@webitel/ui-sdk 25.10.52 → 25.10.54

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 (67) hide show
  1. package/dist/img/sprite/index.js +14 -1
  2. package/dist/img/sprite/record-start.svg +7 -0
  3. package/dist/img/sprite/record-stop.svg +7 -0
  4. package/dist/img/sprite/screenshot-done.svg +7 -0
  5. package/dist/img/sprite/screenshot-false.svg +7 -0
  6. package/dist/img/sprite/screenshot.svg +8 -0
  7. package/dist/img/sprite/sharing-end.svg +5 -0
  8. package/dist/{install-hlMLq0U3.js → install-Cvn-xDmg.js} +30453 -31092
  9. package/dist/ui-sdk.css +1 -1
  10. package/dist/ui-sdk.js +1 -1
  11. package/dist/ui-sdk.umd.cjs +1001 -989
  12. package/dist/vidstack-Bq6c3Bam-S5OrhBq2.js +413 -0
  13. package/dist/vidstack-D2pY00kU-HK4wj-R2.js +138 -0
  14. package/dist/vidstack-DDXt6fpN-D1Nzo26r.js +60 -0
  15. package/dist/vidstack-D_-9AA6_-DBOQembh.js +20 -0
  16. package/dist/vidstack-Dm1xEU9Q-qSXq3AI-.js +31 -0
  17. package/dist/vidstack-DqAw8m9J-k1JRevJl.js +29 -0
  18. package/dist/vidstack-audio-B1snbo-4.js +32 -0
  19. package/dist/vidstack-dash-BeCOt7Pp.js +403 -0
  20. package/dist/vidstack-google-cast-iUp-BySZ.js +377 -0
  21. package/dist/vidstack-hls-DVZy4g9e.js +324 -0
  22. package/dist/vidstack-krOAtKMi-B4IZWKdc.js +29 -0
  23. package/dist/vidstack-video-ykJKnrB2.js +181 -0
  24. package/dist/vidstack-vimeo-Bk8cduzE.js +437 -0
  25. package/dist/vidstack-youtube-FNzWU8v0.js +236 -0
  26. package/package.json +3 -3
  27. package/src/assets/icons/sprite/index.js +14 -1
  28. package/src/assets/icons/sprite/record-start.svg +7 -0
  29. package/src/assets/icons/sprite/record-stop.svg +7 -0
  30. package/src/assets/icons/sprite/screenshot-done.svg +7 -0
  31. package/src/assets/icons/sprite/screenshot-false.svg +7 -0
  32. package/src/assets/icons/sprite/screenshot.svg +8 -0
  33. package/src/assets/icons/sprite/sharing-end.svg +5 -0
  34. package/src/components/wt-image/wt-image.vue +4 -1
  35. package/src/components/wt-vidstack-player/components/layouts/video-layout.vue +12 -2
  36. package/src/components/wt-vidstack-player/components/panels/screen-sharing-control-panel/screen-sharing-control-panel.vue +211 -0
  37. package/src/components/wt-vidstack-player/types/WtVidstackPlayerControlsMode.ts +7 -0
  38. package/src/components/wt-vidstack-player/types/WtVidstackPlayerSession.ts +7 -0
  39. package/src/components/wt-vidstack-player/wt-vidstack-player.vue +24 -3
  40. package/src/plugins/primevue/theme/components/components.js +1 -2
  41. package/src/plugins/primevue/theme/extend/player/player.js +15 -0
  42. package/src/plugins/primevue/theme/webitel-theme.js +6 -1
  43. package/types/components/wt-image/wt-image.vue.d.ts +12 -2
  44. package/types/components/wt-vidstack-player/components/layouts/video-layout.vue.d.ts +5 -1
  45. package/types/components/wt-vidstack-player/components/panels/screen-sharing-control-panel/screen-sharing-control-panel.vue.d.ts +6 -0
  46. package/types/components/wt-vidstack-player/types/WtVidstackPlayerControlsMode.d.ts +5 -0
  47. package/types/components/wt-vidstack-player/types/WtVidstackPlayerSession.d.ts +7 -0
  48. package/types/components/wt-vidstack-player/wt-vidstack-player.vue.d.ts +6 -0
  49. package/types/plugins/primevue/theme/extend/player/player.d.ts +3 -0
  50. package/dist/vidstack-54Jpr2Lq-B-3uagaf.js +0 -142
  51. package/dist/vidstack-BP-l85ST-cd089zs4.js +0 -21
  52. package/dist/vidstack-BTBUzdbF-BuhaE3ef.js +0 -29
  53. package/dist/vidstack-Ccp8mxka-Cyoe3N05.js +0 -20
  54. package/dist/vidstack-Dgd3Tj9x-D_ifpfX9.js +0 -397
  55. package/dist/vidstack-DscYSLiW-Dk1undJ-.js +0 -33
  56. package/dist/vidstack-HTyVv8Yq-DRdwbVZd.js +0 -52
  57. package/dist/vidstack-audio-CFFRqrJ3.js +0 -26
  58. package/dist/vidstack-dash-BDtu3f4j.js +0 -405
  59. package/dist/vidstack-google-cast-hKSzmdiF.js +0 -405
  60. package/dist/vidstack-hls-BLyFYePL.js +0 -328
  61. package/dist/vidstack-video-BlmYiw-x.js +0 -149
  62. package/dist/vidstack-vimeo-DhWdWK51.js +0 -434
  63. package/dist/vidstack-youtube-l9Si5Vl-.js +0 -204
  64. package/src/plugins/primevue/theme/extend/extend.js +0 -7
  65. package/src/plugins/primevue/theme/extend/spacings/spacings.js +0 -15
  66. package/types/plugins/primevue/theme/extend/extend.d.ts +0 -5
  67. package/types/plugins/primevue/theme/extend/spacings/spacings.d.ts +0 -13
@@ -0,0 +1,29 @@
1
+ const g = /(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:(?:\?hash=|\?h=|\/)(.*))?/, c = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2
+ function b(n) {
3
+ const o = n.match(g);
4
+ return { videoId: o == null ? void 0 : o[1], hash: o == null ? void 0 : o[2] };
5
+ }
6
+ async function w(n, o, r) {
7
+ if (c.has(n)) return c.get(n);
8
+ if (i.has(n)) return i.get(n);
9
+ let t = `https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${n}`;
10
+ r && (t = t.concat(`?h=${r}`));
11
+ const s = window.fetch(t, {
12
+ mode: "cors",
13
+ signal: o.signal
14
+ }).then((e) => e.json()).then((e) => {
15
+ var l, p;
16
+ const u = /vimeocdn.com\/video\/(.*)?_/, h = (p = (l = e == null ? void 0 : e.thumbnail_url) == null ? void 0 : l.match(u)) == null ? void 0 : p[1], f = h ? `https://i.vimeocdn.com/video/${h}_1920x1080.webp` : "", m = {
17
+ title: (e == null ? void 0 : e.title) ?? "",
18
+ duration: (e == null ? void 0 : e.duration) ?? 0,
19
+ poster: f,
20
+ pro: e.account_type !== "basic"
21
+ };
22
+ return c.set(n, m), m;
23
+ }).finally(() => i.delete(n));
24
+ return i.set(n, s), s;
25
+ }
26
+ export {
27
+ w as getVimeoVideoInfo,
28
+ b as resolveVimeoVideoId
29
+ };
@@ -0,0 +1,181 @@
1
+ var $ = Object.defineProperty;
2
+ var b = (i) => {
3
+ throw TypeError(i);
4
+ };
5
+ var N = (i, t, e) => t in i ? $(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
6
+ var m = (i, t, e) => N(i, typeof t != "symbol" ? t + "" : t, e), E = (i, t, e) => t.has(i) || b("Cannot " + e);
7
+ var s = (i, t, e) => (E(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ? b("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), c = (i, t, e, n) => (E(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e), p = (i, t, e) => (E(i, t, "access private method"), e);
8
+ import { s as U, u as V, v as A, w as q, x as C, l as F, D as Y, E as _, T as j, g as v } from "./install-Cvn-xDmg.js";
9
+ import { H as z, a as B } from "./vidstack-Bq6c3Bam-S5OrhBq2.js";
10
+ var P, f, k, D, H;
11
+ class G {
12
+ constructor(t, e) {
13
+ r(this, k);
14
+ r(this, P);
15
+ r(this, f);
16
+ c(this, P, t), c(this, f, e), t.textTracks.onaddtrack = p(this, k, D).bind(this), C(p(this, k, H).bind(this));
17
+ }
18
+ }
19
+ P = new WeakMap(), f = new WeakMap(), k = new WeakSet(), D = function(t) {
20
+ const e = t.track;
21
+ if (!e || J(s(this, P), e)) return;
22
+ const n = new j({
23
+ id: e.id,
24
+ kind: e.kind,
25
+ label: e.label ?? "",
26
+ language: e.language,
27
+ type: "vtt"
28
+ });
29
+ n[v.native] = { track: e }, n[v.readyState] = 2, n[v.nativeHLS] = !0;
30
+ let a = 0;
31
+ const I = (O) => {
32
+ if (e.cues)
33
+ for (let w = a; w < e.cues.length; w++)
34
+ n.addCue(e.cues[w], O), a++;
35
+ };
36
+ I(t), e.oncuechange = I, s(this, f).textTracks.add(n, t), n.setMode(e.mode, t);
37
+ }, H = function() {
38
+ var t;
39
+ s(this, P).textTracks.onaddtrack = null;
40
+ for (const e of s(this, f).textTracks) {
41
+ const n = (t = e[v.native]) == null ? void 0 : t.track;
42
+ n != null && n.oncuechange && (n.oncuechange = null);
43
+ }
44
+ };
45
+ function J(i, t) {
46
+ return Array.from(i.children).find((e) => e.track === t);
47
+ }
48
+ var d, y, x, S, L, T;
49
+ class K {
50
+ constructor(t, e) {
51
+ r(this, x);
52
+ r(this, d);
53
+ r(this, y);
54
+ r(this, T, (t, e) => {
55
+ s(this, y).notify("picture-in-picture-change", t, e);
56
+ });
57
+ c(this, d, t), c(this, y, e), new _(t).add("enterpictureinpicture", p(this, x, S).bind(this)).add("leavepictureinpicture", p(this, x, L).bind(this));
58
+ }
59
+ get active() {
60
+ return document.pictureInPictureElement === s(this, d);
61
+ }
62
+ get supported() {
63
+ return A(s(this, d));
64
+ }
65
+ async enter() {
66
+ return s(this, d).requestPictureInPicture();
67
+ }
68
+ exit() {
69
+ return document.exitPictureInPicture();
70
+ }
71
+ }
72
+ d = new WeakMap(), y = new WeakMap(), x = new WeakSet(), S = function(t) {
73
+ s(this, T).call(this, !0, t);
74
+ }, L = function(t) {
75
+ s(this, T).call(this, !1, t);
76
+ }, T = new WeakMap();
77
+ var l, g, o, M, R;
78
+ class Q {
79
+ constructor(t, e) {
80
+ r(this, M);
81
+ r(this, l);
82
+ r(this, g);
83
+ r(this, o, "inline");
84
+ c(this, l, t), c(this, g, e), F(t, "webkitpresentationmodechanged", p(this, M, R).bind(this));
85
+ }
86
+ get mode() {
87
+ return s(this, o);
88
+ }
89
+ get supported() {
90
+ return V(s(this, l));
91
+ }
92
+ async setPresentationMode(t) {
93
+ s(this, o) !== t && s(this, l).webkitSetPresentationMode(t);
94
+ }
95
+ }
96
+ l = new WeakMap(), g = new WeakMap(), o = new WeakMap(), M = new WeakSet(), R = function(t) {
97
+ var n;
98
+ const e = s(this, o);
99
+ c(this, o, s(this, l).webkitPresentationMode), (n = s(this, g).player) == null || n.dispatch(
100
+ new Y("video-presentation-change", {
101
+ detail: s(this, o),
102
+ trigger: t
103
+ })
104
+ ), ["fullscreen", "picture-in-picture"].forEach((a) => {
105
+ (s(this, o) === a || e === a) && s(this, g).notify(`${a}-change`, s(this, o) === a, t);
106
+ });
107
+ };
108
+ var u;
109
+ class W {
110
+ constructor(t) {
111
+ r(this, u);
112
+ c(this, u, t);
113
+ }
114
+ get active() {
115
+ return s(this, u).mode === "fullscreen";
116
+ }
117
+ get supported() {
118
+ return s(this, u).supported;
119
+ }
120
+ async enter() {
121
+ s(this, u).setPresentationMode("fullscreen");
122
+ }
123
+ async exit() {
124
+ s(this, u).setPresentationMode("inline");
125
+ }
126
+ }
127
+ u = new WeakMap();
128
+ var h;
129
+ class X {
130
+ constructor(t) {
131
+ r(this, h);
132
+ c(this, h, t);
133
+ }
134
+ get active() {
135
+ return s(this, h).mode === "picture-in-picture";
136
+ }
137
+ get supported() {
138
+ return s(this, h).supported;
139
+ }
140
+ async enter() {
141
+ s(this, h).setPresentationMode("picture-in-picture");
142
+ }
143
+ async exit() {
144
+ s(this, h).setPresentationMode("inline");
145
+ }
146
+ }
147
+ h = new WeakMap();
148
+ class it extends z {
149
+ constructor(e, n) {
150
+ super(e, n);
151
+ m(this, "$$PROVIDER_TYPE", "VIDEO");
152
+ m(this, "airPlay");
153
+ m(this, "fullscreen");
154
+ m(this, "pictureInPicture");
155
+ U(() => {
156
+ if (this.airPlay = new B(e, n), V(e)) {
157
+ const a = new Q(e, n);
158
+ this.fullscreen = new W(a), this.pictureInPicture = new X(a);
159
+ } else A(e) && (this.pictureInPicture = new K(e, n));
160
+ }, this.scope);
161
+ }
162
+ get type() {
163
+ return "video";
164
+ }
165
+ setup() {
166
+ super.setup(), q(this.video) && new G(this.video, this.ctx), this.ctx.textRenderers.attachVideo(this.video), C(() => {
167
+ this.ctx.textRenderers.attachVideo(null);
168
+ }), this.type === "video" && this.ctx.notify("provider-setup", this);
169
+ }
170
+ /**
171
+ * The native HTML `<video>` element.
172
+ *
173
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement}
174
+ */
175
+ get video() {
176
+ return this.media;
177
+ }
178
+ }
179
+ export {
180
+ it as VideoProvider
181
+ };
@@ -0,0 +1,437 @@
1
+ var ue = Object.defineProperty;
2
+ var N = (r) => {
3
+ throw TypeError(r);
4
+ };
5
+ var de = (r, c, e) => c in r ? ue(r, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[c] = e;
6
+ var b = (r, c, e) => de(r, typeof c != "symbol" ? c + "" : c, e), S = (r, c, e) => c.has(r) || N("Cannot " + e);
7
+ var t = (r, c, e) => (S(r, c, "read from private field"), e ? e.call(r) : c.get(r)), f = (r, c, e) => c.has(r) ? N("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(r) : c.set(r, e), u = (r, c, e, i) => (S(r, c, "write to private field"), i ? i.call(r, e) : c.set(r, e), e), o = (r, c, e) => (S(r, c, "access private method"), e);
8
+ import { y as fe, J as U, K as C, p as pe, e as q, d as Q, b as ye, M as _, L as R, l as be, N as ke, T as ve, Q as J } from "./install-Cvn-xDmg.js";
9
+ import { R as me } from "./vidstack-DqAw8m9J-k1JRevJl.js";
10
+ import { E as we } from "./vidstack-DDXt6fpN-D1Nzo26r.js";
11
+ import { resolveVimeoVideoId as Pe, getVimeoVideoInfo as Te } from "./vidstack-krOAtKMi-B4IZWKdc.js";
12
+ const Ce = [
13
+ "bufferend",
14
+ "bufferstart",
15
+ // 'cuechange',
16
+ "durationchange",
17
+ "ended",
18
+ "enterpictureinpicture",
19
+ "error",
20
+ "fullscreenchange",
21
+ "leavepictureinpicture",
22
+ "loaded",
23
+ // 'loadeddata',
24
+ // 'loadedmetadata',
25
+ // 'loadstart',
26
+ "playProgress",
27
+ "loadProgress",
28
+ "pause",
29
+ "play",
30
+ "playbackratechange",
31
+ // 'progress',
32
+ "qualitychange",
33
+ "seeked",
34
+ "seeking",
35
+ // 'texttrackchange',
36
+ "timeupdate",
37
+ "volumechange",
38
+ "waiting"
39
+ // 'adstarted',
40
+ // 'adcompleted',
41
+ // 'aderror',
42
+ // 'adskipped',
43
+ // 'adallcompleted',
44
+ // 'adclicked',
45
+ // 'chapterchange',
46
+ // 'chromecastconnected',
47
+ // 'remoteplaybackavailabilitychange',
48
+ // 'remoteplaybackconnecting',
49
+ // 'remoteplaybackconnect',
50
+ // 'remoteplaybackdisconnect',
51
+ // 'liveeventended',
52
+ // 'liveeventstarted',
53
+ // 'livestreamoffline',
54
+ // 'livestreamonline',
55
+ ];
56
+ var a, y, k, w, g, V, v, $, M, P, m, E, s, K, W, Y, z, T, G, H, X, L, Z, ee, te, se, ie, x, ne, ae, oe, F, he, O, re, D, ce, le, l, j, B;
57
+ class Re extends we {
58
+ constructor(e, i) {
59
+ super(e);
60
+ f(this, s);
61
+ b(this, "$$PROVIDER_TYPE", "VIMEO");
62
+ b(this, "scope", fe());
63
+ b(this, "fullscreen");
64
+ f(this, a);
65
+ f(this, y, U(""));
66
+ f(this, k, U(!1));
67
+ f(this, w, null);
68
+ f(this, g, null);
69
+ f(this, V, !1);
70
+ f(this, v, new C(0, 0));
71
+ f(this, $, new me(o(this, s, z).bind(this)));
72
+ f(this, M, null);
73
+ f(this, P, null);
74
+ f(this, m, /* @__PURE__ */ new Map());
75
+ f(this, E, null);
76
+ /**
77
+ * Whether tracking session data should be enabled on the embed, including cookies and analytics.
78
+ * This is turned off by default to be GDPR-compliant.
79
+ *
80
+ * @defaultValue `false`
81
+ */
82
+ b(this, "cookies", !1);
83
+ b(this, "title", !0);
84
+ b(this, "byline", !0);
85
+ b(this, "portrait", !0);
86
+ b(this, "color", "00ADEF");
87
+ // Embed will sometimes dispatch 0 at end of playback.
88
+ f(this, T, !1);
89
+ u(this, a, i);
90
+ const n = this;
91
+ this.fullscreen = {
92
+ get active() {
93
+ return t(n, V);
94
+ },
95
+ supported: !0,
96
+ enter: () => o(this, s, l).call(this, "requestFullscreen"),
97
+ exit: () => o(this, s, l).call(this, "exitFullscreen")
98
+ };
99
+ }
100
+ get type() {
101
+ return "vimeo";
102
+ }
103
+ get currentSrc() {
104
+ return t(this, g);
105
+ }
106
+ get videoId() {
107
+ return t(this, y).call(this);
108
+ }
109
+ get hash() {
110
+ return t(this, w);
111
+ }
112
+ get isPro() {
113
+ return t(this, k).call(this);
114
+ }
115
+ preconnect() {
116
+ pe(this.getOrigin());
117
+ }
118
+ setup() {
119
+ super.setup(), q(o(this, s, K).bind(this)), q(o(this, s, W).bind(this)), q(o(this, s, Y).bind(this)), t(this, a).notify("provider-setup", this);
120
+ }
121
+ destroy() {
122
+ o(this, s, j).call(this), this.fullscreen = void 0;
123
+ const e = "provider destroyed";
124
+ for (const i of t(this, m).values())
125
+ for (const { reject: n } of i) n(e);
126
+ t(this, m).clear(), o(this, s, l).call(this, "destroy");
127
+ }
128
+ async play() {
129
+ return o(this, s, l).call(this, "play");
130
+ }
131
+ async pause() {
132
+ return o(this, s, l).call(this, "pause");
133
+ }
134
+ setMuted(e) {
135
+ o(this, s, l).call(this, "setMuted", e);
136
+ }
137
+ setCurrentTime(e) {
138
+ o(this, s, l).call(this, "seekTo", e), t(this, a).notify("seeking", e);
139
+ }
140
+ setVolume(e) {
141
+ o(this, s, l).call(this, "setVolume", e), o(this, s, l).call(this, "setMuted", Q(t(this, a).$state.muted));
142
+ }
143
+ setPlaybackRate(e) {
144
+ o(this, s, l).call(this, "setPlaybackRate", e);
145
+ }
146
+ async loadSource(e) {
147
+ if (!ye(e.src)) {
148
+ u(this, g, null), u(this, w, null), t(this, y).set("");
149
+ return;
150
+ }
151
+ const { videoId: i, hash: n } = Pe(e.src);
152
+ t(this, y).set(i ?? ""), u(this, w, n ?? null), u(this, g, e);
153
+ }
154
+ getOrigin() {
155
+ return "https://player.vimeo.com";
156
+ }
157
+ buildParams() {
158
+ const { keyDisabled: e } = t(this, a).$props, { playsInline: i, nativeControls: n } = t(this, a).$state, h = n();
159
+ return {
160
+ title: this.title,
161
+ byline: this.byline,
162
+ color: this.color,
163
+ portrait: this.portrait,
164
+ controls: h,
165
+ h: this.hash,
166
+ keyboard: h && !e(),
167
+ transparent: !0,
168
+ playsinline: i(),
169
+ dnt: !this.cookies
170
+ };
171
+ }
172
+ onMessage(e, i) {
173
+ e.event ? o(this, s, ce).call(this, e.event, e.data, i) : e.method && o(this, s, Z).call(this, e.method, e.value, i);
174
+ }
175
+ onLoad() {
176
+ }
177
+ }
178
+ a = new WeakMap(), y = new WeakMap(), k = new WeakMap(), w = new WeakMap(), g = new WeakMap(), V = new WeakMap(), v = new WeakMap(), $ = new WeakMap(), M = new WeakMap(), P = new WeakMap(), m = new WeakMap(), E = new WeakMap(), s = new WeakSet(), K = function() {
179
+ o(this, s, j).call(this);
180
+ const e = t(this, y).call(this);
181
+ if (!e) {
182
+ this.src.set("");
183
+ return;
184
+ }
185
+ this.src.set(`${this.getOrigin()}/video/${e}`), t(this, a).notify("load-start");
186
+ }, W = function() {
187
+ const e = t(this, y).call(this);
188
+ if (!e) return;
189
+ const i = _(), n = new AbortController();
190
+ return u(this, E, i), Te(e, n, t(this, w)).then((h) => {
191
+ i.resolve(h);
192
+ }).catch((h) => {
193
+ i.reject();
194
+ }), () => {
195
+ i.reject(), n.abort();
196
+ };
197
+ }, Y = function() {
198
+ const e = t(this, k).call(this), { $state: i, qualities: n } = t(this, a);
199
+ if (i.canSetPlaybackRate.set(e), n[R.setReadonly](!e), e)
200
+ return be(n, "change", () => {
201
+ var d;
202
+ if (n.auto) return;
203
+ const h = (d = n.selected) == null ? void 0 : d.id;
204
+ h && o(this, s, l).call(this, "setQuality", h);
205
+ });
206
+ }, z = function() {
207
+ o(this, s, l).call(this, "getCurrentTime");
208
+ }, T = new WeakMap(), G = function(e, i) {
209
+ if (t(this, T) && e === 0) return;
210
+ const { realCurrentTime: n, paused: h, bufferedEnd: d, seekableEnd: p, live: I } = t(this, a).$state;
211
+ if (n() === e) return;
212
+ const A = n();
213
+ t(this, a).notify("time-change", e, i), Math.abs(A - e) > 1.5 && (t(this, a).notify("seeking", e, i), !h() && d() < e && t(this, a).notify("waiting", void 0, i)), !I() && p() - e < 0.01 && (t(this, a).notify("end", void 0, i), u(this, T, !0), setTimeout(() => {
214
+ u(this, T, !1);
215
+ }, 500));
216
+ }, H = function(e, i) {
217
+ t(this, a).notify("seeked", e, i);
218
+ }, X = function(e) {
219
+ var n;
220
+ const i = t(this, y).call(this);
221
+ (n = t(this, E)) == null || n.promise.then((h) => {
222
+ if (!h) return;
223
+ const { title: d, poster: p, duration: I, pro: A } = h;
224
+ t(this, k).set(A), t(this, a).notify("title-change", d, e), t(this, a).notify("poster-change", p, e), t(this, a).notify("duration-change", I, e), o(this, s, L).call(this, I, e);
225
+ }).catch(() => {
226
+ i === t(this, y).call(this) && (o(this, s, l).call(this, "getVideoTitle"), o(this, s, l).call(this, "getDuration"));
227
+ });
228
+ }, L = function(e, i) {
229
+ const { nativeControls: n } = t(this, a).$state, h = n();
230
+ u(this, v, new C(0, e));
231
+ const d = {
232
+ buffered: new C(0, 0),
233
+ seekable: t(this, v),
234
+ duration: e
235
+ };
236
+ t(this, a).delegate.ready(d, i), h || o(this, s, l).call(this, "_hideOverlay"), o(this, s, l).call(this, "getQualities"), o(this, s, l).call(this, "getChapters");
237
+ }, Z = function(e, i, n) {
238
+ var h;
239
+ switch (e) {
240
+ case "getVideoTitle":
241
+ const d = i;
242
+ t(this, a).notify("title-change", d, n);
243
+ break;
244
+ case "getDuration":
245
+ const p = i;
246
+ t(this, a).$state.canPlay() ? t(this, a).notify("duration-change", p, n) : o(this, s, L).call(this, p, n);
247
+ break;
248
+ case "getCurrentTime":
249
+ o(this, s, G).call(this, i, n);
250
+ break;
251
+ case "getBuffered":
252
+ ke(i) && i.length && o(this, s, x).call(this, i[i.length - 1][1], n);
253
+ break;
254
+ case "setMuted":
255
+ o(this, s, F).call(this, Q(t(this, a).$state.volume), i, n);
256
+ break;
257
+ // case 'getTextTracks':
258
+ // this.#onTextTracksChange(data as VimeoTextTrack[], trigger);
259
+ // break;
260
+ case "getChapters":
261
+ o(this, s, he).call(this, i);
262
+ break;
263
+ case "getQualities":
264
+ o(this, s, re).call(this, i, n);
265
+ break;
266
+ }
267
+ (h = o(this, s, B).call(this, e)) == null || h.resolve();
268
+ }, ee = function() {
269
+ for (const e of Ce)
270
+ o(this, s, l).call(this, "addEventListener", e);
271
+ }, te = function(e) {
272
+ t(this, $).stop(), t(this, a).notify("pause", void 0, e);
273
+ }, se = function(e) {
274
+ t(this, $).start(), t(this, a).notify("play", void 0, e);
275
+ }, ie = function(e) {
276
+ const { paused: i } = t(this, a).$state;
277
+ !i() && !t(this, T) && t(this, a).notify("playing", void 0, e);
278
+ }, x = function(e, i) {
279
+ const n = {
280
+ buffered: new C(0, e),
281
+ seekable: t(this, v)
282
+ };
283
+ t(this, a).notify("progress", n, i);
284
+ }, ne = function(e) {
285
+ t(this, a).notify("waiting", void 0, e);
286
+ }, ae = function(e) {
287
+ const { paused: i } = t(this, a).$state;
288
+ i() || t(this, a).notify("playing", void 0, e);
289
+ }, oe = function(e) {
290
+ const { paused: i } = t(this, a).$state;
291
+ i() && t(this, a).notify("play", void 0, e), t(this, a).notify("waiting", void 0, e);
292
+ }, F = function(e, i, n) {
293
+ const h = { volume: e, muted: i };
294
+ t(this, a).notify("volume-change", h, n);
295
+ }, // #onTextTrackChange(track: VimeoTextTrack, trigger: Event) {
296
+ // const textTrack = this.#ctx.textTracks.toArray().find((t) => t.language === track.language);
297
+ // if (textTrack) textTrack.mode = track.mode;
298
+ // }
299
+ // #onTextTracksChange(tracks: VimeoTextTrack[], trigger: Event) {
300
+ // for (const init of tracks) {
301
+ // const textTrack = new TextTrack({
302
+ // ...init,
303
+ // label: init.label.replace('auto-generated', 'auto'),
304
+ // });
305
+ // textTrack[TextTrackSymbol.readyState] = 2;
306
+ // this.#ctx.textTracks.add(textTrack, trigger);
307
+ // textTrack.setMode(init.mode, trigger);
308
+ // }
309
+ // }
310
+ // #onCueChange(cue: VimeoTextCue, trigger: Event) {
311
+ // const { textTracks, $state } = this.#ctx,
312
+ // { currentTime } = $state,
313
+ // track = textTracks.selected;
314
+ // if (this.#currentCue) track?.removeCue(this.#currentCue, trigger);
315
+ // this.#currentCue = new window.VTTCue(currentTime(), Number.MAX_SAFE_INTEGER, cue.text);
316
+ // track?.addCue(this.#currentCue, trigger);
317
+ // }
318
+ he = function(e) {
319
+ if (o(this, s, O).call(this), !e.length) return;
320
+ const i = new ve({
321
+ kind: "chapters",
322
+ default: !0
323
+ }), { seekableEnd: n } = t(this, a).$state;
324
+ for (let h = 0; h < e.length; h++) {
325
+ const d = e[h], p = e[h + 1];
326
+ i.addCue(
327
+ new window.VTTCue(
328
+ d.startTime,
329
+ (p == null ? void 0 : p.startTime) ?? n(),
330
+ d.title
331
+ )
332
+ );
333
+ }
334
+ u(this, P, i), t(this, a).textTracks.add(i);
335
+ }, O = function() {
336
+ t(this, P) && (t(this, a).textTracks.remove(t(this, P)), u(this, P, null));
337
+ }, re = function(e, i) {
338
+ t(this, a).qualities[J.enableAuto] = e.some((n) => n.id === "auto") ? () => o(this, s, l).call(this, "setQuality", "auto") : void 0;
339
+ for (const n of e) {
340
+ if (n.id === "auto") continue;
341
+ const h = +n.id.slice(0, -1);
342
+ isNaN(h) || t(this, a).qualities[R.add](
343
+ {
344
+ id: n.id,
345
+ width: h * (16 / 9),
346
+ height: h,
347
+ codec: "avc1,h.264",
348
+ bitrate: -1
349
+ },
350
+ i
351
+ );
352
+ }
353
+ o(this, s, D).call(this, e.find((n) => n.active), i);
354
+ }, D = function({ id: e } = {}, i) {
355
+ if (!e) return;
356
+ const n = e === "auto", h = t(this, a).qualities.getById(e);
357
+ n ? (t(this, a).qualities[J.setAuto](n, i), t(this, a).qualities[R.select](void 0, !0, i)) : t(this, a).qualities[R.select](h ?? void 0, !0, i);
358
+ }, ce = function(e, i, n) {
359
+ switch (e) {
360
+ case "ready":
361
+ o(this, s, ee).call(this);
362
+ break;
363
+ case "loaded":
364
+ o(this, s, X).call(this, n);
365
+ break;
366
+ case "play":
367
+ o(this, s, se).call(this, n);
368
+ break;
369
+ case "playProgress":
370
+ o(this, s, ie).call(this, n);
371
+ break;
372
+ case "pause":
373
+ o(this, s, te).call(this, n);
374
+ break;
375
+ case "loadProgress":
376
+ o(this, s, x).call(this, i.seconds, n);
377
+ break;
378
+ case "waiting":
379
+ o(this, s, oe).call(this, n);
380
+ break;
381
+ case "bufferstart":
382
+ o(this, s, ne).call(this, n);
383
+ break;
384
+ case "bufferend":
385
+ o(this, s, ae).call(this, n);
386
+ break;
387
+ case "volumechange":
388
+ o(this, s, F).call(this, i.volume, Q(t(this, a).$state.muted), n);
389
+ break;
390
+ case "durationchange":
391
+ u(this, v, new C(0, i.duration)), t(this, a).notify("duration-change", i.duration, n);
392
+ break;
393
+ case "playbackratechange":
394
+ t(this, a).notify("rate-change", i.playbackRate, n);
395
+ break;
396
+ case "qualitychange":
397
+ o(this, s, D).call(this, i, n);
398
+ break;
399
+ case "fullscreenchange":
400
+ u(this, V, i.fullscreen), t(this, a).notify("fullscreen-change", i.fullscreen, n);
401
+ break;
402
+ case "enterpictureinpicture":
403
+ t(this, a).notify("picture-in-picture-change", !0, n);
404
+ break;
405
+ case "leavepictureinpicture":
406
+ t(this, a).notify("picture-in-picture-change", !1, n);
407
+ break;
408
+ case "ended":
409
+ t(this, a).notify("end", void 0, n);
410
+ break;
411
+ case "error":
412
+ o(this, s, le).call(this, i, n);
413
+ break;
414
+ case "seek":
415
+ case "seeked":
416
+ o(this, s, H).call(this, i.seconds, n);
417
+ break;
418
+ }
419
+ }, le = function(e, i) {
420
+ var d;
421
+ const { message: n, method: h } = e;
422
+ h === "setPlaybackRate" && t(this, k).set(!1), h && ((d = o(this, s, B).call(this, h)) == null || d.reject(n));
423
+ }, l = async function(e, i) {
424
+ let n = _(), h = t(this, m).get(e);
425
+ return h || t(this, m).set(e, h = []), h.push(n), this.postMessage({
426
+ method: e,
427
+ value: i
428
+ }), n.promise;
429
+ }, j = function() {
430
+ t(this, $).stop(), u(this, v, new C(0, 0)), u(this, E, null), u(this, M, null), t(this, k).set(!1), o(this, s, O).call(this);
431
+ }, B = function(e) {
432
+ var i;
433
+ return (i = t(this, m).get(e)) == null ? void 0 : i.shift();
434
+ };
435
+ export {
436
+ Re as VimeoProvider
437
+ };