@vindral/web-sdk 4.2.0-5-g7d2f2421 → 4.2.0-7-g7d6ca07f

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/CnCQ_flD.js ADDED
@@ -0,0 +1,4492 @@
1
+ import { n as e, t } from "./DTteQSVE.js";
2
+ import { C as n, S as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as ee, i as d, l as te, m as f, n as p, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as ce, x as m, y as le } from "./D4BVrOMF.js";
3
+ import { M as ue } from "./zjSBNbgC.js";
4
+ import { n as de, t as fe } from "./CgCFv2k5.js";
5
+ import { t as pe } from "./R2vG6-bP.js";
6
+ import { t as me } from "./1vibAwcB.js";
7
+ //#region ../../libs/utils/src/formatting.ts
8
+ var he = 1e3, ge = he * 1e3, _e = ge * 1e3, ve = (e, t, n) => e % t === 0 ? e / t : (e / t).toFixed(n), ye = (e, t = 1) => e >= _e ? `${ve(e, _e, t)} Gbit/s` : e >= ge ? `${ve(e, ge, t)} Mbit/s` : e >= he ? `${ve(e, he, t)} Kbit/s` : `${e} bit/s`, be = ({ width: e, height: t }) => `${e}x${t}`, xe = ({ title: e, subTitle: t = "Live stream", poster: n }) => {
9
+ document.title = e, "mediaSession" in navigator && (navigator.mediaSession.metadata = new MediaMetadata({
10
+ title: e,
11
+ artist: t,
12
+ artwork: n ? [{ src: n }] : []
13
+ }));
14
+ }, Se = (e) => e === "mse" || e === "webcodecs" || e === "wasm";
15
+ function Ce(e) {
16
+ if (e === null || e === "auto") return;
17
+ let t = e.split(",").filter(Se);
18
+ return t.length > 0 ? t : void 0;
19
+ }
20
+ function we(e) {
21
+ if (e === "no-preference" || e === "prefer-hardware" || e === "prefer-software") return e;
22
+ }
23
+ //#endregion
24
+ //#region ../../libs/player-next/src/VindralAttributes.ts
25
+ var h = {
26
+ PAUSED: "paused",
27
+ MUTED: "muted",
28
+ USER_INTERACTING: "user-interacting",
29
+ IS_CASTING: "is-casting",
30
+ CAST_AVAILABLE: "cast-available",
31
+ CAST_RECEIVER_NAME: "cast-receiver-name",
32
+ BUFFERING: "buffering",
33
+ UI_LOCKED: "ui-locked",
34
+ HIDE_UI_ON_PAUSE: "hide-ui-on-pause",
35
+ FULLSCREEN: "is-fullscreen",
36
+ FULLSCREEN_FALLBACK: "is-fullscreen-fallback",
37
+ RENDITION_LEVELS: "rendition-levels",
38
+ RENDITION_LEVEL: "rendition-level",
39
+ MAX_VIDEO_BITRATE: "max-video-bit-rate",
40
+ MAX_INITIAL_BITRATE: "max-initial-bit-rate",
41
+ ABR_ENABLED: "abr-enabled",
42
+ SIZE_BASED_RESOLUTION_CAP_ENABLED: "size-based-resolution-cap-enabled",
43
+ CHANNELS: "channels",
44
+ CHANNEL_ID: "channel-id",
45
+ CHANNEL_GROUP_ID: "channel-group-id",
46
+ PIP_AVAILABLE: "pip-available",
47
+ IS_PIP: "is-pip",
48
+ AIRPLAY_AVAILABLE: "airplay-available",
49
+ IS_AIRPLAYING: "is-airplaying",
50
+ MEDIA: "media",
51
+ LANGUAGES: "languages",
52
+ LANGUAGE: "language",
53
+ TEXT_TRACKS: "text-tracks",
54
+ TEXT_TRACK: "text-track",
55
+ NEEDS_USER_INPUT_VIDEO: "needs-user-input-video",
56
+ NEEDS_USER_INPUT_AUDIO: "needs-user-input-audio",
57
+ AUTHENTICATION_TOKEN: "authentication-token",
58
+ VOLUME: "volume",
59
+ VOLUME_LEVEL: "volume-level",
60
+ CAST_ENABLED: "cast",
61
+ AIRPLAY_ENABLED: "airplay",
62
+ PIP_ENABLED: "pip",
63
+ FULLSCREEN_ENABLED: "fullscreen",
64
+ VU_METER_ENABLED: "vu-meter",
65
+ TIMESHIFT_ENABLED: "timeshift",
66
+ TIMESHIFT_POSITION: "timeshift-position",
67
+ POSTER_SRC: "poster-src",
68
+ DURATION: "duration"
69
+ }, Te = Object.values(h), g = {
70
+ PLAY: "play",
71
+ PAUSE: "pause",
72
+ MUTE: "mute",
73
+ UNMUTE: "unmute",
74
+ LOCK_UI: "lock-ui",
75
+ UNLOCK_UI: "unlock-ui",
76
+ ENTER_FULLSCREEN: "enter-fullscreen",
77
+ EXIT_FULLSCREEN: "exit-fullscreen",
78
+ SET_RENDITION: "set-rendition",
79
+ SET_ABR_MODE: "set-abr-mode",
80
+ SET_SIZE_BASED_RESOLUTION_CAP_MODE: "set-size-based-resolution-cap-mode",
81
+ CHANNEL_GRID_OPENED: "channel-grid-opened",
82
+ CHANNEL_GRID_CLOSED: "channel-grid-closed",
83
+ ENTER_PIP: "enter-pip",
84
+ EXIT_PIP: "exit-pip",
85
+ REQUEST_AIRPLAY: "request-airplay",
86
+ SET_LANGUAGE: "set-language",
87
+ SET_TEXT_TRACK: "set-text-track",
88
+ REQUEST_USER_INPUT: "request-user-input",
89
+ SET_VOLUME: "set-volume",
90
+ SEEK: "seek",
91
+ GO_LIVE: "go-live"
92
+ };
93
+ //#endregion
94
+ //#region ../../libs/player-next/src/utils/vindralAttributesUtils.ts
95
+ function Ee(e) {
96
+ return e === "audio" || e === "video" || e === "audio+video" ? e : "audio+video";
97
+ }
98
+ function De(e) {
99
+ return e === "trace" || e === "debug" || e === "info" || e === "warn" || e === "error" || e === "off" ? e : "off";
100
+ }
101
+ function Oe(e) {
102
+ if (e === null) return;
103
+ let t = e.split(",").map((e) => e.trim()).filter((e) => e === "h264" || e === "av1");
104
+ if (t.length !== 0) return t;
105
+ }
106
+ function ke(e) {
107
+ if (e !== null) try {
108
+ let t = JSON.parse(e);
109
+ if (typeof t == "object" && t) {
110
+ let e = t;
111
+ if (typeof e.width == "number" && typeof e.height == "number") return e;
112
+ }
113
+ } catch (e) {
114
+ return;
115
+ }
116
+ }
117
+ function Ae(e) {
118
+ if (e !== null) try {
119
+ let t = JSON.parse(e);
120
+ if (typeof t == "object" && t) return t;
121
+ } catch (e) {
122
+ return;
123
+ }
124
+ }
125
+ function je(e) {
126
+ if (e === null) return;
127
+ let t = parseFloat(e);
128
+ return isNaN(t) ? void 0 : t;
129
+ }
130
+ function _(e) {
131
+ return typeof e == "string";
132
+ }
133
+ function v(e, t) {
134
+ if (e === null) return t == null ? void 0 : t;
135
+ let n = e.toLowerCase();
136
+ return n === "false" ? !1 : n === "true" || n === "" || t == null ? !0 : t;
137
+ }
138
+ function Me(e, t) {
139
+ return e === null ? t == null ? void 0 : t : e === "" || e.toLowerCase() === "true" ? !0 : e.toLowerCase() === "false" ? !1 : e;
140
+ }
141
+ function Ne(e) {
142
+ if (e === null) return;
143
+ let t = {}, n = e.split(",");
144
+ for (let e of n) {
145
+ let [n, r] = e.split(":");
146
+ n && r && (t[n.trim()] = r.trim());
147
+ }
148
+ return Object.keys(t).length > 0 ? t : void 0;
149
+ }
150
+ function Pe(e) {
151
+ if (e === null) return;
152
+ let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
153
+ return t.length > 0 ? t : void 0;
154
+ }
155
+ //#endregion
156
+ //#region ../../libs/player-next/src/components/VindralButton.ts
157
+ var Fe = document.createElement("template");
158
+ Fe.innerHTML = "\n <style>\n :host {\n cursor: pointer;\n color: var(--fg-strong);\n padding: var(--button-padding);\n background: transparent;\n transition: background 0.2s linear;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host(:focus-visible) {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n outline: 0;\n }\n\n :host(:where(:focus)) {\n box-shadow: none;\n outline: 0;\n }\n\n @media (hover: hover) and (pointer: fine) {\n :host(:hover) {\n background: rgba(255, 255, 255, 0.15);\n }\n }\n\n :host(:active) {\n background: rgba(255, 255, 255, 0.25);\n }\n\n :host(:active) svg {\n scale: 0.9;\n }\n\n :host([disabled]) {\n opacity: 0.5;\n background: transparent;\n }\n\n slot > svg {\n display: block;\n width: var(--button-icon-size);\n height: var(--button-icon-size);\n }\n </style>\n";
159
+ var Ie = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), y = class extends HTMLElement {
160
+ constructor() {
161
+ super(), n(this, Ie, null), n(this, Le, (e) => {
162
+ this.handleClick(e);
163
+ }), n(this, Re, (e) => {
164
+ let { key: t } = e;
165
+ if (!this.keysUsed.includes(t)) {
166
+ this.removeEventListener("keyup", o(Re, this));
167
+ return;
168
+ }
169
+ this.handleClick(e);
170
+ }), n(this, ze, (e) => {
171
+ let { metaKey: t, altKey: n, key: r } = e;
172
+ if (t || n || !this.keysUsed.includes(r)) {
173
+ this.removeEventListener("keyup", o(Re, this));
174
+ return;
175
+ }
176
+ this.addEventListener("keyup", o(Re, this), { once: !0 });
177
+ }), this.attachShadow({ mode: "open" }).appendChild(Fe.content.cloneNode(!0));
178
+ }
179
+ get keysUsed() {
180
+ return ["Enter", " "];
181
+ }
182
+ connectedCallback() {
183
+ var e;
184
+ m(Ie, this, this.closest("vindral-controller")), (e = o(Ie, this)) == null || e.connectListener(this), this.hasAttribute("disabled") || this.enable(), this.setAttribute("role", "button");
185
+ }
186
+ enable() {
187
+ this.addEventListener("click", o(Le, this)), this.addEventListener("keydown", o(ze, this)), this.tabIndex = 0;
188
+ }
189
+ disable() {
190
+ this.removeEventListener("click", o(Le, this)), this.removeEventListener("keydown", o(ze, this)), this.removeEventListener("keyup", o(Re, this)), this.tabIndex = -1;
191
+ }
192
+ disconnectedCallback() {
193
+ var e;
194
+ (e = o(Ie, this)) == null || e.disconnectListener(this);
195
+ }
196
+ attributeChangedCallback(e, t, n) {
197
+ e === "disabled" && (_(n) ? this.disable() : this.enable());
198
+ }
199
+ };
200
+ e(y, "observedAttributes", ["disabled"]);
201
+ //#endregion
202
+ //#region \0@oxc-project+runtime@0.115.0/helpers/getPrototypeOf.js
203
+ function Be(e) {
204
+ return Be = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
205
+ return e.__proto__ || Object.getPrototypeOf(e);
206
+ }, Be(e);
207
+ }
208
+ //#endregion
209
+ //#region \0@oxc-project+runtime@0.115.0/helpers/superPropBase.js
210
+ function Ve(e, t) {
211
+ for (; !{}.hasOwnProperty.call(e, t) && (e = Be(e)) !== null;);
212
+ return e;
213
+ }
214
+ //#endregion
215
+ //#region \0@oxc-project+runtime@0.115.0/helpers/get.js
216
+ function He() {
217
+ return He = typeof Reflect < "u" && Reflect.get ? Reflect.get.bind() : function(e, t, n) {
218
+ var r = Ve(e, t);
219
+ if (r) {
220
+ var i = Object.getOwnPropertyDescriptor(r, t);
221
+ return i.get ? i.get.call(arguments.length < 3 ? e : n) : i.value;
222
+ }
223
+ }, He.apply(null, arguments);
224
+ }
225
+ //#endregion
226
+ //#region \0@oxc-project+runtime@0.115.0/helpers/superPropGet.js
227
+ function b(e, t, n, r) {
228
+ var i = He(Be(1 & r ? e.prototype : e), t, n);
229
+ return 2 & r && typeof i == "function" ? function(e) {
230
+ return i.apply(n, e);
231
+ } : i;
232
+ }
233
+ //#endregion
234
+ //#region ../../libs/player-next/src/components/AirPlayButton.ts
235
+ var Ue, We = document.createElement("template"), Ge = "\n <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>\n";
236
+ We.innerHTML = `
237
+ <style>
238
+ :host {
239
+ display: var(--airplay-button-display);
240
+ }
241
+
242
+ :host(:not([${h.AIRPLAY_AVAILABLE}])) {
243
+ display: none !important;
244
+ }
245
+
246
+ :host([${h.IS_AIRPLAYING}]) slot[name="exit"] {
247
+ display: none !important;
248
+ }
249
+
250
+ :host(:not([${h.IS_AIRPLAYING}])) slot[name="enter"] {
251
+ display: none !important;
252
+ }
253
+ </style>
254
+
255
+ <slot name="icon">
256
+ <slot name="enter">${Ge}</slot>
257
+ <slot name="exit">${Ge}</slot>
258
+ </slot>
259
+ `;
260
+ var Ke = /* @__PURE__ */ new WeakSet(), qe = class extends y {
261
+ constructor() {
262
+ var e;
263
+ super(), p(this, Ke), (e = this.shadowRoot) == null || e.appendChild(We.content.cloneNode(!0));
264
+ }
265
+ connectedCallback() {
266
+ super.connectedCallback(), r(Ke, this, Je).call(this);
267
+ }
268
+ disconnectedCallback() {
269
+ super.disconnectedCallback();
270
+ }
271
+ attributeChangedCallback(e, t, n) {
272
+ super.attributeChangedCallback(e, t, n), e === h.IS_AIRPLAYING && r(Ke, this, Je).call(this);
273
+ }
274
+ set isAirPlaying(e) {
275
+ e ? this.setAttribute(h.IS_AIRPLAYING, "") : this.removeAttribute(h.IS_AIRPLAYING);
276
+ }
277
+ get isAirPlaying() {
278
+ return this.hasAttribute(h.IS_AIRPLAYING);
279
+ }
280
+ handleClick(e) {
281
+ this.dispatchEvent(new CustomEvent(g.REQUEST_AIRPLAY, {
282
+ bubbles: !0,
283
+ composed: !0
284
+ }));
285
+ }
286
+ };
287
+ Ue = qe;
288
+ function Je() {
289
+ this.setAttribute("aria-label", this.isAirPlaying ? "Exit airplay" : "Enter airplay");
290
+ }
291
+ e(qe, "observedAttributes", [
292
+ ...b(Ue, "observedAttributes", Ue),
293
+ h.AIRPLAY_AVAILABLE,
294
+ h.IS_AIRPLAYING
295
+ ]);
296
+ //#endregion
297
+ //#region ../../libs/player-next/src/components/VindralMenuButton.ts
298
+ var Ye = document.createElement("template");
299
+ Ye.innerHTML = "\n <style>\n :host {\n position: relative;\n }\n\n :host([hidden]) {\n display: none;\n }\n </style>\n";
300
+ var Xe = /* @__PURE__ */ new WeakMap(), Ze = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakSet(), nt = class extends y {
301
+ constructor() {
302
+ var e;
303
+ super(), p(this, tt), n(this, Xe, void 0), n(this, Ze, void 0), n(this, x, void 0), n(this, Qe, null), n(this, $e, (e) => {
304
+ e.composedPath().includes(this) || this.hide();
305
+ }), n(this, et, () => {
306
+ this.hide();
307
+ }), (e = this.shadowRoot) == null || e.appendChild(Ye.content.cloneNode(!0));
308
+ }
309
+ connectedCallback() {
310
+ var e, t, n, r;
311
+ super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("aria-haspopup", "listbox");
312
+ let i = (e = this.getAttribute("list-position")) == null ? "top" : e;
313
+ (t = o(Ze, this)) == null || t.setAttribute("list-position", i);
314
+ let a = this.getRootNode(), s = [...(n = (r = this.shadowRoot) == null ? void 0 : r.querySelectorAll(":not(:defined)")) == null ? [] : n].map((e) => customElements.whenDefined(e.localName));
315
+ Promise.all(s).then(() => {
316
+ if (a instanceof Document || a instanceof ShadowRoot) {
317
+ var e;
318
+ m(Qe, this, a.querySelector("vindral-controller")), (e = o(Qe, this)) == null || e.connectListener(this);
319
+ }
320
+ });
321
+ }
322
+ set button(e) {
323
+ m(Xe, this, e);
324
+ }
325
+ set listbox(e) {
326
+ m(Ze, this, e);
327
+ }
328
+ set listboxSlot(e) {
329
+ m(x, this, e);
330
+ }
331
+ enable() {
332
+ super.enable(), this.addEventListener("change", o(et, this)), document.addEventListener("click", o($e, this));
333
+ }
334
+ hide() {
335
+ var e, t;
336
+ !o(x, this) || (e = o(x, this)) != null && e.hidden || (o(x, this).hidden = !0, (t = o(Xe, this)) == null || t.setAttribute("aria-expanded", "false"), this.dispatchEvent(new CustomEvent(g.UNLOCK_UI, {
337
+ bubbles: !0,
338
+ composed: !0
339
+ })), this.focus());
340
+ }
341
+ handleClick(e) {
342
+ o(x, this) && !e.composedPath().includes(o(x, this)) && r(tt, this, rt).call(this);
343
+ }
344
+ };
345
+ function rt() {
346
+ var e;
347
+ (e = o(x, this)) != null && e.hidden ? r(tt, this, it).call(this) : this.hide();
348
+ }
349
+ function it() {
350
+ var e, t, n;
351
+ (e = o(x, this)) != null && e.hidden && (o(x, this).hidden = !1, (t = o(Xe, this)) == null || t.setAttribute("aria-expanded", "true"), (n = o(Ze, this)) == null || n.focus(), this.dispatchEvent(new CustomEvent(g.LOCK_UI, {
352
+ bubbles: !0,
353
+ composed: !0
354
+ })));
355
+ }
356
+ //#endregion
357
+ //#region ../../libs/player-next/src/components/AdvancedRenditionMenu.ts
358
+ var at, ot = "\n<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\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <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\" />\n</svg>\n", st = document.createElement("template");
359
+ st.innerHTML = `
360
+ <style>
361
+ :host {
362
+ display: var(--rendition-menu-display);
363
+ }
364
+ </style>
365
+
366
+ <slot name="button">${ot}</slot>
367
+ <slot name="listbox" hidden>
368
+ <vindral-advanced-rendition-menu-list id="listbox" part="listbox"></vindral-advanced-rendition-menu-list>
369
+ </slot>
370
+ `;
371
+ var ct = /* @__PURE__ */ new WeakSet(), lt = class extends nt {
372
+ constructor() {
373
+ var e, t, n, r;
374
+ super(), p(this, ct), (e = this.shadowRoot) == null || e.appendChild(st.content.cloneNode(!0)), this.button = (t = this.shadowRoot) == null ? void 0 : t.querySelector("slot[name=button]"), this.listbox = (n = this.shadowRoot) == null ? void 0 : n.querySelector("[part=listbox]"), this.listboxSlot = (r = this.shadowRoot) == null ? void 0 : r.querySelector("slot[name=listbox]");
375
+ }
376
+ connectedCallback() {
377
+ super.connectedCallback(), r(ct, this, ut).call(this), this.setAttribute("aria-label", "Advanced rendition controls");
378
+ }
379
+ attributeChangedCallback(e, t, n) {
380
+ super.attributeChangedCallback(e, t, n), e === h.RENDITION_LEVELS && r(ct, this, ut).call(this);
381
+ }
382
+ };
383
+ at = lt;
384
+ function ut() {
385
+ let e = this.getAttribute(h.RENDITION_LEVELS);
386
+ !e || e === "[]" ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
387
+ }
388
+ e(lt, "observedAttributes", [...b(at, "observedAttributes", at), h.RENDITION_LEVELS]);
389
+ //#endregion
390
+ //#region ../../libs/player-next/src/components/AdvancedRenditionMenuList.ts
391
+ var dt = document.createElement("template");
392
+ dt.innerHTML = "\n <style>\n :host {\n font: inherit;\n cursor: default;\n padding: var(--padding-2);\n padding-top: var(--padding-3);\n border-radius: 0.25em;\n position: absolute;\n min-width: 220px;\n background: var(--bg-subtle);\n z-index: 1;\n overflow: auto;\n }\n\n :host([list-position=\"top\"]) {\n bottom: calc(100% + 0.5em);\n transform: translate(-50%);\n }\n\n :host([list-position=\"bottom\"]) {\n top: calc(100% + 0.5em);\n }\n\n :host::-webkit-scrollbar {\n width: 5px;\n padding-right: 5px;\n }\n\n :host::-webkit-scrollbar-thumb {\n background-color: var(--fg-extra-subtle);\n border-radius: 10px;\n border: 0;\n }\n\n :host::-webkit-scrollbar-track {\n border-radius: 10px;\n background-color: transparent;\n }\n\n .mode-toggle {\n display: flex;\n gap: var(--padding-1);\n margin-bottom: var(--padding-2);\n }\n\n .mode-btn {\n flex: 1;\n padding: var(--padding-1) var(--padding-2);\n border: none;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 500;\n cursor: pointer;\n background: var(--bg-component);\n color: var(--fg-default);\n transition: background 0.15s;\n }\n\n .mode-btn:hover {\n background: var(--bg-component-hover);\n }\n\n .mode-btn[data-active=\"true\"] {\n background: #549ce0;\n color: #ffffff;\n }\n\n .setting-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--padding-2);\n margin-bottom: var(--padding-2);\n padding: 0 var(--padding-1);\n }\n\n .setting-label {\n font-size: 10px;\n color: var(--fg-subtle);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n }\n\n .setting-toggle-btn {\n border: none;\n border-radius: 999px;\n background: var(--bg-component);\n color: var(--fg-default);\n font-size: 10px;\n font-weight: 600;\n min-width: 44px;\n padding: 4px 10px;\n cursor: pointer;\n transition: background 0.15s;\n }\n\n .setting-toggle-btn[data-active=\"true\"] {\n background: #549ce0;\n color: #ffffff;\n }\n\n .setting-toggle-btn:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .quality-status-text {\n font-size: 10px;\n color: var(--fg-subtle);\n margin-bottom: var(--padding-2);\n padding: 0 var(--padding-1);\n font-style: italic;\n }\n\n .menu {\n display: grid;\n gap: var(--padding-1);\n }\n\n .menu-item {\n display: flex;\n align-items: center;\n gap: var(--padding-2);\n padding: var(--padding-2);\n border-radius: 4px;\n cursor: pointer;\n font-size: 13px;\n position: relative;\n }\n\n .menu-item:hover {\n background: var(--bg-component-hover);\n }\n\n .menu-item[data-selected=\"true\"] {\n background: var(--bg-component-active);\n border: 1px solid var(--fg-extra-subtle);\n }\n\n .menu-item[data-capped=\"true\"] {\n opacity: 0.5;\n }\n\n .menu-item:focus-visible {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n outline: 0;\n }\n\n .menu-item-info {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n\n .menu-item-title {\n font-weight: 500;\n }\n\n .menu-item-subtitle {\n font-size: 10px;\n opacity: 0.6;\n }\n\n .current-label {\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n color: #549ce0;\n margin-left: auto;\n display: none;\n }\n\n .menu-item[data-playing=\"true\"] .current-label {\n display: block;\n }\n </style>\n\n <slot>\n <div class=\"mode-toggle\">\n <button class=\"mode-btn\" data-mode=\"auto\">Auto (ABR)</button>\n <button class=\"mode-btn\" data-mode=\"fixed\">Fixed</button>\n </div>\n <div class=\"setting-row\">\n <span class=\"setting-label\">Size cap</span>\n <button id=\"size-cap-toggle\" class=\"setting-toggle-btn\" type=\"button\"></button>\n </div>\n <div class=\"quality-status-text\" id=\"quality-status-text\"></div>\n <div class=\"menu\" role=\"menu\" aria-label=\"Quality options\"></div>\n </slot>\n";
393
+ var ft = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), _t = /* @__PURE__ */ new WeakMap(), vt = /* @__PURE__ */ new WeakMap(), yt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakSet(), xt = class extends HTMLElement {
394
+ constructor() {
395
+ super(), p(this, C), n(this, ft, []), n(this, pt, 2 ** 53 - 1), n(this, S, !1), n(this, mt, !0), n(this, ht, null), n(this, gt, null), n(this, _t, []), n(this, vt, null), n(this, yt, null), n(this, bt, null), e(this, "handleEvent", (e) => {
396
+ switch (e.type) {
397
+ case "keydown":
398
+ r(C, this, Nt).call(this, e);
399
+ break;
400
+ }
401
+ }), this.attachShadow({ mode: "open" }).appendChild(dt.content.cloneNode(!0));
402
+ }
403
+ connectedCallback() {
404
+ let e = this.getRootNode();
405
+ if (e instanceof ShadowRoot) {
406
+ var t;
407
+ m(vt, this, e.host.closest("vindral-controller")), (t = o(vt, this)) == null || t.connectListener(this), r(C, this, Dt).call(this), r(C, this, St).call(this), r(C, this, Ct).call(this), r(C, this, Ot).call(this), m(yt, this, e.host), this.addEventListener("keydown", this);
408
+ }
409
+ }
410
+ disconnectedCallback() {
411
+ var e, t;
412
+ (e = o(vt, this)) == null || e.disconnectListener(this), (t = o(bt, this)) == null || t.disconnect(), m(bt, this, null), this.removeEventListener("keydown", this);
413
+ }
414
+ attributeChangedCallback(e, t, n) {
415
+ t !== n && (e === h.RENDITION_LEVELS && n && (this.list = JSON.parse(n)), e === h.MAX_VIDEO_BITRATE && (this.maxVideoBitrate = n ? parseInt(n, 10) : 2 ** 53 - 1), e === h.ABR_ENABLED && (m(S, this, v(n, !1)), r(C, this, Tt).call(this), r(C, this, At).call(this)), e === h.RENDITION_LEVEL && n && (m(ht, this, JSON.parse(n)), r(C, this, At).call(this)), e === h.SIZE_BASED_RESOLUTION_CAP_ENABLED && (m(mt, this, v(n, !0)), r(C, this, Et).call(this)));
416
+ }
417
+ set list(e) {
418
+ m(ft, this, e), r(C, this, Ot).call(this);
419
+ }
420
+ set maxVideoBitrate(e) {
421
+ m(pt, this, e), r(C, this, At).call(this);
422
+ }
423
+ get keysUsed() {
424
+ return [
425
+ "Enter",
426
+ "Escape",
427
+ "Tab",
428
+ " ",
429
+ "ArrowDown",
430
+ "ArrowUp",
431
+ "Home",
432
+ "End"
433
+ ];
434
+ }
435
+ focus() {
436
+ var e;
437
+ (e = o(gt, this)) == null || e.focus();
438
+ }
439
+ };
440
+ function St() {
441
+ var e, t;
442
+ let n = (e = this.shadowRoot) == null ? void 0 : e.querySelector("[data-mode=\"auto\"]"), i = (t = this.shadowRoot) == null ? void 0 : t.querySelector("[data-mode=\"fixed\"]");
443
+ n == null || n.addEventListener("click", () => {
444
+ m(S, this, !0), r(C, this, Tt).call(this), r(C, this, At).call(this), this.dispatchEvent(new CustomEvent(g.SET_ABR_MODE, {
445
+ bubbles: !0,
446
+ composed: !0,
447
+ detail: !0
448
+ }));
449
+ }), i == null || i.addEventListener("click", () => {
450
+ let e = r(C, this, wt).call(this);
451
+ e && this.dispatchEvent(new CustomEvent(g.SET_RENDITION, {
452
+ bubbles: !0,
453
+ composed: !0,
454
+ detail: e
455
+ })), m(S, this, !1), r(C, this, Tt).call(this), r(C, this, At).call(this), this.dispatchEvent(new CustomEvent(g.SET_ABR_MODE, {
456
+ bubbles: !0,
457
+ composed: !0,
458
+ detail: !1
459
+ }));
460
+ }), r(C, this, Tt).call(this);
461
+ }
462
+ function Ct() {
463
+ var e;
464
+ let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#size-cap-toggle");
465
+ t == null || t.addEventListener("click", () => {
466
+ let e = !o(mt, this);
467
+ m(mt, this, e), r(C, this, Et).call(this), this.dispatchEvent(new CustomEvent(g.SET_SIZE_BASED_RESOLUTION_CAP_MODE, {
468
+ bubbles: !0,
469
+ composed: !0,
470
+ detail: e
471
+ }));
472
+ }), r(C, this, Et).call(this);
473
+ }
474
+ function wt() {
475
+ let e = [...o(ft, this)].sort((e, t) => {
476
+ var n, r;
477
+ return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
478
+ });
479
+ return e.find((e) => {
480
+ var t;
481
+ return ((t = e.video) == null ? void 0 : t.bitRate) && e.video.bitRate <= o(pt, this);
482
+ }) || e[e.length - 1] || null;
483
+ }
484
+ function Tt() {
485
+ var e, t, n;
486
+ let i = (e = this.shadowRoot) == null ? void 0 : e.querySelector("[data-mode=\"auto\"]"), a = (t = this.shadowRoot) == null ? void 0 : t.querySelector("[data-mode=\"fixed\"]"), s = (n = this.shadowRoot) == null ? void 0 : n.querySelector("#quality-status-text");
487
+ i && a && (i.setAttribute("data-active", String(o(S, this))), a.setAttribute("data-active", String(!o(S, this)))), s && (s.textContent = o(S, this) ? "Select maximum allowed quality" : "Select specific quality (may cause buffering)"), r(C, this, Et).call(this);
488
+ }
489
+ function Et() {
490
+ var e;
491
+ let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#size-cap-toggle");
492
+ t && (t.textContent = o(mt, this) ? "On" : "Off", t.setAttribute("aria-pressed", String(o(mt, this))), t.setAttribute("data-active", String(o(mt, this))), t.disabled = !o(S, this), t.title = o(S, this) ? "Toggle size-based resolution cap" : "Only available in Auto (ABR) mode");
493
+ }
494
+ function Dt() {
495
+ var e;
496
+ (e = o(bt, this)) == null || e.disconnect(), m(bt, this, new IntersectionObserver((e) => {
497
+ e.forEach((e) => {
498
+ if (e.intersectionRatio === 1) {
499
+ this.style.height = "auto";
500
+ return;
501
+ } else if (e.intersectionRatio > 0) {
502
+ let t = e.intersectionRect.height, n = Math.max(0, t - 24);
503
+ this.style.height = `${n}px`;
504
+ } else this.style.height = "auto";
505
+ });
506
+ }, {
507
+ root: o(vt, this),
508
+ threshold: 0
509
+ })), o(bt, this).observe(this);
510
+ }
511
+ function Ot() {
512
+ var e;
513
+ let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".menu");
514
+ t && (m(_t, this, []), t.innerHTML = "", o(ft, this).sort((e, t) => {
515
+ var n, r;
516
+ return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
517
+ }).forEach((e) => {
518
+ var n, i, a, s, c, l, u, ee, d, te;
519
+ let f = document.createElement("div");
520
+ f.setAttribute("role", "menuitem"), f.setAttribute("value", String((n = e.video) == null ? void 0 : n.height)), f.classList.add("menu-item"), f.tabIndex = -1;
521
+ let p = document.createElement("div");
522
+ p.className = "menu-item-info";
523
+ let ne = document.createElement("span");
524
+ ne.className = "menu-item-title", ne.textContent = e.video ? be(e.video) : "";
525
+ let re = document.createElement("span");
526
+ re.classList.add("menu-item-subtitle");
527
+ let ie = r(C, this, kt).call(this, (i = e.video) == null ? void 0 : i.frameRate);
528
+ re.textContent = `${ye(((a = (s = e.video) == null ? void 0 : s.bitRate) == null ? 0 : a) + ((c = (l = e.audio) == null ? void 0 : l.bitRate) == null ? 0 : c))}, ${ie}fps`, p.appendChild(ne), p.appendChild(re), f.appendChild(p);
529
+ let ae = document.createElement("span");
530
+ ae.className = "current-label", ae.textContent = "Current", f.appendChild(ae), f.addEventListener("click", () => r(C, this, Mt).call(this, e)), o(_t, this).push({
531
+ el: f,
532
+ id: (u = (ee = e.video) == null ? void 0 : ee.id) == null ? -1 : u,
533
+ bitrate: (d = (te = e.video) == null ? void 0 : te.bitRate) == null ? 0 : d
534
+ }), t.appendChild(f);
535
+ }), r(C, this, At).call(this));
536
+ }
537
+ function kt(e) {
538
+ return e ? e[0] % e[1] === 0 ? (e[0] / e[1]).toString() : (e[0] / e[1]).toFixed(2) : "";
539
+ }
540
+ function At() {
541
+ var e;
542
+ let t = (e = o(ht, this)) == null || (e = e.video) == null ? void 0 : e.id, n = r(C, this, jt).call(this), i = n == null ? void 0 : n.id;
543
+ m(gt, this, null), o(_t, this).forEach((e) => {
544
+ let n = e.id, r = e.bitrate;
545
+ e.el.setAttribute("data-playing", String(n === t));
546
+ let a = n === i;
547
+ if (e.el.setAttribute("data-selected", String(a)), a ? (e.el.setAttribute("aria-selected", "true"), e.el.tabIndex = 0, m(gt, this, e.el)) : (e.el.removeAttribute("aria-selected"), e.el.tabIndex = -1), o(S, this)) {
548
+ let t = r > o(pt, this);
549
+ e.el.setAttribute("data-capped", String(t));
550
+ } else e.el.removeAttribute("data-capped");
551
+ });
552
+ }
553
+ function jt() {
554
+ let e = [...o(_t, this)].sort((e, t) => t.bitrate - e.bitrate);
555
+ return e.find((e) => e.bitrate <= o(pt, this)) || e[e.length - 1];
556
+ }
557
+ function Mt(e) {
558
+ this.dispatchEvent(new Event("change", {
559
+ bubbles: !0,
560
+ composed: !0
561
+ })), this.dispatchEvent(new CustomEvent(g.SET_RENDITION, {
562
+ bubbles: !0,
563
+ composed: !0,
564
+ detail: e
565
+ }));
566
+ }
567
+ function Nt(e) {
568
+ let { key: t, ctrlKey: n, altKey: i, metaKey: a } = e;
569
+ if (!(n || i || a) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") {
570
+ var s;
571
+ (s = o(yt, this)) == null || s.hide();
572
+ } else if (t === "Enter" || t === " ") {
573
+ var c;
574
+ (c = r(C, this, Ft).call(this)) == null || (c = c.el) == null || c.click();
575
+ } else r(C, this, Pt).call(this, e);
576
+ }
577
+ function Pt(e) {
578
+ var t;
579
+ let { key: n } = e, i = o(_t, this), a = (t = r(C, this, Ft).call(this)) == null ? i[0] : t;
580
+ if (!a) return;
581
+ let s = i.indexOf(a), c = Math.max(0, s);
582
+ n === "ArrowDown" ? c++ : n === "ArrowUp" ? c-- : e.key === "Home" ? c = 0 : e.key === "End" && (c = i.length - 1), c < 0 && (c = i.length - 1), c > i.length - 1 && (c = 0);
583
+ let l = i[c];
584
+ l && (r(C, this, It).call(this, l.id), l.el.focus());
585
+ }
586
+ function Ft() {
587
+ return o(_t, this).find((e) => e.el.tabIndex === 0);
588
+ }
589
+ function It(e) {
590
+ for (let t of o(_t, this)) t.el.tabIndex = t.id === e ? 0 : -1;
591
+ }
592
+ e(xt, "observedAttributes", [
593
+ h.RENDITION_LEVELS,
594
+ h.MAX_VIDEO_BITRATE,
595
+ h.ABR_ENABLED,
596
+ h.RENDITION_LEVEL,
597
+ h.SIZE_BASED_RESOLUTION_CAP_ENABLED
598
+ ]);
599
+ //#endregion
600
+ //#region ../../libs/player-next/src/components/BufferingIcon.ts
601
+ var Lt = document.createElement("template");
602
+ Lt.innerHTML = `
603
+ <style>
604
+ :host {
605
+ color: var(--fg-strong);
606
+ }
607
+
608
+ slot > svg {
609
+ display: block;
610
+ }
611
+
612
+ :host(:not([${h.BUFFERING}])) {
613
+ visibility: hidden !important;
614
+ }
615
+ </style>
616
+
617
+ <slot name="icon">
618
+ <svg width="24" height="24" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
619
+ <style>
620
+ .spinner-container {
621
+ transform-origin: center;
622
+ animation: rotate 2s linear infinite;
623
+ }
624
+ .spinner-circle {
625
+ stroke-linecap: round;
626
+ animation: dash 1.5s ease-in-out infinite;
627
+ }
628
+ @keyframes rotate {
629
+ 100% {
630
+ transform: rotate(360deg);
631
+ }
632
+ }
633
+ @keyframes dash {
634
+ 0% {
635
+ stroke-dasharray: 0 150;
636
+ stroke-dashoffset: 0;
637
+ }
638
+ 47.5% {
639
+ stroke-dasharray: 42 150;
640
+ stroke-dashoffset: -16;
641
+ }
642
+ 95%, 100% {
643
+ stroke-dasharray: 42 150;
644
+ stroke-dashoffset: -59;
645
+ }
646
+ }
647
+ </style>
648
+ <g class="spinner-container">
649
+ <circle class="spinner-circle" cx="12" cy="12" r="9.5" fill="none" stroke-width="3"></circle>
650
+ </g>
651
+ </svg>
652
+ </slot>
653
+ `;
654
+ var Rt = /* @__PURE__ */ new WeakMap(), zt = class extends HTMLElement {
655
+ constructor() {
656
+ super(), n(this, Rt, null), this.attachShadow({ mode: "open" }).appendChild(Lt.content.cloneNode(!0));
657
+ }
658
+ connectedCallback() {
659
+ var e;
660
+ m(Rt, this, this.closest("vindral-controller")), (e = o(Rt, this)) == null || e.connectListener(this);
661
+ }
662
+ disconnectedCallback() {
663
+ var e;
664
+ (e = o(Rt, this)) == null || e.disconnectListener(this);
665
+ }
666
+ };
667
+ e(zt, "observedAttributes", [h.BUFFERING]);
668
+ //#endregion
669
+ //#region ../../libs/player-next/src/components/BufferingOverlay.ts
670
+ var Bt = document.createElement("template");
671
+ Bt.innerHTML = `
672
+ <style>
673
+ :host {
674
+ display: var(--buffering-overlay-display);
675
+ align-items: center;
676
+ justify-content: center;
677
+ position: absolute;
678
+ top: 0;
679
+ bottom: 0;
680
+ left: 0;
681
+ right: 0;
682
+ background-color: rgba(0, 0, 0, 0.3);
683
+ transition: opacity 250ms;
684
+ transition-delay: 1s;
685
+ opacity: 1;
686
+ pointer-events: none;
687
+ z-index: 1;
688
+ }
689
+
690
+ #buffering-indicator {
691
+ width: 40px;
692
+ height: 40px;
693
+ border-radius: 40px;
694
+ background-color: var(--fg-strong);
695
+ animation: scaleout 1s infinite ease-in-out;
696
+ }
697
+
698
+ @-webkit-keyframes scaleout {
699
+ 0% {
700
+ -webkit-transform: scale(0);
701
+ }
702
+ 100% {
703
+ -webkit-transform: scale(1);
704
+ opacity: 0;
705
+ }
706
+ }
707
+
708
+ @keyframes scaleout {
709
+ 0% {
710
+ -webkit-transform: scale(0);
711
+ transform: scale(0);
712
+ }
713
+ 100% {
714
+ -webkit-transform: scale(1);
715
+ transform: scale(1);
716
+ opacity: 0;
717
+ }
718
+ }
719
+
720
+ :host(:not([${h.BUFFERING}])) {
721
+ transition-delay: 0s;
722
+ opacity: 0 !important;
723
+ }
724
+ </style>
725
+
726
+ <div id="buffering-indicator"></div>
727
+ `;
728
+ var Vt = /* @__PURE__ */ new WeakMap(), Ht = class extends HTMLElement {
729
+ constructor() {
730
+ super(), n(this, Vt, null), this.attachShadow({ mode: "open" }).appendChild(Bt.content.cloneNode(!0));
731
+ }
732
+ connectedCallback() {
733
+ var e;
734
+ m(Vt, this, this.closest("vindral-controller")), (e = o(Vt, this)) == null || e.connectListener(this);
735
+ }
736
+ disconnectedCallback() {
737
+ var e;
738
+ (e = o(Vt, this)) == null || e.disconnectListener(this);
739
+ }
740
+ };
741
+ e(Ht, "observedAttributes", [h.BUFFERING]);
742
+ //#endregion
743
+ //#region ../../libs/player-next/src/components/CastButton.ts
744
+ var Ut, Wt = document.createElement("template");
745
+ Wt.innerHTML = `
746
+ <style>
747
+ :host {
748
+ display: var(--cast-button-display);
749
+ }
750
+
751
+ google-cast-launcher {
752
+ display: block;
753
+ width: var(--button-icon-size);
754
+ height: var(--button-icon-size);
755
+ cursor: pointer;
756
+ --connected-color: var(--fg-strong);
757
+ --disconnected-color: var(--fg-strong);
758
+ }
759
+
760
+ :host(:active) google-cast-launcher {
761
+ transform: scale(0.9);
762
+ }
763
+
764
+ :host(:not([${h.CAST_AVAILABLE}])) {
765
+ display: none !important;
766
+ }
767
+ </style>
768
+ `;
769
+ var Gt = /* @__PURE__ */ new WeakSet(), Kt = class extends y {
770
+ constructor() {
771
+ var e;
772
+ super(), p(this, Gt), (e = this.shadowRoot) == null || e.appendChild(Wt.content.cloneNode(!0));
773
+ }
774
+ connectedCallback() {
775
+ super.connectedCallback(), r(Gt, this, qt).call(this);
776
+ }
777
+ disconnectedCallback() {
778
+ super.disconnectedCallback();
779
+ }
780
+ attributeChangedCallback(e, t, n) {
781
+ super.attributeChangedCallback(e, t, n), e === h.CAST_AVAILABLE && r(Gt, this, Jt).call(this), e === h.IS_CASTING && r(Gt, this, qt).call(this);
782
+ }
783
+ set isCasting(e) {
784
+ e ? this.setAttribute(h.IS_CASTING, "") : this.removeAttribute(h.IS_CASTING);
785
+ }
786
+ get isCasting() {
787
+ return this.hasAttribute(h.IS_CASTING);
788
+ }
789
+ handleClick(e) {}
790
+ };
791
+ Ut = Kt;
792
+ function qt() {
793
+ this.setAttribute("aria-label", this.isCasting ? "Exit cast" : "Enter cast");
794
+ }
795
+ function Jt() {
796
+ var e;
797
+ if (!((e = this.shadowRoot) != null && e.querySelector("google-cast-launcher"))) {
798
+ var t;
799
+ let e = document.createElement("google-cast-launcher");
800
+ (t = this.shadowRoot) == null || t.appendChild(e);
801
+ }
802
+ }
803
+ e(Kt, "observedAttributes", [
804
+ ...b(Ut, "observedAttributes", Ut),
805
+ h.CAST_AVAILABLE,
806
+ h.IS_CASTING
807
+ ]);
808
+ //#endregion
809
+ //#region ../../libs/player-next/src/components/CastOverlay.ts
810
+ var Yt = document.createElement("template");
811
+ Yt.innerHTML = `
812
+ <style>
813
+ :host {
814
+ position: absolute;
815
+ top: 0;
816
+ left: 0;
817
+ width: 100%;
818
+ font-size: 20px;
819
+ text-align: center;
820
+ padding: 5% 0;
821
+ box-shadow: 0px 0px 20px black;
822
+ background: rgba(0, 0, 0, 0.5);
823
+ color: white;
824
+ pointer-events: none;
825
+ z-index: 1;
826
+ transition: opacity 0.3s ease-in-out;
827
+ }
828
+
829
+ @media only screen and (max-width: 600px) {
830
+ :host {
831
+ font-size: 14px;
832
+ }
833
+ }
834
+
835
+ :host(:not([${h.IS_CASTING}])) {
836
+ display: none;
837
+ }
838
+
839
+ #text {
840
+ margin: 0;
841
+ padding: 0;
842
+ }
843
+ </style>
844
+ <span id="text"></span>
845
+ `;
846
+ var Xt = /* @__PURE__ */ new WeakMap(), Zt = /* @__PURE__ */ new WeakMap(), Qt = class extends HTMLElement {
847
+ constructor() {
848
+ super(), n(this, Xt, null), n(this, Zt, null), this.attachShadow({ mode: "open" }).appendChild(Yt.content.cloneNode(!0));
849
+ }
850
+ connectedCallback() {
851
+ var e, t;
852
+ m(Xt, this, this.closest("vindral-controller")), (e = o(Xt, this)) == null || e.connectListener(this), m(Zt, this, (t = this.shadowRoot) == null ? void 0 : t.querySelector("#text"));
853
+ }
854
+ disconnectedCallback() {
855
+ var e;
856
+ (e = o(Xt, this)) == null || e.disconnectListener(this);
857
+ }
858
+ attributeChangedCallback(e, t, n) {
859
+ t === n || !o(Zt, this) || e === "cast-receiver-name" && typeof n == "string" && (o(Zt, this).innerText = `Casting to ${n || "device"}`);
860
+ }
861
+ };
862
+ e(Qt, "observedAttributes", [h.IS_CASTING, h.CAST_RECEIVER_NAME]);
863
+ //#endregion
864
+ //#region ../../libs/player-next/src/utils/elementUtils.ts
865
+ function $t(e = document) {
866
+ let t = e == null ? void 0 : e.activeElement;
867
+ if (!t) return null;
868
+ if (t.shadowRoot) {
869
+ let e = $t(t.shadowRoot);
870
+ return e == null ? t : e;
871
+ }
872
+ return t;
873
+ }
874
+ //#endregion
875
+ //#region ../../libs/player-next/src/components/ChannelGridItem.ts
876
+ var en = document.createElement("template");
877
+ en.innerHTML = "\n <style>\n :host {\n position: relative;\n aspect-ratio: 16 / 9;\n object-fit: cover;\n cursor: pointer;\n border-radius: 6px;\n box-sizing: border-box;\n\n background-size: cover;\n background-position: center;\n\n transition-property: background-image;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 200ms;\n\n background-color: rgba(0, 0, 0, 0.5);\n background-blend-mode: multiply;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([aria-selected=\"true\"]) {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n background-color: rgba(0, 0, 0, 0);\n }\n\n :host(:focus),\n :host(:focus-visible) {\n outline: none;\n }\n\n :host([offline]) {\n display: var(--grid-item-offline-display);\n background-image: repeating-linear-gradient(-45deg, #3d3d3d 0, #3d3d3d 4px, #1c2024 4px, #1c2024 8px) !important;\n pointer-events: none;\n }\n\n :host::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(255, 255, 255, 0);\n transition: background 0.2s ease;\n }\n\n :host(:hover)::before {\n background: rgba(255, 255, 255, 0.1);\n }\n\n .channel-title {\n position: absolute;\n bottom: var(--padding-2);\n left: var(--padding-2);\n padding: var(--padding-1) var(--padding-2);\n color: white;\n font-size: 15px;\n font-weight: 500;\n text-overflow: ellipsis;\n border-radius: 4px;\n\n @container (max-width: 480px) {\n font-size: 13px;\n }\n }\n </style>\n <slot></slot>\n";
878
+ var tn = /* @__PURE__ */ new WeakMap(), nn = class extends HTMLElement {
879
+ constructor() {
880
+ super(), n(this, tn, void 0), e(this, "lastThumbnailUpdate", void 0);
881
+ let t = this.attachShadow({ mode: "open" });
882
+ m(tn, this, document.createElement("span")), o(tn, this).className = "channel-title", t.appendChild(o(tn, this)), t.appendChild(en.content.cloneNode(!0));
883
+ }
884
+ attributeChangedCallback(e, t, n) {
885
+ if (t !== n) switch (e) {
886
+ case "url":
887
+ this.updateThumbnail();
888
+ break;
889
+ case "title":
890
+ o(tn, this).textContent = n;
891
+ break;
892
+ }
893
+ }
894
+ updateThumbnail() {
895
+ let e = this.getAttribute("url"), t = this.hasAttribute("offline"), n = this.hasAttribute("visible");
896
+ if (t || !e || !n || this.lastThumbnailUpdate && Date.now() - this.lastThumbnailUpdate < 1e4) return;
897
+ let r = new URL(e), i = new Image(), a = this.getAttribute("authentication-token");
898
+ a && r.searchParams.set("auth.token", a), r.searchParams.set("t", Date.now().toString()), i.src = r.toString(), i.onload = () => this.style.backgroundImage = `url(${r.toString()})`;
899
+ }
900
+ };
901
+ e(nn, "observedAttributes", [
902
+ "url",
903
+ "title",
904
+ "offline",
905
+ "authentication-token",
906
+ "visible"
907
+ ]);
908
+ //#endregion
909
+ //#region ../../libs/player-next/src/components/ChannelGrid.ts
910
+ var rn = document.createElement("template");
911
+ rn.innerHTML = "\n <style>\n :host {\n cursor: default;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n border-radius: 4px;\n background-color: var(--bg-subtle);\n padding: var(--padding-2);\n\n position: absolute;\n bottom: 0;\n right: 0;\n\n z-index: 5;\n width: 100%;\n max-height: 75%;\n\n @container (width < 768px) {\n padding: var(--padding-1);\n }\n }\n\n :host([hidden]) {\n display: none;\n }\n\n .wrapper {\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n height: 100%;\n }\n\n .wrapper::-webkit-scrollbar {\n display: none;\n }\n\n slot#grid {\n display: grid;\n gap: var(--padding-2);\n grid-template-columns: repeat(4, minmax(0, 1fr));\n\n @container (width < 768px) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: var(--padding-1);\n }\n @container (width < 1024px) and (width >= 768px) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n @container (width >= 1024px) {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n }\n\n /* Smart TV */\n @media (width < 1024px) and (width >= 768px) and (-webkit-min-device-pixel-ratio: 2) {\n slot#grid {\n grid-template-columns: repeat(4, minmax(0, 1fr)) !important;\n }\n }\n\n :host([mode=\"list\"]) slot#grid {\n grid-template-columns: repeat(1, minmax(0, 1fr));\n }\n </style>\n\n <div class=\"wrapper\">\n <slot name=\"grid\" id=\"grid\"></slot>\n </div>\n";
912
+ var an = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), sn = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), cn = /* @__PURE__ */ new WeakMap(), ln = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new WeakMap(), dn = /* @__PURE__ */ new WeakMap(), fn = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakSet(), pn = class extends HTMLElement {
913
+ constructor() {
914
+ super(), p(this, E), n(this, an, null), n(this, on, null), n(this, sn, []), n(this, w, []), n(this, T, void 0), n(this, cn, void 0), n(this, ln, void 0), n(this, un, void 0), n(this, dn, void 0), n(this, fn, void 0), e(this, "handleEvent", (e) => {
915
+ switch (e.type) {
916
+ case "keydown":
917
+ r(E, this, En).call(this, e);
918
+ break;
919
+ }
920
+ }), this.attachShadow({ mode: "open" }).appendChild(rn.content.cloneNode(!0));
921
+ }
922
+ connectedCallback() {
923
+ var e, t, n;
924
+ m(on, this, this.closest("vindral-controller")), (e = o(on, this)) == null || e.connectListener(this), r(E, this, mn).call(this), (t = o(an, this)) == null || t.observe((n = this.shadowRoot) == null ? void 0 : n.querySelector(".wrapper")), r(E, this, bn).call(this), m(ln, this, window.setInterval(() => {
925
+ r(E, this, wn).call(this);
926
+ }, 1e4));
927
+ }
928
+ disconnectedCallback() {
929
+ var e, t;
930
+ clearInterval(o(ln, this)), r(E, this, Mn).call(this), this.removeEventListener("keydown", this), (e = o(an, this)) == null || e.disconnect(), (t = o(on, this)) == null || t.disconnectListener(this);
931
+ }
932
+ attributeChangedCallback(e, t, n) {
933
+ if (t !== n) switch (e) {
934
+ case h.CHANNEL_ID:
935
+ r(E, this, Cn).call(this, n);
936
+ break;
937
+ case h.CHANNELS:
938
+ m(sn, this, JSON.parse(n)), r(E, this, bn).call(this);
939
+ break;
940
+ case "authentication-token":
941
+ m(cn, this, n);
942
+ break;
943
+ }
944
+ }
945
+ get keysUsed() {
946
+ return [
947
+ "Enter",
948
+ "Escape",
949
+ "Tab",
950
+ " ",
951
+ "ArrowDown",
952
+ "ArrowUp",
953
+ "ArrowLeft",
954
+ "ArrowRight",
955
+ "Home",
956
+ "End"
957
+ ];
958
+ }
959
+ focus() {
960
+ var e;
961
+ let t = $t();
962
+ t && t !== this && !this.contains(t) && m(un, this, t), (e = o(T, this)) == null || e.focus();
963
+ }
964
+ };
965
+ function mn() {
966
+ m(an, this, new IntersectionObserver((e) => {
967
+ e.forEach((e) => {
968
+ let { target: t, isIntersecting: n } = e;
969
+ t instanceof nn ? r(E, this, yn).call(this, t, n) : r(E, this, hn).call(this, n);
970
+ });
971
+ }, { root: o(on, this) }));
972
+ }
973
+ function hn(e) {
974
+ e ? r(E, this, gn).call(this) : r(E, this, _n).call(this);
975
+ }
976
+ function gn() {
977
+ this.dispatchEvent(new CustomEvent(g.CHANNEL_GRID_OPENED, {
978
+ bubbles: !0,
979
+ composed: !0
980
+ })), r(E, this, vn).call(this), this.addEventListener("keydown", this), o(T, this) && (o(T, this).tabIndex = 0);
981
+ }
982
+ function _n() {
983
+ r(E, this, Mn).call(this), o(T, this) && (o(T, this).tabIndex = -1), this.dispatchEvent(new CustomEvent(g.CHANNEL_GRID_CLOSED, {
984
+ bubbles: !0,
985
+ composed: !0
986
+ })), r(E, this, kn).call(this), this.removeEventListener("keydown", this);
987
+ }
988
+ function vn() {
989
+ var e;
990
+ r(E, this, Mn).call(this), m(fn, this, () => {
991
+ clearTimeout(o(dn, this)), m(dn, this, window.setTimeout(() => {
992
+ r(E, this, jn).call(this) && this.focus(), r(E, this, Mn).call(this);
993
+ }, 100));
994
+ }), (e = this.parentElement) == null || e.addEventListener("scroll", o(fn, this));
995
+ }
996
+ function yn(e, t) {
997
+ t ? (e.setAttribute("visible", ""), (!e.lastThumbnailUpdate || Date.now() - e.lastThumbnailUpdate >= 1e4) && (e.updateThumbnail(), e.lastThumbnailUpdate = Date.now())) : e.removeAttribute("visible");
998
+ }
999
+ function bn() {
1000
+ var e;
1001
+ let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot[name=grid]"), n = new Map(o(w, this).map((e) => [e.id, e])), i = this.getAttribute("channel-id");
1002
+ m(w, this, o(sn, this).map((e) => {
1003
+ var a;
1004
+ let s = n.get(e.channelId);
1005
+ if (s) return r(E, this, xn).call(this, s.element, e), s;
1006
+ let c = r(E, this, Sn).call(this, e, i);
1007
+ return (a = o(an, this)) == null || a.observe(c.element), t.contains(c.element) || t.appendChild(c.element), c;
1008
+ })), n.forEach((e, t) => {
1009
+ if (!o(sn, this).some((e) => e.channelId === t)) {
1010
+ var n;
1011
+ (n = o(an, this)) == null || n.unobserve(e.element), e.element.remove();
1012
+ }
1013
+ }), o(w, this).sort((e, t) => e.element.hasAttribute("offline") && !t.element.hasAttribute("offline") ? 1 : -1).forEach((e) => {
1014
+ t.contains(e.element) || t.appendChild(e.element);
1015
+ });
1016
+ }
1017
+ function xn(e, t) {
1018
+ t.isLive ? e.removeAttribute("offline") : e.setAttribute("offline", ""), e.setAttribute("url", t.thumbnailUrls[0] || ""), e.setAttribute("title", t.name);
1019
+ }
1020
+ function Sn(e, t) {
1021
+ let n = document.createElement("vindral-channel-grid-item");
1022
+ return n.setAttribute("url", e.thumbnailUrls[0] || ""), n.setAttribute("title", e.name), o(cn, this) && n.setAttribute("authentication-token", o(cn, this)), e.isLive || n.setAttribute("offline", ""), e.channelId === t && (n.setAttribute("aria-selected", "true"), m(T, this, n)), n.tabIndex = -1, n.onclick = () => r(E, this, Tn).call(this, e), {
1023
+ element: n,
1024
+ thumbnail: e.thumbnailUrls[0] || "",
1025
+ id: e.channelId
1026
+ };
1027
+ }
1028
+ function Cn(e) {
1029
+ o(w, this).forEach((t) => {
1030
+ t.id === e ? (t.element.setAttribute("aria-selected", "true"), t.element.tabIndex = 0, m(T, this, t.element)) : (t.element.tabIndex = -1, t.element.setAttribute("aria-selected", "false"));
1031
+ });
1032
+ }
1033
+ function wn() {
1034
+ this.hasAttribute("hidden") || o(w, this).forEach((e) => e.element.updateThumbnail());
1035
+ }
1036
+ function Tn(e) {
1037
+ var t;
1038
+ r(E, this, Nn).call(this), (t = o(on, this)) == null || t.setAttribute("channel-id", e.channelId);
1039
+ }
1040
+ function En(e) {
1041
+ let { key: t, ctrlKey: n, altKey: i, metaKey: a } = e;
1042
+ if (!(n || i || a) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") r(E, this, Nn).call(this);
1043
+ else if (t === "Enter" || t === " ") {
1044
+ var s;
1045
+ (s = o(T, this)) == null || s.click();
1046
+ } else r(E, this, Dn).call(this, e);
1047
+ }
1048
+ function Dn(e) {
1049
+ if (!o(T, this)) return;
1050
+ let { key: t } = e, n = o(w, this).findIndex((e) => e.element === o(T, this)), i = o(T, this).getBoundingClientRect();
1051
+ switch (t) {
1052
+ case "ArrowUp":
1053
+ if (n = r(E, this, On).call(this, i, -1, 0), n < 0) {
1054
+ r(E, this, Nn).call(this);
1055
+ return;
1056
+ }
1057
+ break;
1058
+ case "ArrowDown":
1059
+ n = r(E, this, On).call(this, i, 1, 0);
1060
+ break;
1061
+ case "ArrowLeft":
1062
+ n = r(E, this, On).call(this, i, 0, -1);
1063
+ break;
1064
+ case "ArrowRight":
1065
+ n = r(E, this, On).call(this, i, 0, 1);
1066
+ break;
1067
+ case "Home":
1068
+ n = 0;
1069
+ break;
1070
+ case "End":
1071
+ n = o(w, this).length - 1;
1072
+ break;
1073
+ }
1074
+ if (n >= 0 && n < o(w, this).length) {
1075
+ let e = o(w, this)[n];
1076
+ if (!e) return;
1077
+ o(T, this).setAttribute("aria-selected", "false"), o(T, this).tabIndex = -1, m(T, this, e.element), o(T, this).setAttribute("aria-selected", "true"), o(T, this).tabIndex = 0, o(T, this).focus();
1078
+ }
1079
+ }
1080
+ function On(e, t, n) {
1081
+ let r = -1, i = Infinity;
1082
+ return o(w, this).filter((e) => e.element.getBoundingClientRect().width > 0).forEach((a, o) => {
1083
+ let s = a.element.getBoundingClientRect(), c = t === 0 || t < 0 && s.top < e.top || t > 0 && s.top > e.top, l = n === 0 || n < 0 && s.left < e.left || n > 0 && s.left > e.left;
1084
+ if (c && l) {
1085
+ let t = Math.sqrt((s.top - e.top) ** 2 + (s.left - e.left) ** 2);
1086
+ t < i && (i = t, r = o);
1087
+ }
1088
+ }), r;
1089
+ }
1090
+ function kn() {
1091
+ var e, t;
1092
+ if ((e = o(un, this)) != null && e.isConnected) {
1093
+ o(un, this).focus({ preventScroll: !0 });
1094
+ return;
1095
+ }
1096
+ (t = o(on, this)) == null || t.focus({ preventScroll: !0 });
1097
+ }
1098
+ function An(e) {
1099
+ return (e == null ? void 0 : e.localName) === "vindral-scroll-overlay";
1100
+ }
1101
+ function jn() {
1102
+ let e = this.parentElement;
1103
+ return e ? r(E, this, An).call(this, e) ? e.hasAttribute("open") : !this.hasAttribute("hidden") : !1;
1104
+ }
1105
+ function Mn() {
1106
+ if (o(dn, this) && (clearTimeout(o(dn, this)), m(dn, this, void 0)), o(fn, this)) {
1107
+ var e;
1108
+ (e = this.parentElement) == null || e.removeEventListener("scroll", o(fn, this)), m(fn, this, void 0);
1109
+ }
1110
+ }
1111
+ function Nn() {
1112
+ let e = this.parentElement;
1113
+ if (r(E, this, An).call(this, e)) {
1114
+ e.open = !1;
1115
+ return;
1116
+ }
1117
+ e == null || e.removeAttribute("open");
1118
+ }
1119
+ e(pn, "observedAttributes", [
1120
+ h.CHANNELS,
1121
+ h.CHANNEL_ID,
1122
+ h.AUTHENTICATION_TOKEN,
1123
+ "mode",
1124
+ "hidden"
1125
+ ]);
1126
+ //#endregion
1127
+ //#region ../../libs/player-next/src/components/ChannelGridButton.ts
1128
+ var Pn, Fn = "\n<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\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <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\" />\n <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\" />\n <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\" />\n <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\" />\n</svg>\n", In = document.createElement("template");
1129
+ In.innerHTML = `
1130
+ <style>
1131
+ :host {
1132
+ display: var(--grid-button-display);
1133
+ cursor: pointer;
1134
+ flex-shrink: 0.5;
1135
+ color: var(--fg-strong);
1136
+ }
1137
+
1138
+ :host([hidden]) {
1139
+ display: none;
1140
+ }
1141
+ </style>
1142
+ <slot name="button">${Fn}</slot>
1143
+ `;
1144
+ var Ln = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), Rn = /* @__PURE__ */ new WeakMap(), zn = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakSet(), Bn = class extends y {
1145
+ constructor() {
1146
+ var e, t;
1147
+ super(), p(this, O), n(this, Ln, void 0), n(this, D, void 0), n(this, Rn, void 0), n(this, zn, (e) => {
1148
+ e.composedPath().includes(this) || r(O, this, Un).call(this);
1149
+ }), (e = this.shadowRoot) == null || e.appendChild(In.content.cloneNode(!0)), m(Ln, this, (t = this.shadowRoot) == null ? void 0 : t.querySelector("slot[name=button]"));
1150
+ }
1151
+ connectedCallback() {
1152
+ super.connectedCallback(), this.setAttribute("aria-haspopup", "listbox"), this.enable(), r(O, this, Wn).call(this);
1153
+ let e = this.getRootNode();
1154
+ if (e instanceof Document || e instanceof ShadowRoot) {
1155
+ var t;
1156
+ m(D, this, e.querySelector("vindral-channel-grid")), ((t = o(D, this).parentElement) == null ? void 0 : t.localName) === "vindral-scroll-overlay" && (o(D, this).hidden = !1, o(D, this).style.position = "relative", m(Rn, this, o(D, this).parentElement));
1157
+ }
1158
+ r(O, this, Gn).call(this);
1159
+ }
1160
+ disconnectedCallback() {}
1161
+ attributeChangedCallback(e, t, n) {
1162
+ super.attributeChangedCallback(e, t, n), (e === h.CHANNEL_GROUP_ID || e === h.CHANNELS) && r(O, this, Wn).call(this);
1163
+ }
1164
+ enable() {
1165
+ super.enable(), document.addEventListener("click", o(zn, this));
1166
+ }
1167
+ handleClick(e) {
1168
+ r(O, this, Vn).call(this);
1169
+ }
1170
+ get isOpen() {
1171
+ var e;
1172
+ return o(Rn, this) ? o(Rn, this).hasAttribute("open") : !((e = o(D, this)) != null && e.hidden);
1173
+ }
1174
+ };
1175
+ Pn = Bn;
1176
+ function Vn() {
1177
+ if (o(Rn, this)) o(Rn, this).hasAttribute("open") ? r(O, this, Un).call(this) : r(O, this, Hn).call(this);
1178
+ else {
1179
+ var e;
1180
+ (e = o(D, this)) != null && e.hidden ? r(O, this, Hn).call(this) : r(O, this, Un).call(this);
1181
+ }
1182
+ r(O, this, Gn).call(this);
1183
+ }
1184
+ function Hn() {
1185
+ if (o(Rn, this)) o(Rn, this).setAttribute("open", "");
1186
+ else {
1187
+ var e;
1188
+ if (!((e = o(D, this)) != null && e.hidden)) return;
1189
+ o(D, this).hidden = !1, o(D, this).focus();
1190
+ }
1191
+ o(Ln, this).setAttribute("aria-expanded", "true");
1192
+ }
1193
+ function Un() {
1194
+ if (o(Rn, this)) o(Rn, this).open = !1;
1195
+ else {
1196
+ if (!o(D, this) || o(D, this).hidden) return;
1197
+ o(D, this).hidden = !0;
1198
+ }
1199
+ o(Ln, this).setAttribute("aria-expanded", "false");
1200
+ }
1201
+ function Wn() {
1202
+ this.getAttribute(h.CHANNEL_GROUP_ID) ? this.removeAttribute("hidden") : this.setAttribute("hidden", ""), this.hasAttribute(h.CHANNELS) ? this.removeAttribute("disabled") : this.setAttribute("disabled", "");
1203
+ }
1204
+ function Gn() {
1205
+ this.setAttribute("aria-label", this.isOpen ? "Exit grid" : "Enter grid");
1206
+ }
1207
+ e(Bn, "observedAttributes", [
1208
+ ...b(Pn, "observedAttributes", Pn),
1209
+ h.CHANNEL_GROUP_ID,
1210
+ h.CHANNELS,
1211
+ "hidden"
1212
+ ]);
1213
+ //#endregion
1214
+ //#region ../../libs/player-next/src/components/ControlBar.ts
1215
+ var Kn = document.createElement("template");
1216
+ Kn.innerHTML = "\n <style>\n :host {\n display: flex;\n width: 100%;\n align-items: center;\n }\n\n slot {\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n\n :host([content-center]) slot {\n justify-content: center;\n }\n\n slot[name=\"right\"] {\n justify-content: flex-end;\n }\n </style>\n\n <slot name=\"bar\">\n <slot></slot>\n <slot name=\"right\"></slot>\n </slot>\n";
1217
+ var qn = class extends HTMLElement {
1218
+ constructor() {
1219
+ super(), this.attachShadow({ mode: "open" }).appendChild(Kn.content.cloneNode(!0));
1220
+ }
1221
+ connectedCallback() {}
1222
+ disconnectedCallback() {}
1223
+ };
1224
+ e(qn, "observedAttributes", []);
1225
+ //#endregion
1226
+ //#region ../../libs/airplay-sender/src/AirPlaySender.ts
1227
+ var Jn = class extends pe {
1228
+ constructor(t) {
1229
+ super(), e(this, "config", void 0), e(this, "hlsUrl", void 0), e(this, "element", void 0), e(this, "connectingTimeout", void 0), e(this, "castingAvailable", !1), e(this, "updateAuthenticationToken", (e) => {
1230
+ this.config.authenticationToken = e, this.hlsUrl = this.getHlsUrl(), this.castingAvailable && (this.element.src = this.hlsUrl);
1231
+ }), e(this, "unload", () => {
1232
+ this.element && (this.element.removeEventListener("webkitplaybacktargetavailabilitychanged", this.onAirPlayAvailable), this.element.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged", this.onAirPlayPlaybackChanged), this.element.remove());
1233
+ }), e(this, "onAirPlayAvailable", (e) => {
1234
+ switch (e.availability) {
1235
+ case "available":
1236
+ this.castingAvailable = !0, this.element.src !== this.hlsUrl && this.checkHlsUrl(this.hlsUrl).then((e) => {
1237
+ e && (this.element.src = this.hlsUrl, this.emit("available"));
1238
+ });
1239
+ break;
1240
+ case "not-available":
1241
+ this.castingAvailable = !1;
1242
+ break;
1243
+ default: break;
1244
+ }
1245
+ }), e(this, "onAirPlayPlaybackChanged", () => {
1246
+ 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");
1247
+ }), this.config = t, this.hlsUrl = this.getHlsUrl(), 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.slot = "overlay", 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);
1248
+ }
1249
+ get casting() {
1250
+ return this.element.webkitCurrentPlaybackTargetIsWireless;
1251
+ }
1252
+ set channelId(e) {}
1253
+ showPlaybackTargetPicker() {
1254
+ "webkitShowPlaybackTargetPicker" in this.element && this.castingAvailable && (this.element.paused && (this.element.play().catch(ue), this.connectingTimeout = window.setTimeout(() => {
1255
+ this.casting || (this.element.pause(), this.element.src = "", this.element.src = this.hlsUrl);
1256
+ }, 3e4)), this.element.webkitShowPlaybackTargetPicker());
1257
+ }
1258
+ static isAirPlaySupported() {
1259
+ return !!window.WebKitPlaybackTargetAvailabilityEvent;
1260
+ }
1261
+ getHlsUrl() {
1262
+ let e = new URL(`/api/hls?channelId=${this.config.channelId}`, this.config.url);
1263
+ return this.config.authenticationToken && e.searchParams.set("authenticationToken", this.config.authenticationToken), e.toString();
1264
+ }
1265
+ checkHlsUrl(e) {
1266
+ return t(function* () {
1267
+ try {
1268
+ return (yield fetch(e, { method: "HEAD" })).ok;
1269
+ } catch (e) {
1270
+ return !1;
1271
+ }
1272
+ })();
1273
+ }
1274
+ }, Yn = class n extends pe {
1275
+ constructor(r) {
1276
+ var i;
1277
+ super(), i = this, e(this, "container", void 0), e(this, "unload", () => {
1278
+ document.removeEventListener("webkitfullscreenchange", this.onChange), document.removeEventListener("mozfullscreenchange", this.onChange), document.removeEventListener("fullscreenchange", this.onChange), this.container.removeEventListener("webkitendfullscreen", this.onChange);
1279
+ }), e(this, "request", t(function* () {
1280
+ try {
1281
+ yield i.requestFn();
1282
+ } catch (e) {
1283
+ throw i.onChange(), e;
1284
+ }
1285
+ })), e(this, "exit", t(function* () {
1286
+ try {
1287
+ yield i.exitFn();
1288
+ } catch (e) {
1289
+ throw i.onChange(), e;
1290
+ }
1291
+ })), e(this, "onChange", () => this.emit("on fullscreen change", this.isFullscreen())), e(this, "isFullscreen", () => te()), e(this, "isSupported", () => n.isFullscreenApiSupported(this.container) || !this.isInIframe()), e(this, "isFullscreenApiSupported", () => n.isFullscreenApiSupported(this.container)), e(this, "isInIframe", () => window.location !== window.parent.location), this.container = r, document.addEventListener("webkitfullscreenchange", this.onChange), document.addEventListener("mozfullscreenchange", this.onChange), document.addEventListener("fullscreenchange", this.onChange), this.container.addEventListener("webkitendfullscreen", this.onChange);
1292
+ }
1293
+ get requestFn() {
1294
+ var e;
1295
+ return (e = ne(this.container)) == null ? (() => Promise.resolve()) : e;
1296
+ }
1297
+ get exitFn() {
1298
+ if (n.isFullscreenApiSupported(this.container) && this.isFullscreen()) {
1299
+ var e;
1300
+ return (e = d(this.container)) == null ? (() => Promise.resolve()) : e;
1301
+ }
1302
+ return () => Promise.resolve();
1303
+ }
1304
+ };
1305
+ e(Yn, "isFullscreenApiSupported", (e) => se(e));
1306
+ //#endregion
1307
+ //#region ../../libs/player-next/src/PictureInPicture.ts
1308
+ var Xn = /* @__PURE__ */ new WeakMap(), Zn = /* @__PURE__ */ new WeakMap(), Qn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), er = /* @__PURE__ */ new WeakMap(), tr = /* @__PURE__ */ new WeakMap(), nr = /* @__PURE__ */ new WeakMap(), rr = /* @__PURE__ */ new WeakMap(), ir = /* @__PURE__ */ new WeakMap(), ar = class extends pe {
1309
+ constructor(r) {
1310
+ var i;
1311
+ super(), i = this, e(this, "unload", () => {
1312
+ this.element.removeEventListener("enterpictureinpicture", this.onChange), this.element.removeEventListener("leavepictureinpicture", this.onChange), re(this.element, !1);
1313
+ }), e(this, "request", t(function* () {
1314
+ try {
1315
+ return yield o(Xn, i).call(i);
1316
+ } catch (e) {
1317
+ throw i.onChange(), e;
1318
+ }
1319
+ })), e(this, "exit", t(function* () {
1320
+ try {
1321
+ return yield o(Zn, i).call(i);
1322
+ } catch (e) {
1323
+ throw i.onChange(), e;
1324
+ }
1325
+ })), e(this, "onChange", () => {
1326
+ this.emit("on picture in picture change", this.isPictureInPictureActive());
1327
+ }), e(this, "isPictureInPictureActive", () => o(nr, this).call(this) || o(tr, this).call(this)), e(this, "isSupported", () => o(ir, this).call(this) || o(er, this).call(this)), n(this, Xn, () => o(er, this).call(this) ? o(Qn, this).call(this) : o(ir, this).call(this) ? o(rr, this).call(this, "picture-in-picture") : Promise.resolve()), n(this, Zn, () => this.isPictureInPictureActive() ? o(er, this).call(this) ? o($n, this).call(this) : o(ir, this).call(this) ? o(rr, this).call(this, "inline") : Promise.resolve() : Promise.resolve()), n(this, Qn, t(function* () {
1328
+ let e = ae(i.element);
1329
+ e && (yield e());
1330
+ })), n(this, $n, t(function* () {
1331
+ let e = a();
1332
+ e && (yield e());
1333
+ })), n(this, er, () => ee(this.element)), n(this, tr, () => c()), n(this, nr, () => s(this.element) === "picture-in-picture"), n(this, rr, (e) => (u(this.element) && f(this.element, e), Promise.resolve())), n(this, ir, () => u(this.element)), this.element = r, this.element.addEventListener("enterpictureinpicture", this.onChange), this.element.addEventListener("leavepictureinpicture", this.onChange), re(this.element, !0);
1334
+ }
1335
+ get videoElement() {
1336
+ return this.element;
1337
+ }
1338
+ }, or = (e) => {
1339
+ var t;
1340
+ let n = "observedAttributes" in e.constructor ? e.constructor.observedAttributes : void 0;
1341
+ return !n && (t = e.nodeName) != null && t.includes("-") && (globalThis.customElements.upgrade(e), n = "observedAttributes" in e.constructor ? e.constructor.observedAttributes : void 0), Array.isArray(n) ? n.filter((e) => Te.includes(e)) : [];
1342
+ };
1343
+ //#endregion
1344
+ //#region ../../libs/player-next/src/utils/humanReadableTimeToSeconds.ts
1345
+ function sr(e) {
1346
+ if (typeof e != "string") return NaN;
1347
+ let t = [...e.matchAll(/(\d+(?:\.\d+)?)([hms])/gi)];
1348
+ return t.length === 0 ? NaN : t.reduce((e, t) => {
1349
+ var n, r;
1350
+ let i = parseFloat((n = t[1]) == null ? "0" : n);
1351
+ switch (((r = t[2]) == null ? "" : r).toLowerCase()) {
1352
+ case "h": return e + i * 3600;
1353
+ case "m": return e + i * 60;
1354
+ case "s": return e + i;
1355
+ default: return e;
1356
+ }
1357
+ }, 0);
1358
+ }
1359
+ //#endregion
1360
+ //#region ../../libs/player-next/src/VolumeLevel.ts
1361
+ var cr = class extends pe {
1362
+ constructor(t) {
1363
+ if (super(), e(this, "audioContext", void 0), e(this, "audioNode", void 0), e(this, "bufferLength", void 0), e(this, "animationFrameId", null), e(this, "canUseFloatTimeDomainData", void 0), e(this, "byteSampleBuffer", null), e(this, "floatSampleBuffer", null), e(this, "leftAnalyser", void 0), e(this, "rightAnalyser", void 0), e(this, "mediaElementSource", null), e(this, "update", () => {
1364
+ let e = this.getDecibel(this.leftAnalyser, this.floatSampleBuffer || this.byteSampleBuffer), t = this.getDecibel(this.rightAnalyser, this.floatSampleBuffer || this.byteSampleBuffer);
1365
+ this.emit("on decibel change", {
1366
+ left: e,
1367
+ right: t
1368
+ }), this.animationFrameId = requestAnimationFrame(this.update);
1369
+ }), this.source = t, t instanceof HTMLMediaElement) {
1370
+ let e = new AudioContext();
1371
+ this.mediaElementSource = e.createMediaElementSource(t), this.audioNode = e.createChannelSplitter(2), this.mediaElementSource.connect(this.audioNode), this.audioContext = e, this.mediaElementSource.connect(this.audioContext.destination);
1372
+ } else this.audioNode = t, this.audioContext = this.audioNode.context;
1373
+ this.leftAnalyser = this.audioNode.context.createAnalyser(), this.rightAnalyser = this.audioNode.context.createAnalyser(), this.audioNode.connect(this.leftAnalyser, 0), this.audioNode.connect(this.rightAnalyser, 1), this.canUseFloatTimeDomainData = typeof this.leftAnalyser.getFloatTimeDomainData == "function", this.leftAnalyser.fftSize = 1024, this.rightAnalyser.fftSize = 1024, this.bufferLength = this.leftAnalyser.fftSize, this.canUseFloatTimeDomainData ? this.floatSampleBuffer = new Float32Array(this.bufferLength) : this.byteSampleBuffer = new Uint8Array(this.bufferLength);
1374
+ }
1375
+ getDecibel(e, t) {
1376
+ let n = 0;
1377
+ if (t instanceof Float32Array) {
1378
+ e.getFloatTimeDomainData(t);
1379
+ for (let e = 0; e < t.length; e++) {
1380
+ let r = t[e];
1381
+ if (r) {
1382
+ let e = r ** 2;
1383
+ n = Math.max(e, n);
1384
+ }
1385
+ }
1386
+ } else {
1387
+ e.getByteTimeDomainData(t);
1388
+ for (let e = 0; e < t.length; e++) {
1389
+ let r = t[e];
1390
+ if (r) {
1391
+ let e = (r / 128 - 1) ** 2;
1392
+ n = Math.max(e, n);
1393
+ }
1394
+ }
1395
+ }
1396
+ return 10 * Math.log10(n);
1397
+ }
1398
+ start() {
1399
+ this.animationFrameId === null && (this.audioContext instanceof AudioContext && this.audioContext.state === "suspended" ? this.audioContext.resume().then(() => {
1400
+ this.update();
1401
+ }) : this.update());
1402
+ }
1403
+ stop() {
1404
+ this.animationFrameId !== null && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null);
1405
+ }
1406
+ unload() {
1407
+ var e;
1408
+ this.stop(), (e = this.mediaElementSource) == null || e.disconnect(), this.leftAnalyser.disconnect(), this.rightAnalyser.disconnect(), this.audioNode.disconnect();
1409
+ }
1410
+ get isMediaElementSource() {
1411
+ return this.source instanceof HTMLMediaElement;
1412
+ }
1413
+ }, k = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), lr = /* @__PURE__ */ new WeakMap(), ur = /* @__PURE__ */ new WeakMap(), dr = /* @__PURE__ */ new WeakMap(), fr = /* @__PURE__ */ new WeakMap(), pr = /* @__PURE__ */ new WeakMap(), mr = /* @__PURE__ */ new WeakMap(), hr = /* @__PURE__ */ new WeakMap(), gr = /* @__PURE__ */ new WeakMap(), _r = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakSet(), vr = /* @__PURE__ */ new WeakMap(), yr = /* @__PURE__ */ new WeakMap(), br = /* @__PURE__ */ new WeakMap(), xr = /* @__PURE__ */ new WeakMap(), Sr = class {
1414
+ constructor(t, i) {
1415
+ p(this, N), n(this, k, void 0), n(this, A, void 0), n(this, j, void 0), n(this, lr, void 0), n(this, ur, void 0), e(this, "userPaused", !0), n(this, dr, void 0), n(this, fr, void 0), n(this, pr, !1), n(this, mr, !1), n(this, hr, null), n(this, gr, 0), n(this, _r, !1), n(this, M, ie.get().createContext("HlsPlayer")), n(this, vr, () => r(N, this, Fr).call(this, !0)), n(this, yr, () => r(N, this, Fr).call(this, !1)), n(this, br, () => {
1416
+ o(k, this).readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && !o(k, this).paused && r(N, this, Fr).call(this, !1);
1417
+ }), n(this, xr, () => {
1418
+ o(k, this).readyState >= HTMLMediaElement.HAVE_FUTURE_DATA && r(N, this, Fr).call(this, !1);
1419
+ }), m(A, this, t), m(fr, this, i == null ? void 0 : i.maxVideoBitRate), o(A, this).style.position = "absolute", o(A, this).style.top = "0", o(A, this).style.left = "0", o(A, this).style.width = "100%", o(A, this).style.height = "100%", o(A, this).style.opacity = "0", o(A, this).style.pointerEvents = "none", o(A, this).style.transition = "opacity 0.12s linear";
1420
+ let a = document.createElement("video");
1421
+ m(k, this, a), t.appendChild(o(k, this)), o(k, this).style.width = "100%", o(k, this).style.height = "100%", o(k, this).setAttribute("playsinline", ""), o(k, this).setAttribute("webkit-playsinline", ""), o(k, this).setAttribute("preload", "metadata"), r(N, this, Nr).call(this), m(_r, this, o(k, this).muted), (i == null ? void 0 : i.volume) !== void 0 && (this.volume = i.volume), (i == null ? void 0 : i.muted) !== void 0 && (this.muted = i.muted);
1422
+ }
1423
+ hide() {
1424
+ m(pr, this, !0), m(mr, this, !1), o(A, this).classList.remove("active"), o(A, this).style.opacity = "0", o(A, this).style.pointerEvents = "none", m(hr, this, null);
1425
+ }
1426
+ play() {
1427
+ var e = this;
1428
+ return t(function* () {
1429
+ try {
1430
+ return o(j, e) ? (e.userPaused = !1, yield o(k, e).play()) : Promise.reject("HLS not initialized");
1431
+ } catch (t) {
1432
+ o(M, e).error("Failed to play timeshift video:", t);
1433
+ }
1434
+ })();
1435
+ }
1436
+ seek(e) {
1437
+ var n = this;
1438
+ return t(function* () {
1439
+ if (o(M, n).debug("HlsPlayer seek to", e.time), !Number.isFinite(e.time)) {
1440
+ m(hr, n, null);
1441
+ return;
1442
+ }
1443
+ if (m(hr, n, e.time > .1 ? e.time : null), n.isActive() && o(j, n)) r(N, n, Dr).call(n, e.time);
1444
+ else return r(N, n, Or).call(n, e);
1445
+ })();
1446
+ }
1447
+ shouldIgnoreTimeupdate() {
1448
+ if (o(hr, this) == null) return !1;
1449
+ let e = o(k, this).currentTime;
1450
+ return !Number.isFinite(e) || e <= .1 ? !0 : (m(hr, this, null), !1);
1451
+ }
1452
+ isPipSupported() {
1453
+ return "pictureInPictureEnabled" in document && !o(k, this).disablePictureInPicture;
1454
+ }
1455
+ requestPictureInPicture() {
1456
+ return o(k, this).requestPictureInPicture();
1457
+ }
1458
+ exitPictureInPicture() {
1459
+ return document.pictureInPictureElement === o(k, this) ? document.exitPictureInPicture() : Promise.resolve();
1460
+ }
1461
+ isActive() {
1462
+ return o(A, this).style.opacity === "1" || o(A, this).classList.contains("active");
1463
+ }
1464
+ cleanup() {
1465
+ r(N, this, Pr).call(this), r(N, this, Er).call(this), o(dr, this) && (cancelAnimationFrame(o(dr, this)), m(dr, this, void 0)), m(hr, this, null), o(k, this).remove();
1466
+ }
1467
+ addEventListener(e, t) {
1468
+ o(k, this).addEventListener(e, t);
1469
+ }
1470
+ removeEventListener(e, t) {
1471
+ o(k, this).removeEventListener(e, t);
1472
+ }
1473
+ dispatchEvent(e) {
1474
+ return o(k, this).dispatchEvent(e);
1475
+ }
1476
+ setTimeshiftUrl(e) {
1477
+ o(ur, this) !== e && (o(M, this).debug("HLSPlayer Setting timeshift URL to", e), m(ur, this, e));
1478
+ }
1479
+ get videoElement() {
1480
+ return o(k, this);
1481
+ }
1482
+ pause() {
1483
+ this.userPaused = !0, o(k, this).pause();
1484
+ }
1485
+ get paused() {
1486
+ return o(k, this).paused;
1487
+ }
1488
+ set volume(e) {
1489
+ o(k, this).volume = e;
1490
+ }
1491
+ get volume() {
1492
+ return o(k, this).volume;
1493
+ }
1494
+ set muted(e) {
1495
+ m(_r, this, e), o(k, this).muted = e;
1496
+ }
1497
+ get muted() {
1498
+ return o(_r, this);
1499
+ }
1500
+ set currentTime(e) {
1501
+ o(k, this).currentTime = e;
1502
+ }
1503
+ get currentTime() {
1504
+ return o(k, this).currentTime;
1505
+ }
1506
+ get seeking() {
1507
+ return o(k, this).seeking;
1508
+ }
1509
+ get duration() {
1510
+ return o(k, this).duration;
1511
+ }
1512
+ get maxVideoBitRate() {
1513
+ return o(fr, this);
1514
+ }
1515
+ set maxVideoBitRate(e) {
1516
+ m(fr, this, e), e !== void 0 && o(j, this) && r(N, this, wr).call(this, e);
1517
+ }
1518
+ };
1519
+ function Cr() {
1520
+ var e = this;
1521
+ return t(function* () {
1522
+ let { default: t } = yield import("./Dps-VoAh.js");
1523
+ if (m(lr, e, t), !t.isSupported()) {
1524
+ o(M, e).warn("HLS not supported");
1525
+ return;
1526
+ }
1527
+ m(j, e, new t({
1528
+ capLevelToPlayerSize: !0,
1529
+ enableWorker: !0,
1530
+ backBufferLength: 30,
1531
+ maxBufferLength: 10,
1532
+ maxMaxBufferLength: 30,
1533
+ maxBufferSize: 3e7,
1534
+ fragLoadingTimeOut: 2e4,
1535
+ manifestLoadingTimeOut: 1e4,
1536
+ fragLoadingRetryDelay: 1e3,
1537
+ manifestLoadingRetryDelay: 1e3,
1538
+ fragLoadingMaxRetry: 3,
1539
+ manifestLoadingMaxRetry: 3,
1540
+ abrEwmaDefaultEstimate: 2e6,
1541
+ abrBandWidthFactor: .95,
1542
+ abrBandWidthUpFactor: .85,
1543
+ startFragPrefetch: !0,
1544
+ testBandwidth: !1,
1545
+ debug: !1
1546
+ })), o(j, e).attachMedia(o(k, e)), o(j, e).on(t.Events.MEDIA_ATTACHED, () => o(M, e).debug("[HLS] media attached")), o(j, e).on(t.Events.MANIFEST_PARSED, () => o(M, e).debug("[HLS] manifest parsed")), o(j, e).on(t.Events.ERROR, (t, n) => {
1547
+ o(M, e).error("[HLS] error:", n), n.fatal && r(N, e, Tr).call(e, n);
1548
+ }), o(j, e).on(t.Events.MANIFEST_PARSED, () => {
1549
+ var t;
1550
+ !o(fr, e) || ((t = o(j, e)) == null ? void 0 : t.levels.length) === 0 || r(N, e, wr).call(e, o(fr, e));
1551
+ }), o(j, e).on(t.Events.LEVEL_SWITCHED, () => {
1552
+ var t, n;
1553
+ o(M, e).debug("Level switched:", (t = o(j, e)) == null ? void 0 : t.currentLevel, "max:", e.maxVideoBitRate, "autoLevelCapping:", (n = o(j, e)) == null ? void 0 : n.autoLevelCapping);
1554
+ });
1555
+ })();
1556
+ }
1557
+ function wr(e) {
1558
+ if (!o(j, this)) {
1559
+ o(M, this).warn("HLS not initialized, cannot set bitrate cap");
1560
+ return;
1561
+ }
1562
+ let t = o(j, this).levels.map((e, t) => ({
1563
+ i: t,
1564
+ bitrate: e.bitrate
1565
+ })).filter((t) => e >= t.bitrate * .8).map((e) => e.i).pop();
1566
+ if (t === void 0) {
1567
+ var n;
1568
+ t = 0, o(M, this).debug("No level fits under bitrate cap: " + e + ", defaulting to lowest level: " + ((n = o(j, this).levels[0]) == null ? void 0 : n.bitrate));
1569
+ }
1570
+ let r = o(j, this).currentLevel;
1571
+ o(j, this).autoLevelCapping = t, r !== t && (o(M, this).debug(`Current level ${r} exceeds cap ${t}, forcing immediate switch`), o(j, this).currentLevel = t);
1572
+ }
1573
+ function Tr(e) {
1574
+ if (!o(lr, this)) {
1575
+ o(M, this).error("Hls class not available for error handling");
1576
+ return;
1577
+ }
1578
+ let t = o(lr, this);
1579
+ switch (e.type) {
1580
+ case t.ErrorTypes.NETWORK_ERROR:
1581
+ var n;
1582
+ o(M, this).warn("[HLS] network error -> startLoad"), (n = o(j, this)) == null || n.startLoad();
1583
+ break;
1584
+ case t.ErrorTypes.MEDIA_ERROR:
1585
+ var i;
1586
+ o(M, this).warn("[HLS] media error -> recoverMediaError"), (i = o(j, this)) == null || i.recoverMediaError();
1587
+ break;
1588
+ default:
1589
+ o(M, this).error("[HLS] fatal -> destroy"), r(N, this, Er).call(this);
1590
+ break;
1591
+ }
1592
+ }
1593
+ function Er() {
1594
+ o(j, this) && (o(j, this).destroy(), m(j, this, void 0));
1595
+ }
1596
+ function Dr(e) {
1597
+ if (!Number.isFinite(e)) {
1598
+ m(hr, this, null);
1599
+ return;
1600
+ }
1601
+ let t = r(N, this, Mr).call(this, o(k, this), e);
1602
+ m(hr, this, t > .1 ? t : null), o(dr, this) && cancelAnimationFrame(o(dr, this)), m(dr, this, requestAnimationFrame(() => {
1603
+ o(k, this).currentTime = t;
1604
+ }));
1605
+ }
1606
+ function Or(e) {
1607
+ var n = this;
1608
+ return t(function* () {
1609
+ var t;
1610
+ let { time: i, playWhenReady: a = !0 } = e || {}, s = m(gr, n, (t = o(gr, n), ++t));
1611
+ if (!o(ur, n)) {
1612
+ o(M, n).warn("No timeshift URL");
1613
+ return;
1614
+ }
1615
+ if (!o(j, n) && (yield r(N, n, Cr).call(n), !r(N, n, Ir).call(n, s))) return;
1616
+ m(pr, n, !1), m(mr, n, !1), o(j, n) && (!o(j, n).url || o(j, n).url !== o(ur, n)) && (o(M, n).debug("Loading timeshift URL", o(ur, n)), o(j, n).loadSource(o(ur, n)));
1617
+ let c = n.muted;
1618
+ o(k, n).muted = !0, yield r(N, n, kr).call(n), r(N, n, Ir).call(n, s) && (r(N, n, Dr).call(n, i), !(a && (yield n.play(), !r(N, n, Ir).call(n, s))) && r(N, n, Ar).call(n, c, s));
1619
+ })();
1620
+ }
1621
+ function kr() {
1622
+ return o(k, this).duration && !isNaN(o(k, this).duration) ? Promise.resolve() : new Promise((e) => {
1623
+ o(M, this).debug("Waiting for duration...");
1624
+ let t = () => {
1625
+ o(M, this).debug("Duration loaded:", o(k, this).duration), o(k, this).removeEventListener("loadedmetadata", t), clearTimeout(n), e();
1626
+ }, n = setTimeout(() => {
1627
+ o(M, this).debug("Duration timeout, proceeding anyway"), o(k, this).removeEventListener("loadedmetadata", t), e();
1628
+ }, 2e4);
1629
+ o(k, this).addEventListener("loadedmetadata", t);
1630
+ });
1631
+ }
1632
+ function Ar(e, t) {
1633
+ let n = HTMLMediaElement.HAVE_CURRENT_DATA, i = () => o(k, this).readyState >= n && o(k, this).videoWidth > 0 && o(k, this).videoHeight > 0, a = () => {
1634
+ o(pr, this) || o(mr, this) || !r(N, this, Ir).call(this, t) || (m(mr, this, !0), o(M, this).debug("Revealing timeshift video"), o(A, this).classList.add("active"), o(A, this).style.opacity = "1", o(A, this).style.pointerEvents = "auto", o(k, this).dispatchEvent(new CustomEvent("timeshiftready", { detail: { activationId: t } })), e || r(N, this, jr).call(this, t));
1635
+ }, s = () => {
1636
+ o(pr, this) || o(mr, this) || !r(N, this, Ir).call(this, t) || i() && (l(), a());
1637
+ }, c = !1, l = () => {
1638
+ c || (c = !0, o(k, this).removeEventListener("canplay", s), o(k, this).removeEventListener("canplaythrough", s), o(k, this).removeEventListener("loadeddata", s), clearTimeout(u));
1639
+ };
1640
+ if (i()) {
1641
+ a();
1642
+ return;
1643
+ }
1644
+ o(k, this).addEventListener("canplay", s), o(k, this).addEventListener("canplaythrough", s), o(k, this).addEventListener("loadeddata", s);
1645
+ let u = setTimeout(() => {
1646
+ o(M, this).debug("Timeout reached, forcing reveal"), l(), a();
1647
+ }, 2e3);
1648
+ }
1649
+ function jr(e) {
1650
+ let t = () => {
1651
+ r(N, this, Ir).call(this, e) && (o(k, this).muted = !1);
1652
+ };
1653
+ "requestVideoFrameCallback" in o(k, this) ? o(k, this).requestVideoFrameCallback(() => {
1654
+ setTimeout(() => {
1655
+ t();
1656
+ }, 100);
1657
+ }) : setTimeout(() => {
1658
+ t();
1659
+ }, 120);
1660
+ }
1661
+ function Mr(e, t) {
1662
+ let n = e.seekable;
1663
+ if (!n || n.length === 0) return t;
1664
+ let r = n.start(0), i = n.end(n.length - 1);
1665
+ return o(M, this).debug("Clamped seekable:", Math.max(r, Math.min(t, i))), Math.max(r, Math.min(t, i));
1666
+ }
1667
+ function Nr() {
1668
+ for (let e of Lr._) o(k, this).addEventListener(e, o(vr, this));
1669
+ for (let e of Rr._) o(k, this).addEventListener(e, o(yr, this));
1670
+ o(k, this).addEventListener("timeupdate", o(br, this)), o(k, this).addEventListener("progress", o(xr, this));
1671
+ }
1672
+ function Pr() {
1673
+ for (let e of Lr._) o(k, this).removeEventListener(e, o(vr, this));
1674
+ for (let e of Rr._) o(k, this).removeEventListener(e, o(yr, this));
1675
+ o(k, this).removeEventListener("timeupdate", o(br, this)), o(k, this).removeEventListener("progress", o(xr, this));
1676
+ }
1677
+ function Fr(e) {
1678
+ let t = e && (o(k, this).readyState < HTMLMediaElement.HAVE_FUTURE_DATA || o(k, this).seeking || o(k, this).paused && !this.userPaused);
1679
+ o(k, this).dispatchEvent(new CustomEvent(t ? "hlsbuffering" : "hlsnotbuffering", {
1680
+ bubbles: !0,
1681
+ composed: !0
1682
+ }));
1683
+ }
1684
+ function Ir(e) {
1685
+ return o(gr, this) === e;
1686
+ }
1687
+ var Lr = { _: [
1688
+ "waiting",
1689
+ "seeking",
1690
+ "stalled",
1691
+ "loadstart"
1692
+ ] }, Rr = { _: [
1693
+ "canplay",
1694
+ "canplaythrough",
1695
+ "seeked",
1696
+ "loadeddata"
1697
+ ] }, zr = class {
1698
+ constructor(e) {
1699
+ this.vindral = e;
1700
+ }
1701
+ get volume() {
1702
+ return this.vindral.volume;
1703
+ }
1704
+ get muted() {
1705
+ return this.vindral.muted;
1706
+ }
1707
+ play() {
1708
+ var e = this;
1709
+ return t(function* () {
1710
+ var t;
1711
+ return (t = e.vindral) == null || t.play(), Promise.resolve();
1712
+ })();
1713
+ }
1714
+ pause() {
1715
+ this.vindral.pause();
1716
+ }
1717
+ }, Br = document.createElement("template");
1718
+ Br.innerHTML = "\n <style>\n :host {\n --value: 0;\n --range-thickness: var(--vindral-range-thickness, 4px);\n --range-hover-thickness: var(--vindral-range-hover-thickness, var(--range-thickness));\n --range-thumb-size: var(--vindral-range-thumb-size, 12px);\n --range-thumb-hover-size: var(--vindral-range-thumb-hover-size, var(--range-thumb-size));\n --range-fill-color: var(--vindral-range-fill-color, var(--fg-strong));\n --range-thumb-color: var(--vindral-range-thumb-color, var(--fg-strong));\n --_focus-box-shadow: none;\n height: calc(var(--button-icon-size) + 2 * var(--button-padding));\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 !important;\n margin: 0;\n position: relative;\n cursor: pointer;\n touch-action: none;\n box-shadow: var(--_focus-visible-box-shadow, none);\n outline: 0;\n background: transparent;\n }\n\n :host > * {\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n transition-duration: 0.1s;\n }\n\n #range {\n -webkit-appearance: none;\n appearance: none;\n\n height: var(--range-thickness);\n width: 100%;\n margin: 0;\n padding: 0;\n\n background-color: #00000000;\n outline: none;\n z-index: 1;\n cursor: pointer;\n transition-property: height;\n }\n\n #range-track {\n position: absolute;\n top: calc(50% - calc(var(--range-thickness) / 2));\n left: 1px;\n width: calc(100% - 2px);\n height: var(--range-thickness);\n background-color: rgb(255 255 255 / 0.2);\n overflow: hidden;\n cursor: pointer;\n transition-property: height, top;\n }\n\n @media (hover: hover) and (pointer: fine) {\n :host(:hover) #range {\n height: var(--range-hover-thickness);\n }\n\n :host(:hover) #range-track {\n height: var(--range-hover-thickness);\n top: calc(50% - calc(var(--range-hover-thickness) / 2));\n }\n }\n\n #range-track::before {\n position: absolute;\n content: \"\";\n left: calc(-100%);\n top: 0;\n width: calc(100%);\n height: 100%;\n background: var(--range-fill-color);\n transition: background-color 300ms ease-out;\n transform-origin: 100% 0%;\n transform: translateX(calc(var(--value) * 100%)) scaleX(1.2);\n }\n\n #range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: var(--range-thumb-size);\n height: var(--range-thumb-size);\n border-radius: 50%;\n background: var(--range-thumb-color);\n cursor: pointer;\n z-index: 1;\n transition-property: width, height;\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n transition-duration: 0.1s;\n }\n\n #range::-moz-range-thumb {\n -moz-appearance: none;\n appearance: none;\n width: var(--range-thumb-size);\n height: var(--range-thumb-size);\n border-radius: 50%;\n background: var(--range-thumb-color);\n cursor: pointer;\n z-index: 1;\n border: none;\n transition-property: width, height;\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n transition-duration: 0.1s;\n }\n\n :host:has(#range:focus-visible) {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n }\n\n @media (hover: hover) and (pointer: fine) {\n :host(:hover) #range::-webkit-slider-thumb {\n width: var(--range-thumb-hover-size);\n height: var(--range-thumb-hover-size);\n }\n\n :host(:hover) #range::-moz-range-thumb {\n width: var(--range-thumb-hover-size);\n height: var(--range-thumb-hover-size);\n }\n }\n </style>\n\n <input type=\"range\" id=\"range\" min=\"0\" max=\"1\" step=\"any\" value=\"0\" />\n <div id=\"range-track\"></div>\n";
1719
+ var Vr = /* @__PURE__ */ new WeakMap(), Hr = /* @__PURE__ */ new WeakMap(), Ur = class extends HTMLElement {
1720
+ constructor() {
1721
+ super(), n(this, Vr, null), n(this, Hr, void 0), e(this, "range", void 0), m(Hr, this, this.attachShadow({ mode: "open" })), o(Hr, this).appendChild(Br.content.cloneNode(!0)), this.range = o(Hr, this).getElementById("range");
1722
+ }
1723
+ connectedCallback() {
1724
+ var e;
1725
+ m(Vr, this, this.closest("vindral-controller")), (e = o(Vr, this)) == null || e.connectListener(this), this.hasAttribute("disabled") || this.enable();
1726
+ }
1727
+ disconnectedCallback() {
1728
+ var e;
1729
+ (e = o(Vr, this)) == null || e.disconnectListener(this);
1730
+ }
1731
+ attributeChangedCallback(e, t, n) {
1732
+ t !== n && (e === "disabled" && n ? this.disable() : this.enable(), this.updateBar());
1733
+ }
1734
+ enable() {
1735
+ this.addEventListener("input", this);
1736
+ }
1737
+ disable() {
1738
+ this.range.removeEventListener("input", this);
1739
+ }
1740
+ handleEvent(e) {
1741
+ e.type === "input" && this.updateBar();
1742
+ }
1743
+ updateBar() {
1744
+ this.style.setProperty("--value", this.range.value);
1745
+ }
1746
+ get keysUsed() {
1747
+ return [
1748
+ "ArrowUp",
1749
+ "ArrowRight",
1750
+ "ArrowDown",
1751
+ "ArrowLeft"
1752
+ ];
1753
+ }
1754
+ };
1755
+ e(Ur, "observedAttributes", ["disabled"]);
1756
+ //#endregion
1757
+ //#region ../../libs/player-next/src/components/Controller.ts
1758
+ var Wr = document.createElement("template");
1759
+ Wr.innerHTML = `
1760
+ <style>
1761
+ :host {
1762
+ --fg-strong: var(--vindral-fg-strong, #eeeeee);
1763
+ --fg-subtle: var(--vindral-fg-subtle, #b4b4b4);
1764
+ --fg-extra-subtle: var(--vindral-fg-extra-subtle, #7b7b7b);
1765
+ --bg-strong: var(--vindral-bg-strong, #111111);
1766
+ --bg-subtle: var(--vindral-bg-subtle, #191919);
1767
+ --bg-extra-subtle: var(--vindral-bg-extra-subtle, #222222);
1768
+ --bg-component: var(--vindral-bg-component, #222222);
1769
+ --bg-component-hover: var(--vindral-bg-component-hover, #2a2a2a);
1770
+ --bg-component-active: var(--vindral-bg-component-active, #313131);
1771
+
1772
+ --padding-1: var(--vindral-padding-1, 4px);
1773
+ --padding-2: var(--vindral-padding-2, 8px);
1774
+ --padding-3: var(--vindral-padding-3, 16px);
1775
+ --padding-4: var(--vindral-padding-4, 24px);
1776
+ --padding-5: var(--vindral-padding-5, 32px);
1777
+ --padding-6: var(--vindral-padding-6, 40px);
1778
+ --control-padding: var(--vindral-control-padding, var(--padding-1));
1779
+
1780
+ --ui-font: var(
1781
+ --vindral-ui-font,
1782
+ -apple-system,
1783
+ BlinkMacSystemFont,
1784
+ "Segoe UI",
1785
+ Roboto,
1786
+ "Helvetica Neue",
1787
+ Arial,
1788
+ sans-serif
1789
+ );
1790
+
1791
+ --button-padding: var(--vindral-button-padding, var(--padding-2));
1792
+ --button-icon-size: var(--vindral-button-icon-size, 24px);
1793
+ --play-overlay-icon-size: var(--vindral-play-overlay-icon-size, 72px);
1794
+
1795
+ --ui-display: var(--vindral-ui-display, flex);
1796
+ --play-button-display: var(--vindral-play-button-display, flex);
1797
+ --mute-button-display: var(--vindral-mute-button-display, flex);
1798
+ --airplay-button-display: var(--vindral-airplay-button-display, flex);
1799
+ --pip-button-display: var(--vindral-pip-button-display, flex);
1800
+ --fullscreen-button-display: var(--vindral-fullscreen-button-display, flex);
1801
+ --cast-button-display: var(--vindral-cast-button-display, flex);
1802
+ --grid-button-display: var(--vindral-grid-button-display, flex);
1803
+ --grid-item-offline-display: var(--vindral-grid-item-offline-display, flex);
1804
+ --volume-range-display: var(--vindral-volume-range-display, flex);
1805
+ --volume-meter-display: var(--vindral-volume-meter-display, flex);
1806
+ --rendition-menu-display: var(--vindral-rendition-menu-display, flex);
1807
+ --language-menu-display: var(--vindral-language-menu-display, flex);
1808
+ --play-overlay-display: var(--vindral-play-overlay-display, flex);
1809
+ --buffering-overlay-display: var(--vindral-buffering-overlay-display, flex);
1810
+ --poster-overlay-display: var(--vindral-poster-overlay-display, flex);
1811
+ --live-button-display: var(--vindral-live-button-display, flex);
1812
+ --seek-bar-display: var(--vindral-seek-bar-display, flex);
1813
+
1814
+ position: relative;
1815
+ display: flex;
1816
+ background-color: var(--bg-strong);
1817
+ width: 100%;
1818
+ container-type: inline-size;
1819
+ overflow: hidden;
1820
+ font-family: var(--ui-font);
1821
+ }
1822
+
1823
+ #ui {
1824
+ position: absolute;
1825
+ display: flex;
1826
+ justify-content: space-between;
1827
+ flex-direction: column;
1828
+ top: 0;
1829
+ bottom: 0;
1830
+ left: 0;
1831
+ right: 0;
1832
+ transition: opacity 0.5s;
1833
+ user-select: none;
1834
+ pointer-events: none;
1835
+ }
1836
+
1837
+ #ui > * {
1838
+ display: var(--ui-display);
1839
+ }
1840
+
1841
+ #ui > slot::slotted(*) {
1842
+ pointer-events: auto;
1843
+ z-index: 10;
1844
+ box-sizing: border-box;
1845
+ padding: var(--control-padding);
1846
+ // Ensure the #ui element is above the video element on Safari
1847
+ // and that we can layer things under, between, and above ui and video
1848
+ }
1849
+
1850
+ #video {
1851
+ cursor: none;
1852
+ display: flex;
1853
+ width: 100%;
1854
+ z-index: 0;
1855
+ }
1856
+
1857
+ #video video::-webkit-media-text-track-display {
1858
+ transform: translateY(var(--vindral-subtitle-offset, 0px)) !important;
1859
+ }
1860
+
1861
+ #video video::cue {
1862
+ font-size: 28px;
1863
+ background-color: rgba(0, 0, 0, 0.6);
1864
+ }
1865
+
1866
+ :host([user-interacting]) #video {
1867
+ cursor: auto;
1868
+ }
1869
+
1870
+ #video > canvas {
1871
+ object-fit: contain;
1872
+ }
1873
+
1874
+ slot#middle {
1875
+ align-items: center;
1876
+ justify-content: center;
1877
+ flex-grow: 1;
1878
+ }
1879
+
1880
+ #top-bar::slotted(vindral-control-bar) {
1881
+ background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
1882
+ }
1883
+
1884
+ #bottom-bar::slotted(vindral-control-bar) {
1885
+ background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
1886
+ }
1887
+
1888
+ slot#bottom-bar {
1889
+ flex-direction: column;
1890
+ }
1891
+
1892
+ :host(:focus-visible) {
1893
+ outline: none;
1894
+ }
1895
+
1896
+ :host(
1897
+ :not([${h.USER_INTERACTING}]
1898
+ ):not([${h.PAUSED}]:not([${h.HIDE_UI_ON_PAUSE}])
1899
+ ):not([${h.IS_CASTING}]
1900
+ ):not([${h.MEDIA}="audio"])
1901
+ )
1902
+ #ui {
1903
+ opacity: 0;
1904
+ cursor: none;
1905
+ pointer-events: none;
1906
+ }
1907
+
1908
+ :host(
1909
+ :not([${h.USER_INTERACTING}]
1910
+ ):not([${h.PAUSED}]:not([${h.HIDE_UI_ON_PAUSE}])
1911
+ ):not([${h.IS_CASTING}]
1912
+ ):not([${h.MEDIA}="audio"])
1913
+ )
1914
+ #ui > * {
1915
+ pointer-events: none;
1916
+ }
1917
+
1918
+ :host([${h.FULLSCREEN}][${h.FULLSCREEN_FALLBACK}]) {
1919
+ position: fixed !important;
1920
+ inset: 0 !important;
1921
+ margin: 0 !important;
1922
+ box-sizing: border-box !important;
1923
+ min-width: 0 !important;
1924
+ max-width: none !important;
1925
+ min-height: 0 !important;
1926
+ max-height: none !important;
1927
+ width: 100% !important;
1928
+ height: 100% !important;
1929
+ transform: none !important;
1930
+ z-index: 1000 !important;
1931
+ background: black;
1932
+ top: 0;
1933
+ left: 0;
1934
+ right: 0;
1935
+ bottom: 0;
1936
+
1937
+ /* intentionally not !important */
1938
+ object-fit: contain;
1939
+ }
1940
+
1941
+ :host([${h.MEDIA}="audio"]) {
1942
+ min-height: 100px;
1943
+ overflow: visible;
1944
+ }
1945
+ </style>
1946
+
1947
+ <div id="video"></div>
1948
+ <div id="time-shift-video"></div>
1949
+
1950
+ <slot id="overlay" name="overlay"></slot>
1951
+
1952
+ <div id="ui">
1953
+ <slot id="top-bar" name="top-bar"></slot>
1954
+ <slot id="middle" name="middle"></slot>
1955
+ <slot id="bottom-bar"></slot>
1956
+ <slot id="overlay-interactive" name="overlay-interactive"></slot>
1957
+ </div>
1958
+ `;
1959
+ var Gr = [
1960
+ "ArrowDown",
1961
+ "ArrowLeft",
1962
+ "ArrowRight",
1963
+ "Tab",
1964
+ "Enter",
1965
+ " ",
1966
+ "f",
1967
+ "m"
1968
+ ], Kr = /* @__PURE__ */ new WeakMap(), qr = /* @__PURE__ */ new WeakMap(), Jr = /* @__PURE__ */ new WeakMap(), Yr = /* @__PURE__ */ new WeakMap(), Xr = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Zr = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), Qr = /* @__PURE__ */ new WeakMap(), $r = /* @__PURE__ */ new WeakMap(), ei = /* @__PURE__ */ new WeakMap(), ti = /* @__PURE__ */ new WeakMap(), ni = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), ri = /* @__PURE__ */ new WeakMap(), ii = /* @__PURE__ */ new WeakMap(), ai = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), oi = /* @__PURE__ */ new WeakMap(), si = /* @__PURE__ */ new WeakMap(), ci = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), li = /* @__PURE__ */ new WeakMap(), ui = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakSet(), di = /* @__PURE__ */ new WeakMap(), fi = /* @__PURE__ */ new WeakMap(), pi = /* @__PURE__ */ new WeakMap(), mi = /* @__PURE__ */ new WeakMap(), hi = /* @__PURE__ */ new WeakMap(), gi = /* @__PURE__ */ new WeakMap(), _i = /* @__PURE__ */ new WeakMap(), vi = /* @__PURE__ */ new WeakMap(), yi = /* @__PURE__ */ new WeakMap(), bi = /* @__PURE__ */ new WeakMap(), xi = /* @__PURE__ */ new WeakMap(), Si = /* @__PURE__ */ new WeakMap(), Ci = /* @__PURE__ */ new WeakMap(), wi = /* @__PURE__ */ new WeakMap(), Ti = /* @__PURE__ */ new WeakMap(), Ei = /* @__PURE__ */ new WeakMap(), Di = /* @__PURE__ */ new WeakMap(), Oi = /* @__PURE__ */ new WeakMap(), ki = /* @__PURE__ */ new WeakMap(), Ai = /* @__PURE__ */ new WeakMap(), ji = /* @__PURE__ */ new WeakMap(), Mi = /* @__PURE__ */ new WeakMap(), Ni = /* @__PURE__ */ new WeakMap(), Pi = /* @__PURE__ */ new WeakMap(), Fi = /* @__PURE__ */ new WeakMap(), Ii = /* @__PURE__ */ new WeakMap(), Li = /* @__PURE__ */ new WeakMap(), Ri = /* @__PURE__ */ new WeakMap(), zi = /* @__PURE__ */ new WeakMap(), Bi = /* @__PURE__ */ new WeakMap(), Vi = /* @__PURE__ */ new WeakMap(), Hi = class extends HTMLElement {
1969
+ constructor() {
1970
+ var t;
1971
+ super(), p(this, B), n(this, Kr, /* @__PURE__ */ new Map()), n(this, qr, 2e3), n(this, Jr, null), n(this, Yr, null), n(this, Xr, void 0), n(this, P, void 0), n(this, F, void 0), n(this, Zr, void 0), n(this, I, void 0), n(this, Qr, xa._), n(this, $r, void 0), n(this, ei, void 0), n(this, ti, void 0), n(this, ni, void 0), n(this, L, void 0), n(this, ri, void 0), n(this, ii, void 0), n(this, ai, void 0), n(this, R, void 0), n(this, oi, void 0), n(this, si, void 0), n(this, ci, void 0), n(this, z, void 0), n(this, li, null), n(this, ui, !1), n(this, di, (e) => {
1972
+ let t = e.filter((e) => {
1973
+ var t;
1974
+ return (t = e.video) == null ? void 0 : t.width;
1975
+ });
1976
+ r(B, this, V).call(this, h.RENDITION_LEVELS, JSON.stringify(t));
1977
+ }), n(this, fi, (e) => {
1978
+ r(B, this, V).call(this, h.RENDITION_LEVEL, JSON.stringify(e));
1979
+ }), n(this, pi, (e) => {
1980
+ switch (e) {
1981
+ case "playing":
1982
+ r(B, this, H).call(this, h.PAUSED), r(B, this, H).call(this, h.BUFFERING);
1983
+ break;
1984
+ case "paused":
1985
+ r(B, this, V).call(this, h.PAUSED, ""), r(B, this, H).call(this, h.BUFFERING);
1986
+ break;
1987
+ case "buffering":
1988
+ r(B, this, H).call(this, h.PAUSED), r(B, this, V).call(this, h.BUFFERING, "");
1989
+ break;
1990
+ default: break;
1991
+ }
1992
+ }), n(this, mi, (e) => {
1993
+ r(B, this, V).call(this, h.VOLUME, e.volume.toString()), e.isMuted ? r(B, this, V).call(this, h.MUTED, "") : r(B, this, H).call(this, h.MUTED);
1994
+ }), n(this, hi, ({ channelId: e }) => {
1995
+ var t;
1996
+ this.setAttribute(h.CHANNEL_ID, e), ((t = o(P, this)) == null ? void 0 : t.playbackState) !== "buffering" && r(B, this, H).call(this, h.BUFFERING);
1997
+ }), n(this, gi, ({ channelId: e }) => {
1998
+ var t;
1999
+ o($r, this) !== e && this.setAttribute(h.CHANNEL_ID, e), ((t = o(P, this)) == null ? void 0 : t.playbackState) !== "buffering" && r(B, this, H).call(this, h.BUFFERING);
2000
+ }), n(this, _i, (e) => {
2001
+ m(zi, this, Date.now()), r(B, this, V).call(this, h.CHANNELS, JSON.stringify(e));
2002
+ }), n(this, vi, (e) => {
2003
+ var t;
2004
+ r(B, this, V).call(this, h.LANGUAGES, JSON.stringify(e)), (t = o(P, this)) != null && t.language && r(B, this, V).call(this, h.LANGUAGE, o(P, this).language);
2005
+ }), n(this, yi, (e) => {
2006
+ var t;
2007
+ if (r(B, this, V).call(this, h.TEXT_TRACKS, JSON.stringify(e)), (t = o(P, this)) != null && t.textTrack) {
2008
+ var n, i;
2009
+ r(B, this, V).call(this, h.TEXT_TRACK, (n = (i = o(P, this)) == null ? void 0 : i.textTrack) == null ? "" : n);
2010
+ }
2011
+ }), n(this, bi, (e) => {
2012
+ e != null && e.forVideo ? (r(B, this, V).call(this, h.NEEDS_USER_INPUT_VIDEO, ""), r(B, this, H).call(this, h.NEEDS_USER_INPUT_AUDIO)) : e != null && e.forAudio && (r(B, this, V).call(this, h.NEEDS_USER_INPUT_AUDIO, ""), r(B, this, H).call(this, h.NEEDS_USER_INPUT_VIDEO));
2013
+ }), n(this, xi, (e) => {
2014
+ e || r(B, this, H).call(this, h.BUFFERING);
2015
+ }), n(this, Si, (e) => {
2016
+ var t;
2017
+ let { urls: n, duration: i } = e;
2018
+ if (!n[0] || !o(I, this)) return;
2019
+ let a = new URL(n[0]);
2020
+ a.searchParams.set("channelId", (t = o($r, this)) == null ? "" : t);
2021
+ let s = this.getAttribute("authentication-token");
2022
+ s && a.searchParams.set("authToken", s);
2023
+ let c = sr(i);
2024
+ if (isNaN(c)) {
2025
+ o(z, this).error(`Invalid duration format: ${i}`);
2026
+ return;
2027
+ }
2028
+ let l = Math.floor(Date.now() / 1e3), u = (/* @__PURE__ */ new Date((l - c) * 1e3)).toISOString();
2029
+ a.searchParams.set("from", u), o(I, this).setTimeshiftUrl(a.toString()), r(B, this, V).call(this, h.DURATION, c.toString());
2030
+ }), n(this, Ci, () => {
2031
+ r(B, this, H).call(this, h.PAUSED), r(B, this, H).call(this, h.BUFFERING);
2032
+ }), n(this, wi, () => {
2033
+ r(B, this, V).call(this, h.PAUSED, ""), r(B, this, H).call(this, h.BUFFERING);
2034
+ }), n(this, Ti, () => {
2035
+ o(Ii, this).call(this), r(B, this, H).call(this, h.BUFFERING);
2036
+ }), n(this, Ei, () => {
2037
+ if (!o(I, this)) return;
2038
+ let e = o(I, this).duration;
2039
+ r(B, this, V).call(this, h.DURATION, isNaN(e) ? "0" : e.toString());
2040
+ }), n(this, Di, () => {
2041
+ var e, t;
2042
+ if (!o(I, this) || o(I, this).seeking || (e = (t = o(I, this)).shouldIgnoreTimeupdate) != null && e.call(t)) return;
2043
+ let n = o(I, this).currentTime;
2044
+ n != null && r(B, this, V).call(this, h.TIMESHIFT_POSITION, n.toString());
2045
+ }), n(this, Oi, () => {
2046
+ o(I, this) && (r(B, this, V).call(this, h.VOLUME, o(I, this).volume.toString()), o(I, this).muted ? r(B, this, V).call(this, h.MUTED, "") : r(B, this, H).call(this, h.MUTED));
2047
+ }), n(this, ki, () => {
2048
+ r(B, this, V).call(this, h.BUFFERING, "");
2049
+ }), n(this, Ai, () => {
2050
+ r(B, this, H).call(this, h.BUFFERING);
2051
+ }), n(this, ji, () => {
2052
+ if (o(ui, this)) {
2053
+ if (o(F, this) !== o(I, this)) {
2054
+ m(ui, this, !1);
2055
+ return;
2056
+ }
2057
+ m(ui, this, !1), r(B, this, ga).call(this);
2058
+ }
2059
+ }), n(this, Mi, 0), e(this, "handleEvent", (e) => {
2060
+ switch (e.type) {
2061
+ case "pointerdown":
2062
+ m(Mi, this, e.timeStamp);
2063
+ break;
2064
+ case "pointermove":
2065
+ r(B, this, oa).call(this, e);
2066
+ break;
2067
+ case "pointerup":
2068
+ r(B, this, sa).call(this, e);
2069
+ break;
2070
+ case "mouseleave":
2071
+ r(B, this, ma).call(this);
2072
+ break;
2073
+ case "dblclick":
2074
+ r(B, this, ca).call(this, e);
2075
+ break;
2076
+ case "mousemove":
2077
+ r(B, this, la).call(this, e);
2078
+ break;
2079
+ case "keydown":
2080
+ o(Fi, this).call(this, e);
2081
+ break;
2082
+ case "keyup":
2083
+ r(B, this, ma).call(this), o(Pi, this).call(this, e);
2084
+ break;
2085
+ }
2086
+ }), n(this, Ni, (e) => {
2087
+ if (o(P, this) && (o(z, this).debug("Vindral event", { type: e.type }), e instanceof CustomEvent)) switch (e.type) {
2088
+ case g.PLAY:
2089
+ this.removeAttribute(h.PAUSED);
2090
+ break;
2091
+ case g.PAUSE:
2092
+ this.setAttribute(h.PAUSED, "");
2093
+ break;
2094
+ case g.MUTE:
2095
+ this.setAttribute(h.MUTED, "");
2096
+ break;
2097
+ case g.UNMUTE:
2098
+ this.removeAttribute(h.MUTED);
2099
+ break;
2100
+ case g.LOCK_UI:
2101
+ this.setAttribute(h.UI_LOCKED, "");
2102
+ break;
2103
+ case g.UNLOCK_UI:
2104
+ this.removeAttribute(h.UI_LOCKED);
2105
+ break;
2106
+ case g.ENTER_FULLSCREEN:
2107
+ this.setAttribute(h.FULLSCREEN, "");
2108
+ break;
2109
+ case g.EXIT_FULLSCREEN:
2110
+ this.removeAttribute(h.FULLSCREEN);
2111
+ break;
2112
+ case g.SET_RENDITION:
2113
+ {
2114
+ let t = e.detail;
2115
+ t.audio && (o(P, this).maxAudioBitRate = t.audio.bitRate), t.video && (o(P, this).maxVideoBitRate = t.video.bitRate, o(P, this).maxSize = t.video, this.setAttribute(h.MAX_VIDEO_BITRATE, String(t.video.bitRate)));
2116
+ }
2117
+ break;
2118
+ case g.SET_ABR_MODE:
2119
+ {
2120
+ let t = e.detail;
2121
+ this.setAttribute(h.ABR_ENABLED, t ? "true" : "false");
2122
+ }
2123
+ break;
2124
+ case g.SET_SIZE_BASED_RESOLUTION_CAP_MODE:
2125
+ {
2126
+ let t = e.detail;
2127
+ this.setAttribute(h.SIZE_BASED_RESOLUTION_CAP_ENABLED, t ? "true" : "false");
2128
+ }
2129
+ break;
2130
+ case g.CHANNEL_GRID_OPENED:
2131
+ o(li, this) === null && r(B, this, da).call(this);
2132
+ break;
2133
+ case g.CHANNEL_GRID_CLOSED:
2134
+ o(li, this) !== null && (clearTimeout(o(li, this)), m(li, this, null));
2135
+ break;
2136
+ case g.ENTER_PIP:
2137
+ this.setAttribute(h.IS_PIP, "");
2138
+ break;
2139
+ case g.EXIT_PIP:
2140
+ this.removeAttribute(h.IS_PIP);
2141
+ break;
2142
+ case g.REQUEST_AIRPLAY:
2143
+ var t;
2144
+ (t = o(ai, this)) == null || t.showPlaybackTargetPicker();
2145
+ break;
2146
+ case g.SET_LANGUAGE:
2147
+ _(e.detail) ? this.setAttribute(h.LANGUAGE, e.detail) : this.removeAttribute(h.LANGUAGE);
2148
+ break;
2149
+ case g.SET_TEXT_TRACK:
2150
+ _(e.detail) ? this.setAttribute(h.TEXT_TRACK, e.detail) : this.removeAttribute(h.TEXT_TRACK);
2151
+ break;
2152
+ case g.REQUEST_USER_INPUT:
2153
+ o(P, this).play(), o(P, this).muted = !1;
2154
+ break;
2155
+ case g.SET_VOLUME:
2156
+ {
2157
+ let t = e.detail;
2158
+ o(P, this).muted && t > 0 ? (o(P, this).muted = !1, o(I, this) && (o(I, this).muted = !1)) : t === 0 && (o(P, this).muted = !0, o(I, this) && (o(I, this).muted = !0)), this.setAttribute(h.VOLUME, t.toString());
2159
+ }
2160
+ break;
2161
+ case g.SEEK:
2162
+ this.handleTimeShiftUpdate(String(e.detail));
2163
+ break;
2164
+ case g.GO_LIVE:
2165
+ o(Ii, this).call(this);
2166
+ break;
2167
+ }
2168
+ }), n(this, Pi, (e) => {
2169
+ let { key: t } = e;
2170
+ if (!Gr.includes(t)) {
2171
+ this.removeEventListener("keyup", this);
2172
+ return;
2173
+ }
2174
+ r(B, this, ua).call(this, e);
2175
+ }), n(this, Fi, (e) => {
2176
+ let { metaKey: t, altKey: n, key: r } = e;
2177
+ t || n || !Gr.includes(r) || this.addEventListener("keyup", this, { once: !0 });
2178
+ }), n(this, Ii, () => {
2179
+ this.removeAttribute(h.TIMESHIFT_POSITION), this.handleTimeShiftUpdate(!1);
2180
+ }), n(this, Li, (e) => {
2181
+ var t;
2182
+ o(I, this) || r(B, this, qi).call(this), o(F, this) !== o(I, this) && (e && r(B, this, _a).call(this), m(F, this, o(I, this)), r(B, this, Gi).call(this), r(B, this, Ki).call(this), r(B, this, Zi).call(this), (t = o(P, this)) == null || t.pause(), m(ui, this, e));
2183
+ }), n(this, Ri, (e) => {
2184
+ var t, n, i, a;
2185
+ e && r(B, this, _a).call(this), (t = o(I, this)) == null || t.hide(), m(F, this, o(Zr, this)), r(B, this, Zi).call(this), this.hasAttribute(h.PAUSED) ? (n = o(F, this)) == null || n.pause() : (i = o(F, this)) == null || i.play(), r(B, this, Yi).call(this), r(B, this, Wi).call(this), (a = o(I, this)) == null || a.pause(), e && (m(ui, this, !1), setTimeout(() => {
2186
+ r(B, this, ga).call(this);
2187
+ }, 100));
2188
+ }), e(this, "handleTimeShiftUpdate", (e) => {
2189
+ let t = this.hasAttribute(h.IS_PIP);
2190
+ if (e !== !1) {
2191
+ var n;
2192
+ o(Li, this).call(this, t), (n = o(I, this)) == null || n.seek({
2193
+ time: parseFloat(e),
2194
+ playWhenReady: !this.hasAttribute(h.PAUSED)
2195
+ });
2196
+ return;
2197
+ }
2198
+ o(F, this) !== o(Zr, this) && o(Ri, this).call(this, t);
2199
+ }), n(this, zi, null), n(this, Bi, () => {
2200
+ var e;
2201
+ let t = (e = o(P, this)) == null ? void 0 : e.currentRenditionLevel;
2202
+ if (!(t != null && t.video)) return;
2203
+ let n = l(t.video.width > t.video.height ? "landscape-primary" : "portrait-primary");
2204
+ n && n.catch(() => {});
2205
+ }), n(this, Vi, () => {
2206
+ i();
2207
+ }), this.attachShadow({ mode: "open" }).appendChild(Wr.content.cloneNode(!0));
2208
+ let a = De(this.getAttribute("log-level"));
2209
+ m(z, this, ie.get().createContext("VindralController")), o(z, this).setLevel(a), m(Xr, this, (t = this.shadowRoot) == null ? void 0 : t.querySelector("#time-shift-video"));
2210
+ }
2211
+ connectedCallback() {
2212
+ var e = this;
2213
+ return t(function* () {
2214
+ v(e.getAttribute("auto-instance-enabled"), !0) && (yield r(B, e, Ui).call(e));
2215
+ for (let t of Object.values(g)) e.addEventListener(t, o(Ni, e));
2216
+ window.PointerEvent ? (e.addEventListener("pointerdown", e), e.addEventListener("pointermove", e), e.addEventListener("pointerup", e)) : e.addEventListener("mousemove", e), e.addEventListener("mouseleave", e), e.addEventListener("keydown", e), e.addEventListener("resize", e), e.addEventListener("dblclick", e), e.connectListener(e), e.tabIndex = 0, e.focus({ preventScroll: !0 });
2217
+ })();
2218
+ }
2219
+ disconnectedCallback() {
2220
+ var e, t, n, i, a;
2221
+ (e = o(P, this)) == null || e.unload(), (t = o(L, this)) == null || t.unload(), (n = o(ri, this)) == null || n.unload(), (i = o(ii, this)) == null || i.unload(), (a = o(R, this)) == null || a.unload(), r(B, this, Ji).call(this);
2222
+ for (let e of Object.values(g)) this.removeEventListener(e, o(Ni, this));
2223
+ r(B, this, Gi).call(this), o(Jr, this) && (clearTimeout(o(Jr, this)), m(Jr, this, null)), this.disconnectListener(this);
2224
+ }
2225
+ attributeChangedCallback(e, t, n) {
2226
+ if (t != n) {
2227
+ switch (o(z, this).debug("Attribute changed", {
2228
+ name: e,
2229
+ oldValue: t,
2230
+ newValue: n
2231
+ }), e) {
2232
+ case "channel-id":
2233
+ m($r, this, n), o(P, this) && n && (o(P, this).channelId = n, o(P, this).play(), r(B, this, V).call(this, h.BUFFERING, ""), r(B, this, V).call(this, h.CHANNEL_ID, n), r(B, this, V).call(this, h.POSTER_SRC, o(P, this).getThumbnailUrl()));
2234
+ break;
2235
+ case "channel-group-id":
2236
+ m(ei, this, n);
2237
+ break;
2238
+ case "url":
2239
+ n && m(Qr, this, n);
2240
+ break;
2241
+ case "paused":
2242
+ if (_(n)) {
2243
+ var i;
2244
+ (i = o(F, this)) == null || i.pause(), r(B, this, V).call(this, h.PAUSED, "");
2245
+ } else {
2246
+ var a;
2247
+ r(B, this, H).call(this, h.NEEDS_USER_INPUT_VIDEO), r(B, this, H).call(this, h.PAUSED), (a = o(F, this)) == null || a.play();
2248
+ }
2249
+ break;
2250
+ case "target-buffer-time":
2251
+ if (o(P, this) && n) {
2252
+ let e = parseInt(n, 10);
2253
+ Number.isNaN(e) || (o(P, this).targetBufferTime = e);
2254
+ }
2255
+ break;
2256
+ case "user-interacting":
2257
+ _(n) ? r(B, this, V).call(this, h.USER_INTERACTING, "") : r(B, this, H).call(this, h.USER_INTERACTING);
2258
+ break;
2259
+ case "muted":
2260
+ if (o(P, this)) if (_(n)) {
2261
+ var s;
2262
+ if (o(P, this).muted = !0, o(I, this) && (o(I, this).muted = !0), r(B, this, V).call(this, h.MUTED, ""), (s = o(R, this)) != null && s.isMediaElementSource) {
2263
+ var c;
2264
+ (c = o(R, this)) == null || c.stop(), r(B, this, V).call(this, h.VOLUME_LEVEL, JSON.stringify({
2265
+ left: null,
2266
+ right: null
2267
+ }));
2268
+ }
2269
+ } else {
2270
+ var l;
2271
+ o(P, this).muted = !1, o(I, this) && (o(I, this).muted = !1), r(B, this, H).call(this, h.MUTED), r(B, this, H).call(this, h.NEEDS_USER_INPUT_AUDIO), o(P, this).volume === 0 && (o(P, this).volume = .3), (l = o(R, this)) == null || l.start();
2272
+ }
2273
+ break;
2274
+ case "ui-locked":
2275
+ _(n) ? r(B, this, pa).call(this) : r(B, this, ma).call(this);
2276
+ break;
2277
+ case "is-fullscreen":
2278
+ _(n) ? r(B, this, va).call(this) : r(B, this, ya).call(this);
2279
+ break;
2280
+ case "abr-enabled":
2281
+ {
2282
+ let e = v(n == null ? null : n, !1);
2283
+ o(P, this) && (o(P, this).abrEnabled = e, e && (o(P, this).sizeBasedResolutionCapEnabled = v(this.getAttribute(h.SIZE_BASED_RESOLUTION_CAP_ENABLED), !0))), e ? r(B, this, V).call(this, h.ABR_ENABLED, "") : r(B, this, H).call(this, h.ABR_ENABLED);
2284
+ }
2285
+ break;
2286
+ case "size-based-resolution-cap-enabled":
2287
+ {
2288
+ let e = v(n == null ? null : n, !0);
2289
+ o(P, this) && (o(P, this).sizeBasedResolutionCapEnabled = e), r(B, this, V).call(this, h.SIZE_BASED_RESOLUTION_CAP_ENABLED, e ? "true" : "false");
2290
+ }
2291
+ break;
2292
+ case "max-video-bit-rate":
2293
+ m(ti, this, n), _(n) ? r(B, this, V).call(this, h.MAX_VIDEO_BITRATE, n) : r(B, this, H).call(this, h.MAX_VIDEO_BITRATE), o(I, this) && (o(I, this).maxVideoBitRate = n ? je(n) : void 0);
2294
+ break;
2295
+ case "max-initial-bit-rate":
2296
+ m(ni, this, n), _(n) ? r(B, this, V).call(this, h.MAX_INITIAL_BITRATE, n) : r(B, this, H).call(this, h.MAX_INITIAL_BITRATE);
2297
+ break;
2298
+ case "is-pip":
2299
+ _(n) ? r(B, this, ga).call(this) : r(B, this, _a).call(this);
2300
+ break;
2301
+ case "is-airplaying":
2302
+ if (_(n)) {
2303
+ var u, ee;
2304
+ (u = o(P, this)) != null && u.mediaElement && (o(P, this).mediaElement.style.display = "hidden"), (ee = o(P, this)) == null || ee.pause();
2305
+ } else {
2306
+ var d;
2307
+ (d = o(P, this)) != null && d.mediaElement && (o(P, this).mediaElement.style.display = "block");
2308
+ }
2309
+ break;
2310
+ case "is-casting":
2311
+ if (_(n)) {
2312
+ var te, f;
2313
+ (te = o(ri, this)) != null && te.isFullscreen() && r(B, this, ya).call(this), (f = o(P, this)) == null || f.pause();
2314
+ } else if (!document.hidden) {
2315
+ var p;
2316
+ (p = o(P, this)) == null || p.play();
2317
+ }
2318
+ break;
2319
+ case "cast-receiver-id":
2320
+ m(si, this, n);
2321
+ break;
2322
+ case "cast-background":
2323
+ m(ci, this, n);
2324
+ break;
2325
+ case "language":
2326
+ o(P, this) && (o(P, this).language = n, _(n) ? r(B, this, V).call(this, h.LANGUAGE, n) : r(B, this, H).call(this, h.LANGUAGE));
2327
+ break;
2328
+ case "text-track":
2329
+ o(P, this) && (o(P, this).textTrack = n, _(n) ? r(B, this, V).call(this, h.TEXT_TRACK, n) : r(B, this, H).call(this, h.TEXT_TRACK));
2330
+ break;
2331
+ case "log-level":
2332
+ _(n) && o(z, this).setLevel(De(n));
2333
+ break;
2334
+ case "authentication-token":
2335
+ if (_(n)) {
2336
+ var ne, re;
2337
+ (ne = o(P, this)) == null || ne.updateAuthenticationToken(n), (re = o(ai, this)) == null || re.updateAuthenticationToken(n), r(B, this, V).call(this, h.AUTHENTICATION_TOKEN, n);
2338
+ } else r(B, this, H).call(this, h.AUTHENTICATION_TOKEN);
2339
+ break;
2340
+ case "volume":
2341
+ if (_(n)) {
2342
+ let e = parseFloat(n);
2343
+ o(I, this) && (o(I, this).volume = e), o(P, this) && (o(P, this).volume = e);
2344
+ }
2345
+ break;
2346
+ case "timeshift-position":
2347
+ _(n) ? r(B, this, V).call(this, h.TIMESHIFT_POSITION, n) : r(B, this, H).call(this, h.TIMESHIFT_POSITION);
2348
+ break;
2349
+ case "drm-headers":
2350
+ if (_(n)) {
2351
+ let e = Ne(n);
2352
+ if (e) {
2353
+ var ie;
2354
+ (ie = o(P, this)) == null || ie.drm.setHeaders(e);
2355
+ } else o(z, this).warn("Invalid DRM headers format:", n);
2356
+ }
2357
+ break;
2358
+ case "drm-queryparams":
2359
+ if (_(n)) {
2360
+ let e = Ne(n);
2361
+ if (e) {
2362
+ var ae;
2363
+ (ae = o(P, this)) == null || ae.drm.setQueryParams(e);
2364
+ } else o(z, this).warn("Invalid DRM query parameters format:", n);
2365
+ }
2366
+ break;
2367
+ }
2368
+ [
2369
+ h.USER_INTERACTING,
2370
+ h.PAUSED,
2371
+ h.HIDE_UI_ON_PAUSE
2372
+ ].includes(e) && r(B, this, ha).call(this);
2373
+ }
2374
+ }
2375
+ connectListener(e) {
2376
+ or(e).forEach((t) => {
2377
+ let n = o(Kr, this).get(t);
2378
+ switch (n ? n.push(e) : o(Kr, this).set(t, [e]), t) {
2379
+ case h.PAUSED:
2380
+ var r;
2381
+ (((r = o(P, this)) == null ? void 0 : r.playbackState) === "paused" || this.hasAttribute(h.PAUSED)) && e.setAttribute(h.PAUSED, "");
2382
+ break;
2383
+ case h.MUTED:
2384
+ var i;
2385
+ ((i = o(P, this)) != null && i.muted || this.hasAttribute(h.MUTED)) && e.setAttribute(h.MUTED, "");
2386
+ break;
2387
+ case h.MAX_VIDEO_BITRATE:
2388
+ o(ti, this) && e.setAttribute(h.MAX_VIDEO_BITRATE, o(ti, this));
2389
+ break;
2390
+ case h.ABR_ENABLED:
2391
+ var a, s;
2392
+ ((a = (s = o(P, this)) == null ? void 0 : s.abrEnabled) == null ? v(this.getAttribute(h.ABR_ENABLED), !0) : a) ? e.setAttribute(h.ABR_ENABLED, "") : e.removeAttribute(h.ABR_ENABLED);
2393
+ break;
2394
+ case h.SIZE_BASED_RESOLUTION_CAP_ENABLED:
2395
+ {
2396
+ var c, l;
2397
+ let t = (c = (l = o(P, this)) == null ? void 0 : l.sizeBasedResolutionCapEnabled) == null ? v(this.getAttribute(h.SIZE_BASED_RESOLUTION_CAP_ENABLED), !0) : c;
2398
+ e.setAttribute(h.SIZE_BASED_RESOLUTION_CAP_ENABLED, t ? "true" : "false");
2399
+ }
2400
+ break;
2401
+ case h.CHANNEL_ID:
2402
+ o($r, this) && e.setAttribute(h.CHANNEL_ID, o($r, this));
2403
+ break;
2404
+ case h.CHANNEL_GROUP_ID:
2405
+ o(ei, this) && e.setAttribute(h.CHANNEL_GROUP_ID, o(ei, this));
2406
+ break;
2407
+ case h.AUTHENTICATION_TOKEN: {
2408
+ let t = this.getAttribute("authentication-token");
2409
+ t && e.setAttribute(h.AUTHENTICATION_TOKEN, t);
2410
+ break;
2411
+ }
2412
+ }
2413
+ });
2414
+ }
2415
+ disconnectListener(e) {
2416
+ or(e).forEach((t) => {
2417
+ let n = o(Kr, this).get(t);
2418
+ n && o(Kr, this).set(t, n.filter((t) => t != e));
2419
+ });
2420
+ }
2421
+ get instance() {
2422
+ return o(P, this);
2423
+ }
2424
+ get fullscreen() {
2425
+ return r(B, this, ea).call(this);
2426
+ }
2427
+ get airPlay() {
2428
+ return o(ai, this);
2429
+ }
2430
+ connect() {
2431
+ r(B, this, Ui).call(this);
2432
+ }
2433
+ };
2434
+ function Ui() {
2435
+ var e = this;
2436
+ return t(function* () {
2437
+ var t, n;
2438
+ if (!o($r, e)) return;
2439
+ let i = o(F, e) === o(Zr, e);
2440
+ yield (t = o(P, e)) == null ? void 0 : t.unload(), i && m(F, e, void 0);
2441
+ let a = e.hasAttribute(h.PAUSED), s = e.hasAttribute(h.MUTED), c = je(e.getAttribute(h.VOLUME)), l = typeof c == "number" ? Math.max(0, Math.min(1, c)) : c, u = Ee(e.getAttribute(h.MEDIA)), ee = e.getAttribute(h.TEXT_TRACK) || void 0, d = e.getAttribute("edge-url") || void 0, te = e.getAttribute("authentication-token") || void 0, f = je(e.getAttribute("max-video-bit-rate")), p = je(e.getAttribute("max-initial-bit-rate")), ne = ke(e.getAttribute("max-size")), re = je(e.getAttribute("min-buffer-time")), ie = je(e.getAttribute("max-buffer-time")), ae = v(e.getAttribute("burst-enabled")), se = v(e.getAttribute("mse-enabled")), ce = v(e.getAttribute("mse-opus-enabled")), le = v(e.getAttribute("ios-background-play-enabled")), ue = v(e.getAttribute("ios-wake-lock-enabled")), de = v(e.getAttribute("stream-to-media-element-enabled")), fe = v(e.getAttribute("ios-media-element-enabled")), pe = v(e.getAttribute("abr-enabled"), !0), me = v(e.getAttribute("size-based-resolution-cap-enabled")), he = v(e.getAttribute("telemetry-enabled")), ge = Oe(e.getAttribute("video-codecs")), _e = Me(e.getAttribute("poster")), ve = Ae(e.getAttribute("advanced")), ye = De(e.getAttribute("log-level")), be = {
2442
+ headers: Ne(e.getAttribute("drm-headers")),
2443
+ queryParams: Ne(e.getAttribute("drm-queryparams")),
2444
+ widevine: {
2445
+ videoRobustness: Pe(e.getAttribute("drm-widevine-video-robustness")),
2446
+ audioRobustness: Pe(e.getAttribute("drm-widevine-audio-robustness"))
2447
+ },
2448
+ playready: {
2449
+ videoRobustness: Pe(e.getAttribute("drm-playready-video-robustness")),
2450
+ audioRobustness: Pe(e.getAttribute("drm-playready-audio-robustness"))
2451
+ }
2452
+ }, xe = we(e.getAttribute("webcodecs-hardware-acceleration")), Se = Ce(e.getAttribute("decoders")), Te = v(e.getAttribute("offscreen-canvas-enabled")), g = v(e.getAttribute("webtransport-enabled")), Fe = je(e.getAttribute("reconnect-retries")), Ie = Fe === void 0 ? void 0 : (e) => e.reconnectRetries < Fe, Le = e.getAttribute("language") || void 0;
2453
+ m(P, e, new oe({
2454
+ url: o(Qr, e),
2455
+ channelId: o($r, e),
2456
+ channelGroupId: o(ei, e),
2457
+ edgeUrl: d,
2458
+ authenticationToken: te,
2459
+ muted: s,
2460
+ volume: l,
2461
+ media: u,
2462
+ maxSize: ne,
2463
+ maxVideoBitRate: f,
2464
+ maxInitialBitRate: p,
2465
+ minBufferTime: re,
2466
+ maxBufferTime: ie,
2467
+ burstEnabled: ae,
2468
+ mseEnabled: se,
2469
+ mseOpusEnabled: ce,
2470
+ iosBackgroundPlayEnabled: le,
2471
+ iosWakeLockEnabled: ue,
2472
+ streamToMediaElementEnabled: de,
2473
+ iosMediaElementEnabled: fe,
2474
+ abrEnabled: pe,
2475
+ sizeBasedResolutionCapEnabled: me,
2476
+ telemetryEnabled: he,
2477
+ videoCodecs: ge,
2478
+ poster: _e,
2479
+ textTrack: ee,
2480
+ advanced: ve,
2481
+ logLevel: ye,
2482
+ language: Le,
2483
+ drm: be,
2484
+ webtransportEnabled: g,
2485
+ webcodecsHardwareAcceleration: xe,
2486
+ decoders: Se,
2487
+ offscreenCanvasEnabled: Te,
2488
+ reconnectHandler: Ie
2489
+ })), m(Zr, e, new zr(o(P, e))), o(F, e) || m(F, e, o(Zr, e)), r(B, e, Wi).call(e), m(Yr, e, (n = e.shadowRoot) == null ? void 0 : n.querySelector("#video")), o(Yr, e) && o(P, e).attach(o(Yr, e)), e.setAttribute(h.MEDIA, o(P, e).media), o(P, e).muted && r(B, e, V).call(e, h.MUTED, ""), o(P, e).abrEnabled ? r(B, e, V).call(e, h.ABR_ENABLED, "") : r(B, e, H).call(e, h.ABR_ENABLED), r(B, e, V).call(e, h.SIZE_BASED_RESOLUTION_CAP_ENABLED, o(P, e).sizeBasedResolutionCapEnabled ? "true" : "false"), r(B, e, V).call(e, h.VOLUME, o(P, e).volume.toString()), _(_e) || r(B, e, V).call(e, h.POSTER_SRC, o(P, e).getThumbnailUrl());
2490
+ let Re = v(e.getAttribute(h.AIRPLAY_ENABLED), !1), ze = v(e.getAttribute(h.CAST_ENABLED), !0), y = v(e.getAttribute(h.FULLSCREEN_ENABLED), !0), Be = v(e.getAttribute(h.PIP_ENABLED), !0), Ve = v(e.getAttribute(h.VU_METER_ENABLED), !1), He = v(e.getAttribute(h.TIMESHIFT_ENABLED), !1);
2491
+ Re && r(B, e, ia).call(e, o(P, e)), ze && r(B, e, ta).call(e, o(P, e)), y && r(B, e, Qi).call(e, o(P, e)), Be && r(B, e, Xi).call(e, o(P, e)), a || o(P, e).play(), Ve && r(B, e, aa).call(e, o(P, e)), e.dispatchEvent(new CustomEvent("vindral-instance-ready", {
2492
+ bubbles: !0,
2493
+ composed: !0,
2494
+ detail: o(P, e)
2495
+ })), He && (r(B, e, qi).call(e), y && r(B, e, $i).call(e));
2496
+ })();
2497
+ }
2498
+ function Wi() {
2499
+ o(P, this) && (o(P, this).on("rendition levels", o(di, this)), o(P, this).on("rendition level", o(fi, this)), o(P, this).on("playback state", o(pi, this)), o(P, this).on("volume state", o(mi, this)), o(P, this).on("channel switch failed", o(hi, this)), o(P, this).on("channel switch", o(gi, this)), o(P, this).on("channels", o(_i, this)), o(P, this).on("languages", o(vi, this)), o(P, this).on("text tracks", o(yi, this)), o(P, this).on("needs user input", o(bi, this)), o(P, this).on("is live", o(xi, this)), o(P, this).on("timeshift info", o(Si, this)));
2500
+ }
2501
+ function Gi() {
2502
+ o(P, this) && (o(P, this).off("playback state", o(pi, this)), o(P, this).off("volume state", o(mi, this)), o(P, this).off("channel switch failed", o(hi, this)), o(P, this).off("channel switch", o(gi, this)), o(P, this).off("channels", o(_i, this)), o(P, this).off("languages", o(vi, this)), o(P, this).off("text tracks", o(yi, this)), o(P, this).off("needs user input", o(bi, this)), o(P, this).off("is live", o(xi, this)), o(P, this).off("timeshift info", o(Si, this)));
2503
+ }
2504
+ function Ki() {
2505
+ o(I, this) && (o(I, this).addEventListener("playing", o(Ci, this)), o(I, this).addEventListener("pause", o(wi, this)), o(I, this).addEventListener("ended", o(Ti, this)), o(I, this).addEventListener("timeupdate", o(Di, this)), o(I, this).addEventListener("volumechange", o(Oi, this)), o(I, this).addEventListener("hlsbuffering", o(ki, this)), o(I, this).addEventListener("hlsnotbuffering", o(Ai, this)), o(I, this).addEventListener("timeshiftready", o(ji, this)));
2506
+ }
2507
+ function qi() {
2508
+ var e, t, n, i;
2509
+ let a = je(this.getAttribute(h.VOLUME)), s = a === void 0 ? (e = (t = o(F, this)) == null ? void 0 : t.volume) == null ? 1 : e : Math.max(0, Math.min(1, a)), c = v(this.getAttribute(h.MUTED), (n = (i = o(F, this)) == null ? void 0 : i.muted) == null ? !1 : n);
2510
+ r(B, this, Ji).call(this), m(I, this, new Sr(o(Xr, this), {
2511
+ volume: s,
2512
+ muted: c,
2513
+ maxVideoBitRate: o(ti, this) ? parseInt(o(ti, this), 10) : void 0
2514
+ })), o(I, this).addEventListener("durationchange", o(Ei, this));
2515
+ }
2516
+ function Ji() {
2517
+ o(I, this) && (r(B, this, Yi).call(this), o(I, this).removeEventListener("durationchange", o(Ei, this)), o(I, this).cleanup(), o(F, this) === o(I, this) && m(F, this, void 0), m(I, this, void 0));
2518
+ }
2519
+ function Yi() {
2520
+ o(I, this) && (o(I, this).removeEventListener("playing", o(Ci, this)), o(I, this).removeEventListener("pause", o(wi, this)), o(I, this).removeEventListener("ended", o(Ti, this)), o(I, this).removeEventListener("timeupdate", o(Di, this)), o(I, this).removeEventListener("volumechange", o(Oi, this)), o(I, this).removeEventListener("hlsbuffering", o(ki, this)), o(I, this).removeEventListener("hlsnotbuffering", o(Ai, this)), o(I, this).removeEventListener("timeshiftready", o(ji, this)));
2521
+ }
2522
+ function Xi(e) {
2523
+ e.mediaElement instanceof HTMLVideoElement && (m(L, this, new ar(e.mediaElement)), o(L, this).isSupported() && (o(z, this).debug("PIP is supported"), r(B, this, V).call(this, h.PIP_AVAILABLE, "")), o(L, this).on("on picture in picture change", (e) => {
2524
+ e ? r(B, this, V).call(this, h.IS_PIP, "") : r(B, this, H).call(this, h.IS_PIP);
2525
+ }));
2526
+ }
2527
+ function Zi() {
2528
+ var e;
2529
+ if (!o(L, this)) return;
2530
+ let t = null;
2531
+ o(F, this) === o(I, this) && o(I, this) ? t = o(I, this).videoElement : ((e = o(P, this)) == null ? void 0 : e.mediaElement) instanceof HTMLVideoElement && (t = o(P, this).mediaElement), t && t !== o(L, this).videoElement && (o(z, this).debug("Updating PIP target to", o(F, this) === o(I, this) ? "HLS" : "Vindral"), o(L, this).unload(), m(L, this, new ar(t)), o(L, this).on("on picture in picture change", (e) => {
2532
+ e ? r(B, this, V).call(this, h.IS_PIP, "") : r(B, this, H).call(this, h.IS_PIP);
2533
+ }));
2534
+ }
2535
+ function Qi(e) {
2536
+ let t = !Yn.isFullscreenApiSupported(this) && Yn.isFullscreenApiSupported(e.mediaElement) ? e.mediaElement : this;
2537
+ m(ri, this, new Yn(t)), o(ri, this).on("on fullscreen change", (e) => {
2538
+ e ? r(B, this, V).call(this, h.FULLSCREEN, "") : r(B, this, H).call(this, h.FULLSCREEN);
2539
+ });
2540
+ }
2541
+ function $i() {
2542
+ var e;
2543
+ o(I, this) && (m(ii, this, !Yn.isFullscreenApiSupported(this) && Yn.isFullscreenApiSupported((e = o(I, this)) == null ? void 0 : e.videoElement) ? new Yn(o(I, this).videoElement) : new Yn(this)), o(ii, this).on("on fullscreen change", (e) => {
2544
+ e ? r(B, this, V).call(this, h.FULLSCREEN, "") : r(B, this, H).call(this, h.FULLSCREEN);
2545
+ }));
2546
+ }
2547
+ function ea() {
2548
+ return this.hasAttribute(h.TIMESHIFT_POSITION) ? o(ii, this) : o(ri, this);
2549
+ }
2550
+ function ta(e) {
2551
+ m(oi, this, new me({
2552
+ background: o(ci, this),
2553
+ receiverApplicationId: o(si, this),
2554
+ options: e.getCastOptions()
2555
+ })), o(oi, this).init().then(() => {
2556
+ var e, t, n;
2557
+ r(B, this, V).call(this, h.CAST_AVAILABLE, ""), (e = o(oi, this)) == null || e.on("connected", r(B, this, na).bind(this)), (t = o(oi, this)) == null || t.on("resumed", r(B, this, na).bind(this)), (n = o(oi, this)) == null || n.on("disconnected", r(B, this, ra).bind(this));
2558
+ }).catch((e) => {
2559
+ o(z, this).warn("Failed to initialize CastSender", e);
2560
+ });
2561
+ }
2562
+ function na() {
2563
+ var e, t;
2564
+ r(B, this, V).call(this, h.IS_CASTING, "");
2565
+ let n = (e = (t = o(oi, this)) == null ? void 0 : t.getReceiverName()) == null ? "device" : e;
2566
+ r(B, this, V).call(this, h.CAST_RECEIVER_NAME, n);
2567
+ }
2568
+ function ra() {
2569
+ r(B, this, H).call(this, h.IS_CASTING), r(B, this, H).call(this, h.CAST_RECEIVER_NAME);
2570
+ }
2571
+ function ia(e) {
2572
+ var t;
2573
+ (t = o(ai, this)) == null || t.unload();
2574
+ let n = e.getCastOptions();
2575
+ m(ai, this, new Jn({
2576
+ url: n.url,
2577
+ channelId: n.channelId,
2578
+ authenticationToken: n.authenticationToken,
2579
+ container: this
2580
+ })), o(ai, this).once("available", () => {
2581
+ r(B, this, V).call(this, h.AIRPLAY_AVAILABLE, "");
2582
+ }), o(ai, this).on("connected", () => {
2583
+ r(B, this, V).call(this, h.IS_AIRPLAYING, "");
2584
+ }), o(ai, this).on("disconnected", () => {
2585
+ r(B, this, H).call(this, h.IS_AIRPLAYING);
2586
+ });
2587
+ }
2588
+ function aa(e) {
2589
+ var t;
2590
+ if ((t = o(R, this)) == null || t.unload(), !ce()) {
2591
+ if (e.audioNode) m(R, this, new cr(e.audioNode));
2592
+ else if (e.mediaElement instanceof HTMLMediaElement) m(R, this, new cr(e.mediaElement));
2593
+ else return;
2594
+ o(R, this).on("on decibel change", (e) => {
2595
+ r(B, this, V).call(this, h.VOLUME_LEVEL, JSON.stringify(e));
2596
+ }), r(B, this, V).call(this, h.VOLUME_LEVEL, JSON.stringify({
2597
+ left: null,
2598
+ right: null
2599
+ })), (!o(R, this).isMediaElementSource || !this.hasAttribute(h.MUTED)) && o(R, this).start();
2600
+ }
2601
+ }
2602
+ function oa(e) {
2603
+ e.pointerType !== "mouse" && e.timeStamp - o(Mi, this) < 250 || (r(B, this, pa).call(this), o(Jr, this) && clearTimeout(o(Jr, this)), e.target instanceof HTMLElement && ([this, o(Yr, this)].includes(e.target) || e.target.localName === "vindral-scroll-overlay") && r(B, this, ma).call(this));
2604
+ }
2605
+ function sa(e) {
2606
+ let t = this.hasAttribute(h.USER_INTERACTING);
2607
+ e.pointerType === "touch" && e.target instanceof HTMLElement ? [this, o(Yr, this)].includes(e.target) && t ? r(B, this, fa).call(this) : r(B, this, ma).call(this) : e.composedPath().some((e) => e instanceof HTMLElement && ["vindral-play-button"].includes(e == null ? void 0 : e.localName)) && r(B, this, ma).call(this);
2608
+ }
2609
+ function ca(e) {
2610
+ !o(ri, this) || e.target instanceof y || e.target instanceof nt || e.target instanceof Ur || (this.hasAttribute(h.FULLSCREEN) ? this.removeAttribute(h.FULLSCREEN) : this.setAttribute(h.FULLSCREEN, ""));
2611
+ }
2612
+ function la(e) {
2613
+ this.hasAttribute(h.USER_INTERACTING) || r(B, this, ma).call(this);
2614
+ }
2615
+ function ua(e) {
2616
+ var t;
2617
+ let { metaKey: n, altKey: r, key: i } = e;
2618
+ if (n || r || !Gr.includes(i)) return;
2619
+ let a = (t = e.target) == null ? void 0 : t.keysUsed;
2620
+ if (!(Array.isArray(a) && a.includes(i)) && !e.composedPath().some((e) => {
2621
+ let t = e == null ? void 0 : e.keysUsed;
2622
+ return Array.isArray(t) && t.includes(i);
2623
+ })) switch (i) {
2624
+ case "f":
2625
+ this.hasAttribute(h.FULLSCREEN) ? this.removeAttribute(h.FULLSCREEN) : this.setAttribute(h.FULLSCREEN, "");
2626
+ break;
2627
+ case "m":
2628
+ this.hasAttribute(h.MUTED) ? this.removeAttribute(h.MUTED) : this.setAttribute(h.MUTED, "");
2629
+ break;
2630
+ case "ArrowDown":
2631
+ var o;
2632
+ (o = this.querySelector("vindral-scroll-overlay")) == null || o.setAttribute("open", "");
2633
+ break;
2634
+ }
2635
+ }
2636
+ function da() {
2637
+ var e = this;
2638
+ return t(function* () {
2639
+ if (!o(P, e) || !o(ei, e)) return;
2640
+ let t = Date.now();
2641
+ if (o(zi, e) && t - o(zi, e) < 1e4) o(z, e).debug("Skipping channel update, last update was less than 10 seconds ago.");
2642
+ else {
2643
+ m(zi, e, t);
2644
+ let n = yield o(P, e).getApiClient().getChannels(o(ei, e));
2645
+ r(B, e, V).call(e, h.CHANNELS, JSON.stringify(n));
2646
+ }
2647
+ m(li, e, window.setTimeout(() => void r(B, e, da).call(e), 1e4));
2648
+ })();
2649
+ }
2650
+ function fa() {
2651
+ !this.hasAttribute(h.USER_INTERACTING) || this.hasAttribute(h.UI_LOCKED) || (this.dispatchEvent(new CustomEvent("user-interacting", {
2652
+ bubbles: !0,
2653
+ composed: !0,
2654
+ detail: { active: !1 }
2655
+ })), this.removeAttribute(h.USER_INTERACTING));
2656
+ }
2657
+ function pa() {
2658
+ this.hasAttribute(h.USER_INTERACTING) || requestAnimationFrame(() => {
2659
+ this.setAttribute(h.USER_INTERACTING, ""), this.dispatchEvent(new CustomEvent("user-interacting", {
2660
+ bubbles: !0,
2661
+ composed: !0,
2662
+ detail: { active: !0 }
2663
+ }));
2664
+ });
2665
+ }
2666
+ function ma() {
2667
+ r(B, this, pa).call(this), o(Jr, this) && clearTimeout(o(Jr, this)), o(qr, this) && m(Jr, this, self.setTimeout(() => {
2668
+ r(B, this, fa).call(this);
2669
+ }, o(qr, this)));
2670
+ }
2671
+ function ha() {
2672
+ var e;
2673
+ let t = getComputedStyle(this).getPropertyValue("--vindral-subtitle-offset") || "0px";
2674
+ (e = o(P, this)) == null || (e = e.mediaElement) == null || e.style.setProperty("--vindral-subtitle-offset", t);
2675
+ }
2676
+ function ga() {
2677
+ var e;
2678
+ r(B, this, Zi).call(this), r(B, this, ba).call(this), (e = o(L, this)) == null || e.request().catch((e) => {
2679
+ o(z, this).warn("Failed to enter picture in picture:", e);
2680
+ });
2681
+ }
2682
+ function _a() {
2683
+ var e;
2684
+ (e = o(L, this)) == null || e.exit().catch((e) => {
2685
+ o(z, this).warn("Failed to exit picture in picture:", e);
2686
+ });
2687
+ }
2688
+ function va() {
2689
+ let e = r(B, this, ea).call(this);
2690
+ if (!e) {
2691
+ console.warn("No fullscreen target available"), this.setAttribute(h.FULLSCREEN_FALLBACK, ""), r(B, this, V).call(this, h.FULLSCREEN, "");
2692
+ return;
2693
+ }
2694
+ e != null && e.isFullscreenApiSupported() ? (r(B, this, ba).call(this), e == null || e.request().then(() => {
2695
+ o(Bi, this).call(this);
2696
+ }).catch((e) => {
2697
+ o(z, this).warn("Failed to enter fullscreen:", e);
2698
+ })) : (this.setAttribute(h.FULLSCREEN_FALLBACK, ""), r(B, this, V).call(this, h.FULLSCREEN, ""));
2699
+ }
2700
+ function ya() {
2701
+ let e = r(B, this, ea).call(this);
2702
+ e != null && e.isFullscreenApiSupported() ? e == null || e.exit().then(() => {
2703
+ o(Vi, this).call(this);
2704
+ }).catch((e) => {
2705
+ o(z, this).warn("Failed to exit fullscreen:", e);
2706
+ }) : (this.removeAttribute(h.FULLSCREEN_FALLBACK), r(B, this, H).call(this, h.FULLSCREEN));
2707
+ }
2708
+ function ba() {
2709
+ o(P, this) && o(P, this).emitter.emit("ios-hack: reset size");
2710
+ }
2711
+ function V(e, t) {
2712
+ var n;
2713
+ (n = o(Kr, this).get(e)) == null || n.forEach((n) => n.setAttribute(e, t));
2714
+ }
2715
+ function H(e) {
2716
+ var t;
2717
+ (t = o(Kr, this).get(e)) == null || t.forEach((t) => t.removeAttribute(e));
2718
+ }
2719
+ e(Hi, "observedAttributes", [
2720
+ ...Te,
2721
+ "url",
2722
+ "edge-url",
2723
+ "target-buffer-time",
2724
+ "cast-receiver-id",
2725
+ "cast-background",
2726
+ "log-level",
2727
+ "max-size",
2728
+ "min-buffer-time",
2729
+ "max-buffer-time",
2730
+ "max-audio-bit-rate",
2731
+ "max-initial-bit-rate",
2732
+ "burst-enabled",
2733
+ "mse-enabled",
2734
+ "mse-opus-enabled",
2735
+ "ios-background-play-enabled",
2736
+ "ios-wake-lock-enabled",
2737
+ "stream-to-media-element-enabled",
2738
+ "ios-media-element-enabled",
2739
+ "abr-enabled",
2740
+ "size-based-resolution-cap-enabled",
2741
+ "telemetry-enabled",
2742
+ "video-codecs",
2743
+ "poster",
2744
+ "advanced",
2745
+ "drm-headers",
2746
+ "drm-queryparams",
2747
+ "drm-widevine-video-robustness",
2748
+ "drm-widevine-audio-robustness",
2749
+ "drm-playready-video-robustness",
2750
+ "drm-playready-audio-robustness",
2751
+ "webtransport-enabled",
2752
+ "webcodecs-hardware-acceleration",
2753
+ "decoders",
2754
+ "offscreen-canvas-enabled",
2755
+ "reconnect-retries",
2756
+ "auto-instance-enabled",
2757
+ "language"
2758
+ ]);
2759
+ var xa = { _: "https://lb.cdn.vindral.com" }, Sa, Ca = document.createElement("template");
2760
+ Ca.innerHTML = `
2761
+ <style>
2762
+ :host {
2763
+ display: var(--fullscreen-button-display);
2764
+ }
2765
+
2766
+ :host([${h.FULLSCREEN}]) slot[name="enter"] {
2767
+ display: none !important;
2768
+ }
2769
+
2770
+ :host(:not([${h.FULLSCREEN}])) slot[name="exit"] {
2771
+ display: none !important;
2772
+ }
2773
+ </style>
2774
+
2775
+ <slot name="icon">
2776
+ <slot name="enter">
2777
+ <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>
2778
+ </slot>
2779
+ <slot name="exit">
2780
+ <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>
2781
+ </slot>
2782
+ </slot>
2783
+ `;
2784
+ var wa = class extends y {
2785
+ constructor() {
2786
+ var e;
2787
+ super(), (e = this.shadowRoot) == null || e.appendChild(Ca.content.cloneNode(!0));
2788
+ }
2789
+ connectedCallback() {
2790
+ super.connectedCallback(), this.setAttribute("aria-label", this.isFullscreen ? "Exit fullscreen" : "Enter fullscreen");
2791
+ }
2792
+ disconnectedCallback() {
2793
+ super.disconnectedCallback();
2794
+ }
2795
+ attributeChangedCallback(e, t, n) {
2796
+ super.attributeChangedCallback(e, t, n), e === h.FULLSCREEN && this.setAttribute("aria-label", this.isFullscreen ? "Exit fullscreen" : "Enter fullscreen");
2797
+ }
2798
+ set isFullscreen(e) {
2799
+ e ? this.setAttribute(h.FULLSCREEN, "") : this.removeAttribute(h.FULLSCREEN);
2800
+ }
2801
+ get isFullscreen() {
2802
+ return this.hasAttribute(h.FULLSCREEN);
2803
+ }
2804
+ handleClick(e) {
2805
+ let t = this.isFullscreen ? g.EXIT_FULLSCREEN : g.ENTER_FULLSCREEN;
2806
+ this.dispatchEvent(new CustomEvent(t, {
2807
+ bubbles: !0,
2808
+ composed: !0
2809
+ }));
2810
+ }
2811
+ };
2812
+ Sa = wa, e(wa, "observedAttributes", [...b(Sa, "observedAttributes", Sa), h.FULLSCREEN]);
2813
+ //#endregion
2814
+ //#region ../../libs/player-next/src/components/LanguageMenu.ts
2815
+ var Ta, Ea = "\n <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>\n", Da = document.createElement("template");
2816
+ Da.innerHTML = `
2817
+ <style>
2818
+ :host(:not([hidden])) {
2819
+ display: var(--language-menu-display);
2820
+ }
2821
+ </style>
2822
+
2823
+ <slot name="button">${Ea}</slot>
2824
+ <slot name="listbox" hidden>
2825
+ <vindral-language-menu-list id="listbox" part="listbox"></vindral-language-menu-list>
2826
+ </slot>
2827
+ `;
2828
+ var Oa = /* @__PURE__ */ new WeakSet(), ka = class extends nt {
2829
+ constructor() {
2830
+ var e, t, n, r;
2831
+ super(), p(this, Oa), (e = this.shadowRoot) == null || e.appendChild(Da.content.cloneNode(!0)), this.button = (t = this.shadowRoot) == null ? void 0 : t.querySelector("slot[name=button]"), this.listbox = (n = this.shadowRoot) == null ? void 0 : n.querySelector("[part=listbox]"), this.listboxSlot = (r = this.shadowRoot) == null ? void 0 : r.querySelector("slot[name=listbox]");
2832
+ }
2833
+ connectedCallback() {
2834
+ super.connectedCallback(), r(Oa, this, Aa).call(this), this.setAttribute("aria-label", "Languages");
2835
+ }
2836
+ attributeChangedCallback(e, t, n) {
2837
+ super.attributeChangedCallback(e, t, n), (e === h.LANGUAGES || e === h.TEXT_TRACKS) && r(Oa, this, Aa).call(this);
2838
+ }
2839
+ };
2840
+ Ta = ka;
2841
+ function Aa() {
2842
+ let e = (e) => (e ? JSON.parse(e) : []).length < 2, t = e(this.getAttribute(h.LANGUAGES)), n = e(this.getAttribute(h.TEXT_TRACKS));
2843
+ t && n ? this.setAttribute("hidden", "") : this.removeAttribute("hidden");
2844
+ }
2845
+ e(ka, "observedAttributes", [
2846
+ ...b(Ta, "observedAttributes", Ta),
2847
+ h.LANGUAGES,
2848
+ h.TEXT_TRACKS
2849
+ ]);
2850
+ //#endregion
2851
+ //#region ../../libs/player-next/src/components/LanguageMenuList.ts
2852
+ var ja = document.createElement("template");
2853
+ ja.innerHTML = `
2854
+ <style>
2855
+ :host {
2856
+ font: inherit;
2857
+ cursor: default;
2858
+ padding: var(--padding-2);
2859
+ padding-top: var(--padding-3);
2860
+ border-radius: 0.25em;
2861
+ position: absolute;
2862
+ min-width: 140px;
2863
+ background: var(--bg-subtle);
2864
+ z-index: 1;
2865
+ overflow: auto;
2866
+ display: flex;
2867
+ flex-direction: row;
2868
+ gap: var(--padding-3);
2869
+ }
2870
+
2871
+ :host([list-position="top"]) {
2872
+ bottom: calc(100% + 0.5em);
2873
+ transform: translate(-50%);
2874
+ }
2875
+
2876
+ :host([list-position="bottom"]) {
2877
+ top: calc(100% + 0.5em);
2878
+ }
2879
+
2880
+ :host::-webkit-scrollbar {
2881
+ width: 5px;
2882
+ padding-right: 5px;
2883
+ }
2884
+
2885
+ :host::-webkit-scrollbar-thumb {
2886
+ background-color: var(--fg-extra-subtle);
2887
+ border-radius: 10px;
2888
+ border: 0;
2889
+ }
2890
+
2891
+ :host::-webkit-scrollbar-track {
2892
+ border-radius: 10px;
2893
+ background-color: transparent;
2894
+ }
2895
+
2896
+ .menu {
2897
+ display: grid;
2898
+ gap: var(--padding-1);
2899
+ }
2900
+
2901
+ .menu-container {
2902
+ display: flex;
2903
+ flex-direction: column;
2904
+ flex: 1;
2905
+ }
2906
+
2907
+ [role="menuitem"] {
2908
+ position: relative;
2909
+ cursor: pointer;
2910
+ display: flex;
2911
+ align-items: center;
2912
+ height: 44px;
2913
+ padding: 0 var(--padding-3);
2914
+ padding-left: var(--padding-6);
2915
+ border-radius: 4px;
2916
+ font-size: 14px;
2917
+ }
2918
+
2919
+ [role="menuitem"]:hover {
2920
+ background: var(--bg-component-hover);
2921
+ }
2922
+
2923
+ [role="menuitem"][aria-selected="true"] {
2924
+ background: var(--bg-component-active);
2925
+ }
2926
+
2927
+ [role="menuitem"][aria-selected="true"]::before {
2928
+ content: url("data:image/svg+xml,%0A%20%20%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2078.369%2078.369%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M78.049%2019.015%2029.458%2067.606a1.094%201.094%200%200%201-1.548%200L.32%2040.015a1.094%201.094%200%200%201%200-1.547l6.704-6.704a1.095%201.095%200%200%201%201.548%200l20.113%2020.112%2041.113-41.113a1.095%201.095%200%200%201%201.548%200l6.703%206.704a1.094%201.094%200%200%201%200%201.548z%22%2F%3E%3C%2Fsvg%3E%0A");
2929
+ position: absolute;
2930
+ left: var(--padding-3);
2931
+ top: calc(50% - 8px);
2932
+ }
2933
+
2934
+ [role="menuitem"]:focus-visible {
2935
+ box-shadow: inset 0 0 0 2px var(--fg-strong);
2936
+ outline: 0;
2937
+ }
2938
+
2939
+ .heading {
2940
+ text-transform: uppercase;
2941
+ margin-bottom: var(--padding-2);
2942
+ padding: 0 var(--padding-3);
2943
+ font-size: 11px;
2944
+ font-weight: bold;
2945
+ }
2946
+
2947
+ :host([${h.LANGUAGES}="[]"]) #languages,
2948
+ :host(:not([${h.LANGUAGES}])) #languages {
2949
+ display: none;
2950
+ }
2951
+
2952
+ :host([${h.TEXT_TRACKS}="[]"]) #text-tracks,
2953
+ :host(:not([${h.TEXT_TRACKS}])) #text-tracks {
2954
+ display: none;
2955
+ }
2956
+ </style>
2957
+
2958
+ <div id="languages" class="menu-container">
2959
+ <div class="heading">Language</div>
2960
+ <div class="menu"></div>
2961
+ </div>
2962
+ <div id="text-tracks" class="menu-container">
2963
+ <div class="heading">Subtitles</div>
2964
+ <div class="menu"></div>
2965
+ </div>
2966
+ `;
2967
+ var Ma = /* @__PURE__ */ new WeakMap(), Na = /* @__PURE__ */ new WeakMap(), Pa = /* @__PURE__ */ new WeakMap(), Fa = /* @__PURE__ */ new WeakMap(), Ia = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), La = /* @__PURE__ */ new WeakMap(), Ra = /* @__PURE__ */ new WeakMap(), za = /* @__PURE__ */ new WeakMap(), Ba = /* @__PURE__ */ new WeakMap(), Va = /* @__PURE__ */ new WeakMap(), Ha = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakSet(), Ua = class extends HTMLElement {
2968
+ constructor() {
2969
+ super(), p(this, W), n(this, Ma, []), n(this, Na, []), n(this, Pa, void 0), n(this, Fa, void 0), n(this, Ia, []), n(this, U, []), n(this, La, null), n(this, Ra, null), n(this, za, null), n(this, Ba, null), n(this, Va, null), n(this, Ha, null), e(this, "handleEvent", (e) => {
2970
+ switch (e.type) {
2971
+ case "keydown":
2972
+ r(W, this, Qa).call(this, e);
2973
+ break;
2974
+ }
2975
+ }), this.attachShadow({ mode: "open" }).appendChild(ja.content.cloneNode(!0));
2976
+ }
2977
+ connectedCallback() {
2978
+ let e = this.getRootNode();
2979
+ if (e instanceof ShadowRoot) {
2980
+ var t, n, i;
2981
+ m(za, this, e.host.closest("vindral-controller")), (t = o(za, this)) == null || t.connectListener(this), m(La, this, (n = this.shadowRoot) == null ? void 0 : n.querySelector("#languages .menu")), m(Ra, this, (i = this.shadowRoot) == null ? void 0 : i.querySelector("#text-tracks .menu")), r(W, this, Wa).call(this), r(W, this, Ga).call(this), m(Ba, this, e.host), this.addEventListener("keydown", this);
2982
+ }
2983
+ }
2984
+ disconnectedCallback() {
2985
+ this.removeEventListener("keydown", this);
2986
+ }
2987
+ attributeChangedCallback(e, t, n) {
2988
+ t !== n && (e === h.LANGUAGES && n && (this.languages = JSON.parse(n)), e === h.TEXT_TRACKS && n && (this.textTracks = JSON.parse(n)), e === h.LANGUAGE && (this.language = n), e === h.TEXT_TRACK && (this.textTrack = n));
2989
+ }
2990
+ set languages(e) {
2991
+ m(Ma, this, e), r(W, this, qa).call(this), r(W, this, Ya).call(this);
2992
+ }
2993
+ set textTracks(e) {
2994
+ m(Na, this, e), r(W, this, Ka).call(this), r(W, this, Xa).call(this);
2995
+ }
2996
+ set language(e) {
2997
+ m(Pa, this, e), r(W, this, Ya).call(this);
2998
+ }
2999
+ set textTrack(e) {
3000
+ m(Fa, this, e), r(W, this, Xa).call(this);
3001
+ }
3002
+ get keysUsed() {
3003
+ return [
3004
+ "Enter",
3005
+ "Escape",
3006
+ "Tab",
3007
+ " ",
3008
+ "ArrowDown",
3009
+ "ArrowUp",
3010
+ "ArrowLeft",
3011
+ "ArrowRight",
3012
+ "Home",
3013
+ "End"
3014
+ ];
3015
+ }
3016
+ focus() {
3017
+ o(Va, this) ? o(Va, this).focus() : o(Ha, this) && o(Ha, this).focus();
3018
+ }
3019
+ };
3020
+ function Wa() {
3021
+ new IntersectionObserver((e) => {
3022
+ e.forEach((e) => {
3023
+ if (e.intersectionRatio !== 1) if (e.intersectionRatio > 0) {
3024
+ let t = this.offsetHeight * e.intersectionRatio - 24;
3025
+ this.style.height = `${t}px`;
3026
+ } else this.style.height = "auto";
3027
+ });
3028
+ }, {
3029
+ root: o(za, this),
3030
+ threshold: 0
3031
+ }).observe(this);
3032
+ }
3033
+ function Ga() {
3034
+ o(La, this) && (r(W, this, qa).call(this), r(W, this, Ya).call(this)), o(Ra, this) && (r(W, this, Ka).call(this), r(W, this, Xa).call(this));
3035
+ }
3036
+ function Ka() {
3037
+ o(Ra, this).innerHTML = "", m(U, this, []);
3038
+ let e = r(W, this, Ja).call(this, "Off", "textTrack", void 0);
3039
+ o(Ra, this).appendChild(e), o(U, this).push({
3040
+ element: e,
3041
+ value: void 0
3042
+ }), o(Na, this).forEach((e) => {
3043
+ let t = r(W, this, Ja).call(this, e, "textTrack", e);
3044
+ o(Ra, this).appendChild(t), o(U, this).push({
3045
+ element: t,
3046
+ value: e
3047
+ });
3048
+ }), r(W, this, Xa).call(this);
3049
+ }
3050
+ function qa() {
3051
+ o(La, this).innerHTML = "", m(Ia, this, []), o(Ma, this).forEach((e) => {
3052
+ let t = r(W, this, Ja).call(this, e, "language", e);
3053
+ o(La, this).appendChild(t), o(Ia, this).push({
3054
+ element: t,
3055
+ value: e
3056
+ });
3057
+ }), r(W, this, Ya).call(this);
3058
+ }
3059
+ function Ja(e, t, n) {
3060
+ let i = document.createElement("div");
3061
+ return i.setAttribute("role", "menuitem"), i.textContent = e, i.addEventListener("click", () => r(W, this, Za).call(this, n, t)), i;
3062
+ }
3063
+ function Ya() {
3064
+ o(Va, this) && (o(Va, this).removeAttribute("aria-selected"), o(Va, this).tabIndex = -1);
3065
+ let e = o(Ia, this).find((e) => e.value === o(Pa, this));
3066
+ e && (e.element.setAttribute("aria-selected", "true"), e.element.tabIndex = 0, m(Va, this, e.element));
3067
+ }
3068
+ function Xa() {
3069
+ o(Ha, this) && (o(Ha, this).removeAttribute("aria-selected"), o(Ha, this).tabIndex = -1);
3070
+ let e = o(U, this).find((e) => e.value === o(Fa, this));
3071
+ if (e) e.element.setAttribute("aria-selected", "true"), e.element.tabIndex = 0, m(Ha, this, e.element);
3072
+ else {
3073
+ let e = o(U, this).find((e) => e.value === void 0);
3074
+ e && (e.element.setAttribute("aria-selected", "true"), e.element.tabIndex = 0, m(Ha, this, e.element));
3075
+ }
3076
+ }
3077
+ function Za(e, t) {
3078
+ this.dispatchEvent(new Event("change", {
3079
+ bubbles: !0,
3080
+ composed: !0
3081
+ }));
3082
+ let n = t === "language" ? g.SET_LANGUAGE : g.SET_TEXT_TRACK;
3083
+ this.dispatchEvent(new CustomEvent(n, {
3084
+ bubbles: !0,
3085
+ composed: !0,
3086
+ detail: e
3087
+ }));
3088
+ }
3089
+ function Qa(e) {
3090
+ let { key: t, ctrlKey: n, altKey: i, metaKey: a } = e;
3091
+ if (!(n || i || a) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") {
3092
+ var s;
3093
+ (s = o(Ba, this)) == null || s.hide();
3094
+ } else if (t === "Enter" || t === " ") {
3095
+ var c;
3096
+ (c = r(W, this, to).call(this)) == null || (c = c.element) == null || c.click();
3097
+ } else r(W, this, $a).call(this, e);
3098
+ }
3099
+ function $a(e) {
3100
+ var t;
3101
+ let { key: n } = e, i = [...o(Ia, this), ...o(U, this)], a = (t = r(W, this, to).call(this)) == null ? i[0] : t;
3102
+ if (!a) return;
3103
+ let s = i.indexOf(a), c = Math.max(0, s);
3104
+ n === "ArrowDown" ? c++ : n === "ArrowUp" ? c-- : n === "ArrowLeft" ? c = r(W, this, eo).call(this, s, "left") : n === "ArrowRight" ? c = r(W, this, eo).call(this, s, "right") : e.key === "Home" ? c = 0 : e.key === "End" && (c = i.length - 1), c < 0 && (c = i.length - 1), c > i.length - 1 && (c = 0);
3105
+ let l = i[c];
3106
+ l && (r(W, this, no).call(this, l.value), l.element.focus());
3107
+ }
3108
+ function eo(e, t) {
3109
+ let n = o(Ia, this).length, r = o(U, this).length;
3110
+ return t === "left" ? e < n ? n + r - 1 : e - n - 1 : e >= n ? 0 : e + n;
3111
+ }
3112
+ function to() {
3113
+ return [...o(Ia, this), ...o(U, this)].find((e) => e.element.tabIndex === 0);
3114
+ }
3115
+ function no(e) {
3116
+ for (let t of [...o(Ia, this), ...o(U, this)]) t.element.tabIndex = t.value === e ? 0 : -1;
3117
+ }
3118
+ e(Ua, "observedAttributes", [
3119
+ h.LANGUAGES,
3120
+ h.TEXT_TRACKS,
3121
+ h.LANGUAGE,
3122
+ h.TEXT_TRACK
3123
+ ]);
3124
+ //#endregion
3125
+ //#region ../../libs/player-next/src/components/LiveButton.ts
3126
+ var ro, io = document.createElement("template");
3127
+ io.innerHTML = "\n <style>\n :host {\n display: var(--live-button-display, flex);\n color: var(--vindral-fg-strong, #eee);\n border: 1px solid transparent;\n font-size: 12px;\n font-weight: bold;\n cursor: pointer;\n transition: all 0.2s;\n min-width: 50px;\n text-align: center;\n align-items: center;\n justify-content: center;\n }\n\n .live-text {\n display: inline-block;\n vertical-align: middle;\n margin-left: 4px;\n }\n\n slot[name=\"icon\"] svg {\n width: 5px;\n height: 5px;\n flex-shrink: 0;\n }\n\n .live-dot {\n fill: var(--vindral-fg-subtle, #b4b4b4);\n transition: fill 0.2s;\n transform-origin: center;\n }\n\n /* Red pulsing dot when live */\n :host(:not([timeshift-position])) .live-dot {\n fill: #ff0000;\n animation: pulse-dot 2s ease-in-out infinite alternate;\n }\n\n @keyframes pulse-dot {\n 0% {\n opacity: 0.8;\n transform: scale(0.9);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n :host([disabled]) {\n cursor: default;\n opacity: 1;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n </style>\n\n <slot name=\"icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"5\" height=\"5\" viewBox=\"0 0 5 5\" fill=\"currentColor\">\n <circle cx=\"2.5\" cy=\"2.5\" r=\"2.5\" class=\"live-dot\"/>\n </svg>\n</slot>\n <span class=\"live-text\">LIVE</span>\n";
3128
+ var ao = class extends y {
3129
+ constructor() {
3130
+ var e;
3131
+ super(), (e = this.shadowRoot) == null || e.appendChild(io.content.cloneNode(!0));
3132
+ }
3133
+ connectedCallback() {
3134
+ super.connectedCallback(), this.updateState();
3135
+ }
3136
+ disconnectedCallback() {
3137
+ super.disconnectedCallback();
3138
+ }
3139
+ attributeChangedCallback(e, t, n) {
3140
+ super.attributeChangedCallback(e, t, n), (e === h.TIMESHIFT_POSITION || e === h.DURATION) && this.updateState();
3141
+ }
3142
+ updateState() {
3143
+ if (!this.hasAttribute(h.DURATION)) {
3144
+ this.setAttribute("hidden", ""), this.removeAttribute("aria-label"), this.removeAttribute("disabled");
3145
+ return;
3146
+ }
3147
+ this.removeAttribute("hidden"), this.isLive ? (this.setAttribute("aria-label", "Currently live"), this.setAttribute("disabled", "")) : (this.setAttribute("aria-label", "Go live"), this.removeAttribute("disabled"));
3148
+ }
3149
+ get isLive() {
3150
+ return !this.hasAttribute(h.TIMESHIFT_POSITION);
3151
+ }
3152
+ set isLive(e) {
3153
+ e ? this.removeAttribute(h.TIMESHIFT_POSITION) : this.setAttribute(h.TIMESHIFT_POSITION, "");
3154
+ }
3155
+ handleClick(e) {
3156
+ this.isLive || this.dispatchEvent(new CustomEvent(g.GO_LIVE, {
3157
+ bubbles: !0,
3158
+ composed: !0
3159
+ }));
3160
+ }
3161
+ };
3162
+ ro = ao, e(ao, "observedAttributes", [
3163
+ ...b(ro, "observedAttributes", ro),
3164
+ h.TIMESHIFT_POSITION,
3165
+ h.DURATION
3166
+ ]);
3167
+ //#endregion
3168
+ //#region ../../libs/player-next/src/components/MuteButton.ts
3169
+ var oo, so = document.createElement("template");
3170
+ so.innerHTML = `
3171
+ <style>
3172
+ :host {
3173
+ display: var(--mute-button-display);
3174
+ }
3175
+
3176
+ :host([${h.MUTED}]) slot[name="unmute"] {
3177
+ display: none !important;
3178
+ }
3179
+
3180
+ :host(:not([${h.MUTED}])) slot[name="mute"] {
3181
+ display: none !important;
3182
+ }
3183
+ </style>
3184
+
3185
+ <slot name="icon">
3186
+ <slot name="mute">
3187
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" <g fill="none" stroke="currentColor">
3188
+ <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" />
3189
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" />
3190
+ </g></svg>
3191
+ </slot>
3192
+ <slot name="unmute">
3193
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" <g fill="none" stroke="currentColor">
3194
+ <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>
3195
+ </slot>
3196
+ </slot>
3197
+ `;
3198
+ var co = class extends y {
3199
+ constructor() {
3200
+ var e;
3201
+ super(), (e = this.shadowRoot) == null || e.appendChild(so.content.cloneNode(!0));
3202
+ }
3203
+ connectedCallback() {
3204
+ super.connectedCallback(), this.setAttribute("aria-label", this.muted ? "UnMute" : "Mute");
3205
+ }
3206
+ disconnectedCallback() {
3207
+ super.disconnectedCallback();
3208
+ }
3209
+ attributeChangedCallback(e, t, n) {
3210
+ super.attributeChangedCallback(e, t, n), e === h.MUTED && this.setAttribute("aria-label", this.muted ? "UnMute" : "Mute");
3211
+ }
3212
+ set muted(e) {
3213
+ e ? this.setAttribute(h.MUTED, "") : this.removeAttribute(h.MUTED);
3214
+ }
3215
+ get muted() {
3216
+ return this.hasAttribute(h.MUTED);
3217
+ }
3218
+ handleClick(e) {
3219
+ let t = this.muted ? g.UNMUTE : g.MUTE;
3220
+ this.dispatchEvent(new CustomEvent(t, {
3221
+ bubbles: !0,
3222
+ composed: !0
3223
+ }));
3224
+ }
3225
+ };
3226
+ oo = co, e(co, "observedAttributes", [...b(oo, "observedAttributes", oo), h.MUTED]);
3227
+ //#endregion
3228
+ //#region ../../libs/player-next/src/components/PictureInPictureButton.ts
3229
+ var lo, uo = document.createElement("template");
3230
+ uo.innerHTML = `
3231
+ <style>
3232
+ :host {
3233
+ display: var(--pip-button-display);
3234
+ }
3235
+
3236
+ :host(:not([${h.PIP_AVAILABLE}])) {
3237
+ display: none !important;
3238
+ }
3239
+ </style>
3240
+ <slot name="icon">
3241
+ <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>
3242
+ </slot>
3243
+ `;
3244
+ var fo = class extends y {
3245
+ constructor() {
3246
+ var e;
3247
+ super(), (e = this.shadowRoot) == null || e.appendChild(uo.content.cloneNode(!0));
3248
+ }
3249
+ connectedCallback() {
3250
+ super.connectedCallback(), this.setAttribute("aria-label", this.isPictureInPictureActive ? "Exit picture in picture" : "Enter picture in picture");
3251
+ }
3252
+ disconnectedCallback() {
3253
+ super.disconnectedCallback();
3254
+ }
3255
+ attributeChangedCallback(e, t, n) {
3256
+ super.attributeChangedCallback(e, t, n), e === h.IS_PIP && this.setAttribute("aria-label", this.isPictureInPictureActive ? "Exit picture in picture" : "Enter picture in picture");
3257
+ }
3258
+ set isPictureInPictureActive(e) {
3259
+ e ? this.setAttribute(h.IS_PIP, "") : this.removeAttribute(h.IS_PIP);
3260
+ }
3261
+ get isPictureInPictureActive() {
3262
+ return this.hasAttribute(h.IS_PIP);
3263
+ }
3264
+ handleClick(e) {
3265
+ let t = this.isPictureInPictureActive ? g.EXIT_PIP : g.ENTER_PIP;
3266
+ this.dispatchEvent(new CustomEvent(t, {
3267
+ bubbles: !0,
3268
+ composed: !0
3269
+ }));
3270
+ }
3271
+ };
3272
+ lo = fo, e(fo, "observedAttributes", [
3273
+ ...b(lo, "observedAttributes", lo),
3274
+ h.IS_PIP,
3275
+ h.PIP_AVAILABLE
3276
+ ]);
3277
+ //#endregion
3278
+ //#region ../../libs/player-next/src/components/PlayButton.ts
3279
+ var po, mo = document.createElement("template");
3280
+ mo.innerHTML = `
3281
+ <style>
3282
+ :host {
3283
+ display: var(--play-button-display);
3284
+ }
3285
+
3286
+ :host([${h.PAUSED}]) slot[name="pause"] {
3287
+ display: none !important;
3288
+ }
3289
+
3290
+ :host(:not([${h.PAUSED}])) slot[name="play"] {
3291
+ display: none !important;
3292
+ }
3293
+ </style>
3294
+
3295
+ <slot name="icon">
3296
+ <slot name="play">
3297
+ <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>
3298
+ </slot>
3299
+ <slot name="pause">
3300
+ <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>
3301
+ </slot>
3302
+ </slot>
3303
+ `;
3304
+ var ho = class extends y {
3305
+ constructor() {
3306
+ var e;
3307
+ super(), (e = this.shadowRoot) == null || e.appendChild(mo.content.cloneNode(!0));
3308
+ }
3309
+ connectedCallback() {
3310
+ super.connectedCallback(), this.setAttribute("aria-label", this.paused ? "Play" : "Pause");
3311
+ }
3312
+ disconnectedCallback() {
3313
+ super.disconnectedCallback();
3314
+ }
3315
+ attributeChangedCallback(e, t, n) {
3316
+ super.attributeChangedCallback(e, t, n), e === h.PAUSED && this.setAttribute("aria-label", this.paused ? "Play" : "Pause");
3317
+ }
3318
+ set paused(e) {
3319
+ e ? this.setAttribute(h.PAUSED, "") : this.removeAttribute(h.PAUSED);
3320
+ }
3321
+ get paused() {
3322
+ return this.hasAttribute(h.PAUSED);
3323
+ }
3324
+ handleClick(e) {
3325
+ let t = this.paused ? g.PLAY : g.PAUSE;
3326
+ this.dispatchEvent(new CustomEvent(t, {
3327
+ bubbles: !0,
3328
+ composed: !0
3329
+ }));
3330
+ }
3331
+ };
3332
+ po = ho, e(ho, "observedAttributes", [...b(po, "observedAttributes", po), h.PAUSED]);
3333
+ //#endregion
3334
+ //#region ../../libs/player-next/src/PlayerAttributes.ts
3335
+ var G = {
3336
+ TITLE: "title",
3337
+ OFFLINE: "offline",
3338
+ ADVANCED_RENDITION_MENU_ENABLED: "advanced-rendition-menu-enabled",
3339
+ REFRESH_POSTER_ENABLED: "refresh-poster-enabled",
3340
+ STREAM_POLL_ENABLED: "stream-poll-enabled"
3341
+ }, go = Object.values(G), _o = /* @__PURE__ */ new WeakMap(), vo = /* @__PURE__ */ new WeakMap(), yo = /* @__PURE__ */ new WeakMap(), bo = /* @__PURE__ */ new WeakMap(), xo = /* @__PURE__ */ new WeakMap(), So = /* @__PURE__ */ new WeakMap(), Co = /* @__PURE__ */ new WeakMap(), wo = /* @__PURE__ */ new WeakSet(), To = class extends pe {
3342
+ constructor(e) {
3343
+ super(), p(this, wo), n(this, _o, void 0), n(this, vo, void 0), n(this, yo, !1), n(this, bo, !1), n(this, xo, !0), n(this, So, null), n(this, Co, null), m(vo, this, e), m(_o, this, new fe({
3344
+ publicEndpoint: e.url,
3345
+ tokenFactory: () => e.authenticationToken
3346
+ }));
3347
+ }
3348
+ start(e = 5e3) {
3349
+ o(Co, this) && clearInterval(o(Co, this)), m(yo, this, !1), m(bo, this, !1), r(wo, this, ko).call(this), r(wo, this, Eo).call(this), m(Co, this, window.setInterval(() => {
3350
+ !o(bo, this) && !o(vo, this).infiniteReconnect && !o(So, this) && o(xo, this) && m(So, this, window.setTimeout(() => r(wo, this, Do).call(this), 300 * 1e3)), !o(bo, this) && o(xo, this) && r(wo, this, Eo).call(this);
3351
+ }, e));
3352
+ }
3353
+ stop() {
3354
+ r(wo, this, Oo).call(this), o(Co, this) && (window.clearInterval(o(Co, this)), m(Co, this, null));
3355
+ }
3356
+ };
3357
+ function Eo() {
3358
+ var e = this;
3359
+ return t(function* () {
3360
+ if (o(yo, e)) return;
3361
+ m(yo, e, !0);
3362
+ let t = "Stream is offline", n = "Please stand by";
3363
+ try {
3364
+ let t = yield o(_o, e).getChannel(o(vo, e).channelId);
3365
+ if (t.isLive) {
3366
+ m(bo, e, !0), r(wo, e, ko).call(e), e.emit("live", t), m(yo, e, !1);
3367
+ return;
3368
+ }
3369
+ } catch (e) {
3370
+ de(e) && (e.status === 403 || e.status === 401) && (t = "Forbidden", n = "You do not have permission to view this stream");
3371
+ }
3372
+ o(xo, e) && e.emit("error", {
3373
+ title: t,
3374
+ message: n
3375
+ }), m(yo, e, !1);
3376
+ })();
3377
+ }
3378
+ function Do() {
3379
+ this.stop(), m(xo, this, !1), this.emit("timeout");
3380
+ }
3381
+ function Oo() {
3382
+ o(So, this) && (window.clearTimeout(o(So, this)), m(So, this, null));
3383
+ }
3384
+ function ko() {
3385
+ r(wo, this, Oo).call(this), m(xo, this, !0);
3386
+ }
3387
+ //#endregion
3388
+ //#region ../../libs/player-next/src/utils/browser.ts
3389
+ var Ao = /\/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\//i, jo = navigator.userAgent.toLowerCase(), Mo = Ao.test(jo), No = (e) => Hi.observedAttributes.includes(e), Po = `
3390
+ <style>
3391
+ :host {
3392
+ container-type: inline-size;
3393
+ position: relative;
3394
+ overflow: hidden;
3395
+ width: 100%;
3396
+ display: flex;
3397
+ justify-content: center;
3398
+
3399
+ --vindral-volume-range-display: ${Mo ? "none" : "flex"};
3400
+ --vindral-airplay-button-display: none;
3401
+ --vindral-play-overlay-display: none;
3402
+ --vindral-grid-item-offline-display: none;
3403
+ --vindral-seek-bar-display: none;
3404
+ }
3405
+
3406
+ vindral-control-bar[slot="top-bar"] {
3407
+ display: none;
3408
+ }
3409
+
3410
+ @container (max-width: 320px) {
3411
+ vindral-controller {
3412
+ --vindral-volume-range-display: none;
3413
+ --vindral-control-padding: 0px;
3414
+ --vindral-button-padding: 4px;
3415
+ --vindral-play-overlay-icon-size: 40px;
3416
+ }
3417
+
3418
+ vindral-control-bar[slot="top-bar"] {
3419
+ display: block;
3420
+ }
3421
+
3422
+ vindral-control-bar:not([slot="top-bar"]) vindral-rendition-levels-menu,
3423
+ vindral-control-bar:not([slot="top-bar"]) vindral-advanced-rendition-menu,
3424
+ vindral-control-bar:not([slot="top-bar"]) vindral-cast-button,
3425
+ vindral-control-bar:not([slot="top-bar"]) vindral-airplay-button {
3426
+ display: none;
3427
+ }
3428
+ }
3429
+
3430
+ vindral-scroll-overlay {
3431
+ z-index: 20;
3432
+ // needs to be higher than bottom bar/UI
3433
+ }
3434
+
3435
+ :host([${G.OFFLINE}]) {
3436
+ aspect-ratio: 16 / 9;
3437
+ vindral-controller {
3438
+ --vindral-ui-display: none;
3439
+ --vindral-play-overlay-display: none;
3440
+ }
3441
+ }
3442
+
3443
+ :host([${h.AIRPLAY_ENABLED}="false"]) {
3444
+ --vindral-airplay-button-display: none;
3445
+ }
3446
+
3447
+ :host([${h.CAST_ENABLED}="false"]) {
3448
+ --vindral-cast-button-display: none;
3449
+ }
3450
+
3451
+ :host([${h.FULLSCREEN_ENABLED}="false"]) {
3452
+ --vindral-fullscreen-button-display: none;
3453
+ }
3454
+
3455
+ :host([${h.PIP_ENABLED}="false"]) {
3456
+ --vindral-pip-button-display: none;
3457
+ }
3458
+
3459
+ :host([${h.TIMESHIFT_ENABLED}="false"]) {
3460
+ --vindral-seek-bar-display: none;
3461
+ --vindral-live-button-display: none;
3462
+ }
3463
+
3464
+ :host(:not([${h.CHANNEL_GROUP_ID}])) vindral-scroll-overlay {
3465
+ display: none;
3466
+ }
3467
+
3468
+ :host([${h.MEDIA}="video"]) vindral-mute-button,
3469
+ :host([${h.MEDIA}="video"]) vindral-volume-range {
3470
+ display: none;
3471
+ }
3472
+
3473
+ /* Apply subtitle offset when the UI is visible (e.g. during user interaction
3474
+ or when paused with the UI showing) so subtitles sit above the control bar. */
3475
+ vindral-controller[user-interacting],
3476
+ vindral-controller[paused]:not([hide-ui-on-pause]) {
3477
+ --vindral-subtitle-offset: -48px;
3478
+ }
3479
+ </style>
3480
+ `, Fo = (e) => {
3481
+ let t = e ? "vindral-advanced-rendition-menu" : "vindral-rendition-levels-menu";
3482
+ return `
3483
+ ${Po}
3484
+
3485
+ <vindral-controller>
3486
+ <vindral-control-bar slot="top-bar">
3487
+ <${t} list-position="bottom"></${t}>
3488
+ <vindral-cast-button></vindral-cast-button>
3489
+ <vindral-airplay-button></vindral-airplay-button>
3490
+ </vindral-control-bar>
3491
+ <vindral-seek-bar></vindral-seek-bar>
3492
+ <vindral-control-bar>
3493
+ <vindral-play-button></vindral-play-button>
3494
+ <vindral-mute-button></vindral-mute-button>
3495
+ <vindral-volume-range></vindral-volume-range>
3496
+ <vindral-channel-grid-button slot="right"></vindral-channel-grid-button>
3497
+ <vindral-language-menu slot="right"></vindral-language-menu>
3498
+ <vindral-live-button id="live-button" slot="right"></vindral-live-button>
3499
+ <${t} slot="right"></${t}>
3500
+ <vindral-pip-button slot="right"></vindral-pip-button>
3501
+ <vindral-cast-button slot="right"></vindral-cast-button>
3502
+ <vindral-airplay-button slot="right"></vindral-airplay-button>
3503
+ <vindral-fullscreen-button slot="right"></vindral-fullscreen-button>
3504
+ </vindral-control-bar>
3505
+ <vindral-scroll-overlay slot="overlay">
3506
+ <vindral-channel-grid id="listbox" part="listbox"></vindral-channel-grid>
3507
+ </vindral-scroll-overlay>
3508
+ <vindral-cast-overlay slot="overlay"></vindral-cast-overlay>
3509
+ <vindral-buffering-overlay slot="overlay"></vindral-buffering-overlay>
3510
+ <vindral-user-input-play-overlay slot="overlay"></vindral-user-input-play-overlay>
3511
+ <vindral-poster-overlay slot="overlay" disabled></vindral-poster-overlay>
3512
+
3513
+ <vindral-play-overlay id="play-overlay" slot="overlay" hidden></vindral-play-overlay>
3514
+ <vindral-message id="vindral-message" slot="overlay" hidden></vindral-message>
3515
+ </vindral-controller>
3516
+ `;
3517
+ }, Io = `
3518
+ ${Po}
3519
+
3520
+ <style>
3521
+ #control-bar {
3522
+ display: flex;
3523
+ justify-content: center;
3524
+ align-items: center;
3525
+ gap: var(--padding-3);
3526
+ }
3527
+ </style>
3528
+
3529
+ <vindral-controller>
3530
+ <div id="control-bar" slot="middle">
3531
+ <vindral-play-button></vindral-play-button>
3532
+ <vindral-mute-button></vindral-mute-button>
3533
+ <vindral-volume-range></vindral-volume-range>
3534
+ <vindral-buffering-icon></vindral-buffering-icon>
3535
+ </div>
3536
+
3537
+ <vindral-play-overlay id="play-overlay" slot="overlay" hidden></vindral-play-overlay>
3538
+ <vindral-message id="vindral-message" slot="overlay" hidden></vindral-message>
3539
+ </vindral-controller>
3540
+ `, Lo = document.createElement("template"), Ro = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), zo = /* @__PURE__ */ new WeakMap(), Bo = /* @__PURE__ */ new WeakMap(), Vo = /* @__PURE__ */ new WeakMap(), Ho = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), Uo = /* @__PURE__ */ new WeakMap(), Wo = /* @__PURE__ */ new WeakMap(), Go = /* @__PURE__ */ new WeakMap(), Ko = class extends HTMLElement {
3541
+ constructor() {
3542
+ super(), p(this, Y), n(this, Ro, void 0), n(this, K, void 0), n(this, q, void 0), n(this, J, void 0), n(this, zo, void 0), n(this, Bo, /* @__PURE__ */ new Set()), n(this, Vo, () => {
3543
+ Array.from(this.attributes).forEach((e) => {
3544
+ o(Ho, this).call(this, e.name, e.value);
3545
+ });
3546
+ }), n(this, Ho, (e, t) => {
3547
+ No(e) && (_(t) ? o(K, this).setAttribute(e, t) : o(K, this).removeAttribute(e));
3548
+ }), n(this, Uo, () => {
3549
+ Array.from(this.children).forEach((e) => {
3550
+ o(Bo, this).add(e);
3551
+ });
3552
+ }), n(this, Wo, () => {
3553
+ let e = o(K, this).instance;
3554
+ e && (e.on("is live", (e) => {
3555
+ e ? (this.removeAttribute(G.OFFLINE), o(q, this).setAttribute("hidden", "")) : (this.setAttribute(G.OFFLINE, ""), o(q, this).removeAttribute("hidden"), r(Y, this, Zo).call(this, "Stream is offline", "Please stand by"));
3556
+ }), e.on("channels", (e) => {
3557
+ let t = o(K, this).getAttribute("channel-id"), n = e.find((e) => e.channelId === t);
3558
+ n && r(Y, this, Xo).call(this, n);
3559
+ }), e.on("channel switch", ({ channelId: t }) => {
3560
+ let n = e.channels.find((e) => e.channelId === t);
3561
+ n && r(Y, this, Xo).call(this, n);
3562
+ }), e.on("error", (e) => {
3563
+ if (e.code() === "connection_failed") {
3564
+ r(Y, this, Zo).call(this, "Stream is offline", "Please stand by");
3565
+ return;
3566
+ }
3567
+ e.isFatal() && (e.code() === "access_forbidden" ? r(Y, this, Zo).call(this, "Forbidden", "You do not have permission to view this stream") : e.code() === "connection_failed_will_not_attempt_again" ? r(Y, this, Zo).call(this, "Stream is offline", "Please stand by") : r(Y, this, Zo).call(this, "An error occurred", e.message), o(J, this).removeAttribute("hidden"), this.setAttribute(G.OFFLINE, ""), o(K, this).dispatchEvent(new CustomEvent(g.EXIT_FULLSCREEN)), o(K, this).dispatchEvent(new CustomEvent(g.EXIT_PIP)));
3568
+ }));
3569
+ }), n(this, Go, () => {
3570
+ o(K, this).connect(), o(J, this).setAttribute("hidden", ""), o(q, this).setAttribute("hidden", ""), o(K, this).focus();
3571
+ }), m(Ro, this, this.attachShadow({ mode: "open" })), r(Y, this, Jo).call(this), m(K, this, o(Ro, this).querySelector("vindral-controller")), m(q, this, o(Ro, this).querySelector("#vindral-message")), m(J, this, o(Ro, this).querySelector("#play-overlay"));
3572
+ }
3573
+ connectedCallback() {
3574
+ this.setAttribute(G.OFFLINE, ""), o(K, this).addEventListener("vindral-instance-ready", o(Wo, this)), r(Y, this, Yo).call(this);
3575
+ }
3576
+ disconnectedCallback() {
3577
+ var e;
3578
+ o(K, this).removeEventListener("vindral-instance-ready", o(Wo, this)), o(J, this).removeEventListener("click", o(Go, this)), (e = o(zo, this)) == null || e.stop();
3579
+ }
3580
+ attributeChangedCallback(e, t, n) {
3581
+ if (t !== n) if (e === h.MEDIA || e === G.ADVANCED_RENDITION_MENU_ENABLED) r(Y, this, Jo).call(this);
3582
+ else if (e === G.REFRESH_POSTER_ENABLED) {
3583
+ let e = o(Ro, this).querySelector("vindral-poster-overlay");
3584
+ e && (e.disabled = v(this.getAttribute(G.REFRESH_POSTER_ENABLED), !1) === !1);
3585
+ } else o(Ho, this).call(this, e, n);
3586
+ }
3587
+ get instance() {
3588
+ return o(K, this).instance;
3589
+ }
3590
+ get airPlay() {
3591
+ return o(K, this).airPlay;
3592
+ }
3593
+ };
3594
+ function qo() {
3595
+ let e = Ee(this.getAttribute(h.MEDIA)), t = v(this.getAttribute(G.ADVANCED_RENDITION_MENU_ENABLED), !1);
3596
+ return e === "audio" ? Io : Fo(t);
3597
+ }
3598
+ function Jo() {
3599
+ let e = o(Ro, this).hasChildNodes(), t = e ? o(K, this) : void 0, n = e ? o(J, this) : void 0;
3600
+ this.isConnected && t && t.removeEventListener("vindral-instance-ready", o(Wo, this)), this.isConnected && n && o(zo, this) && n.removeEventListener("click", o(Go, this)), Lo.innerHTML = r(Y, this, qo).call(this);
3601
+ let i = Lo.content.cloneNode(!0);
3602
+ m(K, this, i.querySelector("vindral-controller")), m(q, this, i.querySelector("#vindral-message")), m(J, this, i.querySelector("#play-overlay")), o(Uo, this).call(this), o(Bo, this).forEach((e) => {
3603
+ o(K, this).appendChild(e);
3604
+ }), o(Vo, this).call(this), o(Ro, this).innerHTML = "", o(Ro, this).appendChild(i), this.isConnected && (o(K, this).addEventListener("vindral-instance-ready", o(Wo, this)), o(zo, this) && o(J, this).addEventListener("click", o(Go, this)));
3605
+ }
3606
+ function Yo() {
3607
+ var e;
3608
+ if (v(this.getAttribute(G.STREAM_POLL_ENABLED), !0) === !1) return;
3609
+ let t = this.getAttribute("url"), n = this.getAttribute("channel-id"), i = (e = this.getAttribute("authentication-token")) == null ? void 0 : e, a = this.hasAttribute("infinite-reconnect");
3610
+ if (!t || !n) {
3611
+ this.setAttribute(G.OFFLINE, ""), r(Y, this, Zo).call(this, "Invalid options", "Please enter at least a channel id and url to start the stream");
3612
+ return;
3613
+ }
3614
+ m(zo, this, new To({
3615
+ url: t,
3616
+ channelId: n,
3617
+ authenticationToken: i,
3618
+ infiniteReconnect: a
3619
+ })), o(zo, this).on("live", (e) => {
3620
+ o(K, this).connect(), this.removeAttribute("offline"), o(q, this).setAttribute("hidden", ""), r(Y, this, Xo).call(this, e);
3621
+ }), o(zo, this).on("timeout", () => {
3622
+ o(q, this).setAttribute("hidden", ""), o(J, this).removeAttribute("hidden");
3623
+ }), o(zo, this).on("error", (e) => {
3624
+ this.setAttribute(G.OFFLINE, ""), r(Y, this, Zo).call(this, e.title, e.message);
3625
+ }), o(J, this).addEventListener("click", o(Go, this)), this.hasAttribute("paused") && o(zo, this).start();
3626
+ }
3627
+ function Xo(e) {
3628
+ let t = Me(this.getAttribute("title"), !1);
3629
+ if (!t) return;
3630
+ let n = this.getAttribute("poster"), r = typeof t == "string" ? t : e.name, i;
3631
+ if (typeof n == "string") i = n;
3632
+ else {
3633
+ var a, o;
3634
+ i = (a = (o = this.instance) == null ? void 0 : o.getThumbnailUrl()) == null ? e.thumbnailUrls.length ? e.thumbnailUrls[0] : void 0 : a;
3635
+ }
3636
+ xe({
3637
+ title: r,
3638
+ poster: i
3639
+ });
3640
+ }
3641
+ function Zo(e, t) {
3642
+ o(q, this).setAttribute("title", e), o(q, this).setAttribute("description", t);
3643
+ let n = this.getAttribute("poster");
3644
+ n && o(q, this).setAttribute("background-image", n), o(q, this).removeAttribute("hidden");
3645
+ }
3646
+ e(Ko, "observedAttributes", [...Hi.observedAttributes, ...go]);
3647
+ //#endregion
3648
+ //#region ../../libs/player-next/src/components/PosterOverlay.ts
3649
+ var Qo = document.createElement("template");
3650
+ Qo.innerHTML = `
3651
+ <style>
3652
+ :host {
3653
+ display: var(--poster-overlay-display);
3654
+ position: absolute;
3655
+ top: 0;
3656
+ left: 0;
3657
+ max-width: 100%;
3658
+ max-height: 100%;
3659
+ min-width: 100%;
3660
+ min-height: 100%;
3661
+ background-repeat: no-repeat;
3662
+ background-position: 50% 50%;
3663
+ background-size: contain;
3664
+ transition-property: background-image;
3665
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
3666
+ transition-duration: 200ms;
3667
+ }
3668
+
3669
+ :host::before {
3670
+ content: "";
3671
+ position: absolute;
3672
+ top: 0;
3673
+ left: 0;
3674
+ right: 0;
3675
+ bottom: 0;
3676
+ background: rgba(255, 255, 255, 0);
3677
+ transition: background 0.2s ease;
3678
+ }
3679
+
3680
+ :host(:not([${h.PAUSED}])) {
3681
+ display: none;
3682
+ }
3683
+ </style>
3684
+ `;
3685
+ var $o = 6e3, es = /* @__PURE__ */ new WeakMap(), ts = /* @__PURE__ */ new WeakMap(), ns = /* @__PURE__ */ new WeakMap(), rs = /* @__PURE__ */ new WeakMap(), is = /* @__PURE__ */ new WeakSet(), as = /* @__PURE__ */ new WeakMap(), os = class extends HTMLElement {
3686
+ constructor() {
3687
+ super(), p(this, is), n(this, es, null), n(this, ts, null), n(this, ns, null), n(this, rs, () => {
3688
+ !document.hidden && this.hasAttribute("intersecting") && this.paused && !this.disabled ? r(is, this, ss).call(this) : r(is, this, cs).call(this);
3689
+ }), n(this, as, (e) => {
3690
+ e.forEach((e) => {
3691
+ e.isIntersecting ? this.setAttribute("intersecting", "") : this.removeAttribute("intersecting");
3692
+ });
3693
+ }), this.attachShadow({ mode: "open" }).appendChild(Qo.content.cloneNode(!0));
3694
+ }
3695
+ connectedCallback() {
3696
+ var e;
3697
+ m(es, this, this.closest("vindral-controller")), (e = o(es, this)) == null || e.connectListener(this), document.addEventListener("visibilitychange", o(rs, this)), m(ns, this, new IntersectionObserver(o(as, this))), o(ns, this).observe(this);
3698
+ }
3699
+ disconnectedCallback() {
3700
+ var e, t;
3701
+ (e = o(es, this)) == null || e.disconnectListener(this), document.removeEventListener("visibilitychange", o(rs, this)), (t = o(ns, this)) == null || t.disconnect(), m(ns, this, null), r(is, this, cs).call(this);
3702
+ }
3703
+ attributeChangedCallback(e, t, n) {
3704
+ t !== n && (e === h.POSTER_SRC && this.paused && !this.disabled && r(is, this, ls).call(this), (e === h.PAUSED || e === "disabled" || e === "intersecting") && o(rs, this).call(this));
3705
+ }
3706
+ get disabled() {
3707
+ return this.hasAttribute("disabled");
3708
+ }
3709
+ set disabled(e) {
3710
+ e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
3711
+ }
3712
+ get posterSrc() {
3713
+ return this.getAttribute(h.POSTER_SRC);
3714
+ }
3715
+ get paused() {
3716
+ return this.hasAttribute(h.PAUSED);
3717
+ }
3718
+ };
3719
+ function ss() {
3720
+ o(ts, this) === null && (r(is, this, cs).call(this), m(ts, this, window.setInterval(() => r(is, this, ls).call(this), $o)));
3721
+ }
3722
+ function cs() {
3723
+ o(ts, this) !== null && (clearInterval(o(ts, this)), m(ts, this, null)), this.style.backgroundImage = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg==')";
3724
+ }
3725
+ function ls() {
3726
+ if (!this.posterSrc) return;
3727
+ let e = new URL(this.posterSrc), t = new Image();
3728
+ e.searchParams.set("t", Date.now().toString()), t.src = e.toString(), t.onload = () => this.style.backgroundImage = `url(${e.toString()})`;
3729
+ }
3730
+ e(os, "observedAttributes", [
3731
+ h.POSTER_SRC,
3732
+ h.PAUSED,
3733
+ "disabled",
3734
+ "intersecting"
3735
+ ]);
3736
+ //#endregion
3737
+ //#region ../../libs/player-next/src/components/RenditionLevelsMenu.ts
3738
+ var us, ds = "\n<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\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <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\" />\n</svg>\n", fs = document.createElement("template");
3739
+ fs.innerHTML = `
3740
+ <style>
3741
+ :host {
3742
+ display: var(--rendition-menu-display);
3743
+ }
3744
+ </style>
3745
+
3746
+ <slot name="button">${ds}</slot>
3747
+ <slot name="listbox" hidden>
3748
+ <vindral-rendition-levels-menu-list id="listbox" part="listbox"></vindral-rendition-levels-menu-list>
3749
+ </slot>
3750
+ `;
3751
+ var ps = /* @__PURE__ */ new WeakSet(), ms = class extends nt {
3752
+ constructor() {
3753
+ var e, t, n, r;
3754
+ super(), p(this, ps), (e = this.shadowRoot) == null || e.appendChild(fs.content.cloneNode(!0)), this.button = (t = this.shadowRoot) == null ? void 0 : t.querySelector("slot[name=button]"), this.listbox = (n = this.shadowRoot) == null ? void 0 : n.querySelector("[part=listbox]"), this.listboxSlot = (r = this.shadowRoot) == null ? void 0 : r.querySelector("slot[name=listbox]");
3755
+ }
3756
+ connectedCallback() {
3757
+ super.connectedCallback(), r(ps, this, hs).call(this), this.setAttribute("aria-label", "Rendition levels");
3758
+ }
3759
+ attributeChangedCallback(e, t, n) {
3760
+ super.attributeChangedCallback(e, t, n), e === h.RENDITION_LEVELS && r(ps, this, hs).call(this);
3761
+ }
3762
+ };
3763
+ us = ms;
3764
+ function hs() {
3765
+ let e = this.getAttribute(h.RENDITION_LEVELS);
3766
+ !e || e === "[]" ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
3767
+ }
3768
+ e(ms, "observedAttributes", [...b(us, "observedAttributes", us), h.RENDITION_LEVELS]);
3769
+ //#endregion
3770
+ //#region ../../libs/player-next/src/components/RenditionLevelsMenuList.ts
3771
+ var gs = document.createElement("template");
3772
+ gs.innerHTML = "\n <style>\n :host {\n font: inherit;\n cursor: default;\n padding: var(--padding-2);\n padding-top: var(--padding-3);\n border-radius: 0.25em;\n position: absolute;\n min-width: 140px;\n background: var(--bg-subtle);\n z-index: 1;\n overflow: auto;\n }\n\n :host([list-position=\"top\"]) {\n bottom: calc(100% + 0.5em);\n transform: translate(-50%);\n }\n\n :host([list-position=\"bottom\"]) {\n top: calc(100% + 0.5em);\n }\n\n :host::-webkit-scrollbar {\n width: 5px;\n padding-right: 5px;\n }\n\n :host::-webkit-scrollbar-thumb {\n background-color: var(--fg-extra-subtle);\n border-radius: 10px;\n border: 0;\n }\n\n :host::-webkit-scrollbar-track {\n border-radius: 10px;\n background-color: transparent;\n }\n\n .menu {\n display: grid;\n gap: var(--padding-1);\n }\n\n [role=\"menuitem\"] {\n flex: 1;\n position: relative;\n cursor: pointer;\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: 44px;\n padding: 0 var(--padding-5);\n border-radius: 4px;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: normal;\n white-space: nowrap;\n text-align: left;\n }\n\n [role=\"menuitem\"]:hover {\n background: var(--bg-component-hover);\n }\n\n [role=\"menuitem\"][aria-selected=\"true\"] {\n background: var(--bg-component-active);\n }\n\n [role=\"menuitem\"][aria-selected=\"true\"]::before {\n content: url(\"data:image/svg+xml,%0A%20%20%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2078.369%2078.369%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M78.049%2019.015%2029.458%2067.606a1.094%201.094%200%200%201-1.548%200L.32%2040.015a1.094%201.094%200%200%201%200-1.547l6.704-6.704a1.095%201.095%200%200%201%201.548%200l20.113%2020.112%2041.113-41.113a1.095%201.095%200%200%201%201.548%200l6.703%206.704a1.094%201.094%200%200%201%200%201.548z%22%2F%3E%3C%2Fsvg%3E%0A\");\n position: absolute;\n left: calc(var(--padding-3) - var(--padding-1));\n top: calc(50% - 8px);\n }\n\n [role=\"menuitem\"]:focus-visible {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n outline: 0;\n }\n\n .menu-item-subtitle {\n font-size: 11px;\n opacity: 0.6;\n }\n\n .heading {\n text-transform: uppercase;\n margin-bottom: var(--padding-2);\n padding: 0 var(--padding-3);\n font-size: 11px;\n font-weight: bold;\n }\n </style>\n\n <slot>\n <div class=\"heading\">Max quality</div>\n <div class=\"menu\"></div>\n </slot>\n";
3773
+ var _s = /* @__PURE__ */ new WeakMap(), vs = /* @__PURE__ */ new WeakMap(), ys = /* @__PURE__ */ new WeakMap(), bs = /* @__PURE__ */ new WeakMap(), xs = /* @__PURE__ */ new WeakMap(), Ss = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), Cs = class extends HTMLElement {
3774
+ constructor() {
3775
+ super(), p(this, X), n(this, _s, []), n(this, vs, 2 ** 53 - 1), n(this, ys, null), n(this, bs, []), n(this, xs, null), n(this, Ss, null), e(this, "handleEvent", (e) => {
3776
+ switch (e.type) {
3777
+ case "keydown":
3778
+ r(X, this, ks).call(this, e);
3779
+ break;
3780
+ }
3781
+ }), this.attachShadow({ mode: "open" }).appendChild(gs.content.cloneNode(!0));
3782
+ }
3783
+ connectedCallback() {
3784
+ let e = this.getRootNode();
3785
+ if (e instanceof ShadowRoot) {
3786
+ var t;
3787
+ m(xs, this, e.host.closest("vindral-controller")), (t = o(xs, this)) == null || t.connectListener(this), r(X, this, ws).call(this), r(X, this, Ts).call(this), m(Ss, this, e.host), this.addEventListener("keydown", this);
3788
+ }
3789
+ }
3790
+ disconnectedCallback() {
3791
+ var e;
3792
+ (e = o(xs, this)) == null || e.disconnectListener(this), this.removeEventListener("keydown", this);
3793
+ }
3794
+ attributeChangedCallback(e, t, n) {
3795
+ t !== n && (e === h.RENDITION_LEVELS && n && (this.list = JSON.parse(n)), e === h.MAX_VIDEO_BITRATE && n && (this.maxVideoBitrate = n ? parseInt(n) : 2 ** 53 - 1));
3796
+ }
3797
+ set list(e) {
3798
+ m(_s, this, e), r(X, this, Ts).call(this);
3799
+ }
3800
+ set maxVideoBitrate(e) {
3801
+ m(vs, this, e), r(X, this, Ds).call(this);
3802
+ }
3803
+ get keysUsed() {
3804
+ return [
3805
+ "Enter",
3806
+ "Escape",
3807
+ "Tab",
3808
+ " ",
3809
+ "ArrowDown",
3810
+ "ArrowUp",
3811
+ "Home",
3812
+ "End"
3813
+ ];
3814
+ }
3815
+ focus() {
3816
+ var e;
3817
+ (e = o(ys, this)) == null || e.focus();
3818
+ }
3819
+ };
3820
+ function ws() {
3821
+ new IntersectionObserver((e) => {
3822
+ e.forEach((e) => {
3823
+ if (e.intersectionRatio !== 1) if (e.intersectionRatio > 0) {
3824
+ let t = this.offsetHeight * e.intersectionRatio - 24;
3825
+ this.style.height = `${t}px`;
3826
+ } else this.style.height = "auto";
3827
+ });
3828
+ }, {
3829
+ root: o(xs, this),
3830
+ threshold: 0
3831
+ }).observe(this);
3832
+ }
3833
+ function Ts() {
3834
+ var e;
3835
+ let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".menu");
3836
+ t && (m(bs, this, []), t.innerHTML = "", o(_s, this).sort((e, t) => {
3837
+ var n, r;
3838
+ return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
3839
+ }).forEach((e) => {
3840
+ var n, i, a, s, c, l, u, ee;
3841
+ let d = document.createElement("div");
3842
+ d.setAttribute("role", "menuitem"), d.setAttribute("value", String((n = e.video) == null ? void 0 : n.height)), d.classList.add("menu-item"), d.tabIndex = -1;
3843
+ let te = r(X, this, Es).call(this, (i = e.video) == null ? void 0 : i.frameRate);
3844
+ d.textContent = e.video ? be(e.video) : "";
3845
+ let f = document.createElement("span");
3846
+ f.classList.add("menu-item-subtitle"), f.textContent = `${ye(((a = (s = e.video) == null ? void 0 : s.bitRate) == null ? 0 : a) + ((c = (l = e.audio) == null ? void 0 : l.bitRate) == null ? 0 : c))}, ${te}p`, d.appendChild(f), d.addEventListener("click", () => r(X, this, Os).call(this, e)), o(bs, this).push({
3847
+ el: d,
3848
+ id: (u = (ee = e.video) == null ? void 0 : ee.id) == null ? -1 : u
3849
+ }), t.appendChild(d);
3850
+ }), r(X, this, Ds).call(this));
3851
+ }
3852
+ function Es(e) {
3853
+ return e ? e[0] % e[1] === 0 ? (e[0] / e[1]).toString() : (e[0] / e[1]).toFixed(2) : "";
3854
+ }
3855
+ function Ds() {
3856
+ o(ys, this) && (o(ys, this).removeAttribute("aria-selected"), o(ys, this).tabIndex = -1);
3857
+ let e = o(_s, this).sort((e, t) => {
3858
+ var n, r;
3859
+ return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
3860
+ }), t = o(_s, this).filter((e) => {
3861
+ var t;
3862
+ return ((t = e.video) == null ? void 0 : t.bitRate) && e.video.bitRate <= o(vs, this);
3863
+ })[0] || e[e.length - 1];
3864
+ if (t) {
3865
+ let e = o(bs, this).find((e) => {
3866
+ var n;
3867
+ return e.id === ((n = t.video) == null ? void 0 : n.id);
3868
+ });
3869
+ e && (e.el.tabIndex = 0, e.el.setAttribute("aria-selected", "true"), m(ys, this, e.el));
3870
+ }
3871
+ }
3872
+ function Os(e) {
3873
+ this.dispatchEvent(new Event("change", {
3874
+ bubbles: !0,
3875
+ composed: !0
3876
+ })), this.dispatchEvent(new CustomEvent(g.SET_RENDITION, {
3877
+ bubbles: !0,
3878
+ composed: !0,
3879
+ detail: e
3880
+ }));
3881
+ }
3882
+ function ks(e) {
3883
+ let { key: t, ctrlKey: n, altKey: i, metaKey: a } = e;
3884
+ if (!(n || i || a) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") {
3885
+ var s;
3886
+ (s = o(Ss, this)) == null || s.hide();
3887
+ } else if (t === "Enter" || t === " ") {
3888
+ var c;
3889
+ (c = r(X, this, js).call(this)) == null || (c = c.el) == null || c.click();
3890
+ } else r(X, this, As).call(this, e);
3891
+ }
3892
+ function As(e) {
3893
+ var t;
3894
+ let { key: n } = e, i = o(bs, this), a = (t = r(X, this, js).call(this)) == null ? i[0] : t;
3895
+ if (!a) return;
3896
+ let s = i.indexOf(a), c = Math.max(0, s);
3897
+ n === "ArrowDown" ? c++ : n === "ArrowUp" ? c-- : e.key === "Home" ? c = 0 : e.key === "End" && (c = i.length - 1), c < 0 && (c = i.length - 1), c > i.length - 1 && (c = 0);
3898
+ let l = i[c];
3899
+ l && (r(X, this, Ms).call(this, l.id), l.el.focus());
3900
+ }
3901
+ function js() {
3902
+ return o(bs, this).find((e) => e.el.tabIndex === 0);
3903
+ }
3904
+ function Ms(e) {
3905
+ for (let t of o(bs, this)) t.el.tabIndex = t.id === e ? 0 : -1;
3906
+ }
3907
+ e(Cs, "observedAttributes", [h.RENDITION_LEVELS, h.MAX_VIDEO_BITRATE]);
3908
+ //#endregion
3909
+ //#region ../../libs/player-next/src/components/ScrollOverlay.ts
3910
+ var Ns = document.createElement("template");
3911
+ Ns.innerHTML = `
3912
+ <style>
3913
+ :host {
3914
+ --scroll-overlay-offset: var(--vindral-scroll-overlay-offset, 0px);
3915
+
3916
+ position: absolute;
3917
+ top: 0;
3918
+ width: 100%;
3919
+ height: 100%;
3920
+ overflow-y: scroll !important;
3921
+ pointer-events: none !important;
3922
+ display: block;
3923
+ transition: background-color 0.5s ease-in-out;
3924
+ -ms-overflow-style: none;
3925
+ scrollbar-width: none;
3926
+ }
3927
+
3928
+ :host([snap]) {
3929
+ scroll-snap-type: y mandatory;
3930
+ scroll-behavior: smooth;
3931
+ }
3932
+
3933
+ :host([snap-touch]) {
3934
+ scroll-snap-type: y mandatory;
3935
+ scroll-behavior: smooth;
3936
+ pointer-events: auto !important;
3937
+ }
3938
+
3939
+ :host([open]) #scroll-area {
3940
+ width: 100%;
3941
+ cursor: pointer;
3942
+ }
3943
+
3944
+ :host([open]) {
3945
+ background-color: rgba(0, 0, 0, 0.5);
3946
+ }
3947
+
3948
+ :host::-webkit-scrollbar {
3949
+ display: none;
3950
+ }
3951
+
3952
+ #scroll-area {
3953
+ margin: 0 auto;
3954
+ width: 1px;
3955
+ height: calc(100% - var(--scroll-overlay-offset));
3956
+ pointer-events: auto;
3957
+ scroll-snap-align: start;
3958
+ min-height: 1px;
3959
+ -webkit-tap-highlight-color: transparent;
3960
+ }
3961
+
3962
+ slot#content {
3963
+ display: flex;
3964
+ margin: 0 auto;
3965
+ width: 100%;
3966
+ pointer-events: auto;
3967
+ scroll-snap-align: start;
3968
+ flex-direction: column;
3969
+ }
3970
+
3971
+ :host(:not([${h.USER_INTERACTING}])) {
3972
+ overflow: hidden !important;
3973
+ }
3974
+ </style>
3975
+
3976
+ <div id="scroll-area"></div>
3977
+ <slot id="content"></slot>
3978
+ `;
3979
+ var Ps = /* @__PURE__ */ new WeakMap(), Fs = /* @__PURE__ */ new WeakMap(), Is = /* @__PURE__ */ new WeakMap(), Ls = /* @__PURE__ */ new WeakMap(), Rs = /* @__PURE__ */ new WeakMap(), zs = /* @__PURE__ */ new WeakMap(), Bs = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakSet(), Vs = /* @__PURE__ */ new WeakMap(), Hs = class extends HTMLElement {
3980
+ constructor() {
3981
+ super(), p(this, Z), n(this, Ps, null), n(this, Fs, null), n(this, Is, !1), n(this, Ls, !1), n(this, Rs, !1), n(this, zs, () => {
3982
+ this.open && (this.open = !1);
3983
+ }), n(this, Bs, null), e(this, "handleEvent", (e) => {
3984
+ switch (e.type) {
3985
+ case "touchstart":
3986
+ r(Z, this, Ws).call(this, e);
3987
+ break;
3988
+ case "touchmove":
3989
+ r(Z, this, Gs).call(this, e);
3990
+ break;
3991
+ case "touchend":
3992
+ r(Z, this, Ks).call(this, e);
3993
+ break;
3994
+ }
3995
+ }), n(this, Vs, () => {
3996
+ let e = o(Rs, this);
3997
+ if (this.scrollTop === 0) {
3998
+ r(Z, this, ec).call(this, e);
3999
+ return;
4000
+ }
4001
+ if (!e && !r(Z, this, qs).call(this)) {
4002
+ r(Z, this, Qs).call(this), r(Z, this, ec).call(this);
4003
+ return;
4004
+ }
4005
+ !this.visible && this.scrollTop > 0 && !o(Is, this) ? r(Z, this, tc).call(this) : !o(Is, this) && r(Z, this, Ys).call(this) && (this.open || (this.open = !0), e && !this.hasAttribute("snap-touch") && this.setAttribute("snap-touch", ""));
4006
+ }), this.attachShadow({ mode: "open" }).appendChild(Ns.content.cloneNode(!0));
4007
+ }
4008
+ connectedCallback() {
4009
+ let e = this.getRootNode();
4010
+ if (e instanceof Document || e instanceof ShadowRoot) {
4011
+ var t, n, r;
4012
+ m(Ps, this, e.querySelector("vindral-controller")), (t = o(Ps, this)) == null || t.connectListener(this), m(Fs, this, (n = this.shadowRoot) == null ? void 0 : n.querySelector("#scroll-area")), (r = o(Fs, this)) == null || r.addEventListener("click", o(zs, this));
4013
+ let c = this.hasAttribute("touch-enabled");
4014
+ if (m(Rs, this, le() && c), !o(Rs, this)) this.setAttribute("snap", "");
4015
+ else {
4016
+ var i, a, s;
4017
+ (i = o(Ps, this)) == null || i.addEventListener("touchstart", this, { passive: !0 }), (a = o(Ps, this)) == null || a.addEventListener("touchmove", this, { passive: !1 }), (s = o(Ps, this)) == null || s.addEventListener("touchend", this, { passive: !0 });
4018
+ }
4019
+ this.addEventListener("scroll", o(Vs, this));
4020
+ }
4021
+ }
4022
+ disconnectedCallback() {
4023
+ var e, t, n, r, i;
4024
+ (e = o(Fs, this)) == null || e.removeEventListener("click", o(zs, this)), this.removeEventListener("scroll", o(Vs, this)), (t = o(Ps, this)) == null || t.removeEventListener("touchstart", this), (n = o(Ps, this)) == null || n.removeEventListener("touchmove", this), (r = o(Ps, this)) == null || r.removeEventListener("touchend", this), (i = o(Ps, this)) == null || i.disconnectListener(this);
4025
+ }
4026
+ attributeChangedCallback(e, t, n) {
4027
+ if (t !== n && (e === h.USER_INTERACTING && n === null && r(Z, this, Js).call(this) && setTimeout(() => {
4028
+ this.open = !1;
4029
+ }, 300), e === "open")) if (n !== null) {
4030
+ var i;
4031
+ m(Is, this, !1), this.scrollTop > 0 && r(Z, this, tc).call(this), this.scrollTo({
4032
+ top: (i = o(Fs, this)) == null ? void 0 : i.clientHeight,
4033
+ behavior: "smooth"
4034
+ });
4035
+ } else r(Z, this, $s).call(this);
4036
+ }
4037
+ set open(e) {
4038
+ if (e) {
4039
+ this.setAttribute("open", "");
4040
+ return;
4041
+ }
4042
+ let t = this.hasAttribute("open"), n = this.visible || r(Z, this, Js).call(this);
4043
+ t ? this.removeAttribute("open") : n ? r(Z, this, $s).call(this) : (m(Is, this, !1), this.removeAttribute("snap-touch"));
4044
+ }
4045
+ get open() {
4046
+ return this.hasAttribute("open");
4047
+ }
4048
+ set visible(e) {
4049
+ e ? this.setAttribute("visible", "") : this.removeAttribute("visible");
4050
+ }
4051
+ get visible() {
4052
+ return this.hasAttribute("visible");
4053
+ }
4054
+ };
4055
+ function Us() {
4056
+ return r(Z, this, qs).call(this) || r(Z, this, Zs).call(this) || r(Z, this, Js).call(this);
4057
+ }
4058
+ function Ws(e) {
4059
+ let t = e.touches[0];
4060
+ t && (m(Ls, this, r(Z, this, Us).call(this)), o(Ls, this) && (m(Is, this, !1), m(Bs, this, t.clientY)));
4061
+ }
4062
+ function Gs(e) {
4063
+ if (!(!o(Ls, this) || o(Bs, this) === null || this.hasAttribute("snap-touch") && this.open) && (e.preventDefault(), e.touches[0])) {
4064
+ let t = e.touches[0].clientY, n = o(Bs, this) - t;
4065
+ this.scrollTop = Math.max(0, n);
4066
+ }
4067
+ }
4068
+ function Ks(e) {
4069
+ o(Ls, this) && !o(Is, this) && r(Z, this, Js).call(this) && (!this.hasAttribute("snap-touch") || !this.open) && (this.open = !0), m(Bs, this, null), m(Ls, this, !1);
4070
+ }
4071
+ function qs() {
4072
+ return this.hasAttribute(h.USER_INTERACTING);
4073
+ }
4074
+ function Js() {
4075
+ return this.scrollTop > 0;
4076
+ }
4077
+ function Ys() {
4078
+ var e;
4079
+ return Math.round(this.scrollTop) === this.scrollHeight - this.clientHeight || Math.round(this.scrollTop) === ((e = o(Fs, this)) == null ? void 0 : e.clientHeight);
4080
+ }
4081
+ function Xs() {
4082
+ var e;
4083
+ let t = (e = o(Fs, this)) == null ? void 0 : e.clientHeight;
4084
+ return !t || this.clientHeight <= 0 ? 0 : Math.max(this.clientHeight - t, 0);
4085
+ }
4086
+ function Zs() {
4087
+ let e = getComputedStyle(this), t = Number.parseFloat(e.getPropertyValue("--vindral-scroll-overlay-offset"));
4088
+ return Number.isNaN(t) ? r(Z, this, Xs).call(this) > 0 : t > 0;
4089
+ }
4090
+ function Qs() {
4091
+ let e = this.style.scrollBehavior;
4092
+ this.style.scrollBehavior = "auto", this.scrollTo({
4093
+ top: 0,
4094
+ behavior: "auto"
4095
+ }), this.style.scrollBehavior = e;
4096
+ }
4097
+ function $s() {
4098
+ m(Is, this, !0), this.removeAttribute("snap-touch"), r(Z, this, nc).call(this), this.scrollTo({
4099
+ top: 0,
4100
+ behavior: "smooth"
4101
+ });
4102
+ }
4103
+ function ec(e = !1) {
4104
+ this.open = !1, e && this.removeAttribute("snap-touch"), m(Is, this, !1), r(Z, this, nc).call(this);
4105
+ }
4106
+ function tc() {
4107
+ this.visible || (this.visible = !0, this.dispatchEvent(new CustomEvent(g.LOCK_UI, {
4108
+ bubbles: !0,
4109
+ composed: !0
4110
+ })));
4111
+ }
4112
+ function nc() {
4113
+ this.visible && (this.visible = !1, this.dispatchEvent(new CustomEvent(g.UNLOCK_UI, {
4114
+ bubbles: !0,
4115
+ composed: !0
4116
+ })));
4117
+ }
4118
+ e(Hs, "observedAttributes", [
4119
+ h.USER_INTERACTING,
4120
+ "open",
4121
+ "touch-enabled"
4122
+ ]);
4123
+ //#endregion
4124
+ //#region ../../libs/player-next/src/components/SeekBar.ts
4125
+ var rc = document.createElement("template");
4126
+ rc.innerHTML = "\n <style>\n :host {\n --buffered: 0;\n --vindral-range-thickness: 3px;\n --vindral-range-hover-thickness: 5px;\n --vindral-range-thumb-size: 10px;\n --vindral-range-thumb-hover-size: 15px;\n --vindral-range-fill-color: linear-gradient(\n 90deg,\n #03a9f4 0%,\n #03a9f4 calc(100% - min(20%, 150px)),\n #b3e5fc 100%\n );\n --vindral-range-thumb-color: #03a9f4;\n display: var(--seek-bar-display);\n position: relative;\n }\n\n :host([data-no-duration]) {\n display: none;\n }\n\n #hover-preview {\n position: absolute;\n background-color: rgba(255, 255, 255, 0.6);\n opacity: 0;\n pointer-events: none;\n z-index: 1;\n }\n\n #time-tooltip {\n position: absolute;\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%) translateY(-8px);\n background: rgba(0, 0, 0, 0.8);\n color: white;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 12px;\n white-space: nowrap;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.2s;\n z-index: 10;\n }\n\n @media (hover: none) {\n #time-tooltip {\n display: none;\n }\n }\n </style>\n\n <div id=\"buffered-track\"></div>\n <div id=\"hover-preview\"></div>\n <div id=\"time-tooltip\"></div>\n";
4127
+ var Q = /* @__PURE__ */ new WeakMap(), ic = /* @__PURE__ */ new WeakMap(), ac = /* @__PURE__ */ new WeakMap(), oc = /* @__PURE__ */ new WeakMap(), sc = /* @__PURE__ */ new WeakMap(), cc = /* @__PURE__ */ new WeakMap(), lc = /* @__PURE__ */ new WeakMap(), uc = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakSet(), dc = /* @__PURE__ */ new WeakMap(), fc = /* @__PURE__ */ new WeakMap(), pc = /* @__PURE__ */ new WeakMap(), mc = /* @__PURE__ */ new WeakMap(), hc = /* @__PURE__ */ new WeakMap(), gc = /* @__PURE__ */ new WeakMap(), _c = class extends Ur {
4128
+ constructor() {
4129
+ var e, t, i;
4130
+ super(), p(this, $), n(this, Q, void 0), n(this, ic, void 0), n(this, ac, void 0), n(this, oc, !1), n(this, sc, null), n(this, cc, null), n(this, lc, !1), n(this, uc, !1), n(this, dc, (e) => {
4131
+ if (!r($, this, yc).call(this) || r($, this, bc).call(this)) {
4132
+ e.preventDefault();
4133
+ return;
4134
+ }
4135
+ m(oc, this, !0), m(cc, this, e.pointerId);
4136
+ try {
4137
+ this.setPointerCapture(e.pointerId);
4138
+ } catch (e) {}
4139
+ r($, this, Cc).call(this, e);
4140
+ }), n(this, fc, (e) => {
4141
+ if (!(!r($, this, yc).call(this) || r($, this, bc).call(this))) {
4142
+ if (o(sc, this) && (cancelAnimationFrame(o(sc, this)), m(sc, this, null)), o(oc, this) && e.pointerId === o(cc, this)) {
4143
+ e.preventDefault(), r($, this, Cc).call(this, e);
4144
+ return;
4145
+ }
4146
+ m(sc, this, requestAnimationFrame(() => {
4147
+ if (e.pointerType !== "mouse" || o(oc, this) || !this.duration) {
4148
+ o(ac, this).style.opacity = "0", m(sc, this, null);
4149
+ return;
4150
+ }
4151
+ let t = r($, this, Sc).call(this, e.clientX);
4152
+ if (r($, this, Tc).call(this, t, e.clientX), t > this.range.valueAsNumber) {
4153
+ let e = this.range.valueAsNumber * 100, n = (t - this.range.valueAsNumber) * 100;
4154
+ o(ac, this).style.transform = `translateX(${e}%) scaleX(${n / 100})`, o(ac, this).style.opacity = "1";
4155
+ } else o(ac, this).style.opacity = "0";
4156
+ m(sc, this, null);
4157
+ }));
4158
+ }
4159
+ }), n(this, pc, (e) => {
4160
+ if (e.pointerId === o(cc, this)) {
4161
+ try {
4162
+ this.releasePointerCapture(e.pointerId);
4163
+ } catch (e) {}
4164
+ m(oc, this, !1), m(cc, this, null), e.pointerType !== "mouse" && (o(ic, this).style.opacity = "0"), o(uc, this) && r($, this, Oc).call(this) && (m(lc, this, !1), m(uc, this, !1));
4165
+ }
4166
+ }), n(this, mc, () => {
4167
+ this.duration && !r($, this, bc).call(this) && (o(ic, this).style.opacity = "1");
4168
+ }), n(this, hc, () => {
4169
+ o(ic, this).style.opacity = "0", o(ac, this).style.opacity = "0";
4170
+ }), n(this, gc, (e) => {
4171
+ if (r($, this, bc).call(this) || !o(Q, this) || o(Q, this) <= 0 || !isFinite(o(Q, this))) return;
4172
+ let t = r($, this, vc).call(this);
4173
+ if (t <= 0) return;
4174
+ let n = this.range.valueAsNumber * t, i = n;
4175
+ switch (e.preventDefault(), e.key) {
4176
+ case "ArrowLeft":
4177
+ i = Math.max(0, n - 5);
4178
+ break;
4179
+ case "ArrowRight":
4180
+ if (r($, this, Oc).call(this)) return;
4181
+ i = Math.min(t, n + 5);
4182
+ break;
4183
+ case "Home":
4184
+ i = 0;
4185
+ break;
4186
+ case "End":
4187
+ if (r($, this, Oc).call(this)) return;
4188
+ i = t;
4189
+ break;
4190
+ default: return;
4191
+ }
4192
+ let a = Math.min(i / t, 1);
4193
+ r($, this, wc).call(this, a);
4194
+ }), (e = this.shadowRoot) == null || e.appendChild(rc.content.cloneNode(!0)), m(ic, this, (t = this.shadowRoot) == null ? void 0 : t.getElementById("time-tooltip")), m(ac, this, (i = this.shadowRoot) == null ? void 0 : i.getElementById("hover-preview")), this.addEventListener("pointerdown", o(dc, this)), this.addEventListener("pointermove", o(fc, this)), this.addEventListener("pointerup", o(pc, this)), this.addEventListener("pointercancel", o(pc, this)), this.addEventListener("mouseenter", o(mc, this)), this.addEventListener("mouseleave", o(hc, this));
4195
+ }
4196
+ connectedCallback() {
4197
+ super.connectedCallback(), this.setAttribute("aria-label", "Seek video position"), this.setAttribute("role", "slider"), r($, this, xc).call(this), this.addEventListener("keydown", o(gc, this)), r($, this, Oc).call(this) && (this.range.value = "1", r($, this, xc).call(this));
4198
+ }
4199
+ disconnectedCallback() {
4200
+ super.disconnectedCallback(), this.removeEventListener("pointerdown", o(dc, this)), this.removeEventListener("pointermove", o(fc, this)), this.removeEventListener("pointerup", o(pc, this)), this.removeEventListener("pointercancel", o(pc, this)), this.removeEventListener("mouseenter", o(mc, this)), this.removeEventListener("mouseleave", o(hc, this)), this.removeEventListener("keydown", o(gc, this)), m(cc, this, null);
4201
+ }
4202
+ attributeChangedCallback(e, t, n) {
4203
+ if (super.attributeChangedCallback(e, t, n), t !== n) switch (e) {
4204
+ case h.TIMESHIFT_POSITION:
4205
+ if (r($, this, Oc).call(this)) {
4206
+ o(oc, this) ? m(uc, this, !0) : (m(lc, this, !1), m(uc, this, !1)), this.range.value = "1", r($, this, xc).call(this);
4207
+ return;
4208
+ }
4209
+ if (o(Q, this)) {
4210
+ m(uc, this, !1);
4211
+ let e = Math.max(parseFloat(n) / o(Q, this), 0);
4212
+ this.range.value = e.toString(), r($, this, xc).call(this);
4213
+ }
4214
+ break;
4215
+ case h.DURATION:
4216
+ m(Q, this, parseFloat(n) || 0), r($, this, xc).call(this);
4217
+ break;
4218
+ }
4219
+ }
4220
+ get keysUsed() {
4221
+ return [
4222
+ ...super.keysUsed,
4223
+ "Home",
4224
+ "End"
4225
+ ];
4226
+ }
4227
+ get duration() {
4228
+ return o(Q, this);
4229
+ }
4230
+ set duration(e) {
4231
+ this.setAttribute(h.DURATION, e.toString());
4232
+ }
4233
+ };
4234
+ function vc() {
4235
+ return o(Q, this) ? o(Q, this) : 1;
4236
+ }
4237
+ function yc() {
4238
+ return !!o(Q, this) && o(Q, this) > 0 && isFinite(o(Q, this));
4239
+ }
4240
+ function bc() {
4241
+ return o(lc, this);
4242
+ }
4243
+ function xc() {
4244
+ let e = r($, this, vc).call(this);
4245
+ !o(Q, this) || o(Q, this) <= 0 || !isFinite(o(Q, this)) ? this.setAttribute("data-no-duration", "") : this.removeAttribute("data-no-duration"), o(oc, this) || (this.updateBar(), this.setAttribute("aria-valuetext", `${r($, this, kc).call(this, this.range.valueAsNumber * e)} of ${r($, this, kc).call(this, e)}`), !o(oc, this) && !r($, this, bc).call(this) && r($, this, Dc).call(this, this.range.valueAsNumber));
4246
+ }
4247
+ function Sc(e) {
4248
+ let t = this.getBoundingClientRect(), n = (e - t.left) / t.width;
4249
+ return Math.max(0, Math.min(1, n));
4250
+ }
4251
+ function Cc(e) {
4252
+ let t = r($, this, Sc).call(this, e.clientX);
4253
+ r($, this, Tc).call(this, t, e.clientX), o(oc, this) || (o(ic, this).style.opacity = "1"), r($, this, wc).call(this, t);
4254
+ }
4255
+ function wc(e) {
4256
+ if (r($, this, bc).call(this) || r($, this, Dc).call(this, e)) return;
4257
+ let t = e * r($, this, vc).call(this);
4258
+ this.range.value = e.toString(), this.updateBar(), r($, this, Ec).call(this, t);
4259
+ }
4260
+ function Tc(e, t) {
4261
+ if (!o(Q, this) || !isFinite(o(Q, this))) return;
4262
+ let n = e * o(Q, this), i = o(Q, this) - n;
4263
+ o(ic, this).textContent = `-${r($, this, kc).call(this, i)}`;
4264
+ let a = this.getBoundingClientRect(), s = (t - a.left) / a.width * 100;
4265
+ o(ic, this).style.left = `${Math.min(Math.max(s, 2), 98)}%`;
4266
+ }
4267
+ function Ec(e) {
4268
+ this.dispatchEvent(new CustomEvent("seek", {
4269
+ bubbles: !0,
4270
+ composed: !0,
4271
+ detail: e
4272
+ }));
4273
+ }
4274
+ function Dc(e) {
4275
+ return o(lc, this) || r($, this, Oc).call(this) || e < .999 ? !1 : (m(lc, this, !0), m(uc, this, !1), this.dispatchEvent(new CustomEvent(g.GO_LIVE, {
4276
+ bubbles: !0,
4277
+ composed: !0
4278
+ })), !0);
4279
+ }
4280
+ function Oc() {
4281
+ return !this.hasAttribute(h.TIMESHIFT_POSITION);
4282
+ }
4283
+ function kc(e) {
4284
+ let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
4285
+ return o(Q, this) && o(Q, this) >= 3600 ? `${t}:${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}` : `${n}:${r.toString().padStart(2, "0")}`;
4286
+ }
4287
+ e(_c, "observedAttributes", [
4288
+ ...Ur.observedAttributes,
4289
+ h.TIMESHIFT_POSITION,
4290
+ h.DURATION
4291
+ ]);
4292
+ //#endregion
4293
+ //#region ../../libs/player-next/src/components/UserInputPlayOverlay.ts
4294
+ var Ac = document.createElement("template");
4295
+ Ac.innerHTML = `
4296
+ <style>
4297
+ :host {
4298
+ display: var(--play-overlay-display);
4299
+ align-items: center;
4300
+ justify-content: center;
4301
+ position: absolute;
4302
+ top: 0;
4303
+ bottom: 0;
4304
+ left: 0;
4305
+ right: 0;
4306
+ z-index: 1;
4307
+ pointer-events: none;
4308
+ }
4309
+
4310
+ :host([hidden]) {
4311
+ display: none;
4312
+ }
4313
+
4314
+ /* Make icon slots clickable */
4315
+ slot[name="play"],
4316
+ slot[name="unmute"] {
4317
+ color: var(--fg-strong);
4318
+ pointer-events: auto;
4319
+ cursor: pointer;
4320
+ }
4321
+
4322
+ :host(:focus-visible) svg {
4323
+ box-shadow: inset 0 0 0 2px var(--fg-strong);
4324
+ outline: 0;
4325
+ }
4326
+
4327
+ :host(:active) svg {
4328
+ scale: 0.9;
4329
+ }
4330
+
4331
+ slot > svg {
4332
+ width: var(--play-overlay-icon-size);
4333
+ height: var(--play-overlay-icon-size);
4334
+ }
4335
+
4336
+ :host(:not([${h.NEEDS_USER_INPUT_VIDEO}]):not([${h.PAUSED}])) slot[name="play"] {
4337
+ display: none !important;
4338
+ }
4339
+
4340
+ :host([${h.PAUSED}]) slot[name="unmute"],
4341
+ :host(:not([${h.NEEDS_USER_INPUT_AUDIO}])) slot[name="unmute"] {
4342
+ display: none !important;
4343
+ }
4344
+ </style>
4345
+
4346
+ <slot name="icon">
4347
+ <slot name="play">
4348
+ <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>
4349
+ </slot>
4350
+ <slot name="unmute">
4351
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" stroke="currentColor"><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" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" /></g></svg>
4352
+ </slot>
4353
+ </slot>
4354
+ `;
4355
+ var jc = /* @__PURE__ */ new WeakMap(), Mc = /* @__PURE__ */ new WeakMap(), Nc = /* @__PURE__ */ new WeakMap(), Pc = /* @__PURE__ */ new WeakMap(), Fc = class extends HTMLElement {
4356
+ constructor() {
4357
+ super(), n(this, jc, null), n(this, Mc, () => {
4358
+ this.dispatchEvent(new CustomEvent(g.REQUEST_USER_INPUT, {
4359
+ bubbles: !0,
4360
+ composed: !0
4361
+ }));
4362
+ }), n(this, Nc, (e) => {
4363
+ let { key: t } = e;
4364
+ if (!this.keysUsed.includes(t)) {
4365
+ this.removeEventListener("keyup", o(Nc, this));
4366
+ return;
4367
+ }
4368
+ this.dispatchEvent(new CustomEvent(g.REQUEST_USER_INPUT, {
4369
+ bubbles: !0,
4370
+ composed: !0
4371
+ }));
4372
+ }), n(this, Pc, (e) => {
4373
+ let { metaKey: t, altKey: n, key: r } = e;
4374
+ if (t || n || !this.keysUsed.includes(r)) {
4375
+ this.removeEventListener("keyup", o(Nc, this));
4376
+ return;
4377
+ }
4378
+ this.addEventListener("keyup", o(Nc, this), { once: !0 });
4379
+ }), this.attachShadow({ mode: "open" }).appendChild(Ac.content.cloneNode(!0));
4380
+ }
4381
+ get keysUsed() {
4382
+ return ["Enter", " "];
4383
+ }
4384
+ connectedCallback() {
4385
+ var e;
4386
+ m(jc, this, this.closest("vindral-controller")), (e = o(jc, this)) == null || e.connectListener(this), this.setAttribute("aria-label", "Play"), this.setAttribute("role", "button"), this.enable();
4387
+ }
4388
+ enable() {
4389
+ this.addEventListener("click", o(Mc, this)), this.addEventListener("keydown", o(Pc, this)), this.tabIndex = 0;
4390
+ }
4391
+ disable() {
4392
+ this.removeEventListener("click", o(Mc, this)), this.removeEventListener("keydown", o(Pc, this)), this.removeEventListener("keyup", o(Nc, this)), this.tabIndex = -1;
4393
+ }
4394
+ disconnectedCallback() {
4395
+ var e;
4396
+ (e = o(jc, this)) == null || e.disconnectListener(this), this.disable();
4397
+ }
4398
+ };
4399
+ e(Fc, "observedAttributes", [
4400
+ "hidden",
4401
+ h.NEEDS_USER_INPUT_VIDEO,
4402
+ h.NEEDS_USER_INPUT_AUDIO,
4403
+ h.PAUSED
4404
+ ]);
4405
+ //#endregion
4406
+ //#region ../../libs/player-next/src/components/VindralMessage.ts
4407
+ var Ic = document.createElement("template");
4408
+ Ic.innerHTML = "\n <style>\n :host,\n #background {\n position: absolute;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n top: 0;\n left: 0;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n background-size: contain;\n font-size: 20px;\n color: var(--fg-strong);\n pointer-events: none;\n transition: opacity 100ms;\n background-color: rgba(0, 0, 0, 0.3);\n }\n\n :host([hidden]) {\n opacity: 0;\n }\n\n #message-container {\n position: absolute;\n left: 50%;\n bottom: calc(50% + var(--play-overlay-icon-size));\n transform: translateX(-50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n width: max-content;\n max-width: 90%;\n pointer-events: none;\n }\n\n #title,\n #description {\n text-align: center;\n text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);\n margin: 0;\n }\n\n #title {\n margin-bottom: var(--padding-2);\n }\n\n @container (max-width: 600px) {\n :host {\n font-size: 15px;\n }\n #message-container {\n bottom: 0;\n top: var(--padding-1);\n }\n }\n\n @container (max-width: 400px) {\n :host {\n font-size: 12px;\n }\n #title {\n margin-bottom: 0;\n }\n }\n\n @container (max-width: 150px) {\n :host {\n font-size: 10px;\n }\n #title,\n #description {\n font-size: 1.2em;\n margin: 0;\n }\n }\n </style>\n\n <div id=\"background\"></div>\n <div id=\"message-container\">\n <h1 id=\"title\"></h1>\n <p id=\"description\"></p>\n </div>\n";
4409
+ var Lc = /* @__PURE__ */ new WeakMap(), Rc = /* @__PURE__ */ new WeakMap(), zc = /* @__PURE__ */ new WeakMap(), Bc = class extends HTMLElement {
4410
+ constructor() {
4411
+ super(), n(this, Lc, void 0), n(this, Rc, void 0), n(this, zc, void 0);
4412
+ let e = this.attachShadow({ mode: "open" });
4413
+ e.appendChild(Ic.content.cloneNode(!0)), m(Lc, this, e.querySelector("#title")), m(Rc, this, e.querySelector("#description")), m(zc, this, e.querySelector("#background"));
4414
+ }
4415
+ connectedCallback() {}
4416
+ disconnectedCallback() {}
4417
+ attributeChangedCallback(e, t, n) {
4418
+ t !== n && (e === "title" ? o(Lc, this).textContent = n : e === "description" ? o(Rc, this).textContent = n : e === "background-image" && (o(zc, this).style.backgroundImage = `url(${n})`));
4419
+ }
4420
+ };
4421
+ e(Bc, "observedAttributes", [
4422
+ "title",
4423
+ "description",
4424
+ "background-image",
4425
+ "hidden"
4426
+ ]);
4427
+ //#endregion
4428
+ //#region ../../libs/player-next/src/components/VindralPlayOverlay.ts
4429
+ var Vc = document.createElement("template");
4430
+ Vc.innerHTML = "\n <style>\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1;\n pointer-events: none;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n :host(:focus-visible) {\n outline: none;\n outline: 0;\n }\n\n :host(:focus-visible) svg {\n outline: 0;\n }\n\n :host(:where(:focus)) svg {\n box-shadow: none;\n outline: 0;\n }\n\n :host(:active) svg {\n scale: 0.9;\n }\n\n slot#play {\n color: var(--fg-strong);\n pointer-events: auto;\n cursor: pointer;\n }\n\n slot#play > svg {\n width: var(--play-overlay-icon-size);\n height: var(--play-overlay-icon-size);\n }\n </style>\n\n <slot id=\"play\" name=\"icon\">\n <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>\n</slot>\n";
4431
+ var Hc = /* @__PURE__ */ new WeakMap(), Uc = class extends HTMLElement {
4432
+ constructor() {
4433
+ super(), n(this, Hc, null), this.attachShadow({ mode: "open" }).appendChild(Vc.content.cloneNode(!0));
4434
+ }
4435
+ connectedCallback() {
4436
+ var e;
4437
+ m(Hc, this, this.closest("vindral-controller")), (e = o(Hc, this)) == null || e.connectListener(this), this.setAttribute("aria-label", "Play"), this.setAttribute("role", "button"), this.tabIndex = 0;
4438
+ }
4439
+ disconnectedCallback() {
4440
+ var e;
4441
+ (e = o(Hc, this)) == null || e.disconnectListener(this);
4442
+ }
4443
+ attributeChangedCallback(e, t, n) {
4444
+ t !== n && e === "hidden" && !_(n) && this.focus();
4445
+ }
4446
+ };
4447
+ e(Uc, "observedAttributes", ["hidden"]);
4448
+ //#endregion
4449
+ //#region ../../libs/player-next/src/components/VolumeRange.ts
4450
+ var Wc, Gc = document.createElement("template");
4451
+ Gc.innerHTML = "\n <style>\n :host {\n display: var(--volume-range-display);\n width: 80px;\n }\n\n @media (hover: hover) and (pointer: fine) {\n :host(:hover) {\n background: rgba(255, 255, 255, 0.15);\n }\n }\n\n :host(:active) {\n background: rgba(255, 255, 255, 0.25);\n }\n </style>\n";
4452
+ var Kc = (e) => `${Math.round(e * 100)}%`, qc = /* @__PURE__ */ new WeakMap(), Jc = class extends Ur {
4453
+ constructor() {
4454
+ var e;
4455
+ super(), n(this, qc, () => {
4456
+ let e = this.range.valueAsNumber;
4457
+ this.dispatchEvent(new CustomEvent(g.SET_VOLUME, {
4458
+ bubbles: !0,
4459
+ composed: !0,
4460
+ detail: e
4461
+ }));
4462
+ }), (e = this.shadowRoot) == null || e.appendChild(Gc.content.cloneNode(!0));
4463
+ }
4464
+ connectedCallback() {
4465
+ super.connectedCallback(), this.range.addEventListener("input", o(qc, this)), this.range.setAttribute("aria-label", "volume");
4466
+ }
4467
+ disconnectedCallback() {
4468
+ super.disconnectedCallback(), this.range.removeEventListener("input", o(qc, this));
4469
+ }
4470
+ attributeChangedCallback(e, t, n) {
4471
+ super.attributeChangedCallback(e, t, n), (e === h.MUTED || e === h.VOLUME) && (this.range.valueAsNumber = this.muted ? 0 : parseFloat(this.volume), this.range.setAttribute("aria-valuetext", Kc(this.range.valueAsNumber)), this.updateBar());
4472
+ }
4473
+ get volume() {
4474
+ var e;
4475
+ return (e = this.getAttribute(h.VOLUME)) == null ? "1" : e;
4476
+ }
4477
+ get muted() {
4478
+ return this.hasAttribute(h.MUTED);
4479
+ }
4480
+ };
4481
+ Wc = Jc, e(Jc, "observedAttributes", [
4482
+ ...b(Wc, "observedAttributes", Wc),
4483
+ h.MUTED,
4484
+ h.VOLUME
4485
+ ]);
4486
+ //#endregion
4487
+ //#region ../../libs/player-next/src/registerComponents.ts
4488
+ function Yc() {
4489
+ customElements.define("vindral-controller", Hi), customElements.define("vindral-control-bar", qn), customElements.define("vindral-advanced-rendition-menu", lt), customElements.define("vindral-advanced-rendition-menu-list", xt), customElements.define("vindral-play-button", ho), customElements.define("vindral-mute-button", co), customElements.define("vindral-buffering-overlay", Ht), customElements.define("vindral-scroll-overlay", Hs), customElements.define("vindral-play-overlay", Uc), customElements.define("vindral-user-input-play-overlay", Fc), customElements.define("vindral-fullscreen-button", wa), customElements.define("vindral-rendition-levels-menu", ms), customElements.define("vindral-rendition-levels-menu-list", Cs), customElements.define("vindral-channel-grid-button", Bn), customElements.define("vindral-channel-grid", pn), customElements.define("vindral-channel-grid-item", nn), customElements.define("vindral-pip-button", fo), customElements.define("vindral-airplay-button", qe), customElements.define("vindral-cast-button", Kt), customElements.define("vindral-cast-overlay", Qt), customElements.define("vindral-buffering-icon", zt), customElements.define("vindral-language-menu", ka), customElements.define("vindral-language-menu-list", Ua), customElements.define("vindral-message", Bc), customElements.define("vindral-volume-range", Jc), customElements.define("vindral-poster-overlay", os), customElements.define("vindral-player", Ko), customElements.define("vindral-seek-bar", _c), customElements.define("vindral-live-button", ao);
4490
+ }
4491
+ //#endregion
4492
+ export { Yc as t };