@moq/ui-core 0.1.0
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/README.md +38 -0
- package/button/button.d.ts +37 -0
- package/button/button.d.ts.map +1 -0
- package/icon/icon.d.ts +28 -0
- package/icon/icon.d.ts.map +1 -0
- package/index.d.ts +5 -0
- package/index.d.ts.map +1 -0
- package/index.js +910 -0
- package/index.js.map +1 -0
- package/package.json +17 -0
- package/stats/components/StatsItem.d.ts +18 -0
- package/stats/components/StatsItem.d.ts.map +1 -0
- package/stats/components/StatsPanel.d.ts +18 -0
- package/stats/components/StatsPanel.d.ts.map +1 -0
- package/stats/index.d.ts +13 -0
- package/stats/index.d.ts.map +1 -0
- package/stats/providers/audio.d.ts +30 -0
- package/stats/providers/audio.d.ts.map +1 -0
- package/stats/providers/base.d.ts +26 -0
- package/stats/providers/base.d.ts.map +1 -0
- package/stats/providers/buffer.d.ts +12 -0
- package/stats/providers/buffer.d.ts.map +1 -0
- package/stats/providers/index.d.ts +10 -0
- package/stats/providers/index.d.ts.map +1 -0
- package/stats/providers/network.d.ts +49 -0
- package/stats/providers/network.d.ts.map +1 -0
- package/stats/providers/registry.d.ts +17 -0
- package/stats/providers/registry.d.ts.map +1 -0
- package/stats/providers/video.d.ts +33 -0
- package/stats/providers/video.d.ts.map +1 -0
- package/stats/types.d.ts +53 -0
- package/stats/types.d.ts.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
import { Effect as kt } from "@moq/signals";
|
|
2
|
+
const yt = !1, xt = (t, e) => t === e, mt = /* @__PURE__ */ Symbol("solid-track"), O = {
|
|
3
|
+
equals: xt
|
|
4
|
+
};
|
|
5
|
+
let nt = at;
|
|
6
|
+
const b = 1, R = 2, st = {
|
|
7
|
+
owned: null,
|
|
8
|
+
cleanups: null,
|
|
9
|
+
context: null,
|
|
10
|
+
owner: null
|
|
11
|
+
};
|
|
12
|
+
var d = null;
|
|
13
|
+
let z = null, bt = null, f = null, w = null, x = null, G = 0;
|
|
14
|
+
function K(t, e) {
|
|
15
|
+
const n = f, s = d, i = t.length === 0, o = s, r = i ? st : {
|
|
16
|
+
owned: null,
|
|
17
|
+
cleanups: null,
|
|
18
|
+
context: o ? o.context : null,
|
|
19
|
+
owner: o
|
|
20
|
+
}, l = i ? t : () => t(() => E(() => L(r)));
|
|
21
|
+
d = r, f = null;
|
|
22
|
+
try {
|
|
23
|
+
return N(l, !0);
|
|
24
|
+
} finally {
|
|
25
|
+
f = n, d = s;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function it(t, e) {
|
|
29
|
+
e = e ? Object.assign({}, O, e) : O;
|
|
30
|
+
const n = {
|
|
31
|
+
value: t,
|
|
32
|
+
observers: null,
|
|
33
|
+
observerSlots: null,
|
|
34
|
+
comparator: e.equals || void 0
|
|
35
|
+
}, s = (i) => (typeof i == "function" && (i = i(n.value)), lt(n, i));
|
|
36
|
+
return [rt.bind(n), s];
|
|
37
|
+
}
|
|
38
|
+
function $(t, e, n) {
|
|
39
|
+
const s = q(t, e, !1, b);
|
|
40
|
+
B(s);
|
|
41
|
+
}
|
|
42
|
+
function At(t, e, n) {
|
|
43
|
+
nt = Mt;
|
|
44
|
+
const s = q(t, e, !1, b);
|
|
45
|
+
s.user = !0, x ? x.push(s) : B(s);
|
|
46
|
+
}
|
|
47
|
+
function V(t, e, n) {
|
|
48
|
+
n = n ? Object.assign({}, O, n) : O;
|
|
49
|
+
const s = q(t, e, !0, 0);
|
|
50
|
+
return s.observers = null, s.observerSlots = null, s.comparator = n.equals || void 0, B(s), rt.bind(s);
|
|
51
|
+
}
|
|
52
|
+
function E(t) {
|
|
53
|
+
if (f === null) return t();
|
|
54
|
+
const e = f;
|
|
55
|
+
f = null;
|
|
56
|
+
try {
|
|
57
|
+
return t();
|
|
58
|
+
} finally {
|
|
59
|
+
f = e;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function ot(t) {
|
|
63
|
+
return d === null || (d.cleanups === null ? d.cleanups = [t] : d.cleanups.push(t)), t;
|
|
64
|
+
}
|
|
65
|
+
function Dt(t) {
|
|
66
|
+
let e;
|
|
67
|
+
return d && d.context && (e = d.context[t.id]) !== void 0 ? e : t.defaultValue;
|
|
68
|
+
}
|
|
69
|
+
function rt() {
|
|
70
|
+
if (this.sources && this.state)
|
|
71
|
+
if (this.state === b) B(this);
|
|
72
|
+
else {
|
|
73
|
+
const t = w;
|
|
74
|
+
w = null, N(() => U(this), !1), w = t;
|
|
75
|
+
}
|
|
76
|
+
if (f) {
|
|
77
|
+
const t = this.observers ? this.observers.length : 0;
|
|
78
|
+
f.sources ? (f.sources.push(this), f.sourceSlots.push(t)) : (f.sources = [this], f.sourceSlots = [t]), this.observers ? (this.observers.push(f), this.observerSlots.push(f.sources.length - 1)) : (this.observers = [f], this.observerSlots = [f.sources.length - 1]);
|
|
79
|
+
}
|
|
80
|
+
return this.value;
|
|
81
|
+
}
|
|
82
|
+
function lt(t, e, n) {
|
|
83
|
+
let s = t.value;
|
|
84
|
+
return (!t.comparator || !t.comparator(s, e)) && (t.value = e, t.observers && t.observers.length && N(() => {
|
|
85
|
+
for (let i = 0; i < t.observers.length; i += 1) {
|
|
86
|
+
const o = t.observers[i], r = z && z.running;
|
|
87
|
+
r && z.disposed.has(o), (r ? !o.tState : !o.state) && (o.pure ? w.push(o) : x.push(o), o.observers && ct(o)), r || (o.state = b);
|
|
88
|
+
}
|
|
89
|
+
if (w.length > 1e6)
|
|
90
|
+
throw w = [], new Error();
|
|
91
|
+
}, !1)), e;
|
|
92
|
+
}
|
|
93
|
+
function B(t) {
|
|
94
|
+
if (!t.fn) return;
|
|
95
|
+
L(t);
|
|
96
|
+
const e = G;
|
|
97
|
+
St(t, t.value, e);
|
|
98
|
+
}
|
|
99
|
+
function St(t, e, n) {
|
|
100
|
+
let s;
|
|
101
|
+
const i = d, o = f;
|
|
102
|
+
f = d = t;
|
|
103
|
+
try {
|
|
104
|
+
s = t.fn(e);
|
|
105
|
+
} catch (r) {
|
|
106
|
+
return t.pure && (t.state = b, t.owned && t.owned.forEach(L), t.owned = null), t.updatedAt = n + 1, ut(r);
|
|
107
|
+
} finally {
|
|
108
|
+
f = o, d = i;
|
|
109
|
+
}
|
|
110
|
+
(!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? lt(t, s) : t.value = s, t.updatedAt = n);
|
|
111
|
+
}
|
|
112
|
+
function q(t, e, n, s = b, i) {
|
|
113
|
+
const o = {
|
|
114
|
+
fn: t,
|
|
115
|
+
state: s,
|
|
116
|
+
updatedAt: null,
|
|
117
|
+
owned: null,
|
|
118
|
+
sources: null,
|
|
119
|
+
sourceSlots: null,
|
|
120
|
+
cleanups: null,
|
|
121
|
+
value: e,
|
|
122
|
+
owner: d,
|
|
123
|
+
context: d ? d.context : null,
|
|
124
|
+
pure: n
|
|
125
|
+
};
|
|
126
|
+
return d === null || d !== st && (d.owned ? d.owned.push(o) : d.owned = [o]), o;
|
|
127
|
+
}
|
|
128
|
+
function F(t) {
|
|
129
|
+
if (t.state === 0) return;
|
|
130
|
+
if (t.state === R) return U(t);
|
|
131
|
+
if (t.suspense && E(t.suspense.inFallback)) return t.suspense.effects.push(t);
|
|
132
|
+
const e = [t];
|
|
133
|
+
for (; (t = t.owner) && (!t.updatedAt || t.updatedAt < G); )
|
|
134
|
+
t.state && e.push(t);
|
|
135
|
+
for (let n = e.length - 1; n >= 0; n--)
|
|
136
|
+
if (t = e[n], t.state === b)
|
|
137
|
+
B(t);
|
|
138
|
+
else if (t.state === R) {
|
|
139
|
+
const s = w;
|
|
140
|
+
w = null, N(() => U(t, e[0]), !1), w = s;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function N(t, e) {
|
|
144
|
+
if (w) return t();
|
|
145
|
+
let n = !1;
|
|
146
|
+
e || (w = []), x ? n = !0 : x = [], G++;
|
|
147
|
+
try {
|
|
148
|
+
const s = t();
|
|
149
|
+
return Ct(n), s;
|
|
150
|
+
} catch (s) {
|
|
151
|
+
n || (x = null), w = null, ut(s);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function Ct(t) {
|
|
155
|
+
if (w && (at(w), w = null), t) return;
|
|
156
|
+
const e = x;
|
|
157
|
+
x = null, e.length && N(() => nt(e), !1);
|
|
158
|
+
}
|
|
159
|
+
function at(t) {
|
|
160
|
+
for (let e = 0; e < t.length; e++) F(t[e]);
|
|
161
|
+
}
|
|
162
|
+
function Mt(t) {
|
|
163
|
+
let e, n = 0;
|
|
164
|
+
for (e = 0; e < t.length; e++) {
|
|
165
|
+
const s = t[e];
|
|
166
|
+
s.user ? t[n++] = s : F(s);
|
|
167
|
+
}
|
|
168
|
+
for (e = 0; e < n; e++) F(t[e]);
|
|
169
|
+
}
|
|
170
|
+
function U(t, e) {
|
|
171
|
+
t.state = 0;
|
|
172
|
+
for (let n = 0; n < t.sources.length; n += 1) {
|
|
173
|
+
const s = t.sources[n];
|
|
174
|
+
if (s.sources) {
|
|
175
|
+
const i = s.state;
|
|
176
|
+
i === b ? s !== e && (!s.updatedAt || s.updatedAt < G) && F(s) : i === R && U(s, e);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function ct(t) {
|
|
181
|
+
for (let e = 0; e < t.observers.length; e += 1) {
|
|
182
|
+
const n = t.observers[e];
|
|
183
|
+
n.state || (n.state = R, n.pure ? w.push(n) : x.push(n), n.observers && ct(n));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function L(t) {
|
|
187
|
+
let e;
|
|
188
|
+
if (t.sources)
|
|
189
|
+
for (; t.sources.length; ) {
|
|
190
|
+
const n = t.sources.pop(), s = t.sourceSlots.pop(), i = n.observers;
|
|
191
|
+
if (i && i.length) {
|
|
192
|
+
const o = i.pop(), r = n.observerSlots.pop();
|
|
193
|
+
s < i.length && (o.sourceSlots[r] = s, i[s] = o, n.observerSlots[s] = r);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (t.tOwned) {
|
|
197
|
+
for (e = t.tOwned.length - 1; e >= 0; e--) L(t.tOwned[e]);
|
|
198
|
+
delete t.tOwned;
|
|
199
|
+
}
|
|
200
|
+
if (t.owned) {
|
|
201
|
+
for (e = t.owned.length - 1; e >= 0; e--) L(t.owned[e]);
|
|
202
|
+
t.owned = null;
|
|
203
|
+
}
|
|
204
|
+
if (t.cleanups) {
|
|
205
|
+
for (e = t.cleanups.length - 1; e >= 0; e--) t.cleanups[e]();
|
|
206
|
+
t.cleanups = null;
|
|
207
|
+
}
|
|
208
|
+
t.state = 0;
|
|
209
|
+
}
|
|
210
|
+
function It(t) {
|
|
211
|
+
return t instanceof Error ? t : new Error(typeof t == "string" ? t : "Unknown error", {
|
|
212
|
+
cause: t
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function ut(t, e = d) {
|
|
216
|
+
throw It(t);
|
|
217
|
+
}
|
|
218
|
+
const Et = /* @__PURE__ */ Symbol("fallback");
|
|
219
|
+
function Y(t) {
|
|
220
|
+
for (let e = 0; e < t.length; e++) t[e]();
|
|
221
|
+
}
|
|
222
|
+
function $t(t, e, n = {}) {
|
|
223
|
+
let s = [], i = [], o = [], r = 0, l = e.length > 1 ? [] : null;
|
|
224
|
+
return ot(() => Y(o)), () => {
|
|
225
|
+
let c = t() || [], u = c.length, h, a;
|
|
226
|
+
return c[mt], E(() => {
|
|
227
|
+
let v, A, D, j, T, g, k, y, C;
|
|
228
|
+
if (u === 0)
|
|
229
|
+
r !== 0 && (Y(o), o = [], s = [], i = [], r = 0, l && (l = [])), n.fallback && (s = [Et], i[0] = K((gt) => (o[0] = gt, n.fallback())), r = 1);
|
|
230
|
+
else if (r === 0) {
|
|
231
|
+
for (i = new Array(u), a = 0; a < u; a++)
|
|
232
|
+
s[a] = c[a], i[a] = K(S);
|
|
233
|
+
r = u;
|
|
234
|
+
} else {
|
|
235
|
+
for (D = new Array(u), j = new Array(u), l && (T = new Array(u)), g = 0, k = Math.min(r, u); g < k && s[g] === c[g]; g++) ;
|
|
236
|
+
for (k = r - 1, y = u - 1; k >= g && y >= g && s[k] === c[y]; k--, y--)
|
|
237
|
+
D[y] = i[k], j[y] = o[k], l && (T[y] = l[k]);
|
|
238
|
+
for (v = /* @__PURE__ */ new Map(), A = new Array(y + 1), a = y; a >= g; a--)
|
|
239
|
+
C = c[a], h = v.get(C), A[a] = h === void 0 ? -1 : h, v.set(C, a);
|
|
240
|
+
for (h = g; h <= k; h++)
|
|
241
|
+
C = s[h], a = v.get(C), a !== void 0 && a !== -1 ? (D[a] = i[h], j[a] = o[h], l && (T[a] = l[h]), a = A[a], v.set(C, a)) : o[h]();
|
|
242
|
+
for (a = g; a < u; a++)
|
|
243
|
+
a in D ? (i[a] = D[a], o[a] = j[a], l && (l[a] = T[a], l[a](a))) : i[a] = K(S);
|
|
244
|
+
i = i.slice(0, r = u), s = c.slice(0);
|
|
245
|
+
}
|
|
246
|
+
return i;
|
|
247
|
+
});
|
|
248
|
+
function S(v) {
|
|
249
|
+
if (o[a] = v, l) {
|
|
250
|
+
const [A, D] = it(a);
|
|
251
|
+
return l[a] = D, e(c[a], A);
|
|
252
|
+
}
|
|
253
|
+
return e(c[a]);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function m(t, e) {
|
|
258
|
+
return E(() => t(e || {}));
|
|
259
|
+
}
|
|
260
|
+
const Lt = (t) => `Stale read from <${t}>.`;
|
|
261
|
+
function Bt(t) {
|
|
262
|
+
const e = "fallback" in t && {
|
|
263
|
+
fallback: () => t.fallback
|
|
264
|
+
};
|
|
265
|
+
return V($t(() => t.each, t.children, e || void 0));
|
|
266
|
+
}
|
|
267
|
+
function Nt(t) {
|
|
268
|
+
const e = t.keyed, n = V(() => t.when, void 0, void 0), s = e ? n : V(n, void 0, {
|
|
269
|
+
equals: (i, o) => !i == !o
|
|
270
|
+
});
|
|
271
|
+
return V(() => {
|
|
272
|
+
const i = s();
|
|
273
|
+
if (i) {
|
|
274
|
+
const o = t.children;
|
|
275
|
+
return typeof o == "function" && o.length > 0 ? E(() => o(e ? i : () => {
|
|
276
|
+
if (!E(s)) throw Lt("Show");
|
|
277
|
+
return n();
|
|
278
|
+
})) : o;
|
|
279
|
+
}
|
|
280
|
+
return t.fallback;
|
|
281
|
+
}, void 0, void 0);
|
|
282
|
+
}
|
|
283
|
+
function _t(t, e, n) {
|
|
284
|
+
let s = n.length, i = e.length, o = s, r = 0, l = 0, c = e[i - 1].nextSibling, u = null;
|
|
285
|
+
for (; r < i || l < o; ) {
|
|
286
|
+
if (e[r] === n[l]) {
|
|
287
|
+
r++, l++;
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
for (; e[i - 1] === n[o - 1]; )
|
|
291
|
+
i--, o--;
|
|
292
|
+
if (i === r) {
|
|
293
|
+
const h = o < s ? l ? n[l - 1].nextSibling : n[o - l] : c;
|
|
294
|
+
for (; l < o; ) t.insertBefore(n[l++], h);
|
|
295
|
+
} else if (o === l)
|
|
296
|
+
for (; r < i; )
|
|
297
|
+
(!u || !u.has(e[r])) && e[r].remove(), r++;
|
|
298
|
+
else if (e[r] === n[o - 1] && n[l] === e[i - 1]) {
|
|
299
|
+
const h = e[--i].nextSibling;
|
|
300
|
+
t.insertBefore(n[l++], e[r++].nextSibling), t.insertBefore(n[--o], h), e[i] = n[o];
|
|
301
|
+
} else {
|
|
302
|
+
if (!u) {
|
|
303
|
+
u = /* @__PURE__ */ new Map();
|
|
304
|
+
let a = l;
|
|
305
|
+
for (; a < o; ) u.set(n[a], a++);
|
|
306
|
+
}
|
|
307
|
+
const h = u.get(e[r]);
|
|
308
|
+
if (h != null)
|
|
309
|
+
if (l < h && h < o) {
|
|
310
|
+
let a = r, S = 1, v;
|
|
311
|
+
for (; ++a < i && a < o && !((v = u.get(e[a])) == null || v !== h + S); )
|
|
312
|
+
S++;
|
|
313
|
+
if (S > h - l) {
|
|
314
|
+
const A = e[r];
|
|
315
|
+
for (; l < h; ) t.insertBefore(n[l++], A);
|
|
316
|
+
} else t.replaceChild(n[l++], e[r++]);
|
|
317
|
+
} else r++;
|
|
318
|
+
else e[r++].remove();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const tt = "_$DX_DELEGATE";
|
|
323
|
+
function _(t, e, n, s) {
|
|
324
|
+
let i;
|
|
325
|
+
const o = () => {
|
|
326
|
+
const l = document.createElement("template");
|
|
327
|
+
return l.innerHTML = t, l.content.firstChild;
|
|
328
|
+
}, r = () => (i || (i = o())).cloneNode(!0);
|
|
329
|
+
return r.cloneNode = r, r;
|
|
330
|
+
}
|
|
331
|
+
function jt(t, e = window.document) {
|
|
332
|
+
const n = e[tt] || (e[tt] = /* @__PURE__ */ new Set());
|
|
333
|
+
for (let s = 0, i = t.length; s < i; s++) {
|
|
334
|
+
const o = t[s];
|
|
335
|
+
n.has(o) || (n.add(o), e.addEventListener(o, Pt));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function M(t, e, n) {
|
|
339
|
+
n == null ? t.removeAttribute(e) : t.setAttribute(e, n);
|
|
340
|
+
}
|
|
341
|
+
function ht(t, e) {
|
|
342
|
+
e == null ? t.removeAttribute("class") : t.className = e;
|
|
343
|
+
}
|
|
344
|
+
function Tt(t, e, n, s) {
|
|
345
|
+
Array.isArray(n) ? (t[`$$${e}`] = n[0], t[`$$${e}Data`] = n[1]) : t[`$$${e}`] = n;
|
|
346
|
+
}
|
|
347
|
+
function I(t, e, n, s) {
|
|
348
|
+
if (typeof e != "function") return H(t, e, s, n);
|
|
349
|
+
$((i) => H(t, e(), i, n), s);
|
|
350
|
+
}
|
|
351
|
+
function Pt(t) {
|
|
352
|
+
let e = t.target;
|
|
353
|
+
const n = `$$${t.type}`, s = t.target, i = t.currentTarget, o = (c) => Object.defineProperty(t, "target", {
|
|
354
|
+
configurable: !0,
|
|
355
|
+
value: c
|
|
356
|
+
}), r = () => {
|
|
357
|
+
const c = e[n];
|
|
358
|
+
if (c && !e.disabled) {
|
|
359
|
+
const u = e[`${n}Data`];
|
|
360
|
+
if (u !== void 0 ? c.call(e, u, t) : c.call(e, t), t.cancelBubble) return;
|
|
361
|
+
}
|
|
362
|
+
return e.host && typeof e.host != "string" && !e.host._$host && e.contains(t.target) && o(e.host), !0;
|
|
363
|
+
}, l = () => {
|
|
364
|
+
for (; r() && (e = e._$host || e.parentNode || e.host); ) ;
|
|
365
|
+
};
|
|
366
|
+
if (Object.defineProperty(t, "currentTarget", {
|
|
367
|
+
configurable: !0,
|
|
368
|
+
get() {
|
|
369
|
+
return e || document;
|
|
370
|
+
}
|
|
371
|
+
}), t.composedPath) {
|
|
372
|
+
const c = t.composedPath();
|
|
373
|
+
o(c[0]);
|
|
374
|
+
for (let u = 0; u < c.length - 2 && (e = c[u], !!r()); u++) {
|
|
375
|
+
if (e._$host) {
|
|
376
|
+
e = e._$host, l();
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
if (e.parentNode === i)
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
} else l();
|
|
383
|
+
o(s);
|
|
384
|
+
}
|
|
385
|
+
function H(t, e, n, s, i) {
|
|
386
|
+
for (; typeof n == "function"; ) n = n();
|
|
387
|
+
if (e === n) return n;
|
|
388
|
+
const o = typeof e;
|
|
389
|
+
if (t = t, o === "string" || o === "number") {
|
|
390
|
+
if (o === "number" && (e = e.toString(), e === n))
|
|
391
|
+
return n;
|
|
392
|
+
n !== "" && typeof n == "string" ? n = t.firstChild.data = e : n = t.textContent = e;
|
|
393
|
+
} else if (e == null || o === "boolean")
|
|
394
|
+
n = P(t, n, s);
|
|
395
|
+
else {
|
|
396
|
+
if (o === "function")
|
|
397
|
+
return $(() => {
|
|
398
|
+
let r = e();
|
|
399
|
+
for (; typeof r == "function"; ) r = r();
|
|
400
|
+
n = H(t, r, n, s);
|
|
401
|
+
}), () => n;
|
|
402
|
+
if (Array.isArray(e)) {
|
|
403
|
+
const r = [], l = n && Array.isArray(n);
|
|
404
|
+
if (Z(r, e, n, i))
|
|
405
|
+
return $(() => n = H(t, r, n, s, !0)), () => n;
|
|
406
|
+
r.length === 0 ? n = P(t, n, s) : l ? n.length === 0 ? et(t, r, s) : _t(t, n, r) : (n && P(t), et(t, r)), n = r;
|
|
407
|
+
} else e.nodeType && (Array.isArray(n) ? P(t, n, null, e) : n == null || n === "" || !t.firstChild ? t.appendChild(e) : t.replaceChild(e, t.firstChild), n = e);
|
|
408
|
+
}
|
|
409
|
+
return n;
|
|
410
|
+
}
|
|
411
|
+
function Z(t, e, n, s) {
|
|
412
|
+
let i = !1;
|
|
413
|
+
for (let o = 0, r = e.length; o < r; o++) {
|
|
414
|
+
let l = e[o], c = n && n[t.length], u;
|
|
415
|
+
if (!(l == null || l === !0 || l === !1)) if ((u = typeof l) == "object" && l.nodeType)
|
|
416
|
+
t.push(l);
|
|
417
|
+
else if (Array.isArray(l))
|
|
418
|
+
i = Z(t, l, c) || i;
|
|
419
|
+
else if (u === "function")
|
|
420
|
+
if (s) {
|
|
421
|
+
for (; typeof l == "function"; ) l = l();
|
|
422
|
+
i = Z(t, Array.isArray(l) ? l : [l], Array.isArray(c) ? c : [c]) || i;
|
|
423
|
+
} else
|
|
424
|
+
t.push(l), i = !0;
|
|
425
|
+
else {
|
|
426
|
+
const h = String(l);
|
|
427
|
+
c && c.nodeType === 3 && c.data === h ? t.push(c) : t.push(document.createTextNode(h));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return i;
|
|
431
|
+
}
|
|
432
|
+
function et(t, e, n = null) {
|
|
433
|
+
for (let s = 0, i = e.length; s < i; s++) t.insertBefore(e[s], n);
|
|
434
|
+
}
|
|
435
|
+
function P(t, e, n, s) {
|
|
436
|
+
if (n === void 0) return t.textContent = "";
|
|
437
|
+
const i = s || document.createTextNode("");
|
|
438
|
+
if (e.length) {
|
|
439
|
+
let o = !1;
|
|
440
|
+
for (let r = e.length - 1; r >= 0; r--) {
|
|
441
|
+
const l = e[r];
|
|
442
|
+
if (i !== l) {
|
|
443
|
+
const c = l.parentNode === t;
|
|
444
|
+
!o && !r ? c ? t.replaceChild(i, l) : t.insertBefore(i, n) : c && l.remove();
|
|
445
|
+
} else o = !0;
|
|
446
|
+
}
|
|
447
|
+
} else t.insertBefore(i, n);
|
|
448
|
+
return [i];
|
|
449
|
+
}
|
|
450
|
+
var Vt = /* @__PURE__ */ _("<button>");
|
|
451
|
+
function Be(t) {
|
|
452
|
+
return (() => {
|
|
453
|
+
var e = Vt();
|
|
454
|
+
return Tt(e, "click", t.onClick), I(e, () => t.children), $((n) => {
|
|
455
|
+
var s = t.type ?? "button", i = t.title ?? "Simple button", o = `flex--center button ${t.class ? `${t.class}` : ""}`.trimEnd(), r = t.ariaLabel ?? t.title ?? (typeof t.children == "string" ? t.children : void 0), l = t.ariaDisabled ?? t.disabled, c = t.disabled, u = t.tabIndex;
|
|
456
|
+
return s !== n.e && M(e, "type", n.e = s), i !== n.t && M(e, "title", n.t = i), o !== n.a && ht(e, n.a = o), r !== n.o && M(e, "aria-label", n.o = r), l !== n.i && M(e, "aria-disabled", n.i = l), c !== n.n && (e.disabled = n.n = c), u !== n.s && M(e, "tabindex", n.s = u), n;
|
|
457
|
+
}, {
|
|
458
|
+
e: void 0,
|
|
459
|
+
t: void 0,
|
|
460
|
+
a: void 0,
|
|
461
|
+
o: void 0,
|
|
462
|
+
i: void 0,
|
|
463
|
+
n: void 0,
|
|
464
|
+
s: void 0
|
|
465
|
+
}), e;
|
|
466
|
+
})();
|
|
467
|
+
}
|
|
468
|
+
jt(["click"]);
|
|
469
|
+
const Ot = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
470
|
+
<g transform="rotate(180 12 12)">
|
|
471
|
+
<path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" />
|
|
472
|
+
</g>
|
|
473
|
+
</svg>`, Rt = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
474
|
+
<path d="M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" />
|
|
475
|
+
</svg>`, Ft = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
476
|
+
<path d="M9 18V5l12-2v13" />
|
|
477
|
+
<circle cx="6" cy="18" r="3" />
|
|
478
|
+
<circle cx="18" cy="16" r="3" />
|
|
479
|
+
</svg>`, Ut = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="var(--color-red)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
480
|
+
<path d="M4.929 4.929 19.07 19.071" />
|
|
481
|
+
<circle cx="12" cy="12" r="10" />
|
|
482
|
+
</svg>`, Ht = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
483
|
+
<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" />
|
|
484
|
+
</svg>`, Gt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
485
|
+
<path d="M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z" />
|
|
486
|
+
<circle cx="12" cy="13" r="3" />
|
|
487
|
+
</svg>`, Wt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
488
|
+
<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
|
|
489
|
+
</svg>`, zt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
490
|
+
<path d="M8 3H5a2 2 0 0 0-2 2v3" />
|
|
491
|
+
<path d="M21 8V5a2 2 0 0 0-2-2h-3" />
|
|
492
|
+
<path d="M3 16v3a2 2 0 0 0 2 2h3" />
|
|
493
|
+
<path d="M16 21h3a2 2 0 0 0 2-2v-3" />
|
|
494
|
+
</svg>`, Kt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
495
|
+
<path d="M8 3v3a2 2 0 0 1-2 2H3" />
|
|
496
|
+
<path d="M21 8h-3a2 2 0 0 1-2-2V3" />
|
|
497
|
+
<path d="M3 16h3a2 2 0 0 1 2 2v3" />
|
|
498
|
+
<path d="M16 21v-3a2 2 0 0 1 2-2h3" />
|
|
499
|
+
</svg>`, Zt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
500
|
+
<path d="M12 19v3" />
|
|
501
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2" />
|
|
502
|
+
<rect x="9" y="2" width="6" height="13" rx="3" />
|
|
503
|
+
</svg>`, qt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
504
|
+
<path d="M16 9a5 5 0 0 1 .95 2.293" />
|
|
505
|
+
<path d="M19.364 5.636a9 9 0 0 1 1.889 9.96" />
|
|
506
|
+
<path d="m2 2 20 20" />
|
|
507
|
+
<path d="m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11" />
|
|
508
|
+
<path d="M9.828 4.172A.686.686 0 0 1 11 4.657v.686" />
|
|
509
|
+
</svg>`, Qt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
510
|
+
<path d="M16.247 7.761a6 6 0 0 1 0 8.478" />
|
|
511
|
+
<path d="M19.075 4.933a10 10 0 0 1 0 14.134" />
|
|
512
|
+
<path d="M4.925 19.067a10 10 0 0 1 0-14.134" />
|
|
513
|
+
<path d="M7.753 16.239a6 6 0 0 1 0-8.478" />
|
|
514
|
+
<circle cx="12" cy="12" r="2" />
|
|
515
|
+
</svg>`, Xt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
516
|
+
<rect x="14" y="3" width="5" height="18" rx="1" />
|
|
517
|
+
<rect x="5" y="3" width="5" height="18" rx="1" />
|
|
518
|
+
</svg>`, Jt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
519
|
+
<path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" />
|
|
520
|
+
</svg>`, Yt = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
521
|
+
<rect width="20" height="14" x="2" y="3" rx="2" />
|
|
522
|
+
<line x1="8" x2="16" y1="21" y2="21" />
|
|
523
|
+
<line x1="12" x2="12" y1="17" y2="21" />
|
|
524
|
+
</svg>`, te = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
525
|
+
<path d="M5 21v-6" />
|
|
526
|
+
<path d="M12 21V3" />
|
|
527
|
+
<path d="M19 21V9" />
|
|
528
|
+
</svg>`, ee = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
529
|
+
<path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5" />
|
|
530
|
+
<rect x="2" y="6" width="14" height="12" rx="2" />
|
|
531
|
+
</svg>`, ne = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
532
|
+
<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
|
|
533
|
+
<path d="M16 9a5 5 0 0 1 0 6" />
|
|
534
|
+
<path d="M19.364 18.364a9 9 0 0 0 0-12.728" />
|
|
535
|
+
</svg>`, se = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
536
|
+
<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
|
|
537
|
+
</svg>`, ie = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="var(--color-white)" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
538
|
+
<path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
|
|
539
|
+
<path d="M16 9a5 5 0 0 1 0 6" />
|
|
540
|
+
</svg>`;
|
|
541
|
+
var oe = /* @__PURE__ */ _("<span class=flex--center role=img>");
|
|
542
|
+
function dt(t) {
|
|
543
|
+
return (() => {
|
|
544
|
+
var e = oe();
|
|
545
|
+
return M(e, "aria-hidden", !0), e.innerHTML = t, e;
|
|
546
|
+
})();
|
|
547
|
+
}
|
|
548
|
+
const p = (t) => () => dt(t), re = p(Ot), le = p(Rt), ft = p(Ft), ae = p(Ut), pt = p(Ht), ce = p(Gt), ue = p(Wt), he = p(zt), de = p(Kt), fe = p(Zt), pe = p(qt), wt = p(Qt), we = p(Xt), ve = p(Jt), ge = p(Yt), ke = p(te), vt = p(ee), ye = p(ne), xe = p(se), me = p(ie), Ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
549
|
+
__proto__: null,
|
|
550
|
+
ArrowDown: re,
|
|
551
|
+
ArrowUp: le,
|
|
552
|
+
Audio: ft,
|
|
553
|
+
Ban: ae,
|
|
554
|
+
Buffer: pt,
|
|
555
|
+
Camera: ce,
|
|
556
|
+
Element: dt,
|
|
557
|
+
File: ue,
|
|
558
|
+
FullscreenEnter: he,
|
|
559
|
+
FullscreenExit: de,
|
|
560
|
+
Microphone: fe,
|
|
561
|
+
Mute: pe,
|
|
562
|
+
Network: wt,
|
|
563
|
+
Pause: we,
|
|
564
|
+
Play: ve,
|
|
565
|
+
Screen: ge,
|
|
566
|
+
Stats: ke,
|
|
567
|
+
Video: vt,
|
|
568
|
+
VolumeHigh: ye,
|
|
569
|
+
VolumeLow: xe,
|
|
570
|
+
VolumeMedium: me
|
|
571
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
572
|
+
class W {
|
|
573
|
+
/** Manages subscriptions lifecycle */
|
|
574
|
+
signals = new kt();
|
|
575
|
+
/** Stream sources provided to provider */
|
|
576
|
+
props;
|
|
577
|
+
/**
|
|
578
|
+
* Initialize provider with stream sources
|
|
579
|
+
* @param props - Audio and video stream sources
|
|
580
|
+
*/
|
|
581
|
+
constructor(e) {
|
|
582
|
+
this.props = e;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Clean up subscriptions
|
|
586
|
+
*/
|
|
587
|
+
cleanup() {
|
|
588
|
+
this.signals.close();
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
class Q extends W {
|
|
592
|
+
/** Polling interval in milliseconds */
|
|
593
|
+
static POLLING_INTERVAL_MS = 250;
|
|
594
|
+
/** Display context for updating metrics */
|
|
595
|
+
context;
|
|
596
|
+
/** Polling interval ID */
|
|
597
|
+
updateInterval;
|
|
598
|
+
/** Previous bytes received for bitrate calculation */
|
|
599
|
+
previousBytesReceived = 0;
|
|
600
|
+
/** Previous timestamp for accurate elapsed time calculation */
|
|
601
|
+
previousWhen = 0;
|
|
602
|
+
/**
|
|
603
|
+
* Initialize audio provider with polling interval
|
|
604
|
+
*/
|
|
605
|
+
setup(e) {
|
|
606
|
+
if (this.context = e, !this.props.audio) {
|
|
607
|
+
e.setDisplayData("N/A");
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
this.updateInterval = window.setInterval(this.updateDisplayData.bind(this), Q.POLLING_INTERVAL_MS), this.previousWhen = performance.now(), this.updateDisplayData();
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Calculate and display current audio metrics
|
|
614
|
+
*/
|
|
615
|
+
updateDisplayData() {
|
|
616
|
+
if (!this.context || !this.props.audio)
|
|
617
|
+
return;
|
|
618
|
+
const e = this.props.audio.source.track.peek(), n = this.props.audio.source.config.peek(), s = this.props.audio.stats.peek();
|
|
619
|
+
if (!e || !n) {
|
|
620
|
+
this.context.setDisplayData("N/A");
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
const i = performance.now();
|
|
624
|
+
let o;
|
|
625
|
+
if (s && this.previousBytesReceived > 0) {
|
|
626
|
+
const l = s.bytesReceived - this.previousBytesReceived;
|
|
627
|
+
if (l > 0) {
|
|
628
|
+
const c = i - this.previousWhen;
|
|
629
|
+
if (c > 0) {
|
|
630
|
+
const u = l * 8 * (1e3 / c);
|
|
631
|
+
u >= 1e6 ? o = `${(u / 1e6).toFixed(1)}Mbps` : u >= 1e3 ? o = `${(u / 1e3).toFixed(0)}kbps` : o = `${u.toFixed(0)}bps`;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
s && (this.previousBytesReceived = s.bytesReceived, this.previousWhen = i);
|
|
636
|
+
const r = [];
|
|
637
|
+
if (n.sampleRate) {
|
|
638
|
+
const l = (n.sampleRate / 1e3).toFixed(1);
|
|
639
|
+
r.push(`${l}kHz`);
|
|
640
|
+
}
|
|
641
|
+
n.numberOfChannels && r.push(`${n.numberOfChannels}ch`), r.push(o ?? "N/A"), n.codec && r.push(n.codec), this.context.setDisplayData(r.length > 0 ? r.join(`
|
|
642
|
+
`) : "N/A");
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Clean up polling interval
|
|
646
|
+
*/
|
|
647
|
+
cleanup() {
|
|
648
|
+
this.updateInterval !== void 0 && window.clearInterval(this.updateInterval), super.cleanup();
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
class be extends W {
|
|
652
|
+
/**
|
|
653
|
+
* Initialize buffer provider with signal subscriptions
|
|
654
|
+
*/
|
|
655
|
+
setup(e) {
|
|
656
|
+
if (!this.props.video) {
|
|
657
|
+
e.setDisplayData("N/A");
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
e.setDisplayData("TODO");
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
class X extends W {
|
|
664
|
+
/** Polling interval in milliseconds */
|
|
665
|
+
static POLLING_INTERVAL_MS = 100;
|
|
666
|
+
/** Display context for updating metrics */
|
|
667
|
+
context;
|
|
668
|
+
/** Network information from navigator.connection */
|
|
669
|
+
networkInfo;
|
|
670
|
+
/** Polling interval ID */
|
|
671
|
+
updateInterval;
|
|
672
|
+
boundUpdateDisplayData = this.updateDisplayData.bind(this);
|
|
673
|
+
/**
|
|
674
|
+
* Initialize network provider with connection listeners
|
|
675
|
+
*/
|
|
676
|
+
setup(e) {
|
|
677
|
+
this.context = e;
|
|
678
|
+
const n = navigator;
|
|
679
|
+
if (this.networkInfo = n.connection ?? n.mozConnection ?? n.webkitConnection, !this.networkInfo) {
|
|
680
|
+
e.setDisplayData("N/A");
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
this.networkInfo.addEventListener?.("change", this.boundUpdateDisplayData), window.addEventListener("online", this.boundUpdateDisplayData), window.addEventListener("offline", this.boundUpdateDisplayData), this.updateInterval = window.setInterval(this.boundUpdateDisplayData, X.POLLING_INTERVAL_MS), this.updateDisplayData();
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Clean up event listeners and polling interval
|
|
687
|
+
*/
|
|
688
|
+
cleanup() {
|
|
689
|
+
this.networkInfo?.removeEventListener && this.networkInfo.removeEventListener("change", this.boundUpdateDisplayData), window.removeEventListener("online", this.boundUpdateDisplayData), window.removeEventListener("offline", this.boundUpdateDisplayData), this.updateInterval !== void 0 && clearInterval(this.updateInterval), super.cleanup();
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Calculate and display current network metrics
|
|
693
|
+
*/
|
|
694
|
+
updateDisplayData() {
|
|
695
|
+
if (!this.context)
|
|
696
|
+
return;
|
|
697
|
+
const e = [
|
|
698
|
+
this.getConnectionType(),
|
|
699
|
+
this.getEffectiveBandwidth(),
|
|
700
|
+
this.getLatency(),
|
|
701
|
+
this.getSaveDataStatus()
|
|
702
|
+
].filter((n) => n !== null);
|
|
703
|
+
this.context.setDisplayData(e.length > 0 ? e.join(`
|
|
704
|
+
`) : "N/A");
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Get formatted connection type
|
|
708
|
+
* @returns Connection type or null if unavailable
|
|
709
|
+
*/
|
|
710
|
+
getConnectionType() {
|
|
711
|
+
if (!navigator.onLine)
|
|
712
|
+
return "offline";
|
|
713
|
+
if (!this.networkInfo)
|
|
714
|
+
return null;
|
|
715
|
+
const e = this.networkInfo.effectiveType;
|
|
716
|
+
if (e)
|
|
717
|
+
return {
|
|
718
|
+
"slow-2g": "Slow-2G",
|
|
719
|
+
"2g": "2G",
|
|
720
|
+
"3g": "3G",
|
|
721
|
+
"4g": "4G"
|
|
722
|
+
}[e];
|
|
723
|
+
const n = this.networkInfo.type;
|
|
724
|
+
return n ? n.charAt(0).toUpperCase() + n.slice(1) : null;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Get formatted bandwidth in Mbps or Gbps
|
|
728
|
+
* @returns Bandwidth string or null if unavailable
|
|
729
|
+
*/
|
|
730
|
+
getEffectiveBandwidth() {
|
|
731
|
+
const e = this.networkInfo?.downlink;
|
|
732
|
+
return !e || e <= 0 ? null : e >= 1e3 ? `${(e / 1e3).toFixed(1)}Gbps` : e >= 1 ? `${e.toFixed(1)}Mbps` : `${(e * 1e3).toFixed(0)}Kbps`;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Get formatted round-trip latency
|
|
736
|
+
* @returns Latency string or null if unavailable
|
|
737
|
+
*/
|
|
738
|
+
getLatency() {
|
|
739
|
+
const e = this.networkInfo?.rtt;
|
|
740
|
+
return e && e > 0 ? `${e}ms` : null;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Get data saver mode status
|
|
744
|
+
* @returns Data saver indicator or null if disabled
|
|
745
|
+
*/
|
|
746
|
+
getSaveDataStatus() {
|
|
747
|
+
return this.networkInfo?.saveData ? "Save-Data" : null;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
class J extends W {
|
|
751
|
+
/** Polling interval in milliseconds */
|
|
752
|
+
static POLLING_INTERVAL_MS = 250;
|
|
753
|
+
/** Display context for updating metrics */
|
|
754
|
+
context;
|
|
755
|
+
/** Polling interval ID */
|
|
756
|
+
updateInterval;
|
|
757
|
+
/** Bound callback for display updates */
|
|
758
|
+
/** Previous frame count for FPS calculation */
|
|
759
|
+
previousFrameCount = 0;
|
|
760
|
+
/** Previous bytes received for bitrate calculation */
|
|
761
|
+
previousBytesReceived = 0;
|
|
762
|
+
/** Previous timestamp for accurate elapsed time calculation in bitrate */
|
|
763
|
+
previousWhen = 0;
|
|
764
|
+
/**
|
|
765
|
+
* Initialize video provider with polling interval
|
|
766
|
+
*/
|
|
767
|
+
setup(e) {
|
|
768
|
+
if (this.context = e, !this.props.video) {
|
|
769
|
+
e.setDisplayData("N/A");
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
this.updateInterval = window.setInterval(this.updateDisplayData.bind(this), J.POLLING_INTERVAL_MS), this.previousWhen = performance.now(), this.updateDisplayData();
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Calculate and display current video metrics
|
|
776
|
+
*/
|
|
777
|
+
updateDisplayData() {
|
|
778
|
+
if (!this.context || !this.props.video)
|
|
779
|
+
return;
|
|
780
|
+
const e = this.props.video.source.catalog.peek(), n = this.props.video.stats.peek(), s = performance.now(), i = s - this.previousWhen;
|
|
781
|
+
let o;
|
|
782
|
+
if (n && this.previousFrameCount > 0) {
|
|
783
|
+
const h = n.frameCount - this.previousFrameCount;
|
|
784
|
+
if (i > 0 && h > 0) {
|
|
785
|
+
const a = i / 1e3;
|
|
786
|
+
o = h / a;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
let r;
|
|
790
|
+
if (n && this.previousBytesReceived > 0) {
|
|
791
|
+
const h = n.bytesReceived - this.previousBytesReceived;
|
|
792
|
+
if (h > 0 && i > 0) {
|
|
793
|
+
const a = h * 8 * (1e3 / i);
|
|
794
|
+
a >= 1e6 ? r = `${(a / 1e6).toFixed(1)}Mbps` : a >= 1e3 ? r = `${(a / 1e3).toFixed(0)}kbps` : r = `${a.toFixed(0)}bps`;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
n && (this.previousFrameCount = n.frameCount, this.previousBytesReceived = n.bytesReceived, this.previousWhen = s);
|
|
798
|
+
const { width: l, height: c } = e?.display ?? {}, u = [
|
|
799
|
+
l && c ? `${l}x${c}` : "N/A",
|
|
800
|
+
o !== void 0 ? `@${o.toFixed(1)} fps` : "N/A",
|
|
801
|
+
r ?? "N/A"
|
|
802
|
+
];
|
|
803
|
+
this.context.setDisplayData(u.join(`
|
|
804
|
+
`));
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Clean up polling interval
|
|
808
|
+
*/
|
|
809
|
+
cleanup() {
|
|
810
|
+
this.updateInterval !== void 0 && clearInterval(this.updateInterval), super.cleanup();
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
const Ae = {
|
|
814
|
+
video: J,
|
|
815
|
+
audio: Q,
|
|
816
|
+
buffer: be,
|
|
817
|
+
network: X
|
|
818
|
+
};
|
|
819
|
+
function De(t) {
|
|
820
|
+
return Ae[t];
|
|
821
|
+
}
|
|
822
|
+
var Se = /* @__PURE__ */ _("<div><div class=stats__icon-wrapper></div><div class=stats__item-detail><span class=stats__item-title></span><span class=stats__item-data>");
|
|
823
|
+
const Ce = (t) => {
|
|
824
|
+
const [e, n] = it("N/A");
|
|
825
|
+
return At(() => {
|
|
826
|
+
const s = De(t.statProvider);
|
|
827
|
+
if (!s) {
|
|
828
|
+
n("N/A");
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
const i = new s({
|
|
832
|
+
audio: t.audio,
|
|
833
|
+
video: t.video
|
|
834
|
+
});
|
|
835
|
+
i.setup({
|
|
836
|
+
setDisplayData: n
|
|
837
|
+
}), ot(() => {
|
|
838
|
+
i.cleanup();
|
|
839
|
+
});
|
|
840
|
+
}), (() => {
|
|
841
|
+
var s = Se(), i = s.firstChild, o = i.nextSibling, r = o.firstChild, l = r.nextSibling;
|
|
842
|
+
return I(i, () => t.svg), I(r, () => t.statProvider), I(l, e), $(() => ht(s, `stats__item stats__item--${t.statProvider}`)), s;
|
|
843
|
+
})();
|
|
844
|
+
};
|
|
845
|
+
var Me = /* @__PURE__ */ _("<div class=stats__panel>");
|
|
846
|
+
const Ie = [{
|
|
847
|
+
name: "Network",
|
|
848
|
+
statProvider: "network",
|
|
849
|
+
icon: () => m(wt, {})
|
|
850
|
+
}, {
|
|
851
|
+
name: "Video",
|
|
852
|
+
statProvider: "video",
|
|
853
|
+
icon: () => m(vt, {})
|
|
854
|
+
}, {
|
|
855
|
+
name: "Audio",
|
|
856
|
+
statProvider: "audio",
|
|
857
|
+
icon: () => m(ft, {})
|
|
858
|
+
}, {
|
|
859
|
+
name: "Buffer",
|
|
860
|
+
statProvider: "buffer",
|
|
861
|
+
icon: () => m(pt, {})
|
|
862
|
+
}], Ee = (t) => (() => {
|
|
863
|
+
var e = Me();
|
|
864
|
+
return I(e, m(Bt, {
|
|
865
|
+
each: Ie,
|
|
866
|
+
children: ({
|
|
867
|
+
name: n,
|
|
868
|
+
statProvider: s,
|
|
869
|
+
icon: i
|
|
870
|
+
}) => m(Ce, {
|
|
871
|
+
name: n,
|
|
872
|
+
statProvider: s,
|
|
873
|
+
get svg() {
|
|
874
|
+
return i();
|
|
875
|
+
},
|
|
876
|
+
get audio() {
|
|
877
|
+
return t.audio;
|
|
878
|
+
},
|
|
879
|
+
get video() {
|
|
880
|
+
return t.video;
|
|
881
|
+
}
|
|
882
|
+
})
|
|
883
|
+
})), e;
|
|
884
|
+
})();
|
|
885
|
+
var $e = /* @__PURE__ */ _("<div class=stats>");
|
|
886
|
+
const _e = (t) => {
|
|
887
|
+
const e = Dt(t.context);
|
|
888
|
+
return m(Nt, {
|
|
889
|
+
get when() {
|
|
890
|
+
return t.getElement(e);
|
|
891
|
+
},
|
|
892
|
+
children: (n) => (() => {
|
|
893
|
+
var s = $e();
|
|
894
|
+
return I(s, m(Ee, {
|
|
895
|
+
get audio() {
|
|
896
|
+
return n().audio;
|
|
897
|
+
},
|
|
898
|
+
get video() {
|
|
899
|
+
return n().video;
|
|
900
|
+
}
|
|
901
|
+
})), s;
|
|
902
|
+
})()
|
|
903
|
+
});
|
|
904
|
+
};
|
|
905
|
+
export {
|
|
906
|
+
Be as Button,
|
|
907
|
+
Ne as Icon,
|
|
908
|
+
_e as Stats
|
|
909
|
+
};
|
|
910
|
+
//# sourceMappingURL=index.js.map
|