@vindral/web-sdk 3.4.4 → 4.0.0-191-g9f7294ed

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