@hadoku/watchparty-ui 0.44.3 → 0.44.5

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.
Files changed (22) hide show
  1. package/dist/chunks/{AdminPanel-DAoc4unj.js → AdminPanel-D8enrakS.js} +4 -4
  2. package/dist/chunks/{AdminPanel-DAoc4unj.js.map → AdminPanel-D8enrakS.js.map} +1 -1
  3. package/dist/chunks/{CharacterModal-Doc-Va6V.js → CharacterModal-BvKgFeXp.js} +2 -2
  4. package/dist/chunks/{CharacterModal-Doc-Va6V.js.map → CharacterModal-BvKgFeXp.js.map} +1 -1
  5. package/dist/chunks/{GameModule-C9L3B_xh.js → GameModule-DCJB67lD.js} +4 -4
  6. package/dist/chunks/{GameModule-C9L3B_xh.js.map → GameModule-DCJB67lD.js.map} +1 -1
  7. package/dist/chunks/{MapEditor-BTSHw1Xb.js → MapEditor-RPCxlQKS.js} +2 -2
  8. package/dist/chunks/{MapEditor-BTSHw1Xb.js.map → MapEditor-RPCxlQKS.js.map} +1 -1
  9. package/dist/chunks/{MediaDrawer-DY7Rc7Bm.js → MediaDrawer-DD5kS4Qx.js} +4 -4
  10. package/dist/chunks/{MediaDrawer-DY7Rc7Bm.js.map → MediaDrawer-DD5kS4Qx.js.map} +1 -1
  11. package/dist/chunks/{PlaylistPanel-KoHnRQN9.js → PlaylistPanel-C91LS3wt.js} +3 -3
  12. package/dist/chunks/{PlaylistPanel-KoHnRQN9.js.map → PlaylistPanel-C91LS3wt.js.map} +1 -1
  13. package/dist/chunks/{Room-C4jnGrvL.js → Room-D9ctqJMZ.js} +376 -367
  14. package/dist/chunks/Room-D9ctqJMZ.js.map +1 -0
  15. package/dist/chunks/{index-0c7HI7Ol.js → index-BFFDpKNA.js} +3 -3
  16. package/dist/chunks/{index-0c7HI7Ol.js.map → index-BFFDpKNA.js.map} +1 -1
  17. package/dist/chunks/{submissionsApi-DL6BTffE.js → submissionsApi-680RUJv6.js} +2 -2
  18. package/dist/chunks/{submissionsApi-DL6BTffE.js.map → submissionsApi-680RUJv6.js.map} +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/room-chrome.js.map +1 -1
  21. package/package.json +3 -3
  22. package/dist/chunks/Room-C4jnGrvL.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { jsx as l, jsxs as M, Fragment as be } from "react/jsx-runtime";
2
- import Be, { useState as $, useRef as N, useEffect as F, useCallback as U, useMemo as ke, Component as Lr, useContext as $r, createContext as Br, useId as Dr, useEffectEvent as Dt, useLayoutEffect as Pr } from "react";
3
- import { k as Or, M as Hr, m as Ur, f as jr, a as Gr, b as at, c as Wt, i as Wr, S as Vr, r as pt, d as w, e as ue, h as S, j as Pe, l as Oe, s as He, D as tt, w as T, n as Nn, o as Kr, p as Ln, q as $n, t as Bn, v as zr, L as Jr, x as Qr, y as ct, z as qr, A as Xr, B as Yr, E as Zr, F as Dn, G as Vt, H as Pn, I as On, J as es, K as ts, N as Me, O as ln, T as Et, P as ns, Q as Hn, R as Se, g as rs, U as Un, V as jn, W as Ke, X as ss, Y as as, Z as is, _ as os, $ as cs, a0 as dn, a1 as je, a2 as ls, a3 as un, a4 as ds, a5 as us, a6 as fn, a7 as fs, a8 as hs, a9 as ps, aa as ms, ab as gs, ac as hn, ad as pn, ae as Gn, af as Wn, ag as mn, ah as bs, ai as dt, aj as ys, ak as vs, al as Ss, am as ws, an as xs, ao as Es, ap as Ms, aq as ks, ar as _s } from "./index-0c7HI7Ol.js";
2
+ import Be, { useState as $, useRef as N, useEffect as F, useCallback as U, useMemo as ke, Component as Lr, useContext as $r, createContext as Br, useId as Dr, useEffectEvent as Dt } from "react";
3
+ import { k as Pr, M as Or, m as Hr, f as Ur, a as jr, b as at, c as Wt, i as Gr, S as Wr, r as pt, d as w, e as ue, h as S, j as Pe, l as Oe, s as He, D as tt, w as T, n as Nn, o as Vr, p as Ln, q as $n, t as Bn, v as Kr, L as zr, x as Jr, y as ct, z as Qr, A as qr, B as Xr, E as Yr, F as Dn, G as Vt, H as Pn, I as On, J as Zr, K as es, N as Me, O as ln, T as Et, P as ts, Q as Hn, R as Se, g as ns, U as Un, V as jn, W as Ke, X as rs, Y as ss, Z as as, _ as is, $ as os, a0 as dn, a1 as je, a2 as cs, a3 as un, a4 as ls, a5 as ds, a6 as fn, a7 as us, a8 as fs, a9 as hs, aa as ps, ab as ms, ac as hn, ad as pn, ae as Gn, af as Wn, ag as mn, ah as gs, ai as dt, aj as bs, ak as ys, al as vs, am as Ss, an as ws, ao as xs, ap as Es, aq as Ms, ar as ks } from "./index-BFFDpKNA.js";
4
4
  import { createPortal as gt } from "react-dom";
5
- import { Icon as it, THEMES as Ts, useHadokuThemeOptional as As } from "@wolffm/themes";
6
- import { HadokuThemePicker as Cs } from "@wolffm/task-ui-components";
7
- import { createRoot as Is } from "react-dom/client";
8
- function Rs(n) {
5
+ import { Icon as it, THEMES as _s, useHadokuThemeOptional as Ts } from "@wolffm/themes";
6
+ import { HadokuThemePicker as As } from "@wolffm/task-ui-components";
7
+ import { createRoot as Cs } from "react-dom/client";
8
+ function Is(n) {
9
9
  return n.kind === "file";
10
10
  }
11
11
  class Vn extends Error {
@@ -33,42 +33,42 @@ function ht(n) {
33
33
  return "Image upload failed";
34
34
  }
35
35
  }
36
- function Fs(n) {
36
+ function Rs(n) {
37
37
  return n instanceof at ? ht(n.reason) : n instanceof Vn ? n.message : "Image upload failed";
38
38
  }
39
- function Ns(n) {
39
+ function Fs(n) {
40
40
  const e = n.type.toLowerCase().split(";")[0].trim();
41
- return e && Or(e) !== "image" ? ht("unsupported-type") : n.size > Hr.image ? ht("too-large") : n.size === 0 ? ht("invalid") : null;
41
+ return e && Pr(e) !== "image" ? ht("unsupported-type") : n.size > Or.image ? ht("too-large") : n.size === 0 ? ht("invalid") : null;
42
+ }
43
+ function Ns(n) {
44
+ return Ur(n);
42
45
  }
43
46
  function Ls(n) {
44
47
  return jr(n);
45
48
  }
46
- function $s(n) {
47
- return Gr(n);
48
- }
49
- async function Bs(n) {
50
- const e = await Ur(n);
49
+ async function $s(n) {
50
+ const e = await Hr(n);
51
51
  return { w: e?.width ?? 0, h: e?.height ?? 0 };
52
52
  }
53
- async function Ds(n, e = {}) {
53
+ async function Bs(n, e = {}) {
54
54
  const t = await Wt().upload(n, { signal: e.signal });
55
- if (!Wr(t.key))
55
+ if (!Gr(t.key))
56
56
  throw new Vn("Image upload returned an unusable key");
57
57
  return { key: t.key, deduplicated: t.deduplicated === !0 };
58
58
  }
59
- async function Ps(n, e = {}) {
59
+ async function Ds(n, e = {}) {
60
60
  const t = [];
61
61
  for (const r of n) {
62
62
  if (r.kind === "remote") {
63
63
  t.push({ key: r.key, w: r.w, h: r.h, ...r.title ? { title: r.title } : {} });
64
64
  continue;
65
65
  }
66
- const { key: s } = await Ds(r.file, e);
66
+ const { key: s } = await Bs(r.file, e);
67
67
  t.push({ key: s, w: r.w, h: r.h });
68
68
  }
69
69
  return t;
70
70
  }
71
- function Os(n) {
71
+ function Ps(n) {
72
72
  return {
73
73
  error: n instanceof Error ? n.message : String(n),
74
74
  name: n instanceof Error ? n.name : typeof n,
@@ -76,14 +76,14 @@ function Os(n) {
76
76
  status: n instanceof at ? n.status : void 0
77
77
  };
78
78
  }
79
- function Hs(n) {
79
+ function Os(n) {
80
80
  const e = N(n);
81
81
  return F(() => {
82
82
  e.current = n;
83
83
  }), [e, `${n.cdnBase}|${n.uploadPath}`];
84
84
  }
85
- function Us(n, e, t, r = {}) {
86
- const { limit: s, debounceMs: i = Vr } = r, [a, d] = Hs(n), [c, o] = $([]), [u, f] = $(null), [b, x] = $(!1), [y, h] = $(null), [m, _] = $(0), g = N(null);
85
+ function Hs(n, e, t, r = {}) {
86
+ const { limit: s, debounceMs: i = Wr } = r, [a, d] = Os(n), [c, o] = $([]), [u, f] = $(null), [b, x] = $(!1), [y, h] = $(null), [m, _] = $(0), g = N(null);
87
87
  F(() => {
88
88
  _(0), f(null);
89
89
  }, [t, e]), F(() => {
@@ -127,17 +127,17 @@ function Us(n, e, t, r = {}) {
127
127
  }, [b, u]);
128
128
  return { items: c, loading: b, error: y, hasMore: u !== null, loadMore: v };
129
129
  }
130
- const Pt = 240, Ne = 8, js = 28, Kn = 240;
131
- function Gs(n, e, t) {
130
+ const Pt = 240, Ne = 8, Us = 28, Kn = 240;
131
+ function js(n, e, t) {
132
132
  let r = e.left - Pt - Ne;
133
133
  r < Ne && (r = e.right + Ne), r = Math.min(r, t.width - Pt - Ne), r = Math.max(Ne, r);
134
- const s = Kn + js;
134
+ const s = Kn + Us;
135
135
  let i = n.top + n.height / 2 - s / 2;
136
136
  return i = Math.min(i, t.height - s - Ne), i = Math.max(Ne, i), { left: r, top: i };
137
137
  }
138
- const zn = "/dataplatform/api/memes", Ws = 120;
139
- function Vs({ onClose: n, onPick: e, onUnavailable: t }) {
140
- const [r, s] = $(""), i = N(null), a = N(null), d = Wt(), { items: c, loading: o, error: u, hasMore: f, loadMore: b } = Us(
138
+ const zn = "/dataplatform/api/memes", Gs = 120;
139
+ function Ws({ onClose: n, onPick: e, onUnavailable: t }) {
140
+ const [r, s] = $(""), i = N(null), a = N(null), d = Wt(), { items: c, loading: o, error: u, hasMore: f, loadMore: b } = Hs(
141
141
  d,
142
142
  zn,
143
143
  r.trim()
@@ -154,12 +154,12 @@ function Vs({ onClose: n, onPick: e, onUnavailable: t }) {
154
154
  if (!j) return;
155
155
  const P = () => m({
156
156
  item: p,
157
- ...Gs(A.getBoundingClientRect(), j.getBoundingClientRect(), {
157
+ ...js(A.getBoundingClientRect(), j.getBoundingClientRect(), {
158
158
  width: window.innerWidth,
159
159
  height: window.innerHeight
160
160
  })
161
161
  });
162
- g(), C ? P() : _.current = window.setTimeout(P, Ws);
162
+ g(), C ? P() : _.current = window.setTimeout(P, Gs);
163
163
  },
164
164
  [g]
165
165
  );
@@ -302,12 +302,12 @@ function Vs({ onClose: n, onPick: e, onUnavailable: t }) {
302
302
  );
303
303
  }
304
304
  function Jn({ open: n, ...e }) {
305
- return n ? /* @__PURE__ */ l(Vs, { ...e }) : null;
305
+ return n ? /* @__PURE__ */ l(Ws, { ...e }) : null;
306
306
  }
307
- function Ks(n) {
307
+ function Vs(n) {
308
308
  return typeof n == "object" && n !== null && typeof n.mount == "function";
309
309
  }
310
- function zs(n) {
310
+ function Ks(n) {
311
311
  return typeof n == "object" && n !== null && typeof n.unmount == "function" && typeof n.update == "function";
312
312
  }
313
313
  const Ot = "watchparty:open-media-drawer";
@@ -351,21 +351,21 @@ function zt(n) {
351
351
  function Jt(n) {
352
352
  return n.isLeader ? zt(n) ? n.gameOverlay && !n.isFullscreen ? "room-corner" : "control-bar" : "chat-toolbar" : "none";
353
353
  }
354
- function Js(n) {
354
+ function zs(n) {
355
355
  return !(n.button !== 0 || n.ctrlKey || n.metaKey || n.shiftKey || n.altKey);
356
356
  }
357
- const Qs = Br(null);
358
- function qs() {
359
- return $r(Qs);
357
+ const Js = Br(null);
358
+ function Qs() {
359
+ return $r(Js);
360
360
  }
361
- function Xs({ src: n, title: e, onClose: t }) {
361
+ function qs({ src: n, title: e, onClose: t }) {
362
362
  F(() => {
363
363
  const i = (a) => {
364
364
  a.key === "Escape" && (a.stopPropagation(), t());
365
365
  };
366
366
  return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
367
367
  }, [t]);
368
- const r = qs(), s = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
368
+ const r = Qs(), s = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
369
369
  return s ? gt(
370
370
  /* @__PURE__ */ M(
371
371
  "div",
@@ -404,11 +404,11 @@ function Xs({ src: n, title: e, onClose: t }) {
404
404
  s
405
405
  ) : null;
406
406
  }
407
- const Mt = 240, Ys = 320;
408
- function Zs({ image: n }) {
407
+ const Mt = 240, Xs = 320;
408
+ function Ys({ image: n }) {
409
409
  const [e, t] = $(!1), r = pt(n.key);
410
410
  if (!r) return null;
411
- const s = n.w > 0 && n.h > 0, i = s ? Math.min(1, Ys / n.w, Mt / n.h) : 1;
411
+ const s = n.w > 0 && n.h > 0, i = s ? Math.min(1, Xs / n.w, Mt / n.h) : 1;
412
412
  return /* @__PURE__ */ M(be, { children: [
413
413
  /* @__PURE__ */ l(
414
414
  "a",
@@ -419,7 +419,7 @@ function Zs({ image: n }) {
419
419
  className: "block max-w-full cursor-zoom-in",
420
420
  "data-testid": "chat-image",
421
421
  onClick: (a) => {
422
- Js(a) && (a.preventDefault(), t(!0));
422
+ zs(a) && (a.preventDefault(), t(!0));
423
423
  },
424
424
  children: /* @__PURE__ */ l(
425
425
  "img",
@@ -437,7 +437,7 @@ function Zs({ image: n }) {
437
437
  }
438
438
  ),
439
439
  e && /* @__PURE__ */ l(
440
- Xs,
440
+ qs,
441
441
  {
442
442
  src: r,
443
443
  title: n.title,
@@ -447,16 +447,16 @@ function Zs({ image: n }) {
447
447
  ] });
448
448
  }
449
449
  function qn({ images: n }) {
450
- return n?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: n.map((e, t) => /* @__PURE__ */ l(Zs, { image: e }, `${e.key}-${t}`)) }) : null;
450
+ return n?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: n.map((e, t) => /* @__PURE__ */ l(Ys, { image: e }, `${e.key}-${t}`)) }) : null;
451
451
  }
452
- function ea(n, e) {
452
+ function Zs(n, e) {
453
453
  return n.author && e.author ? n.author === e.author : !!e.clientId && n.clientId === e.clientId;
454
454
  }
455
455
  function kt(n) {
456
456
  return new Date(n).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
457
457
  }
458
- const ta = Be.memo(function({ message: e }) {
459
- const t = S((a) => a.me.clientId), r = S((a) => a.me.clientId ? a.roster[a.me.clientId]?.author : void 0), s = ea(e, { clientId: t, author: r });
458
+ const ea = Be.memo(function({ message: e }) {
459
+ const t = S((a) => a.me.clientId), r = S((a) => a.me.clientId ? a.roster[a.me.clientId]?.author : void 0), s = Zs(e, { clientId: t, author: r });
460
460
  if (e.isSystem && e.systemType === "recap")
461
461
  return /* @__PURE__ */ l("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ M("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
462
462
  /* @__PURE__ */ M("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
@@ -489,7 +489,7 @@ const ta = Be.memo(function({ message: e }) {
489
489
  ] })
490
490
  ] });
491
491
  });
492
- function na() {
492
+ function ta() {
493
493
  const n = S((s) => s.chat), e = N(null), t = N(!1), r = U(() => {
494
494
  const s = e.current;
495
495
  if (!s) return;
@@ -513,7 +513,7 @@ function na() {
513
513
  /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(s.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
514
514
  /* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" })
515
515
  ] }),
516
- /* @__PURE__ */ l(ta, { message: s })
516
+ /* @__PURE__ */ l(ea, { message: s })
517
517
  ] }, s.id);
518
518
  }) })
519
519
  }
@@ -546,12 +546,12 @@ const Qt = [
546
546
  scope: "local"
547
547
  }
548
548
  ], Je = "/";
549
- function ra(n) {
549
+ function na(n) {
550
550
  if (!n.startsWith(Je)) return null;
551
551
  const e = n.slice(Je.length);
552
552
  return /\s/.test(e) ? null : e.toLowerCase();
553
553
  }
554
- function sa(n, e = Qt) {
554
+ function ra(n, e = Qt) {
555
555
  const t = n.toLowerCase();
556
556
  if (!t) return [...e].sort((s, i) => s.name.localeCompare(i.name));
557
557
  const r = [];
@@ -561,23 +561,23 @@ function sa(n, e = Qt) {
561
561
  }
562
562
  return r.sort((s, i) => s.rank - i.rank || s.cmd.name.localeCompare(i.cmd.name)).map((s) => s.cmd);
563
563
  }
564
- function aa(n) {
564
+ function sa(n) {
565
565
  return `${Je}${n.name} `;
566
566
  }
567
567
  function _t(n, e) {
568
568
  return e <= 0 ? 0 : (n % e + e) % e;
569
569
  }
570
- function ia(n, e = Qt) {
570
+ function aa(n, e = Qt) {
571
571
  const t = n.trim();
572
572
  if (!t) return null;
573
573
  if (!t.startsWith(Je)) return { kind: "chat", text: t };
574
574
  const r = t.slice(Je.length), s = r.search(/\s/), i = (s === -1 ? r : r.slice(0, s)).toLowerCase(), a = s === -1 ? "" : r.slice(s).trim(), d = e.find((c) => c.name.toLowerCase() === i);
575
575
  return d ? { kind: "command", command: d, args: a } : { kind: "chat", text: t };
576
576
  }
577
- function oa(n, e) {
577
+ function ia(n, e) {
578
578
  return n.requiresMedia && !e.hasMedia ? `${Je}${n.name} needs an episode loaded.` : null;
579
579
  }
580
- function ca({
580
+ function oa({
581
581
  commands: n,
582
582
  activeIndex: e,
583
583
  hasMedia: t,
@@ -653,17 +653,17 @@ function Yn() {
653
653
  i.current.clear();
654
654
  }, []);
655
655
  const a = U((h) => {
656
- Rs(h) && (URL.revokeObjectURL(h.previewUrl), i.current.delete(h.previewUrl));
656
+ Is(h) && (URL.revokeObjectURL(h.previewUrl), i.current.delete(h.previewUrl));
657
657
  }, []), d = U(async (h) => {
658
658
  if (!h.length) return;
659
659
  const m = [];
660
660
  for (const _ of h) {
661
- const g = Ns(_);
661
+ const g = Fs(_);
662
662
  if (g) {
663
663
  s("error", g);
664
664
  continue;
665
665
  }
666
- const { w: v, h: k } = await Bs(_), R = URL.createObjectURL(_);
666
+ const { w: v, h: k } = await $s(_), R = URL.createObjectURL(_);
667
667
  i.current.add(R), m.push({
668
668
  kind: "file",
669
669
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
@@ -710,10 +710,10 @@ function Yn() {
710
710
  return [];
711
711
  });
712
712
  }, [a]), f = U((h) => {
713
- const m = Ls(h.clipboardData);
713
+ const m = Ns(h.clipboardData);
714
714
  m.length && (h.preventDefault(), d(m));
715
715
  }, [d]), b = U((h) => {
716
- const m = $s(h.dataTransfer);
716
+ const m = Ls(h.dataTransfer);
717
717
  m.length && (h.preventDefault(), d(m));
718
718
  }, [d]), x = U((h) => {
719
719
  h.dataTransfer?.types?.includes("Files") && h.preventDefault();
@@ -721,9 +721,9 @@ function Yn() {
721
721
  if (!n.length) return [];
722
722
  r(!0);
723
723
  try {
724
- return await Ps(n);
724
+ return await Ds(n);
725
725
  } catch (h) {
726
- return T("chat", "Image upload failed", Os(h)), s("error", Fs(h)), null;
726
+ return T("chat", "Image upload failed", Ps(h)), s("error", Rs(h)), null;
727
727
  } finally {
728
728
  r(!1);
729
729
  }
@@ -741,16 +741,16 @@ function Yn() {
741
741
  onDragOver: x
742
742
  };
743
743
  }
744
- const gn = Bn, la = $n;
745
- function da({ commands: n = Qt }) {
746
- const [e, t] = $(""), [r, s] = $(!1), [i, a] = $({ q: null, i: 0 }), [d, c] = $(!1), o = N(null), u = Dr(), [f, b] = $(!1), [x, y] = $(!1), h = Yn(), m = S((L) => L.snapshot.mediaId), _ = S((L) => L.pushToast), g = S((L) => L.setTierlistOpen), v = S((L) => L.setCharacterModalOpen), k = !!m, R = ra(e), I = ke(
747
- () => R === null ? [] : sa(R, n),
744
+ const gn = Bn, ca = $n;
745
+ function la({ commands: n = Qt }) {
746
+ const [e, t] = $(""), [r, s] = $(!1), [i, a] = $({ q: null, i: 0 }), [d, c] = $(!1), o = N(null), u = Dr(), [f, b] = $(!1), [x, y] = $(!1), h = Yn(), m = S((L) => L.snapshot.mediaId), _ = S((L) => L.pushToast), g = S((L) => L.setTierlistOpen), v = S((L) => L.setCharacterModalOpen), k = !!m, R = na(e), I = ke(
747
+ () => R === null ? [] : ra(R, n),
748
748
  [R, n]
749
749
  ), B = R !== null && !d && I.length > 0, p = i.q === R ? _t(i.i, I.length) : 0, A = U(
750
750
  (L) => a({ q: R, i: L }),
751
751
  [R]
752
752
  ), C = U((L, O) => {
753
- const ee = oa(L, { hasMedia: k });
753
+ const ee = ia(L, { hasMedia: k });
754
754
  if (ee) {
755
755
  _("info", ee);
756
756
  return;
@@ -760,7 +760,7 @@ function da({ commands: n = Qt }) {
760
760
  _("info", n.map((ne) => ne.usage).join(" "));
761
761
  break;
762
762
  case "recap":
763
- Kr();
763
+ Vr();
764
764
  break;
765
765
  case "tierlist":
766
766
  Nn(), g(!0);
@@ -772,10 +772,10 @@ function da({ commands: n = Qt }) {
772
772
  _("info", `${L.usage} is not implemented yet.`);
773
773
  }
774
774
  }, [k, _, n, g, v]), j = U((L) => {
775
- t(aa(L)), c(!1), o.current?.focus();
775
+ t(sa(L)), c(!1), o.current?.focus();
776
776
  }, []), P = U(async (L) => {
777
777
  if (L.preventDefault(), r || h.uploading) return;
778
- const O = ia(e, n);
778
+ const O = aa(e, n);
779
779
  if (!O && !h.pending.length) return;
780
780
  if (O?.kind === "command" && h.pending.length) {
781
781
  _("info", "Send images on their own, not with a command.");
@@ -786,7 +786,7 @@ function da({ commands: n = Qt }) {
786
786
  return;
787
787
  }
788
788
  const ee = await h.uploadPending();
789
- ee !== null && (Ln(O?.text ?? "", ee), t(""), h.clear(), s(!0), setTimeout(() => s(!1), la), !document.hidden && document.hasFocus() && o.current?.focus());
789
+ ee !== null && (Ln(O?.text ?? "", ee), t(""), h.clear(), s(!0), setTimeout(() => s(!1), ca), !document.hidden && document.hasFocus() && o.current?.focus());
790
790
  }, [e, r, C, h, _, n]), W = U((L) => {
791
791
  if (L.key === "Escape" && B) {
792
792
  L.preventDefault(), c(!0);
@@ -829,7 +829,7 @@ function da({ commands: n = Qt }) {
829
829
  /* @__PURE__ */ l(Xn, { pending: h.pending, uploading: h.uploading, onRemove: h.remove }),
830
830
  /* @__PURE__ */ M("div", { className: "relative", children: [
831
831
  B && /* @__PURE__ */ l(
832
- ca,
832
+ oa,
833
833
  {
834
834
  commands: I,
835
835
  activeIndex: p,
@@ -893,7 +893,7 @@ function da({ commands: n = Qt }) {
893
893
  }
894
894
  );
895
895
  }
896
- function ua() {
896
+ function da() {
897
897
  const n = S((t) => t.roster), e = Object.values(n);
898
898
  return e.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: e.map((t) => {
899
899
  const r = Pe(t.sprite);
@@ -912,7 +912,7 @@ function ua() {
912
912
  ] }, t.clientId);
913
913
  }) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
914
914
  }
915
- function fa() {
915
+ function ua() {
916
916
  const n = S((s) => Object.keys(s.roster).length), [e, t] = $(!1), r = N(null);
917
917
  return F(() => {
918
918
  if (!e) return;
@@ -940,11 +940,11 @@ function fa() {
940
940
  n,
941
941
  " online"
942
942
  ] }),
943
- /* @__PURE__ */ l(ua, {})
943
+ /* @__PURE__ */ l(da, {})
944
944
  ] })
945
945
  ] });
946
946
  }
947
- function ha() {
947
+ function fa() {
948
948
  const n = S((t) => t.sprite), e = S((t) => t.setCharacterModalOpen);
949
949
  return /* @__PURE__ */ l(
950
950
  "button",
@@ -967,44 +967,57 @@ function ha() {
967
967
  }
968
968
  );
969
969
  }
970
- function pa({ leaderId: n, clientId: e, keyType: t }) {
970
+ function ha({ leaderId: n, clientId: e, keyType: t }) {
971
971
  return n !== null ? n === e : t === "leader";
972
972
  }
973
- const ma = /-[0-9a-fA-F]{16}$/;
974
- function ga(n) {
975
- return n && ma.test(n) ? "leader" : null;
973
+ const pa = /-[0-9a-fA-F]{16}$/;
974
+ function ma(n) {
975
+ return n && pa.test(n) ? "leader" : null;
976
+ }
977
+ const ga = /\/room\/([^/]+)\/?$/;
978
+ function ba(n) {
979
+ const e = n ? ga.exec(n) : null;
980
+ if (!e) return null;
981
+ try {
982
+ return decodeURIComponent(e[1]);
983
+ } catch {
984
+ return e[1];
985
+ }
986
+ }
987
+ function ya(n, e) {
988
+ return n && e?.roomKey === n ? e.type : ma(n);
976
989
  }
977
990
  function Qe() {
978
991
  return S((n) => !!n.snapshot.leaderId && n.snapshot.leaderId === n.me.clientId);
979
992
  }
980
993
  function bt() {
981
- const n = S((t) => t.activeGameId), e = zr();
994
+ const n = S((t) => t.activeGameId), e = Kr();
982
995
  return n ? e.find((t) => t.id === n) ?? null : null;
983
996
  }
984
997
  function qt() {
985
- return S((n) => pa({
998
+ return S((n) => ha({
986
999
  leaderId: n.snapshot.leaderId,
987
1000
  clientId: n.me.clientId,
988
- keyType: n.roomKeyType
1001
+ keyType: ya(ba(globalThis.location?.pathname), n.roomKeyType)
989
1002
  }));
990
1003
  }
991
1004
  function Zn() {
992
1005
  return S((n) => n.readiness);
993
1006
  }
994
- function ba() {
1007
+ function va() {
995
1008
  return S((n) => n.snapshot);
996
1009
  }
997
- const ya = 3e4;
1010
+ const Sa = 3e4;
998
1011
  function er() {
999
1012
  const n = Zn(), [e, t] = $(!1);
1000
1013
  return F(() => {
1001
1014
  if (t(!1), n.ready) return;
1002
- const r = setTimeout(() => t(!0), ya);
1015
+ const r = setTimeout(() => t(!0), Sa);
1003
1016
  return () => clearTimeout(r);
1004
1017
  }, [n.mediaId, n.ready]), e;
1005
1018
  }
1006
- const va = ct(() => import("./AdminPanel-DAoc4unj.js")), Sa = ct(() => import("./PlaylistPanel-KoHnRQN9.js"));
1007
- function wa() {
1019
+ const wa = ct(() => import("./AdminPanel-D8enrakS.js")), xa = ct(() => import("./PlaylistPanel-C91LS3wt.js"));
1020
+ function Ea() {
1008
1021
  const n = S((f) => f.chatCollapsed), e = Kt(), t = S((f) => f.sidebarTab), r = S((f) => f.setSidebarTab), s = S((f) => f.healthSnapshot?.clients.length ?? 0), i = S((f) => !!f.playlist), a = Qe(), d = qt(), c = S((f) => f.snapshot.mediaId), o = bt() !== null;
1009
1022
  if (zt({ hasMedia: !!c, chatCollapsed: n, isFullscreen: e }))
1010
1023
  return null;
@@ -1012,14 +1025,14 @@ function wa() {
1012
1025
  return /* @__PURE__ */ M("aside", { className: "w-80 self-stretch border-l border-border flex flex-col bg-bg relative z-10", children: [
1013
1026
  /* @__PURE__ */ M("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
1014
1027
  /* @__PURE__ */ l(
1015
- Jr,
1028
+ zr,
1016
1029
  {
1017
1030
  to: "/",
1018
1031
  className: "p-1.5 rounded text-text-secondary hover:text-white hover:bg-bg-alt transition-colors cursor-pointer",
1019
1032
  title: "Home",
1020
1033
  "aria-label": "Home",
1021
1034
  onClick: () => {
1022
- w("navigation", "Home button clicked (chat toolbar)"), Qr();
1035
+ w("navigation", "Home button clicked (chat toolbar)"), Jr();
1023
1036
  },
1024
1037
  children: /* @__PURE__ */ l("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" }) })
1025
1038
  }
@@ -1034,9 +1047,9 @@ function wa() {
1034
1047
  children: /* @__PURE__ */ l("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 4h16a1 1 0 011 1v14a1 1 0 01-1 1H4a1 1 0 01-1-1V5a1 1 0 011-1z" }) })
1035
1048
  }
1036
1049
  ),
1037
- /* @__PURE__ */ l(Cs, {}),
1038
- /* @__PURE__ */ l(fa, {}),
1039
- /* @__PURE__ */ l(ha, {})
1050
+ /* @__PURE__ */ l(As, {}),
1051
+ /* @__PURE__ */ l(ua, {}),
1052
+ /* @__PURE__ */ l(fa, {})
1040
1053
  ] }),
1041
1054
  (a || i) && /* @__PURE__ */ M("div", { className: "flex border-b border-border shrink-0", children: [
1042
1055
  /* @__PURE__ */ l(
@@ -1067,30 +1080,30 @@ function wa() {
1067
1080
  }
1068
1081
  )
1069
1082
  ] }),
1070
- u === "health" ? /* @__PURE__ */ l(Be.Suspense, { fallback: /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ l(va, {}) }) : u === "playlist" ? /* @__PURE__ */ l(Be.Suspense, { fallback: /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ l(Sa, {}) }) : /* @__PURE__ */ M(be, { children: [
1071
- /* @__PURE__ */ l(na, {}),
1072
- /* @__PURE__ */ l(da, {})
1083
+ u === "health" ? /* @__PURE__ */ l(Be.Suspense, { fallback: /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ l(wa, {}) }) : u === "playlist" ? /* @__PURE__ */ l(Be.Suspense, { fallback: /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ l(xa, {}) }) : /* @__PURE__ */ M(be, { children: [
1084
+ /* @__PURE__ */ l(ta, {}),
1085
+ /* @__PURE__ */ l(la, {})
1073
1086
  ] })
1074
1087
  ] });
1075
1088
  }
1076
- const bn = (n) => typeof n == "string" && Ts.includes(n);
1077
- function xa(n, e, t) {
1089
+ const bn = (n) => typeof n == "string" && _s.includes(n);
1090
+ function Ma(n, e, t) {
1078
1091
  return bn(e) ? e : bn(t) ? t : "dark";
1079
1092
  }
1080
- function Ea(n, e) {
1081
- if (!qr(n)) return null;
1093
+ function ka(n, e) {
1094
+ if (!Qr(n)) return null;
1082
1095
  const t = new URL(n, e);
1083
1096
  return t.origin === e ? t.href : null;
1084
1097
  }
1085
- function Ma(n, e) {
1086
- const t = Ea(n.url, e);
1098
+ function _a(n, e) {
1099
+ const t = ka(n.url, e);
1087
1100
  return { id: n.id, name: n.name, load: t ? () => import(
1088
1101
  /* @vite-ignore */
1089
1102
  t
1090
1103
  ) : null };
1091
1104
  }
1092
1105
  const ut = (n) => n instanceof Error ? n.message : String(n);
1093
- function ka(n) {
1106
+ function Ta(n) {
1094
1107
  let e = n.ctx, t = null, r = !1, s = !1;
1095
1108
  const i = (c) => {
1096
1109
  try {
@@ -1120,7 +1133,7 @@ function ka(n) {
1120
1133
  return;
1121
1134
  }
1122
1135
  if (r) return;
1123
- if (!Ks(c)) {
1136
+ if (!Vs(c)) {
1124
1137
  a("the game module does not export mount()");
1125
1138
  return;
1126
1139
  }
@@ -1132,7 +1145,7 @@ function ka(n) {
1132
1145
  a(`the game failed to start: ${ut(f)}`, f);
1133
1146
  return;
1134
1147
  }
1135
- if (!zs(u)) {
1148
+ if (!Ks(u)) {
1136
1149
  a("the game's mount() did not return { unmount, update }");
1137
1150
  return;
1138
1151
  }
@@ -1149,12 +1162,12 @@ function ka(n) {
1149
1162
  };
1150
1163
  }
1151
1164
  function yn({ activity: n, roomKey: e, layer: t }) {
1152
- const r = N(null), s = N(null), [i, a] = $(null), [d, c] = $(!1), o = S((v) => v.snapshot.leaderId), u = S((v) => v.me.clientId), f = !!o && o === u, b = S((v) => v.name), x = As()?.theme, y = xa(void 0, x, Xr().theme), h = ke(() => ({
1165
+ const r = N(null), s = N(null), [i, a] = $(null), [d, c] = $(!1), o = S((v) => v.snapshot.leaderId), u = S((v) => v.me.clientId), f = !!o && o === u, b = S((v) => v.name), x = Ts()?.theme, y = Ma(void 0, x, qr().theme), h = ke(() => ({
1153
1166
  roomKey: e,
1154
1167
  identity: {
1155
1168
  // The registry userId — what RoomChrome's `userId` prop is.
1156
- userId: Zr(),
1157
- userType: Yr(),
1169
+ userId: Yr(),
1170
+ userType: Xr(),
1158
1171
  name: b || null
1159
1172
  },
1160
1173
  theme: y,
@@ -1169,7 +1182,7 @@ function yn({ activity: n, roomKey: e, layer: t }) {
1169
1182
  const v = r.current, k = n.load;
1170
1183
  if (!v || !k || d) return;
1171
1184
  w("game", "bundle mount", { gameId: n.id });
1172
- const R = ka({
1185
+ const R = Ta({
1173
1186
  load: k,
1174
1187
  el: v,
1175
1188
  ctx: m(),
@@ -1202,8 +1215,8 @@ function yn({ activity: n, roomKey: e, layer: t }) {
1202
1215
  }
1203
1216
  );
1204
1217
  }
1205
- const _a = "drawer-btn";
1206
- function Ta({ open: n, onClose: e, header: t, footer: r, children: s }) {
1218
+ const Aa = "drawer-btn";
1219
+ function Ca({ open: n, onClose: e, header: t, footer: r, children: s }) {
1207
1220
  return F(() => {
1208
1221
  if (!n) return;
1209
1222
  function i(a) {
@@ -1217,7 +1230,7 @@ function Ta({ open: n, onClose: e, header: t, footer: r, children: s }) {
1217
1230
  onClick: (i) => i.stopPropagation(),
1218
1231
  children: [
1219
1232
  /* @__PURE__ */ M("div", { className: "p-3 border-b border-border flex items-center gap-2 text-sm", children: [
1220
- /* @__PURE__ */ l("button", { onClick: e, className: _a, children: "Close" }),
1233
+ /* @__PURE__ */ l("button", { onClick: e, className: Aa, children: "Close" }),
1221
1234
  t
1222
1235
  ] }),
1223
1236
  s,
@@ -1226,20 +1239,20 @@ function Ta({ open: n, onClose: e, header: t, footer: r, children: s }) {
1226
1239
  }
1227
1240
  ) }) : null;
1228
1241
  }
1229
- function Aa({ open: n, onClose: e }) {
1230
- return /* @__PURE__ */ l(Ta, { open: n, onClose: e, children: /* @__PURE__ */ l("div", { className: "px-4 py-3 text-xs text-text-muted", children: "Loading…" }) });
1242
+ function Ia({ open: n, onClose: e }) {
1243
+ return /* @__PURE__ */ l(Ca, { open: n, onClose: e, children: /* @__PURE__ */ l("div", { className: "px-4 py-3 text-xs text-text-muted", children: "Loading…" }) });
1231
1244
  }
1232
- const tr = 9e3, vn = 1500, Ca = {
1245
+ const tr = 9e3, vn = 1500, Ra = {
1233
1246
  classic: "[text-shadow:_-1px_-1px_0_#000,_1px_-1px_0_#000,_-1px_1px_0_#000,_1px_1px_0_#000,_0_-1px_0_#000,_0_1px_0_#000,_-1px_0_0_#000,_1px_0_0_#000]",
1234
1247
  cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
1235
1248
  minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
1236
1249
  contrast: "bg-black/70 px-2 py-0.5 rounded"
1237
1250
  };
1238
- function Ia({ message: n, age: e, ccStyle: t }) {
1251
+ function Fa({ message: n, age: e, ccStyle: t }) {
1239
1252
  const r = tr - vn;
1240
1253
  let s = 1;
1241
1254
  e > r && (s = Math.max(0, 1 - (e - r) / vn));
1242
- const i = Ca[t], a = Pe(n.sprite);
1255
+ const i = Ra[t], a = Pe(n.sprite);
1243
1256
  return /* @__PURE__ */ M(
1244
1257
  "div",
1245
1258
  {
@@ -1264,7 +1277,7 @@ function Ia({ message: n, age: e, ccStyle: t }) {
1264
1277
  }
1265
1278
  );
1266
1279
  }
1267
- function Ra() {
1280
+ function Na() {
1268
1281
  const n = S((f) => f.chat), e = S((f) => f.chatCollapsed), t = S((f) => f.floatingChatEnabled), r = S((f) => f.mediaPrefs.subtitleStyle), [s, i] = $(!1), [a, d] = $(Date.now());
1269
1282
  F(() => {
1270
1283
  const f = () => {
@@ -1289,7 +1302,7 @@ function Ra() {
1289
1302
  className: "absolute right-4 w-80 z-20 pointer-events-none flex flex-col",
1290
1303
  style: { bottom: "35%" },
1291
1304
  children: u.map((f) => /* @__PURE__ */ l(
1292
- Ia,
1305
+ Fa,
1293
1306
  {
1294
1307
  message: f,
1295
1308
  age: a - f.ts,
@@ -1300,18 +1313,18 @@ function Ra() {
1300
1313
  }
1301
1314
  );
1302
1315
  }
1303
- const Fa = 2;
1316
+ const La = 2;
1304
1317
  function nr(n) {
1305
1318
  return n.duration_ms > 0 && n.duration_ms - n.playhead_ms <= Vt;
1306
1319
  }
1307
1320
  function rr(n) {
1308
1321
  const e = n.video_ready_state ?? -1;
1309
- return e < 0 ? !0 : !(e <= Fa && n.buffered_ahead_ms > Vt);
1322
+ return e < 0 ? !0 : !(e <= La && n.buffered_ahead_ms > Vt);
1310
1323
  }
1311
- function Vo(n) {
1324
+ function zo(n) {
1312
1325
  return n.playhead_ms === 0 && !n.is_buffering && n.buffered_ahead_ms === 0 ? "idle" : n.is_buffering ? "buffering" : nr(n) ? "healthy" : !rr(n) || n.buffered_ahead_ms <= Pn ? "critical" : n.buffered_ahead_ms <= Vt ? "warning" : "healthy";
1313
1326
  }
1314
- const Ko = {
1327
+ const Jo = {
1315
1328
  idle: "Idle",
1316
1329
  buffering: "Buffering",
1317
1330
  critical: "Critical",
@@ -1368,7 +1381,7 @@ On("__WP_SOUNDS__", {
1368
1381
  off: lr
1369
1382
  });
1370
1383
  const Sn = { on: 0, off: 0 };
1371
- function Na(n, e, t, r) {
1384
+ function $a(n, e, t, r) {
1372
1385
  if (!t || !r) return Sn;
1373
1386
  const s = new Set(n), i = new Set(e);
1374
1387
  let a = 0;
@@ -1377,15 +1390,15 @@ function Na(n, e, t, r) {
1377
1390
  for (const c of s) i.has(c) || d++;
1378
1391
  return a === 0 && d === 0 ? Sn : { on: a, off: d };
1379
1392
  }
1380
- const La = 1200, he = 52, mt = 4, Ut = (he - mt) / 2, wn = 2 * Math.PI * Ut, Ae = he - mt * 2 - 4;
1381
- function $a(n) {
1393
+ const Ba = 1200, he = 52, mt = 4, Ut = (he - mt) / 2, wn = 2 * Math.PI * Ut, Ae = he - mt * 2 - 4;
1394
+ function Da(n) {
1382
1395
  return nr(n) ? !0 : rr(n) ? n.buffered_ahead_ms >= Me : !1;
1383
1396
  }
1384
- function Ba(n) {
1397
+ function Pa(n) {
1385
1398
  return `hsl(${Math.round(n * 120)}, 90%, 55%)`;
1386
1399
  }
1387
- function Da({ client: n, fading: e, onFadeEnd: t }) {
1388
- const r = Math.min(1, n.buffered_ahead_ms / Me), s = wn * (1 - r), i = Ba(r), a = Pe(n.sprite_id);
1400
+ function Oa({ client: n, fading: e, onFadeEnd: t }) {
1401
+ const r = Math.min(1, n.buffered_ahead_ms / Me), s = wn * (1 - r), i = Pa(r), a = Pe(n.sprite_id);
1389
1402
  return /* @__PURE__ */ M(
1390
1403
  "div",
1391
1404
  {
@@ -1393,7 +1406,7 @@ function Da({ client: n, fading: e, onFadeEnd: t }) {
1393
1406
  "data-client-id": n.client_id,
1394
1407
  className: "flex flex-col items-center gap-1",
1395
1408
  style: e ? {
1396
- animation: `bufferFadeOut ${La}ms ease forwards`
1409
+ animation: `bufferFadeOut ${Ba}ms ease forwards`
1397
1410
  } : void 0,
1398
1411
  onAnimationEnd: e ? t : void 0,
1399
1412
  children: [
@@ -1471,7 +1484,7 @@ function Da({ client: n, fading: e, onFadeEnd: t }) {
1471
1484
  }
1472
1485
  );
1473
1486
  }
1474
- function Pa({ clientId: n, sprite: e, name: t, isReady: r, isSelf: s, onToggle: i }) {
1487
+ function Ha({ clientId: n, sprite: e, name: t, isReady: r, isSelf: s, onToggle: i }) {
1475
1488
  const a = Pe(e || ""), d = r ? "rgba(34,197,94,0.92)" : "rgba(120,120,120,0.85)", c = r ? /* @__PURE__ */ l(it, { name: "tick" }) : /* @__PURE__ */ l(it, { name: "hourglass" });
1476
1489
  return /* @__PURE__ */ M(
1477
1490
  "button",
@@ -1542,7 +1555,7 @@ function Pa({ clientId: n, sprite: e, name: t, isReady: r, isSelf: s, onToggle:
1542
1555
  }
1543
1556
  );
1544
1557
  }
1545
- function Oa() {
1558
+ function Ua() {
1546
1559
  const n = S((I) => I.bufferStatus), e = S((I) => I.readyCheck), t = S((I) => I.roster), r = S((I) => I.me.clientId), s = S((I) => I.snapshot.playing), i = Qe(), [a, d] = $([]), c = N(/* @__PURE__ */ new Map()), o = N(/* @__PURE__ */ new Set());
1547
1560
  F(() => {
1548
1561
  if (!n || n.clients.length === 0) {
@@ -1551,7 +1564,7 @@ function Oa() {
1551
1564
  }
1552
1565
  const I = Date.now(), B = [];
1553
1566
  for (const p of n.clients) {
1554
- const A = $a(p), C = c.current.get(p.client_id) ?? null, j = o.current.has(p.client_id);
1567
+ const A = Da(p), C = c.current.get(p.client_id) ?? null, j = o.current.has(p.client_id);
1555
1568
  A ? j && C === null ? (c.current.set(p.client_id, I), B.push({ client: p, completedAt: I })) : C !== null && B.push({ client: p, completedAt: C }) : (C !== null && c.current.delete(p.client_id), o.current.add(p.client_id), B.push({ client: p, completedAt: null }));
1556
1569
  }
1557
1570
  d(B);
@@ -1566,7 +1579,7 @@ function Oa() {
1566
1579
  }, [y]);
1567
1580
  const _ = N(e.ready), g = N(e.active);
1568
1581
  F(() => {
1569
- const { on: I, off: B } = Na(
1582
+ const { on: I, off: B } = $a(
1570
1583
  _.current,
1571
1584
  e.ready,
1572
1585
  g.current,
@@ -1605,20 +1618,20 @@ function Oa() {
1605
1618
  }
1606
1619
  ),
1607
1620
  /* @__PURE__ */ l("div", { className: "flex flex-col gap-3", children: b.map((I) => /* @__PURE__ */ l(
1608
- Pa,
1621
+ Ha,
1609
1622
  {
1610
1623
  clientId: I.clientId,
1611
1624
  sprite: I.sprite,
1612
1625
  name: I.name || "Anon",
1613
1626
  isReady: f.has(I.clientId),
1614
1627
  isSelf: I.clientId === r,
1615
- onToggle: () => es(!x)
1628
+ onToggle: () => Zr(!x)
1616
1629
  },
1617
1630
  I.clientId
1618
1631
  )) })
1619
1632
  ] }),
1620
1633
  k && a.map(({ client: I, completedAt: B }) => /* @__PURE__ */ l(
1621
- Da,
1634
+ Oa,
1622
1635
  {
1623
1636
  client: I,
1624
1637
  fading: B !== null,
@@ -1631,7 +1644,7 @@ function Oa() {
1631
1644
  {
1632
1645
  type: "button",
1633
1646
  "data-testid": "start-ready-check",
1634
- onClick: () => ts(),
1647
+ onClick: () => es(),
1635
1648
  className: "px-2.5 py-1 rounded bg-black/55 text-xs font-semibold tracking-wide hover:bg-black/75 transition-colors",
1636
1649
  style: { color: "#fff", pointerEvents: "auto" },
1637
1650
  title: "Ask everyone if they're ready",
@@ -1701,7 +1714,7 @@ function xn({
1701
1714
  }
1702
1715
  );
1703
1716
  }
1704
- function Ha({
1717
+ function ja({
1705
1718
  anchor: n,
1706
1719
  itemId: e,
1707
1720
  snap: t
@@ -1756,7 +1769,7 @@ function Ha({
1756
1769
  document.body
1757
1770
  );
1758
1771
  }
1759
- function Ua() {
1772
+ function Ga() {
1760
1773
  const n = S((p) => p.tierlistOpen), e = S((p) => p.setTierlistOpen), t = S((p) => p.tierlist), r = S((p) => p.tierlistDraft), s = S((p) => p.tierlistSaving), i = S((p) => p.moveTierlistItem), [a, d] = $(null), [c, o] = $(null), [u, f] = $(null), [b, x] = $(null), [y, h] = $("mine");
1761
1774
  F(() => {
1762
1775
  ln(!0);
@@ -1800,7 +1813,7 @@ function Ua() {
1800
1813
  a && (i(a, p === Le ? null : p), d(null));
1801
1814
  }
1802
1815
  }), k = U(async () => {
1803
- await ns(S.getState().tierlistDraft) && x(Date.now());
1816
+ await ts(S.getState().tierlistDraft) && x(Date.now());
1804
1817
  }, []);
1805
1818
  if (F(() => {
1806
1819
  if (b === null) return;
@@ -1955,81 +1968,81 @@ function Ua() {
1955
1968
  ]
1956
1969
  }
1957
1970
  ),
1958
- u && t && /* @__PURE__ */ l(Ha, { anchor: u.anchor, itemId: u.itemId, snap: t })
1971
+ u && t && /* @__PURE__ */ l(ja, { anchor: u.anchor, itemId: u.itemId, snap: t })
1959
1972
  ]
1960
1973
  }
1961
1974
  ),
1962
1975
  document.body
1963
1976
  );
1964
1977
  }
1965
- function ja({ children: n }) {
1978
+ function Wa({ children: n }) {
1966
1979
  const [e, t] = $(null);
1967
1980
  return F(() => {
1968
1981
  const r = () => t(document.fullscreenElement);
1969
1982
  return r(), document.addEventListener("fullscreenchange", r), () => document.removeEventListener("fullscreenchange", r);
1970
1983
  }, []), e ? gt(n, e) : /* @__PURE__ */ l(be, { children: n });
1971
1984
  }
1972
- function zo({ className: n = "w-5 h-5" }) {
1985
+ function Qo({ className: n = "w-5 h-5" }) {
1973
1986
  return /* @__PURE__ */ l("svg", { className: n, fill: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ l("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" }) });
1974
1987
  }
1975
- function Ga({ className: n = "w-5 h-5" }) {
1988
+ function Va({ className: n = "w-5 h-5" }) {
1976
1989
  return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ l("path", { d: "M8 5v14l11-7z" }) });
1977
1990
  }
1978
- function Wa({ className: n = "w-5 h-5" }) {
1991
+ function Ka({ className: n = "w-5 h-5" }) {
1979
1992
  return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ l("path", { d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z" }) });
1980
1993
  }
1981
- function Va({ className: n = "w-5 h-5" }) {
1994
+ function za({ className: n = "w-5 h-5" }) {
1982
1995
  return /* @__PURE__ */ M("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
1983
1996
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
1984
1997
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" })
1985
1998
  ] });
1986
1999
  }
1987
- function Ka({ className: n = "w-5 h-5" }) {
2000
+ function Ja({ className: n = "w-5 h-5" }) {
1988
2001
  return /* @__PURE__ */ M("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
1989
2002
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
1990
2003
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.536 8.464a5 5 0 010 7.072" })
1991
2004
  ] });
1992
2005
  }
1993
- function za({ className: n = "w-5 h-5" }) {
2006
+ function Qa({ className: n = "w-5 h-5" }) {
1994
2007
  return /* @__PURE__ */ M("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
1995
2008
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
1996
2009
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.536 8.464a5 5 0 010 7.072M18.364 5.636a9 9 0 010 12.728" })
1997
2010
  ] });
1998
2011
  }
1999
- function Ja({ className: n = "w-5 h-5" }) {
2012
+ function qa({ className: n = "w-5 h-5" }) {
2000
2013
  return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
2001
2014
  }
2002
- function Qa({ className: n = "w-5 h-5" }) {
2015
+ function Xa({ className: n = "w-5 h-5" }) {
2003
2016
  return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 9V4H4m0 0l5 5M9 15v5H4m0 0l5-5M15 9V4h5m0 0l-5 5M15 15v5h5m0 0l-5-5" }) });
2004
2017
  }
2005
- function qa({ className: n = "w-5 h-5" }) {
2018
+ function Ya({ className: n = "w-5 h-5" }) {
2006
2019
  return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19l-7-7 7-7" }) });
2007
2020
  }
2008
- function Xa({ className: n = "w-5 h-5" }) {
2021
+ function Za({ className: n = "w-5 h-5" }) {
2009
2022
  return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
2010
2023
  }
2011
- function Ya({ className: n = "w-4 h-4" }) {
2024
+ function ei({ className: n = "w-4 h-4" }) {
2012
2025
  return /* @__PURE__ */ M("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2013
2026
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
2014
2027
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
2015
2028
  ] });
2016
2029
  }
2017
- function Za({ className: n = "w-4 h-4" }) {
2030
+ function ti({ className: n = "w-4 h-4" }) {
2018
2031
  return /* @__PURE__ */ M("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2019
2032
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
2020
2033
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
2021
2034
  ] });
2022
2035
  }
2023
- function ei({ className: n = "w-5 h-5" }) {
2036
+ function ni({ className: n = "w-5 h-5" }) {
2024
2037
  return /* @__PURE__ */ l("svg", { className: n, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
2025
2038
  }
2026
- function ti({ className: n = "w-5 h-5" }) {
2039
+ function ri({ className: n = "w-5 h-5" }) {
2027
2040
  return /* @__PURE__ */ M("svg", { className: n, viewBox: "0 0 24 24", fill: "currentColor", children: [
2028
2041
  /* @__PURE__ */ l("path", { d: "M12 5l8 11H4z" }),
2029
2042
  /* @__PURE__ */ l("rect", { x: "4", y: "17", width: "16", height: "3", rx: "0.5" })
2030
2043
  ] });
2031
2044
  }
2032
- function ni({ className: n = "w-5 h-5" }) {
2045
+ function si({ className: n = "w-5 h-5" }) {
2033
2046
  return /* @__PURE__ */ l("svg", { className: n, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 4h16a1 1 0 011 1v14a1 1 0 01-1 1H4a1 1 0 01-1-1V5a1 1 0 011-1z" }) });
2034
2047
  }
2035
2048
  function fr({ site: n = "control bar", className: e = "ctr-btn" }) {
@@ -2040,11 +2053,11 @@ function fr({ site: n = "control bar", className: e = "ctr-btn" }) {
2040
2053
  className: e,
2041
2054
  title: "Select Media",
2042
2055
  "aria-label": "Select Media",
2043
- children: /* @__PURE__ */ l(ni, {})
2056
+ children: /* @__PURE__ */ l(si, {})
2044
2057
  }
2045
2058
  );
2046
2059
  }
2047
- function ri() {
2060
+ function ai() {
2048
2061
  const n = S((b) => b.chatCollapsed), e = S((b) => b.toggleChatCollapsed), t = S((b) => !!b.snapshot.mediaId), r = Kt(), s = bt(), i = Qe(), a = qt(), d = Jt({
2049
2062
  isLeader: a,
2050
2063
  hasMedia: t,
@@ -2056,7 +2069,7 @@ function ri() {
2056
2069
  d && /* @__PURE__ */ l(fr, { site: "room corner", className: "corner-btn" }),
2057
2070
  c && /* @__PURE__ */ l("button", { type: "button", onClick: () => {
2058
2071
  w("game", "game_select", { gameId: null, source: "room corner" }), Dn(null);
2059
- }, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ l(ei, {}) }),
2072
+ }, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ l(ni, {}) }),
2060
2073
  t && /* @__PURE__ */ l(
2061
2074
  "button",
2062
2075
  {
@@ -2074,7 +2087,7 @@ function ri() {
2074
2087
  title: o ? "Show chat" : "Hide chat",
2075
2088
  "aria-label": o ? "Show chat" : "Hide chat",
2076
2089
  "aria-expanded": !o,
2077
- children: o ? /* @__PURE__ */ l(Za, { className: "w-5 h-5" }) : /* @__PURE__ */ l(Ya, { className: "w-5 h-5" })
2090
+ children: o ? /* @__PURE__ */ l(ti, { className: "w-5 h-5" }) : /* @__PURE__ */ l(ei, { className: "w-5 h-5" })
2078
2091
  }
2079
2092
  )
2080
2093
  ] });
@@ -2093,32 +2106,32 @@ function Ge() {
2093
2106
  }
2094
2107
  }
2095
2108
  let At = !1;
2096
- function si() {
2109
+ function ii() {
2097
2110
  return At ? () => {
2098
2111
  } : (At = !0, document.addEventListener("click", Ge, { capture: !0, passive: !0 }), document.addEventListener("touchend", Ge, { capture: !0, passive: !0 }), document.addEventListener("keydown", Ge, { capture: !0, passive: !0 }), () => {
2099
2112
  document.removeEventListener("click", Ge, { capture: !0 }), document.removeEventListener("touchend", Ge, { capture: !0 }), document.removeEventListener("keydown", Ge, { capture: !0 }), At = !1;
2100
2113
  });
2101
2114
  }
2102
- const ai = 400;
2103
- function ii(n) {
2115
+ const oi = 400;
2116
+ function ci(n) {
2104
2117
  return n === "leader" || n === "viewer" ? n : null;
2105
2118
  }
2106
- async function oi(n) {
2107
- const e = rs(), t = await fetch(`${e}/api/rooms/validate/${encodeURIComponent(n)}`);
2119
+ async function li(n) {
2120
+ const e = ns(), t = await fetch(`${e}/api/rooms/validate/${encodeURIComponent(n)}`);
2108
2121
  if (t.status === 404) return null;
2109
2122
  if (!t.ok) throw new Error(`validate returned ${t.status}`);
2110
2123
  const r = await t.json();
2111
- return ii(r?.type);
2124
+ return ci(r?.type);
2112
2125
  }
2113
- async function ci(n) {
2126
+ async function di(n) {
2114
2127
  for (let e = 0; e < 2; e++)
2115
2128
  try {
2116
- const t = await oi(n);
2117
- S.getState().setRoomKeyType(t), w("room", "Room key type probed", { roomKey: n, type: t });
2129
+ const t = await li(n);
2130
+ S.getState().setRoomKeyType({ roomKey: n, type: t }), w("room", "Room key type probed", { roomKey: n, type: t });
2118
2131
  return;
2119
2132
  } catch (t) {
2120
2133
  if (e === 0) {
2121
- await new Promise((r) => setTimeout(r, ai));
2134
+ await new Promise((r) => setTimeout(r, oi));
2122
2135
  continue;
2123
2136
  }
2124
2137
  T("room", "Room key type probe failed, falling back to socket truth", Se(t));
@@ -2128,14 +2141,14 @@ function Ce(n, e) {
2128
2141
  const r = S.getState().allocateClientSeq(), s = { kind: n, client_seq: r, ...e || {} };
2129
2142
  return Un().emit(jn.CONTROL, s), r;
2130
2143
  }
2131
- function Jo(n) {
2144
+ function qo(n) {
2132
2145
  return Ce("load", { media_id: n });
2133
2146
  }
2134
- function li() {
2147
+ function ui() {
2135
2148
  return Ce("home");
2136
2149
  }
2137
- function di() {
2138
- const n = ba(), e = Zn(), t = Qe(), r = er(), s = t && r && !e.ready, i = !e.ready && !s;
2150
+ function fi() {
2151
+ const n = va(), e = Zn(), t = Qe(), r = er(), s = t && r && !e.ready, i = !e.ready && !s;
2139
2152
  return /* @__PURE__ */ l(
2140
2153
  "button",
2141
2154
  {
@@ -2155,13 +2168,13 @@ function di() {
2155
2168
  className: "ctr-btn",
2156
2169
  title: s ? "Some viewers still loading — play anyway" : i ? "Waiting for sync..." : t ? n.playing ? "Pause" : "Play" : "Only the leader can control playback",
2157
2170
  "data-active": !i && t && n.playing ? "1" : "0",
2158
- children: n.playing ? /* @__PURE__ */ l(Wa, {}) : /* @__PURE__ */ l(Ga, {})
2171
+ children: n.playing ? /* @__PURE__ */ l(Ka, {}) : /* @__PURE__ */ l(Va, {})
2159
2172
  }
2160
2173
  );
2161
2174
  }
2162
- function ui() {
2175
+ function hi() {
2163
2176
  function n() {
2164
- w("controls", "Unload episode clicked"), li();
2177
+ w("controls", "Unload episode clicked"), ui();
2165
2178
  }
2166
2179
  return /* @__PURE__ */ l(
2167
2180
  "button",
@@ -2170,25 +2183,25 @@ function ui() {
2170
2183
  className: "ctr-btn",
2171
2184
  title: "Unload episode (return to lobby)",
2172
2185
  "aria-label": "Unload episode",
2173
- children: /* @__PURE__ */ l(ti, {})
2186
+ children: /* @__PURE__ */ l(ri, {})
2174
2187
  }
2175
2188
  );
2176
2189
  }
2177
- function fi(n) {
2190
+ function pi(n) {
2178
2191
  return !n.isLeader || n.durationMs === 0 ? !0 : !n.ready && !n.canOverride;
2179
2192
  }
2180
- function hi(n) {
2193
+ function mi(n) {
2181
2194
  return n.localValue !== null ? n.localValue : n.displayPlayheadMs ?? n.snapshotPlayheadMs;
2182
2195
  }
2183
- function pi(n, e) {
2196
+ function gi(n, e) {
2184
2197
  return e <= 0 ? 0 : n / e;
2185
2198
  }
2186
2199
  function Ct(n) {
2187
2200
  const e = Math.floor(n / 1e3), t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), s = e % 60;
2188
2201
  return t > 0 ? `${t}:${r.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}` : `${r}:${s.toString().padStart(2, "0")}`;
2189
2202
  }
2190
- function mi({ durationMs: n, displayPlayheadMs: e }) {
2191
- const t = S((I) => I.snapshot), r = S((I) => I.readiness), s = Qe(), i = er(), a = s && i && !r.ready, d = N(null), [c, o] = $(null), [u, f] = $(0), [b, x] = $(!1), [y, h] = $(null), m = N(0), _ = n || 0, g = hi({ localValue: y, displayPlayheadMs: e, snapshotPlayheadMs: t.playheadMs }), v = N(0);
2203
+ function bi({ durationMs: n, displayPlayheadMs: e }) {
2204
+ const t = S((I) => I.snapshot), r = S((I) => I.readiness), s = Qe(), i = er(), a = s && i && !r.ready, d = N(null), [c, o] = $(null), [u, f] = $(0), [b, x] = $(!1), [y, h] = $(null), m = N(0), _ = n || 0, g = mi({ localValue: y, displayPlayheadMs: e, snapshotPlayheadMs: t.playheadMs }), v = N(0);
2192
2205
  F(() => {
2193
2206
  h(null), x(!1), v.current = 0;
2194
2207
  }, [t.mediaId]), F(() => {
@@ -2231,8 +2244,8 @@ function mi({ durationMs: n, displayPlayheadMs: e }) {
2231
2244
  min: 0,
2232
2245
  max: _,
2233
2246
  value: g,
2234
- disabled: fi({ isLeader: s, ready: r.ready, canOverride: a, durationMs: _ }),
2235
- style: { "--progress": `${pi(g, _) * 100}%` },
2247
+ disabled: pi({ isLeader: s, ready: r.ready, canOverride: a, durationMs: _ }),
2248
+ style: { "--progress": `${gi(g, _) * 100}%` },
2236
2249
  onChange: (I) => {
2237
2250
  const B = Number(I.target.value);
2238
2251
  h(B), v.current = Date.now();
@@ -2264,7 +2277,7 @@ function mi({ durationMs: n, displayPlayheadMs: e }) {
2264
2277
  /* @__PURE__ */ l("span", { className: "text-[11px] font-mono text-text-muted w-[45px] text-left shrink-0", children: Ct(_) })
2265
2278
  ] });
2266
2279
  }
2267
- function gi({ videoRef: n }) {
2280
+ function yi({ videoRef: n }) {
2268
2281
  const e = S((u) => u.mediaPrefs.volume), t = S((u) => u.mediaPrefs.muted), r = S((u) => u.setVolume), s = S((u) => u.setMuted);
2269
2282
  F(() => {
2270
2283
  const u = n.current;
@@ -2275,7 +2288,7 @@ function gi({ videoRef: n }) {
2275
2288
  r(f), f > 0 && t && s(!1);
2276
2289
  }, a = () => {
2277
2290
  s(!t);
2278
- }, d = () => t || e === 0 ? /* @__PURE__ */ l(Va, {}) : e < 0.5 ? /* @__PURE__ */ l(Ka, {}) : /* @__PURE__ */ l(za, {}), c = t ? 0 : e, o = Math.round(c * 100);
2291
+ }, d = () => t || e === 0 ? /* @__PURE__ */ l(za, {}) : e < 0.5 ? /* @__PURE__ */ l(Ja, {}) : /* @__PURE__ */ l(Qa, {}), c = t ? 0 : e, o = Math.round(c * 100);
2279
2292
  return /* @__PURE__ */ M("div", { className: "flex items-center gap-2", children: [
2280
2293
  /* @__PURE__ */ l(
2281
2294
  "button",
@@ -2308,7 +2321,7 @@ function gi({ videoRef: n }) {
2308
2321
  ] })
2309
2322
  ] });
2310
2323
  }
2311
- function bi({
2324
+ function vi({
2312
2325
  tracks: n,
2313
2326
  selectedIndex: e,
2314
2327
  onSelect: t
@@ -2332,7 +2345,7 @@ function bi({
2332
2345
  )
2333
2346
  ] });
2334
2347
  }
2335
- function yi({
2348
+ function Si({
2336
2349
  tracks: n,
2337
2350
  selectedIndex: e,
2338
2351
  onSelect: t,
@@ -2369,13 +2382,13 @@ function yi({
2369
2382
  )
2370
2383
  ] });
2371
2384
  }
2372
- const vi = [
2385
+ const wi = [
2373
2386
  { value: "classic", label: "Classic" },
2374
2387
  { value: "cinema", label: "Cinema" },
2375
2388
  { value: "minimal", label: "Minimal" },
2376
2389
  { value: "contrast", label: "High Contrast" }
2377
2390
  ];
2378
- function Si({ style: n, onStyleChange: e, enabled: t }) {
2391
+ function xi({ style: n, onStyleChange: e, enabled: t }) {
2379
2392
  return t ? /* @__PURE__ */ M("div", { className: "flex items-center gap-2", children: [
2380
2393
  /* @__PURE__ */ l("span", { className: "text-[10px] opacity-60 uppercase tracking-wide", children: "Style" }),
2381
2394
  /* @__PURE__ */ l(
@@ -2386,12 +2399,12 @@ function Si({ style: n, onStyleChange: e, enabled: t }) {
2386
2399
  className: "text-xs rounded px-2 py-1 cursor-pointer",
2387
2400
  title: "Select subtitle style",
2388
2401
  "aria-label": "Subtitle style selection",
2389
- children: vi.map((r) => /* @__PURE__ */ l("option", { value: r.value, children: r.label }, r.value))
2402
+ children: wi.map((r) => /* @__PURE__ */ l("option", { value: r.value, children: r.label }, r.value))
2390
2403
  }
2391
2404
  )
2392
2405
  ] }) : null;
2393
2406
  }
2394
- function wi({ videoRef: n }) {
2407
+ function Ei({ videoRef: n }) {
2395
2408
  const [e, t] = $(!1);
2396
2409
  return F(() => {
2397
2410
  const s = () => {
@@ -2417,11 +2430,11 @@ function wi({ videoRef: n }) {
2417
2430
  },
2418
2431
  className: "ctr-btn",
2419
2432
  title: e ? "Exit Fullscreen" : "Enter Fullscreen",
2420
- children: e ? /* @__PURE__ */ l(Qa, {}) : /* @__PURE__ */ l(Ja, {})
2433
+ children: e ? /* @__PURE__ */ l(Xa, {}) : /* @__PURE__ */ l(qa, {})
2421
2434
  }
2422
2435
  );
2423
2436
  }
2424
- function xi({
2437
+ function Mi({
2425
2438
  videoRef: n,
2426
2439
  mediaId: e,
2427
2440
  durationMs: t,
@@ -2496,18 +2509,18 @@ function xi({
2496
2509
  children: [
2497
2510
  /* @__PURE__ */ M("div", { ref: p, className: ye, children: [
2498
2511
  _ && /* @__PURE__ */ M("div", { className: "cluster", children: [
2499
- /* @__PURE__ */ l(di, {}),
2512
+ /* @__PURE__ */ l(fi, {}),
2500
2513
  I && /* @__PURE__ */ l(fr, {}),
2501
- /* @__PURE__ */ l(ui, {})
2514
+ /* @__PURE__ */ l(hi, {})
2502
2515
  ] }),
2503
- /* @__PURE__ */ l("div", { className: "cluster-seek", children: /* @__PURE__ */ l(mi, { durationMs: t, displayPlayheadMs: y }) }),
2516
+ /* @__PURE__ */ l("div", { className: "cluster-seek", children: /* @__PURE__ */ l(bi, { durationMs: t, displayPlayheadMs: y }) }),
2504
2517
  /* @__PURE__ */ M("div", { className: "cluster", children: [
2505
- /* @__PURE__ */ l(gi, { videoRef: n }),
2518
+ /* @__PURE__ */ l(yi, { videoRef: n }),
2506
2519
  s.length > 1 && /* @__PURE__ */ M(be, { children: [
2507
2520
  /* @__PURE__ */ l("div", { className: "w-px h-5 bg-white/20" }),
2508
2521
  " ",
2509
2522
  /* @__PURE__ */ l(
2510
- bi,
2523
+ vi,
2511
2524
  {
2512
2525
  tracks: s,
2513
2526
  selectedIndex: i,
@@ -2518,7 +2531,7 @@ function xi({
2518
2531
  ] }),
2519
2532
  d.length > 0 && /* @__PURE__ */ M("div", { className: "cluster", children: [
2520
2533
  /* @__PURE__ */ l(
2521
- yi,
2534
+ Si,
2522
2535
  {
2523
2536
  tracks: d,
2524
2537
  selectedIndex: c,
@@ -2528,7 +2541,7 @@ function xi({
2528
2541
  }
2529
2542
  ),
2530
2543
  /* @__PURE__ */ l(
2531
- Si,
2544
+ xi,
2532
2545
  {
2533
2546
  style: b,
2534
2547
  onStyleChange: x,
@@ -2589,7 +2602,7 @@ function xi({
2589
2602
  ]
2590
2603
  }
2591
2604
  ),
2592
- /* @__PURE__ */ l("div", { className: "cluster cluster-tight", children: /* @__PURE__ */ l(wi, { videoRef: n }) })
2605
+ /* @__PURE__ */ l("div", { className: "cluster cluster-tight", children: /* @__PURE__ */ l(Ei, { videoRef: n }) })
2593
2606
  ] }),
2594
2607
  Xe && /* @__PURE__ */ M("div", { className: "ctr-scroll-group", children: [
2595
2608
  /* @__PURE__ */ l(
@@ -2598,7 +2611,7 @@ function xi({
2598
2611
  className: `ctr-scroll-btn ${C ? "visible" : ""}`,
2599
2612
  onClick: () => Re("left"),
2600
2613
  "aria-label": "Scroll left",
2601
- children: /* @__PURE__ */ l(qa, {})
2614
+ children: /* @__PURE__ */ l(Ya, {})
2602
2615
  }
2603
2616
  ),
2604
2617
  /* @__PURE__ */ l(
@@ -2607,7 +2620,7 @@ function xi({
2607
2620
  className: `ctr-scroll-btn ${P ? "visible" : ""}`,
2608
2621
  onClick: () => Re("right"),
2609
2622
  "aria-label": "Scroll right",
2610
- children: /* @__PURE__ */ l(Xa, {})
2623
+ children: /* @__PURE__ */ l(Za, {})
2611
2624
  }
2612
2625
  )
2613
2626
  ] })
@@ -2615,43 +2628,43 @@ function xi({
2615
2628
  }
2616
2629
  );
2617
2630
  }
2618
- const Ei = 1e3;
2619
- function Mi(n) {
2620
- return n.hidden && n.roomPlaying && !n.seekInFlight && !n.ended && !n.localPause && n.sinceUserPauseMs >= Ei;
2631
+ const ki = 1e3;
2632
+ function _i(n) {
2633
+ return n.hidden && n.roomPlaying && !n.seekInFlight && !n.ended && !n.localPause && n.sinceUserPauseMs >= ki;
2621
2634
  }
2622
- function ki(n, e) {
2635
+ function Ti(n, e) {
2623
2636
  return e.isLeader ? n === "play" && e.roomPlaying ? { kind: "resync" } : n === "pause" && !e.roomPlaying ? { kind: "none" } : { kind: "control", control: n } : n === "pause" ? { kind: "local-pause" } : e.roomPlaying ? { kind: "resync" } : { kind: "none" };
2624
2637
  }
2625
- function _i(n) {
2638
+ function Ai(n) {
2626
2639
  if (!n.roomPlaying || n.seekInFlight) return { kind: "none" };
2627
2640
  const e = n.durationMs > 0 ? Math.min(n.roomMs, n.durationMs) : n.roomMs;
2628
2641
  return Math.abs(e - n.elementMs) > n.driftToleranceMs ? { kind: "seek", targetMs: Math.round(e) } : n.elementPaused ? { kind: "resume" } : { kind: "none" };
2629
2642
  }
2630
- function Ti(n, e, t) {
2643
+ function Ci(n, e, t) {
2631
2644
  return n.playheadMs + (n.playing ? Math.max(0, t - e) : 0);
2632
2645
  }
2633
2646
  function pr(n) {
2634
2647
  const e = n.split("/").filter(Boolean);
2635
2648
  return e.length >= 2 ? e.slice(-2).join(" ") : e[e.length - 1] || n;
2636
2649
  }
2637
- function Ai(n) {
2650
+ function Ii(n) {
2638
2651
  const e = n.split("/").filter(Boolean), t = [`${e.join("/")}/poster.jpg`];
2639
2652
  return e.length >= 2 && t.push(`${e.slice(0, -1).join("/")}/poster.jpg`), t;
2640
2653
  }
2641
- function Ci({ mediaId: n, visible: e }) {
2654
+ function Ri({ mediaId: n, visible: e }) {
2642
2655
  return n ? /* @__PURE__ */ l("div", { className: `media-title ${e ? "show" : ""}`, children: pr(n) }) : null;
2643
2656
  }
2644
- const We = 3, Ii = 1e3, Ri = 15e3, Z = {
2657
+ const We = 3, Fi = 1e3, Ni = 15e3, Z = {
2645
2658
  EQUAL: 1e-3,
2646
2659
  POINT: 0.05,
2647
2660
  RANGE: 0.1,
2648
2661
  FALLBACK: 1
2649
2662
  }, It = 0.5, Rt = 3e3;
2650
2663
  function rt(n, e = {}) {
2651
- const { baseMs: t = Ii, capMs: r = Ri, jitter: s = 0.25 } = e, i = Math.min(t * Math.pow(2, n - 1), r), a = s > 0 ? Math.round(i * Math.random() * s) : 0;
2664
+ const { baseMs: t = Fi, capMs: r = Ni, jitter: s = 0.25 } = e, i = Math.min(t * Math.pow(2, n - 1), r), a = s > 0 ? Math.round(i * Math.random() * s) : 0;
2652
2665
  return i + a;
2653
2666
  }
2654
- const Mn = 15, Fi = 35e3, Ni = 2e3, Ft = 10;
2667
+ const Mn = 15, Li = 35e3, $i = 2e3, Ft = 10;
2655
2668
  function Ee(n, e) {
2656
2669
  if (n.length === 0) return 0;
2657
2670
  if (e >= n[n.length - 1].end_ms) return n.length - 1;
@@ -2685,15 +2698,15 @@ function Nt(n, e, t, r = Z.RANGE) {
2685
2698
  function fe(n) {
2686
2699
  return n ? Array.from({ length: n.length }, (e, t) => `${n.start(t).toFixed(2)}-${n.end(t).toFixed(2)}`) : [];
2687
2700
  }
2688
- function Li(n) {
2701
+ function Bi(n) {
2689
2702
  if (n.length === 0) return 0;
2690
2703
  const e = n.reduce((r, s) => r + s.bytes, 0), t = n.reduce((r, s) => r + s.durationMs, 0);
2691
2704
  return t === 0 ? 0 : e / t * 1e3;
2692
2705
  }
2693
- const $i = 8e5, Bi = 4;
2706
+ const Di = 8e5, Pi = 4;
2694
2707
  function nt(n) {
2695
2708
  if (n === 0) return 6e4;
2696
- const e = $i / n * 1e3 * Bi;
2709
+ const e = Di / n * 1e3 * Pi;
2697
2710
  return Math.max(3e4, Math.min(12e4, Math.round(e)));
2698
2711
  }
2699
2712
  function kn(n, e) {
@@ -2701,7 +2714,7 @@ function kn(n, e) {
2701
2714
  if (n[t]?.keyframe) return t;
2702
2715
  return -1;
2703
2716
  }
2704
- function Di(n, e, t, r) {
2717
+ function Oi(n, e, t, r) {
2705
2718
  const s = n * 1e3 - 100, i = e * 1e3 + 100;
2706
2719
  for (const a of r) {
2707
2720
  const d = t[a];
@@ -2710,7 +2723,7 @@ function Di(n, e, t, r) {
2710
2723
  }
2711
2724
  return !1;
2712
2725
  }
2713
- function Pi(n) {
2726
+ function Hi(n) {
2714
2727
  const e = [], t = n.replace(/\r\n/g, `
2715
2728
  `).split(`
2716
2729
  `);
@@ -2765,10 +2778,10 @@ function _n(n) {
2765
2778
  let t = 0, r, s;
2766
2779
  return e.length === 3 ? (t = parseInt(e[0], 10), r = parseInt(e[1], 10), s = parseFloat(e[2])) : (r = parseInt(e[0], 10), s = parseFloat(e[1])), isNaN(t) || isNaN(r) || isNaN(s) ? null : t * 3600 + r * 60 + s;
2767
2780
  }
2768
- function Oi(n) {
2781
+ function Ui(n) {
2769
2782
  return n.replace(/<\/?[^>]+(>|$)/g, "").replace(/\{[^}]+\}/g, "").replace(/\\N/g, " ").replace(/\s*\n\s*/g, " ").replace(/\s{2,}/g, " ").trim();
2770
2783
  }
2771
- const Hi = {
2784
+ const ji = {
2772
2785
  // Standard CC look: white text with thick black outline stroke
2773
2786
  classic: "text-white [text-shadow:_-2px_-2px_0_#000,_2px_-2px_0_#000,_-2px_2px_0_#000,_2px_2px_0_#000,_0_-2px_0_#000,_0_2px_0_#000,_-2px_0_0_#000,_2px_0_0_#000]",
2774
2787
  // DVD/theater style: yellow text on dark translucent box
@@ -2778,7 +2791,7 @@ const Hi = {
2778
2791
  // Accessibility-focused: bold white text on solid black box
2779
2792
  contrast: "text-white font-bold bg-black px-3 py-1"
2780
2793
  };
2781
- function Ui({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
2794
+ function Gi({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
2782
2795
  const [s, i] = $([]), [a, d] = $([]), c = N(null), [o, u] = $(40), [f, b] = $(18);
2783
2796
  F(() => {
2784
2797
  if (!n) {
@@ -2795,7 +2808,7 @@ function Ui({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
2795
2808
  if (!R.ok) throw new Error(`Failed to fetch subtitles (status ${R.status})`);
2796
2809
  const I = await R.text();
2797
2810
  if (g) return;
2798
- const B = Pi(I);
2811
+ const B = Hi(I);
2799
2812
  i(B);
2800
2813
  return;
2801
2814
  } catch (R) {
@@ -2863,8 +2876,8 @@ function Ui({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
2863
2876
  children: /* @__PURE__ */ l(
2864
2877
  "div",
2865
2878
  {
2866
- className: `${k} font-medium max-w-[95%] inline-block antialiased ${Hi[t]}`,
2867
- children: Oi(R.text)
2879
+ className: `${k} font-medium max-w-[95%] inline-block antialiased ${ji[t]}`,
2880
+ children: Ui(R.text)
2868
2881
  }
2869
2882
  )
2870
2883
  },
@@ -2901,7 +2914,7 @@ function Ui({ subtitleUrl: n, videoRef: e, style: t, enabled: r }) {
2901
2914
  _(h.bl, h.bc, h.br, { bottom: `${o}px` }, c)
2902
2915
  ] });
2903
2916
  }
2904
- const ji = 300, Gi = 50, Wi = 100, Vi = 100, Ki = 100, zi = 100;
2917
+ const Wi = 300, Vi = 50, Ki = 100, zi = 100, Ji = 100, Qi = 100;
2905
2918
  function Lt(n, e) {
2906
2919
  if (n.length === 0) return 0;
2907
2920
  const t = Math.min(Math.floor(e / 100 * n.length), n.length - 1);
@@ -2919,10 +2932,10 @@ function _e(n) {
2919
2932
  max: Math.round(e[e.length - 1])
2920
2933
  };
2921
2934
  }
2922
- function Te(n, e = ji) {
2935
+ function Te(n, e = Wi) {
2923
2936
  n.length > e && n.splice(0, n.length - e);
2924
2937
  }
2925
- class Ji {
2938
+ class qi {
2926
2939
  // Fetch
2927
2940
  _fetches = [];
2928
2941
  _fetchTimeoutCount = 0;
@@ -2980,11 +2993,11 @@ class Ji {
2980
2993
  }
2981
2994
  /** Called when waitForAppend times out. */
2982
2995
  recordAppendTimeout(e, t, r) {
2983
- this._appendTimeouts.push({ index: e, timeoutMs: t, queueDepth: r, ts: performance.now() }), Te(this._appendTimeouts, Gi);
2996
+ this._appendTimeouts.push({ index: e, timeoutMs: t, queueDepth: r, ts: performance.now() }), Te(this._appendTimeouts, Vi);
2984
2997
  }
2985
2998
  /** Called when a seek completes (COMPLETED path in _execute). */
2986
2999
  recordSeekCompleted(e, t, r) {
2987
- this._seeks.push({ caller: e, targetMs: t, durationMs: r, ts: performance.now() }), Te(this._seeks, Wi);
3000
+ this._seeks.push({ caller: e, targetMs: t, durationMs: r, ts: performance.now() }), Te(this._seeks, Ki);
2988
3001
  }
2989
3002
  /** Called when waitForSeeked resolves via timeout rather than the 'seeked' event. */
2990
3003
  recordWaitForSeekedTimeout() {
@@ -3006,11 +3019,11 @@ class Ji {
3006
3019
  this._stallStart && (this._stalls.push({
3007
3020
  ...this._stallStart,
3008
3021
  durationMs: Math.round(performance.now() - this._stallStart.ts)
3009
- }), Te(this._stalls, Vi), this._stallStart = null);
3022
+ }), Te(this._stalls, zi), this._stallStart = null);
3010
3023
  }
3011
3024
  /** Called from _doEvict with the reason tag passed by the caller. */
3012
3025
  recordEvict(e, t, r) {
3013
- this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: t, end: r, ts: performance.now() }), Te(this._evicts, Ki);
3026
+ this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: t, end: r, ts: performance.now() }), Te(this._evicts, Ji);
3014
3027
  }
3015
3028
  /** Called from FragmentManager.reconcileLoadedStates() when the browser's
3016
3029
  * own silent quota eviction is detected (fragments 'loaded' but gone from
@@ -3052,7 +3065,7 @@ class Ji {
3052
3065
  },
3053
3066
  audio: {
3054
3067
  driftMs: _e(this._audioDrifts),
3055
- highDriftCount: this._audioDrifts.filter((o) => o > zi).length,
3068
+ highDriftCount: this._audioDrifts.filter((o) => o > Qi).length,
3056
3069
  samples: this._audioDrifts.slice(-20).map((o) => Math.round(o))
3057
3070
  },
3058
3071
  stalls: {
@@ -3101,9 +3114,9 @@ class Ji {
3101
3114
  this._fetches = [], this._fetchTimeoutCount = 0, this._fetchErrorCount = 0, this._appends = [], this._appendStarts.clear(), this._appendTimeouts = [], this._seeks = [], this._waitForSeekedTimeouts = 0, this._audioDrifts = [], this._stalls = [], this._stallStart = null, this._evictCounts = {}, this._evicts = [], this._browserEvictions = [];
3102
3115
  }
3103
3116
  }
3104
- const oe = new Ji();
3117
+ const oe = new qi();
3105
3118
  On("__WP_PERF__", oe);
3106
- class Qi {
3119
+ class Xi {
3107
3120
  cache = /* @__PURE__ */ new Map();
3108
3121
  getOrCreate(e) {
3109
3122
  let t = this.cache.get(e);
@@ -3142,8 +3155,8 @@ class Qi {
3142
3155
  this.cache.clear();
3143
3156
  }
3144
3157
  }
3145
- const ge = new Qi(), Tn = 60, qi = 5e3;
3146
- class Xi {
3158
+ const ge = new Xi(), Tn = 60, Yi = 5e3;
3159
+ class Zi {
3147
3160
  constructor(e) {
3148
3161
  this.deps = e;
3149
3162
  }
@@ -3223,7 +3236,7 @@ class Xi {
3223
3236
  if (this.evictStartedAt === 0)
3224
3237
  return this.evictStartedAt = Date.now(), !0;
3225
3238
  const e = Date.now() - this.evictStartedAt;
3226
- return e < qi ? !0 : (T("buffer", `EVICT-STUCK isEvicting held ${e}ms — clearing; a remove() updateend was lost, eviction was disabled`), oe.recordEvict("stuck-recovered", 0, 0), this._isEvicting = !1, this.evictStartedAt = 0, !1);
3239
+ return e < Yi ? !0 : (T("buffer", `EVICT-STUCK isEvicting held ${e}ms — clearing; a remove() updateend was lost, eviction was disabled`), oe.recordEvict("stuck-recovered", 0, 0), this._isEvicting = !1, this.evictStartedAt = 0, !1);
3227
3240
  }
3228
3241
  /** Called on dispose, on SourceBuffer error, and on media change
3229
3242
  * (FragmentManager.setIndex) — see the note at that call site. */
@@ -3388,13 +3401,13 @@ class ze {
3388
3401
  * hold began. Lets processAppendQueue bound a hold that would otherwise
3389
3402
  * never end — see APPEND_HOLD_MAX_MS. */
3390
3403
  appendHold = null;
3391
- eviction = new Xi({
3404
+ eviction = new Zi({
3392
3405
  getFragments: () => this.fragments,
3393
3406
  getSourceBuffer: () => this.sourceBuffer,
3394
3407
  getMediaSource: () => this.mediaSource,
3395
3408
  isDisposed: () => this.disposed,
3396
3409
  fragmentStates: this.fragmentStates,
3397
- getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs > Fi ? null : this.pendingSeekTargetMs
3410
+ getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs > Li ? null : this.pendingSeekTargetMs
3398
3411
  });
3399
3412
  lastGapWarnMs = 0;
3400
3413
  stableGapSignature = null;
@@ -3420,7 +3433,7 @@ class ze {
3420
3433
  // timing, and APPEND-HOLD reason counts. Read by emitInitDigest() which warns
3421
3434
  // once at gate-pass time so the load shape is visible in session logs without
3422
3435
  // wp:reportLogs=true.
3423
- static INIT_TRACK_FRAGS = ss;
3436
+ static INIT_TRACK_FRAGS = rs;
3424
3437
  loadStartTs = 0;
3425
3438
  initFetchStart = 0;
3426
3439
  initFetchEnd = 0;
@@ -3495,8 +3508,8 @@ class ze {
3495
3508
  * `fragment-route.realmedia.test.ts`; this is the client-side backstop.
3496
3509
  */
3497
3510
  async tryFragmentRoute(e, t, r) {
3498
- if (this.fragmentRouteDisabled || !this.delivery || !as()) return null;
3499
- const s = is(this.delivery, e);
3511
+ if (this.fragmentRouteDisabled || !this.delivery || !ss()) return null;
3512
+ const s = as(this.delivery, e);
3500
3513
  if (!s)
3501
3514
  return this.disableFragmentRoute(e, "could not build a URL for this config"), null;
3502
3515
  try {
@@ -3623,12 +3636,12 @@ class ze {
3623
3636
  }
3624
3637
  this.initAppendDone = performance.now(), this.initState = "loaded", this.initRetryCount = 0, w("buffer", `INIT-LOADED sbRanges=[${fe(this.sourceBuffer?.buffered).join(", ")}]`), this.processAppendQueue();
3625
3638
  } catch (d) {
3626
- ue("buffer", "Init segment fetch/append failed", { error: d.message }), a() || (this.initState = "pending", this.initRetryCount += 1, this.initRetryCount >= os ? (this.initFailed = !0, T("buffer", "INIT-GIVE-UP — init segment failed repeatedly; rejecting waiters for fast recovery", {
3639
+ ue("buffer", "Init segment fetch/append failed", { error: d.message }), a() || (this.initState = "pending", this.initRetryCount += 1, this.initRetryCount >= is ? (this.initFailed = !0, T("buffer", "INIT-GIVE-UP — init segment failed repeatedly; rejecting waiters for fast recovery", {
3627
3640
  attempts: this.initRetryCount,
3628
3641
  error: d.message
3629
3642
  }), this.rejectAllWaiters(new Error("init segment failed after repeated retries"))) : this.disposed || setTimeout(() => {
3630
3643
  !this.disposed && this.initState === "pending" && this.fetchInit();
3631
- }, cs));
3644
+ }, os));
3632
3645
  }
3633
3646
  }
3634
3647
  /** Runs inside updateend after an append completes. Decides whether MSE
@@ -3716,7 +3729,7 @@ class ze {
3716
3729
  ]), r = [], s = this.currentPlayheadMs / 1e3;
3717
3730
  for (let d = 1; d < e.buffered.length; d++) {
3718
3731
  const c = e.buffered.end(d - 1), o = e.buffered.start(d);
3719
- o <= s || Di(c, o, this.fragments, t) || r.push(`${c.toFixed(2)}-${o.toFixed(2)}`);
3732
+ o <= s || Oi(c, o, this.fragments, t) || r.push(`${c.toFixed(2)}-${o.toFixed(2)}`);
3720
3733
  }
3721
3734
  if (r.length === 0) {
3722
3735
  this.stableGapSignature = null, this.stableGapSince = 0;
@@ -4156,7 +4169,7 @@ class ze {
4156
4169
  if (this.appendHold?.index !== e)
4157
4170
  return this.appendHold = { index: e, since: r }, !1;
4158
4171
  const s = r - this.appendHold.since;
4159
- if (s < ls) return !1;
4172
+ if (s < cs) return !1;
4160
4173
  T("buffer", `APPEND-HOLD-BREAK #${e} held ${s}ms behind ${t.length} pending fetch(es) — declaring them dead so the queue can drain`, {
4161
4174
  headIndex: e,
4162
4175
  heldMs: s,
@@ -4220,7 +4233,7 @@ class ze {
4220
4233
  if (this.disposed || !this.sourceBuffer || (this.currentPlayheadMs = e, this.currentJobs.size >= je)) return;
4221
4234
  const t = Ee(this.fragments, e), r = Math.min(this.fragments.length - 1, Ee(this.fragments, e + Ke)), s = Date.now();
4222
4235
  for (let a = t; a <= r; a++)
4223
- this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >= ds && ((this.fetchErrorCycles.get(a) ?? 0) >= un ? w("buffer", `PREFETCH-DEAD #${a} cycles=${this.fetchErrorCycles.get(a)} not resetting`) : (this.fragmentStates.set(a, "pending"), this.errorTimestamps.delete(a)));
4236
+ this.fragmentStates.get(a) === "error" && s - (this.errorTimestamps.get(a) ?? 0) >= ls && ((this.fetchErrorCycles.get(a) ?? 0) >= un ? w("buffer", `PREFETCH-DEAD #${a} cycles=${this.fetchErrorCycles.get(a)} not resetting`) : (this.fragmentStates.set(a, "pending"), this.errorTimestamps.delete(a)));
4224
4237
  let i = 0;
4225
4238
  for (let a = t; a <= r && i < je - this.currentJobs.size; a++) {
4226
4239
  const d = this.fragmentStates.get(a);
@@ -4251,7 +4264,7 @@ class ze {
4251
4264
  /** Public eviction entry point used by MediaPlayer / prefetch. Delegates
4252
4265
  * to the strategy which owns the isEvicting state + range choice logic. */
4253
4266
  evictBefore(e) {
4254
- this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <= Ni && (this.pendingSeekTargetMs = null), this.eviction.evictBefore(e);
4267
+ this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <= $i && (this.pendingSeekTargetMs = null), this.eviction.evictBefore(e);
4255
4268
  }
4256
4269
  // Public entry point for socket reconnect scenarios. Clears stale in-flight
4257
4270
  // fetches and their pendingFetchIndices entries so the queue is unblocked on
@@ -4399,7 +4412,7 @@ class ze {
4399
4412
  return { ranges: e, gaps: e.length > 1, fragmentStates: t };
4400
4413
  }
4401
4414
  getAverageDownloadRate() {
4402
- return Li(this.downloadSamples);
4415
+ return Bi(this.downloadSamples);
4403
4416
  }
4404
4417
  /** Nominal media end time (ms) = last fragment's end. 0 if no index loaded.
4405
4418
  * Reported in health so the leader's status card can tell "near end-of-stream,
@@ -4473,7 +4486,7 @@ class ze {
4473
4486
  if (this.eosRetryTimer) return;
4474
4487
  this.eosRetryTimer = setTimeout(() => {
4475
4488
  this.eosRetryTimer = null, this.tryEndOfStream();
4476
- }, us);
4489
+ }, ds);
4477
4490
  return;
4478
4491
  }
4479
4492
  try {
@@ -4486,14 +4499,14 @@ class ze {
4486
4499
  this.disposed = !0, this.eosRetryTimer && (clearTimeout(this.eosRetryTimer), this.eosRetryTimer = null), this.pendingEndOfStream = !1, this.abortAllJobs("dispose"), this.rejectAllWaiters(new Error("FragmentManager disposed")), this.appendQueue = [], this.isAppending = !1, this.eviction.reset(), this.appendingIndex = null, this.fragmentStates.clear(), this.errorTimestamps.clear(), this.discardCounts.clear(), this.fetchErrorCycles.clear(), this.downloadSamples = [], this.preAppendRanges = [], this.sourceBuffer = null, this.mediaSource = null, this.initState = "pending", this.initRange = null;
4487
4500
  }
4488
4501
  }
4489
- function Yi(n, e) {
4502
+ function eo(n, e) {
4490
4503
  return !!n && n !== "eng" && e;
4491
4504
  }
4492
- function Zi(n) {
4493
- return n.override !== null ? n.override : n.globalEnabled || Yi(n.selectedAudioLang, n.hasEngSub);
4505
+ function to(n) {
4506
+ return n.override !== null ? n.override : n.globalEnabled || eo(n.selectedAudioLang, n.hasEngSub);
4494
4507
  }
4495
4508
  const mr = "wp_reload_history", Yt = "wp_phantom_reload", gr = 5 * 6e4, An = 3;
4496
- function eo() {
4509
+ function no() {
4497
4510
  try {
4498
4511
  const n = sessionStorage.getItem(mr);
4499
4512
  return (n ? JSON.parse(n) : []).filter((t) => Date.now() - t < gr);
@@ -4502,7 +4515,7 @@ function eo() {
4502
4515
  }
4503
4516
  }
4504
4517
  function Gt(n, e) {
4505
- const t = eo();
4518
+ const t = no();
4506
4519
  if (t.length >= An) {
4507
4520
  fn(
4508
4521
  "error",
@@ -4538,13 +4551,13 @@ function Cn() {
4538
4551
  return null;
4539
4552
  }
4540
4553
  }
4541
- function to() {
4554
+ function ro() {
4542
4555
  try {
4543
4556
  sessionStorage.removeItem(Yt);
4544
4557
  } catch {
4545
4558
  }
4546
4559
  }
4547
- function no() {
4560
+ function so() {
4548
4561
  const n = navigator;
4549
4562
  try {
4550
4563
  return typeof n.getAutoplayPolicy == "function" ? n.getAutoplayPolicy("mediaelement") : void 0;
@@ -4552,11 +4565,11 @@ function no() {
4552
4565
  return;
4553
4566
  }
4554
4567
  }
4555
- function ro(n, e) {
4568
+ function ao(n, e) {
4556
4569
  return n === "disallowed" ? "deferred" : e ? "user-muted" : n === "allowed-muted" ? "muted-bridge" : "audible";
4557
4570
  }
4558
4571
  function br(n, e) {
4559
- const t = no(), r = ro(t, e.userWantsMuted);
4572
+ const t = so(), r = ao(t, e.userWantsMuted);
4560
4573
  w(e.label, "autoplay plan", { policy: t ?? "unknown", plan: r, userWantsMuted: e.userWantsMuted });
4561
4574
  const s = () => {
4562
4575
  n.muted = !0, n.play().then(() => {
@@ -4596,7 +4609,7 @@ function yr(n, e = 3e3) {
4596
4609
  n.addEventListener("seeked", s, { once: !0 });
4597
4610
  });
4598
4611
  }
4599
- class so {
4612
+ class io {
4600
4613
  // ── State ──
4601
4614
  _seekInFlight = !1;
4602
4615
  /** Route taken by the in-flight seek (buffered/loading/nearby-pending/far) —
@@ -4788,10 +4801,10 @@ class so {
4788
4801
  }
4789
4802
  }
4790
4803
  let st = null;
4791
- function ao() {
4792
- st === null && (w("health", "Starting health reporting"), In(), st = window.setInterval(In, fs));
4804
+ function oo() {
4805
+ st === null && (w("health", "Starting health reporting"), In(), st = window.setInterval(In, us));
4793
4806
  }
4794
- function io() {
4807
+ function co() {
4795
4808
  st !== null && (w("health", "Stopping health reporting"), window.clearInterval(st), st = null);
4796
4809
  }
4797
4810
  function In() {
@@ -4825,13 +4838,13 @@ function In() {
4825
4838
  fragments_error: i.fragmentStates.error || 0,
4826
4839
  video_ready_state: r?.readyState ?? -1,
4827
4840
  duration_ms: t.getMediaEndMs(),
4828
- delivery_arm: ps(),
4829
- ...oo(r),
4830
- pong_age_ms: hs(),
4841
+ delivery_arm: hs(),
4842
+ ...lo(r),
4843
+ pong_age_ms: fs(),
4831
4844
  reported_at: Date.now()
4832
4845
  });
4833
4846
  }
4834
- function oo(n) {
4847
+ function lo(n) {
4835
4848
  const e = typeof navigator > "u" ? void 0 : navigator, t = e?.connection;
4836
4849
  return {
4837
4850
  page_visible: typeof document.visibilityState == "string" ? document.visibilityState === "visible" : void 0,
@@ -4843,8 +4856,8 @@ function oo(n) {
4843
4856
  net_downlink_mbps: typeof t?.downlink == "number" && t.downlink >= 0 ? t.downlink : void 0
4844
4857
  };
4845
4858
  }
4846
- const co = 3e3;
4847
- function lo() {
4859
+ const uo = 3e3;
4860
+ function fo() {
4848
4861
  const [n, e] = $(!1), t = N(null), r = N(!1), s = () => {
4849
4862
  t.current && (clearTimeout(t.current), t.current = null);
4850
4863
  }, i = U((c = 3e3) => {
@@ -4854,7 +4867,7 @@ function lo() {
4854
4867
  }, []), a = U(() => {
4855
4868
  r.current || (s(), e(!1));
4856
4869
  }, []), d = U((c) => {
4857
- r.current !== c && (r.current = c, c ? (s(), e(!0)) : i(co));
4870
+ r.current !== c && (r.current = c, c ? (s(), e(!0)) : i(uo));
4858
4871
  }, [i]);
4859
4872
  return F(() => {
4860
4873
  const c = () => {
@@ -4865,7 +4878,7 @@ function lo() {
4865
4878
  };
4866
4879
  }, [i]), { controlsVisible: n, showControls: i, hideControls: a, setControlsHeld: d };
4867
4880
  }
4868
- const vr = [], Sr = [], uo = {
4881
+ const vr = [], Sr = [], ho = {
4869
4882
  fragments: vr,
4870
4883
  durationMs: null,
4871
4884
  mseCodec: null,
@@ -4873,8 +4886,8 @@ const vr = [], Sr = [], uo = {
4873
4886
  audioTracks: Sr,
4874
4887
  contentToken: null
4875
4888
  };
4876
- function fo(n, e) {
4877
- if (!n || n.url !== e) return uo;
4889
+ function po(n, e) {
4890
+ if (!n || n.url !== e) return ho;
4878
4891
  const t = n.data;
4879
4892
  return {
4880
4893
  fragments: t.fragments || vr,
@@ -4903,7 +4916,7 @@ function Rn(n) {
4903
4916
  return null;
4904
4917
  }
4905
4918
  }
4906
- function ho(n) {
4919
+ function mo(n) {
4907
4920
  const [e, t] = $(null);
4908
4921
  return F(() => {
4909
4922
  const r = new AbortController();
@@ -4956,7 +4969,7 @@ function ho(n) {
4956
4969
  return s(), () => {
4957
4970
  r.abort();
4958
4971
  };
4959
- }, [n]), ke(() => fo(e, n), [e, n]);
4972
+ }, [n]), ke(() => po(e, n), [e, n]);
4960
4973
  }
4961
4974
  const $t = {
4962
4975
  audioTracks: [],
@@ -4964,12 +4977,12 @@ const $t = {
4964
4977
  selectedAudioIndex: 0,
4965
4978
  selectedSubtitleIndex: 0
4966
4979
  };
4967
- function po(n) {
4968
- const [e, t] = $($t), r = ms(), s = S((d) => d.mediaPrefs.preferredAudioLang);
4980
+ function go(n) {
4981
+ const [e, t] = $($t), r = ps(), s = S((d) => d.mediaPrefs.preferredAudioLang);
4969
4982
  F(() => {
4970
4983
  if (!n) return;
4971
4984
  t($t);
4972
- const d = new AbortController(), c = gs(r);
4985
+ const d = new AbortController(), c = ms(r);
4973
4986
  let o;
4974
4987
  return (async () => {
4975
4988
  try {
@@ -4999,12 +5012,12 @@ function po(n) {
4999
5012
  setSelectedSubtitleIndex: a
5000
5013
  };
5001
5014
  }
5002
- const mo = 100;
5003
- function go(n) {
5004
- return !n.roomPlaying || n.videoPaused ? "not-playing" : n.seekInFlight ? "seeking" : n.advancedMs > mo ? "advancing" : "stalled";
5015
+ const bo = 100;
5016
+ function yo(n) {
5017
+ return !n.roomPlaying || n.videoPaused ? "not-playing" : n.seekInFlight ? "seeking" : n.advancedMs > bo ? "advancing" : "stalled";
5005
5018
  }
5006
- const Bt = 4e4, bo = 3e3;
5007
- function yo(n, e, t, r, s, i) {
5019
+ const Bt = 4e4, vo = 3e3;
5020
+ function So(n, e, t, r, s, i) {
5008
5021
  const a = (m) => {
5009
5022
  const _ = {};
5010
5023
  return (i?.current ?? []).forEach((v, k) => {
@@ -5029,13 +5042,13 @@ function yo(n, e, t, r, s, i) {
5029
5042
  function g() {
5030
5043
  _();
5031
5044
  const p = n.current;
5032
- p && (y.current = p.currentTime, x.current = setTimeout(v, bo));
5045
+ p && (y.current = p.currentTime, x.current = setTimeout(v, vo));
5033
5046
  }
5034
5047
  function v() {
5035
5048
  x.current = null;
5036
5049
  const p = n.current;
5037
5050
  if (!p) return;
5038
- const A = S.getState(), C = t.current, j = go({
5051
+ const A = S.getState(), C = t.current, j = yo({
5039
5052
  roomPlaying: A.snapshot.playing,
5040
5053
  videoPaused: p.paused,
5041
5054
  seekInFlight: !!C?.seekInFlight,
@@ -5193,8 +5206,8 @@ function yo(n, e, t, r, s, i) {
5193
5206
  };
5194
5207
  }, [r]);
5195
5208
  }
5196
- const vo = 1.5;
5197
- function So(n, e, t, r, s, i) {
5209
+ const wo = 1.5;
5210
+ function xo(n, e, t, r, s, i) {
5198
5211
  const a = N(null), d = N(null), c = U(() => {
5199
5212
  a.current && (clearInterval(a.current), a.current = null), d.current?.(), d.current = null;
5200
5213
  }, []);
@@ -5223,7 +5236,7 @@ function So(n, e, t, r, s, i) {
5223
5236
  };
5224
5237
  a.current = setInterval(x, pn);
5225
5238
  const y = () => {
5226
- performance.now() - b >= pn * vo && x();
5239
+ performance.now() - b >= pn * wo && x();
5227
5240
  };
5228
5241
  if (o && (o.addEventListener("timeupdate", y), d.current = () => o.removeEventListener("timeupdate", y)), o && !t.current?.seekInFlight) {
5229
5242
  b = performance.now();
@@ -5233,7 +5246,7 @@ function So(n, e, t, r, s, i) {
5233
5246
  return c;
5234
5247
  }, [r, s]), { stopPrefetch: c };
5235
5248
  }
5236
- function wo(n, e, t, r, s, i) {
5249
+ function Eo(n, e, t, r, s, i) {
5237
5250
  const a = S((o) => o.snapshot), d = S((o) => o.loadGeneration), c = N(d);
5238
5251
  F(() => {
5239
5252
  const o = n.current;
@@ -5265,7 +5278,7 @@ function Fn(n, e) {
5265
5278
  }, { once: !0 });
5266
5279
  });
5267
5280
  }
5268
- function xo(n) {
5281
+ function Mo(n) {
5269
5282
  const e = S((s) => s.playlist), t = S((s) => s.activePlaylistIndex), r = S((s) => s.snapshot.mediaId);
5270
5283
  F(() => {
5271
5284
  if (!e || !e.videos.some((i) => i.mediaId === r)) return;
@@ -5363,11 +5376,11 @@ function xo(n) {
5363
5376
  }, [e?.id, t, r]);
5364
5377
  }
5365
5378
  const $e = "bg-play";
5366
- function Eo() {
5379
+ function ko() {
5367
5380
  const n = S.getState();
5368
5381
  return !!n.snapshot.leaderId && n.snapshot.leaderId === n.me.clientId;
5369
5382
  }
5370
- function Mo(n) {
5383
+ function _o(n) {
5371
5384
  return typeof Image > "u" ? Promise.resolve(null) : n.reduce(
5372
5385
  (e, t) => e.then((r) => r ?? new Promise((s) => {
5373
5386
  const i = new Image();
@@ -5376,16 +5389,16 @@ function Mo(n) {
5376
5389
  Promise.resolve(null)
5377
5390
  );
5378
5391
  }
5379
- function ko(n, e, t, r, s, i) {
5392
+ function To(n, e, t, r, s, i) {
5380
5393
  const a = N(!1), d = N(0), c = Dt((o) => {
5381
5394
  const u = n.current, f = e.current;
5382
5395
  if (!u || !s) return;
5383
- const b = S.getState(), x = _i({
5396
+ const b = S.getState(), x = Ai({
5384
5397
  roomPlaying: b.snapshot.playing,
5385
5398
  seekInFlight: !!f?.seekInFlight,
5386
5399
  elementPaused: u.paused,
5387
5400
  elementMs: u.currentTime * 1e3,
5388
- roomMs: Ti(b.snapshot, b.snapshotReceivedAt, Date.now()),
5401
+ roomMs: Ci(b.snapshot, b.snapshotReceivedAt, Date.now()),
5389
5402
  durationMs: r,
5390
5403
  driftToleranceMs: Gn
5391
5404
  });
@@ -5396,7 +5409,7 @@ function ko(n, e, t, r, s, i) {
5396
5409
  if (!o || !s) return;
5397
5410
  const u = () => {
5398
5411
  const b = S.getState();
5399
- Mi({
5412
+ _i({
5400
5413
  hidden: document.visibilityState === "hidden",
5401
5414
  roomPlaying: b.snapshot.playing,
5402
5415
  seekInFlight: !!e.current?.seekInFlight,
@@ -5422,9 +5435,9 @@ function ko(n, e, t, r, s, i) {
5422
5435
  artwork: v ? [{ src: v }] : []
5423
5436
  }));
5424
5437
  };
5425
- x(null), Mo(Ai(t).map(bs)).then(x);
5438
+ x(null), _o(Ii(t).map(gs)).then(x);
5426
5439
  const y = (v) => () => {
5427
- const k = S.getState(), R = ki(v, { isLeader: Eo(), roomPlaying: k.snapshot.playing });
5440
+ const k = S.getState(), R = Ti(v, { isLeader: ko(), roomPlaying: k.snapshot.playing });
5428
5441
  switch (w($e, "media session press", { action: v, result: R.kind }), v === "pause" && (d.current = Date.now()), R.kind) {
5429
5442
  case "control":
5430
5443
  Ce(R.control), R.control === "pause" && o.pause();
@@ -5497,9 +5510,9 @@ function ko(n, e, t, r, s, i) {
5497
5510
  };
5498
5511
  }, []);
5499
5512
  }
5500
- const _o = 3e5, To = 1, Ao = 1;
5501
- function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5502
- const r = N(null), [s, i] = $(!1), [a, d] = $(!1), { controlsVisible: c, showControls: o, hideControls: u, setControlsHeld: f } = lo();
5513
+ const Ao = 3e5, Co = 1, Io = 1;
5514
+ function Ro({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5515
+ const r = N(null), [s, i] = $(!1), [a, d] = $(!1), { controlsVisible: c, showControls: o, hideControls: u, setControlsHeld: f } = fo();
5503
5516
  F(() => {
5504
5517
  const E = () => d(!!document.fullscreenElement);
5505
5518
  return document.addEventListener("fullscreenchange", E), () => document.removeEventListener("fullscreenchange", E);
@@ -5511,7 +5524,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5511
5524
  initSegment: h,
5512
5525
  audioTracks: m,
5513
5526
  contentToken: _
5514
- } = ho(e), g = U((E) => {
5527
+ } = mo(e), g = U((E) => {
5515
5528
  if (!_) return null;
5516
5529
  const D = n.replace(new RegExp(`/${dt.replace(/\./g, "\\.")}$`), "");
5517
5530
  return D === n ? null : { baseUrl: D, token: _, trackId: E };
@@ -5522,11 +5535,11 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5522
5535
  setSelectedAudioIndex: Xe,
5523
5536
  selectedSubtitleIndex: V,
5524
5537
  setSelectedSubtitleIndex: de
5525
- } = po(t), xe = S((E) => E.mediaPrefs), vt = S((E) => E.mutedForAutoplay), wr = S((E) => E.setMutedForAutoplay), Zt = S((E) => E.setSubtitlesEnabled), xr = S((E) => E.setSubtitleStyle), St = S((E) => E.setPreferredAudioLang), Er = xe.subtitlesEnabled, en = xe.subtitleStyle, Mr = pe[ye]?.lang, kr = Re.some((E) => E.lang === "eng"), [_r, tn] = $(null);
5538
+ } = go(t), xe = S((E) => E.mediaPrefs), vt = S((E) => E.mutedForAutoplay), wr = S((E) => E.setMutedForAutoplay), Zt = S((E) => E.setSubtitlesEnabled), xr = S((E) => E.setSubtitleStyle), St = S((E) => E.setPreferredAudioLang), Er = xe.subtitlesEnabled, en = xe.subtitleStyle, Mr = pe[ye]?.lang, kr = Re.some((E) => E.lang === "eng"), [_r, tn] = $(null);
5526
5539
  F(() => {
5527
5540
  tn(null);
5528
5541
  }, [t]);
5529
- const Ye = Zi({
5542
+ const Ye = to({
5530
5543
  override: _r,
5531
5544
  globalEnabled: Er,
5532
5545
  selectedAudioLang: Mr,
@@ -5574,12 +5587,12 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5574
5587
  C.current = G;
5575
5588
  const le = ++wt.current;
5576
5589
  window.__FRAGMENT_MANAGER__ = G, window.__AUDIO_FRAGMENT_MANAGERS__ = H.current;
5577
- const te = new so({
5590
+ const te = new io({
5578
5591
  videoRef: r,
5579
5592
  fragmentManagerRef: C,
5580
5593
  audioFragmentManagersRef: H
5581
5594
  });
5582
- ne.current = te, window.__SEEK_COORDINATOR__ = te, ao();
5595
+ ne.current = te, window.__SEEK_COORDINATOR__ = te, oo();
5583
5596
  const K = r.current, re = () => {
5584
5597
  const q = K?.error;
5585
5598
  q && (ue("video", `Media error code=${q.code}: ${q.message}`, {
@@ -5645,7 +5658,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5645
5658
  }
5646
5659
  };
5647
5660
  return K && (X.addEventListener("sourceopen", Ue), D = URL.createObjectURL(X), K.src = D, K.addEventListener("error", re)), () => {
5648
- r.current?.pause(), K && K.removeEventListener("error", re), X.removeEventListener("sourceopen", Ue), io(), te.dispose(), ne.current = null, G.dispose(), C.current = null, window.__FRAGMENT_MANAGER__ = null, window.__AUDIO_FRAGMENT_MANAGERS__ = null;
5661
+ r.current?.pause(), K && K.removeEventListener("error", re), X.removeEventListener("sourceopen", Ue), co(), te.dispose(), ne.current = null, G.dispose(), C.current = null, window.__FRAGMENT_MANAGER__ = null, window.__AUDIO_FRAGMENT_MANAGERS__ = null;
5649
5662
  for (const q of H.current) q.dispose();
5650
5663
  if (H.current = [], X.readyState === "open") {
5651
5664
  for (const q of [p.current, ...L.current])
@@ -5762,7 +5775,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5762
5775
  })();
5763
5776
  }, [k, s, ye, m, t, n, Ze]);
5764
5777
  const sn = U((E) => {
5765
- if (P.current >= Ao) {
5778
+ if (P.current >= Io) {
5766
5779
  Gt("phantom-recreate-exhausted", { reason: E, recreates: P.current, mediaId: t });
5767
5780
  return;
5768
5781
  }
@@ -5786,7 +5799,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5786
5799
  })
5787
5800
  );
5788
5801
  if (await E.ensureBuffered(G, "initial"), E.isDisposed) return;
5789
- const re = ys;
5802
+ const re = bs;
5790
5803
  await Promise.allSettled(K);
5791
5804
  const se = te.map(
5792
5805
  (J) => J.waitForBuffered(G + Me, re)
@@ -5796,7 +5809,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5796
5809
  aheadMs: Math.round(E.getBufferedAheadMs(G)),
5797
5810
  targetMs: Me
5798
5811
  }), E.isDisposed) return;
5799
- if (E.getBufferedAheadMs(G) > _o && E.getLoadedCount() === 0) {
5812
+ if (E.getBufferedAheadMs(G) > Ao && E.getLoadedCount() === 0) {
5800
5813
  E.dumpBufferDiagnostics(G, "phantom-detected"), T("buffer", "PHANTOM-BUFFER detected at gate — recreating MediaSource", {
5801
5814
  gateAheadMs: Math.round(E.getBufferedAheadMs(G)),
5802
5815
  loaded: E.getLoadedCount(),
@@ -5812,7 +5825,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5812
5825
  totalMs: q
5813
5826
  });
5814
5827
  const ve = Ue ? "gate-pass" : "gate-timeout";
5815
- E.emitInitDigest("video", ve), te.forEach((J, ie) => J.emitInitDigest(`audio:${ie}`, ve)), I.current || (I.current = !0, vs(t));
5828
+ E.emitInitDigest("video", ve), te.forEach((J, ie) => J.emitInitDigest(`audio:${ie}`, ve)), I.current || (I.current = !0, ys(t));
5816
5829
  let Y = G;
5817
5830
  if (D && Y > 0) {
5818
5831
  const J = D.buffered;
@@ -5822,7 +5835,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5822
5835
  }
5823
5836
  D.currentTime = Y / 1e3, await yr(D, 3e3);
5824
5837
  }
5825
- we.current = Y, i(!0), B.current = !0, j.current = 0, Cn() && T("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: t }), to(), w("buffer", "initializePlayback complete", {
5838
+ we.current = Y, i(!0), B.current = !0, j.current = 0, Cn() && T("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: t }), ro(), w("buffer", "initializePlayback complete", {
5826
5839
  mediaId: t,
5827
5840
  startMs: G,
5828
5841
  seekMs: Y,
@@ -5887,7 +5900,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5887
5900
  return;
5888
5901
  }
5889
5902
  const re = K.includes("SourceBuffer is full"), se = K.includes("init segment failed");
5890
- j.current += 1, re || se || j.current > To ? (ue("buffer", "Initialize playback failed — recreating MediaSource", {
5903
+ j.current += 1, re || se || j.current > Co ? (ue("buffer", "Initialize playback failed — recreating MediaSource", {
5891
5904
  error: K,
5892
5905
  mediaId: t,
5893
5906
  attempt: j.current,
@@ -5903,9 +5916,9 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5903
5916
  }
5904
5917
  }
5905
5918
  }
5906
- wo(ne, r, we, s, lt, nn), yo(r, C, ne, s, nn, H), ko(r, ne, t, x ?? 0, s, lt);
5907
- const { stopPrefetch: Cr } = So(r, C, ne, s, Ie, H);
5908
- xo(C), qe.current = Cr;
5919
+ Eo(ne, r, we, s, lt, nn), So(r, C, ne, s, nn, H), To(r, ne, t, x ?? 0, s, lt);
5920
+ const { stopPrefetch: Cr } = xo(r, C, ne, s, Ie, H);
5921
+ Mo(C), qe.current = Cr;
5909
5922
  const Ir = U(() => {
5910
5923
  const E = r.current?.parentElement;
5911
5924
  E && (document.fullscreenElement ? document.exitFullscreen().catch((D) => T("ui", "exitFullscreen failed", { error: D?.message, name: D?.name })) : E.requestFullscreen().catch((D) => T("ui", "requestFullscreen failed", { error: D?.message, name: D?.name })));
@@ -5931,7 +5944,7 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5931
5944
  }
5932
5945
  ),
5933
5946
  /* @__PURE__ */ l(
5934
- Ui,
5947
+ Gi,
5935
5948
  {
5936
5949
  subtitleUrl: Fr,
5937
5950
  videoRef: r,
@@ -5939,9 +5952,9 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5939
5952
  enabled: Ye
5940
5953
  }
5941
5954
  ),
5942
- /* @__PURE__ */ l(Ci, { mediaId: t, visible: c }),
5955
+ /* @__PURE__ */ l(Ri, { mediaId: t, visible: c }),
5943
5956
  /* @__PURE__ */ l(
5944
- xi,
5957
+ Mi,
5945
5958
  {
5946
5959
  videoRef: r,
5947
5960
  mediaId: t,
@@ -5989,14 +6002,14 @@ function Co({ mediaUrl: n, indexUrl: e, mediaId: t }) {
5989
6002
  }
5990
6003
  );
5991
6004
  }
5992
- function Io() {
6005
+ function Fo() {
5993
6006
  const n = S((t) => t.snapshot.mediaId), e = ke(() => n ? { mediaId: n, ...Wn(n) } : null, [n]);
5994
- return e ? /* @__PURE__ */ l(Ht, { children: /* @__PURE__ */ l(Co, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ l(xs, {});
6007
+ return e ? /* @__PURE__ */ l(Ht, { children: /* @__PURE__ */ l(Ro, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ l(ws, {});
5995
6008
  }
5996
- const Ro = (n) => {
5997
- const e = Is(n);
6009
+ const No = (n) => {
6010
+ const e = Cs(n);
5998
6011
  return e.render(
5999
- /* @__PURE__ */ l(Ss.Provider, { value: ws(), children: /* @__PURE__ */ l(Io, {}) })
6012
+ /* @__PURE__ */ l(vs.Provider, { value: Ss(), children: /* @__PURE__ */ l(Fo, {}) })
6000
6013
  ), {
6001
6014
  update() {
6002
6015
  },
@@ -6007,25 +6020,21 @@ const Ro = (n) => {
6007
6020
  queueMicrotask(() => e.unmount());
6008
6021
  }
6009
6022
  };
6010
- }, Fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6023
+ }, Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6011
6024
  __proto__: null,
6012
- mount: Ro
6013
- }, Symbol.toStringTag, { value: "Module" })), No = {
6025
+ mount: No
6026
+ }, Symbol.toStringTag, { value: "Module" })), $o = {
6014
6027
  id: "player",
6015
6028
  name: "Media player",
6016
- load: () => Promise.resolve(Fo)
6017
- }, Lo = ct(() => import("./MediaDrawer-DY7Rc7Bm.js")), $o = ct(() => import("./CharacterModal-Doc-Va6V.js")), Bo = ct(() => import("./GameModule-C9L3B_xh.js"));
6018
- function Do() {
6029
+ load: () => Promise.resolve(Lo)
6030
+ }, Bo = ct(() => import("./MediaDrawer-DD5kS4Qx.js")), Do = ct(() => import("./CharacterModal-BvKgFeXp.js")), Po = ct(() => import("./GameModule-DCJB67lD.js"));
6031
+ function Oo() {
6019
6032
  const n = S((h) => h.snapshot), e = S((h) => h.ensureAutoIdentity), t = S((h) => h.characterModalOpen), r = S((h) => h.setCharacterModalOpen), s = S((h) => h.setTierlistOpen), i = bt(), a = ke(
6020
- () => i?.kind === "module" ? Ma(i, window.location.origin) : null,
6033
+ () => i?.kind === "module" ? _a(i, window.location.origin) : null,
6021
6034
  [i]
6022
- ), d = Es(), c = N(!1), [o, u] = $(!1), f = d.roomKey || null;
6023
- F(() => si(), []), Pr(() => {
6024
- if (!f) return;
6025
- const h = ga(f);
6026
- h && S.getState().setRoomKeyType(h);
6027
- }, [f]), F(() => {
6028
- f && ci(f);
6035
+ ), d = xs(), c = N(!1), [o, u] = $(!1), f = d.roomKey || null;
6036
+ F(() => ii(), []), F(() => {
6037
+ f && di(f);
6029
6038
  }, [f]), F(() => {
6030
6039
  const h = () => u(!0);
6031
6040
  return window.addEventListener(Ot, h), () => window.removeEventListener(Ot, h);
@@ -6036,7 +6045,7 @@ function Do() {
6036
6045
  return (async () => {
6037
6046
  try {
6038
6047
  await Promise.race([
6039
- Promise.all([Ms(), ks()]),
6048
+ Promise.all([Es(), Ms()]),
6040
6049
  new Promise((v) => setTimeout(v, m))
6041
6050
  ]);
6042
6051
  } catch (v) {
@@ -6046,7 +6055,7 @@ function Do() {
6046
6055
  const _ = S.getState();
6047
6056
  w("room", "Joining room", { roomKey: f, name: _.name, sprite: _.sprite }), e();
6048
6057
  const g = S.getState();
6049
- _s({
6058
+ ks({
6050
6059
  room_key: f,
6051
6060
  name: g.name || void 0,
6052
6061
  sprite: g.sprite || void 0
@@ -6069,39 +6078,39 @@ function Do() {
6069
6078
  };
6070
6079
  return f ? /* @__PURE__ */ M("div", { className: "relative flex-1 flex overflow-hidden min-h-0", children: [
6071
6080
  /* @__PURE__ */ M("div", { className: "flex-1 relative bg-black overflow-hidden min-w-0", children: [
6072
- /* @__PURE__ */ l(yn, { activity: No, roomKey: n.roomId ?? "", layer: "base" }),
6073
- i?.kind === "iframe" && /* @__PURE__ */ l(Ht, { children: /* @__PURE__ */ l(Be.Suspense, { fallback: null, children: /* @__PURE__ */ l(Bo, {}) }) }),
6081
+ /* @__PURE__ */ l(yn, { activity: $o, roomKey: n.roomId ?? "", layer: "base" }),
6082
+ i?.kind === "iframe" && /* @__PURE__ */ l(Ht, { children: /* @__PURE__ */ l(Be.Suspense, { fallback: null, children: /* @__PURE__ */ l(Po, {}) }) }),
6074
6083
  a && n.roomId && /* @__PURE__ */ l(Ht, { children: /* @__PURE__ */ l(yn, { activity: a, roomKey: n.roomId, layer: "overlay" }, a.id) }),
6075
- /* @__PURE__ */ M(ja, { children: [
6076
- /* @__PURE__ */ l(Ra, {}),
6077
- /* @__PURE__ */ l(Oa, {}),
6078
- /* @__PURE__ */ l(ri, {}),
6079
- /* @__PURE__ */ l(Ua, {})
6084
+ /* @__PURE__ */ M(Wa, { children: [
6085
+ /* @__PURE__ */ l(Na, {}),
6086
+ /* @__PURE__ */ l(Ua, {}),
6087
+ /* @__PURE__ */ l(ai, {}),
6088
+ /* @__PURE__ */ l(Ga, {})
6080
6089
  ] })
6081
6090
  ] }),
6082
- /* @__PURE__ */ l(wa, {}),
6083
- /* @__PURE__ */ l(Be.Suspense, { fallback: /* @__PURE__ */ l(Aa, { open: o, onClose: b }), children: /* @__PURE__ */ l(Lo, { open: o, onClose: b }) }),
6084
- /* @__PURE__ */ l(Be.Suspense, { fallback: null, children: t && /* @__PURE__ */ l($o, { open: t, onClose: x, roomKey: f, tierlist: y }) })
6091
+ /* @__PURE__ */ l(Ea, {}),
6092
+ /* @__PURE__ */ l(Be.Suspense, { fallback: /* @__PURE__ */ l(Ia, { open: o, onClose: b }), children: /* @__PURE__ */ l(Bo, { open: o, onClose: b }) }),
6093
+ /* @__PURE__ */ l(Be.Suspense, { fallback: null, children: t && /* @__PURE__ */ l(Do, { open: t, onClose: x, roomKey: f, tierlist: y }) })
6085
6094
  ] }) : (T("room", "No room key provided"), /* @__PURE__ */ l("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ M("div", { className: "text-text-secondary", children: [
6086
6095
  "No room key provided. Go to the ",
6087
6096
  /* @__PURE__ */ l("a", { href: "/", className: "underline", children: "home page" }),
6088
6097
  " to select a room."
6089
6098
  ] }) }));
6090
6099
  }
6091
- const Qo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6100
+ const Xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6092
6101
  __proto__: null,
6093
- default: Do
6102
+ default: Oo
6094
6103
  }, Symbol.toStringTag, { value: "Module" }));
6095
6104
  export {
6096
- Ko as B,
6097
- Ta as D,
6098
- Qo as R,
6099
- zo as S,
6100
- _a as a,
6101
- li as b,
6102
- Vo as c,
6105
+ Jo as B,
6106
+ Ca as D,
6107
+ Xo as R,
6108
+ Qo as S,
6109
+ Aa as a,
6110
+ ui as b,
6111
+ zo as c,
6103
6112
  Qe as d,
6104
- Jo as s,
6113
+ qo as s,
6105
6114
  qt as u
6106
6115
  };
6107
- //# sourceMappingURL=Room-C4jnGrvL.js.map
6116
+ //# sourceMappingURL=Room-D9ctqJMZ.js.map