@vindral/web-sdk 3.4.4 → 4.0.0-190-g016e452d

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