@glitchlab/vue-video-player 1.1.1 → 1.2.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.
Files changed (51) hide show
  1. package/README.md +56 -1
  2. package/dist/HLSPlayer.vue.d.ts +10 -0
  3. package/dist/HLSPlayer.vue.d.ts.map +1 -1
  4. package/dist/VideoPlayer.vue.d.ts +1 -1
  5. package/dist/VideoPlayer.vue.d.ts.map +1 -1
  6. package/dist/components/AudioTrackSwitcher.vue.d.ts +24 -0
  7. package/dist/components/AudioTrackSwitcher.vue.d.ts.map +1 -0
  8. package/dist/components/CaptionsSwitcher.vue.d.ts +16 -0
  9. package/dist/components/CaptionsSwitcher.vue.d.ts.map +1 -0
  10. package/dist/components/ControlBar.vue.d.ts +22 -0
  11. package/dist/components/ControlBar.vue.d.ts.map +1 -0
  12. package/dist/components/IconAudio.vue.d.ts +16 -0
  13. package/dist/components/IconAudio.vue.d.ts.map +1 -0
  14. package/dist/components/IconCaptions.vue.d.ts +16 -0
  15. package/dist/components/IconCaptions.vue.d.ts.map +1 -0
  16. package/dist/components/IconChevron.vue.d.ts +16 -0
  17. package/dist/components/IconChevron.vue.d.ts.map +1 -0
  18. package/dist/components/IconFullscreen.vue.d.ts +16 -0
  19. package/dist/components/IconFullscreen.vue.d.ts.map +1 -0
  20. package/dist/components/IconFullscreenExit.vue.d.ts +16 -0
  21. package/dist/components/IconFullscreenExit.vue.d.ts.map +1 -0
  22. package/dist/components/IconPause.vue.d.ts +16 -0
  23. package/dist/components/IconPause.vue.d.ts.map +1 -0
  24. package/dist/components/IconPiP.vue.d.ts +16 -0
  25. package/dist/components/IconPiP.vue.d.ts.map +1 -0
  26. package/dist/components/IconPlaySolid.vue.d.ts +16 -0
  27. package/dist/components/IconPlaySolid.vue.d.ts.map +1 -0
  28. package/dist/components/IconSpeed.vue.d.ts +16 -0
  29. package/dist/components/IconSpeed.vue.d.ts.map +1 -0
  30. package/dist/components/IconVolumeHigh.vue.d.ts +16 -0
  31. package/dist/components/IconVolumeHigh.vue.d.ts.map +1 -0
  32. package/dist/components/IconVolumeLow.vue.d.ts +16 -0
  33. package/dist/components/IconVolumeLow.vue.d.ts.map +1 -0
  34. package/dist/components/IconVolumeMuted.vue.d.ts +16 -0
  35. package/dist/components/IconVolumeMuted.vue.d.ts.map +1 -0
  36. package/dist/components/SpeedSwitcher.vue.d.ts +20 -0
  37. package/dist/components/SpeedSwitcher.vue.d.ts.map +1 -0
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.mjs +1368 -227
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/style.css +1 -1
  45. package/dist/utils/audio-tracks.d.ts +15 -0
  46. package/dist/utils/audio-tracks.d.ts.map +1 -0
  47. package/dist/utils/format-time.d.ts +2 -0
  48. package/dist/utils/format-time.d.ts.map +1 -0
  49. package/dist/utils/types.d.ts +7 -2
  50. package/dist/utils/types.d.ts.map +1 -1
  51. package/package.json +4 -3
package/dist/index.mjs CHANGED
@@ -1,6 +1,19 @@
1
- import { defineComponent as x, ref as w, onMounted as A, watch as D, onUnmounted as N, openBlock as d, createElementBlock as v, normalizeClass as C, renderSlot as T, createElementVNode as p, computed as P, normalizeStyle as Z, createBlock as U, withCtx as z, createCommentVNode as $, createVNode as B, toDisplayString as W } from "vue";
2
- import L from "hls.js";
3
- const _ = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "poster"], Y = /* @__PURE__ */ x({
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";
2
+ import ee from "hls.js";
3
+ function he(t, a, l) {
4
+ const e = t == null ? void 0 : t.trim();
5
+ if (e) return e;
6
+ if (a) {
7
+ try {
8
+ const m = new Intl.DisplayNames(void 0, { type: "language" }).of(a);
9
+ if (m && m !== a) return m;
10
+ } catch {
11
+ }
12
+ return a;
13
+ }
14
+ return `Audio ${l + 1}`;
15
+ }
16
+ const _e = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "poster"], Ee = /* @__PURE__ */ T({
4
17
  __name: "HLSPlayer",
5
18
  props: {
6
19
  src: {},
@@ -13,98 +26,1108 @@ const _ = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "p
13
26
  playsInline: { type: Boolean, default: !0 },
14
27
  preload: { default: "metadata" },
15
28
  poster: {},
16
- class: {}
29
+ class: {},
30
+ audioTrackIndex: { default: -1 }
17
31
  },
18
- emits: ["play", "pause"],
19
- setup(e, { expose: s, emit: o }) {
20
- const t = e, f = o, i = w(null), r = w(null), u = globalThis.window !== void 0 && L.isSupported(), b = (n) => !!t.isHls || u && n.endsWith(".m3u8");
21
- let y;
22
- function m() {
23
- y == null || y(), y = void 0, r.value && (r.value.destroy(), r.value = null);
24
- const n = i.value;
25
- if (n) {
26
- for (n.pause(), n.removeAttribute("src"); n.firstChild; ) n.firstChild.remove();
27
- n.load();
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", []);
28
43
  }
29
44
  }
30
- function M(n) {
31
- const c = i.value;
32
- if (!c || !n) return;
33
- m();
34
- const h = () => {
35
- t.autoPlay && c.play().catch(() => {
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(() => {
36
52
  });
37
53
  };
38
- if (b(n)) {
39
- const g = new L(t.hlsConfig);
40
- r.value = g, g.attachMedia(c), g.loadSource(n), g.on(L.Events.MANIFEST_PARSED, h), g.on(L.Events.ERROR, (S, E) => {
41
- E.fatal && (g.destroy(), r.value = null);
42
- });
43
- } else
44
- c.src = n, c.load(), c.addEventListener("loadedmetadata", h, { once: !0 }), y = () => {
45
- c.removeEventListener("loadedmetadata", h);
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
62
+ }));
63
+ o("audio-tracks", D);
64
+ };
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);
68
+ } else {
69
+ b.src = r, b.load(), b.addEventListener("loadedmetadata", E, { once: !0 }), L = () => {
70
+ b.removeEventListener("loadedmetadata", E);
46
71
  };
72
+ const y = b.audioTracks;
73
+ if (y) {
74
+ const I = () => {
75
+ const D = [];
76
+ for (let B = 0; B < y.length; B++) {
77
+ const N = y[B];
78
+ D.push({
79
+ index: B,
80
+ label: he(N.label, N.language, B),
81
+ lang: N.language || void 0
82
+ });
83
+ }
84
+ o("audio-tracks", D);
85
+ };
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);
89
+ };
90
+ }
91
+ }
92
+ }
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);
99
+ return;
100
+ }
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;
47
105
  }
48
- return A(() => {
49
- t.src && M(t.src);
50
- }), D(
51
- () => t.src,
52
- (n) => {
53
- n && M(n);
106
+ return fe(() => {
107
+ e.src && k(e.src);
108
+ }), F(
109
+ () => e.src,
110
+ (r) => {
111
+ r && k(r);
54
112
  }
55
- ), N(m), s({ videoEl: i }), (n, c) => (d(), v("video", {
113
+ ), F(
114
+ () => e.audioTrackIndex,
115
+ (r) => h(r)
116
+ ), X(_), a({ videoEl: m }), (r, b) => (i(), v("video", {
56
117
  ref_key: "videoEl",
57
- ref: i,
58
- muted: e.muted,
59
- loop: e.loop,
60
- controls: e.controls,
61
- autoplay: e.autoPlay,
62
- playsinline: e.playsInline,
63
- preload: e.preload,
64
- poster: e.poster,
65
- class: C(t.class),
66
- onPlay: c[0] || (c[0] = (h) => f("play")),
67
- onPause: c[1] || (c[1] = (h) => f("pause"))
118
+ ref: m,
119
+ muted: t.muted,
120
+ loop: t.loop,
121
+ controls: t.controls,
122
+ autoplay: t.autoPlay,
123
+ playsinline: t.playsInline,
124
+ preload: t.preload,
125
+ 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"))
68
129
  }, [
69
- T(n.$slots, "default")
70
- ], 42, _));
130
+ ke(r.$slots, "default")
131
+ ], 42, _e));
71
132
  }
72
- }), j = { name: "IconDesktop" }, F = /* @__PURE__ */ x({
73
- ...j,
133
+ }), $e = { name: "IconAudio" }, Le = /* @__PURE__ */ T({
134
+ ...$e,
74
135
  props: {
75
136
  class: {}
76
137
  },
77
- setup(e) {
78
- const s = e;
79
- return (o, t) => (d(), v("svg", {
80
- class: C(["gvp-icon", s.class]),
138
+ setup(t) {
139
+ const a = t;
140
+ return (l, e) => (i(), v("svg", {
141
+ class: C(["gvp-icon", a.class]),
142
+ width: "16",
143
+ height: "16",
144
+ viewBox: "0 0 24 24",
145
+ fill: "none",
146
+ xmlns: "http://www.w3.org/2000/svg",
147
+ "aria-hidden": "true"
148
+ }, [...e[0] || (e[0] = [
149
+ s("path", {
150
+ 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
+ stroke: "currentColor",
152
+ "stroke-width": "1.5",
153
+ "stroke-linejoin": "round"
154
+ }, null, -1),
155
+ s("path", {
156
+ 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
+ stroke: "currentColor",
158
+ "stroke-width": "1.5",
159
+ "stroke-linecap": "round"
160
+ }, null, -1)
161
+ ])], 2));
162
+ }
163
+ }), Pe = { name: "IconChevron" }, ye = /* @__PURE__ */ T({
164
+ ...Pe,
165
+ props: {
166
+ class: {}
167
+ },
168
+ setup(t) {
169
+ const a = t;
170
+ return (l, e) => (i(), v("svg", {
171
+ class: C(["gvp-icon", a.class]),
172
+ width: "12",
173
+ height: "12",
174
+ viewBox: "0 0 24 24",
175
+ fill: "none",
176
+ xmlns: "http://www.w3.org/2000/svg",
177
+ "aria-hidden": "true"
178
+ }, [...e[0] || (e[0] = [
179
+ s("path", {
180
+ d: "M6 9L12 15L18 9",
181
+ stroke: "currentColor",
182
+ "stroke-width": "2",
183
+ "stroke-linecap": "round",
184
+ "stroke-linejoin": "round"
185
+ }, null, -1)
186
+ ])], 2));
187
+ }
188
+ }), Me = ["aria-expanded"], Te = { class: "gvp-audio-label" }, Ie = {
189
+ key: 0,
190
+ class: "gvp-audio-menu",
191
+ role: "listbox",
192
+ "aria-label": "Audio tracks"
193
+ }, Se = ["aria-selected", "onClick"], He = /* @__PURE__ */ T({
194
+ __name: "AudioTrackSwitcher",
195
+ props: {
196
+ tracks: {},
197
+ activeIndex: {}
198
+ },
199
+ emits: ["select"],
200
+ 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]
203
+ );
204
+ function p(x) {
205
+ m.value && !m.value.contains(x.target) && (o.value = !1);
206
+ }
207
+ function L(x) {
208
+ x.key === "Escape" && (o.value = !1);
209
+ }
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);
214
+ });
215
+ function P(x) {
216
+ e("select", x), o.value = !1;
217
+ }
218
+ return (x, _) => {
219
+ var k;
220
+ return i(), v("div", {
221
+ ref_key: "rootEl",
222
+ ref: m,
223
+ class: "gvp-audio"
224
+ }, [
225
+ s("button", {
226
+ type: "button",
227
+ class: "gvp-audio-btn",
228
+ "aria-haspopup": "listbox",
229
+ "aria-expanded": o.value,
230
+ "aria-label": "Audio track",
231
+ onClick: _[0] || (_[0] = (h) => o.value = !o.value)
232
+ }, [
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
240
+ }, [
241
+ s("button", {
242
+ type: "button",
243
+ 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)
248
+ ]))), 128))
249
+ ])) : M("", !0)
250
+ ], 512);
251
+ };
252
+ }
253
+ }), Be = { name: "IconSpeed" }, we = /* @__PURE__ */ T({
254
+ ...Be,
255
+ props: {
256
+ class: {}
257
+ },
258
+ setup(t) {
259
+ const a = t;
260
+ return (l, e) => (i(), v("svg", {
261
+ class: C(["gvp-icon", a.class]),
262
+ width: "16",
263
+ height: "16",
264
+ viewBox: "0 0 24 24",
265
+ fill: "none",
266
+ xmlns: "http://www.w3.org/2000/svg",
267
+ "aria-hidden": "true"
268
+ }, [...e[0] || (e[0] = [
269
+ s("path", {
270
+ 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
+ stroke: "currentColor",
272
+ "stroke-width": "1.5"
273
+ }, null, -1),
274
+ s("path", {
275
+ d: "M12 8V12L14.5 14.5",
276
+ stroke: "currentColor",
277
+ "stroke-width": "1.5",
278
+ "stroke-linecap": "round",
279
+ "stroke-linejoin": "round"
280
+ }, null, -1)
281
+ ])], 2));
282
+ }
283
+ }), Ve = ["aria-expanded"], Ae = { class: "gvp-speed-label" }, De = {
284
+ key: 0,
285
+ class: "gvp-speed-menu",
286
+ role: "listbox",
287
+ "aria-label": "Playback speed"
288
+ }, Re = ["aria-selected", "onClick"], Fe = /* @__PURE__ */ T({
289
+ __name: "SpeedSwitcher",
290
+ props: {
291
+ speed: {}
292
+ },
293
+ emits: ["select"],
294
+ 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);
298
+ }
299
+ function p(P) {
300
+ P.key === "Escape" && (o.value = !1);
301
+ }
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);
306
+ });
307
+ function L(P) {
308
+ e("select", P), o.value = !1;
309
+ }
310
+ return (P, x) => (i(), v("div", {
311
+ ref_key: "rootEl",
312
+ ref: m,
313
+ class: "gvp-speed"
314
+ }, [
315
+ s("button", {
316
+ type: "button",
317
+ class: "gvp-speed-btn",
318
+ "aria-haspopup": "listbox",
319
+ "aria-expanded": o.value,
320
+ "aria-label": "`Playback speed: ${speed === 1 ? '1×' : speed + '×'}`",
321
+ onClick: x[0] || (x[0] = (_) => o.value = !o.value)
322
+ }, [
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", {
330
+ type: "button",
331
+ 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)
336
+ ])), 64))
337
+ ])) : M("", !0)
338
+ ], 512));
339
+ }
340
+ }), Ne = { name: "IconCaptions" }, be = /* @__PURE__ */ T({
341
+ ...Ne,
342
+ props: {
343
+ class: {}
344
+ },
345
+ setup(t) {
346
+ const a = t;
347
+ return (l, e) => (i(), v("svg", {
348
+ class: C(["gvp-icon", a.class]),
349
+ width: "18",
350
+ height: "18",
351
+ viewBox: "0 0 24 24",
352
+ fill: "none",
353
+ xmlns: "http://www.w3.org/2000/svg",
354
+ "aria-hidden": "true"
355
+ }, [...e[0] || (e[0] = [
356
+ s("rect", {
357
+ x: "2",
358
+ y: "5",
359
+ width: "20",
360
+ height: "14",
361
+ rx: "3",
362
+ stroke: "currentColor",
363
+ "stroke-width": "1.5"
364
+ }, null, -1),
365
+ s("path", {
366
+ d: "M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17",
367
+ stroke: "currentColor",
368
+ "stroke-width": "1.5",
369
+ "stroke-linecap": "round"
370
+ }, null, -1)
371
+ ])], 2));
372
+ }
373
+ }), Oe = ["aria-expanded", "aria-pressed"], je = {
374
+ key: 0,
375
+ class: "gvp-captions-menu",
376
+ role: "listbox",
377
+ "aria-label": "Captions"
378
+ }, Ue = ["aria-selected"], Ze = ["aria-selected", "onClick"], qe = /* @__PURE__ */ T({
379
+ __name: "CaptionsSwitcher",
380
+ props: {
381
+ video: {}
382
+ },
383
+ 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}` });
390
+ }
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;
396
+ break;
397
+ }
398
+ e.value = r;
399
+ }
400
+ let p = null;
401
+ F(() => a.video, (k) => {
402
+ if (p == null || p(), p = null, !k) {
403
+ l.value = [], e.value = -1;
404
+ return;
405
+ }
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);
411
+ });
412
+ }, { immediate: !0 }), X(() => {
413
+ p == null || p(), document.removeEventListener("mousedown", L), document.removeEventListener("keydown", P);
414
+ });
415
+ function L(k) {
416
+ m.value && !m.value.contains(k.target) && (o.value = !1);
417
+ }
418
+ function P(k) {
419
+ k.key === "Escape" && (o.value = !1);
420
+ }
421
+ F(o, (k) => {
422
+ k ? (document.addEventListener("mousedown", L), document.addEventListener("keydown", P)) : (document.removeEventListener("mousedown", L), document.removeEventListener("keydown", P));
423
+ });
424
+ function x() {
425
+ 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;
429
+ }
430
+ function _(k) {
431
+ 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;
436
+ }
437
+ return (k, h) => l.value.length > 0 ? (i(), v("div", {
438
+ key: 0,
439
+ ref_key: "rootEl",
440
+ ref: m,
441
+ class: "gvp-captions"
442
+ }, [
443
+ s("button", {
444
+ type: "button",
445
+ class: C(["gvp-captions-btn", { "is-active": e.value >= 0 }]),
446
+ "aria-haspopup": "listbox",
447
+ "aria-expanded": o.value,
448
+ "aria-pressed": e.value >= 0,
449
+ "aria-label": "Captions",
450
+ onClick: h[0] || (h[0] = (r) => o.value = !o.value)
451
+ }, [
452
+ j(be)
453
+ ], 10, Oe),
454
+ o.value ? (i(), v("ul", je, [
455
+ s("li", null, [
456
+ s("button", {
457
+ type: "button",
458
+ role: "option",
459
+ "aria-selected": e.value === -1,
460
+ class: C(["gvp-captions-menu-item", { "is-active": e.value === -1 }]),
461
+ onClick: x
462
+ }, " Off ", 10, Ue)
463
+ ]),
464
+ (i(!0), v(oe, null, ae(l.value, (r) => (i(), v("li", {
465
+ key: r.index
466
+ }, [
467
+ s("button", {
468
+ type: "button",
469
+ 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)
474
+ ]))), 128))
475
+ ])) : M("", !0)
476
+ ], 512)) : M("", !0);
477
+ }
478
+ }), ze = { name: "IconPause" }, We = /* @__PURE__ */ T({
479
+ ...ze,
480
+ props: {
481
+ class: {}
482
+ },
483
+ setup(t) {
484
+ const a = t;
485
+ return (l, e) => (i(), v("svg", {
486
+ class: C(["gvp-icon", a.class]),
487
+ width: "16",
488
+ height: "16",
489
+ viewBox: "0 0 24 24",
490
+ fill: "none",
491
+ xmlns: "http://www.w3.org/2000/svg",
492
+ "aria-hidden": "true"
493
+ }, [...e[0] || (e[0] = [
494
+ s("rect", {
495
+ x: "6",
496
+ y: "5",
497
+ width: "4",
498
+ height: "14",
499
+ rx: "1",
500
+ fill: "currentColor"
501
+ }, null, -1),
502
+ s("rect", {
503
+ x: "14",
504
+ y: "5",
505
+ width: "4",
506
+ height: "14",
507
+ rx: "1",
508
+ fill: "currentColor"
509
+ }, null, -1)
510
+ ])], 2));
511
+ }
512
+ }), Ye = { name: "IconPlaySolid" }, Ke = /* @__PURE__ */ T({
513
+ ...Ye,
514
+ props: {
515
+ class: {}
516
+ },
517
+ setup(t) {
518
+ const a = t;
519
+ return (l, e) => (i(), v("svg", {
520
+ class: C(["gvp-icon", a.class]),
521
+ width: "16",
522
+ height: "16",
523
+ viewBox: "0 0 24 24",
524
+ fill: "none",
525
+ xmlns: "http://www.w3.org/2000/svg",
526
+ "aria-hidden": "true"
527
+ }, [...e[0] || (e[0] = [
528
+ s("path", {
529
+ 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
+ fill: "currentColor"
531
+ }, null, -1)
532
+ ])], 2));
533
+ }
534
+ }), Je = { name: "IconVolumeHigh" }, Xe = /* @__PURE__ */ T({
535
+ ...Je,
536
+ props: {
537
+ class: {}
538
+ },
539
+ setup(t) {
540
+ const a = t;
541
+ return (l, e) => (i(), v("svg", {
542
+ class: C(["gvp-icon", a.class]),
543
+ width: "18",
544
+ height: "18",
545
+ viewBox: "0 0 24 24",
546
+ fill: "none",
547
+ xmlns: "http://www.w3.org/2000/svg",
548
+ "aria-hidden": "true"
549
+ }, [...e[0] || (e[0] = [
550
+ s("path", {
551
+ 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
+ stroke: "currentColor",
553
+ "stroke-width": "1.5",
554
+ "stroke-linejoin": "round"
555
+ }, null, -1),
556
+ s("path", {
557
+ 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
+ stroke: "currentColor",
559
+ "stroke-width": "1.5",
560
+ "stroke-linecap": "round"
561
+ }, null, -1)
562
+ ])], 2));
563
+ }
564
+ }), Ge = { name: "IconVolumeLow" }, Qe = /* @__PURE__ */ T({
565
+ ...Ge,
566
+ props: {
567
+ class: {}
568
+ },
569
+ setup(t) {
570
+ const a = t;
571
+ return (l, e) => (i(), v("svg", {
572
+ class: C(["gvp-icon", a.class]),
573
+ width: "18",
574
+ height: "18",
575
+ viewBox: "0 0 24 24",
576
+ fill: "none",
577
+ xmlns: "http://www.w3.org/2000/svg",
578
+ "aria-hidden": "true"
579
+ }, [...e[0] || (e[0] = [
580
+ s("path", {
581
+ 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
+ stroke: "currentColor",
583
+ "stroke-width": "1.5",
584
+ "stroke-linejoin": "round"
585
+ }, null, -1),
586
+ s("path", {
587
+ d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",
588
+ stroke: "currentColor",
589
+ "stroke-width": "1.5",
590
+ "stroke-linecap": "round"
591
+ }, null, -1)
592
+ ])], 2));
593
+ }
594
+ }), et = { name: "IconVolumeMuted" }, tt = /* @__PURE__ */ T({
595
+ ...et,
596
+ props: {
597
+ class: {}
598
+ },
599
+ setup(t) {
600
+ const a = t;
601
+ return (l, e) => (i(), v("svg", {
602
+ class: C(["gvp-icon", a.class]),
603
+ width: "18",
604
+ height: "18",
605
+ viewBox: "0 0 24 24",
606
+ fill: "none",
607
+ xmlns: "http://www.w3.org/2000/svg",
608
+ "aria-hidden": "true"
609
+ }, [...e[0] || (e[0] = [
610
+ s("path", {
611
+ 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
+ stroke: "currentColor",
613
+ "stroke-width": "1.5",
614
+ "stroke-linejoin": "round"
615
+ }, null, -1),
616
+ s("path", {
617
+ d: "M16 9L22 15M22 9L16 15",
618
+ stroke: "currentColor",
619
+ "stroke-width": "1.5",
620
+ "stroke-linecap": "round"
621
+ }, null, -1)
622
+ ])], 2));
623
+ }
624
+ }), nt = { name: "IconPiP" }, Ce = /* @__PURE__ */ T({
625
+ ...nt,
626
+ props: {
627
+ class: {}
628
+ },
629
+ setup(t) {
630
+ const a = t;
631
+ return (l, e) => (i(), v("svg", {
632
+ class: C(["gvp-icon", a.class]),
633
+ width: "18",
634
+ height: "18",
635
+ viewBox: "0 0 24 24",
636
+ fill: "none",
637
+ xmlns: "http://www.w3.org/2000/svg",
638
+ "aria-hidden": "true"
639
+ }, [...e[0] || (e[0] = [
640
+ s("rect", {
641
+ x: "2",
642
+ y: "4",
643
+ width: "20",
644
+ height: "16",
645
+ rx: "2",
646
+ stroke: "currentColor",
647
+ "stroke-width": "1.5"
648
+ }, null, -1),
649
+ s("rect", {
650
+ x: "12",
651
+ y: "12",
652
+ width: "8",
653
+ height: "5",
654
+ rx: "1",
655
+ fill: "currentColor"
656
+ }, null, -1)
657
+ ])], 2));
658
+ }
659
+ }), ot = { name: "IconFullscreen" }, at = /* @__PURE__ */ T({
660
+ ...ot,
661
+ props: {
662
+ class: {}
663
+ },
664
+ setup(t) {
665
+ const a = t;
666
+ return (l, e) => (i(), v("svg", {
667
+ class: C(["gvp-icon", a.class]),
668
+ width: "18",
669
+ height: "18",
670
+ viewBox: "0 0 24 24",
671
+ fill: "none",
672
+ xmlns: "http://www.w3.org/2000/svg",
673
+ "aria-hidden": "true"
674
+ }, [...e[0] || (e[0] = [
675
+ s("path", {
676
+ d: "M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",
677
+ stroke: "currentColor",
678
+ "stroke-width": "1.75",
679
+ "stroke-linecap": "round",
680
+ "stroke-linejoin": "round"
681
+ }, null, -1)
682
+ ])], 2));
683
+ }
684
+ }), st = { name: "IconFullscreenExit" }, lt = /* @__PURE__ */ T({
685
+ ...st,
686
+ props: {
687
+ class: {}
688
+ },
689
+ setup(t) {
690
+ const a = t;
691
+ return (l, e) => (i(), v("svg", {
692
+ class: C(["gvp-icon", a.class]),
693
+ width: "18",
694
+ height: "18",
695
+ viewBox: "0 0 24 24",
696
+ fill: "none",
697
+ xmlns: "http://www.w3.org/2000/svg",
698
+ "aria-hidden": "true"
699
+ }, [...e[0] || (e[0] = [
700
+ s("path", {
701
+ d: "M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",
702
+ stroke: "currentColor",
703
+ "stroke-width": "1.75",
704
+ "stroke-linecap": "round",
705
+ "stroke-linejoin": "round"
706
+ }, null, -1)
707
+ ])], 2));
708
+ }
709
+ });
710
+ function ge(t) {
711
+ 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}`;
716
+ }
717
+ return `${e}:${m}`;
718
+ }
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 = {
720
+ class: "gvp-time",
721
+ "aria-live": "off"
722
+ }, pt = ["aria-expanded", "aria-label"], ft = { class: "gvp-speed-label" }, mt = {
723
+ key: 0,
724
+ class: "gvp-speed-menu",
725
+ role: "listbox",
726
+ "aria-label": "Playback speed"
727
+ }, ht = ["aria-selected", "onClick"], gt = ["aria-expanded", "aria-pressed"], kt = {
728
+ key: 0,
729
+ class: "gvp-captions-menu",
730
+ role: "listbox",
731
+ "aria-label": "Captions"
732
+ }, yt = ["aria-selected"], wt = ["aria-selected", "onClick"], bt = ["aria-label", "aria-pressed"], Ct = {
733
+ key: 0,
734
+ 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({
736
+ __name: "ControlBar",
737
+ props: {
738
+ video: {},
739
+ isPlaying: { type: Boolean },
740
+ container: {},
741
+ onTogglePlay: { type: Function }
742
+ },
743
+ setup(t) {
744
+ const a = (() => {
745
+ 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);
752
+ }
753
+ function L() {
754
+ p(), o.isPlaying && (g = setTimeout(() => {
755
+ m.value = !1;
756
+ }, Lt));
757
+ }
758
+ function P() {
759
+ m.value = !0, L();
760
+ }
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);
767
+ }, { 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;
779
+ return;
780
+ }
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);
785
+ break;
786
+ }
787
+ k.value = me;
788
+ };
789
+ u(), f(), $(), n.addEventListener("timeupdate", u), n.addEventListener("durationchange", f), n.addEventListener("loadedmetadata", f), n.addEventListener("progress", $), n.addEventListener("timeupdate", $);
790
+ }, { 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;
797
+ }
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;
803
+ };
804
+ u(), n.addEventListener("volumechange", u);
805
+ }, { immediate: !0 });
806
+ function A() {
807
+ o.video && (o.video.muted = !o.video.muted);
808
+ }
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);
814
+ }
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;
820
+ };
821
+ u(), n.addEventListener("ratechange", u);
822
+ }, { immediate: !0 });
823
+ function N(n) {
824
+ o.video && (o.video.playbackRate = n), I.value = n, D.value = !1;
825
+ }
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}` });
832
+ }
833
+ G.value = u;
834
+ let f = -1;
835
+ for (let $ = 0; $ < n.length; $++)
836
+ if (n[$].mode === "showing") {
837
+ f = $;
838
+ break;
839
+ }
840
+ S.value = f;
841
+ }
842
+ F(() => o.video, (n) => {
843
+ if (!n) {
844
+ G.value = [], S.value = -1;
845
+ return;
846
+ }
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));
851
+ }, { 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;
858
+ }
859
+ }
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;
866
+ }
867
+ }
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;
874
+ }));
875
+ }, { immediate: !0 });
876
+ function pe() {
877
+ o.video && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
878
+ }) : o.video.requestPictureInPicture().catch(() => {
879
+ }));
880
+ }
881
+ const W = w(!1), le = typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
882
+ function d() {
883
+ return document.fullscreenElement ?? document.webkitFullscreenElement ?? null;
884
+ }
885
+ function c(n) {
886
+ const u = n.requestFullscreen ?? n.webkitRequestFullscreen;
887
+ return u ? u.call(n) : Promise.reject(new Error("unsupported"));
888
+ }
889
+ function O() {
890
+ const n = document.exitFullscreen ?? document.webkitExitFullscreen;
891
+ return n ? n.call(document) : Promise.reject(new Error("unsupported"));
892
+ }
893
+ function K() {
894
+ W.value = d() === o.container;
895
+ }
896
+ fe(() => {
897
+ document.addEventListener("fullscreenchange", K), document.addEventListener("webkitfullscreenchange", K);
898
+ }), X(() => {
899
+ p(), document.removeEventListener("fullscreenchange", K), document.removeEventListener("webkitfullscreenchange", K);
900
+ });
901
+ function re() {
902
+ var n, u;
903
+ if (l) {
904
+ (u = (n = o.video) == null ? void 0 : n.webkitEnterFullscreen) == null || u.call(n);
905
+ return;
906
+ }
907
+ W.value ? O().catch(() => {
908
+ }) : o.container && c(o.container).catch(() => {
909
+ });
910
+ }
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);
915
+ }
916
+ function $(V) {
917
+ V.key === "Escape" && (n.value = !1);
918
+ }
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", $);
923
+ });
924
+ }
925
+ return ue(D, B), ue(z, te), (n, u) => (i(), v("div", {
926
+ role: "toolbar",
927
+ "aria-label": "Video controls",
928
+ class: C(["gvp-controls", !m.value && "is-hidden"]),
929
+ onMouseenter: p,
930
+ onMouseleave: L
931
+ }, [
932
+ s("div", rt, [
933
+ s("button", {
934
+ type: "button",
935
+ class: "gvp-ctrl-btn",
936
+ "aria-label": t.isPlaying ? "Pause" : "Play",
937
+ "aria-pressed": t.isPlaying,
938
+ onClick: u[0] || (u[0] = //@ts-ignore
939
+ (...f) => t.onTogglePlay && t.onTogglePlay(...f))
940
+ }, [
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", {
946
+ class: "gvp-seek-buffered",
947
+ style: ce({ width: `${b()}%` })
948
+ }, null, 4),
949
+ s("div", {
950
+ class: "gvp-seek-progress",
951
+ style: ce({ width: `${r()}%` })
952
+ }, null, 4)
953
+ ]),
954
+ s("input", {
955
+ type: "range",
956
+ class: "gvp-seek-input",
957
+ min: 0,
958
+ max: 100,
959
+ step: 0.1,
960
+ value: r(),
961
+ disabled: !h(),
962
+ "aria-label": "Seek",
963
+ "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", {
971
+ ref_key: "speedRootEl",
972
+ ref: B,
973
+ class: "gvp-speed"
974
+ }, [
975
+ s("button", {
976
+ type: "button",
977
+ class: "gvp-ctrl-btn gvp-speed-btn",
978
+ "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)
982
+ }, [
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", {
989
+ type: "button",
990
+ 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)
995
+ ])), 64))
996
+ ])) : M("", !0)
997
+ ], 512),
998
+ G.value.length > 0 ? (i(), v("div", {
999
+ key: 0,
1000
+ ref_key: "captionsRootEl",
1001
+ ref: te,
1002
+ class: "gvp-captions"
1003
+ }, [
1004
+ s("button", {
1005
+ type: "button",
1006
+ class: C(["gvp-ctrl-btn", S.value >= 0 && "is-active"]),
1007
+ "aria-haspopup": "listbox",
1008
+ "aria-expanded": z.value,
1009
+ "aria-label": "Captions",
1010
+ "aria-pressed": S.value >= 0,
1011
+ onClick: u[2] || (u[2] = (f) => z.value = !z.value)
1012
+ }, [
1013
+ j(be)
1014
+ ], 10, gt),
1015
+ z.value ? (i(), v("ul", kt, [
1016
+ s("li", null, [
1017
+ s("button", {
1018
+ type: "button",
1019
+ 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)
1024
+ ]),
1025
+ (i(!0), v(oe, null, ae(G.value, (f) => (i(), v("li", {
1026
+ key: f.index
1027
+ }, [
1028
+ s("button", {
1029
+ type: "button",
1030
+ 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)
1035
+ ]))), 128))
1036
+ ])) : M("", !0)
1037
+ ], 512)) : M("", !0),
1038
+ s("div", {
1039
+ class: C(["gvp-volume", !J(a) && "is-expandable"])
1040
+ }, [
1041
+ s("button", {
1042
+ type: "button",
1043
+ class: "gvp-ctrl-btn",
1044
+ "aria-label": H.value ? "Unmute" : "Mute",
1045
+ "aria-pressed": H.value,
1046
+ onClick: A
1047
+ }, [
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", {
1053
+ class: "gvp-volume-fill",
1054
+ style: ce({ width: `${H.value ? 0 : Math.round(R.value * 100)}%` })
1055
+ }, null, 4)
1056
+ ]),
1057
+ s("input", {
1058
+ type: "range",
1059
+ class: "gvp-volume-input",
1060
+ min: 0,
1061
+ max: 100,
1062
+ step: 1,
1063
+ value: H.value ? 0 : Math.round(R.value * 100),
1064
+ "aria-label": "Volume",
1065
+ "aria-valuemin": 0,
1066
+ "aria-valuemax": 100,
1067
+ "aria-valuenow": H.value ? 0 : Math.round(R.value * 100),
1068
+ onInput: y
1069
+ }, null, 40, _t)
1070
+ ]))
1071
+ ], 2),
1072
+ J(ve) ? (i(), v("button", {
1073
+ key: 1,
1074
+ 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
1079
+ }, [
1080
+ j(Ce)
1081
+ ], 10, Et)) : M("", !0),
1082
+ J(ie) ? (i(), v("button", {
1083
+ key: 2,
1084
+ 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
1089
+ }, [
1090
+ W.value ? (i(), U(lt, { key: 0 })) : (i(), U(at, { key: 1 }))
1091
+ ], 10, $t)) : M("", !0)
1092
+ ])
1093
+ ], 34));
1094
+ }
1095
+ }), Mt = { name: "IconDesktop" }, Tt = /* @__PURE__ */ T({
1096
+ ...Mt,
1097
+ props: {
1098
+ class: {}
1099
+ },
1100
+ setup(t) {
1101
+ const a = t;
1102
+ return (l, e) => (i(), v("svg", {
1103
+ class: C(["gvp-icon", a.class]),
81
1104
  width: "20",
82
1105
  height: "20",
83
1106
  viewBox: "0 0 24 24",
84
1107
  fill: "none",
85
1108
  xmlns: "http://www.w3.org/2000/svg",
86
1109
  "aria-hidden": "true"
87
- }, [...t[0] || (t[0] = [
88
- p("path", {
1110
+ }, [...e[0] || (e[0] = [
1111
+ s("path", {
89
1112
  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",
90
1113
  stroke: "currentColor",
91
1114
  "stroke-width": "1.5",
92
1115
  "stroke-linecap": "round"
93
1116
  }, null, -1),
94
- p("path", {
1117
+ s("path", {
95
1118
  d: "M11 15H13",
96
1119
  stroke: "currentColor",
97
1120
  "stroke-width": "1.5",
98
1121
  "stroke-linecap": "round",
99
1122
  "stroke-linejoin": "round"
100
1123
  }, null, -1),
101
- p("path", {
1124
+ s("path", {
102
1125
  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",
103
1126
  stroke: "currentColor",
104
1127
  "stroke-width": "1.5",
105
1128
  "stroke-linecap": "round"
106
1129
  }, null, -1),
107
- p("path", {
1130
+ s("path", {
108
1131
  d: "M7 22H17",
109
1132
  stroke: "currentColor",
110
1133
  "stroke-width": "1.5",
@@ -112,36 +1135,36 @@ const _ = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "p
112
1135
  }, null, -1)
113
1136
  ])], 2));
114
1137
  }
115
- }), J = { name: "IconMobile" }, O = /* @__PURE__ */ x({
116
- ...J,
1138
+ }), It = { name: "IconMobile" }, St = /* @__PURE__ */ T({
1139
+ ...It,
117
1140
  props: {
118
1141
  class: {}
119
1142
  },
120
- setup(e) {
121
- const s = e;
122
- return (o, t) => (d(), v("svg", {
123
- class: C(["gvp-icon", s.class]),
1143
+ setup(t) {
1144
+ const a = t;
1145
+ return (l, e) => (i(), v("svg", {
1146
+ class: C(["gvp-icon", a.class]),
124
1147
  width: "20",
125
1148
  height: "20",
126
1149
  viewBox: "0 0 24 24",
127
1150
  fill: "none",
128
1151
  xmlns: "http://www.w3.org/2000/svg",
129
1152
  "aria-hidden": "true"
130
- }, [...t[0] || (t[0] = [
131
- p("path", {
1153
+ }, [...e[0] || (e[0] = [
1154
+ s("path", {
132
1155
  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",
133
1156
  stroke: "currentColor",
134
1157
  "stroke-width": "2",
135
1158
  "stroke-linecap": "round"
136
1159
  }, null, -1),
137
- p("path", {
1160
+ s("path", {
138
1161
  d: "M11 19H13",
139
1162
  stroke: "currentColor",
140
1163
  "stroke-width": "2",
141
1164
  "stroke-linecap": "round",
142
1165
  "stroke-linejoin": "round"
143
1166
  }, null, -1),
144
- p("path", {
1167
+ s("path", {
145
1168
  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",
146
1169
  stroke: "currentColor",
147
1170
  "stroke-width": "2",
@@ -149,121 +1172,121 @@ const _ = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "p
149
1172
  }, null, -1)
150
1173
  ])], 2));
151
1174
  }
152
- }), X = { name: "IconPlay" }, q = /* @__PURE__ */ x({
153
- ...X,
1175
+ }), Ht = { name: "IconPlay" }, Bt = /* @__PURE__ */ T({
1176
+ ...Ht,
154
1177
  props: {
155
1178
  class: {}
156
1179
  },
157
- setup(e) {
158
- const s = e;
159
- return (o, t) => (d(), v("svg", {
160
- class: C(["gvp-icon", s.class]),
1180
+ setup(t) {
1181
+ const a = t;
1182
+ return (l, e) => (i(), v("svg", {
1183
+ class: C(["gvp-icon", a.class]),
161
1184
  width: "22",
162
1185
  height: "22",
163
1186
  viewBox: "0 0 16 16",
164
1187
  fill: "none",
165
1188
  xmlns: "http://www.w3.org/2000/svg",
166
1189
  "aria-hidden": "true"
167
- }, [...t[0] || (t[0] = [
168
- p("path", {
1190
+ }, [...e[0] || (e[0] = [
1191
+ s("path", {
169
1192
  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",
170
1193
  fill: "currentColor"
171
1194
  }, null, -1)
172
1195
  ])], 2));
173
1196
  }
174
- }), G = { name: "IconX" }, K = /* @__PURE__ */ x({
175
- ...G,
1197
+ }), Vt = { name: "IconX" }, At = /* @__PURE__ */ T({
1198
+ ...Vt,
176
1199
  props: {
177
1200
  class: {}
178
1201
  },
179
- setup(e) {
180
- const s = e;
181
- return (o, t) => (d(), v("svg", {
182
- class: C(["gvp-icon", s.class]),
1202
+ setup(t) {
1203
+ const a = t;
1204
+ return (l, e) => (i(), v("svg", {
1205
+ class: C(["gvp-icon", a.class]),
183
1206
  width: "14",
184
1207
  height: "14",
185
1208
  viewBox: "0 0 14 14",
186
1209
  fill: "none",
187
1210
  xmlns: "http://www.w3.org/2000/svg",
188
1211
  "aria-hidden": "true"
189
- }, [...t[0] || (t[0] = [
190
- p("path", {
1212
+ }, [...e[0] || (e[0] = [
1213
+ s("path", {
191
1214
  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",
192
1215
  fill: "currentColor"
193
1216
  }, null, -1)
194
1217
  ])], 2));
195
1218
  }
196
1219
  });
197
- function Q(e) {
198
- if (!e) return null;
199
- if (/^[A-Za-z0-9_-]{11}$/.test(e)) return e;
200
- let s;
1220
+ function Dt(t) {
1221
+ if (!t) return null;
1222
+ if (/^[A-Za-z0-9_-]{11}$/.test(t)) return t;
1223
+ let a;
201
1224
  try {
202
- s = new URL(e);
1225
+ a = new URL(t);
203
1226
  } catch {
204
1227
  return null;
205
1228
  }
206
- const o = s.hostname.replace(/^www\./, "");
207
- if (o === "youtu.be") {
208
- const t = s.pathname.slice(1).split("/")[0];
209
- return /^[A-Za-z0-9_-]{11}$/.test(t) ? t : null;
1229
+ const l = a.hostname.replace(/^www\./, "");
1230
+ if (l === "youtu.be") {
1231
+ const e = a.pathname.slice(1).split("/")[0];
1232
+ return /^[A-Za-z0-9_-]{11}$/.test(e) ? e : null;
210
1233
  }
211
- if (o === "youtube.com" || o === "m.youtube.com" || o === "music.youtube.com" || o === "youtube-nocookie.com") {
212
- const t = s.searchParams.get("v");
213
- if (t && /^[A-Za-z0-9_-]{11}$/.test(t)) return t;
214
- const f = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
215
- s.pathname
1234
+ if (l === "youtube.com" || l === "m.youtube.com" || l === "music.youtube.com" || l === "youtube-nocookie.com") {
1235
+ const e = a.searchParams.get("v");
1236
+ if (e && /^[A-Za-z0-9_-]{11}$/.test(e)) return e;
1237
+ const o = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
1238
+ a.pathname
216
1239
  );
217
- if (f) return f[1];
1240
+ if (o) return o[1];
218
1241
  }
219
1242
  return null;
220
1243
  }
221
- function ee(e) {
1244
+ function Rt(t) {
222
1245
  try {
223
- const s = new URL(e), o = s.searchParams.get("t") ?? s.searchParams.get("start");
224
- if (!o) return null;
225
- if (/^\d+s?$/.test(o)) return Number.parseInt(o, 10);
226
- const t = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(o);
227
- if (t) {
228
- const f = Number.parseInt(t[1] ?? "0", 10), i = Number.parseInt(t[2] ?? "0", 10), r = Number.parseInt(t[3] ?? "0", 10), u = f * 3600 + i * 60 + r;
229
- return u > 0 ? u : null;
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);
1250
+ 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;
230
1253
  }
231
1254
  } catch {
232
1255
  }
233
1256
  return null;
234
1257
  }
235
- function te(e, s = {}) {
1258
+ function Ft(t, a = {}) {
236
1259
  const {
237
- autoPlay: o = !1,
238
- muted: t = !0,
239
- loop: f = !1,
240
- controls: i = !0,
241
- startSeconds: r
242
- } = s, u = new URLSearchParams({
1260
+ autoPlay: l = !1,
1261
+ muted: e = !0,
1262
+ loop: o = !1,
1263
+ controls: m = !0,
1264
+ startSeconds: g
1265
+ } = a, p = new URLSearchParams({
243
1266
  rel: "0",
244
1267
  modestbranding: "1",
245
1268
  playsinline: "1",
246
- controls: i ? "1" : "0"
1269
+ controls: m ? "1" : "0"
247
1270
  });
248
- return o ? (u.set("autoplay", "1"), u.set("mute", "1")) : t && u.set("mute", "1"), f && (u.set("loop", "1"), u.set("playlist", e)), r && r > 0 && u.set("start", String(r)), `https://www.youtube-nocookie.com/embed/${e}?${u.toString()}`;
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()}`;
249
1272
  }
250
- const oe = ["src"], le = {
1273
+ const Nt = ["src"], Ot = {
251
1274
  key: 2,
252
1275
  class: "gvp-vignette"
253
- }, se = {
1276
+ }, jt = {
254
1277
  key: 3,
255
1278
  class: "gvp-toggle"
256
- }, ae = { class: "gvp-toggle-pill" }, ne = ["aria-pressed"], re = ["aria-pressed"], ue = {
257
- key: 5,
1279
+ }, Ut = { class: "gvp-toggle-pill" }, Zt = ["aria-pressed"], qt = ["aria-pressed"], zt = ["aria-label", "aria-pressed"], Wt = ["aria-label"], Yt = {
1280
+ key: 10,
258
1281
  class: "gvp-play-wrap"
259
- }, ie = {
1282
+ }, Kt = {
260
1283
  key: 0,
261
1284
  class: "gvp-tooltip",
262
1285
  role: "tooltip"
263
- }, ce = {
264
- key: 6,
1286
+ }, Jt = {
1287
+ key: 12,
265
1288
  class: "gvp-bottom-fade"
266
- }, ve = /* @__PURE__ */ x({
1289
+ }, Qt = /* @__PURE__ */ T({
267
1290
  __name: "VideoPlayer",
268
1291
  props: {
269
1292
  src: {},
@@ -274,7 +1297,7 @@ const oe = ["src"], le = {
274
1297
  tooltipText: {},
275
1298
  muted: { type: Boolean, default: !0 },
276
1299
  loop: { type: Boolean, default: !1 },
277
- controls: { type: Boolean, default: !1 },
1300
+ controls: { type: [Boolean, String], default: !1 },
278
1301
  autoPlay: { type: Boolean, default: !1 },
279
1302
  frameMaxWidth: {},
280
1303
  aspectRatio: {},
@@ -284,165 +1307,283 @@ const oe = ["src"], le = {
284
1307
  closable: { type: Boolean, default: !1 }
285
1308
  },
286
1309
  emits: ["close", "play", "pause"],
287
- setup(e, { emit: s }) {
288
- const o = e, t = s, f = w(null), i = w(o.defaultDevice), r = w(!1), u = w(!1), b = w(null), y = P(() => Q(o.src)), m = P(() => y.value !== null), M = P(
289
- () => y.value ? te(y.value, {
290
- autoPlay: o.autoPlay,
291
- muted: o.muted,
292
- loop: o.loop,
293
- controls: o.controls,
294
- startSeconds: ee(o.src)
1310
+ 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(() => l.controls === "custom"), R = Z(() => l.controls === !0), H = Z(() => Dt(l.src)), A = Z(() => H.value !== null), y = Z(
1312
+ () => H.value ? Ft(H.value, {
1313
+ autoPlay: l.autoPlay,
1314
+ muted: l.muted,
1315
+ loop: l.loop,
1316
+ controls: E.value ? !0 : R.value,
1317
+ startSeconds: Rt(l.src)
295
1318
  }) : null
296
- ), n = P(
1319
+ );
1320
+ function I(d) {
1321
+ P.value = d, x.value = -1;
1322
+ }
1323
+ const D = Z(
1324
+ () => !A.value && P.value.length > 1
1325
+ ), B = Z(
1326
+ () => {
1327
+ var d;
1328
+ return x.value >= 0 ? x.value : ((d = P.value[0]) == null ? void 0 : d.index) ?? -1;
1329
+ }
1330
+ ), N = Z(
297
1331
  () => {
298
- var a, l;
299
- return i.value === "mobile" ? ((a = o.aspectRatio) == null ? void 0 : a.mobile) ?? "9/16" : ((l = o.aspectRatio) == null ? void 0 : l.desktop) ?? "16/9";
1332
+ var d, c;
1333
+ return m.value === "mobile" ? ((d = l.aspectRatio) == null ? void 0 : d.mobile) ?? "9/16" : ((c = l.aspectRatio) == null ? void 0 : c.desktop) ?? "16/9";
300
1334
  }
301
- ), c = P(
1335
+ ), G = Z(
302
1336
  () => {
303
- var a, l;
304
- return i.value === "mobile" ? ((a = o.frameMaxWidth) == null ? void 0 : a.mobile) ?? "420px" : ((l = o.frameMaxWidth) == null ? void 0 : l.desktop) ?? "960px";
1337
+ var d, c;
1338
+ return m.value === "mobile" ? ((d = l.frameMaxWidth) == null ? void 0 : d.mobile) ?? "420px" : ((c = l.frameMaxWidth) == null ? void 0 : c.desktop) ?? "960px";
305
1339
  }
306
- ), h = P(() => {
307
- var a;
308
- return ((a = f.value) == null ? void 0 : a.videoEl) ?? null;
1340
+ ), S = Z(() => {
1341
+ var d;
1342
+ return ((d = o.value) == null ? void 0 : d.videoEl) ?? null;
309
1343
  });
310
- async function g() {
311
- const a = h.value;
312
- if (a)
1344
+ async function z() {
1345
+ const d = S.value;
1346
+ if (d)
313
1347
  try {
314
- a.readyState < 2 && a.load();
315
- const l = a.play();
316
- b.value = l, await l, r.value = !0;
1348
+ d.readyState < 2 && d.load();
1349
+ const c = d.play();
1350
+ L.value = c, await c, g.value = !0;
317
1351
  } catch {
318
- r.value = !1;
1352
+ g.value = !1;
319
1353
  } finally {
320
- b.value = null;
1354
+ L.value = null;
321
1355
  }
322
1356
  }
323
- async function S() {
324
- const a = h.value;
325
- if (a) {
326
- if (b.value)
1357
+ async function te() {
1358
+ const d = S.value;
1359
+ if (d) {
1360
+ if (L.value)
327
1361
  try {
328
- await b.value;
1362
+ await L.value;
329
1363
  } catch {
330
1364
  }
331
- a.pause();
1365
+ d.pause();
332
1366
  }
333
1367
  }
334
- async function E() {
335
- !o.hoverPlay || m.value || await g();
1368
+ async function se() {
1369
+ !l.hoverPlay || A.value || await z();
336
1370
  }
337
- async function H() {
338
- !o.hoverPlay || m.value || (await S(), r.value = !1);
1371
+ async function de() {
1372
+ !l.hoverPlay || A.value || (await te(), g.value = !1);
339
1373
  }
340
- async function I() {
341
- const a = h.value;
342
- a && (a.paused ? await g() : (await S(), r.value = !1));
1374
+ async function Q() {
1375
+ const d = S.value;
1376
+ d && (d.paused ? await z() : (await te(), g.value = !1));
343
1377
  }
344
- function R() {
345
- u.value = !0, E();
1378
+ function Y() {
1379
+ p.value = !0, se();
346
1380
  }
347
- function V() {
348
- u.value = !1, H();
1381
+ function ve() {
1382
+ p.value = !1, de();
349
1383
  }
350
- return (a, l) => (d(), v("div", {
351
- class: C(["gvp-root", o.class]),
352
- style: Z({ width: c.value, aspectRatio: n.value }),
353
- onMouseenter: R,
354
- onMouseleave: V
1384
+ function pe(d) {
1385
+ _.value = d;
1386
+ const c = S.value;
1387
+ c && (c.playbackRate = d);
1388
+ }
1389
+ F(S, (d) => {
1390
+ d && (d.addEventListener("ratechange", () => {
1391
+ _.value = d.playbackRate;
1392
+ }), d.addEventListener("enterpictureinpicture", () => {
1393
+ k.value = !0;
1394
+ }), d.addEventListener("leavepictureinpicture", () => {
1395
+ k.value = !1;
1396
+ }));
1397
+ });
1398
+ function W() {
1399
+ const d = S.value;
1400
+ d && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
1401
+ }) : d.requestPictureInPicture().catch(() => {
1402
+ }));
1403
+ }
1404
+ function le(d) {
1405
+ var K, re, ie;
1406
+ const c = S.value;
1407
+ if (!(!c || !h.value && !((K = r.value) != null && K.contains(document.activeElement)) || d.target.tagName === "INPUT" && d.key !== " "))
1408
+ switch (d.key) {
1409
+ case " ":
1410
+ case "k":
1411
+ d.preventDefault(), Q();
1412
+ break;
1413
+ case "ArrowLeft":
1414
+ d.preventDefault(), c.currentTime = Math.max(0, c.currentTime - 5);
1415
+ break;
1416
+ case "ArrowRight":
1417
+ d.preventDefault(), c.currentTime = Math.min(c.duration || 0, c.currentTime + 5);
1418
+ break;
1419
+ case "ArrowUp":
1420
+ d.preventDefault(), c.volume = Math.min(1, c.volume + 0.1), c.muted && (c.muted = !1);
1421
+ break;
1422
+ case "ArrowDown":
1423
+ d.preventDefault(), c.volume = Math.max(0, c.volume - 0.1);
1424
+ break;
1425
+ case "m":
1426
+ c.muted = !c.muted;
1427
+ break;
1428
+ case "f": {
1429
+ 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;
1430
+ ue === r.value ? u == null || u.call(document).catch(() => {
1431
+ }) : n && r.value && n.call(r.value).catch(() => {
1432
+ });
1433
+ break;
1434
+ }
1435
+ case "p":
1436
+ b && W();
1437
+ break;
1438
+ }
1439
+ }
1440
+ return fe(() => {
1441
+ document.addEventListener("keydown", le);
1442
+ }), X(() => {
1443
+ document.removeEventListener("keydown", le);
1444
+ }), (d, c) => (i(), v("div", {
1445
+ ref_key: "rootEl",
1446
+ ref: r,
1447
+ class: C(["gvp-root", l.class]),
1448
+ style: ce({ width: G.value, aspectRatio: N.value }),
1449
+ onMouseenter: c[8] || (c[8] = (O) => {
1450
+ h.value = !0, Y();
1451
+ }),
1452
+ onMouseleave: c[9] || (c[9] = (O) => {
1453
+ h.value = !1, ve();
1454
+ })
355
1455
  }, [
356
- m.value ? (d(), v("iframe", {
1456
+ A.value ? (i(), v("iframe", {
357
1457
  key: 0,
358
1458
  class: "gvp-video gvp-youtube",
359
- src: M.value ?? void 0,
1459
+ src: y.value ?? void 0,
360
1460
  title: "YouTube video player",
361
1461
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
362
1462
  allowfullscreen: "",
363
1463
  referrerpolicy: "strict-origin-when-cross-origin"
364
- }, null, 8, oe)) : (d(), U(Y, {
1464
+ }, null, 8, Nt)) : (i(), U(Ee, {
365
1465
  key: 1,
366
1466
  ref_key: "hlsPlayerRef",
367
- ref: f,
368
- controls: e.controls,
369
- "hls-config": e.hlsConfig,
370
- "is-hls": e.isHls,
371
- loop: e.loop,
372
- muted: e.muted,
373
- "auto-play": e.autoPlay,
1467
+ ref: o,
1468
+ controls: R.value,
1469
+ "hls-config": t.hlsConfig,
1470
+ "is-hls": t.isHls,
1471
+ loop: t.loop,
1472
+ muted: t.muted,
1473
+ "auto-play": t.autoPlay,
1474
+ "audio-track-index": x.value,
374
1475
  "plays-inline": !0,
375
- poster: e.poster,
376
- src: e.src,
1476
+ poster: t.poster,
1477
+ src: t.src,
377
1478
  class: "gvp-video",
378
1479
  preload: "metadata",
379
- onPause: l[0] || (l[0] = (k) => {
380
- r.value = !1, t("pause");
1480
+ onAudioTracks: I,
1481
+ onPause: c[0] || (c[0] = (O) => {
1482
+ g.value = !1, e("pause");
381
1483
  }),
382
- onPlay: l[1] || (l[1] = (k) => {
383
- r.value = !0, t("play");
1484
+ onPlay: c[1] || (c[1] = (O) => {
1485
+ g.value = !0, e("play");
384
1486
  })
385
1487
  }, {
386
- default: z(() => [
387
- T(a.$slots, "default")
1488
+ default: xe(() => [
1489
+ ke(d.$slots, "default")
388
1490
  ]),
389
1491
  _: 3
390
- }, 8, ["controls", "hls-config", "is-hls", "loop", "muted", "auto-play", "poster", "src"])),
391
- m.value ? $("", !0) : (d(), v("div", le)),
392
- e.showDeviceToggle ? (d(), v("div", se, [
393
- p("div", ae, [
394
- p("button", {
395
- "aria-pressed": i.value === "desktop",
396
- class: C(["gvp-toggle-btn", { "is-active": i.value === "desktop" }]),
1492
+ }, 8, ["controls", "hls-config", "is-hls", "loop", "muted", "auto-play", "audio-track-index", "poster", "src"])),
1493
+ A.value ? M("", !0) : (i(), v("div", Ot)),
1494
+ t.showDeviceToggle ? (i(), v("div", jt, [
1495
+ s("div", Ut, [
1496
+ s("button", {
1497
+ "aria-pressed": m.value === "desktop",
1498
+ class: C(["gvp-toggle-btn", { "is-active": m.value === "desktop" }]),
397
1499
  "aria-label": "Desktop view",
398
1500
  type: "button",
399
- onClick: l[2] || (l[2] = (k) => i.value = "desktop")
1501
+ onClick: c[2] || (c[2] = (O) => m.value = "desktop")
400
1502
  }, [
401
- B(F)
402
- ], 10, ne),
403
- l[7] || (l[7] = p("div", { class: "gvp-toggle-divider" }, null, -1)),
404
- p("button", {
405
- "aria-pressed": i.value === "mobile",
406
- class: C(["gvp-toggle-btn", { "is-active": i.value === "mobile" }]),
1503
+ j(Tt)
1504
+ ], 10, Zt),
1505
+ c[10] || (c[10] = s("div", { class: "gvp-toggle-divider" }, null, -1)),
1506
+ s("button", {
1507
+ "aria-pressed": m.value === "mobile",
1508
+ class: C(["gvp-toggle-btn", { "is-active": m.value === "mobile" }]),
407
1509
  "aria-label": "Mobile view",
408
1510
  type: "button",
409
- onClick: l[3] || (l[3] = (k) => i.value = "mobile")
1511
+ onClick: c[3] || (c[3] = (O) => m.value = "mobile")
410
1512
  }, [
411
- B(O)
412
- ], 10, re)
1513
+ j(St)
1514
+ ], 10, qt)
413
1515
  ])
414
- ])) : $("", !0),
415
- e.closable ? (d(), v("button", {
1516
+ ])) : M("", !0),
1517
+ t.closable ? (i(), v("button", {
416
1518
  key: 4,
417
1519
  "aria-label": "Close",
418
1520
  class: "gvp-close",
419
1521
  type: "button",
420
- onClick: l[4] || (l[4] = (k) => t("close"))
1522
+ onClick: c[4] || (c[4] = (O) => e("close"))
1523
+ }, [
1524
+ j(At)
1525
+ ])) : M("", !0),
1526
+ D.value && !E.value ? (i(), U(He, {
1527
+ key: 5,
1528
+ tracks: P.value,
1529
+ "active-index": B.value,
1530
+ onSelect: c[5] || (c[5] = (O) => x.value = O)
1531
+ }, null, 8, ["tracks", "active-index"])) : M("", !0),
1532
+ !A.value && !E.value ? (i(), U(Fe, {
1533
+ key: 6,
1534
+ speed: _.value,
1535
+ onSelect: pe
1536
+ }, null, 8, ["speed"])) : M("", !0),
1537
+ !A.value && !E.value ? (i(), U(qe, {
1538
+ key: 7,
1539
+ video: S.value
1540
+ }, null, 8, ["video"])) : M("", !0),
1541
+ !A.value && J(b) && !E.value ? (i(), v("button", {
1542
+ key: 8,
1543
+ type: "button",
1544
+ class: C(["gvp-pip-btn", { "is-active": k.value }]),
1545
+ "aria-label": k.value ? "Exit picture-in-picture" : "Picture-in-picture",
1546
+ "aria-pressed": k.value,
1547
+ onClick: W
421
1548
  }, [
422
- B(K)
423
- ])) : $("", !0),
424
- !m.value && !r.value ? (d(), v("div", ue, [
425
- p("button", {
1549
+ j(Ce)
1550
+ ], 10, zt)) : M("", !0),
1551
+ !A.value && E.value ? (i(), v("button", {
1552
+ key: 9,
1553
+ type: "button",
1554
+ class: "gvp-click-layer",
1555
+ "aria-label": g.value ? "Pause" : "Play",
1556
+ onClick: Q
1557
+ }, null, 8, Wt)) : M("", !0),
1558
+ !A.value && !E.value && !g.value ? (i(), v("div", Yt, [
1559
+ s("button", {
426
1560
  "aria-label": "Play",
427
1561
  class: "gvp-play",
428
1562
  type: "button",
429
- onClick: I,
430
- onMouseenter: l[5] || (l[5] = (k) => u.value = !0),
431
- onMouseleave: l[6] || (l[6] = (k) => u.value = !1)
1563
+ onClick: Q,
1564
+ onMouseenter: c[6] || (c[6] = (O) => p.value = !0),
1565
+ onMouseleave: c[7] || (c[7] = (O) => p.value = !1)
432
1566
  }, [
433
- B(q),
434
- e.tooltipText && u.value ? (d(), v("span", ie, W(e.tooltipText), 1)) : $("", !0)
1567
+ j(Bt),
1568
+ t.tooltipText && p.value ? (i(), v("span", Kt, q(t.tooltipText), 1)) : M("", !0)
435
1569
  ], 32)
436
- ])) : $("", !0),
437
- m.value ? $("", !0) : (d(), v("div", ce))
1570
+ ])) : M("", !0),
1571
+ !A.value && E.value ? (i(), U(Pt, {
1572
+ key: 11,
1573
+ video: S.value,
1574
+ "is-playing": g.value,
1575
+ container: r.value,
1576
+ "on-toggle-play": Q
1577
+ }, null, 8, ["video", "is-playing", "container"])) : M("", !0),
1578
+ !A.value && !E.value ? (i(), v("div", Jt)) : M("", !0)
438
1579
  ], 38));
439
1580
  }
440
1581
  });
441
1582
  export {
442
- Y as HLSPlayer,
443
- ve as VueVideoPlayer,
444
- Q as parseYouTubeId,
445
- ee as parseYouTubeStart,
446
- te as youTubeEmbedUrl
1583
+ Ee as HLSPlayer,
1584
+ Qt as VueVideoPlayer,
1585
+ Dt as parseYouTubeId,
1586
+ Rt as parseYouTubeStart,
1587
+ Ft as youTubeEmbedUrl
447
1588
  };
448
1589
  //# sourceMappingURL=index.mjs.map