@hadoku/watchparty-ui 0.45.91 → 0.45.93

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, Km = 80, Qo = "/watchparty/ws", ed = 500, Gm = 1e3, ba = 4, Ym = 3e3, Zo = typeof process < "u" && process.env ? process.env : {};
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 : {};
4805
4805
  Zo.PRODUCTION_UI_URL;
4806
4806
  Zo.PRODUCTION_SERVER_URL;
4807
- const Vr = u.enum(["S", "A", "B", "C", "D", "F"]), Xm = ["S", "A", "B", "C", "D", "F"], Ai = 2e4, td = 300;
4807
+ const Vr = u.enum(["S", "A", "B", "C", "D", "F"]), Qm = ["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 Jm = 4, Qm = 3e4, Zm = 5e3, eg = 2e3, tg = 5e3, rg = 2e3, ng = 5e3, ag = 2e3, ig = 1e4, og = 10, sg = 2e3, lg = 3, cg = 50, ug = 3, dg = 3e4, fg = 2e4, hg = 99999, vd = 5e3, bd = "output_frag.mp4", Pi = "/healthz", as = { mode: "off", percent: 0 }, wd = ["off", "on", "ab"];
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"];
5232
5232
  function _d(e) {
5233
5233
  return typeof e == "string" && wd.includes(e);
5234
5234
  }
@@ -5347,7 +5347,9 @@ const ls = u.string().min(2).max(512).refine(Ad, {
5347
5347
  poster: u.string().nullable(),
5348
5348
  /** The folder this show would land in — `SousouNoFrieren`. */
5349
5349
  series: u.string(),
5350
- /** On the scraper's watch list already (by series). */
5350
+ /** On the scraper's watch list already: an entry for this exact show (same
5351
+ * provider id), not merely the same series folder — Season 2 of a show
5352
+ * whose Season 1 is listed is NOT on the list. */
5351
5353
  onWatchlist: u.boolean(),
5352
5354
  /**
5353
5355
  * Not addable: a movie, or a title with no usable Latin-script name. The
@@ -5373,8 +5375,40 @@ u.object({
5373
5375
  source: Ra,
5374
5376
  id: u.string().regex(/^\d{1,12}$/)
5375
5377
  });
5376
- u.object({ series: u.string(), title: u.string() });
5377
- const pg = 2, mg = 100;
5378
+ u.object({
5379
+ series: u.string(),
5380
+ title: u.string(),
5381
+ /** The season the scraper recorded (it derives one from AniList's prequel
5382
+ * chain), or null when it could not tell. */
5383
+ season: u.number().int().nullable()
5384
+ });
5385
+ const Nd = 99, $d = u.object({
5386
+ id: u.number().int(),
5387
+ series: u.string(),
5388
+ season: u.number().int().nullable(),
5389
+ title: u.string(),
5390
+ source: u.string().nullable(),
5391
+ sourceId: u.string().nullable(),
5392
+ createdAt: u.string().nullable(),
5393
+ retiredAt: u.string().nullable(),
5394
+ retiredReason: u.string().nullable(),
5395
+ /** `you` — added for the caller; `other` — for someone else; `none` — no
5396
+ * one (the scraper's committed list, an operator's add). */
5397
+ owner: u.enum(["you", "other", "none"]),
5398
+ /** The caller may change or remove it: their own row, or any row for an admin. */
5399
+ editable: u.boolean(),
5400
+ /** Episodes of this season the library holds: `ready` to play, and
5401
+ * `downloaded` (in the input tree, ingested or not). Null when the season
5402
+ * is unknown. */
5403
+ episodes: u.object({ ready: u.number().int(), downloaded: u.number().int() }).nullable()
5404
+ });
5405
+ u.object({ entries: u.array($d) });
5406
+ u.object({
5407
+ season: u.number().int().min(1).max(Nd).nullable().optional(),
5408
+ title: u.string().trim().min(1).max(200).optional(),
5409
+ retired: u.boolean().optional()
5410
+ }).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;
5378
5412
  var On = {
5379
5413
  image: 10 * 1024 * 1024,
5380
5414
  audio: 50 * 1024 * 1024
@@ -5385,7 +5419,7 @@ function we(e, t, r) {
5385
5419
  function xe(e) {
5386
5420
  return [...e].map((t) => t.charCodeAt(0));
5387
5421
  }
5388
- function Nd(e) {
5422
+ function Fd(e) {
5389
5423
  if (e.length < 3 || e[0] !== 255) return !1;
5390
5424
  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;
5391
5425
  return n && a !== 1 && i === 1 && o !== 0 && o !== 15 && s !== 3;
@@ -5436,7 +5470,7 @@ var cs = [
5436
5470
  kind: "audio",
5437
5471
  // Either an ID3v2 tag ("ID3" + a major version of 2–4 + a minor that is
5438
5472
  // never 0xFF) or a bare Layer III frame. Most real mp3s carry the tag.
5439
- matches: (e) => we(e, 0, xe("ID3")) && (e[3] ?? 0) >= 2 && (e[3] ?? 0) <= 4 && e[4] !== 255 || Nd(e)
5473
+ matches: (e) => we(e, 0, xe("ID3")) && (e[3] ?? 0) >= 2 && (e[3] ?? 0) <= 4 && e[4] !== 255 || Fd(e)
5440
5474
  },
5441
5475
  {
5442
5476
  contentType: "audio/flac",
@@ -5482,7 +5516,7 @@ function us(e) {
5482
5516
  );
5483
5517
  }
5484
5518
  cs.map((e) => e.contentType).join(", ");
5485
- var $d = us("image"), Fd = us("audio"), Ud = {
5519
+ var Ud = us("image"), Bd = us("audio"), jd = {
5486
5520
  "audio/mp3": "audio/mpeg",
5487
5521
  "audio/x-mp3": "audio/mpeg",
5488
5522
  "audio/x-mpeg": "audio/mpeg",
@@ -5496,9 +5530,9 @@ var $d = us("image"), Fd = us("audio"), Ud = {
5496
5530
  };
5497
5531
  function ds(e) {
5498
5532
  const t = e.toLowerCase();
5499
- return $d.includes(t) ? "image" : Fd.includes(t) || t in Ud ? "audio" : null;
5533
+ return Ud.includes(t) ? "image" : Bd.includes(t) || t in jd ? "audio" : null;
5500
5534
  }
5501
- var Bd = 24, gg = 250, tr = class extends Error {
5535
+ var zd = 24, vg = 250, tr = class extends Error {
5502
5536
  reason;
5503
5537
  /** HTTP status, when there was a response. */
5504
5538
  status;
@@ -5515,7 +5549,7 @@ var Bd = 24, gg = 250, tr = class extends Error {
5515
5549
  super(t), this.name = "CdnError", this.reason = e, this.status = r, this.retryAfterSeconds = n;
5516
5550
  }
5517
5551
  };
5518
- function jd(e, t = Date.now()) {
5552
+ function Hd(e, t = Date.now()) {
5519
5553
  if (!e) return null;
5520
5554
  const r = e.trim();
5521
5555
  if (!r) return null;
@@ -5524,7 +5558,7 @@ function jd(e, t = Date.now()) {
5524
5558
  const a = Date.parse(r);
5525
5559
  return Number.isNaN(a) ? null : Math.max(0, Math.ceil((a - t) / 1e3));
5526
5560
  }
5527
- function zd(e) {
5561
+ function Vd(e) {
5528
5562
  switch (e) {
5529
5563
  case 401:
5530
5564
  return "unauthenticated";
@@ -5547,8 +5581,8 @@ function zd(e) {
5547
5581
  return "unknown";
5548
5582
  }
5549
5583
  }
5550
- async function Hd(e) {
5551
- const t = zd(e.status);
5584
+ async function qd(e) {
5585
+ const t = Vd(e.status);
5552
5586
  let r = `CDN request failed (${e.status})`;
5553
5587
  try {
5554
5588
  const n = await e.json();
@@ -5559,11 +5593,11 @@ async function Hd(e) {
5559
5593
  t,
5560
5594
  r,
5561
5595
  e.status,
5562
- t === "rate-limited" ? jd(e.headers.get("Retry-After")) : null
5596
+ t === "rate-limited" ? Hd(e.headers.get("Retry-After")) : null
5563
5597
  );
5564
5598
  }
5565
- var Vd = "/cdn/api/upload", qd = /^[0-9a-f]{64}\.[a-z0-9]{1,8}$/;
5566
- function Wd(e) {
5599
+ var Wd = "/cdn/api/upload", Kd = /^[0-9a-f]{64}\.[a-z0-9]{1,8}$/;
5600
+ function Gd(e) {
5567
5601
  if (e.size === 0)
5568
5602
  throw new tr("invalid", "File is empty");
5569
5603
  const t = e.type ? ds(e.type) : null;
@@ -5573,7 +5607,7 @@ function Wd(e) {
5573
5607
  if (e.size > r)
5574
5608
  throw new tr("too-large", `File is ${e.size} bytes; the maximum is ${r}`);
5575
5609
  }
5576
- function Kd(e) {
5610
+ function Yd(e) {
5577
5611
  if (typeof e != "object" || e === null) return null;
5578
5612
  const t = e;
5579
5613
  return typeof t.key != "string" || !t.key ? null : {
@@ -5585,8 +5619,8 @@ function Kd(e) {
5585
5619
  contentType: typeof t.contentType == "string" ? t.contentType : "image/*"
5586
5620
  };
5587
5621
  }
5588
- function Gd(e) {
5589
- const t = e.cdnBase.replace(/\/+$/, ""), r = e.uploadPath ?? Vd, n = e.fetch ?? globalThis.fetch.bind(globalThis);
5622
+ function Xd(e) {
5623
+ const t = e.cdnBase.replace(/\/+$/, ""), r = e.uploadPath ?? Wd, n = e.fetch ?? globalThis.fetch.bind(globalThis);
5590
5624
  async function a(i, o) {
5591
5625
  let s;
5592
5626
  try {
@@ -5594,14 +5628,14 @@ function Gd(e) {
5594
5628
  } catch (l) {
5595
5629
  throw l instanceof Error && l.name === "AbortError" ? l : new tr("network", l instanceof Error ? l.message : "Request failed");
5596
5630
  }
5597
- if (!s.ok) throw await Hd(s);
5631
+ if (!s.ok) throw await qd(s);
5598
5632
  return s;
5599
5633
  }
5600
5634
  return {
5601
5635
  cdnBase: t,
5602
5636
  uploadPath: r,
5603
5637
  async upload(i, o) {
5604
- return Wd(i), await (await a(r, {
5638
+ return Gd(i), await (await a(r, {
5605
5639
  method: "POST",
5606
5640
  body: i,
5607
5641
  signal: o?.signal,
@@ -5614,21 +5648,21 @@ function Gd(e) {
5614
5648
  return `${t}/${i.replace(/^\/+/, "")}`;
5615
5649
  },
5616
5650
  isKey(i) {
5617
- return qd.test(i);
5651
+ return Kd.test(i);
5618
5652
  },
5619
5653
  catalogue(i, o) {
5620
5654
  const s = i.replace(/\/+$/, ""), l = o?.surface;
5621
5655
  return {
5622
5656
  async search(c = {}) {
5623
5657
  const d = new URLSearchParams(), h = c.query?.trim();
5624
- h && d.set("q", h), d.set("limit", String(c.limit ?? Bd)), c.cursor && d.set("cursor", c.cursor);
5658
+ h && d.set("q", h), d.set("limit", String(c.limit ?? zd)), c.cursor && d.set("cursor", c.cursor);
5625
5659
  const g = await (await a(`${s}?${d.toString()}`, {
5626
5660
  method: "GET",
5627
5661
  signal: c.signal,
5628
5662
  credentials: "same-origin"
5629
5663
  })).json();
5630
5664
  return {
5631
- results: (Array.isArray(g.results) ? g.results : []).map(Kd).filter((R) => R !== null),
5665
+ results: (Array.isArray(g.results) ? g.results : []).map(Yd).filter((R) => R !== null),
5632
5666
  next: typeof g.next == "string" && g.next ? g.next : null
5633
5667
  };
5634
5668
  },
@@ -5644,12 +5678,12 @@ function Gd(e) {
5644
5678
  }
5645
5679
  };
5646
5680
  }
5647
- function yg(e, t = ["image"]) {
5681
+ function bg(e, t = ["image"]) {
5648
5682
  if (!e) return [];
5649
5683
  const r = (i) => fs(i, t), n = e.files ? Array.from(e.files) : [];
5650
5684
  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);
5651
5685
  }
5652
- function vg(e, t = ["image"]) {
5686
+ function wg(e, t = ["image"]) {
5653
5687
  return e?.files ? Array.from(e.files).filter((r) => fs(r, t)) : [];
5654
5688
  }
5655
5689
  function fs(e, t) {
@@ -5657,7 +5691,7 @@ function fs(e, t) {
5657
5691
  const r = ds(e.type);
5658
5692
  return r !== null && t.includes(r);
5659
5693
  }
5660
- async function bg(e) {
5694
+ async function _g(e) {
5661
5695
  const t = globalThis.createImageBitmap;
5662
5696
  if (typeof t != "function") return null;
5663
5697
  try {
@@ -5668,27 +5702,27 @@ async function bg(e) {
5668
5702
  }
5669
5703
  }
5670
5704
  let Ir = null, hs = Yo;
5671
- function Yd(e) {
5705
+ function Jd(e) {
5672
5706
  e.cdnBase && (hs = e.cdnBase);
5673
5707
  }
5674
5708
  function ps() {
5675
5709
  return hs.replace(/\/+$/, "");
5676
5710
  }
5677
- function Xd() {
5711
+ function Qd() {
5678
5712
  const e = ps();
5679
- return (!Ir || Ir.base !== e) && (Ir = { base: e, client: Gd({ cdnBase: e }) }), Ir.client;
5713
+ return (!Ir || Ir.base !== e) && (Ir = { base: e, client: Xd({ cdnBase: e }) }), Ir.client;
5680
5714
  }
5681
- function wg(e) {
5682
- return !Jo(e) || !ps() ? null : Xd().urlFor(e);
5715
+ function Eg(e) {
5716
+ return !Jo(e) || !ps() ? null : Qd().urlFor(e);
5683
5717
  }
5684
- function Jd(e) {
5718
+ function Zd(e) {
5685
5719
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
5686
5720
  }
5687
- function Qd({ className: e }) {
5721
+ function ef({ className: e }) {
5688
5722
  return /* @__PURE__ */ N(
5689
5723
  "a",
5690
5724
  {
5691
- href: Jd(window.location),
5725
+ href: Zd(window.location),
5692
5726
  className: e,
5693
5727
  "data-testid": "sign-in-with-code",
5694
5728
  children: "Sign in with a code"
@@ -5701,17 +5735,17 @@ const rr = {
5701
5735
  cdnBase: Yo
5702
5736
  };
5703
5737
  let qr = { ...rr };
5704
- function Zd(e) {
5738
+ function tf(e) {
5705
5739
  const t = Object.fromEntries(
5706
5740
  Object.entries(e).filter(([r, n]) => n !== void 0)
5707
5741
  );
5708
- qr = { ...qr, ...t }, Yd({ cdnBase: qr.cdnBase });
5742
+ qr = { ...qr, ...t }, Jd({ cdnBase: qr.cdnBase });
5709
5743
  }
5710
5744
  function Tt() {
5711
5745
  return qr;
5712
5746
  }
5713
5747
  const ms = pl(rr);
5714
- function ef() {
5748
+ function rf() {
5715
5749
  return ml(ms);
5716
5750
  }
5717
5751
  function gs(e) {
@@ -5748,7 +5782,7 @@ function Ta(e, t) {
5748
5782
  return !1;
5749
5783
  }
5750
5784
  }
5751
- function tf() {
5785
+ function nf() {
5752
5786
  try {
5753
5787
  const e = mn();
5754
5788
  if (!e) return [];
@@ -5768,7 +5802,7 @@ function nn(e) {
5768
5802
  } catch {
5769
5803
  }
5770
5804
  }
5771
- function rf(e) {
5805
+ function af(e) {
5772
5806
  const t = je(e);
5773
5807
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
5774
5808
  }
@@ -5777,16 +5811,16 @@ let vs = !1;
5777
5811
  function gn(e, t) {
5778
5812
  ys.set(e, t), vs && bs(e, t);
5779
5813
  }
5780
- function nf() {
5814
+ function of() {
5781
5815
  vs = !0;
5782
5816
  for (const [e, t] of ys) bs(e, t);
5783
5817
  }
5784
5818
  function bs(e, t) {
5785
5819
  typeof window > "u" || (window[e] = t);
5786
5820
  }
5787
- const nr = [], af = 500;
5821
+ const nr = [], sf = 500;
5788
5822
  let Wr = [], Gn = null;
5789
- const of = 1e3, sf = 200;
5823
+ const lf = 1e3, cf = 200;
5790
5824
  let cr = null;
5791
5825
  function ws(e) {
5792
5826
  cr = e;
@@ -5800,13 +5834,13 @@ function Es() {
5800
5834
  const t = je(Ft.DEBUG_FLAG);
5801
5835
  return t !== null && t !== "false";
5802
5836
  }
5803
- function lf() {
5837
+ function uf() {
5804
5838
  const e = je(Ft.DEBUG_FLAG);
5805
5839
  if (!e || e === "true") return null;
5806
5840
  const t = e.split(",").map((r) => r.trim().toLowerCase()).filter(Boolean);
5807
5841
  return t.length > 0 ? new Set(t) : null;
5808
5842
  }
5809
- function cf() {
5843
+ function df() {
5810
5844
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
5811
5845
  hour12: !1,
5812
5846
  hour: "2-digit",
@@ -5815,8 +5849,8 @@ function cf() {
5815
5849
  fractionalSecondDigits: 3
5816
5850
  });
5817
5851
  }
5818
- function uf(e) {
5819
- nr.push(e), nr.length > af && nr.shift();
5852
+ function ff(e) {
5853
+ nr.push(e), nr.length > sf && nr.shift();
5820
5854
  }
5821
5855
  const Dn = {
5822
5856
  debug: "color: #64748b; font-weight: normal;",
@@ -5825,7 +5859,7 @@ const Dn = {
5825
5859
  category: "color: #3b82f6; font-weight: bold;",
5826
5860
  time: "color: #6b7280; font-weight: normal;"
5827
5861
  };
5828
- function df(e) {
5862
+ function hf(e) {
5829
5863
  try {
5830
5864
  return JSON.stringify(e);
5831
5865
  } catch {
@@ -5840,12 +5874,12 @@ function xa(e, t, r, n, a, i, o) {
5840
5874
  data: o,
5841
5875
  timestamp: Date.now()
5842
5876
  };
5843
- if (uf(s), (r || _s()) && Li(s), !n) {
5877
+ if (ff(s), (r || _s()) && Li(s), !n) {
5844
5878
  if (!Es()) return;
5845
- const d = lf();
5879
+ const d = uf();
5846
5880
  if (d && !d.has(a.toLowerCase())) return;
5847
5881
  }
5848
- const l = cf(), c = o !== void 0 ? " " + df(o) : "";
5882
+ const l = df(), c = o !== void 0 ? " " + hf(o) : "";
5849
5883
  t(
5850
5884
  `%c[${l}]%c [${a}]%c ${i}${c}`,
5851
5885
  Dn.time,
@@ -5862,25 +5896,25 @@ function ne(e, t, r) {
5862
5896
  function at(e, t, r) {
5863
5897
  xa("error", console.error, !0, !0, e, t, r);
5864
5898
  }
5865
- function ff() {
5899
+ function pf() {
5866
5900
  return [...nr];
5867
5901
  }
5868
- function hf() {
5902
+ function mf() {
5869
5903
  nr.length = 0;
5870
5904
  }
5871
- function pf(e) {
5905
+ function gf(e) {
5872
5906
  const t = e && e.length > 0 ? e.join(",") : "true";
5873
5907
  Ta(Ft.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
5874
5908
  }
5875
- function mf() {
5909
+ function yf() {
5876
5910
  nn(Ft.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
5877
5911
  }
5878
- const gf = 1024, yf = 5e4;
5912
+ const vf = 1024, bf = 5e4;
5879
5913
  function Ss(e) {
5880
5914
  if (e == null) return e;
5881
5915
  try {
5882
5916
  const t = JSON.stringify(e);
5883
- if (t.length <= gf) return e;
5917
+ if (t.length <= vf) return e;
5884
5918
  if (typeof e == "object" && !Array.isArray(e)) {
5885
5919
  const r = {};
5886
5920
  for (const [n, a] of Object.entries(e)) {
@@ -5894,7 +5928,7 @@ function Ss(e) {
5894
5928
  return "[unserializable]";
5895
5929
  }
5896
5930
  }
5897
- function _g(e, t, r, n) {
5931
+ function Sg(e, t, r, n) {
5898
5932
  try {
5899
5933
  console.warn(`[${t}] ${r}`, n ?? "");
5900
5934
  } catch {
@@ -5921,7 +5955,7 @@ function _g(e, t, r, n) {
5921
5955
  } catch {
5922
5956
  }
5923
5957
  }
5924
- async function vf() {
5958
+ async function wf() {
5925
5959
  if (Wr.length === 0) return;
5926
5960
  const e = Wr;
5927
5961
  Wr = [], Gn = null;
@@ -5945,7 +5979,7 @@ async function vf() {
5945
5979
  let i = [], o = 0;
5946
5980
  for (const s of a) {
5947
5981
  const l = JSON.stringify(s).length + 1;
5948
- o + l > yf && i.length > 0 && (await fetch(n, {
5982
+ o + l > bf && i.length > 0 && (await fetch(n, {
5949
5983
  method: "POST",
5950
5984
  headers: { "Content-Type": "application/json" },
5951
5985
  body: JSON.stringify({ logs: i })
@@ -5962,9 +5996,9 @@ async function vf() {
5962
5996
  }
5963
5997
  function Li(e) {
5964
5998
  if (Wr.push(e), !Gn) {
5965
- const t = _s() ? sf : of;
5999
+ const t = _s() ? cf : lf;
5966
6000
  Gn = setTimeout(() => {
5967
- vf();
6001
+ wf();
5968
6002
  }, t);
5969
6003
  }
5970
6004
  }
@@ -5972,10 +6006,10 @@ function Ue(e) {
5972
6006
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
5973
6007
  }
5974
6008
  gn("__wpDebug", {
5975
- enable: pf,
5976
- disable: mf,
5977
- history: ff,
5978
- clear: hf
6009
+ enable: gf,
6010
+ disable: yf,
6011
+ history: pf,
6012
+ clear: mf
5979
6013
  });
5980
6014
  function Rs(e) {
5981
6015
  return hn(e) ? md[e] : "var(--color-neutral-bg)";
@@ -5984,7 +6018,7 @@ function Ts(e) {
5984
6018
  return hn(e) ? `${Tt().serverOrigin.replace(/\/$/, "")}${yd(e)}` : void 0;
5985
6019
  }
5986
6020
  let ur = null, Lr = null;
5987
- function bf() {
6021
+ function _f() {
5988
6022
  return ur ? Promise.resolve() : Lr || (Lr = (async () => {
5989
6023
  try {
5990
6024
  const e = Tt().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
@@ -6003,14 +6037,14 @@ function St(e) {
6003
6037
  const t = e.toLowerCase();
6004
6038
  return Nt.some((r) => r === t) ? !0 : ur ? Object.values(ur).some((r) => r.toLowerCase() === t) : !1;
6005
6039
  }
6006
- function wf(e, t, r) {
6040
+ function Ef(e, t, r) {
6007
6041
  const n = !!e.name && !r(e.name) && (!t || r(t.name || "")), a = !!e.avatarId && (!t || t.avatarId !== e.avatarId);
6008
6042
  if (!n && !a)
6009
6043
  return null;
6010
6044
  const i = {};
6011
6045
  return n && (i.name = e.name), a && (i.avatarId = e.avatarId), i;
6012
6046
  }
6013
- const _f = [
6047
+ const Sf = [
6014
6048
  "sage",
6015
6049
  "herald",
6016
6050
  "cleric",
@@ -6035,20 +6069,20 @@ const _f = [
6035
6069
  "sunny",
6036
6070
  "mentor"
6037
6071
  ];
6038
- function xs(e, t, r = _f, n = Math.random) {
6072
+ function xs(e, t, r = Sf, n = Math.random) {
6039
6073
  const a = /* @__PURE__ */ new Set();
6040
6074
  for (const o of e)
6041
6075
  o && a.add(o);
6042
6076
  const i = r.filter((o) => !a.has(o));
6043
6077
  return i.length ? i[Math.floor(n() * i.length)] : void 0;
6044
6078
  }
6045
- const Ef = {
6079
+ const Rf = {
6046
6080
  /** client → server, with an ack. Payload: `RoomWatch`. */
6047
6081
  watch: "room-feed:watch",
6048
6082
  /** server → client. Payload: `RoomChanged`. */
6049
6083
  changed: "room-feed:changed"
6050
6084
  };
6051
- function Sf(e) {
6085
+ function Tf(e) {
6052
6086
  if (typeof e != "object" || e === null || Array.isArray(e))
6053
6087
  return null;
6054
6088
  const t = e;
@@ -6062,11 +6096,11 @@ function Sf(e) {
6062
6096
  }
6063
6097
  return null;
6064
6098
  }
6065
- const Rf = 1280;
6066
- function Tf(e) {
6067
- return e.screenWidth < Rf ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
6099
+ const xf = 1280;
6100
+ function Cf(e) {
6101
+ return e.screenWidth < xf ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
6068
6102
  }
6069
- function xf() {
6103
+ function kf() {
6070
6104
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
6071
6105
  return {
6072
6106
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -6077,13 +6111,13 @@ function xf() {
6077
6111
  }
6078
6112
  let Yn = !1, Oi = null;
6079
6113
  const Xn = /* @__PURE__ */ new Set();
6080
- function Cf() {
6081
- return Oi ??= Tf(xf()), Oi;
6114
+ function Af() {
6115
+ return Oi ??= Cf(kf()), Oi;
6082
6116
  }
6083
6117
  function $t() {
6084
- return Yn || Cf();
6118
+ return Yn || Af();
6085
6119
  }
6086
- function kf(e) {
6120
+ function Pf(e) {
6087
6121
  const t = e === !0;
6088
6122
  if (t === Yn) return;
6089
6123
  const r = $t();
@@ -6106,13 +6140,13 @@ const ye = {
6106
6140
  function yn() {
6107
6141
  return ye.accountId ? ye.accountId : ye.resolved && ye.userType === "public" ? "anon" : null;
6108
6142
  }
6109
- function Af(e) {
6143
+ function Mf(e) {
6110
6144
  ye.resolved = !0, e.userType && (ye.userType = e.userType), e.userId !== void 0 && (ye.accountId = e.userId && e.userId !== "public" ? e.userId : null);
6111
6145
  }
6112
6146
  function Di() {
6113
6147
  return ye.userType;
6114
6148
  }
6115
- function Pf() {
6149
+ function If() {
6116
6150
  return ye.resolved && ye.userType === "public";
6117
6151
  }
6118
6152
  const Ni = {
@@ -6123,19 +6157,19 @@ const Ni = {
6123
6157
  wife: 4,
6124
6158
  admin: 5
6125
6159
  };
6126
- function Mf(e, t) {
6160
+ function Lf(e, t) {
6127
6161
  return (Ni[e] ?? -1) >= Ni[t];
6128
6162
  }
6129
- function Eg() {
6130
- return Mf(ye.userType, "service");
6163
+ function Rg() {
6164
+ return Lf(ye.userType, "service");
6131
6165
  }
6132
6166
  function vn() {
6133
6167
  return ye.accountId ?? "public";
6134
6168
  }
6135
- function If() {
6169
+ function Of() {
6136
6170
  return yn() ?? "unscoped";
6137
6171
  }
6138
- async function Lf() {
6172
+ async function Df() {
6139
6173
  if (ye.name) return ye.name;
6140
6174
  try {
6141
6175
  const e = await fetch("/session/whoami", {
@@ -6145,7 +6179,7 @@ async function Lf() {
6145
6179
  if (!e.ok || !(e.headers.get("content-type") ?? "").includes("json"))
6146
6180
  return x("auth", "whoami unavailable", { status: e.status }), null;
6147
6181
  const t = await e.json();
6148
- if (kf(t.tv), ye.userType === "public") return null;
6182
+ if (Pf(t.tv), ye.userType === "public") return null;
6149
6183
  if (t.valid && (ye.accountId = typeof t.userId == "string" && t.userId ? t.userId : null), t.valid && typeof t.name == "string")
6150
6184
  return ye.name = t.name, t.name;
6151
6185
  } catch (e) {
@@ -6153,7 +6187,7 @@ async function Lf() {
6153
6187
  }
6154
6188
  return null;
6155
6189
  }
6156
- const Of = u.object({
6190
+ const Nf = u.object({
6157
6191
  // Identity. There is deliberately NO `name`: a person's name is their
6158
6192
  // hadoku key-registry name, resolved by the server from whoami and renamed
6159
6193
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -6180,13 +6214,13 @@ const Of = u.object({
6180
6214
  subtitleStyle: u.string().optional()
6181
6215
  }), ar = El({
6182
6216
  appId: "watchparty",
6183
- schema: Of
6184
- }), Df = /* @__PURE__ */ new Set(["theme", "themeMode"]);
6217
+ schema: Nf
6218
+ }), $f = /* @__PURE__ */ new Set(["theme", "themeMode"]);
6185
6219
  function an(e) {
6186
6220
  const t = yn();
6187
6221
  return t ? `prefs-cache:${t}:${e}` : null;
6188
6222
  }
6189
- function Nf() {
6223
+ function Ff() {
6190
6224
  return yn() === null;
6191
6225
  }
6192
6226
  function $i(e) {
@@ -6200,9 +6234,9 @@ function $i(e) {
6200
6234
  return {};
6201
6235
  }
6202
6236
  }
6203
- function $f() {
6237
+ function Uf() {
6204
6238
  let e = 0;
6205
- for (const t of tf()) {
6239
+ for (const t of nf()) {
6206
6240
  const r = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), n = t === on || t.startsWith(`${on}:`) && !t.endsWith(":_serverSynced_v1");
6207
6241
  if (!r && !n) continue;
6208
6242
  const a = je(t);
@@ -6223,7 +6257,7 @@ function $f() {
6223
6257
  let As = null, Ps = null;
6224
6258
  const Fi = /* @__PURE__ */ new Set();
6225
6259
  function Ca() {
6226
- if (Nf())
6260
+ if (Ff())
6227
6261
  return x("preferences", "Boot read deferred — session pending, identity unresolved"), {};
6228
6262
  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";
6229
6263
  if (Fi.has(a))
@@ -6248,15 +6282,15 @@ function Ca() {
6248
6282
  }), o;
6249
6283
  }
6250
6284
  let Ms = !1;
6251
- function Ff() {
6285
+ function Bf() {
6252
6286
  const e = vn();
6253
6287
  return !e || e === "public";
6254
6288
  }
6255
6289
  function Ze(e, t) {
6256
- Ff() && (Ms = !0), Df.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 });
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 });
6257
6291
  }
6258
6292
  let Or = null, Ui = !1;
6259
- function Uf() {
6293
+ function jf() {
6260
6294
  return Or || (Or = (async () => {
6261
6295
  if (typeof window > "u") return !1;
6262
6296
  try {
@@ -6282,7 +6316,7 @@ function Uf() {
6282
6316
  // Post-fetch cache state: should be non-zero if SDK wrote it.
6283
6317
  sdkThemeBytesPost: a?.length ?? 0,
6284
6318
  sdkAppBytesPost: i?.length ?? 0
6285
- }), await Bf(e, t), Ms ? (x("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
6319
+ }), await zf(e, t), Ms ? (x("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
6286
6320
  Zt.promoteAnonPrefsToUser().catch(() => {
6287
6321
  }),
6288
6322
  ar.promoteAnonPrefsToUser().catch(() => {
@@ -6294,7 +6328,7 @@ function Uf() {
6294
6328
  })(), Or);
6295
6329
  }
6296
6330
  const on = "watchparty_preferences";
6297
- $f();
6331
+ Uf();
6298
6332
  function Jn() {
6299
6333
  const e = vn();
6300
6334
  return !e || e === "public" ? on : `${on}:${e}`;
@@ -6312,7 +6346,7 @@ function Is() {
6312
6346
  function Bi() {
6313
6347
  nn(Jn()), nn(`${Jn()}:_serverSynced_v1`);
6314
6348
  }
6315
- async function Bf(e, t) {
6349
+ async function zf(e, t) {
6316
6350
  const r = Is();
6317
6351
  if (!r || Object.keys(r).length === 0) return;
6318
6352
  const n = Object.keys(e ?? {}).length > 0, a = Object.keys(t ?? {}).length > 0, i = {}, o = {};
@@ -6369,10 +6403,10 @@ function Hi(e) {
6369
6403
  }
6370
6404
  }).catch((t) => ne("preferences", "store import failed", { reason: e, err: t?.message }));
6371
6405
  }
6372
- const Ls = 320, Vi = 240, jf = 640;
6406
+ const Ls = 320, Vi = 240, Hf = 640;
6373
6407
  function Nn(e, t) {
6374
6408
  if (!Number.isFinite(e)) return Ls;
6375
- let r = jf;
6409
+ let r = Hf;
6376
6410
  return r = Math.max(r, Vi), Math.round(Math.min(r, Math.max(Vi, e)));
6377
6411
  }
6378
6412
  function Os(e, t) {
@@ -6610,7 +6644,7 @@ const Ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6610
6644
  mergeHistory: Os,
6611
6645
  useAppStore: U
6612
6646
  }, Symbol.toStringTag, { value: "Module" }));
6613
- function zf({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
6647
+ function Vf({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
6614
6648
  const t = U((n) => n.toasts), r = U((n) => n.popToast);
6615
6649
  return nt(() => {
6616
6650
  const n = t.map((a) => setTimeout(() => r(a.id), 4e3));
@@ -6619,14 +6653,14 @@ function zf({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
6619
6653
  };
6620
6654
  }, [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)) });
6621
6655
  }
6622
- function Hf() {
6656
+ function qf() {
6623
6657
  try {
6624
6658
  return typeof document > "u" ? !0 : !document.hidden;
6625
6659
  } catch {
6626
6660
  return !0;
6627
6661
  }
6628
6662
  }
6629
- function Vf(e) {
6663
+ function Wf(e) {
6630
6664
  if (typeof document > "u" || typeof document.addEventListener != "function")
6631
6665
  return () => {
6632
6666
  };
@@ -6635,9 +6669,9 @@ function Vf(e) {
6635
6669
  };
6636
6670
  return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
6637
6671
  }
6638
- const qf = 3e4;
6639
- function Wf(e, t) {
6640
- const r = t.isVisible ?? Hf, n = t.setInterval ?? ((_, R) => setInterval(_, R)), a = t.clearInterval ?? ((_) => clearInterval(_));
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(_));
6641
6675
  let i = { list: null, loading: !0, error: null };
6642
6676
  const o = /* @__PURE__ */ new Set();
6643
6677
  let s = null, l = !1;
@@ -6662,9 +6696,9 @@ function Wf(e, t) {
6662
6696
  d();
6663
6697
  const h = t.pings.subscribe(e, () => {
6664
6698
  r() && d();
6665
- }), y = (t.onVisible ?? Vf)(() => d()), g = n(() => {
6699
+ }), y = (t.onVisible ?? Wf)(() => d()), g = n(() => {
6666
6700
  r() && d();
6667
- }, t.fallbackMs ?? qf);
6701
+ }, t.fallbackMs ?? Kf);
6668
6702
  return {
6669
6703
  getState() {
6670
6704
  return i;
@@ -6678,21 +6712,21 @@ function Wf(e, t) {
6678
6712
  }
6679
6713
  };
6680
6714
  }
6681
- function Kf(e) {
6715
+ function Yf(e) {
6682
6716
  return "list";
6683
6717
  }
6684
- const Gf = { list: null, loading: !0, error: null };
6685
- function Yf() {
6718
+ const Xf = { list: null, loading: !0, error: null };
6719
+ function Jf() {
6686
6720
  return () => {
6687
6721
  };
6688
6722
  }
6689
- function Xf(e, t) {
6690
- const r = Kf(), n = _t(t);
6723
+ function Qf(e, t) {
6724
+ const r = Yf(), n = _t(t);
6691
6725
  n.current = t;
6692
6726
  const a = _t(null);
6693
6727
  (a.current === null || a.current.key !== r) && (a.current?.client.close(), a.current = {
6694
6728
  key: r,
6695
- client: Wf(e, {
6729
+ client: Gf(e, {
6696
6730
  pings: n.current.pings,
6697
6731
  fetchList: (l) => n.current.fetchList(l),
6698
6732
  fallbackMs: n.current.fallbackMs,
@@ -6707,9 +6741,9 @@ function Xf(e, t) {
6707
6741
  o.current = setTimeout(() => {
6708
6742
  o.current = null, a.current?.client === i && i.close();
6709
6743
  }, 0);
6710
- }), [i]), { ...ln(i ? i.subscribe : Yf, () => i ? i.getState() : Gf), refresh: () => i.refresh() };
6744
+ }), [i]), { ...ln(i ? i.subscribe : Jf, () => i ? i.getState() : Xf), refresh: () => i.refresh() };
6711
6745
  }
6712
- const Jf = 400;
6746
+ const Zf = 400;
6713
6747
  function Ns() {
6714
6748
  const e = _t(null), t = _t([]);
6715
6749
  return nt(() => {
@@ -6792,7 +6826,7 @@ function Ns() {
6792
6826
  };
6793
6827
  }
6794
6828
  if (!t.current.length)
6795
- for (let b = 0; b < Jf; b++) t.current.push(l(void 0, void 0, !0, b));
6829
+ for (let b = 0; b < Zf; b++) t.current.push(l(void 0, void 0, !0, b));
6796
6830
  let c, d = performance.now();
6797
6831
  const h = 50;
6798
6832
  function y(b, C, E, A) {
@@ -6933,7 +6967,7 @@ function Wi(e) {
6933
6967
  return e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
6934
6968
  }
6935
6969
  let $n;
6936
- function Qf(e, t) {
6970
+ function eh(e, t) {
6937
6971
  if ($s && e.data instanceof Blob)
6938
6972
  return e.data.arrayBuffer().then(Wi).then(t);
6939
6973
  if (Fs && (e.data instanceof ArrayBuffer || Us(e.data)))
@@ -6945,14 +6979,14 @@ function Qf(e, t) {
6945
6979
  const Ki = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Jt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
6946
6980
  for (let e = 0; e < Ki.length; e++)
6947
6981
  Jt[Ki.charCodeAt(e)] = e;
6948
- const Zf = (e) => {
6982
+ const th = (e) => {
6949
6983
  let t = e.length * 0.75, r = e.length, n, a = 0, i, o, s, l;
6950
6984
  e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
6951
6985
  const c = new ArrayBuffer(t), d = new Uint8Array(c);
6952
6986
  for (n = 0; n < r; n += 4)
6953
6987
  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;
6954
6988
  return c;
6955
- }, eh = typeof ArrayBuffer == "function", Aa = (e, t) => {
6989
+ }, rh = typeof ArrayBuffer == "function", Aa = (e, t) => {
6956
6990
  if (typeof e != "string")
6957
6991
  return {
6958
6992
  type: "message",
@@ -6961,20 +6995,20 @@ const Zf = (e) => {
6961
6995
  const r = e.charAt(0);
6962
6996
  return r === "b" ? {
6963
6997
  type: "message",
6964
- data: th(e.substring(1), t)
6998
+ data: nh(e.substring(1), t)
6965
6999
  } : Kr[r] ? e.length > 1 ? {
6966
7000
  type: Kr[r],
6967
7001
  data: e.substring(1)
6968
7002
  } : {
6969
7003
  type: Kr[r]
6970
7004
  } : Qn;
6971
- }, th = (e, t) => {
6972
- if (eh) {
6973
- const r = Zf(e);
7005
+ }, nh = (e, t) => {
7006
+ if (rh) {
7007
+ const r = th(e);
6974
7008
  return Bs(r, t);
6975
7009
  } else
6976
7010
  return { base64: !0, data: e };
6977
- }, Bs = (e, t) => t === "blob" ? e instanceof Blob ? e : new Blob([e]) : e instanceof ArrayBuffer ? e : e.buffer, js = "", rh = (e, t) => {
7011
+ }, Bs = (e, t) => t === "blob" ? e instanceof Blob ? e : new Blob([e]) : e instanceof ArrayBuffer ? e : e.buffer, js = "", ah = (e, t) => {
6978
7012
  const r = e.length, n = new Array(r);
6979
7013
  let a = 0;
6980
7014
  e.forEach((i, o) => {
@@ -6982,7 +7016,7 @@ const Zf = (e) => {
6982
7016
  n[o] = s, ++a === r && t(n.join(js));
6983
7017
  });
6984
7018
  });
6985
- }, nh = (e, t) => {
7019
+ }, ih = (e, t) => {
6986
7020
  const r = e.split(js), n = [];
6987
7021
  for (let a = 0; a < r.length; a++) {
6988
7022
  const i = Aa(r[a], t);
@@ -6991,10 +7025,10 @@ const Zf = (e) => {
6991
7025
  }
6992
7026
  return n;
6993
7027
  };
6994
- function ah() {
7028
+ function oh() {
6995
7029
  return new TransformStream({
6996
7030
  transform(e, t) {
6997
- Qf(e, (r) => {
7031
+ eh(e, (r) => {
6998
7032
  const n = r.length;
6999
7033
  let a;
7000
7034
  if (n < 126)
@@ -7026,7 +7060,7 @@ function Nr(e, t) {
7026
7060
  r[a] = e[0][n++], n === e[0].length && (e.shift(), n = 0);
7027
7061
  return e.length && n < e[0].length && (e[0] = e[0].slice(n)), r;
7028
7062
  }
7029
- function ih(e, t) {
7063
+ function sh(e, t) {
7030
7064
  Fn || (Fn = new TextDecoder());
7031
7065
  const r = [];
7032
7066
  let n = 0, a = -1, i = !1;
@@ -7068,9 +7102,9 @@ function ih(e, t) {
7068
7102
  }
7069
7103
  const zs = 4;
7070
7104
  function de(e) {
7071
- if (e) return oh(e);
7105
+ if (e) return lh(e);
7072
7106
  }
7073
- function oh(e) {
7107
+ function lh(e) {
7074
7108
  for (var t in de.prototype)
7075
7109
  e[t] = de.prototype[t];
7076
7110
  return e;
@@ -7116,19 +7150,19 @@ de.prototype.listeners = function(e) {
7116
7150
  de.prototype.hasListeners = function(e) {
7117
7151
  return !!this.listeners(e).length;
7118
7152
  };
7119
- 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")(), sh = "arraybuffer";
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";
7120
7154
  function Hs(e, ...t) {
7121
7155
  return t.reduce((r, n) => (e.hasOwnProperty(n) && (r[n] = e[n]), r), {});
7122
7156
  }
7123
- const lh = Le.setTimeout, ch = Le.clearTimeout;
7157
+ const uh = Le.setTimeout, dh = Le.clearTimeout;
7124
7158
  function wn(e, t) {
7125
- t.useNativeTimers ? (e.setTimeoutFn = lh.bind(Le), e.clearTimeoutFn = ch.bind(Le)) : (e.setTimeoutFn = Le.setTimeout.bind(Le), e.clearTimeoutFn = Le.clearTimeout.bind(Le));
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));
7126
7160
  }
7127
- const uh = 1.33;
7128
- function dh(e) {
7129
- return typeof e == "string" ? fh(e) : Math.ceil((e.byteLength || e.size) * uh);
7161
+ const fh = 1.33;
7162
+ function hh(e) {
7163
+ return typeof e == "string" ? ph(e) : Math.ceil((e.byteLength || e.size) * fh);
7130
7164
  }
7131
- function fh(e) {
7165
+ function ph(e) {
7132
7166
  let t = 0, r = 0;
7133
7167
  for (let n = 0, a = e.length; n < a; n++)
7134
7168
  t = e.charCodeAt(n), t < 128 ? r += 1 : t < 2048 ? r += 2 : t < 55296 || t >= 57344 ? r += 3 : (n++, r += 4);
@@ -7137,13 +7171,13 @@ function fh(e) {
7137
7171
  function Vs() {
7138
7172
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
7139
7173
  }
7140
- function hh(e) {
7174
+ function mh(e) {
7141
7175
  let t = "";
7142
7176
  for (let r in e)
7143
7177
  e.hasOwnProperty(r) && (t.length && (t += "&"), t += encodeURIComponent(r) + "=" + encodeURIComponent(e[r]));
7144
7178
  return t;
7145
7179
  }
7146
- function ph(e) {
7180
+ function gh(e) {
7147
7181
  let t = {}, r = e.split("&");
7148
7182
  for (let n = 0, a = r.length; n < a; n++) {
7149
7183
  let i = r[n].split("=");
@@ -7151,7 +7185,7 @@ function ph(e) {
7151
7185
  }
7152
7186
  return t;
7153
7187
  }
7154
- class mh extends Error {
7188
+ class yh extends Error {
7155
7189
  constructor(t, r, n) {
7156
7190
  super(t), this.description = r, this.context = n, this.type = "TransportError";
7157
7191
  }
@@ -7176,7 +7210,7 @@ class Pa extends de {
7176
7210
  * @protected
7177
7211
  */
7178
7212
  onError(t, r, n) {
7179
- return super.emitReserved("error", new mh(t, r, n)), this;
7213
+ return super.emitReserved("error", new yh(t, r, n)), this;
7180
7214
  }
7181
7215
  /**
7182
7216
  * Opens the transport.
@@ -7250,11 +7284,11 @@ class Pa extends de {
7250
7284
  return this.opts.port && (this.opts.secure && +(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
7251
7285
  }
7252
7286
  _query(t) {
7253
- const r = hh(t);
7287
+ const r = mh(t);
7254
7288
  return r.length ? "?" + r : "";
7255
7289
  }
7256
7290
  }
7257
- class gh extends Pa {
7291
+ class vh extends Pa {
7258
7292
  constructor() {
7259
7293
  super(...arguments), this._polling = !1;
7260
7294
  }
@@ -7310,7 +7344,7 @@ class gh extends Pa {
7310
7344
  return this.onClose({ description: "transport closed by the server" }), !1;
7311
7345
  this.onPacket(n);
7312
7346
  };
7313
- nh(t, this.socket.binaryType).forEach(r), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
7347
+ ih(t, this.socket.binaryType).forEach(r), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
7314
7348
  }
7315
7349
  /**
7316
7350
  * For polling, send a close packet.
@@ -7330,7 +7364,7 @@ class gh extends Pa {
7330
7364
  * @protected
7331
7365
  */
7332
7366
  write(t) {
7333
- this.writable = !1, rh(t, (r) => {
7367
+ this.writable = !1, ah(t, (r) => {
7334
7368
  this.doWrite(r, () => {
7335
7369
  this.writable = !0, this.emitReserved("drain");
7336
7370
  });
@@ -7351,10 +7385,10 @@ try {
7351
7385
  qs = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
7352
7386
  } catch {
7353
7387
  }
7354
- const yh = qs;
7355
- function vh() {
7388
+ const bh = qs;
7389
+ function wh() {
7356
7390
  }
7357
- class bh extends gh {
7391
+ class _h extends vh {
7358
7392
  /**
7359
7393
  * XHR Polling constructor.
7360
7394
  *
@@ -7467,7 +7501,7 @@ let It = class Gr extends de {
7467
7501
  */
7468
7502
  _cleanup(t) {
7469
7503
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
7470
- if (this._xhr.onreadystatechange = vh, t)
7504
+ if (this._xhr.onreadystatechange = wh, t)
7471
7505
  try {
7472
7506
  this._xhr.abort();
7473
7507
  } catch {
@@ -7507,17 +7541,17 @@ function Gi() {
7507
7541
  for (let e in It.requests)
7508
7542
  It.requests.hasOwnProperty(e) && It.requests[e].abort();
7509
7543
  }
7510
- const wh = (function() {
7544
+ const Eh = (function() {
7511
7545
  const e = Ws({
7512
7546
  xdomain: !1
7513
7547
  });
7514
7548
  return e && e.responseType !== null;
7515
7549
  })();
7516
- class _h extends bh {
7550
+ class Sh extends _h {
7517
7551
  constructor(t) {
7518
7552
  super(t);
7519
7553
  const r = t && t.forceBase64;
7520
- this.supportsBinary = wh && !r;
7554
+ this.supportsBinary = Eh && !r;
7521
7555
  }
7522
7556
  request(t = {}) {
7523
7557
  return Object.assign(t, { xd: this.xd }, this.opts), new It(Ws, this.uri(), t);
@@ -7526,7 +7560,7 @@ class _h extends bh {
7526
7560
  function Ws(e) {
7527
7561
  const t = e.xdomain;
7528
7562
  try {
7529
- if (typeof XMLHttpRequest < "u" && (!t || yh))
7563
+ if (typeof XMLHttpRequest < "u" && (!t || bh))
7530
7564
  return new XMLHttpRequest();
7531
7565
  } catch {
7532
7566
  }
@@ -7537,7 +7571,7 @@ function Ws(e) {
7537
7571
  }
7538
7572
  }
7539
7573
  const Ks = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
7540
- class Eh extends Pa {
7574
+ class Rh extends Pa {
7541
7575
  get name() {
7542
7576
  return "websocket";
7543
7577
  }
@@ -7594,7 +7628,7 @@ class Eh extends Pa {
7594
7628
  }
7595
7629
  }
7596
7630
  const Un = Le.WebSocket || Le.MozWebSocket;
7597
- class Sh extends Eh {
7631
+ class Th extends Rh {
7598
7632
  createSocket(t, r, n) {
7599
7633
  return Ks ? new Un(t, r, n) : r ? new Un(t, r) : new Un(t);
7600
7634
  }
@@ -7602,7 +7636,7 @@ class Sh extends Eh {
7602
7636
  this.ws.send(r);
7603
7637
  }
7604
7638
  }
7605
- class Rh extends Pa {
7639
+ class xh extends Pa {
7606
7640
  get name() {
7607
7641
  return "webtransport";
7608
7642
  }
@@ -7618,7 +7652,7 @@ class Rh extends Pa {
7618
7652
  this.onError("webtransport error", t);
7619
7653
  }), this._transport.ready.then(() => {
7620
7654
  this._transport.createBidirectionalStream().then((t) => {
7621
- const r = ih(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = t.readable.pipeThrough(r).getReader(), a = ah();
7655
+ const r = sh(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = t.readable.pipeThrough(r).getReader(), a = oh();
7622
7656
  a.readable.pipeTo(t.writable), this._writer = a.writable.getWriter();
7623
7657
  const i = () => {
7624
7658
  n.read().then(({ done: s, value: l }) => {
@@ -7648,11 +7682,11 @@ class Rh extends Pa {
7648
7682
  (t = this._transport) === null || t === void 0 || t.close();
7649
7683
  }
7650
7684
  }
7651
- const Th = {
7652
- websocket: Sh,
7653
- webtransport: Rh,
7654
- polling: _h
7655
- }, xh = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Ch = [
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 = [
7656
7690
  "source",
7657
7691
  "protocol",
7658
7692
  "authority",
@@ -7673,16 +7707,16 @@ function Zn(e) {
7673
7707
  throw "URI too long";
7674
7708
  const t = e, r = e.indexOf("["), n = e.indexOf("]");
7675
7709
  r != -1 && n != -1 && (e = e.substring(0, r) + e.substring(r, n).replace(/:/g, ";") + e.substring(n, e.length));
7676
- let a = xh.exec(e || ""), i = {}, o = 14;
7710
+ let a = kh.exec(e || ""), i = {}, o = 14;
7677
7711
  for (; o--; )
7678
- i[Ch[o]] = a[o] || "";
7679
- 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 = kh(i, i.path), i.queryKey = Ah(i, i.query), i;
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;
7680
7714
  }
7681
- function kh(e, t) {
7715
+ function Ph(e, t) {
7682
7716
  const r = /\/{2,9}/g, n = t.replace(r, "/").split("/");
7683
7717
  return (t.slice(0, 1) == "/" || t.length === 0) && n.splice(0, 1), t.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
7684
7718
  }
7685
- function Ah(e, t) {
7719
+ function Mh(e, t) {
7686
7720
  const r = {};
7687
7721
  return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, a, i) {
7688
7722
  a && (r[a] = i);
@@ -7700,7 +7734,7 @@ class ft extends de {
7700
7734
  * @param {Object} opts - options
7701
7735
  */
7702
7736
  constructor(t, r) {
7703
- if (super(), this.binaryType = sh, 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) {
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) {
7704
7738
  const n = Zn(t);
7705
7739
  r.hostname = n.host, r.secure = n.protocol === "https" || n.protocol === "wss", r.port = n.port, n.query && (r.query = n.query);
7706
7740
  } else r.host && (r.hostname = Zn(r.host).host);
@@ -7721,7 +7755,7 @@ class ft extends de {
7721
7755
  },
7722
7756
  transportOptions: {},
7723
7757
  closeOnBeforeunload: !1
7724
- }, r), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = ph(this.opts.query)), ea && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
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 = () => {
7725
7759
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
7726
7760
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
7727
7761
  this._onClose("transport close", {
@@ -7856,7 +7890,7 @@ class ft extends de {
7856
7890
  let r = 1;
7857
7891
  for (let n = 0; n < this.writeBuffer.length; n++) {
7858
7892
  const a = this.writeBuffer[n].data;
7859
- if (a && (r += dh(a)), n > 0 && r > this._maxPayload)
7893
+ if (a && (r += hh(a)), n > 0 && r > this._maxPayload)
7860
7894
  return this.writeBuffer.slice(0, n);
7861
7895
  r += 2;
7862
7896
  }
@@ -7963,7 +7997,7 @@ class ft extends de {
7963
7997
  }
7964
7998
  }
7965
7999
  ft.protocol = zs;
7966
- class Ph extends ft {
8000
+ class Ih extends ft {
7967
8001
  constructor() {
7968
8002
  super(...arguments), this._upgrades = [];
7969
8003
  }
@@ -8035,21 +8069,21 @@ class Ph extends ft {
8035
8069
  return r;
8036
8070
  }
8037
8071
  }
8038
- let Mh = class extends Ph {
8072
+ let Lh = class extends Ih {
8039
8073
  constructor(t, r = {}) {
8040
8074
  const n = typeof t == "object" ? t : r;
8041
- (!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((a) => Th[a]).filter((a) => !!a)), super(t, n);
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);
8042
8076
  }
8043
8077
  };
8044
- function Ih(e, t = "", r) {
8078
+ function Oh(e, t = "", r) {
8045
8079
  let n = e;
8046
8080
  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 || "/";
8047
8081
  const i = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
8048
8082
  return n.id = n.protocol + "://" + i + ":" + n.port + t, n.href = n.protocol + "://" + i + (r && r.port === n.port ? "" : ":" + n.port), n;
8049
8083
  }
8050
- const Lh = typeof ArrayBuffer == "function", Oh = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, Gs = Object.prototype.toString, Dh = typeof Blob == "function" || typeof Blob < "u" && Gs.call(Blob) === "[object BlobConstructor]", Nh = typeof File == "function" || typeof File < "u" && Gs.call(File) === "[object FileConstructor]";
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]";
8051
8085
  function Ma(e) {
8052
- return Lh && (e instanceof ArrayBuffer || Oh(e)) || Dh && e instanceof Blob || Nh && e instanceof File;
8086
+ return Dh && (e instanceof ArrayBuffer || Nh(e)) || $h && e instanceof Blob || Fh && e instanceof File;
8053
8087
  }
8054
8088
  function Xr(e, t) {
8055
8089
  if (!e || typeof e != "object")
@@ -8069,7 +8103,7 @@ function Xr(e, t) {
8069
8103
  return !0;
8070
8104
  return !1;
8071
8105
  }
8072
- function $h(e) {
8106
+ function Uh(e) {
8073
8107
  const t = [], r = e.data, n = e;
8074
8108
  return n.data = ta(r, t), n.attachments = t.length, { packet: n, buffers: t };
8075
8109
  }
@@ -8092,7 +8126,7 @@ function ta(e, t) {
8092
8126
  }
8093
8127
  return e;
8094
8128
  }
8095
- function Fh(e, t) {
8129
+ function Bh(e, t) {
8096
8130
  return e.data = ra(e.data, t), delete e.attachments, e;
8097
8131
  }
8098
8132
  function ra(e, t) {
@@ -8110,7 +8144,7 @@ function ra(e, t) {
8110
8144
  Object.prototype.hasOwnProperty.call(e, r) && (e[r] = ra(e[r], t));
8111
8145
  return e;
8112
8146
  }
8113
- const Uh = [
8147
+ const jh = [
8114
8148
  "connect",
8115
8149
  "connect_error",
8116
8150
  "disconnect",
@@ -8118,12 +8152,12 @@ const Uh = [
8118
8152
  "newListener",
8119
8153
  "removeListener"
8120
8154
  // used by the Node.js EventEmitter
8121
- ], Bh = 5;
8155
+ ], zh = 5;
8122
8156
  var X;
8123
8157
  (function(e) {
8124
8158
  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";
8125
8159
  })(X || (X = {}));
8126
- class jh {
8160
+ class Hh {
8127
8161
  /**
8128
8162
  * Encoder constructor
8129
8163
  *
@@ -8159,7 +8193,7 @@ class jh {
8159
8193
  * a list of buffers.
8160
8194
  */
8161
8195
  encodeAsBinary(t) {
8162
- const r = $h(t), n = this.encodeAsString(r.packet), a = r.buffers;
8196
+ const r = Uh(t), n = this.encodeAsString(r.packet), a = r.buffers;
8163
8197
  return a.unshift(n), a;
8164
8198
  }
8165
8199
  }
@@ -8187,7 +8221,7 @@ class Ia extends de {
8187
8221
  throw new Error("got plaintext data when reconstructing a packet");
8188
8222
  r = this.decodeString(t);
8189
8223
  const n = r.type === X.BINARY_EVENT;
8190
- n || r.type === X.BINARY_ACK ? (r.type = n ? X.EVENT : X.ACK, this.reconstructor = new zh(r), r.attachments === 0 && super.emitReserved("decoded", r)) : super.emitReserved("decoded", r);
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);
8191
8225
  } else if (Ma(t) || t.base64)
8192
8226
  if (this.reconstructor)
8193
8227
  r = this.reconstructor.takeBinaryData(t), r && (this.reconstructor = null, super.emitReserved("decoded", r));
@@ -8265,7 +8299,7 @@ class Ia extends de {
8265
8299
  return typeof r == "string" || Yi(r);
8266
8300
  case X.EVENT:
8267
8301
  case X.BINARY_EVENT:
8268
- return Array.isArray(r) && (typeof r[0] == "number" || typeof r[0] == "string" && Uh.indexOf(r[0]) === -1);
8302
+ return Array.isArray(r) && (typeof r[0] == "number" || typeof r[0] == "string" && jh.indexOf(r[0]) === -1);
8269
8303
  case X.ACK:
8270
8304
  case X.BINARY_ACK:
8271
8305
  return Array.isArray(r);
@@ -8278,7 +8312,7 @@ class Ia extends de {
8278
8312
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
8279
8313
  }
8280
8314
  }
8281
- class zh {
8315
+ class Vh {
8282
8316
  constructor(t) {
8283
8317
  this.packet = t, this.buffers = [], this.reconPack = t;
8284
8318
  }
@@ -8292,7 +8326,7 @@ class zh {
8292
8326
  */
8293
8327
  takeBinaryData(t) {
8294
8328
  if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
8295
- const r = Fh(this.reconPack, this.buffers);
8329
+ const r = Bh(this.reconPack, this.buffers);
8296
8330
  return this.finishedReconstruction(), r;
8297
8331
  }
8298
8332
  return null;
@@ -8304,21 +8338,21 @@ class zh {
8304
8338
  this.reconPack = null, this.buffers = [];
8305
8339
  }
8306
8340
  }
8307
- const Hh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8341
+ const qh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8308
8342
  __proto__: null,
8309
8343
  Decoder: Ia,
8310
- Encoder: jh,
8344
+ Encoder: Hh,
8311
8345
  get PacketType() {
8312
8346
  return X;
8313
8347
  },
8314
- protocol: Bh
8348
+ protocol: zh
8315
8349
  }, Symbol.toStringTag, { value: "Module" }));
8316
8350
  function Ne(e, t, r) {
8317
8351
  return e.on(t, r), function() {
8318
8352
  e.off(t, r);
8319
8353
  };
8320
8354
  }
8321
- const Vh = Object.freeze({
8355
+ const Wh = Object.freeze({
8322
8356
  connect: 1,
8323
8357
  connect_error: 1,
8324
8358
  disconnect: 1,
@@ -8443,7 +8477,7 @@ class Ys extends de {
8443
8477
  */
8444
8478
  emit(t, ...r) {
8445
8479
  var n, a, i;
8446
- if (Vh.hasOwnProperty(t))
8480
+ if (Wh.hasOwnProperty(t))
8447
8481
  throw new Error('"' + t.toString() + '" is a reserved event name');
8448
8482
  if (r.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
8449
8483
  return this._addToQueue(r), this;
@@ -8950,7 +8984,7 @@ class na extends de {
8950
8984
  max: this.reconnectionDelayMax(),
8951
8985
  jitter: this.randomizationFactor()
8952
8986
  }), this.timeout(r.timeout == null ? 2e4 : r.timeout), this._readyState = "closed", this.uri = t;
8953
- const a = r.parser || Hh;
8987
+ const a = r.parser || qh;
8954
8988
  this.encoder = new a.Encoder(), this.decoder = new a.Decoder(), this._autoConnect = r.autoConnect !== !1, this._autoConnect && this.open();
8955
8989
  }
8956
8990
  reconnection(t) {
@@ -8993,7 +9027,7 @@ class na extends de {
8993
9027
  open(t) {
8994
9028
  if (~this._readyState.indexOf("open"))
8995
9029
  return this;
8996
- this.engine = new Mh(this.uri, this.opts);
9030
+ this.engine = new Lh(this.uri, this.opts);
8997
9031
  const r = this.engine, n = this;
8998
9032
  this._readyState = "opening", this.skipReconnect = !1;
8999
9033
  const a = Ne(r, "open", function() {
@@ -9183,7 +9217,7 @@ class na extends de {
9183
9217
  const Kt = {};
9184
9218
  function Lt(e, t) {
9185
9219
  typeof e == "object" && (t = e, e = void 0), t = t || {};
9186
- const r = Ih(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;
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;
9187
9221
  let l;
9188
9222
  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);
9189
9223
  }
@@ -9193,7 +9227,7 @@ Object.assign(Lt, {
9193
9227
  io: Lt,
9194
9228
  connect: Lt
9195
9229
  });
9196
- function qh(e) {
9230
+ function Kh(e) {
9197
9231
  const t = /* @__PURE__ */ new Map();
9198
9232
  let r = 0, n = null;
9199
9233
  const a = () => {
@@ -9250,16 +9284,16 @@ function Xi() {
9250
9284
  return new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
9251
9285
  }
9252
9286
  let Ji;
9253
- function Wh() {
9254
- return Ji ??= qh({
9255
- wire: { channel: Ef, parseChanged: Sf },
9287
+ function Gh() {
9288
+ return Ji ??= Kh({
9289
+ wire: { channel: Rf, parseChanged: Tf },
9256
9290
  connect: () => {
9257
9291
  const e = Lt(Xi(), { path: Qo, transports: ["websocket", "polling"] });
9258
9292
  return x("room-feed", "feed socket opened", { origin: Xi() }), e;
9259
9293
  }
9260
9294
  }), Ji;
9261
9295
  }
9262
- var Kh = ["effect", "gradient", "font", "overlay", "message"], G = (e, t, r, n = {}) => ({ id: `${e}.${t}`, slot: e, label: r, ...n }), _e = { hidden: !0 }, La = [
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 = [
9263
9297
  G("effect", "glint", "Glint"),
9264
9298
  G("effect", "aura", "Aura"),
9265
9299
  G("effect", "hop", "Hop", _e),
@@ -9367,13 +9401,13 @@ function ia(e, t) {
9367
9401
  bottom: Math.max(...A)
9368
9402
  };
9369
9403
  }
9370
- var Gh = La.filter((e) => !!e.art), Yh = {
9404
+ var Xh = La.filter((e) => !!e.art), Jh = {
9371
9405
  left: -25,
9372
- top: Math.floor(Math.min(...Gh.map((e) => ia(e.art, Xs).top))),
9406
+ top: Math.floor(Math.min(...Xh.map((e) => ia(e.art, Xs).top))),
9373
9407
  right: 125,
9374
9408
  bottom: 110
9375
9409
  }, $r = (e, [t, r]) => Math.min(r, Math.max(t, e));
9376
- function Xh(e, t) {
9410
+ function Qh(e, t) {
9377
9411
  const r = (s, l) => typeof s == "number" && Number.isFinite(s) ? s : l, n = {
9378
9412
  x: Math.round($r(r(t.x, 0), Gt.x)),
9379
9413
  y: Math.round($r(r(t.y, 0), Gt.y)),
@@ -9381,7 +9415,7 @@ function Xh(e, t) {
9381
9415
  s: Math.round($r(r(t.s, 100), Gt.s)),
9382
9416
  flip: t.flip === !0,
9383
9417
  back: t.back === !0
9384
- }, a = Yh;
9418
+ }, a = Jh;
9385
9419
  let i = ia(e, n);
9386
9420
  const o = Math.min(
9387
9421
  (a.right - a.left - 2) / (i.right - i.left),
@@ -9389,62 +9423,62 @@ function Xh(e, t) {
9389
9423
  );
9390
9424
  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;
9391
9425
  }
9392
- function Jh(e) {
9426
+ function Zh(e) {
9393
9427
  if (!e || typeof e != "object") return;
9394
9428
  const t = e, r = {};
9395
- for (const a of Kh) {
9429
+ for (const a of Yh) {
9396
9430
  const i = t[a], o = typeof i == "string" ? aa.get(i) : void 0;
9397
9431
  o && !o.hidden && o.slot === a && (r[a] = o.id);
9398
9432
  }
9399
9433
  const n = r.overlay ? aa.get(r.overlay)?.art : void 0;
9400
- return n && t.placement && typeof t.placement == "object" && (r.placement = Xh(n, t.placement)), Object.keys(r).length ? r : void 0;
9434
+ return n && t.placement && typeof t.placement == "object" && (r.placement = Qh(n, t.placement)), Object.keys(r).length ? r : void 0;
9401
9435
  }
9402
- var Qh = 0.3, Zh = 0.82, kt = 24, ep = 32;
9403
- function tp(e) {
9436
+ var ep = 0.3, tp = 0.82, kt = 24, rp = 32;
9437
+ function np(e) {
9404
9438
  let t = 0, r = 0, n = 0, a = 0;
9405
9439
  for (let i = 0; i + 3 < e.length; i += 4) {
9406
9440
  const o = e[i + 3];
9407
- o < ep || (t += e[i] * o, r += e[i + 1] * o, n += e[i + 2] * o, a += o);
9441
+ o < rp || (t += e[i] * o, r += e[i + 1] * o, n += e[i + 2] * o, a += o);
9408
9442
  }
9409
- return a === 0 ? null : rp(t / a, r / a, n / a);
9443
+ return a === 0 ? null : ap(t / a, r / a, n / a);
9410
9444
  }
9411
- function rp(e, t, r) {
9412
- const [n, a, i] = np(e / 255, t / 255, r / 255), o = Math.min(Zh, Math.max(Qh, i)), [s, l, c] = ap(n, a, o), d = (h) => Math.round(h * 255).toString(16).padStart(2, "0");
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");
9413
9447
  return `#${d(s)}${d(l)}${d(c)}`;
9414
9448
  }
9415
- function np(e, t, r) {
9449
+ function ip(e, t, r) {
9416
9450
  const n = Math.max(e, t, r), a = Math.min(e, t, r), i = (n + a) / 2;
9417
9451
  if (n === a) return [0, 0, i];
9418
9452
  const o = n - a, s = i > 0.5 ? o / (2 - n - a) : o / (n + a);
9419
9453
  let l;
9420
9454
  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];
9421
9455
  }
9422
- function ap(e, t, r) {
9456
+ function op(e, t, r) {
9423
9457
  if (t === 0) return [r, r, r];
9424
9458
  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);
9425
9459
  return [i(e + 1 / 3), i(e), i(e - 1 / 3)];
9426
9460
  }
9427
9461
  var Jr = /* @__PURE__ */ new Map(), Bn = /* @__PURE__ */ new Map(), oa = /* @__PURE__ */ new Set();
9428
- function ip(e) {
9462
+ function sp(e) {
9429
9463
  return Jr.get(e);
9430
9464
  }
9431
- function op(e) {
9465
+ function lp(e) {
9432
9466
  return oa.add(e), () => {
9433
9467
  oa.delete(e);
9434
9468
  };
9435
9469
  }
9436
- function sp(e) {
9470
+ function cp(e) {
9437
9471
  if (Jr.has(e)) return Promise.resolve(Jr.get(e) ?? null);
9438
9472
  const t = Bn.get(e);
9439
9473
  if (t) return t;
9440
- const r = lp(e).then((n) => {
9474
+ const r = up(e).then((n) => {
9441
9475
  Bn.delete(e), Jr.set(e, n);
9442
9476
  for (const a of oa) a();
9443
9477
  return n;
9444
9478
  });
9445
9479
  return Bn.set(e, r), r;
9446
9480
  }
9447
- function lp(e) {
9481
+ function up(e) {
9448
9482
  return typeof Image > "u" || typeof document > "u" ? Promise.resolve(null) : new Promise((t) => {
9449
9483
  const r = new Image();
9450
9484
  r.crossOrigin = "anonymous", r.referrerPolicy = "no-referrer", r.onload = () => {
@@ -9457,7 +9491,7 @@ function lp(e) {
9457
9491
  }
9458
9492
  a.drawImage(r, 0, 0, kt, kt);
9459
9493
  try {
9460
- t(tp(a.getImageData(0, 0, kt, kt).data));
9494
+ t(np(a.getImageData(0, 0, kt, kt).data));
9461
9495
  } catch (i) {
9462
9496
  console.debug("[prefs-client] picture colour unreadable", e, i), t(null);
9463
9497
  }
@@ -9468,13 +9502,13 @@ var Oa = "/cosmetics", Qi = "hadoku-cosmetics", Ie = (e) => e.replace(
9468
9502
  /[&<>"']/g,
9469
9503
  (t) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[t]
9470
9504
  ), ir = (e) => e ? e.slice(e.indexOf(".") + 1) : "none";
9471
- function cp(e) {
9505
+ function dp(e) {
9472
9506
  const t = e.s / 100 * (e.flip ? -1 : 1);
9473
9507
  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)})`;
9474
9508
  }
9475
- var up = /* @__PURE__ */ new Set(["hop"]);
9476
- function Rg(e, t, r = {}) {
9477
- const n = ir(t?.effect), a = ir(t?.gradient), i = ir(t?.font), o = Ie(e), s = up.has(n), l = s ? `<span class="hc-tx">${[...e].map(
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(
9478
9512
  (g, _) => `<span class="hc-ch" style="--hc-i:${_}"><span class="hc-c">${g === " " ? "&nbsp;" : Ie(g)}</span></span>`
9479
9513
  ).join("")}</span>` : `<span class="hc-tx">${o}</span>`, c = (g) => `<span class="hc-lyr${g}" aria-hidden="true">${o}</span>`;
9480
9514
  let d = "", h = "";
@@ -9486,23 +9520,23 @@ function Rg(e, t, r = {}) {
9486
9520
  ([g, _, R]) => `<i class="hc-tw" aria-hidden="true" style="left:${g}%;top:${_}%;animation-delay:${R}s"></i>`
9487
9521
  ).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>`;
9488
9522
  }
9489
- var dp = (() => {
9523
+ var hp = (() => {
9490
9524
  let e = "";
9491
9525
  for (let t = 0; t < 12; t++)
9492
9526
  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>`;
9493
9527
  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>`;
9494
9528
  })();
9495
- function Tg(e, t = Oa) {
9529
+ function Cg(e, t = Oa) {
9496
9530
  const r = e?.overlay;
9497
9531
  if (!r) return "";
9498
9532
  const n = aa.get(r)?.art;
9499
9533
  if (n) {
9500
9534
  const a = e?.placement ?? Xs;
9501
- 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:${cp(a)}"><img alt="" draggable="false" style="--hc-tilt:${n.tilt}deg" src="${Ie(`${t}/art/${n.file}`)}"></span></span>`;
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>`;
9502
9536
  }
9503
9537
  switch (ir(r)) {
9504
9538
  case "runes":
9505
- return `<span class="hc-ol hc-runes">${dp}</span>`;
9539
+ return `<span class="hc-ol hc-runes">${hp}</span>`;
9506
9540
  case "comet":
9507
9541
  return '<span class="hc-ol hc-comet"></span>';
9508
9542
  case "shine":
@@ -9517,12 +9551,12 @@ function Tg(e, t = Oa) {
9517
9551
  return "";
9518
9552
  }
9519
9553
  }
9520
- var Zi = "!<>-_/[]{}=+*^?#%&01", eo = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), to = 1400, fp = 160;
9521
- function xg(e, t, r = {}) {
9554
+ var Zi = "!<>-_/[]{}=+*^?#%&01", eo = /* @__PURE__ */ new Set(["type", "decode", "cascade"]), to = 1400, pp = 160;
9555
+ function kg(e, t, r = {}) {
9522
9556
  let n = ir(t?.message);
9523
9557
  if (n === "none") return `<span class="hc-msg">${Ie(e)}</span>`;
9524
9558
  const a = e.split(/\s+/).filter(Boolean);
9525
- eo.has(n) && e.length > fp && (n = "words");
9559
+ eo.has(n) && e.length > pp && (n = "words");
9526
9560
  const i = r.keep ? " data-hc-keep" : "";
9527
9561
  let o, s;
9528
9562
  if (eo.has(n)) {
@@ -9543,7 +9577,7 @@ function xg(e, t, r = {}) {
9543
9577
  ).join(" ");
9544
9578
  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>`;
9545
9579
  }
9546
- function hp(e) {
9580
+ function mp(e) {
9547
9581
  const t = e.target;
9548
9582
  if (e.pseudoElement || !t?.hasAttribute?.("data-hc-last")) return;
9549
9583
  const r = t.closest(".hc-msg");
@@ -9613,7 +9647,7 @@ var ro = {
9613
9647
  css: "font-weight:400;font-size:.62em;line-height:1.6"
9614
9648
  }
9615
9649
  };
9616
- function pp(e = Oa) {
9650
+ function gp(e = Oa) {
9617
9651
  const t = Object.entries(ro).map(
9618
9652
  ([n, a]) => `@font-face{font-family:"hc-${n}";src:url("${e}/fonts/${a.file}.woff2") format("woff2");font-display:swap}`
9619
9653
  ).join(`
@@ -9708,20 +9742,20 @@ ${r}
9708
9742
  @media (prefers-reduced-motion:reduce){.hc-name *,.hc-av *,.hc-av *::after,.hc-msg *,.hc-msg *::before,.hc-msg *::after{animation:none!important}}
9709
9743
  `;
9710
9744
  }
9711
- function Cg(e = document, t = Oa) {
9745
+ function Ag(e = document, t = Oa) {
9712
9746
  if (e.getElementById(Qi)) return;
9713
9747
  const r = e.createElement("style");
9714
- r.id = Qi, r.textContent = pp(t), e.head.appendChild(r), e.addEventListener("animationend", hp);
9748
+ r.id = Qi, r.textContent = gp(t), e.head.appendChild(r), e.addEventListener("animationend", mp);
9715
9749
  }
9716
- function mp(e, t) {
9717
- return (t ? ip(t) : null) ?? Rs(e);
9750
+ function yp(e, t) {
9751
+ return (t ? sp(t) : null) ?? Rs(e);
9718
9752
  }
9719
- function gp(e, t) {
9753
+ function vp(e, t) {
9720
9754
  return nt(() => {
9721
- t && sp(t);
9722
- }, [t]), ln(op, () => mp(e, t), () => Rs(e));
9755
+ t && cp(t);
9756
+ }, [t]), ln(lp, () => yp(e, t), () => Rs(e));
9723
9757
  }
9724
- function yp({ sprite: e, url: t, alt: r = "", className: n, style: a, fallback: i }) {
9758
+ function bp({ sprite: e, url: t, alt: r = "", className: n, style: a, fallback: i }) {
9725
9759
  const [o, s] = vo(null);
9726
9760
  if (t && t !== o)
9727
9761
  return /* @__PURE__ */ N(
@@ -9739,11 +9773,11 @@ function yp({ sprite: e, url: t, alt: r = "", className: n, style: a, fallback:
9739
9773
  const l = Ts(e);
9740
9774
  return l ? /* @__PURE__ */ N("img", { src: l, alt: r, crossOrigin: "anonymous", className: n, style: a, draggable: !1 }) : /* @__PURE__ */ N(yo, { children: i });
9741
9775
  }
9742
- const vp = "hadoku://library";
9743
- function bp(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
9776
+ const wp = "hadoku://library";
9777
+ function _p(e = typeof navigator < "u" ? navigator.userAgent : void 0) {
9744
9778
  return e !== void 0 && /(^|\s)HadokuApp\/\S/.test(e);
9745
9779
  }
9746
- function wp(e) {
9780
+ function Ep(e) {
9747
9781
  return e.slice().sort(
9748
9782
  (t, r) => (r.users?.length ?? 0) - (t.users?.length ?? 0) || t.room_id.localeCompare(r.room_id)
9749
9783
  );
@@ -9755,7 +9789,7 @@ async function Js(e, t = 1) {
9755
9789
  const a = await fetch(`${r}/api/rooms${Es() ? "?debug=1" : ""}`, { cache: "no-store", signal: e });
9756
9790
  if (!a.ok) throw new Error(`HTTP ${a.status}`);
9757
9791
  const i = await a.json();
9758
- return x("home", "rooms-fetch: success", { attempt: t, elapsedMs: Date.now() - n, roomCount: (i.rooms ?? []).length }), wp(i.rooms || []);
9792
+ return x("home", "rooms-fetch: success", { attempt: t, elapsedMs: Date.now() - n, roomCount: (i.rooms ?? []).length }), Ep(i.rooms || []);
9759
9793
  } catch (a) {
9760
9794
  if (a instanceof Error && a.name === "AbortError") throw a;
9761
9795
  const i = a instanceof Error ? a.message : void 0;
@@ -9764,11 +9798,11 @@ async function Js(e, t = 1) {
9764
9798
  throw at("app", "Failed to load rooms list", { elapsedMs: Date.now() - n, error: i }), a;
9765
9799
  }
9766
9800
  }
9767
- function _p(e) {
9801
+ function Sp(e) {
9768
9802
  return e.room_id.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" ");
9769
9803
  }
9770
- function Ep({ user: e }) {
9771
- const t = gp(e.sprite_id, e.avatar_url);
9804
+ function Rp({ user: e }) {
9805
+ const t = vp(e.sprite_id, e.avatar_url);
9772
9806
  return /* @__PURE__ */ $e("span", { className: "relative -ml-2 first:ml-0 group/av", children: [
9773
9807
  /* @__PURE__ */ N(
9774
9808
  "span",
@@ -9776,7 +9810,7 @@ function Ep({ user: e }) {
9776
9810
  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",
9777
9811
  style: { borderColor: t },
9778
9812
  children: /* @__PURE__ */ N(
9779
- yp,
9813
+ bp,
9780
9814
  {
9781
9815
  sprite: e.sprite_id,
9782
9816
  url: e.avatar_url,
@@ -9797,7 +9831,7 @@ function Ep({ user: e }) {
9797
9831
  )
9798
9832
  ] });
9799
9833
  }
9800
- function Sp({ room: e }) {
9834
+ function Tp({ room: e }) {
9801
9835
  const t = e.users ?? [], r = t.length;
9802
9836
  return /* @__PURE__ */ $e("li", { className: "flex items-stretch gap-2", children: [
9803
9837
  /* @__PURE__ */ N(
@@ -9806,8 +9840,8 @@ function Sp({ room: e }) {
9806
9840
  to: `/room/${encodeURIComponent(e.viewer_key)}`,
9807
9841
  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",
9808
9842
  children: /* @__PURE__ */ $e("div", { className: "flex items-center justify-between gap-4", children: [
9809
- /* @__PURE__ */ N("div", { className: "text-xl font-medium tracking-wide text-text no-underline", children: _p(e) }),
9810
- r > 0 && /* @__PURE__ */ N("div", { className: "flex shrink-0", children: t.map((n, a) => /* @__PURE__ */ N(Ep, { user: n }, `${n.name}-${a}`)) })
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}`)) })
9811
9845
  ] })
9812
9846
  }
9813
9847
  ),
@@ -9822,9 +9856,9 @@ function Sp({ room: e }) {
9822
9856
  )
9823
9857
  ] });
9824
9858
  }
9825
- function Rp() {
9826
- const e = ef(), { list: t, loading: r, error: n, refresh: a } = Xf("list", {
9827
- pings: Wh(),
9859
+ function xp() {
9860
+ const e = rf(), { list: t, loading: r, error: n, refresh: a } = Qf("list", {
9861
+ pings: Gh(),
9828
9862
  fetchList: (h) => Js(h)
9829
9863
  }), i = gl(() => t ?? [], [t]), o = t === null ? n : null, s = ks(), l = _t(null);
9830
9864
  nt(() => {
@@ -9853,15 +9887,15 @@ function Rp() {
9853
9887
  children: "Retry"
9854
9888
  }
9855
9889
  )
9856
- ] }) : 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(Sp, { room: h }, h.viewer_key)) }) })
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)) }) })
9857
9891
  ] }),
9858
- Pf() && /* @__PURE__ */ N("div", { className: "w-full max-w-md z-10", children: /* @__PURE__ */ N(Qd, { 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" }) }),
9859
- bp() && /* @__PURE__ */ $e("div", { className: "w-full max-w-md z-10", children: [
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: [
9860
9894
  /* @__PURE__ */ N("h2", { className: "text-xs uppercase tracking-[0.2em] text-text-muted/70 mb-3 px-1", children: "On this phone" }),
9861
9895
  /* @__PURE__ */ $e(
9862
9896
  "a",
9863
9897
  {
9864
- href: vp,
9898
+ href: wp,
9865
9899
  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",
9866
9900
  children: [
9867
9901
  /* @__PURE__ */ N("div", { className: "text-xl font-medium tracking-wide text-text", children: "Library" }),
@@ -9872,18 +9906,18 @@ function Rp() {
9872
9906
  ] })
9873
9907
  ] });
9874
9908
  }
9875
- function Tp() {
9909
+ function Cp() {
9876
9910
  return /* @__PURE__ */ $e("div", { className: "fixed inset-0 bg-black", children: [
9877
9911
  /* @__PURE__ */ N(Ns, {}),
9878
9912
  /* @__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..." }) }) })
9879
9913
  ] });
9880
9914
  }
9881
- const xp = "watchparty_fragment_delivery", Cp = /^[0-9a-f]{64}$/, kp = /^[A-Za-z0-9_.-]+$/;
9882
- function Ap(e) {
9883
- return !(!e || !e.baseUrl || e.baseUrl.endsWith("/") || !Cp.test(e.token) || e.trackId !== void 0 && !kp.test(e.trackId));
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));
9884
9918
  }
9885
- function kg(e, t) {
9886
- if (!Ap(e)) return null;
9919
+ function Pg(e, t) {
9920
+ if (!Mp(e)) return null;
9887
9921
  let r;
9888
9922
  if (t === "init")
9889
9923
  r = "init";
@@ -9894,7 +9928,7 @@ function kg(e, t) {
9894
9928
  const n = e.trackId ? `audio/${e.trackId}/` : "";
9895
9929
  return `${e.baseUrl}/v/${e.token}/${n}${r}`;
9896
9930
  }
9897
- function Pp() {
9931
+ function Ip() {
9898
9932
  if (typeof window > "u") return null;
9899
9933
  try {
9900
9934
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -9902,27 +9936,27 @@ function Pp() {
9902
9936
  if (e === "0" || e === "false") return !1;
9903
9937
  } catch {
9904
9938
  }
9905
- return rf(xp);
9939
+ return af(kp);
9906
9940
  }
9907
9941
  let Da = { ...as }, Qr = null, Qs = !1;
9908
9942
  const no = "watchparty_delivery_client_id";
9909
- function Mp() {
9943
+ function Lp() {
9910
9944
  const e = je(no);
9911
9945
  if (e) return e;
9912
9946
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
9913
9947
  return Ta(no, t) ? t : "";
9914
9948
  }
9915
- function Ip(e) {
9949
+ function Op(e) {
9916
9950
  Da = is(e), Qs || (Qr = null);
9917
9951
  }
9918
- function Lp() {
9952
+ function Dp() {
9919
9953
  return { ...Da };
9920
9954
  }
9921
9955
  function Zs() {
9922
- return Qr === null && (Qr = Sd(Da, Mp(), Pp())), Qr;
9956
+ return Qr === null && (Qr = Sd(Da, Lp(), Ip())), Qr;
9923
9957
  }
9924
9958
  let ao = !1;
9925
- async function Op(e) {
9959
+ async function Np(e) {
9926
9960
  if (!ao) {
9927
9961
  ao = !0;
9928
9962
  for (let t = 0; t < 2; t++) {
@@ -9930,7 +9964,7 @@ async function Op(e) {
9930
9964
  const r = await fetch(`${e}/api/flags`, { cache: "no-store" });
9931
9965
  if (r.ok) {
9932
9966
  const n = await r.json();
9933
- Ip(n?.fragment_delivery), x("app", "Delivery flag loaded", { ...Lp(), attempt: t });
9967
+ Op(n?.fragment_delivery), x("app", "Delivery flag loaded", { ...Dp(), attempt: t });
9934
9968
  return;
9935
9969
  }
9936
9970
  } catch {
@@ -9940,28 +9974,28 @@ async function Op(e) {
9940
9974
  ne("app", "Delivery flag fetch failed; staying on the default delivery path");
9941
9975
  }
9942
9976
  }
9943
- function Dp() {
9977
+ function $p() {
9944
9978
  return Zs();
9945
9979
  }
9946
- function Ag() {
9980
+ function Mg() {
9947
9981
  const e = Zs();
9948
9982
  return Qs = !0, e === "fragment";
9949
9983
  }
9950
9984
  let Na = Ld;
9951
9985
  const sa = /* @__PURE__ */ new Set();
9952
- function Np(e) {
9986
+ function Fp(e) {
9953
9987
  Na = e;
9954
9988
  for (const t of sa) t();
9955
9989
  }
9956
- function $p(e) {
9990
+ function Up(e) {
9957
9991
  const t = Id.safeParse(e?.games);
9958
9992
  if (!t.success)
9959
9993
  return ne("game", "Game catalog rejected; keeping the current list", { issues: t.error.issues.length }), !1;
9960
9994
  const r = t.data;
9961
- return Np(r), !0;
9995
+ return Fp(r), !0;
9962
9996
  }
9963
9997
  let io = !1;
9964
- async function Fp(e) {
9998
+ async function Bp(e) {
9965
9999
  if (!io) {
9966
10000
  io = !0;
9967
10001
  try {
@@ -9970,24 +10004,24 @@ async function Fp(e) {
9970
10004
  ne("game", "Game catalog fetch failed; using the default list", { status: t.status });
9971
10005
  return;
9972
10006
  }
9973
- $p(await t.json()) && x("game", "Game catalog loaded", { games: Na.map((r) => r.id) });
10007
+ Up(await t.json()) && x("game", "Game catalog loaded", { games: Na.map((r) => r.id) });
9974
10008
  } catch (t) {
9975
10009
  ne("game", "Game catalog fetch failed; using the default list", Ue(t));
9976
10010
  }
9977
10011
  }
9978
10012
  }
9979
- function Up() {
10013
+ function jp() {
9980
10014
  return Na;
9981
10015
  }
9982
- function Bp(e) {
10016
+ function zp(e) {
9983
10017
  return sa.add(e), () => {
9984
10018
  sa.delete(e);
9985
10019
  };
9986
10020
  }
9987
- function Pg() {
9988
- return ln(Bp, Up);
10021
+ function Ig() {
10022
+ return ln(zp, jp);
9989
10023
  }
9990
- function jp(e) {
10024
+ function Hp(e) {
9991
10025
  return ut.lazy(async () => {
9992
10026
  try {
9993
10027
  return await e();
@@ -10001,33 +10035,33 @@ function jp(e) {
10001
10035
  }
10002
10036
  });
10003
10037
  }
10004
- const zp = ["demo-room"];
10005
- function Hp(e) {
10006
- return e ? zp.some((t) => e === t || e.startsWith(t + "-")) : !1;
10038
+ const Vp = ["demo-room"];
10039
+ function qp(e) {
10040
+ return e ? Vp.some((t) => e === t || e.startsWith(t + "-")) : !1;
10007
10041
  }
10008
- function Vp(e) {
10042
+ function Wp(e) {
10009
10043
  if (!(e.hostname === "hadoku.me")) return null;
10010
10044
  if (e.requireAuth) {
10011
10045
  if (Di() !== "public") return null;
10012
10046
  const n = e.pathname + (e.search || "");
10013
10047
  return `/auth?return=${encodeURIComponent(n)}`;
10014
10048
  }
10015
- if (!e.roomKey || Hp(e.roomKey) || Di() !== "public") return null;
10049
+ if (!e.roomKey || qp(e.roomKey) || Di() !== "public") return null;
10016
10050
  const r = e.pathname + (e.search || "");
10017
10051
  return `/auth?return=${encodeURIComponent(r)}`;
10018
10052
  }
10019
- const oo = jp(() => import("./Room-D30OEvyK.js").then((e) => e.R));
10053
+ const oo = Hp(() => import("./Room-B0Zl13Bx.js").then((e) => e.R));
10020
10054
  function so() {
10021
10055
  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..." }) });
10022
10056
  }
10023
- function qp() {
10024
- const e = pt(), t = qc(), r = Vp({
10057
+ function Kp() {
10058
+ const e = pt(), t = qc(), r = Wp({
10025
10059
  roomKey: t.roomKey,
10026
10060
  hostname: window.location.hostname,
10027
10061
  pathname: window.location.pathname,
10028
10062
  search: window.location.search
10029
10063
  });
10030
- 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(Rp, {}) : 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" });
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" });
10031
10065
  }
10032
10066
  function jn(e) {
10033
10067
  const [t, r] = vo(!1), n = ks(), a = {
@@ -10046,7 +10080,7 @@ function jn(e) {
10046
10080
  signal: o.signal
10047
10081
  });
10048
10082
  if (o.signal.aborted) return;
10049
- c.ok ? (x("app", "API health check passed"), Op(i), Fp(i)) : (at("app", "API health check failed", { status: c.status }), r(!0));
10083
+ c.ok ? (x("app", "API health check passed"), Np(i), Bp(i)) : (at("app", "API health check failed", { status: c.status }), r(!0));
10050
10084
  } catch (c) {
10051
10085
  if (c?.name === "AbortError") return;
10052
10086
  at("app", "API unreachable", { url: l, error: c }), r(!0);
@@ -10084,19 +10118,19 @@ function jn(e) {
10084
10118
  "requestIdleCallback" in window ? window.requestIdleCallback(o, { timeout: 2e3 }) : setTimeout(o, 600);
10085
10119
  }
10086
10120
  document.readyState === "complete" ? s() : window.addEventListener("load", s, { once: !0 });
10087
- }, []), t ? /* @__PURE__ */ N(Tp, {}) : (
10121
+ }, []), t ? /* @__PURE__ */ N(Cp, {}) : (
10088
10122
  // HadokuThemeRoot must sit above everything that reads the theme —
10089
10123
  // <HadokuThemePicker> in ChatPanel throws without it, by design, so a
10090
10124
  // missing provider is a mount-time error rather than a silently wrong
10091
10125
  // theme. It also applies data-theme, which this app previously did through
10092
10126
  // its own useTheme() call.
10093
10127
  /* @__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: [
10094
- /* @__PURE__ */ N("main", { className: "flex-1 w-full overflow-hidden min-h-0 flex flex-col", children: /* @__PURE__ */ N(qp, {}) }),
10095
- /* @__PURE__ */ N(zf, {})
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, {})
10096
10130
  ] }) }) })
10097
10131
  );
10098
10132
  }
10099
- function Wp({ basename: e = "/watchparty", appProps: t } = {}) {
10133
+ function Gp({ basename: e = "/watchparty", appProps: t } = {}) {
10100
10134
  const r = t ?? {}, n = [
10101
10135
  { path: "/", element: /* @__PURE__ */ N(jn, { ...r }) },
10102
10136
  { path: "/room/:roomKey", element: /* @__PURE__ */ N(jn, { ...r }) },
@@ -10108,7 +10142,7 @@ let Zr;
10108
10142
  function el() {
10109
10143
  return je(Rl) || void 0;
10110
10144
  }
10111
- function Kp() {
10145
+ function Yp() {
10112
10146
  if (Zr) return;
10113
10147
  const e = el();
10114
10148
  if (e) {
@@ -10121,10 +10155,10 @@ function Kp() {
10121
10155
  x("identity", "device id unavailable — joining without one");
10122
10156
  });
10123
10157
  }
10124
- function Gp() {
10158
+ function Xp() {
10125
10159
  return Zr ??= el();
10126
10160
  }
10127
- function Yp(e) {
10161
+ function Jp(e) {
10128
10162
  const t = typeof window < "u" ? window.location.href : "http://localhost/", r = new URL(e, t).pathname;
10129
10163
  return `${r.endsWith("/") ? r : `${r}/`}socket.io/`;
10130
10164
  }
@@ -10146,7 +10180,7 @@ function lo(e, t) {
10146
10180
  template: e.isSystem && typeof e.template == "string" && e.template.includes(id) ? e.template : void 0
10147
10181
  };
10148
10182
  }
10149
- function Xp(e, t = () => !0) {
10183
+ function Qp(e, t = () => !0) {
10150
10184
  e.on(re.CHAT_BROADCAST, (r) => {
10151
10185
  if (!t()) return;
10152
10186
  const n = { ...lo(r, r.server_seq), live: !0 };
@@ -10157,29 +10191,29 @@ function Xp(e, t = () => !0) {
10157
10191
  U.getState().setChat(n), x("chat", "History loaded", { count: n.length });
10158
10192
  });
10159
10193
  }
10160
- let Jp = null;
10161
- function Qp(e = Jp) {
10194
+ let Zp = null;
10195
+ function em(e = Zp) {
10162
10196
  if (!e) return null;
10163
10197
  const t = typeof window < "u" ? window.location.href : "http://localhost/", r = e.namespace ?? "/room";
10164
10198
  return {
10165
10199
  url: `${new URL(e.origin, t).origin}${r.startsWith("/") ? r : `/${r}`}`,
10166
- path: e.path ?? Yp(e.origin)
10200
+ path: e.path ?? Jp(e.origin)
10167
10201
  };
10168
10202
  }
10169
- function Mg(e) {
10203
+ function Lg(e) {
10170
10204
  const r = `${pn()}/media/${e}`.replace(/\\/g, "/");
10171
10205
  return { mediaUrl: `${r}/${bd}`, indexUrl: `${r}/index.json` };
10172
10206
  }
10173
- function Zp(e) {
10207
+ function tm(e) {
10174
10208
  return `${pn()}/media/${e}`.replace(/\\/g, "/");
10175
10209
  }
10176
- function em(e, t) {
10177
- return Zp(t ?? `${e}/poster.jpg`);
10210
+ function rm(e, t) {
10211
+ return tm(t ?? `${e}/poster.jpg`);
10178
10212
  }
10179
10213
  function tl(e) {
10180
10214
  return `${pn()}${e}`.replace(/\\/g, "/");
10181
10215
  }
10182
- async function tm(e) {
10216
+ async function nm(e) {
10183
10217
  try {
10184
10218
  const t = await fetch(tl("/api/tierlist"));
10185
10219
  if (!t.ok)
@@ -10195,19 +10229,19 @@ async function tm(e) {
10195
10229
  }
10196
10230
  }
10197
10231
  let co = !1;
10198
- function Ig() {
10232
+ function Og() {
10199
10233
  if (co || typeof Image > "u") return;
10200
10234
  const e = U.getState().tierlist;
10201
10235
  if (!(!e || e.items.length === 0)) {
10202
10236
  co = !0;
10203
10237
  for (const t of e.items) {
10204
10238
  const r = new Image();
10205
- r.decoding = "async", r.src = em(t.id, t.thumbnail);
10239
+ r.decoding = "async", r.src = rm(t.id, t.thumbnail);
10206
10240
  }
10207
10241
  x("tierlist", "Warming posters", { count: e.items.length });
10208
10242
  }
10209
10243
  }
10210
- async function Lg(e) {
10244
+ async function Dg(e) {
10211
10245
  U.getState().setTierlistSaving(!0);
10212
10246
  try {
10213
10247
  const r = await fetch(tl("/api/tierlist/me"), {
@@ -10225,18 +10259,18 @@ async function Lg(e) {
10225
10259
  U.getState().setTierlistSaving(!1);
10226
10260
  }
10227
10261
  }
10228
- function rm() {
10262
+ function am() {
10229
10263
  const e = U.getState(), t = xs(Object.values(e.roster).map((a) => a.sprite), void 0, Nt);
10230
10264
  if (!t)
10231
10265
  return ne("socket", "sprite_taken: no available sprites to retry with"), null;
10232
10266
  const r = !!e.name && !St(e.name), n = r ? e.name : dr(t);
10233
10267
  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 };
10234
10268
  }
10235
- function nm(e) {
10269
+ function im(e) {
10236
10270
  const t = U.getState(), r = e ? t.roster[e] : void 0;
10237
10271
  return !r || !!r.sprite && r.sprite === t.sprite;
10238
10272
  }
10239
- var am = "https://hadoku.me/prefs", uo = "hadoku-avatar-link", im = "hadoku-avatar-link", fo = "hadoku-avatar-link-popup";
10273
+ var om = "https://hadoku.me/prefs", uo = "hadoku-avatar-link", sm = "hadoku-avatar-link", fo = "hadoku-avatar-link-popup";
10240
10274
  function ho(e) {
10241
10275
  try {
10242
10276
  e ? sessionStorage.setItem(fo, "1") : sessionStorage.removeItem(fo);
@@ -10249,21 +10283,21 @@ var sn = class extends Error {
10249
10283
  }
10250
10284
  status;
10251
10285
  };
10252
- async function om(e) {
10286
+ async function lm(e) {
10253
10287
  if (!e.ok) {
10254
10288
  const t = await e.json().catch(() => null);
10255
10289
  throw new sn(e.status, t?.message ?? `HTTP ${e.status}`);
10256
10290
  }
10257
10291
  return await e.json();
10258
10292
  }
10259
- function sm(e = {}) {
10260
- const t = `${e.baseUrl ?? am}/api/v1/_avatar`, r = e.fetch ?? fetch, n = (s, l = {}) => r(`${t}${s}`, { credentials: "include", ...l }).then(om), a = (s, l, c) => n(s, {
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, {
10261
10295
  method: l,
10262
10296
  ...c === void 0 ? {} : { headers: { "Content-Type": "application/json" }, body: JSON.stringify(c) }
10263
10297
  }), i = () => n("");
10264
10298
  async function o(s) {
10265
10299
  ho(!0);
10266
- const l = window.open("about:blank", im, "popup,width=520,height=760");
10300
+ const l = window.open("about:blank", sm, "popup,width=520,height=760");
10267
10301
  if (ho(!1), !l)
10268
10302
  throw new sn(0, "The sign-in window was blocked: allow pop-ups for hadoku.me");
10269
10303
  let c;
@@ -10328,16 +10362,16 @@ var po = "hadoku:avatar";
10328
10362
  function $a(e) {
10329
10363
  return e?.sprite ?? e?.avatar?.sprite ?? null;
10330
10364
  }
10331
- async function lm(e = {}) {
10365
+ async function um(e = {}) {
10332
10366
  const t = typeof location > "u" ? void 0 : location.origin, r = e.baseUrl ?? (t ? `${t}/prefs` : void 0);
10333
10367
  if (!r) return null;
10334
10368
  try {
10335
- return $a(await sm({ baseUrl: r, fetch: e.fetch }).get());
10369
+ return $a(await cm({ baseUrl: r, fetch: e.fetch }).get());
10336
10370
  } catch (n) {
10337
10371
  return n instanceof sn && [401, 403, 404].includes(n.status) || (e.onError ?? ((a) => console.warn("[prefs-client] avatar settings unreadable", a)))(n), null;
10338
10372
  }
10339
10373
  }
10340
- function Og(e) {
10374
+ function Ng(e) {
10341
10375
  if (typeof window > "u") return () => {
10342
10376
  };
10343
10377
  const t = (r) => {
@@ -10346,13 +10380,13 @@ function Og(e) {
10346
10380
  };
10347
10381
  return window.addEventListener(po, t), () => window.removeEventListener(po, t);
10348
10382
  }
10349
- const cm = "hadoku:name";
10350
- function Dg(e) {
10383
+ const dm = "hadoku:name";
10384
+ function $g(e) {
10351
10385
  const t = $a(e);
10352
10386
  return hn(t) ? t : null;
10353
10387
  }
10354
- async function Ng(e = {}) {
10355
- const t = await lm({
10388
+ async function Fg(e = {}) {
10389
+ const t = await um({
10356
10390
  ...e,
10357
10391
  onError: (n) => ne("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ue(n))
10358
10392
  }), r = hn(t) ? t : null;
@@ -10365,7 +10399,7 @@ function mo(e) {
10365
10399
  const n = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !St(t.name) ? t.name : dr(e);
10366
10400
  return t.setSessionIdentity(n, e), !0;
10367
10401
  }
10368
- function um(e, t, r) {
10402
+ function fm(e, t, r) {
10369
10403
  if (!r) return () => {
10370
10404
  };
10371
10405
  const n = (a) => {
@@ -10374,25 +10408,25 @@ function um(e, t, r) {
10374
10408
  };
10375
10409
  return r.addEventListener(e, n), () => r.removeEventListener(e, n);
10376
10410
  }
10377
- const dm = () => typeof window > "u" ? void 0 : window;
10378
- function $g(e, t = dm()) {
10379
- return um(cm, (r) => {
10411
+ const hm = () => typeof window > "u" ? void 0 : window;
10412
+ function Ug(e, t = hm()) {
10413
+ return fm(dm, (r) => {
10380
10414
  typeof r.name == "string" && r.name.trim() && e(r.name);
10381
10415
  }, t);
10382
10416
  }
10383
- const fm = 10;
10384
- function hm(e = typeof window < "u" ? window : void 0) {
10417
+ const pm = 10;
10418
+ function mm(e = typeof window < "u" ? window : void 0) {
10385
10419
  if (!e) return { framed: !1, depth: 0 };
10386
10420
  try {
10387
10421
  let t = 0, r = e;
10388
- for (; r !== r.parent && t < fm; )
10422
+ for (; r !== r.parent && t < pm; )
10389
10423
  t++, r = r.parent;
10390
10424
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
10391
10425
  } catch {
10392
10426
  return { framed: !1, depth: 0 };
10393
10427
  }
10394
10428
  }
10395
- function pm(e, t) {
10429
+ function gm(e, t) {
10396
10430
  let r = 0;
10397
10431
  for (const n of e.videos) {
10398
10432
  const a = Ft.voteKey(t, e.id, n.mediaId);
@@ -10400,49 +10434,49 @@ function pm(e, t) {
10400
10434
  }
10401
10435
  return r;
10402
10436
  }
10403
- const mm = 2e4, gm = 1e4;
10404
- function ym() {
10437
+ const ym = 2e4, vm = 1e4;
10438
+ function bm() {
10405
10439
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
10406
10440
  }
10407
- function vm(e, t) {
10441
+ function wm(e, t) {
10408
10442
  e.lastPongAt = t, e.unansweredSince = null;
10409
10443
  }
10410
- function bm(e, t, r) {
10411
- const n = e.lastTickAt !== null && t - e.lastTickAt > gm;
10412
- return e.lastTickAt = t, r ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > mm : (e.unansweredSince = null, !1);
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);
10413
10447
  }
10414
10448
  function rl(e, t) {
10415
10449
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
10416
10450
  }
10417
10451
  let Q = null, Fe = null, en = null, Be = null, it = null;
10418
- const wm = Em(), Et = ym();
10452
+ const Em = Rm(), Et = bm();
10419
10453
  let Fr = null, zn = null, go = 0, Fa = null, fr = !1, Ua = !1, Qt = !1, Ba = null;
10420
- function Fg(e) {
10454
+ function Bg(e) {
10421
10455
  const t = Ae(), r = U.getState();
10422
10456
  if (r.me.clientId && r.roster[r.me.clientId])
10423
10457
  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;
10424
- const n = _m(e);
10458
+ const n = Sm(e);
10425
10459
  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", () => {
10426
10460
  x("socket", "Emitting join", n), t.emit(re.JOIN, n);
10427
10461
  }), t;
10428
10462
  }
10429
- function _m(e) {
10463
+ function Sm(e) {
10430
10464
  return {
10431
10465
  room_key: e.room_key,
10432
10466
  name: e.name,
10433
10467
  sprite: e.sprite,
10434
10468
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
10435
10469
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
10436
- embed: hm(),
10437
- delivery_arm: Dp(),
10470
+ embed: mm(),
10471
+ delivery_arm: $p(),
10438
10472
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
10439
10473
  // (lastJoinPayload carries it) so a reconnect lands on the same
10440
10474
  // ParticipantId rather than minting a new person.
10441
- device_id: Gp(),
10442
- tab_id: wm
10475
+ device_id: Xp(),
10476
+ tab_id: Em
10443
10477
  };
10444
10478
  }
10445
- function Em() {
10479
+ function Rm() {
10446
10480
  const e = globalThis.crypto;
10447
10481
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
10448
10482
  const t = new Uint8Array(16);
@@ -10450,7 +10484,7 @@ function Em() {
10450
10484
  else for (let r = 0; r < t.length; r++) t[r] = Math.floor(Math.random() * 256);
10451
10485
  return Array.from(t, (r) => r.toString(16).padStart(2, "0")).join("");
10452
10486
  }
10453
- function Ug() {
10487
+ function jg() {
10454
10488
  return rl(Et, Date.now());
10455
10489
  }
10456
10490
  function Ae() {
@@ -10460,7 +10494,7 @@ function Ae() {
10460
10494
  const n = window.location;
10461
10495
  (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 }));
10462
10496
  }
10463
- const r = Qp();
10497
+ const r = em();
10464
10498
  if (r)
10465
10499
  Q = Lt(r.url, { path: r.path, transports: ["websocket", "polling"] }), x("socket", "Socket initialized on the room origin", r);
10466
10500
  else {
@@ -10468,14 +10502,14 @@ function Ae() {
10468
10502
  Q = Lt(n, { path: Qo, transports: ["websocket", "polling"] }), x("socket", "Socket initialized", { origin: t });
10469
10503
  }
10470
10504
  gn("__SOCKET__", Q), Be && (clearTimeout(Be), Be = null), Fe = null, en = setInterval(() => {
10471
- if (bm(Et, Date.now(), !!Q?.connected)) {
10505
+ if (_m(Et, Date.now(), !!Q?.connected)) {
10472
10506
  ne("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
10473
10507
  sid: Q?.id,
10474
10508
  lastPongAgeMs: rl(Et, Date.now()) ?? null
10475
10509
  }), zn = "pong-watchdog", Et.unansweredSince = null, Q?.io.engine?.close();
10476
10510
  return;
10477
10511
  }
10478
- Im();
10512
+ Om();
10479
10513
  }, vd), Q.on("connect", () => {
10480
10514
  Ua = !1;
10481
10515
  const n = Q?.id;
@@ -10512,14 +10546,14 @@ function Ae() {
10512
10546
  Qt = !0;
10513
10547
  }), Q.on("disconnect", (n) => {
10514
10548
  ws(null), Fr = { reason: zn ?? n, at: Date.now() }, zn = null, x("socket", "Disconnected", { reason: n });
10515
- }), 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")), Mm(Q);
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);
10516
10550
  }
10517
10551
  return Q;
10518
10552
  }
10519
10553
  function Hn(e) {
10520
10554
  return e.play_state === "playing" || e.playing === !0;
10521
10555
  }
10522
- function Sm(e) {
10556
+ function Tm(e) {
10523
10557
  e.on(re.SNAPSHOT, (t) => {
10524
10558
  e.emit(Ea.SYNC), U.getState().applySnapshot({
10525
10559
  roomId: t.room_id ?? null,
@@ -10529,7 +10563,7 @@ function Sm(e) {
10529
10563
  serverSeq: t.server_seq || 0,
10530
10564
  leaderId: t.leader_id || null
10531
10565
  }), U.getState().name || x("socket", "Deferring identity to presence event (snapshot carries no roster)");
10532
- const r = U.getState(), n = Q?.id, i = (n ? r.roster[n] : void 0) ?? Fa, o = wf(
10566
+ const r = U.getState(), n = Q?.id, i = (n ? r.roster[n] : void 0) ?? Fa, o = Ef(
10533
10567
  { name: r.name, avatarId: r.sprite },
10534
10568
  i ? { name: i.name, avatarId: i.sprite ?? null } : void 0,
10535
10569
  // A join that carried no name counts as a default one, so a name that
@@ -10572,7 +10606,7 @@ function Sm(e) {
10572
10606
  }), e.on(re.CONTROL_ACK, (t) => {
10573
10607
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && x("socket", "Control ack received", t);
10574
10608
  }), e.on(re.TIME_PONG, (t) => {
10575
- if (vm(Et, Date.now()), Fe && Fe.ts) {
10609
+ if (wm(Et, Date.now()), Fe && Fe.ts) {
10576
10610
  const r = Date.now() - Fe.ts;
10577
10611
  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 });
10578
10612
  }
@@ -10582,11 +10616,11 @@ function Sm(e) {
10582
10616
  U.getState().setReadiness({ mediaId: r, ready: i, readyCount: n, total: a }), x("socket", "Ready state received", { mediaId: r, readyCount: n, total: a, ready: i });
10583
10617
  });
10584
10618
  }
10585
- function Rm(e) {
10586
- const t = Jh(e);
10619
+ function xm(e) {
10620
+ const t = Zh(e);
10587
10621
  return t ? { cosmetics: t } : {};
10588
10622
  }
10589
- function Tm(e) {
10623
+ function Cm(e) {
10590
10624
  e.on(re.PRESENCE, (t) => {
10591
10625
  if (!t) return;
10592
10626
  if (Array.isArray(t.users)) {
@@ -10600,7 +10634,7 @@ function Tm(e) {
10600
10634
  isLeader: s.is_leader,
10601
10635
  ...s.registry_name ? { registryName: !0 } : {},
10602
10636
  ...s.avatar_url ? { avatarUrl: s.avatar_url } : {},
10603
- ...Rm(s.cosmetics)
10637
+ ...xm(s.cosmetics)
10604
10638
  };
10605
10639
  const a = U.getState(), i = Q?.id, o = i ? n[i] : void 0;
10606
10640
  if (o?.registryName)
@@ -10622,7 +10656,7 @@ function Tm(e) {
10622
10656
  }
10623
10657
  });
10624
10658
  }
10625
- function xm(e) {
10659
+ function km(e) {
10626
10660
  e.on(rt.STATE, (t) => {
10627
10661
  U.getState().applyPlaylistState({
10628
10662
  playlist: t?.playlist ?? null,
@@ -10635,63 +10669,63 @@ function xm(e) {
10635
10669
  U.getState().setPlaylistResults(t ?? null), x("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
10636
10670
  }), e.on(rt.VOTES_CLEARED, (t) => {
10637
10671
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
10638
- const r = pm(
10672
+ const r = gm(
10639
10673
  { id: t.playlistId, videos: t.mediaIds.map((a) => ({ mediaId: a })) },
10640
- If()
10674
+ Of()
10641
10675
  ), n = U.getState();
10642
10676
  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 });
10643
10677
  });
10644
10678
  }
10645
- function Cm(e) {
10679
+ function Am(e) {
10646
10680
  e.on(hd.UPDATED, () => {
10647
- x("tierlist", "Someone saved — refreshing the board"), tm(!1);
10681
+ x("tierlist", "Someone saved — refreshing the board"), nm(!1);
10648
10682
  });
10649
10683
  }
10650
- function km(e) {
10684
+ function Pm(e) {
10651
10685
  e.on(_a.STATE, (t) => {
10652
10686
  if (!t || typeof t.active != "boolean") return;
10653
10687
  const r = Array.isArray(t.ready) ? t.ready.filter((n) => typeof n == "string") : [];
10654
10688
  U.getState().setReadyCheckState({ active: t.active, ready: r }), x("ready-check", "State received", { active: t.active, readyCount: r.length });
10655
10689
  });
10656
10690
  }
10657
- function Bg() {
10691
+ function zg() {
10658
10692
  Q?.emit(_a.START, {});
10659
10693
  }
10660
- function jg(e) {
10694
+ function Hg(e) {
10661
10695
  Q?.emit(_a.TOGGLE, { ready: e });
10662
10696
  }
10663
- function Am(e) {
10697
+ function Mm(e) {
10664
10698
  e.on(Ea.ACTIVE, (t) => {
10665
10699
  const r = typeof t?.gameId == "string" ? t.gameId : null;
10666
10700
  U.getState().setActiveGameId(r), x("game", "game_active", { gameId: r });
10667
10701
  });
10668
10702
  }
10669
- function zg(e) {
10703
+ function Vg(e) {
10670
10704
  Q?.emit(Ea.SELECT, { gameId: e });
10671
10705
  }
10672
- function Pm(e) {
10706
+ function Im(e) {
10673
10707
  e.on(re.HEALTH_SNAPSHOT, (t) => {
10674
10708
  U.getState().setHealthSnapshot(t);
10675
10709
  }), e.on(re.BUFFER_STATUS, (t) => {
10676
10710
  U.getState().setBufferStatus(t);
10677
10711
  });
10678
10712
  }
10679
- function Mm(e) {
10680
- Sm(e), Tm(e), Xp(e, () => !0), Pm(e), xm(e), Cm(e), km(e), Am(e), e.on(re.ERROR, (t) => {
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) => {
10681
10715
  const r = t?.code || "error/unknown";
10682
10716
  if (r === "conflict" && t?.message === "sprite_held_by_you") {
10683
10717
  Ua = !0, x("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
10684
10718
  return;
10685
10719
  }
10686
10720
  if (r === "conflict" && t?.message === "sprite_taken") {
10687
- if (nm(Q?.id)) {
10721
+ if (im(Q?.id)) {
10688
10722
  x("socket", "sprite_taken: stale, the server already has our sprite");
10689
10723
  return;
10690
10724
  }
10691
10725
  fr = !0;
10692
10726
  let o;
10693
10727
  try {
10694
- o = rm();
10728
+ o = am();
10695
10729
  } finally {
10696
10730
  fr = !1;
10697
10731
  }
@@ -10722,16 +10756,16 @@ function Mm(e) {
10722
10756
  (r.startsWith("auth/") ? ne : at)("socket", `Server error: ${a}`, { code: r, raw: t }), U.getState().pushToast("error", a);
10723
10757
  });
10724
10758
  }
10725
- function Hg(e, t) {
10759
+ function qg(e, t) {
10726
10760
  const r = t?.length ? { text: e, images: t } : { text: e };
10727
10761
  Ae().emit(re.CHAT_SEND, r);
10728
10762
  }
10729
- function Im() {
10763
+ function Om() {
10730
10764
  Fe || (Fe = { ts: Date.now() }, Ae().emit(re.TIME_PING, {}), Be = setTimeout(() => {
10731
10765
  Fe && (x("socket", "Time ping timed out after 10s, clearing inflight"), Fe = null), Be = null;
10732
10766
  }, 1e4));
10733
10767
  }
10734
- function Vg(e) {
10768
+ function Wg(e) {
10735
10769
  const t = U.getState(), r = t.me.clientId;
10736
10770
  if (!r || !t.roster[r]) {
10737
10771
  mo(e), x("socket", "Avatar change before join: the join will carry it", { sprite: e });
@@ -10746,10 +10780,10 @@ function Vg(e) {
10746
10780
  const n = U.getState(), a = { avatar: !0 };
10747
10781
  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);
10748
10782
  }
10749
- function qg(e) {
10750
- U.getState().me.clientId && Lm(e);
10783
+ function Kg(e) {
10784
+ U.getState().me.clientId && Dm(e);
10751
10785
  }
10752
- function Lm(e, t) {
10786
+ function Dm(e, t) {
10753
10787
  const r = {};
10754
10788
  e && (r.name = e), !(!r.name && !r.sprite) && (x("socket", "Sending identity update", r), Ae().emit(re.IDENTITY_UPDATE, r));
10755
10789
  }
@@ -10765,14 +10799,14 @@ U.subscribe((e, t) => {
10765
10799
  const o = {};
10766
10800
  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);
10767
10801
  });
10768
- function Om() {
10802
+ function Nm() {
10769
10803
  en && (clearInterval(en), en = null), Be && (clearTimeout(Be), Be = null), Fe = null, Et.unansweredSince = null, Et.lastTickAt = null;
10770
10804
  }
10771
- function Dm() {
10805
+ function $m() {
10772
10806
  x("socket", "clearJoinState called", { hadPayload: it !== null, room_key: it?.room_key }), it = null, Qt = !1, Ba = null;
10773
10807
  }
10774
- function Nm() {
10775
- x("socket", "leaveRoom called", { room_key: it?.room_key }), Dm(), Om(), Q && (Q.disconnect(), Q = null), U.setState({
10808
+ function Fm() {
10809
+ x("socket", "leaveRoom called", { room_key: it?.room_key }), $m(), Nm(), Q && (Q.disconnect(), Q = null), U.setState({
10776
10810
  me: { clientId: null, nextClientSeq: 1 },
10777
10811
  roster: {},
10778
10812
  snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
@@ -10787,40 +10821,40 @@ function Nm() {
10787
10821
  activeGameId: null
10788
10822
  });
10789
10823
  }
10790
- function Wg(e) {
10824
+ function Gg(e) {
10791
10825
  x("playlist", "Emitting playlist_load", { playlistId: e }), Ae().emit(rt.LOAD, { playlistId: e });
10792
10826
  }
10793
- function Kg(e) {
10827
+ function Yg(e) {
10794
10828
  x("playlist", "Emitting playlist_select", { index: e }), Ae().emit(rt.SELECT, { index: e });
10795
10829
  }
10796
- function Gg(e, t, r) {
10830
+ function Xg(e, t, r) {
10797
10831
  x("playlist", "Emitting playlist_vote_update", { playlistId: e, mediaId: t, vote: r }), Ae().emit(rt.VOTE_UPDATE, { playlistId: e, mediaId: t, vote: r });
10798
10832
  }
10799
- function Yg() {
10833
+ function Jg() {
10800
10834
  x("chat", "Emitting recap_request"), Ae().emit("recap_request");
10801
10835
  }
10802
- function Xg() {
10836
+ function Qg() {
10803
10837
  x("playlist", "Emitting playlist_reveal_request"), Ae().emit(rt.REVEAL_REQUEST, {});
10804
10838
  }
10805
- function Jg(e) {
10839
+ function Zg(e) {
10806
10840
  x("playlist", "Emitting playlist_vote_remove", { voterKey: e }), Ae().emit(rt.VOTE_REMOVE, { voterKey: e });
10807
10841
  }
10808
- function Qg(e) {
10842
+ function ey(e) {
10809
10843
  Ba = e, Ae().emit(re.CLIENT_READY, { media_id: e }), x("socket", "client_ready emitted", { mediaId: e });
10810
10844
  }
10811
- function $m(e) {
10845
+ function Um(e) {
10812
10846
  if (!e || e === "/" || document.querySelector(`link[rel="preconnect"][href="${e}"]`)) return;
10813
10847
  const t = document.createElement("link");
10814
10848
  t.rel = "preconnect", t.href = e, t.crossOrigin = "anonymous", document.head.appendChild(t);
10815
10849
  }
10816
- function Fm(e, t, r) {
10850
+ function Bm(e, t, r) {
10817
10851
  const n = yl(e), a = r ? /* @__PURE__ */ N(ut.StrictMode, { children: t }) : t;
10818
10852
  return n.render(a), n;
10819
10853
  }
10820
10854
  let Ot = null, Dt = null;
10821
10855
  const nl = import.meta.url.replace(/[^/]*$/, "");
10822
10856
  let Br = !1;
10823
- function Um() {
10857
+ function jm() {
10824
10858
  const e = () => {
10825
10859
  Br || !$t() || (Br = !0, x("boot", "tv mode: starting with chat collapsed"), U.getState().applyTvDefaults());
10826
10860
  };
@@ -10830,19 +10864,19 @@ function Um() {
10830
10864
  });
10831
10865
  }
10832
10866
  }
10833
- function Bm(e) {
10867
+ function zm(e) {
10834
10868
  return !e.filename || !e.filename.startsWith(nl) ? !1 : !/^ResizeObserver loop/.test(e.message ?? "");
10835
10869
  }
10836
- function Zg(e, t = {}) {
10870
+ function ty(e, t = {}) {
10837
10871
  const { basename: r, strictMode: n = !1, ...a } = t;
10838
- nf(), Zd({
10872
+ of(), tf({
10839
10873
  serverOrigin: a.serverOrigin,
10840
10874
  defaultRoomKey: a.defaultRoomKey,
10841
10875
  cdnBase: a.cdnBase
10842
- }), Kp(), Af({
10876
+ }), Yp(), Mf({
10843
10877
  userType: a.userType,
10844
10878
  userId: a.userId
10845
- }), U.getState().rehydrateFromPrefs(), Um();
10879
+ }), U.getState().rehydrateFromPrefs(), jm();
10846
10880
  try {
10847
10881
  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();
10848
10882
  x("boot", "prefs.beacon", {
@@ -10858,138 +10892,139 @@ function Zg(e, t = {}) {
10858
10892
  } catch (c) {
10859
10893
  ne("boot", "prefs.beacon.threw", { err: c?.message });
10860
10894
  }
10861
- Lf().catch((c) => ne("boot", "whoami threw", Ue(c))), Uf().then((c) => {
10895
+ Df().catch((c) => ne("boot", "whoami threw", Ue(c))), jf().then((c) => {
10862
10896
  c && U.getState().rehydrateFromPrefs();
10863
10897
  }).catch((c) => ne("boot", "prefs sync threw", Ue(c))), Ot || (Ot = (c) => {
10864
10898
  at("app", "Unhandled promise rejection", { reason: String(c.reason) });
10865
10899
  }, window.addEventListener("unhandledrejection", Ot)), Dt || (Dt = (c) => {
10866
- Bm(c) && at("app", "Uncaught error", {
10900
+ zm(c) && at("app", "Uncaught error", {
10867
10901
  message: c.message,
10868
10902
  source: `${c.filename.slice(nl.length)}:${c.lineno}:${c.colno}`,
10869
10903
  stack: c.error instanceof Error ? c.error.stack?.slice(0, 1500) : void 0
10870
10904
  });
10871
- }, window.addEventListener("error", Dt)), a.serverOrigin && $m(a.serverOrigin);
10905
+ }, window.addEventListener("error", Dt)), a.serverOrigin && Um(a.serverOrigin);
10872
10906
  const i = Ca().theme;
10873
- i && wl.includes(i) && _l(i), bf().catch((c) => ne("boot", "display names load threw", Ue(c))), e.__watchparty?.root.unmount();
10874
- const o = Wp({
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({
10875
10909
  basename: r,
10876
10910
  appProps: a
10877
- }), l = { root: Fm(e, /* @__PURE__ */ N(Yu, { router: o }), n) };
10911
+ }), l = { root: Bm(e, /* @__PURE__ */ N(Yu, { router: o }), n) };
10878
10912
  return e.__watchparty = l, o;
10879
10913
  }
10880
- function ey(e) {
10914
+ function ry(e) {
10881
10915
  const t = e.__watchparty;
10882
- t && (t.root.unmount(), delete e.__watchparty, Nm(), Ot && (window.removeEventListener("unhandledrejection", Ot), Ot = null), Dt && (window.removeEventListener("error", Dt), Dt = null));
10916
+ t && (t.root.unmount(), delete e.__watchparty, Fm(), Ot && (window.removeEventListener("unhandledrejection", Ot), Ot = null), Dt && (window.removeEventListener("error", Dt), Dt = null));
10883
10917
  }
10884
10918
  export {
10885
10919
  Ae as $,
10886
- yp as A,
10920
+ bp as A,
10887
10921
  Ca as B,
10888
10922
  tr as C,
10889
10923
  ba as D,
10890
10924
  Di as E,
10891
10925
  vn as F,
10892
- zg as G,
10893
- tg as H,
10894
- eg as I,
10926
+ Vg as G,
10927
+ ng as H,
10928
+ rg as I,
10895
10929
  gn as J,
10896
- jg as K,
10930
+ Hg as K,
10897
10931
  rn as L,
10898
10932
  On as M,
10899
- Bg as N,
10900
- Zm as O,
10901
- tm as P,
10902
- Lg as Q,
10903
- em as R,
10904
- gg as S,
10905
- Xm as T,
10906
- Og as U,
10907
- $g as V,
10908
- Dg as W,
10909
- Vg as X,
10910
- qg as Y,
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,
10911
10945
  Ue as Z,
10912
10946
  pn as _,
10913
- vg as a,
10947
+ wg as a,
10914
10948
  re as a0,
10915
- Qm as a1,
10916
- og as a2,
10917
- Ag as a3,
10918
- kg as a4,
10919
- lg as a5,
10920
- sg as a6,
10921
- ng as a7,
10922
- Jm as a8,
10923
- fg as a9,
10924
- Fg as aA,
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,
10925
10959
  Es as aB,
10926
- pg as aC,
10927
- mg as aD,
10928
- Mf as aE,
10929
- Wg as aF,
10930
- Eg as aG,
10931
- hn as aH,
10932
- Jg as aI,
10933
- Ft as aJ,
10934
- If as aK,
10935
- je as aL,
10936
- Gg as aM,
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,
10937
10971
  Xg as aN,
10938
- Kg as aO,
10939
- Ta as aP,
10940
- Zg as aQ,
10941
- ey as aR,
10942
- Wp as aS,
10943
- ug as aa,
10944
- dg as ab,
10945
- cg as ac,
10946
- _g as ad,
10947
- Ym as ae,
10948
- Ug as af,
10949
- Dp as ag,
10950
- ef as ah,
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,
10951
10986
  gs as ai,
10952
- rg as aj,
10953
- ag as ak,
10954
- Km as al,
10955
- Mg as am,
10956
- hg as an,
10957
- Zp as ao,
10987
+ ag as aj,
10988
+ og as ak,
10989
+ Ym as al,
10990
+ Lg as am,
10991
+ mg as an,
10992
+ tm as ao,
10958
10993
  bd as ap,
10959
10994
  ks as aq,
10960
- ig as ar,
10961
- Qg as as,
10995
+ sg as ar,
10996
+ ey as as,
10962
10997
  ms as at,
10963
10998
  Tt as au,
10964
10999
  Ns as av,
10965
11000
  qc as aw,
10966
- bf as ax,
10967
- Uf as ay,
10968
- Ng as az,
10969
- Qd as b,
11001
+ _f as ax,
11002
+ jf as ay,
11003
+ Fg as az,
11004
+ ef as b,
10970
11005
  id as c,
10971
11006
  x as d,
10972
11007
  at as e,
10973
- yg as f,
10974
- Xd as g,
10975
- Cg as h,
11008
+ bg as f,
11009
+ Qd as g,
11010
+ Ag as h,
10976
11011
  Jo as i,
10977
- Tg as j,
11012
+ Cg as j,
10978
11013
  ds as k,
10979
- gp as l,
10980
- bg as m,
10981
- xg as n,
10982
- Rg as o,
10983
- Ig as p,
10984
- Yg as q,
10985
- wg as r,
10986
- Hg as s,
10987
- Gm as t,
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,
10988
11023
  U as u,
10989
11024
  ed as v,
10990
11025
  ne as w,
10991
- Pg as x,
10992
- Nm as y,
10993
- jp as z
11026
+ Ig as x,
11027
+ Fm as y,
11028
+ Hp as z
10994
11029
  };
10995
- //# sourceMappingURL=index-CuuTdsvJ.js.map
11030
+ //# sourceMappingURL=index-Blg73T3D.js.map