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