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,32 @@
1
+ var a = Object.defineProperty;
2
+ var o = (i, e, t) => e in i ? a(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var r = (i, e, t) => o(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { s as p } from "./index-CJNQa9oe.js";
5
+ import { H as d, a as u } from "./vidstack-Bq6c3Bam-ajJxDr7M.js";
6
+ class n extends d {
7
+ constructor(t, s) {
8
+ super(t, s);
9
+ r(this, "$$PROVIDER_TYPE", "AUDIO");
10
+ r(this, "airPlay");
11
+ p(() => {
12
+ this.airPlay = new u(this.media, s);
13
+ }, this.scope);
14
+ }
15
+ get type() {
16
+ return "audio";
17
+ }
18
+ setup() {
19
+ super.setup(), this.type === "audio" && this.ctx.notify("provider-setup", this);
20
+ }
21
+ /**
22
+ * The native HTML `<audio>` element.
23
+ *
24
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement}
25
+ */
26
+ get audio() {
27
+ return this.media;
28
+ }
29
+ }
30
+ export {
31
+ n as AudioProvider
32
+ };
@@ -0,0 +1,403 @@
1
+ var vt = Object.defineProperty;
2
+ var Y = (n) => {
3
+ throw TypeError(n);
4
+ };
5
+ var wt = (n, t, e) => t in n ? vt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
+ var I = (n, t, e) => wt(n, typeof t != "symbol" ? t + "" : t, e), b = (n, t, e) => t.has(n) || Y("Cannot " + e);
7
+ var i = (n, t, e) => (b(n, t, "read from private field"), e ? e.call(n) : t.get(n)), f = (n, t, e) => t.has(n) ? Y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), p = (n, t, e, r) => (b(n, t, "write to private field"), r ? r.call(n, e) : t.set(n, e), e), h = (n, t, e) => (b(n, t, "access private method"), e);
8
+ import { o as Et, b as _, p as Lt, d as At, Q as z, l as J, e as Dt, D as N, f as O, T as xt, L as q, q as Mt, r as Ct, t as Nt, g as Rt, h as Z, j as Ft, k as Pt, m as qt, n as _t } from "./index-CJNQa9oe.js";
9
+ import { VideoProvider as $t } from "./vidstack-video-YYohV9Kw.js";
10
+ import { R as jt } from "./vidstack-DqAw8m9J-C-yN2xmu.js";
11
+ function W(n) {
12
+ try {
13
+ return new Intl.DisplayNames(navigator.languages, { type: "language" }).of(n) ?? null;
14
+ } catch {
15
+ return null;
16
+ }
17
+ }
18
+ const Ht = (n) => `dash-${_t(n)}`;
19
+ var L, d, o, R, F, s, x, k, tt, it, w, P, et, st, nt, rt, ot, at, ht, dt, A, ut, Q, G, ct, V, lt, pt, U;
20
+ class It {
21
+ constructor(t, e) {
22
+ f(this, s);
23
+ f(this, L);
24
+ f(this, d);
25
+ f(this, o, null);
26
+ f(this, R, /* @__PURE__ */ new Set());
27
+ f(this, F, null);
28
+ I(this, "config", {});
29
+ f(this, w, null);
30
+ f(this, P, {});
31
+ f(this, A, -1);
32
+ p(this, L, t), p(this, d, e);
33
+ }
34
+ get instance() {
35
+ return i(this, o);
36
+ }
37
+ setup(t) {
38
+ p(this, o, t().create());
39
+ const e = h(this, s, it).bind(this);
40
+ for (const r of Object.values(t.events)) i(this, o).on(r, e);
41
+ i(this, o).on(t.events.ERROR, h(this, s, at).bind(this));
42
+ for (const r of i(this, R)) r(i(this, o));
43
+ i(this, d).player.dispatch("dash-instance", {
44
+ detail: i(this, o)
45
+ }), i(this, o).initialize(i(this, L), void 0, !1), i(this, o).updateSettings({
46
+ streaming: {
47
+ text: {
48
+ // Disabling text rendering by dash.
49
+ defaultEnabled: !1,
50
+ dispatchForManualRendering: !0
51
+ },
52
+ buffer: {
53
+ /// Enables buffer replacement when switching bitrates for faster switching.
54
+ fastSwitchEnabled: !0
55
+ }
56
+ },
57
+ ...this.config
58
+ }), i(this, o).on(t.events.FRAGMENT_LOADING_STARTED, h(this, s, ht).bind(this)), i(this, o).on(
59
+ t.events.FRAGMENT_LOADING_COMPLETED,
60
+ h(this, s, dt).bind(this)
61
+ ), i(this, o).on(t.events.MANIFEST_LOADED, h(this, s, ot).bind(this)), i(this, o).on(t.events.QUALITY_CHANGE_RENDERED, h(this, s, rt).bind(this)), i(this, o).on(t.events.TEXT_TRACKS_ADDED, h(this, s, st).bind(this)), i(this, o).on(t.events.TRACK_CHANGE_RENDERED, h(this, s, nt).bind(this)), i(this, d).qualities[z.enableAuto] = h(this, s, ct).bind(this), J(i(this, d).qualities, "change", h(this, s, lt).bind(this)), J(i(this, d).audioTracks, "change", h(this, s, pt).bind(this)), p(this, F, Dt(h(this, s, k).bind(this)));
62
+ }
63
+ onInstance(t) {
64
+ return i(this, R).add(t), () => i(this, R).delete(t);
65
+ }
66
+ loadSource(t) {
67
+ var e;
68
+ h(this, s, U).call(this), _(t.src) && ((e = i(this, o)) == null || e.attachSource(t.src));
69
+ }
70
+ destroy() {
71
+ var t, e;
72
+ h(this, s, U).call(this), (t = i(this, o)) == null || t.destroy(), p(this, o, null), (e = i(this, F)) == null || e.call(this), p(this, F, null);
73
+ }
74
+ }
75
+ L = new WeakMap(), d = new WeakMap(), o = new WeakMap(), R = new WeakMap(), F = new WeakMap(), s = new WeakSet(), x = function(t) {
76
+ return new N(Ht(t.type), { detail: t });
77
+ }, k = function() {
78
+ if (!i(this, d).$state.live()) return;
79
+ const t = new jt(h(this, s, tt).bind(this));
80
+ return t.start(), t.stop.bind(t);
81
+ }, tt = function() {
82
+ if (!i(this, o)) return;
83
+ const t = i(this, o).duration() - i(this, o).time();
84
+ i(this, d).$state.liveSyncPosition.set(isNaN(t) ? 1 / 0 : t);
85
+ }, it = function(t) {
86
+ var e;
87
+ (e = i(this, d).player) == null || e.dispatch(h(this, s, x).call(this, t));
88
+ }, w = new WeakMap(), P = new WeakMap(), et = function(t) {
89
+ var u;
90
+ const e = (u = i(this, w)) == null ? void 0 : u[O.native], r = (e == null ? void 0 : e.track).cues;
91
+ if (!e || !r) return;
92
+ const l = i(this, w).id, g = i(this, P)[l] ?? 0, y = h(this, s, x).call(this, t);
93
+ for (let m = g; m < r.length; m++) {
94
+ const c = r[m];
95
+ c.positionAlign || (c.positionAlign = "auto"), i(this, w).addCue(c, y);
96
+ }
97
+ i(this, P)[l] = r.length;
98
+ }, st = function(t) {
99
+ var g;
100
+ if (!i(this, o)) return;
101
+ const e = t.tracks, r = [...i(this, L).textTracks].filter((y) => "manualMode" in y), l = h(this, s, x).call(this, t);
102
+ for (let y = 0; y < r.length; y++) {
103
+ const u = e[y], m = r[y], c = `dash-${u.kind}-${y}`, E = new xt({
104
+ id: c,
105
+ label: (u == null ? void 0 : u.label) ?? ((g = u.labels.find((a) => a.text)) == null ? void 0 : g.text) ?? ((u == null ? void 0 : u.lang) && W(u.lang)) ?? (u == null ? void 0 : u.lang) ?? void 0,
106
+ language: u.lang ?? void 0,
107
+ kind: u.kind,
108
+ default: u.defaultTrack
109
+ });
110
+ E[O.native] = {
111
+ managed: !0,
112
+ track: m
113
+ }, E[O.readyState] = 2, E[O.onModeChange] = () => {
114
+ i(this, o) && (E.mode === "showing" ? (i(this, o).setTextTrack(y), p(this, w, E)) : (i(this, o).setTextTrack(-1), p(this, w, null)));
115
+ }, i(this, d).textTracks.add(E, l);
116
+ }
117
+ }, nt = function(t) {
118
+ const { mediaType: e, newMediaInfo: r } = t;
119
+ if (e === "audio") {
120
+ const l = i(this, d).audioTracks.getById(`dash-audio-${r.index}`);
121
+ if (l) {
122
+ const g = h(this, s, x).call(this, t);
123
+ i(this, d).audioTracks[q.select](l, !0, g);
124
+ }
125
+ }
126
+ }, rt = function(t) {
127
+ if (t.mediaType !== "video") return;
128
+ const e = i(this, d).qualities[t.newQuality];
129
+ if (e) {
130
+ const r = h(this, s, x).call(this, t);
131
+ i(this, d).qualities[q.select](e, !0, r);
132
+ }
133
+ }, ot = function(t) {
134
+ if (i(this, d).$state.canPlay() || !i(this, o)) return;
135
+ const { type: e, mediaPresentationDuration: r } = t.data, l = h(this, s, x).call(this, t);
136
+ i(this, d).notify("stream-type-change", e !== "static" ? "live" : "on-demand", l), i(this, d).notify("duration-change", r, l), i(this, d).qualities[z.setAuto](!0, l);
137
+ const g = i(this, o).getVideoElement(), y = i(this, o).getTracksForTypeFromManifest(
138
+ "video",
139
+ t.data
140
+ ), u = [...new Set(y.map((a) => a.mimeType))].find(
141
+ (a) => a && Mt(g, a)
142
+ ), m = y.filter(
143
+ (a) => u === a.mimeType
144
+ )[0];
145
+ let c = i(this, o).getTracksForTypeFromManifest(
146
+ "audio",
147
+ t.data
148
+ );
149
+ const E = [...new Set(c.map((a) => a.mimeType))].find(
150
+ (a) => a && Ct(g, a)
151
+ );
152
+ if (c = c.filter((a) => E === a.mimeType), m.bitrateList.forEach((a, H) => {
153
+ var C;
154
+ const B = {
155
+ id: ((C = a.id) == null ? void 0 : C.toString()) ?? `dash-bitrate-${H}`,
156
+ width: a.width ?? 0,
157
+ height: a.height ?? 0,
158
+ bitrate: a.bandwidth ?? 0,
159
+ codec: m.codec,
160
+ index: H
161
+ };
162
+ i(this, d).qualities[q.add](B, l);
163
+ }), Nt(m.index)) {
164
+ const a = i(this, d).qualities[m.index];
165
+ a && i(this, d).qualities[q.select](a, !0, l);
166
+ }
167
+ c.forEach((a, H) => {
168
+ const C = a.labels.find((K) => navigator.languages.some((St) => K.lang && St.toLowerCase().startsWith(K.lang.toLowerCase()))) || a.labels[0], Tt = {
169
+ id: `dash-audio-${a == null ? void 0 : a.index}`,
170
+ label: (C == null ? void 0 : C.text) ?? (a.lang && W(a.lang)) ?? a.lang ?? "",
171
+ language: a.lang ?? "",
172
+ kind: "main",
173
+ mimeType: a.mimeType,
174
+ codec: a.codec,
175
+ index: H
176
+ };
177
+ i(this, d).audioTracks[q.add](Tt, l);
178
+ }), g.dispatchEvent(new N("canplay", { trigger: l }));
179
+ }, at = function(t) {
180
+ const { type: e, error: r } = t;
181
+ switch (r.code) {
182
+ case 27:
183
+ h(this, s, ut).call(this, r);
184
+ break;
185
+ default:
186
+ h(this, s, G).call(this, r);
187
+ break;
188
+ }
189
+ }, ht = function() {
190
+ i(this, A) >= 0 && h(this, s, Q).call(this);
191
+ }, dt = function(t) {
192
+ t.mediaType === "text" && requestAnimationFrame(h(this, s, et).bind(this, t));
193
+ }, A = new WeakMap(), ut = function(t) {
194
+ var e;
195
+ h(this, s, Q).call(this), (e = i(this, o)) == null || e.play(), p(this, A, window.setTimeout(() => {
196
+ p(this, A, -1), h(this, s, G).call(this, t);
197
+ }, 5e3));
198
+ }, Q = function() {
199
+ clearTimeout(i(this, A)), p(this, A, -1);
200
+ }, G = function(t) {
201
+ i(this, d).notify("error", {
202
+ message: t.message ?? "",
203
+ code: 1,
204
+ error: t
205
+ });
206
+ }, ct = function() {
207
+ var e;
208
+ h(this, s, V).call(this, "video", !0);
209
+ const { qualities: t } = i(this, d);
210
+ (e = i(this, o)) == null || e.setQualityFor("video", t.selectedIndex, !0);
211
+ }, V = function(t, e) {
212
+ var r;
213
+ (r = i(this, o)) == null || r.updateSettings({
214
+ streaming: { abr: { autoSwitchBitrate: { [t]: e } } }
215
+ });
216
+ }, lt = function() {
217
+ const { qualities: t } = i(this, d);
218
+ !i(this, o) || t.auto || !t.selected || (h(this, s, V).call(this, "video", !1), i(this, o).setQualityFor("video", t.selectedIndex, t.switch === "current"), Rt && (i(this, L).currentTime = i(this, L).currentTime));
219
+ }, pt = function() {
220
+ if (!i(this, o)) return;
221
+ const { audioTracks: t } = i(this, d), e = i(this, o).getTracksFor("audio").find(
222
+ (r) => t.selected && t.selected.id === `dash-audio-${r.index}`
223
+ );
224
+ e && i(this, o).setCurrentTrack(e);
225
+ }, U = function() {
226
+ h(this, s, Q).call(this), p(this, w, null), p(this, P, {});
227
+ };
228
+ var M, S, $, v, gt, ft, yt, mt;
229
+ class Ot {
230
+ constructor(t, e, r) {
231
+ f(this, v);
232
+ f(this, M);
233
+ f(this, S);
234
+ f(this, $);
235
+ p(this, M, t), p(this, S, e), p(this, $, r), h(this, v, gt).call(this);
236
+ }
237
+ }
238
+ M = new WeakMap(), S = new WeakMap(), $ = new WeakMap(), v = new WeakSet(), gt = async function() {
239
+ const t = {
240
+ onLoadStart: h(this, v, ft).bind(this),
241
+ onLoaded: h(this, v, yt).bind(this),
242
+ onLoadError: h(this, v, mt).bind(this)
243
+ };
244
+ let e = await bt(i(this, M), t);
245
+ if (Z(e) && !_(i(this, M)) && (e = await Qt(i(this, M), t)), !e) return null;
246
+ if (!window.dashjs.supportsMediaSource()) {
247
+ const r = "[vidstack] `dash.js` is not supported in this environment";
248
+ return i(this, S).player.dispatch(new N("dash-unsupported")), i(this, S).notify("error", { message: r, code: 4 }), null;
249
+ }
250
+ return e;
251
+ }, ft = function() {
252
+ i(this, S).player.dispatch(new N("dash-lib-load-start"));
253
+ }, yt = function(t) {
254
+ i(this, S).player.dispatch(
255
+ new N("dash-lib-loaded", {
256
+ detail: t
257
+ })
258
+ ), i(this, $).call(this, t);
259
+ }, mt = function(t) {
260
+ const e = Ft(t);
261
+ i(this, S).player.dispatch(
262
+ new N("dash-lib-load-error", {
263
+ detail: e
264
+ })
265
+ ), i(this, S).notify("error", {
266
+ message: e.message,
267
+ code: 4,
268
+ error: e
269
+ });
270
+ };
271
+ async function Qt(n, t = {}) {
272
+ var e, r, l, g, y, u, m;
273
+ if (!Z(n)) {
274
+ if ((e = t.onLoadStart) == null || e.call(t), Gt(n))
275
+ return (r = t.onLoaded) == null || r.call(t, n), n;
276
+ if (X(n)) {
277
+ const c = n.MediaPlayer;
278
+ return (l = t.onLoaded) == null || l.call(t, c), c;
279
+ }
280
+ try {
281
+ const c = (g = await n()) == null ? void 0 : g.default;
282
+ if (X(c))
283
+ return (y = t.onLoaded) == null || y.call(t, c.MediaPlayer), c.MediaPlayer;
284
+ if (c)
285
+ (u = t.onLoaded) == null || u.call(t, c);
286
+ else
287
+ throw Error(
288
+ ""
289
+ );
290
+ return c;
291
+ } catch (c) {
292
+ (m = t.onLoadError) == null || m.call(t, c);
293
+ }
294
+ }
295
+ }
296
+ async function bt(n, t = {}) {
297
+ var e, r, l;
298
+ if (_(n)) {
299
+ (e = t.onLoadStart) == null || e.call(t);
300
+ try {
301
+ if (await Pt(n), !qt(window.dashjs.MediaPlayer))
302
+ throw Error(
303
+ ""
304
+ );
305
+ const g = window.dashjs.MediaPlayer;
306
+ return (r = t.onLoaded) == null || r.call(t, g), g;
307
+ } catch (g) {
308
+ (l = t.onLoadError) == null || l.call(t, g);
309
+ }
310
+ }
311
+ }
312
+ function Gt(n) {
313
+ return n && n.prototype && n.prototype !== Function;
314
+ }
315
+ function X(n) {
316
+ return n && "MediaPlayer" in n;
317
+ }
318
+ const Vt = "https://cdn.jsdelivr.net";
319
+ var j, T, D;
320
+ class Ut extends $t {
321
+ constructor() {
322
+ super(...arguments);
323
+ I(this, "$$PROVIDER_TYPE", "DASH");
324
+ f(this, j, null);
325
+ f(this, T, new It(this.video, this.ctx));
326
+ f(this, D, `${Vt}/npm/dashjs@4.7.4/dist/dash.all.min.js`);
327
+ }
328
+ /**
329
+ * The `dash.js` constructor.
330
+ */
331
+ get ctor() {
332
+ return i(this, j);
333
+ }
334
+ /**
335
+ * The current `dash.js` instance.
336
+ */
337
+ get instance() {
338
+ return i(this, T).instance;
339
+ }
340
+ get type() {
341
+ return "dash";
342
+ }
343
+ get canLiveSync() {
344
+ return !0;
345
+ }
346
+ /**
347
+ * The `dash.js` configuration object.
348
+ *
349
+ * @see {@link https://cdn.dashjs.org/latest/jsdoc/module-Settings.html}
350
+ */
351
+ get config() {
352
+ return i(this, T).config;
353
+ }
354
+ set config(e) {
355
+ i(this, T).config = e;
356
+ }
357
+ /**
358
+ * The `dash.js` constructor (supports dynamic imports) or a URL of where it can be found.
359
+ *
360
+ * @defaultValue `https://cdn.jsdelivr.net/npm/dashjs@4.7.4/dist/dash.all.min.js`
361
+ */
362
+ get library() {
363
+ return i(this, D);
364
+ }
365
+ set library(e) {
366
+ p(this, D, e);
367
+ }
368
+ preconnect() {
369
+ _(i(this, D)) && Lt(i(this, D));
370
+ }
371
+ setup() {
372
+ super.setup(), new Ot(i(this, D), this.ctx, (e) => {
373
+ p(this, j, e), i(this, T).setup(e), this.ctx.notify("provider-setup", this);
374
+ const r = At(this.ctx.$state.source);
375
+ r && this.loadSource(r);
376
+ });
377
+ }
378
+ async loadSource(e, r) {
379
+ if (!_(e.src)) {
380
+ this.removeSource();
381
+ return;
382
+ }
383
+ this.media.preload = r || "", this.appendSource(e, "application/x-mpegurl"), i(this, T).loadSource(e), this.currentSrc = e;
384
+ }
385
+ /**
386
+ * The given callback is invoked when a new `dash.js` instance is created and right before it's
387
+ * attached to media.
388
+ */
389
+ onInstance(e) {
390
+ const r = i(this, T).instance;
391
+ return r && e(r), i(this, T).onInstance(e);
392
+ }
393
+ destroy() {
394
+ i(this, T).destroy();
395
+ }
396
+ }
397
+ j = new WeakMap(), T = new WeakMap(), D = new WeakMap(), /**
398
+ * Whether `dash.js` is supported in this environment.
399
+ */
400
+ I(Ut, "supported", Et());
401
+ export {
402
+ Ut as DASHProvider
403
+ };