@hadoku/watchparty-ui 0.45.116 → 0.45.117

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
- import { jsx as l, jsxs as _, Fragment as te } from "react/jsx-runtime";
2
- import Ge, { useState as N, useRef as $, useMemo as F, useCallback as M, useEffect as R, createContext as kt, useContext as pa, useSyncExternalStore as ba, useLayoutEffect as Ut, useId as $t, useEffectEvent as ya } from "react";
3
- import { themePrefs as pe, Icon as Nn, THEMES as jn, useHadokuThemeOptional as Pn } from "@wolffm/themes";
4
- import { createCdnClient as Rn, 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 _a, nameHtml as wa, finishReveal as Bn } from "@wolffm/prefs-client/cosmetics";
6
- import { create as Gn } from "zustand";
7
- import { avatarPortraitPath as Kn, pickAvatar as ka, applyReaction as Vn, mintTabId as Yn, resolveIdentityReassert as Jn } from "@wolffm/rooms-protocol";
1
+ import { jsx as l, jsxs as w, Fragment as te } from "react/jsx-runtime";
2
+ import Ke, { useState as N, useRef as $, useMemo as F, useCallback as M, useEffect as P, createContext as wt, useContext as ba, useSyncExternalStore as ya, useLayoutEffect as $t, useId as Ft, useEffectEvent as _a } from "react";
3
+ import { themePrefs as pe, Icon as jn, THEMES as Rn, useHadokuThemeOptional as Pn } from "@wolffm/themes";
4
+ import { createCdnClient as Mn, kindOfType as Dn, MAX_BYTES as Ln, measureImage as On, filesFromClipboard as qn, filesFromDrop as Hn, CdnError as ut } from "@wolffm/cdn-client";
5
+ import { ensureCosmeticsStyles as Un, cleanWorn as $n, readPictureColour as Fn, onPictureColour as zn, pictureColour as Wn, decorHtml as Bn, messageHtml as wa, nameHtml as ka, finishReveal as Gn } from "@wolffm/prefs-client/cosmetics";
6
+ import { create as Kn } from "zustand";
7
+ import { avatarPortraitPath as Vn, pickAvatar as va, applyReaction as Yn, mintTabId as Jn, resolveIdentityReassert as Xn } from "@wolffm/rooms-protocol";
8
8
  import { z as i } from "zod";
9
- import { createPrefsClient as Xn, getDeviceId as Qn, DEVICE_ID_KEY as Zn } from "@wolffm/prefs-client";
10
- import { io as ht } from "socket.io-client";
11
- import { fetchCharacter as eo, characterOf as to, onAvatarChange as ao } from "@wolffm/prefs-client/avatar";
12
- import { relayIdentityChanges as no } from "@wolffm/task-ui-components/identity-relay";
13
- import { createPortal as va } from "react-dom";
14
- import { useCatalogueSearch as oo } 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 xt = 8080, Ta = 5173, ro = "/watchparty/ws", Ca = 500, io = 1e3, ae = 4, Ia = typeof process < "u" && process.env ? process.env : {};
9
+ import { createPrefsClient as Qn, getDeviceId as Zn, DEVICE_ID_KEY as eo } from "@wolffm/prefs-client";
10
+ import { io as mt } from "socket.io-client";
11
+ import { fetchCharacter as to, characterOf as ao, onAvatarChange as no } from "@wolffm/prefs-client/avatar";
12
+ import { relayIdentityChanges as oo } from "@wolffm/task-ui-components/identity-relay";
13
+ import { createPortal as xa } from "react-dom";
14
+ import { useCatalogueSearch as ro } 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 vt = 8080, Ca = 5173, io = "/watchparty/ws", Ea = 500, fo = 1e3, ae = 4, Ia = typeof process < "u" && process.env ? process.env : {};
20
20
  Ia.PRODUCTION_UI_URL;
21
21
  Ia.PRODUCTION_SERVER_URL;
22
- const qe = i.enum(["S", "A", "B", "C", "D", "F"]), Ft = 2e4, fo = 300;
22
+ const He = i.enum(["S", "A", "B", "C", "D", "F"]), zt = 2e4, so = 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(),
@@ -52,7 +52,7 @@ const S = {
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
- }, so = i.enum(["play", "pause", "seek", "load", "home"]), lo = i.object({
55
+ }, lo = i.enum(["play", "pause", "seek", "load", "home"]), co = 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: lo.optional(),
63
+ embed: co.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: so,
111
+ kind: lo,
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(fo).optional()
146
- }), Aa = /^[A-Za-z0-9_.:-]{1,64}$/;
145
+ title: i.string().max(so).optional()
146
+ }), Na = /^[A-Za-z0-9_.:-]{1,64}$/;
147
147
  i.object({
148
- text: i.string().max(Ca),
148
+ text: i.string().max(Ea),
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 co = i.enum(["join", "leave", "media_change", "identity_change", "recap"]);
154
+ const uo = 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: co.optional(),
175
+ systemType: uo.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 St = "{name}", uo = i.object({
182
+ const xt = "{name}", mo = 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 St = "{name}", uo = 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
- }), mo = uo.extend({
224
+ }), go = mo.extend({
225
225
  client_id: i.string(),
226
226
  name: i.string(),
227
227
  sprite_id: i.string().nullable(),
@@ -232,10 +232,10 @@ const St = "{name}", uo = i.object({
232
232
  stale_ms: i.number().int().nonnegative().optional()
233
233
  });
234
234
  i.object({
235
- clients: i.array(mo),
235
+ clients: i.array(go),
236
236
  server_ts: i.number().int().nonnegative()
237
237
  });
238
- const go = i.object({
238
+ const ho = 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 go = i.object({
253
253
  video_ready_state: i.number().int().default(-1)
254
254
  });
255
255
  i.object({
256
- clients: i.array(go),
256
+ clients: i.array(ho),
257
257
  server_ts: i.number().int().nonnegative()
258
258
  });
259
259
  i.object({
260
260
  media_id: i.string()
261
261
  });
262
- const Tt = i.enum(["super_upvote", "upvote", "mid", "downvote"]), ho = i.object({
262
+ const St = i.enum(["super_upvote", "upvote", "mid", "downvote"]), po = 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 Tt = i.enum(["super_upvote", "upvote", "mid", "downvote"]), ho = 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
- }), po = i.enum(["basic", "vote"]), Na = i.object({
273
+ }), bo = i.enum(["basic", "vote"]), ja = i.object({
274
274
  id: i.string(),
275
275
  name: i.string(),
276
- type: po.default("vote"),
277
- videos: i.array(ho),
276
+ type: bo.default("vote"),
277
+ videos: i.array(po),
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: Tt
286
+ vote: St
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(), Tt)
293
+ myVotes: i.record(i.string(), St)
294
294
  // mediaId -> VoteValue
295
295
  });
296
- const bo = i.object({
296
+ const yo = 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(bo)
303
+ progress: i.array(yo)
304
304
  });
305
305
  i.object({
306
- playlist: Na,
307
- votes: i.record(i.string(), i.record(i.string(), Tt)),
306
+ playlist: ja,
307
+ votes: i.record(i.string(), i.record(i.string(), St)),
308
308
  // votes[clientId][mediaId]
309
309
  names: i.record(i.string(), i.string()),
310
310
  // clientId -> display name
@@ -329,31 +329,31 @@ const Pe = {
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 Pa = i.partialRecord(qe, i.array(i.string()));
340
+ const Pa = i.partialRecord(He, i.array(i.string()));
341
341
  i.object({ board: Pa });
342
- const yo = i.object({
342
+ const _o = i.object({
343
343
  mediaId: i.string(),
344
- tier: qe,
345
- absoluteTier: qe,
344
+ tier: He,
345
+ absoluteTier: He,
346
346
  /** Tier level + within-row position. Integer part is the tier. */
347
347
  score: i.number(),
348
348
  /** The consensus mean that decided the tier. Never the displayed number. */
349
349
  placementScore: i.number(),
350
350
  subRankOffset: i.number(),
351
- votes: i.record(i.string(), qe)
351
+ votes: i.record(i.string(), He)
352
352
  // opaque voterId -> the letter they gave
353
353
  });
354
354
  i.object({
355
- items: i.array(ja),
356
- placed: i.array(yo),
355
+ items: i.array(Ra),
356
+ placed: i.array(_o),
357
357
  unrated: i.array(i.string()),
358
358
  spread: i.number(),
359
359
  nudged: i.boolean(),
@@ -365,7 +365,7 @@ i.object({
365
365
  voterCount: i.number().int().nonnegative(),
366
366
  myBoard: Pa
367
367
  });
368
- const _o = {
368
+ const wo = {
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 wo = {
381
+ const ko = {
382
382
  STATE: "ready_check_state"
383
383
  // distinct from buffer-readiness 'ready_state'
384
- }, Ra = {
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 ko = [
396
+ const vo = [
397
397
  {
398
398
  id: "fantasy",
399
399
  characters: [
@@ -437,16 +437,16 @@ const ko = [
437
437
  { id: "mentor", color: "#e1e0dc" }
438
438
  ]
439
439
  }
440
- ], Ma = ko.flatMap((e) => e.characters), Ze = Ma.map((e) => e.id), vo = Object.fromEntries(Ma.map((e) => [e.id, e.color]));
440
+ ], Da = vo.flatMap((e) => e.characters), Ze = Da.map((e) => e.id), xo = Object.fromEntries(Da.map((e) => [e.id, e.color]));
441
441
  function et(e) {
442
442
  return !!e && Ze.includes(e);
443
443
  }
444
- const xo = 5e3, Da = { mode: "off", percent: 0 }, So = ["off", "on", "ab"];
445
- function To(e) {
446
- return typeof e == "string" && So.includes(e);
447
- }
444
+ const So = 5e3, La = { mode: "off", percent: 0 }, To = ["off", "on", "ab"];
448
445
  function Co(e) {
449
- 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;
446
+ return typeof e == "string" && To.includes(e);
447
+ }
448
+ function Eo(e) {
449
+ const t = e && typeof e == "object" ? e : {}, a = Co(t.mode) ? t.mode : La.mode, n = Number(t.percent), o = Number.isFinite(n) ? Math.min(100, Math.max(0, Math.round(n))) : 0;
450
450
  return { mode: a, percent: o };
451
451
  }
452
452
  function Io(e) {
@@ -455,37 +455,37 @@ function Io(e) {
455
455
  t ^= e.charCodeAt(a), t = Math.imul(t, 16777619) >>> 0;
456
456
  return t >>> 0;
457
457
  }
458
- function Eo(e, t, a) {
458
+ function Ao(e, t, a) {
459
459
  if (a === !0)
460
460
  return "fragment";
461
461
  if (a === !1)
462
462
  return "range";
463
- const n = Co(e);
463
+ const n = Eo(e);
464
464
  return n.mode === "on" ? "fragment" : n.mode === "off" || n.percent <= 0 ? "range" : n.percent >= 100 || t && Io(t) % 100 < n.percent ? "fragment" : "range";
465
465
  }
466
- let Re = null, La = xa;
467
- function Ao(e) {
468
- e.cdnBase && (La = e.cdnBase);
466
+ let Me = null, Oa = Sa;
467
+ function No(e) {
468
+ e.cdnBase && (Oa = e.cdnBase);
469
469
  }
470
- function Oa() {
471
- return La.replace(/\/+$/, "");
470
+ function qa() {
471
+ return Oa.replace(/\/+$/, "");
472
472
  }
473
473
  function tt() {
474
- const e = Oa();
475
- return (!Re || Re.base !== e) && (Re = { base: e, client: Rn({ cdnBase: e }) }), Re.client;
474
+ const e = qa();
475
+ return (!Me || Me.base !== e) && (Me = { base: e, client: Mn({ cdnBase: e }) }), Me.client;
476
476
  }
477
- function Ke(e) {
478
- return !vt(e) || !Oa() ? null : tt().urlFor(e);
477
+ function Ve(e) {
478
+ return !kt(e) || !qa() ? null : tt().urlFor(e);
479
479
  }
480
- function No(e) {
480
+ function jo(e) {
481
481
  return e.kind === "file";
482
482
  }
483
- class qa extends Error {
483
+ class Ha extends Error {
484
484
  constructor(t) {
485
485
  super(t), this.name = "ChatImageUploadError";
486
486
  }
487
487
  }
488
- function He(e) {
488
+ function Ue(e) {
489
489
  switch (e) {
490
490
  case "unauthenticated":
491
491
  return "Sign in to paste images";
@@ -505,121 +505,121 @@ function He(e) {
505
505
  return "Image upload failed";
506
506
  }
507
507
  }
508
- function jo(e) {
509
- return e instanceof gt ? He(e.reason) : e instanceof qa ? e.message : "Image upload failed";
508
+ function Ro(e) {
509
+ return e instanceof ut ? Ue(e.reason) : e instanceof Ha ? e.message : "Image upload failed";
510
510
  }
511
511
  function Po(e) {
512
512
  const t = e.type.toLowerCase().split(";")[0].trim();
513
- return t && Mn(t) !== "image" ? He("unsupported-type") : e.size > Dn.image ? He("too-large") : e.size === 0 ? He("invalid") : null;
514
- }
515
- function Ro(e) {
516
- return On(e);
513
+ return t && Dn(t) !== "image" ? Ue("unsupported-type") : e.size > Ln.image ? Ue("too-large") : e.size === 0 ? Ue("invalid") : null;
517
514
  }
518
515
  function Mo(e) {
519
516
  return qn(e);
520
517
  }
521
- async function Do(e) {
522
- const t = await Ln(e);
518
+ function Do(e) {
519
+ return Hn(e);
520
+ }
521
+ async function Lo(e) {
522
+ const t = await On(e);
523
523
  return { w: t?.width ?? 0, h: t?.height ?? 0 };
524
524
  }
525
- async function Lo(e, t = {}) {
525
+ async function Oo(e, t = {}) {
526
526
  const a = await tt().upload(e, { signal: t.signal });
527
- if (!vt(a.key))
528
- throw new qa("Image upload returned an unusable key");
527
+ if (!kt(a.key))
528
+ throw new Ha("Image upload returned an unusable key");
529
529
  return { key: a.key, deduplicated: a.deduplicated === !0 };
530
530
  }
531
- async function Oo(e, t = {}) {
531
+ async function qo(e, t = {}) {
532
532
  const a = [];
533
533
  for (const n of e) {
534
534
  if (n.kind === "remote") {
535
535
  a.push({ key: n.key, w: n.w, h: n.h, ...n.title ? { title: n.title } : {} });
536
536
  continue;
537
537
  }
538
- const { key: o } = await Lo(n.file, t);
538
+ const { key: o } = await Oo(n.file, t);
539
539
  a.push({ key: o, w: n.w, h: n.h });
540
540
  }
541
541
  return a;
542
542
  }
543
- function qo(e) {
543
+ function Ho(e) {
544
544
  return {
545
545
  error: e instanceof Error ? e.message : String(e),
546
546
  name: e instanceof Error ? e.name : typeof e,
547
- reason: e instanceof gt ? e.reason : void 0,
548
- status: e instanceof gt ? e.status : void 0
547
+ reason: e instanceof ut ? e.reason : void 0,
548
+ status: e instanceof ut ? e.status : void 0
549
549
  };
550
550
  }
551
551
  function at(e) {
552
552
  return e.key === "Escape" || e.key === "GoBack" || e.key === "BrowserBack" || e.key === "XF86Back" || e.keyCode === 461 || e.keyCode === 10009;
553
553
  }
554
- function Ho(e) {
554
+ function Uo(e) {
555
555
  return `/tv?return=${encodeURIComponent(e.pathname + e.search)}`;
556
556
  }
557
- function Uo({ className: e }) {
557
+ function $o({ className: e }) {
558
558
  return /* @__PURE__ */ l(
559
559
  "a",
560
560
  {
561
- href: Ho(window.location),
561
+ href: Uo(window.location),
562
562
  className: e,
563
563
  "data-testid": "sign-in-with-code",
564
564
  children: "Sign in with a code"
565
565
  }
566
566
  );
567
567
  }
568
- const pt = 240, fe = 8, $o = 28, Ha = 240;
569
- function Fo(e, t, a) {
570
- let n = t.left - pt - fe;
571
- n < fe && (n = t.right + fe), n = Math.min(n, a.width - pt - fe), n = Math.max(fe, n);
572
- const o = Ha + $o;
568
+ const gt = 240, fe = 8, Fo = 28, Ua = 240;
569
+ function zo(e, t, a) {
570
+ let n = t.left - gt - fe;
571
+ n < fe && (n = t.right + fe), n = Math.min(n, a.width - gt - fe), n = Math.max(fe, n);
572
+ const o = Ua + Fo;
573
573
  let r = e.top + e.height / 2 - o / 2;
574
574
  return r = Math.min(r, a.height - o - fe), r = Math.max(fe, r), { left: n, top: r };
575
575
  }
576
- const Ua = "/dataplatform/api/memes", zo = 120;
577
- function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
578
- const [o, r] = N(""), f = $(null), s = $(null), c = tt(), { items: g, loading: m, error: v, hasMore: x, loadMore: E } = oo(
576
+ const $a = "/dataplatform/api/memes", Wo = 120;
577
+ function Bo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
578
+ const [o, r] = N(""), f = $(null), s = $(null), c = tt(), { items: g, loading: u, error: v, hasMore: x, loadMore: I } = ro(
579
579
  c,
580
- Ua,
580
+ $a,
581
581
  o.trim()
582
- ), P = v?.reason ?? null, y = F(() => {
583
- const I = /* @__PURE__ */ new Set();
584
- return g.filter((j) => I.has(j.key) ? !1 : (I.add(j.key), !0));
585
- }, [g]), [d, u] = N(null), w = $(null), p = M(() => {
586
- w.current !== null && (window.clearTimeout(w.current), w.current = null);
582
+ ), R = v?.reason ?? null, _ = F(() => {
583
+ const E = /* @__PURE__ */ new Set();
584
+ return g.filter((j) => E.has(j.key) ? !1 : (E.add(j.key), !0));
585
+ }, [g]), [d, y] = N(null), h = $(null), b = M(() => {
586
+ h.current !== null && (window.clearTimeout(h.current), h.current = null);
587
587
  }, []), T = M(() => {
588
- p(), u(null);
589
- }, [p]), L = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, q = M(
590
- (I, j, A = !1) => {
591
- const O = f.current;
592
- if (!O) return;
593
- const H = () => u({
594
- item: I,
595
- ...Fo(j.getBoundingClientRect(), O.getBoundingClientRect(), {
588
+ b(), y(null);
589
+ }, [b]), L = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, O = M(
590
+ (E, j, A = !1) => {
591
+ const q = f.current;
592
+ if (!q) return;
593
+ const H = () => y({
594
+ item: E,
595
+ ...zo(j.getBoundingClientRect(), q.getBoundingClientRect(), {
596
596
  width: window.innerWidth,
597
597
  height: window.innerHeight
598
598
  })
599
599
  });
600
- p(), A ? H() : w.current = window.setTimeout(H, zo);
600
+ b(), A ? H() : h.current = window.setTimeout(H, Wo);
601
601
  },
602
- [p]
602
+ [b]
603
603
  );
604
- R(() => () => p(), [p]), R(() => {
605
- P === "unavailable" && a?.();
606
- }, [P, a]), R(() => {
604
+ P(() => () => b(), [b]), P(() => {
605
+ R === "unavailable" && a?.();
606
+ }, [R, a]), P(() => {
607
607
  s.current?.focus();
608
- }, []), R(() => {
609
- const I = (A) => {
608
+ }, []), P(() => {
609
+ const E = (A) => {
610
610
  at(A) && (A.stopPropagation(), e());
611
611
  }, j = (A) => {
612
- const O = A.target;
613
- f.current && !f.current.contains(O) && !n?.contains(O) && e();
612
+ const q = A.target;
613
+ f.current && !f.current.contains(q) && !n?.contains(q) && e();
614
614
  };
615
- return document.addEventListener("keydown", I), document.addEventListener("mousedown", j), () => {
616
- document.removeEventListener("keydown", I), document.removeEventListener("mousedown", j);
615
+ return document.addEventListener("keydown", E), document.addEventListener("mousedown", j), () => {
616
+ document.removeEventListener("keydown", E), document.removeEventListener("mousedown", j);
617
617
  };
618
618
  }, [e, n]);
619
- const z = M((I) => {
620
- t(I), e();
621
- }, [t, e]), W = !m && !v && y.length === 0;
622
- return /* @__PURE__ */ _(
619
+ const z = M((E) => {
620
+ t(E), e();
621
+ }, [t, e]), W = !u && !v && _.length === 0;
622
+ return /* @__PURE__ */ w(
623
623
  "div",
624
624
  {
625
625
  ref: f,
@@ -634,14 +634,14 @@ function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
634
634
  ref: s,
635
635
  type: "text",
636
636
  value: o,
637
- onChange: (I) => r(I.target.value),
637
+ onChange: (E) => r(E.target.value),
638
638
  placeholder: "Search memes...",
639
639
  "aria-label": "Search memes",
640
640
  "data-testid": "meme-search",
641
641
  className: "w-full rounded border border-border-light bg-bg-alt px-2 py-1 text-sm text-text placeholder:text-text-secondary focus:outline-none focus:border-primary"
642
642
  }
643
643
  ) }),
644
- /* @__PURE__ */ _(
644
+ /* @__PURE__ */ w(
645
645
  "div",
646
646
  {
647
647
  className: "flex-1 overflow-y-auto p-2",
@@ -653,50 +653,50 @@ function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
653
653
  {
654
654
  className: "m-2 p-2 text-center text-sm bg-danger-bg text-on-danger-bg rounded",
655
655
  role: "alert",
656
- "data-reason": P,
657
- children: P === "unauthenticated" ? /* @__PURE__ */ _(te, { children: [
656
+ "data-reason": R,
657
+ children: R === "unauthenticated" ? /* @__PURE__ */ w(te, { children: [
658
658
  "Sign in to browse memes · ",
659
- /* @__PURE__ */ l(Uo, { className: "underline text-on-danger-bg" })
660
- ] }) : P === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
659
+ /* @__PURE__ */ l($o, { className: "underline text-on-danger-bg" })
660
+ ] }) : R === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
661
661
  }
662
662
  ),
663
663
  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" }),
664
- y.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: y.map((I) => {
665
- const j = Ke(I.key);
664
+ _.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: _.map((E) => {
665
+ const j = Ve(E.key);
666
666
  return j ? /* @__PURE__ */ l(
667
667
  "button",
668
668
  {
669
669
  type: "button",
670
- onClick: () => z(I),
671
- title: I.title,
670
+ onClick: () => z(E),
671
+ title: E.title,
672
672
  "data-testid": "meme-result",
673
673
  onMouseEnter: (A) => {
674
- L && q(I, A.currentTarget);
674
+ L && O(E, A.currentTarget);
675
675
  },
676
676
  onMouseLeave: T,
677
- onFocus: (A) => q(I, A.currentTarget, !0),
677
+ onFocus: (A) => O(E, A.currentTarget, !0),
678
678
  onBlur: T,
679
679
  className: "group relative aspect-square overflow-hidden rounded border border-border-light bg-bg-alt focus:outline-none focus:border-primary hover:border-primary",
680
680
  children: /* @__PURE__ */ l(
681
681
  "img",
682
682
  {
683
683
  src: j,
684
- alt: I.title || "Meme",
684
+ alt: E.title || "Meme",
685
685
  loading: "lazy",
686
686
  decoding: "async",
687
687
  className: "h-full w-full object-cover"
688
688
  }
689
689
  )
690
690
  },
691
- I.key
691
+ E.key
692
692
  ) : null;
693
693
  }) }),
694
- m && /* @__PURE__ */ l("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
695
- x && !m && /* @__PURE__ */ l(
694
+ u && /* @__PURE__ */ l("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
695
+ x && !u && /* @__PURE__ */ l(
696
696
  "button",
697
697
  {
698
698
  type: "button",
699
- onClick: E,
699
+ onClick: I,
700
700
  "data-testid": "meme-load-more",
701
701
  className: "mt-2 w-full rounded border border-border-light py-1 text-xs text-text-secondary hover:text-text hover:border-primary",
702
702
  children: "Load more"
@@ -705,7 +705,7 @@ function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
705
705
  ]
706
706
  }
707
707
  ),
708
- d && /* @__PURE__ */ _(
708
+ d && /* @__PURE__ */ w(
709
709
  "div",
710
710
  {
711
711
  "data-testid": "meme-preview",
@@ -713,7 +713,7 @@ function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
713
713
  style: {
714
714
  left: d.left,
715
715
  top: d.top,
716
- width: pt,
716
+ width: gt,
717
717
  /* The placement maths reserves exactly PREVIEW_PX of width.
718
718
  Without border-box the padding and border sit OUTSIDE that
719
719
  number and the box laps over the panel it is meant to sit
@@ -727,10 +727,10 @@ function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
727
727
  /* @__PURE__ */ l(
728
728
  "img",
729
729
  {
730
- src: Ke(d.item.key) ?? void 0,
730
+ src: Ve(d.item.key) ?? void 0,
731
731
  alt: "",
732
732
  className: "block w-full rounded bg-bg object-contain",
733
- style: { height: "auto", maxHeight: Ha }
733
+ style: { height: "auto", maxHeight: Ua }
734
734
  }
735
735
  ),
736
736
  d.item.title && /* One line. A long title must not change the box height, because
@@ -743,53 +743,53 @@ function Wo({ onClose: e, onPick: t, onUnavailable: a, toggle: n }) {
743
743
  }
744
744
  );
745
745
  }
746
- function Bo({ open: e, ...t }) {
747
- return e ? /* @__PURE__ */ l(Wo, { ...t }) : null;
746
+ function Go({ open: e, ...t }) {
747
+ return e ? /* @__PURE__ */ l(Bo, { ...t }) : null;
748
748
  }
749
- const Ct = {
750
- serverOrigin: `http://localhost:${xt}`,
749
+ const Tt = {
750
+ serverOrigin: `http://localhost:${vt}`,
751
751
  defaultRoomKey: "dev-room",
752
- cdnBase: xa
752
+ cdnBase: Sa
753
753
  };
754
- let Ue = { ...Ct };
755
- function Go(e) {
754
+ let $e = { ...Tt };
755
+ function Ko(e) {
756
756
  const t = Object.fromEntries(
757
757
  Object.entries(e).filter(([a, n]) => n !== void 0)
758
758
  );
759
- Ue = { ...Ue, ...t }, Ao({ cdnBase: Ue.cdnBase });
759
+ $e = { ...$e, ...t }, No({ cdnBase: $e.cdnBase });
760
760
  }
761
- function Te() {
762
- return Ue;
761
+ function Ce() {
762
+ return $e;
763
763
  }
764
- const Ko = kt(Ct);
765
- function Vo(e) {
764
+ const Vo = wt(Tt);
765
+ function Yo(e) {
766
766
  return e.serverOrigin?.replace(/\/$/, "") || "";
767
767
  }
768
- function $a() {
769
- return Vo(Te());
768
+ function Fa() {
769
+ return Yo(Ce());
770
770
  }
771
- const Fa = kt(null);
772
- function za() {
773
- return pa(Fa);
771
+ const za = wt(null);
772
+ function Wa() {
773
+ return ba(za);
774
774
  }
775
- const Wa = kt(!0);
776
- function Ba() {
777
- const e = pa(Wa);
778
- R(() => {
779
- e && Hn();
775
+ const Ba = wt(!0);
776
+ function Ga() {
777
+ const e = ba(Ba);
778
+ P(() => {
779
+ e && Un();
780
780
  }, [e]);
781
781
  }
782
- function Ga(e) {
782
+ function Ka(e) {
783
783
  return e ? { "--hc-base": e } : {};
784
784
  }
785
- const we = Ge.memo(
785
+ const we = Ke.memo(
786
786
  function({ html: t, as: a = "span", className: n, style: o }) {
787
- return Ge.createElement(a, { className: n, style: o, dangerouslySetInnerHTML: { __html: t } });
787
+ return Ke.createElement(a, { className: n, style: o, dangerouslySetInnerHTML: { __html: t } });
788
788
  },
789
789
  (e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
790
790
  );
791
- function Yo(e, t) {
792
- R(() => {
791
+ function Jo(e, t) {
792
+ P(() => {
793
793
  const a = e.current;
794
794
  if (!a || !t || typeof IntersectionObserver > "u") return;
795
795
  const n = new IntersectionObserver(([o]) => {
@@ -804,7 +804,7 @@ const oe = {
804
804
  ANON_KEY: "watchparty_preferences",
805
805
  DEBUG_FLAG: "wp:debug",
806
806
  REPORT_LOGS_FLAG: "wp:reportLogs",
807
- /** The emoji this browser reacted with, most recent first (lib/emoji.ts). */
807
+ /** RETIRED: recent emoji now live in prefs (lib/recentEmoji.ts); read once to carry them over, then deleted. */
808
808
  RECENT_EMOJI: "wp:recentEmoji",
809
809
  voteKey: (e, t, a) => `watchparty_vote:${e}:${t}:${a}`
810
810
  };
@@ -822,7 +822,7 @@ function B(e) {
822
822
  return null;
823
823
  }
824
824
  }
825
- function ot(e, t) {
825
+ function Ct(e, t) {
826
826
  try {
827
827
  const a = nt();
828
828
  return a ? (a.setItem(e, t), !0) : !1;
@@ -830,7 +830,7 @@ function ot(e, t) {
830
830
  return !1;
831
831
  }
832
832
  }
833
- function Jo() {
833
+ function Xo() {
834
834
  try {
835
835
  const e = nt();
836
836
  if (!e) return [];
@@ -844,51 +844,51 @@ function Jo() {
844
844
  return [];
845
845
  }
846
846
  }
847
- function Ve(e) {
847
+ function ke(e) {
848
848
  try {
849
849
  nt()?.removeItem(e);
850
850
  } catch {
851
851
  }
852
852
  }
853
- function Xo(e) {
853
+ function Qo(e) {
854
854
  const t = B(e);
855
855
  return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
856
856
  }
857
- const Ka = /* @__PURE__ */ new Map();
858
- let Va = !1;
859
- function rt(e, t) {
860
- Ka.set(e, t), Va && Ya(e, t);
857
+ const Va = /* @__PURE__ */ new Map();
858
+ let Ya = !1;
859
+ function ot(e, t) {
860
+ Va.set(e, t), Ya && Ja(e, t);
861
861
  }
862
- function Qo() {
863
- Va = !0;
864
- for (const [e, t] of Ka) Ya(e, t);
862
+ function Zo() {
863
+ Ya = !0;
864
+ for (const [e, t] of Va) Ja(e, t);
865
865
  }
866
- function Ya(e, t) {
866
+ function Ja(e, t) {
867
867
  typeof window > "u" || (window[e] = t);
868
868
  }
869
- const be = [], Zo = 500;
870
- let $e = [], bt = null;
871
- const er = 1e3, tr = 200;
872
- let yt = null;
873
- function Ja(e) {
874
- yt = e;
869
+ const be = [], er = 500;
870
+ let Fe = [], ht = null;
871
+ const tr = 1e3, ar = 200;
872
+ let pt = null;
873
+ function Xa(e) {
874
+ pt = e;
875
875
  }
876
- function Xa() {
876
+ function Qa() {
877
877
  return B(oe.REPORT_LOGS_FLAG) === "true";
878
878
  }
879
- function ar() {
879
+ function nr() {
880
880
  if (typeof window > "u") return !1;
881
881
  if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
882
882
  const t = B(oe.DEBUG_FLAG);
883
883
  return t !== null && t !== "false";
884
884
  }
885
- function nr() {
885
+ function or() {
886
886
  const e = B(oe.DEBUG_FLAG);
887
887
  if (!e || e === "true") return null;
888
888
  const t = e.split(",").map((a) => a.trim().toLowerCase()).filter(Boolean);
889
889
  return t.length > 0 ? new Set(t) : null;
890
890
  }
891
- function or() {
891
+ function rr() {
892
892
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
893
893
  hour12: !1,
894
894
  hour: "2-digit",
@@ -897,24 +897,24 @@ function or() {
897
897
  fractionalSecondDigits: 3
898
898
  });
899
899
  }
900
- function rr(e) {
901
- be.push(e), be.length > Zo && be.shift();
900
+ function ir(e) {
901
+ be.push(e), be.length > er && be.shift();
902
902
  }
903
- const st = {
903
+ const it = {
904
904
  debug: "color: #64748b; font-weight: normal;",
905
905
  warn: "color: #f59e0b; font-weight: bold;",
906
906
  error: "color: #ef4444; font-weight: bold;",
907
907
  category: "color: #3b82f6; font-weight: bold;",
908
908
  time: "color: #6b7280; font-weight: normal;"
909
909
  };
910
- function ir(e) {
910
+ function fr(e) {
911
911
  try {
912
912
  return JSON.stringify(e);
913
913
  } catch {
914
914
  return "[unserializable]";
915
915
  }
916
916
  }
917
- function It(e, t, a, n, o, r, f) {
917
+ function Et(e, t, a, n, o, r, f) {
918
918
  const s = {
919
919
  level: e,
920
920
  category: o,
@@ -922,47 +922,47 @@ function It(e, t, a, n, o, r, f) {
922
922
  data: f,
923
923
  timestamp: Date.now()
924
924
  };
925
- if (rr(s), (a || Xa()) && zt(s), !n) {
926
- if (!ar()) return;
927
- const m = nr();
928
- if (m && !m.has(o.toLowerCase())) return;
925
+ if (ir(s), (a || Qa()) && Wt(s), !n) {
926
+ if (!nr()) return;
927
+ const u = or();
928
+ if (u && !u.has(o.toLowerCase())) return;
929
929
  }
930
- const c = or(), g = f !== void 0 ? " " + ir(f) : "";
930
+ const c = rr(), g = f !== void 0 ? " " + fr(f) : "";
931
931
  t(
932
932
  `%c[${c}]%c [${o}]%c ${r}${g}`,
933
- st.time,
934
- st.category,
935
- st[e]
933
+ it.time,
934
+ it.category,
935
+ it[e]
936
936
  );
937
937
  }
938
- function b(e, t, a) {
939
- It("debug", console.log, !1, !1, e, t, a);
938
+ function p(e, t, a) {
939
+ Et("debug", console.log, !1, !1, e, t, a);
940
940
  }
941
941
  function D(e, t, a) {
942
- It("warn", console.warn, !0, !1, e, t, a);
942
+ Et("warn", console.warn, !0, !1, e, t, a);
943
943
  }
944
- function Fe(e, t, a) {
945
- It("error", console.error, !0, !0, e, t, a);
944
+ function ze(e, t, a) {
945
+ Et("error", console.error, !0, !0, e, t, a);
946
946
  }
947
- function fr() {
947
+ function sr() {
948
948
  return [...be];
949
949
  }
950
- function sr() {
950
+ function lr() {
951
951
  be.length = 0;
952
952
  }
953
- function lr(e) {
953
+ function cr(e) {
954
954
  const t = e && e.length > 0 ? e.join(",") : "true";
955
- ot(oe.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
955
+ Ct(oe.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
956
956
  }
957
- function cr() {
958
- Ve(oe.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
957
+ function dr() {
958
+ ke(oe.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
959
959
  }
960
- const dr = 1024, ur = 5e4;
961
- function mr(e) {
960
+ const ur = 1024, mr = 5e4;
961
+ function gr(e) {
962
962
  if (e == null) return e;
963
963
  try {
964
964
  const t = JSON.stringify(e);
965
- if (t.length <= dr) return e;
965
+ if (t.length <= ur) return e;
966
966
  if (typeof e == "object" && !Array.isArray(e)) {
967
967
  const a = {};
968
968
  for (const [n, o] of Object.entries(e)) {
@@ -976,31 +976,31 @@ function mr(e) {
976
976
  return "[unserializable]";
977
977
  }
978
978
  }
979
- async function gr() {
980
- if ($e.length === 0) return;
981
- const e = $e;
982
- $e = [], bt = null;
979
+ async function hr() {
980
+ if (Fe.length === 0) return;
981
+ const e = Fe;
982
+ Fe = [], ht = null;
983
983
  try {
984
- let a = Te().serverOrigin || "";
984
+ let a = Ce().serverOrigin || "";
985
985
  if ((a === "/" || !a) && typeof window < "u") {
986
986
  const s = window.location;
987
- (s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(Ta) ? a = `${s.protocol}//${s.hostname}:${xt}` : a = s.origin;
987
+ (s.hostname === "localhost" || s.hostname === "127.0.0.1") && s.port === String(Ca) ? a = `${s.protocol}//${s.hostname}:${vt}` : a = s.origin;
988
988
  }
989
989
  const n = `${a.replace(/\/$/, "")}/api/client-log`, o = e.map((s) => ({
990
990
  level: s.level,
991
991
  category: s.category,
992
992
  message: s.message,
993
- data: mr(s.data),
993
+ data: gr(s.data),
994
994
  timestamp: s.timestamp,
995
995
  url: typeof window < "u" ? window.location.href : void 0,
996
996
  userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
997
- room_key: yt?.room_key,
998
- client_id: yt?.client_id
997
+ room_key: pt?.room_key,
998
+ client_id: pt?.client_id
999
999
  }));
1000
1000
  let r = [], f = 0;
1001
1001
  for (const s of o) {
1002
1002
  const c = JSON.stringify(s).length + 1;
1003
- f + c > ur && r.length > 0 && (await fetch(n, {
1003
+ f + c > mr && r.length > 0 && (await fetch(n, {
1004
1004
  method: "POST",
1005
1005
  headers: { "Content-Type": "application/json" },
1006
1006
  body: JSON.stringify({ logs: r })
@@ -1012,31 +1012,31 @@ async function gr() {
1012
1012
  body: JSON.stringify({ logs: r })
1013
1013
  });
1014
1014
  } catch (t) {
1015
- console.warn("[wp] log flush failed (client logs may be lost):", Ce(t).error);
1015
+ console.warn("[wp] log flush failed (client logs may be lost):", Ee(t).error);
1016
1016
  }
1017
1017
  }
1018
- function zt(e) {
1019
- if ($e.push(e), !bt) {
1020
- const t = Xa() ? tr : er;
1021
- bt = setTimeout(() => {
1022
- gr();
1018
+ function Wt(e) {
1019
+ if (Fe.push(e), !ht) {
1020
+ const t = Qa() ? ar : tr;
1021
+ ht = setTimeout(() => {
1022
+ hr();
1023
1023
  }, t);
1024
1024
  }
1025
1025
  }
1026
- function Ce(e) {
1026
+ function Ee(e) {
1027
1027
  return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
1028
1028
  }
1029
- rt("__wpDebug", {
1030
- enable: lr,
1031
- disable: cr,
1032
- history: fr,
1033
- clear: sr
1029
+ ot("__wpDebug", {
1030
+ enable: cr,
1031
+ disable: dr,
1032
+ history: sr,
1033
+ clear: lr
1034
1034
  });
1035
- const hr = 1280;
1036
- function pr(e) {
1037
- return e.screenWidth < hr ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1035
+ const pr = 1280;
1036
+ function br(e) {
1037
+ return e.screenWidth < pr ? !1 : e.noHoverNoPointer || e.anyHoverNone && e.maxTouchPoints === 0;
1038
1038
  }
1039
- function br() {
1039
+ function yr() {
1040
1040
  const e = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches;
1041
1041
  return {
1042
1042
  noHoverNoPointer: e("(hover: none) and (pointer: none)"),
@@ -1045,57 +1045,57 @@ function br() {
1045
1045
  screenWidth: typeof screen < "u" ? screen.width : 0
1046
1046
  };
1047
1047
  }
1048
- let Wt = null;
1049
- function yr() {
1050
- return Wt ??= pr(br()), Wt;
1048
+ let Bt = null;
1049
+ function _r() {
1050
+ return Bt ??= br(yr()), Bt;
1051
1051
  }
1052
- function Bt() {
1053
- return yr();
1052
+ function Gt() {
1053
+ return _r();
1054
1054
  }
1055
1055
  const ne = {
1056
1056
  resolved: !1,
1057
1057
  userType: "public",
1058
1058
  accountId: null
1059
1059
  };
1060
- function Et() {
1060
+ function It() {
1061
1061
  return ne.accountId ? ne.accountId : ne.resolved && ne.userType === "public" ? "anon" : null;
1062
1062
  }
1063
- function _r(e) {
1063
+ function wr(e) {
1064
1064
  ne.resolved = !0, e.userType && (ne.userType = e.userType), e.userId !== void 0 && (ne.accountId = e.userId && e.userId !== "public" ? e.userId : null);
1065
1065
  }
1066
1066
  function At() {
1067
1067
  return ne.accountId ?? "public";
1068
1068
  }
1069
- function wr() {
1070
- return Et() ?? "unscoped";
1069
+ function kr() {
1070
+ return It() ?? "unscoped";
1071
1071
  }
1072
- function Qa(e) {
1073
- return et(e) ? vo[e] : "var(--color-neutral-bg)";
1072
+ function Za(e) {
1073
+ return et(e) ? xo[e] : "var(--color-neutral-bg)";
1074
1074
  }
1075
- function kr(e) {
1076
- return et(e) ? `${Te().serverOrigin.replace(/\/$/, "")}${Kn(e)}` : void 0;
1075
+ function vr(e) {
1076
+ return et(e) ? `${Ce().serverOrigin.replace(/\/$/, "")}${Vn(e)}` : void 0;
1077
1077
  }
1078
- let ke = null, Me = null;
1079
- function vr() {
1080
- return ke ? Promise.resolve() : Me || (Me = (async () => {
1078
+ let ve = null, De = null;
1079
+ function xr() {
1080
+ return ve ? Promise.resolve() : De || (De = (async () => {
1081
1081
  try {
1082
- const e = Te().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
1082
+ const e = Ce().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
1083
1083
  if (!t.ok) return;
1084
1084
  const a = await t.json();
1085
- ke = a, rt("__DISPLAY_NAMES__", a), b("characters", "Loaded display names", a);
1085
+ ve = a, ot("__DISPLAY_NAMES__", a), p("characters", "Loaded display names", a);
1086
1086
  } catch (e) {
1087
- b("characters", "display names fetch failed (degrading to sprite IDs)", Ce(e));
1087
+ p("characters", "display names fetch failed (degrading to sprite IDs)", Ee(e));
1088
1088
  }
1089
- })(), Me);
1089
+ })(), De);
1090
1090
  }
1091
- function ve(e) {
1092
- return ke?.[e] || e.charAt(0).toUpperCase() + e.slice(1);
1091
+ function xe(e) {
1092
+ return ve?.[e] || e.charAt(0).toUpperCase() + e.slice(1);
1093
1093
  }
1094
1094
  function le(e) {
1095
1095
  const t = e.toLowerCase();
1096
- return Ze.some((a) => a === t) ? !0 : ke ? Object.values(ke).some((a) => a.toLowerCase() === t) : !1;
1096
+ return Ze.some((a) => a === t) ? !0 : ve ? Object.values(ve).some((a) => a.toLowerCase() === t) : !1;
1097
1097
  }
1098
- const xr = i.object({
1098
+ const Sr = i.object({
1099
1099
  // Identity. There is deliberately NO `name`: a person's name is their
1100
1100
  // hadoku key-registry name, resolved by the server from whoami and renamed
1101
1101
  // through hadoku_site's POST /session/name (operator decision 2026-10-08).
@@ -1114,24 +1114,28 @@ const xr = i.object({
1114
1114
  // app's chatCollapsed on purpose.
1115
1115
  chromeChatCollapsed: i.boolean().optional(),
1116
1116
  chromeChatWidth: i.number().optional(),
1117
+ // Recently used emoji, most recent first (lib/recentEmoji.ts). A plain
1118
+ // array: a bound here would fail the whole row's parse, so the cap is
1119
+ // applied on read.
1120
+ recentEmoji: i.array(i.string()).optional(),
1117
1121
  // Media settings
1118
1122
  volume: i.number().min(0).max(1).optional(),
1119
1123
  muted: i.boolean().optional(),
1120
1124
  preferredAudioLang: i.string().optional(),
1121
1125
  subtitlesEnabled: i.boolean().optional(),
1122
1126
  subtitleStyle: i.string().optional()
1123
- }), ye = Xn({
1127
+ }), ye = Qn({
1124
1128
  appId: "watchparty",
1125
- schema: xr
1126
- }), Sr = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1129
+ schema: Sr
1130
+ }), Tr = /* @__PURE__ */ new Set(["theme", "themeMode"]);
1127
1131
  function Ye(e) {
1128
- const t = Et();
1132
+ const t = It();
1129
1133
  return t ? `prefs-cache:${t}:${e}` : null;
1130
1134
  }
1131
- function Tr() {
1132
- return Et() === null;
1135
+ function Cr() {
1136
+ return It() === null;
1133
1137
  }
1134
- function Gt(e) {
1138
+ function Kt(e) {
1135
1139
  const t = Ye(e);
1136
1140
  if (!t) return {};
1137
1141
  const a = B(t);
@@ -1142,9 +1146,9 @@ function Gt(e) {
1142
1146
  return {};
1143
1147
  }
1144
1148
  }
1145
- function Cr() {
1149
+ function Er() {
1146
1150
  let e = 0;
1147
- for (const t of Jo()) {
1151
+ for (const t of Xo()) {
1148
1152
  const a = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), n = t === Je || t.startsWith(`${Je}:`) && !t.endsWith(":_serverSynced_v1");
1149
1153
  if (!a && !n) continue;
1150
1154
  const o = B(t);
@@ -1158,18 +1162,18 @@ function Cr() {
1158
1162
  const f = a ? r?.blob : r;
1159
1163
  if (!f || typeof f != "object" || !("name" in f)) continue;
1160
1164
  const { name: s, ...c } = f, g = a ? { ...r, blob: c } : c;
1161
- ot(t, JSON.stringify(g)) && e++;
1165
+ Ct(t, JSON.stringify(g)) && e++;
1162
1166
  }
1163
- return e > 0 && b("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
1167
+ return e > 0 && p("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
1164
1168
  }
1165
- let Za = null, en = null;
1166
- const Kt = /* @__PURE__ */ new Set();
1169
+ let en = null, tn = null;
1170
+ const Vt = /* @__PURE__ */ new Set();
1167
1171
  function Nt() {
1168
- if (Tr())
1169
- return b("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1170
- const e = Gt("portfolio"), t = Gt("watchparty"), a = Object.keys(e).length > 0 ? e : Za ?? {}, n = Object.keys(t).length > 0 ? t : en ?? {}, o = At() || "public";
1171
- if (Kt.has(o))
1172
- return b("preferences", "Loaded (sync, SDK-only after first read)", {
1172
+ if (Cr())
1173
+ return p("preferences", "Boot read deferred — session pending, identity unresolved"), {};
1174
+ const e = Kt("portfolio"), t = Kt("watchparty"), a = Object.keys(e).length > 0 ? e : en ?? {}, n = Object.keys(t).length > 0 ? t : tn ?? {}, o = At() || "public";
1175
+ if (Vt.has(o))
1176
+ return p("preferences", "Loaded (sync, SDK-only after first read)", {
1173
1177
  uid: o,
1174
1178
  sdkThemeKeys: Object.keys(a).length,
1175
1179
  sdkAppKeys: Object.keys(n).length,
@@ -1178,9 +1182,9 @@ function Nt() {
1178
1182
  themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
1179
1183
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1180
1184
  }), { ...n, ...a };
1181
- Kt.add(o);
1182
- const r = an() ?? {}, f = { ...r, ...n, ...a };
1183
- return b("preferences", "Loaded (sync, first read — legacy + SDK)", {
1185
+ Vt.add(o);
1186
+ const r = nn() ?? {}, f = { ...r, ...n, ...a };
1187
+ return p("preferences", "Loaded (sync, first read — legacy + SDK)", {
1184
1188
  uid: o,
1185
1189
  sdkThemeKeys: Object.keys(a).length,
1186
1190
  sdkAppKeys: Object.keys(n).length,
@@ -1189,60 +1193,60 @@ function Nt() {
1189
1193
  appSource: Object.keys(t).length > 0 ? "cache" : "mem"
1190
1194
  }), f;
1191
1195
  }
1192
- let tn = !1;
1196
+ let an = !1;
1193
1197
  function Ir() {
1194
1198
  const e = At();
1195
1199
  return !e || e === "public";
1196
1200
  }
1197
1201
  function J(e, t) {
1198
- 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 });
1202
+ Ir() && (an = !0), Tr.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 })), p("preferences", "Saved (via SDK)", { key: e, value: t });
1199
1203
  }
1200
- let De = null, Vt = !1;
1201
- function Er() {
1202
- return De || (De = (async () => {
1204
+ let Le = null, Yt = !1;
1205
+ function Ar() {
1206
+ return Le || (Le = (async () => {
1203
1207
  if (typeof window > "u") return !1;
1204
1208
  try {
1205
- Vt || (Vt = !0, pe.subscribe((f) => {
1206
- Za = f, Xt("portfolio", f), Qt("theme");
1209
+ Yt || (Yt = !0, pe.subscribe((f) => {
1210
+ en = f, Qt("portfolio", f), Zt("theme");
1207
1211
  }), ye.subscribe((f) => {
1208
- en = f, Xt("watchparty", f), Qt("watchparty");
1212
+ tn = f, Qt("watchparty", f), Zt("watchparty");
1209
1213
  }));
1210
1214
  const [e, t] = await Promise.all([
1211
1215
  pe.read(),
1212
1216
  ye.read()
1213
1217
  ]);
1214
1218
  try {
1215
- const { useAppStore: f } = await Promise.resolve().then(() => fn);
1219
+ const { useAppStore: f } = await Promise.resolve().then(() => ln);
1216
1220
  f.getState().rehydrateFromPrefs();
1217
1221
  } catch (f) {
1218
1222
  D("preferences", "inline rehydrate after SDK read failed", { err: f?.message });
1219
1223
  }
1220
1224
  const a = Ye("portfolio"), n = Ye("watchparty"), o = a ? B(a) : null, r = n ? B(n) : null;
1221
- return b("preferences", "sdk.read", {
1225
+ return p("preferences", "sdk.read", {
1222
1226
  themeKeys: Object.keys(e ?? {}),
1223
1227
  appKeys: Object.keys(t ?? {}),
1224
1228
  // Post-fetch cache state: should be non-zero if SDK wrote it.
1225
1229
  sdkThemeBytesPost: o?.length ?? 0,
1226
1230
  sdkAppBytesPost: r?.length ?? 0
1227
- }), await Ar(e, t), tn ? (b("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1231
+ }), await Nr(e, t), an ? (p("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
1228
1232
  pe.promoteAnonPrefsToUser().catch(() => {
1229
1233
  }),
1230
1234
  ye.promoteAnonPrefsToUser().catch(() => {
1231
1235
  })
1232
- ])) : b("preferences", "Skipping anon promotion — no pre-auth writes this load"), b("preferences", "First-load SDK sync complete"), !0;
1236
+ ])) : p("preferences", "Skipping anon promotion — no pre-auth writes this load"), p("preferences", "First-load SDK sync complete"), !0;
1233
1237
  } catch (e) {
1234
1238
  return D("preferences", "First-load SDK sync failed (non-fatal)", { err: e?.message }), !1;
1235
1239
  }
1236
- })(), De);
1240
+ })(), Le);
1237
1241
  }
1238
1242
  const Je = "watchparty_preferences";
1239
- Cr();
1240
- function _t() {
1243
+ Er();
1244
+ function bt() {
1241
1245
  const e = At();
1242
1246
  return !e || e === "public" ? Je : `${Je}:${e}`;
1243
1247
  }
1244
- function an() {
1245
- const e = B(_t());
1248
+ function nn() {
1249
+ const e = B(bt());
1246
1250
  if (!e) return null;
1247
1251
  try {
1248
1252
  const t = JSON.parse(e);
@@ -1251,21 +1255,21 @@ function an() {
1251
1255
  return null;
1252
1256
  }
1253
1257
  }
1254
- function Yt() {
1255
- Ve(_t()), Ve(`${_t()}:_serverSynced_v1`);
1258
+ function Jt() {
1259
+ ke(bt()), ke(`${bt()}:_serverSynced_v1`);
1256
1260
  }
1257
- async function Ar(e, t) {
1258
- const a = an();
1261
+ async function Nr(e, t) {
1262
+ const a = nn();
1259
1263
  if (!a || Object.keys(a).length === 0) return;
1260
1264
  const n = Object.keys(e ?? {}).length > 0, o = Object.keys(t ?? {}).length > 0, r = {}, f = {};
1261
- for (const [g, m] of Object.entries(a))
1262
- 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));
1265
+ for (const [g, u] of Object.entries(a))
1266
+ n || (g === "theme" && typeof u == "string" ? r.theme = u : g === "themeMode" && (u === "simple" || u === "advanced") && (r.themeMode = u)), o || (g === "chatCollapsed" && typeof u == "boolean" ? f.chatCollapsed = u : g === "floatingChatEnabled" && typeof u == "boolean" ? f.floatingChatEnabled = u : g === "volume" && typeof u == "number" && u >= 0 && u <= 1 ? f.volume = u : g === "muted" && typeof u == "boolean" ? f.muted = u : g === "preferredAudioLang" && typeof u == "string" ? f.preferredAudioLang = u : g === "subtitlesEnabled" && typeof u == "boolean" ? f.subtitlesEnabled = u : g === "subtitleStyle" && typeof u == "string" && (f.subtitleStyle = u));
1263
1267
  const s = Object.keys(r), c = Object.keys(f);
1264
1268
  if (s.length === 0 && c.length === 0) {
1265
- Yt();
1269
+ Jt();
1266
1270
  return;
1267
1271
  }
1268
- b("preferences", "Migrating legacy localStorage prefs to SDK", {
1272
+ p("preferences", "Migrating legacy localStorage prefs to SDK", {
1269
1273
  themeKeys: s,
1270
1274
  appKeys: c,
1271
1275
  sdkHasTheme: n,
@@ -1275,15 +1279,15 @@ async function Ar(e, t) {
1275
1279
  await Promise.all([
1276
1280
  s.length > 0 ? pe.save(r, { scope: "device" }) : Promise.resolve(),
1277
1281
  c.length > 0 ? ye.save(f) : Promise.resolve()
1278
- ]), Yt(), b("preferences", "Legacy migration complete");
1282
+ ]), Jt(), p("preferences", "Legacy migration complete");
1279
1283
  } catch (g) {
1280
1284
  D("preferences", "Legacy migration save failed — will retry next load", {
1281
1285
  err: g?.message
1282
1286
  });
1283
1287
  }
1284
1288
  }
1285
- let Jt = !1;
1286
- function Xt(e, t) {
1289
+ let Xt = !1;
1290
+ function Qt(e, t) {
1287
1291
  const a = Ye(e);
1288
1292
  if (a)
1289
1293
  try {
@@ -1295,15 +1299,15 @@ function Xt(e, t) {
1295
1299
  };
1296
1300
  localStorage.setItem(a, JSON.stringify(n));
1297
1301
  } catch (n) {
1298
- 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)", {
1299
1303
  appId: e,
1300
1304
  err: n?.message,
1301
1305
  name: n?.name
1302
1306
  }));
1303
1307
  }
1304
1308
  }
1305
- function Qt(e) {
1306
- Promise.resolve().then(() => fn).then(({ useAppStore: t }) => {
1309
+ function Zt(e) {
1310
+ Promise.resolve().then(() => ln).then(({ useAppStore: t }) => {
1307
1311
  try {
1308
1312
  t.getState().rehydrateFromPrefs();
1309
1313
  } catch (a) {
@@ -1311,21 +1315,44 @@ function Qt(e) {
1311
1315
  }
1312
1316
  }).catch((t) => D("preferences", "store import failed", { reason: e, err: t?.message }));
1313
1317
  }
1314
- const nn = 320, Xe = 240, jt = 640, Nr = 320, jr = 36, Zt = 16;
1318
+ const on = 24;
1319
+ function yt(e) {
1320
+ if (!Array.isArray(e)) return [];
1321
+ const t = [];
1322
+ for (const a of e)
1323
+ if (typeof a == "string" && a && a.length <= 32 && !t.includes(a) && t.push(a), t.length === on) break;
1324
+ return t;
1325
+ }
1326
+ function jr(e, t) {
1327
+ return [t, ...e.filter((a) => a !== t)].slice(0, on);
1328
+ }
1329
+ function Rr() {
1330
+ const e = B(oe.RECENT_EMOJI);
1331
+ if (!e) return [];
1332
+ try {
1333
+ return yt(JSON.parse(e));
1334
+ } catch {
1335
+ return [];
1336
+ }
1337
+ }
1338
+ function Pr() {
1339
+ ke(oe.RECENT_EMOJI);
1340
+ }
1341
+ const rn = 320, Xe = 240, jt = 640, Mr = 320, Dr = 36, ea = 16;
1315
1342
  function Z(e, t) {
1316
- if (!Number.isFinite(e)) return nn;
1343
+ if (!Number.isFinite(e)) return rn;
1317
1344
  let a = jt;
1318
- 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)));
1345
+ return t !== void 0 && Number.isFinite(t) && t > 0 && (a = Math.min(a, t - Mr)), a = Math.max(a, Xe), Math.round(Math.min(a, Math.max(Xe, e)));
1319
1346
  }
1320
- function ea(e, t, a, n) {
1347
+ function ta(e, t, a, n) {
1321
1348
  return Z(e + (t - a), n);
1322
1349
  }
1323
- function Pr(e, t, a) {
1350
+ function Lr(e, t, a) {
1324
1351
  switch (t) {
1325
1352
  case "ArrowLeft":
1326
- return Z(e + Zt, a);
1353
+ return Z(e + ea, a);
1327
1354
  case "ArrowRight":
1328
- return Z(e - Zt, a);
1355
+ return Z(e - ea, a);
1329
1356
  case "Home":
1330
1357
  return Z(Xe, a);
1331
1358
  case "End":
@@ -1334,14 +1361,14 @@ function Pr(e, t, a) {
1334
1361
  return null;
1335
1362
  }
1336
1363
  }
1337
- function Rr(e, t) {
1338
- return { collapsed: e, width: e ? jr : t };
1364
+ function Or(e, t) {
1365
+ return { collapsed: e, width: e ? Dr : t };
1339
1366
  }
1340
- function on(e, t) {
1367
+ function fn(e, t) {
1341
1368
  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);
1342
1369
  return o.length ? [...t, ...o] : t;
1343
1370
  }
1344
- const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1371
+ const sn = 6e3, G = Nt(), m = Kn((e, t) => ({
1345
1372
  ready: !1,
1346
1373
  name: "",
1347
1374
  sprite: null,
@@ -1352,9 +1379,11 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1352
1379
  replyingTo: null,
1353
1380
  typing: {},
1354
1381
  chatJump: null,
1355
- chatCollapsed: X.chatCollapsed ?? !1,
1356
- chromeChatCollapsed: X.chromeChatCollapsed ?? !1,
1357
- chromeChatWidth: Z(X.chromeChatWidth ?? nn),
1382
+ chatCollapsed: G.chatCollapsed ?? !1,
1383
+ chromeChatCollapsed: G.chromeChatCollapsed ?? !1,
1384
+ chromeChatWidth: Z(G.chromeChatWidth ?? rn),
1385
+ // The account's list, else what this browser kept before it moved to prefs.
1386
+ recentEmoji: G.recentEmoji !== void 0 ? yt(G.recentEmoji) : Rr(),
1358
1387
  // Hardcoded on for everyone — the per-user toggle was removed from the
1359
1388
  // control bar; FloatingChat + toggleFloatingChat code is kept for future
1360
1389
  // re-enablement but the value is no longer user-controllable.
@@ -1366,11 +1395,11 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1366
1395
  bufferState: { isBuffering: !1, bufferedEndMs: 0 },
1367
1396
  toasts: [],
1368
1397
  mediaPrefs: {
1369
- volume: X.volume ?? 1,
1370
- muted: X.muted ?? !1,
1371
- preferredAudioLang: X.preferredAudioLang || "jpn",
1372
- subtitlesEnabled: X.subtitlesEnabled ?? !0,
1373
- subtitleStyle: ["classic", "cinema", "minimal", "contrast"].includes(X.subtitleStyle) ? X.subtitleStyle : "classic"
1398
+ volume: G.volume ?? 1,
1399
+ muted: G.muted ?? !1,
1400
+ preferredAudioLang: G.preferredAudioLang || "jpn",
1401
+ subtitlesEnabled: G.subtitlesEnabled ?? !0,
1402
+ subtitleStyle: ["classic", "cinema", "minimal", "contrast"].includes(G.subtitleStyle) ? G.subtitleStyle : "classic"
1374
1403
  },
1375
1404
  healthSnapshot: null,
1376
1405
  sidebarTab: "chat",
@@ -1390,33 +1419,33 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1390
1419
  gameSettings: null,
1391
1420
  roomKeyType: null,
1392
1421
  setReady: () => {
1393
- b("store", "App ready"), e({ ready: !0 });
1422
+ p("store", "App ready"), e({ ready: !0 });
1394
1423
  },
1395
1424
  setSessionIdentity: (a, n) => {
1396
- b("store", "Session identity set (not persisted)", { name: a, sprite: n }), e({ name: a, sprite: n });
1425
+ p("store", "Session identity set (not persisted)", { name: a, sprite: n }), e({ name: a, sprite: n });
1397
1426
  },
1398
1427
  ensureAutoIdentity: () => e((a) => {
1399
1428
  if (a.name) return {};
1400
1429
  if (a.sprite) {
1401
- const r = ve(a.sprite);
1402
- return b("store", "Auto-identity: deriving name from the requested sprite", { name: r, sprite: a.sprite }), { name: r };
1430
+ const r = xe(a.sprite);
1431
+ return p("store", "Auto-identity: deriving name from the requested sprite", { name: r, sprite: a.sprite }), { name: r };
1403
1432
  }
1404
- const n = Object.values(a.roster).map((r) => r.sprite), o = ka(n, void 0, Ze);
1433
+ const n = Object.values(a.roster).map((r) => r.sprite), o = va(n, void 0, Ze);
1405
1434
  if (o) {
1406
- const r = ve(o);
1407
- return b("store", "Auto-identity assigned", { name: r, sprite: o }), { name: r, sprite: o };
1435
+ const r = xe(o);
1436
+ return p("store", "Auto-identity assigned", { name: r, sprite: o }), { name: r, sprite: o };
1408
1437
  }
1409
1438
  return D("store", "All characters taken, leaving identity unset"), {};
1410
1439
  }),
1411
1440
  ensureMe: (a) => {
1412
- b("store", "Client ID set", { clientId: a }), e((n) => ({ me: { ...n.me, clientId: a } }));
1441
+ p("store", "Client ID set", { clientId: a }), e((n) => ({ me: { ...n.me, clientId: a } }));
1413
1442
  },
1414
1443
  applySnapshot: (a) => e((n) => {
1415
1444
  const o = { ...n.roster };
1416
1445
  if (a.users)
1417
1446
  for (const c of a.users) o[c.clientId] = c;
1418
1447
  const r = a.mediaId !== void 0 ? a.mediaId : n.snapshot.mediaId, f = a.leaderId !== void 0 ? a.leaderId : n.snapshot.leaderId;
1419
- b("store", "Snapshot applied", {
1448
+ p("store", "Snapshot applied", {
1420
1449
  mediaId: r,
1421
1450
  playing: a.playing ?? n.snapshot.playing,
1422
1451
  serverSeq: a.serverSeq ?? n.snapshot.serverSeq,
@@ -1441,22 +1470,22 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1441
1470
  };
1442
1471
  }),
1443
1472
  upsertUser: (a) => {
1444
- b("store", "User upserted", { clientId: a.clientId, name: a.name, isLeader: a.isLeader }), e((n) => ({ roster: { ...n.roster, [a.clientId]: a } }));
1473
+ p("store", "User upserted", { clientId: a.clientId, name: a.name, isLeader: a.isLeader }), e((n) => ({ roster: { ...n.roster, [a.clientId]: a } }));
1445
1474
  },
1446
1475
  removeUser: (a) => {
1447
- b("store", "User removed", { clientId: a }), e((n) => {
1476
+ p("store", "User removed", { clientId: a }), e((n) => {
1448
1477
  const o = { ...n.roster };
1449
1478
  return delete o[a], { roster: o };
1450
1479
  });
1451
1480
  },
1452
1481
  appendChat: (a) => {
1453
- b("chat", "Message appended", { id: a.id, from: a.name, isSystem: a.isSystem }), e((n) => {
1482
+ p("chat", "Message appended", { id: a.id, from: a.name, isSystem: a.isSystem }), e((n) => {
1454
1483
  if (a.isSystem || !(a.clientId in n.typing)) return { chat: [...n.chat, a].slice(-500) };
1455
1484
  const o = { ...n.typing };
1456
1485
  return delete o[a.clientId], { chat: [...n.chat, a].slice(-500), typing: o };
1457
1486
  });
1458
1487
  },
1459
- setChat: (a) => e((n) => ({ chat: on(n.chat, a).slice(-500) })),
1488
+ setChat: (a) => e((n) => ({ chat: fn(n.chat, a).slice(-500) })),
1460
1489
  setReplyingTo: (a) => e(() => ({ replyingTo: a })),
1461
1490
  setReactions: (a, n) => e((o) => {
1462
1491
  const r = o.chat.findIndex((s) => s.id === a);
@@ -1467,12 +1496,12 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1467
1496
  setTyping: (a, n) => e((o) => {
1468
1497
  if (!n && !(a in o.typing)) return {};
1469
1498
  const r = { ...o.typing };
1470
- return n ? r[a] = Date.now() + rn : delete r[a], { typing: r };
1499
+ return n ? r[a] = Date.now() + sn : delete r[a], { typing: r };
1471
1500
  }),
1472
1501
  jumpToMessage: (a) => e(() => ({ chatJump: { id: a, at: Date.now() } })),
1473
1502
  toggleChatCollapsed: () => e((a) => {
1474
1503
  const n = !a.chatCollapsed;
1475
- return Bt() || J("chatCollapsed", n), { chatCollapsed: n };
1504
+ return Gt() || J("chatCollapsed", n), { chatCollapsed: n };
1476
1505
  }),
1477
1506
  applyTvDefaults: () => e(() => ({ chatCollapsed: !0 })),
1478
1507
  toggleChromeChatCollapsed: () => e((a) => {
@@ -1483,6 +1512,10 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1483
1512
  const n = Z(a);
1484
1513
  return J("chromeChatWidth", n), { chromeChatWidth: n };
1485
1514
  }),
1515
+ noteRecentEmoji: (a) => e((n) => {
1516
+ const o = jr(n.recentEmoji, a);
1517
+ return J("recentEmoji", o), Pr(), { recentEmoji: o };
1518
+ }),
1486
1519
  toggleFloatingChat: () => e((a) => {
1487
1520
  const n = !a.floatingChatEnabled;
1488
1521
  return J("floatingChatEnabled", n), { floatingChatEnabled: n };
@@ -1493,7 +1526,7 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1493
1526
  },
1494
1527
  bumpLoadGeneration: () => e((a) => ({ loadGeneration: a.loadGeneration + 1 })),
1495
1528
  updateControlState: (a) => {
1496
- b("store", "updateControlState called", a), e((n) => ({
1529
+ p("store", "updateControlState called", a), e((n) => ({
1497
1530
  snapshot: { ...n.snapshot, ...a },
1498
1531
  // Always update snapshotReceivedAt — any control_broadcast from the
1499
1532
  // server resets the elapsed-time calculation. The old condition
@@ -1513,7 +1546,7 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1513
1546
  return { drift: { rtts: f, offsetMs: s } };
1514
1547
  }),
1515
1548
  pushToast: (a, n) => {
1516
- b("store", "Toast pushed", { kind: a, msg: n }), e((o) => ({ toasts: [...o.toasts, { id: Math.random().toString(36).slice(2), kind: a, msg: n, ts: Date.now() }].slice(-5) }));
1549
+ p("store", "Toast pushed", { kind: a, msg: n }), e((o) => ({ toasts: [...o.toasts, { id: Math.random().toString(36).slice(2), kind: a, msg: n, ts: Date.now() }].slice(-5) }));
1517
1550
  },
1518
1551
  popToast: (a) => e((n) => ({ toasts: n.toasts.filter((o) => o.id !== a) })),
1519
1552
  setReadiness: (a) => e({ readiness: { mediaId: a.mediaId, ready: a.ready, readyCount: a.readyCount, total: a.total } }),
@@ -1563,7 +1596,7 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1563
1596
  moveTierlistItem: (a, n, o) => e((r) => {
1564
1597
  const f = {};
1565
1598
  for (const [s, c] of Object.entries(r.tierlistDraft)) {
1566
- const g = (c ?? []).filter((m) => m !== a);
1599
+ const g = (c ?? []).filter((u) => u !== a);
1567
1600
  g.length > 0 && (f[s] = g);
1568
1601
  }
1569
1602
  if (n !== null) {
@@ -1578,7 +1611,7 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1578
1611
  setRoomKeyType: (a) => e({ roomKeyType: a }),
1579
1612
  rehydrateFromPrefs: () => e((a) => {
1580
1613
  const n = Nt(), o = {};
1581
- 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)) {
1614
+ 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)), n.recentEmoji !== void 0 && (o.recentEmoji = yt(n.recentEmoji)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((s) => n[s] !== void 0)) {
1582
1615
  const s = { ...a.mediaPrefs };
1583
1616
  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;
1584
1617
  }
@@ -1586,92 +1619,92 @@ const rn = 6e3, X = Nt(), h = Gn((e, t) => ({
1586
1619
  }),
1587
1620
  setSidebarTab: (a) => e((n) => n.sidebarTab === a && a !== "chat" ? { sidebarTab: "chat" } : { sidebarTab: a, chatCollapsed: !1 })
1588
1621
  }));
1589
- rt("__ZUSTAND_STORE__", h);
1590
- const fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1622
+ ot("__ZUSTAND_STORE__", m);
1623
+ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1591
1624
  __proto__: null,
1592
- TYPING_EXPIRE_MS: rn,
1593
- mergeHistory: on,
1594
- useAppStore: h
1595
- }, Symbol.toStringTag, { value: "Module" })), Mr = 5e3;
1596
- function Dr(e, t, a) {
1625
+ TYPING_EXPIRE_MS: sn,
1626
+ mergeHistory: fn,
1627
+ useAppStore: m
1628
+ }, Symbol.toStringTag, { value: "Module" })), qr = 5e3;
1629
+ function Hr(e, t, a) {
1597
1630
  return !!e?.some((n) => n.emoji === t && n.by.includes(a));
1598
1631
  }
1599
- function Lr(e, t, a) {
1632
+ function Ur(e, t, a) {
1600
1633
  let n = e ?? [];
1601
- for (const [o, r] of t) n = Vn(n, o, a, r.on) ?? n;
1634
+ for (const [o, r] of t) n = Yn(n, o, a, r.on) ?? n;
1602
1635
  return n;
1603
1636
  }
1604
- function Or(e, t, a, n) {
1637
+ function $r(e, t, a, n) {
1605
1638
  const o = /* @__PURE__ */ new Map();
1606
1639
  for (const [r, f] of t)
1607
- f.expires <= n || Dr(e, r, a) !== f.on && o.set(r, f);
1640
+ f.expires <= n || Hr(e, r, a) !== f.on && o.set(r, f);
1608
1641
  return o;
1609
1642
  }
1610
- const xe = /* @__PURE__ */ new Map();
1611
- function Pt(e, t) {
1612
- 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) {
1613
- xe.delete(e);
1643
+ const Se = /* @__PURE__ */ new Map();
1644
+ function Rt(e, t) {
1645
+ if (t.intents = $r(t.confirmed, t.intents, t.handle, Date.now()), m.getState().setReactions(e, Ur(t.confirmed, t.intents, t.handle)), t.timer && clearTimeout(t.timer), t.timer = null, t.intents.size === 0) {
1646
+ Se.delete(e);
1614
1647
  return;
1615
1648
  }
1616
1649
  const a = Math.min(...[...t.intents.values()].map((n) => n.expires));
1617
1650
  t.timer = setTimeout(() => {
1618
- xe.get(e) === t && Pt(e, t);
1651
+ Se.get(e) === t && Rt(e, t);
1619
1652
  }, Math.max(0, a - Date.now()));
1620
1653
  }
1621
- function qr(e, t, a, n) {
1622
- let o = xe.get(e);
1623
- 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);
1654
+ function Fr(e, t, a, n) {
1655
+ let o = Se.get(e);
1656
+ o || (o = { confirmed: m.getState().chat.find((f) => f.id === e)?.reactions, intents: /* @__PURE__ */ new Map(), handle: n, timer: null }, Se.set(e, o)), o.handle = n, o.intents.delete(t), o.intents.set(t, { on: a, expires: Date.now() + qr }), Rt(e, o);
1624
1657
  }
1625
- function Hr(e, t) {
1626
- const a = xe.get(e);
1658
+ function zr(e, t) {
1659
+ const a = Se.get(e);
1627
1660
  if (!a) {
1628
- h.getState().setReactions(e, t);
1661
+ m.getState().setReactions(e, t);
1629
1662
  return;
1630
1663
  }
1631
- a.confirmed = t, Pt(e, a);
1664
+ a.confirmed = t, Rt(e, a);
1632
1665
  }
1633
- function sn(e) {
1666
+ function cn(e) {
1634
1667
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = new URL(e, t).pathname;
1635
1668
  return `${a.endsWith("/") ? a : `${a}/`}socket.io/`;
1636
1669
  }
1637
- function Ur(e) {
1670
+ function Wr(e) {
1638
1671
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = e.namespace ?? "/chat";
1639
1672
  return {
1640
1673
  url: `${new URL(e.origin, t).origin}${a.startsWith("/") ? a : `/${a}`}`,
1641
- path: e.path ?? sn(e.origin)
1674
+ path: e.path ?? cn(e.origin)
1642
1675
  };
1643
1676
  }
1644
- let Q = null, Y = null, ze = null;
1645
- function ta(e) {
1646
- e && Q && e.origin === Q.origin && e.path === Q.path && e.namespace === Q.namespace || !e && !Q || (cn(), Q = e);
1677
+ let Q = null, X = null, We = null;
1678
+ function aa(e) {
1679
+ e && Q && e.origin === Q.origin && e.path === Q.path && e.namespace === Q.namespace || !e && !Q || (un(), Q = e);
1647
1680
  }
1648
1681
  function Ie() {
1649
1682
  return Q !== null;
1650
1683
  }
1651
- function $r(e) {
1684
+ function Br(e) {
1652
1685
  if (Q)
1653
- if (ze = e, Y)
1654
- Y.connected && Y.emit(S.JOIN, e);
1686
+ if (We = e, X)
1687
+ X.connected && X.emit(S.JOIN, e);
1655
1688
  else {
1656
- const { url: t, path: a } = Ur(Q), n = ht(t, { path: a, transports: ["websocket", "polling"] });
1657
- Y = n, b("chat", "External chat socket", { url: t, path: a }), un(n), n.on(S.ERROR, (o) => {
1689
+ const { url: t, path: a } = Wr(Q), n = mt(t, { path: a, transports: ["websocket", "polling"] });
1690
+ X = n, p("chat", "External chat socket", { url: t, path: a }), gn(n), n.on(S.ERROR, (o) => {
1658
1691
  const r = o?.message || o?.code || "chat error";
1659
- D("chat", `Chat server error: ${r}`, { code: o?.code }), h.getState().pushToast("error", r);
1692
+ D("chat", `Chat server error: ${r}`, { code: o?.code }), m.getState().pushToast("error", r);
1660
1693
  }), n.on("connect", () => {
1661
- ze && n.emit(S.JOIN, ze);
1694
+ We && n.emit(S.JOIN, We);
1662
1695
  }), n.on("connect_error", (o) => D("chat", "Chat connection error", { message: o?.message }));
1663
1696
  }
1664
1697
  }
1665
- function Fr(e) {
1666
- Y?.emit(S.CHAT_SEND, e);
1698
+ function Gr(e) {
1699
+ X?.emit(S.CHAT_SEND, e);
1667
1700
  }
1668
- function ln(e, t) {
1669
- Y?.connected && Y.emit(e, t);
1701
+ function dn(e, t) {
1702
+ X?.connected && X.emit(e, t);
1670
1703
  }
1671
- function cn() {
1672
- ze = null, Y && (Y.disconnect(), Y = null);
1704
+ function un() {
1705
+ We = null, X && (X.disconnect(), X = null);
1673
1706
  }
1674
- function aa(e, t) {
1707
+ function na(e, t) {
1675
1708
  return {
1676
1709
  id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
1677
1710
  clientId: e.client_id,
@@ -1683,15 +1716,15 @@ function aa(e, t) {
1683
1716
  // Attachments arrive from other clients, so the key shape is re-checked
1684
1717
  // here at the boundary rather than trusted at render time. A malformed
1685
1718
  // entry is dropped, not rendered and not allowed near an <img src>.
1686
- images: Array.isArray(e.images) ? e.images.filter((a) => !!a && vt(a.key)).slice(0, ae) : void 0,
1719
+ images: Array.isArray(e.images) ? e.images.filter((a) => !!a && kt(a.key)).slice(0, ae) : void 0,
1687
1720
  isSystem: e.isSystem || !1,
1688
1721
  systemType: e.systemType,
1689
- template: e.isSystem && typeof e.template == "string" && e.template.includes(St) ? e.template : void 0,
1690
- replyTo: typeof e.reply_to == "string" && Aa.test(e.reply_to) ? e.reply_to : void 0,
1691
- reactions: dn(e.reactions)
1722
+ template: e.isSystem && typeof e.template == "string" && e.template.includes(xt) ? e.template : void 0,
1723
+ replyTo: typeof e.reply_to == "string" && Na.test(e.reply_to) ? e.reply_to : void 0,
1724
+ reactions: mn(e.reactions)
1692
1725
  };
1693
1726
  }
1694
- function dn(e) {
1727
+ function mn(e) {
1695
1728
  if (!Array.isArray(e)) return;
1696
1729
  const t = e.filter((a) => {
1697
1730
  const n = a;
@@ -1699,101 +1732,101 @@ function dn(e) {
1699
1732
  });
1700
1733
  return t.length ? t : void 0;
1701
1734
  }
1702
- function un(e, t = () => !0) {
1735
+ function gn(e, t = () => !0) {
1703
1736
  e.on(S.CHAT_BROADCAST, (a) => {
1704
1737
  if (!t()) return;
1705
- const n = { ...aa(a, a.server_seq), live: !0 };
1706
- h.getState().appendChat(n), b("chat", "Message received", n);
1738
+ const n = { ...na(a, a.server_seq), live: !0 };
1739
+ m.getState().appendChat(n), p("chat", "Message received", n);
1707
1740
  }), e.on(S.CHAT_HISTORY, (a) => {
1708
1741
  if (!t() || !a?.messages || !Array.isArray(a.messages)) return;
1709
- const n = a.messages.map((o) => aa(o));
1710
- h.getState().setChat(n), b("chat", "History loaded", { count: n.length });
1742
+ const n = a.messages.map((o) => na(o));
1743
+ m.getState().setChat(n), p("chat", "History loaded", { count: n.length });
1711
1744
  }), e.on(S.CHAT_REACTION, (a) => {
1712
- t() && (!a || typeof a.id != "string" || Hr(a.id, dn(a.reactions) ?? []));
1745
+ t() && (!a || typeof a.id != "string" || zr(a.id, mn(a.reactions) ?? []));
1713
1746
  }), e.on(S.CHAT_TYPING, (a) => {
1714
- t() && (!a || typeof a.client_id != "string" || typeof a.typing != "boolean" || h.getState().setTyping(a.client_id, a.typing));
1747
+ t() && (!a || typeof a.client_id != "string" || typeof a.typing != "boolean" || m.getState().setTyping(a.client_id, a.typing));
1715
1748
  });
1716
1749
  }
1717
- let mn = null;
1718
- function zr(e) {
1719
- mn = e;
1750
+ let hn = null;
1751
+ function Kr(e) {
1752
+ hn = e;
1720
1753
  }
1721
- function Wr(e = mn) {
1754
+ function Vr(e = hn) {
1722
1755
  if (!e) return null;
1723
1756
  const t = typeof window < "u" ? window.location.href : "http://localhost/", a = e.namespace ?? "/room";
1724
1757
  return {
1725
1758
  url: `${new URL(e.origin, t).origin}${a.startsWith("/") ? a : `/${a}`}`,
1726
- path: e.path ?? sn(e.origin)
1759
+ path: e.path ?? cn(e.origin)
1727
1760
  };
1728
1761
  }
1729
- function Br(e) {
1730
- return `${$a()}/media/${e}`.replace(/\\/g, "/");
1762
+ function Yr(e) {
1763
+ return `${Fa()}/media/${e}`.replace(/\\/g, "/");
1731
1764
  }
1732
- function Gr(e, t) {
1733
- return Br(t ?? `${e}/poster.jpg`);
1765
+ function Jr(e, t) {
1766
+ return Yr(t ?? `${e}/poster.jpg`);
1734
1767
  }
1735
- function Kr(e) {
1736
- return `${$a()}${e}`.replace(/\\/g, "/");
1768
+ function Xr(e) {
1769
+ return `${Fa()}${e}`.replace(/\\/g, "/");
1737
1770
  }
1738
- async function Vr(e) {
1771
+ async function Qr(e) {
1739
1772
  try {
1740
- const t = await fetch(Kr("/api/tierlist"));
1773
+ const t = await fetch(Xr("/api/tierlist"));
1741
1774
  if (!t.ok)
1742
1775
  return D("tierlist", "Board fetch failed", { status: t.status }), null;
1743
1776
  const a = await t.json();
1744
- return h.getState().setTierlistSnapshot(a, e), b("tierlist", "Board loaded", {
1777
+ return m.getState().setTierlistSnapshot(a, e), p("tierlist", "Board loaded", {
1745
1778
  items: a.items.length,
1746
1779
  voters: a.voterCount,
1747
1780
  placed: a.placed.length
1748
1781
  }), a;
1749
1782
  } catch (t) {
1750
- return D("tierlist", "Board fetch threw", Ce(t)), null;
1783
+ return D("tierlist", "Board fetch threw", Ee(t)), null;
1751
1784
  }
1752
1785
  }
1753
- let na = !1;
1754
- function Yr() {
1755
- if (na || typeof Image > "u") return;
1756
- const e = h.getState().tierlist;
1786
+ let oa = !1;
1787
+ function Zr() {
1788
+ if (oa || typeof Image > "u") return;
1789
+ const e = m.getState().tierlist;
1757
1790
  if (!(!e || e.items.length === 0)) {
1758
- na = !0;
1791
+ oa = !0;
1759
1792
  for (const t of e.items) {
1760
1793
  const a = new Image();
1761
- a.decoding = "async", a.src = Gr(t.id, t.thumbnail);
1794
+ a.decoding = "async", a.src = Jr(t.id, t.thumbnail);
1762
1795
  }
1763
- b("tierlist", "Warming posters", { count: e.items.length });
1796
+ p("tierlist", "Warming posters", { count: e.items.length });
1764
1797
  }
1765
1798
  }
1766
- function Jr() {
1767
- const e = h.getState(), t = ka(Object.values(e.roster).map((o) => o.sprite), void 0, Ze);
1799
+ function ei() {
1800
+ const e = m.getState(), t = va(Object.values(e.roster).map((o) => o.sprite), void 0, Ze);
1768
1801
  if (!t)
1769
1802
  return D("socket", "sprite_taken: no available sprites to retry with"), null;
1770
- const a = !!e.name && !le(e.name), n = a ? e.name : ve(t);
1771
- 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 };
1803
+ const a = !!e.name && !le(e.name), n = a ? e.name : xe(t);
1804
+ return p("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 };
1772
1805
  }
1773
- function Xr(e) {
1774
- const t = h.getState(), a = e ? t.roster[e] : void 0;
1806
+ function ti(e) {
1807
+ const t = m.getState(), a = e ? t.roster[e] : void 0;
1775
1808
  return !a || !!a.sprite && a.sprite === t.sprite;
1776
1809
  }
1777
- const Qr = "hadoku:name";
1778
- function Zr(e) {
1779
- const t = to(e);
1810
+ const ai = "hadoku:name";
1811
+ function ni(e) {
1812
+ const t = ao(e);
1780
1813
  return et(t) ? t : null;
1781
1814
  }
1782
- async function ei(e = {}) {
1783
- const t = await eo({
1815
+ async function oi(e = {}) {
1816
+ const t = await to({
1784
1817
  ...e,
1785
- onError: (n) => D("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ce(n))
1818
+ onError: (n) => D("avatar", "Avatar settings read failed — keeping the auto-assigned character", Ee(n))
1786
1819
  }), a = et(t) ? t : null;
1787
- return b("avatar", "Requested character from prefs-api", { sprite: a }), a;
1820
+ return p("avatar", "Requested character from prefs-api", { sprite: a }), a;
1788
1821
  }
1789
- function oa(e) {
1822
+ function ra(e) {
1790
1823
  if (!e) return !1;
1791
- const t = h.getState();
1824
+ const t = m.getState();
1792
1825
  if (t.sprite === e) return !1;
1793
- const n = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !le(t.name) ? t.name : ve(e);
1826
+ const n = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !le(t.name) ? t.name : xe(e);
1794
1827
  return t.setSessionIdentity(n, e), !0;
1795
1828
  }
1796
- function ti(e, t, a) {
1829
+ function ri(e, t, a) {
1797
1830
  if (!a) return () => {
1798
1831
  };
1799
1832
  const n = (o) => {
@@ -1802,26 +1835,26 @@ function ti(e, t, a) {
1802
1835
  };
1803
1836
  return a.addEventListener(e, n), () => a.removeEventListener(e, n);
1804
1837
  }
1805
- const ai = () => typeof window > "u" ? void 0 : window;
1806
- function ni(e, t = ai()) {
1807
- return ti(Qr, (a) => {
1838
+ const ii = () => typeof window > "u" ? void 0 : window;
1839
+ function fi(e, t = ii()) {
1840
+ return ri(ai, (a) => {
1808
1841
  typeof a.name == "string" && a.name.trim() && e(a.name);
1809
1842
  }, t);
1810
1843
  }
1811
- const oi = 10;
1812
- function ri(e = typeof window < "u" ? window : void 0) {
1844
+ const si = 10;
1845
+ function li(e = typeof window < "u" ? window : void 0) {
1813
1846
  if (!e) return { framed: !1, depth: 0 };
1814
1847
  try {
1815
1848
  let t = 0, a = e;
1816
- for (; a !== a.parent && t < oi; )
1849
+ for (; a !== a.parent && t < si; )
1817
1850
  t++, a = a.parent;
1818
1851
  return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
1819
1852
  } catch {
1820
1853
  return { framed: !1, depth: 0 };
1821
1854
  }
1822
1855
  }
1823
- const ii = "watchparty_fragment_delivery";
1824
- function fi() {
1856
+ const ci = "watchparty_fragment_delivery";
1857
+ function di() {
1825
1858
  if (typeof window > "u") return null;
1826
1859
  try {
1827
1860
  const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
@@ -1829,169 +1862,169 @@ function fi() {
1829
1862
  if (e === "0" || e === "false") return !1;
1830
1863
  } catch {
1831
1864
  }
1832
- return Xo(ii);
1865
+ return Qo(ci);
1833
1866
  }
1834
- let si = { ...Da }, lt = null;
1835
- const ra = "watchparty_delivery_client_id";
1836
- function li() {
1837
- const e = B(ra);
1867
+ let ui = { ...La }, ft = null;
1868
+ const ia = "watchparty_delivery_client_id";
1869
+ function mi() {
1870
+ const e = B(ia);
1838
1871
  if (e) return e;
1839
1872
  const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
1840
- return ot(ra, t) ? t : "";
1873
+ return Ct(ia, t) ? t : "";
1841
1874
  }
1842
- function ci() {
1843
- return lt === null && (lt = Eo(si, li(), fi())), lt;
1875
+ function gi() {
1876
+ return ft === null && (ft = Ao(ui, mi(), di())), ft;
1844
1877
  }
1845
- function di() {
1846
- return ci();
1878
+ function hi() {
1879
+ return gi();
1847
1880
  }
1848
- let We;
1849
- function gn() {
1850
- return B(Zn) || void 0;
1881
+ let Be;
1882
+ function pn() {
1883
+ return B(eo) || void 0;
1851
1884
  }
1852
- function ui() {
1853
- if (We) return;
1854
- const e = gn();
1885
+ function pi() {
1886
+ if (Be) return;
1887
+ const e = pn();
1855
1888
  if (e) {
1856
- We = e;
1889
+ Be = e;
1857
1890
  return;
1858
1891
  }
1859
- Qn().then((t) => {
1860
- t && (We = t);
1892
+ Zn().then((t) => {
1893
+ t && (Be = t);
1861
1894
  }).catch(() => {
1862
- b("identity", "device id unavailable — joining without one");
1895
+ p("identity", "device id unavailable — joining without one");
1863
1896
  });
1864
1897
  }
1865
- function mi() {
1866
- return We ??= gn();
1898
+ function bi() {
1899
+ return Be ??= pn();
1867
1900
  }
1868
- function gi(e, t) {
1901
+ function yi(e, t) {
1869
1902
  let a = 0;
1870
1903
  for (const n of e.videos) {
1871
1904
  const o = oe.voteKey(t, e.id, n.mediaId);
1872
- globalThis.localStorage?.getItem(o) != null && a++, Ve(o);
1905
+ globalThis.localStorage?.getItem(o) != null && a++, ke(o);
1873
1906
  }
1874
1907
  return a;
1875
1908
  }
1876
- const hi = 2e4, pi = 1e4;
1877
- function bi() {
1909
+ const _i = 2e4, wi = 1e4;
1910
+ function ki() {
1878
1911
  return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
1879
1912
  }
1880
- function yi(e, t) {
1913
+ function vi(e, t) {
1881
1914
  e.lastPongAt = t, e.unansweredSince = null;
1882
1915
  }
1883
- function _i(e, t, a) {
1884
- const n = e.lastTickAt !== null && t - e.lastTickAt > pi;
1885
- return e.lastTickAt = t, a ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > hi : (e.unansweredSince = null, !1);
1916
+ function xi(e, t, a) {
1917
+ const n = e.lastTickAt !== null && t - e.lastTickAt > wi;
1918
+ return e.lastTickAt = t, a ? n || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > _i : (e.unansweredSince = null, !1);
1886
1919
  }
1887
- function wi(e, t) {
1920
+ function Si(e, t) {
1888
1921
  return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
1889
1922
  }
1890
- let C = null, G = null, Be = null, K = null, ee = null;
1891
- const ki = Yn(), de = bi();
1892
- let Le = null, ct = null, ia = 0, Rt = null, Se = !1, Mt = !1, he = !1, hn = null;
1893
- function vi(e) {
1894
- const t = re(), a = h.getState();
1923
+ let C = null, K = null, Ge = null, V = null, ee = null;
1924
+ const Ti = Jn(), de = ki();
1925
+ let Oe = null, st = null, fa = 0, Pt = null, Te = !1, Mt = !1, he = !1, bn = null;
1926
+ function Ci(e) {
1927
+ const t = re(), a = m.getState();
1895
1928
  if (a.me.clientId && a.roster[a.me.clientId])
1896
- 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;
1897
- const n = xi(e);
1898
- return ee = n, Rt = { name: n.name, sprite: n.sprite }, Ie() && $r(n), t.connected ? (b("socket", "Emitting join", n), t.emit(S.JOIN, n)) : t.once("connect", () => {
1899
- b("socket", "Emitting join", n), t.emit(S.JOIN, n);
1929
+ return (e.name || e.sprite) && (p("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(S.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
1930
+ const n = Ei(e);
1931
+ return ee = n, Pt = { name: n.name, sprite: n.sprite }, Ie() && Br(n), t.connected ? (p("socket", "Emitting join", n), t.emit(S.JOIN, n)) : t.once("connect", () => {
1932
+ p("socket", "Emitting join", n), t.emit(S.JOIN, n);
1900
1933
  }), t;
1901
1934
  }
1902
- function xi(e) {
1935
+ function Ei(e) {
1903
1936
  return {
1904
1937
  room_key: e.room_key,
1905
1938
  name: e.name,
1906
1939
  sprite: e.sprite,
1907
1940
  // Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
1908
1941
  // rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
1909
- embed: ri(),
1910
- delivery_arm: di(),
1942
+ embed: li(),
1943
+ delivery_arm: hi(),
1911
1944
  // Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
1912
1945
  // (lastJoinPayload carries it) so a reconnect lands on the same
1913
1946
  // ParticipantId rather than minting a new person.
1914
- device_id: mi(),
1915
- tab_id: ki
1947
+ device_id: bi(),
1948
+ tab_id: Ti
1916
1949
  };
1917
1950
  }
1918
1951
  function re() {
1919
1952
  if (!C) {
1920
- let t = Te().serverOrigin || "/";
1953
+ let t = Ce().serverOrigin || "/";
1921
1954
  if (t === "/" && typeof window < "u") {
1922
1955
  const n = window.location;
1923
- (n.hostname === "localhost" || n.hostname === "127.0.0.1") && n.port === String(Ta) && (t = `${n.protocol}//${n.hostname}:${xt}`, b("socket", "Using dev fallback origin", { origin: t }));
1956
+ (n.hostname === "localhost" || n.hostname === "127.0.0.1") && n.port === String(Ca) && (t = `${n.protocol}//${n.hostname}:${vt}`, p("socket", "Using dev fallback origin", { origin: t }));
1924
1957
  }
1925
- const a = Wr();
1958
+ const a = Vr();
1926
1959
  if (a)
1927
- C = ht(a.url, { path: a.path, transports: ["websocket", "polling"] }), b("socket", "Socket initialized on the room origin", a);
1960
+ C = mt(a.url, { path: a.path, transports: ["websocket", "polling"] }), p("socket", "Socket initialized on the room origin", a);
1928
1961
  else {
1929
1962
  const n = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
1930
- C = ht(n, { path: ro, transports: ["websocket", "polling"] }), b("socket", "Socket initialized", { origin: t });
1963
+ C = mt(n, { path: io, transports: ["websocket", "polling"] }), p("socket", "Socket initialized", { origin: t });
1931
1964
  }
1932
- rt("__SOCKET__", C), K && (clearTimeout(K), K = null), G = null, Be = setInterval(() => {
1933
- if (_i(de, Date.now(), !!C?.connected)) {
1965
+ ot("__SOCKET__", C), V && (clearTimeout(V), V = null), K = null, Ge = setInterval(() => {
1966
+ if (xi(de, Date.now(), !!C?.connected)) {
1934
1967
  D("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
1935
1968
  sid: C?.id,
1936
- lastPongAgeMs: wi(de, Date.now()) ?? null
1937
- }), ct = "pong-watchdog", de.unansweredSince = null, C?.io.engine?.close();
1969
+ lastPongAgeMs: Si(de, Date.now()) ?? null
1970
+ }), st = "pong-watchdog", de.unansweredSince = null, C?.io.engine?.close();
1938
1971
  return;
1939
1972
  }
1940
- Li();
1941
- }, xo), C.on("connect", () => {
1973
+ Ui();
1974
+ }, So), C.on("connect", () => {
1942
1975
  Mt = !1;
1943
1976
  const n = C?.id;
1944
- if (b("socket", "Connected", { id: n, isReconnect: he }), n)
1977
+ if (p("socket", "Connected", { id: n, isReconnect: he }), n)
1945
1978
  try {
1946
- h.getState().ensureMe(n), h.setState((o) => ({ me: { ...o.me, nextClientSeq: 1 } })), b("socket", "Reset client sequence for new connection");
1979
+ m.getState().ensureMe(n), m.setState((o) => ({ me: { ...o.me, nextClientSeq: 1 } })), p("socket", "Reset client sequence for new connection");
1947
1980
  } catch (o) {
1948
- Fe("socket", "Failed to initialize store on connect", { error: o.message, sid: n });
1981
+ ze("socket", "Failed to initialize store on connect", { error: o.message, sid: n });
1949
1982
  }
1950
1983
  if (he && ee) {
1951
- const o = h.getState();
1952
- ia += 1;
1984
+ const o = m.getState();
1985
+ fa += 1;
1953
1986
  const r = {
1954
1987
  ...ee,
1955
1988
  name: o.name,
1956
1989
  sprite: o.sprite,
1957
1990
  reconnect: {
1958
- count: ia,
1959
- reason: (Le?.reason ?? "unknown").slice(0, 64),
1960
- offline_ms: Le ? Math.max(0, Date.now() - Le.at) : 0
1991
+ count: fa,
1992
+ reason: (Oe?.reason ?? "unknown").slice(0, 64),
1993
+ offline_ms: Oe ? Math.max(0, Date.now() - Oe.at) : 0
1961
1994
  }
1962
- }, f = hn;
1963
- if (b("socket", "Re-emitting join after reconnect", { room_key: r.room_key, name: r.name, sprite: r.sprite }), f) {
1995
+ }, f = bn;
1996
+ if (p("socket", "Re-emitting join after reconnect", { room_key: r.room_key, name: r.name, sprite: r.sprite }), f) {
1964
1997
  let s = !1;
1965
1998
  const c = () => {
1966
- 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 }));
1999
+ s || (s = !0, C.off(S.SNAPSHOT, c), C.emit(S.CLIENT_READY, { media_id: f }), p("socket", "Re-emitted client_ready after reconnect snapshot", { mediaId: f }));
1967
2000
  };
1968
2001
  C.on(S.SNAPSHOT, c), setTimeout(() => {
1969
2002
  s || (s = !0, C.off(S.SNAPSHOT, c), D("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: f }));
1970
2003
  }, 1e4);
1971
2004
  }
1972
- Rt = { name: r.name, sprite: r.sprite }, C.emit(S.JOIN, r), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
2005
+ Pt = { name: r.name, sprite: r.sprite }, C.emit(S.JOIN, r), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
1973
2006
  } else he && D("socket", "Reconnected — no join payload, not re-joining any room");
1974
2007
  he = !0;
1975
2008
  }), C.on("disconnect", (n) => {
1976
- Ja(null), Le = { reason: ct ?? n, at: Date.now() }, ct = null, b("socket", "Disconnected", { reason: n });
1977
- }), 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);
2009
+ Xa(null), Oe = { reason: st ?? n, at: Date.now() }, st = null, p("socket", "Disconnected", { reason: n });
2010
+ }), C.on("connect_error", (n) => ze("socket", "Connection error", { message: n?.message })), C.on("reconnect_attempt", (n) => D("socket", "Reconnect attempt", { attempt: n })), C.on("reconnect_failed", () => ze("socket", "Reconnect failed")), Li(C);
1978
2011
  }
1979
2012
  return C;
1980
2013
  }
1981
- function dt(e) {
2014
+ function lt(e) {
1982
2015
  return e.play_state === "playing" || e.playing === !0;
1983
2016
  }
1984
- function Si(e) {
2017
+ function Ii(e) {
1985
2018
  e.on(S.SNAPSHOT, (t) => {
1986
- e.emit(Ra.SYNC), h.getState().applySnapshot({
2019
+ e.emit(Ma.SYNC), m.getState().applySnapshot({
1987
2020
  roomId: t.room_id ?? null,
1988
2021
  mediaId: t.media_id ?? null,
1989
2022
  playheadMs: t.playhead_ms || 0,
1990
- playing: dt(t),
2023
+ playing: lt(t),
1991
2024
  serverSeq: t.server_seq || 0,
1992
2025
  leaderId: t.leader_id || null
1993
- }), h.getState().name || b("socket", "Deferring identity to presence event (snapshot carries no roster)");
1994
- const a = h.getState(), n = C?.id, r = (n ? a.roster[n] : void 0) ?? Rt, f = Jn(
2026
+ }), m.getState().name || p("socket", "Deferring identity to presence event (snapshot carries no roster)");
2027
+ const a = m.getState(), n = C?.id, r = (n ? a.roster[n] : void 0) ?? Pt, f = Xn(
1995
2028
  { name: a.name, avatarId: a.sprite },
1996
2029
  r ? { name: r.name, avatarId: r.sprite ?? null } : void 0,
1997
2030
  // A join that carried no name counts as a default one, so a name that
@@ -2003,28 +2036,28 @@ function Si(e) {
2003
2036
  ...f.name !== void 0 ? { name: f.name } : {},
2004
2037
  ...f.avatarId !== void 0 && !Mt ? { sprite: f.avatarId } : {}
2005
2038
  };
2006
- Object.keys(s).length > 0 && (b("socket", "Identity update on snapshot", s), e.emit(S.IDENTITY_UPDATE, s));
2039
+ Object.keys(s).length > 0 && (p("socket", "Identity update on snapshot", s), e.emit(S.IDENTITY_UPDATE, s));
2007
2040
  }
2008
- b("socket", "Received snapshot", {
2041
+ p("socket", "Received snapshot", {
2009
2042
  mediaId: t.media_id ?? null,
2010
2043
  playheadMs: t.playhead_ms || 0,
2011
- playing: dt(t),
2044
+ playing: lt(t),
2012
2045
  leaderId: t.leader_id || null,
2013
2046
  serverSeq: t.server_seq || 0,
2014
2047
  rosterSize: Object.keys(a.roster).length
2015
- }), ee?.room_key && C?.id && Ja({ room_key: ee.room_key, client_id: C.id });
2048
+ }), ee?.room_key && C?.id && Xa({ room_key: ee.room_key, client_id: C.id });
2016
2049
  }), e.on(S.CONTROL_BROADCAST, (t) => {
2017
- const a = h.getState();
2050
+ const a = m.getState();
2018
2051
  if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
2019
2052
  const n = t.media_id ?? null;
2020
2053
  a.snapshot.mediaId !== n && (a.applySnapshot({ mediaId: n }), n && a.setReadiness({ mediaId: n, ready: !1, readyCount: 0, total: 0 }), a.bumpLoadGeneration());
2021
2054
  }
2022
2055
  a.updateControlState({
2023
2056
  playheadMs: t.playhead_ms,
2024
- playing: dt(t),
2057
+ playing: lt(t),
2025
2058
  serverSeq: t.server_seq,
2026
2059
  leaderId: t.leader_id ?? a.snapshot.leaderId
2027
- }), b("socket", "Control broadcast received", {
2060
+ }), p("socket", "Control broadcast received", {
2028
2061
  kind: t.kind,
2029
2062
  serverSeq: t.server_seq,
2030
2063
  playheadMs: t.playhead_ms,
@@ -2032,23 +2065,23 @@ function Si(e) {
2032
2065
  mediaId: t.media_id
2033
2066
  });
2034
2067
  }), e.on(S.CONTROL_ACK, (t) => {
2035
- typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && b("socket", "Control ack received", t);
2068
+ typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && p("socket", "Control ack received", t);
2036
2069
  }), e.on(S.TIME_PONG, (t) => {
2037
- if (yi(de, Date.now()), G && G.ts) {
2038
- const a = Date.now() - G.ts;
2039
- 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 });
2070
+ if (vi(de, Date.now()), K && K.ts) {
2071
+ const a = Date.now() - K.ts;
2072
+ m.getState().addRttSample(a, t?.server_ts, K.ts), K = null, V && (clearTimeout(V), V = null), p("socket", "Time sync RTT", { rtt: a, offset: m.getState().drift.offsetMs });
2040
2073
  }
2041
2074
  }), e.on(S.READY_STATE, (t) => {
2042
2075
  if (!t) return;
2043
2076
  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;
2044
- h.getState().setReadiness({ mediaId: a, ready: r, readyCount: n, total: o }), b("socket", "Ready state received", { mediaId: a, readyCount: n, total: o, ready: r });
2077
+ m.getState().setReadiness({ mediaId: a, ready: r, readyCount: n, total: o }), p("socket", "Ready state received", { mediaId: a, readyCount: n, total: o, ready: r });
2045
2078
  });
2046
2079
  }
2047
- function Ti(e) {
2048
- const t = Un(e);
2080
+ function Ai(e) {
2081
+ const t = $n(e);
2049
2082
  return t ? { cosmetics: t } : {};
2050
2083
  }
2051
- function Ci(e) {
2084
+ function Ni(e) {
2052
2085
  e.on(S.PRESENCE, (t) => {
2053
2086
  if (!t) return;
2054
2087
  if (Array.isArray(t.users)) {
@@ -2062,91 +2095,91 @@ function Ci(e) {
2062
2095
  isLeader: s.is_leader,
2063
2096
  ...s.registry_name ? { registryName: !0 } : {},
2064
2097
  ...s.avatar_url ? { avatarUrl: s.avatar_url } : {},
2065
- ...Ti(s.cosmetics)
2098
+ ...Ai(s.cosmetics)
2066
2099
  };
2067
- const o = h.getState(), r = C?.id, f = r ? n[r] : void 0;
2100
+ const o = m.getState(), r = C?.id, f = r ? n[r] : void 0;
2068
2101
  if (f?.registryName)
2069
- 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));
2102
+ m.setState({ roster: n }), (f.name !== o.name || f.sprite && f.sprite !== o.sprite) && (p("socket", "Adopting registry name", { from: o.name, to: f.name }), m.getState().setSessionIdentity(f.name, f.sprite ?? o.sprite));
2070
2103
  else if (r && n[r]) {
2071
2104
  const s = n[r].name, c = n[r].sprite;
2072
- if (o.name && !le(o.name) && (n[r].name = o.name), h.setState({ roster: n }), c && c !== o.sprite) {
2073
- const g = o.name && !le(o.name), m = g ? o.name : ve(c);
2074
- 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 });
2105
+ if (o.name && !le(o.name) && (n[r].name = o.name), m.setState({ roster: n }), c && c !== o.sprite) {
2106
+ const g = o.name && !le(o.name), u = g ? o.name : xe(c);
2107
+ p("socket", "Server reassigned sprite", { from: o.sprite, to: c, newName: u, preservingCustomName: g }), m.getState().setSessionIdentity(u, c), u !== s && e.emit(S.IDENTITY_UPDATE, { name: u });
2075
2108
  }
2076
2109
  }
2077
2110
  }
2078
- b("socket", "Received presence update", t);
2079
- const a = h.getState();
2111
+ p("socket", "Received presence update", t);
2112
+ const a = m.getState();
2080
2113
  if (!a.name) {
2081
2114
  a.ensureAutoIdentity?.();
2082
- const n = h.getState();
2083
- 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 }));
2115
+ const n = m.getState();
2116
+ n.name && (p("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 }));
2084
2117
  }
2085
2118
  });
2086
2119
  }
2087
- function Ii(e) {
2120
+ function ji(e) {
2088
2121
  e.on(Pe.STATE, (t) => {
2089
- h.getState().applyPlaylistState({
2122
+ m.getState().applyPlaylistState({
2090
2123
  playlist: t?.playlist ?? null,
2091
2124
  activeIndex: t?.activeIndex ?? null,
2092
2125
  myVotes: t?.myVotes ?? {}
2093
- }), b("playlist", "Playlist state received", { playlistId: t?.playlist?.id ?? null, activeIndex: t?.activeIndex, myVoteCount: Object.keys(t?.myVotes || {}).length });
2126
+ }), p("playlist", "Playlist state received", { playlistId: t?.playlist?.id ?? null, activeIndex: t?.activeIndex, myVoteCount: Object.keys(t?.myVotes || {}).length });
2094
2127
  }), e.on(Pe.VOTE_PROGRESS, (t) => {
2095
- h.getState().setVoteProgress(t?.progress ?? []), b("playlist", "Vote progress", { progressCount: t?.progress?.length });
2128
+ m.getState().setVoteProgress(t?.progress ?? []), p("playlist", "Vote progress", { progressCount: t?.progress?.length });
2096
2129
  }), e.on(Pe.RESULTS, (t) => {
2097
- h.getState().setPlaylistResults(t ?? null), b("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2130
+ m.getState().setPlaylistResults(t ?? null), p("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
2098
2131
  }), e.on(Pe.VOTES_CLEARED, (t) => {
2099
2132
  if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
2100
- const a = gi(
2133
+ const a = yi(
2101
2134
  { id: t.playlistId, videos: t.mediaIds.map((o) => ({ mediaId: o })) },
2102
- wr()
2103
- ), n = h.getState();
2104
- 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 });
2135
+ kr()
2136
+ ), n = m.getState();
2137
+ n.playlist?.id === t.playlistId && n.applyPlaylistState({ playlist: n.playlist, activeIndex: n.activePlaylistIndex, myVotes: {} }), p("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: a });
2105
2138
  });
2106
2139
  }
2107
- function Ei(e) {
2108
- e.on(_o.UPDATED, () => {
2109
- b("tierlist", "Someone saved — refreshing the board"), Vr(!1);
2140
+ function Ri(e) {
2141
+ e.on(wo.UPDATED, () => {
2142
+ p("tierlist", "Someone saved — refreshing the board"), Qr(!1);
2110
2143
  });
2111
2144
  }
2112
- function Ai(e) {
2113
- e.on(wo.STATE, (t) => {
2145
+ function Pi(e) {
2146
+ e.on(ko.STATE, (t) => {
2114
2147
  if (!t || typeof t.active != "boolean") return;
2115
2148
  const a = Array.isArray(t.ready) ? t.ready.filter((n) => typeof n == "string") : [];
2116
- h.getState().setReadyCheckState({ active: t.active, ready: a }), b("ready-check", "State received", { active: t.active, readyCount: a.length });
2149
+ m.getState().setReadyCheckState({ active: t.active, ready: a }), p("ready-check", "State received", { active: t.active, readyCount: a.length });
2117
2150
  });
2118
2151
  }
2119
- function Ni(e) {
2120
- e.on(Ra.ACTIVE, (t) => {
2152
+ function Mi(e) {
2153
+ e.on(Ma.ACTIVE, (t) => {
2121
2154
  const a = typeof t?.gameId == "string" ? t.gameId : null;
2122
- h.getState().setActiveGameId(a), b("game", "game_active", { gameId: a });
2155
+ m.getState().setActiveGameId(a), p("game", "game_active", { gameId: a });
2123
2156
  });
2124
2157
  }
2125
- function ji(e) {
2158
+ function Di(e) {
2126
2159
  e.on(S.HEALTH_SNAPSHOT, (t) => {
2127
- h.getState().setHealthSnapshot(t);
2160
+ m.getState().setHealthSnapshot(t);
2128
2161
  }), e.on(S.BUFFER_STATUS, (t) => {
2129
- h.getState().setBufferStatus(t);
2162
+ m.getState().setBufferStatus(t);
2130
2163
  });
2131
2164
  }
2132
- function Pi(e) {
2133
- Si(e), Ci(e), un(e, () => !Ie()), ji(e), Ii(e), Ei(e), Ai(e), Ni(e), e.on(S.ERROR, (t) => {
2165
+ function Li(e) {
2166
+ Ii(e), Ni(e), gn(e, () => !Ie()), Di(e), ji(e), Ri(e), Pi(e), Mi(e), e.on(S.ERROR, (t) => {
2134
2167
  const a = t?.code || "error/unknown";
2135
2168
  if (a === "conflict" && t?.message === "sprite_held_by_you") {
2136
- Mt = !0, b("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2169
+ Mt = !0, p("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
2137
2170
  return;
2138
2171
  }
2139
2172
  if (a === "conflict" && t?.message === "sprite_taken") {
2140
- if (Xr(C?.id)) {
2141
- b("socket", "sprite_taken: stale, the server already has our sprite");
2173
+ if (ti(C?.id)) {
2174
+ p("socket", "sprite_taken: stale, the server already has our sprite");
2142
2175
  return;
2143
2176
  }
2144
- Se = !0;
2177
+ Te = !0;
2145
2178
  let f;
2146
2179
  try {
2147
- f = Jr();
2180
+ f = ei();
2148
2181
  } finally {
2149
- Se = !1;
2182
+ Te = !1;
2150
2183
  }
2151
2184
  f && e.emit(S.IDENTITY_UPDATE, f);
2152
2185
  return;
@@ -2169,75 +2202,75 @@ function Pi(e) {
2169
2202
  "recap/not_found": "No recap available for the previous episode."
2170
2203
  }[a] || a;
2171
2204
  if (a.startsWith("recap/")) {
2172
- b("socket", `recap unavailable: ${o}`, { code: a }), h.getState().pushToast("info", o);
2205
+ p("socket", `recap unavailable: ${o}`, { code: a }), m.getState().pushToast("info", o);
2173
2206
  return;
2174
2207
  }
2175
- (a.startsWith("auth/") ? D : Fe)("socket", `Server error: ${o}`, { code: a, raw: t }), h.getState().pushToast("error", o);
2208
+ (a.startsWith("auth/") ? D : ze)("socket", `Server error: ${o}`, { code: a, raw: t }), m.getState().pushToast("error", o);
2176
2209
  });
2177
2210
  }
2178
- function Ri(e, t, a) {
2211
+ function Oi(e, t, a) {
2179
2212
  const n = {
2180
2213
  text: e,
2181
2214
  ...t?.length ? { images: t } : {},
2182
2215
  ...a ? { reply_to: a } : {}
2183
2216
  };
2184
- Ie() ? Fr(n) : re().emit(S.CHAT_SEND, n);
2217
+ Ie() ? Gr(n) : re().emit(S.CHAT_SEND, n);
2185
2218
  }
2186
- function Mi(e, t, a) {
2219
+ function qi(e, t, a) {
2187
2220
  const n = { id: e, emoji: t, on: a };
2188
- Ie() ? ln(S.CHAT_REACT, n) : re().emit(S.CHAT_REACT, n);
2221
+ Ie() ? dn(S.CHAT_REACT, n) : re().emit(S.CHAT_REACT, n);
2189
2222
  }
2190
- function Di(e) {
2223
+ function Hi(e) {
2191
2224
  const t = { typing: e };
2192
- Ie() ? ln(S.CHAT_TYPING, t) : C?.connected && C.emit(S.CHAT_TYPING, t);
2225
+ Ie() ? dn(S.CHAT_TYPING, t) : C?.connected && C.emit(S.CHAT_TYPING, t);
2193
2226
  }
2194
- function Li() {
2195
- G || (G = { ts: Date.now() }, re().emit(S.TIME_PING, {}), K = setTimeout(() => {
2196
- G && (b("socket", "Time ping timed out after 10s, clearing inflight"), G = null), K = null;
2227
+ function Ui() {
2228
+ K || (K = { ts: Date.now() }, re().emit(S.TIME_PING, {}), V = setTimeout(() => {
2229
+ K && (p("socket", "Time ping timed out after 10s, clearing inflight"), K = null), V = null;
2197
2230
  }, 1e4));
2198
2231
  }
2199
- function pn(e) {
2200
- const t = h.getState(), a = t.me.clientId;
2232
+ function yn(e) {
2233
+ const t = m.getState(), a = t.me.clientId;
2201
2234
  if (!a || !t.roster[a]) {
2202
- oa(e), b("socket", "Avatar change before join: the join will carry it", { sprite: e });
2235
+ ra(e), p("socket", "Avatar change before join: the join will carry it", { sprite: e });
2203
2236
  return;
2204
2237
  }
2205
- Se = !0;
2238
+ Te = !0;
2206
2239
  try {
2207
- oa(e);
2240
+ ra(e);
2208
2241
  } finally {
2209
- Se = !1;
2242
+ Te = !1;
2210
2243
  }
2211
- const n = h.getState(), o = { avatar: !0 };
2212
- 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);
2244
+ const n = m.getState(), o = { avatar: !0 };
2245
+ n.sprite && n.sprite !== t.sprite && (o.sprite = n.sprite), n.name && n.name !== t.name && (o.name = n.name), p("socket", "Sending avatar change", o), re().emit(S.IDENTITY_UPDATE, o);
2213
2246
  }
2214
- function Oi(e) {
2215
- h.getState().me.clientId && qi(e);
2247
+ function $i(e) {
2248
+ m.getState().me.clientId && Fi(e);
2216
2249
  }
2217
- function qi(e, t) {
2250
+ function Fi(e, t) {
2218
2251
  const a = {};
2219
- e && (a.name = e), !(!a.name && !a.sprite) && (b("socket", "Sending identity update", a), re().emit(S.IDENTITY_UPDATE, a));
2252
+ e && (a.name = e), !(!a.name && !a.sprite) && (p("socket", "Sending identity update", a), re().emit(S.IDENTITY_UPDATE, a));
2220
2253
  }
2221
- let Oe = { name: "", sprite: "" };
2222
- h.subscribe((e, t) => {
2223
- if (e.name === t.name && e.sprite === t.sprite || Se) return;
2254
+ let qe = { name: "", sprite: "" };
2255
+ m.subscribe((e, t) => {
2256
+ if (e.name === t.name && e.sprite === t.sprite || Te) return;
2224
2257
  const a = e.me.clientId;
2225
2258
  if (!a) return;
2226
2259
  const n = e.roster[a];
2227
2260
  if (!n) return;
2228
- 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;
2261
+ const o = !!e.name && !le(e.name) && e.name !== qe.name && (le(n.name || "") || n.name !== e.name), r = !!e.sprite && e.sprite !== qe.sprite && n.sprite !== e.sprite;
2229
2262
  if (!o && !r) return;
2230
2263
  const f = {};
2231
- 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);
2264
+ o && (f.name = e.name, qe.name = e.name), r && (f.sprite = e.sprite, qe.sprite = e.sprite), p("socket", "Identity reassert (store change)", f), C?.connected ? C.emit(S.IDENTITY_UPDATE, f) : re().emit(S.IDENTITY_UPDATE, f);
2232
2265
  });
2233
- function Hi() {
2234
- Be && (clearInterval(Be), Be = null), K && (clearTimeout(K), K = null), G = null, de.unansweredSince = null, de.lastTickAt = null;
2266
+ function zi() {
2267
+ Ge && (clearInterval(Ge), Ge = null), V && (clearTimeout(V), V = null), K = null, de.unansweredSince = null, de.lastTickAt = null;
2235
2268
  }
2236
- function Ui() {
2237
- b("socket", "clearJoinState called", { hadPayload: ee !== null, room_key: ee?.room_key }), ee = null, he = !1, hn = null;
2269
+ function Wi() {
2270
+ p("socket", "clearJoinState called", { hadPayload: ee !== null, room_key: ee?.room_key }), ee = null, he = !1, bn = null;
2238
2271
  }
2239
- function fa() {
2240
- b("socket", "leaveRoom called", { room_key: ee?.room_key }), Ui(), Hi(), cn(), C && (C.disconnect(), C = null), h.setState({
2272
+ function sa() {
2273
+ p("socket", "leaveRoom called", { room_key: ee?.room_key }), Wi(), zi(), un(), C && (C.disconnect(), C = null), m.setState({
2241
2274
  me: { clientId: null, nextClientSeq: 1 },
2242
2275
  roster: {},
2243
2276
  snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
@@ -2255,31 +2288,31 @@ function fa() {
2255
2288
  activeGameId: null
2256
2289
  });
2257
2290
  }
2258
- function $i() {
2259
- b("chat", "Emitting recap_request"), re().emit("recap_request");
2291
+ function Bi() {
2292
+ p("chat", "Emitting recap_request"), re().emit("recap_request");
2260
2293
  }
2261
- function Fi() {
2262
- R(() => {
2263
- const e = no(), t = ao((n, o) => {
2264
- const r = Zr(o);
2265
- b("avatar", "Avatar changed in the settings popout", { sprite: r, source: o.avatar?.source }), pn(r);
2266
- }), a = ni((n) => {
2267
- b("avatar", "Renamed in the settings popout", { name: n }), Oi(n);
2294
+ function Gi() {
2295
+ P(() => {
2296
+ const e = oo(), t = no((n, o) => {
2297
+ const r = ni(o);
2298
+ p("avatar", "Avatar changed in the settings popout", { sprite: r, source: o.avatar?.source }), yn(r);
2299
+ }), a = fi((n) => {
2300
+ p("avatar", "Renamed in the settings popout", { name: n }), $i(n);
2268
2301
  });
2269
2302
  return () => {
2270
2303
  t(), a(), e();
2271
2304
  };
2272
2305
  }, []);
2273
2306
  }
2274
- function zi(e, t) {
2275
- return (t ? zn(t) : null) ?? Qa(e);
2307
+ function Ki(e, t) {
2308
+ return (t ? Wn(t) : null) ?? Za(e);
2276
2309
  }
2277
- function Ee(e, t) {
2278
- return R(() => {
2279
- t && $n(t);
2280
- }, [t]), ba(Fn, () => zi(e, t), () => Qa(e));
2310
+ function Ae(e, t) {
2311
+ return P(() => {
2312
+ t && Fn(t);
2313
+ }, [t]), ya(zn, () => Ki(e, t), () => Za(e));
2281
2314
  }
2282
- function Wi(e, t) {
2315
+ function Vi(e, t) {
2283
2316
  if (t.clientId) {
2284
2317
  const a = e[t.clientId];
2285
2318
  if (a && (!t.author || !a.author || a.author === t.author)) return a;
@@ -2288,8 +2321,8 @@ function Wi(e, t) {
2288
2321
  for (const a of Object.values(e)) if (a.author === t.author) return a;
2289
2322
  }
2290
2323
  }
2291
- function Bi(e, t, a) {
2292
- const n = Wi(e, t);
2324
+ function Yi(e, t, a) {
2325
+ const n = Vi(e, t);
2293
2326
  return n ? {
2294
2327
  name: n.name || a.name,
2295
2328
  // A connection briefly without a character (a reconnect waiting for one to
@@ -2300,11 +2333,11 @@ function Bi(e, t, a) {
2300
2333
  here: !0
2301
2334
  } : { name: a.name, sprite: a.sprite, pictureUrl: a.pictureUrl, here: !1 };
2302
2335
  }
2303
- function Gi(e, t, a) {
2304
- return !t || !a.here ? e : t.split(St).join(a.name);
2336
+ function Ji(e, t, a) {
2337
+ return !t || !a.here ? e : t.split(xt).join(a.name);
2305
2338
  }
2306
- function it(e, t) {
2307
- const a = h((n) => JSON.stringify(Bi(n.roster, e, t)));
2339
+ function rt(e, t) {
2340
+ const a = m((n) => JSON.stringify(Yi(n.roster, e, t)));
2308
2341
  return F(() => JSON.parse(a), [a]);
2309
2342
  }
2310
2343
  function Dt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback: r }) {
@@ -2322,11 +2355,11 @@ function Dt({ sprite: e, url: t, alt: a = "", className: n, style: o, fallback:
2322
2355
  onError: () => s(t)
2323
2356
  }
2324
2357
  );
2325
- const c = kr(e);
2358
+ const c = vr(e);
2326
2359
  return c ? /* @__PURE__ */ l("img", { src: c, alt: a, crossOrigin: "anonymous", className: n, style: o, draggable: !1 }) : /* @__PURE__ */ l(te, { children: r });
2327
2360
  }
2328
- function bn({ sprite: e, url: t, alt: a, worn: n }) {
2329
- return /* @__PURE__ */ _("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
2361
+ function _n({ sprite: e, url: t, alt: a, worn: n }) {
2362
+ return /* @__PURE__ */ w("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
2330
2363
  /* @__PURE__ */ l("span", { className: "hc-pic", children: /* @__PURE__ */ l(
2331
2364
  Dt,
2332
2365
  {
@@ -2337,22 +2370,22 @@ function bn({ sprite: e, url: t, alt: a, worn: n }) {
2337
2370
  fallback: /* @__PURE__ */ l("span", { className: "inline-block w-8 h-8 bg-bg-alt/50 rounded-full flex-shrink-0" })
2338
2371
  }
2339
2372
  ) }),
2340
- n?.overlay && /* @__PURE__ */ l(we, { html: Wn(n), style: { display: "contents" } })
2373
+ n?.overlay && /* @__PURE__ */ l(we, { html: Bn(n), style: { display: "contents" } })
2341
2374
  ] });
2342
2375
  }
2343
- function Ki(e) {
2376
+ function Xi(e) {
2344
2377
  return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
2345
2378
  }
2346
- function Vi({ src: e, title: t, onClose: a }) {
2347
- R(() => {
2379
+ function Qi({ src: e, title: t, onClose: a }) {
2380
+ P(() => {
2348
2381
  const r = (f) => {
2349
2382
  at(f) && (f.stopPropagation(), a());
2350
2383
  };
2351
2384
  return document.addEventListener("keydown", r, !0), () => document.removeEventListener("keydown", r, !0);
2352
2385
  }, [a]);
2353
- const n = za(), o = typeof document > "u" ? null : document.fullscreenElement ?? n ?? document.body;
2354
- return o ? va(
2355
- /* @__PURE__ */ _(
2386
+ const n = Wa(), o = typeof document > "u" ? null : document.fullscreenElement ?? n ?? document.body;
2387
+ return o ? xa(
2388
+ /* @__PURE__ */ w(
2356
2389
  "div",
2357
2390
  {
2358
2391
  className: "fixed inset-0 z-[10000] flex flex-col items-center justify-center bg-black/85 p-6",
@@ -2389,12 +2422,12 @@ function Vi({ src: e, title: t, onClose: a }) {
2389
2422
  o
2390
2423
  ) : null;
2391
2424
  }
2392
- const ut = 240, Yi = 320;
2393
- function Ji({ image: e }) {
2394
- const [t, a] = N(!1), n = Ke(e.key);
2425
+ const ct = 240, Zi = 320;
2426
+ function ef({ image: e }) {
2427
+ const [t, a] = N(!1), n = Ve(e.key);
2395
2428
  if (!n) return null;
2396
- const o = e.w > 0 && e.h > 0, r = o ? Math.min(1, Yi / e.w, ut / e.h) : 1;
2397
- return /* @__PURE__ */ _(te, { children: [
2429
+ const o = e.w > 0 && e.h > 0, r = o ? Math.min(1, Zi / e.w, ct / e.h) : 1;
2430
+ return /* @__PURE__ */ w(te, { children: [
2398
2431
  /* @__PURE__ */ l(
2399
2432
  "a",
2400
2433
  {
@@ -2404,7 +2437,7 @@ function Ji({ image: e }) {
2404
2437
  className: "block max-w-full cursor-zoom-in",
2405
2438
  "data-testid": "chat-image",
2406
2439
  onClick: (f) => {
2407
- Ki(f) && (f.preventDefault(), a(!0));
2440
+ Xi(f) && (f.preventDefault(), a(!0));
2408
2441
  },
2409
2442
  children: /* @__PURE__ */ l(
2410
2443
  "img",
@@ -2416,13 +2449,13 @@ function Ji({ image: e }) {
2416
2449
  width: o ? Math.round(e.w * r) : void 0,
2417
2450
  height: o ? Math.round(e.h * r) : void 0,
2418
2451
  className: "rounded border border-border-light object-contain bg-bg-alt/30",
2419
- style: o ? { aspectRatio: `${e.w} / ${e.h}`, maxWidth: "100%", maxHeight: ut } : { maxWidth: "100%", maxHeight: ut }
2452
+ style: o ? { aspectRatio: `${e.w} / ${e.h}`, maxWidth: "100%", maxHeight: ct } : { maxWidth: "100%", maxHeight: ct }
2420
2453
  }
2421
2454
  )
2422
2455
  }
2423
2456
  ),
2424
2457
  t && /* @__PURE__ */ l(
2425
- Vi,
2458
+ Qi,
2426
2459
  {
2427
2460
  src: n,
2428
2461
  title: e.title,
@@ -2431,13 +2464,13 @@ function Ji({ image: e }) {
2431
2464
  )
2432
2465
  ] });
2433
2466
  }
2434
- function yn({ images: e }) {
2435
- 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(Ji, { image: t }, `${t.key}-${a}`)) }) : null;
2467
+ function wn({ images: e }) {
2468
+ 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(ef, { image: t }, `${t.key}-${a}`)) }) : null;
2436
2469
  }
2437
- function Xi(e, t) {
2470
+ function tf(e, t) {
2438
2471
  return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
2439
2472
  }
2440
- const Qi = [
2473
+ const af = [
2441
2474
  { 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" },
2442
2475
  { 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" },
2443
2476
  { 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" },
@@ -2448,22 +2481,22 @@ const Qi = [
2448
2481
  { 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" },
2449
2482
  { 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" }
2450
2483
  ];
2451
- function Zi(e) {
2484
+ function nf(e) {
2452
2485
  return e.replace(/[^a-z0-9+]+/g, "_").replace(/^_|_$/g, "");
2453
2486
  }
2454
- function ef(e) {
2455
- const [t = "", a = "", n = ""] = e.split(":"), o = Zi(a), r = n ? n.split(",") : [];
2487
+ function of(e) {
2488
+ const [t = "", a = "", n = ""] = e.split(":"), o = nf(a), r = n ? n.split(",") : [];
2456
2489
  return o && !r.includes(o) && r.push(o), { char: String.fromCodePoint(...t.split("-").map((f) => parseInt(f, 16))), name: a, shortcodes: r };
2457
2490
  }
2458
- let sa = null;
2459
- function Ae() {
2460
- return sa ??= Qi.map((e) => ({ id: e.id, label: e.label, emoji: e.data.split("|").map(ef) })), sa;
2491
+ let la = null;
2492
+ function Ne() {
2493
+ return la ??= af.map((e) => ({ id: e.id, label: e.label, emoji: e.data.split("|").map(of) })), la;
2461
2494
  }
2462
2495
  let se = null;
2463
2496
  function Qe(e) {
2464
2497
  if (!se) {
2465
2498
  se = /* @__PURE__ */ new Map();
2466
- for (const t of Ae().flatMap((a) => a.emoji)) {
2499
+ for (const t of Ne().flatMap((a) => a.emoji)) {
2467
2500
  se.set(t.char, t);
2468
2501
  const a = t.char.replace(/\ufe0f/g, "");
2469
2502
  se.has(a) || se.set(a, t);
@@ -2471,7 +2504,7 @@ function Qe(e) {
2471
2504
  }
2472
2505
  return se.get(e) ?? se.get(e.replace(/\ufe0f/g, ""));
2473
2506
  }
2474
- const tf = [
2507
+ const rf = [
2475
2508
  "joy",
2476
2509
  "heart",
2477
2510
  "thumbsup",
@@ -2508,82 +2541,74 @@ const tf = [
2508
2541
  "x",
2509
2542
  "pensive"
2510
2543
  ];
2511
- let la = null;
2512
- function af() {
2513
- return la ??= tf.flatMap((e) => _n(e)?.char ?? []), la;
2544
+ let ca = null;
2545
+ function ff() {
2546
+ return ca ??= rf.flatMap((e) => kn(e)?.char ?? []), ca;
2514
2547
  }
2515
2548
  let ge = null;
2516
- function _n(e) {
2549
+ function kn(e) {
2517
2550
  if (!ge) {
2518
2551
  ge = /* @__PURE__ */ new Map();
2519
- for (const t of Ae().flatMap((a) => a.emoji))
2552
+ for (const t of Ne().flatMap((a) => a.emoji))
2520
2553
  for (const a of t.shortcodes) ge.has(a) || ge.set(a, t);
2521
2554
  }
2522
2555
  return ge.get(e.toLowerCase());
2523
2556
  }
2524
- function nf(e, t = 8) {
2557
+ function sf(e, t = 8) {
2525
2558
  const a = e.toLowerCase();
2526
2559
  if (!a) return [];
2527
2560
  const n = /* @__PURE__ */ new Map();
2528
- for (const s of [...ft(), ...af()]) n.has(s) || n.set(s, n.size);
2561
+ for (const s of [...Lt(), ...ff()]) n.has(s) || n.set(s, n.size);
2529
2562
  const o = (s) => n.get(s.char) ?? n.size, r = [];
2530
2563
  let f = 0;
2531
- for (const s of Ae().flatMap((c) => c.emoji)) {
2564
+ for (const s of Ne().flatMap((c) => c.emoji)) {
2532
2565
  f += 1;
2533
2566
  let c = null;
2534
2567
  for (const g of s.shortcodes) {
2535
- const m = g === a ? 0 : g.startsWith(a) ? 1 : g.split("_").some((v) => v.startsWith(a)) ? 2 : g.includes(a) ? 3 : -1;
2536
- m < 0 || (!c || m < c.rank) && (c = { code: g, rank: m });
2568
+ const u = g === a ? 0 : g.startsWith(a) ? 1 : g.split("_").some((v) => v.startsWith(a)) ? 2 : g.includes(a) ? 3 : -1;
2569
+ u < 0 || (!c || u < c.rank) && (c = { code: g, rank: u });
2537
2570
  }
2538
2571
  c && r.push({ emoji: s, code: c.code, rank: c.rank, order: o(s) * 1e4 + f });
2539
2572
  }
2540
2573
  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 }));
2541
2574
  }
2542
- function of(e, t = 120) {
2575
+ function lf(e, t = 120) {
2543
2576
  const a = e.toLowerCase().trim().split(/\s+/).filter(Boolean);
2544
2577
  if (!a.length) return [];
2545
- const n = Ae().flatMap((c) => c.emoji), o = a.join("_").replace(/^:|:$/g, ""), r = n.filter((c) => {
2578
+ const n = Ne().flatMap((c) => c.emoji), o = a.join("_").replace(/^:|:$/g, ""), r = n.filter((c) => {
2546
2579
  const g = c.name.split(/[\s-]+/);
2547
- return a.every((m) => g.some((v) => v.startsWith(m))) || c.shortcodes.some((m) => m.startsWith(o));
2580
+ return a.every((u) => g.some((v) => v.startsWith(u))) || c.shortcodes.some((u) => u.startsWith(o));
2548
2581
  }), f = a.join(" "), s = (c) => {
2549
2582
  if (c.name === f || c.shortcodes.includes(o)) return 0;
2550
2583
  const g = c.name.split(/[\s-]+/);
2551
- return a.every((m) => g.includes(m)) ? 1 : 2;
2584
+ return a.every((u) => g.includes(u)) ? 1 : 2;
2552
2585
  };
2553
2586
  return r.sort((c, g) => s(c) - s(g)), r.slice(0, t);
2554
2587
  }
2555
- const rf = [
2588
+ const cf = [
2556
2589
  [128077],
2557
2590
  [10084, 65039],
2558
2591
  [128514],
2559
2592
  [128558],
2560
2593
  [128546],
2561
2594
  [128293]
2562
- ].map((e) => String.fromCodePoint(...e)), wn = 24;
2563
- function ft() {
2564
- const e = B(oe.RECENT_EMOJI);
2565
- if (!e) return [];
2566
- try {
2567
- const t = JSON.parse(e);
2568
- return Array.isArray(t) ? t.filter((a) => typeof a == "string").slice(0, wn) : [];
2569
- } catch {
2570
- return [];
2571
- }
2595
+ ].map((e) => String.fromCodePoint(...e));
2596
+ function Lt() {
2597
+ return m.getState().recentEmoji;
2572
2598
  }
2573
- function kn(e) {
2574
- const t = [e, ...ft().filter((a) => a !== e)].slice(0, wn);
2575
- ot(oe.RECENT_EMOJI, JSON.stringify(t));
2599
+ function vn(e) {
2600
+ m.getState().noteRecentEmoji(e);
2576
2601
  }
2577
- function ff(e = 3) {
2578
- const t = [];
2579
- for (const a of [...ft(), ...rf])
2580
- if (t.includes(a) || t.push(a), t.length === e) break;
2581
- return t;
2602
+ function df(e = 3, t = Lt()) {
2603
+ const a = [];
2604
+ for (const n of [...t, ...cf])
2605
+ if (a.includes(n) || a.push(n), a.length === e) break;
2606
+ return a;
2582
2607
  }
2583
- function vn(e, t) {
2608
+ function xn(e, t) {
2584
2609
  return e.by.some((a) => a === t.author || !!t.clientId && a === t.clientId);
2585
2610
  }
2586
- function sf(e, t, a) {
2611
+ function uf(e, t, a) {
2587
2612
  const n = /* @__PURE__ */ new Map();
2588
2613
  for (const s of Object.values(t))
2589
2614
  s.author && n.set(s.author, s.name), n.set(s.clientId, s.name);
@@ -2599,18 +2624,18 @@ function sf(e, t, a) {
2599
2624
  }
2600
2625
  return r && o.unshift("You"), f && o.push(f === 1 ? "1 other" : `${f} others`), o;
2601
2626
  }
2602
- function lf(e, t) {
2627
+ function mf(e, t) {
2603
2628
  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"}`;
2604
2629
  }
2605
2630
  const ce = 8;
2606
- function cf(e) {
2631
+ function gf(e) {
2607
2632
  return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
2608
2633
  }
2609
- function df() {
2610
- const e = za();
2611
- return ba(cf, () => document.fullscreenElement, () => null) ?? e ?? document.body;
2634
+ function hf() {
2635
+ const e = Wa();
2636
+ return ya(gf, () => document.fullscreenElement, () => null) ?? e ?? document.body;
2612
2637
  }
2613
- function uf({
2638
+ function pf({
2614
2639
  anchor: e,
2615
2640
  onClose: t,
2616
2641
  width: a,
@@ -2621,31 +2646,31 @@ function uf({
2621
2646
  role: s = "dialog",
2622
2647
  ariaLabel: c,
2623
2648
  testId: g,
2624
- children: m
2649
+ children: u
2625
2650
  }) {
2626
- const v = df(), x = $(null), [E, P] = N(null), y = M(() => {
2651
+ const v = hf(), x = $(null), [I, R] = N(null), _ = M(() => {
2627
2652
  const d = x.current;
2628
2653
  if (!e || !d) return;
2629
- 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;
2630
- P((H) => H && H.left === L && H.top === O && H.maxHeight === j ? H : { left: L, top: O, maxHeight: j });
2654
+ const y = e.getBoundingClientRect(), h = window.innerWidth, b = window.innerHeight, T = Math.min(a, h - ce * 2), L = Math.min(Math.max(ce, o ? y.right - T : y.left), h - T - ce), O = d.offsetHeight, z = y.top - r - ce, W = b - y.bottom - r - ce, E = n === "top" ? O <= z || z >= W : !(O <= W || W >= z), j = Math.max(120, E ? z : W), A = Math.min(O, j), q = E ? y.top - r - A : y.bottom + r;
2655
+ R((H) => H && H.left === L && H.top === q && H.maxHeight === j ? H : { left: L, top: q, maxHeight: j });
2631
2656
  }, [e, a, o, r, n]);
2632
- return Ut(() => {
2633
- y();
2634
- const d = x.current, u = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => y());
2635
- return u && d && u.observe(d), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0), () => {
2636
- u?.disconnect(), window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0);
2657
+ return $t(() => {
2658
+ _();
2659
+ const d = x.current, y = typeof ResizeObserver > "u" || !d ? null : new ResizeObserver(() => _());
2660
+ return y && d && y.observe(d), window.addEventListener("resize", _), window.addEventListener("scroll", _, !0), () => {
2661
+ y?.disconnect(), window.removeEventListener("resize", _), window.removeEventListener("scroll", _, !0);
2637
2662
  };
2638
- }, [y]), Ut(() => {
2639
- const d = (w) => {
2640
- at(w) && (w.stopPropagation(), t(), e?.focus({ preventScroll: !0 }));
2641
- }, u = (w) => {
2642
- const p = w.target;
2643
- x.current?.contains(p) || e?.contains(p) || t();
2663
+ }, [_]), $t(() => {
2664
+ const d = (h) => {
2665
+ at(h) && (h.stopPropagation(), t(), e?.focus({ preventScroll: !0 }));
2666
+ }, y = (h) => {
2667
+ const b = h.target;
2668
+ x.current?.contains(b) || e?.contains(b) || t();
2644
2669
  };
2645
- return document.addEventListener("keydown", d), document.addEventListener("pointerdown", u, !0), () => {
2646
- document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", u, !0);
2670
+ return document.addEventListener("keydown", d), document.addEventListener("pointerdown", y, !0), () => {
2671
+ document.removeEventListener("keydown", d), document.removeEventListener("pointerdown", y, !0);
2647
2672
  };
2648
- }, [t, e]), va(
2673
+ }, [t, e]), xa(
2649
2674
  /* @__PURE__ */ l(
2650
2675
  "div",
2651
2676
  {
@@ -2656,52 +2681,52 @@ function uf({
2656
2681
  className: `floating-panel ${f}`,
2657
2682
  style: {
2658
2683
  position: "fixed",
2659
- left: E?.left ?? 0,
2660
- top: E?.top ?? 0,
2684
+ left: I?.left ?? 0,
2685
+ top: I?.top ?? 0,
2661
2686
  width: a,
2662
2687
  maxWidth: `calc(100vw - ${ce * 2}px)`,
2663
- maxHeight: E?.maxHeight,
2688
+ maxHeight: I?.maxHeight,
2664
2689
  // Measured before it is shown, so it never flashes at 0,0. Opacity,
2665
2690
  // not visibility: a hidden element cannot take focus, and the panel's
2666
2691
  // content focuses itself on mount (the emoji search, a menu option).
2667
- opacity: E ? 1 : 0,
2668
- pointerEvents: E ? void 0 : "none"
2692
+ opacity: I ? 1 : 0,
2693
+ pointerEvents: I ? void 0 : "none"
2669
2694
  },
2670
- children: m
2695
+ children: u
2671
2696
  }
2672
2697
  ),
2673
2698
  v
2674
2699
  );
2675
2700
  }
2676
- const mf = 340;
2677
- function gf({ anchor: e, onPick: t, onClose: a }) {
2678
- const [n, o] = N(""), [r, f] = N(null), s = $(null), c = $(null), g = F(() => Ae(), []), m = F(
2679
- () => ft().map((d) => Qe(d) ?? { char: d, name: "", shortcodes: [] }).slice(0, 16),
2701
+ const bf = 340;
2702
+ function yf({ anchor: e, onPick: t, onClose: a }) {
2703
+ const [n, o] = N(""), [r, f] = N(null), s = $(null), c = $(null), g = F(() => Ne(), []), u = F(
2704
+ () => Lt().map((d) => Qe(d) ?? { char: d, name: "", shortcodes: [] }).slice(0, 16),
2680
2705
  []
2681
- ), v = F(() => of(n), [n]), x = n.trim().length > 0;
2682
- R(() => {
2706
+ ), v = F(() => lf(n), [n]), x = n.trim().length > 0;
2707
+ P(() => {
2683
2708
  s.current?.focus({ preventScroll: !0 });
2684
2709
  }, []);
2685
- const E = (d, u) => {
2686
- t(u.char), d.shiftKey || a();
2687
- }, P = (d) => {
2688
- const u = c.current, w = u?.querySelector(`[data-emoji-group="${d}"]`);
2689
- u && w && (u.scrollTop = w.offsetTop - u.offsetTop);
2690
- }, y = (d, u) => /* @__PURE__ */ l(
2710
+ const I = (d, y) => {
2711
+ t(y.char), d.shiftKey || a();
2712
+ }, R = (d) => {
2713
+ const y = c.current, h = y?.querySelector(`[data-emoji-group="${d}"]`);
2714
+ y && h && (y.scrollTop = h.offsetTop - y.offsetTop);
2715
+ }, _ = (d, y) => /* @__PURE__ */ l(
2691
2716
  "button",
2692
2717
  {
2693
2718
  type: "button",
2694
2719
  className: "emoji-cell",
2695
- onClick: (w) => E(w, d),
2720
+ onClick: (h) => I(h, d),
2696
2721
  onMouseEnter: () => f(d),
2697
2722
  onFocus: () => f(d),
2698
2723
  "aria-label": d.name || d.char,
2699
2724
  "data-emoji": d.char,
2700
2725
  children: d.char
2701
2726
  },
2702
- u
2727
+ y
2703
2728
  );
2704
- return /* @__PURE__ */ _(uf, { anchor: e, onClose: a, width: mf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
2729
+ return /* @__PURE__ */ w(pf, { anchor: e, onClose: a, width: bf, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
2705
2730
  /* @__PURE__ */ l("div", { className: "emoji-picker-search", children: /* @__PURE__ */ l(
2706
2731
  "input",
2707
2732
  {
@@ -2714,27 +2739,27 @@ function gf({ anchor: e, onPick: t, onClose: a }) {
2714
2739
  "data-testid": "emoji-search"
2715
2740
  }
2716
2741
  ) }),
2717
- !x && /* @__PURE__ */ _("div", { className: "emoji-picker-tabs", role: "tablist", "aria-label": "Emoji categories", children: [
2718
- m.length > 0 && /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => P("recent"), title: "Frequently used", "aria-label": "Frequently used", children: m[0].char }),
2719
- g.map((d) => /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => P(d.id), title: d.label, "aria-label": d.label, children: d.emoji[0].char }, d.id))
2742
+ !x && /* @__PURE__ */ w("div", { className: "emoji-picker-tabs", role: "tablist", "aria-label": "Emoji categories", children: [
2743
+ u.length > 0 && /* @__PURE__ */ l("button", { type: "button", className: "emoji-tab", onClick: () => R("recent"), title: "Frequently used", "aria-label": "Frequently used", children: u[0].char }),
2744
+ 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))
2720
2745
  ] }),
2721
- /* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => f(null), children: x ? v.length ? /* @__PURE__ */ l("div", { className: "emoji-grid", children: v.map((d) => y(d, d.char)) }) : /* @__PURE__ */ _("p", { className: "emoji-picker-empty", children: [
2746
+ /* @__PURE__ */ l("div", { ref: c, className: "emoji-picker-body", onMouseLeave: () => f(null), children: x ? v.length ? /* @__PURE__ */ l("div", { className: "emoji-grid", children: v.map((d) => _(d, d.char)) }) : /* @__PURE__ */ w("p", { className: "emoji-picker-empty", children: [
2722
2747
  "No emoji match “",
2723
2748
  n.trim(),
2724
2749
  "”"
2725
- ] }) : /* @__PURE__ */ _(te, { children: [
2726
- m.length > 0 && /* @__PURE__ */ _("section", { "data-emoji-group": "recent", children: [
2750
+ ] }) : /* @__PURE__ */ w(te, { children: [
2751
+ u.length > 0 && /* @__PURE__ */ w("section", { "data-emoji-group": "recent", children: [
2727
2752
  /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: "Frequently used" }),
2728
- /* @__PURE__ */ l("div", { className: "emoji-grid", children: m.map((d) => y(d, `r-${d.char}`)) })
2753
+ /* @__PURE__ */ l("div", { className: "emoji-grid", children: u.map((d) => _(d, `r-${d.char}`)) })
2729
2754
  ] }),
2730
- g.map((d) => /* @__PURE__ */ _("section", { "data-emoji-group": d.id, className: "emoji-section", children: [
2755
+ g.map((d) => /* @__PURE__ */ w("section", { "data-emoji-group": d.id, className: "emoji-section", children: [
2731
2756
  /* @__PURE__ */ l("h4", { className: "emoji-section-label", children: d.label }),
2732
- /* @__PURE__ */ l("div", { className: "emoji-grid", children: d.emoji.map((u) => y(u, u.char)) })
2757
+ /* @__PURE__ */ l("div", { className: "emoji-grid", children: d.emoji.map((y) => _(y, y.char)) })
2733
2758
  ] }, d.id))
2734
2759
  ] }) }),
2735
- /* @__PURE__ */ l("div", { className: "emoji-picker-footer", "aria-hidden": "true", children: r ? /* @__PURE__ */ _(te, { children: [
2760
+ /* @__PURE__ */ l("div", { className: "emoji-picker-footer", "aria-hidden": "true", children: r ? /* @__PURE__ */ w(te, { children: [
2736
2761
  /* @__PURE__ */ l("span", { className: "emoji-picker-footer-char", children: r.char }),
2737
- /* @__PURE__ */ _("span", { className: "emoji-picker-footer-name", children: [
2762
+ /* @__PURE__ */ w("span", { className: "emoji-picker-footer-name", children: [
2738
2763
  ":",
2739
2764
  r.shortcodes[0] ?? r.name.replace(/\s+/g, "_"),
2740
2765
  ":"
@@ -2742,127 +2767,127 @@ function gf({ anchor: e, onPick: t, onClose: a }) {
2742
2767
  ] }) : null })
2743
2768
  ] });
2744
2769
  }
2745
- function hf({ className: e = "w-4 h-4" }) {
2746
- return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2770
+ function _f({ className: e = "w-4 h-4" }) {
2771
+ return /* @__PURE__ */ w("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2747
2772
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
2748
2773
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
2749
2774
  ] });
2750
2775
  }
2751
- function pf({ className: e = "w-4 h-4" }) {
2752
- return /* @__PURE__ */ _("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2776
+ function wf({ className: e = "w-4 h-4" }) {
2777
+ return /* @__PURE__ */ w("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
2753
2778
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
2754
2779
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
2755
2780
  ] });
2756
2781
  }
2757
- function bf({ className: e = "w-5 h-5" }) {
2782
+ function kf({ className: e = "w-5 h-5" }) {
2758
2783
  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" }) });
2759
2784
  }
2760
- function xn({ className: e = "w-4 h-4" }) {
2761
- return /* @__PURE__ */ _("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2785
+ function Sn({ className: e = "w-4 h-4" }) {
2786
+ return /* @__PURE__ */ w("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2762
2787
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20.5 12.5A8.5 8.5 0 1111.5 3.5" }),
2763
2788
  /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M8.5 14.5a4 4 0 007 0" }),
2764
2789
  /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M9 9.5h.01M14 9.5h.01", strokeWidth: 2.6 }),
2765
2790
  /* @__PURE__ */ l("path", { strokeLinecap: "round", d: "M19 2v6M16 5h6" })
2766
2791
  ] });
2767
2792
  }
2768
- function yf({ className: e = "w-4 h-4" }) {
2769
- return /* @__PURE__ */ _("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2793
+ function vf({ className: e = "w-4 h-4" }) {
2794
+ return /* @__PURE__ */ w("svg", { className: e, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
2770
2795
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M10 7L4 12l6 5" }),
2771
2796
  /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 12h9a7 7 0 017 7" })
2772
2797
  ] });
2773
2798
  }
2774
- function mt(e) {
2799
+ function dt(e) {
2775
2800
  return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
2776
2801
  }
2777
- const _f = Ge.memo(function({ message: t }) {
2778
- const a = h((u) => u.me.clientId), n = h((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), o = Xi(t, { clientId: a, author: n }), r = it(
2802
+ const xf = Ke.memo(function({ message: t }) {
2803
+ const a = m((h) => h.me.clientId), n = m((h) => h.me.clientId ? h.roster[h.me.clientId]?.author : void 0), o = tf(t, { clientId: a, author: n }), r = rt(
2779
2804
  { clientId: t.clientId, author: t.author },
2780
2805
  { name: t.name, sprite: t.sprite }
2781
- ), f = Ee(r.sprite, r.pictureUrl), s = t.isSystem ? void 0 : r.cosmetics, c = $(null);
2782
- Yo(c, !!s);
2806
+ ), f = Ae(r.sprite, r.pictureUrl), s = t.isSystem ? void 0 : r.cosmetics, c = $(null);
2807
+ Jo(c, !!s);
2783
2808
  const [g] = N(
2784
- () => t.live && t.text ? _a(t.text, s) : null
2785
- ), [m, v] = N(!1), [x, E] = N(null), P = h((u) => u.setReplyingTo);
2809
+ () => t.live && t.text ? wa(t.text, s) : null
2810
+ ), [u, v] = N(!1), [x, I] = N(null), R = m((h) => h.setReplyingTo), _ = m((h) => h.recentEmoji);
2786
2811
  if (t.isSystem && t.systemType === "recap")
2787
- 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: [
2788
- /* @__PURE__ */ _("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
2812
+ return /* @__PURE__ */ l("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ w("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
2813
+ /* @__PURE__ */ w("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
2789
2814
  "Recap",
2790
- /* @__PURE__ */ l("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: mt(t.ts) })
2815
+ /* @__PURE__ */ l("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: dt(t.ts) })
2791
2816
  ] }),
2792
2817
  /* @__PURE__ */ l("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: t.text })
2793
2818
  ] }) });
2794
2819
  if (t.isSystem)
2795
- return /* @__PURE__ */ _("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
2796
- Gi(t.text, t.template, r),
2797
- /* @__PURE__ */ l("span", { className: "ml-1 text-[10px] opacity-50", children: mt(t.ts) })
2820
+ return /* @__PURE__ */ w("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
2821
+ Ji(t.text, t.template, r),
2822
+ /* @__PURE__ */ l("span", { className: "ml-1 text-[10px] opacity-50", children: dt(t.ts) })
2798
2823
  ] });
2799
- const y = { clientId: a, author: n }, d = (u) => {
2800
- const w = t.reactions?.find((L) => L.emoji === u), p = !(w && vn(w, y));
2801
- p && kn(u);
2802
- const T = n ?? a;
2803
- T && qr(t.id, u, p, T), Mi(t.id, u, p);
2824
+ const d = { clientId: a, author: n }, y = (h) => {
2825
+ const b = t.reactions?.find((O) => O.emoji === h), T = !(b && xn(b, d));
2826
+ T && vn(h);
2827
+ const L = n ?? a;
2828
+ L && Fr(t.id, h, T, L), qi(t.id, h, T);
2804
2829
  };
2805
- return /* @__PURE__ */ _(
2830
+ return /* @__PURE__ */ w(
2806
2831
  "div",
2807
2832
  {
2808
2833
  ref: c,
2809
- style: Ga(f),
2834
+ style: Ka(f),
2810
2835
  "data-msg-id": t.id,
2811
2836
  className: `chat-msg px-2 py-1 ${o ? "chat-msg-own" : ""}`,
2812
2837
  onMouseEnter: () => v(!0),
2813
2838
  onMouseLeave: () => v(!1),
2814
2839
  onFocus: () => v(!0),
2815
- onBlur: (u) => {
2816
- u.currentTarget.contains(u.relatedTarget) || v(!1);
2840
+ onBlur: (h) => {
2841
+ h.currentTarget.contains(h.relatedTarget) || v(!1);
2817
2842
  },
2818
- "data-active": m || x ? "true" : void 0,
2843
+ "data-active": u || x ? "true" : void 0,
2819
2844
  children: [
2820
- t.replyTo && /* @__PURE__ */ l(wf, { replyTo: t.replyTo }),
2821
- /* @__PURE__ */ _("div", { className: "flex items-start gap-2", children: [
2822
- /* @__PURE__ */ l(bn, { sprite: r.sprite, url: r.pictureUrl, alt: r.name, worn: s }),
2823
- /* @__PURE__ */ _("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
2824
- 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 }),
2825
- /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: mt(t.ts) }),
2845
+ t.replyTo && /* @__PURE__ */ l(Sf, { replyTo: t.replyTo }),
2846
+ /* @__PURE__ */ w("div", { className: "flex items-start gap-2", children: [
2847
+ /* @__PURE__ */ l(_n, { sprite: r.sprite, url: r.pictureUrl, alt: r.name, worn: s }),
2848
+ /* @__PURE__ */ w("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
2849
+ s ? /* @__PURE__ */ l(we, { html: ka(r.name, s), className: "text-[13px]", style: { color: f } }) : /* @__PURE__ */ l("span", { className: "font-medium text-[13px]", style: { color: f }, children: r.name }),
2850
+ /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: dt(t.ts) }),
2826
2851
  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 })),
2827
- /* @__PURE__ */ l(yn, { images: t.images }),
2828
- t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(kf, { reactions: t.reactions, me: y, onToggle: d, onAdd: E })
2852
+ /* @__PURE__ */ l(wn, { images: t.images }),
2853
+ t.reactions && t.reactions.length > 0 && /* @__PURE__ */ l(Tf, { reactions: t.reactions, me: d, onToggle: y, onAdd: I })
2829
2854
  ] })
2830
2855
  ] }),
2831
- (m || x) && /* @__PURE__ */ _("div", { className: "chat-msg-actions", role: "toolbar", "aria-label": "Message actions", "data-testid": "chat-msg-actions", children: [
2832
- ff().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)),
2856
+ (u || x) && /* @__PURE__ */ w("div", { className: "chat-msg-actions", role: "toolbar", "aria-label": "Message actions", "data-testid": "chat-msg-actions", children: [
2857
+ df(3, _).map((h) => /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn chat-action-emoji", onClick: () => y(h), "aria-label": `React with ${Qe(h)?.name ?? h}`, title: Qe(h)?.name, children: h }, h)),
2833
2858
  /* @__PURE__ */ l(
2834
2859
  "button",
2835
2860
  {
2836
2861
  type: "button",
2837
2862
  className: "chat-action-btn",
2838
- onClick: (u) => E(x ? null : u.currentTarget),
2863
+ onClick: (h) => I(x ? null : h.currentTarget),
2839
2864
  "aria-label": "Add reaction",
2840
2865
  title: "Add reaction",
2841
2866
  "aria-expanded": !!x,
2842
- children: /* @__PURE__ */ l(xn, {})
2867
+ children: /* @__PURE__ */ l(Sn, {})
2843
2868
  }
2844
2869
  ),
2845
- /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn", onClick: () => P(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ l(yf, {}) })
2870
+ /* @__PURE__ */ l("button", { type: "button", className: "chat-action-btn", onClick: () => R(t.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ l(vf, {}) })
2846
2871
  ] }),
2847
- x && /* @__PURE__ */ l(gf, { anchor: x, onPick: d, onClose: () => {
2848
- E(null), v(!1);
2872
+ x && /* @__PURE__ */ l(yf, { anchor: x, onPick: y, onClose: () => {
2873
+ I(null), v(!1);
2849
2874
  } })
2850
2875
  ]
2851
2876
  }
2852
2877
  );
2853
2878
  });
2854
- function wf({ replyTo: e }) {
2855
- const t = h((f) => f.chat.find((s) => s.id === e)), a = h((f) => f.jumpToMessage), n = it(
2879
+ function Sf({ replyTo: e }) {
2880
+ const t = m((f) => f.chat.find((s) => s.id === e)), a = m((f) => f.jumpToMessage), n = rt(
2856
2881
  { clientId: t?.clientId ?? "", author: t?.author },
2857
2882
  { name: t?.name ?? "", sprite: t?.sprite ?? null }
2858
- ), o = Ee(n.sprite, n.pictureUrl);
2883
+ ), o = Ae(n.sprite, n.pictureUrl);
2859
2884
  if (!t)
2860
- return /* @__PURE__ */ _("div", { className: "chat-reply-quote", "data-testid": "chat-reply-quote", "data-missing": "true", children: [
2885
+ return /* @__PURE__ */ w("div", { className: "chat-reply-quote", "data-testid": "chat-reply-quote", "data-missing": "true", children: [
2861
2886
  /* @__PURE__ */ l("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
2862
2887
  /* @__PURE__ */ l("span", { className: "chat-reply-text italic", children: "Original message unavailable" })
2863
2888
  ] });
2864
- const r = t.isSystem ? (t.template ?? t.text).split(St).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2865
- return /* @__PURE__ */ _(
2889
+ const r = t.isSystem ? (t.template ?? t.text).split(xt).join(n.name) : t.text || (t.images?.length ? "Image" : "");
2890
+ return /* @__PURE__ */ w(
2866
2891
  "button",
2867
2892
  {
2868
2893
  type: "button",
@@ -2888,12 +2913,12 @@ function wf({ replyTo: e }) {
2888
2913
  }
2889
2914
  );
2890
2915
  }
2891
- function kf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2892
- const o = h((r) => r.roster);
2893
- return /* @__PURE__ */ _("div", { className: "chat-reactions", "data-testid": "chat-reactions", children: [
2916
+ function Tf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2917
+ const o = m((r) => r.roster);
2918
+ return /* @__PURE__ */ w("div", { className: "chat-reactions", "data-testid": "chat-reactions", children: [
2894
2919
  e.map((r) => {
2895
- const f = vn(r, t);
2896
- return /* @__PURE__ */ _(
2920
+ const f = xn(r, t);
2921
+ return /* @__PURE__ */ w(
2897
2922
  "button",
2898
2923
  {
2899
2924
  type: "button",
@@ -2901,7 +2926,7 @@ function kf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2901
2926
  "data-mine": f ? "true" : void 0,
2902
2927
  "aria-pressed": f,
2903
2928
  onClick: () => a(r.emoji),
2904
- title: lf(sf(r, o, t), Qe(r.emoji)?.name),
2929
+ title: mf(uf(r, o, t), Qe(r.emoji)?.name),
2905
2930
  "data-emoji": r.emoji,
2906
2931
  children: [
2907
2932
  /* @__PURE__ */ l("span", { className: "chat-reaction-emoji", children: r.emoji }),
@@ -2911,23 +2936,23 @@ function kf({ reactions: e, me: t, onToggle: a, onAdd: n }) {
2911
2936
  r.emoji
2912
2937
  );
2913
2938
  }),
2914
- /* @__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, {}) })
2939
+ /* @__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(Sn, {}) })
2915
2940
  ] });
2916
2941
  }
2917
- function vf() {
2918
- Ba();
2919
- const e = h((r) => r.chat), t = $(null), a = $(!1), n = M(() => {
2942
+ function Cf() {
2943
+ Ga();
2944
+ const e = m((r) => r.chat), t = $(null), a = $(!1), n = M(() => {
2920
2945
  const r = t.current;
2921
2946
  if (!r) return;
2922
2947
  const { scrollHeight: f, scrollTop: s, clientHeight: c } = r, g = f - s - c;
2923
2948
  a.current = g > 40;
2924
2949
  }, []);
2925
- R(() => {
2950
+ P(() => {
2926
2951
  const r = t.current;
2927
2952
  !r || a.current || (typeof r.scrollTo == "function" ? r.scrollTo({ top: r.scrollHeight, behavior: "smooth" }) : r.scrollTop = r.scrollHeight);
2928
2953
  }, [e.length]);
2929
- const o = h((r) => r.chatJump);
2930
- return R(() => {
2954
+ const o = m((r) => r.chatJump);
2955
+ return P(() => {
2931
2956
  const r = t.current;
2932
2957
  if (!o || !r) return;
2933
2958
  const f = r.querySelector(`[data-msg-id="${o.id}"]`);
@@ -2944,19 +2969,19 @@ function vf() {
2944
2969
  className: "relative flex-1 overflow-y-auto overflow-x-hidden chat-messages pt-3",
2945
2970
  children: e.length === 0 ? /* @__PURE__ */ l("div", { className: "p-4 text-xs text-text-muted text-center", children: "No messages yet. Be the first to say something!" }) : /* @__PURE__ */ l(te, { children: e.map((r, f) => {
2946
2971
  const s = f > 0 ? e[f - 1] : null, c = s && r.ts - s.ts > 1440 * 60 * 1e3;
2947
- return /* @__PURE__ */ _(Ge.Fragment, { children: [
2948
- c && /* @__PURE__ */ _("div", { className: "flex items-center gap-2 px-4 py-2 my-1", children: [
2972
+ return /* @__PURE__ */ w(Ke.Fragment, { children: [
2973
+ c && /* @__PURE__ */ w("div", { className: "flex items-center gap-2 px-4 py-2 my-1", children: [
2949
2974
  /* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" }),
2950
2975
  /* @__PURE__ */ l("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(r.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
2951
2976
  /* @__PURE__ */ l("div", { className: "flex-1 h-px bg-border" })
2952
2977
  ] }),
2953
- /* @__PURE__ */ l(_f, { message: r })
2978
+ /* @__PURE__ */ l(xf, { message: r })
2954
2979
  ] }, r.id);
2955
2980
  }) })
2956
2981
  }
2957
2982
  );
2958
2983
  }
2959
- const Lt = [
2984
+ const Ot = [
2960
2985
  {
2961
2986
  name: "recap",
2962
2987
  description: "Summarise the previous episode of what is loaded",
@@ -2977,12 +3002,12 @@ const Lt = [
2977
3002
  scope: "local"
2978
3003
  }
2979
3004
  ], ue = "/";
2980
- function xf(e) {
3005
+ function Ef(e) {
2981
3006
  if (!e.startsWith(ue)) return null;
2982
3007
  const t = e.slice(ue.length);
2983
3008
  return /\s/.test(t) ? null : t.toLowerCase();
2984
3009
  }
2985
- function Sf(e, t = Lt) {
3010
+ function If(e, t = Ot) {
2986
3011
  const a = e.toLowerCase();
2987
3012
  if (!a) return [...t].sort((o, r) => o.name.localeCompare(r.name));
2988
3013
  const n = [];
@@ -2992,23 +3017,23 @@ function Sf(e, t = Lt) {
2992
3017
  }
2993
3018
  return n.sort((o, r) => o.rank - r.rank || o.cmd.name.localeCompare(r.cmd.name)).map((o) => o.cmd);
2994
3019
  }
2995
- function Tf(e) {
3020
+ function Af(e) {
2996
3021
  return `${ue}${e.name} `;
2997
3022
  }
2998
3023
  function _e(e, t) {
2999
3024
  return t <= 0 ? 0 : (e % t + t) % t;
3000
3025
  }
3001
- function Cf(e, t = Lt) {
3026
+ function Nf(e, t = Ot) {
3002
3027
  const a = e.trim();
3003
3028
  if (!a) return null;
3004
3029
  if (!a.startsWith(ue)) return { kind: "chat", text: a };
3005
3030
  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);
3006
3031
  return s ? { kind: "command", command: s, args: f } : { kind: "chat", text: a };
3007
3032
  }
3008
- function If(e, t) {
3033
+ function jf(e, t) {
3009
3034
  return e.requiresMedia && !t.hasMedia ? `${ue}${e.name} needs an episode loaded.` : null;
3010
3035
  }
3011
- function Ef({
3036
+ function Rf({
3012
3037
  commands: e,
3013
3038
  activeIndex: t,
3014
3039
  hasMedia: a,
@@ -3027,15 +3052,15 @@ function Ef({
3027
3052
  list-none m-0 p-0 py-1 mb-1`,
3028
3053
  children: e.map((f, s) => {
3029
3054
  const c = !!f.requiresMedia && !a, g = s === t;
3030
- return /* @__PURE__ */ _(
3055
+ return /* @__PURE__ */ w(
3031
3056
  "li",
3032
3057
  {
3033
3058
  id: `${r}-opt-${f.name}`,
3034
3059
  role: "option",
3035
3060
  "aria-selected": g,
3036
3061
  "aria-disabled": c,
3037
- onMouseDown: (m) => {
3038
- m.preventDefault(), n(f);
3062
+ onMouseDown: (u) => {
3063
+ u.preventDefault(), n(f);
3039
3064
  },
3040
3065
  onMouseEnter: () => o(s),
3041
3066
  className: `px-3 py-1.5 cursor-pointer flex items-baseline gap-2 ${g ? "bg-bg-alt" : ""} ${c ? "opacity-50" : ""}`,
@@ -3050,8 +3075,8 @@ function Ef({
3050
3075
  }
3051
3076
  );
3052
3077
  }
3053
- const Sn = (e, t) => `${e}-emoji-${t.code}`;
3054
- function Af({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o }) {
3078
+ const Tn = (e, t) => `${e}-emoji-${t.code}`;
3079
+ function Pf({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o }) {
3055
3080
  return e.length === 0 ? null : /* @__PURE__ */ l(
3056
3081
  "ul",
3057
3082
  {
@@ -3062,10 +3087,10 @@ function Af({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o })
3062
3087
  className: `absolute bottom-full left-0 right-0 z-30 max-h-64 overflow-y-auto
3063
3088
  bg-bg-card border border-border-light rounded shadow-lg
3064
3089
  list-none m-0 p-0 py-1 mb-1`,
3065
- children: e.map((r, f) => /* @__PURE__ */ _(
3090
+ children: e.map((r, f) => /* @__PURE__ */ w(
3066
3091
  "li",
3067
3092
  {
3068
- id: Sn(o, r),
3093
+ id: Tn(o, r),
3069
3094
  role: "option",
3070
3095
  "aria-selected": f === t,
3071
3096
  onMouseDown: (s) => {
@@ -3075,7 +3100,7 @@ function Af({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o })
3075
3100
  className: `px-3 py-1 cursor-pointer flex items-center gap-2 ${f === t ? "bg-bg-alt" : ""}`,
3076
3101
  children: [
3077
3102
  /* @__PURE__ */ l("span", { className: "text-lg leading-none shrink-0", "aria-hidden": "true", children: r.emoji.char }),
3078
- /* @__PURE__ */ _("span", { className: "text-sm text-text truncate", children: [
3103
+ /* @__PURE__ */ w("span", { className: "text-sm text-text truncate", children: [
3079
3104
  ":",
3080
3105
  r.code,
3081
3106
  ":"
@@ -3087,54 +3112,54 @@ function Af({ matches: e, activeIndex: t, onPick: a, onHover: n, listboxId: o })
3087
3112
  }
3088
3113
  );
3089
3114
  }
3090
- const Nf = 2, jf = /^[a-z0-9_+-]*$/i;
3091
- function Pf(e, t) {
3115
+ const Mf = 2, Df = /^[a-z0-9_+-]*$/i;
3116
+ function Lf(e, t) {
3092
3117
  const a = e.slice(0, t), n = a.lastIndexOf(":");
3093
3118
  if (n < 0) return null;
3094
3119
  const o = n === 0 ? "" : a[n - 1];
3095
3120
  if (o && !/[\s([{]/.test(o)) return null;
3096
3121
  const r = a.slice(n + 1);
3097
- return r.length < Nf || !jf.test(r) ? null : { query: r.toLowerCase(), start: n };
3122
+ return r.length < Mf || !Df.test(r) ? null : { query: r.toLowerCase(), start: n };
3098
3123
  }
3099
- function Rf(e, t, a, n) {
3124
+ function Of(e, t, a, n) {
3100
3125
  const o = e.slice(a), r = o.startsWith(" ") ? n : `${n} `;
3101
3126
  return { text: e.slice(0, t) + r + o, caret: t + r.length };
3102
3127
  }
3103
- function Mf(e) {
3128
+ function qf(e) {
3104
3129
  let t = -1;
3105
3130
  return e.replace(/:([a-z0-9_+-]+):/gi, (a, n, o) => {
3106
3131
  const r = o === 0 ? "" : e[o - 1];
3107
3132
  if (r && !/[\s([{]/.test(r) && o !== t) return a;
3108
- const f = _n(n);
3133
+ const f = kn(n);
3109
3134
  return f ? (t = o + a.length, f.char) : a;
3110
3135
  });
3111
3136
  }
3112
- function Df(e, t, a) {
3113
- 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, v = F(() => m ? nf(m) : [], [m]), x = g ? `${g.start}:${m}` : null, E = v.length > 0 && s !== x, P = r.q === x ? _e(r.i, v.length) : 0, y = M((p) => f({ q: x, i: p }), [x]), d = M((p) => o(p.selectionStart ?? p.value.length), []), u = M((p) => {
3137
+ function Hf(e, t, a) {
3138
+ const [n, o] = N(0), [r, f] = N({ q: null, i: 0 }), [s, c] = N(null), g = Lf(e, Math.min(n, e.length)), u = g?.query ?? null, v = F(() => u ? sf(u) : [], [u]), x = g ? `${g.start}:${u}` : null, I = v.length > 0 && s !== x, R = r.q === x ? _e(r.i, v.length) : 0, _ = M((b) => f({ q: x, i: b }), [x]), d = M((b) => o(b.selectionStart ?? b.value.length), []), y = M((b) => {
3114
3139
  if (!g) return;
3115
- const T = Rf(e, g.start, Math.min(n, e.length), p.emoji.char);
3116
- t(T.text), o(T.caret), kn(p.emoji.char);
3140
+ const T = Of(e, g.start, Math.min(n, e.length), b.emoji.char);
3141
+ t(T.text), o(T.caret), vn(b.emoji.char);
3117
3142
  const L = a.current;
3118
3143
  L && (L.focus(), requestAnimationFrame(() => L.setSelectionRange(T.caret, T.caret)));
3119
- }, [g, e, n, t, a]), w = M((p) => {
3120
- if (!E) return !1;
3121
- if (p.key === "ArrowDown" || p.key === "ArrowUp")
3122
- return p.preventDefault(), y(_e(P + (p.key === "ArrowDown" ? 1 : -1), v.length)), !0;
3123
- if (p.key === "Tab" || p.key === "Enter") {
3124
- p.preventDefault();
3125
- const T = v[P];
3126
- return T && u(T), !0;
3144
+ }, [g, e, n, t, a]), h = M((b) => {
3145
+ if (!I) return !1;
3146
+ if (b.key === "ArrowDown" || b.key === "ArrowUp")
3147
+ return b.preventDefault(), _(_e(R + (b.key === "ArrowDown" ? 1 : -1), v.length)), !0;
3148
+ if (b.key === "Tab" || b.key === "Enter") {
3149
+ b.preventDefault();
3150
+ const T = v[R];
3151
+ return T && y(T), !0;
3127
3152
  }
3128
- return p.key === "Escape" ? (p.preventDefault(), c(x), !0) : !1;
3129
- }, [E, v, P, u, y, x]);
3130
- return { open: E, matches: v, activeIndex: P, setActiveIndex: y, pick: u, onKeyDown: w, trackCaret: d };
3153
+ return b.key === "Escape" ? (b.preventDefault(), c(x), !0) : !1;
3154
+ }, [I, v, R, y, _, x]);
3155
+ return { open: I, matches: v, activeIndex: R, setActiveIndex: _, pick: y, onKeyDown: h, trackCaret: d };
3131
3156
  }
3132
- function Lf({
3157
+ function Uf({
3133
3158
  pending: e,
3134
3159
  uploading: t,
3135
3160
  onRemove: a
3136
3161
  }) {
3137
- return e.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1.5 pb-1.5", "data-testid": "chat-attachment-strip", children: e.map((n) => /* @__PURE__ */ _("div", { className: "relative", children: [
3162
+ return e.length ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1.5 pb-1.5", "data-testid": "chat-attachment-strip", children: e.map((n) => /* @__PURE__ */ w("div", { className: "relative", children: [
3138
3163
  /* @__PURE__ */ l(
3139
3164
  "img",
3140
3165
  {
@@ -3156,84 +3181,84 @@ function Lf({
3156
3181
  )
3157
3182
  ] }, n.id)) }) : null;
3158
3183
  }
3159
- function Of() {
3160
- const [e, t] = N([]), [a, n] = N(!1), o = h((y) => y.pushToast), r = $(/* @__PURE__ */ new Set());
3161
- R(() => () => {
3162
- for (const y of r.current) URL.revokeObjectURL(y);
3184
+ function $f() {
3185
+ const [e, t] = N([]), [a, n] = N(!1), o = m((_) => _.pushToast), r = $(/* @__PURE__ */ new Set());
3186
+ P(() => () => {
3187
+ for (const _ of r.current) URL.revokeObjectURL(_);
3163
3188
  r.current.clear();
3164
3189
  }, []);
3165
- const f = M((y) => {
3166
- No(y) && (URL.revokeObjectURL(y.previewUrl), r.current.delete(y.previewUrl));
3167
- }, []), s = M(async (y) => {
3168
- if (!y.length) return;
3190
+ const f = M((_) => {
3191
+ jo(_) && (URL.revokeObjectURL(_.previewUrl), r.current.delete(_.previewUrl));
3192
+ }, []), s = M(async (_) => {
3193
+ if (!_.length) return;
3169
3194
  const d = [];
3170
- for (const u of y) {
3171
- const w = Po(u);
3172
- if (w) {
3173
- o("error", w);
3195
+ for (const y of _) {
3196
+ const h = Po(y);
3197
+ if (h) {
3198
+ o("error", h);
3174
3199
  continue;
3175
3200
  }
3176
- const { w: p, h: T } = await Do(u), L = URL.createObjectURL(u);
3201
+ const { w: b, h: T } = await Lo(y), L = URL.createObjectURL(y);
3177
3202
  r.current.add(L), d.push({
3178
3203
  kind: "file",
3179
3204
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
3180
- file: u,
3205
+ file: y,
3181
3206
  previewUrl: L,
3182
- w: p,
3207
+ w: b,
3183
3208
  h: T
3184
3209
  });
3185
3210
  }
3186
- d.length && t((u) => {
3187
- const w = ae - u.length;
3188
- if (w <= 0) {
3211
+ d.length && t((y) => {
3212
+ const h = ae - y.length;
3213
+ if (h <= 0) {
3189
3214
  o("info", `Up to ${ae} images per message`);
3190
- for (const p of d) f(p);
3191
- return u;
3215
+ for (const b of d) f(b);
3216
+ return y;
3192
3217
  }
3193
- if (d.length > w) {
3218
+ if (d.length > h) {
3194
3219
  o("info", `Up to ${ae} images per message`);
3195
- for (const p of d.slice(w)) f(p);
3220
+ for (const b of d.slice(h)) f(b);
3196
3221
  }
3197
- return [...u, ...d.slice(0, w)];
3222
+ return [...y, ...d.slice(0, h)];
3198
3223
  });
3199
- }, [o, f]), c = M((y) => {
3200
- const d = Ke(y.key);
3201
- d && (t((u) => u.length >= ae ? (o("info", `Up to ${ae} images per message`), u) : [...u, {
3224
+ }, [o, f]), c = M((_) => {
3225
+ const d = Ve(_.key);
3226
+ d && (t((y) => y.length >= ae ? (o("info", `Up to ${ae} images per message`), y) : [...y, {
3202
3227
  kind: "remote",
3203
3228
  id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
3204
- key: y.key,
3229
+ key: _.key,
3205
3230
  previewUrl: d,
3206
3231
  // The catalogue spells "unknown" as null; the wire schema spells it
3207
3232
  // as 0, and the renderer falls back to natural flow on that.
3208
- w: y.width ?? 0,
3209
- h: y.height ?? 0,
3210
- title: y.title || void 0
3211
- }]), tt().catalogue(Ua).recordUse(y.key));
3212
- }, [o]), g = M((y) => {
3233
+ w: _.width ?? 0,
3234
+ h: _.height ?? 0,
3235
+ title: _.title || void 0
3236
+ }]), tt().catalogue($a).recordUse(_.key));
3237
+ }, [o]), g = M((_) => {
3213
3238
  t((d) => {
3214
- const u = d.find((w) => w.id === y);
3215
- return u && f(u), d.filter((w) => w.id !== y);
3239
+ const y = d.find((h) => h.id === _);
3240
+ return y && f(y), d.filter((h) => h.id !== _);
3216
3241
  });
3217
- }, [f]), m = M(() => {
3218
- t((y) => {
3219
- for (const d of y) f(d);
3242
+ }, [f]), u = M(() => {
3243
+ t((_) => {
3244
+ for (const d of _) f(d);
3220
3245
  return [];
3221
3246
  });
3222
- }, [f]), v = M((y) => {
3223
- const d = Ro(y.clipboardData);
3224
- d.length && (y.preventDefault(), s(d));
3225
- }, [s]), x = M((y) => {
3226
- const d = Mo(y.dataTransfer);
3227
- d.length && (y.preventDefault(), s(d));
3228
- }, [s]), E = M((y) => {
3229
- y.dataTransfer?.types?.includes("Files") && y.preventDefault();
3230
- }, []), P = M(async () => {
3247
+ }, [f]), v = M((_) => {
3248
+ const d = Mo(_.clipboardData);
3249
+ d.length && (_.preventDefault(), s(d));
3250
+ }, [s]), x = M((_) => {
3251
+ const d = Do(_.dataTransfer);
3252
+ d.length && (_.preventDefault(), s(d));
3253
+ }, [s]), I = M((_) => {
3254
+ _.dataTransfer?.types?.includes("Files") && _.preventDefault();
3255
+ }, []), R = M(async () => {
3231
3256
  if (!e.length) return [];
3232
3257
  n(!0);
3233
3258
  try {
3234
- return await Oo(e);
3235
- } catch (y) {
3236
- return D("chat", "Image upload failed", qo(y)), o("error", jo(y)), null;
3259
+ return await qo(e);
3260
+ } catch (_) {
3261
+ return D("chat", "Image upload failed", Ho(_)), o("error", Ro(_)), null;
3237
3262
  } finally {
3238
3263
  n(!1);
3239
3264
  }
@@ -3244,15 +3269,15 @@ function Of() {
3244
3269
  addFiles: s,
3245
3270
  addMeme: c,
3246
3271
  remove: g,
3247
- clear: m,
3248
- uploadPending: P,
3272
+ clear: u,
3273
+ uploadPending: R,
3249
3274
  onPaste: v,
3250
3275
  onDrop: x,
3251
- onDragOver: E
3276
+ onDragOver: I
3252
3277
  };
3253
3278
  }
3254
- const qf = 2500, Hf = 5e3;
3255
- class Uf {
3279
+ const Ff = 2500, zf = 5e3;
3280
+ class Wf {
3256
3281
  constructor(t, a = Date.now) {
3257
3282
  this.send = t, this.now = a;
3258
3283
  }
@@ -3267,36 +3292,36 @@ class Uf {
3267
3292
  return;
3268
3293
  }
3269
3294
  const a = this.now();
3270
- (!this.typing || a - this.lastSent >= qf) && (this.typing = !0, this.lastSent = a, this.send(!0)), this.idle && clearTimeout(this.idle), this.idle = setTimeout(() => this.stop(), Hf);
3295
+ (!this.typing || a - this.lastSent >= Ff) && (this.typing = !0, this.lastSent = a, this.send(!0)), this.idle && clearTimeout(this.idle), this.idle = setTimeout(() => this.stop(), zf);
3271
3296
  }
3272
3297
  stop() {
3273
3298
  this.idle && (clearTimeout(this.idle), this.idle = null), this.typing && (this.typing = !1, this.send(!1));
3274
3299
  }
3275
3300
  }
3276
- function $f() {
3277
- const [e] = N(() => new Uf(Di));
3278
- return R(() => () => e.stop(), [e]), e;
3301
+ function Bf() {
3302
+ const [e] = N(() => new Wf(Hi));
3303
+ return P(() => () => e.stop(), [e]), e;
3279
3304
  }
3280
- function Ff(e) {
3305
+ function Gf(e) {
3281
3306
  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…";
3282
3307
  }
3283
- function zf({ replyTo: e, onCancel: t }) {
3284
- const a = h((r) => r.chat.find((f) => f.id === e)), n = it(
3308
+ function Kf({ replyTo: e, onCancel: t }) {
3309
+ const a = m((r) => r.chat.find((f) => f.id === e)), n = rt(
3285
3310
  { clientId: a?.clientId ?? "", author: a?.author },
3286
3311
  { name: a?.name ?? "a message", sprite: a?.sprite ?? null }
3287
- ), o = Ee(n.sprite, n.pictureUrl);
3288
- return /* @__PURE__ */ _("div", { className: "chat-reply-bar", "data-testid": "chat-reply-bar", children: [
3289
- /* @__PURE__ */ _("span", { className: "min-w-0 truncate", children: [
3312
+ ), o = Ae(n.sprite, n.pictureUrl);
3313
+ return /* @__PURE__ */ w("div", { className: "chat-reply-bar", "data-testid": "chat-reply-bar", children: [
3314
+ /* @__PURE__ */ w("span", { className: "min-w-0 truncate", children: [
3290
3315
  "Replying to ",
3291
3316
  /* @__PURE__ */ l("span", { className: "font-semibold", style: { color: o }, children: n.name })
3292
3317
  ] }),
3293
- /* @__PURE__ */ l("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ l(bf, { className: "w-3.5 h-3.5" }) })
3318
+ /* @__PURE__ */ l("button", { type: "button", className: "chat-reply-cancel", onClick: t, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ l(kf, { className: "w-3.5 h-3.5" }) })
3294
3319
  ] });
3295
3320
  }
3296
- function Tn(e, t) {
3321
+ function Cn(e, t) {
3297
3322
  const a = /* @__PURE__ */ new Map();
3298
3323
  for (const n of Object.values(e)) {
3299
- const o = wt(n), r = a.get(o);
3324
+ const o = _t(n), r = a.get(o);
3300
3325
  if (!r) {
3301
3326
  a.set(o, n);
3302
3327
  continue;
@@ -3306,30 +3331,30 @@ function Tn(e, t) {
3306
3331
  }
3307
3332
  return [...a.values()];
3308
3333
  }
3309
- function wt(e) {
3334
+ function _t(e) {
3310
3335
  return e.author ? `author:${e.author}` : `client:${e.clientId}`;
3311
3336
  }
3312
- function Wf() {
3313
- const e = h((c) => c.typing), t = h((c) => c.roster), a = h((c) => c.me.clientId), n = h((c) => c.setTyping);
3314
- R(() => {
3337
+ function Vf() {
3338
+ const e = m((c) => c.typing), t = m((c) => c.roster), a = m((c) => c.me.clientId), n = m((c) => c.setTyping);
3339
+ P(() => {
3315
3340
  const c = Object.keys(e);
3316
3341
  if (c.length === 0) return;
3317
- const g = Math.min(...c.map((v) => e[v])), m = setTimeout(() => {
3342
+ const g = Math.min(...c.map((v) => e[v])), u = setTimeout(() => {
3318
3343
  const v = Date.now();
3319
3344
  for (const x of c) e[x] <= v && n(x, !1);
3320
3345
  }, Math.max(0, g - Date.now()) + 50);
3321
- return () => clearTimeout(m);
3346
+ return () => clearTimeout(u);
3322
3347
  }, [e, n]);
3323
- const o = a && t[a] ? wt(t[a]) : null, r = /* @__PURE__ */ new Map();
3348
+ const o = a && t[a] ? _t(t[a]) : null, r = /* @__PURE__ */ new Map();
3324
3349
  for (const c of Object.keys(e)) {
3325
3350
  const g = t[c];
3326
3351
  if (!g || c === a) continue;
3327
- const m = wt(g);
3328
- m !== o && !r.has(m) && r.set(m, g.name || "Someone");
3352
+ const u = _t(g);
3353
+ u !== o && !r.has(u) && r.set(u, g.name || "Someone");
3329
3354
  }
3330
- const f = [...r.values()].sort((c, g) => c.localeCompare(g)), s = Ff(f);
3331
- return /* @__PURE__ */ l("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children: s && /* @__PURE__ */ _(te, { children: [
3332
- /* @__PURE__ */ _("span", { className: "chat-typing-dots", "aria-hidden": "true", children: [
3355
+ const f = [...r.values()].sort((c, g) => c.localeCompare(g)), s = Gf(f);
3356
+ return /* @__PURE__ */ l("div", { className: "chat-typing", "aria-live": "polite", "data-testid": "chat-typing", children: s && /* @__PURE__ */ w(te, { children: [
3357
+ /* @__PURE__ */ w("span", { className: "chat-typing-dots", "aria-hidden": "true", children: [
3333
3358
  /* @__PURE__ */ l("i", {}),
3334
3359
  /* @__PURE__ */ l("i", {}),
3335
3360
  /* @__PURE__ */ l("i", {})
@@ -3337,114 +3362,114 @@ function Wf() {
3337
3362
  /* @__PURE__ */ l("span", { className: "truncate", children: s })
3338
3363
  ] }) });
3339
3364
  }
3340
- const ca = Ca, Bf = io;
3341
- function Gf({ commands: e = Lt }) {
3342
- const [t, a] = N(""), [n, o] = N(!1), [r, f] = N({ q: null, i: 0 }), [s, c] = N(!1), g = $(null), m = $t(), v = $t(), [x, E] = N(!1), [P, y] = N(!1), d = Df(t, a, g), u = Of(), w = $f(), p = h((k) => k.replyingTo), T = h((k) => k.setReplyingTo);
3343
- R(() => {
3344
- p && !document.hidden && g.current?.focus({ preventScroll: !0 });
3345
- }, [p]);
3346
- const L = h((k) => k.snapshot.mediaId), q = h((k) => k.pushToast), z = h((k) => k.setTierlistOpen), W = !!L, I = xf(t), j = F(
3347
- () => I === null ? [] : Sf(I, e),
3348
- [I, e]
3349
- ), A = I !== null && !s && j.length > 0, O = r.q === I ? _e(r.i, j.length) : 0, H = M(
3350
- (k) => f({ q: I, i: k }),
3351
- [I]
3365
+ const da = Ea, Yf = fo;
3366
+ function Jf({ commands: e = Ot }) {
3367
+ const [t, a] = N(""), [n, o] = N(!1), [r, f] = N({ q: null, i: 0 }), [s, c] = N(!1), g = $(null), u = Ft(), v = Ft(), [x, I] = N(!1), [R, _] = N(!1), d = Hf(t, a, g), y = $f(), h = Bf(), b = m((k) => k.replyingTo), T = m((k) => k.setReplyingTo);
3368
+ P(() => {
3369
+ b && !document.hidden && g.current?.focus({ preventScroll: !0 });
3370
+ }, [b]);
3371
+ const L = m((k) => k.snapshot.mediaId), O = m((k) => k.pushToast), z = m((k) => k.setTierlistOpen), W = !!L, E = Ef(t), j = F(
3372
+ () => E === null ? [] : If(E, e),
3373
+ [E, e]
3374
+ ), A = E !== null && !s && j.length > 0, q = r.q === E ? _e(r.i, j.length) : 0, H = M(
3375
+ (k) => f({ q: E, i: k }),
3376
+ [E]
3352
3377
  ), ie = M((k, U) => {
3353
- const me = If(k, { hasMedia: W });
3378
+ const me = jf(k, { hasMedia: W });
3354
3379
  if (me) {
3355
- q("info", me);
3380
+ O("info", me);
3356
3381
  return;
3357
3382
  }
3358
3383
  switch (k.name) {
3359
3384
  case "help":
3360
- q("info", e.map((An) => An.usage).join(" "));
3385
+ O("info", e.map((Nn) => Nn.usage).join(" "));
3361
3386
  break;
3362
3387
  case "recap":
3363
- $i();
3388
+ Bi();
3364
3389
  break;
3365
3390
  case "tierlist":
3366
- Yr(), z(!0);
3391
+ Zr(), z(!0);
3367
3392
  break;
3368
3393
  default:
3369
- q("info", `${k.usage} is not implemented yet.`);
3394
+ O("info", `${k.usage} is not implemented yet.`);
3370
3395
  }
3371
- }, [W, q, e, z]), V = M((k) => {
3372
- a(Tf(k)), c(!1), g.current?.focus();
3396
+ }, [W, O, e, z]), Y = M((k) => {
3397
+ a(Af(k)), c(!1), g.current?.focus();
3373
3398
  }, []), In = M(async (k) => {
3374
- if (k.preventDefault(), n || u.uploading) return;
3375
- const U = Cf(t, e);
3376
- if (!U && !u.pending.length) return;
3377
- if (U?.kind === "command" && u.pending.length) {
3378
- q("info", "Send images on their own, not with a command.");
3399
+ if (k.preventDefault(), n || y.uploading) return;
3400
+ const U = Nf(t, e);
3401
+ if (!U && !y.pending.length) return;
3402
+ if (U?.kind === "command" && y.pending.length) {
3403
+ O("info", "Send images on their own, not with a command.");
3379
3404
  return;
3380
3405
  }
3381
3406
  if (U?.kind === "command") {
3382
- ie(U.command, U.args), a(""), w.stop(), !document.hidden && document.hasFocus() && g.current?.focus();
3407
+ ie(U.command, U.args), a(""), h.stop(), !document.hidden && document.hasFocus() && g.current?.focus();
3383
3408
  return;
3384
3409
  }
3385
- const me = await u.uploadPending();
3386
- me !== null && (Ri(Mf(U?.text ?? ""), me, p), a(""), w.stop(), T(null), u.clear(), o(!0), setTimeout(() => o(!1), Bf), !document.hidden && document.hasFocus() && g.current?.focus());
3387
- }, [t, n, ie, u, q, e, p, T, w]), En = M((k) => {
3410
+ const me = await y.uploadPending();
3411
+ me !== null && (Oi(qf(U?.text ?? ""), me, b), a(""), h.stop(), T(null), y.clear(), o(!0), setTimeout(() => o(!1), Yf), !document.hidden && document.hasFocus() && g.current?.focus());
3412
+ }, [t, n, ie, y, O, e, b, T, h]), An = M((k) => {
3388
3413
  if (!(!A && d.onKeyDown(k))) {
3389
3414
  if (k.key === "Escape" && A) {
3390
3415
  k.preventDefault(), c(!0);
3391
3416
  return;
3392
3417
  }
3393
- if (k.key === "Escape" && p) {
3418
+ if (k.key === "Escape" && b) {
3394
3419
  k.preventDefault(), T(null);
3395
3420
  return;
3396
3421
  }
3397
3422
  if (A) {
3398
3423
  if (k.key === "ArrowDown")
3399
- k.preventDefault(), H(_e(O + 1, j.length));
3424
+ k.preventDefault(), H(_e(q + 1, j.length));
3400
3425
  else if (k.key === "ArrowUp")
3401
- k.preventDefault(), H(_e(O - 1, j.length));
3426
+ k.preventDefault(), H(_e(q - 1, j.length));
3402
3427
  else if (k.key === "Tab") {
3403
3428
  k.preventDefault();
3404
- const U = j[O];
3405
- U && V(U);
3429
+ const U = j[q];
3430
+ U && Y(U);
3406
3431
  } else if (k.key === "Enter") {
3407
3432
  k.preventDefault();
3408
- const U = j[O];
3409
- U && V(U);
3433
+ const U = j[q];
3434
+ U && Y(U);
3410
3435
  }
3411
3436
  }
3412
3437
  }
3413
- }, [A, j, O, V, H, p, T, d]);
3414
- R(() => {
3438
+ }, [A, j, q, Y, H, b, T, d]);
3439
+ P(() => {
3415
3440
  const k = () => {
3416
3441
  document.hidden || !document.hasFocus() || (g.current?.focus(), g.current?.scrollIntoView({ block: "nearest" }));
3417
3442
  };
3418
3443
  return window.addEventListener("watchparty:focus-chat-input", k), () => window.removeEventListener("watchparty:focus-chat-input", k);
3419
3444
  }, []);
3420
- 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;
3421
- return /* @__PURE__ */ _(
3445
+ const je = da - t.length, qt = je <= 100, Ht = A ? j[q] : void 0, Re = !A && d.open, Ut = Re ? d.matches[d.activeIndex] : void 0;
3446
+ return /* @__PURE__ */ w(
3422
3447
  "form",
3423
3448
  {
3424
3449
  onSubmit: (k) => {
3425
3450
  In(k);
3426
3451
  },
3427
- onPaste: u.onPaste,
3428
- onDrop: u.onDrop,
3429
- onDragOver: u.onDragOver,
3452
+ onPaste: y.onPaste,
3453
+ onDrop: y.onDrop,
3454
+ onDragOver: y.onDragOver,
3430
3455
  className: "p-2 border-t border-border",
3431
3456
  children: [
3432
- p && /* @__PURE__ */ l(zf, { replyTo: p, onCancel: () => T(null) }),
3433
- /* @__PURE__ */ l(Lf, { pending: u.pending, uploading: u.uploading, onRemove: u.remove }),
3434
- /* @__PURE__ */ _("div", { className: "relative", children: [
3457
+ b && /* @__PURE__ */ l(Kf, { replyTo: b, onCancel: () => T(null) }),
3458
+ /* @__PURE__ */ l(Uf, { pending: y.pending, uploading: y.uploading, onRemove: y.remove }),
3459
+ /* @__PURE__ */ w("div", { className: "relative", children: [
3435
3460
  A && /* @__PURE__ */ l(
3436
- Ef,
3461
+ Rf,
3437
3462
  {
3438
3463
  commands: j,
3439
- activeIndex: O,
3464
+ activeIndex: q,
3440
3465
  hasMedia: W,
3441
- onPick: V,
3466
+ onPick: Y,
3442
3467
  onHover: H,
3443
- listboxId: m
3468
+ listboxId: u
3444
3469
  }
3445
3470
  ),
3446
- je && /* @__PURE__ */ l(
3447
- Af,
3471
+ Re && /* @__PURE__ */ l(
3472
+ Pf,
3448
3473
  {
3449
3474
  matches: d.matches,
3450
3475
  activeIndex: d.activeIndex,
@@ -3454,18 +3479,18 @@ function Gf({ commands: e = Lt }) {
3454
3479
  }
3455
3480
  ),
3456
3481
  /* @__PURE__ */ l(
3457
- Bo,
3482
+ Go,
3458
3483
  {
3459
3484
  open: x,
3460
- onClose: () => E(!1),
3461
- onPick: u.addMeme,
3485
+ onClose: () => I(!1),
3486
+ onPick: y.addMeme,
3462
3487
  onUnavailable: () => {
3463
- y(!0), E(!1);
3488
+ _(!0), I(!1);
3464
3489
  }
3465
3490
  }
3466
3491
  ),
3467
- /* @__PURE__ */ _("div", { className: "flex items-center gap-1.5", children: [
3468
- /* @__PURE__ */ _("div", { className: "relative flex-1", children: [
3492
+ /* @__PURE__ */ w("div", { className: "flex items-center gap-1.5", children: [
3493
+ /* @__PURE__ */ w("div", { className: "relative flex-1", children: [
3469
3494
  /* @__PURE__ */ l(
3470
3495
  "input",
3471
3496
  {
@@ -3473,49 +3498,49 @@ function Gf({ commands: e = Lt }) {
3473
3498
  type: "text",
3474
3499
  value: t,
3475
3500
  onChange: (k) => {
3476
- a(k.target.value), d.trackCaret(k.target), c(!1), k.target.value.startsWith("/") ? w.stop() : w.input(k.target.value);
3501
+ a(k.target.value), d.trackCaret(k.target), c(!1), k.target.value.startsWith("/") ? h.stop() : h.input(k.target.value);
3477
3502
  },
3478
- onKeyDown: En,
3503
+ onKeyDown: An,
3479
3504
  onSelect: (k) => d.trackCaret(k.currentTarget),
3480
- maxLength: ca,
3505
+ maxLength: da,
3481
3506
  placeholder: "Send a message",
3482
3507
  role: "combobox",
3483
- "aria-expanded": A || je,
3484
- "aria-controls": A ? m : je ? v : void 0,
3485
- "aria-activedescendant": qt ? `${m}-opt-${qt.name}` : Ht ? Sn(v, Ht) : void 0,
3508
+ "aria-expanded": A || Re,
3509
+ "aria-controls": A ? u : Re ? v : void 0,
3510
+ "aria-activedescendant": Ht ? `${u}-opt-${Ht.name}` : Ut ? Tn(v, Ut) : void 0,
3486
3511
  "aria-autocomplete": "list",
3487
- 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" : ""}`
3512
+ 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" : ""}`
3488
3513
  }
3489
3514
  ),
3490
- /* @__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 })
3515
+ /* @__PURE__ */ l("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${je <= 50 ? je <= 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 && je })
3491
3516
  ] }),
3492
- !P && /* @__PURE__ */ l(
3517
+ !R && /* @__PURE__ */ l(
3493
3518
  "button",
3494
3519
  {
3495
3520
  type: "button",
3496
- onClick: () => E((k) => !k),
3521
+ onClick: () => I((k) => !k),
3497
3522
  "aria-label": "Add a meme",
3498
3523
  "aria-expanded": x,
3499
3524
  title: "Add a meme",
3500
3525
  "data-testid": "meme-button",
3501
3526
  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"}`,
3502
- children: /* @__PURE__ */ l(Nn, { name: "image" })
3527
+ children: /* @__PURE__ */ l(jn, { name: "image" })
3503
3528
  }
3504
3529
  )
3505
3530
  ] })
3506
3531
  ] }),
3507
- /* @__PURE__ */ l(Wf, {})
3532
+ /* @__PURE__ */ l(Vf, {})
3508
3533
  ]
3509
3534
  }
3510
3535
  );
3511
3536
  }
3512
- function Kf() {
3513
- const e = h((n) => n.roster), t = h((n) => n.me.clientId), a = F(() => Tn(e, t), [e, t]);
3514
- return a.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: a.map((n) => /* @__PURE__ */ l(Vf, { u: n }, n.clientId)) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
3537
+ function Xf() {
3538
+ const e = m((n) => n.roster), t = m((n) => n.me.clientId), a = F(() => Cn(e, t), [e, t]);
3539
+ return a.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-1", children: a.map((n) => /* @__PURE__ */ l(Qf, { u: n }, n.clientId)) }) : /* @__PURE__ */ l("div", { className: "text-xs text-text-muted", children: "No users online" });
3515
3540
  }
3516
- function Vf({ u: e }) {
3517
- const t = Ee(e.sprite, e.avatarUrl);
3518
- return /* @__PURE__ */ _("div", { className: "flex items-center gap-2 py-0.5", children: [
3541
+ function Qf({ u: e }) {
3542
+ const t = Ae(e.sprite, e.avatarUrl);
3543
+ return /* @__PURE__ */ w("div", { className: "flex items-center gap-2 py-0.5", children: [
3519
3544
  /* @__PURE__ */ l(
3520
3545
  Dt,
3521
3546
  {
@@ -3530,9 +3555,9 @@ function Vf({ u: e }) {
3530
3555
  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" })
3531
3556
  ] });
3532
3557
  }
3533
- function Yf() {
3534
- const e = h((r) => Tn(r.roster).length), [t, a] = N(!1), n = $(null), o = $(null);
3535
- return R(() => {
3558
+ function Zf() {
3559
+ const e = m((r) => Cn(r.roster).length), [t, a] = N(!1), n = $(null), o = $(null);
3560
+ return P(() => {
3536
3561
  if (!t) return;
3537
3562
  function r(s) {
3538
3563
  n.current && !n.current.contains(s.target) && a(!1);
@@ -3543,15 +3568,15 @@ function Yf() {
3543
3568
  return document.addEventListener("mousedown", r), document.addEventListener("keydown", f, !0), () => {
3544
3569
  document.removeEventListener("mousedown", r), document.removeEventListener("keydown", f, !0);
3545
3570
  };
3546
- }, [t]), /* @__PURE__ */ _("div", { className: "relative", ref: n, children: [
3547
- /* @__PURE__ */ _(
3571
+ }, [t]), /* @__PURE__ */ w("div", { className: "relative", ref: n, children: [
3572
+ /* @__PURE__ */ w(
3548
3573
  "button",
3549
3574
  {
3550
3575
  ref: o,
3551
3576
  "aria-expanded": t,
3552
3577
  "aria-label": `Users (${e})`,
3553
3578
  onClick: () => {
3554
- b("chat", "User list toggled", { open: !t, userCount: e }), a(!t);
3579
+ p("chat", "User list toggled", { open: !t, userCount: e }), a(!t);
3555
3580
  },
3556
3581
  className: "p-1.5 rounded text-text-secondary hover:text-white hover:bg-bg-alt transition-colors flex items-center gap-1 cursor-pointer",
3557
3582
  title: "Users",
@@ -3561,70 +3586,70 @@ function Yf() {
3561
3586
  ]
3562
3587
  }
3563
3588
  ),
3564
- t && /* @__PURE__ */ _("div", { className: "absolute top-full right-0 mt-1 bg-bg-card rounded-lg shadow-xl p-3 max-h-64 overflow-y-auto z-50 w-max min-w-[180px] max-w-[220px]", children: [
3565
- /* @__PURE__ */ _("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-2", children: [
3589
+ t && /* @__PURE__ */ w("div", { className: "absolute top-full right-0 mt-1 bg-bg-card rounded-lg shadow-xl p-3 max-h-64 overflow-y-auto z-50 w-max min-w-[180px] max-w-[220px]", children: [
3590
+ /* @__PURE__ */ w("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-2", children: [
3566
3591
  e,
3567
3592
  " online"
3568
3593
  ] }),
3569
- /* @__PURE__ */ l(Kf, {})
3594
+ /* @__PURE__ */ l(Xf, {})
3570
3595
  ] })
3571
3596
  ] });
3572
3597
  }
3573
- function da({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3574
- const t = h((n) => n.toasts), a = h((n) => n.popToast);
3575
- return R(() => {
3598
+ function ua({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
3599
+ const t = m((n) => n.toasts), a = m((n) => n.popToast);
3600
+ return P(() => {
3576
3601
  const n = t.map((o) => setTimeout(() => a(o.id), 4e3));
3577
3602
  return () => {
3578
3603
  n.forEach(clearTimeout);
3579
3604
  };
3580
3605
  }, [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)) });
3581
3606
  }
3582
- const Cn = 9e3, ua = 1500, Jf = {
3607
+ const En = 9e3, ma = 1500, es = {
3583
3608
  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]",
3584
3609
  cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
3585
3610
  minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
3586
3611
  contrast: "bg-black/70 px-2 py-0.5 rounded"
3587
- }, ma = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, ga = {
3612
+ }, ga = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, ha = {
3588
3613
  textShadow: "none",
3589
3614
  filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
3590
3615
  };
3591
- function Xf({ message: e, age: t, ccStyle: a }) {
3592
- const n = Cn - ua;
3616
+ function ts({ message: e, age: t, ccStyle: a }) {
3617
+ const n = En - ma;
3593
3618
  let o = 1;
3594
- t > n && (o = Math.max(0, 1 - (t - n) / ua));
3595
- const r = Jf[a], f = it(
3619
+ t > n && (o = Math.max(0, 1 - (t - n) / ma));
3620
+ const r = es[a], f = rt(
3596
3621
  { clientId: e.clientId, author: e.author },
3597
3622
  { name: e.name, sprite: e.sprite }
3598
- ), s = Ee(f.sprite, f.pictureUrl), c = f.cosmetics, [g] = N(
3599
- () => e.live && e.text ? _a(e.text, c) : null
3623
+ ), s = Ae(f.sprite, f.pictureUrl), c = f.cosmetics, [g] = N(
3624
+ () => e.live && e.text ? wa(e.text, c) : null
3600
3625
  );
3601
- return /* @__PURE__ */ _(
3626
+ return /* @__PURE__ */ w(
3602
3627
  "div",
3603
3628
  {
3604
3629
  className: `flex items-start gap-2 py-1 ${r}`,
3605
- style: { opacity: o, transition: "opacity 0.15s ease-out", ...Ga(s) },
3630
+ style: { opacity: o, transition: "opacity 0.15s ease-out", ...Ka(s) },
3606
3631
  children: [
3607
- /* @__PURE__ */ l(bn, { sprite: f.sprite, url: f.pictureUrl, worn: c }),
3608
- /* @__PURE__ */ _("div", { className: "min-w-0 flex-1", children: [
3609
- 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 }),
3610
- g ? /* @__PURE__ */ l(we, { html: g, className: "text-sm text-white break-words", style: ga }) : /* @__PURE__ */ l("span", { className: "text-sm text-white break-words", style: ma, children: e.text }),
3611
- /* @__PURE__ */ l(yn, { images: e.images })
3632
+ /* @__PURE__ */ l(_n, { sprite: f.sprite, url: f.pictureUrl, worn: c }),
3633
+ /* @__PURE__ */ w("div", { className: "min-w-0 flex-1", children: [
3634
+ c ? /* @__PURE__ */ l(we, { html: ka(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 }),
3635
+ 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 }),
3636
+ /* @__PURE__ */ l(wn, { images: e.images })
3612
3637
  ] })
3613
3638
  ]
3614
3639
  }
3615
3640
  );
3616
3641
  }
3617
- function Qf({ shown: e, className: t }) {
3618
- Ba();
3619
- const a = h((c) => c.chat), n = h((c) => c.mediaPrefs.subtitleStyle), [o, r] = N(() => Date.now()), f = a.length > 0;
3620
- R(() => {
3642
+ function as({ shown: e, className: t }) {
3643
+ Ga();
3644
+ const a = m((c) => c.chat), n = m((c) => c.mediaPrefs.subtitleStyle), [o, r] = N(() => Date.now()), f = a.length > 0;
3645
+ P(() => {
3621
3646
  const c = setInterval(() => {
3622
3647
  f && r(Date.now());
3623
3648
  }, 200);
3624
3649
  return () => clearInterval(c);
3625
3650
  }, [f]);
3626
3651
  const s = F(() => {
3627
- const c = o - Cn;
3652
+ const c = o - En;
3628
3653
  return a.filter((g) => !g.isSystem && g.ts > c).slice(-12);
3629
3654
  }, [a, o]);
3630
3655
  return !e || s.length === 0 ? null : /* @__PURE__ */ l(
@@ -3633,7 +3658,7 @@ function Qf({ shown: e, className: t }) {
3633
3658
  className: `wp-floating-chat pointer-events-none flex flex-col ${t}`,
3634
3659
  "data-testid": "floating-chat",
3635
3660
  children: s.map((c) => /* @__PURE__ */ l(
3636
- Xf,
3661
+ ts,
3637
3662
  {
3638
3663
  message: c,
3639
3664
  age: o - c.ts,
@@ -3644,27 +3669,27 @@ function Qf({ shown: e, className: t }) {
3644
3669
  }
3645
3670
  );
3646
3671
  }
3647
- const ha = (e) => typeof e == "string" && jn.includes(e);
3648
- function Zf(e, t, a) {
3649
- return e || (ha(t) ? t : ha(a) ? a : "dark");
3672
+ const pa = (e) => typeof e == "string" && Rn.includes(e);
3673
+ function ns(e, t, a) {
3674
+ return e || (pa(t) ? t : pa(a) ? a : "dark");
3650
3675
  }
3651
- function es(e, t) {
3676
+ function os(e, t) {
3652
3677
  if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
3653
3678
  };
3654
3679
  const a = new ResizeObserver(() => t(e.clientWidth));
3655
3680
  return a.observe(e), () => a.disconnect();
3656
3681
  }
3657
- function ts(e) {
3682
+ function rs(e) {
3658
3683
  const t = e?.trim() ?? "";
3659
3684
  return t ? { source: "host", name: t } : { source: "auto" };
3660
3685
  }
3661
- function as(e) {
3686
+ function is(e) {
3662
3687
  if (e.source !== "host") return;
3663
- const { setSessionIdentity: t, sprite: a } = h.getState();
3688
+ const { setSessionIdentity: t, sprite: a } = m.getState();
3664
3689
  t(e.name, a);
3665
3690
  }
3666
- const ns = 1500;
3667
- function _s({
3691
+ const fs = 1500;
3692
+ function xs({
3668
3693
  roomKey: e,
3669
3694
  serverOrigin: t,
3670
3695
  roomOrigin: a,
@@ -3675,78 +3700,78 @@ function _s({
3675
3700
  userId: s,
3676
3701
  theme: c,
3677
3702
  name: g,
3678
- onLeave: m,
3703
+ onLeave: u,
3679
3704
  onLayoutChange: v,
3680
3705
  collapsible: x = !0,
3681
- debug: E,
3682
- children: P
3706
+ debug: I,
3707
+ children: R
3683
3708
  }) {
3684
- const [y, d] = N(null), { setFrame: u, ...w } = os(v, x), p = h((A) => A.floatingChatEnabled), T = ya(() => g), L = F(() => (_r({ userType: f, userId: s ?? null }), Nt().theme), [f, s]), q = Pn(), z = q?.theme, W = F(
3685
- () => Zf(c, z, L),
3709
+ const [_, d] = N(null), { setFrame: y, ...h } = ss(v, x), b = m((A) => A.floatingChatEnabled), T = _a(() => g), L = F(() => (wr({ userType: f, userId: s ?? null }), Nt().theme), [f, s]), O = Pn(), z = O?.theme, W = F(
3710
+ () => ns(c, z, L),
3686
3711
  [c, z, L]
3687
3712
  );
3688
- R(() => {
3689
- }, [c, q !== null]);
3713
+ P(() => {
3714
+ }, [c, O !== null]);
3690
3715
  const j = F(
3691
- () => ({ ...Ct, serverOrigin: t, defaultRoomKey: e }),
3716
+ () => ({ ...Tt, serverOrigin: t, defaultRoomKey: e }),
3692
3717
  [t, e]
3693
3718
  );
3694
- return R(() => {
3695
- E && Qo();
3696
- }, [E]), Fi(), R(() => {
3697
- Go({ serverOrigin: t, defaultRoomKey: e }), zr(a ? { origin: a, path: n } : null), ta(o && !a ? { origin: o, path: r } : null), h.getState().rehydrateFromPrefs(), ui();
3719
+ return P(() => {
3720
+ I && Zo();
3721
+ }, [I]), Gi(), P(() => {
3722
+ Ko({ serverOrigin: t, defaultRoomKey: e }), Kr(a ? { origin: a, path: n } : null), aa(o && !a ? { origin: o, path: r } : null), m.getState().rehydrateFromPrefs(), pi();
3698
3723
  let A = !1;
3699
- const O = vr();
3724
+ const q = xr();
3700
3725
  return (async () => {
3701
3726
  try {
3702
3727
  await Promise.race([
3703
3728
  Promise.all([
3704
- O,
3705
- Er().then((V) => {
3706
- V && h.getState().rehydrateFromPrefs();
3729
+ q,
3730
+ Ar().then((Y) => {
3731
+ Y && m.getState().rehydrateFromPrefs();
3707
3732
  }),
3708
3733
  // The character chosen in the settings popout (lib/avatar.ts).
3709
- ei().then(pn)
3734
+ oi().then(yn)
3710
3735
  ]),
3711
- new Promise((V) => setTimeout(V, ns))
3736
+ new Promise((Y) => setTimeout(Y, fs))
3712
3737
  ]);
3713
- } catch (V) {
3714
- D("room-chrome", "pre-join wait threw, proceeding anyway", Ce(V));
3738
+ } catch (Y) {
3739
+ D("room-chrome", "pre-join wait threw, proceeding anyway", Ee(Y));
3715
3740
  }
3716
3741
  if (A) return;
3717
- const H = ts(T());
3718
- h.getState().ensureAutoIdentity(), as(H);
3719
- const ie = h.getState();
3720
- b("room-chrome", "Joining room", { roomKey: e, name: ie.name, sprite: ie.sprite }), vi({ room_key: e, name: ie.name || void 0, sprite: ie.sprite || void 0 });
3742
+ const H = rs(T());
3743
+ m.getState().ensureAutoIdentity(), is(H);
3744
+ const ie = m.getState();
3745
+ p("room-chrome", "Joining room", { roomKey: e, name: ie.name, sprite: ie.sprite }), Ci({ room_key: e, name: ie.name || void 0, sprite: ie.sprite || void 0 });
3721
3746
  })(), () => {
3722
- A = !0, fa(), ta(null);
3747
+ A = !0, sa(), aa(null);
3723
3748
  };
3724
- }, [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: [
3725
- /* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: P }),
3749
+ }, [e, t, a, n, o, r, f, s]), /* @__PURE__ */ l(Vo.Provider, { value: j, children: /* @__PURE__ */ l(Ba.Provider, { value: !1, children: /* @__PURE__ */ l(za.Provider, { value: _, children: /* @__PURE__ */ w("div", { ref: y, className: "wp-room-chrome-frame", children: [
3750
+ /* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: R }),
3726
3751
  /* @__PURE__ */ l(
3727
3752
  "aside",
3728
3753
  {
3729
3754
  ref: d,
3730
3755
  className: "wp-room-chrome",
3731
3756
  "data-theme": W,
3732
- "data-collapsed": w.collapsed ? "1" : "0",
3733
- style: { "--wp-room-chrome-width": `${w.state.width}px` },
3734
- onAnimationEnd: (A) => Bn(A.nativeEvent),
3735
- children: w.collapsed ? /* @__PURE__ */ _(te, { children: [
3757
+ "data-collapsed": h.collapsed ? "1" : "0",
3758
+ style: { "--wp-room-chrome-width": `${h.state.width}px` },
3759
+ onAnimationEnd: (A) => Gn(A.nativeEvent),
3760
+ children: h.collapsed ? /* @__PURE__ */ w(te, { children: [
3736
3761
  /* @__PURE__ */ l(
3737
3762
  "button",
3738
3763
  {
3739
- onClick: w.toggleCollapsed,
3764
+ onClick: h.toggleCollapsed,
3740
3765
  className: "wp-room-chrome__icon-btn",
3741
3766
  title: "Show chat",
3742
3767
  "aria-label": "Show chat",
3743
3768
  "aria-expanded": !1,
3744
- children: /* @__PURE__ */ l(pf, {})
3769
+ children: /* @__PURE__ */ l(wf, {})
3745
3770
  }
3746
3771
  ),
3747
- /* @__PURE__ */ l(da, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3748
- /* @__PURE__ */ l(Qf, { shown: p, className: "wp-room-chrome__floating" })
3749
- ] }) : /* @__PURE__ */ _(te, { children: [
3772
+ /* @__PURE__ */ l(ua, { className: "absolute bottom-2 right-full mr-2 w-72" }),
3773
+ /* @__PURE__ */ l(as, { shown: b, className: "wp-room-chrome__floating" })
3774
+ ] }) : /* @__PURE__ */ w(te, { children: [
3750
3775
  /* @__PURE__ */ l(
3751
3776
  "div",
3752
3777
  {
@@ -3755,25 +3780,25 @@ function _s({
3755
3780
  "aria-label": "Resize chat",
3756
3781
  "aria-valuemin": Xe,
3757
3782
  "aria-valuemax": jt,
3758
- "aria-valuenow": w.state.width,
3783
+ "aria-valuenow": h.state.width,
3759
3784
  tabIndex: 0,
3760
3785
  className: "wp-room-chrome__resize",
3761
- "data-dragging": w.dragging ? "1" : "0",
3762
- onPointerDown: w.onPointerDown,
3763
- onPointerMove: w.onPointerMove,
3764
- onPointerUp: w.onPointerEnd,
3765
- onPointerCancel: w.onPointerEnd,
3766
- onKeyDown: w.onKeyDown
3786
+ "data-dragging": h.dragging ? "1" : "0",
3787
+ onPointerDown: h.onPointerDown,
3788
+ onPointerMove: h.onPointerMove,
3789
+ onPointerUp: h.onPointerEnd,
3790
+ onPointerCancel: h.onPointerEnd,
3791
+ onKeyDown: h.onKeyDown
3767
3792
  }
3768
3793
  ),
3769
- /* @__PURE__ */ _("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
3770
- /* @__PURE__ */ l(Yf, {}),
3794
+ /* @__PURE__ */ w("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
3795
+ /* @__PURE__ */ l(Zf, {}),
3771
3796
  /* @__PURE__ */ l("div", { className: "flex-1" }),
3772
- m && /* @__PURE__ */ l(
3797
+ u && /* @__PURE__ */ l(
3773
3798
  "button",
3774
3799
  {
3775
3800
  onClick: () => {
3776
- fa(), m();
3801
+ sa(), u();
3777
3802
  },
3778
3803
  className: "wp-room-chrome__leave",
3779
3804
  title: "Leave room",
@@ -3784,56 +3809,56 @@ function _s({
3784
3809
  x && /* @__PURE__ */ l(
3785
3810
  "button",
3786
3811
  {
3787
- onClick: w.toggleCollapsed,
3812
+ onClick: h.toggleCollapsed,
3788
3813
  className: "wp-room-chrome__icon-btn",
3789
3814
  title: "Hide chat",
3790
3815
  "aria-label": "Hide chat",
3791
3816
  "aria-expanded": !0,
3792
- children: /* @__PURE__ */ l(hf, {})
3817
+ children: /* @__PURE__ */ l(_f, {})
3793
3818
  }
3794
3819
  )
3795
3820
  ] }),
3796
- /* @__PURE__ */ l(vf, {}),
3797
- /* @__PURE__ */ l(Gf, { commands: [] }),
3798
- /* @__PURE__ */ l(da, { className: "absolute bottom-14 left-2 right-2" })
3821
+ /* @__PURE__ */ l(Cf, {}),
3822
+ /* @__PURE__ */ l(Jf, { commands: [] }),
3823
+ /* @__PURE__ */ l(ua, { className: "absolute bottom-14 left-2 right-2" })
3799
3824
  ] })
3800
3825
  }
3801
3826
  )
3802
3827
  ] }) }) }) });
3803
3828
  }
3804
- function os(e, t) {
3805
- 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, v] = N(null);
3806
- R(() => {
3829
+ function ss(e, t) {
3830
+ const a = m((b) => b.chromeChatCollapsed) && t, n = m((b) => b.chromeChatWidth), o = m((b) => b.toggleChromeChatCollapsed), r = m((b) => b.setChromeChatWidth), [f, s] = N(null), [c, g] = N(void 0), [u, v] = N(null);
3831
+ P(() => {
3807
3832
  if (f)
3808
- return es(f, g);
3833
+ return os(f, g);
3809
3834
  }, [f]);
3810
- const x = Z(m?.current ?? n, c), E = F(() => Rr(a, x), [a, x]), P = ya((p) => e?.(p));
3811
- return R(() => {
3812
- P(E);
3813
- }, [E]), {
3835
+ const x = Z(u?.current ?? n, c), I = F(() => Or(a, x), [a, x]), R = _a((b) => e?.(b));
3836
+ return P(() => {
3837
+ R(I);
3838
+ }, [I]), {
3814
3839
  setFrame: s,
3815
3840
  collapsed: a,
3816
- state: E,
3817
- dragging: m !== null,
3841
+ state: I,
3842
+ dragging: u !== null,
3818
3843
  toggleCollapsed: o,
3819
- onPointerDown: (p) => {
3820
- p.button === 0 && (p.preventDefault(), p.currentTarget.setPointerCapture(p.pointerId), v({ pointerId: p.pointerId, startX: p.clientX, startWidth: x, current: x }));
3844
+ onPointerDown: (b) => {
3845
+ b.button === 0 && (b.preventDefault(), b.currentTarget.setPointerCapture(b.pointerId), v({ pointerId: b.pointerId, startX: b.clientX, startWidth: x, current: x }));
3821
3846
  },
3822
- onPointerMove: (p) => {
3823
- !m || m.pointerId !== p.pointerId || v({ ...m, current: ea(m.startWidth, m.startX, p.clientX, c) });
3847
+ onPointerMove: (b) => {
3848
+ !u || u.pointerId !== b.pointerId || v({ ...u, current: ta(u.startWidth, u.startX, b.clientX, c) });
3824
3849
  },
3825
- onPointerEnd: (p) => {
3826
- if (!m || m.pointerId !== p.pointerId) return;
3827
- const T = ea(m.startWidth, m.startX, p.clientX, c);
3850
+ onPointerEnd: (b) => {
3851
+ if (!u || u.pointerId !== b.pointerId) return;
3852
+ const T = ta(u.startWidth, u.startX, b.clientX, c);
3828
3853
  v(null), T !== n && r(T);
3829
3854
  },
3830
- onKeyDown: (p) => {
3831
- const T = Pr(x, p.key, c);
3832
- T !== null && (p.preventDefault(), T !== n && r(T));
3855
+ onKeyDown: (b) => {
3856
+ const T = Lr(x, b.key, c);
3857
+ T !== null && (b.preventDefault(), T !== n && r(T));
3833
3858
  }
3834
3859
  };
3835
3860
  }
3836
3861
  export {
3837
- _s as RoomChrome
3862
+ xs as RoomChrome
3838
3863
  };
3839
3864
  //# sourceMappingURL=room-chrome.js.map