@hadoku/watchparty-ui 0.45.127 → 0.45.129
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-lz1nZ6tu.js → AdminPanel-CXJxwzns.js} +4 -4
- package/dist/chunks/{AdminPanel-lz1nZ6tu.js.map → AdminPanel-CXJxwzns.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-BZw22blo.js → MediaDrawer-Df-Cgg6o.js} +4 -4
- package/dist/chunks/{MediaDrawer-BZw22blo.js.map → MediaDrawer-Df-Cgg6o.js.map} +1 -1
- package/dist/chunks/{PlaylistPanel-BNxyWYbT.js → PlaylistPanel-C7BIPHXm.js} +3 -3
- package/dist/chunks/{PlaylistPanel-BNxyWYbT.js.map → PlaylistPanel-C7BIPHXm.js.map} +1 -1
- package/dist/chunks/{Room-Bulzv-Yd.js → Room-BW0i25qJ.js} +849 -835
- package/dist/chunks/Room-BW0i25qJ.js.map +1 -0
- package/dist/chunks/{index-DiG1O-X7.js → index-DeZ6HVmt.js} +138 -134
- package/dist/chunks/{index-DiG1O-X7.js.map → index-DeZ6HVmt.js.map} +1 -1
- package/dist/chunks/{submissionsApi-DiBzaU6m.js → submissionsApi-B9a3kfk2.js} +6 -6
- package/dist/chunks/{submissionsApi-DiBzaU6m.js.map → submissionsApi-B9a3kfk2.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/room-chrome.d.ts +13 -1
- package/dist/room-chrome.js +1914 -1819
- package/dist/room-chrome.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/Room-Bulzv-Yd.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as c, jsxs as x, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
-
import rt, { useState as L, useRef as D, useEffect as R, useCallback as j, useMemo as ye, Component as as, useContext as
|
|
3
|
-
import { k as ss, M as is, m as os, f as fs, a as ls, C as
|
|
2
|
+
import rt, { useState as L, useRef as D, useEffect as R, useCallback as j, useMemo as ye, Component as as, useContext as Ca, createContext as Ia, useLayoutEffect as zt, useSyncExternalStore as rs, useId as Wt, useEffectEvent as ke } from "react";
|
|
3
|
+
import { k as ss, M as is, m as os, f as fs, a as ls, C as It, g as Cn, i as cs, S as ds, b as us, r as Gt, d as T, e as ae, u as k, c as Na, h as hs, A as yt, j as gs, l as Ge, n as Ra, o as La, p as ms, s as ps, D as St, w as N, q as bs, t as ys, v as ws, x as Fa, y as $a, z as Da, B as Pa, E as _s, F as vs, G as ks, H as Ss, I as In, J as xs, K as Es, L as Ms, N as Ba, O as Nn, P as Oa, Q as Ts, R as As, T as Be, U as qn, V as an, W as Cs, X as ja, Y as Is, Z as Ns, _ as Rs, $ as Ha, a0 as Ls, a1 as Z, a2 as Fs, a3 as Ua, a4 as za, a5 as pt, a6 as $s, a7 as Ds, a8 as Ps, a9 as Bs, aa as Os, ab as Kn, ac as lt, ad as js, ae as Vn, af as Hs, ag as Us, ah as Jn, ai as zs, aj as Ws, ak as Gs, al as qs, am as Ks, an as Qn, ao as Yn, ap as Vs, aq as Wa, ar as Xn, as as Js, at as Ot, au as Qs, av as Ys, aw as Xs, ax as Zs, ay as ei, az as ti, aA as ni, aB as ai, aC as ri, aD as si, aE as ii } from "./index-DeZ6HVmt.js";
|
|
4
4
|
import { createPortal as wt } from "react-dom";
|
|
5
|
-
import { Icon as Nt, useHadokuThemeOptional as
|
|
5
|
+
import { Icon as Nt, useHadokuThemeOptional as Ga, THEMES as oi } from "@wolffm/themes";
|
|
6
6
|
import { HadokuThemePicker as fi, ConnectedSettings as li } from "@wolffm/task-ui-components";
|
|
7
7
|
import { createRoot as ci } from "react-dom/client";
|
|
8
8
|
const di = "output/fmp4/youtube", ui = /^(.*) \[([A-Za-z0-9_-]{11})\]$/;
|
|
@@ -25,7 +25,7 @@ function mi(t) {
|
|
|
25
25
|
function pi(t) {
|
|
26
26
|
return t.kind === "file";
|
|
27
27
|
}
|
|
28
|
-
class
|
|
28
|
+
class qa extends Error {
|
|
29
29
|
constructor(e) {
|
|
30
30
|
super(e), this.name = "ChatImageUploadError";
|
|
31
31
|
}
|
|
@@ -51,7 +51,7 @@ function Ut(t) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function bi(t) {
|
|
54
|
-
return t instanceof
|
|
54
|
+
return t instanceof It ? Ut(t.reason) : t instanceof qa ? t.message : "Image upload failed";
|
|
55
55
|
}
|
|
56
56
|
function yi(t) {
|
|
57
57
|
const e = t.type.toLowerCase().split(";")[0].trim();
|
|
@@ -68,9 +68,9 @@ async function vi(t) {
|
|
|
68
68
|
return { w: e?.width ?? 0, h: e?.height ?? 0 };
|
|
69
69
|
}
|
|
70
70
|
async function ki(t, e = {}) {
|
|
71
|
-
const n = await
|
|
71
|
+
const n = await Cn().upload(t, { signal: e.signal });
|
|
72
72
|
if (!cs(n.key))
|
|
73
|
-
throw new
|
|
73
|
+
throw new qa("Image upload returned an unusable key");
|
|
74
74
|
return { key: n.key, deduplicated: n.deduplicated === !0 };
|
|
75
75
|
}
|
|
76
76
|
async function Si(t, e = {}) {
|
|
@@ -89,8 +89,8 @@ function xi(t) {
|
|
|
89
89
|
return {
|
|
90
90
|
error: t instanceof Error ? t.message : String(t),
|
|
91
91
|
name: t instanceof Error ? t.name : typeof t,
|
|
92
|
-
reason: t instanceof
|
|
93
|
-
status: t instanceof
|
|
92
|
+
reason: t instanceof It ? t.reason : void 0,
|
|
93
|
+
status: t instanceof It ? t.status : void 0
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
function Ei(t) {
|
|
@@ -105,7 +105,7 @@ function Mi(t, e, n, a = {}) {
|
|
|
105
105
|
p(0), u(null);
|
|
106
106
|
}, [n, e]), R(() => {
|
|
107
107
|
let M = !1;
|
|
108
|
-
const w = h === 0,
|
|
108
|
+
const w = h === 0, S = async () => {
|
|
109
109
|
_.current?.abort();
|
|
110
110
|
const E = new AbortController();
|
|
111
111
|
_.current = E, y(!0), g(null);
|
|
@@ -117,10 +117,10 @@ function Mi(t, e, n, a = {}) {
|
|
|
117
117
|
signal: E.signal
|
|
118
118
|
});
|
|
119
119
|
if (M) return;
|
|
120
|
-
l((
|
|
120
|
+
l((I) => w ? v.results : [...I, ...v.results]), u(v.next);
|
|
121
121
|
} catch (v) {
|
|
122
122
|
if (M || v instanceof Error && v.name === "AbortError") return;
|
|
123
|
-
g(v instanceof
|
|
123
|
+
g(v instanceof It ? v : new It("unknown", String(v)));
|
|
124
124
|
} finally {
|
|
125
125
|
M || y(!1);
|
|
126
126
|
}
|
|
@@ -129,7 +129,7 @@ function Mi(t, e, n, a = {}) {
|
|
|
129
129
|
// allowAsStatement, so the discard is fine as a statement and an
|
|
130
130
|
// error as an expression body.
|
|
131
131
|
() => {
|
|
132
|
-
|
|
132
|
+
S();
|
|
133
133
|
},
|
|
134
134
|
// Only debounce typing. Paging is a deliberate click and should feel
|
|
135
135
|
// immediate.
|
|
@@ -139,10 +139,10 @@ function Mi(t, e, n, a = {}) {
|
|
|
139
139
|
M = !0, clearTimeout(F);
|
|
140
140
|
};
|
|
141
141
|
}, [i, f, e, n, s, r, h]);
|
|
142
|
-
const
|
|
142
|
+
const C = j(() => {
|
|
143
143
|
m || !d || p((M) => M + 1);
|
|
144
144
|
}, [m, d]);
|
|
145
|
-
return { items: o, loading: m, error: b, hasMore: d !== null, loadMore:
|
|
145
|
+
return { items: o, loading: m, error: b, hasMore: d !== null, loadMore: C };
|
|
146
146
|
}
|
|
147
147
|
function qe(t) {
|
|
148
148
|
return t.key === "Escape" || t.key === "GoBack" || t.key === "BrowserBack" || t.key === "XF86Back" || t.keyCode === 461 || t.keyCode === 10009;
|
|
@@ -165,7 +165,7 @@ function Ai(t) {
|
|
|
165
165
|
const i = Ti.has(e);
|
|
166
166
|
return r === "bar" ? !s && i ? "wake" : "show" : i ? "enter-bar" : "show";
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function Ci(t, e, n = !1, a = { atStart: !1, atEnd: !1 }, s = !1) {
|
|
169
169
|
const r = t === "ArrowLeft" ? -1 : t === "ArrowRight" ? 1 : null, i = t === "ArrowUp" ? -1 : t === "ArrowDown" ? 1 : null;
|
|
170
170
|
switch (e) {
|
|
171
171
|
case "range":
|
|
@@ -183,69 +183,69 @@ function Ii(t, e, n = !1, a = { atStart: !1, atEnd: !1 }, s = !1) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
const mt = "data-remote-engaged";
|
|
186
|
-
function qa(t) {
|
|
187
|
-
return t instanceof HTMLSelectElement ? "select" : t instanceof HTMLInputElement ? t.type === "range" ? "range" : "text" : t instanceof HTMLTextAreaElement ? "text" : "button";
|
|
188
|
-
}
|
|
189
|
-
const Ci = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';
|
|
190
186
|
function Ka(t) {
|
|
191
|
-
return
|
|
187
|
+
return t instanceof HTMLSelectElement ? "select" : t instanceof HTMLInputElement ? t.type === "range" ? "range" : "text" : t instanceof HTMLTextAreaElement ? "text" : "button";
|
|
192
188
|
}
|
|
189
|
+
const Ii = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';
|
|
193
190
|
function Va(t) {
|
|
194
|
-
|
|
195
|
-
return e.find((n) => n.hasAttribute("data-remote-primary")) ?? e.find((n) => !n.hasAttribute("data-remote-destructive")) ?? null;
|
|
191
|
+
return Array.from(t.querySelectorAll(Ii)).filter((e) => e.tabIndex >= 0 && e.getClientRects().length > 0);
|
|
196
192
|
}
|
|
197
193
|
function Ja(t) {
|
|
194
|
+
const e = Va(t);
|
|
195
|
+
return e.find((n) => n.hasAttribute("data-remote-primary")) ?? e.find((n) => !n.hasAttribute("data-remote-destructive")) ?? null;
|
|
196
|
+
}
|
|
197
|
+
function Qa(t) {
|
|
198
198
|
return t ? t instanceof HTMLTextAreaElement ? !0 : t instanceof HTMLInputElement ? !["range", "checkbox", "radio", "button", "submit"].includes(t.type) : t.isContentEditable === !0 : !1;
|
|
199
199
|
}
|
|
200
|
-
const _n = 240, et = 8, Ni = 28,
|
|
200
|
+
const _n = 240, et = 8, Ni = 28, Ya = 240;
|
|
201
201
|
function Ri(t, e, n) {
|
|
202
202
|
let a = e.left - _n - et;
|
|
203
203
|
a < et && (a = e.right + et), a = Math.min(a, n.width - _n - et), a = Math.max(et, a);
|
|
204
|
-
const s =
|
|
204
|
+
const s = Ya + Ni;
|
|
205
205
|
let r = t.top + t.height / 2 - s / 2;
|
|
206
206
|
return r = Math.min(r, n.height - s - et), r = Math.max(et, r), { left: a, top: r };
|
|
207
207
|
}
|
|
208
|
-
const
|
|
208
|
+
const Xa = "/dataplatform/api/memes", Li = 120;
|
|
209
209
|
function Fi({ onClose: t, onPick: e, onUnavailable: n, toggle: a }) {
|
|
210
|
-
const [s, r] = L(""), i = D(null), f = D(null), o =
|
|
210
|
+
const [s, r] = L(""), i = D(null), f = D(null), o = Cn(), { items: l, loading: d, error: u, hasMore: m, loadMore: y } = Mi(
|
|
211
211
|
o,
|
|
212
|
-
|
|
212
|
+
Xa,
|
|
213
213
|
s.trim()
|
|
214
214
|
), b = u?.reason ?? null, g = ye(() => {
|
|
215
215
|
const v = /* @__PURE__ */ new Set();
|
|
216
|
-
return l.filter((
|
|
217
|
-
}, [l]), [h, p] = L(null), _ = D(null),
|
|
216
|
+
return l.filter((I) => v.has(I.key) ? !1 : (v.add(I.key), !0));
|
|
217
|
+
}, [l]), [h, p] = L(null), _ = D(null), C = j(() => {
|
|
218
218
|
_.current !== null && (window.clearTimeout(_.current), _.current = null);
|
|
219
219
|
}, []), M = j(() => {
|
|
220
|
-
|
|
221
|
-
}, [
|
|
222
|
-
(v,
|
|
220
|
+
C(), p(null);
|
|
221
|
+
}, [C]), w = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, S = j(
|
|
222
|
+
(v, I, $ = !1) => {
|
|
223
223
|
const B = i.current;
|
|
224
224
|
if (!B) return;
|
|
225
225
|
const O = () => p({
|
|
226
226
|
item: v,
|
|
227
|
-
...Ri(
|
|
227
|
+
...Ri(I.getBoundingClientRect(), B.getBoundingClientRect(), {
|
|
228
228
|
width: window.innerWidth,
|
|
229
229
|
height: window.innerHeight
|
|
230
230
|
})
|
|
231
231
|
});
|
|
232
|
-
|
|
232
|
+
C(), $ ? O() : _.current = window.setTimeout(O, Li);
|
|
233
233
|
},
|
|
234
|
-
[
|
|
234
|
+
[C]
|
|
235
235
|
);
|
|
236
|
-
R(() => () =>
|
|
236
|
+
R(() => () => C(), [C]), R(() => {
|
|
237
237
|
b === "unavailable" && n?.();
|
|
238
238
|
}, [b, n]), R(() => {
|
|
239
239
|
f.current?.focus();
|
|
240
240
|
}, []), R(() => {
|
|
241
241
|
const v = ($) => {
|
|
242
242
|
qe($) && ($.stopPropagation(), t());
|
|
243
|
-
},
|
|
243
|
+
}, I = ($) => {
|
|
244
244
|
const B = $.target;
|
|
245
245
|
i.current && !i.current.contains(B) && !a?.contains(B) && t();
|
|
246
246
|
};
|
|
247
|
-
return document.addEventListener("keydown", v), document.addEventListener("mousedown",
|
|
248
|
-
document.removeEventListener("keydown", v), document.removeEventListener("mousedown",
|
|
247
|
+
return document.addEventListener("keydown", v), document.addEventListener("mousedown", I), () => {
|
|
248
|
+
document.removeEventListener("keydown", v), document.removeEventListener("mousedown", I);
|
|
249
249
|
};
|
|
250
250
|
}, [t, a]);
|
|
251
251
|
const F = j((v) => {
|
|
@@ -294,8 +294,8 @@ function Fi({ onClose: t, onPick: e, onUnavailable: n, toggle: a }) {
|
|
|
294
294
|
),
|
|
295
295
|
E && /* @__PURE__ */ c("p", { className: "p-4 text-center text-sm text-text-secondary", children: s.trim() ? `No memes match "${s.trim()}"` : "The meme library is empty" }),
|
|
296
296
|
g.length > 0 && /* @__PURE__ */ c("div", { className: "grid grid-cols-3 gap-1.5 sm:grid-cols-4", children: g.map((v) => {
|
|
297
|
-
const
|
|
298
|
-
return
|
|
297
|
+
const I = Gt(v.key);
|
|
298
|
+
return I ? /* @__PURE__ */ c(
|
|
299
299
|
"button",
|
|
300
300
|
{
|
|
301
301
|
type: "button",
|
|
@@ -303,16 +303,16 @@ function Fi({ onClose: t, onPick: e, onUnavailable: n, toggle: a }) {
|
|
|
303
303
|
title: v.title,
|
|
304
304
|
"data-testid": "meme-result",
|
|
305
305
|
onMouseEnter: ($) => {
|
|
306
|
-
w &&
|
|
306
|
+
w && S(v, $.currentTarget);
|
|
307
307
|
},
|
|
308
308
|
onMouseLeave: M,
|
|
309
|
-
onFocus: ($) =>
|
|
309
|
+
onFocus: ($) => S(v, $.currentTarget, !0),
|
|
310
310
|
onBlur: M,
|
|
311
311
|
className: "group relative aspect-square overflow-hidden rounded border border-border-light bg-bg-alt focus:outline-none focus:border-primary hover:border-primary",
|
|
312
312
|
children: /* @__PURE__ */ c(
|
|
313
313
|
"img",
|
|
314
314
|
{
|
|
315
|
-
src:
|
|
315
|
+
src: I,
|
|
316
316
|
alt: v.title || "Meme",
|
|
317
317
|
loading: "lazy",
|
|
318
318
|
decoding: "async",
|
|
@@ -362,7 +362,7 @@ function Fi({ onClose: t, onPick: e, onUnavailable: n, toggle: a }) {
|
|
|
362
362
|
src: Gt(h.item.key) ?? void 0,
|
|
363
363
|
alt: "",
|
|
364
364
|
className: "block w-full rounded bg-bg object-contain",
|
|
365
|
-
style: { height: "auto", maxHeight:
|
|
365
|
+
style: { height: "auto", maxHeight: Ya }
|
|
366
366
|
}
|
|
367
367
|
),
|
|
368
368
|
h.item.title && /* One line. A long title must not change the box height, because
|
|
@@ -375,7 +375,7 @@ function Fi({ onClose: t, onPick: e, onUnavailable: n, toggle: a }) {
|
|
|
375
375
|
}
|
|
376
376
|
);
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function Za({ open: t, ...e }) {
|
|
379
379
|
return t ? /* @__PURE__ */ c(Fi, { ...e }) : null;
|
|
380
380
|
}
|
|
381
381
|
function $i(t) {
|
|
@@ -512,10 +512,10 @@ function Oi(t) {
|
|
|
512
512
|
}, [i]), e;
|
|
513
513
|
}
|
|
514
514
|
const vn = "watchparty:open-media-drawer";
|
|
515
|
-
function
|
|
515
|
+
function er(t) {
|
|
516
516
|
T("navigation", `Select Media clicked (${t})`), window.dispatchEvent(new CustomEvent(vn));
|
|
517
517
|
}
|
|
518
|
-
class
|
|
518
|
+
class tr extends as {
|
|
519
519
|
state = { hasError: !1 };
|
|
520
520
|
static getDerivedStateFromError() {
|
|
521
521
|
return { hasError: !0 };
|
|
@@ -555,7 +555,7 @@ function ji(t, e) {
|
|
|
555
555
|
function Rn(t) {
|
|
556
556
|
return t.isLeader ? Vt(t) ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "chat-toolbar" : "none";
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function nr(t) {
|
|
559
559
|
return t.hasMedia ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "none";
|
|
560
560
|
}
|
|
561
561
|
function Hi(t, e) {
|
|
@@ -567,7 +567,7 @@ function Hi(t, e) {
|
|
|
567
567
|
for (const n of Object.values(t)) if (n.author === e.author) return n;
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function ar(t, e, n) {
|
|
571
571
|
const a = Hi(t, e);
|
|
572
572
|
return a ? {
|
|
573
573
|
name: a.name || n.name,
|
|
@@ -580,20 +580,20 @@ function nr(t, e, n) {
|
|
|
580
580
|
} : { name: n.name, sprite: n.sprite, pictureUrl: n.pictureUrl, here: !1 };
|
|
581
581
|
}
|
|
582
582
|
function Ui(t, e, n) {
|
|
583
|
-
return !e || !n.here ? t : e.split(
|
|
583
|
+
return !e || !n.here ? t : e.split(Na).join(n.name);
|
|
584
584
|
}
|
|
585
585
|
function Jt(t, e) {
|
|
586
|
-
const n =
|
|
586
|
+
const n = k((a) => JSON.stringify(ar(a.roster, t, e)));
|
|
587
587
|
return ye(() => JSON.parse(n), [n]);
|
|
588
588
|
}
|
|
589
589
|
const zi = Ia(!0);
|
|
590
|
-
function
|
|
591
|
-
const t =
|
|
590
|
+
function rr() {
|
|
591
|
+
const t = Ca(zi);
|
|
592
592
|
R(() => {
|
|
593
593
|
t && hs();
|
|
594
594
|
}, [t]);
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function sr(t) {
|
|
597
597
|
return t ? { "--hc-base": t } : {};
|
|
598
598
|
}
|
|
599
599
|
const Rt = rt.memo(
|
|
@@ -614,7 +614,7 @@ function Wi(t, e) {
|
|
|
614
614
|
};
|
|
615
615
|
}, [t, e]);
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function ir({ sprite: t, url: e, alt: n, worn: a }) {
|
|
618
618
|
return /* @__PURE__ */ x("span", { className: "hc-av", style: { "--hc-sz": "32px" }, children: [
|
|
619
619
|
/* @__PURE__ */ c("span", { className: "hc-pic", children: /* @__PURE__ */ c(
|
|
620
620
|
yt,
|
|
@@ -633,8 +633,8 @@ function Gi(t) {
|
|
|
633
633
|
return !(t.button !== 0 || t.ctrlKey || t.metaKey || t.shiftKey || t.altKey);
|
|
634
634
|
}
|
|
635
635
|
const qi = Ia(null);
|
|
636
|
-
function
|
|
637
|
-
return
|
|
636
|
+
function or() {
|
|
637
|
+
return Ca(qi);
|
|
638
638
|
}
|
|
639
639
|
function Ki({ src: t, title: e, onClose: n }) {
|
|
640
640
|
R(() => {
|
|
@@ -643,7 +643,7 @@ function Ki({ src: t, title: e, onClose: n }) {
|
|
|
643
643
|
};
|
|
644
644
|
return document.addEventListener("keydown", r, !0), () => document.removeEventListener("keydown", r, !0);
|
|
645
645
|
}, [n]);
|
|
646
|
-
const a =
|
|
646
|
+
const a = or(), s = typeof document > "u" ? null : document.fullscreenElement ?? a ?? document.body;
|
|
647
647
|
return s ? wt(
|
|
648
648
|
/* @__PURE__ */ x(
|
|
649
649
|
"div",
|
|
@@ -724,10 +724,10 @@ function Ji({ image: t }) {
|
|
|
724
724
|
)
|
|
725
725
|
] });
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function fr({ images: t }) {
|
|
728
728
|
return t?.length ? /* @__PURE__ */ c("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: t.map((e, n) => /* @__PURE__ */ c(Ji, { image: e }, `${e.key}-${n}`)) }) : null;
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function lr(t, e) {
|
|
731
731
|
return t.author && e.author ? t.author === e.author : !!e.clientId && t.clientId === e.clientId;
|
|
732
732
|
}
|
|
733
733
|
const Qi = [
|
|
@@ -748,9 +748,9 @@ function Xi(t) {
|
|
|
748
748
|
const [e = "", n = "", a = ""] = t.split(":"), s = Yi(n), r = a ? a.split(",") : [];
|
|
749
749
|
return s && !r.includes(s) && r.push(s), { char: String.fromCodePoint(...e.split("-").map((i) => parseInt(i, 16))), name: n, shortcodes: r };
|
|
750
750
|
}
|
|
751
|
-
let
|
|
751
|
+
let Zn = null;
|
|
752
752
|
function $t() {
|
|
753
|
-
return
|
|
753
|
+
return Zn ??= Qi.map((t) => ({ id: t.id, label: t.label, emoji: t.data.split("|").map(Xi) })), Zn;
|
|
754
754
|
}
|
|
755
755
|
let tt = null;
|
|
756
756
|
function qt(t) {
|
|
@@ -801,12 +801,12 @@ const Zi = [
|
|
|
801
801
|
"x",
|
|
802
802
|
"pensive"
|
|
803
803
|
];
|
|
804
|
-
let
|
|
804
|
+
let ea = null;
|
|
805
805
|
function eo() {
|
|
806
|
-
return
|
|
806
|
+
return ea ??= Zi.flatMap((t) => cr(t)?.char ?? []), ea;
|
|
807
807
|
}
|
|
808
808
|
let xt = null;
|
|
809
|
-
function
|
|
809
|
+
function cr(t) {
|
|
810
810
|
if (!xt) {
|
|
811
811
|
xt = /* @__PURE__ */ new Map();
|
|
812
812
|
for (const e of $t().flatMap((n) => n.emoji))
|
|
@@ -854,10 +854,10 @@ const ao = [
|
|
|
854
854
|
[128293]
|
|
855
855
|
].map((t) => String.fromCodePoint(...t));
|
|
856
856
|
function Ln() {
|
|
857
|
-
return
|
|
857
|
+
return k.getState().recentEmoji;
|
|
858
858
|
}
|
|
859
|
-
function
|
|
860
|
-
|
|
859
|
+
function dr(t) {
|
|
860
|
+
k.getState().noteRecentEmoji(t);
|
|
861
861
|
}
|
|
862
862
|
function ro(t = 3, e = Ln()) {
|
|
863
863
|
const n = [];
|
|
@@ -865,7 +865,7 @@ function ro(t = 3, e = Ln()) {
|
|
|
865
865
|
if (n.includes(a) || n.push(a), n.length === t) break;
|
|
866
866
|
return n;
|
|
867
867
|
}
|
|
868
|
-
function
|
|
868
|
+
function ur(t, e) {
|
|
869
869
|
return t.by.some((n) => n === e.author || !!e.clientId && n === e.clientId);
|
|
870
870
|
}
|
|
871
871
|
function so(t, e, n) {
|
|
@@ -891,11 +891,11 @@ const Ne = 8;
|
|
|
891
891
|
function oo(t) {
|
|
892
892
|
return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
const t =
|
|
894
|
+
function hr() {
|
|
895
|
+
const t = or();
|
|
896
896
|
return rs(oo, () => document.fullscreenElement, () => null) ?? t ?? document.body;
|
|
897
897
|
}
|
|
898
|
-
function
|
|
898
|
+
function gr({
|
|
899
899
|
anchor: t,
|
|
900
900
|
onClose: e,
|
|
901
901
|
width: n,
|
|
@@ -908,11 +908,11 @@ function hr({
|
|
|
908
908
|
testId: l,
|
|
909
909
|
children: d
|
|
910
910
|
}) {
|
|
911
|
-
const u =
|
|
911
|
+
const u = hr(), m = D(null), [y, b] = L(null), g = j(() => {
|
|
912
912
|
const h = m.current;
|
|
913
913
|
if (!t || !h) return;
|
|
914
|
-
const p = t.getBoundingClientRect(), _ = window.innerWidth,
|
|
915
|
-
b((O) => O && O.left === w && O.top === B && O.maxHeight ===
|
|
914
|
+
const p = t.getBoundingClientRect(), _ = window.innerWidth, C = window.innerHeight, M = Math.min(n, _ - Ne * 2), w = Math.min(Math.max(Ne, s ? p.right - M : p.left), _ - M - Ne), S = h.offsetHeight, F = p.top - r - Ne, E = C - p.bottom - r - Ne, v = a === "top" ? S <= F || F >= E : !(S <= E || E >= F), I = Math.max(120, v ? F : E), $ = Math.min(S, I), B = v ? p.top - r - $ : p.bottom + r;
|
|
915
|
+
b((O) => O && O.left === w && O.top === B && O.maxHeight === I ? O : { left: w, top: B, maxHeight: I });
|
|
916
916
|
}, [t, n, s, r, a]);
|
|
917
917
|
return zt(() => {
|
|
918
918
|
g();
|
|
@@ -924,8 +924,8 @@ function hr({
|
|
|
924
924
|
const h = (_) => {
|
|
925
925
|
qe(_) && (_.stopPropagation(), e(), t?.focus({ preventScroll: !0 }));
|
|
926
926
|
}, p = (_) => {
|
|
927
|
-
const
|
|
928
|
-
m.current?.contains(
|
|
927
|
+
const C = _.target;
|
|
928
|
+
m.current?.contains(C) || t?.contains(C) || e();
|
|
929
929
|
};
|
|
930
930
|
return document.addEventListener("keydown", h), document.addEventListener("pointerdown", p, !0), () => {
|
|
931
931
|
document.removeEventListener("keydown", h), document.removeEventListener("pointerdown", p, !0);
|
|
@@ -958,8 +958,8 @@ function hr({
|
|
|
958
958
|
u
|
|
959
959
|
);
|
|
960
960
|
}
|
|
961
|
-
function
|
|
962
|
-
const a =
|
|
961
|
+
function ta({ anchor: t, width: e, children: n }) {
|
|
962
|
+
const a = hr(), [s, r] = L(null);
|
|
963
963
|
return zt(() => {
|
|
964
964
|
if (!t) return;
|
|
965
965
|
const i = () => {
|
|
@@ -1002,7 +1002,7 @@ function lo({ anchor: t, onPick: e, onClose: n }) {
|
|
|
1002
1002
|
},
|
|
1003
1003
|
p
|
|
1004
1004
|
);
|
|
1005
|
-
return /* @__PURE__ */ x(
|
|
1005
|
+
return /* @__PURE__ */ x(gr, { anchor: t, onClose: n, width: fo, className: "emoji-picker", ariaLabel: "Emoji picker", testId: "emoji-picker", children: [
|
|
1006
1006
|
/* @__PURE__ */ c("div", { className: "emoji-picker-search", children: /* @__PURE__ */ c(
|
|
1007
1007
|
"input",
|
|
1008
1008
|
{
|
|
@@ -1043,7 +1043,7 @@ function lo({ anchor: t, onPick: e, onClose: n }) {
|
|
|
1043
1043
|
] }) : null })
|
|
1044
1044
|
] });
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1046
|
+
function Pc({ className: t = "w-5 h-5" }) {
|
|
1047
1047
|
return /* @__PURE__ */ c("svg", { className: t, fill: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" }) });
|
|
1048
1048
|
}
|
|
1049
1049
|
function co({ className: t = "w-5 h-5" }) {
|
|
@@ -1076,13 +1076,13 @@ function po({ className: t = "w-5 h-5" }) {
|
|
|
1076
1076
|
function bo({ className: t = "w-5 h-5" }) {
|
|
1077
1077
|
return /* @__PURE__ */ c("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4l5 5m0-4v4H5m15-5l-5 5m0-4v4h4M4 20l5-5m0 4v-4H5m15 5l-5-5m0 4v-4h4" }) });
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1079
|
+
function mr({ className: t = "w-5 h-5" }) {
|
|
1080
1080
|
return /* @__PURE__ */ c("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19l-7-7 7-7" }) });
|
|
1081
1081
|
}
|
|
1082
1082
|
function yo({ className: t = "w-5 h-5" }) {
|
|
1083
1083
|
return /* @__PURE__ */ c("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function pr({ className: t = "w-4 h-4" }) {
|
|
1086
1086
|
return /* @__PURE__ */ x("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
1087
1087
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
|
|
1088
1088
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
|
|
@@ -1094,7 +1094,7 @@ function wo({ className: t = "w-4 h-4" }) {
|
|
|
1094
1094
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
|
|
1095
1095
|
] });
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function br({ className: t = "w-5 h-5" }) {
|
|
1098
1098
|
return /* @__PURE__ */ c("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
|
|
1099
1099
|
}
|
|
1100
1100
|
function _o({ className: t = "w-5 h-5" }) {
|
|
@@ -1106,7 +1106,7 @@ function _o({ className: t = "w-5 h-5" }) {
|
|
|
1106
1106
|
function vo({ className: t = "w-5 h-5" }) {
|
|
1107
1107
|
return /* @__PURE__ */ c("svg", { className: t, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 4h16a1 1 0 011 1v14a1 1 0 01-1 1H4a1 1 0 01-1-1V5a1 1 0 011-1z" }) });
|
|
1108
1108
|
}
|
|
1109
|
-
function
|
|
1109
|
+
function yr({ className: t = "w-4 h-4" }) {
|
|
1110
1110
|
return /* @__PURE__ */ x("svg", { className: t, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
1111
1111
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20.5 12.5A8.5 8.5 0 1111.5 3.5" }),
|
|
1112
1112
|
/* @__PURE__ */ c("path", { strokeLinecap: "round", d: "M8.5 14.5a4 4 0 007 0" }),
|
|
@@ -1124,14 +1124,14 @@ function sn(t) {
|
|
|
1124
1124
|
return new Date(t).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
1125
1125
|
}
|
|
1126
1126
|
const So = rt.memo(function({ message: e }) {
|
|
1127
|
-
const n =
|
|
1127
|
+
const n = k((_) => _.me.clientId), a = k((_) => _.me.clientId ? _.roster[_.me.clientId]?.author : void 0), s = lr(e, { clientId: n, author: a }), r = Jt(
|
|
1128
1128
|
{ clientId: e.clientId, author: e.author },
|
|
1129
1129
|
{ name: e.name, sprite: e.sprite }
|
|
1130
1130
|
), i = Ge(r.sprite, r.pictureUrl), f = e.isSystem ? void 0 : r.cosmetics, o = D(null);
|
|
1131
1131
|
Wi(o, !!f);
|
|
1132
1132
|
const [l] = L(
|
|
1133
|
-
() => e.live && e.text ?
|
|
1134
|
-
), [d, u] = L(!1), [m, y] = L(null), b =
|
|
1133
|
+
() => e.live && e.text ? Ra(e.text, f) : null
|
|
1134
|
+
), [d, u] = L(!1), [m, y] = L(null), b = k((_) => _.setReplyingTo), g = k((_) => _.recentEmoji);
|
|
1135
1135
|
if (e.isSystem && e.systemType === "recap")
|
|
1136
1136
|
return /* @__PURE__ */ c("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ x("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
|
|
1137
1137
|
/* @__PURE__ */ x("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
|
|
@@ -1146,8 +1146,8 @@ const So = rt.memo(function({ message: e }) {
|
|
|
1146
1146
|
/* @__PURE__ */ c("span", { className: "ml-1 text-[10px] opacity-50", children: sn(e.ts) })
|
|
1147
1147
|
] });
|
|
1148
1148
|
const h = { clientId: n, author: a }, p = (_) => {
|
|
1149
|
-
const
|
|
1150
|
-
M &&
|
|
1149
|
+
const C = e.reactions?.find((S) => S.emoji === _), M = !(C && ur(C, h));
|
|
1150
|
+
M && dr(_);
|
|
1151
1151
|
const w = a ?? n;
|
|
1152
1152
|
w && ms(e.id, _, M, w), ps(e.id, _, M);
|
|
1153
1153
|
};
|
|
@@ -1155,7 +1155,7 @@ const So = rt.memo(function({ message: e }) {
|
|
|
1155
1155
|
"div",
|
|
1156
1156
|
{
|
|
1157
1157
|
ref: o,
|
|
1158
|
-
style:
|
|
1158
|
+
style: sr(i),
|
|
1159
1159
|
"data-msg-id": e.id,
|
|
1160
1160
|
className: `chat-msg px-2 py-1 ${s ? "chat-msg-own" : ""}`,
|
|
1161
1161
|
onMouseEnter: () => u(!0),
|
|
@@ -1168,12 +1168,12 @@ const So = rt.memo(function({ message: e }) {
|
|
|
1168
1168
|
children: [
|
|
1169
1169
|
e.replyTo && /* @__PURE__ */ c(xo, { replyTo: e.replyTo }),
|
|
1170
1170
|
/* @__PURE__ */ x("div", { className: "flex items-start gap-2", children: [
|
|
1171
|
-
/* @__PURE__ */ c(
|
|
1171
|
+
/* @__PURE__ */ c(ir, { sprite: r.sprite, url: r.pictureUrl, alt: r.name, worn: f }),
|
|
1172
1172
|
/* @__PURE__ */ x("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
|
|
1173
|
-
f ? /* @__PURE__ */ c(Rt, { html:
|
|
1173
|
+
f ? /* @__PURE__ */ c(Rt, { html: La(r.name, f), className: "text-[13px]", style: { color: i } }) : /* @__PURE__ */ c("span", { className: "font-medium text-[13px]", style: { color: i }, children: r.name }),
|
|
1174
1174
|
/* @__PURE__ */ c("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: sn(e.ts) }),
|
|
1175
1175
|
e.text && (l ? /* @__PURE__ */ c(Rt, { as: "p", html: l, 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: e.text })),
|
|
1176
|
-
/* @__PURE__ */ c(
|
|
1176
|
+
/* @__PURE__ */ c(fr, { images: e.images }),
|
|
1177
1177
|
e.reactions && e.reactions.length > 0 && /* @__PURE__ */ c(Eo, { reactions: e.reactions, me: h, onToggle: p, onAdd: y })
|
|
1178
1178
|
] })
|
|
1179
1179
|
] }),
|
|
@@ -1188,7 +1188,7 @@ const So = rt.memo(function({ message: e }) {
|
|
|
1188
1188
|
"aria-label": "Add reaction",
|
|
1189
1189
|
title: "Add reaction",
|
|
1190
1190
|
"aria-expanded": !!m,
|
|
1191
|
-
children: /* @__PURE__ */ c(
|
|
1191
|
+
children: /* @__PURE__ */ c(yr, {})
|
|
1192
1192
|
}
|
|
1193
1193
|
),
|
|
1194
1194
|
/* @__PURE__ */ c("button", { type: "button", className: "chat-action-btn", onClick: () => b(e.id), "aria-label": "Reply", title: "Reply", children: /* @__PURE__ */ c(ko, {}) })
|
|
@@ -1201,7 +1201,7 @@ const So = rt.memo(function({ message: e }) {
|
|
|
1201
1201
|
);
|
|
1202
1202
|
});
|
|
1203
1203
|
function xo({ replyTo: t }) {
|
|
1204
|
-
const e =
|
|
1204
|
+
const e = k((i) => i.chat.find((f) => f.id === t)), n = k((i) => i.jumpToMessage), a = Jt(
|
|
1205
1205
|
{ clientId: e?.clientId ?? "", author: e?.author },
|
|
1206
1206
|
{ name: e?.name ?? "", sprite: e?.sprite ?? null }
|
|
1207
1207
|
), s = Ge(a.sprite, a.pictureUrl);
|
|
@@ -1210,7 +1210,7 @@ function xo({ replyTo: t }) {
|
|
|
1210
1210
|
/* @__PURE__ */ c("span", { className: "chat-reply-spine", "aria-hidden": "true" }),
|
|
1211
1211
|
/* @__PURE__ */ c("span", { className: "chat-reply-text italic", children: "Original message unavailable" })
|
|
1212
1212
|
] });
|
|
1213
|
-
const r = e.isSystem ? (e.template ?? e.text).split(
|
|
1213
|
+
const r = e.isSystem ? (e.template ?? e.text).split(Na).join(a.name) : e.text || (e.images?.length ? "Image" : "");
|
|
1214
1214
|
return /* @__PURE__ */ x(
|
|
1215
1215
|
"button",
|
|
1216
1216
|
{
|
|
@@ -1238,10 +1238,10 @@ function xo({ replyTo: t }) {
|
|
|
1238
1238
|
);
|
|
1239
1239
|
}
|
|
1240
1240
|
function Eo({ reactions: t, me: e, onToggle: n, onAdd: a }) {
|
|
1241
|
-
const s =
|
|
1241
|
+
const s = k((r) => r.roster);
|
|
1242
1242
|
return /* @__PURE__ */ x("div", { className: "chat-reactions", "data-testid": "chat-reactions", children: [
|
|
1243
1243
|
t.map((r) => {
|
|
1244
|
-
const i =
|
|
1244
|
+
const i = ur(r, e);
|
|
1245
1245
|
return /* @__PURE__ */ x(
|
|
1246
1246
|
"button",
|
|
1247
1247
|
{
|
|
@@ -1260,12 +1260,12 @@ function Eo({ reactions: t, me: e, onToggle: n, onAdd: a }) {
|
|
|
1260
1260
|
r.emoji
|
|
1261
1261
|
);
|
|
1262
1262
|
}),
|
|
1263
|
-
/* @__PURE__ */ c("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (r) => a(r.currentTarget), "aria-label": "Add reaction", title: "Add reaction", children: /* @__PURE__ */ c(
|
|
1263
|
+
/* @__PURE__ */ c("button", { type: "button", className: "chat-reaction chat-reaction-add", onClick: (r) => a(r.currentTarget), "aria-label": "Add reaction", title: "Add reaction", children: /* @__PURE__ */ c(yr, {}) })
|
|
1264
1264
|
] });
|
|
1265
1265
|
}
|
|
1266
1266
|
function Mo() {
|
|
1267
|
-
|
|
1268
|
-
const t =
|
|
1267
|
+
rr();
|
|
1268
|
+
const t = k((r) => r.chat), e = D(null), n = D(!1), a = j(() => {
|
|
1269
1269
|
const r = e.current;
|
|
1270
1270
|
if (!r) return;
|
|
1271
1271
|
const { scrollHeight: i, scrollTop: f, clientHeight: o } = r, l = i - f - o;
|
|
@@ -1275,7 +1275,7 @@ function Mo() {
|
|
|
1275
1275
|
const r = e.current;
|
|
1276
1276
|
!r || n.current || (typeof r.scrollTo == "function" ? r.scrollTo({ top: r.scrollHeight, behavior: "smooth" }) : r.scrollTop = r.scrollHeight);
|
|
1277
1277
|
}, [t.length]);
|
|
1278
|
-
const s =
|
|
1278
|
+
const s = k((r) => r.chatJump);
|
|
1279
1279
|
return R(() => {
|
|
1280
1280
|
const r = e.current;
|
|
1281
1281
|
if (!s || !r) return;
|
|
@@ -1341,13 +1341,13 @@ function Ao(t, e = Fn) {
|
|
|
1341
1341
|
}
|
|
1342
1342
|
return a.sort((s, r) => s.rank - r.rank || s.cmd.name.localeCompare(r.cmd.name)).map((s) => s.cmd);
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1344
|
+
function Co(t) {
|
|
1345
1345
|
return `${bt}${t.name} `;
|
|
1346
1346
|
}
|
|
1347
1347
|
function Tt(t, e) {
|
|
1348
1348
|
return e <= 0 ? 0 : (t % e + e) % e;
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1350
|
+
function Io(t, e = Fn) {
|
|
1351
1351
|
const n = t.trim();
|
|
1352
1352
|
if (!n) return null;
|
|
1353
1353
|
if (!n.startsWith(bt)) return { kind: "chat", text: n };
|
|
@@ -1399,8 +1399,8 @@ function Ro({
|
|
|
1399
1399
|
}
|
|
1400
1400
|
);
|
|
1401
1401
|
}
|
|
1402
|
-
const
|
|
1403
|
-
function
|
|
1402
|
+
const wr = (t, e) => `${t}-emoji-${e.code}`;
|
|
1403
|
+
function _r({ matches: t, activeIndex: e, onPick: n, onHover: a, listboxId: s }) {
|
|
1404
1404
|
return t.length === 0 ? null : /* @__PURE__ */ c(
|
|
1405
1405
|
"ul",
|
|
1406
1406
|
{
|
|
@@ -1414,7 +1414,7 @@ function wr({ matches: t, activeIndex: e, onPick: n, onHover: a, listboxId: s })
|
|
|
1414
1414
|
children: t.map((r, i) => /* @__PURE__ */ x(
|
|
1415
1415
|
"li",
|
|
1416
1416
|
{
|
|
1417
|
-
id:
|
|
1417
|
+
id: wr(s, r),
|
|
1418
1418
|
role: "option",
|
|
1419
1419
|
"aria-selected": i === e,
|
|
1420
1420
|
onMouseDown: (f) => {
|
|
@@ -1449,16 +1449,16 @@ function Do(t, e, n, a) {
|
|
|
1449
1449
|
const s = t.slice(n), r = s.startsWith(" ") ? a : `${a} `;
|
|
1450
1450
|
return { text: t.slice(0, e) + r + s, caret: e + r.length };
|
|
1451
1451
|
}
|
|
1452
|
-
function
|
|
1452
|
+
function vr(t) {
|
|
1453
1453
|
let e = -1;
|
|
1454
1454
|
return t.replace(/:([a-z0-9_+-]+):/gi, (n, a, s) => {
|
|
1455
1455
|
const r = s === 0 ? "" : t[s - 1];
|
|
1456
1456
|
if (r && !/[\s([{]/.test(r) && s !== e) return n;
|
|
1457
|
-
const i =
|
|
1457
|
+
const i = cr(a);
|
|
1458
1458
|
return i ? (e = s + n.length, i.char) : n;
|
|
1459
1459
|
});
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function kr(t, e, n) {
|
|
1462
1462
|
const [a, s] = L(0), [r, i] = L({ q: null, i: 0 }), [f, o] = L(null), l = $o(t, Math.min(a, t.length)), d = l?.query ?? null, u = ye(() => d ? to(d) : [], [d]), m = l ? `${l.start}:${d}` : null, y = u.length > 0 && f !== m, b = r.q === m ? Tt(r.i, u.length) : 0, g = j((M) => i({ q: m, i: M }), [m]), h = D(null);
|
|
1463
1463
|
zt(() => {
|
|
1464
1464
|
const M = h.current, w = n.current;
|
|
@@ -1467,8 +1467,8 @@ function vr(t, e, n) {
|
|
|
1467
1467
|
const p = j((M) => s(M.selectionStart ?? M.value.length), []), _ = j((M) => {
|
|
1468
1468
|
if (!l) return;
|
|
1469
1469
|
const w = Do(t, l.start, Math.min(a, t.length), M.emoji.char);
|
|
1470
|
-
e(w.text), s(w.caret),
|
|
1471
|
-
}, [l, t, a, e, n]),
|
|
1470
|
+
e(w.text), s(w.caret), dr(M.emoji.char), h.current = w.caret, n.current?.focus();
|
|
1471
|
+
}, [l, t, a, e, n]), C = j((M) => {
|
|
1472
1472
|
if (!y) return !1;
|
|
1473
1473
|
if (M.key === "ArrowDown" || M.key === "ArrowUp")
|
|
1474
1474
|
return M.preventDefault(), g(Tt(b + (M.key === "ArrowDown" ? 1 : -1), u.length)), !0;
|
|
@@ -1479,9 +1479,9 @@ function vr(t, e, n) {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
return M.key === "Escape" ? (M.preventDefault(), o(m), !0) : !1;
|
|
1481
1481
|
}, [y, u, b, _, g, m]);
|
|
1482
|
-
return { open: y, matches: u, activeIndex: b, setActiveIndex: g, pick: _, onKeyDown:
|
|
1482
|
+
return { open: y, matches: u, activeIndex: b, setActiveIndex: g, pick: _, onKeyDown: C, trackCaret: p };
|
|
1483
1483
|
}
|
|
1484
|
-
function
|
|
1484
|
+
function Sr({
|
|
1485
1485
|
pending: t,
|
|
1486
1486
|
uploading: e,
|
|
1487
1487
|
onRemove: n
|
|
@@ -1508,8 +1508,8 @@ function kr({
|
|
|
1508
1508
|
)
|
|
1509
1509
|
] }, a.id)) }) : null;
|
|
1510
1510
|
}
|
|
1511
|
-
function
|
|
1512
|
-
const [t, e] = L([]), [n, a] = L(!1), s =
|
|
1511
|
+
function xr() {
|
|
1512
|
+
const [t, e] = L([]), [n, a] = L(!1), s = k((g) => g.pushToast), r = D(/* @__PURE__ */ new Set());
|
|
1513
1513
|
R(() => () => {
|
|
1514
1514
|
for (const g of r.current) URL.revokeObjectURL(g);
|
|
1515
1515
|
r.current.clear();
|
|
@@ -1525,13 +1525,13 @@ function Sr() {
|
|
|
1525
1525
|
s("error", _);
|
|
1526
1526
|
continue;
|
|
1527
1527
|
}
|
|
1528
|
-
const { w:
|
|
1528
|
+
const { w: C, h: M } = await vi(p), w = URL.createObjectURL(p);
|
|
1529
1529
|
r.current.add(w), h.push({
|
|
1530
1530
|
kind: "file",
|
|
1531
1531
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
1532
1532
|
file: p,
|
|
1533
1533
|
previewUrl: w,
|
|
1534
|
-
w:
|
|
1534
|
+
w: C,
|
|
1535
1535
|
h: M
|
|
1536
1536
|
});
|
|
1537
1537
|
}
|
|
@@ -1539,12 +1539,12 @@ function Sr() {
|
|
|
1539
1539
|
const _ = St - p.length;
|
|
1540
1540
|
if (_ <= 0) {
|
|
1541
1541
|
s("info", `Up to ${St} images per message`);
|
|
1542
|
-
for (const
|
|
1542
|
+
for (const C of h) i(C);
|
|
1543
1543
|
return p;
|
|
1544
1544
|
}
|
|
1545
1545
|
if (h.length > _) {
|
|
1546
1546
|
s("info", `Up to ${St} images per message`);
|
|
1547
|
-
for (const
|
|
1547
|
+
for (const C of h.slice(_)) i(C);
|
|
1548
1548
|
}
|
|
1549
1549
|
return [...p, ...h.slice(0, _)];
|
|
1550
1550
|
});
|
|
@@ -1560,7 +1560,7 @@ function Sr() {
|
|
|
1560
1560
|
w: g.width ?? 0,
|
|
1561
1561
|
h: g.height ?? 0,
|
|
1562
1562
|
title: g.title || void 0
|
|
1563
|
-
}]),
|
|
1563
|
+
}]), Cn().catalogue(Xa).recordUse(g.key));
|
|
1564
1564
|
}, [s]), l = j((g) => {
|
|
1565
1565
|
e((h) => {
|
|
1566
1566
|
const p = h.find((_) => _.id === g);
|
|
@@ -1625,7 +1625,7 @@ class Oo {
|
|
|
1625
1625
|
this.idle && (clearTimeout(this.idle), this.idle = null), this.typing && (this.typing = !1, this.send(!1));
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
|
-
function
|
|
1628
|
+
function Er() {
|
|
1629
1629
|
const [t] = L(() => new Oo(bs));
|
|
1630
1630
|
return R(() => () => t.stop(), [t]), t;
|
|
1631
1631
|
}
|
|
@@ -1633,7 +1633,7 @@ function jo(t) {
|
|
|
1633
1633
|
return t.length === 0 ? null : t.length === 1 ? `${t[0]} is typing…` : t.length === 2 ? `${t[0]} and ${t[1]} are typing…` : t.length === 3 ? `${t[0]}, ${t[1]} and ${t[2]} are typing…` : "Several people are typing…";
|
|
1634
1634
|
}
|
|
1635
1635
|
function Ho({ replyTo: t, onCancel: e }) {
|
|
1636
|
-
const n =
|
|
1636
|
+
const n = k((r) => r.chat.find((i) => i.id === t)), a = Jt(
|
|
1637
1637
|
{ clientId: n?.clientId ?? "", author: n?.author },
|
|
1638
1638
|
{ name: n?.name ?? "a message", sprite: n?.sprite ?? null }
|
|
1639
1639
|
), s = Ge(a.sprite, a.pictureUrl);
|
|
@@ -1642,10 +1642,10 @@ function Ho({ replyTo: t, onCancel: e }) {
|
|
|
1642
1642
|
"Replying to ",
|
|
1643
1643
|
/* @__PURE__ */ c("span", { className: "font-semibold", style: { color: s }, children: a.name })
|
|
1644
1644
|
] }),
|
|
1645
|
-
/* @__PURE__ */ c("button", { type: "button", className: "chat-reply-cancel", onClick: e, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ c(
|
|
1645
|
+
/* @__PURE__ */ c("button", { type: "button", className: "chat-reply-cancel", onClick: e, "aria-label": "Cancel reply", title: "Cancel reply", children: /* @__PURE__ */ c(br, { className: "w-3.5 h-3.5" }) })
|
|
1646
1646
|
] });
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function Mr(t, e) {
|
|
1649
1649
|
const n = /* @__PURE__ */ new Map();
|
|
1650
1650
|
for (const a of Object.values(t)) {
|
|
1651
1651
|
const s = kn(a), r = n.get(s);
|
|
@@ -1662,7 +1662,7 @@ function kn(t) {
|
|
|
1662
1662
|
return t.author ? `author:${t.author}` : `client:${t.clientId}`;
|
|
1663
1663
|
}
|
|
1664
1664
|
function Uo() {
|
|
1665
|
-
const t =
|
|
1665
|
+
const t = k((o) => o.typing), e = k((o) => o.roster), n = k((o) => o.me.clientId), a = k((o) => o.setTyping);
|
|
1666
1666
|
R(() => {
|
|
1667
1667
|
const o = Object.keys(t);
|
|
1668
1668
|
if (o.length === 0) return;
|
|
@@ -1689,27 +1689,27 @@ function Uo() {
|
|
|
1689
1689
|
/* @__PURE__ */ c("span", { className: "truncate", children: f })
|
|
1690
1690
|
] }) });
|
|
1691
1691
|
}
|
|
1692
|
-
const
|
|
1692
|
+
const na = Da, zo = $a;
|
|
1693
1693
|
function Wo({ commands: t = Fn }) {
|
|
1694
|
-
const [e, n] = L(""), [a, s] = L(!1), [r, i] = L({ q: null, i: 0 }), [f, o] = L(!1), l = D(null), d = Wt(), u = Wt(), [m, y] = L(!1), [b, g] = L(!1), h =
|
|
1694
|
+
const [e, n] = L(""), [a, s] = L(!1), [r, i] = L({ q: null, i: 0 }), [f, o] = L(!1), l = D(null), d = Wt(), u = Wt(), [m, y] = L(!1), [b, g] = L(!1), h = kr(e, n, l), p = xr(), _ = Er(), C = k((P) => P.replyingTo), M = k((P) => P.setReplyingTo);
|
|
1695
1695
|
R(() => {
|
|
1696
|
-
|
|
1697
|
-
}, [
|
|
1698
|
-
const w =
|
|
1696
|
+
C && !document.hidden && l.current?.focus({ preventScroll: !0 });
|
|
1697
|
+
}, [C]);
|
|
1698
|
+
const w = k((P) => P.snapshot.mediaId), S = k((P) => P.pushToast), F = k((P) => P.setTierlistOpen), E = !!w, v = To(e), I = ye(
|
|
1699
1699
|
() => v === null ? [] : Ao(v, t),
|
|
1700
1700
|
[v, t]
|
|
1701
|
-
), $ = v !== null && !f &&
|
|
1701
|
+
), $ = v !== null && !f && I.length > 0, B = r.q === v ? Tt(r.i, I.length) : 0, O = j(
|
|
1702
1702
|
(P) => i({ q: v, i: P }),
|
|
1703
1703
|
[v]
|
|
1704
1704
|
), z = j((P, te) => {
|
|
1705
1705
|
const Ae = No(P, { hasMedia: E });
|
|
1706
1706
|
if (Ae) {
|
|
1707
|
-
|
|
1707
|
+
S("info", Ae);
|
|
1708
1708
|
return;
|
|
1709
1709
|
}
|
|
1710
1710
|
switch (P.name) {
|
|
1711
1711
|
case "help":
|
|
1712
|
-
|
|
1712
|
+
S("info", t.map((Ke) => Ke.usage).join(" "));
|
|
1713
1713
|
break;
|
|
1714
1714
|
case "recap":
|
|
1715
1715
|
ws();
|
|
@@ -1718,16 +1718,16 @@ function Wo({ commands: t = Fn }) {
|
|
|
1718
1718
|
ys(), F(!0);
|
|
1719
1719
|
break;
|
|
1720
1720
|
default:
|
|
1721
|
-
|
|
1721
|
+
S("info", `${P.usage} is not implemented yet.`);
|
|
1722
1722
|
}
|
|
1723
|
-
}, [E,
|
|
1724
|
-
n(
|
|
1723
|
+
}, [E, S, t, F]), K = j((P) => {
|
|
1724
|
+
n(Co(P)), o(!1), l.current?.focus();
|
|
1725
1725
|
}, []), le = j(async (P) => {
|
|
1726
1726
|
if (P.preventDefault(), a || p.uploading) return;
|
|
1727
|
-
const te =
|
|
1727
|
+
const te = Io(e, t);
|
|
1728
1728
|
if (!te && !p.pending.length) return;
|
|
1729
1729
|
if (te?.kind === "command" && p.pending.length) {
|
|
1730
|
-
|
|
1730
|
+
S("info", "Send images on their own, not with a command.");
|
|
1731
1731
|
return;
|
|
1732
1732
|
}
|
|
1733
1733
|
if (te?.kind === "command") {
|
|
@@ -1735,41 +1735,41 @@ function Wo({ commands: t = Fn }) {
|
|
|
1735
1735
|
return;
|
|
1736
1736
|
}
|
|
1737
1737
|
const Ae = await p.uploadPending();
|
|
1738
|
-
Ae !== null && (
|
|
1739
|
-
}, [e, a, z, p,
|
|
1738
|
+
Ae !== null && (Fa(vr(te?.text ?? ""), Ae, C), n(""), _.stop(), M(null), p.clear(), s(!0), setTimeout(() => s(!1), zo), !document.hidden && document.hasFocus() && l.current?.focus());
|
|
1739
|
+
}, [e, a, z, p, S, t, C, M, _]), V = j((P) => {
|
|
1740
1740
|
if (!(!$ && h.onKeyDown(P))) {
|
|
1741
1741
|
if (P.key === "Escape" && $) {
|
|
1742
1742
|
P.preventDefault(), o(!0);
|
|
1743
1743
|
return;
|
|
1744
1744
|
}
|
|
1745
|
-
if (P.key === "Escape" &&
|
|
1745
|
+
if (P.key === "Escape" && C) {
|
|
1746
1746
|
P.preventDefault(), M(null);
|
|
1747
1747
|
return;
|
|
1748
1748
|
}
|
|
1749
1749
|
if ($) {
|
|
1750
1750
|
if (P.key === "ArrowDown")
|
|
1751
|
-
P.preventDefault(), O(Tt(B + 1,
|
|
1751
|
+
P.preventDefault(), O(Tt(B + 1, I.length));
|
|
1752
1752
|
else if (P.key === "ArrowUp")
|
|
1753
|
-
P.preventDefault(), O(Tt(B - 1,
|
|
1753
|
+
P.preventDefault(), O(Tt(B - 1, I.length));
|
|
1754
1754
|
else if (P.key === "Tab") {
|
|
1755
1755
|
P.preventDefault();
|
|
1756
|
-
const te =
|
|
1756
|
+
const te = I[B];
|
|
1757
1757
|
te && K(te);
|
|
1758
1758
|
} else if (P.key === "Enter") {
|
|
1759
1759
|
P.preventDefault();
|
|
1760
|
-
const te =
|
|
1760
|
+
const te = I[B];
|
|
1761
1761
|
te && K(te);
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
}
|
|
1765
|
-
}, [$,
|
|
1765
|
+
}, [$, I, B, K, O, C, M, h]);
|
|
1766
1766
|
R(() => {
|
|
1767
1767
|
const P = () => {
|
|
1768
1768
|
document.hidden || !document.hasFocus() || (l.current?.focus(), l.current?.scrollIntoView({ block: "nearest" }));
|
|
1769
1769
|
};
|
|
1770
1770
|
return window.addEventListener("watchparty:focus-chat-input", P), () => window.removeEventListener("watchparty:focus-chat-input", P);
|
|
1771
1771
|
}, []);
|
|
1772
|
-
const X =
|
|
1772
|
+
const X = na - e.length, W = X <= 100, he = $ ? I[B] : void 0, ee = !$ && h.open, Q = ee ? h.matches[h.activeIndex] : void 0;
|
|
1773
1773
|
return /* @__PURE__ */ x(
|
|
1774
1774
|
"form",
|
|
1775
1775
|
{
|
|
@@ -1781,13 +1781,13 @@ function Wo({ commands: t = Fn }) {
|
|
|
1781
1781
|
onDragOver: p.onDragOver,
|
|
1782
1782
|
className: "p-2 border-t border-border",
|
|
1783
1783
|
children: [
|
|
1784
|
-
|
|
1785
|
-
/* @__PURE__ */ c(
|
|
1784
|
+
C && /* @__PURE__ */ c(Ho, { replyTo: C, onCancel: () => M(null) }),
|
|
1785
|
+
/* @__PURE__ */ c(Sr, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
|
|
1786
1786
|
/* @__PURE__ */ x("div", { className: "relative", children: [
|
|
1787
1787
|
$ && /* @__PURE__ */ c(
|
|
1788
1788
|
Ro,
|
|
1789
1789
|
{
|
|
1790
|
-
commands:
|
|
1790
|
+
commands: I,
|
|
1791
1791
|
activeIndex: B,
|
|
1792
1792
|
hasMedia: E,
|
|
1793
1793
|
onPick: K,
|
|
@@ -1796,7 +1796,7 @@ function Wo({ commands: t = Fn }) {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
),
|
|
1798
1798
|
ee && /* @__PURE__ */ c(
|
|
1799
|
-
|
|
1799
|
+
_r,
|
|
1800
1800
|
{
|
|
1801
1801
|
matches: h.matches,
|
|
1802
1802
|
activeIndex: h.activeIndex,
|
|
@@ -1806,7 +1806,7 @@ function Wo({ commands: t = Fn }) {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
),
|
|
1808
1808
|
/* @__PURE__ */ c(
|
|
1809
|
-
|
|
1809
|
+
Za,
|
|
1810
1810
|
{
|
|
1811
1811
|
open: m,
|
|
1812
1812
|
onClose: () => y(!1),
|
|
@@ -1829,12 +1829,12 @@ function Wo({ commands: t = Fn }) {
|
|
|
1829
1829
|
},
|
|
1830
1830
|
onKeyDown: V,
|
|
1831
1831
|
onSelect: (P) => h.trackCaret(P.currentTarget),
|
|
1832
|
-
maxLength:
|
|
1832
|
+
maxLength: na,
|
|
1833
1833
|
placeholder: "Send a message",
|
|
1834
1834
|
role: "combobox",
|
|
1835
1835
|
"aria-expanded": $ || ee,
|
|
1836
1836
|
"aria-controls": $ ? d : ee ? u : void 0,
|
|
1837
|
-
"aria-activedescendant": he ? `${d}-opt-${he.name}` : Q ?
|
|
1837
|
+
"aria-activedescendant": he ? `${d}-opt-${he.name}` : Q ? wr(u, Q) : void 0,
|
|
1838
1838
|
"aria-autocomplete": "list",
|
|
1839
1839
|
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 ${W ? "pr-12" : ""}`
|
|
1840
1840
|
}
|
|
@@ -1861,11 +1861,80 @@ function Wo({ commands: t = Fn }) {
|
|
|
1861
1861
|
}
|
|
1862
1862
|
);
|
|
1863
1863
|
}
|
|
1864
|
+
let jt = null;
|
|
1865
|
+
function $n() {
|
|
1866
|
+
if (jt) return jt;
|
|
1867
|
+
try {
|
|
1868
|
+
const t = window.AudioContext ?? window.webkitAudioContext;
|
|
1869
|
+
t && (jt = new t());
|
|
1870
|
+
} catch {
|
|
1871
|
+
}
|
|
1872
|
+
return jt;
|
|
1873
|
+
}
|
|
1874
|
+
function Dn(t) {
|
|
1875
|
+
t.state === "suspended" && t.resume().catch(() => {
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
function Tr(t, e, n, a) {
|
|
1879
|
+
t.gain.setValueAtTime(0, e), t.gain.linearRampToValueAtTime(n, e + 5e-3), t.gain.exponentialRampToValueAtTime(1e-4, e + a);
|
|
1880
|
+
}
|
|
1881
|
+
function at(t, e, n = 0.15, a = 0) {
|
|
1882
|
+
const s = $n();
|
|
1883
|
+
if (!s) return;
|
|
1884
|
+
Dn(s);
|
|
1885
|
+
const r = s.currentTime + a, i = s.createOscillator(), f = s.createGain();
|
|
1886
|
+
i.type = "sine", i.frequency.value = t, Tr(f, r, n, e / 1e3), i.connect(f).connect(s.destination), i.start(r), i.stop(r + e / 1e3 + 0.05);
|
|
1887
|
+
}
|
|
1888
|
+
function on(t, e, n, a, s = 0.15, r = 0) {
|
|
1889
|
+
const i = $n();
|
|
1890
|
+
if (!i) return;
|
|
1891
|
+
Dn(i);
|
|
1892
|
+
const f = i.currentTime + r, o = i.createOscillator(), l = i.createOscillator(), d = i.createGain(), u = i.createGain();
|
|
1893
|
+
o.type = "sine", o.frequency.value = t, l.type = "sine", l.frequency.value = e, d.gain.value = n * e, l.connect(d).connect(o.frequency), Tr(u, f, s, a / 1e3), o.connect(u).connect(i.destination), o.start(f), o.stop(f + a / 1e3 + 0.05), l.start(f), l.stop(f + a / 1e3 + 0.05);
|
|
1894
|
+
}
|
|
1895
|
+
function Ar() {
|
|
1896
|
+
at(700, 60, 0.14, 0), at(700, 60, 0.14, 0.1), at(932, 120, 0.17, 0.2);
|
|
1897
|
+
}
|
|
1898
|
+
function Cr() {
|
|
1899
|
+
at(784, 45, 0.07, 0), at(1047, 60, 0.07, 0.045);
|
|
1900
|
+
}
|
|
1901
|
+
function Ir() {
|
|
1902
|
+
at(659, 45, 0.06, 0), at(494, 70, 0.06, 0.045);
|
|
1903
|
+
}
|
|
1904
|
+
function Nr() {
|
|
1905
|
+
on(587, 1174, 3, 320, 0.12, 0), on(880, 1760, 3, 320, 0.12, 0.06), on(884, 1768, 3, 320, 0.08, 0.06);
|
|
1906
|
+
}
|
|
1907
|
+
function Pn() {
|
|
1908
|
+
const t = $n();
|
|
1909
|
+
if (!t) return;
|
|
1910
|
+
Dn(t);
|
|
1911
|
+
const e = t.currentTime, n = t.createOscillator(), a = t.createGain();
|
|
1912
|
+
n.type = "sine", n.frequency.setValueAtTime(380, e), n.frequency.exponentialRampToValueAtTime(760, e + 0.07), a.gain.setValueAtTime(0, e), a.gain.linearRampToValueAtTime(0.06, e + 0.01), a.gain.exponentialRampToValueAtTime(1e-4, e + 0.14), n.connect(a).connect(t.destination), n.start(e), n.stop(e + 0.19);
|
|
1913
|
+
}
|
|
1914
|
+
Pa("__WP_SOUNDS__", {
|
|
1915
|
+
start: Ar,
|
|
1916
|
+
finish: Nr,
|
|
1917
|
+
on: Cr,
|
|
1918
|
+
off: Ir,
|
|
1919
|
+
chat: Pn
|
|
1920
|
+
});
|
|
1864
1921
|
function Go() {
|
|
1865
|
-
const t =
|
|
1866
|
-
|
|
1922
|
+
const t = k((a) => a.chatSoundEnabled), e = k((a) => a.setChatSoundEnabled), n = (a) => {
|
|
1923
|
+
a !== t && (e(a), a && Pn());
|
|
1924
|
+
};
|
|
1925
|
+
return /* @__PURE__ */ x("div", { className: "settings-popout__row settings-popout__row--stack", children: [
|
|
1926
|
+
/* @__PURE__ */ c("span", { className: "settings-popout__label", id: "wp-chat-sound-label", children: "Chat sound" }),
|
|
1927
|
+
/* @__PURE__ */ x("div", { className: "settings-popout__pill", role: "radiogroup", "aria-labelledby": "wp-chat-sound-label", children: [
|
|
1928
|
+
/* @__PURE__ */ c("button", { type: "button", role: "radio", "aria-checked": t, className: `settings-popout__seg${t ? " settings-popout__seg--filled" : ""}`, onClick: () => n(!0), children: "On" }),
|
|
1929
|
+
/* @__PURE__ */ c("button", { type: "button", role: "radio", "aria-checked": !t, className: `settings-popout__seg${t ? "" : " settings-popout__seg--filled"}`, onClick: () => n(!1), children: "Off" })
|
|
1930
|
+
] })
|
|
1931
|
+
] });
|
|
1867
1932
|
}
|
|
1868
|
-
function qo(
|
|
1933
|
+
function qo() {
|
|
1934
|
+
const t = k((a) => a.roster), e = k((a) => a.me.clientId), n = ye(() => Mr(t, e), [t, e]);
|
|
1935
|
+
return n.length ? /* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: n.map((a) => /* @__PURE__ */ c(Ko, { u: a }, a.clientId)) }) : /* @__PURE__ */ c("div", { className: "text-xs text-text-muted", children: "No users online" });
|
|
1936
|
+
}
|
|
1937
|
+
function Ko({ u: t }) {
|
|
1869
1938
|
const e = Ge(t.sprite, t.avatarUrl);
|
|
1870
1939
|
return /* @__PURE__ */ x("div", { className: "flex items-center gap-2 py-0.5", children: [
|
|
1871
1940
|
/* @__PURE__ */ c(
|
|
@@ -1882,8 +1951,8 @@ function qo({ u: t }) {
|
|
|
1882
1951
|
t.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" })
|
|
1883
1952
|
] });
|
|
1884
1953
|
}
|
|
1885
|
-
function
|
|
1886
|
-
const t =
|
|
1954
|
+
function Vo() {
|
|
1955
|
+
const t = k((r) => Mr(r.roster).length), [e, n] = L(!1), a = D(null), s = D(null);
|
|
1887
1956
|
return R(() => {
|
|
1888
1957
|
if (!e) return;
|
|
1889
1958
|
function r(f) {
|
|
@@ -1918,15 +1987,15 @@ function Ko() {
|
|
|
1918
1987
|
t,
|
|
1919
1988
|
" online"
|
|
1920
1989
|
] }),
|
|
1921
|
-
/* @__PURE__ */ c(
|
|
1990
|
+
/* @__PURE__ */ c(qo, {})
|
|
1922
1991
|
] })
|
|
1923
1992
|
] });
|
|
1924
1993
|
}
|
|
1925
|
-
const
|
|
1926
|
-
function
|
|
1994
|
+
const Jo = /* @__PURE__ */ c("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" }) });
|
|
1995
|
+
function Qo(t) {
|
|
1927
1996
|
return t.button === 0 && !t.metaKey && !t.ctrlKey && !t.shiftKey && !t.altKey;
|
|
1928
1997
|
}
|
|
1929
|
-
function
|
|
1998
|
+
function fn({ label: t, icon: e, href: n, onPress: a, inPage: s = !1 }) {
|
|
1930
1999
|
return n && s ? /* @__PURE__ */ c(
|
|
1931
2000
|
"a",
|
|
1932
2001
|
{
|
|
@@ -1935,34 +2004,37 @@ function on({ label: t, icon: e, href: n, onPress: a, inPage: s = !1 }) {
|
|
|
1935
2004
|
title: t,
|
|
1936
2005
|
"aria-label": t,
|
|
1937
2006
|
onClick: (r) => {
|
|
1938
|
-
!a || !
|
|
2007
|
+
!a || !Qo(r) || (r.preventDefault(), a());
|
|
1939
2008
|
},
|
|
1940
2009
|
children: e
|
|
1941
2010
|
}
|
|
1942
2011
|
) : n ? /* @__PURE__ */ c("a", { href: n, target: "_blank", rel: "noopener noreferrer", className: "chat-toolbar__btn", title: t, "aria-label": t, children: e }) : /* @__PURE__ */ c("button", { type: "button", onClick: a, className: "chat-toolbar__btn", title: t, "aria-label": t, children: e });
|
|
1943
2012
|
}
|
|
1944
|
-
function
|
|
1945
|
-
const f =
|
|
2013
|
+
function Yo({ home: t, lead: e, theme: n = !0, settings: a = !0, settingsSection: s, extra: r, children: i }) {
|
|
2014
|
+
const f = Ga() !== null;
|
|
1946
2015
|
return /* @__PURE__ */ x("div", { className: "chat-toolbar", children: [
|
|
1947
|
-
t && /* @__PURE__ */ c(
|
|
1948
|
-
e?.map((o) => /* @__PURE__ */ c(
|
|
2016
|
+
t && /* @__PURE__ */ c(fn, { label: "Home", icon: Jo, href: t.href, onPress: t.onPress, inPage: !0 }),
|
|
2017
|
+
e?.map((o) => /* @__PURE__ */ c(fn, { ...o }, o.id)),
|
|
1949
2018
|
n && f && /* @__PURE__ */ c(fi, {}),
|
|
1950
|
-
a && /* @__PURE__ */
|
|
1951
|
-
|
|
1952
|
-
|
|
2019
|
+
a && /* @__PURE__ */ x(li, { children: [
|
|
2020
|
+
/* @__PURE__ */ c(Go, {}),
|
|
2021
|
+
s ?? null
|
|
2022
|
+
] }),
|
|
2023
|
+
r?.map((o) => /* @__PURE__ */ c(fn, { ...o }, o.id)),
|
|
2024
|
+
/* @__PURE__ */ c(Vo, {}),
|
|
1953
2025
|
i
|
|
1954
2026
|
] });
|
|
1955
2027
|
}
|
|
1956
|
-
function
|
|
2028
|
+
function Xo({ leaderId: t, clientId: e, keyType: n }) {
|
|
1957
2029
|
return t !== null ? t === e : n === "leader";
|
|
1958
2030
|
}
|
|
1959
|
-
const
|
|
1960
|
-
function
|
|
1961
|
-
return t &&
|
|
2031
|
+
const Zo = /-[0-9a-fA-F]{16}$/;
|
|
2032
|
+
function ef(t) {
|
|
2033
|
+
return t && Zo.test(t) ? "leader" : null;
|
|
1962
2034
|
}
|
|
1963
|
-
const
|
|
1964
|
-
function
|
|
1965
|
-
const e = t ?
|
|
2035
|
+
const tf = /\/room\/([^/]+)\/?$/;
|
|
2036
|
+
function nf(t) {
|
|
2037
|
+
const e = t ? tf.exec(t) : null;
|
|
1966
2038
|
if (!e) return null;
|
|
1967
2039
|
try {
|
|
1968
2040
|
return decodeURIComponent(e[1]);
|
|
@@ -1970,39 +2042,39 @@ function tf(t) {
|
|
|
1970
2042
|
return e[1];
|
|
1971
2043
|
}
|
|
1972
2044
|
}
|
|
1973
|
-
function
|
|
1974
|
-
return t && e?.roomKey === t ? e.type :
|
|
2045
|
+
function af(t, e) {
|
|
2046
|
+
return t && e?.roomKey === t ? e.type : ef(t);
|
|
1975
2047
|
}
|
|
1976
2048
|
function st() {
|
|
1977
|
-
return
|
|
2049
|
+
return k((t) => !!t.snapshot.leaderId && t.snapshot.leaderId === t.me.clientId);
|
|
1978
2050
|
}
|
|
1979
2051
|
function Qt() {
|
|
1980
|
-
const t =
|
|
2052
|
+
const t = k((n) => n.activeGameId), e = _s();
|
|
1981
2053
|
return t ? e.find((n) => n.id === t) ?? null : null;
|
|
1982
2054
|
}
|
|
1983
|
-
function
|
|
1984
|
-
return
|
|
2055
|
+
function Bn() {
|
|
2056
|
+
return k((t) => Xo({
|
|
1985
2057
|
leaderId: t.snapshot.leaderId,
|
|
1986
2058
|
clientId: t.me.clientId,
|
|
1987
|
-
keyType: nf(
|
|
2059
|
+
keyType: af(nf(globalThis.location?.pathname), t.roomKeyType)
|
|
1988
2060
|
}));
|
|
1989
2061
|
}
|
|
1990
|
-
function
|
|
1991
|
-
return
|
|
2062
|
+
function Rr() {
|
|
2063
|
+
return k((t) => t.readiness);
|
|
1992
2064
|
}
|
|
1993
|
-
function
|
|
1994
|
-
return
|
|
2065
|
+
function rf() {
|
|
2066
|
+
return k((t) => t.snapshot);
|
|
1995
2067
|
}
|
|
1996
|
-
const
|
|
1997
|
-
function
|
|
1998
|
-
const t =
|
|
2068
|
+
const sf = 3e4;
|
|
2069
|
+
function Lr() {
|
|
2070
|
+
const t = Rr(), [e, n] = L(!1), [a, s] = L({ mediaId: t.mediaId, ready: t.ready });
|
|
1999
2071
|
return (a.mediaId !== t.mediaId || a.ready !== t.ready) && (s({ mediaId: t.mediaId, ready: t.ready }), n(!1)), R(() => {
|
|
2000
2072
|
if (t.ready) return;
|
|
2001
|
-
const r = setTimeout(() => n(!0),
|
|
2073
|
+
const r = setTimeout(() => n(!0), sf);
|
|
2002
2074
|
return () => clearTimeout(r);
|
|
2003
2075
|
}, [t.mediaId, t.ready]), e;
|
|
2004
2076
|
}
|
|
2005
|
-
function
|
|
2077
|
+
function of({ draw: t }) {
|
|
2006
2078
|
const e = D(null);
|
|
2007
2079
|
return R(() => {
|
|
2008
2080
|
const n = e.current;
|
|
@@ -2010,20 +2082,20 @@ function sf({ draw: t }) {
|
|
|
2010
2082
|
return t(n) ?? void 0;
|
|
2011
2083
|
}, [t]), /* @__PURE__ */ c("div", { ref: e, "data-testid": "game-settings" });
|
|
2012
2084
|
}
|
|
2013
|
-
const
|
|
2085
|
+
const ff = In(() => import("./AdminPanel-CXJxwzns.js")), lf = In(() => import("./PlaylistPanel-C7BIPHXm.js")), cf = [{
|
|
2014
2086
|
id: "select-media",
|
|
2015
2087
|
label: "Select Media",
|
|
2016
2088
|
icon: /* @__PURE__ */ c("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ c("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 4h16a1 1 0 011 1v14a1 1 0 01-1 1H4a1 1 0 01-1-1V5a1 1 0 011-1z" }) }),
|
|
2017
|
-
onPress: () =>
|
|
2089
|
+
onPress: () => er("chat toolbar")
|
|
2018
2090
|
}];
|
|
2019
|
-
function
|
|
2020
|
-
const t = vs(), e = ks("/"), n =
|
|
2091
|
+
function df() {
|
|
2092
|
+
const t = vs(), e = ks("/"), n = k((g) => g.chatCollapsed), a = Ft(), s = k((g) => g.sidebarTab), r = k((g) => g.setSidebarTab), i = k((g) => g.healthSnapshot?.clients.length ?? 0), f = k((g) => !!g.playlist), o = st(), l = Bn(), d = k((g) => g.gameSettings), u = k((g) => g.snapshot.mediaId), m = Qt() !== null;
|
|
2021
2093
|
if (Vt({ hasMedia: !!u, chatCollapsed: n, isFullscreen: a }))
|
|
2022
2094
|
return null;
|
|
2023
2095
|
const y = Rn({ isLeader: l, hasMedia: !!u, chatCollapsed: n, isFullscreen: a, gameOverlay: m }) === "chat-toolbar", b = s === "health" && !o || s === "playlist" && !f ? "chat" : s;
|
|
2024
2096
|
return /* @__PURE__ */ x("aside", { className: "wp-chat-panel w-80 self-stretch border-l border-border flex flex-col bg-bg relative z-[35]", children: [
|
|
2025
2097
|
/* @__PURE__ */ c(
|
|
2026
|
-
|
|
2098
|
+
Yo,
|
|
2027
2099
|
{
|
|
2028
2100
|
home: {
|
|
2029
2101
|
href: e,
|
|
@@ -2031,8 +2103,8 @@ function cf() {
|
|
|
2031
2103
|
T("navigation", "Home button clicked (chat toolbar)"), Ss(), t("/");
|
|
2032
2104
|
}
|
|
2033
2105
|
},
|
|
2034
|
-
lead: y ?
|
|
2035
|
-
settingsSection: d ? /* @__PURE__ */ c(
|
|
2106
|
+
lead: y ? cf : void 0,
|
|
2107
|
+
settingsSection: d ? /* @__PURE__ */ c(of, { draw: d }) : void 0
|
|
2036
2108
|
}
|
|
2037
2109
|
),
|
|
2038
2110
|
(o || f) && /* @__PURE__ */ x("div", { role: "tablist", "aria-label": "Sidebar", className: "flex border-b border-border shrink-0", children: [
|
|
@@ -2070,23 +2142,23 @@ function cf() {
|
|
|
2070
2142
|
}
|
|
2071
2143
|
)
|
|
2072
2144
|
] }),
|
|
2073
|
-
b === "health" ? /* @__PURE__ */ c(rt.Suspense, { fallback: /* @__PURE__ */ c("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ c(
|
|
2145
|
+
b === "health" ? /* @__PURE__ */ c(rt.Suspense, { fallback: /* @__PURE__ */ c("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ c(ff, {}) }) : b === "playlist" ? /* @__PURE__ */ c(rt.Suspense, { fallback: /* @__PURE__ */ c("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ c(lf, {}) }) : /* @__PURE__ */ x(pe, { children: [
|
|
2074
2146
|
/* @__PURE__ */ c(Mo, {}),
|
|
2075
2147
|
/* @__PURE__ */ c(Wo, {})
|
|
2076
2148
|
] })
|
|
2077
2149
|
] });
|
|
2078
2150
|
}
|
|
2079
|
-
const
|
|
2080
|
-
function
|
|
2081
|
-
return
|
|
2151
|
+
const aa = (t) => typeof t == "string" && oi.includes(t);
|
|
2152
|
+
function uf(t, e, n) {
|
|
2153
|
+
return aa(e) ? e : aa(n) ? n : "dark";
|
|
2082
2154
|
}
|
|
2083
|
-
const
|
|
2084
|
-
function
|
|
2085
|
-
let e =
|
|
2086
|
-
return e === void 0 && (e = (n) => t.mountSettings(n),
|
|
2155
|
+
const ra = /* @__PURE__ */ new WeakMap();
|
|
2156
|
+
function hf(t) {
|
|
2157
|
+
let e = ra.get(t);
|
|
2158
|
+
return e === void 0 && (e = (n) => t.mountSettings(n), ra.set(t, e)), e;
|
|
2087
2159
|
}
|
|
2088
|
-
function
|
|
2089
|
-
const [a, s] = L(null), [r, i] = L(!1), f =
|
|
2160
|
+
function sa({ activity: t, roomKey: e, layer: n }) {
|
|
2161
|
+
const [a, s] = L(null), [r, i] = L(!1), f = k((h) => h.snapshot.leaderId), o = k((h) => h.me.clientId), l = !!f && f === o, d = k((h) => h.name), u = Ga()?.theme, m = uf(void 0, u, xs().theme), y = ye(() => ({
|
|
2090
2162
|
roomKey: e,
|
|
2091
2163
|
identity: {
|
|
2092
2164
|
// The registry userId — what RoomChrome's `userId` prop is.
|
|
@@ -2097,7 +2169,7 @@ function ra({ activity: t, roomKey: e, layer: n }) {
|
|
|
2097
2169
|
theme: m,
|
|
2098
2170
|
isLeader: l,
|
|
2099
2171
|
close: () => {
|
|
2100
|
-
T("game", "bundle close", { gameId: t.id, isLeader: l, layer: n }), n !== "base" && (l ?
|
|
2172
|
+
T("game", "bundle close", { gameId: t.id, isLeader: l, layer: n }), n !== "base" && (l ? Ba(null) : i(!0));
|
|
2101
2173
|
}
|
|
2102
2174
|
}), [e, d, m, l, t.id, n]), b = Oi({
|
|
2103
2175
|
load: r ? null : t.load,
|
|
@@ -2109,8 +2181,8 @@ function ra({ activity: t, roomKey: e, layer: n }) {
|
|
|
2109
2181
|
// Only the overlay's game gets the popout's section. The base layer is
|
|
2110
2182
|
// the media player, which has no settings of its own.
|
|
2111
2183
|
onSettingsAvailable: n === "overlay" ? (h, p) => {
|
|
2112
|
-
const { gameSettings: _, setGameSettings:
|
|
2113
|
-
h ?
|
|
2184
|
+
const { gameSettings: _, setGameSettings: C } = k.getState(), M = hf(p);
|
|
2185
|
+
h ? C(M) : _ === M && C(null);
|
|
2114
2186
|
} : void 0,
|
|
2115
2187
|
onSettingsError: (h, p) => {
|
|
2116
2188
|
N("game", "bundle settings failed", { gameId: t.id, message: h, cause: String(p) });
|
|
@@ -2138,8 +2210,8 @@ function ra({ activity: t, roomKey: e, layer: n }) {
|
|
|
2138
2210
|
}
|
|
2139
2211
|
);
|
|
2140
2212
|
}
|
|
2141
|
-
const
|
|
2142
|
-
function
|
|
2213
|
+
const Bc = "drawer-btn", gf = "drawer-icon-btn";
|
|
2214
|
+
function mf({ open: t, onClose: e, back: n = !1, header: a, footer: s, children: r }) {
|
|
2143
2215
|
const i = D(null);
|
|
2144
2216
|
return R(() => {
|
|
2145
2217
|
if (!t) return;
|
|
@@ -2162,7 +2234,7 @@ function gf({ open: t, onClose: e, back: n = !1, header: a, footer: s, children:
|
|
|
2162
2234
|
onClick: (f) => f.stopPropagation(),
|
|
2163
2235
|
children: [
|
|
2164
2236
|
/* @__PURE__ */ x("div", { className: "px-3 py-2 border-b border-border flex items-center gap-2 text-sm min-w-0", children: [
|
|
2165
|
-
/* @__PURE__ */ c("button", { ref: i, onClick: e, className:
|
|
2237
|
+
/* @__PURE__ */ c("button", { ref: i, onClick: e, className: gf, "aria-label": n ? "Back" : "Close", title: n ? "Back" : "Close", children: n ? /* @__PURE__ */ c(mr, { className: "w-4 h-4" }) : /* @__PURE__ */ c(pr, { className: "w-4 h-4" }) }),
|
|
2166
2238
|
a
|
|
2167
2239
|
] }),
|
|
2168
2240
|
r,
|
|
@@ -2171,47 +2243,47 @@ function gf({ open: t, onClose: e, back: n = !1, header: a, footer: s, children:
|
|
|
2171
2243
|
}
|
|
2172
2244
|
) }) : null;
|
|
2173
2245
|
}
|
|
2174
|
-
function
|
|
2175
|
-
return /* @__PURE__ */ c(
|
|
2246
|
+
function pf({ open: t, onClose: e }) {
|
|
2247
|
+
return /* @__PURE__ */ c(mf, { open: t, onClose: e, children: /* @__PURE__ */ c("div", { className: "px-4 py-3 text-xs text-text-muted", children: "Loading…" }) });
|
|
2176
2248
|
}
|
|
2177
|
-
const
|
|
2249
|
+
const Fr = 9e3, ia = 1500, bf = {
|
|
2178
2250
|
classic: "[text-shadow:_-1px_-1px_0_#000,_1px_-1px_0_#000,_-1px_1px_0_#000,_1px_1px_0_#000,_0_-1px_0_#000,_0_1px_0_#000,_-1px_0_0_#000,_1px_0_0_#000]",
|
|
2179
2251
|
cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
|
|
2180
2252
|
minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
|
|
2181
2253
|
contrast: "bg-black/70 px-2 py-0.5 rounded"
|
|
2182
|
-
},
|
|
2254
|
+
}, oa = { WebkitTextStroke: "0.5px black", paintOrder: "stroke fill" }, fa = {
|
|
2183
2255
|
textShadow: "none",
|
|
2184
2256
|
filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
|
|
2185
2257
|
};
|
|
2186
|
-
function
|
|
2187
|
-
const a =
|
|
2258
|
+
function yf({ message: t, age: e, ccStyle: n }) {
|
|
2259
|
+
const a = Fr - ia;
|
|
2188
2260
|
let s = 1;
|
|
2189
|
-
e > a && (s = Math.max(0, 1 - (e - a) /
|
|
2190
|
-
const r =
|
|
2261
|
+
e > a && (s = Math.max(0, 1 - (e - a) / ia));
|
|
2262
|
+
const r = bf[n], i = Jt(
|
|
2191
2263
|
{ clientId: t.clientId, author: t.author },
|
|
2192
2264
|
{ name: t.name, sprite: t.sprite }
|
|
2193
2265
|
), f = Ge(i.sprite, i.pictureUrl), o = i.cosmetics, [l] = L(
|
|
2194
|
-
() => t.live && t.text ?
|
|
2266
|
+
() => t.live && t.text ? Ra(t.text, o) : null
|
|
2195
2267
|
);
|
|
2196
2268
|
return /* @__PURE__ */ x(
|
|
2197
2269
|
"div",
|
|
2198
2270
|
{
|
|
2199
2271
|
className: `flex items-start gap-2 py-1 ${r}`,
|
|
2200
|
-
style: { opacity: s, transition: "opacity 0.15s ease-out", ...
|
|
2272
|
+
style: { opacity: s, transition: "opacity 0.15s ease-out", ...sr(f) },
|
|
2201
2273
|
children: [
|
|
2202
|
-
/* @__PURE__ */ c(
|
|
2274
|
+
/* @__PURE__ */ c(ir, { sprite: i.sprite, url: i.pictureUrl, worn: o }),
|
|
2203
2275
|
/* @__PURE__ */ x("div", { className: "min-w-0 flex-1", children: [
|
|
2204
|
-
o ? /* @__PURE__ */ c(Rt, { html:
|
|
2205
|
-
l ? /* @__PURE__ */ c(Rt, { html: l, className: "text-sm text-white break-words", style:
|
|
2206
|
-
/* @__PURE__ */ c(
|
|
2276
|
+
o ? /* @__PURE__ */ c(Rt, { html: La(i.name, o), className: "text-sm mr-2", style: { color: f, ...fa } }) : /* @__PURE__ */ c("span", { className: "font-medium text-sm mr-2", style: { color: f, ...oa }, children: i.name }),
|
|
2277
|
+
l ? /* @__PURE__ */ c(Rt, { html: l, className: "text-sm text-white break-words", style: fa }) : /* @__PURE__ */ c("span", { className: "text-sm text-white break-words", style: oa, children: t.text }),
|
|
2278
|
+
/* @__PURE__ */ c(fr, { images: t.images })
|
|
2207
2279
|
] })
|
|
2208
2280
|
]
|
|
2209
2281
|
}
|
|
2210
2282
|
);
|
|
2211
2283
|
}
|
|
2212
|
-
function
|
|
2213
|
-
|
|
2214
|
-
const n =
|
|
2284
|
+
function wf({ shown: t, className: e }) {
|
|
2285
|
+
rr();
|
|
2286
|
+
const n = k((o) => o.chat), a = k((o) => o.mediaPrefs.subtitleStyle), [s, r] = L(() => Date.now()), i = n.length > 0;
|
|
2215
2287
|
R(() => {
|
|
2216
2288
|
const o = setInterval(() => {
|
|
2217
2289
|
i && r(Date.now());
|
|
@@ -2219,7 +2291,7 @@ function yf({ shown: t, className: e }) {
|
|
|
2219
2291
|
return () => clearInterval(o);
|
|
2220
2292
|
}, [i]);
|
|
2221
2293
|
const f = ye(() => {
|
|
2222
|
-
const o = s -
|
|
2294
|
+
const o = s - Fr;
|
|
2223
2295
|
return n.filter((l) => !l.isSystem && l.ts > o).slice(-12);
|
|
2224
2296
|
}, [n, s]);
|
|
2225
2297
|
return !t || f.length === 0 ? null : /* @__PURE__ */ c(
|
|
@@ -2228,7 +2300,7 @@ function yf({ shown: t, className: e }) {
|
|
|
2228
2300
|
className: `wp-floating-chat pointer-events-none flex flex-col ${e}`,
|
|
2229
2301
|
"data-testid": "floating-chat",
|
|
2230
2302
|
children: f.map((o) => /* @__PURE__ */ c(
|
|
2231
|
-
|
|
2303
|
+
yf,
|
|
2232
2304
|
{
|
|
2233
2305
|
message: o,
|
|
2234
2306
|
age: s - o.ts,
|
|
@@ -2239,100 +2311,42 @@ function yf({ shown: t, className: e }) {
|
|
|
2239
2311
|
}
|
|
2240
2312
|
);
|
|
2241
2313
|
}
|
|
2242
|
-
const
|
|
2243
|
-
function
|
|
2314
|
+
const _f = 2;
|
|
2315
|
+
function $r(t) {
|
|
2244
2316
|
return t.duration_ms > 0 && t.duration_ms - t.playhead_ms <= Nn;
|
|
2245
2317
|
}
|
|
2246
|
-
function
|
|
2318
|
+
function Dr(t) {
|
|
2247
2319
|
const e = t.video_ready_state ?? -1;
|
|
2248
|
-
return e < 0 ? !0 : !(e <=
|
|
2320
|
+
return e < 0 ? !0 : !(e <= _f && t.buffered_ahead_ms > Nn);
|
|
2249
2321
|
}
|
|
2250
|
-
function
|
|
2251
|
-
return t.playhead_ms === 0 && !t.is_buffering && t.buffered_ahead_ms === 0 ? "idle" : t.is_buffering ? "buffering" :
|
|
2322
|
+
function Oc(t) {
|
|
2323
|
+
return t.playhead_ms === 0 && !t.is_buffering && t.buffered_ahead_ms === 0 ? "idle" : t.is_buffering ? "buffering" : $r(t) ? "healthy" : !Dr(t) || t.buffered_ahead_ms <= Oa ? "critical" : t.buffered_ahead_ms <= Nn ? "warning" : "healthy";
|
|
2252
2324
|
}
|
|
2253
|
-
const
|
|
2325
|
+
const jc = {
|
|
2254
2326
|
idle: "Idle",
|
|
2255
2327
|
buffering: "Buffering",
|
|
2256
2328
|
critical: "Critical",
|
|
2257
2329
|
warning: "Low Buffer",
|
|
2258
2330
|
healthy: "Healthy"
|
|
2259
|
-
};
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
if (jt) return jt;
|
|
2263
|
-
try {
|
|
2264
|
-
const t = window.AudioContext ?? window.webkitAudioContext;
|
|
2265
|
-
t && (jt = new t());
|
|
2266
|
-
} catch {
|
|
2267
|
-
}
|
|
2268
|
-
return jt;
|
|
2269
|
-
}
|
|
2270
|
-
function Pn(t) {
|
|
2271
|
-
t.state === "suspended" && t.resume().catch(() => {
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
function Nr(t, e, n, a) {
|
|
2275
|
-
t.gain.setValueAtTime(0, e), t.gain.linearRampToValueAtTime(n, e + 5e-3), t.gain.exponentialRampToValueAtTime(1e-4, e + a);
|
|
2276
|
-
}
|
|
2277
|
-
function at(t, e, n = 0.15, a = 0) {
|
|
2278
|
-
const s = Dn();
|
|
2279
|
-
if (!s) return;
|
|
2280
|
-
Pn(s);
|
|
2281
|
-
const r = s.currentTime + a, i = s.createOscillator(), f = s.createGain();
|
|
2282
|
-
i.type = "sine", i.frequency.value = t, Nr(f, r, n, e / 1e3), i.connect(f).connect(s.destination), i.start(r), i.stop(r + e / 1e3 + 0.05);
|
|
2283
|
-
}
|
|
2284
|
-
function fn(t, e, n, a, s = 0.15, r = 0) {
|
|
2285
|
-
const i = Dn();
|
|
2286
|
-
if (!i) return;
|
|
2287
|
-
Pn(i);
|
|
2288
|
-
const f = i.currentTime + r, o = i.createOscillator(), l = i.createOscillator(), d = i.createGain(), u = i.createGain();
|
|
2289
|
-
o.type = "sine", o.frequency.value = t, l.type = "sine", l.frequency.value = e, d.gain.value = n * e, l.connect(d).connect(o.frequency), Nr(u, f, s, a / 1e3), o.connect(u).connect(i.destination), o.start(f), o.stop(f + a / 1e3 + 0.05), l.start(f), l.stop(f + a / 1e3 + 0.05);
|
|
2290
|
-
}
|
|
2291
|
-
function Rr() {
|
|
2292
|
-
at(700, 60, 0.14, 0), at(700, 60, 0.14, 0.1), at(932, 120, 0.17, 0.2);
|
|
2293
|
-
}
|
|
2294
|
-
function Lr() {
|
|
2295
|
-
at(784, 45, 0.07, 0), at(1047, 60, 0.07, 0.045);
|
|
2296
|
-
}
|
|
2297
|
-
function Fr() {
|
|
2298
|
-
at(659, 45, 0.06, 0), at(494, 70, 0.06, 0.045);
|
|
2299
|
-
}
|
|
2300
|
-
function $r() {
|
|
2301
|
-
fn(587, 1174, 3, 320, 0.12, 0), fn(880, 1760, 3, 320, 0.12, 0.06), fn(884, 1768, 3, 320, 0.08, 0.06);
|
|
2302
|
-
}
|
|
2303
|
-
function Dr() {
|
|
2304
|
-
const t = Dn();
|
|
2305
|
-
if (!t) return;
|
|
2306
|
-
Pn(t);
|
|
2307
|
-
const e = t.currentTime, n = t.createOscillator(), a = t.createGain();
|
|
2308
|
-
n.type = "sine", n.frequency.setValueAtTime(380, e), n.frequency.exponentialRampToValueAtTime(760, e + 0.07), a.gain.setValueAtTime(0, e), a.gain.linearRampToValueAtTime(0.06, e + 0.01), a.gain.exponentialRampToValueAtTime(1e-4, e + 0.14), n.connect(a).connect(t.destination), n.start(e), n.stop(e + 0.19);
|
|
2309
|
-
}
|
|
2310
|
-
Ba("__WP_SOUNDS__", {
|
|
2311
|
-
start: Rr,
|
|
2312
|
-
finish: $r,
|
|
2313
|
-
on: Lr,
|
|
2314
|
-
off: Fr,
|
|
2315
|
-
chat: Dr
|
|
2316
|
-
});
|
|
2317
|
-
const fa = { on: 0, off: 0 };
|
|
2318
|
-
function _f(t, e, n, a) {
|
|
2319
|
-
if (!n || !a) return fa;
|
|
2331
|
+
}, la = { on: 0, off: 0 };
|
|
2332
|
+
function vf(t, e, n, a) {
|
|
2333
|
+
if (!n || !a) return la;
|
|
2320
2334
|
const s = new Set(t), r = new Set(e);
|
|
2321
2335
|
let i = 0;
|
|
2322
2336
|
for (const o of r) s.has(o) || i++;
|
|
2323
2337
|
let f = 0;
|
|
2324
2338
|
for (const o of s) r.has(o) || f++;
|
|
2325
|
-
return i === 0 && f === 0 ?
|
|
2326
|
-
}
|
|
2327
|
-
const vf = 1200, xe = 52, Kt = 4, Sn = (xe - Kt) / 2, la = 2 * Math.PI * Sn, ze = xe - Kt * 2 - 4;
|
|
2328
|
-
function kf(t) {
|
|
2329
|
-
return Ir(t) ? !0 : Cr(t) ? t.buffered_ahead_ms >= Be : !1;
|
|
2339
|
+
return i === 0 && f === 0 ? la : { on: i, off: f };
|
|
2330
2340
|
}
|
|
2341
|
+
const kf = 1200, xe = 52, Kt = 4, Sn = (xe - Kt) / 2, ca = 2 * Math.PI * Sn, ze = xe - Kt * 2 - 4;
|
|
2331
2342
|
function Sf(t) {
|
|
2343
|
+
return $r(t) ? !0 : Dr(t) ? t.buffered_ahead_ms >= Be : !1;
|
|
2344
|
+
}
|
|
2345
|
+
function xf(t) {
|
|
2332
2346
|
return `hsl(${Math.round(t * 120)}, 90%, 55%)`;
|
|
2333
2347
|
}
|
|
2334
|
-
function
|
|
2335
|
-
const s = Math.min(1, t.buffered_ahead_ms / Be), r =
|
|
2348
|
+
function Ef({ client: t, look: e, fading: n, onFadeEnd: a }) {
|
|
2349
|
+
const s = Math.min(1, t.buffered_ahead_ms / Be), r = ca * (1 - s), i = xf(s), f = Ge(e.sprite, e.pictureUrl);
|
|
2336
2350
|
return /* @__PURE__ */ x(
|
|
2337
2351
|
"div",
|
|
2338
2352
|
{
|
|
@@ -2340,7 +2354,7 @@ function xf({ client: t, look: e, fading: n, onFadeEnd: a }) {
|
|
|
2340
2354
|
"data-client-id": t.client_id,
|
|
2341
2355
|
className: "flex flex-col items-center gap-1",
|
|
2342
2356
|
style: n ? {
|
|
2343
|
-
animation: `bufferFadeOut ${
|
|
2357
|
+
animation: `bufferFadeOut ${kf}ms ease forwards`
|
|
2344
2358
|
} : void 0,
|
|
2345
2359
|
onAnimationEnd: n ? a : void 0,
|
|
2346
2360
|
children: [
|
|
@@ -2374,7 +2388,7 @@ function xf({ client: t, look: e, fading: n, onFadeEnd: a }) {
|
|
|
2374
2388
|
stroke: i,
|
|
2375
2389
|
strokeWidth: Kt,
|
|
2376
2390
|
strokeLinecap: "round",
|
|
2377
|
-
strokeDasharray:
|
|
2391
|
+
strokeDasharray: ca,
|
|
2378
2392
|
strokeDashoffset: r,
|
|
2379
2393
|
style: { transition: "stroke-dashoffset 0.4s ease, stroke 0.4s ease" }
|
|
2380
2394
|
}
|
|
@@ -2419,7 +2433,7 @@ function xf({ client: t, look: e, fading: n, onFadeEnd: a }) {
|
|
|
2419
2433
|
}
|
|
2420
2434
|
);
|
|
2421
2435
|
}
|
|
2422
|
-
function
|
|
2436
|
+
function Mf({ clientId: t, sprite: e, pictureUrl: n, name: a, isReady: s, isSelf: r, onToggle: i }) {
|
|
2423
2437
|
const f = Ge(e, n), o = s ? "success" : "neutral", l = s ? /* @__PURE__ */ c(Nt, { name: "tick" }) : /* @__PURE__ */ c(Nt, { name: "hourglass" });
|
|
2424
2438
|
return /* @__PURE__ */ x(
|
|
2425
2439
|
"button",
|
|
@@ -2491,42 +2505,42 @@ function Ef({ clientId: t, sprite: e, pictureUrl: n, name: a, isReady: s, isSelf
|
|
|
2491
2505
|
}
|
|
2492
2506
|
);
|
|
2493
2507
|
}
|
|
2494
|
-
const
|
|
2495
|
-
function
|
|
2508
|
+
const Tf = { status: null, entries: [], completed: /* @__PURE__ */ new Set(), below: /* @__PURE__ */ new Set() };
|
|
2509
|
+
function da(t, e) {
|
|
2496
2510
|
if (!e || e.clients.length === 0) return { ...t, status: e, entries: [] };
|
|
2497
2511
|
const n = new Set(t.completed), a = new Set(t.below), s = [];
|
|
2498
2512
|
for (const r of e.clients) {
|
|
2499
2513
|
const i = r.client_id;
|
|
2500
|
-
|
|
2514
|
+
Sf(r) ? a.has(i) && !n.has(i) ? (n.add(i), s.push({ client: r, completed: !0 })) : n.has(i) && s.push({ client: r, completed: !0 }) : (n.delete(i), a.add(i), s.push({ client: r, completed: !1 }));
|
|
2501
2515
|
}
|
|
2502
2516
|
return { status: e, entries: s, completed: n, below: a };
|
|
2503
2517
|
}
|
|
2504
|
-
function
|
|
2505
|
-
const t =
|
|
2506
|
-
i.status !== t && f(
|
|
2518
|
+
function Af() {
|
|
2519
|
+
const t = k((w) => w.bufferStatus), e = k((w) => w.readyCheck), n = k((w) => w.roster), a = k((w) => w.me.clientId), s = k((w) => w.snapshot.playing), r = st(), [i, f] = L(() => da(Tf, t));
|
|
2520
|
+
i.status !== t && f(da(i, t));
|
|
2507
2521
|
const o = i.entries, l = (w) => {
|
|
2508
|
-
f((
|
|
2509
|
-
const F = new Set(
|
|
2510
|
-
return F.delete(w), E.delete(w), { ...
|
|
2522
|
+
f((S) => {
|
|
2523
|
+
const F = new Set(S.completed), E = new Set(S.below);
|
|
2524
|
+
return F.delete(w), E.delete(w), { ...S, completed: F, below: E, entries: S.entries.filter((v) => v.client.client_id !== w) };
|
|
2511
2525
|
});
|
|
2512
2526
|
}, d = new Set(e.ready), u = Object.values(n), m = !!a && d.has(a), y = e.active && u.length > 0 && e.ready.length >= u.length, b = D(e.active), g = D(y);
|
|
2513
2527
|
R(() => {
|
|
2514
|
-
!b.current && e.active &&
|
|
2528
|
+
!b.current && e.active && Ar(), b.current = e.active;
|
|
2515
2529
|
}, [e.active]), R(() => {
|
|
2516
|
-
!g.current && y &&
|
|
2530
|
+
!g.current && y && Nr(), g.current = y;
|
|
2517
2531
|
}, [y]);
|
|
2518
2532
|
const h = D(e.ready), p = D(e.active);
|
|
2519
2533
|
R(() => {
|
|
2520
|
-
const { on: w, off:
|
|
2534
|
+
const { on: w, off: S } = vf(
|
|
2521
2535
|
h.current,
|
|
2522
2536
|
e.ready,
|
|
2523
2537
|
p.current,
|
|
2524
2538
|
e.active
|
|
2525
2539
|
);
|
|
2526
|
-
w > 0 &&
|
|
2540
|
+
w > 0 && Cr(), S > 0 && Ir(), h.current = e.ready, p.current = e.active;
|
|
2527
2541
|
}, [e.ready, e.active]);
|
|
2528
|
-
const _ = e.active,
|
|
2529
|
-
return !_ && !
|
|
2542
|
+
const _ = e.active, C = !_ && o.length > 0, M = !_ && !C && r && u.length > 0 && !s;
|
|
2543
|
+
return !_ && !C && !M ? null : /* @__PURE__ */ x(pe, { children: [
|
|
2530
2544
|
/* @__PURE__ */ c("style", { children: `
|
|
2531
2545
|
@keyframes bufferFadeOut {
|
|
2532
2546
|
from { opacity: 1; transform: translateY(0); }
|
|
@@ -2537,7 +2551,7 @@ function Tf() {
|
|
|
2537
2551
|
"div",
|
|
2538
2552
|
{
|
|
2539
2553
|
"data-testid": "client-status-overlay",
|
|
2540
|
-
"data-mode": _ ? "ready-check" :
|
|
2554
|
+
"data-mode": _ ? "ready-check" : C ? "buffer-load" : "idle",
|
|
2541
2555
|
className: "absolute top-16 right-4 z-20 flex flex-col items-end gap-3 pointer-events-none",
|
|
2542
2556
|
children: [
|
|
2543
2557
|
_ && /* @__PURE__ */ x(pe, { children: [
|
|
@@ -2556,7 +2570,7 @@ function Tf() {
|
|
|
2556
2570
|
}
|
|
2557
2571
|
),
|
|
2558
2572
|
/* @__PURE__ */ c("div", { className: "flex flex-col gap-3", children: u.map((w) => /* @__PURE__ */ c(
|
|
2559
|
-
|
|
2573
|
+
Mf,
|
|
2560
2574
|
{
|
|
2561
2575
|
clientId: w.clientId,
|
|
2562
2576
|
sprite: w.sprite,
|
|
@@ -2569,12 +2583,12 @@ function Tf() {
|
|
|
2569
2583
|
w.clientId
|
|
2570
2584
|
)) })
|
|
2571
2585
|
] }),
|
|
2572
|
-
|
|
2573
|
-
|
|
2586
|
+
C && o.map(({ client: w, completed: S }) => /* @__PURE__ */ c(
|
|
2587
|
+
Ef,
|
|
2574
2588
|
{
|
|
2575
2589
|
client: w,
|
|
2576
|
-
look:
|
|
2577
|
-
fading:
|
|
2590
|
+
look: ar(n, { clientId: w.client_id }, { name: w.name, sprite: w.sprite_id ?? null }),
|
|
2591
|
+
fading: S,
|
|
2578
2592
|
onFadeEnd: () => l(w.client_id)
|
|
2579
2593
|
},
|
|
2580
2594
|
w.client_id
|
|
@@ -2597,14 +2611,14 @@ function Tf() {
|
|
|
2597
2611
|
] });
|
|
2598
2612
|
}
|
|
2599
2613
|
const xn = /* @__PURE__ */ new Map();
|
|
2600
|
-
function
|
|
2614
|
+
function Cf(t, e) {
|
|
2601
2615
|
return xn.has(t) ? xn.get(t) : e;
|
|
2602
2616
|
}
|
|
2603
2617
|
function If(t, e) {
|
|
2604
2618
|
xn.set(t, e);
|
|
2605
2619
|
}
|
|
2606
|
-
function
|
|
2607
|
-
const [n, a] = L(() =>
|
|
2620
|
+
function Nf(t, e) {
|
|
2621
|
+
const [n, a] = L(() => Cf(t, e)), s = j((r) => {
|
|
2608
2622
|
a((i) => {
|
|
2609
2623
|
const f = typeof r == "function" ? r(i) : r;
|
|
2610
2624
|
return If(t, f), f;
|
|
@@ -2623,7 +2637,7 @@ const En = {
|
|
|
2623
2637
|
function Pr(t) {
|
|
2624
2638
|
t?.complete && t.naturalWidth > 0 && (t.dataset.loaded = "true");
|
|
2625
2639
|
}
|
|
2626
|
-
function
|
|
2640
|
+
function ua({
|
|
2627
2641
|
entry: t,
|
|
2628
2642
|
draggable: e,
|
|
2629
2643
|
picked: n,
|
|
@@ -2650,7 +2664,7 @@ function da({
|
|
|
2650
2664
|
/* @__PURE__ */ c(
|
|
2651
2665
|
"img",
|
|
2652
2666
|
{
|
|
2653
|
-
src:
|
|
2667
|
+
src: ja(t.id, t.thumbnail),
|
|
2654
2668
|
alt: "",
|
|
2655
2669
|
loading: "eager",
|
|
2656
2670
|
decoding: "async",
|
|
@@ -2670,7 +2684,7 @@ function da({
|
|
|
2670
2684
|
}
|
|
2671
2685
|
);
|
|
2672
2686
|
}
|
|
2673
|
-
function
|
|
2687
|
+
function Rf({ sprite: t, url: e }) {
|
|
2674
2688
|
const n = Ge(t, e);
|
|
2675
2689
|
return /* @__PURE__ */ c(
|
|
2676
2690
|
yt,
|
|
@@ -2683,7 +2697,7 @@ function Nf({ sprite: t, url: e }) {
|
|
|
2683
2697
|
}
|
|
2684
2698
|
);
|
|
2685
2699
|
}
|
|
2686
|
-
function
|
|
2700
|
+
function Lf({
|
|
2687
2701
|
anchor: t,
|
|
2688
2702
|
itemId: e,
|
|
2689
2703
|
snap: n
|
|
@@ -2710,7 +2724,7 @@ function Rf({
|
|
|
2710
2724
|
children: [
|
|
2711
2725
|
/* @__PURE__ */ c("div", { className: "text-[11px] font-semibold text-text leading-snug pb-1.5 mb-1.5 border-b border-border", children: f }),
|
|
2712
2726
|
Object.entries(i.votes).map(([o, l]) => /* @__PURE__ */ x("div", { className: "flex items-center gap-2 py-0.5", children: [
|
|
2713
|
-
/* @__PURE__ */ c(
|
|
2727
|
+
/* @__PURE__ */ c(Rf, { sprite: n.sprites[o], url: n.pictures?.[o] }),
|
|
2714
2728
|
/* @__PURE__ */ c("span", { className: "flex-1 text-[11px] text-text-secondary truncate", children: n.names[o] ?? "viewer" }),
|
|
2715
2729
|
/* @__PURE__ */ c(
|
|
2716
2730
|
"span",
|
|
@@ -2727,12 +2741,12 @@ function Rf({
|
|
|
2727
2741
|
document.body
|
|
2728
2742
|
);
|
|
2729
2743
|
}
|
|
2730
|
-
function
|
|
2731
|
-
const t =
|
|
2744
|
+
function Ff() {
|
|
2745
|
+
const t = k((E) => E.tierlistOpen), e = k((E) => E.setTierlistOpen), n = k((E) => E.tierlist), a = k((E) => E.tierlistDraft), s = k((E) => E.tierlistSaving), r = k((E) => E.moveTierlistItem), [i, f] = L(null), [o, l] = L(null), [d, u] = L(null), [m, y] = L(null), [b, g] = Nf("tierlist.tab", "mine");
|
|
2732
2746
|
R(() => {
|
|
2733
|
-
|
|
2747
|
+
qn(!0);
|
|
2734
2748
|
}, []), R(() => {
|
|
2735
|
-
t &&
|
|
2749
|
+
t && qn(!0);
|
|
2736
2750
|
}, [t]), R(() => {
|
|
2737
2751
|
if (!t) return;
|
|
2738
2752
|
const E = (v) => {
|
|
@@ -2742,43 +2756,43 @@ function Lf() {
|
|
|
2742
2756
|
}, [t, e]);
|
|
2743
2757
|
const h = ye(() => new Map((n?.items ?? []).map((E) => [E.id, E])), [n]), p = ye(() => {
|
|
2744
2758
|
const E = { S: [], A: [], B: [], C: [], D: [], F: [], [nt]: [] }, v = /* @__PURE__ */ new Set();
|
|
2745
|
-
for (const
|
|
2746
|
-
for (const $ of a[
|
|
2759
|
+
for (const I of an)
|
|
2760
|
+
for (const $ of a[I] ?? []) {
|
|
2747
2761
|
const B = h.get($);
|
|
2748
|
-
B && (E[
|
|
2762
|
+
B && (E[I].push(B), v.add($));
|
|
2749
2763
|
}
|
|
2750
|
-
for (const
|
|
2764
|
+
for (const I of h.values()) v.has(I.id) || E[nt].push(I);
|
|
2751
2765
|
return E;
|
|
2752
|
-
}, [a, h]), _ = (E, v,
|
|
2753
|
-
const $ = [...E.querySelectorAll("article[data-item-id]")].filter((O) => O.dataset.itemId !==
|
|
2766
|
+
}, [a, h]), _ = (E, v, I) => {
|
|
2767
|
+
const $ = [...E.querySelectorAll("article[data-item-id]")].filter((O) => O.dataset.itemId !== I);
|
|
2754
2768
|
let B = 0;
|
|
2755
2769
|
for (const O of $) {
|
|
2756
2770
|
const z = O.getBoundingClientRect();
|
|
2757
2771
|
v > z.left + z.width / 2 && B++;
|
|
2758
2772
|
}
|
|
2759
2773
|
return B;
|
|
2760
|
-
},
|
|
2774
|
+
}, C = (E) => ({
|
|
2761
2775
|
onDragOver: (v) => {
|
|
2762
2776
|
v.preventDefault(), v.dataTransfer.dropEffect = "move", l(E);
|
|
2763
2777
|
},
|
|
2764
2778
|
onDragLeave: () => l((v) => v === E ? null : v),
|
|
2765
2779
|
onDrop: (v) => {
|
|
2766
2780
|
v.preventDefault(), l(null);
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2781
|
+
const I = v.dataTransfer.getData("text/plain");
|
|
2782
|
+
I && r(I, E === nt ? null : E, _(v.currentTarget, v.clientX, I));
|
|
2769
2783
|
},
|
|
2770
2784
|
onClick: () => {
|
|
2771
2785
|
i && (r(i, E === nt ? null : E), f(null));
|
|
2772
2786
|
}
|
|
2773
2787
|
}), M = j(async () => {
|
|
2774
|
-
await
|
|
2788
|
+
await Cs(k.getState().tierlistDraft) && y(Date.now());
|
|
2775
2789
|
}, []);
|
|
2776
2790
|
if (R(() => {
|
|
2777
2791
|
if (m === null) return;
|
|
2778
2792
|
const E = setTimeout(() => y(null), 2500);
|
|
2779
2793
|
return () => clearTimeout(E);
|
|
2780
2794
|
}, [m]), !t) return null;
|
|
2781
|
-
const w = JSON.stringify(a) !== JSON.stringify(n?.myBoard ?? {}),
|
|
2795
|
+
const w = JSON.stringify(a) !== JSON.stringify(n?.myBoard ?? {}), S = Object.values(n?.myBoard ?? {}).some((E) => (E?.length ?? 0) > 0), F = S ? b : "mine";
|
|
2782
2796
|
return wt(
|
|
2783
2797
|
/* @__PURE__ */ x(
|
|
2784
2798
|
"div",
|
|
@@ -2798,7 +2812,7 @@ function Lf() {
|
|
|
2798
2812
|
children: [
|
|
2799
2813
|
/* @__PURE__ */ x("div", { className: "flex items-center gap-3 px-4 py-2.5 border-b border-border bg-bg-alt shrink-0", children: [
|
|
2800
2814
|
/* @__PURE__ */ c("span", { className: "text-[15px] font-semibold text-text leading-none", children: "Tierlist" }),
|
|
2801
|
-
|
|
2815
|
+
S && /* @__PURE__ */ c("div", { className: "tl-tabs ml-1", role: "tablist", "aria-label": "Tierlist view", children: [["mine", "Mine"], ["everyone", "Everyone"]].map(([E, v]) => /* @__PURE__ */ c(
|
|
2802
2816
|
"button",
|
|
2803
2817
|
{
|
|
2804
2818
|
role: "tab",
|
|
@@ -2834,15 +2848,15 @@ function Lf() {
|
|
|
2834
2848
|
/* @__PURE__ */ c(
|
|
2835
2849
|
"div",
|
|
2836
2850
|
{
|
|
2837
|
-
...
|
|
2851
|
+
...C(E),
|
|
2838
2852
|
className: `flex items-center gap-2 p-2 overflow-x-auto transition-colors ${o === E ? "bg-primary/15 ring-1 ring-inset ring-primary" : "bg-bg-card"}`,
|
|
2839
2853
|
children: p[E].map((v) => /* @__PURE__ */ c(
|
|
2840
|
-
|
|
2854
|
+
ua,
|
|
2841
2855
|
{
|
|
2842
2856
|
entry: v,
|
|
2843
2857
|
draggable: !0,
|
|
2844
2858
|
picked: i === v.id,
|
|
2845
|
-
onPick: () => f((
|
|
2859
|
+
onPick: () => f((I) => I === v.id ? null : v.id),
|
|
2846
2860
|
onDragStart: () => f(null)
|
|
2847
2861
|
},
|
|
2848
2862
|
v.id
|
|
@@ -2853,10 +2867,10 @@ function Lf() {
|
|
|
2853
2867
|
/* @__PURE__ */ c(
|
|
2854
2868
|
"div",
|
|
2855
2869
|
{
|
|
2856
|
-
...
|
|
2870
|
+
...C(nt),
|
|
2857
2871
|
className: `flex items-center gap-2 p-2 overflow-x-auto min-h-[96px] border-t border-dashed border-border transition-colors ${o === nt ? "bg-primary/15 ring-1 ring-inset ring-primary" : "bg-bg"}`,
|
|
2858
2872
|
children: p[nt].map((E) => /* @__PURE__ */ c(
|
|
2859
|
-
|
|
2873
|
+
ua,
|
|
2860
2874
|
{
|
|
2861
2875
|
entry: E,
|
|
2862
2876
|
draggable: !0,
|
|
@@ -2870,7 +2884,7 @@ function Lf() {
|
|
|
2870
2884
|
)
|
|
2871
2885
|
] }),
|
|
2872
2886
|
F === "everyone" && n && /* @__PURE__ */ c(pe, { children: an.map((E) => {
|
|
2873
|
-
const v = n.placed.filter((
|
|
2887
|
+
const v = n.placed.filter((I) => I.tier === E);
|
|
2874
2888
|
return /* @__PURE__ */ x("div", { className: "grid grid-cols-[56px_1fr] border-b border-border/50 min-h-[86px]", children: [
|
|
2875
2889
|
/* @__PURE__ */ c(
|
|
2876
2890
|
"div",
|
|
@@ -2880,23 +2894,23 @@ function Lf() {
|
|
|
2880
2894
|
children: /* @__PURE__ */ c("span", { className: "text-2xl font-bold leading-none", children: E })
|
|
2881
2895
|
}
|
|
2882
2896
|
),
|
|
2883
|
-
/* @__PURE__ */ c("div", { className: "flex items-stretch gap-2 p-2 overflow-x-auto bg-bg-card", children: v.map((
|
|
2884
|
-
const $ = h.get(
|
|
2897
|
+
/* @__PURE__ */ c("div", { className: "flex items-stretch gap-2 p-2 overflow-x-auto bg-bg-card", children: v.map((I) => {
|
|
2898
|
+
const $ = h.get(I.mediaId);
|
|
2885
2899
|
return /* @__PURE__ */ x(
|
|
2886
2900
|
"div",
|
|
2887
2901
|
{
|
|
2888
2902
|
tabIndex: 0,
|
|
2889
|
-
onMouseEnter: (B) => u({ anchor: B.currentTarget.getBoundingClientRect(), itemId:
|
|
2903
|
+
onMouseEnter: (B) => u({ anchor: B.currentTarget.getBoundingClientRect(), itemId: I.mediaId }),
|
|
2890
2904
|
onMouseLeave: () => u(null),
|
|
2891
|
-
onFocus: (B) => u({ anchor: B.currentTarget.getBoundingClientRect(), itemId:
|
|
2905
|
+
onFocus: (B) => u({ anchor: B.currentTarget.getBoundingClientRect(), itemId: I.mediaId }),
|
|
2892
2906
|
onBlur: () => u(null),
|
|
2893
|
-
"aria-label": `${$?.displayName ??
|
|
2907
|
+
"aria-label": `${$?.displayName ?? I.mediaId} — score ${I.score.toFixed(2)}. ${Object.entries(I.votes).map(([B, O]) => `${n.names[B] ?? "viewer"} ${O}`).join(", ")}`,
|
|
2894
2908
|
className: "w-[124px] shrink-0 rounded-md overflow-hidden bg-bg-alt border border-border hover:border-primary transition-colors",
|
|
2895
2909
|
children: [
|
|
2896
2910
|
/* @__PURE__ */ c(
|
|
2897
2911
|
"img",
|
|
2898
2912
|
{
|
|
2899
|
-
src:
|
|
2913
|
+
src: ja(I.mediaId, $?.thumbnail),
|
|
2900
2914
|
alt: "",
|
|
2901
2915
|
loading: "eager",
|
|
2902
2916
|
decoding: "async",
|
|
@@ -2910,14 +2924,14 @@ function Lf() {
|
|
|
2910
2924
|
className: "tl-card-img w-full aspect-video object-cover bg-bg-card"
|
|
2911
2925
|
}
|
|
2912
2926
|
),
|
|
2913
|
-
/* @__PURE__ */ c("div", { className: "px-1.5 pt-1 text-[11px] leading-tight text-text-secondary line-clamp-2 min-h-[28px]", children: $?.displayName ??
|
|
2927
|
+
/* @__PURE__ */ c("div", { className: "px-1.5 pt-1 text-[11px] leading-tight text-text-secondary line-clamp-2 min-h-[28px]", children: $?.displayName ?? I.mediaId }),
|
|
2914
2928
|
/* @__PURE__ */ x("div", { className: "px-1.5 pb-1 flex items-center gap-1 text-[10px] tabular-nums text-text-muted", children: [
|
|
2915
2929
|
/* @__PURE__ */ c("span", { children: "score" }),
|
|
2916
|
-
/* @__PURE__ */ c("span", { className: "text-text-secondary", children:
|
|
2930
|
+
/* @__PURE__ */ c("span", { className: "text-text-secondary", children: I.score.toFixed(2) })
|
|
2917
2931
|
] })
|
|
2918
2932
|
]
|
|
2919
2933
|
},
|
|
2920
|
-
|
|
2934
|
+
I.mediaId
|
|
2921
2935
|
);
|
|
2922
2936
|
}) })
|
|
2923
2937
|
] }, E);
|
|
@@ -2926,14 +2940,14 @@ function Lf() {
|
|
|
2926
2940
|
]
|
|
2927
2941
|
}
|
|
2928
2942
|
),
|
|
2929
|
-
d && n && /* @__PURE__ */ c(
|
|
2943
|
+
d && n && /* @__PURE__ */ c(Lf, { anchor: d.anchor, itemId: d.itemId, snap: n })
|
|
2930
2944
|
]
|
|
2931
2945
|
}
|
|
2932
2946
|
),
|
|
2933
2947
|
document.body
|
|
2934
2948
|
);
|
|
2935
2949
|
}
|
|
2936
|
-
function
|
|
2950
|
+
function $f({ children: t }) {
|
|
2937
2951
|
const [e, n] = L(null);
|
|
2938
2952
|
return R(() => {
|
|
2939
2953
|
const a = () => n(document.fullscreenElement);
|
|
@@ -2944,7 +2958,7 @@ function Br({ site: t = "control bar", className: e = "ctr-btn" }) {
|
|
|
2944
2958
|
return /* @__PURE__ */ c(
|
|
2945
2959
|
"button",
|
|
2946
2960
|
{
|
|
2947
|
-
onClick: () =>
|
|
2961
|
+
onClick: () => er(t),
|
|
2948
2962
|
className: e,
|
|
2949
2963
|
title: "Select Media",
|
|
2950
2964
|
"aria-label": "Select Media",
|
|
@@ -2952,8 +2966,8 @@ function Br({ site: t = "control bar", className: e = "ctr-btn" }) {
|
|
|
2952
2966
|
}
|
|
2953
2967
|
);
|
|
2954
2968
|
}
|
|
2955
|
-
function
|
|
2956
|
-
const t =
|
|
2969
|
+
function Df() {
|
|
2970
|
+
const t = k((i) => i.chatCollapsed), e = k((i) => i.toggleChatCollapsed), n = k((i) => !!i.snapshot.mediaId), a = Ft(), s = Vt({ hasMedia: n, chatCollapsed: t, isFullscreen: a });
|
|
2957
2971
|
return { panelHidden: s, toggle: () => {
|
|
2958
2972
|
if (T("chat", s ? "Show chat" : "Hide chat", { isFullscreen: a, chatCollapsed: t }), !s) {
|
|
2959
2973
|
e();
|
|
@@ -2965,7 +2979,7 @@ function $f() {
|
|
|
2965
2979
|
} };
|
|
2966
2980
|
}
|
|
2967
2981
|
function Or({ className: t }) {
|
|
2968
|
-
const { panelHidden: e, toggle: n } =
|
|
2982
|
+
const { panelHidden: e, toggle: n } = Df(), a = e ? "Show chat" : "Hide chat";
|
|
2969
2983
|
return /* @__PURE__ */ c(
|
|
2970
2984
|
"button",
|
|
2971
2985
|
{
|
|
@@ -2975,49 +2989,49 @@ function Or({ className: t }) {
|
|
|
2975
2989
|
title: a,
|
|
2976
2990
|
"aria-label": a,
|
|
2977
2991
|
"aria-expanded": !e,
|
|
2978
|
-
children: e ? /* @__PURE__ */ c(wo, { className: "w-5 h-5" }) : /* @__PURE__ */ c(
|
|
2992
|
+
children: e ? /* @__PURE__ */ c(wo, { className: "w-5 h-5" }) : /* @__PURE__ */ c(pr, { className: "w-5 h-5" })
|
|
2979
2993
|
}
|
|
2980
2994
|
);
|
|
2981
2995
|
}
|
|
2982
|
-
function
|
|
2983
|
-
const t =
|
|
2996
|
+
function Pf() {
|
|
2997
|
+
const t = k((d) => d.chatCollapsed), e = k((d) => !!d.snapshot.mediaId), n = Ft(), a = Qt(), s = st(), r = Bn(), i = Rn({
|
|
2984
2998
|
isLeader: r,
|
|
2985
2999
|
hasMedia: e,
|
|
2986
3000
|
chatCollapsed: t,
|
|
2987
3001
|
isFullscreen: n,
|
|
2988
3002
|
gameOverlay: a !== null
|
|
2989
|
-
}) === "room-corner", f = s && a !== null && !n, o =
|
|
3003
|
+
}) === "room-corner", f = s && a !== null && !n, o = nr({ hasMedia: e, isFullscreen: n, gameOverlay: a !== null }) === "room-corner";
|
|
2990
3004
|
return !i && !f && !o ? null : /* @__PURE__ */ x("div", { className: "absolute top-2 right-2 z-40 flex items-center gap-2", "data-testid": "room-corner-controls", children: [
|
|
2991
3005
|
i && /* @__PURE__ */ c(Br, { site: "room corner", className: "corner-btn" }),
|
|
2992
3006
|
f && /* @__PURE__ */ c("button", { type: "button", onClick: () => {
|
|
2993
|
-
T("game", "game_select", { gameId: null, source: "room corner" }),
|
|
2994
|
-
}, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ c(
|
|
3007
|
+
T("game", "game_select", { gameId: null, source: "room corner" }), Ba(null);
|
|
3008
|
+
}, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ c(br, {}) }),
|
|
2995
3009
|
o && /* @__PURE__ */ c(Or, { className: "corner-btn" })
|
|
2996
3010
|
] });
|
|
2997
3011
|
}
|
|
2998
|
-
const Mn = "hadoku:avatar", Tn = "hadoku:name",
|
|
2999
|
-
function
|
|
3000
|
-
return typeof globalThis.BroadcastChannel > "u" ? null : new globalThis.BroadcastChannel(
|
|
3012
|
+
const Mn = "hadoku:avatar", Tn = "hadoku:name", Bf = "hadoku:identity", Ht = /* @__PURE__ */ Symbol.for("hadoku:identity-relay"), ha = /* @__PURE__ */ Symbol.for("hadoku:identity-relayed");
|
|
3013
|
+
function Of() {
|
|
3014
|
+
return typeof globalThis.BroadcastChannel > "u" ? null : new globalThis.BroadcastChannel(Bf);
|
|
3001
3015
|
}
|
|
3002
|
-
function
|
|
3016
|
+
function ga(t) {
|
|
3003
3017
|
return t === Tn || t === Mn;
|
|
3004
3018
|
}
|
|
3005
|
-
function
|
|
3019
|
+
function jf(t, e) {
|
|
3006
3020
|
const n = (a) => {
|
|
3007
|
-
if (a[
|
|
3021
|
+
if (a[ha]) return;
|
|
3008
3022
|
const s = a.detail;
|
|
3009
|
-
!s || typeof s != "object" || !
|
|
3023
|
+
!s || typeof s != "object" || !ga(a.type) || e.postMessage({ event: a.type, detail: s });
|
|
3010
3024
|
};
|
|
3011
3025
|
return t.addEventListener(Tn, n), t.addEventListener(Mn, n), e.addEventListener("message", (a) => {
|
|
3012
3026
|
const { event: s, detail: r } = a.data ?? {};
|
|
3013
|
-
if (!
|
|
3027
|
+
if (!ga(s) || !r || typeof r != "object") return;
|
|
3014
3028
|
const i = new globalThis.CustomEvent(s, { detail: r });
|
|
3015
|
-
Object.defineProperty(i,
|
|
3029
|
+
Object.defineProperty(i, ha, { value: !0 }), t.dispatchEvent(i);
|
|
3016
3030
|
}), () => {
|
|
3017
3031
|
t.removeEventListener(Tn, n), t.removeEventListener(Mn, n), e.close();
|
|
3018
3032
|
};
|
|
3019
3033
|
}
|
|
3020
|
-
function
|
|
3034
|
+
function Hf(t = typeof window > "u" ? void 0 : window, e = Of) {
|
|
3021
3035
|
if (!t) return () => {
|
|
3022
3036
|
};
|
|
3023
3037
|
const n = t;
|
|
@@ -3026,7 +3040,7 @@ function jf(t = typeof window > "u" ? void 0 : window, e = Bf) {
|
|
|
3026
3040
|
const i = e();
|
|
3027
3041
|
if (!i) return () => {
|
|
3028
3042
|
};
|
|
3029
|
-
a = { count: 0, stop:
|
|
3043
|
+
a = { count: 0, stop: jf(t, i) }, n[Ht] = a;
|
|
3030
3044
|
}
|
|
3031
3045
|
a.count++;
|
|
3032
3046
|
const s = a;
|
|
@@ -3035,11 +3049,11 @@ function jf(t = typeof window > "u" ? void 0 : window, e = Bf) {
|
|
|
3035
3049
|
r || (r = !0, !(--s.count > 0) && (s.stop(), n[Ht] === s && delete n[Ht]));
|
|
3036
3050
|
};
|
|
3037
3051
|
}
|
|
3038
|
-
function
|
|
3052
|
+
function Uf() {
|
|
3039
3053
|
R(() => {
|
|
3040
|
-
const t =
|
|
3054
|
+
const t = Hf(), e = Is((a, s) => {
|
|
3041
3055
|
const r = Rs(s);
|
|
3042
|
-
T("avatar", "Avatar changed in the settings popout", { sprite: r, source: s.avatar?.source }),
|
|
3056
|
+
T("avatar", "Avatar changed in the settings popout", { sprite: r, source: s.avatar?.source }), Ha(r);
|
|
3043
3057
|
}), n = Ns((a) => {
|
|
3044
3058
|
T("avatar", "Renamed in the settings popout", { name: a }), Ls(a);
|
|
3045
3059
|
});
|
|
@@ -3048,26 +3062,26 @@ function Hf() {
|
|
|
3048
3062
|
};
|
|
3049
3063
|
}, []);
|
|
3050
3064
|
}
|
|
3051
|
-
const
|
|
3052
|
-
function
|
|
3053
|
-
if (a || !t.live || t.isSystem ||
|
|
3054
|
-
for (let
|
|
3055
|
-
const
|
|
3056
|
-
if (!(
|
|
3057
|
-
return t.ts -
|
|
3065
|
+
const zf = 6e4;
|
|
3066
|
+
function Wf({ message: t, earlier: e, me: n, mediaPlaying: a, enabled: s }) {
|
|
3067
|
+
if (!s || a || !t.live || t.isSystem || lr(t, n)) return !1;
|
|
3068
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
3069
|
+
const i = e[r];
|
|
3070
|
+
if (!(i.isSystem || i.id === t.id))
|
|
3071
|
+
return t.ts - i.ts >= zf;
|
|
3058
3072
|
}
|
|
3059
3073
|
return !0;
|
|
3060
3074
|
}
|
|
3061
|
-
function
|
|
3062
|
-
R(() =>
|
|
3075
|
+
function Gf() {
|
|
3076
|
+
R(() => k.subscribe((t, e) => {
|
|
3063
3077
|
const n = t.chat[t.chat.length - 1];
|
|
3064
3078
|
if (!n || n === e.chat[e.chat.length - 1]) return;
|
|
3065
3079
|
const a = { clientId: t.me.clientId, author: t.me.clientId ? t.roster[t.me.clientId]?.author : void 0 }, s = t.snapshot.playing && t.snapshot.mediaId !== null;
|
|
3066
|
-
|
|
3080
|
+
Wf({ message: n, earlier: e.chat, me: a, mediaPlaying: s, enabled: t.chatSoundEnabled }) && (T("chat", "Chat chime", { id: n.id }), Pn());
|
|
3067
3081
|
}), []);
|
|
3068
3082
|
}
|
|
3069
3083
|
const jr = [];
|
|
3070
|
-
function
|
|
3084
|
+
function ma(t) {
|
|
3071
3085
|
jr.push(t);
|
|
3072
3086
|
}
|
|
3073
3087
|
function dt() {
|
|
@@ -3080,19 +3094,19 @@ function dt() {
|
|
|
3080
3094
|
}
|
|
3081
3095
|
}
|
|
3082
3096
|
let ln = !1;
|
|
3083
|
-
function
|
|
3097
|
+
function qf() {
|
|
3084
3098
|
return ln ? () => {
|
|
3085
3099
|
} : (ln = !0, document.addEventListener("click", dt, { capture: !0, passive: !0 }), document.addEventListener("touchend", dt, { capture: !0, passive: !0 }), document.addEventListener("keydown", dt, { capture: !0, passive: !0 }), () => {
|
|
3086
3100
|
document.removeEventListener("click", dt, { capture: !0 }), document.removeEventListener("touchend", dt, { capture: !0 }), document.removeEventListener("keydown", dt, { capture: !0 }), ln = !1;
|
|
3087
3101
|
});
|
|
3088
3102
|
}
|
|
3089
|
-
const cn = "data-wp-input",
|
|
3090
|
-
function
|
|
3091
|
-
return
|
|
3103
|
+
const cn = "data-wp-input", Kf = /* @__PURE__ */ new Set(["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"]);
|
|
3104
|
+
function Vf(t, e) {
|
|
3105
|
+
return Qa(e) ? !1 : Kf.has(t.key) || qe(t) && t.key !== "Escape";
|
|
3092
3106
|
}
|
|
3093
|
-
function
|
|
3107
|
+
function Jf() {
|
|
3094
3108
|
const t = document.documentElement, e = (a) => {
|
|
3095
|
-
|
|
3109
|
+
Vf(a, document.activeElement) && t.setAttribute(cn, "remote");
|
|
3096
3110
|
}, n = (a) => {
|
|
3097
3111
|
a.detail > 0 && t.setAttribute(cn, "pointer");
|
|
3098
3112
|
};
|
|
@@ -3100,43 +3114,43 @@ function Vf() {
|
|
|
3100
3114
|
window.removeEventListener("keydown", e, !0), window.removeEventListener("click", n, !0), t.removeAttribute(cn);
|
|
3101
3115
|
};
|
|
3102
3116
|
}
|
|
3103
|
-
const
|
|
3104
|
-
function
|
|
3117
|
+
const Qf = 400;
|
|
3118
|
+
function Yf(t) {
|
|
3105
3119
|
return t === "leader" || t === "viewer" ? t : null;
|
|
3106
3120
|
}
|
|
3107
|
-
async function
|
|
3121
|
+
async function Xf(t) {
|
|
3108
3122
|
const e = Fs(), n = await fetch(`${e}/api/rooms/validate/${encodeURIComponent(t)}`);
|
|
3109
3123
|
if (n.status === 404) return null;
|
|
3110
3124
|
if (!n.ok) throw new Error(`validate returned ${n.status}`);
|
|
3111
3125
|
const a = await n.json();
|
|
3112
|
-
return
|
|
3126
|
+
return Yf(a?.type);
|
|
3113
3127
|
}
|
|
3114
|
-
async function
|
|
3128
|
+
async function Zf(t) {
|
|
3115
3129
|
for (let e = 0; e < 2; e++)
|
|
3116
3130
|
try {
|
|
3117
|
-
const n = await
|
|
3118
|
-
|
|
3131
|
+
const n = await Xf(t);
|
|
3132
|
+
k.getState().setRoomKeyType({ roomKey: t, type: n }), T("room", "Room key type probed", { roomKey: t, type: n });
|
|
3119
3133
|
return;
|
|
3120
3134
|
} catch (n) {
|
|
3121
3135
|
if (e === 0) {
|
|
3122
|
-
await new Promise((a) => setTimeout(a,
|
|
3136
|
+
await new Promise((a) => setTimeout(a, Qf));
|
|
3123
3137
|
continue;
|
|
3124
3138
|
}
|
|
3125
3139
|
N("room", "Room key type probe failed, falling back to socket truth", Z(n));
|
|
3126
3140
|
}
|
|
3127
3141
|
}
|
|
3128
3142
|
function Oe(t, e) {
|
|
3129
|
-
const a =
|
|
3130
|
-
return
|
|
3143
|
+
const a = k.getState().allocateClientSeq(), s = { kind: t, client_seq: a, ...e || {} };
|
|
3144
|
+
return Ua().emit(za.CONTROL, s), a;
|
|
3131
3145
|
}
|
|
3132
|
-
function
|
|
3146
|
+
function Hc(t) {
|
|
3133
3147
|
return Oe("load", { media_id: t });
|
|
3134
3148
|
}
|
|
3135
|
-
function
|
|
3149
|
+
function el() {
|
|
3136
3150
|
return Oe("home");
|
|
3137
3151
|
}
|
|
3138
|
-
function
|
|
3139
|
-
const t =
|
|
3152
|
+
function tl() {
|
|
3153
|
+
const t = rf(), e = Rr(), n = st(), a = Lr(), s = n && a && !e.ready, r = !e.ready && !s;
|
|
3140
3154
|
return /* @__PURE__ */ c(
|
|
3141
3155
|
"button",
|
|
3142
3156
|
{
|
|
@@ -3161,9 +3175,9 @@ function el() {
|
|
|
3161
3175
|
}
|
|
3162
3176
|
);
|
|
3163
3177
|
}
|
|
3164
|
-
function
|
|
3178
|
+
function nl() {
|
|
3165
3179
|
function t() {
|
|
3166
|
-
T("controls", "Unload episode clicked"),
|
|
3180
|
+
T("controls", "Unload episode clicked"), el();
|
|
3167
3181
|
}
|
|
3168
3182
|
return /* @__PURE__ */ c(
|
|
3169
3183
|
"button",
|
|
@@ -3177,31 +3191,31 @@ function tl() {
|
|
|
3177
3191
|
}
|
|
3178
3192
|
);
|
|
3179
3193
|
}
|
|
3180
|
-
function
|
|
3194
|
+
function al(t) {
|
|
3181
3195
|
return !t.isLeader || t.durationMs === 0 ? !0 : !t.ready && !t.canOverride;
|
|
3182
3196
|
}
|
|
3183
|
-
function
|
|
3197
|
+
function rl(t) {
|
|
3184
3198
|
return t.localValue !== null ? t.localValue : t.displayPlayheadMs ?? t.snapshotPlayheadMs;
|
|
3185
3199
|
}
|
|
3186
|
-
function
|
|
3200
|
+
function sl(t, e) {
|
|
3187
3201
|
return e <= 0 ? 0 : t / e;
|
|
3188
3202
|
}
|
|
3189
|
-
const
|
|
3190
|
-
function
|
|
3203
|
+
const pa = 1e4, ba = 6e4;
|
|
3204
|
+
function il(t, e, n) {
|
|
3191
3205
|
if (n <= 0) return null;
|
|
3192
3206
|
let a;
|
|
3193
3207
|
switch (t) {
|
|
3194
3208
|
case "ArrowLeft":
|
|
3195
|
-
a = e -
|
|
3209
|
+
a = e - pa;
|
|
3196
3210
|
break;
|
|
3197
3211
|
case "ArrowRight":
|
|
3198
|
-
a = e +
|
|
3212
|
+
a = e + pa;
|
|
3199
3213
|
break;
|
|
3200
3214
|
case "PageDown":
|
|
3201
|
-
a = e -
|
|
3215
|
+
a = e - ba;
|
|
3202
3216
|
break;
|
|
3203
3217
|
case "PageUp":
|
|
3204
|
-
a = e +
|
|
3218
|
+
a = e + ba;
|
|
3205
3219
|
break;
|
|
3206
3220
|
case "Home":
|
|
3207
3221
|
a = 0;
|
|
@@ -3214,28 +3228,28 @@ function sl(t, e, n) {
|
|
|
3214
3228
|
}
|
|
3215
3229
|
return Math.round(Math.min(n, Math.max(0, a)));
|
|
3216
3230
|
}
|
|
3217
|
-
const
|
|
3231
|
+
const ol = 600;
|
|
3218
3232
|
function dn(t) {
|
|
3219
3233
|
const e = Math.floor(t / 1e3), n = Math.floor(e / 3600), a = Math.floor(e % 3600 / 60), s = e % 60;
|
|
3220
3234
|
return n > 0 ? `${n}:${a.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}` : `${a}:${s.toString().padStart(2, "0")}`;
|
|
3221
3235
|
}
|
|
3222
|
-
function
|
|
3223
|
-
const n =
|
|
3236
|
+
function fl({ durationMs: t, displayPlayheadMs: e }) {
|
|
3237
|
+
const n = k(($) => $.snapshot), a = k(($) => $.readiness), s = st(), r = Lr(), i = s && r && !a.ready, f = D(null), [o, l] = L(null), [d, u] = L(0), [m, y] = L(!1), [b, g] = L(null), h = D(0), [p, _] = L(n.mediaId);
|
|
3224
3238
|
p !== n.mediaId && (_(n.mediaId), g(null), y(!1));
|
|
3225
|
-
const
|
|
3226
|
-
!m && b !== null && Math.abs(
|
|
3227
|
-
const M = t || 0, w =
|
|
3239
|
+
const C = e ?? n.playheadMs;
|
|
3240
|
+
!m && b !== null && Math.abs(C - b) < Oa && g(null);
|
|
3241
|
+
const M = t || 0, w = rl({ localValue: b, displayPlayheadMs: e, snapshotPlayheadMs: n.playheadMs }), S = D(0);
|
|
3228
3242
|
R(() => {
|
|
3229
3243
|
if (m || b === null) return;
|
|
3230
|
-
const $ = 1e4 - (Date.now() -
|
|
3244
|
+
const $ = 1e4 - (Date.now() - S.current), B = setTimeout(() => {
|
|
3231
3245
|
N("seek", "SeekBar local override timed out — seek never completed", {
|
|
3232
3246
|
target: Math.round(b),
|
|
3233
|
-
actual: Math.round(
|
|
3234
|
-
delta: Math.round(Math.abs(
|
|
3247
|
+
actual: Math.round(C),
|
|
3248
|
+
delta: Math.round(Math.abs(C - b))
|
|
3235
3249
|
}), g(null);
|
|
3236
3250
|
}, Math.max(0, $));
|
|
3237
3251
|
return () => clearTimeout(B);
|
|
3238
|
-
}, [
|
|
3252
|
+
}, [C, m, b]);
|
|
3239
3253
|
const F = j(($) => {
|
|
3240
3254
|
const B = $.currentTarget.getBoundingClientRect(), O = $.clientX - B.left, z = O / B.width, K = Math.round(z * M);
|
|
3241
3255
|
l(O), u(Math.max(0, Math.min(K, M)));
|
|
@@ -3245,12 +3259,12 @@ function ol({ durationMs: t, displayPlayheadMs: e }) {
|
|
|
3245
3259
|
R(() => () => {
|
|
3246
3260
|
v.current && clearTimeout(v.current);
|
|
3247
3261
|
}, []);
|
|
3248
|
-
const
|
|
3262
|
+
const I = j(($) => {
|
|
3249
3263
|
if ($.defaultPrevented) return;
|
|
3250
|
-
const B =
|
|
3251
|
-
B !== null && ($.preventDefault(), g(B),
|
|
3264
|
+
const B = il($.key, w, M);
|
|
3265
|
+
B !== null && ($.preventDefault(), g(B), S.current = Date.now(), v.current && clearTimeout(v.current), v.current = setTimeout(() => {
|
|
3252
3266
|
v.current = null, T("seek", "Keyboard seek", { to_ms: B }), Oe("seek", { to_ms: B }), h.current = B;
|
|
3253
|
-
},
|
|
3267
|
+
}, ol));
|
|
3254
3268
|
}, [w, M]);
|
|
3255
3269
|
return /* @__PURE__ */ x("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
3256
3270
|
/* @__PURE__ */ c("span", { className: "text-[11px] font-mono text-text-secondary w-[45px] text-right shrink-0", children: dn(w) }),
|
|
@@ -3262,11 +3276,11 @@ function ol({ durationMs: t, displayPlayheadMs: e }) {
|
|
|
3262
3276
|
min: 0,
|
|
3263
3277
|
max: M,
|
|
3264
3278
|
value: w,
|
|
3265
|
-
disabled:
|
|
3266
|
-
style: { "--progress": `${
|
|
3279
|
+
disabled: al({ isLeader: s, ready: a.ready, canOverride: i, durationMs: M }),
|
|
3280
|
+
style: { "--progress": `${sl(w, M) * 100}%` },
|
|
3267
3281
|
onChange: ($) => {
|
|
3268
3282
|
const B = Number($.target.value);
|
|
3269
|
-
g(B),
|
|
3283
|
+
g(B), S.current = Date.now();
|
|
3270
3284
|
},
|
|
3271
3285
|
onMouseDown: () => {
|
|
3272
3286
|
y(!0), h.current = e ?? n.playheadMs;
|
|
@@ -3274,7 +3288,7 @@ function ol({ durationMs: t, displayPlayheadMs: e }) {
|
|
|
3274
3288
|
onMouseUp: () => {
|
|
3275
3289
|
y(!1), b !== null && b !== h.current && (T("seek", "Final seek on mouseup", { to_ms: b }), Oe("seek", { to_ms: b }), h.current = b);
|
|
3276
3290
|
},
|
|
3277
|
-
onKeyDown:
|
|
3291
|
+
onKeyDown: I,
|
|
3278
3292
|
onMouseMove: F,
|
|
3279
3293
|
onMouseLeave: () => {
|
|
3280
3294
|
E(), m && b !== null && b !== h.current && (y(!1), T("seek", "Final seek on mouseleave-while-dragging", { to_ms: b }), Oe("seek", { to_ms: b }), h.current = b);
|
|
@@ -3296,8 +3310,8 @@ function ol({ durationMs: t, displayPlayheadMs: e }) {
|
|
|
3296
3310
|
/* @__PURE__ */ c("span", { className: "text-[11px] font-mono text-text-muted w-[45px] text-left shrink-0", children: dn(M) })
|
|
3297
3311
|
] });
|
|
3298
3312
|
}
|
|
3299
|
-
function
|
|
3300
|
-
const e =
|
|
3313
|
+
function ll({ videoRef: t }) {
|
|
3314
|
+
const e = k((d) => d.mediaPrefs.volume), n = k((d) => d.mediaPrefs.muted), a = k((d) => d.setVolume), s = k((d) => d.setMuted);
|
|
3301
3315
|
R(() => {
|
|
3302
3316
|
const d = t.current;
|
|
3303
3317
|
d && (d.volume = e, d.muted = n);
|
|
@@ -3340,7 +3354,7 @@ function fl({ videoRef: t }) {
|
|
|
3340
3354
|
] })
|
|
3341
3355
|
] });
|
|
3342
3356
|
}
|
|
3343
|
-
function
|
|
3357
|
+
function On({
|
|
3344
3358
|
ariaLabel: t,
|
|
3345
3359
|
title: e,
|
|
3346
3360
|
options: n,
|
|
@@ -3351,20 +3365,20 @@ function Bn({
|
|
|
3351
3365
|
width: f = 200,
|
|
3352
3366
|
testId: o
|
|
3353
3367
|
}) {
|
|
3354
|
-
const [l, d] = L(!1), [u, m] = L(0), [y, b] = L(null), g = D(null), h = Wt(), p = Math.max(0, n.findIndex((
|
|
3355
|
-
d(
|
|
3368
|
+
const [l, d] = L(!1), [u, m] = L(0), [y, b] = L(null), g = D(null), h = Wt(), p = Math.max(0, n.findIndex((S) => S.value === a)), _ = (S) => {
|
|
3369
|
+
d(S), i?.(S), S && m(p);
|
|
3356
3370
|
};
|
|
3357
3371
|
R(() => () => i?.(!1), [i]), R(() => {
|
|
3358
3372
|
l && g.current?.querySelector(`[data-index="${u}"]`)?.focus({ preventScroll: !1 });
|
|
3359
3373
|
}, [l, u]);
|
|
3360
|
-
const
|
|
3361
|
-
const F = n[
|
|
3374
|
+
const C = (S) => {
|
|
3375
|
+
const F = n[S];
|
|
3362
3376
|
_(!1), y?.focus({ preventScroll: !0 }), F && F.value !== a && s(F.value);
|
|
3363
|
-
}, M = (
|
|
3364
|
-
(
|
|
3365
|
-
}, w = (
|
|
3377
|
+
}, M = (S) => {
|
|
3378
|
+
(S.key === "ArrowDown" || S.key === "ArrowUp") && (S.preventDefault(), r || _(!0));
|
|
3379
|
+
}, w = (S) => {
|
|
3366
3380
|
const F = n.length - 1, E = { ArrowDown: 1, ArrowUp: -1 };
|
|
3367
|
-
|
|
3381
|
+
S.key in E ? (S.preventDefault(), m((v) => Math.min(F, Math.max(0, v + E[S.key])))) : S.key === "Home" || S.key === "End" ? (S.preventDefault(), m(S.key === "Home" ? 0 : F)) : S.key === "Enter" || S.key === " " ? (S.preventDefault(), C(u)) : S.key === "Tab" && _(!1);
|
|
3368
3382
|
};
|
|
3369
3383
|
return /* @__PURE__ */ x(pe, { children: [
|
|
3370
3384
|
/* @__PURE__ */ x(
|
|
@@ -3390,7 +3404,7 @@ function Bn({
|
|
|
3390
3404
|
}
|
|
3391
3405
|
),
|
|
3392
3406
|
l && /* @__PURE__ */ c(
|
|
3393
|
-
|
|
3407
|
+
gr,
|
|
3394
3408
|
{
|
|
3395
3409
|
anchor: y,
|
|
3396
3410
|
onClose: () => _(!1),
|
|
@@ -3406,23 +3420,23 @@ function Bn({
|
|
|
3406
3420
|
"aria-label": `${t} options`,
|
|
3407
3421
|
className: "bar-menu-list",
|
|
3408
3422
|
onKeyDown: w,
|
|
3409
|
-
children: n.map((
|
|
3423
|
+
children: n.map((S, F) => /* @__PURE__ */ x(
|
|
3410
3424
|
"div",
|
|
3411
3425
|
{
|
|
3412
3426
|
role: "option",
|
|
3413
|
-
"aria-selected":
|
|
3427
|
+
"aria-selected": S.value === a,
|
|
3414
3428
|
tabIndex: F === u ? 0 : -1,
|
|
3415
3429
|
"data-index": F,
|
|
3416
|
-
"data-value": String(
|
|
3430
|
+
"data-value": String(S.value),
|
|
3417
3431
|
className: "bar-menu-option",
|
|
3418
|
-
onClick: () =>
|
|
3432
|
+
onClick: () => C(F),
|
|
3419
3433
|
onMouseEnter: () => m(F),
|
|
3420
3434
|
children: [
|
|
3421
|
-
/* @__PURE__ */ c("span", { className: "bar-menu-check", "aria-hidden": "true", children:
|
|
3422
|
-
|
|
3435
|
+
/* @__PURE__ */ c("span", { className: "bar-menu-check", "aria-hidden": "true", children: S.value === a ? "•" : "" }),
|
|
3436
|
+
S.render ?? S.label
|
|
3423
3437
|
]
|
|
3424
3438
|
},
|
|
3425
|
-
String(
|
|
3439
|
+
String(S.value)
|
|
3426
3440
|
))
|
|
3427
3441
|
}
|
|
3428
3442
|
)
|
|
@@ -3430,13 +3444,13 @@ function Bn({
|
|
|
3430
3444
|
)
|
|
3431
3445
|
] });
|
|
3432
3446
|
}
|
|
3433
|
-
function
|
|
3447
|
+
function cl({ tracks: t, selectedIndex: e, onSelect: n, onMenuOpen: a }) {
|
|
3434
3448
|
if (t.length === 0) return null;
|
|
3435
3449
|
const s = t.length === 1;
|
|
3436
3450
|
return /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
|
|
3437
3451
|
/* @__PURE__ */ c("span", { className: "text-[10px] opacity-60 uppercase tracking-wide", children: "Audio" }),
|
|
3438
3452
|
/* @__PURE__ */ c(
|
|
3439
|
-
|
|
3453
|
+
On,
|
|
3440
3454
|
{
|
|
3441
3455
|
ariaLabel: "Audio track selection",
|
|
3442
3456
|
title: s ? t[0].label : "Select audio track",
|
|
@@ -3450,7 +3464,7 @@ function ll({ tracks: t, selectedIndex: e, onSelect: n, onMenuOpen: a }) {
|
|
|
3450
3464
|
)
|
|
3451
3465
|
] });
|
|
3452
3466
|
}
|
|
3453
|
-
function
|
|
3467
|
+
function dl({
|
|
3454
3468
|
tracks: t,
|
|
3455
3469
|
selectedIndex: e,
|
|
3456
3470
|
onSelect: n,
|
|
@@ -3470,7 +3484,7 @@ function cl({
|
|
|
3470
3484
|
}
|
|
3471
3485
|
),
|
|
3472
3486
|
/* @__PURE__ */ c(
|
|
3473
|
-
|
|
3487
|
+
On,
|
|
3474
3488
|
{
|
|
3475
3489
|
ariaLabel: "Subtitle language selection",
|
|
3476
3490
|
title: "Select subtitle language",
|
|
@@ -3485,8 +3499,8 @@ function cl({
|
|
|
3485
3499
|
)
|
|
3486
3500
|
] });
|
|
3487
3501
|
}
|
|
3488
|
-
const ut = 3,
|
|
3489
|
-
function
|
|
3502
|
+
const ut = 3, ul = 1e3, hl = 15e3;
|
|
3503
|
+
function Ie(t) {
|
|
3490
3504
|
const e = t?.readyState;
|
|
3491
3505
|
return e === "open" || e === "ended";
|
|
3492
3506
|
}
|
|
@@ -3497,10 +3511,10 @@ const ne = {
|
|
|
3497
3511
|
FALLBACK: 1
|
|
3498
3512
|
}, un = 0.5, hn = 3e3;
|
|
3499
3513
|
function At(t, e = {}) {
|
|
3500
|
-
const { baseMs: n =
|
|
3514
|
+
const { baseMs: n = ul, capMs: a = hl, jitter: s = 0.25 } = e, r = Math.min(n * Math.pow(2, t - 1), a), i = s > 0 ? Math.round(r * Math.random() * s) : 0;
|
|
3501
3515
|
return r + i;
|
|
3502
3516
|
}
|
|
3503
|
-
const
|
|
3517
|
+
const ya = 15, gl = 35e3, ml = 2e3, gn = 10;
|
|
3504
3518
|
function Pe(t, e) {
|
|
3505
3519
|
if (t.length === 0) return 0;
|
|
3506
3520
|
if (e >= t[t.length - 1].end_ms) return t.length - 1;
|
|
@@ -3511,7 +3525,7 @@ function Pe(t, e) {
|
|
|
3511
3525
|
}
|
|
3512
3526
|
return n;
|
|
3513
3527
|
}
|
|
3514
|
-
function
|
|
3528
|
+
function jn(t, e) {
|
|
3515
3529
|
const n = Pe(t, e);
|
|
3516
3530
|
if (t.length === 0 || t[0].keyframe === void 0) return n;
|
|
3517
3531
|
for (let a = n; a >= 0; a--)
|
|
@@ -3534,23 +3548,23 @@ function mn(t, e, n, a = ne.RANGE) {
|
|
|
3534
3548
|
function Se(t) {
|
|
3535
3549
|
return t ? Array.from({ length: t.length }, (e, n) => `${t.start(n).toFixed(2)}-${t.end(n).toFixed(2)}`) : [];
|
|
3536
3550
|
}
|
|
3537
|
-
function
|
|
3551
|
+
function pl(t) {
|
|
3538
3552
|
if (t.length === 0) return 0;
|
|
3539
3553
|
const e = t.reduce((a, s) => a + s.bytes, 0), n = t.reduce((a, s) => a + s.durationMs, 0);
|
|
3540
3554
|
return n === 0 ? 0 : e / n * 1e3;
|
|
3541
3555
|
}
|
|
3542
|
-
const
|
|
3556
|
+
const bl = 8e5, yl = 4;
|
|
3543
3557
|
function Et(t) {
|
|
3544
3558
|
if (t === 0) return 6e4;
|
|
3545
|
-
const e =
|
|
3559
|
+
const e = bl / t * 1e3 * yl;
|
|
3546
3560
|
return Math.max(3e4, Math.min(12e4, Math.round(e)));
|
|
3547
3561
|
}
|
|
3548
|
-
function
|
|
3562
|
+
function wa(t, e) {
|
|
3549
3563
|
for (let n = e; n >= 0; n--)
|
|
3550
3564
|
if (t[n]?.keyframe) return n;
|
|
3551
3565
|
return -1;
|
|
3552
3566
|
}
|
|
3553
|
-
function
|
|
3567
|
+
function wl(t, e, n, a) {
|
|
3554
3568
|
const s = t * 1e3 - 100, r = e * 1e3 + 100;
|
|
3555
3569
|
for (const i of a) {
|
|
3556
3570
|
const f = n[i];
|
|
@@ -3559,7 +3573,7 @@ function yl(t, e, n, a) {
|
|
|
3559
3573
|
}
|
|
3560
3574
|
return !1;
|
|
3561
3575
|
}
|
|
3562
|
-
function
|
|
3576
|
+
function _l(t) {
|
|
3563
3577
|
const e = [], n = t.replace(/\r\n/g, `
|
|
3564
3578
|
`).split(`
|
|
3565
3579
|
`);
|
|
@@ -3569,7 +3583,7 @@ function wl(t) {
|
|
|
3569
3583
|
for (; a < n.length; ) {
|
|
3570
3584
|
const s = n[a].trim();
|
|
3571
3585
|
if (s.includes("-->")) {
|
|
3572
|
-
const r = s.split("-->"), i =
|
|
3586
|
+
const r = s.split("-->"), i = _a(r[0].trim()), f = r[1].trim().split(/\s+/), o = _a(f[0]);
|
|
3573
3587
|
let l, d, u;
|
|
3574
3588
|
for (let y = 1; y < f.length; y++) {
|
|
3575
3589
|
const b = f[y];
|
|
@@ -3608,13 +3622,13 @@ function wl(t) {
|
|
|
3608
3622
|
}
|
|
3609
3623
|
return e;
|
|
3610
3624
|
}
|
|
3611
|
-
function
|
|
3625
|
+
function _a(t) {
|
|
3612
3626
|
const e = t.split(":");
|
|
3613
3627
|
if (e.length < 2) return null;
|
|
3614
3628
|
let n = 0, a, s;
|
|
3615
3629
|
return e.length === 3 ? (n = parseInt(e[0], 10), a = parseInt(e[1], 10), s = parseFloat(e[2])) : (a = parseInt(e[0], 10), s = parseFloat(e[1])), isNaN(n) || isNaN(a) || isNaN(s) ? null : n * 3600 + a * 60 + s;
|
|
3616
3630
|
}
|
|
3617
|
-
function
|
|
3631
|
+
function vl(t) {
|
|
3618
3632
|
return t.replace(/<\/?[^>]+(>|$)/g, "").replace(/\{[^}]+\}/g, "").replace(/\\N/g, " ").replace(/\s*\n\s*/g, " ").replace(/\s{2,}/g, " ").trim();
|
|
3619
3633
|
}
|
|
3620
3634
|
const Hr = {
|
|
@@ -3627,28 +3641,28 @@ const Hr = {
|
|
|
3627
3641
|
// Accessibility-focused: bold white text on solid black box
|
|
3628
3642
|
contrast: "text-white font-bold bg-black px-3 py-1"
|
|
3629
3643
|
};
|
|
3630
|
-
function
|
|
3644
|
+
function kl({ subtitleUrl: t, videoRef: e, style: n, enabled: a }) {
|
|
3631
3645
|
const [s, r] = L([]), [i, f] = L([]), o = D(null), [l, d] = L(40), [u, m] = L(18), [y, b] = L(t);
|
|
3632
3646
|
y !== t && (b(t), t || r([])), R(() => {
|
|
3633
3647
|
if (!t) return;
|
|
3634
3648
|
let w = !1;
|
|
3635
|
-
const
|
|
3649
|
+
const S = 2;
|
|
3636
3650
|
return (async () => {
|
|
3637
|
-
for (let F = 0; F <=
|
|
3651
|
+
for (let F = 0; F <= S; F++) {
|
|
3638
3652
|
if (w) return;
|
|
3639
3653
|
try {
|
|
3640
3654
|
const E = await fetch(t);
|
|
3641
3655
|
if (!E.ok) throw new Error(`Failed to fetch subtitles (status ${E.status})`);
|
|
3642
3656
|
const v = await E.text();
|
|
3643
3657
|
if (w) return;
|
|
3644
|
-
const
|
|
3645
|
-
r(
|
|
3658
|
+
const I = _l(v);
|
|
3659
|
+
r(I);
|
|
3646
3660
|
return;
|
|
3647
3661
|
} catch (E) {
|
|
3648
3662
|
if (w) return;
|
|
3649
|
-
if (F <
|
|
3663
|
+
if (F < S) {
|
|
3650
3664
|
const v = At(F + 1, { baseMs: 1e3, capMs: 2e3, jitter: 0 });
|
|
3651
|
-
N("subtitles", `Fetch failed, retrying in ${v}ms (attempt ${F + 1}/${
|
|
3665
|
+
N("subtitles", `Fetch failed, retrying in ${v}ms (attempt ${F + 1}/${S + 1})`, { error: E?.message }), await new Promise((I) => setTimeout(I, v));
|
|
3652
3666
|
} else
|
|
3653
3667
|
N("subtitles", "All fetch attempts failed", { error: E?.message }), r([]);
|
|
3654
3668
|
}
|
|
@@ -3663,25 +3677,25 @@ function vl({ subtitleUrl: t, videoRef: e, style: n, enabled: a }) {
|
|
|
3663
3677
|
f([]);
|
|
3664
3678
|
return;
|
|
3665
3679
|
}
|
|
3666
|
-
const
|
|
3667
|
-
(E) =>
|
|
3680
|
+
const S = w.currentTime, F = s.filter(
|
|
3681
|
+
(E) => S >= E.startTime && S < E.endTime
|
|
3668
3682
|
);
|
|
3669
3683
|
f(F);
|
|
3670
3684
|
}, [e, a, s]);
|
|
3671
3685
|
R(() => {
|
|
3672
3686
|
const w = e.current;
|
|
3673
3687
|
if (!w) return;
|
|
3674
|
-
const
|
|
3675
|
-
return w.addEventListener("timeupdate",
|
|
3676
|
-
w.removeEventListener("timeupdate",
|
|
3688
|
+
const S = () => g();
|
|
3689
|
+
return w.addEventListener("timeupdate", S), w.addEventListener("seeked", S), () => {
|
|
3690
|
+
w.removeEventListener("timeupdate", S), w.removeEventListener("seeked", S);
|
|
3677
3691
|
};
|
|
3678
3692
|
}, [e, g]);
|
|
3679
3693
|
const h = i.length > 0;
|
|
3680
3694
|
if (R(() => {
|
|
3681
|
-
const w = e.current,
|
|
3682
|
-
if (!w || !
|
|
3695
|
+
const w = e.current, S = o.current?.parentElement;
|
|
3696
|
+
if (!w || !S) return;
|
|
3683
3697
|
const F = () => {
|
|
3684
|
-
const E =
|
|
3698
|
+
const E = S.clientHeight, v = S.clientWidth, I = w.videoWidth || 1920, $ = w.videoHeight || 1080, B = Math.min(v / I, E / $), O = $ * B, z = (E - O) / 2, K = Math.max(16, O * 0.035), le = Math.max(K * 0.8, O * 0.055);
|
|
3685
3699
|
d(Math.max(z + le, 40)), m(K);
|
|
3686
3700
|
};
|
|
3687
3701
|
return F(), window.addEventListener("resize", F), w.addEventListener("loadedmetadata", F), () => {
|
|
@@ -3690,9 +3704,9 @@ function vl({ subtitleUrl: t, videoRef: e, style: n, enabled: a }) {
|
|
|
3690
3704
|
}, [e, h]), !a || i.length === 0)
|
|
3691
3705
|
return null;
|
|
3692
3706
|
function p(w) {
|
|
3693
|
-
const
|
|
3707
|
+
const S = w.linePercent !== void 0 && w.linePercent <= 0.5;
|
|
3694
3708
|
let F = "c";
|
|
3695
|
-
return w.align === "start" ? F = "l" : w.align === "end" ? F = "r" : w.positionPercent !== void 0 && (w.positionPercent < 0.3 ? F = "l" : w.positionPercent > 0.7 && (F = "r")), (
|
|
3709
|
+
return w.align === "start" ? F = "l" : w.align === "end" ? F = "r" : w.positionPercent !== void 0 && (w.positionPercent < 0.3 ? F = "l" : w.positionPercent > 0.7 && (F = "r")), (S ? "t" : "b") + F;
|
|
3696
3710
|
}
|
|
3697
3711
|
const _ = {
|
|
3698
3712
|
tl: [],
|
|
@@ -3703,36 +3717,36 @@ function vl({ subtitleUrl: t, videoRef: e, style: n, enabled: a }) {
|
|
|
3703
3717
|
br: []
|
|
3704
3718
|
};
|
|
3705
3719
|
for (const w of i) _[p(w)].push(w);
|
|
3706
|
-
const
|
|
3720
|
+
const C = (w, S, F) => w.map((E) => /* @__PURE__ */ c(
|
|
3707
3721
|
"div",
|
|
3708
3722
|
{
|
|
3709
|
-
className: `flex flex-col ${
|
|
3723
|
+
className: `flex flex-col ${S} w-full`,
|
|
3710
3724
|
style: { fontSize: u + "px" },
|
|
3711
3725
|
children: /* @__PURE__ */ c(
|
|
3712
3726
|
"div",
|
|
3713
3727
|
{
|
|
3714
3728
|
className: `${F} font-medium max-w-[95%] inline-block antialiased ${Hr[n]}`,
|
|
3715
|
-
children:
|
|
3729
|
+
children: vl(E.text)
|
|
3716
3730
|
}
|
|
3717
3731
|
)
|
|
3718
3732
|
},
|
|
3719
3733
|
E.id
|
|
3720
|
-
)), M = (w,
|
|
3734
|
+
)), M = (w, S, F, E, v) => /* @__PURE__ */ x(pe, { children: [
|
|
3721
3735
|
w.length > 0 && /* @__PURE__ */ c(
|
|
3722
3736
|
"div",
|
|
3723
3737
|
{
|
|
3724
3738
|
className: "absolute left-0 flex flex-col items-start gap-2 pointer-events-none z-10 px-3 max-w-[35%]",
|
|
3725
3739
|
style: E,
|
|
3726
|
-
children:
|
|
3740
|
+
children: C(w, "items-start", "text-left")
|
|
3727
3741
|
}
|
|
3728
3742
|
),
|
|
3729
|
-
|
|
3743
|
+
S.length > 0 && /* @__PURE__ */ c(
|
|
3730
3744
|
"div",
|
|
3731
3745
|
{
|
|
3732
3746
|
ref: v,
|
|
3733
3747
|
className: "absolute left-0 right-0 flex flex-col items-center gap-2 pointer-events-none z-10",
|
|
3734
3748
|
style: E,
|
|
3735
|
-
children:
|
|
3749
|
+
children: C(S, "items-center", "text-center")
|
|
3736
3750
|
}
|
|
3737
3751
|
),
|
|
3738
3752
|
F.length > 0 && /* @__PURE__ */ c(
|
|
@@ -3740,7 +3754,7 @@ function vl({ subtitleUrl: t, videoRef: e, style: n, enabled: a }) {
|
|
|
3740
3754
|
{
|
|
3741
3755
|
className: "absolute right-0 flex flex-col items-end gap-2 pointer-events-none z-10 px-3 max-w-[35%]",
|
|
3742
3756
|
style: E,
|
|
3743
|
-
children:
|
|
3757
|
+
children: C(F, "items-end", "text-right")
|
|
3744
3758
|
}
|
|
3745
3759
|
)
|
|
3746
3760
|
] });
|
|
@@ -3749,21 +3763,21 @@ function vl({ subtitleUrl: t, videoRef: e, style: n, enabled: a }) {
|
|
|
3749
3763
|
M(_.bl, _.bc, _.br, { bottom: `${l}px` }, o)
|
|
3750
3764
|
] });
|
|
3751
3765
|
}
|
|
3752
|
-
const
|
|
3766
|
+
const Sl = [
|
|
3753
3767
|
{ value: "classic", label: "Classic" },
|
|
3754
3768
|
{ value: "cinema", label: "Cinema" },
|
|
3755
3769
|
{ value: "minimal", label: "Minimal" },
|
|
3756
3770
|
{ value: "contrast", label: "High Contrast" }
|
|
3757
3771
|
];
|
|
3758
|
-
function
|
|
3772
|
+
function xl({ style: t, onStyleChange: e, enabled: n, onMenuOpen: a }) {
|
|
3759
3773
|
return n ? /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
|
|
3760
3774
|
/* @__PURE__ */ c("span", { className: "text-[10px] opacity-60 uppercase tracking-wide", children: "Style" }),
|
|
3761
3775
|
/* @__PURE__ */ c(
|
|
3762
|
-
|
|
3776
|
+
On,
|
|
3763
3777
|
{
|
|
3764
3778
|
ariaLabel: "Subtitle style selection",
|
|
3765
3779
|
title: "Select subtitle style",
|
|
3766
|
-
options:
|
|
3780
|
+
options: Sl.map((s) => ({
|
|
3767
3781
|
...s,
|
|
3768
3782
|
render: /* @__PURE__ */ c("span", { className: "subtitle-style-preview", "data-style": s.value, children: /* @__PURE__ */ c("span", { className: `font-medium text-[15px] leading-tight inline-block antialiased ${Hr[s.value]}`, children: s.label }) })
|
|
3769
3783
|
})),
|
|
@@ -3775,7 +3789,7 @@ function Sl({ style: t, onStyleChange: e, enabled: n, onMenuOpen: a }) {
|
|
|
3775
3789
|
)
|
|
3776
3790
|
] }) : null;
|
|
3777
3791
|
}
|
|
3778
|
-
function
|
|
3792
|
+
function El({ videoRef: t }) {
|
|
3779
3793
|
const [e, n] = L(!1);
|
|
3780
3794
|
R(() => {
|
|
3781
3795
|
const s = () => {
|
|
@@ -3809,7 +3823,7 @@ function xl({ videoRef: t }) {
|
|
|
3809
3823
|
}
|
|
3810
3824
|
);
|
|
3811
3825
|
}
|
|
3812
|
-
function
|
|
3826
|
+
function Ml({
|
|
3813
3827
|
videoRef: t,
|
|
3814
3828
|
mediaId: e,
|
|
3815
3829
|
durationMs: n,
|
|
@@ -3828,15 +3842,15 @@ function El({
|
|
|
3828
3842
|
onChatActivity: g,
|
|
3829
3843
|
onMenuHeld: h
|
|
3830
3844
|
}) {
|
|
3831
|
-
const p = st(), _ =
|
|
3845
|
+
const p = st(), _ = k((U) => U.chatCollapsed), C = Ft(), M = Bn(), w = Qt() !== null, S = Rn({
|
|
3832
3846
|
isLeader: M,
|
|
3833
3847
|
hasMedia: !0,
|
|
3834
3848
|
chatCollapsed: _,
|
|
3835
|
-
isFullscreen:
|
|
3849
|
+
isFullscreen: C,
|
|
3836
3850
|
gameOverlay: w
|
|
3837
|
-
}) === "control-bar", F =
|
|
3838
|
-
|
|
3839
|
-
}, []), [z, K] = L(!1), [le, V] = L(!1), [X, W] = L(""), [he, ee] = L(!1), Q =
|
|
3851
|
+
}) === "control-bar", F = nr({ hasMedia: !0, isFullscreen: C, gameOverlay: w }) === "control-bar", E = k((U) => U.floatingChatEnabled), v = D(null), I = D(null), [$, B] = L(null), O = j((U) => {
|
|
3852
|
+
I.current = U, B(U);
|
|
3853
|
+
}, []), [z, K] = L(!1), [le, V] = L(!1), [X, W] = L(""), [he, ee] = L(!1), Q = xr(), [P, te] = L(!1), [Ae, Ke] = L(!1), [Dt, _t] = L(null), Re = Er(), ge = kr(X, W, I), Ee = Wt(), it = k((U) => U.replyingTo), ot = k((U) => U.setReplyingTo), Ve = D(/* @__PURE__ */ new Set()), Me = j((U, se) => {
|
|
3840
3854
|
const we = Ve.current.size > 0;
|
|
3841
3855
|
se ? Ve.current.add(U) : Ve.current.delete(U);
|
|
3842
3856
|
const ft = Ve.current.size > 0;
|
|
@@ -3848,7 +3862,7 @@ function El({
|
|
|
3848
3862
|
const se = X.trim();
|
|
3849
3863
|
if (!se && !Q.pending.length || he || Q.uploading) return;
|
|
3850
3864
|
const we = await Q.uploadPending();
|
|
3851
|
-
we !== null && (
|
|
3865
|
+
we !== null && (Fa(vr(se), we, it), W(""), Re.stop(), ot(null), Q.clear(), ee(!0), setTimeout(() => ee(!1), $a), !document.hidden && document.hasFocus() && I.current?.focus());
|
|
3852
3866
|
}, [X, he, Q, Re, it, ot, ge]);
|
|
3853
3867
|
R(() => () => {
|
|
3854
3868
|
Ve.current.clear(), h?.(!1);
|
|
@@ -3882,18 +3896,18 @@ function El({
|
|
|
3882
3896
|
return /* @__PURE__ */ x("div", { className: `ctr-bar-wrapper ${Je ? "show" : ""}`, children: [
|
|
3883
3897
|
/* @__PURE__ */ x("div", { ref: v, className: en, children: [
|
|
3884
3898
|
p && /* @__PURE__ */ x("div", { className: "cluster", children: [
|
|
3885
|
-
/* @__PURE__ */ c(
|
|
3886
|
-
|
|
3887
|
-
/* @__PURE__ */ c(
|
|
3899
|
+
/* @__PURE__ */ c(tl, {}),
|
|
3900
|
+
S && /* @__PURE__ */ c(Br, {}),
|
|
3901
|
+
/* @__PURE__ */ c(nl, {})
|
|
3888
3902
|
] }),
|
|
3889
|
-
/* @__PURE__ */ c("div", { className: "cluster-seek", children: /* @__PURE__ */ c(
|
|
3903
|
+
/* @__PURE__ */ c("div", { className: "cluster-seek", children: /* @__PURE__ */ c(fl, { durationMs: n, displayPlayheadMs: b }) }),
|
|
3890
3904
|
/* @__PURE__ */ x("div", { className: "cluster", children: [
|
|
3891
|
-
/* @__PURE__ */ c(
|
|
3905
|
+
/* @__PURE__ */ c(ll, { videoRef: t }),
|
|
3892
3906
|
s.length > 1 && /* @__PURE__ */ x(pe, { children: [
|
|
3893
3907
|
/* @__PURE__ */ c("div", { className: "w-px h-5 bg-white/20" }),
|
|
3894
3908
|
" ",
|
|
3895
3909
|
/* @__PURE__ */ c(
|
|
3896
|
-
|
|
3910
|
+
cl,
|
|
3897
3911
|
{
|
|
3898
3912
|
tracks: s,
|
|
3899
3913
|
selectedIndex: r,
|
|
@@ -3905,7 +3919,7 @@ function El({
|
|
|
3905
3919
|
] }),
|
|
3906
3920
|
f.length > 0 && /* @__PURE__ */ x("div", { className: "cluster", children: [
|
|
3907
3921
|
/* @__PURE__ */ c(
|
|
3908
|
-
|
|
3922
|
+
dl,
|
|
3909
3923
|
{
|
|
3910
3924
|
tracks: f,
|
|
3911
3925
|
selectedIndex: o,
|
|
@@ -3916,7 +3930,7 @@ function El({
|
|
|
3916
3930
|
}
|
|
3917
3931
|
),
|
|
3918
3932
|
/* @__PURE__ */ c(
|
|
3919
|
-
|
|
3933
|
+
xl,
|
|
3920
3934
|
{
|
|
3921
3935
|
style: m,
|
|
3922
3936
|
onStyleChange: y,
|
|
@@ -3933,9 +3947,9 @@ function El({
|
|
|
3933
3947
|
onDrop: Q.onDrop,
|
|
3934
3948
|
onDragOver: Q.onDragOver,
|
|
3935
3949
|
children: [
|
|
3936
|
-
/* @__PURE__ */ c(
|
|
3937
|
-
P && /* @__PURE__ */ c(
|
|
3938
|
-
|
|
3950
|
+
/* @__PURE__ */ c(Sr, { pending: Q.pending, uploading: Q.uploading, onRemove: Q.remove }),
|
|
3951
|
+
P && /* @__PURE__ */ c(ta, { anchor: Dt, width: 340, children: /* @__PURE__ */ c(
|
|
3952
|
+
Za,
|
|
3939
3953
|
{
|
|
3940
3954
|
open: !0,
|
|
3941
3955
|
toggle: Dt,
|
|
@@ -3946,8 +3960,8 @@ function El({
|
|
|
3946
3960
|
}
|
|
3947
3961
|
}
|
|
3948
3962
|
) }),
|
|
3949
|
-
ge.open && /* @__PURE__ */ c(
|
|
3950
|
-
|
|
3963
|
+
ge.open && /* @__PURE__ */ c(ta, { anchor: $, width: 260, children: /* @__PURE__ */ c(
|
|
3964
|
+
_r,
|
|
3951
3965
|
{
|
|
3952
3966
|
matches: ge.matches,
|
|
3953
3967
|
activeIndex: ge.activeIndex,
|
|
@@ -3963,7 +3977,7 @@ function El({
|
|
|
3963
3977
|
type: "text",
|
|
3964
3978
|
value: X,
|
|
3965
3979
|
onChange: (U) => {
|
|
3966
|
-
const se = U.target.value.slice(0,
|
|
3980
|
+
const se = U.target.value.slice(0, Da);
|
|
3967
3981
|
W(se), ge.trackCaret(U.target), Re.input(se), g?.();
|
|
3968
3982
|
},
|
|
3969
3983
|
onKeyDown: (U) => {
|
|
@@ -3998,7 +4012,7 @@ function El({
|
|
|
3998
4012
|
),
|
|
3999
4013
|
/* @__PURE__ */ x("div", { className: "cluster cluster-tight", children: [
|
|
4000
4014
|
F && /* @__PURE__ */ c(Or, { className: "ctr-btn" }),
|
|
4001
|
-
/* @__PURE__ */ c(
|
|
4015
|
+
/* @__PURE__ */ c(El, { videoRef: t })
|
|
4002
4016
|
] })
|
|
4003
4017
|
] }),
|
|
4004
4018
|
tn && /* @__PURE__ */ x("div", { className: "ctr-scroll-group", children: [
|
|
@@ -4009,7 +4023,7 @@ function El({
|
|
|
4009
4023
|
onClick: () => vt("left"),
|
|
4010
4024
|
tabIndex: -1,
|
|
4011
4025
|
"aria-label": "Scroll left",
|
|
4012
|
-
children: /* @__PURE__ */ c(
|
|
4026
|
+
children: /* @__PURE__ */ c(mr, {})
|
|
4013
4027
|
}
|
|
4014
4028
|
),
|
|
4015
4029
|
/* @__PURE__ */ c(
|
|
@@ -4025,20 +4039,20 @@ function El({
|
|
|
4025
4039
|
] })
|
|
4026
4040
|
] });
|
|
4027
4041
|
}
|
|
4028
|
-
const
|
|
4029
|
-
function
|
|
4030
|
-
return t.hidden && t.roomPlaying && !t.seekInFlight && !t.ended && !t.localPause && t.sinceUserPauseMs >=
|
|
4042
|
+
const Tl = 1e3;
|
|
4043
|
+
function Al(t) {
|
|
4044
|
+
return t.hidden && t.roomPlaying && !t.seekInFlight && !t.ended && !t.localPause && t.sinceUserPauseMs >= Tl;
|
|
4031
4045
|
}
|
|
4032
|
-
function
|
|
4046
|
+
function Cl(t, e) {
|
|
4033
4047
|
return e.isLeader ? t === "play" && e.roomPlaying ? { kind: "resync" } : t === "pause" && !e.roomPlaying ? { kind: "none" } : { kind: "control", control: t } : t === "pause" ? { kind: "local-pause" } : e.roomPlaying ? { kind: "resync" } : { kind: "none" };
|
|
4034
4048
|
}
|
|
4035
4049
|
const Il = 1e3;
|
|
4036
|
-
function
|
|
4050
|
+
function Nl(t) {
|
|
4037
4051
|
if (!t.roomPlaying || t.seekInFlight) return { kind: "none" };
|
|
4038
4052
|
const e = t.durationMs > 0 ? Math.min(t.roomMs, t.durationMs) : t.roomMs;
|
|
4039
4053
|
return Math.abs(e - t.elementMs) > t.driftToleranceMs ? { kind: "seek", targetMs: Math.round(e) } : t.elementPaused ? { kind: "resume" } : { kind: "none" };
|
|
4040
4054
|
}
|
|
4041
|
-
function
|
|
4055
|
+
function Rl(t, e, n) {
|
|
4042
4056
|
return t.playheadMs + (t.playing ? Math.max(0, n - e) : 0);
|
|
4043
4057
|
}
|
|
4044
4058
|
function Ur(t) {
|
|
@@ -4047,14 +4061,14 @@ function Ur(t) {
|
|
|
4047
4061
|
const n = t.split("/").filter(Boolean);
|
|
4048
4062
|
return n.length >= 2 ? n.slice(-2).join(" ") : n[n.length - 1] || t;
|
|
4049
4063
|
}
|
|
4050
|
-
function
|
|
4064
|
+
function Ll(t) {
|
|
4051
4065
|
const e = t.split("/").filter(Boolean), n = [`${e.join("/")}/poster.jpg`];
|
|
4052
4066
|
return e.length >= 2 && n.push(`${e.slice(0, -1).join("/")}/poster.jpg`), n;
|
|
4053
4067
|
}
|
|
4054
|
-
function
|
|
4068
|
+
function Fl({ mediaId: t, visible: e }) {
|
|
4055
4069
|
return t ? /* @__PURE__ */ c("div", { className: `media-title ${e ? "show" : ""}`, children: Ur(t) }) : null;
|
|
4056
4070
|
}
|
|
4057
|
-
const
|
|
4071
|
+
const $l = 300, Dl = 50, Pl = 100, Bl = 100, Ol = 100, jl = 100;
|
|
4058
4072
|
function pn(t, e) {
|
|
4059
4073
|
if (t.length === 0) return 0;
|
|
4060
4074
|
const n = Math.min(Math.floor(e / 100 * t.length), t.length - 1);
|
|
@@ -4072,10 +4086,10 @@ function He(t) {
|
|
|
4072
4086
|
max: Math.round(e[e.length - 1])
|
|
4073
4087
|
};
|
|
4074
4088
|
}
|
|
4075
|
-
function Ue(t, e =
|
|
4089
|
+
function Ue(t, e = $l) {
|
|
4076
4090
|
t.length > e && t.splice(0, t.length - e);
|
|
4077
4091
|
}
|
|
4078
|
-
class
|
|
4092
|
+
class Hl {
|
|
4079
4093
|
// Fetch
|
|
4080
4094
|
_fetches = [];
|
|
4081
4095
|
_fetchTimeoutCount = 0;
|
|
@@ -4133,11 +4147,11 @@ class jl {
|
|
|
4133
4147
|
}
|
|
4134
4148
|
/** Called when waitForAppend times out. */
|
|
4135
4149
|
recordAppendTimeout(e, n, a) {
|
|
4136
|
-
this._appendTimeouts.push({ index: e, timeoutMs: n, queueDepth: a, ts: performance.now() }), Ue(this._appendTimeouts,
|
|
4150
|
+
this._appendTimeouts.push({ index: e, timeoutMs: n, queueDepth: a, ts: performance.now() }), Ue(this._appendTimeouts, Dl);
|
|
4137
4151
|
}
|
|
4138
4152
|
/** Called when a seek completes (COMPLETED path in _execute). */
|
|
4139
4153
|
recordSeekCompleted(e, n, a) {
|
|
4140
|
-
this._seeks.push({ caller: e, targetMs: n, durationMs: a, ts: performance.now() }), Ue(this._seeks,
|
|
4154
|
+
this._seeks.push({ caller: e, targetMs: n, durationMs: a, ts: performance.now() }), Ue(this._seeks, Pl);
|
|
4141
4155
|
}
|
|
4142
4156
|
/** Called when waitForSeeked resolves via timeout rather than the 'seeked' event. */
|
|
4143
4157
|
recordWaitForSeekedTimeout() {
|
|
@@ -4159,11 +4173,11 @@ class jl {
|
|
|
4159
4173
|
this._stallStart && (this._stalls.push({
|
|
4160
4174
|
...this._stallStart,
|
|
4161
4175
|
durationMs: Math.round(performance.now() - this._stallStart.ts)
|
|
4162
|
-
}), Ue(this._stalls,
|
|
4176
|
+
}), Ue(this._stalls, Bl), this._stallStart = null);
|
|
4163
4177
|
}
|
|
4164
4178
|
/** Called from _doEvict with the reason tag passed by the caller. */
|
|
4165
4179
|
recordEvict(e, n, a) {
|
|
4166
|
-
this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: n, end: a, ts: performance.now() }), Ue(this._evicts,
|
|
4180
|
+
this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: n, end: a, ts: performance.now() }), Ue(this._evicts, Ol);
|
|
4167
4181
|
}
|
|
4168
4182
|
/** Called from FragmentManager.reconcileLoadedStates() when the browser's
|
|
4169
4183
|
* own silent quota eviction is detected (fragments 'loaded' but gone from
|
|
@@ -4205,7 +4219,7 @@ class jl {
|
|
|
4205
4219
|
},
|
|
4206
4220
|
audio: {
|
|
4207
4221
|
driftMs: He(this._audioDrifts),
|
|
4208
|
-
highDriftCount: this._audioDrifts.filter((l) => l >
|
|
4222
|
+
highDriftCount: this._audioDrifts.filter((l) => l > jl).length,
|
|
4209
4223
|
samples: this._audioDrifts.slice(-20).map((l) => Math.round(l))
|
|
4210
4224
|
},
|
|
4211
4225
|
stalls: {
|
|
@@ -4254,9 +4268,9 @@ class jl {
|
|
|
4254
4268
|
this._fetches = [], this._fetchTimeoutCount = 0, this._fetchErrorCount = 0, this._appends = [], this._appendStarts.clear(), this._appendTimeouts = [], this._seeks = [], this._waitForSeekedTimeouts = 0, this._audioDrifts = [], this._stalls = [], this._stallStart = null, this._evictCounts = {}, this._evicts = [], this._browserEvictions = [];
|
|
4255
4269
|
}
|
|
4256
4270
|
}
|
|
4257
|
-
const me = new
|
|
4258
|
-
|
|
4259
|
-
class
|
|
4271
|
+
const me = new Hl();
|
|
4272
|
+
Pa("__WP_PERF__", me);
|
|
4273
|
+
class Ul {
|
|
4260
4274
|
cache = /* @__PURE__ */ new Map();
|
|
4261
4275
|
getOrCreate(e) {
|
|
4262
4276
|
let n = this.cache.get(e);
|
|
@@ -4285,7 +4299,7 @@ class Hl {
|
|
|
4285
4299
|
if (n.length === 0) return 0;
|
|
4286
4300
|
const a = this.cache.get(e);
|
|
4287
4301
|
if (!a) return 0;
|
|
4288
|
-
const s =
|
|
4302
|
+
const s = jn(n, 0);
|
|
4289
4303
|
let r = 0;
|
|
4290
4304
|
for (let i = s; i < n.length && a.fragments.has(i); i++)
|
|
4291
4305
|
r = n[i].end_ms;
|
|
@@ -4295,8 +4309,8 @@ class Hl {
|
|
|
4295
4309
|
this.cache.clear();
|
|
4296
4310
|
}
|
|
4297
4311
|
}
|
|
4298
|
-
const Te = new
|
|
4299
|
-
class
|
|
4312
|
+
const Te = new Ul(), va = 60, zl = 5e3;
|
|
4313
|
+
class Wl {
|
|
4300
4314
|
constructor(e) {
|
|
4301
4315
|
this.deps = e;
|
|
4302
4316
|
}
|
|
@@ -4376,7 +4390,7 @@ class zl {
|
|
|
4376
4390
|
if (this.evictStartedAt === 0)
|
|
4377
4391
|
return this.evictStartedAt = Date.now(), !0;
|
|
4378
4392
|
const e = Date.now() - this.evictStartedAt;
|
|
4379
|
-
return e <
|
|
4393
|
+
return e < zl ? !0 : (N("buffer", `EVICT-STUCK isEvicting held ${e}ms — clearing; a remove() updateend was lost, eviction was disabled`), me.recordEvict("stuck-recovered", 0, 0), this._isEvicting = !1, this.evictStartedAt = 0, !1);
|
|
4380
4394
|
}
|
|
4381
4395
|
/** Called on dispose, on SourceBuffer error, and on media change
|
|
4382
4396
|
* (FragmentManager.setIndex) — see the note at that call site. */
|
|
@@ -4389,7 +4403,7 @@ class zl {
|
|
|
4389
4403
|
* range per call; the updateend chain handles any remainder. */
|
|
4390
4404
|
evictSeekGap(e) {
|
|
4391
4405
|
const n = this.deps.getSourceBuffer(), a = this.deps.getMediaSource();
|
|
4392
|
-
if (!n || n.updating || this.deps.isDisposed() || !
|
|
4406
|
+
if (!n || n.updating || this.deps.isDisposed() || !Ie(a) || this.clearIfStuck()) return;
|
|
4393
4407
|
this.pendingEvictionMs = e;
|
|
4394
4408
|
const s = e / 1e3, r = n.buffered;
|
|
4395
4409
|
for (let f = 0; f < r.length; f++) {
|
|
@@ -4415,12 +4429,12 @@ class zl {
|
|
|
4415
4429
|
evictBefore(e) {
|
|
4416
4430
|
this.pendingEvictionMs = e;
|
|
4417
4431
|
const n = this.deps.getSourceBuffer(), a = this.deps.getMediaSource();
|
|
4418
|
-
if (!n || n.updating || this.deps.isDisposed() || !
|
|
4432
|
+
if (!n || n.updating || this.deps.isDisposed() || !Ie(a) || this.clearIfStuck()) return;
|
|
4419
4433
|
const s = e / 1e3, r = n.buffered, i = this.deps.getPendingSeekTargetMs(), f = i === null ? null : i / 1e3;
|
|
4420
4434
|
for (let o = 0; o < r.length; o++) {
|
|
4421
4435
|
const l = r.start(o), d = r.end(o);
|
|
4422
|
-
if (l < s -
|
|
4423
|
-
const h = s -
|
|
4436
|
+
if (l < s - va && d > s) {
|
|
4437
|
+
const h = s - va;
|
|
4424
4438
|
T("buffer", `EVICT-START [behind-tail-trim] range=${l.toFixed(2)}-${d.toFixed(2)} → trim [${l.toFixed(2)}-${h.toFixed(2)}] playhead=${s.toFixed(2)}`), this._doEvict(l, h, "behind-tail-trim");
|
|
4425
4439
|
return;
|
|
4426
4440
|
}
|
|
@@ -4542,13 +4556,13 @@ class We {
|
|
|
4542
4556
|
* hold began. Lets processAppendQueue bound a hold that would otherwise
|
|
4543
4557
|
* never end — see APPEND_HOLD_MAX_MS. */
|
|
4544
4558
|
appendHold = null;
|
|
4545
|
-
eviction = new
|
|
4559
|
+
eviction = new Wl({
|
|
4546
4560
|
getFragments: () => this.fragments,
|
|
4547
4561
|
getSourceBuffer: () => this.sourceBuffer,
|
|
4548
4562
|
getMediaSource: () => this.mediaSource,
|
|
4549
4563
|
isDisposed: () => this.disposed,
|
|
4550
4564
|
fragmentStates: this.fragmentStates,
|
|
4551
|
-
getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs >
|
|
4565
|
+
getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs > gl ? null : this.pendingSeekTargetMs
|
|
4552
4566
|
});
|
|
4553
4567
|
lastGapWarnMs = 0;
|
|
4554
4568
|
stableGapSignature = null;
|
|
@@ -4877,14 +4891,14 @@ class We {
|
|
|
4877
4891
|
]), a = [], s = this.currentPlayheadMs / 1e3;
|
|
4878
4892
|
for (let f = 1; f < e.buffered.length; f++) {
|
|
4879
4893
|
const o = e.buffered.end(f - 1), l = e.buffered.start(f);
|
|
4880
|
-
l <= s ||
|
|
4894
|
+
l <= s || wl(o, l, this.fragments, n) || a.push(`${o.toFixed(2)}-${l.toFixed(2)}`);
|
|
4881
4895
|
}
|
|
4882
4896
|
if (a.length === 0) {
|
|
4883
4897
|
this.stableGapSignature = null, this.stableGapSince = 0;
|
|
4884
4898
|
return;
|
|
4885
4899
|
}
|
|
4886
4900
|
const r = a.join("|"), i = Date.now();
|
|
4887
|
-
this.stableGapSignature !== r ? (this.stableGapSignature = r, this.stableGapSince = i) : i - this.stableGapSince >=
|
|
4901
|
+
this.stableGapSignature !== r ? (this.stableGapSignature = r, this.stableGapSince = i) : i - this.stableGapSince >= Kn && i - this.lastGapWarnMs > Kn && (this.lastGapWarnMs = i, N("buffer", `SB has ${e.buffered.length} ranges with ${a.length} stable unfillable gap(s) ${JSON.stringify({
|
|
4888
4902
|
ranges: Se(e.buffered),
|
|
4889
4903
|
unfillableGaps: a,
|
|
4890
4904
|
stableForMs: i - this.stableGapSince,
|
|
@@ -4932,7 +4946,7 @@ class We {
|
|
|
4932
4946
|
});
|
|
4933
4947
|
}
|
|
4934
4948
|
isBuffered(e) {
|
|
4935
|
-
return !this.sourceBuffer?.buffered || !
|
|
4949
|
+
return !this.sourceBuffer?.buffered || !Ie(this.mediaSource) ? !1 : ht(this.sourceBuffer.buffered, e / 1e3, ne.RANGE) >= 0;
|
|
4936
4950
|
}
|
|
4937
4951
|
/** True when `timeMs` is comfortably inside a buffered range — more than
|
|
4938
4952
|
* GAP_SKIP_EDGE_SEC of data ahead of it. `isBuffered` is a point test and says
|
|
@@ -4941,7 +4955,7 @@ class We {
|
|
|
4941
4955
|
* a viewer frozen 45ms short of their audio buffer's end (mistral-bluff
|
|
4942
4956
|
* 2026-10-20, 55s). Test: fragmentManager.trailingEdgeRefill.test.ts. */
|
|
4943
4957
|
hasDataAhead(e) {
|
|
4944
|
-
if (!this.sourceBuffer?.buffered || !
|
|
4958
|
+
if (!this.sourceBuffer?.buffered || !Ie(this.mediaSource)) return !1;
|
|
4945
4959
|
const n = this.sourceBuffer.buffered, a = e / 1e3, s = ht(n, a, ne.RANGE);
|
|
4946
4960
|
return s >= 0 && n.end(s) - a > un;
|
|
4947
4961
|
}
|
|
@@ -4976,7 +4990,7 @@ class We {
|
|
|
4976
4990
|
* and seek gates follow the same rule (`isMediaSourceAttached`).
|
|
4977
4991
|
*/
|
|
4978
4992
|
canReportBuffered() {
|
|
4979
|
-
return
|
|
4993
|
+
return Ie(this.mediaSource);
|
|
4980
4994
|
}
|
|
4981
4995
|
getBufferedEnd(e) {
|
|
4982
4996
|
if (!this.sourceBuffer?.buffered || !this.canReportBuffered()) return 0;
|
|
@@ -5049,7 +5063,7 @@ class We {
|
|
|
5049
5063
|
if (this.isBuffered(e)) return { status: "buffered", fragmentIndex: n };
|
|
5050
5064
|
const a = this.currentJobs.get(n);
|
|
5051
5065
|
if (a) return { status: "loading", fragmentIndex: n, existingPromise: a.promise };
|
|
5052
|
-
const s = Math.max(0, n -
|
|
5066
|
+
const s = Math.max(0, n - ya), r = Math.min(this.fragments.length - 1, n + ya);
|
|
5053
5067
|
for (let i = s; i <= r; i++) {
|
|
5054
5068
|
const f = this.fragmentStates.get(i);
|
|
5055
5069
|
if (f === "loaded" || f === "loading") return { status: "nearby-pending", fragmentIndex: n };
|
|
@@ -5061,7 +5075,7 @@ class We {
|
|
|
5061
5075
|
}
|
|
5062
5076
|
async ensureBuffered(e, n, a) {
|
|
5063
5077
|
if (!(this.disposed || !this.sourceBuffer || !this.fragments.length || this.isBuffered(e))) {
|
|
5064
|
-
if (!
|
|
5078
|
+
if (!Ie(this.mediaSource)) {
|
|
5065
5079
|
T("buffer", `ENSURE-SKIP — mediaSource.readyState=${this.mediaSource?.readyState ?? "null"}`);
|
|
5066
5080
|
return;
|
|
5067
5081
|
}
|
|
@@ -5069,7 +5083,7 @@ class We {
|
|
|
5069
5083
|
}
|
|
5070
5084
|
}
|
|
5071
5085
|
async _fetchRange(e, n) {
|
|
5072
|
-
if (this.disposed || !this.sourceBuffer || !this.fragments.length || this.hasDataAhead(e) || !
|
|
5086
|
+
if (this.disposed || !this.sourceBuffer || !this.fragments.length || this.hasDataAhead(e) || !Ie(this.mediaSource)) return;
|
|
5073
5087
|
const { abort: a = !1, minimal: s = !1, signal: r, caller: i = "unknown" } = n;
|
|
5074
5088
|
a && this.abortAllJobs(i);
|
|
5075
5089
|
const f = Pe(this.fragments, e);
|
|
@@ -5078,7 +5092,7 @@ class We {
|
|
|
5078
5092
|
for (let h = f; h <= g; h++)
|
|
5079
5093
|
this.discardCounts.delete(h), this.fetchErrorCycles.delete(h);
|
|
5080
5094
|
}
|
|
5081
|
-
const o =
|
|
5095
|
+
const o = jn(this.fragments, e), l = this.fragments[o], d = l && this.sourceBuffer?.buffered && mn(this.sourceBuffer.buffered, l.start_ms, l.end_ms), u = d ? f : o, m = s ? Math.min(this.fragments.length - 1, f + 1) : Pe(this.fragments, e + Be);
|
|
5082
5096
|
this.initRange && this.initState !== "loaded" && await this.fetchInit();
|
|
5083
5097
|
const y = [], b = [];
|
|
5084
5098
|
for (let g = u; g <= m; g++) {
|
|
@@ -5228,8 +5242,8 @@ class We {
|
|
|
5228
5242
|
ae("buffer", `Fragment #${e} bad response after ${ut} retries`, { expected: p, actual: _.byteLength }), this.fragmentStates.set(e, "error"), this.errorTimestamps.set(e, Date.now()), this.fetchErrorCycles.set(e, (this.fetchErrorCycles.get(e) ?? 0) + 1), me.recordFetchError(e);
|
|
5229
5243
|
return;
|
|
5230
5244
|
}
|
|
5231
|
-
const
|
|
5232
|
-
if (this.isInInitPhase() && this.recordInitFragEvent(e, { fetchEnd: performance.now(), bytes: _.byteLength, ttfbMs: g, cf: h }), T("buffer", `FETCH-OK #${e} [${r}] ${_.byteLength}B in ${Math.round(
|
|
5245
|
+
const C = performance.now() - l;
|
|
5246
|
+
if (this.isInInitPhase() && this.recordInitFragEvent(e, { fetchEnd: performance.now(), bytes: _.byteLength, ttfbMs: g, cf: h }), T("buffer", `FETCH-OK #${e} [${r}] ${_.byteLength}B in ${Math.round(C)}ms (ttfb=${g}ms cf=${h || "-"}) (${(_.byteLength / C * 1e3 / 1024).toFixed(0)} KB/s)`), C > 0 && (this.downloadSamples.push({ bytes: _.byteLength, durationMs: C }), this.downloadSamples.length > gn && this.downloadSamples.shift(), me.recordFetch(e, _.byteLength, C)), this.disposed || this.mediaUrl !== y) {
|
|
5233
5247
|
T("buffer", `FETCH-STALE #${e} discarding (mediaUrl changed)`);
|
|
5234
5248
|
return;
|
|
5235
5249
|
}
|
|
@@ -5274,7 +5288,7 @@ class We {
|
|
|
5274
5288
|
if (e <= 0 || this.fragments.length === 0 || this.fragments[0].keyframe === void 0) return !1;
|
|
5275
5289
|
const n = this.fragments[e];
|
|
5276
5290
|
if (!n || n.keyframe) return !1;
|
|
5277
|
-
const a =
|
|
5291
|
+
const a = wa(this.fragments, e - 1);
|
|
5278
5292
|
if (a < 0 || this.fragmentStates.get(a) !== "error") return !1;
|
|
5279
5293
|
const s = this.fragments[a];
|
|
5280
5294
|
if (this.sourceBuffer ? mn(this.sourceBuffer.buffered, s.start_ms, s.end_ms) : !1) return !1;
|
|
@@ -5285,7 +5299,7 @@ class We {
|
|
|
5285
5299
|
f.push(o);
|
|
5286
5300
|
continue;
|
|
5287
5301
|
}
|
|
5288
|
-
|
|
5302
|
+
wa(this.fragments, o.index - 1) === a ? (i.push(o.index), this.fragmentStates.set(o.index, "pending")) : f.push(o);
|
|
5289
5303
|
}
|
|
5290
5304
|
return i.length === 0 ? !1 : (this.appendQueue = f, N("buffer", `APPEND-DROP-DEPENDENT [${i.join(",")}] — keyframe #${a} in error, not in SB`, {
|
|
5291
5305
|
kfIdx: a,
|
|
@@ -5325,11 +5339,11 @@ class We {
|
|
|
5325
5339
|
liveJobs: Array.from(this.currentJobs.keys()).sort((r, i) => r - i)
|
|
5326
5340
|
});
|
|
5327
5341
|
for (const r of n)
|
|
5328
|
-
this.currentJobs.get(r)?.abortController.abort(), this.currentJobs.delete(r), this.pendingFetchIndices.delete(r), this.fragmentStates.set(r, "error"), this.errorTimestamps.set(r, a), this.fetchErrorCycles.set(r,
|
|
5342
|
+
this.currentJobs.get(r)?.abortController.abort(), this.currentJobs.delete(r), this.pendingFetchIndices.delete(r), this.fragmentStates.set(r, "error"), this.errorTimestamps.set(r, a), this.fetchErrorCycles.set(r, Vn);
|
|
5329
5343
|
return this.appendHold = null, !0;
|
|
5330
5344
|
}
|
|
5331
5345
|
processAppendQueue() {
|
|
5332
|
-
if (this.isAppending || this.disposed || !this.sourceBuffer || this.sourceBuffer.updating || !
|
|
5346
|
+
if (this.isAppending || this.disposed || !this.sourceBuffer || this.sourceBuffer.updating || !Ie(this.mediaSource) || this.appendQueue.length === 0) return;
|
|
5333
5347
|
const e = this.appendQueue[0];
|
|
5334
5348
|
if (e) {
|
|
5335
5349
|
if (this.initRange && this.initState !== "loaded") {
|
|
@@ -5380,7 +5394,7 @@ class We {
|
|
|
5380
5394
|
if (this.disposed || !this.sourceBuffer || (this.currentPlayheadMs = e, this.currentJobs.size >= lt)) return;
|
|
5381
5395
|
const n = Pe(this.fragments, e), a = Math.min(this.fragments.length - 1, Pe(this.fragments, e + pt)), s = Date.now();
|
|
5382
5396
|
for (let i = n; i <= a; i++)
|
|
5383
|
-
this.fragmentStates.get(i) === "error" && s - (this.errorTimestamps.get(i) ?? 0) >= Hs && ((this.fetchErrorCycles.get(i) ?? 0) >=
|
|
5397
|
+
this.fragmentStates.get(i) === "error" && s - (this.errorTimestamps.get(i) ?? 0) >= Hs && ((this.fetchErrorCycles.get(i) ?? 0) >= Vn ? T("buffer", `PREFETCH-DEAD #${i} cycles=${this.fetchErrorCycles.get(i)} not resetting`) : (this.fragmentStates.set(i, "pending"), this.errorTimestamps.delete(i)));
|
|
5384
5398
|
let r = 0;
|
|
5385
5399
|
for (let i = n; i <= a && r < lt - this.currentJobs.size; i++) {
|
|
5386
5400
|
const f = this.fragmentStates.get(i);
|
|
@@ -5411,7 +5425,7 @@ class We {
|
|
|
5411
5425
|
/** Public eviction entry point used by MediaPlayer / prefetch. Delegates
|
|
5412
5426
|
* to the strategy which owns the isEvicting state + range choice logic. */
|
|
5413
5427
|
evictBefore(e) {
|
|
5414
|
-
this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <=
|
|
5428
|
+
this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <= ml && (this.pendingSeekTargetMs = null), this.eviction.evictBefore(e);
|
|
5415
5429
|
}
|
|
5416
5430
|
// Public entry point for socket reconnect scenarios. Clears stale in-flight
|
|
5417
5431
|
// fetches and their pendingFetchIndices entries so the queue is unblocked on
|
|
@@ -5559,7 +5573,7 @@ class We {
|
|
|
5559
5573
|
return { ranges: e, gaps: e.length > 1, fragmentStates: n };
|
|
5560
5574
|
}
|
|
5561
5575
|
getAverageDownloadRate() {
|
|
5562
|
-
return
|
|
5576
|
+
return pl(this.downloadSamples);
|
|
5563
5577
|
}
|
|
5564
5578
|
/** Nominal media end time (ms) = last fragment's end. 0 if no index loaded.
|
|
5565
5579
|
* Reported in health so the leader's status card can tell "near end-of-stream,
|
|
@@ -5573,7 +5587,7 @@ class We {
|
|
|
5573
5587
|
* structural gaps caused by late-IDR fragments (where the IDR is deep inside the
|
|
5574
5588
|
* fragment's mdat so MSE only buffers from the IDR timestamp, not the nominal start). */
|
|
5575
5589
|
findNextRangeStart(e, n) {
|
|
5576
|
-
if (!this.sourceBuffer?.buffered || !
|
|
5590
|
+
if (!this.sourceBuffer?.buffered || !Ie(this.mediaSource)) return null;
|
|
5577
5591
|
const a = e / 1e3, s = this.sourceBuffer.buffered, r = ht(s, a, ne.RANGE);
|
|
5578
5592
|
if (r >= 0 && s.end(r) - a > un) return null;
|
|
5579
5593
|
const i = r >= 0 ? Math.max(a, s.end(r)) : a;
|
|
@@ -5594,7 +5608,7 @@ class We {
|
|
|
5594
5608
|
* same way the skip decision measures it (from the containing range's end).
|
|
5595
5609
|
* Returns null only when there is no usable SourceBuffer. */
|
|
5596
5610
|
getForwardGapDiag(e) {
|
|
5597
|
-
if (!this.sourceBuffer?.buffered || !
|
|
5611
|
+
if (!this.sourceBuffer?.buffered || !Ie(this.mediaSource)) return null;
|
|
5598
5612
|
const n = e / 1e3, a = this.sourceBuffer.buffered, s = ht(a, n, ne.RANGE), r = s >= 0 ? Math.max(0, a.end(s) - n) : 0, i = s >= 0 ? Math.max(n, a.end(s)) : n;
|
|
5599
5613
|
let f = null;
|
|
5600
5614
|
for (let o = 0; o < a.length; o++)
|
|
@@ -5677,14 +5691,14 @@ class We {
|
|
|
5677
5691
|
this.disposed = !0, this.mediaSource && gt.get(this.mediaSource)?.delete(this), this.eosRetryTimer && (clearTimeout(this.eosRetryTimer), this.eosRetryTimer = null), this.pendingEndOfStream = !1, this.endOfStreamEligible = !1, this.abortAllJobs("dispose"), this.rejectAllWaiters(new Error("FragmentManager disposed")), this.appendQueue = [], this.isAppending = !1, this.eviction.reset(), this.appendingIndex = null, this.fragmentStates.clear(), this.errorTimestamps.clear(), this.discardCounts.clear(), this.fetchErrorCycles.clear(), this.downloadSamples = [], this.preAppendRanges = [], this.sourceBuffer = null, this.mediaSource = null, this.initState = "pending", this.initRange = null;
|
|
5678
5692
|
}
|
|
5679
5693
|
}
|
|
5680
|
-
function
|
|
5694
|
+
function Gl(t, e) {
|
|
5681
5695
|
return !!t && t !== "eng" && e;
|
|
5682
5696
|
}
|
|
5683
|
-
function
|
|
5684
|
-
return t.override !== null ? t.override : t.globalEnabled ||
|
|
5697
|
+
function ql(t) {
|
|
5698
|
+
return t.override !== null ? t.override : t.globalEnabled || Gl(t.selectedAudioLang, t.hasEngSub);
|
|
5685
5699
|
}
|
|
5686
|
-
const zr = "wp_reload_history",
|
|
5687
|
-
function
|
|
5700
|
+
const zr = "wp_reload_history", Hn = "wp_phantom_reload", Wr = 5 * 6e4, ka = 3;
|
|
5701
|
+
function Kl() {
|
|
5688
5702
|
try {
|
|
5689
5703
|
const t = sessionStorage.getItem(zr);
|
|
5690
5704
|
return (t ? JSON.parse(t) : []).filter((n) => Date.now() - n < Wr);
|
|
@@ -5693,16 +5707,16 @@ function ql() {
|
|
|
5693
5707
|
}
|
|
5694
5708
|
}
|
|
5695
5709
|
function An(t, e) {
|
|
5696
|
-
const n =
|
|
5697
|
-
if (n.length >=
|
|
5698
|
-
|
|
5710
|
+
const n = Kl();
|
|
5711
|
+
if (n.length >= ka) {
|
|
5712
|
+
Jn(
|
|
5699
5713
|
"error",
|
|
5700
5714
|
"buffer",
|
|
5701
5715
|
`AUTO-RELOAD SUPPRESSED reason=${t} — ${n.length} reloads in ${Wr / 6e4}m, giving up (connection looks unstable)`,
|
|
5702
5716
|
e
|
|
5703
5717
|
);
|
|
5704
5718
|
try {
|
|
5705
|
-
|
|
5719
|
+
k.getState().pushToast(
|
|
5706
5720
|
"error",
|
|
5707
5721
|
"Playback keeps dropping — your connection looks unstable. Try reloading the page or rejoining."
|
|
5708
5722
|
);
|
|
@@ -5711,31 +5725,31 @@ function An(t, e) {
|
|
|
5711
5725
|
return !1;
|
|
5712
5726
|
}
|
|
5713
5727
|
try {
|
|
5714
|
-
n.push(Date.now()), sessionStorage.setItem(zr, JSON.stringify(n)), sessionStorage.setItem(
|
|
5728
|
+
n.push(Date.now()), sessionStorage.setItem(zr, JSON.stringify(n)), sessionStorage.setItem(Hn, String(Date.now()));
|
|
5715
5729
|
} catch {
|
|
5716
5730
|
}
|
|
5717
|
-
|
|
5731
|
+
Jn("error", "buffer", `AUTO-RELOAD reason=${t} attempt=${n.length}/${ka}`, e);
|
|
5718
5732
|
try {
|
|
5719
5733
|
window.location.reload();
|
|
5720
5734
|
} catch {
|
|
5721
5735
|
}
|
|
5722
5736
|
return !0;
|
|
5723
5737
|
}
|
|
5724
|
-
function
|
|
5738
|
+
function Sa() {
|
|
5725
5739
|
try {
|
|
5726
|
-
const t = sessionStorage.getItem(
|
|
5740
|
+
const t = sessionStorage.getItem(Hn);
|
|
5727
5741
|
return t ? Number(t) : null;
|
|
5728
5742
|
} catch {
|
|
5729
5743
|
return null;
|
|
5730
5744
|
}
|
|
5731
5745
|
}
|
|
5732
|
-
function
|
|
5746
|
+
function Vl() {
|
|
5733
5747
|
try {
|
|
5734
|
-
sessionStorage.removeItem(
|
|
5748
|
+
sessionStorage.removeItem(Hn);
|
|
5735
5749
|
} catch {
|
|
5736
5750
|
}
|
|
5737
5751
|
}
|
|
5738
|
-
function
|
|
5752
|
+
function Jl() {
|
|
5739
5753
|
const t = navigator;
|
|
5740
5754
|
try {
|
|
5741
5755
|
return typeof t.getAutoplayPolicy == "function" ? t.getAutoplayPolicy("mediaelement") : void 0;
|
|
@@ -5743,20 +5757,20 @@ function Vl() {
|
|
|
5743
5757
|
return;
|
|
5744
5758
|
}
|
|
5745
5759
|
}
|
|
5746
|
-
function
|
|
5760
|
+
function Ql(t, e) {
|
|
5747
5761
|
return t === "disallowed" ? "deferred" : e ? "user-muted" : t === "allowed-muted" ? "muted-bridge" : "audible";
|
|
5748
5762
|
}
|
|
5749
5763
|
function Gr(t, e) {
|
|
5750
|
-
const n =
|
|
5764
|
+
const n = Jl(), a = Ql(n, e.userWantsMuted);
|
|
5751
5765
|
T(e.label, "autoplay plan", { policy: n ?? "unknown", plan: a, userWantsMuted: e.userWantsMuted });
|
|
5752
5766
|
const s = () => {
|
|
5753
5767
|
t.muted = !0, t.play().then(() => {
|
|
5754
|
-
e.onMutedBridge?.(),
|
|
5768
|
+
e.onMutedBridge?.(), ma(() => {
|
|
5755
5769
|
e.userWantsMuted || (t.muted = !1, e.onUnmuted?.(), T(e.label, "autoplay bridge unmuted on interaction"));
|
|
5756
5770
|
});
|
|
5757
5771
|
}).catch((r) => N(e.label, "muted-bridge play failed", { error: r?.name }));
|
|
5758
5772
|
};
|
|
5759
|
-
return a === "deferred" ? (
|
|
5773
|
+
return a === "deferred" ? (ma(() => {
|
|
5760
5774
|
t.play().catch((r) => N(e.label, "deferred play retry failed", { error: r?.name }));
|
|
5761
5775
|
}), a) : a === "muted-bridge" ? (s(), a) : (t.muted = e.userWantsMuted, t.play().catch((r) => {
|
|
5762
5776
|
r?.name === "NotAllowedError" && !e.userWantsMuted ? s() : r?.name !== "AbortError" && N(e.label, "video.play() failed", { error: r?.name, message: r?.message });
|
|
@@ -5787,7 +5801,7 @@ function qr(t, e = 3e3) {
|
|
|
5787
5801
|
t.addEventListener("seeked", s, { once: !0 });
|
|
5788
5802
|
});
|
|
5789
5803
|
}
|
|
5790
|
-
class
|
|
5804
|
+
class Yl {
|
|
5791
5805
|
// ── State ──
|
|
5792
5806
|
_seekInFlight = !1;
|
|
5793
5807
|
/** Route taken by the in-flight seek (buffered/loading/nearby-pending/far) —
|
|
@@ -5875,7 +5889,7 @@ class Ql {
|
|
|
5875
5889
|
route: this._lastSeekRoute,
|
|
5876
5890
|
totalMs: b,
|
|
5877
5891
|
videoReady: i.readyState
|
|
5878
|
-
}), me.recordSeekCompleted(s, a, b),
|
|
5892
|
+
}), me.recordSeekCompleted(s, a, b), k.getState().snapshot.playing && (r || i.paused) && this._resume(i), e.onComplete?.(y);
|
|
5879
5893
|
const h = this.deps.fragmentManagerRef.current;
|
|
5880
5894
|
h && h.prefetchAround(y);
|
|
5881
5895
|
const p = this.deps.audioFragmentManagersRef.current ?? [];
|
|
@@ -5891,7 +5905,7 @@ class Ql {
|
|
|
5891
5905
|
videoTime: Math.round(i.currentTime * 1e3),
|
|
5892
5906
|
videoReady: i.readyState,
|
|
5893
5907
|
videoPaused: i.paused
|
|
5894
|
-
}), e.onAborted?.(d), r &&
|
|
5908
|
+
}), e.onAborted?.(d), r && k.getState().snapshot.playing && i.paused && this._resume(i), null);
|
|
5895
5909
|
} finally {
|
|
5896
5910
|
this._clear(n);
|
|
5897
5911
|
}
|
|
@@ -5969,26 +5983,26 @@ class Ql {
|
|
|
5969
5983
|
e.pause();
|
|
5970
5984
|
}
|
|
5971
5985
|
_resume(e) {
|
|
5972
|
-
const n =
|
|
5986
|
+
const n = k.getState();
|
|
5973
5987
|
Gr(e, {
|
|
5974
5988
|
userWantsMuted: n.mediaPrefs.muted,
|
|
5975
|
-
onMutedBridge: () =>
|
|
5976
|
-
onUnmuted: () =>
|
|
5989
|
+
onMutedBridge: () => k.getState().setMutedForAutoplay(!0),
|
|
5990
|
+
onUnmuted: () => k.getState().setMutedForAutoplay(!1),
|
|
5977
5991
|
label: "seek-coord"
|
|
5978
5992
|
});
|
|
5979
5993
|
}
|
|
5980
5994
|
}
|
|
5981
|
-
let
|
|
5982
|
-
function Yl() {
|
|
5983
|
-
It === null && (T("health", "Starting health reporting"), Sa(), It = window.setInterval(Sa, zs));
|
|
5984
|
-
}
|
|
5995
|
+
let Ct = null;
|
|
5985
5996
|
function Xl() {
|
|
5986
|
-
|
|
5997
|
+
Ct === null && (T("health", "Starting health reporting"), xa(), Ct = window.setInterval(xa, zs));
|
|
5987
5998
|
}
|
|
5988
|
-
function
|
|
5989
|
-
|
|
5999
|
+
function Zl() {
|
|
6000
|
+
Ct !== null && (T("health", "Stopping health reporting"), window.clearInterval(Ct), Ct = null);
|
|
6001
|
+
}
|
|
6002
|
+
function xa() {
|
|
6003
|
+
const t = Ua();
|
|
5990
6004
|
if (!t.connected) return;
|
|
5991
|
-
const e =
|
|
6005
|
+
const e = k.getState();
|
|
5992
6006
|
if (!e.snapshot.mediaId) return;
|
|
5993
6007
|
const n = window.__FRAGMENT_MANAGER__;
|
|
5994
6008
|
if (!n) return;
|
|
@@ -6004,7 +6018,7 @@ function Sa() {
|
|
|
6004
6018
|
(o < 0 || y < o) && (o = y);
|
|
6005
6019
|
}
|
|
6006
6020
|
const l = Math.max(0, i - s), d = o < 0 ? l : Math.min(l, o), u = e.drift.rtts.length > 0 ? e.drift.rtts.reduce((m, y) => m + y, 0) / e.drift.rtts.length : 0;
|
|
6007
|
-
t.emit(
|
|
6021
|
+
t.emit(za.HEALTH_REPORT, {
|
|
6008
6022
|
avg_download_rate_bps: n.getAverageDownloadRate(),
|
|
6009
6023
|
buffered_ahead_ms: d,
|
|
6010
6024
|
audio_buffered_ahead_ms: o < 0 ? -1 : Math.round(o),
|
|
@@ -6017,12 +6031,12 @@ function Sa() {
|
|
|
6017
6031
|
video_ready_state: a?.readyState ?? -1,
|
|
6018
6032
|
duration_ms: n.getMediaEndMs(),
|
|
6019
6033
|
delivery_arm: Gs(),
|
|
6020
|
-
...
|
|
6034
|
+
...ec(a),
|
|
6021
6035
|
pong_age_ms: Ws(),
|
|
6022
6036
|
reported_at: Date.now()
|
|
6023
6037
|
});
|
|
6024
6038
|
}
|
|
6025
|
-
function
|
|
6039
|
+
function ec(t) {
|
|
6026
6040
|
const e = typeof navigator > "u" ? void 0 : navigator, n = e?.connection;
|
|
6027
6041
|
return {
|
|
6028
6042
|
page_visible: typeof document.visibilityState == "string" ? document.visibilityState === "visible" : void 0,
|
|
@@ -6034,8 +6048,8 @@ function Zl(t) {
|
|
|
6034
6048
|
net_downlink_mbps: typeof n?.downlink == "number" && n.downlink >= 0 ? n.downlink : void 0
|
|
6035
6049
|
};
|
|
6036
6050
|
}
|
|
6037
|
-
const
|
|
6038
|
-
function
|
|
6051
|
+
const tc = 3e3;
|
|
6052
|
+
function nc() {
|
|
6039
6053
|
const [t, e] = L(!1), n = D(null), a = D(!1), s = () => {
|
|
6040
6054
|
n.current && (clearTimeout(n.current), n.current = null);
|
|
6041
6055
|
}, r = j((o = 3e3) => {
|
|
@@ -6045,7 +6059,7 @@ function tc() {
|
|
|
6045
6059
|
}, []), i = j(() => {
|
|
6046
6060
|
a.current || (s(), e(!1));
|
|
6047
6061
|
}, []), f = j((o) => {
|
|
6048
|
-
a.current !== o && (a.current = o, o ? (s(), e(!0)) : r(
|
|
6062
|
+
a.current !== o && (a.current = o, o ? (s(), e(!0)) : r(tc));
|
|
6049
6063
|
}, [r]);
|
|
6050
6064
|
return R(() => {
|
|
6051
6065
|
const o = () => {
|
|
@@ -6056,7 +6070,7 @@ function tc() {
|
|
|
6056
6070
|
};
|
|
6057
6071
|
}, [r]), { controlsVisible: t, showControls: r, hideControls: i, setControlsHeld: f };
|
|
6058
6072
|
}
|
|
6059
|
-
const Kr = [], Vr = [],
|
|
6073
|
+
const Kr = [], Vr = [], ac = {
|
|
6060
6074
|
fragments: Kr,
|
|
6061
6075
|
durationMs: null,
|
|
6062
6076
|
mseCodec: null,
|
|
@@ -6064,8 +6078,8 @@ const Kr = [], Vr = [], nc = {
|
|
|
6064
6078
|
audioTracks: Vr,
|
|
6065
6079
|
contentToken: null
|
|
6066
6080
|
};
|
|
6067
|
-
function
|
|
6068
|
-
if (!t || t.url !== e) return
|
|
6081
|
+
function rc(t, e) {
|
|
6082
|
+
if (!t || t.url !== e) return ac;
|
|
6069
6083
|
const n = t.data;
|
|
6070
6084
|
return {
|
|
6071
6085
|
fragments: n.fragments || Kr,
|
|
@@ -6076,7 +6090,7 @@ function ac(t, e) {
|
|
|
6076
6090
|
contentToken: n.content_token || null
|
|
6077
6091
|
};
|
|
6078
6092
|
}
|
|
6079
|
-
function
|
|
6093
|
+
function Ea(t) {
|
|
6080
6094
|
try {
|
|
6081
6095
|
const e = performance.getEntriesByName(t, "resource");
|
|
6082
6096
|
if (!e.length) return null;
|
|
@@ -6094,7 +6108,7 @@ function xa(t) {
|
|
|
6094
6108
|
return null;
|
|
6095
6109
|
}
|
|
6096
6110
|
}
|
|
6097
|
-
function
|
|
6111
|
+
function sc(t) {
|
|
6098
6112
|
const [e, n] = L(null);
|
|
6099
6113
|
return R(() => {
|
|
6100
6114
|
const a = new AbortController();
|
|
@@ -6115,7 +6129,7 @@ function rc(t) {
|
|
|
6115
6129
|
const d = await o.text(), u = Math.round(performance.now() - f) - l, m = JSON.parse(d), y = Math.round(performance.now() - f) - l - u, b = l + u + y;
|
|
6116
6130
|
if (a.signal.aborted) return;
|
|
6117
6131
|
n({ url: t, data: m });
|
|
6118
|
-
const g =
|
|
6132
|
+
const g = Ea(t);
|
|
6119
6133
|
T("mse", "Index loaded", {
|
|
6120
6134
|
attempt: r + 1,
|
|
6121
6135
|
headerMs: l,
|
|
@@ -6133,7 +6147,7 @@ function rc(t) {
|
|
|
6133
6147
|
} catch (o) {
|
|
6134
6148
|
if (a.signal.aborted) return;
|
|
6135
6149
|
r++;
|
|
6136
|
-
const l = Math.round(performance.now() - f), d =
|
|
6150
|
+
const l = Math.round(performance.now() - f), d = Ea(t);
|
|
6137
6151
|
N("mse", `Index fetch attempt ${r} failed (${l}ms)`, {
|
|
6138
6152
|
error: o?.message,
|
|
6139
6153
|
elapsedMs: l,
|
|
@@ -6147,7 +6161,7 @@ function rc(t) {
|
|
|
6147
6161
|
return s(), () => {
|
|
6148
6162
|
a.abort();
|
|
6149
6163
|
};
|
|
6150
|
-
}, [t]), ye(() =>
|
|
6164
|
+
}, [t]), ye(() => rc(e, t), [e, t]);
|
|
6151
6165
|
}
|
|
6152
6166
|
const bn = {
|
|
6153
6167
|
audioTracks: [],
|
|
@@ -6155,8 +6169,8 @@ const bn = {
|
|
|
6155
6169
|
selectedAudioIndex: 0,
|
|
6156
6170
|
selectedSubtitleIndex: 0
|
|
6157
6171
|
};
|
|
6158
|
-
function
|
|
6159
|
-
const [e, n] = L(bn), a = qs(), s =
|
|
6172
|
+
function ic(t) {
|
|
6173
|
+
const [e, n] = L(bn), a = qs(), s = k((d) => d.mediaPrefs.preferredAudioLang), [r, i] = L(t);
|
|
6160
6174
|
r !== t && (i(t), t && n(bn));
|
|
6161
6175
|
const f = ke(() => ({ origin: Ks(a), preferredAudioLang: s }));
|
|
6162
6176
|
R(() => {
|
|
@@ -6166,8 +6180,8 @@ function sc(t) {
|
|
|
6166
6180
|
return (async () => {
|
|
6167
6181
|
try {
|
|
6168
6182
|
if (y = await fetch(`${u}/api/media/${encodeURIComponent(t)}/tracks`, { signal: d.signal }), !y.ok) throw new Error("Failed to fetch tracks");
|
|
6169
|
-
const b = await y.json(), g = (
|
|
6170
|
-
n({ audioTracks: h, subtitleTracks: p, selectedAudioIndex:
|
|
6183
|
+
const b = await y.json(), g = (S) => S.startsWith("/") ? `${u}${S}` : S, h = (b.audio || []).map((S) => ({ ...S, url: g(S.url) })), p = (b.subtitles || []).map((S) => ({ ...S, url: g(S.url) })), _ = h.findIndex((S) => S.lang === m), C = _ >= 0 ? _ : 0, M = p.findIndex((S) => S.lang === "eng"), w = M >= 0 ? M : 0;
|
|
6184
|
+
n({ audioTracks: h, subtitleTracks: p, selectedAudioIndex: C, selectedSubtitleIndex: w }), T("mse", "Tracks loaded", { audio: h.length, subs: p.length });
|
|
6171
6185
|
} catch (b) {
|
|
6172
6186
|
const g = Z(b);
|
|
6173
6187
|
if (g.name === "AbortError") return;
|
|
@@ -6191,20 +6205,20 @@ function sc(t) {
|
|
|
6191
6205
|
setSelectedSubtitleIndex: l
|
|
6192
6206
|
};
|
|
6193
6207
|
}
|
|
6194
|
-
const
|
|
6195
|
-
function
|
|
6196
|
-
return !t.roomPlaying || t.videoPaused ? "not-playing" : t.seekInFlight ? "seeking" : t.advancedMs >
|
|
6208
|
+
const oc = 100;
|
|
6209
|
+
function fc(t) {
|
|
6210
|
+
return !t.roomPlaying || t.videoPaused ? "not-playing" : t.seekInFlight ? "seeking" : t.advancedMs > oc ? "advancing" : "stalled";
|
|
6197
6211
|
}
|
|
6198
|
-
const yn = 4e4,
|
|
6199
|
-
function
|
|
6212
|
+
const yn = 4e4, lc = 3e3;
|
|
6213
|
+
function cc(t, e, n, a, s, r) {
|
|
6200
6214
|
const i = ke((p) => {
|
|
6201
6215
|
const _ = {};
|
|
6202
6216
|
return (r?.current ?? []).forEach((M, w) => {
|
|
6203
6217
|
M.hasIndex && (_[`audio:${w}`] = M.getTrackDiag(p));
|
|
6204
6218
|
}), _;
|
|
6205
6219
|
}), f = ke((p, _) => {
|
|
6206
|
-
for (const
|
|
6207
|
-
|
|
6220
|
+
for (const C of r?.current ?? [])
|
|
6221
|
+
C.hasIndex && (C.reconcileLoadedStates(), C.fetchNearby(p).catch((M) => {
|
|
6208
6222
|
M?.name !== "AbortError" && N("sync", "audio FM recovery fetchNearby failed", {
|
|
6209
6223
|
reason: _,
|
|
6210
6224
|
currentMs: Math.round(p),
|
|
@@ -6218,23 +6232,23 @@ function lc(t, e, n, a, s, r) {
|
|
|
6218
6232
|
function _() {
|
|
6219
6233
|
b.current && (clearTimeout(b.current), b.current = null);
|
|
6220
6234
|
}
|
|
6221
|
-
function
|
|
6235
|
+
function C() {
|
|
6222
6236
|
_();
|
|
6223
6237
|
const v = t.current;
|
|
6224
|
-
v && (g.current = v.currentTime, b.current = setTimeout(M,
|
|
6238
|
+
v && (g.current = v.currentTime, b.current = setTimeout(M, lc));
|
|
6225
6239
|
}
|
|
6226
6240
|
function M() {
|
|
6227
6241
|
b.current = null;
|
|
6228
6242
|
const v = t.current;
|
|
6229
6243
|
if (!v) return;
|
|
6230
|
-
const
|
|
6231
|
-
roomPlaying:
|
|
6244
|
+
const I = k.getState(), $ = n.current, B = fc({
|
|
6245
|
+
roomPlaying: I.snapshot.playing,
|
|
6232
6246
|
videoPaused: v.paused,
|
|
6233
6247
|
seekInFlight: !!$?.seekInFlight,
|
|
6234
6248
|
advancedMs: (v.currentTime - g.current) * 1e3
|
|
6235
6249
|
});
|
|
6236
6250
|
if (B !== "stalled") {
|
|
6237
|
-
h.current = null, B !== "not-playing" &&
|
|
6251
|
+
h.current = null, B !== "not-playing" && C();
|
|
6238
6252
|
return;
|
|
6239
6253
|
}
|
|
6240
6254
|
const O = v.currentTime * 1e3, z = e.current, K = Date.now();
|
|
@@ -6280,15 +6294,15 @@ function lc(t, e, n, a, s, r) {
|
|
|
6280
6294
|
}), h.current = null;
|
|
6281
6295
|
return;
|
|
6282
6296
|
}
|
|
6283
|
-
|
|
6297
|
+
C();
|
|
6284
6298
|
}
|
|
6285
6299
|
function w() {
|
|
6286
|
-
h.current = null,
|
|
6300
|
+
h.current = null, C();
|
|
6287
6301
|
}
|
|
6288
|
-
function
|
|
6302
|
+
function S() {
|
|
6289
6303
|
const v = p.currentTime * 1e3;
|
|
6290
6304
|
u.current = Date.now();
|
|
6291
|
-
const
|
|
6305
|
+
const I = k.getState(), $ = I.snapshot.playing, B = !!I.snapshot.leaderId && I.snapshot.leaderId === I.me.clientId, O = I.snapshot.playheadMs + (I.snapshot.playing ? Date.now() - I.snapshotReceivedAt : 0);
|
|
6292
6306
|
T("sync", "VIDEO waiting event", {
|
|
6293
6307
|
currentTime: p.currentTime.toFixed(2),
|
|
6294
6308
|
readyState: p.readyState,
|
|
@@ -6338,13 +6352,13 @@ function lc(t, e, n, a, s, r) {
|
|
|
6338
6352
|
}
|
|
6339
6353
|
B && $ && !l.current && (l.current = setTimeout(() => {
|
|
6340
6354
|
l.current = null;
|
|
6341
|
-
const V =
|
|
6342
|
-
X && !p.paused && p.readyState < 3 && !W && (N("sync", "Leader stall threshold reached — pausing room", { stallMs:
|
|
6343
|
-
},
|
|
6355
|
+
const V = k.getState(), X = !!V.snapshot.leaderId && V.snapshot.leaderId === V.me.clientId, W = !!n.current?.seekInFlight;
|
|
6356
|
+
X && !p.paused && p.readyState < 3 && !W && (N("sync", "Leader stall threshold reached — pausing room", { stallMs: Qn }), d.current = !0, Oe("pause"));
|
|
6357
|
+
}, Qn)), $ && !m.current && (y.current = p.currentTime, m.current = setTimeout(() => {
|
|
6344
6358
|
m.current = null;
|
|
6345
6359
|
const V = t.current;
|
|
6346
6360
|
if (!V) return;
|
|
6347
|
-
const W =
|
|
6361
|
+
const W = k.getState().snapshot.playing, he = e.current, ee = he?.getBufferedAheadMs(V.currentTime * 1e3) ?? -1, Q = V.currentTime - y.current;
|
|
6348
6362
|
if (!(W && Q < 0.5 && V.readyState < 3 && ee < 1e3)) {
|
|
6349
6363
|
T("sync", "STUCK-CHECK cleared — playback progressed, no reload", {
|
|
6350
6364
|
advancedSec: +Q.toFixed(2),
|
|
@@ -6365,15 +6379,15 @@ function lc(t, e, n, a, s, r) {
|
|
|
6365
6379
|
}, yn));
|
|
6366
6380
|
}
|
|
6367
6381
|
function F() {
|
|
6368
|
-
me.recordStallEnd(), l.current && (clearTimeout(l.current), l.current = null), m.current && (clearTimeout(m.current), m.current = null), h.current = null,
|
|
6369
|
-
const v =
|
|
6370
|
-
!
|
|
6382
|
+
me.recordStallEnd(), l.current && (clearTimeout(l.current), l.current = null), m.current && (clearTimeout(m.current), m.current = null), h.current = null, C();
|
|
6383
|
+
const v = k.getState(), I = v.snapshot.playing, $ = !!v.snapshot.leaderId && v.snapshot.leaderId === v.me.clientId;
|
|
6384
|
+
!I && !p.paused && o(p), $ && d.current && !I && (d.current = !1, N("sync", "Leader stall recovered — resuming room", { currentTime: p.currentTime.toFixed(2) }), Oe("play"));
|
|
6371
6385
|
const B = u.current !== null ? Date.now() - u.current : null;
|
|
6372
6386
|
u.current = null;
|
|
6373
|
-
const O =
|
|
6387
|
+
const O = k.getState(), z = O.snapshot.playheadMs + (O.snapshot.playing ? Date.now() - O.snapshotReceivedAt : 0), K = p.currentTime * 1e3;
|
|
6374
6388
|
T("sync", "VIDEO playing event", {
|
|
6375
6389
|
currentTime: p.currentTime.toFixed(2),
|
|
6376
|
-
shouldPlay:
|
|
6390
|
+
shouldPlay: I,
|
|
6377
6391
|
stallDurationMs: B,
|
|
6378
6392
|
// Positive = viewer is behind server; negative = viewer is ahead.
|
|
6379
6393
|
driftMs: B !== null ? Math.round(z - K) : null
|
|
@@ -6382,13 +6396,13 @@ function lc(t, e, n, a, s, r) {
|
|
|
6382
6396
|
function E() {
|
|
6383
6397
|
h.current = null, _();
|
|
6384
6398
|
}
|
|
6385
|
-
return p.addEventListener("waiting",
|
|
6386
|
-
p.removeEventListener("waiting",
|
|
6399
|
+
return p.addEventListener("waiting", S), p.addEventListener("playing", F), p.addEventListener("timeupdate", w), p.addEventListener("pause", E), p.paused || C(), () => {
|
|
6400
|
+
p.removeEventListener("waiting", S), p.removeEventListener("playing", F), p.removeEventListener("timeupdate", w), p.removeEventListener("pause", E), l.current && (clearTimeout(l.current), l.current = null), m.current && (clearTimeout(m.current), m.current = null), _(), h.current = null;
|
|
6387
6401
|
};
|
|
6388
6402
|
}, [a, t, e, n]);
|
|
6389
6403
|
}
|
|
6390
|
-
const
|
|
6391
|
-
function
|
|
6404
|
+
const dc = 1.5;
|
|
6405
|
+
function uc(t, e, n, a, s, r) {
|
|
6392
6406
|
const i = D(null), f = D(null), o = j(() => {
|
|
6393
6407
|
i.current && (clearInterval(i.current), i.current = null), f.current?.(), f.current = null;
|
|
6394
6408
|
}, []);
|
|
@@ -6415,9 +6429,9 @@ function dc(t, e, n, a, s, r) {
|
|
|
6415
6429
|
s({ bufferedEndMs: h });
|
|
6416
6430
|
}
|
|
6417
6431
|
};
|
|
6418
|
-
i.current = setInterval(y,
|
|
6432
|
+
i.current = setInterval(y, Yn);
|
|
6419
6433
|
const b = () => {
|
|
6420
|
-
performance.now() - m >=
|
|
6434
|
+
performance.now() - m >= Yn * dc && y();
|
|
6421
6435
|
};
|
|
6422
6436
|
if (l && (l.addEventListener("timeupdate", b), f.current = () => l.removeEventListener("timeupdate", b)), l && !n.current?.seekInFlight) {
|
|
6423
6437
|
m = performance.now();
|
|
@@ -6427,8 +6441,8 @@ function dc(t, e, n, a, s, r) {
|
|
|
6427
6441
|
return o;
|
|
6428
6442
|
}, [a, s, t, e, n, r, o]), { stopPrefetch: o };
|
|
6429
6443
|
}
|
|
6430
|
-
function
|
|
6431
|
-
const i =
|
|
6444
|
+
function hc(t, e, n, a, s, r) {
|
|
6445
|
+
const i = k((u) => u.snapshot), f = k((u) => u.loadGeneration), o = D(f), l = ke((u) => s(u)), d = ke((u) => r(u));
|
|
6432
6446
|
R(() => {
|
|
6433
6447
|
const u = t.current;
|
|
6434
6448
|
if (!u || !a) return;
|
|
@@ -6451,7 +6465,7 @@ function uc(t, e, n, a, s, r) {
|
|
|
6451
6465
|
m && y ? (T("sync", "Play/pause sync", { playing: m, videoPaused: y, currentTime: Math.round(u.currentTime * 1e3) }), l(u)) : !m && !y && (T("sync", "Play/pause sync", { playing: m, videoPaused: y, currentTime: Math.round(u.currentTime * 1e3) }), d(u));
|
|
6452
6466
|
}, [i.playing, a, t, e]);
|
|
6453
6467
|
}
|
|
6454
|
-
function
|
|
6468
|
+
function Ma(t, e) {
|
|
6455
6469
|
return new Promise((n, a) => {
|
|
6456
6470
|
const s = setTimeout(n, t);
|
|
6457
6471
|
e.addEventListener("abort", () => {
|
|
@@ -6459,8 +6473,8 @@ function Ea(t, e) {
|
|
|
6459
6473
|
}, { once: !0 });
|
|
6460
6474
|
});
|
|
6461
6475
|
}
|
|
6462
|
-
function
|
|
6463
|
-
const e =
|
|
6476
|
+
function gc(t) {
|
|
6477
|
+
const e = k((i) => i.playlist), n = k((i) => i.activePlaylistIndex), a = k((i) => i.snapshot.mediaId), s = e?.id, r = ke(() => e);
|
|
6464
6478
|
R(() => {
|
|
6465
6479
|
const i = r();
|
|
6466
6480
|
if (!i || !i.videos.some((o) => o.mediaId === a)) return;
|
|
@@ -6469,16 +6483,16 @@ function hc(t) {
|
|
|
6469
6483
|
for (let o = 0; o < i.videos.length; o++) {
|
|
6470
6484
|
if (f.signal.aborted) return;
|
|
6471
6485
|
if (o === n) continue;
|
|
6472
|
-
const l = i.videos[o], { mediaUrl: d, indexUrl: u } =
|
|
6486
|
+
const l = i.videos[o], { mediaUrl: d, indexUrl: u } = Wa(l.mediaId), m = 3e3, y = async () => {
|
|
6473
6487
|
for (; !f.signal.aborted && (t.current?.getPendingCount() ?? 0) !== 0; )
|
|
6474
6488
|
try {
|
|
6475
|
-
await
|
|
6489
|
+
await Ma(2e3, f.signal);
|
|
6476
6490
|
} catch {
|
|
6477
6491
|
return !1;
|
|
6478
6492
|
}
|
|
6479
6493
|
if (f.signal.aborted) return !1;
|
|
6480
6494
|
try {
|
|
6481
|
-
await
|
|
6495
|
+
await Ma(m, f.signal);
|
|
6482
6496
|
} catch {
|
|
6483
6497
|
return !1;
|
|
6484
6498
|
}
|
|
@@ -6500,25 +6514,25 @@ function hc(t) {
|
|
|
6500
6514
|
}
|
|
6501
6515
|
const { fragments: g, init_segment: h } = b;
|
|
6502
6516
|
if (!g?.length) continue;
|
|
6503
|
-
const p =
|
|
6504
|
-
if (
|
|
6517
|
+
const p = jn(g, 0), _ = Pe(g, Be), C = Te.getInit(l.mediaId) !== void 0, M = Te.getBufferedMs(l.mediaId, g) >= Be;
|
|
6518
|
+
if (C && M) {
|
|
6505
6519
|
T("prebuffer", `${l.mediaId} already fully pre-buffered, skipping`);
|
|
6506
6520
|
continue;
|
|
6507
6521
|
}
|
|
6508
|
-
if (T("prebuffer", `Pre-buffering ${l.mediaId} frags ${p}-${_}`), !
|
|
6522
|
+
if (T("prebuffer", `Pre-buffering ${l.mediaId} frags ${p}-${_}`), !C && h) {
|
|
6509
6523
|
if (!await y()) return;
|
|
6510
6524
|
try {
|
|
6511
6525
|
const w = await fetch(d, {
|
|
6512
6526
|
headers: {
|
|
6513
6527
|
Range: `bytes=${h.start_byte}-${h.end_byte}`,
|
|
6514
|
-
"X-Buffer-Ahead-Ms": String(
|
|
6528
|
+
"X-Buffer-Ahead-Ms": String(Xn)
|
|
6515
6529
|
// background fetch — low priority
|
|
6516
6530
|
},
|
|
6517
6531
|
signal: f.signal
|
|
6518
6532
|
});
|
|
6519
6533
|
if (w.ok) {
|
|
6520
|
-
const
|
|
6521
|
-
Te.storeInit(l.mediaId,
|
|
6534
|
+
const S = await w.arrayBuffer();
|
|
6535
|
+
Te.storeInit(l.mediaId, S), T("prebuffer", `Init cached for ${l.mediaId} (${S.byteLength}B)`);
|
|
6522
6536
|
}
|
|
6523
6537
|
} catch (w) {
|
|
6524
6538
|
if (f.signal.aborted) return;
|
|
@@ -6529,12 +6543,12 @@ function hc(t) {
|
|
|
6529
6543
|
if (f.signal.aborted) return;
|
|
6530
6544
|
if (Te.hasFragment(l.mediaId, w)) continue;
|
|
6531
6545
|
if (!await y()) return;
|
|
6532
|
-
const
|
|
6546
|
+
const S = g[w];
|
|
6533
6547
|
try {
|
|
6534
6548
|
const F = await fetch(d, {
|
|
6535
6549
|
headers: {
|
|
6536
|
-
Range: `bytes=${
|
|
6537
|
-
"X-Buffer-Ahead-Ms": String(
|
|
6550
|
+
Range: `bytes=${S.start_byte}-${S.end_byte}`,
|
|
6551
|
+
"X-Buffer-Ahead-Ms": String(Xn)
|
|
6538
6552
|
},
|
|
6539
6553
|
signal: f.signal
|
|
6540
6554
|
});
|
|
@@ -6558,11 +6572,11 @@ function hc(t) {
|
|
|
6558
6572
|
}, [s, n, a, t]);
|
|
6559
6573
|
}
|
|
6560
6574
|
const De = "bg-play";
|
|
6561
|
-
function
|
|
6562
|
-
const t =
|
|
6575
|
+
function mc() {
|
|
6576
|
+
const t = k.getState();
|
|
6563
6577
|
return !!t.snapshot.leaderId && t.snapshot.leaderId === t.me.clientId;
|
|
6564
6578
|
}
|
|
6565
|
-
function
|
|
6579
|
+
function pc(t) {
|
|
6566
6580
|
return typeof Image > "u" ? Promise.resolve(null) : t.reduce(
|
|
6567
6581
|
(e, n) => e.then((a) => a ?? new Promise((s) => {
|
|
6568
6582
|
const r = new Image();
|
|
@@ -6571,11 +6585,11 @@ function mc(t) {
|
|
|
6571
6585
|
Promise.resolve(null)
|
|
6572
6586
|
);
|
|
6573
6587
|
}
|
|
6574
|
-
function
|
|
6588
|
+
function bc(t, e, n, a, s, r) {
|
|
6575
6589
|
const i = D(!1), f = D(0), o = ke((d) => r(d)), l = ke((d) => {
|
|
6576
6590
|
const u = t.current, m = e.current;
|
|
6577
6591
|
if (!u || !s) return;
|
|
6578
|
-
const y =
|
|
6592
|
+
const y = k.getState(), b = u.currentTime * 1e3, g = Rl(y.snapshot, y.snapshotReceivedAt, Date.now()), h = Nl({
|
|
6579
6593
|
roomPlaying: y.snapshot.playing,
|
|
6580
6594
|
seekInFlight: !!m?.seekInFlight,
|
|
6581
6595
|
elementPaused: u.paused,
|
|
@@ -6594,8 +6608,8 @@ function pc(t, e, n, a, s, r) {
|
|
|
6594
6608
|
const d = t.current;
|
|
6595
6609
|
if (!d || !s) return;
|
|
6596
6610
|
const u = () => {
|
|
6597
|
-
const y =
|
|
6598
|
-
|
|
6611
|
+
const y = k.getState();
|
|
6612
|
+
Al({
|
|
6599
6613
|
hidden: document.visibilityState === "hidden",
|
|
6600
6614
|
roomPlaying: y.snapshot.playing,
|
|
6601
6615
|
seekInFlight: !!e.current?.seekInFlight,
|
|
@@ -6621,12 +6635,12 @@ function pc(t, e, n, a, s, r) {
|
|
|
6621
6635
|
artwork: M ? [{ src: M }] : []
|
|
6622
6636
|
}));
|
|
6623
6637
|
};
|
|
6624
|
-
b(null),
|
|
6638
|
+
b(null), pc(Ll(n).map(Js)).then(b);
|
|
6625
6639
|
const g = (M) => () => {
|
|
6626
|
-
const w =
|
|
6627
|
-
switch (T(De, "media session press", { action: M, result:
|
|
6640
|
+
const w = k.getState(), S = Cl(M, { isLeader: mc(), roomPlaying: w.snapshot.playing });
|
|
6641
|
+
switch (T(De, "media session press", { action: M, result: S.kind }), M === "pause" && (f.current = Date.now()), S.kind) {
|
|
6628
6642
|
case "control":
|
|
6629
|
-
Oe(
|
|
6643
|
+
Oe(S.control), S.control === "pause" && d.pause();
|
|
6630
6644
|
break;
|
|
6631
6645
|
case "local-pause":
|
|
6632
6646
|
i.current = !0, d.pause();
|
|
@@ -6646,8 +6660,8 @@ function pc(t, e, n, a, s, r) {
|
|
|
6646
6660
|
for (const [M, w] of h)
|
|
6647
6661
|
try {
|
|
6648
6662
|
u.setActionHandler(M, w);
|
|
6649
|
-
} catch (
|
|
6650
|
-
T(De, "media session action unsupported", { action: M, ...Z(
|
|
6663
|
+
} catch (S) {
|
|
6664
|
+
T(De, "media session action unsupported", { action: M, ...Z(S) });
|
|
6651
6665
|
}
|
|
6652
6666
|
const p = () => {
|
|
6653
6667
|
const M = a / 1e3;
|
|
@@ -6659,11 +6673,11 @@ function pc(t, e, n, a, s, r) {
|
|
|
6659
6673
|
}
|
|
6660
6674
|
}, _ = () => {
|
|
6661
6675
|
u.playbackState = "playing", p();
|
|
6662
|
-
},
|
|
6676
|
+
}, C = () => {
|
|
6663
6677
|
u.playbackState = "paused", p();
|
|
6664
6678
|
};
|
|
6665
|
-
return d.addEventListener("play", _), d.addEventListener("pause",
|
|
6666
|
-
m = !0, d.removeEventListener("play", _), d.removeEventListener("pause",
|
|
6679
|
+
return d.addEventListener("play", _), d.addEventListener("pause", C), d.addEventListener("seeked", p), d.addEventListener("ratechange", p), p(), () => {
|
|
6680
|
+
m = !0, d.removeEventListener("play", _), d.removeEventListener("pause", C), d.removeEventListener("seeked", p), d.removeEventListener("ratechange", p);
|
|
6667
6681
|
for (const [M] of h)
|
|
6668
6682
|
try {
|
|
6669
6683
|
u.setActionHandler(M, null);
|
|
@@ -6696,12 +6710,12 @@ function pc(t, e, n, a, s, r) {
|
|
|
6696
6710
|
};
|
|
6697
6711
|
}, [t]);
|
|
6698
6712
|
}
|
|
6699
|
-
const Mt = 5e3,
|
|
6700
|
-
function
|
|
6713
|
+
const Mt = 5e3, Ta = ".ctr-bar-wrapper";
|
|
6714
|
+
function yc(t, e, n, a) {
|
|
6701
6715
|
const s = ke((i) => {
|
|
6702
6716
|
const f = t.current;
|
|
6703
6717
|
if (!f) return;
|
|
6704
|
-
const o = f.querySelector(
|
|
6718
|
+
const o = f.querySelector(Ta), l = document.activeElement, d = Qa(l) ? "text" : o && l && o.contains(l) ? "bar" : !l || l === document.body || l === f ? "idle" : "elsewhere", u = Ai({
|
|
6705
6719
|
key: i.key,
|
|
6706
6720
|
back: qe(i),
|
|
6707
6721
|
modifier: i.ctrlKey || i.metaKey || i.altKey,
|
|
@@ -6709,7 +6723,7 @@ function bc(t, e, n, a) {
|
|
|
6709
6723
|
focus: d
|
|
6710
6724
|
});
|
|
6711
6725
|
if (u === "ignore") {
|
|
6712
|
-
d === "text" && o && l && o.contains(l) && (n(Mt),
|
|
6726
|
+
d === "text" && o && l && o.contains(l) && (n(Mt), Aa(i, o, l));
|
|
6713
6727
|
return;
|
|
6714
6728
|
}
|
|
6715
6729
|
const m = l?.hasAttribute(mt) ?? !1;
|
|
@@ -6723,21 +6737,21 @@ function bc(t, e, n, a) {
|
|
|
6723
6737
|
}
|
|
6724
6738
|
if (n(Mt), u === "show") {
|
|
6725
6739
|
if (d !== "bar" || !o || !l) return;
|
|
6726
|
-
if (i.key === "Enter" &&
|
|
6740
|
+
if (i.key === "Enter" && Ka(l) === "range") {
|
|
6727
6741
|
i.preventDefault(), m ? l.removeAttribute(mt) : l.setAttribute(mt, "");
|
|
6728
6742
|
return;
|
|
6729
6743
|
}
|
|
6730
|
-
|
|
6744
|
+
Aa(i, o, l);
|
|
6731
6745
|
return;
|
|
6732
6746
|
}
|
|
6733
|
-
i.preventDefault(), T("controls", `remote key ${u}`, { key: i.key }), u === "enter-bar" && o &&
|
|
6747
|
+
i.preventDefault(), T("controls", `remote key ${u}`, { key: i.key }), u === "enter-bar" && o && Ja(o)?.focus({ preventScroll: !0 });
|
|
6734
6748
|
});
|
|
6735
6749
|
R(() => {
|
|
6736
6750
|
const i = (f) => s(f);
|
|
6737
6751
|
return window.addEventListener("keydown", i, !0), () => window.removeEventListener("keydown", i, !0);
|
|
6738
6752
|
}, []);
|
|
6739
6753
|
const r = ke((i) => {
|
|
6740
|
-
const f = t.current?.querySelector(
|
|
6754
|
+
const f = t.current?.querySelector(Ta);
|
|
6741
6755
|
f && i.target instanceof Node && f.contains(i.target) && n(Mt);
|
|
6742
6756
|
});
|
|
6743
6757
|
R(() => {
|
|
@@ -6751,20 +6765,20 @@ function bc(t, e, n, a) {
|
|
|
6751
6765
|
};
|
|
6752
6766
|
}, [t]);
|
|
6753
6767
|
}
|
|
6754
|
-
function
|
|
6755
|
-
const a = n instanceof HTMLInputElement && n.type !== "range" ? n : null, s = a ? { atStart: (a.selectionEnd ?? 0) === 0, atEnd: (a.selectionStart ?? 0) === a.value.length } : void 0, r = a?.getAttribute("aria-expanded") === "true", i =
|
|
6768
|
+
function Aa(t, e, n) {
|
|
6769
|
+
const a = n instanceof HTMLInputElement && n.type !== "range" ? n : null, s = a ? { atStart: (a.selectionEnd ?? 0) === 0, atEnd: (a.selectionStart ?? 0) === a.value.length } : void 0, r = a?.getAttribute("aria-expanded") === "true", i = Ci(t.key, Ka(n), n.hasAttribute(mt), s, r);
|
|
6756
6770
|
if (i === null) return;
|
|
6757
6771
|
t.preventDefault();
|
|
6758
|
-
const f =
|
|
6772
|
+
const f = Va(e), o = f.indexOf(n);
|
|
6759
6773
|
f[Math.min(f.length - 1, Math.max(0, o + i))]?.focus({ preventScroll: !1 });
|
|
6760
6774
|
}
|
|
6761
|
-
const
|
|
6775
|
+
const wc = 3e5, _c = 1, vc = 1;
|
|
6762
6776
|
function wn(t) {
|
|
6763
6777
|
ae("buffer", "initializePlayback threw", Z(t));
|
|
6764
6778
|
}
|
|
6765
|
-
function
|
|
6766
|
-
const a = D(null), s = D(null), [r, i] = L(!1), [f, o] = L(!1), { controlsVisible: l, showControls: d, hideControls: u, setControlsHeld: m } =
|
|
6767
|
-
|
|
6779
|
+
function kc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
6780
|
+
const a = D(null), s = D(null), [r, i] = L(!1), [f, o] = L(!1), { controlsVisible: l, showControls: d, hideControls: u, setControlsHeld: m } = nc();
|
|
6781
|
+
yc(s, l, d, u), R(() => {
|
|
6768
6782
|
const A = () => o(!!document.fullscreenElement);
|
|
6769
6783
|
return document.addEventListener("fullscreenchange", A), () => document.removeEventListener("fullscreenchange", A);
|
|
6770
6784
|
}, []);
|
|
@@ -6775,27 +6789,27 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6775
6789
|
initSegment: h,
|
|
6776
6790
|
audioTracks: p,
|
|
6777
6791
|
contentToken: _
|
|
6778
|
-
} =
|
|
6792
|
+
} = sc(e), C = j((A) => {
|
|
6779
6793
|
if (!_) return null;
|
|
6780
6794
|
const H = t.replace(new RegExp(`/${Ot.replace(/\./g, "\\.")}$`), "");
|
|
6781
6795
|
return H === t ? null : { baseUrl: H, token: _, trackId: A };
|
|
6782
|
-
}, [_, t]), w = g !== null && p.length > 0,
|
|
6796
|
+
}, [_, t]), w = g !== null && p.length > 0, S = k((A) => A.readiness), F = Qs(), E = st();
|
|
6783
6797
|
R(() => {
|
|
6784
6798
|
const A = s.current;
|
|
6785
6799
|
if (!A) return;
|
|
6786
6800
|
const H = document.activeElement;
|
|
6787
6801
|
if (H && H !== document.body && H !== A) return;
|
|
6788
|
-
const ce = A.querySelector(".ctr-bar-wrapper"), q = ce?.querySelector("[data-remote-primary]"), de = F && ce && !q?.disabled ?
|
|
6802
|
+
const ce = A.querySelector(".ctr-bar-wrapper"), q = ce?.querySelector("[data-remote-primary]"), de = F && ce && !q?.disabled ? Ja(ce) : null;
|
|
6789
6803
|
de ? (d(Mt), de.focus({ preventScroll: !0 })) : H !== A && A.focus({ preventScroll: !0 });
|
|
6790
|
-
}, [F,
|
|
6791
|
-
const v = D(!1),
|
|
6804
|
+
}, [F, S.ready, E, d]);
|
|
6805
|
+
const v = D(!1), I = D(!1), $ = D(null), B = D(null), O = D(null), z = D(0), K = D(0), le = D(null), [V, X] = L(0), W = D([]), he = D([]), ee = D(-1), Q = D(!1), P = D(null), te = D(0), Ae = D(null), Ke = D(0), Dt = k((A) => A.bufferState), _t = k((A) => A.setBufferState), {
|
|
6792
6806
|
audioTracks: Re,
|
|
6793
6807
|
subtitleTracks: ge,
|
|
6794
6808
|
selectedAudioIndex: Ee,
|
|
6795
6809
|
setSelectedAudioIndex: it,
|
|
6796
6810
|
selectedSubtitleIndex: ot,
|
|
6797
6811
|
setSelectedSubtitleIndex: Ve
|
|
6798
|
-
} =
|
|
6812
|
+
} = ic(n), Me = k((A) => A.mediaPrefs), Yt = k((A) => A.mutedForAutoplay), Xt = k((A) => A.setMutedForAutoplay), Pt = k((A) => A.setSubtitlesEnabled), Zt = k((A) => A.setSubtitleStyle), Je = k((A) => A.setPreferredAudioLang), Qe = Me.subtitlesEnabled, vt = Me.subtitleStyle, en = Re[Ee]?.lang, tn = ge.some((A) => A.lang === "eng"), [U, se] = L(null), we = ql({
|
|
6799
6813
|
override: U,
|
|
6800
6814
|
globalEnabled: Qe,
|
|
6801
6815
|
selectedAudioLang: en,
|
|
@@ -6804,28 +6818,28 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6804
6818
|
const A = !we;
|
|
6805
6819
|
se(A), Pt(A);
|
|
6806
6820
|
}, [we, Pt]), Bt = j((A) => {
|
|
6807
|
-
const H =
|
|
6821
|
+
const H = k.getState();
|
|
6808
6822
|
Gr(A, {
|
|
6809
6823
|
userWantsMuted: H.mediaPrefs.muted,
|
|
6810
6824
|
onMutedBridge: () => H.setMutedForAutoplay(!0),
|
|
6811
6825
|
onUnmuted: () => H.setMutedForAutoplay(!1),
|
|
6812
6826
|
label: "video"
|
|
6813
6827
|
});
|
|
6814
|
-
}, []),
|
|
6828
|
+
}, []), Un = j((A) => {
|
|
6815
6829
|
A.pause();
|
|
6816
|
-
}, []), [Jr,
|
|
6817
|
-
Qr !== n && (Yr(n), se(null),
|
|
6830
|
+
}, []), [Jr, zn] = L(0), [Qr, Yr] = L(n);
|
|
6831
|
+
Qr !== n && (Yr(n), se(null), zn(0)), R(() => {
|
|
6818
6832
|
const A = a.current;
|
|
6819
6833
|
if (!A) return;
|
|
6820
6834
|
const H = () => {
|
|
6821
|
-
|
|
6835
|
+
zn(Math.round(A.currentTime * 1e3));
|
|
6822
6836
|
};
|
|
6823
6837
|
return A.addEventListener("timeupdate", H), () => A.removeEventListener("timeupdate", H);
|
|
6824
6838
|
}, []);
|
|
6825
6839
|
const kt = j((A) => {
|
|
6826
6840
|
_t({ isBuffering: A });
|
|
6827
|
-
}, [_t]),
|
|
6828
|
-
if (K.current >=
|
|
6841
|
+
}, [_t]), Wn = j((A) => {
|
|
6842
|
+
if (K.current >= vc) {
|
|
6829
6843
|
An("phantom-recreate-exhausted", { reason: A, recreates: K.current, mediaId: n });
|
|
6830
6844
|
return;
|
|
6831
6845
|
}
|
|
@@ -6836,8 +6850,8 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6836
6850
|
}, [n]);
|
|
6837
6851
|
async function nn() {
|
|
6838
6852
|
const A = O.current, H = a.current;
|
|
6839
|
-
if (!A || !y.length ||
|
|
6840
|
-
const ce =
|
|
6853
|
+
if (!A || !y.length || I.current) return;
|
|
6854
|
+
const ce = k.getState().snapshot, q = ce.playheadMs || 0;
|
|
6841
6855
|
T("buffer", "Initializing playback", { mediaId: n, startMs: q, playing: ce.playing }), A.setPlayhead(q);
|
|
6842
6856
|
const de = performance.now();
|
|
6843
6857
|
try {
|
|
@@ -6853,20 +6867,20 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6853
6867
|
await Promise.allSettled(re);
|
|
6854
6868
|
const J = ue.map(
|
|
6855
6869
|
(G) => G.waitForBuffered(q + Be, ie)
|
|
6856
|
-
),
|
|
6857
|
-
if (await Promise.allSettled(J),
|
|
6870
|
+
), Ce = await A.waitForBuffered(q + Be, ie);
|
|
6871
|
+
if (await Promise.allSettled(J), Ce || N("buffer", "Buffer gate timeout — proceeding with partial buffer", {
|
|
6858
6872
|
startMs: q,
|
|
6859
6873
|
aheadMs: Math.round(A.getBufferedAheadMs(q)),
|
|
6860
6874
|
targetMs: Be
|
|
6861
6875
|
}), A.isDisposed) return;
|
|
6862
|
-
if (A.getBufferedAheadMs(q) >
|
|
6876
|
+
if (A.getBufferedAheadMs(q) > wc && A.getLoadedCount() === 0) {
|
|
6863
6877
|
A.dumpBufferDiagnostics(q, "phantom-detected"), N("buffer", "PHANTOM-BUFFER detected at gate — recreating MediaSource", {
|
|
6864
6878
|
gateAheadMs: Math.round(A.getBufferedAheadMs(q)),
|
|
6865
6879
|
loaded: A.getLoadedCount(),
|
|
6866
6880
|
startMs: Math.round(q),
|
|
6867
6881
|
recreateAttempt: K.current,
|
|
6868
6882
|
mediaId: n
|
|
6869
|
-
}),
|
|
6883
|
+
}), Wn("phantom-buffer");
|
|
6870
6884
|
return;
|
|
6871
6885
|
}
|
|
6872
6886
|
const Ye = Math.round(performance.now() - de);
|
|
@@ -6874,7 +6888,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6874
6888
|
aheadMs: Math.round(A.getBufferedAheadMs(q)),
|
|
6875
6889
|
totalMs: Ye
|
|
6876
6890
|
});
|
|
6877
|
-
const Le =
|
|
6891
|
+
const Le = Ce ? "gate-pass" : "gate-timeout";
|
|
6878
6892
|
A.emitInitDigest("video", Le), ue.forEach((G, oe) => G.emitInitDigest(`audio:${oe}`, Le)), v.current || (v.current = !0, Xs(n));
|
|
6879
6893
|
let Y = q;
|
|
6880
6894
|
if (H && Y > 0) {
|
|
@@ -6885,15 +6899,15 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6885
6899
|
}
|
|
6886
6900
|
H.currentTime = Y / 1e3, await qr(H, 3e3);
|
|
6887
6901
|
}
|
|
6888
|
-
te.current = Y, i(!0),
|
|
6902
|
+
te.current = Y, i(!0), I.current = !0, z.current = 0, Sa() && N("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: n }), Vl(), T("buffer", "initializePlayback complete", {
|
|
6889
6903
|
mediaId: n,
|
|
6890
6904
|
startMs: q,
|
|
6891
6905
|
seekMs: Y,
|
|
6892
6906
|
initDurationMs: Math.round(performance.now() - de)
|
|
6893
6907
|
});
|
|
6894
|
-
const Xe =
|
|
6908
|
+
const Xe = k.getState().snapshot;
|
|
6895
6909
|
if (H && Xe.playing && H.paused && (T("buffer", "initializePlayback: calling play()", { playing: Xe.playing }), Bt(H)), A.isDisposed) return;
|
|
6896
|
-
const be =
|
|
6910
|
+
const be = k.getState();
|
|
6897
6911
|
if (!(!!be.snapshot.leaderId && be.snapshot.leaderId === be.me.clientId) && be.snapshot.playing)
|
|
6898
6912
|
try {
|
|
6899
6913
|
const G = Date.now() - be.snapshotReceivedAt, oe = be.snapshot.playheadMs + G;
|
|
@@ -6907,7 +6921,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6907
6921
|
}), oe > q) {
|
|
6908
6922
|
const fe = P.current;
|
|
6909
6923
|
if (H && fe) {
|
|
6910
|
-
const _e =
|
|
6924
|
+
const _e = k.getState(), ve = Date.now() - _e.snapshotReceivedAt, Ze = _e.snapshot.playheadMs + ve, $e = Ze > oe ? Ze : oe;
|
|
6911
6925
|
await fe.submit({
|
|
6912
6926
|
targetMs: $e,
|
|
6913
6927
|
priority: Lt.VIEWER_CORRECTION,
|
|
@@ -6934,12 +6948,12 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6934
6948
|
});
|
|
6935
6949
|
}
|
|
6936
6950
|
} catch (ue) {
|
|
6937
|
-
if (!
|
|
6951
|
+
if (!I.current && A.getLoadedCount() > 0) {
|
|
6938
6952
|
N("buffer", "ensureBuffered failed but have buffer — setting mseReady for recovery", {
|
|
6939
6953
|
loadedCount: A.getLoadedCount(),
|
|
6940
6954
|
error: ue?.message
|
|
6941
|
-
}), i(!0),
|
|
6942
|
-
const re =
|
|
6955
|
+
}), i(!0), I.current = !0;
|
|
6956
|
+
const re = k.getState().snapshot;
|
|
6943
6957
|
H && re.playing && H.paused && Bt(H);
|
|
6944
6958
|
} else {
|
|
6945
6959
|
const re = ue?.message || "";
|
|
@@ -6950,18 +6964,18 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6950
6964
|
return;
|
|
6951
6965
|
}
|
|
6952
6966
|
const ie = re.includes("SourceBuffer is full"), J = re.includes("init segment failed");
|
|
6953
|
-
z.current += 1, ie || J || z.current >
|
|
6967
|
+
z.current += 1, ie || J || z.current > _c ? (ae("buffer", "Initialize playback failed — recreating MediaSource", {
|
|
6954
6968
|
error: re,
|
|
6955
6969
|
mediaId: n,
|
|
6956
6970
|
attempt: z.current,
|
|
6957
6971
|
sbFull: ie,
|
|
6958
6972
|
initFailed: J
|
|
6959
|
-
}),
|
|
6973
|
+
}), Wn(ie ? "sourcebuffer-full" : J ? "init-failed" : "init-retry-cap")) : (ae("buffer", "Initialize playback error — will retry in 3s", {
|
|
6960
6974
|
error: re,
|
|
6961
6975
|
mediaId: n,
|
|
6962
6976
|
attempt: z.current
|
|
6963
6977
|
}), setTimeout(() => {
|
|
6964
|
-
O.current && !A.isDisposed && !
|
|
6978
|
+
O.current && !A.isDisposed && !I.current && (T("buffer", "Retrying initializePlayback"), nn().catch(wn));
|
|
6965
6979
|
}, 3e3));
|
|
6966
6980
|
}
|
|
6967
6981
|
}
|
|
@@ -6971,7 +6985,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6971
6985
|
selectedAudioIndex: Ee,
|
|
6972
6986
|
mseAudioTracks: p,
|
|
6973
6987
|
fragments: y,
|
|
6974
|
-
deliveryFor:
|
|
6988
|
+
deliveryFor: C,
|
|
6975
6989
|
initializePlayback: nn
|
|
6976
6990
|
}));
|
|
6977
6991
|
R(() => {
|
|
@@ -6985,7 +6999,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6985
6999
|
initializePlayback: ue
|
|
6986
7000
|
} = Xr();
|
|
6987
7001
|
le.current !== n && (le.current = n, K.current = 0, z.current = 0);
|
|
6988
|
-
const re =
|
|
7002
|
+
const re = Sa();
|
|
6989
7003
|
re && N("buffer", "POST-AUTO-RELOAD — this load follows an auto-reload recovery", {
|
|
6990
7004
|
reloadAtMs: re,
|
|
6991
7005
|
sinceReloadMs: Date.now() - re,
|
|
@@ -6994,27 +7008,27 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6994
7008
|
let ie = null;
|
|
6995
7009
|
const J = new MediaSource();
|
|
6996
7010
|
B.current = J;
|
|
6997
|
-
const
|
|
6998
|
-
O.current =
|
|
7011
|
+
const Ce = new We(kt);
|
|
7012
|
+
O.current = Ce;
|
|
6999
7013
|
const Ye = ++Ke.current;
|
|
7000
|
-
window.__FRAGMENT_MANAGER__ =
|
|
7001
|
-
const Le = new
|
|
7014
|
+
window.__FRAGMENT_MANAGER__ = Ce, window.__AUDIO_FRAGMENT_MANAGERS__ = W.current;
|
|
7015
|
+
const Le = new Yl({
|
|
7002
7016
|
videoRef: a,
|
|
7003
7017
|
fragmentManagerRef: O,
|
|
7004
7018
|
audioFragmentManagersRef: W
|
|
7005
7019
|
});
|
|
7006
|
-
P.current = Le, window.__SEEK_COORDINATOR__ = Le,
|
|
7020
|
+
P.current = Le, window.__SEEK_COORDINATOR__ = Le, Xl();
|
|
7007
7021
|
const Y = a.current, Xe = () => {
|
|
7008
7022
|
const G = Y?.error;
|
|
7009
7023
|
G && (ae("video", `Media error code=${G.code}: ${G.message}`, {
|
|
7010
7024
|
code: G.code,
|
|
7011
7025
|
networkState: Y.networkState,
|
|
7012
7026
|
readyState: Y.readyState
|
|
7013
|
-
}),
|
|
7027
|
+
}), k.getState().pushToast("error", "Video playback error. Try reloading."));
|
|
7014
7028
|
}, be = t.replace(new RegExp(`/${Ot.replace(/\./g, "\\.")}$`), ""), Fe = () => {
|
|
7015
7029
|
try {
|
|
7016
7030
|
const G = `video/mp4; codecs="${g}"`;
|
|
7017
|
-
MediaSource.isTypeSupported(G) || (N("mse", `Codec not supported by browser MSE: ${G}`),
|
|
7031
|
+
MediaSource.isTypeSupported(G) || (N("mse", `Codec not supported by browser MSE: ${G}`), k.getState().pushToast("error", "Video codec not supported by your browser.")), T("mse", `addSourceBuffer: ${G}`);
|
|
7018
7032
|
const oe = J.addSourceBuffer(G);
|
|
7019
7033
|
if ($.current = oe, oe.addEventListener("error", () => {
|
|
7020
7034
|
const fe = a.current?.error;
|
|
@@ -7023,7 +7037,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7023
7037
|
readyState: J.readyState,
|
|
7024
7038
|
updating: oe.updating
|
|
7025
7039
|
});
|
|
7026
|
-
}),
|
|
7040
|
+
}), Ce.setSourceBuffer(oe, J), A) {
|
|
7027
7041
|
const fe = Math.max(0, Math.min(H, ce.length - 1)), _e = ce[fe], ve = _e.mse_codec;
|
|
7028
7042
|
if (!MediaSource.isTypeSupported(ve))
|
|
7029
7043
|
N("mse", `Audio codec not supported: ${ve}, track=${_e.track_id}`);
|
|
@@ -7049,7 +7063,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7049
7063
|
Ze && (Ze.muted = !1);
|
|
7050
7064
|
}
|
|
7051
7065
|
if (q.length) {
|
|
7052
|
-
if (
|
|
7066
|
+
if (Ce.setIndex(q, t, h, n, de()), Ce.epoch = Ye, A) {
|
|
7053
7067
|
const fe = ee.current, _e = W.current[0], ve = fe >= 0 ? ce[fe] : void 0;
|
|
7054
7068
|
if (_e && ve) {
|
|
7055
7069
|
const Ze = `${be}/${ve.path}`.replace(/\\/g, "/");
|
|
@@ -7069,7 +7083,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7069
7083
|
}
|
|
7070
7084
|
};
|
|
7071
7085
|
return Y && (J.addEventListener("sourceopen", Fe, { once: !0 }), ie = URL.createObjectURL(J), Y.src = ie, Y.addEventListener("error", Xe)), () => {
|
|
7072
|
-
Y?.pause(), Y && Y.removeEventListener("error", Xe), J.removeEventListener("sourceopen", Fe),
|
|
7086
|
+
Y?.pause(), Y && Y.removeEventListener("error", Xe), J.removeEventListener("sourceopen", Fe), Zl(), Le.dispose(), P.current = null, Ce.dispose(), O.current = null, window.__FRAGMENT_MANAGER__ = null, window.__AUDIO_FRAGMENT_MANAGERS__ = null;
|
|
7073
7087
|
for (const G of W.current) G.dispose();
|
|
7074
7088
|
if (W.current = [], J.readyState === "open") {
|
|
7075
7089
|
for (const G of [$.current, ...he.current])
|
|
@@ -7084,14 +7098,14 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7084
7098
|
Y.removeAttribute("src"), Y.load();
|
|
7085
7099
|
} catch {
|
|
7086
7100
|
}
|
|
7087
|
-
Ae.current?.(),
|
|
7101
|
+
Ae.current?.(), I.current = !1, v.current = !1, $.current = null, i(!1);
|
|
7088
7102
|
};
|
|
7089
7103
|
}, [t, n, g, h, kt, V]);
|
|
7090
7104
|
const Zr = ke(() => {
|
|
7091
7105
|
const A = O.current, H = Ke.current;
|
|
7092
7106
|
if (B.current?.readyState === "open" && $.current && y.length && A) {
|
|
7093
7107
|
if (A.hasIndex && A.epoch === H) return;
|
|
7094
|
-
if (A.setIndex(y, t, h, n,
|
|
7108
|
+
if (A.setIndex(y, t, h, n, C()), A.epoch = H, w) {
|
|
7095
7109
|
const ce = t.replace(new RegExp(`/${Ot.replace(/\./g, "\\.")}$`), ""), q = ee.current, de = W.current[0], ue = q >= 0 ? p[q] : void 0;
|
|
7096
7110
|
if (de && ue && !(de.hasIndex && de.epoch === H)) {
|
|
7097
7111
|
const re = `${ce}/${ue.path}`.replace(/\\/g, "/");
|
|
@@ -7100,11 +7114,11 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7100
7114
|
re,
|
|
7101
7115
|
ue.init_segment,
|
|
7102
7116
|
`${n}::audio::${ue.track_id}`,
|
|
7103
|
-
|
|
7117
|
+
C(ue.track_id)
|
|
7104
7118
|
), de.epoch = H;
|
|
7105
7119
|
}
|
|
7106
7120
|
}
|
|
7107
|
-
|
|
7121
|
+
I.current || nn().catch(wn);
|
|
7108
7122
|
}
|
|
7109
7123
|
});
|
|
7110
7124
|
R(() => {
|
|
@@ -7173,7 +7187,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7173
7187
|
Ye,
|
|
7174
7188
|
q.init_segment,
|
|
7175
7189
|
`${n}::audio::${q.track_id}`,
|
|
7176
|
-
|
|
7190
|
+
C(q.track_id)
|
|
7177
7191
|
), J.epoch = de, W.current.length = 0, W.current.push(J), ee.current = ce;
|
|
7178
7192
|
const Le = P.current?.inFlightTargetMs ?? Math.round(H.currentTime * 1e3), Y = new AbortController();
|
|
7179
7193
|
J.setPlayhead(Le);
|
|
@@ -7186,11 +7200,11 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7186
7200
|
Q.current = !1;
|
|
7187
7201
|
}
|
|
7188
7202
|
})().catch((re) => ae("audio", "MSE audio swap failed", Z(re)));
|
|
7189
|
-
}, [w, r, Ee, p, n, t, kt,
|
|
7190
|
-
const { stopPrefetch:
|
|
7191
|
-
|
|
7192
|
-
Ae.current =
|
|
7193
|
-
}, [
|
|
7203
|
+
}, [w, r, Ee, p, n, t, kt, C]), hc(P, a, te, r, Bt, Un), cc(a, O, P, r, Un, W), bc(a, P, n, b ?? 0, r, Bt);
|
|
7204
|
+
const { stopPrefetch: Gn } = uc(a, O, P, r, _t, W);
|
|
7205
|
+
gc(O), R(() => {
|
|
7206
|
+
Ae.current = Gn;
|
|
7207
|
+
}, [Gn]);
|
|
7194
7208
|
const es = j(() => {
|
|
7195
7209
|
const A = a.current?.parentElement;
|
|
7196
7210
|
A && (document.fullscreenElement ? document.exitFullscreen().catch((H) => N("ui", "exitFullscreen failed", Z(H))) : A.requestFullscreen().catch((H) => N("ui", "requestFullscreen failed", Z(H))));
|
|
@@ -7219,7 +7233,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7219
7233
|
}
|
|
7220
7234
|
),
|
|
7221
7235
|
/* @__PURE__ */ c(
|
|
7222
|
-
|
|
7236
|
+
kl,
|
|
7223
7237
|
{
|
|
7224
7238
|
subtitleUrl: ns,
|
|
7225
7239
|
videoRef: a,
|
|
@@ -7227,9 +7241,9 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7227
7241
|
enabled: we
|
|
7228
7242
|
}
|
|
7229
7243
|
),
|
|
7230
|
-
/* @__PURE__ */ c(
|
|
7244
|
+
/* @__PURE__ */ c(Fl, { mediaId: n, visible: l }),
|
|
7231
7245
|
/* @__PURE__ */ c(
|
|
7232
|
-
|
|
7246
|
+
Ml,
|
|
7233
7247
|
{
|
|
7234
7248
|
videoRef: a,
|
|
7235
7249
|
mediaId: n,
|
|
@@ -7269,7 +7283,7 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7269
7283
|
]
|
|
7270
7284
|
}
|
|
7271
7285
|
),
|
|
7272
|
-
Dt.isBuffering &&
|
|
7286
|
+
Dt.isBuffering && S.ready && /* @__PURE__ */ c("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ x("div", { className: "flex flex-col items-center gap-2", children: [
|
|
7273
7287
|
/* @__PURE__ */ c("div", { className: "w-8 h-8 border-2 border-text border-t-transparent rounded-full animate-spin" }),
|
|
7274
7288
|
/* @__PURE__ */ c("div", { className: "px-4 py-2 rounded bg-wp-surface-2/80 text-xs font-medium", children: "Buffering…" })
|
|
7275
7289
|
] }) })
|
|
@@ -7277,14 +7291,14 @@ function vc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
7277
7291
|
}
|
|
7278
7292
|
);
|
|
7279
7293
|
}
|
|
7280
|
-
function
|
|
7281
|
-
const t =
|
|
7282
|
-
return e ? /* @__PURE__ */ c(
|
|
7294
|
+
function Sc() {
|
|
7295
|
+
const t = k((n) => n.snapshot.mediaId), e = ye(() => t ? { mediaId: t, ...Wa(t) } : null, [t]);
|
|
7296
|
+
return e ? /* @__PURE__ */ c(tr, { children: /* @__PURE__ */ c(kc, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ c(ti, {});
|
|
7283
7297
|
}
|
|
7284
|
-
const
|
|
7298
|
+
const xc = (t) => {
|
|
7285
7299
|
const e = ci(t);
|
|
7286
7300
|
return e.render(
|
|
7287
|
-
/* @__PURE__ */ c(Zs.Provider, { value: ei(), children: /* @__PURE__ */ c(
|
|
7301
|
+
/* @__PURE__ */ c(Zs.Provider, { value: ei(), children: /* @__PURE__ */ c(Sc, {}) })
|
|
7288
7302
|
), {
|
|
7289
7303
|
update() {
|
|
7290
7304
|
},
|
|
@@ -7295,21 +7309,21 @@ const Sc = (t) => {
|
|
|
7295
7309
|
queueMicrotask(() => e.unmount());
|
|
7296
7310
|
}
|
|
7297
7311
|
};
|
|
7298
|
-
},
|
|
7312
|
+
}, Ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7299
7313
|
__proto__: null,
|
|
7300
|
-
mount:
|
|
7301
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
7314
|
+
mount: xc
|
|
7315
|
+
}, Symbol.toStringTag, { value: "Module" })), Mc = {
|
|
7302
7316
|
id: "player",
|
|
7303
7317
|
name: "Media player",
|
|
7304
|
-
load: () => Promise.resolve(
|
|
7305
|
-
},
|
|
7306
|
-
function
|
|
7307
|
-
const t =
|
|
7318
|
+
load: () => Promise.resolve(Ec)
|
|
7319
|
+
}, Tc = In(() => import("./MediaDrawer-Df-Cgg6o.js"));
|
|
7320
|
+
function Ac() {
|
|
7321
|
+
const t = k((d) => d.snapshot), e = k((d) => d.ensureAutoIdentity), n = Qt(), a = ye(
|
|
7308
7322
|
() => n ? Pi(n, window.location.origin) : null,
|
|
7309
7323
|
[n]
|
|
7310
7324
|
), s = ni(), r = D(!1), [i, f] = L(!1), o = s.roomKey || null;
|
|
7311
|
-
|
|
7312
|
-
o &&
|
|
7325
|
+
Uf(), Gf(), R(() => qf(), []), R(() => Jf(), []), R(() => {
|
|
7326
|
+
o && Zf(o);
|
|
7313
7327
|
}, [o]), R(() => {
|
|
7314
7328
|
const d = () => f(!0);
|
|
7315
7329
|
return window.addEventListener(vn, d), () => window.removeEventListener(vn, d);
|
|
@@ -7323,7 +7337,7 @@ function Tc() {
|
|
|
7323
7337
|
Promise.all([
|
|
7324
7338
|
ai(),
|
|
7325
7339
|
ri(),
|
|
7326
|
-
si().then(
|
|
7340
|
+
si().then(Ha)
|
|
7327
7341
|
]),
|
|
7328
7342
|
new Promise((b) => setTimeout(b, u))
|
|
7329
7343
|
]);
|
|
@@ -7331,9 +7345,9 @@ function Tc() {
|
|
|
7331
7345
|
N("room", "pre-join wait threw, proceeding anyway", { err: b?.message });
|
|
7332
7346
|
}
|
|
7333
7347
|
if (d) return;
|
|
7334
|
-
const m =
|
|
7348
|
+
const m = k.getState();
|
|
7335
7349
|
T("room", "Joining room", { roomKey: o, name: m.name, sprite: m.sprite }), e();
|
|
7336
|
-
const y =
|
|
7350
|
+
const y = k.getState();
|
|
7337
7351
|
ii({
|
|
7338
7352
|
room_key: o,
|
|
7339
7353
|
name: y.name || void 0,
|
|
@@ -7348,56 +7362,56 @@ function Tc() {
|
|
|
7348
7362
|
}
|
|
7349
7363
|
return o ? /* @__PURE__ */ x("div", { className: "relative flex-1 flex overflow-hidden min-h-0", children: [
|
|
7350
7364
|
/* @__PURE__ */ x("div", { className: "flex-1 relative bg-black overflow-hidden min-w-0", children: [
|
|
7351
|
-
/* @__PURE__ */ c(
|
|
7352
|
-
a && t.roomId && /* @__PURE__ */ c(
|
|
7353
|
-
/* @__PURE__ */ x(
|
|
7354
|
-
/* @__PURE__ */ c(
|
|
7355
|
-
/* @__PURE__ */ c(
|
|
7356
|
-
/* @__PURE__ */ c(
|
|
7357
|
-
/* @__PURE__ */ c(
|
|
7365
|
+
/* @__PURE__ */ c(sa, { activity: Mc, roomKey: t.roomId ?? "", layer: "base" }),
|
|
7366
|
+
a && t.roomId && /* @__PURE__ */ c(tr, { children: /* @__PURE__ */ c(sa, { activity: a, roomKey: t.roomId, layer: "overlay" }, a.id) }),
|
|
7367
|
+
/* @__PURE__ */ x($f, { children: [
|
|
7368
|
+
/* @__PURE__ */ c(Cc, {}),
|
|
7369
|
+
/* @__PURE__ */ c(Af, {}),
|
|
7370
|
+
/* @__PURE__ */ c(Pf, {}),
|
|
7371
|
+
/* @__PURE__ */ c(Ff, {})
|
|
7358
7372
|
] })
|
|
7359
7373
|
] }),
|
|
7360
|
-
/* @__PURE__ */ c(
|
|
7361
|
-
/* @__PURE__ */ c(rt.Suspense, { fallback: /* @__PURE__ */ c(
|
|
7374
|
+
/* @__PURE__ */ c(df, {}),
|
|
7375
|
+
/* @__PURE__ */ c(rt.Suspense, { fallback: /* @__PURE__ */ c(pf, { open: i, onClose: l }), children: /* @__PURE__ */ c(Tc, { open: i, onClose: l }) })
|
|
7362
7376
|
] }) : (N("room", "No room key provided"), /* @__PURE__ */ c("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ x("div", { className: "text-text-secondary", children: [
|
|
7363
7377
|
"No room key provided. Go to the ",
|
|
7364
7378
|
/* @__PURE__ */ c("a", { href: "/", className: "underline", children: "home page" }),
|
|
7365
7379
|
" to select a room."
|
|
7366
7380
|
] }) }));
|
|
7367
7381
|
}
|
|
7368
|
-
function
|
|
7369
|
-
const t =
|
|
7382
|
+
function Cc() {
|
|
7383
|
+
const t = k((s) => s.floatingChatEnabled), e = k((s) => s.chatCollapsed), n = k((s) => !!s.snapshot.mediaId), a = Ft();
|
|
7370
7384
|
return /* @__PURE__ */ c(
|
|
7371
|
-
|
|
7385
|
+
wf,
|
|
7372
7386
|
{
|
|
7373
7387
|
shown: ji(t, { hasMedia: n, chatCollapsed: e, isFullscreen: a }),
|
|
7374
7388
|
className: "absolute right-4 bottom-[35%] w-80 z-20"
|
|
7375
7389
|
}
|
|
7376
7390
|
);
|
|
7377
7391
|
}
|
|
7378
|
-
const
|
|
7392
|
+
const Uc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7379
7393
|
__proto__: null,
|
|
7380
|
-
default:
|
|
7394
|
+
default: Ac
|
|
7381
7395
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
7382
7396
|
export {
|
|
7383
|
-
|
|
7397
|
+
jc as B,
|
|
7384
7398
|
yo as C,
|
|
7385
|
-
|
|
7399
|
+
mf as D,
|
|
7386
7400
|
_o as E,
|
|
7387
7401
|
co as P,
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7402
|
+
Uc as R,
|
|
7403
|
+
Pc as S,
|
|
7404
|
+
gf as a,
|
|
7405
|
+
Bn as b,
|
|
7392
7406
|
If as c,
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7407
|
+
Bc as d,
|
|
7408
|
+
el as e,
|
|
7409
|
+
Oc as f,
|
|
7396
7410
|
st as g,
|
|
7397
7411
|
qe as i,
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7412
|
+
ar as p,
|
|
7413
|
+
Cf as r,
|
|
7414
|
+
Hc as s,
|
|
7415
|
+
Nf as u
|
|
7402
7416
|
};
|
|
7403
|
-
//# sourceMappingURL=Room-
|
|
7417
|
+
//# sourceMappingURL=Room-BW0i25qJ.js.map
|