@glitchlab/vue-video-player 1.3.0 → 1.5.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.
package/dist/index.mjs CHANGED
@@ -1,19 +1,27 @@
1
- import { defineComponent as T, ref as w, onMounted as fe, watch as F, onBeforeUnmount as X, openBlock as i, createElementBlock as v, normalizeClass as C, renderSlot as ke, createElementVNode as s, computed as Z, createVNode as j, toDisplayString as q, Fragment as oe, renderList as ae, createCommentVNode as M, createBlock as U, normalizeStyle as ce, unref as J, withCtx as xe } from "vue";
1
+ import { defineComponent as I, ref as y, onMounted as He, watch as R, onBeforeUnmount as ne, openBlock as d, createElementBlock as f, normalizeClass as w, renderSlot as Fe, createElementVNode as r, computed as T, createVNode as Z, toDisplayString as U, Fragment as ie, renderList as ue, createCommentVNode as M, createBlock as z, normalizeStyle as re, withDirectives as We, vShow as ze, unref as te, withCtx as Ye } from "vue";
2
2
  import ee from "hls.js";
3
- function he(t, a, l) {
3
+ function Ve(t, a, n) {
4
4
  const e = t == null ? void 0 : t.trim();
5
5
  if (e) return e;
6
6
  if (a) {
7
7
  try {
8
- const m = new Intl.DisplayNames(void 0, { type: "language" }).of(a);
9
- if (m && m !== a) return m;
8
+ const o = new Intl.DisplayNames(void 0, { type: "language" }).of(a);
9
+ if (o && o !== a) return o;
10
10
  } catch {
11
11
  }
12
12
  return a;
13
13
  }
14
- return `Audio ${l + 1}`;
14
+ return `Audio ${n + 1}`;
15
15
  }
16
- const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "poster"], Ee = /* @__PURE__ */ T({
16
+ const Ke = {
17
+ index: -1,
18
+ height: 0,
19
+ label: "Auto"
20
+ };
21
+ function Xe(t, a) {
22
+ return t > 0 ? `${t}p` : `Level ${a + 1}`;
23
+ }
24
+ const Je = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "poster"], Ge = /* @__PURE__ */ I({
17
25
  __name: "HLSPlayer",
18
26
  props: {
19
27
  src: {},
@@ -27,95 +35,113 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
27
35
  preload: { default: "metadata" },
28
36
  poster: {},
29
37
  class: {},
30
- audioTrackIndex: { default: -1 }
38
+ audioTrackIndex: { default: -1 },
39
+ qualityLevelIndex: { default: -1 }
31
40
  },
32
- emits: ["play", "pause", "audio-tracks"],
33
- setup(t, { expose: a, emit: l }) {
34
- const e = t, o = l, m = w(null), g = w(null);
35
- let p, L;
36
- const P = globalThis.window !== void 0 && ee.isSupported(), x = (r) => !!e.isHls || P && r.endsWith(".m3u8");
37
- function _() {
38
- L == null || L(), L = void 0, p == null || p(), p = void 0, g.value && (g.value.destroy(), g.value = null);
39
- const r = m.value;
40
- if (r) {
41
- for (r.pause(), r.removeAttribute("src"); r.firstChild; ) r.firstChild.remove();
42
- r.load(), o("audio-tracks", []);
41
+ emits: ["play", "pause", "ended", "audio-tracks", "quality-levels", "current-level"],
42
+ setup(t, { expose: a, emit: n }) {
43
+ const e = t, c = n, o = y(null), h = y(null);
44
+ let g, E;
45
+ const _ = globalThis.window !== void 0 && ee.isSupported(), $ = (p) => !!e.isHls || _ && p.endsWith(".m3u8");
46
+ function S() {
47
+ E == null || E(), E = void 0, g == null || g(), g = void 0, h.value && (h.value.destroy(), h.value = null);
48
+ const p = o.value;
49
+ if (p) {
50
+ for (p.pause(), p.removeAttribute("src"); p.firstChild; ) p.firstChild.remove();
51
+ p.load(), c("audio-tracks", []), c("quality-levels", []), c("current-level", -1);
43
52
  }
44
53
  }
45
- function k(r) {
46
- var R, H, A;
47
- const b = m.value;
48
- if (!b || !r) return;
49
- _();
50
- const E = () => {
51
- e.autoPlay && b.play().catch(() => {
54
+ function b(p) {
55
+ var Y, A, J;
56
+ const x = o.value;
57
+ if (!x || !p) return;
58
+ S();
59
+ const B = () => {
60
+ e.autoPlay && x.play().catch(() => {
52
61
  });
53
62
  };
54
- if (x(r)) {
55
- const y = new ee(e.hlsConfig);
56
- g.value = y;
57
- const I = () => {
58
- const D = y.audioTracks.map((B, N) => ({
59
- index: N,
60
- label: he(B.name, B.lang, N),
61
- lang: B.lang || void 0
63
+ if ($(p)) {
64
+ const k = new ee(e.hlsConfig);
65
+ h.value = k;
66
+ const N = () => {
67
+ const H = k.audioTracks.map((V, O) => ({
68
+ index: O,
69
+ label: Ve(V.name, V.lang, O),
70
+ lang: V.lang || void 0
62
71
  }));
63
- o("audio-tracks", D);
72
+ c("audio-tracks", H);
73
+ }, D = () => {
74
+ const H = k.levels.map((V, O) => ({
75
+ index: O,
76
+ height: V.height || 0,
77
+ label: Xe(V.height || 0, O)
78
+ }));
79
+ c("quality-levels", H);
64
80
  };
65
- y.on(ee.Events.MANIFEST_PARSED, E), y.on(ee.Events.AUDIO_TRACKS_UPDATED, I), y.on(ee.Events.AUDIO_TRACK_SWITCHED, I), y.on(ee.Events.ERROR, (D, B) => {
66
- B.fatal && (y.destroy(), g.value = null);
67
- }), y.attachMedia(b), y.loadSource(r);
81
+ k.on(ee.Events.MANIFEST_PARSED, B), k.on(ee.Events.MANIFEST_PARSED, D), k.on(ee.Events.LEVELS_UPDATED, D), k.on(ee.Events.LEVEL_SWITCHED, (H, V) => {
82
+ c("current-level", V.level);
83
+ }), k.on(ee.Events.AUDIO_TRACKS_UPDATED, N), k.on(ee.Events.AUDIO_TRACK_SWITCHED, N), k.on(ee.Events.ERROR, (H, V) => {
84
+ V.fatal && (k.destroy(), h.value = null);
85
+ }), k.attachMedia(x), k.loadSource(p);
68
86
  } else {
69
- b.src = r, b.load(), b.addEventListener("loadedmetadata", E, { once: !0 }), L = () => {
70
- b.removeEventListener("loadedmetadata", E);
87
+ x.src = p, x.load(), x.addEventListener("loadedmetadata", B, { once: !0 }), E = () => {
88
+ x.removeEventListener("loadedmetadata", B);
71
89
  };
72
- const y = b.audioTracks;
73
- if (y) {
74
- const I = () => {
90
+ const k = x.audioTracks;
91
+ if (k) {
92
+ const N = () => {
75
93
  const D = [];
76
- for (let B = 0; B < y.length; B++) {
77
- const N = y[B];
94
+ for (let H = 0; H < k.length; H++) {
95
+ const V = k[H];
78
96
  D.push({
79
- index: B,
80
- label: he(N.label, N.language, B),
81
- lang: N.language || void 0
97
+ index: H,
98
+ label: Ve(V.label, V.language, H),
99
+ lang: V.language || void 0
82
100
  });
83
101
  }
84
- o("audio-tracks", D);
102
+ c("audio-tracks", D);
85
103
  };
86
- (R = y.addEventListener) == null || R.call(y, "addtrack", I), (H = y.addEventListener) == null || H.call(y, "removetrack", I), (A = y.addEventListener) == null || A.call(y, "change", I), y.length > 0 && I(), p = () => {
87
- var D, B, N;
88
- (D = y.removeEventListener) == null || D.call(y, "addtrack", I), (B = y.removeEventListener) == null || B.call(y, "removetrack", I), (N = y.removeEventListener) == null || N.call(y, "change", I);
104
+ (Y = k.addEventListener) == null || Y.call(k, "addtrack", N), (A = k.addEventListener) == null || A.call(k, "removetrack", N), (J = k.addEventListener) == null || J.call(k, "change", N), k.length > 0 && N(), g = () => {
105
+ var D, H, V;
106
+ (D = k.removeEventListener) == null || D.call(k, "addtrack", N), (H = k.removeEventListener) == null || H.call(k, "removetrack", N), (V = k.removeEventListener) == null || V.call(k, "change", N);
89
107
  };
90
108
  }
91
109
  }
92
110
  }
93
- function h(r) {
94
- var R;
95
- if (r == null || r < 0) return;
96
- const b = g.value;
97
- if (b) {
98
- b.audioTrack !== r && (b.audioTrack = r);
111
+ function m(p) {
112
+ var Y;
113
+ if (p == null || p < 0) return;
114
+ const x = h.value;
115
+ if (x) {
116
+ x.audioTrack !== p && (x.audioTrack = p);
99
117
  return;
100
118
  }
101
- const E = (R = m.value) == null ? void 0 : R.audioTracks;
102
- if (E)
103
- for (let H = 0; H < E.length; H++)
104
- E[H].enabled = H === r;
119
+ const B = (Y = o.value) == null ? void 0 : Y.audioTracks;
120
+ if (B)
121
+ for (let A = 0; A < B.length; A++)
122
+ B[A].enabled = A === p;
123
+ }
124
+ function C(p) {
125
+ if (p == null) return;
126
+ const x = h.value;
127
+ x && x.currentLevel !== p && (x.currentLevel = p);
105
128
  }
106
- return fe(() => {
107
- e.src && k(e.src);
108
- }), F(
129
+ return He(() => {
130
+ e.src && b(e.src);
131
+ }), R(
109
132
  () => e.src,
110
- (r) => {
111
- r && k(r);
133
+ (p) => {
134
+ p && b(p);
112
135
  }
113
- ), F(
136
+ ), R(
114
137
  () => e.audioTrackIndex,
115
- (r) => h(r)
116
- ), X(_), a({ videoEl: m }), (r, b) => (i(), v("video", {
138
+ (p) => m(p)
139
+ ), R(
140
+ () => e.qualityLevelIndex,
141
+ (p) => C(p)
142
+ ), ne(S), a({ videoEl: o }), (p, x) => (d(), f("video", {
117
143
  ref_key: "videoEl",
118
- ref: m,
144
+ ref: o,
119
145
  muted: t.muted,
120
146
  loop: t.loop,
121
147
  controls: t.controls,
@@ -123,22 +149,23 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
123
149
  playsinline: t.playsInline,
124
150
  preload: t.preload,
125
151
  poster: t.poster,
126
- class: C(e.class),
127
- onPlay: b[0] || (b[0] = (E) => o("play")),
128
- onPause: b[1] || (b[1] = (E) => o("pause"))
152
+ class: w(e.class),
153
+ onPlay: x[0] || (x[0] = (B) => c("play")),
154
+ onPause: x[1] || (x[1] = (B) => c("pause")),
155
+ onEnded: x[2] || (x[2] = (B) => c("ended"))
129
156
  }, [
130
- ke(r.$slots, "default")
131
- ], 42, _e));
157
+ Fe(p.$slots, "default")
158
+ ], 42, Je));
132
159
  }
133
- }), $e = { name: "IconAudio" }, Le = /* @__PURE__ */ T({
134
- ...$e,
160
+ }), et = { name: "IconAudio" }, tt = /* @__PURE__ */ I({
161
+ ...et,
135
162
  props: {
136
163
  class: {}
137
164
  },
138
165
  setup(t) {
139
166
  const a = t;
140
- return (l, e) => (i(), v("svg", {
141
- class: C(["gvp-icon", a.class]),
167
+ return (n, e) => (d(), f("svg", {
168
+ class: w(["gvp-icon", a.class]),
142
169
  width: "16",
143
170
  height: "16",
144
171
  viewBox: "0 0 24 24",
@@ -146,13 +173,13 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
146
173
  xmlns: "http://www.w3.org/2000/svg",
147
174
  "aria-hidden": "true"
148
175
  }, [...e[0] || (e[0] = [
149
- s("path", {
176
+ r("path", {
150
177
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
151
178
  stroke: "currentColor",
152
179
  "stroke-width": "1.5",
153
180
  "stroke-linejoin": "round"
154
181
  }, null, -1),
155
- s("path", {
182
+ r("path", {
156
183
  d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",
157
184
  stroke: "currentColor",
158
185
  "stroke-width": "1.5",
@@ -160,15 +187,15 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
160
187
  }, null, -1)
161
188
  ])], 2));
162
189
  }
163
- }), Pe = { name: "IconChevron" }, ye = /* @__PURE__ */ T({
164
- ...Pe,
190
+ }), nt = { name: "IconChevron" }, Re = /* @__PURE__ */ I({
191
+ ...nt,
165
192
  props: {
166
193
  class: {}
167
194
  },
168
195
  setup(t) {
169
196
  const a = t;
170
- return (l, e) => (i(), v("svg", {
171
- class: C(["gvp-icon", a.class]),
197
+ return (n, e) => (d(), f("svg", {
198
+ class: w(["gvp-icon", a.class]),
172
199
  width: "12",
173
200
  height: "12",
174
201
  viewBox: "0 0 24 24",
@@ -176,7 +203,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
176
203
  xmlns: "http://www.w3.org/2000/svg",
177
204
  "aria-hidden": "true"
178
205
  }, [...e[0] || (e[0] = [
179
- s("path", {
206
+ r("path", {
180
207
  d: "M6 9L12 15L18 9",
181
208
  stroke: "currentColor",
182
209
  "stroke-width": "2",
@@ -185,12 +212,12 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
185
212
  }, null, -1)
186
213
  ])], 2));
187
214
  }
188
- }), Me = ["aria-expanded"], Te = { class: "gvp-audio-label" }, Ie = {
215
+ }), lt = ["aria-expanded"], at = { class: "gvp-audio-label" }, ot = {
189
216
  key: 0,
190
217
  class: "gvp-audio-menu",
191
218
  role: "listbox",
192
219
  "aria-label": "Audio tracks"
193
- }, Se = ["aria-selected", "onClick"], He = /* @__PURE__ */ T({
220
+ }, st = ["aria-selected", "onClick"], rt = /* @__PURE__ */ I({
194
221
  __name: "AudioTrackSwitcher",
195
222
  props: {
196
223
  tracks: {},
@@ -198,67 +225,67 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
198
225
  },
199
226
  emits: ["select"],
200
227
  setup(t, { emit: a }) {
201
- const l = t, e = a, o = w(!1), m = w(null), g = Z(
202
- () => l.tracks.find((x) => x.index === l.activeIndex) ?? l.tracks[0]
228
+ const n = t, e = a, c = y(!1), o = y(null), h = T(
229
+ () => n.tracks.find(($) => $.index === n.activeIndex) ?? n.tracks[0]
203
230
  );
204
- function p(x) {
205
- m.value && !m.value.contains(x.target) && (o.value = !1);
231
+ function g($) {
232
+ o.value && !o.value.contains($.target) && (c.value = !1);
206
233
  }
207
- function L(x) {
208
- x.key === "Escape" && (o.value = !1);
234
+ function E($) {
235
+ $.key === "Escape" && (c.value = !1);
209
236
  }
210
- F(o, (x) => {
211
- x ? (document.addEventListener("mousedown", p), document.addEventListener("keydown", L)) : (document.removeEventListener("mousedown", p), document.removeEventListener("keydown", L));
212
- }), X(() => {
213
- document.removeEventListener("mousedown", p), document.removeEventListener("keydown", L);
237
+ R(c, ($) => {
238
+ $ ? (document.addEventListener("mousedown", g), document.addEventListener("keydown", E)) : (document.removeEventListener("mousedown", g), document.removeEventListener("keydown", E));
239
+ }), ne(() => {
240
+ document.removeEventListener("mousedown", g), document.removeEventListener("keydown", E);
214
241
  });
215
- function P(x) {
216
- e("select", x), o.value = !1;
242
+ function _($) {
243
+ e("select", $), c.value = !1;
217
244
  }
218
- return (x, _) => {
219
- var k;
220
- return i(), v("div", {
245
+ return ($, S) => {
246
+ var b;
247
+ return d(), f("div", {
221
248
  ref_key: "rootEl",
222
- ref: m,
249
+ ref: o,
223
250
  class: "gvp-audio"
224
251
  }, [
225
- s("button", {
252
+ r("button", {
226
253
  type: "button",
227
254
  class: "gvp-audio-btn",
228
255
  "aria-haspopup": "listbox",
229
- "aria-expanded": o.value,
256
+ "aria-expanded": c.value,
230
257
  "aria-label": "Audio track",
231
- onClick: _[0] || (_[0] = (h) => o.value = !o.value)
258
+ onClick: S[0] || (S[0] = (m) => c.value = !c.value)
232
259
  }, [
233
- j(Le),
234
- s("span", Te, q((k = g.value) == null ? void 0 : k.label), 1),
235
- j(ye)
236
- ], 8, Me),
237
- o.value ? (i(), v("ul", Ie, [
238
- (i(!0), v(oe, null, ae(t.tracks, (h) => (i(), v("li", {
239
- key: h.index
260
+ Z(tt),
261
+ r("span", at, U((b = h.value) == null ? void 0 : b.label), 1),
262
+ Z(Re)
263
+ ], 8, lt),
264
+ c.value ? (d(), f("ul", ot, [
265
+ (d(!0), f(ie, null, ue(t.tracks, (m) => (d(), f("li", {
266
+ key: m.index
240
267
  }, [
241
- s("button", {
268
+ r("button", {
242
269
  type: "button",
243
270
  role: "option",
244
- "aria-selected": h.index === t.activeIndex,
245
- class: C(["gvp-audio-menu-item", { "is-active": h.index === t.activeIndex }]),
246
- onClick: (r) => P(h.index)
247
- }, q(h.label), 11, Se)
271
+ "aria-selected": m.index === t.activeIndex,
272
+ class: w(["gvp-audio-menu-item", { "is-active": m.index === t.activeIndex }]),
273
+ onClick: (C) => _(m.index)
274
+ }, U(m.label), 11, st)
248
275
  ]))), 128))
249
276
  ])) : M("", !0)
250
277
  ], 512);
251
278
  };
252
279
  }
253
- }), Be = { name: "IconSpeed" }, we = /* @__PURE__ */ T({
254
- ...Be,
280
+ }), it = { name: "IconSpeed" }, Oe = /* @__PURE__ */ I({
281
+ ...it,
255
282
  props: {
256
283
  class: {}
257
284
  },
258
285
  setup(t) {
259
286
  const a = t;
260
- return (l, e) => (i(), v("svg", {
261
- class: C(["gvp-icon", a.class]),
287
+ return (n, e) => (d(), f("svg", {
288
+ class: w(["gvp-icon", a.class]),
262
289
  width: "16",
263
290
  height: "16",
264
291
  viewBox: "0 0 24 24",
@@ -266,12 +293,12 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
266
293
  xmlns: "http://www.w3.org/2000/svg",
267
294
  "aria-hidden": "true"
268
295
  }, [...e[0] || (e[0] = [
269
- s("path", {
296
+ r("path", {
270
297
  d: "M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",
271
298
  stroke: "currentColor",
272
299
  "stroke-width": "1.5"
273
300
  }, null, -1),
274
- s("path", {
301
+ r("path", {
275
302
  d: "M12 8V12L14.5 14.5",
276
303
  stroke: "currentColor",
277
304
  "stroke-width": "1.5",
@@ -280,72 +307,72 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
280
307
  }, null, -1)
281
308
  ])], 2));
282
309
  }
283
- }), Ve = ["aria-expanded"], Ae = { class: "gvp-speed-label" }, De = {
310
+ }), ut = ["aria-expanded"], ct = { class: "gvp-speed-label" }, dt = {
284
311
  key: 0,
285
312
  class: "gvp-speed-menu",
286
313
  role: "listbox",
287
314
  "aria-label": "Playback speed"
288
- }, Re = ["aria-selected", "onClick"], Fe = /* @__PURE__ */ T({
315
+ }, vt = ["aria-selected", "onClick"], pt = /* @__PURE__ */ I({
289
316
  __name: "SpeedSwitcher",
290
317
  props: {
291
318
  speed: {}
292
319
  },
293
320
  emits: ["select"],
294
321
  setup(t, { emit: a }) {
295
- const l = [0.5, 0.75, 1, 1.25, 1.5, 2], e = a, o = w(!1), m = w(null);
296
- function g(P) {
297
- m.value && !m.value.contains(P.target) && (o.value = !1);
322
+ const n = [0.5, 0.75, 1, 1.25, 1.5, 2], e = a, c = y(!1), o = y(null);
323
+ function h(_) {
324
+ o.value && !o.value.contains(_.target) && (c.value = !1);
298
325
  }
299
- function p(P) {
300
- P.key === "Escape" && (o.value = !1);
326
+ function g(_) {
327
+ _.key === "Escape" && (c.value = !1);
301
328
  }
302
- F(o, (P) => {
303
- P ? (document.addEventListener("mousedown", g), document.addEventListener("keydown", p)) : (document.removeEventListener("mousedown", g), document.removeEventListener("keydown", p));
304
- }), X(() => {
305
- document.removeEventListener("mousedown", g), document.removeEventListener("keydown", p);
329
+ R(c, (_) => {
330
+ _ ? (document.addEventListener("mousedown", h), document.addEventListener("keydown", g)) : (document.removeEventListener("mousedown", h), document.removeEventListener("keydown", g));
331
+ }), ne(() => {
332
+ document.removeEventListener("mousedown", h), document.removeEventListener("keydown", g);
306
333
  });
307
- function L(P) {
308
- e("select", P), o.value = !1;
334
+ function E(_) {
335
+ e("select", _), c.value = !1;
309
336
  }
310
- return (P, x) => (i(), v("div", {
337
+ return (_, $) => (d(), f("div", {
311
338
  ref_key: "rootEl",
312
- ref: m,
339
+ ref: o,
313
340
  class: "gvp-speed"
314
341
  }, [
315
- s("button", {
342
+ r("button", {
316
343
  type: "button",
317
344
  class: "gvp-speed-btn",
318
345
  "aria-haspopup": "listbox",
319
- "aria-expanded": o.value,
346
+ "aria-expanded": c.value,
320
347
  "aria-label": "`Playback speed: ${speed === 1 ? '1×' : speed + '×'}`",
321
- onClick: x[0] || (x[0] = (_) => o.value = !o.value)
348
+ onClick: $[0] || ($[0] = (S) => c.value = !c.value)
322
349
  }, [
323
- j(we),
324
- s("span", Ae, q(t.speed === 1 ? "1×" : `${t.speed}×`), 1),
325
- j(ye)
326
- ], 8, Ve),
327
- o.value ? (i(), v("ul", De, [
328
- (i(), v(oe, null, ae(l, (_) => s("li", { key: _ }, [
329
- s("button", {
350
+ Z(Oe),
351
+ r("span", ct, U(t.speed === 1 ? "1×" : `${t.speed}×`), 1),
352
+ Z(Re)
353
+ ], 8, ut),
354
+ c.value ? (d(), f("ul", dt, [
355
+ (d(), f(ie, null, ue(n, (S) => r("li", { key: S }, [
356
+ r("button", {
330
357
  type: "button",
331
358
  role: "option",
332
- "aria-selected": _ === t.speed,
333
- class: C(["gvp-speed-menu-item", { "is-active": _ === t.speed }]),
334
- onClick: (k) => L(_)
335
- }, q(_ === 1 ? "Normal" : `${_}×`), 11, Re)
359
+ "aria-selected": S === t.speed,
360
+ class: w(["gvp-speed-menu-item", { "is-active": S === t.speed }]),
361
+ onClick: (b) => E(S)
362
+ }, U(S === 1 ? "Normal" : `${S}×`), 11, vt)
336
363
  ])), 64))
337
364
  ])) : M("", !0)
338
365
  ], 512));
339
366
  }
340
- }), Ne = { name: "IconCaptions" }, be = /* @__PURE__ */ T({
341
- ...Ne,
367
+ }), ft = { name: "IconCaptions" }, Ue = /* @__PURE__ */ I({
368
+ ...ft,
342
369
  props: {
343
370
  class: {}
344
371
  },
345
372
  setup(t) {
346
373
  const a = t;
347
- return (l, e) => (i(), v("svg", {
348
- class: C(["gvp-icon", a.class]),
374
+ return (n, e) => (d(), f("svg", {
375
+ class: w(["gvp-icon", a.class]),
349
376
  width: "18",
350
377
  height: "18",
351
378
  viewBox: "0 0 24 24",
@@ -353,7 +380,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
353
380
  xmlns: "http://www.w3.org/2000/svg",
354
381
  "aria-hidden": "true"
355
382
  }, [...e[0] || (e[0] = [
356
- s("rect", {
383
+ r("rect", {
357
384
  x: "2",
358
385
  y: "5",
359
386
  width: "20",
@@ -362,7 +389,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
362
389
  stroke: "currentColor",
363
390
  "stroke-width": "1.5"
364
391
  }, null, -1),
365
- s("path", {
392
+ r("path", {
366
393
  d: "M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17",
367
394
  stroke: "currentColor",
368
395
  "stroke-width": "1.5",
@@ -370,120 +397,120 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
370
397
  }, null, -1)
371
398
  ])], 2));
372
399
  }
373
- }), Oe = ["aria-expanded", "aria-pressed"], je = {
400
+ }), mt = ["aria-expanded", "aria-pressed"], ht = {
374
401
  key: 0,
375
402
  class: "gvp-captions-menu",
376
403
  role: "listbox",
377
404
  "aria-label": "Captions"
378
- }, Ue = ["aria-selected"], Ze = ["aria-selected", "onClick"], qe = /* @__PURE__ */ T({
405
+ }, gt = ["aria-selected"], kt = ["aria-selected", "onClick"], yt = /* @__PURE__ */ I({
379
406
  __name: "CaptionsSwitcher",
380
407
  props: {
381
408
  video: {}
382
409
  },
383
410
  setup(t) {
384
- const a = t, l = w([]), e = w(-1), o = w(!1), m = w(null);
385
- function g(k) {
386
- const h = [];
387
- for (let b = 0; b < k.length; b++) {
388
- const E = k[b];
389
- (E.kind === "subtitles" || E.kind === "captions") && h.push({ index: b, label: E.label || E.language || `Track ${b + 1}` });
411
+ const a = t, n = y([]), e = y(-1), c = y(!1), o = y(null);
412
+ function h(b) {
413
+ const m = [];
414
+ for (let p = 0; p < b.length; p++) {
415
+ const x = b[p];
416
+ (x.kind === "subtitles" || x.kind === "captions") && m.push({ index: p, label: x.label || x.language || `Track ${p + 1}` });
390
417
  }
391
- l.value = h;
392
- let r = -1;
393
- for (let b = 0; b < k.length; b++)
394
- if (k[b].mode === "showing") {
395
- r = b;
418
+ n.value = m;
419
+ let C = -1;
420
+ for (let p = 0; p < b.length; p++)
421
+ if (b[p].mode === "showing") {
422
+ C = p;
396
423
  break;
397
424
  }
398
- e.value = r;
425
+ e.value = C;
399
426
  }
400
- let p = null;
401
- F(() => a.video, (k) => {
402
- if (p == null || p(), p = null, !k) {
403
- l.value = [], e.value = -1;
427
+ let g = null;
428
+ R(() => a.video, (b) => {
429
+ if (g == null || g(), g = null, !b) {
430
+ n.value = [], e.value = -1;
404
431
  return;
405
432
  }
406
- const h = k.textTracks;
407
- g(h);
408
- const r = () => g(h);
409
- typeof h.addEventListener == "function" && (h.addEventListener("addtrack", r), h.addEventListener("removetrack", r), h.addEventListener("change", r), p = () => {
410
- h.removeEventListener("addtrack", r), h.removeEventListener("removetrack", r), h.removeEventListener("change", r);
433
+ const m = b.textTracks;
434
+ h(m);
435
+ const C = () => h(m);
436
+ typeof m.addEventListener == "function" && (m.addEventListener("addtrack", C), m.addEventListener("removetrack", C), m.addEventListener("change", C), g = () => {
437
+ m.removeEventListener("addtrack", C), m.removeEventListener("removetrack", C), m.removeEventListener("change", C);
411
438
  });
412
- }, { immediate: !0 }), X(() => {
413
- p == null || p(), document.removeEventListener("mousedown", L), document.removeEventListener("keydown", P);
439
+ }, { immediate: !0 }), ne(() => {
440
+ g == null || g(), document.removeEventListener("mousedown", E), document.removeEventListener("keydown", _);
414
441
  });
415
- function L(k) {
416
- m.value && !m.value.contains(k.target) && (o.value = !1);
442
+ function E(b) {
443
+ o.value && !o.value.contains(b.target) && (c.value = !1);
417
444
  }
418
- function P(k) {
419
- k.key === "Escape" && (o.value = !1);
445
+ function _(b) {
446
+ b.key === "Escape" && (c.value = !1);
420
447
  }
421
- F(o, (k) => {
422
- k ? (document.addEventListener("mousedown", L), document.addEventListener("keydown", P)) : (document.removeEventListener("mousedown", L), document.removeEventListener("keydown", P));
448
+ R(c, (b) => {
449
+ b ? (document.addEventListener("mousedown", E), document.addEventListener("keydown", _)) : (document.removeEventListener("mousedown", E), document.removeEventListener("keydown", _));
423
450
  });
424
- function x() {
451
+ function $() {
425
452
  if (!a.video) return;
426
- const k = a.video.textTracks;
427
- for (let h = 0; h < k.length; h++) k[h].mode = "hidden";
428
- e.value = -1, o.value = !1;
453
+ const b = a.video.textTracks;
454
+ for (let m = 0; m < b.length; m++) b[m].mode = "hidden";
455
+ e.value = -1, c.value = !1;
429
456
  }
430
- function _(k) {
457
+ function S(b) {
431
458
  if (!a.video) return;
432
- const h = a.video.textTracks;
433
- for (let r = 0; r < h.length; r++)
434
- h[r].mode = r === k ? "showing" : "hidden";
435
- e.value = k, o.value = !1;
459
+ const m = a.video.textTracks;
460
+ for (let C = 0; C < m.length; C++)
461
+ m[C].mode = C === b ? "showing" : "hidden";
462
+ e.value = b, c.value = !1;
436
463
  }
437
- return (k, h) => l.value.length > 0 ? (i(), v("div", {
464
+ return (b, m) => n.value.length > 0 ? (d(), f("div", {
438
465
  key: 0,
439
466
  ref_key: "rootEl",
440
- ref: m,
467
+ ref: o,
441
468
  class: "gvp-captions"
442
469
  }, [
443
- s("button", {
470
+ r("button", {
444
471
  type: "button",
445
- class: C(["gvp-captions-btn", { "is-active": e.value >= 0 }]),
472
+ class: w(["gvp-captions-btn", { "is-active": e.value >= 0 }]),
446
473
  "aria-haspopup": "listbox",
447
- "aria-expanded": o.value,
474
+ "aria-expanded": c.value,
448
475
  "aria-pressed": e.value >= 0,
449
476
  "aria-label": "Captions",
450
- onClick: h[0] || (h[0] = (r) => o.value = !o.value)
477
+ onClick: m[0] || (m[0] = (C) => c.value = !c.value)
451
478
  }, [
452
- j(be)
453
- ], 10, Oe),
454
- o.value ? (i(), v("ul", je, [
455
- s("li", null, [
456
- s("button", {
479
+ Z(Ue)
480
+ ], 10, mt),
481
+ c.value ? (d(), f("ul", ht, [
482
+ r("li", null, [
483
+ r("button", {
457
484
  type: "button",
458
485
  role: "option",
459
486
  "aria-selected": e.value === -1,
460
- class: C(["gvp-captions-menu-item", { "is-active": e.value === -1 }]),
461
- onClick: x
462
- }, " Off ", 10, Ue)
487
+ class: w(["gvp-captions-menu-item", { "is-active": e.value === -1 }]),
488
+ onClick: $
489
+ }, " Off ", 10, gt)
463
490
  ]),
464
- (i(!0), v(oe, null, ae(l.value, (r) => (i(), v("li", {
465
- key: r.index
491
+ (d(!0), f(ie, null, ue(n.value, (C) => (d(), f("li", {
492
+ key: C.index
466
493
  }, [
467
- s("button", {
494
+ r("button", {
468
495
  type: "button",
469
496
  role: "option",
470
- "aria-selected": r.index === e.value,
471
- class: C(["gvp-captions-menu-item", { "is-active": r.index === e.value }]),
472
- onClick: (b) => _(r.index)
473
- }, q(r.label), 11, Ze)
497
+ "aria-selected": C.index === e.value,
498
+ class: w(["gvp-captions-menu-item", { "is-active": C.index === e.value }]),
499
+ onClick: (p) => S(C.index)
500
+ }, U(C.label), 11, kt)
474
501
  ]))), 128))
475
502
  ])) : M("", !0)
476
503
  ], 512)) : M("", !0);
477
504
  }
478
- }), ze = { name: "IconPause" }, We = /* @__PURE__ */ T({
479
- ...ze,
505
+ }), wt = { name: "IconPause" }, bt = /* @__PURE__ */ I({
506
+ ...wt,
480
507
  props: {
481
508
  class: {}
482
509
  },
483
510
  setup(t) {
484
511
  const a = t;
485
- return (l, e) => (i(), v("svg", {
486
- class: C(["gvp-icon", a.class]),
512
+ return (n, e) => (d(), f("svg", {
513
+ class: w(["gvp-icon", a.class]),
487
514
  width: "16",
488
515
  height: "16",
489
516
  viewBox: "0 0 24 24",
@@ -491,7 +518,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
491
518
  xmlns: "http://www.w3.org/2000/svg",
492
519
  "aria-hidden": "true"
493
520
  }, [...e[0] || (e[0] = [
494
- s("rect", {
521
+ r("rect", {
495
522
  x: "6",
496
523
  y: "5",
497
524
  width: "4",
@@ -499,7 +526,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
499
526
  rx: "1",
500
527
  fill: "currentColor"
501
528
  }, null, -1),
502
- s("rect", {
529
+ r("rect", {
503
530
  x: "14",
504
531
  y: "5",
505
532
  width: "4",
@@ -509,15 +536,15 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
509
536
  }, null, -1)
510
537
  ])], 2));
511
538
  }
512
- }), Ye = { name: "IconPlaySolid" }, Ke = /* @__PURE__ */ T({
513
- ...Ye,
539
+ }), Ct = { name: "IconPlaySolid" }, xt = /* @__PURE__ */ I({
540
+ ...Ct,
514
541
  props: {
515
542
  class: {}
516
543
  },
517
544
  setup(t) {
518
545
  const a = t;
519
- return (l, e) => (i(), v("svg", {
520
- class: C(["gvp-icon", a.class]),
546
+ return (n, e) => (d(), f("svg", {
547
+ class: w(["gvp-icon", a.class]),
521
548
  width: "16",
522
549
  height: "16",
523
550
  viewBox: "0 0 24 24",
@@ -525,21 +552,77 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
525
552
  xmlns: "http://www.w3.org/2000/svg",
526
553
  "aria-hidden": "true"
527
554
  }, [...e[0] || (e[0] = [
528
- s("path", {
555
+ r("path", {
529
556
  d: "M7 5.5V18.5C7 19.2659 7.84856 19.7261 8.4899 19.3071L19.0801 12.4014C19.6644 12.0204 19.6644 11.9796 19.0801 11.5986L8.4899 4.69288C7.84856 4.27388 7 4.73408 7 5.5Z",
530
557
  fill: "currentColor"
531
558
  }, null, -1)
532
559
  ])], 2));
533
560
  }
534
- }), Je = { name: "IconVolumeHigh" }, Xe = /* @__PURE__ */ T({
535
- ...Je,
561
+ }), Lt = { name: "IconPrev" }, Et = /* @__PURE__ */ I({
562
+ ...Lt,
563
+ props: {
564
+ class: {}
565
+ },
566
+ setup(t) {
567
+ const a = t;
568
+ return (n, e) => (d(), f("svg", {
569
+ class: w(["gvp-icon", a.class]),
570
+ width: "16",
571
+ height: "16",
572
+ viewBox: "0 0 24 24",
573
+ fill: "none",
574
+ xmlns: "http://www.w3.org/2000/svg",
575
+ "aria-hidden": "true"
576
+ }, [...e[0] || (e[0] = [
577
+ r("path", {
578
+ d: "M16.5 18.5V5.5C16.5 4.73408 15.6514 4.27388 15.0101 4.69288L6.91993 9.98432C6.33563 10.3653 6.33563 11.0347 6.91993 11.4157L15.0101 16.7071C15.6514 17.1261 16.5 16.6659 16.5 15.9V18.5Z",
579
+ fill: "currentColor"
580
+ }, null, -1),
581
+ r("path", {
582
+ d: "M6 5V19",
583
+ stroke: "currentColor",
584
+ "stroke-width": "2",
585
+ "stroke-linecap": "round"
586
+ }, null, -1)
587
+ ])], 2));
588
+ }
589
+ }), _t = { name: "IconNext" }, $t = /* @__PURE__ */ I({
590
+ ..._t,
591
+ props: {
592
+ class: {}
593
+ },
594
+ setup(t) {
595
+ const a = t;
596
+ return (n, e) => (d(), f("svg", {
597
+ class: w(["gvp-icon", a.class]),
598
+ width: "16",
599
+ height: "16",
600
+ viewBox: "0 0 24 24",
601
+ fill: "none",
602
+ xmlns: "http://www.w3.org/2000/svg",
603
+ "aria-hidden": "true"
604
+ }, [...e[0] || (e[0] = [
605
+ r("path", {
606
+ d: "M7.5 5.5V18.5C7.5 19.2659 8.34856 19.7261 8.98990 19.3071L17.0801 14.0157C17.6644 13.6347 17.6644 12.9653 17.0801 12.5843L8.98990 7.29288C8.34856 6.87388 7.5 7.33408 7.5 8.1V5.5Z",
607
+ fill: "currentColor"
608
+ }, null, -1),
609
+ r("path", {
610
+ d: "M18 5V19",
611
+ stroke: "currentColor",
612
+ "stroke-width": "2",
613
+ "stroke-linecap": "round"
614
+ }, null, -1)
615
+ ])], 2));
616
+ }
617
+ }), Pt = { name: "IconVolumeHigh" }, Mt = /* @__PURE__ */ I({
618
+ ...Pt,
536
619
  props: {
537
620
  class: {}
538
621
  },
539
622
  setup(t) {
540
623
  const a = t;
541
- return (l, e) => (i(), v("svg", {
542
- class: C(["gvp-icon", a.class]),
624
+ return (n, e) => (d(), f("svg", {
625
+ class: w(["gvp-icon", a.class]),
543
626
  width: "18",
544
627
  height: "18",
545
628
  viewBox: "0 0 24 24",
@@ -547,13 +630,13 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
547
630
  xmlns: "http://www.w3.org/2000/svg",
548
631
  "aria-hidden": "true"
549
632
  }, [...e[0] || (e[0] = [
550
- s("path", {
633
+ r("path", {
551
634
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
552
635
  stroke: "currentColor",
553
636
  "stroke-width": "1.5",
554
637
  "stroke-linejoin": "round"
555
638
  }, null, -1),
556
- s("path", {
639
+ r("path", {
557
640
  d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",
558
641
  stroke: "currentColor",
559
642
  "stroke-width": "1.5",
@@ -561,15 +644,15 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
561
644
  }, null, -1)
562
645
  ])], 2));
563
646
  }
564
- }), Ge = { name: "IconVolumeLow" }, Qe = /* @__PURE__ */ T({
565
- ...Ge,
647
+ }), Tt = { name: "IconVolumeLow" }, It = /* @__PURE__ */ I({
648
+ ...Tt,
566
649
  props: {
567
650
  class: {}
568
651
  },
569
652
  setup(t) {
570
653
  const a = t;
571
- return (l, e) => (i(), v("svg", {
572
- class: C(["gvp-icon", a.class]),
654
+ return (n, e) => (d(), f("svg", {
655
+ class: w(["gvp-icon", a.class]),
573
656
  width: "18",
574
657
  height: "18",
575
658
  viewBox: "0 0 24 24",
@@ -577,13 +660,13 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
577
660
  xmlns: "http://www.w3.org/2000/svg",
578
661
  "aria-hidden": "true"
579
662
  }, [...e[0] || (e[0] = [
580
- s("path", {
663
+ r("path", {
581
664
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
582
665
  stroke: "currentColor",
583
666
  "stroke-width": "1.5",
584
667
  "stroke-linejoin": "round"
585
668
  }, null, -1),
586
- s("path", {
669
+ r("path", {
587
670
  d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",
588
671
  stroke: "currentColor",
589
672
  "stroke-width": "1.5",
@@ -591,15 +674,15 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
591
674
  }, null, -1)
592
675
  ])], 2));
593
676
  }
594
- }), et = { name: "IconVolumeMuted" }, tt = /* @__PURE__ */ T({
595
- ...et,
677
+ }), St = { name: "IconVolumeMuted" }, Nt = /* @__PURE__ */ I({
678
+ ...St,
596
679
  props: {
597
680
  class: {}
598
681
  },
599
682
  setup(t) {
600
683
  const a = t;
601
- return (l, e) => (i(), v("svg", {
602
- class: C(["gvp-icon", a.class]),
684
+ return (n, e) => (d(), f("svg", {
685
+ class: w(["gvp-icon", a.class]),
603
686
  width: "18",
604
687
  height: "18",
605
688
  viewBox: "0 0 24 24",
@@ -607,13 +690,13 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
607
690
  xmlns: "http://www.w3.org/2000/svg",
608
691
  "aria-hidden": "true"
609
692
  }, [...e[0] || (e[0] = [
610
- s("path", {
693
+ r("path", {
611
694
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
612
695
  stroke: "currentColor",
613
696
  "stroke-width": "1.5",
614
697
  "stroke-linejoin": "round"
615
698
  }, null, -1),
616
- s("path", {
699
+ r("path", {
617
700
  d: "M16 9L22 15M22 9L16 15",
618
701
  stroke: "currentColor",
619
702
  "stroke-width": "1.5",
@@ -621,15 +704,44 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
621
704
  }, null, -1)
622
705
  ])], 2));
623
706
  }
624
- }), nt = { name: "IconPiP" }, Ce = /* @__PURE__ */ T({
625
- ...nt,
707
+ }), At = { name: "IconQuality" }, Ht = /* @__PURE__ */ I({
708
+ ...At,
709
+ props: {
710
+ class: {}
711
+ },
712
+ setup(t) {
713
+ const a = t;
714
+ return (n, e) => (d(), f("svg", {
715
+ class: w(["gvp-icon", a.class]),
716
+ width: "16",
717
+ height: "16",
718
+ viewBox: "0 0 24 24",
719
+ fill: "none",
720
+ xmlns: "http://www.w3.org/2000/svg",
721
+ "aria-hidden": "true"
722
+ }, [...e[0] || (e[0] = [
723
+ r("path", {
724
+ d: "M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",
725
+ stroke: "currentColor",
726
+ "stroke-width": "1.5"
727
+ }, null, -1),
728
+ r("path", {
729
+ d: "M3 12C3 12.6 3.08 13.18 3.23 13.73L4.6 14.5C4.86 14.65 5.02 14.94 5 15.24C4.98 15.58 4.96 15.92 5.07 16.24C5.18 16.56 5.39 16.83 5.62 17.08C5.83 17.3 6.13 17.4 6.42 17.36L7.99 17.13C8.28 17.09 8.57 17.21 8.74 17.45C9.07 17.93 9.49 18.34 9.97 18.66C10.21 18.83 10.34 19.11 10.31 19.4L10.13 20.97C10.1 21.26 10.21 21.55 10.43 21.74C10.91 22.16 11.45 22 12 22C12.55 22 13.09 22.16 13.57 21.74C13.79 21.55 13.9 21.26 13.87 20.97L13.69 19.4C13.66 19.11 13.79 18.83 14.03 18.66",
730
+ stroke: "currentColor",
731
+ "stroke-width": "1.5",
732
+ "stroke-linecap": "round"
733
+ }, null, -1)
734
+ ])], 2));
735
+ }
736
+ }), Bt = { name: "IconPiP" }, Ze = /* @__PURE__ */ I({
737
+ ...Bt,
626
738
  props: {
627
739
  class: {}
628
740
  },
629
741
  setup(t) {
630
742
  const a = t;
631
- return (l, e) => (i(), v("svg", {
632
- class: C(["gvp-icon", a.class]),
743
+ return (n, e) => (d(), f("svg", {
744
+ class: w(["gvp-icon", a.class]),
633
745
  width: "18",
634
746
  height: "18",
635
747
  viewBox: "0 0 24 24",
@@ -637,7 +749,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
637
749
  xmlns: "http://www.w3.org/2000/svg",
638
750
  "aria-hidden": "true"
639
751
  }, [...e[0] || (e[0] = [
640
- s("rect", {
752
+ r("rect", {
641
753
  x: "2",
642
754
  y: "4",
643
755
  width: "20",
@@ -646,7 +758,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
646
758
  stroke: "currentColor",
647
759
  "stroke-width": "1.5"
648
760
  }, null, -1),
649
- s("rect", {
761
+ r("rect", {
650
762
  x: "12",
651
763
  y: "12",
652
764
  width: "8",
@@ -656,15 +768,15 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
656
768
  }, null, -1)
657
769
  ])], 2));
658
770
  }
659
- }), ot = { name: "IconFullscreen" }, at = /* @__PURE__ */ T({
660
- ...ot,
771
+ }), Vt = { name: "IconFullscreen" }, qt = /* @__PURE__ */ I({
772
+ ...Vt,
661
773
  props: {
662
774
  class: {}
663
775
  },
664
776
  setup(t) {
665
777
  const a = t;
666
- return (l, e) => (i(), v("svg", {
667
- class: C(["gvp-icon", a.class]),
778
+ return (n, e) => (d(), f("svg", {
779
+ class: w(["gvp-icon", a.class]),
668
780
  width: "18",
669
781
  height: "18",
670
782
  viewBox: "0 0 24 24",
@@ -672,7 +784,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
672
784
  xmlns: "http://www.w3.org/2000/svg",
673
785
  "aria-hidden": "true"
674
786
  }, [...e[0] || (e[0] = [
675
- s("path", {
787
+ r("path", {
676
788
  d: "M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",
677
789
  stroke: "currentColor",
678
790
  "stroke-width": "1.75",
@@ -681,15 +793,15 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
681
793
  }, null, -1)
682
794
  ])], 2));
683
795
  }
684
- }), st = { name: "IconFullscreenExit" }, lt = /* @__PURE__ */ T({
685
- ...st,
796
+ }), Dt = { name: "IconFullscreenExit" }, Ft = /* @__PURE__ */ I({
797
+ ...Dt,
686
798
  props: {
687
799
  class: {}
688
800
  },
689
801
  setup(t) {
690
802
  const a = t;
691
- return (l, e) => (i(), v("svg", {
692
- class: C(["gvp-icon", a.class]),
803
+ return (n, e) => (d(), f("svg", {
804
+ class: w(["gvp-icon", a.class]),
693
805
  width: "18",
694
806
  height: "18",
695
807
  viewBox: "0 0 24 24",
@@ -697,7 +809,7 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
697
809
  xmlns: "http://www.w3.org/2000/svg",
698
810
  "aria-hidden": "true"
699
811
  }, [...e[0] || (e[0] = [
700
- s("path", {
812
+ r("path", {
701
813
  d: "M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",
702
814
  stroke: "currentColor",
703
815
  "stroke-width": "1.75",
@@ -707,400 +819,661 @@ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
707
819
  ])], 2));
708
820
  }
709
821
  });
710
- function ge(t) {
822
+ function Ae(t) {
711
823
  if (!Number.isFinite(t) || t < 0) return "--:--";
712
- const a = Math.floor(t), l = Math.floor(a / 3600), e = Math.floor(a % 3600 / 60), m = (a % 60).toString().padStart(2, "0");
713
- if (l > 0) {
714
- const g = e.toString().padStart(2, "0");
715
- return `${l}:${g}:${m}`;
824
+ const a = Math.floor(t), n = Math.floor(a / 3600), e = Math.floor(a % 3600 / 60), o = (a % 60).toString().padStart(2, "0");
825
+ if (n > 0) {
826
+ const h = e.toString().padStart(2, "0");
827
+ return `${n}:${h}:${o}`;
828
+ }
829
+ return `${e}:${o}`;
830
+ }
831
+ function qe(t) {
832
+ const a = t.trim().split(":");
833
+ if (a.length < 2 || a.length > 3) return NaN;
834
+ const n = a.map(Number);
835
+ return n.some((e) => !Number.isFinite(e)) ? NaN : n.length === 3 ? n[0] * 3600 + n[1] * 60 + n[2] : n[0] * 60 + n[1];
836
+ }
837
+ function Rt(t, a) {
838
+ try {
839
+ return new URL(t, a).href;
840
+ } catch {
841
+ return t;
842
+ }
843
+ }
844
+ function Ot(t, a) {
845
+ const n = [], e = t.replace(/\r/g, "").split(`
846
+ `);
847
+ for (let c = 0; c < e.length; c++) {
848
+ const o = e[c].indexOf("-->");
849
+ if (o === -1) continue;
850
+ const h = qe(e[c].slice(0, o)), g = qe(e[c].slice(o + 3));
851
+ if (!Number.isFinite(h) || !Number.isFinite(g)) continue;
852
+ const E = (e[c + 1] ?? "").trim();
853
+ if (!E) continue;
854
+ const _ = E.indexOf("#xywh=");
855
+ let $ = E, S = 0, b = 0, m = 0, C = 0;
856
+ if (_ !== -1) {
857
+ $ = E.slice(0, _);
858
+ const p = E.slice(_ + 6).split(",").map(Number);
859
+ p.length === 4 && p.every(Number.isFinite) && ([S, b, m, C] = p);
860
+ }
861
+ n.push({ start: h, end: g, url: Rt($, a), x: S, y: b, w: m, h: C });
862
+ }
863
+ return n.sort((c, o) => c.start - o.start), n;
864
+ }
865
+ function Ut(t) {
866
+ return {
867
+ cues: t,
868
+ cueAt(a) {
869
+ if (t.length === 0) return null;
870
+ let n = 0, e = t.length - 1, c = t[0];
871
+ for (; n <= e; ) {
872
+ const o = n + e >> 1, h = t[o];
873
+ if (a < h.start)
874
+ e = o - 1;
875
+ else if (a > h.end)
876
+ c = h, n = o + 1;
877
+ else
878
+ return h;
879
+ }
880
+ return c;
881
+ }
882
+ };
883
+ }
884
+ function De(t) {
885
+ const a = t.trim().split(":");
886
+ if (a.length < 2 || a.length > 3) return NaN;
887
+ const n = a.map(Number);
888
+ return n.some((e) => !Number.isFinite(e)) ? NaN : n.length === 3 ? n[0] * 3600 + n[1] * 60 + n[2] : n[0] * 60 + n[1];
889
+ }
890
+ function Zt(t) {
891
+ const a = [], n = t.replace(/\r/g, "").split(`
892
+ `);
893
+ for (let e = 0; e < n.length; e++) {
894
+ const c = n[e].indexOf("-->");
895
+ if (c === -1) continue;
896
+ const o = De(n[e].slice(0, c)), h = De(n[e].slice(c + 3));
897
+ if (!Number.isFinite(o) || !Number.isFinite(h)) continue;
898
+ const g = (n[e + 1] ?? "").trim();
899
+ g && a.push({ start: o, end: h, title: g });
716
900
  }
717
- return `${e}:${m}`;
901
+ return a.sort((e, c) => e.start - c.start), a;
902
+ }
903
+ function jt(t, a) {
904
+ const n = t.filter((e) => Number.isFinite(e.start) && e.start >= 0 && e.title).sort((e, c) => e.start - c.start);
905
+ return n.map((e, c) => {
906
+ var o;
907
+ return {
908
+ start: e.start,
909
+ end: Number.isFinite(e.end) ? e.end : ((o = n[c + 1]) == null ? void 0 : o.start) ?? a,
910
+ title: e.title
911
+ };
912
+ });
718
913
  }
719
- const rt = { class: "gvp-controls-row" }, it = ["aria-label", "aria-pressed"], ut = { class: "gvp-seek" }, ct = { class: "gvp-seek-track" }, dt = ["value", "disabled", "aria-valuemax", "aria-valuenow"], vt = {
914
+ function Qt(t, a) {
915
+ for (const n of t)
916
+ if (a >= n.start && a < n.end) return n;
917
+ return null;
918
+ }
919
+ const Wt = { class: "gvp-controls-row" }, zt = ["disabled"], Yt = ["aria-label", "aria-pressed"], Kt = ["disabled"], Xt = {
920
+ key: 1,
921
+ class: "gvp-seek-preview-chapter"
922
+ }, Jt = { class: "gvp-seek-preview-time" }, Gt = ["value", "disabled", "aria-valuemax", "aria-valuenow"], en = {
720
923
  class: "gvp-time",
721
924
  "aria-live": "off"
722
- }, pt = ["aria-expanded", "aria-label"], ft = { class: "gvp-speed-label" }, mt = {
925
+ }, tn = ["aria-expanded", "aria-label"], nn = { class: "gvp-speed-label" }, ln = {
723
926
  key: 0,
724
927
  class: "gvp-speed-menu",
725
928
  role: "listbox",
726
929
  "aria-label": "Playback speed"
727
- }, ht = ["aria-selected", "onClick"], gt = ["aria-expanded", "aria-pressed"], kt = {
930
+ }, an = ["aria-selected", "onClick"], on = ["aria-expanded", "aria-label"], sn = { class: "gvp-quality-label" }, rn = {
931
+ key: 0,
932
+ class: "gvp-quality-menu",
933
+ role: "listbox",
934
+ "aria-label": "Quality"
935
+ }, un = ["aria-selected"], cn = ["aria-selected", "onClick"], dn = ["aria-expanded", "aria-pressed"], vn = {
728
936
  key: 0,
729
937
  class: "gvp-captions-menu",
730
938
  role: "listbox",
731
939
  "aria-label": "Captions"
732
- }, yt = ["aria-selected"], wt = ["aria-selected", "onClick"], bt = ["aria-label", "aria-pressed"], Ct = {
940
+ }, pn = ["aria-selected"], fn = ["aria-selected", "onClick"], mn = ["aria-label", "aria-pressed"], hn = {
733
941
  key: 0,
734
942
  class: "gvp-volume-slider-wrap"
735
- }, xt = { class: "gvp-volume-track" }, _t = ["value", "aria-valuenow"], Et = ["aria-label", "aria-pressed"], $t = ["aria-label", "aria-pressed"], Lt = 3e3, Pt = /* @__PURE__ */ T({
943
+ }, gn = { class: "gvp-volume-track" }, kn = ["value", "aria-valuenow"], yn = ["aria-label", "aria-pressed"], wn = ["aria-label", "aria-pressed"], bn = 3e3, Cn = /* @__PURE__ */ I({
736
944
  __name: "ControlBar",
737
945
  props: {
738
946
  video: {},
739
947
  isPlaying: { type: Boolean },
740
948
  container: {},
741
- onTogglePlay: { type: Function }
949
+ onTogglePlay: {},
950
+ qualityLevels: { default: () => [] },
951
+ currentLevel: { default: -1 },
952
+ selectedLevel: { default: -1 },
953
+ thumbnails: {},
954
+ chapters: {},
955
+ hasPrev: { type: Boolean, default: !1 },
956
+ hasNext: { type: Boolean, default: !1 }
742
957
  },
743
- setup(t) {
744
- const a = (() => {
958
+ emits: ["select-level", "prev", "next"],
959
+ setup(t, { emit: a }) {
960
+ const n = (() => {
745
961
  if (typeof navigator > "u") return !1;
746
- const n = navigator.userAgent;
747
- return /iPad|iPhone|iPod/.test(n) || n.includes("Mac") && navigator.maxTouchPoints > 1;
748
- })(), l = typeof navigator > "u" ? !1 : /iPhone|iPod/.test(navigator.userAgent), e = [0.5, 0.75, 1, 1.25, 1.5, 2], o = t, m = w(!0);
749
- let g = null;
750
- function p() {
751
- g !== null && (clearTimeout(g), g = null);
962
+ const l = navigator.userAgent;
963
+ return /iPad|iPhone|iPod/.test(l) || l.includes("Mac") && navigator.maxTouchPoints > 1;
964
+ })(), e = typeof navigator > "u" ? !1 : /iPhone|iPod/.test(navigator.userAgent), c = [0.5, 0.75, 1, 1.25, 1.5, 2], o = t, h = a, g = y(!0);
965
+ let E = null;
966
+ function _() {
967
+ E !== null && (clearTimeout(E), E = null);
752
968
  }
753
- function L() {
754
- p(), o.isPlaying && (g = setTimeout(() => {
755
- m.value = !1;
756
- }, Lt));
969
+ function $() {
970
+ _(), o.isPlaying && (E = setTimeout(() => {
971
+ g.value = !1;
972
+ }, bn));
757
973
  }
758
- function P() {
759
- m.value = !0, L();
974
+ function S() {
975
+ g.value = !0, $();
760
976
  }
761
- F(() => o.isPlaying, (n) => {
762
- n ? L() : (p(), m.value = !0);
763
- }, { immediate: !0 }), F(() => o.container, (n) => {
764
- if (!n) return;
765
- const u = () => P();
766
- n.addEventListener("mousemove", u), n.addEventListener("touchstart", u), n.addEventListener("focusin", u);
977
+ R(() => o.isPlaying, (l) => {
978
+ l ? $() : (_(), g.value = !0);
979
+ }, { immediate: !0 }), R(() => o.container, (l) => {
980
+ if (!l) return;
981
+ const s = () => S();
982
+ l.addEventListener("mousemove", s), l.addEventListener("touchstart", s), l.addEventListener("focusin", s);
767
983
  }, { immediate: !0 });
768
- const x = w(0), _ = w(0), k = w(0);
769
- F(() => o.video, (n) => {
770
- if (!n) return;
771
- const u = () => {
772
- x.value = n.currentTime;
773
- }, f = () => {
774
- _.value = Number.isFinite(n.duration) ? n.duration : 0;
775
- }, $ = () => {
776
- const V = n.buffered;
777
- if (!V || V.length === 0) {
778
- k.value = 0;
984
+ const b = y(0), m = y(0), C = y(0);
985
+ R(() => o.video, (l) => {
986
+ if (!l) return;
987
+ const s = () => {
988
+ b.value = l.currentTime;
989
+ }, i = () => {
990
+ m.value = Number.isFinite(l.duration) ? l.duration : 0;
991
+ }, L = () => {
992
+ const F = l.buffered;
993
+ if (!F || F.length === 0) {
994
+ C.value = 0;
779
995
  return;
780
996
  }
781
- let me = V.end(V.length - 1);
782
- for (let ne = 0; ne < V.length; ne++)
783
- if (V.start(ne) <= n.currentTime && n.currentTime <= V.end(ne)) {
784
- me = V.end(ne);
997
+ let Be = F.end(F.length - 1);
998
+ for (let ye = 0; ye < F.length; ye++)
999
+ if (F.start(ye) <= l.currentTime && l.currentTime <= F.end(ye)) {
1000
+ Be = F.end(ye);
785
1001
  break;
786
1002
  }
787
- k.value = me;
1003
+ C.value = Be;
788
1004
  };
789
- u(), f(), $(), n.addEventListener("timeupdate", u), n.addEventListener("durationchange", f), n.addEventListener("loadedmetadata", f), n.addEventListener("progress", $), n.addEventListener("timeupdate", $);
1005
+ s(), i(), L(), l.addEventListener("timeupdate", s), l.addEventListener("durationchange", i), l.addEventListener("loadedmetadata", i), l.addEventListener("progress", L), l.addEventListener("timeupdate", L);
1006
+ }, { immediate: !0 });
1007
+ const p = () => m.value > 0, x = () => p() ? b.value / m.value * 100 : 0, B = () => p() ? C.value / m.value * 100 : 0;
1008
+ function Y(l) {
1009
+ const s = o.video;
1010
+ if (!s || !p()) return;
1011
+ const i = Number(l.target.value) / 100 * m.value;
1012
+ s.currentTime = i, b.value = i;
1013
+ }
1014
+ const A = y(null), J = y(null), k = y(0), N = y(0), D = y(!1);
1015
+ R(() => o.thumbnails, (l) => {
1016
+ if (A.value = null, !l) return;
1017
+ let s = !1;
1018
+ fetch(l).then((i) => i.ok ? i.text() : Promise.reject(new Error("fetch failed"))).then((i) => {
1019
+ if (s) return;
1020
+ const L = Ot(i, new URL(l, location.href).href);
1021
+ A.value = L.length > 0 ? Ut(L) : null;
1022
+ }).catch(() => {
1023
+ s || (A.value = null);
1024
+ }), ne(() => {
1025
+ s = !0;
1026
+ });
790
1027
  }, { immediate: !0 });
791
- const h = () => _.value > 0, r = () => h() ? x.value / _.value * 100 : 0, b = () => h() ? k.value / _.value * 100 : 0;
792
- function E(n) {
793
- const u = o.video;
794
- if (!u || !h()) return;
795
- const f = Number(n.target.value) / 100 * _.value;
796
- u.currentTime = f, x.value = f;
1028
+ function H(l) {
1029
+ const s = J.value;
1030
+ if (!s || !p()) return;
1031
+ const i = s.getBoundingClientRect(), L = Math.min(Math.max(l.clientX - i.left, 0), i.width);
1032
+ N.value = L, k.value = L / i.width * m.value, D.value = !0;
1033
+ }
1034
+ function V() {
1035
+ D.value = !1;
797
1036
  }
798
- const R = w(1), H = w(!1);
799
- F(() => o.video, (n) => {
800
- if (!n) return;
801
- const u = () => {
802
- R.value = n.volume, H.value = n.muted;
1037
+ const O = T(
1038
+ () => {
1039
+ var l;
1040
+ return D.value ? ((l = A.value) == null ? void 0 : l.cueAt(k.value)) ?? null : null;
1041
+ }
1042
+ ), me = T(() => {
1043
+ const l = O.value;
1044
+ return l !== null && l.w > 0 && l.h > 0;
1045
+ }), Pe = T(() => {
1046
+ var L;
1047
+ const l = O.value, s = ((L = J.value) == null ? void 0 : L.clientWidth) ?? 0;
1048
+ if (!me.value || !l || s === 0) return N.value;
1049
+ const i = l.w / 2;
1050
+ return Math.min(Math.max(N.value, i), s - i);
1051
+ }), oe = y([]);
1052
+ R(() => o.chapters, (l) => {
1053
+ if (oe.value = [], typeof l != "string" || !l) return;
1054
+ let s = !1;
1055
+ fetch(l).then((i) => i.ok ? i.text() : Promise.reject(new Error("fetch failed"))).then((i) => {
1056
+ s || (oe.value = Zt(i));
1057
+ }).catch(() => {
1058
+ s || (oe.value = []);
1059
+ }), ne(() => {
1060
+ s = !0;
1061
+ });
1062
+ }, { immediate: !0 });
1063
+ const ce = T(() => typeof o.chapters == "string" ? oe.value : Array.isArray(o.chapters) ? jt(o.chapters, m.value) : []), de = T(
1064
+ () => D.value ? Qt(ce.value, k.value) : null
1065
+ ), K = y(1), q = y(!1);
1066
+ R(() => o.video, (l) => {
1067
+ if (!l) return;
1068
+ const s = () => {
1069
+ K.value = l.volume, q.value = l.muted;
803
1070
  };
804
- u(), n.addEventListener("volumechange", u);
1071
+ s(), l.addEventListener("volumechange", s);
805
1072
  }, { immediate: !0 });
806
- function A() {
1073
+ function Me() {
807
1074
  o.video && (o.video.muted = !o.video.muted);
808
1075
  }
809
- function y(n) {
810
- const u = o.video;
811
- if (!u) return;
812
- const f = Number(n.target.value) / 100;
813
- u.volume = f, f > 0 && u.muted && (u.muted = !1);
1076
+ function Te(l) {
1077
+ const s = o.video;
1078
+ if (!s) return;
1079
+ const i = Number(l.target.value) / 100;
1080
+ s.volume = i, i > 0 && s.muted && (s.muted = !1);
814
1081
  }
815
- const I = w(1), D = w(!1), B = w(null);
816
- F(() => o.video, (n) => {
817
- if (!n) return;
818
- const u = () => {
819
- I.value = n.playbackRate;
1082
+ const X = y(1), le = y(!1), we = y(null);
1083
+ R(() => o.video, (l) => {
1084
+ if (!l) return;
1085
+ const s = () => {
1086
+ X.value = l.playbackRate;
820
1087
  };
821
- u(), n.addEventListener("ratechange", u);
1088
+ s(), l.addEventListener("ratechange", s);
822
1089
  }, { immediate: !0 });
823
- function N(n) {
824
- o.video && (o.video.playbackRate = n), I.value = n, D.value = !1;
1090
+ function Ie(l) {
1091
+ o.video && (o.video.playbackRate = l), X.value = l, le.value = !1;
1092
+ }
1093
+ const ae = y(!1), Q = y(null), he = T(() => o.qualityLevels.length >= 2), be = T(
1094
+ () => [...o.qualityLevels].sort((l, s) => s.height - l.height)
1095
+ ), ve = T(
1096
+ () => o.qualityLevels.find((l) => l.index === o.currentLevel)
1097
+ ), Ce = T(() => {
1098
+ if (o.selectedLevel < 0)
1099
+ return ve.value ? `Auto (${ve.value.label})` : "Auto";
1100
+ const l = o.qualityLevels.find((s) => s.index === o.selectedLevel);
1101
+ return (l == null ? void 0 : l.label) ?? "Auto";
1102
+ });
1103
+ function se(l) {
1104
+ h("select-level", l), ae.value = !1;
825
1105
  }
826
- const G = w([]), S = w(-1), z = w(!1), te = w(null);
827
- function se(n) {
828
- const u = [];
829
- for (let $ = 0; $ < n.length; $++) {
830
- const V = n[$];
831
- (V.kind === "subtitles" || V.kind === "captions") && u.push({ index: $, label: V.label || V.language || `Track ${$ + 1}` });
1106
+ const pe = y([]), W = y(-1), G = y(!1), xe = y(null);
1107
+ function ge(l) {
1108
+ const s = [];
1109
+ for (let L = 0; L < l.length; L++) {
1110
+ const F = l[L];
1111
+ (F.kind === "subtitles" || F.kind === "captions") && s.push({ index: L, label: F.label || F.language || `Track ${L + 1}` });
832
1112
  }
833
- G.value = u;
834
- let f = -1;
835
- for (let $ = 0; $ < n.length; $++)
836
- if (n[$].mode === "showing") {
837
- f = $;
1113
+ pe.value = s;
1114
+ let i = -1;
1115
+ for (let L = 0; L < l.length; L++)
1116
+ if (l[L].mode === "showing") {
1117
+ i = L;
838
1118
  break;
839
1119
  }
840
- S.value = f;
1120
+ W.value = i;
841
1121
  }
842
- F(() => o.video, (n) => {
843
- if (!n) {
844
- G.value = [], S.value = -1;
1122
+ R(() => o.video, (l) => {
1123
+ if (!l) {
1124
+ pe.value = [], W.value = -1;
845
1125
  return;
846
1126
  }
847
- const u = n.textTracks;
848
- se(u);
849
- const f = () => se(u);
850
- typeof u.addEventListener == "function" && (u.addEventListener("addtrack", f), u.addEventListener("removetrack", f), u.addEventListener("change", f));
1127
+ const s = l.textTracks;
1128
+ ge(s);
1129
+ const i = () => ge(s);
1130
+ typeof s.addEventListener == "function" && (s.addEventListener("addtrack", i), s.addEventListener("removetrack", i), s.addEventListener("change", i));
851
1131
  }, { immediate: !0 });
852
- function de(n) {
853
- var f;
854
- const u = (f = o.video) == null ? void 0 : f.textTracks;
855
- if (u) {
856
- for (let $ = 0; $ < u.length; $++) u[$].mode = $ === n ? "showing" : "hidden";
857
- S.value = n, z.value = !1;
1132
+ function Le(l) {
1133
+ var i;
1134
+ const s = (i = o.video) == null ? void 0 : i.textTracks;
1135
+ if (s) {
1136
+ for (let L = 0; L < s.length; L++) s[L].mode = L === l ? "showing" : "hidden";
1137
+ W.value = l, G.value = !1;
858
1138
  }
859
1139
  }
860
- function Q() {
861
- var u;
862
- const n = (u = o.video) == null ? void 0 : u.textTracks;
863
- if (n) {
864
- for (let f = 0; f < n.length; f++) n[f].mode = "hidden";
865
- S.value = -1, z.value = !1;
1140
+ function u() {
1141
+ var s;
1142
+ const l = (s = o.video) == null ? void 0 : s.textTracks;
1143
+ if (l) {
1144
+ for (let i = 0; i < l.length; i++) l[i].mode = "hidden";
1145
+ W.value = -1, G.value = !1;
866
1146
  }
867
1147
  }
868
- const Y = w(!1), ve = typeof document < "u" && !!document.pictureInPictureEnabled;
869
- F(() => o.video, (n) => {
870
- n && (n.addEventListener("enterpictureinpicture", () => {
871
- Y.value = !0;
872
- }), n.addEventListener("leavepictureinpicture", () => {
873
- Y.value = !1;
1148
+ const v = y(!1), P = typeof document < "u" && !!document.pictureInPictureEnabled;
1149
+ R(() => o.video, (l) => {
1150
+ l && (l.addEventListener("enterpictureinpicture", () => {
1151
+ v.value = !0;
1152
+ }), l.addEventListener("leavepictureinpicture", () => {
1153
+ v.value = !1;
874
1154
  }));
875
1155
  }, { immediate: !0 });
876
- function pe() {
1156
+ function fe() {
877
1157
  o.video && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
878
1158
  }) : o.video.requestPictureInPicture().catch(() => {
879
1159
  }));
880
1160
  }
881
- const W = w(!1), le = typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
882
- function d() {
1161
+ const j = y(!1), Ee = typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
1162
+ function Se() {
883
1163
  return document.fullscreenElement ?? document.webkitFullscreenElement ?? null;
884
1164
  }
885
- function c(n) {
886
- const u = n.requestFullscreen ?? n.webkitRequestFullscreen;
887
- return u ? u.call(n) : Promise.reject(new Error("unsupported"));
1165
+ function _e(l) {
1166
+ const s = l.requestFullscreen ?? l.webkitRequestFullscreen;
1167
+ return s ? s.call(l) : Promise.reject(new Error("unsupported"));
888
1168
  }
889
- function O() {
890
- const n = document.exitFullscreen ?? document.webkitExitFullscreen;
891
- return n ? n.call(document) : Promise.reject(new Error("unsupported"));
1169
+ function ke() {
1170
+ const l = document.exitFullscreen ?? document.webkitExitFullscreen;
1171
+ return l ? l.call(document) : Promise.reject(new Error("unsupported"));
892
1172
  }
893
- function K() {
894
- W.value = d() === o.container;
1173
+ function $e() {
1174
+ j.value = Se() === o.container;
895
1175
  }
896
- fe(() => {
897
- document.addEventListener("fullscreenchange", K), document.addEventListener("webkitfullscreenchange", K);
898
- }), X(() => {
899
- p(), document.removeEventListener("fullscreenchange", K), document.removeEventListener("webkitfullscreenchange", K);
1176
+ He(() => {
1177
+ document.addEventListener("fullscreenchange", $e), document.addEventListener("webkitfullscreenchange", $e);
1178
+ }), ne(() => {
1179
+ _(), document.removeEventListener("fullscreenchange", $e), document.removeEventListener("webkitfullscreenchange", $e);
900
1180
  });
901
- function re() {
902
- var n, u;
903
- if (l) {
904
- (u = (n = o.video) == null ? void 0 : n.webkitEnterFullscreen) == null || u.call(n);
1181
+ function je() {
1182
+ var l, s;
1183
+ if (e) {
1184
+ (s = (l = o.video) == null ? void 0 : l.webkitEnterFullscreen) == null || s.call(l);
905
1185
  return;
906
1186
  }
907
- W.value ? O().catch(() => {
908
- }) : o.container && c(o.container).catch(() => {
1187
+ j.value ? ke().catch(() => {
1188
+ }) : o.container && _e(o.container).catch(() => {
909
1189
  });
910
1190
  }
911
- const ie = le || l && o.video !== null && typeof o.video.webkitEnterFullscreen == "function";
912
- function ue(n, u) {
913
- function f(V) {
914
- u.value && !u.value.contains(V.target) && (n.value = !1);
1191
+ const Qe = Ee || e && o.video !== null && typeof o.video.webkitEnterFullscreen == "function";
1192
+ function Ne(l, s) {
1193
+ function i(F) {
1194
+ s.value && !s.value.contains(F.target) && (l.value = !1);
915
1195
  }
916
- function $(V) {
917
- V.key === "Escape" && (n.value = !1);
1196
+ function L(F) {
1197
+ F.key === "Escape" && (l.value = !1);
918
1198
  }
919
- F(n, (V) => {
920
- V ? (document.addEventListener("mousedown", f), document.addEventListener("keydown", $)) : (document.removeEventListener("mousedown", f), document.removeEventListener("keydown", $));
921
- }), X(() => {
922
- document.removeEventListener("mousedown", f), document.removeEventListener("keydown", $);
1199
+ R(l, (F) => {
1200
+ F ? (document.addEventListener("mousedown", i), document.addEventListener("keydown", L)) : (document.removeEventListener("mousedown", i), document.removeEventListener("keydown", L));
1201
+ }), ne(() => {
1202
+ document.removeEventListener("mousedown", i), document.removeEventListener("keydown", L);
923
1203
  });
924
1204
  }
925
- return ue(D, B), ue(z, te), (n, u) => (i(), v("div", {
1205
+ return Ne(le, we), Ne(G, xe), Ne(ae, Q), (l, s) => (d(), f("div", {
926
1206
  role: "toolbar",
927
1207
  "aria-label": "Video controls",
928
- class: C(["gvp-controls", !m.value && "is-hidden"]),
929
- onMouseenter: p,
930
- onMouseleave: L
1208
+ class: w(["gvp-controls", !g.value && "is-hidden"]),
1209
+ onMouseenter: _,
1210
+ onMouseleave: $
931
1211
  }, [
932
- s("div", rt, [
933
- s("button", {
1212
+ r("div", Wt, [
1213
+ t.hasPrev || t.hasNext ? (d(), f("button", {
1214
+ key: 0,
1215
+ type: "button",
1216
+ class: "gvp-ctrl-btn",
1217
+ "aria-label": "Previous video",
1218
+ disabled: !t.hasPrev,
1219
+ onClick: s[0] || (s[0] = (i) => h("prev"))
1220
+ }, [
1221
+ Z(Et)
1222
+ ], 8, zt)) : M("", !0),
1223
+ r("button", {
934
1224
  type: "button",
935
1225
  class: "gvp-ctrl-btn",
936
1226
  "aria-label": t.isPlaying ? "Pause" : "Play",
937
1227
  "aria-pressed": t.isPlaying,
938
- onClick: u[0] || (u[0] = //@ts-ignore
939
- (...f) => t.onTogglePlay && t.onTogglePlay(...f))
1228
+ onClick: s[1] || (s[1] = //@ts-ignore
1229
+ (...i) => t.onTogglePlay && t.onTogglePlay(...i))
1230
+ }, [
1231
+ t.isPlaying ? (d(), z(bt, { key: 0 })) : (d(), z(xt, { key: 1 }))
1232
+ ], 8, Yt),
1233
+ t.hasPrev || t.hasNext ? (d(), f("button", {
1234
+ key: 1,
1235
+ type: "button",
1236
+ class: "gvp-ctrl-btn",
1237
+ "aria-label": "Next video",
1238
+ disabled: !t.hasNext,
1239
+ onClick: s[2] || (s[2] = (i) => h("next"))
1240
+ }, [
1241
+ Z($t)
1242
+ ], 8, Kt)) : M("", !0),
1243
+ r("div", {
1244
+ class: "gvp-seek",
1245
+ onPointermove: H,
1246
+ onPointerleave: V
940
1247
  }, [
941
- t.isPlaying ? (i(), U(We, { key: 0 })) : (i(), U(Ke, { key: 1 }))
942
- ], 8, it),
943
- s("div", ut, [
944
- s("div", ct, [
945
- s("div", {
1248
+ r("div", {
1249
+ ref_key: "seekTrackEl",
1250
+ ref: J,
1251
+ class: "gvp-seek-track"
1252
+ }, [
1253
+ r("div", {
946
1254
  class: "gvp-seek-buffered",
947
- style: ce({ width: `${b()}%` })
1255
+ style: re({ width: `${B()}%` })
948
1256
  }, null, 4),
949
- s("div", {
1257
+ r("div", {
950
1258
  class: "gvp-seek-progress",
951
- style: ce({ width: `${r()}%` })
952
- }, null, 4)
953
- ]),
954
- s("input", {
1259
+ style: re({ width: `${x()}%` })
1260
+ }, null, 4),
1261
+ p() ? (d(!0), f(ie, { key: 0 }, ue(ce.value, (i) => We((d(), f("div", {
1262
+ key: `${i.start}-${i.title}`,
1263
+ class: "gvp-seek-chapter-tick",
1264
+ style: re({ left: `${i.start / m.value * 100}%` })
1265
+ }, null, 4)), [
1266
+ [ze, i.start > 0 && i.start < m.value]
1267
+ ])), 128)) : M("", !0)
1268
+ ], 512),
1269
+ D.value && p() ? (d(), f("div", {
1270
+ key: 0,
1271
+ class: w(["gvp-seek-preview", { "has-thumb": me.value }]),
1272
+ style: re({ left: `${Pe.value}px` })
1273
+ }, [
1274
+ me.value && O.value ? (d(), f("div", {
1275
+ key: 0,
1276
+ class: "gvp-seek-preview-thumb",
1277
+ style: re({
1278
+ width: `${O.value.w}px`,
1279
+ height: `${O.value.h}px`,
1280
+ backgroundImage: `url(${JSON.stringify(O.value.url)})`,
1281
+ backgroundPosition: `-${O.value.x}px -${O.value.y}px`
1282
+ })
1283
+ }, null, 4)) : M("", !0),
1284
+ de.value ? (d(), f("span", Xt, U(de.value.title), 1)) : M("", !0),
1285
+ r("span", Jt, U(te(Ae)(k.value)), 1)
1286
+ ], 6)) : M("", !0),
1287
+ r("input", {
955
1288
  type: "range",
956
1289
  class: "gvp-seek-input",
957
1290
  min: 0,
958
1291
  max: 100,
959
1292
  step: 0.1,
960
- value: r(),
961
- disabled: !h(),
1293
+ value: x(),
1294
+ disabled: !p(),
962
1295
  "aria-label": "Seek",
963
1296
  "aria-valuemin": 0,
964
- "aria-valuemax": Math.floor(_.value),
965
- "aria-valuenow": Math.floor(x.value),
966
- onInput: E
967
- }, null, 40, dt)
968
- ]),
969
- s("span", vt, q(J(ge)(x.value)) + " / " + q(J(ge)(_.value)), 1),
970
- s("div", {
1297
+ "aria-valuemax": Math.floor(m.value),
1298
+ "aria-valuenow": Math.floor(b.value),
1299
+ onInput: Y
1300
+ }, null, 40, Gt)
1301
+ ], 32),
1302
+ r("span", en, U(te(Ae)(b.value)) + " / " + U(te(Ae)(m.value)), 1),
1303
+ r("div", {
971
1304
  ref_key: "speedRootEl",
972
- ref: B,
1305
+ ref: we,
973
1306
  class: "gvp-speed"
974
1307
  }, [
975
- s("button", {
1308
+ r("button", {
976
1309
  type: "button",
977
1310
  class: "gvp-ctrl-btn gvp-speed-btn",
978
1311
  "aria-haspopup": "listbox",
979
- "aria-expanded": D.value,
980
- "aria-label": `Playback speed: ${I.value === 1 ? "1×" : I.value + "×"}`,
981
- onClick: u[1] || (u[1] = (f) => D.value = !D.value)
1312
+ "aria-expanded": le.value,
1313
+ "aria-label": `Playback speed: ${X.value === 1 ? "1×" : X.value + "×"}`,
1314
+ onClick: s[3] || (s[3] = (i) => le.value = !le.value)
982
1315
  }, [
983
- j(we),
984
- s("span", ft, q(I.value === 1 ? "1×" : `${I.value}×`), 1)
985
- ], 8, pt),
986
- D.value ? (i(), v("ul", mt, [
987
- (i(), v(oe, null, ae(e, (f) => s("li", { key: f }, [
988
- s("button", {
1316
+ Z(Oe),
1317
+ r("span", nn, U(X.value === 1 ? "1×" : `${X.value}×`), 1)
1318
+ ], 8, tn),
1319
+ le.value ? (d(), f("ul", ln, [
1320
+ (d(), f(ie, null, ue(c, (i) => r("li", { key: i }, [
1321
+ r("button", {
989
1322
  type: "button",
990
1323
  role: "option",
991
- "aria-selected": f === I.value,
992
- class: C(["gvp-speed-menu-item", { "is-active": f === I.value }]),
993
- onClick: ($) => N(f)
994
- }, q(f === 1 ? "Normal" : `${f}×`), 11, ht)
1324
+ "aria-selected": i === X.value,
1325
+ class: w(["gvp-speed-menu-item", { "is-active": i === X.value }]),
1326
+ onClick: (L) => Ie(i)
1327
+ }, U(i === 1 ? "Normal" : `${i}×`), 11, an)
995
1328
  ])), 64))
996
1329
  ])) : M("", !0)
997
1330
  ], 512),
998
- G.value.length > 0 ? (i(), v("div", {
999
- key: 0,
1331
+ he.value ? (d(), f("div", {
1332
+ key: 2,
1333
+ ref_key: "qualityRootEl",
1334
+ ref: Q,
1335
+ class: "gvp-quality"
1336
+ }, [
1337
+ r("button", {
1338
+ type: "button",
1339
+ class: "gvp-ctrl-btn gvp-quality-btn",
1340
+ "aria-haspopup": "listbox",
1341
+ "aria-expanded": ae.value,
1342
+ "aria-label": `Quality: ${Ce.value}`,
1343
+ onClick: s[4] || (s[4] = (i) => ae.value = !ae.value)
1344
+ }, [
1345
+ Z(Ht),
1346
+ r("span", sn, U(Ce.value), 1)
1347
+ ], 8, on),
1348
+ ae.value ? (d(), f("ul", rn, [
1349
+ r("li", null, [
1350
+ r("button", {
1351
+ type: "button",
1352
+ role: "option",
1353
+ "aria-selected": t.selectedLevel < 0,
1354
+ class: w(["gvp-quality-menu-item", { "is-active": t.selectedLevel < 0 }]),
1355
+ onClick: s[5] || (s[5] = (i) => se(te(Ke).index))
1356
+ }, U(ve.value ? `Auto (${ve.value.label})` : "Auto"), 11, un)
1357
+ ]),
1358
+ (d(!0), f(ie, null, ue(be.value, (i) => (d(), f("li", {
1359
+ key: i.index
1360
+ }, [
1361
+ r("button", {
1362
+ type: "button",
1363
+ role: "option",
1364
+ "aria-selected": i.index === t.selectedLevel,
1365
+ class: w(["gvp-quality-menu-item", { "is-active": i.index === t.selectedLevel }]),
1366
+ onClick: (L) => se(i.index)
1367
+ }, U(i.label), 11, cn)
1368
+ ]))), 128))
1369
+ ])) : M("", !0)
1370
+ ], 512)) : M("", !0),
1371
+ pe.value.length > 0 ? (d(), f("div", {
1372
+ key: 3,
1000
1373
  ref_key: "captionsRootEl",
1001
- ref: te,
1374
+ ref: xe,
1002
1375
  class: "gvp-captions"
1003
1376
  }, [
1004
- s("button", {
1377
+ r("button", {
1005
1378
  type: "button",
1006
- class: C(["gvp-ctrl-btn", S.value >= 0 && "is-active"]),
1379
+ class: w(["gvp-ctrl-btn", W.value >= 0 && "is-active"]),
1007
1380
  "aria-haspopup": "listbox",
1008
- "aria-expanded": z.value,
1381
+ "aria-expanded": G.value,
1009
1382
  "aria-label": "Captions",
1010
- "aria-pressed": S.value >= 0,
1011
- onClick: u[2] || (u[2] = (f) => z.value = !z.value)
1383
+ "aria-pressed": W.value >= 0,
1384
+ onClick: s[6] || (s[6] = (i) => G.value = !G.value)
1012
1385
  }, [
1013
- j(be)
1014
- ], 10, gt),
1015
- z.value ? (i(), v("ul", kt, [
1016
- s("li", null, [
1017
- s("button", {
1386
+ Z(Ue)
1387
+ ], 10, dn),
1388
+ G.value ? (d(), f("ul", vn, [
1389
+ r("li", null, [
1390
+ r("button", {
1018
1391
  type: "button",
1019
1392
  role: "option",
1020
- "aria-selected": S.value === -1,
1021
- class: C(["gvp-captions-menu-item", { "is-active": S.value === -1 }]),
1022
- onClick: Q
1023
- }, "Off", 10, yt)
1393
+ "aria-selected": W.value === -1,
1394
+ class: w(["gvp-captions-menu-item", { "is-active": W.value === -1 }]),
1395
+ onClick: u
1396
+ }, "Off", 10, pn)
1024
1397
  ]),
1025
- (i(!0), v(oe, null, ae(G.value, (f) => (i(), v("li", {
1026
- key: f.index
1398
+ (d(!0), f(ie, null, ue(pe.value, (i) => (d(), f("li", {
1399
+ key: i.index
1027
1400
  }, [
1028
- s("button", {
1401
+ r("button", {
1029
1402
  type: "button",
1030
1403
  role: "option",
1031
- "aria-selected": f.index === S.value,
1032
- class: C(["gvp-captions-menu-item", { "is-active": f.index === S.value }]),
1033
- onClick: ($) => de(f.index)
1034
- }, q(f.label), 11, wt)
1404
+ "aria-selected": i.index === W.value,
1405
+ class: w(["gvp-captions-menu-item", { "is-active": i.index === W.value }]),
1406
+ onClick: (L) => Le(i.index)
1407
+ }, U(i.label), 11, fn)
1035
1408
  ]))), 128))
1036
1409
  ])) : M("", !0)
1037
1410
  ], 512)) : M("", !0),
1038
- s("div", {
1039
- class: C(["gvp-volume", !J(a) && "is-expandable"])
1411
+ r("div", {
1412
+ class: w(["gvp-volume", !te(n) && "is-expandable"])
1040
1413
  }, [
1041
- s("button", {
1414
+ r("button", {
1042
1415
  type: "button",
1043
1416
  class: "gvp-ctrl-btn",
1044
- "aria-label": H.value ? "Unmute" : "Mute",
1045
- "aria-pressed": H.value,
1046
- onClick: A
1417
+ "aria-label": q.value ? "Unmute" : "Mute",
1418
+ "aria-pressed": q.value,
1419
+ onClick: Me
1047
1420
  }, [
1048
- H.value || R.value === 0 ? (i(), U(tt, { key: 0 })) : R.value < 0.5 ? (i(), U(Qe, { key: 1 })) : (i(), U(Xe, { key: 2 }))
1049
- ], 8, bt),
1050
- J(a) ? M("", !0) : (i(), v("div", Ct, [
1051
- s("div", xt, [
1052
- s("div", {
1421
+ q.value || K.value === 0 ? (d(), z(Nt, { key: 0 })) : K.value < 0.5 ? (d(), z(It, { key: 1 })) : (d(), z(Mt, { key: 2 }))
1422
+ ], 8, mn),
1423
+ te(n) ? M("", !0) : (d(), f("div", hn, [
1424
+ r("div", gn, [
1425
+ r("div", {
1053
1426
  class: "gvp-volume-fill",
1054
- style: ce({ width: `${H.value ? 0 : Math.round(R.value * 100)}%` })
1427
+ style: re({ width: `${q.value ? 0 : Math.round(K.value * 100)}%` })
1055
1428
  }, null, 4)
1056
1429
  ]),
1057
- s("input", {
1430
+ r("input", {
1058
1431
  type: "range",
1059
1432
  class: "gvp-volume-input",
1060
1433
  min: 0,
1061
1434
  max: 100,
1062
1435
  step: 1,
1063
- value: H.value ? 0 : Math.round(R.value * 100),
1436
+ value: q.value ? 0 : Math.round(K.value * 100),
1064
1437
  "aria-label": "Volume",
1065
1438
  "aria-valuemin": 0,
1066
1439
  "aria-valuemax": 100,
1067
- "aria-valuenow": H.value ? 0 : Math.round(R.value * 100),
1068
- onInput: y
1069
- }, null, 40, _t)
1440
+ "aria-valuenow": q.value ? 0 : Math.round(K.value * 100),
1441
+ onInput: Te
1442
+ }, null, 40, kn)
1070
1443
  ]))
1071
1444
  ], 2),
1072
- J(ve) ? (i(), v("button", {
1073
- key: 1,
1445
+ te(P) ? (d(), f("button", {
1446
+ key: 4,
1074
1447
  type: "button",
1075
- class: C(["gvp-ctrl-btn", Y.value && "is-active"]),
1076
- "aria-label": Y.value ? "Exit picture-in-picture" : "Picture-in-picture",
1077
- "aria-pressed": Y.value,
1078
- onClick: pe
1448
+ class: w(["gvp-ctrl-btn", v.value && "is-active"]),
1449
+ "aria-label": v.value ? "Exit picture-in-picture" : "Picture-in-picture",
1450
+ "aria-pressed": v.value,
1451
+ onClick: fe
1079
1452
  }, [
1080
- j(Ce)
1081
- ], 10, Et)) : M("", !0),
1082
- J(ie) ? (i(), v("button", {
1083
- key: 2,
1453
+ Z(Ze)
1454
+ ], 10, yn)) : M("", !0),
1455
+ te(Qe) ? (d(), f("button", {
1456
+ key: 5,
1084
1457
  type: "button",
1085
- class: C(["gvp-ctrl-btn", W.value && "is-active"]),
1086
- "aria-label": W.value ? "Exit fullscreen" : "Enter fullscreen",
1087
- "aria-pressed": W.value,
1088
- onClick: re
1458
+ class: w(["gvp-ctrl-btn", j.value && "is-active"]),
1459
+ "aria-label": j.value ? "Exit fullscreen" : "Enter fullscreen",
1460
+ "aria-pressed": j.value,
1461
+ onClick: je
1089
1462
  }, [
1090
- W.value ? (i(), U(lt, { key: 0 })) : (i(), U(at, { key: 1 }))
1091
- ], 10, $t)) : M("", !0)
1463
+ j.value ? (d(), z(Ft, { key: 0 })) : (d(), z(qt, { key: 1 }))
1464
+ ], 10, wn)) : M("", !0)
1092
1465
  ])
1093
1466
  ], 34));
1094
1467
  }
1095
- }), Mt = { name: "IconDesktop" }, Tt = /* @__PURE__ */ T({
1096
- ...Mt,
1468
+ }), xn = { name: "IconDesktop" }, Ln = /* @__PURE__ */ I({
1469
+ ...xn,
1097
1470
  props: {
1098
1471
  class: {}
1099
1472
  },
1100
1473
  setup(t) {
1101
1474
  const a = t;
1102
- return (l, e) => (i(), v("svg", {
1103
- class: C(["gvp-icon", a.class]),
1475
+ return (n, e) => (d(), f("svg", {
1476
+ class: w(["gvp-icon", a.class]),
1104
1477
  width: "20",
1105
1478
  height: "20",
1106
1479
  viewBox: "0 0 24 24",
@@ -1108,26 +1481,26 @@ const rt = { class: "gvp-controls-row" }, it = ["aria-label", "aria-pressed"], u
1108
1481
  xmlns: "http://www.w3.org/2000/svg",
1109
1482
  "aria-hidden": "true"
1110
1483
  }, [...e[0] || (e[0] = [
1111
- s("path", {
1484
+ r("path", {
1112
1485
  d: "M14 2H10C6.72077 2 5.08116 2 3.91891 2.81382C3.48891 3.1149 3.1149 3.48891 2.81382 3.91891C2 5.08116 2 6.72077 2 10C2 13.2792 2 14.9188 2.81382 16.0811C3.1149 16.5111 3.48891 16.8851 3.91891 17.1862C5.08116 18 6.72077 18 10 18H14C17.2792 18 18.9188 18 20.0811 17.1862C20.5111 16.8851 20.8851 16.5111 21.1862 16.0811C22 14.9188 22 13.2792 22 10C22 6.72077 22 5.08116 21.1862 3.91891C20.8851 3.48891 20.5111 3.1149 20.0811 2.81382C18.9188 2 17.2792 2 14 2Z",
1113
1486
  stroke: "currentColor",
1114
1487
  "stroke-width": "1.5",
1115
1488
  "stroke-linecap": "round"
1116
1489
  }, null, -1),
1117
- s("path", {
1490
+ r("path", {
1118
1491
  d: "M11 15H13",
1119
1492
  stroke: "currentColor",
1120
1493
  "stroke-width": "1.5",
1121
1494
  "stroke-linecap": "round",
1122
1495
  "stroke-linejoin": "round"
1123
1496
  }, null, -1),
1124
- s("path", {
1497
+ r("path", {
1125
1498
  d: "M14.5 22L14.1845 21.5811C13.4733 20.6369 13.2969 19.1944 13.7468 18M9.5 22L9.8155 21.5811C10.5267 20.6369 10.7031 19.1944 10.2532 18",
1126
1499
  stroke: "currentColor",
1127
1500
  "stroke-width": "1.5",
1128
1501
  "stroke-linecap": "round"
1129
1502
  }, null, -1),
1130
- s("path", {
1503
+ r("path", {
1131
1504
  d: "M7 22H17",
1132
1505
  stroke: "currentColor",
1133
1506
  "stroke-width": "1.5",
@@ -1135,15 +1508,15 @@ const rt = { class: "gvp-controls-row" }, it = ["aria-label", "aria-pressed"], u
1135
1508
  }, null, -1)
1136
1509
  ])], 2));
1137
1510
  }
1138
- }), It = { name: "IconMobile" }, St = /* @__PURE__ */ T({
1139
- ...It,
1511
+ }), En = { name: "IconMobile" }, _n = /* @__PURE__ */ I({
1512
+ ...En,
1140
1513
  props: {
1141
1514
  class: {}
1142
1515
  },
1143
1516
  setup(t) {
1144
1517
  const a = t;
1145
- return (l, e) => (i(), v("svg", {
1146
- class: C(["gvp-icon", a.class]),
1518
+ return (n, e) => (d(), f("svg", {
1519
+ class: w(["gvp-icon", a.class]),
1147
1520
  width: "20",
1148
1521
  height: "20",
1149
1522
  viewBox: "0 0 24 24",
@@ -1151,20 +1524,20 @@ const rt = { class: "gvp-controls-row" }, it = ["aria-label", "aria-pressed"], u
1151
1524
  xmlns: "http://www.w3.org/2000/svg",
1152
1525
  "aria-hidden": "true"
1153
1526
  }, [...e[0] || (e[0] = [
1154
- s("path", {
1527
+ r("path", {
1155
1528
  d: "M5 9C5 5.70017 5 4.05025 6.02513 3.02513C7.05025 2 8.70017 2 12 2C15.2998 2 16.9497 2 17.9749 3.02513C19 4.05025 19 5.70017 19 9V15C19 18.2998 19 19.9497 17.9749 20.9749C16.9497 22 15.2998 22 12 22C8.70017 22 7.05025 22 6.02513 20.9749C5 19.9497 5 18.2998 5 15V9Z",
1156
1529
  stroke: "currentColor",
1157
1530
  "stroke-width": "2",
1158
1531
  "stroke-linecap": "round"
1159
1532
  }, null, -1),
1160
- s("path", {
1533
+ r("path", {
1161
1534
  d: "M11 19H13",
1162
1535
  stroke: "currentColor",
1163
1536
  "stroke-width": "2",
1164
1537
  "stroke-linecap": "round",
1165
1538
  "stroke-linejoin": "round"
1166
1539
  }, null, -1),
1167
- s("path", {
1540
+ r("path", {
1168
1541
  d: "M9 2L9.089 2.53402C9.28188 3.69129 9.37832 4.26993 9.77519 4.62204C10.1892 4.98934 10.7761 5 12 5C13.2239 5 13.8108 4.98934 14.2248 4.62204C14.6217 4.26993 14.7181 3.69129 14.911 2.53402L15 2",
1169
1542
  stroke: "currentColor",
1170
1543
  "stroke-width": "2",
@@ -1172,15 +1545,15 @@ const rt = { class: "gvp-controls-row" }, it = ["aria-label", "aria-pressed"], u
1172
1545
  }, null, -1)
1173
1546
  ])], 2));
1174
1547
  }
1175
- }), Ht = { name: "IconPlay" }, Bt = /* @__PURE__ */ T({
1176
- ...Ht,
1548
+ }), $n = { name: "IconPlay" }, Pn = /* @__PURE__ */ I({
1549
+ ...$n,
1177
1550
  props: {
1178
1551
  class: {}
1179
1552
  },
1180
1553
  setup(t) {
1181
1554
  const a = t;
1182
- return (l, e) => (i(), v("svg", {
1183
- class: C(["gvp-icon", a.class]),
1555
+ return (n, e) => (d(), f("svg", {
1556
+ class: w(["gvp-icon", a.class]),
1184
1557
  width: "22",
1185
1558
  height: "22",
1186
1559
  viewBox: "0 0 16 16",
@@ -1188,21 +1561,21 @@ const rt = { class: "gvp-controls-row" }, it = ["aria-label", "aria-pressed"], u
1188
1561
  xmlns: "http://www.w3.org/2000/svg",
1189
1562
  "aria-hidden": "true"
1190
1563
  }, [...e[0] || (e[0] = [
1191
- s("path", {
1564
+ r("path", {
1192
1565
  d: "M5.3335 11.45V4.54997C5.3335 4.36108 5.40016 4.20275 5.5335 4.07497C5.66683 3.94719 5.82238 3.8833 6.00016 3.8833C6.05572 3.8833 6.11405 3.89163 6.17516 3.9083C6.23627 3.92497 6.29461 3.94997 6.35016 3.9833L11.7835 7.4333C11.8835 7.49997 11.9585 7.5833 12.0085 7.6833C12.0585 7.7833 12.0835 7.88886 12.0835 7.99997C12.0835 8.11108 12.0585 8.21663 12.0085 8.31663C11.9585 8.41663 11.8835 8.49997 11.7835 8.56663L6.35016 12.0166C6.29461 12.05 6.23627 12.075 6.17516 12.0916C6.11405 12.1083 6.05572 12.1166 6.00016 12.1166C5.82238 12.1166 5.66683 12.0527 5.5335 11.925C5.40016 11.7972 5.3335 11.6389 5.3335 11.45Z",
1193
1566
  fill: "currentColor"
1194
1567
  }, null, -1)
1195
1568
  ])], 2));
1196
1569
  }
1197
- }), Vt = { name: "IconX" }, At = /* @__PURE__ */ T({
1198
- ...Vt,
1570
+ }), Mn = { name: "IconX" }, Tn = /* @__PURE__ */ I({
1571
+ ...Mn,
1199
1572
  props: {
1200
1573
  class: {}
1201
1574
  },
1202
1575
  setup(t) {
1203
1576
  const a = t;
1204
- return (l, e) => (i(), v("svg", {
1205
- class: C(["gvp-icon", a.class]),
1577
+ return (n, e) => (d(), f("svg", {
1578
+ class: w(["gvp-icon", a.class]),
1206
1579
  width: "14",
1207
1580
  height: "14",
1208
1581
  viewBox: "0 0 14 14",
@@ -1210,14 +1583,14 @@ const rt = { class: "gvp-controls-row" }, it = ["aria-label", "aria-pressed"], u
1210
1583
  xmlns: "http://www.w3.org/2000/svg",
1211
1584
  "aria-hidden": "true"
1212
1585
  }, [...e[0] || (e[0] = [
1213
- s("path", {
1586
+ r("path", {
1214
1587
  d: "M6.94994 5.53594L12.1929 0.292938C12.5834 -0.0975275 13.2165 -0.0975279 13.6069 0.292938C13.9974 0.683403 13.9974 1.31647 13.6069 1.70694L8.36394 6.94994L13.6069 12.1929C13.9974 12.5834 13.9974 13.2165 13.6069 13.6069C13.2165 13.9974 12.5834 13.9974 12.1929 13.6069L6.94994 8.36394L1.70694 13.6069C1.31647 13.9974 0.683403 13.9974 0.292938 13.6069C-0.0975279 13.2165 -0.0975277 12.5834 0.292938 12.1929L5.53594 6.94994L0.292938 1.70694C-0.0975279 1.31647 -0.0975279 0.683403 0.292938 0.292938C0.683403 -0.0975279 1.31647 -0.0975277 1.70694 0.292938L6.94994 5.53594Z",
1215
1588
  fill: "currentColor"
1216
1589
  }, null, -1)
1217
1590
  ])], 2));
1218
1591
  }
1219
1592
  });
1220
- function Dt(t) {
1593
+ function In(t) {
1221
1594
  if (!t) return null;
1222
1595
  if (/^[A-Za-z0-9_-]{11}$/.test(t)) return t;
1223
1596
  let a;
@@ -1226,71 +1599,74 @@ function Dt(t) {
1226
1599
  } catch {
1227
1600
  return null;
1228
1601
  }
1229
- const l = a.hostname.replace(/^www\./, "");
1230
- if (l === "youtu.be") {
1602
+ const n = a.hostname.replace(/^www\./, "");
1603
+ if (n === "youtu.be") {
1231
1604
  const e = a.pathname.slice(1).split("/")[0];
1232
1605
  return /^[A-Za-z0-9_-]{11}$/.test(e) ? e : null;
1233
1606
  }
1234
- if (l === "youtube.com" || l === "m.youtube.com" || l === "music.youtube.com" || l === "youtube-nocookie.com") {
1607
+ if (n === "youtube.com" || n === "m.youtube.com" || n === "music.youtube.com" || n === "youtube-nocookie.com") {
1235
1608
  const e = a.searchParams.get("v");
1236
1609
  if (e && /^[A-Za-z0-9_-]{11}$/.test(e)) return e;
1237
- const o = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
1610
+ const c = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
1238
1611
  a.pathname
1239
1612
  );
1240
- if (o) return o[1];
1613
+ if (c) return c[1];
1241
1614
  }
1242
1615
  return null;
1243
1616
  }
1244
- function Rt(t) {
1617
+ function Sn(t) {
1245
1618
  try {
1246
- const a = new URL(t), l = a.searchParams.get("t") ?? a.searchParams.get("start");
1247
- if (!l) return null;
1248
- if (/^\d+s?$/.test(l)) return Number.parseInt(l, 10);
1249
- const e = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(l);
1619
+ const a = new URL(t), n = a.searchParams.get("t") ?? a.searchParams.get("start");
1620
+ if (!n) return null;
1621
+ if (/^\d+s?$/.test(n)) return Number.parseInt(n, 10);
1622
+ const e = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(n);
1250
1623
  if (e) {
1251
- const o = Number.parseInt(e[1] ?? "0", 10), m = Number.parseInt(e[2] ?? "0", 10), g = Number.parseInt(e[3] ?? "0", 10), p = o * 3600 + m * 60 + g;
1252
- return p > 0 ? p : null;
1624
+ const c = Number.parseInt(e[1] ?? "0", 10), o = Number.parseInt(e[2] ?? "0", 10), h = Number.parseInt(e[3] ?? "0", 10), g = c * 3600 + o * 60 + h;
1625
+ return g > 0 ? g : null;
1253
1626
  }
1254
1627
  } catch {
1255
1628
  }
1256
1629
  return null;
1257
1630
  }
1258
- function Ft(t, a = {}) {
1631
+ function Nn(t, a = {}) {
1259
1632
  const {
1260
- autoPlay: l = !1,
1633
+ autoPlay: n = !1,
1261
1634
  muted: e = !0,
1262
- loop: o = !1,
1263
- controls: m = !0,
1264
- startSeconds: g
1265
- } = a, p = new URLSearchParams({
1635
+ loop: c = !1,
1636
+ controls: o = !0,
1637
+ startSeconds: h
1638
+ } = a, g = new URLSearchParams({
1266
1639
  rel: "0",
1267
1640
  modestbranding: "1",
1268
1641
  playsinline: "1",
1269
- controls: m ? "1" : "0"
1642
+ controls: o ? "1" : "0"
1270
1643
  });
1271
- return l ? (p.set("autoplay", "1"), p.set("mute", "1")) : e && p.set("mute", "1"), o && (p.set("loop", "1"), p.set("playlist", t)), g && g > 0 && p.set("start", String(g)), `https://www.youtube-nocookie.com/embed/${t}?${p.toString()}`;
1644
+ return n ? (g.set("autoplay", "1"), g.set("mute", "1")) : e && g.set("mute", "1"), c && (g.set("loop", "1"), g.set("playlist", t)), h && h > 0 && g.set("start", String(h)), `https://www.youtube-nocookie.com/embed/${t}?${g.toString()}`;
1272
1645
  }
1273
- const Nt = ["src"], Ot = {
1646
+ const An = ["src"], Hn = {
1274
1647
  key: 2,
1275
1648
  class: "gvp-vignette"
1276
- }, jt = {
1649
+ }, Bn = {
1277
1650
  key: 3,
1278
1651
  class: "gvp-toggle"
1279
- }, Ut = { class: "gvp-toggle-pill" }, Zt = ["aria-pressed"], qt = ["aria-pressed"], zt = ["aria-label", "aria-pressed"], Wt = ["aria-label"], Yt = {
1652
+ }, Vn = { class: "gvp-toggle-pill" }, qn = ["aria-pressed"], Dn = ["aria-pressed"], Fn = ["aria-label", "aria-pressed"], Rn = ["aria-label"], On = {
1280
1653
  key: 10,
1281
1654
  class: "gvp-play-wrap"
1282
- }, Kt = {
1655
+ }, Un = {
1283
1656
  key: 0,
1284
1657
  class: "gvp-tooltip",
1285
1658
  role: "tooltip"
1286
- }, Jt = {
1659
+ }, Zn = {
1287
1660
  key: 12,
1288
1661
  class: "gvp-bottom-fade"
1289
- }, Qt = /* @__PURE__ */ T({
1662
+ }, Wn = /* @__PURE__ */ I({
1290
1663
  __name: "VideoPlayer",
1291
1664
  props: {
1292
1665
  src: {},
1293
1666
  poster: {},
1667
+ playlist: {},
1668
+ defaultIndex: { default: 0 },
1669
+ autoAdvance: { type: Boolean, default: !0 },
1294
1670
  showDeviceToggle: { type: Boolean, default: !0 },
1295
1671
  defaultDevice: { default: "desktop" },
1296
1672
  hoverPlay: { type: Boolean, default: !1 },
@@ -1303,289 +1679,360 @@ const Nt = ["src"], Ot = {
1303
1679
  aspectRatio: {},
1304
1680
  hlsConfig: {},
1305
1681
  isHls: { type: Boolean },
1682
+ thumbnails: {},
1683
+ chapters: {},
1306
1684
  class: { default: "" },
1307
1685
  closable: { type: Boolean, default: !1 }
1308
1686
  },
1309
- emits: ["close", "play", "pause"],
1687
+ emits: ["close", "play", "pause", "ended", "time-update", "seeked", "volume-change", "milestone", "error", "playlist-change"],
1310
1688
  setup(t, { emit: a }) {
1311
- const l = t, e = a, o = w(null), m = w(l.defaultDevice), g = w(!1), p = w(!1), L = w(null), P = w([]), x = w(-1), _ = w(1), k = w(!1), h = w(!1), r = w(null), b = typeof document < "u" && !!document.pictureInPictureEnabled, E = Z(
1312
- () => l.controls === !0 || l.controls === "custom"
1313
- ), R = Z(() => l.controls === "native"), H = Z(() => Dt(l.src)), A = Z(() => H.value !== null), y = Z(
1314
- () => H.value ? Ft(H.value, {
1315
- autoPlay: l.autoPlay,
1316
- muted: l.muted,
1317
- loop: l.loop,
1318
- controls: E.value ? !0 : R.value,
1319
- startSeconds: Rt(l.src)
1689
+ const n = t, e = a, c = y(null), o = y(n.defaultDevice), h = y(!1), g = y(!1), E = y(null), _ = y([]), $ = y(-1), S = y([]), b = y(-1), m = y(-1), C = y(1), p = y(!1), x = y(!1), B = y(null), Y = typeof document < "u" && !!document.pictureInPictureEnabled, A = T(
1690
+ () => n.controls === !0 || n.controls === "custom"
1691
+ ), J = T(() => n.controls === "native"), k = T(
1692
+ () => Array.isArray(n.playlist) && n.playlist.length > 0
1693
+ ), N = y(
1694
+ k.value ? Math.min(Math.max(n.defaultIndex, 0), n.playlist.length - 1) : 0
1695
+ ), D = T(
1696
+ () => k.value ? n.playlist[Math.min(N.value, n.playlist.length - 1)] : null
1697
+ ), H = T(() => {
1698
+ var u;
1699
+ return ((u = D.value) == null ? void 0 : u.src) ?? n.src ?? "";
1700
+ }), V = T(() => {
1701
+ var u;
1702
+ return ((u = D.value) == null ? void 0 : u.poster) ?? n.poster;
1703
+ }), O = T(
1704
+ () => {
1705
+ var u;
1706
+ return ((u = D.value) == null ? void 0 : u.thumbnails) ?? n.thumbnails;
1707
+ }
1708
+ ), me = T(
1709
+ () => {
1710
+ var u;
1711
+ return ((u = D.value) == null ? void 0 : u.chapters) ?? n.chapters;
1712
+ }
1713
+ ), Pe = T(() => k.value && N.value > 0), oe = T(
1714
+ () => k.value && N.value < n.playlist.length - 1
1715
+ );
1716
+ let ce = !1;
1717
+ function de(u, v = !1) {
1718
+ if (!k.value) return;
1719
+ const P = Math.min(Math.max(u, 0), n.playlist.length - 1);
1720
+ P !== N.value && (ce = v, N.value = P, e("playlist-change", P, n.playlist[P]));
1721
+ }
1722
+ const K = T(() => In(H.value)), q = T(() => K.value !== null), Me = T(
1723
+ () => K.value ? Nn(K.value, {
1724
+ autoPlay: n.autoPlay,
1725
+ muted: n.muted,
1726
+ loop: n.loop,
1727
+ controls: A.value ? !0 : J.value,
1728
+ startSeconds: Sn(H.value)
1320
1729
  }) : null
1321
1730
  );
1322
- function I(d) {
1323
- P.value = d, x.value = -1;
1731
+ function Te(u) {
1732
+ _.value = u, $.value = -1;
1324
1733
  }
1325
- const D = Z(
1326
- () => !A.value && P.value.length > 1
1327
- ), B = Z(
1734
+ function X(u) {
1735
+ S.value = u, m.value = -1;
1736
+ }
1737
+ const le = T(
1738
+ () => !q.value && _.value.length > 1
1739
+ ), we = T(
1328
1740
  () => {
1329
- var d;
1330
- return x.value >= 0 ? x.value : ((d = P.value[0]) == null ? void 0 : d.index) ?? -1;
1741
+ var u;
1742
+ return $.value >= 0 ? $.value : ((u = _.value[0]) == null ? void 0 : u.index) ?? -1;
1331
1743
  }
1332
- ), N = Z(
1744
+ ), Ie = T(
1333
1745
  () => {
1334
- var d, c;
1335
- return m.value === "mobile" ? ((d = l.aspectRatio) == null ? void 0 : d.mobile) ?? "9/16" : ((c = l.aspectRatio) == null ? void 0 : c.desktop) ?? "16/9";
1746
+ var u, v;
1747
+ return o.value === "mobile" ? ((u = n.aspectRatio) == null ? void 0 : u.mobile) ?? "9/16" : ((v = n.aspectRatio) == null ? void 0 : v.desktop) ?? "16/9";
1336
1748
  }
1337
- ), G = Z(
1749
+ ), ae = T(
1338
1750
  () => {
1339
- var d, c;
1340
- return m.value === "mobile" ? ((d = l.frameMaxWidth) == null ? void 0 : d.mobile) ?? "420px" : ((c = l.frameMaxWidth) == null ? void 0 : c.desktop) ?? "960px";
1751
+ var u, v;
1752
+ return o.value === "mobile" ? ((u = n.frameMaxWidth) == null ? void 0 : u.mobile) ?? "420px" : ((v = n.frameMaxWidth) == null ? void 0 : v.desktop) ?? "960px";
1341
1753
  }
1342
- ), S = Z(() => {
1343
- var d;
1344
- return ((d = o.value) == null ? void 0 : d.videoEl) ?? null;
1754
+ ), Q = T(() => {
1755
+ var u;
1756
+ return ((u = c.value) == null ? void 0 : u.videoEl) ?? null;
1345
1757
  });
1346
- async function z() {
1347
- const d = S.value;
1348
- if (d)
1758
+ async function he() {
1759
+ const u = Q.value;
1760
+ if (u)
1349
1761
  try {
1350
- d.readyState < 2 && d.load();
1351
- const c = d.play();
1352
- L.value = c, await c, g.value = !0;
1762
+ u.readyState < 2 && u.load();
1763
+ const v = u.play();
1764
+ E.value = v, await v, h.value = !0;
1353
1765
  } catch {
1354
- g.value = !1;
1766
+ h.value = !1;
1355
1767
  } finally {
1356
- L.value = null;
1768
+ E.value = null;
1357
1769
  }
1358
1770
  }
1359
- async function te() {
1360
- const d = S.value;
1361
- if (d) {
1362
- if (L.value)
1771
+ async function be() {
1772
+ const u = Q.value;
1773
+ if (u) {
1774
+ if (E.value)
1363
1775
  try {
1364
- await L.value;
1776
+ await E.value;
1365
1777
  } catch {
1366
1778
  }
1367
- d.pause();
1779
+ u.pause();
1368
1780
  }
1369
1781
  }
1370
- async function se() {
1371
- !l.hoverPlay || A.value || await z();
1782
+ async function ve() {
1783
+ !n.hoverPlay || q.value || await he();
1372
1784
  }
1373
- async function de() {
1374
- !l.hoverPlay || A.value || (await te(), g.value = !1);
1785
+ async function Ce() {
1786
+ !n.hoverPlay || q.value || (await be(), h.value = !1);
1375
1787
  }
1376
- async function Q() {
1377
- const d = S.value;
1378
- d && (d.paused ? await z() : (await te(), g.value = !1));
1788
+ async function se() {
1789
+ const u = Q.value;
1790
+ u && (u.paused ? await he() : (await be(), h.value = !1));
1379
1791
  }
1380
- function Y() {
1381
- p.value = !0, se();
1792
+ function pe() {
1793
+ h.value = !1, e("ended"), k.value && n.autoAdvance && oe.value && de(N.value + 1, !0);
1382
1794
  }
1383
- function ve() {
1384
- p.value = !1, de();
1795
+ R(H, () => {
1796
+ ce && (ce = !1, he());
1797
+ });
1798
+ function W() {
1799
+ g.value = !0, ve();
1385
1800
  }
1386
- function pe(d) {
1387
- _.value = d;
1388
- const c = S.value;
1389
- c && (c.playbackRate = d);
1801
+ function G() {
1802
+ g.value = !1, Ce();
1390
1803
  }
1391
- F(S, (d) => {
1392
- d && (d.addEventListener("ratechange", () => {
1393
- _.value = d.playbackRate;
1394
- }), d.addEventListener("enterpictureinpicture", () => {
1395
- k.value = !0;
1396
- }), d.addEventListener("leavepictureinpicture", () => {
1397
- k.value = !1;
1398
- }));
1804
+ function xe(u) {
1805
+ C.value = u;
1806
+ const v = Q.value;
1807
+ v && (v.playbackRate = u);
1808
+ }
1809
+ R(Q, (u) => {
1810
+ if (!u) return;
1811
+ u.addEventListener("ratechange", () => {
1812
+ C.value = u.playbackRate;
1813
+ }), u.addEventListener("enterpictureinpicture", () => {
1814
+ p.value = !0;
1815
+ }), u.addEventListener("leavepictureinpicture", () => {
1816
+ p.value = !1;
1817
+ });
1818
+ const v = /* @__PURE__ */ new Set();
1819
+ u.addEventListener("timeupdate", () => {
1820
+ const P = u.duration;
1821
+ if (e("time-update", u.currentTime, Number.isFinite(P) ? P : 0), !Number.isFinite(P) || P <= 0) return;
1822
+ const fe = u.currentTime / P * 100;
1823
+ for (const j of [25, 50, 75, 100])
1824
+ fe >= j && !v.has(j) && (v.add(j), e("milestone", j));
1825
+ }), u.addEventListener("seeked", () => {
1826
+ e("seeked", u.currentTime);
1827
+ }), u.addEventListener("volumechange", () => {
1828
+ e("volume-change", u.volume, u.muted);
1829
+ }), u.addEventListener("error", () => {
1830
+ e("error");
1831
+ });
1399
1832
  });
1400
- function W() {
1401
- const d = S.value;
1402
- d && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
1403
- }) : d.requestPictureInPicture().catch(() => {
1833
+ function ge() {
1834
+ const u = Q.value;
1835
+ u && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
1836
+ }) : u.requestPictureInPicture().catch(() => {
1404
1837
  }));
1405
1838
  }
1406
- function le(d) {
1407
- var K, re, ie;
1408
- const c = S.value;
1409
- if (!(!c || !h.value && !((K = r.value) != null && K.contains(document.activeElement)) || d.target.tagName === "INPUT" && d.key !== " "))
1410
- switch (d.key) {
1839
+ function Le(u) {
1840
+ var fe, j, Ee;
1841
+ const v = Q.value;
1842
+ if (!(!v || !x.value && !((fe = B.value) != null && fe.contains(document.activeElement)) || u.target.tagName === "INPUT" && u.key !== " "))
1843
+ switch (u.key) {
1411
1844
  case " ":
1412
1845
  case "k":
1413
- d.preventDefault(), Q();
1846
+ u.preventDefault(), se();
1414
1847
  break;
1415
1848
  case "ArrowLeft":
1416
- d.preventDefault(), c.currentTime = Math.max(0, c.currentTime - 5);
1849
+ u.preventDefault(), v.currentTime = Math.max(0, v.currentTime - 5);
1417
1850
  break;
1418
1851
  case "ArrowRight":
1419
- d.preventDefault(), c.currentTime = Math.min(c.duration || 0, c.currentTime + 5);
1852
+ u.preventDefault(), v.currentTime = Math.min(v.duration || 0, v.currentTime + 5);
1420
1853
  break;
1421
1854
  case "ArrowUp":
1422
- d.preventDefault(), c.volume = Math.min(1, c.volume + 0.1), c.muted && (c.muted = !1);
1855
+ u.preventDefault(), v.volume = Math.min(1, v.volume + 0.1), v.muted && (v.muted = !1);
1423
1856
  break;
1424
1857
  case "ArrowDown":
1425
- d.preventDefault(), c.volume = Math.max(0, c.volume - 0.1);
1858
+ u.preventDefault(), v.volume = Math.max(0, v.volume - 0.1);
1426
1859
  break;
1427
1860
  case "m":
1428
- c.muted = !c.muted;
1861
+ v.muted = !v.muted;
1429
1862
  break;
1430
1863
  case "f": {
1431
- const ue = document.fullscreenElement ?? document.webkitFullscreenElement ?? null, n = ((re = r.value) == null ? void 0 : re.requestFullscreen) ?? ((ie = r.value) == null ? void 0 : ie.webkitRequestFullscreen), u = document.exitFullscreen ?? document.webkitExitFullscreen;
1432
- ue === r.value ? u == null || u.call(document).catch(() => {
1433
- }) : n && r.value && n.call(r.value).catch(() => {
1864
+ const Se = document.fullscreenElement ?? document.webkitFullscreenElement ?? null, _e = ((j = B.value) == null ? void 0 : j.requestFullscreen) ?? ((Ee = B.value) == null ? void 0 : Ee.webkitRequestFullscreen), ke = document.exitFullscreen ?? document.webkitExitFullscreen;
1865
+ Se === B.value ? ke == null || ke.call(document).catch(() => {
1866
+ }) : _e && B.value && _e.call(B.value).catch(() => {
1434
1867
  });
1435
1868
  break;
1436
1869
  }
1437
1870
  case "p":
1438
- b && W();
1871
+ Y && ge();
1439
1872
  break;
1440
1873
  }
1441
1874
  }
1442
- return fe(() => {
1443
- document.addEventListener("keydown", le);
1444
- }), X(() => {
1445
- document.removeEventListener("keydown", le);
1446
- }), (d, c) => (i(), v("div", {
1875
+ return He(() => {
1876
+ document.addEventListener("keydown", Le);
1877
+ }), ne(() => {
1878
+ document.removeEventListener("keydown", Le);
1879
+ }), (u, v) => (d(), f("div", {
1447
1880
  ref_key: "rootEl",
1448
- ref: r,
1449
- class: C(["gvp-root", l.class]),
1450
- style: ce({ width: G.value, aspectRatio: N.value }),
1451
- onMouseenter: c[8] || (c[8] = (O) => {
1452
- h.value = !0, Y();
1881
+ ref: B,
1882
+ class: w(["gvp-root", n.class]),
1883
+ style: re({ width: ae.value, aspectRatio: Ie.value }),
1884
+ onMouseenter: v[12] || (v[12] = (P) => {
1885
+ x.value = !0, W();
1453
1886
  }),
1454
- onMouseleave: c[9] || (c[9] = (O) => {
1455
- h.value = !1, ve();
1887
+ onMouseleave: v[13] || (v[13] = (P) => {
1888
+ x.value = !1, G();
1456
1889
  })
1457
1890
  }, [
1458
- A.value ? (i(), v("iframe", {
1891
+ q.value ? (d(), f("iframe", {
1459
1892
  key: 0,
1460
1893
  class: "gvp-video gvp-youtube",
1461
- src: y.value ?? void 0,
1894
+ src: Me.value ?? void 0,
1462
1895
  title: "YouTube video player",
1463
1896
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
1464
1897
  allowfullscreen: "",
1465
1898
  referrerpolicy: "strict-origin-when-cross-origin"
1466
- }, null, 8, Nt)) : (i(), U(Ee, {
1467
- key: 1,
1899
+ }, null, 8, An)) : (d(), z(Ge, {
1468
1900
  ref_key: "hlsPlayerRef",
1469
- ref: o,
1470
- controls: R.value,
1901
+ ref: c,
1902
+ key: H.value,
1903
+ controls: J.value,
1471
1904
  "hls-config": t.hlsConfig,
1472
1905
  "is-hls": t.isHls,
1473
1906
  loop: t.loop,
1474
1907
  muted: t.muted,
1475
1908
  "auto-play": t.autoPlay,
1476
- "audio-track-index": x.value,
1909
+ "audio-track-index": $.value,
1910
+ "quality-level-index": m.value,
1477
1911
  "plays-inline": !0,
1478
- poster: t.poster,
1479
- src: t.src,
1912
+ poster: V.value,
1913
+ src: H.value,
1480
1914
  class: "gvp-video",
1481
1915
  preload: "metadata",
1482
- onAudioTracks: I,
1483
- onPause: c[0] || (c[0] = (O) => {
1484
- g.value = !1, e("pause");
1916
+ onAudioTracks: Te,
1917
+ onQualityLevels: X,
1918
+ onCurrentLevel: v[0] || (v[0] = (P) => b.value = P),
1919
+ onEnded: pe,
1920
+ onPause: v[1] || (v[1] = (P) => {
1921
+ h.value = !1, e("pause");
1485
1922
  }),
1486
- onPlay: c[1] || (c[1] = (O) => {
1487
- g.value = !0, e("play");
1923
+ onPlay: v[2] || (v[2] = (P) => {
1924
+ h.value = !0, e("play");
1488
1925
  })
1489
1926
  }, {
1490
- default: xe(() => [
1491
- ke(d.$slots, "default")
1927
+ default: Ye(() => [
1928
+ Fe(u.$slots, "default")
1492
1929
  ]),
1493
1930
  _: 3
1494
- }, 8, ["controls", "hls-config", "is-hls", "loop", "muted", "auto-play", "audio-track-index", "poster", "src"])),
1495
- A.value ? M("", !0) : (i(), v("div", Ot)),
1496
- t.showDeviceToggle ? (i(), v("div", jt, [
1497
- s("div", Ut, [
1498
- s("button", {
1499
- "aria-pressed": m.value === "desktop",
1500
- class: C(["gvp-toggle-btn", { "is-active": m.value === "desktop" }]),
1931
+ }, 8, ["controls", "hls-config", "is-hls", "loop", "muted", "auto-play", "audio-track-index", "quality-level-index", "poster", "src"])),
1932
+ q.value ? M("", !0) : (d(), f("div", Hn)),
1933
+ t.showDeviceToggle ? (d(), f("div", Bn, [
1934
+ r("div", Vn, [
1935
+ r("button", {
1936
+ "aria-pressed": o.value === "desktop",
1937
+ class: w(["gvp-toggle-btn", { "is-active": o.value === "desktop" }]),
1501
1938
  "aria-label": "Desktop view",
1502
1939
  type: "button",
1503
- onClick: c[2] || (c[2] = (O) => m.value = "desktop")
1940
+ onClick: v[3] || (v[3] = (P) => o.value = "desktop")
1504
1941
  }, [
1505
- j(Tt)
1506
- ], 10, Zt),
1507
- c[10] || (c[10] = s("div", { class: "gvp-toggle-divider" }, null, -1)),
1508
- s("button", {
1509
- "aria-pressed": m.value === "mobile",
1510
- class: C(["gvp-toggle-btn", { "is-active": m.value === "mobile" }]),
1942
+ Z(Ln)
1943
+ ], 10, qn),
1944
+ v[14] || (v[14] = r("div", { class: "gvp-toggle-divider" }, null, -1)),
1945
+ r("button", {
1946
+ "aria-pressed": o.value === "mobile",
1947
+ class: w(["gvp-toggle-btn", { "is-active": o.value === "mobile" }]),
1511
1948
  "aria-label": "Mobile view",
1512
1949
  type: "button",
1513
- onClick: c[3] || (c[3] = (O) => m.value = "mobile")
1950
+ onClick: v[4] || (v[4] = (P) => o.value = "mobile")
1514
1951
  }, [
1515
- j(St)
1516
- ], 10, qt)
1952
+ Z(_n)
1953
+ ], 10, Dn)
1517
1954
  ])
1518
1955
  ])) : M("", !0),
1519
- t.closable ? (i(), v("button", {
1956
+ t.closable ? (d(), f("button", {
1520
1957
  key: 4,
1521
1958
  "aria-label": "Close",
1522
1959
  class: "gvp-close",
1523
1960
  type: "button",
1524
- onClick: c[4] || (c[4] = (O) => e("close"))
1961
+ onClick: v[5] || (v[5] = (P) => e("close"))
1525
1962
  }, [
1526
- j(At)
1963
+ Z(Tn)
1527
1964
  ])) : M("", !0),
1528
- D.value && !E.value ? (i(), U(He, {
1965
+ le.value && !A.value ? (d(), z(rt, {
1529
1966
  key: 5,
1530
- tracks: P.value,
1531
- "active-index": B.value,
1532
- onSelect: c[5] || (c[5] = (O) => x.value = O)
1967
+ tracks: _.value,
1968
+ "active-index": we.value,
1969
+ onSelect: v[6] || (v[6] = (P) => $.value = P)
1533
1970
  }, null, 8, ["tracks", "active-index"])) : M("", !0),
1534
- !A.value && !E.value ? (i(), U(Fe, {
1971
+ !q.value && !A.value ? (d(), z(pt, {
1535
1972
  key: 6,
1536
- speed: _.value,
1537
- onSelect: pe
1973
+ speed: C.value,
1974
+ onSelect: xe
1538
1975
  }, null, 8, ["speed"])) : M("", !0),
1539
- !A.value && !E.value ? (i(), U(qe, {
1976
+ !q.value && !A.value ? (d(), z(yt, {
1540
1977
  key: 7,
1541
- video: S.value
1978
+ video: Q.value
1542
1979
  }, null, 8, ["video"])) : M("", !0),
1543
- !A.value && J(b) && !E.value ? (i(), v("button", {
1980
+ !q.value && te(Y) && !A.value ? (d(), f("button", {
1544
1981
  key: 8,
1545
1982
  type: "button",
1546
- class: C(["gvp-pip-btn", { "is-active": k.value }]),
1547
- "aria-label": k.value ? "Exit picture-in-picture" : "Picture-in-picture",
1548
- "aria-pressed": k.value,
1549
- onClick: W
1983
+ class: w(["gvp-pip-btn", { "is-active": p.value }]),
1984
+ "aria-label": p.value ? "Exit picture-in-picture" : "Picture-in-picture",
1985
+ "aria-pressed": p.value,
1986
+ onClick: ge
1550
1987
  }, [
1551
- j(Ce)
1552
- ], 10, zt)) : M("", !0),
1553
- !A.value && E.value ? (i(), v("button", {
1988
+ Z(Ze)
1989
+ ], 10, Fn)) : M("", !0),
1990
+ !q.value && A.value ? (d(), f("button", {
1554
1991
  key: 9,
1555
1992
  type: "button",
1556
1993
  class: "gvp-click-layer",
1557
- "aria-label": g.value ? "Pause" : "Play",
1558
- onClick: Q
1559
- }, null, 8, Wt)) : M("", !0),
1560
- !A.value && !E.value && !g.value ? (i(), v("div", Yt, [
1561
- s("button", {
1994
+ "aria-label": h.value ? "Pause" : "Play",
1995
+ onClick: se
1996
+ }, null, 8, Rn)) : M("", !0),
1997
+ !q.value && !A.value && !h.value ? (d(), f("div", On, [
1998
+ r("button", {
1562
1999
  "aria-label": "Play",
1563
2000
  class: "gvp-play",
1564
2001
  type: "button",
1565
- onClick: Q,
1566
- onMouseenter: c[6] || (c[6] = (O) => p.value = !0),
1567
- onMouseleave: c[7] || (c[7] = (O) => p.value = !1)
2002
+ onClick: se,
2003
+ onMouseenter: v[7] || (v[7] = (P) => g.value = !0),
2004
+ onMouseleave: v[8] || (v[8] = (P) => g.value = !1)
1568
2005
  }, [
1569
- j(Bt),
1570
- t.tooltipText && p.value ? (i(), v("span", Kt, q(t.tooltipText), 1)) : M("", !0)
2006
+ Z(Pn),
2007
+ t.tooltipText && g.value ? (d(), f("span", Un, U(t.tooltipText), 1)) : M("", !0)
1571
2008
  ], 32)
1572
2009
  ])) : M("", !0),
1573
- !A.value && E.value ? (i(), U(Pt, {
2010
+ !q.value && A.value ? (d(), z(Cn, {
1574
2011
  key: 11,
1575
- video: S.value,
1576
- "is-playing": g.value,
1577
- container: r.value,
1578
- "on-toggle-play": Q
1579
- }, null, 8, ["video", "is-playing", "container"])) : M("", !0),
1580
- !A.value && !E.value ? (i(), v("div", Jt)) : M("", !0)
2012
+ video: Q.value,
2013
+ "is-playing": h.value,
2014
+ container: B.value,
2015
+ "on-toggle-play": se,
2016
+ "quality-levels": S.value,
2017
+ "current-level": b.value,
2018
+ "selected-level": m.value,
2019
+ thumbnails: O.value,
2020
+ chapters: me.value,
2021
+ "has-prev": Pe.value,
2022
+ "has-next": oe.value,
2023
+ onSelectLevel: v[9] || (v[9] = (P) => m.value = P),
2024
+ onPrev: v[10] || (v[10] = (P) => de(N.value - 1, !0)),
2025
+ onNext: v[11] || (v[11] = (P) => de(N.value + 1, !0))
2026
+ }, null, 8, ["video", "is-playing", "container", "quality-levels", "current-level", "selected-level", "thumbnails", "chapters", "has-prev", "has-next"])) : M("", !0),
2027
+ !q.value && !A.value ? (d(), f("div", Zn)) : M("", !0)
1581
2028
  ], 38));
1582
2029
  }
1583
2030
  });
1584
2031
  export {
1585
- Ee as HLSPlayer,
1586
- Qt as VueVideoPlayer,
1587
- Dt as parseYouTubeId,
1588
- Rt as parseYouTubeStart,
1589
- Ft as youTubeEmbedUrl
2032
+ Ge as HLSPlayer,
2033
+ Wn as VueVideoPlayer,
2034
+ In as parseYouTubeId,
2035
+ Sn as parseYouTubeStart,
2036
+ Nn as youTubeEmbedUrl
1590
2037
  };
1591
2038
  //# sourceMappingURL=index.mjs.map