@moq/watch 0.2.11 → 0.2.12

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.
Files changed (112) hide show
  1. package/README.md +7 -7
  2. package/audio/buffer.d.ts +1 -1
  3. package/audio/buffer.d.ts.map +1 -1
  4. package/audio/decoder.d.ts +1 -1
  5. package/audio/decoder.d.ts.map +1 -1
  6. package/audio/render.d.ts +1 -1
  7. package/audio/render.d.ts.map +1 -1
  8. package/audio/ring-buffer.d.ts +1 -1
  9. package/audio/ring-buffer.d.ts.map +1 -1
  10. package/audio/shared-ring-buffer.d.ts +1 -1
  11. package/audio/shared-ring-buffer.d.ts.map +1 -1
  12. package/audio/source.d.ts.map +1 -1
  13. package/backend.d.ts +1 -1
  14. package/backend.d.ts.map +1 -1
  15. package/{broadcast-b74Ew4Ql.js → broadcast-CLjMphZS.js} +1108 -1013
  16. package/broadcast-CLjMphZS.js.map +1 -0
  17. package/broadcast.d.ts +4 -3
  18. package/broadcast.d.ts.map +1 -1
  19. package/chat/index.d.ts +1 -1
  20. package/chat/index.d.ts.map +1 -1
  21. package/chat/message.d.ts +1 -1
  22. package/chat/message.d.ts.map +1 -1
  23. package/chat/typing.d.ts +1 -1
  24. package/chat/typing.d.ts.map +1 -1
  25. package/dom-BsFrLb_F.js +35 -0
  26. package/dom-BsFrLb_F.js.map +1 -0
  27. package/element.d.ts +4 -4
  28. package/element.d.ts.map +1 -1
  29. package/element.js +43 -32
  30. package/element.js.map +1 -1
  31. package/index.d.ts +1 -1
  32. package/index.d.ts.map +1 -1
  33. package/index.js +12 -11
  34. package/index.js.map +1 -1
  35. package/libav-opus-af-BlMWboA7.js.map +1 -1
  36. package/location/index.d.ts +1 -1
  37. package/location/index.d.ts.map +1 -1
  38. package/location/peers.d.ts +1 -1
  39. package/location/peers.d.ts.map +1 -1
  40. package/location/window.d.ts +1 -1
  41. package/location/window.d.ts.map +1 -1
  42. package/main-DGBFe0O7.js.map +1 -1
  43. package/package.json +7 -8
  44. package/preview.d.ts +1 -1
  45. package/preview.d.ts.map +1 -1
  46. package/support/element.js +49 -60
  47. package/support/element.js.map +1 -1
  48. package/sync.d.ts +2 -2
  49. package/sync.d.ts.map +1 -1
  50. package/ui/components/buffer-control.d.ts +5 -0
  51. package/ui/components/buffer-control.d.ts.map +1 -0
  52. package/ui/components/buffering-indicator.d.ts +4 -0
  53. package/ui/components/buffering-indicator.d.ts.map +1 -0
  54. package/ui/components/fullscreen-button.d.ts +4 -0
  55. package/ui/components/fullscreen-button.d.ts.map +1 -0
  56. package/ui/components/offline-indicator.d.ts +4 -0
  57. package/ui/components/offline-indicator.d.ts.map +1 -0
  58. package/ui/components/play-pause.d.ts +4 -0
  59. package/ui/components/play-pause.d.ts.map +1 -0
  60. package/ui/components/quality-selector.d.ts +4 -0
  61. package/ui/components/quality-selector.d.ts.map +1 -0
  62. package/ui/components/stats-button.d.ts +3 -0
  63. package/ui/components/stats-button.d.ts.map +1 -0
  64. package/ui/components/volume-slider.d.ts +4 -0
  65. package/ui/components/volume-slider.d.ts.map +1 -0
  66. package/ui/components/watch-status-indicator.d.ts +4 -0
  67. package/ui/components/watch-status-indicator.d.ts.map +1 -0
  68. package/ui/element.d.ts +11 -4
  69. package/ui/element.d.ts.map +1 -1
  70. package/ui/element.js +382 -0
  71. package/ui/element.js.map +1 -0
  72. package/ui/icons.d.ts +16 -0
  73. package/ui/icons.d.ts.map +1 -0
  74. package/ui/stats.d.ts +4 -0
  75. package/ui/stats.d.ts.map +1 -0
  76. package/video/backend.d.ts +1 -1
  77. package/video/backend.d.ts.map +1 -1
  78. package/video/decoder.d.ts +1 -1
  79. package/video/decoder.d.ts.map +1 -1
  80. package/video/mse.d.ts +1 -1
  81. package/video/mse.d.ts.map +1 -1
  82. package/video/renderer.d.ts +1 -1
  83. package/video/renderer.d.ts.map +1 -1
  84. package/video/source.d.ts +2 -0
  85. package/video/source.d.ts.map +1 -1
  86. package/broadcast-b74Ew4Ql.js.map +0 -1
  87. package/ui/components/BufferControl.d.ts +0 -8
  88. package/ui/components/BufferControl.d.ts.map +0 -1
  89. package/ui/components/BufferingIndicator.d.ts +0 -2
  90. package/ui/components/BufferingIndicator.d.ts.map +0 -1
  91. package/ui/components/FullscreenButton.d.ts +0 -2
  92. package/ui/components/FullscreenButton.d.ts.map +0 -1
  93. package/ui/components/PlayPauseButton.d.ts +0 -2
  94. package/ui/components/PlayPauseButton.d.ts.map +0 -1
  95. package/ui/components/QualitySelector.d.ts +0 -3
  96. package/ui/components/QualitySelector.d.ts.map +0 -1
  97. package/ui/components/StatsButton.d.ts +0 -5
  98. package/ui/components/StatsButton.d.ts.map +0 -1
  99. package/ui/components/VolumeSlider.d.ts +0 -2
  100. package/ui/components/VolumeSlider.d.ts.map +0 -1
  101. package/ui/components/WatchControls.d.ts +0 -2
  102. package/ui/components/WatchControls.d.ts.map +0 -1
  103. package/ui/components/WatchStatusIndicator.d.ts +0 -2
  104. package/ui/components/WatchStatusIndicator.d.ts.map +0 -1
  105. package/ui/context.d.ts +0 -44
  106. package/ui/context.d.ts.map +0 -1
  107. package/ui/hooks/use-watch-ui.d.ts +0 -3
  108. package/ui/hooks/use-watch-ui.d.ts.map +0 -1
  109. package/ui/index.d.ts +0 -7
  110. package/ui/index.d.ts.map +0 -1
  111. package/ui/index.js +0 -1065
  112. package/ui/index.js.map +0 -1
package/ui/index.js DELETED
@@ -1,1065 +0,0 @@
1
- import { Button as ct, Icon as L, Stats as Nt } from "@moq/ui-core";
2
- import { Signals as Ut } from "@moq/hang";
3
- const Kt = !1, Dt = (t, e) => t === e, Ht = /* @__PURE__ */ Symbol("solid-track"), rt = {
4
- equals: Dt
5
- };
6
- let Mt = Vt;
7
- const B = 1, at = 2, Rt = {
8
- owned: null,
9
- cleanups: null,
10
- context: null,
11
- owner: null
12
- };
13
- var p = null;
14
- let gt = null, Gt = null, v = null, C = null, j = null, ut = 0;
15
- function nt(t, e) {
16
- const n = v, a = p, r = t.length === 0, o = e === void 0 ? a : e, s = r ? Rt : {
17
- owned: null,
18
- cleanups: null,
19
- context: o ? o.context : null,
20
- owner: o
21
- }, i = r ? t : () => t(() => I(() => Q(s)));
22
- p = s, v = null;
23
- try {
24
- return J(i, !0);
25
- } finally {
26
- v = n, p = a;
27
- }
28
- }
29
- function E(t, e) {
30
- e = e ? Object.assign({}, rt, e) : rt;
31
- const n = {
32
- value: t,
33
- observers: null,
34
- observerSlots: null,
35
- comparator: e.equals || void 0
36
- }, a = (r) => (typeof r == "function" && (r = r(n.value)), It(n, r));
37
- return [Tt.bind(n), a];
38
- }
39
- function T(t, e, n) {
40
- const a = kt(t, e, !1, B);
41
- X(a);
42
- }
43
- function Wt(t, e, n) {
44
- Mt = te;
45
- const a = kt(t, e, !1, B);
46
- a.user = !0, j ? j.push(a) : X(a);
47
- }
48
- function O(t, e, n) {
49
- n = n ? Object.assign({}, rt, n) : rt;
50
- const a = kt(t, e, !0, 0);
51
- return a.observers = null, a.observerSlots = null, a.comparator = n.equals || void 0, X(a), Tt.bind(a);
52
- }
53
- function I(t) {
54
- if (v === null) return t();
55
- const e = v;
56
- v = null;
57
- try {
58
- return t();
59
- } finally {
60
- v = e;
61
- }
62
- }
63
- function Lt(t) {
64
- Wt(() => I(t));
65
- }
66
- function ft(t) {
67
- return p === null || (p.cleanups === null ? p.cleanups = [t] : p.cleanups.push(t)), t;
68
- }
69
- function Qt() {
70
- return p;
71
- }
72
- function Xt(t, e) {
73
- const n = /* @__PURE__ */ Symbol("context");
74
- return {
75
- id: n,
76
- Provider: ne(n),
77
- defaultValue: t
78
- };
79
- }
80
- function jt(t) {
81
- let e;
82
- return p && p.context && (e = p.context[t.id]) !== void 0 ? e : t.defaultValue;
83
- }
84
- function Jt(t) {
85
- const e = O(t), n = O(() => wt(e()));
86
- return n.toArray = () => {
87
- const a = n();
88
- return Array.isArray(a) ? a : a != null ? [a] : [];
89
- }, n;
90
- }
91
- function Tt() {
92
- if (this.sources && this.state)
93
- if (this.state === B) X(this);
94
- else {
95
- const t = C;
96
- C = null, J(() => it(this), !1), C = t;
97
- }
98
- if (v) {
99
- const t = this.observers ? this.observers.length : 0;
100
- v.sources ? (v.sources.push(this), v.sourceSlots.push(t)) : (v.sources = [this], v.sourceSlots = [t]), this.observers ? (this.observers.push(v), this.observerSlots.push(v.sources.length - 1)) : (this.observers = [v], this.observerSlots = [v.sources.length - 1]);
101
- }
102
- return this.value;
103
- }
104
- function It(t, e, n) {
105
- let a = t.value;
106
- return (!t.comparator || !t.comparator(a, e)) && (t.value = e, t.observers && t.observers.length && J(() => {
107
- for (let r = 0; r < t.observers.length; r += 1) {
108
- const o = t.observers[r], s = gt && gt.running;
109
- s && gt.disposed.has(o), (s ? !o.tState : !o.state) && (o.pure ? C.push(o) : j.push(o), o.observers && zt(o)), s || (o.state = B);
110
- }
111
- if (C.length > 1e6)
112
- throw C = [], new Error();
113
- }, !1)), e;
114
- }
115
- function X(t) {
116
- if (!t.fn) return;
117
- Q(t);
118
- const e = ut;
119
- Zt(t, t.value, e);
120
- }
121
- function Zt(t, e, n) {
122
- let a;
123
- const r = p, o = v;
124
- v = p = t;
125
- try {
126
- a = t.fn(e);
127
- } catch (s) {
128
- return t.pure && (t.state = B, t.owned && t.owned.forEach(Q), t.owned = null), t.updatedAt = n + 1, Ot(s);
129
- } finally {
130
- v = o, p = r;
131
- }
132
- (!t.updatedAt || t.updatedAt <= n) && (t.updatedAt != null && "observers" in t ? It(t, a) : t.value = a, t.updatedAt = n);
133
- }
134
- function kt(t, e, n, a = B, r) {
135
- const o = {
136
- fn: t,
137
- state: a,
138
- updatedAt: null,
139
- owned: null,
140
- sources: null,
141
- sourceSlots: null,
142
- cleanups: null,
143
- value: e,
144
- owner: p,
145
- context: p ? p.context : null,
146
- pure: n
147
- };
148
- return p === null || p !== Rt && (p.owned ? p.owned.push(o) : p.owned = [o]), o;
149
- }
150
- function ot(t) {
151
- if (t.state === 0) return;
152
- if (t.state === at) return it(t);
153
- if (t.suspense && I(t.suspense.inFallback)) return t.suspense.effects.push(t);
154
- const e = [t];
155
- for (; (t = t.owner) && (!t.updatedAt || t.updatedAt < ut); )
156
- t.state && e.push(t);
157
- for (let n = e.length - 1; n >= 0; n--)
158
- if (t = e[n], t.state === B)
159
- X(t);
160
- else if (t.state === at) {
161
- const a = C;
162
- C = null, J(() => it(t, e[0]), !1), C = a;
163
- }
164
- }
165
- function J(t, e) {
166
- if (C) return t();
167
- let n = !1;
168
- e || (C = []), j ? n = !0 : j = [], ut++;
169
- try {
170
- const a = t();
171
- return Yt(n), a;
172
- } catch (a) {
173
- n || (j = null), C = null, Ot(a);
174
- }
175
- }
176
- function Yt(t) {
177
- if (C && (Vt(C), C = null), t) return;
178
- const e = j;
179
- j = null, e.length && J(() => Mt(e), !1);
180
- }
181
- function Vt(t) {
182
- for (let e = 0; e < t.length; e++) ot(t[e]);
183
- }
184
- function te(t) {
185
- let e, n = 0;
186
- for (e = 0; e < t.length; e++) {
187
- const a = t[e];
188
- a.user ? t[n++] = a : ot(a);
189
- }
190
- for (e = 0; e < n; e++) ot(t[e]);
191
- }
192
- function it(t, e) {
193
- t.state = 0;
194
- for (let n = 0; n < t.sources.length; n += 1) {
195
- const a = t.sources[n];
196
- if (a.sources) {
197
- const r = a.state;
198
- r === B ? a !== e && (!a.updatedAt || a.updatedAt < ut) && ot(a) : r === at && it(a, e);
199
- }
200
- }
201
- }
202
- function zt(t) {
203
- for (let e = 0; e < t.observers.length; e += 1) {
204
- const n = t.observers[e];
205
- n.state || (n.state = at, n.pure ? C.push(n) : j.push(n), n.observers && zt(n));
206
- }
207
- }
208
- function Q(t) {
209
- let e;
210
- if (t.sources)
211
- for (; t.sources.length; ) {
212
- const n = t.sources.pop(), a = t.sourceSlots.pop(), r = n.observers;
213
- if (r && r.length) {
214
- const o = r.pop(), s = n.observerSlots.pop();
215
- a < r.length && (o.sourceSlots[s] = a, r[a] = o, n.observerSlots[a] = s);
216
- }
217
- }
218
- if (t.tOwned) {
219
- for (e = t.tOwned.length - 1; e >= 0; e--) Q(t.tOwned[e]);
220
- delete t.tOwned;
221
- }
222
- if (t.owned) {
223
- for (e = t.owned.length - 1; e >= 0; e--) Q(t.owned[e]);
224
- t.owned = null;
225
- }
226
- if (t.cleanups) {
227
- for (e = t.cleanups.length - 1; e >= 0; e--) t.cleanups[e]();
228
- t.cleanups = null;
229
- }
230
- t.state = 0;
231
- }
232
- function ee(t) {
233
- return t instanceof Error ? t : new Error(typeof t == "string" ? t : "Unknown error", {
234
- cause: t
235
- });
236
- }
237
- function Ot(t, e = p) {
238
- throw ee(t);
239
- }
240
- function wt(t) {
241
- if (typeof t == "function" && !t.length) return wt(t());
242
- if (Array.isArray(t)) {
243
- const e = [];
244
- for (let n = 0; n < t.length; n++) {
245
- const a = wt(t[n]);
246
- Array.isArray(a) ? e.push.apply(e, a) : e.push(a);
247
- }
248
- return e;
249
- }
250
- return t;
251
- }
252
- function ne(t, e) {
253
- return function(a) {
254
- let r;
255
- return T(() => r = I(() => (p.context = {
256
- ...p.context,
257
- [t]: a.value
258
- }, Jt(() => a.children))), void 0), r;
259
- };
260
- }
261
- const re = /* @__PURE__ */ Symbol("fallback");
262
- function At(t) {
263
- for (let e = 0; e < t.length; e++) t[e]();
264
- }
265
- function ae(t, e, n = {}) {
266
- let a = [], r = [], o = [], s = 0, i = e.length > 1 ? [] : null;
267
- return ft(() => At(o)), () => {
268
- let c = t() || [], u = c.length, f, l;
269
- return c[Ht], I(() => {
270
- let x, A, y, P, $, m, h, d, _;
271
- if (u === 0)
272
- s !== 0 && (At(o), o = [], a = [], r = [], s = 0, i && (i = [])), n.fallback && (a = [re], r[0] = nt((q) => (o[0] = q, n.fallback())), s = 1);
273
- else if (s === 0) {
274
- for (r = new Array(u), l = 0; l < u; l++)
275
- a[l] = c[l], r[l] = nt(S);
276
- s = u;
277
- } else {
278
- for (y = new Array(u), P = new Array(u), i && ($ = new Array(u)), m = 0, h = Math.min(s, u); m < h && a[m] === c[m]; m++) ;
279
- for (h = s - 1, d = u - 1; h >= m && d >= m && a[h] === c[d]; h--, d--)
280
- y[d] = r[h], P[d] = o[h], i && ($[d] = i[h]);
281
- for (x = /* @__PURE__ */ new Map(), A = new Array(d + 1), l = d; l >= m; l--)
282
- _ = c[l], f = x.get(_), A[l] = f === void 0 ? -1 : f, x.set(_, l);
283
- for (f = m; f <= h; f++)
284
- _ = a[f], l = x.get(_), l !== void 0 && l !== -1 ? (y[l] = r[f], P[l] = o[f], i && ($[l] = i[f]), l = A[l], x.set(_, l)) : o[f]();
285
- for (l = m; l < u; l++)
286
- l in y ? (r[l] = y[l], o[l] = P[l], i && (i[l] = $[l], i[l](l))) : r[l] = nt(S);
287
- r = r.slice(0, s = u), a = c.slice(0);
288
- }
289
- return r;
290
- });
291
- function S(x) {
292
- if (o[l] = x, i) {
293
- const [A, y] = E(l);
294
- return i[l] = y, e(c[l], A);
295
- }
296
- return e(c[l]);
297
- }
298
- };
299
- }
300
- function g(t, e) {
301
- return I(() => t(e || {}));
302
- }
303
- const oe = (t) => `Stale read from <${t}>.`;
304
- function ie(t) {
305
- const e = "fallback" in t && {
306
- fallback: () => t.fallback
307
- };
308
- return O(ae(() => t.each, t.children, e || void 0));
309
- }
310
- function Z(t) {
311
- const e = t.keyed, n = O(() => t.when, void 0, void 0), a = e ? n : O(n, void 0, {
312
- equals: (r, o) => !r == !o
313
- });
314
- return O(() => {
315
- const r = a();
316
- if (r) {
317
- const o = t.children;
318
- return typeof o == "function" && o.length > 0 ? I(() => o(e ? r : () => {
319
- if (!I(a)) throw oe("Show");
320
- return n();
321
- })) : o;
322
- }
323
- return t.fallback;
324
- }, void 0, void 0);
325
- }
326
- const mt = (t) => O(() => t());
327
- function se(t, e, n) {
328
- let a = n.length, r = e.length, o = a, s = 0, i = 0, c = e[r - 1].nextSibling, u = null;
329
- for (; s < r || i < o; ) {
330
- if (e[s] === n[i]) {
331
- s++, i++;
332
- continue;
333
- }
334
- for (; e[r - 1] === n[o - 1]; )
335
- r--, o--;
336
- if (r === s) {
337
- const f = o < a ? i ? n[i - 1].nextSibling : n[o - i] : c;
338
- for (; i < o; ) t.insertBefore(n[i++], f);
339
- } else if (o === i)
340
- for (; s < r; )
341
- (!u || !u.has(e[s])) && e[s].remove(), s++;
342
- else if (e[s] === n[o - 1] && n[i] === e[r - 1]) {
343
- const f = e[--r].nextSibling;
344
- t.insertBefore(n[i++], e[s++].nextSibling), t.insertBefore(n[--o], f), e[r] = n[o];
345
- } else {
346
- if (!u) {
347
- u = /* @__PURE__ */ new Map();
348
- let l = i;
349
- for (; l < o; ) u.set(n[l], l++);
350
- }
351
- const f = u.get(e[s]);
352
- if (f != null)
353
- if (i < f && f < o) {
354
- let l = s, S = 1, x;
355
- for (; ++l < r && l < o && !((x = u.get(e[l])) == null || x !== f + S); )
356
- S++;
357
- if (S > f - i) {
358
- const A = e[s];
359
- for (; i < f; ) t.insertBefore(n[i++], A);
360
- } else t.replaceChild(n[i++], e[s++]);
361
- } else s++;
362
- else e[s++].remove();
363
- }
364
- }
365
- }
366
- const $t = "_$DX_DELEGATE";
367
- function R(t, e, n, a) {
368
- let r;
369
- const o = () => {
370
- const i = document.createElement("template");
371
- return i.innerHTML = t, i.content.firstChild;
372
- }, s = () => (r || (r = o())).cloneNode(!0);
373
- return s.cloneNode = s, s;
374
- }
375
- function le(t, e = window.document) {
376
- const n = e[$t] || (e[$t] = /* @__PURE__ */ new Set());
377
- for (let a = 0, r = t.length; a < r; a++) {
378
- const o = t[a];
379
- n.has(o) || (n.add(o), e.addEventListener(o, ue));
380
- }
381
- }
382
- function pt(t, e, n) {
383
- n == null ? t.removeAttribute(e) : t.setAttribute(e, n);
384
- }
385
- function yt(t, e) {
386
- e == null ? t.removeAttribute("class") : t.className = e;
387
- }
388
- function ce(t, e, n) {
389
- n != null ? t.style.setProperty(e, n) : t.style.removeProperty(e);
390
- }
391
- function _t(t, e, n) {
392
- return I(() => t(e, n));
393
- }
394
- function w(t, e, n, a) {
395
- if (n !== void 0 && !a && (a = []), typeof e != "function") return st(t, e, a, n);
396
- T((r) => st(t, e(), r, n), a);
397
- }
398
- function ue(t) {
399
- let e = t.target;
400
- const n = `$$${t.type}`, a = t.target, r = t.currentTarget, o = (c) => Object.defineProperty(t, "target", {
401
- configurable: !0,
402
- value: c
403
- }), s = () => {
404
- const c = e[n];
405
- if (c && !e.disabled) {
406
- const u = e[`${n}Data`];
407
- if (u !== void 0 ? c.call(e, u, t) : c.call(e, t), t.cancelBubble) return;
408
- }
409
- return e.host && typeof e.host != "string" && !e.host._$host && e.contains(t.target) && o(e.host), !0;
410
- }, i = () => {
411
- for (; s() && (e = e._$host || e.parentNode || e.host); ) ;
412
- };
413
- if (Object.defineProperty(t, "currentTarget", {
414
- configurable: !0,
415
- get() {
416
- return e || document;
417
- }
418
- }), t.composedPath) {
419
- const c = t.composedPath();
420
- o(c[0]);
421
- for (let u = 0; u < c.length - 2 && (e = c[u], !!s()); u++) {
422
- if (e._$host) {
423
- e = e._$host, i();
424
- break;
425
- }
426
- if (e.parentNode === r)
427
- break;
428
- }
429
- } else i();
430
- o(a);
431
- }
432
- function st(t, e, n, a, r) {
433
- for (; typeof n == "function"; ) n = n();
434
- if (e === n) return n;
435
- const o = typeof e, s = a !== void 0;
436
- if (t = s && n[0] && n[0].parentNode || t, o === "string" || o === "number") {
437
- if (o === "number" && (e = e.toString(), e === n))
438
- return n;
439
- if (s) {
440
- let i = n[0];
441
- i && i.nodeType === 3 ? i.data !== e && (i.data = e) : i = document.createTextNode(e), n = G(t, n, a, i);
442
- } else
443
- n !== "" && typeof n == "string" ? n = t.firstChild.data = e : n = t.textContent = e;
444
- } else if (e == null || o === "boolean")
445
- n = G(t, n, a);
446
- else {
447
- if (o === "function")
448
- return T(() => {
449
- let i = e();
450
- for (; typeof i == "function"; ) i = i();
451
- n = st(t, i, n, a);
452
- }), () => n;
453
- if (Array.isArray(e)) {
454
- const i = [], c = n && Array.isArray(n);
455
- if (xt(i, e, n, r))
456
- return T(() => n = st(t, i, n, a, !0)), () => n;
457
- if (i.length === 0) {
458
- if (n = G(t, n, a), s) return n;
459
- } else c ? n.length === 0 ? Et(t, i, a) : se(t, n, i) : (n && G(t), Et(t, i));
460
- n = i;
461
- } else if (e.nodeType) {
462
- if (Array.isArray(n)) {
463
- if (s) return n = G(t, n, a, e);
464
- G(t, n, null, e);
465
- } else n == null || n === "" || !t.firstChild ? t.appendChild(e) : t.replaceChild(e, t.firstChild);
466
- n = e;
467
- }
468
- }
469
- return n;
470
- }
471
- function xt(t, e, n, a) {
472
- let r = !1;
473
- for (let o = 0, s = e.length; o < s; o++) {
474
- let i = e[o], c = n && n[t.length], u;
475
- if (!(i == null || i === !0 || i === !1)) if ((u = typeof i) == "object" && i.nodeType)
476
- t.push(i);
477
- else if (Array.isArray(i))
478
- r = xt(t, i, c) || r;
479
- else if (u === "function")
480
- if (a) {
481
- for (; typeof i == "function"; ) i = i();
482
- r = xt(t, Array.isArray(i) ? i : [i], Array.isArray(c) ? c : [c]) || r;
483
- } else
484
- t.push(i), r = !0;
485
- else {
486
- const f = String(i);
487
- c && c.nodeType === 3 && c.data === f ? t.push(c) : t.push(document.createTextNode(f));
488
- }
489
- }
490
- return r;
491
- }
492
- function Et(t, e, n = null) {
493
- for (let a = 0, r = e.length; a < r; a++) t.insertBefore(e[a], n);
494
- }
495
- function G(t, e, n, a) {
496
- if (n === void 0) return t.textContent = "";
497
- const r = a || document.createTextNode("");
498
- if (e.length) {
499
- let o = !1;
500
- for (let s = e.length - 1; s >= 0; s--) {
501
- const i = e[s];
502
- if (r !== i) {
503
- const c = i.parentNode === t;
504
- !o && !s ? c ? t.replaceChild(r, i) : t.insertBefore(r, n) : c && i.remove();
505
- } else o = !0;
506
- }
507
- } else t.insertBefore(r, n);
508
- return [r];
509
- }
510
- function fe(t) {
511
- return Object.keys(t).reduce((n, a) => {
512
- const r = t[a];
513
- return n[a] = Object.assign({}, r), Ft(r.value) && !_e(r.value) && !Array.isArray(r.value) && (n[a].value = Object.assign({}, r.value)), Array.isArray(r.value) && (n[a].value = r.value.slice(0)), n;
514
- }, {});
515
- }
516
- function de(t) {
517
- return t ? Object.keys(t).reduce((n, a) => {
518
- const r = t[a];
519
- return n[a] = Ft(r) && "value" in r ? r : {
520
- value: r
521
- }, n[a].attribute || (n[a].attribute = pe(a)), n[a].parse = "parse" in n[a] ? n[a].parse : typeof n[a].value != "string", n;
522
- }, {}) : {};
523
- }
524
- function he(t) {
525
- return Object.keys(t).reduce((n, a) => (n[a] = t[a].value, n), {});
526
- }
527
- function ge(t, e) {
528
- const n = fe(e);
529
- return Object.keys(e).forEach((r) => {
530
- const o = n[r], s = t.getAttribute(o.attribute), i = t[r];
531
- s != null && (o.value = o.parse ? Bt(s) : s), i != null && (o.value = Array.isArray(i) ? i.slice(0) : i), o.reflect && Pt(t, o.attribute, o.value, !!o.parse), Object.defineProperty(t, r, {
532
- get() {
533
- return o.value;
534
- },
535
- set(c) {
536
- const u = o.value;
537
- o.value = c, o.reflect && Pt(this, o.attribute, o.value, !!o.parse);
538
- for (let f = 0, l = this.__propertyChangedCallbacks.length; f < l; f++)
539
- this.__propertyChangedCallbacks[f](r, c, u);
540
- },
541
- enumerable: !0,
542
- configurable: !0
543
- });
544
- }), n;
545
- }
546
- function Bt(t) {
547
- if (t)
548
- try {
549
- return JSON.parse(t);
550
- } catch {
551
- return t;
552
- }
553
- }
554
- function Pt(t, e, n, a) {
555
- if (n == null || n === !1) return t.removeAttribute(e);
556
- let r = a ? JSON.stringify(n) : n;
557
- t.__updating[e] = !0, r === "true" && (r = ""), t.setAttribute(e, r), Promise.resolve().then(() => delete t.__updating[e]);
558
- }
559
- function pe(t) {
560
- return t.replace(/\.?([A-Z]+)/g, (e, n) => "-" + n.toLowerCase()).replace("_", "-").replace(/^-/, "");
561
- }
562
- function Ft(t) {
563
- return t != null && (typeof t == "object" || typeof t == "function");
564
- }
565
- function _e(t) {
566
- return Object.prototype.toString.call(t) === "[object Function]";
567
- }
568
- function be(t) {
569
- return typeof t == "function" && t.toString().indexOf("class") === 0;
570
- }
571
- let bt;
572
- function ve(t, e) {
573
- const n = Object.keys(e);
574
- return class extends t {
575
- static get observedAttributes() {
576
- return n.map((r) => e[r].attribute);
577
- }
578
- constructor() {
579
- super(), this.__initialized = !1, this.__released = !1, this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props = {};
580
- for (let r of n)
581
- this[r] = void 0;
582
- }
583
- connectedCallback() {
584
- if (this.__initialized) return;
585
- this.__releaseCallbacks = [], this.__propertyChangedCallbacks = [], this.__updating = {}, this.props = ge(this, e);
586
- const r = he(this.props), o = this.Component, s = bt;
587
- try {
588
- bt = this, this.__initialized = !0, be(o) ? new o(r, {
589
- element: this
590
- }) : o(r, {
591
- element: this
592
- });
593
- } finally {
594
- bt = s;
595
- }
596
- }
597
- async disconnectedCallback() {
598
- if (await Promise.resolve(), this.isConnected) return;
599
- this.__propertyChangedCallbacks.length = 0;
600
- let r = null;
601
- for (; r = this.__releaseCallbacks.pop(); ) r(this);
602
- delete this.__initialized, this.__released = !0;
603
- }
604
- attributeChangedCallback(r, o, s) {
605
- if (this.__initialized && !this.__updating[r] && (r = this.lookupProp(r), r in e)) {
606
- if (s == null && !this[r]) return;
607
- this[r] = e[r].parse ? Bt(s) : s;
608
- }
609
- }
610
- lookupProp(r) {
611
- if (e)
612
- return n.find((o) => r === o || r === e[o].attribute);
613
- }
614
- get renderRoot() {
615
- return this.shadowRoot || this.attachShadow({
616
- mode: "open"
617
- });
618
- }
619
- addReleaseCallback(r) {
620
- this.__releaseCallbacks.push(r);
621
- }
622
- addPropertyChangedCallback(r) {
623
- this.__propertyChangedCallbacks.push(r);
624
- }
625
- };
626
- }
627
- function we(t, e = {}, n = {}) {
628
- const {
629
- BaseElement: a = HTMLElement,
630
- extension: r,
631
- customElements: o = window.customElements
632
- } = n;
633
- return (s) => {
634
- let i = o.get(t);
635
- return i ? (i.prototype.Component = s, i) : (i = ve(a, de(e)), i.prototype.Component = s, i.prototype.registeredTag = t, o.define(t, i, r), i);
636
- };
637
- }
638
- function me(t) {
639
- const e = Object.keys(t), n = {};
640
- for (let a = 0; a < e.length; a++) {
641
- const [r, o] = E(t[e[a]]);
642
- Object.defineProperty(n, e[a], {
643
- get: r,
644
- set(s) {
645
- o(() => s);
646
- }
647
- });
648
- }
649
- return n;
650
- }
651
- function ye(t) {
652
- if (t.assignedSlot && t.assignedSlot._$owner) return t.assignedSlot._$owner;
653
- let e = t.parentNode;
654
- for (; e && !e._$owner && !(e.assignedSlot && e.assignedSlot._$owner); )
655
- e = e.parentNode;
656
- return e && e.assignedSlot ? e.assignedSlot._$owner : t._$owner;
657
- }
658
- function xe(t) {
659
- return (e, n) => {
660
- const { element: a } = n;
661
- return nt((r) => {
662
- const o = me(e);
663
- a.addPropertyChangedCallback((i, c) => o[i] = c), a.addReleaseCallback(() => {
664
- a.renderRoot.textContent = "", r();
665
- });
666
- const s = t(o, n);
667
- return w(a.renderRoot, s);
668
- }, ye(a));
669
- };
670
- }
671
- function ke(t, e, n) {
672
- return arguments.length === 2 && (n = e, e = {}), we(t, e)(xe(n));
673
- }
674
- function U(t) {
675
- const [e, n] = E(t.peek(), { equals: !1 }), a = t.subscribe((r) => n(() => r));
676
- return ft(() => a()), e;
677
- }
678
- const lt = Xt();
679
- function Ce(t) {
680
- const [e, n] = E("no-url"), [a, r] = E(!1), o = U(t.moqWatch.backend.audio.muted), [s, i] = E(0), c = U(t.moqWatch.backend.video.stalled), u = U(t.moqWatch.backend.latency), f = U(t.moqWatch.backend.jitter), [l, S] = E([]), x = U(t.moqWatch.backend.video.source.track), [A, y] = E(!1), [P, $] = E(!!document.fullscreenElement), m = () => {
681
- t.moqWatch.paused = !t.moqWatch.paused;
682
- }, h = () => {
683
- document.fullscreenElement ? document.exitFullscreen() : t.moqWatch.requestFullscreen();
684
- }, d = (b) => {
685
- t.moqWatch.backend.audio.volume.set(b / 100);
686
- }, _ = () => {
687
- t.moqWatch.backend.audio.muted.update((b) => !b);
688
- }, q = (b) => {
689
- t.moqWatch.latency = b;
690
- }, N = (b) => {
691
- t.moqWatch.backend.video.source.target.update((M) => ({
692
- ...M,
693
- name: b
694
- }));
695
- }, K = () => t.moqWatch.backend.sync.now(), D = U(t.moqWatch.backend.video.buffered), dt = U(t.moqWatch.backend.audio.buffered), Y = {
696
- moqWatch: t.moqWatch,
697
- watchStatus: e,
698
- togglePlayback: m,
699
- isPlaying: a,
700
- setVolume: d,
701
- isMuted: o,
702
- currentVolume: s,
703
- toggleMuted: _,
704
- buffering: c,
705
- latency: u,
706
- jitter: f,
707
- setLatency: q,
708
- availableRenditions: l,
709
- activeRendition: x,
710
- setActiveRendition: N,
711
- isStatsPanelVisible: A,
712
- setIsStatsPanelVisible: y,
713
- isFullscreen: P,
714
- toggleFullscreen: h,
715
- timestamp: K,
716
- videoBuffered: D,
717
- audioBuffered: dt
718
- }, V = t.moqWatch, W = new Ut.Effect();
719
- W.run((b) => {
720
- const M = b.get(V.connection.url), z = b.get(V.connection.status), k = b.get(V.broadcast.status);
721
- M ? z === "disconnected" ? n("disconnected") : z === "connecting" ? n("connecting") : k === "offline" ? n("offline") : k === "loading" ? n("loading") : k === "live" ? n("live") : z === "connected" && n("connected") : n("no-url");
722
- }), W.run((b) => {
723
- const M = b.get(V.backend.paused);
724
- r(!M);
725
- }), W.run((b) => {
726
- const M = b.get(V.backend.audio.volume);
727
- i(M * 100);
728
- }), W.run((b) => {
729
- const z = b.get(V.backend.video.source.catalog)?.renditions ?? {}, k = Object.entries(z).map(([tt, H]) => ({
730
- name: tt,
731
- width: H.codedWidth,
732
- height: H.codedHeight,
733
- bitrate: H.bitrate
734
- }));
735
- S(k);
736
- });
737
- const ht = () => {
738
- $(!!document.fullscreenElement);
739
- };
740
- return W.event(document, "fullscreenchange", ht), ft(() => W.close()), g(lt.Provider, {
741
- value: Y,
742
- get children() {
743
- return t.children;
744
- }
745
- });
746
- }
747
- function F() {
748
- const t = jt(lt);
749
- if (!t)
750
- throw new Error("useWatchUIContext must be used within a WatchUIContextProvider");
751
- return t;
752
- }
753
- var Se = /* @__PURE__ */ R('<div class="watch-ui__buffering flex--center"><div class=watch-ui__buffering-spinner>');
754
- function Ae() {
755
- const t = F();
756
- return g(Z, {
757
- get when() {
758
- return t.buffering();
759
- },
760
- get children() {
761
- return Se();
762
- }
763
- });
764
- }
765
- var $e = /* @__PURE__ */ R('<div class=watch-ui__buffer><div role=slider tabindex=0 aria-label="Buffer jitter"><div class=watch-ui__buffer-playhead></div><div class="watch-ui__buffer-track watch-ui__buffer-track--video"><span class=watch-ui__buffer-track-label>Video</span><canvas class=watch-ui__buffer-canvas></canvas></div><div class="watch-ui__buffer-track watch-ui__buffer-track--audio"><span class=watch-ui__buffer-track-label>Audio</span><canvas class=watch-ui__buffer-canvas></canvas></div><div class=watch-ui__buffer-target-area><div class=watch-ui__buffer-target-line><span class=watch-ui__buffer-target-label>'), Ee = /* @__PURE__ */ R("<span class=watch-ui__buffer-help>click to change latency");
766
- const vt = 0, et = 10;
767
- function qt(t, e, n, a, r) {
768
- const o = t.getContext("2d");
769
- if (!o) return;
770
- const s = window.devicePixelRatio || 1, i = t.getBoundingClientRect(), c = i.width, u = i.height, f = Math.round(c * s), l = Math.round(u * s);
771
- if ((t.width !== f || t.height !== l) && (t.width = f, t.height = l), o.setTransform(s, 0, 0, s, 0, 0), o.clearRect(0, 0, c, u), n === void 0) return;
772
- const S = 2, x = u - S * 2, A = 2;
773
- for (let y = 0; y < e.length; y++) {
774
- const P = e[y], $ = P.start - n, m = P.end - n, h = Math.max(0, $), d = Math.min(m, a);
775
- if (d <= h) continue;
776
- const _ = h / a * c, q = Math.max(2, (d - h) / a * c);
777
- if (o.globalAlpha = 0.85, o.fillStyle = r ? "#f87171" : y > 0 ? "#facc15" : "#4ade80", typeof o.roundRect == "function" ? (o.beginPath(), o.roundRect(_, S, q, x, A), o.fill()) : o.fillRect(_, S, q, x), m > a) {
778
- const N = ((m - a) / 1e3).toFixed(1);
779
- o.globalAlpha = 0.7, o.fillStyle = "black", o.font = "500 9px system-ui, sans-serif", o.textAlign = "right", o.textBaseline = "middle", o.fillText(`+${N}s`, _ + q - 4, u / 2);
780
- }
781
- }
782
- }
783
- function Pe(t) {
784
- const e = F(), n = () => t.max ?? 4e3, [a, r] = E(!1), [o, s] = E(!1), i = O(() => e.jitter() / n() * 100);
785
- let c, u, f;
786
- const l = 48, S = (h) => {
787
- if (!c) return;
788
- const d = c.getBoundingClientRect(), _ = d.width - l, N = Math.max(0, Math.min(h - d.left - l, _)) / _ * n(), K = Math.round(N / et) * et, D = Math.max(vt, Math.min(n(), K));
789
- e.setLatency(D);
790
- }, x = (h) => {
791
- r(!0), s(!0), S(h.clientX), document.addEventListener("mousemove", A), document.addEventListener("mouseup", y);
792
- }, A = (h) => {
793
- a() && S(h.clientX);
794
- }, y = () => {
795
- r(!1), document.removeEventListener("mousemove", A), document.removeEventListener("mouseup", y);
796
- }, P = (h) => {
797
- let d = 0;
798
- if (h.key === "ArrowRight" || h.key === "ArrowUp")
799
- d = et;
800
- else if (h.key === "ArrowLeft" || h.key === "ArrowDown")
801
- d = -et;
802
- else
803
- return;
804
- h.preventDefault(), s(!0);
805
- const _ = Math.max(vt, Math.min(n(), e.jitter() + d));
806
- e.setLatency(_);
807
- };
808
- let $;
809
- const m = () => {
810
- const h = n(), d = e.timestamp(), _ = e.buffering();
811
- u && qt(u, e.videoBuffered(), d, h, _), f && qt(f, e.audioBuffered(), d, h, _), $ = requestAnimationFrame(m);
812
- };
813
- return Lt(() => {
814
- $ = requestAnimationFrame(m);
815
- }), ft(() => {
816
- $ !== void 0 && cancelAnimationFrame($), document.removeEventListener("mousemove", A), document.removeEventListener("mouseup", y);
817
- }), (() => {
818
- var h = $e(), d = h.firstChild, _ = d.firstChild, q = _.nextSibling, N = q.firstChild, K = N.nextSibling, D = q.nextSibling, dt = D.firstChild, Y = dt.nextSibling, V = D.nextSibling, W = V.firstChild, ht = W.firstChild;
819
- d.$$keydown = P, d.$$mousedown = x;
820
- var b = c;
821
- typeof b == "function" ? _t(b, d) : c = d, pt(d, "aria-valuemin", vt);
822
- var M = u;
823
- typeof M == "function" ? _t(M, K) : u = K;
824
- var z = f;
825
- return typeof z == "function" ? _t(z, Y) : f = Y, w(ht, () => `${Math.round(e.jitter())}ms`), w(d, (() => {
826
- var k = mt(() => !o());
827
- return () => k() && Ee();
828
- })(), null), T((k) => {
829
- var tt = `watch-ui__buffer-visualization ${a() ? "watch-ui__buffer-visualization--dragging" : ""}`, H = e.jitter(), Ct = n(), St = `${i()}%`;
830
- return tt !== k.e && yt(d, k.e = tt), H !== k.t && pt(d, "aria-valuenow", k.t = H), Ct !== k.a && pt(d, "aria-valuemax", k.a = Ct), St !== k.o && ce(W, "left", k.o = St), k;
831
- }, {
832
- e: void 0,
833
- t: void 0,
834
- a: void 0,
835
- o: void 0
836
- }), h;
837
- })();
838
- }
839
- le(["mousedown", "keydown"]);
840
- function qe() {
841
- const t = F();
842
- return g(ct, {
843
- title: "Fullscreen",
844
- onClick: () => {
845
- t.toggleFullscreen();
846
- },
847
- get children() {
848
- return g(Z, {
849
- get when() {
850
- return t.isFullscreen();
851
- },
852
- get fallback() {
853
- return g(L.FullscreenEnter, {});
854
- },
855
- get children() {
856
- return g(L.FullscreenExit, {});
857
- }
858
- });
859
- }
860
- });
861
- }
862
- function Me() {
863
- const t = F();
864
- return g(ct, {
865
- get title() {
866
- return t.isPlaying() ? "Pause" : "Play";
867
- },
868
- class: "button--playback",
869
- onClick: () => {
870
- t.togglePlayback();
871
- },
872
- get children() {
873
- return g(Z, {
874
- get when() {
875
- return t.isPlaying();
876
- },
877
- get fallback() {
878
- return g(L.Play, {});
879
- },
880
- get children() {
881
- return g(L.Pause, {});
882
- }
883
- });
884
- }
885
- });
886
- }
887
- var Re = /* @__PURE__ */ R("<div class=watch-ui__quality-selector><label for=quality-select class=watch-ui__quality-label>Quality: </label><select id=quality-select class=watch-ui__quality-select><option value>Auto"), We = /* @__PURE__ */ R("<option>");
888
- function Le(t) {
889
- return t >= 1e6 ? `${(t / 1e6).toFixed(1)} Mbps` : t >= 1e3 ? `${(t / 1e3).toFixed(0)} kbps` : `${t} bps`;
890
- }
891
- function je() {
892
- const t = F(), e = (n) => {
893
- const a = n.currentTarget.value || void 0;
894
- t.setActiveRendition(a);
895
- };
896
- return (() => {
897
- var n = Re(), a = n.firstChild, r = a.nextSibling;
898
- return r.firstChild, r.addEventListener("change", e), w(r, g(ie, {
899
- get each() {
900
- return t.availableRenditions() ?? [];
901
- },
902
- children: (o) => (() => {
903
- var s = We();
904
- return w(s, () => o.name, null), w(s, (() => {
905
- var i = mt(() => !!(o.width && o.height));
906
- return () => i() ? ` (${o.width}x${o.height})` : "";
907
- })(), null), w(s, (() => {
908
- var i = mt(() => !!o.bitrate);
909
- return () => i() ? ` ${Le(o.bitrate)}` : "";
910
- })(), null), T(() => s.value = o.name), s;
911
- })()
912
- }), null), T(() => r.value = t.activeRendition() ?? ""), n;
913
- })();
914
- }
915
- function Te() {
916
- const t = F();
917
- return g(ct, {
918
- get title() {
919
- return t.isStatsPanelVisible() ? "Hide stats" : "Show stats";
920
- },
921
- onClick: () => {
922
- t.setIsStatsPanelVisible(!t.isStatsPanelVisible());
923
- },
924
- get children() {
925
- return g(L.Stats, {});
926
- }
927
- });
928
- }
929
- var Ie = /* @__PURE__ */ R('<div class="watch-ui__volume-slider flex--center"><input type=range min=0 max=100><span class=watch-ui__volume-label>');
930
- const Ve = (t, e) => e || t === 0 ? g(L.Mute, {}) : t > 0 && t <= 33 ? g(L.VolumeLow, {}) : t > 33 && t <= 66 ? g(L.VolumeMedium, {}) : g(L.VolumeHigh, {});
931
- function ze() {
932
- const [t, e] = E(0), n = F(), a = (r) => {
933
- const o = r.currentTarget, s = parseFloat(o.value);
934
- n.setVolume(s);
935
- };
936
- return Wt(() => {
937
- const r = n.currentVolume() || 0;
938
- e(Math.round(r));
939
- }), (() => {
940
- var r = Ie(), o = r.firstChild, s = o.nextSibling;
941
- return w(r, g(ct, {
942
- get title() {
943
- return n.isMuted() ? "Unmute" : "Mute";
944
- },
945
- onClick: () => n.toggleMuted(),
946
- get children() {
947
- return Ve(n.currentVolume(), n.isMuted());
948
- }
949
- }), o), o.addEventListener("change", a), w(s, t), T(() => o.value = n.currentVolume()), r;
950
- })();
951
- }
952
- var Oe = /* @__PURE__ */ R('<div class="watch-ui__status-indicator flex--center"><span></span><span>');
953
- const Be = {
954
- "no-url": {
955
- variant: "error",
956
- text: "No URL"
957
- },
958
- disconnected: {
959
- variant: "error",
960
- text: "Disconnected"
961
- },
962
- connecting: {
963
- variant: "connecting",
964
- text: "Connecting..."
965
- },
966
- offline: {
967
- variant: "error",
968
- text: "Offline"
969
- },
970
- loading: {
971
- variant: "loading",
972
- text: "Loading..."
973
- },
974
- live: {
975
- variant: "live",
976
- text: "Live"
977
- },
978
- connected: {
979
- variant: "connected",
980
- text: "Connected"
981
- }
982
- }, Fe = {
983
- variant: "error",
984
- text: "Unknown"
985
- };
986
- function Ne() {
987
- const t = F(), e = () => {
988
- const n = t.watchStatus();
989
- return Be[n] || Fe;
990
- };
991
- return (() => {
992
- var n = Oe(), a = n.firstChild, r = a.nextSibling;
993
- return w(r, () => e().text), T((o) => {
994
- var s = `watch-ui__status-indicator-dot watch-ui__status-indicator-dot--${e().variant}`, i = `watch-ui__status-indicator-text watch-ui__status-indicator-text--${e().variant}`;
995
- return s !== o.e && yt(a, o.e = s), i !== o.t && yt(r, o.t = i), o;
996
- }, {
997
- e: void 0,
998
- t: void 0
999
- }), n;
1000
- })();
1001
- }
1002
- var Ue = /* @__PURE__ */ R('<div class=watch-ui__controls><div class="watch-ui__playback-controls flex--align-center"></div><div class=watch-ui__latency-controls>');
1003
- function Ke() {
1004
- return (() => {
1005
- var t = Ue(), e = t.firstChild, n = e.nextSibling;
1006
- return w(e, g(Me, {}), null), w(e, g(ze, {}), null), w(e, g(Ne, {}), null), w(e, g(Te, {}), null), w(e, g(qe, {}), null), w(n, g(Pe, {}), null), w(n, g(je, {}), null), t;
1007
- })();
1008
- }
1009
- const De = ':host{--color-white: #ffffff;--color-white-alpha-05: rgba(255, 255, 255, .05);--color-white-alpha-10: rgba(255, 255, 255, .1);--color-white-alpha-15: rgba(255, 255, 255, .15);--color-white-alpha-20: rgba(255, 255, 255, .2);--color-white-alpha-25: rgba(255, 255, 255, .25);--color-white-alpha-30: rgba(255, 255, 255, .3);--color-white-alpha-70: rgba(255, 255, 255, .7);--color-white-alpha-90: rgba(255, 255, 255, .9);--color-gray-100: #9ca3af;--color-gray-950: #1a1a1a;--color-blue-400: #00dfff;--color-blue-500: #52a1ff;--color-blue-900: #1b3243;--color-purple-400: #a855f7;--color-purple-500: #c27bff;--color-purple-900: #31144a;--color-green-400: #65ee2e;--color-green-900: #3d4928;--color-yellow-400: #facc15;--color-orange-300: rgb(253, 186, 116);--color-orange-400: #ff9900;--color-orange-450: #fb923c;--color-orange-500: #f97316;--color-orange-900: #4d301b;--color-amber-600: #d97706;--color-amber-600-alpha-20: rgba(217, 119, 6, .2);--color-amber-600-alpha-30: rgba(217, 119, 6, .3);--color-orange-400-alpha-20: rgba(255, 153, 0, .2);--color-orange-500-alpha-30: rgba(249, 115, 22, .3);--color-orange-500-alpha-40: rgba(249, 115, 22, .4);--color-orange-500-alpha-50: rgba(249, 115, 22, .5);--color-orange-500-alpha-60: rgba(249, 115, 22, .6);--color-orange-500-alpha-80: rgba(249, 115, 22, .8);--color-red-300: rgb(252, 165, 165);--color-red-400-alpha-25: rgba(248, 113, 113, .25);--color-red-500-alpha-25: rgba(239, 68, 68, .25);--color-red-500-alpha-45: rgba(239, 68, 68, .45);--color-red-500-alpha-60: rgba(239, 68, 68, .6);--color-red-600-alpha-25: rgba(220, 38, 38, .25);--color-red-900-alpha-35: rgba(127, 29, 29, .35);--color-red: #e60000;--color-black-alpha-8: rgba(0, 0, 0, .08);--color-black-alpha-10: rgba(0, 0, 0, .1);--color-black-alpha-60: rgba(0, 0, 0, .6);--color-black-alpha-70: rgba(0, 0, 0, .7);--color-black-alpha-85: rgba(0, 0, 0, .85);--color-black: #000000;--spacing-1: .0625rem;--spacing-2: .125rem;--spacing-4: .25rem;--spacing-8: .5rem;--spacing-12: .75rem;--spacing-16: 1rem;--spacing-24: 1.5rem;--spacing-32: 2rem;--spacing-48: 3rem;--border-radius-sm: .5rem;--border-radius-md: .75rem;--border-radius-lg: 1rem}:is(.flex--center){display:flex;justify-content:center;align-items:center}:is(.flex--align-center){align-items:center}:is(.flex--space-between){justify-content:space-between}.button{color:var(--color-white);cursor:pointer;background-color:var(--color-white-alpha-10);border:var(--spacing-1) solid var(--color-white-alpha-20);border-radius:50%;width:2.25rem;height:2.25rem;transform-origin:center;transition:transform .1s cubic-bezier(.4,0,.2,1)}.button:hover:not(:disabled){transform:scale(1.02);color:var(--color-white);background-color:var(--color-white-alpha-20);box-shadow:0 var(--spacing-2) var(--spacing-8) var(--color-black-alpha-10)}.button:active:not(:disabled){transform:scale(.98);box-shadow:0 var(--spacing-1) var(--spacing-4) var(--color-black-alpha-8)}.button:disabled{opacity:.5;cursor:default;color:var(--color-gray-100)}.stats{display:flex;align-items:center;justify-content:center;position:absolute;inset:0;pointer-events:none;z-index:2;width:100%;height:inherit;container-type:inline-size}.stats .stats__panel{position:absolute;display:flex;align-items:flex-start;justify-content:center;flex-direction:row;flex-wrap:wrap;gap:var(--spacing-12);max-width:240px;width:100%;background-color:var(--color-black-alpha-85);border:1px solid var(--color-white-alpha-25);border-radius:8px;padding:var(--spacing-12);pointer-events:auto;top:8px}@container (width > 480px) and (width <= 768px){.stats .stats__panel{max-width:360px;padding:var(--spacing-24)}}@container (width > 768px){.stats .stats__panel{max-width:600px;padding:var(--spacing-24)}}.stats .stats__panel .stats__item{display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:row;height:auto;column-gap:var(--spacing-8);flex-basis:calc(50% - var(--spacing-12));flex-grow:1;flex-shrink:1}@container (width > 480px){.stats .stats__panel .stats__item{flex-basis:calc(25% - var(--spacing-12))}}.stats .stats__panel .stats__item .stats__icon-wrapper{display:none;padding:var(--spacing-8);border-radius:8px;width:fit-content;height:fit-content;flex-shrink:0}@container (width > 480px){.stats .stats__panel .stats__item .stats__icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-direction:row}}.stats .stats__panel .stats__item .stats__icon-wrapper svg{width:100%;height:100%}.stats .stats__panel .stats__item.stats__item--network .stats__icon-wrapper{background-color:var(--color-blue-900)}.stats .stats__panel .stats__item.stats__item--network,.stats .stats__panel .stats__item.stats__item--network .stats__item-data{color:var(--color-blue-400)}.stats .stats__panel .stats__item.stats__item--video .stats__icon-wrapper{background-color:var(--color-purple-900)}.stats .stats__panel .stats__item.stats__item--video,.stats .stats__panel .stats__item.stats__item--video .stats__item-data{color:var(--color-purple-400)}.stats .stats__panel .stats__item.stats__item--audio .stats__icon-wrapper{background-color:var(--color-green-900)}.stats .stats__panel .stats__item.stats__item--audio,.stats .stats__panel .stats__item.stats__item--audio .stats__item-data{color:var(--color-green-400)}.stats .stats__panel .stats__item.stats__item--buffer .stats__icon-wrapper{background-color:var(--color-orange-900)}.stats .stats__panel .stats__item.stats__item--buffer,.stats .stats__panel .stats__item.stats__item--buffer .stats__item-data{color:var(--color-orange-400)}.stats .stats__panel .stats__item .stats__item-detail{display:flex;align-items:flex-start;justify-content:space-evenly;flex-direction:column;gap:var(--spacing-4)}.stats .stats__panel .stats__item .stats__item-detail .stats__item-title{font-size:12px;font-weight:500;text-transform:capitalize;color:var(--color-gray-100);font-family:Segoe UI,Roboto,sans-serif;letter-spacing:1px;line-height:12px}.stats .stats__panel .stats__item .stats__item-detail .stats__item-data{font-size:16px;font-weight:700;font-family:Segoe UI,Roboto,sans-serif;white-space:pre-wrap;line-height:1.5}.watch-ui__video-container{display:block;position:relative;width:100%;height:auto;border-radius:var(--spacing-4);margin:0 auto;pointer-events:none}.watch-ui__controls{display:flex;flex-direction:column;gap:var(--spacing-24)}.button.button--playback{width:3rem;height:3rem;background:linear-gradient(to bottom right,var(--color-orange-400),var(--color-orange-500),var(--color-amber-600));box-shadow:0 0 var(--spacing-16) var(--color-orange-500-alpha-60);transition:box-shadow .15s cubic-bezier(.4,0,.2,1);position:relative;overflow:hidden}.button.button--playback:hover:not(:disabled){box-shadow:0 0 var(--spacing-24) var(--color-orange-500-alpha-80);transform:scale(1.02)}.button.button--playback:active:not(:disabled){transform:scale(.98)}.button.button--playback:before{content:"";position:absolute;inset:0;background:linear-gradient(to bottom right,var(--color-white-alpha-30),transparent);opacity:0;transition:opacity .15s cubic-bezier(.4,0,.2,1);pointer-events:none}.button.button--playback:hover:before{opacity:1}.button.button--playback:after{content:"";position:absolute;inset:0;background-color:var(--color-white-alpha-20);border-radius:50%;filter:blur(var(--spacing-24));pointer-events:none}.watch-ui__playback-controls{display:flex;place-content:center space-around;gap:var(--spacing-8);padding:var(--spacing-8) 0}.watch-ui__latency-controls{display:flex;flex-direction:column;gap:var(--spacing-16)}.watch-ui__volume-slider{gap:var(--spacing-4)}.watch-ui__volume-label{width:var(--spacing-16);text-align:right}.watch-ui__quality-selector{display:flex;align-items:center;gap:var(--spacing-8);background:transparent;border-radius:var(--spacing-8)}.watch-ui__quality-label{font-size:1.25rem;font-weight:500;color:var(--color-white);white-space:nowrap}.watch-ui__quality-select{flex:0 1 auto;font-size:1rem;padding:var(--spacing-8);border-radius:var(--spacing-4);background:var(--color-white-alpha-10);color:var(--color-white);border:var(--spacing-1) solid var(--color-white-alpha-20);cursor:pointer;transition:background .2s ease}.watch-ui__quality-select:hover{background:var(--color-white-alpha-15)}.watch-ui__quality-select:focus{outline:var(--spacing-2) solid var(--color-white-alpha-30);outline-offset:var(--spacing-2)}.watch-ui__quality-select option{background:var(--color-gray-950);color:var(--color-white)}.watch-ui__buffer{width:100%}.watch-ui__buffer-visualization{position:relative;width:100%;height:3.75rem;background:var(--color-white-alpha-10);border-radius:var(--spacing-4);cursor:pointer;user-select:none;padding-left:var(--spacing-48);box-sizing:border-box}.watch-ui__buffer-playhead{position:absolute;left:var(--spacing-48);top:0;bottom:0;width:var(--spacing-2);background:var(--color-white);z-index:3}.watch-ui__buffer-track{display:flex;align-items:center;position:absolute;left:var(--spacing-48);right:0;height:var(--spacing-24)}.watch-ui__buffer-track--video{top:var(--spacing-4)}.watch-ui__buffer-track--audio{top:var(--spacing-32)}.watch-ui__buffer-track-label{position:absolute;left:-2.875rem;width:2.5rem;font-size:.625rem;color:var(--color-white-alpha-70);text-align:right;padding-right:var(--spacing-4);pointer-events:none;box-sizing:border-box}.watch-ui__buffer-canvas{position:absolute;top:0;left:0;width:100%;height:100%}.watch-ui__buffer-target-area{position:absolute;top:0;bottom:0;left:var(--spacing-48);right:0;pointer-events:none}.watch-ui__buffer-target-line{position:absolute;top:0;bottom:0;width:.1875rem;background:var(--color-orange-400, var(--color-orange-450));z-index:2;cursor:ew-resize;border-radius:var(--spacing-1);pointer-events:auto}.watch-ui__buffer-target-label{position:absolute;bottom:100%;left:50%;transform:translate(-50%);font-size:.6875rem;font-weight:500;color:var(--color-orange-400, var(--color-orange-450));white-space:nowrap;margin-bottom:var(--spacing-2);opacity:0;transition:opacity .15s ease;pointer-events:none}.watch-ui__buffer-visualization:hover .watch-ui__buffer-target-label,.watch-ui__buffer-visualization--dragging .watch-ui__buffer-target-label{opacity:1}.watch-ui__buffer-help{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:.75rem;color:var(--color-white-alpha-30, rgba(255, 255, 255, .3));pointer-events:none;white-space:nowrap}.watch-ui__buffering{position:absolute;width:100%;height:100%;top:0;left:0;z-index:1;background-color:var(--color-black-alpha-40);backdrop-filter:blur(var(--spacing-2));pointer-events:auto}.watch-ui__buffering-spinner{width:2.5rem;height:2.5rem;border:var(--spacing-4) solid var(--color-white-alpha-20);border-top:var(--spacing-4) solid var(--color-white);border-radius:50%;animation:buffer-spin 1s linear infinite}@keyframes buffer-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.watch-ui__status-indicator{gap:var(--spacing-12);backdrop-filter:blur(var(--spacing-16))}.watch-ui__status-indicator-dot{position:relative;width:.75rem;height:.75rem;border-radius:50%;flex-shrink:0;z-index:1}.watch-ui__status-indicator-dot:after{content:"";position:absolute;inset:0;border-radius:50%;background:currentcolor;transform:scale(1);opacity:.5;animation:status-pulse 1.5s ease-out infinite;z-index:-1}.watch-ui__status-indicator-dot:after{display:none}.watch-ui__status-indicator-dot--live:after,.watch-ui__status-indicator-dot--connected:after,.watch-ui__status-indicator-dot--loading:after,.watch-ui__status-indicator-dot--connecting:after{display:block}.watch-ui__status-indicator-dot--error{background:var(--color-gray-100);color:var(--color-gray-100)}.watch-ui__status-indicator-text--error{color:var(--color-gray-100)}.watch-ui__status-indicator-dot--connecting{background:var(--color-yellow-400);color:var(--color-yellow-400)}.watch-ui__status-indicator-text--connecting{color:var(--color-yellow-400)}.watch-ui__status-indicator-dot--loading{background:var(--color-yellow-400);color:var(--color-yellow-400)}.watch-ui__status-indicator-text--loading{color:var(--color-yellow-400)}.watch-ui__status-indicator-dot--live{background:var(--color-green-400);color:var(--color-green-400)}.watch-ui__status-indicator-text--live{color:var(--color-green-400)}.watch-ui__status-indicator-dot--connected{background:var(--color-blue-500);color:var(--color-blue-500)}.watch-ui__status-indicator-text--connected{color:var(--color-blue-500)}.watch-ui__status-indicator-text{font-size:1rem;letter-spacing:.1rem}@keyframes status-pulse{0%{transform:scale(1);opacity:.5}70%{opacity:.25}to{transform:scale(2.5);opacity:0}}';
1010
- var He = /* @__PURE__ */ R("<style>"), Ge = /* @__PURE__ */ R("<div class=watch-ui__video-container><slot>");
1011
- function Qe(t) {
1012
- return g(Ce, {
1013
- get moqWatch() {
1014
- return t.watch;
1015
- },
1016
- get children() {
1017
- return [(() => {
1018
- var e = He();
1019
- return w(e, De), e;
1020
- })(), (() => {
1021
- var e = Ge(), n = e.firstChild;
1022
- return n._$owner = Qt(), w(e, () => {
1023
- const a = jt(lt);
1024
- return a ? g(Z, {
1025
- get when() {
1026
- return a.isStatsPanelVisible();
1027
- },
1028
- get children() {
1029
- return g(Nt, {
1030
- context: lt,
1031
- getElement: (r) => {
1032
- if (r)
1033
- return {
1034
- audio: r.moqWatch.backend.audio,
1035
- video: r.moqWatch.backend.video,
1036
- connection: r.moqWatch.connection.established
1037
- };
1038
- }
1039
- });
1040
- }
1041
- }) : null;
1042
- }, null), w(e, g(Ae, {}), null), e;
1043
- })(), g(Ke, {})];
1044
- }
1045
- });
1046
- }
1047
- ke("moq-watch-ui", (t, {
1048
- element: e
1049
- }) => {
1050
- const [n, a] = E();
1051
- return Lt(async () => {
1052
- await customElements.whenDefined("moq-watch");
1053
- const r = e.querySelector("moq-watch");
1054
- a(r || void 0);
1055
- }), g(Z, {
1056
- get when() {
1057
- return n();
1058
- },
1059
- keyed: !0,
1060
- children: (r) => g(Qe, {
1061
- watch: r
1062
- })
1063
- });
1064
- });
1065
- //# sourceMappingURL=index.js.map