test-bentoweb-ui 1.0.73 → 1.0.75

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.
@@ -0,0 +1,413 @@
1
+ var Qt = Object.defineProperty;
2
+ var ot = (n) => {
3
+ throw TypeError(n);
4
+ };
5
+ var Xt = (n, t, s) => t in n ? Qt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s;
6
+ var M = (n, t, s) => Xt(n, typeof t != "symbol" ? t + "" : t, s), X = (n, t, s) => t.has(n) || ot("Cannot " + s);
7
+ var i = (n, t, s) => (X(n, t, "read from private field"), s ? s.call(n) : t.get(n)), d = (n, t, s) => t.has(n) ? ot("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), c = (n, t, s, r) => (X(n, t, "write to private field"), r ? r.call(n, s) : t.set(n, s), s), a = (n, t, s) => (X(n, t, "access private method"), s);
8
+ import { y as Yt, x as ut, z as j, A as Zt, b as ti, E as nt, e as lt, B as _, C as ii, F as ei, d as si, G as ai, l as rt, H as dt, D as ni, L as Y, J as Z } from "./index-CJNQa9oe.js";
9
+ import { R as ri } from "./vidstack-DqAw8m9J-C-yN2xmu.js";
10
+ let q = null, z = [], J = [];
11
+ function ht() {
12
+ return q ?? (q = new AudioContext());
13
+ }
14
+ function hi() {
15
+ const n = ht(), t = n.createGain();
16
+ return t.connect(n.destination), z.push(t), t;
17
+ }
18
+ function oi(n, t) {
19
+ const s = ht(), r = s.createMediaElementSource(n);
20
+ return t && r.connect(t), J.push(r), r;
21
+ }
22
+ function di(n) {
23
+ const t = z.indexOf(n);
24
+ t !== -1 && (z.splice(t, 1), n.disconnect(), ft());
25
+ }
26
+ function ci(n) {
27
+ const t = J.indexOf(n);
28
+ t !== -1 && (J.splice(t, 1), n.disconnect(), ft());
29
+ }
30
+ function ft() {
31
+ q && z.length === 0 && J.length === 0 && q.close().then(() => {
32
+ q = null;
33
+ });
34
+ }
35
+ var R, E, m, p, P, mt, tt;
36
+ class ui {
37
+ constructor(t, s) {
38
+ d(this, P);
39
+ d(this, R);
40
+ d(this, E);
41
+ d(this, m, null);
42
+ d(this, p, null);
43
+ c(this, R, t), c(this, E, s);
44
+ }
45
+ get currentGain() {
46
+ var t, s;
47
+ return ((s = (t = i(this, m)) == null ? void 0 : t.gain) == null ? void 0 : s.value) ?? null;
48
+ }
49
+ get supported() {
50
+ return !0;
51
+ }
52
+ setGain(t) {
53
+ const s = this.currentGain;
54
+ if (t !== this.currentGain) {
55
+ if (t === 1 && s !== 1) {
56
+ this.removeGain();
57
+ return;
58
+ }
59
+ i(this, m) || (c(this, m, hi()), i(this, p) && i(this, p).connect(i(this, m))), i(this, p) || c(this, p, oi(i(this, R), i(this, m))), i(this, m).gain.value = t, i(this, E).call(this, t);
60
+ }
61
+ }
62
+ removeGain() {
63
+ i(this, m) && (i(this, p) && i(this, p).connect(ht().destination), a(this, P, tt).call(this), i(this, E).call(this, null));
64
+ }
65
+ destroy() {
66
+ a(this, P, mt).call(this), a(this, P, tt).call(this);
67
+ }
68
+ }
69
+ R = new WeakMap(), E = new WeakMap(), m = new WeakMap(), p = new WeakMap(), P = new WeakSet(), mt = function() {
70
+ if (i(this, p))
71
+ try {
72
+ ci(i(this, p));
73
+ } catch {
74
+ } finally {
75
+ c(this, p, null);
76
+ }
77
+ }, tt = function() {
78
+ if (i(this, m))
79
+ try {
80
+ di(i(this, m));
81
+ } catch {
82
+ } finally {
83
+ c(this, m, null);
84
+ }
85
+ };
86
+ const li = ["focus", "blur", "visibilitychange", "pageshow", "pagehide"];
87
+ var k, A, D, K, pt;
88
+ class fi {
89
+ constructor() {
90
+ d(this, K);
91
+ d(this, k, Z(ct()));
92
+ d(this, A, Z(document.visibilityState));
93
+ d(this, D);
94
+ }
95
+ connect() {
96
+ const t = new nt(window), s = a(this, K, pt).bind(this);
97
+ for (const r of li)
98
+ t.add(r, s);
99
+ _ && t.add("beforeunload", (r) => {
100
+ c(this, D, setTimeout(() => {
101
+ r.defaultPrevented || r.returnValue.length > 0 || (i(this, k).set("hidden"), i(this, A).set("hidden"));
102
+ }, 0));
103
+ });
104
+ }
105
+ /**
106
+ * The current page state. Important to note we only account for a subset of page states, as
107
+ * the rest aren't valuable to the player at the moment.
108
+ *
109
+ * - **active:** A page is in the active state if it is visible and has input focus.
110
+ * - **passive:** A page is in the passive state if it is visible and does not have input focus.
111
+ * - **hidden:** A page is in the hidden state if it is not visible.
112
+ *
113
+ * @see https://developers.google.com/web/updates/2018/07/page-lifecycle-api#states
114
+ */
115
+ get pageState() {
116
+ return i(this, k).call(this);
117
+ }
118
+ /**
119
+ * The current document visibility state.
120
+ *
121
+ * - **visible:** The page content may be at least partially visible. In practice, this means that
122
+ * the page is the foreground tab of a non-minimized window.
123
+ * - **hidden:** The page content is not visible to the user. In practice this means that the
124
+ * document is either a background tab or part of a minimized window, or the OS screen lock is
125
+ * active.
126
+ *
127
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState
128
+ */
129
+ get visibility() {
130
+ return i(this, A).call(this);
131
+ }
132
+ }
133
+ k = new WeakMap(), A = new WeakMap(), D = new WeakMap(), K = new WeakSet(), pt = function(t) {
134
+ _ && window.clearTimeout(i(this, D)), (t.type !== "blur" || i(this, k).call(this) === "active") && (i(this, k).set(ct(t)), i(this, A).set(document.visibilityState == "hidden" ? "hidden" : "visible"));
135
+ };
136
+ function ct(n) {
137
+ return (n == null ? void 0 : n.type) === "blur" || document.visibilityState === "hidden" ? "hidden" : document.hasFocus() ? "active" : "passive";
138
+ }
139
+ var O, h, b, x, L, S, H, G, e, o, yt, $, N, gt, bt, vt, Tt, Q, at, u, pi, T, kt, it, St, wt, Pt, W, Ct, Et, At, xt, Lt, Gt, $t, Nt, Mt, Rt, Dt, Ot, Ht, It, Ft, Ut, Vt, Bt;
140
+ class mi {
141
+ constructor(t, s) {
142
+ d(this, e);
143
+ d(this, O);
144
+ d(this, h);
145
+ d(this, b, !1);
146
+ d(this, x, !1);
147
+ d(this, L, !1);
148
+ d(this, S, new ri(a(this, e, gt).bind(this)));
149
+ d(this, H, new fi());
150
+ d(this, G);
151
+ /**
152
+ * The `timeupdate` event fires surprisingly infrequently during playback, meaning your progress
153
+ * bar (or whatever else is synced to the currentTime) moves in a choppy fashion. This helps
154
+ * resolve that by retrieving time updates in a request animation frame loop.
155
+ */
156
+ d(this, $, 0);
157
+ d(this, N, -1);
158
+ d(this, Q);
159
+ d(this, at);
160
+ c(this, O, t), c(this, h, s), c(this, G, new nt(t.media)), a(this, e, bt).call(this), i(this, H).connect(), lt(a(this, e, Mt).bind(this)), ut(a(this, e, yt).bind(this));
161
+ }
162
+ }
163
+ O = new WeakMap(), h = new WeakMap(), b = new WeakMap(), x = new WeakMap(), L = new WeakMap(), S = new WeakMap(), H = new WeakMap(), G = new WeakMap(), e = new WeakSet(), o = function() {
164
+ return i(this, O).media;
165
+ }, yt = function() {
166
+ var t;
167
+ c(this, x, !1), c(this, L, !1), i(this, S).stop(), i(this, G).abort(), (t = i(this, Q)) == null || t.clear();
168
+ }, $ = new WeakMap(), N = new WeakMap(), gt = function() {
169
+ const t = i(this, e, o).currentTime;
170
+ !(_ && t - i(this, N) < 0.35) && i(this, $) !== t && (a(this, e, T).call(this, t), c(this, $, t));
171
+ }, bt = function() {
172
+ a(this, e, u).call(this, "loadstart", a(this, e, kt)), a(this, e, u).call(this, "abort", a(this, e, it)), a(this, e, u).call(this, "emptied", a(this, e, St)), a(this, e, u).call(this, "error", a(this, e, Bt)), a(this, e, u).call(this, "volumechange", a(this, e, Ot));
173
+ }, vt = function() {
174
+ i(this, x) || (a(this, e, u).call(this, "loadeddata", a(this, e, wt)), a(this, e, u).call(this, "loadedmetadata", a(this, e, Pt)), a(this, e, u).call(this, "canplay", a(this, e, At)), a(this, e, u).call(this, "canplaythrough", a(this, e, xt)), a(this, e, u).call(this, "durationchange", a(this, e, Dt)), a(this, e, u).call(this, "play", a(this, e, Ct)), a(this, e, u).call(this, "progress", a(this, e, Ft)), a(this, e, u).call(this, "stalled", a(this, e, Gt)), a(this, e, u).call(this, "suspend", a(this, e, Ut)), a(this, e, u).call(this, "ratechange", a(this, e, Vt)), c(this, x, !0));
175
+ }, Tt = function() {
176
+ i(this, L) || (a(this, e, u).call(this, "pause", a(this, e, Et)), a(this, e, u).call(this, "playing", a(this, e, Lt)), a(this, e, u).call(this, "seeked", a(this, e, Ht)), a(this, e, u).call(this, "seeking", a(this, e, It)), a(this, e, u).call(this, "ended", a(this, e, Nt)), a(this, e, u).call(this, "waiting", a(this, e, $t)), c(this, L, !0));
177
+ }, Q = new WeakMap(), at = new WeakMap(), u = function(t, s) {
178
+ i(this, G).add(t, s.bind(this));
179
+ }, pi = function(t) {
180
+ }, T = function(t, s) {
181
+ const r = Math.min(t, i(this, h).$state.seekableEnd());
182
+ i(this, h).notify("time-change", r, s);
183
+ }, kt = function(t) {
184
+ if (i(this, e, o).networkState === 3) {
185
+ a(this, e, it).call(this, t);
186
+ return;
187
+ }
188
+ a(this, e, vt).call(this), i(this, h).notify("load-start", void 0, t);
189
+ }, it = function(t) {
190
+ i(this, h).notify("abort", void 0, t);
191
+ }, St = function() {
192
+ i(this, h).notify("emptied", void 0, event);
193
+ }, wt = function(t) {
194
+ i(this, h).notify("loaded-data", void 0, t);
195
+ }, Pt = function(t) {
196
+ c(this, $, 0), c(this, N, -1), a(this, e, Tt).call(this), i(this, h).notify("loaded-metadata", void 0, t), (ii || _ && ei(i(this, h).$state.source())) && i(this, h).delegate.ready(a(this, e, W).call(this), t);
197
+ }, W = function() {
198
+ return {
199
+ provider: si(i(this, h).$provider),
200
+ duration: i(this, e, o).duration,
201
+ buffered: i(this, e, o).buffered,
202
+ seekable: i(this, e, o).seekable
203
+ };
204
+ }, Ct = function(t) {
205
+ i(this, h).$state.canPlay && i(this, h).notify("play", void 0, t);
206
+ }, Et = function(t) {
207
+ i(this, e, o).readyState === 1 && !i(this, b) || (c(this, b, !1), i(this, S).stop(), i(this, h).notify("pause", void 0, t));
208
+ }, At = function(t) {
209
+ i(this, h).delegate.ready(a(this, e, W).call(this), t);
210
+ }, xt = function(t) {
211
+ i(this, h).$state.started() || i(this, h).notify("can-play-through", a(this, e, W).call(this), t);
212
+ }, Lt = function(t) {
213
+ i(this, e, o).paused || (c(this, b, !1), i(this, h).notify("playing", void 0, t), i(this, S).start());
214
+ }, Gt = function(t) {
215
+ i(this, h).notify("stalled", void 0, t), i(this, e, o).readyState < 3 && (c(this, b, !0), i(this, h).notify("waiting", void 0, t));
216
+ }, $t = function(t) {
217
+ i(this, e, o).readyState < 3 && (c(this, b, !0), i(this, h).notify("waiting", void 0, t));
218
+ }, Nt = function(t) {
219
+ i(this, S).stop(), a(this, e, T).call(this, i(this, e, o).duration, t), i(this, h).notify("end", void 0, t), i(this, h).$state.loop() && ai(i(this, e, o).controls) && (i(this, e, o).controls = !1);
220
+ }, Mt = function() {
221
+ const t = i(this, h).$state.paused(), s = i(this, H).visibility === "hidden";
222
+ (t || s) && rt(i(this, e, o), "timeupdate", a(this, e, Rt).bind(this));
223
+ }, Rt = function(t) {
224
+ a(this, e, T).call(this, i(this, e, o).currentTime, t);
225
+ }, Dt = function(t) {
226
+ i(this, h).$state.ended() && a(this, e, T).call(this, i(this, e, o).duration, t), i(this, h).notify("duration-change", i(this, e, o).duration, t);
227
+ }, Ot = function(t) {
228
+ const s = {
229
+ volume: i(this, e, o).volume,
230
+ muted: i(this, e, o).muted
231
+ };
232
+ i(this, h).notify("volume-change", s, t);
233
+ }, Ht = function(t) {
234
+ c(this, N, i(this, e, o).currentTime), a(this, e, T).call(this, i(this, e, o).currentTime, t), i(this, h).notify("seeked", i(this, e, o).currentTime, t), Math.trunc(i(this, e, o).currentTime) === Math.trunc(i(this, e, o).duration) && dt(i(this, e, o).duration) > dt(i(this, e, o).currentTime) && (a(this, e, T).call(this, i(this, e, o).duration, t), i(this, e, o).ended || i(this, h).player.dispatch(
235
+ new ni("media-play-request", {
236
+ trigger: t
237
+ })
238
+ ));
239
+ }, It = function(t) {
240
+ i(this, h).notify("seeking", i(this, e, o).currentTime, t);
241
+ }, Ft = function(t) {
242
+ const s = {
243
+ buffered: i(this, e, o).buffered,
244
+ seekable: i(this, e, o).seekable
245
+ };
246
+ i(this, h).notify("progress", s, t);
247
+ }, Ut = function(t) {
248
+ i(this, h).notify("suspend", void 0, t);
249
+ }, Vt = function(t) {
250
+ i(this, h).notify("rate-change", i(this, e, o).playbackRate, t);
251
+ }, Bt = function(t) {
252
+ const s = i(this, e, o).error;
253
+ if (!s) return;
254
+ const r = {
255
+ message: s.message,
256
+ code: s.code,
257
+ mediaError: s
258
+ };
259
+ i(this, h).notify("error", r, t);
260
+ };
261
+ var I, g, l, C, jt, qt, Wt, et, _t;
262
+ class yi {
263
+ constructor(t, s) {
264
+ d(this, l);
265
+ d(this, I);
266
+ d(this, g);
267
+ c(this, I, t), c(this, g, s), i(this, l, C).onaddtrack = a(this, l, jt).bind(this), i(this, l, C).onremovetrack = a(this, l, qt).bind(this), i(this, l, C).onchange = a(this, l, Wt).bind(this), rt(i(this, g).audioTracks, "change", a(this, l, _t).bind(this));
268
+ }
269
+ }
270
+ I = new WeakMap(), g = new WeakMap(), l = new WeakSet(), C = function() {
271
+ return i(this, I).media.audioTracks;
272
+ }, jt = function(t) {
273
+ const s = t.track;
274
+ if (s.label === "") return;
275
+ const r = s.id.toString() || `native-audio-${i(this, g).audioTracks.length}`, f = {
276
+ id: r,
277
+ label: s.label,
278
+ language: s.language,
279
+ kind: s.kind,
280
+ selected: !1
281
+ };
282
+ i(this, g).audioTracks[Y.add](f, t), s.enabled && (f.selected = !0);
283
+ }, qt = function(t) {
284
+ const s = i(this, g).audioTracks.getById(t.track.id);
285
+ s && i(this, g).audioTracks[Y.remove](s, t);
286
+ }, Wt = function(t) {
287
+ let s = a(this, l, et).call(this);
288
+ if (!s) return;
289
+ const r = i(this, g).audioTracks.getById(s.id);
290
+ r && i(this, g).audioTracks[Y.select](r, !0, t);
291
+ }, et = function() {
292
+ return Array.from(i(this, l, C)).find((t) => t.enabled);
293
+ }, _t = function(t) {
294
+ const { current: s } = t.detail;
295
+ if (!s) return;
296
+ const r = i(this, l, C).getTrackById(s.id);
297
+ if (r) {
298
+ const f = a(this, l, et).call(this);
299
+ f && (f.enabled = !1), r.enabled = !0;
300
+ }
301
+ };
302
+ var F, st;
303
+ class ki {
304
+ constructor(t, s) {
305
+ d(this, F);
306
+ M(this, "scope", Yt());
307
+ M(this, "currentSrc", null);
308
+ M(this, "audioGain");
309
+ this.media = t, this.ctx = s, this.audioGain = new ui(t, (r) => {
310
+ this.ctx.notify("audio-gain-change", r);
311
+ });
312
+ }
313
+ setup() {
314
+ new mi(this, this.ctx), "audioTracks" in this.media && new yi(this, this.ctx), ut(() => {
315
+ this.audioGain.destroy(), this.media.srcObject = null, this.media.removeAttribute("src");
316
+ for (const t of this.media.querySelectorAll("source")) t.remove();
317
+ this.media.load();
318
+ });
319
+ }
320
+ get type() {
321
+ return "";
322
+ }
323
+ setPlaybackRate(t) {
324
+ this.media.playbackRate = t;
325
+ }
326
+ async play() {
327
+ return this.media.play();
328
+ }
329
+ async pause() {
330
+ return this.media.pause();
331
+ }
332
+ setMuted(t) {
333
+ this.media.muted = t;
334
+ }
335
+ setVolume(t) {
336
+ this.media.volume = t;
337
+ }
338
+ setCurrentTime(t) {
339
+ this.media.currentTime = t;
340
+ }
341
+ setPlaysInline(t) {
342
+ j(this.media, "playsinline", t);
343
+ }
344
+ async loadSource({ src: t, type: s }, r) {
345
+ this.media.preload = r || "", Zt(t) ? (this.removeSource(), this.media.srcObject = t) : (this.media.srcObject = null, ti(t) ? s !== "?" ? this.appendSource({ src: t, type: s }) : (this.removeSource(), this.media.src = a(this, F, st).call(this, t)) : (this.removeSource(), this.media.src = window.URL.createObjectURL(t))), this.media.load(), this.currentSrc = { src: t, type: s };
346
+ }
347
+ /**
348
+ * Append source so it works when requesting AirPlay since hls.js will remove it.
349
+ */
350
+ appendSource(t, s) {
351
+ const r = this.media.querySelector("source[data-vds]"), f = r ?? document.createElement("source");
352
+ j(f, "src", a(this, F, st).call(this, t.src)), j(f, "type", t.type !== "?" ? t.type : s), j(f, "data-vds", ""), r || this.media.append(f);
353
+ }
354
+ removeSource() {
355
+ var t;
356
+ (t = this.media.querySelector("source[data-vds]")) == null || t.remove();
357
+ }
358
+ }
359
+ F = new WeakSet(), st = function(t) {
360
+ const { clipStartTime: s, clipEndTime: r } = this.ctx.$state, f = s(), B = r();
361
+ return f > 0 && B > 0 ? `${t}#t=${f},${B}` : f > 0 ? `${t}#t=${f}` : B > 0 ? `${t}#t=0,${B}` : t;
362
+ };
363
+ var y, U, V, w, v, zt, Jt, Kt;
364
+ class gi {
365
+ constructor(t, s) {
366
+ d(this, v);
367
+ d(this, y);
368
+ d(this, U);
369
+ d(this, V);
370
+ d(this, w, Z(!1));
371
+ c(this, y, t), c(this, U, s), a(this, v, zt).call(this);
372
+ }
373
+ get supported() {
374
+ return i(this, w).call(this);
375
+ }
376
+ async prompt() {
377
+ if (!this.supported) throw Error("Not supported on this platform.");
378
+ return this.type === "airplay" && i(this, y).webkitShowPlaybackTargetPicker ? i(this, y).webkitShowPlaybackTargetPicker() : i(this, y).remote.prompt();
379
+ }
380
+ }
381
+ y = new WeakMap(), U = new WeakMap(), V = new WeakMap(), w = new WeakMap(), v = new WeakSet(), zt = function() {
382
+ var t;
383
+ !((t = i(this, y)) != null && t.remote) || !this.canPrompt || (i(this, y).remote.watchAvailability((s) => {
384
+ i(this, w).set(s);
385
+ }).catch(() => {
386
+ i(this, w).set(!1);
387
+ }), lt(a(this, v, Jt).bind(this)));
388
+ }, Jt = function() {
389
+ if (!i(this, w).call(this)) return;
390
+ const t = ["connecting", "connect", "disconnect"], s = a(this, v, Kt).bind(this);
391
+ s(), rt(i(this, y), "playing", s);
392
+ const r = new nt(i(this, y).remote);
393
+ for (const f of t)
394
+ r.add(f, s);
395
+ }, Kt = function(t) {
396
+ const s = i(this, y).remote.state;
397
+ if (s === i(this, V)) return;
398
+ const r = { type: this.type, state: s };
399
+ i(this, U).notify("remote-playback-change", r, t), c(this, V, s);
400
+ };
401
+ class Si extends gi {
402
+ constructor() {
403
+ super(...arguments);
404
+ M(this, "type", "airplay");
405
+ }
406
+ get canPrompt() {
407
+ return "WebKitPlaybackTargetAvailabilityEvent" in window;
408
+ }
409
+ }
410
+ export {
411
+ ki as H,
412
+ Si as a
413
+ };
@@ -0,0 +1,138 @@
1
+ var _ = Object.defineProperty;
2
+ var w = (t) => {
3
+ throw TypeError(t);
4
+ };
5
+ var P = (t, e, a) => e in t ? _(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
6
+ var u = (t, e, a) => P(t, typeof e != "symbol" ? e + "" : e, a), C = (t, e, a) => e.has(t) || w("Cannot " + a);
7
+ var c = (t, e, a) => (C(t, e, "read from private field"), a ? a.call(t) : e.get(t)), m = (t, e, a) => e.has(t) ? w("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), y = (t, e, a, o) => (C(t, e, "write to private field"), o ? o.call(t, a) : e.set(t, a), a), s = (t, e, a) => (C(t, e, "access private method"), a);
8
+ import { l as b, g as A, C as O, S as D, d as R, k as M } from "./index-CJNQa9oe.js";
9
+ function G() {
10
+ return "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
11
+ }
12
+ function L() {
13
+ var t;
14
+ return !!((t = window.cast) != null && t.framework);
15
+ }
16
+ function N() {
17
+ var t, e;
18
+ return !!((e = (t = window.chrome) == null ? void 0 : t.cast) != null && e.isAvailable);
19
+ }
20
+ function v() {
21
+ return g().getCastState() === cast.framework.CastState.CONNECTED;
22
+ }
23
+ function g() {
24
+ return window.cast.framework.CastContext.getInstance();
25
+ }
26
+ function E() {
27
+ return g().getCurrentSession();
28
+ }
29
+ function T() {
30
+ var t;
31
+ return (t = E()) == null ? void 0 : t.getSessionObj().media[0];
32
+ }
33
+ function J(t) {
34
+ var a;
35
+ return ((a = T()) == null ? void 0 : a.media.contentId) === (t == null ? void 0 : t.src);
36
+ }
37
+ function U() {
38
+ return {
39
+ language: "en-US",
40
+ autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
41
+ receiverApplicationId: chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,
42
+ resumeSavedSession: !0,
43
+ androidReceiverCompatible: !0
44
+ };
45
+ }
46
+ function j(t) {
47
+ return `Google Cast Error Code: ${t}`;
48
+ }
49
+ function V(t, e) {
50
+ return b(g(), t, e);
51
+ }
52
+ var n, r, S, k, I, l, d;
53
+ class F {
54
+ constructor() {
55
+ m(this, r);
56
+ u(this, "name", "google-cast");
57
+ u(this, "target");
58
+ m(this, n);
59
+ }
60
+ /**
61
+ * @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastContext}
62
+ */
63
+ get cast() {
64
+ return g();
65
+ }
66
+ mediaType() {
67
+ return "video";
68
+ }
69
+ canPlay(e) {
70
+ return A && !O && D(e);
71
+ }
72
+ async prompt(e) {
73
+ var h;
74
+ let a, o, i;
75
+ try {
76
+ a = await s(this, r, S).call(this, e), c(this, n) || (y(this, n, new cast.framework.RemotePlayer()), new cast.framework.RemotePlayerController(c(this, n))), o = e.player.createEvent("google-cast-prompt-open", {
77
+ trigger: a
78
+ }), e.player.dispatchEvent(o), s(this, r, l).call(this, e, "connecting", o), await s(this, r, k).call(this, R(e.$props.googleCast)), e.$state.remotePlaybackInfo.set({
79
+ deviceName: (h = E()) == null ? void 0 : h.getCastDevice().friendlyName
80
+ }), v() && s(this, r, l).call(this, e, "connected", o);
81
+ } catch (p) {
82
+ const f = p instanceof Error ? p : s(this, r, d).call(this, (p + "").toUpperCase(), "Prompt failed.");
83
+ throw i = e.player.createEvent("google-cast-prompt-error", {
84
+ detail: f,
85
+ trigger: o ?? a,
86
+ cancelable: !0
87
+ }), e.player.dispatch(i), s(this, r, l).call(this, e, v() ? "connected" : "disconnected", i), f;
88
+ } finally {
89
+ e.player.dispatch("google-cast-prompt-close", {
90
+ trigger: i ?? o ?? a
91
+ });
92
+ }
93
+ }
94
+ async load(e) {
95
+ if (!c(this, n))
96
+ throw Error("[vidstack] google cast player was not initialized");
97
+ return new (await import("./vidstack-google-cast-D-pvs1aK.js")).GoogleCastProvider(c(this, n), e);
98
+ }
99
+ }
100
+ n = new WeakMap(), r = new WeakSet(), S = async function(e) {
101
+ if (L()) return;
102
+ const a = e.player.createEvent("google-cast-load-start");
103
+ e.player.dispatch(a), await M(G()), await customElements.whenDefined("google-cast-launcher");
104
+ const o = e.player.createEvent("google-cast-loaded", { trigger: a });
105
+ if (e.player.dispatch(o), !N())
106
+ throw s(this, r, d).call(this, "CAST_NOT_AVAILABLE", "Google Cast not available on this platform.");
107
+ return o;
108
+ }, k = async function(e) {
109
+ s(this, r, I).call(this, e);
110
+ const a = await this.cast.requestSession();
111
+ if (a)
112
+ throw s(this, r, d).call(this, a.toUpperCase(), j(a));
113
+ }, I = function(e) {
114
+ var a;
115
+ (a = this.cast) == null || a.setOptions({
116
+ ...U(),
117
+ ...e
118
+ });
119
+ }, l = function(e, a, o) {
120
+ const i = { type: "google-cast", state: a };
121
+ e.notify("remote-playback-change", i, o);
122
+ }, d = function(e, a) {
123
+ const o = Error(a);
124
+ return o.code = e, o;
125
+ };
126
+ const q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
127
+ __proto__: null,
128
+ GoogleCastLoader: F
129
+ }, Symbol.toStringTag, { value: "Module" }));
130
+ export {
131
+ E as a,
132
+ T as b,
133
+ j as c,
134
+ g,
135
+ J as h,
136
+ V as l,
137
+ q as v
138
+ };
@@ -0,0 +1,60 @@
1
+ var y = Object.defineProperty;
2
+ var g = (s) => {
3
+ throw TypeError(s);
4
+ };
5
+ var w = (s, t, i) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[t] = i;
6
+ var c = (s, t, i) => w(s, typeof t != "symbol" ? t + "" : t, i), h = (s, t, i) => t.has(s) || g("Cannot " + i);
7
+ var e = (s, t, i) => (h(s, t, "read from private field"), i ? i.call(s) : t.get(s)), l = (s, t, i) => t.has(s) ? g("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, i), p = (s, t, i, a) => (h(s, t, "write to private field"), a ? a.call(s, i) : t.set(s, i), i), u = (s, t, i) => (h(s, t, "access private method"), i);
8
+ import { J as M, l as f, e as A, d as P, R as O, b as S } from "./index-CJNQa9oe.js";
9
+ var r, o, b, m;
10
+ class W {
11
+ constructor(t) {
12
+ l(this, o);
13
+ l(this, r);
14
+ c(this, "src", M(""));
15
+ /**
16
+ * Defines which referrer is sent when fetching the resource.
17
+ *
18
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy}
19
+ */
20
+ c(this, "referrerPolicy", null);
21
+ p(this, r, t), t.setAttribute("frameBorder", "0"), t.setAttribute("aria-hidden", "true"), t.setAttribute(
22
+ "allow",
23
+ "autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"
24
+ ), this.referrerPolicy !== null && t.setAttribute("referrerpolicy", this.referrerPolicy);
25
+ }
26
+ get iframe() {
27
+ return e(this, r);
28
+ }
29
+ setup() {
30
+ f(window, "message", u(this, o, m).bind(this)), f(e(this, r), "load", this.onLoad.bind(this)), A(u(this, o, b).bind(this));
31
+ }
32
+ postMessage(t, i) {
33
+ var a;
34
+ (a = e(this, r).contentWindow) == null || a.postMessage(JSON.stringify(t), i ?? "*");
35
+ }
36
+ }
37
+ r = new WeakMap(), o = new WeakSet(), b = function() {
38
+ const t = this.src();
39
+ if (!t.length) {
40
+ e(this, r).setAttribute("src", "");
41
+ return;
42
+ }
43
+ const i = P(() => this.buildParams());
44
+ e(this, r).setAttribute("src", O(t, i));
45
+ }, m = function(t) {
46
+ var d;
47
+ const i = this.getOrigin();
48
+ if ((t.source === null || t.source === ((d = e(this, r)) == null ? void 0 : d.contentWindow)) && (!S(i) || i === t.origin)) {
49
+ try {
50
+ const n = JSON.parse(t.data);
51
+ n && this.onMessage(n, t);
52
+ return;
53
+ } catch {
54
+ }
55
+ t.data && this.onMessage(t.data, t);
56
+ }
57
+ };
58
+ export {
59
+ W as E
60
+ };
@@ -0,0 +1,20 @@
1
+ import { c as d, I as i, e as l, a as m } from "./index-CJNQa9oe.js";
2
+ const p = /* @__PURE__ */ m(
3
+ '<svg viewBox="0 0 32 32" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"></svg>'
4
+ );
5
+ function v(a, s) {
6
+ const o = d(p);
7
+ o.innerHTML = i, a.append(o);
8
+ const e = document.createElement("span");
9
+ e.classList.add("vds-google-cast-info"), a.append(e);
10
+ const n = document.createElement("span");
11
+ n.classList.add("vds-google-cast-device-name"), l(() => {
12
+ const { remotePlaybackInfo: c } = s, t = c();
13
+ return t != null && t.deviceName && (n.textContent = t.deviceName, e.append("Google Cast on ", n)), () => {
14
+ e.textContent = "";
15
+ };
16
+ });
17
+ }
18
+ export {
19
+ v as insertContent
20
+ };
@@ -0,0 +1,31 @@
1
+ const i = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, u = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2
+ function l(e) {
3
+ var t;
4
+ return (t = e.match(i)) == null ? void 0 : t[1];
5
+ }
6
+ async function b(e, t) {
7
+ if (u.has(e)) return u.get(e);
8
+ if (n.has(e)) return n.get(e);
9
+ const s = new Promise(async (r) => {
10
+ const c = ["maxresdefault", "sddefault", "hqdefault"];
11
+ for (const a of c)
12
+ for (const f of [!0, !1]) {
13
+ const o = p(e, a, f);
14
+ if ((await fetch(o, {
15
+ mode: "no-cors",
16
+ signal: t.signal
17
+ })).status < 400) {
18
+ u.set(e, o), r(o);
19
+ return;
20
+ }
21
+ }
22
+ }).catch(() => "").finally(() => n.delete(e));
23
+ return n.set(e, s), s;
24
+ }
25
+ function p(e, t, s) {
26
+ return `https://i.ytimg.com/${s ? "vi_webp" : "vi"}/${e}/${t}.${s ? "webp" : "jpg"}`;
27
+ }
28
+ export {
29
+ b as findYouTubePoster,
30
+ l as resolveYouTubeVideoId
31
+ };
@@ -0,0 +1,29 @@
1
+ var l = (i) => {
2
+ throw TypeError(i);
3
+ };
4
+ var c = (i, t, s) => t.has(i) || l("Cannot " + s);
5
+ var r = (i, t, s) => (c(i, t, "read from private field"), s ? s.call(i) : t.get(i)), e = (i, t, s) => t.has(i) ? l("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), h = (i, t, s, f) => (c(i, t, "write to private field"), f ? f.call(i, s) : t.set(i, s), s), m = (i, t, s) => (c(i, t, "access private method"), s);
6
+ import { h as p, t as u } from "./index-CJNQa9oe.js";
7
+ var o, a, n, d;
8
+ class F {
9
+ constructor(t) {
10
+ e(this, n);
11
+ e(this, o);
12
+ e(this, a);
13
+ h(this, a, t);
14
+ }
15
+ start() {
16
+ p(r(this, o)) && m(this, n, d).call(this);
17
+ }
18
+ stop() {
19
+ u(r(this, o)) && window.cancelAnimationFrame(r(this, o)), h(this, o, void 0);
20
+ }
21
+ }
22
+ o = new WeakMap(), a = new WeakMap(), n = new WeakSet(), d = function() {
23
+ h(this, o, window.requestAnimationFrame(() => {
24
+ p(r(this, o)) || (r(this, a).call(this), m(this, n, d).call(this));
25
+ }));
26
+ };
27
+ export {
28
+ F as R
29
+ };