@hadoku/watchparty-ui 0.45.27 → 0.45.28
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.
- package/dist/chunks/{AdminPanel-DwCWmVfW.js → AdminPanel-CqJPu1ee.js} +4 -4
- package/dist/chunks/{AdminPanel-DwCWmVfW.js.map → AdminPanel-CqJPu1ee.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-kz_YdaqY.js → MediaDrawer-CXffVb5D.js} +4 -4
- package/dist/chunks/{MediaDrawer-kz_YdaqY.js.map → MediaDrawer-CXffVb5D.js.map} +1 -1
- package/dist/chunks/{PlaylistPanel-DEEnr7Mj.js → PlaylistPanel-Ck8PUq7r.js} +3 -3
- package/dist/chunks/{PlaylistPanel-DEEnr7Mj.js.map → PlaylistPanel-Ck8PUq7r.js.map} +1 -1
- package/dist/chunks/{Room-DgBCVk-f.js → Room-CQy_wCnX.js} +458 -458
- package/dist/chunks/Room-CQy_wCnX.js.map +1 -0
- package/dist/chunks/{index-DOW8Etk-.js → index-CXl-xAUD.js} +2 -2
- package/dist/chunks/{index-DOW8Etk-.js.map → index-CXl-xAUD.js.map} +1 -1
- package/dist/chunks/{submissionsApi-D2UlQjUa.js → submissionsApi-DFGFSika.js} +2 -2
- package/dist/chunks/{submissionsApi-D2UlQjUa.js.map → submissionsApi-DFGFSika.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/room-chrome.css +125 -0
- package/dist/room-chrome.js +529 -528
- package/dist/room-chrome.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/Room-DgBCVk-f.js.map +0 -1
package/dist/room-chrome.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx as c, jsxs as v, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
-
import Pe, { useState as R, useRef as K, useMemo as J, useCallback as k, useEffect as N, createContext as rt, useContext as
|
|
2
|
+
import Pe, { useState as R, useRef as K, useMemo as J, useCallback as k, useEffect as N, createContext as rt, useContext as Kt, useSyncExternalStore as Ln, useId as jn, useEffectEvent as Wt } from "react";
|
|
3
3
|
import { themePrefs as ie, Icon as Un, THEMES as Fn, useHadokuThemeOptional as Hn } from "@wolffm/themes";
|
|
4
4
|
import { z as o } from "zod";
|
|
5
5
|
import { createCdnClient as $n, kindOfType as Bn, MAX_BYTES as Gn, measureImage as qn, filesFromClipboard as Vn, filesFromDrop as Kn, CdnError as ze } from "@wolffm/cdn-client";
|
|
6
|
-
import { ensureCosmeticsStyles as Wn, cleanWorn as Yn, decorHtml as zn, messageHtml as Xn, nameHtml as Jn } from "@wolffm/prefs-client/cosmetics";
|
|
7
|
-
import { create as
|
|
8
|
-
import { createPrefsClient as
|
|
9
|
-
import { io as
|
|
10
|
-
import { createAvatarClient as
|
|
11
|
-
import { resolveIdentityReassert as
|
|
12
|
-
import { createPortal as
|
|
13
|
-
import { useCatalogueSearch as
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
return typeof e == "string" &&
|
|
17
|
-
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const Ie = o.enum(["S", "A", "B", "C", "D", "F"]),
|
|
6
|
+
import { ensureCosmeticsStyles as Wn, cleanWorn as Yn, decorHtml as zn, messageHtml as Xn, nameHtml as Jn, finishReveal as Zn } from "@wolffm/prefs-client/cosmetics";
|
|
7
|
+
import { create as Qn } from "zustand";
|
|
8
|
+
import { createPrefsClient as er, getDeviceId as tr, DEVICE_ID_KEY as nr } from "@wolffm/prefs-client";
|
|
9
|
+
import { io as rr } from "socket.io-client";
|
|
10
|
+
import { createAvatarClient as or, AvatarError as _t } from "@wolffm/prefs-client/avatar";
|
|
11
|
+
import { resolveIdentityReassert as ar } from "@wolffm/rooms-protocol";
|
|
12
|
+
import { createPortal as ir } from "react-dom";
|
|
13
|
+
import { useCatalogueSearch as sr } from "@wolffm/cdn-client/react";
|
|
14
|
+
const Yt = "https://cdn.hadoku.me", zt = /^[0-9a-f]{64}\.(?:png|jpe?g|gif|webp|avif)$/;
|
|
15
|
+
function ot(e) {
|
|
16
|
+
return typeof e == "string" && zt.test(e);
|
|
17
|
+
}
|
|
18
|
+
const at = 8080, Xt = 5173, lr = "/watchparty/ws", Jt = 500, cr = 1e3, Y = 4, Zt = typeof process < "u" && process.env ? process.env : {};
|
|
19
|
+
Zt.PRODUCTION_UI_URL;
|
|
20
|
+
Zt.PRODUCTION_SERVER_URL;
|
|
21
|
+
const Ie = o.enum(["S", "A", "B", "C", "D", "F"]), xt = 2e4, dr = 300;
|
|
22
22
|
o.object({
|
|
23
23
|
name: o.string().min(1).max(32).optional(),
|
|
24
24
|
sprite: o.string().min(1).max(32).optional(),
|
|
@@ -45,7 +45,7 @@ const _ = {
|
|
|
45
45
|
// 'ready_state' here = playback-readiness gate (distinct from READY_EVENTS.STATE = "ready check" UX feature)
|
|
46
46
|
READY_STATE: "ready_state",
|
|
47
47
|
ERROR: "error"
|
|
48
|
-
},
|
|
48
|
+
}, ur = o.enum(["play", "pause", "seek", "load", "home"]), mr = o.object({
|
|
49
49
|
framed: o.boolean(),
|
|
50
50
|
depth: o.number().int().nonnegative().max(10)
|
|
51
51
|
});
|
|
@@ -53,7 +53,7 @@ o.object({
|
|
|
53
53
|
room_key: o.string(),
|
|
54
54
|
name: o.string().min(1).max(32).optional(),
|
|
55
55
|
sprite: o.string().min(1).max(32).optional(),
|
|
56
|
-
embed:
|
|
56
|
+
embed: mr.optional(),
|
|
57
57
|
/** Which media-delivery path this client resolved to ('range' | 'fragment').
|
|
58
58
|
* Optional so older clients still validate. Reported so a party's logs can be split by
|
|
59
59
|
* arm — without it an A/B rollout is unmeasurable, exactly as entry path was before
|
|
@@ -101,13 +101,13 @@ o.object({
|
|
|
101
101
|
});
|
|
102
102
|
o.object({
|
|
103
103
|
client_seq: o.number().int().positive(),
|
|
104
|
-
kind:
|
|
104
|
+
kind: ur,
|
|
105
105
|
to_ms: o.number().int().nonnegative().optional(),
|
|
106
106
|
media_id: o.string().optional()
|
|
107
107
|
// leader_id removed - not needed since set_leader control was removed
|
|
108
108
|
});
|
|
109
|
-
const
|
|
110
|
-
key: o.string().regex(
|
|
109
|
+
const Qt = o.object({
|
|
110
|
+
key: o.string().regex(zt, "not a CDN image key"),
|
|
111
111
|
/**
|
|
112
112
|
* Intrinsic pixels, or **0 meaning "unknown"**.
|
|
113
113
|
*
|
|
@@ -120,8 +120,8 @@ const en = o.object({
|
|
|
120
120
|
* text went with it, with nothing said. Widening is backward compatible —
|
|
121
121
|
* every message already in history carries positive dimensions.
|
|
122
122
|
*/
|
|
123
|
-
w: o.number().int().nonnegative().max(
|
|
124
|
-
h: o.number().int().nonnegative().max(
|
|
123
|
+
w: o.number().int().nonnegative().max(xt),
|
|
124
|
+
h: o.number().int().nonnegative().max(xt),
|
|
125
125
|
/**
|
|
126
126
|
* Human-readable description, rendered as the `alt` text.
|
|
127
127
|
*
|
|
@@ -135,14 +135,14 @@ const en = o.object({
|
|
|
135
135
|
* value only, never as markup. Bounded so one message cannot carry a
|
|
136
136
|
* paragraph; the library's own titles run well under this.
|
|
137
137
|
*/
|
|
138
|
-
title: o.string().max(
|
|
138
|
+
title: o.string().max(dr).optional()
|
|
139
139
|
});
|
|
140
140
|
o.object({
|
|
141
|
-
text: o.string().max(
|
|
141
|
+
text: o.string().max(Jt),
|
|
142
142
|
style: o.string().max(64).optional(),
|
|
143
|
-
images: o.array(
|
|
143
|
+
images: o.array(Qt).max(Y).optional()
|
|
144
144
|
}).refine((e) => e.text.length > 0 || (e.images?.length ?? 0) > 0, { message: "message must carry text or at least one image" });
|
|
145
|
-
const
|
|
145
|
+
const fr = o.enum(["join", "leave", "media_change", "identity_change", "recap"]);
|
|
146
146
|
o.object({
|
|
147
147
|
id: o.string(),
|
|
148
148
|
client_id: o.string(),
|
|
@@ -155,11 +155,11 @@ o.object({
|
|
|
155
155
|
ts: o.number(),
|
|
156
156
|
// Optional so a client on an older bundle still validates a message that
|
|
157
157
|
// has none, and so system messages (which never carry images) stay unchanged.
|
|
158
|
-
images: o.array(
|
|
158
|
+
images: o.array(Qt).max(Y).optional(),
|
|
159
159
|
isSystem: o.boolean().optional(),
|
|
160
|
-
systemType:
|
|
160
|
+
systemType: fr.optional()
|
|
161
161
|
});
|
|
162
|
-
const
|
|
162
|
+
const pr = o.object({
|
|
163
163
|
avg_download_rate_bps: o.number().nonnegative(),
|
|
164
164
|
buffered_ahead_ms: o.number().nonnegative(),
|
|
165
165
|
rtt_ms: o.number().nonnegative(),
|
|
@@ -201,7 +201,7 @@ const fr = o.object({
|
|
|
201
201
|
* socket shows here as a growing number while everything else looks fine. */
|
|
202
202
|
pong_age_ms: o.number().int().nonnegative().optional(),
|
|
203
203
|
reported_at: o.number().int().nonnegative()
|
|
204
|
-
}),
|
|
204
|
+
}), hr = pr.extend({
|
|
205
205
|
client_id: o.string(),
|
|
206
206
|
name: o.string(),
|
|
207
207
|
sprite_id: o.string().nullable(),
|
|
@@ -212,10 +212,10 @@ const fr = o.object({
|
|
|
212
212
|
stale_ms: o.number().int().nonnegative().optional()
|
|
213
213
|
});
|
|
214
214
|
o.object({
|
|
215
|
-
clients: o.array(
|
|
215
|
+
clients: o.array(hr),
|
|
216
216
|
server_ts: o.number().int().nonnegative()
|
|
217
217
|
});
|
|
218
|
-
const
|
|
218
|
+
const gr = o.object({
|
|
219
219
|
client_id: o.string(),
|
|
220
220
|
sprite_id: o.string().nullable(),
|
|
221
221
|
name: o.string(),
|
|
@@ -233,13 +233,13 @@ const hr = o.object({
|
|
|
233
233
|
video_ready_state: o.number().int().default(-1)
|
|
234
234
|
});
|
|
235
235
|
o.object({
|
|
236
|
-
clients: o.array(
|
|
236
|
+
clients: o.array(gr),
|
|
237
237
|
server_ts: o.number().int().nonnegative()
|
|
238
238
|
});
|
|
239
239
|
o.object({
|
|
240
240
|
media_id: o.string()
|
|
241
241
|
});
|
|
242
|
-
const
|
|
242
|
+
const it = o.enum(["super_upvote", "upvote", "mid", "downvote"]), yr = o.object({
|
|
243
243
|
mediaId: o.string(),
|
|
244
244
|
displayName: o.string(),
|
|
245
245
|
// Enrichment fields — present for flat-playlist ingest output, absent for
|
|
@@ -250,11 +250,11 @@ const st = o.enum(["super_upvote", "upvote", "mid", "downvote"]), gr = o.object(
|
|
|
250
250
|
durationMs: o.number().optional(),
|
|
251
251
|
uploadDate: o.string().optional()
|
|
252
252
|
// YouTube upload date 'YYYY-MM-DD'; drives playlist order
|
|
253
|
-
}),
|
|
253
|
+
}), br = o.enum(["basic", "vote"]), en = o.object({
|
|
254
254
|
id: o.string(),
|
|
255
255
|
name: o.string(),
|
|
256
|
-
type:
|
|
257
|
-
videos: o.array(
|
|
256
|
+
type: br.default("vote"),
|
|
257
|
+
videos: o.array(yr),
|
|
258
258
|
cover: o.string().optional()
|
|
259
259
|
// media-relative path to the playlist cover image
|
|
260
260
|
});
|
|
@@ -263,28 +263,28 @@ o.object({ index: o.number().int().min(0) });
|
|
|
263
263
|
o.object({
|
|
264
264
|
playlistId: o.string(),
|
|
265
265
|
mediaId: o.string(),
|
|
266
|
-
vote:
|
|
266
|
+
vote: it
|
|
267
267
|
});
|
|
268
268
|
o.object({ voterKey: o.string().min(1).max(128) });
|
|
269
269
|
o.object({ playlistId: o.string(), mediaIds: o.array(o.string()) });
|
|
270
270
|
o.object({
|
|
271
|
-
playlist:
|
|
271
|
+
playlist: en.nullable(),
|
|
272
272
|
activeIndex: o.number().int().nullable(),
|
|
273
|
-
myVotes: o.record(o.string(),
|
|
273
|
+
myVotes: o.record(o.string(), it)
|
|
274
274
|
// mediaId -> VoteValue
|
|
275
275
|
});
|
|
276
|
-
const
|
|
276
|
+
const vr = o.object({
|
|
277
277
|
clientId: o.string(),
|
|
278
278
|
name: o.string(),
|
|
279
279
|
votedCount: o.number().int().nonnegative(),
|
|
280
280
|
totalVideos: o.number().int().nonnegative()
|
|
281
281
|
});
|
|
282
282
|
o.object({
|
|
283
|
-
progress: o.array(
|
|
283
|
+
progress: o.array(vr)
|
|
284
284
|
});
|
|
285
285
|
o.object({
|
|
286
|
-
playlist:
|
|
287
|
-
votes: o.record(o.string(), o.record(o.string(),
|
|
286
|
+
playlist: en,
|
|
287
|
+
votes: o.record(o.string(), o.record(o.string(), it)),
|
|
288
288
|
// votes[clientId][mediaId]
|
|
289
289
|
names: o.record(o.string(), o.string()),
|
|
290
290
|
// clientId -> display name
|
|
@@ -305,17 +305,17 @@ const be = {
|
|
|
305
305
|
RESULTS: "playlist_results",
|
|
306
306
|
/** Server -> the removed voter: forget the ballot you hold in localStorage. */
|
|
307
307
|
VOTES_CLEARED: "playlist_votes_cleared"
|
|
308
|
-
},
|
|
308
|
+
}, tn = o.object({
|
|
309
309
|
id: o.string(),
|
|
310
310
|
displayName: o.string(),
|
|
311
311
|
thumbnail: o.string().optional()
|
|
312
312
|
});
|
|
313
313
|
o.object({
|
|
314
|
-
items: o.array(
|
|
314
|
+
items: o.array(tn)
|
|
315
315
|
});
|
|
316
|
-
const
|
|
317
|
-
o.object({ board:
|
|
318
|
-
const
|
|
316
|
+
const nn = o.partialRecord(Ie, o.array(o.string()));
|
|
317
|
+
o.object({ board: nn });
|
|
318
|
+
const Sr = o.object({
|
|
319
319
|
mediaId: o.string(),
|
|
320
320
|
tier: Ie,
|
|
321
321
|
absoluteTier: Ie,
|
|
@@ -328,8 +328,8 @@ const vr = o.object({
|
|
|
328
328
|
// opaque voterId -> the letter they gave
|
|
329
329
|
});
|
|
330
330
|
o.object({
|
|
331
|
-
items: o.array(
|
|
332
|
-
placed: o.array(
|
|
331
|
+
items: o.array(tn),
|
|
332
|
+
placed: o.array(Sr),
|
|
333
333
|
unrated: o.array(o.string()),
|
|
334
334
|
spread: o.number(),
|
|
335
335
|
nudged: o.boolean(),
|
|
@@ -339,9 +339,9 @@ o.object({
|
|
|
339
339
|
* browser on a newer bundle still reads an older server's board. */
|
|
340
340
|
pictures: o.record(o.string(), o.string()).optional(),
|
|
341
341
|
voterCount: o.number().int().nonnegative(),
|
|
342
|
-
myBoard:
|
|
342
|
+
myBoard: nn
|
|
343
343
|
});
|
|
344
|
-
const
|
|
344
|
+
const wr = {
|
|
345
345
|
/** Broadcast to EVERY connected socket when anyone saves. Carries no board —
|
|
346
346
|
* it is a "re-fetch" ping, because the shared result is identical for all
|
|
347
347
|
* viewers but `myBoard` is not, and one payload cannot serve both. */
|
|
@@ -354,10 +354,10 @@ o.object({
|
|
|
354
354
|
ready: o.array(o.string())
|
|
355
355
|
// clientIds who have flagged ready
|
|
356
356
|
});
|
|
357
|
-
const
|
|
357
|
+
const _r = {
|
|
358
358
|
STATE: "ready_check_state"
|
|
359
359
|
// distinct from buffer-readiness 'ready_state'
|
|
360
|
-
},
|
|
360
|
+
}, rn = {
|
|
361
361
|
ACTIVE: "game_active",
|
|
362
362
|
// server -> room (the open game id; null = none)
|
|
363
363
|
SYNC: "game_sync"
|
|
@@ -369,7 +369,7 @@ o.object({
|
|
|
369
369
|
o.object({
|
|
370
370
|
gameId: o.string().nullable()
|
|
371
371
|
});
|
|
372
|
-
const
|
|
372
|
+
const xr = [
|
|
373
373
|
{
|
|
374
374
|
id: "fantasy",
|
|
375
375
|
characters: [
|
|
@@ -413,37 +413,37 @@ const _r = [
|
|
|
413
413
|
{ id: "mentor", color: "#e1e0dc" }
|
|
414
414
|
]
|
|
415
415
|
}
|
|
416
|
-
],
|
|
417
|
-
function
|
|
418
|
-
const t =
|
|
416
|
+
], st = xr.flatMap((e) => e.characters), je = st.map((e) => e.id), Ir = Object.fromEntries(st.map((e) => [e.id, e.color])), Cr = Object.fromEntries(st.map((e) => [e.id, "rev" in e ? e.rev : 1]));
|
|
417
|
+
function Tr(e) {
|
|
418
|
+
const t = Cr[e];
|
|
419
419
|
return `/media/sprites/square_${e}.png${t > 1 ? `?v=${t}` : ""}`;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function lt(e) {
|
|
422
422
|
return !!e && je.includes(e);
|
|
423
423
|
}
|
|
424
|
-
const
|
|
425
|
-
function Er(e) {
|
|
426
|
-
return typeof e == "string" && Ar.includes(e);
|
|
427
|
-
}
|
|
424
|
+
const Ar = 5e3, on = { mode: "off", percent: 0 }, Er = ["off", "on", "ab"];
|
|
428
425
|
function kr(e) {
|
|
429
|
-
|
|
430
|
-
return { mode: n, percent: a };
|
|
426
|
+
return typeof e == "string" && Er.includes(e);
|
|
431
427
|
}
|
|
432
428
|
function Nr(e) {
|
|
429
|
+
const t = e && typeof e == "object" ? e : {}, n = kr(t.mode) ? t.mode : on.mode, r = Number(t.percent), a = Number.isFinite(r) ? Math.min(100, Math.max(0, Math.round(r))) : 0;
|
|
430
|
+
return { mode: n, percent: a };
|
|
431
|
+
}
|
|
432
|
+
function Pr(e) {
|
|
433
433
|
let t = 2166136261;
|
|
434
434
|
for (let n = 0; n < e.length; n++)
|
|
435
435
|
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
436
436
|
return t >>> 0;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function Rr(e, t, n) {
|
|
439
439
|
if (n === !0)
|
|
440
440
|
return "fragment";
|
|
441
441
|
if (n === !1)
|
|
442
442
|
return "range";
|
|
443
|
-
const r =
|
|
444
|
-
return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t &&
|
|
443
|
+
const r = Nr(e);
|
|
444
|
+
return r.mode === "on" ? "fragment" : r.mode === "off" || r.percent <= 0 ? "range" : r.percent >= 100 || t && Pr(t) % 100 < r.percent ? "fragment" : "range";
|
|
445
445
|
}
|
|
446
|
-
const
|
|
446
|
+
const an = o.enum(["url", "magnet", "upload"]), Or = o.enum([
|
|
447
447
|
"pending",
|
|
448
448
|
"approved",
|
|
449
449
|
"fetching",
|
|
@@ -451,7 +451,7 @@ const sn = o.enum(["url", "magnet", "upload"]), Rr = o.enum([
|
|
|
451
451
|
"ready",
|
|
452
452
|
"rejected",
|
|
453
453
|
"failed"
|
|
454
|
-
]),
|
|
454
|
+
]), It = {
|
|
455
455
|
pending: ["approved", "rejected"],
|
|
456
456
|
approved: ["fetching", "rejected", "failed"],
|
|
457
457
|
fetching: ["ingesting", "failed"],
|
|
@@ -460,12 +460,12 @@ const sn = o.enum(["url", "magnet", "upload"]), Rr = o.enum([
|
|
|
460
460
|
rejected: [],
|
|
461
461
|
failed: ["approved"]
|
|
462
462
|
};
|
|
463
|
-
Object.keys(
|
|
464
|
-
const
|
|
463
|
+
Object.keys(It).filter((e) => It[e].length === 0);
|
|
464
|
+
const Dr = o.object({
|
|
465
465
|
id: o.string().min(1),
|
|
466
466
|
/** Stable userId from whoami. Never the raw `X-User-Key`. */
|
|
467
467
|
ownerUserId: o.string().min(1),
|
|
468
|
-
kind:
|
|
468
|
+
kind: an,
|
|
469
469
|
/** The magnet URI, the https URL, or the filetransfer binding id. */
|
|
470
470
|
source: o.string().min(1),
|
|
471
471
|
title: o.string().optional(),
|
|
@@ -480,7 +480,7 @@ const Or = o.object({
|
|
|
480
480
|
* misroute the copy.
|
|
481
481
|
*/
|
|
482
482
|
series: o.string().optional(),
|
|
483
|
-
state:
|
|
483
|
+
state: Or,
|
|
484
484
|
createdAt: o.number().int().nonnegative(),
|
|
485
485
|
updatedAt: o.number().int().nonnegative(),
|
|
486
486
|
/** Why it failed, or why an operator rejected it. */
|
|
@@ -488,19 +488,19 @@ const Or = o.object({
|
|
|
488
488
|
/** Size once known. 0 means "known to be empty"; absent means "not yet known" —
|
|
489
489
|
* the same distinction `chatImages` draws for image dimensions. */
|
|
490
490
|
bytes: o.number().int().nonnegative().optional()
|
|
491
|
-
}),
|
|
491
|
+
}), Mr = 4096, sn = 300, Lr = 100;
|
|
492
492
|
o.object({
|
|
493
|
-
kind:
|
|
494
|
-
source: o.string().min(1).max(
|
|
495
|
-
title: o.string().min(1).max(
|
|
493
|
+
kind: an,
|
|
494
|
+
source: o.string().min(1).max(Mr),
|
|
495
|
+
title: o.string().min(1).max(sn).optional(),
|
|
496
496
|
/** Required for `kind: 'magnet'` by `checkSource`; ignored for `url`/`upload`. */
|
|
497
|
-
series: o.string().min(1).max(
|
|
497
|
+
series: o.string().min(1).max(Lr).optional()
|
|
498
498
|
});
|
|
499
499
|
o.object({
|
|
500
|
-
reason: o.string().min(1).max(
|
|
500
|
+
reason: o.string().min(1).max(sn).optional()
|
|
501
501
|
});
|
|
502
502
|
o.object({
|
|
503
|
-
submissions: o.array(
|
|
503
|
+
submissions: o.array(Dr)
|
|
504
504
|
});
|
|
505
505
|
o.object({
|
|
506
506
|
error: o.literal("submissions/quota_exceeded"),
|
|
@@ -509,26 +509,26 @@ o.object({
|
|
|
509
509
|
/** The cap that was applied, from the server's config. */
|
|
510
510
|
capBytes: o.number().int().nonnegative()
|
|
511
511
|
});
|
|
512
|
-
const
|
|
513
|
-
function
|
|
512
|
+
const jr = /^[a-z0-9][a-z0-9-]{0,31}$/, Ct = "https://game-catalog.invalid";
|
|
513
|
+
function Ur(e) {
|
|
514
514
|
if (!e.startsWith("/") || e.startsWith("//") || /[\\\s]/.test(e) || [...e].some((t) => t.charCodeAt(0) < 32 || t.charCodeAt(0) === 127))
|
|
515
515
|
return !1;
|
|
516
516
|
try {
|
|
517
|
-
return new URL(e,
|
|
517
|
+
return new URL(e, Ct).origin === Ct;
|
|
518
518
|
} catch {
|
|
519
519
|
return !1;
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
const
|
|
522
|
+
const ln = o.string().min(2).max(512).refine(Ur, {
|
|
523
523
|
message: "must be a root-relative path on the page origin (e.g. /cardtable/embed/x.js)"
|
|
524
|
-
}),
|
|
525
|
-
id: o.string().regex(
|
|
524
|
+
}), Fr = {
|
|
525
|
+
id: o.string().regex(jr),
|
|
526
526
|
name: o.string().min(1).max(64),
|
|
527
|
-
cover:
|
|
528
|
-
},
|
|
529
|
-
o.array(
|
|
530
|
-
const
|
|
531
|
-
source:
|
|
527
|
+
cover: ln.optional()
|
|
528
|
+
}, Hr = o.object({ ...Fr, kind: o.literal("module"), url: ln }).strict();
|
|
529
|
+
o.array(Hr).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" });
|
|
530
|
+
const ct = o.enum(["anilist", "tmdb"]), $r = o.object({
|
|
531
|
+
source: ct,
|
|
532
532
|
/** The provider's own id, as a string (AniList and TMDB both use integers). */
|
|
533
533
|
id: o.string(),
|
|
534
534
|
title: o.string(),
|
|
@@ -549,11 +549,11 @@ const dt = o.enum(["anilist", "tmdb"]), Hr = o.object({
|
|
|
549
549
|
addable: o.boolean()
|
|
550
550
|
});
|
|
551
551
|
o.object({
|
|
552
|
-
results: o.array(
|
|
552
|
+
results: o.array($r),
|
|
553
553
|
/** Providers that answered. TMDB is absent when no token is configured. */
|
|
554
|
-
sources: o.array(
|
|
554
|
+
sources: o.array(ct)
|
|
555
555
|
});
|
|
556
|
-
const
|
|
556
|
+
const Br = o.object({
|
|
557
557
|
id: o.string(),
|
|
558
558
|
url: o.string(),
|
|
559
559
|
title: o.string(),
|
|
@@ -561,30 +561,30 @@ const $r = o.object({
|
|
|
561
561
|
durationS: o.number().nullable(),
|
|
562
562
|
thumb: o.string().nullable()
|
|
563
563
|
});
|
|
564
|
-
o.object({ results: o.array(
|
|
564
|
+
o.object({ results: o.array(Br) });
|
|
565
565
|
o.object({
|
|
566
|
-
source:
|
|
566
|
+
source: ct,
|
|
567
567
|
id: o.string().regex(/^\d{1,12}$/)
|
|
568
568
|
});
|
|
569
569
|
o.object({ series: o.string(), title: o.string() });
|
|
570
|
-
let ve = null,
|
|
571
|
-
function
|
|
572
|
-
e.cdnBase && (
|
|
570
|
+
let ve = null, cn = Yt;
|
|
571
|
+
function Gr(e) {
|
|
572
|
+
e.cdnBase && (cn = e.cdnBase);
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
return
|
|
574
|
+
function dn() {
|
|
575
|
+
return cn.replace(/\/+$/, "");
|
|
576
576
|
}
|
|
577
577
|
function Ue() {
|
|
578
|
-
const e =
|
|
578
|
+
const e = dn();
|
|
579
579
|
return (!ve || ve.base !== e) && (ve = { base: e, client: $n({ cdnBase: e }) }), ve.client;
|
|
580
580
|
}
|
|
581
581
|
function Re(e) {
|
|
582
|
-
return !
|
|
582
|
+
return !ot(e) || !dn() ? null : Ue().urlFor(e);
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function qr(e) {
|
|
585
585
|
return e.kind === "file";
|
|
586
586
|
}
|
|
587
|
-
class
|
|
587
|
+
class un extends Error {
|
|
588
588
|
constructor(t) {
|
|
589
589
|
super(t), this.name = "ChatImageUploadError";
|
|
590
590
|
}
|
|
@@ -609,42 +609,42 @@ function Ce(e) {
|
|
|
609
609
|
return "Image upload failed";
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
-
function qr(e) {
|
|
613
|
-
return e instanceof ze ? Ce(e.reason) : e instanceof mn ? e.message : "Image upload failed";
|
|
614
|
-
}
|
|
615
612
|
function Vr(e) {
|
|
613
|
+
return e instanceof ze ? Ce(e.reason) : e instanceof un ? e.message : "Image upload failed";
|
|
614
|
+
}
|
|
615
|
+
function Kr(e) {
|
|
616
616
|
const t = e.type.toLowerCase().split(";")[0].trim();
|
|
617
617
|
return t && Bn(t) !== "image" ? Ce("unsupported-type") : e.size > Gn.image ? Ce("too-large") : e.size === 0 ? Ce("invalid") : null;
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function Wr(e) {
|
|
620
620
|
return Vn(e);
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function Yr(e) {
|
|
623
623
|
return Kn(e);
|
|
624
624
|
}
|
|
625
|
-
async function
|
|
625
|
+
async function zr(e) {
|
|
626
626
|
const t = await qn(e);
|
|
627
627
|
return { w: t?.width ?? 0, h: t?.height ?? 0 };
|
|
628
628
|
}
|
|
629
|
-
async function
|
|
629
|
+
async function Xr(e, t = {}) {
|
|
630
630
|
const n = await Ue().upload(e, { signal: t.signal });
|
|
631
|
-
if (!
|
|
632
|
-
throw new
|
|
631
|
+
if (!ot(n.key))
|
|
632
|
+
throw new un("Image upload returned an unusable key");
|
|
633
633
|
return { key: n.key, deduplicated: n.deduplicated === !0 };
|
|
634
634
|
}
|
|
635
|
-
async function
|
|
635
|
+
async function Jr(e, t = {}) {
|
|
636
636
|
const n = [];
|
|
637
637
|
for (const r of e) {
|
|
638
638
|
if (r.kind === "remote") {
|
|
639
639
|
n.push({ key: r.key, w: r.w, h: r.h, ...r.title ? { title: r.title } : {} });
|
|
640
640
|
continue;
|
|
641
641
|
}
|
|
642
|
-
const { key: a } = await
|
|
642
|
+
const { key: a } = await Xr(r.file, t);
|
|
643
643
|
n.push({ key: a, w: r.w, h: r.h });
|
|
644
644
|
}
|
|
645
645
|
return n;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Zr(e) {
|
|
648
648
|
return {
|
|
649
649
|
error: e instanceof Error ? e.message : String(e),
|
|
650
650
|
name: e instanceof Error ? e.name : typeof e,
|
|
@@ -652,19 +652,19 @@ function Jr(e) {
|
|
|
652
652
|
status: e instanceof ze ? e.status : void 0
|
|
653
653
|
};
|
|
654
654
|
}
|
|
655
|
-
const Xe = 240, X = 8,
|
|
656
|
-
function
|
|
655
|
+
const Xe = 240, X = 8, Qr = 28, mn = 240;
|
|
656
|
+
function eo(e, t, n) {
|
|
657
657
|
let r = t.left - Xe - X;
|
|
658
658
|
r < X && (r = t.right + X), r = Math.min(r, n.width - Xe - X), r = Math.max(X, r);
|
|
659
|
-
const a =
|
|
659
|
+
const a = mn + Qr;
|
|
660
660
|
let i = e.top + e.height / 2 - a / 2;
|
|
661
661
|
return i = Math.min(i, n.height - a - X), i = Math.max(X, i), { left: r, top: i };
|
|
662
662
|
}
|
|
663
|
-
const
|
|
664
|
-
function
|
|
665
|
-
const [r, a] = R(""), i = K(null), s = K(null), l = Ue(), { items: m, loading: h, error: u, hasMore: D, loadMore: M } =
|
|
663
|
+
const fn = "/dataplatform/api/memes", to = 120;
|
|
664
|
+
function no({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
665
|
+
const [r, a] = R(""), i = K(null), s = K(null), l = Ue(), { items: m, loading: h, error: u, hasMore: D, loadMore: M } = sr(
|
|
666
666
|
l,
|
|
667
|
-
|
|
667
|
+
fn,
|
|
668
668
|
r.trim()
|
|
669
669
|
), L = u?.reason ?? null, C = J(() => {
|
|
670
670
|
const x = /* @__PURE__ */ new Set();
|
|
@@ -679,12 +679,12 @@ function to({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
679
679
|
if (!he) return;
|
|
680
680
|
const ge = () => S({
|
|
681
681
|
item: x,
|
|
682
|
-
...
|
|
682
|
+
...eo(P.getBoundingClientRect(), he.getBoundingClientRect(), {
|
|
683
683
|
width: window.innerWidth,
|
|
684
684
|
height: window.innerHeight
|
|
685
685
|
})
|
|
686
686
|
});
|
|
687
|
-
I(), T ? ge() : b.current = window.setTimeout(ge,
|
|
687
|
+
I(), T ? ge() : b.current = window.setTimeout(ge, to);
|
|
688
688
|
},
|
|
689
689
|
[I]
|
|
690
690
|
);
|
|
@@ -702,7 +702,7 @@ function to({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
702
702
|
document.removeEventListener("keydown", x), document.removeEventListener("mousedown", P);
|
|
703
703
|
};
|
|
704
704
|
}, [e]);
|
|
705
|
-
const
|
|
705
|
+
const j = k((x) => {
|
|
706
706
|
t(x), e();
|
|
707
707
|
}, [t, e]), F = !h && !u && C.length === 0;
|
|
708
708
|
return /* @__PURE__ */ v(
|
|
@@ -750,7 +750,7 @@ function to({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
750
750
|
"button",
|
|
751
751
|
{
|
|
752
752
|
type: "button",
|
|
753
|
-
onClick: () =>
|
|
753
|
+
onClick: () => j(x),
|
|
754
754
|
title: x.title,
|
|
755
755
|
"data-testid": "meme-result",
|
|
756
756
|
onMouseEnter: (T) => {
|
|
@@ -813,7 +813,7 @@ function to({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
813
813
|
src: Re(p.item.key) ?? void 0,
|
|
814
814
|
alt: "",
|
|
815
815
|
className: "block w-full rounded bg-bg object-contain",
|
|
816
|
-
style: { height: "auto", maxHeight:
|
|
816
|
+
style: { height: "auto", maxHeight: mn }
|
|
817
817
|
}
|
|
818
818
|
),
|
|
819
819
|
p.item.title && /* One line. A long title must not change the box height, because
|
|
@@ -826,34 +826,34 @@ function to({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
826
826
|
}
|
|
827
827
|
);
|
|
828
828
|
}
|
|
829
|
-
function
|
|
830
|
-
return e ? /* @__PURE__ */ c(
|
|
829
|
+
function ro({ open: e, ...t }) {
|
|
830
|
+
return e ? /* @__PURE__ */ c(no, { ...t }) : null;
|
|
831
831
|
}
|
|
832
|
-
const
|
|
833
|
-
serverOrigin: `http://localhost:${
|
|
832
|
+
const dt = {
|
|
833
|
+
serverOrigin: `http://localhost:${at}`,
|
|
834
834
|
defaultRoomKey: "dev-room",
|
|
835
|
-
cdnBase:
|
|
835
|
+
cdnBase: Yt
|
|
836
836
|
};
|
|
837
|
-
let Te = { ...
|
|
838
|
-
function
|
|
837
|
+
let Te = { ...dt };
|
|
838
|
+
function oo(e) {
|
|
839
839
|
const t = Object.fromEntries(
|
|
840
840
|
Object.entries(e).filter(([n, r]) => r !== void 0)
|
|
841
841
|
);
|
|
842
|
-
Te = { ...Te, ...t },
|
|
842
|
+
Te = { ...Te, ...t }, Gr({ cdnBase: Te.cdnBase });
|
|
843
843
|
}
|
|
844
844
|
function fe() {
|
|
845
845
|
return Te;
|
|
846
846
|
}
|
|
847
|
-
const
|
|
848
|
-
function
|
|
847
|
+
const ao = rt(dt);
|
|
848
|
+
function io(e) {
|
|
849
849
|
return e.serverOrigin?.replace(/\/$/, "") || "";
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
return
|
|
851
|
+
function pn() {
|
|
852
|
+
return io(fe());
|
|
853
853
|
}
|
|
854
|
-
const
|
|
855
|
-
function
|
|
856
|
-
return
|
|
854
|
+
const hn = rt(null);
|
|
855
|
+
function so() {
|
|
856
|
+
return Kt(hn);
|
|
857
857
|
}
|
|
858
858
|
const ne = {
|
|
859
859
|
ANON_KEY: "watchparty_preferences",
|
|
@@ -875,7 +875,7 @@ function B(e) {
|
|
|
875
875
|
return null;
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function ut(e, t) {
|
|
879
879
|
try {
|
|
880
880
|
const n = Fe();
|
|
881
881
|
return n ? (n.setItem(e, t), !0) : !1;
|
|
@@ -883,7 +883,7 @@ function mt(e, t) {
|
|
|
883
883
|
return !1;
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
function
|
|
886
|
+
function lo() {
|
|
887
887
|
try {
|
|
888
888
|
const e = Fe();
|
|
889
889
|
if (!e) return [];
|
|
@@ -903,45 +903,45 @@ function Oe(e) {
|
|
|
903
903
|
} catch {
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
function
|
|
906
|
+
function co(e) {
|
|
907
907
|
const t = B(e);
|
|
908
908
|
return t === null ? null : t === "true" ? !0 : t === "false" ? !1 : null;
|
|
909
909
|
}
|
|
910
|
-
const
|
|
911
|
-
let
|
|
910
|
+
const gn = /* @__PURE__ */ new Map();
|
|
911
|
+
let yn = !1;
|
|
912
912
|
function He(e, t) {
|
|
913
|
-
|
|
913
|
+
gn.set(e, t), yn && bn(e, t);
|
|
914
914
|
}
|
|
915
|
-
function
|
|
916
|
-
|
|
917
|
-
for (const [e, t] of
|
|
915
|
+
function uo() {
|
|
916
|
+
yn = !0;
|
|
917
|
+
for (const [e, t] of gn) bn(e, t);
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function bn(e, t) {
|
|
920
920
|
typeof window > "u" || (window[e] = t);
|
|
921
921
|
}
|
|
922
|
-
const se = [],
|
|
922
|
+
const se = [], mo = 500;
|
|
923
923
|
let Ae = [], Je = null;
|
|
924
|
-
const
|
|
924
|
+
const fo = 1e3, po = 200;
|
|
925
925
|
let Ze = null;
|
|
926
|
-
function
|
|
926
|
+
function vn(e) {
|
|
927
927
|
Ze = e;
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function Sn() {
|
|
930
930
|
return B(ne.REPORT_LOGS_FLAG) === "true";
|
|
931
931
|
}
|
|
932
|
-
function
|
|
932
|
+
function ho() {
|
|
933
933
|
if (typeof window > "u") return !1;
|
|
934
934
|
if (window.__WP_DEBUG__ || new URLSearchParams(window.location.search).get("debug") === "true") return !0;
|
|
935
935
|
const t = B(ne.DEBUG_FLAG);
|
|
936
936
|
return t !== null && t !== "false";
|
|
937
937
|
}
|
|
938
|
-
function
|
|
938
|
+
function go() {
|
|
939
939
|
const e = B(ne.DEBUG_FLAG);
|
|
940
940
|
if (!e || e === "true") return null;
|
|
941
941
|
const t = e.split(",").map((n) => n.trim().toLowerCase()).filter(Boolean);
|
|
942
942
|
return t.length > 0 ? new Set(t) : null;
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function yo() {
|
|
945
945
|
return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
|
|
946
946
|
hour12: !1,
|
|
947
947
|
hour: "2-digit",
|
|
@@ -950,8 +950,8 @@ function go() {
|
|
|
950
950
|
fractionalSecondDigits: 3
|
|
951
951
|
});
|
|
952
952
|
}
|
|
953
|
-
function
|
|
954
|
-
se.push(e), se.length >
|
|
953
|
+
function bo(e) {
|
|
954
|
+
se.push(e), se.length > mo && se.shift();
|
|
955
955
|
}
|
|
956
956
|
const $e = {
|
|
957
957
|
debug: "color: #64748b; font-weight: normal;",
|
|
@@ -960,14 +960,14 @@ const $e = {
|
|
|
960
960
|
category: "color: #3b82f6; font-weight: bold;",
|
|
961
961
|
time: "color: #6b7280; font-weight: normal;"
|
|
962
962
|
};
|
|
963
|
-
function
|
|
963
|
+
function vo(e) {
|
|
964
964
|
try {
|
|
965
965
|
return JSON.stringify(e);
|
|
966
966
|
} catch {
|
|
967
967
|
return "[unserializable]";
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function mt(e, t, n, r, a, i, s) {
|
|
971
971
|
const l = {
|
|
972
972
|
level: e,
|
|
973
973
|
category: a,
|
|
@@ -975,12 +975,12 @@ function ft(e, t, n, r, a, i, s) {
|
|
|
975
975
|
data: s,
|
|
976
976
|
timestamp: Date.now()
|
|
977
977
|
};
|
|
978
|
-
if (
|
|
979
|
-
if (!
|
|
980
|
-
const u =
|
|
978
|
+
if (bo(l), (n || Sn()) && Tt(l), !r) {
|
|
979
|
+
if (!ho()) return;
|
|
980
|
+
const u = go();
|
|
981
981
|
if (u && !u.has(a.toLowerCase())) return;
|
|
982
982
|
}
|
|
983
|
-
const m =
|
|
983
|
+
const m = yo(), h = s !== void 0 ? " " + vo(s) : "";
|
|
984
984
|
t(
|
|
985
985
|
`%c[${m}]%c [${a}]%c ${i}${h}`,
|
|
986
986
|
$e.time,
|
|
@@ -989,33 +989,33 @@ function ft(e, t, n, r, a, i, s) {
|
|
|
989
989
|
);
|
|
990
990
|
}
|
|
991
991
|
function d(e, t, n) {
|
|
992
|
-
|
|
992
|
+
mt("debug", console.log, !1, !1, e, t, n);
|
|
993
993
|
}
|
|
994
994
|
function A(e, t, n) {
|
|
995
|
-
|
|
995
|
+
mt("warn", console.warn, !0, !1, e, t, n);
|
|
996
996
|
}
|
|
997
997
|
function Ee(e, t, n) {
|
|
998
|
-
|
|
998
|
+
mt("error", console.error, !0, !0, e, t, n);
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function So() {
|
|
1001
1001
|
return [...se];
|
|
1002
1002
|
}
|
|
1003
|
-
function
|
|
1003
|
+
function wo() {
|
|
1004
1004
|
se.length = 0;
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1006
|
+
function _o(e) {
|
|
1007
1007
|
const t = e && e.length > 0 ? e.join(",") : "true";
|
|
1008
|
-
|
|
1008
|
+
ut(ne.DEBUG_FLAG, t), console.log("[wp] Debug mode enabled");
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function xo() {
|
|
1011
1011
|
Oe(ne.DEBUG_FLAG), console.log("[wp] Debug mode disabled");
|
|
1012
1012
|
}
|
|
1013
|
-
const
|
|
1014
|
-
function
|
|
1013
|
+
const Io = 1024, Co = 5e4;
|
|
1014
|
+
function To(e) {
|
|
1015
1015
|
if (e == null) return e;
|
|
1016
1016
|
try {
|
|
1017
1017
|
const t = JSON.stringify(e);
|
|
1018
|
-
if (t.length <=
|
|
1018
|
+
if (t.length <= Io) return e;
|
|
1019
1019
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
1020
1020
|
const n = {};
|
|
1021
1021
|
for (const [r, a] of Object.entries(e)) {
|
|
@@ -1029,7 +1029,7 @@ function Co(e) {
|
|
|
1029
1029
|
return "[unserializable]";
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
|
-
async function
|
|
1032
|
+
async function Ao() {
|
|
1033
1033
|
if (Ae.length === 0) return;
|
|
1034
1034
|
const e = Ae;
|
|
1035
1035
|
Ae = [], Je = null;
|
|
@@ -1037,13 +1037,13 @@ async function To() {
|
|
|
1037
1037
|
let n = fe().serverOrigin || "";
|
|
1038
1038
|
if ((n === "/" || !n) && typeof window < "u") {
|
|
1039
1039
|
const l = window.location;
|
|
1040
|
-
(l.hostname === "localhost" || l.hostname === "127.0.0.1") && l.port === String(
|
|
1040
|
+
(l.hostname === "localhost" || l.hostname === "127.0.0.1") && l.port === String(Xt) ? n = `${l.protocol}//${l.hostname}:${at}` : n = l.origin;
|
|
1041
1041
|
}
|
|
1042
1042
|
const r = `${n.replace(/\/$/, "")}/api/client-log`, a = e.map((l) => ({
|
|
1043
1043
|
level: l.level,
|
|
1044
1044
|
category: l.category,
|
|
1045
1045
|
message: l.message,
|
|
1046
|
-
data:
|
|
1046
|
+
data: To(l.data),
|
|
1047
1047
|
timestamp: l.timestamp,
|
|
1048
1048
|
url: typeof window < "u" ? window.location.href : void 0,
|
|
1049
1049
|
userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
|
|
@@ -1053,7 +1053,7 @@ async function To() {
|
|
|
1053
1053
|
let i = [], s = 0;
|
|
1054
1054
|
for (const l of a) {
|
|
1055
1055
|
const m = JSON.stringify(l).length + 1;
|
|
1056
|
-
s + m >
|
|
1056
|
+
s + m > Co && i.length > 0 && (await fetch(r, {
|
|
1057
1057
|
method: "POST",
|
|
1058
1058
|
headers: { "Content-Type": "application/json" },
|
|
1059
1059
|
body: JSON.stringify({ logs: i })
|
|
@@ -1068,11 +1068,11 @@ async function To() {
|
|
|
1068
1068
|
console.warn("[wp] log flush failed (client logs may be lost):", pe(t).error);
|
|
1069
1069
|
}
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Tt(e) {
|
|
1072
1072
|
if (Ae.push(e), !Je) {
|
|
1073
|
-
const t =
|
|
1073
|
+
const t = Sn() ? po : fo;
|
|
1074
1074
|
Je = setTimeout(() => {
|
|
1075
|
-
|
|
1075
|
+
Ao();
|
|
1076
1076
|
}, t);
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
@@ -1080,19 +1080,19 @@ function pe(e) {
|
|
|
1080
1080
|
return e instanceof Error ? { error: e.message, name: e.name } : { error: String(e), name: typeof e };
|
|
1081
1081
|
}
|
|
1082
1082
|
He("__wpDebug", {
|
|
1083
|
-
enable:
|
|
1084
|
-
disable:
|
|
1085
|
-
history:
|
|
1086
|
-
clear:
|
|
1083
|
+
enable: _o,
|
|
1084
|
+
disable: xo,
|
|
1085
|
+
history: So,
|
|
1086
|
+
clear: wo
|
|
1087
1087
|
});
|
|
1088
|
-
function
|
|
1089
|
-
return
|
|
1088
|
+
function wn(e) {
|
|
1089
|
+
return lt(e) ? Ir[e] : "var(--color-neutral-bg)";
|
|
1090
1090
|
}
|
|
1091
|
-
function
|
|
1092
|
-
return
|
|
1091
|
+
function Eo(e) {
|
|
1092
|
+
return lt(e) ? `${fe().serverOrigin.replace(/\/$/, "")}${Tr(e)}` : void 0;
|
|
1093
1093
|
}
|
|
1094
1094
|
let de = null, Se = null;
|
|
1095
|
-
function
|
|
1095
|
+
function ko() {
|
|
1096
1096
|
return de ? Promise.resolve() : Se || (Se = (async () => {
|
|
1097
1097
|
try {
|
|
1098
1098
|
const e = fe().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
|
|
@@ -1116,19 +1116,19 @@ const z = {
|
|
|
1116
1116
|
userType: "public",
|
|
1117
1117
|
accountId: null
|
|
1118
1118
|
};
|
|
1119
|
-
function
|
|
1119
|
+
function ft() {
|
|
1120
1120
|
return z.accountId ? z.accountId : z.resolved && z.userType === "public" ? "anon" : null;
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1122
|
+
function No(e) {
|
|
1123
1123
|
z.resolved = !0, e.userType && (z.userType = e.userType), e.userId !== void 0 && (z.accountId = e.userId && e.userId !== "public" ? e.userId : null);
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1125
|
+
function pt() {
|
|
1126
1126
|
return z.accountId ?? "public";
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1129
|
-
return
|
|
1128
|
+
function Po() {
|
|
1129
|
+
return ft() ?? "unscoped";
|
|
1130
1130
|
}
|
|
1131
|
-
const
|
|
1131
|
+
const Ro = o.object({
|
|
1132
1132
|
// Identity. There is deliberately NO `name`: a person's name is their
|
|
1133
1133
|
// hadoku key-registry name, resolved by the server from whoami and renamed
|
|
1134
1134
|
// through hadoku_site's POST /session/name (operator decision 2026-10-08).
|
|
@@ -1153,18 +1153,18 @@ const Po = o.object({
|
|
|
1153
1153
|
preferredAudioLang: o.string().optional(),
|
|
1154
1154
|
subtitlesEnabled: o.boolean().optional(),
|
|
1155
1155
|
subtitleStyle: o.string().optional()
|
|
1156
|
-
}), le =
|
|
1156
|
+
}), le = er({
|
|
1157
1157
|
appId: "watchparty",
|
|
1158
|
-
schema:
|
|
1159
|
-
}),
|
|
1158
|
+
schema: Ro
|
|
1159
|
+
}), Oo = /* @__PURE__ */ new Set(["theme", "themeMode"]);
|
|
1160
1160
|
function De(e) {
|
|
1161
|
-
const t =
|
|
1161
|
+
const t = ft();
|
|
1162
1162
|
return t ? `prefs-cache:${t}:${e}` : null;
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1165
|
-
return
|
|
1164
|
+
function Do() {
|
|
1165
|
+
return ft() === null;
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function At(e) {
|
|
1168
1168
|
const t = De(e);
|
|
1169
1169
|
if (!t) return {};
|
|
1170
1170
|
const n = B(t);
|
|
@@ -1175,9 +1175,9 @@ function kt(e) {
|
|
|
1175
1175
|
return {};
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1178
|
+
function Mo() {
|
|
1179
1179
|
let e = 0;
|
|
1180
|
-
for (const t of
|
|
1180
|
+
for (const t of lo()) {
|
|
1181
1181
|
const n = t.startsWith("prefs-cache:") && t.endsWith(":watchparty"), r = t === Me || t.startsWith(`${Me}:`) && !t.endsWith(":_serverSynced_v1");
|
|
1182
1182
|
if (!n && !r) continue;
|
|
1183
1183
|
const a = B(t);
|
|
@@ -1191,17 +1191,17 @@ function Do() {
|
|
|
1191
1191
|
const s = n ? i?.blob : i;
|
|
1192
1192
|
if (!s || typeof s != "object" || !("name" in s)) continue;
|
|
1193
1193
|
const { name: l, ...m } = s, h = n ? { ...i, blob: m } : m;
|
|
1194
|
-
|
|
1194
|
+
ut(t, JSON.stringify(h)) && e++;
|
|
1195
1195
|
}
|
|
1196
1196
|
return e > 0 && d("preferences", "Stripped retired name from cached prefs rows", { rewritten: e }), e;
|
|
1197
1197
|
}
|
|
1198
|
-
let
|
|
1199
|
-
const
|
|
1200
|
-
function
|
|
1201
|
-
if (
|
|
1198
|
+
let _n = null, xn = null;
|
|
1199
|
+
const Et = /* @__PURE__ */ new Set();
|
|
1200
|
+
function ht() {
|
|
1201
|
+
if (Do())
|
|
1202
1202
|
return d("preferences", "Boot read deferred — session pending, identity unresolved"), {};
|
|
1203
|
-
const e =
|
|
1204
|
-
if (
|
|
1203
|
+
const e = At("portfolio"), t = At("watchparty"), n = Object.keys(e).length > 0 ? e : _n ?? {}, r = Object.keys(t).length > 0 ? t : xn ?? {}, a = pt() || "public";
|
|
1204
|
+
if (Et.has(a))
|
|
1205
1205
|
return d("preferences", "Loaded (sync, SDK-only after first read)", {
|
|
1206
1206
|
uid: a,
|
|
1207
1207
|
sdkThemeKeys: Object.keys(n).length,
|
|
@@ -1211,8 +1211,8 @@ function gt() {
|
|
|
1211
1211
|
themeSource: Object.keys(e).length > 0 ? "cache" : "mem",
|
|
1212
1212
|
appSource: Object.keys(t).length > 0 ? "cache" : "mem"
|
|
1213
1213
|
}), { ...r, ...n };
|
|
1214
|
-
|
|
1215
|
-
const i =
|
|
1214
|
+
Et.add(a);
|
|
1215
|
+
const i = Cn() ?? {}, s = { ...i, ...r, ...n };
|
|
1216
1216
|
return d("preferences", "Loaded (sync, first read — legacy + SDK)", {
|
|
1217
1217
|
uid: a,
|
|
1218
1218
|
sdkThemeKeys: Object.keys(n).length,
|
|
@@ -1222,30 +1222,30 @@ function gt() {
|
|
|
1222
1222
|
appSource: Object.keys(t).length > 0 ? "cache" : "mem"
|
|
1223
1223
|
}), s;
|
|
1224
1224
|
}
|
|
1225
|
-
let
|
|
1226
|
-
function
|
|
1227
|
-
const e =
|
|
1225
|
+
let In = !1;
|
|
1226
|
+
function Lo() {
|
|
1227
|
+
const e = pt();
|
|
1228
1228
|
return !e || e === "public";
|
|
1229
1229
|
}
|
|
1230
1230
|
function G(e, t) {
|
|
1231
|
-
|
|
1231
|
+
Lo() && (In = !0), Oo.has(e) ? ie.save({ [e]: t }, { scope: "device" }).catch((n) => A("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : le.save({ [e]: t }).catch((n) => A("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), d("preferences", "Saved (via SDK)", { key: e, value: t });
|
|
1232
1232
|
}
|
|
1233
|
-
let we = null,
|
|
1234
|
-
function
|
|
1233
|
+
let we = null, kt = !1;
|
|
1234
|
+
function jo() {
|
|
1235
1235
|
return we || (we = (async () => {
|
|
1236
1236
|
if (typeof window > "u") return !1;
|
|
1237
1237
|
try {
|
|
1238
|
-
|
|
1239
|
-
|
|
1238
|
+
kt || (kt = !0, ie.subscribe((s) => {
|
|
1239
|
+
_n = s, Rt("portfolio", s), Ot("theme");
|
|
1240
1240
|
}), le.subscribe((s) => {
|
|
1241
|
-
|
|
1241
|
+
xn = s, Rt("watchparty", s), Ot("watchparty");
|
|
1242
1242
|
}));
|
|
1243
1243
|
const [e, t] = await Promise.all([
|
|
1244
1244
|
ie.read(),
|
|
1245
1245
|
le.read()
|
|
1246
1246
|
]);
|
|
1247
1247
|
try {
|
|
1248
|
-
const { useAppStore: s } = await Promise.resolve().then(() =>
|
|
1248
|
+
const { useAppStore: s } = await Promise.resolve().then(() => An);
|
|
1249
1249
|
s.getState().rehydrateFromPrefs();
|
|
1250
1250
|
} catch (s) {
|
|
1251
1251
|
A("preferences", "inline rehydrate after SDK read failed", { err: s?.message });
|
|
@@ -1257,7 +1257,7 @@ function Lo() {
|
|
|
1257
1257
|
// Post-fetch cache state: should be non-zero if SDK wrote it.
|
|
1258
1258
|
sdkThemeBytesPost: a?.length ?? 0,
|
|
1259
1259
|
sdkAppBytesPost: i?.length ?? 0
|
|
1260
|
-
}), await
|
|
1260
|
+
}), await Uo(e, t), In ? (d("preferences", "Promoting this load's pre-auth picks to the signed-in user"), await Promise.all([
|
|
1261
1261
|
ie.promoteAnonPrefsToUser().catch(() => {
|
|
1262
1262
|
}),
|
|
1263
1263
|
le.promoteAnonPrefsToUser().catch(() => {
|
|
@@ -1269,12 +1269,12 @@ function Lo() {
|
|
|
1269
1269
|
})(), we);
|
|
1270
1270
|
}
|
|
1271
1271
|
const Me = "watchparty_preferences";
|
|
1272
|
-
|
|
1272
|
+
Mo();
|
|
1273
1273
|
function Qe() {
|
|
1274
|
-
const e =
|
|
1274
|
+
const e = pt();
|
|
1275
1275
|
return !e || e === "public" ? Me : `${Me}:${e}`;
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1277
|
+
function Cn() {
|
|
1278
1278
|
const e = B(Qe());
|
|
1279
1279
|
if (!e) return null;
|
|
1280
1280
|
try {
|
|
@@ -1284,18 +1284,18 @@ function Tn() {
|
|
|
1284
1284
|
return null;
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
|
-
function
|
|
1287
|
+
function Nt() {
|
|
1288
1288
|
Oe(Qe()), Oe(`${Qe()}:_serverSynced_v1`);
|
|
1289
1289
|
}
|
|
1290
|
-
async function
|
|
1291
|
-
const n =
|
|
1290
|
+
async function Uo(e, t) {
|
|
1291
|
+
const n = Cn();
|
|
1292
1292
|
if (!n || Object.keys(n).length === 0) return;
|
|
1293
1293
|
const r = Object.keys(e ?? {}).length > 0, a = Object.keys(t ?? {}).length > 0, i = {}, s = {};
|
|
1294
1294
|
for (const [h, u] of Object.entries(n))
|
|
1295
1295
|
r || (h === "theme" && typeof u == "string" ? i.theme = u : h === "themeMode" && (u === "simple" || u === "advanced") && (i.themeMode = u)), a || (h === "chatCollapsed" && typeof u == "boolean" ? s.chatCollapsed = u : h === "floatingChatEnabled" && typeof u == "boolean" ? s.floatingChatEnabled = u : h === "volume" && typeof u == "number" && u >= 0 && u <= 1 ? s.volume = u : h === "muted" && typeof u == "boolean" ? s.muted = u : h === "preferredAudioLang" && typeof u == "string" ? s.preferredAudioLang = u : h === "subtitlesEnabled" && typeof u == "boolean" ? s.subtitlesEnabled = u : h === "subtitleStyle" && typeof u == "string" && (s.subtitleStyle = u));
|
|
1296
1296
|
const l = Object.keys(i), m = Object.keys(s);
|
|
1297
1297
|
if (l.length === 0 && m.length === 0) {
|
|
1298
|
-
|
|
1298
|
+
Nt();
|
|
1299
1299
|
return;
|
|
1300
1300
|
}
|
|
1301
1301
|
d("preferences", "Migrating legacy localStorage prefs to SDK", {
|
|
@@ -1308,15 +1308,15 @@ async function jo(e, t) {
|
|
|
1308
1308
|
await Promise.all([
|
|
1309
1309
|
l.length > 0 ? ie.save(i, { scope: "device" }) : Promise.resolve(),
|
|
1310
1310
|
m.length > 0 ? le.save(s) : Promise.resolve()
|
|
1311
|
-
]),
|
|
1311
|
+
]), Nt(), d("preferences", "Legacy migration complete");
|
|
1312
1312
|
} catch (h) {
|
|
1313
1313
|
A("preferences", "Legacy migration save failed — will retry next load", {
|
|
1314
1314
|
err: h?.message
|
|
1315
1315
|
});
|
|
1316
1316
|
}
|
|
1317
1317
|
}
|
|
1318
|
-
let
|
|
1319
|
-
function
|
|
1318
|
+
let Pt = !1;
|
|
1319
|
+
function Rt(e, t) {
|
|
1320
1320
|
const n = De(e);
|
|
1321
1321
|
if (n)
|
|
1322
1322
|
try {
|
|
@@ -1328,15 +1328,15 @@ function Dt(e, t) {
|
|
|
1328
1328
|
};
|
|
1329
1329
|
localStorage.setItem(n, JSON.stringify(r));
|
|
1330
1330
|
} catch (r) {
|
|
1331
|
-
|
|
1331
|
+
Pt || (Pt = !0, A("preferences", "writeThrough localStorage failed (in-memory backstop only)", {
|
|
1332
1332
|
appId: e,
|
|
1333
1333
|
err: r?.message,
|
|
1334
1334
|
name: r?.name
|
|
1335
1335
|
}));
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1339
|
-
Promise.resolve().then(() =>
|
|
1338
|
+
function Ot(e) {
|
|
1339
|
+
Promise.resolve().then(() => An).then(({ useAppStore: t }) => {
|
|
1340
1340
|
try {
|
|
1341
1341
|
t.getState().rehydrateFromPrefs();
|
|
1342
1342
|
} catch (n) {
|
|
@@ -1344,33 +1344,33 @@ function Mt(e) {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
}).catch((t) => A("preferences", "store import failed", { reason: e, err: t?.message }));
|
|
1346
1346
|
}
|
|
1347
|
-
const
|
|
1347
|
+
const Tn = 320, Le = 240, gt = 640, Fo = 320, Ho = 36, Dt = 16;
|
|
1348
1348
|
function V(e, t) {
|
|
1349
|
-
if (!Number.isFinite(e)) return
|
|
1350
|
-
let n =
|
|
1351
|
-
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t -
|
|
1349
|
+
if (!Number.isFinite(e)) return Tn;
|
|
1350
|
+
let n = gt;
|
|
1351
|
+
return t !== void 0 && Number.isFinite(t) && t > 0 && (n = Math.min(n, t - Fo)), n = Math.max(n, Le), Math.round(Math.min(n, Math.max(Le, e)));
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function Mt(e, t, n, r) {
|
|
1354
1354
|
return V(e + (t - n), r);
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1356
|
+
function $o(e, t, n) {
|
|
1357
1357
|
switch (t) {
|
|
1358
1358
|
case "ArrowLeft":
|
|
1359
|
-
return V(e +
|
|
1359
|
+
return V(e + Dt, n);
|
|
1360
1360
|
case "ArrowRight":
|
|
1361
|
-
return V(e -
|
|
1361
|
+
return V(e - Dt, n);
|
|
1362
1362
|
case "Home":
|
|
1363
1363
|
return V(Le, n);
|
|
1364
1364
|
case "End":
|
|
1365
|
-
return V(
|
|
1365
|
+
return V(gt, n);
|
|
1366
1366
|
default:
|
|
1367
1367
|
return null;
|
|
1368
1368
|
}
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1371
|
-
return { collapsed: e, width: e ?
|
|
1370
|
+
function Bo(e, t) {
|
|
1371
|
+
return { collapsed: e, width: e ? Ho : t };
|
|
1372
1372
|
}
|
|
1373
|
-
const q =
|
|
1373
|
+
const q = ht(), f = Qn((e, t) => ({
|
|
1374
1374
|
ready: !1,
|
|
1375
1375
|
name: "",
|
|
1376
1376
|
sprite: null,
|
|
@@ -1380,7 +1380,7 @@ const q = gt(), f = Zn((e, t) => ({
|
|
|
1380
1380
|
chat: [],
|
|
1381
1381
|
chatCollapsed: q.chatCollapsed ?? !1,
|
|
1382
1382
|
chromeChatCollapsed: q.chromeChatCollapsed ?? !1,
|
|
1383
|
-
chromeChatWidth: V(q.chromeChatWidth ??
|
|
1383
|
+
chromeChatWidth: V(q.chromeChatWidth ?? Tn),
|
|
1384
1384
|
// Hardcoded on for everyone — the per-user toggle was removed from the
|
|
1385
1385
|
// control bar; FloatingChat + toggleFloatingChat code is kept for future
|
|
1386
1386
|
// re-enablement but the value is no longer user-controllable.
|
|
@@ -1590,7 +1590,7 @@ const q = gt(), f = Zn((e, t) => ({
|
|
|
1590
1590
|
setGameSettings: (n) => e({ gameSettings: n }),
|
|
1591
1591
|
setRoomKeyType: (n) => e({ roomKeyType: n }),
|
|
1592
1592
|
rehydrateFromPrefs: () => e((n) => {
|
|
1593
|
-
const r =
|
|
1593
|
+
const r = ht(), a = {};
|
|
1594
1594
|
if (r.chatCollapsed !== void 0 && (a.chatCollapsed = r.chatCollapsed), r.chromeChatCollapsed !== void 0 && (a.chromeChatCollapsed = r.chromeChatCollapsed), r.chromeChatWidth !== void 0 && (a.chromeChatWidth = V(r.chromeChatWidth)), ["volume", "muted", "preferredAudioLang", "subtitlesEnabled", "subtitleStyle"].some((l) => r[l] !== void 0)) {
|
|
1595
1595
|
const l = { ...n.mediaPrefs };
|
|
1596
1596
|
r.volume !== void 0 && (l.volume = r.volume), r.muted !== void 0 && (l.muted = r.muted), r.preferredAudioLang !== void 0 && (l.preferredAudioLang = r.preferredAudioLang), r.subtitlesEnabled !== void 0 && (l.subtitlesEnabled = r.subtitlesEnabled), r.subtitleStyle !== void 0 && ["classic", "cinema", "minimal", "contrast"].includes(r.subtitleStyle) && (l.subtitleStyle = r.subtitleStyle), a.mediaPrefs = l;
|
|
@@ -1600,27 +1600,27 @@ const q = gt(), f = Zn((e, t) => ({
|
|
|
1600
1600
|
setSidebarTab: (n) => e((r) => r.sidebarTab === n && n !== "chat" ? { sidebarTab: "chat" } : { sidebarTab: n, chatCollapsed: !1 })
|
|
1601
1601
|
}));
|
|
1602
1602
|
He("__ZUSTAND_STORE__", f);
|
|
1603
|
-
const
|
|
1603
|
+
const An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1604
1604
|
__proto__: null,
|
|
1605
1605
|
useAppStore: f
|
|
1606
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1607
|
-
function
|
|
1608
|
-
const e =
|
|
1606
|
+
}, Symbol.toStringTag, { value: "Module" })), En = rt(!0);
|
|
1607
|
+
function Go() {
|
|
1608
|
+
const e = Kt(En);
|
|
1609
1609
|
N(() => {
|
|
1610
1610
|
e && Wn();
|
|
1611
1611
|
}, [e]);
|
|
1612
1612
|
}
|
|
1613
|
-
function
|
|
1613
|
+
function qo(e, t) {
|
|
1614
1614
|
if (!t) return "";
|
|
1615
1615
|
for (const n of Object.values(e))
|
|
1616
1616
|
if (n.author === t && n.cosmetics) return JSON.stringify(n.cosmetics);
|
|
1617
1617
|
return "";
|
|
1618
1618
|
}
|
|
1619
|
-
function qo(e) {
|
|
1620
|
-
const t = ot(bt), n = f((r) => t ? Go(r.roster, e) : "");
|
|
1621
|
-
return J(() => n ? JSON.parse(n) : void 0, [n]);
|
|
1622
|
-
}
|
|
1623
1619
|
function Vo(e) {
|
|
1620
|
+
const t = f((n) => qo(n.roster, e));
|
|
1621
|
+
return J(() => t ? JSON.parse(t) : void 0, [t]);
|
|
1622
|
+
}
|
|
1623
|
+
function Ko(e) {
|
|
1624
1624
|
return e ? { "--hc-base": e } : {};
|
|
1625
1625
|
}
|
|
1626
1626
|
const et = Pe.memo(
|
|
@@ -1629,7 +1629,7 @@ const et = Pe.memo(
|
|
|
1629
1629
|
},
|
|
1630
1630
|
(e, t) => e.html === t.html && e.as === t.as && e.className === t.className && JSON.stringify(e.style) === JSON.stringify(t.style)
|
|
1631
1631
|
);
|
|
1632
|
-
function
|
|
1632
|
+
function Wo(e, t) {
|
|
1633
1633
|
N(() => {
|
|
1634
1634
|
const n = e.current;
|
|
1635
1635
|
if (!n || !t || typeof IntersectionObserver > "u") return;
|
|
@@ -1641,18 +1641,18 @@ function Ko(e, t) {
|
|
|
1641
1641
|
};
|
|
1642
1642
|
}, [e, t]);
|
|
1643
1643
|
}
|
|
1644
|
-
function
|
|
1645
|
-
return `${
|
|
1644
|
+
function Yo(e) {
|
|
1645
|
+
return `${pn()}/media/${e}`.replace(/\\/g, "/");
|
|
1646
1646
|
}
|
|
1647
|
-
function
|
|
1648
|
-
return
|
|
1647
|
+
function zo(e, t) {
|
|
1648
|
+
return Yo(t ?? `${e}/poster.jpg`);
|
|
1649
1649
|
}
|
|
1650
|
-
function
|
|
1651
|
-
return `${
|
|
1650
|
+
function Xo(e) {
|
|
1651
|
+
return `${pn()}${e}`.replace(/\\/g, "/");
|
|
1652
1652
|
}
|
|
1653
|
-
async function
|
|
1653
|
+
async function Jo(e) {
|
|
1654
1654
|
try {
|
|
1655
|
-
const t = await fetch(
|
|
1655
|
+
const t = await fetch(Xo("/api/tierlist"));
|
|
1656
1656
|
if (!t.ok)
|
|
1657
1657
|
return A("tierlist", "Board fetch failed", { status: t.status }), null;
|
|
1658
1658
|
const n = await t.json();
|
|
@@ -1665,78 +1665,78 @@ async function Xo(e) {
|
|
|
1665
1665
|
return A("tierlist", "Board fetch threw", pe(t)), null;
|
|
1666
1666
|
}
|
|
1667
1667
|
}
|
|
1668
|
-
let
|
|
1669
|
-
function
|
|
1670
|
-
if (
|
|
1668
|
+
let Lt = !1;
|
|
1669
|
+
function Zo() {
|
|
1670
|
+
if (Lt || typeof Image > "u") return;
|
|
1671
1671
|
const e = f.getState().tierlist;
|
|
1672
1672
|
if (!(!e || e.items.length === 0)) {
|
|
1673
|
-
|
|
1673
|
+
Lt = !0;
|
|
1674
1674
|
for (const t of e.items) {
|
|
1675
1675
|
const n = new Image();
|
|
1676
|
-
n.decoding = "async", n.src =
|
|
1676
|
+
n.decoding = "async", n.src = zo(t.id, t.thumbnail);
|
|
1677
1677
|
}
|
|
1678
1678
|
d("tierlist", "Warming posters", { count: e.items.length });
|
|
1679
1679
|
}
|
|
1680
1680
|
}
|
|
1681
|
-
function
|
|
1681
|
+
function Qo() {
|
|
1682
1682
|
const e = f.getState(), t = new Set(Object.values(e.roster).map((i) => i.sprite).filter(Boolean)), n = je.find((i) => !t.has(i));
|
|
1683
1683
|
if (!n)
|
|
1684
1684
|
return A("socket", "sprite_taken: no available sprites to retry with"), null;
|
|
1685
1685
|
const r = !!e.name && !Z(e.name), a = r ? e.name : ue(n);
|
|
1686
1686
|
return d("socket", "sprite_taken: retrying with next available", { from: e.sprite, to: n, name: a, keptCustomName: r }), e.setSessionIdentity(a, n), { name: a, sprite: n };
|
|
1687
1687
|
}
|
|
1688
|
-
function
|
|
1688
|
+
function ea(e) {
|
|
1689
1689
|
const t = f.getState(), n = e ? t.roster[e] : void 0;
|
|
1690
1690
|
return !n || !!n.sprite && n.sprite === t.sprite;
|
|
1691
1691
|
}
|
|
1692
|
-
const
|
|
1692
|
+
const jt = "hadoku:avatar";
|
|
1693
1693
|
function kn(e) {
|
|
1694
1694
|
const t = e?.sprite ?? e?.avatar?.sprite ?? null;
|
|
1695
|
-
return
|
|
1695
|
+
return lt(t) ? t : null;
|
|
1696
1696
|
}
|
|
1697
|
-
async function
|
|
1697
|
+
async function ta(e = {}) {
|
|
1698
1698
|
const t = e.fetch ?? (typeof fetch > "u" ? void 0 : fetch), n = typeof window > "u" ? void 0 : window.location?.origin, r = e.baseUrl ?? (n ? `${n}/prefs` : void 0);
|
|
1699
1699
|
if (!t || !r) return null;
|
|
1700
1700
|
try {
|
|
1701
|
-
const a = await
|
|
1701
|
+
const a = await or({ baseUrl: r, fetch: t }).get(), i = kn(a);
|
|
1702
1702
|
return d("avatar", "Requested character from prefs-api", { sprite: i }), i;
|
|
1703
1703
|
} catch (a) {
|
|
1704
|
-
return a instanceof
|
|
1705
|
-
status: a instanceof
|
|
1704
|
+
return a instanceof _t && (a.status === 401 || a.status === 403 || a.status === 404) ? d("avatar", "No avatar settings here (signed out, or no prefs-api on this origin)", { status: a.status }) : A("avatar", "Avatar settings read failed — keeping the auto-assigned character", {
|
|
1705
|
+
status: a instanceof _t ? a.status : void 0,
|
|
1706
1706
|
...pe(a)
|
|
1707
1707
|
}), null;
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1710
|
+
function Ut(e) {
|
|
1711
1711
|
if (!e) return !1;
|
|
1712
1712
|
const t = f.getState();
|
|
1713
1713
|
if (t.sprite === e) return !1;
|
|
1714
1714
|
const r = !!(t.me.clientId && t.roster[t.me.clientId]?.registryName) || !t.name || !Z(t.name) ? t.name : ue(e);
|
|
1715
1715
|
return t.setSessionIdentity(r, e), !0;
|
|
1716
1716
|
}
|
|
1717
|
-
function
|
|
1717
|
+
function na(e, t = typeof window > "u" ? void 0 : window) {
|
|
1718
1718
|
if (!t) return () => {
|
|
1719
1719
|
};
|
|
1720
1720
|
const n = (r) => {
|
|
1721
1721
|
const a = r.detail;
|
|
1722
1722
|
!a || typeof a != "object" || e(a);
|
|
1723
1723
|
};
|
|
1724
|
-
return t.addEventListener(
|
|
1724
|
+
return t.addEventListener(jt, n), () => t.removeEventListener(jt, n);
|
|
1725
1725
|
}
|
|
1726
|
-
const
|
|
1727
|
-
function
|
|
1726
|
+
const ra = 10;
|
|
1727
|
+
function oa(e = typeof window < "u" ? window : void 0) {
|
|
1728
1728
|
if (!e) return { framed: !1, depth: 0 };
|
|
1729
1729
|
try {
|
|
1730
1730
|
let t = 0, n = e;
|
|
1731
|
-
for (; n !== n.parent && t <
|
|
1731
|
+
for (; n !== n.parent && t < ra; )
|
|
1732
1732
|
t++, n = n.parent;
|
|
1733
1733
|
return { framed: e.top ? e.top !== e.self : t > 0, depth: t };
|
|
1734
1734
|
} catch {
|
|
1735
1735
|
return { framed: !1, depth: 0 };
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
|
-
const
|
|
1739
|
-
function
|
|
1738
|
+
const aa = "watchparty_fragment_delivery";
|
|
1739
|
+
function ia() {
|
|
1740
1740
|
if (typeof window > "u") return null;
|
|
1741
1741
|
try {
|
|
1742
1742
|
const e = new URLSearchParams(window.location.search).get("fragmentDelivery");
|
|
@@ -1744,43 +1744,43 @@ function aa() {
|
|
|
1744
1744
|
if (e === "0" || e === "false") return !1;
|
|
1745
1745
|
} catch {
|
|
1746
1746
|
}
|
|
1747
|
-
return
|
|
1747
|
+
return co(aa);
|
|
1748
1748
|
}
|
|
1749
|
-
let
|
|
1750
|
-
const
|
|
1751
|
-
function
|
|
1752
|
-
const e = B(
|
|
1749
|
+
let sa = { ...on }, Be = null;
|
|
1750
|
+
const Ft = "watchparty_delivery_client_id";
|
|
1751
|
+
function la() {
|
|
1752
|
+
const e = B(Ft);
|
|
1753
1753
|
if (e) return e;
|
|
1754
1754
|
const t = globalThis.crypto?.randomUUID?.() ?? `d${Math.random().toString(36).slice(2)}`;
|
|
1755
|
-
return
|
|
1756
|
-
}
|
|
1757
|
-
function la() {
|
|
1758
|
-
return Be === null && (Be = Pr(ia, sa(), aa())), Be;
|
|
1755
|
+
return ut(Ft, t) ? t : "";
|
|
1759
1756
|
}
|
|
1760
1757
|
function ca() {
|
|
1761
|
-
return la();
|
|
1758
|
+
return Be === null && (Be = Rr(sa, la(), ia())), Be;
|
|
1759
|
+
}
|
|
1760
|
+
function da() {
|
|
1761
|
+
return ca();
|
|
1762
1762
|
}
|
|
1763
1763
|
let ke;
|
|
1764
1764
|
function Nn() {
|
|
1765
|
-
return B(
|
|
1765
|
+
return B(nr) || void 0;
|
|
1766
1766
|
}
|
|
1767
|
-
function
|
|
1767
|
+
function ua() {
|
|
1768
1768
|
if (ke) return;
|
|
1769
1769
|
const e = Nn();
|
|
1770
1770
|
if (e) {
|
|
1771
1771
|
ke = e;
|
|
1772
1772
|
return;
|
|
1773
1773
|
}
|
|
1774
|
-
|
|
1774
|
+
tr().then((t) => {
|
|
1775
1775
|
t && (ke = t);
|
|
1776
1776
|
}).catch(() => {
|
|
1777
1777
|
d("identity", "device id unavailable — joining without one");
|
|
1778
1778
|
});
|
|
1779
1779
|
}
|
|
1780
|
-
function
|
|
1780
|
+
function ma() {
|
|
1781
1781
|
return ke ??= Nn();
|
|
1782
1782
|
}
|
|
1783
|
-
function
|
|
1783
|
+
function fa(e, t) {
|
|
1784
1784
|
let n = 0;
|
|
1785
1785
|
for (const r of e.videos) {
|
|
1786
1786
|
const a = ne.voteKey(t, e.id, r.mediaId);
|
|
@@ -1788,49 +1788,49 @@ function ma(e, t) {
|
|
|
1788
1788
|
}
|
|
1789
1789
|
return n;
|
|
1790
1790
|
}
|
|
1791
|
-
const
|
|
1792
|
-
function
|
|
1791
|
+
const pa = 2e4, ha = 1e4;
|
|
1792
|
+
function ga() {
|
|
1793
1793
|
return { unansweredSince: null, lastPongAt: null, lastTickAt: null };
|
|
1794
1794
|
}
|
|
1795
|
-
function
|
|
1795
|
+
function ya(e, t) {
|
|
1796
1796
|
e.lastPongAt = t, e.unansweredSince = null;
|
|
1797
1797
|
}
|
|
1798
|
-
function
|
|
1799
|
-
const r = e.lastTickAt !== null && t - e.lastTickAt >
|
|
1800
|
-
return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince >
|
|
1798
|
+
function ba(e, t, n) {
|
|
1799
|
+
const r = e.lastTickAt !== null && t - e.lastTickAt > ha;
|
|
1800
|
+
return e.lastTickAt = t, n ? r || e.unansweredSince === null ? (e.unansweredSince = t, !1) : t - e.unansweredSince > pa : (e.unansweredSince = null, !1);
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1802
|
+
function va(e, t) {
|
|
1803
1803
|
return e.lastPongAt === null ? void 0 : Math.max(0, t - e.lastPongAt);
|
|
1804
1804
|
}
|
|
1805
1805
|
let w = null, H = null, Ne = null, $ = null, W = null;
|
|
1806
|
-
const
|
|
1807
|
-
let _e = null, Ge = null,
|
|
1808
|
-
function
|
|
1806
|
+
const Sa = xa(), ee = ga();
|
|
1807
|
+
let _e = null, Ge = null, Ht = 0, yt = null, me = !1, bt = !1, ae = !1, Pn = null;
|
|
1808
|
+
function wa(e) {
|
|
1809
1809
|
const t = re(), n = f.getState();
|
|
1810
1810
|
if (n.me.clientId && n.roster[n.me.clientId])
|
|
1811
1811
|
return (e.name || e.sprite) && (d("socket", "Identity update (already joined)", { name: e.name, sprite: e.sprite }), t.emit(_.IDENTITY_UPDATE, { name: e.name, sprite: e.sprite })), t;
|
|
1812
|
-
const r =
|
|
1813
|
-
return W = r,
|
|
1812
|
+
const r = _a(e);
|
|
1813
|
+
return W = r, yt = { name: r.name, sprite: r.sprite }, t.connected ? (d("socket", "Emitting join", r), t.emit(_.JOIN, r)) : t.once("connect", () => {
|
|
1814
1814
|
d("socket", "Emitting join", r), t.emit(_.JOIN, r);
|
|
1815
1815
|
}), t;
|
|
1816
1816
|
}
|
|
1817
|
-
function
|
|
1817
|
+
function _a(e) {
|
|
1818
1818
|
return {
|
|
1819
1819
|
room_key: e.room_key,
|
|
1820
1820
|
name: e.name,
|
|
1821
1821
|
sprite: e.sprite,
|
|
1822
1822
|
// Entry-path telemetry — see lib/embedContext.ts. Sent on every join AND
|
|
1823
1823
|
// rejoin (lastJoinPayload carries it), so a reconnect keeps the attribution.
|
|
1824
|
-
embed:
|
|
1825
|
-
delivery_arm:
|
|
1824
|
+
embed: oa(),
|
|
1825
|
+
delivery_arm: da(),
|
|
1826
1826
|
// Identity tier input — see lib/deviceId.ts. Sent on every join AND rejoin
|
|
1827
1827
|
// (lastJoinPayload carries it) so a reconnect lands on the same
|
|
1828
1828
|
// ParticipantId rather than minting a new person.
|
|
1829
|
-
device_id:
|
|
1830
|
-
tab_id:
|
|
1829
|
+
device_id: ma(),
|
|
1830
|
+
tab_id: Sa
|
|
1831
1831
|
};
|
|
1832
1832
|
}
|
|
1833
|
-
function
|
|
1833
|
+
function xa() {
|
|
1834
1834
|
const e = globalThis.crypto;
|
|
1835
1835
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
1836
1836
|
const t = new Uint8Array(16);
|
|
@@ -1843,20 +1843,20 @@ function re() {
|
|
|
1843
1843
|
let t = fe().serverOrigin || "/";
|
|
1844
1844
|
if (t === "/" && typeof window < "u") {
|
|
1845
1845
|
const r = window.location;
|
|
1846
|
-
(r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String(
|
|
1846
|
+
(r.hostname === "localhost" || r.hostname === "127.0.0.1") && r.port === String(Xt) && (t = `${r.protocol}//${r.hostname}:${at}`, d("socket", "Using dev fallback origin", { origin: t }));
|
|
1847
1847
|
}
|
|
1848
1848
|
const n = new URL(t.startsWith("http") ? t : `${window.location.origin}${t}`).origin;
|
|
1849
|
-
w =
|
|
1850
|
-
if (
|
|
1849
|
+
w = rr(n, { path: lr, transports: ["websocket", "polling"] }), d("socket", "Socket initialized", { origin: t }), He("__SOCKET__", w), $ && (clearTimeout($), $ = null), H = null, Ne = setInterval(() => {
|
|
1850
|
+
if (ba(ee, Date.now(), !!w?.connected)) {
|
|
1851
1851
|
A("socket", "PONG-WATCHDOG no time_pong for 20s — replacing the connection", {
|
|
1852
1852
|
sid: w?.id,
|
|
1853
|
-
lastPongAgeMs:
|
|
1853
|
+
lastPongAgeMs: va(ee, Date.now()) ?? null
|
|
1854
1854
|
}), Ge = "pong-watchdog", ee.unansweredSince = null, w?.io.engine?.close();
|
|
1855
1855
|
return;
|
|
1856
1856
|
}
|
|
1857
|
-
|
|
1858
|
-
},
|
|
1859
|
-
|
|
1857
|
+
Ma();
|
|
1858
|
+
}, Ar), w.on("connect", () => {
|
|
1859
|
+
bt = !1;
|
|
1860
1860
|
const r = w?.id;
|
|
1861
1861
|
if (d("socket", "Connected", { id: r, isReconnect: ae }), r)
|
|
1862
1862
|
try {
|
|
@@ -1866,13 +1866,13 @@ function re() {
|
|
|
1866
1866
|
}
|
|
1867
1867
|
if (ae && W) {
|
|
1868
1868
|
const a = f.getState();
|
|
1869
|
-
|
|
1869
|
+
Ht += 1;
|
|
1870
1870
|
const i = {
|
|
1871
1871
|
...W,
|
|
1872
1872
|
name: a.name,
|
|
1873
1873
|
sprite: a.sprite,
|
|
1874
1874
|
reconnect: {
|
|
1875
|
-
count:
|
|
1875
|
+
count: Ht,
|
|
1876
1876
|
reason: (_e?.reason ?? "unknown").slice(0, 64),
|
|
1877
1877
|
offline_ms: _e ? Math.max(0, Date.now() - _e.at) : 0
|
|
1878
1878
|
}
|
|
@@ -1886,19 +1886,19 @@ function re() {
|
|
|
1886
1886
|
l || (l = !0, w.off(_.SNAPSHOT, m), A("socket", "client_ready re-emit timed out waiting for snapshot", { mediaId: s }));
|
|
1887
1887
|
}, 1e4);
|
|
1888
1888
|
}
|
|
1889
|
-
|
|
1889
|
+
yt = { name: i.name, sprite: i.sprite }, w.emit(_.JOIN, i), window.dispatchEvent(new CustomEvent("watchparty:socket-reconnect"));
|
|
1890
1890
|
} else ae && A("socket", "Reconnected — no join payload, not re-joining any room");
|
|
1891
1891
|
ae = !0;
|
|
1892
1892
|
}), w.on("disconnect", (r) => {
|
|
1893
|
-
|
|
1894
|
-
}), w.on("connect_error", (r) => Ee("socket", "Connection error", { message: r?.message })), w.on("reconnect_attempt", (r) => A("socket", "Reconnect attempt", { attempt: r })), w.on("reconnect_failed", () => Ee("socket", "Reconnect failed")),
|
|
1893
|
+
vn(null), _e = { reason: Ge ?? r, at: Date.now() }, Ge = null, d("socket", "Disconnected", { reason: r });
|
|
1894
|
+
}), w.on("connect_error", (r) => Ee("socket", "Connection error", { message: r?.message })), w.on("reconnect_attempt", (r) => A("socket", "Reconnect attempt", { attempt: r })), w.on("reconnect_failed", () => Ee("socket", "Reconnect failed")), Oa(w);
|
|
1895
1895
|
}
|
|
1896
1896
|
return w;
|
|
1897
1897
|
}
|
|
1898
1898
|
function qe(e) {
|
|
1899
1899
|
return e.play_state === "playing" || e.playing === !0;
|
|
1900
1900
|
}
|
|
1901
|
-
function
|
|
1901
|
+
function $t(e, t) {
|
|
1902
1902
|
return {
|
|
1903
1903
|
id: String(e.id ?? e.server_seq ?? t ?? `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`),
|
|
1904
1904
|
clientId: e.client_id,
|
|
@@ -1910,14 +1910,14 @@ function Gt(e, t) {
|
|
|
1910
1910
|
// Attachments arrive from other clients, so the key shape is re-checked
|
|
1911
1911
|
// here at the boundary rather than trusted at render time. A malformed
|
|
1912
1912
|
// entry is dropped, not rendered and not allowed near an <img src>.
|
|
1913
|
-
images: Array.isArray(e.images) ? e.images.filter((n) => !!n &&
|
|
1913
|
+
images: Array.isArray(e.images) ? e.images.filter((n) => !!n && ot(n.key)).slice(0, Y) : void 0,
|
|
1914
1914
|
isSystem: e.isSystem || !1,
|
|
1915
1915
|
systemType: e.systemType
|
|
1916
1916
|
};
|
|
1917
1917
|
}
|
|
1918
|
-
function
|
|
1918
|
+
function Ia(e) {
|
|
1919
1919
|
e.on(_.SNAPSHOT, (t) => {
|
|
1920
|
-
e.emit(
|
|
1920
|
+
e.emit(rn.SYNC), f.getState().applySnapshot({
|
|
1921
1921
|
roomId: t.room_id ?? null,
|
|
1922
1922
|
mediaId: t.media_id ?? null,
|
|
1923
1923
|
playheadMs: t.playhead_ms || 0,
|
|
@@ -1925,7 +1925,7 @@ function xa(e) {
|
|
|
1925
1925
|
serverSeq: t.server_seq || 0,
|
|
1926
1926
|
leaderId: t.leader_id || null
|
|
1927
1927
|
}), f.getState().name || d("socket", "Deferring identity to presence event (snapshot carries no roster)");
|
|
1928
|
-
const n = f.getState(), r = w?.id, i = (r ? n.roster[r] : void 0) ??
|
|
1928
|
+
const n = f.getState(), r = w?.id, i = (r ? n.roster[r] : void 0) ?? yt, s = ar(
|
|
1929
1929
|
{ name: n.name, avatarId: n.sprite },
|
|
1930
1930
|
i ? { name: i.name, avatarId: i.sprite ?? null } : void 0,
|
|
1931
1931
|
// A join that carried no name counts as a default one, so a name that
|
|
@@ -1935,7 +1935,7 @@ function xa(e) {
|
|
|
1935
1935
|
if (s) {
|
|
1936
1936
|
const l = {
|
|
1937
1937
|
...s.name !== void 0 ? { name: s.name } : {},
|
|
1938
|
-
...s.avatarId !== void 0 && !
|
|
1938
|
+
...s.avatarId !== void 0 && !bt ? { sprite: s.avatarId } : {}
|
|
1939
1939
|
};
|
|
1940
1940
|
Object.keys(l).length > 0 && (d("socket", "Identity update on snapshot", l), e.emit(_.IDENTITY_UPDATE, l));
|
|
1941
1941
|
}
|
|
@@ -1946,7 +1946,7 @@ function xa(e) {
|
|
|
1946
1946
|
leaderId: t.leader_id || null,
|
|
1947
1947
|
serverSeq: t.server_seq || 0,
|
|
1948
1948
|
rosterSize: Object.keys(n.roster).length
|
|
1949
|
-
}), W?.room_key && w?.id &&
|
|
1949
|
+
}), W?.room_key && w?.id && vn({ room_key: W.room_key, client_id: w.id });
|
|
1950
1950
|
}), e.on(_.CONTROL_BROADCAST, (t) => {
|
|
1951
1951
|
const n = f.getState();
|
|
1952
1952
|
if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
|
|
@@ -1968,7 +1968,7 @@ function xa(e) {
|
|
|
1968
1968
|
}), e.on(_.CONTROL_ACK, (t) => {
|
|
1969
1969
|
typeof t?.client_seq == "number" && typeof t?.server_seq == "number" && d("socket", "Control ack received", t);
|
|
1970
1970
|
}), e.on(_.TIME_PONG, (t) => {
|
|
1971
|
-
if (
|
|
1971
|
+
if (ya(ee, Date.now()), H && H.ts) {
|
|
1972
1972
|
const n = Date.now() - H.ts;
|
|
1973
1973
|
f.getState().addRttSample(n, t?.server_ts, H.ts), H = null, $ && (clearTimeout($), $ = null), d("socket", "Time sync RTT", { rtt: n, offset: f.getState().drift.offsetMs });
|
|
1974
1974
|
}
|
|
@@ -1978,11 +1978,11 @@ function xa(e) {
|
|
|
1978
1978
|
f.getState().setReadiness({ mediaId: n, ready: i, readyCount: r, total: a }), d("socket", "Ready state received", { mediaId: n, readyCount: r, total: a, ready: i });
|
|
1979
1979
|
});
|
|
1980
1980
|
}
|
|
1981
|
-
function
|
|
1981
|
+
function Ca(e) {
|
|
1982
1982
|
const t = Yn(e);
|
|
1983
1983
|
return t ? { cosmetics: t } : {};
|
|
1984
1984
|
}
|
|
1985
|
-
function
|
|
1985
|
+
function Ta(e) {
|
|
1986
1986
|
e.on(_.PRESENCE, (t) => {
|
|
1987
1987
|
if (!t) return;
|
|
1988
1988
|
if (Array.isArray(t.users)) {
|
|
@@ -1996,7 +1996,7 @@ function Ca(e) {
|
|
|
1996
1996
|
isLeader: l.is_leader,
|
|
1997
1997
|
...l.registry_name ? { registryName: !0 } : {},
|
|
1998
1998
|
...l.avatar_url ? { avatarUrl: l.avatar_url } : {},
|
|
1999
|
-
...
|
|
1999
|
+
...Ca(l.cosmetics)
|
|
2000
2000
|
};
|
|
2001
2001
|
const a = f.getState(), i = w?.id, s = i ? r[i] : void 0;
|
|
2002
2002
|
if (s?.registryName)
|
|
@@ -2018,17 +2018,17 @@ function Ca(e) {
|
|
|
2018
2018
|
}
|
|
2019
2019
|
});
|
|
2020
2020
|
}
|
|
2021
|
-
function
|
|
2021
|
+
function Aa(e) {
|
|
2022
2022
|
e.on(_.CHAT_BROADCAST, (t) => {
|
|
2023
|
-
const n = {
|
|
2023
|
+
const n = { ...$t(t, t.server_seq), live: !0 };
|
|
2024
2024
|
f.getState().appendChat(n), d("chat", "Message received", n);
|
|
2025
2025
|
}), e.on(_.CHAT_HISTORY, (t) => {
|
|
2026
2026
|
if (!t?.messages || !Array.isArray(t.messages)) return;
|
|
2027
|
-
const n = t.messages.map((r) =>
|
|
2027
|
+
const n = t.messages.map((r) => $t(r));
|
|
2028
2028
|
f.getState().setChat(n), d("chat", "History loaded", { count: n.length });
|
|
2029
2029
|
});
|
|
2030
2030
|
}
|
|
2031
|
-
function
|
|
2031
|
+
function Ea(e) {
|
|
2032
2032
|
e.on(be.STATE, (t) => {
|
|
2033
2033
|
f.getState().applyPlaylistState({
|
|
2034
2034
|
playlist: t?.playlist ?? null,
|
|
@@ -2041,54 +2041,54 @@ function Aa(e) {
|
|
|
2041
2041
|
f.getState().setPlaylistResults(t ?? null), d("playlist", "Results received", { playlistId: t?.playlist?.id, update: t?.update === !0 });
|
|
2042
2042
|
}), e.on(be.VOTES_CLEARED, (t) => {
|
|
2043
2043
|
if (!t?.playlistId || !Array.isArray(t.mediaIds)) return;
|
|
2044
|
-
const n =
|
|
2044
|
+
const n = fa(
|
|
2045
2045
|
{ id: t.playlistId, videos: t.mediaIds.map((a) => ({ mediaId: a })) },
|
|
2046
|
-
|
|
2046
|
+
Po()
|
|
2047
2047
|
), r = f.getState();
|
|
2048
2048
|
r.playlist?.id === t.playlistId && r.applyPlaylistState({ playlist: r.playlist, activeIndex: r.activePlaylistIndex, myVotes: {} }), d("playlist", "Votes cleared by leader", { playlistId: t.playlistId, removed: n });
|
|
2049
2049
|
});
|
|
2050
2050
|
}
|
|
2051
|
-
function
|
|
2052
|
-
e.on(
|
|
2053
|
-
d("tierlist", "Someone saved — refreshing the board"),
|
|
2051
|
+
function ka(e) {
|
|
2052
|
+
e.on(wr.UPDATED, () => {
|
|
2053
|
+
d("tierlist", "Someone saved — refreshing the board"), Jo(!1);
|
|
2054
2054
|
});
|
|
2055
2055
|
}
|
|
2056
|
-
function
|
|
2057
|
-
e.on(
|
|
2056
|
+
function Na(e) {
|
|
2057
|
+
e.on(_r.STATE, (t) => {
|
|
2058
2058
|
if (!t || typeof t.active != "boolean") return;
|
|
2059
2059
|
const n = Array.isArray(t.ready) ? t.ready.filter((r) => typeof r == "string") : [];
|
|
2060
2060
|
f.getState().setReadyCheckState({ active: t.active, ready: n }), d("ready-check", "State received", { active: t.active, readyCount: n.length });
|
|
2061
2061
|
});
|
|
2062
2062
|
}
|
|
2063
|
-
function
|
|
2064
|
-
e.on(
|
|
2063
|
+
function Pa(e) {
|
|
2064
|
+
e.on(rn.ACTIVE, (t) => {
|
|
2065
2065
|
const n = typeof t?.gameId == "string" ? t.gameId : null;
|
|
2066
2066
|
f.getState().setActiveGameId(n), d("game", "game_active", { gameId: n });
|
|
2067
2067
|
});
|
|
2068
2068
|
}
|
|
2069
|
-
function
|
|
2069
|
+
function Ra(e) {
|
|
2070
2070
|
e.on(_.HEALTH_SNAPSHOT, (t) => {
|
|
2071
2071
|
f.getState().setHealthSnapshot(t);
|
|
2072
2072
|
}), e.on(_.BUFFER_STATUS, (t) => {
|
|
2073
2073
|
f.getState().setBufferStatus(t);
|
|
2074
2074
|
});
|
|
2075
2075
|
}
|
|
2076
|
-
function
|
|
2077
|
-
|
|
2076
|
+
function Oa(e) {
|
|
2077
|
+
Ia(e), Ta(e), Aa(e), Ra(e), Ea(e), ka(e), Na(e), Pa(e), e.on(_.ERROR, (t) => {
|
|
2078
2078
|
const n = t?.code || "error/unknown";
|
|
2079
2079
|
if (n === "conflict" && t?.message === "sprite_held_by_you") {
|
|
2080
|
-
|
|
2080
|
+
bt = !0, d("socket", "sprite held by this account's other connection: keeping the server-assigned sprite");
|
|
2081
2081
|
return;
|
|
2082
2082
|
}
|
|
2083
2083
|
if (n === "conflict" && t?.message === "sprite_taken") {
|
|
2084
|
-
if (
|
|
2084
|
+
if (ea(w?.id)) {
|
|
2085
2085
|
d("socket", "sprite_taken: stale, the server already has our sprite");
|
|
2086
2086
|
return;
|
|
2087
2087
|
}
|
|
2088
2088
|
me = !0;
|
|
2089
2089
|
let s;
|
|
2090
2090
|
try {
|
|
2091
|
-
s =
|
|
2091
|
+
s = Qo();
|
|
2092
2092
|
} finally {
|
|
2093
2093
|
me = !1;
|
|
2094
2094
|
}
|
|
@@ -2119,10 +2119,10 @@ function Ra(e) {
|
|
|
2119
2119
|
(n.startsWith("auth/") ? A : Ee)("socket", `Server error: ${a}`, { code: n, raw: t }), f.getState().pushToast("error", a);
|
|
2120
2120
|
});
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2122
|
+
function Da(e, t) {
|
|
2123
2123
|
re().emit(_.CHAT_SEND, t?.length ? { text: e, images: t } : { text: e });
|
|
2124
2124
|
}
|
|
2125
|
-
function
|
|
2125
|
+
function Ma() {
|
|
2126
2126
|
H || (H = { ts: Date.now() }, re().emit(_.TIME_PING, {}), $ = setTimeout(() => {
|
|
2127
2127
|
H && (d("socket", "Time ping timed out after 10s, clearing inflight"), H = null), $ = null;
|
|
2128
2128
|
}, 1e4));
|
|
@@ -2130,12 +2130,12 @@ function Da() {
|
|
|
2130
2130
|
function Rn(e) {
|
|
2131
2131
|
const t = f.getState(), n = t.me.clientId;
|
|
2132
2132
|
if (!n || !t.roster[n]) {
|
|
2133
|
-
|
|
2133
|
+
Ut(e), d("socket", "Avatar change before join: the join will carry it", { sprite: e });
|
|
2134
2134
|
return;
|
|
2135
2135
|
}
|
|
2136
2136
|
me = !0;
|
|
2137
2137
|
try {
|
|
2138
|
-
|
|
2138
|
+
Ut(e);
|
|
2139
2139
|
} finally {
|
|
2140
2140
|
me = !1;
|
|
2141
2141
|
}
|
|
@@ -2154,14 +2154,14 @@ f.subscribe((e, t) => {
|
|
|
2154
2154
|
const s = {};
|
|
2155
2155
|
a && (s.name = e.name, xe.name = e.name), i && (s.sprite = e.sprite, xe.sprite = e.sprite), d("socket", "Identity reassert (store change)", s), w?.connected ? w.emit(_.IDENTITY_UPDATE, s) : re().emit(_.IDENTITY_UPDATE, s);
|
|
2156
2156
|
});
|
|
2157
|
-
function
|
|
2157
|
+
function La() {
|
|
2158
2158
|
Ne && (clearInterval(Ne), Ne = null), $ && (clearTimeout($), $ = null), H = null, ee.unansweredSince = null, ee.lastTickAt = null;
|
|
2159
2159
|
}
|
|
2160
|
-
function
|
|
2160
|
+
function ja() {
|
|
2161
2161
|
d("socket", "clearJoinState called", { hadPayload: W !== null, room_key: W?.room_key }), W = null, ae = !1, Pn = null;
|
|
2162
2162
|
}
|
|
2163
|
-
function
|
|
2164
|
-
d("socket", "leaveRoom called", { room_key: W?.room_key }),
|
|
2163
|
+
function Bt() {
|
|
2164
|
+
d("socket", "leaveRoom called", { room_key: W?.room_key }), ja(), La(), w && (w.disconnect(), w = null), f.setState({
|
|
2165
2165
|
me: { clientId: null, nextClientSeq: 1 },
|
|
2166
2166
|
roster: {},
|
|
2167
2167
|
snapshot: { roomId: null, mediaId: null, playheadMs: 0, playing: !1, serverSeq: 0, leaderId: null },
|
|
@@ -2176,51 +2176,51 @@ function qt() {
|
|
|
2176
2176
|
activeGameId: null
|
|
2177
2177
|
});
|
|
2178
2178
|
}
|
|
2179
|
-
function
|
|
2179
|
+
function Ua() {
|
|
2180
2180
|
d("chat", "Emitting recap_request"), re().emit("recap_request");
|
|
2181
2181
|
}
|
|
2182
|
-
function
|
|
2183
|
-
N(() =>
|
|
2182
|
+
function Fa() {
|
|
2183
|
+
N(() => na((e) => {
|
|
2184
2184
|
const t = kn(e);
|
|
2185
2185
|
d("avatar", "Avatar changed in the settings popout", { sprite: t, source: e.avatar?.source }), Rn(t);
|
|
2186
2186
|
}), []);
|
|
2187
2187
|
}
|
|
2188
|
-
const
|
|
2189
|
-
function
|
|
2188
|
+
const Ha = 0.3, $a = 0.82, Q = 24, Ba = 32;
|
|
2189
|
+
function Ga(e) {
|
|
2190
2190
|
let t = 0, n = 0, r = 0, a = 0;
|
|
2191
2191
|
for (let i = 0; i + 3 < e.length; i += 4) {
|
|
2192
2192
|
const s = e[i + 3];
|
|
2193
|
-
s <
|
|
2193
|
+
s < Ba || (t += e[i] * s, n += e[i + 1] * s, r += e[i + 2] * s, a += s);
|
|
2194
2194
|
}
|
|
2195
|
-
return a === 0 ? null :
|
|
2195
|
+
return a === 0 ? null : qa(t / a, n / a, r / a);
|
|
2196
2196
|
}
|
|
2197
|
-
function
|
|
2198
|
-
const [r, a, i] =
|
|
2197
|
+
function qa(e, t, n) {
|
|
2198
|
+
const [r, a, i] = Va(e / 255, t / 255, n / 255), s = Math.min($a, Math.max(Ha, i)), [l, m, h] = Ka(r, a, s), u = (D) => Math.round(D * 255).toString(16).padStart(2, "0");
|
|
2199
2199
|
return `#${u(l)}${u(m)}${u(h)}`;
|
|
2200
2200
|
}
|
|
2201
|
-
function
|
|
2201
|
+
function Va(e, t, n) {
|
|
2202
2202
|
const r = Math.max(e, t, n), a = Math.min(e, t, n), i = (r + a) / 2;
|
|
2203
2203
|
if (r === a) return [0, 0, i];
|
|
2204
2204
|
const s = r - a, l = i > 0.5 ? s / (2 - r - a) : s / (r + a);
|
|
2205
2205
|
let m;
|
|
2206
2206
|
return r === e ? m = (t - n) / s + (t < n ? 6 : 0) : r === t ? m = (n - e) / s + 2 : m = (e - t) / s + 4, [m / 6, l, i];
|
|
2207
2207
|
}
|
|
2208
|
-
function
|
|
2208
|
+
function Ka(e, t, n) {
|
|
2209
2209
|
if (t === 0) return [n, n, n];
|
|
2210
2210
|
const r = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - r, i = (s) => (s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? a + (r - a) * 6 * s : s < 1 / 2 ? r : s < 2 / 3 ? a + (r - a) * (2 / 3 - s) * 6 : a);
|
|
2211
2211
|
return [i(e + 1 / 3), i(e), i(e - 1 / 3)];
|
|
2212
2212
|
}
|
|
2213
2213
|
const tt = /* @__PURE__ */ new Map(), Ve = /* @__PURE__ */ new Set(), nt = /* @__PURE__ */ new Set();
|
|
2214
|
-
function
|
|
2214
|
+
function Wa() {
|
|
2215
2215
|
for (const e of nt) e();
|
|
2216
2216
|
}
|
|
2217
|
-
function
|
|
2217
|
+
function Ya(e) {
|
|
2218
2218
|
if (tt.has(e) || Ve.has(e) || typeof Image > "u" || typeof document > "u") return;
|
|
2219
2219
|
Ve.add(e);
|
|
2220
2220
|
const t = new Image();
|
|
2221
2221
|
t.crossOrigin = "anonymous", t.referrerPolicy = "no-referrer";
|
|
2222
2222
|
const n = (r) => {
|
|
2223
|
-
Ve.delete(e), tt.set(e, r),
|
|
2223
|
+
Ve.delete(e), tt.set(e, r), Wa();
|
|
2224
2224
|
};
|
|
2225
2225
|
t.onload = () => {
|
|
2226
2226
|
try {
|
|
@@ -2231,28 +2231,28 @@ function Wa(e) {
|
|
|
2231
2231
|
n(null);
|
|
2232
2232
|
return;
|
|
2233
2233
|
}
|
|
2234
|
-
a.drawImage(t, 0, 0, Q, Q), n(
|
|
2234
|
+
a.drawImage(t, 0, 0, Q, Q), n(Ga(a.getImageData(0, 0, Q, Q).data));
|
|
2235
2235
|
} catch (r) {
|
|
2236
2236
|
d("avatar", "picture colour unreadable", { url: e, error: r instanceof Error ? r.message : String(r) }), n(null);
|
|
2237
2237
|
}
|
|
2238
2238
|
}, t.onerror = () => n(null), t.src = e;
|
|
2239
2239
|
}
|
|
2240
|
-
function
|
|
2240
|
+
function za(e) {
|
|
2241
2241
|
return nt.add(e), () => nt.delete(e);
|
|
2242
2242
|
}
|
|
2243
|
-
function
|
|
2243
|
+
function Xa(e, t) {
|
|
2244
2244
|
if (t) {
|
|
2245
2245
|
const n = tt.get(t);
|
|
2246
2246
|
if (n) return n;
|
|
2247
2247
|
}
|
|
2248
|
-
return
|
|
2248
|
+
return wn(e);
|
|
2249
2249
|
}
|
|
2250
2250
|
function On(e, t) {
|
|
2251
2251
|
return N(() => {
|
|
2252
|
-
t &&
|
|
2253
|
-
}, [t]), Ln(
|
|
2252
|
+
t && Ya(t);
|
|
2253
|
+
}, [t]), Ln(za, () => Xa(e, t), () => wn(e));
|
|
2254
2254
|
}
|
|
2255
|
-
function
|
|
2255
|
+
function Ja(e, t) {
|
|
2256
2256
|
if (t) {
|
|
2257
2257
|
for (const n of Object.values(e))
|
|
2258
2258
|
if (n.author === t && n.avatarUrl) return n.avatarUrl;
|
|
@@ -2273,10 +2273,10 @@ function Dn({ sprite: e, url: t, alt: n = "", className: r, style: a, fallback:
|
|
|
2273
2273
|
onError: () => l(t)
|
|
2274
2274
|
}
|
|
2275
2275
|
);
|
|
2276
|
-
const m =
|
|
2276
|
+
const m = Eo(e);
|
|
2277
2277
|
return m ? /* @__PURE__ */ c("img", { src: m, alt: n, crossOrigin: "anonymous", className: r, style: a, draggable: !1 }) : /* @__PURE__ */ c(ce, { children: i });
|
|
2278
2278
|
}
|
|
2279
|
-
function
|
|
2279
|
+
function Za({ sprite: e, url: t, alt: n, worn: r }) {
|
|
2280
2280
|
return /* @__PURE__ */ v("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
|
|
2281
2281
|
/* @__PURE__ */ c("span", { className: "hc-pic", children: /* @__PURE__ */ c(
|
|
2282
2282
|
Dn,
|
|
@@ -2291,18 +2291,18 @@ function Ja({ sprite: e, url: t, alt: n, worn: r }) {
|
|
|
2291
2291
|
r?.overlay && /* @__PURE__ */ c(et, { html: zn(r), style: { display: "contents" } })
|
|
2292
2292
|
] });
|
|
2293
2293
|
}
|
|
2294
|
-
function
|
|
2294
|
+
function Qa(e) {
|
|
2295
2295
|
return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
|
|
2296
2296
|
}
|
|
2297
|
-
function
|
|
2297
|
+
function ei({ src: e, title: t, onClose: n }) {
|
|
2298
2298
|
N(() => {
|
|
2299
2299
|
const i = (s) => {
|
|
2300
2300
|
s.key === "Escape" && (s.stopPropagation(), n());
|
|
2301
2301
|
};
|
|
2302
2302
|
return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
|
|
2303
2303
|
}, [n]);
|
|
2304
|
-
const r =
|
|
2305
|
-
return a ?
|
|
2304
|
+
const r = so(), a = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
|
|
2305
|
+
return a ? ir(
|
|
2306
2306
|
/* @__PURE__ */ v(
|
|
2307
2307
|
"div",
|
|
2308
2308
|
{
|
|
@@ -2340,11 +2340,11 @@ function Qa({ src: e, title: t, onClose: n }) {
|
|
|
2340
2340
|
a
|
|
2341
2341
|
) : null;
|
|
2342
2342
|
}
|
|
2343
|
-
const Ke = 240,
|
|
2344
|
-
function
|
|
2343
|
+
const Ke = 240, ti = 320;
|
|
2344
|
+
function ni({ image: e }) {
|
|
2345
2345
|
const [t, n] = R(!1), r = Re(e.key);
|
|
2346
2346
|
if (!r) return null;
|
|
2347
|
-
const a = e.w > 0 && e.h > 0, i = a ? Math.min(1,
|
|
2347
|
+
const a = e.w > 0 && e.h > 0, i = a ? Math.min(1, ti / e.w, Ke / e.h) : 1;
|
|
2348
2348
|
return /* @__PURE__ */ v(ce, { children: [
|
|
2349
2349
|
/* @__PURE__ */ c(
|
|
2350
2350
|
"a",
|
|
@@ -2355,7 +2355,7 @@ function ti({ image: e }) {
|
|
|
2355
2355
|
className: "block max-w-full cursor-zoom-in",
|
|
2356
2356
|
"data-testid": "chat-image",
|
|
2357
2357
|
onClick: (s) => {
|
|
2358
|
-
|
|
2358
|
+
Qa(s) && (s.preventDefault(), n(!0));
|
|
2359
2359
|
},
|
|
2360
2360
|
children: /* @__PURE__ */ c(
|
|
2361
2361
|
"img",
|
|
@@ -2373,7 +2373,7 @@ function ti({ image: e }) {
|
|
|
2373
2373
|
}
|
|
2374
2374
|
),
|
|
2375
2375
|
t && /* @__PURE__ */ c(
|
|
2376
|
-
|
|
2376
|
+
ei,
|
|
2377
2377
|
{
|
|
2378
2378
|
src: r,
|
|
2379
2379
|
title: e.title,
|
|
@@ -2382,18 +2382,18 @@ function ti({ image: e }) {
|
|
|
2382
2382
|
)
|
|
2383
2383
|
] });
|
|
2384
2384
|
}
|
|
2385
|
-
function
|
|
2386
|
-
return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(
|
|
2385
|
+
function ri({ images: e }) {
|
|
2386
|
+
return e?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: e.map((t, n) => /* @__PURE__ */ c(ni, { image: t }, `${t.key}-${n}`)) }) : null;
|
|
2387
2387
|
}
|
|
2388
|
-
function
|
|
2388
|
+
function oi(e, t) {
|
|
2389
2389
|
return e.author && t.author ? e.author === t.author : !!t.clientId && e.clientId === t.clientId;
|
|
2390
2390
|
}
|
|
2391
2391
|
function We(e) {
|
|
2392
2392
|
return new Date(e).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
2393
2393
|
}
|
|
2394
|
-
const
|
|
2395
|
-
const n = f((u) => u.me.clientId), r = f((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), a =
|
|
2396
|
-
|
|
2394
|
+
const ai = Pe.memo(function({ message: t }) {
|
|
2395
|
+
const n = f((u) => u.me.clientId), r = f((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), a = oi(t, { clientId: n, author: r }), i = f((u) => Ja(u.roster, t.author)), s = On(t.sprite, i), l = Vo(t.isSystem ? void 0 : t.author), m = K(null);
|
|
2396
|
+
Wo(m, !!l);
|
|
2397
2397
|
const [h] = R(
|
|
2398
2398
|
() => t.live && t.text ? Xn(t.text, l) : null
|
|
2399
2399
|
);
|
|
@@ -2406,18 +2406,18 @@ const oi = Pe.memo(function({ message: t }) {
|
|
|
2406
2406
|
] }) }) : t.isSystem ? /* @__PURE__ */ v("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
|
|
2407
2407
|
t.text,
|
|
2408
2408
|
/* @__PURE__ */ c("span", { className: "ml-1 text-[10px] opacity-50", children: We(t.ts) })
|
|
2409
|
-
] }) : /* @__PURE__ */ v("div", { ref: m, style:
|
|
2410
|
-
/* @__PURE__ */ c(
|
|
2409
|
+
] }) : /* @__PURE__ */ v("div", { ref: m, style: Ko(s), className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${a ? "bg-bg-card/30" : ""}`, children: [
|
|
2410
|
+
/* @__PURE__ */ c(Za, { sprite: t.sprite, url: i, alt: t.name, worn: l }),
|
|
2411
2411
|
/* @__PURE__ */ v("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
|
|
2412
2412
|
l ? /* @__PURE__ */ c(et, { html: Jn(t.name, l), className: "text-[13px]", style: { color: s } }) : /* @__PURE__ */ c("span", { className: "font-medium text-[13px]", style: { color: s }, children: t.name }),
|
|
2413
2413
|
/* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: We(t.ts) }),
|
|
2414
2414
|
t.text && (h ? /* @__PURE__ */ c(et, { as: "p", html: h, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ c("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: t.text })),
|
|
2415
|
-
/* @__PURE__ */ c(
|
|
2415
|
+
/* @__PURE__ */ c(ri, { images: t.images })
|
|
2416
2416
|
] })
|
|
2417
2417
|
] });
|
|
2418
2418
|
});
|
|
2419
|
-
function
|
|
2420
|
-
|
|
2419
|
+
function ii() {
|
|
2420
|
+
Go();
|
|
2421
2421
|
const e = f((a) => a.chat), t = K(null), n = K(!1), r = k(() => {
|
|
2422
2422
|
const a = t.current;
|
|
2423
2423
|
if (!a) return;
|
|
@@ -2441,13 +2441,13 @@ function ai() {
|
|
|
2441
2441
|
/* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(a.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
|
|
2442
2442
|
/* @__PURE__ */ c("div", { className: "flex-1 h-px bg-border" })
|
|
2443
2443
|
] }),
|
|
2444
|
-
/* @__PURE__ */ c(
|
|
2444
|
+
/* @__PURE__ */ c(ai, { message: a })
|
|
2445
2445
|
] }, a.id);
|
|
2446
2446
|
}) })
|
|
2447
2447
|
}
|
|
2448
2448
|
);
|
|
2449
2449
|
}
|
|
2450
|
-
const
|
|
2450
|
+
const vt = [
|
|
2451
2451
|
{
|
|
2452
2452
|
name: "recap",
|
|
2453
2453
|
description: "Summarise the previous episode of what is loaded",
|
|
@@ -2468,12 +2468,12 @@ const wt = [
|
|
|
2468
2468
|
scope: "local"
|
|
2469
2469
|
}
|
|
2470
2470
|
], te = "/";
|
|
2471
|
-
function
|
|
2471
|
+
function si(e) {
|
|
2472
2472
|
if (!e.startsWith(te)) return null;
|
|
2473
2473
|
const t = e.slice(te.length);
|
|
2474
2474
|
return /\s/.test(t) ? null : t.toLowerCase();
|
|
2475
2475
|
}
|
|
2476
|
-
function
|
|
2476
|
+
function li(e, t = vt) {
|
|
2477
2477
|
const n = e.toLowerCase();
|
|
2478
2478
|
if (!n) return [...t].sort((a, i) => a.name.localeCompare(i.name));
|
|
2479
2479
|
const r = [];
|
|
@@ -2483,23 +2483,23 @@ function si(e, t = wt) {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
return r.sort((a, i) => a.rank - i.rank || a.cmd.name.localeCompare(i.cmd.name)).map((a) => a.cmd);
|
|
2485
2485
|
}
|
|
2486
|
-
function
|
|
2486
|
+
function ci(e) {
|
|
2487
2487
|
return `${te}${e.name} `;
|
|
2488
2488
|
}
|
|
2489
2489
|
function Ye(e, t) {
|
|
2490
2490
|
return t <= 0 ? 0 : (e % t + t) % t;
|
|
2491
2491
|
}
|
|
2492
|
-
function
|
|
2492
|
+
function di(e, t = vt) {
|
|
2493
2493
|
const n = e.trim();
|
|
2494
2494
|
if (!n) return null;
|
|
2495
2495
|
if (!n.startsWith(te)) return { kind: "chat", text: n };
|
|
2496
2496
|
const r = n.slice(te.length), a = r.search(/\s/), i = (a === -1 ? r : r.slice(0, a)).toLowerCase(), s = a === -1 ? "" : r.slice(a).trim(), l = t.find((m) => m.name.toLowerCase() === i);
|
|
2497
2497
|
return l ? { kind: "command", command: l, args: s } : { kind: "chat", text: n };
|
|
2498
2498
|
}
|
|
2499
|
-
function
|
|
2499
|
+
function ui(e, t) {
|
|
2500
2500
|
return e.requiresMedia && !t.hasMedia ? `${te}${e.name} needs an episode loaded.` : null;
|
|
2501
2501
|
}
|
|
2502
|
-
function
|
|
2502
|
+
function mi({
|
|
2503
2503
|
commands: e,
|
|
2504
2504
|
activeIndex: t,
|
|
2505
2505
|
hasMedia: n,
|
|
@@ -2541,7 +2541,7 @@ function ui({
|
|
|
2541
2541
|
}
|
|
2542
2542
|
);
|
|
2543
2543
|
}
|
|
2544
|
-
function
|
|
2544
|
+
function fi({
|
|
2545
2545
|
pending: e,
|
|
2546
2546
|
uploading: t,
|
|
2547
2547
|
onRemove: n
|
|
@@ -2568,24 +2568,24 @@ function mi({
|
|
|
2568
2568
|
)
|
|
2569
2569
|
] }, r.id)) }) : null;
|
|
2570
2570
|
}
|
|
2571
|
-
function
|
|
2571
|
+
function pi() {
|
|
2572
2572
|
const [e, t] = R([]), [n, r] = R(!1), a = f((p) => p.pushToast), i = K(/* @__PURE__ */ new Set());
|
|
2573
2573
|
N(() => () => {
|
|
2574
2574
|
for (const p of i.current) URL.revokeObjectURL(p);
|
|
2575
2575
|
i.current.clear();
|
|
2576
2576
|
}, []);
|
|
2577
2577
|
const s = k((p) => {
|
|
2578
|
-
|
|
2578
|
+
qr(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
|
|
2579
2579
|
}, []), l = k(async (p) => {
|
|
2580
2580
|
if (!p.length) return;
|
|
2581
2581
|
const S = [];
|
|
2582
2582
|
for (const b of p) {
|
|
2583
|
-
const I =
|
|
2583
|
+
const I = Kr(b);
|
|
2584
2584
|
if (I) {
|
|
2585
2585
|
a("error", I);
|
|
2586
2586
|
continue;
|
|
2587
2587
|
}
|
|
2588
|
-
const { w: g, h: E } = await
|
|
2588
|
+
const { w: g, h: E } = await zr(b), O = URL.createObjectURL(b);
|
|
2589
2589
|
i.current.add(O), S.push({
|
|
2590
2590
|
kind: "file",
|
|
2591
2591
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
@@ -2620,7 +2620,7 @@ function fi() {
|
|
|
2620
2620
|
w: p.width ?? 0,
|
|
2621
2621
|
h: p.height ?? 0,
|
|
2622
2622
|
title: p.title || void 0
|
|
2623
|
-
}]), Ue().catalogue(
|
|
2623
|
+
}]), Ue().catalogue(fn).recordUse(p.key));
|
|
2624
2624
|
}, [a]), h = k((p) => {
|
|
2625
2625
|
t((S) => {
|
|
2626
2626
|
const b = S.find((I) => I.id === p);
|
|
@@ -2632,10 +2632,10 @@ function fi() {
|
|
|
2632
2632
|
return [];
|
|
2633
2633
|
});
|
|
2634
2634
|
}, [s]), D = k((p) => {
|
|
2635
|
-
const S =
|
|
2635
|
+
const S = Wr(p.clipboardData);
|
|
2636
2636
|
S.length && (p.preventDefault(), l(S));
|
|
2637
2637
|
}, [l]), M = k((p) => {
|
|
2638
|
-
const S =
|
|
2638
|
+
const S = Yr(p.dataTransfer);
|
|
2639
2639
|
S.length && (p.preventDefault(), l(S));
|
|
2640
2640
|
}, [l]), L = k((p) => {
|
|
2641
2641
|
p.dataTransfer?.types?.includes("Files") && p.preventDefault();
|
|
@@ -2643,9 +2643,9 @@ function fi() {
|
|
|
2643
2643
|
if (!e.length) return [];
|
|
2644
2644
|
r(!0);
|
|
2645
2645
|
try {
|
|
2646
|
-
return await
|
|
2646
|
+
return await Jr(e);
|
|
2647
2647
|
} catch (p) {
|
|
2648
|
-
return A("chat", "Image upload failed",
|
|
2648
|
+
return A("chat", "Image upload failed", Zr(p)), a("error", Vr(p)), null;
|
|
2649
2649
|
} finally {
|
|
2650
2650
|
r(!1);
|
|
2651
2651
|
}
|
|
@@ -2663,16 +2663,16 @@ function fi() {
|
|
|
2663
2663
|
onDragOver: L
|
|
2664
2664
|
};
|
|
2665
2665
|
}
|
|
2666
|
-
const
|
|
2667
|
-
function
|
|
2668
|
-
const [t, n] = R(""), [r, a] = R(!1), [i, s] = R({ q: null, i: 0 }), [l, m] = R(!1), h = K(null), u = jn(), [D, M] = R(!1), [L, C] = R(!1), p =
|
|
2669
|
-
() => E === null ? [] :
|
|
2666
|
+
const Gt = Jt, hi = cr;
|
|
2667
|
+
function gi({ commands: e = vt }) {
|
|
2668
|
+
const [t, n] = R(""), [r, a] = R(!1), [i, s] = R({ q: null, i: 0 }), [l, m] = R(!1), h = K(null), u = jn(), [D, M] = R(!1), [L, C] = R(!1), p = pi(), S = f((y) => y.snapshot.mediaId), b = f((y) => y.pushToast), I = f((y) => y.setTierlistOpen), g = !!S, E = si(t), O = J(
|
|
2669
|
+
() => E === null ? [] : li(E, e),
|
|
2670
2670
|
[E, e]
|
|
2671
|
-
),
|
|
2671
|
+
), j = E !== null && !l && O.length > 0, F = i.q === E ? Ye(i.i, O.length) : 0, x = k(
|
|
2672
2672
|
(y) => s({ q: E, i: y }),
|
|
2673
2673
|
[E]
|
|
2674
|
-
), P = k((y,
|
|
2675
|
-
const oe =
|
|
2674
|
+
), P = k((y, U) => {
|
|
2675
|
+
const oe = ui(y, { hasMedia: g });
|
|
2676
2676
|
if (oe) {
|
|
2677
2677
|
b("info", oe);
|
|
2678
2678
|
return;
|
|
@@ -2682,58 +2682,58 @@ function hi({ commands: e = wt }) {
|
|
|
2682
2682
|
b("info", e.map((Mn) => Mn.usage).join(" "));
|
|
2683
2683
|
break;
|
|
2684
2684
|
case "recap":
|
|
2685
|
-
|
|
2685
|
+
Ua();
|
|
2686
2686
|
break;
|
|
2687
2687
|
case "tierlist":
|
|
2688
|
-
|
|
2688
|
+
Zo(), I(!0);
|
|
2689
2689
|
break;
|
|
2690
2690
|
default:
|
|
2691
2691
|
b("info", `${y.usage} is not implemented yet.`);
|
|
2692
2692
|
}
|
|
2693
2693
|
}, [g, b, e, I]), T = k((y) => {
|
|
2694
|
-
n(
|
|
2694
|
+
n(ci(y)), m(!1), h.current?.focus();
|
|
2695
2695
|
}, []), he = k(async (y) => {
|
|
2696
2696
|
if (y.preventDefault(), r || p.uploading) return;
|
|
2697
|
-
const
|
|
2698
|
-
if (!
|
|
2699
|
-
if (
|
|
2697
|
+
const U = di(t, e);
|
|
2698
|
+
if (!U && !p.pending.length) return;
|
|
2699
|
+
if (U?.kind === "command" && p.pending.length) {
|
|
2700
2700
|
b("info", "Send images on their own, not with a command.");
|
|
2701
2701
|
return;
|
|
2702
2702
|
}
|
|
2703
|
-
if (
|
|
2704
|
-
P(
|
|
2703
|
+
if (U?.kind === "command") {
|
|
2704
|
+
P(U.command, U.args), n(""), !document.hidden && document.hasFocus() && h.current?.focus();
|
|
2705
2705
|
return;
|
|
2706
2706
|
}
|
|
2707
2707
|
const oe = await p.uploadPending();
|
|
2708
|
-
oe !== null && (
|
|
2708
|
+
oe !== null && (Da(U?.text ?? "", oe), n(""), p.clear(), a(!0), setTimeout(() => a(!1), hi), !document.hidden && document.hasFocus() && h.current?.focus());
|
|
2709
2709
|
}, [t, r, P, p, b, e]), ge = k((y) => {
|
|
2710
|
-
if (y.key === "Escape" &&
|
|
2710
|
+
if (y.key === "Escape" && j) {
|
|
2711
2711
|
y.preventDefault(), m(!0);
|
|
2712
2712
|
return;
|
|
2713
2713
|
}
|
|
2714
|
-
if (
|
|
2714
|
+
if (j) {
|
|
2715
2715
|
if (y.key === "ArrowDown")
|
|
2716
2716
|
y.preventDefault(), x(Ye(F + 1, O.length));
|
|
2717
2717
|
else if (y.key === "ArrowUp")
|
|
2718
2718
|
y.preventDefault(), x(Ye(F - 1, O.length));
|
|
2719
2719
|
else if (y.key === "Tab") {
|
|
2720
2720
|
y.preventDefault();
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2721
|
+
const U = O[F];
|
|
2722
|
+
U && T(U);
|
|
2723
2723
|
} else if (y.key === "Enter") {
|
|
2724
2724
|
y.preventDefault();
|
|
2725
|
-
const
|
|
2726
|
-
|
|
2725
|
+
const U = O[F];
|
|
2726
|
+
U && T(U);
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
2729
|
-
}, [
|
|
2729
|
+
}, [j, O, F, T, x]);
|
|
2730
2730
|
N(() => {
|
|
2731
2731
|
const y = () => {
|
|
2732
2732
|
document.hidden || !document.hasFocus() || (h.current?.focus(), h.current?.scrollIntoView({ block: "nearest" }));
|
|
2733
2733
|
};
|
|
2734
2734
|
return window.addEventListener("watchparty:focus-chat-input", y), () => window.removeEventListener("watchparty:focus-chat-input", y);
|
|
2735
2735
|
}, []);
|
|
2736
|
-
const ye =
|
|
2736
|
+
const ye = Gt - t.length, St = ye <= 100, wt = j ? O[F] : void 0;
|
|
2737
2737
|
return /* @__PURE__ */ v(
|
|
2738
2738
|
"form",
|
|
2739
2739
|
{
|
|
@@ -2745,10 +2745,10 @@ function hi({ commands: e = wt }) {
|
|
|
2745
2745
|
onDragOver: p.onDragOver,
|
|
2746
2746
|
className: "p-2 border-t border-border",
|
|
2747
2747
|
children: [
|
|
2748
|
-
/* @__PURE__ */ c(
|
|
2748
|
+
/* @__PURE__ */ c(fi, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
|
|
2749
2749
|
/* @__PURE__ */ v("div", { className: "relative", children: [
|
|
2750
|
-
|
|
2751
|
-
|
|
2750
|
+
j && /* @__PURE__ */ c(
|
|
2751
|
+
mi,
|
|
2752
2752
|
{
|
|
2753
2753
|
commands: O,
|
|
2754
2754
|
activeIndex: F,
|
|
@@ -2759,7 +2759,7 @@ function hi({ commands: e = wt }) {
|
|
|
2759
2759
|
}
|
|
2760
2760
|
),
|
|
2761
2761
|
/* @__PURE__ */ c(
|
|
2762
|
-
|
|
2762
|
+
ro,
|
|
2763
2763
|
{
|
|
2764
2764
|
open: D,
|
|
2765
2765
|
onClose: () => M(!1),
|
|
@@ -2781,17 +2781,17 @@ function hi({ commands: e = wt }) {
|
|
|
2781
2781
|
n(y.target.value), m(!1);
|
|
2782
2782
|
},
|
|
2783
2783
|
onKeyDown: ge,
|
|
2784
|
-
maxLength:
|
|
2784
|
+
maxLength: Gt,
|
|
2785
2785
|
placeholder: "Send a message",
|
|
2786
2786
|
role: "combobox",
|
|
2787
|
-
"aria-expanded":
|
|
2788
|
-
"aria-controls":
|
|
2789
|
-
"aria-activedescendant":
|
|
2787
|
+
"aria-expanded": j,
|
|
2788
|
+
"aria-controls": j ? u : void 0,
|
|
2789
|
+
"aria-activedescendant": wt ? `${u}-opt-${wt.name}` : void 0,
|
|
2790
2790
|
"aria-autocomplete": "list",
|
|
2791
|
-
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 ${
|
|
2791
|
+
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 ${St ? "pr-12" : ""}`
|
|
2792
2792
|
}
|
|
2793
2793
|
),
|
|
2794
|
-
/* @__PURE__ */ c("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${ye <= 50 ? ye <= 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:
|
|
2794
|
+
/* @__PURE__ */ c("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${ye <= 50 ? ye <= 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: St && ye })
|
|
2795
2795
|
] }),
|
|
2796
2796
|
!L && /* @__PURE__ */ c(
|
|
2797
2797
|
"button",
|
|
@@ -2812,11 +2812,11 @@ function hi({ commands: e = wt }) {
|
|
|
2812
2812
|
}
|
|
2813
2813
|
);
|
|
2814
2814
|
}
|
|
2815
|
-
function
|
|
2815
|
+
function yi() {
|
|
2816
2816
|
const e = f((n) => n.roster), t = Object.values(e);
|
|
2817
|
-
return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(
|
|
2817
|
+
return t.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: t.map((n) => /* @__PURE__ */ c(bi, { u: n }, n.clientId)) }) : /* @__PURE__ */ c("div", { className: "text-xs text-text-muted", children: "No users online" });
|
|
2818
2818
|
}
|
|
2819
|
-
function
|
|
2819
|
+
function bi({ u: e }) {
|
|
2820
2820
|
const t = On(e.sprite, e.avatarUrl);
|
|
2821
2821
|
return /* @__PURE__ */ v("div", { className: "flex items-center gap-2 py-0.5", children: [
|
|
2822
2822
|
/* @__PURE__ */ c(
|
|
@@ -2833,7 +2833,7 @@ function yi({ u: e }) {
|
|
|
2833
2833
|
e.isLeader && /* @__PURE__ */ c("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
|
|
2834
2834
|
] });
|
|
2835
2835
|
}
|
|
2836
|
-
function
|
|
2836
|
+
function vi() {
|
|
2837
2837
|
const e = f((a) => Object.keys(a.roster).length), [t, n] = R(!1), r = K(null);
|
|
2838
2838
|
return N(() => {
|
|
2839
2839
|
if (!t) return;
|
|
@@ -2861,11 +2861,11 @@ function bi() {
|
|
|
2861
2861
|
e,
|
|
2862
2862
|
" online"
|
|
2863
2863
|
] }),
|
|
2864
|
-
/* @__PURE__ */ c(
|
|
2864
|
+
/* @__PURE__ */ c(yi, {})
|
|
2865
2865
|
] })
|
|
2866
2866
|
] });
|
|
2867
2867
|
}
|
|
2868
|
-
function
|
|
2868
|
+
function qt({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
|
|
2869
2869
|
const t = f((r) => r.toasts), n = f((r) => r.popToast);
|
|
2870
2870
|
return N(() => {
|
|
2871
2871
|
const r = t.map((a) => setTimeout(() => n(a.id), 4e3));
|
|
@@ -2874,39 +2874,39 @@ function Kt({ className: e = "fixed bottom-4 left-1/2 -translate-x-1/2" }) {
|
|
|
2874
2874
|
};
|
|
2875
2875
|
}, [t, n]), /* @__PURE__ */ c("div", { className: `${e} flex flex-col gap-2 z-50`, children: t.map((r) => /* @__PURE__ */ c("div", { className: `px-3 py-2 rounded text-sm shadow font-medium border ${r.kind === "error" ? "bg-danger-bg text-on-danger-bg border-danger" : "bg-bg-card border-border-light text-text"}`, children: r.msg }, r.id)) });
|
|
2876
2876
|
}
|
|
2877
|
-
const
|
|
2878
|
-
function
|
|
2879
|
-
return e || (
|
|
2877
|
+
const Vt = (e) => typeof e == "string" && Fn.includes(e);
|
|
2878
|
+
function Si(e, t, n) {
|
|
2879
|
+
return e || (Vt(t) ? t : Vt(n) ? n : "dark");
|
|
2880
2880
|
}
|
|
2881
|
-
function
|
|
2881
|
+
function wi(e, t) {
|
|
2882
2882
|
if (t(e.clientWidth), typeof ResizeObserver > "u") return () => {
|
|
2883
2883
|
};
|
|
2884
2884
|
const n = new ResizeObserver(() => t(e.clientWidth));
|
|
2885
2885
|
return n.observe(e), () => n.disconnect();
|
|
2886
2886
|
}
|
|
2887
|
-
function
|
|
2887
|
+
function _i(e) {
|
|
2888
2888
|
const t = e?.trim() ?? "";
|
|
2889
2889
|
return t ? { source: "host", name: t } : { source: "auto" };
|
|
2890
2890
|
}
|
|
2891
|
-
function
|
|
2891
|
+
function xi(e) {
|
|
2892
2892
|
if (e.source !== "host") return;
|
|
2893
2893
|
const { setSessionIdentity: t, sprite: n } = f.getState();
|
|
2894
2894
|
t(e.name, n);
|
|
2895
2895
|
}
|
|
2896
|
-
function
|
|
2896
|
+
function Ii({ className: e = "w-4 h-4" }) {
|
|
2897
2897
|
return /* @__PURE__ */ v("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2898
2898
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
|
|
2899
2899
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
|
|
2900
2900
|
] });
|
|
2901
2901
|
}
|
|
2902
|
-
function
|
|
2902
|
+
function Ci({ className: e = "w-4 h-4" }) {
|
|
2903
2903
|
return /* @__PURE__ */ v("svg", { className: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2904
2904
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
|
|
2905
2905
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
|
|
2906
2906
|
] });
|
|
2907
2907
|
}
|
|
2908
|
-
const
|
|
2909
|
-
function
|
|
2908
|
+
const Ti = 1500;
|
|
2909
|
+
function $i({
|
|
2910
2910
|
roomKey: e,
|
|
2911
2911
|
serverOrigin: t,
|
|
2912
2912
|
userType: n,
|
|
@@ -2919,47 +2919,47 @@ function Hi({
|
|
|
2919
2919
|
debug: h,
|
|
2920
2920
|
children: u
|
|
2921
2921
|
}) {
|
|
2922
|
-
const [D, M] = R(null), { setFrame: L, ...C } =
|
|
2923
|
-
() =>
|
|
2922
|
+
const [D, M] = R(null), { setFrame: L, ...C } = Ai(l, m), p = Wt(() => i), S = J(() => (No({ userType: n, userId: r ?? null }), ht().theme), [n, r]), b = Hn(), I = b?.theme, g = J(
|
|
2923
|
+
() => Si(a, I, S),
|
|
2924
2924
|
[a, I, S]
|
|
2925
2925
|
);
|
|
2926
2926
|
N(() => {
|
|
2927
2927
|
}, [a, b !== null]);
|
|
2928
2928
|
const O = J(
|
|
2929
|
-
() => ({ ...
|
|
2929
|
+
() => ({ ...dt, serverOrigin: t, defaultRoomKey: e }),
|
|
2930
2930
|
[t, e]
|
|
2931
2931
|
);
|
|
2932
2932
|
return N(() => {
|
|
2933
|
-
h &&
|
|
2934
|
-
}, [h]),
|
|
2935
|
-
|
|
2936
|
-
let
|
|
2937
|
-
const F =
|
|
2933
|
+
h && uo();
|
|
2934
|
+
}, [h]), Fa(), N(() => {
|
|
2935
|
+
oo({ serverOrigin: t, defaultRoomKey: e }), f.getState().rehydrateFromPrefs(), ua();
|
|
2936
|
+
let j = !1;
|
|
2937
|
+
const F = ko();
|
|
2938
2938
|
return (async () => {
|
|
2939
2939
|
try {
|
|
2940
2940
|
await Promise.race([
|
|
2941
2941
|
Promise.all([
|
|
2942
2942
|
F,
|
|
2943
|
-
|
|
2943
|
+
jo().then((T) => {
|
|
2944
2944
|
T && f.getState().rehydrateFromPrefs();
|
|
2945
2945
|
}),
|
|
2946
2946
|
// The character chosen in the settings popout (lib/avatar.ts).
|
|
2947
|
-
|
|
2947
|
+
ta().then(Rn)
|
|
2948
2948
|
]),
|
|
2949
|
-
new Promise((T) => setTimeout(T,
|
|
2949
|
+
new Promise((T) => setTimeout(T, Ti))
|
|
2950
2950
|
]);
|
|
2951
2951
|
} catch (T) {
|
|
2952
2952
|
A("room-chrome", "pre-join wait threw, proceeding anyway", pe(T));
|
|
2953
2953
|
}
|
|
2954
|
-
if (
|
|
2955
|
-
const x =
|
|
2956
|
-
f.getState().ensureAutoIdentity(),
|
|
2954
|
+
if (j) return;
|
|
2955
|
+
const x = _i(p());
|
|
2956
|
+
f.getState().ensureAutoIdentity(), xi(x);
|
|
2957
2957
|
const P = f.getState();
|
|
2958
|
-
d("room-chrome", "Joining room", { roomKey: e, name: P.name, sprite: P.sprite }),
|
|
2958
|
+
d("room-chrome", "Joining room", { roomKey: e, name: P.name, sprite: P.sprite }), wa({ room_key: e, name: P.name || void 0, sprite: P.sprite || void 0 });
|
|
2959
2959
|
})(), () => {
|
|
2960
|
-
|
|
2960
|
+
j = !0, Bt();
|
|
2961
2961
|
};
|
|
2962
|
-
}, [e, t, n, r]), /* @__PURE__ */ c(
|
|
2962
|
+
}, [e, t, n, r]), /* @__PURE__ */ c(ao.Provider, { value: O, children: /* @__PURE__ */ c(En.Provider, { value: !1, children: /* @__PURE__ */ c(hn.Provider, { value: D, children: /* @__PURE__ */ v("div", { ref: L, className: "wp-room-chrome-frame", children: [
|
|
2963
2963
|
/* @__PURE__ */ c("div", { className: "wp-room-chrome-frame__content", children: u }),
|
|
2964
2964
|
/* @__PURE__ */ c(
|
|
2965
2965
|
"aside",
|
|
@@ -2969,6 +2969,7 @@ function Hi({
|
|
|
2969
2969
|
"data-theme": g,
|
|
2970
2970
|
"data-collapsed": C.collapsed ? "1" : "0",
|
|
2971
2971
|
style: { "--wp-room-chrome-width": `${C.state.width}px` },
|
|
2972
|
+
onAnimationEnd: (j) => Zn(j.nativeEvent),
|
|
2972
2973
|
children: C.collapsed ? /* @__PURE__ */ v(ce, { children: [
|
|
2973
2974
|
/* @__PURE__ */ c(
|
|
2974
2975
|
"button",
|
|
@@ -2978,10 +2979,10 @@ function Hi({
|
|
|
2978
2979
|
title: "Show chat",
|
|
2979
2980
|
"aria-label": "Show chat",
|
|
2980
2981
|
"aria-expanded": !1,
|
|
2981
|
-
children: /* @__PURE__ */ c(
|
|
2982
|
+
children: /* @__PURE__ */ c(Ci, {})
|
|
2982
2983
|
}
|
|
2983
2984
|
),
|
|
2984
|
-
/* @__PURE__ */ c(
|
|
2985
|
+
/* @__PURE__ */ c(qt, { className: "absolute bottom-2 right-full mr-2 w-72" })
|
|
2985
2986
|
] }) : /* @__PURE__ */ v(ce, { children: [
|
|
2986
2987
|
/* @__PURE__ */ c(
|
|
2987
2988
|
"div",
|
|
@@ -2990,7 +2991,7 @@ function Hi({
|
|
|
2990
2991
|
"aria-orientation": "vertical",
|
|
2991
2992
|
"aria-label": "Resize chat",
|
|
2992
2993
|
"aria-valuemin": Le,
|
|
2993
|
-
"aria-valuemax":
|
|
2994
|
+
"aria-valuemax": gt,
|
|
2994
2995
|
"aria-valuenow": C.state.width,
|
|
2995
2996
|
tabIndex: 0,
|
|
2996
2997
|
className: "wp-room-chrome__resize",
|
|
@@ -3003,13 +3004,13 @@ function Hi({
|
|
|
3003
3004
|
}
|
|
3004
3005
|
),
|
|
3005
3006
|
/* @__PURE__ */ v("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
|
|
3006
|
-
/* @__PURE__ */ c(
|
|
3007
|
+
/* @__PURE__ */ c(vi, {}),
|
|
3007
3008
|
/* @__PURE__ */ c("div", { className: "flex-1" }),
|
|
3008
3009
|
s && /* @__PURE__ */ c(
|
|
3009
3010
|
"button",
|
|
3010
3011
|
{
|
|
3011
3012
|
onClick: () => {
|
|
3012
|
-
|
|
3013
|
+
Bt(), s();
|
|
3013
3014
|
},
|
|
3014
3015
|
className: "wp-room-chrome__leave",
|
|
3015
3016
|
title: "Leave room",
|
|
@@ -3025,25 +3026,25 @@ function Hi({
|
|
|
3025
3026
|
title: "Hide chat",
|
|
3026
3027
|
"aria-label": "Hide chat",
|
|
3027
3028
|
"aria-expanded": !0,
|
|
3028
|
-
children: /* @__PURE__ */ c(
|
|
3029
|
+
children: /* @__PURE__ */ c(Ii, {})
|
|
3029
3030
|
}
|
|
3030
3031
|
)
|
|
3031
3032
|
] }),
|
|
3032
|
-
/* @__PURE__ */ c(
|
|
3033
|
-
/* @__PURE__ */ c(
|
|
3034
|
-
/* @__PURE__ */ c(
|
|
3033
|
+
/* @__PURE__ */ c(ii, {}),
|
|
3034
|
+
/* @__PURE__ */ c(gi, { commands: [] }),
|
|
3035
|
+
/* @__PURE__ */ c(qt, { className: "absolute bottom-14 left-2 right-2" })
|
|
3035
3036
|
] })
|
|
3036
3037
|
}
|
|
3037
3038
|
)
|
|
3038
3039
|
] }) }) }) });
|
|
3039
3040
|
}
|
|
3040
|
-
function
|
|
3041
|
+
function Ai(e, t) {
|
|
3041
3042
|
const n = f((g) => g.chromeChatCollapsed) && t, r = f((g) => g.chromeChatWidth), a = f((g) => g.toggleChromeChatCollapsed), i = f((g) => g.setChromeChatWidth), [s, l] = R(null), [m, h] = R(void 0), [u, D] = R(null);
|
|
3042
3043
|
N(() => {
|
|
3043
3044
|
if (s)
|
|
3044
|
-
return
|
|
3045
|
+
return wi(s, h);
|
|
3045
3046
|
}, [s]);
|
|
3046
|
-
const M = V(u?.current ?? r, m), L = J(() =>
|
|
3047
|
+
const M = V(u?.current ?? r, m), L = J(() => Bo(n, M), [n, M]), C = Wt((g) => e?.(g));
|
|
3047
3048
|
return N(() => {
|
|
3048
3049
|
C(L);
|
|
3049
3050
|
}, [L]), {
|
|
@@ -3056,20 +3057,20 @@ function Ti(e, t) {
|
|
|
3056
3057
|
g.button === 0 && (g.preventDefault(), g.currentTarget.setPointerCapture(g.pointerId), D({ pointerId: g.pointerId, startX: g.clientX, startWidth: M, current: M }));
|
|
3057
3058
|
},
|
|
3058
3059
|
onPointerMove: (g) => {
|
|
3059
|
-
!u || u.pointerId !== g.pointerId || D({ ...u, current:
|
|
3060
|
+
!u || u.pointerId !== g.pointerId || D({ ...u, current: Mt(u.startWidth, u.startX, g.clientX, m) });
|
|
3060
3061
|
},
|
|
3061
3062
|
onPointerEnd: (g) => {
|
|
3062
3063
|
if (!u || u.pointerId !== g.pointerId) return;
|
|
3063
|
-
const E =
|
|
3064
|
+
const E = Mt(u.startWidth, u.startX, g.clientX, m);
|
|
3064
3065
|
D(null), E !== r && i(E);
|
|
3065
3066
|
},
|
|
3066
3067
|
onKeyDown: (g) => {
|
|
3067
|
-
const E =
|
|
3068
|
+
const E = $o(M, g.key, m);
|
|
3068
3069
|
E !== null && (g.preventDefault(), E !== r && i(E));
|
|
3069
3070
|
}
|
|
3070
3071
|
};
|
|
3071
3072
|
}
|
|
3072
3073
|
export {
|
|
3073
|
-
|
|
3074
|
+
$i as RoomChrome
|
|
3074
3075
|
};
|
|
3075
3076
|
//# sourceMappingURL=room-chrome.js.map
|