@webitel/ui-sdk 26.2.70 → 26.2.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{errors-DCJKAXTz.js → errors-CTL-RV3B.js} +1 -1
- package/dist/{index-B71drQtj.js → index-DWA4o3XJ.js} +4 -4
- package/dist/{index-cVwBpL1P.js → index-pMfSnCae.js} +1 -1
- package/dist/{install-BEn6vjFW.js → install-UIKG1ERr.js} +9496 -8874
- package/dist/{isObject-DB0eH0MA.js → isObject-B3V85Sws.js} +1 -1
- package/dist/prod-BoQuiIB3.js +973 -0
- package/dist/srt-parser-CsN7bp5E.js +26 -0
- package/dist/ssa-parser-BJOOPeQF.js +200 -0
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +1 -1
- package/dist/ui-sdk.umd.cjs +464 -482
- package/dist/vidstack-Bq6c3Bam-pb8Xltql.js +425 -0
- package/dist/vidstack-D2pY00kU-DiDeMWBZ.js +135 -0
- package/dist/vidstack-DDXt6fpN-BJpO5v6W.js +50 -0
- package/dist/vidstack-D_-9AA6_-D9IZ6RtF.js +20 -0
- package/dist/{vidstack-Dm1xEU9Q-qSXq3AI-.js → vidstack-Dm1xEU9Q-CXHNvShT.js} +10 -11
- package/dist/vidstack-DqAw8m9J-R8izgrMK.js +22 -0
- package/dist/vidstack-audio-RReC5vyt.js +28 -0
- package/dist/vidstack-dash-DW7Ue8Mf.js +392 -0
- package/dist/vidstack-google-cast-C0U2wzqB.js +382 -0
- package/dist/vidstack-hls-BZgfDsGk.js +309 -0
- package/dist/vidstack-krOAtKMi-C50BTxmn.js +28 -0
- package/dist/vidstack-video-CI2rq89j.js +163 -0
- package/dist/vidstack-vimeo-CgwZpCSk.js +451 -0
- package/dist/vidstack-youtube-BYXk8CK9.js +232 -0
- package/dist/{wt-action-bar-ColV1kXE.js → wt-action-bar-DR8FqGoN.js} +1 -1
- package/dist/{wt-button-select-CfoSEYMj.js → wt-button-select-DZ_mMZr7.js} +1 -1
- package/dist/{wt-chat-emoji-Bgv9Viz-.js → wt-chat-emoji-Bx7YenHF.js} +6 -11
- package/dist/{wt-confirm-dialog-bVhuyR-Q.js → wt-confirm-dialog-Bmt7hVhO.js} +1 -1
- package/dist/{wt-context-menu-Cd8pgBRV.js → wt-context-menu-DEonPBI7.js} +1 -1
- package/dist/{wt-copy-action-jjp1mO2h.js → wt-copy-action-DQZ5qUUm.js} +1 -1
- package/dist/wt-datepicker-DRUiK--W.js +5660 -0
- package/dist/wt-display-chip-items-x25aFJxY.js +46 -0
- package/dist/{wt-dual-panel-DJsiR6RF.js → wt-dual-panel-0fDOCrlS.js} +1 -1
- package/dist/{wt-dummy-O94iGdZS.js → wt-dummy-CFcLvVwn.js} +1 -1
- package/dist/{wt-error-page-xgSWJ65z.js → wt-error-page-CebFt3Gg.js} +1 -1
- package/dist/{wt-expansion-panel-vzG02b62.js → wt-expansion-panel-cJWQaqAc.js} +1 -1
- package/dist/{wt-filters-panel-wrapper-h-UaAMuF.js → wt-filters-panel-wrapper-4-k7czbS.js} +1 -1
- package/dist/wt-galleria-Ds-HZvJq.js +322 -0
- package/dist/{wt-navigation-menu-Cu5Y9kua.js → wt-navigation-menu-DqnvQB3G.js} +2 -5
- package/dist/wt-notifications-bar-Bmww4vJb.js +79 -0
- package/dist/{wt-page-header-DlRrRzG7.js → wt-page-header-6lJKDnEs.js} +1 -1
- package/dist/{wt-pagination-CW46I4u2.js → wt-pagination-D7BhUkrI.js} +1 -1
- package/dist/{wt-player-3qh_Jzm2.js → wt-player-Bx_9-9R6.js} +1 -1
- package/dist/{wt-popover-BTG5bUP0.js → wt-popover-U7JE0uoX.js} +19 -22
- package/dist/{wt-search-bar-CTsNf7bp.js → wt-search-bar-BfHsofcU.js} +25 -28
- package/dist/{wt-selection-popup-DvaUvY4O.js → wt-selection-popup-B5Wt1WQk.js} +1 -1
- package/dist/{wt-start-page-CcN7JC_u.js → wt-start-page-8ywFCoUJ.js} +7 -7
- package/dist/{wt-status-select-C8t0cgTg.js → wt-status-select-CFdNgbIP.js} +1 -1
- package/dist/{wt-stepper-BLb42q2I.js → wt-stepper-59a_rP7o.js} +1 -1
- package/dist/{wt-table-9gmsV0Y9.js → wt-table-DuxjiiFi.js} +111 -114
- package/dist/{wt-table-actions-BB7AH7sR.js → wt-table-actions-CsrvF6d8.js} +1 -1
- package/dist/{wt-table-column-select-B3lrCEaV.js → wt-table-column-select-Zga4Zyfd.js} +28 -31
- package/dist/{wt-tabs-CCHi_E1a.js → wt-tabs-CMMlNgqE.js} +1 -1
- package/dist/{wt-tags-input-DLicKjv3.js → wt-tags-input-O1wer3-w.js} +56 -57
- package/dist/{wt-timepicker-B9ONDzNQ.js → wt-timepicker-BscP21YM.js} +1 -1
- package/dist/{wt-tree-cQlvJmh5.js → wt-tree-BRPd5QbE.js} +4 -5
- package/dist/{wt-tree-table-B89YKiMf.js → wt-tree-table-CZQ7xmja.js} +5 -5
- package/dist/{wt-type-extension-value-input-Da8FXLDs.js → wt-type-extension-value-input-DZqeSLGx.js} +214 -218
- package/dist/wt-vidstack-player-CA18U-L9.js +10229 -0
- package/package.json +5 -5
- package/src/components/wt-button/wt-button.vue +9 -13
- package/src/install.ts +0 -1
- package/src/locale/i18n.js +1 -1
- package/src/modules/Notifications/store/NotificationsStoreModule.js +1 -1
- package/src/modules/Userinfo/classes/ApplicationsAccess.ts +36 -3
- package/src/modules/Userinfo/scripts/utils.ts +2 -22
- package/src/modules/Userinfo/stores/accessStore.ts +20 -5
- package/src/modules/Userinfo/types/UserAccess.d.ts +11 -3
- package/types/locale/i18n.d.ts +1 -1
- package/types/modules/Notifications/store/NotificationsStoreModule.d.ts +1 -1
- package/types/modules/Userinfo/classes/ApplicationsAccess.d.ts +34 -243
- package/types/modules/Userinfo/scripts/utils.d.ts +1 -2
- package/types/modules/Userinfo/stores/accessStore.d.ts +1 -1
- package/types/modules/Userinfo/stores/userinfoStore.d.ts +21 -9
- package/dist/prod-DTLJXtPo.js +0 -994
- package/dist/srt-parser-CWqahKwO.js +0 -27
- package/dist/ssa-parser-BqjjKy4M.js +0 -209
- package/dist/vidstack-Bq6c3Bam-w5y-QQDX.js +0 -413
- package/dist/vidstack-D2pY00kU-BI5rYx7p.js +0 -138
- package/dist/vidstack-DDXt6fpN-QZPrP2dy.js +0 -60
- package/dist/vidstack-D_-9AA6_-Bo1xPN-G.js +0 -20
- package/dist/vidstack-DqAw8m9J-DL7LzrFt.js +0 -29
- package/dist/vidstack-audio-lX1O0fza.js +0 -32
- package/dist/vidstack-dash-BQkRGWe_.js +0 -403
- package/dist/vidstack-google-cast-C39n-PU1.js +0 -377
- package/dist/vidstack-hls-BCLhCuNJ.js +0 -324
- package/dist/vidstack-krOAtKMi-B4IZWKdc.js +0 -29
- package/dist/vidstack-video-BgayrEIC.js +0 -181
- package/dist/vidstack-vimeo-Lpe7iySs.js +0 -437
- package/dist/vidstack-youtube-Dmcz0xVm.js +0 -236
- package/dist/vuex.esm-bundler-tZVctzTj.js +0 -950
- package/dist/wt-datepicker-Cs3xDzVq.js +0 -5789
- package/dist/wt-display-chip-items-IqNMxa_X.js +0 -52
- package/dist/wt-galleria-cDjsiOcp.js +0 -324
- package/dist/wt-notifications-bar-KNH47kZ7.js +0 -80
- package/dist/wt-vidstack-player-BzFbIwCa.js +0 -10250
|
@@ -0,0 +1,973 @@
|
|
|
1
|
+
const J = {
|
|
2
|
+
LoadFail: 0,
|
|
3
|
+
BadSignature: 1,
|
|
4
|
+
BadTimestamp: 2,
|
|
5
|
+
BadSettingValue: 3,
|
|
6
|
+
BadFormat: 4,
|
|
7
|
+
UnknownSetting: 5
|
|
8
|
+
};
|
|
9
|
+
class Q extends Error {
|
|
10
|
+
code;
|
|
11
|
+
line;
|
|
12
|
+
constructor(t) {
|
|
13
|
+
super(t.reason), this.code = t.code, this.line = t.line;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const B = /\r?\n|\r/gm;
|
|
17
|
+
class Z {
|
|
18
|
+
writable;
|
|
19
|
+
readable;
|
|
20
|
+
constructor(t) {
|
|
21
|
+
const e = new U(t);
|
|
22
|
+
this.writable = new WritableStream({
|
|
23
|
+
write(s) {
|
|
24
|
+
e.transform(s);
|
|
25
|
+
},
|
|
26
|
+
close() {
|
|
27
|
+
e.close();
|
|
28
|
+
}
|
|
29
|
+
}), this.readable = new ReadableStream({
|
|
30
|
+
start(s) {
|
|
31
|
+
e.onLine = (a) => s.enqueue(a), e.onClose = () => s.close();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class U {
|
|
37
|
+
a = "";
|
|
38
|
+
b;
|
|
39
|
+
onLine;
|
|
40
|
+
onClose;
|
|
41
|
+
constructor(t) {
|
|
42
|
+
this.b = new TextDecoder(t);
|
|
43
|
+
}
|
|
44
|
+
transform(t) {
|
|
45
|
+
this.a += this.b.decode(t, { stream: !0 });
|
|
46
|
+
const e = this.a.split(B);
|
|
47
|
+
this.a = e.pop() || "";
|
|
48
|
+
for (let s = 0; s < e.length; s++)
|
|
49
|
+
this.onLine(e[s].trim());
|
|
50
|
+
}
|
|
51
|
+
close() {
|
|
52
|
+
this.a && this.onLine(this.a.trim()), this.a = "", this.onClose();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function tt(i, t) {
|
|
56
|
+
const e = new ReadableStream({
|
|
57
|
+
start(s) {
|
|
58
|
+
const a = i.split(B);
|
|
59
|
+
for (const r of a)
|
|
60
|
+
s.enqueue(r);
|
|
61
|
+
s.close();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return N(e, t);
|
|
65
|
+
}
|
|
66
|
+
async function N(i, t) {
|
|
67
|
+
const e = t?.type ?? "vtt";
|
|
68
|
+
let s;
|
|
69
|
+
if (typeof e == "string")
|
|
70
|
+
switch (e) {
|
|
71
|
+
case "srt":
|
|
72
|
+
s = (await import("./srt-parser-CsN7bp5E.js")).default;
|
|
73
|
+
break;
|
|
74
|
+
case "ssa":
|
|
75
|
+
case "ass":
|
|
76
|
+
s = (await import("./ssa-parser-BJOOPeQF.js")).default;
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
s = (await Promise.resolve().then(function() {
|
|
80
|
+
return vt;
|
|
81
|
+
})).default;
|
|
82
|
+
}
|
|
83
|
+
else
|
|
84
|
+
s = e;
|
|
85
|
+
let a;
|
|
86
|
+
const r = i.getReader(), n = s(), o = !!t?.strict || !!t?.errors;
|
|
87
|
+
await n.init({
|
|
88
|
+
strict: !1,
|
|
89
|
+
...t,
|
|
90
|
+
errors: o,
|
|
91
|
+
type: e,
|
|
92
|
+
cancel() {
|
|
93
|
+
r.cancel(), a = n.done(!0);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
let l = 1;
|
|
97
|
+
for (; ; ) {
|
|
98
|
+
const { value: h, done: c } = await r.read();
|
|
99
|
+
if (c) {
|
|
100
|
+
n.parse("", l), a = n.done(!1);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
n.parse(h, l), l++;
|
|
104
|
+
}
|
|
105
|
+
return a;
|
|
106
|
+
}
|
|
107
|
+
async function et(i, t) {
|
|
108
|
+
const e = await i;
|
|
109
|
+
if (!e.ok || !e.body)
|
|
110
|
+
return {
|
|
111
|
+
metadata: {},
|
|
112
|
+
cues: [],
|
|
113
|
+
regions: [],
|
|
114
|
+
errors: [void 0]
|
|
115
|
+
};
|
|
116
|
+
const s = e.headers.get("content-type") || "", a = s.match(/text\/(.*?)(?:;|$)/)?.[1], r = s.match(/charset=(.*?)(?:;|$)/)?.[1];
|
|
117
|
+
return z(e.body, { type: a, encoding: r, ...t });
|
|
118
|
+
}
|
|
119
|
+
async function z(i, { encoding: t = "utf-8", ...e } = {}) {
|
|
120
|
+
const s = i.pipeThrough(new Z(t));
|
|
121
|
+
return N(s, e);
|
|
122
|
+
}
|
|
123
|
+
class $ extends EventTarget {
|
|
124
|
+
/**
|
|
125
|
+
* A string that identifies the cue.
|
|
126
|
+
*
|
|
127
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/id}
|
|
128
|
+
*/
|
|
129
|
+
id = "";
|
|
130
|
+
/**
|
|
131
|
+
* A `double` that represents the video time that the cue will start being displayed, in seconds.
|
|
132
|
+
*
|
|
133
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/startTime}
|
|
134
|
+
*/
|
|
135
|
+
startTime;
|
|
136
|
+
/**
|
|
137
|
+
* A `double` that represents the video time that the cue will stop being displayed, in seconds.
|
|
138
|
+
*
|
|
139
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/endTime}
|
|
140
|
+
*/
|
|
141
|
+
endTime;
|
|
142
|
+
/**
|
|
143
|
+
* Returns a string with the contents of the cue.
|
|
144
|
+
*
|
|
145
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/text}
|
|
146
|
+
*/
|
|
147
|
+
text;
|
|
148
|
+
/**
|
|
149
|
+
* A `boolean` for whether the video will pause when this cue stops being displayed.
|
|
150
|
+
*
|
|
151
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/pauseOnExit}
|
|
152
|
+
*/
|
|
153
|
+
pauseOnExit = !1;
|
|
154
|
+
constructor(t, e, s) {
|
|
155
|
+
super(), this.startTime = t, this.endTime = e, this.text = s;
|
|
156
|
+
}
|
|
157
|
+
addEventListener(t, e, s) {
|
|
158
|
+
super.addEventListener(t, e, s);
|
|
159
|
+
}
|
|
160
|
+
removeEventListener(t, e, s) {
|
|
161
|
+
super.removeEventListener(t, e, s);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const _ = typeof document > "u", it = _ ? $ : window.VTTCue;
|
|
165
|
+
class j extends it {
|
|
166
|
+
/**
|
|
167
|
+
* A `VTTRegion` object describing the video's sub-region that the cue will be drawn onto,
|
|
168
|
+
* or `null` if none is assigned.
|
|
169
|
+
*
|
|
170
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/region}
|
|
171
|
+
*/
|
|
172
|
+
region = null;
|
|
173
|
+
/**
|
|
174
|
+
* The cue writing direction.
|
|
175
|
+
*
|
|
176
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/vertical}
|
|
177
|
+
*/
|
|
178
|
+
vertical = "";
|
|
179
|
+
/**
|
|
180
|
+
* Returns `true` if the `VTTCue.line` attribute is an integer number of lines or a percentage
|
|
181
|
+
* of the video size.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/snapToLines}
|
|
184
|
+
*/
|
|
185
|
+
snapToLines = !0;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the line positioning of the cue. This can be the string `'auto'` or a number whose
|
|
188
|
+
* interpretation depends on the value of `VTTCue.snapToLines`.
|
|
189
|
+
*
|
|
190
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/line}
|
|
191
|
+
*/
|
|
192
|
+
line = "auto";
|
|
193
|
+
/**
|
|
194
|
+
* Returns an enum representing the alignment of the `VTTCue.line`.
|
|
195
|
+
*
|
|
196
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineAlign}
|
|
197
|
+
*/
|
|
198
|
+
lineAlign = "start";
|
|
199
|
+
/**
|
|
200
|
+
* Returns the indentation of the cue within the line. This can be the string `'auto'` or a
|
|
201
|
+
* number representing the percentage of the `VTTCue.region`, or the video size if `VTTCue`.region`
|
|
202
|
+
* is `null`.
|
|
203
|
+
*
|
|
204
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/position}
|
|
205
|
+
*/
|
|
206
|
+
position = "auto";
|
|
207
|
+
/**
|
|
208
|
+
* Returns an enum representing the alignment of the cue. This is used to determine what
|
|
209
|
+
* the `VTTCue.position` is anchored to. The default is `'auto'`.
|
|
210
|
+
*
|
|
211
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionAlign}
|
|
212
|
+
*/
|
|
213
|
+
positionAlign = "auto";
|
|
214
|
+
/**
|
|
215
|
+
* Returns a double representing the size of the cue, as a percentage of the video size.
|
|
216
|
+
*
|
|
217
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/size}
|
|
218
|
+
*/
|
|
219
|
+
size = 100;
|
|
220
|
+
/**
|
|
221
|
+
* Returns an enum representing the alignment of all the lines of text within the cue box.
|
|
222
|
+
*
|
|
223
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/align}
|
|
224
|
+
*/
|
|
225
|
+
align = "center";
|
|
226
|
+
/**
|
|
227
|
+
* Additional styles associated with the cue.
|
|
228
|
+
*/
|
|
229
|
+
style;
|
|
230
|
+
}
|
|
231
|
+
class G {
|
|
232
|
+
/**
|
|
233
|
+
* A string that identifies the region.
|
|
234
|
+
*/
|
|
235
|
+
id = "";
|
|
236
|
+
/**
|
|
237
|
+
* A `double` representing the width of the region, as a percentage of the video.
|
|
238
|
+
*/
|
|
239
|
+
width = 100;
|
|
240
|
+
/**
|
|
241
|
+
* A `double` representing the height of the region, in number of lines.
|
|
242
|
+
*/
|
|
243
|
+
lines = 3;
|
|
244
|
+
/**
|
|
245
|
+
* A `double` representing the region anchor X offset, as a percentage of the region.
|
|
246
|
+
*/
|
|
247
|
+
regionAnchorX = 0;
|
|
248
|
+
/**
|
|
249
|
+
* A `double` representing the region anchor Y offset, as a percentage of the region.
|
|
250
|
+
*/
|
|
251
|
+
regionAnchorY = 100;
|
|
252
|
+
/**
|
|
253
|
+
* A `double` representing the viewport anchor X offset, as a percentage of the video.
|
|
254
|
+
*/
|
|
255
|
+
viewportAnchorX = 0;
|
|
256
|
+
/**
|
|
257
|
+
* A `double` representing the viewport anchor Y offset, as a percentage of the video.
|
|
258
|
+
*/
|
|
259
|
+
viewportAnchorY = 100;
|
|
260
|
+
/**
|
|
261
|
+
* An enum representing how adding new cues will move existing cues.
|
|
262
|
+
*/
|
|
263
|
+
scroll = "";
|
|
264
|
+
}
|
|
265
|
+
const M = ",", st = "%";
|
|
266
|
+
function rt(i) {
|
|
267
|
+
const t = parseInt(i, 10);
|
|
268
|
+
return Number.isNaN(t) ? null : t;
|
|
269
|
+
}
|
|
270
|
+
function w(i) {
|
|
271
|
+
const t = parseInt(i.replace(st, ""), 10);
|
|
272
|
+
return !Number.isNaN(t) && t >= 0 && t <= 100 ? t : null;
|
|
273
|
+
}
|
|
274
|
+
function x(i) {
|
|
275
|
+
if (!i.includes(M))
|
|
276
|
+
return null;
|
|
277
|
+
const [t, e] = i.split(M).map(w);
|
|
278
|
+
return t !== null && e !== null ? [t, e] : null;
|
|
279
|
+
}
|
|
280
|
+
function nt(i) {
|
|
281
|
+
const t = parseFloat(i);
|
|
282
|
+
return Number.isNaN(t) ? null : t;
|
|
283
|
+
}
|
|
284
|
+
const at = "WEBVTT", P = ",", ot = "%", g = /[:=]/, lt = /^[\s\t]*(region|vertical|line|position|size|align)[:=]/, ht = "NOTE", ct = "REGION", ut = /^REGION:?[\s\t]+/, T = /[\s\t]+/, ft = "-->", dt = /[\s\t]*-->[\s\t]+/, pt = /start|center|end|left|right/, gt = /start|center|end/, mt = /line-(?:left|right)|center|auto/, Tt = /^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/;
|
|
285
|
+
var H = /* @__PURE__ */ ((i) => (i[i.None = 0] = "None", i[i.Header = 1] = "Header", i[i.Cue = 2] = "Cue", i[i.Region = 3] = "Region", i[i.Note = 4] = "Note", i))(H || {});
|
|
286
|
+
class V {
|
|
287
|
+
h;
|
|
288
|
+
e = 0;
|
|
289
|
+
i = {};
|
|
290
|
+
j = {};
|
|
291
|
+
l = [];
|
|
292
|
+
c = null;
|
|
293
|
+
d = null;
|
|
294
|
+
m = [];
|
|
295
|
+
f;
|
|
296
|
+
n = "";
|
|
297
|
+
async init(t) {
|
|
298
|
+
this.h = t, t.strict && (this.e = 1), t.errors && (this.f = (await import("./errors-CTL-RV3B.js")).ParseErrorBuilder);
|
|
299
|
+
}
|
|
300
|
+
parse(t, e) {
|
|
301
|
+
if (t === "")
|
|
302
|
+
this.c ? (this.l.push(this.c), this.h.onCue?.(this.c), this.c = null) : this.d ? (this.j[this.d.id] = this.d, this.h.onRegion?.(this.d), this.d = null) : this.e === 1 && (this.k(t, e), this.h.onHeaderMetadata?.(this.i)), this.e = 0;
|
|
303
|
+
else if (this.e)
|
|
304
|
+
switch (this.e) {
|
|
305
|
+
case 1:
|
|
306
|
+
this.k(t, e);
|
|
307
|
+
break;
|
|
308
|
+
case 2:
|
|
309
|
+
if (this.c) {
|
|
310
|
+
const s = this.c.text.length > 0;
|
|
311
|
+
!s && lt.test(t) ? this.o(t.split(T), e) : this.c.text += (s ? `
|
|
312
|
+
` : "") + t;
|
|
313
|
+
}
|
|
314
|
+
break;
|
|
315
|
+
case 3:
|
|
316
|
+
this.p(t.split(T), e);
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
else if (t.startsWith(ht))
|
|
320
|
+
this.e = 4;
|
|
321
|
+
else if (t.startsWith(ct))
|
|
322
|
+
this.e = 3, this.d = new G(), this.p(t.replace(ut, "").split(T), e);
|
|
323
|
+
else if (t.includes(ft)) {
|
|
324
|
+
const s = this.q(t, e);
|
|
325
|
+
s && (this.c = new j(s[0], s[1], ""), this.c.id = this.n, this.o(s[2], e)), this.e = 2;
|
|
326
|
+
} else e === 1 && this.k(t, e);
|
|
327
|
+
this.n = t;
|
|
328
|
+
}
|
|
329
|
+
done() {
|
|
330
|
+
return {
|
|
331
|
+
metadata: this.i,
|
|
332
|
+
cues: this.l,
|
|
333
|
+
regions: Object.values(this.j),
|
|
334
|
+
errors: this.m
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
k(t, e) {
|
|
338
|
+
if (e > 1) {
|
|
339
|
+
if (g.test(t)) {
|
|
340
|
+
const [s, a] = t.split(g);
|
|
341
|
+
s && (this.i[s] = (a || "").replace(T, ""));
|
|
342
|
+
}
|
|
343
|
+
} else t.startsWith(at) ? this.e = 1 : this.g(this.f?.r());
|
|
344
|
+
}
|
|
345
|
+
q(t, e) {
|
|
346
|
+
const [s, a = ""] = t.split(dt), [r, ...n] = a.split(T), o = y(s), l = y(r);
|
|
347
|
+
if (o !== null && l !== null && l > o)
|
|
348
|
+
return [o, l, n];
|
|
349
|
+
o === null && this.g(this.f?.s(s, e)), l === null && this.g(this.f?.t(r, e)), o != null && l !== null && l > o && this.g(this.f?.u(o, l, e));
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @see {@link https://www.w3.org/TR/webvtt1/#region-settings-parsing}
|
|
353
|
+
*/
|
|
354
|
+
p(t, e) {
|
|
355
|
+
let s;
|
|
356
|
+
for (let a = 0; a < t.length; a++)
|
|
357
|
+
if (g.test(t[a])) {
|
|
358
|
+
s = !1;
|
|
359
|
+
const [r, n] = t[a].split(g);
|
|
360
|
+
switch (r) {
|
|
361
|
+
case "id":
|
|
362
|
+
this.d.id = n;
|
|
363
|
+
break;
|
|
364
|
+
case "width":
|
|
365
|
+
const o = w(n);
|
|
366
|
+
o !== null ? this.d.width = o : s = !0;
|
|
367
|
+
break;
|
|
368
|
+
case "lines":
|
|
369
|
+
const l = rt(n);
|
|
370
|
+
l !== null ? this.d.lines = l : s = !0;
|
|
371
|
+
break;
|
|
372
|
+
case "regionanchor":
|
|
373
|
+
const h = x(n);
|
|
374
|
+
h !== null ? (this.d.regionAnchorX = h[0], this.d.regionAnchorY = h[1]) : s = !0;
|
|
375
|
+
break;
|
|
376
|
+
case "viewportanchor":
|
|
377
|
+
const c = x(n);
|
|
378
|
+
c !== null ? (this.d.viewportAnchorX = c[0], this.d.viewportAnchorY = c[1]) : s = !0;
|
|
379
|
+
break;
|
|
380
|
+
case "scroll":
|
|
381
|
+
n === "up" ? this.d.scroll = "up" : s = !0;
|
|
382
|
+
break;
|
|
383
|
+
default:
|
|
384
|
+
this.g(this.f?.v(r, n, e));
|
|
385
|
+
}
|
|
386
|
+
s && this.g(this.f?.w(r, n, e));
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* @see {@link https://www.w3.org/TR/webvtt1/#cue-timings-and-settings-parsing}
|
|
391
|
+
*/
|
|
392
|
+
o(t, e) {
|
|
393
|
+
let s;
|
|
394
|
+
for (let a = 0; a < t.length; a++)
|
|
395
|
+
if (s = !1, g.test(t[a])) {
|
|
396
|
+
const [r, n] = t[a].split(g);
|
|
397
|
+
switch (r) {
|
|
398
|
+
case "region":
|
|
399
|
+
const o = this.j[n];
|
|
400
|
+
o && (this.c.region = o);
|
|
401
|
+
break;
|
|
402
|
+
case "vertical":
|
|
403
|
+
n === "lr" || n === "rl" ? (this.c.vertical = n, this.c.region = null) : s = !0;
|
|
404
|
+
break;
|
|
405
|
+
case "line":
|
|
406
|
+
const [l, h] = n.split(P);
|
|
407
|
+
if (l.includes(ot)) {
|
|
408
|
+
const m = w(l);
|
|
409
|
+
m !== null ? (this.c.line = m, this.c.snapToLines = !1) : s = !0;
|
|
410
|
+
} else {
|
|
411
|
+
const m = nt(l);
|
|
412
|
+
m !== null ? this.c.line = m : s = !0;
|
|
413
|
+
}
|
|
414
|
+
gt.test(h) ? this.c.lineAlign = h : h && (s = !0), this.c.line !== "auto" && (this.c.region = null);
|
|
415
|
+
break;
|
|
416
|
+
case "position":
|
|
417
|
+
const [c, f] = n.split(P), b = w(c);
|
|
418
|
+
b !== null ? this.c.position = b : s = !0, f && mt.test(f) ? this.c.positionAlign = f : f && (s = !0);
|
|
419
|
+
break;
|
|
420
|
+
case "size":
|
|
421
|
+
const S = w(n);
|
|
422
|
+
S !== null ? (this.c.size = S, S < 100 && (this.c.region = null)) : s = !0;
|
|
423
|
+
break;
|
|
424
|
+
case "align":
|
|
425
|
+
pt.test(n) ? this.c.align = n : s = !0;
|
|
426
|
+
break;
|
|
427
|
+
default:
|
|
428
|
+
this.g(this.f?.x(r, n, e));
|
|
429
|
+
}
|
|
430
|
+
s && this.g(this.f?.y(r, n, e));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
g(t) {
|
|
434
|
+
if (t) {
|
|
435
|
+
if (this.m.push(t), this.h.strict)
|
|
436
|
+
throw this.h.cancel(), t;
|
|
437
|
+
this.h.onError?.(t);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function y(i) {
|
|
442
|
+
const t = i.match(Tt);
|
|
443
|
+
if (!t)
|
|
444
|
+
return null;
|
|
445
|
+
const e = t[1] ? parseInt(t[1], 10) : 0, s = parseInt(t[2], 10), a = parseInt(t[3], 10), r = t[4] ? parseInt(t[4].padEnd(3, "0"), 10) : 0, n = e * 3600 + s * 60 + a + r / 1e3;
|
|
446
|
+
return e < 0 || s < 0 || a < 0 || r < 0 || s > 59 || a > 59 ? null : n;
|
|
447
|
+
}
|
|
448
|
+
function wt() {
|
|
449
|
+
return new V();
|
|
450
|
+
}
|
|
451
|
+
var vt = /* @__PURE__ */ Object.freeze({
|
|
452
|
+
__proto__: null,
|
|
453
|
+
VTTBlock: H,
|
|
454
|
+
VTTParser: V,
|
|
455
|
+
default: wt,
|
|
456
|
+
parseVTTTimestamp: y
|
|
457
|
+
});
|
|
458
|
+
const yt = /[0-9]/, bt = /[\s\t]+/, F = {
|
|
459
|
+
c: "span",
|
|
460
|
+
i: "i",
|
|
461
|
+
b: "b",
|
|
462
|
+
u: "u",
|
|
463
|
+
ruby: "ruby",
|
|
464
|
+
rt: "rt",
|
|
465
|
+
v: "span",
|
|
466
|
+
lang: "span",
|
|
467
|
+
timestamp: "span"
|
|
468
|
+
}, At = {
|
|
469
|
+
"&": "&",
|
|
470
|
+
"<": "<",
|
|
471
|
+
">": ">",
|
|
472
|
+
""": '"',
|
|
473
|
+
"'": "'",
|
|
474
|
+
" ": " ",
|
|
475
|
+
"‎": "",
|
|
476
|
+
"‏": ""
|
|
477
|
+
}, Et = /&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g, St = /* @__PURE__ */ new Set([
|
|
478
|
+
"white",
|
|
479
|
+
"lime",
|
|
480
|
+
"cyan",
|
|
481
|
+
"red",
|
|
482
|
+
"yellow",
|
|
483
|
+
"magenta",
|
|
484
|
+
"blue",
|
|
485
|
+
"black"
|
|
486
|
+
]), kt = /* @__PURE__ */ new Set(Object.keys(F));
|
|
487
|
+
function D(i) {
|
|
488
|
+
let t = "", e = 1, s = [], a = [], r;
|
|
489
|
+
for (let h = 0; h < i.text.length; h++) {
|
|
490
|
+
const c = i.text[h];
|
|
491
|
+
switch (e) {
|
|
492
|
+
case 1:
|
|
493
|
+
c === "<" ? (l(), e = 2) : t += c;
|
|
494
|
+
break;
|
|
495
|
+
case 2:
|
|
496
|
+
switch (c) {
|
|
497
|
+
case `
|
|
498
|
+
`:
|
|
499
|
+
case " ":
|
|
500
|
+
case " ":
|
|
501
|
+
n(), e = 4;
|
|
502
|
+
break;
|
|
503
|
+
case ".":
|
|
504
|
+
n(), e = 3;
|
|
505
|
+
break;
|
|
506
|
+
case "/":
|
|
507
|
+
e = 5;
|
|
508
|
+
break;
|
|
509
|
+
case ">":
|
|
510
|
+
n(), e = 1;
|
|
511
|
+
break;
|
|
512
|
+
default:
|
|
513
|
+
!t && yt.test(c) && (e = 6), t += c;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
break;
|
|
517
|
+
case 3:
|
|
518
|
+
switch (c) {
|
|
519
|
+
case " ":
|
|
520
|
+
case " ":
|
|
521
|
+
case `
|
|
522
|
+
`:
|
|
523
|
+
o(), r && r.class?.trim(), e = 4;
|
|
524
|
+
break;
|
|
525
|
+
case ".":
|
|
526
|
+
o();
|
|
527
|
+
break;
|
|
528
|
+
case ">":
|
|
529
|
+
o(), r && r.class?.trim(), e = 1;
|
|
530
|
+
break;
|
|
531
|
+
default:
|
|
532
|
+
t += c;
|
|
533
|
+
}
|
|
534
|
+
break;
|
|
535
|
+
case 4:
|
|
536
|
+
c === ">" ? (t = t.replace(bt, " "), r?.type === "v" ? r.voice = k(t) : r?.type === "lang" && (r.lang = k(t)), t = "", e = 1) : t += c;
|
|
537
|
+
break;
|
|
538
|
+
case 5:
|
|
539
|
+
c === ">" && (t = "", r = a.pop(), e = 1);
|
|
540
|
+
break;
|
|
541
|
+
case 6:
|
|
542
|
+
if (c === ">") {
|
|
543
|
+
const f = y(t);
|
|
544
|
+
f !== null && f >= i.startTime && f <= i.endTime && (t = "timestamp", n(), r.time = f), t = "", e = 1;
|
|
545
|
+
} else
|
|
546
|
+
t += c;
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
function n() {
|
|
551
|
+
if (kt.has(t)) {
|
|
552
|
+
const h = r;
|
|
553
|
+
r = Nt(t), h ? (a[a.length - 1] !== h && a.push(h), h.children.push(r)) : s.push(r);
|
|
554
|
+
}
|
|
555
|
+
t = "", e = 1;
|
|
556
|
+
}
|
|
557
|
+
function o() {
|
|
558
|
+
if (r && t) {
|
|
559
|
+
const h = t.replace("bg_", "");
|
|
560
|
+
St.has(h) ? r[t.startsWith("bg_") ? "bgColor" : "color"] = h : r.class = r.class ? r.class + " " + t : t;
|
|
561
|
+
}
|
|
562
|
+
t = "";
|
|
563
|
+
}
|
|
564
|
+
function l() {
|
|
565
|
+
if (!t)
|
|
566
|
+
return;
|
|
567
|
+
const h = { type: "text", data: k(t) };
|
|
568
|
+
r ? r.children.push(h) : s.push(h), t = "";
|
|
569
|
+
}
|
|
570
|
+
return e === 1 && l(), s;
|
|
571
|
+
}
|
|
572
|
+
function Nt(i) {
|
|
573
|
+
return {
|
|
574
|
+
tagName: F[i],
|
|
575
|
+
type: i,
|
|
576
|
+
children: []
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
function k(i) {
|
|
580
|
+
return i.replace(Et, (t) => At[t] || "'");
|
|
581
|
+
}
|
|
582
|
+
function u(i, t, e) {
|
|
583
|
+
i.style.setProperty(`--${t}`, e + "");
|
|
584
|
+
}
|
|
585
|
+
function d(i, t, e = !0) {
|
|
586
|
+
i.setAttribute(`data-${t}`, e === !0 ? "" : e + "");
|
|
587
|
+
}
|
|
588
|
+
function A(i, t) {
|
|
589
|
+
i.setAttribute("data-part", t);
|
|
590
|
+
}
|
|
591
|
+
function _t(i) {
|
|
592
|
+
return parseFloat(getComputedStyle(i).lineHeight) || 0;
|
|
593
|
+
}
|
|
594
|
+
function Ct(i) {
|
|
595
|
+
if (_)
|
|
596
|
+
throw Error(
|
|
597
|
+
"[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`"
|
|
598
|
+
);
|
|
599
|
+
const t = document.createElement("template");
|
|
600
|
+
return t.innerHTML = C(i), { cue: i, content: t.content };
|
|
601
|
+
}
|
|
602
|
+
function C(i, t = 0) {
|
|
603
|
+
return R(D(i), t);
|
|
604
|
+
}
|
|
605
|
+
function R(i, t = 0) {
|
|
606
|
+
let e, s = "";
|
|
607
|
+
for (const a of i)
|
|
608
|
+
if (a.type === "text")
|
|
609
|
+
s += a.data;
|
|
610
|
+
else {
|
|
611
|
+
const r = a.type === "timestamp";
|
|
612
|
+
e = {}, e.class = a.class, e.title = a.type === "v" && a.voice, e.lang = a.type === "lang" && a.lang, e["data-part"] = a.type === "v" && "voice", r && (e["data-part"] = "timed", e["data-time"] = a.time, e["data-future"] = a.time > t, e["data-past"] = a.time < t), e.style = `${a.color ? `color: ${a.color};` : ""}${a.bgColor ? `background-color: ${a.bgColor};` : ""}`;
|
|
613
|
+
const n = Object.entries(e).filter((o) => o[1]).map((o) => `${o[0]}="${o[1] === !0 ? "" : o[1]}"`).join(" ");
|
|
614
|
+
s += `<${a.tagName}${n ? " " + n : ""}>${R(
|
|
615
|
+
a.children
|
|
616
|
+
)}</${a.tagName}>`;
|
|
617
|
+
}
|
|
618
|
+
return s;
|
|
619
|
+
}
|
|
620
|
+
function W(i, t) {
|
|
621
|
+
if (!_)
|
|
622
|
+
for (const e of i.querySelectorAll('[data-part="timed"]')) {
|
|
623
|
+
const s = Number(e.getAttribute("data-time"));
|
|
624
|
+
Number.isNaN(s) || (s > t ? d(e, "future") : e.removeAttribute("data-future"), s < t ? d(e, "past") : e.removeAttribute("data-past"));
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
function Rt(i, t) {
|
|
628
|
+
let e = null, s;
|
|
629
|
+
function a() {
|
|
630
|
+
r(), i(...s), s = void 0;
|
|
631
|
+
}
|
|
632
|
+
function r() {
|
|
633
|
+
clearTimeout(e), e = null;
|
|
634
|
+
}
|
|
635
|
+
function n() {
|
|
636
|
+
s = [].slice.call(arguments), r(), e = setTimeout(a, t);
|
|
637
|
+
}
|
|
638
|
+
return n;
|
|
639
|
+
}
|
|
640
|
+
const p = /* @__PURE__ */ Symbol(0);
|
|
641
|
+
function I(i) {
|
|
642
|
+
return i instanceof HTMLElement ? {
|
|
643
|
+
top: i.offsetTop,
|
|
644
|
+
width: i.clientWidth,
|
|
645
|
+
height: i.clientHeight,
|
|
646
|
+
left: i.offsetLeft,
|
|
647
|
+
right: i.offsetLeft + i.clientWidth,
|
|
648
|
+
bottom: i.offsetTop + i.clientHeight
|
|
649
|
+
} : { ...i };
|
|
650
|
+
}
|
|
651
|
+
function E(i, t, e) {
|
|
652
|
+
switch (t) {
|
|
653
|
+
case "+x":
|
|
654
|
+
i.left += e, i.right += e;
|
|
655
|
+
break;
|
|
656
|
+
case "-x":
|
|
657
|
+
i.left -= e, i.right -= e;
|
|
658
|
+
break;
|
|
659
|
+
case "+y":
|
|
660
|
+
i.top += e, i.bottom += e;
|
|
661
|
+
break;
|
|
662
|
+
case "-y":
|
|
663
|
+
i.top -= e, i.bottom -= e;
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
function It(i, t) {
|
|
668
|
+
return i.left <= t.right && i.right >= t.left && i.top <= t.bottom && i.bottom >= t.top;
|
|
669
|
+
}
|
|
670
|
+
function Lt(i, t) {
|
|
671
|
+
for (let e = 0; e < t.length; e++)
|
|
672
|
+
if (It(i, t[e]))
|
|
673
|
+
return t[e];
|
|
674
|
+
return null;
|
|
675
|
+
}
|
|
676
|
+
function O(i, t) {
|
|
677
|
+
return t.top >= 0 && t.bottom <= i.height && t.left >= 0 && t.right <= i.width;
|
|
678
|
+
}
|
|
679
|
+
function Mt(i, t, e) {
|
|
680
|
+
switch (e) {
|
|
681
|
+
case "+x":
|
|
682
|
+
return t.left < 0;
|
|
683
|
+
case "-x":
|
|
684
|
+
return t.right > i.width;
|
|
685
|
+
case "+y":
|
|
686
|
+
return t.top < 0;
|
|
687
|
+
case "-y":
|
|
688
|
+
return t.bottom > i.height;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function xt(i, t) {
|
|
692
|
+
const e = Math.max(0, Math.min(i.width, t.right) - Math.max(0, t.left)), s = Math.max(0, Math.min(i.height, t.bottom) - Math.max(0, t.top));
|
|
693
|
+
return e * s / (i.height * i.width);
|
|
694
|
+
}
|
|
695
|
+
function L(i, t) {
|
|
696
|
+
return {
|
|
697
|
+
top: t.top / i.height,
|
|
698
|
+
left: t.left / i.width,
|
|
699
|
+
right: (i.width - t.right) / i.width,
|
|
700
|
+
bottom: (i.height - t.bottom) / i.height
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function q(i, t) {
|
|
704
|
+
return t.top = t.top * i.height, t.left = t.left * i.width, t.right = i.width - t.right * i.width, t.bottom = i.height - t.bottom * i.height, t;
|
|
705
|
+
}
|
|
706
|
+
const X = ["top", "left", "right", "bottom"];
|
|
707
|
+
function Y(i, t, e, s) {
|
|
708
|
+
const a = L(t, e);
|
|
709
|
+
for (const r of X)
|
|
710
|
+
u(i, `${s}-${r}`, a[r] * 100 + "%");
|
|
711
|
+
}
|
|
712
|
+
function K(i, t, e, s) {
|
|
713
|
+
let a = 1, r, n = { ...t };
|
|
714
|
+
for (let o = 0; o < s.length; o++) {
|
|
715
|
+
for (; Mt(i, t, s[o]) || O(i, t) && Lt(t, e); )
|
|
716
|
+
E(t, s[o], 1);
|
|
717
|
+
if (O(i, t))
|
|
718
|
+
return t;
|
|
719
|
+
const l = xt(i, t);
|
|
720
|
+
a > l && (r = { ...t }, a = l), t = { ...n };
|
|
721
|
+
}
|
|
722
|
+
return r || n;
|
|
723
|
+
}
|
|
724
|
+
const v = /* @__PURE__ */ Symbol(0);
|
|
725
|
+
function Pt(i, t, e, s) {
|
|
726
|
+
let a = e.firstElementChild, r = zt(t), n, o = [];
|
|
727
|
+
if (e[p] || (e[p] = Ot(i, e)), n = q(i, { ...e[p] }), e[v])
|
|
728
|
+
o = [e[v] === "top" ? "+y" : "-y", "+x", "-x"];
|
|
729
|
+
else if (t.snapToLines) {
|
|
730
|
+
let l;
|
|
731
|
+
switch (t.vertical) {
|
|
732
|
+
case "":
|
|
733
|
+
o = ["+y", "-y"], l = "height";
|
|
734
|
+
break;
|
|
735
|
+
case "rl":
|
|
736
|
+
o = ["+x", "-x"], l = "width";
|
|
737
|
+
break;
|
|
738
|
+
case "lr":
|
|
739
|
+
o = ["-x", "+x"], l = "width";
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
let h = _t(a), c = h * Math.round(r), f = i[l] + h, b = o[0];
|
|
743
|
+
Math.abs(c) > f && (c = c < 0 ? -1 : 1, c *= Math.ceil(f / h) * h), r < 0 && (c += t.vertical === "" ? i.height : i.width, o = o.reverse()), E(n, b, c);
|
|
744
|
+
} else {
|
|
745
|
+
const l = t.vertical === "", h = l ? "+y" : "+x", c = l ? n.height : n.width;
|
|
746
|
+
E(
|
|
747
|
+
n,
|
|
748
|
+
h,
|
|
749
|
+
(l ? i.height : i.width) * r / 100
|
|
750
|
+
), E(
|
|
751
|
+
n,
|
|
752
|
+
h,
|
|
753
|
+
t.lineAlign === "center" ? c / 2 : t.lineAlign === "end" ? c : 0
|
|
754
|
+
), o = l ? ["-y", "+y", "-x", "+x"] : ["-x", "+x", "-y", "+y"];
|
|
755
|
+
}
|
|
756
|
+
return n = K(i, n, s, o), Y(e, i, n, "cue"), n;
|
|
757
|
+
}
|
|
758
|
+
function Ot(i, t) {
|
|
759
|
+
const e = I(t), s = Bt(t);
|
|
760
|
+
if (t[v] = !1, s.top && (e.top = s.top, e.bottom = s.top + e.height, t[v] = "top"), s.bottom) {
|
|
761
|
+
const a = i.height - s.bottom;
|
|
762
|
+
e.top = a - e.height, e.bottom = a, t[v] = "bottom";
|
|
763
|
+
}
|
|
764
|
+
return s.left && (e.left = s.left), s.right && (e.right = i.width - s.right), L(i, e);
|
|
765
|
+
}
|
|
766
|
+
function Bt(i) {
|
|
767
|
+
const t = {};
|
|
768
|
+
for (const e of X)
|
|
769
|
+
t[e] = parseFloat(i.style.getPropertyValue(`--cue-${e}`));
|
|
770
|
+
return t;
|
|
771
|
+
}
|
|
772
|
+
function zt(i) {
|
|
773
|
+
return i.line === "auto" ? i.snapToLines ? -1 : 100 : i.line;
|
|
774
|
+
}
|
|
775
|
+
function $t(i) {
|
|
776
|
+
if (i.position === "auto")
|
|
777
|
+
switch (i.align) {
|
|
778
|
+
case "start":
|
|
779
|
+
case "left":
|
|
780
|
+
return 0;
|
|
781
|
+
case "right":
|
|
782
|
+
case "end":
|
|
783
|
+
return 100;
|
|
784
|
+
default:
|
|
785
|
+
return 50;
|
|
786
|
+
}
|
|
787
|
+
return i.position;
|
|
788
|
+
}
|
|
789
|
+
function jt(i, t) {
|
|
790
|
+
if (i.positionAlign === "auto")
|
|
791
|
+
switch (i.align) {
|
|
792
|
+
case "start":
|
|
793
|
+
return t === "ltr" ? "line-left" : "line-right";
|
|
794
|
+
case "end":
|
|
795
|
+
return t === "ltr" ? "line-right" : "line-left";
|
|
796
|
+
case "center":
|
|
797
|
+
return "center";
|
|
798
|
+
default:
|
|
799
|
+
return `line-${i.align}`;
|
|
800
|
+
}
|
|
801
|
+
return i.positionAlign;
|
|
802
|
+
}
|
|
803
|
+
const Gt = ["-y", "+y", "-x", "+x"];
|
|
804
|
+
function Ht(i, t, e, s) {
|
|
805
|
+
let a = Array.from(e.querySelectorAll('[data-part="cue-display"]')), r = 0, n = Math.max(0, a.length - t.lines);
|
|
806
|
+
for (let l = a.length - 1; l >= n; l--)
|
|
807
|
+
r += a[l].offsetHeight;
|
|
808
|
+
u(e, "region-height", r + "px"), e[p] || (e[p] = L(i, I(e)));
|
|
809
|
+
let o = { ...e[p] };
|
|
810
|
+
return o = q(i, o), o.width = e.clientWidth, o.height = r, o.right = o.left + o.width, o.bottom = o.top + r, o = K(i, o, s, Gt), Y(e, i, o, "region"), o;
|
|
811
|
+
}
|
|
812
|
+
class Vt {
|
|
813
|
+
overlay;
|
|
814
|
+
z;
|
|
815
|
+
A = 0;
|
|
816
|
+
C = "ltr";
|
|
817
|
+
B = [];
|
|
818
|
+
D = !1;
|
|
819
|
+
E;
|
|
820
|
+
j = /* @__PURE__ */ new Map();
|
|
821
|
+
l = /* @__PURE__ */ new Map();
|
|
822
|
+
/* Text direction. */
|
|
823
|
+
get dir() {
|
|
824
|
+
return this.C;
|
|
825
|
+
}
|
|
826
|
+
set dir(t) {
|
|
827
|
+
this.C = t, d(this.overlay, "dir", t);
|
|
828
|
+
}
|
|
829
|
+
get currentTime() {
|
|
830
|
+
return this.A;
|
|
831
|
+
}
|
|
832
|
+
set currentTime(t) {
|
|
833
|
+
this.A = t, this.update();
|
|
834
|
+
}
|
|
835
|
+
constructor(t, e) {
|
|
836
|
+
this.overlay = t, this.dir = e?.dir ?? "ltr", t.setAttribute("translate", "yes"), t.setAttribute("aria-live", "off"), t.setAttribute("aria-atomic", "true"), A(t, "captions"), this.G(), this.E = new ResizeObserver(this.I.bind(this)), this.E.observe(t);
|
|
837
|
+
}
|
|
838
|
+
changeTrack({ regions: t, cues: e }) {
|
|
839
|
+
this.reset(), this.J(t);
|
|
840
|
+
for (const s of e)
|
|
841
|
+
this.l.set(s, null);
|
|
842
|
+
this.update();
|
|
843
|
+
}
|
|
844
|
+
addCue(t) {
|
|
845
|
+
this.l.set(t, null), this.update();
|
|
846
|
+
}
|
|
847
|
+
removeCue(t) {
|
|
848
|
+
this.l.delete(t), this.update();
|
|
849
|
+
}
|
|
850
|
+
update(t = !1) {
|
|
851
|
+
this.H(t);
|
|
852
|
+
}
|
|
853
|
+
reset() {
|
|
854
|
+
this.l.clear(), this.j.clear(), this.B = [], this.overlay.textContent = "";
|
|
855
|
+
}
|
|
856
|
+
destroy() {
|
|
857
|
+
this.reset(), this.E.disconnect();
|
|
858
|
+
}
|
|
859
|
+
I() {
|
|
860
|
+
this.D = !0, this.K();
|
|
861
|
+
}
|
|
862
|
+
K = Rt(() => {
|
|
863
|
+
this.D = !1, this.G();
|
|
864
|
+
for (const t of this.j.values())
|
|
865
|
+
t[p] = null;
|
|
866
|
+
for (const t of this.l.values())
|
|
867
|
+
t && (t[p] = null);
|
|
868
|
+
this.H(!0);
|
|
869
|
+
}, 50);
|
|
870
|
+
G() {
|
|
871
|
+
this.z = I(this.overlay), u(this.overlay, "overlay-width", this.z.width + "px"), u(this.overlay, "overlay-height", this.z.height + "px");
|
|
872
|
+
}
|
|
873
|
+
H(t = !1) {
|
|
874
|
+
if (!this.l.size || this.D)
|
|
875
|
+
return;
|
|
876
|
+
let e, s = [...this.l.keys()].filter((r) => this.A >= r.startTime && this.A <= r.endTime).sort(
|
|
877
|
+
(r, n) => r.startTime !== n.startTime ? r.startTime - n.startTime : r.endTime - n.endTime
|
|
878
|
+
), a = s.map((r) => r.region);
|
|
879
|
+
for (let r = 0; r < this.B.length; r++) {
|
|
880
|
+
if (e = this.B[r], s[r] === e)
|
|
881
|
+
continue;
|
|
882
|
+
if (e.region && !a.includes(e.region)) {
|
|
883
|
+
const o = this.j.get(e.region.id);
|
|
884
|
+
o && (o.removeAttribute("data-active"), t = !0);
|
|
885
|
+
}
|
|
886
|
+
const n = this.l.get(e);
|
|
887
|
+
n && (n.remove(), t = !0);
|
|
888
|
+
}
|
|
889
|
+
for (let r = 0; r < s.length; r++) {
|
|
890
|
+
e = s[r];
|
|
891
|
+
let n = this.l.get(e);
|
|
892
|
+
n || this.l.set(e, n = this.L(e));
|
|
893
|
+
const o = this.F(e) && this.j.get(e.region.id);
|
|
894
|
+
o && !o.hasAttribute("data-active") && (requestAnimationFrame(() => d(o, "active")), t = !0), n.isConnected || ((o || this.overlay).append(n), t = !0);
|
|
895
|
+
}
|
|
896
|
+
if (t) {
|
|
897
|
+
const r = [], n = /* @__PURE__ */ new Set();
|
|
898
|
+
for (let o = s.length - 1; o >= 0; o--) {
|
|
899
|
+
if (e = s[o], n.has(e.region || e))
|
|
900
|
+
continue;
|
|
901
|
+
const l = this.F(e), h = l ? this.j.get(e.region.id) : this.l.get(e);
|
|
902
|
+
l ? r.push(Ht(this.z, e.region, h, r)) : r.push(Pt(this.z, e, h, r)), n.add(l ? e.region : e);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
W(this.overlay, this.A), this.B = s;
|
|
906
|
+
}
|
|
907
|
+
J(t) {
|
|
908
|
+
if (t)
|
|
909
|
+
for (const e of t) {
|
|
910
|
+
const s = this.M(e);
|
|
911
|
+
this.j.set(e.id, s), this.overlay.append(s);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
M(t) {
|
|
915
|
+
const e = document.createElement("div");
|
|
916
|
+
return A(e, "region"), d(e, "id", t.id), d(e, "scroll", t.scroll), u(e, "region-width", t.width + "%"), u(e, "region-anchor-x", t.regionAnchorX), u(e, "region-anchor-y", t.regionAnchorY), u(e, "region-viewport-anchor-x", t.viewportAnchorX), u(e, "region-viewport-anchor-y", t.viewportAnchorY), u(e, "region-lines", t.lines), e;
|
|
917
|
+
}
|
|
918
|
+
L(t) {
|
|
919
|
+
const e = document.createElement("div"), s = $t(t), a = jt(t, this.C);
|
|
920
|
+
if (A(e, "cue-display"), t.vertical !== "" && d(e, "vertical"), u(e, "cue-text-align", t.align), t.style)
|
|
921
|
+
for (const n of Object.keys(t.style))
|
|
922
|
+
e.style.setProperty(n, t.style[n]);
|
|
923
|
+
if (this.F(t))
|
|
924
|
+
u(
|
|
925
|
+
e,
|
|
926
|
+
"cue-offset",
|
|
927
|
+
`${s - (a === "line-right" ? 100 : a === "center" ? 50 : 0)}%`
|
|
928
|
+
);
|
|
929
|
+
else if (u(
|
|
930
|
+
e,
|
|
931
|
+
"cue-writing-mode",
|
|
932
|
+
t.vertical === "" ? "horizontal-tb" : t.vertical === "lr" ? "vertical-lr" : "vertical-rl"
|
|
933
|
+
), !t.style?.["--cue-width"]) {
|
|
934
|
+
let n = s;
|
|
935
|
+
a === "line-left" ? n = 100 - s : a === "center" && s <= 50 ? n = s * 2 : a === "center" && s > 50 && (n = (100 - s) * 2);
|
|
936
|
+
const o = t.size < n ? t.size : n;
|
|
937
|
+
t.vertical === "" ? u(e, "cue-width", o + "%") : u(e, "cue-height", o + "%");
|
|
938
|
+
}
|
|
939
|
+
const r = document.createElement("div");
|
|
940
|
+
return A(r, "cue"), t.id && d(r, "id", t.id), r.innerHTML = C(t), e.append(r), e;
|
|
941
|
+
}
|
|
942
|
+
F(t) {
|
|
943
|
+
return t.region && t.size === 100 && t.vertical === "" && t.line === "auto";
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
const Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
947
|
+
__proto__: null,
|
|
948
|
+
CaptionsRenderer: Vt,
|
|
949
|
+
ParseError: Q,
|
|
950
|
+
ParseErrorCode: J,
|
|
951
|
+
TextCue: $,
|
|
952
|
+
VTTCue: j,
|
|
953
|
+
VTTRegion: G,
|
|
954
|
+
createVTTCueTemplate: Ct,
|
|
955
|
+
parseByteStream: z,
|
|
956
|
+
parseResponse: et,
|
|
957
|
+
parseText: tt,
|
|
958
|
+
parseTextStream: N,
|
|
959
|
+
parseVTTTimestamp: y,
|
|
960
|
+
renderVTTCueString: C,
|
|
961
|
+
renderVTTTokensString: R,
|
|
962
|
+
tokenizeVTTCue: D,
|
|
963
|
+
updateTimedVTTCueNodes: W
|
|
964
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
965
|
+
export {
|
|
966
|
+
Q as P,
|
|
967
|
+
V,
|
|
968
|
+
H as a,
|
|
969
|
+
j as b,
|
|
970
|
+
J as c,
|
|
971
|
+
Ft as d,
|
|
972
|
+
y as p
|
|
973
|
+
};
|