@vindral/web-sdk 3.4.3 → 4.0.0-100-g47797f66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/player.js ADDED
@@ -0,0 +1,3839 @@
1
+ var Gr = Object.defineProperty;
2
+ var $r = Object.getPrototypeOf;
3
+ var zr = Reflect.get;
4
+ var Ps = (h) => {
5
+ throw TypeError(h);
6
+ };
7
+ var Br = (h, a, t) => a in h ? Gr(h, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[a] = t;
8
+ var m = (h, a, t) => Br(h, typeof a != "symbol" ? a + "" : a, t), Pi = (h, a, t) => a.has(h) || Ps("Cannot " + t);
9
+ var e = (h, a, t) => (Pi(h, a, "read from private field"), t ? t.call(h) : a.get(h)), l = (h, a, t) => a.has(h) ? Ps("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(h) : a.set(h, t), d = (h, a, t, i) => (Pi(h, a, "write to private field"), i ? i.call(h, t) : a.set(h, t), t), r = (h, a, t) => (Pi(h, a, "access private method"), t);
10
+ var G = (h, a, t) => zr($r(h), t, a);
11
+ var $ = (h, a, t) => new Promise((i, s) => {
12
+ var o = (v) => {
13
+ try {
14
+ p(t.next(v));
15
+ } catch (g) {
16
+ s(g);
17
+ }
18
+ }, u = (v) => {
19
+ try {
20
+ p(t.throw(v));
21
+ } catch (g) {
22
+ s(g);
23
+ }
24
+ }, p = (v) => v.done ? i(v.value) : Promise.resolve(v.value).then(o, u);
25
+ p((t = t.apply(h, a)).next());
26
+ });
27
+ import { L as Kr, V as qr, f as Xr, A as Vr, C as jr, g as Yr } from "./Bozsjl6j.js";
28
+ import { E as ri } from "./Bx7s5QdT.js";
29
+ import { CastSender as Jr } from "./cast-sender.js";
30
+ import { A as Qr, b as Wr } from "./C80BN8Qb.js";
31
+ const Oi = 1e3, Hi = Oi * 1e3, Ms = Hi * 1e3, Mi = (h, a, t) => h % a === 0 ? h / a : (h / a).toFixed(t), Zr = (h, a = 1) => h >= Ms ? `${Mi(h, Ms, a)} Gbit/s` : h >= Hi ? `${Mi(h, Hi, a)} Mbit/s` : h >= Oi ? `${Mi(h, Oi, a)} Kbit/s` : `${h} bit/s`, to = ({ width: h, height: a }) => `${h}x${a}`, eo = ({
32
+ title: h,
33
+ subTitle: a = "Live stream",
34
+ poster: t
35
+ }) => {
36
+ document.title = h, "mediaSession" in navigator && (navigator.mediaSession.metadata = new MediaMetadata({
37
+ title: h,
38
+ artist: a,
39
+ artwork: t ? [{ src: t }] : []
40
+ }));
41
+ }, n = {
42
+ PAUSED: "paused",
43
+ MUTED: "muted",
44
+ USER_INTERACTING: "user-interacting",
45
+ IS_CASTING: "is-casting",
46
+ CAST_AVAILABLE: "cast-available",
47
+ CAST_RECEIVER_NAME: "cast-receiver-name",
48
+ BUFFERING: "buffering",
49
+ UI_LOCKED: "ui-locked",
50
+ HIDE_UI_ON_PAUSE: "hide-ui-on-pause",
51
+ FULLSCREEN: "is-fullscreen",
52
+ FULLSCREEN_FALLBACK: "is-fullscreen-fallback",
53
+ RENDITION_LEVELS: "rendition-levels",
54
+ RENDITION_LEVEL: "rendition-level",
55
+ MAX_VIDEO_BITRATE: "max-video-bit-rate",
56
+ CHANNELS: "channels",
57
+ CHANNEL_ID: "channel-id",
58
+ CHANNEL_GROUP_ID: "channel-group-id",
59
+ PIP_AVAILABLE: "pip-available",
60
+ IS_PIP: "is-pip",
61
+ AIRPLAY_AVAILABLE: "airplay-available",
62
+ IS_AIRPLAYING: "is-airplaying",
63
+ MEDIA: "media",
64
+ LANGUAGES: "languages",
65
+ LANGUAGE: "language",
66
+ TEXT_TRACKS: "text-tracks",
67
+ TEXT_TRACK: "text-track",
68
+ NEEDS_USER_INPUT: "needs-user-input",
69
+ AUTHENTICATION_TOKEN: "authentication-token",
70
+ VOLUME: "volume",
71
+ VOLUME_LEVEL: "volume-level",
72
+ CAST_ENABLED: "cast",
73
+ AIRPLAY_ENABLED: "airplay",
74
+ PIP_ENABLED: "pip",
75
+ FULLSCREEN_ENABLED: "fullscreen",
76
+ VU_METER_ENABLED: "vu-meter",
77
+ POSTER_SRC: "poster-src"
78
+ }, $s = Object.values(n), f = {
79
+ PLAY: "play",
80
+ PAUSE: "pause",
81
+ MUTE: "mute",
82
+ UNMUTE: "unmute",
83
+ LOCK_UI: "lock-ui",
84
+ UNLOCK_UI: "unlock-ui",
85
+ ENTER_FULLSCREEN: "enter-fullscreen",
86
+ EXIT_FULLSCREEN: "exit-fullscreen",
87
+ SET_RENDITION: "set-rendition",
88
+ CHANNEL_GRID_OPENED: "channel-grid-opened",
89
+ CHANNEL_GRID_CLOSED: "channel-grid-closed",
90
+ ENTER_PIP: "enter-pip",
91
+ EXIT_PIP: "exit-pip",
92
+ REQUEST_AIRPLAY: "request-airplay",
93
+ SET_LANGUAGE: "set-language",
94
+ SET_TEXT_TRACK: "set-text-track",
95
+ REQUEST_USER_INPUT: "request-user-input",
96
+ SET_VOLUME: "set-volume"
97
+ };
98
+ function zs(h) {
99
+ return h === "audio" || h === "video" || h === "audio+video" ? h : "audio+video";
100
+ }
101
+ function Di(h) {
102
+ return h === "trace" || h === "debug" || h === "info" || h === "warn" || h === "error" || h === "off" ? h : "off";
103
+ }
104
+ function io(h) {
105
+ if (h === null)
106
+ return;
107
+ const a = h.split(",").map((t) => t.trim()).filter((t) => t === "h264" || t === "av1");
108
+ if (a.length !== 0)
109
+ return a;
110
+ }
111
+ function Bs(h) {
112
+ if (h !== null)
113
+ return h === "" ? !0 : h;
114
+ }
115
+ function so(h) {
116
+ if (h !== null)
117
+ try {
118
+ const a = JSON.parse(h);
119
+ if (typeof a == "object" && a !== null) {
120
+ const t = a;
121
+ if (typeof t.width == "number" && typeof t.height == "number")
122
+ return t;
123
+ }
124
+ } catch (a) {
125
+ return;
126
+ }
127
+ }
128
+ function no(h) {
129
+ if (h !== null)
130
+ try {
131
+ const a = JSON.parse(h);
132
+ if (typeof a == "object" && a !== null) {
133
+ const t = a;
134
+ if (t.wasmDecodingConstraint) {
135
+ const i = t.wasmDecodingConstraint;
136
+ if (typeof i.width != "number" || typeof i.height != "number" || typeof i.bitRate != "number")
137
+ return;
138
+ }
139
+ return t;
140
+ }
141
+ } catch (a) {
142
+ return;
143
+ }
144
+ }
145
+ function ai(h) {
146
+ if (h === null)
147
+ return;
148
+ const a = parseInt(h, 10);
149
+ return isNaN(a) ? void 0 : a;
150
+ }
151
+ function x(h) {
152
+ return typeof h == "string";
153
+ }
154
+ function T(h, a) {
155
+ if (h === null)
156
+ return a != null ? a : void 0;
157
+ const t = h.toLowerCase();
158
+ return t === "false" ? !1 : t === "true" || t === "" ? !0 : a != null ? a : !0;
159
+ }
160
+ function Ds(h) {
161
+ if (h === null)
162
+ return;
163
+ const a = {}, t = h.split(",");
164
+ for (const i of t) {
165
+ const [s, o] = i.split(":");
166
+ s && o && (a[s.trim()] = o.trim());
167
+ }
168
+ return Object.keys(a).length > 0 ? a : void 0;
169
+ }
170
+ const Ks = document.createElement("template");
171
+ Ks.innerHTML = /* HTML */
172
+ `
173
+ <style>
174
+ :host {
175
+ cursor: pointer;
176
+ color: var(--fg-strong);
177
+ padding: var(--button-padding);
178
+ background: transparent;
179
+ transition: background 0.2s linear;
180
+ -webkit-tap-highlight-color: transparent;
181
+ }
182
+
183
+ :host(:focus-visible) {
184
+ box-shadow: inset 0 0 0 2px var(--fg-strong);
185
+ outline: 0;
186
+ }
187
+
188
+ :host(:where(:focus)) {
189
+ box-shadow: none;
190
+ outline: 0;
191
+ }
192
+
193
+ @media (hover: hover) and (pointer: fine) {
194
+ :host(:hover) {
195
+ background: rgba(255, 255, 255, 0.15);
196
+ }
197
+ }
198
+
199
+ :host(:active) {
200
+ background: rgba(255, 255, 255, 0.25);
201
+ }
202
+
203
+ :host(:active) svg {
204
+ scale: 0.9;
205
+ }
206
+
207
+ :host([disabled]) {
208
+ opacity: 0.5;
209
+ background: transparent;
210
+ }
211
+ </style>
212
+ `;
213
+ var Gt, Le, xt, Te;
214
+ class Z extends HTMLElement {
215
+ constructor() {
216
+ super();
217
+ l(this, Gt, null);
218
+ l(this, Le, (t) => {
219
+ this.handleClick(t);
220
+ });
221
+ l(this, xt, (t) => {
222
+ const { key: i } = t;
223
+ if (!this.keysUsed.includes(i)) {
224
+ this.removeEventListener("keyup", e(this, xt));
225
+ return;
226
+ }
227
+ this.handleClick(t);
228
+ });
229
+ l(this, Te, (t) => {
230
+ const { metaKey: i, altKey: s, key: o } = t;
231
+ if (i || s || !this.keysUsed.includes(o)) {
232
+ this.removeEventListener("keyup", e(this, xt));
233
+ return;
234
+ }
235
+ this.addEventListener("keyup", e(this, xt), { once: !0 });
236
+ });
237
+ this.attachShadow({ mode: "open" }).appendChild(Ks.content.cloneNode(!0));
238
+ }
239
+ get keysUsed() {
240
+ return ["Enter", " "];
241
+ }
242
+ connectedCallback() {
243
+ var t;
244
+ d(this, Gt, this.closest("vindral-controller")), (t = e(this, Gt)) == null || t.connectListener(this), this.hasAttribute("disabled") || this.enable(), this.setAttribute("role", "button");
245
+ }
246
+ enable() {
247
+ this.addEventListener("click", e(this, Le)), this.addEventListener("keydown", e(this, Te)), this.tabIndex = 0;
248
+ }
249
+ disable() {
250
+ this.removeEventListener("click", e(this, Le)), this.removeEventListener("keydown", e(this, Te)), this.removeEventListener("keyup", e(this, xt)), this.tabIndex = -1;
251
+ }
252
+ disconnectedCallback() {
253
+ var t;
254
+ (t = e(this, Gt)) == null || t.disconnectListener(this);
255
+ }
256
+ attributeChangedCallback(t, i, s) {
257
+ t === "disabled" && (x(s) ? this.disable() : this.enable());
258
+ }
259
+ }
260
+ Gt = new WeakMap(), Le = new WeakMap(), xt = new WeakMap(), Te = new WeakMap(), m(Z, "observedAttributes", ["disabled"]);
261
+ const qs = document.createElement("template"), Fs = (
262
+ /* SVG */
263
+ `
264
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" ><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 18a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-12a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3" /><path d="M9 20h6l-3 -5z" /></svg>
265
+ `
266
+ );
267
+ qs.innerHTML = /* HTML */
268
+ `
269
+ <style>
270
+ :host {
271
+ display: var(--airplay-button-display);
272
+ }
273
+
274
+ slot > svg {
275
+ display: block;
276
+ }
277
+
278
+ :host(:not([${n.AIRPLAY_AVAILABLE}])) {
279
+ display: none !important;
280
+ }
281
+
282
+ :host([${n.IS_AIRPLAYING}]) slot[name="exit"] {
283
+ display: none !important;
284
+ }
285
+
286
+ :host(:not([${n.IS_AIRPLAYING}])) slot[name="enter"] {
287
+ display: none !important;
288
+ }
289
+ </style>
290
+
291
+ <slot name="icon">
292
+ <slot name="enter">${Fs}</slot>
293
+ <slot name="exit">${Fs}</slot>
294
+ </slot>
295
+ `;
296
+ var xe, $i;
297
+ const pe = class pe extends Z {
298
+ constructor() {
299
+ var t;
300
+ super();
301
+ l(this, xe);
302
+ (t = this.shadowRoot) == null || t.appendChild(qs.content.cloneNode(!0));
303
+ }
304
+ connectedCallback() {
305
+ super.connectedCallback(), r(this, xe, $i).call(this);
306
+ }
307
+ disconnectedCallback() {
308
+ super.disconnectedCallback();
309
+ }
310
+ attributeChangedCallback(t, i, s) {
311
+ super.attributeChangedCallback(t, i, s), t === n.IS_AIRPLAYING && r(this, xe, $i).call(this);
312
+ }
313
+ set isAirPlaying(t) {
314
+ t ? this.setAttribute(n.IS_AIRPLAYING, "") : this.removeAttribute(n.IS_AIRPLAYING);
315
+ }
316
+ get isAirPlaying() {
317
+ return this.hasAttribute(n.IS_AIRPLAYING);
318
+ }
319
+ handleClick(t) {
320
+ this.dispatchEvent(new CustomEvent(f.REQUEST_AIRPLAY, { bubbles: !0, composed: !0 }));
321
+ }
322
+ };
323
+ xe = new WeakSet(), $i = function() {
324
+ this.setAttribute("aria-label", this.isAirPlaying ? "Exit airplay" : "Enter airplay");
325
+ }, m(pe, "observedAttributes", [
326
+ ...G(pe, pe, "observedAttributes"),
327
+ n.AIRPLAY_AVAILABLE,
328
+ n.IS_AIRPLAYING
329
+ ]);
330
+ let Gi = pe;
331
+ const Xs = document.createElement("template");
332
+ Xs.innerHTML = /* HTML */
333
+ `
334
+ <style>
335
+ :host {
336
+ display: var(--buffering-overlay-display);
337
+ align-items: center;
338
+ justify-content: center;
339
+ position: absolute;
340
+ top: 0;
341
+ bottom: 0;
342
+ left: 0;
343
+ right: 0;
344
+ background-color: rgba(0, 0, 0, 0.3);
345
+ transition: opacity 250ms;
346
+ transition-delay: 1s;
347
+ opacity: 1;
348
+ pointer-events: none;
349
+ z-index: 1;
350
+ }
351
+
352
+ #buffering-indicator {
353
+ width: 40px;
354
+ height: 40px;
355
+ border-radius: 40px;
356
+ background-color: var(--fg-strong);
357
+ animation: scaleout 1s infinite ease-in-out;
358
+ }
359
+
360
+ @-webkit-keyframes scaleout {
361
+ 0% {
362
+ -webkit-transform: scale(0);
363
+ }
364
+ 100% {
365
+ -webkit-transform: scale(1);
366
+ opacity: 0;
367
+ }
368
+ }
369
+
370
+ @keyframes scaleout {
371
+ 0% {
372
+ -webkit-transform: scale(0);
373
+ transform: scale(0);
374
+ }
375
+ 100% {
376
+ -webkit-transform: scale(1);
377
+ transform: scale(1);
378
+ opacity: 0;
379
+ }
380
+ }
381
+
382
+ :host(:not([${n.BUFFERING}])) {
383
+ transition-delay: 0s;
384
+ opacity: 0 !important;
385
+ }
386
+ </style>
387
+
388
+ <div id="buffering-indicator"></div>
389
+ `;
390
+ var $t;
391
+ class Vs extends HTMLElement {
392
+ constructor() {
393
+ super();
394
+ l(this, $t, null);
395
+ this.attachShadow({ mode: "open" }).appendChild(Xs.content.cloneNode(!0));
396
+ }
397
+ connectedCallback() {
398
+ var t;
399
+ d(this, $t, this.closest("vindral-controller")), (t = e(this, $t)) == null || t.connectListener(this);
400
+ }
401
+ disconnectedCallback() {
402
+ var t;
403
+ (t = e(this, $t)) == null || t.disconnectListener(this);
404
+ }
405
+ }
406
+ $t = new WeakMap(), m(Vs, "observedAttributes", [n.BUFFERING]);
407
+ const js = document.createElement("template");
408
+ js.innerHTML = /* HTML */
409
+ `
410
+ <style>
411
+ :host {
412
+ display: var(--cast-button-display);
413
+ }
414
+
415
+ google-cast-launcher {
416
+ display: block;
417
+ width: 24px;
418
+ height: 24px;
419
+ cursor: pointer;
420
+ --connected-color: var(--fg-strong);
421
+ --disconnected-color: var(--fg-strong);
422
+ }
423
+
424
+ :host(:active) google-cast-launcher {
425
+ transform: scale(0.9);
426
+ }
427
+
428
+ :host(:not([${n.CAST_AVAILABLE}])) {
429
+ display: none !important;
430
+ }
431
+ </style>
432
+ `;
433
+ var Ft, Bi, Ys;
434
+ const be = class be extends Z {
435
+ constructor() {
436
+ var t;
437
+ super();
438
+ l(this, Ft);
439
+ (t = this.shadowRoot) == null || t.appendChild(js.content.cloneNode(!0));
440
+ }
441
+ connectedCallback() {
442
+ super.connectedCallback(), r(this, Ft, Bi).call(this);
443
+ }
444
+ disconnectedCallback() {
445
+ super.disconnectedCallback();
446
+ }
447
+ attributeChangedCallback(t, i, s) {
448
+ super.attributeChangedCallback(t, i, s), t === n.CAST_AVAILABLE && r(this, Ft, Ys).call(this), t === n.IS_CASTING && r(this, Ft, Bi).call(this);
449
+ }
450
+ set isCasting(t) {
451
+ t ? this.setAttribute(n.IS_CASTING, "") : this.removeAttribute(n.IS_CASTING);
452
+ }
453
+ get isCasting() {
454
+ return this.hasAttribute(n.IS_CASTING);
455
+ }
456
+ handleClick(t) {
457
+ }
458
+ };
459
+ Ft = new WeakSet(), Bi = function() {
460
+ this.setAttribute("aria-label", this.isCasting ? "Exit cast" : "Enter cast");
461
+ }, Ys = function() {
462
+ var t, i;
463
+ if (!((t = this.shadowRoot) != null && t.querySelector("google-cast-launcher"))) {
464
+ const s = document.createElement("google-cast-launcher");
465
+ (i = this.shadowRoot) == null || i.appendChild(s);
466
+ }
467
+ }, m(be, "observedAttributes", [
468
+ ...G(be, be, "observedAttributes"),
469
+ n.CAST_AVAILABLE,
470
+ n.IS_CASTING
471
+ ]);
472
+ let zi = be;
473
+ const Js = document.createElement("template");
474
+ Js.innerHTML = /* HTML */
475
+ `
476
+ <style>
477
+ :host {
478
+ position: absolute;
479
+ top: 0;
480
+ left: 0;
481
+ width: 100%;
482
+ font-size: 20px;
483
+ text-align: center;
484
+ padding: 5% 0;
485
+ box-shadow: 0px 0px 20px black;
486
+ background: rgba(0, 0, 0, 0.5);
487
+ color: white;
488
+ pointer-events: none;
489
+ z-index: 1;
490
+ transition: opacity 0.3s ease-in-out;
491
+ }
492
+
493
+ @media only screen and (max-width: 600px) {
494
+ :host {
495
+ font-size: 14px;
496
+ }
497
+ }
498
+
499
+ :host(:not([${n.IS_CASTING}])) {
500
+ display: none;
501
+ }
502
+
503
+ #text {
504
+ margin: 0;
505
+ padding: 0;
506
+ }
507
+ </style>
508
+ <span id="text"></span>
509
+ `;
510
+ var zt, Bt;
511
+ class Qs extends HTMLElement {
512
+ constructor() {
513
+ super();
514
+ l(this, zt, null);
515
+ l(this, Bt, null);
516
+ this.attachShadow({ mode: "open" }).appendChild(Js.content.cloneNode(!0));
517
+ }
518
+ connectedCallback() {
519
+ var t, i;
520
+ d(this, zt, this.closest("vindral-controller")), (t = e(this, zt)) == null || t.connectListener(this), d(this, Bt, (i = this.shadowRoot) == null ? void 0 : i.querySelector("#text"));
521
+ }
522
+ disconnectedCallback() {
523
+ var t;
524
+ (t = e(this, zt)) == null || t.disconnectListener(this);
525
+ }
526
+ attributeChangedCallback(t, i, s) {
527
+ i === s || !e(this, Bt) || t === "cast-receiver-name" && typeof s == "string" && (e(this, Bt).innerText = `Casting to ${s || "device"}`);
528
+ }
529
+ }
530
+ zt = new WeakMap(), Bt = new WeakMap(), m(Qs, "observedAttributes", [n.IS_CASTING, n.CAST_RECEIVER_NAME]);
531
+ function Ws(h = document) {
532
+ const a = h == null ? void 0 : h.activeElement;
533
+ if (!a) return null;
534
+ if (a.shadowRoot) {
535
+ const t = Ws(a.shadowRoot);
536
+ return t != null ? t : a;
537
+ }
538
+ return a;
539
+ }
540
+ const Zs = document.createElement("template");
541
+ Zs.innerHTML = /* HTML */
542
+ `
543
+ <style>
544
+ :host {
545
+ position: relative;
546
+ aspect-ratio: 16 / 9;
547
+ object-fit: cover;
548
+ cursor: pointer;
549
+ border-radius: 6px;
550
+ box-sizing: border-box;
551
+ margin: 2px;
552
+
553
+ background-size: cover;
554
+ background-position: center;
555
+
556
+ transition-property: background-image;
557
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
558
+ transition-duration: 200ms;
559
+
560
+ background-color: rgba(0, 0, 0, 0.5);
561
+ background-blend-mode: multiply;
562
+ }
563
+
564
+ :host([aria-selected="true"]) {
565
+ outline: 2px solid var(--fg-strong);
566
+ background-color: rgba(0, 0, 0, 0);
567
+ }
568
+
569
+ :host([offline]) {
570
+ display: var(--grid-item-offline-display);
571
+ background-image: repeating-linear-gradient(-45deg, #3d3d3d 0, #3d3d3d 4px, #1c2024 4px, #1c2024 8px) !important;
572
+ pointer-events: none;
573
+ }
574
+
575
+ :host::before {
576
+ content: "";
577
+ position: absolute;
578
+ top: 0;
579
+ left: 0;
580
+ right: 0;
581
+ bottom: 0;
582
+ background: rgba(255, 255, 255, 0);
583
+ transition: background 0.2s ease;
584
+ }
585
+
586
+ :host(:hover)::before {
587
+ background: rgba(255, 255, 255, 0.1);
588
+ }
589
+
590
+ .channel-title {
591
+ position: absolute;
592
+ bottom: var(--padding-2);
593
+ left: var(--padding-2);
594
+ padding: var(--padding-1) var(--padding-2);
595
+ color: white;
596
+ font-size: 15px;
597
+ font-weight: 500;
598
+ text-overflow: ellipsis;
599
+ border-radius: 4px;
600
+
601
+ @container (max-width: 480px) {
602
+ font-size: 13px;
603
+ }
604
+ }
605
+ </style>
606
+ <slot></slot>
607
+ `;
608
+ var St;
609
+ class Ts extends HTMLElement {
610
+ constructor() {
611
+ super();
612
+ l(this, St);
613
+ m(this, "lastThumbnailUpdate");
614
+ const t = this.attachShadow({ mode: "open" });
615
+ d(this, St, document.createElement("span")), e(this, St).className = "channel-title", t.appendChild(e(this, St)), t.appendChild(Zs.content.cloneNode(!0));
616
+ }
617
+ attributeChangedCallback(t, i, s) {
618
+ if (i !== s)
619
+ switch (t) {
620
+ case "url":
621
+ this.updateThumbnail();
622
+ break;
623
+ case "title":
624
+ e(this, St).textContent = s;
625
+ break;
626
+ }
627
+ }
628
+ updateThumbnail() {
629
+ const t = this.getAttribute("url"), i = this.hasAttribute("offline"), s = this.hasAttribute("visible");
630
+ if (i || !t || !s || this.lastThumbnailUpdate && Date.now() - this.lastThumbnailUpdate < 1e4) return;
631
+ const o = new URL(t), u = new Image(), p = this.getAttribute("authentication-token");
632
+ p && o.searchParams.set("auth.token", p), o.searchParams.set("t", Date.now().toString()), u.src = o.toString(), u.onload = () => this.style.backgroundImage = `url(${o.toString()})`;
633
+ }
634
+ }
635
+ St = new WeakMap(), m(Ts, "observedAttributes", ["url", "title", "offline", "authentication-token", "visible"]);
636
+ const tn = document.createElement("template");
637
+ tn.innerHTML = /* HTML */
638
+ `
639
+ <style>
640
+ :host {
641
+ cursor: default;
642
+ display: flex;
643
+ flex-direction: column;
644
+ box-sizing: border-box;
645
+ border-radius: 4px;
646
+ background-color: var(--bg-subtle);
647
+ padding: var(--padding-2);
648
+
649
+ position: absolute;
650
+ bottom: 0;
651
+ right: 0;
652
+
653
+ z-index: 5;
654
+ width: 100%;
655
+ max-height: 75%;
656
+ }
657
+
658
+ :host([hidden]) {
659
+ display: none;
660
+ }
661
+
662
+ .wrapper {
663
+ overflow: auto;
664
+ -ms-overflow-style: none;
665
+ scrollbar-width: none;
666
+ height: 100%;
667
+ }
668
+
669
+ .wrapper::-webkit-scrollbar {
670
+ display: none;
671
+ }
672
+
673
+ slot#grid {
674
+ display: grid;
675
+ gap: var(--padding-2);
676
+ grid-template-columns: repeat(4, minmax(0, 1fr));
677
+
678
+ @container (width < 768px) {
679
+ grid-template-columns: repeat(2, minmax(0, 1fr));
680
+ }
681
+ @container (width < 1024px) and (width >= 768px) {
682
+ grid-template-columns: repeat(3, minmax(0, 1fr));
683
+ }
684
+ @container (width >= 1024px) {
685
+ grid-template-columns: repeat(4, minmax(0, 1fr));
686
+ }
687
+ }
688
+
689
+ /* Smart TV */
690
+ @media (width < 1024px) and (width >= 768px) and (-webkit-min-device-pixel-ratio: 2) {
691
+ slot#grid {
692
+ grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
693
+ }
694
+ }
695
+
696
+ :host([mode="list"]) slot#grid {
697
+ grid-template-columns: repeat(1, minmax(0, 1fr));
698
+ }
699
+ </style>
700
+
701
+ <div class="wrapper">
702
+ <slot name="grid" id="grid"></slot>
703
+ </div>
704
+ `;
705
+ var dt, ut, Kt, D, L, qt, Se, Ne, Re, y, sn, nn, rn, Ki, on, an, ln, cn, hn, dn, un, ce;
706
+ class en extends HTMLElement {
707
+ constructor() {
708
+ super();
709
+ l(this, y);
710
+ l(this, dt, null);
711
+ l(this, ut, null);
712
+ l(this, Kt, []);
713
+ l(this, D, []);
714
+ l(this, L);
715
+ l(this, qt);
716
+ l(this, Se);
717
+ l(this, Ne);
718
+ l(this, Re);
719
+ m(this, "handleEvent", (t) => {
720
+ switch (t.type) {
721
+ case "keydown":
722
+ r(this, y, dn).call(this, t);
723
+ break;
724
+ }
725
+ });
726
+ this.attachShadow({ mode: "open" }).appendChild(tn.content.cloneNode(!0));
727
+ }
728
+ connectedCallback() {
729
+ var t, i, s;
730
+ d(this, ut, this.closest("vindral-controller")), (t = e(this, ut)) == null || t.connectListener(this), r(this, y, sn).call(this), (s = e(this, dt)) == null || s.observe((i = this.shadowRoot) == null ? void 0 : i.querySelector(".wrapper")), r(this, y, Ki).call(this), d(this, Se, window.setInterval(() => {
731
+ r(this, y, cn).call(this);
732
+ }, 1e4));
733
+ }
734
+ disconnectedCallback() {
735
+ var t;
736
+ clearInterval(e(this, Se)), this.removeEventListener("keydown", this), (t = e(this, dt)) == null || t.disconnect();
737
+ }
738
+ attributeChangedCallback(t, i, s) {
739
+ if (i !== s)
740
+ switch (t) {
741
+ case n.CHANNEL_ID: {
742
+ r(this, y, ln).call(this, s);
743
+ break;
744
+ }
745
+ case n.CHANNELS:
746
+ d(this, Kt, JSON.parse(s)), r(this, y, Ki).call(this);
747
+ break;
748
+ case "authentication-token":
749
+ d(this, qt, s);
750
+ break;
751
+ }
752
+ }
753
+ get keysUsed() {
754
+ return ["Enter", "Escape", "Tab", " ", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight", "Home", "End"];
755
+ }
756
+ focus() {
757
+ var t;
758
+ d(this, Ne, Ws()), (t = e(this, L)) == null || t.focus();
759
+ }
760
+ }
761
+ dt = new WeakMap(), ut = new WeakMap(), Kt = new WeakMap(), D = new WeakMap(), L = new WeakMap(), qt = new WeakMap(), Se = new WeakMap(), Ne = new WeakMap(), Re = new WeakMap(), y = new WeakSet(), sn = function() {
762
+ d(this, dt, new IntersectionObserver(
763
+ (t) => {
764
+ t.forEach((i) => {
765
+ const { target: s, isIntersecting: o } = i;
766
+ s instanceof Ts ? r(this, y, rn).call(this, s, o) : r(this, y, nn).call(this, o);
767
+ });
768
+ },
769
+ {
770
+ root: e(this, ut)
771
+ }
772
+ ));
773
+ }, nn = function(t) {
774
+ var i, s;
775
+ if (t) {
776
+ this.dispatchEvent(new CustomEvent(f.CHANNEL_GRID_OPENED, { bubbles: !0, composed: !0 }));
777
+ const o = () => {
778
+ window.clearTimeout(e(this, Re)), d(this, Re, window.setTimeout(() => {
779
+ var u;
780
+ this.focus(), (u = this.parentElement) == null || u.removeEventListener("scroll", o);
781
+ }, 100));
782
+ };
783
+ (i = this.parentElement) == null || i.addEventListener("scroll", o), this.addEventListener("keydown", this), e(this, L) && (e(this, L).tabIndex = 0);
784
+ } else
785
+ e(this, L) && (e(this, L).tabIndex = -1), this.dispatchEvent(new CustomEvent(f.CHANNEL_GRID_CLOSED, { bubbles: !0, composed: !0 })), (s = e(this, Ne)) == null || s.focus(), this.removeEventListener("keydown", this);
786
+ }, rn = function(t, i) {
787
+ i ? (t.setAttribute("visible", ""), (!t.lastThumbnailUpdate || Date.now() - t.lastThumbnailUpdate >= 1e4) && (t.updateThumbnail(), t.lastThumbnailUpdate = Date.now())) : t.removeAttribute("visible");
788
+ }, Ki = function() {
789
+ var o;
790
+ const t = (o = this.shadowRoot) == null ? void 0 : o.querySelector("slot[name=grid]"), i = new Map(e(this, D).map((u) => [u.id, u])), s = this.getAttribute("channel-id");
791
+ d(this, D, e(this, Kt).map((u) => {
792
+ var g;
793
+ const p = i.get(u.channelId);
794
+ if (p)
795
+ return r(this, y, on).call(this, p.element, u), p;
796
+ const v = r(this, y, an).call(this, u, s);
797
+ return (g = e(this, dt)) == null || g.observe(v.element), t.contains(v.element) || t.appendChild(v.element), v;
798
+ })), i.forEach((u, p) => {
799
+ var v;
800
+ e(this, Kt).some((g) => g.channelId === p) || ((v = e(this, dt)) == null || v.unobserve(u.element), u.element.remove());
801
+ }), e(this, D).sort((u, p) => u.element.hasAttribute("offline") && !p.element.hasAttribute("offline") ? 1 : -1).forEach((u) => {
802
+ t.contains(u.element) || t.appendChild(u.element);
803
+ });
804
+ }, on = function(t, i) {
805
+ i.isLive ? t.removeAttribute("offline") : t.setAttribute("offline", ""), t.setAttribute("url", i.thumbnailUrls[0] || ""), t.setAttribute("title", i.name);
806
+ }, an = function(t, i) {
807
+ const s = document.createElement("vindral-channel-grid-item");
808
+ return s.setAttribute("url", t.thumbnailUrls[0] || ""), s.setAttribute("title", t.name), e(this, qt) && s.setAttribute("authentication-token", e(this, qt)), t.isLive || s.setAttribute("offline", ""), t.channelId === i && (s.setAttribute("aria-selected", "true"), d(this, L, s)), s.tabIndex = -1, s.onclick = () => r(this, y, hn).call(this, t), { element: s, thumbnail: t.thumbnailUrls[0] || "", id: t.channelId };
809
+ }, ln = function(t) {
810
+ e(this, D).forEach((i) => {
811
+ i.id === t ? (i.element.setAttribute("aria-selected", "true"), i.element.tabIndex = 0, d(this, L, i.element)) : (i.element.tabIndex = -1, i.element.setAttribute("aria-selected", "false"));
812
+ });
813
+ }, cn = function() {
814
+ this.hasAttribute("hidden") || e(this, D).forEach((t) => t.element.updateThumbnail());
815
+ }, hn = function(t) {
816
+ var i;
817
+ (i = e(this, ut)) == null || i.setAttribute("channel-id", t.channelId);
818
+ }, dn = function(t) {
819
+ var p, v, g;
820
+ const { key: i, ctrlKey: s, altKey: o, metaKey: u } = t;
821
+ s || o || u || this.keysUsed.includes(i) && (t.preventDefault(), t.stopPropagation(), i === "Tab" || i === "Escape" ? ((p = this.parentElement) == null || p.removeAttribute("open"), (v = e(this, ut)) == null || v.focus()) : i === "Enter" || i === " " ? (g = e(this, L)) == null || g.click() : r(this, y, un).call(this, t));
822
+ }, un = function(t) {
823
+ var p;
824
+ if (!e(this, L)) return;
825
+ const { key: i } = t;
826
+ let o = e(this, D).findIndex((v) => v.element === e(this, L));
827
+ const u = e(this, L).getBoundingClientRect();
828
+ switch (i) {
829
+ case "ArrowUp":
830
+ if (o = r(this, y, ce).call(this, u, -1, 0), o < 0) {
831
+ (p = this.parentElement) == null || p.removeAttribute("open");
832
+ return;
833
+ }
834
+ break;
835
+ case "ArrowDown":
836
+ o = r(this, y, ce).call(this, u, 1, 0);
837
+ break;
838
+ case "ArrowLeft":
839
+ o = r(this, y, ce).call(this, u, 0, -1);
840
+ break;
841
+ case "ArrowRight":
842
+ o = r(this, y, ce).call(this, u, 0, 1);
843
+ break;
844
+ case "Home":
845
+ o = 0;
846
+ break;
847
+ case "End":
848
+ o = e(this, D).length - 1;
849
+ break;
850
+ }
851
+ if (o >= 0 && o < e(this, D).length) {
852
+ const v = e(this, D)[o];
853
+ if (!v) return;
854
+ e(this, L).setAttribute("aria-selected", "false"), e(this, L).tabIndex = -1, d(this, L, v.element), e(this, L).setAttribute("aria-selected", "true"), e(this, L).tabIndex = 0, e(this, L).focus();
855
+ }
856
+ }, ce = function(t, i, s) {
857
+ let o = -1, u = 1 / 0;
858
+ return e(this, D).filter((p) => p.element.getBoundingClientRect().width > 0).forEach((p, v) => {
859
+ const g = p.element.getBoundingClientRect(), P = i === 0 || i < 0 && g.top < t.top || i > 0 && g.top > t.top, tt = s === 0 || s < 0 && g.left < t.left || s > 0 && g.left > t.left;
860
+ if (P && tt) {
861
+ const j = Math.sqrt(
862
+ Math.pow(g.top - t.top, 2) + Math.pow(g.left - t.left, 2)
863
+ );
864
+ j < u && (u = j, o = v);
865
+ }
866
+ }), o;
867
+ }, m(en, "observedAttributes", [
868
+ n.CHANNELS,
869
+ n.CHANNEL_ID,
870
+ n.AUTHENTICATION_TOKEN,
871
+ "mode",
872
+ "hidden"
873
+ ]);
874
+ const ro = (
875
+ /* SVG */
876
+ `
877
+ <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-layout-grid" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="currentColor" stroke-linecap="round" stroke-linejoin="round">
878
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
879
+ <path d="M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
880
+ <path d="M14 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
881
+ <path d="M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
882
+ <path d="M14 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" />
883
+ </svg>
884
+ `
885
+ ), pn = document.createElement("template");
886
+ pn.innerHTML = /* HTML */
887
+ `
888
+ <style>
889
+ :host {
890
+ display: var(--grid-button-display);
891
+ cursor: pointer;
892
+ flex-shrink: 0.5;
893
+ color: var(--fg-strong);
894
+ }
895
+
896
+ :host([hidden]) {
897
+ display: none;
898
+ }
899
+
900
+ slot > svg {
901
+ display: block;
902
+ }
903
+ </style>
904
+ <slot name="button">${ro}</slot>
905
+ `;
906
+ var Xt, R, X, bi, N, bn, Xi, li, Vi, ji;
907
+ const me = class me extends Z {
908
+ constructor() {
909
+ var t, i;
910
+ super();
911
+ l(this, N);
912
+ l(this, Xt);
913
+ l(this, R);
914
+ l(this, X);
915
+ l(this, bi, (t) => {
916
+ t.composedPath().includes(this) || r(this, N, li).call(this);
917
+ });
918
+ (t = this.shadowRoot) == null || t.appendChild(pn.content.cloneNode(!0)), d(this, Xt, (i = this.shadowRoot) == null ? void 0 : i.querySelector("slot[name=button]"));
919
+ }
920
+ connectedCallback() {
921
+ var i;
922
+ super.connectedCallback(), this.setAttribute("aria-haspopup", "listbox"), this.enable(), r(this, N, Vi).call(this);
923
+ const t = this.getRootNode();
924
+ (t instanceof Document || t instanceof ShadowRoot) && (d(this, R, t.querySelector("vindral-channel-grid")), ((i = e(this, R).parentElement) == null ? void 0 : i.localName) === "vindral-scroll-overlay" && (e(this, R).hidden = !1, e(this, R).style.position = "relative", d(this, X, e(this, R).parentElement))), r(this, N, ji).call(this);
925
+ }
926
+ disconnectedCallback() {
927
+ }
928
+ attributeChangedCallback(t, i, s) {
929
+ super.attributeChangedCallback(t, i, s), (t === n.CHANNEL_GROUP_ID || t === n.CHANNELS) && r(this, N, Vi).call(this);
930
+ }
931
+ enable() {
932
+ super.enable(), document.addEventListener("click", e(this, bi));
933
+ }
934
+ handleClick(t) {
935
+ r(this, N, bn).call(this);
936
+ }
937
+ get isOpen() {
938
+ var t, i;
939
+ return ((t = e(this, X)) == null ? void 0 : t.hasAttribute("open")) || !((i = e(this, R)) != null && i.hidden);
940
+ }
941
+ };
942
+ Xt = new WeakMap(), R = new WeakMap(), X = new WeakMap(), bi = new WeakMap(), N = new WeakSet(), bn = function() {
943
+ var t;
944
+ e(this, X) ? e(this, X).hasAttribute("open") ? r(this, N, li).call(this) : r(this, N, Xi).call(this) : (t = e(this, R)) != null && t.hidden ? r(this, N, Xi).call(this) : r(this, N, li).call(this), r(this, N, ji).call(this);
945
+ }, Xi = function() {
946
+ var t;
947
+ if (e(this, X))
948
+ e(this, X).setAttribute("open", "");
949
+ else {
950
+ if (!((t = e(this, R)) != null && t.hidden)) return;
951
+ e(this, R).hidden = !1, e(this, R).focus();
952
+ }
953
+ e(this, Xt).setAttribute("aria-expanded", "true");
954
+ }, li = function() {
955
+ if (e(this, X))
956
+ e(this, X).removeAttribute("open");
957
+ else {
958
+ if (!e(this, R) || e(this, R).hidden) return;
959
+ e(this, R).hidden = !0;
960
+ }
961
+ e(this, Xt).setAttribute("aria-expanded", "false");
962
+ }, Vi = function() {
963
+ this.getAttribute(n.CHANNEL_GROUP_ID) ? this.removeAttribute("hidden") : this.setAttribute("hidden", ""), this.hasAttribute(n.CHANNELS) ? this.removeAttribute("disabled") : this.setAttribute("disabled", "");
964
+ }, ji = function() {
965
+ this.setAttribute("aria-label", this.isOpen ? "Exit grid" : "Enter grid");
966
+ }, m(me, "observedAttributes", [
967
+ ...G(me, me, "observedAttributes"),
968
+ n.CHANNEL_GROUP_ID,
969
+ n.CHANNELS,
970
+ "hidden"
971
+ ]);
972
+ let qi = me;
973
+ const mn = document.createElement("template");
974
+ mn.innerHTML = /* HTML */
975
+ `
976
+ <style>
977
+ :host {
978
+ display: flex;
979
+ width: 100%;
980
+ align-items: center;
981
+ }
982
+
983
+ slot {
984
+ display: flex;
985
+ flex-grow: 1;
986
+ align-items: center;
987
+ }
988
+
989
+ :host([content-center]) slot {
990
+ justify-content: center;
991
+ }
992
+
993
+ slot[name="right"] {
994
+ justify-content: flex-end;
995
+ }
996
+ </style>
997
+
998
+ <slot name="bar">
999
+ <slot></slot>
1000
+ <slot name="right"></slot>
1001
+ </slot>
1002
+ `;
1003
+ class vn extends HTMLElement {
1004
+ constructor() {
1005
+ super(), this.attachShadow({ mode: "open" }).appendChild(mn.content.cloneNode(!0));
1006
+ }
1007
+ connectedCallback() {
1008
+ }
1009
+ disconnectedCallback() {
1010
+ }
1011
+ }
1012
+ m(vn, "observedAttributes", []);
1013
+ class oo extends ri {
1014
+ constructor(t) {
1015
+ super();
1016
+ m(this, "config");
1017
+ m(this, "hlsUrl");
1018
+ m(this, "element");
1019
+ m(this, "connectingTimeout");
1020
+ /**
1021
+ * Update authentication token on an already established and authenticated connection.
1022
+ */
1023
+ m(this, "updateAuthenticationToken", (t) => {
1024
+ });
1025
+ /**
1026
+ * Fully unloads the instance. This disconnects the current listeners.
1027
+ */
1028
+ m(this, "unload", () => {
1029
+ this.element && (this.element.removeEventListener("webkitplaybacktargetavailabilitychanged", this.onAirPlayAvailable), this.element.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged", this.onAirPlayPlaybackChanged), this.element.remove());
1030
+ });
1031
+ m(this, "onAirPlayAvailable", (t) => {
1032
+ switch (t.availability) {
1033
+ case "available": {
1034
+ this.element.src !== this.hlsUrl && this.checkHlsUrl(this.hlsUrl).then((s) => {
1035
+ s && (this.element.src = this.hlsUrl, this.emit("available"));
1036
+ });
1037
+ break;
1038
+ }
1039
+ }
1040
+ });
1041
+ m(this, "onAirPlayPlaybackChanged", () => {
1042
+ window.clearTimeout(this.connectingTimeout), this.element.webkitCurrentPlaybackTargetIsWireless ? (this.emit("connected"), this.element.style.display = "block", this.element.paused && this.element.play()) : (this.emit("disconnected"), this.element.pause(), this.element.src = "", this.element.src = this.hlsUrl, this.element.style.display = "none");
1043
+ });
1044
+ this.hlsUrl = new URL(`/api/hls?channelId=${t.channelId}`, t.url).toString(), this.config = t, this.element = document.createElement("video"), this.element.style.position = "absolute", this.element.style.top = "0", this.element.style.bottom = "0", this.element.style.left = "0", this.element.style.right = "0", this.element.style.width = "100%", this.element.style.height = "100%", this.element.style.zIndex = "1001", this.element.style.display = "none", this.element.id = "vindral-airplay-element", this.element.playsInline = !0, this.element.controls = !0, this.element.preload = "metadata", this.element.addEventListener("webkitplaybacktargetavailabilitychanged", this.onAirPlayAvailable), this.element.addEventListener("webkitcurrentplaybacktargetiswirelesschanged", this.onAirPlayPlaybackChanged), this.config.container.appendChild(this.element);
1045
+ }
1046
+ /**
1047
+ * True if the instance is casting right now.
1048
+ */
1049
+ get casting() {
1050
+ return this.element.webkitCurrentPlaybackTargetIsWireless;
1051
+ }
1052
+ /**
1053
+ * Set the current channelId.
1054
+ */
1055
+ set channelId(t) {
1056
+ }
1057
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-call */
1058
+ /**
1059
+ * Show the AirPlay picker.
1060
+ */
1061
+ showPlaybackTargetPicker() {
1062
+ this.element.paused && (this.element.play(), this.connectingTimeout = window.setTimeout(() => {
1063
+ this.element.webkitCurrentPlaybackTargetIsWireless || (this.element.pause(), this.element.src = "", this.element.src = this.hlsUrl);
1064
+ }, 3e4)), this.element.webkitShowPlaybackTargetPicker();
1065
+ }
1066
+ /**
1067
+ * Returns if AirPlay is supported.
1068
+ */
1069
+ static isAirPlaySupported() {
1070
+ return !!window.WebKitPlaybackTargetAvailabilityEvent;
1071
+ }
1072
+ checkHlsUrl(t) {
1073
+ return $(this, null, function* () {
1074
+ try {
1075
+ return (yield fetch(t, { method: "HEAD" })).ok;
1076
+ } catch (i) {
1077
+ return !1;
1078
+ }
1079
+ });
1080
+ }
1081
+ /* eslint-enable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-call */
1082
+ }
1083
+ const Tt = class Tt extends ri {
1084
+ constructor(t) {
1085
+ super();
1086
+ m(this, "container");
1087
+ m(this, "unload", () => {
1088
+ document.removeEventListener("webkitfullscreenchange", this.onChange), document.removeEventListener("mozfullscreenchange", this.onChange), document.removeEventListener("fullscreenchange", this.onChange), this.container.removeEventListener("webkitendfullscreen", this.onChange);
1089
+ });
1090
+ m(this, "request", () => $(this, null, function* () {
1091
+ try {
1092
+ yield this.requestFn();
1093
+ } catch (t) {
1094
+ throw this.onChange(), t;
1095
+ }
1096
+ }));
1097
+ m(this, "exit", () => $(this, null, function* () {
1098
+ try {
1099
+ yield this.exitFn();
1100
+ } catch (t) {
1101
+ throw this.onChange(), t;
1102
+ }
1103
+ }));
1104
+ m(this, "onChange", () => this.emit("on fullscreen change", this.isFullscreen()));
1105
+ // into the yolo zone
1106
+ /* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/unbound-method */
1107
+ m(this, "isFullscreen", () => !!(document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen));
1108
+ m(this, "isSupported", () => Tt.isFullscreenApiSupported(this.container) || !this.isInIframe());
1109
+ m(this, "isFullscreenApiSupported", () => Tt.isFullscreenApiSupported(this.container));
1110
+ m(this, "isInIframe", () => window.location !== window.parent.location);
1111
+ this.container = t, document.addEventListener("webkitfullscreenchange", this.onChange), document.addEventListener("mozfullscreenchange", this.onChange), document.addEventListener("fullscreenchange", this.onChange), this.container.addEventListener("webkitendfullscreen", this.onChange);
1112
+ }
1113
+ get requestFn() {
1114
+ return Tt.isFullscreenApiSupported(this.container) ? (this.container.requestFullscreen || this.container.webkitRequestFullscreen || this.container.webkitEnterFullscreen || this.container.mozRequestFullScreen).bind(this.container) : () => new Promise((t) => {
1115
+ t();
1116
+ });
1117
+ }
1118
+ get exitFn() {
1119
+ if (Tt.isFullscreenApiSupported(this.container) && this.isFullscreen()) {
1120
+ const t = document.exitFullscreen, i = document.webkitFullscreenElement && document.webkitExitFullscreen, s = document.mozFullscreenElement && document.mozCancelFullScreen, o = t || i || s;
1121
+ return o ? o.bind(document) : this.container.webkitExitFullscreen.bind(this.container);
1122
+ }
1123
+ return () => new Promise((t) => {
1124
+ t();
1125
+ });
1126
+ }
1127
+ /* eslint-enable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/unbound-method */
1128
+ };
1129
+ m(Tt, "isFullscreenApiSupported", (t) => (t.requestFullscreen || t.webkitRequestFullscreen || t.webkitEnterFullscreen || t.mozRequestFullScreen) !== void 0);
1130
+ let ue = Tt;
1131
+ var mi, vi, gi, fi, Vt, Ei, Ai, Ue, jt;
1132
+ class ao extends ri {
1133
+ constructor(t) {
1134
+ super();
1135
+ m(this, "unload", () => {
1136
+ this.element.removeEventListener("enterpictureinpicture", this.onChange), this.element.removeEventListener("leavepictureinpicture", this.onChange);
1137
+ });
1138
+ m(this, "request", () => $(this, null, function* () {
1139
+ try {
1140
+ return yield e(this, mi).call(this);
1141
+ } catch (t) {
1142
+ throw this.onChange(), t;
1143
+ }
1144
+ }));
1145
+ m(this, "exit", () => $(this, null, function* () {
1146
+ try {
1147
+ return yield e(this, vi).call(this);
1148
+ } catch (t) {
1149
+ throw this.onChange(), t;
1150
+ }
1151
+ }));
1152
+ m(this, "onChange", () => {
1153
+ this.emit("on picture in picture change", this.isPictureInPictureActive());
1154
+ });
1155
+ m(this, "isPictureInPictureActive", () => e(this, Ai).call(this) || e(this, Ei).call(this));
1156
+ m(this, "isSupported", () => e(this, jt).call(this) || e(this, Vt).call(this));
1157
+ l(this, mi, () => e(this, Vt).call(this) ? e(this, gi).call(this) : e(this, jt).call(this) ? e(this, Ue).call(this, "picture-in-picture") : Promise.resolve());
1158
+ l(this, vi, () => this.isPictureInPictureActive() ? e(this, Vt).call(this) ? e(this, fi).call(this) : e(this, jt).call(this) ? e(this, Ue).call(this, "inline") : Promise.resolve() : Promise.resolve());
1159
+ l(this, gi, () => $(this, null, function* () {
1160
+ yield this.element.requestPictureInPicture();
1161
+ }));
1162
+ l(this, fi, () => $(this, null, function* () {
1163
+ yield document.exitPictureInPicture();
1164
+ }));
1165
+ l(this, Vt, () => !!this.element.requestPictureInPicture && !!document.pictureInPictureEnabled);
1166
+ l(this, Ei, () => !!document.pictureInPictureElement);
1167
+ l(this, Ai, () => this.element.webkitPresentationMode === "picture-in-picture");
1168
+ l(this, Ue, (t) => (this.element.webkitSetPresentationMode && this.element.webkitSetPresentationMode(t), Promise.resolve()));
1169
+ l(this, jt, () => !!this.element.webkitSetPresentationMode);
1170
+ this.element = t, this.element.addEventListener("enterpictureinpicture", this.onChange), this.element.addEventListener("leavepictureinpicture", this.onChange), this.element.setAttribute("autopictureinpicture", "");
1171
+ }
1172
+ }
1173
+ mi = new WeakMap(), vi = new WeakMap(), gi = new WeakMap(), fi = new WeakMap(), Vt = new WeakMap(), Ei = new WeakMap(), Ai = new WeakMap(), Ue = new WeakMap(), jt = new WeakMap();
1174
+ class Os extends ri {
1175
+ constructor(t) {
1176
+ super();
1177
+ m(this, "audioContext");
1178
+ m(this, "audioNode");
1179
+ m(this, "bufferLength");
1180
+ m(this, "animationFrameId", null);
1181
+ m(this, "canUseFloatTimeDomainData");
1182
+ m(this, "byteSampleBuffer", null);
1183
+ m(this, "floatSampleBuffer", null);
1184
+ m(this, "leftAnalyser");
1185
+ m(this, "rightAnalyser");
1186
+ m(this, "mediaElementSource", null);
1187
+ m(this, "update", () => {
1188
+ const t = this.getDecibel(this.leftAnalyser, this.floatSampleBuffer || this.byteSampleBuffer), i = this.getDecibel(this.rightAnalyser, this.floatSampleBuffer || this.byteSampleBuffer);
1189
+ this.emit("on decibel change", { left: t, right: i }), this.animationFrameId = requestAnimationFrame(this.update);
1190
+ });
1191
+ if (this.source = t, t instanceof HTMLMediaElement) {
1192
+ const i = new AudioContext();
1193
+ this.mediaElementSource = i.createMediaElementSource(t), this.audioNode = i.createChannelSplitter(2), this.mediaElementSource.connect(this.audioNode), this.audioContext = i, this.mediaElementSource.connect(this.audioContext.destination);
1194
+ } else
1195
+ this.audioNode = t, this.audioContext = this.audioNode.context;
1196
+ this.leftAnalyser = this.audioNode.context.createAnalyser(), this.rightAnalyser = this.audioNode.context.createAnalyser(), this.audioNode.connect(this.leftAnalyser, 0), this.audioNode.connect(this.rightAnalyser, 1), this.canUseFloatTimeDomainData = typeof this.leftAnalyser.getFloatTimeDomainData == "function", this.leftAnalyser.fftSize = 1024, this.rightAnalyser.fftSize = 1024, this.bufferLength = this.leftAnalyser.fftSize, this.canUseFloatTimeDomainData ? this.floatSampleBuffer = new Float32Array(this.bufferLength) : this.byteSampleBuffer = new Uint8Array(this.bufferLength);
1197
+ }
1198
+ getDecibel(t, i) {
1199
+ let s = 0;
1200
+ if (this.canUseFloatTimeDomainData) {
1201
+ t.getFloatTimeDomainData(i);
1202
+ for (let o = 0; o < i.length; o++) {
1203
+ const u = i[o];
1204
+ if (u) {
1205
+ const p = u ** 2;
1206
+ s = Math.max(p, s);
1207
+ }
1208
+ }
1209
+ } else {
1210
+ t.getByteTimeDomainData(i);
1211
+ for (let o = 0; o < i.length; o++) {
1212
+ const u = i[o];
1213
+ if (u) {
1214
+ const p = (u / 128 - 1) ** 2;
1215
+ s = Math.max(p, s);
1216
+ }
1217
+ }
1218
+ }
1219
+ return 10 * Math.log10(s);
1220
+ }
1221
+ start() {
1222
+ this.animationFrameId === null && (this.audioContext instanceof AudioContext && this.audioContext.state === "suspended" ? this.audioContext.resume().then(() => {
1223
+ this.update();
1224
+ }) : this.update());
1225
+ }
1226
+ stop() {
1227
+ this.animationFrameId !== null && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null);
1228
+ }
1229
+ unload() {
1230
+ var t;
1231
+ this.stop(), (t = this.mediaElementSource) == null || t.disconnect(), this.leftAnalyser.disconnect(), this.rightAnalyser.disconnect(), this.audioNode.disconnect();
1232
+ }
1233
+ get isMediaElementSource() {
1234
+ return this.source instanceof HTMLMediaElement;
1235
+ }
1236
+ }
1237
+ const Hs = (h) => {
1238
+ var t;
1239
+ let a = "observedAttributes" in h.constructor ? h.constructor.observedAttributes : void 0;
1240
+ return !a && ((t = h.nodeName) != null && t.includes("-")) && (globalThis.customElements.upgrade(h), a = "observedAttributes" in h.constructor ? h.constructor.observedAttributes : void 0), Array.isArray(a) ? a.filter((i) => $s.includes(i)) : [];
1241
+ }, gn = document.createElement("template");
1242
+ gn.innerHTML = /* HTML */
1243
+ `
1244
+ <style>
1245
+ :host {
1246
+ position: relative;
1247
+ }
1248
+
1249
+ slot > svg {
1250
+ display: block;
1251
+ }
1252
+
1253
+ :host([hidden]) {
1254
+ display: none;
1255
+ }
1256
+ </style>
1257
+ `;
1258
+ var Yt, Jt, z, _e, yi, ki, ae, fn, En;
1259
+ class xs extends Z {
1260
+ constructor() {
1261
+ var t;
1262
+ super();
1263
+ l(this, ae);
1264
+ l(this, Yt);
1265
+ l(this, Jt);
1266
+ l(this, z);
1267
+ l(this, _e, null);
1268
+ l(this, yi, (t) => {
1269
+ t.composedPath().includes(this) || this.hide();
1270
+ });
1271
+ l(this, ki, () => {
1272
+ this.hide();
1273
+ });
1274
+ (t = this.shadowRoot) == null || t.appendChild(gn.content.cloneNode(!0));
1275
+ }
1276
+ connectedCallback() {
1277
+ var u, p, v, g;
1278
+ super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("aria-haspopup", "listbox");
1279
+ const t = (u = this.getAttribute("list-position")) != null ? u : "top";
1280
+ (p = e(this, Jt)) == null || p.setAttribute("list-position", t);
1281
+ const i = this.getRootNode(), o = [...(g = (v = this.shadowRoot) == null ? void 0 : v.querySelectorAll(":not(:defined)")) != null ? g : []].map((P) => customElements.whenDefined(P.localName));
1282
+ Promise.all(o).then(() => {
1283
+ var P;
1284
+ (i instanceof Document || i instanceof ShadowRoot) && (d(this, _e, i.querySelector("vindral-controller")), (P = e(this, _e)) == null || P.connectListener(this));
1285
+ });
1286
+ }
1287
+ set button(t) {
1288
+ d(this, Yt, t);
1289
+ }
1290
+ set listbox(t) {
1291
+ d(this, Jt, t);
1292
+ }
1293
+ set listboxSlot(t) {
1294
+ d(this, z, t);
1295
+ }
1296
+ enable() {
1297
+ super.enable(), this.addEventListener("change", e(this, ki)), document.addEventListener("click", e(this, yi));
1298
+ }
1299
+ hide() {
1300
+ var t, i;
1301
+ !e(this, z) || (t = e(this, z)) != null && t.hidden || (e(this, z).hidden = !0, (i = e(this, Yt)) == null || i.setAttribute("aria-expanded", "false"), this.dispatchEvent(new CustomEvent(f.UNLOCK_UI, { bubbles: !0, composed: !0 })), this.focus());
1302
+ }
1303
+ handleClick(t) {
1304
+ e(this, z) && !t.composedPath().includes(e(this, z)) && r(this, ae, fn).call(this);
1305
+ }
1306
+ }
1307
+ Yt = new WeakMap(), Jt = new WeakMap(), z = new WeakMap(), _e = new WeakMap(), yi = new WeakMap(), ki = new WeakMap(), ae = new WeakSet(), fn = function() {
1308
+ var t;
1309
+ (t = e(this, z)) != null && t.hidden ? r(this, ae, En).call(this) : this.hide();
1310
+ }, En = function() {
1311
+ var t, i, s;
1312
+ (t = e(this, z)) != null && t.hidden && (e(this, z).hidden = !1, (i = e(this, Yt)) == null || i.setAttribute("aria-expanded", "true"), (s = e(this, Jt)) == null || s.focus(), this.dispatchEvent(new CustomEvent(f.LOCK_UI, { bubbles: !0, composed: !0 })));
1313
+ };
1314
+ const An = document.createElement("template");
1315
+ An.innerHTML = /* HTML */
1316
+ `
1317
+ <style>
1318
+ :host {
1319
+ --fg-strong: var(--vindral-fg-strong, #eeeeee);
1320
+ --fg-subtle: var(--vindral-fg-subtle, #b4b4b4);
1321
+ --fg-extra-subtle: var(--vindral-fg-extra-subtle, #7b7b7b);
1322
+
1323
+ --bg-strong: var(--vindral-bg-strong, #111111);
1324
+ --bg-subtle: var(--vindral-bg-subtle, #191919);
1325
+ --bg-extra-subtle: var(--vindral-bg-extra-subtle, #222222);
1326
+
1327
+ --bg-component: var(--vindral-bg-component, #222222);
1328
+ --bg-component-hover: var(--vindral-bg-component-hover, #2a2a2a);
1329
+ --bg-component-active: var(--vindral-bg-component-active, #313131);
1330
+
1331
+ --padding-1: var(--vindral-padding-1, 4px);
1332
+ --padding-2: var(--vindral-padding-2, 8px);
1333
+ --padding-3: var(--vindral-padding-3, 16px);
1334
+ --padding-4: var(--vindral-padding-4, 24px);
1335
+ --padding-5: var(--vindral-padding-5, 32px);
1336
+ --padding-6: var(--vindral-padding-6, 40px);
1337
+
1338
+ --control-padding: var(--vindral-control-padding, var(--padding-1));
1339
+
1340
+ --button-padding: var(--vindral-button-padding, var(--padding-2));
1341
+
1342
+ --ui-font: var(
1343
+ --vindral-ui-font,
1344
+ -apple-system,
1345
+ BlinkMacSystemFont,
1346
+ "Segoe UI",
1347
+ Roboto,
1348
+ "Helvetica Neue",
1349
+ Arial,
1350
+ sans-serif
1351
+ );
1352
+ --ui-display: var(--vindral-ui-display, flex);
1353
+
1354
+ --play-button-display: var(--vindral-play-button-display, flex);
1355
+ --mute-button-display: var(--vindral-mute-button-display, flex);
1356
+ --airplay-button-display: var(--vindral-airplay-button-display, flex);
1357
+ --pip-button-display: var(--vindral-pip-button-display, flex);
1358
+ --fullscreen-button-display: var(--vindral-fullscreen-button-display, flex);
1359
+ --cast-button-display: var(--vindral-cast-button-display, flex);
1360
+ --grid-button-display: var(--vindral-grid-button-display, flex);
1361
+ --grid-item-offline-display: var(--vindral-grid-item-offline-display, flex);
1362
+ --volume-range-display: var(--vindral-volume-range-display, flex);
1363
+ --volume-meter-display: var(--vindral-volume-meter-display, flex);
1364
+ --rendition-menu-display: var(--vindral-rendition-menu-display, flex);
1365
+ --language-menu-display: var(--vindral-language-menu-display, flex);
1366
+ --play-overlay-display: var(--vindral-play-overlay-display, flex);
1367
+ --buffering-overlay-display: var(--vindral-buffering-overlay-display, flex);
1368
+ --poster-overlay-display: var(--vindral-poster-overlay-display, flex);
1369
+
1370
+ position: relative;
1371
+ display: flex;
1372
+ background-color: var(--bg-strong);
1373
+ width: 100%;
1374
+ container-type: inline-size;
1375
+ overflow: hidden;
1376
+ font-family: var(--ui-font);
1377
+ }
1378
+
1379
+ #ui {
1380
+ position: absolute;
1381
+ display: flex;
1382
+ justify-content: space-between;
1383
+ flex-direction: column;
1384
+ top: 0;
1385
+ bottom: 0;
1386
+ left: 0;
1387
+ right: 0;
1388
+ transition: opacity 0.5s;
1389
+ user-select: none;
1390
+ pointer-events: auto;
1391
+
1392
+ // Ensure the #ui element is above the video element on Safari
1393
+ z-index: 1;
1394
+ }
1395
+
1396
+ #ui > * {
1397
+ pointer-events: auto;
1398
+ display: var(--ui-display);
1399
+ }
1400
+
1401
+ #video {
1402
+ cursor: none;
1403
+ display: flex;
1404
+ width: 100%;
1405
+ z-index: 0;
1406
+ }
1407
+
1408
+ #video > canvas {
1409
+ object-fit: contain;
1410
+ }
1411
+
1412
+ slot#middle {
1413
+ align-items: center;
1414
+ justify-content: center;
1415
+ flex-grow: 1;
1416
+ }
1417
+
1418
+ slot#top-bar {
1419
+ background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
1420
+ padding: var(--control-padding);
1421
+ }
1422
+
1423
+ slot#bottom-bar {
1424
+ padding: var(--control-padding);
1425
+ background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
1426
+ }
1427
+
1428
+ :host(:focus-visible) {
1429
+ outline: none;
1430
+ }
1431
+
1432
+ :host(
1433
+ :not([${n.USER_INTERACTING}]
1434
+ ):not([${n.PAUSED}]:not([${n.HIDE_UI_ON_PAUSE}])
1435
+ ):not([${n.IS_CASTING}]
1436
+ ):not([${n.MEDIA}="audio"])
1437
+ )
1438
+ #ui {
1439
+ opacity: 0;
1440
+ cursor: none;
1441
+ pointer-events: none;
1442
+ }
1443
+
1444
+ :host(
1445
+ :not([${n.USER_INTERACTING}]
1446
+ ):not([${n.PAUSED}]:not([${n.HIDE_UI_ON_PAUSE}])
1447
+ ):not([${n.IS_CASTING}]
1448
+ ):not([${n.MEDIA}="audio"])
1449
+ )
1450
+ #ui > * {
1451
+ pointer-events: none;
1452
+ }
1453
+
1454
+ :host([${n.FULLSCREEN}][${n.FULLSCREEN_FALLBACK}]) {
1455
+ position: fixed !important;
1456
+ inset: 0 !important;
1457
+ margin: 0 !important;
1458
+ box-sizing: border-box !important;
1459
+ min-width: 0 !important;
1460
+ max-width: none !important;
1461
+ min-height: 0 !important;
1462
+ max-height: none !important;
1463
+ width: 100% !important;
1464
+ height: 100% !important;
1465
+ transform: none !important;
1466
+ z-index: 1000 !important;
1467
+ background: black;
1468
+ top: 0;
1469
+ left: 0;
1470
+ right: 0;
1471
+ bottom: 0;
1472
+
1473
+ /* intentionally not !important */
1474
+ object-fit: contain;
1475
+ }
1476
+
1477
+ :host([${n.MEDIA}="audio"]) {
1478
+ min-height: 100px;
1479
+ overflow: visible;
1480
+ }
1481
+ </style>
1482
+
1483
+ <div id="video"></div>
1484
+
1485
+ <slot id="overlay" name="overlay"></slot>
1486
+
1487
+ <div id="ui">
1488
+ <slot id="top-bar" name="top-bar"></slot>
1489
+ <slot id="middle" name="middle"></slot>
1490
+ <slot id="bottom-bar"></slot>
1491
+ <slot id="overlay-interactive" name="overlay-interactive"></slot>
1492
+ </div>
1493
+ `;
1494
+ const Fi = ["ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Enter", " ", "f", "m"];
1495
+ var wi, et, Pe, pt, bt, b, Me, it, st, Qt, nt, B, mt, F, rt, De, Fe, U, vt, c, Yi, yn, kn, wn, Ji, In, Cn, Ln, Oe, Tn, xn, Sn, Nn, He, Ii, Ci, Rn, Nt, Qi, Wi, ci, ht, Un, _n, Pn, Zi, Li, Ti, ts, A, C;
1496
+ const ve = class ve extends HTMLElement {
1497
+ constructor() {
1498
+ super();
1499
+ l(this, c);
1500
+ l(this, et, /* @__PURE__ */ new Map());
1501
+ l(this, Pe, 2e3);
1502
+ l(this, pt, null);
1503
+ l(this, bt, null);
1504
+ l(this, b);
1505
+ l(this, Me, e(ve, wi));
1506
+ l(this, it);
1507
+ l(this, st);
1508
+ l(this, Qt);
1509
+ l(this, nt);
1510
+ l(this, B);
1511
+ l(this, mt);
1512
+ l(this, F);
1513
+ l(this, rt);
1514
+ l(this, De);
1515
+ l(this, Fe);
1516
+ l(this, U);
1517
+ l(this, vt, null);
1518
+ l(this, Oe, 0);
1519
+ m(this, "handleEvent", (t) => {
1520
+ switch (t.type) {
1521
+ case "pointerdown":
1522
+ d(this, Oe, t.timeStamp);
1523
+ break;
1524
+ case "pointermove":
1525
+ r(this, c, Tn).call(this, t);
1526
+ break;
1527
+ case "pointerup":
1528
+ r(this, c, xn).call(this, t);
1529
+ break;
1530
+ case "mouseleave":
1531
+ r(this, c, ht).call(this);
1532
+ break;
1533
+ case "dblclick":
1534
+ r(this, c, Sn).call(this, t);
1535
+ break;
1536
+ case "mousemove":
1537
+ r(this, c, Nn).call(this, t);
1538
+ break;
1539
+ case "keydown":
1540
+ e(this, Ci).call(this, t);
1541
+ break;
1542
+ case "keyup":
1543
+ r(this, c, ht).call(this), e(this, Ii).call(this, t);
1544
+ break;
1545
+ }
1546
+ });
1547
+ l(this, He, (t) => {
1548
+ var i;
1549
+ if (e(this, b) && (e(this, U).debug("Vindral event", { type: t.type }), t instanceof CustomEvent))
1550
+ switch (t.type) {
1551
+ case f.PLAY:
1552
+ this.removeAttribute(n.PAUSED);
1553
+ break;
1554
+ case f.PAUSE:
1555
+ this.setAttribute(n.PAUSED, "");
1556
+ break;
1557
+ case f.MUTE:
1558
+ this.setAttribute(n.MUTED, "");
1559
+ break;
1560
+ case f.UNMUTE:
1561
+ this.removeAttribute(n.MUTED);
1562
+ break;
1563
+ case f.LOCK_UI:
1564
+ this.setAttribute(n.UI_LOCKED, "");
1565
+ break;
1566
+ case f.UNLOCK_UI:
1567
+ this.removeAttribute(n.UI_LOCKED);
1568
+ break;
1569
+ case f.ENTER_FULLSCREEN:
1570
+ this.setAttribute(n.FULLSCREEN, "");
1571
+ break;
1572
+ case f.EXIT_FULLSCREEN:
1573
+ this.removeAttribute(n.FULLSCREEN);
1574
+ break;
1575
+ case f.SET_RENDITION:
1576
+ {
1577
+ const s = t.detail;
1578
+ s.audio && (e(this, b).maxAudioBitRate = s.audio.bitRate), s.video && (e(this, b).maxVideoBitRate = s.video.bitRate, e(this, b).maxSize = s.video, this.setAttribute(n.MAX_VIDEO_BITRATE, String(s.video.bitRate)));
1579
+ }
1580
+ break;
1581
+ case f.CHANNEL_GRID_OPENED: {
1582
+ e(this, vt) === null && r(this, c, Qi).call(this);
1583
+ break;
1584
+ }
1585
+ case f.CHANNEL_GRID_CLOSED: {
1586
+ e(this, vt) !== null && (clearTimeout(e(this, vt)), d(this, vt, null));
1587
+ break;
1588
+ }
1589
+ case f.ENTER_PIP:
1590
+ this.setAttribute(n.IS_PIP, "");
1591
+ break;
1592
+ case f.EXIT_PIP:
1593
+ this.removeAttribute(n.IS_PIP);
1594
+ break;
1595
+ case f.REQUEST_AIRPLAY:
1596
+ (i = e(this, mt)) == null || i.showPlaybackTargetPicker();
1597
+ break;
1598
+ case f.SET_LANGUAGE:
1599
+ x(t.detail) ? this.setAttribute(n.LANGUAGE, t.detail) : this.removeAttribute(n.LANGUAGE);
1600
+ break;
1601
+ case f.SET_TEXT_TRACK:
1602
+ x(t.detail) ? this.setAttribute(n.TEXT_TRACK, t.detail) : this.removeAttribute(n.TEXT_TRACK);
1603
+ break;
1604
+ case f.REQUEST_USER_INPUT:
1605
+ r(this, c, C).call(this, n.NEEDS_USER_INPUT), e(this, b).play();
1606
+ break;
1607
+ case f.SET_VOLUME:
1608
+ {
1609
+ const s = t.detail;
1610
+ e(this, b).muted && s > 0 ? e(this, b).muted = !1 : s === 0 && (e(this, b).muted = !0), this.setAttribute(n.VOLUME, s.toString());
1611
+ }
1612
+ break;
1613
+ }
1614
+ });
1615
+ l(this, Ii, (t) => {
1616
+ const { key: i } = t;
1617
+ if (!Fi.includes(i)) {
1618
+ this.removeEventListener("keyup", this);
1619
+ return;
1620
+ }
1621
+ r(this, c, Rn).call(this, t);
1622
+ });
1623
+ l(this, Ci, (t) => {
1624
+ const { metaKey: i, altKey: s, key: o } = t;
1625
+ i || s || !Fi.includes(o) || this.addEventListener("keyup", this, { once: !0 });
1626
+ });
1627
+ l(this, Nt, null);
1628
+ l(this, Li, () => {
1629
+ var i, s, o;
1630
+ if (!("orientation" in screen) || !screen.orientation.lock)
1631
+ return;
1632
+ const t = (i = e(this, b)) == null ? void 0 : i.currentRenditionLevel;
1633
+ t != null && t.video && screen.orientation.lock(((s = t == null ? void 0 : t.video) == null ? void 0 : s.width) > ((o = t == null ? void 0 : t.video) == null ? void 0 : o.height) ? "landscape-primary" : "portrait-primary").catch(() => {
1634
+ });
1635
+ });
1636
+ l(this, Ti, () => {
1637
+ !("orientation" in screen) || !screen.orientation.unlock || screen.orientation.unlock();
1638
+ });
1639
+ this.attachShadow({ mode: "open" }).appendChild(An.content.cloneNode(!0));
1640
+ const i = Di(this.getAttribute("log-level"));
1641
+ d(this, U, Kr.get().createContext("VindralController")), e(this, U).setLevel(i);
1642
+ }
1643
+ connectedCallback() {
1644
+ return $(this, null, function* () {
1645
+ T(this.getAttribute("auto-instance-enabled"), !0) && (yield r(this, c, Yi).call(this));
1646
+ for (const i of Object.values(f))
1647
+ this.addEventListener(i, e(this, He));
1648
+ window.PointerEvent ? (this.addEventListener("pointerdown", this), this.addEventListener("pointermove", this), this.addEventListener("pointerup", this)) : this.addEventListener("mousemove", this), this.addEventListener("mouseleave", this), this.addEventListener("keydown", this), this.addEventListener("resize", this), this.addEventListener("dblclick", this), this.connectListener(this);
1649
+ });
1650
+ }
1651
+ disconnectedCallback() {
1652
+ var t, i, s, o;
1653
+ (t = e(this, b)) == null || t.unload(), (i = e(this, nt)) == null || i.unload(), (s = e(this, B)) == null || s.unload(), (o = e(this, F)) == null || o.unload();
1654
+ for (const u of Object.values(f))
1655
+ this.removeEventListener(u, e(this, He));
1656
+ this.disconnectListener(this);
1657
+ }
1658
+ attributeChangedCallback(t, i, s) {
1659
+ var o, u, p, v, g, P, tt, j, It, Ct, Lt;
1660
+ if (i != s)
1661
+ switch (e(this, U).debug("Attribute changed", { name: t, oldValue: i, newValue: s }), t) {
1662
+ case "channel-id":
1663
+ d(this, it, s), e(this, b) && s && (e(this, b).channelId = s, e(this, b).play(), r(this, c, A).call(this, n.BUFFERING, ""), r(this, c, A).call(this, n.CHANNEL_ID, s), r(this, c, A).call(this, n.POSTER_SRC, e(this, b).getThumbnailUrl()));
1664
+ break;
1665
+ case "channel-group-id":
1666
+ d(this, st, s);
1667
+ break;
1668
+ case "url":
1669
+ s && d(this, Me, s);
1670
+ break;
1671
+ case "paused":
1672
+ x(s) ? (o = e(this, b)) == null || o.pause() : (u = e(this, b)) == null || u.play();
1673
+ break;
1674
+ case "target-buffer-time":
1675
+ if (e(this, b) && s) {
1676
+ const Ot = parseInt(s, 10);
1677
+ Number.isNaN(Ot) || (e(this, b).targetBufferTime = Ot);
1678
+ }
1679
+ break;
1680
+ case "user-interacting":
1681
+ x(s) ? r(this, c, A).call(this, n.USER_INTERACTING, "") : r(this, c, C).call(this, n.USER_INTERACTING);
1682
+ break;
1683
+ case "muted":
1684
+ e(this, b) && (x(s) ? (e(this, b).muted = !0, r(this, c, A).call(this, n.MUTED, ""), (p = e(this, F)) != null && p.isMediaElementSource && ((v = e(this, F)) == null || v.stop(), r(this, c, A).call(this, n.VOLUME_LEVEL, JSON.stringify({ left: null, right: null })))) : (e(this, b).muted = !1, r(this, c, C).call(this, n.MUTED), e(this, b).volume === 0 && (e(this, b).volume = 0.3), (g = e(this, F)) == null || g.start()));
1685
+ break;
1686
+ case "ui-locked":
1687
+ x(s) ? r(this, c, ci).call(this) : r(this, c, ht).call(this);
1688
+ break;
1689
+ case "is-fullscreen":
1690
+ x(s) ? r(this, c, Pn).call(this) : r(this, c, Zi).call(this);
1691
+ break;
1692
+ case "max-video-bit-rate":
1693
+ d(this, Qt, s), x(s) ? r(this, c, A).call(this, n.MAX_VIDEO_BITRATE, s) : r(this, c, C).call(this, n.MAX_VIDEO_BITRATE);
1694
+ break;
1695
+ case "is-pip":
1696
+ x(s) ? r(this, c, Un).call(this) : r(this, c, _n).call(this);
1697
+ break;
1698
+ case "is-airplaying":
1699
+ x(s) ? ((P = e(this, b)) != null && P.mediaElement && (e(this, b).mediaElement.style.display = "hidden"), (tt = e(this, b)) == null || tt.pause()) : (j = e(this, b)) != null && j.mediaElement && (e(this, b).mediaElement.style.display = "block");
1700
+ break;
1701
+ case "is-casting":
1702
+ x(s) ? ((It = e(this, B)) != null && It.isFullscreen() && r(this, c, Zi).call(this), (Ct = e(this, b)) == null || Ct.pause()) : document.hidden || (Lt = e(this, b)) == null || Lt.play();
1703
+ break;
1704
+ case "cast-receiver-id":
1705
+ d(this, De, s);
1706
+ break;
1707
+ case "cast-background":
1708
+ d(this, Fe, s);
1709
+ break;
1710
+ case "language":
1711
+ e(this, b) && (e(this, b).language = s, x(s) ? r(this, c, A).call(this, n.LANGUAGE, s) : r(this, c, C).call(this, n.LANGUAGE));
1712
+ break;
1713
+ case "text-track":
1714
+ e(this, b) && (e(this, b).textTrack = s, x(s) ? r(this, c, A).call(this, n.TEXT_TRACK, s) : r(this, c, C).call(this, n.TEXT_TRACK));
1715
+ break;
1716
+ case "log-level":
1717
+ x(s) && e(this, U).setLevel(Di(s));
1718
+ break;
1719
+ case "authentication-token":
1720
+ x(s) ? r(this, c, A).call(this, n.AUTHENTICATION_TOKEN, s) : r(this, c, C).call(this, n.AUTHENTICATION_TOKEN);
1721
+ break;
1722
+ case "volume":
1723
+ if (e(this, b) && x(s)) {
1724
+ const Ot = parseFloat(s);
1725
+ e(this, b).volume = Ot;
1726
+ }
1727
+ break;
1728
+ }
1729
+ }
1730
+ connectListener(t) {
1731
+ Hs(t).forEach((s) => {
1732
+ var u, p;
1733
+ const o = e(this, et).get(s);
1734
+ switch (o ? o.push(t) : e(this, et).set(s, [t]), s) {
1735
+ case n.PAUSED:
1736
+ (((u = e(this, b)) == null ? void 0 : u.playbackState) === "paused" || this.hasAttribute(n.PAUSED)) && t.setAttribute(n.PAUSED, "");
1737
+ break;
1738
+ case n.MUTED:
1739
+ ((p = e(this, b)) != null && p.muted || this.hasAttribute(n.MUTED)) && t.setAttribute(n.MUTED, "");
1740
+ break;
1741
+ case n.MAX_VIDEO_BITRATE:
1742
+ e(this, Qt) && t.setAttribute(n.MAX_VIDEO_BITRATE, e(this, Qt));
1743
+ break;
1744
+ case n.CHANNEL_ID:
1745
+ e(this, it) && t.setAttribute(n.CHANNEL_ID, e(this, it));
1746
+ break;
1747
+ case n.CHANNEL_GROUP_ID:
1748
+ e(this, st) && t.setAttribute(n.CHANNEL_GROUP_ID, e(this, st));
1749
+ break;
1750
+ case n.AUTHENTICATION_TOKEN: {
1751
+ const v = this.getAttribute("authentication-token");
1752
+ v && t.setAttribute(n.AUTHENTICATION_TOKEN, v);
1753
+ break;
1754
+ }
1755
+ }
1756
+ });
1757
+ }
1758
+ disconnectListener(t) {
1759
+ Hs(t).forEach((s) => {
1760
+ const o = e(this, et).get(s);
1761
+ o && e(this, et).set(
1762
+ s,
1763
+ o.filter((u) => u != t)
1764
+ );
1765
+ });
1766
+ }
1767
+ get instance() {
1768
+ return e(this, b);
1769
+ }
1770
+ connect() {
1771
+ r(this, c, Yi).call(this);
1772
+ }
1773
+ };
1774
+ wi = new WeakMap(), et = new WeakMap(), Pe = new WeakMap(), pt = new WeakMap(), bt = new WeakMap(), b = new WeakMap(), Me = new WeakMap(), it = new WeakMap(), st = new WeakMap(), Qt = new WeakMap(), nt = new WeakMap(), B = new WeakMap(), mt = new WeakMap(), F = new WeakMap(), rt = new WeakMap(), De = new WeakMap(), Fe = new WeakMap(), U = new WeakMap(), vt = new WeakMap(), c = new WeakSet(), Yi = function() {
1775
+ return $(this, null, function* () {
1776
+ var Us, _s;
1777
+ if (!e(this, it)) return;
1778
+ yield (Us = e(this, b)) == null ? void 0 : Us.unload();
1779
+ const t = this.hasAttribute(n.PAUSED), i = this.hasAttribute(n.MUTED), s = zs(this.getAttribute(n.MEDIA)), o = this.getAttribute(n.TEXT_TRACK) || void 0, u = this.getAttribute("edge-url") || void 0, p = this.getAttribute("authentication-token") || void 0, v = ai(this.getAttribute("max-video-bit-rate")), g = so(this.getAttribute("max-size")), P = ai(this.getAttribute("min-buffer-time")), tt = ai(this.getAttribute("max-buffer-time")), j = T(this.getAttribute("burst-enabled")), It = T(this.getAttribute("mse-enabled")), Ct = T(this.getAttribute("mse-opus-enabled")), Lt = T(this.getAttribute("ios-background-play-enabled")), Ot = T(this.getAttribute("ios-wake-lock-enabled")), Ir = T(this.getAttribute("ios-media-element-enabled")), Cr = T(this.getAttribute("abr-enabled")), Lr = T(this.getAttribute("size-based-resolution-cap-enabled")), Tr = T(this.getAttribute("telemetry-enabled")), xr = io(this.getAttribute("video-codecs")), Ns = Bs(this.getAttribute("poster")), Sr = no(this.getAttribute("advanced")), Nr = Di(this.getAttribute("log-level")), Rr = Ds(this.getAttribute("drm-headers")), Ur = Ds(this.getAttribute("drm-queryparams")), _r = T(this.getAttribute("webtransport-enabled")), Rs = ai(this.getAttribute("reconnect-retries")), Pr = Rs !== void 0 ? (w) => w.reconnectRetries < Rs : void 0;
1780
+ d(this, b, new qr({
1781
+ url: e(this, Me),
1782
+ channelId: e(this, it),
1783
+ channelGroupId: e(this, st),
1784
+ edgeUrl: u,
1785
+ authenticationToken: p,
1786
+ muted: i,
1787
+ media: s,
1788
+ maxSize: g,
1789
+ maxVideoBitRate: v,
1790
+ minBufferTime: P,
1791
+ maxBufferTime: tt,
1792
+ burstEnabled: j,
1793
+ mseEnabled: It,
1794
+ mseOpusEnabled: Ct,
1795
+ iosBackgroundPlayEnabled: Lt,
1796
+ iosWakeLockEnabled: Ot,
1797
+ iosMediaElementEnabled: Ir,
1798
+ abrEnabled: Cr,
1799
+ sizeBasedResolutionCapEnabled: Lr,
1800
+ telemetryEnabled: Tr,
1801
+ videoCodecs: xr,
1802
+ poster: Ns,
1803
+ textTrack: o,
1804
+ advanced: Sr,
1805
+ logLevel: Nr,
1806
+ drm: { headers: Rr, queryParams: Ur },
1807
+ webtransportEnabled: _r,
1808
+ reconnectHandler: Pr
1809
+ })), e(this, b).on("rendition levels", (w) => {
1810
+ const M = w.filter((oi) => {
1811
+ var le;
1812
+ return (le = oi.video) == null ? void 0 : le.width;
1813
+ });
1814
+ r(this, c, A).call(this, n.RENDITION_LEVELS, JSON.stringify(M));
1815
+ }), e(this, b).on("rendition level", (w) => {
1816
+ r(this, c, A).call(this, n.RENDITION_LEVEL, JSON.stringify(w));
1817
+ }), e(this, b).on("playback state", (w) => {
1818
+ switch (w) {
1819
+ case "playing":
1820
+ r(this, c, C).call(this, n.PAUSED), r(this, c, C).call(this, n.BUFFERING);
1821
+ break;
1822
+ case "paused":
1823
+ r(this, c, A).call(this, n.PAUSED, ""), r(this, c, C).call(this, n.BUFFERING);
1824
+ break;
1825
+ case "buffering":
1826
+ r(this, c, C).call(this, n.PAUSED), r(this, c, A).call(this, n.BUFFERING, "");
1827
+ break;
1828
+ }
1829
+ }), e(this, b).on("volume state", (w) => {
1830
+ r(this, c, A).call(this, n.VOLUME, w.volume.toString()), w.isMuted ? r(this, c, A).call(this, n.MUTED, "") : r(this, c, C).call(this, n.MUTED);
1831
+ }), e(this, b).on("channel switch failed", ({ channelId: w }) => {
1832
+ var M;
1833
+ this.setAttribute(n.CHANNEL_ID, w), ((M = e(this, b)) == null ? void 0 : M.playbackState) !== "buffering" && r(this, c, C).call(this, n.BUFFERING);
1834
+ }), e(this, b).on("channel switch", ({ channelId: w }) => {
1835
+ var M;
1836
+ e(this, it) !== w && this.setAttribute(n.CHANNEL_ID, w), ((M = e(this, b)) == null ? void 0 : M.playbackState) !== "buffering" && r(this, c, C).call(this, n.BUFFERING);
1837
+ }), e(this, b).on("channels", (w) => {
1838
+ d(this, Nt, Date.now()), r(this, c, A).call(this, n.CHANNELS, JSON.stringify(w));
1839
+ }), e(this, b).on("languages", (w) => {
1840
+ var M;
1841
+ r(this, c, A).call(this, n.LANGUAGES, JSON.stringify(w)), (M = e(this, b)) != null && M.language && r(this, c, A).call(this, n.LANGUAGE, e(this, b).language);
1842
+ }), e(this, b).on("text tracks", (w) => {
1843
+ var M, oi, le;
1844
+ r(this, c, A).call(this, n.TEXT_TRACKS, JSON.stringify(w)), (M = e(this, b)) != null && M.textTrack && r(this, c, A).call(this, n.TEXT_TRACK, (le = (oi = e(this, b)) == null ? void 0 : oi.textTrack) != null ? le : "");
1845
+ }), e(this, b).on("needs user input", () => {
1846
+ r(this, c, A).call(this, n.NEEDS_USER_INPUT, "");
1847
+ }), e(this, b).on("is live", (w) => {
1848
+ w || r(this, c, C).call(this, n.BUFFERING);
1849
+ }), d(this, bt, (_s = this.shadowRoot) == null ? void 0 : _s.querySelector("#video")), e(this, bt) && e(this, b).attach(e(this, bt)), this.setAttribute(n.MEDIA, e(this, b).media), e(this, b).muted && r(this, c, A).call(this, n.MUTED, ""), r(this, c, A).call(this, n.VOLUME, e(this, b).volume.toString()), x(Ns) || r(this, c, A).call(this, n.POSTER_SRC, e(this, b).getThumbnailUrl());
1850
+ const Mr = T(this.getAttribute(n.AIRPLAY_ENABLED), !1), Dr = T(this.getAttribute(n.CAST_ENABLED), !0), Fr = T(this.getAttribute(n.FULLSCREEN_ENABLED), !0), Or = T(this.getAttribute(n.PIP_ENABLED), !0), Hr = T(this.getAttribute(n.VU_METER_ENABLED), !1);
1851
+ Mr && r(this, c, Cn).call(this, e(this, b)), Dr && r(this, c, wn).call(this, e(this, b)), Fr && r(this, c, kn).call(this, e(this, b)), Or && r(this, c, yn).call(this, e(this, b)), t || e(this, b).play(), Hr && r(this, c, Ln).call(this, e(this, b)), this.dispatchEvent(
1852
+ new CustomEvent("vindral-instance-ready", { bubbles: !0, composed: !0, detail: e(this, b) })
1853
+ );
1854
+ });
1855
+ }, yn = function(t) {
1856
+ t.mediaElement instanceof HTMLVideoElement && (d(this, nt, new ao(t.mediaElement)), e(this, nt).isSupported() && (e(this, U).info("PIP is supported"), r(this, c, A).call(this, n.PIP_AVAILABLE, "")), e(this, nt).on("on picture in picture change", (i) => {
1857
+ i ? r(this, c, A).call(this, n.IS_PIP, "") : r(this, c, C).call(this, n.IS_PIP);
1858
+ }));
1859
+ }, kn = function(t) {
1860
+ const i = !ue.isFullscreenApiSupported(this) && ue.isFullscreenApiSupported(t.mediaElement) ? t.mediaElement : this;
1861
+ d(this, B, new ue(i)), e(this, B).on("on fullscreen change", (s) => {
1862
+ s ? r(this, c, A).call(this, n.FULLSCREEN, "") : r(this, c, C).call(this, n.FULLSCREEN);
1863
+ });
1864
+ }, wn = function(t) {
1865
+ d(this, rt, new Jr({
1866
+ background: e(this, Fe),
1867
+ receiverApplicationId: e(this, De),
1868
+ options: t.getCastOptions()
1869
+ })), e(this, rt).init().then(() => {
1870
+ var i, s, o;
1871
+ r(this, c, A).call(this, n.CAST_AVAILABLE, ""), (i = e(this, rt)) == null || i.on("connected", r(this, c, Ji).bind(this)), (s = e(this, rt)) == null || s.on("resumed", r(this, c, Ji).bind(this)), (o = e(this, rt)) == null || o.on("disconnected", r(this, c, In).bind(this));
1872
+ }).catch((i) => {
1873
+ e(this, U).warn("Failed to initialize CastSender", i);
1874
+ });
1875
+ }, Ji = function() {
1876
+ var i, s;
1877
+ r(this, c, A).call(this, n.IS_CASTING, "");
1878
+ const t = (s = (i = e(this, rt)) == null ? void 0 : i.getReceiverName()) != null ? s : "device";
1879
+ r(this, c, A).call(this, n.CAST_RECEIVER_NAME, t);
1880
+ }, In = function() {
1881
+ r(this, c, C).call(this, n.IS_CASTING), r(this, c, C).call(this, n.CAST_RECEIVER_NAME);
1882
+ }, Cn = function(t) {
1883
+ const i = t.getCastOptions();
1884
+ d(this, mt, new oo({
1885
+ url: i.url,
1886
+ channelId: i.channelId,
1887
+ authenticationToken: i.authenticationToken,
1888
+ container: this
1889
+ })), e(this, mt).once("available", () => {
1890
+ r(this, c, A).call(this, n.AIRPLAY_AVAILABLE, "");
1891
+ }), e(this, mt).on("connected", () => {
1892
+ r(this, c, A).call(this, n.IS_AIRPLAYING, "");
1893
+ }), e(this, mt).on("disconnected", () => {
1894
+ r(this, c, C).call(this, n.IS_AIRPLAYING);
1895
+ });
1896
+ }, Ln = function(t) {
1897
+ var i;
1898
+ if ((i = e(this, F)) == null || i.unload(), !Xr()) {
1899
+ if (t.audioNode)
1900
+ d(this, F, new Os(t.audioNode));
1901
+ else if (t.mediaElement instanceof HTMLMediaElement)
1902
+ d(this, F, new Os(t.mediaElement));
1903
+ else
1904
+ return;
1905
+ e(this, F).on("on decibel change", (s) => {
1906
+ r(this, c, A).call(this, n.VOLUME_LEVEL, JSON.stringify(s));
1907
+ }), r(this, c, A).call(this, n.VOLUME_LEVEL, JSON.stringify({ left: null, right: null })), (!e(this, F).isMediaElementSource || !this.hasAttribute(n.MUTED)) && e(this, F).start();
1908
+ }
1909
+ }, Oe = new WeakMap(), Tn = function(t) {
1910
+ t.pointerType !== "mouse" && t.timeStamp - e(this, Oe) < 250 || (r(this, c, ci).call(this), e(this, pt) && clearTimeout(e(this, pt)), t.target instanceof HTMLElement && ([this, e(this, bt)].includes(t.target) || t.target.localName === "vindral-scroll-overlay") && r(this, c, ht).call(this));
1911
+ }, xn = function(t) {
1912
+ const i = this.hasAttribute(n.USER_INTERACTING);
1913
+ t.pointerType === "touch" && t.target instanceof HTMLElement ? [this, e(this, bt)].includes(t.target) && i ? r(this, c, Wi).call(this) : r(this, c, ht).call(this) : t.composedPath().some((s) => s instanceof HTMLElement && ["vindral-play-button"].includes(s == null ? void 0 : s.localName)) && r(this, c, ht).call(this);
1914
+ }, Sn = function(t) {
1915
+ !e(this, B) || t.target instanceof Z || t.target instanceof xs || (this.hasAttribute(n.FULLSCREEN) ? this.removeAttribute(n.FULLSCREEN) : this.setAttribute(n.FULLSCREEN, ""));
1916
+ }, Nn = function(t) {
1917
+ this.hasAttribute(n.USER_INTERACTING) || r(this, c, ht).call(this);
1918
+ }, He = new WeakMap(), Ii = new WeakMap(), Ci = new WeakMap(), Rn = function(t) {
1919
+ var p, v;
1920
+ const { metaKey: i, altKey: s, key: o } = t;
1921
+ if (!(i || s || !Fi.includes(o) || (((p = t.target) == null ? void 0 : p.keysUsed) || []).includes(o)))
1922
+ switch (o) {
1923
+ case "f":
1924
+ this.hasAttribute(n.FULLSCREEN) ? this.removeAttribute(n.FULLSCREEN) : this.setAttribute(n.FULLSCREEN, "");
1925
+ break;
1926
+ case "m":
1927
+ this.hasAttribute(n.MUTED) ? this.removeAttribute(n.MUTED) : this.setAttribute(n.MUTED, "");
1928
+ break;
1929
+ case "ArrowDown":
1930
+ (v = this.querySelector("vindral-scroll-overlay")) == null || v.setAttribute("open", "");
1931
+ break;
1932
+ }
1933
+ }, Nt = new WeakMap(), Qi = function() {
1934
+ return $(this, null, function* () {
1935
+ if (!e(this, b) || !e(this, st))
1936
+ return;
1937
+ const t = Date.now();
1938
+ if (e(this, Nt) && t - e(this, Nt) < 1e4)
1939
+ e(this, U).debug("Skipping channel update, last update was less than 10 seconds ago.");
1940
+ else {
1941
+ d(this, Nt, t);
1942
+ const i = yield e(this, b).getApiClient().getChannels(e(this, st));
1943
+ r(this, c, A).call(this, n.CHANNELS, JSON.stringify(i));
1944
+ }
1945
+ d(this, vt, window.setTimeout(() => void r(this, c, Qi).call(this), 1e4));
1946
+ });
1947
+ }, Wi = function() {
1948
+ !this.hasAttribute(n.USER_INTERACTING) || this.hasAttribute(n.UI_LOCKED) || (this.dispatchEvent(
1949
+ new CustomEvent("user-interacting", { bubbles: !0, composed: !0, detail: { active: !1 } })
1950
+ ), this.removeAttribute(n.USER_INTERACTING));
1951
+ }, ci = function() {
1952
+ this.hasAttribute(n.USER_INTERACTING) || requestAnimationFrame(() => {
1953
+ this.setAttribute(n.USER_INTERACTING, ""), this.dispatchEvent(
1954
+ new CustomEvent("user-interacting", { bubbles: !0, composed: !0, detail: { active: !0 } })
1955
+ );
1956
+ });
1957
+ }, ht = function() {
1958
+ r(this, c, ci).call(this), e(this, pt) && clearTimeout(e(this, pt)), e(this, Pe) && d(this, pt, self.setTimeout(() => {
1959
+ r(this, c, Wi).call(this);
1960
+ }, e(this, Pe)));
1961
+ }, Un = function() {
1962
+ var t;
1963
+ r(this, c, ts).call(this), (t = e(this, nt)) == null || t.request().catch((i) => {
1964
+ e(this, U).warn("Failed to enter picture in picture:", i);
1965
+ });
1966
+ }, _n = function() {
1967
+ var t;
1968
+ (t = e(this, nt)) == null || t.exit().catch((i) => {
1969
+ e(this, U).warn("Failed to exit picture in picture:", i);
1970
+ });
1971
+ }, Pn = function() {
1972
+ var t, i;
1973
+ (t = e(this, B)) != null && t.isFullscreenApiSupported() ? (r(this, c, ts).call(this), (i = e(this, B)) == null || i.request().then(() => {
1974
+ e(this, Li).call(this);
1975
+ }).catch((s) => {
1976
+ e(this, U).warn("Failed to enter fullscreen:", s);
1977
+ })) : (this.setAttribute(n.FULLSCREEN_FALLBACK, ""), r(this, c, A).call(this, n.FULLSCREEN, ""));
1978
+ }, Zi = function() {
1979
+ var t, i;
1980
+ (t = e(this, B)) != null && t.isFullscreenApiSupported() ? (i = e(this, B)) == null || i.exit().then(() => {
1981
+ e(this, Ti).call(this);
1982
+ }).catch((s) => {
1983
+ e(this, U).warn("Failed to exit fullscreen:", s);
1984
+ }) : (this.removeAttribute(n.FULLSCREEN_FALLBACK), r(this, c, C).call(this, n.FULLSCREEN));
1985
+ }, Li = new WeakMap(), Ti = new WeakMap(), ts = function() {
1986
+ if (!e(this, b)) return;
1987
+ e(this, b).emitter.emit("ios-hack: reset size");
1988
+ }, A = function(t, i) {
1989
+ var s;
1990
+ (s = e(this, et).get(t)) == null || s.forEach((o) => o.setAttribute(t, i));
1991
+ }, C = function(t) {
1992
+ var i;
1993
+ (i = e(this, et).get(t)) == null || i.forEach((s) => s.removeAttribute(t));
1994
+ }, m(ve, "observedAttributes", [
1995
+ ...$s,
1996
+ "url",
1997
+ "edge-url",
1998
+ "target-buffer-time",
1999
+ "cast-receiver-id",
2000
+ "cast-background",
2001
+ "log-level",
2002
+ "max-size",
2003
+ "min-buffer-time",
2004
+ "max-buffer-time",
2005
+ "max-audio-bit-rate",
2006
+ "burst-enabled",
2007
+ "mse-enabled",
2008
+ "mse-opus-enabled",
2009
+ "ios-background-play-enabled",
2010
+ "ios-wake-lock-enabled",
2011
+ "ios-media-element-enabled",
2012
+ "abr-enabled",
2013
+ "size-based-resolution-cap-enabled",
2014
+ "telemetry-enabled",
2015
+ "video-codecs",
2016
+ "poster",
2017
+ "advanced",
2018
+ "drm-headers",
2019
+ "drm-queryparams",
2020
+ "webtransport-enabled",
2021
+ "reconnect-retries",
2022
+ "auto-instance-enabled"
2023
+ ]), l(ve, wi, "https://lb.cdn.vindral.com");
2024
+ let Ce = ve;
2025
+ const Mn = document.createElement("template"), lo = (
2026
+ /* SVG */
2027
+ `
2028
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-maximize"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 8v-2a2 2 0 0 1 2 -2h2" /><path d="M4 16v2a2 2 0 0 0 2 2h2" /><path d="M16 4h2a2 2 0 0 1 2 2v2" /><path d="M16 20h2a2 2 0 0 0 2 -2v-2" /></svg>
2029
+ `
2030
+ ), co = (
2031
+ /* SVG */
2032
+ `
2033
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-minimize"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 19v-2a2 2 0 0 1 2 -2h2" /><path d="M15 5v2a2 2 0 0 0 2 2h2" /><path d="M5 15h2a2 2 0 0 1 2 2v2" /><path d="M5 9h2a2 2 0 0 0 2 -2v-2" /></svg>
2034
+ `
2035
+ );
2036
+ Mn.innerHTML = /* HTML */
2037
+ `
2038
+ <style>
2039
+ :host {
2040
+ display: var(--fullscreen-button-display);
2041
+ }
2042
+
2043
+ slot > svg {
2044
+ display: block;
2045
+ }
2046
+
2047
+ :host([${n.FULLSCREEN}]) slot[name="enter"] {
2048
+ display: none !important;
2049
+ }
2050
+
2051
+ :host(:not([${n.FULLSCREEN}])) slot[name="exit"] {
2052
+ display: none !important;
2053
+ }
2054
+ </style>
2055
+
2056
+ <slot name="icon">
2057
+ <slot name="enter">${lo}</slot>
2058
+ <slot name="exit">${co}</slot>
2059
+ </slot>
2060
+ `;
2061
+ const ge = class ge extends Z {
2062
+ constructor() {
2063
+ var a;
2064
+ super(), (a = this.shadowRoot) == null || a.appendChild(Mn.content.cloneNode(!0));
2065
+ }
2066
+ connectedCallback() {
2067
+ super.connectedCallback(), this.setAttribute("aria-label", this.isFullscreen ? "Exit fullscreen" : "Enter fullscreen");
2068
+ }
2069
+ disconnectedCallback() {
2070
+ super.disconnectedCallback();
2071
+ }
2072
+ attributeChangedCallback(a, t, i) {
2073
+ super.attributeChangedCallback(a, t, i), a === n.FULLSCREEN && this.setAttribute("aria-label", this.isFullscreen ? "Exit fullscreen" : "Enter fullscreen");
2074
+ }
2075
+ set isFullscreen(a) {
2076
+ a ? this.setAttribute(n.FULLSCREEN, "") : this.removeAttribute(n.FULLSCREEN);
2077
+ }
2078
+ get isFullscreen() {
2079
+ return this.hasAttribute(n.FULLSCREEN);
2080
+ }
2081
+ handleClick(a) {
2082
+ const t = this.isFullscreen ? f.EXIT_FULLSCREEN : f.ENTER_FULLSCREEN;
2083
+ this.dispatchEvent(new CustomEvent(t, { bubbles: !0, composed: !0 }));
2084
+ }
2085
+ };
2086
+ m(ge, "observedAttributes", [...G(ge, ge, "observedAttributes"), n.FULLSCREEN]);
2087
+ let es = ge;
2088
+ const ho = (
2089
+ /* SVG */
2090
+ `
2091
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 5h7" /><path d="M9 3v2c0 4.418 -2.239 8 -5 8" /><path d="M5 9c0 2.144 2.952 3.908 6.7 4" /><path d="M12 20l4 -9l4 9" /><path d="M19.1 18h-6.2" /></svg>
2092
+ `
2093
+ ), Dn = document.createElement("template");
2094
+ Dn.innerHTML = /* HTML */
2095
+ `
2096
+ <style>
2097
+ :host(:not([hidden])) {
2098
+ display: var(--language-menu-display);
2099
+ }
2100
+ </style>
2101
+
2102
+ <slot name="button">${ho}</slot>
2103
+ <slot name="listbox" hidden>
2104
+ <vindral-language-menu-list id="listbox" part="listbox"></vindral-language-menu-list>
2105
+ </slot>
2106
+ `;
2107
+ var Ge, ss;
2108
+ const fe = class fe extends xs {
2109
+ constructor() {
2110
+ var t, i, s, o;
2111
+ super();
2112
+ l(this, Ge);
2113
+ (t = this.shadowRoot) == null || t.appendChild(Dn.content.cloneNode(!0)), this.button = (i = this.shadowRoot) == null ? void 0 : i.querySelector("slot[name=button]"), this.listbox = (s = this.shadowRoot) == null ? void 0 : s.querySelector("[part=listbox]"), this.listboxSlot = (o = this.shadowRoot) == null ? void 0 : o.querySelector("slot[name=listbox]");
2114
+ }
2115
+ connectedCallback() {
2116
+ super.connectedCallback(), r(this, Ge, ss).call(this), this.setAttribute("aria-label", "Languages");
2117
+ }
2118
+ attributeChangedCallback(t, i, s) {
2119
+ super.attributeChangedCallback(t, i, s), (t === n.LANGUAGES || t === n.TEXT_TRACKS) && r(this, Ge, ss).call(this);
2120
+ }
2121
+ };
2122
+ Ge = new WeakSet(), ss = function() {
2123
+ const t = this.getAttribute(n.LANGUAGES), i = this.getAttribute(n.TEXT_TRACKS);
2124
+ (!t || t === "[]") && (!i || i === "[]") ? this.setAttribute("hidden", "") : this.removeAttribute("hidden");
2125
+ }, m(fe, "observedAttributes", [...G(fe, fe, "observedAttributes"), n.LANGUAGES, n.TEXT_TRACKS]);
2126
+ let is = fe;
2127
+ const Fn = document.createElement("template"), uo = (
2128
+ /* SVG */
2129
+ `
2130
+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="#fff" viewBox="0 0 78.369 78.369" xml:space="preserve"><path d="M78.049 19.015 29.458 67.606a1.094 1.094 0 0 1-1.548 0L.32 40.015a1.094 1.094 0 0 1 0-1.547l6.704-6.704a1.095 1.095 0 0 1 1.548 0l20.113 20.112 41.113-41.113a1.095 1.095 0 0 1 1.548 0l6.703 6.704a1.094 1.094 0 0 1 0 1.548z"/></svg>
2131
+ `
2132
+ );
2133
+ Fn.innerHTML = /* HTML */
2134
+ `
2135
+ <style>
2136
+ :host {
2137
+ font: inherit;
2138
+ cursor: default;
2139
+ padding: var(--padding-2);
2140
+ padding-top: var(--padding-3);
2141
+ border-radius: 0.25em;
2142
+ position: absolute;
2143
+ min-width: 140px;
2144
+ background: var(--bg-subtle);
2145
+ z-index: 1;
2146
+ overflow: auto;
2147
+ display: flex;
2148
+ flex-direction: row;
2149
+ gap: var(--padding-3);
2150
+ }
2151
+
2152
+ :host([list-position="top"]) {
2153
+ bottom: calc(100% + 0.5em);
2154
+ transform: translate(-50%);
2155
+ }
2156
+
2157
+ :host([list-position="bottom"]) {
2158
+ top: calc(100% + 0.5em);
2159
+ }
2160
+
2161
+ :host::-webkit-scrollbar {
2162
+ width: 5px;
2163
+ padding-right: 5px;
2164
+ }
2165
+
2166
+ :host::-webkit-scrollbar-thumb {
2167
+ background-color: var(--fg-extra-subtle);
2168
+ border-radius: 10px;
2169
+ border: 0;
2170
+ }
2171
+
2172
+ :host::-webkit-scrollbar-track {
2173
+ border-radius: 10px;
2174
+ background-color: transparent;
2175
+ }
2176
+
2177
+ .menu {
2178
+ display: grid;
2179
+ gap: var(--padding-1);
2180
+ }
2181
+
2182
+ .menu-container {
2183
+ display: flex;
2184
+ flex-direction: column;
2185
+ flex: 1;
2186
+ }
2187
+
2188
+ [role="menuitem"] {
2189
+ position: relative;
2190
+ cursor: pointer;
2191
+ display: flex;
2192
+ align-items: center;
2193
+ height: 44px;
2194
+ padding: 0 var(--padding-3);
2195
+ padding-left: var(--padding-6);
2196
+ border-radius: 4px;
2197
+ font-size: 14px;
2198
+ }
2199
+
2200
+ [role="menuitem"]:hover {
2201
+ background: var(--bg-component-hover);
2202
+ }
2203
+
2204
+ [role="menuitem"][aria-selected="true"] {
2205
+ background: var(--bg-component-active);
2206
+ }
2207
+
2208
+ [role="menuitem"][aria-selected="true"]::before {
2209
+ content: url("data:image/svg+xml,${encodeURIComponent(uo)}");
2210
+ position: absolute;
2211
+ left: var(--padding-3);
2212
+ top: calc(50% - 8px);
2213
+ }
2214
+
2215
+ [role="menuitem"]:focus-visible {
2216
+ box-shadow: inset 0 0 0 2px var(--fg-strong);
2217
+ outline: 0;
2218
+ }
2219
+
2220
+ .heading {
2221
+ text-transform: uppercase;
2222
+ margin-bottom: var(--padding-2);
2223
+ padding: 0 var(--padding-3);
2224
+ font-size: 11px;
2225
+ font-weight: bold;
2226
+ }
2227
+
2228
+ :host([${n.LANGUAGES}="[]"]) #languages,
2229
+ :host(:not([${n.LANGUAGES}])) #languages {
2230
+ display: none;
2231
+ }
2232
+
2233
+ :host([${n.TEXT_TRACKS}="[]"]) #text-tracks,
2234
+ :host(:not([${n.TEXT_TRACKS}])) #text-tracks {
2235
+ display: none;
2236
+ }
2237
+ </style>
2238
+
2239
+ <div id="languages" class="menu-container">
2240
+ <div class="heading">Language</div>
2241
+ <div class="menu"></div>
2242
+ </div>
2243
+ <div id="text-tracks" class="menu-container">
2244
+ <div class="heading">Subtitles</div>
2245
+ <div class="menu"></div>
2246
+ </div>
2247
+ `;
2248
+ var $e, ze, Be, Ke, Y, K, Rt, gt, Wt, qe, ot, J, E, Hn, Gn, ns, rs, hi, he, de, $n, zn, Bn, os, as, Kn;
2249
+ class On extends HTMLElement {
2250
+ constructor() {
2251
+ super();
2252
+ l(this, E);
2253
+ l(this, $e, []);
2254
+ l(this, ze, []);
2255
+ l(this, Be);
2256
+ l(this, Ke);
2257
+ l(this, Y, []);
2258
+ l(this, K, []);
2259
+ l(this, Rt, null);
2260
+ l(this, gt, null);
2261
+ l(this, Wt, null);
2262
+ l(this, qe, null);
2263
+ l(this, ot, null);
2264
+ l(this, J, null);
2265
+ m(this, "handleEvent", (t) => {
2266
+ switch (t.type) {
2267
+ case "keydown":
2268
+ r(this, E, zn).call(this, t);
2269
+ break;
2270
+ }
2271
+ });
2272
+ this.attachShadow({ mode: "open" }).appendChild(Fn.content.cloneNode(!0));
2273
+ }
2274
+ connectedCallback() {
2275
+ var i, s, o;
2276
+ const t = this.getRootNode();
2277
+ t instanceof ShadowRoot && (d(this, Wt, t.host.closest("vindral-controller")), (i = e(this, Wt)) == null || i.connectListener(this), d(this, Rt, (s = this.shadowRoot) == null ? void 0 : s.querySelector("#languages .menu")), d(this, gt, (o = this.shadowRoot) == null ? void 0 : o.querySelector("#text-tracks .menu")), r(this, E, Hn).call(this), r(this, E, Gn).call(this), d(this, qe, t.host), this.addEventListener("keydown", this));
2278
+ }
2279
+ disconnectedCallback() {
2280
+ this.removeEventListener("keydown", this);
2281
+ }
2282
+ attributeChangedCallback(t, i, s) {
2283
+ i !== s && (t === n.LANGUAGES && s && (this.languages = JSON.parse(s)), t === n.TEXT_TRACKS && s && (this.textTracks = JSON.parse(s)), t === n.LANGUAGE && (this.language = s), t === n.TEXT_TRACK && (this.textTrack = s));
2284
+ }
2285
+ set languages(t) {
2286
+ d(this, $e, t), r(this, E, rs).call(this), r(this, E, he).call(this);
2287
+ }
2288
+ set textTracks(t) {
2289
+ d(this, ze, t), r(this, E, ns).call(this), r(this, E, de).call(this);
2290
+ }
2291
+ set language(t) {
2292
+ d(this, Be, t), r(this, E, he).call(this);
2293
+ }
2294
+ set textTrack(t) {
2295
+ d(this, Ke, t), r(this, E, de).call(this);
2296
+ }
2297
+ get keysUsed() {
2298
+ return ["Enter", "Escape", "Tab", " ", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight", "Home", "End"];
2299
+ }
2300
+ focus() {
2301
+ e(this, ot) ? e(this, ot).focus() : e(this, J) && e(this, J).focus();
2302
+ }
2303
+ }
2304
+ $e = new WeakMap(), ze = new WeakMap(), Be = new WeakMap(), Ke = new WeakMap(), Y = new WeakMap(), K = new WeakMap(), Rt = new WeakMap(), gt = new WeakMap(), Wt = new WeakMap(), qe = new WeakMap(), ot = new WeakMap(), J = new WeakMap(), E = new WeakSet(), Hn = function() {
2305
+ const t = (s) => {
2306
+ s.forEach((o) => {
2307
+ if (o.intersectionRatio !== 1)
2308
+ if (o.intersectionRatio > 0) {
2309
+ const u = this.offsetHeight, p = o.intersectionRatio, g = u * p - 24;
2310
+ this.style.height = `${g}px`;
2311
+ } else
2312
+ this.style.height = "auto";
2313
+ });
2314
+ };
2315
+ new IntersectionObserver(t, {
2316
+ root: e(this, Wt),
2317
+ // The parent element to use as the viewport
2318
+ threshold: 0
2319
+ // 0 means any intersection is enough to be considered "inside"
2320
+ }).observe(this);
2321
+ }, Gn = function() {
2322
+ e(this, Rt) && (r(this, E, rs).call(this), r(this, E, he).call(this)), e(this, gt) && (r(this, E, ns).call(this), r(this, E, de).call(this));
2323
+ }, ns = function() {
2324
+ e(this, gt).innerHTML = "", d(this, K, []);
2325
+ const t = r(this, E, hi).call(this, "Off", "textTrack", void 0);
2326
+ e(this, gt).appendChild(t), e(this, K).push({ element: t, value: void 0 }), e(this, ze).forEach((i) => {
2327
+ const s = r(this, E, hi).call(this, i, "textTrack", i);
2328
+ e(this, gt).appendChild(s), e(this, K).push({ element: s, value: i });
2329
+ }), r(this, E, de).call(this);
2330
+ }, rs = function() {
2331
+ e(this, Rt).innerHTML = "", d(this, Y, []), e(this, $e).forEach((t) => {
2332
+ const i = r(this, E, hi).call(this, t, "language", t);
2333
+ e(this, Rt).appendChild(i), e(this, Y).push({ element: i, value: t });
2334
+ }), r(this, E, he).call(this);
2335
+ }, hi = function(t, i, s) {
2336
+ const o = document.createElement("div");
2337
+ return o.setAttribute("role", "menuitem"), o.textContent = t, o.addEventListener("click", () => r(this, E, $n).call(this, s, i)), o;
2338
+ }, he = function() {
2339
+ e(this, ot) && (e(this, ot).removeAttribute("aria-selected"), e(this, ot).tabIndex = -1);
2340
+ const t = e(this, Y).find((i) => i.value === e(this, Be));
2341
+ t && (t.element.setAttribute("aria-selected", "true"), t.element.tabIndex = 0, d(this, ot, t.element));
2342
+ }, de = function() {
2343
+ e(this, J) && (e(this, J).removeAttribute("aria-selected"), e(this, J).tabIndex = -1);
2344
+ const t = e(this, K).find((i) => i.value === e(this, Ke));
2345
+ if (t)
2346
+ t.element.setAttribute("aria-selected", "true"), t.element.tabIndex = 0, d(this, J, t.element);
2347
+ else {
2348
+ const i = e(this, K).find((s) => s.value === void 0);
2349
+ i && (i.element.setAttribute("aria-selected", "true"), i.element.tabIndex = 0, d(this, J, i.element));
2350
+ }
2351
+ }, $n = function(t, i) {
2352
+ this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 }));
2353
+ const s = i === "language" ? f.SET_LANGUAGE : f.SET_TEXT_TRACK;
2354
+ this.dispatchEvent(new CustomEvent(s, { bubbles: !0, composed: !0, detail: t }));
2355
+ }, zn = function(t) {
2356
+ var p, v, g;
2357
+ const { key: i, ctrlKey: s, altKey: o, metaKey: u } = t;
2358
+ s || o || u || this.keysUsed.includes(i) && (t.preventDefault(), t.stopPropagation(), i === "Tab" || i === "Escape" ? (p = e(this, qe)) == null || p.hide() : i === "Enter" || i === " " ? (g = (v = r(this, E, as).call(this)) == null ? void 0 : v.element) == null || g.click() : r(this, E, Bn).call(this, t));
2359
+ }, Bn = function(t) {
2360
+ var g;
2361
+ const { key: i } = t, s = [...e(this, Y), ...e(this, K)], o = (g = r(this, E, as).call(this)) != null ? g : s[0];
2362
+ if (!o) return;
2363
+ const u = s.indexOf(o);
2364
+ let p = Math.max(0, u);
2365
+ i === "ArrowDown" ? p++ : i === "ArrowUp" ? p-- : i === "ArrowLeft" ? p = r(this, E, os).call(this, u, "left") : i === "ArrowRight" ? p = r(this, E, os).call(this, u, "right") : t.key === "Home" ? p = 0 : t.key === "End" && (p = s.length - 1), p < 0 && (p = s.length - 1), p > s.length - 1 && (p = 0);
2366
+ const v = s[p];
2367
+ v && (r(this, E, Kn).call(this, v.value), v.element.focus());
2368
+ }, os = function(t, i) {
2369
+ const s = e(this, Y).length, o = e(this, K).length;
2370
+ return i === "left" ? t < s ? s + o - 1 : t - s - 1 : t >= s ? 0 : t + s;
2371
+ }, as = function() {
2372
+ return [...e(this, Y), ...e(this, K)].find((t) => t.element.tabIndex === 0);
2373
+ }, Kn = function(t) {
2374
+ for (const i of [...e(this, Y), ...e(this, K)])
2375
+ i.element.tabIndex = i.value === t ? 0 : -1;
2376
+ }, m(On, "observedAttributes", [
2377
+ n.LANGUAGES,
2378
+ n.TEXT_TRACKS,
2379
+ n.LANGUAGE,
2380
+ n.TEXT_TRACK
2381
+ ]);
2382
+ const qn = document.createElement("template"), po = (
2383
+ /* SVG */
2384
+ `
2385
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" <g fill="none" stroke="currentColor">
2386
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" clip-rule="evenodd" />
2387
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" />
2388
+ </g></svg>
2389
+ `
2390
+ ), bo = (
2391
+ /* SVG */
2392
+ `
2393
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" <g fill="none" stroke="currentColor">
2394
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" /></svg>
2395
+ `
2396
+ );
2397
+ qn.innerHTML = /* HTML */
2398
+ `
2399
+ <style>
2400
+ :host {
2401
+ display: var(--mute-button-display);
2402
+ }
2403
+
2404
+ slot > svg {
2405
+ display: block;
2406
+ }
2407
+
2408
+ :host([${n.MUTED}]) slot[name="unmute"] {
2409
+ display: none !important;
2410
+ }
2411
+
2412
+ :host(:not([${n.MUTED}])) slot[name="mute"] {
2413
+ display: none !important;
2414
+ }
2415
+ </style>
2416
+
2417
+ <slot name="icon">
2418
+ <slot name="mute">${po}</slot>
2419
+ <slot name="unmute">${bo}</slot>
2420
+ </slot>
2421
+ `;
2422
+ const Ee = class Ee extends Z {
2423
+ constructor() {
2424
+ var a;
2425
+ super(), (a = this.shadowRoot) == null || a.appendChild(qn.content.cloneNode(!0));
2426
+ }
2427
+ connectedCallback() {
2428
+ super.connectedCallback(), this.setAttribute("aria-label", this.muted ? "UnMute" : "Mute");
2429
+ }
2430
+ disconnectedCallback() {
2431
+ super.disconnectedCallback();
2432
+ }
2433
+ attributeChangedCallback(a, t, i) {
2434
+ super.attributeChangedCallback(a, t, i), a === n.MUTED && this.setAttribute("aria-label", this.muted ? "UnMute" : "Mute");
2435
+ }
2436
+ set muted(a) {
2437
+ a ? this.setAttribute(n.MUTED, "") : this.removeAttribute(n.MUTED);
2438
+ }
2439
+ get muted() {
2440
+ return this.hasAttribute(n.MUTED);
2441
+ }
2442
+ handleClick(a) {
2443
+ const t = this.muted ? f.UNMUTE : f.MUTE;
2444
+ this.dispatchEvent(new CustomEvent(t, { bubbles: !0, composed: !0 }));
2445
+ }
2446
+ };
2447
+ m(Ee, "observedAttributes", [...G(Ee, Ee, "observedAttributes"), n.MUTED]);
2448
+ let ls = Ee;
2449
+ const Xn = document.createElement("template"), mo = (
2450
+ /* SVG */
2451
+ `
2452
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19 4a3 3 0 0 1 3 3v4a1 1 0 0 1 -2 0v-4a1 1 0 0 0 -1 -1h-14a1 1 0 0 0 -1 1v10a1 1 0 0 0 1 1h6a1 1 0 0 1 0 2h-6a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3z" /><path d="M20 13a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-5a2 2 0 0 1 -2 -2v-3a2 2 0 0 1 2 -2z" /></svg>
2453
+ `
2454
+ );
2455
+ Xn.innerHTML = /* HTML */
2456
+ `
2457
+ <style>
2458
+ :host {
2459
+ display: var(--pip-button-display);
2460
+ }
2461
+
2462
+ slot > svg {
2463
+ display: block;
2464
+ }
2465
+
2466
+ :host(:not([${n.PIP_AVAILABLE}])) {
2467
+ display: none !important;
2468
+ }
2469
+ </style>
2470
+ <slot name="icon">${mo}</slot>
2471
+ `;
2472
+ const Ae = class Ae extends Z {
2473
+ constructor() {
2474
+ var a;
2475
+ super(), (a = this.shadowRoot) == null || a.appendChild(Xn.content.cloneNode(!0));
2476
+ }
2477
+ connectedCallback() {
2478
+ super.connectedCallback(), this.setAttribute(
2479
+ "aria-label",
2480
+ this.isPictureInPictureActive ? "Exit picture in picture" : "Enter picture in picture"
2481
+ );
2482
+ }
2483
+ disconnectedCallback() {
2484
+ super.disconnectedCallback();
2485
+ }
2486
+ attributeChangedCallback(a, t, i) {
2487
+ super.attributeChangedCallback(a, t, i), a === n.IS_PIP && this.setAttribute(
2488
+ "aria-label",
2489
+ this.isPictureInPictureActive ? "Exit picture in picture" : "Enter picture in picture"
2490
+ );
2491
+ }
2492
+ set isPictureInPictureActive(a) {
2493
+ a ? this.setAttribute(n.IS_PIP, "") : this.removeAttribute(n.IS_PIP);
2494
+ }
2495
+ get isPictureInPictureActive() {
2496
+ return this.hasAttribute(n.IS_PIP);
2497
+ }
2498
+ handleClick(a) {
2499
+ const t = this.isPictureInPictureActive ? f.EXIT_PIP : f.ENTER_PIP;
2500
+ this.dispatchEvent(new CustomEvent(t, { bubbles: !0, composed: !0 }));
2501
+ }
2502
+ };
2503
+ m(Ae, "observedAttributes", [...G(Ae, Ae, "observedAttributes"), n.IS_PIP, n.PIP_AVAILABLE]);
2504
+ let cs = Ae;
2505
+ const Vn = document.createElement("template"), vo = (
2506
+ /* SVG */
2507
+ `
2508
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z" /></svg>
2509
+ `
2510
+ ), go = (
2511
+ /* SVG */
2512
+ `
2513
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z" /><path d="M17 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z" /></svg>
2514
+ `
2515
+ );
2516
+ Vn.innerHTML = /* HTML */
2517
+ `
2518
+ <style>
2519
+ :host {
2520
+ display: var(--play-button-display);
2521
+ }
2522
+
2523
+ slot > svg {
2524
+ display: block;
2525
+ }
2526
+
2527
+ :host([${n.PAUSED}]) slot[name="pause"] {
2528
+ display: none !important;
2529
+ }
2530
+
2531
+ :host(:not([${n.PAUSED}])) slot[name="play"] {
2532
+ display: none !important;
2533
+ }
2534
+ </style>
2535
+
2536
+ <slot name="icon">
2537
+ <slot name="play">${vo}</slot>
2538
+ <slot name="pause">${go}</slot>
2539
+ </slot>
2540
+ `;
2541
+ const ye = class ye extends Z {
2542
+ constructor() {
2543
+ var a;
2544
+ super(), (a = this.shadowRoot) == null || a.appendChild(Vn.content.cloneNode(!0));
2545
+ }
2546
+ connectedCallback() {
2547
+ super.connectedCallback(), this.setAttribute("aria-label", this.paused ? "Play" : "Pause");
2548
+ }
2549
+ disconnectedCallback() {
2550
+ super.disconnectedCallback();
2551
+ }
2552
+ attributeChangedCallback(a, t, i) {
2553
+ super.attributeChangedCallback(a, t, i), a === n.PAUSED && this.setAttribute("aria-label", this.paused ? "Play" : "Pause");
2554
+ }
2555
+ set paused(a) {
2556
+ a ? this.setAttribute(n.PAUSED, "") : this.removeAttribute(n.PAUSED);
2557
+ }
2558
+ get paused() {
2559
+ return this.hasAttribute(n.PAUSED);
2560
+ }
2561
+ handleClick(a) {
2562
+ const t = this.paused ? f.PLAY : f.PAUSE;
2563
+ this.dispatchEvent(new CustomEvent(t, { bubbles: !0, composed: !0 }));
2564
+ }
2565
+ };
2566
+ m(ye, "observedAttributes", [...G(ye, ye, "observedAttributes"), n.PAUSED]);
2567
+ let hs = ye;
2568
+ const q = {
2569
+ TITLE: "title",
2570
+ OFFLINE: "offline",
2571
+ REFRESH_POSTER_ENABLED: "refresh-poster-enabled",
2572
+ STREAM_POLL_ENABLED: "stream-poll-enabled"
2573
+ }, fo = Object.values(q);
2574
+ var Xe, Zt, ft, Ut, Et, At, at, H, ds, jn, us, ps;
2575
+ class Eo extends ri {
2576
+ constructor(t) {
2577
+ super();
2578
+ l(this, H);
2579
+ l(this, Xe);
2580
+ l(this, Zt);
2581
+ l(this, ft, !1);
2582
+ l(this, Ut, !1);
2583
+ l(this, Et, !0);
2584
+ l(this, At, null);
2585
+ l(this, at, null);
2586
+ d(this, Zt, t), d(this, Xe, new Qr({
2587
+ publicEndpoint: t.url,
2588
+ tokenFactory: () => t.authenticationToken
2589
+ }));
2590
+ }
2591
+ start(t = 5e3) {
2592
+ e(this, at) && clearInterval(e(this, at)), d(this, ft, !1), d(this, Ut, !1), r(this, H, ps).call(this), r(this, H, ds).call(this), d(this, at, window.setInterval(() => {
2593
+ !e(this, Ut) && !e(this, Zt).infiniteReconnect && !e(this, At) && e(this, Et) && d(this, At, window.setTimeout(() => r(this, H, jn).call(this), 5 * 60 * 1e3)), !e(this, Ut) && e(this, Et) && r(this, H, ds).call(this);
2594
+ }, t));
2595
+ }
2596
+ stop() {
2597
+ r(this, H, us).call(this), e(this, at) && (window.clearInterval(e(this, at)), d(this, at, null));
2598
+ }
2599
+ }
2600
+ Xe = new WeakMap(), Zt = new WeakMap(), ft = new WeakMap(), Ut = new WeakMap(), Et = new WeakMap(), At = new WeakMap(), at = new WeakMap(), H = new WeakSet(), ds = function() {
2601
+ return $(this, null, function* () {
2602
+ if (e(this, ft))
2603
+ return;
2604
+ d(this, ft, !0);
2605
+ let t = "Stream is offline", i = "Please stand by";
2606
+ try {
2607
+ const s = yield e(this, Xe).getChannel(e(this, Zt).channelId);
2608
+ if (s.isLive) {
2609
+ d(this, Ut, !0), r(this, H, ps).call(this), this.emit("live", s), d(this, ft, !1);
2610
+ return;
2611
+ }
2612
+ } catch (s) {
2613
+ Wr(s) && (s.status === 403 || s.status === 401) && (t = "Forbidden", i = "You do not have permission to view this stream");
2614
+ }
2615
+ e(this, Et) && this.emit("error", { title: t, message: i }), d(this, ft, !1);
2616
+ });
2617
+ }, jn = function() {
2618
+ this.stop(), d(this, Et, !1), this.emit("timeout");
2619
+ }, us = function() {
2620
+ e(this, At) && (window.clearTimeout(e(this, At)), d(this, At, null));
2621
+ }, ps = function() {
2622
+ r(this, H, us).call(this), d(this, Et, !0);
2623
+ };
2624
+ const Ao = new RegExp(
2625
+ "/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/",
2626
+ "i"
2627
+ ), yo = navigator.userAgent.toLowerCase(), ko = Ao.test(yo), wo = (h) => Ce.observedAttributes.includes(h), Yn = (
2628
+ /* HTML */
2629
+ `
2630
+ <style>
2631
+ :host {
2632
+ container-type: inline-size;
2633
+ position: relative;
2634
+ overflow: hidden;
2635
+ width: 100%;
2636
+ display: flex;
2637
+ justify-content: center;
2638
+
2639
+ --vindral-volume-range-display: ${ko ? "none" : "flex"};
2640
+ --vindral-airplay-button-display: none;
2641
+ --vindral-play-overlay-display: none;
2642
+ --vindral-grid-item-offline-display: none;
2643
+ }
2644
+
2645
+ vindral-control-bar[slot="top-bar"] {
2646
+ display: none;
2647
+ }
2648
+
2649
+ @container (max-width: 320px) {
2650
+ vindral-controller {
2651
+ --vindral-volume-range-display: none;
2652
+ --vindral-control-padding: 0px;
2653
+ --vindral-button-padding: 4px;
2654
+ }
2655
+
2656
+ vindral-control-bar[slot="top-bar"] {
2657
+ display: block;
2658
+ }
2659
+
2660
+ vindral-control-bar:not([slot="top-bar"]) vindral-rendition-levels-menu,
2661
+ vindral-control-bar:not([slot="top-bar"]) vindral-cast-button,
2662
+ vindral-control-bar:not([slot="top-bar"]) vindral-airplay-button {
2663
+ display: none;
2664
+ }
2665
+ }
2666
+
2667
+ :host([${q.OFFLINE}]) {
2668
+ aspect-ratio: 16 / 9;
2669
+ vindral-controller {
2670
+ --vindral-ui-display: none;
2671
+ }
2672
+ }
2673
+
2674
+ :host([${n.AIRPLAY_ENABLED}="false"]) {
2675
+ --vindral-airplay-button-display: none;
2676
+ }
2677
+
2678
+ :host([${n.CAST_ENABLED}="false"]) {
2679
+ --vindral-cast-button-display: none;
2680
+ }
2681
+
2682
+ :host([${n.FULLSCREEN_ENABLED}="false"]) {
2683
+ --vindral-fullscreen-button-display: none;
2684
+ }
2685
+
2686
+ :host([${n.PIP_ENABLED}="false"]) {
2687
+ --vindral-pip-button-display: none;
2688
+ }
2689
+
2690
+ :host(:not([${n.CHANNEL_GROUP_ID}])) vindral-scroll-overlay {
2691
+ display: none;
2692
+ }
2693
+
2694
+ :host([${n.MEDIA}="video"]) vindral-mute-button,
2695
+ :host([${n.MEDIA}="video"]) vindral-volume-range {
2696
+ display: none;
2697
+ }
2698
+ </style>
2699
+ `
2700
+ ), Io = (
2701
+ /* HTML */
2702
+ `
2703
+ ${Yn}
2704
+
2705
+ <vindral-controller>
2706
+ <vindral-control-bar slot="top-bar">
2707
+ <vindral-rendition-levels-menu list-position="bottom"></vindral-rendition-levels-menu>
2708
+ <vindral-cast-button></vindral-cast-button>
2709
+ <vindral-airplay-button></vindral-airplay-button>
2710
+ </vindral-control-bar>
2711
+ <vindral-control-bar>
2712
+ <vindral-play-button></vindral-play-button>
2713
+ <vindral-mute-button></vindral-mute-button>
2714
+ <vindral-volume-range></vindral-volume-range>
2715
+ <vindral-channel-grid-button slot="right"></vindral-channel-grid-button>
2716
+ <vindral-language-menu slot="right"></vindral-language-menu>
2717
+ <vindral-rendition-levels-menu slot="right"></vindral-rendition-levels-menu>
2718
+ <vindral-pip-button slot="right"></vindral-pip-button>
2719
+ <vindral-cast-button slot="right"></vindral-cast-button>
2720
+ <vindral-airplay-button slot="right"></vindral-airplay-button>
2721
+ <vindral-fullscreen-button slot="right"></vindral-fullscreen-button>
2722
+ </vindral-control-bar>
2723
+ <vindral-scroll-overlay slot="overlay">
2724
+ <vindral-channel-grid id="listbox" part="listbox"></vindral-channel-grid>
2725
+ </vindral-scroll-overlay>
2726
+ <vindral-cast-overlay slot="overlay"></vindral-cast-overlay>
2727
+ <vindral-buffering-overlay slot="overlay"></vindral-buffering-overlay>
2728
+ <vindral-user-input-play-overlay slot="overlay"></vindral-user-input-play-overlay>
2729
+ <vindral-poster-overlay slot="overlay" disabled></vindral-poster-overlay>
2730
+
2731
+ <vindral-play-overlay id="play-overlay" slot="overlay" hidden></vindral-play-overlay>
2732
+ <vindral-message id="vindral-message" slot="overlay" hidden></vindral-message>
2733
+ </vindral-controller>
2734
+ `
2735
+ ), Co = (
2736
+ /* HTML */
2737
+ `
2738
+ ${Yn}
2739
+
2740
+ <style>
2741
+ #control-bar {
2742
+ display: flex;
2743
+ justify-content: center;
2744
+ align-items: center;
2745
+ gap: var(--padding-3);
2746
+ }
2747
+ </style>
2748
+
2749
+ <vindral-controller>
2750
+ <div id="control-bar" slot="middle">
2751
+ <vindral-play-button></vindral-play-button>
2752
+ <vindral-mute-button></vindral-mute-button>
2753
+ <vindral-volume-range></vindral-volume-range>
2754
+ <vindral-buffering-icon></vindral-buffering-icon>
2755
+ </div>
2756
+
2757
+ <vindral-play-overlay id="play-overlay" slot="overlay" hidden></vindral-play-overlay>
2758
+ <vindral-message id="vindral-message" slot="overlay" hidden></vindral-message>
2759
+ </vindral-controller>
2760
+ `
2761
+ ), Gs = document.createElement("template");
2762
+ var Q, _, O, yt, W, xi, Ve, Si, S, bs, Qn, je, di, Ht;
2763
+ class Jn extends HTMLElement {
2764
+ constructor() {
2765
+ super();
2766
+ l(this, S);
2767
+ l(this, Q);
2768
+ l(this, _);
2769
+ l(this, O);
2770
+ l(this, yt);
2771
+ l(this, W);
2772
+ l(this, xi, () => {
2773
+ Array.from(this.attributes).forEach((t) => {
2774
+ e(this, Ve).call(this, t.name, t.value);
2775
+ });
2776
+ });
2777
+ l(this, Ve, (t, i) => {
2778
+ wo(t) && (x(i) ? e(this, _).setAttribute(t, i) : e(this, _).removeAttribute(t));
2779
+ });
2780
+ l(this, Si, () => zs(this.getAttribute(n.MEDIA)) === "audio" ? Co : Io);
2781
+ l(this, je, () => {
2782
+ const t = e(this, _).instance;
2783
+ t && (t.on("is live", (i) => {
2784
+ i ? (this.removeAttribute(q.OFFLINE), e(this, O).setAttribute("hidden", "")) : (this.setAttribute(q.OFFLINE, ""), e(this, O).removeAttribute("hidden"), r(this, S, Ht).call(this, "Stream is offline", "Please stand by"));
2785
+ }), t.on("channels", (i) => {
2786
+ const s = e(this, _).getAttribute("channel-id"), o = i.find((u) => u.channelId === s);
2787
+ o && r(this, S, di).call(this, o.name);
2788
+ }), t.on("channel switch", ({ channelId: i }) => {
2789
+ const s = t.channels.find((o) => o.channelId === i);
2790
+ s && r(this, S, di).call(this, s.name);
2791
+ }), t.on("error", (i) => {
2792
+ var u;
2793
+ let s = "Stream is offline", o = "Please stand by";
2794
+ i.isFatal() ? (i.code() === Vr ? (s = "Forbidden", o = "You do not have permission to view this stream", r(this, S, Ht).call(this, s, o)) : (u = e(this, W)) == null || u.start(), this.setAttribute(q.OFFLINE, "")) : i.code() === jr && r(this, S, Ht).call(this, s, o);
2795
+ }));
2796
+ });
2797
+ d(this, Q, this.attachShadow({ mode: "open" })), r(this, S, bs).call(this), d(this, _, e(this, Q).querySelector("vindral-controller")), d(this, O, e(this, Q).querySelector("#vindral-message")), d(this, yt, e(this, Q).querySelector("#play-overlay"));
2798
+ }
2799
+ connectedCallback() {
2800
+ this.setAttribute(q.OFFLINE, ""), e(this, _).addEventListener("vindral-instance-ready", e(this, je)), r(this, S, Qn).call(this);
2801
+ }
2802
+ disconnectedCallback() {
2803
+ var t;
2804
+ e(this, _).removeEventListener("vindral-instance-ready", e(this, je)), (t = e(this, W)) == null || t.stop();
2805
+ }
2806
+ attributeChangedCallback(t, i, s) {
2807
+ if (i !== s)
2808
+ if (t === n.MEDIA)
2809
+ r(this, S, bs).call(this);
2810
+ else if (t === q.REFRESH_POSTER_ENABLED) {
2811
+ const o = e(this, Q).querySelector("vindral-poster-overlay");
2812
+ o && (o.disabled = T(this.getAttribute(q.REFRESH_POSTER_ENABLED), !1) === !1);
2813
+ } else
2814
+ e(this, Ve).call(this, t, s);
2815
+ }
2816
+ get instance() {
2817
+ return e(this, _).instance;
2818
+ }
2819
+ }
2820
+ Q = new WeakMap(), _ = new WeakMap(), O = new WeakMap(), yt = new WeakMap(), W = new WeakMap(), xi = new WeakMap(), Ve = new WeakMap(), Si = new WeakMap(), S = new WeakSet(), bs = function() {
2821
+ Gs.innerHTML = e(this, Si).call(this);
2822
+ const t = Gs.content.cloneNode(!0);
2823
+ d(this, _, t.querySelector("vindral-controller")), d(this, O, t.querySelector("#vindral-message")), d(this, yt, t.querySelector("#play-overlay")), this.children.length > 0 && Array.from(this.children).forEach((i) => {
2824
+ e(this, _).appendChild(i);
2825
+ }), e(this, xi).call(this), e(this, Q).innerHTML = "", e(this, Q).appendChild(t);
2826
+ }, Qn = function() {
2827
+ var p;
2828
+ if (T(this.getAttribute(q.STREAM_POLL_ENABLED), !0) === !1)
2829
+ return;
2830
+ const t = this.getAttribute("url"), i = this.getAttribute("channel-id"), s = (p = this.getAttribute("authentication-token")) != null ? p : void 0, o = this.hasAttribute("infinite-reconnect"), u = T(this.getAttribute("title"), !1);
2831
+ if (!t || !i) {
2832
+ this.setAttribute(q.OFFLINE, ""), r(this, S, Ht).call(this, "Invalid options", "Please enter at least a channel id and url to start the stream");
2833
+ return;
2834
+ }
2835
+ d(this, W, new Eo({
2836
+ url: t,
2837
+ channelId: i,
2838
+ authenticationToken: s,
2839
+ infiniteReconnect: o
2840
+ })), e(this, W).on("live", (v) => {
2841
+ e(this, _).connect(), this.removeAttribute("offline"), e(this, O).setAttribute("hidden", ""), u && r(this, S, di).call(this, v.name);
2842
+ }), e(this, W).on("timeout", () => {
2843
+ e(this, O).setAttribute("hidden", ""), e(this, yt).removeAttribute("hidden");
2844
+ }), e(this, W).on("error", (v) => {
2845
+ this.setAttribute(q.OFFLINE, ""), r(this, S, Ht).call(this, v.title, v.message);
2846
+ }), e(this, yt).addEventListener("click", () => {
2847
+ e(this, _).connect(), e(this, yt).setAttribute("hidden", "");
2848
+ }), this.hasAttribute("paused") && e(this, W).start();
2849
+ }, je = new WeakMap(), di = function(t) {
2850
+ if (!T(this.getAttribute("title"), !0)) return;
2851
+ const i = Bs(this.getAttribute("poster"));
2852
+ eo({
2853
+ title: t,
2854
+ poster: typeof i == "string" ? i : void 0
2855
+ });
2856
+ }, Ht = function(t, i) {
2857
+ e(this, O).setAttribute("title", t), e(this, O).setAttribute("description", i);
2858
+ const s = this.getAttribute("poster");
2859
+ s && e(this, O).setAttribute("background-image", s), e(this, O).removeAttribute("hidden");
2860
+ }, m(Jn, "observedAttributes", [...Ce.observedAttributes, ...fo]);
2861
+ const Wn = document.createElement("template");
2862
+ Wn.innerHTML = /* HTML */
2863
+ `
2864
+ <style>
2865
+ :host {
2866
+ display: var(--poster-overlay-display);
2867
+ position: absolute;
2868
+ top: 0;
2869
+ left: 0;
2870
+ max-width: 100%;
2871
+ max-height: 100%;
2872
+ min-width: 100%;
2873
+ min-height: 100%;
2874
+ background-repeat: no-repeat;
2875
+ background-position: 50% 50%;
2876
+ background-size: contain;
2877
+ transition-property: background-image;
2878
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
2879
+ transition-duration: 200ms;
2880
+ }
2881
+
2882
+ :host::before {
2883
+ content: "";
2884
+ position: absolute;
2885
+ top: 0;
2886
+ left: 0;
2887
+ right: 0;
2888
+ bottom: 0;
2889
+ background: rgba(255, 255, 255, 0);
2890
+ transition: background 0.2s ease;
2891
+ }
2892
+
2893
+ :host(:not([${n.PAUSED}])) {
2894
+ display: none;
2895
+ }
2896
+ </style>
2897
+ `;
2898
+ const Lo = 6e3;
2899
+ var te, kt, _t, ee, V, tr, ui, ms, Ni;
2900
+ class Zn extends HTMLElement {
2901
+ constructor() {
2902
+ super();
2903
+ l(this, V);
2904
+ l(this, te, null);
2905
+ l(this, kt, null);
2906
+ l(this, _t, null);
2907
+ l(this, ee, () => {
2908
+ !document.hidden && this.hasAttribute("intersecting") && this.paused && !this.disabled ? r(this, V, tr).call(this) : r(this, V, ui).call(this);
2909
+ });
2910
+ l(this, Ni, (t) => {
2911
+ t.forEach((i) => {
2912
+ i.isIntersecting ? this.setAttribute("intersecting", "") : this.removeAttribute("intersecting");
2913
+ });
2914
+ });
2915
+ this.attachShadow({ mode: "open" }).appendChild(Wn.content.cloneNode(!0));
2916
+ }
2917
+ connectedCallback() {
2918
+ var t;
2919
+ d(this, te, this.closest("vindral-controller")), (t = e(this, te)) == null || t.connectListener(this), document.addEventListener("visibilitychange", e(this, ee)), d(this, _t, new IntersectionObserver(e(this, Ni))), e(this, _t).observe(this);
2920
+ }
2921
+ disconnectedCallback() {
2922
+ var t, i;
2923
+ (t = e(this, te)) == null || t.disconnectListener(this), document.removeEventListener("visibilitychange", e(this, ee)), (i = e(this, _t)) == null || i.disconnect(), d(this, _t, null), r(this, V, ui).call(this);
2924
+ }
2925
+ attributeChangedCallback(t, i, s) {
2926
+ i !== s && (t === n.POSTER_SRC && this.paused && !this.disabled && r(this, V, ms).call(this), (t === n.PAUSED || t === "disabled" || t === "intersecting") && e(this, ee).call(this));
2927
+ }
2928
+ get disabled() {
2929
+ return this.hasAttribute("disabled");
2930
+ }
2931
+ set disabled(t) {
2932
+ t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
2933
+ }
2934
+ get posterSrc() {
2935
+ return this.getAttribute(n.POSTER_SRC);
2936
+ }
2937
+ get paused() {
2938
+ return this.hasAttribute(n.PAUSED);
2939
+ }
2940
+ }
2941
+ te = new WeakMap(), kt = new WeakMap(), _t = new WeakMap(), ee = new WeakMap(), V = new WeakSet(), tr = function() {
2942
+ e(this, kt) === null && (r(this, V, ui).call(this), d(this, kt, window.setInterval(() => r(this, V, ms).call(this), Lo)));
2943
+ }, ui = function() {
2944
+ e(this, kt) !== null && (clearInterval(e(this, kt)), d(this, kt, null)), this.style.backgroundImage = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg==')";
2945
+ }, ms = function() {
2946
+ if (!this.posterSrc) return;
2947
+ const t = new URL(this.posterSrc), i = new Image();
2948
+ t.searchParams.set("t", Date.now().toString()), i.src = t.toString(), i.onload = () => this.style.backgroundImage = `url(${t.toString()})`;
2949
+ }, Ni = new WeakMap(), m(Zn, "observedAttributes", [n.POSTER_SRC, n.PAUSED, "disabled", "intersecting"]);
2950
+ const To = (
2951
+ /* SVG */
2952
+ `
2953
+ <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-settings-filled" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#2c3e50" fill="none" stroke-linecap="round" stroke-linejoin="round">
2954
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
2955
+ <path d="M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z" stroke-width="0" fill="currentColor" />
2956
+ </svg>
2957
+ `
2958
+ ), er = document.createElement("template");
2959
+ er.innerHTML = /* HTML */
2960
+ `
2961
+ <style>
2962
+ :host {
2963
+ display: var(--rendition-menu-display);
2964
+ }
2965
+ </style>
2966
+
2967
+ <slot name="button">${To}</slot>
2968
+ <slot name="listbox" hidden>
2969
+ <vindral-rendition-levels-menu-list id="listbox" part="listbox"></vindral-rendition-levels-menu-list>
2970
+ </slot>
2971
+ `;
2972
+ var Ye, gs;
2973
+ const ke = class ke extends xs {
2974
+ constructor() {
2975
+ var t, i, s, o;
2976
+ super();
2977
+ l(this, Ye);
2978
+ (t = this.shadowRoot) == null || t.appendChild(er.content.cloneNode(!0)), this.button = (i = this.shadowRoot) == null ? void 0 : i.querySelector("slot[name=button]"), this.listbox = (s = this.shadowRoot) == null ? void 0 : s.querySelector("[part=listbox]"), this.listboxSlot = (o = this.shadowRoot) == null ? void 0 : o.querySelector("slot[name=listbox]");
2979
+ }
2980
+ connectedCallback() {
2981
+ super.connectedCallback(), r(this, Ye, gs).call(this), this.setAttribute("aria-label", "Rendition levels");
2982
+ }
2983
+ attributeChangedCallback(t, i, s) {
2984
+ super.attributeChangedCallback(t, i, s), t === n.RENDITION_LEVELS && r(this, Ye, gs).call(this);
2985
+ }
2986
+ };
2987
+ Ye = new WeakSet(), gs = function() {
2988
+ const t = this.getAttribute(n.RENDITION_LEVELS);
2989
+ !t || t === "[]" ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
2990
+ }, m(ke, "observedAttributes", [...G(ke, ke, "observedAttributes"), n.RENDITION_LEVELS]);
2991
+ let vs = ke;
2992
+ const ir = document.createElement("template"), xo = (
2993
+ /* SVG */
2994
+ `
2995
+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="#fff" viewBox="0 0 78.369 78.369" xml:space="preserve"><path d="M78.049 19.015 29.458 67.606a1.094 1.094 0 0 1-1.548 0L.32 40.015a1.094 1.094 0 0 1 0-1.547l6.704-6.704a1.095 1.095 0 0 1 1.548 0l20.113 20.112 41.113-41.113a1.095 1.095 0 0 1 1.548 0l6.703 6.704a1.094 1.094 0 0 1 0 1.548z"/></svg>
2996
+ `
2997
+ );
2998
+ ir.innerHTML = /* HTML */
2999
+ `
3000
+ <style>
3001
+ :host {
3002
+ font: inherit;
3003
+ cursor: default;
3004
+ padding: var(--padding-2);
3005
+ padding-top: var(--padding-3);
3006
+ border-radius: 0.25em;
3007
+ position: absolute;
3008
+ min-width: 140px;
3009
+ background: var(--bg-subtle);
3010
+ z-index: 1;
3011
+ overflow: auto;
3012
+ }
3013
+
3014
+ :host([list-position="top"]) {
3015
+ bottom: calc(100% + 0.5em);
3016
+ transform: translate(-50%);
3017
+ }
3018
+
3019
+ :host([list-position="bottom"]) {
3020
+ top: calc(100% + 0.5em);
3021
+ }
3022
+
3023
+ :host::-webkit-scrollbar {
3024
+ width: 5px;
3025
+ padding-right: 5px;
3026
+ }
3027
+
3028
+ :host::-webkit-scrollbar-thumb {
3029
+ background-color: var(--fg-extra-subtle);
3030
+ border-radius: 10px;
3031
+ border: 0;
3032
+ }
3033
+
3034
+ :host::-webkit-scrollbar-track {
3035
+ border-radius: 10px;
3036
+ background-color: transparent;
3037
+ }
3038
+
3039
+ .menu {
3040
+ display: grid;
3041
+ gap: var(--padding-1);
3042
+ }
3043
+
3044
+ [role="menuitem"] {
3045
+ flex: 1;
3046
+ position: relative;
3047
+ cursor: pointer;
3048
+ display: flex;
3049
+ flex-direction: column;
3050
+ justify-content: center;
3051
+ height: 44px;
3052
+ padding: 0 var(--padding-5);
3053
+ border-radius: 4px;
3054
+ font-size: 14px;
3055
+ font-style: normal;
3056
+ font-weight: 500;
3057
+ line-height: normal;
3058
+ white-space: nowrap;
3059
+ text-align: left;
3060
+ }
3061
+
3062
+ [role="menuitem"]:hover {
3063
+ background: var(--bg-component-hover);
3064
+ }
3065
+
3066
+ [role="menuitem"][aria-selected="true"] {
3067
+ background: var(--bg-component-active);
3068
+ }
3069
+
3070
+ [role="menuitem"][aria-selected="true"]::before {
3071
+ content: url("data:image/svg+xml,${encodeURIComponent(xo)}");
3072
+ position: absolute;
3073
+ left: calc(var(--padding-3) - var(--padding-1));
3074
+ top: calc(50% - 8px);
3075
+ }
3076
+
3077
+ [role="menuitem"]:focus-visible {
3078
+ box-shadow: inset 0 0 0 2px var(--fg-strong);
3079
+ outline: 0;
3080
+ }
3081
+
3082
+ .menu-item-subtitle {
3083
+ font-size: 11px;
3084
+ opacity: 0.6;
3085
+ }
3086
+
3087
+ .heading {
3088
+ text-transform: uppercase;
3089
+ margin-bottom: var(--padding-2);
3090
+ padding: 0 var(--padding-3);
3091
+ font-size: 11px;
3092
+ font-weight: bold;
3093
+ }
3094
+ </style>
3095
+
3096
+ <slot>
3097
+ <div class="heading">Max quality</div>
3098
+ <div class="menu"></div>
3099
+ </slot>
3100
+ `;
3101
+ var Pt, Je, wt, lt, Mt, Qe, I, nr, fs, rr, Es, or, ar, lr, As, cr;
3102
+ class sr extends HTMLElement {
3103
+ constructor() {
3104
+ super();
3105
+ l(this, I);
3106
+ l(this, Pt, []);
3107
+ l(this, Je, Number.MAX_SAFE_INTEGER);
3108
+ l(this, wt, null);
3109
+ l(this, lt, []);
3110
+ l(this, Mt, null);
3111
+ l(this, Qe, null);
3112
+ m(this, "handleEvent", (t) => {
3113
+ switch (t.type) {
3114
+ case "keydown":
3115
+ r(this, I, ar).call(this, t);
3116
+ break;
3117
+ }
3118
+ });
3119
+ this.attachShadow({ mode: "open" }).appendChild(ir.content.cloneNode(!0));
3120
+ }
3121
+ connectedCallback() {
3122
+ var i;
3123
+ const t = this.getRootNode();
3124
+ t instanceof ShadowRoot && (d(this, Mt, t.host.closest("vindral-controller")), (i = e(this, Mt)) == null || i.connectListener(this), r(this, I, nr).call(this), r(this, I, fs).call(this), d(this, Qe, t.host), this.addEventListener("keydown", this));
3125
+ }
3126
+ disconnectedCallback() {
3127
+ var t;
3128
+ (t = e(this, Mt)) == null || t.disconnectListener(this), this.removeEventListener("keydown", this);
3129
+ }
3130
+ attributeChangedCallback(t, i, s) {
3131
+ i !== s && (t === n.RENDITION_LEVELS && s && (this.list = JSON.parse(s)), t === n.MAX_VIDEO_BITRATE && s && (this.maxVideoBitrate = s ? parseInt(s) : Number.MAX_SAFE_INTEGER));
3132
+ }
3133
+ set list(t) {
3134
+ d(this, Pt, t), r(this, I, fs).call(this);
3135
+ }
3136
+ set maxVideoBitrate(t) {
3137
+ d(this, Je, t), r(this, I, Es).call(this);
3138
+ }
3139
+ get keysUsed() {
3140
+ return ["Enter", "Escape", "Tab", " ", "ArrowDown", "ArrowUp", "Home", "End"];
3141
+ }
3142
+ focus() {
3143
+ var t;
3144
+ (t = e(this, wt)) == null || t.focus();
3145
+ }
3146
+ }
3147
+ Pt = new WeakMap(), Je = new WeakMap(), wt = new WeakMap(), lt = new WeakMap(), Mt = new WeakMap(), Qe = new WeakMap(), I = new WeakSet(), nr = function() {
3148
+ const t = (s) => {
3149
+ s.forEach((o) => {
3150
+ if (o.intersectionRatio !== 1)
3151
+ if (o.intersectionRatio > 0) {
3152
+ const u = this.offsetHeight, p = o.intersectionRatio, g = u * p - 24;
3153
+ this.style.height = `${g}px`;
3154
+ } else
3155
+ this.style.height = "auto";
3156
+ });
3157
+ };
3158
+ new IntersectionObserver(t, {
3159
+ root: e(this, Mt),
3160
+ // The parent element to use as the viewport
3161
+ threshold: 0
3162
+ // 0 means any intersection is enough to be considered "inside"
3163
+ }).observe(this);
3164
+ }, fs = function() {
3165
+ var i;
3166
+ const t = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".menu");
3167
+ t && (d(this, lt, []), t.innerHTML = "", e(this, Pt).sort((s, o) => {
3168
+ var u, p;
3169
+ return (u = s.video) != null && u.bitRate && ((p = o.video) != null && p.bitRate) ? o.video.bitRate - s.video.bitRate : 0;
3170
+ }).forEach((s) => {
3171
+ var v, g, P, tt, j, It, Ct, Lt;
3172
+ const o = document.createElement("div");
3173
+ o.setAttribute("role", "menuitem"), o.setAttribute("value", String((v = s.video) == null ? void 0 : v.height)), o.classList.add("menu-item"), o.tabIndex = -1;
3174
+ const u = r(this, I, rr).call(this, (g = s.video) == null ? void 0 : g.frameRate);
3175
+ o.textContent = s.video ? to(s.video) : "";
3176
+ const p = document.createElement("span");
3177
+ p.classList.add("menu-item-subtitle"), p.textContent = `${Zr(((tt = (P = s.video) == null ? void 0 : P.bitRate) != null ? tt : 0) + ((It = (j = s.audio) == null ? void 0 : j.bitRate) != null ? It : 0))}, ${u}p`, o.appendChild(p), o.addEventListener("click", () => r(this, I, or).call(this, s)), e(this, lt).push({ el: o, id: (Lt = (Ct = s.video) == null ? void 0 : Ct.id) != null ? Lt : -1 }), t.appendChild(o);
3178
+ }), r(this, I, Es).call(this));
3179
+ }, rr = function(t) {
3180
+ return t ? t[0] % t[1] === 0 ? (t[0] / t[1]).toString() : (t[0] / t[1]).toFixed(2) : "";
3181
+ }, Es = function() {
3182
+ e(this, wt) && (e(this, wt).removeAttribute("aria-selected"), e(this, wt).tabIndex = -1);
3183
+ const t = e(this, Pt).sort(
3184
+ (s, o) => {
3185
+ var u, p;
3186
+ return (u = s.video) != null && u.bitRate && ((p = o.video) != null && p.bitRate) ? o.video.bitRate - s.video.bitRate : 0;
3187
+ }
3188
+ ), i = e(this, Pt).filter(
3189
+ (s) => {
3190
+ var o;
3191
+ return ((o = s.video) == null ? void 0 : o.bitRate) && s.video.bitRate <= e(this, Je);
3192
+ }
3193
+ )[0] || t[t.length - 1];
3194
+ if (i) {
3195
+ const s = e(this, lt).find((o) => {
3196
+ var u;
3197
+ return o.id === ((u = i.video) == null ? void 0 : u.id);
3198
+ });
3199
+ s && (s.el.tabIndex = 0, s.el.setAttribute("aria-selected", "true"), d(this, wt, s.el));
3200
+ }
3201
+ }, or = function(t) {
3202
+ this.dispatchEvent(new Event("change", { bubbles: !0, composed: !0 })), this.dispatchEvent(
3203
+ new CustomEvent(f.SET_RENDITION, { bubbles: !0, composed: !0, detail: t })
3204
+ );
3205
+ }, ar = function(t) {
3206
+ var p, v, g;
3207
+ const { key: i, ctrlKey: s, altKey: o, metaKey: u } = t;
3208
+ s || o || u || this.keysUsed.includes(i) && (t.preventDefault(), t.stopPropagation(), i === "Tab" || i === "Escape" ? (p = e(this, Qe)) == null || p.hide() : i === "Enter" || i === " " ? (g = (v = r(this, I, As).call(this)) == null ? void 0 : v.el) == null || g.click() : r(this, I, lr).call(this, t));
3209
+ }, lr = function(t) {
3210
+ var g;
3211
+ const { key: i } = t, s = e(this, lt), o = (g = r(this, I, As).call(this)) != null ? g : s[0];
3212
+ if (!o) return;
3213
+ const u = s.indexOf(o);
3214
+ let p = Math.max(0, u);
3215
+ i === "ArrowDown" ? p++ : i === "ArrowUp" ? p-- : t.key === "Home" ? p = 0 : t.key === "End" && (p = s.length - 1), p < 0 && (p = s.length - 1), p > s.length - 1 && (p = 0);
3216
+ const v = s[p];
3217
+ v && (r(this, I, cr).call(this, v.id), v.el.focus());
3218
+ }, As = function() {
3219
+ return e(this, lt).find((t) => t.el.tabIndex === 0);
3220
+ }, cr = function(t) {
3221
+ for (const i of e(this, lt))
3222
+ i.el.tabIndex = i.id === t ? 0 : -1;
3223
+ }, m(sr, "observedAttributes", [n.RENDITION_LEVELS, n.MAX_VIDEO_BITRATE]);
3224
+ const hr = document.createElement("template");
3225
+ hr.innerHTML = /* HTML */
3226
+ `
3227
+ <style>
3228
+ :host {
3229
+ --scroll-overlay-offset: var(--vindral-scroll-overlay-offset, 0px);
3230
+
3231
+ position: absolute;
3232
+ top: 0;
3233
+ width: 100%;
3234
+ height: 100%;
3235
+ overflow-y: scroll !important;
3236
+ pointer-events: none !important;
3237
+ display: block;
3238
+ transition: background-color 0.5s ease-in-out;
3239
+ -ms-overflow-style: none;
3240
+ scrollbar-width: none;
3241
+ }
3242
+
3243
+ :host([snap]) {
3244
+ scroll-snap-type: y mandatory;
3245
+ scroll-behavior: smooth;
3246
+ }
3247
+
3248
+ :host([snap-touch]) {
3249
+ scroll-snap-type: y mandatory;
3250
+ scroll-behavior: smooth;
3251
+ pointer-events: auto !important;
3252
+ }
3253
+
3254
+ :host([open]) #scroll-area {
3255
+ width: 100%;
3256
+ cursor: pointer;
3257
+ }
3258
+
3259
+ :host([open]) {
3260
+ background-color: rgba(0, 0, 0, 0.5);
3261
+ }
3262
+
3263
+ :host::-webkit-scrollbar {
3264
+ display: none;
3265
+ }
3266
+
3267
+ #scroll-area {
3268
+ margin: 0 auto;
3269
+ width: 1px;
3270
+ height: calc(100% - var(--scroll-overlay-offset));
3271
+ pointer-events: auto;
3272
+ scroll-snap-align: start;
3273
+ min-height: 1px;
3274
+ }
3275
+
3276
+ slot#content {
3277
+ display: flex;
3278
+ margin: 0 auto;
3279
+ width: 100%;
3280
+ pointer-events: auto;
3281
+ scroll-snap-align: start;
3282
+ flex-direction: column;
3283
+ }
3284
+
3285
+ :host(:not([${n.USER_INTERACTING}])) {
3286
+ overflow: hidden !important;
3287
+ }
3288
+ </style>
3289
+
3290
+ <div id="scroll-area"></div>
3291
+ <slot id="content"></slot>
3292
+ `;
3293
+ var ct, Dt, ie, We, k, ur, pr, br, Ri, Ui, pi, ys, ks, ws, Is;
3294
+ class dr extends HTMLElement {
3295
+ constructor() {
3296
+ super();
3297
+ l(this, k);
3298
+ l(this, ct, null);
3299
+ l(this, Dt, null);
3300
+ l(this, ie, null);
3301
+ l(this, We, 0);
3302
+ m(this, "handleEvent", (t) => {
3303
+ switch (t.type) {
3304
+ case "touchstart":
3305
+ r(this, k, ur).call(this, t);
3306
+ break;
3307
+ case "touchmove":
3308
+ r(this, k, pr).call(this, t);
3309
+ break;
3310
+ case "touchend":
3311
+ r(this, k, br).call(this, t);
3312
+ break;
3313
+ }
3314
+ });
3315
+ l(this, Ri, () => {
3316
+ this.scrollTop === 0 ? (this.open = !1, this.removeAttribute("snap-touch"), r(this, k, Is).call(this)) : !this.visible && this.scrollTop > 0 ? r(this, k, ws).call(this) : (
3317
+ // fully open
3318
+ !this.hasAttribute("snap-touch") && r(this, k, ks).call(this) && (this.open = !0, this.setAttribute("snap-touch", ""))
3319
+ );
3320
+ });
3321
+ l(this, Ui, () => {
3322
+ const t = e(this, We);
3323
+ if (d(this, We, this.scrollTop), !r(this, k, pi).call(this)) {
3324
+ this.scrollTop = 0;
3325
+ return;
3326
+ }
3327
+ this.scrollTop === 0 ? (this.open = !1, r(this, k, Is).call(this)) : !this.visible && this.scrollTop > 0 ? r(this, k, ws).call(this) : r(this, k, ks).call(this) && t <= this.scrollTop && (this.open = !0);
3328
+ });
3329
+ this.attachShadow({ mode: "open" }).appendChild(hr.content.cloneNode(!0));
3330
+ }
3331
+ connectedCallback() {
3332
+ var i, s, o, u, p, v;
3333
+ const t = this.getRootNode();
3334
+ if (t instanceof Document || t instanceof ShadowRoot) {
3335
+ d(this, ct, t.querySelector("vindral-controller")), (i = e(this, ct)) == null || i.connectListener(this), d(this, Dt, (s = this.shadowRoot) == null ? void 0 : s.querySelector("#scroll-area")), (o = e(this, Dt)) == null || o.addEventListener("click", () => {
3336
+ this.open && (this.open = !1);
3337
+ });
3338
+ const g = this.hasAttribute("touch-enabled");
3339
+ if (!Yr() || !g) {
3340
+ this.setAttribute("snap", ""), this.addEventListener("scroll", e(this, Ui));
3341
+ return;
3342
+ }
3343
+ this.addEventListener("scroll", e(this, Ri)), (u = e(this, ct)) == null || u.addEventListener("touchstart", this, { passive: !0 }), (p = e(this, ct)) == null || p.addEventListener("touchmove", this, { passive: !1 }), (v = e(this, ct)) == null || v.addEventListener("touchend", this, { passive: !0 });
3344
+ }
3345
+ }
3346
+ disconnectedCallback() {
3347
+ var t;
3348
+ (t = e(this, ct)) == null || t.disconnectListener(this);
3349
+ }
3350
+ attributeChangedCallback(t, i, s) {
3351
+ var o;
3352
+ i !== s && (t === n.USER_INTERACTING && s === null && r(this, k, ys).call(this) && setTimeout(() => {
3353
+ this.open = !1;
3354
+ }, 300), t === "open" && this.scrollTo({ top: s === null ? 0 : (o = e(this, Dt)) == null ? void 0 : o.clientHeight, behavior: "smooth" }));
3355
+ }
3356
+ set open(t) {
3357
+ t ? this.setAttribute("open", "") : this.removeAttribute("open");
3358
+ }
3359
+ get open() {
3360
+ return this.hasAttribute("open");
3361
+ }
3362
+ set visible(t) {
3363
+ t ? this.setAttribute("visible", "") : this.removeAttribute("visible");
3364
+ }
3365
+ get visible() {
3366
+ return this.hasAttribute("visible");
3367
+ }
3368
+ }
3369
+ ct = new WeakMap(), Dt = new WeakMap(), ie = new WeakMap(), We = new WeakMap(), k = new WeakSet(), ur = function(t) {
3370
+ r(this, k, pi).call(this) && t.touches[0] && d(this, ie, t.touches[0].clientY);
3371
+ }, pr = function(t) {
3372
+ if (!(!r(this, k, pi).call(this) || !e(this, ie) || this.hasAttribute("snap-touch")) && (t.preventDefault(), t.touches[0])) {
3373
+ const i = t.touches[0].clientY, s = e(this, ie) - i;
3374
+ this.scrollTop = s;
3375
+ }
3376
+ }, br = function(t) {
3377
+ r(this, k, ys).call(this) && !this.hasAttribute("snap-touch") && (this.open = !0);
3378
+ }, Ri = new WeakMap(), Ui = new WeakMap(), pi = function() {
3379
+ return this.hasAttribute(n.USER_INTERACTING);
3380
+ }, ys = function() {
3381
+ return this.scrollTop > 0;
3382
+ }, ks = function() {
3383
+ var t;
3384
+ return Math.round(this.scrollTop) === this.scrollHeight - this.clientHeight || Math.round(this.scrollTop) === ((t = e(this, Dt)) == null ? void 0 : t.clientHeight);
3385
+ }, ws = function() {
3386
+ this.visible = !0, this.dispatchEvent(new CustomEvent(f.LOCK_UI, { bubbles: !0, composed: !0 }));
3387
+ }, Is = function() {
3388
+ this.visible = !1, this.dispatchEvent(new CustomEvent(f.UNLOCK_UI, { bubbles: !0, composed: !0 }));
3389
+ }, m(dr, "observedAttributes", [n.USER_INTERACTING, "open", "touch-enabled"]);
3390
+ const mr = document.createElement("template");
3391
+ mr.innerHTML = /* HTML */
3392
+ `
3393
+ <style>
3394
+ :host {
3395
+ --value: 0;
3396
+ --_focus-box-shadow: none;
3397
+ height: calc(24px + 2 * var(--button-padding));
3398
+ width: 100%;
3399
+ display: flex;
3400
+ align-items: center;
3401
+ justify-content: center;
3402
+ padding: 0;
3403
+ margin: 0;
3404
+ position: relative;
3405
+ cursor: pointer;
3406
+ pointer-events: auto;
3407
+ touch-action: none;
3408
+ box-shadow: var(--_focus-visible-box-shadow, none);
3409
+ outline: 0;
3410
+ background: transparent;
3411
+ transition: background 0.2s linear;
3412
+ }
3413
+
3414
+ #range {
3415
+ -webkit-appearance: none;
3416
+ appearance: none;
3417
+
3418
+ height: 4px;
3419
+ width: 100%;
3420
+ margin: 0;
3421
+ padding: 0;
3422
+
3423
+ background-color: #00000000;
3424
+ outline: none;
3425
+ z-index: 1;
3426
+ cursor: pointer;
3427
+ }
3428
+
3429
+ #range-track {
3430
+ position: absolute;
3431
+ top: calc(50% - 2px);
3432
+ left: 1px;
3433
+ width: calc(100% - 1px);
3434
+ height: 4px;
3435
+ background-color: rgb(255 255 255 / 0.2);
3436
+ overflow: hidden;
3437
+ cursor: pointer;
3438
+ }
3439
+
3440
+ #range-track::before {
3441
+ position: absolute;
3442
+ content: "";
3443
+ left: calc(-100%);
3444
+ top: 0;
3445
+ width: calc(100%);
3446
+ height: 100%;
3447
+ background-color: var(--fg-strong);
3448
+ transition: background-color 300ms ease-out;
3449
+ transform-origin: 100% 0%;
3450
+ transform: translateX(calc(var(--value) * 100%)) scaleX(1.2);
3451
+ }
3452
+
3453
+ #range::-webkit-slider-thumb {
3454
+ -webkit-appearance: none;
3455
+ appearance: none;
3456
+ width: 12px;
3457
+ height: 12px;
3458
+ border-radius: 50%;
3459
+ background-color: var(--fg-strong);
3460
+ cursor: pointer;
3461
+ z-index: 1;
3462
+ }
3463
+
3464
+ #range::-moz-range-thumb {
3465
+ -moz-appearance: none;
3466
+ appearance: none;
3467
+ width: 12px;
3468
+ height: 12px;
3469
+ border-radius: 50%;
3470
+ background-color: var(--fg-strong);
3471
+ cursor: pointer;
3472
+ z-index: 1;
3473
+ }
3474
+
3475
+ :host(:focus-visible) {
3476
+ box-shadow: inset 0 0 0 2px var(--fg-strong);
3477
+ outline: 0;
3478
+ }
3479
+
3480
+ @media (hover: hover) and (pointer: fine) {
3481
+ :host(:hover) {
3482
+ background: rgba(255, 255, 255, 0.15);
3483
+ }
3484
+ }
3485
+
3486
+ :host(:active) {
3487
+ background: rgba(255, 255, 255, 0.25);
3488
+ }
3489
+ </style>
3490
+
3491
+ <input type="range" id="range" min="0" max="1" step="any" value="0" />
3492
+ <div id="range-track"></div>
3493
+ `;
3494
+ var se, ne, Ze, ti;
3495
+ class vr extends HTMLElement {
3496
+ constructor() {
3497
+ super();
3498
+ l(this, se, null);
3499
+ l(this, ne);
3500
+ m(this, "range");
3501
+ l(this, Ze, () => {
3502
+ this.range.matches(":focus-visible") && this.style.setProperty("--_focus-visible-box-shadow", "inset 0 0 0 2px var(--fg-strong)");
3503
+ });
3504
+ l(this, ti, () => {
3505
+ this.style.removeProperty("--_focus-visible-box-shadow");
3506
+ });
3507
+ d(this, ne, this.attachShadow({ mode: "open" })), e(this, ne).appendChild(mr.content.cloneNode(!0)), this.range = e(this, ne).getElementById("range");
3508
+ }
3509
+ connectedCallback() {
3510
+ var t;
3511
+ d(this, se, this.closest("vindral-controller")), (t = e(this, se)) == null || t.connectListener(this), this.hasAttribute("disabled") || this.enable(), this.range.addEventListener("focusin", e(this, Ze)), this.range.addEventListener("focusout", e(this, ti));
3512
+ }
3513
+ disconnectedCallback() {
3514
+ var t;
3515
+ (t = e(this, se)) == null || t.disconnectListener(this), this.range.removeEventListener("focusin", e(this, Ze)), this.range.removeEventListener("focusout", e(this, ti));
3516
+ }
3517
+ attributeChangedCallback(t, i, s) {
3518
+ i !== s && (t === "disabled" && s ? this.disable() : this.enable(), this.updateBar());
3519
+ }
3520
+ enable() {
3521
+ this.addEventListener("input", this);
3522
+ }
3523
+ disable() {
3524
+ this.range.removeEventListener("input", this);
3525
+ }
3526
+ handleEvent(t) {
3527
+ t.type === "input" && this.updateBar();
3528
+ }
3529
+ updateBar() {
3530
+ this.style.setProperty("--value", this.range.value);
3531
+ }
3532
+ get keysUsed() {
3533
+ return ["ArrowUp", "ArrowRight", "ArrowDown", "ArrowLeft"];
3534
+ }
3535
+ }
3536
+ se = new WeakMap(), ne = new WeakMap(), Ze = new WeakMap(), ti = new WeakMap(), m(vr, "observedAttributes", ["disabled"]);
3537
+ const gr = document.createElement("template");
3538
+ gr.innerHTML = /* HTML */
3539
+ `
3540
+ <style>
3541
+ :host {
3542
+ display: var(--volume-range-display);
3543
+ width: 80px;
3544
+ }
3545
+ </style>
3546
+ `;
3547
+ const So = (h) => `${Math.round(h * 100)}%`;
3548
+ var ei;
3549
+ const we = class we extends vr {
3550
+ constructor() {
3551
+ var t;
3552
+ super();
3553
+ l(this, ei, () => {
3554
+ const t = this.range.valueAsNumber;
3555
+ this.dispatchEvent(new CustomEvent(f.SET_VOLUME, { bubbles: !0, composed: !0, detail: t }));
3556
+ });
3557
+ (t = this.shadowRoot) == null || t.appendChild(gr.content.cloneNode(!0));
3558
+ }
3559
+ connectedCallback() {
3560
+ super.connectedCallback(), this.range.addEventListener("input", e(this, ei)), this.range.setAttribute("aria-label", "volume");
3561
+ }
3562
+ disconnectedCallback() {
3563
+ super.disconnectedCallback(), this.range.removeEventListener("input", e(this, ei));
3564
+ }
3565
+ attributeChangedCallback(t, i, s) {
3566
+ super.attributeChangedCallback(t, i, s), (t === n.MUTED || t === n.VOLUME) && (this.range.valueAsNumber = this.muted ? 0 : parseFloat(this.volume), this.range.setAttribute("aria-valuetext", So(this.range.valueAsNumber)), this.updateBar());
3567
+ }
3568
+ get volume() {
3569
+ var t;
3570
+ return (t = this.getAttribute(n.VOLUME)) != null ? t : "1";
3571
+ }
3572
+ get muted() {
3573
+ return this.hasAttribute(n.MUTED);
3574
+ }
3575
+ };
3576
+ ei = new WeakMap(), m(we, "observedAttributes", [...G(we, we, "observedAttributes"), n.MUTED, n.VOLUME]);
3577
+ let Cs = we;
3578
+ const fr = document.createElement("template"), No = (
3579
+ /* SVG */
3580
+ `
3581
+ <svg width="24" height="24" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
3582
+ <style>
3583
+ .spinner-container {
3584
+ transform-origin: center;
3585
+ animation: rotate 2s linear infinite;
3586
+ }
3587
+ .spinner-circle {
3588
+ stroke-linecap: round;
3589
+ animation: dash 1.5s ease-in-out infinite;
3590
+ }
3591
+ @keyframes rotate {
3592
+ 100% {
3593
+ transform: rotate(360deg);
3594
+ }
3595
+ }
3596
+ @keyframes dash {
3597
+ 0% {
3598
+ stroke-dasharray: 0 150;
3599
+ stroke-dashoffset: 0;
3600
+ }
3601
+ 47.5% {
3602
+ stroke-dasharray: 42 150;
3603
+ stroke-dashoffset: -16;
3604
+ }
3605
+ 95%, 100% {
3606
+ stroke-dasharray: 42 150;
3607
+ stroke-dashoffset: -59;
3608
+ }
3609
+ }
3610
+ </style>
3611
+ <g class="spinner-container">
3612
+ <circle class="spinner-circle" cx="12" cy="12" r="9.5" fill="none" stroke-width="3"></circle>
3613
+ </g>
3614
+ </svg>
3615
+ `
3616
+ );
3617
+ fr.innerHTML = /* HTML */
3618
+ `
3619
+ <style>
3620
+ :host {
3621
+ color: var(--fg-strong);
3622
+ }
3623
+
3624
+ slot > svg {
3625
+ display: block;
3626
+ }
3627
+
3628
+ :host(:not([${n.BUFFERING}])) {
3629
+ visibility: hidden !important;
3630
+ }
3631
+ </style>
3632
+
3633
+ <slot name="icon">${No}</slot>
3634
+ `;
3635
+ var re;
3636
+ class Er extends HTMLElement {
3637
+ constructor() {
3638
+ super();
3639
+ l(this, re, null);
3640
+ this.attachShadow({ mode: "open" }).appendChild(fr.content.cloneNode(!0));
3641
+ }
3642
+ connectedCallback() {
3643
+ var t;
3644
+ d(this, re, this.closest("vindral-controller")), (t = e(this, re)) == null || t.connectListener(this);
3645
+ }
3646
+ disconnectedCallback() {
3647
+ var t;
3648
+ (t = e(this, re)) == null || t.disconnectListener(this);
3649
+ }
3650
+ }
3651
+ re = new WeakMap(), m(Er, "observedAttributes", [n.BUFFERING]);
3652
+ const Ar = document.createElement("template"), Ro = (
3653
+ /* SVG */
3654
+ `
3655
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z" /></svg>
3656
+ `
3657
+ );
3658
+ Ar.innerHTML = /* HTML */
3659
+ `
3660
+ <style>
3661
+ :host {
3662
+ display: flex;
3663
+ align-items: center;
3664
+ justify-content: center;
3665
+ position: absolute;
3666
+ top: 0;
3667
+ bottom: 0;
3668
+ left: 0;
3669
+ right: 0;
3670
+ z-index: 1;
3671
+ pointer-events: none;
3672
+ }
3673
+
3674
+ :host([hidden]) {
3675
+ display: none;
3676
+ }
3677
+
3678
+ slot#play {
3679
+ pointer-events: auto;
3680
+ cursor: pointer;
3681
+ color: var(--fg-strong);
3682
+ }
3683
+
3684
+ slot#play > svg {
3685
+ width: 48px;
3686
+ height: 48px;
3687
+ }
3688
+ </style>
3689
+
3690
+ <slot id="play" name="icon">${Ro}</slot>
3691
+ `;
3692
+ var oe;
3693
+ class Ss extends HTMLElement {
3694
+ constructor() {
3695
+ super();
3696
+ l(this, oe, null);
3697
+ this.attachShadow({ mode: "open" }).appendChild(Ar.content.cloneNode(!0));
3698
+ }
3699
+ connectedCallback() {
3700
+ var t;
3701
+ d(this, oe, this.closest("vindral-controller")), (t = e(this, oe)) == null || t.connectListener(this), this.setAttribute("arial-label", "Play");
3702
+ }
3703
+ disconnectedCallback() {
3704
+ var t;
3705
+ (t = e(this, oe)) == null || t.disconnectListener(this);
3706
+ }
3707
+ }
3708
+ oe = new WeakMap(), m(Ss, "observedAttributes", ["hidden"]);
3709
+ const yr = document.createElement("template");
3710
+ yr.innerHTML = /* HTML */
3711
+ `
3712
+ <style>
3713
+ :host {
3714
+ display: var(--play-overlay-display);
3715
+ }
3716
+
3717
+ :host(:not([${n.NEEDS_USER_INPUT}]):not([${n.PAUSED}])) #play {
3718
+ display: none;
3719
+ }
3720
+ </style>
3721
+ `;
3722
+ var _i;
3723
+ const Ie = class Ie extends Ss {
3724
+ constructor() {
3725
+ var t;
3726
+ super();
3727
+ l(this, _i, () => {
3728
+ this.dispatchEvent(new CustomEvent(f.REQUEST_USER_INPUT, { bubbles: !0, composed: !0 }));
3729
+ });
3730
+ (t = this.shadowRoot) == null || t.appendChild(yr.content.cloneNode(!0));
3731
+ }
3732
+ connectedCallback() {
3733
+ super.connectedCallback(), this.addEventListener("click", e(this, _i));
3734
+ }
3735
+ disconnectedCallback() {
3736
+ super.disconnectedCallback();
3737
+ }
3738
+ };
3739
+ _i = new WeakMap(), m(Ie, "observedAttributes", [
3740
+ ...G(Ie, Ie, "observedAttributes"),
3741
+ n.NEEDS_USER_INPUT,
3742
+ n.PAUSED
3743
+ ]);
3744
+ let Ls = Ie;
3745
+ const kr = document.createElement("template");
3746
+ kr.innerHTML = /* HTML */
3747
+ `
3748
+ <style>
3749
+ :host,
3750
+ #background {
3751
+ position: absolute;
3752
+ overflow: hidden;
3753
+ display: flex;
3754
+ flex-direction: column;
3755
+ height: 100%;
3756
+ width: 100%;
3757
+ top: 0;
3758
+ left: 0;
3759
+ justify-content: center;
3760
+ align-items: center;
3761
+ background-repeat: no-repeat;
3762
+ background-position: 50% 50%;
3763
+ background-size: contain;
3764
+ font-size: 20px;
3765
+ color: var(--fg-strong);
3766
+ pointer-events: none;
3767
+ }
3768
+
3769
+ :host([hidden]) {
3770
+ display: none;
3771
+ }
3772
+
3773
+ #background {
3774
+ opacity: 0.7;
3775
+ }
3776
+
3777
+ #title,
3778
+ #description {
3779
+ position: relative;
3780
+ text-align: center;
3781
+ text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
3782
+ }
3783
+
3784
+ @container (max-width: 600px) {
3785
+ :host {
3786
+ font-size: 15px;
3787
+ }
3788
+ }
3789
+
3790
+ @container (max-width: 400px) {
3791
+ :host {
3792
+ font-size: 12px;
3793
+ }
3794
+ #title {
3795
+ margin: 0;
3796
+ }
3797
+ }
3798
+
3799
+ @container (max-width: 150px) {
3800
+ :host {
3801
+ font-size: 10px;
3802
+ }
3803
+ #title,
3804
+ #description {
3805
+ font-size: 1.2em;
3806
+ margin: 0;
3807
+ }
3808
+ }
3809
+ </style>
3810
+
3811
+ <div id="background"></div>
3812
+ <h1 id="title"></h1>
3813
+ <p id="description"></p>
3814
+ `;
3815
+ var ii, si, ni;
3816
+ class wr extends HTMLElement {
3817
+ constructor() {
3818
+ super();
3819
+ l(this, ii);
3820
+ l(this, si);
3821
+ l(this, ni);
3822
+ const t = this.attachShadow({ mode: "open" });
3823
+ t.appendChild(kr.content.cloneNode(!0)), d(this, ii, t.querySelector("#title")), d(this, si, t.querySelector("#description")), d(this, ni, t.querySelector("#background"));
3824
+ }
3825
+ connectedCallback() {
3826
+ }
3827
+ disconnectedCallback() {
3828
+ }
3829
+ attributeChangedCallback(t, i, s) {
3830
+ i !== s && (t === "title" ? e(this, ii).textContent = s : t === "description" ? e(this, si).textContent = s : t === "background-image" && (e(this, ni).style.backgroundImage = `url(${s})`));
3831
+ }
3832
+ }
3833
+ ii = new WeakMap(), si = new WeakMap(), ni = new WeakMap(), m(wr, "observedAttributes", ["title", "description", "background-image", "hidden"]);
3834
+ function Fo() {
3835
+ customElements.define("vindral-controller", Ce), customElements.define("vindral-control-bar", vn), customElements.define("vindral-play-button", hs), customElements.define("vindral-mute-button", ls), customElements.define("vindral-buffering-overlay", Vs), customElements.define("vindral-scroll-overlay", dr), customElements.define("vindral-play-overlay", Ss), customElements.define("vindral-user-input-play-overlay", Ls), customElements.define("vindral-fullscreen-button", es), customElements.define("vindral-rendition-levels-menu", vs), customElements.define("vindral-rendition-levels-menu-list", sr), customElements.define("vindral-channel-grid-button", qi), customElements.define("vindral-channel-grid", en), customElements.define("vindral-channel-grid-item", Ts), customElements.define("vindral-pip-button", cs), customElements.define("vindral-airplay-button", Gi), customElements.define("vindral-cast-button", zi), customElements.define("vindral-cast-overlay", Qs), customElements.define("vindral-buffering-icon", Er), customElements.define("vindral-language-menu", is), customElements.define("vindral-language-menu-list", On), customElements.define("vindral-message", wr), customElements.define("vindral-volume-range", Cs), customElements.define("vindral-poster-overlay", Zn), customElements.define("vindral-player", Jn);
3836
+ }
3837
+ export {
3838
+ Fo as registerComponents
3839
+ };