@vindral/web-sdk 4.2.0 → 4.2.1

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