@hadoku/watchparty-ui 0.45.112 → 0.45.114

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 l, jsxs as _, Fragment as te } from "react/jsx-runtime";
2
- import Ge, { useState as N, useRef as $, useMemo as W, useCallback as M, useEffect as P, createContext as wt, useContext as pa, useSyncExternalStore as ba, useLayoutEffect as Ut, useId as $t, useEffectEvent as ya } from "react";
3
- import { themePrefs as pe, Icon as En, THEMES as An, useHadokuThemeOptional as Nn } from "@wolffm/themes";
4
- import { createCdnClient as jn, kindOfType as Rn, MAX_BYTES as Pn, measureImage as Mn, filesFromClipboard as Dn, filesFromDrop as Ln, CdnError as gt } from "@wolffm/cdn-client";
5
- import { ensureCosmeticsStyles as On, cleanWorn as qn, readPictureColour as Hn, onPictureColour as Un, pictureColour as $n, decorHtml as Fn, messageHtml as _a, nameHtml as wa, finishReveal as zn } from "@wolffm/prefs-client/cosmetics";
6
- import { create as Wn } from "zustand";
7
- import { pickAvatar as va, applyReaction as Bn, resolveIdentityReassert as Gn } from "@wolffm/rooms-protocol";
2
+ import Ge, { useState as N, useRef as $, useMemo as F, useCallback as M, useEffect as P, createContext as vt, useContext as ba, useSyncExternalStore as ya, useLayoutEffect as $t, useId as Ft, useEffectEvent as _a } from "react";
3
+ import { themePrefs as pe, Icon as Nn, THEMES as jn, useHadokuThemeOptional as Rn } from "@wolffm/themes";
4
+ import { createCdnClient as Pn, kindOfType as Mn, MAX_BYTES as Dn, measureImage as Ln, filesFromClipboard as On, filesFromDrop as qn, CdnError as gt } from "@wolffm/cdn-client";
5
+ import { ensureCosmeticsStyles as Hn, cleanWorn as Un, readPictureColour as $n, onPictureColour as Fn, pictureColour as zn, decorHtml as Wn, messageHtml as wa, nameHtml as va, finishReveal as Bn } from "@wolffm/prefs-client/cosmetics";
6
+ import { create as Gn } from "zustand";
7
+ import { pickAvatar as ka, applyReaction as Kn, resolveIdentityReassert as Vn } from "@wolffm/rooms-protocol";
8
8
  import { z as i } from "zod";
9
- import { createPrefsClient as Kn, getDeviceId as Vn, DEVICE_ID_KEY as Yn } from "@wolffm/prefs-client";
9
+ import { createPrefsClient as Yn, getDeviceId as Jn, DEVICE_ID_KEY as Xn } from "@wolffm/prefs-client";
10
10
  import { io as ht } from "socket.io-client";
11
- import { fetchCharacter as Jn, characterOf as Xn, onAvatarChange as Qn } from "@wolffm/prefs-client/avatar";
12
- import { relayIdentityChanges as Zn } from "@wolffm/task-ui-components/identity-relay";
13
- import { createPortal as ka } from "react-dom";
14
- import { useCatalogueSearch as eo } from "@wolffm/cdn-client/react";
15
- const xa = "https://cdn.hadoku.me", Sa = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
16
- function vt(e) {
17
- return typeof e == "string" && Sa.test(e);
18
- }
19
- const kt = 8080, Ta = 5173, to = "/watchparty/ws", Ca = 500, ao = 1e3, ae = 4, Ia = typeof process < "u" && process.env ? process.env : {};
20
- Ia.PRODUCTION_UI_URL;
21
- Ia.PRODUCTION_SERVER_URL;
22
- const qe = i.enum(["S", "A", "B", "C", "D", "F"]), Ft = 2e4, no = 300;
11
+ import { fetchCharacter as Qn, characterOf as Zn, onAvatarChange as eo } from "@wolffm/prefs-client/avatar";
12
+ import { relayIdentityChanges as to } from "@wolffm/task-ui-components/identity-relay";
13
+ import { createPortal as xa } from "react-dom";
14
+ import { useCatalogueSearch as ao } from "@wolffm/cdn-client/react";
15
+ const Sa = "https://cdn.hadoku.me", Ta = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
16
+ function kt(e) {
17
+ return typeof e == "string" && Ta.test(e);
18
+ }
19
+ const xt = 8080, Ca = 5173, no = "/watchparty/ws", Ia = 500, oo = 1e3, ae = 4, Ea = typeof process < "u" && process.env ? process.env : {};
20
+ Ea.PRODUCTION_UI_URL;
21
+ Ea.PRODUCTION_SERVER_URL;
22
+ const qe = i.enum(["S", "A", "B", "C", "D", "F"]), zt = 2e4, ro = 300;
23
23
  i.object({
24
24
  name: i.string().min(1).max(32).optional(),
25
25
  sprite: i.string().min(1).max(32).optional(),
@@ -28,7 +28,7 @@ i.object({
28
28
  * resolves it from prefs-api by registry userId, never from the client. */
29
29
  avatar: i.literal(!0).optional()
30
30
  });
31
- const k = {
31
+ const S = {
32
32
  JOIN: "join",
33
33
  SNAPSHOT: "snapshot",
34
34
  CONTROL_ACK: "control_ack",
@@ -52,7 +52,7 @@ const k = {
52
52
  // 'ready_state' here = playback-readiness gate (distinct from READY_EVENTS.STATE = "ready check" UX feature)
53
53
  READY_STATE: "ready_state",
54
54
  ERROR: "error"
55
- }, oo = i.enum(["play", "pause", "seek", "load", "home"]), ro = i.object({
55
+ }, io = i.enum(["play", "pause", "seek", "load", "home"]), fo = i.object({
56
56
  framed: i.boolean(),
57
57
  depth: i.number().int().nonnegative().max(10)
58
58
  });
@@ -60,7 +60,7 @@ i.object({
60
60
  room_key: i.string(),
61
61
  name: i.string().min(1).max(32).optional(),
62
62
  sprite: i.string().min(1).max(32).optional(),
63
- embed: ro.optional(),
63
+ embed: fo.optional(),
64
64
  /** Which media-delivery path this client resolved to ('range' | 'fragment').
65
65
  * Optional so older clients still validate. Reported so a party's logs can be split by
66
66
  * arm — without it an A/B rollout is unmeasurable, exactly as entry path was before
@@ -108,13 +108,13 @@ i.object({
108
108
  });
109
109
  i.object({
110
110
  client_seq: i.number().int().positive(),
111
- kind: oo,
111
+ kind: io,
112
112
  to_ms: i.number().int().nonnegative().optional(),
113
113
  media_id: i.string().optional()
114
114
  // leader_id removed - not needed since set_leader control was removed
115
115
  });
116
- const Ea = i.object({
117
- key: i.string().regex(Sa, "not a CDN image key"),
116
+ const Aa = i.object({
117
+ key: i.string().regex(Ta, "not a CDN image key"),
118
118
  /**
119
119
  * Intrinsic pixels, or **0 meaning "unknown"**.
120
120
  *
@@ -127,8 +127,8 @@ const Ea = i.object({
127
127
  * text went with it, with nothing said. Widening is backward compatible —
128
128
  * every message already in history carries positive dimensions.
129
129
  */
130
- w: i.number().int().nonnegative().max(Ft),
131
- h: i.number().int().nonnegative().max(Ft),
130
+ w: i.number().int().nonnegative().max(zt),
131
+ h: i.number().int().nonnegative().max(zt),
132
132
  /**
133
133
  * Human-readable description, rendered as the `alt` text.
134
134
  *
@@ -142,16 +142,16 @@ const Ea = i.object({
142
142
  * value only, never as markup. Bounded so one message cannot carry a
143
143
  * paragraph; the library's own titles run well under this.
144
144
  */
145
- title: i.string().max(no).optional()
146
- }), Aa = /^[A-Za-z0-9_.:-]{1,64}$/;
145
+ title: i.string().max(ro).optional()
146
+ }), Na = /^[A-Za-z0-9_.:-]{1,64}$/;
147
147
  i.object({
148
- text: i.string().max(Ca),
148
+ text: i.string().max(Ia),
149
149
  style: i.string().max(64).optional(),
150
- images: i.array(Ea).max(ae).optional(),
150
+ images: i.array(Aa).max(ae).optional(),
151
151
  /** The message this one replies to. Optional: older clients never send it. */
152
- reply_to: i.string().regex(Aa).optional()
152
+ reply_to: i.string().regex(Na).optional()
153
153
  }).refine((e) => e.text.length > 0 || (e.images?.length ?? 0) > 0, { message: "message must carry text or at least one image" });
154
- const io = i.enum(["join", "leave", "media_change", "identity_change", "recap"]);
154
+ const so = i.enum(["join", "leave", "media_change", "identity_change", "recap"]);
155
155
  i.object({
156
156
  id: i.string(),
157
157
  client_id: i.string(),
@@ -164,7 +164,7 @@ i.object({
164
164
  ts: i.number(),
165
165
  // Optional so a client on an older bundle still validates a message that
166
166
  // has none, and so system messages (which never carry images) stay unchanged.
167
- images: i.array(Ea).max(ae).optional(),
167
+ images: i.array(Aa).max(ae).optional(),
168
168
  /** The id of the message this one answers (resolved by the client from
169
169
  * what it holds; the original may have rolled out of history). */
170
170
  reply_to: i.string().optional(),
@@ -172,14 +172,14 @@ i.object({
172
172
  * ids `author` carries). Absent when there are none. */
173
173
  reactions: i.array(i.object({ emoji: i.string(), by: i.array(i.string()) })).optional(),
174
174
  isSystem: i.boolean().optional(),
175
- systemType: io.optional(),
175
+ systemType: so.optional(),
176
176
  /** A system line about a person: its text with `CHAT_NAME_TOKEN` where their
177
177
  * name goes. `text` is that template filled when sent; a client fills it
178
178
  * again with the person's CURRENT name (found by `author`) while they are
179
179
  * here, so a rename reaches lines already on screen. */
180
180
  template: i.string().optional()
181
181
  });
182
- const xt = "{name}", fo = i.object({
182
+ const St = "{name}", lo = i.object({
183
183
  avg_download_rate_bps: i.number().nonnegative(),
184
184
  buffered_ahead_ms: i.number().nonnegative(),
185
185
  rtt_ms: i.number().nonnegative(),
@@ -221,7 +221,7 @@ const xt = "{name}", fo = i.object({
221
221
  * socket shows here as a growing number while everything else looks fine. */
222
222
  pong_age_ms: i.number().int().nonnegative().optional(),
223
223
  reported_at: i.number().int().nonnegative()
224
- }), so = fo.extend({
224
+ }), co = lo.extend({
225
225
  client_id: i.string(),
226
226
  name: i.string(),
227
227
  sprite_id: i.string().nullable(),
@@ -232,10 +232,10 @@ const xt = "{name}", fo = i.object({
232
232
  stale_ms: i.number().int().nonnegative().optional()
233
233
  });
234
234
  i.object({
235
- clients: i.array(so),
235
+ clients: i.array(co),
236
236
  server_ts: i.number().int().nonnegative()
237
237
  });
238
- const lo = i.object({
238
+ const uo = i.object({
239
239
  client_id: i.string(),
240
240
  sprite_id: i.string().nullable(),
241
241
  name: i.string(),
@@ -253,13 +253,13 @@ const lo = i.object({
253
253
  video_ready_state: i.number().int().default(-1)
254
254
  });
255
255
  i.object({
256
- clients: i.array(lo),
256
+ clients: i.array(uo),
257
257
  server_ts: i.number().int().nonnegative()
258
258
  });
259
259
  i.object({
260
260
  media_id: i.string()
261
261
  });
262
- const St = i.enum(["super_upvote", "upvote", "mid", "downvote"]), co = i.object({
262
+ const Tt = i.enum(["super_upvote", "upvote", "mid", "downvote"]), mo = i.object({
263
263
  mediaId: i.string(),
264
264
  displayName: i.string(),
265
265
  // Enrichment fields — present for flat-playlist ingest output, absent for
@@ -270,11 +270,11 @@ const St = i.enum(["super_upvote", "upvote", "mid", "downvote"]), co = i.object(
270
270
  durationMs: i.number().optional(),
271
271
  uploadDate: i.string().optional()
272
272
  // YouTube upload date 'YYYY-MM-DD'; drives playlist order
273
- }), uo = i.enum(["basic", "vote"]), Na = i.object({
273
+ }), go = i.enum(["basic", "vote"]), ja = i.object({
274
274
  id: i.string(),
275
275
  name: i.string(),
276
- type: uo.default("vote"),
277
- videos: i.array(co),
276
+ type: go.default("vote"),
277
+ videos: i.array(mo),
278
278
  cover: i.string().optional()
279
279
  // media-relative path to the playlist cover image
280
280
  });
@@ -283,28 +283,28 @@ i.object({ index: i.number().int().min(0) });
283
283
  i.object({
284
284
  playlistId: i.string(),
285
285
  mediaId: i.string(),
286
- vote: St
286
+ vote: Tt
287
287
  });
288
288
  i.object({ voterKey: i.string().min(1).max(128) });
289
289
  i.object({ playlistId: i.string(), mediaIds: i.array(i.string()) });
290
290
  i.object({
291
- playlist: Na.nullable(),
291
+ playlist: ja.nullable(),
292
292
  activeIndex: i.number().int().nullable(),
293
- myVotes: i.record(i.string(), St)
293
+ myVotes: i.record(i.string(), Tt)
294
294
  // mediaId -> VoteValue
295
295
  });
296
- const mo = i.object({
296
+ const ho = i.object({
297
297
  clientId: i.string(),
298
298
  name: i.string(),
299
299
  votedCount: i.number().int().nonnegative(),
300
300
  totalVideos: i.number().int().nonnegative()
301
301
  });
302
302
  i.object({
303
- progress: i.array(mo)
303
+ progress: i.array(ho)
304
304
  });
305
305
  i.object({
306
- playlist: Na,
307
- votes: i.record(i.string(), i.record(i.string(), St)),
306
+ playlist: ja,
307
+ votes: i.record(i.string(), i.record(i.string(), Tt)),
308
308
  // votes[clientId][mediaId]
309
309
  names: i.record(i.string(), i.string()),
310
310
  // clientId -> display name
@@ -329,17 +329,17 @@ const Re = {
329
329
  RESULTS: "playlist_results",
330
330
  /** Server -> the removed voter: forget the ballot you hold in localStorage. */
331
331
  VOTES_CLEARED: "playlist_votes_cleared"
332
- }, ja = i.object({
332
+ }, Ra = i.object({
333
333
  id: i.string(),
334
334
  displayName: i.string(),
335
335
  thumbnail: i.string().optional()
336
336
  });
337
337
  i.object({
338
- items: i.array(ja)
338
+ items: i.array(Ra)
339
339
  });
340
- const Ra = i.partialRecord(qe, i.array(i.string()));
341
- i.object({ board: Ra });
342
- const go = i.object({
340
+ const Pa = i.partialRecord(qe, i.array(i.string()));
341
+ i.object({ board: Pa });
342
+ const po = i.object({
343
343
  mediaId: i.string(),
344
344
  tier: qe,
345
345
  absoluteTier: qe,
@@ -352,8 +352,8 @@ const go = i.object({
352
352
  // opaque voterId -> the letter they gave
353
353
  });
354
354
  i.object({
355
- items: i.array(ja),
356
- placed: i.array(go),
355
+ items: i.array(Ra),
356
+ placed: i.array(po),
357
357
  unrated: i.array(i.string()),
358
358
  spread: i.number(),
359
359
  nudged: i.boolean(),
@@ -363,9 +363,9 @@ i.object({
363
363
  * browser on a newer bundle still reads an older server's board. */
364
364
  pictures: i.record(i.string(), i.string()).optional(),
365
365
  voterCount: i.number().int().nonnegative(),
366
- myBoard: Ra
366
+ myBoard: Pa
367
367
  });
368
- const ho = {
368
+ const bo = {
369
369
  /** Broadcast to EVERY connected socket when anyone saves. Carries no board —
370
370
  * it is a "re-fetch" ping, because the shared result is identical for all
371
371
  * viewers but `myBoard` is not, and one payload cannot serve both. */
@@ -378,10 +378,10 @@ i.object({
378
378
  ready: i.array(i.string())
379
379
  // clientIds who have flagged ready
380
380
  });
381
- const po = {
381
+ const yo = {
382
382
  STATE: "ready_check_state"
383
383
  // distinct from buffer-readiness 'ready_state'
384
- }, Pa = {
384
+ }, Ma = {
385
385
  ACTIVE: "game_active",
386
386
  // server -> room (the open game id; null = none)
387
387
  SYNC: "game_sync"
@@ -393,7 +393,7 @@ i.object({
393
393
  i.object({
394
394
  gameId: i.string().nullable()
395
395
  });
396
- const bo = [
396
+ const _o = [
397
397
  {
398
398
  id: "fantasy",
399
399
  characters: [
@@ -437,54 +437,54 @@ const bo = [
437
437
  { id: "mentor", color: "#e1e0dc" }
438
438
  ]
439
439
  }
440
- ], Tt = bo.flatMap((e) => e.characters), Ze = Tt.map((e) => e.id), yo = Object.fromEntries(Tt.map((e) => [e.id, e.color])), _o = Object.fromEntries(Tt.map((e) => [e.id, "rev" in e ? e.rev : 1]));
441
- function wo(e) {
442
- const t = _o[e];
440
+ ], Ct = _o.flatMap((e) => e.characters), Ze = Ct.map((e) => e.id), wo = Object.fromEntries(Ct.map((e) => [e.id, e.color])), vo = Object.fromEntries(Ct.map((e) => [e.id, "rev" in e ? e.rev : 1]));
441
+ function ko(e) {
442
+ const t = vo[e];
443
443
  return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
444
444
  }
445
445
  function et(e) {
446
446
  return !!e && Ze.includes(e);
447
447
  }
448
- const vo = 5e3, Ma = { mode: "off", percent: 0 }, ko = ["off", "on", "ab"];
449
- function xo(e) {
450
- return typeof e == "string" && ko.includes(e);
448
+ const xo = 5e3, Da = { mode: "off", percent: 0 }, So = ["off", "on", "ab"];
449
+ function To(e) {
450
+ return typeof e == "string" && So.includes(e);
451
451
  }
452
- function So(e) {
453
- const t = e && typeof e == "object" ? e : {}, a = xo(t.mode) ? t.mode : Ma.mode, n = Number(t.percent), o = Number.isFinite(n) ? Math.min(100, Math.max(0, Math.round(n))) : 0;
452
+ function Co(e) {
453
+ const t = e && typeof e == "object" ? e : {}, a = To(t.mode) ? t.mode : Da.mode, n = Number(t.percent), o = Number.isFinite(n) ? Math.min(100, Math.max(0, Math.round(n))) : 0;
454
454
  return { mode: a, percent: o };
455
455
  }
456
- function To(e) {
456
+ function Io(e) {
457
457
  let t = 2166136261;
458
458
  for (let a = 0; a < e.length; a++)
459
459
  t ^= e.charCodeAt(a), t = Math.imul(t, 16777619) >>> 0;
460
460
  return t >>> 0;
461
461
  }
462
- function Co(e, t, a) {
462
+ function Eo(e, t, a) {
463
463
  if (a === !0)
464
464
  return "fragment";
465
465
  if (a === !1)
466
466
  return "range";
467
- const n = So(e);
468
- return n.mode === "on" ? "fragment" : n.mode === "off" || n.percent <= 0 ? "range" : n.percent >= 100 || t && To(t) % 100 < n.percent ? "fragment" : "range";
467
+ const n = Co(e);
468
+ return n.mode === "on" ? "fragment" : n.mode === "off" || n.percent <= 0 ? "range" : n.percent >= 100 || t && Io(t) % 100 < n.percent ? "fragment" : "range";
469
469
  }
470
- let Pe = null, Da = xa;
471
- function Io(e) {
472
- e.cdnBase && (Da = e.cdnBase);
470
+ let Pe = null, La = Sa;
471
+ function Ao(e) {
472
+ e.cdnBase && (La = e.cdnBase);
473
473
  }
474
- function La() {
475
- return Da.replace(/\/+$/, "");
474
+ function Oa() {
475
+ return La.replace(/\/+$/, "");
476
476
  }
477
477
  function tt() {
478
- const e = La();
479
- return (!Pe || Pe.base !== e) && (Pe = { base: e, client: jn({ cdnBase: e }) }), Pe.client;
478
+ const e = Oa();
479
+ return (!Pe || Pe.base !== e) && (Pe = { base: e, client: Pn({ cdnBase: e }) }), Pe.client;
480
480
  }
481
481
  function Ke(e) {
482
- return !vt(e) || !La() ? null : tt().urlFor(e);
482
+ return !kt(e) || !Oa() ? null : tt().urlFor(e);
483
483
  }
484
- function Eo(e) {
484
+ function No(e) {
485
485
  return e.kind === "file";
486
486
  }
487
- class Oa extends Error {
487
+ class qa extends Error {
488
488
  constructor(t) {
489
489
  super(t), this.name = "ChatImageUploadError";
490
490
  }
@@ -509,42 +509,42 @@ function He(e) {
509
509
  return "Image upload failed";
510
510
  }
511
511
  }
512
- function Ao(e) {
513
- return e instanceof gt ? He(e.reason) : e instanceof Oa ? e.message : "Image upload failed";
512
+ function jo(e) {
513
+ return e instanceof gt ? He(e.reason) : e instanceof qa ? e.message : "Image upload failed";
514
514
  }
515
- function No(e) {
515
+ function Ro(e) {
516
516
  const t = e.type.toLowerCase().split(";")[0].trim();
517
- return t && Rn(t) !== "image" ? He("unsupported-type") : e.size > Pn.image ? He("too-large") : e.size === 0 ? He("invalid") : null;
517
+ return t && Mn(t) !== "image" ? He("unsupported-type") : e.size > Dn.image ? He("too-large") : e.size === 0 ? He("invalid") : null;
518
518
  }
519
- function jo(e) {
520
- return Dn(e);
519
+ function Po(e) {
520
+ return On(e);
521
521
  }
522
- function Ro(e) {
523
- return Ln(e);
522
+ function Mo(e) {
523
+ return qn(e);
524
524
  }
525
- async function Po(e) {
526
- const t = await Mn(e);
525
+ async function Do(e) {
526
+ const t = await Ln(e);
527
527
  return { w: t?.width ?? 0, h: t?.height ?? 0 };
528
528
  }
529
- async function Mo(e, t = {}) {
529
+ async function Lo(e, t = {}) {
530
530
  const a = await tt().upload(e, { signal: t.signal });
531
- if (!vt(a.key))
532
- throw new Oa("Image upload returned an unusable key");
531
+ if (!kt(a.key))
532
+ throw new qa("Image upload returned an unusable key");
533
533
  return { key: a.key, deduplicated: a.deduplicated === !0 };
534
534
  }
535
- async function Do(e, t = {}) {
535
+ async function Oo(e, t = {}) {
536
536
  const a = [];
537
537
  for (const n of e) {
538
538
  if (n.kind === "remote") {
539
539
  a.push({ key: n.key, w: n.w, h: n.h, ...n.title ? { title: n.title } : {} });
540
540
  continue;
541
541
  }
542
- const { key: o } = await Mo(n.file, t);
542
+ const { key: o } = await Lo(n.file, t);
543
543
  a.push({ key: o, w: n.w, h: n.h });
544
544
  }
545
545
  return a;
546
546
  }
547
- function Lo(e) {
547
+ function qo(e) {
548
548
  return {
549
549
  error: e instanceof Error ? e.message : String(e),
550
550
  name: e instanceof Error ? e.name : typeof e,
@@ -555,38 +555,38 @@ function Lo(e) {
555
555
  function at(e) {
556
556
  return e.key === "Escape" || e.key === "GoBack" || e.key === "BrowserBack" || e.key === "XF86Back" || e.keyCode === 461 || e.keyCode === 10009;
557
557
  }
558
- function Oo(e) {
558
+ function Ho(e) {
559
559
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
560
560
  }
561
- function qo({ className: e }) {
561
+ function Uo({ className: e }) {
562
562
  return /* @__PURE__ */ l(
563
563
  "a",
564
564
  {
565
- href: Oo(window.location),
565
+ href: Ho(window.location),
566
566
  className: e,
567
567
  "data-testid": "sign-in-with-code",
568
568
  children: "Sign in with a code"
569
569
  }
570
570
  );
571
571
  }
572
- const pt = 240, fe = 8, Ho = 28, qa = 240;
573
- function Uo(e, t, a) {
572
+ const pt = 240, fe = 8, $o = 28, Ha = 240;
573
+ function Fo(e, t, a) {
574
574
  let n = t.left - pt - fe;
575
575
  n < fe && (n = t.right + fe), n = Math.min(n, a.width - pt - fe), n = Math.max(fe, n);
576
- const o = qa + Ho;
576
+ const o = Ha + $o;
577
577
  let r = e.top + e.height / 2 - o / 2;
578
578
  return r = Math.min(r, a.height - o - fe), r = Math.max(fe, r), { left: n, top: r };
579
579
  }
580
- const Ha = "/dataplatform/api/memes", $o = 120;
581
- function Fo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
582
- const [o, r] = N(""), f = $(null), s = $(null), c = tt(), { items: h, loading: m, error: S, hasMore: x, loadMore: E } = eo(
580
+ const Ua = "/dataplatform/api/memes", zo = 120;
581
+ function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
582
+ const [o, r] = N(""), f = $(null), s = $(null), c = tt(), { items: g, loading: m, error: k, hasMore: x, loadMore: E } = ao(
583
583
  c,
584
- Ha,
584
+ Ua,
585
585
  o.trim()
586
- ), R = S?.reason ?? null, y = W(() => {
586
+ ), R = k?.reason ?? null, y = F(() => {
587
587
  const I = /* @__PURE__ */ new Set();
588
- return h.filter((j) => I.has(j.key) ? !1 : (I.add(j.key), !0));
589
- }, [h]), [d, u] = N(null), w = $(null), p = M(() => {
588
+ return g.filter((j) => I.has(j.key) ? !1 : (I.add(j.key), !0));
589
+ }, [g]), [d, u] = N(null), w = $(null), p = M(() => {
590
590
  w.current !== null && (window.clearTimeout(w.current), w.current = null);
591
591
  }, []), T = M(() => {
592
592
  p(), u(null);
@@ -596,12 +596,12 @@ function Fo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
596
596
  if (!O) return;
597
597
  const H = () => u({
598
598
  item: I,
599
- ...Uo(j.getBoundingClientRect(), O.getBoundingClientRect(), {
599
+ ...Fo(j.getBoundingClientRect(), O.getBoundingClientRect(), {
600
600
  width: window.innerWidth,
601
601
  height: window.innerHeight
602
602
  })
603
603
  });
604
- p(), A ? H() : w.current = window.setTimeout(H, $o);
604
+ p(), A ? H() : w.current = window.setTimeout(H, zo);
605
605
  },
606
606
  [p]
607
607
  );
@@ -620,9 +620,9 @@ function Fo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
620
620
  document.removeEventListener("keydown", I), document.removeEventListener("mousedown", j);
621
621
  };
622
622
  }, [e, n]);
623
- const F = M((I) => {
623
+ const z = M((I) => {
624
624
  t(I), e();
625
- }, [t, e]), z = !m && !S && y.length === 0;
625
+ }, [t, e]), W = !m && !k && y.length === 0;
626
626
  return /* @__PURE__ */ _(
627
627
  "div",
628
628
  {
@@ -652,7 +652,7 @@ function Fo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
652
652
  onScroll: T,
653
653
  onMouseLeave: T,
654
654
  children: [
655
- S && /* @__PURE__ */ l(
655
+ k && /* @__PURE__ */ l(
656
656
  "p",
657
657
  {
658
658
  className: "m-2 p-2 text-center text-sm bg-danger-bg text-on-danger-bg rounded",
@@ -660,18 +660,18 @@ function Fo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
660
660
  "data-reason": R,
661
661
  children: R === "unauthenticated" ? /* @__PURE__ */ _(te, { children: [
662
662
  "Sign in to browse memes · ",
663
- /* @__PURE__ */ l(qo, { className: "underline text-on-danger-bg" })
663
+ /* @__PURE__ */ l(Uo, { className: "underline text-on-danger-bg" })
664
664
  ] }) : R === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
665
665
  }
666
666
  ),
667
- z && /* @__PURE__ */ l("p", { className: "p-4 text-center text-sm text-text-secondary", children: o.trim() ? `No memes match "${o.trim()}"` : "The meme library is empty" }),
667
+ W && /* @__PURE__ */ l("p", { className: "p-4 text-center text-sm text-text-secondary", children: o.trim() ? `No memes match "${o.trim()}"` : "The meme library is empty" }),
668
668
  y.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: y.map((I) => {
669
669
  const j = Ke(I.key);
670
670
  return j ? /* @__PURE__ */ l(
671
671
  "button",
672
672
  {
673
673
  type: "button",
674
- onClick: () => F(I),
674
+ onClick: () => z(I),
675
675
  title: I.title,
676
676
  "data-testid": "meme-result",
677
677
  onMouseEnter: (A) => {
@@ -734,7 +734,7 @@ function Fo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
734
734
  src: Ke(d.item.key) ?? void 0,
735
735
  alt: "",
736
736
  className: "block w-full rounded bg-bg object-contain",
737
- style: { height: "auto", maxHeight: qa }
737
+ style: { height: "auto", maxHeight: Ha }
738
738
  }
739
739
  ),
740
740
  d.item.title && /* One line. A long title must not change the box height, because
@@ -747,43 +747,43 @@ function Fo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
747
747
  }
748
748
  );
749
749
  }
750
- function zo({ open: e, ...t }) {
751
- return e ? /* @__PURE__ */ l(Fo, { ...t }) : null;
750
+ function Bo({ open: e, ...t }) {
751
+ return e ? /* @__PURE__ */ l(Wo, { ...t }) : null;
752
752
  }
753
- const Ct = {
754
- serverOrigin: `http://localhost:${kt}`,
753
+ const It = {
754
+ serverOrigin: `http://localhost:${xt}`,
755
755
  defaultRoomKey: "dev-room",
756
- cdnBase: xa
756
+ cdnBase: Sa
757
757
  };
758
- let Ue = { ...Ct };
759
- function Wo(e) {
758
+ let Ue = { ...It };
759
+ function Go(e) {
760
760
  const t = Object.fromEntries(
761
761
  Object.entries(e).filter(([a, n]) => n !== void 0)
762
762
  );
763
- Ue = { ...Ue, ...t }, Io({ cdnBase: Ue.cdnBase });
763
+ Ue = { ...Ue, ...t }, Ao({ cdnBase: Ue.cdnBase });
764
764
  }
765
765
  function Te() {
766
766
  return Ue;
767
767
  }
768
- const Bo = wt(Ct);
769
- function Go(e) {
768
+ const Ko = vt(It);
769
+ function Vo(e) {
770
770
  return e.serverOrigin?.replace(/\/$/, "") || "";
771
771
  }
772
- function Ua() {
773
- return Go(Te());
772
+ function $a() {
773
+ return Vo(Te());
774
774
  }
775
- const $a = wt(null);
776
- function Fa() {
777
- return pa($a);
775
+ const Fa = vt(null);
776
+ function za() {
777
+ return ba(Fa);
778
778
  }
779
- const za = wt(!0);
780
- function Wa() {
781
- const e = pa(za);
779
+ const Wa = vt(!0);
780
+ function Ba() {
781
+ const e = ba(Wa);
782
782
  P(() => {
783
- e && On();
783
+ e && Hn();
784
784
  }, [e]);
785
785
  }
786
- function Ba(e) {
786
+ function Ga(e) {
787
787
  return e ? { "--hc-base": e } : {};
788
788
  }
789
789
  const we = Ge.memo(
@@ -792,7 +792,7 @@ const we = Ge.memo(
792
792
  },
793
793
  (e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
794
794
  );
795
- function Ko(e, t) {
795
+ function Yo(e, t) {
796
796
  P(() => {
797
797
  const a = e.current;
798
798
  if (!a || !t || typeof IntersectionObserver > "u") return;
@@ -834,7 +834,7 @@ function ot(e, t) {
834
834
  return !1;
835
835
  }
836
836
  }
837
- function Vo() {
837
+ function Jo() {
838
838
  try {
839
839
  const e = nt();
840
840
  if (!e) return [];
@@ -854,45 +854,45 @@ function Ve(e) {
854
854
  } catch {
855
855
  }
856
856
  }
857
- function Yo(e) {
857
+ function Xo(e) {
858
858
  const t = B(e);
859
859
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
860
860
  }
861
- const Ga = /* @__PURE__ */ new Map();
862
- let Ka = !1;
861
+ const Ka = /* @__PURE__ */ new Map();
862
+ let Va = !1;
863
863
  function rt(e, t) {
864
- Ga.set(e, t), Ka && Va(e, t);
864
+ Ka.set(e, t), Va && Ya(e, t);
865
865
  }
866
- function Jo() {
867
- Ka = !0;
868
- for (const [e, t] of Ga) Va(e, t);
866
+ function Qo() {
867
+ Va = !0;
868
+ for (const [e, t] of Ka) Ya(e, t);
869
869
  }
870
- function Va(e, t) {
870
+ function Ya(e, t) {
871
871
  typeof window > "u" || (window[e] = t);
872
872
  }
873
- const be = [], Xo = 500;
873
+ const be = [], Zo = 500;
874
874
  let $e = [], bt = null;
875
- const Qo = 1e3, Zo = 200;
875
+ const er = 1e3, tr = 200;
876
876
  let yt = null;
877
- function Ya(e) {
877
+ function Ja(e) {
878
878
  yt = e;
879
879
  }
880
- function Ja() {
880
+ function Xa() {
881
881
  return B(oe.REPORT_LOGS_FLAG) === "true";
882
882
  }
883
- function er() {
883
+ function ar() {
884
884
  if (typeof window > "u") return !1;
885
885
  if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
886
886
  const t = B(oe.DEBUG_FLAG);
887
887
  return t !== null && t !== "false";
888
888
  }
889
- function tr() {
889
+ function nr() {
890
890
  const e = B(oe.DEBUG_FLAG);
891
891
  if (!e || e === "true") return null;
892
892
  const t = e.split(",").map((a) => a.trim().toLowerCase()).filter(Boolean);
893
893
  return t.length > 0 ? new Set(t) : null;
894
894
  }
895
- function ar() {
895
+ function or() {
896
896
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
897
897
  hour12: !1,
898
898
  hour: "2-digit",
@@ -901,8 +901,8 @@ function ar() {
901
901
  fractionalSecondDigits: 3
902
902
  });
903
903
  }
904
- function nr(e) {
905
- be.push(e), be.length > Xo && be.shift();
904
+ function rr(e) {
905
+ be.push(e), be.length > Zo && be.shift();
906
906
  }
907
907
  const st = {
908
908
  debug: "color: #64748b; font-weight: normal;",
@@ -911,14 +911,14 @@ const st = {
911
911
  category: "color: #3b82f6; font-weight: bold;",
912
912
  time: "color: #6b7280; font-weight: normal;"
913
913
  };
914
- function or(e) {
914
+ function ir(e) {
915
915
  try {
916
916
  return JSON.stringify(e);
917
917
  } catch {
918
918
  return "[unserializable]";
919
919
  }
920
920
  }
921
- function It(e, t, a, n, o, r, f) {
921
+ function Et(e, t, a, n, o, r, f) {
922
922
  const s = {
923
923
  level: e,
924
924
  category: o,
@@ -926,47 +926,47 @@ function It(e, t, a, n, o, r, f) {
926
926
  data: f,
927
927
  timestamp: Date.now()
928
928
  };
929
- if (nr(s), (a || Ja()) && zt(s), !n) {
930
- if (!er()) return;
931
- const m = tr();
929
+ if (rr(s), (a || Xa()) && Wt(s), !n) {
930
+ if (!ar()) return;
931
+ const m = nr();
932
932
  if (m && !m.has(o.toLowerCase())) return;
933
933
  }
934
- const c = ar(), h = f !== void 0 ? " " + or(f) : "";
934
+ const c = or(), g = f !== void 0 ? " " + ir(f) : "";
935
935
  t(
936
- `%c[${c}]%c [${o}]%c ${r}${h}`,
936
+ `%c[${c}]%c [${o}]%c ${r}${g}`,
937
937
  st.time,
938
938
  st.category,
939
939
  st[e]
940
940
  );
941
941
  }
942
942
  function b(e, t, a) {
943
- It("debug", console.log, !1, !1, e, t, a);
943
+ Et("debug", console.log, !1, !1, e, t, a);
944
944
  }
945
945
  function D(e, t, a) {
946
- It("warn", console.warn, !0, !1, e, t, a);
946
+ Et("warn", console.warn, !0, !1, e, t, a);
947
947
  }
948
948
  function Fe(e, t, a) {
949
- It("error", console.error, !0, !0, e, t, a);
949
+ Et("error", console.error, !0, !0, e, t, a);
950
950
  }
951
- function rr() {
951
+ function fr() {
952
952
  return [...be];
953
953
  }
954
- function ir() {
954
+ function sr() {
955
955
  be.length = 0;
956
956
  }
957
- function fr(e) {
957
+ function lr(e) {
958
958
  const t = e && e.length > 0 ? e.join(",") : "true";
959
959
  ot(oe.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
960
960
  }
961
- function sr() {
961
+ function cr() {
962
962
  Ve(oe.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
963
963
  }
964
- const lr = 1024, cr = 5e4;
965
- function dr(e) {
964
+ const dr = 1024, ur = 5e4;
965
+ function mr(e) {
966
966
  if (e == null) return e;
967
967
  try {
968
968
  const t = JSON.stringify(e);
969
- if (t.length <= lr) return e;
969
+ if (t.length <= dr) return e;
970
970
  if (typeof e == "object" && !Array.isArray(e)) {
971
971
  const a = {};
972
972
  for (const [n, o] of Object.entries(e)) {
@@ -980,7 +980,7 @@ function dr(e) {
980
980
  return "[unserializable]";
981
981
  }
982
982
  }
983
- async function ur() {
983
+ async function gr() {
984
984
  if ($e.length === 0) return;
985
985
  const e = $e;
986
986
  $e = [], bt = null;
@@ -988,13 +988,13 @@ async function ur() {
988
988
  let a = Te().serverOrigin || "";
989
989
  if ((a === "/" || !a) && typeof window < "u") {
990
990
  const s = window.location;
991
- (s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(Ta) ? a = `${s.protocol}//${s.hostname}:${kt}` : a = s.origin;
991
+ (s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(Ca) ? a = `${s.protocol}//${s.hostname}:${xt}` : a = s.origin;
992
992
  }
993
993
  const n = `${a.replace(/\/$/, "")}/api/client-log`, o = e.map((s) => ({
994
994
  level: s.level,
995
995
  category: s.category,
996
996
  message: s.message,
997
- data: dr(s.data),
997
+ data: mr(s.data),
998
998
  timestamp: s.timestamp,
999
999
  url: typeof window < "u" ? window.location.href : void 0,
1000
1000
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
@@ -1004,7 +1004,7 @@ async function ur() {
1004
1004
  let r = [], f = 0;
1005
1005
  for (const s of o) {
1006
1006
  const c = JSON.stringify(s).length + 1;
1007
- f + c > cr && r.length > 0 && (await fetch(n, {
1007
+ f + c > ur && r.length > 0 && (await fetch(n, {
1008
1008
  method: "POST",
1009
1009
  headers: { "Content-Type": "application/json" },
1010
1010
  body: JSON.stringify({ logs: r })
@@ -1019,11 +1019,11 @@ async function ur() {
1019
1019
  console.warn("[wp] log flush failed (client logs may be lost):", Ce(t).error);
1020
1020
  }
1021
1021
  }
1022
- function zt(e) {
1022
+ function Wt(e) {
1023
1023
  if ($e.push(e), !bt) {
1024
- const t = Ja() ? Zo : Qo;
1024
+ const t = Xa() ? tr : er;
1025
1025
  bt = setTimeout(() => {
1026
- ur();
1026
+ gr();
1027
1027
  }, t);
1028
1028
  }
1029
1029
  }
@@ -1031,16 +1031,16 @@ function Ce(e) {
1031
1031
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
1032
1032
  }
1033
1033
  rt("__wpDebug", {
1034
- enable: fr,
1035
- disable: sr,
1036
- history: rr,
1037
- clear: ir
1034
+ enable: lr,
1035
+ disable: cr,
1036
+ history: fr,
1037
+ clear: sr
1038
1038
  });
1039
- const mr = 1280;
1040
- function gr(e) {
1041
- return e.screenWidth < mr ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1039
+ const hr = 1280;
1040
+ function pr(e) {
1041
+ return e.screenWidth < hr ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1042
1042
  }
1043
- function hr() {
1043
+ function br() {
1044
1044
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
1045
1045
  return {
1046
1046
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -1049,38 +1049,38 @@ function hr() {
1049
1049
  screenWidth: typeof screen < "u" ? screen.width : 0
1050
1050
  };
1051
1051
  }
1052
- let Wt = null;
1053
- function pr() {
1054
- return Wt ??= gr(hr()), Wt;
1052
+ let Bt = null;
1053
+ function yr() {
1054
+ return Bt ??= pr(br()), Bt;
1055
1055
  }
1056
- function Bt() {
1057
- return pr();
1056
+ function Gt() {
1057
+ return yr();
1058
1058
  }
1059
1059
  const ne = {
1060
1060
  resolved: !1,
1061
1061
  userType: "public",
1062
1062
  accountId: null
1063
1063
  };
1064
- function Et() {
1064
+ function At() {
1065
1065
  return ne.accountId ? ne.accountId : ne.resolved && ne.userType === "public" ? "anon" : null;
1066
1066
  }
1067
- function br(e) {
1067
+ function _r(e) {
1068
1068
  ne.resolved = !0, e.userType && (ne.userType = e.userType), e.userId !== void 0 && (ne.accountId = e.userId && e.userId !== "public" ? e.userId : null);
1069
1069
  }
1070
- function At() {
1070
+ function Nt() {
1071
1071
  return ne.accountId ?? "public";
1072
1072
  }
1073
- function yr() {
1074
- return Et() ?? "unscoped";
1073
+ function wr() {
1074
+ return At() ?? "unscoped";
1075
1075
  }
1076
- function Xa(e) {
1077
- return et(e) ? yo[e] : "var(--color-neutral-bg)";
1076
+ function Qa(e) {
1077
+ return et(e) ? wo[e] : "var(--color-neutral-bg)";
1078
1078
  }
1079
- function _r(e) {
1080
- return et(e) ? `${Te().serverOrigin.replace(/\/$/, "")}${wo(e)}` : void 0;
1079
+ function vr(e) {
1080
+ return et(e) ? `${Te().serverOrigin.replace(/\/$/, "")}${ko(e)}` : void 0;
1081
1081
  }
1082
1082
  let ve = null, Me = null;
1083
- function wr() {
1083
+ function kr() {
1084
1084
  return ve ? Promise.resolve() : Me || (Me = (async () => {
1085
1085
  try {
1086
1086
  const e = Te().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
@@ -1099,7 +1099,7 @@ function le(e) {
1099
1099
  const t = e.toLowerCase();
1100
1100
  return Ze.some((a) => a === t) ? !0 : ve ? Object.values(ve).some((a) => a.toLowerCase() === t) : !1;
1101
1101
  }
1102
- const vr = i.object({
1102
+ const xr = i.object({
1103
1103
  // Identity. There is deliberately NO `name`: a person's name is their
1104
1104
  // hadoku key-registry name, resolved by the server from whoami and renamed
1105
1105
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -1124,18 +1124,18 @@ const vr = i.object({
1124
1124
  preferredAudioLang: i.string().optional(),
1125
1125
  subtitlesEnabled: i.boolean().optional(),
1126
1126
  subtitleStyle: i.string().optional()
1127
- }), ye = Kn({
1127
+ }), ye = Yn({
1128
1128
  appId: "watchparty",
1129
- schema: vr
1130
- }), kr = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1129
+ schema: xr
1130
+ }), Sr = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1131
1131
  function Ye(e) {
1132
- const t = Et();
1132
+ const t = At();
1133
1133
  return t ? `prefs-cache:${t}:${e}` : null;
1134
1134
  }
1135
- function xr() {
1136
- return Et() === null;
1135
+ function Tr() {
1136
+ return At() === null;
1137
1137
  }
1138
- function Gt(e) {
1138
+ function Kt(e) {
1139
1139
  const t = Ye(e);
1140
1140
  if (!t) return {};
1141
1141
  const a = B(t);
@@ -1146,9 +1146,9 @@ function Gt(e) {
1146
1146
  return {};
1147
1147
  }
1148
1148
  }
1149
- function Sr() {
1149
+ function Cr() {
1150
1150
  let e = 0;
1151
- for (const t of Vo()) {
1151
+ for (const t of Jo()) {
1152
1152
  const a = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), n = t === Je || t.startsWith(`${Je}:`) && !t.endsWith(":_serverSynced_v1");
1153
1153
  if (!a && !n) continue;
1154
1154
  const o = B(t);
@@ -1161,18 +1161,18 @@ function Sr() {
1161
1161
  }
1162
1162
  const f = a ? r?.blob : r;
1163
1163
  if (!f || typeof f != "object" || !("name" in f)) continue;
1164
- const { name: s, ...c } = f, h = a ? { ...r, blob: c } : c;
1165
- ot(t, JSON.stringify(h)) && e++;
1164
+ const { name: s, ...c } = f, g = a ? { ...r, blob: c } : c;
1165
+ ot(t, JSON.stringify(g)) && e++;
1166
1166
  }
1167
1167
  return e > 0 && b("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
1168
1168
  }
1169
- let Qa = null, Za = null;
1170
- const Kt = /* @__PURE__ */ new Set();
1171
- function Nt() {
1172
- if (xr())
1169
+ let Za = null, en = null;
1170
+ const Vt = /* @__PURE__ */ new Set();
1171
+ function jt() {
1172
+ if (Tr())
1173
1173
  return b("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1174
- const e = Gt("portfolio"), t = Gt("watchparty"), a = Object.keys(e).length > 0 ? e : Qa ?? {}, n = Object.keys(t).length > 0 ? t : Za ?? {}, o = At() || "public";
1175
- if (Kt.has(o))
1174
+ const e = Kt("portfolio"), t = Kt("watchparty"), a = Object.keys(e).length > 0 ? e : Za ?? {}, n = Object.keys(t).length > 0 ? t : en ?? {}, o = Nt() || "public";
1175
+ if (Vt.has(o))
1176
1176
  return b("preferences", "Loaded (sync, SDK-only after first read)", {
1177
1177
  uid: o,
1178
1178
  sdkThemeKeys: Object.keys(a).length,
@@ -1182,8 +1182,8 @@ function Nt() {
1182
1182
  themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
1183
1183
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1184
1184
  }), { ...n, ...a };
1185
- Kt.add(o);
1186
- const r = tn() ?? {}, f = { ...r, ...n, ...a };
1185
+ Vt.add(o);
1186
+ const r = an() ?? {}, f = { ...r, ...n, ...a };
1187
1187
  return b("preferences", "Loaded (sync, first read — legacy + SDK)", {
1188
1188
  uid: o,
1189
1189
  sdkThemeKeys: Object.keys(a).length,
@@ -1193,30 +1193,30 @@ function Nt() {
1193
1193
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1194
1194
  }), f;
1195
1195
  }
1196
- let en = !1;
1197
- function Tr() {
1198
- const e = At();
1196
+ let tn = !1;
1197
+ function Ir() {
1198
+ const e = Nt();
1199
1199
  return !e || e === "public";
1200
1200
  }
1201
1201
  function J(e, t) {
1202
- Tr() && (en = !0), kr.has(e) ? pe.save({ [e]: t }, { scope: "device" }).catch((a) => D("preferences", "themePrefs.save failed", { key: e, err: a?.message })) : ye.save({ [e]: t }).catch((a) => D("preferences", "watchpartyPrefs.save failed", { key: e, err: a?.message })), b("preferences", "Saved (via SDK)", { key: e, value: t });
1202
+ Ir() && (tn = !0), Sr.has(e) ? pe.save({ [e]: t }, { scope: "device" }).catch((a) => D("preferences", "themePrefs.save failed", { key: e, err: a?.message })) : ye.save({ [e]: t }).catch((a) => D("preferences", "watchpartyPrefs.save failed", { key: e, err: a?.message })), b("preferences", "Saved (via SDK)", { key: e, value: t });
1203
1203
  }
1204
- let De = null, Vt = !1;
1205
- function Cr() {
1204
+ let De = null, Yt = !1;
1205
+ function Er() {
1206
1206
  return De || (De = (async () => {
1207
1207
  if (typeof window > "u") return !1;
1208
1208
  try {
1209
- Vt || (Vt = !0, pe.subscribe((f) => {
1210
- Qa = f, Xt("portfolio", f), Qt("theme");
1209
+ Yt || (Yt = !0, pe.subscribe((f) => {
1210
+ Za = f, Qt("portfolio", f), Zt("theme");
1211
1211
  }), ye.subscribe((f) => {
1212
- Za = f, Xt("watchparty", f), Qt("watchparty");
1212
+ en = f, Qt("watchparty", f), Zt("watchparty");
1213
1213
  }));
1214
1214
  const [e, t] = await Promise.all([
1215
1215
  pe.read(),
1216
1216
  ye.read()
1217
1217
  ]);
1218
1218
  try {
1219
- const { useAppStore: f } = await Promise.resolve().then(() => rn);
1219
+ const { useAppStore: f } = await Promise.resolve().then(() => fn);
1220
1220
  f.getState().rehydrateFromPrefs();
1221
1221
  } catch (f) {
1222
1222
  D("preferences", "inline rehydrate after SDK read failed", { err: f?.message });
@@ -1228,7 +1228,7 @@ function Cr() {
1228
1228
  // Post-fetch cache state: should be non-zero if SDK wrote it.
1229
1229
  sdkThemeBytesPost: o?.length ?? 0,
1230
1230
  sdkAppBytesPost: r?.length ?? 0
1231
- }), await Ir(e, t), en ? (b("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1231
+ }), await Ar(e, t), tn ? (b("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1232
1232
  pe.promoteAnonPrefsToUser().catch(() => {
1233
1233
  }),
1234
1234
  ye.promoteAnonPrefsToUser().catch(() => {
@@ -1240,12 +1240,12 @@ function Cr() {
1240
1240
  })(), De);
1241
1241
  }
1242
1242
  const Je = "watchparty_preferences";
1243
- Sr();
1243
+ Cr();
1244
1244
  function _t() {
1245
- const e = At();
1245
+ const e = Nt();
1246
1246
  return !e || e === "public" ? Je : `${Je}:${e}`;
1247
1247
  }
1248
- function tn() {
1248
+ function an() {
1249
1249
  const e = B(_t());
1250
1250
  if (!e) return null;
1251
1251
  try {
@@ -1255,18 +1255,18 @@ function tn() {
1255
1255
  return null;
1256
1256
  }
1257
1257
  }
1258
- function Yt() {
1258
+ function Jt() {
1259
1259
  Ve(_t()), Ve(`${_t()}:_serverSynced_v1`);
1260
1260
  }
1261
- async function Ir(e, t) {
1262
- const a = tn();
1261
+ async function Ar(e, t) {
1262
+ const a = an();
1263
1263
  if (!a || Object.keys(a).length === 0) return;
1264
1264
  const n = Object.keys(e ?? {}).length > 0, o = Object.keys(t ?? {}).length > 0, r = {}, f = {};
1265
- for (const [h, m] of Object.entries(a))
1266
- n || (h === "theme" && typeof m == "string" ? r.theme = m : h === "themeMode" && (m === "simple" || m === "advanced") && (r.themeMode = m)), o || (h === "chatCollapsed" && typeof m == "boolean" ? f.chatCollapsed = m : h === "floatingChatEnabled" && typeof m == "boolean" ? f.floatingChatEnabled = m : h === "volume" && typeof m == "number" && m >= 0 && m <= 1 ? f.volume = m : h === "muted" && typeof m == "boolean" ? f.muted = m : h === "preferredAudioLang" && typeof m == "string" ? f.preferredAudioLang = m : h === "subtitlesEnabled" && typeof m == "boolean" ? f.subtitlesEnabled = m : h === "subtitleStyle" && typeof m == "string" && (f.subtitleStyle = m));
1265
+ for (const [g, m] of Object.entries(a))
1266
+ n || (g === "theme" && typeof m == "string" ? r.theme = m : g === "themeMode" && (m === "simple" || m === "advanced") && (r.themeMode = m)), o || (g === "chatCollapsed" && typeof m == "boolean" ? f.chatCollapsed = m : g === "floatingChatEnabled" && typeof m == "boolean" ? f.floatingChatEnabled = m : g === "volume" && typeof m == "number" && m >= 0 && m <= 1 ? f.volume = m : g === "muted" && typeof m == "boolean" ? f.muted = m : g === "preferredAudioLang" && typeof m == "string" ? f.preferredAudioLang = m : g === "subtitlesEnabled" && typeof m == "boolean" ? f.subtitlesEnabled = m : g === "subtitleStyle" && typeof m == "string" && (f.subtitleStyle = m));
1267
1267
  const s = Object.keys(r), c = Object.keys(f);
1268
1268
  if (s.length === 0 && c.length === 0) {
1269
- Yt();
1269
+ Jt();
1270
1270
  return;
1271
1271
  }
1272
1272
  b("preferences", "Migrating legacy localStorage prefs to SDK", {
@@ -1279,15 +1279,15 @@ async function Ir(e, t) {
1279
1279
  await Promise.all([
1280
1280
  s.length > 0 ? pe.save(r, { scope: "device" }) : Promise.resolve(),
1281
1281
  c.length > 0 ? ye.save(f) : Promise.resolve()
1282
- ]), Yt(), b("preferences", "Legacy migration complete");
1283
- } catch (h) {
1282
+ ]), Jt(), b("preferences", "Legacy migration complete");
1283
+ } catch (g) {
1284
1284
  D("preferences", "Legacy migration save failed — will retry next load", {
1285
- err: h?.message
1285
+ err: g?.message
1286
1286
  });
1287
1287
  }
1288
1288
  }
1289
- let Jt = !1;
1290
- function Xt(e, t) {
1289
+ let Xt = !1;
1290
+ function Qt(e, t) {
1291
1291
  const a = Ye(e);
1292
1292
  if (a)
1293
1293
  try {
@@ -1299,15 +1299,15 @@ function Xt(e, t) {
1299
1299
  };
1300
1300
  localStorage.setItem(a, JSON.stringify(n));
1301
1301
  } catch (n) {
1302
- Jt || (Jt = !0, D("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
1302
+ Xt || (Xt = !0, D("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
1303
1303
  appId: e,
1304
1304
  err: n?.message,
1305
1305
  name: n?.name
1306
1306
  }));
1307
1307
  }
1308
1308
  }
1309
- function Qt(e) {
1310
- Promise.resolve().then(() => rn).then(({ useAppStore: t }) => {
1309
+ function Zt(e) {
1310
+ Promise.resolve().then(() => fn).then(({ useAppStore: t }) => {
1311
1311
  try {
1312
1312
  t.getState().rehydrateFromPrefs();
1313
1313
  } catch (a) {
@@ -1315,37 +1315,37 @@ function Qt(e) {
1315
1315
  }
1316
1316
  }).catch((t) => D("preferences", "store import failed", { reason: e, err: t?.message }));
1317
1317
  }
1318
- const an = 320, Xe = 240, jt = 640, Er = 320, Ar = 36, Zt = 16;
1318
+ const nn = 320, Xe = 240, Rt = 640, Nr = 320, jr = 36, ea = 16;
1319
1319
  function Z(e, t) {
1320
- if (!Number.isFinite(e)) return an;
1321
- let a = jt;
1322
- return t !== void 0 && Number.isFinite(t) && t > 0 && (a = Math.min(a, t - Er)), a = Math.max(a, Xe), Math.round(Math.min(a, Math.max(Xe, e)));
1320
+ if (!Number.isFinite(e)) return nn;
1321
+ let a = Rt;
1322
+ return t !== void 0 && Number.isFinite(t) && t > 0 && (a = Math.min(a, t - Nr)), a = Math.max(a, Xe), Math.round(Math.min(a, Math.max(Xe, e)));
1323
1323
  }
1324
- function ea(e, t, a, n) {
1324
+ function ta(e, t, a, n) {
1325
1325
  return Z(e + (t - a), n);
1326
1326
  }
1327
- function Nr(e, t, a) {
1327
+ function Rr(e, t, a) {
1328
1328
  switch (t) {
1329
1329
  case "ArrowLeft":
1330
- return Z(e + Zt, a);
1330
+ return Z(e + ea, a);
1331
1331
  case "ArrowRight":
1332
- return Z(e - Zt, a);
1332
+ return Z(e - ea, a);
1333
1333
  case "Home":
1334
1334
  return Z(Xe, a);
1335
1335
  case "End":
1336
- return Z(jt, a);
1336
+ return Z(Rt, a);
1337
1337
  default:
1338
1338
  return null;
1339
1339
  }
1340
1340
  }
1341
- function jr(e, t) {
1342
- return { collapsed: e, width: e ? Ar : t };
1341
+ function Pr(e, t) {
1342
+ return { collapsed: e, width: e ? jr : t };
1343
1343
  }
1344
- function nn(e, t) {
1344
+ function on(e, t) {
1345
1345
  const a = new Set(t.map((r) => r.id)), n = t.reduce((r, f) => Math.max(r, f.ts), -1 / 0), o = e.filter((r) => !a.has(r.id) && r.ts > n);
1346
1346
  return o.length ? [...t, ...o] : t;
1347
1347
  }
1348
- const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1348
+ const rn = 6e3, X = jt(), h = Gn((e, t) => ({
1349
1349
  ready: !1,
1350
1350
  name: "",
1351
1351
  sprite: null,
@@ -1358,7 +1358,7 @@ const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1358
1358
  chatJump: null,
1359
1359
  chatCollapsed: X.chatCollapsed ?? !1,
1360
1360
  chromeChatCollapsed: X.chromeChatCollapsed ?? !1,
1361
- chromeChatWidth: Z(X.chromeChatWidth ?? an),
1361
+ chromeChatWidth: Z(X.chromeChatWidth ?? nn),
1362
1362
  // Hardcoded on for everyone — the per-user toggle was removed from the
1363
1363
  // control bar; FloatingChat + toggleFloatingChat code is kept for future
1364
1364
  // re-enablement but the value is no longer user-controllable.
@@ -1405,7 +1405,7 @@ const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1405
1405
  const r = ke(a.sprite);
1406
1406
  return b("store", "Auto-identity: deriving name from the requested sprite", { name: r, sprite: a.sprite }), { name: r };
1407
1407
  }
1408
- const n = Object.values(a.roster).map((r) => r.sprite), o = va(n, void 0, Ze);
1408
+ const n = Object.values(a.roster).map((r) => r.sprite), o = ka(n, void 0, Ze);
1409
1409
  if (o) {
1410
1410
  const r = ke(o);
1411
1411
  return b("store", "Auto-identity assigned", { name: r, sprite: o }), { name: r, sprite: o };
@@ -1460,7 +1460,7 @@ const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1460
1460
  return delete o[a.clientId], { chat: [...n.chat, a].slice(-500), typing: o };
1461
1461
  });
1462
1462
  },
1463
- setChat: (a) => e((n) => ({ chat: nn(n.chat, a).slice(-500) })),
1463
+ setChat: (a) => e((n) => ({ chat: on(n.chat, a).slice(-500) })),
1464
1464
  setReplyingTo: (a) => e(() => ({ replyingTo: a })),
1465
1465
  setReactions: (a, n) => e((o) => {
1466
1466
  const r = o.chat.findIndex((s) => s.id === a);
@@ -1471,12 +1471,12 @@ const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1471
1471
  setTyping: (a, n) => e((o) => {
1472
1472
  if (!n && !(a in o.typing)) return {};
1473
1473
  const r = { ...o.typing };
1474
- return n ? r[a] = Date.now() + on : delete r[a], { typing: r };
1474
+ return n ? r[a] = Date.now() + rn : delete r[a], { typing: r };
1475
1475
  }),
1476
1476
  jumpToMessage: (a) => e(() => ({ chatJump: { id: a, at: Date.now() } })),
1477
1477
  toggleChatCollapsed: () => e((a) => {
1478
1478
  const n = !a.chatCollapsed;
1479
- return Bt() || J("chatCollapsed", n), { chatCollapsed: n };
1479
+ return Gt() || J("chatCollapsed", n), { chatCollapsed: n };
1480
1480
  }),
1481
1481
  applyTvDefaults: () => e(() => ({ chatCollapsed: !0 })),
1482
1482
  toggleChromeChatCollapsed: () => e((a) => {
@@ -1567,8 +1567,8 @@ const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1567
1567
  moveTierlistItem: (a, n, o) => e((r) => {
1568
1568
  const f = {};
1569
1569
  for (const [s, c] of Object.entries(r.tierlistDraft)) {
1570
- const h = (c ?? []).filter((m) => m !== a);
1571
- h.length > 0 && (f[s] = h);
1570
+ const g = (c ?? []).filter((m) => m !== a);
1571
+ g.length > 0 && (f[s] = g);
1572
1572
  }
1573
1573
  if (n !== null) {
1574
1574
  const s = f[n] ?? [], c = Math.max(0, Math.min(o ?? s.length, s.length));
@@ -1581,8 +1581,8 @@ const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1581
1581
  setGameSettings: (a) => e({ gameSettings: a }),
1582
1582
  setRoomKeyType: (a) => e({ roomKeyType: a }),
1583
1583
  rehydrateFromPrefs: () => e((a) => {
1584
- const n = Nt(), o = {};
1585
- if (n.chatCollapsed !== void 0 && !Bt() && (o.chatCollapsed = n.chatCollapsed), n.chromeChatCollapsed !== void 0 && (o.chromeChatCollapsed = n.chromeChatCollapsed), n.chromeChatWidth !== void 0 && (o.chromeChatWidth = Z(n.chromeChatWidth)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((s) => n[s] !== void 0)) {
1584
+ const n = jt(), o = {};
1585
+ if (n.chatCollapsed !== void 0 && !Gt() && (o.chatCollapsed = n.chatCollapsed), n.chromeChatCollapsed !== void 0 && (o.chromeChatCollapsed = n.chromeChatCollapsed), n.chromeChatWidth !== void 0 && (o.chromeChatWidth = Z(n.chromeChatWidth)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((s) => n[s] !== void 0)) {
1586
1586
  const s = { ...a.mediaPrefs };
1587
1587
  n.volume !== void 0 && (s.volume = n.volume), n.muted !== void 0 && (s.muted = n.muted), n.preferredAudioLang !== void 0 && (s.preferredAudioLang = n.preferredAudioLang), n.subtitlesEnabled !== void 0 && (s.subtitlesEnabled = n.subtitlesEnabled), n.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(n.subtitleStyle) && (s.subtitleStyle = n.subtitleStyle), o.mediaPrefs = s;
1588
1588
  }
@@ -1590,92 +1590,92 @@ const on = 6e3, X = Nt(), g = Wn((e, t) => ({
1590
1590
  }),
1591
1591
  setSidebarTab: (a) => e((n) => n.sidebarTab === a && a !== "chat" ? { sidebarTab: "chat" } : { sidebarTab: a, chatCollapsed: !1 })
1592
1592
  }));
1593
- rt("__ZUSTAND_STORE__", g);
1594
- const rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1593
+ rt("__ZUSTAND_STORE__", h);
1594
+ const fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1595
1595
  __proto__: null,
1596
- TYPING_EXPIRE_MS: on,
1597
- mergeHistory: nn,
1598
- useAppStore: g
1599
- }, Symbol.toStringTag, { value: "Module" })), Rr = 5e3;
1600
- function Pr(e, t, a) {
1596
+ TYPING_EXPIRE_MS: rn,
1597
+ mergeHistory: on,
1598
+ useAppStore: h
1599
+ }, Symbol.toStringTag, { value: "Module" })), Mr = 5e3;
1600
+ function Dr(e, t, a) {
1601
1601
  return !!e?.some((n) => n.emoji === t && n.by.includes(a));
1602
1602
  }
1603
- function Mr(e, t, a) {
1603
+ function Lr(e, t, a) {
1604
1604
  let n = e ?? [];
1605
- for (const [o, r] of t) n = Bn(n, o, a, r.on) ?? n;
1605
+ for (const [o, r] of t) n = Kn(n, o, a, r.on) ?? n;
1606
1606
  return n;
1607
1607
  }
1608
- function Dr(e, t, a, n) {
1608
+ function Or(e, t, a, n) {
1609
1609
  const o = /* @__PURE__ */ new Map();
1610
1610
  for (const [r, f] of t)
1611
- f.expires <= n || Pr(e, r, a) !== f.on && o.set(r, f);
1611
+ f.expires <= n || Dr(e, r, a) !== f.on && o.set(r, f);
1612
1612
  return o;
1613
1613
  }
1614
1614
  const xe = /* @__PURE__ */ new Map();
1615
- function Rt(e, t) {
1616
- if (t.intents = Dr(t.confirmed, t.intents, t.handle, Date.now()), g.getState().setReactions(e, Mr(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
1615
+ function Pt(e, t) {
1616
+ if (t.intents = Or(t.confirmed, t.intents, t.handle, Date.now()), h.getState().setReactions(e, Lr(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
1617
1617
  xe.delete(e);
1618
1618
  return;
1619
1619
  }
1620
1620
  const a = Math.min(...[...t.intents.values()].map((n) => n.expires));
1621
1621
  t.timer = setTimeout(() => {
1622
- xe.get(e) === t && Rt(e, t);
1622
+ xe.get(e) === t && Pt(e, t);
1623
1623
  }, Math.max(0, a - Date.now()));
1624
1624
  }
1625
- function Lr(e, t, a, n) {
1625
+ function qr(e, t, a, n) {
1626
1626
  let o = xe.get(e);
1627
- o || (o = { confirmed: g.getState().chat.find((f) => f.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: n, timer: null }, xe.set(e, o)), o.handle = n, o.intents.delete(t), o.intents.set(t, { on: a, expires: Date.now() + Rr }), Rt(e, o);
1627
+ o || (o = { confirmed: h.getState().chat.find((f) => f.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: n, timer: null }, xe.set(e, o)), o.handle = n, o.intents.delete(t), o.intents.set(t, { on: a, expires: Date.now() + Mr }), Pt(e, o);
1628
1628
  }
1629
- function Or(e, t) {
1629
+ function Hr(e, t) {
1630
1630
  const a = xe.get(e);
1631
1631
  if (!a) {
1632
- g.getState().setReactions(e, t);
1632
+ h.getState().setReactions(e, t);
1633
1633
  return;
1634
1634
  }
1635
- a.confirmed = t, Rt(e, a);
1635
+ a.confirmed = t, Pt(e, a);
1636
1636
  }
1637
- function fn(e) {
1637
+ function sn(e) {
1638
1638
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = new URL(e, t).pathname;
1639
1639
  return `${a.endsWith("/") ? a : `${a}/`}socket.io/`;
1640
1640
  }
1641
- function qr(e) {
1641
+ function Ur(e) {
1642
1642
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = e.namespace ?? "/chat";
1643
1643
  return {
1644
1644
  url: `${new URL(e.origin, t).origin}${a.startsWith("/") ? a : `/${a}`}`,
1645
- path: e.path ?? fn(e.origin)
1645
+ path: e.path ?? sn(e.origin)
1646
1646
  };
1647
1647
  }
1648
1648
  let Q = null, Y = null, ze = null;
1649
- function ta(e) {
1650
- e && Q && e.origin === Q.origin && e.path === Q.path && e.namespace === Q.namespace || !e && !Q || (ln(), Q = e);
1649
+ function aa(e) {
1650
+ e && Q && e.origin === Q.origin && e.path === Q.path && e.namespace === Q.namespace || !e && !Q || (cn(), Q = e);
1651
1651
  }
1652
1652
  function Ie() {
1653
1653
  return Q !== null;
1654
1654
  }
1655
- function Hr(e) {
1655
+ function $r(e) {
1656
1656
  if (Q)
1657
1657
  if (ze = e, Y)
1658
- Y.connected && Y.emit(k.JOIN, e);
1658
+ Y.connected && Y.emit(S.JOIN, e);
1659
1659
  else {
1660
- const { url: t, path: a } = qr(Q), n = ht(t, { path: a, transports: ["websocket", "polling"] });
1661
- Y = n, b("chat", "External chat socket", { url: t, path: a }), dn(n), n.on(k.ERROR, (o) => {
1660
+ const { url: t, path: a } = Ur(Q), n = ht(t, { path: a, transports: ["websocket", "polling"] });
1661
+ Y = n, b("chat", "External chat socket", { url: t, path: a }), un(n), n.on(S.ERROR, (o) => {
1662
1662
  const r = o?.message || o?.code || "chat error";
1663
- D("chat", `Chat server error: ${r}`, { code: o?.code }), g.getState().pushToast("error", r);
1663
+ D("chat", `Chat server error: ${r}`, { code: o?.code }), h.getState().pushToast("error", r);
1664
1664
  }), n.on("connect", () => {
1665
- ze && n.emit(k.JOIN, ze);
1665
+ ze && n.emit(S.JOIN, ze);
1666
1666
  }), n.on("connect_error", (o) => D("chat", "Chat connection error", { message: o?.message }));
1667
1667
  }
1668
1668
  }
1669
- function Ur(e) {
1670
- Y?.emit(k.CHAT_SEND, e);
1669
+ function Fr(e) {
1670
+ Y?.emit(S.CHAT_SEND, e);
1671
1671
  }
1672
- function sn(e, t) {
1672
+ function ln(e, t) {
1673
1673
  Y?.connected && Y.emit(e, t);
1674
1674
  }
1675
- function ln() {
1675
+ function cn() {
1676
1676
  ze = null, Y && (Y.disconnect(), Y = null);
1677
1677
  }
1678
- function aa(e, t) {
1678
+ function na(e, t) {
1679
1679
  return {
1680
1680
  id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
1681
1681
  clientId: e.client_id,
@@ -1687,15 +1687,15 @@ function aa(e, t) {
1687
1687
  // Attachments arrive from other clients, so the key shape is re-checked
1688
1688
  // here at the boundary rather than trusted at render time. A malformed
1689
1689
  // entry is dropped, not rendered and not allowed near an <img src>.
1690
- images: Array.isArray(e.images) ? e.images.filter((a) => !!a && vt(a.key)).slice(0, ae) : void 0,
1690
+ images: Array.isArray(e.images) ? e.images.filter((a) => !!a && kt(a.key)).slice(0, ae) : void 0,
1691
1691
  isSystem: e.isSystem || !1,
1692
1692
  systemType: e.systemType,
1693
- template: e.isSystem && typeof e.template == "string" && e.template.includes(xt) ? e.template : void 0,
1694
- replyTo: typeof e.reply_to == "string" && Aa.test(e.reply_to) ? e.reply_to : void 0,
1695
- reactions: cn(e.reactions)
1693
+ template: e.isSystem && typeof e.template == "string" && e.template.includes(St) ? e.template : void 0,
1694
+ replyTo: typeof e.reply_to == "string" && Na.test(e.reply_to) ? e.reply_to : void 0,
1695
+ reactions: dn(e.reactions)
1696
1696
  };
1697
1697
  }
1698
- function cn(e) {
1698
+ function dn(e) {
1699
1699
  if (!Array.isArray(e)) return;
1700
1700
  const t = e.filter((a) => {
1701
1701
  const n = a;
@@ -1703,49 +1703,49 @@ function cn(e) {
1703
1703
  });
1704
1704
  return t.length ? t : void 0;
1705
1705
  }
1706
- function dn(e, t = () => !0) {
1707
- e.on(k.CHAT_BROADCAST, (a) => {
1706
+ function un(e, t = () => !0) {
1707
+ e.on(S.CHAT_BROADCAST, (a) => {
1708
1708
  if (!t()) return;
1709
- const n = { ...aa(a, a.server_seq), live: !0 };
1710
- g.getState().appendChat(n), b("chat", "Message received", n);
1711
- }), e.on(k.CHAT_HISTORY, (a) => {
1709
+ const n = { ...na(a, a.server_seq), live: !0 };
1710
+ h.getState().appendChat(n), b("chat", "Message received", n);
1711
+ }), e.on(S.CHAT_HISTORY, (a) => {
1712
1712
  if (!t() || !a?.messages || !Array.isArray(a.messages)) return;
1713
- const n = a.messages.map((o) => aa(o));
1714
- g.getState().setChat(n), b("chat", "History loaded", { count: n.length });
1715
- }), e.on(k.CHAT_REACTION, (a) => {
1716
- t() && (!a || typeof a.id != "string" || Or(a.id, cn(a.reactions) ?? []));
1717
- }), e.on(k.CHAT_TYPING, (a) => {
1718
- t() && (!a || typeof a.client_id != "string" || typeof a.typing != "boolean" || g.getState().setTyping(a.client_id, a.typing));
1713
+ const n = a.messages.map((o) => na(o));
1714
+ h.getState().setChat(n), b("chat", "History loaded", { count: n.length });
1715
+ }), e.on(S.CHAT_REACTION, (a) => {
1716
+ t() && (!a || typeof a.id != "string" || Hr(a.id, dn(a.reactions) ?? []));
1717
+ }), e.on(S.CHAT_TYPING, (a) => {
1718
+ t() && (!a || typeof a.client_id != "string" || typeof a.typing != "boolean" || h.getState().setTyping(a.client_id, a.typing));
1719
1719
  });
1720
1720
  }
1721
- let un = null;
1722
- function $r(e) {
1723
- un = e;
1721
+ let mn = null;
1722
+ function zr(e) {
1723
+ mn = e;
1724
1724
  }
1725
- function Fr(e = un) {
1725
+ function Wr(e = mn) {
1726
1726
  if (!e) return null;
1727
1727
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = e.namespace ?? "/room";
1728
1728
  return {
1729
1729
  url: `${new URL(e.origin, t).origin}${a.startsWith("/") ? a : `/${a}`}`,
1730
- path: e.path ?? fn(e.origin)
1730
+ path: e.path ?? sn(e.origin)
1731
1731
  };
1732
1732
  }
1733
- function zr(e) {
1734
- return `${Ua()}/media/${e}`.replace(/\\/g, "/");
1733
+ function Br(e) {
1734
+ return `${$a()}/media/${e}`.replace(/\\/g, "/");
1735
1735
  }
1736
- function Wr(e, t) {
1737
- return zr(t ?? `${e}/poster.jpg`);
1736
+ function Gr(e, t) {
1737
+ return Br(t ?? `${e}/poster.jpg`);
1738
1738
  }
1739
- function Br(e) {
1740
- return `${Ua()}${e}`.replace(/\\/g, "/");
1739
+ function Kr(e) {
1740
+ return `${$a()}${e}`.replace(/\\/g, "/");
1741
1741
  }
1742
- async function Gr(e) {
1742
+ async function Vr(e) {
1743
1743
  try {
1744
- const t = await fetch(Br("/api/tierlist"));
1744
+ const t = await fetch(Kr("/api/tierlist"));
1745
1745
  if (!t.ok)
1746
1746
  return D("tierlist", "Board fetch failed", { status: t.status }), null;
1747
1747
  const a = await t.json();
1748
- return g.getState().setTierlistSnapshot(a, e), b("tierlist", "Board loaded", {
1748
+ return h.getState().setTierlistSnapshot(a, e), b("tierlist", "Board loaded", {
1749
1749
  items: a.items.length,
1750
1750
  voters: a.voterCount,
1751
1751
  placed: a.placed.length
@@ -1754,50 +1754,50 @@ async function Gr(e) {
1754
1754
  return D("tierlist", "Board fetch threw", Ce(t)), null;
1755
1755
  }
1756
1756
  }
1757
- let na = !1;
1758
- function Kr() {
1759
- if (na || typeof Image > "u") return;
1760
- const e = g.getState().tierlist;
1757
+ let oa = !1;
1758
+ function Yr() {
1759
+ if (oa || typeof Image > "u") return;
1760
+ const e = h.getState().tierlist;
1761
1761
  if (!(!e || e.items.length === 0)) {
1762
- na = !0;
1762
+ oa = !0;
1763
1763
  for (const t of e.items) {
1764
1764
  const a = new Image();
1765
- a.decoding = "async", a.src = Wr(t.id, t.thumbnail);
1765
+ a.decoding = "async", a.src = Gr(t.id, t.thumbnail);
1766
1766
  }
1767
1767
  b("tierlist", "Warming posters", { count: e.items.length });
1768
1768
  }
1769
1769
  }
1770
- function Vr() {
1771
- const e = g.getState(), t = va(Object.values(e.roster).map((o) => o.sprite), void 0, Ze);
1770
+ function Jr() {
1771
+ const e = h.getState(), t = ka(Object.values(e.roster).map((o) => o.sprite), void 0, Ze);
1772
1772
  if (!t)
1773
1773
  return D("socket", "sprite_taken: no available sprites to retry with"), null;
1774
1774
  const a = !!e.name && !le(e.name), n = a ? e.name : ke(t);
1775
1775
  return b("socket", "sprite_taken: retrying with a free character", { from: e.sprite, to: t, name: n, keptCustomName: a }), e.setSessionIdentity(n, t), { name: n, sprite: t };
1776
1776
  }
1777
- function Yr(e) {
1778
- const t = g.getState(), a = e ? t.roster[e] : void 0;
1777
+ function Xr(e) {
1778
+ const t = h.getState(), a = e ? t.roster[e] : void 0;
1779
1779
  return !a || !!a.sprite && a.sprite === t.sprite;
1780
1780
  }
1781
- const Jr = "hadoku:name";
1782
- function Xr(e) {
1783
- const t = Xn(e);
1781
+ const Qr = "hadoku:name";
1782
+ function Zr(e) {
1783
+ const t = Zn(e);
1784
1784
  return et(t) ? t : null;
1785
1785
  }
1786
- async function Qr(e = {}) {
1787
- const t = await Jn({
1786
+ async function ei(e = {}) {
1787
+ const t = await Qn({
1788
1788
  ...e,
1789
1789
  onError: (n) => D("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ce(n))
1790
1790
  }), a = et(t) ? t : null;
1791
1791
  return b("avatar", "Requested character from prefs-api", { sprite: a }), a;
1792
1792
  }
1793
- function oa(e) {
1793
+ function ra(e) {
1794
1794
  if (!e) return !1;
1795
- const t = g.getState();
1795
+ const t = h.getState();
1796
1796
  if (t.sprite === e) return !1;
1797
1797
  const n = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !le(t.name) ? t.name : ke(e);
1798
1798
  return t.setSessionIdentity(n, e), !0;
1799
1799
  }
1800
- function Zr(e, t, a) {
1800
+ function ti(e, t, a) {
1801
1801
  if (!a) return () => {
1802
1802
  };
1803
1803
  const n = (o) => {
@@ -1806,26 +1806,26 @@ function Zr(e, t, a) {
1806
1806
  };
1807
1807
  return a.addEventListener(e, n), () => a.removeEventListener(e, n);
1808
1808
  }
1809
- const ei = () => typeof window > "u" ? void 0 : window;
1810
- function ti(e, t = ei()) {
1811
- return Zr(Jr, (a) => {
1809
+ const ai = () => typeof window > "u" ? void 0 : window;
1810
+ function ni(e, t = ai()) {
1811
+ return ti(Qr, (a) => {
1812
1812
  typeof a.name == "string" && a.name.trim() && e(a.name);
1813
1813
  }, t);
1814
1814
  }
1815
- const ai = 10;
1816
- function ni(e = typeof window < "u" ? window : void 0) {
1815
+ const oi = 10;
1816
+ function ri(e = typeof window < "u" ? window : void 0) {
1817
1817
  if (!e) return { framed: !1, depth: 0 };
1818
1818
  try {
1819
1819
  let t = 0, a = e;
1820
- for (; a !== a.parent && t < ai; )
1820
+ for (; a !== a.parent && t < oi; )
1821
1821
  t++, a = a.parent;
1822
1822
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
1823
1823
  } catch {
1824
1824
  return { framed: !1, depth: 0 };
1825
1825
  }
1826
1826
  }
1827
- const oi = "watchparty_fragment_delivery";
1828
- function ri() {
1827
+ const ii = "watchparty_fragment_delivery";
1828
+ function fi() {
1829
1829
  if (typeof window > "u") return null;
1830
1830
  try {
1831
1831
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -1833,43 +1833,43 @@ function ri() {
1833
1833
  if (e === "0" || e === "false") return !1;
1834
1834
  } catch {
1835
1835
  }
1836
- return Yo(oi);
1836
+ return Xo(ii);
1837
1837
  }
1838
- let ii = { ...Ma }, lt = null;
1839
- const ra = "watchparty_delivery_client_id";
1840
- function fi() {
1841
- const e = B(ra);
1838
+ let si = { ...Da }, lt = null;
1839
+ const ia = "watchparty_delivery_client_id";
1840
+ function li() {
1841
+ const e = B(ia);
1842
1842
  if (e) return e;
1843
1843
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
1844
- return ot(ra, t) ? t : "";
1844
+ return ot(ia, t) ? t : "";
1845
1845
  }
1846
- function si() {
1847
- return lt === null && (lt = Co(ii, fi(), ri())), lt;
1846
+ function ci() {
1847
+ return lt === null && (lt = Eo(si, li(), fi())), lt;
1848
1848
  }
1849
- function li() {
1850
- return si();
1849
+ function di() {
1850
+ return ci();
1851
1851
  }
1852
1852
  let We;
1853
- function mn() {
1854
- return B(Yn) || void 0;
1853
+ function gn() {
1854
+ return B(Xn) || void 0;
1855
1855
  }
1856
- function ci() {
1856
+ function ui() {
1857
1857
  if (We) return;
1858
- const e = mn();
1858
+ const e = gn();
1859
1859
  if (e) {
1860
1860
  We = e;
1861
1861
  return;
1862
1862
  }
1863
- Vn().then((t) => {
1863
+ Jn().then((t) => {
1864
1864
  t && (We = t);
1865
1865
  }).catch(() => {
1866
1866
  b("identity", "device id unavailable — joining without one");
1867
1867
  });
1868
1868
  }
1869
- function di() {
1870
- return We ??= mn();
1869
+ function mi() {
1870
+ return We ??= gn();
1871
1871
  }
1872
- function ui(e, t) {
1872
+ function gi(e, t) {
1873
1873
  let a = 0;
1874
1874
  for (const n of e.videos) {
1875
1875
  const o = oe.voteKey(t, e.id, n.mediaId);
@@ -1877,49 +1877,49 @@ function ui(e, t) {
1877
1877
  }
1878
1878
  return a;
1879
1879
  }
1880
- const mi = 2e4, gi = 1e4;
1881
- function hi() {
1880
+ const hi = 2e4, pi = 1e4;
1881
+ function bi() {
1882
1882
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
1883
1883
  }
1884
- function pi(e, t) {
1884
+ function yi(e, t) {
1885
1885
  e.lastPongAt = t, e.unansweredSince = null;
1886
1886
  }
1887
- function bi(e, t, a) {
1888
- const n = e.lastTickAt !== null && t - e.lastTickAt > gi;
1889
- return e.lastTickAt = t, a ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > mi : (e.unansweredSince = null, !1);
1887
+ function _i(e, t, a) {
1888
+ const n = e.lastTickAt !== null && t - e.lastTickAt > pi;
1889
+ return e.lastTickAt = t, a ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > hi : (e.unansweredSince = null, !1);
1890
1890
  }
1891
- function yi(e, t) {
1891
+ function wi(e, t) {
1892
1892
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
1893
1893
  }
1894
1894
  let C = null, G = null, Be = null, K = null, ee = null;
1895
- const _i = ki(), de = hi();
1896
- let Le = null, ct = null, ia = 0, Pt = null, Se = !1, Mt = !1, he = !1, gn = null;
1897
- function wi(e) {
1898
- const t = re(), a = g.getState();
1895
+ const vi = Si(), de = bi();
1896
+ let Le = null, ct = null, fa = 0, Mt = null, Se = !1, Dt = !1, he = !1, hn = null;
1897
+ function ki(e) {
1898
+ const t = re(), a = h.getState();
1899
1899
  if (a.me.clientId && a.roster[a.me.clientId])
1900
- return (e.name || e.sprite) && (b("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(k.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1901
- const n = vi(e);
1902
- return ee = n, Pt = { name: n.name, sprite: n.sprite }, Ie() && Hr(n), t.connected ? (b("socket", "Emitting join", n), t.emit(k.JOIN, n)) : t.once("connect", () => {
1903
- b("socket", "Emitting join", n), t.emit(k.JOIN, n);
1900
+ return (e.name || e.sprite) && (b("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(S.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1901
+ const n = xi(e);
1902
+ return ee = n, Mt = { name: n.name, sprite: n.sprite }, Ie() && $r(n), t.connected ? (b("socket", "Emitting join", n), t.emit(S.JOIN, n)) : t.once("connect", () => {
1903
+ b("socket", "Emitting join", n), t.emit(S.JOIN, n);
1904
1904
  }), t;
1905
1905
  }
1906
- function vi(e) {
1906
+ function xi(e) {
1907
1907
  return {
1908
1908
  room_key: e.room_key,
1909
1909
  name: e.name,
1910
1910
  sprite: e.sprite,
1911
1911
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
1912
1912
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
1913
- embed: ni(),
1914
- delivery_arm: li(),
1913
+ embed: ri(),
1914
+ delivery_arm: di(),
1915
1915
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
1916
1916
  // (lastJoinPayload carries it) so a reconnect lands on the same
1917
1917
  // ParticipantId rather than minting a new person.
1918
- device_id: di(),
1919
- tab_id: _i
1918
+ device_id: mi(),
1919
+ tab_id: vi
1920
1920
  };
1921
1921
  }
1922
- function ki() {
1922
+ function Si() {
1923
1923
  const e = globalThis.crypto;
1924
1924
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
1925
1925
  const t = new Uint8Array(16);
@@ -1932,78 +1932,78 @@ function re() {
1932
1932
  let t = Te().serverOrigin || "/";
1933
1933
  if (t === "/" && typeof window < "u") {
1934
1934
  const n = window.location;
1935
- (n.hostname === "localhost" || n.hostname === "127.0.0.1") && n.port === String(Ta) && (t = `${n.protocol}//${n.hostname}:${kt}`, b("socket", "Using dev fallback origin", { origin: t }));
1935
+ (n.hostname === "localhost" || n.hostname === "127.0.0.1") && n.port === String(Ca) && (t = `${n.protocol}//${n.hostname}:${xt}`, b("socket", "Using dev fallback origin", { origin: t }));
1936
1936
  }
1937
- const a = Fr();
1937
+ const a = Wr();
1938
1938
  if (a)
1939
1939
  C = ht(a.url, { path: a.path, transports: ["websocket", "polling"] }), b("socket", "Socket initialized on the room origin", a);
1940
1940
  else {
1941
1941
  const n = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
1942
- C = ht(n, { path: to, transports: ["websocket", "polling"] }), b("socket", "Socket initialized", { origin: t });
1942
+ C = ht(n, { path: no, transports: ["websocket", "polling"] }), b("socket", "Socket initialized", { origin: t });
1943
1943
  }
1944
1944
  rt("__SOCKET__", C), K && (clearTimeout(K), K = null), G = null, Be = setInterval(() => {
1945
- if (bi(de, Date.now(), !!C?.connected)) {
1945
+ if (_i(de, Date.now(), !!C?.connected)) {
1946
1946
  D("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
1947
1947
  sid: C?.id,
1948
- lastPongAgeMs: yi(de, Date.now()) ?? null
1948
+ lastPongAgeMs: wi(de, Date.now()) ?? null
1949
1949
  }), ct = "pong-watchdog", de.unansweredSince = null, C?.io.engine?.close();
1950
1950
  return;
1951
1951
  }
1952
- Di();
1953
- }, vo), C.on("connect", () => {
1954
- Mt = !1;
1952
+ Oi();
1953
+ }, xo), C.on("connect", () => {
1954
+ Dt = !1;
1955
1955
  const n = C?.id;
1956
1956
  if (b("socket", "Connected", { id: n, isReconnect: he }), n)
1957
1957
  try {
1958
- g.getState().ensureMe(n), g.setState((o) => ({ me: { ...o.me, nextClientSeq: 1 } })), b("socket", "Reset client sequence for new connection");
1958
+ h.getState().ensureMe(n), h.setState((o) => ({ me: { ...o.me, nextClientSeq: 1 } })), b("socket", "Reset client sequence for new connection");
1959
1959
  } catch (o) {
1960
1960
  Fe("socket", "Failed to initialize store on connect", { error: o.message, sid: n });
1961
1961
  }
1962
1962
  if (he && ee) {
1963
- const o = g.getState();
1964
- ia += 1;
1963
+ const o = h.getState();
1964
+ fa += 1;
1965
1965
  const r = {
1966
1966
  ...ee,
1967
1967
  name: o.name,
1968
1968
  sprite: o.sprite,
1969
1969
  reconnect: {
1970
- count: ia,
1970
+ count: fa,
1971
1971
  reason: (Le?.reason ?? "unknown").slice(0, 64),
1972
1972
  offline_ms: Le ? Math.max(0, Date.now() - Le.at) : 0
1973
1973
  }
1974
- }, f = gn;
1974
+ }, f = hn;
1975
1975
  if (b("socket", "Re-emitting join after reconnect", { room_key: r.room_key, name: r.name, sprite: r.sprite }), f) {
1976
1976
  let s = !1;
1977
1977
  const c = () => {
1978
- s || (s = !0, C.off(k.SNAPSHOT, c), C.emit(k.CLIENT_READY, { media_id: f }), b("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: f }));
1978
+ s || (s = !0, C.off(S.SNAPSHOT, c), C.emit(S.CLIENT_READY, { media_id: f }), b("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: f }));
1979
1979
  };
1980
- C.on(k.SNAPSHOT, c), setTimeout(() => {
1981
- s || (s = !0, C.off(k.SNAPSHOT, c), D("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: f }));
1980
+ C.on(S.SNAPSHOT, c), setTimeout(() => {
1981
+ s || (s = !0, C.off(S.SNAPSHOT, c), D("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: f }));
1982
1982
  }, 1e4);
1983
1983
  }
1984
- Pt = { name: r.name, sprite: r.sprite }, C.emit(k.JOIN, r), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
1984
+ Mt = { name: r.name, sprite: r.sprite }, C.emit(S.JOIN, r), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
1985
1985
  } else he && D("socket", "Reconnected — no join payload, not re-joining any room");
1986
1986
  he = !0;
1987
1987
  }), C.on("disconnect", (n) => {
1988
- Ya(null), Le = { reason: ct ?? n, at: Date.now() }, ct = null, b("socket", "Disconnected", { reason: n });
1989
- }), C.on("connect_error", (n) => Fe("socket", "Connection error", { message: n?.message })), C.on("reconnect_attempt", (n) => D("socket", "Reconnect attempt", { attempt: n })), C.on("reconnect_failed", () => Fe("socket", "Reconnect failed")), ji(C);
1988
+ Ja(null), Le = { reason: ct ?? n, at: Date.now() }, ct = null, b("socket", "Disconnected", { reason: n });
1989
+ }), C.on("connect_error", (n) => Fe("socket", "Connection error", { message: n?.message })), C.on("reconnect_attempt", (n) => D("socket", "Reconnect attempt", { attempt: n })), C.on("reconnect_failed", () => Fe("socket", "Reconnect failed")), Pi(C);
1990
1990
  }
1991
1991
  return C;
1992
1992
  }
1993
1993
  function dt(e) {
1994
1994
  return e.play_state === "playing" || e.playing === !0;
1995
1995
  }
1996
- function xi(e) {
1997
- e.on(k.SNAPSHOT, (t) => {
1998
- e.emit(Pa.SYNC), g.getState().applySnapshot({
1996
+ function Ti(e) {
1997
+ e.on(S.SNAPSHOT, (t) => {
1998
+ e.emit(Ma.SYNC), h.getState().applySnapshot({
1999
1999
  roomId: t.room_id ?? null,
2000
2000
  mediaId: t.media_id ?? null,
2001
2001
  playheadMs: t.playhead_ms || 0,
2002
2002
  playing: dt(t),
2003
2003
  serverSeq: t.server_seq || 0,
2004
2004
  leaderId: t.leader_id || null
2005
- }), g.getState().name || b("socket", "Deferring identity to presence event (snapshot carries no roster)");
2006
- const a = g.getState(), n = C?.id, r = (n ? a.roster[n] : void 0) ?? Pt, f = Gn(
2005
+ }), h.getState().name || b("socket", "Deferring identity to presence event (snapshot carries no roster)");
2006
+ const a = h.getState(), n = C?.id, r = (n ? a.roster[n] : void 0) ?? Mt, f = Vn(
2007
2007
  { name: a.name, avatarId: a.sprite },
2008
2008
  r ? { name: r.name, avatarId: r.sprite ?? null } : void 0,
2009
2009
  // A join that carried no name counts as a default one, so a name that
@@ -2013,9 +2013,9 @@ function xi(e) {
2013
2013
  if (f) {
2014
2014
  const s = {
2015
2015
  ...f.name !== void 0 ? { name: f.name } : {},
2016
- ...f.avatarId !== void 0 && !Mt ? { sprite: f.avatarId } : {}
2016
+ ...f.avatarId !== void 0 && !Dt ? { sprite: f.avatarId } : {}
2017
2017
  };
2018
- Object.keys(s).length > 0 && (b("socket", "Identity update on snapshot", s), e.emit(k.IDENTITY_UPDATE, s));
2018
+ Object.keys(s).length > 0 && (b("socket", "Identity update on snapshot", s), e.emit(S.IDENTITY_UPDATE, s));
2019
2019
  }
2020
2020
  b("socket", "Received snapshot", {
2021
2021
  mediaId: t.media_id ?? null,
@@ -2024,9 +2024,9 @@ function xi(e) {
2024
2024
  leaderId: t.leader_id || null,
2025
2025
  serverSeq: t.server_seq || 0,
2026
2026
  rosterSize: Object.keys(a.roster).length
2027
- }), ee?.room_key && C?.id && Ya({ room_key: ee.room_key, client_id: C.id });
2028
- }), e.on(k.CONTROL_BROADCAST, (t) => {
2029
- const a = g.getState();
2027
+ }), ee?.room_key && C?.id && Ja({ room_key: ee.room_key, client_id: C.id });
2028
+ }), e.on(S.CONTROL_BROADCAST, (t) => {
2029
+ const a = h.getState();
2030
2030
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
2031
2031
  const n = t.media_id ?? null;
2032
2032
  a.snapshot.mediaId !== n && (a.applySnapshot({ mediaId: n }), n && a.setReadiness({ mediaId: n, ready: !1, readyCount: 0, total: 0 }), a.bumpLoadGeneration());
@@ -2043,25 +2043,25 @@ function xi(e) {
2043
2043
  playState: t.play_state,
2044
2044
  mediaId: t.media_id
2045
2045
  });
2046
- }), e.on(k.CONTROL_ACK, (t) => {
2046
+ }), e.on(S.CONTROL_ACK, (t) => {
2047
2047
  typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && b("socket", "Control ack received", t);
2048
- }), e.on(k.TIME_PONG, (t) => {
2049
- if (pi(de, Date.now()), G && G.ts) {
2048
+ }), e.on(S.TIME_PONG, (t) => {
2049
+ if (yi(de, Date.now()), G && G.ts) {
2050
2050
  const a = Date.now() - G.ts;
2051
- g.getState().addRttSample(a, t?.server_ts, G.ts), G = null, K && (clearTimeout(K), K = null), b("socket", "Time sync RTT", { rtt: a, offset: g.getState().drift.offsetMs });
2051
+ h.getState().addRttSample(a, t?.server_ts, G.ts), G = null, K && (clearTimeout(K), K = null), b("socket", "Time sync RTT", { rtt: a, offset: h.getState().drift.offsetMs });
2052
2052
  }
2053
- }), e.on(k.READY_STATE, (t) => {
2053
+ }), e.on(S.READY_STATE, (t) => {
2054
2054
  if (!t) return;
2055
2055
  const a = t.media_id ?? null, n = typeof t.ready_count == "number" ? t.ready_count : 0, o = typeof t.total == "number" ? t.total : 0, r = t.ready === !0;
2056
- g.getState().setReadiness({ mediaId: a, ready: r, readyCount: n, total: o }), b("socket", "Ready state received", { mediaId: a, readyCount: n, total: o, ready: r });
2056
+ h.getState().setReadiness({ mediaId: a, ready: r, readyCount: n, total: o }), b("socket", "Ready state received", { mediaId: a, readyCount: n, total: o, ready: r });
2057
2057
  });
2058
2058
  }
2059
- function Si(e) {
2060
- const t = qn(e);
2059
+ function Ci(e) {
2060
+ const t = Un(e);
2061
2061
  return t ? { cosmetics: t } : {};
2062
2062
  }
2063
- function Ti(e) {
2064
- e.on(k.PRESENCE, (t) => {
2063
+ function Ii(e) {
2064
+ e.on(S.PRESENCE, (t) => {
2065
2065
  if (!t) return;
2066
2066
  if (Array.isArray(t.users)) {
2067
2067
  const n = {};
@@ -2074,93 +2074,93 @@ function Ti(e) {
2074
2074
  isLeader: s.is_leader,
2075
2075
  ...s.registry_name ? { registryName: !0 } : {},
2076
2076
  ...s.avatar_url ? { avatarUrl: s.avatar_url } : {},
2077
- ...Si(s.cosmetics)
2077
+ ...Ci(s.cosmetics)
2078
2078
  };
2079
- const o = g.getState(), r = C?.id, f = r ? n[r] : void 0;
2079
+ const o = h.getState(), r = C?.id, f = r ? n[r] : void 0;
2080
2080
  if (f?.registryName)
2081
- g.setState({ roster: n }), (f.name !== o.name || f.sprite && f.sprite !== o.sprite) && (b("socket", "Adopting registry name", { from: o.name, to: f.name }), g.getState().setSessionIdentity(f.name, f.sprite ?? o.sprite));
2081
+ h.setState({ roster: n }), (f.name !== o.name || f.sprite && f.sprite !== o.sprite) && (b("socket", "Adopting registry name", { from: o.name, to: f.name }), h.getState().setSessionIdentity(f.name, f.sprite ?? o.sprite));
2082
2082
  else if (r && n[r]) {
2083
2083
  const s = n[r].name, c = n[r].sprite;
2084
- if (o.name && !le(o.name) && (n[r].name = o.name), g.setState({ roster: n }), c && c !== o.sprite) {
2085
- const h = o.name && !le(o.name), m = h ? o.name : ke(c);
2086
- b("socket", "Server reassigned sprite", { from: o.sprite, to: c, newName: m, preservingCustomName: h }), g.getState().setSessionIdentity(m, c), m !== s && e.emit(k.IDENTITY_UPDATE, { name: m });
2084
+ if (o.name && !le(o.name) && (n[r].name = o.name), h.setState({ roster: n }), c && c !== o.sprite) {
2085
+ const g = o.name && !le(o.name), m = g ? o.name : ke(c);
2086
+ b("socket", "Server reassigned sprite", { from: o.sprite, to: c, newName: m, preservingCustomName: g }), h.getState().setSessionIdentity(m, c), m !== s && e.emit(S.IDENTITY_UPDATE, { name: m });
2087
2087
  }
2088
2088
  }
2089
2089
  }
2090
2090
  b("socket", "Received presence update", t);
2091
- const a = g.getState();
2091
+ const a = h.getState();
2092
2092
  if (!a.name) {
2093
2093
  a.ensureAutoIdentity?.();
2094
- const n = g.getState();
2095
- n.name && (b("socket", "Auto-assigned identity on presence", { name: n.name, sprite: n.sprite }), e.emit(k.IDENTITY_UPDATE, { name: n.name, sprite: n.sprite || void 0 }));
2094
+ const n = h.getState();
2095
+ n.name && (b("socket", "Auto-assigned identity on presence", { name: n.name, sprite: n.sprite }), e.emit(S.IDENTITY_UPDATE, { name: n.name, sprite: n.sprite || void 0 }));
2096
2096
  }
2097
2097
  });
2098
2098
  }
2099
- function Ci(e) {
2099
+ function Ei(e) {
2100
2100
  e.on(Re.STATE, (t) => {
2101
- g.getState().applyPlaylistState({
2101
+ h.getState().applyPlaylistState({
2102
2102
  playlist: t?.playlist ?? null,
2103
2103
  activeIndex: t?.activeIndex ?? null,
2104
2104
  myVotes: t?.myVotes ?? {}
2105
2105
  }), b("playlist", "Playlist state received", { playlistId: t?.playlist?.id ?? null, activeIndex: t?.activeIndex, myVoteCount: Object.keys(t?.myVotes || {}).length });
2106
2106
  }), e.on(Re.VOTE_PROGRESS, (t) => {
2107
- g.getState().setVoteProgress(t?.progress ?? []), b("playlist", "Vote progress", { progressCount: t?.progress?.length });
2107
+ h.getState().setVoteProgress(t?.progress ?? []), b("playlist", "Vote progress", { progressCount: t?.progress?.length });
2108
2108
  }), e.on(Re.RESULTS, (t) => {
2109
- g.getState().setPlaylistResults(t ?? null), b("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2109
+ h.getState().setPlaylistResults(t ?? null), b("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2110
2110
  }), e.on(Re.VOTES_CLEARED, (t) => {
2111
2111
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
2112
- const a = ui(
2112
+ const a = gi(
2113
2113
  { id: t.playlistId, videos: t.mediaIds.map((o) => ({ mediaId: o })) },
2114
- yr()
2115
- ), n = g.getState();
2114
+ wr()
2115
+ ), n = h.getState();
2116
2116
  n.playlist?.id === t.playlistId && n.applyPlaylistState({ playlist: n.playlist, activeIndex: n.activePlaylistIndex, myVotes: {} }), b("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: a });
2117
2117
  });
2118
2118
  }
2119
- function Ii(e) {
2120
- e.on(ho.UPDATED, () => {
2121
- b("tierlist", "Someone saved — refreshing the board"), Gr(!1);
2119
+ function Ai(e) {
2120
+ e.on(bo.UPDATED, () => {
2121
+ b("tierlist", "Someone saved — refreshing the board"), Vr(!1);
2122
2122
  });
2123
2123
  }
2124
- function Ei(e) {
2125
- e.on(po.STATE, (t) => {
2124
+ function Ni(e) {
2125
+ e.on(yo.STATE, (t) => {
2126
2126
  if (!t || typeof t.active != "boolean") return;
2127
2127
  const a = Array.isArray(t.ready) ? t.ready.filter((n) => typeof n == "string") : [];
2128
- g.getState().setReadyCheckState({ active: t.active, ready: a }), b("ready-check", "State received", { active: t.active, readyCount: a.length });
2128
+ h.getState().setReadyCheckState({ active: t.active, ready: a }), b("ready-check", "State received", { active: t.active, readyCount: a.length });
2129
2129
  });
2130
2130
  }
2131
- function Ai(e) {
2132
- e.on(Pa.ACTIVE, (t) => {
2131
+ function ji(e) {
2132
+ e.on(Ma.ACTIVE, (t) => {
2133
2133
  const a = typeof t?.gameId == "string" ? t.gameId : null;
2134
- g.getState().setActiveGameId(a), b("game", "game_active", { gameId: a });
2134
+ h.getState().setActiveGameId(a), b("game", "game_active", { gameId: a });
2135
2135
  });
2136
2136
  }
2137
- function Ni(e) {
2138
- e.on(k.HEALTH_SNAPSHOT, (t) => {
2139
- g.getState().setHealthSnapshot(t);
2140
- }), e.on(k.BUFFER_STATUS, (t) => {
2141
- g.getState().setBufferStatus(t);
2137
+ function Ri(e) {
2138
+ e.on(S.HEALTH_SNAPSHOT, (t) => {
2139
+ h.getState().setHealthSnapshot(t);
2140
+ }), e.on(S.BUFFER_STATUS, (t) => {
2141
+ h.getState().setBufferStatus(t);
2142
2142
  });
2143
2143
  }
2144
- function ji(e) {
2145
- xi(e), Ti(e), dn(e, () => !Ie()), Ni(e), Ci(e), Ii(e), Ei(e), Ai(e), e.on(k.ERROR, (t) => {
2144
+ function Pi(e) {
2145
+ Ti(e), Ii(e), un(e, () => !Ie()), Ri(e), Ei(e), Ai(e), Ni(e), ji(e), e.on(S.ERROR, (t) => {
2146
2146
  const a = t?.code || "error/unknown";
2147
2147
  if (a === "conflict" && t?.message === "sprite_held_by_you") {
2148
- Mt = !0, b("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2148
+ Dt = !0, b("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2149
2149
  return;
2150
2150
  }
2151
2151
  if (a === "conflict" && t?.message === "sprite_taken") {
2152
- if (Yr(C?.id)) {
2152
+ if (Xr(C?.id)) {
2153
2153
  b("socket", "sprite_taken: stale, the server already has our sprite");
2154
2154
  return;
2155
2155
  }
2156
2156
  Se = !0;
2157
2157
  let f;
2158
2158
  try {
2159
- f = Vr();
2159
+ f = Jr();
2160
2160
  } finally {
2161
2161
  Se = !1;
2162
2162
  }
2163
- f && e.emit(k.IDENTITY_UPDATE, f);
2163
+ f && e.emit(S.IDENTITY_UPDATE, f);
2164
2164
  return;
2165
2165
  }
2166
2166
  const o = {
@@ -2181,57 +2181,57 @@ function ji(e) {
2181
2181
  "recap/not_found": "No recap available for the previous episode."
2182
2182
  }[a] || a;
2183
2183
  if (a.startsWith("recap/")) {
2184
- b("socket", `recap unavailable: ${o}`, { code: a }), g.getState().pushToast("info", o);
2184
+ b("socket", `recap unavailable: ${o}`, { code: a }), h.getState().pushToast("info", o);
2185
2185
  return;
2186
2186
  }
2187
- (a.startsWith("auth/") ? D : Fe)("socket", `Server error: ${o}`, { code: a, raw: t }), g.getState().pushToast("error", o);
2187
+ (a.startsWith("auth/") ? D : Fe)("socket", `Server error: ${o}`, { code: a, raw: t }), h.getState().pushToast("error", o);
2188
2188
  });
2189
2189
  }
2190
- function Ri(e, t, a) {
2190
+ function Mi(e, t, a) {
2191
2191
  const n = {
2192
2192
  text: e,
2193
2193
  ...t?.length ? { images: t } : {},
2194
2194
  ...a ? { reply_to: a } : {}
2195
2195
  };
2196
- Ie() ? Ur(n) : re().emit(k.CHAT_SEND, n);
2196
+ Ie() ? Fr(n) : re().emit(S.CHAT_SEND, n);
2197
2197
  }
2198
- function Pi(e, t, a) {
2198
+ function Di(e, t, a) {
2199
2199
  const n = { id: e, emoji: t, on: a };
2200
- Ie() ? sn(k.CHAT_REACT, n) : re().emit(k.CHAT_REACT, n);
2200
+ Ie() ? ln(S.CHAT_REACT, n) : re().emit(S.CHAT_REACT, n);
2201
2201
  }
2202
- function Mi(e) {
2202
+ function Li(e) {
2203
2203
  const t = { typing: e };
2204
- Ie() ? sn(k.CHAT_TYPING, t) : C?.connected && C.emit(k.CHAT_TYPING, t);
2204
+ Ie() ? ln(S.CHAT_TYPING, t) : C?.connected && C.emit(S.CHAT_TYPING, t);
2205
2205
  }
2206
- function Di() {
2207
- G || (G = { ts: Date.now() }, re().emit(k.TIME_PING, {}), K = setTimeout(() => {
2206
+ function Oi() {
2207
+ G || (G = { ts: Date.now() }, re().emit(S.TIME_PING, {}), K = setTimeout(() => {
2208
2208
  G && (b("socket", "Time ping timed out after 10s, clearing inflight"), G = null), K = null;
2209
2209
  }, 1e4));
2210
2210
  }
2211
- function hn(e) {
2212
- const t = g.getState(), a = t.me.clientId;
2211
+ function pn(e) {
2212
+ const t = h.getState(), a = t.me.clientId;
2213
2213
  if (!a || !t.roster[a]) {
2214
- oa(e), b("socket", "Avatar change before join: the join will carry it", { sprite: e });
2214
+ ra(e), b("socket", "Avatar change before join: the join will carry it", { sprite: e });
2215
2215
  return;
2216
2216
  }
2217
2217
  Se = !0;
2218
2218
  try {
2219
- oa(e);
2219
+ ra(e);
2220
2220
  } finally {
2221
2221
  Se = !1;
2222
2222
  }
2223
- const n = g.getState(), o = { avatar: !0 };
2224
- n.sprite && n.sprite !== t.sprite && (o.sprite = n.sprite), n.name && n.name !== t.name && (o.name = n.name), b("socket", "Sending avatar change", o), re().emit(k.IDENTITY_UPDATE, o);
2223
+ const n = h.getState(), o = { avatar: !0 };
2224
+ n.sprite && n.sprite !== t.sprite && (o.sprite = n.sprite), n.name && n.name !== t.name && (o.name = n.name), b("socket", "Sending avatar change", o), re().emit(S.IDENTITY_UPDATE, o);
2225
2225
  }
2226
- function Li(e) {
2227
- g.getState().me.clientId && Oi(e);
2226
+ function qi(e) {
2227
+ h.getState().me.clientId && Hi(e);
2228
2228
  }
2229
- function Oi(e, t) {
2229
+ function Hi(e, t) {
2230
2230
  const a = {};
2231
- e && (a.name = e), !(!a.name && !a.sprite) && (b("socket", "Sending identity update", a), re().emit(k.IDENTITY_UPDATE, a));
2231
+ e && (a.name = e), !(!a.name && !a.sprite) && (b("socket", "Sending identity update", a), re().emit(S.IDENTITY_UPDATE, a));
2232
2232
  }
2233
2233
  let Oe = { name: "", sprite: "" };
2234
- g.subscribe((e, t) => {
2234
+ h.subscribe((e, t) => {
2235
2235
  if (e.name === t.name && e.sprite === t.sprite || Se) return;
2236
2236
  const a = e.me.clientId;
2237
2237
  if (!a) return;
@@ -2240,16 +2240,16 @@ g.subscribe((e, t) => {
2240
2240
  const o = !!e.name && !le(e.name) && e.name !== Oe.name && (le(n.name || "") || n.name !== e.name), r = !!e.sprite && e.sprite !== Oe.sprite && n.sprite !== e.sprite;
2241
2241
  if (!o && !r) return;
2242
2242
  const f = {};
2243
- o && (f.name = e.name, Oe.name = e.name), r && (f.sprite = e.sprite, Oe.sprite = e.sprite), b("socket", "Identity reassert (store change)", f), C?.connected ? C.emit(k.IDENTITY_UPDATE, f) : re().emit(k.IDENTITY_UPDATE, f);
2243
+ o && (f.name = e.name, Oe.name = e.name), r && (f.sprite = e.sprite, Oe.sprite = e.sprite), b("socket", "Identity reassert (store change)", f), C?.connected ? C.emit(S.IDENTITY_UPDATE, f) : re().emit(S.IDENTITY_UPDATE, f);
2244
2244
  });
2245
- function qi() {
2245
+ function Ui() {
2246
2246
  Be && (clearInterval(Be), Be = null), K && (clearTimeout(K), K = null), G = null, de.unansweredSince = null, de.lastTickAt = null;
2247
2247
  }
2248
- function Hi() {
2249
- b("socket", "clearJoinState called", { hadPayload: ee !== null, room_key: ee?.room_key }), ee = null, he = !1, gn = null;
2248
+ function $i() {
2249
+ b("socket", "clearJoinState called", { hadPayload: ee !== null, room_key: ee?.room_key }), ee = null, he = !1, hn = null;
2250
2250
  }
2251
- function fa() {
2252
- b("socket", "leaveRoom called", { room_key: ee?.room_key }), Hi(), qi(), ln(), C && (C.disconnect(), C = null), g.setState({
2251
+ function sa() {
2252
+ b("socket", "leaveRoom called", { room_key: ee?.room_key }), $i(), Ui(), cn(), C && (C.disconnect(), C = null), h.setState({
2253
2253
  me: { clientId: null, nextClientSeq: 1 },
2254
2254
  roster: {},
2255
2255
  snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
@@ -2267,31 +2267,31 @@ function fa() {
2267
2267
  activeGameId: null
2268
2268
  });
2269
2269
  }
2270
- function Ui() {
2270
+ function Fi() {
2271
2271
  b("chat", "Emitting recap_request"), re().emit("recap_request");
2272
2272
  }
2273
- function $i() {
2273
+ function zi() {
2274
2274
  P(() => {
2275
- const e = Zn(), t = Qn((n, o) => {
2276
- const r = Xr(o);
2277
- b("avatar", "Avatar changed in the settings popout", { sprite: r, source: o.avatar?.source }), hn(r);
2278
- }), a = ti((n) => {
2279
- b("avatar", "Renamed in the settings popout", { name: n }), Li(n);
2275
+ const e = to(), t = eo((n, o) => {
2276
+ const r = Zr(o);
2277
+ b("avatar", "Avatar changed in the settings popout", { sprite: r, source: o.avatar?.source }), pn(r);
2278
+ }), a = ni((n) => {
2279
+ b("avatar", "Renamed in the settings popout", { name: n }), qi(n);
2280
2280
  });
2281
2281
  return () => {
2282
2282
  t(), a(), e();
2283
2283
  };
2284
2284
  }, []);
2285
2285
  }
2286
- function Fi(e, t) {
2287
- return (t ? $n(t) : null) ?? Xa(e);
2286
+ function Wi(e, t) {
2287
+ return (t ? zn(t) : null) ?? Qa(e);
2288
2288
  }
2289
2289
  function Ee(e, t) {
2290
2290
  return P(() => {
2291
- t && Hn(t);
2292
- }, [t]), ba(Un, () => Fi(e, t), () => Xa(e));
2291
+ t && $n(t);
2292
+ }, [t]), ya(Fn, () => Wi(e, t), () => Qa(e));
2293
2293
  }
2294
- function zi(e, t) {
2294
+ function Bi(e, t) {
2295
2295
  if (t.clientId) {
2296
2296
  const a = e[t.clientId];
2297
2297
  if (a && (!t.author || !a.author || a.author === t.author)) return a;
@@ -2300,8 +2300,8 @@ function zi(e, t) {
2300
2300
  for (const a of Object.values(e)) if (a.author === t.author) return a;
2301
2301
  }
2302
2302
  }
2303
- function Wi(e, t, a) {
2304
- const n = zi(e, t);
2303
+ function Gi(e, t, a) {
2304
+ const n = Bi(e, t);
2305
2305
  return n ? {
2306
2306
  name: n.name || a.name,
2307
2307
  // A connection briefly without a character (a reconnect waiting for one to
@@ -2312,14 +2312,14 @@ function Wi(e, t, a) {
2312
2312
  here: !0
2313
2313
  } : { name: a.name, sprite: a.sprite, pictureUrl: a.pictureUrl, here: !1 };
2314
2314
  }
2315
- function Bi(e, t, a) {
2316
- return !t || !a.here ? e : t.split(xt).join(a.name);
2315
+ function Ki(e, t, a) {
2316
+ return !t || !a.here ? e : t.split(St).join(a.name);
2317
2317
  }
2318
2318
  function it(e, t) {
2319
- const a = g((n) => JSON.stringify(Wi(n.roster, e, t)));
2320
- return W(() => JSON.parse(a), [a]);
2319
+ const a = h((n) => JSON.stringify(Gi(n.roster, e, t)));
2320
+ return F(() => JSON.parse(a), [a]);
2321
2321
  }
2322
- function Dt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback: r }) {
2322
+ function Lt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback: r }) {
2323
2323
  const [f, s] = N(null);
2324
2324
  if (t && t !== f)
2325
2325
  return /* @__PURE__ */ l(
@@ -2334,13 +2334,13 @@ function Dt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback:
2334
2334
  onError: () => s(t)
2335
2335
  }
2336
2336
  );
2337
- const c = _r(e);
2337
+ const c = vr(e);
2338
2338
  return c ? /* @__PURE__ */ l("img", { src: c, alt: a, crossOrigin: "anonymous", className: n, style: o, draggable: !1 }) : /* @__PURE__ */ l(te, { children: r });
2339
2339
  }
2340
- function pn({ sprite: e, url: t, alt: a, worn: n }) {
2340
+ function bn({ sprite: e, url: t, alt: a, worn: n }) {
2341
2341
  return /* @__PURE__ */ _("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
2342
2342
  /* @__PURE__ */ l("span", { className: "hc-pic", children: /* @__PURE__ */ l(
2343
- Dt,
2343
+ Lt,
2344
2344
  {
2345
2345
  sprite: e,
2346
2346
  url: t,
@@ -2349,21 +2349,21 @@ function pn({ sprite: e, url: t, alt: a, worn: n }) {
2349
2349
  fallback: /* @__PURE__ */ l("span", { className: "inline-block w-8 h-8 bg-bg-alt/50 rounded-full flex-shrink-0" })
2350
2350
  }
2351
2351
  ) }),
2352
- n?.overlay && /* @__PURE__ */ l(we, { html: Fn(n), style: { display: "contents" } })
2352
+ n?.overlay && /* @__PURE__ */ l(we, { html: Wn(n), style: { display: "contents" } })
2353
2353
  ] });
2354
2354
  }
2355
- function Gi(e) {
2355
+ function Vi(e) {
2356
2356
  return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
2357
2357
  }
2358
- function Ki({ src: e, title: t, onClose: a }) {
2358
+ function Yi({ src: e, title: t, onClose: a }) {
2359
2359
  P(() => {
2360
2360
  const r = (f) => {
2361
2361
  at(f) && (f.stopPropagation(), a());
2362
2362
  };
2363
2363
  return document.addEventListener("keydown", r, !0), () => document.removeEventListener("keydown", r, !0);
2364
2364
  }, [a]);
2365
- const n = Fa(), o = typeof document > "u" ? null : document.fullscreenElement ?? n ?? document.body;
2366
- return o ? ka(
2365
+ const n = za(), o = typeof document > "u" ? null : document.fullscreenElement ?? n ?? document.body;
2366
+ return o ? xa(
2367
2367
  /* @__PURE__ */ _(
2368
2368
  "div",
2369
2369
  {
@@ -2401,11 +2401,11 @@ function Ki({ src: e, title: t, onClose: a }) {
2401
2401
  o
2402
2402
  ) : null;
2403
2403
  }
2404
- const ut = 240, Vi = 320;
2405
- function Yi({ image: e }) {
2404
+ const ut = 240, Ji = 320;
2405
+ function Xi({ image: e }) {
2406
2406
  const [t, a] = N(!1), n = Ke(e.key);
2407
2407
  if (!n) return null;
2408
- const o = e.w > 0 && e.h > 0, r = o ? Math.min(1, Vi / e.w, ut / e.h) : 1;
2408
+ const o = e.w > 0 && e.h > 0, r = o ? Math.min(1, Ji / e.w, ut / e.h) : 1;
2409
2409
  return /* @__PURE__ */ _(te, { children: [
2410
2410
  /* @__PURE__ */ l(
2411
2411
  "a",
@@ -2416,7 +2416,7 @@ function Yi({ image: e }) {
2416
2416
  className: "block max-w-full cursor-zoom-in",
2417
2417
  "data-testid": "chat-image",
2418
2418
  onClick: (f) => {
2419
- Gi(f) && (f.preventDefault(), a(!0));
2419
+ Vi(f) && (f.preventDefault(), a(!0));
2420
2420
  },
2421
2421
  children: /* @__PURE__ */ l(
2422
2422
  "img",
@@ -2434,7 +2434,7 @@ function Yi({ image: e }) {
2434
2434
  }
2435
2435
  ),
2436
2436
  t && /* @__PURE__ */ l(
2437
- Ki,
2437
+ Yi,
2438
2438
  {
2439
2439
  src: n,
2440
2440
  title: e.title,
@@ -2443,13 +2443,13 @@ function Yi({ image: e }) {
2443
2443
  )
2444
2444
  ] });
2445
2445
  }
2446
- function bn({ images: e }) {
2447
- return e?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, a) => /* @__PURE__ */ l(Yi, { image: t }, `${t.key}-${a}`)) }) : null;
2446
+ function yn({ images: e }) {
2447
+ return e?.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, a) => /* @__PURE__ */ l(Xi, { image: t }, `${t.key}-${a}`)) }) : null;
2448
2448
  }
2449
- function Ji(e, t) {
2449
+ function Qi(e, t) {
2450
2450
  return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
2451
2451
  }
2452
- const Xi = [
2452
+ const Zi = [
2453
2453
  { id: "smileys", label: "Smileys & Emotion", data: "1f600:grinning face:grinning|1f603:grinning face with big eyes:smiley|1f604:grinning face with smiling eyes:smile|1f601:beaming face with smiling eyes:grin|1f606:grinning squinting face:laughing,satisfied|1f605:grinning face with sweat:sweat_smile|1f923:rolling on the floor laughing:rofl|1f602:face with tears of joy:joy|1f642:slightly smiling face:slight_smile|1f643:upside-down face:upside_down|1fae0:melting face|1f609:winking face:wink|1f60a:smiling face with smiling eyes:blush|1f607:smiling face with halo:innocent|1f970:smiling face with hearts:smiling_face_with_3_hearts|1f60d:smiling face with heart-eyes:heart_eyes|1f929:star-struck|1f618:face blowing a kiss:kissing_heart|1f617:kissing face:kissing|263a-fe0f:smiling face:relaxed|1f61a:kissing face with closed eyes:kissing_closed_eyes|1f619:kissing face with smiling eyes:kissing_smiling_eyes|1f972:smiling face with tear|1f60b:face savoring food:yum|1f61b:face with tongue:stuck_out_tongue|1f61c:winking face with tongue:stuck_out_tongue_winking_eye|1f92a:zany face|1f61d:squinting face with tongue:stuck_out_tongue_closed_eyes|1f911:money-mouth face:money_mouth|1f917:smiling face with open hands:hugging,hugging_face|1f92d:face with hand over mouth|1fae2:face with open eyes and hand over mouth|1fae3:face with peeking eye|1f92b:shushing face|1f914:thinking face:thinking|1fae1:saluting face|1f910:zipper-mouth face:zipper_mouth|1f928:face with raised eyebrow|1f610:neutral face|1f611:expressionless face:expressionless|1f636:face without mouth:no_mouth|1fae5:dotted line face|1f636-200d-1f32b-fe0f:face in clouds|1f60f:smirking face:smirk|1f612:unamused face:unamused|1f644:face with rolling eyes:rolling_eyes|1f62c:grimacing face:grimacing|1f62e-200d-1f4a8:face exhaling|1f925:lying face:liar|1fae8:shaking face|1f60c:relieved face:relieved|1f614:pensive face:pensive|1f62a:sleepy face:sleepy|1f924:drooling face:drool|1f634:sleeping face:sleeping|1f637:face with medical mask:mask|1f912:face with thermometer:thermometer_face|1f915:face with head-bandage:head_bandage|1f922:nauseated face:sick|1f92e:face vomiting|1f927:sneezing face:sneeze|1f975:hot face|1f976:cold face|1f974:woozy face|1f635:face with crossed-out eyes:dizzy_face|1f635-200d-1f4ab:face with spiral eyes|1f92f:exploding head|1f920:cowboy hat face:cowboy,face_with_cowboy_hat|1f973:partying face|1f978:disguised face|1f60e:smiling face with sunglasses:sunglasses|1f913:nerd face:nerd|1f9d0:face with monocle|1f615:confused face:confused|1fae4:face with diagonal mouth|1f61f:worried face:worried|1f641:slightly frowning face:slight_frown|2639-fe0f:frowning face:frowning2,white_frowning_face|1f62e:face with open mouth:open_mouth|1f62f:hushed face:hushed|1f632:astonished face:astonished|1f633:flushed face:flushed|1f97a:pleading face|1f979:face holding back tears|1f626:frowning face with open mouth:frowning|1f627:anguished face:anguished|1f628:fearful face:fearful|1f630:anxious face with sweat:cold_sweat|1f625:sad but relieved face:disappointed_relieved|1f622:crying face:cry|1f62d:loudly crying face:sob|1f631:face screaming in fear:scream|1f616:confounded face:confounded|1f623:persevering face:persevere|1f61e:disappointed face:disappointed|1f613:downcast face with sweat:sweat|1f629:weary face:weary|1f62b:tired face|1f971:yawning face|1f624:face with steam from nose:triumph|1f621:enraged face:rage,pouting_face|1f620:angry face:angry|1f92c:face with symbols on mouth:face_with_symbols_over_mouth|1f608:smiling face with horns:smiling_imp|1f47f:angry face with horns:imp|1f480:skull:skeleton|2620-fe0f:skull and crossbones:skull_crossbones|1f4a9:pile of poo:poop,shit,hankey,poo|1f921:clown face:clown|1f479:ogre:japanese_ogre|1f47a:goblin:japanese_goblin|1f47b:ghost|1f47d:alien|1f47e:alien monster:space_invader|1f916:robot:robot_face|1f63a:grinning cat:smiley_cat|1f638:grinning cat with smiling eyes:smile_cat|1f639:cat with tears of joy:joy_cat|1f63b:smiling cat with heart-eyes:heart_eyes_cat|1f63c:cat with wry smile:smirk_cat|1f63d:kissing cat|1f640:weary cat:scream_cat|1f63f:crying cat:crying_cat_face|1f63e:pouting cat|1f648:see-no-evil monkey:see_no_evil|1f649:hear-no-evil monkey:hear_no_evil|1f64a:speak-no-evil monkey:speak_no_evil|1f48c:love letter|1f498:heart with arrow:cupid|1f49d:heart with ribbon:gift_heart|1f496:sparkling heart|1f497:growing heart:heartpulse|1f493:beating heart:heartbeat|1f49e:revolving hearts|1f495:two hearts|1f49f:heart decoration|2763-fe0f:heart exclamation:heavy_heart_exclamation_mark_ornament|1f494:broken heart|2764-fe0f-200d-1f525:heart on fire|2764-fe0f-200d-1fa79:mending heart|2764-fe0f:red heart:heart|1fa77:pink heart|1f9e1:orange heart|1f49b:yellow heart|1f49a:green heart|1f499:blue heart|1fa75:light blue heart|1f49c:purple heart|1f90e:brown heart|1f5a4:black heart|1fa76:grey heart|1f90d:white heart|1f48b:kiss mark:kiss|1f4af:hundred points:100|1f4a2:anger symbol:anger|1f4a5:collision:boom|1f4ab:dizzy|1f4a6:sweat droplets:sweat_drops|1f4a8:dashing away:dash|1f573-fe0f:hole|1f4ac:speech balloon|1f441-fe0f-200d-1f5e8-fe0f:eye in speech bubble|1f5e8-fe0f:left speech bubble:speech_left|1f5ef-fe0f:right anger bubble:anger_right|1f4ad:thought balloon|1f4a4:zzz" },
2454
2454
  { id: "people", label: "People & Body", data: "1f44b:waving hand:wave|1f91a:raised back of hand:back_of_hand|1f590-fe0f:hand with fingers splayed:hand_splayed,raised_hand_with_fingers_splayed|270b:raised hand|1f596:vulcan salute:vulcan,raised_hand_with_part_between_middle_and_ring_fingers|1faf1:rightwards hand|1faf2:leftwards hand|1faf3:palm down hand|1faf4:palm up hand|1faf7:leftwards pushing hand|1faf8:rightwards pushing hand|1f44c:ok hand|1f90c:pinched fingers|1f90f:pinching hand|270c-fe0f:victory hand:v|1f91e:crossed fingers:fingers_crossed,hand_with_index_and_middle_finger_crossed|1faf0:hand with index finger and thumb crossed|1f91f:love-you gesture|1f918:sign of the horns:metal|1f919:call me hand:call_me|1f448:backhand index pointing left:point_left|1f449:backhand index pointing right:point_right|1f446:backhand index pointing up:point_up_2|1f595:middle finger:reversed_hand_with_middle_finger_extended|1f447:backhand index pointing down:point_down|261d-fe0f:index pointing up:point_up|1faf5:index pointing at the viewer|1f44d:thumbs up:thumbsup,+1,thumbup|1f44e:thumbs down:thumbsdown,-1,thumbdown|270a:raised fist:fist|1f44a:oncoming fist:punch|1f91b:left-facing fist:left_fist|1f91c:right-facing fist:right_fist|1f44f:clapping hands:clap|1f64c:raising hands:raised_hands|1faf6:heart hands|1f450:open hands|1f932:palms up together|1f91d:handshake:shaking_hands|1f64f:folded hands:pray|270d-fe0f:writing hand|1f485:nail polish:nail_care|1f933:selfie|1f4aa:flexed biceps:muscle|1f9be:mechanical arm|1f9bf:mechanical leg|1f9b5:leg|1f9b6:foot|1f442:ear|1f9bb:ear with hearing aid|1f443:nose|1f9e0:brain|1fac0:anatomical heart|1fac1:lungs|1f9b7:tooth|1f9b4:bone|1f440:eyes|1f441-fe0f:eye|1f445:tongue|1f444:mouth:lips|1fae6:biting lip|1f476:baby|1f9d2:child|1f466:boy|1f467:girl|1f9d1:person:adult|1f471:person blond hair:blond_haired_person,person_with_blond_hair|1f468:man|1f9d4:person beard:bearded_person|1f9d4-200d-2642-fe0f:man beard|1f9d4-200d-2640-fe0f:woman beard|1f468-200d-1f9b0:man red hair:man_red_haired|1f468-200d-1f9b1:man curly hair:man_curly_haired|1f468-200d-1f9b3:man white hair:man_white_haired|1f468-200d-1f9b2:man bald|1f469:woman|1f469-200d-1f9b0:woman red hair:woman_red_haired|1f9d1-200d-1f9b0:person red hair|1f469-200d-1f9b1:woman curly hair:woman_curly_haired|1f9d1-200d-1f9b1:person curly hair|1f469-200d-1f9b3:woman white hair:woman_white_haired|1f9d1-200d-1f9b3:person white hair|1f469-200d-1f9b2:woman bald|1f9d1-200d-1f9b2:person bald|1f471-200d-2640-fe0f:woman blond hair|1f471-200d-2642-fe0f:man blond hair|1f9d3:older person:older_adult|1f474:old man:older_man|1f475:old woman:older_woman,grandma|1f64d:person frowning|1f64d-200d-2642-fe0f:man frowning|1f64d-200d-2640-fe0f:woman frowning|1f64e:person pouting:person_with_pouting_face|1f64e-200d-2642-fe0f:man pouting|1f64e-200d-2640-fe0f:woman pouting|1f645:person gesturing no:no_good|1f645-200d-2642-fe0f:man gesturing no|1f645-200d-2640-fe0f:woman gesturing no|1f646:person gesturing ok:ok_woman|1f646-200d-2642-fe0f:man gesturing ok|1f646-200d-2640-fe0f:woman gesturing ok|1f481:person tipping hand:information_desk_person|1f481-200d-2642-fe0f:man tipping hand|1f481-200d-2640-fe0f:woman tipping hand|1f64b:person raising hand:raising_hand|1f64b-200d-2642-fe0f:man raising hand|1f64b-200d-2640-fe0f:woman raising hand|1f9cf:deaf person|1f9cf-200d-2642-fe0f:deaf man|1f9cf-200d-2640-fe0f:deaf woman|1f647:person bowing:bow|1f647-200d-2642-fe0f:man bowing|1f647-200d-2640-fe0f:woman bowing|1f926:person facepalming:face_palm,facepalm|1f926-200d-2642-fe0f:man facepalming|1f926-200d-2640-fe0f:woman facepalming|1f937:person shrugging:shrug|1f937-200d-2642-fe0f:man shrugging|1f937-200d-2640-fe0f:woman shrugging|1f9d1-200d-2695-fe0f:health worker|1f468-200d-2695-fe0f:man health worker|1f469-200d-2695-fe0f:woman health worker|1f9d1-200d-1f393:student|1f468-200d-1f393:man student|1f469-200d-1f393:woman student|1f9d1-200d-1f3eb:teacher|1f468-200d-1f3eb:man teacher|1f469-200d-1f3eb:woman teacher|1f9d1-200d-2696-fe0f:judge|1f468-200d-2696-fe0f:man judge|1f469-200d-2696-fe0f:woman judge|1f9d1-200d-1f33e:farmer|1f468-200d-1f33e:man farmer|1f469-200d-1f33e:woman farmer|1f9d1-200d-1f373:cook|1f468-200d-1f373:man cook|1f469-200d-1f373:woman cook|1f9d1-200d-1f527:mechanic|1f468-200d-1f527:man mechanic|1f469-200d-1f527:woman mechanic|1f9d1-200d-1f3ed:factory worker|1f468-200d-1f3ed:man factory worker|1f469-200d-1f3ed:woman factory worker|1f9d1-200d-1f4bc:office worker|1f468-200d-1f4bc:man office worker|1f469-200d-1f4bc:woman office worker|1f9d1-200d-1f52c:scientist|1f468-200d-1f52c:man scientist|1f469-200d-1f52c:woman scientist|1f9d1-200d-1f4bb:technologist|1f468-200d-1f4bb:man technologist|1f469-200d-1f4bb:woman technologist|1f9d1-200d-1f3a4:singer|1f468-200d-1f3a4:man singer|1f469-200d-1f3a4:woman singer|1f9d1-200d-1f3a8:artist|1f468-200d-1f3a8:man artist|1f469-200d-1f3a8:woman artist|1f9d1-200d-2708-fe0f:pilot|1f468-200d-2708-fe0f:man pilot|1f469-200d-2708-fe0f:woman pilot|1f9d1-200d-1f680:astronaut|1f468-200d-1f680:man astronaut|1f469-200d-1f680:woman astronaut|1f9d1-200d-1f692:firefighter|1f468-200d-1f692:man firefighter|1f469-200d-1f692:woman firefighter|1f46e:police officer:cop|1f46e-200d-2642-fe0f:man police officer|1f46e-200d-2640-fe0f:woman police officer|1f575-fe0f:detective:spy,sleuth_or_spy|1f575-fe0f-200d-2642-fe0f:man detective|1f575-fe0f-200d-2640-fe0f:woman detective|1f482:guard:guardsman|1f482-200d-2642-fe0f:man guard|1f482-200d-2640-fe0f:woman guard|1f977:ninja|1f477:construction worker|1f477-200d-2642-fe0f:man construction worker|1f477-200d-2640-fe0f:woman construction worker|1fac5:person with crown|1f934:prince|1f478:princess|1f473:person wearing turban:man_with_turban|1f473-200d-2642-fe0f:man wearing turban|1f473-200d-2640-fe0f:woman wearing turban|1f472:person with skullcap:man_with_chinese_cap,man_with_gua_pi_mao|1f9d5:woman with headscarf|1f935:person in tuxedo|1f935-200d-2642-fe0f:man in tuxedo|1f935-200d-2640-fe0f:woman in tuxedo|1f470:person with veil|1f470-200d-2642-fe0f:man with veil|1f470-200d-2640-fe0f:woman with veil|1f930:pregnant woman:expecting_woman|1fac3:pregnant man|1fac4:pregnant person|1f931:breast-feeding|1f469-200d-1f37c:woman feeding baby|1f468-200d-1f37c:man feeding baby|1f9d1-200d-1f37c:person feeding baby|1f47c:baby angel:angel|1f385:santa claus:santa|1f936:mrs. claus:mother_christmas|1f9d1-200d-1f384:mx claus|1f9b8:superhero|1f9b8-200d-2642-fe0f:man superhero|1f9b8-200d-2640-fe0f:woman superhero|1f9b9:supervillain|1f9b9-200d-2642-fe0f:man supervillain|1f9b9-200d-2640-fe0f:woman supervillain|1f9d9:mage|1f9d9-200d-2642-fe0f:man mage|1f9d9-200d-2640-fe0f:woman mage|1f9da:fairy|1f9da-200d-2642-fe0f:man fairy|1f9da-200d-2640-fe0f:woman fairy|1f9db:vampire|1f9db-200d-2642-fe0f:man vampire|1f9db-200d-2640-fe0f:woman vampire|1f9dc:merperson|1f9dc-200d-2642-fe0f:merman|1f9dc-200d-2640-fe0f:mermaid|1f9dd:elf|1f9dd-200d-2642-fe0f:man elf|1f9dd-200d-2640-fe0f:woman elf|1f9de:genie|1f9de-200d-2642-fe0f:man genie|1f9de-200d-2640-fe0f:woman genie|1f9df:zombie|1f9df-200d-2642-fe0f:man zombie|1f9df-200d-2640-fe0f:woman zombie|1f9cc:troll|1f486:person getting massage:massage|1f486-200d-2642-fe0f:man getting massage|1f486-200d-2640-fe0f:woman getting massage|1f487:person getting haircut:haircut|1f487-200d-2642-fe0f:man getting haircut|1f487-200d-2640-fe0f:woman getting haircut|1f6b6:person walking:walking|1f6b6-200d-2642-fe0f:man walking|1f6b6-200d-2640-fe0f:woman walking|1f9cd:person standing|1f9cd-200d-2642-fe0f:man standing|1f9cd-200d-2640-fe0f:woman standing|1f9ce:person kneeling|1f9ce-200d-2642-fe0f:man kneeling|1f9ce-200d-2640-fe0f:woman kneeling|1f9d1-200d-1f9af:person with white cane:person_with_probing_cane|1f468-200d-1f9af:man with white cane:man_with_probing_cane|1f469-200d-1f9af:woman with white cane:woman_with_probing_cane|1f9d1-200d-1f9bc:person in motorized wheelchair|1f468-200d-1f9bc:man in motorized wheelchair|1f469-200d-1f9bc:woman in motorized wheelchair|1f9d1-200d-1f9bd:person in manual wheelchair|1f468-200d-1f9bd:man in manual wheelchair|1f469-200d-1f9bd:woman in manual wheelchair|1f3c3:person running:runner|1f3c3-200d-2642-fe0f:man running|1f3c3-200d-2640-fe0f:woman running|1f483:woman dancing:dancer|1f57a:man dancing:male_dancer|1f574-fe0f:person in suit levitating:levitate,man_in_business_suit_levitating|1f46f:people with bunny ears:people_with_bunny_ears_partying,dancers|1f46f-200d-2642-fe0f:men with bunny ears|1f46f-200d-2640-fe0f:women with bunny ears|1f9d6:person in steamy room|1f9d6-200d-2642-fe0f:man in steamy room|1f9d6-200d-2640-fe0f:woman in steamy room|1f9d7:person climbing|1f9d7-200d-2642-fe0f:man climbing|1f9d7-200d-2640-fe0f:woman climbing|1f93a:person fencing:fencer,fencing|1f3c7:horse racing|26f7-fe0f:skier|1f3c2:snowboarder|1f3cc-fe0f:person golfing:golfer|1f3cc-fe0f-200d-2642-fe0f:man golfing|1f3cc-fe0f-200d-2640-fe0f:woman golfing|1f3c4:person surfing:surfer|1f3c4-200d-2642-fe0f:man surfing|1f3c4-200d-2640-fe0f:woman surfing|1f6a3:person rowing boat:rowboat|1f6a3-200d-2642-fe0f:man rowing boat|1f6a3-200d-2640-fe0f:woman rowing boat|1f3ca:person swimming:swimmer|1f3ca-200d-2642-fe0f:man swimming|1f3ca-200d-2640-fe0f:woman swimming|26f9-fe0f:person bouncing ball:basketball_player,person_with_ball|26f9-fe0f-200d-2642-fe0f:man bouncing ball|26f9-fe0f-200d-2640-fe0f:woman bouncing ball|1f3cb-fe0f:person lifting weights:lifter,weight_lifter|1f3cb-fe0f-200d-2642-fe0f:man lifting weights|1f3cb-fe0f-200d-2640-fe0f:woman lifting weights|1f6b4:person biking:bicyclist|1f6b4-200d-2642-fe0f:man biking|1f6b4-200d-2640-fe0f:woman biking|1f6b5:person mountain biking:mountain_bicyclist|1f6b5-200d-2642-fe0f:man mountain biking|1f6b5-200d-2640-fe0f:woman mountain biking|1f938:person cartwheeling:person_doing_cartwheel,cartwheel|1f938-200d-2642-fe0f:man cartwheeling|1f938-200d-2640-fe0f:woman cartwheeling|1f93c:people wrestling:wrestlers,wrestling|1f93c-200d-2642-fe0f:men wrestling|1f93c-200d-2640-fe0f:women wrestling|1f93d:person playing water polo:water_polo|1f93d-200d-2642-fe0f:man playing water polo|1f93d-200d-2640-fe0f:woman playing water polo|1f93e:person playing handball:handball|1f93e-200d-2642-fe0f:man playing handball|1f93e-200d-2640-fe0f:woman playing handball|1f939:person juggling:juggling,juggler|1f939-200d-2642-fe0f:man juggling|1f939-200d-2640-fe0f:woman juggling|1f9d8:person in lotus position|1f9d8-200d-2642-fe0f:man in lotus position|1f9d8-200d-2640-fe0f:woman in lotus position|1f6c0:person taking bath:bath|1f6cc:person in bed:sleeping_accommodation|1f9d1-200d-1f91d-200d-1f9d1:people holding hands|1f46d:women holding hands:two_women_holding_hands|1f46b:woman and man holding hands:couple|1f46c:men holding hands:two_men_holding_hands|1f48f:kiss:couplekiss|1f469-200d-2764-fe0f-200d-1f48b-200d-1f468:kiss woman, man|1f468-200d-2764-fe0f-200d-1f48b-200d-1f468:kiss man, man|1f469-200d-2764-fe0f-200d-1f48b-200d-1f469:kiss woman, woman|1f491:couple with heart|1f469-200d-2764-fe0f-200d-1f468:couple with heart woman, man|1f468-200d-2764-fe0f-200d-1f468:couple with heart man, man|1f469-200d-2764-fe0f-200d-1f469:couple with heart woman, woman|1f468-200d-1f469-200d-1f466:family man, woman, boy|1f468-200d-1f469-200d-1f467:family man, woman, girl:family_mwg|1f468-200d-1f469-200d-1f467-200d-1f466:family man, woman, girl, boy:family_mwgb|1f468-200d-1f469-200d-1f466-200d-1f466:family man, woman, boy, boy:family_mwbb|1f468-200d-1f469-200d-1f467-200d-1f467:family man, woman, girl, girl:family_mwgg|1f468-200d-1f468-200d-1f466:family man, man, boy:family_mmb|1f468-200d-1f468-200d-1f467:family man, man, girl:family_mmg|1f468-200d-1f468-200d-1f467-200d-1f466:family man, man, girl, boy:family_mmgb|1f468-200d-1f468-200d-1f466-200d-1f466:family man, man, boy, boy:family_mmbb|1f468-200d-1f468-200d-1f467-200d-1f467:family man, man, girl, girl:family_mmgg|1f469-200d-1f469-200d-1f466:family woman, woman, boy:family_wwb|1f469-200d-1f469-200d-1f467:family woman, woman, girl:family_wwg|1f469-200d-1f469-200d-1f467-200d-1f466:family woman, woman, girl, boy:family_wwgb|1f469-200d-1f469-200d-1f466-200d-1f466:family woman, woman, boy, boy:family_wwbb|1f469-200d-1f469-200d-1f467-200d-1f467:family woman, woman, girl, girl:family_wwgg|1f468-200d-1f466:family man, boy|1f468-200d-1f466-200d-1f466:family man, boy, boy|1f468-200d-1f467:family man, girl|1f468-200d-1f467-200d-1f466:family man, girl, boy|1f468-200d-1f467-200d-1f467:family man, girl, girl|1f469-200d-1f466:family woman, boy|1f469-200d-1f466-200d-1f466:family woman, boy, boy|1f469-200d-1f467:family woman, girl|1f469-200d-1f467-200d-1f466:family woman, girl, boy|1f469-200d-1f467-200d-1f467:family woman, girl, girl|1f5e3-fe0f:speaking head:speaking_head_in_silhouette|1f464:bust in silhouette|1f465:busts in silhouette|1fac2:people hugging|1f46a:family|1f463:footprints" },
2455
2455
  { id: "nature", label: "Animals & Nature", data: "1f435:monkey face|1f412:monkey|1f98d:gorilla|1f9a7:orangutan|1f436:dog face:dog|1f415:dog:dog2|1f9ae:guide dog|1f415-200d-1f9ba:service dog|1f429:poodle|1f43a:wolf|1f98a:fox:fox_face|1f99d:raccoon|1f431:cat face:cat|1f408:cat:cat2|1f408-200d-2b1b:black cat|1f981:lion:lion_face|1f42f:tiger face:tiger|1f405:tiger:tiger2|1f406:leopard|1f434:horse face:horse|1face:moose|1facf:donkey|1f40e:horse:racehorse|1f984:unicorn:unicorn_face|1f993:zebra|1f98c:deer|1f9ac:bison|1f42e:cow face:cow|1f402:ox|1f403:water buffalo|1f404:cow:cow2|1f437:pig face:pig|1f416:pig:pig2|1f417:boar|1f43d:pig nose|1f40f:ram|1f411:ewe:sheep|1f410:goat|1f42a:camel:dromedary_camel|1f42b:two-hump camel:camel|1f999:llama|1f992:giraffe|1f418:elephant|1f9a3:mammoth|1f98f:rhinoceros:rhino|1f99b:hippopotamus|1f42d:mouse face:mouse|1f401:mouse:mouse2|1f400:rat|1f439:hamster|1f430:rabbit face:rabbit|1f407:rabbit:rabbit2|1f43f-fe0f:chipmunk|1f9ab:beaver|1f994:hedgehog|1f987:bat|1f43b:bear|1f43b-200d-2744-fe0f:polar bear|1f428:koala|1f43c:panda:panda_face|1f9a5:sloth|1f9a6:otter|1f9a8:skunk|1f998:kangaroo|1f9a1:badger|1f43e:paw prints:feet|1f983:turkey|1f414:chicken|1f413:rooster|1f423:hatching chick|1f424:baby chick|1f425:front-facing baby chick:hatched_chick|1f426:bird|1f427:penguin|1f54a-fe0f:dove:dove_of_peace|1f985:eagle|1f986:duck|1f9a2:swan|1f989:owl|1f9a4:dodo|1fab6:feather|1f9a9:flamingo|1f99a:peacock|1f99c:parrot|1fabd:wing|1f426-200d-2b1b:black bird|1fabf:goose|1f438:frog|1f40a:crocodile|1f422:turtle|1f98e:lizard|1f40d:snake|1f432:dragon face|1f409:dragon|1f995:sauropod|1f996:t-rex|1f433:spouting whale:whale|1f40b:whale:whale2|1f42c:dolphin|1f9ad:seal|1f41f:fish|1f420:tropical fish|1f421:blowfish|1f988:shark|1f419:octopus|1f41a:spiral shell:shell|1fab8:coral|1fabc:jellyfish|1f980:crab|1f99e:lobster|1f990:shrimp|1f991:squid|1f9aa:oyster|1f40c:snail|1f98b:butterfly|1f41b:bug|1f41c:ant|1f41d:honeybee:bee|1fab2:beetle|1f41e:lady beetle|1f997:cricket|1fab3:cockroach|1f577-fe0f:spider|1f578-fe0f:spider web|1f982:scorpion|1f99f:mosquito|1fab0:fly|1fab1:worm|1f9a0:microbe|1f490:bouquet|1f338:cherry blossom|1f4ae:white flower|1fab7:lotus|1f3f5-fe0f:rosette|1f339:rose|1f940:wilted flower:wilted_rose|1f33a:hibiscus|1f33b:sunflower|1f33c:blossom|1f337:tulip|1fabb:hyacinth|1f331:seedling|1fab4:potted plant|1f332:evergreen tree|1f333:deciduous tree|1f334:palm tree|1f335:cactus|1f33e:sheaf of rice:ear_of_rice|1f33f:herb|2618-fe0f:shamrock|1f340:four leaf clover|1f341:maple leaf|1f342:fallen leaf|1f343:leaf fluttering in wind:leaves|1fab9:empty nest|1faba:nest with eggs|1f344:mushroom" },
@@ -2460,16 +2460,16 @@ const Xi = [
2460
2460
  { id: "symbols", label: "Symbols", data: "1f3e7:atm sign:atm|1f6ae:litter in bin sign:put_litter_in_its_place|1f6b0:potable water|267f:wheelchair symbol:wheelchair|1f6b9:men’s room:mens,mens_room|1f6ba:women’s room:womens,womens_room|1f6bb:restroom|1f6bc:baby symbol|1f6be:water closet:wc|1f6c2:passport control|1f6c3:customs|1f6c4:baggage claim|1f6c5:left luggage|26a0-fe0f:warning|1f6b8:children crossing|26d4:no entry|1f6ab:prohibited:no_entry_sign|1f6b3:no bicycles|1f6ad:no smoking|1f6af:no littering:do_not_litter|1f6b1:non-potable water:non-potable_water|1f6b7:no pedestrians|1f4f5:no mobile phones|1f51e:no one under eighteen:underage|2622-fe0f:radioactive:radioactive_sign|2623-fe0f:biohazard:biohazard_sign|2b06-fe0f:up arrow:arrow_up|2197-fe0f:up-right arrow:arrow_upper_right|27a1-fe0f:right arrow:arrow_right|2198-fe0f:down-right arrow:arrow_lower_right|2b07-fe0f:down arrow:arrow_down|2199-fe0f:down-left arrow:arrow_lower_left|2b05-fe0f:left arrow:arrow_left|2196-fe0f:up-left arrow:arrow_upper_left|2195-fe0f:up-down arrow:arrow_up_down|2194-fe0f:left-right arrow|21a9-fe0f:right arrow curving left:leftwards_arrow_with_hook|21aa-fe0f:left arrow curving right:arrow_right_hook|2934-fe0f:right arrow curving up:arrow_heading_up|2935-fe0f:right arrow curving down:arrow_heading_down|1f503:clockwise vertical arrows:arrows_clockwise|1f504:counterclockwise arrows button:arrows_counterclockwise|1f519:back arrow:back|1f51a:end arrow:end|1f51b:on! arrow:on|1f51c:soon arrow:soon|1f51d:top arrow:top|1f6d0:place of worship:worship_symbol|269b-fe0f:atom symbol:atom|1f549-fe0f:om:om_symbol|2721-fe0f:star of david|2638-fe0f:wheel of dharma|262f-fe0f:yin yang|271d-fe0f:latin cross:cross|2626-fe0f:orthodox cross|262a-fe0f:star and crescent|262e-fe0f:peace symbol:peace|1f54e:menorah|1f52f:dotted six-pointed star:six_pointed_star|1faaf:khanda|2648:aries|2649:taurus|264a:gemini|264b:cancer|264c:leo|264d:virgo|264e:libra|264f:scorpio:scorpius|2650:sagittarius|2651:capricorn|2652:aquarius|2653:pisces|26ce:ophiuchus|1f500:shuffle tracks button:twisted_rightwards_arrows|1f501:repeat button:repeat|1f502:repeat single button:repeat_one|25b6-fe0f:play button:arrow_forward|23e9:fast-forward button:fast_forward|23ed-fe0f:next track button:track_next,next_track|23ef-fe0f:play or pause button:play_pause|25c0-fe0f:reverse button:arrow_backward|23ea:fast reverse button:rewind|23ee-fe0f:last track button:track_previous,previous_track|1f53c:upwards button:arrow_up_small|23eb:fast up button:arrow_double_up|1f53d:downwards button:arrow_down_small|23ec:fast down button:arrow_double_down|23f8-fe0f:pause button:double_vertical_bar|23f9-fe0f:stop button|23fa-fe0f:record button|23cf-fe0f:eject button:eject,eject_symbol|1f3a6:cinema|1f505:dim button:low_brightness|1f506:bright button:high_brightness|1f4f6:antenna bars:signal_strength|1f6dc:wireless|1f4f3:vibration mode|1f4f4:mobile phone off|2640-fe0f:female sign|2642-fe0f:male sign|26a7-fe0f:transgender symbol|2716-fe0f:multiply:heavy_multiplication_x|2795:plus:heavy_plus_sign|2796:minus:heavy_minus_sign|2797:divide:heavy_division_sign|1f7f0:heavy equals sign|267e-fe0f:infinity|203c-fe0f:double exclamation mark:bangbang|2049-fe0f:exclamation question mark:interrobang|2753:red question mark:question,question_mark|2754:white question mark:grey_question|2755:white exclamation mark:grey_exclamation|2757:red exclamation mark:exclamation|3030-fe0f:wavy dash|1f4b1:currency exchange|1f4b2:heavy dollar sign|2695-fe0f:medical symbol|267b-fe0f:recycling symbol:recycle|269c-fe0f:fleur-de-lis:fleur-de-lis|1f531:trident emblem:trident|1f4db:name badge|1f530:japanese symbol for beginner:beginner|2b55:hollow red circle:o|2705:check mark button:white_check_mark|2611-fe0f:check box with check:ballot_box_with_check|2714-fe0f:check mark:heavy_check_mark|274c:cross mark:x|274e:cross mark button:negative_squared_cross_mark|27b0:curly loop|27bf:double curly loop:loop|303d-fe0f:part alternation mark|2733-fe0f:eight-spoked asterisk|2734-fe0f:eight-pointed star:eight_pointed_black_star|2747-fe0f:sparkle|00a9-fe0f:copyright|00ae-fe0f:registered|2122-fe0f:trade mark:tm|0023-fe0f-20e3:keycap #|002a-fe0f-20e3:keycap *|0030-fe0f-20e3:keycap 0|0031-fe0f-20e3:keycap 1|0032-fe0f-20e3:keycap 2|0033-fe0f-20e3:keycap 3|0034-fe0f-20e3:keycap 4|0035-fe0f-20e3:keycap 5|0036-fe0f-20e3:keycap 6|0037-fe0f-20e3:keycap 7|0038-fe0f-20e3:keycap 8|0039-fe0f-20e3:keycap 9|1f51f:keycap 10:keycap_ten|1f520:input latin uppercase:capital_abcd|1f521:input latin lowercase:abcd|1f522:input numbers:1234|1f523:input symbols:symbols|1f524:input latin letters:abc|1f170-fe0f:a button (blood type):a|1f18e:ab button (blood type):ab|1f171-fe0f:b button (blood type):b|1f191:cl button:cl|1f192:cool button:cool|1f193:free button:free|2139-fe0f:information:information_source|1f194:id button:id|24c2-fe0f:circled m:m|1f195:new button:new|1f196:ng button:ng|1f17e-fe0f:o button (blood type):o2|1f197:ok button:ok|1f17f-fe0f:p button:parking|1f198:sos button:sos|1f199:up! button:up|1f19a:vs button:vs|1f201:japanese “here” button:koko|1f202-fe0f:japanese “service charge” button:sa|1f237-fe0f:japanese “monthly amount” button:u6708|1f236:japanese “not free of charge” button:u6709|1f22f:japanese “reserved” button:u6307|1f250:japanese “bargain” button:ideograph_advantage|1f239:japanese “discount” button:u5272|1f21a:japanese “free of charge” button:u7121|1f232:japanese “prohibited” button:u7981|1f251:japanese “acceptable” button:accept|1f238:japanese “application” button:u7533|1f234:japanese “passing grade” button:u5408|1f233:japanese “vacancy” button:u7a7a|3297-fe0f:japanese “congratulations” button:congratulations|3299-fe0f:japanese “secret” button:secret|1f23a:japanese “open for business” button:u55b6|1f235:japanese “no vacancy” button:u6e80|1f534:red circle|1f7e0:orange circle|1f7e1:yellow circle|1f7e2:green circle|1f535:blue circle|1f7e3:purple circle|1f7e4:brown circle|26ab:black circle|26aa:white circle|1f7e5:red square|1f7e7:orange square|1f7e8:yellow square|1f7e9:green square|1f7e6:blue square|1f7ea:purple square|1f7eb:brown square|2b1b:black large square|2b1c:white large square|25fc-fe0f:black medium square|25fb-fe0f:white medium square|25fe:black medium-small square|25fd:white medium-small square|25aa-fe0f:black small square|25ab-fe0f:white small square|1f536:large orange diamond|1f537:large blue diamond|1f538:small orange diamond|1f539:small blue diamond|1f53a:red triangle pointed up:small_red_triangle|1f53b:red triangle pointed down:small_red_triangle_down|1f4a0:diamond with a dot:diamond_shape_with_a_dot_inside|1f518:radio button|1f533:white square button|1f532:black square button" },
2461
2461
  { id: "flags", label: "Flags", data: "1f3c1:chequered flag:checkered_flag|1f6a9:triangular flag:triangular_flag_on_post|1f38c:crossed flags|1f3f4:black flag:flag_black,waving_black_flag|1f3f3-fe0f:white flag:flag_white,waving_white_flag|1f3f3-fe0f-200d-1f308:rainbow flag|1f3f3-fe0f-200d-26a7-fe0f:transgender flag|1f3f4-200d-2620-fe0f:pirate flag|1f1e6-1f1e8:flag ascension island:flag_ac|1f1e6-1f1e9:flag andorra:flag_ad|1f1e6-1f1ea:flag united arab emirates:flag_ae|1f1e6-1f1eb:flag afghanistan:flag_af|1f1e6-1f1ec:flag antigua & barbuda:flag_ag|1f1e6-1f1ee:flag anguilla:flag_ai|1f1e6-1f1f1:flag albania:flag_al|1f1e6-1f1f2:flag armenia:flag_am|1f1e6-1f1f4:flag angola:flag_ao|1f1e6-1f1f6:flag antarctica:flag_aq|1f1e6-1f1f7:flag argentina:flag_ar|1f1e6-1f1f8:flag american samoa:flag_as|1f1e6-1f1f9:flag austria:flag_at|1f1e6-1f1fa:flag australia:flag_au|1f1e6-1f1fc:flag aruba:flag_aw|1f1e6-1f1fd:flag åland islands:flag_ax|1f1e6-1f1ff:flag azerbaijan:flag_az|1f1e7-1f1e6:flag bosnia & herzegovina:flag_ba|1f1e7-1f1e7:flag barbados:flag_bb|1f1e7-1f1e9:flag bangladesh:flag_bd|1f1e7-1f1ea:flag belgium:flag_be|1f1e7-1f1eb:flag burkina faso:flag_bf|1f1e7-1f1ec:flag bulgaria:flag_bg|1f1e7-1f1ed:flag bahrain:flag_bh|1f1e7-1f1ee:flag burundi:flag_bi|1f1e7-1f1ef:flag benin:flag_bj|1f1e7-1f1f1:flag st. barthélemy:flag_bl|1f1e7-1f1f2:flag bermuda:flag_bm|1f1e7-1f1f3:flag brunei:flag_bn|1f1e7-1f1f4:flag bolivia:flag_bo|1f1e7-1f1f6:flag caribbean netherlands:flag_bq|1f1e7-1f1f7:flag brazil:flag_br|1f1e7-1f1f8:flag bahamas:flag_bs|1f1e7-1f1f9:flag bhutan:flag_bt|1f1e7-1f1fb:flag bouvet island:flag_bv|1f1e7-1f1fc:flag botswana:flag_bw|1f1e7-1f1fe:flag belarus:flag_by|1f1e7-1f1ff:flag belize:flag_bz|1f1e8-1f1e6:flag canada:flag_ca|1f1e8-1f1e8:flag cocos (keeling) islands:flag_cc|1f1e8-1f1e9:flag congo - kinshasa:flag_cd,congo|1f1e8-1f1eb:flag central african republic:flag_cf|1f1e8-1f1ec:flag congo - brazzaville:flag_cg|1f1e8-1f1ed:flag switzerland:flag_ch|1f1e8-1f1ee:flag côte d’ivoire:flag_ci|1f1e8-1f1f0:flag cook islands:flag_ck|1f1e8-1f1f1:flag chile:flag_cl,chile|1f1e8-1f1f2:flag cameroon:flag_cm|1f1e8-1f1f3:flag china:flag_cn|1f1e8-1f1f4:flag colombia:flag_co|1f1e8-1f1f5:flag clipperton island:flag_cp|1f1e8-1f1f7:flag costa rica:flag_cr|1f1e8-1f1fa:flag cuba:flag_cu|1f1e8-1f1fb:flag cape verde:flag_cv|1f1e8-1f1fc:flag curaçao:flag_cw|1f1e8-1f1fd:flag christmas island:flag_cx|1f1e8-1f1fe:flag cyprus:flag_cy|1f1e8-1f1ff:flag czechia:flag_cz|1f1e9-1f1ea:flag germany:flag_de|1f1e9-1f1ec:flag diego garcia:flag_dg|1f1e9-1f1ef:flag djibouti:flag_dj|1f1e9-1f1f0:flag denmark:flag_dk|1f1e9-1f1f2:flag dominica:flag_dm|1f1e9-1f1f4:flag dominican republic:flag_do|1f1e9-1f1ff:flag algeria:flag_dz|1f1ea-1f1e6:flag ceuta & melilla:flag_ea|1f1ea-1f1e8:flag ecuador:flag_ec|1f1ea-1f1ea:flag estonia:flag_ee|1f1ea-1f1ec:flag egypt:flag_eg|1f1ea-1f1ed:flag western sahara:flag_eh|1f1ea-1f1f7:flag eritrea:flag_er|1f1ea-1f1f8:flag spain:flag_es|1f1ea-1f1f9:flag ethiopia:flag_et|1f1ea-1f1fa:flag european union:flag_eu|1f1eb-1f1ee:flag finland:flag_fi|1f1eb-1f1ef:flag fiji:flag_fj|1f1eb-1f1f0:flag falkland islands:flag_fk|1f1eb-1f1f2:flag micronesia:flag_fm|1f1eb-1f1f4:flag faroe islands:flag_fo|1f1eb-1f1f7:flag france:flag_fr|1f1ec-1f1e6:flag gabon:flag_ga|1f1ec-1f1e7:flag united kingdom:flag_gb|1f1ec-1f1e9:flag grenada:flag_gd|1f1ec-1f1ea:flag georgia:flag_ge|1f1ec-1f1eb:flag french guiana:flag_gf|1f1ec-1f1ec:flag guernsey:flag_gg|1f1ec-1f1ed:flag ghana:flag_gh|1f1ec-1f1ee:flag gibraltar:flag_gi|1f1ec-1f1f1:flag greenland:flag_gl|1f1ec-1f1f2:flag gambia:flag_gm|1f1ec-1f1f3:flag guinea:flag_gn|1f1ec-1f1f5:flag guadeloupe:flag_gp|1f1ec-1f1f6:flag equatorial guinea:flag_gq|1f1ec-1f1f7:flag greece:flag_gr|1f1ec-1f1f8:flag south georgia & south sandwich islands:flag_gs|1f1ec-1f1f9:flag guatemala:flag_gt|1f1ec-1f1fa:flag guam:flag_gu|1f1ec-1f1fc:flag guinea-bissau:flag_gw|1f1ec-1f1fe:flag guyana:flag_gy|1f1ed-1f1f0:flag hong kong sar china:flag_hk|1f1ed-1f1f2:flag heard island & mcdonald islands:flag_hm|1f1ed-1f1f3:flag honduras:flag_hn|1f1ed-1f1f7:flag croatia:flag_hr|1f1ed-1f1f9:flag haiti:flag_ht|1f1ed-1f1fa:flag hungary:flag_hu|1f1ee-1f1e8:flag canary islands:flag_ic|1f1ee-1f1e9:flag indonesia:flag_id,indonesia|1f1ee-1f1ea:flag ireland:flag_ie|1f1ee-1f1f1:flag israel:flag_il|1f1ee-1f1f2:flag isle of man:flag_im|1f1ee-1f1f3:flag india:flag_in|1f1ee-1f1f4:flag british indian ocean territory:flag_io|1f1ee-1f1f6:flag iraq:flag_iq|1f1ee-1f1f7:flag iran:flag_ir|1f1ee-1f1f8:flag iceland:flag_is|1f1ee-1f1f9:flag italy:flag_it|1f1ef-1f1ea:flag jersey:flag_je|1f1ef-1f1f2:flag jamaica:flag_jm|1f1ef-1f1f4:flag jordan:flag_jo|1f1ef-1f1f5:flag japan:flag_jp|1f1f0-1f1ea:flag kenya:flag_ke|1f1f0-1f1ec:flag kyrgyzstan:flag_kg|1f1f0-1f1ed:flag cambodia:flag_kh|1f1f0-1f1ee:flag kiribati:flag_ki|1f1f0-1f1f2:flag comoros:flag_km|1f1f0-1f1f3:flag st. kitts & nevis:flag_kn|1f1f0-1f1f5:flag north korea:flag_kp|1f1f0-1f1f7:flag south korea:flag_kr|1f1f0-1f1fc:flag kuwait:flag_kw|1f1f0-1f1fe:flag cayman islands:flag_ky|1f1f0-1f1ff:flag kazakhstan:flag_kz|1f1f1-1f1e6:flag laos:flag_la|1f1f1-1f1e7:flag lebanon:flag_lb|1f1f1-1f1e8:flag st. lucia:flag_lc|1f1f1-1f1ee:flag liechtenstein:flag_li|1f1f1-1f1f0:flag sri lanka:flag_lk|1f1f1-1f1f7:flag liberia:flag_lr|1f1f1-1f1f8:flag lesotho:flag_ls|1f1f1-1f1f9:flag lithuania:flag_lt|1f1f1-1f1fa:flag luxembourg:flag_lu|1f1f1-1f1fb:flag latvia:flag_lv|1f1f1-1f1fe:flag libya:flag_ly|1f1f2-1f1e6:flag morocco:flag_ma|1f1f2-1f1e8:flag monaco:flag_mc|1f1f2-1f1e9:flag moldova:flag_md|1f1f2-1f1ea:flag montenegro:flag_me|1f1f2-1f1eb:flag st. martin:flag_mf|1f1f2-1f1ec:flag madagascar:flag_mg|1f1f2-1f1ed:flag marshall islands:flag_mh|1f1f2-1f1f0:flag north macedonia:flag_mk|1f1f2-1f1f1:flag mali:flag_ml|1f1f2-1f1f2:flag myanmar (burma):flag_mm|1f1f2-1f1f3:flag mongolia:flag_mn|1f1f2-1f1f4:flag macao sar china:flag_mo|1f1f2-1f1f5:flag northern mariana islands:flag_mp|1f1f2-1f1f6:flag martinique:flag_mq|1f1f2-1f1f7:flag mauritania:flag_mr|1f1f2-1f1f8:flag montserrat:flag_ms|1f1f2-1f1f9:flag malta:flag_mt|1f1f2-1f1fa:flag mauritius:flag_mu|1f1f2-1f1fb:flag maldives:flag_mv|1f1f2-1f1fc:flag malawi:flag_mw|1f1f2-1f1fd:flag mexico:flag_mx|1f1f2-1f1fe:flag malaysia:flag_my|1f1f2-1f1ff:flag mozambique:flag_mz|1f1f3-1f1e6:flag namibia:flag_na|1f1f3-1f1e8:flag new caledonia:flag_nc|1f1f3-1f1ea:flag niger:flag_ne|1f1f3-1f1eb:flag norfolk island:flag_nf|1f1f3-1f1ec:flag nigeria:flag_ng,nigeria|1f1f3-1f1ee:flag nicaragua:flag_ni|1f1f3-1f1f1:flag netherlands:flag_nl|1f1f3-1f1f4:flag norway:flag_no|1f1f3-1f1f5:flag nepal:flag_np|1f1f3-1f1f7:flag nauru:flag_nr|1f1f3-1f1fa:flag niue:flag_nu|1f1f3-1f1ff:flag new zealand:flag_nz|1f1f4-1f1f2:flag oman:flag_om|1f1f5-1f1e6:flag panama:flag_pa|1f1f5-1f1ea:flag peru:flag_pe|1f1f5-1f1eb:flag french polynesia:flag_pf|1f1f5-1f1ec:flag papua new guinea:flag_pg|1f1f5-1f1ed:flag philippines:flag_ph|1f1f5-1f1f0:flag pakistan:flag_pk|1f1f5-1f1f1:flag poland:flag_pl|1f1f5-1f1f2:flag st. pierre & miquelon:flag_pm|1f1f5-1f1f3:flag pitcairn islands:flag_pn|1f1f5-1f1f7:flag puerto rico:flag_pr|1f1f5-1f1f8:flag palestinian territories:flag_ps|1f1f5-1f1f9:flag portugal:flag_pt|1f1f5-1f1fc:flag palau:flag_pw|1f1f5-1f1fe:flag paraguay:flag_py|1f1f6-1f1e6:flag qatar:flag_qa|1f1f7-1f1ea:flag réunion:flag_re|1f1f7-1f1f4:flag romania:flag_ro|1f1f7-1f1f8:flag serbia:flag_rs|1f1f7-1f1fa:flag russia:flag_ru|1f1f7-1f1fc:flag rwanda:flag_rw|1f1f8-1f1e6:flag saudi arabia:flag_sa,saudiarabia,saudi|1f1f8-1f1e7:flag solomon islands:flag_sb|1f1f8-1f1e8:flag seychelles:flag_sc|1f1f8-1f1e9:flag sudan:flag_sd|1f1f8-1f1ea:flag sweden:flag_se|1f1f8-1f1ec:flag singapore:flag_sg|1f1f8-1f1ed:flag st. helena, ascension & tristan da cunha:flag_sh|1f1f8-1f1ee:flag slovenia:flag_si|1f1f8-1f1ef:flag svalbard & jan mayen:flag_sj|1f1f8-1f1f0:flag slovakia:flag_sk|1f1f8-1f1f1:flag sierra leone:flag_sl|1f1f8-1f1f2:flag san marino:flag_sm|1f1f8-1f1f3:flag senegal:flag_sn|1f1f8-1f1f4:flag somalia:flag_so|1f1f8-1f1f7:flag suriname:flag_sr|1f1f8-1f1f8:flag south sudan:flag_ss|1f1f8-1f1f9:flag são tomé & príncipe:flag_st|1f1f8-1f1fb:flag el salvador:flag_sv|1f1f8-1f1fd:flag sint maarten:flag_sx|1f1f8-1f1fe:flag syria:flag_sy|1f1f8-1f1ff:flag eswatini:flag_sz|1f1f9-1f1e6:flag tristan da cunha:flag_ta|1f1f9-1f1e8:flag turks & caicos islands:flag_tc|1f1f9-1f1e9:flag chad:flag_td|1f1f9-1f1eb:flag french southern and antarctic lands:flag_tf|1f1f9-1f1ec:flag togo:flag_tg|1f1f9-1f1ed:flag thailand:flag_th|1f1f9-1f1ef:flag tajikistan:flag_tj|1f1f9-1f1f0:flag tokelau:flag_tk|1f1f9-1f1f1:flag timor-leste:flag_tl|1f1f9-1f1f2:flag turkmenistan:flag_tm,turkmenistan|1f1f9-1f1f3:flag tunisia:flag_tn|1f1f9-1f1f4:flag tonga:flag_to|1f1f9-1f1f7:flag türkiye:flag_tr|1f1f9-1f1f9:flag trinidad & tobago:flag_tt|1f1f9-1f1fb:flag tuvalu:flag_tv,tuvalu|1f1f9-1f1fc:flag taiwan:flag_tw|1f1f9-1f1ff:flag tanzania:flag_tz|1f1fa-1f1e6:flag ukraine:flag_ua|1f1fa-1f1ec:flag uganda:flag_ug|1f1fa-1f1f2:flag u.s. outlying islands:flag_um|1f1fa-1f1f3:flag united nations:united_nations|1f1fa-1f1f8:flag united states:flag_us|1f1fa-1f1fe:flag uruguay:flag_uy|1f1fa-1f1ff:flag uzbekistan:flag_uz|1f1fb-1f1e6:flag vatican city:flag_va|1f1fb-1f1e8:flag st. vincent & grenadines:flag_vc|1f1fb-1f1ea:flag venezuela:flag_ve|1f1fb-1f1ec:flag british virgin islands:flag_vg|1f1fb-1f1ee:flag u.s. virgin islands:flag_vi|1f1fb-1f1f3:flag vietnam:flag_vn|1f1fb-1f1fa:flag vanuatu:flag_vu|1f1fc-1f1eb:flag wallis & futuna:flag_wf|1f1fc-1f1f8:flag samoa:flag_ws|1f1fd-1f1f0:flag kosovo:flag_xk|1f1fe-1f1ea:flag yemen:flag_ye|1f1fe-1f1f9:flag mayotte:flag_yt|1f1ff-1f1e6:flag south africa:flag_za|1f1ff-1f1f2:flag zambia:flag_zm|1f1ff-1f1fc:flag zimbabwe:flag_zw|1f3f4-e0067-e0062-e0065-e006e-e0067-e007f:flag england:england|1f3f4-e0067-e0062-e0073-e0063-e0074-e007f:flag scotland:scotland|1f3f4-e0067-e0062-e0077-e006c-e0073-e007f:flag wales:wales" }
2462
2462
  ];
2463
- function Qi(e) {
2463
+ function ef(e) {
2464
2464
  return e.replace(/[^a-z0-9+]+/g, "_").replace(/^_|_$/g, "");
2465
2465
  }
2466
- function Zi(e) {
2467
- const [t = "", a = "", n = ""] = e.split(":"), o = Qi(a), r = n ? n.split(",") : [];
2466
+ function tf(e) {
2467
+ const [t = "", a = "", n = ""] = e.split(":"), o = ef(a), r = n ? n.split(",") : [];
2468
2468
  return o && !r.includes(o) && r.push(o), { char: String.fromCodePoint(...t.split("-").map((f) => parseInt(f, 16))), name: a, shortcodes: r };
2469
2469
  }
2470
- let sa = null;
2470
+ let la = null;
2471
2471
  function Ae() {
2472
- return sa ??= Xi.map((e) => ({ id: e.id, label: e.label, emoji: e.data.split("|").map(Zi) })), sa;
2472
+ return la ??= Zi.map((e) => ({ id: e.id, label: e.label, emoji: e.data.split("|").map(tf) })), la;
2473
2473
  }
2474
2474
  let se = null;
2475
2475
  function Qe(e) {
@@ -2483,7 +2483,7 @@ function Qe(e) {
2483
2483
  }
2484
2484
  return se.get(e) ?? se.get(e.replace(/\ufe0f/g, ""));
2485
2485
  }
2486
- const ef = [
2486
+ const af = [
2487
2487
  "joy",
2488
2488
  "heart",
2489
2489
  "thumbsup",
@@ -2520,12 +2520,12 @@ const ef = [
2520
2520
  "x",
2521
2521
  "pensive"
2522
2522
  ];
2523
- let la = null;
2524
- function tf() {
2525
- return la ??= ef.flatMap((e) => yn(e)?.char ?? []), la;
2523
+ let ca = null;
2524
+ function nf() {
2525
+ return ca ??= af.flatMap((e) => _n(e)?.char ?? []), ca;
2526
2526
  }
2527
2527
  let ge = null;
2528
- function yn(e) {
2528
+ function _n(e) {
2529
2529
  if (!ge) {
2530
2530
  ge = /* @__PURE__ */ new Map();
2531
2531
  for (const t of Ae().flatMap((a) => a.emoji))
@@ -2533,69 +2533,69 @@ function yn(e) {
2533
2533
  }
2534
2534
  return ge.get(e.toLowerCase());
2535
2535
  }
2536
- function af(e, t = 8) {
2536
+ function of(e, t = 8) {
2537
2537
  const a = e.toLowerCase();
2538
2538
  if (!a) return [];
2539
2539
  const n = /* @__PURE__ */ new Map();
2540
- for (const s of [...ft(), ...tf()]) n.has(s) || n.set(s, n.size);
2540
+ for (const s of [...ft(), ...nf()]) n.has(s) || n.set(s, n.size);
2541
2541
  const o = (s) => n.get(s.char) ?? n.size, r = [];
2542
2542
  let f = 0;
2543
2543
  for (const s of Ae().flatMap((c) => c.emoji)) {
2544
2544
  f += 1;
2545
2545
  let c = null;
2546
- for (const h of s.shortcodes) {
2547
- const m = h === a ? 0 : h.startsWith(a) ? 1 : h.split("_").some((S) => S.startsWith(a)) ? 2 : h.includes(a) ? 3 : -1;
2548
- m < 0 || (!c || m < c.rank) && (c = { code: h, rank: m });
2546
+ for (const g of s.shortcodes) {
2547
+ const m = g === a ? 0 : g.startsWith(a) ? 1 : g.split("_").some((k) => k.startsWith(a)) ? 2 : g.includes(a) ? 3 : -1;
2548
+ m < 0 || (!c || m < c.rank) && (c = { code: g, rank: m });
2549
2549
  }
2550
2550
  c && r.push({ emoji: s, code: c.code, rank: c.rank, order: o(s) * 1e4 + f });
2551
2551
  }
2552
2552
  return r.sort((s, c) => s.rank - c.rank || s.order - c.order), r.slice(0, t).map(({ emoji: s, code: c }) => ({ emoji: s, code: c }));
2553
2553
  }
2554
- function nf(e, t = 120) {
2554
+ function rf(e, t = 120) {
2555
2555
  const a = e.toLowerCase().trim().split(/\s+/).filter(Boolean);
2556
2556
  if (!a.length) return [];
2557
2557
  const n = Ae().flatMap((c) => c.emoji), o = a.join("_").replace(/^:|:$/g, ""), r = n.filter((c) => {
2558
- const h = c.name.split(/[\s-]+/);
2559
- return a.every((m) => h.some((S) => S.startsWith(m))) || c.shortcodes.some((m) => m.startsWith(o));
2558
+ const g = c.name.split(/[\s-]+/);
2559
+ return a.every((m) => g.some((k) => k.startsWith(m))) || c.shortcodes.some((m) => m.startsWith(o));
2560
2560
  }), f = a.join(" "), s = (c) => {
2561
2561
  if (c.name === f || c.shortcodes.includes(o)) return 0;
2562
- const h = c.name.split(/[\s-]+/);
2563
- return a.every((m) => h.includes(m)) ? 1 : 2;
2562
+ const g = c.name.split(/[\s-]+/);
2563
+ return a.every((m) => g.includes(m)) ? 1 : 2;
2564
2564
  };
2565
- return r.sort((c, h) => s(c) - s(h)), r.slice(0, t);
2565
+ return r.sort((c, g) => s(c) - s(g)), r.slice(0, t);
2566
2566
  }
2567
- const of = [
2567
+ const ff = [
2568
2568
  [128077],
2569
2569
  [10084, 65039],
2570
2570
  [128514],
2571
2571
  [128558],
2572
2572
  [128546],
2573
2573
  [128293]
2574
- ].map((e) => String.fromCodePoint(...e)), _n = 24;
2574
+ ].map((e) => String.fromCodePoint(...e)), wn = 24;
2575
2575
  function ft() {
2576
2576
  const e = B(oe.RECENT_EMOJI);
2577
2577
  if (!e) return [];
2578
2578
  try {
2579
2579
  const t = JSON.parse(e);
2580
- return Array.isArray(t) ? t.filter((a) => typeof a == "string").slice(0, _n) : [];
2580
+ return Array.isArray(t) ? t.filter((a) => typeof a == "string").slice(0, wn) : [];
2581
2581
  } catch {
2582
2582
  return [];
2583
2583
  }
2584
2584
  }
2585
- function wn(e) {
2586
- const t = [e, ...ft().filter((a) => a !== e)].slice(0, _n);
2585
+ function vn(e) {
2586
+ const t = [e, ...ft().filter((a) => a !== e)].slice(0, wn);
2587
2587
  ot(oe.RECENT_EMOJI, JSON.stringify(t));
2588
2588
  }
2589
- function rf(e = 3) {
2589
+ function sf(e = 3) {
2590
2590
  const t = [];
2591
- for (const a of [...ft(), ...of])
2591
+ for (const a of [...ft(), ...ff])
2592
2592
  if (t.includes(a) || t.push(a), t.length === e) break;
2593
2593
  return t;
2594
2594
  }
2595
- function vn(e, t) {
2595
+ function kn(e, t) {
2596
2596
  return e.by.some((a) => a === t.author || !!t.clientId && a === t.clientId);
2597
2597
  }
2598
- function ff(e, t, a) {
2598
+ function lf(e, t, a) {
2599
2599
  const n = /* @__PURE__ */ new Map();
2600
2600
  for (const s of Object.values(t))
2601
2601
  s.author && n.set(s.author, s.name), n.set(s.clientId, s.name);
@@ -2611,18 +2611,18 @@ function ff(e, t, a) {
2611
2611
  }
2612
2612
  return r && o.unshift("You"), f && o.push(f === 1 ? "1 other" : `${f} others`), o;
2613
2613
  }
2614
- function sf(e, t) {
2614
+ function cf(e, t) {
2615
2615
  return `${e.length <= 1 ? e[0] ?? "Someone" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`} reacted with ${t ? `:${t.replace(/\s+/g, "_")}:` : "this"}`;
2616
2616
  }
2617
2617
  const ce = 8;
2618
- function lf(e) {
2618
+ function df(e) {
2619
2619
  return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
2620
2620
  }
2621
- function cf() {
2622
- const e = Fa();
2623
- return ba(lf, () => document.fullscreenElement, () => null) ?? e ?? document.body;
2621
+ function uf() {
2622
+ const e = za();
2623
+ return ya(df, () => document.fullscreenElement, () => null) ?? e ?? document.body;
2624
2624
  }
2625
- function df({
2625
+ function mf({
2626
2626
  anchor: e,
2627
2627
  onClose: t,
2628
2628
  width: a,
@@ -2632,22 +2632,22 @@ function df({
2632
2632
  className: f = "",
2633
2633
  role: s = "dialog",
2634
2634
  ariaLabel: c,
2635
- testId: h,
2635
+ testId: g,
2636
2636
  children: m
2637
2637
  }) {
2638
- const S = cf(), x = $(null), [E, R] = N(null), y = M(() => {
2638
+ const k = uf(), x = $(null), [E, R] = N(null), y = M(() => {
2639
2639
  const d = x.current;
2640
2640
  if (!e || !d) return;
2641
- const u = e.getBoundingClientRect(), w = window.innerWidth, p = window.innerHeight, T = Math.min(a, w - ce * 2), L = Math.min(Math.max(ce, o ? u.right - T : u.left), w - T - ce), q = d.offsetHeight, F = u.top - r - ce, z = p - u.bottom - r - ce, I = n === "top" ? q <= F || F >= z : !(q <= z || z >= F), j = Math.max(120, I ? F : z), A = Math.min(q, j), O = I ? u.top - r - A : u.bottom + r;
2641
+ const u = e.getBoundingClientRect(), w = window.innerWidth, p = window.innerHeight, T = Math.min(a, w - ce * 2), L = Math.min(Math.max(ce, o ? u.right - T : u.left), w - T - ce), q = d.offsetHeight, z = u.top - r - ce, W = p - u.bottom - r - ce, I = n === "top" ? q <= z || z >= W : !(q <= W || W >= z), j = Math.max(120, I ? z : W), A = Math.min(q, j), O = I ? u.top - r - A : u.bottom + r;
2642
2642
  R((H) => H && H.left === L && H.top === O && H.maxHeight === j ? H : { left: L, top: O, maxHeight: j });
2643
2643
  }, [e, a, o, r, n]);
2644
- return Ut(() => {
2644
+ return $t(() => {
2645
2645
  y();
2646
2646
  const d = x.current, u = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => y());
2647
2647
  return u && d && u.observe(d), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0), () => {
2648
2648
  u?.disconnect(), window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0);
2649
2649
  };
2650
- }, [y]), Ut(() => {
2650
+ }, [y]), $t(() => {
2651
2651
  const d = (w) => {
2652
2652
  at(w) && (w.stopPropagation(), t(), e?.focus({ preventScroll: !0 }));
2653
2653
  }, u = (w) => {
@@ -2657,14 +2657,14 @@ function df({
2657
2657
  return document.addEventListener("keydown", d), document.addEventListener("pointerdown", u, !0), () => {
2658
2658
  document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", u, !0);
2659
2659
  };
2660
- }, [t, e]), ka(
2660
+ }, [t, e]), xa(
2661
2661
  /* @__PURE__ */ l(
2662
2662
  "div",
2663
2663
  {
2664
2664
  ref: x,
2665
2665
  role: s,
2666
2666
  "aria-label": c,
2667
- "data-testid": h,
2667
+ "data-testid": g,
2668
2668
  className: `floating-panel ${f}`,
2669
2669
  style: {
2670
2670
  position: "fixed",
@@ -2682,15 +2682,15 @@ function df({
2682
2682
  children: m
2683
2683
  }
2684
2684
  ),
2685
- S
2685
+ k
2686
2686
  );
2687
2687
  }
2688
- const uf = 340;
2689
- function mf({ anchor: e, onPick: t, onClose: a }) {
2690
- const [n, o] = N(""), [r, f] = N(null), s = $(null), c = $(null), h = W(() => Ae(), []), m = W(
2688
+ const gf = 340;
2689
+ function hf({ anchor: e, onPick: t, onClose: a }) {
2690
+ const [n, o] = N(""), [r, f] = N(null), s = $(null), c = $(null), g = F(() => Ae(), []), m = F(
2691
2691
  () => ft().map((d) => Qe(d) ?? { char: d, name: "", shortcodes: [] }).slice(0, 16),
2692
2692
  []
2693
- ), S = W(() => nf(n), [n]), x = n.trim().length > 0;
2693
+ ), k = F(() => rf(n), [n]), x = n.trim().length > 0;
2694
2694
  P(() => {
2695
2695
  s.current?.focus({ preventScroll: !0 });
2696
2696
  }, []);
@@ -2713,7 +2713,7 @@ function mf({ anchor: e, onPick: t, onClose: a }) {
2713
2713
  },
2714
2714
  u
2715
2715
  );
2716
- return /* @__PURE__ */ _(df, { anchor: e, onClose: a, width: uf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
2716
+ return /* @__PURE__ */ _(mf, { anchor: e, onClose: a, width: gf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
2717
2717
  /* @__PURE__ */ l("div", { className: "emoji-picker-search", children: /* @__PURE__ */ l(
2718
2718
  "input",
2719
2719
  {
@@ -2728,9 +2728,9 @@ function mf({ anchor: e, onPick: t, onClose: a }) {
2728
2728
  ) }),
2729
2729
  !x && /* @__PURE__ */ _("div", { className: "emoji-picker-tabs", role: "tablist", "aria-label": "Emoji categories", children: [
2730
2730
  m.length > 0 && /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => R("recent"), title: "Frequently used", "aria-label": "Frequently used", children: m[0].char }),
2731
- h.map((d) => /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => R(d.id), title: d.label, "aria-label": d.label, children: d.emoji[0].char }, d.id))
2731
+ g.map((d) => /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => R(d.id), title: d.label, "aria-label": d.label, children: d.emoji[0].char }, d.id))
2732
2732
  ] }),
2733
- /* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => f(null), children: x ? S.length ? /* @__PURE__ */ l("div", { className: "emoji-grid", children: S.map((d) => y(d, d.char)) }) : /* @__PURE__ */ _("p", { className: "emoji-picker-empty", children: [
2733
+ /* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => f(null), children: x ? k.length ? /* @__PURE__ */ l("div", { className: "emoji-grid", children: k.map((d) => y(d, d.char)) }) : /* @__PURE__ */ _("p", { className: "emoji-picker-empty", children: [
2734
2734
  "No emoji match “",
2735
2735
  n.trim(),
2736
2736
  "”"
@@ -2739,7 +2739,7 @@ function mf({ anchor: e, onPick: t, onClose: a }) {
2739
2739
  /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: "Frequently used" }),
2740
2740
  /* @__PURE__ */ l("div", { className: "emoji-grid", children: m.map((d) => y(d, `r-${d.char}`)) })
2741
2741
  ] }),
2742
- h.map((d) => /* @__PURE__ */ _("section", { "data-emoji-group": d.id, className: "emoji-section", children: [
2742
+ g.map((d) => /* @__PURE__ */ _("section", { "data-emoji-group": d.id, className: "emoji-section", children: [
2743
2743
  /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: d.label }),
2744
2744
  /* @__PURE__ */ l("div", { className: "emoji-grid", children: d.emoji.map((u) => y(u, u.char)) })
2745
2745
  ] }, d.id))
@@ -2754,22 +2754,22 @@ function mf({ anchor: e, onPick: t, onClose: a }) {
2754
2754
  ] }) : null })
2755
2755
  ] });
2756
2756
  }
2757
- function gf({ className: e = "w-4 h-4" }) {
2757
+ function pf({ className: e = "w-4 h-4" }) {
2758
2758
  return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2759
2759
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
2760
2760
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
2761
2761
  ] });
2762
2762
  }
2763
- function hf({ className: e = "w-4 h-4" }) {
2763
+ function bf({ className: e = "w-4 h-4" }) {
2764
2764
  return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2765
2765
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
2766
2766
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
2767
2767
  ] });
2768
2768
  }
2769
- function pf({ className: e = "w-5 h-5" }) {
2769
+ function yf({ className: e = "w-5 h-5" }) {
2770
2770
  return /* @__PURE__ */ l("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
2771
2771
  }
2772
- function kn({ className: e = "w-4 h-4" }) {
2772
+ function xn({ className: e = "w-4 h-4" }) {
2773
2773
  return /* @__PURE__ */ _("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2774
2774
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20.5 12.5A8.5 8.5 0 1111.5 3.5" }),
2775
2775
  /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M8.5 14.5a4 4 0 007 0" }),
@@ -2777,7 +2777,7 @@ function kn({ className: e = "w-4 h-4" }) {
2777
2777
  /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M19 2v6M16 5h6" })
2778
2778
  ] });
2779
2779
  }
2780
- function bf({ className: e = "w-4 h-4" }) {
2780
+ function _f({ className: e = "w-4 h-4" }) {
2781
2781
  return /* @__PURE__ */ _("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2782
2782
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M10 7L4 12l6 5" }),
2783
2783
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 12h9a7 7 0 017 7" })
@@ -2786,15 +2786,15 @@ function bf({ className: e = "w-4 h-4" }) {
2786
2786
  function mt(e) {
2787
2787
  return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2788
2788
  }
2789
- const yf = Ge.memo(function({ message: t }) {
2790
- const a = g((u) => u.me.clientId), n = g((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), o = Ji(t, { clientId: a, author: n }), r = it(
2789
+ const wf = Ge.memo(function({ message: t }) {
2790
+ const a = h((u) => u.me.clientId), n = h((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), o = Qi(t, { clientId: a, author: n }), r = it(
2791
2791
  { clientId: t.clientId, author: t.author },
2792
2792
  { name: t.name, sprite: t.sprite }
2793
2793
  ), f = Ee(r.sprite, r.pictureUrl), s = t.isSystem ? void 0 : r.cosmetics, c = $(null);
2794
- Ko(c, !!s);
2795
- const [h] = N(
2796
- () => t.live && t.text ? _a(t.text, s) : null
2797
- ), [m, S] = N(!1), [x, E] = N(null), R = g((u) => u.setReplyingTo);
2794
+ Yo(c, !!s);
2795
+ const [g] = N(
2796
+ () => t.live && t.text ? wa(t.text, s) : null
2797
+ ), [m, k] = N(!1), [x, E] = N(null), R = h((u) => u.setReplyingTo);
2798
2798
  if (t.isSystem && t.systemType === "recap")
2799
2799
  return /* @__PURE__ */ l("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ _("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
2800
2800
  /* @__PURE__ */ _("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
@@ -2805,43 +2805,43 @@ const yf = Ge.memo(function({ message: t }) {
2805
2805
  ] }) });
2806
2806
  if (t.isSystem)
2807
2807
  return /* @__PURE__ */ _("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
2808
- Bi(t.text, t.template, r),
2808
+ Ki(t.text, t.template, r),
2809
2809
  /* @__PURE__ */ l("span", { className: "ml-1 text-[10px] opacity-50", children: mt(t.ts) })
2810
2810
  ] });
2811
2811
  const y = { clientId: a, author: n }, d = (u) => {
2812
- const w = t.reactions?.find((L) => L.emoji === u), p = !(w && vn(w, y));
2813
- p && wn(u);
2812
+ const w = t.reactions?.find((L) => L.emoji === u), p = !(w && kn(w, y));
2813
+ p && vn(u);
2814
2814
  const T = n ?? a;
2815
- T && Lr(t.id, u, p, T), Pi(t.id, u, p);
2815
+ T && qr(t.id, u, p, T), Di(t.id, u, p);
2816
2816
  };
2817
2817
  return /* @__PURE__ */ _(
2818
2818
  "div",
2819
2819
  {
2820
2820
  ref: c,
2821
- style: Ba(f),
2821
+ style: Ga(f),
2822
2822
  "data-msg-id": t.id,
2823
2823
  className: `chat-msg px-2 py-1 ${o ? "chat-msg-own" : ""}`,
2824
- onMouseEnter: () => S(!0),
2825
- onMouseLeave: () => S(!1),
2826
- onFocus: () => S(!0),
2824
+ onMouseEnter: () => k(!0),
2825
+ onMouseLeave: () => k(!1),
2826
+ onFocus: () => k(!0),
2827
2827
  onBlur: (u) => {
2828
- u.currentTarget.contains(u.relatedTarget) || S(!1);
2828
+ u.currentTarget.contains(u.relatedTarget) || k(!1);
2829
2829
  },
2830
2830
  "data-active": m || x ? "true" : void 0,
2831
2831
  children: [
2832
- t.replyTo && /* @__PURE__ */ l(_f, { replyTo: t.replyTo }),
2832
+ t.replyTo && /* @__PURE__ */ l(vf, { replyTo: t.replyTo }),
2833
2833
  /* @__PURE__ */ _("div", { className: "flex items-start gap-2", children: [
2834
- /* @__PURE__ */ l(pn, { sprite: r.sprite, url: r.pictureUrl, alt: r.name, worn: s }),
2834
+ /* @__PURE__ */ l(bn, { sprite: r.sprite, url: r.pictureUrl, alt: r.name, worn: s }),
2835
2835
  /* @__PURE__ */ _("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
2836
- s ? /* @__PURE__ */ l(we, { html: wa(r.name, s), className: "text-[13px]", style: { color: f } }) : /* @__PURE__ */ l("span", { className: "font-medium text-[13px]", style: { color: f }, children: r.name }),
2836
+ s ? /* @__PURE__ */ l(we, { html: va(r.name, s), className: "text-[13px]", style: { color: f } }) : /* @__PURE__ */ l("span", { className: "font-medium text-[13px]", style: { color: f }, children: r.name }),
2837
2837
  /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: mt(t.ts) }),
2838
- t.text && (h ? /* @__PURE__ */ l(we, { as: "p", html: h, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ l("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
2839
- /* @__PURE__ */ l(bn, { images: t.images }),
2840
- t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(wf, { reactions: t.reactions, me: y, onToggle: d, onAdd: E })
2838
+ t.text && (g ? /* @__PURE__ */ l(we, { as: "p", html: g, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ l("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
2839
+ /* @__PURE__ */ l(yn, { images: t.images }),
2840
+ t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(kf, { reactions: t.reactions, me: y, onToggle: d, onAdd: E })
2841
2841
  ] })
2842
2842
  ] }),
2843
2843
  (m || x) && /* @__PURE__ */ _("div", { className: "chat-msg-actions", role: "toolbar", "aria-label": "Message actions", "data-testid": "chat-msg-actions", children: [
2844
- rf().map((u) => /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn chat-action-emoji", onClick: () => d(u), "aria-label": `React with ${Qe(u)?.name ?? u}`, title: Qe(u)?.name, children: u }, u)),
2844
+ sf().map((u) => /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn chat-action-emoji", onClick: () => d(u), "aria-label": `React with ${Qe(u)?.name ?? u}`, title: Qe(u)?.name, children: u }, u)),
2845
2845
  /* @__PURE__ */ l(
2846
2846
  "button",
2847
2847
  {
@@ -2851,20 +2851,20 @@ const yf = Ge.memo(function({ message: t }) {
2851
2851
  "aria-label": "Add reaction",
2852
2852
  title: "Add reaction",
2853
2853
  "aria-expanded": !!x,
2854
- children: /* @__PURE__ */ l(kn, {})
2854
+ children: /* @__PURE__ */ l(xn, {})
2855
2855
  }
2856
2856
  ),
2857
- /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn", onClick: () => R(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ l(bf, {}) })
2857
+ /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn", onClick: () => R(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ l(_f, {}) })
2858
2858
  ] }),
2859
- x && /* @__PURE__ */ l(mf, { anchor: x, onPick: d, onClose: () => {
2860
- E(null), S(!1);
2859
+ x && /* @__PURE__ */ l(hf, { anchor: x, onPick: d, onClose: () => {
2860
+ E(null), k(!1);
2861
2861
  } })
2862
2862
  ]
2863
2863
  }
2864
2864
  );
2865
2865
  });
2866
- function _f({ replyTo: e }) {
2867
- const t = g((f) => f.chat.find((s) => s.id === e)), a = g((f) => f.jumpToMessage), n = it(
2866
+ function vf({ replyTo: e }) {
2867
+ const t = h((f) => f.chat.find((s) => s.id === e)), a = h((f) => f.jumpToMessage), n = it(
2868
2868
  { clientId: t?.clientId ?? "", author: t?.author },
2869
2869
  { name: t?.name ?? "", sprite: t?.sprite ?? null }
2870
2870
  ), o = Ee(n.sprite, n.pictureUrl);
@@ -2873,7 +2873,7 @@ function _f({ replyTo: e }) {
2873
2873
  /* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2874
2874
  /* @__PURE__ */ l("span", { className: "chat-reply-text italic", children: "Original message unavailable" })
2875
2875
  ] });
2876
- const r = t.isSystem ? (t.template ?? t.text).split(xt).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2876
+ const r = t.isSystem ? (t.template ?? t.text).split(St).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2877
2877
  return /* @__PURE__ */ _(
2878
2878
  "button",
2879
2879
  {
@@ -2885,7 +2885,7 @@ function _f({ replyTo: e }) {
2885
2885
  children: [
2886
2886
  /* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2887
2887
  /* @__PURE__ */ l(
2888
- Dt,
2888
+ Lt,
2889
2889
  {
2890
2890
  sprite: n.sprite,
2891
2891
  url: n.pictureUrl,
@@ -2900,11 +2900,11 @@ function _f({ replyTo: e }) {
2900
2900
  }
2901
2901
  );
2902
2902
  }
2903
- function wf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2904
- const o = g((r) => r.roster);
2903
+ function kf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2904
+ const o = h((r) => r.roster);
2905
2905
  return /* @__PURE__ */ _("div", { className: "chat-reactions", "data-testid": "chat-reactions", children: [
2906
2906
  e.map((r) => {
2907
- const f = vn(r, t);
2907
+ const f = kn(r, t);
2908
2908
  return /* @__PURE__ */ _(
2909
2909
  "button",
2910
2910
  {
@@ -2913,7 +2913,7 @@ function wf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2913
2913
  "data-mine": f ? "true" : void 0,
2914
2914
  "aria-pressed": f,
2915
2915
  onClick: () => a(r.emoji),
2916
- title: sf(ff(r, o, t), Qe(r.emoji)?.name),
2916
+ title: cf(lf(r, o, t), Qe(r.emoji)?.name),
2917
2917
  "data-emoji": r.emoji,
2918
2918
  children: [
2919
2919
  /* @__PURE__ */ l("span", { className: "chat-reaction-emoji", children: r.emoji }),
@@ -2923,22 +2923,22 @@ function wf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2923
2923
  r.emoji
2924
2924
  );
2925
2925
  }),
2926
- /* @__PURE__ */ l("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (r) => n(r.currentTarget), "aria-label": "Add reaction", title: "Add reaction", children: /* @__PURE__ */ l(kn, {}) })
2926
+ /* @__PURE__ */ l("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (r) => n(r.currentTarget), "aria-label": "Add reaction", title: "Add reaction", children: /* @__PURE__ */ l(xn, {}) })
2927
2927
  ] });
2928
2928
  }
2929
- function vf() {
2930
- Wa();
2931
- const e = g((r) => r.chat), t = $(null), a = $(!1), n = M(() => {
2929
+ function xf() {
2930
+ Ba();
2931
+ const e = h((r) => r.chat), t = $(null), a = $(!1), n = M(() => {
2932
2932
  const r = t.current;
2933
2933
  if (!r) return;
2934
- const { scrollHeight: f, scrollTop: s, clientHeight: c } = r, h = f - s - c;
2935
- a.current = h > 40;
2934
+ const { scrollHeight: f, scrollTop: s, clientHeight: c } = r, g = f - s - c;
2935
+ a.current = g > 40;
2936
2936
  }, []);
2937
2937
  P(() => {
2938
2938
  const r = t.current;
2939
2939
  !r || a.current || (typeof r.scrollTo == "function" ? r.scrollTo({ top: r.scrollHeight, behavior: "smooth" }) : r.scrollTop = r.scrollHeight);
2940
2940
  }, [e.length]);
2941
- const o = g((r) => r.chatJump);
2941
+ const o = h((r) => r.chatJump);
2942
2942
  return P(() => {
2943
2943
  const r = t.current;
2944
2944
  if (!o || !r) return;
@@ -2962,13 +2962,13 @@ function vf() {
2962
2962
  /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(r.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
2963
2963
  /* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" })
2964
2964
  ] }),
2965
- /* @__PURE__ */ l(yf, { message: r })
2965
+ /* @__PURE__ */ l(wf, { message: r })
2966
2966
  ] }, r.id);
2967
2967
  }) })
2968
2968
  }
2969
2969
  );
2970
2970
  }
2971
- const Lt = [
2971
+ const Ot = [
2972
2972
  {
2973
2973
  name: "recap",
2974
2974
  description: "Summarise the previous episode of what is loaded",
@@ -2989,12 +2989,12 @@ const Lt = [
2989
2989
  scope: "local"
2990
2990
  }
2991
2991
  ], ue = "/";
2992
- function kf(e) {
2992
+ function Sf(e) {
2993
2993
  if (!e.startsWith(ue)) return null;
2994
2994
  const t = e.slice(ue.length);
2995
2995
  return /\s/.test(t) ? null : t.toLowerCase();
2996
2996
  }
2997
- function xf(e, t = Lt) {
2997
+ function Tf(e, t = Ot) {
2998
2998
  const a = e.toLowerCase();
2999
2999
  if (!a) return [...t].sort((o, r) => o.name.localeCompare(r.name));
3000
3000
  const n = [];
@@ -3004,23 +3004,23 @@ function xf(e, t = Lt) {
3004
3004
  }
3005
3005
  return n.sort((o, r) => o.rank - r.rank || o.cmd.name.localeCompare(r.cmd.name)).map((o) => o.cmd);
3006
3006
  }
3007
- function Sf(e) {
3007
+ function Cf(e) {
3008
3008
  return `${ue}${e.name} `;
3009
3009
  }
3010
3010
  function _e(e, t) {
3011
3011
  return t <= 0 ? 0 : (e % t + t) % t;
3012
3012
  }
3013
- function Tf(e, t = Lt) {
3013
+ function If(e, t = Ot) {
3014
3014
  const a = e.trim();
3015
3015
  if (!a) return null;
3016
3016
  if (!a.startsWith(ue)) return { kind: "chat", text: a };
3017
3017
  const n = a.slice(ue.length), o = n.search(/\s/), r = (o === -1 ? n : n.slice(0, o)).toLowerCase(), f = o === -1 ? "" : n.slice(o).trim(), s = t.find((c) => c.name.toLowerCase() === r);
3018
3018
  return s ? { kind: "command", command: s, args: f } : { kind: "chat", text: a };
3019
3019
  }
3020
- function Cf(e, t) {
3020
+ function Ef(e, t) {
3021
3021
  return e.requiresMedia && !t.hasMedia ? `${ue}${e.name} needs an episode loaded.` : null;
3022
3022
  }
3023
- function If({
3023
+ function Af({
3024
3024
  commands: e,
3025
3025
  activeIndex: t,
3026
3026
  hasMedia: a,
@@ -3038,19 +3038,19 @@ function If({
3038
3038
  bg-bg-card border border-border-light rounded shadow-lg
3039
3039
  list-none m-0 p-0 py-1 mb-1`,
3040
3040
  children: e.map((f, s) => {
3041
- const c = !!f.requiresMedia && !a, h = s === t;
3041
+ const c = !!f.requiresMedia && !a, g = s === t;
3042
3042
  return /* @__PURE__ */ _(
3043
3043
  "li",
3044
3044
  {
3045
3045
  id: `${r}-opt-${f.name}`,
3046
3046
  role: "option",
3047
- "aria-selected": h,
3047
+ "aria-selected": g,
3048
3048
  "aria-disabled": c,
3049
3049
  onMouseDown: (m) => {
3050
3050
  m.preventDefault(), n(f);
3051
3051
  },
3052
3052
  onMouseEnter: () => o(s),
3053
- className: `px-3 py-1.5 cursor-pointer flex items-baseline gap-2 ${h ? "bg-bg-alt" : ""} ${c ? "opacity-50" : ""}`,
3053
+ className: `px-3 py-1.5 cursor-pointer flex items-baseline gap-2 ${g ? "bg-bg-alt" : ""} ${c ? "opacity-50" : ""}`,
3054
3054
  children: [
3055
3055
  /* @__PURE__ */ l("span", { className: "text-sm font-semibold text-text shrink-0", children: f.usage }),
3056
3056
  /* @__PURE__ */ l("span", { className: "text-xs text-text-secondary truncate", children: c ? "needs an episode loaded" : f.description })
@@ -3062,8 +3062,8 @@ function If({
3062
3062
  }
3063
3063
  );
3064
3064
  }
3065
- const xn = (e, t) => `${e}-emoji-${t.code}`;
3066
- function Ef({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o }) {
3065
+ const Sn = (e, t) => `${e}-emoji-${t.code}`;
3066
+ function Nf({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o }) {
3067
3067
  return e.length === 0 ? null : /* @__PURE__ */ l(
3068
3068
  "ul",
3069
3069
  {
@@ -3077,7 +3077,7 @@ function Ef({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o })
3077
3077
  children: e.map((r, f) => /* @__PURE__ */ _(
3078
3078
  "li",
3079
3079
  {
3080
- id: xn(o, r),
3080
+ id: Sn(o, r),
3081
3081
  role: "option",
3082
3082
  "aria-selected": f === t,
3083
3083
  onMouseDown: (s) => {
@@ -3099,49 +3099,49 @@ function Ef({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o })
3099
3099
  }
3100
3100
  );
3101
3101
  }
3102
- const Af = 2, Nf = /^[a-z0-9_+-]*$/i;
3103
- function jf(e, t) {
3102
+ const jf = 2, Rf = /^[a-z0-9_+-]*$/i;
3103
+ function Pf(e, t) {
3104
3104
  const a = e.slice(0, t), n = a.lastIndexOf(":");
3105
3105
  if (n < 0) return null;
3106
3106
  const o = n === 0 ? "" : a[n - 1];
3107
3107
  if (o && !/[\s([{]/.test(o)) return null;
3108
3108
  const r = a.slice(n + 1);
3109
- return r.length < Af || !Nf.test(r) ? null : { query: r.toLowerCase(), start: n };
3109
+ return r.length < jf || !Rf.test(r) ? null : { query: r.toLowerCase(), start: n };
3110
3110
  }
3111
- function Rf(e, t, a, n) {
3111
+ function Mf(e, t, a, n) {
3112
3112
  const o = e.slice(a), r = o.startsWith(" ") ? n : `${n} `;
3113
3113
  return { text: e.slice(0, t) + r + o, caret: t + r.length };
3114
3114
  }
3115
- function Pf(e) {
3115
+ function Df(e) {
3116
3116
  let t = -1;
3117
3117
  return e.replace(/:([a-z0-9_+-]+):/gi, (a, n, o) => {
3118
3118
  const r = o === 0 ? "" : e[o - 1];
3119
3119
  if (r && !/[\s([{]/.test(r) && o !== t) return a;
3120
- const f = yn(n);
3120
+ const f = _n(n);
3121
3121
  return f ? (t = o + a.length, f.char) : a;
3122
3122
  });
3123
3123
  }
3124
- function Mf(e, t, a) {
3125
- const [n, o] = N(0), [r, f] = N({ q: null, i: 0 }), [s, c] = N(null), h = jf(e, Math.min(n, e.length)), m = h?.query ?? null, S = W(() => m ? af(m) : [], [m]), x = h ? `${h.start}:${m}` : null, E = S.length > 0 && s !== x, R = r.q === x ? _e(r.i, S.length) : 0, y = M((p) => f({ q: x, i: p }), [x]), d = M((p) => o(p.selectionStart ?? p.value.length), []), u = M((p) => {
3126
- if (!h) return;
3127
- const T = Rf(e, h.start, Math.min(n, e.length), p.emoji.char);
3128
- t(T.text), o(T.caret), wn(p.emoji.char);
3124
+ function Lf(e, t, a) {
3125
+ const [n, o] = N(0), [r, f] = N({ q: null, i: 0 }), [s, c] = N(null), g = Pf(e, Math.min(n, e.length)), m = g?.query ?? null, k = F(() => m ? of(m) : [], [m]), x = g ? `${g.start}:${m}` : null, E = k.length > 0 && s !== x, R = r.q === x ? _e(r.i, k.length) : 0, y = M((p) => f({ q: x, i: p }), [x]), d = M((p) => o(p.selectionStart ?? p.value.length), []), u = M((p) => {
3126
+ if (!g) return;
3127
+ const T = Mf(e, g.start, Math.min(n, e.length), p.emoji.char);
3128
+ t(T.text), o(T.caret), vn(p.emoji.char);
3129
3129
  const L = a.current;
3130
3130
  L && (L.focus(), requestAnimationFrame(() => L.setSelectionRange(T.caret, T.caret)));
3131
- }, [h, e, n, t, a]), w = M((p) => {
3131
+ }, [g, e, n, t, a]), w = M((p) => {
3132
3132
  if (!E) return !1;
3133
3133
  if (p.key === "ArrowDown" || p.key === "ArrowUp")
3134
- return p.preventDefault(), y(_e(R + (p.key === "ArrowDown" ? 1 : -1), S.length)), !0;
3134
+ return p.preventDefault(), y(_e(R + (p.key === "ArrowDown" ? 1 : -1), k.length)), !0;
3135
3135
  if (p.key === "Tab" || p.key === "Enter") {
3136
3136
  p.preventDefault();
3137
- const T = S[R];
3137
+ const T = k[R];
3138
3138
  return T && u(T), !0;
3139
3139
  }
3140
3140
  return p.key === "Escape" ? (p.preventDefault(), c(x), !0) : !1;
3141
- }, [E, S, R, u, y, x]);
3142
- return { open: E, matches: S, activeIndex: R, setActiveIndex: y, pick: u, onKeyDown: w, trackCaret: d };
3141
+ }, [E, k, R, u, y, x]);
3142
+ return { open: E, matches: k, activeIndex: R, setActiveIndex: y, pick: u, onKeyDown: w, trackCaret: d };
3143
3143
  }
3144
- function Df({
3144
+ function Of({
3145
3145
  pending: e,
3146
3146
  uploading: t,
3147
3147
  onRemove: a
@@ -3168,24 +3168,24 @@ function Df({
3168
3168
  )
3169
3169
  ] }, n.id)) }) : null;
3170
3170
  }
3171
- function Lf() {
3172
- const [e, t] = N([]), [a, n] = N(!1), o = g((y) => y.pushToast), r = $(/* @__PURE__ */ new Set());
3171
+ function qf() {
3172
+ const [e, t] = N([]), [a, n] = N(!1), o = h((y) => y.pushToast), r = $(/* @__PURE__ */ new Set());
3173
3173
  P(() => () => {
3174
3174
  for (const y of r.current) URL.revokeObjectURL(y);
3175
3175
  r.current.clear();
3176
3176
  }, []);
3177
3177
  const f = M((y) => {
3178
- Eo(y) && (URL.revokeObjectURL(y.previewUrl), r.current.delete(y.previewUrl));
3178
+ No(y) && (URL.revokeObjectURL(y.previewUrl), r.current.delete(y.previewUrl));
3179
3179
  }, []), s = M(async (y) => {
3180
3180
  if (!y.length) return;
3181
3181
  const d = [];
3182
3182
  for (const u of y) {
3183
- const w = No(u);
3183
+ const w = Ro(u);
3184
3184
  if (w) {
3185
3185
  o("error", w);
3186
3186
  continue;
3187
3187
  }
3188
- const { w: p, h: T } = await Po(u), L = URL.createObjectURL(u);
3188
+ const { w: p, h: T } = await Do(u), L = URL.createObjectURL(u);
3189
3189
  r.current.add(L), d.push({
3190
3190
  kind: "file",
3191
3191
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
@@ -3220,8 +3220,8 @@ function Lf() {
3220
3220
  w: y.width ?? 0,
3221
3221
  h: y.height ?? 0,
3222
3222
  title: y.title || void 0
3223
- }]), tt().catalogue(Ha).recordUse(y.key));
3224
- }, [o]), h = M((y) => {
3223
+ }]), tt().catalogue(Ua).recordUse(y.key));
3224
+ }, [o]), g = M((y) => {
3225
3225
  t((d) => {
3226
3226
  const u = d.find((w) => w.id === y);
3227
3227
  return u && f(u), d.filter((w) => w.id !== y);
@@ -3231,11 +3231,11 @@ function Lf() {
3231
3231
  for (const d of y) f(d);
3232
3232
  return [];
3233
3233
  });
3234
- }, [f]), S = M((y) => {
3235
- const d = jo(y.clipboardData);
3234
+ }, [f]), k = M((y) => {
3235
+ const d = Po(y.clipboardData);
3236
3236
  d.length && (y.preventDefault(), s(d));
3237
3237
  }, [s]), x = M((y) => {
3238
- const d = Ro(y.dataTransfer);
3238
+ const d = Mo(y.dataTransfer);
3239
3239
  d.length && (y.preventDefault(), s(d));
3240
3240
  }, [s]), E = M((y) => {
3241
3241
  y.dataTransfer?.types?.includes("Files") && y.preventDefault();
@@ -3243,9 +3243,9 @@ function Lf() {
3243
3243
  if (!e.length) return [];
3244
3244
  n(!0);
3245
3245
  try {
3246
- return await Do(e);
3246
+ return await Oo(e);
3247
3247
  } catch (y) {
3248
- return D("chat", "Image upload failed", Lo(y)), o("error", Ao(y)), null;
3248
+ return D("chat", "Image upload failed", qo(y)), o("error", jo(y)), null;
3249
3249
  } finally {
3250
3250
  n(!1);
3251
3251
  }
@@ -3255,16 +3255,16 @@ function Lf() {
3255
3255
  uploading: a,
3256
3256
  addFiles: s,
3257
3257
  addMeme: c,
3258
- remove: h,
3258
+ remove: g,
3259
3259
  clear: m,
3260
3260
  uploadPending: R,
3261
- onPaste: S,
3261
+ onPaste: k,
3262
3262
  onDrop: x,
3263
3263
  onDragOver: E
3264
3264
  };
3265
3265
  }
3266
- const Of = 2500, qf = 5e3;
3267
- class Hf {
3266
+ const Hf = 2500, Uf = 5e3;
3267
+ class $f {
3268
3268
  constructor(t, a = Date.now) {
3269
3269
  this.send = t, this.now = a;
3270
3270
  }
@@ -3279,21 +3279,21 @@ class Hf {
3279
3279
  return;
3280
3280
  }
3281
3281
  const a = this.now();
3282
- (!this.typing || a - this.lastSent >= Of) && (this.typing = !0, this.lastSent = a, this.send(!0)), this.idle && clearTimeout(this.idle), this.idle = setTimeout(() => this.stop(), qf);
3282
+ (!this.typing || a - this.lastSent >= Hf) && (this.typing = !0, this.lastSent = a, this.send(!0)), this.idle && clearTimeout(this.idle), this.idle = setTimeout(() => this.stop(), Uf);
3283
3283
  }
3284
3284
  stop() {
3285
3285
  this.idle && (clearTimeout(this.idle), this.idle = null), this.typing && (this.typing = !1, this.send(!1));
3286
3286
  }
3287
3287
  }
3288
- function Uf() {
3289
- const [e] = N(() => new Hf(Mi));
3288
+ function Ff() {
3289
+ const [e] = N(() => new $f(Li));
3290
3290
  return P(() => () => e.stop(), [e]), e;
3291
3291
  }
3292
- function $f(e) {
3292
+ function zf(e) {
3293
3293
  return e.length === 0 ? null : e.length === 1 ? `${e[0]} is typing…` : e.length === 2 ? `${e[0]} and ${e[1]} are typing…` : e.length === 3 ? `${e[0]}, ${e[1]} and ${e[2]} are typing…` : "Several people are typing…";
3294
3294
  }
3295
- function Ff({ replyTo: e, onCancel: t }) {
3296
- const a = g((r) => r.chat.find((f) => f.id === e)), n = it(
3295
+ function Wf({ replyTo: e, onCancel: t }) {
3296
+ const a = h((r) => r.chat.find((f) => f.id === e)), n = it(
3297
3297
  { clientId: a?.clientId ?? "", author: a?.author },
3298
3298
  { name: a?.name ?? "a message", sprite: a?.sprite ?? null }
3299
3299
  ), o = Ee(n.sprite, n.pictureUrl);
@@ -3302,78 +3302,101 @@ function Ff({ replyTo: e, onCancel: t }) {
3302
3302
  "Replying to ",
3303
3303
  /* @__PURE__ */ l("span", { className: "font-semibold", style: { color: o }, children: n.name })
3304
3304
  ] }),
3305
- /* @__PURE__ */ l("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ l(pf, { className: "w-3.5 h-3.5" }) })
3305
+ /* @__PURE__ */ l("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ l(yf, { className: "w-3.5 h-3.5" }) })
3306
3306
  ] });
3307
3307
  }
3308
- function zf() {
3309
- const e = g((f) => f.typing), t = g((f) => f.roster), a = g((f) => f.me.clientId), n = g((f) => f.setTyping);
3308
+ function Tn(e, t) {
3309
+ const a = /* @__PURE__ */ new Map();
3310
+ for (const n of Object.values(e)) {
3311
+ const o = wt(n), r = a.get(o);
3312
+ if (!r) {
3313
+ a.set(o, n);
3314
+ continue;
3315
+ }
3316
+ const f = n.clientId === t ? n : r, s = !!(r.isLeader || n.isLeader);
3317
+ a.set(o, s && !f.isLeader ? { ...f, isLeader: !0 } : f);
3318
+ }
3319
+ return [...a.values()];
3320
+ }
3321
+ function wt(e) {
3322
+ return e.author ? `author:${e.author}` : `client:${e.clientId}`;
3323
+ }
3324
+ function Bf() {
3325
+ const e = h((c) => c.typing), t = h((c) => c.roster), a = h((c) => c.me.clientId), n = h((c) => c.setTyping);
3310
3326
  P(() => {
3311
- const f = Object.keys(e);
3312
- if (f.length === 0) return;
3313
- const s = Math.min(...f.map((h) => e[h])), c = setTimeout(() => {
3314
- const h = Date.now();
3315
- for (const m of f) e[m] <= h && n(m, !1);
3316
- }, Math.max(0, s - Date.now()) + 50);
3317
- return () => clearTimeout(c);
3327
+ const c = Object.keys(e);
3328
+ if (c.length === 0) return;
3329
+ const g = Math.min(...c.map((k) => e[k])), m = setTimeout(() => {
3330
+ const k = Date.now();
3331
+ for (const x of c) e[x] <= k && n(x, !1);
3332
+ }, Math.max(0, g - Date.now()) + 50);
3333
+ return () => clearTimeout(m);
3318
3334
  }, [e, n]);
3319
- const o = Object.keys(e).filter((f) => f !== a && t[f]).map((f) => t[f].name || "Someone").sort((f, s) => f.localeCompare(s)), r = $f(o);
3320
- return /* @__PURE__ */ l("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children: r && /* @__PURE__ */ _(te, { children: [
3335
+ const o = a && t[a] ? wt(t[a]) : null, r = /* @__PURE__ */ new Map();
3336
+ for (const c of Object.keys(e)) {
3337
+ const g = t[c];
3338
+ if (!g || c === a) continue;
3339
+ const m = wt(g);
3340
+ m !== o && !r.has(m) && r.set(m, g.name || "Someone");
3341
+ }
3342
+ const f = [...r.values()].sort((c, g) => c.localeCompare(g)), s = zf(f);
3343
+ return /* @__PURE__ */ l("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children: s && /* @__PURE__ */ _(te, { children: [
3321
3344
  /* @__PURE__ */ _("span", { className: "chat-typing-dots", "aria-hidden": "true", children: [
3322
3345
  /* @__PURE__ */ l("i", {}),
3323
3346
  /* @__PURE__ */ l("i", {}),
3324
3347
  /* @__PURE__ */ l("i", {})
3325
3348
  ] }),
3326
- /* @__PURE__ */ l("span", { className: "truncate", children: r })
3349
+ /* @__PURE__ */ l("span", { className: "truncate", children: s })
3327
3350
  ] }) });
3328
3351
  }
3329
- const ca = Ca, Wf = ao;
3330
- function Bf({ commands: e = Lt }) {
3331
- const [t, a] = N(""), [n, o] = N(!1), [r, f] = N({ q: null, i: 0 }), [s, c] = N(!1), h = $(null), m = $t(), S = $t(), [x, E] = N(!1), [R, y] = N(!1), d = Mf(t, a, h), u = Lf(), w = Uf(), p = g((v) => v.replyingTo), T = g((v) => v.setReplyingTo);
3352
+ const da = Ia, Gf = oo;
3353
+ function Kf({ commands: e = Ot }) {
3354
+ const [t, a] = N(""), [n, o] = N(!1), [r, f] = N({ q: null, i: 0 }), [s, c] = N(!1), g = $(null), m = Ft(), k = Ft(), [x, E] = N(!1), [R, y] = N(!1), d = Lf(t, a, g), u = qf(), w = Ff(), p = h((v) => v.replyingTo), T = h((v) => v.setReplyingTo);
3332
3355
  P(() => {
3333
- p && !document.hidden && h.current?.focus({ preventScroll: !0 });
3356
+ p && !document.hidden && g.current?.focus({ preventScroll: !0 });
3334
3357
  }, [p]);
3335
- const L = g((v) => v.snapshot.mediaId), q = g((v) => v.pushToast), F = g((v) => v.setTierlistOpen), z = !!L, I = kf(t), j = W(
3336
- () => I === null ? [] : xf(I, e),
3358
+ const L = h((v) => v.snapshot.mediaId), q = h((v) => v.pushToast), z = h((v) => v.setTierlistOpen), W = !!L, I = Sf(t), j = F(
3359
+ () => I === null ? [] : Tf(I, e),
3337
3360
  [I, e]
3338
3361
  ), A = I !== null && !s && j.length > 0, O = r.q === I ? _e(r.i, j.length) : 0, H = M(
3339
3362
  (v) => f({ q: I, i: v }),
3340
3363
  [I]
3341
3364
  ), ie = M((v, U) => {
3342
- const me = Cf(v, { hasMedia: z });
3365
+ const me = Ef(v, { hasMedia: W });
3343
3366
  if (me) {
3344
3367
  q("info", me);
3345
3368
  return;
3346
3369
  }
3347
3370
  switch (v.name) {
3348
3371
  case "help":
3349
- q("info", e.map((In) => In.usage).join(" "));
3372
+ q("info", e.map((An) => An.usage).join(" "));
3350
3373
  break;
3351
3374
  case "recap":
3352
- Ui();
3375
+ Fi();
3353
3376
  break;
3354
3377
  case "tierlist":
3355
- Kr(), F(!0);
3378
+ Yr(), z(!0);
3356
3379
  break;
3357
3380
  default:
3358
3381
  q("info", `${v.usage} is not implemented yet.`);
3359
3382
  }
3360
- }, [z, q, e, F]), V = M((v) => {
3361
- a(Sf(v)), c(!1), h.current?.focus();
3362
- }, []), Tn = M(async (v) => {
3383
+ }, [W, q, e, z]), V = M((v) => {
3384
+ a(Cf(v)), c(!1), g.current?.focus();
3385
+ }, []), In = M(async (v) => {
3363
3386
  if (v.preventDefault(), n || u.uploading) return;
3364
- const U = Tf(t, e);
3387
+ const U = If(t, e);
3365
3388
  if (!U && !u.pending.length) return;
3366
3389
  if (U?.kind === "command" && u.pending.length) {
3367
3390
  q("info", "Send images on their own, not with a command.");
3368
3391
  return;
3369
3392
  }
3370
3393
  if (U?.kind === "command") {
3371
- ie(U.command, U.args), a(""), w.stop(), !document.hidden && document.hasFocus() && h.current?.focus();
3394
+ ie(U.command, U.args), a(""), w.stop(), !document.hidden && document.hasFocus() && g.current?.focus();
3372
3395
  return;
3373
3396
  }
3374
3397
  const me = await u.uploadPending();
3375
- me !== null && (Ri(Pf(U?.text ?? ""), me, p), a(""), w.stop(), T(null), u.clear(), o(!0), setTimeout(() => o(!1), Wf), !document.hidden && document.hasFocus() && h.current?.focus());
3376
- }, [t, n, ie, u, q, e, p, T, w]), Cn = M((v) => {
3398
+ me !== null && (Mi(Df(U?.text ?? ""), me, p), a(""), w.stop(), T(null), u.clear(), o(!0), setTimeout(() => o(!1), Gf), !document.hidden && document.hasFocus() && g.current?.focus());
3399
+ }, [t, n, ie, u, q, e, p, T, w]), En = M((v) => {
3377
3400
  if (!(!A && d.onKeyDown(v))) {
3378
3401
  if (v.key === "Escape" && A) {
3379
3402
  v.preventDefault(), c(!0);
@@ -3402,48 +3425,48 @@ function Bf({ commands: e = Lt }) {
3402
3425
  }, [A, j, O, V, H, p, T, d]);
3403
3426
  P(() => {
3404
3427
  const v = () => {
3405
- document.hidden || !document.hasFocus() || (h.current?.focus(), h.current?.scrollIntoView({ block: "nearest" }));
3428
+ document.hidden || !document.hasFocus() || (g.current?.focus(), g.current?.scrollIntoView({ block: "nearest" }));
3406
3429
  };
3407
3430
  return window.addEventListener("watchparty:focus-chat-input", v), () => window.removeEventListener("watchparty:focus-chat-input", v);
3408
3431
  }, []);
3409
- const Ne = ca - t.length, Ot = Ne <= 100, qt = A ? j[O] : void 0, je = !A && d.open, Ht = je ? d.matches[d.activeIndex] : void 0;
3432
+ const Ne = da - t.length, qt = Ne <= 100, Ht = A ? j[O] : void 0, je = !A && d.open, Ut = je ? d.matches[d.activeIndex] : void 0;
3410
3433
  return /* @__PURE__ */ _(
3411
3434
  "form",
3412
3435
  {
3413
3436
  onSubmit: (v) => {
3414
- Tn(v);
3437
+ In(v);
3415
3438
  },
3416
3439
  onPaste: u.onPaste,
3417
3440
  onDrop: u.onDrop,
3418
3441
  onDragOver: u.onDragOver,
3419
3442
  className: "p-2 border-t border-border",
3420
3443
  children: [
3421
- p && /* @__PURE__ */ l(Ff, { replyTo: p, onCancel: () => T(null) }),
3422
- /* @__PURE__ */ l(Df, { pending: u.pending, uploading: u.uploading, onRemove: u.remove }),
3444
+ p && /* @__PURE__ */ l(Wf, { replyTo: p, onCancel: () => T(null) }),
3445
+ /* @__PURE__ */ l(Of, { pending: u.pending, uploading: u.uploading, onRemove: u.remove }),
3423
3446
  /* @__PURE__ */ _("div", { className: "relative", children: [
3424
3447
  A && /* @__PURE__ */ l(
3425
- If,
3448
+ Af,
3426
3449
  {
3427
3450
  commands: j,
3428
3451
  activeIndex: O,
3429
- hasMedia: z,
3452
+ hasMedia: W,
3430
3453
  onPick: V,
3431
3454
  onHover: H,
3432
3455
  listboxId: m
3433
3456
  }
3434
3457
  ),
3435
3458
  je && /* @__PURE__ */ l(
3436
- Ef,
3459
+ Nf,
3437
3460
  {
3438
3461
  matches: d.matches,
3439
3462
  activeIndex: d.activeIndex,
3440
3463
  onPick: d.pick,
3441
3464
  onHover: d.setActiveIndex,
3442
- listboxId: S
3465
+ listboxId: k
3443
3466
  }
3444
3467
  ),
3445
3468
  /* @__PURE__ */ l(
3446
- zo,
3469
+ Bo,
3447
3470
  {
3448
3471
  open: x,
3449
3472
  onClose: () => E(!1),
@@ -3458,25 +3481,25 @@ function Bf({ commands: e = Lt }) {
3458
3481
  /* @__PURE__ */ l(
3459
3482
  "input",
3460
3483
  {
3461
- ref: h,
3484
+ ref: g,
3462
3485
  type: "text",
3463
3486
  value: t,
3464
3487
  onChange: (v) => {
3465
3488
  a(v.target.value), d.trackCaret(v.target), c(!1), v.target.value.startsWith("/") ? w.stop() : w.input(v.target.value);
3466
3489
  },
3467
- onKeyDown: Cn,
3490
+ onKeyDown: En,
3468
3491
  onSelect: (v) => d.trackCaret(v.currentTarget),
3469
- maxLength: ca,
3492
+ maxLength: da,
3470
3493
  placeholder: "Send a message",
3471
3494
  role: "combobox",
3472
3495
  "aria-expanded": A || je,
3473
- "aria-controls": A ? m : je ? S : void 0,
3474
- "aria-activedescendant": qt ? `${m}-opt-${qt.name}` : Ht ? xn(S, Ht) : void 0,
3496
+ "aria-controls": A ? m : je ? k : void 0,
3497
+ "aria-activedescendant": Ht ? `${m}-opt-${Ht.name}` : Ut ? Sn(k, Ut) : void 0,
3475
3498
  "aria-autocomplete": "list",
3476
- className: `w-full bg-bg-card border border-border-light rounded px-3 py-1.5 text-sm focus:outline-none focus:border-text-muted ${Ot ? "pr-12" : ""}`
3499
+ className: `w-full bg-bg-card border border-border-light rounded px-3 py-1.5 text-sm focus:outline-none focus:border-text-muted ${qt ? "pr-12" : ""}`
3477
3500
  }
3478
3501
  ),
3479
- /* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${Ne <= 50 ? Ne <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children: Ot && Ne })
3502
+ /* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${Ne <= 50 ? Ne <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children: qt && Ne })
3480
3503
  ] }),
3481
3504
  !R && /* @__PURE__ */ l(
3482
3505
  "button",
@@ -3488,25 +3511,25 @@ function Bf({ commands: e = Lt }) {
3488
3511
  title: "Add a meme",
3489
3512
  "data-testid": "meme-button",
3490
3513
  className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${x ? "text-text border-primary" : "text-text-secondary"}`,
3491
- children: /* @__PURE__ */ l(En, { name: "image" })
3514
+ children: /* @__PURE__ */ l(Nn, { name: "image" })
3492
3515
  }
3493
3516
  )
3494
3517
  ] })
3495
3518
  ] }),
3496
- /* @__PURE__ */ l(zf, {})
3519
+ /* @__PURE__ */ l(Bf, {})
3497
3520
  ]
3498
3521
  }
3499
3522
  );
3500
3523
  }
3501
- function Gf() {
3502
- const e = g((a) => a.roster), t = Object.values(e);
3503
- return t.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: t.map((a) => /* @__PURE__ */ l(Kf, { u: a }, a.clientId)) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
3524
+ function Vf() {
3525
+ const e = h((n) => n.roster), t = h((n) => n.me.clientId), a = F(() => Tn(e, t), [e, t]);
3526
+ return a.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: a.map((n) => /* @__PURE__ */ l(Yf, { u: n }, n.clientId)) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
3504
3527
  }
3505
- function Kf({ u: e }) {
3528
+ function Yf({ u: e }) {
3506
3529
  const t = Ee(e.sprite, e.avatarUrl);
3507
3530
  return /* @__PURE__ */ _("div", { className: "flex items-center gap-2 py-0.5", children: [
3508
3531
  /* @__PURE__ */ l(
3509
- Dt,
3532
+ Lt,
3510
3533
  {
3511
3534
  sprite: e.sprite,
3512
3535
  url: e.avatarUrl,
@@ -3519,8 +3542,8 @@ function Kf({ u: e }) {
3519
3542
  e.isLeader && /* @__PURE__ */ l("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
3520
3543
  ] });
3521
3544
  }
3522
- function Vf() {
3523
- const e = g((r) => Object.keys(r.roster).length), [t, a] = N(!1), n = $(null), o = $(null);
3545
+ function Jf() {
3546
+ const e = h((r) => Tn(r.roster).length), [t, a] = N(!1), n = $(null), o = $(null);
3524
3547
  return P(() => {
3525
3548
  if (!t) return;
3526
3549
  function r(s) {
@@ -3555,12 +3578,12 @@ function Vf() {
3555
3578
  e,
3556
3579
  " online"
3557
3580
  ] }),
3558
- /* @__PURE__ */ l(Gf, {})
3581
+ /* @__PURE__ */ l(Vf, {})
3559
3582
  ] })
3560
3583
  ] });
3561
3584
  }
3562
- function da({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3563
- const t = g((n) => n.toasts), a = g((n) => n.popToast);
3585
+ function ua({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3586
+ const t = h((n) => n.toasts), a = h((n) => n.popToast);
3564
3587
  return P(() => {
3565
3588
  const n = t.map((o) => setTimeout(() => a(o.id), 4e3));
3566
3589
  return () => {
@@ -3568,53 +3591,53 @@ function da({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3568
3591
  };
3569
3592
  }, [t, a]), /* @__PURE__ */ l("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((n) => /* @__PURE__ */ l("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${n.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: n.msg }, n.id)) });
3570
3593
  }
3571
- const Sn = 9e3, ua = 1500, Yf = {
3594
+ const Cn = 9e3, ma = 1500, Xf = {
3572
3595
  classic: "[text-shadow:_-1px_-1px_0_#000,_1px_-1px_0_#000,_-1px_1px_0_#000,_1px_1px_0_#000,_0_-1px_0_#000,_0_1px_0_#000,_-1px_0_0_#000,_1px_0_0_#000]",
3573
3596
  cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
3574
3597
  minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
3575
3598
  contrast: "bg-black/70 px-2 py-0.5 rounded"
3576
- }, ma = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, ga = {
3599
+ }, ga = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, ha = {
3577
3600
  textShadow: "none",
3578
3601
  filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
3579
3602
  };
3580
- function Jf({ message: e, age: t, ccStyle: a }) {
3581
- const n = Sn - ua;
3603
+ function Qf({ message: e, age: t, ccStyle: a }) {
3604
+ const n = Cn - ma;
3582
3605
  let o = 1;
3583
- t > n && (o = Math.max(0, 1 - (t - n) / ua));
3584
- const r = Yf[a], f = it(
3606
+ t > n && (o = Math.max(0, 1 - (t - n) / ma));
3607
+ const r = Xf[a], f = it(
3585
3608
  { clientId: e.clientId, author: e.author },
3586
3609
  { name: e.name, sprite: e.sprite }
3587
- ), s = Ee(f.sprite, f.pictureUrl), c = f.cosmetics, [h] = N(
3588
- () => e.live && e.text ? _a(e.text, c) : null
3610
+ ), s = Ee(f.sprite, f.pictureUrl), c = f.cosmetics, [g] = N(
3611
+ () => e.live && e.text ? wa(e.text, c) : null
3589
3612
  );
3590
3613
  return /* @__PURE__ */ _(
3591
3614
  "div",
3592
3615
  {
3593
3616
  className: `flex items-start gap-2 py-1 ${r}`,
3594
- style: { opacity: o, transition: "opacity 0.15s ease-out", ...Ba(s) },
3617
+ style: { opacity: o, transition: "opacity 0.15s ease-out", ...Ga(s) },
3595
3618
  children: [
3596
- /* @__PURE__ */ l(pn, { sprite: f.sprite, url: f.pictureUrl, worn: c }),
3619
+ /* @__PURE__ */ l(bn, { sprite: f.sprite, url: f.pictureUrl, worn: c }),
3597
3620
  /* @__PURE__ */ _("div", { className: "min-w-0 flex-1", children: [
3598
- c ? /* @__PURE__ */ l(we, { html: wa(f.name, c), className: "text-sm mr-2", style: { color: s, ...ga } }) : /* @__PURE__ */ l("span", { className: "font-medium text-sm mr-2", style: { color: s, ...ma }, children: f.name }),
3599
- h ? /* @__PURE__ */ l(we, { html: h, className: "text-sm text-white break-words", style: ga }) : /* @__PURE__ */ l("span", { className: "text-sm text-white break-words", style: ma, children: e.text }),
3600
- /* @__PURE__ */ l(bn, { images: e.images })
3621
+ c ? /* @__PURE__ */ l(we, { html: va(f.name, c), className: "text-sm mr-2", style: { color: s, ...ha } }) : /* @__PURE__ */ l("span", { className: "font-medium text-sm mr-2", style: { color: s, ...ga }, children: f.name }),
3622
+ g ? /* @__PURE__ */ l(we, { html: g, className: "text-sm text-white break-words", style: ha }) : /* @__PURE__ */ l("span", { className: "text-sm text-white break-words", style: ga, children: e.text }),
3623
+ /* @__PURE__ */ l(yn, { images: e.images })
3601
3624
  ] })
3602
3625
  ]
3603
3626
  }
3604
3627
  );
3605
3628
  }
3606
- function Xf({ shown: e, className: t }) {
3607
- Wa();
3608
- const a = g((c) => c.chat), n = g((c) => c.mediaPrefs.subtitleStyle), [o, r] = N(() => Date.now()), f = a.length > 0;
3629
+ function Zf({ shown: e, className: t }) {
3630
+ Ba();
3631
+ const a = h((c) => c.chat), n = h((c) => c.mediaPrefs.subtitleStyle), [o, r] = N(() => Date.now()), f = a.length > 0;
3609
3632
  P(() => {
3610
3633
  const c = setInterval(() => {
3611
3634
  f && r(Date.now());
3612
3635
  }, 200);
3613
3636
  return () => clearInterval(c);
3614
3637
  }, [f]);
3615
- const s = W(() => {
3616
- const c = o - Sn;
3617
- return a.filter((h) => !h.isSystem && h.ts > c).slice(-12);
3638
+ const s = F(() => {
3639
+ const c = o - Cn;
3640
+ return a.filter((g) => !g.isSystem && g.ts > c).slice(-12);
3618
3641
  }, [a, o]);
3619
3642
  return !e || s.length === 0 ? null : /* @__PURE__ */ l(
3620
3643
  "div",
@@ -3622,7 +3645,7 @@ function Xf({ shown: e, className: t }) {
3622
3645
  className: `wp-floating-chat pointer-events-none flex flex-col ${t}`,
3623
3646
  "data-testid": "floating-chat",
3624
3647
  children: s.map((c) => /* @__PURE__ */ l(
3625
- Jf,
3648
+ Qf,
3626
3649
  {
3627
3650
  message: c,
3628
3651
  age: o - c.ts,
@@ -3633,27 +3656,27 @@ function Xf({ shown: e, className: t }) {
3633
3656
  }
3634
3657
  );
3635
3658
  }
3636
- const ha = (e) => typeof e == "string" && An.includes(e);
3637
- function Qf(e, t, a) {
3638
- return e || (ha(t) ? t : ha(a) ? a : "dark");
3659
+ const pa = (e) => typeof e == "string" && jn.includes(e);
3660
+ function es(e, t, a) {
3661
+ return e || (pa(t) ? t : pa(a) ? a : "dark");
3639
3662
  }
3640
- function Zf(e, t) {
3663
+ function ts(e, t) {
3641
3664
  if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
3642
3665
  };
3643
3666
  const a = new ResizeObserver(() => t(e.clientWidth));
3644
3667
  return a.observe(e), () => a.disconnect();
3645
3668
  }
3646
- function es(e) {
3669
+ function as(e) {
3647
3670
  const t = e?.trim() ?? "";
3648
3671
  return t ? { source: "host", name: t } : { source: "auto" };
3649
3672
  }
3650
- function ts(e) {
3673
+ function ns(e) {
3651
3674
  if (e.source !== "host") return;
3652
- const { setSessionIdentity: t, sprite: a } = g.getState();
3675
+ const { setSessionIdentity: t, sprite: a } = h.getState();
3653
3676
  t(e.name, a);
3654
3677
  }
3655
- const as = 1500;
3656
- function ys({
3678
+ const os = 1500;
3679
+ function ws({
3657
3680
  roomKey: e,
3658
3681
  serverOrigin: t,
3659
3682
  roomOrigin: a,
@@ -3663,64 +3686,64 @@ function ys({
3663
3686
  userType: f,
3664
3687
  userId: s,
3665
3688
  theme: c,
3666
- name: h,
3689
+ name: g,
3667
3690
  onLeave: m,
3668
- onLayoutChange: S,
3691
+ onLayoutChange: k,
3669
3692
  collapsible: x = !0,
3670
3693
  debug: E,
3671
3694
  children: R
3672
3695
  }) {
3673
- const [y, d] = N(null), { setFrame: u, ...w } = ns(S, x), p = g((A) => A.floatingChatEnabled), T = ya(() => h), L = W(() => (br({ userType: f, userId: s ?? null }), Nt().theme), [f, s]), q = Nn(), F = q?.theme, z = W(
3674
- () => Qf(c, F, L),
3675
- [c, F, L]
3696
+ const [y, d] = N(null), { setFrame: u, ...w } = rs(k, x), p = h((A) => A.floatingChatEnabled), T = _a(() => g), L = F(() => (_r({ userType: f, userId: s ?? null }), jt().theme), [f, s]), q = Rn(), z = q?.theme, W = F(
3697
+ () => es(c, z, L),
3698
+ [c, z, L]
3676
3699
  );
3677
3700
  P(() => {
3678
3701
  }, [c, q !== null]);
3679
- const j = W(
3680
- () => ({ ...Ct, serverOrigin: t, defaultRoomKey: e }),
3702
+ const j = F(
3703
+ () => ({ ...It, serverOrigin: t, defaultRoomKey: e }),
3681
3704
  [t, e]
3682
3705
  );
3683
3706
  return P(() => {
3684
- E && Jo();
3685
- }, [E]), $i(), P(() => {
3686
- Wo({ serverOrigin: t, defaultRoomKey: e }), $r(a ? { origin: a, path: n } : null), ta(o && !a ? { origin: o, path: r } : null), g.getState().rehydrateFromPrefs(), ci();
3707
+ E && Qo();
3708
+ }, [E]), zi(), P(() => {
3709
+ Go({ serverOrigin: t, defaultRoomKey: e }), zr(a ? { origin: a, path: n } : null), aa(o && !a ? { origin: o, path: r } : null), h.getState().rehydrateFromPrefs(), ui();
3687
3710
  let A = !1;
3688
- const O = wr();
3711
+ const O = kr();
3689
3712
  return (async () => {
3690
3713
  try {
3691
3714
  await Promise.race([
3692
3715
  Promise.all([
3693
3716
  O,
3694
- Cr().then((V) => {
3695
- V && g.getState().rehydrateFromPrefs();
3717
+ Er().then((V) => {
3718
+ V && h.getState().rehydrateFromPrefs();
3696
3719
  }),
3697
3720
  // The character chosen in the settings popout (lib/avatar.ts).
3698
- Qr().then(hn)
3721
+ ei().then(pn)
3699
3722
  ]),
3700
- new Promise((V) => setTimeout(V, as))
3723
+ new Promise((V) => setTimeout(V, os))
3701
3724
  ]);
3702
3725
  } catch (V) {
3703
3726
  D("room-chrome", "pre-join wait threw, proceeding anyway", Ce(V));
3704
3727
  }
3705
3728
  if (A) return;
3706
- const H = es(T());
3707
- g.getState().ensureAutoIdentity(), ts(H);
3708
- const ie = g.getState();
3709
- b("room-chrome", "Joining room", { roomKey: e, name: ie.name, sprite: ie.sprite }), wi({ room_key: e, name: ie.name || void 0, sprite: ie.sprite || void 0 });
3729
+ const H = as(T());
3730
+ h.getState().ensureAutoIdentity(), ns(H);
3731
+ const ie = h.getState();
3732
+ b("room-chrome", "Joining room", { roomKey: e, name: ie.name, sprite: ie.sprite }), ki({ room_key: e, name: ie.name || void 0, sprite: ie.sprite || void 0 });
3710
3733
  })(), () => {
3711
- A = !0, fa(), ta(null);
3734
+ A = !0, sa(), aa(null);
3712
3735
  };
3713
- }, [e, t, a, n, o, r, f, s]), /* @__PURE__ */ l(Bo.Provider, { value: j, children: /* @__PURE__ */ l(za.Provider, { value: !1, children: /* @__PURE__ */ l($a.Provider, { value: y, children: /* @__PURE__ */ _("div", { ref: u, className: "wp-room-chrome-frame", children: [
3736
+ }, [e, t, a, n, o, r, f, s]), /* @__PURE__ */ l(Ko.Provider, { value: j, children: /* @__PURE__ */ l(Wa.Provider, { value: !1, children: /* @__PURE__ */ l(Fa.Provider, { value: y, children: /* @__PURE__ */ _("div", { ref: u, className: "wp-room-chrome-frame", children: [
3714
3737
  /* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: R }),
3715
3738
  /* @__PURE__ */ l(
3716
3739
  "aside",
3717
3740
  {
3718
3741
  ref: d,
3719
3742
  className: "wp-room-chrome",
3720
- "data-theme": z,
3743
+ "data-theme": W,
3721
3744
  "data-collapsed": w.collapsed ? "1" : "0",
3722
3745
  style: { "--wp-room-chrome-width": `${w.state.width}px` },
3723
- onAnimationEnd: (A) => zn(A.nativeEvent),
3746
+ onAnimationEnd: (A) => Bn(A.nativeEvent),
3724
3747
  children: w.collapsed ? /* @__PURE__ */ _(te, { children: [
3725
3748
  /* @__PURE__ */ l(
3726
3749
  "button",
@@ -3730,11 +3753,11 @@ function ys({
3730
3753
  title: "Show chat",
3731
3754
  "aria-label": "Show chat",
3732
3755
  "aria-expanded": !1,
3733
- children: /* @__PURE__ */ l(hf, {})
3756
+ children: /* @__PURE__ */ l(bf, {})
3734
3757
  }
3735
3758
  ),
3736
- /* @__PURE__ */ l(da, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3737
- /* @__PURE__ */ l(Xf, { shown: p, className: "wp-room-chrome__floating" })
3759
+ /* @__PURE__ */ l(ua, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3760
+ /* @__PURE__ */ l(Zf, { shown: p, className: "wp-room-chrome__floating" })
3738
3761
  ] }) : /* @__PURE__ */ _(te, { children: [
3739
3762
  /* @__PURE__ */ l(
3740
3763
  "div",
@@ -3743,7 +3766,7 @@ function ys({
3743
3766
  "aria-orientation": "vertical",
3744
3767
  "aria-label": "Resize chat",
3745
3768
  "aria-valuemin": Xe,
3746
- "aria-valuemax": jt,
3769
+ "aria-valuemax": Rt,
3747
3770
  "aria-valuenow": w.state.width,
3748
3771
  tabIndex: 0,
3749
3772
  className: "wp-room-chrome__resize",
@@ -3756,13 +3779,13 @@ function ys({
3756
3779
  }
3757
3780
  ),
3758
3781
  /* @__PURE__ */ _("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
3759
- /* @__PURE__ */ l(Vf, {}),
3782
+ /* @__PURE__ */ l(Jf, {}),
3760
3783
  /* @__PURE__ */ l("div", { className: "flex-1" }),
3761
3784
  m && /* @__PURE__ */ l(
3762
3785
  "button",
3763
3786
  {
3764
3787
  onClick: () => {
3765
- fa(), m();
3788
+ sa(), m();
3766
3789
  },
3767
3790
  className: "wp-room-chrome__leave",
3768
3791
  title: "Leave room",
@@ -3778,25 +3801,25 @@ function ys({
3778
3801
  title: "Hide chat",
3779
3802
  "aria-label": "Hide chat",
3780
3803
  "aria-expanded": !0,
3781
- children: /* @__PURE__ */ l(gf, {})
3804
+ children: /* @__PURE__ */ l(pf, {})
3782
3805
  }
3783
3806
  )
3784
3807
  ] }),
3785
- /* @__PURE__ */ l(vf, {}),
3786
- /* @__PURE__ */ l(Bf, { commands: [] }),
3787
- /* @__PURE__ */ l(da, { className: "absolute bottom-14 left-2 right-2" })
3808
+ /* @__PURE__ */ l(xf, {}),
3809
+ /* @__PURE__ */ l(Kf, { commands: [] }),
3810
+ /* @__PURE__ */ l(ua, { className: "absolute bottom-14 left-2 right-2" })
3788
3811
  ] })
3789
3812
  }
3790
3813
  )
3791
3814
  ] }) }) }) });
3792
3815
  }
3793
- function ns(e, t) {
3794
- const a = g((p) => p.chromeChatCollapsed) && t, n = g((p) => p.chromeChatWidth), o = g((p) => p.toggleChromeChatCollapsed), r = g((p) => p.setChromeChatWidth), [f, s] = N(null), [c, h] = N(void 0), [m, S] = N(null);
3816
+ function rs(e, t) {
3817
+ const a = h((p) => p.chromeChatCollapsed) && t, n = h((p) => p.chromeChatWidth), o = h((p) => p.toggleChromeChatCollapsed), r = h((p) => p.setChromeChatWidth), [f, s] = N(null), [c, g] = N(void 0), [m, k] = N(null);
3795
3818
  P(() => {
3796
3819
  if (f)
3797
- return Zf(f, h);
3820
+ return ts(f, g);
3798
3821
  }, [f]);
3799
- const x = Z(m?.current ?? n, c), E = W(() => jr(a, x), [a, x]), R = ya((p) => e?.(p));
3822
+ const x = Z(m?.current ?? n, c), E = F(() => Pr(a, x), [a, x]), R = _a((p) => e?.(p));
3800
3823
  return P(() => {
3801
3824
  R(E);
3802
3825
  }, [E]), {
@@ -3806,23 +3829,23 @@ function ns(e, t) {
3806
3829
  dragging: m !== null,
3807
3830
  toggleCollapsed: o,
3808
3831
  onPointerDown: (p) => {
3809
- p.button === 0 && (p.preventDefault(), p.currentTarget.setPointerCapture(p.pointerId), S({ pointerId: p.pointerId, startX: p.clientX, startWidth: x, current: x }));
3832
+ p.button === 0 && (p.preventDefault(), p.currentTarget.setPointerCapture(p.pointerId), k({ pointerId: p.pointerId, startX: p.clientX, startWidth: x, current: x }));
3810
3833
  },
3811
3834
  onPointerMove: (p) => {
3812
- !m || m.pointerId !== p.pointerId || S({ ...m, current: ea(m.startWidth, m.startX, p.clientX, c) });
3835
+ !m || m.pointerId !== p.pointerId || k({ ...m, current: ta(m.startWidth, m.startX, p.clientX, c) });
3813
3836
  },
3814
3837
  onPointerEnd: (p) => {
3815
3838
  if (!m || m.pointerId !== p.pointerId) return;
3816
- const T = ea(m.startWidth, m.startX, p.clientX, c);
3817
- S(null), T !== n && r(T);
3839
+ const T = ta(m.startWidth, m.startX, p.clientX, c);
3840
+ k(null), T !== n && r(T);
3818
3841
  },
3819
3842
  onKeyDown: (p) => {
3820
- const T = Nr(x, p.key, c);
3843
+ const T = Rr(x, p.key, c);
3821
3844
  T !== null && (p.preventDefault(), T !== n && r(T));
3822
3845
  }
3823
3846
  };
3824
3847
  }
3825
3848
  export {
3826
- ys as RoomChrome
3849
+ ws as RoomChrome
3827
3850
  };
3828
3851
  //# sourceMappingURL=room-chrome.js.map