@instructure/studio-player 1.1.15 → 1.2.1
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/{ar-DWuLBmz_.js → ar-Z9acuZzl.js} +59 -57
- package/dist/{ca-Qqae8qG8.js → ca-DlR1wIBB.js} +53 -51
- package/dist/chromecast-fcYiHsj5.js +4 -0
- package/dist/{cy-BpEFkqco.js → cy-Bfp7KxBK.js} +56 -54
- package/dist/{da-wed3aJ7h.js → da-qrZgDst-.js} +48 -46
- package/dist/{da-x-k12-COGvNdvr.js → da-x-k12-By8rNInq.js} +46 -44
- package/dist/{de-nKvELG0o.js → de-knn0V76L.js} +52 -50
- package/dist/dev-D3SS6qhA.js +1000 -0
- package/dist/{en_AU-MbaPa8_v.js → en-AU-x-unimelb-ByeXpRSQ.js} +54 -52
- package/dist/en-AyGO5HzS.js +133 -0
- package/dist/{en-GB-x-ukhe-B4JozeRC.js → en-GB-x-ukhe-xHRAKkin.js} +56 -54
- package/dist/{en-AU-x-unimelb-CkNBO1qD.js → en_AU-DyOGFAXY.js} +48 -46
- package/dist/{en_CY-Bic0boap.js → en_CY-BOdUgRsC.js} +52 -50
- package/dist/{en_GB-Bic0boap.js → en_GB-BgDkmLv4.js} +50 -48
- package/dist/errors-Bfk1GqFn.js +70 -0
- package/dist/{es-BcgDzQZG.js → es-CBqAZZdR.js} +54 -52
- package/dist/{es_ES-Dpu1hibc.js → es_ES-DLfG4pu4.js} +60 -58
- package/dist/{fi-BEWl8re7.js → fi-Dq0xAMjn.js} +55 -53
- package/dist/{fr-DiQce0QU.js → fr-CvtcW3Dj.js} +58 -56
- package/dist/fr_CA-ZpBdXMbh.js +133 -0
- package/dist/ga-83Dv-X5Z.js +133 -0
- package/dist/{hi-DFgKd5Rh.js → hi-xRyetvo6.js} +59 -57
- package/dist/ht-DA2-RKUH.js +133 -0
- package/dist/id-CEs1cZOo.js +133 -0
- package/dist/index-Bc3X9mWo.css +1 -0
- package/dist/{is-CTl9VBTw.js → is-BbinArrV.js} +56 -54
- package/dist/{it-DS73ictn.js → it-HslrRsSS.js} +58 -56
- package/dist/ja-D89KNqN9.js +133 -0
- package/dist/mi-aU_9ve5X.js +133 -0
- package/dist/{ms-C_fuUCcA.js → ms-bWAzRpaY.js} +52 -50
- package/dist/nb-M_VkURkp.js +133 -0
- package/dist/{nb-CrJr2akb.js → nb-x-k12-B-_bQnAo.js} +54 -52
- package/dist/{nl-CrynP9Ac.js → nl-DHdAiTnV.js} +56 -54
- package/dist/pl-1Qw2eZF3.js +133 -0
- package/dist/{pt-GnFuQolP.js → pt-Ck4sSJ6k.js} +52 -50
- package/dist/{pt_BR-Bw-U8Fma.js → pt_BR-Cx97cXwr.js} +56 -54
- package/dist/ru-C-htuaP4.js +133 -0
- package/dist/sl-CQCpGyzi.js +133 -0
- package/dist/srt-parser-HIGL5vQl.js +27 -0
- package/dist/ssa-parser-DsrjQpwb.js +209 -0
- package/dist/studio-player.es.js +4703 -4719
- package/dist/sv-e5AFl9Ar.js +133 -0
- package/dist/sv-x-k12-pMVzTct2.js +133 -0
- package/dist/{th-DY_qsUyE.js → th-D_TJAjfw.js} +63 -61
- package/dist/{vi-CZWY3NLh.js → vi-Cm6S7qCi.js} +53 -51
- package/dist/vidstack-CjqtyAQk.js +9772 -0
- package/dist/vidstack-audio-CkMeA4-b.js +32 -0
- package/dist/vidstack-dash-CMEjAqOU.js +95 -0
- package/dist/vidstack-google-cast-BMQWFfhs.js +313 -0
- package/dist/vidstack-hls-D1a98pZ4.js +95 -0
- package/dist/vidstack-html-CPvoK3qB.js +73 -0
- package/dist/vidstack-video-C_npz5Cj.js +39 -0
- package/dist/vidstack-vimeo-j7LNW6Re.js +426 -0
- package/dist/vidstack-youtube-C_ammZWO.js +264 -0
- package/dist/zh-DaDuLWt4.js +133 -0
- package/dist/zh-Hans-Bh10_Au7.js +133 -0
- package/dist/zh-Hant-DvNKec8H.js +133 -0
- package/dist/{zh-Hant-DuAgeN0L.js → zh_HK-CwSDZpFm.js} +59 -57
- package/package.json +4 -4
- package/dist/en-Da2QqQzB.js +0 -131
- package/dist/errors-DCJKAXTz.js +0 -70
- package/dist/fr_CA-zzDHXzBI.js +0 -131
- package/dist/ga-BnfTovup.js +0 -125
- package/dist/ht-DmkZypkC.js +0 -131
- package/dist/id-D12ot73_.js +0 -131
- package/dist/index-DhrDIAdb.css +0 -1
- package/dist/ja-B0B-sKEG.js +0 -131
- package/dist/mi-BX_XpUQT.js +0 -131
- package/dist/nb-x-k12-LqbRKYNM.js +0 -131
- package/dist/patches.d.ts +0 -1
- package/dist/pl-CBE8GSTo.js +0 -131
- package/dist/prod-DTLJXtPo.js +0 -994
- package/dist/ru-Din5Ed0v.js +0 -131
- package/dist/sl-DOsudmDY.js +0 -131
- package/dist/srt-parser-CWqahKwO.js +0 -27
- package/dist/ssa-parser-BqjjKy4M.js +0 -209
- package/dist/sv-CxnJbrMd.js +0 -131
- package/dist/sv-x-k12-C3MKrKJe.js +0 -131
- package/dist/vidstack-CpEp8jXV.js +0 -32955
- package/dist/zh-Cb-utrSO.js +0 -131
- package/dist/zh-Hans-C6EE8GVu.js +0 -131
- package/dist/zh_HK-BaabEC8v.js +0 -131
package/dist/prod-DTLJXtPo.js
DELETED
|
@@ -1,994 +0,0 @@
|
|
|
1
|
-
var U = Object.defineProperty;
|
|
2
|
-
var tt = (i, t, e) => t in i ? U(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var h = (i, t, e) => tt(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
const et = {
|
|
5
|
-
LoadFail: 0,
|
|
6
|
-
BadSignature: 1,
|
|
7
|
-
BadTimestamp: 2,
|
|
8
|
-
BadSettingValue: 3,
|
|
9
|
-
BadFormat: 4,
|
|
10
|
-
UnknownSetting: 5
|
|
11
|
-
};
|
|
12
|
-
class it extends Error {
|
|
13
|
-
constructor(e) {
|
|
14
|
-
super(e.reason);
|
|
15
|
-
h(this, "code");
|
|
16
|
-
h(this, "line");
|
|
17
|
-
this.code = e.code, this.line = e.line;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const j = /\r?\n|\r/gm;
|
|
21
|
-
class st {
|
|
22
|
-
constructor(t) {
|
|
23
|
-
h(this, "writable");
|
|
24
|
-
h(this, "readable");
|
|
25
|
-
const e = new rt(t);
|
|
26
|
-
this.writable = new WritableStream({
|
|
27
|
-
write(s) {
|
|
28
|
-
e.transform(s);
|
|
29
|
-
},
|
|
30
|
-
close() {
|
|
31
|
-
e.close();
|
|
32
|
-
}
|
|
33
|
-
}), this.readable = new ReadableStream({
|
|
34
|
-
start(s) {
|
|
35
|
-
e.onLine = (n) => s.enqueue(n), e.onClose = () => s.close();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
class rt {
|
|
41
|
-
constructor(t) {
|
|
42
|
-
h(this, "a", "");
|
|
43
|
-
h(this, "b");
|
|
44
|
-
h(this, "onLine");
|
|
45
|
-
h(this, "onClose");
|
|
46
|
-
this.b = new TextDecoder(t);
|
|
47
|
-
}
|
|
48
|
-
transform(t) {
|
|
49
|
-
this.a += this.b.decode(t, { stream: !0 });
|
|
50
|
-
const e = this.a.split(j);
|
|
51
|
-
this.a = e.pop() || "";
|
|
52
|
-
for (let s = 0; s < e.length; s++)
|
|
53
|
-
this.onLine(e[s].trim());
|
|
54
|
-
}
|
|
55
|
-
close() {
|
|
56
|
-
this.a && this.onLine(this.a.trim()), this.a = "", this.onClose();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function nt(i, t) {
|
|
60
|
-
const e = new ReadableStream({
|
|
61
|
-
start(s) {
|
|
62
|
-
const n = i.split(j);
|
|
63
|
-
for (const r of n)
|
|
64
|
-
s.enqueue(r);
|
|
65
|
-
s.close();
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return C(e, t);
|
|
69
|
-
}
|
|
70
|
-
async function C(i, t) {
|
|
71
|
-
const e = (t == null ? void 0 : t.type) ?? "vtt";
|
|
72
|
-
let s;
|
|
73
|
-
if (typeof e == "string")
|
|
74
|
-
switch (e) {
|
|
75
|
-
case "srt":
|
|
76
|
-
s = (await import("./srt-parser-CWqahKwO.js")).default;
|
|
77
|
-
break;
|
|
78
|
-
case "ssa":
|
|
79
|
-
case "ass":
|
|
80
|
-
s = (await import("./ssa-parser-BqjjKy4M.js")).default;
|
|
81
|
-
break;
|
|
82
|
-
default:
|
|
83
|
-
s = (await Promise.resolve().then(function() {
|
|
84
|
-
return St;
|
|
85
|
-
})).default;
|
|
86
|
-
}
|
|
87
|
-
else
|
|
88
|
-
s = e;
|
|
89
|
-
let n;
|
|
90
|
-
const r = i.getReader(), l = s(), a = !!(t != null && t.strict) || !!(t != null && t.errors);
|
|
91
|
-
await l.init({
|
|
92
|
-
strict: !1,
|
|
93
|
-
...t,
|
|
94
|
-
errors: a,
|
|
95
|
-
type: e,
|
|
96
|
-
cancel() {
|
|
97
|
-
r.cancel(), n = l.done(!0);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
let o = 1;
|
|
101
|
-
for (; ; ) {
|
|
102
|
-
const { value: c, done: f } = await r.read();
|
|
103
|
-
if (f) {
|
|
104
|
-
l.parse("", o), n = l.done(!1);
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
l.parse(c, o), o++;
|
|
108
|
-
}
|
|
109
|
-
return n;
|
|
110
|
-
}
|
|
111
|
-
async function at(i, t) {
|
|
112
|
-
var l, a;
|
|
113
|
-
const e = await i;
|
|
114
|
-
if (!e.ok || !e.body)
|
|
115
|
-
return {
|
|
116
|
-
metadata: {},
|
|
117
|
-
cues: [],
|
|
118
|
-
regions: [],
|
|
119
|
-
errors: [void 0]
|
|
120
|
-
};
|
|
121
|
-
const s = e.headers.get("content-type") || "", n = (l = s.match(/text\/(.*?)(?:;|$)/)) == null ? void 0 : l[1], r = (a = s.match(/charset=(.*?)(?:;|$)/)) == null ? void 0 : a[1];
|
|
122
|
-
return G(e.body, { type: n, encoding: r, ...t });
|
|
123
|
-
}
|
|
124
|
-
async function G(i, { encoding: t = "utf-8", ...e } = {}) {
|
|
125
|
-
const s = i.pipeThrough(new st(t));
|
|
126
|
-
return C(s, e);
|
|
127
|
-
}
|
|
128
|
-
class H extends EventTarget {
|
|
129
|
-
constructor(e, s, n) {
|
|
130
|
-
super();
|
|
131
|
-
/**
|
|
132
|
-
* A string that identifies the cue.
|
|
133
|
-
*
|
|
134
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/id}
|
|
135
|
-
*/
|
|
136
|
-
h(this, "id", "");
|
|
137
|
-
/**
|
|
138
|
-
* A `double` that represents the video time that the cue will start being displayed, in seconds.
|
|
139
|
-
*
|
|
140
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/startTime}
|
|
141
|
-
*/
|
|
142
|
-
h(this, "startTime");
|
|
143
|
-
/**
|
|
144
|
-
* A `double` that represents the video time that the cue will stop being displayed, in seconds.
|
|
145
|
-
*
|
|
146
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/endTime}
|
|
147
|
-
*/
|
|
148
|
-
h(this, "endTime");
|
|
149
|
-
/**
|
|
150
|
-
* Returns a string with the contents of the cue.
|
|
151
|
-
*
|
|
152
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/text}
|
|
153
|
-
*/
|
|
154
|
-
h(this, "text");
|
|
155
|
-
/**
|
|
156
|
-
* A `boolean` for whether the video will pause when this cue stops being displayed.
|
|
157
|
-
*
|
|
158
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/pauseOnExit}
|
|
159
|
-
*/
|
|
160
|
-
h(this, "pauseOnExit", !1);
|
|
161
|
-
this.startTime = e, this.endTime = s, this.text = n;
|
|
162
|
-
}
|
|
163
|
-
addEventListener(e, s, n) {
|
|
164
|
-
super.addEventListener(e, s, n);
|
|
165
|
-
}
|
|
166
|
-
removeEventListener(e, s, n) {
|
|
167
|
-
super.removeEventListener(e, s, n);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
const R = typeof document > "u", lt = R ? H : window.VTTCue;
|
|
171
|
-
class V extends lt {
|
|
172
|
-
constructor() {
|
|
173
|
-
super(...arguments);
|
|
174
|
-
/**
|
|
175
|
-
* A `VTTRegion` object describing the video's sub-region that the cue will be drawn onto,
|
|
176
|
-
* or `null` if none is assigned.
|
|
177
|
-
*
|
|
178
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/region}
|
|
179
|
-
*/
|
|
180
|
-
h(this, "region", null);
|
|
181
|
-
/**
|
|
182
|
-
* The cue writing direction.
|
|
183
|
-
*
|
|
184
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/vertical}
|
|
185
|
-
*/
|
|
186
|
-
h(this, "vertical", "");
|
|
187
|
-
/**
|
|
188
|
-
* Returns `true` if the `VTTCue.line` attribute is an integer number of lines or a percentage
|
|
189
|
-
* of the video size.
|
|
190
|
-
*
|
|
191
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/snapToLines}
|
|
192
|
-
*/
|
|
193
|
-
h(this, "snapToLines", !0);
|
|
194
|
-
/**
|
|
195
|
-
* Returns the line positioning of the cue. This can be the string `'auto'` or a number whose
|
|
196
|
-
* interpretation depends on the value of `VTTCue.snapToLines`.
|
|
197
|
-
*
|
|
198
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/line}
|
|
199
|
-
*/
|
|
200
|
-
h(this, "line", "auto");
|
|
201
|
-
/**
|
|
202
|
-
* Returns an enum representing the alignment of the `VTTCue.line`.
|
|
203
|
-
*
|
|
204
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineAlign}
|
|
205
|
-
*/
|
|
206
|
-
h(this, "lineAlign", "start");
|
|
207
|
-
/**
|
|
208
|
-
* Returns the indentation of the cue within the line. This can be the string `'auto'` or a
|
|
209
|
-
* number representing the percentage of the `VTTCue.region`, or the video size if `VTTCue`.region`
|
|
210
|
-
* is `null`.
|
|
211
|
-
*
|
|
212
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/position}
|
|
213
|
-
*/
|
|
214
|
-
h(this, "position", "auto");
|
|
215
|
-
/**
|
|
216
|
-
* Returns an enum representing the alignment of the cue. This is used to determine what
|
|
217
|
-
* the `VTTCue.position` is anchored to. The default is `'auto'`.
|
|
218
|
-
*
|
|
219
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionAlign}
|
|
220
|
-
*/
|
|
221
|
-
h(this, "positionAlign", "auto");
|
|
222
|
-
/**
|
|
223
|
-
* Returns a double representing the size of the cue, as a percentage of the video size.
|
|
224
|
-
*
|
|
225
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/size}
|
|
226
|
-
*/
|
|
227
|
-
h(this, "size", 100);
|
|
228
|
-
/**
|
|
229
|
-
* Returns an enum representing the alignment of all the lines of text within the cue box.
|
|
230
|
-
*
|
|
231
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/align}
|
|
232
|
-
*/
|
|
233
|
-
h(this, "align", "center");
|
|
234
|
-
/**
|
|
235
|
-
* Additional styles associated with the cue.
|
|
236
|
-
*/
|
|
237
|
-
h(this, "style");
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
class F {
|
|
241
|
-
constructor() {
|
|
242
|
-
/**
|
|
243
|
-
* A string that identifies the region.
|
|
244
|
-
*/
|
|
245
|
-
h(this, "id", "");
|
|
246
|
-
/**
|
|
247
|
-
* A `double` representing the width of the region, as a percentage of the video.
|
|
248
|
-
*/
|
|
249
|
-
h(this, "width", 100);
|
|
250
|
-
/**
|
|
251
|
-
* A `double` representing the height of the region, in number of lines.
|
|
252
|
-
*/
|
|
253
|
-
h(this, "lines", 3);
|
|
254
|
-
/**
|
|
255
|
-
* A `double` representing the region anchor X offset, as a percentage of the region.
|
|
256
|
-
*/
|
|
257
|
-
h(this, "regionAnchorX", 0);
|
|
258
|
-
/**
|
|
259
|
-
* A `double` representing the region anchor Y offset, as a percentage of the region.
|
|
260
|
-
*/
|
|
261
|
-
h(this, "regionAnchorY", 100);
|
|
262
|
-
/**
|
|
263
|
-
* A `double` representing the viewport anchor X offset, as a percentage of the video.
|
|
264
|
-
*/
|
|
265
|
-
h(this, "viewportAnchorX", 0);
|
|
266
|
-
/**
|
|
267
|
-
* A `double` representing the viewport anchor Y offset, as a percentage of the video.
|
|
268
|
-
*/
|
|
269
|
-
h(this, "viewportAnchorY", 100);
|
|
270
|
-
/**
|
|
271
|
-
* An enum representing how adding new cues will move existing cues.
|
|
272
|
-
*/
|
|
273
|
-
h(this, "scroll", "");
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
const O = ",", ot = "%";
|
|
277
|
-
function ht(i) {
|
|
278
|
-
const t = parseInt(i, 10);
|
|
279
|
-
return Number.isNaN(t) ? null : t;
|
|
280
|
-
}
|
|
281
|
-
function b(i) {
|
|
282
|
-
const t = parseInt(i.replace(ot, ""), 10);
|
|
283
|
-
return !Number.isNaN(t) && t >= 0 && t <= 100 ? t : null;
|
|
284
|
-
}
|
|
285
|
-
function B(i) {
|
|
286
|
-
if (!i.includes(O))
|
|
287
|
-
return null;
|
|
288
|
-
const [t, e] = i.split(O).map(b);
|
|
289
|
-
return t !== null && e !== null ? [t, e] : null;
|
|
290
|
-
}
|
|
291
|
-
function ct(i) {
|
|
292
|
-
const t = parseFloat(i);
|
|
293
|
-
return Number.isNaN(t) ? null : t;
|
|
294
|
-
}
|
|
295
|
-
const ut = "WEBVTT", z = ",", ft = "%", w = /[:=]/, dt = /^[\s\t]*(region|vertical|line|position|size|align)[:=]/, pt = "NOTE", gt = "REGION", mt = /^REGION:?[\s\t]+/, y = /[\s\t]+/, Tt = "-->", wt = /[\s\t]*-->[\s\t]+/, vt = /start|center|end|left|right/, yt = /start|center|end/, bt = /line-(?:left|right)|center|auto/, At = /^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/;
|
|
296
|
-
var D = /* @__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))(D || {});
|
|
297
|
-
class W {
|
|
298
|
-
constructor() {
|
|
299
|
-
h(this, "h");
|
|
300
|
-
h(this, "e", 0);
|
|
301
|
-
h(this, "i", {});
|
|
302
|
-
h(this, "j", {});
|
|
303
|
-
h(this, "l", []);
|
|
304
|
-
h(this, "c", null);
|
|
305
|
-
h(this, "d", null);
|
|
306
|
-
h(this, "m", []);
|
|
307
|
-
h(this, "f");
|
|
308
|
-
h(this, "n", "");
|
|
309
|
-
}
|
|
310
|
-
async init(t) {
|
|
311
|
-
this.h = t, t.strict && (this.e = 1), t.errors && (this.f = (await import("./errors-DCJKAXTz.js")).ParseErrorBuilder);
|
|
312
|
-
}
|
|
313
|
-
parse(t, e) {
|
|
314
|
-
var s, n, r, l, a, o;
|
|
315
|
-
if (t === "")
|
|
316
|
-
this.c ? (this.l.push(this.c), (n = (s = this.h).onCue) == null || n.call(s, this.c), this.c = null) : this.d ? (this.j[this.d.id] = this.d, (l = (r = this.h).onRegion) == null || l.call(r, this.d), this.d = null) : this.e === 1 && (this.k(t, e), (o = (a = this.h).onHeaderMetadata) == null || o.call(a, this.i)), this.e = 0;
|
|
317
|
-
else if (this.e)
|
|
318
|
-
switch (this.e) {
|
|
319
|
-
case 1:
|
|
320
|
-
this.k(t, e);
|
|
321
|
-
break;
|
|
322
|
-
case 2:
|
|
323
|
-
if (this.c) {
|
|
324
|
-
const c = this.c.text.length > 0;
|
|
325
|
-
!c && dt.test(t) ? this.o(t.split(y), e) : this.c.text += (c ? `
|
|
326
|
-
` : "") + t;
|
|
327
|
-
}
|
|
328
|
-
break;
|
|
329
|
-
case 3:
|
|
330
|
-
this.p(t.split(y), e);
|
|
331
|
-
break;
|
|
332
|
-
}
|
|
333
|
-
else if (t.startsWith(pt))
|
|
334
|
-
this.e = 4;
|
|
335
|
-
else if (t.startsWith(gt))
|
|
336
|
-
this.e = 3, this.d = new F(), this.p(t.replace(mt, "").split(y), e);
|
|
337
|
-
else if (t.includes(Tt)) {
|
|
338
|
-
const c = this.q(t, e);
|
|
339
|
-
c && (this.c = new V(c[0], c[1], ""), this.c.id = this.n, this.o(c[2], e)), this.e = 2;
|
|
340
|
-
} else e === 1 && this.k(t, e);
|
|
341
|
-
this.n = t;
|
|
342
|
-
}
|
|
343
|
-
done() {
|
|
344
|
-
return {
|
|
345
|
-
metadata: this.i,
|
|
346
|
-
cues: this.l,
|
|
347
|
-
regions: Object.values(this.j),
|
|
348
|
-
errors: this.m
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
k(t, e) {
|
|
352
|
-
var s;
|
|
353
|
-
if (e > 1) {
|
|
354
|
-
if (w.test(t)) {
|
|
355
|
-
const [n, r] = t.split(w);
|
|
356
|
-
n && (this.i[n] = (r || "").replace(y, ""));
|
|
357
|
-
}
|
|
358
|
-
} else t.startsWith(ut) ? this.e = 1 : this.g((s = this.f) == null ? void 0 : s.r());
|
|
359
|
-
}
|
|
360
|
-
q(t, e) {
|
|
361
|
-
var c, f, u;
|
|
362
|
-
const [s, n = ""] = t.split(wt), [r, ...l] = n.split(y), a = E(s), o = E(r);
|
|
363
|
-
if (a !== null && o !== null && o > a)
|
|
364
|
-
return [a, o, l];
|
|
365
|
-
a === null && this.g((c = this.f) == null ? void 0 : c.s(s, e)), o === null && this.g((f = this.f) == null ? void 0 : f.t(r, e)), a != null && o !== null && o > a && this.g((u = this.f) == null ? void 0 : u.u(a, o, e));
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* @see {@link https://www.w3.org/TR/webvtt1/#region-settings-parsing}
|
|
369
|
-
*/
|
|
370
|
-
p(t, e) {
|
|
371
|
-
var n, r;
|
|
372
|
-
let s;
|
|
373
|
-
for (let l = 0; l < t.length; l++)
|
|
374
|
-
if (w.test(t[l])) {
|
|
375
|
-
s = !1;
|
|
376
|
-
const [a, o] = t[l].split(w);
|
|
377
|
-
switch (a) {
|
|
378
|
-
case "id":
|
|
379
|
-
this.d.id = o;
|
|
380
|
-
break;
|
|
381
|
-
case "width":
|
|
382
|
-
const c = b(o);
|
|
383
|
-
c !== null ? this.d.width = c : s = !0;
|
|
384
|
-
break;
|
|
385
|
-
case "lines":
|
|
386
|
-
const f = ht(o);
|
|
387
|
-
f !== null ? this.d.lines = f : s = !0;
|
|
388
|
-
break;
|
|
389
|
-
case "regionanchor":
|
|
390
|
-
const u = B(o);
|
|
391
|
-
u !== null ? (this.d.regionAnchorX = u[0], this.d.regionAnchorY = u[1]) : s = !0;
|
|
392
|
-
break;
|
|
393
|
-
case "viewportanchor":
|
|
394
|
-
const d = B(o);
|
|
395
|
-
d !== null ? (this.d.viewportAnchorX = d[0], this.d.viewportAnchorY = d[1]) : s = !0;
|
|
396
|
-
break;
|
|
397
|
-
case "scroll":
|
|
398
|
-
o === "up" ? this.d.scroll = "up" : s = !0;
|
|
399
|
-
break;
|
|
400
|
-
default:
|
|
401
|
-
this.g((n = this.f) == null ? void 0 : n.v(a, o, e));
|
|
402
|
-
}
|
|
403
|
-
s && this.g((r = this.f) == null ? void 0 : r.w(a, o, e));
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* @see {@link https://www.w3.org/TR/webvtt1/#cue-timings-and-settings-parsing}
|
|
408
|
-
*/
|
|
409
|
-
o(t, e) {
|
|
410
|
-
var n, r;
|
|
411
|
-
let s;
|
|
412
|
-
for (let l = 0; l < t.length; l++)
|
|
413
|
-
if (s = !1, w.test(t[l])) {
|
|
414
|
-
const [a, o] = t[l].split(w);
|
|
415
|
-
switch (a) {
|
|
416
|
-
case "region":
|
|
417
|
-
const c = this.j[o];
|
|
418
|
-
c && (this.c.region = c);
|
|
419
|
-
break;
|
|
420
|
-
case "vertical":
|
|
421
|
-
o === "lr" || o === "rl" ? (this.c.vertical = o, this.c.region = null) : s = !0;
|
|
422
|
-
break;
|
|
423
|
-
case "line":
|
|
424
|
-
const [f, u] = o.split(z);
|
|
425
|
-
if (f.includes(ft)) {
|
|
426
|
-
const v = b(f);
|
|
427
|
-
v !== null ? (this.c.line = v, this.c.snapToLines = !1) : s = !0;
|
|
428
|
-
} else {
|
|
429
|
-
const v = ct(f);
|
|
430
|
-
v !== null ? this.c.line = v : s = !0;
|
|
431
|
-
}
|
|
432
|
-
yt.test(u) ? this.c.lineAlign = u : u && (s = !0), this.c.line !== "auto" && (this.c.region = null);
|
|
433
|
-
break;
|
|
434
|
-
case "position":
|
|
435
|
-
const [d, g] = o.split(z), P = b(d);
|
|
436
|
-
P !== null ? this.c.position = P : s = !0, g && bt.test(g) ? this.c.positionAlign = g : g && (s = !0);
|
|
437
|
-
break;
|
|
438
|
-
case "size":
|
|
439
|
-
const N = b(o);
|
|
440
|
-
N !== null ? (this.c.size = N, N < 100 && (this.c.region = null)) : s = !0;
|
|
441
|
-
break;
|
|
442
|
-
case "align":
|
|
443
|
-
vt.test(o) ? this.c.align = o : s = !0;
|
|
444
|
-
break;
|
|
445
|
-
default:
|
|
446
|
-
this.g((n = this.f) == null ? void 0 : n.x(a, o, e));
|
|
447
|
-
}
|
|
448
|
-
s && this.g((r = this.f) == null ? void 0 : r.y(a, o, e));
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
g(t) {
|
|
452
|
-
var e, s;
|
|
453
|
-
if (t) {
|
|
454
|
-
if (this.m.push(t), this.h.strict)
|
|
455
|
-
throw this.h.cancel(), t;
|
|
456
|
-
(s = (e = this.h).onError) == null || s.call(e, t);
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
function E(i) {
|
|
461
|
-
const t = i.match(At);
|
|
462
|
-
if (!t)
|
|
463
|
-
return null;
|
|
464
|
-
const e = t[1] ? parseInt(t[1], 10) : 0, s = parseInt(t[2], 10), n = parseInt(t[3], 10), r = t[4] ? parseInt(t[4].padEnd(3, "0"), 10) : 0, l = e * 3600 + s * 60 + n + r / 1e3;
|
|
465
|
-
return e < 0 || s < 0 || n < 0 || r < 0 || s > 59 || n > 59 ? null : l;
|
|
466
|
-
}
|
|
467
|
-
function Et() {
|
|
468
|
-
return new W();
|
|
469
|
-
}
|
|
470
|
-
var St = /* @__PURE__ */ Object.freeze({
|
|
471
|
-
__proto__: null,
|
|
472
|
-
VTTBlock: D,
|
|
473
|
-
VTTParser: W,
|
|
474
|
-
default: Et,
|
|
475
|
-
parseVTTTimestamp: E
|
|
476
|
-
});
|
|
477
|
-
const kt = /[0-9]/, Nt = /[\s\t]+/, q = {
|
|
478
|
-
c: "span",
|
|
479
|
-
i: "i",
|
|
480
|
-
b: "b",
|
|
481
|
-
u: "u",
|
|
482
|
-
ruby: "ruby",
|
|
483
|
-
rt: "rt",
|
|
484
|
-
v: "span",
|
|
485
|
-
lang: "span",
|
|
486
|
-
timestamp: "span"
|
|
487
|
-
}, _t = {
|
|
488
|
-
"&": "&",
|
|
489
|
-
"<": "<",
|
|
490
|
-
">": ">",
|
|
491
|
-
""": '"',
|
|
492
|
-
"'": "'",
|
|
493
|
-
" ": " ",
|
|
494
|
-
"‎": "",
|
|
495
|
-
"‏": ""
|
|
496
|
-
}, Ct = /&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g, Rt = /* @__PURE__ */ new Set([
|
|
497
|
-
"white",
|
|
498
|
-
"lime",
|
|
499
|
-
"cyan",
|
|
500
|
-
"red",
|
|
501
|
-
"yellow",
|
|
502
|
-
"magenta",
|
|
503
|
-
"blue",
|
|
504
|
-
"black"
|
|
505
|
-
]), It = /* @__PURE__ */ new Set(Object.keys(q));
|
|
506
|
-
function X(i) {
|
|
507
|
-
var c, f;
|
|
508
|
-
let t = "", e = 1, s = [], n = [], r;
|
|
509
|
-
for (let u = 0; u < i.text.length; u++) {
|
|
510
|
-
const d = i.text[u];
|
|
511
|
-
switch (e) {
|
|
512
|
-
case 1:
|
|
513
|
-
d === "<" ? (o(), e = 2) : t += d;
|
|
514
|
-
break;
|
|
515
|
-
case 2:
|
|
516
|
-
switch (d) {
|
|
517
|
-
case `
|
|
518
|
-
`:
|
|
519
|
-
case " ":
|
|
520
|
-
case " ":
|
|
521
|
-
l(), e = 4;
|
|
522
|
-
break;
|
|
523
|
-
case ".":
|
|
524
|
-
l(), e = 3;
|
|
525
|
-
break;
|
|
526
|
-
case "/":
|
|
527
|
-
e = 5;
|
|
528
|
-
break;
|
|
529
|
-
case ">":
|
|
530
|
-
l(), e = 1;
|
|
531
|
-
break;
|
|
532
|
-
default:
|
|
533
|
-
!t && kt.test(d) && (e = 6), t += d;
|
|
534
|
-
break;
|
|
535
|
-
}
|
|
536
|
-
break;
|
|
537
|
-
case 3:
|
|
538
|
-
switch (d) {
|
|
539
|
-
case " ":
|
|
540
|
-
case " ":
|
|
541
|
-
case `
|
|
542
|
-
`:
|
|
543
|
-
a(), r && ((c = r.class) == null || c.trim()), e = 4;
|
|
544
|
-
break;
|
|
545
|
-
case ".":
|
|
546
|
-
a();
|
|
547
|
-
break;
|
|
548
|
-
case ">":
|
|
549
|
-
a(), r && ((f = r.class) == null || f.trim()), e = 1;
|
|
550
|
-
break;
|
|
551
|
-
default:
|
|
552
|
-
t += d;
|
|
553
|
-
}
|
|
554
|
-
break;
|
|
555
|
-
case 4:
|
|
556
|
-
d === ">" ? (t = t.replace(Nt, " "), (r == null ? void 0 : r.type) === "v" ? r.voice = _(t) : (r == null ? void 0 : r.type) === "lang" && (r.lang = _(t)), t = "", e = 1) : t += d;
|
|
557
|
-
break;
|
|
558
|
-
case 5:
|
|
559
|
-
d === ">" && (t = "", r = n.pop(), e = 1);
|
|
560
|
-
break;
|
|
561
|
-
case 6:
|
|
562
|
-
if (d === ">") {
|
|
563
|
-
const g = E(t);
|
|
564
|
-
g !== null && g >= i.startTime && g <= i.endTime && (t = "timestamp", l(), r.time = g), t = "", e = 1;
|
|
565
|
-
} else
|
|
566
|
-
t += d;
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
function l() {
|
|
571
|
-
if (It.has(t)) {
|
|
572
|
-
const u = r;
|
|
573
|
-
r = Lt(t), u ? (n[n.length - 1] !== u && n.push(u), u.children.push(r)) : s.push(r);
|
|
574
|
-
}
|
|
575
|
-
t = "", e = 1;
|
|
576
|
-
}
|
|
577
|
-
function a() {
|
|
578
|
-
if (r && t) {
|
|
579
|
-
const u = t.replace("bg_", "");
|
|
580
|
-
Rt.has(u) ? r[t.startsWith("bg_") ? "bgColor" : "color"] = u : r.class = r.class ? r.class + " " + t : t;
|
|
581
|
-
}
|
|
582
|
-
t = "";
|
|
583
|
-
}
|
|
584
|
-
function o() {
|
|
585
|
-
if (!t)
|
|
586
|
-
return;
|
|
587
|
-
const u = { type: "text", data: _(t) };
|
|
588
|
-
r ? r.children.push(u) : s.push(u), t = "";
|
|
589
|
-
}
|
|
590
|
-
return e === 1 && o(), s;
|
|
591
|
-
}
|
|
592
|
-
function Lt(i) {
|
|
593
|
-
return {
|
|
594
|
-
tagName: q[i],
|
|
595
|
-
type: i,
|
|
596
|
-
children: []
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
function _(i) {
|
|
600
|
-
return i.replace(Ct, (t) => _t[t] || "'");
|
|
601
|
-
}
|
|
602
|
-
function p(i, t, e) {
|
|
603
|
-
i.style.setProperty(`--${t}`, e + "");
|
|
604
|
-
}
|
|
605
|
-
function m(i, t, e = !0) {
|
|
606
|
-
i.setAttribute(`data-${t}`, e === !0 ? "" : e + "");
|
|
607
|
-
}
|
|
608
|
-
function S(i, t) {
|
|
609
|
-
i.setAttribute("data-part", t);
|
|
610
|
-
}
|
|
611
|
-
function Mt(i) {
|
|
612
|
-
return parseFloat(getComputedStyle(i).lineHeight) || 0;
|
|
613
|
-
}
|
|
614
|
-
function xt(i) {
|
|
615
|
-
if (R)
|
|
616
|
-
throw Error(
|
|
617
|
-
"[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`"
|
|
618
|
-
);
|
|
619
|
-
const t = document.createElement("template");
|
|
620
|
-
return t.innerHTML = I(i), { cue: i, content: t.content };
|
|
621
|
-
}
|
|
622
|
-
function I(i, t = 0) {
|
|
623
|
-
return L(X(i), t);
|
|
624
|
-
}
|
|
625
|
-
function L(i, t = 0) {
|
|
626
|
-
let e, s = "";
|
|
627
|
-
for (const n of i)
|
|
628
|
-
if (n.type === "text")
|
|
629
|
-
s += n.data;
|
|
630
|
-
else {
|
|
631
|
-
const r = n.type === "timestamp";
|
|
632
|
-
e = {}, e.class = n.class, e.title = n.type === "v" && n.voice, e.lang = n.type === "lang" && n.lang, e["data-part"] = n.type === "v" && "voice", r && (e["data-part"] = "timed", e["data-time"] = n.time, e["data-future"] = n.time > t, e["data-past"] = n.time < t), e.style = `${n.color ? `color: ${n.color};` : ""}${n.bgColor ? `background-color: ${n.bgColor};` : ""}`;
|
|
633
|
-
const l = Object.entries(e).filter((a) => a[1]).map((a) => `${a[0]}="${a[1] === !0 ? "" : a[1]}"`).join(" ");
|
|
634
|
-
s += `<${n.tagName}${l ? " " + l : ""}>${L(
|
|
635
|
-
n.children
|
|
636
|
-
)}</${n.tagName}>`;
|
|
637
|
-
}
|
|
638
|
-
return s;
|
|
639
|
-
}
|
|
640
|
-
function Y(i, t) {
|
|
641
|
-
if (!R)
|
|
642
|
-
for (const e of i.querySelectorAll('[data-part="timed"]')) {
|
|
643
|
-
const s = Number(e.getAttribute("data-time"));
|
|
644
|
-
Number.isNaN(s) || (s > t ? m(e, "future") : e.removeAttribute("data-future"), s < t ? m(e, "past") : e.removeAttribute("data-past"));
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
function Pt(i, t) {
|
|
648
|
-
let e = null, s;
|
|
649
|
-
function n() {
|
|
650
|
-
r(), i(...s), s = void 0;
|
|
651
|
-
}
|
|
652
|
-
function r() {
|
|
653
|
-
clearTimeout(e), e = null;
|
|
654
|
-
}
|
|
655
|
-
function l() {
|
|
656
|
-
s = [].slice.call(arguments), r(), e = setTimeout(n, t);
|
|
657
|
-
}
|
|
658
|
-
return l;
|
|
659
|
-
}
|
|
660
|
-
const T = Symbol(0);
|
|
661
|
-
function M(i) {
|
|
662
|
-
return i instanceof HTMLElement ? {
|
|
663
|
-
top: i.offsetTop,
|
|
664
|
-
width: i.clientWidth,
|
|
665
|
-
height: i.clientHeight,
|
|
666
|
-
left: i.offsetLeft,
|
|
667
|
-
right: i.offsetLeft + i.clientWidth,
|
|
668
|
-
bottom: i.offsetTop + i.clientHeight
|
|
669
|
-
} : { ...i };
|
|
670
|
-
}
|
|
671
|
-
function k(i, t, e) {
|
|
672
|
-
switch (t) {
|
|
673
|
-
case "+x":
|
|
674
|
-
i.left += e, i.right += e;
|
|
675
|
-
break;
|
|
676
|
-
case "-x":
|
|
677
|
-
i.left -= e, i.right -= e;
|
|
678
|
-
break;
|
|
679
|
-
case "+y":
|
|
680
|
-
i.top += e, i.bottom += e;
|
|
681
|
-
break;
|
|
682
|
-
case "-y":
|
|
683
|
-
i.top -= e, i.bottom -= e;
|
|
684
|
-
break;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
function Ot(i, t) {
|
|
688
|
-
return i.left <= t.right && i.right >= t.left && i.top <= t.bottom && i.bottom >= t.top;
|
|
689
|
-
}
|
|
690
|
-
function Bt(i, t) {
|
|
691
|
-
for (let e = 0; e < t.length; e++)
|
|
692
|
-
if (Ot(i, t[e]))
|
|
693
|
-
return t[e];
|
|
694
|
-
return null;
|
|
695
|
-
}
|
|
696
|
-
function $(i, t) {
|
|
697
|
-
return t.top >= 0 && t.bottom <= i.height && t.left >= 0 && t.right <= i.width;
|
|
698
|
-
}
|
|
699
|
-
function zt(i, t, e) {
|
|
700
|
-
switch (e) {
|
|
701
|
-
case "+x":
|
|
702
|
-
return t.left < 0;
|
|
703
|
-
case "-x":
|
|
704
|
-
return t.right > i.width;
|
|
705
|
-
case "+y":
|
|
706
|
-
return t.top < 0;
|
|
707
|
-
case "-y":
|
|
708
|
-
return t.bottom > i.height;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
function $t(i, t) {
|
|
712
|
-
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));
|
|
713
|
-
return e * s / (i.height * i.width);
|
|
714
|
-
}
|
|
715
|
-
function x(i, t) {
|
|
716
|
-
return {
|
|
717
|
-
top: t.top / i.height,
|
|
718
|
-
left: t.left / i.width,
|
|
719
|
-
right: (i.width - t.right) / i.width,
|
|
720
|
-
bottom: (i.height - t.bottom) / i.height
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
function K(i, t) {
|
|
724
|
-
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;
|
|
725
|
-
}
|
|
726
|
-
const J = ["top", "left", "right", "bottom"];
|
|
727
|
-
function Q(i, t, e, s) {
|
|
728
|
-
const n = x(t, e);
|
|
729
|
-
for (const r of J)
|
|
730
|
-
p(i, `${s}-${r}`, n[r] * 100 + "%");
|
|
731
|
-
}
|
|
732
|
-
function Z(i, t, e, s) {
|
|
733
|
-
let n = 1, r, l = { ...t };
|
|
734
|
-
for (let a = 0; a < s.length; a++) {
|
|
735
|
-
for (; zt(i, t, s[a]) || $(i, t) && Bt(t, e); )
|
|
736
|
-
k(t, s[a], 1);
|
|
737
|
-
if ($(i, t))
|
|
738
|
-
return t;
|
|
739
|
-
const o = $t(i, t);
|
|
740
|
-
n > o && (r = { ...t }, n = o), t = { ...l };
|
|
741
|
-
}
|
|
742
|
-
return r || l;
|
|
743
|
-
}
|
|
744
|
-
const A = Symbol(0);
|
|
745
|
-
function jt(i, t, e, s) {
|
|
746
|
-
let n = e.firstElementChild, r = Vt(t), l, a = [];
|
|
747
|
-
if (e[T] || (e[T] = Gt(i, e)), l = K(i, { ...e[T] }), e[A])
|
|
748
|
-
a = [e[A] === "top" ? "+y" : "-y", "+x", "-x"];
|
|
749
|
-
else if (t.snapToLines) {
|
|
750
|
-
let o;
|
|
751
|
-
switch (t.vertical) {
|
|
752
|
-
case "":
|
|
753
|
-
a = ["+y", "-y"], o = "height";
|
|
754
|
-
break;
|
|
755
|
-
case "rl":
|
|
756
|
-
a = ["+x", "-x"], o = "width";
|
|
757
|
-
break;
|
|
758
|
-
case "lr":
|
|
759
|
-
a = ["-x", "+x"], o = "width";
|
|
760
|
-
break;
|
|
761
|
-
}
|
|
762
|
-
let c = Mt(n), f = c * Math.round(r), u = i[o] + c, d = a[0];
|
|
763
|
-
Math.abs(f) > u && (f = f < 0 ? -1 : 1, f *= Math.ceil(u / c) * c), r < 0 && (f += t.vertical === "" ? i.height : i.width, a = a.reverse()), k(l, d, f);
|
|
764
|
-
} else {
|
|
765
|
-
const o = t.vertical === "", c = o ? "+y" : "+x", f = o ? l.height : l.width;
|
|
766
|
-
k(
|
|
767
|
-
l,
|
|
768
|
-
c,
|
|
769
|
-
(o ? i.height : i.width) * r / 100
|
|
770
|
-
), k(
|
|
771
|
-
l,
|
|
772
|
-
c,
|
|
773
|
-
t.lineAlign === "center" ? f / 2 : t.lineAlign === "end" ? f : 0
|
|
774
|
-
), a = o ? ["-y", "+y", "-x", "+x"] : ["-x", "+x", "-y", "+y"];
|
|
775
|
-
}
|
|
776
|
-
return l = Z(i, l, s, a), Q(e, i, l, "cue"), l;
|
|
777
|
-
}
|
|
778
|
-
function Gt(i, t) {
|
|
779
|
-
const e = M(t), s = Ht(t);
|
|
780
|
-
if (t[A] = !1, s.top && (e.top = s.top, e.bottom = s.top + e.height, t[A] = "top"), s.bottom) {
|
|
781
|
-
const n = i.height - s.bottom;
|
|
782
|
-
e.top = n - e.height, e.bottom = n, t[A] = "bottom";
|
|
783
|
-
}
|
|
784
|
-
return s.left && (e.left = s.left), s.right && (e.right = i.width - s.right), x(i, e);
|
|
785
|
-
}
|
|
786
|
-
function Ht(i) {
|
|
787
|
-
const t = {};
|
|
788
|
-
for (const e of J)
|
|
789
|
-
t[e] = parseFloat(i.style.getPropertyValue(`--cue-${e}`));
|
|
790
|
-
return t;
|
|
791
|
-
}
|
|
792
|
-
function Vt(i) {
|
|
793
|
-
return i.line === "auto" ? i.snapToLines ? -1 : 100 : i.line;
|
|
794
|
-
}
|
|
795
|
-
function Ft(i) {
|
|
796
|
-
if (i.position === "auto")
|
|
797
|
-
switch (i.align) {
|
|
798
|
-
case "start":
|
|
799
|
-
case "left":
|
|
800
|
-
return 0;
|
|
801
|
-
case "right":
|
|
802
|
-
case "end":
|
|
803
|
-
return 100;
|
|
804
|
-
default:
|
|
805
|
-
return 50;
|
|
806
|
-
}
|
|
807
|
-
return i.position;
|
|
808
|
-
}
|
|
809
|
-
function Dt(i, t) {
|
|
810
|
-
if (i.positionAlign === "auto")
|
|
811
|
-
switch (i.align) {
|
|
812
|
-
case "start":
|
|
813
|
-
return t === "ltr" ? "line-left" : "line-right";
|
|
814
|
-
case "end":
|
|
815
|
-
return t === "ltr" ? "line-right" : "line-left";
|
|
816
|
-
case "center":
|
|
817
|
-
return "center";
|
|
818
|
-
default:
|
|
819
|
-
return `line-${i.align}`;
|
|
820
|
-
}
|
|
821
|
-
return i.positionAlign;
|
|
822
|
-
}
|
|
823
|
-
const Wt = ["-y", "+y", "-x", "+x"];
|
|
824
|
-
function qt(i, t, e, s) {
|
|
825
|
-
let n = Array.from(e.querySelectorAll('[data-part="cue-display"]')), r = 0, l = Math.max(0, n.length - t.lines);
|
|
826
|
-
for (let o = n.length - 1; o >= l; o--)
|
|
827
|
-
r += n[o].offsetHeight;
|
|
828
|
-
p(e, "region-height", r + "px"), e[T] || (e[T] = x(i, M(e)));
|
|
829
|
-
let a = { ...e[T] };
|
|
830
|
-
return a = K(i, a), a.width = e.clientWidth, a.height = r, a.right = a.left + a.width, a.bottom = a.top + r, a = Z(i, a, s, Wt), Q(e, i, a, "region"), a;
|
|
831
|
-
}
|
|
832
|
-
class Xt {
|
|
833
|
-
constructor(t, e) {
|
|
834
|
-
h(this, "overlay");
|
|
835
|
-
h(this, "z");
|
|
836
|
-
h(this, "A", 0);
|
|
837
|
-
h(this, "C", "ltr");
|
|
838
|
-
h(this, "B", []);
|
|
839
|
-
h(this, "D", !1);
|
|
840
|
-
h(this, "E");
|
|
841
|
-
h(this, "j", /* @__PURE__ */ new Map());
|
|
842
|
-
h(this, "l", /* @__PURE__ */ new Map());
|
|
843
|
-
h(this, "K", Pt(() => {
|
|
844
|
-
this.D = !1, this.G();
|
|
845
|
-
for (const t of this.j.values())
|
|
846
|
-
t[T] = null;
|
|
847
|
-
for (const t of this.l.values())
|
|
848
|
-
t && (t[T] = null);
|
|
849
|
-
this.H(!0);
|
|
850
|
-
}, 50));
|
|
851
|
-
this.overlay = t, this.dir = (e == null ? void 0 : e.dir) ?? "ltr", t.setAttribute("translate", "yes"), t.setAttribute("aria-live", "off"), t.setAttribute("aria-atomic", "true"), S(t, "captions"), this.G(), this.E = new ResizeObserver(this.I.bind(this)), this.E.observe(t);
|
|
852
|
-
}
|
|
853
|
-
/* Text direction. */
|
|
854
|
-
get dir() {
|
|
855
|
-
return this.C;
|
|
856
|
-
}
|
|
857
|
-
set dir(t) {
|
|
858
|
-
this.C = t, m(this.overlay, "dir", t);
|
|
859
|
-
}
|
|
860
|
-
get currentTime() {
|
|
861
|
-
return this.A;
|
|
862
|
-
}
|
|
863
|
-
set currentTime(t) {
|
|
864
|
-
this.A = t, this.update();
|
|
865
|
-
}
|
|
866
|
-
changeTrack({ regions: t, cues: e }) {
|
|
867
|
-
this.reset(), this.J(t);
|
|
868
|
-
for (const s of e)
|
|
869
|
-
this.l.set(s, null);
|
|
870
|
-
this.update();
|
|
871
|
-
}
|
|
872
|
-
addCue(t) {
|
|
873
|
-
this.l.set(t, null), this.update();
|
|
874
|
-
}
|
|
875
|
-
removeCue(t) {
|
|
876
|
-
this.l.delete(t), this.update();
|
|
877
|
-
}
|
|
878
|
-
update(t = !1) {
|
|
879
|
-
this.H(t);
|
|
880
|
-
}
|
|
881
|
-
reset() {
|
|
882
|
-
this.l.clear(), this.j.clear(), this.B = [], this.overlay.textContent = "";
|
|
883
|
-
}
|
|
884
|
-
destroy() {
|
|
885
|
-
this.reset(), this.E.disconnect();
|
|
886
|
-
}
|
|
887
|
-
I() {
|
|
888
|
-
this.D = !0, this.K();
|
|
889
|
-
}
|
|
890
|
-
G() {
|
|
891
|
-
this.z = M(this.overlay), p(this.overlay, "overlay-width", this.z.width + "px"), p(this.overlay, "overlay-height", this.z.height + "px");
|
|
892
|
-
}
|
|
893
|
-
H(t = !1) {
|
|
894
|
-
if (!this.l.size || this.D)
|
|
895
|
-
return;
|
|
896
|
-
let e, s = [...this.l.keys()].filter((r) => this.A >= r.startTime && this.A <= r.endTime).sort(
|
|
897
|
-
(r, l) => r.startTime !== l.startTime ? r.startTime - l.startTime : r.endTime - l.endTime
|
|
898
|
-
), n = s.map((r) => r.region);
|
|
899
|
-
for (let r = 0; r < this.B.length; r++) {
|
|
900
|
-
if (e = this.B[r], s[r] === e)
|
|
901
|
-
continue;
|
|
902
|
-
if (e.region && !n.includes(e.region)) {
|
|
903
|
-
const a = this.j.get(e.region.id);
|
|
904
|
-
a && (a.removeAttribute("data-active"), t = !0);
|
|
905
|
-
}
|
|
906
|
-
const l = this.l.get(e);
|
|
907
|
-
l && (l.remove(), t = !0);
|
|
908
|
-
}
|
|
909
|
-
for (let r = 0; r < s.length; r++) {
|
|
910
|
-
e = s[r];
|
|
911
|
-
let l = this.l.get(e);
|
|
912
|
-
l || this.l.set(e, l = this.L(e));
|
|
913
|
-
const a = this.F(e) && this.j.get(e.region.id);
|
|
914
|
-
a && !a.hasAttribute("data-active") && (requestAnimationFrame(() => m(a, "active")), t = !0), l.isConnected || ((a || this.overlay).append(l), t = !0);
|
|
915
|
-
}
|
|
916
|
-
if (t) {
|
|
917
|
-
const r = [], l = /* @__PURE__ */ new Set();
|
|
918
|
-
for (let a = s.length - 1; a >= 0; a--) {
|
|
919
|
-
if (e = s[a], l.has(e.region || e))
|
|
920
|
-
continue;
|
|
921
|
-
const o = this.F(e), c = o ? this.j.get(e.region.id) : this.l.get(e);
|
|
922
|
-
o ? r.push(qt(this.z, e.region, c, r)) : r.push(jt(this.z, e, c, r)), l.add(o ? e.region : e);
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
Y(this.overlay, this.A), this.B = s;
|
|
926
|
-
}
|
|
927
|
-
J(t) {
|
|
928
|
-
if (t)
|
|
929
|
-
for (const e of t) {
|
|
930
|
-
const s = this.M(e);
|
|
931
|
-
this.j.set(e.id, s), this.overlay.append(s);
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
M(t) {
|
|
935
|
-
const e = document.createElement("div");
|
|
936
|
-
return S(e, "region"), m(e, "id", t.id), m(e, "scroll", t.scroll), p(e, "region-width", t.width + "%"), p(e, "region-anchor-x", t.regionAnchorX), p(e, "region-anchor-y", t.regionAnchorY), p(e, "region-viewport-anchor-x", t.viewportAnchorX), p(e, "region-viewport-anchor-y", t.viewportAnchorY), p(e, "region-lines", t.lines), e;
|
|
937
|
-
}
|
|
938
|
-
L(t) {
|
|
939
|
-
var l;
|
|
940
|
-
const e = document.createElement("div"), s = Ft(t), n = Dt(t, this.C);
|
|
941
|
-
if (S(e, "cue-display"), t.vertical !== "" && m(e, "vertical"), p(e, "cue-text-align", t.align), t.style)
|
|
942
|
-
for (const a of Object.keys(t.style))
|
|
943
|
-
e.style.setProperty(a, t.style[a]);
|
|
944
|
-
if (this.F(t))
|
|
945
|
-
p(
|
|
946
|
-
e,
|
|
947
|
-
"cue-offset",
|
|
948
|
-
`${s - (n === "line-right" ? 100 : n === "center" ? 50 : 0)}%`
|
|
949
|
-
);
|
|
950
|
-
else if (p(
|
|
951
|
-
e,
|
|
952
|
-
"cue-writing-mode",
|
|
953
|
-
t.vertical === "" ? "horizontal-tb" : t.vertical === "lr" ? "vertical-lr" : "vertical-rl"
|
|
954
|
-
), !((l = t.style) != null && l["--cue-width"])) {
|
|
955
|
-
let a = s;
|
|
956
|
-
n === "line-left" ? a = 100 - s : n === "center" && s <= 50 ? a = s * 2 : n === "center" && s > 50 && (a = (100 - s) * 2);
|
|
957
|
-
const o = t.size < a ? t.size : a;
|
|
958
|
-
t.vertical === "" ? p(e, "cue-width", o + "%") : p(e, "cue-height", o + "%");
|
|
959
|
-
}
|
|
960
|
-
const r = document.createElement("div");
|
|
961
|
-
return S(r, "cue"), t.id && m(r, "id", t.id), r.innerHTML = I(t), e.append(r), e;
|
|
962
|
-
}
|
|
963
|
-
F(t) {
|
|
964
|
-
return t.region && t.size === 100 && t.vertical === "" && t.line === "auto";
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
const Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
968
|
-
__proto__: null,
|
|
969
|
-
CaptionsRenderer: Xt,
|
|
970
|
-
ParseError: it,
|
|
971
|
-
ParseErrorCode: et,
|
|
972
|
-
TextCue: H,
|
|
973
|
-
VTTCue: V,
|
|
974
|
-
VTTRegion: F,
|
|
975
|
-
createVTTCueTemplate: xt,
|
|
976
|
-
parseByteStream: G,
|
|
977
|
-
parseResponse: at,
|
|
978
|
-
parseText: nt,
|
|
979
|
-
parseTextStream: C,
|
|
980
|
-
parseVTTTimestamp: E,
|
|
981
|
-
renderVTTCueString: I,
|
|
982
|
-
renderVTTTokensString: L,
|
|
983
|
-
tokenizeVTTCue: X,
|
|
984
|
-
updateTimedVTTCueNodes: Y
|
|
985
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
986
|
-
export {
|
|
987
|
-
it as P,
|
|
988
|
-
W as V,
|
|
989
|
-
D as a,
|
|
990
|
-
V as b,
|
|
991
|
-
et as c,
|
|
992
|
-
Kt as d,
|
|
993
|
-
E as p
|
|
994
|
-
};
|