@hadoku/watchparty-ui 0.45.80 → 0.45.82

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.
@@ -1,25 +1,25 @@
1
1
  import { jsx as c, jsxs as w, Fragment as se } from "react/jsx-runtime";
2
- import Oe, { useState as P, useRef as G, useMemo as te, useCallback as E, useEffect as A, createContext as ot, useContext as Xt, useSyncExternalStore as Yn, useId as zn, useEffectEvent as Jt } from "react";
3
- import { themePrefs as me, Icon as Xn, THEMES as Jn, useHadokuThemeOptional as Qn } from "@wolffm/themes";
2
+ import Oe, { useState as P, useRef as G, useMemo as te, useCallback as E, useEffect as A, createContext as ot, useContext as Xt, useSyncExternalStore as zn, useId as Xn, useEffectEvent as Jt } from "react";
3
+ import { themePrefs as me, Icon as Jn, THEMES as Qn, useHadokuThemeOptional as Zn } from "@wolffm/themes";
4
4
  import { z as o } from "zod";
5
- import { createCdnClient as Zn, kindOfType as er, MAX_BYTES as tr, measureImage as nr, filesFromClipboard as rr, filesFromDrop as or, CdnError as Je } from "@wolffm/cdn-client";
6
- import { ensureCosmeticsStyles as ar, cleanWorn as ir, readPictureColour as sr, onPictureColour as lr, pictureColour as cr, decorHtml as dr, messageHtml as ur, nameHtml as mr, finishReveal as fr } from "@wolffm/prefs-client/cosmetics";
7
- import { create as pr } from "zustand";
8
- import { createPrefsClient as hr, getDeviceId as gr, DEVICE_ID_KEY as yr } from "@wolffm/prefs-client";
5
+ import { createCdnClient as er, kindOfType as tr, MAX_BYTES as nr, measureImage as rr, filesFromClipboard as or, filesFromDrop as ar, CdnError as Je } from "@wolffm/cdn-client";
6
+ import { ensureCosmeticsStyles as ir, cleanWorn as sr, readPictureColour as lr, onPictureColour as cr, pictureColour as dr, decorHtml as ur, messageHtml as mr, nameHtml as fr, finishReveal as pr } from "@wolffm/prefs-client/cosmetics";
7
+ import { create as hr } from "zustand";
8
+ import { pickAvatar as Qt, resolveIdentityReassert as gr } from "@wolffm/rooms-protocol";
9
+ import { createPrefsClient as yr, getDeviceId as br, DEVICE_ID_KEY as vr } from "@wolffm/prefs-client";
9
10
  import { io as Qe } from "socket.io-client";
10
- import { createAvatarClient as br, AvatarError as Ct } from "@wolffm/prefs-client/avatar";
11
- import { resolveIdentityReassert as vr } from "@wolffm/rooms-protocol";
12
- import { relayIdentityChanges as wr } from "@wolffm/task-ui-components/identity-relay";
13
- import { createPortal as Sr } from "react-dom";
14
- import { useCatalogueSearch as _r } from "@wolffm/cdn-client/react";
15
- const Qt = "https://cdn.hadoku.me", Zt = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
11
+ import { createAvatarClient as wr, AvatarError as Ct } from "@wolffm/prefs-client/avatar";
12
+ import { relayIdentityChanges as Sr } from "@wolffm/task-ui-components/identity-relay";
13
+ import { createPortal as _r } from "react-dom";
14
+ import { useCatalogueSearch as xr } from "@wolffm/cdn-client/react";
15
+ const Zt = "https://cdn.hadoku.me", en = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
16
16
  function at(e) {
17
- return typeof e == "string" && Zt.test(e);
17
+ return typeof e == "string" && en.test(e);
18
18
  }
19
- const it = 8080, en = 5173, xr = "/watchparty/ws", tn = 500, Cr = 1e3, J = 4, nn = typeof process < "u" && process.env ? process.env : {};
20
- nn.PRODUCTION_UI_URL;
21
- nn.PRODUCTION_SERVER_URL;
22
- const Te = o.enum(["S", "A", "B", "C", "D", "F"]), It = 2e4, Ir = 300;
19
+ const it = 8080, tn = 5173, Cr = "/watchparty/ws", nn = 500, Ir = 1e3, J = 4, rn = typeof process < "u" && process.env ? process.env : {};
20
+ rn.PRODUCTION_UI_URL;
21
+ rn.PRODUCTION_SERVER_URL;
22
+ const Te = o.enum(["S", "A", "B", "C", "D", "F"]), It = 2e4, Tr = 300;
23
23
  o.object({
24
24
  name: o.string().min(1).max(32).optional(),
25
25
  sprite: o.string().min(1).max(32).optional(),
@@ -46,7 +46,7 @@ const v = {
46
46
  // 'ready_state' here = playback-readiness gate (distinct from READY_EVENTS.STATE = "ready check" UX feature)
47
47
  READY_STATE: "ready_state",
48
48
  ERROR: "error"
49
- }, Tr = o.enum(["play", "pause", "seek", "load", "home"]), kr = o.object({
49
+ }, kr = o.enum(["play", "pause", "seek", "load", "home"]), Er = o.object({
50
50
  framed: o.boolean(),
51
51
  depth: o.number().int().nonnegative().max(10)
52
52
  });
@@ -54,7 +54,7 @@ o.object({
54
54
  room_key: o.string(),
55
55
  name: o.string().min(1).max(32).optional(),
56
56
  sprite: o.string().min(1).max(32).optional(),
57
- embed: kr.optional(),
57
+ embed: Er.optional(),
58
58
  /** Which media-delivery path this client resolved to ('range' | 'fragment').
59
59
  * Optional so older clients still validate. Reported so a party's logs can be split by
60
60
  * arm — without it an A/B rollout is unmeasurable, exactly as entry path was before
@@ -102,13 +102,13 @@ o.object({
102
102
  });
103
103
  o.object({
104
104
  client_seq: o.number().int().positive(),
105
- kind: Tr,
105
+ kind: kr,
106
106
  to_ms: o.number().int().nonnegative().optional(),
107
107
  media_id: o.string().optional()
108
108
  // leader_id removed - not needed since set_leader control was removed
109
109
  });
110
- const rn = o.object({
111
- key: o.string().regex(Zt, "not a CDN image key"),
110
+ const on = o.object({
111
+ key: o.string().regex(en, "not a CDN image key"),
112
112
  /**
113
113
  * Intrinsic pixels, or **0 meaning "unknown"**.
114
114
  *
@@ -136,14 +136,14 @@ const rn = o.object({
136
136
  * value only, never as markup. Bounded so one message cannot carry a
137
137
  * paragraph; the library's own titles run well under this.
138
138
  */
139
- title: o.string().max(Ir).optional()
139
+ title: o.string().max(Tr).optional()
140
140
  });
141
141
  o.object({
142
- text: o.string().max(tn),
142
+ text: o.string().max(nn),
143
143
  style: o.string().max(64).optional(),
144
- images: o.array(rn).max(J).optional()
144
+ images: o.array(on).max(J).optional()
145
145
  }).refine((e) => e.text.length > 0 || (e.images?.length ?? 0) > 0, { message: "message must carry text or at least one image" });
146
- const Er = o.enum(["join", "leave", "media_change", "identity_change", "recap"]);
146
+ const Ar = o.enum(["join", "leave", "media_change", "identity_change", "recap"]);
147
147
  o.object({
148
148
  id: o.string(),
149
149
  client_id: o.string(),
@@ -156,16 +156,16 @@ o.object({
156
156
  ts: o.number(),
157
157
  // Optional so a client on an older bundle still validates a message that
158
158
  // has none, and so system messages (which never carry images) stay unchanged.
159
- images: o.array(rn).max(J).optional(),
159
+ images: o.array(on).max(J).optional(),
160
160
  isSystem: o.boolean().optional(),
161
- systemType: Er.optional(),
161
+ systemType: Ar.optional(),
162
162
  /** A system line about a person: its text with `CHAT_NAME_TOKEN` where their
163
163
  * name goes. `text` is that template filled when sent; a client fills it
164
164
  * again with the person's CURRENT name (found by `author`) while they are
165
165
  * here, so a rename reaches lines already on screen. */
166
166
  template: o.string().optional()
167
167
  });
168
- const on = "{name}", Ar = o.object({
168
+ const an = "{name}", Nr = o.object({
169
169
  avg_download_rate_bps: o.number().nonnegative(),
170
170
  buffered_ahead_ms: o.number().nonnegative(),
171
171
  rtt_ms: o.number().nonnegative(),
@@ -207,7 +207,7 @@ const on = "{name}", Ar = o.object({
207
207
  * socket shows here as a growing number while everything else looks fine. */
208
208
  pong_age_ms: o.number().int().nonnegative().optional(),
209
209
  reported_at: o.number().int().nonnegative()
210
- }), Nr = Ar.extend({
210
+ }), Pr = Nr.extend({
211
211
  client_id: o.string(),
212
212
  name: o.string(),
213
213
  sprite_id: o.string().nullable(),
@@ -218,10 +218,10 @@ const on = "{name}", Ar = o.object({
218
218
  stale_ms: o.number().int().nonnegative().optional()
219
219
  });
220
220
  o.object({
221
- clients: o.array(Nr),
221
+ clients: o.array(Pr),
222
222
  server_ts: o.number().int().nonnegative()
223
223
  });
224
- const Pr = o.object({
224
+ const Rr = o.object({
225
225
  client_id: o.string(),
226
226
  sprite_id: o.string().nullable(),
227
227
  name: o.string(),
@@ -239,13 +239,13 @@ const Pr = o.object({
239
239
  video_ready_state: o.number().int().default(-1)
240
240
  });
241
241
  o.object({
242
- clients: o.array(Pr),
242
+ clients: o.array(Rr),
243
243
  server_ts: o.number().int().nonnegative()
244
244
  });
245
245
  o.object({
246
246
  media_id: o.string()
247
247
  });
248
- const st = o.enum(["super_upvote", "upvote", "mid", "downvote"]), Rr = o.object({
248
+ const st = o.enum(["super_upvote", "upvote", "mid", "downvote"]), Dr = o.object({
249
249
  mediaId: o.string(),
250
250
  displayName: o.string(),
251
251
  // Enrichment fields — present for flat-playlist ingest output, absent for
@@ -256,11 +256,11 @@ const st = o.enum(["super_upvote", "upvote", "mid", "downvote"]), Rr = o.object(
256
256
  durationMs: o.number().optional(),
257
257
  uploadDate: o.string().optional()
258
258
  // YouTube upload date 'YYYY-MM-DD'; drives playlist order
259
- }), Dr = o.enum(["basic", "vote"]), an = o.object({
259
+ }), Or = o.enum(["basic", "vote"]), sn = o.object({
260
260
  id: o.string(),
261
261
  name: o.string(),
262
- type: Dr.default("vote"),
263
- videos: o.array(Rr),
262
+ type: Or.default("vote"),
263
+ videos: o.array(Dr),
264
264
  cover: o.string().optional()
265
265
  // media-relative path to the playlist cover image
266
266
  });
@@ -274,22 +274,22 @@ o.object({
274
274
  o.object({ voterKey: o.string().min(1).max(128) });
275
275
  o.object({ playlistId: o.string(), mediaIds: o.array(o.string()) });
276
276
  o.object({
277
- playlist: an.nullable(),
277
+ playlist: sn.nullable(),
278
278
  activeIndex: o.number().int().nullable(),
279
279
  myVotes: o.record(o.string(), st)
280
280
  // mediaId -> VoteValue
281
281
  });
282
- const Or = o.object({
282
+ const Lr = o.object({
283
283
  clientId: o.string(),
284
284
  name: o.string(),
285
285
  votedCount: o.number().int().nonnegative(),
286
286
  totalVideos: o.number().int().nonnegative()
287
287
  });
288
288
  o.object({
289
- progress: o.array(Or)
289
+ progress: o.array(Lr)
290
290
  });
291
291
  o.object({
292
- playlist: an,
292
+ playlist: sn,
293
293
  votes: o.record(o.string(), o.record(o.string(), st)),
294
294
  // votes[clientId][mediaId]
295
295
  names: o.record(o.string(), o.string()),
@@ -315,17 +315,17 @@ const we = {
315
315
  RESULTS: "playlist_results",
316
316
  /** Server -> the removed voter: forget the ballot you hold in localStorage. */
317
317
  VOTES_CLEARED: "playlist_votes_cleared"
318
- }, sn = o.object({
318
+ }, ln = o.object({
319
319
  id: o.string(),
320
320
  displayName: o.string(),
321
321
  thumbnail: o.string().optional()
322
322
  });
323
323
  o.object({
324
- items: o.array(sn)
324
+ items: o.array(ln)
325
325
  });
326
- const ln = o.partialRecord(Te, o.array(o.string()));
327
- o.object({ board: ln });
328
- const Lr = o.object({
326
+ const cn = o.partialRecord(Te, o.array(o.string()));
327
+ o.object({ board: cn });
328
+ const Mr = o.object({
329
329
  mediaId: o.string(),
330
330
  tier: Te,
331
331
  absoluteTier: Te,
@@ -338,8 +338,8 @@ const Lr = o.object({
338
338
  // opaque voterId -> the letter they gave
339
339
  });
340
340
  o.object({
341
- items: o.array(sn),
342
- placed: o.array(Lr),
341
+ items: o.array(ln),
342
+ placed: o.array(Mr),
343
343
  unrated: o.array(o.string()),
344
344
  spread: o.number(),
345
345
  nudged: o.boolean(),
@@ -349,9 +349,9 @@ o.object({
349
349
  * browser on a newer bundle still reads an older server's board. */
350
350
  pictures: o.record(o.string(), o.string()).optional(),
351
351
  voterCount: o.number().int().nonnegative(),
352
- myBoard: ln
352
+ myBoard: cn
353
353
  });
354
- const Mr = {
354
+ const jr = {
355
355
  /** Broadcast to EVERY connected socket when anyone saves. Carries no board —
356
356
  * it is a "re-fetch" ping, because the shared result is identical for all
357
357
  * viewers but `myBoard` is not, and one payload cannot serve both. */
@@ -364,10 +364,10 @@ o.object({
364
364
  ready: o.array(o.string())
365
365
  // clientIds who have flagged ready
366
366
  });
367
- const jr = {
367
+ const Ur = {
368
368
  STATE: "ready_check_state"
369
369
  // distinct from buffer-readiness 'ready_state'
370
- }, cn = {
370
+ }, dn = {
371
371
  ACTIVE: "game_active",
372
372
  // server -> room (the open game id; null = none)
373
373
  SYNC: "game_sync"
@@ -379,7 +379,7 @@ o.object({
379
379
  o.object({
380
380
  gameId: o.string().nullable()
381
381
  });
382
- const Ur = [
382
+ const Hr = [
383
383
  {
384
384
  id: "fantasy",
385
385
  characters: [
@@ -423,37 +423,37 @@ const Ur = [
423
423
  { id: "mentor", color: "#e1e0dc" }
424
424
  ]
425
425
  }
426
- ], lt = Ur.flatMap((e) => e.characters), Fe = lt.map((e) => e.id), Hr = Object.fromEntries(lt.map((e) => [e.id, e.color])), Fr = Object.fromEntries(lt.map((e) => [e.id, "rev" in e ? e.rev : 1]));
427
- function $r(e) {
428
- const t = Fr[e];
426
+ ], lt = Hr.flatMap((e) => e.characters), Fe = lt.map((e) => e.id), Fr = Object.fromEntries(lt.map((e) => [e.id, e.color])), $r = Object.fromEntries(lt.map((e) => [e.id, "rev" in e ? e.rev : 1]));
427
+ function Br(e) {
428
+ const t = $r[e];
429
429
  return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
430
430
  }
431
431
  function ct(e) {
432
432
  return !!e && Fe.includes(e);
433
433
  }
434
- const Br = 5e3, dn = { mode: "off", percent: 0 }, Gr = ["off", "on", "ab"];
435
- function Wr(e) {
436
- return typeof e == "string" && Gr.includes(e);
437
- }
434
+ const Gr = 5e3, un = { mode: "off", percent: 0 }, Wr = ["off", "on", "ab"];
438
435
  function qr(e) {
439
- const t = e && typeof e == "object" ? e : {}, n = Wr(t.mode) ? t.mode : dn.mode, r = Number(t.percent), a = Number.isFinite(r) ? Math.min(100, Math.max(0, Math.round(r))) : 0;
440
- return { mode: n, percent: a };
436
+ return typeof e == "string" && Wr.includes(e);
441
437
  }
442
438
  function Vr(e) {
439
+ const t = e && typeof e == "object" ? e : {}, n = qr(t.mode) ? t.mode : un.mode, r = Number(t.percent), a = Number.isFinite(r) ? Math.min(100, Math.max(0, Math.round(r))) : 0;
440
+ return { mode: n, percent: a };
441
+ }
442
+ function Kr(e) {
443
443
  let t = 2166136261;
444
444
  for (let n = 0; n < e.length; n++)
445
445
  t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
446
446
  return t >>> 0;
447
447
  }
448
- function Kr(e, t, n) {
448
+ function Yr(e, t, n) {
449
449
  if (n === !0)
450
450
  return "fragment";
451
451
  if (n === !1)
452
452
  return "range";
453
- const r = qr(e);
454
- return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t && Vr(t) % 100 < r.percent ? "fragment" : "range";
453
+ const r = Vr(e);
454
+ return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t && Kr(t) % 100 < r.percent ? "fragment" : "range";
455
455
  }
456
- const un = o.enum(["url", "magnet", "upload"]), Yr = o.enum([
456
+ const mn = o.enum(["url", "magnet", "upload"]), zr = o.enum([
457
457
  "pending",
458
458
  "approved",
459
459
  "fetching",
@@ -471,11 +471,11 @@ const un = o.enum(["url", "magnet", "upload"]), Yr = o.enum([
471
471
  failed: ["approved"]
472
472
  };
473
473
  Object.keys(Tt).filter((e) => Tt[e].length === 0);
474
- const zr = o.object({
474
+ const Xr = o.object({
475
475
  id: o.string().min(1),
476
476
  /** Stable userId from whoami. Never the raw `X-User-Key`. */
477
477
  ownerUserId: o.string().min(1),
478
- kind: un,
478
+ kind: mn,
479
479
  /** The magnet URI, the https URL, or the filetransfer binding id. */
480
480
  source: o.string().min(1),
481
481
  title: o.string().optional(),
@@ -490,7 +490,7 @@ const zr = o.object({
490
490
  * misroute the copy.
491
491
  */
492
492
  series: o.string().optional(),
493
- state: Yr,
493
+ state: zr,
494
494
  createdAt: o.number().int().nonnegative(),
495
495
  updatedAt: o.number().int().nonnegative(),
496
496
  /** Why it failed, or why an operator rejected it. */
@@ -498,19 +498,19 @@ const zr = o.object({
498
498
  /** Size once known. 0 means "known to be empty"; absent means "not yet known" —
499
499
  * the same distinction `chatImages` draws for image dimensions. */
500
500
  bytes: o.number().int().nonnegative().optional()
501
- }), Xr = 4096, mn = 300, Jr = 100;
501
+ }), Jr = 4096, fn = 300, Qr = 100;
502
502
  o.object({
503
- kind: un,
504
- source: o.string().min(1).max(Xr),
505
- title: o.string().min(1).max(mn).optional(),
503
+ kind: mn,
504
+ source: o.string().min(1).max(Jr),
505
+ title: o.string().min(1).max(fn).optional(),
506
506
  /** Required for `kind: 'magnet'` by `checkSource`; ignored for `url`/`upload`. */
507
- series: o.string().min(1).max(Jr).optional()
507
+ series: o.string().min(1).max(Qr).optional()
508
508
  });
509
509
  o.object({
510
- reason: o.string().min(1).max(mn).optional()
510
+ reason: o.string().min(1).max(fn).optional()
511
511
  });
512
512
  o.object({
513
- submissions: o.array(zr)
513
+ submissions: o.array(Xr)
514
514
  });
515
515
  o.object({
516
516
  error: o.literal("submissions/quota_exceeded"),
@@ -519,8 +519,8 @@ o.object({
519
519
  /** The cap that was applied, from the server's config. */
520
520
  capBytes: o.number().int().nonnegative()
521
521
  });
522
- const Qr = /^[a-z0-9][a-z0-9-]{0,31}$/, kt = "https://game-catalog.invalid";
523
- function Zr(e) {
522
+ const Zr = /^[a-z0-9][a-z0-9-]{0,31}$/, kt = "https://game-catalog.invalid";
523
+ function eo(e) {
524
524
  if (!e.startsWith("/") || e.startsWith("//") || /[\\\s]/.test(e) || [...e].some((t) => t.charCodeAt(0) < 32 || t.charCodeAt(0) === 127))
525
525
  return !1;
526
526
  try {
@@ -529,15 +529,15 @@ function Zr(e) {
529
529
  return !1;
530
530
  }
531
531
  }
532
- const fn = o.string().min(2).max(512).refine(Zr, {
532
+ const pn = o.string().min(2).max(512).refine(eo, {
533
533
  message: "must be a root-relative path on the page origin (e.g. /cardtable/embed/x.js)"
534
- }), eo = {
535
- id: o.string().regex(Qr),
534
+ }), to = {
535
+ id: o.string().regex(Zr),
536
536
  name: o.string().min(1).max(64),
537
- cover: fn.optional()
538
- }, to = o.object({ ...eo, kind: o.literal("module"), url: fn }).strict();
539
- o.array(to).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" });
540
- const dt = o.enum(["anilist", "tmdb"]), no = o.object({
537
+ cover: pn.optional()
538
+ }, no = o.object({ ...to, kind: o.literal("module"), url: pn }).strict();
539
+ o.array(no).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" });
540
+ const dt = o.enum(["anilist", "tmdb"]), ro = o.object({
541
541
  source: dt,
542
542
  /** The provider's own id, as a string (AniList and TMDB both use integers). */
543
543
  id: o.string(),
@@ -559,11 +559,11 @@ const dt = o.enum(["anilist", "tmdb"]), no = o.object({
559
559
  addable: o.boolean()
560
560
  });
561
561
  o.object({
562
- results: o.array(no),
562
+ results: o.array(ro),
563
563
  /** Providers that answered. TMDB is absent when no token is configured. */
564
564
  sources: o.array(dt)
565
565
  });
566
- const ro = o.object({
566
+ const oo = o.object({
567
567
  id: o.string(),
568
568
  url: o.string(),
569
569
  title: o.string(),
@@ -571,30 +571,30 @@ const ro = o.object({
571
571
  durationS: o.number().nullable(),
572
572
  thumb: o.string().nullable()
573
573
  });
574
- o.object({ results: o.array(ro) });
574
+ o.object({ results: o.array(oo) });
575
575
  o.object({
576
576
  source: dt,
577
577
  id: o.string().regex(/^\d{1,12}$/)
578
578
  });
579
579
  o.object({ series: o.string(), title: o.string() });
580
- let Se = null, pn = Qt;
581
- function oo(e) {
582
- e.cdnBase && (pn = e.cdnBase);
580
+ let Se = null, hn = Zt;
581
+ function ao(e) {
582
+ e.cdnBase && (hn = e.cdnBase);
583
583
  }
584
- function hn() {
585
- return pn.replace(/\/+$/, "");
584
+ function gn() {
585
+ return hn.replace(/\/+$/, "");
586
586
  }
587
587
  function $e() {
588
- const e = hn();
589
- return (!Se || Se.base !== e) && (Se = { base: e, client: Zn({ cdnBase: e }) }), Se.client;
588
+ const e = gn();
589
+ return (!Se || Se.base !== e) && (Se = { base: e, client: er({ cdnBase: e }) }), Se.client;
590
590
  }
591
591
  function Le(e) {
592
- return !at(e) || !hn() ? null : $e().urlFor(e);
592
+ return !at(e) || !gn() ? null : $e().urlFor(e);
593
593
  }
594
- function ao(e) {
594
+ function io(e) {
595
595
  return e.kind === "file";
596
596
  }
597
- class gn extends Error {
597
+ class yn extends Error {
598
598
  constructor(t) {
599
599
  super(t), this.name = "ChatImageUploadError";
600
600
  }
@@ -619,42 +619,42 @@ function ke(e) {
619
619
  return "Image upload failed";
620
620
  }
621
621
  }
622
- function io(e) {
623
- return e instanceof Je ? ke(e.reason) : e instanceof gn ? e.message : "Image upload failed";
624
- }
625
622
  function so(e) {
626
- const t = e.type.toLowerCase().split(";")[0].trim();
627
- return t && er(t) !== "image" ? ke("unsupported-type") : e.size > tr.image ? ke("too-large") : e.size === 0 ? ke("invalid") : null;
623
+ return e instanceof Je ? ke(e.reason) : e instanceof yn ? e.message : "Image upload failed";
628
624
  }
629
625
  function lo(e) {
630
- return rr(e);
626
+ const t = e.type.toLowerCase().split(";")[0].trim();
627
+ return t && tr(t) !== "image" ? ke("unsupported-type") : e.size > nr.image ? ke("too-large") : e.size === 0 ? ke("invalid") : null;
631
628
  }
632
629
  function co(e) {
633
630
  return or(e);
634
631
  }
635
- async function uo(e) {
636
- const t = await nr(e);
632
+ function uo(e) {
633
+ return ar(e);
634
+ }
635
+ async function mo(e) {
636
+ const t = await rr(e);
637
637
  return { w: t?.width ?? 0, h: t?.height ?? 0 };
638
638
  }
639
- async function mo(e, t = {}) {
639
+ async function fo(e, t = {}) {
640
640
  const n = await $e().upload(e, { signal: t.signal });
641
641
  if (!at(n.key))
642
- throw new gn("Image upload returned an unusable key");
642
+ throw new yn("Image upload returned an unusable key");
643
643
  return { key: n.key, deduplicated: n.deduplicated === !0 };
644
644
  }
645
- async function fo(e, t = {}) {
645
+ async function po(e, t = {}) {
646
646
  const n = [];
647
647
  for (const r of e) {
648
648
  if (r.kind === "remote") {
649
649
  n.push({ key: r.key, w: r.w, h: r.h, ...r.title ? { title: r.title } : {} });
650
650
  continue;
651
651
  }
652
- const { key: a } = await mo(r.file, t);
652
+ const { key: a } = await fo(r.file, t);
653
653
  n.push({ key: a, w: r.w, h: r.h });
654
654
  }
655
655
  return n;
656
656
  }
657
- function po(e) {
657
+ function ho(e) {
658
658
  return {
659
659
  error: e instanceof Error ? e.message : String(e),
660
660
  name: e instanceof Error ? e.name : typeof e,
@@ -665,33 +665,33 @@ function po(e) {
665
665
  function ut(e) {
666
666
  return e.key === "Escape" || e.key === "GoBack" || e.key === "BrowserBack" || e.key === "XF86Back" || e.keyCode === 461 || e.keyCode === 10009;
667
667
  }
668
- function ho(e) {
668
+ function go(e) {
669
669
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
670
670
  }
671
- function go({ className: e }) {
671
+ function yo({ className: e }) {
672
672
  return /* @__PURE__ */ c(
673
673
  "a",
674
674
  {
675
- href: ho(window.location),
675
+ href: go(window.location),
676
676
  className: e,
677
677
  "data-testid": "sign-in-with-code",
678
678
  children: "Sign in with a code"
679
679
  }
680
680
  );
681
681
  }
682
- const Ze = 240, ee = 8, yo = 28, yn = 240;
683
- function bo(e, t, n) {
682
+ const Ze = 240, ee = 8, bo = 28, bn = 240;
683
+ function vo(e, t, n) {
684
684
  let r = t.left - Ze - ee;
685
685
  r < ee && (r = t.right + ee), r = Math.min(r, n.width - Ze - ee), r = Math.max(ee, r);
686
- const a = yn + yo;
686
+ const a = bn + bo;
687
687
  let i = e.top + e.height / 2 - a / 2;
688
688
  return i = Math.min(i, n.height - a - ee), i = Math.max(ee, i), { left: r, top: i };
689
689
  }
690
- const bn = "/dataplatform/api/memes", vo = 120;
691
- function wo({ onClose: e, onPick: t, onUnavailable: n }) {
692
- const [r, a] = P(""), i = G(null), s = G(null), l = $e(), { items: f, loading: h, error: u, hasMore: L, loadMore: R } = _r(
690
+ const vn = "/dataplatform/api/memes", wo = 120;
691
+ function So({ onClose: e, onPick: t, onUnavailable: n }) {
692
+ const [r, a] = P(""), i = G(null), s = G(null), l = $e(), { items: f, loading: h, error: u, hasMore: L, loadMore: R } = xr(
693
693
  l,
694
- bn,
694
+ vn,
695
695
  r.trim()
696
696
  ), D = u?.reason ?? null, U = te(() => {
697
697
  const C = /* @__PURE__ */ new Set();
@@ -706,12 +706,12 @@ function wo({ onClose: e, onPick: t, onUnavailable: n }) {
706
706
  if (!oe) return;
707
707
  const ae = () => x({
708
708
  item: C,
709
- ...bo(O.getBoundingClientRect(), oe.getBoundingClientRect(), {
709
+ ...vo(O.getBoundingClientRect(), oe.getBoundingClientRect(), {
710
710
  width: window.innerWidth,
711
711
  height: window.innerHeight
712
712
  })
713
713
  });
714
- y(), k ? ae() : S.current = window.setTimeout(ae, vo);
714
+ y(), k ? ae() : S.current = window.setTimeout(ae, wo);
715
715
  },
716
716
  [y]
717
717
  );
@@ -769,7 +769,7 @@ function wo({ onClose: e, onPick: t, onUnavailable: n }) {
769
769
  "data-reason": D,
770
770
  children: D === "unauthenticated" ? /* @__PURE__ */ w(se, { children: [
771
771
  "Sign in to browse memes · ",
772
- /* @__PURE__ */ c(go, { className: "underline text-on-danger-bg" })
772
+ /* @__PURE__ */ c(yo, { className: "underline text-on-danger-bg" })
773
773
  ] }) : D === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
774
774
  }
775
775
  ),
@@ -843,7 +843,7 @@ function wo({ onClose: e, onPick: t, onUnavailable: n }) {
843
843
  src: Le(p.item.key) ?? void 0,
844
844
  alt: "",
845
845
  className: "block w-full rounded bg-bg object-contain",
846
- style: { height: "auto", maxHeight: yn }
846
+ style: { height: "auto", maxHeight: bn }
847
847
  }
848
848
  ),
849
849
  p.item.title && /* One line. A long title must not change the box height, because
@@ -856,43 +856,43 @@ function wo({ onClose: e, onPick: t, onUnavailable: n }) {
856
856
  }
857
857
  );
858
858
  }
859
- function So({ open: e, ...t }) {
860
- return e ? /* @__PURE__ */ c(wo, { ...t }) : null;
859
+ function _o({ open: e, ...t }) {
860
+ return e ? /* @__PURE__ */ c(So, { ...t }) : null;
861
861
  }
862
862
  const mt = {
863
863
  serverOrigin: `http://localhost:${it}`,
864
864
  defaultRoomKey: "dev-room",
865
- cdnBase: Qt
865
+ cdnBase: Zt
866
866
  };
867
867
  let Ee = { ...mt };
868
- function _o(e) {
868
+ function xo(e) {
869
869
  const t = Object.fromEntries(
870
870
  Object.entries(e).filter(([n, r]) => r !== void 0)
871
871
  );
872
- Ee = { ...Ee, ...t }, oo({ cdnBase: Ee.cdnBase });
872
+ Ee = { ...Ee, ...t }, ao({ cdnBase: Ee.cdnBase });
873
873
  }
874
874
  function be() {
875
875
  return Ee;
876
876
  }
877
- const xo = ot(mt);
878
- function Co(e) {
877
+ const Co = ot(mt);
878
+ function Io(e) {
879
879
  return e.serverOrigin?.replace(/\/$/, "") || "";
880
880
  }
881
- function vn() {
882
- return Co(be());
883
- }
884
- const wn = ot(null);
885
- function Io() {
886
- return Xt(wn);
881
+ function wn() {
882
+ return Io(be());
887
883
  }
888
- const Sn = ot(!0);
884
+ const Sn = ot(null);
889
885
  function To() {
890
- const e = Xt(Sn);
886
+ return Xt(Sn);
887
+ }
888
+ const _n = ot(!0);
889
+ function ko() {
890
+ const e = Xt(_n);
891
891
  A(() => {
892
- e && ar();
892
+ e && ir();
893
893
  }, [e]);
894
894
  }
895
- function ko(e) {
895
+ function Eo(e) {
896
896
  return e ? { "--hc-base": e } : {};
897
897
  }
898
898
  const et = Oe.memo(
@@ -901,7 +901,7 @@ const et = Oe.memo(
901
901
  },
902
902
  (e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
903
903
  );
904
- function Eo(e, t) {
904
+ function Ao(e, t) {
905
905
  A(() => {
906
906
  const n = e.current;
907
907
  if (!n || !t || typeof IntersectionObserver > "u") return;
@@ -941,7 +941,7 @@ function ft(e, t) {
941
941
  return !1;
942
942
  }
943
943
  }
944
- function Ao() {
944
+ function No() {
945
945
  try {
946
946
  const e = Be();
947
947
  if (!e) return [];
@@ -961,45 +961,45 @@ function Me(e) {
961
961
  } catch {
962
962
  }
963
963
  }
964
- function No(e) {
964
+ function Po(e) {
965
965
  const t = B(e);
966
966
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
967
967
  }
968
- const _n = /* @__PURE__ */ new Map();
969
- let xn = !1;
968
+ const xn = /* @__PURE__ */ new Map();
969
+ let Cn = !1;
970
970
  function Ge(e, t) {
971
- _n.set(e, t), xn && Cn(e, t);
971
+ xn.set(e, t), Cn && In(e, t);
972
972
  }
973
- function Po() {
974
- xn = !0;
975
- for (const [e, t] of _n) Cn(e, t);
973
+ function Ro() {
974
+ Cn = !0;
975
+ for (const [e, t] of xn) In(e, t);
976
976
  }
977
- function Cn(e, t) {
977
+ function In(e, t) {
978
978
  typeof window > "u" || (window[e] = t);
979
979
  }
980
- const fe = [], Ro = 500;
980
+ const fe = [], Do = 500;
981
981
  let Ae = [], tt = null;
982
- const Do = 1e3, Oo = 200;
982
+ const Oo = 1e3, Lo = 200;
983
983
  let nt = null;
984
- function In(e) {
984
+ function Tn(e) {
985
985
  nt = e;
986
986
  }
987
- function Tn() {
987
+ function kn() {
988
988
  return B(ce.REPORT_LOGS_FLAG) === "true";
989
989
  }
990
- function Lo() {
990
+ function Mo() {
991
991
  if (typeof window > "u") return !1;
992
992
  if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
993
993
  const t = B(ce.DEBUG_FLAG);
994
994
  return t !== null && t !== "false";
995
995
  }
996
- function Mo() {
996
+ function jo() {
997
997
  const e = B(ce.DEBUG_FLAG);
998
998
  if (!e || e === "true") return null;
999
999
  const t = e.split(",").map((n) => n.trim().toLowerCase()).filter(Boolean);
1000
1000
  return t.length > 0 ? new Set(t) : null;
1001
1001
  }
1002
- function jo() {
1002
+ function Uo() {
1003
1003
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
1004
1004
  hour12: !1,
1005
1005
  hour: "2-digit",
@@ -1008,8 +1008,8 @@ function jo() {
1008
1008
  fractionalSecondDigits: 3
1009
1009
  });
1010
1010
  }
1011
- function Uo(e) {
1012
- fe.push(e), fe.length > Ro && fe.shift();
1011
+ function Ho(e) {
1012
+ fe.push(e), fe.length > Do && fe.shift();
1013
1013
  }
1014
1014
  const We = {
1015
1015
  debug: "color: #64748b; font-weight: normal;",
@@ -1018,7 +1018,7 @@ const We = {
1018
1018
  category: "color: #3b82f6; font-weight: bold;",
1019
1019
  time: "color: #6b7280; font-weight: normal;"
1020
1020
  };
1021
- function Ho(e) {
1021
+ function Fo(e) {
1022
1022
  try {
1023
1023
  return JSON.stringify(e);
1024
1024
  } catch {
@@ -1033,12 +1033,12 @@ function pt(e, t, n, r, a, i, s) {
1033
1033
  data: s,
1034
1034
  timestamp: Date.now()
1035
1035
  };
1036
- if (Uo(l), (n || Tn()) && Et(l), !r) {
1037
- if (!Lo()) return;
1038
- const u = Mo();
1036
+ if (Ho(l), (n || kn()) && Et(l), !r) {
1037
+ if (!Mo()) return;
1038
+ const u = jo();
1039
1039
  if (u && !u.has(a.toLowerCase())) return;
1040
1040
  }
1041
- const f = jo(), h = s !== void 0 ? " " + Ho(s) : "";
1041
+ const f = Uo(), h = s !== void 0 ? " " + Fo(s) : "";
1042
1042
  t(
1043
1043
  `%c[${f}]%c [${a}]%c ${i}${h}`,
1044
1044
  We.time,
@@ -1055,25 +1055,25 @@ function I(e, t, n) {
1055
1055
  function Ne(e, t, n) {
1056
1056
  pt("error", console.error, !0, !0, e, t, n);
1057
1057
  }
1058
- function Fo() {
1058
+ function $o() {
1059
1059
  return [...fe];
1060
1060
  }
1061
- function $o() {
1061
+ function Bo() {
1062
1062
  fe.length = 0;
1063
1063
  }
1064
- function Bo(e) {
1064
+ function Go(e) {
1065
1065
  const t = e && e.length > 0 ? e.join(",") : "true";
1066
1066
  ft(ce.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
1067
1067
  }
1068
- function Go() {
1068
+ function Wo() {
1069
1069
  Me(ce.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
1070
1070
  }
1071
- const Wo = 1024, qo = 5e4;
1072
- function Vo(e) {
1071
+ const qo = 1024, Vo = 5e4;
1072
+ function Ko(e) {
1073
1073
  if (e == null) return e;
1074
1074
  try {
1075
1075
  const t = JSON.stringify(e);
1076
- if (t.length <= Wo) return e;
1076
+ if (t.length <= qo) return e;
1077
1077
  if (typeof e == "object" && !Array.isArray(e)) {
1078
1078
  const n = {};
1079
1079
  for (const [r, a] of Object.entries(e)) {
@@ -1087,7 +1087,7 @@ function Vo(e) {
1087
1087
  return "[unserializable]";
1088
1088
  }
1089
1089
  }
1090
- async function Ko() {
1090
+ async function Yo() {
1091
1091
  if (Ae.length === 0) return;
1092
1092
  const e = Ae;
1093
1093
  Ae = [], tt = null;
@@ -1095,13 +1095,13 @@ async function Ko() {
1095
1095
  let n = be().serverOrigin || "";
1096
1096
  if ((n === "/" || !n) && typeof window < "u") {
1097
1097
  const l = window.location;
1098
- (l.hostname === "localhost" || l.hostname === "127.0.0.1") && l.port === String(en) ? n = `${l.protocol}//${l.hostname}:${it}` : n = l.origin;
1098
+ (l.hostname === "localhost" || l.hostname === "127.0.0.1") && l.port === String(tn) ? n = `${l.protocol}//${l.hostname}:${it}` : n = l.origin;
1099
1099
  }
1100
1100
  const r = `${n.replace(/\/$/, "")}/api/client-log`, a = e.map((l) => ({
1101
1101
  level: l.level,
1102
1102
  category: l.category,
1103
1103
  message: l.message,
1104
- data: Vo(l.data),
1104
+ data: Ko(l.data),
1105
1105
  timestamp: l.timestamp,
1106
1106
  url: typeof window < "u" ? window.location.href : void 0,
1107
1107
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
@@ -1111,7 +1111,7 @@ async function Ko() {
1111
1111
  let i = [], s = 0;
1112
1112
  for (const l of a) {
1113
1113
  const f = JSON.stringify(l).length + 1;
1114
- s + f > qo && i.length > 0 && (await fetch(r, {
1114
+ s + f > Vo && i.length > 0 && (await fetch(r, {
1115
1115
  method: "POST",
1116
1116
  headers: { "Content-Type": "application/json" },
1117
1117
  body: JSON.stringify({ logs: i })
@@ -1128,9 +1128,9 @@ async function Ko() {
1128
1128
  }
1129
1129
  function Et(e) {
1130
1130
  if (Ae.push(e), !tt) {
1131
- const t = Tn() ? Oo : Do;
1131
+ const t = kn() ? Lo : Oo;
1132
1132
  tt = setTimeout(() => {
1133
- Ko();
1133
+ Yo();
1134
1134
  }, t);
1135
1135
  }
1136
1136
  }
@@ -1138,16 +1138,16 @@ function ve(e) {
1138
1138
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
1139
1139
  }
1140
1140
  Ge("__wpDebug", {
1141
- enable: Bo,
1142
- disable: Go,
1143
- history: Fo,
1144
- clear: $o
1141
+ enable: Go,
1142
+ disable: Wo,
1143
+ history: $o,
1144
+ clear: Bo
1145
1145
  });
1146
- const Yo = 1280;
1147
- function zo(e) {
1148
- return e.screenWidth < Yo ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1146
+ const zo = 1280;
1147
+ function Xo(e) {
1148
+ return e.screenWidth < zo ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1149
1149
  }
1150
- function Xo() {
1150
+ function Jo() {
1151
1151
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
1152
1152
  return {
1153
1153
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -1157,11 +1157,11 @@ function Xo() {
1157
1157
  };
1158
1158
  }
1159
1159
  let At = null;
1160
- function Jo() {
1161
- return At ??= zo(Xo()), At;
1160
+ function Qo() {
1161
+ return At ??= Xo(Jo()), At;
1162
1162
  }
1163
1163
  function Nt() {
1164
- return Jo();
1164
+ return Qo();
1165
1165
  }
1166
1166
  const Q = {
1167
1167
  resolved: !1,
@@ -1171,23 +1171,23 @@ const Q = {
1171
1171
  function ht() {
1172
1172
  return Q.accountId ? Q.accountId : Q.resolved && Q.userType === "public" ? "anon" : null;
1173
1173
  }
1174
- function Qo(e) {
1174
+ function Zo(e) {
1175
1175
  Q.resolved = !0, e.userType && (Q.userType = e.userType), e.userId !== void 0 && (Q.accountId = e.userId && e.userId !== "public" ? e.userId : null);
1176
1176
  }
1177
1177
  function gt() {
1178
1178
  return Q.accountId ?? "public";
1179
1179
  }
1180
- function Zo() {
1180
+ function ea() {
1181
1181
  return ht() ?? "unscoped";
1182
1182
  }
1183
- function kn(e) {
1184
- return ct(e) ? Hr[e] : "var(--color-neutral-bg)";
1183
+ function En(e) {
1184
+ return ct(e) ? Fr[e] : "var(--color-neutral-bg)";
1185
1185
  }
1186
- function ea(e) {
1187
- return ct(e) ? `${be().serverOrigin.replace(/\/$/, "")}${$r(e)}` : void 0;
1186
+ function ta(e) {
1187
+ return ct(e) ? `${be().serverOrigin.replace(/\/$/, "")}${Br(e)}` : void 0;
1188
1188
  }
1189
1189
  let he = null, _e = null;
1190
- function ta() {
1190
+ function na() {
1191
1191
  return he ? Promise.resolve() : _e || (_e = (async () => {
1192
1192
  try {
1193
1193
  const e = be().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
@@ -1206,7 +1206,7 @@ function ne(e) {
1206
1206
  const t = e.toLowerCase();
1207
1207
  return Fe.some((n) => n === t) ? !0 : he ? Object.values(he).some((n) => n.toLowerCase() === t) : !1;
1208
1208
  }
1209
- const na = o.object({
1209
+ const ra = o.object({
1210
1210
  // Identity. There is deliberately NO `name`: a person's name is their
1211
1211
  // hadoku key-registry name, resolved by the server from whoami and renamed
1212
1212
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -1231,15 +1231,15 @@ const na = o.object({
1231
1231
  preferredAudioLang: o.string().optional(),
1232
1232
  subtitlesEnabled: o.boolean().optional(),
1233
1233
  subtitleStyle: o.string().optional()
1234
- }), pe = hr({
1234
+ }), pe = yr({
1235
1235
  appId: "watchparty",
1236
- schema: na
1237
- }), ra = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1236
+ schema: ra
1237
+ }), oa = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1238
1238
  function je(e) {
1239
1239
  const t = ht();
1240
1240
  return t ? `prefs-cache:${t}:${e}` : null;
1241
1241
  }
1242
- function oa() {
1242
+ function aa() {
1243
1243
  return ht() === null;
1244
1244
  }
1245
1245
  function Pt(e) {
@@ -1253,9 +1253,9 @@ function Pt(e) {
1253
1253
  return {};
1254
1254
  }
1255
1255
  }
1256
- function aa() {
1256
+ function ia() {
1257
1257
  let e = 0;
1258
- for (const t of Ao()) {
1258
+ for (const t of No()) {
1259
1259
  const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), r = t === Ue || t.startsWith(`${Ue}:`) && !t.endsWith(":_serverSynced_v1");
1260
1260
  if (!n && !r) continue;
1261
1261
  const a = B(t);
@@ -1273,12 +1273,12 @@ function aa() {
1273
1273
  }
1274
1274
  return e > 0 && d("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
1275
1275
  }
1276
- let En = null, An = null;
1276
+ let An = null, Nn = null;
1277
1277
  const Rt = /* @__PURE__ */ new Set();
1278
1278
  function yt() {
1279
- if (oa())
1279
+ if (aa())
1280
1280
  return d("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1281
- const e = Pt("portfolio"), t = Pt("watchparty"), n = Object.keys(e).length > 0 ? e : En ?? {}, r = Object.keys(t).length > 0 ? t : An ?? {}, a = gt() || "public";
1281
+ const e = Pt("portfolio"), t = Pt("watchparty"), n = Object.keys(e).length > 0 ? e : An ?? {}, r = Object.keys(t).length > 0 ? t : Nn ?? {}, a = gt() || "public";
1282
1282
  if (Rt.has(a))
1283
1283
  return d("preferences", "Loaded (sync, SDK-only after first read)", {
1284
1284
  uid: a,
@@ -1290,7 +1290,7 @@ function yt() {
1290
1290
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1291
1291
  }), { ...r, ...n };
1292
1292
  Rt.add(a);
1293
- const i = Pn() ?? {}, s = { ...i, ...r, ...n };
1293
+ const i = Rn() ?? {}, s = { ...i, ...r, ...n };
1294
1294
  return d("preferences", "Loaded (sync, first read — legacy + SDK)", {
1295
1295
  uid: a,
1296
1296
  sdkThemeKeys: Object.keys(n).length,
@@ -1300,30 +1300,30 @@ function yt() {
1300
1300
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1301
1301
  }), s;
1302
1302
  }
1303
- let Nn = !1;
1304
- function ia() {
1303
+ let Pn = !1;
1304
+ function sa() {
1305
1305
  const e = gt();
1306
1306
  return !e || e === "public";
1307
1307
  }
1308
1308
  function q(e, t) {
1309
- ia() && (Nn = !0), ra.has(e) ? me.save({ [e]: t }, { scope: "device" }).catch((n) => I("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : pe.save({ [e]: t }).catch((n) => I("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), d("preferences", "Saved (via SDK)", { key: e, value: t });
1309
+ sa() && (Pn = !0), oa.has(e) ? me.save({ [e]: t }, { scope: "device" }).catch((n) => I("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : pe.save({ [e]: t }).catch((n) => I("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), d("preferences", "Saved (via SDK)", { key: e, value: t });
1310
1310
  }
1311
1311
  let xe = null, Dt = !1;
1312
- function sa() {
1312
+ function la() {
1313
1313
  return xe || (xe = (async () => {
1314
1314
  if (typeof window > "u") return !1;
1315
1315
  try {
1316
1316
  Dt || (Dt = !0, me.subscribe((s) => {
1317
- En = s, Mt("portfolio", s), jt("theme");
1317
+ An = s, Mt("portfolio", s), jt("theme");
1318
1318
  }), pe.subscribe((s) => {
1319
- An = s, Mt("watchparty", s), jt("watchparty");
1319
+ Nn = s, Mt("watchparty", s), jt("watchparty");
1320
1320
  }));
1321
1321
  const [e, t] = await Promise.all([
1322
1322
  me.read(),
1323
1323
  pe.read()
1324
1324
  ]);
1325
1325
  try {
1326
- const { useAppStore: s } = await Promise.resolve().then(() => On);
1326
+ const { useAppStore: s } = await Promise.resolve().then(() => Ln);
1327
1327
  s.getState().rehydrateFromPrefs();
1328
1328
  } catch (s) {
1329
1329
  I("preferences", "inline rehydrate after SDK read failed", { err: s?.message });
@@ -1335,7 +1335,7 @@ function sa() {
1335
1335
  // Post-fetch cache state: should be non-zero if SDK wrote it.
1336
1336
  sdkThemeBytesPost: a?.length ?? 0,
1337
1337
  sdkAppBytesPost: i?.length ?? 0
1338
- }), await la(e, t), Nn ? (d("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1338
+ }), await ca(e, t), Pn ? (d("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1339
1339
  me.promoteAnonPrefsToUser().catch(() => {
1340
1340
  }),
1341
1341
  pe.promoteAnonPrefsToUser().catch(() => {
@@ -1347,12 +1347,12 @@ function sa() {
1347
1347
  })(), xe);
1348
1348
  }
1349
1349
  const Ue = "watchparty_preferences";
1350
- aa();
1350
+ ia();
1351
1351
  function rt() {
1352
1352
  const e = gt();
1353
1353
  return !e || e === "public" ? Ue : `${Ue}:${e}`;
1354
1354
  }
1355
- function Pn() {
1355
+ function Rn() {
1356
1356
  const e = B(rt());
1357
1357
  if (!e) return null;
1358
1358
  try {
@@ -1365,8 +1365,8 @@ function Pn() {
1365
1365
  function Ot() {
1366
1366
  Me(rt()), Me(`${rt()}:_serverSynced_v1`);
1367
1367
  }
1368
- async function la(e, t) {
1369
- const n = Pn();
1368
+ async function ca(e, t) {
1369
+ const n = Rn();
1370
1370
  if (!n || Object.keys(n).length === 0) return;
1371
1371
  const r = Object.keys(e ?? {}).length > 0, a = Object.keys(t ?? {}).length > 0, i = {}, s = {};
1372
1372
  for (const [h, u] of Object.entries(n))
@@ -1414,7 +1414,7 @@ function Mt(e, t) {
1414
1414
  }
1415
1415
  }
1416
1416
  function jt(e) {
1417
- Promise.resolve().then(() => On).then(({ useAppStore: t }) => {
1417
+ Promise.resolve().then(() => Ln).then(({ useAppStore: t }) => {
1418
1418
  try {
1419
1419
  t.getState().rehydrateFromPrefs();
1420
1420
  } catch (n) {
@@ -1422,16 +1422,16 @@ function jt(e) {
1422
1422
  }
1423
1423
  }).catch((t) => I("preferences", "store import failed", { reason: e, err: t?.message }));
1424
1424
  }
1425
- const Rn = 320, He = 240, bt = 640, ca = 320, da = 36, Ut = 16;
1425
+ const Dn = 320, He = 240, bt = 640, da = 320, ua = 36, Ut = 16;
1426
1426
  function Y(e, t) {
1427
- if (!Number.isFinite(e)) return Rn;
1427
+ if (!Number.isFinite(e)) return Dn;
1428
1428
  let n = bt;
1429
- return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - ca)), n = Math.max(n, He), Math.round(Math.min(n, Math.max(He, e)));
1429
+ return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - da)), n = Math.max(n, He), Math.round(Math.min(n, Math.max(He, e)));
1430
1430
  }
1431
1431
  function Ht(e, t, n, r) {
1432
1432
  return Y(e + (t - n), r);
1433
1433
  }
1434
- function ua(e, t, n) {
1434
+ function ma(e, t, n) {
1435
1435
  switch (t) {
1436
1436
  case "ArrowLeft":
1437
1437
  return Y(e + Ut, n);
@@ -1445,14 +1445,14 @@ function ua(e, t, n) {
1445
1445
  return null;
1446
1446
  }
1447
1447
  }
1448
- function ma(e, t) {
1449
- return { collapsed: e, width: e ? da : t };
1448
+ function fa(e, t) {
1449
+ return { collapsed: e, width: e ? ua : t };
1450
1450
  }
1451
- function Dn(e, t) {
1451
+ function On(e, t) {
1452
1452
  const n = new Set(t.map((i) => i.id)), r = t.reduce((i, s) => Math.max(i, s.ts), -1 / 0), a = e.filter((i) => !n.has(i.id) && i.ts > r);
1453
1453
  return a.length ? [...t, ...a] : t;
1454
1454
  }
1455
- const V = yt(), m = pr((e, t) => ({
1455
+ const V = yt(), m = hr((e, t) => ({
1456
1456
  ready: !1,
1457
1457
  name: "",
1458
1458
  sprite: null,
@@ -1462,7 +1462,7 @@ const V = yt(), m = pr((e, t) => ({
1462
1462
  chat: [],
1463
1463
  chatCollapsed: V.chatCollapsed ?? !1,
1464
1464
  chromeChatCollapsed: V.chromeChatCollapsed ?? !1,
1465
- chromeChatWidth: Y(V.chromeChatWidth ?? Rn),
1465
+ chromeChatWidth: Y(V.chromeChatWidth ?? Dn),
1466
1466
  // Hardcoded on for everyone — the per-user toggle was removed from the
1467
1467
  // control bar; FloatingChat + toggleFloatingChat code is kept for future
1468
1468
  // re-enablement but the value is no longer user-controllable.
@@ -1506,19 +1506,14 @@ const V = yt(), m = pr((e, t) => ({
1506
1506
  ensureAutoIdentity: () => e((n) => {
1507
1507
  if (n.name) return {};
1508
1508
  if (n.sprite) {
1509
- const a = ge(n.sprite);
1510
- return d("store", "Auto-identity: deriving name from the requested sprite", { name: a, sprite: n.sprite }), { name: a };
1509
+ const i = ge(n.sprite);
1510
+ return d("store", "Auto-identity: deriving name from the requested sprite", { name: i, sprite: n.sprite }), { name: i };
1511
+ }
1512
+ const r = Object.values(n.roster).map((i) => i.sprite), a = Qt(r, void 0, Fe);
1513
+ if (a) {
1514
+ const i = ge(a);
1515
+ return d("store", "Auto-identity assigned", { name: i, sprite: a }), { name: i, sprite: a };
1511
1516
  }
1512
- const r = new Set(Object.values(n.roster).map((a) => a.sprite).filter(Boolean));
1513
- d("store", "ensureAutoIdentity checking", {
1514
- rosterSize: Object.keys(n.roster).length,
1515
- usedSprites: Array.from(r)
1516
- });
1517
- for (const a of Fe)
1518
- if (!r.has(a)) {
1519
- const i = ge(a);
1520
- return d("store", "Auto-identity assigned", { name: i, sprite: a }), { name: i, sprite: a };
1521
- }
1522
1517
  return I("store", "All characters taken, leaving identity unset"), {};
1523
1518
  }),
1524
1519
  ensureMe: (n) => {
@@ -1565,7 +1560,7 @@ const V = yt(), m = pr((e, t) => ({
1565
1560
  appendChat: (n) => {
1566
1561
  d("chat", "Message appended", { id: n.id, from: n.name, isSystem: n.isSystem }), e((r) => ({ chat: [...r.chat, n].slice(-500) }));
1567
1562
  },
1568
- setChat: (n) => e((r) => ({ chat: Dn(r.chat, n).slice(-500) })),
1563
+ setChat: (n) => e((r) => ({ chat: On(r.chat, n).slice(-500) })),
1569
1564
  toggleChatCollapsed: () => e((n) => {
1570
1565
  const r = !n.chatCollapsed;
1571
1566
  return Nt() || q("chatCollapsed", r), { chatCollapsed: r };
@@ -1683,36 +1678,36 @@ const V = yt(), m = pr((e, t) => ({
1683
1678
  setSidebarTab: (n) => e((r) => r.sidebarTab === n && n !== "chat" ? { sidebarTab: "chat" } : { sidebarTab: n, chatCollapsed: !1 })
1684
1679
  }));
1685
1680
  Ge("__ZUSTAND_STORE__", m);
1686
- const On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1681
+ const Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1687
1682
  __proto__: null,
1688
- mergeHistory: Dn,
1683
+ mergeHistory: On,
1689
1684
  useAppStore: m
1690
1685
  }, Symbol.toStringTag, { value: "Module" }));
1691
- function Ln(e) {
1686
+ function Mn(e) {
1692
1687
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = new URL(e, t).pathname;
1693
1688
  return `${n.endsWith("/") ? n : `${n}/`}socket.io/`;
1694
1689
  }
1695
- function fa(e) {
1690
+ function pa(e) {
1696
1691
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/chat";
1697
1692
  return {
1698
1693
  url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
1699
- path: e.path ?? Ln(e.origin)
1694
+ path: e.path ?? Mn(e.origin)
1700
1695
  };
1701
1696
  }
1702
1697
  let K = null, Z = null, Pe = null;
1703
1698
  function Ft(e) {
1704
- e && K && e.origin === K.origin && e.path === K.path && e.namespace === K.namespace || !e && !K || (Mn(), K = e);
1699
+ e && K && e.origin === K.origin && e.path === K.path && e.namespace === K.namespace || !e && !K || (jn(), K = e);
1705
1700
  }
1706
1701
  function vt() {
1707
1702
  return K !== null;
1708
1703
  }
1709
- function pa(e) {
1704
+ function ha(e) {
1710
1705
  if (K)
1711
1706
  if (Pe = e, Z)
1712
1707
  Z.connected && Z.emit(v.JOIN, e);
1713
1708
  else {
1714
- const { url: t, path: n } = fa(K), r = Qe(t, { path: n, transports: ["websocket", "polling"] });
1715
- Z = r, d("chat", "External chat socket", { url: t, path: n }), jn(r), r.on(v.ERROR, (a) => {
1709
+ const { url: t, path: n } = pa(K), r = Qe(t, { path: n, transports: ["websocket", "polling"] });
1710
+ Z = r, d("chat", "External chat socket", { url: t, path: n }), Un(r), r.on(v.ERROR, (a) => {
1716
1711
  const i = a?.message || a?.code || "chat error";
1717
1712
  I("chat", `Chat server error: ${i}`, { code: a?.code }), m.getState().pushToast("error", i);
1718
1713
  }), r.on("connect", () => {
@@ -1720,10 +1715,10 @@ function pa(e) {
1720
1715
  }), r.on("connect_error", (a) => I("chat", "Chat connection error", { message: a?.message }));
1721
1716
  }
1722
1717
  }
1723
- function ha(e) {
1718
+ function ga(e) {
1724
1719
  Z?.emit(v.CHAT_SEND, e);
1725
1720
  }
1726
- function Mn() {
1721
+ function jn() {
1727
1722
  Pe = null, Z && (Z.disconnect(), Z = null);
1728
1723
  }
1729
1724
  function $t(e, t) {
@@ -1741,10 +1736,10 @@ function $t(e, t) {
1741
1736
  images: Array.isArray(e.images) ? e.images.filter((n) => !!n && at(n.key)).slice(0, J) : void 0,
1742
1737
  isSystem: e.isSystem || !1,
1743
1738
  systemType: e.systemType,
1744
- template: e.isSystem && typeof e.template == "string" && e.template.includes(on) ? e.template : void 0
1739
+ template: e.isSystem && typeof e.template == "string" && e.template.includes(an) ? e.template : void 0
1745
1740
  };
1746
1741
  }
1747
- function jn(e, t = () => !0) {
1742
+ function Un(e, t = () => !0) {
1748
1743
  e.on(v.CHAT_BROADCAST, (n) => {
1749
1744
  if (!t()) return;
1750
1745
  const r = { ...$t(n, n.server_seq), live: !0 };
@@ -1755,30 +1750,30 @@ function jn(e, t = () => !0) {
1755
1750
  m.getState().setChat(r), d("chat", "History loaded", { count: r.length });
1756
1751
  });
1757
1752
  }
1758
- let Un = null;
1759
- function ga(e) {
1760
- Un = e;
1753
+ let Hn = null;
1754
+ function ya(e) {
1755
+ Hn = e;
1761
1756
  }
1762
- function ya(e = Un) {
1757
+ function ba(e = Hn) {
1763
1758
  if (!e) return null;
1764
1759
  const t = typeof window < "u" ? window.location.href : "http://localhost/", n = e.namespace ?? "/room";
1765
1760
  return {
1766
1761
  url: `${new URL(e.origin, t).origin}${n.startsWith("/") ? n : `/${n}`}`,
1767
- path: e.path ?? Ln(e.origin)
1762
+ path: e.path ?? Mn(e.origin)
1768
1763
  };
1769
1764
  }
1770
- function ba(e) {
1771
- return `${vn()}/media/${e}`.replace(/\\/g, "/");
1765
+ function va(e) {
1766
+ return `${wn()}/media/${e}`.replace(/\\/g, "/");
1772
1767
  }
1773
- function va(e, t) {
1774
- return ba(t ?? `${e}/poster.jpg`);
1768
+ function wa(e, t) {
1769
+ return va(t ?? `${e}/poster.jpg`);
1775
1770
  }
1776
- function wa(e) {
1777
- return `${vn()}${e}`.replace(/\\/g, "/");
1771
+ function Sa(e) {
1772
+ return `${wn()}${e}`.replace(/\\/g, "/");
1778
1773
  }
1779
- async function Sa(e) {
1774
+ async function _a(e) {
1780
1775
  try {
1781
- const t = await fetch(wa("/api/tierlist"));
1776
+ const t = await fetch(Sa("/api/tierlist"));
1782
1777
  if (!t.ok)
1783
1778
  return I("tierlist", "Board fetch failed", { status: t.status }), null;
1784
1779
  const n = await t.json();
@@ -1792,39 +1787,39 @@ async function Sa(e) {
1792
1787
  }
1793
1788
  }
1794
1789
  let Bt = !1;
1795
- function _a() {
1790
+ function xa() {
1796
1791
  if (Bt || typeof Image > "u") return;
1797
1792
  const e = m.getState().tierlist;
1798
1793
  if (!(!e || e.items.length === 0)) {
1799
1794
  Bt = !0;
1800
1795
  for (const t of e.items) {
1801
1796
  const n = new Image();
1802
- n.decoding = "async", n.src = va(t.id, t.thumbnail);
1797
+ n.decoding = "async", n.src = wa(t.id, t.thumbnail);
1803
1798
  }
1804
1799
  d("tierlist", "Warming posters", { count: e.items.length });
1805
1800
  }
1806
1801
  }
1807
- function xa() {
1808
- const e = m.getState(), t = new Set(Object.values(e.roster).map((i) => i.sprite).filter(Boolean)), n = Fe.find((i) => !t.has(i));
1809
- if (!n)
1802
+ function Ca() {
1803
+ const e = m.getState(), t = Qt(Object.values(e.roster).map((a) => a.sprite), void 0, Fe);
1804
+ if (!t)
1810
1805
  return I("socket", "sprite_taken: no available sprites to retry with"), null;
1811
- const r = !!e.name && !ne(e.name), a = r ? e.name : ge(n);
1812
- return d("socket", "sprite_taken: retrying with next available", { from: e.sprite, to: n, name: a, keptCustomName: r }), e.setSessionIdentity(a, n), { name: a, sprite: n };
1806
+ const n = !!e.name && !ne(e.name), r = n ? e.name : ge(t);
1807
+ return d("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: r, keptCustomName: n }), e.setSessionIdentity(r, t), { name: r, sprite: t };
1813
1808
  }
1814
- function Ca(e) {
1809
+ function Ia(e) {
1815
1810
  const t = m.getState(), n = e ? t.roster[e] : void 0;
1816
1811
  return !n || !!n.sprite && n.sprite === t.sprite;
1817
1812
  }
1818
- const Ia = "hadoku:avatar", Ta = "hadoku:name";
1819
- function Hn(e) {
1813
+ const Ta = "hadoku:avatar", ka = "hadoku:name";
1814
+ function Fn(e) {
1820
1815
  const t = e?.sprite ?? e?.avatar?.sprite ?? null;
1821
1816
  return ct(t) ? t : null;
1822
1817
  }
1823
- async function ka(e = {}) {
1818
+ async function Ea(e = {}) {
1824
1819
  const t = e.fetch ?? (typeof fetch > "u" ? void 0 : fetch), n = typeof window > "u" ? void 0 : window.location?.origin, r = e.baseUrl ?? (n ? `${n}/prefs` : void 0);
1825
1820
  if (!t || !r) return null;
1826
1821
  try {
1827
- const a = await br({ baseUrl: r, fetch: t }).get(), i = Hn(a);
1822
+ const a = await wr({ baseUrl: r, fetch: t }).get(), i = Fn(a);
1828
1823
  return d("avatar", "Requested character from prefs-api", { sprite: i }), i;
1829
1824
  } catch (a) {
1830
1825
  return a instanceof Ct && (a.status === 401 || a.status === 403 || a.status === 404) ? d("avatar", "No avatar settings here (signed out, or no prefs-api on this origin)", { status: a.status }) : I("avatar", "Avatar settings read failed — keeping the auto-assigned character", {
@@ -1840,7 +1835,7 @@ function Gt(e) {
1840
1835
  const r = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !ne(t.name) ? t.name : ge(e);
1841
1836
  return t.setSessionIdentity(r, e), !0;
1842
1837
  }
1843
- function Fn(e, t, n) {
1838
+ function $n(e, t, n) {
1844
1839
  if (!n) return () => {
1845
1840
  };
1846
1841
  const r = (a) => {
@@ -1849,29 +1844,29 @@ function Fn(e, t, n) {
1849
1844
  };
1850
1845
  return n.addEventListener(e, r), () => n.removeEventListener(e, r);
1851
1846
  }
1852
- const $n = () => typeof window > "u" ? void 0 : window;
1853
- function Ea(e, t = $n()) {
1854
- return Fn(Ia, e, t);
1847
+ const Bn = () => typeof window > "u" ? void 0 : window;
1848
+ function Aa(e, t = Bn()) {
1849
+ return $n(Ta, e, t);
1855
1850
  }
1856
- function Aa(e, t = $n()) {
1857
- return Fn(Ta, (n) => {
1851
+ function Na(e, t = Bn()) {
1852
+ return $n(ka, (n) => {
1858
1853
  typeof n.name == "string" && n.name.trim() && e(n.name);
1859
1854
  }, t);
1860
1855
  }
1861
- const Na = 10;
1862
- function Pa(e = typeof window < "u" ? window : void 0) {
1856
+ const Pa = 10;
1857
+ function Ra(e = typeof window < "u" ? window : void 0) {
1863
1858
  if (!e) return { framed: !1, depth: 0 };
1864
1859
  try {
1865
1860
  let t = 0, n = e;
1866
- for (; n !== n.parent && t < Na; )
1861
+ for (; n !== n.parent && t < Pa; )
1867
1862
  t++, n = n.parent;
1868
1863
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
1869
1864
  } catch {
1870
1865
  return { framed: !1, depth: 0 };
1871
1866
  }
1872
1867
  }
1873
- const Ra = "watchparty_fragment_delivery";
1874
- function Da() {
1868
+ const Da = "watchparty_fragment_delivery";
1869
+ function Oa() {
1875
1870
  if (typeof window > "u") return null;
1876
1871
  try {
1877
1872
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -1879,43 +1874,43 @@ function Da() {
1879
1874
  if (e === "0" || e === "false") return !1;
1880
1875
  } catch {
1881
1876
  }
1882
- return No(Ra);
1877
+ return Po(Da);
1883
1878
  }
1884
- let Oa = { ...dn }, qe = null;
1879
+ let La = { ...un }, qe = null;
1885
1880
  const Wt = "watchparty_delivery_client_id";
1886
- function La() {
1881
+ function Ma() {
1887
1882
  const e = B(Wt);
1888
1883
  if (e) return e;
1889
1884
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
1890
1885
  return ft(Wt, t) ? t : "";
1891
1886
  }
1892
- function Ma() {
1893
- return qe === null && (qe = Kr(Oa, La(), Da())), qe;
1894
- }
1895
1887
  function ja() {
1896
- return Ma();
1888
+ return qe === null && (qe = Yr(La, Ma(), Oa())), qe;
1889
+ }
1890
+ function Ua() {
1891
+ return ja();
1897
1892
  }
1898
1893
  let Re;
1899
- function Bn() {
1900
- return B(yr) || void 0;
1894
+ function Gn() {
1895
+ return B(vr) || void 0;
1901
1896
  }
1902
- function Ua() {
1897
+ function Ha() {
1903
1898
  if (Re) return;
1904
- const e = Bn();
1899
+ const e = Gn();
1905
1900
  if (e) {
1906
1901
  Re = e;
1907
1902
  return;
1908
1903
  }
1909
- gr().then((t) => {
1904
+ br().then((t) => {
1910
1905
  t && (Re = t);
1911
1906
  }).catch(() => {
1912
1907
  d("identity", "device id unavailable — joining without one");
1913
1908
  });
1914
1909
  }
1915
- function Ha() {
1916
- return Re ??= Bn();
1910
+ function Fa() {
1911
+ return Re ??= Gn();
1917
1912
  }
1918
- function Fa(e, t) {
1913
+ function $a(e, t) {
1919
1914
  let n = 0;
1920
1915
  for (const r of e.videos) {
1921
1916
  const a = ce.voteKey(t, e.id, r.mediaId);
@@ -1923,49 +1918,49 @@ function Fa(e, t) {
1923
1918
  }
1924
1919
  return n;
1925
1920
  }
1926
- const $a = 2e4, Ba = 1e4;
1927
- function Ga() {
1921
+ const Ba = 2e4, Ga = 1e4;
1922
+ function Wa() {
1928
1923
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
1929
1924
  }
1930
- function Wa(e, t) {
1925
+ function qa(e, t) {
1931
1926
  e.lastPongAt = t, e.unansweredSince = null;
1932
1927
  }
1933
- function qa(e, t, n) {
1934
- const r = e.lastTickAt !== null && t - e.lastTickAt > Ba;
1935
- return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > $a : (e.unansweredSince = null, !1);
1928
+ function Va(e, t, n) {
1929
+ const r = e.lastTickAt !== null && t - e.lastTickAt > Ga;
1930
+ return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > Ba : (e.unansweredSince = null, !1);
1936
1931
  }
1937
- function Va(e, t) {
1932
+ function Ka(e, t) {
1938
1933
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
1939
1934
  }
1940
1935
  let _ = null, F = null, De = null, $ = null, z = null;
1941
- const Ka = Xa(), ie = Ga();
1942
- let Ce = null, Ve = null, qt = 0, wt = null, ye = !1, St = !1, ue = !1, Gn = null;
1943
- function Ya(e) {
1936
+ const Ya = Ja(), ie = Wa();
1937
+ let Ce = null, Ve = null, qt = 0, wt = null, ye = !1, St = !1, ue = !1, Wn = null;
1938
+ function za(e) {
1944
1939
  const t = re(), n = m.getState();
1945
1940
  if (n.me.clientId && n.roster[n.me.clientId])
1946
1941
  return (e.name || e.sprite) && (d("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(v.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1947
- const r = za(e);
1948
- return z = r, wt = { name: r.name, sprite: r.sprite }, vt() && pa(r), t.connected ? (d("socket", "Emitting join", r), t.emit(v.JOIN, r)) : t.once("connect", () => {
1942
+ const r = Xa(e);
1943
+ return z = r, wt = { name: r.name, sprite: r.sprite }, vt() && ha(r), t.connected ? (d("socket", "Emitting join", r), t.emit(v.JOIN, r)) : t.once("connect", () => {
1949
1944
  d("socket", "Emitting join", r), t.emit(v.JOIN, r);
1950
1945
  }), t;
1951
1946
  }
1952
- function za(e) {
1947
+ function Xa(e) {
1953
1948
  return {
1954
1949
  room_key: e.room_key,
1955
1950
  name: e.name,
1956
1951
  sprite: e.sprite,
1957
1952
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
1958
1953
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
1959
- embed: Pa(),
1960
- delivery_arm: ja(),
1954
+ embed: Ra(),
1955
+ delivery_arm: Ua(),
1961
1956
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
1962
1957
  // (lastJoinPayload carries it) so a reconnect lands on the same
1963
1958
  // ParticipantId rather than minting a new person.
1964
- device_id: Ha(),
1965
- tab_id: Ka
1959
+ device_id: Fa(),
1960
+ tab_id: Ya
1966
1961
  };
1967
1962
  }
1968
- function Xa() {
1963
+ function Ja() {
1969
1964
  const e = globalThis.crypto;
1970
1965
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
1971
1966
  const t = new Uint8Array(16);
@@ -1978,25 +1973,25 @@ function re() {
1978
1973
  let t = be().serverOrigin || "/";
1979
1974
  if (t === "/" && typeof window < "u") {
1980
1975
  const r = window.location;
1981
- (r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String(en) && (t = `${r.protocol}//${r.hostname}:${it}`, d("socket", "Using dev fallback origin", { origin: t }));
1976
+ (r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String(tn) && (t = `${r.protocol}//${r.hostname}:${it}`, d("socket", "Using dev fallback origin", { origin: t }));
1982
1977
  }
1983
- const n = ya();
1978
+ const n = ba();
1984
1979
  if (n)
1985
1980
  _ = Qe(n.url, { path: n.path, transports: ["websocket", "polling"] }), d("socket", "Socket initialized on the room origin", n);
1986
1981
  else {
1987
1982
  const r = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
1988
- _ = Qe(r, { path: xr, transports: ["websocket", "polling"] }), d("socket", "Socket initialized", { origin: t });
1983
+ _ = Qe(r, { path: Cr, transports: ["websocket", "polling"] }), d("socket", "Socket initialized", { origin: t });
1989
1984
  }
1990
1985
  Ge("__SOCKET__", _), $ && (clearTimeout($), $ = null), F = null, De = setInterval(() => {
1991
- if (qa(ie, Date.now(), !!_?.connected)) {
1986
+ if (Va(ie, Date.now(), !!_?.connected)) {
1992
1987
  I("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
1993
1988
  sid: _?.id,
1994
- lastPongAgeMs: Va(ie, Date.now()) ?? null
1989
+ lastPongAgeMs: Ka(ie, Date.now()) ?? null
1995
1990
  }), Ve = "pong-watchdog", ie.unansweredSince = null, _?.io.engine?.close();
1996
1991
  return;
1997
1992
  }
1998
- si();
1999
- }, Br), _.on("connect", () => {
1993
+ li();
1994
+ }, Gr), _.on("connect", () => {
2000
1995
  St = !1;
2001
1996
  const r = _?.id;
2002
1997
  if (d("socket", "Connected", { id: r, isReconnect: ue }), r)
@@ -2017,7 +2012,7 @@ function re() {
2017
2012
  reason: (Ce?.reason ?? "unknown").slice(0, 64),
2018
2013
  offline_ms: Ce ? Math.max(0, Date.now() - Ce.at) : 0
2019
2014
  }
2020
- }, s = Gn;
2015
+ }, s = Wn;
2021
2016
  if (d("socket", "Re-emitting join after reconnect", { room_key: i.room_key, name: i.name, sprite: i.sprite }), s) {
2022
2017
  let l = !1;
2023
2018
  const f = () => {
@@ -2031,17 +2026,17 @@ function re() {
2031
2026
  } else ue && I("socket", "Reconnected — no join payload, not re-joining any room");
2032
2027
  ue = !0;
2033
2028
  }), _.on("disconnect", (r) => {
2034
- In(null), Ce = { reason: Ve ?? r, at: Date.now() }, Ve = null, d("socket", "Disconnected", { reason: r });
2035
- }), _.on("connect_error", (r) => Ne("socket", "Connection error", { message: r?.message })), _.on("reconnect_attempt", (r) => I("socket", "Reconnect attempt", { attempt: r })), _.on("reconnect_failed", () => Ne("socket", "Reconnect failed")), ai(_);
2029
+ Tn(null), Ce = { reason: Ve ?? r, at: Date.now() }, Ve = null, d("socket", "Disconnected", { reason: r });
2030
+ }), _.on("connect_error", (r) => Ne("socket", "Connection error", { message: r?.message })), _.on("reconnect_attempt", (r) => I("socket", "Reconnect attempt", { attempt: r })), _.on("reconnect_failed", () => Ne("socket", "Reconnect failed")), ii(_);
2036
2031
  }
2037
2032
  return _;
2038
2033
  }
2039
2034
  function Ke(e) {
2040
2035
  return e.play_state === "playing" || e.playing === !0;
2041
2036
  }
2042
- function Ja(e) {
2037
+ function Qa(e) {
2043
2038
  e.on(v.SNAPSHOT, (t) => {
2044
- e.emit(cn.SYNC), m.getState().applySnapshot({
2039
+ e.emit(dn.SYNC), m.getState().applySnapshot({
2045
2040
  roomId: t.room_id ?? null,
2046
2041
  mediaId: t.media_id ?? null,
2047
2042
  playheadMs: t.playhead_ms || 0,
@@ -2049,7 +2044,7 @@ function Ja(e) {
2049
2044
  serverSeq: t.server_seq || 0,
2050
2045
  leaderId: t.leader_id || null
2051
2046
  }), m.getState().name || d("socket", "Deferring identity to presence event (snapshot carries no roster)");
2052
- const n = m.getState(), r = _?.id, i = (r ? n.roster[r] : void 0) ?? wt, s = vr(
2047
+ const n = m.getState(), r = _?.id, i = (r ? n.roster[r] : void 0) ?? wt, s = gr(
2053
2048
  { name: n.name, avatarId: n.sprite },
2054
2049
  i ? { name: i.name, avatarId: i.sprite ?? null } : void 0,
2055
2050
  // A join that carried no name counts as a default one, so a name that
@@ -2070,7 +2065,7 @@ function Ja(e) {
2070
2065
  leaderId: t.leader_id || null,
2071
2066
  serverSeq: t.server_seq || 0,
2072
2067
  rosterSize: Object.keys(n.roster).length
2073
- }), z?.room_key && _?.id && In({ room_key: z.room_key, client_id: _.id });
2068
+ }), z?.room_key && _?.id && Tn({ room_key: z.room_key, client_id: _.id });
2074
2069
  }), e.on(v.CONTROL_BROADCAST, (t) => {
2075
2070
  const n = m.getState();
2076
2071
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
@@ -2092,7 +2087,7 @@ function Ja(e) {
2092
2087
  }), e.on(v.CONTROL_ACK, (t) => {
2093
2088
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && d("socket", "Control ack received", t);
2094
2089
  }), e.on(v.TIME_PONG, (t) => {
2095
- if (Wa(ie, Date.now()), F && F.ts) {
2090
+ if (qa(ie, Date.now()), F && F.ts) {
2096
2091
  const n = Date.now() - F.ts;
2097
2092
  m.getState().addRttSample(n, t?.server_ts, F.ts), F = null, $ && (clearTimeout($), $ = null), d("socket", "Time sync RTT", { rtt: n, offset: m.getState().drift.offsetMs });
2098
2093
  }
@@ -2102,11 +2097,11 @@ function Ja(e) {
2102
2097
  m.getState().setReadiness({ mediaId: n, ready: i, readyCount: r, total: a }), d("socket", "Ready state received", { mediaId: n, readyCount: r, total: a, ready: i });
2103
2098
  });
2104
2099
  }
2105
- function Qa(e) {
2106
- const t = ir(e);
2100
+ function Za(e) {
2101
+ const t = sr(e);
2107
2102
  return t ? { cosmetics: t } : {};
2108
2103
  }
2109
- function Za(e) {
2104
+ function ei(e) {
2110
2105
  e.on(v.PRESENCE, (t) => {
2111
2106
  if (!t) return;
2112
2107
  if (Array.isArray(t.users)) {
@@ -2120,7 +2115,7 @@ function Za(e) {
2120
2115
  isLeader: l.is_leader,
2121
2116
  ...l.registry_name ? { registryName: !0 } : {},
2122
2117
  ...l.avatar_url ? { avatarUrl: l.avatar_url } : {},
2123
- ...Qa(l.cosmetics)
2118
+ ...Za(l.cosmetics)
2124
2119
  };
2125
2120
  const a = m.getState(), i = _?.id, s = i ? r[i] : void 0;
2126
2121
  if (s?.registryName)
@@ -2142,7 +2137,7 @@ function Za(e) {
2142
2137
  }
2143
2138
  });
2144
2139
  }
2145
- function ei(e) {
2140
+ function ti(e) {
2146
2141
  e.on(we.STATE, (t) => {
2147
2142
  m.getState().applyPlaylistState({
2148
2143
  playlist: t?.playlist ?? null,
@@ -2155,54 +2150,54 @@ function ei(e) {
2155
2150
  m.getState().setPlaylistResults(t ?? null), d("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2156
2151
  }), e.on(we.VOTES_CLEARED, (t) => {
2157
2152
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
2158
- const n = Fa(
2153
+ const n = $a(
2159
2154
  { id: t.playlistId, videos: t.mediaIds.map((a) => ({ mediaId: a })) },
2160
- Zo()
2155
+ ea()
2161
2156
  ), r = m.getState();
2162
2157
  r.playlist?.id === t.playlistId && r.applyPlaylistState({ playlist: r.playlist, activeIndex: r.activePlaylistIndex, myVotes: {} }), d("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: n });
2163
2158
  });
2164
2159
  }
2165
- function ti(e) {
2166
- e.on(Mr.UPDATED, () => {
2167
- d("tierlist", "Someone saved — refreshing the board"), Sa(!1);
2160
+ function ni(e) {
2161
+ e.on(jr.UPDATED, () => {
2162
+ d("tierlist", "Someone saved — refreshing the board"), _a(!1);
2168
2163
  });
2169
2164
  }
2170
- function ni(e) {
2171
- e.on(jr.STATE, (t) => {
2165
+ function ri(e) {
2166
+ e.on(Ur.STATE, (t) => {
2172
2167
  if (!t || typeof t.active != "boolean") return;
2173
2168
  const n = Array.isArray(t.ready) ? t.ready.filter((r) => typeof r == "string") : [];
2174
2169
  m.getState().setReadyCheckState({ active: t.active, ready: n }), d("ready-check", "State received", { active: t.active, readyCount: n.length });
2175
2170
  });
2176
2171
  }
2177
- function ri(e) {
2178
- e.on(cn.ACTIVE, (t) => {
2172
+ function oi(e) {
2173
+ e.on(dn.ACTIVE, (t) => {
2179
2174
  const n = typeof t?.gameId == "string" ? t.gameId : null;
2180
2175
  m.getState().setActiveGameId(n), d("game", "game_active", { gameId: n });
2181
2176
  });
2182
2177
  }
2183
- function oi(e) {
2178
+ function ai(e) {
2184
2179
  e.on(v.HEALTH_SNAPSHOT, (t) => {
2185
2180
  m.getState().setHealthSnapshot(t);
2186
2181
  }), e.on(v.BUFFER_STATUS, (t) => {
2187
2182
  m.getState().setBufferStatus(t);
2188
2183
  });
2189
2184
  }
2190
- function ai(e) {
2191
- Ja(e), Za(e), jn(e, () => !vt()), oi(e), ei(e), ti(e), ni(e), ri(e), e.on(v.ERROR, (t) => {
2185
+ function ii(e) {
2186
+ Qa(e), ei(e), Un(e, () => !vt()), ai(e), ti(e), ni(e), ri(e), oi(e), e.on(v.ERROR, (t) => {
2192
2187
  const n = t?.code || "error/unknown";
2193
2188
  if (n === "conflict" && t?.message === "sprite_held_by_you") {
2194
2189
  St = !0, d("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2195
2190
  return;
2196
2191
  }
2197
2192
  if (n === "conflict" && t?.message === "sprite_taken") {
2198
- if (Ca(_?.id)) {
2193
+ if (Ia(_?.id)) {
2199
2194
  d("socket", "sprite_taken: stale, the server already has our sprite");
2200
2195
  return;
2201
2196
  }
2202
2197
  ye = !0;
2203
2198
  let s;
2204
2199
  try {
2205
- s = xa();
2200
+ s = Ca();
2206
2201
  } finally {
2207
2202
  ye = !1;
2208
2203
  }
@@ -2233,16 +2228,16 @@ function ai(e) {
2233
2228
  (n.startsWith("auth/") ? I : Ne)("socket", `Server error: ${a}`, { code: n, raw: t }), m.getState().pushToast("error", a);
2234
2229
  });
2235
2230
  }
2236
- function ii(e, t) {
2231
+ function si(e, t) {
2237
2232
  const n = t?.length ? { text: e, images: t } : { text: e };
2238
- vt() ? ha(n) : re().emit(v.CHAT_SEND, n);
2233
+ vt() ? ga(n) : re().emit(v.CHAT_SEND, n);
2239
2234
  }
2240
- function si() {
2235
+ function li() {
2241
2236
  F || (F = { ts: Date.now() }, re().emit(v.TIME_PING, {}), $ = setTimeout(() => {
2242
2237
  F && (d("socket", "Time ping timed out after 10s, clearing inflight"), F = null), $ = null;
2243
2238
  }, 1e4));
2244
2239
  }
2245
- function Wn(e) {
2240
+ function qn(e) {
2246
2241
  const t = m.getState(), n = t.me.clientId;
2247
2242
  if (!n || !t.roster[n]) {
2248
2243
  Gt(e), d("socket", "Avatar change before join: the join will carry it", { sprite: e });
@@ -2257,10 +2252,10 @@ function Wn(e) {
2257
2252
  const r = m.getState(), a = { avatar: !0 };
2258
2253
  r.sprite && r.sprite !== t.sprite && (a.sprite = r.sprite), r.name && r.name !== t.name && (a.name = r.name), d("socket", "Sending avatar change", a), re().emit(v.IDENTITY_UPDATE, a);
2259
2254
  }
2260
- function li(e) {
2261
- m.getState().me.clientId && ci(e);
2255
+ function ci(e) {
2256
+ m.getState().me.clientId && di(e);
2262
2257
  }
2263
- function ci(e, t) {
2258
+ function di(e, t) {
2264
2259
  const n = {};
2265
2260
  e && (n.name = e), !(!n.name && !n.sprite) && (d("socket", "Sending identity update", n), re().emit(v.IDENTITY_UPDATE, n));
2266
2261
  }
@@ -2276,14 +2271,14 @@ m.subscribe((e, t) => {
2276
2271
  const s = {};
2277
2272
  a && (s.name = e.name, Ie.name = e.name), i && (s.sprite = e.sprite, Ie.sprite = e.sprite), d("socket", "Identity reassert (store change)", s), _?.connected ? _.emit(v.IDENTITY_UPDATE, s) : re().emit(v.IDENTITY_UPDATE, s);
2278
2273
  });
2279
- function di() {
2274
+ function ui() {
2280
2275
  De && (clearInterval(De), De = null), $ && (clearTimeout($), $ = null), F = null, ie.unansweredSince = null, ie.lastTickAt = null;
2281
2276
  }
2282
- function ui() {
2283
- d("socket", "clearJoinState called", { hadPayload: z !== null, room_key: z?.room_key }), z = null, ue = !1, Gn = null;
2277
+ function mi() {
2278
+ d("socket", "clearJoinState called", { hadPayload: z !== null, room_key: z?.room_key }), z = null, ue = !1, Wn = null;
2284
2279
  }
2285
2280
  function Vt() {
2286
- d("socket", "leaveRoom called", { room_key: z?.room_key }), ui(), di(), Mn(), _ && (_.disconnect(), _ = null), m.setState({
2281
+ d("socket", "leaveRoom called", { room_key: z?.room_key }), mi(), ui(), jn(), _ && (_.disconnect(), _ = null), m.setState({
2287
2282
  me: { clientId: null, nextClientSeq: 1 },
2288
2283
  roster: {},
2289
2284
  snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
@@ -2298,31 +2293,31 @@ function Vt() {
2298
2293
  activeGameId: null
2299
2294
  });
2300
2295
  }
2301
- function mi() {
2296
+ function fi() {
2302
2297
  d("chat", "Emitting recap_request"), re().emit("recap_request");
2303
2298
  }
2304
- function fi() {
2299
+ function pi() {
2305
2300
  A(() => {
2306
- const e = wr(), t = Ea((r) => {
2307
- const a = Hn(r);
2308
- d("avatar", "Avatar changed in the settings popout", { sprite: a, source: r.avatar?.source }), Wn(a);
2309
- }), n = Aa((r) => {
2310
- d("avatar", "Renamed in the settings popout", { name: r }), li(r);
2301
+ const e = Sr(), t = Aa((r) => {
2302
+ const a = Fn(r);
2303
+ d("avatar", "Avatar changed in the settings popout", { sprite: a, source: r.avatar?.source }), qn(a);
2304
+ }), n = Na((r) => {
2305
+ d("avatar", "Renamed in the settings popout", { name: r }), ci(r);
2311
2306
  });
2312
2307
  return () => {
2313
2308
  t(), n(), e();
2314
2309
  };
2315
2310
  }, []);
2316
2311
  }
2317
- function pi(e, t) {
2318
- return (t ? cr(t) : null) ?? kn(e);
2312
+ function hi(e, t) {
2313
+ return (t ? dr(t) : null) ?? En(e);
2319
2314
  }
2320
- function qn(e, t) {
2315
+ function Vn(e, t) {
2321
2316
  return A(() => {
2322
- t && sr(t);
2323
- }, [t]), Yn(lr, () => pi(e, t), () => kn(e));
2317
+ t && lr(t);
2318
+ }, [t]), zn(cr, () => hi(e, t), () => En(e));
2324
2319
  }
2325
- function hi(e, t) {
2320
+ function gi(e, t) {
2326
2321
  if (t.clientId) {
2327
2322
  const n = e[t.clientId];
2328
2323
  if (n && (!t.author || !n.author || n.author === t.author)) return n;
@@ -2331,8 +2326,8 @@ function hi(e, t) {
2331
2326
  for (const n of Object.values(e)) if (n.author === t.author) return n;
2332
2327
  }
2333
2328
  }
2334
- function gi(e, t, n) {
2335
- const r = hi(e, t);
2329
+ function yi(e, t, n) {
2330
+ const r = gi(e, t);
2336
2331
  return r ? {
2337
2332
  name: r.name || n.name,
2338
2333
  // A connection briefly without a character (a reconnect waiting for one to
@@ -2343,14 +2338,14 @@ function gi(e, t, n) {
2343
2338
  here: !0
2344
2339
  } : { name: n.name, sprite: n.sprite, pictureUrl: n.pictureUrl, here: !1 };
2345
2340
  }
2346
- function yi(e, t, n) {
2347
- return !t || !n.here ? e : t.split(on).join(n.name);
2341
+ function bi(e, t, n) {
2342
+ return !t || !n.here ? e : t.split(an).join(n.name);
2348
2343
  }
2349
- function bi(e, t) {
2350
- const n = m((r) => JSON.stringify(gi(r.roster, e, t)));
2344
+ function vi(e, t) {
2345
+ const n = m((r) => JSON.stringify(yi(r.roster, e, t)));
2351
2346
  return te(() => JSON.parse(n), [n]);
2352
2347
  }
2353
- function Vn({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback: i }) {
2348
+ function Kn({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback: i }) {
2354
2349
  const [s, l] = P(null);
2355
2350
  if (t && t !== s)
2356
2351
  return /* @__PURE__ */ c(
@@ -2365,13 +2360,13 @@ function Vn({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback:
2365
2360
  onError: () => l(t)
2366
2361
  }
2367
2362
  );
2368
- const f = ea(e);
2363
+ const f = ta(e);
2369
2364
  return f ? /* @__PURE__ */ c("img", { src: f, alt: n, crossOrigin: "anonymous", className: r, style: a, draggable: !1 }) : /* @__PURE__ */ c(se, { children: i });
2370
2365
  }
2371
- function vi({ sprite: e, url: t, alt: n, worn: r }) {
2366
+ function wi({ sprite: e, url: t, alt: n, worn: r }) {
2372
2367
  return /* @__PURE__ */ w("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
2373
2368
  /* @__PURE__ */ c("span", { className: "hc-pic", children: /* @__PURE__ */ c(
2374
- Vn,
2369
+ Kn,
2375
2370
  {
2376
2371
  sprite: e,
2377
2372
  url: t,
@@ -2380,21 +2375,21 @@ function vi({ sprite: e, url: t, alt: n, worn: r }) {
2380
2375
  fallback: /* @__PURE__ */ c("span", { className: "inline-block w-8 h-8 bg-bg-alt/50 rounded-full flex-shrink-0" })
2381
2376
  }
2382
2377
  ) }),
2383
- r?.overlay && /* @__PURE__ */ c(et, { html: dr(r), style: { display: "contents" } })
2378
+ r?.overlay && /* @__PURE__ */ c(et, { html: ur(r), style: { display: "contents" } })
2384
2379
  ] });
2385
2380
  }
2386
- function wi(e) {
2381
+ function Si(e) {
2387
2382
  return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
2388
2383
  }
2389
- function Si({ src: e, title: t, onClose: n }) {
2384
+ function _i({ src: e, title: t, onClose: n }) {
2390
2385
  A(() => {
2391
2386
  const i = (s) => {
2392
2387
  ut(s) && (s.stopPropagation(), n());
2393
2388
  };
2394
2389
  return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
2395
2390
  }, [n]);
2396
- const r = Io(), a = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
2397
- return a ? Sr(
2391
+ const r = To(), a = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
2392
+ return a ? _r(
2398
2393
  /* @__PURE__ */ w(
2399
2394
  "div",
2400
2395
  {
@@ -2432,11 +2427,11 @@ function Si({ src: e, title: t, onClose: n }) {
2432
2427
  a
2433
2428
  ) : null;
2434
2429
  }
2435
- const Ye = 240, _i = 320;
2436
- function xi({ image: e }) {
2430
+ const Ye = 240, xi = 320;
2431
+ function Ci({ image: e }) {
2437
2432
  const [t, n] = P(!1), r = Le(e.key);
2438
2433
  if (!r) return null;
2439
- const a = e.w > 0 && e.h > 0, i = a ? Math.min(1, _i / e.w, Ye / e.h) : 1;
2434
+ const a = e.w > 0 && e.h > 0, i = a ? Math.min(1, xi / e.w, Ye / e.h) : 1;
2440
2435
  return /* @__PURE__ */ w(se, { children: [
2441
2436
  /* @__PURE__ */ c(
2442
2437
  "a",
@@ -2447,7 +2442,7 @@ function xi({ image: e }) {
2447
2442
  className: "block max-w-full cursor-zoom-in",
2448
2443
  "data-testid": "chat-image",
2449
2444
  onClick: (s) => {
2450
- wi(s) && (s.preventDefault(), n(!0));
2445
+ Si(s) && (s.preventDefault(), n(!0));
2451
2446
  },
2452
2447
  children: /* @__PURE__ */ c(
2453
2448
  "img",
@@ -2465,7 +2460,7 @@ function xi({ image: e }) {
2465
2460
  }
2466
2461
  ),
2467
2462
  t && /* @__PURE__ */ c(
2468
- Si,
2463
+ _i,
2469
2464
  {
2470
2465
  src: r,
2471
2466
  title: e.title,
@@ -2474,23 +2469,23 @@ function xi({ image: e }) {
2474
2469
  )
2475
2470
  ] });
2476
2471
  }
2477
- function Ci({ images: e }) {
2478
- return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(xi, { image: t }, `${t.key}-${n}`)) }) : null;
2472
+ function Ii({ images: e }) {
2473
+ return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(Ci, { image: t }, `${t.key}-${n}`)) }) : null;
2479
2474
  }
2480
- function Ii(e, t) {
2475
+ function Ti(e, t) {
2481
2476
  return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
2482
2477
  }
2483
2478
  function ze(e) {
2484
2479
  return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2485
2480
  }
2486
- const Ti = Oe.memo(function({ message: t }) {
2487
- const n = m((u) => u.me.clientId), r = m((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), a = Ii(t, { clientId: n, author: r }), i = bi(
2481
+ const ki = Oe.memo(function({ message: t }) {
2482
+ const n = m((u) => u.me.clientId), r = m((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), a = Ti(t, { clientId: n, author: r }), i = vi(
2488
2483
  { clientId: t.clientId, author: t.author },
2489
2484
  { name: t.name, sprite: t.sprite }
2490
- ), s = qn(i.sprite, i.pictureUrl), l = t.isSystem ? void 0 : i.cosmetics, f = G(null);
2491
- Eo(f, !!l);
2485
+ ), s = Vn(i.sprite, i.pictureUrl), l = t.isSystem ? void 0 : i.cosmetics, f = G(null);
2486
+ Ao(f, !!l);
2492
2487
  const [h] = P(
2493
- () => t.live && t.text ? ur(t.text, l) : null
2488
+ () => t.live && t.text ? mr(t.text, l) : null
2494
2489
  );
2495
2490
  return t.isSystem && t.systemType === "recap" ? /* @__PURE__ */ c("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ w("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
2496
2491
  /* @__PURE__ */ w("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
@@ -2499,20 +2494,20 @@ const Ti = Oe.memo(function({ message: t }) {
2499
2494
  ] }),
2500
2495
  /* @__PURE__ */ c("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: t.text })
2501
2496
  ] }) }) : t.isSystem ? /* @__PURE__ */ w("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
2502
- yi(t.text, t.template, i),
2497
+ bi(t.text, t.template, i),
2503
2498
  /* @__PURE__ */ c("span", { className: "ml-1 text-[10px] opacity-50", children: ze(t.ts) })
2504
- ] }) : /* @__PURE__ */ w("div", { ref: f, style: ko(s), className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${a ? "bg-bg-card/30" : ""}`, children: [
2505
- /* @__PURE__ */ c(vi, { sprite: i.sprite, url: i.pictureUrl, alt: i.name, worn: l }),
2499
+ ] }) : /* @__PURE__ */ w("div", { ref: f, style: Eo(s), className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${a ? "bg-bg-card/30" : ""}`, children: [
2500
+ /* @__PURE__ */ c(wi, { sprite: i.sprite, url: i.pictureUrl, alt: i.name, worn: l }),
2506
2501
  /* @__PURE__ */ w("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
2507
- l ? /* @__PURE__ */ c(et, { html: mr(i.name, l), className: "text-[13px]", style: { color: s } }) : /* @__PURE__ */ c("span", { className: "font-medium text-[13px]", style: { color: s }, children: i.name }),
2502
+ l ? /* @__PURE__ */ c(et, { html: fr(i.name, l), className: "text-[13px]", style: { color: s } }) : /* @__PURE__ */ c("span", { className: "font-medium text-[13px]", style: { color: s }, children: i.name }),
2508
2503
  /* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: ze(t.ts) }),
2509
2504
  t.text && (h ? /* @__PURE__ */ c(et, { as: "p", html: h, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ c("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
2510
- /* @__PURE__ */ c(Ci, { images: t.images })
2505
+ /* @__PURE__ */ c(Ii, { images: t.images })
2511
2506
  ] })
2512
2507
  ] });
2513
2508
  });
2514
- function ki() {
2515
- To();
2509
+ function Ei() {
2510
+ ko();
2516
2511
  const e = m((a) => a.chat), t = G(null), n = G(!1), r = E(() => {
2517
2512
  const a = t.current;
2518
2513
  if (!a) return;
@@ -2536,7 +2531,7 @@ function ki() {
2536
2531
  /* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(a.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
2537
2532
  /* @__PURE__ */ c("div", { className: "flex-1 h-px bg-border" })
2538
2533
  ] }),
2539
- /* @__PURE__ */ c(Ti, { message: a })
2534
+ /* @__PURE__ */ c(ki, { message: a })
2540
2535
  ] }, a.id);
2541
2536
  }) })
2542
2537
  }
@@ -2563,12 +2558,12 @@ const _t = [
2563
2558
  scope: "local"
2564
2559
  }
2565
2560
  ], le = "/";
2566
- function Ei(e) {
2561
+ function Ai(e) {
2567
2562
  if (!e.startsWith(le)) return null;
2568
2563
  const t = e.slice(le.length);
2569
2564
  return /\s/.test(t) ? null : t.toLowerCase();
2570
2565
  }
2571
- function Ai(e, t = _t) {
2566
+ function Ni(e, t = _t) {
2572
2567
  const n = e.toLowerCase();
2573
2568
  if (!n) return [...t].sort((a, i) => a.name.localeCompare(i.name));
2574
2569
  const r = [];
@@ -2578,23 +2573,23 @@ function Ai(e, t = _t) {
2578
2573
  }
2579
2574
  return r.sort((a, i) => a.rank - i.rank || a.cmd.name.localeCompare(i.cmd.name)).map((a) => a.cmd);
2580
2575
  }
2581
- function Ni(e) {
2576
+ function Pi(e) {
2582
2577
  return `${le}${e.name} `;
2583
2578
  }
2584
2579
  function Xe(e, t) {
2585
2580
  return t <= 0 ? 0 : (e % t + t) % t;
2586
2581
  }
2587
- function Pi(e, t = _t) {
2582
+ function Ri(e, t = _t) {
2588
2583
  const n = e.trim();
2589
2584
  if (!n) return null;
2590
2585
  if (!n.startsWith(le)) return { kind: "chat", text: n };
2591
2586
  const r = n.slice(le.length), a = r.search(/\s/), i = (a === -1 ? r : r.slice(0, a)).toLowerCase(), s = a === -1 ? "" : r.slice(a).trim(), l = t.find((f) => f.name.toLowerCase() === i);
2592
2587
  return l ? { kind: "command", command: l, args: s } : { kind: "chat", text: n };
2593
2588
  }
2594
- function Ri(e, t) {
2589
+ function Di(e, t) {
2595
2590
  return e.requiresMedia && !t.hasMedia ? `${le}${e.name} needs an episode loaded.` : null;
2596
2591
  }
2597
- function Di({
2592
+ function Oi({
2598
2593
  commands: e,
2599
2594
  activeIndex: t,
2600
2595
  hasMedia: n,
@@ -2636,7 +2631,7 @@ function Di({
2636
2631
  }
2637
2632
  );
2638
2633
  }
2639
- function Oi({
2634
+ function Li({
2640
2635
  pending: e,
2641
2636
  uploading: t,
2642
2637
  onRemove: n
@@ -2663,24 +2658,24 @@ function Oi({
2663
2658
  )
2664
2659
  ] }, r.id)) }) : null;
2665
2660
  }
2666
- function Li() {
2661
+ function Mi() {
2667
2662
  const [e, t] = P([]), [n, r] = P(!1), a = m((p) => p.pushToast), i = G(/* @__PURE__ */ new Set());
2668
2663
  A(() => () => {
2669
2664
  for (const p of i.current) URL.revokeObjectURL(p);
2670
2665
  i.current.clear();
2671
2666
  }, []);
2672
2667
  const s = E((p) => {
2673
- ao(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
2668
+ io(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
2674
2669
  }, []), l = E(async (p) => {
2675
2670
  if (!p.length) return;
2676
2671
  const x = [];
2677
2672
  for (const S of p) {
2678
- const y = so(S);
2673
+ const y = lo(S);
2679
2674
  if (y) {
2680
2675
  a("error", y);
2681
2676
  continue;
2682
2677
  }
2683
- const { w: g, h: T } = await uo(S), N = URL.createObjectURL(S);
2678
+ const { w: g, h: T } = await mo(S), N = URL.createObjectURL(S);
2684
2679
  i.current.add(N), x.push({
2685
2680
  kind: "file",
2686
2681
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
@@ -2715,7 +2710,7 @@ function Li() {
2715
2710
  w: p.width ?? 0,
2716
2711
  h: p.height ?? 0,
2717
2712
  title: p.title || void 0
2718
- }]), $e().catalogue(bn).recordUse(p.key));
2713
+ }]), $e().catalogue(vn).recordUse(p.key));
2719
2714
  }, [a]), h = E((p) => {
2720
2715
  t((x) => {
2721
2716
  const S = x.find((y) => y.id === p);
@@ -2727,10 +2722,10 @@ function Li() {
2727
2722
  return [];
2728
2723
  });
2729
2724
  }, [s]), L = E((p) => {
2730
- const x = lo(p.clipboardData);
2725
+ const x = co(p.clipboardData);
2731
2726
  x.length && (p.preventDefault(), l(x));
2732
2727
  }, [l]), R = E((p) => {
2733
- const x = co(p.dataTransfer);
2728
+ const x = uo(p.dataTransfer);
2734
2729
  x.length && (p.preventDefault(), l(x));
2735
2730
  }, [l]), D = E((p) => {
2736
2731
  p.dataTransfer?.types?.includes("Files") && p.preventDefault();
@@ -2738,9 +2733,9 @@ function Li() {
2738
2733
  if (!e.length) return [];
2739
2734
  r(!0);
2740
2735
  try {
2741
- return await fo(e);
2736
+ return await po(e);
2742
2737
  } catch (p) {
2743
- return I("chat", "Image upload failed", po(p)), a("error", io(p)), null;
2738
+ return I("chat", "Image upload failed", ho(p)), a("error", so(p)), null;
2744
2739
  } finally {
2745
2740
  r(!1);
2746
2741
  }
@@ -2758,38 +2753,38 @@ function Li() {
2758
2753
  onDragOver: D
2759
2754
  };
2760
2755
  }
2761
- const Kt = tn, Mi = Cr;
2762
- function ji({ commands: e = _t }) {
2763
- const [t, n] = P(""), [r, a] = P(!1), [i, s] = P({ q: null, i: 0 }), [l, f] = P(!1), h = G(null), u = zn(), [L, R] = P(!1), [D, U] = P(!1), p = Li(), x = m((b) => b.snapshot.mediaId), S = m((b) => b.pushToast), y = m((b) => b.setTierlistOpen), g = !!x, T = Ei(t), N = te(
2764
- () => T === null ? [] : Ai(T, e),
2756
+ const Kt = nn, ji = Ir;
2757
+ function Ui({ commands: e = _t }) {
2758
+ const [t, n] = P(""), [r, a] = P(!1), [i, s] = P({ q: null, i: 0 }), [l, f] = P(!1), h = G(null), u = Xn(), [L, R] = P(!1), [D, U] = P(!1), p = Mi(), x = m((b) => b.snapshot.mediaId), S = m((b) => b.pushToast), y = m((b) => b.setTierlistOpen), g = !!x, T = Ai(t), N = te(
2759
+ () => T === null ? [] : Ni(T, e),
2765
2760
  [T, e]
2766
2761
  ), j = T !== null && !l && N.length > 0, H = i.q === T ? Xe(i.i, N.length) : 0, C = E(
2767
2762
  (b) => s({ q: T, i: b }),
2768
2763
  [T]
2769
2764
  ), O = E((b, M) => {
2770
- const de = Ri(b, { hasMedia: g });
2765
+ const de = Di(b, { hasMedia: g });
2771
2766
  if (de) {
2772
2767
  S("info", de);
2773
2768
  return;
2774
2769
  }
2775
2770
  switch (b.name) {
2776
2771
  case "help":
2777
- S("info", e.map((Kn) => Kn.usage).join(" "));
2772
+ S("info", e.map((Yn) => Yn.usage).join(" "));
2778
2773
  break;
2779
2774
  case "recap":
2780
- mi();
2775
+ fi();
2781
2776
  break;
2782
2777
  case "tierlist":
2783
- _a(), y(!0);
2778
+ xa(), y(!0);
2784
2779
  break;
2785
2780
  default:
2786
2781
  S("info", `${b.usage} is not implemented yet.`);
2787
2782
  }
2788
2783
  }, [g, S, e, y]), k = E((b) => {
2789
- n(Ni(b)), f(!1), h.current?.focus();
2784
+ n(Pi(b)), f(!1), h.current?.focus();
2790
2785
  }, []), oe = E(async (b) => {
2791
2786
  if (b.preventDefault(), r || p.uploading) return;
2792
- const M = Pi(t, e);
2787
+ const M = Ri(t, e);
2793
2788
  if (!M && !p.pending.length) return;
2794
2789
  if (M?.kind === "command" && p.pending.length) {
2795
2790
  S("info", "Send images on their own, not with a command.");
@@ -2800,7 +2795,7 @@ function ji({ commands: e = _t }) {
2800
2795
  return;
2801
2796
  }
2802
2797
  const de = await p.uploadPending();
2803
- de !== null && (ii(M?.text ?? "", de), n(""), p.clear(), a(!0), setTimeout(() => a(!1), Mi), !document.hidden && document.hasFocus() && h.current?.focus());
2798
+ de !== null && (si(M?.text ?? "", de), n(""), p.clear(), a(!0), setTimeout(() => a(!1), ji), !document.hidden && document.hasFocus() && h.current?.focus());
2804
2799
  }, [t, r, O, p, S, e]), ae = E((b) => {
2805
2800
  if (b.key === "Escape" && j) {
2806
2801
  b.preventDefault(), f(!0);
@@ -2840,10 +2835,10 @@ function ji({ commands: e = _t }) {
2840
2835
  onDragOver: p.onDragOver,
2841
2836
  className: "p-2 border-t border-border",
2842
2837
  children: [
2843
- /* @__PURE__ */ c(Oi, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
2838
+ /* @__PURE__ */ c(Li, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
2844
2839
  /* @__PURE__ */ w("div", { className: "relative", children: [
2845
2840
  j && /* @__PURE__ */ c(
2846
- Di,
2841
+ Oi,
2847
2842
  {
2848
2843
  commands: N,
2849
2844
  activeIndex: H,
@@ -2854,7 +2849,7 @@ function ji({ commands: e = _t }) {
2854
2849
  }
2855
2850
  ),
2856
2851
  /* @__PURE__ */ c(
2857
- So,
2852
+ _o,
2858
2853
  {
2859
2854
  open: L,
2860
2855
  onClose: () => R(!1),
@@ -2898,7 +2893,7 @@ function ji({ commands: e = _t }) {
2898
2893
  title: "Add a meme",
2899
2894
  "data-testid": "meme-button",
2900
2895
  className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${L ? "text-text border-primary" : "text-text-secondary"}`,
2901
- children: /* @__PURE__ */ c(Xn, { name: "image" })
2896
+ children: /* @__PURE__ */ c(Jn, { name: "image" })
2902
2897
  }
2903
2898
  )
2904
2899
  ] })
@@ -2907,15 +2902,15 @@ function ji({ commands: e = _t }) {
2907
2902
  }
2908
2903
  );
2909
2904
  }
2910
- function Ui() {
2905
+ function Hi() {
2911
2906
  const e = m((n) => n.roster), t = Object.values(e);
2912
- return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(Hi, { u: n }, n.clientId)) }) : /* @__PURE__ */ c("div", { className: "text-xs text-text-muted", children: "No users online" });
2907
+ return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(Fi, { u: n }, n.clientId)) }) : /* @__PURE__ */ c("div", { className: "text-xs text-text-muted", children: "No users online" });
2913
2908
  }
2914
- function Hi({ u: e }) {
2915
- const t = qn(e.sprite, e.avatarUrl);
2909
+ function Fi({ u: e }) {
2910
+ const t = Vn(e.sprite, e.avatarUrl);
2916
2911
  return /* @__PURE__ */ w("div", { className: "flex items-center gap-2 py-0.5", children: [
2917
2912
  /* @__PURE__ */ c(
2918
- Vn,
2913
+ Kn,
2919
2914
  {
2920
2915
  sprite: e.sprite,
2921
2916
  url: e.avatarUrl,
@@ -2928,7 +2923,7 @@ function Hi({ u: e }) {
2928
2923
  e.isLeader && /* @__PURE__ */ c("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
2929
2924
  ] });
2930
2925
  }
2931
- function Fi() {
2926
+ function $i() {
2932
2927
  const e = m((i) => Object.keys(i.roster).length), [t, n] = P(!1), r = G(null), a = G(null);
2933
2928
  return A(() => {
2934
2929
  if (!t) return;
@@ -2964,7 +2959,7 @@ function Fi() {
2964
2959
  e,
2965
2960
  " online"
2966
2961
  ] }),
2967
- /* @__PURE__ */ c(Ui, {})
2962
+ /* @__PURE__ */ c(Hi, {})
2968
2963
  ] })
2969
2964
  ] });
2970
2965
  }
@@ -2977,39 +2972,39 @@ function Yt({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
2977
2972
  };
2978
2973
  }, [t, n]), /* @__PURE__ */ c("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((r) => /* @__PURE__ */ c("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${r.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: r.msg }, r.id)) });
2979
2974
  }
2980
- const zt = (e) => typeof e == "string" && Jn.includes(e);
2981
- function $i(e, t, n) {
2975
+ const zt = (e) => typeof e == "string" && Qn.includes(e);
2976
+ function Bi(e, t, n) {
2982
2977
  return e || (zt(t) ? t : zt(n) ? n : "dark");
2983
2978
  }
2984
- function Bi(e, t) {
2979
+ function Gi(e, t) {
2985
2980
  if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
2986
2981
  };
2987
2982
  const n = new ResizeObserver(() => t(e.clientWidth));
2988
2983
  return n.observe(e), () => n.disconnect();
2989
2984
  }
2990
- function Gi(e) {
2985
+ function Wi(e) {
2991
2986
  const t = e?.trim() ?? "";
2992
2987
  return t ? { source: "host", name: t } : { source: "auto" };
2993
2988
  }
2994
- function Wi(e) {
2989
+ function qi(e) {
2995
2990
  if (e.source !== "host") return;
2996
2991
  const { setSessionIdentity: t, sprite: n } = m.getState();
2997
2992
  t(e.name, n);
2998
2993
  }
2999
- function qi({ className: e = "w-4 h-4" }) {
2994
+ function Vi({ className: e = "w-4 h-4" }) {
3000
2995
  return /* @__PURE__ */ w("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
3001
2996
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
3002
2997
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
3003
2998
  ] });
3004
2999
  }
3005
- function Vi({ className: e = "w-4 h-4" }) {
3000
+ function Ki({ className: e = "w-4 h-4" }) {
3006
3001
  return /* @__PURE__ */ w("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
3007
3002
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
3008
3003
  /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
3009
3004
  ] });
3010
3005
  }
3011
- const Ki = 1500;
3012
- function cs({
3006
+ const Yi = 1500;
3007
+ function ds({
3013
3008
  roomKey: e,
3014
3009
  serverOrigin: t,
3015
3010
  roomOrigin: n,
@@ -3026,8 +3021,8 @@ function cs({
3026
3021
  debug: D,
3027
3022
  children: U
3028
3023
  }) {
3029
- const [p, x] = P(null), { setFrame: S, ...y } = Yi(L, R), g = Jt(() => h), T = te(() => (Qo({ userType: s, userId: l ?? null }), yt().theme), [s, l]), N = Qn(), j = N?.theme, H = te(
3030
- () => $i(f, j, T),
3024
+ const [p, x] = P(null), { setFrame: S, ...y } = zi(L, R), g = Jt(() => h), T = te(() => (Zo({ userType: s, userId: l ?? null }), yt().theme), [s, l]), N = Zn(), j = N?.theme, H = te(
3025
+ () => Bi(f, j, T),
3031
3026
  [f, j, T]
3032
3027
  );
3033
3028
  A(() => {
@@ -3037,36 +3032,36 @@ function cs({
3037
3032
  [t, e]
3038
3033
  );
3039
3034
  return A(() => {
3040
- D && Po();
3041
- }, [D]), fi(), A(() => {
3042
- _o({ serverOrigin: t, defaultRoomKey: e }), ga(n ? { origin: n, path: r } : null), Ft(a && !n ? { origin: a, path: i } : null), m.getState().rehydrateFromPrefs(), Ua();
3035
+ D && Ro();
3036
+ }, [D]), pi(), A(() => {
3037
+ xo({ serverOrigin: t, defaultRoomKey: e }), ya(n ? { origin: n, path: r } : null), Ft(a && !n ? { origin: a, path: i } : null), m.getState().rehydrateFromPrefs(), Ha();
3043
3038
  let k = !1;
3044
- const oe = ta();
3039
+ const oe = na();
3045
3040
  return (async () => {
3046
3041
  try {
3047
3042
  await Promise.race([
3048
3043
  Promise.all([
3049
3044
  oe,
3050
- sa().then((X) => {
3045
+ la().then((X) => {
3051
3046
  X && m.getState().rehydrateFromPrefs();
3052
3047
  }),
3053
3048
  // The character chosen in the settings popout (lib/avatar.ts).
3054
- ka().then(Wn)
3049
+ Ea().then(qn)
3055
3050
  ]),
3056
- new Promise((X) => setTimeout(X, Ki))
3051
+ new Promise((X) => setTimeout(X, Yi))
3057
3052
  ]);
3058
3053
  } catch (X) {
3059
3054
  I("room-chrome", "pre-join wait threw, proceeding anyway", ve(X));
3060
3055
  }
3061
3056
  if (k) return;
3062
- const ae = Gi(g());
3063
- m.getState().ensureAutoIdentity(), Wi(ae);
3057
+ const ae = Wi(g());
3058
+ m.getState().ensureAutoIdentity(), qi(ae);
3064
3059
  const W = m.getState();
3065
- d("room-chrome", "Joining room", { roomKey: e, name: W.name, sprite: W.sprite }), Ya({ room_key: e, name: W.name || void 0, sprite: W.sprite || void 0 });
3060
+ d("room-chrome", "Joining room", { roomKey: e, name: W.name, sprite: W.sprite }), za({ room_key: e, name: W.name || void 0, sprite: W.sprite || void 0 });
3066
3061
  })(), () => {
3067
3062
  k = !0, Vt(), Ft(null);
3068
3063
  };
3069
- }, [e, t, n, r, a, i, s, l]), /* @__PURE__ */ c(xo.Provider, { value: O, children: /* @__PURE__ */ c(Sn.Provider, { value: !1, children: /* @__PURE__ */ c(wn.Provider, { value: p, children: /* @__PURE__ */ w("div", { ref: S, className: "wp-room-chrome-frame", children: [
3064
+ }, [e, t, n, r, a, i, s, l]), /* @__PURE__ */ c(Co.Provider, { value: O, children: /* @__PURE__ */ c(_n.Provider, { value: !1, children: /* @__PURE__ */ c(Sn.Provider, { value: p, children: /* @__PURE__ */ w("div", { ref: S, className: "wp-room-chrome-frame", children: [
3070
3065
  /* @__PURE__ */ c("div", { className: "wp-room-chrome-frame__content", children: U }),
3071
3066
  /* @__PURE__ */ c(
3072
3067
  "aside",
@@ -3076,7 +3071,7 @@ function cs({
3076
3071
  "data-theme": H,
3077
3072
  "data-collapsed": y.collapsed ? "1" : "0",
3078
3073
  style: { "--wp-room-chrome-width": `${y.state.width}px` },
3079
- onAnimationEnd: (k) => fr(k.nativeEvent),
3074
+ onAnimationEnd: (k) => pr(k.nativeEvent),
3080
3075
  children: y.collapsed ? /* @__PURE__ */ w(se, { children: [
3081
3076
  /* @__PURE__ */ c(
3082
3077
  "button",
@@ -3086,7 +3081,7 @@ function cs({
3086
3081
  title: "Show chat",
3087
3082
  "aria-label": "Show chat",
3088
3083
  "aria-expanded": !1,
3089
- children: /* @__PURE__ */ c(Vi, {})
3084
+ children: /* @__PURE__ */ c(Ki, {})
3090
3085
  }
3091
3086
  ),
3092
3087
  /* @__PURE__ */ c(Yt, { className: "absolute bottom-2 right-full mr-2 w-72" })
@@ -3111,7 +3106,7 @@ function cs({
3111
3106
  }
3112
3107
  ),
3113
3108
  /* @__PURE__ */ w("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
3114
- /* @__PURE__ */ c(Fi, {}),
3109
+ /* @__PURE__ */ c($i, {}),
3115
3110
  /* @__PURE__ */ c("div", { className: "flex-1" }),
3116
3111
  u && /* @__PURE__ */ c(
3117
3112
  "button",
@@ -3133,25 +3128,25 @@ function cs({
3133
3128
  title: "Hide chat",
3134
3129
  "aria-label": "Hide chat",
3135
3130
  "aria-expanded": !0,
3136
- children: /* @__PURE__ */ c(qi, {})
3131
+ children: /* @__PURE__ */ c(Vi, {})
3137
3132
  }
3138
3133
  )
3139
3134
  ] }),
3140
- /* @__PURE__ */ c(ki, {}),
3141
- /* @__PURE__ */ c(ji, { commands: [] }),
3135
+ /* @__PURE__ */ c(Ei, {}),
3136
+ /* @__PURE__ */ c(Ui, { commands: [] }),
3142
3137
  /* @__PURE__ */ c(Yt, { className: "absolute bottom-14 left-2 right-2" })
3143
3138
  ] })
3144
3139
  }
3145
3140
  )
3146
3141
  ] }) }) }) });
3147
3142
  }
3148
- function Yi(e, t) {
3143
+ function zi(e, t) {
3149
3144
  const n = m((g) => g.chromeChatCollapsed) && t, r = m((g) => g.chromeChatWidth), a = m((g) => g.toggleChromeChatCollapsed), i = m((g) => g.setChromeChatWidth), [s, l] = P(null), [f, h] = P(void 0), [u, L] = P(null);
3150
3145
  A(() => {
3151
3146
  if (s)
3152
- return Bi(s, h);
3147
+ return Gi(s, h);
3153
3148
  }, [s]);
3154
- const R = Y(u?.current ?? r, f), D = te(() => ma(n, R), [n, R]), U = Jt((g) => e?.(g));
3149
+ const R = Y(u?.current ?? r, f), D = te(() => fa(n, R), [n, R]), U = Jt((g) => e?.(g));
3155
3150
  return A(() => {
3156
3151
  U(D);
3157
3152
  }, [D]), {
@@ -3172,12 +3167,12 @@ function Yi(e, t) {
3172
3167
  L(null), T !== r && i(T);
3173
3168
  },
3174
3169
  onKeyDown: (g) => {
3175
- const T = ua(R, g.key, f);
3170
+ const T = ma(R, g.key, f);
3176
3171
  T !== null && (g.preventDefault(), T !== r && i(T));
3177
3172
  }
3178
3173
  };
3179
3174
  }
3180
3175
  export {
3181
- cs as RoomChrome
3176
+ ds as RoomChrome
3182
3177
  };
3183
3178
  //# sourceMappingURL=room-chrome.js.map