@hadoku/watchparty-ui 0.45.95 → 0.45.97

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.
@@ -4801,10 +4801,10 @@ const ki = (e) => {
4801
4801
  function Jo(e) {
4802
4802
  return typeof e == "string" && Xo.test(e);
4803
4803
  }
4804
- const vr = 8080, fn = 5173, Ym = 80, Qo = "/watchparty/ws", ed = 500, Xm = 1e3, ba = 4, Jm = 3e3, Zo = typeof process < "u" && process.env ? process.env : {};
4804
+ const vr = 8080, fn = 5173, Xm = 80, Qo = "/watchparty/ws", ed = 500, Jm = 1e3, ba = 4, Qm = 3e3, Zo = typeof process < "u" && process.env ? process.env : {};
4805
4805
  Zo.PRODUCTION_UI_URL;
4806
4806
  Zo.PRODUCTION_SERVER_URL;
4807
- const Vr = u.enum(["S", "A", "B", "C", "D", "F"]), Qm = ["S", "A", "B", "C", "D", "F"], Ai = 2e4, td = 300;
4807
+ const Vr = u.enum(["S", "A", "B", "C", "D", "F"]), Zm = ["S", "A", "B", "C", "D", "F"], Ai = 2e4, td = 300;
4808
4808
  u.object({
4809
4809
  name: u.string().min(1).max(32).optional(),
4810
4810
  sprite: u.string().min(1).max(32).optional(),
@@ -5228,7 +5228,7 @@ function yd(e) {
5228
5228
  function hn(e) {
5229
5229
  return !!e && Nt.includes(e);
5230
5230
  }
5231
- const Zm = 4, eg = 3e4, tg = 5e3, rg = 2e3, ng = 5e3, ag = 2e3, ig = 5e3, og = 2e3, sg = 1e4, lg = 10, cg = 2e3, ug = 3, dg = 50, fg = 3, hg = 3e4, pg = 2e4, mg = 99999, vd = 5e3, bd = "output_frag.mp4", Pi = "/healthz", as = { mode: "off", percent: 0 }, wd = ["off", "on", "ab"];
5231
+ const eg = 4, tg = 3e4, rg = 5e3, ng = 2e3, ag = 5e3, ig = 2e3, og = 5e3, sg = 2e3, lg = 1e4, cg = 10, ug = 2e3, dg = 3, fg = 50, hg = 3, pg = 3e4, mg = 2e4, gg = 99999, vd = 5e3, bd = "output_frag.mp4", Pi = "/healthz", as = { mode: "off", percent: 0 }, wd = ["off", "on", "ab"];
5232
5232
  function _d(e) {
5233
5233
  return typeof e == "string" && wd.includes(e);
5234
5234
  }
@@ -5355,7 +5355,10 @@ const ls = u.string().min(2).max(512).refine(Ad, {
5355
5355
  * Not addable: a movie, or a title with no usable Latin-script name. The
5356
5356
  * scraper matches releases by `SxxExx`, so a film can never arrive through it.
5357
5357
  */
5358
- addable: u.boolean()
5358
+ addable: u.boolean(),
5359
+ /** AniList links this entry to another season (a PREQUEL or SEQUEL), so the
5360
+ * drawer offers its season list (`GET /api/search/seasons`). */
5361
+ hasSeasons: u.boolean()
5359
5362
  });
5360
5363
  u.object({
5361
5364
  results: u.array(Od),
@@ -5371,6 +5374,22 @@ const Dd = u.object({
5371
5374
  thumb: u.string().nullable()
5372
5375
  });
5373
5376
  u.object({ results: u.array(Dd) });
5377
+ const Nd = u.object({
5378
+ id: u.string(),
5379
+ title: u.string(),
5380
+ /** 1-based position in the chain. */
5381
+ number: u.number().int(),
5382
+ /** When it first aired; either may be null for an unannounced season. */
5383
+ year: u.number().int().nullable(),
5384
+ month: u.number().int().min(1).max(12).nullable(),
5385
+ episodes: u.number().int().nullable(),
5386
+ format: u.string().nullable(),
5387
+ onWatchlist: u.boolean()
5388
+ });
5389
+ u.object({
5390
+ /** Requested id → its show's seasons. An id AniList does not know is absent. */
5391
+ chains: u.record(u.string(), u.array(Nd))
5392
+ });
5374
5393
  u.object({
5375
5394
  source: Ra,
5376
5395
  id: u.string().regex(/^\d{1,12}$/)
@@ -5382,7 +5401,7 @@ u.object({
5382
5401
  * chain), or null when it could not tell. */
5383
5402
  season: u.number().int().nullable()
5384
5403
  });
5385
- const Nd = 99, $d = u.object({
5404
+ const $d = 99, Fd = u.object({
5386
5405
  id: u.number().int(),
5387
5406
  series: u.string(),
5388
5407
  season: u.number().int().nullable(),
@@ -5402,13 +5421,13 @@ const Nd = 99, $d = u.object({
5402
5421
  * is unknown. */
5403
5422
  episodes: u.object({ ready: u.number().int(), downloaded: u.number().int() }).nullable()
5404
5423
  });
5405
- u.object({ entries: u.array($d) });
5424
+ u.object({ entries: u.array(Fd) });
5406
5425
  u.object({
5407
- season: u.number().int().min(1).max(Nd).nullable().optional(),
5426
+ season: u.number().int().min(1).max($d).nullable().optional(),
5408
5427
  title: u.string().trim().min(1).max(200).optional(),
5409
5428
  retired: u.boolean().optional()
5410
5429
  }).strict().refine((e) => e.season !== void 0 || e.title !== void 0 || e.retired !== void 0, { message: "nothing to change" });
5411
- const gg = 2, yg = 100;
5430
+ const yg = 2, vg = 100;
5412
5431
  var On = {
5413
5432
  image: 10 * 1024 * 1024,
5414
5433
  audio: 50 * 1024 * 1024
@@ -5419,7 +5438,7 @@ function we(e, t, r) {
5419
5438
  function xe(e) {
5420
5439
  return [...e].map((t) => t.charCodeAt(0));
5421
5440
  }
5422
- function Fd(e) {
5441
+ function Ud(e) {
5423
5442
  if (e.length < 3 || e[0] !== 255) return !1;
5424
5443
  const t = e[1] ?? 0, r = e[2] ?? 0, n = (t & 224) === 224, a = t >> 3 & 3, i = t >> 1 & 3, o = r >> 4, s = r >> 2 & 3;
5425
5444
  return n && a !== 1 && i === 1 && o !== 0 && o !== 15 && s !== 3;
@@ -5470,7 +5489,7 @@ var cs = [
5470
5489
  kind: "audio",
5471
5490
  // Either an ID3v2 tag ("ID3" + a major version of 2–4 + a minor that is
5472
5491
  // never 0xFF) or a bare Layer III frame. Most real mp3s carry the tag.
5473
- matches: (e) => we(e, 0, xe("ID3")) && (e[3] ?? 0) >= 2 && (e[3] ?? 0) <= 4 && e[4] !== 255 || Fd(e)
5492
+ matches: (e) => we(e, 0, xe("ID3")) && (e[3] ?? 0) >= 2 && (e[3] ?? 0) <= 4 && e[4] !== 255 || Ud(e)
5474
5493
  },
5475
5494
  {
5476
5495
  contentType: "audio/flac",
@@ -5516,7 +5535,7 @@ function us(e) {
5516
5535
  );
5517
5536
  }
5518
5537
  cs.map((e) => e.contentType).join(", ");
5519
- var Ud = us("image"), Bd = us("audio"), jd = {
5538
+ var Bd = us("image"), jd = us("audio"), zd = {
5520
5539
  "audio/mp3": "audio/mpeg",
5521
5540
  "audio/x-mp3": "audio/mpeg",
5522
5541
  "audio/x-mpeg": "audio/mpeg",
@@ -5530,9 +5549,9 @@ var Ud = us("image"), Bd = us("audio"), jd = {
5530
5549
  };
5531
5550
  function ds(e) {
5532
5551
  const t = e.toLowerCase();
5533
- return Ud.includes(t) ? "image" : Bd.includes(t) || t in jd ? "audio" : null;
5552
+ return Bd.includes(t) ? "image" : jd.includes(t) || t in zd ? "audio" : null;
5534
5553
  }
5535
- var zd = 24, vg = 250, tr = class extends Error {
5554
+ var Hd = 24, bg = 250, tr = class extends Error {
5536
5555
  reason;
5537
5556
  /** HTTP status, when there was a response. */
5538
5557
  status;
@@ -5549,7 +5568,7 @@ var zd = 24, vg = 250, tr = class extends Error {
5549
5568
  super(t), this.name = "CdnError", this.reason = e, this.status = r, this.retryAfterSeconds = n;
5550
5569
  }
5551
5570
  };
5552
- function Hd(e, t = Date.now()) {
5571
+ function Vd(e, t = Date.now()) {
5553
5572
  if (!e) return null;
5554
5573
  const r = e.trim();
5555
5574
  if (!r) return null;
@@ -5558,7 +5577,7 @@ function Hd(e, t = Date.now()) {
5558
5577
  const a = Date.parse(r);
5559
5578
  return Number.isNaN(a) ? null : Math.max(0, Math.ceil((a - t) / 1e3));
5560
5579
  }
5561
- function Vd(e) {
5580
+ function qd(e) {
5562
5581
  switch (e) {
5563
5582
  case 401:
5564
5583
  return "unauthenticated";
@@ -5581,8 +5600,8 @@ function Vd(e) {
5581
5600
  return "unknown";
5582
5601
  }
5583
5602
  }
5584
- async function qd(e) {
5585
- const t = Vd(e.status);
5603
+ async function Wd(e) {
5604
+ const t = qd(e.status);
5586
5605
  let r = `CDN request failed (${e.status})`;
5587
5606
  try {
5588
5607
  const n = await e.json();
@@ -5593,11 +5612,11 @@ async function qd(e) {
5593
5612
  t,
5594
5613
  r,
5595
5614
  e.status,
5596
- t === "rate-limited" ? Hd(e.headers.get("Retry-After")) : null
5615
+ t === "rate-limited" ? Vd(e.headers.get("Retry-After")) : null
5597
5616
  );
5598
5617
  }
5599
- var Wd = "/cdn/api/upload", Kd = /^[0-9a-f]{64}\.[a-z0-9]{1,8}$/;
5600
- function Gd(e) {
5618
+ var Kd = "/cdn/api/upload", Gd = /^[0-9a-f]{64}\.[a-z0-9]{1,8}$/;
5619
+ function Yd(e) {
5601
5620
  if (e.size === 0)
5602
5621
  throw new tr("invalid", "File is empty");
5603
5622
  const t = e.type ? ds(e.type) : null;
@@ -5607,7 +5626,7 @@ function Gd(e) {
5607
5626
  if (e.size > r)
5608
5627
  throw new tr("too-large", `File is ${e.size} bytes; the maximum is ${r}`);
5609
5628
  }
5610
- function Yd(e) {
5629
+ function Xd(e) {
5611
5630
  if (typeof e != "object" || e === null) return null;
5612
5631
  const t = e;
5613
5632
  return typeof t.key != "string" || !t.key ? null : {
@@ -5619,8 +5638,8 @@ function Yd(e) {
5619
5638
  contentType: typeof t.contentType == "string" ? t.contentType : "image/*"
5620
5639
  };
5621
5640
  }
5622
- function Xd(e) {
5623
- const t = e.cdnBase.replace(/\/+$/, ""), r = e.uploadPath ?? Wd, n = e.fetch ?? globalThis.fetch.bind(globalThis);
5641
+ function Jd(e) {
5642
+ const t = e.cdnBase.replace(/\/+$/, ""), r = e.uploadPath ?? Kd, n = e.fetch ?? globalThis.fetch.bind(globalThis);
5624
5643
  async function a(i, o) {
5625
5644
  let s;
5626
5645
  try {
@@ -5628,14 +5647,14 @@ function Xd(e) {
5628
5647
  } catch (l) {
5629
5648
  throw l instanceof Error && l.name === "AbortError" ? l : new tr("network", l instanceof Error ? l.message : "Request failed");
5630
5649
  }
5631
- if (!s.ok) throw await qd(s);
5650
+ if (!s.ok) throw await Wd(s);
5632
5651
  return s;
5633
5652
  }
5634
5653
  return {
5635
5654
  cdnBase: t,
5636
5655
  uploadPath: r,
5637
5656
  async upload(i, o) {
5638
- return Gd(i), await (await a(r, {
5657
+ return Yd(i), await (await a(r, {
5639
5658
  method: "POST",
5640
5659
  body: i,
5641
5660
  signal: o?.signal,
@@ -5648,21 +5667,21 @@ function Xd(e) {
5648
5667
  return `${t}/${i.replace(/^\/+/, "")}`;
5649
5668
  },
5650
5669
  isKey(i) {
5651
- return Kd.test(i);
5670
+ return Gd.test(i);
5652
5671
  },
5653
5672
  catalogue(i, o) {
5654
5673
  const s = i.replace(/\/+$/, ""), l = o?.surface;
5655
5674
  return {
5656
5675
  async search(c = {}) {
5657
5676
  const d = new URLSearchParams(), h = c.query?.trim();
5658
- h && d.set("q", h), d.set("limit", String(c.limit ?? zd)), c.cursor && d.set("cursor", c.cursor);
5677
+ h && d.set("q", h), d.set("limit", String(c.limit ?? Hd)), c.cursor && d.set("cursor", c.cursor);
5659
5678
  const g = await (await a(`${s}?${d.toString()}`, {
5660
5679
  method: "GET",
5661
5680
  signal: c.signal,
5662
5681
  credentials: "same-origin"
5663
5682
  })).json();
5664
5683
  return {
5665
- results: (Array.isArray(g.results) ? g.results : []).map(Yd).filter((R) => R !== null),
5684
+ results: (Array.isArray(g.results) ? g.results : []).map(Xd).filter((R) => R !== null),
5666
5685
  next: typeof g.next == "string" && g.next ? g.next : null
5667
5686
  };
5668
5687
  },
@@ -5678,12 +5697,12 @@ function Xd(e) {
5678
5697
  }
5679
5698
  };
5680
5699
  }
5681
- function bg(e, t = ["image"]) {
5700
+ function wg(e, t = ["image"]) {
5682
5701
  if (!e) return [];
5683
5702
  const r = (i) => fs(i, t), n = e.files ? Array.from(e.files) : [];
5684
5703
  return n.length > 0 ? n.filter(r) : (e.items ? Array.from(e.items) : []).filter((i) => i.kind === "file").map((i) => i.getAsFile()).filter((i) => i !== null).filter(r);
5685
5704
  }
5686
- function wg(e, t = ["image"]) {
5705
+ function _g(e, t = ["image"]) {
5687
5706
  return e?.files ? Array.from(e.files).filter((r) => fs(r, t)) : [];
5688
5707
  }
5689
5708
  function fs(e, t) {
@@ -5691,7 +5710,7 @@ function fs(e, t) {
5691
5710
  const r = ds(e.type);
5692
5711
  return r !== null && t.includes(r);
5693
5712
  }
5694
- async function _g(e) {
5713
+ async function Eg(e) {
5695
5714
  const t = globalThis.createImageBitmap;
5696
5715
  if (typeof t != "function") return null;
5697
5716
  try {
@@ -5702,27 +5721,27 @@ async function _g(e) {
5702
5721
  }
5703
5722
  }
5704
5723
  let Ir = null, hs = Yo;
5705
- function Jd(e) {
5724
+ function Qd(e) {
5706
5725
  e.cdnBase && (hs = e.cdnBase);
5707
5726
  }
5708
5727
  function ps() {
5709
5728
  return hs.replace(/\/+$/, "");
5710
5729
  }
5711
- function Qd() {
5730
+ function Zd() {
5712
5731
  const e = ps();
5713
- return (!Ir || Ir.base !== e) && (Ir = { base: e, client: Xd({ cdnBase: e }) }), Ir.client;
5732
+ return (!Ir || Ir.base !== e) && (Ir = { base: e, client: Jd({ cdnBase: e }) }), Ir.client;
5714
5733
  }
5715
- function Eg(e) {
5716
- return !Jo(e) || !ps() ? null : Qd().urlFor(e);
5734
+ function Sg(e) {
5735
+ return !Jo(e) || !ps() ? null : Zd().urlFor(e);
5717
5736
  }
5718
- function Zd(e) {
5737
+ function ef(e) {
5719
5738
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
5720
5739
  }
5721
- function ef({ className: e }) {
5740
+ function tf({ className: e }) {
5722
5741
  return /* @__PURE__ */ N(
5723
5742
  "a",
5724
5743
  {
5725
- href: Zd(window.location),
5744
+ href: ef(window.location),
5726
5745
  className: e,
5727
5746
  "data-testid": "sign-in-with-code",
5728
5747
  children: "Sign in with a code"
@@ -5735,17 +5754,17 @@ const rr = {
5735
5754
  cdnBase: Yo
5736
5755
  };
5737
5756
  let qr = { ...rr };
5738
- function tf(e) {
5757
+ function rf(e) {
5739
5758
  const t = Object.fromEntries(
5740
5759
  Object.entries(e).filter(([r, n]) => n !== void 0)
5741
5760
  );
5742
- qr = { ...qr, ...t }, Jd({ cdnBase: qr.cdnBase });
5761
+ qr = { ...qr, ...t }, Qd({ cdnBase: qr.cdnBase });
5743
5762
  }
5744
5763
  function Tt() {
5745
5764
  return qr;
5746
5765
  }
5747
5766
  const ms = pl(rr);
5748
- function rf() {
5767
+ function nf() {
5749
5768
  return ml(ms);
5750
5769
  }
5751
5770
  function gs(e) {
@@ -5782,7 +5801,7 @@ function Ta(e, t) {
5782
5801
  return !1;
5783
5802
  }
5784
5803
  }
5785
- function nf() {
5804
+ function af() {
5786
5805
  try {
5787
5806
  const e = mn();
5788
5807
  if (!e) return [];
@@ -5802,7 +5821,7 @@ function nn(e) {
5802
5821
  } catch {
5803
5822
  }
5804
5823
  }
5805
- function af(e) {
5824
+ function of(e) {
5806
5825
  const t = je(e);
5807
5826
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
5808
5827
  }
@@ -5811,16 +5830,16 @@ let vs = !1;
5811
5830
  function gn(e, t) {
5812
5831
  ys.set(e, t), vs && bs(e, t);
5813
5832
  }
5814
- function of() {
5833
+ function sf() {
5815
5834
  vs = !0;
5816
5835
  for (const [e, t] of ys) bs(e, t);
5817
5836
  }
5818
5837
  function bs(e, t) {
5819
5838
  typeof window > "u" || (window[e] = t);
5820
5839
  }
5821
- const nr = [], sf = 500;
5840
+ const nr = [], lf = 500;
5822
5841
  let Wr = [], Gn = null;
5823
- const lf = 1e3, cf = 200;
5842
+ const cf = 1e3, uf = 200;
5824
5843
  let cr = null;
5825
5844
  function ws(e) {
5826
5845
  cr = e;
@@ -5834,13 +5853,13 @@ function Es() {
5834
5853
  const t = je(Ft.DEBUG_FLAG);
5835
5854
  return t !== null && t !== "false";
5836
5855
  }
5837
- function uf() {
5856
+ function df() {
5838
5857
  const e = je(Ft.DEBUG_FLAG);
5839
5858
  if (!e || e === "true") return null;
5840
5859
  const t = e.split(",").map((r) => r.trim().toLowerCase()).filter(Boolean);
5841
5860
  return t.length > 0 ? new Set(t) : null;
5842
5861
  }
5843
- function df() {
5862
+ function ff() {
5844
5863
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
5845
5864
  hour12: !1,
5846
5865
  hour: "2-digit",
@@ -5849,8 +5868,8 @@ function df() {
5849
5868
  fractionalSecondDigits: 3
5850
5869
  });
5851
5870
  }
5852
- function ff(e) {
5853
- nr.push(e), nr.length > sf && nr.shift();
5871
+ function hf(e) {
5872
+ nr.push(e), nr.length > lf && nr.shift();
5854
5873
  }
5855
5874
  const Dn = {
5856
5875
  debug: "color: #64748b; font-weight: normal;",
@@ -5859,7 +5878,7 @@ const Dn = {
5859
5878
  category: "color: #3b82f6; font-weight: bold;",
5860
5879
  time: "color: #6b7280; font-weight: normal;"
5861
5880
  };
5862
- function hf(e) {
5881
+ function pf(e) {
5863
5882
  try {
5864
5883
  return JSON.stringify(e);
5865
5884
  } catch {
@@ -5874,12 +5893,12 @@ function xa(e, t, r, n, a, i, o) {
5874
5893
  data: o,
5875
5894
  timestamp: Date.now()
5876
5895
  };
5877
- if (ff(s), (r || _s()) && Li(s), !n) {
5896
+ if (hf(s), (r || _s()) && Li(s), !n) {
5878
5897
  if (!Es()) return;
5879
- const d = uf();
5898
+ const d = df();
5880
5899
  if (d && !d.has(a.toLowerCase())) return;
5881
5900
  }
5882
- const l = df(), c = o !== void 0 ? " " + hf(o) : "";
5901
+ const l = ff(), c = o !== void 0 ? " " + pf(o) : "";
5883
5902
  t(
5884
5903
  `%c[${l}]%c [${a}]%c ${i}${c}`,
5885
5904
  Dn.time,
@@ -5896,25 +5915,25 @@ function ne(e, t, r) {
5896
5915
  function at(e, t, r) {
5897
5916
  xa("error", console.error, !0, !0, e, t, r);
5898
5917
  }
5899
- function pf() {
5918
+ function mf() {
5900
5919
  return [...nr];
5901
5920
  }
5902
- function mf() {
5921
+ function gf() {
5903
5922
  nr.length = 0;
5904
5923
  }
5905
- function gf(e) {
5924
+ function yf(e) {
5906
5925
  const t = e && e.length > 0 ? e.join(",") : "true";
5907
5926
  Ta(Ft.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
5908
5927
  }
5909
- function yf() {
5928
+ function vf() {
5910
5929
  nn(Ft.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
5911
5930
  }
5912
- const vf = 1024, bf = 5e4;
5931
+ const bf = 1024, wf = 5e4;
5913
5932
  function Ss(e) {
5914
5933
  if (e == null) return e;
5915
5934
  try {
5916
5935
  const t = JSON.stringify(e);
5917
- if (t.length <= vf) return e;
5936
+ if (t.length <= bf) return e;
5918
5937
  if (typeof e == "object" && !Array.isArray(e)) {
5919
5938
  const r = {};
5920
5939
  for (const [n, a] of Object.entries(e)) {
@@ -5928,7 +5947,7 @@ function Ss(e) {
5928
5947
  return "[unserializable]";
5929
5948
  }
5930
5949
  }
5931
- function Sg(e, t, r, n) {
5950
+ function Rg(e, t, r, n) {
5932
5951
  try {
5933
5952
  console.warn(`[${t}] ${r}`, n ?? "");
5934
5953
  } catch {
@@ -5955,7 +5974,7 @@ function Sg(e, t, r, n) {
5955
5974
  } catch {
5956
5975
  }
5957
5976
  }
5958
- async function wf() {
5977
+ async function _f() {
5959
5978
  if (Wr.length === 0) return;
5960
5979
  const e = Wr;
5961
5980
  Wr = [], Gn = null;
@@ -5979,7 +5998,7 @@ async function wf() {
5979
5998
  let i = [], o = 0;
5980
5999
  for (const s of a) {
5981
6000
  const l = JSON.stringify(s).length + 1;
5982
- o + l > bf && i.length > 0 && (await fetch(n, {
6001
+ o + l > wf && i.length > 0 && (await fetch(n, {
5983
6002
  method: "POST",
5984
6003
  headers: { "Content-Type": "application/json" },
5985
6004
  body: JSON.stringify({ logs: i })
@@ -5996,9 +6015,9 @@ async function wf() {
5996
6015
  }
5997
6016
  function Li(e) {
5998
6017
  if (Wr.push(e), !Gn) {
5999
- const t = _s() ? cf : lf;
6018
+ const t = _s() ? uf : cf;
6000
6019
  Gn = setTimeout(() => {
6001
- wf();
6020
+ _f();
6002
6021
  }, t);
6003
6022
  }
6004
6023
  }
@@ -6006,10 +6025,10 @@ function Ue(e) {
6006
6025
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
6007
6026
  }
6008
6027
  gn("__wpDebug", {
6009
- enable: gf,
6010
- disable: yf,
6011
- history: pf,
6012
- clear: mf
6028
+ enable: yf,
6029
+ disable: vf,
6030
+ history: mf,
6031
+ clear: gf
6013
6032
  });
6014
6033
  function Rs(e) {
6015
6034
  return hn(e) ? md[e] : "var(--color-neutral-bg)";
@@ -6018,7 +6037,7 @@ function Ts(e) {
6018
6037
  return hn(e) ? `${Tt().serverOrigin.replace(/\/$/, "")}${yd(e)}` : void 0;
6019
6038
  }
6020
6039
  let ur = null, Lr = null;
6021
- function _f() {
6040
+ function Ef() {
6022
6041
  return ur ? Promise.resolve() : Lr || (Lr = (async () => {
6023
6042
  try {
6024
6043
  const e = Tt().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
@@ -6037,14 +6056,14 @@ function St(e) {
6037
6056
  const t = e.toLowerCase();
6038
6057
  return Nt.some((r) => r === t) ? !0 : ur ? Object.values(ur).some((r) => r.toLowerCase() === t) : !1;
6039
6058
  }
6040
- function Ef(e, t, r) {
6059
+ function Sf(e, t, r) {
6041
6060
  const n = !!e.name && !r(e.name) && (!t || r(t.name || "")), a = !!e.avatarId && (!t || t.avatarId !== e.avatarId);
6042
6061
  if (!n && !a)
6043
6062
  return null;
6044
6063
  const i = {};
6045
6064
  return n && (i.name = e.name), a && (i.avatarId = e.avatarId), i;
6046
6065
  }
6047
- const Sf = [
6066
+ const Rf = [
6048
6067
  "sage",
6049
6068
  "herald",
6050
6069
  "cleric",
@@ -6069,20 +6088,20 @@ const Sf = [
6069
6088
  "sunny",
6070
6089
  "mentor"
6071
6090
  ];
6072
- function xs(e, t, r = Sf, n = Math.random) {
6091
+ function xs(e, t, r = Rf, n = Math.random) {
6073
6092
  const a = /* @__PURE__ */ new Set();
6074
6093
  for (const o of e)
6075
6094
  o && a.add(o);
6076
6095
  const i = r.filter((o) => !a.has(o));
6077
6096
  return i.length ? i[Math.floor(n() * i.length)] : void 0;
6078
6097
  }
6079
- const Rf = {
6098
+ const Tf = {
6080
6099
  /** client → server, with an ack. Payload: `RoomWatch`. */
6081
6100
  watch: "room-feed:watch",
6082
6101
  /** server → client. Payload: `RoomChanged`. */
6083
6102
  changed: "room-feed:changed"
6084
6103
  };
6085
- function Tf(e) {
6104
+ function xf(e) {
6086
6105
  if (typeof e != "object" || e === null || Array.isArray(e))
6087
6106
  return null;
6088
6107
  const t = e;
@@ -6096,11 +6115,11 @@ function Tf(e) {
6096
6115
  }
6097
6116
  return null;
6098
6117
  }
6099
- const xf = 1280;
6100
- function Cf(e) {
6101
- return e.screenWidth < xf ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
6118
+ const Cf = 1280;
6119
+ function kf(e) {
6120
+ return e.screenWidth < Cf ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
6102
6121
  }
6103
- function kf() {
6122
+ function Af() {
6104
6123
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
6105
6124
  return {
6106
6125
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -6111,13 +6130,13 @@ function kf() {
6111
6130
  }
6112
6131
  let Yn = !1, Oi = null;
6113
6132
  const Xn = /* @__PURE__ */ new Set();
6114
- function Af() {
6115
- return Oi ??= Cf(kf()), Oi;
6133
+ function Pf() {
6134
+ return Oi ??= kf(Af()), Oi;
6116
6135
  }
6117
6136
  function $t() {
6118
- return Yn || Af();
6137
+ return Yn || Pf();
6119
6138
  }
6120
- function Pf(e) {
6139
+ function Mf(e) {
6121
6140
  const t = e === !0;
6122
6141
  if (t === Yn) return;
6123
6142
  const r = $t();
@@ -6140,13 +6159,13 @@ const ye = {
6140
6159
  function yn() {
6141
6160
  return ye.accountId ? ye.accountId : ye.resolved && ye.userType === "public" ? "anon" : null;
6142
6161
  }
6143
- function Mf(e) {
6162
+ function If(e) {
6144
6163
  ye.resolved = !0, e.userType && (ye.userType = e.userType), e.userId !== void 0 && (ye.accountId = e.userId && e.userId !== "public" ? e.userId : null);
6145
6164
  }
6146
6165
  function Di() {
6147
6166
  return ye.userType;
6148
6167
  }
6149
- function If() {
6168
+ function Lf() {
6150
6169
  return ye.resolved && ye.userType === "public";
6151
6170
  }
6152
6171
  const Ni = {
@@ -6157,19 +6176,19 @@ const Ni = {
6157
6176
  wife: 4,
6158
6177
  admin: 5
6159
6178
  };
6160
- function Lf(e, t) {
6179
+ function Of(e, t) {
6161
6180
  return (Ni[e] ?? -1) >= Ni[t];
6162
6181
  }
6163
- function Rg() {
6164
- return Lf(ye.userType, "service");
6182
+ function Tg() {
6183
+ return Of(ye.userType, "service");
6165
6184
  }
6166
6185
  function vn() {
6167
6186
  return ye.accountId ?? "public";
6168
6187
  }
6169
- function Of() {
6188
+ function Df() {
6170
6189
  return yn() ?? "unscoped";
6171
6190
  }
6172
- async function Df() {
6191
+ async function Nf() {
6173
6192
  if (ye.name) return ye.name;
6174
6193
  try {
6175
6194
  const e = await fetch("/session/whoami", {
@@ -6179,7 +6198,7 @@ async function Df() {
6179
6198
  if (!e.ok || !(e.headers.get("content-type") ?? "").includes("json"))
6180
6199
  return x("auth", "whoami unavailable", { status: e.status }), null;
6181
6200
  const t = await e.json();
6182
- if (Pf(t.tv), ye.userType === "public") return null;
6201
+ if (Mf(t.tv), ye.userType === "public") return null;
6183
6202
  if (t.valid && (ye.accountId = typeof t.userId == "string" && t.userId ? t.userId : null), t.valid && typeof t.name == "string")
6184
6203
  return ye.name = t.name, t.name;
6185
6204
  } catch (e) {
@@ -6187,7 +6206,7 @@ async function Df() {
6187
6206
  }
6188
6207
  return null;
6189
6208
  }
6190
- const Nf = u.object({
6209
+ const $f = u.object({
6191
6210
  // Identity. There is deliberately NO `name`: a person's name is their
6192
6211
  // hadoku key-registry name, resolved by the server from whoami and renamed
6193
6212
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -6214,13 +6233,13 @@ const Nf = u.object({
6214
6233
  subtitleStyle: u.string().optional()
6215
6234
  }), ar = El({
6216
6235
  appId: "watchparty",
6217
- schema: Nf
6218
- }), $f = /* @__PURE__ */ new Set(["theme", "themeMode"]);
6236
+ schema: $f
6237
+ }), Ff = /* @__PURE__ */ new Set(["theme", "themeMode"]);
6219
6238
  function an(e) {
6220
6239
  const t = yn();
6221
6240
  return t ? `prefs-cache:${t}:${e}` : null;
6222
6241
  }
6223
- function Ff() {
6242
+ function Uf() {
6224
6243
  return yn() === null;
6225
6244
  }
6226
6245
  function $i(e) {
@@ -6234,9 +6253,9 @@ function $i(e) {
6234
6253
  return {};
6235
6254
  }
6236
6255
  }
6237
- function Uf() {
6256
+ function Bf() {
6238
6257
  let e = 0;
6239
- for (const t of nf()) {
6258
+ for (const t of af()) {
6240
6259
  const r = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), n = t === on || t.startsWith(`${on}:`) && !t.endsWith(":_serverSynced_v1");
6241
6260
  if (!r && !n) continue;
6242
6261
  const a = je(t);
@@ -6257,7 +6276,7 @@ function Uf() {
6257
6276
  let As = null, Ps = null;
6258
6277
  const Fi = /* @__PURE__ */ new Set();
6259
6278
  function Ca() {
6260
- if (Ff())
6279
+ if (Uf())
6261
6280
  return x("preferences", "Boot read deferred — session pending, identity unresolved"), {};
6262
6281
  const e = $i("portfolio"), t = $i("watchparty"), r = Object.keys(e).length > 0 ? e : As ?? {}, n = Object.keys(t).length > 0 ? t : Ps ?? {}, a = vn() || "public";
6263
6282
  if (Fi.has(a))
@@ -6282,15 +6301,15 @@ function Ca() {
6282
6301
  }), o;
6283
6302
  }
6284
6303
  let Ms = !1;
6285
- function Bf() {
6304
+ function jf() {
6286
6305
  const e = vn();
6287
6306
  return !e || e === "public";
6288
6307
  }
6289
6308
  function Ze(e, t) {
6290
- Bf() && (Ms = !0), $f.has(e) ? Zt.save({ [e]: t }, { scope: "device" }).catch((r) => ne("preferences", "themePrefs.save failed", { key: e, err: r?.message })) : ar.save({ [e]: t }).catch((r) => ne("preferences", "watchpartyPrefs.save failed", { key: e, err: r?.message })), x("preferences", "Saved (via SDK)", { key: e, value: t });
6309
+ jf() && (Ms = !0), Ff.has(e) ? Zt.save({ [e]: t }, { scope: "device" }).catch((r) => ne("preferences", "themePrefs.save failed", { key: e, err: r?.message })) : ar.save({ [e]: t }).catch((r) => ne("preferences", "watchpartyPrefs.save failed", { key: e, err: r?.message })), x("preferences", "Saved (via SDK)", { key: e, value: t });
6291
6310
  }
6292
6311
  let Or = null, Ui = !1;
6293
- function jf() {
6312
+ function zf() {
6294
6313
  return Or || (Or = (async () => {
6295
6314
  if (typeof window > "u") return !1;
6296
6315
  try {
@@ -6316,7 +6335,7 @@ function jf() {
6316
6335
  // Post-fetch cache state: should be non-zero if SDK wrote it.
6317
6336
  sdkThemeBytesPost: a?.length ?? 0,
6318
6337
  sdkAppBytesPost: i?.length ?? 0
6319
- }), await zf(e, t), Ms ? (x("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
6338
+ }), await Hf(e, t), Ms ? (x("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
6320
6339
  Zt.promoteAnonPrefsToUser().catch(() => {
6321
6340
  }),
6322
6341
  ar.promoteAnonPrefsToUser().catch(() => {
@@ -6328,7 +6347,7 @@ function jf() {
6328
6347
  })(), Or);
6329
6348
  }
6330
6349
  const on = "watchparty_preferences";
6331
- Uf();
6350
+ Bf();
6332
6351
  function Jn() {
6333
6352
  const e = vn();
6334
6353
  return !e || e === "public" ? on : `${on}:${e}`;
@@ -6346,7 +6365,7 @@ function Is() {
6346
6365
  function Bi() {
6347
6366
  nn(Jn()), nn(`${Jn()}:_serverSynced_v1`);
6348
6367
  }
6349
- async function zf(e, t) {
6368
+ async function Hf(e, t) {
6350
6369
  const r = Is();
6351
6370
  if (!r || Object.keys(r).length === 0) return;
6352
6371
  const n = Object.keys(e ?? {}).length > 0, a = Object.keys(t ?? {}).length > 0, i = {}, o = {};
@@ -6403,10 +6422,10 @@ function Hi(e) {
6403
6422
  }
6404
6423
  }).catch((t) => ne("preferences", "store import failed", { reason: e, err: t?.message }));
6405
6424
  }
6406
- const Ls = 320, Vi = 240, Hf = 640;
6425
+ const Ls = 320, Vi = 240, Vf = 640;
6407
6426
  function Nn(e, t) {
6408
6427
  if (!Number.isFinite(e)) return Ls;
6409
- let r = Hf;
6428
+ let r = Vf;
6410
6429
  return r = Math.max(r, Vi), Math.round(Math.min(r, Math.max(Vi, e)));
6411
6430
  }
6412
6431
  function Os(e, t) {
@@ -6644,7 +6663,7 @@ const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6644
6663
  mergeHistory: Os,
6645
6664
  useAppStore: U
6646
6665
  }, Symbol.toStringTag, { value: "Module" }));
6647
- function Vf({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
6666
+ function qf({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
6648
6667
  const t = U((n) => n.toasts), r = U((n) => n.popToast);
6649
6668
  return nt(() => {
6650
6669
  const n = t.map((a) => setTimeout(() => r(a.id), 4e3));
@@ -6653,14 +6672,14 @@ function Vf({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
6653
6672
  };
6654
6673
  }, [t, r]), /* @__PURE__ */ N("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((n) => /* @__PURE__ */ N("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${n.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: n.msg }, n.id)) });
6655
6674
  }
6656
- function qf() {
6675
+ function Wf() {
6657
6676
  try {
6658
6677
  return typeof document > "u" ? !0 : !document.hidden;
6659
6678
  } catch {
6660
6679
  return !0;
6661
6680
  }
6662
6681
  }
6663
- function Wf(e) {
6682
+ function Kf(e) {
6664
6683
  if (typeof document > "u" || typeof document.addEventListener != "function")
6665
6684
  return () => {
6666
6685
  };
@@ -6669,9 +6688,9 @@ function Wf(e) {
6669
6688
  };
6670
6689
  return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
6671
6690
  }
6672
- const Kf = 3e4;
6673
- function Gf(e, t) {
6674
- const r = t.isVisible ?? qf, n = t.setInterval ?? ((_, R) => setInterval(_, R)), a = t.clearInterval ?? ((_) => clearInterval(_));
6691
+ const Gf = 3e4;
6692
+ function Yf(e, t) {
6693
+ const r = t.isVisible ?? Wf, n = t.setInterval ?? ((_, R) => setInterval(_, R)), a = t.clearInterval ?? ((_) => clearInterval(_));
6675
6694
  let i = { list: null, loading: !0, error: null };
6676
6695
  const o = /* @__PURE__ */ new Set();
6677
6696
  let s = null, l = !1;
@@ -6696,9 +6715,9 @@ function Gf(e, t) {
6696
6715
  d();
6697
6716
  const h = t.pings.subscribe(e, () => {
6698
6717
  r() && d();
6699
- }), y = (t.onVisible ?? Wf)(() => d()), g = n(() => {
6718
+ }), y = (t.onVisible ?? Kf)(() => d()), g = n(() => {
6700
6719
  r() && d();
6701
- }, t.fallbackMs ?? Kf);
6720
+ }, t.fallbackMs ?? Gf);
6702
6721
  return {
6703
6722
  getState() {
6704
6723
  return i;
@@ -6712,21 +6731,21 @@ function Gf(e, t) {
6712
6731
  }
6713
6732
  };
6714
6733
  }
6715
- function Yf(e) {
6734
+ function Xf(e) {
6716
6735
  return "list";
6717
6736
  }
6718
- const Xf = { list: null, loading: !0, error: null };
6719
- function Jf() {
6737
+ const Jf = { list: null, loading: !0, error: null };
6738
+ function Qf() {
6720
6739
  return () => {
6721
6740
  };
6722
6741
  }
6723
- function Qf(e, t) {
6724
- const r = Yf(), n = _t(t);
6742
+ function Zf(e, t) {
6743
+ const r = Xf(), n = _t(t);
6725
6744
  n.current = t;
6726
6745
  const a = _t(null);
6727
6746
  (a.current === null || a.current.key !== r) && (a.current?.client.close(), a.current = {
6728
6747
  key: r,
6729
- client: Gf(e, {
6748
+ client: Yf(e, {
6730
6749
  pings: n.current.pings,
6731
6750
  fetchList: (l) => n.current.fetchList(l),
6732
6751
  fallbackMs: n.current.fallbackMs,
@@ -6741,9 +6760,9 @@ function Qf(e, t) {
6741
6760
  o.current = setTimeout(() => {
6742
6761
  o.current = null, a.current?.client === i && i.close();
6743
6762
  }, 0);
6744
- }), [i]), { ...ln(i ? i.subscribe : Jf, () => i ? i.getState() : Xf), refresh: () => i.refresh() };
6763
+ }), [i]), { ...ln(i ? i.subscribe : Qf, () => i ? i.getState() : Jf), refresh: () => i.refresh() };
6745
6764
  }
6746
- const Zf = 400;
6765
+ const eh = 400;
6747
6766
  function Ns() {
6748
6767
  const e = _t(null), t = _t([]);
6749
6768
  return nt(() => {
@@ -6826,7 +6845,7 @@ function Ns() {
6826
6845
  };
6827
6846
  }
6828
6847
  if (!t.current.length)
6829
- for (let b = 0; b < Zf; b++) t.current.push(l(void 0, void 0, !0, b));
6848
+ for (let b = 0; b < eh; b++) t.current.push(l(void 0, void 0, !0, b));
6830
6849
  let c, d = performance.now();
6831
6850
  const h = 50;
6832
6851
  function y(b, C, E, A) {
@@ -6967,7 +6986,7 @@ function Wi(e) {
6967
6986
  return e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
6968
6987
  }
6969
6988
  let $n;
6970
- function eh(e, t) {
6989
+ function th(e, t) {
6971
6990
  if ($s && e.data instanceof Blob)
6972
6991
  return e.data.arrayBuffer().then(Wi).then(t);
6973
6992
  if (Fs && (e.data instanceof ArrayBuffer || Us(e.data)))
@@ -6979,14 +6998,14 @@ function eh(e, t) {
6979
6998
  const Ki = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Jt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
6980
6999
  for (let e = 0; e < Ki.length; e++)
6981
7000
  Jt[Ki.charCodeAt(e)] = e;
6982
- const th = (e) => {
7001
+ const rh = (e) => {
6983
7002
  let t = e.length * 0.75, r = e.length, n, a = 0, i, o, s, l;
6984
7003
  e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
6985
7004
  const c = new ArrayBuffer(t), d = new Uint8Array(c);
6986
7005
  for (n = 0; n < r; n += 4)
6987
7006
  i = Jt[e.charCodeAt(n)], o = Jt[e.charCodeAt(n + 1)], s = Jt[e.charCodeAt(n + 2)], l = Jt[e.charCodeAt(n + 3)], d[a++] = i << 2 | o >> 4, d[a++] = (o & 15) << 4 | s >> 2, d[a++] = (s & 3) << 6 | l & 63;
6988
7007
  return c;
6989
- }, rh = typeof ArrayBuffer == "function", Aa = (e, t) => {
7008
+ }, nh = typeof ArrayBuffer == "function", Aa = (e, t) => {
6990
7009
  if (typeof e != "string")
6991
7010
  return {
6992
7011
  type: "message",
@@ -6995,20 +7014,20 @@ const th = (e) => {
6995
7014
  const r = e.charAt(0);
6996
7015
  return r === "b" ? {
6997
7016
  type: "message",
6998
- data: nh(e.substring(1), t)
7017
+ data: ah(e.substring(1), t)
6999
7018
  } : Kr[r] ? e.length > 1 ? {
7000
7019
  type: Kr[r],
7001
7020
  data: e.substring(1)
7002
7021
  } : {
7003
7022
  type: Kr[r]
7004
7023
  } : Qn;
7005
- }, nh = (e, t) => {
7006
- if (rh) {
7007
- const r = th(e);
7024
+ }, ah = (e, t) => {
7025
+ if (nh) {
7026
+ const r = rh(e);
7008
7027
  return Bs(r, t);
7009
7028
  } else
7010
7029
  return { base64: !0, data: e };
7011
- }, Bs = (e, t) => t === "blob" ? e instanceof Blob ? e : new Blob([e]) : e instanceof ArrayBuffer ? e : e.buffer, js = "", ah = (e, t) => {
7030
+ }, Bs = (e, t) => t === "blob" ? e instanceof Blob ? e : new Blob([e]) : e instanceof ArrayBuffer ? e : e.buffer, js = "", ih = (e, t) => {
7012
7031
  const r = e.length, n = new Array(r);
7013
7032
  let a = 0;
7014
7033
  e.forEach((i, o) => {
@@ -7016,7 +7035,7 @@ const th = (e) => {
7016
7035
  n[o] = s, ++a === r && t(n.join(js));
7017
7036
  });
7018
7037
  });
7019
- }, ih = (e, t) => {
7038
+ }, oh = (e, t) => {
7020
7039
  const r = e.split(js), n = [];
7021
7040
  for (let a = 0; a < r.length; a++) {
7022
7041
  const i = Aa(r[a], t);
@@ -7025,10 +7044,10 @@ const th = (e) => {
7025
7044
  }
7026
7045
  return n;
7027
7046
  };
7028
- function oh() {
7047
+ function sh() {
7029
7048
  return new TransformStream({
7030
7049
  transform(e, t) {
7031
- eh(e, (r) => {
7050
+ th(e, (r) => {
7032
7051
  const n = r.length;
7033
7052
  let a;
7034
7053
  if (n < 126)
@@ -7060,7 +7079,7 @@ function Nr(e, t) {
7060
7079
  r[a] = e[0][n++], n === e[0].length && (e.shift(), n = 0);
7061
7080
  return e.length && n < e[0].length && (e[0] = e[0].slice(n)), r;
7062
7081
  }
7063
- function sh(e, t) {
7082
+ function lh(e, t) {
7064
7083
  Fn || (Fn = new TextDecoder());
7065
7084
  const r = [];
7066
7085
  let n = 0, a = -1, i = !1;
@@ -7102,9 +7121,9 @@ function sh(e, t) {
7102
7121
  }
7103
7122
  const zs = 4;
7104
7123
  function de(e) {
7105
- if (e) return lh(e);
7124
+ if (e) return ch(e);
7106
7125
  }
7107
- function lh(e) {
7126
+ function ch(e) {
7108
7127
  for (var t in de.prototype)
7109
7128
  e[t] = de.prototype[t];
7110
7129
  return e;
@@ -7150,19 +7169,19 @@ de.prototype.listeners = function(e) {
7150
7169
  de.prototype.hasListeners = function(e) {
7151
7170
  return !!this.listeners(e).length;
7152
7171
  };
7153
- const bn = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, r) => r(t, 0), Le = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), ch = "arraybuffer";
7172
+ const bn = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, r) => r(t, 0), Le = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), uh = "arraybuffer";
7154
7173
  function Hs(e, ...t) {
7155
7174
  return t.reduce((r, n) => (e.hasOwnProperty(n) && (r[n] = e[n]), r), {});
7156
7175
  }
7157
- const uh = Le.setTimeout, dh = Le.clearTimeout;
7176
+ const dh = Le.setTimeout, fh = Le.clearTimeout;
7158
7177
  function wn(e, t) {
7159
- t.useNativeTimers ? (e.setTimeoutFn = uh.bind(Le), e.clearTimeoutFn = dh.bind(Le)) : (e.setTimeoutFn = Le.setTimeout.bind(Le), e.clearTimeoutFn = Le.clearTimeout.bind(Le));
7160
- }
7161
- const fh = 1.33;
7162
- function hh(e) {
7163
- return typeof e == "string" ? ph(e) : Math.ceil((e.byteLength || e.size) * fh);
7178
+ t.useNativeTimers ? (e.setTimeoutFn = dh.bind(Le), e.clearTimeoutFn = fh.bind(Le)) : (e.setTimeoutFn = Le.setTimeout.bind(Le), e.clearTimeoutFn = Le.clearTimeout.bind(Le));
7164
7179
  }
7180
+ const hh = 1.33;
7165
7181
  function ph(e) {
7182
+ return typeof e == "string" ? mh(e) : Math.ceil((e.byteLength || e.size) * hh);
7183
+ }
7184
+ function mh(e) {
7166
7185
  let t = 0, r = 0;
7167
7186
  for (let n = 0, a = e.length; n < a; n++)
7168
7187
  t = e.charCodeAt(n), t < 128 ? r += 1 : t < 2048 ? r += 2 : t < 55296 || t >= 57344 ? r += 3 : (n++, r += 4);
@@ -7171,13 +7190,13 @@ function ph(e) {
7171
7190
  function Vs() {
7172
7191
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
7173
7192
  }
7174
- function mh(e) {
7193
+ function gh(e) {
7175
7194
  let t = "";
7176
7195
  for (let r in e)
7177
7196
  e.hasOwnProperty(r) && (t.length && (t += "&"), t += encodeURIComponent(r) + "=" + encodeURIComponent(e[r]));
7178
7197
  return t;
7179
7198
  }
7180
- function gh(e) {
7199
+ function yh(e) {
7181
7200
  let t = {}, r = e.split("&");
7182
7201
  for (let n = 0, a = r.length; n < a; n++) {
7183
7202
  let i = r[n].split("=");
@@ -7185,7 +7204,7 @@ function gh(e) {
7185
7204
  }
7186
7205
  return t;
7187
7206
  }
7188
- class yh extends Error {
7207
+ class vh extends Error {
7189
7208
  constructor(t, r, n) {
7190
7209
  super(t), this.description = r, this.context = n, this.type = "TransportError";
7191
7210
  }
@@ -7210,7 +7229,7 @@ class Pa extends de {
7210
7229
  * @protected
7211
7230
  */
7212
7231
  onError(t, r, n) {
7213
- return super.emitReserved("error", new yh(t, r, n)), this;
7232
+ return super.emitReserved("error", new vh(t, r, n)), this;
7214
7233
  }
7215
7234
  /**
7216
7235
  * Opens the transport.
@@ -7284,11 +7303,11 @@ class Pa extends de {
7284
7303
  return this.opts.port && (this.opts.secure && +(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
7285
7304
  }
7286
7305
  _query(t) {
7287
- const r = mh(t);
7306
+ const r = gh(t);
7288
7307
  return r.length ? "?" + r : "";
7289
7308
  }
7290
7309
  }
7291
- class vh extends Pa {
7310
+ class bh extends Pa {
7292
7311
  constructor() {
7293
7312
  super(...arguments), this._polling = !1;
7294
7313
  }
@@ -7344,7 +7363,7 @@ class vh extends Pa {
7344
7363
  return this.onClose({ description: "transport closed by the server" }), !1;
7345
7364
  this.onPacket(n);
7346
7365
  };
7347
- ih(t, this.socket.binaryType).forEach(r), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
7366
+ oh(t, this.socket.binaryType).forEach(r), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
7348
7367
  }
7349
7368
  /**
7350
7369
  * For polling, send a close packet.
@@ -7364,7 +7383,7 @@ class vh extends Pa {
7364
7383
  * @protected
7365
7384
  */
7366
7385
  write(t) {
7367
- this.writable = !1, ah(t, (r) => {
7386
+ this.writable = !1, ih(t, (r) => {
7368
7387
  this.doWrite(r, () => {
7369
7388
  this.writable = !0, this.emitReserved("drain");
7370
7389
  });
@@ -7385,10 +7404,10 @@ try {
7385
7404
  qs = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
7386
7405
  } catch {
7387
7406
  }
7388
- const bh = qs;
7389
- function wh() {
7407
+ const wh = qs;
7408
+ function _h() {
7390
7409
  }
7391
- class _h extends vh {
7410
+ class Eh extends bh {
7392
7411
  /**
7393
7412
  * XHR Polling constructor.
7394
7413
  *
@@ -7501,7 +7520,7 @@ let It = class Gr extends de {
7501
7520
  */
7502
7521
  _cleanup(t) {
7503
7522
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
7504
- if (this._xhr.onreadystatechange = wh, t)
7523
+ if (this._xhr.onreadystatechange = _h, t)
7505
7524
  try {
7506
7525
  this._xhr.abort();
7507
7526
  } catch {
@@ -7541,17 +7560,17 @@ function Gi() {
7541
7560
  for (let e in It.requests)
7542
7561
  It.requests.hasOwnProperty(e) && It.requests[e].abort();
7543
7562
  }
7544
- const Eh = (function() {
7563
+ const Sh = (function() {
7545
7564
  const e = Ws({
7546
7565
  xdomain: !1
7547
7566
  });
7548
7567
  return e && e.responseType !== null;
7549
7568
  })();
7550
- class Sh extends _h {
7569
+ class Rh extends Eh {
7551
7570
  constructor(t) {
7552
7571
  super(t);
7553
7572
  const r = t && t.forceBase64;
7554
- this.supportsBinary = Eh && !r;
7573
+ this.supportsBinary = Sh && !r;
7555
7574
  }
7556
7575
  request(t = {}) {
7557
7576
  return Object.assign(t, { xd: this.xd }, this.opts), new It(Ws, this.uri(), t);
@@ -7560,7 +7579,7 @@ class Sh extends _h {
7560
7579
  function Ws(e) {
7561
7580
  const t = e.xdomain;
7562
7581
  try {
7563
- if (typeof XMLHttpRequest < "u" && (!t || bh))
7582
+ if (typeof XMLHttpRequest < "u" && (!t || wh))
7564
7583
  return new XMLHttpRequest();
7565
7584
  } catch {
7566
7585
  }
@@ -7571,7 +7590,7 @@ function Ws(e) {
7571
7590
  }
7572
7591
  }
7573
7592
  const Ks = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
7574
- class Rh extends Pa {
7593
+ class Th extends Pa {
7575
7594
  get name() {
7576
7595
  return "websocket";
7577
7596
  }
@@ -7628,7 +7647,7 @@ class Rh extends Pa {
7628
7647
  }
7629
7648
  }
7630
7649
  const Un = Le.WebSocket || Le.MozWebSocket;
7631
- class Th extends Rh {
7650
+ class xh extends Th {
7632
7651
  createSocket(t, r, n) {
7633
7652
  return Ks ? new Un(t, r, n) : r ? new Un(t, r) : new Un(t);
7634
7653
  }
@@ -7636,7 +7655,7 @@ class Th extends Rh {
7636
7655
  this.ws.send(r);
7637
7656
  }
7638
7657
  }
7639
- class xh extends Pa {
7658
+ class Ch extends Pa {
7640
7659
  get name() {
7641
7660
  return "webtransport";
7642
7661
  }
@@ -7652,7 +7671,7 @@ class xh extends Pa {
7652
7671
  this.onError("webtransport error", t);
7653
7672
  }), this._transport.ready.then(() => {
7654
7673
  this._transport.createBidirectionalStream().then((t) => {
7655
- const r = sh(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = t.readable.pipeThrough(r).getReader(), a = oh();
7674
+ const r = lh(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = t.readable.pipeThrough(r).getReader(), a = sh();
7656
7675
  a.readable.pipeTo(t.writable), this._writer = a.writable.getWriter();
7657
7676
  const i = () => {
7658
7677
  n.read().then(({ done: s, value: l }) => {
@@ -7682,11 +7701,11 @@ class xh extends Pa {
7682
7701
  (t = this._transport) === null || t === void 0 || t.close();
7683
7702
  }
7684
7703
  }
7685
- const Ch = {
7686
- websocket: Th,
7687
- webtransport: xh,
7688
- polling: Sh
7689
- }, kh = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Ah = [
7704
+ const kh = {
7705
+ websocket: xh,
7706
+ webtransport: Ch,
7707
+ polling: Rh
7708
+ }, Ah = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Ph = [
7690
7709
  "source",
7691
7710
  "protocol",
7692
7711
  "authority",
@@ -7707,16 +7726,16 @@ function Zn(e) {
7707
7726
  throw "URI too long";
7708
7727
  const t = e, r = e.indexOf("["), n = e.indexOf("]");
7709
7728
  r != -1 && n != -1 && (e = e.substring(0, r) + e.substring(r, n).replace(/:/g, ";") + e.substring(n, e.length));
7710
- let a = kh.exec(e || ""), i = {}, o = 14;
7729
+ let a = Ah.exec(e || ""), i = {}, o = 14;
7711
7730
  for (; o--; )
7712
- i[Ah[o]] = a[o] || "";
7713
- return r != -1 && n != -1 && (i.source = t, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Ph(i, i.path), i.queryKey = Mh(i, i.query), i;
7731
+ i[Ph[o]] = a[o] || "";
7732
+ return r != -1 && n != -1 && (i.source = t, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Mh(i, i.path), i.queryKey = Ih(i, i.query), i;
7714
7733
  }
7715
- function Ph(e, t) {
7734
+ function Mh(e, t) {
7716
7735
  const r = /\/{2,9}/g, n = t.replace(r, "/").split("/");
7717
7736
  return (t.slice(0, 1) == "/" || t.length === 0) && n.splice(0, 1), t.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
7718
7737
  }
7719
- function Mh(e, t) {
7738
+ function Ih(e, t) {
7720
7739
  const r = {};
7721
7740
  return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, a, i) {
7722
7741
  a && (r[a] = i);
@@ -7734,7 +7753,7 @@ class ft extends de {
7734
7753
  * @param {Object} opts - options
7735
7754
  */
7736
7755
  constructor(t, r) {
7737
- if (super(), this.binaryType = ch, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (r = t, t = null), t) {
7756
+ if (super(), this.binaryType = uh, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (r = t, t = null), t) {
7738
7757
  const n = Zn(t);
7739
7758
  r.hostname = n.host, r.secure = n.protocol === "https" || n.protocol === "wss", r.port = n.port, n.query && (r.query = n.query);
7740
7759
  } else r.host && (r.hostname = Zn(r.host).host);
@@ -7755,7 +7774,7 @@ class ft extends de {
7755
7774
  },
7756
7775
  transportOptions: {},
7757
7776
  closeOnBeforeunload: !1
7758
- }, r), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = gh(this.opts.query)), ea && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
7777
+ }, r), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = yh(this.opts.query)), ea && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
7759
7778
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
7760
7779
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
7761
7780
  this._onClose("transport close", {
@@ -7890,7 +7909,7 @@ class ft extends de {
7890
7909
  let r = 1;
7891
7910
  for (let n = 0; n < this.writeBuffer.length; n++) {
7892
7911
  const a = this.writeBuffer[n].data;
7893
- if (a && (r += hh(a)), n > 0 && r > this._maxPayload)
7912
+ if (a && (r += ph(a)), n > 0 && r > this._maxPayload)
7894
7913
  return this.writeBuffer.slice(0, n);
7895
7914
  r += 2;
7896
7915
  }
@@ -7997,7 +8016,7 @@ class ft extends de {
7997
8016
  }
7998
8017
  }
7999
8018
  ft.protocol = zs;
8000
- class Ih extends ft {
8019
+ class Lh extends ft {
8001
8020
  constructor() {
8002
8021
  super(...arguments), this._upgrades = [];
8003
8022
  }
@@ -8069,21 +8088,21 @@ class Ih extends ft {
8069
8088
  return r;
8070
8089
  }
8071
8090
  }
8072
- let Lh = class extends Ih {
8091
+ let Oh = class extends Lh {
8073
8092
  constructor(t, r = {}) {
8074
8093
  const n = typeof t == "object" ? t : r;
8075
- (!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((a) => Ch[a]).filter((a) => !!a)), super(t, n);
8094
+ (!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((a) => kh[a]).filter((a) => !!a)), super(t, n);
8076
8095
  }
8077
8096
  };
8078
- function Oh(e, t = "", r) {
8097
+ function Dh(e, t = "", r) {
8079
8098
  let n = e;
8080
8099
  r = r || typeof location < "u" && location, e == null && (e = r.protocol + "//" + r.host), typeof e == "string" && (e.charAt(0) === "/" && (e.charAt(1) === "/" ? e = r.protocol + e : e = r.host + e), /^(https?|wss?):\/\//.test(e) || (typeof r < "u" ? e = r.protocol + "//" + e : e = "https://" + e), n = Zn(e)), n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443")), n.path = n.path || "/";
8081
8100
  const i = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
8082
8101
  return n.id = n.protocol + "://" + i + ":" + n.port + t, n.href = n.protocol + "://" + i + (r && r.port === n.port ? "" : ":" + n.port), n;
8083
8102
  }
8084
- const Dh = typeof ArrayBuffer == "function", Nh = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, Gs = Object.prototype.toString, $h = typeof Blob == "function" || typeof Blob < "u" && Gs.call(Blob) === "[object BlobConstructor]", Fh = typeof File == "function" || typeof File < "u" && Gs.call(File) === "[object FileConstructor]";
8103
+ const Nh = typeof ArrayBuffer == "function", $h = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, Gs = Object.prototype.toString, Fh = typeof Blob == "function" || typeof Blob < "u" && Gs.call(Blob) === "[object BlobConstructor]", Uh = typeof File == "function" || typeof File < "u" && Gs.call(File) === "[object FileConstructor]";
8085
8104
  function Ma(e) {
8086
- return Dh && (e instanceof ArrayBuffer || Nh(e)) || $h && e instanceof Blob || Fh && e instanceof File;
8105
+ return Nh && (e instanceof ArrayBuffer || $h(e)) || Fh && e instanceof Blob || Uh && e instanceof File;
8087
8106
  }
8088
8107
  function Xr(e, t) {
8089
8108
  if (!e || typeof e != "object")
@@ -8103,7 +8122,7 @@ function Xr(e, t) {
8103
8122
  return !0;
8104
8123
  return !1;
8105
8124
  }
8106
- function Uh(e) {
8125
+ function Bh(e) {
8107
8126
  const t = [], r = e.data, n = e;
8108
8127
  return n.data = ta(r, t), n.attachments = t.length, { packet: n, buffers: t };
8109
8128
  }
@@ -8126,7 +8145,7 @@ function ta(e, t) {
8126
8145
  }
8127
8146
  return e;
8128
8147
  }
8129
- function Bh(e, t) {
8148
+ function jh(e, t) {
8130
8149
  return e.data = ra(e.data, t), delete e.attachments, e;
8131
8150
  }
8132
8151
  function ra(e, t) {
@@ -8144,7 +8163,7 @@ function ra(e, t) {
8144
8163
  Object.prototype.hasOwnProperty.call(e, r) && (e[r] = ra(e[r], t));
8145
8164
  return e;
8146
8165
  }
8147
- const jh = [
8166
+ const zh = [
8148
8167
  "connect",
8149
8168
  "connect_error",
8150
8169
  "disconnect",
@@ -8152,12 +8171,12 @@ const jh = [
8152
8171
  "newListener",
8153
8172
  "removeListener"
8154
8173
  // used by the Node.js EventEmitter
8155
- ], zh = 5;
8174
+ ], Hh = 5;
8156
8175
  var X;
8157
8176
  (function(e) {
8158
8177
  e[e.CONNECT = 0] = "CONNECT", e[e.DISCONNECT = 1] = "DISCONNECT", e[e.EVENT = 2] = "EVENT", e[e.ACK = 3] = "ACK", e[e.CONNECT_ERROR = 4] = "CONNECT_ERROR", e[e.BINARY_EVENT = 5] = "BINARY_EVENT", e[e.BINARY_ACK = 6] = "BINARY_ACK";
8159
8178
  })(X || (X = {}));
8160
- class Hh {
8179
+ class Vh {
8161
8180
  /**
8162
8181
  * Encoder constructor
8163
8182
  *
@@ -8193,7 +8212,7 @@ class Hh {
8193
8212
  * a list of buffers.
8194
8213
  */
8195
8214
  encodeAsBinary(t) {
8196
- const r = Uh(t), n = this.encodeAsString(r.packet), a = r.buffers;
8215
+ const r = Bh(t), n = this.encodeAsString(r.packet), a = r.buffers;
8197
8216
  return a.unshift(n), a;
8198
8217
  }
8199
8218
  }
@@ -8221,7 +8240,7 @@ class Ia extends de {
8221
8240
  throw new Error("got plaintext data when reconstructing a packet");
8222
8241
  r = this.decodeString(t);
8223
8242
  const n = r.type === X.BINARY_EVENT;
8224
- n || r.type === X.BINARY_ACK ? (r.type = n ? X.EVENT : X.ACK, this.reconstructor = new Vh(r), r.attachments === 0 && super.emitReserved("decoded", r)) : super.emitReserved("decoded", r);
8243
+ n || r.type === X.BINARY_ACK ? (r.type = n ? X.EVENT : X.ACK, this.reconstructor = new qh(r), r.attachments === 0 && super.emitReserved("decoded", r)) : super.emitReserved("decoded", r);
8225
8244
  } else if (Ma(t) || t.base64)
8226
8245
  if (this.reconstructor)
8227
8246
  r = this.reconstructor.takeBinaryData(t), r && (this.reconstructor = null, super.emitReserved("decoded", r));
@@ -8299,7 +8318,7 @@ class Ia extends de {
8299
8318
  return typeof r == "string" || Yi(r);
8300
8319
  case X.EVENT:
8301
8320
  case X.BINARY_EVENT:
8302
- return Array.isArray(r) && (typeof r[0] == "number" || typeof r[0] == "string" && jh.indexOf(r[0]) === -1);
8321
+ return Array.isArray(r) && (typeof r[0] == "number" || typeof r[0] == "string" && zh.indexOf(r[0]) === -1);
8303
8322
  case X.ACK:
8304
8323
  case X.BINARY_ACK:
8305
8324
  return Array.isArray(r);
@@ -8312,7 +8331,7 @@ class Ia extends de {
8312
8331
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
8313
8332
  }
8314
8333
  }
8315
- class Vh {
8334
+ class qh {
8316
8335
  constructor(t) {
8317
8336
  this.packet = t, this.buffers = [], this.reconPack = t;
8318
8337
  }
@@ -8326,7 +8345,7 @@ class Vh {
8326
8345
  */
8327
8346
  takeBinaryData(t) {
8328
8347
  if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
8329
- const r = Bh(this.reconPack, this.buffers);
8348
+ const r = jh(this.reconPack, this.buffers);
8330
8349
  return this.finishedReconstruction(), r;
8331
8350
  }
8332
8351
  return null;
@@ -8338,21 +8357,21 @@ class Vh {
8338
8357
  this.reconPack = null, this.buffers = [];
8339
8358
  }
8340
8359
  }
8341
- const qh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8360
+ const Wh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8342
8361
  __proto__: null,
8343
8362
  Decoder: Ia,
8344
- Encoder: Hh,
8363
+ Encoder: Vh,
8345
8364
  get PacketType() {
8346
8365
  return X;
8347
8366
  },
8348
- protocol: zh
8367
+ protocol: Hh
8349
8368
  }, Symbol.toStringTag, { value: "Module" }));
8350
8369
  function Ne(e, t, r) {
8351
8370
  return e.on(t, r), function() {
8352
8371
  e.off(t, r);
8353
8372
  };
8354
8373
  }
8355
- const Wh = Object.freeze({
8374
+ const Kh = Object.freeze({
8356
8375
  connect: 1,
8357
8376
  connect_error: 1,
8358
8377
  disconnect: 1,
@@ -8477,7 +8496,7 @@ class Ys extends de {
8477
8496
  */
8478
8497
  emit(t, ...r) {
8479
8498
  var n, a, i;
8480
- if (Wh.hasOwnProperty(t))
8499
+ if (Kh.hasOwnProperty(t))
8481
8500
  throw new Error('"' + t.toString() + '" is a reserved event name');
8482
8501
  if (r.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
8483
8502
  return this._addToQueue(r), this;
@@ -8984,7 +9003,7 @@ class na extends de {
8984
9003
  max: this.reconnectionDelayMax(),
8985
9004
  jitter: this.randomizationFactor()
8986
9005
  }), this.timeout(r.timeout == null ? 2e4 : r.timeout), this._readyState = "closed", this.uri = t;
8987
- const a = r.parser || qh;
9006
+ const a = r.parser || Wh;
8988
9007
  this.encoder = new a.Encoder(), this.decoder = new a.Decoder(), this._autoConnect = r.autoConnect !== !1, this._autoConnect && this.open();
8989
9008
  }
8990
9009
  reconnection(t) {
@@ -9027,7 +9046,7 @@ class na extends de {
9027
9046
  open(t) {
9028
9047
  if (~this._readyState.indexOf("open"))
9029
9048
  return this;
9030
- this.engine = new Lh(this.uri, this.opts);
9049
+ this.engine = new Oh(this.uri, this.opts);
9031
9050
  const r = this.engine, n = this;
9032
9051
  this._readyState = "opening", this.skipReconnect = !1;
9033
9052
  const a = Ne(r, "open", function() {
@@ -9217,7 +9236,7 @@ class na extends de {
9217
9236
  const Kt = {};
9218
9237
  function Lt(e, t) {
9219
9238
  typeof e == "object" && (t = e, e = void 0), t = t || {};
9220
- const r = Oh(e, t.path || "/socket.io"), n = r.source, a = r.id, i = r.path, o = Kt[a] && i in Kt[a].nsps, s = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
9239
+ const r = Dh(e, t.path || "/socket.io"), n = r.source, a = r.id, i = r.path, o = Kt[a] && i in Kt[a].nsps, s = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
9221
9240
  let l;
9222
9241
  return s ? l = new na(n, t) : (Kt[a] || (Kt[a] = new na(n, t)), l = Kt[a]), r.query && !t.query && (t.query = r.queryKey), l.socket(r.path, t);
9223
9242
  }
@@ -9227,7 +9246,7 @@ Object.assign(Lt, {
9227
9246
  io: Lt,
9228
9247
  connect: Lt
9229
9248
  });
9230
- function Kh(e) {
9249
+ function Gh(e) {
9231
9250
  const t = /* @__PURE__ */ new Map();
9232
9251
  let r = 0, n = null;
9233
9252
  const a = () => {
@@ -9284,16 +9303,16 @@ function Xi() {
9284
9303
  return new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
9285
9304
  }
9286
9305
  let Ji;
9287
- function Gh() {
9288
- return Ji ??= Kh({
9289
- wire: { channel: Rf, parseChanged: Tf },
9306
+ function Yh() {
9307
+ return Ji ??= Gh({
9308
+ wire: { channel: Tf, parseChanged: xf },
9290
9309
  connect: () => {
9291
9310
  const e = Lt(Xi(), { path: Qo, transports: ["websocket", "polling"] });
9292
9311
  return x("room-feed", "feed socket opened", { origin: Xi() }), e;
9293
9312
  }
9294
9313
  }), Ji;
9295
9314
  }
9296
- var Yh = ["effect", "gradient", "font", "overlay", "message"], G = (e, t, r, n = {}) => ({ id: `${e}.${t}`, slot: e, label: r, ...n }), _e = { hidden: !0 }, La = [
9315
+ var Xh = ["effect", "gradient", "font", "overlay", "message"], G = (e, t, r, n = {}) => ({ id: `${e}.${t}`, slot: e, label: r, ...n }), _e = { hidden: !0 }, La = [
9297
9316
  G("effect", "glint", "Glint"),
9298
9317
  G("effect", "aura", "Aura"),
9299
9318
  G("effect", "hop", "Hop", _e),
@@ -9401,13 +9420,13 @@ function ia(e, t) {
9401
9420
  bottom: Math.max(...A)
9402
9421
  };
9403
9422
  }
9404
- var Xh = La.filter((e) => !!e.art), Jh = {
9423
+ var Jh = La.filter((e) => !!e.art), Qh = {
9405
9424
  left: -25,
9406
- top: Math.floor(Math.min(...Xh.map((e) => ia(e.art, Xs).top))),
9425
+ top: Math.floor(Math.min(...Jh.map((e) => ia(e.art, Xs).top))),
9407
9426
  right: 125,
9408
9427
  bottom: 110
9409
9428
  }, $r = (e, [t, r]) => Math.min(r, Math.max(t, e));
9410
- function Qh(e, t) {
9429
+ function Zh(e, t) {
9411
9430
  const r = (s, l) => typeof s == "number" && Number.isFinite(s) ? s : l, n = {
9412
9431
  x: Math.round($r(r(t.x, 0), Gt.x)),
9413
9432
  y: Math.round($r(r(t.y, 0), Gt.y)),
@@ -9415,7 +9434,7 @@ function Qh(e, t) {
9415
9434
  s: Math.round($r(r(t.s, 100), Gt.s)),
9416
9435
  flip: t.flip === !0,
9417
9436
  back: t.back === !0
9418
- }, a = Jh;
9437
+ }, a = Qh;
9419
9438
  let i = ia(e, n);
9420
9439
  const o = Math.min(
9421
9440
  (a.right - a.left - 2) / (i.right - i.left),
@@ -9423,62 +9442,62 @@ function Qh(e, t) {
9423
9442
  );
9424
9443
  return o < 1 && (n.s = Math.max(Gt.s[0], Math.floor(n.s * o)), i = ia(e, n)), n.x += Math.ceil(Math.max(0, a.left - i.left)) - Math.ceil(Math.max(0, i.right - a.right)), n.y += Math.ceil(Math.max(0, a.top - i.top)) - Math.ceil(Math.max(0, i.bottom - a.bottom)), n;
9425
9444
  }
9426
- function Zh(e) {
9445
+ function ep(e) {
9427
9446
  if (!e || typeof e != "object") return;
9428
9447
  const t = e, r = {};
9429
- for (const a of Yh) {
9448
+ for (const a of Xh) {
9430
9449
  const i = t[a], o = typeof i == "string" ? aa.get(i) : void 0;
9431
9450
  o && !o.hidden && o.slot === a && (r[a] = o.id);
9432
9451
  }
9433
9452
  const n = r.overlay ? aa.get(r.overlay)?.art : void 0;
9434
- return n && t.placement && typeof t.placement == "object" && (r.placement = Qh(n, t.placement)), Object.keys(r).length ? r : void 0;
9453
+ return n && t.placement && typeof t.placement == "object" && (r.placement = Zh(n, t.placement)), Object.keys(r).length ? r : void 0;
9435
9454
  }
9436
- var ep = 0.3, tp = 0.82, kt = 24, rp = 32;
9437
- function np(e) {
9455
+ var tp = 0.3, rp = 0.82, kt = 24, np = 32;
9456
+ function ap(e) {
9438
9457
  let t = 0, r = 0, n = 0, a = 0;
9439
9458
  for (let i = 0; i + 3 < e.length; i += 4) {
9440
9459
  const o = e[i + 3];
9441
- o < rp || (t += e[i] * o, r += e[i + 1] * o, n += e[i + 2] * o, a += o);
9460
+ o < np || (t += e[i] * o, r += e[i + 1] * o, n += e[i + 2] * o, a += o);
9442
9461
  }
9443
- return a === 0 ? null : ap(t / a, r / a, n / a);
9462
+ return a === 0 ? null : ip(t / a, r / a, n / a);
9444
9463
  }
9445
- function ap(e, t, r) {
9446
- const [n, a, i] = ip(e / 255, t / 255, r / 255), o = Math.min(tp, Math.max(ep, i)), [s, l, c] = op(n, a, o), d = (h) => Math.round(h * 255).toString(16).padStart(2, "0");
9464
+ function ip(e, t, r) {
9465
+ const [n, a, i] = op(e / 255, t / 255, r / 255), o = Math.min(rp, Math.max(tp, i)), [s, l, c] = sp(n, a, o), d = (h) => Math.round(h * 255).toString(16).padStart(2, "0");
9447
9466
  return `#${d(s)}${d(l)}${d(c)}`;
9448
9467
  }
9449
- function ip(e, t, r) {
9468
+ function op(e, t, r) {
9450
9469
  const n = Math.max(e, t, r), a = Math.min(e, t, r), i = (n + a) / 2;
9451
9470
  if (n === a) return [0, 0, i];
9452
9471
  const o = n - a, s = i > 0.5 ? o / (2 - n - a) : o / (n + a);
9453
9472
  let l;
9454
9473
  return n === e ? l = (t - r) / o + (t < r ? 6 : 0) : n === t ? l = (r - e) / o + 2 : l = (e - t) / o + 4, [l / 6, s, i];
9455
9474
  }
9456
- function op(e, t, r) {
9475
+ function sp(e, t, r) {
9457
9476
  if (t === 0) return [r, r, r];
9458
9477
  const n = r < 0.5 ? r * (1 + t) : r + t - r * t, a = 2 * r - n, i = (o) => (o < 0 && (o += 1), o > 1 && (o -= 1), o < 1 / 6 ? a + (n - a) * 6 * o : o < 1 / 2 ? n : o < 2 / 3 ? a + (n - a) * (2 / 3 - o) * 6 : a);
9459
9478
  return [i(e + 1 / 3), i(e), i(e - 1 / 3)];
9460
9479
  }
9461
9480
  var Jr = /* @__PURE__ */ new Map(), Bn = /* @__PURE__ */ new Map(), oa = /* @__PURE__ */ new Set();
9462
- function sp(e) {
9481
+ function lp(e) {
9463
9482
  return Jr.get(e);
9464
9483
  }
9465
- function lp(e) {
9484
+ function cp(e) {
9466
9485
  return oa.add(e), () => {
9467
9486
  oa.delete(e);
9468
9487
  };
9469
9488
  }
9470
- function cp(e) {
9489
+ function up(e) {
9471
9490
  if (Jr.has(e)) return Promise.resolve(Jr.get(e) ?? null);
9472
9491
  const t = Bn.get(e);
9473
9492
  if (t) return t;
9474
- const r = up(e).then((n) => {
9493
+ const r = dp(e).then((n) => {
9475
9494
  Bn.delete(e), Jr.set(e, n);
9476
9495
  for (const a of oa) a();
9477
9496
  return n;
9478
9497
  });
9479
9498
  return Bn.set(e, r), r;
9480
9499
  }
9481
- function up(e) {
9500
+ function dp(e) {
9482
9501
  return typeof Image > "u" || typeof document > "u" ? Promise.resolve(null) : new Promise((t) => {
9483
9502
  const r = new Image();
9484
9503
  r.crossOrigin = "anonymous", r.referrerPolicy = "no-referrer", r.onload = () => {
@@ -9491,7 +9510,7 @@ function up(e) {
9491
9510
  }
9492
9511
  a.drawImage(r, 0, 0, kt, kt);
9493
9512
  try {
9494
- t(np(a.getImageData(0, 0, kt, kt).data));
9513
+ t(ap(a.getImageData(0, 0, kt, kt).data));
9495
9514
  } catch (i) {
9496
9515
  console.debug("[prefs-client] picture colour unreadable", e, i), t(null);
9497
9516
  }
@@ -9502,13 +9521,13 @@ var Oa = "/cosmetics", Qi = "hadoku-cosmetics", Ie = (e) => e.replace(
9502
9521
  /[&<>"']/g,
9503
9522
  (t) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[t]
9504
9523
  ), ir = (e) => e ? e.slice(e.indexOf(".") + 1) : "none";
9505
- function dp(e) {
9524
+ function fp(e) {
9506
9525
  const t = e.s / 100 * (e.flip ? -1 : 1);
9507
9526
  return `translate(calc(var(--hc-sz) * ${(e.x / 100).toFixed(3)}),calc(var(--hc-sz) * ${(e.y / 100).toFixed(3)})) rotate(${e.r}deg) scale(${t.toFixed(3)},${(e.s / 100).toFixed(3)})`;
9508
9527
  }
9509
- var fp = /* @__PURE__ */ new Set(["hop"]);
9510
- function xg(e, t, r = {}) {
9511
- const n = ir(t?.effect), a = ir(t?.gradient), i = ir(t?.font), o = Ie(e), s = fp.has(n), l = s ? `<span class="hc-tx">${[...e].map(
9528
+ var hp = /* @__PURE__ */ new Set(["hop"]);
9529
+ function Cg(e, t, r = {}) {
9530
+ const n = ir(t?.effect), a = ir(t?.gradient), i = ir(t?.font), o = Ie(e), s = hp.has(n), l = s ? `<span class="hc-tx">${[...e].map(
9512
9531
  (g, _) => `<span class="hc-ch" style="--hc-i:${_}"><span class="hc-c">${g === " " ? "&nbsp;" : Ie(g)}</span></span>`
9513
9532
  ).join("")}</span>` : `<span class="hc-tx">${o}</span>`, c = (g) => `<span class="hc-lyr${g}" aria-hidden="true">${o}</span>`;
9514
9533
  let d = "", h = "";
@@ -9520,23 +9539,23 @@ function xg(e, t, r = {}) {
9520
9539
  ([g, _, R]) => `<i class="hc-tw" aria-hidden="true" style="left:${g}%;top:${_}%;animation-delay:${R}s"></i>`
9521
9540
  ).join("")), `<span class="${`hc-name hc-fx-${n} hc-gr-${a} hc-font-${i}${s ? " hc-split" : ""}${r.large ? " hc-large" : ""}`}">${d}${l}${h}</span>`;
9522
9541
  }
9523
- var hp = (() => {
9542
+ var pp = (() => {
9524
9543
  let e = "";
9525
9544
  for (let t = 0; t < 12; t++)
9526
9545
  e += `<g transform="rotate(${t * 30} 50 50)"><path d="M50 3 l2.5 4 -2.5 4 -2.5 -4z" fill="currentColor" opacity="${t % 3 ? 0.55 : 1}"/></g>`;
9527
9546
  return `<svg viewBox="0 0 100 100" aria-hidden="true"><circle cx="50" cy="50" r="44" fill="none" stroke="currentColor" stroke-width="1" stroke-dasharray="3 5" opacity=".7"/>${e}</svg>`;
9528
9547
  })();
9529
- function Cg(e, t = Oa) {
9548
+ function kg(e, t = Oa) {
9530
9549
  const r = e?.overlay;
9531
9550
  if (!r) return "";
9532
9551
  const n = aa.get(r)?.art;
9533
9552
  if (n) {
9534
9553
  const a = e?.placement ?? Xs;
9535
- return `<span class="hc-ol hc-art${n.pixel ? " hc-px" : ""}" data-hc-art="${Ie(r)}" style="left:${50 - n.width / 2}%;top:${n.top}%;width:${n.width}%;z-index:${a.back ? 0 : 3}"><span class="hc-adj" style="transform:${dp(a)}"><img alt="" draggable="false" style="--hc-tilt:${n.tilt}deg" src="${Ie(`${t}/art/${n.file}`)}"></span></span>`;
9554
+ return `<span class="hc-ol hc-art${n.pixel ? " hc-px" : ""}" data-hc-art="${Ie(r)}" style="left:${50 - n.width / 2}%;top:${n.top}%;width:${n.width}%;z-index:${a.back ? 0 : 3}"><span class="hc-adj" style="transform:${fp(a)}"><img alt="" draggable="false" style="--hc-tilt:${n.tilt}deg" src="${Ie(`${t}/art/${n.file}`)}"></span></span>`;
9536
9555
  }
9537
9556
  switch (ir(r)) {
9538
9557
  case "runes":
9539
- return `<span class="hc-ol hc-runes">${hp}</span>`;
9558
+ return `<span class="hc-ol hc-runes">${pp}</span>`;
9540
9559
  case "comet":
9541
9560
  return '<span class="hc-ol hc-comet"></span>';
9542
9561
  case "shine":
@@ -9551,12 +9570,12 @@ function Cg(e, t = Oa) {
9551
9570
  return "";
9552
9571
  }
9553
9572
  }
9554
- var Zi = "!<>-_/[]{}=+*^?#%&01", eo = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), to = 1400, pp = 160;
9555
- function kg(e, t, r = {}) {
9573
+ var Zi = "!<>-_/[]{}=+*^?#%&01", eo = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), to = 1400, mp = 160;
9574
+ function Ag(e, t, r = {}) {
9556
9575
  let n = ir(t?.message);
9557
9576
  if (n === "none") return `<span class="hc-msg">${Ie(e)}</span>`;
9558
9577
  const a = e.split(/\s+/).filter(Boolean);
9559
- eo.has(n) && e.length > pp && (n = "words");
9578
+ eo.has(n) && e.length > mp && (n = "words");
9560
9579
  const i = r.keep ? " data-hc-keep" : "";
9561
9580
  let o, s;
9562
9581
  if (eo.has(n)) {
@@ -9577,7 +9596,7 @@ function kg(e, t, r = {}) {
9577
9596
  ).join(" ");
9578
9597
  return `<span class="hc-msg hc-mt-${n}" style="--hc-step:${s.toFixed(1)}ms" data-text="${Ie(e)}"${i}><span class="hc-sr">${Ie(e)}</span><span aria-hidden="true">${o}</span></span>`;
9579
9598
  }
9580
- function mp(e) {
9599
+ function gp(e) {
9581
9600
  const t = e.target;
9582
9601
  if (e.pseudoElement || !t?.hasAttribute?.("data-hc-last")) return;
9583
9602
  const r = t.closest(".hc-msg");
@@ -9647,7 +9666,7 @@ var ro = {
9647
9666
  css: "font-weight:400;font-size:.62em;line-height:1.6"
9648
9667
  }
9649
9668
  };
9650
- function gp(e = Oa) {
9669
+ function yp(e = Oa) {
9651
9670
  const t = Object.entries(ro).map(
9652
9671
  ([n, a]) => `@font-face{font-family:"hc-${n}";src:url("${e}/fonts/${a.file}.woff2") format("woff2");font-display:swap}`
9653
9672
  ).join(`
@@ -9742,20 +9761,20 @@ ${r}
9742
9761
  @media (prefers-reduced-motion:reduce){.hc-name *,.hc-av *,.hc-av *::after,.hc-msg *,.hc-msg *::before,.hc-msg *::after{animation:none!important}}
9743
9762
  `;
9744
9763
  }
9745
- function Ag(e = document, t = Oa) {
9764
+ function Pg(e = document, t = Oa) {
9746
9765
  if (e.getElementById(Qi)) return;
9747
9766
  const r = e.createElement("style");
9748
- r.id = Qi, r.textContent = gp(t), e.head.appendChild(r), e.addEventListener("animationend", mp);
9749
- }
9750
- function yp(e, t) {
9751
- return (t ? sp(t) : null) ?? Rs(e);
9767
+ r.id = Qi, r.textContent = yp(t), e.head.appendChild(r), e.addEventListener("animationend", gp);
9752
9768
  }
9753
9769
  function vp(e, t) {
9770
+ return (t ? lp(t) : null) ?? Rs(e);
9771
+ }
9772
+ function bp(e, t) {
9754
9773
  return nt(() => {
9755
- t && cp(t);
9756
- }, [t]), ln(lp, () => yp(e, t), () => Rs(e));
9774
+ t && up(t);
9775
+ }, [t]), ln(cp, () => vp(e, t), () => Rs(e));
9757
9776
  }
9758
- function bp({ sprite: e, url: t, alt: r = "", className: n, style: a, fallback: i }) {
9777
+ function wp({ sprite: e, url: t, alt: r = "", className: n, style: a, fallback: i }) {
9759
9778
  const [o, s] = vo(null);
9760
9779
  if (t && t !== o)
9761
9780
  return /* @__PURE__ */ N(
@@ -9773,11 +9792,11 @@ function bp({ sprite: e, url: t, alt: r = "", className: n, style: a, fallback:
9773
9792
  const l = Ts(e);
9774
9793
  return l ? /* @__PURE__ */ N("img", { src: l, alt: r, crossOrigin: "anonymous", className: n, style: a, draggable: !1 }) : /* @__PURE__ */ N(yo, { children: i });
9775
9794
  }
9776
- const wp = "hadoku://library";
9777
- function _p(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
9795
+ const _p = "hadoku://library";
9796
+ function Ep(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
9778
9797
  return e !== void 0 && /(^|\s)HadokuApp\/\S/.test(e);
9779
9798
  }
9780
- function Ep(e) {
9799
+ function Sp(e) {
9781
9800
  return e.slice().sort(
9782
9801
  (t, r) => (r.users?.length ?? 0) - (t.users?.length ?? 0) || t.room_id.localeCompare(r.room_id)
9783
9802
  );
@@ -9789,7 +9808,7 @@ async function Js(e, t = 1) {
9789
9808
  const a = await fetch(`${r}/api/rooms${Es() ? "?debug=1" : ""}`, { cache: "no-store", signal: e });
9790
9809
  if (!a.ok) throw new Error(`HTTP ${a.status}`);
9791
9810
  const i = await a.json();
9792
- return x("home", "rooms-fetch: success", { attempt: t, elapsedMs: Date.now() - n, roomCount: (i.rooms ?? []).length }), Ep(i.rooms || []);
9811
+ return x("home", "rooms-fetch: success", { attempt: t, elapsedMs: Date.now() - n, roomCount: (i.rooms ?? []).length }), Sp(i.rooms || []);
9793
9812
  } catch (a) {
9794
9813
  if (a instanceof Error && a.name === "AbortError") throw a;
9795
9814
  const i = a instanceof Error ? a.message : void 0;
@@ -9798,11 +9817,11 @@ async function Js(e, t = 1) {
9798
9817
  throw at("app", "Failed to load rooms list", { elapsedMs: Date.now() - n, error: i }), a;
9799
9818
  }
9800
9819
  }
9801
- function Sp(e) {
9820
+ function Rp(e) {
9802
9821
  return e.room_id.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
9803
9822
  }
9804
- function Rp({ user: e }) {
9805
- const t = vp(e.sprite_id, e.avatar_url);
9823
+ function Tp({ user: e }) {
9824
+ const t = bp(e.sprite_id, e.avatar_url);
9806
9825
  return /* @__PURE__ */ $e("span", { className: "relative -ml-2 first:ml-0 group/av", children: [
9807
9826
  /* @__PURE__ */ N(
9808
9827
  "span",
@@ -9810,7 +9829,7 @@ function Rp({ user: e }) {
9810
9829
  className: "block h-10 w-10 rounded-full border-2 overflow-hidden bg-bg-card transition-transform duration-150 group-hover/av:scale-110 group-hover/av:z-10 shadow-md",
9811
9830
  style: { borderColor: t },
9812
9831
  children: /* @__PURE__ */ N(
9813
- bp,
9832
+ wp,
9814
9833
  {
9815
9834
  sprite: e.sprite_id,
9816
9835
  url: e.avatar_url,
@@ -9831,7 +9850,7 @@ function Rp({ user: e }) {
9831
9850
  )
9832
9851
  ] });
9833
9852
  }
9834
- function Tp({ room: e }) {
9853
+ function xp({ room: e }) {
9835
9854
  const t = e.users ?? [], r = t.length;
9836
9855
  return /* @__PURE__ */ $e("li", { className: "flex items-stretch gap-2", children: [
9837
9856
  /* @__PURE__ */ N(
@@ -9840,8 +9859,8 @@ function Tp({ room: e }) {
9840
9859
  to: `/room/${encodeURIComponent(e.viewer_key)}`,
9841
9860
  className: "flex-1 block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40",
9842
9861
  children: /* @__PURE__ */ $e("div", { className: "flex items-center justify-between gap-4", children: [
9843
- /* @__PURE__ */ N("div", { className: "text-xl font-medium tracking-wide text-text no-underline", children: Sp(e) }),
9844
- r > 0 && /* @__PURE__ */ N("div", { className: "flex shrink-0", children: t.map((n, a) => /* @__PURE__ */ N(Rp, { user: n }, `${n.name}-${a}`)) })
9862
+ /* @__PURE__ */ N("div", { className: "text-xl font-medium tracking-wide text-text no-underline", children: Rp(e) }),
9863
+ r > 0 && /* @__PURE__ */ N("div", { className: "flex shrink-0", children: t.map((n, a) => /* @__PURE__ */ N(Tp, { user: n }, `${n.name}-${a}`)) })
9845
9864
  ] })
9846
9865
  }
9847
9866
  ),
@@ -9856,9 +9875,9 @@ function Tp({ room: e }) {
9856
9875
  )
9857
9876
  ] });
9858
9877
  }
9859
- function xp() {
9860
- const e = rf(), { list: t, loading: r, error: n, refresh: a } = Qf("list", {
9861
- pings: Gh(),
9878
+ function Cp() {
9879
+ const e = nf(), { list: t, loading: r, error: n, refresh: a } = Zf("list", {
9880
+ pings: Yh(),
9862
9881
  fetchList: (h) => Js(h)
9863
9882
  }), i = gl(() => t ?? [], [t]), o = t === null ? n : null, s = ks(), l = _t(null);
9864
9883
  nt(() => {
@@ -9887,15 +9906,15 @@ function xp() {
9887
9906
  children: "Retry"
9888
9907
  }
9889
9908
  )
9890
- ] }) : i.length === 0 ? /* @__PURE__ */ N("div", { className: "text-text-secondary text-sm px-1 py-3", children: "No rooms available." }) : /* @__PURE__ */ N(yo, { children: /* @__PURE__ */ N("ul", { ref: l, className: "list-none p-0 m-0 space-y-2", children: i.map((h) => /* @__PURE__ */ N(Tp, { room: h }, h.viewer_key)) }) })
9909
+ ] }) : i.length === 0 ? /* @__PURE__ */ N("div", { className: "text-text-secondary text-sm px-1 py-3", children: "No rooms available." }) : /* @__PURE__ */ N(yo, { children: /* @__PURE__ */ N("ul", { ref: l, className: "list-none p-0 m-0 space-y-2", children: i.map((h) => /* @__PURE__ */ N(xp, { room: h }, h.viewer_key)) }) })
9891
9910
  ] }),
9892
- If() && /* @__PURE__ */ N("div", { className: "w-full max-w-md z-10", children: /* @__PURE__ */ N(ef, { className: "block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 text-xl font-medium tracking-wide text-text transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40" }) }),
9893
- _p() && /* @__PURE__ */ $e("div", { className: "w-full max-w-md z-10", children: [
9911
+ Lf() && /* @__PURE__ */ N("div", { className: "w-full max-w-md z-10", children: /* @__PURE__ */ N(tf, { className: "block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 text-xl font-medium tracking-wide text-text transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40" }) }),
9912
+ Ep() && /* @__PURE__ */ $e("div", { className: "w-full max-w-md z-10", children: [
9894
9913
  /* @__PURE__ */ N("h2", { className: "text-xs uppercase tracking-[0.2em] text-text-muted/70 mb-3 px-1", children: "On this phone" }),
9895
9914
  /* @__PURE__ */ $e(
9896
9915
  "a",
9897
9916
  {
9898
- href: wp,
9917
+ href: _p,
9899
9918
  className: "block no-underline rounded-lg border border-border bg-bg-card/40 backdrop-blur-sm px-5 py-4 transition-all duration-150 hover:border-border-light hover:-translate-y-px hover:bg-bg-card/55 focus:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/40",
9900
9919
  children: [
9901
9920
  /* @__PURE__ */ N("div", { className: "text-xl font-medium tracking-wide text-text", children: "Library" }),
@@ -9906,18 +9925,18 @@ function xp() {
9906
9925
  ] })
9907
9926
  ] });
9908
9927
  }
9909
- function Cp() {
9928
+ function kp() {
9910
9929
  return /* @__PURE__ */ $e("div", { className: "fixed inset-0 bg-black", children: [
9911
9930
  /* @__PURE__ */ N(Ns, {}),
9912
9931
  /* @__PURE__ */ N("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ N("div", { className: "text-center", children: /* @__PURE__ */ N("h1", { className: "text-4xl font-bold text-white mb-4", children: "API is sleeping..." }) }) })
9913
9932
  ] });
9914
9933
  }
9915
- const kp = "watchparty_fragment_delivery", Ap = /^[0-9a-f]{64}$/, Pp = /^[A-Za-z0-9_.-]+$/;
9916
- function Mp(e) {
9917
- return !(!e || !e.baseUrl || e.baseUrl.endsWith("/") || !Ap.test(e.token) || e.trackId !== void 0 && !Pp.test(e.trackId));
9934
+ const Ap = "watchparty_fragment_delivery", Pp = /^[0-9a-f]{64}$/, Mp = /^[A-Za-z0-9_.-]+$/;
9935
+ function Ip(e) {
9936
+ return !(!e || !e.baseUrl || e.baseUrl.endsWith("/") || !Pp.test(e.token) || e.trackId !== void 0 && !Mp.test(e.trackId));
9918
9937
  }
9919
- function Pg(e, t) {
9920
- if (!Mp(e)) return null;
9938
+ function Mg(e, t) {
9939
+ if (!Ip(e)) return null;
9921
9940
  let r;
9922
9941
  if (t === "init")
9923
9942
  r = "init";
@@ -9928,7 +9947,7 @@ function Pg(e, t) {
9928
9947
  const n = e.trackId ? `audio/${e.trackId}/` : "";
9929
9948
  return `${e.baseUrl}/v/${e.token}/${n}${r}`;
9930
9949
  }
9931
- function Ip() {
9950
+ function Lp() {
9932
9951
  if (typeof window > "u") return null;
9933
9952
  try {
9934
9953
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -9936,27 +9955,27 @@ function Ip() {
9936
9955
  if (e === "0" || e === "false") return !1;
9937
9956
  } catch {
9938
9957
  }
9939
- return af(kp);
9958
+ return of(Ap);
9940
9959
  }
9941
9960
  let Da = { ...as }, Qr = null, Qs = !1;
9942
9961
  const no = "watchparty_delivery_client_id";
9943
- function Lp() {
9962
+ function Op() {
9944
9963
  const e = je(no);
9945
9964
  if (e) return e;
9946
9965
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
9947
9966
  return Ta(no, t) ? t : "";
9948
9967
  }
9949
- function Op(e) {
9968
+ function Dp(e) {
9950
9969
  Da = is(e), Qs || (Qr = null);
9951
9970
  }
9952
- function Dp() {
9971
+ function Np() {
9953
9972
  return { ...Da };
9954
9973
  }
9955
9974
  function Zs() {
9956
- return Qr === null && (Qr = Sd(Da, Lp(), Ip())), Qr;
9975
+ return Qr === null && (Qr = Sd(Da, Op(), Lp())), Qr;
9957
9976
  }
9958
9977
  let ao = !1;
9959
- async function Np(e) {
9978
+ async function $p(e) {
9960
9979
  if (!ao) {
9961
9980
  ao = !0;
9962
9981
  for (let t = 0; t < 2; t++) {
@@ -9964,7 +9983,7 @@ async function Np(e) {
9964
9983
  const r = await fetch(`${e}/api/flags`, { cache: "no-store" });
9965
9984
  if (r.ok) {
9966
9985
  const n = await r.json();
9967
- Op(n?.fragment_delivery), x("app", "Delivery flag loaded", { ...Dp(), attempt: t });
9986
+ Dp(n?.fragment_delivery), x("app", "Delivery flag loaded", { ...Np(), attempt: t });
9968
9987
  return;
9969
9988
  }
9970
9989
  } catch {
@@ -9974,28 +9993,28 @@ async function Np(e) {
9974
9993
  ne("app", "Delivery flag fetch failed; staying on the default delivery path");
9975
9994
  }
9976
9995
  }
9977
- function $p() {
9996
+ function Fp() {
9978
9997
  return Zs();
9979
9998
  }
9980
- function Mg() {
9999
+ function Ig() {
9981
10000
  const e = Zs();
9982
10001
  return Qs = !0, e === "fragment";
9983
10002
  }
9984
10003
  let Na = Ld;
9985
10004
  const sa = /* @__PURE__ */ new Set();
9986
- function Fp(e) {
10005
+ function Up(e) {
9987
10006
  Na = e;
9988
10007
  for (const t of sa) t();
9989
10008
  }
9990
- function Up(e) {
10009
+ function Bp(e) {
9991
10010
  const t = Id.safeParse(e?.games);
9992
10011
  if (!t.success)
9993
10012
  return ne("game", "Game catalog rejected; keeping the current list", { issues: t.error.issues.length }), !1;
9994
10013
  const r = t.data;
9995
- return Fp(r), !0;
10014
+ return Up(r), !0;
9996
10015
  }
9997
10016
  let io = !1;
9998
- async function Bp(e) {
10017
+ async function jp(e) {
9999
10018
  if (!io) {
10000
10019
  io = !0;
10001
10020
  try {
@@ -10004,24 +10023,24 @@ async function Bp(e) {
10004
10023
  ne("game", "Game catalog fetch failed; using the default list", { status: t.status });
10005
10024
  return;
10006
10025
  }
10007
- Up(await t.json()) && x("game", "Game catalog loaded", { games: Na.map((r) => r.id) });
10026
+ Bp(await t.json()) && x("game", "Game catalog loaded", { games: Na.map((r) => r.id) });
10008
10027
  } catch (t) {
10009
10028
  ne("game", "Game catalog fetch failed; using the default list", Ue(t));
10010
10029
  }
10011
10030
  }
10012
10031
  }
10013
- function jp() {
10032
+ function zp() {
10014
10033
  return Na;
10015
10034
  }
10016
- function zp(e) {
10035
+ function Hp(e) {
10017
10036
  return sa.add(e), () => {
10018
10037
  sa.delete(e);
10019
10038
  };
10020
10039
  }
10021
- function Ig() {
10022
- return ln(zp, jp);
10040
+ function Lg() {
10041
+ return ln(Hp, zp);
10023
10042
  }
10024
- function Hp(e) {
10043
+ function Vp(e) {
10025
10044
  return ut.lazy(async () => {
10026
10045
  try {
10027
10046
  return await e();
@@ -10035,33 +10054,33 @@ function Hp(e) {
10035
10054
  }
10036
10055
  });
10037
10056
  }
10038
- const Vp = ["demo-room"];
10039
- function qp(e) {
10040
- return e ? Vp.some((t) => e === t || e.startsWith(t + "-")) : !1;
10041
- }
10057
+ const qp = ["demo-room"];
10042
10058
  function Wp(e) {
10059
+ return e ? qp.some((t) => e === t || e.startsWith(t + "-")) : !1;
10060
+ }
10061
+ function Kp(e) {
10043
10062
  if (!(e.hostname === "hadoku.me")) return null;
10044
10063
  if (e.requireAuth) {
10045
10064
  if (Di() !== "public") return null;
10046
10065
  const n = e.pathname + (e.search || "");
10047
10066
  return `/auth?return=${encodeURIComponent(n)}`;
10048
10067
  }
10049
- if (!e.roomKey || qp(e.roomKey) || Di() !== "public") return null;
10068
+ if (!e.roomKey || Wp(e.roomKey) || Di() !== "public") return null;
10050
10069
  const r = e.pathname + (e.search || "");
10051
10070
  return `/auth?return=${encodeURIComponent(r)}`;
10052
10071
  }
10053
- const oo = Hp(() => import("./Room-B0Zl13Bx.js").then((e) => e.R));
10072
+ const oo = Vp(() => import("./Room-tIpAYM6b.js").then((e) => e.R));
10054
10073
  function so() {
10055
10074
  return /* @__PURE__ */ N("div", { className: "flex-1 flex items-center justify-center bg-black", children: /* @__PURE__ */ N("div", { className: "text-text-secondary text-sm", children: "Loading room..." }) });
10056
10075
  }
10057
- function Kp() {
10058
- const e = pt(), t = qc(), r = Wp({
10076
+ function Gp() {
10077
+ const e = pt(), t = qc(), r = Kp({
10059
10078
  roomKey: t.roomKey,
10060
10079
  hostname: window.location.hostname,
10061
10080
  pathname: window.location.pathname,
10062
10081
  search: window.location.search
10063
10082
  });
10064
- return r ? (window.location.replace(r), null) : t.roomKey ? /* @__PURE__ */ N(ut.Suspense, { fallback: /* @__PURE__ */ N(so, {}), children: /* @__PURE__ */ N(oo, {}) }) : e.pathname === "/" || e.pathname === "" ? /* @__PURE__ */ N(xp, {}) : e.pathname.startsWith("/room") ? /* @__PURE__ */ N(ut.Suspense, { fallback: /* @__PURE__ */ N(so, {}), children: /* @__PURE__ */ N(oo, {}) }) : /* @__PURE__ */ N("div", { className: "p-6", children: "Not Found" });
10083
+ return r ? (window.location.replace(r), null) : t.roomKey ? /* @__PURE__ */ N(ut.Suspense, { fallback: /* @__PURE__ */ N(so, {}), children: /* @__PURE__ */ N(oo, {}) }) : e.pathname === "/" || e.pathname === "" ? /* @__PURE__ */ N(Cp, {}) : e.pathname.startsWith("/room") ? /* @__PURE__ */ N(ut.Suspense, { fallback: /* @__PURE__ */ N(so, {}), children: /* @__PURE__ */ N(oo, {}) }) : /* @__PURE__ */ N("div", { className: "p-6", children: "Not Found" });
10065
10084
  }
10066
10085
  function jn(e) {
10067
10086
  const [t, r] = vo(!1), n = ks(), a = {
@@ -10080,7 +10099,7 @@ function jn(e) {
10080
10099
  signal: o.signal
10081
10100
  });
10082
10101
  if (o.signal.aborted) return;
10083
- c.ok ? (x("app", "API health check passed"), Np(i), Bp(i)) : (at("app", "API health check failed", { status: c.status }), r(!0));
10102
+ c.ok ? (x("app", "API health check passed"), $p(i), jp(i)) : (at("app", "API health check failed", { status: c.status }), r(!0));
10084
10103
  } catch (c) {
10085
10104
  if (c?.name === "AbortError") return;
10086
10105
  at("app", "API unreachable", { url: l, error: c }), r(!0);
@@ -10118,19 +10137,19 @@ function jn(e) {
10118
10137
  "requestIdleCallback" in window ? window.requestIdleCallback(o, { timeout: 2e3 }) : setTimeout(o, 600);
10119
10138
  }
10120
10139
  document.readyState === "complete" ? s() : window.addEventListener("load", s, { once: !0 });
10121
- }, []), t ? /* @__PURE__ */ N(Cp, {}) : (
10140
+ }, []), t ? /* @__PURE__ */ N(kp, {}) : (
10122
10141
  // HadokuThemeRoot must sit above everything that reads the theme —
10123
10142
  // <HadokuThemePicker> in ChatPanel throws without it, by design, so a
10124
10143
  // missing provider is a mount-time error rather than a silently wrong
10125
10144
  // theme. It also applies data-theme, which this app previously did through
10126
10145
  // its own useTheme() call.
10127
10146
  /* @__PURE__ */ N(bl, { children: /* @__PURE__ */ N(ms.Provider, { value: a, children: /* @__PURE__ */ $e("div", { className: "h-screen flex flex-col bg-bg", "data-tv": n ? "" : void 0, children: [
10128
- /* @__PURE__ */ N("main", { className: "flex-1 w-full overflow-hidden min-h-0 flex flex-col", children: /* @__PURE__ */ N(Kp, {}) }),
10129
- /* @__PURE__ */ N(Vf, {})
10147
+ /* @__PURE__ */ N("main", { className: "flex-1 w-full overflow-hidden min-h-0 flex flex-col", children: /* @__PURE__ */ N(Gp, {}) }),
10148
+ /* @__PURE__ */ N(qf, {})
10130
10149
  ] }) }) })
10131
10150
  );
10132
10151
  }
10133
- function Gp({ basename: e = "/watchparty", appProps: t } = {}) {
10152
+ function Yp({ basename: e = "/watchparty", appProps: t } = {}) {
10134
10153
  const r = t ?? {}, n = [
10135
10154
  { path: "/", element: /* @__PURE__ */ N(jn, { ...r }) },
10136
10155
  { path: "/room/:roomKey", element: /* @__PURE__ */ N(jn, { ...r }) },
@@ -10142,7 +10161,7 @@ let Zr;
10142
10161
  function el() {
10143
10162
  return je(Rl) || void 0;
10144
10163
  }
10145
- function Yp() {
10164
+ function Xp() {
10146
10165
  if (Zr) return;
10147
10166
  const e = el();
10148
10167
  if (e) {
@@ -10155,10 +10174,10 @@ function Yp() {
10155
10174
  x("identity", "device id unavailable — joining without one");
10156
10175
  });
10157
10176
  }
10158
- function Xp() {
10177
+ function Jp() {
10159
10178
  return Zr ??= el();
10160
10179
  }
10161
- function Jp(e) {
10180
+ function Qp(e) {
10162
10181
  const t = typeof window < "u" ? window.location.href : "http://localhost/", r = new URL(e, t).pathname;
10163
10182
  return `${r.endsWith("/") ? r : `${r}/`}socket.io/`;
10164
10183
  }
@@ -10180,7 +10199,7 @@ function lo(e, t) {
10180
10199
  template: e.isSystem && typeof e.template == "string" && e.template.includes(id) ? e.template : void 0
10181
10200
  };
10182
10201
  }
10183
- function Qp(e, t = () => !0) {
10202
+ function Zp(e, t = () => !0) {
10184
10203
  e.on(re.CHAT_BROADCAST, (r) => {
10185
10204
  if (!t()) return;
10186
10205
  const n = { ...lo(r, r.server_seq), live: !0 };
@@ -10191,29 +10210,29 @@ function Qp(e, t = () => !0) {
10191
10210
  U.getState().setChat(n), x("chat", "History loaded", { count: n.length });
10192
10211
  });
10193
10212
  }
10194
- let Zp = null;
10195
- function em(e = Zp) {
10213
+ let em = null;
10214
+ function tm(e = em) {
10196
10215
  if (!e) return null;
10197
10216
  const t = typeof window < "u" ? window.location.href : "http://localhost/", r = e.namespace ?? "/room";
10198
10217
  return {
10199
10218
  url: `${new URL(e.origin, t).origin}${r.startsWith("/") ? r : `/${r}`}`,
10200
- path: e.path ?? Jp(e.origin)
10219
+ path: e.path ?? Qp(e.origin)
10201
10220
  };
10202
10221
  }
10203
- function Lg(e) {
10222
+ function Og(e) {
10204
10223
  const r = `${pn()}/media/${e}`.replace(/\\/g, "/");
10205
10224
  return { mediaUrl: `${r}/${bd}`, indexUrl: `${r}/index.json` };
10206
10225
  }
10207
- function tm(e) {
10226
+ function rm(e) {
10208
10227
  return `${pn()}/media/${e}`.replace(/\\/g, "/");
10209
10228
  }
10210
- function rm(e, t) {
10211
- return tm(t ?? `${e}/poster.jpg`);
10229
+ function nm(e, t) {
10230
+ return rm(t ?? `${e}/poster.jpg`);
10212
10231
  }
10213
10232
  function tl(e) {
10214
10233
  return `${pn()}${e}`.replace(/\\/g, "/");
10215
10234
  }
10216
- async function nm(e) {
10235
+ async function am(e) {
10217
10236
  try {
10218
10237
  const t = await fetch(tl("/api/tierlist"));
10219
10238
  if (!t.ok)
@@ -10229,19 +10248,19 @@ async function nm(e) {
10229
10248
  }
10230
10249
  }
10231
10250
  let co = !1;
10232
- function Og() {
10251
+ function Dg() {
10233
10252
  if (co || typeof Image > "u") return;
10234
10253
  const e = U.getState().tierlist;
10235
10254
  if (!(!e || e.items.length === 0)) {
10236
10255
  co = !0;
10237
10256
  for (const t of e.items) {
10238
10257
  const r = new Image();
10239
- r.decoding = "async", r.src = rm(t.id, t.thumbnail);
10258
+ r.decoding = "async", r.src = nm(t.id, t.thumbnail);
10240
10259
  }
10241
10260
  x("tierlist", "Warming posters", { count: e.items.length });
10242
10261
  }
10243
10262
  }
10244
- async function Dg(e) {
10263
+ async function Ng(e) {
10245
10264
  U.getState().setTierlistSaving(!0);
10246
10265
  try {
10247
10266
  const r = await fetch(tl("/api/tierlist/me"), {
@@ -10259,18 +10278,18 @@ async function Dg(e) {
10259
10278
  U.getState().setTierlistSaving(!1);
10260
10279
  }
10261
10280
  }
10262
- function am() {
10281
+ function im() {
10263
10282
  const e = U.getState(), t = xs(Object.values(e.roster).map((a) => a.sprite), void 0, Nt);
10264
10283
  if (!t)
10265
10284
  return ne("socket", "sprite_taken: no available sprites to retry with"), null;
10266
10285
  const r = !!e.name && !St(e.name), n = r ? e.name : dr(t);
10267
10286
  return x("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: n, keptCustomName: r }), e.setSessionIdentity(n, t), { name: n, sprite: t };
10268
10287
  }
10269
- function im(e) {
10288
+ function om(e) {
10270
10289
  const t = U.getState(), r = e ? t.roster[e] : void 0;
10271
10290
  return !r || !!r.sprite && r.sprite === t.sprite;
10272
10291
  }
10273
- var om = "https://hadoku.me/prefs", uo = "hadoku-avatar-link", sm = "hadoku-avatar-link", fo = "hadoku-avatar-link-popup";
10292
+ var sm = "https://hadoku.me/prefs", uo = "hadoku-avatar-link", lm = "hadoku-avatar-link", fo = "hadoku-avatar-link-popup";
10274
10293
  function ho(e) {
10275
10294
  try {
10276
10295
  e ? sessionStorage.setItem(fo, "1") : sessionStorage.removeItem(fo);
@@ -10283,21 +10302,21 @@ var sn = class extends Error {
10283
10302
  }
10284
10303
  status;
10285
10304
  };
10286
- async function lm(e) {
10305
+ async function cm(e) {
10287
10306
  if (!e.ok) {
10288
10307
  const t = await e.json().catch(() => null);
10289
10308
  throw new sn(e.status, t?.message ?? `HTTP ${e.status}`);
10290
10309
  }
10291
10310
  return await e.json();
10292
10311
  }
10293
- function cm(e = {}) {
10294
- const t = `${e.baseUrl ?? om}/api/v1/_avatar`, r = e.fetch ?? fetch, n = (s, l = {}) => r(`${t}${s}`, { credentials: "include", ...l }).then(lm), a = (s, l, c) => n(s, {
10312
+ function um(e = {}) {
10313
+ const t = `${e.baseUrl ?? sm}/api/v1/_avatar`, r = e.fetch ?? fetch, n = (s, l = {}) => r(`${t}${s}`, { credentials: "include", ...l }).then(cm), a = (s, l, c) => n(s, {
10295
10314
  method: l,
10296
10315
  ...c === void 0 ? {} : { headers: { "Content-Type": "application/json" }, body: JSON.stringify(c) }
10297
10316
  }), i = () => n("");
10298
10317
  async function o(s) {
10299
10318
  ho(!0);
10300
- const l = window.open("about:blank", sm, "popup,width=520,height=760");
10319
+ const l = window.open("about:blank", lm, "popup,width=520,height=760");
10301
10320
  if (ho(!1), !l)
10302
10321
  throw new sn(0, "The sign-in window was blocked: allow pop-ups for hadoku.me");
10303
10322
  let c;
@@ -10362,16 +10381,16 @@ var po = "hadoku:avatar";
10362
10381
  function $a(e) {
10363
10382
  return e?.sprite ?? e?.avatar?.sprite ?? null;
10364
10383
  }
10365
- async function um(e = {}) {
10384
+ async function dm(e = {}) {
10366
10385
  const t = typeof location > "u" ? void 0 : location.origin, r = e.baseUrl ?? (t ? `${t}/prefs` : void 0);
10367
10386
  if (!r) return null;
10368
10387
  try {
10369
- return $a(await cm({ baseUrl: r, fetch: e.fetch }).get());
10388
+ return $a(await um({ baseUrl: r, fetch: e.fetch }).get());
10370
10389
  } catch (n) {
10371
10390
  return n instanceof sn && [401, 403, 404].includes(n.status) || (e.onError ?? ((a) => console.warn("[prefs-client] avatar settings unreadable", a)))(n), null;
10372
10391
  }
10373
10392
  }
10374
- function Ng(e) {
10393
+ function $g(e) {
10375
10394
  if (typeof window > "u") return () => {
10376
10395
  };
10377
10396
  const t = (r) => {
@@ -10380,13 +10399,13 @@ function Ng(e) {
10380
10399
  };
10381
10400
  return window.addEventListener(po, t), () => window.removeEventListener(po, t);
10382
10401
  }
10383
- const dm = "hadoku:name";
10384
- function $g(e) {
10402
+ const fm = "hadoku:name";
10403
+ function Fg(e) {
10385
10404
  const t = $a(e);
10386
10405
  return hn(t) ? t : null;
10387
10406
  }
10388
- async function Fg(e = {}) {
10389
- const t = await um({
10407
+ async function Ug(e = {}) {
10408
+ const t = await dm({
10390
10409
  ...e,
10391
10410
  onError: (n) => ne("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ue(n))
10392
10411
  }), r = hn(t) ? t : null;
@@ -10399,7 +10418,7 @@ function mo(e) {
10399
10418
  const n = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !St(t.name) ? t.name : dr(e);
10400
10419
  return t.setSessionIdentity(n, e), !0;
10401
10420
  }
10402
- function fm(e, t, r) {
10421
+ function hm(e, t, r) {
10403
10422
  if (!r) return () => {
10404
10423
  };
10405
10424
  const n = (a) => {
@@ -10408,25 +10427,25 @@ function fm(e, t, r) {
10408
10427
  };
10409
10428
  return r.addEventListener(e, n), () => r.removeEventListener(e, n);
10410
10429
  }
10411
- const hm = () => typeof window > "u" ? void 0 : window;
10412
- function Ug(e, t = hm()) {
10413
- return fm(dm, (r) => {
10430
+ const pm = () => typeof window > "u" ? void 0 : window;
10431
+ function Bg(e, t = pm()) {
10432
+ return hm(fm, (r) => {
10414
10433
  typeof r.name == "string" && r.name.trim() && e(r.name);
10415
10434
  }, t);
10416
10435
  }
10417
- const pm = 10;
10418
- function mm(e = typeof window < "u" ? window : void 0) {
10436
+ const mm = 10;
10437
+ function gm(e = typeof window < "u" ? window : void 0) {
10419
10438
  if (!e) return { framed: !1, depth: 0 };
10420
10439
  try {
10421
10440
  let t = 0, r = e;
10422
- for (; r !== r.parent && t < pm; )
10441
+ for (; r !== r.parent && t < mm; )
10423
10442
  t++, r = r.parent;
10424
10443
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
10425
10444
  } catch {
10426
10445
  return { framed: !1, depth: 0 };
10427
10446
  }
10428
10447
  }
10429
- function gm(e, t) {
10448
+ function ym(e, t) {
10430
10449
  let r = 0;
10431
10450
  for (const n of e.videos) {
10432
10451
  const a = Ft.voteKey(t, e.id, n.mediaId);
@@ -10434,49 +10453,49 @@ function gm(e, t) {
10434
10453
  }
10435
10454
  return r;
10436
10455
  }
10437
- const ym = 2e4, vm = 1e4;
10438
- function bm() {
10456
+ const vm = 2e4, bm = 1e4;
10457
+ function wm() {
10439
10458
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
10440
10459
  }
10441
- function wm(e, t) {
10460
+ function _m(e, t) {
10442
10461
  e.lastPongAt = t, e.unansweredSince = null;
10443
10462
  }
10444
- function _m(e, t, r) {
10445
- const n = e.lastTickAt !== null && t - e.lastTickAt > vm;
10446
- return e.lastTickAt = t, r ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > ym : (e.unansweredSince = null, !1);
10463
+ function Em(e, t, r) {
10464
+ const n = e.lastTickAt !== null && t - e.lastTickAt > bm;
10465
+ return e.lastTickAt = t, r ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > vm : (e.unansweredSince = null, !1);
10447
10466
  }
10448
10467
  function rl(e, t) {
10449
10468
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
10450
10469
  }
10451
10470
  let Q = null, Fe = null, en = null, Be = null, it = null;
10452
- const Em = Rm(), Et = bm();
10471
+ const Sm = Tm(), Et = wm();
10453
10472
  let Fr = null, zn = null, go = 0, Fa = null, fr = !1, Ua = !1, Qt = !1, Ba = null;
10454
- function Bg(e) {
10473
+ function jg(e) {
10455
10474
  const t = Ae(), r = U.getState();
10456
10475
  if (r.me.clientId && r.roster[r.me.clientId])
10457
10476
  return (e.name || e.sprite) && (x("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(re.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
10458
- const n = Sm(e);
10477
+ const n = Rm(e);
10459
10478
  return it = n, Fa = { name: n.name, sprite: n.sprite }, t.connected ? (x("socket", "Emitting join", n), t.emit(re.JOIN, n)) : t.once("connect", () => {
10460
10479
  x("socket", "Emitting join", n), t.emit(re.JOIN, n);
10461
10480
  }), t;
10462
10481
  }
10463
- function Sm(e) {
10482
+ function Rm(e) {
10464
10483
  return {
10465
10484
  room_key: e.room_key,
10466
10485
  name: e.name,
10467
10486
  sprite: e.sprite,
10468
10487
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
10469
10488
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
10470
- embed: mm(),
10471
- delivery_arm: $p(),
10489
+ embed: gm(),
10490
+ delivery_arm: Fp(),
10472
10491
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
10473
10492
  // (lastJoinPayload carries it) so a reconnect lands on the same
10474
10493
  // ParticipantId rather than minting a new person.
10475
- device_id: Xp(),
10476
- tab_id: Em
10494
+ device_id: Jp(),
10495
+ tab_id: Sm
10477
10496
  };
10478
10497
  }
10479
- function Rm() {
10498
+ function Tm() {
10480
10499
  const e = globalThis.crypto;
10481
10500
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
10482
10501
  const t = new Uint8Array(16);
@@ -10484,7 +10503,7 @@ function Rm() {
10484
10503
  else for (let r = 0; r < t.length; r++) t[r] = Math.floor(Math.random() * 256);
10485
10504
  return Array.from(t, (r) => r.toString(16).padStart(2, "0")).join("");
10486
10505
  }
10487
- function jg() {
10506
+ function zg() {
10488
10507
  return rl(Et, Date.now());
10489
10508
  }
10490
10509
  function Ae() {
@@ -10494,7 +10513,7 @@ function Ae() {
10494
10513
  const n = window.location;
10495
10514
  (n.hostname === "localhost" || n.hostname === "127.0.0.1") && n.port === String(fn) && (t = `${n.protocol}//${n.hostname}:${vr}`, x("socket", "Using dev fallback origin", { origin: t }));
10496
10515
  }
10497
- const r = em();
10516
+ const r = tm();
10498
10517
  if (r)
10499
10518
  Q = Lt(r.url, { path: r.path, transports: ["websocket", "polling"] }), x("socket", "Socket initialized on the room origin", r);
10500
10519
  else {
@@ -10502,14 +10521,14 @@ function Ae() {
10502
10521
  Q = Lt(n, { path: Qo, transports: ["websocket", "polling"] }), x("socket", "Socket initialized", { origin: t });
10503
10522
  }
10504
10523
  gn("__SOCKET__", Q), Be && (clearTimeout(Be), Be = null), Fe = null, en = setInterval(() => {
10505
- if (_m(Et, Date.now(), !!Q?.connected)) {
10524
+ if (Em(Et, Date.now(), !!Q?.connected)) {
10506
10525
  ne("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
10507
10526
  sid: Q?.id,
10508
10527
  lastPongAgeMs: rl(Et, Date.now()) ?? null
10509
10528
  }), zn = "pong-watchdog", Et.unansweredSince = null, Q?.io.engine?.close();
10510
10529
  return;
10511
10530
  }
10512
- Om();
10531
+ Dm();
10513
10532
  }, vd), Q.on("connect", () => {
10514
10533
  Ua = !1;
10515
10534
  const n = Q?.id;
@@ -10546,14 +10565,14 @@ function Ae() {
10546
10565
  Qt = !0;
10547
10566
  }), Q.on("disconnect", (n) => {
10548
10567
  ws(null), Fr = { reason: zn ?? n, at: Date.now() }, zn = null, x("socket", "Disconnected", { reason: n });
10549
- }), Q.on("connect_error", (n) => at("socket", "Connection error", { message: n?.message })), Q.on("reconnect_attempt", (n) => ne("socket", "Reconnect attempt", { attempt: n })), Q.on("reconnect_failed", () => at("socket", "Reconnect failed")), Lm(Q);
10568
+ }), Q.on("connect_error", (n) => at("socket", "Connection error", { message: n?.message })), Q.on("reconnect_attempt", (n) => ne("socket", "Reconnect attempt", { attempt: n })), Q.on("reconnect_failed", () => at("socket", "Reconnect failed")), Om(Q);
10550
10569
  }
10551
10570
  return Q;
10552
10571
  }
10553
10572
  function Hn(e) {
10554
10573
  return e.play_state === "playing" || e.playing === !0;
10555
10574
  }
10556
- function Tm(e) {
10575
+ function xm(e) {
10557
10576
  e.on(re.SNAPSHOT, (t) => {
10558
10577
  e.emit(Ea.SYNC), U.getState().applySnapshot({
10559
10578
  roomId: t.room_id ?? null,
@@ -10563,7 +10582,7 @@ function Tm(e) {
10563
10582
  serverSeq: t.server_seq || 0,
10564
10583
  leaderId: t.leader_id || null
10565
10584
  }), U.getState().name || x("socket", "Deferring identity to presence event (snapshot carries no roster)");
10566
- const r = U.getState(), n = Q?.id, i = (n ? r.roster[n] : void 0) ?? Fa, o = Ef(
10585
+ const r = U.getState(), n = Q?.id, i = (n ? r.roster[n] : void 0) ?? Fa, o = Sf(
10567
10586
  { name: r.name, avatarId: r.sprite },
10568
10587
  i ? { name: i.name, avatarId: i.sprite ?? null } : void 0,
10569
10588
  // A join that carried no name counts as a default one, so a name that
@@ -10606,7 +10625,7 @@ function Tm(e) {
10606
10625
  }), e.on(re.CONTROL_ACK, (t) => {
10607
10626
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && x("socket", "Control ack received", t);
10608
10627
  }), e.on(re.TIME_PONG, (t) => {
10609
- if (wm(Et, Date.now()), Fe && Fe.ts) {
10628
+ if (_m(Et, Date.now()), Fe && Fe.ts) {
10610
10629
  const r = Date.now() - Fe.ts;
10611
10630
  U.getState().addRttSample(r, t?.server_ts, Fe.ts), Fe = null, Be && (clearTimeout(Be), Be = null), x("socket", "Time sync RTT", { rtt: r, offset: U.getState().drift.offsetMs });
10612
10631
  }
@@ -10616,11 +10635,11 @@ function Tm(e) {
10616
10635
  U.getState().setReadiness({ mediaId: r, ready: i, readyCount: n, total: a }), x("socket", "Ready state received", { mediaId: r, readyCount: n, total: a, ready: i });
10617
10636
  });
10618
10637
  }
10619
- function xm(e) {
10620
- const t = Zh(e);
10638
+ function Cm(e) {
10639
+ const t = ep(e);
10621
10640
  return t ? { cosmetics: t } : {};
10622
10641
  }
10623
- function Cm(e) {
10642
+ function km(e) {
10624
10643
  e.on(re.PRESENCE, (t) => {
10625
10644
  if (!t) return;
10626
10645
  if (Array.isArray(t.users)) {
@@ -10634,7 +10653,7 @@ function Cm(e) {
10634
10653
  isLeader: s.is_leader,
10635
10654
  ...s.registry_name ? { registryName: !0 } : {},
10636
10655
  ...s.avatar_url ? { avatarUrl: s.avatar_url } : {},
10637
- ...xm(s.cosmetics)
10656
+ ...Cm(s.cosmetics)
10638
10657
  };
10639
10658
  const a = U.getState(), i = Q?.id, o = i ? n[i] : void 0;
10640
10659
  if (o?.registryName)
@@ -10656,7 +10675,7 @@ function Cm(e) {
10656
10675
  }
10657
10676
  });
10658
10677
  }
10659
- function km(e) {
10678
+ function Am(e) {
10660
10679
  e.on(rt.STATE, (t) => {
10661
10680
  U.getState().applyPlaylistState({
10662
10681
  playlist: t?.playlist ?? null,
@@ -10669,63 +10688,63 @@ function km(e) {
10669
10688
  U.getState().setPlaylistResults(t ?? null), x("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
10670
10689
  }), e.on(rt.VOTES_CLEARED, (t) => {
10671
10690
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
10672
- const r = gm(
10691
+ const r = ym(
10673
10692
  { id: t.playlistId, videos: t.mediaIds.map((a) => ({ mediaId: a })) },
10674
- Of()
10693
+ Df()
10675
10694
  ), n = U.getState();
10676
10695
  n.playlist?.id === t.playlistId && n.applyPlaylistState({ playlist: n.playlist, activeIndex: n.activePlaylistIndex, myVotes: {} }), x("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: r });
10677
10696
  });
10678
10697
  }
10679
- function Am(e) {
10698
+ function Pm(e) {
10680
10699
  e.on(hd.UPDATED, () => {
10681
- x("tierlist", "Someone saved — refreshing the board"), nm(!1);
10700
+ x("tierlist", "Someone saved — refreshing the board"), am(!1);
10682
10701
  });
10683
10702
  }
10684
- function Pm(e) {
10703
+ function Mm(e) {
10685
10704
  e.on(_a.STATE, (t) => {
10686
10705
  if (!t || typeof t.active != "boolean") return;
10687
10706
  const r = Array.isArray(t.ready) ? t.ready.filter((n) => typeof n == "string") : [];
10688
10707
  U.getState().setReadyCheckState({ active: t.active, ready: r }), x("ready-check", "State received", { active: t.active, readyCount: r.length });
10689
10708
  });
10690
10709
  }
10691
- function zg() {
10710
+ function Hg() {
10692
10711
  Q?.emit(_a.START, {});
10693
10712
  }
10694
- function Hg(e) {
10713
+ function Vg(e) {
10695
10714
  Q?.emit(_a.TOGGLE, { ready: e });
10696
10715
  }
10697
- function Mm(e) {
10716
+ function Im(e) {
10698
10717
  e.on(Ea.ACTIVE, (t) => {
10699
10718
  const r = typeof t?.gameId == "string" ? t.gameId : null;
10700
10719
  U.getState().setActiveGameId(r), x("game", "game_active", { gameId: r });
10701
10720
  });
10702
10721
  }
10703
- function Vg(e) {
10722
+ function qg(e) {
10704
10723
  Q?.emit(Ea.SELECT, { gameId: e });
10705
10724
  }
10706
- function Im(e) {
10725
+ function Lm(e) {
10707
10726
  e.on(re.HEALTH_SNAPSHOT, (t) => {
10708
10727
  U.getState().setHealthSnapshot(t);
10709
10728
  }), e.on(re.BUFFER_STATUS, (t) => {
10710
10729
  U.getState().setBufferStatus(t);
10711
10730
  });
10712
10731
  }
10713
- function Lm(e) {
10714
- Tm(e), Cm(e), Qp(e, () => !0), Im(e), km(e), Am(e), Pm(e), Mm(e), e.on(re.ERROR, (t) => {
10732
+ function Om(e) {
10733
+ xm(e), km(e), Zp(e, () => !0), Lm(e), Am(e), Pm(e), Mm(e), Im(e), e.on(re.ERROR, (t) => {
10715
10734
  const r = t?.code || "error/unknown";
10716
10735
  if (r === "conflict" && t?.message === "sprite_held_by_you") {
10717
10736
  Ua = !0, x("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
10718
10737
  return;
10719
10738
  }
10720
10739
  if (r === "conflict" && t?.message === "sprite_taken") {
10721
- if (im(Q?.id)) {
10740
+ if (om(Q?.id)) {
10722
10741
  x("socket", "sprite_taken: stale, the server already has our sprite");
10723
10742
  return;
10724
10743
  }
10725
10744
  fr = !0;
10726
10745
  let o;
10727
10746
  try {
10728
- o = am();
10747
+ o = im();
10729
10748
  } finally {
10730
10749
  fr = !1;
10731
10750
  }
@@ -10756,16 +10775,16 @@ function Lm(e) {
10756
10775
  (r.startsWith("auth/") ? ne : at)("socket", `Server error: ${a}`, { code: r, raw: t }), U.getState().pushToast("error", a);
10757
10776
  });
10758
10777
  }
10759
- function qg(e, t) {
10778
+ function Wg(e, t) {
10760
10779
  const r = t?.length ? { text: e, images: t } : { text: e };
10761
10780
  Ae().emit(re.CHAT_SEND, r);
10762
10781
  }
10763
- function Om() {
10782
+ function Dm() {
10764
10783
  Fe || (Fe = { ts: Date.now() }, Ae().emit(re.TIME_PING, {}), Be = setTimeout(() => {
10765
10784
  Fe && (x("socket", "Time ping timed out after 10s, clearing inflight"), Fe = null), Be = null;
10766
10785
  }, 1e4));
10767
10786
  }
10768
- function Wg(e) {
10787
+ function Kg(e) {
10769
10788
  const t = U.getState(), r = t.me.clientId;
10770
10789
  if (!r || !t.roster[r]) {
10771
10790
  mo(e), x("socket", "Avatar change before join: the join will carry it", { sprite: e });
@@ -10780,10 +10799,10 @@ function Wg(e) {
10780
10799
  const n = U.getState(), a = { avatar: !0 };
10781
10800
  n.sprite && n.sprite !== t.sprite && (a.sprite = n.sprite), n.name && n.name !== t.name && (a.name = n.name), x("socket", "Sending avatar change", a), Ae().emit(re.IDENTITY_UPDATE, a);
10782
10801
  }
10783
- function Kg(e) {
10784
- U.getState().me.clientId && Dm(e);
10802
+ function Gg(e) {
10803
+ U.getState().me.clientId && Nm(e);
10785
10804
  }
10786
- function Dm(e, t) {
10805
+ function Nm(e, t) {
10787
10806
  const r = {};
10788
10807
  e && (r.name = e), !(!r.name && !r.sprite) && (x("socket", "Sending identity update", r), Ae().emit(re.IDENTITY_UPDATE, r));
10789
10808
  }
@@ -10799,14 +10818,14 @@ U.subscribe((e, t) => {
10799
10818
  const o = {};
10800
10819
  a && (o.name = e.name, Ur.name = e.name), i && (o.sprite = e.sprite, Ur.sprite = e.sprite), x("socket", "Identity reassert (store change)", o), Q?.connected ? Q.emit(re.IDENTITY_UPDATE, o) : Ae().emit(re.IDENTITY_UPDATE, o);
10801
10820
  });
10802
- function Nm() {
10821
+ function $m() {
10803
10822
  en && (clearInterval(en), en = null), Be && (clearTimeout(Be), Be = null), Fe = null, Et.unansweredSince = null, Et.lastTickAt = null;
10804
10823
  }
10805
- function $m() {
10824
+ function Fm() {
10806
10825
  x("socket", "clearJoinState called", { hadPayload: it !== null, room_key: it?.room_key }), it = null, Qt = !1, Ba = null;
10807
10826
  }
10808
- function Fm() {
10809
- x("socket", "leaveRoom called", { room_key: it?.room_key }), $m(), Nm(), Q && (Q.disconnect(), Q = null), U.setState({
10827
+ function Um() {
10828
+ x("socket", "leaveRoom called", { room_key: it?.room_key }), Fm(), $m(), Q && (Q.disconnect(), Q = null), U.setState({
10810
10829
  me: { clientId: null, nextClientSeq: 1 },
10811
10830
  roster: {},
10812
10831
  snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
@@ -10821,40 +10840,40 @@ function Fm() {
10821
10840
  activeGameId: null
10822
10841
  });
10823
10842
  }
10824
- function Gg(e) {
10843
+ function Yg(e) {
10825
10844
  x("playlist", "Emitting playlist_load", { playlistId: e }), Ae().emit(rt.LOAD, { playlistId: e });
10826
10845
  }
10827
- function Yg(e) {
10846
+ function Xg(e) {
10828
10847
  x("playlist", "Emitting playlist_select", { index: e }), Ae().emit(rt.SELECT, { index: e });
10829
10848
  }
10830
- function Xg(e, t, r) {
10849
+ function Jg(e, t, r) {
10831
10850
  x("playlist", "Emitting playlist_vote_update", { playlistId: e, mediaId: t, vote: r }), Ae().emit(rt.VOTE_UPDATE, { playlistId: e, mediaId: t, vote: r });
10832
10851
  }
10833
- function Jg() {
10852
+ function Qg() {
10834
10853
  x("chat", "Emitting recap_request"), Ae().emit("recap_request");
10835
10854
  }
10836
- function Qg() {
10855
+ function Zg() {
10837
10856
  x("playlist", "Emitting playlist_reveal_request"), Ae().emit(rt.REVEAL_REQUEST, {});
10838
10857
  }
10839
- function Zg(e) {
10858
+ function ey(e) {
10840
10859
  x("playlist", "Emitting playlist_vote_remove", { voterKey: e }), Ae().emit(rt.VOTE_REMOVE, { voterKey: e });
10841
10860
  }
10842
- function ey(e) {
10861
+ function ty(e) {
10843
10862
  Ba = e, Ae().emit(re.CLIENT_READY, { media_id: e }), x("socket", "client_ready emitted", { mediaId: e });
10844
10863
  }
10845
- function Um(e) {
10864
+ function Bm(e) {
10846
10865
  if (!e || e === "/" || document.querySelector(`link[rel="preconnect"][href="${e}"]`)) return;
10847
10866
  const t = document.createElement("link");
10848
10867
  t.rel = "preconnect", t.href = e, t.crossOrigin = "anonymous", document.head.appendChild(t);
10849
10868
  }
10850
- function Bm(e, t, r) {
10869
+ function jm(e, t, r) {
10851
10870
  const n = yl(e), a = r ? /* @__PURE__ */ N(ut.StrictMode, { children: t }) : t;
10852
10871
  return n.render(a), n;
10853
10872
  }
10854
10873
  let Ot = null, Dt = null;
10855
10874
  const nl = import.meta.url.replace(/[^/]*$/, "");
10856
10875
  let Br = !1;
10857
- function jm() {
10876
+ function zm() {
10858
10877
  const e = () => {
10859
10878
  Br || !$t() || (Br = !0, x("boot", "tv mode: starting with chat collapsed"), U.getState().applyTvDefaults());
10860
10879
  };
@@ -10864,19 +10883,19 @@ function jm() {
10864
10883
  });
10865
10884
  }
10866
10885
  }
10867
- function zm(e) {
10886
+ function Hm(e) {
10868
10887
  return !e.filename || !e.filename.startsWith(nl) ? !1 : !/^ResizeObserver loop/.test(e.message ?? "");
10869
10888
  }
10870
- function ty(e, t = {}) {
10889
+ function ry(e, t = {}) {
10871
10890
  const { basename: r, strictMode: n = !1, ...a } = t;
10872
- of(), tf({
10891
+ sf(), rf({
10873
10892
  serverOrigin: a.serverOrigin,
10874
10893
  defaultRoomKey: a.defaultRoomKey,
10875
10894
  cdnBase: a.cdnBase
10876
- }), Yp(), Mf({
10895
+ }), Xp(), If({
10877
10896
  userType: a.userType,
10878
10897
  userId: a.userId
10879
- }), U.getState().rehydrateFromPrefs(), jm();
10898
+ }), U.getState().rehydrateFromPrefs(), zm();
10880
10899
  try {
10881
10900
  const c = vn() || "public", d = yn(), h = typeof localStorage < "u" ? localStorage : null, y = h?.getItem("watchparty_preferences"), g = h && c !== "public" ? h.getItem(`watchparty_preferences:${c}`) : null, _ = d ? h?.getItem(`prefs-cache:${d}:portfolio`) : null, R = d ? h?.getItem(`prefs-cache:${d}:watchparty`) : null, b = U.getState();
10882
10901
  x("boot", "prefs.beacon", {
@@ -10892,139 +10911,138 @@ function ty(e, t = {}) {
10892
10911
  } catch (c) {
10893
10912
  ne("boot", "prefs.beacon.threw", { err: c?.message });
10894
10913
  }
10895
- Df().catch((c) => ne("boot", "whoami threw", Ue(c))), jf().then((c) => {
10914
+ Nf().catch((c) => ne("boot", "whoami threw", Ue(c))), zf().then((c) => {
10896
10915
  c && U.getState().rehydrateFromPrefs();
10897
10916
  }).catch((c) => ne("boot", "prefs sync threw", Ue(c))), Ot || (Ot = (c) => {
10898
10917
  at("app", "Unhandled promise rejection", { reason: String(c.reason) });
10899
10918
  }, window.addEventListener("unhandledrejection", Ot)), Dt || (Dt = (c) => {
10900
- zm(c) && at("app", "Uncaught error", {
10919
+ Hm(c) && at("app", "Uncaught error", {
10901
10920
  message: c.message,
10902
10921
  source: `${c.filename.slice(nl.length)}:${c.lineno}:${c.colno}`,
10903
10922
  stack: c.error instanceof Error ? c.error.stack?.slice(0, 1500) : void 0
10904
10923
  });
10905
- }, window.addEventListener("error", Dt)), a.serverOrigin && Um(a.serverOrigin);
10924
+ }, window.addEventListener("error", Dt)), a.serverOrigin && Bm(a.serverOrigin);
10906
10925
  const i = Ca().theme;
10907
- i && wl.includes(i) && _l(i), _f().catch((c) => ne("boot", "display names load threw", Ue(c))), e.__watchparty?.root.unmount();
10908
- const o = Gp({
10926
+ i && wl.includes(i) && _l(i), Ef().catch((c) => ne("boot", "display names load threw", Ue(c))), e.__watchparty?.root.unmount();
10927
+ const o = Yp({
10909
10928
  basename: r,
10910
10929
  appProps: a
10911
- }), l = { root: Bm(e, /* @__PURE__ */ N(Yu, { router: o }), n) };
10930
+ }), l = { root: jm(e, /* @__PURE__ */ N(Yu, { router: o }), n) };
10912
10931
  return e.__watchparty = l, o;
10913
10932
  }
10914
- function ry(e) {
10933
+ function ny(e) {
10915
10934
  const t = e.__watchparty;
10916
- t && (t.root.unmount(), delete e.__watchparty, Fm(), Ot && (window.removeEventListener("unhandledrejection", Ot), Ot = null), Dt && (window.removeEventListener("error", Dt), Dt = null));
10935
+ t && (t.root.unmount(), delete e.__watchparty, Um(), Ot && (window.removeEventListener("unhandledrejection", Ot), Ot = null), Dt && (window.removeEventListener("error", Dt), Dt = null));
10917
10936
  }
10918
10937
  export {
10919
10938
  Ae as $,
10920
- bp as A,
10939
+ wp as A,
10921
10940
  Ca as B,
10922
10941
  tr as C,
10923
10942
  ba as D,
10924
10943
  Di as E,
10925
10944
  vn as F,
10926
- Vg as G,
10927
- ng as H,
10928
- rg as I,
10945
+ qg as G,
10946
+ ag as H,
10947
+ ng as I,
10929
10948
  gn as J,
10930
- Hg as K,
10949
+ Vg as K,
10931
10950
  rn as L,
10932
10951
  On as M,
10933
- zg as N,
10934
- tg as O,
10935
- nm as P,
10936
- Dg as Q,
10937
- rm as R,
10938
- vg as S,
10939
- Qm as T,
10940
- Ng as U,
10941
- Ug as V,
10942
- $g as W,
10943
- Wg as X,
10944
- Kg as Y,
10952
+ Hg as N,
10953
+ rg as O,
10954
+ am as P,
10955
+ Ng as Q,
10956
+ nm as R,
10957
+ bg as S,
10958
+ Zm as T,
10959
+ $g as U,
10960
+ Bg as V,
10961
+ Fg as W,
10962
+ Kg as X,
10963
+ Gg as Y,
10945
10964
  Ue as Z,
10946
10965
  pn as _,
10947
- wg as a,
10966
+ _g as a,
10948
10967
  re as a0,
10949
- eg as a1,
10950
- lg as a2,
10951
- Mg as a3,
10952
- Pg as a4,
10953
- ug as a5,
10954
- cg as a6,
10955
- ig as a7,
10956
- Zm as a8,
10957
- pg as a9,
10958
- Bg as aA,
10968
+ tg as a1,
10969
+ cg as a2,
10970
+ Ig as a3,
10971
+ Mg as a4,
10972
+ dg as a5,
10973
+ ug as a6,
10974
+ og as a7,
10975
+ eg as a8,
10976
+ mg as a9,
10977
+ jg as aA,
10959
10978
  Es as aB,
10960
- gg as aC,
10961
- yg as aD,
10962
- Nd as aE,
10963
- Lf as aF,
10964
- Gg as aG,
10965
- Rg as aH,
10966
- hn as aI,
10967
- Zg as aJ,
10968
- Ft as aK,
10969
- Of as aL,
10970
- je as aM,
10971
- Xg as aN,
10972
- Qg as aO,
10973
- Yg as aP,
10974
- Ta as aQ,
10975
- ty as aR,
10976
- ry as aS,
10977
- Gp as aT,
10978
- fg as aa,
10979
- hg as ab,
10980
- dg as ac,
10981
- Sg as ad,
10982
- Jm as ae,
10983
- jg as af,
10984
- $p as ag,
10985
- rf as ah,
10979
+ yg as aC,
10980
+ vg as aD,
10981
+ Of as aE,
10982
+ Yg as aF,
10983
+ Tg as aG,
10984
+ hn as aH,
10985
+ ey as aI,
10986
+ Ft as aJ,
10987
+ Df as aK,
10988
+ je as aL,
10989
+ Jg as aM,
10990
+ Zg as aN,
10991
+ Xg as aO,
10992
+ Ta as aP,
10993
+ ry as aQ,
10994
+ ny as aR,
10995
+ Yp as aS,
10996
+ hg as aa,
10997
+ pg as ab,
10998
+ fg as ac,
10999
+ Rg as ad,
11000
+ Qm as ae,
11001
+ zg as af,
11002
+ Fp as ag,
11003
+ nf as ah,
10986
11004
  gs as ai,
10987
- ag as aj,
10988
- og as ak,
10989
- Ym as al,
10990
- Lg as am,
10991
- mg as an,
10992
- tm as ao,
11005
+ ig as aj,
11006
+ sg as ak,
11007
+ Xm as al,
11008
+ Og as am,
11009
+ gg as an,
11010
+ rm as ao,
10993
11011
  bd as ap,
10994
11012
  ks as aq,
10995
- sg as ar,
10996
- ey as as,
11013
+ lg as ar,
11014
+ ty as as,
10997
11015
  ms as at,
10998
11016
  Tt as au,
10999
11017
  Ns as av,
11000
11018
  qc as aw,
11001
- _f as ax,
11002
- jf as ay,
11003
- Fg as az,
11004
- ef as b,
11019
+ Ef as ax,
11020
+ zf as ay,
11021
+ Ug as az,
11022
+ tf as b,
11005
11023
  id as c,
11006
11024
  x as d,
11007
11025
  at as e,
11008
- bg as f,
11009
- Qd as g,
11010
- Ag as h,
11026
+ wg as f,
11027
+ Zd as g,
11028
+ Pg as h,
11011
11029
  Jo as i,
11012
- Cg as j,
11030
+ kg as j,
11013
11031
  ds as k,
11014
- vp as l,
11015
- _g as m,
11016
- kg as n,
11017
- xg as o,
11018
- Og as p,
11019
- Jg as q,
11020
- Eg as r,
11021
- qg as s,
11022
- Xm as t,
11032
+ bp as l,
11033
+ Eg as m,
11034
+ Ag as n,
11035
+ Cg as o,
11036
+ Dg as p,
11037
+ Qg as q,
11038
+ Sg as r,
11039
+ Wg as s,
11040
+ Jm as t,
11023
11041
  U as u,
11024
11042
  ed as v,
11025
11043
  ne as w,
11026
- Ig as x,
11027
- Fm as y,
11028
- Hp as z
11044
+ Lg as x,
11045
+ Um as y,
11046
+ Vp as z
11029
11047
  };
11030
- //# sourceMappingURL=index-Blg73T3D.js.map
11048
+ //# sourceMappingURL=index-JIM3jBN_.js.map