@hadoku/watchparty-ui 0.44.6 → 0.44.8
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-1S4mJpWS.js → AdminPanel-Bwn6LIOC.js} +6 -6
- package/dist/chunks/{AdminPanel-1S4mJpWS.js.map → AdminPanel-Bwn6LIOC.js.map} +1 -1
- package/dist/chunks/{CharacterModal-UtPjznzn.js → CharacterModal-BHb04Fee.js} +4 -4
- package/dist/chunks/{CharacterModal-UtPjznzn.js.map → CharacterModal-BHb04Fee.js.map} +1 -1
- package/dist/chunks/{GameModule-D1d7Zr6a.js → GameModule-D2TSoCac.js} +4 -4
- package/dist/chunks/{GameModule-D1d7Zr6a.js.map → GameModule-D2TSoCac.js.map} +1 -1
- package/dist/chunks/{MapEditor-C3KodXrH.js → MapEditor-Dd3OijeD.js} +2 -2
- package/dist/chunks/{MapEditor-C3KodXrH.js.map → MapEditor-Dd3OijeD.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-BFbOwOFm.js → MediaDrawer-Bq4rhXGa.js} +24 -24
- package/dist/chunks/{MediaDrawer-BFbOwOFm.js.map → MediaDrawer-Bq4rhXGa.js.map} +1 -1
- package/dist/chunks/{PlaylistPanel-CBEr11Uk.js → PlaylistPanel-BOU78K3d.js} +16 -16
- package/dist/chunks/{PlaylistPanel-CBEr11Uk.js.map → PlaylistPanel-BOU78K3d.js.map} +1 -1
- package/dist/chunks/{Room-CEvONUxa.js → Room-DXyTphDD.js} +1695 -1649
- package/dist/chunks/Room-DXyTphDD.js.map +1 -0
- package/dist/chunks/{index-CPnofWre.js → index-D8nwgvG0.js} +65 -63
- package/dist/chunks/{index-CPnofWre.js.map → index-D8nwgvG0.js.map} +1 -1
- package/dist/chunks/{submissionsApi-yLNU0Z4F.js → submissionsApi-BHPcbZrP.js} +9 -9
- package/dist/chunks/{submissionsApi-yLNU0Z4F.js.map → submissionsApi-BHPcbZrP.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/room-chrome.js +85 -83
- package/dist/room-chrome.js.map +1 -1
- package/dist/watchparty-ui.css +1 -1
- package/package.json +3 -3
- package/dist/chunks/Room-CEvONUxa.js.map +0 -1
package/dist/room-chrome.js
CHANGED
|
@@ -495,19 +495,19 @@ function vr(e) {
|
|
|
495
495
|
const t = e && typeof e == "object" ? e : {}, n = yr(t.mode) ? t.mode : rn.mode, o = Number(t.percent), i = Number.isFinite(o) ? Math.min(100, Math.max(0, Math.round(o))) : 0;
|
|
496
496
|
return { mode: n, percent: i };
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function Sr(e) {
|
|
499
499
|
let t = 2166136261;
|
|
500
500
|
for (let n = 0; n < e.length; n++)
|
|
501
501
|
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619) >>> 0;
|
|
502
502
|
return t >>> 0;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function wr(e, t, n) {
|
|
505
505
|
if (n === !0)
|
|
506
506
|
return "fragment";
|
|
507
507
|
if (n === !1)
|
|
508
508
|
return "range";
|
|
509
509
|
const o = vr(e);
|
|
510
|
-
return o.mode === "on" ? "fragment" : o.mode === "off" || o.percent <= 0 ? "range" : o.percent >= 100 || t &&
|
|
510
|
+
return o.mode === "on" ? "fragment" : o.mode === "off" || o.percent <= 0 ? "range" : o.percent >= 100 || t && Sr(t) % 100 < o.percent ? "fragment" : "range";
|
|
511
511
|
}
|
|
512
512
|
const on = r.enum(["url", "magnet", "upload"]), _r = r.enum([
|
|
513
513
|
"pending",
|
|
@@ -575,25 +575,25 @@ r.object({
|
|
|
575
575
|
/** The cap that was applied, from the server's config. */
|
|
576
576
|
capBytes: r.number().int().nonnegative()
|
|
577
577
|
});
|
|
578
|
-
const Ir = /^[a-z0-9][a-z0-9-]{0,31}$/,
|
|
578
|
+
const Ir = /^[a-z0-9][a-z0-9-]{0,31}$/, St = "https://game-catalog.invalid";
|
|
579
579
|
function Tr(e) {
|
|
580
580
|
if (!e.startsWith("/") || e.startsWith("//") || /[\\\s]/.test(e) || [...e].some((t) => t.charCodeAt(0) < 32 || t.charCodeAt(0) === 127))
|
|
581
581
|
return !1;
|
|
582
582
|
try {
|
|
583
|
-
return new URL(e,
|
|
583
|
+
return new URL(e, St).origin === St;
|
|
584
584
|
} catch {
|
|
585
585
|
return !1;
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
const sn = r.string().min(2).max(512).refine(Tr, {
|
|
589
589
|
message: "must be a root-relative path on the page origin (e.g. /cardtable/embed/x.js)"
|
|
590
|
-
}),
|
|
590
|
+
}), wt = {
|
|
591
591
|
id: r.string().regex(Ir),
|
|
592
592
|
name: r.string().min(1).max(64),
|
|
593
593
|
cover: sn.optional()
|
|
594
594
|
}, Er = r.discriminatedUnion("kind", [
|
|
595
|
-
r.object({ ...
|
|
596
|
-
r.object({ ...
|
|
595
|
+
r.object({ ...wt, kind: r.literal("iframe") }).strict(),
|
|
596
|
+
r.object({ ...wt, kind: r.literal("module"), url: sn }).strict()
|
|
597
597
|
]);
|
|
598
598
|
r.array(Er).max(32).refine((e) => new Set(e.map((t) => t.id)).size === e.length, { message: "game ids must be unique" });
|
|
599
599
|
const ot = r.enum(["anilist", "tmdb"]), Ar = r.object({
|
|
@@ -736,24 +736,24 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
736
736
|
mn,
|
|
737
737
|
o.trim()
|
|
738
738
|
), T = p?.reason ?? null, C = Q(() => {
|
|
739
|
-
const
|
|
740
|
-
return f.filter((R) =>
|
|
741
|
-
}, [f]), [h, _] = P(null),
|
|
742
|
-
|
|
739
|
+
const S = /* @__PURE__ */ new Set();
|
|
740
|
+
return f.filter((R) => S.has(R.key) ? !1 : (S.add(R.key), !0));
|
|
741
|
+
}, [f]), [h, _] = P(null), w = J(null), k = N(() => {
|
|
742
|
+
w.current !== null && (window.clearTimeout(w.current), w.current = null);
|
|
743
743
|
}, []), u = N(() => {
|
|
744
744
|
k(), _(null);
|
|
745
745
|
}, [k]), v = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, E = N(
|
|
746
|
-
(
|
|
746
|
+
(S, R, L = !1) => {
|
|
747
747
|
const F = s.current;
|
|
748
748
|
if (!F) return;
|
|
749
749
|
const W = () => _({
|
|
750
|
-
item:
|
|
750
|
+
item: S,
|
|
751
751
|
...Br(R.getBoundingClientRect(), F.getBoundingClientRect(), {
|
|
752
752
|
width: window.innerWidth,
|
|
753
753
|
height: window.innerHeight
|
|
754
754
|
})
|
|
755
755
|
});
|
|
756
|
-
k(), L ? W() :
|
|
756
|
+
k(), L ? W() : w.current = window.setTimeout(W, Gr);
|
|
757
757
|
},
|
|
758
758
|
[k]
|
|
759
759
|
);
|
|
@@ -762,17 +762,17 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
762
762
|
}, [T, n]), O(() => {
|
|
763
763
|
a.current?.focus();
|
|
764
764
|
}, []), O(() => {
|
|
765
|
-
const
|
|
765
|
+
const S = (L) => {
|
|
766
766
|
L.key === "Escape" && (L.stopPropagation(), e());
|
|
767
767
|
}, R = (L) => {
|
|
768
768
|
s.current && !s.current.contains(L.target) && e();
|
|
769
769
|
};
|
|
770
|
-
return document.addEventListener("keydown",
|
|
771
|
-
document.removeEventListener("keydown",
|
|
770
|
+
return document.addEventListener("keydown", S), document.addEventListener("mousedown", R), () => {
|
|
771
|
+
document.removeEventListener("keydown", S), document.removeEventListener("mousedown", R);
|
|
772
772
|
};
|
|
773
773
|
}, [e]);
|
|
774
|
-
const U = N((
|
|
775
|
-
t(
|
|
774
|
+
const U = N((S) => {
|
|
775
|
+
t(S), e();
|
|
776
776
|
}, [t, e]), H = !g && !p && C.length === 0;
|
|
777
777
|
return /* @__PURE__ */ b(
|
|
778
778
|
"div",
|
|
@@ -789,7 +789,7 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
789
789
|
ref: a,
|
|
790
790
|
type: "text",
|
|
791
791
|
value: o,
|
|
792
|
-
onChange: (
|
|
792
|
+
onChange: (S) => i(S.target.value),
|
|
793
793
|
placeholder: "Search memes...",
|
|
794
794
|
"aria-label": "Search memes",
|
|
795
795
|
"data-testid": "meme-search",
|
|
@@ -813,34 +813,34 @@ function Wr({ onClose: e, onPick: t, onUnavailable: n }) {
|
|
|
813
813
|
}
|
|
814
814
|
),
|
|
815
815
|
H && /* @__PURE__ */ l("p", { className: "p-4 text-center text-sm text-text-secondary", children: o.trim() ? `No memes match "${o.trim()}"` : "The meme library is empty" }),
|
|
816
|
-
C.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: C.map((
|
|
817
|
-
const R = Pe(
|
|
816
|
+
C.length > 0 && /* @__PURE__ */ l("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: C.map((S) => {
|
|
817
|
+
const R = Pe(S.key);
|
|
818
818
|
return R ? /* @__PURE__ */ l(
|
|
819
819
|
"button",
|
|
820
820
|
{
|
|
821
821
|
type: "button",
|
|
822
|
-
onClick: () => U(
|
|
823
|
-
title:
|
|
822
|
+
onClick: () => U(S),
|
|
823
|
+
title: S.title,
|
|
824
824
|
"data-testid": "meme-result",
|
|
825
825
|
onMouseEnter: (L) => {
|
|
826
|
-
v && E(
|
|
826
|
+
v && E(S, L.currentTarget);
|
|
827
827
|
},
|
|
828
828
|
onMouseLeave: u,
|
|
829
|
-
onFocus: (L) => E(
|
|
829
|
+
onFocus: (L) => E(S, L.currentTarget, !0),
|
|
830
830
|
onBlur: u,
|
|
831
831
|
className: "group relative aspect-square overflow-hidden rounded border border-border-light bg-bg-alt focus:outline-none focus:border-primary hover:border-primary",
|
|
832
832
|
children: /* @__PURE__ */ l(
|
|
833
833
|
"img",
|
|
834
834
|
{
|
|
835
835
|
src: R,
|
|
836
|
-
alt:
|
|
836
|
+
alt: S.title || "Meme",
|
|
837
837
|
loading: "lazy",
|
|
838
838
|
decoding: "async",
|
|
839
839
|
className: "h-full w-full object-cover"
|
|
840
840
|
}
|
|
841
841
|
)
|
|
842
842
|
},
|
|
843
|
-
|
|
843
|
+
S.key
|
|
844
844
|
) : null;
|
|
845
845
|
}) }),
|
|
846
846
|
g && /* @__PURE__ */ l("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
|
|
@@ -995,10 +995,10 @@ const de = [], Zr = 500;
|
|
|
995
995
|
let Te = [], Xe = null;
|
|
996
996
|
const Qr = 1e3, eo = 200;
|
|
997
997
|
let Je = null;
|
|
998
|
-
function
|
|
998
|
+
function Sn(e) {
|
|
999
999
|
Je = e;
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function wn() {
|
|
1002
1002
|
return G(oe.REPORT_LOGS_FLAG) === "true";
|
|
1003
1003
|
}
|
|
1004
1004
|
function to() {
|
|
@@ -1047,7 +1047,7 @@ function st(e, t, n, o, i, s, a) {
|
|
|
1047
1047
|
data: a,
|
|
1048
1048
|
timestamp: Date.now()
|
|
1049
1049
|
};
|
|
1050
|
-
if (oo(c), (n ||
|
|
1050
|
+
if (oo(c), (n || wn()) && _t(c), !o) {
|
|
1051
1051
|
if (!to()) return;
|
|
1052
1052
|
const p = no();
|
|
1053
1053
|
if (p && !p.has(i.toLowerCase())) return;
|
|
@@ -1142,7 +1142,7 @@ async function fo() {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
function _t(e) {
|
|
1144
1144
|
if (Te.push(e), !Xe) {
|
|
1145
|
-
const t =
|
|
1145
|
+
const t = wn() ? eo : Qr;
|
|
1146
1146
|
Xe = setTimeout(fo, t);
|
|
1147
1147
|
}
|
|
1148
1148
|
}
|
|
@@ -1192,9 +1192,9 @@ function He(e) {
|
|
|
1192
1192
|
const t = he().serverOrigin.replace(/\/$/, ""), n = hr[e];
|
|
1193
1193
|
return `${t}/media/sprites/square_${e}.png${n > 1 ? `?v=${n}` : ""}`;
|
|
1194
1194
|
}
|
|
1195
|
-
let pe = null,
|
|
1195
|
+
let pe = null, Se = null;
|
|
1196
1196
|
function yo() {
|
|
1197
|
-
return pe ? Promise.resolve() :
|
|
1197
|
+
return pe ? Promise.resolve() : Se || (Se = (async () => {
|
|
1198
1198
|
try {
|
|
1199
1199
|
const e = he().serverOrigin.replace(/\/$/, ""), t = await fetch(`${e}/media/sprites/names.json`, { cache: "no-cache" });
|
|
1200
1200
|
if (!t.ok) return;
|
|
@@ -1203,7 +1203,7 @@ function yo() {
|
|
|
1203
1203
|
} catch (e) {
|
|
1204
1204
|
d("characters", "display names fetch failed (degrading to sprite IDs)", ge(e));
|
|
1205
1205
|
}
|
|
1206
|
-
})(),
|
|
1206
|
+
})(), Se);
|
|
1207
1207
|
}
|
|
1208
1208
|
function te(e) {
|
|
1209
1209
|
return pe?.[e] || e.charAt(0).toUpperCase() + e.slice(1);
|
|
@@ -1234,12 +1234,12 @@ const vo = r.object({
|
|
|
1234
1234
|
}), me = Wn({
|
|
1235
1235
|
appId: "watchparty",
|
|
1236
1236
|
schema: vo
|
|
1237
|
-
}),
|
|
1237
|
+
}), So = /* @__PURE__ */ new Set(["theme", "themeMode"]);
|
|
1238
1238
|
function Oe(e) {
|
|
1239
1239
|
const t = lt();
|
|
1240
1240
|
return t ? `prefs-cache:${t}:${e}` : null;
|
|
1241
1241
|
}
|
|
1242
|
-
function
|
|
1242
|
+
function wo() {
|
|
1243
1243
|
return lt() === null;
|
|
1244
1244
|
}
|
|
1245
1245
|
function Ct(e) {
|
|
@@ -1276,7 +1276,7 @@ function _o() {
|
|
|
1276
1276
|
let xn = null, Cn = null;
|
|
1277
1277
|
const kt = /* @__PURE__ */ new Set();
|
|
1278
1278
|
function dt() {
|
|
1279
|
-
if (
|
|
1279
|
+
if (wo())
|
|
1280
1280
|
return d("preferences", "Boot read deferred — session pending, identity unresolved"), {};
|
|
1281
1281
|
const e = Ct("portfolio"), t = Ct("watchparty"), n = Object.keys(e).length > 0 ? e : xn ?? {}, o = Object.keys(t).length > 0 ? t : Cn ?? {}, i = ct() || "public";
|
|
1282
1282
|
if (kt.has(i))
|
|
@@ -1306,11 +1306,11 @@ function xo() {
|
|
|
1306
1306
|
return !e || e === "public";
|
|
1307
1307
|
}
|
|
1308
1308
|
function K(e, t) {
|
|
1309
|
-
xo() && (kn = !0),
|
|
1309
|
+
xo() && (kn = !0), So.has(e) ? ce.save({ [e]: t }, { scope: "device" }).catch((n) => A("preferences", "themePrefs.save failed", { key: e, err: n?.message })) : me.save({ [e]: t }).catch((n) => A("preferences", "watchpartyPrefs.save failed", { key: e, err: n?.message })), d("preferences", "Saved (via SDK)", { key: e, value: t });
|
|
1310
1310
|
}
|
|
1311
|
-
let
|
|
1311
|
+
let we = null, It = !1;
|
|
1312
1312
|
function Co() {
|
|
1313
|
-
return
|
|
1313
|
+
return we || (we = (async () => {
|
|
1314
1314
|
if (typeof window > "u") return !1;
|
|
1315
1315
|
try {
|
|
1316
1316
|
It || (It = !0, ce.subscribe((a) => {
|
|
@@ -1346,7 +1346,7 @@ function Co() {
|
|
|
1346
1346
|
} catch (e) {
|
|
1347
1347
|
return A("preferences", "First-load SDK sync failed (non-fatal)", { err: e?.message }), !1;
|
|
1348
1348
|
}
|
|
1349
|
-
})(),
|
|
1349
|
+
})(), we);
|
|
1350
1350
|
}
|
|
1351
1351
|
const Re = "watchparty_preferences";
|
|
1352
1352
|
_o();
|
|
@@ -1494,6 +1494,7 @@ const q = dt(), m = Gn((e, t) => ({
|
|
|
1494
1494
|
tierlistSaving: !1,
|
|
1495
1495
|
readyCheck: { active: !1, ready: [] },
|
|
1496
1496
|
activeGameId: null,
|
|
1497
|
+
gameSettings: null,
|
|
1497
1498
|
roomKeyType: null,
|
|
1498
1499
|
gameSessionWins: {},
|
|
1499
1500
|
gameBotCount: 0,
|
|
@@ -1673,6 +1674,7 @@ const q = dt(), m = Gn((e, t) => ({
|
|
|
1673
1674
|
}),
|
|
1674
1675
|
setReadyCheckState: (n) => e({ readyCheck: n }),
|
|
1675
1676
|
setActiveGameId: (n) => e({ activeGameId: n }),
|
|
1677
|
+
setGameSettings: (n) => e({ gameSettings: n }),
|
|
1676
1678
|
setRoomKeyType: (n) => e({ roomKeyType: n }),
|
|
1677
1679
|
setGameSessionWins: (n) => e({ gameSessionWins: { ...n } }),
|
|
1678
1680
|
setGameBotCount: (n) => e({ gameBotCount: Math.max(0, Math.floor(n)) }),
|
|
@@ -1771,7 +1773,7 @@ function Bo() {
|
|
|
1771
1773
|
return at(Rt, t) ? t : "";
|
|
1772
1774
|
}
|
|
1773
1775
|
function Go() {
|
|
1774
|
-
return Be === null && (Be =
|
|
1776
|
+
return Be === null && (Be = wr($o, Bo(), Ho())), Be;
|
|
1775
1777
|
}
|
|
1776
1778
|
function Wo() {
|
|
1777
1779
|
return Go();
|
|
@@ -1906,7 +1908,7 @@ function ie() {
|
|
|
1906
1908
|
} else le && A("socket", "Reconnected — no join payload, not re-joining any room");
|
|
1907
1909
|
le = !0;
|
|
1908
1910
|
}), x.on("disconnect", (o) => {
|
|
1909
|
-
|
|
1911
|
+
Sn(null), _e = { reason: Ge ?? o, at: Date.now() }, Ge = null, d("socket", "Disconnected", { reason: o });
|
|
1910
1912
|
}), x.on("connect_error", (o) => ue("socket", "Connection error", { message: o?.message })), x.on("reconnect_attempt", (o) => A("socket", "Reconnect attempt", { attempt: o })), x.on("reconnect_failed", () => ue("socket", "Reconnect failed")), mi(x);
|
|
1911
1913
|
}
|
|
1912
1914
|
return x;
|
|
@@ -1962,7 +1964,7 @@ function oi(e) {
|
|
|
1962
1964
|
leaderId: t.leader_id || null,
|
|
1963
1965
|
serverSeq: t.server_seq || 0,
|
|
1964
1966
|
rosterSize: Object.keys(n.roster).length
|
|
1965
|
-
}), z?.room_key && x?.id &&
|
|
1967
|
+
}), z?.room_key && x?.id && Sn({ room_key: z.room_key, client_id: x.id });
|
|
1966
1968
|
}), e.on(I.CONTROL_BROADCAST, (t) => {
|
|
1967
1969
|
const n = m.getState();
|
|
1968
1970
|
if (Object.prototype.hasOwnProperty.call(t, "media_id")) {
|
|
@@ -2182,7 +2184,7 @@ function yi() {
|
|
|
2182
2184
|
function vi(e) {
|
|
2183
2185
|
return !(e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey);
|
|
2184
2186
|
}
|
|
2185
|
-
function
|
|
2187
|
+
function Si({ src: e, title: t, onClose: n }) {
|
|
2186
2188
|
O(() => {
|
|
2187
2189
|
const s = (a) => {
|
|
2188
2190
|
a.key === "Escape" && (a.stopPropagation(), n());
|
|
@@ -2228,11 +2230,11 @@ function wi({ src: e, title: t, onClose: n }) {
|
|
|
2228
2230
|
i
|
|
2229
2231
|
) : null;
|
|
2230
2232
|
}
|
|
2231
|
-
const Ke = 240,
|
|
2233
|
+
const Ke = 240, wi = 320;
|
|
2232
2234
|
function _i({ image: e }) {
|
|
2233
2235
|
const [t, n] = P(!1), o = Pe(e.key);
|
|
2234
2236
|
if (!o) return null;
|
|
2235
|
-
const i = e.w > 0 && e.h > 0, s = i ? Math.min(1,
|
|
2237
|
+
const i = e.w > 0 && e.h > 0, s = i ? Math.min(1, wi / e.w, Ke / e.h) : 1;
|
|
2236
2238
|
return /* @__PURE__ */ b(Ne, { children: [
|
|
2237
2239
|
/* @__PURE__ */ l(
|
|
2238
2240
|
"a",
|
|
@@ -2261,7 +2263,7 @@ function _i({ image: e }) {
|
|
|
2261
2263
|
}
|
|
2262
2264
|
),
|
|
2263
2265
|
t && /* @__PURE__ */ l(
|
|
2264
|
-
|
|
2266
|
+
Si,
|
|
2265
2267
|
{
|
|
2266
2268
|
src: o,
|
|
2267
2269
|
title: e.title,
|
|
@@ -2481,38 +2483,38 @@ function Ri() {
|
|
|
2481
2483
|
}, []), c = N(async (h) => {
|
|
2482
2484
|
if (!h.length) return;
|
|
2483
2485
|
const _ = [];
|
|
2484
|
-
for (const
|
|
2485
|
-
const k = Rr(
|
|
2486
|
+
for (const w of h) {
|
|
2487
|
+
const k = Rr(w);
|
|
2486
2488
|
if (k) {
|
|
2487
2489
|
i("error", k);
|
|
2488
2490
|
continue;
|
|
2489
2491
|
}
|
|
2490
|
-
const { w: u, h: v } = await jr(
|
|
2492
|
+
const { w: u, h: v } = await jr(w), E = URL.createObjectURL(w);
|
|
2491
2493
|
s.current.add(E), _.push({
|
|
2492
2494
|
kind: "file",
|
|
2493
2495
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
2494
|
-
file:
|
|
2496
|
+
file: w,
|
|
2495
2497
|
previewUrl: E,
|
|
2496
2498
|
w: u,
|
|
2497
2499
|
h: v
|
|
2498
2500
|
});
|
|
2499
2501
|
}
|
|
2500
|
-
_.length && t((
|
|
2501
|
-
const k = Y -
|
|
2502
|
+
_.length && t((w) => {
|
|
2503
|
+
const k = Y - w.length;
|
|
2502
2504
|
if (k <= 0) {
|
|
2503
2505
|
i("info", `Up to ${Y} images per message`);
|
|
2504
2506
|
for (const u of _) a(u);
|
|
2505
|
-
return
|
|
2507
|
+
return w;
|
|
2506
2508
|
}
|
|
2507
2509
|
if (_.length > k) {
|
|
2508
2510
|
i("info", `Up to ${Y} images per message`);
|
|
2509
2511
|
for (const u of _.slice(k)) a(u);
|
|
2510
2512
|
}
|
|
2511
|
-
return [...
|
|
2513
|
+
return [...w, ..._.slice(0, k)];
|
|
2512
2514
|
});
|
|
2513
2515
|
}, [i, a]), f = N((h) => {
|
|
2514
2516
|
const _ = Pe(h.key);
|
|
2515
|
-
_ && (t((
|
|
2517
|
+
_ && (t((w) => w.length >= Y ? (i("info", `Up to ${Y} images per message`), w) : [...w, {
|
|
2516
2518
|
kind: "remote",
|
|
2517
2519
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
2518
2520
|
key: h.key,
|
|
@@ -2525,8 +2527,8 @@ function Ri() {
|
|
|
2525
2527
|
}]), je().catalogue(mn).recordUse(h.key));
|
|
2526
2528
|
}, [i]), g = N((h) => {
|
|
2527
2529
|
t((_) => {
|
|
2528
|
-
const
|
|
2529
|
-
return
|
|
2530
|
+
const w = _.find((k) => k.id === h);
|
|
2531
|
+
return w && a(w), _.filter((k) => k.id !== h);
|
|
2530
2532
|
});
|
|
2531
2533
|
}, [a]), p = N(() => {
|
|
2532
2534
|
t((h) => {
|
|
@@ -2567,21 +2569,21 @@ function Ri() {
|
|
|
2567
2569
|
}
|
|
2568
2570
|
const Ut = Yt, Di = Zn;
|
|
2569
2571
|
function Li({ commands: e = ft }) {
|
|
2570
|
-
const [t, n] = P(""), [o, i] = P(!1), [s, a] = P({ q: null, i: 0 }), [c, f] = P(!1), g = J(null), p = On(), [D, M] = P(!1), [T, C] = P(!1), h = Ri(), _ = m((y) => y.snapshot.mediaId),
|
|
2572
|
+
const [t, n] = P(""), [o, i] = P(!1), [s, a] = P({ q: null, i: 0 }), [c, f] = P(!1), g = J(null), p = On(), [D, M] = P(!1), [T, C] = P(!1), h = Ri(), _ = m((y) => y.snapshot.mediaId), w = m((y) => y.pushToast), k = m((y) => y.setTierlistOpen), u = m((y) => y.setCharacterModalOpen), v = !!_, E = Ti(t), U = Q(
|
|
2571
2573
|
() => E === null ? [] : Ei(E, e),
|
|
2572
2574
|
[E, e]
|
|
2573
|
-
), H = E !== null && !c && U.length > 0,
|
|
2575
|
+
), H = E !== null && !c && U.length > 0, S = s.q === E ? Ve(s.i, U.length) : 0, R = N(
|
|
2574
2576
|
(y) => a({ q: E, i: y }),
|
|
2575
2577
|
[E]
|
|
2576
2578
|
), L = N((y, j) => {
|
|
2577
2579
|
const ae = Pi(y, { hasMedia: v });
|
|
2578
2580
|
if (ae) {
|
|
2579
|
-
|
|
2581
|
+
w("info", ae);
|
|
2580
2582
|
return;
|
|
2581
2583
|
}
|
|
2582
2584
|
switch (y.name) {
|
|
2583
2585
|
case "help":
|
|
2584
|
-
|
|
2586
|
+
w("info", e.map((Mn) => Mn.usage).join(" "));
|
|
2585
2587
|
break;
|
|
2586
2588
|
case "recap":
|
|
2587
2589
|
yi();
|
|
@@ -2593,16 +2595,16 @@ function Li({ commands: e = ft }) {
|
|
|
2593
2595
|
u(!0);
|
|
2594
2596
|
break;
|
|
2595
2597
|
default:
|
|
2596
|
-
|
|
2598
|
+
w("info", `${y.usage} is not implemented yet.`);
|
|
2597
2599
|
}
|
|
2598
|
-
}, [v,
|
|
2600
|
+
}, [v, w, e, k, u]), F = N((y) => {
|
|
2599
2601
|
n(Ai(y)), f(!1), g.current?.focus();
|
|
2600
2602
|
}, []), W = N(async (y) => {
|
|
2601
2603
|
if (y.preventDefault(), o || h.uploading) return;
|
|
2602
2604
|
const j = Ni(t, e);
|
|
2603
2605
|
if (!j && !h.pending.length) return;
|
|
2604
2606
|
if (j?.kind === "command" && h.pending.length) {
|
|
2605
|
-
|
|
2607
|
+
w("info", "Send images on their own, not with a command.");
|
|
2606
2608
|
return;
|
|
2607
2609
|
}
|
|
2608
2610
|
if (j?.kind === "command") {
|
|
@@ -2611,34 +2613,34 @@ function Li({ commands: e = ft }) {
|
|
|
2611
2613
|
}
|
|
2612
2614
|
const ae = await h.uploadPending();
|
|
2613
2615
|
ae !== null && (pi(j?.text ?? "", ae), n(""), h.clear(), i(!0), setTimeout(() => i(!1), Di), !document.hidden && document.hasFocus() && g.current?.focus());
|
|
2614
|
-
}, [t, o, L, h,
|
|
2616
|
+
}, [t, o, L, h, w, e]), Pn = N((y) => {
|
|
2615
2617
|
if (y.key === "Escape" && H) {
|
|
2616
2618
|
y.preventDefault(), f(!0);
|
|
2617
2619
|
return;
|
|
2618
2620
|
}
|
|
2619
2621
|
if (H) {
|
|
2620
2622
|
if (y.key === "ArrowDown")
|
|
2621
|
-
y.preventDefault(), R(Ve(
|
|
2623
|
+
y.preventDefault(), R(Ve(S + 1, U.length));
|
|
2622
2624
|
else if (y.key === "ArrowUp")
|
|
2623
|
-
y.preventDefault(), R(Ve(
|
|
2625
|
+
y.preventDefault(), R(Ve(S - 1, U.length));
|
|
2624
2626
|
else if (y.key === "Tab") {
|
|
2625
2627
|
y.preventDefault();
|
|
2626
|
-
const j = U[
|
|
2628
|
+
const j = U[S];
|
|
2627
2629
|
j && F(j);
|
|
2628
2630
|
} else if (y.key === "Enter") {
|
|
2629
2631
|
y.preventDefault();
|
|
2630
|
-
const j = U[
|
|
2632
|
+
const j = U[S];
|
|
2631
2633
|
j && F(j);
|
|
2632
2634
|
}
|
|
2633
2635
|
}
|
|
2634
|
-
}, [H, U,
|
|
2636
|
+
}, [H, U, S, F, R]);
|
|
2635
2637
|
O(() => {
|
|
2636
2638
|
const y = () => {
|
|
2637
2639
|
document.hidden || !document.hasFocus() || (g.current?.focus(), g.current?.scrollIntoView({ block: "nearest" }));
|
|
2638
2640
|
};
|
|
2639
2641
|
return window.addEventListener("watchparty:focus-chat-input", y), () => window.removeEventListener("watchparty:focus-chat-input", y);
|
|
2640
2642
|
}, []);
|
|
2641
|
-
const be = Ut - t.length, ht = be <= 100, gt = H ? U[
|
|
2643
|
+
const be = Ut - t.length, ht = be <= 100, gt = H ? U[S] : void 0;
|
|
2642
2644
|
return /* @__PURE__ */ b(
|
|
2643
2645
|
"form",
|
|
2644
2646
|
{
|
|
@@ -2656,7 +2658,7 @@ function Li({ commands: e = ft }) {
|
|
|
2656
2658
|
Mi,
|
|
2657
2659
|
{
|
|
2658
2660
|
commands: U,
|
|
2659
|
-
activeIndex:
|
|
2661
|
+
activeIndex: S,
|
|
2660
2662
|
hasMedia: v,
|
|
2661
2663
|
onPick: F,
|
|
2662
2664
|
onHover: R,
|
|
@@ -2806,7 +2808,7 @@ function Hi({ open: e, onClose: t, roomKey: n, tierlist: o }) {
|
|
|
2806
2808
|
const h = () => {
|
|
2807
2809
|
const u = f || !g ? s : te(g);
|
|
2808
2810
|
d("character", "Updating identity", { name: u, sprite: g }), c(u, g), hi(u, g || void 0), t();
|
|
2809
|
-
}, _ = (u) => u === a ? !0 : !D.has(u),
|
|
2811
|
+
}, _ = (u) => u === a ? !0 : !D.has(u), w = (u) => {
|
|
2810
2812
|
u.target === u.currentTarget && t();
|
|
2811
2813
|
};
|
|
2812
2814
|
O(() => {
|
|
@@ -2821,7 +2823,7 @@ function Hi({ open: e, onClose: t, roomKey: n, tierlist: o }) {
|
|
|
2821
2823
|
"div",
|
|
2822
2824
|
{
|
|
2823
2825
|
className: "fixed inset-0 bg-black/70 flex items-center justify-center z-50",
|
|
2824
|
-
onMouseDown:
|
|
2826
|
+
onMouseDown: w,
|
|
2825
2827
|
role: "dialog",
|
|
2826
2828
|
"aria-modal": "true",
|
|
2827
2829
|
"aria-label": "Change character",
|
|
@@ -2996,7 +2998,7 @@ function aa({
|
|
|
2996
2998
|
debug: g,
|
|
2997
2999
|
children: p
|
|
2998
3000
|
}) {
|
|
2999
|
-
const [D, M] = P(null), { setFrame: T, ...C } = zi(c, f), h = m((
|
|
3001
|
+
const [D, M] = P(null), { setFrame: T, ...C } = zi(c, f), h = m((S) => S.characterModalOpen), _ = m((S) => S.setCharacterModalOpen), w = Kt(() => s), k = Q(() => (ho({ userType: n, userId: o ?? null }), dt().theme), [n, o]), u = Ln(), v = u?.theme, E = Q(
|
|
3000
3002
|
() => $i(i, v, k),
|
|
3001
3003
|
[i, v, k]
|
|
3002
3004
|
);
|
|
@@ -3010,7 +3012,7 @@ function aa({
|
|
|
3010
3012
|
g && Jr();
|
|
3011
3013
|
}, [g]), O(() => {
|
|
3012
3014
|
qr({ serverOrigin: t, defaultRoomKey: e }), m.getState().rehydrateFromPrefs(), Ko();
|
|
3013
|
-
let
|
|
3015
|
+
let S = !1;
|
|
3014
3016
|
const R = yo();
|
|
3015
3017
|
return (async () => {
|
|
3016
3018
|
try {
|
|
@@ -3026,13 +3028,13 @@ function aa({
|
|
|
3026
3028
|
} catch (W) {
|
|
3027
3029
|
A("room-chrome", "pre-join wait threw, proceeding anyway", ge(W));
|
|
3028
3030
|
}
|
|
3029
|
-
if (
|
|
3030
|
-
const L = Gi(
|
|
3031
|
+
if (S) return;
|
|
3032
|
+
const L = Gi(w());
|
|
3031
3033
|
m.getState().ensureAutoIdentity(), Wi(L);
|
|
3032
3034
|
const F = m.getState();
|
|
3033
3035
|
d("room-chrome", "Joining room", { roomKey: e, name: F.name, sprite: F.sprite }), ti({ room_key: e, name: F.name || void 0, sprite: F.sprite || void 0 });
|
|
3034
3036
|
})(), () => {
|
|
3035
|
-
|
|
3037
|
+
S = !0, jt();
|
|
3036
3038
|
};
|
|
3037
3039
|
}, [e, t, n, o]), /* @__PURE__ */ l(pn.Provider, { value: H, children: /* @__PURE__ */ l(gn.Provider, { value: D, children: /* @__PURE__ */ b("div", { ref: T, className: "wp-room-chrome-frame", children: [
|
|
3038
3040
|
/* @__PURE__ */ l("div", { className: "wp-room-chrome-frame__content", children: p }),
|