@hadoku/watchparty-ui 0.45.32 → 0.45.33
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-D3hirjtp.js → AdminPanel-nU-YUW-1.js} +4 -4
- package/dist/chunks/{AdminPanel-D3hirjtp.js.map → AdminPanel-nU-YUW-1.js.map} +1 -1
- package/dist/chunks/{MediaDrawer-DHq4zHZo.js → MediaDrawer-CF4FGXOt.js} +4 -4
- package/dist/chunks/{MediaDrawer-DHq4zHZo.js.map → MediaDrawer-CF4FGXOt.js.map} +1 -1
- package/dist/chunks/{PlaylistPanel-DBl44brn.js → PlaylistPanel-BHQKt_A8.js} +3 -3
- package/dist/chunks/{PlaylistPanel-DBl44brn.js.map → PlaylistPanel-BHQKt_A8.js.map} +1 -1
- package/dist/chunks/{Room-DjbNxzkP.js → Room-DESl744M.js} +857 -854
- package/dist/chunks/Room-DESl744M.js.map +1 -0
- package/dist/chunks/{index-ByvPQ_Xq.js → index-kMwjyNYE.js} +2 -2
- package/dist/chunks/{index-ByvPQ_Xq.js.map → index-kMwjyNYE.js.map} +1 -1
- package/dist/chunks/{submissionsApi-DjJHgz_a.js → submissionsApi-DvSaPa0u.js} +2 -2
- package/dist/chunks/{submissionsApi-DjJHgz_a.js.map → submissionsApi-DvSaPa0u.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunks/Room-DjbNxzkP.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as d, jsxs as _, Fragment as Se } from "react/jsx-runtime";
|
|
2
2
|
import Ve, { useState as $, useRef as P, useEffect as L, useCallback as U, useMemo as Ee, Component as Xr, useContext as Bn, createContext as On, useId as Zr, useEffectEvent as fe } from "react";
|
|
3
|
-
import { k as es, M as ts, m as ns, f as rs, a as ss, C as dt, g as
|
|
3
|
+
import { k as es, M as ts, m as ns, f as rs, a as ss, C as dt, g as Qt, i as as, S as is, r as vt, d as E, e as ee, b as os, u as x, A as pt, c as cs, h as tt, j as Hn, n as Un, D as it, w as C, l as ls, o as ds, s as jn, p as Gn, q as Wn, t as us, L as fs, v as hs, x as ps, y as qt, z as ms, B as gs, E as bs, F as ys, G as Vn, H as Yt, I as Kn, J as zn, K as vs, N as Ss, O as Ce, P as un, T as It, Q as ws, R as Jn, U as xs, V as Es, W as Qn, X as Y, Y as Ms, Z as qn, _ as Yn, $ as Xe, a0 as ks, a1 as _s, a2 as As, a3 as Ts, a4 as Is, a5 as fn, a6 as ze, a7 as Cs, a8 as hn, a9 as Rs, aa as Fs, ab as pn, ac as Ns, ad as Ls, ae as $s, af as Ps, ag as Ds, ah as mn, ai as gn, aj as Bs, ak as Xn, al as bn, am as Os, an as gt, ao as Hs, ap as Us, aq as js, ar as Gs, as as Ws, at as Vs, au as Ks, av as zs, aw as Js, ax as Qs } from "./index-kMwjyNYE.js";
|
|
4
4
|
import { createPortal as wt } from "react-dom";
|
|
5
5
|
import { Icon as ut, THEMES as qs, useHadokuThemeOptional as Ys } from "@wolffm/themes";
|
|
6
6
|
import { HadokuThemePicker as Xs, ConnectedSettings as Zs } from "@wolffm/task-ui-components";
|
|
@@ -51,7 +51,7 @@ async function ia(t) {
|
|
|
51
51
|
return { w: e?.width ?? 0, h: e?.height ?? 0 };
|
|
52
52
|
}
|
|
53
53
|
async function oa(t, e = {}) {
|
|
54
|
-
const n = await
|
|
54
|
+
const n = await Qt().upload(t, { signal: e.signal });
|
|
55
55
|
if (!as(n.key))
|
|
56
56
|
throw new Zn("Image upload returned an unusable key");
|
|
57
57
|
return { key: n.key, deduplicated: n.deduplicated === !0 };
|
|
@@ -83,15 +83,15 @@ function da(t) {
|
|
|
83
83
|
}), [e, `${t.cdnBase}|${t.uploadPath}`];
|
|
84
84
|
}
|
|
85
85
|
function ua(t, e, n, r = {}) {
|
|
86
|
-
const { limit: s, debounceMs: i = is } = r, [a, l] = da(t), [o, c] = $([]), [u,
|
|
86
|
+
const { limit: s, debounceMs: i = is } = r, [a, l] = da(t), [o, c] = $([]), [u, h] = $(null), [f, y] = $(!1), [g, p] = $(null), [v, w] = $(0), A = P(null);
|
|
87
87
|
L(() => {
|
|
88
|
-
w(0),
|
|
88
|
+
w(0), h(null);
|
|
89
89
|
}, [n, e]), L(() => {
|
|
90
90
|
let k = !1;
|
|
91
|
-
const m =
|
|
91
|
+
const m = v === 0, T = async () => {
|
|
92
92
|
A.current?.abort();
|
|
93
93
|
const b = new AbortController();
|
|
94
|
-
A.current = b,
|
|
94
|
+
A.current = b, y(!0), p(null);
|
|
95
95
|
try {
|
|
96
96
|
const S = await a.current.catalogue(e).search({
|
|
97
97
|
query: n,
|
|
@@ -100,12 +100,12 @@ function ua(t, e, n, r = {}) {
|
|
|
100
100
|
signal: b.signal
|
|
101
101
|
});
|
|
102
102
|
if (k) return;
|
|
103
|
-
c((I) => m ? S.results : [...I, ...S.results]),
|
|
103
|
+
c((I) => m ? S.results : [...I, ...S.results]), h(S.next);
|
|
104
104
|
} catch (S) {
|
|
105
105
|
if (k || S instanceof Error && S.name === "AbortError") return;
|
|
106
|
-
|
|
106
|
+
p(S instanceof dt ? S : new dt("unknown", String(S)));
|
|
107
107
|
} finally {
|
|
108
|
-
k ||
|
|
108
|
+
k || y(!1);
|
|
109
109
|
}
|
|
110
110
|
}, R = setTimeout(
|
|
111
111
|
// A block body, not `() => void run()`: `no-void` is configured with
|
|
@@ -121,38 +121,38 @@ function ua(t, e, n, r = {}) {
|
|
|
121
121
|
return () => {
|
|
122
122
|
k = !0, clearTimeout(R);
|
|
123
123
|
};
|
|
124
|
-
}, [a, l, e, n, s, i,
|
|
124
|
+
}, [a, l, e, n, s, i, v]);
|
|
125
125
|
const F = U(() => {
|
|
126
|
-
|
|
127
|
-
}, [
|
|
128
|
-
return { items: o, loading:
|
|
126
|
+
f || !u || w((k) => k + 1);
|
|
127
|
+
}, [f, u]);
|
|
128
|
+
return { items: o, loading: f, error: g, hasMore: u !== null, loadMore: F };
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const Wt = 240, je = 8, fa = 28, er = 240;
|
|
131
131
|
function ha(t, e, n) {
|
|
132
|
-
let r = e.left -
|
|
133
|
-
r < je && (r = e.right + je), r = Math.min(r, n.width -
|
|
132
|
+
let r = e.left - Wt - je;
|
|
133
|
+
r < je && (r = e.right + je), r = Math.min(r, n.width - Wt - je), r = Math.max(je, r);
|
|
134
134
|
const s = er + fa;
|
|
135
135
|
let i = t.top + t.height / 2 - s / 2;
|
|
136
136
|
return i = Math.min(i, n.height - s - je), i = Math.max(je, i), { left: r, top: i };
|
|
137
137
|
}
|
|
138
138
|
const tr = "/dataplatform/api/memes", pa = 120;
|
|
139
139
|
function ma({ onClose: t, onPick: e, onUnavailable: n }) {
|
|
140
|
-
const [r, s] = $(""), i = P(null), a = P(null), l =
|
|
140
|
+
const [r, s] = $(""), i = P(null), a = P(null), l = Qt(), { items: o, loading: c, error: u, hasMore: h, loadMore: f } = ua(
|
|
141
141
|
l,
|
|
142
142
|
tr,
|
|
143
143
|
r.trim()
|
|
144
|
-
),
|
|
144
|
+
), y = u?.reason ?? null, g = Ee(() => {
|
|
145
145
|
const b = /* @__PURE__ */ new Set();
|
|
146
146
|
return o.filter((S) => b.has(S.key) ? !1 : (b.add(S.key), !0));
|
|
147
|
-
}, [o]), [
|
|
147
|
+
}, [o]), [p, v] = $(null), w = P(null), A = U(() => {
|
|
148
148
|
w.current !== null && (window.clearTimeout(w.current), w.current = null);
|
|
149
149
|
}, []), F = U(() => {
|
|
150
|
-
A(),
|
|
150
|
+
A(), v(null);
|
|
151
151
|
}, [A]), k = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(hover: hover)").matches, m = U(
|
|
152
152
|
(b, S, I = !1) => {
|
|
153
153
|
const B = i.current;
|
|
154
154
|
if (!B) return;
|
|
155
|
-
const H = () =>
|
|
155
|
+
const H = () => v({
|
|
156
156
|
item: b,
|
|
157
157
|
...ha(S.getBoundingClientRect(), B.getBoundingClientRect(), {
|
|
158
158
|
width: window.innerWidth,
|
|
@@ -164,8 +164,8 @@ function ma({ onClose: t, onPick: e, onUnavailable: n }) {
|
|
|
164
164
|
[A]
|
|
165
165
|
);
|
|
166
166
|
L(() => () => A(), [A]), L(() => {
|
|
167
|
-
|
|
168
|
-
}, [
|
|
167
|
+
y === "unavailable" && n?.();
|
|
168
|
+
}, [y, n]), L(() => {
|
|
169
169
|
a.current?.focus();
|
|
170
170
|
}, []), L(() => {
|
|
171
171
|
const b = (I) => {
|
|
@@ -214,8 +214,8 @@ function ma({ onClose: t, onPick: e, onUnavailable: n }) {
|
|
|
214
214
|
{
|
|
215
215
|
className: "m-2 p-2 text-center text-sm bg-danger-bg text-on-danger-bg rounded",
|
|
216
216
|
role: "alert",
|
|
217
|
-
"data-reason":
|
|
218
|
-
children:
|
|
217
|
+
"data-reason": y,
|
|
218
|
+
children: y === "unauthenticated" ? "Sign in to browse memes" : y === "forbidden" ? "Your account can't browse the meme library" : "Meme library is unavailable"
|
|
219
219
|
}
|
|
220
220
|
),
|
|
221
221
|
R && /* @__PURE__ */ d("p", { className: "p-4 text-center text-sm text-text-secondary", children: r.trim() ? `No memes match "${r.trim()}"` : "The meme library is empty" }),
|
|
@@ -250,11 +250,11 @@ function ma({ onClose: t, onPick: e, onUnavailable: n }) {
|
|
|
250
250
|
) : null;
|
|
251
251
|
}) }),
|
|
252
252
|
c && /* @__PURE__ */ d("p", { className: "p-2 text-center text-xs text-text-secondary", children: "Loading…" }),
|
|
253
|
-
|
|
253
|
+
h && !c && /* @__PURE__ */ d(
|
|
254
254
|
"button",
|
|
255
255
|
{
|
|
256
256
|
type: "button",
|
|
257
|
-
onClick:
|
|
257
|
+
onClick: f,
|
|
258
258
|
"data-testid": "meme-load-more",
|
|
259
259
|
className: "mt-2 w-full rounded border border-border-light py-1 text-xs text-text-secondary hover:text-text hover:border-primary",
|
|
260
260
|
children: "Load more"
|
|
@@ -263,15 +263,15 @@ function ma({ onClose: t, onPick: e, onUnavailable: n }) {
|
|
|
263
263
|
]
|
|
264
264
|
}
|
|
265
265
|
),
|
|
266
|
-
|
|
266
|
+
p && /* @__PURE__ */ _(
|
|
267
267
|
"div",
|
|
268
268
|
{
|
|
269
269
|
"data-testid": "meme-preview",
|
|
270
270
|
className: "fixed z-50 flex flex-col gap-1 rounded border border-border-light bg-bg-card p-1.5 shadow-2xl",
|
|
271
271
|
style: {
|
|
272
|
-
left:
|
|
273
|
-
top:
|
|
274
|
-
width:
|
|
272
|
+
left: p.left,
|
|
273
|
+
top: p.top,
|
|
274
|
+
width: Wt,
|
|
275
275
|
/* The placement maths reserves exactly PREVIEW_PX of width.
|
|
276
276
|
Without border-box the padding and border sit OUTSIDE that
|
|
277
277
|
number and the box laps over the panel it is meant to sit
|
|
@@ -285,15 +285,15 @@ function ma({ onClose: t, onPick: e, onUnavailable: n }) {
|
|
|
285
285
|
/* @__PURE__ */ d(
|
|
286
286
|
"img",
|
|
287
287
|
{
|
|
288
|
-
src: vt(
|
|
288
|
+
src: vt(p.item.key) ?? void 0,
|
|
289
289
|
alt: "",
|
|
290
290
|
className: "block w-full rounded bg-bg object-contain",
|
|
291
291
|
style: { height: "auto", maxHeight: er }
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
|
-
|
|
294
|
+
p.item.title && /* One line. A long title must not change the box height, because
|
|
295
295
|
the box height is what the placement maths clamped against. */
|
|
296
|
-
/* @__PURE__ */ d("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap text-center text-[10px] text-text-secondary", children:
|
|
296
|
+
/* @__PURE__ */ d("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap text-center text-[10px] text-text-secondary", children: p.item.title })
|
|
297
297
|
]
|
|
298
298
|
}
|
|
299
299
|
)
|
|
@@ -313,9 +313,9 @@ function ba(t) {
|
|
|
313
313
|
const e = t;
|
|
314
314
|
return typeof e.unmount == "function" && typeof e.update == "function" && (e.mountSettings === void 0 || typeof e.mountSettings == "function");
|
|
315
315
|
}
|
|
316
|
-
const
|
|
316
|
+
const Vt = "watchparty:open-media-drawer";
|
|
317
317
|
function rr(t) {
|
|
318
|
-
E("navigation", `Select Media clicked (${t})`), window.dispatchEvent(new CustomEvent(
|
|
318
|
+
E("navigation", `Select Media clicked (${t})`), window.dispatchEvent(new CustomEvent(Vt));
|
|
319
319
|
}
|
|
320
320
|
class sr extends Xr {
|
|
321
321
|
state = { hasError: !1 };
|
|
@@ -348,11 +348,14 @@ function xt() {
|
|
|
348
348
|
return n(), document.addEventListener("fullscreenchange", n), () => document.removeEventListener("fullscreenchange", n);
|
|
349
349
|
}, []), t;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Et(t) {
|
|
352
352
|
return t.hasMedia && (t.chatCollapsed || t.isFullscreen);
|
|
353
353
|
}
|
|
354
|
+
function ya(t, e) {
|
|
355
|
+
return t && Et(e);
|
|
356
|
+
}
|
|
354
357
|
function Xt(t) {
|
|
355
|
-
return t.isLeader ?
|
|
358
|
+
return t.isLeader ? Et(t) ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "chat-toolbar" : "none";
|
|
356
359
|
}
|
|
357
360
|
function ar(t) {
|
|
358
361
|
return t.hasMedia ? t.gameOverlay && !t.isFullscreen ? "room-corner" : "control-bar" : "none";
|
|
@@ -363,21 +366,21 @@ function ir(t, e) {
|
|
|
363
366
|
if (n.author === e && n.avatarUrl) return n.avatarUrl;
|
|
364
367
|
}
|
|
365
368
|
}
|
|
366
|
-
const
|
|
369
|
+
const va = On(!0);
|
|
367
370
|
function or() {
|
|
368
|
-
const t = Bn(
|
|
371
|
+
const t = Bn(va);
|
|
369
372
|
L(() => {
|
|
370
373
|
t && os();
|
|
371
374
|
}, [t]);
|
|
372
375
|
}
|
|
373
|
-
function
|
|
376
|
+
function Sa(t, e) {
|
|
374
377
|
if (!e) return "";
|
|
375
378
|
for (const n of Object.values(t))
|
|
376
379
|
if (n.author === e && n.cosmetics) return JSON.stringify(n.cosmetics);
|
|
377
380
|
return "";
|
|
378
381
|
}
|
|
379
382
|
function cr(t) {
|
|
380
|
-
const e = x((n) =>
|
|
383
|
+
const e = x((n) => Sa(n.roster, t));
|
|
381
384
|
return Ee(() => e ? JSON.parse(e) : void 0, [e]);
|
|
382
385
|
}
|
|
383
386
|
function lr(t) {
|
|
@@ -389,7 +392,7 @@ const ft = Ve.memo(
|
|
|
389
392
|
},
|
|
390
393
|
(t, e) => t.html === e.html && t.as === e.as && t.className === e.className && JSON.stringify(t.style) === JSON.stringify(e.style)
|
|
391
394
|
);
|
|
392
|
-
function
|
|
395
|
+
function wa(t, e) {
|
|
393
396
|
L(() => {
|
|
394
397
|
const n = t.current;
|
|
395
398
|
if (!n || !e || typeof IntersectionObserver > "u") return;
|
|
@@ -416,21 +419,21 @@ function dr({ sprite: t, url: e, alt: n, worn: r }) {
|
|
|
416
419
|
r?.overlay && /* @__PURE__ */ d(ft, { html: cs(r), style: { display: "contents" } })
|
|
417
420
|
] });
|
|
418
421
|
}
|
|
419
|
-
function
|
|
422
|
+
function xa(t) {
|
|
420
423
|
return !(t.button !== 0 || t.ctrlKey || t.metaKey || t.shiftKey || t.altKey);
|
|
421
424
|
}
|
|
422
|
-
const
|
|
423
|
-
function
|
|
424
|
-
return Bn(
|
|
425
|
+
const Ea = On(null);
|
|
426
|
+
function Ma() {
|
|
427
|
+
return Bn(Ea);
|
|
425
428
|
}
|
|
426
|
-
function
|
|
429
|
+
function ka({ src: t, title: e, onClose: n }) {
|
|
427
430
|
L(() => {
|
|
428
431
|
const i = (a) => {
|
|
429
432
|
a.key === "Escape" && (a.stopPropagation(), n());
|
|
430
433
|
};
|
|
431
434
|
return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
|
|
432
435
|
}, [n]);
|
|
433
|
-
const r =
|
|
436
|
+
const r = Ma(), s = typeof document > "u" ? null : document.fullscreenElement ?? r ?? document.body;
|
|
434
437
|
return s ? wt(
|
|
435
438
|
/* @__PURE__ */ _(
|
|
436
439
|
"div",
|
|
@@ -469,11 +472,11 @@ function Ma({ src: t, title: e, onClose: n }) {
|
|
|
469
472
|
s
|
|
470
473
|
) : null;
|
|
471
474
|
}
|
|
472
|
-
const
|
|
473
|
-
function
|
|
475
|
+
const Ct = 240, _a = 320;
|
|
476
|
+
function Aa({ image: t }) {
|
|
474
477
|
const [e, n] = $(!1), r = vt(t.key);
|
|
475
478
|
if (!r) return null;
|
|
476
|
-
const s = t.w > 0 && t.h > 0, i = s ? Math.min(1,
|
|
479
|
+
const s = t.w > 0 && t.h > 0, i = s ? Math.min(1, _a / t.w, Ct / t.h) : 1;
|
|
477
480
|
return /* @__PURE__ */ _(Se, { children: [
|
|
478
481
|
/* @__PURE__ */ d(
|
|
479
482
|
"a",
|
|
@@ -484,7 +487,7 @@ function _a({ image: t }) {
|
|
|
484
487
|
className: "block max-w-full cursor-zoom-in",
|
|
485
488
|
"data-testid": "chat-image",
|
|
486
489
|
onClick: (a) => {
|
|
487
|
-
|
|
490
|
+
xa(a) && (a.preventDefault(), n(!0));
|
|
488
491
|
},
|
|
489
492
|
children: /* @__PURE__ */ d(
|
|
490
493
|
"img",
|
|
@@ -496,13 +499,13 @@ function _a({ image: t }) {
|
|
|
496
499
|
width: s ? Math.round(t.w * i) : void 0,
|
|
497
500
|
height: s ? Math.round(t.h * i) : void 0,
|
|
498
501
|
className: "rounded border border-border-light object-contain bg-bg-alt/30",
|
|
499
|
-
style: s ? { aspectRatio: `${t.w} / ${t.h}`, maxWidth: "100%", maxHeight:
|
|
502
|
+
style: s ? { aspectRatio: `${t.w} / ${t.h}`, maxWidth: "100%", maxHeight: Ct } : { maxWidth: "100%", maxHeight: Ct }
|
|
500
503
|
}
|
|
501
504
|
)
|
|
502
505
|
}
|
|
503
506
|
),
|
|
504
507
|
e && /* @__PURE__ */ d(
|
|
505
|
-
|
|
508
|
+
ka,
|
|
506
509
|
{
|
|
507
510
|
src: r,
|
|
508
511
|
title: t.title,
|
|
@@ -512,40 +515,40 @@ function _a({ image: t }) {
|
|
|
512
515
|
] });
|
|
513
516
|
}
|
|
514
517
|
function ur({ images: t }) {
|
|
515
|
-
return t?.length ? /* @__PURE__ */ d("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: t.map((e, n) => /* @__PURE__ */ d(
|
|
518
|
+
return t?.length ? /* @__PURE__ */ d("div", { className: "flex flex-wrap gap-1 mt-1", "data-testid": "chat-images", children: t.map((e, n) => /* @__PURE__ */ d(Aa, { image: e }, `${e.key}-${n}`)) }) : null;
|
|
516
519
|
}
|
|
517
|
-
function
|
|
520
|
+
function Ta(t, e) {
|
|
518
521
|
return t.author && e.author ? t.author === e.author : !!e.clientId && t.clientId === e.clientId;
|
|
519
522
|
}
|
|
520
|
-
function
|
|
523
|
+
function Rt(t) {
|
|
521
524
|
return new Date(t).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
522
525
|
}
|
|
523
|
-
const
|
|
524
|
-
const n = x((u) => u.me.clientId), r = x((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), s =
|
|
525
|
-
|
|
526
|
+
const Ia = Ve.memo(function({ message: e }) {
|
|
527
|
+
const n = x((u) => u.me.clientId), r = x((u) => u.me.clientId ? u.roster[u.me.clientId]?.author : void 0), s = Ta(e, { clientId: n, author: r }), i = x((u) => ir(u.roster, e.author)), a = tt(e.sprite, i), l = cr(e.isSystem ? void 0 : e.author), o = P(null);
|
|
528
|
+
wa(o, !!l);
|
|
526
529
|
const [c] = $(
|
|
527
530
|
() => e.live && e.text ? Hn(e.text, l) : null
|
|
528
531
|
);
|
|
529
532
|
return e.isSystem && e.systemType === "recap" ? /* @__PURE__ */ d("div", { className: "px-2 py-1.5", children: /* @__PURE__ */ _("div", { className: "border-l-2 border-border-light pl-2.5 py-0.5", children: [
|
|
530
533
|
/* @__PURE__ */ _("div", { className: "text-[10px] uppercase tracking-wide text-text-muted mb-0.5", children: [
|
|
531
534
|
"Recap",
|
|
532
|
-
/* @__PURE__ */ d("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children:
|
|
535
|
+
/* @__PURE__ */ d("span", { className: "ml-1.5 normal-case tracking-normal opacity-60", children: Rt(e.ts) })
|
|
533
536
|
] }),
|
|
534
537
|
/* @__PURE__ */ d("p", { className: "text-[13px] text-text-secondary leading-relaxed whitespace-pre-wrap break-words", children: e.text })
|
|
535
538
|
] }) }) : e.isSystem ? /* @__PURE__ */ _("div", { className: "px-2 py-0.5 text-[11px] text-text-muted italic text-center leading-tight", children: [
|
|
536
539
|
e.text,
|
|
537
|
-
/* @__PURE__ */ d("span", { className: "ml-1 text-[10px] opacity-50", children:
|
|
540
|
+
/* @__PURE__ */ d("span", { className: "ml-1 text-[10px] opacity-50", children: Rt(e.ts) })
|
|
538
541
|
] }) : /* @__PURE__ */ _("div", { ref: o, style: lr(a), className: `flex items-start gap-2 px-2 py-1 hover:bg-bg-card/20 ${s ? "bg-bg-card/30" : ""}`, children: [
|
|
539
542
|
/* @__PURE__ */ d(dr, { sprite: e.sprite, url: i, alt: e.name, worn: l }),
|
|
540
543
|
/* @__PURE__ */ _("div", { className: "flex-1 min-w-0 -mt-0.5", children: [
|
|
541
544
|
l ? /* @__PURE__ */ d(ft, { html: Un(e.name, l), className: "text-[13px]", style: { color: a } }) : /* @__PURE__ */ d("span", { className: "font-medium text-[13px]", style: { color: a }, children: e.name }),
|
|
542
|
-
/* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children:
|
|
545
|
+
/* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted opacity-60 ml-1.5", children: Rt(e.ts) }),
|
|
543
546
|
e.text && (c ? /* @__PURE__ */ d(ft, { as: "p", html: c, className: "text-[13px] text-text break-words leading-snug m-0" }) : /* @__PURE__ */ d("p", { className: "text-[13px] text-text break-words leading-snug m-0", children: e.text })),
|
|
544
547
|
/* @__PURE__ */ d(ur, { images: e.images })
|
|
545
548
|
] })
|
|
546
549
|
] });
|
|
547
550
|
});
|
|
548
|
-
function
|
|
551
|
+
function Ca() {
|
|
549
552
|
or();
|
|
550
553
|
const t = x((s) => s.chat), e = P(null), n = P(!1), r = U(() => {
|
|
551
554
|
const s = e.current;
|
|
@@ -570,7 +573,7 @@ function Ia() {
|
|
|
570
573
|
/* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted whitespace-nowrap", children: new Date(s.ts).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" }) }),
|
|
571
574
|
/* @__PURE__ */ d("div", { className: "flex-1 h-px bg-border" })
|
|
572
575
|
] }),
|
|
573
|
-
/* @__PURE__ */ d(
|
|
576
|
+
/* @__PURE__ */ d(Ia, { message: s })
|
|
574
577
|
] }, s.id);
|
|
575
578
|
}) })
|
|
576
579
|
}
|
|
@@ -597,12 +600,12 @@ const Zt = [
|
|
|
597
600
|
scope: "local"
|
|
598
601
|
}
|
|
599
602
|
], et = "/";
|
|
600
|
-
function
|
|
603
|
+
function Ra(t) {
|
|
601
604
|
if (!t.startsWith(et)) return null;
|
|
602
605
|
const e = t.slice(et.length);
|
|
603
606
|
return /\s/.test(e) ? null : e.toLowerCase();
|
|
604
607
|
}
|
|
605
|
-
function
|
|
608
|
+
function Fa(t, e = Zt) {
|
|
606
609
|
const n = t.toLowerCase();
|
|
607
610
|
if (!n) return [...e].sort((s, i) => s.name.localeCompare(i.name));
|
|
608
611
|
const r = [];
|
|
@@ -612,23 +615,23 @@ function Ra(t, e = Zt) {
|
|
|
612
615
|
}
|
|
613
616
|
return r.sort((s, i) => s.rank - i.rank || s.cmd.name.localeCompare(i.cmd.name)).map((s) => s.cmd);
|
|
614
617
|
}
|
|
615
|
-
function
|
|
618
|
+
function Na(t) {
|
|
616
619
|
return `${et}${t.name} `;
|
|
617
620
|
}
|
|
618
|
-
function
|
|
621
|
+
function Ft(t, e) {
|
|
619
622
|
return e <= 0 ? 0 : (t % e + e) % e;
|
|
620
623
|
}
|
|
621
|
-
function
|
|
624
|
+
function La(t, e = Zt) {
|
|
622
625
|
const n = t.trim();
|
|
623
626
|
if (!n) return null;
|
|
624
627
|
if (!n.startsWith(et)) return { kind: "chat", text: n };
|
|
625
628
|
const r = n.slice(et.length), s = r.search(/\s/), i = (s === -1 ? r : r.slice(0, s)).toLowerCase(), a = s === -1 ? "" : r.slice(s).trim(), l = e.find((o) => o.name.toLowerCase() === i);
|
|
626
629
|
return l ? { kind: "command", command: l, args: a } : { kind: "chat", text: n };
|
|
627
630
|
}
|
|
628
|
-
function
|
|
631
|
+
function $a(t, e) {
|
|
629
632
|
return t.requiresMedia && !e.hasMedia ? `${et}${t.name} needs an episode loaded.` : null;
|
|
630
633
|
}
|
|
631
|
-
function
|
|
634
|
+
function Pa({
|
|
632
635
|
commands: t,
|
|
633
636
|
activeIndex: e,
|
|
634
637
|
hasMedia: n,
|
|
@@ -698,24 +701,24 @@ function fr({
|
|
|
698
701
|
] }, r.id)) }) : null;
|
|
699
702
|
}
|
|
700
703
|
function hr() {
|
|
701
|
-
const [t, e] = $([]), [n, r] = $(!1), s = x((
|
|
704
|
+
const [t, e] = $([]), [n, r] = $(!1), s = x((p) => p.pushToast), i = P(/* @__PURE__ */ new Set());
|
|
702
705
|
L(() => () => {
|
|
703
|
-
for (const
|
|
706
|
+
for (const p of i.current) URL.revokeObjectURL(p);
|
|
704
707
|
i.current.clear();
|
|
705
708
|
}, []);
|
|
706
|
-
const a = U((
|
|
707
|
-
ta(
|
|
708
|
-
}, []), l = U(async (
|
|
709
|
-
if (!
|
|
710
|
-
const
|
|
711
|
-
for (const w of
|
|
709
|
+
const a = U((p) => {
|
|
710
|
+
ta(p) && (URL.revokeObjectURL(p.previewUrl), i.current.delete(p.previewUrl));
|
|
711
|
+
}, []), l = U(async (p) => {
|
|
712
|
+
if (!p.length) return;
|
|
713
|
+
const v = [];
|
|
714
|
+
for (const w of p) {
|
|
712
715
|
const A = ra(w);
|
|
713
716
|
if (A) {
|
|
714
717
|
s("error", A);
|
|
715
718
|
continue;
|
|
716
719
|
}
|
|
717
720
|
const { w: F, h: k } = await ia(w), m = URL.createObjectURL(w);
|
|
718
|
-
i.current.add(m),
|
|
721
|
+
i.current.add(m), v.push({
|
|
719
722
|
kind: "file",
|
|
720
723
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
721
724
|
file: w,
|
|
@@ -724,57 +727,57 @@ function hr() {
|
|
|
724
727
|
h: k
|
|
725
728
|
});
|
|
726
729
|
}
|
|
727
|
-
|
|
730
|
+
v.length && e((w) => {
|
|
728
731
|
const A = it - w.length;
|
|
729
732
|
if (A <= 0) {
|
|
730
733
|
s("info", `Up to ${it} images per message`);
|
|
731
|
-
for (const F of
|
|
734
|
+
for (const F of v) a(F);
|
|
732
735
|
return w;
|
|
733
736
|
}
|
|
734
|
-
if (
|
|
737
|
+
if (v.length > A) {
|
|
735
738
|
s("info", `Up to ${it} images per message`);
|
|
736
|
-
for (const F of
|
|
739
|
+
for (const F of v.slice(A)) a(F);
|
|
737
740
|
}
|
|
738
|
-
return [...w, ...
|
|
741
|
+
return [...w, ...v.slice(0, A)];
|
|
739
742
|
});
|
|
740
|
-
}, [s, a]), o = U((
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
+
}, [s, a]), o = U((p) => {
|
|
744
|
+
const v = vt(p.key);
|
|
745
|
+
v && (e((w) => w.length >= it ? (s("info", `Up to ${it} images per message`), w) : [...w, {
|
|
743
746
|
kind: "remote",
|
|
744
747
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
745
|
-
key:
|
|
746
|
-
previewUrl:
|
|
748
|
+
key: p.key,
|
|
749
|
+
previewUrl: v,
|
|
747
750
|
// The catalogue spells "unknown" as null; the wire schema spells it
|
|
748
751
|
// as 0, and the renderer falls back to natural flow on that.
|
|
749
|
-
w:
|
|
750
|
-
h:
|
|
751
|
-
title:
|
|
752
|
-
}]),
|
|
753
|
-
}, [s]), c = U((
|
|
754
|
-
e((
|
|
755
|
-
const w =
|
|
756
|
-
return w && a(w),
|
|
752
|
+
w: p.width ?? 0,
|
|
753
|
+
h: p.height ?? 0,
|
|
754
|
+
title: p.title || void 0
|
|
755
|
+
}]), Qt().catalogue(tr).recordUse(p.key));
|
|
756
|
+
}, [s]), c = U((p) => {
|
|
757
|
+
e((v) => {
|
|
758
|
+
const w = v.find((A) => A.id === p);
|
|
759
|
+
return w && a(w), v.filter((A) => A.id !== p);
|
|
757
760
|
});
|
|
758
761
|
}, [a]), u = U(() => {
|
|
759
|
-
e((
|
|
760
|
-
for (const
|
|
762
|
+
e((p) => {
|
|
763
|
+
for (const v of p) a(v);
|
|
761
764
|
return [];
|
|
762
765
|
});
|
|
763
|
-
}, [a]),
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
}, [l]),
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
}, [l]),
|
|
770
|
-
|
|
766
|
+
}, [a]), h = U((p) => {
|
|
767
|
+
const v = sa(p.clipboardData);
|
|
768
|
+
v.length && (p.preventDefault(), l(v));
|
|
769
|
+
}, [l]), f = U((p) => {
|
|
770
|
+
const v = aa(p.dataTransfer);
|
|
771
|
+
v.length && (p.preventDefault(), l(v));
|
|
772
|
+
}, [l]), y = U((p) => {
|
|
773
|
+
p.dataTransfer?.types?.includes("Files") && p.preventDefault();
|
|
771
774
|
}, []), g = U(async () => {
|
|
772
775
|
if (!t.length) return [];
|
|
773
776
|
r(!0);
|
|
774
777
|
try {
|
|
775
778
|
return await ca(t);
|
|
776
|
-
} catch (
|
|
777
|
-
return C("chat", "Image upload failed", la(
|
|
779
|
+
} catch (p) {
|
|
780
|
+
return C("chat", "Image upload failed", la(p)), s("error", na(p)), null;
|
|
778
781
|
} finally {
|
|
779
782
|
r(!1);
|
|
780
783
|
}
|
|
@@ -787,21 +790,21 @@ function hr() {
|
|
|
787
790
|
remove: c,
|
|
788
791
|
clear: u,
|
|
789
792
|
uploadPending: g,
|
|
790
|
-
onPaste:
|
|
791
|
-
onDrop:
|
|
792
|
-
onDragOver:
|
|
793
|
+
onPaste: h,
|
|
794
|
+
onDrop: f,
|
|
795
|
+
onDragOver: y
|
|
793
796
|
};
|
|
794
797
|
}
|
|
795
|
-
const yn = Wn,
|
|
796
|
-
function
|
|
797
|
-
const [e, n] = $(""), [r, s] = $(!1), [i, a] = $({ q: null, i: 0 }), [l, o] = $(!1), c = P(null), u = Zr(), [
|
|
798
|
-
() => k === null ? [] :
|
|
798
|
+
const yn = Wn, Da = Gn;
|
|
799
|
+
function Ba({ commands: t = Zt }) {
|
|
800
|
+
const [e, n] = $(""), [r, s] = $(!1), [i, a] = $({ q: null, i: 0 }), [l, o] = $(!1), c = P(null), u = Zr(), [h, f] = $(!1), [y, g] = $(!1), p = hr(), v = x((N) => N.snapshot.mediaId), w = x((N) => N.pushToast), A = x((N) => N.setTierlistOpen), F = !!v, k = Ra(e), m = Ee(
|
|
801
|
+
() => k === null ? [] : Fa(k, t),
|
|
799
802
|
[k, t]
|
|
800
|
-
), T = k !== null && !l && m.length > 0, R = i.q === k ?
|
|
803
|
+
), T = k !== null && !l && m.length > 0, R = i.q === k ? Ft(i.i, m.length) : 0, b = U(
|
|
801
804
|
(N) => a({ q: k, i: N }),
|
|
802
805
|
[k]
|
|
803
806
|
), S = U((N, O) => {
|
|
804
|
-
const Q =
|
|
807
|
+
const Q = $a(N, { hasMedia: F });
|
|
805
808
|
if (Q) {
|
|
806
809
|
w("info", Q);
|
|
807
810
|
return;
|
|
@@ -820,12 +823,12 @@ function Da({ commands: t = Zt }) {
|
|
|
820
823
|
w("info", `${N.usage} is not implemented yet.`);
|
|
821
824
|
}
|
|
822
825
|
}, [F, w, t, A]), I = U((N) => {
|
|
823
|
-
n(
|
|
826
|
+
n(Na(N)), o(!1), c.current?.focus();
|
|
824
827
|
}, []), B = U(async (N) => {
|
|
825
|
-
if (N.preventDefault(), r ||
|
|
826
|
-
const O =
|
|
827
|
-
if (!O && !
|
|
828
|
-
if (O?.kind === "command" &&
|
|
828
|
+
if (N.preventDefault(), r || p.uploading) return;
|
|
829
|
+
const O = La(e, t);
|
|
830
|
+
if (!O && !p.pending.length) return;
|
|
831
|
+
if (O?.kind === "command" && p.pending.length) {
|
|
829
832
|
w("info", "Send images on their own, not with a command.");
|
|
830
833
|
return;
|
|
831
834
|
}
|
|
@@ -833,18 +836,18 @@ function Da({ commands: t = Zt }) {
|
|
|
833
836
|
S(O.command, O.args), n(""), !document.hidden && document.hasFocus() && c.current?.focus();
|
|
834
837
|
return;
|
|
835
838
|
}
|
|
836
|
-
const Q = await
|
|
837
|
-
Q !== null && (jn(O?.text ?? "", Q), n(""),
|
|
838
|
-
}, [e, r, S,
|
|
839
|
+
const Q = await p.uploadPending();
|
|
840
|
+
Q !== null && (jn(O?.text ?? "", Q), n(""), p.clear(), s(!0), setTimeout(() => s(!1), Da), !document.hidden && document.hasFocus() && c.current?.focus());
|
|
841
|
+
}, [e, r, S, p, w, t]), H = U((N) => {
|
|
839
842
|
if (N.key === "Escape" && T) {
|
|
840
843
|
N.preventDefault(), o(!0);
|
|
841
844
|
return;
|
|
842
845
|
}
|
|
843
846
|
if (T) {
|
|
844
847
|
if (N.key === "ArrowDown")
|
|
845
|
-
N.preventDefault(), b(
|
|
848
|
+
N.preventDefault(), b(Ft(R + 1, m.length));
|
|
846
849
|
else if (N.key === "ArrowUp")
|
|
847
|
-
N.preventDefault(), b(
|
|
850
|
+
N.preventDefault(), b(Ft(R - 1, m.length));
|
|
848
851
|
else if (N.key === "Tab") {
|
|
849
852
|
N.preventDefault();
|
|
850
853
|
const O = m[R];
|
|
@@ -869,15 +872,15 @@ function Da({ commands: t = Zt }) {
|
|
|
869
872
|
onSubmit: (N) => {
|
|
870
873
|
B(N);
|
|
871
874
|
},
|
|
872
|
-
onPaste:
|
|
873
|
-
onDrop:
|
|
874
|
-
onDragOver:
|
|
875
|
+
onPaste: p.onPaste,
|
|
876
|
+
onDrop: p.onDrop,
|
|
877
|
+
onDragOver: p.onDragOver,
|
|
875
878
|
className: "p-2 border-t border-border",
|
|
876
879
|
children: [
|
|
877
|
-
/* @__PURE__ */ d(fr, { pending:
|
|
880
|
+
/* @__PURE__ */ d(fr, { pending: p.pending, uploading: p.uploading, onRemove: p.remove }),
|
|
878
881
|
/* @__PURE__ */ _("div", { className: "relative", children: [
|
|
879
882
|
T && /* @__PURE__ */ d(
|
|
880
|
-
|
|
883
|
+
Pa,
|
|
881
884
|
{
|
|
882
885
|
commands: m,
|
|
883
886
|
activeIndex: R,
|
|
@@ -890,11 +893,11 @@ function Da({ commands: t = Zt }) {
|
|
|
890
893
|
/* @__PURE__ */ d(
|
|
891
894
|
nr,
|
|
892
895
|
{
|
|
893
|
-
open:
|
|
894
|
-
onClose: () =>
|
|
895
|
-
onPick:
|
|
896
|
+
open: h,
|
|
897
|
+
onClose: () => f(!1),
|
|
898
|
+
onPick: p.addMeme,
|
|
896
899
|
onUnavailable: () => {
|
|
897
|
-
g(!0),
|
|
900
|
+
g(!0), f(!1);
|
|
898
901
|
}
|
|
899
902
|
}
|
|
900
903
|
),
|
|
@@ -922,16 +925,16 @@ function Da({ commands: t = Zt }) {
|
|
|
922
925
|
),
|
|
923
926
|
/* @__PURE__ */ d("span", { className: `absolute right-2 top-1/2 -translate-y-1/2 text-[10px] ${j <= 50 ? j <= 0 ? "bg-danger-bg text-on-danger-bg px-1 rounded" : "bg-primary-bg text-on-primary-bg px-1 rounded" : "text-text-muted"}`, children: K && j })
|
|
924
927
|
] }),
|
|
925
|
-
!
|
|
928
|
+
!y && /* @__PURE__ */ d(
|
|
926
929
|
"button",
|
|
927
930
|
{
|
|
928
931
|
type: "button",
|
|
929
|
-
onClick: () =>
|
|
932
|
+
onClick: () => f((N) => !N),
|
|
930
933
|
"aria-label": "Add a meme",
|
|
931
|
-
"aria-expanded":
|
|
934
|
+
"aria-expanded": h,
|
|
932
935
|
title: "Add a meme",
|
|
933
936
|
"data-testid": "meme-button",
|
|
934
|
-
className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${
|
|
937
|
+
className: `shrink-0 rounded border border-border-light px-2 py-1.5 text-sm hover:border-primary ${h ? "text-text border-primary" : "text-text-secondary"}`,
|
|
935
938
|
children: /* @__PURE__ */ d(ut, { name: "image" })
|
|
936
939
|
}
|
|
937
940
|
)
|
|
@@ -941,11 +944,11 @@ function Da({ commands: t = Zt }) {
|
|
|
941
944
|
}
|
|
942
945
|
);
|
|
943
946
|
}
|
|
944
|
-
function
|
|
947
|
+
function Oa() {
|
|
945
948
|
const t = x((n) => n.roster), e = Object.values(t);
|
|
946
|
-
return e.length ? /* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: e.map((n) => /* @__PURE__ */ d(
|
|
949
|
+
return e.length ? /* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: e.map((n) => /* @__PURE__ */ d(Ha, { u: n }, n.clientId)) }) : /* @__PURE__ */ d("div", { className: "text-xs text-text-muted", children: "No users online" });
|
|
947
950
|
}
|
|
948
|
-
function
|
|
951
|
+
function Ha({ u: t }) {
|
|
949
952
|
const e = tt(t.sprite, t.avatarUrl);
|
|
950
953
|
return /* @__PURE__ */ _("div", { className: "flex items-center gap-2 py-0.5", children: [
|
|
951
954
|
/* @__PURE__ */ d(
|
|
@@ -962,7 +965,7 @@ function Oa({ u: t }) {
|
|
|
962
965
|
t.isLeader && /* @__PURE__ */ d("span", { className: "ml-auto px-1.5 py-0.5 rounded text-[9px] font-medium bg-success/20 text-success", children: "Leader" })
|
|
963
966
|
] });
|
|
964
967
|
}
|
|
965
|
-
function
|
|
968
|
+
function Ua() {
|
|
966
969
|
const t = x((s) => Object.keys(s.roster).length), [e, n] = $(!1), r = P(null);
|
|
967
970
|
return L(() => {
|
|
968
971
|
if (!e) return;
|
|
@@ -990,20 +993,20 @@ function Ha() {
|
|
|
990
993
|
t,
|
|
991
994
|
" online"
|
|
992
995
|
] }),
|
|
993
|
-
/* @__PURE__ */ d(
|
|
996
|
+
/* @__PURE__ */ d(Oa, {})
|
|
994
997
|
] })
|
|
995
998
|
] });
|
|
996
999
|
}
|
|
997
|
-
function
|
|
1000
|
+
function ja({ leaderId: t, clientId: e, keyType: n }) {
|
|
998
1001
|
return t !== null ? t === e : n === "leader";
|
|
999
1002
|
}
|
|
1000
|
-
const
|
|
1001
|
-
function
|
|
1002
|
-
return t &&
|
|
1003
|
+
const Ga = /-[0-9a-fA-F]{16}$/;
|
|
1004
|
+
function Wa(t) {
|
|
1005
|
+
return t && Ga.test(t) ? "leader" : null;
|
|
1003
1006
|
}
|
|
1004
|
-
const
|
|
1005
|
-
function
|
|
1006
|
-
const e = t ?
|
|
1007
|
+
const Va = /\/room\/([^/]+)\/?$/;
|
|
1008
|
+
function Ka(t) {
|
|
1009
|
+
const e = t ? Va.exec(t) : null;
|
|
1007
1010
|
if (!e) return null;
|
|
1008
1011
|
try {
|
|
1009
1012
|
return decodeURIComponent(e[1]);
|
|
@@ -1011,39 +1014,39 @@ function Va(t) {
|
|
|
1011
1014
|
return e[1];
|
|
1012
1015
|
}
|
|
1013
1016
|
}
|
|
1014
|
-
function
|
|
1015
|
-
return t && e?.roomKey === t ? e.type :
|
|
1017
|
+
function za(t, e) {
|
|
1018
|
+
return t && e?.roomKey === t ? e.type : Wa(t);
|
|
1016
1019
|
}
|
|
1017
1020
|
function nt() {
|
|
1018
1021
|
return x((t) => !!t.snapshot.leaderId && t.snapshot.leaderId === t.me.clientId);
|
|
1019
1022
|
}
|
|
1020
|
-
function
|
|
1023
|
+
function Mt() {
|
|
1021
1024
|
const t = x((n) => n.activeGameId), e = us();
|
|
1022
1025
|
return t ? e.find((n) => n.id === t) ?? null : null;
|
|
1023
1026
|
}
|
|
1024
1027
|
function en() {
|
|
1025
|
-
return x((t) =>
|
|
1028
|
+
return x((t) => ja({
|
|
1026
1029
|
leaderId: t.snapshot.leaderId,
|
|
1027
1030
|
clientId: t.me.clientId,
|
|
1028
|
-
keyType: Ka(
|
|
1031
|
+
keyType: za(Ka(globalThis.location?.pathname), t.roomKeyType)
|
|
1029
1032
|
}));
|
|
1030
1033
|
}
|
|
1031
1034
|
function pr() {
|
|
1032
1035
|
return x((t) => t.readiness);
|
|
1033
1036
|
}
|
|
1034
|
-
function
|
|
1037
|
+
function Ja() {
|
|
1035
1038
|
return x((t) => t.snapshot);
|
|
1036
1039
|
}
|
|
1037
|
-
const
|
|
1040
|
+
const Qa = 3e4;
|
|
1038
1041
|
function mr() {
|
|
1039
1042
|
const t = pr(), [e, n] = $(!1), [r, s] = $({ mediaId: t.mediaId, ready: t.ready });
|
|
1040
1043
|
return (r.mediaId !== t.mediaId || r.ready !== t.ready) && (s({ mediaId: t.mediaId, ready: t.ready }), n(!1)), L(() => {
|
|
1041
1044
|
if (t.ready) return;
|
|
1042
|
-
const i = setTimeout(() => n(!0),
|
|
1045
|
+
const i = setTimeout(() => n(!0), Qa);
|
|
1043
1046
|
return () => clearTimeout(i);
|
|
1044
1047
|
}, [t.mediaId, t.ready]), e;
|
|
1045
1048
|
}
|
|
1046
|
-
function
|
|
1049
|
+
function qa({ draw: t }) {
|
|
1047
1050
|
const e = P(null);
|
|
1048
1051
|
return L(() => {
|
|
1049
1052
|
const n = e.current;
|
|
@@ -1051,12 +1054,12 @@ function Qa({ draw: t }) {
|
|
|
1051
1054
|
return t(n) ?? void 0;
|
|
1052
1055
|
}, [t]), /* @__PURE__ */ d("div", { ref: e, "data-testid": "game-settings" });
|
|
1053
1056
|
}
|
|
1054
|
-
const
|
|
1055
|
-
function
|
|
1056
|
-
const t = x((
|
|
1057
|
-
if (
|
|
1057
|
+
const Ya = qt(() => import("./AdminPanel-nU-YUW-1.js")), Xa = qt(() => import("./PlaylistPanel-BHQKt_A8.js"));
|
|
1058
|
+
function Za() {
|
|
1059
|
+
const t = x((f) => f.chatCollapsed), e = xt(), n = x((f) => f.sidebarTab), r = x((f) => f.setSidebarTab), s = x((f) => f.healthSnapshot?.clients.length ?? 0), i = x((f) => !!f.playlist), a = nt(), l = en(), o = x((f) => f.gameSettings), c = x((f) => f.snapshot.mediaId), u = Mt() !== null;
|
|
1060
|
+
if (Et({ hasMedia: !!c, chatCollapsed: t, isFullscreen: e }))
|
|
1058
1061
|
return null;
|
|
1059
|
-
const
|
|
1062
|
+
const h = n === "health" && !a || n === "playlist" && !i ? "chat" : n;
|
|
1060
1063
|
return /* @__PURE__ */ _("aside", { className: "w-80 self-stretch border-l border-border flex flex-col bg-bg relative z-10", children: [
|
|
1061
1064
|
/* @__PURE__ */ _("div", { className: "chat-toolbar relative flex items-center gap-1 px-2 py-1.5 border-b border-border", children: [
|
|
1062
1065
|
/* @__PURE__ */ d(
|
|
@@ -1083,17 +1086,17 @@ function Xa() {
|
|
|
1083
1086
|
}
|
|
1084
1087
|
),
|
|
1085
1088
|
/* @__PURE__ */ d(Xs, {}),
|
|
1086
|
-
/* @__PURE__ */ d(Zs, { onNameChange: (
|
|
1087
|
-
|
|
1088
|
-
}, children: o ? /* @__PURE__ */ d(
|
|
1089
|
-
/* @__PURE__ */ d(
|
|
1089
|
+
/* @__PURE__ */ d(Zs, { onNameChange: (f) => {
|
|
1090
|
+
f && x.getState().me.clientId && ps(f);
|
|
1091
|
+
}, children: o ? /* @__PURE__ */ d(qa, { draw: o }) : null }),
|
|
1092
|
+
/* @__PURE__ */ d(Ua, {})
|
|
1090
1093
|
] }),
|
|
1091
1094
|
(a || i) && /* @__PURE__ */ _("div", { className: "flex border-b border-border shrink-0", children: [
|
|
1092
1095
|
/* @__PURE__ */ d(
|
|
1093
1096
|
"button",
|
|
1094
1097
|
{
|
|
1095
1098
|
onClick: () => r("chat"),
|
|
1096
|
-
className: `flex-1 text-xs py-1.5 transition-colors cursor-pointer ${
|
|
1099
|
+
className: `flex-1 text-xs py-1.5 transition-colors cursor-pointer ${h === "chat" ? "text-text border-b-2 border-primary" : "text-text-muted hover:text-text-secondary"}`,
|
|
1097
1100
|
children: "Chat"
|
|
1098
1101
|
}
|
|
1099
1102
|
),
|
|
@@ -1101,7 +1104,7 @@ function Xa() {
|
|
|
1101
1104
|
"button",
|
|
1102
1105
|
{
|
|
1103
1106
|
onClick: () => r("playlist"),
|
|
1104
|
-
className: `flex-1 text-xs py-1.5 transition-colors cursor-pointer ${
|
|
1107
|
+
className: `flex-1 text-xs py-1.5 transition-colors cursor-pointer ${h === "playlist" ? "text-text border-b-2 border-primary" : "text-text-muted hover:text-text-secondary"}`,
|
|
1105
1108
|
children: "Playlist"
|
|
1106
1109
|
}
|
|
1107
1110
|
),
|
|
@@ -1109,7 +1112,7 @@ function Xa() {
|
|
|
1109
1112
|
"button",
|
|
1110
1113
|
{
|
|
1111
1114
|
onClick: () => r("health"),
|
|
1112
|
-
className: `flex-1 text-xs py-1.5 transition-colors cursor-pointer flex items-center justify-center gap-1 ${
|
|
1115
|
+
className: `flex-1 text-xs py-1.5 transition-colors cursor-pointer flex items-center justify-center gap-1 ${h === "health" ? "text-text border-b-2 border-primary" : "text-text-muted hover:text-text-secondary"}`,
|
|
1113
1116
|
children: [
|
|
1114
1117
|
"Health",
|
|
1115
1118
|
/* @__PURE__ */ d("span", { className: "text-[10px] text-text-muted", children: s })
|
|
@@ -1117,80 +1120,80 @@ function Xa() {
|
|
|
1117
1120
|
}
|
|
1118
1121
|
)
|
|
1119
1122
|
] }),
|
|
1120
|
-
|
|
1121
|
-
/* @__PURE__ */ d(
|
|
1122
|
-
/* @__PURE__ */ d(
|
|
1123
|
+
h === "health" ? /* @__PURE__ */ d(Ve.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Ya, {}) }) : h === "playlist" ? /* @__PURE__ */ d(Ve.Suspense, { fallback: /* @__PURE__ */ d("div", { className: "p-4 text-xs text-text-muted", children: "Loading..." }), children: /* @__PURE__ */ d(Xa, {}) }) : /* @__PURE__ */ _(Se, { children: [
|
|
1124
|
+
/* @__PURE__ */ d(Ca, {}),
|
|
1125
|
+
/* @__PURE__ */ d(Ba, {})
|
|
1123
1126
|
] })
|
|
1124
1127
|
] });
|
|
1125
1128
|
}
|
|
1126
1129
|
const vn = (t) => typeof t == "string" && qs.includes(t);
|
|
1127
|
-
function
|
|
1130
|
+
function ei(t, e, n) {
|
|
1128
1131
|
return vn(e) ? e : vn(n) ? n : "dark";
|
|
1129
1132
|
}
|
|
1130
|
-
function
|
|
1133
|
+
function ti(t, e) {
|
|
1131
1134
|
if (!ms(t)) return null;
|
|
1132
1135
|
const n = new URL(t, e);
|
|
1133
1136
|
return n.origin === e ? n.href : null;
|
|
1134
1137
|
}
|
|
1135
|
-
function
|
|
1136
|
-
const n =
|
|
1138
|
+
function ni(t, e) {
|
|
1139
|
+
const n = ti(t.url, e);
|
|
1137
1140
|
return { id: t.id, name: t.name, load: n ? () => import(
|
|
1138
1141
|
/* @vite-ignore */
|
|
1139
1142
|
n
|
|
1140
1143
|
) : null };
|
|
1141
1144
|
}
|
|
1142
1145
|
const Je = (t) => t instanceof Error ? t.message : String(t);
|
|
1143
|
-
function
|
|
1146
|
+
function ri(t) {
|
|
1144
1147
|
let e = t.ctx, n = null, r = !1, s = !1;
|
|
1145
|
-
const i = /* @__PURE__ */ new Set(), a = (
|
|
1146
|
-
if (i.delete(
|
|
1148
|
+
const i = /* @__PURE__ */ new Set(), a = (f, y) => t.onSettingsError?.(f, y), l = (f) => {
|
|
1149
|
+
if (i.delete(f))
|
|
1147
1150
|
try {
|
|
1148
|
-
|
|
1149
|
-
} catch (
|
|
1150
|
-
a(`the game's settings failed to close: ${Je(
|
|
1151
|
+
f.cleanup();
|
|
1152
|
+
} catch (y) {
|
|
1153
|
+
a(`the game's settings failed to close: ${Je(y)}`, y);
|
|
1151
1154
|
}
|
|
1152
|
-
}, o = (
|
|
1153
|
-
for (const
|
|
1154
|
-
|
|
1155
|
-
}, c = (
|
|
1156
|
-
o(
|
|
1155
|
+
}, o = (f) => {
|
|
1156
|
+
for (const y of [...i]) l(y);
|
|
1157
|
+
f.mountSettings && t.onSettingsAvailable?.(!1);
|
|
1158
|
+
}, c = (f) => {
|
|
1159
|
+
o(f);
|
|
1157
1160
|
try {
|
|
1158
|
-
|
|
1159
|
-
} catch (
|
|
1160
|
-
s || t.onError(`unmount threw: ${Je(
|
|
1161
|
+
f.unmount();
|
|
1162
|
+
} catch (y) {
|
|
1163
|
+
s || t.onError(`unmount threw: ${Je(y)}`, y);
|
|
1161
1164
|
}
|
|
1162
|
-
}, u = (
|
|
1165
|
+
}, u = (f, y) => {
|
|
1163
1166
|
if (s || r) return;
|
|
1164
1167
|
s = !0;
|
|
1165
1168
|
const g = n;
|
|
1166
|
-
n = null, g && c(g), t.onError(
|
|
1167
|
-
},
|
|
1168
|
-
if (e =
|
|
1169
|
+
n = null, g && c(g), t.onError(f, y);
|
|
1170
|
+
}, h = (f) => {
|
|
1171
|
+
if (e = f, !(!n || r))
|
|
1169
1172
|
try {
|
|
1170
|
-
n.update(
|
|
1171
|
-
} catch (
|
|
1172
|
-
u(`the game failed to update: ${Je(
|
|
1173
|
+
n.update(f);
|
|
1174
|
+
} catch (y) {
|
|
1175
|
+
u(`the game failed to update: ${Je(y)}`, y);
|
|
1173
1176
|
}
|
|
1174
1177
|
};
|
|
1175
1178
|
return (async () => {
|
|
1176
|
-
let
|
|
1179
|
+
let f;
|
|
1177
1180
|
try {
|
|
1178
|
-
|
|
1179
|
-
} catch (
|
|
1180
|
-
u(`could not load the game: ${Je(
|
|
1181
|
+
f = await t.load();
|
|
1182
|
+
} catch (p) {
|
|
1183
|
+
u(`could not load the game: ${Je(p)}`, p);
|
|
1181
1184
|
return;
|
|
1182
1185
|
}
|
|
1183
1186
|
if (r) return;
|
|
1184
|
-
if (!ga(
|
|
1187
|
+
if (!ga(f)) {
|
|
1185
1188
|
u("the game module does not export mount()");
|
|
1186
1189
|
return;
|
|
1187
1190
|
}
|
|
1188
|
-
const
|
|
1191
|
+
const y = e;
|
|
1189
1192
|
let g;
|
|
1190
1193
|
try {
|
|
1191
|
-
g = await
|
|
1192
|
-
} catch (
|
|
1193
|
-
u(`the game failed to start: ${Je(
|
|
1194
|
+
g = await f.mount(t.el, y);
|
|
1195
|
+
} catch (p) {
|
|
1196
|
+
u(`the game failed to start: ${Je(p)}`, p);
|
|
1194
1197
|
return;
|
|
1195
1198
|
}
|
|
1196
1199
|
if (!ba(g)) {
|
|
@@ -1201,43 +1204,43 @@ function ni(t) {
|
|
|
1201
1204
|
c(g);
|
|
1202
1205
|
return;
|
|
1203
1206
|
}
|
|
1204
|
-
n = g, g.mountSettings && t.onSettingsAvailable?.(!0), e !==
|
|
1207
|
+
n = g, g.mountSettings && t.onSettingsAvailable?.(!0), e !== y && h(e);
|
|
1205
1208
|
})(), {
|
|
1206
|
-
update:
|
|
1209
|
+
update: h,
|
|
1207
1210
|
dispose() {
|
|
1208
1211
|
r || (r = !0, n && c(n), n = null);
|
|
1209
1212
|
},
|
|
1210
|
-
mountSettings(
|
|
1211
|
-
const
|
|
1212
|
-
if (!
|
|
1213
|
+
mountSettings(f) {
|
|
1214
|
+
const y = n;
|
|
1215
|
+
if (!y?.mountSettings || r) return null;
|
|
1213
1216
|
let g;
|
|
1214
1217
|
try {
|
|
1215
|
-
g =
|
|
1216
|
-
} catch (
|
|
1217
|
-
return a(`the game's settings failed to open: ${Je(
|
|
1218
|
+
g = y.mountSettings(f);
|
|
1219
|
+
} catch (v) {
|
|
1220
|
+
return a(`the game's settings failed to open: ${Je(v)}`, v), null;
|
|
1218
1221
|
}
|
|
1219
1222
|
if (typeof g != "function")
|
|
1220
1223
|
return a("the game's mountSettings() did not return a cleanup function"), null;
|
|
1221
|
-
const
|
|
1222
|
-
return i.add(
|
|
1224
|
+
const p = { cleanup: g };
|
|
1225
|
+
return i.add(p), () => l(p);
|
|
1223
1226
|
}
|
|
1224
1227
|
};
|
|
1225
1228
|
}
|
|
1226
1229
|
function Sn({ activity: t, roomKey: e, layer: n }) {
|
|
1227
|
-
const r = P(null), s = P(null), [i, a] = $(null), [l, o] = $(!1), c = x((k) => k.snapshot.leaderId), u = x((k) => k.me.clientId),
|
|
1230
|
+
const r = P(null), s = P(null), [i, a] = $(null), [l, o] = $(!1), c = x((k) => k.snapshot.leaderId), u = x((k) => k.me.clientId), h = !!c && c === u, f = x((k) => k.name), y = Ys()?.theme, g = ei(void 0, y, gs().theme), p = Ee(() => ({
|
|
1228
1231
|
roomKey: e,
|
|
1229
1232
|
identity: {
|
|
1230
1233
|
// The registry userId — what RoomChrome's `userId` prop is.
|
|
1231
1234
|
userId: ys(),
|
|
1232
1235
|
userType: bs(),
|
|
1233
|
-
name:
|
|
1236
|
+
name: f || null
|
|
1234
1237
|
},
|
|
1235
1238
|
theme: g,
|
|
1236
|
-
isLeader:
|
|
1239
|
+
isLeader: h,
|
|
1237
1240
|
close: () => {
|
|
1238
|
-
E("game", "bundle close", { gameId: t.id, isLeader:
|
|
1241
|
+
E("game", "bundle close", { gameId: t.id, isLeader: h, layer: n }), n !== "base" && (h ? Vn(null) : o(!0));
|
|
1239
1242
|
}
|
|
1240
|
-
}), [e,
|
|
1243
|
+
}), [e, f, g, h, t.id, n]), v = fe(() => p), w = fe((k, m) => {
|
|
1241
1244
|
C("game", "bundle failed", { gameId: t.id, message: k, cause: String(m) }), a(k);
|
|
1242
1245
|
}), A = fe((k, m) => {
|
|
1243
1246
|
C("game", "bundle settings failed", { gameId: t.id, message: k, cause: String(m) });
|
|
@@ -1246,10 +1249,10 @@ function Sn({ activity: t, roomKey: e, layer: n }) {
|
|
|
1246
1249
|
const k = r.current, m = t.load;
|
|
1247
1250
|
if (!k || !m || l) return;
|
|
1248
1251
|
E("game", "bundle mount", { gameId: t.id });
|
|
1249
|
-
const { setGameSettings: T } = x.getState(), R = (S) => b.mountSettings(S), b =
|
|
1252
|
+
const { setGameSettings: T } = x.getState(), R = (S) => b.mountSettings(S), b = ri({
|
|
1250
1253
|
load: m,
|
|
1251
1254
|
el: k,
|
|
1252
|
-
ctx:
|
|
1255
|
+
ctx: v(),
|
|
1253
1256
|
onError: w,
|
|
1254
1257
|
onSettingsAvailable: n === "overlay" ? (S) => {
|
|
1255
1258
|
const I = x.getState().gameSettings;
|
|
@@ -1261,8 +1264,8 @@ function Sn({ activity: t, roomKey: e, layer: n }) {
|
|
|
1261
1264
|
b.dispose(), s.current = null;
|
|
1262
1265
|
};
|
|
1263
1266
|
}, [t.id, t.load, l, n]), L(() => {
|
|
1264
|
-
s.current?.update(
|
|
1265
|
-
}, [
|
|
1267
|
+
s.current?.update(p);
|
|
1268
|
+
}, [p]), l) return null;
|
|
1266
1269
|
const F = t.load ? i : "This game is not served from this site.";
|
|
1267
1270
|
return /* @__PURE__ */ _(
|
|
1268
1271
|
"div",
|
|
@@ -1278,14 +1281,14 @@ function Sn({ activity: t, roomKey: e, layer: n }) {
|
|
|
1278
1281
|
" could not start"
|
|
1279
1282
|
] }),
|
|
1280
1283
|
/* @__PURE__ */ d("div", { className: "text-text-secondary text-sm", children: F }),
|
|
1281
|
-
n === "overlay" && /* @__PURE__ */ d("button", { type: "button", className: "drawer-btn", onClick: () =>
|
|
1284
|
+
n === "overlay" && /* @__PURE__ */ d("button", { type: "button", className: "drawer-btn", onClick: () => p.close(), children: "Close" })
|
|
1282
1285
|
] })
|
|
1283
1286
|
]
|
|
1284
1287
|
}
|
|
1285
1288
|
);
|
|
1286
1289
|
}
|
|
1287
|
-
const
|
|
1288
|
-
function
|
|
1290
|
+
const si = "drawer-btn";
|
|
1291
|
+
function ai({ open: t, onClose: e, header: n, footer: r, children: s }) {
|
|
1289
1292
|
return L(() => {
|
|
1290
1293
|
if (!t) return;
|
|
1291
1294
|
function i(a) {
|
|
@@ -1299,7 +1302,7 @@ function si({ open: t, onClose: e, header: n, footer: r, children: s }) {
|
|
|
1299
1302
|
onClick: (i) => i.stopPropagation(),
|
|
1300
1303
|
children: [
|
|
1301
1304
|
/* @__PURE__ */ _("div", { className: "p-3 border-b border-border flex items-center gap-2 text-sm", children: [
|
|
1302
|
-
/* @__PURE__ */ d("button", { onClick: e, className:
|
|
1305
|
+
/* @__PURE__ */ d("button", { onClick: e, className: si, children: "Close" }),
|
|
1303
1306
|
n
|
|
1304
1307
|
] }),
|
|
1305
1308
|
s,
|
|
@@ -1308,10 +1311,10 @@ function si({ open: t, onClose: e, header: n, footer: r, children: s }) {
|
|
|
1308
1311
|
}
|
|
1309
1312
|
) }) : null;
|
|
1310
1313
|
}
|
|
1311
|
-
function
|
|
1312
|
-
return /* @__PURE__ */ d(
|
|
1314
|
+
function ii({ open: t, onClose: e }) {
|
|
1315
|
+
return /* @__PURE__ */ d(ai, { open: t, onClose: e, children: /* @__PURE__ */ d("div", { className: "px-4 py-3 text-xs text-text-muted", children: "Loading…" }) });
|
|
1313
1316
|
}
|
|
1314
|
-
const gr = 9e3, wn = 1500,
|
|
1317
|
+
const gr = 9e3, wn = 1500, oi = {
|
|
1315
1318
|
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]",
|
|
1316
1319
|
cinema: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)]",
|
|
1317
1320
|
minimal: "drop-shadow-[0_2px_4px_rgba(0,0,0,0.9)] drop-shadow-[0_0_8px_rgba(0,0,0,0.7)]",
|
|
@@ -1320,11 +1323,11 @@ const gr = 9e3, wn = 1500, ii = {
|
|
|
1320
1323
|
textShadow: "none",
|
|
1321
1324
|
filter: "drop-shadow(0 0 1px black) drop-shadow(0 0 1px black)"
|
|
1322
1325
|
};
|
|
1323
|
-
function
|
|
1326
|
+
function ci({ message: t, age: e, ccStyle: n }) {
|
|
1324
1327
|
const r = gr - wn;
|
|
1325
1328
|
let s = 1;
|
|
1326
1329
|
e > r && (s = Math.max(0, 1 - (e - r) / wn));
|
|
1327
|
-
const i =
|
|
1330
|
+
const i = oi[n], a = x((u) => ir(u.roster, t.author)), l = tt(t.sprite, a), o = cr(t.isSystem ? void 0 : t.author), [c] = $(
|
|
1328
1331
|
() => t.live && t.text ? Hn(t.text, o) : null
|
|
1329
1332
|
);
|
|
1330
1333
|
return /* @__PURE__ */ _(
|
|
@@ -1343,56 +1346,56 @@ function oi({ message: t, age: e, ccStyle: n }) {
|
|
|
1343
1346
|
}
|
|
1344
1347
|
);
|
|
1345
1348
|
}
|
|
1346
|
-
function
|
|
1349
|
+
function li() {
|
|
1347
1350
|
or();
|
|
1348
|
-
const t = x((f) => f.chat), e = x((f) => f.chatCollapsed), n = x((f) => f.
|
|
1351
|
+
const t = x((f) => f.chat), e = x((f) => f.chatCollapsed), n = x((f) => f.snapshot.mediaId), r = x((f) => f.floatingChatEnabled), s = x((f) => f.mediaPrefs.subtitleStyle), [i, a] = $(!1), [l, o] = $(() => Date.now());
|
|
1349
1352
|
L(() => {
|
|
1350
1353
|
const f = () => {
|
|
1351
|
-
|
|
1354
|
+
a(!!document.fullscreenElement);
|
|
1352
1355
|
};
|
|
1353
1356
|
return document.addEventListener("fullscreenchange", f), f(), () => document.removeEventListener("fullscreenchange", f);
|
|
1354
1357
|
}, []);
|
|
1355
|
-
const
|
|
1358
|
+
const c = t.length > 0;
|
|
1356
1359
|
L(() => {
|
|
1357
1360
|
const f = setInterval(() => {
|
|
1358
|
-
|
|
1361
|
+
c && o(Date.now());
|
|
1359
1362
|
}, 200);
|
|
1360
1363
|
return () => clearInterval(f);
|
|
1361
|
-
}, [
|
|
1362
|
-
const
|
|
1363
|
-
const f =
|
|
1364
|
-
return t.filter((
|
|
1365
|
-
}, [t,
|
|
1366
|
-
return !
|
|
1364
|
+
}, [c]);
|
|
1365
|
+
const u = ya(r, { hasMedia: !!n, chatCollapsed: e, isFullscreen: i }), h = Ee(() => {
|
|
1366
|
+
const f = l - gr;
|
|
1367
|
+
return t.filter((y) => !y.isSystem && y.ts > f).slice(-12);
|
|
1368
|
+
}, [t, l]);
|
|
1369
|
+
return !u || h.length === 0 ? null : /* @__PURE__ */ d(
|
|
1367
1370
|
"div",
|
|
1368
1371
|
{
|
|
1369
1372
|
className: "absolute right-4 w-80 z-20 pointer-events-none flex flex-col",
|
|
1370
1373
|
style: { bottom: "35%" },
|
|
1371
1374
|
"data-testid": "floating-chat",
|
|
1372
|
-
children:
|
|
1373
|
-
|
|
1375
|
+
children: h.map((f) => /* @__PURE__ */ d(
|
|
1376
|
+
ci,
|
|
1374
1377
|
{
|
|
1375
1378
|
message: f,
|
|
1376
|
-
age:
|
|
1377
|
-
ccStyle:
|
|
1379
|
+
age: l - f.ts,
|
|
1380
|
+
ccStyle: s
|
|
1378
1381
|
},
|
|
1379
1382
|
f.id
|
|
1380
1383
|
))
|
|
1381
1384
|
}
|
|
1382
1385
|
);
|
|
1383
1386
|
}
|
|
1384
|
-
const
|
|
1387
|
+
const di = 2;
|
|
1385
1388
|
function br(t) {
|
|
1386
|
-
return t.duration_ms > 0 && t.duration_ms - t.playhead_ms <=
|
|
1389
|
+
return t.duration_ms > 0 && t.duration_ms - t.playhead_ms <= Yt;
|
|
1387
1390
|
}
|
|
1388
1391
|
function yr(t) {
|
|
1389
1392
|
const e = t.video_ready_state ?? -1;
|
|
1390
|
-
return e < 0 ? !0 : !(e <=
|
|
1393
|
+
return e < 0 ? !0 : !(e <= di && t.buffered_ahead_ms > Yt);
|
|
1391
1394
|
}
|
|
1392
|
-
function
|
|
1393
|
-
return t.playhead_ms === 0 && !t.is_buffering && t.buffered_ahead_ms === 0 ? "idle" : t.is_buffering ? "buffering" : br(t) ? "healthy" : !yr(t) || t.buffered_ahead_ms <= Kn ? "critical" : t.buffered_ahead_ms <=
|
|
1395
|
+
function _c(t) {
|
|
1396
|
+
return t.playhead_ms === 0 && !t.is_buffering && t.buffered_ahead_ms === 0 ? "idle" : t.is_buffering ? "buffering" : br(t) ? "healthy" : !yr(t) || t.buffered_ahead_ms <= Kn ? "critical" : t.buffered_ahead_ms <= Yt ? "warning" : "healthy";
|
|
1394
1397
|
}
|
|
1395
|
-
const
|
|
1398
|
+
const Ac = {
|
|
1396
1399
|
idle: "Idle",
|
|
1397
1400
|
buffering: "Buffering",
|
|
1398
1401
|
critical: "Critical",
|
|
@@ -1423,12 +1426,12 @@ function We(t, e, n = 0.15, r = 0) {
|
|
|
1423
1426
|
const i = s.currentTime + r, a = s.createOscillator(), l = s.createGain();
|
|
1424
1427
|
a.type = "sine", a.frequency.value = t, wr(l, i, n, e / 1e3), a.connect(l).connect(s.destination), a.start(i), a.stop(i + e / 1e3 + 0.05);
|
|
1425
1428
|
}
|
|
1426
|
-
function
|
|
1429
|
+
function Nt(t, e, n, r, s = 0.15, i = 0) {
|
|
1427
1430
|
const a = vr();
|
|
1428
1431
|
if (!a) return;
|
|
1429
1432
|
Sr(a);
|
|
1430
|
-
const l = a.currentTime + i, o = a.createOscillator(), c = a.createOscillator(), u = a.createGain(),
|
|
1431
|
-
o.type = "sine", o.frequency.value = t, c.type = "sine", c.frequency.value = e, u.gain.value = n * e, c.connect(u).connect(o.frequency), wr(
|
|
1433
|
+
const l = a.currentTime + i, o = a.createOscillator(), c = a.createOscillator(), u = a.createGain(), h = a.createGain();
|
|
1434
|
+
o.type = "sine", o.frequency.value = t, c.type = "sine", c.frequency.value = e, u.gain.value = n * e, c.connect(u).connect(o.frequency), wr(h, l, s, r / 1e3), o.connect(h).connect(a.destination), o.start(l), o.stop(l + r / 1e3 + 0.05), c.start(l), c.stop(l + r / 1e3 + 0.05);
|
|
1432
1435
|
}
|
|
1433
1436
|
function xr() {
|
|
1434
1437
|
We(700, 60, 0.14, 0), We(700, 60, 0.14, 0.1), We(932, 120, 0.17, 0.2);
|
|
@@ -1440,7 +1443,7 @@ function Mr() {
|
|
|
1440
1443
|
We(659, 45, 0.06, 0), We(494, 70, 0.06, 0.045);
|
|
1441
1444
|
}
|
|
1442
1445
|
function kr() {
|
|
1443
|
-
|
|
1446
|
+
Nt(587, 1174, 3, 320, 0.12, 0), Nt(880, 1760, 3, 320, 0.12, 0.06), Nt(884, 1768, 3, 320, 0.08, 0.06);
|
|
1444
1447
|
}
|
|
1445
1448
|
zn("__WP_SOUNDS__", {
|
|
1446
1449
|
start: xr,
|
|
@@ -1449,7 +1452,7 @@ zn("__WP_SOUNDS__", {
|
|
|
1449
1452
|
off: Mr
|
|
1450
1453
|
});
|
|
1451
1454
|
const Mn = { on: 0, off: 0 };
|
|
1452
|
-
function
|
|
1455
|
+
function ui(t, e, n, r) {
|
|
1453
1456
|
if (!n || !r) return Mn;
|
|
1454
1457
|
const s = new Set(t), i = new Set(e);
|
|
1455
1458
|
let a = 0;
|
|
@@ -1458,15 +1461,15 @@ function di(t, e, n, r) {
|
|
|
1458
1461
|
for (const o of s) i.has(o) || l++;
|
|
1459
1462
|
return a === 0 && l === 0 ? Mn : { on: a, off: l };
|
|
1460
1463
|
}
|
|
1461
|
-
const
|
|
1462
|
-
function
|
|
1464
|
+
const fi = 1200, be = 52, St = 4, Kt = (be - St) / 2, kn = 2 * Math.PI * Kt, $e = be - St * 2 - 4;
|
|
1465
|
+
function hi(t) {
|
|
1463
1466
|
return br(t) ? !0 : yr(t) ? t.buffered_ahead_ms >= Ce : !1;
|
|
1464
1467
|
}
|
|
1465
|
-
function
|
|
1468
|
+
function pi(t) {
|
|
1466
1469
|
return `hsl(${Math.round(t * 120)}, 90%, 55%)`;
|
|
1467
1470
|
}
|
|
1468
|
-
function
|
|
1469
|
-
const s = Math.min(1, t.buffered_ahead_ms / Ce), i = kn * (1 - s), a =
|
|
1471
|
+
function mi({ client: t, pictureUrl: e, fading: n, onFadeEnd: r }) {
|
|
1472
|
+
const s = Math.min(1, t.buffered_ahead_ms / Ce), i = kn * (1 - s), a = pi(s), l = tt(t.sprite_id, e);
|
|
1470
1473
|
return /* @__PURE__ */ _(
|
|
1471
1474
|
"div",
|
|
1472
1475
|
{
|
|
@@ -1474,7 +1477,7 @@ function pi({ client: t, pictureUrl: e, fading: n, onFadeEnd: r }) {
|
|
|
1474
1477
|
"data-client-id": t.client_id,
|
|
1475
1478
|
className: "flex flex-col items-center gap-1",
|
|
1476
1479
|
style: n ? {
|
|
1477
|
-
animation: `bufferFadeOut ${
|
|
1480
|
+
animation: `bufferFadeOut ${fi}ms ease forwards`
|
|
1478
1481
|
} : void 0,
|
|
1479
1482
|
onAnimationEnd: n ? r : void 0,
|
|
1480
1483
|
children: [
|
|
@@ -1492,7 +1495,7 @@ function pi({ client: t, pictureUrl: e, fading: n, onFadeEnd: r }) {
|
|
|
1492
1495
|
{
|
|
1493
1496
|
cx: be / 2,
|
|
1494
1497
|
cy: be / 2,
|
|
1495
|
-
r:
|
|
1498
|
+
r: Kt,
|
|
1496
1499
|
fill: "none",
|
|
1497
1500
|
stroke: "rgba(255,255,255,0.15)",
|
|
1498
1501
|
strokeWidth: St
|
|
@@ -1503,7 +1506,7 @@ function pi({ client: t, pictureUrl: e, fading: n, onFadeEnd: r }) {
|
|
|
1503
1506
|
{
|
|
1504
1507
|
cx: be / 2,
|
|
1505
1508
|
cy: be / 2,
|
|
1506
|
-
r:
|
|
1509
|
+
r: Kt,
|
|
1507
1510
|
fill: "none",
|
|
1508
1511
|
stroke: a,
|
|
1509
1512
|
strokeWidth: St,
|
|
@@ -1553,7 +1556,7 @@ function pi({ client: t, pictureUrl: e, fading: n, onFadeEnd: r }) {
|
|
|
1553
1556
|
}
|
|
1554
1557
|
);
|
|
1555
1558
|
}
|
|
1556
|
-
function
|
|
1559
|
+
function gi({ clientId: t, sprite: e, pictureUrl: n, name: r, isReady: s, isSelf: i, onToggle: a }) {
|
|
1557
1560
|
const l = tt(e, n), o = s ? "success" : "neutral", c = s ? /* @__PURE__ */ d(ut, { name: "tick" }) : /* @__PURE__ */ d(ut, { name: "hourglass" });
|
|
1558
1561
|
return /* @__PURE__ */ _(
|
|
1559
1562
|
"button",
|
|
@@ -1625,41 +1628,41 @@ function mi({ clientId: t, sprite: e, pictureUrl: n, name: r, isReady: s, isSelf
|
|
|
1625
1628
|
}
|
|
1626
1629
|
);
|
|
1627
1630
|
}
|
|
1628
|
-
const
|
|
1631
|
+
const bi = { status: null, entries: [], completed: /* @__PURE__ */ new Set(), below: /* @__PURE__ */ new Set() };
|
|
1629
1632
|
function _n(t, e) {
|
|
1630
1633
|
if (!e || e.clients.length === 0) return { ...t, status: e, entries: [] };
|
|
1631
1634
|
const n = new Set(t.completed), r = new Set(t.below), s = [];
|
|
1632
1635
|
for (const i of e.clients) {
|
|
1633
1636
|
const a = i.client_id;
|
|
1634
|
-
|
|
1637
|
+
hi(i) ? r.has(a) && !n.has(a) ? (n.add(a), s.push({ client: i, completed: !0 })) : n.has(a) && s.push({ client: i, completed: !0 }) : (n.delete(a), r.add(a), s.push({ client: i, completed: !1 }));
|
|
1635
1638
|
}
|
|
1636
1639
|
return { status: e, entries: s, completed: n, below: r };
|
|
1637
1640
|
}
|
|
1638
|
-
function
|
|
1639
|
-
const t = x((m) => m.bufferStatus), e = x((m) => m.readyCheck), n = x((m) => m.roster), r = x((m) => m.me.clientId), s = x((m) => m.snapshot.playing), i = nt(), [a, l] = $(() => _n(
|
|
1641
|
+
function yi() {
|
|
1642
|
+
const t = x((m) => m.bufferStatus), e = x((m) => m.readyCheck), n = x((m) => m.roster), r = x((m) => m.me.clientId), s = x((m) => m.snapshot.playing), i = nt(), [a, l] = $(() => _n(bi, t));
|
|
1640
1643
|
a.status !== t && l(_n(a, t));
|
|
1641
1644
|
const o = a.entries, c = (m) => {
|
|
1642
1645
|
l((T) => {
|
|
1643
1646
|
const R = new Set(T.completed), b = new Set(T.below);
|
|
1644
1647
|
return R.delete(m), b.delete(m), { ...T, completed: R, below: b, entries: T.entries.filter((S) => S.client.client_id !== m) };
|
|
1645
1648
|
});
|
|
1646
|
-
}, u = new Set(e.ready),
|
|
1649
|
+
}, u = new Set(e.ready), h = Object.values(n), f = !!r && u.has(r), y = e.active && h.length > 0 && e.ready.length >= h.length, g = P(e.active), p = P(y);
|
|
1647
1650
|
L(() => {
|
|
1648
1651
|
!g.current && e.active && xr(), g.current = e.active;
|
|
1649
1652
|
}, [e.active]), L(() => {
|
|
1650
|
-
!
|
|
1651
|
-
}, [
|
|
1652
|
-
const
|
|
1653
|
+
!p.current && y && kr(), p.current = y;
|
|
1654
|
+
}, [y]);
|
|
1655
|
+
const v = P(e.ready), w = P(e.active);
|
|
1653
1656
|
L(() => {
|
|
1654
|
-
const { on: m, off: T } =
|
|
1655
|
-
|
|
1657
|
+
const { on: m, off: T } = ui(
|
|
1658
|
+
v.current,
|
|
1656
1659
|
e.ready,
|
|
1657
1660
|
w.current,
|
|
1658
1661
|
e.active
|
|
1659
1662
|
);
|
|
1660
|
-
m > 0 && Er(), T > 0 && Mr(),
|
|
1663
|
+
m > 0 && Er(), T > 0 && Mr(), v.current = e.ready, w.current = e.active;
|
|
1661
1664
|
}, [e.ready, e.active]);
|
|
1662
|
-
const A = e.active, F = !A && o.length > 0, k = !A && !F && i &&
|
|
1665
|
+
const A = e.active, F = !A && o.length > 0, k = !A && !F && i && h.length > 0 && !s;
|
|
1663
1666
|
return !A && !F && !k ? null : /* @__PURE__ */ _(Se, { children: [
|
|
1664
1667
|
/* @__PURE__ */ d("style", { children: `
|
|
1665
1668
|
@keyframes bufferFadeOut {
|
|
@@ -1685,12 +1688,12 @@ function bi() {
|
|
|
1685
1688
|
"Ready ",
|
|
1686
1689
|
e.ready.length,
|
|
1687
1690
|
"/",
|
|
1688
|
-
|
|
1691
|
+
h.length
|
|
1689
1692
|
]
|
|
1690
1693
|
}
|
|
1691
1694
|
),
|
|
1692
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col gap-3", children:
|
|
1693
|
-
|
|
1695
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-3", children: h.map((m) => /* @__PURE__ */ d(
|
|
1696
|
+
gi,
|
|
1694
1697
|
{
|
|
1695
1698
|
clientId: m.clientId,
|
|
1696
1699
|
sprite: m.sprite,
|
|
@@ -1698,13 +1701,13 @@ function bi() {
|
|
|
1698
1701
|
name: m.name || "Anon",
|
|
1699
1702
|
isReady: u.has(m.clientId),
|
|
1700
1703
|
isSelf: m.clientId === r,
|
|
1701
|
-
onToggle: () => vs(!
|
|
1704
|
+
onToggle: () => vs(!f)
|
|
1702
1705
|
},
|
|
1703
1706
|
m.clientId
|
|
1704
1707
|
)) })
|
|
1705
1708
|
] }),
|
|
1706
1709
|
F && o.map(({ client: m, completed: T }) => /* @__PURE__ */ d(
|
|
1707
|
-
|
|
1710
|
+
mi,
|
|
1708
1711
|
{
|
|
1709
1712
|
client: m,
|
|
1710
1713
|
pictureUrl: n[m.client_id]?.avatarUrl,
|
|
@@ -1730,7 +1733,7 @@ function bi() {
|
|
|
1730
1733
|
)
|
|
1731
1734
|
] });
|
|
1732
1735
|
}
|
|
1733
|
-
const
|
|
1736
|
+
const zt = {
|
|
1734
1737
|
S: "var(--color-tier-s)",
|
|
1735
1738
|
A: "var(--color-tier-a)",
|
|
1736
1739
|
B: "var(--color-tier-b)",
|
|
@@ -1788,7 +1791,7 @@ function An({
|
|
|
1788
1791
|
}
|
|
1789
1792
|
);
|
|
1790
1793
|
}
|
|
1791
|
-
function
|
|
1794
|
+
function vi({ sprite: t, url: e }) {
|
|
1792
1795
|
const n = tt(t, e);
|
|
1793
1796
|
return /* @__PURE__ */ d(
|
|
1794
1797
|
pt,
|
|
@@ -1801,7 +1804,7 @@ function yi({ sprite: t, url: e }) {
|
|
|
1801
1804
|
}
|
|
1802
1805
|
);
|
|
1803
1806
|
}
|
|
1804
|
-
function
|
|
1807
|
+
function Si({
|
|
1805
1808
|
anchor: t,
|
|
1806
1809
|
itemId: e,
|
|
1807
1810
|
snap: n
|
|
@@ -1813,8 +1816,8 @@ function vi({
|
|
|
1813
1816
|
const c = o.getBoundingClientRect();
|
|
1814
1817
|
let u = t.left + t.width / 2 - c.width / 2;
|
|
1815
1818
|
u = Math.max(8, Math.min(u, window.innerWidth - c.width - 8));
|
|
1816
|
-
let
|
|
1817
|
-
|
|
1819
|
+
let h = t.top - c.height - 8;
|
|
1820
|
+
h < 8 && (h = t.bottom + 8), i({ left: Math.round(u), top: Math.round(h) });
|
|
1818
1821
|
}, [t, e]), !a) return null;
|
|
1819
1822
|
const l = n.items.find((o) => o.id === e)?.displayName ?? e;
|
|
1820
1823
|
return wt(
|
|
@@ -1828,13 +1831,13 @@ function vi({
|
|
|
1828
1831
|
children: [
|
|
1829
1832
|
/* @__PURE__ */ d("div", { className: "text-[11px] font-semibold text-text leading-snug pb-1.5 mb-1.5 border-b border-border", children: l }),
|
|
1830
1833
|
Object.entries(a.votes).map(([o, c]) => /* @__PURE__ */ _("div", { className: "flex items-center gap-2 py-0.5", children: [
|
|
1831
|
-
/* @__PURE__ */ d(
|
|
1834
|
+
/* @__PURE__ */ d(vi, { sprite: n.sprites[o], url: n.pictures?.[o] }),
|
|
1832
1835
|
/* @__PURE__ */ d("span", { className: "flex-1 text-[11px] text-text-secondary truncate", children: n.names[o] ?? "viewer" }),
|
|
1833
1836
|
/* @__PURE__ */ d(
|
|
1834
1837
|
"span",
|
|
1835
1838
|
{
|
|
1836
1839
|
className: "w-5 h-4 grid place-items-center rounded text-[10px] font-bold shrink-0",
|
|
1837
|
-
style: { background:
|
|
1840
|
+
style: { background: zt[c], color: "var(--color-tier-ink)" },
|
|
1838
1841
|
children: c
|
|
1839
1842
|
}
|
|
1840
1843
|
)
|
|
@@ -1845,8 +1848,8 @@ function vi({
|
|
|
1845
1848
|
document.body
|
|
1846
1849
|
);
|
|
1847
1850
|
}
|
|
1848
|
-
function
|
|
1849
|
-
const t = x((b) => b.tierlistOpen), e = x((b) => b.setTierlistOpen), n = x((b) => b.tierlist), r = x((b) => b.tierlistDraft), s = x((b) => b.tierlistSaving), i = x((b) => b.moveTierlistItem), [a, l] = $(null), [o, c] = $(null), [u,
|
|
1851
|
+
function wi() {
|
|
1852
|
+
const t = x((b) => b.tierlistOpen), e = x((b) => b.setTierlistOpen), n = x((b) => b.tierlist), r = x((b) => b.tierlistDraft), s = x((b) => b.tierlistSaving), i = x((b) => b.moveTierlistItem), [a, l] = $(null), [o, c] = $(null), [u, h] = $(null), [f, y] = $(null), [g, p] = $("mine");
|
|
1850
1853
|
L(() => {
|
|
1851
1854
|
un(!0);
|
|
1852
1855
|
}, []), L(() => {
|
|
@@ -1858,16 +1861,16 @@ function Si() {
|
|
|
1858
1861
|
};
|
|
1859
1862
|
return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
|
|
1860
1863
|
}, [t, e]);
|
|
1861
|
-
const
|
|
1864
|
+
const v = Ee(() => new Map((n?.items ?? []).map((b) => [b.id, b])), [n]), w = Ee(() => {
|
|
1862
1865
|
const b = { S: [], A: [], B: [], C: [], D: [], F: [], [Ge]: [] }, S = /* @__PURE__ */ new Set();
|
|
1863
|
-
for (const I of
|
|
1866
|
+
for (const I of It)
|
|
1864
1867
|
for (const B of r[I] ?? []) {
|
|
1865
|
-
const H =
|
|
1868
|
+
const H = v.get(B);
|
|
1866
1869
|
H && (b[I].push(H), S.add(B));
|
|
1867
1870
|
}
|
|
1868
|
-
for (const I of
|
|
1871
|
+
for (const I of v.values()) S.has(I.id) || b[Ge].push(I);
|
|
1869
1872
|
return b;
|
|
1870
|
-
}, [r,
|
|
1873
|
+
}, [r, v]), A = (b, S, I) => {
|
|
1871
1874
|
const B = [...b.querySelectorAll("article[data-item-id]")].filter((j) => j.dataset.itemId !== I);
|
|
1872
1875
|
let H = 0;
|
|
1873
1876
|
for (const j of B) {
|
|
@@ -1889,13 +1892,13 @@ function Si() {
|
|
|
1889
1892
|
a && (i(a, b === Ge ? null : b), l(null));
|
|
1890
1893
|
}
|
|
1891
1894
|
}), k = U(async () => {
|
|
1892
|
-
await ws(x.getState().tierlistDraft) &&
|
|
1895
|
+
await ws(x.getState().tierlistDraft) && y(Date.now());
|
|
1893
1896
|
}, []);
|
|
1894
1897
|
if (L(() => {
|
|
1895
|
-
if (
|
|
1896
|
-
const b = setTimeout(() =>
|
|
1898
|
+
if (f === null) return;
|
|
1899
|
+
const b = setTimeout(() => y(null), 2500);
|
|
1897
1900
|
return () => clearTimeout(b);
|
|
1898
|
-
}, [
|
|
1901
|
+
}, [f]), !t) return null;
|
|
1899
1902
|
const m = JSON.stringify(r) !== JSON.stringify(n?.myBoard ?? {}), T = Object.values(n?.myBoard ?? {}).some((b) => (b?.length ?? 0) > 0), R = T ? g : "mine";
|
|
1900
1903
|
return wt(
|
|
1901
1904
|
/* @__PURE__ */ _(
|
|
@@ -1922,13 +1925,13 @@ function Si() {
|
|
|
1922
1925
|
role: "tab",
|
|
1923
1926
|
"aria-selected": R === b,
|
|
1924
1927
|
className: "tl-tab",
|
|
1925
|
-
onClick: () =>
|
|
1928
|
+
onClick: () => p(b),
|
|
1926
1929
|
children: S
|
|
1927
1930
|
},
|
|
1928
1931
|
b
|
|
1929
1932
|
)) }),
|
|
1930
1933
|
/* @__PURE__ */ d("div", { className: "flex-1" }),
|
|
1931
|
-
|
|
1934
|
+
f !== null && /* @__PURE__ */ d("span", { className: "text-[11px] bg-success-bg text-on-success-bg px-1.5 py-1 rounded leading-none", children: "Saved" }),
|
|
1932
1935
|
/* @__PURE__ */ d("button", { className: "tl-save", disabled: s || !m, onClick: () => {
|
|
1933
1936
|
k();
|
|
1934
1937
|
}, children: s ? "Saving…" : "Save" }),
|
|
@@ -1936,12 +1939,12 @@ function Si() {
|
|
|
1936
1939
|
] }),
|
|
1937
1940
|
/* @__PURE__ */ _("div", { className: "flex-1 overflow-y-auto", children: [
|
|
1938
1941
|
R === "mine" && /* @__PURE__ */ _(Se, { children: [
|
|
1939
|
-
|
|
1942
|
+
It.map((b) => /* @__PURE__ */ _("div", { className: "grid grid-cols-[56px_1fr] border-b border-border/50 min-h-[86px]", children: [
|
|
1940
1943
|
/* @__PURE__ */ d(
|
|
1941
1944
|
"div",
|
|
1942
1945
|
{
|
|
1943
1946
|
className: "grid place-items-center select-none cursor-pointer",
|
|
1944
|
-
style: { background:
|
|
1947
|
+
style: { background: zt[b], color: "var(--color-tier-ink)" },
|
|
1945
1948
|
onClick: () => {
|
|
1946
1949
|
a && (i(a, b), l(null));
|
|
1947
1950
|
},
|
|
@@ -1987,27 +1990,27 @@ function Si() {
|
|
|
1987
1990
|
}
|
|
1988
1991
|
)
|
|
1989
1992
|
] }),
|
|
1990
|
-
R === "everyone" && n && /* @__PURE__ */ d(Se, { children:
|
|
1993
|
+
R === "everyone" && n && /* @__PURE__ */ d(Se, { children: It.map((b) => {
|
|
1991
1994
|
const S = n.placed.filter((I) => I.tier === b);
|
|
1992
1995
|
return /* @__PURE__ */ _("div", { className: "grid grid-cols-[56px_1fr] border-b border-border/50 min-h-[86px]", children: [
|
|
1993
1996
|
/* @__PURE__ */ d(
|
|
1994
1997
|
"div",
|
|
1995
1998
|
{
|
|
1996
1999
|
className: "grid place-items-center select-none",
|
|
1997
|
-
style: { background:
|
|
2000
|
+
style: { background: zt[b], color: "var(--color-tier-ink)" },
|
|
1998
2001
|
children: /* @__PURE__ */ d("span", { className: "text-2xl font-bold leading-none", children: b })
|
|
1999
2002
|
}
|
|
2000
2003
|
),
|
|
2001
2004
|
/* @__PURE__ */ d("div", { className: "flex items-stretch gap-2 p-2 overflow-x-auto bg-bg-card", children: S.map((I) => {
|
|
2002
|
-
const B =
|
|
2005
|
+
const B = v.get(I.mediaId);
|
|
2003
2006
|
return /* @__PURE__ */ _(
|
|
2004
2007
|
"div",
|
|
2005
2008
|
{
|
|
2006
2009
|
tabIndex: 0,
|
|
2007
|
-
onMouseEnter: (H) =>
|
|
2008
|
-
onMouseLeave: () =>
|
|
2009
|
-
onFocus: (H) =>
|
|
2010
|
-
onBlur: () =>
|
|
2010
|
+
onMouseEnter: (H) => h({ anchor: H.currentTarget.getBoundingClientRect(), itemId: I.mediaId }),
|
|
2011
|
+
onMouseLeave: () => h(null),
|
|
2012
|
+
onFocus: (H) => h({ anchor: H.currentTarget.getBoundingClientRect(), itemId: I.mediaId }),
|
|
2013
|
+
onBlur: () => h(null),
|
|
2011
2014
|
"aria-label": `${B?.displayName ?? I.mediaId} — score ${I.score.toFixed(2)}. ${Object.entries(I.votes).map(([H, j]) => `${n.names[H] ?? "viewer"} ${j}`).join(", ")}`,
|
|
2012
2015
|
className: "w-[124px] shrink-0 rounded-md overflow-hidden bg-bg-alt border border-border hover:border-primary transition-colors",
|
|
2013
2016
|
children: [
|
|
@@ -2044,81 +2047,81 @@ function Si() {
|
|
|
2044
2047
|
]
|
|
2045
2048
|
}
|
|
2046
2049
|
),
|
|
2047
|
-
u && n && /* @__PURE__ */ d(
|
|
2050
|
+
u && n && /* @__PURE__ */ d(Si, { anchor: u.anchor, itemId: u.itemId, snap: n })
|
|
2048
2051
|
]
|
|
2049
2052
|
}
|
|
2050
2053
|
),
|
|
2051
2054
|
document.body
|
|
2052
2055
|
);
|
|
2053
2056
|
}
|
|
2054
|
-
function
|
|
2057
|
+
function xi({ children: t }) {
|
|
2055
2058
|
const [e, n] = $(null);
|
|
2056
2059
|
return L(() => {
|
|
2057
2060
|
const r = () => n(document.fullscreenElement);
|
|
2058
2061
|
return r(), document.addEventListener("fullscreenchange", r), () => document.removeEventListener("fullscreenchange", r);
|
|
2059
2062
|
}, []), e ? wt(t, e) : /* @__PURE__ */ d(Se, { children: t });
|
|
2060
2063
|
}
|
|
2061
|
-
function
|
|
2064
|
+
function Tc({ className: t = "w-5 h-5" }) {
|
|
2062
2065
|
return /* @__PURE__ */ d("svg", { className: t, fill: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ d("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" }) });
|
|
2063
2066
|
}
|
|
2064
|
-
function
|
|
2067
|
+
function Ei({ className: t = "w-5 h-5" }) {
|
|
2065
2068
|
return /* @__PURE__ */ d("svg", { className: t, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ d("path", { d: "M8 5v14l11-7z" }) });
|
|
2066
2069
|
}
|
|
2067
|
-
function
|
|
2070
|
+
function Mi({ className: t = "w-5 h-5" }) {
|
|
2068
2071
|
return /* @__PURE__ */ d("svg", { className: t, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ d("path", { d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z" }) });
|
|
2069
2072
|
}
|
|
2070
|
-
function
|
|
2073
|
+
function ki({ className: t = "w-5 h-5" }) {
|
|
2071
2074
|
return /* @__PURE__ */ _("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2072
2075
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
|
|
2073
2076
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" })
|
|
2074
2077
|
] });
|
|
2075
2078
|
}
|
|
2076
|
-
function
|
|
2079
|
+
function _i({ className: t = "w-5 h-5" }) {
|
|
2077
2080
|
return /* @__PURE__ */ _("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2078
2081
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
|
|
2079
2082
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.536 8.464a5 5 0 010 7.072" })
|
|
2080
2083
|
] });
|
|
2081
2084
|
}
|
|
2082
|
-
function
|
|
2085
|
+
function Ai({ className: t = "w-5 h-5" }) {
|
|
2083
2086
|
return /* @__PURE__ */ _("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2084
2087
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" }),
|
|
2085
2088
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.536 8.464a5 5 0 010 7.072M18.364 5.636a9 9 0 010 12.728" })
|
|
2086
2089
|
] });
|
|
2087
2090
|
}
|
|
2088
|
-
function
|
|
2091
|
+
function Ti({ className: t = "w-5 h-5" }) {
|
|
2089
2092
|
return /* @__PURE__ */ d("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
|
|
2090
2093
|
}
|
|
2091
|
-
function
|
|
2094
|
+
function Ii({ className: t = "w-5 h-5" }) {
|
|
2092
2095
|
return /* @__PURE__ */ d("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 9V4H4m0 0l5 5M9 15v5H4m0 0l5-5M15 9V4h5m0 0l-5 5M15 15v5h5m0 0l-5-5" }) });
|
|
2093
2096
|
}
|
|
2094
|
-
function
|
|
2097
|
+
function Ci({ className: t = "w-5 h-5" }) {
|
|
2095
2098
|
return /* @__PURE__ */ d("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 19l-7-7 7-7" }) });
|
|
2096
2099
|
}
|
|
2097
|
-
function
|
|
2100
|
+
function Ri({ className: t = "w-5 h-5" }) {
|
|
2098
2101
|
return /* @__PURE__ */ d("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) });
|
|
2099
2102
|
}
|
|
2100
|
-
function
|
|
2103
|
+
function Fi({ className: t = "w-4 h-4" }) {
|
|
2101
2104
|
return /* @__PURE__ */ _("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2102
2105
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 4v16" }),
|
|
2103
2106
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12l-5 4v-8l5 4z" })
|
|
2104
2107
|
] });
|
|
2105
2108
|
}
|
|
2106
|
-
function
|
|
2109
|
+
function Ni({ className: t = "w-4 h-4" }) {
|
|
2107
2110
|
return /* @__PURE__ */ _("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
2108
2111
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M20 4v16" }),
|
|
2109
2112
|
/* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12l5 4v-8l-5 4z" })
|
|
2110
2113
|
] });
|
|
2111
2114
|
}
|
|
2112
|
-
function
|
|
2115
|
+
function Li({ className: t = "w-5 h-5" }) {
|
|
2113
2116
|
return /* @__PURE__ */ d("svg", { className: t, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ d("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 6l12 12M18 6L6 18" }) });
|
|
2114
2117
|
}
|
|
2115
|
-
function
|
|
2118
|
+
function $i({ className: t = "w-5 h-5" }) {
|
|
2116
2119
|
return /* @__PURE__ */ _("svg", { className: t, viewBox: "0 0 24 24", fill: "currentColor", children: [
|
|
2117
2120
|
/* @__PURE__ */ d("path", { d: "M12 5l8 11H4z" }),
|
|
2118
2121
|
/* @__PURE__ */ d("rect", { x: "4", y: "17", width: "16", height: "3", rx: "0.5" })
|
|
2119
2122
|
] });
|
|
2120
2123
|
}
|
|
2121
|
-
function
|
|
2124
|
+
function Pi({ className: t = "w-5 h-5" }) {
|
|
2122
2125
|
return /* @__PURE__ */ d("svg", { className: t, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ d("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" }) });
|
|
2123
2126
|
}
|
|
2124
2127
|
function Ar({ site: t = "control bar", className: e = "ctr-btn" }) {
|
|
@@ -2129,12 +2132,12 @@ function Ar({ site: t = "control bar", className: e = "ctr-btn" }) {
|
|
|
2129
2132
|
className: e,
|
|
2130
2133
|
title: "Select Media",
|
|
2131
2134
|
"aria-label": "Select Media",
|
|
2132
|
-
children: /* @__PURE__ */ d(
|
|
2135
|
+
children: /* @__PURE__ */ d(Pi, {})
|
|
2133
2136
|
}
|
|
2134
2137
|
);
|
|
2135
2138
|
}
|
|
2136
|
-
function
|
|
2137
|
-
const t = x((a) => a.chatCollapsed), e = x((a) => a.toggleChatCollapsed), n = x((a) => !!a.snapshot.mediaId), r = xt(), s =
|
|
2139
|
+
function Di() {
|
|
2140
|
+
const t = x((a) => a.chatCollapsed), e = x((a) => a.toggleChatCollapsed), n = x((a) => !!a.snapshot.mediaId), r = xt(), s = Et({ hasMedia: n, chatCollapsed: t, isFullscreen: r });
|
|
2138
2141
|
return { panelHidden: s, toggle: () => {
|
|
2139
2142
|
if (E("chat", s ? "Show chat" : "Hide chat", { isFullscreen: r, chatCollapsed: t }), !s) {
|
|
2140
2143
|
e();
|
|
@@ -2146,7 +2149,7 @@ function Pi() {
|
|
|
2146
2149
|
} };
|
|
2147
2150
|
}
|
|
2148
2151
|
function Tr({ className: t }) {
|
|
2149
|
-
const { panelHidden: e, toggle: n } =
|
|
2152
|
+
const { panelHidden: e, toggle: n } = Di(), r = e ? "Show chat" : "Hide chat";
|
|
2150
2153
|
return /* @__PURE__ */ d(
|
|
2151
2154
|
"button",
|
|
2152
2155
|
{
|
|
@@ -2156,12 +2159,12 @@ function Tr({ className: t }) {
|
|
|
2156
2159
|
title: r,
|
|
2157
2160
|
"aria-label": r,
|
|
2158
2161
|
"aria-expanded": !e,
|
|
2159
|
-
children: e ? /* @__PURE__ */ d(
|
|
2162
|
+
children: e ? /* @__PURE__ */ d(Ni, { className: "w-5 h-5" }) : /* @__PURE__ */ d(Fi, { className: "w-5 h-5" })
|
|
2160
2163
|
}
|
|
2161
2164
|
);
|
|
2162
2165
|
}
|
|
2163
|
-
function
|
|
2164
|
-
const t = x((u) => u.chatCollapsed), e = x((u) => !!u.snapshot.mediaId), n = xt(), r =
|
|
2166
|
+
function Bi() {
|
|
2167
|
+
const t = x((u) => u.chatCollapsed), e = x((u) => !!u.snapshot.mediaId), n = xt(), r = Mt(), s = nt(), i = en(), a = Xt({
|
|
2165
2168
|
isLeader: i,
|
|
2166
2169
|
hasMedia: e,
|
|
2167
2170
|
chatCollapsed: t,
|
|
@@ -2172,11 +2175,11 @@ function Di() {
|
|
|
2172
2175
|
a && /* @__PURE__ */ d(Ar, { site: "room corner", className: "corner-btn" }),
|
|
2173
2176
|
l && /* @__PURE__ */ d("button", { type: "button", onClick: () => {
|
|
2174
2177
|
E("game", "game_select", { gameId: null, source: "room corner" }), Vn(null);
|
|
2175
|
-
}, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ d(
|
|
2178
|
+
}, className: "corner-btn", title: "Stop game", "aria-label": "Stop game", children: /* @__PURE__ */ d(Li, {}) }),
|
|
2176
2179
|
o && /* @__PURE__ */ d(Tr, { className: "corner-btn" })
|
|
2177
2180
|
] });
|
|
2178
2181
|
}
|
|
2179
|
-
function
|
|
2182
|
+
function Oi() {
|
|
2180
2183
|
L(() => xs((t) => {
|
|
2181
2184
|
const e = Es(t);
|
|
2182
2185
|
E("avatar", "Avatar changed in the settings popout", { sprite: e, source: t.avatar?.source }), Qn(e);
|
|
@@ -2195,33 +2198,33 @@ function Qe() {
|
|
|
2195
2198
|
C("audio", "audio-unlock callback threw", Y(n));
|
|
2196
2199
|
}
|
|
2197
2200
|
}
|
|
2198
|
-
let
|
|
2199
|
-
function
|
|
2200
|
-
return
|
|
2201
|
-
} : (
|
|
2202
|
-
document.removeEventListener("click", Qe, { capture: !0 }), document.removeEventListener("touchend", Qe, { capture: !0 }), document.removeEventListener("keydown", Qe, { capture: !0 }),
|
|
2201
|
+
let Lt = !1;
|
|
2202
|
+
function Hi() {
|
|
2203
|
+
return Lt ? () => {
|
|
2204
|
+
} : (Lt = !0, document.addEventListener("click", Qe, { capture: !0, passive: !0 }), document.addEventListener("touchend", Qe, { capture: !0, passive: !0 }), document.addEventListener("keydown", Qe, { capture: !0, passive: !0 }), () => {
|
|
2205
|
+
document.removeEventListener("click", Qe, { capture: !0 }), document.removeEventListener("touchend", Qe, { capture: !0 }), document.removeEventListener("keydown", Qe, { capture: !0 }), Lt = !1;
|
|
2203
2206
|
});
|
|
2204
2207
|
}
|
|
2205
|
-
const
|
|
2206
|
-
function
|
|
2208
|
+
const Ui = 400;
|
|
2209
|
+
function ji(t) {
|
|
2207
2210
|
return t === "leader" || t === "viewer" ? t : null;
|
|
2208
2211
|
}
|
|
2209
|
-
async function
|
|
2212
|
+
async function Gi(t) {
|
|
2210
2213
|
const e = Ms(), n = await fetch(`${e}/api/rooms/validate/${encodeURIComponent(t)}`);
|
|
2211
2214
|
if (n.status === 404) return null;
|
|
2212
2215
|
if (!n.ok) throw new Error(`validate returned ${n.status}`);
|
|
2213
2216
|
const r = await n.json();
|
|
2214
|
-
return
|
|
2217
|
+
return ji(r?.type);
|
|
2215
2218
|
}
|
|
2216
|
-
async function
|
|
2219
|
+
async function Wi(t) {
|
|
2217
2220
|
for (let e = 0; e < 2; e++)
|
|
2218
2221
|
try {
|
|
2219
|
-
const n = await
|
|
2222
|
+
const n = await Gi(t);
|
|
2220
2223
|
x.getState().setRoomKeyType({ roomKey: t, type: n }), E("room", "Room key type probed", { roomKey: t, type: n });
|
|
2221
2224
|
return;
|
|
2222
2225
|
} catch (n) {
|
|
2223
2226
|
if (e === 0) {
|
|
2224
|
-
await new Promise((r) => setTimeout(r,
|
|
2227
|
+
await new Promise((r) => setTimeout(r, Ui));
|
|
2225
2228
|
continue;
|
|
2226
2229
|
}
|
|
2227
2230
|
C("room", "Room key type probe failed, falling back to socket truth", Y(n));
|
|
@@ -2231,14 +2234,14 @@ function Pe(t, e) {
|
|
|
2231
2234
|
const r = x.getState().allocateClientSeq(), s = { kind: t, client_seq: r, ...e || {} };
|
|
2232
2235
|
return qn().emit(Yn.CONTROL, s), r;
|
|
2233
2236
|
}
|
|
2234
|
-
function
|
|
2237
|
+
function Ic(t) {
|
|
2235
2238
|
return Pe("load", { media_id: t });
|
|
2236
2239
|
}
|
|
2237
|
-
function
|
|
2240
|
+
function Vi() {
|
|
2238
2241
|
return Pe("home");
|
|
2239
2242
|
}
|
|
2240
|
-
function
|
|
2241
|
-
const t =
|
|
2243
|
+
function Ki() {
|
|
2244
|
+
const t = Ja(), e = pr(), n = nt(), r = mr(), s = n && r && !e.ready, i = !e.ready && !s;
|
|
2242
2245
|
return /* @__PURE__ */ d(
|
|
2243
2246
|
"button",
|
|
2244
2247
|
{
|
|
@@ -2258,13 +2261,13 @@ function Vi() {
|
|
|
2258
2261
|
className: "ctr-btn",
|
|
2259
2262
|
title: s ? "Some viewers still loading — play anyway" : i ? "Waiting for sync..." : n ? t.playing ? "Pause" : "Play" : "Only the leader can control playback",
|
|
2260
2263
|
"data-active": !i && n && t.playing ? "1" : "0",
|
|
2261
|
-
children: t.playing ? /* @__PURE__ */ d(
|
|
2264
|
+
children: t.playing ? /* @__PURE__ */ d(Mi, {}) : /* @__PURE__ */ d(Ei, {})
|
|
2262
2265
|
}
|
|
2263
2266
|
);
|
|
2264
2267
|
}
|
|
2265
|
-
function
|
|
2268
|
+
function zi() {
|
|
2266
2269
|
function t() {
|
|
2267
|
-
E("controls", "Unload episode clicked"),
|
|
2270
|
+
E("controls", "Unload episode clicked"), Vi();
|
|
2268
2271
|
}
|
|
2269
2272
|
return /* @__PURE__ */ d(
|
|
2270
2273
|
"button",
|
|
@@ -2273,48 +2276,48 @@ function Ki() {
|
|
|
2273
2276
|
className: "ctr-btn",
|
|
2274
2277
|
title: "Unload episode (return to lobby)",
|
|
2275
2278
|
"aria-label": "Unload episode",
|
|
2276
|
-
children: /* @__PURE__ */ d(
|
|
2279
|
+
children: /* @__PURE__ */ d($i, {})
|
|
2277
2280
|
}
|
|
2278
2281
|
);
|
|
2279
2282
|
}
|
|
2280
|
-
function
|
|
2283
|
+
function Ji(t) {
|
|
2281
2284
|
return !t.isLeader || t.durationMs === 0 ? !0 : !t.ready && !t.canOverride;
|
|
2282
2285
|
}
|
|
2283
|
-
function
|
|
2286
|
+
function Qi(t) {
|
|
2284
2287
|
return t.localValue !== null ? t.localValue : t.displayPlayheadMs ?? t.snapshotPlayheadMs;
|
|
2285
2288
|
}
|
|
2286
|
-
function
|
|
2289
|
+
function qi(t, e) {
|
|
2287
2290
|
return e <= 0 ? 0 : t / e;
|
|
2288
2291
|
}
|
|
2289
|
-
function
|
|
2292
|
+
function $t(t) {
|
|
2290
2293
|
const e = Math.floor(t / 1e3), n = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), s = e % 60;
|
|
2291
2294
|
return n > 0 ? `${n}:${r.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}` : `${r}:${s.toString().padStart(2, "0")}`;
|
|
2292
2295
|
}
|
|
2293
|
-
function
|
|
2294
|
-
const n = x((S) => S.snapshot), r = x((S) => S.readiness), s = nt(), i = mr(), a = s && i && !r.ready, l = P(null), [o, c] = $(null), [u,
|
|
2295
|
-
w !== n.mediaId && (A(n.mediaId),
|
|
2296
|
+
function Yi({ durationMs: t, displayPlayheadMs: e }) {
|
|
2297
|
+
const n = x((S) => S.snapshot), r = x((S) => S.readiness), s = nt(), i = mr(), a = s && i && !r.ready, l = P(null), [o, c] = $(null), [u, h] = $(0), [f, y] = $(!1), [g, p] = $(null), v = P(0), [w, A] = $(n.mediaId);
|
|
2298
|
+
w !== n.mediaId && (A(n.mediaId), p(null), y(!1));
|
|
2296
2299
|
const F = e ?? n.playheadMs;
|
|
2297
|
-
!
|
|
2298
|
-
const k = t || 0, m =
|
|
2300
|
+
!f && g !== null && Math.abs(F - g) < Kn && p(null);
|
|
2301
|
+
const k = t || 0, m = Qi({ localValue: g, displayPlayheadMs: e, snapshotPlayheadMs: n.playheadMs }), T = P(0);
|
|
2299
2302
|
L(() => {
|
|
2300
|
-
if (
|
|
2303
|
+
if (f || g === null) return;
|
|
2301
2304
|
const S = 1e4 - (Date.now() - T.current), I = setTimeout(() => {
|
|
2302
2305
|
C("seek", "SeekBar local override timed out — seek never completed", {
|
|
2303
2306
|
target: Math.round(g),
|
|
2304
2307
|
actual: Math.round(F),
|
|
2305
2308
|
delta: Math.round(Math.abs(F - g))
|
|
2306
|
-
}),
|
|
2309
|
+
}), p(null);
|
|
2307
2310
|
}, Math.max(0, S));
|
|
2308
2311
|
return () => clearTimeout(I);
|
|
2309
|
-
}, [F,
|
|
2312
|
+
}, [F, f, g]);
|
|
2310
2313
|
const R = U((S) => {
|
|
2311
2314
|
const I = S.currentTarget.getBoundingClientRect(), B = S.clientX - I.left, H = B / I.width, j = Math.round(H * k);
|
|
2312
|
-
c(B),
|
|
2315
|
+
c(B), h(Math.max(0, Math.min(j, k)));
|
|
2313
2316
|
}, [k]), b = U(() => {
|
|
2314
2317
|
c(null);
|
|
2315
2318
|
}, []);
|
|
2316
2319
|
return /* @__PURE__ */ _("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
2317
|
-
/* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-secondary w-[45px] text-right shrink-0", children:
|
|
2320
|
+
/* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-secondary w-[45px] text-right shrink-0", children: $t(m) }),
|
|
2318
2321
|
/* @__PURE__ */ _("div", { className: "flex-1 relative", children: [
|
|
2319
2322
|
/* @__PURE__ */ d(
|
|
2320
2323
|
"input",
|
|
@@ -2323,21 +2326,21 @@ function qi({ durationMs: t, displayPlayheadMs: e }) {
|
|
|
2323
2326
|
min: 0,
|
|
2324
2327
|
max: k,
|
|
2325
2328
|
value: m,
|
|
2326
|
-
disabled:
|
|
2327
|
-
style: { "--progress": `${
|
|
2329
|
+
disabled: Ji({ isLeader: s, ready: r.ready, canOverride: a, durationMs: k }),
|
|
2330
|
+
style: { "--progress": `${qi(m, k) * 100}%` },
|
|
2328
2331
|
onChange: (S) => {
|
|
2329
2332
|
const I = Number(S.target.value);
|
|
2330
|
-
|
|
2333
|
+
p(I), T.current = Date.now();
|
|
2331
2334
|
},
|
|
2332
2335
|
onMouseDown: () => {
|
|
2333
|
-
|
|
2336
|
+
y(!0), v.current = e ?? n.playheadMs;
|
|
2334
2337
|
},
|
|
2335
2338
|
onMouseUp: () => {
|
|
2336
|
-
|
|
2339
|
+
y(!1), g !== null && g !== v.current && (E("seek", "Final seek on mouseup", { to_ms: g }), Pe("seek", { to_ms: g }), v.current = g);
|
|
2337
2340
|
},
|
|
2338
2341
|
onMouseMove: R,
|
|
2339
2342
|
onMouseLeave: () => {
|
|
2340
|
-
b(),
|
|
2343
|
+
b(), f && g !== null && g !== v.current && (y(!1), E("seek", "Final seek on mouseleave-while-dragging", { to_ms: g }), Pe("seek", { to_ms: g }), v.current = g);
|
|
2341
2344
|
},
|
|
2342
2345
|
className: "w-full range-fill",
|
|
2343
2346
|
ref: l,
|
|
@@ -2349,25 +2352,25 @@ function qi({ durationMs: t, displayPlayheadMs: e }) {
|
|
|
2349
2352
|
{
|
|
2350
2353
|
className: "absolute bottom-full mb-2 px-2 py-1 bg-bg-card text-white text-xs rounded pointer-events-none transform -translate-x-1/2 whitespace-nowrap",
|
|
2351
2354
|
style: { left: o },
|
|
2352
|
-
children:
|
|
2355
|
+
children: $t(u)
|
|
2353
2356
|
}
|
|
2354
2357
|
)
|
|
2355
2358
|
] }),
|
|
2356
|
-
/* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-muted w-[45px] text-left shrink-0", children:
|
|
2359
|
+
/* @__PURE__ */ d("span", { className: "text-[11px] font-mono text-text-muted w-[45px] text-left shrink-0", children: $t(k) })
|
|
2357
2360
|
] });
|
|
2358
2361
|
}
|
|
2359
|
-
function
|
|
2362
|
+
function Xi({ videoRef: t }) {
|
|
2360
2363
|
const e = x((u) => u.mediaPrefs.volume), n = x((u) => u.mediaPrefs.muted), r = x((u) => u.setVolume), s = x((u) => u.setMuted);
|
|
2361
2364
|
L(() => {
|
|
2362
2365
|
const u = t.current;
|
|
2363
2366
|
u && (u.volume = e, u.muted = n);
|
|
2364
2367
|
}, [e, n, t]);
|
|
2365
2368
|
const i = (u) => {
|
|
2366
|
-
const
|
|
2367
|
-
r(
|
|
2369
|
+
const h = parseFloat(u.target.value);
|
|
2370
|
+
r(h), h > 0 && n && s(!1);
|
|
2368
2371
|
}, a = () => {
|
|
2369
2372
|
s(!n);
|
|
2370
|
-
}, l = () => n || e === 0 ? /* @__PURE__ */ d(
|
|
2373
|
+
}, l = () => n || e === 0 ? /* @__PURE__ */ d(ki, {}) : e < 0.5 ? /* @__PURE__ */ d(_i, {}) : /* @__PURE__ */ d(Ai, {}), o = n ? 0 : e, c = Math.round(o * 100);
|
|
2371
2374
|
return /* @__PURE__ */ _("div", { className: "flex items-center gap-2", children: [
|
|
2372
2375
|
/* @__PURE__ */ d(
|
|
2373
2376
|
"button",
|
|
@@ -2400,7 +2403,7 @@ function Yi({ videoRef: t }) {
|
|
|
2400
2403
|
] })
|
|
2401
2404
|
] });
|
|
2402
2405
|
}
|
|
2403
|
-
function
|
|
2406
|
+
function Zi({
|
|
2404
2407
|
tracks: t,
|
|
2405
2408
|
selectedIndex: e,
|
|
2406
2409
|
onSelect: n
|
|
@@ -2424,7 +2427,7 @@ function Xi({
|
|
|
2424
2427
|
)
|
|
2425
2428
|
] });
|
|
2426
2429
|
}
|
|
2427
|
-
function
|
|
2430
|
+
function eo({
|
|
2428
2431
|
tracks: t,
|
|
2429
2432
|
selectedIndex: e,
|
|
2430
2433
|
onSelect: n,
|
|
@@ -2461,13 +2464,13 @@ function Zi({
|
|
|
2461
2464
|
)
|
|
2462
2465
|
] });
|
|
2463
2466
|
}
|
|
2464
|
-
const
|
|
2467
|
+
const to = [
|
|
2465
2468
|
{ value: "classic", label: "Classic" },
|
|
2466
2469
|
{ value: "cinema", label: "Cinema" },
|
|
2467
2470
|
{ value: "minimal", label: "Minimal" },
|
|
2468
2471
|
{ value: "contrast", label: "High Contrast" }
|
|
2469
2472
|
];
|
|
2470
|
-
function
|
|
2473
|
+
function no({ style: t, onStyleChange: e, enabled: n }) {
|
|
2471
2474
|
return n ? /* @__PURE__ */ _("div", { className: "flex items-center gap-2", children: [
|
|
2472
2475
|
/* @__PURE__ */ d("span", { className: "text-[10px] opacity-60 uppercase tracking-wide", children: "Style" }),
|
|
2473
2476
|
/* @__PURE__ */ d(
|
|
@@ -2478,12 +2481,12 @@ function to({ style: t, onStyleChange: e, enabled: n }) {
|
|
|
2478
2481
|
className: "text-xs rounded px-2 py-1 cursor-pointer",
|
|
2479
2482
|
title: "Select subtitle style",
|
|
2480
2483
|
"aria-label": "Subtitle style selection",
|
|
2481
|
-
children:
|
|
2484
|
+
children: to.map((r) => /* @__PURE__ */ d("option", { value: r.value, children: r.label }, r.value))
|
|
2482
2485
|
}
|
|
2483
2486
|
)
|
|
2484
2487
|
] }) : null;
|
|
2485
2488
|
}
|
|
2486
|
-
function
|
|
2489
|
+
function ro({ videoRef: t }) {
|
|
2487
2490
|
const [e, n] = $(!1);
|
|
2488
2491
|
L(() => {
|
|
2489
2492
|
const s = () => {
|
|
@@ -2513,11 +2516,11 @@ function no({ videoRef: t }) {
|
|
|
2513
2516
|
},
|
|
2514
2517
|
className: "ctr-btn",
|
|
2515
2518
|
title: e ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
2516
|
-
children: e ? /* @__PURE__ */ d(
|
|
2519
|
+
children: e ? /* @__PURE__ */ d(Ii, {}) : /* @__PURE__ */ d(Ti, {})
|
|
2517
2520
|
}
|
|
2518
2521
|
);
|
|
2519
2522
|
}
|
|
2520
|
-
function
|
|
2523
|
+
function so({
|
|
2521
2524
|
videoRef: t,
|
|
2522
2525
|
mediaId: e,
|
|
2523
2526
|
durationMs: n,
|
|
@@ -2529,32 +2532,32 @@ function ro({
|
|
|
2529
2532
|
selectedSubtitleIndex: o,
|
|
2530
2533
|
onSubtitleSelect: c,
|
|
2531
2534
|
subtitlesEnabled: u,
|
|
2532
|
-
onSubtitlesToggle:
|
|
2533
|
-
subtitleStyle:
|
|
2534
|
-
onSubtitleStyleChange:
|
|
2535
|
+
onSubtitlesToggle: h,
|
|
2536
|
+
subtitleStyle: f,
|
|
2537
|
+
onSubtitleStyleChange: y,
|
|
2535
2538
|
displayPlayheadMs: g,
|
|
2536
|
-
onChatActivity:
|
|
2537
|
-
onMenuHeld:
|
|
2539
|
+
onChatActivity: p,
|
|
2540
|
+
onMenuHeld: v
|
|
2538
2541
|
}) {
|
|
2539
|
-
const w = nt(), A = x((z) => z.chatCollapsed), F = xt(), k = en(), m =
|
|
2542
|
+
const w = nt(), A = x((z) => z.chatCollapsed), F = xt(), k = en(), m = Mt() !== null, T = Xt({
|
|
2540
2543
|
isLeader: k,
|
|
2541
2544
|
hasMedia: !0,
|
|
2542
2545
|
chatCollapsed: A,
|
|
2543
2546
|
isFullscreen: F,
|
|
2544
2547
|
gameOverlay: m
|
|
2545
|
-
}) === "control-bar", R = ar({ hasMedia: !0, isFullscreen: F, gameOverlay: m }) === "control-bar", b = x((z) => z.floatingChatEnabled), S = P(null), I = P(null), [B, H] = $(!1), [j, K] = $(!1), [X, N] = $(""), [O, Q] = $(!1), W = hr(), [re, le] = $(!1), [Re, Ke] = $(!1),
|
|
2548
|
+
}) === "control-bar", R = ar({ hasMedia: !0, isFullscreen: F, gameOverlay: m }) === "control-bar", b = x((z) => z.floatingChatEnabled), S = P(null), I = P(null), [B, H] = $(!1), [j, K] = $(!1), [X, N] = $(""), [O, Q] = $(!1), W = hr(), [re, le] = $(!1), [Re, Ke] = $(!1), kt = U(async (z) => {
|
|
2546
2549
|
if (z.key !== "Enter") return;
|
|
2547
2550
|
const he = X.trim();
|
|
2548
2551
|
if (!he && !W.pending.length || O || W.uploading) return;
|
|
2549
2552
|
const Me = await W.uploadPending();
|
|
2550
2553
|
Me !== null && (jn(he, Me), N(""), W.clear(), Q(!0), setTimeout(() => Q(!1), Gn), !document.hidden && document.hasFocus() && I.current?.focus());
|
|
2551
2554
|
}, [X, O, W]);
|
|
2552
|
-
L(() => () =>
|
|
2555
|
+
L(() => () => v?.(!1), [e, v]);
|
|
2553
2556
|
const De = r ?? !0, ye = U(() => {
|
|
2554
2557
|
const z = S.current;
|
|
2555
2558
|
if (!z) return;
|
|
2556
|
-
const { scrollLeft: he, scrollWidth: Me, clientWidth:
|
|
2557
|
-
H(he > 5), K(he +
|
|
2559
|
+
const { scrollLeft: he, scrollWidth: Me, clientWidth: _t } = z;
|
|
2560
|
+
H(he > 5), K(he + _t < Me - 5);
|
|
2558
2561
|
}, []);
|
|
2559
2562
|
L(() => {
|
|
2560
2563
|
const z = S.current;
|
|
@@ -2581,10 +2584,10 @@ function ro({
|
|
|
2581
2584
|
{
|
|
2582
2585
|
className: `ctr-bar-wrapper ${De ? "show" : ""}`,
|
|
2583
2586
|
onFocus: (z) => {
|
|
2584
|
-
z.target instanceof HTMLSelectElement &&
|
|
2587
|
+
z.target instanceof HTMLSelectElement && v?.(!0);
|
|
2585
2588
|
},
|
|
2586
2589
|
onBlur: (z) => {
|
|
2587
|
-
z.target instanceof HTMLSelectElement &&
|
|
2590
|
+
z.target instanceof HTMLSelectElement && v?.(!1);
|
|
2588
2591
|
},
|
|
2589
2592
|
onChange: (z) => {
|
|
2590
2593
|
z.target instanceof HTMLSelectElement && z.target.blur();
|
|
@@ -2592,18 +2595,18 @@ function ro({
|
|
|
2592
2595
|
children: [
|
|
2593
2596
|
/* @__PURE__ */ _("div", { ref: S, className: we, children: [
|
|
2594
2597
|
w && /* @__PURE__ */ _("div", { className: "cluster", children: [
|
|
2595
|
-
/* @__PURE__ */ d(
|
|
2598
|
+
/* @__PURE__ */ d(Ki, {}),
|
|
2596
2599
|
T && /* @__PURE__ */ d(Ar, {}),
|
|
2597
|
-
/* @__PURE__ */ d(
|
|
2600
|
+
/* @__PURE__ */ d(zi, {})
|
|
2598
2601
|
] }),
|
|
2599
|
-
/* @__PURE__ */ d("div", { className: "cluster-seek", children: /* @__PURE__ */ d(
|
|
2602
|
+
/* @__PURE__ */ d("div", { className: "cluster-seek", children: /* @__PURE__ */ d(Yi, { durationMs: n, displayPlayheadMs: g }) }),
|
|
2600
2603
|
/* @__PURE__ */ _("div", { className: "cluster", children: [
|
|
2601
|
-
/* @__PURE__ */ d(
|
|
2604
|
+
/* @__PURE__ */ d(Xi, { videoRef: t }),
|
|
2602
2605
|
s.length > 1 && /* @__PURE__ */ _(Se, { children: [
|
|
2603
2606
|
/* @__PURE__ */ d("div", { className: "w-px h-5 bg-white/20" }),
|
|
2604
2607
|
" ",
|
|
2605
2608
|
/* @__PURE__ */ d(
|
|
2606
|
-
|
|
2609
|
+
Zi,
|
|
2607
2610
|
{
|
|
2608
2611
|
tracks: s,
|
|
2609
2612
|
selectedIndex: i,
|
|
@@ -2614,20 +2617,20 @@ function ro({
|
|
|
2614
2617
|
] }),
|
|
2615
2618
|
l.length > 0 && /* @__PURE__ */ _("div", { className: "cluster", children: [
|
|
2616
2619
|
/* @__PURE__ */ d(
|
|
2617
|
-
|
|
2620
|
+
eo,
|
|
2618
2621
|
{
|
|
2619
2622
|
tracks: l,
|
|
2620
2623
|
selectedIndex: o,
|
|
2621
2624
|
onSelect: c,
|
|
2622
2625
|
enabled: u,
|
|
2623
|
-
onToggle:
|
|
2626
|
+
onToggle: h
|
|
2624
2627
|
}
|
|
2625
2628
|
),
|
|
2626
2629
|
/* @__PURE__ */ d(
|
|
2627
|
-
|
|
2630
|
+
no,
|
|
2628
2631
|
{
|
|
2629
|
-
style:
|
|
2630
|
-
onStyleChange:
|
|
2632
|
+
style: f,
|
|
2633
|
+
onStyleChange: y,
|
|
2631
2634
|
enabled: u
|
|
2632
2635
|
}
|
|
2633
2636
|
)
|
|
@@ -2659,10 +2662,10 @@ function ro({
|
|
|
2659
2662
|
type: "text",
|
|
2660
2663
|
value: X,
|
|
2661
2664
|
onChange: (z) => {
|
|
2662
|
-
N(z.target.value.slice(0, Wn)),
|
|
2665
|
+
N(z.target.value.slice(0, Wn)), p?.();
|
|
2663
2666
|
},
|
|
2664
2667
|
onKeyDown: (z) => {
|
|
2665
|
-
|
|
2668
|
+
kt(z);
|
|
2666
2669
|
},
|
|
2667
2670
|
placeholder: "Message...",
|
|
2668
2671
|
className: "bg-transparent border-none outline-none text-sm max-w-[240px] w-48 h-7 px-2",
|
|
@@ -2687,7 +2690,7 @@ function ro({
|
|
|
2687
2690
|
),
|
|
2688
2691
|
/* @__PURE__ */ _("div", { className: "cluster cluster-tight", children: [
|
|
2689
2692
|
R && /* @__PURE__ */ d(Tr, { className: "ctr-btn" }),
|
|
2690
|
-
/* @__PURE__ */ d(
|
|
2693
|
+
/* @__PURE__ */ d(ro, { videoRef: t })
|
|
2691
2694
|
] })
|
|
2692
2695
|
] }),
|
|
2693
2696
|
rt && /* @__PURE__ */ _("div", { className: "ctr-scroll-group", children: [
|
|
@@ -2697,7 +2700,7 @@ function ro({
|
|
|
2697
2700
|
className: `ctr-scroll-btn ${B ? "visible" : ""}`,
|
|
2698
2701
|
onClick: () => Be("left"),
|
|
2699
2702
|
"aria-label": "Scroll left",
|
|
2700
|
-
children: /* @__PURE__ */ d(
|
|
2703
|
+
children: /* @__PURE__ */ d(Ci, {})
|
|
2701
2704
|
}
|
|
2702
2705
|
),
|
|
2703
2706
|
/* @__PURE__ */ d(
|
|
@@ -2706,7 +2709,7 @@ function ro({
|
|
|
2706
2709
|
className: `ctr-scroll-btn ${j ? "visible" : ""}`,
|
|
2707
2710
|
onClick: () => Be("right"),
|
|
2708
2711
|
"aria-label": "Scroll right",
|
|
2709
|
-
children: /* @__PURE__ */ d(
|
|
2712
|
+
children: /* @__PURE__ */ d(Ri, {})
|
|
2710
2713
|
}
|
|
2711
2714
|
)
|
|
2712
2715
|
] })
|
|
@@ -2714,44 +2717,44 @@ function ro({
|
|
|
2714
2717
|
}
|
|
2715
2718
|
);
|
|
2716
2719
|
}
|
|
2717
|
-
const
|
|
2718
|
-
function
|
|
2719
|
-
return t.hidden && t.roomPlaying && !t.seekInFlight && !t.ended && !t.localPause && t.sinceUserPauseMs >=
|
|
2720
|
+
const ao = 1e3;
|
|
2721
|
+
function io(t) {
|
|
2722
|
+
return t.hidden && t.roomPlaying && !t.seekInFlight && !t.ended && !t.localPause && t.sinceUserPauseMs >= ao;
|
|
2720
2723
|
}
|
|
2721
|
-
function
|
|
2724
|
+
function oo(t, e) {
|
|
2722
2725
|
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" };
|
|
2723
2726
|
}
|
|
2724
|
-
const
|
|
2725
|
-
function
|
|
2727
|
+
const co = 1e3;
|
|
2728
|
+
function lo(t) {
|
|
2726
2729
|
if (!t.roomPlaying || t.seekInFlight) return { kind: "none" };
|
|
2727
2730
|
const e = t.durationMs > 0 ? Math.min(t.roomMs, t.durationMs) : t.roomMs;
|
|
2728
2731
|
return Math.abs(e - t.elementMs) > t.driftToleranceMs ? { kind: "seek", targetMs: Math.round(e) } : t.elementPaused ? { kind: "resume" } : { kind: "none" };
|
|
2729
2732
|
}
|
|
2730
|
-
function
|
|
2733
|
+
function uo(t, e, n) {
|
|
2731
2734
|
return t.playheadMs + (t.playing ? Math.max(0, n - e) : 0);
|
|
2732
2735
|
}
|
|
2733
2736
|
function Cr(t) {
|
|
2734
2737
|
const e = t.split("/").filter(Boolean);
|
|
2735
2738
|
return e.length >= 2 ? e.slice(-2).join(" ") : e[e.length - 1] || t;
|
|
2736
2739
|
}
|
|
2737
|
-
function
|
|
2740
|
+
function fo(t) {
|
|
2738
2741
|
const e = t.split("/").filter(Boolean), n = [`${e.join("/")}/poster.jpg`];
|
|
2739
2742
|
return e.length >= 2 && n.push(`${e.slice(0, -1).join("/")}/poster.jpg`), n;
|
|
2740
2743
|
}
|
|
2741
|
-
function
|
|
2744
|
+
function ho({ mediaId: t, visible: e }) {
|
|
2742
2745
|
return t ? /* @__PURE__ */ d("div", { className: `media-title ${e ? "show" : ""}`, children: Cr(t) }) : null;
|
|
2743
2746
|
}
|
|
2744
|
-
const qe = 3,
|
|
2747
|
+
const qe = 3, po = 1e3, mo = 15e3, Z = {
|
|
2745
2748
|
EQUAL: 1e-3,
|
|
2746
2749
|
POINT: 0.05,
|
|
2747
2750
|
RANGE: 0.1,
|
|
2748
2751
|
FALLBACK: 1
|
|
2749
|
-
},
|
|
2752
|
+
}, Pt = 0.5, Dt = 3e3;
|
|
2750
2753
|
function ct(t, e = {}) {
|
|
2751
|
-
const { baseMs: n =
|
|
2754
|
+
const { baseMs: n = po, capMs: r = mo, jitter: s = 0.25 } = e, i = Math.min(n * Math.pow(2, t - 1), r), a = s > 0 ? Math.round(i * Math.random() * s) : 0;
|
|
2752
2755
|
return i + a;
|
|
2753
2756
|
}
|
|
2754
|
-
const In = 15,
|
|
2757
|
+
const In = 15, go = 35e3, bo = 2e3, Bt = 10;
|
|
2755
2758
|
function Ie(t, e) {
|
|
2756
2759
|
if (t.length === 0) return 0;
|
|
2757
2760
|
if (e >= t[t.length - 1].end_ms) return t.length - 1;
|
|
@@ -2776,7 +2779,7 @@ function Ye(t, e, n = Z.POINT) {
|
|
|
2776
2779
|
if (e >= t.start(r) - n && e <= t.end(r)) return r;
|
|
2777
2780
|
return -1;
|
|
2778
2781
|
}
|
|
2779
|
-
function
|
|
2782
|
+
function Ot(t, e, n, r = Z.RANGE) {
|
|
2780
2783
|
const s = e / 1e3, i = n / 1e3;
|
|
2781
2784
|
for (let a = 0; a < t.length; a++)
|
|
2782
2785
|
if (t.start(a) < i + r && t.end(a) > s - r) return !0;
|
|
@@ -2785,15 +2788,15 @@ function Bt(t, e, n, r = Z.RANGE) {
|
|
|
2785
2788
|
function ge(t) {
|
|
2786
2789
|
return t ? Array.from({ length: t.length }, (e, n) => `${t.start(n).toFixed(2)}-${t.end(n).toFixed(2)}`) : [];
|
|
2787
2790
|
}
|
|
2788
|
-
function
|
|
2791
|
+
function yo(t) {
|
|
2789
2792
|
if (t.length === 0) return 0;
|
|
2790
2793
|
const e = t.reduce((r, s) => r + s.bytes, 0), n = t.reduce((r, s) => r + s.durationMs, 0);
|
|
2791
2794
|
return n === 0 ? 0 : e / n * 1e3;
|
|
2792
2795
|
}
|
|
2793
|
-
const
|
|
2796
|
+
const vo = 8e5, So = 4;
|
|
2794
2797
|
function ot(t) {
|
|
2795
2798
|
if (t === 0) return 6e4;
|
|
2796
|
-
const e =
|
|
2799
|
+
const e = vo / t * 1e3 * So;
|
|
2797
2800
|
return Math.max(3e4, Math.min(12e4, Math.round(e)));
|
|
2798
2801
|
}
|
|
2799
2802
|
function Cn(t, e) {
|
|
@@ -2801,7 +2804,7 @@ function Cn(t, e) {
|
|
|
2801
2804
|
if (t[n]?.keyframe) return n;
|
|
2802
2805
|
return -1;
|
|
2803
2806
|
}
|
|
2804
|
-
function
|
|
2807
|
+
function wo(t, e, n, r) {
|
|
2805
2808
|
const s = t * 1e3 - 100, i = e * 1e3 + 100;
|
|
2806
2809
|
for (const a of r) {
|
|
2807
2810
|
const l = n[a];
|
|
@@ -2810,7 +2813,7 @@ function So(t, e, n, r) {
|
|
|
2810
2813
|
}
|
|
2811
2814
|
return !1;
|
|
2812
2815
|
}
|
|
2813
|
-
function
|
|
2816
|
+
function xo(t) {
|
|
2814
2817
|
const e = [], n = t.replace(/\r\n/g, `
|
|
2815
2818
|
`).split(`
|
|
2816
2819
|
`);
|
|
@@ -2821,38 +2824,38 @@ function wo(t) {
|
|
|
2821
2824
|
const s = n[r].trim();
|
|
2822
2825
|
if (s.includes("-->")) {
|
|
2823
2826
|
const i = s.split("-->"), a = Rn(i[0].trim()), l = i[1].trim().split(/\s+/), o = Rn(l[0]);
|
|
2824
|
-
let c, u,
|
|
2825
|
-
for (let
|
|
2826
|
-
const g = l[
|
|
2827
|
+
let c, u, h;
|
|
2828
|
+
for (let y = 1; y < l.length; y++) {
|
|
2829
|
+
const g = l[y];
|
|
2827
2830
|
if (g.startsWith("line:")) {
|
|
2828
|
-
const
|
|
2829
|
-
if (
|
|
2830
|
-
const
|
|
2831
|
-
isNaN(
|
|
2831
|
+
const p = g.slice(5);
|
|
2832
|
+
if (p.endsWith("%")) {
|
|
2833
|
+
const v = parseFloat(p.slice(0, -1));
|
|
2834
|
+
isNaN(v) || (c = v / 100);
|
|
2832
2835
|
}
|
|
2833
2836
|
} else if (g.startsWith("position:")) {
|
|
2834
|
-
const
|
|
2835
|
-
if (
|
|
2836
|
-
const
|
|
2837
|
-
isNaN(
|
|
2837
|
+
const p = g.slice(9);
|
|
2838
|
+
if (p.endsWith("%")) {
|
|
2839
|
+
const v = parseFloat(p.slice(0, -1));
|
|
2840
|
+
isNaN(v) || (u = v / 100);
|
|
2838
2841
|
}
|
|
2839
2842
|
} else if (g.startsWith("align:")) {
|
|
2840
|
-
const
|
|
2841
|
-
(
|
|
2843
|
+
const p = g.slice(6);
|
|
2844
|
+
(p === "start" || p === "center" || p === "end") && (h = p);
|
|
2842
2845
|
}
|
|
2843
2846
|
}
|
|
2844
|
-
const
|
|
2847
|
+
const f = [];
|
|
2845
2848
|
for (r++; r < n.length && n[r].trim() !== ""; )
|
|
2846
|
-
|
|
2847
|
-
a !== null && o !== null &&
|
|
2849
|
+
f.push(n[r].trim()), r++;
|
|
2850
|
+
a !== null && o !== null && f.length > 0 && e.push({
|
|
2848
2851
|
id: `cue-${e.length}`,
|
|
2849
2852
|
startTime: a,
|
|
2850
2853
|
endTime: o,
|
|
2851
|
-
text:
|
|
2854
|
+
text: f.join(`
|
|
2852
2855
|
`),
|
|
2853
2856
|
linePercent: c,
|
|
2854
2857
|
positionPercent: u,
|
|
2855
|
-
align:
|
|
2858
|
+
align: h
|
|
2856
2859
|
});
|
|
2857
2860
|
} else
|
|
2858
2861
|
r++;
|
|
@@ -2865,10 +2868,10 @@ function Rn(t) {
|
|
|
2865
2868
|
let n = 0, r, s;
|
|
2866
2869
|
return e.length === 3 ? (n = parseInt(e[0], 10), r = parseInt(e[1], 10), s = parseFloat(e[2])) : (r = parseInt(e[0], 10), s = parseFloat(e[1])), isNaN(n) || isNaN(r) || isNaN(s) ? null : n * 3600 + r * 60 + s;
|
|
2867
2870
|
}
|
|
2868
|
-
function
|
|
2871
|
+
function Eo(t) {
|
|
2869
2872
|
return t.replace(/<\/?[^>]+(>|$)/g, "").replace(/\{[^}]+\}/g, "").replace(/\\N/g, " ").replace(/\s*\n\s*/g, " ").replace(/\s{2,}/g, " ").trim();
|
|
2870
2873
|
}
|
|
2871
|
-
const
|
|
2874
|
+
const Mo = {
|
|
2872
2875
|
// Standard CC look: white text with thick black outline stroke
|
|
2873
2876
|
classic: "text-white [text-shadow:_-2px_-2px_0_#000,_2px_-2px_0_#000,_-2px_2px_0_#000,_2px_2px_0_#000,_0_-2px_0_#000,_0_2px_0_#000,_-2px_0_0_#000,_2px_0_0_#000]",
|
|
2874
2877
|
// DVD/theater style: yellow text on dark translucent box
|
|
@@ -2878,9 +2881,9 @@ const Eo = {
|
|
|
2878
2881
|
// Accessibility-focused: bold white text on solid black box
|
|
2879
2882
|
contrast: "text-white font-bold bg-black px-3 py-1"
|
|
2880
2883
|
};
|
|
2881
|
-
function
|
|
2882
|
-
const [s, i] = $([]), [a, l] = $([]), o = P(null), [c, u] = $(40), [
|
|
2883
|
-
|
|
2884
|
+
function ko({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
|
|
2885
|
+
const [s, i] = $([]), [a, l] = $([]), o = P(null), [c, u] = $(40), [h, f] = $(18), [y, g] = $(t);
|
|
2886
|
+
y !== t && (g(t), t || i([])), L(() => {
|
|
2884
2887
|
if (!t) return;
|
|
2885
2888
|
let m = !1;
|
|
2886
2889
|
const T = 2;
|
|
@@ -2892,7 +2895,7 @@ function Mo({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
|
|
|
2892
2895
|
if (!b.ok) throw new Error(`Failed to fetch subtitles (status ${b.status})`);
|
|
2893
2896
|
const S = await b.text();
|
|
2894
2897
|
if (m) return;
|
|
2895
|
-
const I =
|
|
2898
|
+
const I = xo(S);
|
|
2896
2899
|
i(I);
|
|
2897
2900
|
return;
|
|
2898
2901
|
} catch (b) {
|
|
@@ -2908,7 +2911,7 @@ function Mo({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
|
|
|
2908
2911
|
m = !0;
|
|
2909
2912
|
};
|
|
2910
2913
|
}, [t]);
|
|
2911
|
-
const
|
|
2914
|
+
const p = U(() => {
|
|
2912
2915
|
const m = e.current;
|
|
2913
2916
|
if (!m || !r || s.length === 0) {
|
|
2914
2917
|
l([]);
|
|
@@ -2922,23 +2925,23 @@ function Mo({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
|
|
|
2922
2925
|
L(() => {
|
|
2923
2926
|
const m = e.current;
|
|
2924
2927
|
if (!m) return;
|
|
2925
|
-
const T = () =>
|
|
2928
|
+
const T = () => p();
|
|
2926
2929
|
return m.addEventListener("timeupdate", T), m.addEventListener("seeked", T), () => {
|
|
2927
2930
|
m.removeEventListener("timeupdate", T), m.removeEventListener("seeked", T);
|
|
2928
2931
|
};
|
|
2929
|
-
}, [e,
|
|
2930
|
-
const
|
|
2932
|
+
}, [e, p]);
|
|
2933
|
+
const v = a.length > 0;
|
|
2931
2934
|
if (L(() => {
|
|
2932
2935
|
const m = e.current, T = o.current?.parentElement;
|
|
2933
2936
|
if (!m || !T) return;
|
|
2934
2937
|
const R = () => {
|
|
2935
2938
|
const b = T.clientHeight, S = T.clientWidth, I = m.videoWidth || 1920, B = m.videoHeight || 1080, H = Math.min(S / I, b / B), j = B * H, K = (b - j) / 2, X = Math.max(16, j * 0.035), N = Math.max(X * 0.8, j * 0.055);
|
|
2936
|
-
u(Math.max(K + N, 40)),
|
|
2939
|
+
u(Math.max(K + N, 40)), f(X);
|
|
2937
2940
|
};
|
|
2938
2941
|
return R(), window.addEventListener("resize", R), m.addEventListener("loadedmetadata", R), () => {
|
|
2939
2942
|
window.removeEventListener("resize", R), m.removeEventListener("loadedmetadata", R);
|
|
2940
2943
|
};
|
|
2941
|
-
}, [e,
|
|
2944
|
+
}, [e, v]), !r || a.length === 0)
|
|
2942
2945
|
return null;
|
|
2943
2946
|
function w(m) {
|
|
2944
2947
|
const T = m.linePercent !== void 0 && m.linePercent <= 0.5;
|
|
@@ -2958,12 +2961,12 @@ function Mo({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
|
|
|
2958
2961
|
"div",
|
|
2959
2962
|
{
|
|
2960
2963
|
className: `flex flex-col ${T} w-full`,
|
|
2961
|
-
style: { fontSize:
|
|
2964
|
+
style: { fontSize: h + "px" },
|
|
2962
2965
|
children: /* @__PURE__ */ d(
|
|
2963
2966
|
"div",
|
|
2964
2967
|
{
|
|
2965
|
-
className: `${R} font-medium max-w-[95%] inline-block antialiased ${
|
|
2966
|
-
children:
|
|
2968
|
+
className: `${R} font-medium max-w-[95%] inline-block antialiased ${Mo[n]}`,
|
|
2969
|
+
children: Eo(b.text)
|
|
2967
2970
|
}
|
|
2968
2971
|
)
|
|
2969
2972
|
},
|
|
@@ -3000,8 +3003,8 @@ function Mo({ subtitleUrl: t, videoRef: e, style: n, enabled: r }) {
|
|
|
3000
3003
|
k(A.bl, A.bc, A.br, { bottom: `${c}px` }, o)
|
|
3001
3004
|
] });
|
|
3002
3005
|
}
|
|
3003
|
-
const
|
|
3004
|
-
function
|
|
3006
|
+
const _o = 300, Ao = 50, To = 100, Io = 100, Co = 100, Ro = 100;
|
|
3007
|
+
function Ht(t, e) {
|
|
3005
3008
|
if (t.length === 0) return 0;
|
|
3006
3009
|
const n = Math.min(Math.floor(e / 100 * t.length), t.length - 1);
|
|
3007
3010
|
return t[n];
|
|
@@ -3012,16 +3015,16 @@ function Ne(t) {
|
|
|
3012
3015
|
return {
|
|
3013
3016
|
count: e.length,
|
|
3014
3017
|
mean: Math.round(n / e.length),
|
|
3015
|
-
p50: Math.round(
|
|
3016
|
-
p90: Math.round(
|
|
3017
|
-
p99: Math.round(
|
|
3018
|
+
p50: Math.round(Ht(e, 50)),
|
|
3019
|
+
p90: Math.round(Ht(e, 90)),
|
|
3020
|
+
p99: Math.round(Ht(e, 99)),
|
|
3018
3021
|
max: Math.round(e[e.length - 1])
|
|
3019
3022
|
};
|
|
3020
3023
|
}
|
|
3021
|
-
function Le(t, e =
|
|
3024
|
+
function Le(t, e = _o) {
|
|
3022
3025
|
t.length > e && t.splice(0, t.length - e);
|
|
3023
3026
|
}
|
|
3024
|
-
class
|
|
3027
|
+
class Fo {
|
|
3025
3028
|
// Fetch
|
|
3026
3029
|
_fetches = [];
|
|
3027
3030
|
_fetchTimeoutCount = 0;
|
|
@@ -3079,11 +3082,11 @@ class Ro {
|
|
|
3079
3082
|
}
|
|
3080
3083
|
/** Called when waitForAppend times out. */
|
|
3081
3084
|
recordAppendTimeout(e, n, r) {
|
|
3082
|
-
this._appendTimeouts.push({ index: e, timeoutMs: n, queueDepth: r, ts: performance.now() }), Le(this._appendTimeouts,
|
|
3085
|
+
this._appendTimeouts.push({ index: e, timeoutMs: n, queueDepth: r, ts: performance.now() }), Le(this._appendTimeouts, Ao);
|
|
3083
3086
|
}
|
|
3084
3087
|
/** Called when a seek completes (COMPLETED path in _execute). */
|
|
3085
3088
|
recordSeekCompleted(e, n, r) {
|
|
3086
|
-
this._seeks.push({ caller: e, targetMs: n, durationMs: r, ts: performance.now() }), Le(this._seeks,
|
|
3089
|
+
this._seeks.push({ caller: e, targetMs: n, durationMs: r, ts: performance.now() }), Le(this._seeks, To);
|
|
3087
3090
|
}
|
|
3088
3091
|
/** Called when waitForSeeked resolves via timeout rather than the 'seeked' event. */
|
|
3089
3092
|
recordWaitForSeekedTimeout() {
|
|
@@ -3105,11 +3108,11 @@ class Ro {
|
|
|
3105
3108
|
this._stallStart && (this._stalls.push({
|
|
3106
3109
|
...this._stallStart,
|
|
3107
3110
|
durationMs: Math.round(performance.now() - this._stallStart.ts)
|
|
3108
|
-
}), Le(this._stalls,
|
|
3111
|
+
}), Le(this._stalls, Io), this._stallStart = null);
|
|
3109
3112
|
}
|
|
3110
3113
|
/** Called from _doEvict with the reason tag passed by the caller. */
|
|
3111
3114
|
recordEvict(e, n, r) {
|
|
3112
|
-
this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: n, end: r, ts: performance.now() }), Le(this._evicts,
|
|
3115
|
+
this._evictCounts[e] = (this._evictCounts[e] ?? 0) + 1, this._evicts.push({ reason: e, start: n, end: r, ts: performance.now() }), Le(this._evicts, Co);
|
|
3113
3116
|
}
|
|
3114
3117
|
/** Called from FragmentManager.reconcileLoadedStates() when the browser's
|
|
3115
3118
|
* own silent quota eviction is detected (fragments 'loaded' but gone from
|
|
@@ -3151,7 +3154,7 @@ class Ro {
|
|
|
3151
3154
|
},
|
|
3152
3155
|
audio: {
|
|
3153
3156
|
driftMs: Ne(this._audioDrifts),
|
|
3154
|
-
highDriftCount: this._audioDrifts.filter((c) => c >
|
|
3157
|
+
highDriftCount: this._audioDrifts.filter((c) => c > Ro).length,
|
|
3155
3158
|
samples: this._audioDrifts.slice(-20).map((c) => Math.round(c))
|
|
3156
3159
|
},
|
|
3157
3160
|
stalls: {
|
|
@@ -3200,9 +3203,9 @@ class Ro {
|
|
|
3200
3203
|
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 = [];
|
|
3201
3204
|
}
|
|
3202
3205
|
}
|
|
3203
|
-
const oe = new
|
|
3206
|
+
const oe = new Fo();
|
|
3204
3207
|
zn("__WP_PERF__", oe);
|
|
3205
|
-
class
|
|
3208
|
+
class No {
|
|
3206
3209
|
cache = /* @__PURE__ */ new Map();
|
|
3207
3210
|
getOrCreate(e) {
|
|
3208
3211
|
let n = this.cache.get(e);
|
|
@@ -3241,8 +3244,8 @@ class Fo {
|
|
|
3241
3244
|
this.cache.clear();
|
|
3242
3245
|
}
|
|
3243
3246
|
}
|
|
3244
|
-
const ve = new
|
|
3245
|
-
class
|
|
3247
|
+
const ve = new No(), Fn = 60, Lo = 5e3;
|
|
3248
|
+
class $o {
|
|
3246
3249
|
constructor(e) {
|
|
3247
3250
|
this.deps = e;
|
|
3248
3251
|
}
|
|
@@ -3322,7 +3325,7 @@ class Lo {
|
|
|
3322
3325
|
if (this.evictStartedAt === 0)
|
|
3323
3326
|
return this.evictStartedAt = Date.now(), !0;
|
|
3324
3327
|
const e = Date.now() - this.evictStartedAt;
|
|
3325
|
-
return e <
|
|
3328
|
+
return e < Lo ? !0 : (C("buffer", `EVICT-STUCK isEvicting held ${e}ms — clearing; a remove() updateend was lost, eviction was disabled`), oe.recordEvict("stuck-recovered", 0, 0), this._isEvicting = !1, this.evictStartedAt = 0, !1);
|
|
3326
3329
|
}
|
|
3327
3330
|
/** Called on dispose, on SourceBuffer error, and on media change
|
|
3328
3331
|
* (FragmentManager.setIndex) — see the note at that call site. */
|
|
@@ -3366,15 +3369,15 @@ class Lo {
|
|
|
3366
3369
|
for (let o = 0; o < i.length; o++) {
|
|
3367
3370
|
const c = i.start(o), u = i.end(o);
|
|
3368
3371
|
if (c < s - Fn && u > s) {
|
|
3369
|
-
const
|
|
3370
|
-
E("buffer", `EVICT-START [behind-tail-trim] range=${c.toFixed(2)}-${u.toFixed(2)} → trim [${c.toFixed(2)}-${
|
|
3372
|
+
const v = s - Fn;
|
|
3373
|
+
E("buffer", `EVICT-START [behind-tail-trim] range=${c.toFixed(2)}-${u.toFixed(2)} → trim [${c.toFixed(2)}-${v.toFixed(2)}] playhead=${s.toFixed(2)}`), this._doEvict(c, v, "behind-tail-trim");
|
|
3371
3374
|
return;
|
|
3372
3375
|
}
|
|
3373
3376
|
if (c < 0.5 && u > s || l !== null && u > l - Z.FALLBACK && c < l + Xe / 1e3) continue;
|
|
3374
|
-
const
|
|
3375
|
-
if (
|
|
3376
|
-
const
|
|
3377
|
-
E("buffer", `EVICT-START [${
|
|
3377
|
+
const h = u < s - 25, f = c > s + 4 * Xe / 1e3, y = o < i.length - 1 ? i.start(o + 1) - u : 0, g = u < s - 25 && y > 5, p = c > s + Xe / 1e3 && (o === 0 || i.end(o - 1) < c - Z.FALLBACK);
|
|
3378
|
+
if (h || f || g || p) {
|
|
3379
|
+
const v = h ? "behind" : f ? "far-ahead-island" : g ? "orphaned-gap" : "forward-orphan";
|
|
3380
|
+
E("buffer", `EVICT-START [${v}] range=${c.toFixed(2)}-${u.toFixed(2)} playhead=${s.toFixed(2)}`), this._doEvict(c, u, v);
|
|
3378
3381
|
return;
|
|
3379
3382
|
}
|
|
3380
3383
|
}
|
|
@@ -3487,13 +3490,13 @@ class Ze {
|
|
|
3487
3490
|
* hold began. Lets processAppendQueue bound a hold that would otherwise
|
|
3488
3491
|
* never end — see APPEND_HOLD_MAX_MS. */
|
|
3489
3492
|
appendHold = null;
|
|
3490
|
-
eviction = new
|
|
3493
|
+
eviction = new $o({
|
|
3491
3494
|
getFragments: () => this.fragments,
|
|
3492
3495
|
getSourceBuffer: () => this.sourceBuffer,
|
|
3493
3496
|
getMediaSource: () => this.mediaSource,
|
|
3494
3497
|
isDisposed: () => this.disposed,
|
|
3495
3498
|
fragmentStates: this.fragmentStates,
|
|
3496
|
-
getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs >
|
|
3499
|
+
getPendingSeekTargetMs: () => this.pendingSeekTargetMs !== null && Date.now() - this.pendingSeekSetAtMs > go ? null : this.pendingSeekTargetMs
|
|
3497
3500
|
});
|
|
3498
3501
|
lastGapWarnMs = 0;
|
|
3499
3502
|
stableGapSignature = null;
|
|
@@ -3687,15 +3690,15 @@ class Ze {
|
|
|
3687
3690
|
}
|
|
3688
3691
|
r && ve.storeInit(r, l);
|
|
3689
3692
|
} else {
|
|
3690
|
-
const u = performance.now(),
|
|
3693
|
+
const u = performance.now(), h = await fetch(s, {
|
|
3691
3694
|
headers: { Range: `bytes=${e}-${n}` },
|
|
3692
3695
|
signal: AbortSignal.timeout(ot(this.getAverageDownloadRate()))
|
|
3693
3696
|
});
|
|
3694
|
-
if (this.initTtfbMs = Math.round(performance.now() - u), this.initCfStatus =
|
|
3695
|
-
if (
|
|
3696
|
-
throw await
|
|
3697
|
-
}), new Error(`init expected 206, got ${
|
|
3698
|
-
if (l = await
|
|
3697
|
+
if (this.initTtfbMs = Math.round(performance.now() - u), this.initCfStatus = h.headers.get("cf-cache-status") || h.headers.get("x-cache") || "", !h.ok) throw new Error(`HTTP ${h.status}`);
|
|
3698
|
+
if (h.status !== 206)
|
|
3699
|
+
throw await h.body?.cancel().catch(() => {
|
|
3700
|
+
}), new Error(`init expected 206, got ${h.status}`);
|
|
3701
|
+
if (l = await h.arrayBuffer(), a()) {
|
|
3699
3702
|
C("buffer", "INIT-FETCH stale on completion, discarding bytes", {
|
|
3700
3703
|
expectedMediaId: r,
|
|
3701
3704
|
currentMediaId: this.mediaId
|
|
@@ -3710,12 +3713,12 @@ class Ze {
|
|
|
3710
3713
|
return;
|
|
3711
3714
|
}
|
|
3712
3715
|
if (await new Promise((c, u) => {
|
|
3713
|
-
const
|
|
3714
|
-
|
|
3715
|
-
},
|
|
3716
|
-
|
|
3716
|
+
const h = i, f = () => {
|
|
3717
|
+
h.removeEventListener("updateend", f), h.removeEventListener("error", y), c();
|
|
3718
|
+
}, y = (g) => {
|
|
3719
|
+
h.removeEventListener("updateend", f), h.removeEventListener("error", y), u(g);
|
|
3717
3720
|
};
|
|
3718
|
-
|
|
3721
|
+
h.addEventListener("updateend", f), h.addEventListener("error", y), h.appendBuffer(l);
|
|
3719
3722
|
}), a()) {
|
|
3720
3723
|
E("buffer", "INIT append completed for stale media, ignoring");
|
|
3721
3724
|
return;
|
|
@@ -3774,9 +3777,9 @@ class Ze {
|
|
|
3774
3777
|
const i = this.fragments[n].end_ms / 1e3, a = (this.fragments[n].end_ms - this.fragments[0].start_ms) / 1e3;
|
|
3775
3778
|
let l = 0;
|
|
3776
3779
|
for (let c = e.buffered.length - 1; c >= 0; c--) {
|
|
3777
|
-
const u = e.buffered.start(c),
|
|
3778
|
-
if (
|
|
3779
|
-
l =
|
|
3780
|
+
const u = e.buffered.start(c), h = e.buffered.end(c);
|
|
3781
|
+
if (h >= i - Z.RANGE) {
|
|
3782
|
+
l = h - u;
|
|
3780
3783
|
break;
|
|
3781
3784
|
}
|
|
3782
3785
|
}
|
|
@@ -3817,7 +3820,7 @@ class Ze {
|
|
|
3817
3820
|
]), r = [], s = this.currentPlayheadMs / 1e3;
|
|
3818
3821
|
for (let l = 1; l < e.buffered.length; l++) {
|
|
3819
3822
|
const o = e.buffered.end(l - 1), c = e.buffered.start(l);
|
|
3820
|
-
c <= s ||
|
|
3823
|
+
c <= s || wo(o, c, this.fragments, n) || r.push(`${o.toFixed(2)}-${c.toFixed(2)}`);
|
|
3821
3824
|
}
|
|
3822
3825
|
if (r.length === 0) {
|
|
3823
3826
|
this.stableGapSignature = null, this.stableGapSince = 0;
|
|
@@ -3883,7 +3886,7 @@ class Ze {
|
|
|
3883
3886
|
hasDataAhead(e) {
|
|
3884
3887
|
if (!this.sourceBuffer?.buffered || this.mediaSource?.readyState !== "open") return !1;
|
|
3885
3888
|
const n = this.sourceBuffer.buffered, r = e / 1e3, s = Ye(n, r, Z.RANGE);
|
|
3886
|
-
return s >= 0 && n.end(s) - r >
|
|
3889
|
+
return s >= 0 && n.end(s) - r > Pt;
|
|
3887
3890
|
}
|
|
3888
3891
|
/** Wait for a specific time position to be buffered in the SourceBuffer.
|
|
3889
3892
|
* Event-driven: resolves on updateend when the position enters a buffered range. */
|
|
@@ -3971,7 +3974,7 @@ class Ze {
|
|
|
3971
3974
|
for (const [s, i] of this.fragmentStates) {
|
|
3972
3975
|
if (i !== "loaded") continue;
|
|
3973
3976
|
const a = this.fragments[s];
|
|
3974
|
-
a && (
|
|
3977
|
+
a && (Ot(e, a.start_ms, a.end_ms) || (this.fragmentStates.set(s, "pending"), n.push(s)));
|
|
3975
3978
|
}
|
|
3976
3979
|
if (n.length === 0) return;
|
|
3977
3980
|
const r = ge(e).join(", ") || "(none)";
|
|
@@ -4015,49 +4018,49 @@ class Ze {
|
|
|
4015
4018
|
r && this.abortAllJobs(a);
|
|
4016
4019
|
const l = Ie(this.fragments, e);
|
|
4017
4020
|
if (r) {
|
|
4018
|
-
const
|
|
4019
|
-
for (let
|
|
4020
|
-
this.discardCounts.delete(
|
|
4021
|
+
const p = Ie(this.fragments, e + Xe);
|
|
4022
|
+
for (let v = l; v <= p; v++)
|
|
4023
|
+
this.discardCounts.delete(v), this.fetchErrorCycles.delete(v);
|
|
4021
4024
|
}
|
|
4022
|
-
const o = tn(this.fragments, e), c = this.fragments[o], u = c && this.sourceBuffer?.buffered &&
|
|
4025
|
+
const o = tn(this.fragments, e), c = this.fragments[o], u = c && this.sourceBuffer?.buffered && Ot(this.sourceBuffer.buffered, c.start_ms, c.end_ms), h = u ? l : o, f = s ? Math.min(this.fragments.length - 1, l + 1) : Ie(this.fragments, e + Ce);
|
|
4023
4026
|
this.initRange && this.initState !== "loaded" && await this.fetchInit();
|
|
4024
|
-
const
|
|
4025
|
-
for (let
|
|
4026
|
-
const
|
|
4027
|
-
if (
|
|
4028
|
-
g.push(`#${
|
|
4027
|
+
const y = [], g = [];
|
|
4028
|
+
for (let p = h; p <= f; p++) {
|
|
4029
|
+
const v = this.fragmentStates.get(p);
|
|
4030
|
+
if (v === "loaded") {
|
|
4031
|
+
g.push(`#${p}=${v}`);
|
|
4029
4032
|
continue;
|
|
4030
4033
|
}
|
|
4031
|
-
if (
|
|
4032
|
-
g.push(`#${
|
|
4034
|
+
if (v === "loading" && this.isFragmentInFlight(p)) {
|
|
4035
|
+
g.push(`#${p}=${v}`);
|
|
4033
4036
|
continue;
|
|
4034
4037
|
}
|
|
4035
|
-
|
|
4038
|
+
v === "loading" && g.push(`#${p}=loading-abandoned→refetch`), y.push(p);
|
|
4036
4039
|
}
|
|
4037
4040
|
if (E("buffer", `FETCH-RANGE [${a}] ${JSON.stringify({
|
|
4038
4041
|
targetMs: Math.round(e),
|
|
4039
4042
|
targetFrag: l,
|
|
4040
4043
|
keyframeFrag: o !== l ? o : void 0,
|
|
4041
4044
|
kfInSb: o !== l ? u : void 0,
|
|
4042
|
-
range: [
|
|
4045
|
+
range: [h, f],
|
|
4043
4046
|
abort: r,
|
|
4044
4047
|
minimal: s,
|
|
4045
|
-
toFetch:
|
|
4048
|
+
toFetch: y,
|
|
4046
4049
|
skipped: g,
|
|
4047
4050
|
activeJobs: Array.from(this.currentJobs.keys()),
|
|
4048
4051
|
sbRanges: ge(this.sourceBuffer?.buffered)
|
|
4049
|
-
})}`),
|
|
4052
|
+
})}`), y.length === 0) {
|
|
4050
4053
|
if (this.fragmentStates.get(l) === "loading") {
|
|
4051
4054
|
E("buffer", `FETCH-RANGE [${a}] target #${l} already loading, awaiting`);
|
|
4052
|
-
const
|
|
4053
|
-
|
|
4055
|
+
const p = this.currentJobs.get(l);
|
|
4056
|
+
p && await p.promise, await this.waitForAppend(l);
|
|
4054
4057
|
}
|
|
4055
4058
|
return;
|
|
4056
4059
|
}
|
|
4057
4060
|
if (i?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
4058
4061
|
!r && this.currentJobs.size >= ze && this.evictFurthestJob(e), this.onBufferingChange?.(!0), this.pendingSeekTargetMs = e, this.pendingSeekSetAtMs = Date.now();
|
|
4059
4062
|
try {
|
|
4060
|
-
if (await this.fetchFragments(
|
|
4063
|
+
if (await this.fetchFragments(y), i?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
4061
4064
|
await this.waitForAppend(l);
|
|
4062
4065
|
} finally {
|
|
4063
4066
|
this.onBufferingChange?.(!1);
|
|
@@ -4119,28 +4122,28 @@ class Ze {
|
|
|
4119
4122
|
try {
|
|
4120
4123
|
const c = performance.now();
|
|
4121
4124
|
this.isInInitPhase() && o === 1 && this.recordInitFragEvent(e, { fetchStart: c, src: "net" });
|
|
4122
|
-
const u = n.end_byte - n.start_byte + 1,
|
|
4123
|
-
if (
|
|
4125
|
+
const u = n.end_byte - n.start_byte + 1, h = this.mediaUrl, f = await this.tryFragmentRoute(e, u, s.signal);
|
|
4126
|
+
if (f) {
|
|
4124
4127
|
const k = performance.now() - c;
|
|
4125
4128
|
if (this.isInInitPhase() && this.recordInitFragEvent(e, {
|
|
4126
4129
|
fetchEnd: performance.now(),
|
|
4127
|
-
bytes:
|
|
4128
|
-
ttfbMs:
|
|
4129
|
-
cf:
|
|
4130
|
-
}), E("buffer", `FETCH-OK #${e} [${i}] ${
|
|
4130
|
+
bytes: f.buf.byteLength,
|
|
4131
|
+
ttfbMs: f.ttfbMs,
|
|
4132
|
+
cf: f.cfStatus
|
|
4133
|
+
}), E("buffer", `FETCH-OK #${e} [${i}] ${f.buf.byteLength}B in ${Math.round(k)}ms via=frag-route (ttfb=${f.ttfbMs}ms cf=${f.cfStatus || "-"})`), k > 0 && (this.downloadSamples.push({ bytes: f.buf.byteLength, durationMs: k }), this.downloadSamples.length > Bt && this.downloadSamples.shift(), oe.recordFetch(e, f.buf.byteLength, k)), this.disposed || this.mediaUrl !== h) {
|
|
4131
4134
|
E("buffer", `FETCH-STALE #${e} discarding frag-route bytes (mediaUrl changed)`);
|
|
4132
4135
|
return;
|
|
4133
4136
|
}
|
|
4134
|
-
this.mediaId && ve.storeFragment(this.mediaId, e,
|
|
4137
|
+
this.mediaId && ve.storeFragment(this.mediaId, e, f.buf), this.disposed || this.queueAppend(e, f.buf);
|
|
4135
4138
|
return;
|
|
4136
4139
|
}
|
|
4137
|
-
const
|
|
4140
|
+
const y = this.mediaUrl, g = await fetch(y, {
|
|
4138
4141
|
headers: {
|
|
4139
4142
|
Range: `bytes=${n.start_byte}-${n.end_byte}`,
|
|
4140
4143
|
"X-Buffer-Ahead-Ms": String(Math.round(this.getBufferedAheadMs(this.currentPlayheadMs)))
|
|
4141
4144
|
},
|
|
4142
4145
|
signal: AbortSignal.any([s.signal, AbortSignal.timeout(ot(this.getAverageDownloadRate()))])
|
|
4143
|
-
}),
|
|
4146
|
+
}), p = Math.round(performance.now() - c), v = g.headers.get("cf-cache-status") || g.headers.get("x-cache") || "";
|
|
4144
4147
|
if (!g.ok) throw new Error(`HTTP ${g.status}`);
|
|
4145
4148
|
const w = n.end_byte - n.start_byte + 1;
|
|
4146
4149
|
if (g.status !== 206) {
|
|
@@ -4148,7 +4151,7 @@ class Ze {
|
|
|
4148
4151
|
}), ee("buffer", `Fragment #${e} range dropped upstream — got ${g.status}, expected 206`, {
|
|
4149
4152
|
httpStatus: g.status,
|
|
4150
4153
|
contentLength: g.headers.get("content-length"),
|
|
4151
|
-
cfCacheStatus:
|
|
4154
|
+
cfCacheStatus: v,
|
|
4152
4155
|
expectedBytes: w
|
|
4153
4156
|
}), this.fragmentStates.set(e, "pending"), o < qe) {
|
|
4154
4157
|
await new Promise((k) => setTimeout(k, ct(o)));
|
|
@@ -4170,7 +4173,7 @@ class Ze {
|
|
|
4170
4173
|
return;
|
|
4171
4174
|
}
|
|
4172
4175
|
const F = performance.now() - c;
|
|
4173
|
-
if (this.isInInitPhase() && this.recordInitFragEvent(e, { fetchEnd: performance.now(), bytes: A.byteLength, ttfbMs:
|
|
4176
|
+
if (this.isInInitPhase() && this.recordInitFragEvent(e, { fetchEnd: performance.now(), bytes: A.byteLength, ttfbMs: p, cf: v }), E("buffer", `FETCH-OK #${e} [${i}] ${A.byteLength}B in ${Math.round(F)}ms (ttfb=${p}ms cf=${v || "-"}) (${(A.byteLength / F * 1e3 / 1024).toFixed(0)} KB/s)`), F > 0 && (this.downloadSamples.push({ bytes: A.byteLength, durationMs: F }), this.downloadSamples.length > Bt && this.downloadSamples.shift(), oe.recordFetch(e, A.byteLength, F)), this.disposed || this.mediaUrl !== y) {
|
|
4174
4177
|
E("buffer", `FETCH-STALE #${e} discarding (mediaUrl changed)`);
|
|
4175
4178
|
return;
|
|
4176
4179
|
}
|
|
@@ -4182,12 +4185,12 @@ class Ze {
|
|
|
4182
4185
|
return;
|
|
4183
4186
|
}
|
|
4184
4187
|
if ((c.name === "TimeoutError" || c.message?.includes("signal timed out") || c.message?.includes("The operation was aborted")) && c.name !== "AbortError") {
|
|
4185
|
-
const
|
|
4186
|
-
this.downloadSamples.push({ bytes: 0, durationMs:
|
|
4188
|
+
const h = ot(this.getAverageDownloadRate());
|
|
4189
|
+
this.downloadSamples.push({ bytes: 0, durationMs: h }), this.downloadSamples.length > Bt && this.downloadSamples.shift(), oe.recordFetchTimeout(e), C("buffer", `FETCH-ERR #${e} [${i}] attempt=${o} timeout=${h}ms avgRate=${Math.round(this.getAverageDownloadRate())}Bps error=${c.message}`);
|
|
4187
4190
|
} else
|
|
4188
4191
|
C("buffer", `FETCH-ERR #${e} [${i}] attempt=${o} error=${c.message}`);
|
|
4189
4192
|
if (this.isInInitPhase() && this.recordInitFragEvent(e, { err: (c.name === "TimeoutError" ? "timeout" : c.message?.slice(0, 40)) || "err" }), this.fragmentStates.set(e, "pending"), o < qe) {
|
|
4190
|
-
await new Promise((
|
|
4193
|
+
await new Promise((h) => setTimeout(h, ct(o)));
|
|
4191
4194
|
continue;
|
|
4192
4195
|
}
|
|
4193
4196
|
throw ee("buffer", `Fragment #${e} failed after ${qe} retries`, { error: c.message }), this.fragmentStates.set(e, "error"), this.errorTimestamps.set(e, Date.now()), this.fetchErrorCycles.set(e, (this.fetchErrorCycles.get(e) ?? 0) + 1), oe.recordFetchError(e), c;
|
|
@@ -4218,7 +4221,7 @@ class Ze {
|
|
|
4218
4221
|
const r = Cn(this.fragments, e - 1);
|
|
4219
4222
|
if (r < 0 || this.fragmentStates.get(r) !== "error") return !1;
|
|
4220
4223
|
const s = this.fragments[r];
|
|
4221
|
-
if (this.sourceBuffer ?
|
|
4224
|
+
if (this.sourceBuffer ? Ot(this.sourceBuffer.buffered, s.start_ms, s.end_ms) : !1) return !1;
|
|
4222
4225
|
const a = [], l = [];
|
|
4223
4226
|
for (const o of this.appendQueue) {
|
|
4224
4227
|
const c = this.fragments[o.index];
|
|
@@ -4352,7 +4355,7 @@ class Ze {
|
|
|
4352
4355
|
/** Public eviction entry point used by MediaPlayer / prefetch. Delegates
|
|
4353
4356
|
* to the strategy which owns the isEvicting state + range choice logic. */
|
|
4354
4357
|
evictBefore(e) {
|
|
4355
|
-
this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <=
|
|
4358
|
+
this.pendingSeekTargetMs !== null && Math.abs(e - this.pendingSeekTargetMs) <= bo && (this.pendingSeekTargetMs = null), this.eviction.evictBefore(e);
|
|
4356
4359
|
}
|
|
4357
4360
|
// Public entry point for socket reconnect scenarios. Clears stale in-flight
|
|
4358
4361
|
// fetches and their pendingFetchIndices entries so the queue is unblocked on
|
|
@@ -4435,8 +4438,8 @@ class Ze {
|
|
|
4435
4438
|
...this.initCfStatus ? { cf: this.initCfStatus } : {}
|
|
4436
4439
|
} : null, a = [], l = Array.from(this.fragInitTimings.entries()).sort((c, u) => c[0] - u[0]);
|
|
4437
4440
|
for (const [c, u] of l) {
|
|
4438
|
-
const
|
|
4439
|
-
u.fetchStart && (
|
|
4441
|
+
const h = { i: c, src: u.src ?? "?" };
|
|
4442
|
+
u.fetchStart && (h.fs = Math.round(u.fetchStart - this.loadStartTs)), u.fetchStart && u.fetchEnd && (h.fM = Math.round(u.fetchEnd - u.fetchStart)), u.queued && u.fetchEnd && (h.qD = Math.round(u.queued - u.fetchEnd)), u.queued && u.appendDone && (h.aM = Math.round(u.appendDone - u.queued)), u.bytes && (h.B = u.bytes), u.ttfbMs !== void 0 && (h.tt = u.ttfbMs), u.cf && (h.cf = u.cf), u.err && (h.e = u.err), a.push(h);
|
|
4440
4443
|
}
|
|
4441
4444
|
const o = this.getLoadedCount();
|
|
4442
4445
|
C("buffer", `INIT-DIGEST [${e}] reason=${n} ${JSON.stringify({
|
|
@@ -4500,7 +4503,7 @@ class Ze {
|
|
|
4500
4503
|
return { ranges: e, gaps: e.length > 1, fragmentStates: n };
|
|
4501
4504
|
}
|
|
4502
4505
|
getAverageDownloadRate() {
|
|
4503
|
-
return
|
|
4506
|
+
return yo(this.downloadSamples);
|
|
4504
4507
|
}
|
|
4505
4508
|
/** Nominal media end time (ms) = last fragment's end. 0 if no index loaded.
|
|
4506
4509
|
* Reported in health so the leader's status card can tell "near end-of-stream,
|
|
@@ -4516,7 +4519,7 @@ class Ze {
|
|
|
4516
4519
|
findNextRangeStart(e, n) {
|
|
4517
4520
|
if (!this.sourceBuffer?.buffered || this.mediaSource?.readyState !== "open") return null;
|
|
4518
4521
|
const r = e / 1e3, s = this.sourceBuffer.buffered, i = Ye(s, r, Z.RANGE);
|
|
4519
|
-
if (i >= 0 && s.end(i) - r >
|
|
4522
|
+
if (i >= 0 && s.end(i) - r > Pt) return null;
|
|
4520
4523
|
const a = i >= 0 ? Math.max(r, s.end(i)) : r;
|
|
4521
4524
|
for (let l = 0; l < s.length; l++) {
|
|
4522
4525
|
const o = s.start(l);
|
|
@@ -4544,7 +4547,7 @@ class Ze {
|
|
|
4544
4547
|
break;
|
|
4545
4548
|
}
|
|
4546
4549
|
return {
|
|
4547
|
-
atEdge: s >= 0 && i <=
|
|
4550
|
+
atEdge: s >= 0 && i <= Pt,
|
|
4548
4551
|
aheadInRangeMs: i * 1e3,
|
|
4549
4552
|
nextRangeStartMs: l !== null ? l * 1e3 : null,
|
|
4550
4553
|
gapMs: l !== null ? (l - a) * 1e3 : null
|
|
@@ -4587,14 +4590,14 @@ class Ze {
|
|
|
4587
4590
|
this.disposed = !0, this.eosRetryTimer && (clearTimeout(this.eosRetryTimer), this.eosRetryTimer = null), this.pendingEndOfStream = !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;
|
|
4588
4591
|
}
|
|
4589
4592
|
}
|
|
4590
|
-
function
|
|
4593
|
+
function Po(t, e) {
|
|
4591
4594
|
return !!t && t !== "eng" && e;
|
|
4592
4595
|
}
|
|
4593
|
-
function
|
|
4594
|
-
return t.override !== null ? t.override : t.globalEnabled ||
|
|
4596
|
+
function Do(t) {
|
|
4597
|
+
return t.override !== null ? t.override : t.globalEnabled || Po(t.selectedAudioLang, t.hasEngSub);
|
|
4595
4598
|
}
|
|
4596
4599
|
const Rr = "wp_reload_history", nn = "wp_phantom_reload", Fr = 5 * 6e4, Nn = 3;
|
|
4597
|
-
function
|
|
4600
|
+
function Bo() {
|
|
4598
4601
|
try {
|
|
4599
4602
|
const t = sessionStorage.getItem(Rr);
|
|
4600
4603
|
return (t ? JSON.parse(t) : []).filter((n) => Date.now() - n < Fr);
|
|
@@ -4602,8 +4605,8 @@ function Do() {
|
|
|
4602
4605
|
return [];
|
|
4603
4606
|
}
|
|
4604
4607
|
}
|
|
4605
|
-
function
|
|
4606
|
-
const n =
|
|
4608
|
+
function Jt(t, e) {
|
|
4609
|
+
const n = Bo();
|
|
4607
4610
|
if (n.length >= Nn) {
|
|
4608
4611
|
pn(
|
|
4609
4612
|
"error",
|
|
@@ -4639,13 +4642,13 @@ function Ln() {
|
|
|
4639
4642
|
return null;
|
|
4640
4643
|
}
|
|
4641
4644
|
}
|
|
4642
|
-
function
|
|
4645
|
+
function Oo() {
|
|
4643
4646
|
try {
|
|
4644
4647
|
sessionStorage.removeItem(nn);
|
|
4645
4648
|
} catch {
|
|
4646
4649
|
}
|
|
4647
4650
|
}
|
|
4648
|
-
function
|
|
4651
|
+
function Ho() {
|
|
4649
4652
|
const t = navigator;
|
|
4650
4653
|
try {
|
|
4651
4654
|
return typeof t.getAutoplayPolicy == "function" ? t.getAutoplayPolicy("mediaelement") : void 0;
|
|
@@ -4653,11 +4656,11 @@ function Oo() {
|
|
|
4653
4656
|
return;
|
|
4654
4657
|
}
|
|
4655
4658
|
}
|
|
4656
|
-
function
|
|
4659
|
+
function Uo(t, e) {
|
|
4657
4660
|
return t === "disallowed" ? "deferred" : e ? "user-muted" : t === "allowed-muted" ? "muted-bridge" : "audible";
|
|
4658
4661
|
}
|
|
4659
4662
|
function Nr(t, e) {
|
|
4660
|
-
const n =
|
|
4663
|
+
const n = Ho(), r = Uo(n, e.userWantsMuted);
|
|
4661
4664
|
E(e.label, "autoplay plan", { policy: n ?? "unknown", plan: r, userWantsMuted: e.userWantsMuted });
|
|
4662
4665
|
const s = () => {
|
|
4663
4666
|
t.muted = !0, t.play().then(() => {
|
|
@@ -4697,7 +4700,7 @@ function Lr(t, e = 3e3) {
|
|
|
4697
4700
|
t.addEventListener("seeked", s, { once: !0 });
|
|
4698
4701
|
});
|
|
4699
4702
|
}
|
|
4700
|
-
class
|
|
4703
|
+
class jo {
|
|
4701
4704
|
// ── State ──
|
|
4702
4705
|
_seekInFlight = !1;
|
|
4703
4706
|
/** Route taken by the in-flight seek (buffered/loading/nearby-pending/far) —
|
|
@@ -4775,28 +4778,28 @@ class Uo {
|
|
|
4775
4778
|
}), await this._smartBufferAll(l, u, r, s, n), this._checkAborted(n), E("seek-coord", `BUFFERED [${s}] took ${Math.round(performance.now() - A)}ms`);
|
|
4776
4779
|
} else
|
|
4777
4780
|
E("seek-coord", `ALREADY BUFFERED [${s}] target=${Math.round(r)}ms`);
|
|
4778
|
-
const
|
|
4779
|
-
a.currentTime =
|
|
4780
|
-
const
|
|
4781
|
+
const f = r / 1e3;
|
|
4782
|
+
a.currentTime = f, await Lr(a), this._checkAborted(n);
|
|
4783
|
+
const y = a.currentTime * 1e3, g = Math.round(performance.now() - o);
|
|
4781
4784
|
C("seek-coord", `SEEK-DIGEST [${s}] route=${this._lastSeekRoute} ${g}ms`, {
|
|
4782
4785
|
targetMs: Math.round(r),
|
|
4783
|
-
actualMs: Math.round(
|
|
4784
|
-
delta: Math.round(
|
|
4786
|
+
actualMs: Math.round(y),
|
|
4787
|
+
delta: Math.round(y - r),
|
|
4785
4788
|
route: this._lastSeekRoute,
|
|
4786
4789
|
totalMs: g,
|
|
4787
4790
|
videoReady: a.readyState
|
|
4788
|
-
}), oe.recordSeekCompleted(s, r, g), x.getState().snapshot.playing && (i || a.paused) && this._resume(a), e.onComplete?.(
|
|
4789
|
-
const
|
|
4790
|
-
|
|
4791
|
+
}), oe.recordSeekCompleted(s, r, g), x.getState().snapshot.playing && (i || a.paused) && this._resume(a), e.onComplete?.(y);
|
|
4792
|
+
const v = this.deps.fragmentManagerRef.current;
|
|
4793
|
+
v && v.prefetchAround(y);
|
|
4791
4794
|
const w = this.deps.audioFragmentManagersRef.current ?? [];
|
|
4792
|
-
for (const A of w) A.prefetchAround(
|
|
4793
|
-
return { actualMs:
|
|
4795
|
+
for (const A of w) A.prefetchAround(y);
|
|
4796
|
+
return { actualMs: y };
|
|
4794
4797
|
} catch (u) {
|
|
4795
|
-
const
|
|
4796
|
-
return u.name === "AbortError" ? (E("seek-coord", `PREEMPTED [${s}] after ${
|
|
4798
|
+
const h = Math.round(performance.now() - o);
|
|
4799
|
+
return u.name === "AbortError" ? (E("seek-coord", `PREEMPTED [${s}] after ${h}ms`, {
|
|
4797
4800
|
targetMs: Math.round(r),
|
|
4798
4801
|
videoTime: Math.round(a.currentTime * 1e3)
|
|
4799
|
-
}), e.onAborted?.(null), null) : (C("seek-coord", `FAILED [${s}] after ${
|
|
4802
|
+
}), e.onAborted?.(null), null) : (C("seek-coord", `FAILED [${s}] after ${h}ms: ${u?.message}`, {
|
|
4800
4803
|
targetMs: Math.round(r),
|
|
4801
4804
|
videoTime: Math.round(a.currentTime * 1e3),
|
|
4802
4805
|
videoReady: a.readyState,
|
|
@@ -4889,10 +4892,10 @@ class Uo {
|
|
|
4889
4892
|
}
|
|
4890
4893
|
}
|
|
4891
4894
|
let lt = null;
|
|
4892
|
-
function
|
|
4895
|
+
function Go() {
|
|
4893
4896
|
lt === null && (E("health", "Starting health reporting"), $n(), lt = window.setInterval($n, Ns));
|
|
4894
4897
|
}
|
|
4895
|
-
function
|
|
4898
|
+
function Wo() {
|
|
4896
4899
|
lt !== null && (E("health", "Stopping health reporting"), window.clearInterval(lt), lt = null);
|
|
4897
4900
|
}
|
|
4898
4901
|
function $n() {
|
|
@@ -4908,17 +4911,17 @@ function $n() {
|
|
|
4908
4911
|
}
|
|
4909
4912
|
const r = document.querySelector("video"), s = r ? Math.round(r.currentTime * 1e3) : e.snapshot.playheadMs, i = n.getBufferState(), a = n.getBufferedEnd(s), l = window.__AUDIO_FRAGMENT_MANAGERS__;
|
|
4910
4913
|
let o = -1;
|
|
4911
|
-
for (const
|
|
4912
|
-
if (!
|
|
4913
|
-
const
|
|
4914
|
-
(o < 0 ||
|
|
4914
|
+
for (const f of l ?? []) {
|
|
4915
|
+
if (!f.hasIndex) continue;
|
|
4916
|
+
const y = f.getBufferedAheadMs(s);
|
|
4917
|
+
(o < 0 || y < o) && (o = y);
|
|
4915
4918
|
}
|
|
4916
|
-
const c = Math.max(0, a - s), u = o < 0 ? c : Math.min(c, o),
|
|
4919
|
+
const c = Math.max(0, a - s), u = o < 0 ? c : Math.min(c, o), h = e.drift.rtts.length > 0 ? e.drift.rtts.reduce((f, y) => f + y, 0) / e.drift.rtts.length : 0;
|
|
4917
4920
|
t.emit(Yn.HEALTH_REPORT, {
|
|
4918
4921
|
avg_download_rate_bps: n.getAverageDownloadRate(),
|
|
4919
4922
|
buffered_ahead_ms: u,
|
|
4920
4923
|
audio_buffered_ahead_ms: o < 0 ? -1 : Math.round(o),
|
|
4921
|
-
rtt_ms:
|
|
4924
|
+
rtt_ms: h,
|
|
4922
4925
|
playhead_ms: s,
|
|
4923
4926
|
is_buffering: e.bufferState.isBuffering,
|
|
4924
4927
|
fragments_loaded: i.fragmentStates.loaded || 0,
|
|
@@ -4927,12 +4930,12 @@ function $n() {
|
|
|
4927
4930
|
video_ready_state: r?.readyState ?? -1,
|
|
4928
4931
|
duration_ms: n.getMediaEndMs(),
|
|
4929
4932
|
delivery_arm: $s(),
|
|
4930
|
-
...
|
|
4933
|
+
...Vo(r),
|
|
4931
4934
|
pong_age_ms: Ls(),
|
|
4932
4935
|
reported_at: Date.now()
|
|
4933
4936
|
});
|
|
4934
4937
|
}
|
|
4935
|
-
function
|
|
4938
|
+
function Vo(t) {
|
|
4936
4939
|
const e = typeof navigator > "u" ? void 0 : navigator, n = e?.connection;
|
|
4937
4940
|
return {
|
|
4938
4941
|
page_visible: typeof document.visibilityState == "string" ? document.visibilityState === "visible" : void 0,
|
|
@@ -4944,8 +4947,8 @@ function Wo(t) {
|
|
|
4944
4947
|
net_downlink_mbps: typeof n?.downlink == "number" && n.downlink >= 0 ? n.downlink : void 0
|
|
4945
4948
|
};
|
|
4946
4949
|
}
|
|
4947
|
-
const
|
|
4948
|
-
function
|
|
4950
|
+
const Ko = 3e3;
|
|
4951
|
+
function zo() {
|
|
4949
4952
|
const [t, e] = $(!1), n = P(null), r = P(!1), s = () => {
|
|
4950
4953
|
n.current && (clearTimeout(n.current), n.current = null);
|
|
4951
4954
|
}, i = U((o = 3e3) => {
|
|
@@ -4955,7 +4958,7 @@ function Ko() {
|
|
|
4955
4958
|
}, []), a = U(() => {
|
|
4956
4959
|
r.current || (s(), e(!1));
|
|
4957
4960
|
}, []), l = U((o) => {
|
|
4958
|
-
r.current !== o && (r.current = o, o ? (s(), e(!0)) : i(
|
|
4961
|
+
r.current !== o && (r.current = o, o ? (s(), e(!0)) : i(Ko));
|
|
4959
4962
|
}, [i]);
|
|
4960
4963
|
return L(() => {
|
|
4961
4964
|
const o = () => {
|
|
@@ -4966,7 +4969,7 @@ function Ko() {
|
|
|
4966
4969
|
};
|
|
4967
4970
|
}, [i]), { controlsVisible: t, showControls: i, hideControls: a, setControlsHeld: l };
|
|
4968
4971
|
}
|
|
4969
|
-
const $r = [], Pr = [],
|
|
4972
|
+
const $r = [], Pr = [], Jo = {
|
|
4970
4973
|
fragments: $r,
|
|
4971
4974
|
durationMs: null,
|
|
4972
4975
|
mseCodec: null,
|
|
@@ -4974,8 +4977,8 @@ const $r = [], Pr = [], zo = {
|
|
|
4974
4977
|
audioTracks: Pr,
|
|
4975
4978
|
contentToken: null
|
|
4976
4979
|
};
|
|
4977
|
-
function
|
|
4978
|
-
if (!t || t.url !== e) return
|
|
4980
|
+
function Qo(t, e) {
|
|
4981
|
+
if (!t || t.url !== e) return Jo;
|
|
4979
4982
|
const n = t.data;
|
|
4980
4983
|
return {
|
|
4981
4984
|
fragments: n.fragments || $r,
|
|
@@ -5004,7 +5007,7 @@ function Pn(t) {
|
|
|
5004
5007
|
return null;
|
|
5005
5008
|
}
|
|
5006
5009
|
}
|
|
5007
|
-
function
|
|
5010
|
+
function qo(t) {
|
|
5008
5011
|
const [e, n] = $(null);
|
|
5009
5012
|
return L(() => {
|
|
5010
5013
|
const r = new AbortController();
|
|
@@ -5022,22 +5025,22 @@ function Qo(t) {
|
|
|
5022
5025
|
priority: "high"
|
|
5023
5026
|
}), c = Math.round(performance.now() - l);
|
|
5024
5027
|
if (!o.ok) throw new Error(`HTTP ${o.status}`);
|
|
5025
|
-
const u = await o.text(),
|
|
5028
|
+
const u = await o.text(), h = Math.round(performance.now() - l) - c, f = JSON.parse(u), y = Math.round(performance.now() - l) - c - h, g = c + h + y;
|
|
5026
5029
|
if (r.signal.aborted) return;
|
|
5027
|
-
n({ url: t, data:
|
|
5028
|
-
const
|
|
5030
|
+
n({ url: t, data: f });
|
|
5031
|
+
const p = Pn(t);
|
|
5029
5032
|
E("mse", "Index loaded", {
|
|
5030
5033
|
attempt: i + 1,
|
|
5031
5034
|
headerMs: c,
|
|
5032
|
-
downloadMs:
|
|
5033
|
-
parseMs:
|
|
5035
|
+
downloadMs: h,
|
|
5036
|
+
parseMs: y,
|
|
5034
5037
|
totalMs: g,
|
|
5035
|
-
count:
|
|
5036
|
-
duration:
|
|
5037
|
-
codec:
|
|
5038
|
-
initSegment:
|
|
5039
|
-
audioTrackCount:
|
|
5040
|
-
...
|
|
5038
|
+
count: f.fragments?.length,
|
|
5039
|
+
duration: f.duration_ms,
|
|
5040
|
+
codec: f.mse_codec,
|
|
5041
|
+
initSegment: f.init_segment,
|
|
5042
|
+
audioTrackCount: f.audio_tracks?.length || 0,
|
|
5043
|
+
...p && { timing: p }
|
|
5041
5044
|
});
|
|
5042
5045
|
return;
|
|
5043
5046
|
} catch (o) {
|
|
@@ -5049,48 +5052,48 @@ function Qo(t) {
|
|
|
5049
5052
|
elapsedMs: c,
|
|
5050
5053
|
...u && { timing: u }
|
|
5051
5054
|
});
|
|
5052
|
-
const
|
|
5053
|
-
|
|
5055
|
+
const h = i <= 1 ? 0 : ct(i - 1, { baseMs: 500, capMs: a, jitter: 0 });
|
|
5056
|
+
h > 0 && await new Promise((f) => setTimeout(f, h));
|
|
5054
5057
|
}
|
|
5055
5058
|
}
|
|
5056
5059
|
}
|
|
5057
5060
|
return s(), () => {
|
|
5058
5061
|
r.abort();
|
|
5059
5062
|
};
|
|
5060
|
-
}, [t]), Ee(() =>
|
|
5063
|
+
}, [t]), Ee(() => Qo(e, t), [e, t]);
|
|
5061
5064
|
}
|
|
5062
|
-
const
|
|
5065
|
+
const Ut = {
|
|
5063
5066
|
audioTracks: [],
|
|
5064
5067
|
subtitleTracks: [],
|
|
5065
5068
|
selectedAudioIndex: 0,
|
|
5066
5069
|
selectedSubtitleIndex: 0
|
|
5067
5070
|
};
|
|
5068
|
-
function
|
|
5069
|
-
const [e, n] = $(
|
|
5070
|
-
i !== t && (a(t), t && n(
|
|
5071
|
+
function Yo(t) {
|
|
5072
|
+
const [e, n] = $(Ut), r = Ps(), s = x((u) => u.mediaPrefs.preferredAudioLang), [i, a] = $(t);
|
|
5073
|
+
i !== t && (a(t), t && n(Ut));
|
|
5071
5074
|
const l = fe(() => ({ origin: Ds(r), preferredAudioLang: s }));
|
|
5072
5075
|
L(() => {
|
|
5073
5076
|
if (!t) return;
|
|
5074
|
-
const u = new AbortController(), { origin:
|
|
5075
|
-
let
|
|
5077
|
+
const u = new AbortController(), { origin: h, preferredAudioLang: f } = l();
|
|
5078
|
+
let y;
|
|
5076
5079
|
return (async () => {
|
|
5077
5080
|
try {
|
|
5078
|
-
if (
|
|
5079
|
-
const g = await
|
|
5080
|
-
n({ audioTracks:
|
|
5081
|
+
if (y = await fetch(`${h}/api/media/${encodeURIComponent(t)}/tracks`, { signal: u.signal }), !y.ok) throw new Error("Failed to fetch tracks");
|
|
5082
|
+
const g = await y.json(), p = (T) => T.startsWith("/") ? `${h}${T}` : T, v = (g.audio || []).map((T) => ({ ...T, url: p(T.url) })), w = (g.subtitles || []).map((T) => ({ ...T, url: p(T.url) })), A = v.findIndex((T) => T.lang === f), F = A >= 0 ? A : 0, k = w.findIndex((T) => T.lang === "eng"), m = k >= 0 ? k : 0;
|
|
5083
|
+
n({ audioTracks: v, subtitleTracks: w, selectedAudioIndex: F, selectedSubtitleIndex: m }), E("mse", "Tracks loaded", { audio: v.length, subs: w.length });
|
|
5081
5084
|
} catch (g) {
|
|
5082
|
-
const
|
|
5083
|
-
if (
|
|
5084
|
-
C("mse", "Tracks fetch error", { mediaId: t, status:
|
|
5085
|
+
const p = Y(g);
|
|
5086
|
+
if (p.name === "AbortError") return;
|
|
5087
|
+
C("mse", "Tracks fetch error", { mediaId: t, status: y?.status, ...p }), n(Ut);
|
|
5085
5088
|
}
|
|
5086
5089
|
})().catch((g) => ee("mse", "Tracks load threw", { mediaId: t, ...Y(g) })), () => {
|
|
5087
5090
|
u.abort();
|
|
5088
5091
|
};
|
|
5089
5092
|
}, [t]);
|
|
5090
5093
|
const o = U((u) => {
|
|
5091
|
-
n((
|
|
5094
|
+
n((h) => ({ ...h, selectedAudioIndex: u }));
|
|
5092
5095
|
}, []), c = U((u) => {
|
|
5093
|
-
n((
|
|
5096
|
+
n((h) => ({ ...h, selectedSubtitleIndex: u }));
|
|
5094
5097
|
}, []);
|
|
5095
5098
|
return {
|
|
5096
5099
|
audioTracks: e.audioTracks,
|
|
@@ -5101,12 +5104,12 @@ function qo(t) {
|
|
|
5101
5104
|
setSelectedSubtitleIndex: c
|
|
5102
5105
|
};
|
|
5103
5106
|
}
|
|
5104
|
-
const
|
|
5105
|
-
function
|
|
5106
|
-
return !t.roomPlaying || t.videoPaused ? "not-playing" : t.seekInFlight ? "seeking" : t.advancedMs >
|
|
5107
|
+
const Xo = 100;
|
|
5108
|
+
function Zo(t) {
|
|
5109
|
+
return !t.roomPlaying || t.videoPaused ? "not-playing" : t.seekInFlight ? "seeking" : t.advancedMs > Xo ? "advancing" : "stalled";
|
|
5107
5110
|
}
|
|
5108
|
-
const
|
|
5109
|
-
function
|
|
5111
|
+
const jt = 4e4, ec = 3e3;
|
|
5112
|
+
function tc(t, e, n, r, s, i) {
|
|
5110
5113
|
const a = fe((w) => {
|
|
5111
5114
|
const A = {};
|
|
5112
5115
|
return (i?.current ?? []).forEach((k, m) => {
|
|
@@ -5121,7 +5124,7 @@ function ec(t, e, n, r, s, i) {
|
|
|
5121
5124
|
error: k?.message
|
|
5122
5125
|
});
|
|
5123
5126
|
}));
|
|
5124
|
-
}), o = fe((w) => s(w)), c = P(null), u = P(!1),
|
|
5127
|
+
}), o = fe((w) => s(w)), c = P(null), u = P(!1), h = P(null), f = P(null), y = P(0), g = P(null), p = P(0), v = P(null);
|
|
5125
5128
|
L(() => {
|
|
5126
5129
|
const w = t.current;
|
|
5127
5130
|
if (!w || !r) return;
|
|
@@ -5131,25 +5134,25 @@ function ec(t, e, n, r, s, i) {
|
|
|
5131
5134
|
function F() {
|
|
5132
5135
|
A();
|
|
5133
5136
|
const S = t.current;
|
|
5134
|
-
S && (
|
|
5137
|
+
S && (p.current = S.currentTime, g.current = setTimeout(k, ec));
|
|
5135
5138
|
}
|
|
5136
5139
|
function k() {
|
|
5137
5140
|
g.current = null;
|
|
5138
5141
|
const S = t.current;
|
|
5139
5142
|
if (!S) return;
|
|
5140
|
-
const I = x.getState(), B = n.current, H =
|
|
5143
|
+
const I = x.getState(), B = n.current, H = Zo({
|
|
5141
5144
|
roomPlaying: I.snapshot.playing,
|
|
5142
5145
|
videoPaused: S.paused,
|
|
5143
5146
|
seekInFlight: !!B?.seekInFlight,
|
|
5144
|
-
advancedMs: (S.currentTime -
|
|
5147
|
+
advancedMs: (S.currentTime - p.current) * 1e3
|
|
5145
5148
|
});
|
|
5146
5149
|
if (H !== "stalled") {
|
|
5147
|
-
|
|
5150
|
+
v.current = null, H !== "not-playing" && F();
|
|
5148
5151
|
return;
|
|
5149
5152
|
}
|
|
5150
5153
|
const j = S.currentTime * 1e3, K = e.current, X = Date.now();
|
|
5151
|
-
|
|
5152
|
-
const N = X -
|
|
5154
|
+
v.current === null && (v.current = X);
|
|
5155
|
+
const N = X - v.current;
|
|
5153
5156
|
if (C("sync", "SILENT-STALL playhead frozen with no `waiting` event", {
|
|
5154
5157
|
currentTime: +S.currentTime.toFixed(2),
|
|
5155
5158
|
readyState: S.readyState,
|
|
@@ -5164,7 +5167,7 @@ function ec(t, e, n, r, s, i) {
|
|
|
5164
5167
|
...a(j)
|
|
5165
5168
|
}), l(j, "silent-stall"), K) {
|
|
5166
5169
|
K.reconcileLoadedStates();
|
|
5167
|
-
const O = K.findNextRangeStart(j,
|
|
5170
|
+
const O = K.findNextRangeStart(j, Dt);
|
|
5168
5171
|
O !== null && B ? (C("sync", "SILENT-STALL gap-skip", {
|
|
5169
5172
|
currentMs: Math.round(j),
|
|
5170
5173
|
gapSkipTarget: Math.round(O)
|
|
@@ -5181,23 +5184,23 @@ function ec(t, e, n, r, s, i) {
|
|
|
5181
5184
|
});
|
|
5182
5185
|
});
|
|
5183
5186
|
}
|
|
5184
|
-
if (N >=
|
|
5185
|
-
K?.dumpBufferDiagnostics(j, "silent-stall-reload"),
|
|
5187
|
+
if (N >= jt) {
|
|
5188
|
+
K?.dumpBufferDiagnostics(j, "silent-stall-reload"), Jt("silent-stall", {
|
|
5186
5189
|
frozenMs: N,
|
|
5187
5190
|
currentTime: +S.currentTime.toFixed(2),
|
|
5188
5191
|
readyState: S.readyState,
|
|
5189
5192
|
loaded: K?.getLoadedCount?.() ?? -1
|
|
5190
|
-
}),
|
|
5193
|
+
}), v.current = null;
|
|
5191
5194
|
return;
|
|
5192
5195
|
}
|
|
5193
5196
|
F();
|
|
5194
5197
|
}
|
|
5195
5198
|
function m() {
|
|
5196
|
-
|
|
5199
|
+
v.current = null, F();
|
|
5197
5200
|
}
|
|
5198
5201
|
function T() {
|
|
5199
5202
|
const S = w.currentTime * 1e3;
|
|
5200
|
-
|
|
5203
|
+
h.current = Date.now();
|
|
5201
5204
|
const I = x.getState(), B = I.snapshot.playing, H = !!I.snapshot.leaderId && I.snapshot.leaderId === I.me.clientId, j = I.snapshot.playheadMs + (I.snapshot.playing ? Date.now() - I.snapshotReceivedAt : 0);
|
|
5202
5205
|
E("sync", "VIDEO waiting event", {
|
|
5203
5206
|
currentTime: w.currentTime.toFixed(2),
|
|
@@ -5217,7 +5220,7 @@ function ec(t, e, n, r, s, i) {
|
|
|
5217
5220
|
}
|
|
5218
5221
|
if (B && !X?.seekInFlight && S > 0 && l(S, "waiting"), B && K && !X?.seekInFlight && S > 0) {
|
|
5219
5222
|
K.reconcileLoadedStates();
|
|
5220
|
-
const O = K.getBufferedAheadMs(S), Q = K.findNextRangeStart(S,
|
|
5223
|
+
const O = K.getBufferedAheadMs(S), Q = K.findNextRangeStart(S, Dt);
|
|
5221
5224
|
if (Q !== null && X)
|
|
5222
5225
|
C("sync", "GAP-SKIP seeking over late-IDR gap", {
|
|
5223
5226
|
currentMs: Math.round(S),
|
|
@@ -5236,7 +5239,7 @@ function ec(t, e, n, r, s, i) {
|
|
|
5236
5239
|
aheadInRangeMs: Math.round(W.aheadInRangeMs),
|
|
5237
5240
|
nextRangeStartMs: Math.round(W.nextRangeStartMs),
|
|
5238
5241
|
gapMs: W.gapMs !== null ? Math.round(W.gapMs) : null,
|
|
5239
|
-
windowMs:
|
|
5242
|
+
windowMs: Dt
|
|
5240
5243
|
}), K.fetchNearby(S).catch((re) => {
|
|
5241
5244
|
const le = Y(re);
|
|
5242
5245
|
le.name !== "AbortError" && C("sync", "Stall recovery fetchNearby failed", {
|
|
@@ -5250,11 +5253,11 @@ function ec(t, e, n, r, s, i) {
|
|
|
5250
5253
|
c.current = null;
|
|
5251
5254
|
const O = x.getState(), Q = !!O.snapshot.leaderId && O.snapshot.leaderId === O.me.clientId, W = !!n.current?.seekInFlight;
|
|
5252
5255
|
Q && !w.paused && w.readyState < 3 && !W && (C("sync", "Leader stall threshold reached — pausing room", { stallMs: mn }), u.current = !0, Pe("pause"));
|
|
5253
|
-
}, mn)), B && !
|
|
5254
|
-
|
|
5256
|
+
}, mn)), B && !f.current && (y.current = w.currentTime, f.current = setTimeout(() => {
|
|
5257
|
+
f.current = null;
|
|
5255
5258
|
const O = t.current;
|
|
5256
5259
|
if (!O) return;
|
|
5257
|
-
const W = x.getState().snapshot.playing, re = e.current, le = re?.getBufferedAheadMs(O.currentTime * 1e3) ?? -1, Re = O.currentTime -
|
|
5260
|
+
const W = x.getState().snapshot.playing, re = e.current, le = re?.getBufferedAheadMs(O.currentTime * 1e3) ?? -1, Re = O.currentTime - y.current;
|
|
5258
5261
|
if (!(W && Re < 0.5 && O.readyState < 3 && le < 1e3)) {
|
|
5259
5262
|
E("sync", "STUCK-CHECK cleared — playback progressed, no reload", {
|
|
5260
5263
|
advancedSec: +Re.toFixed(2),
|
|
@@ -5264,22 +5267,22 @@ function ec(t, e, n, r, s, i) {
|
|
|
5264
5267
|
});
|
|
5265
5268
|
return;
|
|
5266
5269
|
}
|
|
5267
|
-
re?.dumpBufferDiagnostics(O.currentTime * 1e3, "stuck-reload"),
|
|
5268
|
-
stuckMs:
|
|
5270
|
+
re?.dumpBufferDiagnostics(O.currentTime * 1e3, "stuck-reload"), Jt("stuck-watchdog", {
|
|
5271
|
+
stuckMs: jt,
|
|
5269
5272
|
advancedSec: +Re.toFixed(2),
|
|
5270
5273
|
currentTime: +O.currentTime.toFixed(2),
|
|
5271
5274
|
readyState: O.readyState,
|
|
5272
5275
|
bufferedAheadMs: Math.round(le),
|
|
5273
5276
|
loaded: re?.getLoadedCount?.() ?? -1
|
|
5274
5277
|
});
|
|
5275
|
-
},
|
|
5278
|
+
}, jt));
|
|
5276
5279
|
}
|
|
5277
5280
|
function R() {
|
|
5278
|
-
oe.recordStallEnd(), c.current && (clearTimeout(c.current), c.current = null),
|
|
5281
|
+
oe.recordStallEnd(), c.current && (clearTimeout(c.current), c.current = null), f.current && (clearTimeout(f.current), f.current = null), v.current = null, F();
|
|
5279
5282
|
const S = x.getState(), I = S.snapshot.playing, B = !!S.snapshot.leaderId && S.snapshot.leaderId === S.me.clientId;
|
|
5280
5283
|
!I && !w.paused && o(w), B && u.current && !I && (u.current = !1, C("sync", "Leader stall recovered — resuming room", { currentTime: w.currentTime.toFixed(2) }), Pe("play"));
|
|
5281
|
-
const H =
|
|
5282
|
-
|
|
5284
|
+
const H = h.current !== null ? Date.now() - h.current : null;
|
|
5285
|
+
h.current = null;
|
|
5283
5286
|
const j = x.getState(), K = j.snapshot.playheadMs + (j.snapshot.playing ? Date.now() - j.snapshotReceivedAt : 0), X = w.currentTime * 1e3;
|
|
5284
5287
|
E("sync", "VIDEO playing event", {
|
|
5285
5288
|
currentTime: w.currentTime.toFixed(2),
|
|
@@ -5290,15 +5293,15 @@ function ec(t, e, n, r, s, i) {
|
|
|
5290
5293
|
});
|
|
5291
5294
|
}
|
|
5292
5295
|
function b() {
|
|
5293
|
-
|
|
5296
|
+
v.current = null, A();
|
|
5294
5297
|
}
|
|
5295
5298
|
return w.addEventListener("waiting", T), w.addEventListener("playing", R), w.addEventListener("timeupdate", m), w.addEventListener("pause", b), w.paused || F(), () => {
|
|
5296
|
-
w.removeEventListener("waiting", T), w.removeEventListener("playing", R), w.removeEventListener("timeupdate", m), w.removeEventListener("pause", b), c.current && (clearTimeout(c.current), c.current = null),
|
|
5299
|
+
w.removeEventListener("waiting", T), w.removeEventListener("playing", R), w.removeEventListener("timeupdate", m), w.removeEventListener("pause", b), c.current && (clearTimeout(c.current), c.current = null), f.current && (clearTimeout(f.current), f.current = null), A(), v.current = null;
|
|
5297
5300
|
};
|
|
5298
5301
|
}, [r, t, e, n]);
|
|
5299
5302
|
}
|
|
5300
|
-
const
|
|
5301
|
-
function
|
|
5303
|
+
const nc = 1.5;
|
|
5304
|
+
function rc(t, e, n, r, s, i) {
|
|
5302
5305
|
const a = P(null), l = P(null), o = U(() => {
|
|
5303
5306
|
a.current && (clearInterval(a.current), a.current = null), l.current?.(), l.current = null;
|
|
5304
5307
|
}, []);
|
|
@@ -5308,57 +5311,57 @@ function nc(t, e, n, r, s, i) {
|
|
|
5308
5311
|
o();
|
|
5309
5312
|
return;
|
|
5310
5313
|
}
|
|
5311
|
-
const
|
|
5312
|
-
const
|
|
5313
|
-
if (
|
|
5314
|
-
for (const w of
|
|
5315
|
-
w.prefetchAround(
|
|
5314
|
+
const h = (p) => {
|
|
5315
|
+
const v = i?.current;
|
|
5316
|
+
if (v)
|
|
5317
|
+
for (const w of v)
|
|
5318
|
+
w.prefetchAround(p), w.evictBefore(p);
|
|
5316
5319
|
};
|
|
5317
|
-
let
|
|
5318
|
-
const
|
|
5320
|
+
let f = 0;
|
|
5321
|
+
const y = () => {
|
|
5319
5322
|
if (c && u) {
|
|
5320
5323
|
if (n.current?.seekInFlight) return;
|
|
5321
|
-
|
|
5322
|
-
const
|
|
5323
|
-
u.prefetchAround(
|
|
5324
|
-
const
|
|
5325
|
-
s({ bufferedEndMs:
|
|
5324
|
+
f = performance.now();
|
|
5325
|
+
const p = c.currentTime * 1e3;
|
|
5326
|
+
u.prefetchAround(p), u.evictBefore(p), h(p);
|
|
5327
|
+
const v = u.getBufferedEnd(p);
|
|
5328
|
+
s({ bufferedEndMs: v });
|
|
5326
5329
|
}
|
|
5327
5330
|
};
|
|
5328
|
-
a.current = setInterval(
|
|
5331
|
+
a.current = setInterval(y, gn);
|
|
5329
5332
|
const g = () => {
|
|
5330
|
-
performance.now() -
|
|
5333
|
+
performance.now() - f >= gn * nc && y();
|
|
5331
5334
|
};
|
|
5332
5335
|
if (c && (c.addEventListener("timeupdate", g), l.current = () => c.removeEventListener("timeupdate", g)), c && !n.current?.seekInFlight) {
|
|
5333
|
-
|
|
5334
|
-
const
|
|
5335
|
-
u.prefetchAround(
|
|
5336
|
+
f = performance.now();
|
|
5337
|
+
const p = c.currentTime * 1e3;
|
|
5338
|
+
u.prefetchAround(p), h(p);
|
|
5336
5339
|
}
|
|
5337
5340
|
return o;
|
|
5338
5341
|
}, [r, s, t, e, n, i, o]), { stopPrefetch: o };
|
|
5339
5342
|
}
|
|
5340
|
-
function
|
|
5341
|
-
const a = x((
|
|
5343
|
+
function sc(t, e, n, r, s, i) {
|
|
5344
|
+
const a = x((h) => h.snapshot), l = x((h) => h.loadGeneration), o = P(l), c = fe((h) => s(h)), u = fe((h) => i(h));
|
|
5342
5345
|
L(() => {
|
|
5343
|
-
const
|
|
5344
|
-
if (!
|
|
5345
|
-
const
|
|
5346
|
-
o.current = l, !(!g && Math.abs(
|
|
5347
|
-
targetMs:
|
|
5348
|
-
lastApplied:
|
|
5349
|
-
delta: Math.round(
|
|
5346
|
+
const h = t.current;
|
|
5347
|
+
if (!h || !r) return;
|
|
5348
|
+
const f = a.playheadMs, y = n.current, g = l !== o.current;
|
|
5349
|
+
o.current = l, !(!g && Math.abs(f - y) <= Bs) && (E("buffer", "Seek triggered", {
|
|
5350
|
+
targetMs: f,
|
|
5351
|
+
lastApplied: y,
|
|
5352
|
+
delta: Math.round(f - y),
|
|
5350
5353
|
genChanged: g
|
|
5351
|
-
}), n.current =
|
|
5352
|
-
targetMs:
|
|
5354
|
+
}), n.current = f, h.submit({
|
|
5355
|
+
targetMs: f,
|
|
5353
5356
|
priority: ht.SEEK_EFFECT,
|
|
5354
5357
|
caller: "seek-effect",
|
|
5355
5358
|
pauseSeekResume: !0
|
|
5356
|
-
}).catch((
|
|
5359
|
+
}).catch((p) => ee("buffer", "Seek effect submit threw", Y(p))));
|
|
5357
5360
|
}, [a.playheadMs, r, l, t, n]), L(() => {
|
|
5358
|
-
const
|
|
5359
|
-
if (!
|
|
5360
|
-
const
|
|
5361
|
-
|
|
5361
|
+
const h = e.current;
|
|
5362
|
+
if (!h || !r || t.current?.seekInFlight) return;
|
|
5363
|
+
const f = a.playing, y = h.paused;
|
|
5364
|
+
f && y ? (E("sync", "Play/pause sync", { playing: f, videoPaused: y, currentTime: Math.round(h.currentTime * 1e3) }), c(h)) : !f && !y && (E("sync", "Play/pause sync", { playing: f, videoPaused: y, currentTime: Math.round(h.currentTime * 1e3) }), u(h));
|
|
5362
5365
|
}, [a.playing, r, t, e]);
|
|
5363
5366
|
}
|
|
5364
5367
|
function Dn(t, e) {
|
|
@@ -5369,7 +5372,7 @@ function Dn(t, e) {
|
|
|
5369
5372
|
}, { once: !0 });
|
|
5370
5373
|
});
|
|
5371
5374
|
}
|
|
5372
|
-
function
|
|
5375
|
+
function ac(t) {
|
|
5373
5376
|
const e = x((a) => a.playlist), n = x((a) => a.activePlaylistIndex), r = x((a) => a.snapshot.mediaId), s = e?.id, i = fe(() => e);
|
|
5374
5377
|
L(() => {
|
|
5375
5378
|
const a = i();
|
|
@@ -5379,7 +5382,7 @@ function sc(t) {
|
|
|
5379
5382
|
for (let o = 0; o < a.videos.length; o++) {
|
|
5380
5383
|
if (l.signal.aborted) return;
|
|
5381
5384
|
if (o === n) continue;
|
|
5382
|
-
const c = a.videos[o], { mediaUrl: u, indexUrl:
|
|
5385
|
+
const c = a.videos[o], { mediaUrl: u, indexUrl: h } = Xn(c.mediaId), f = 3e3, y = async () => {
|
|
5383
5386
|
for (; !l.signal.aborted && (t.current?.getPendingCount() ?? 0) !== 0; )
|
|
5384
5387
|
try {
|
|
5385
5388
|
await Dn(2e3, l.signal);
|
|
@@ -5388,16 +5391,16 @@ function sc(t) {
|
|
|
5388
5391
|
}
|
|
5389
5392
|
if (l.signal.aborted) return !1;
|
|
5390
5393
|
try {
|
|
5391
|
-
await Dn(
|
|
5394
|
+
await Dn(f, l.signal);
|
|
5392
5395
|
} catch {
|
|
5393
5396
|
return !1;
|
|
5394
5397
|
}
|
|
5395
5398
|
return !l.signal.aborted;
|
|
5396
5399
|
};
|
|
5397
|
-
if (!await
|
|
5400
|
+
if (!await y()) return;
|
|
5398
5401
|
let g;
|
|
5399
5402
|
try {
|
|
5400
|
-
const m = await fetch(
|
|
5403
|
+
const m = await fetch(h, { signal: l.signal });
|
|
5401
5404
|
if (!m.ok) {
|
|
5402
5405
|
C("prebuffer", `index.json fetch failed for ${c.mediaId}: HTTP ${m.status}`);
|
|
5403
5406
|
continue;
|
|
@@ -5408,19 +5411,19 @@ function sc(t) {
|
|
|
5408
5411
|
C("prebuffer", `index.json fetch error for ${c.mediaId}`, Y(m));
|
|
5409
5412
|
continue;
|
|
5410
5413
|
}
|
|
5411
|
-
const { fragments:
|
|
5412
|
-
if (!
|
|
5413
|
-
const w = tn(
|
|
5414
|
+
const { fragments: p, init_segment: v } = g;
|
|
5415
|
+
if (!p?.length) continue;
|
|
5416
|
+
const w = tn(p, 0), A = Ie(p, Ce), F = ve.getInit(c.mediaId) !== void 0, k = ve.getBufferedMs(c.mediaId, p) >= Ce;
|
|
5414
5417
|
if (F && k) {
|
|
5415
5418
|
E("prebuffer", `${c.mediaId} already fully pre-buffered, skipping`);
|
|
5416
5419
|
continue;
|
|
5417
5420
|
}
|
|
5418
|
-
if (E("prebuffer", `Pre-buffering ${c.mediaId} frags ${w}-${A}`), !F &&
|
|
5419
|
-
if (!await
|
|
5421
|
+
if (E("prebuffer", `Pre-buffering ${c.mediaId} frags ${w}-${A}`), !F && v) {
|
|
5422
|
+
if (!await y()) return;
|
|
5420
5423
|
try {
|
|
5421
5424
|
const m = await fetch(u, {
|
|
5422
5425
|
headers: {
|
|
5423
|
-
Range: `bytes=${
|
|
5426
|
+
Range: `bytes=${v.start_byte}-${v.end_byte}`,
|
|
5424
5427
|
"X-Buffer-Ahead-Ms": String(bn)
|
|
5425
5428
|
// background fetch — low priority
|
|
5426
5429
|
},
|
|
@@ -5438,8 +5441,8 @@ function sc(t) {
|
|
|
5438
5441
|
for (let m = w; m <= A; m++) {
|
|
5439
5442
|
if (l.signal.aborted) return;
|
|
5440
5443
|
if (ve.hasFragment(c.mediaId, m)) continue;
|
|
5441
|
-
if (!await
|
|
5442
|
-
const T =
|
|
5444
|
+
if (!await y()) return;
|
|
5445
|
+
const T = p[m];
|
|
5443
5446
|
try {
|
|
5444
5447
|
const R = await fetch(u, {
|
|
5445
5448
|
headers: {
|
|
@@ -5468,11 +5471,11 @@ function sc(t) {
|
|
|
5468
5471
|
}, [s, n, r, t]);
|
|
5469
5472
|
}
|
|
5470
5473
|
const Te = "bg-play";
|
|
5471
|
-
function
|
|
5474
|
+
function ic() {
|
|
5472
5475
|
const t = x.getState();
|
|
5473
5476
|
return !!t.snapshot.leaderId && t.snapshot.leaderId === t.me.clientId;
|
|
5474
5477
|
}
|
|
5475
|
-
function
|
|
5478
|
+
function oc(t) {
|
|
5476
5479
|
return typeof Image > "u" ? Promise.resolve(null) : t.reduce(
|
|
5477
5480
|
(e, n) => e.then((r) => r ?? new Promise((s) => {
|
|
5478
5481
|
const i = new Image();
|
|
@@ -5481,59 +5484,59 @@ function ic(t) {
|
|
|
5481
5484
|
Promise.resolve(null)
|
|
5482
5485
|
);
|
|
5483
5486
|
}
|
|
5484
|
-
function
|
|
5487
|
+
function cc(t, e, n, r, s, i) {
|
|
5485
5488
|
const a = P(!1), l = P(0), o = fe((u) => i(u)), c = fe((u) => {
|
|
5486
|
-
const
|
|
5487
|
-
if (!
|
|
5488
|
-
const
|
|
5489
|
-
roomPlaying:
|
|
5490
|
-
seekInFlight: !!
|
|
5491
|
-
elementPaused:
|
|
5489
|
+
const h = t.current, f = e.current;
|
|
5490
|
+
if (!h || !s) return;
|
|
5491
|
+
const y = x.getState(), g = h.currentTime * 1e3, p = uo(y.snapshot, y.snapshotReceivedAt, Date.now()), v = lo({
|
|
5492
|
+
roomPlaying: y.snapshot.playing,
|
|
5493
|
+
seekInFlight: !!f?.seekInFlight,
|
|
5494
|
+
elementPaused: h.paused,
|
|
5492
5495
|
elementMs: g,
|
|
5493
|
-
roomMs:
|
|
5496
|
+
roomMs: p,
|
|
5494
5497
|
durationMs: r,
|
|
5495
|
-
driftToleranceMs:
|
|
5496
|
-
}), w = Math.round(
|
|
5497
|
-
if (
|
|
5498
|
+
driftToleranceMs: co
|
|
5499
|
+
}), w = Math.round(p - g);
|
|
5500
|
+
if (v.kind === "none") {
|
|
5498
5501
|
E(Te, "resync not needed", { reason: u, driftMs: w });
|
|
5499
5502
|
return;
|
|
5500
5503
|
}
|
|
5501
|
-
|
|
5504
|
+
v.kind === "seek" ? C(Te, "BG-RESYNC seek", { reason: u, driftMs: w, elementMs: Math.round(g) }) : E(Te, "resync", { reason: u, plan: v.kind, driftMs: w }), v.kind === "resume" ? i(h) : f && f.submit({ targetMs: v.targetMs, priority: ht.SEEK_EFFECT, caller: `bg-resync:${u}` });
|
|
5502
5505
|
});
|
|
5503
5506
|
L(() => {
|
|
5504
5507
|
const u = t.current;
|
|
5505
5508
|
if (!u || !s) return;
|
|
5506
|
-
const
|
|
5507
|
-
const
|
|
5508
|
-
|
|
5509
|
+
const h = () => {
|
|
5510
|
+
const y = x.getState();
|
|
5511
|
+
io({
|
|
5509
5512
|
hidden: document.visibilityState === "hidden",
|
|
5510
|
-
roomPlaying:
|
|
5513
|
+
roomPlaying: y.snapshot.playing,
|
|
5511
5514
|
seekInFlight: !!e.current?.seekInFlight,
|
|
5512
5515
|
ended: u.ended,
|
|
5513
5516
|
localPause: a.current,
|
|
5514
5517
|
sinceUserPauseMs: l.current ? Date.now() - l.current : 1 / 0
|
|
5515
5518
|
}) && (E(Te, "keep-alive: browser paused a hidden video, resuming", { currentMs: Math.round(u.currentTime * 1e3) }), o(u));
|
|
5516
|
-
},
|
|
5519
|
+
}, f = () => {
|
|
5517
5520
|
document.visibilityState === "visible" && (a.current = !1, c("visible"));
|
|
5518
5521
|
};
|
|
5519
|
-
return u.addEventListener("pause",
|
|
5520
|
-
u.removeEventListener("pause",
|
|
5522
|
+
return u.addEventListener("pause", h), document.addEventListener("visibilitychange", f), () => {
|
|
5523
|
+
u.removeEventListener("pause", h), document.removeEventListener("visibilitychange", f);
|
|
5521
5524
|
};
|
|
5522
5525
|
}, [s, t, e]), L(() => {
|
|
5523
5526
|
const u = t.current;
|
|
5524
5527
|
if (!u || typeof navigator > "u" || !("mediaSession" in navigator)) return;
|
|
5525
|
-
const
|
|
5526
|
-
let
|
|
5527
|
-
const
|
|
5528
|
-
|
|
5529
|
-
title:
|
|
5528
|
+
const h = navigator.mediaSession;
|
|
5529
|
+
let f = !1;
|
|
5530
|
+
const y = Cr(n), g = (k) => {
|
|
5531
|
+
f || typeof MediaMetadata > "u" || (h.metadata = new MediaMetadata({
|
|
5532
|
+
title: y,
|
|
5530
5533
|
artist: "Watch Party",
|
|
5531
5534
|
artwork: k ? [{ src: k }] : []
|
|
5532
5535
|
}));
|
|
5533
5536
|
};
|
|
5534
|
-
g(null),
|
|
5535
|
-
const
|
|
5536
|
-
const m = x.getState(), T =
|
|
5537
|
+
g(null), oc(fo(n).map(Os)).then(g);
|
|
5538
|
+
const p = (k) => () => {
|
|
5539
|
+
const m = x.getState(), T = oo(k, { isLeader: ic(), roomPlaying: m.snapshot.playing });
|
|
5537
5540
|
switch (E(Te, "media session press", { action: k, result: T.kind }), k === "pause" && (l.current = Date.now()), T.kind) {
|
|
5538
5541
|
case "control":
|
|
5539
5542
|
Pe(T.control), T.control === "pause" && u.pause();
|
|
@@ -5545,96 +5548,96 @@ function oc(t, e, n, r, s, i) {
|
|
|
5545
5548
|
a.current = !1, c("media-session");
|
|
5546
5549
|
break;
|
|
5547
5550
|
}
|
|
5548
|
-
},
|
|
5549
|
-
["play",
|
|
5550
|
-
["pause",
|
|
5551
|
+
}, v = [
|
|
5552
|
+
["play", p("play")],
|
|
5553
|
+
["pause", p("pause")],
|
|
5551
5554
|
// Seeking from the lock screen is not a room control; show no seek buttons.
|
|
5552
5555
|
["seekbackward", null],
|
|
5553
5556
|
["seekforward", null],
|
|
5554
5557
|
["seekto", null]
|
|
5555
5558
|
];
|
|
5556
|
-
for (const [k, m] of
|
|
5559
|
+
for (const [k, m] of v)
|
|
5557
5560
|
try {
|
|
5558
|
-
|
|
5561
|
+
h.setActionHandler(k, m);
|
|
5559
5562
|
} catch (T) {
|
|
5560
5563
|
E(Te, "media session action unsupported", { action: k, ...Y(T) });
|
|
5561
5564
|
}
|
|
5562
5565
|
const w = () => {
|
|
5563
5566
|
const k = r / 1e3;
|
|
5564
|
-
if (!(!(k > 0) || typeof
|
|
5567
|
+
if (!(!(k > 0) || typeof h.setPositionState != "function"))
|
|
5565
5568
|
try {
|
|
5566
|
-
|
|
5569
|
+
h.setPositionState({ duration: k, position: Math.min(Math.max(u.currentTime, 0), k), playbackRate: u.playbackRate || 1 });
|
|
5567
5570
|
} catch (m) {
|
|
5568
5571
|
C(Te, "setPositionState rejected", Y(m));
|
|
5569
5572
|
}
|
|
5570
5573
|
}, A = () => {
|
|
5571
|
-
|
|
5574
|
+
h.playbackState = "playing", w();
|
|
5572
5575
|
}, F = () => {
|
|
5573
|
-
|
|
5576
|
+
h.playbackState = "paused", w();
|
|
5574
5577
|
};
|
|
5575
5578
|
return u.addEventListener("play", A), u.addEventListener("pause", F), u.addEventListener("seeked", w), u.addEventListener("ratechange", w), w(), () => {
|
|
5576
|
-
|
|
5577
|
-
for (const [k] of
|
|
5579
|
+
f = !0, u.removeEventListener("play", A), u.removeEventListener("pause", F), u.removeEventListener("seeked", w), u.removeEventListener("ratechange", w);
|
|
5580
|
+
for (const [k] of v)
|
|
5578
5581
|
try {
|
|
5579
|
-
|
|
5582
|
+
h.setActionHandler(k, null);
|
|
5580
5583
|
} catch {
|
|
5581
5584
|
}
|
|
5582
|
-
|
|
5585
|
+
h.metadata = null, h.playbackState = "none";
|
|
5583
5586
|
};
|
|
5584
5587
|
}, [n, r, t]), L(() => {
|
|
5585
5588
|
const u = t.current;
|
|
5586
5589
|
if (!u || typeof navigator > "u" || !("wakeLock" in navigator)) return;
|
|
5587
|
-
let
|
|
5590
|
+
let h = null, f = !1, y = !1;
|
|
5588
5591
|
const g = () => {
|
|
5589
|
-
const
|
|
5590
|
-
|
|
5591
|
-
},
|
|
5592
|
-
if (!(!
|
|
5592
|
+
const v = h;
|
|
5593
|
+
h = null, v && v.release().catch((w) => E(Te, "wake lock release failed", Y(w)));
|
|
5594
|
+
}, p = () => {
|
|
5595
|
+
if (!(!y && !u.paused && !u.ended && document.visibilityState === "visible")) {
|
|
5593
5596
|
g();
|
|
5594
5597
|
return;
|
|
5595
5598
|
}
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
}), (
|
|
5599
|
+
h || f || (f = !0, navigator.wakeLock.request("screen").then((w) => {
|
|
5600
|
+
f = !1, h = w, w.addEventListener("release", () => {
|
|
5601
|
+
h === w && (h = null);
|
|
5602
|
+
}), (y || u.paused || document.visibilityState !== "visible") && g();
|
|
5600
5603
|
}).catch((w) => {
|
|
5601
|
-
|
|
5604
|
+
f = !1, E(Te, "wake lock refused", Y(w));
|
|
5602
5605
|
}));
|
|
5603
5606
|
};
|
|
5604
|
-
return u.addEventListener("play",
|
|
5605
|
-
|
|
5607
|
+
return u.addEventListener("play", p), u.addEventListener("pause", p), u.addEventListener("ended", p), document.addEventListener("visibilitychange", p), p(), () => {
|
|
5608
|
+
y = !0, u.removeEventListener("play", p), u.removeEventListener("pause", p), u.removeEventListener("ended", p), document.removeEventListener("visibilitychange", p), g();
|
|
5606
5609
|
};
|
|
5607
5610
|
}, [t]);
|
|
5608
5611
|
}
|
|
5609
|
-
const
|
|
5610
|
-
function
|
|
5612
|
+
const lc = 3e5, dc = 1, uc = 1;
|
|
5613
|
+
function Gt(t) {
|
|
5611
5614
|
ee("buffer", "initializePlayback threw", Y(t));
|
|
5612
5615
|
}
|
|
5613
|
-
function
|
|
5614
|
-
const r = P(null), [s, i] = $(!1), [a, l] = $(!1), { controlsVisible: o, showControls: c, hideControls: u, setControlsHeld:
|
|
5616
|
+
function fc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
5617
|
+
const r = P(null), [s, i] = $(!1), [a, l] = $(!1), { controlsVisible: o, showControls: c, hideControls: u, setControlsHeld: h } = zo();
|
|
5615
5618
|
L(() => {
|
|
5616
5619
|
const M = () => l(!!document.fullscreenElement);
|
|
5617
5620
|
return document.addEventListener("fullscreenchange", M), () => document.removeEventListener("fullscreenchange", M);
|
|
5618
5621
|
}, []);
|
|
5619
5622
|
const {
|
|
5620
|
-
fragments:
|
|
5621
|
-
durationMs:
|
|
5623
|
+
fragments: f,
|
|
5624
|
+
durationMs: y,
|
|
5622
5625
|
mseCodec: g,
|
|
5623
|
-
initSegment:
|
|
5624
|
-
audioTracks:
|
|
5626
|
+
initSegment: p,
|
|
5627
|
+
audioTracks: v,
|
|
5625
5628
|
contentToken: w
|
|
5626
|
-
} =
|
|
5629
|
+
} = qo(e), A = U((M) => {
|
|
5627
5630
|
if (!w) return null;
|
|
5628
5631
|
const D = t.replace(new RegExp(`/${gt.replace(/\./g, "\\.")}$`), "");
|
|
5629
5632
|
return D === t ? null : { baseUrl: D, token: w, trackId: M };
|
|
5630
|
-
}, [w, t]), k = g !== null &&
|
|
5633
|
+
}, [w, t]), k = g !== null && v.length > 0, m = x((M) => M.readiness), T = P(!1), R = P(!1), b = P(null), S = P(null), I = P(null), B = P(0), H = P(0), j = P(null), [K, X] = $(0), N = P([]), O = P([]), Q = P(-1), W = P(!1), re = P(null), le = P(0), Re = P(null), Ke = P(0), kt = x((M) => M.bufferState), De = x((M) => M.setBufferState), {
|
|
5631
5634
|
audioTracks: ye,
|
|
5632
5635
|
subtitleTracks: Be,
|
|
5633
5636
|
selectedAudioIndex: we,
|
|
5634
5637
|
setSelectedAudioIndex: rt,
|
|
5635
5638
|
selectedSubtitleIndex: z,
|
|
5636
5639
|
setSelectedSubtitleIndex: he
|
|
5637
|
-
} =
|
|
5640
|
+
} = Yo(n), Me = x((M) => M.mediaPrefs), _t = x((M) => M.mutedForAutoplay), Dr = x((M) => M.setMutedForAutoplay), rn = x((M) => M.setSubtitlesEnabled), Br = x((M) => M.setSubtitleStyle), At = x((M) => M.setPreferredAudioLang), Or = Me.subtitlesEnabled, sn = Me.subtitleStyle, Hr = ye[we]?.lang, Ur = Be.some((M) => M.lang === "eng"), [jr, an] = $(null), st = Do({
|
|
5638
5641
|
override: jr,
|
|
5639
5642
|
globalEnabled: Or,
|
|
5640
5643
|
selectedAudioLang: Hr,
|
|
@@ -5664,8 +5667,8 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5664
5667
|
const at = U((M) => {
|
|
5665
5668
|
De({ isBuffering: M });
|
|
5666
5669
|
}, [De]), ln = U((M) => {
|
|
5667
|
-
if (H.current >=
|
|
5668
|
-
|
|
5670
|
+
if (H.current >= uc) {
|
|
5671
|
+
Jt("phantom-recreate-exhausted", { reason: M, recreates: H.current, mediaId: n });
|
|
5669
5672
|
return;
|
|
5670
5673
|
}
|
|
5671
5674
|
H.current += 1, B.current = 0, C("buffer", "MSE-RECREATE — rebuilding MediaSource to clear corrupt buffer", {
|
|
@@ -5673,9 +5676,9 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5673
5676
|
attempt: H.current
|
|
5674
5677
|
}), X((D) => D + 1);
|
|
5675
5678
|
}, [n]);
|
|
5676
|
-
async function
|
|
5679
|
+
async function Tt() {
|
|
5677
5680
|
const M = I.current, D = r.current;
|
|
5678
|
-
if (!M || !
|
|
5681
|
+
if (!M || !f.length || R.current) return;
|
|
5679
5682
|
const pe = x.getState().snapshot, V = pe.playheadMs || 0;
|
|
5680
5683
|
E("buffer", "Initializing playback", { mediaId: n, startMs: V, playing: pe.playing }), M.setPlayhead(V);
|
|
5681
5684
|
const de = performance.now();
|
|
@@ -5698,7 +5701,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5698
5701
|
aheadMs: Math.round(M.getBufferedAheadMs(V)),
|
|
5699
5702
|
targetMs: Ce
|
|
5700
5703
|
}), M.isDisposed) return;
|
|
5701
|
-
if (M.getBufferedAheadMs(V) >
|
|
5704
|
+
if (M.getBufferedAheadMs(V) > lc && M.getLoadedCount() === 0) {
|
|
5702
5705
|
M.dumpBufferDiagnostics(V, "phantom-detected"), C("buffer", "PHANTOM-BUFFER detected at gate — recreating MediaSource", {
|
|
5703
5706
|
gateAheadMs: Math.round(M.getBufferedAheadMs(V)),
|
|
5704
5707
|
loaded: M.getLoadedCount(),
|
|
@@ -5724,7 +5727,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5724
5727
|
}
|
|
5725
5728
|
D.currentTime = q / 1e3, await Lr(D, 3e3);
|
|
5726
5729
|
}
|
|
5727
|
-
le.current = q, i(!0), R.current = !0, B.current = 0, Ln() && C("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: n }),
|
|
5730
|
+
le.current = q, i(!0), R.current = !0, B.current = 0, Ln() && C("buffer", "RECOVERY-SUCCESS — playback initialized after an auto-reload", { mediaId: n }), Oo(), E("buffer", "initializePlayback complete", {
|
|
5728
5731
|
mediaId: n,
|
|
5729
5732
|
startMs: V,
|
|
5730
5733
|
seekMs: q,
|
|
@@ -5789,7 +5792,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5789
5792
|
return;
|
|
5790
5793
|
}
|
|
5791
5794
|
const ne = te.includes("SourceBuffer is full"), J = te.includes("init segment failed");
|
|
5792
|
-
B.current += 1, ne || J || B.current >
|
|
5795
|
+
B.current += 1, ne || J || B.current > dc ? (ee("buffer", "Initialize playback failed — recreating MediaSource", {
|
|
5793
5796
|
error: te,
|
|
5794
5797
|
mediaId: n,
|
|
5795
5798
|
attempt: B.current,
|
|
@@ -5800,7 +5803,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5800
5803
|
mediaId: n,
|
|
5801
5804
|
attempt: B.current
|
|
5802
5805
|
}), setTimeout(() => {
|
|
5803
|
-
I.current && !M.isDisposed && !R.current && (E("buffer", "Retrying initializePlayback"),
|
|
5806
|
+
I.current && !M.isDisposed && !R.current && (E("buffer", "Retrying initializePlayback"), Tt().catch(Gt));
|
|
5804
5807
|
}, 3e3));
|
|
5805
5808
|
}
|
|
5806
5809
|
}
|
|
@@ -5808,10 +5811,10 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5808
5811
|
const zr = fe(() => ({
|
|
5809
5812
|
useMseAudio: k,
|
|
5810
5813
|
selectedAudioIndex: we,
|
|
5811
|
-
mseAudioTracks:
|
|
5812
|
-
fragments:
|
|
5814
|
+
mseAudioTracks: v,
|
|
5815
|
+
fragments: f,
|
|
5813
5816
|
deliveryFor: A,
|
|
5814
|
-
initializePlayback:
|
|
5817
|
+
initializePlayback: Tt
|
|
5815
5818
|
}));
|
|
5816
5819
|
L(() => {
|
|
5817
5820
|
if (!g) return;
|
|
@@ -5837,12 +5840,12 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5837
5840
|
I.current = xe;
|
|
5838
5841
|
const Oe = ++Ke.current;
|
|
5839
5842
|
window.__FRAGMENT_MANAGER__ = xe, window.__AUDIO_FRAGMENT_MANAGERS__ = N.current;
|
|
5840
|
-
const ke = new
|
|
5843
|
+
const ke = new jo({
|
|
5841
5844
|
videoRef: r,
|
|
5842
5845
|
fragmentManagerRef: I,
|
|
5843
5846
|
audioFragmentManagersRef: N
|
|
5844
5847
|
});
|
|
5845
|
-
re.current = ke, window.__SEEK_COORDINATOR__ = ke,
|
|
5848
|
+
re.current = ke, window.__SEEK_COORDINATOR__ = ke, Go();
|
|
5846
5849
|
const q = r.current, He = () => {
|
|
5847
5850
|
const G = q?.error;
|
|
5848
5851
|
G && (ee("video", `Media error code=${G.code}: ${G.message}`, {
|
|
@@ -5888,7 +5891,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5888
5891
|
Ue && (Ue.muted = !1);
|
|
5889
5892
|
}
|
|
5890
5893
|
if (V.length) {
|
|
5891
|
-
if (xe.setIndex(V, t,
|
|
5894
|
+
if (xe.setIndex(V, t, p, n, de()), xe.epoch = Oe, M) {
|
|
5892
5895
|
const ae = Q.current, ue = N.current[0], me = ae >= 0 ? pe[ae] : void 0;
|
|
5893
5896
|
if (ue && me) {
|
|
5894
5897
|
const Ue = `${ce}/${me.path}`.replace(/\\/g, "/");
|
|
@@ -5901,14 +5904,14 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5901
5904
|
), ue.epoch = Oe;
|
|
5902
5905
|
}
|
|
5903
5906
|
}
|
|
5904
|
-
ie().catch(
|
|
5907
|
+
ie().catch(Gt);
|
|
5905
5908
|
}
|
|
5906
5909
|
} catch (G) {
|
|
5907
5910
|
C("buffer", "MSE source error", { error: G?.message });
|
|
5908
5911
|
}
|
|
5909
5912
|
};
|
|
5910
5913
|
return q && (J.addEventListener("sourceopen", _e), ne = URL.createObjectURL(J), q.src = ne, q.addEventListener("error", He)), () => {
|
|
5911
|
-
q?.pause(), q && q.removeEventListener("error", He), J.removeEventListener("sourceopen", _e),
|
|
5914
|
+
q?.pause(), q && q.removeEventListener("error", He), J.removeEventListener("sourceopen", _e), Wo(), ke.dispose(), re.current = null, xe.dispose(), I.current = null, window.__FRAGMENT_MANAGER__ = null, window.__AUDIO_FRAGMENT_MANAGERS__ = null;
|
|
5912
5915
|
for (const G of N.current) G.dispose();
|
|
5913
5916
|
if (N.current = [], J.readyState === "open") {
|
|
5914
5917
|
for (const G of [b.current, ...O.current])
|
|
@@ -5925,13 +5928,13 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5925
5928
|
}
|
|
5926
5929
|
Re.current?.(), R.current = !1, T.current = !1, b.current = null, i(!1);
|
|
5927
5930
|
};
|
|
5928
|
-
}, [t, n, g,
|
|
5931
|
+
}, [t, n, g, p, at, K]);
|
|
5929
5932
|
const Jr = fe(() => {
|
|
5930
5933
|
const M = I.current, D = Ke.current;
|
|
5931
|
-
if (S.current?.readyState === "open" && b.current &&
|
|
5934
|
+
if (S.current?.readyState === "open" && b.current && f.length && M) {
|
|
5932
5935
|
if (M.hasIndex && M.epoch === D) return;
|
|
5933
|
-
if (M.setIndex(
|
|
5934
|
-
const pe = t.replace(new RegExp(`/${gt.replace(/\./g, "\\.")}$`), ""), V = Q.current, de = N.current[0], ie = V >= 0 ?
|
|
5936
|
+
if (M.setIndex(f, t, p, n, A()), M.epoch = D, k) {
|
|
5937
|
+
const pe = t.replace(new RegExp(`/${gt.replace(/\./g, "\\.")}$`), ""), V = Q.current, de = N.current[0], ie = V >= 0 ? v[V] : void 0;
|
|
5935
5938
|
if (de && ie && !(de.hasIndex && de.epoch === D)) {
|
|
5936
5939
|
const te = `${pe}/${ie.path}`.replace(/\\/g, "/");
|
|
5937
5940
|
de.setIndex(
|
|
@@ -5943,12 +5946,12 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5943
5946
|
), de.epoch = D;
|
|
5944
5947
|
}
|
|
5945
5948
|
}
|
|
5946
|
-
R.current ||
|
|
5949
|
+
R.current || Tt().catch(Gt);
|
|
5947
5950
|
}
|
|
5948
5951
|
});
|
|
5949
5952
|
L(() => {
|
|
5950
5953
|
Jr();
|
|
5951
|
-
}, [
|
|
5954
|
+
}, [f, t, p, v]), L(() => {
|
|
5952
5955
|
const M = () => {
|
|
5953
5956
|
I.current?.abortStaleJobs("socket-reconnect");
|
|
5954
5957
|
for (const D of N.current) D.abortStaleJobs("socket-reconnect");
|
|
@@ -5957,11 +5960,11 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5957
5960
|
}, []), L(() => (window.__AUDIO_SELECT__ = (M) => {
|
|
5958
5961
|
rt(M);
|
|
5959
5962
|
const D = ye[M];
|
|
5960
|
-
D?.lang &&
|
|
5963
|
+
D?.lang && At(D.lang);
|
|
5961
5964
|
}, () => {
|
|
5962
5965
|
window.__AUDIO_SELECT__ = null;
|
|
5963
|
-
}), [ye, rt,
|
|
5964
|
-
if (!k || !s || we < 0 || we >=
|
|
5966
|
+
}), [ye, rt, At]), L(() => {
|
|
5967
|
+
if (!k || !s || we < 0 || we >= v.length || we === Q.current) return;
|
|
5965
5968
|
if (W.current) {
|
|
5966
5969
|
E("audio", "MSE audio swap requested while another in flight — deferring");
|
|
5967
5970
|
return;
|
|
@@ -5973,7 +5976,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
5973
5976
|
}
|
|
5974
5977
|
const D = r.current;
|
|
5975
5978
|
if (!D) return;
|
|
5976
|
-
const pe = we, V =
|
|
5979
|
+
const pe = we, V = v[pe], de = Ke.current;
|
|
5977
5980
|
W.current = !0;
|
|
5978
5981
|
const ie = Math.round(D.currentTime * 1e3);
|
|
5979
5982
|
E("audio", `MSE audio swap START idx=${Q.current}→${pe} lang=${V.lang} playheadMs=${ie}`), (async () => {
|
|
@@ -6025,9 +6028,9 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6025
6028
|
W.current = !1;
|
|
6026
6029
|
}
|
|
6027
6030
|
})().catch((te) => ee("audio", "MSE audio swap failed", Y(te)));
|
|
6028
|
-
}, [k, s, we,
|
|
6029
|
-
const { stopPrefetch: dn } =
|
|
6030
|
-
|
|
6031
|
+
}, [k, s, we, v, n, t, at, A]), sc(re, r, le, s, mt, on), tc(r, I, re, s, on, N), cc(r, re, n, y ?? 0, s, mt);
|
|
6032
|
+
const { stopPrefetch: dn } = rc(r, I, re, s, De, N);
|
|
6033
|
+
ac(I), L(() => {
|
|
6031
6034
|
Re.current = dn;
|
|
6032
6035
|
}, [dn]);
|
|
6033
6036
|
const Qr = U(() => {
|
|
@@ -6055,7 +6058,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6055
6058
|
}
|
|
6056
6059
|
),
|
|
6057
6060
|
/* @__PURE__ */ d(
|
|
6058
|
-
|
|
6061
|
+
ko,
|
|
6059
6062
|
{
|
|
6060
6063
|
subtitleUrl: Yr,
|
|
6061
6064
|
videoRef: r,
|
|
@@ -6063,13 +6066,13 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6063
6066
|
enabled: st
|
|
6064
6067
|
}
|
|
6065
6068
|
),
|
|
6066
|
-
/* @__PURE__ */ d(
|
|
6069
|
+
/* @__PURE__ */ d(ho, { mediaId: n, visible: o }),
|
|
6067
6070
|
/* @__PURE__ */ d(
|
|
6068
|
-
|
|
6071
|
+
so,
|
|
6069
6072
|
{
|
|
6070
6073
|
videoRef: r,
|
|
6071
6074
|
mediaId: n,
|
|
6072
|
-
durationMs:
|
|
6075
|
+
durationMs: y || void 0,
|
|
6073
6076
|
visible: o,
|
|
6074
6077
|
displayPlayheadMs: Wr,
|
|
6075
6078
|
audioTracks: ye,
|
|
@@ -6077,7 +6080,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6077
6080
|
onAudioSelect: (M) => {
|
|
6078
6081
|
rt(M);
|
|
6079
6082
|
const D = ye[M];
|
|
6080
|
-
D?.lang &&
|
|
6083
|
+
D?.lang && At(D.lang);
|
|
6081
6084
|
},
|
|
6082
6085
|
subtitleTracks: Be,
|
|
6083
6086
|
selectedSubtitleIndex: z,
|
|
@@ -6087,10 +6090,10 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6087
6090
|
subtitleStyle: sn,
|
|
6088
6091
|
onSubtitleStyleChange: Br,
|
|
6089
6092
|
onChatActivity: () => c(5e3),
|
|
6090
|
-
onMenuHeld:
|
|
6093
|
+
onMenuHeld: h
|
|
6091
6094
|
}
|
|
6092
6095
|
),
|
|
6093
|
-
|
|
6096
|
+
_t && /* @__PURE__ */ _(
|
|
6094
6097
|
"button",
|
|
6095
6098
|
{
|
|
6096
6099
|
type: "button",
|
|
@@ -6105,7 +6108,7 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6105
6108
|
]
|
|
6106
6109
|
}
|
|
6107
6110
|
),
|
|
6108
|
-
|
|
6111
|
+
kt.isBuffering && m.ready && /* @__PURE__ */ d("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ _("div", { className: "flex flex-col items-center gap-2", children: [
|
|
6109
6112
|
/* @__PURE__ */ d("div", { className: "w-8 h-8 border-2 border-text border-t-transparent rounded-full animate-spin" }),
|
|
6110
6113
|
/* @__PURE__ */ d("div", { className: "px-4 py-2 rounded bg-wp-surface-2/80 text-xs font-medium", children: "Buffering…" })
|
|
6111
6114
|
] }) })
|
|
@@ -6113,14 +6116,14 @@ function uc({ mediaUrl: t, indexUrl: e, mediaId: n }) {
|
|
|
6113
6116
|
}
|
|
6114
6117
|
);
|
|
6115
6118
|
}
|
|
6116
|
-
function
|
|
6119
|
+
function hc() {
|
|
6117
6120
|
const t = x((n) => n.snapshot.mediaId), e = Ee(() => t ? { mediaId: t, ...Xn(t) } : null, [t]);
|
|
6118
|
-
return e ? /* @__PURE__ */ d(sr, { children: /* @__PURE__ */ d(
|
|
6121
|
+
return e ? /* @__PURE__ */ d(sr, { children: /* @__PURE__ */ d(fc, { mediaUrl: e.mediaUrl, indexUrl: e.indexUrl, mediaId: e.mediaId }) }) : /* @__PURE__ */ d(Ws, {});
|
|
6119
6122
|
}
|
|
6120
|
-
const
|
|
6123
|
+
const pc = (t) => {
|
|
6121
6124
|
const e = ea(t);
|
|
6122
6125
|
return e.render(
|
|
6123
|
-
/* @__PURE__ */ d(js.Provider, { value: Gs(), children: /* @__PURE__ */ d(
|
|
6126
|
+
/* @__PURE__ */ d(js.Provider, { value: Gs(), children: /* @__PURE__ */ d(hc, {}) })
|
|
6124
6127
|
), {
|
|
6125
6128
|
update() {
|
|
6126
6129
|
},
|
|
@@ -6131,28 +6134,28 @@ const hc = (t) => {
|
|
|
6131
6134
|
queueMicrotask(() => e.unmount());
|
|
6132
6135
|
}
|
|
6133
6136
|
};
|
|
6134
|
-
},
|
|
6137
|
+
}, mc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6135
6138
|
__proto__: null,
|
|
6136
|
-
mount:
|
|
6137
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
6139
|
+
mount: pc
|
|
6140
|
+
}, Symbol.toStringTag, { value: "Module" })), gc = {
|
|
6138
6141
|
id: "player",
|
|
6139
6142
|
name: "Media player",
|
|
6140
|
-
load: () => Promise.resolve(
|
|
6141
|
-
},
|
|
6142
|
-
function
|
|
6143
|
-
const t = x((u) => u.snapshot), e = x((u) => u.ensureAutoIdentity), n =
|
|
6144
|
-
() => n ?
|
|
6143
|
+
load: () => Promise.resolve(mc)
|
|
6144
|
+
}, bc = qt(() => import("./MediaDrawer-CF4FGXOt.js"));
|
|
6145
|
+
function yc() {
|
|
6146
|
+
const t = x((u) => u.snapshot), e = x((u) => u.ensureAutoIdentity), n = Mt(), r = Ee(
|
|
6147
|
+
() => n ? ni(n, window.location.origin) : null,
|
|
6145
6148
|
[n]
|
|
6146
6149
|
), s = Vs(), i = P(!1), [a, l] = $(!1), o = s.roomKey || null;
|
|
6147
|
-
|
|
6148
|
-
o &&
|
|
6150
|
+
Oi(), L(() => Hi(), []), L(() => {
|
|
6151
|
+
o && Wi(o);
|
|
6149
6152
|
}, [o]), L(() => {
|
|
6150
6153
|
const u = () => l(!0);
|
|
6151
|
-
return window.addEventListener(
|
|
6154
|
+
return window.addEventListener(Vt, u), () => window.removeEventListener(Vt, u);
|
|
6152
6155
|
}, []), L(() => {
|
|
6153
6156
|
if (!o || i.current) return;
|
|
6154
6157
|
let u = !1;
|
|
6155
|
-
const
|
|
6158
|
+
const h = 1500;
|
|
6156
6159
|
return (async () => {
|
|
6157
6160
|
try {
|
|
6158
6161
|
await Promise.race([
|
|
@@ -6161,19 +6164,19 @@ function bc() {
|
|
|
6161
6164
|
zs(),
|
|
6162
6165
|
Js().then(Qn)
|
|
6163
6166
|
]),
|
|
6164
|
-
new Promise((g) => setTimeout(g,
|
|
6167
|
+
new Promise((g) => setTimeout(g, h))
|
|
6165
6168
|
]);
|
|
6166
6169
|
} catch (g) {
|
|
6167
6170
|
C("room", "pre-join wait threw, proceeding anyway", { err: g?.message });
|
|
6168
6171
|
}
|
|
6169
6172
|
if (u) return;
|
|
6170
|
-
const
|
|
6171
|
-
E("room", "Joining room", { roomKey: o, name:
|
|
6172
|
-
const
|
|
6173
|
+
const f = x.getState();
|
|
6174
|
+
E("room", "Joining room", { roomKey: o, name: f.name, sprite: f.sprite }), e();
|
|
6175
|
+
const y = x.getState();
|
|
6173
6176
|
Qs({
|
|
6174
6177
|
room_key: o,
|
|
6175
|
-
name:
|
|
6176
|
-
sprite:
|
|
6178
|
+
name: y.name || void 0,
|
|
6179
|
+
sprite: y.sprite || void 0
|
|
6177
6180
|
}), i.current = !0;
|
|
6178
6181
|
})(), () => {
|
|
6179
6182
|
u = !0;
|
|
@@ -6184,37 +6187,37 @@ function bc() {
|
|
|
6184
6187
|
}
|
|
6185
6188
|
return o ? /* @__PURE__ */ _("div", { className: "relative flex-1 flex overflow-hidden min-h-0", children: [
|
|
6186
6189
|
/* @__PURE__ */ _("div", { className: "flex-1 relative bg-black overflow-hidden min-w-0", children: [
|
|
6187
|
-
/* @__PURE__ */ d(Sn, { activity:
|
|
6190
|
+
/* @__PURE__ */ d(Sn, { activity: gc, roomKey: t.roomId ?? "", layer: "base" }),
|
|
6188
6191
|
r && t.roomId && /* @__PURE__ */ d(sr, { children: /* @__PURE__ */ d(Sn, { activity: r, roomKey: t.roomId, layer: "overlay" }, r.id) }),
|
|
6189
|
-
/* @__PURE__ */ _(
|
|
6190
|
-
/* @__PURE__ */ d(
|
|
6191
|
-
/* @__PURE__ */ d(
|
|
6192
|
-
/* @__PURE__ */ d(
|
|
6193
|
-
/* @__PURE__ */ d(
|
|
6192
|
+
/* @__PURE__ */ _(xi, { children: [
|
|
6193
|
+
/* @__PURE__ */ d(li, {}),
|
|
6194
|
+
/* @__PURE__ */ d(yi, {}),
|
|
6195
|
+
/* @__PURE__ */ d(Bi, {}),
|
|
6196
|
+
/* @__PURE__ */ d(wi, {})
|
|
6194
6197
|
] })
|
|
6195
6198
|
] }),
|
|
6196
|
-
/* @__PURE__ */ d(
|
|
6197
|
-
/* @__PURE__ */ d(Ve.Suspense, { fallback: /* @__PURE__ */ d(
|
|
6199
|
+
/* @__PURE__ */ d(Za, {}),
|
|
6200
|
+
/* @__PURE__ */ d(Ve.Suspense, { fallback: /* @__PURE__ */ d(ii, { open: a, onClose: c }), children: /* @__PURE__ */ d(bc, { open: a, onClose: c }) })
|
|
6198
6201
|
] }) : (C("room", "No room key provided"), /* @__PURE__ */ d("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ _("div", { className: "text-text-secondary", children: [
|
|
6199
6202
|
"No room key provided. Go to the ",
|
|
6200
6203
|
/* @__PURE__ */ d("a", { href: "/", className: "underline", children: "home page" }),
|
|
6201
6204
|
" to select a room."
|
|
6202
6205
|
] }) }));
|
|
6203
6206
|
}
|
|
6204
|
-
const
|
|
6207
|
+
const Cc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6205
6208
|
__proto__: null,
|
|
6206
|
-
default:
|
|
6209
|
+
default: yc
|
|
6207
6210
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6208
6211
|
export {
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6212
|
+
Ac as B,
|
|
6213
|
+
ai as D,
|
|
6214
|
+
Cc as R,
|
|
6215
|
+
Tc as S,
|
|
6216
|
+
si as a,
|
|
6217
|
+
Vi as b,
|
|
6218
|
+
_c as c,
|
|
6216
6219
|
nt as d,
|
|
6217
|
-
|
|
6220
|
+
Ic as s,
|
|
6218
6221
|
en as u
|
|
6219
6222
|
};
|
|
6220
|
-
//# sourceMappingURL=Room-
|
|
6223
|
+
//# sourceMappingURL=Room-DESl744M.js.map
|