@vindral/web-sdk 3.4.3 → 4.0.0

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