@validol4ik/uikit 0.14.8 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,65 +1,53 @@
1
- var ne = (t) => {
1
+ var te = (t) => {
2
2
  throw TypeError(t);
3
3
  };
4
- var x = (t, r, e) => r.has(t) || ne("Cannot " + e);
5
- var b = (t, r, e) => (x(t, r, "read from private field"), e ? e.call(t) : r.get(t)), I = (t, r, e) => r.has(t) ? ne("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(t) : r.set(t, e), M = (t, r, e, s) => (x(t, r, "write to private field"), s ? s.call(t, e) : r.set(t, e), e), oe = (t, r, e) => (x(t, r, "access private method"), e);
6
- import { ref as P, onBeforeUnmount as de, defineComponent as ke, computed as Se, watch as F, onMounted as Re, createElementBlock as k, openBlock as S, unref as w, createCommentVNode as O, createElementVNode as G, normalizeClass as ie, toDisplayString as _e, nextTick as we } from "vue";
7
- import { V as T, D as Te, S as Le, a as le, b as Pe, E as Ae, c as Oe, d as De, B as Ce, e as ce, P as Ie, f as Ve, r as ze, g as Me, t as Ke, W as Ne, h as Be } from "../playback-DxTLyUrL.js";
8
- import { _ as Ue } from "../_plugin-vue_export-helper-CHgC5LLL.js";
9
- const He = (t, r, e) => {
10
- var n;
11
- const s = (l) => !e.includes(l);
12
- return t.hlsSrc && r.hls && s(T.Hls) ? T.Hls : t.dashSrc && r.dash && s(T.Dash) ? T.Dash : (n = t.sources) != null && n.length && s(T.Progressive) ? T.Progressive : null;
13
- }, We = () => {
14
- var s, n;
15
- const { ManagedMediaSource: t, MediaSource: r, WebKitMediaSource: e } = window;
16
- return !!((n = (s = t ?? r ?? e) == null ? void 0 : s.isTypeSupported) != null && n.call(s, Te));
17
- }, Ye = (t) => Le.filter((r) => t.includes(r)), $e = (t) => {
18
- const r = Ye(t.map(({ size: s }) => s)), e = r.includes(le) ? le : r[0];
19
- return t.find((s) => s.size === e) ?? t[0] ?? null;
20
- }, je = () => /iPhone|iPod/.test(navigator.userAgent), xe = () => je() || /iPad/.test(navigator.userAgent) || /Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints > 1;
21
- var N, V, B, C, A, K, pe;
22
- class Fe extends EventTarget {
23
- constructor(e, s, n) {
4
+ var G = (t, r, e) => r.has(t) || te("Cannot " + e);
5
+ var k = (t, r, e) => (G(t, r, "read from private field"), e ? e.call(t) : r.get(t)), A = (t, r, e) => r.has(t) ? te("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(t) : r.set(t, e), I = (t, r, e, n) => (G(t, r, "write to private field"), n ? n.call(t, e) : r.set(t, e), e), re = (t, r, e) => (G(t, r, "access private method"), e);
6
+ import { ref as O, onBeforeUnmount as oe, defineComponent as ve, computed as ye, watch as se, onMounted as Ee, createElementBlock as S, openBlock as R, unref as w, createCommentVNode as L, createElementVNode as j, normalizeClass as ae, toDisplayString as be, nextTick as ke } from "vue";
7
+ import { D as Se, p as Re, E as ge, a as we, b as _e, i as Te, B as Pe, c as ne, P as Le, d as Oe, V as K, e as Ce, r as De, f as Ae, t as Ve, s as ze, W as Ie, g as Ke } from "../playback-CTKx1SmL.js";
8
+ import { _ as Ne } from "../_plugin-vue_export-helper-CHgC5LLL.js";
9
+ var B, V, M, D, P, N, ie;
10
+ class Be extends EventTarget {
11
+ constructor(e, n, i) {
24
12
  super();
25
- I(this, A);
26
- I(this, N);
27
- I(this, V);
28
- I(this, B);
29
- I(this, C, -1);
30
- M(this, N, e), M(this, V, [...s].sort((l, i) => i.size - l.size)), M(this, B, n);
13
+ A(this, P);
14
+ A(this, B);
15
+ A(this, V);
16
+ A(this, M);
17
+ A(this, D, -1);
18
+ I(this, B, e), I(this, V, [...n].sort((l, o) => o.size - l.size)), I(this, M, i);
31
19
  }
32
20
  get selectedIndex() {
33
- return b(this, C);
21
+ return k(this, D);
34
22
  }
35
23
  set selectedIndex(e) {
36
- const s = b(this, A, K);
37
- M(this, C, e), b(this, A, K) !== s && oe(this, A, pe).call(this), this.dispatchEvent(new Event("change"));
24
+ const n = k(this, P, N);
25
+ I(this, D, e), k(this, P, N) !== n && re(this, P, ie).call(this), this.dispatchEvent(new Event("change"));
38
26
  }
39
27
  *[Symbol.iterator]() {
40
- for (const [e, s] of b(this, V).entries())
28
+ for (const [e, n] of k(this, V).entries())
41
29
  yield {
42
- id: String(s.size),
43
- height: s.size,
44
- selected: e === b(this, C),
45
- active: s === b(this, A, K)
30
+ id: String(n.size),
31
+ height: n.size,
32
+ selected: e === k(this, D),
33
+ active: n === k(this, P, N)
46
34
  };
47
35
  }
48
36
  }
49
- N = new WeakMap(), V = new WeakMap(), B = new WeakMap(), C = new WeakMap(), A = new WeakSet(), K = function() {
50
- return b(this, V)[b(this, C)] ?? b(this, B);
37
+ B = new WeakMap(), V = new WeakMap(), M = new WeakMap(), D = new WeakMap(), P = new WeakSet(), N = function() {
38
+ return k(this, V)[k(this, D)] ?? k(this, M);
51
39
  }, // Loading a new src resets the position and speed
52
- pe = function() {
53
- const e = b(this, N), s = e.currentTime, n = e.playbackRate, l = !e.paused;
40
+ ie = function() {
41
+ const e = k(this, B), n = e.currentTime, i = e.playbackRate, l = !e.paused;
54
42
  e.addEventListener(
55
43
  "loadedmetadata",
56
44
  () => {
57
- s && (e.currentTime = s), e.playbackRate = n, l && e.play();
45
+ n && (e.currentTime = n), e.playbackRate = i, l && e.play();
58
46
  },
59
47
  { once: !0 }
60
- ), s && (e.preload = "metadata"), e.src = b(this, A, K).src;
48
+ ), n && (e.preload = "metadata"), e.src = k(this, P, N).src;
61
49
  };
62
- const Ge = (t, r) => {
50
+ const Me = (t, r) => {
63
51
  t.preload = "metadata", t.addEventListener(
64
52
  "loadedmetadata",
65
53
  () => {
@@ -68,118 +56,118 @@ const Ge = (t, r) => {
68
56
  },
69
57
  { once: !0 }
70
58
  );
71
- }, fe = () => {
59
+ }, le = () => {
72
60
  let t = 0, r = 0;
73
61
  return (e) => {
74
- const s = Date.now();
75
- if (s - r > De && (t = 0), r = s, t >= Ae) return !1;
76
- const n = t++;
77
- return setTimeout(() => e(n), Oe * 2 ** n), !0;
62
+ const n = Date.now();
63
+ if (n - r > _e && (t = 0), r = n, t >= ge) return !1;
64
+ const i = t++;
65
+ return setTimeout(() => e(i), we * 2 ** i), !0;
78
66
  };
79
- }, me = (t, r) => {
80
- const { currentTime: e, playbackRate: s, paused: n } = t;
67
+ }, ce = (t, r) => {
68
+ const { currentTime: e, playbackRate: n, paused: i } = t;
81
69
  return () => {
82
70
  t.addEventListener(
83
71
  "loadedmetadata",
84
72
  () => {
85
- t.currentTime = e, t.playbackRate = s, n || t.play().catch(() => {
73
+ t.currentTime = e, t.playbackRate = n, i || t.play().catch(() => {
86
74
  });
87
75
  },
88
76
  { once: !0 }
89
77
  ), r(e);
90
78
  };
91
- }, qe = (t, r, e) => {
92
- let s = null;
93
- const n = fe();
79
+ }, He = (t, r, e) => {
80
+ let n = null;
81
+ const i = le();
94
82
  t.addEventListener("loadstart", () => {
95
- if (!t.engine || t.engine === s) return;
96
- const i = t.engine;
97
- s = i;
98
- const f = () => t.engine === i;
99
- i.on(r.Events.ERROR, async (d, p) => {
100
- var R;
101
- if (!p.fatal) return;
102
- const h = (o) => {
83
+ if (!t.engine || t.engine === n) return;
84
+ const o = t.engine;
85
+ n = o;
86
+ const f = () => t.engine === o;
87
+ o.on(r.Events.ERROR, async (u, d) => {
88
+ var T;
89
+ if (!d.fatal) return;
90
+ const p = (a) => {
103
91
  var m, E;
104
92
  return e.report({
105
- type: p.type,
106
- details: p.details,
107
- status: (m = p.response) == null ? void 0 : m.code,
108
- url: ((E = p.frag) == null ? void 0 : E.url) ?? p.url,
109
- recovering: o
93
+ type: d.type,
94
+ details: d.details,
95
+ status: (m = d.response) == null ? void 0 : m.code,
96
+ url: ((E = d.frag) == null ? void 0 : E.url) ?? d.url,
97
+ recovering: a
110
98
  });
111
- }, u = () => {
112
- h(!0), e.dismissError();
99
+ }, y = () => {
100
+ p(!0), e.dismissError();
113
101
  };
114
- if (p.type === r.ErrorTypes.NETWORK_ERROR) {
115
- if (((R = p.response) == null ? void 0 : R.code) === 401 && await e.reauthorize()) {
116
- u(), i.startLoad(t.currentTime);
102
+ if (d.type === r.ErrorTypes.NETWORK_ERROR) {
103
+ if (((T = d.response) == null ? void 0 : T.code) === 401 && await e.reauthorize()) {
104
+ y(), o.startLoad(t.currentTime);
117
105
  return;
118
106
  }
119
- if (e.hasLoaded() && n(() => f() && i.startLoad(t.currentTime))) {
120
- u();
107
+ if (e.hasLoaded() && i(() => f() && o.startLoad(t.currentTime))) {
108
+ y();
121
109
  return;
122
110
  }
123
- } else if (p.type === r.ErrorTypes.MEDIA_ERROR && e.hasLoaded() && n((o) => {
124
- f() && (o > 0 && i.swapAudioCodec(), i.recoverMediaError());
111
+ } else if (d.type === r.ErrorTypes.MEDIA_ERROR && e.hasLoaded() && i((a) => {
112
+ f() && (a > 0 && o.swapAudioCodec(), o.recoverMediaError());
125
113
  })) {
126
- u();
114
+ y();
127
115
  return;
128
116
  }
129
- h(!1), e.fail();
130
- }), i.on(r.Events.FRAG_LOADED, e.loaded);
117
+ p(!1), e.fail();
118
+ }), o.on(r.Events.FRAG_LOADED, e.loaded);
131
119
  }), t.addEventListener("error", async () => {
132
120
  if (t.engine) return;
133
- const i = me(t, () => t.load()), f = (p) => {
134
- var h;
121
+ const o = ce(t, () => t.load()), f = (d) => {
122
+ var p;
135
123
  return e.report({
136
124
  type: "nativeError",
137
- details: String(((h = t.error) == null ? void 0 : h.code) ?? ""),
138
- recovering: p
125
+ details: String(((p = t.error) == null ? void 0 : p.code) ?? ""),
126
+ recovering: d
139
127
  });
140
128
  };
141
- if ((await e.reauthorize() || e.hasLoaded()) && n(() => t.isConnected && i())) {
129
+ if ((await e.reauthorize() || e.hasLoaded()) && i(() => t.isConnected && o())) {
142
130
  f(!0), e.dismissError();
143
131
  return;
144
132
  }
145
133
  f(!1), e.fail();
146
134
  }), t.addEventListener("loadeddata", e.loaded);
147
- const l = xe();
135
+ const l = Te();
148
136
  e.withCredentials && !l && (t.crossOrigin = "use-credentials"), t.source = {
149
137
  src: e.src,
150
138
  preferPlayback: l ? "native" : "mse"
151
139
  };
152
- }, Je = (t, r) => {
140
+ }, Fe = (t, r) => {
153
141
  const e = t.engine;
154
142
  e.setXHRWithCredentialsForType("default", r.withCredentials);
155
- const s = fe(), n = () => me(
143
+ const n = le(), i = () => ce(
156
144
  t,
157
145
  (l) => e.attachSource(r.src, l)
158
146
  );
159
147
  e.on("error", async (l) => {
160
- var p, h;
161
- const i = l.error, f = (h = (p = i.data) == null ? void 0 : p.response) == null ? void 0 : h.status, d = (u) => r.report({
148
+ var d, p;
149
+ const o = l.error, f = (p = (d = o.data) == null ? void 0 : d.response) == null ? void 0 : p.status, u = (y) => r.report({
162
150
  type: "dashError",
163
- details: String(i.code ?? ""),
151
+ details: String(o.code ?? ""),
164
152
  status: f,
165
- recovering: u
153
+ recovering: y
166
154
  });
167
155
  if (f === 401) {
168
156
  if (await r.reauthorize()) {
169
- d(!0), n()();
157
+ u(!0), i()();
170
158
  return;
171
159
  }
172
- } else if (!Pe.includes(i.code ?? -1))
160
+ } else if (!Se.includes(o.code ?? -1))
173
161
  return;
174
- d(!1), r.fail();
162
+ u(!1), r.fail();
175
163
  }), e.on("fragmentLoadingCompleted", r.loaded), t.addEventListener("error", () => {
176
164
  var f;
177
- const l = n(), i = r.hasLoaded() && s(() => t.isConnected && l());
165
+ const l = i(), o = r.hasLoaded() && n(() => t.isConnected && l());
178
166
  r.report({
179
167
  type: "mediaError",
180
168
  details: String(((f = t.error) == null ? void 0 : f.code) ?? ""),
181
- recovering: i
182
- }), i ? r.dismissError() : r.fail();
169
+ recovering: o
170
+ }), o ? r.dismissError() : r.fail();
183
171
  }), t.source = {
184
172
  src: r.src,
185
173
  engine: {
@@ -192,117 +180,101 @@ const Ge = (t, r) => {
192
180
  }
193
181
  }
194
182
  };
195
- }, Qe = (t, r) => {
196
- const e = $e(r);
183
+ }, We = (t, r) => {
184
+ const e = Re(r);
197
185
  e && (Object.assign(t, {
198
- videoRenditions: new Fe(t, r, e)
186
+ videoRenditions: new Be(t, r, e)
199
187
  }), t.src = e.src);
200
- }, Xe = "media-controls-content, .media-popup, media-error-dialog", Ze = (t) => t instanceof Element && t.matches(Xe), et = (t) => {
201
- const r = P(!1);
202
- let e, s = 1, n = !1, l = null;
203
- const i = () => {
204
- var o;
205
- return (o = t.value) == null ? void 0 : o.store;
188
+ }, Ye = "media-controls-content, .media-popup, media-error-dialog", Ge = (t) => t instanceof Element && t.matches(Ye), je = (t) => {
189
+ const r = O(!1);
190
+ let e, n = 1, i = !1, l = null;
191
+ const o = () => {
192
+ var a;
193
+ return (a = t.value) == null ? void 0 : a.store;
206
194
  }, f = () => {
207
- n = !0;
208
- const o = i();
209
- !o || o.paused || o.playbackRate >= ce || (s = o.playbackRate, o.setPlaybackRate(ce), r.value = !0);
210
- }, d = () => {
195
+ i = !0;
196
+ const a = o();
197
+ !a || a.paused || a.playbackRate >= ne || (n = a.playbackRate, a.setPlaybackRate(ne), r.value = !0);
198
+ }, u = () => {
211
199
  var m;
212
200
  clearTimeout(e), l == null || l(), l = null;
213
- const o = n;
214
- return n = !1, r.value && (r.value = !1, (m = i()) == null || m.setPlaybackRate(s)), o;
215
- }, p = (o, m, E) => {
216
- d(), m && (e = setTimeout(f, Ce));
217
- const _ = (v) => {
218
- if (v instanceof KeyboardEvent) {
219
- if (v.key !== " ") return;
220
- v.preventDefault(), v.stopPropagation();
201
+ const a = i;
202
+ return i = !1, r.value && (r.value = !1, (m = o()) == null || m.setPlaybackRate(n)), a;
203
+ }, d = (a, m, E) => {
204
+ u(), m && (e = setTimeout(f, Pe));
205
+ const g = (h) => {
206
+ if (h instanceof KeyboardEvent) {
207
+ if (h.key !== " ") return;
208
+ h.preventDefault(), h.stopPropagation();
221
209
  }
222
- const L = d();
223
- E == null || E(L);
210
+ const _ = u();
211
+ E == null || E(_);
224
212
  };
225
- o.forEach((v) => window.addEventListener(v, _, !0)), window.addEventListener("blur", d), l = () => {
226
- o.forEach(
227
- (v) => window.removeEventListener(v, _, !0)
228
- ), window.removeEventListener("blur", d);
213
+ a.forEach((h) => window.addEventListener(h, g, !0)), window.addEventListener("blur", u), l = () => {
214
+ a.forEach(
215
+ (h) => window.removeEventListener(h, g, !0)
216
+ ), window.removeEventListener("blur", u);
229
217
  };
230
- }, h = (o) => {
231
- var v;
232
- if (o.key !== " " || o.altKey || o.ctrlKey || o.metaKey)
218
+ }, p = (a) => {
219
+ var h;
220
+ if (a.key !== " " || a.altKey || a.ctrlKey || a.metaKey)
233
221
  return;
234
- if (o.repeat) {
235
- l && (o.preventDefault(), o.stopPropagation());
222
+ if (a.repeat) {
223
+ l && (a.preventDefault(), a.stopPropagation());
236
224
  return;
237
225
  }
238
- const m = i(), E = document.activeElement;
239
- if (!m || !E || !((v = t.value) != null && v.contains(E))) return;
240
- o.preventDefault(), o.stopPropagation();
241
- const _ = m.paused;
242
- _ && m.play(), p(["keyup"], !_, (L) => {
243
- !_ && !L && m.pause();
226
+ const m = o(), E = document.activeElement;
227
+ if (!m || !E || !((h = t.value) != null && h.contains(E))) return;
228
+ a.preventDefault(), a.stopPropagation();
229
+ const g = m.paused;
230
+ g && m.play(), d(["keyup"], !g, (_) => {
231
+ !g && !_ && m.pause();
244
232
  });
245
- }, u = (o) => {
246
- const m = i();
247
- !m || m.paused || o.button !== 0 || o.composedPath().some(Ze) || p(["pointerup", "pointercancel"], !0);
248
- }, R = (o) => {
249
- r.value && o.preventDefault();
233
+ }, y = (a) => {
234
+ const m = o();
235
+ !m || m.paused || a.button !== 0 || a.composedPath().some(Ge) || d(["pointerup", "pointercancel"], !0);
236
+ }, T = (a) => {
237
+ r.value && a.preventDefault();
250
238
  };
251
- return de(d), { boosted: r, release: d, onKeyDown: h, onPointerDown: u, onContextMenu: R };
252
- }, tt = 359999.999, Y = (t, r = 2) => String(t).padStart(r, "0"), ue = (t) => {
253
- const r = Math.round(t * 1e3), e = Math.floor(r / 36e5), s = Math.floor(r / 6e4) % 60, n = Math.floor(r / 1e3) % 60;
254
- return `${Y(e)}:${Y(s)}:${Y(n)}.${Y(r % 1e3, 3)}`;
255
- }, rt = (t) => t.replace(/\s+/g, " ").replace(/-->/g, "->").trim(), st = (t) => {
256
- const r = [...t].sort((s, n) => s.start - n.start);
257
- return `${["WEBVTT", ...r.map((s, n) => {
258
- var i;
259
- const l = ((i = r[n + 1]) == null ? void 0 : i.start) ?? tt;
260
- return `${ue(s.start)} --> ${ue(l)}
261
- ${rt(s.title)}`;
262
- })].join(`
263
-
264
- `)}
265
- `;
266
- }, q = "app-video-player", at = `linear-gradient(to top,
267
- color-mix(in oklab, var(--media-backdrop) 40%, transparent),
268
- color-mix(in oklab, var(--media-backdrop) 12%, transparent) 50%,
269
- color-mix(in oklab, var(--media-backdrop) 2%, transparent) 75%,
270
- transparent)`, nt = async () => {
271
- if (customElements.get(q)) return;
239
+ return oe(u), { boosted: r, release: u, onKeyDown: p, onPointerDown: y, onContextMenu: T };
240
+ }, U = "app-video-player", Ue = `linear-gradient(to top,
241
+ color-mix(in oklab, var(--media-backdrop) 25%, transparent),
242
+ color-mix(in oklab, var(--media-backdrop) 8%, transparent) 50%,
243
+ color-mix(in oklab, var(--media-backdrop) 1%, transparent) 75%,
244
+ transparent)`, qe = "rgb(0 0 0 / 0.4)", Je = async () => {
245
+ if (customElements.get(U)) return;
272
246
  const [{ createPlayer: t, definePlayerFeature: r }, { videoFeatures: e }] = await Promise.all([
273
247
  import("@videojs/html"),
274
248
  import("@videojs/html/video")
275
- ]), s = r({
249
+ ]), n = r({
276
250
  name: "idleControls",
277
251
  // the fields belong to the playback and controls features, this one only reads and sets them
278
252
  state: () => ({}),
279
- attach({ target: l, signal: i, store: f, get: d, set: p }) {
280
- var R;
281
- (R = l.container) == null || R.style.setProperty(
282
- "--media-controls-gradient",
283
- at
284
- );
285
- const h = () => {
286
- const { paused: o, started: m, ended: E, userActive: _, controlsVisible: v } = d();
287
- return o && m && !E && !_ && v;
288
- }, u = f.subscribe(() => {
289
- h() && queueMicrotask(() => {
290
- !i.aborted && h() && p({ controlsVisible: !1 });
253
+ attach({ target: l, signal: o, store: f, get: u, set: d }) {
254
+ var a;
255
+ const p = (a = l.container) == null ? void 0 : a.style;
256
+ p == null || p.setProperty("--media-controls-gradient", Ue), p == null || p.setProperty("--media-popover", qe);
257
+ const y = () => {
258
+ const { paused: m, started: E, ended: g, userActive: h, controlsVisible: _ } = u();
259
+ return m && E && !g && !h && _;
260
+ }, T = f.subscribe(() => {
261
+ y() && queueMicrotask(() => {
262
+ !o.aborted && y() && d({ controlsVisible: !1 });
291
263
  });
292
264
  });
293
- i.addEventListener("abort", u, { once: !0 });
265
+ o.addEventListener("abort", T, { once: !0 });
294
266
  }
295
- }), { PlayerElement: n } = t({
296
- features: [...e, s]
267
+ }), { PlayerElement: i } = t({
268
+ features: [...e, n]
297
269
  });
298
- customElements.get(q) || customElements.define(q, n);
299
- }, ot = ["lang"], it = ["poster", "default-playback-rates"], lt = { class: "app-video__skin" }, ct = ["crossorigin"], ut = ["src"], dt = ["src"], pt = ["crossorigin"], ft = ["src"], mt = ["src"], ht = ["crossorigin"], vt = ["src"], yt = ["src"], Et = /* @__PURE__ */ ke({
270
+ customElements.get(U) || customElements.define(U, i);
271
+ }, Xe = ["lang"], Qe = ["poster", "default-playback-rates"], Ze = { class: "app-video__skin" }, $e = ["crossorigin"], xe = ["src"], et = ["src"], tt = ["crossorigin"], rt = ["src"], st = ["src"], at = ["crossorigin"], nt = ["src"], ot = ["src"], it = /* @__PURE__ */ ve({
300
272
  __name: "AppVideo",
301
273
  props: {
302
274
  hlsSrc: {},
303
275
  dashSrc: {},
304
276
  sources: {},
305
- chapters: {},
277
+ chaptersSrc: {},
306
278
  thumbnailsSrc: {},
307
279
  poster: {},
308
280
  withCredentials: { type: Boolean, default: !0 },
@@ -313,219 +285,210 @@ ${rt(s.title)}`;
313
285
  },
314
286
  emits: ["error", "progress", "ended"],
315
287
  setup(t, { emit: r }) {
316
- const e = t, s = r, n = P(null), l = P(null), i = P(null), f = P([]), d = P(null), p = P(!0), h = P(!1), u = P(null), R = Se(() => {
317
- if (e.thumbnailsSrc)
288
+ const e = t, n = r, i = O(null), l = O(null), o = O(null), f = O([]), u = O(null), d = O(!0), p = O(!1), y = ye(() => {
289
+ if (!(!e.chaptersSrc && !e.thumbnailsSrc))
318
290
  return e.withCredentials ? "use-credentials" : "anonymous";
319
- }), { boosted: o, release: m, onKeyDown: E, onPointerDown: _, onContextMenu: v } = et(n);
320
- let L = null, U = !1, H = !1, z, J, Q, $ = 0, g = null;
321
- const he = (a) => {
291
+ }), { boosted: T, release: a, onKeyDown: m, onPointerDown: E, onContextMenu: g } = je(i);
292
+ let h = null, _ = !1, H = !1, z, q, J, W = 0, b = null;
293
+ const ue = (s) => {
322
294
  var c;
323
- if (d.value !== a) return;
324
- const y = H ? l.value : null;
325
- g = {
326
- time: y ? y.currentTime : (g == null ? void 0 : g.time) ?? 0,
327
- rate: y ? y.playbackRate : (g == null ? void 0 : g.rate) ?? 1,
328
- playing: !!(g != null && g.playing) || ((c = n.value) == null ? void 0 : c.store.paused) === !1
329
- }, f.value = [...f.value, a];
295
+ if (u.value !== s) return;
296
+ const v = H ? l.value : null;
297
+ b = {
298
+ time: v ? v.currentTime : (b == null ? void 0 : b.time) ?? 0,
299
+ rate: v ? v.playbackRate : (b == null ? void 0 : b.rate) ?? 1,
300
+ playing: !!(b != null && b.playing) || ((c = i.value) == null ? void 0 : c.store.paused) === !1
301
+ }, f.value = [...f.value, s];
330
302
  }, X = async () => {
331
303
  if (!e.authorize) return !0;
332
304
  try {
333
305
  return await e.authorize(), !0;
334
- } catch (a) {
335
- return console.error("Video authorization failed", a), !1;
306
+ } catch (s) {
307
+ return console.error("Video authorization failed", s), !1;
336
308
  }
337
- }, Z = (a, y) => ({
338
- src: a ?? "",
309
+ }, Q = (s, v) => ({
310
+ src: s ?? "",
339
311
  withCredentials: e.withCredentials,
340
- reauthorize: async () => U ? !1 : (U = !0, X()),
312
+ reauthorize: async () => _ ? !1 : (_ = !0, X()),
341
313
  loaded: () => {
342
- U = !1, H = !0;
314
+ _ = !1, H = !0;
343
315
  },
344
316
  hasLoaded: () => H,
345
- fail: () => he(y),
317
+ fail: () => ue(v),
346
318
  report: (c) => {
347
- var D;
348
- return s("error", {
319
+ var C;
320
+ return n("error", {
349
321
  ...c,
350
- mode: y,
351
- time: ((D = l.value) == null ? void 0 : D.currentTime) ?? 0
322
+ mode: v,
323
+ time: ((C = l.value) == null ? void 0 : C.currentTime) ?? 0
352
324
  });
353
325
  },
354
326
  dismissError: () => queueMicrotask(() => {
355
327
  var c;
356
- return (c = n.value) == null ? void 0 : c.store.dismissError();
328
+ return (c = i.value) == null ? void 0 : c.store.dismissError();
357
329
  })
358
- }), ve = () => {
359
- e.watermark && (J = setInterval(() => {
360
- var a;
361
- (((a = n.value) == null ? void 0 : a.store.paused) ?? !0) || (h.value = !0, Q = setTimeout(() => {
362
- h.value = !1;
363
- }, Ne));
364
- }, Be));
365
- }, ee = () => {
366
- var a;
367
- u.value && URL.revokeObjectURL(u.value), u.value = (a = e.chapters) != null && a.length ? URL.createObjectURL(
368
- new Blob([st(e.chapters)], { type: "text/vtt" })
369
- ) : null;
370
- }, ye = async (a) => {
371
- var se;
372
- const y = ++$;
373
- await we();
374
- const c = l.value, D = (se = n.value) == null ? void 0 : se.store;
375
- if (!(!c || !D) && (U = !1, H = !1, a !== T.Progressive && await X(), y === $)) {
376
- if (e.resumeKey && ze(c, e.resumeKey), Me(c, () => o.value), Ke(
330
+ }), de = () => {
331
+ e.watermark && (q = setInterval(() => {
332
+ var s;
333
+ (((s = i.value) == null ? void 0 : s.store.paused) ?? !0) || (p.value = !0, J = setTimeout(() => {
334
+ p.value = !1;
335
+ }, Ie));
336
+ }, Ke));
337
+ }, pe = async (s) => {
338
+ var x;
339
+ const v = ++W;
340
+ await ke();
341
+ const c = l.value, C = (x = i.value) == null ? void 0 : x.store;
342
+ if (!(!c || !C) && (_ = !1, H = !1, s !== K.Progressive && await X(), v === W)) {
343
+ if (e.resumeKey && De(c, e.resumeKey), Ae(c, () => T.value), Ve(
377
344
  c,
378
- (W) => s("progress", W),
379
- () => s("ended")
380
- ), g) {
381
- const { time: W, rate: ge, playing: be } = g, ae = () => {
382
- g = null, W && (c.currentTime = W), c.playbackRate = ge;
345
+ (F) => n("progress", F),
346
+ () => n("ended")
347
+ ), b) {
348
+ const { time: F, rate: me, playing: he } = b, ee = () => {
349
+ b = null, F && (c.currentTime = F), c.playbackRate = me;
383
350
  };
384
- be ? Ge(c, ae) : c.addEventListener("loadedmetadata", ae, { once: !0 });
351
+ he ? Me(c, ee) : c.addEventListener("loadedmetadata", ee, { once: !0 });
385
352
  }
386
- a === T.Hls && L ? qe(
353
+ s === K.Hls && h ? He(
387
354
  c,
388
- L,
389
- Z(e.hlsSrc, a)
390
- ) : a === T.Dash ? Je(
355
+ h,
356
+ Q(e.hlsSrc, s)
357
+ ) : s === K.Dash ? Fe(
391
358
  c,
392
- Z(e.dashSrc, a)
393
- ) : Qe(c, e.sources ?? []), p.value = D.controlsVisible, z = D.subscribe(() => {
394
- p.value = D.controlsVisible;
395
- }), ve();
359
+ Q(e.dashSrc, s)
360
+ ) : We(c, e.sources ?? []), d.value = C.controlsVisible, z = C.subscribe(() => {
361
+ d.value = C.controlsVisible;
362
+ }), de();
396
363
  }
397
- }, j = () => {
398
- $++, m(), z == null || z(), z = void 0, clearInterval(J), clearTimeout(Q), h.value = !1;
399
- }, te = () => {
400
- if (!i.value) return;
401
- const a = He(e, i.value, f.value);
402
- a !== d.value && (!a && d.value || (j(), d.value = a, a && ye(a)));
403
- }, Ee = async () => {
404
- const [a] = await Promise.all([
364
+ }, Y = () => {
365
+ W++, a(), z == null || z(), z = void 0, clearInterval(q), clearTimeout(J), p.value = !1;
366
+ }, Z = () => {
367
+ if (!o.value) return;
368
+ const s = Ce(e, o.value, f.value);
369
+ s !== u.value && (!s && u.value || (Y(), u.value = s, s && pe(s)));
370
+ }, fe = async () => {
371
+ const [s] = await Promise.all([
405
372
  e.hlsSrc ? import("@videojs/hlsjs-video") : null,
406
373
  e.hlsSrc ? import("@videojs/html/media/hlsjs-video") : null,
407
374
  e.dashSrc ? import("@videojs/html/media/dash-video") : null,
408
375
  import("@videojs/html/i18n"),
409
376
  import("@videojs/html/i18n/locales/uk/register"),
410
- nt(),
377
+ Je(),
411
378
  import("@videojs/html/video/skin")
412
379
  ]);
413
- return L = (a == null ? void 0 : a.Hls) ?? null, {
414
- hls: !!L && (L.isSupported() || !!document.createElement("video").canPlayType("application/vnd.apple.mpegurl")),
415
- dash: !!e.dashSrc && We()
380
+ return h = (s == null ? void 0 : s.Hls) ?? null, {
381
+ hls: !!h && (h.isSupported() || !!document.createElement("video").canPlayType("application/vnd.apple.mpegurl")),
382
+ dash: !!e.dashSrc && ze()
416
383
  };
417
- }, re = async () => {
418
- i.value = await Ee(), te();
384
+ }, $ = async () => {
385
+ o.value = await fe(), Z();
419
386
  };
420
- return F(f, te), F(() => JSON.stringify(e.chapters), ee), F(
387
+ return se(f, Z), se(
421
388
  () => JSON.stringify([e.hlsSrc, e.dashSrc, e.sources]),
422
389
  () => {
423
- j(), g = null, d.value = null, i.value = null, f.value = [], re();
390
+ Y(), b = null, u.value = null, o.value = null, f.value = [], $();
424
391
  }
425
- ), Re(() => {
426
- ee(), re();
427
- }), de(() => {
428
- j(), u.value && URL.revokeObjectURL(u.value);
429
- }), (a, y) => (S(), k("div", {
392
+ ), Ee($), oe(Y), (s, v) => (R(), S("div", {
430
393
  class: "app-video",
431
- onKeydownCapture: y[0] || (y[0] = //@ts-ignore
394
+ onKeydownCapture: v[0] || (v[0] = //@ts-ignore
395
+ (...c) => w(m) && w(m)(...c)),
396
+ onPointerdownCapture: v[1] || (v[1] = //@ts-ignore
432
397
  (...c) => w(E) && w(E)(...c)),
433
- onPointerdownCapture: y[1] || (y[1] = //@ts-ignore
434
- (...c) => w(_) && w(_)(...c)),
435
- onContextmenuCapture: y[2] || (y[2] = //@ts-ignore
436
- (...c) => w(v) && w(v)(...c))
398
+ onContextmenuCapture: v[2] || (v[2] = //@ts-ignore
399
+ (...c) => w(g) && w(g)(...c))
437
400
  }, [
438
- d.value ? (S(), k("media-i18n", {
439
- key: d.value,
440
- lang: w(Ie)
401
+ u.value ? (R(), S("media-i18n", {
402
+ key: u.value,
403
+ lang: w(Le)
441
404
  }, [
442
- G("app-video-player", {
405
+ j("app-video-player", {
443
406
  ref_key: "playerEl",
444
- ref: n,
445
- poster: a.poster,
446
- "default-playback-rates": w(Ve).join(" ")
407
+ ref: i,
408
+ poster: s.poster,
409
+ "default-playback-rates": w(Oe)().join(" ")
447
410
  }, [
448
- G("video-skin", lt, [
449
- d.value === w(T).Hls ? (S(), k("hlsjs-video", {
411
+ j("video-skin", Ze, [
412
+ u.value === w(K).Hls ? (R(), S("hlsjs-video", {
450
413
  key: 0,
451
414
  ref_key: "mediaEl",
452
415
  ref: l,
453
- crossorigin: R.value,
416
+ crossorigin: y.value,
454
417
  preload: "none",
455
418
  playsinline: ""
456
419
  }, [
457
- u.value ? (S(), k("track", {
458
- key: u.value,
420
+ s.chaptersSrc ? (R(), S("track", {
421
+ key: s.chaptersSrc,
459
422
  kind: "chapters",
460
423
  default: "",
461
- src: u.value
462
- }, null, 8, ut)) : O("", !0),
463
- a.thumbnailsSrc ? (S(), k("track", {
464
- key: a.thumbnailsSrc,
424
+ src: s.chaptersSrc
425
+ }, null, 8, xe)) : L("", !0),
426
+ s.thumbnailsSrc ? (R(), S("track", {
427
+ key: s.thumbnailsSrc,
465
428
  kind: "metadata",
466
429
  label: "thumbnails",
467
430
  default: "",
468
- src: a.thumbnailsSrc
469
- }, null, 8, dt)) : O("", !0)
470
- ], 8, ct)) : d.value === w(T).Dash ? (S(), k("dash-video", {
431
+ src: s.thumbnailsSrc
432
+ }, null, 8, et)) : L("", !0)
433
+ ], 8, $e)) : u.value === w(K).Dash ? (R(), S("dash-video", {
471
434
  key: 1,
472
435
  ref_key: "mediaEl",
473
436
  ref: l,
474
- crossorigin: R.value,
437
+ crossorigin: y.value,
475
438
  preload: "none",
476
439
  playsinline: ""
477
440
  }, [
478
- u.value ? (S(), k("track", {
479
- key: u.value,
441
+ s.chaptersSrc ? (R(), S("track", {
442
+ key: s.chaptersSrc,
480
443
  kind: "chapters",
481
444
  default: "",
482
- src: u.value
483
- }, null, 8, ft)) : O("", !0),
484
- a.thumbnailsSrc ? (S(), k("track", {
485
- key: a.thumbnailsSrc,
445
+ src: s.chaptersSrc
446
+ }, null, 8, rt)) : L("", !0),
447
+ s.thumbnailsSrc ? (R(), S("track", {
448
+ key: s.thumbnailsSrc,
486
449
  kind: "metadata",
487
450
  label: "thumbnails",
488
451
  default: "",
489
- src: a.thumbnailsSrc
490
- }, null, 8, mt)) : O("", !0)
491
- ], 8, pt)) : (S(), k("video", {
452
+ src: s.thumbnailsSrc
453
+ }, null, 8, st)) : L("", !0)
454
+ ], 8, tt)) : (R(), S("video", {
492
455
  key: 2,
493
456
  ref_key: "mediaEl",
494
457
  ref: l,
495
- crossorigin: R.value,
458
+ crossorigin: y.value,
496
459
  preload: "none",
497
460
  playsinline: ""
498
461
  }, [
499
- u.value ? (S(), k("track", {
500
- key: u.value,
462
+ s.chaptersSrc ? (R(), S("track", {
463
+ key: s.chaptersSrc,
501
464
  kind: "chapters",
502
465
  default: "",
503
- src: u.value
504
- }, null, 8, vt)) : O("", !0),
505
- a.thumbnailsSrc ? (S(), k("track", {
506
- key: a.thumbnailsSrc,
466
+ src: s.chaptersSrc
467
+ }, null, 8, nt)) : L("", !0),
468
+ s.thumbnailsSrc ? (R(), S("track", {
469
+ key: s.thumbnailsSrc,
507
470
  kind: "metadata",
508
471
  label: "thumbnails",
509
472
  default: "",
510
- src: a.thumbnailsSrc
511
- }, null, 8, yt)) : O("", !0)
512
- ], 8, ht)),
513
- a.watermark ? (S(), k("div", {
473
+ src: s.thumbnailsSrc
474
+ }, null, 8, ot)) : L("", !0)
475
+ ], 8, at)),
476
+ s.watermark ? (R(), S("div", {
514
477
  key: 3,
515
- class: ie(["app-video__watermark", {
516
- "app-video__watermark_visible": h.value,
517
- "app-video__watermark_raised": p.value
478
+ class: ae(["app-video__watermark", {
479
+ "app-video__watermark_visible": p.value,
480
+ "app-video__watermark_raised": d.value
518
481
  }])
519
- }, _e(a.watermark), 3)) : O("", !0),
520
- G("div", {
521
- class: ie(["app-video__boost", { "app-video__boost_visible": w(o) }])
482
+ }, be(s.watermark), 3)) : L("", !0),
483
+ j("div", {
484
+ class: ae(["app-video__boost", { "app-video__boost_visible": w(T) }])
522
485
  }, " 2× ", 2)
523
486
  ])
524
- ], 8, it)
525
- ], 8, ot)) : O("", !0)
487
+ ], 8, Qe)
488
+ ], 8, Xe)) : L("", !0)
526
489
  ], 32));
527
490
  }
528
- }), Rt = /* @__PURE__ */ Ue(Et, [["__scopeId", "data-v-bde5aa9e"]]);
491
+ }), pt = /* @__PURE__ */ Ne(it, [["__scopeId", "data-v-db629255"]]);
529
492
  export {
530
- Rt as AppVideo
493
+ pt as AppVideo
531
494
  };