@vidispine/vdt-js 23.4.0-pre.2 → 23.4.0-pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +72 -6
- package/dist/index.js +717 -634
- package/dist/index.umd.cjs +3 -3
- package/package.json +19 -18
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { filesize as
|
|
2
|
-
|
|
1
|
+
import { filesize as v } from "filesize";
|
|
2
|
+
import xe from "url-join";
|
|
3
|
+
const le = (e, t) => t ? le(t, e % t) : e, K = (e) => {
|
|
3
4
|
const { width: t, height: r } = e || {};
|
|
4
5
|
if (t === void 0 || r === void 0)
|
|
5
6
|
return;
|
|
6
|
-
const
|
|
7
|
-
let o = t /
|
|
8
|
-
return o > 21 && (
|
|
9
|
-
},
|
|
7
|
+
const s = le(t, r);
|
|
8
|
+
let o = t / s, n = r / s;
|
|
9
|
+
return o > 21 && (n = 1, o = (t / r).toFixed(2)), [o, n].join(":");
|
|
10
|
+
}, M = (e) => Object.fromEntries((e == null ? void 0 : e.map(({ key: t, value: r }) => [t, r])) || []), Jt = {
|
|
10
11
|
ACCESSCONTROL_READ: "_accesscontrol_read",
|
|
11
12
|
ACCESSCONTROL_WRITE: "_accesscontrol_write",
|
|
12
13
|
ADMINISTRATOR: "_administrator",
|
|
@@ -116,7 +117,7 @@ const ue = (e, t) => t ? ue(t, e % t) : e, H = (e) => {
|
|
|
116
117
|
USER: "_user",
|
|
117
118
|
VXA: "_vxa",
|
|
118
119
|
VXA_READ: "_vxa_read"
|
|
119
|
-
},
|
|
120
|
+
}, Xt = [
|
|
120
121
|
"stl_subtitle",
|
|
121
122
|
"stl_tti",
|
|
122
123
|
"stl_gsi",
|
|
@@ -128,7 +129,7 @@ const ue = (e, t) => t ? ue(t, e % t) : e, H = (e) => {
|
|
|
128
129
|
"facedetect_face",
|
|
129
130
|
"originalTrackFilename",
|
|
130
131
|
"stl_gsiHeader"
|
|
131
|
-
],
|
|
132
|
+
], qt = [
|
|
132
133
|
"title",
|
|
133
134
|
"user",
|
|
134
135
|
"shapeTag",
|
|
@@ -267,291 +268,291 @@ const ue = (e, t) => t ? ue(t, e % t) : e, H = (e) => {
|
|
|
267
268
|
"jc",
|
|
268
269
|
"vp",
|
|
269
270
|
"sn"
|
|
270
|
-
],
|
|
271
|
+
], z = [
|
|
271
272
|
"uuid",
|
|
272
273
|
"user",
|
|
273
274
|
"timestamp",
|
|
274
275
|
"change",
|
|
275
276
|
"conflict",
|
|
276
277
|
"mode"
|
|
277
|
-
],
|
|
278
|
+
], _e = [
|
|
278
279
|
"name",
|
|
279
280
|
"id",
|
|
280
281
|
"referenced",
|
|
281
282
|
"data",
|
|
282
283
|
"inheritance"
|
|
283
|
-
],
|
|
284
|
-
...
|
|
284
|
+
], We = [
|
|
285
|
+
...z,
|
|
285
286
|
"value",
|
|
286
287
|
"lang"
|
|
287
|
-
],
|
|
288
|
-
...
|
|
289
|
-
...
|
|
288
|
+
], Pe = [
|
|
289
|
+
...z,
|
|
290
|
+
..._e,
|
|
290
291
|
"value",
|
|
291
292
|
"reference",
|
|
292
293
|
"type",
|
|
293
294
|
"track"
|
|
294
|
-
],
|
|
295
|
-
...
|
|
296
|
-
...
|
|
295
|
+
], je = [
|
|
296
|
+
...z,
|
|
297
|
+
..._e,
|
|
297
298
|
"cycle",
|
|
298
299
|
"field",
|
|
299
300
|
"group"
|
|
300
|
-
],
|
|
301
|
-
const t = (r) =>
|
|
301
|
+
], Y = (e) => Object.prototype.toString.call(e) === "[object Object]" && e.value !== void 0, me = (e) => ["string", "boolean", "number"].includes(typeof e), pe = (e) => Y(e) && ((e == null ? void 0 : e.value) === null || Y(e.value) || me(e.value)), Ue = (e) => Object.prototype.toString.call(e) === "[object Object]", fe = (e) => Object.prototype.toString.call(e) === "[object Date]", Ee = (e) => e === null ? !0 : Array.isArray(e) ? e.some(Ee) : me(e) || pe(e) || fe(e), Te = (e) => {
|
|
302
|
+
const t = (r) => Ue(r) && r.value === void 0 && !!Object.entries(e);
|
|
302
303
|
return Array.isArray(e) ? e.every(Te) : t(e);
|
|
303
|
-
},
|
|
304
|
-
const r = e.filter((
|
|
304
|
+
}, $e = (e, t) => e + (t.length > 1 ? "s" : ""), he = (e, t) => {
|
|
305
|
+
const r = e.filter((s) => !t.includes(s));
|
|
305
306
|
if (r.length)
|
|
306
307
|
throw Error(
|
|
307
|
-
`Unsupported ${
|
|
308
|
+
`Unsupported ${$e("key", r)} (${r.join(", ")})`
|
|
308
309
|
);
|
|
309
|
-
},
|
|
310
|
+
}, Ae = (e) => {
|
|
310
311
|
if (Array.isArray(e))
|
|
311
312
|
throw Error("Invalid value inside value object, cannot be array");
|
|
312
|
-
return [void 0, null].includes(e) ? {} :
|
|
313
|
-
},
|
|
314
|
-
if (
|
|
313
|
+
return [void 0, null].includes(e) ? {} : fe(e) ? { value: e.toISOString() } : { value: e.toString() };
|
|
314
|
+
}, Ge = (e) => {
|
|
315
|
+
if (he(Object.keys(e), We), Object.keys(e).length === 0)
|
|
315
316
|
throw Error("Invalid value object, cannot be empty object");
|
|
316
317
|
if (typeof (e == null ? void 0 : e.value) == "string")
|
|
317
318
|
return e;
|
|
318
|
-
const t =
|
|
319
|
+
const t = Ae(e == null ? void 0 : e.value);
|
|
319
320
|
return { ...e, ...t !== void 0 ? t : {} };
|
|
320
|
-
},
|
|
321
|
+
}, J = (e) => {
|
|
321
322
|
if (![void 0, null].includes(e))
|
|
322
|
-
return Array.isArray(e) ? e.flatMap(
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
const t =
|
|
323
|
+
return Array.isArray(e) ? e.flatMap(J) : Y(e) ? Ge(e) : Ae(e);
|
|
324
|
+
}, Ve = (e) => {
|
|
325
|
+
he(Object.keys(e), Pe);
|
|
326
|
+
const t = J(e == null ? void 0 : e.value);
|
|
326
327
|
if (t === void 0) {
|
|
327
|
-
const { value: r, ...
|
|
328
|
-
return
|
|
328
|
+
const { value: r, ...s } = e;
|
|
329
|
+
return s;
|
|
329
330
|
}
|
|
330
331
|
return {
|
|
331
332
|
...e,
|
|
332
333
|
value: [...Array.isArray(t) ? t : [t]]
|
|
333
334
|
};
|
|
334
|
-
},
|
|
335
|
-
if (
|
|
336
|
-
return
|
|
337
|
-
const t =
|
|
335
|
+
}, ke = (e) => {
|
|
336
|
+
if (pe(e))
|
|
337
|
+
return Ve(e);
|
|
338
|
+
const t = J(e);
|
|
338
339
|
if (t !== void 0)
|
|
339
340
|
return { value: [...Array.isArray(t) ? t : [t]] };
|
|
340
|
-
},
|
|
341
|
+
}, Ie = (e) => {
|
|
341
342
|
const t = [], r = [];
|
|
342
|
-
let
|
|
343
|
-
return Object.entries(e || {}).forEach(([o,
|
|
344
|
-
if (
|
|
345
|
-
|
|
346
|
-
else if (
|
|
343
|
+
let s = {};
|
|
344
|
+
return Object.entries(e || {}).forEach(([o, n]) => {
|
|
345
|
+
if (je.includes(o))
|
|
346
|
+
s = { ...s, [o]: n };
|
|
347
|
+
else if (Ee(n))
|
|
347
348
|
try {
|
|
348
|
-
r.push({ name: o, ...
|
|
349
|
+
r.push({ name: o, ...ke(n) });
|
|
349
350
|
} catch (a) {
|
|
350
351
|
throw Error(a.message + (o ? ` for field "${o}"` : ""));
|
|
351
352
|
}
|
|
352
|
-
else if (Te(
|
|
353
|
-
(Array.isArray(
|
|
354
|
-
t.push({ name: o, ...
|
|
353
|
+
else if (Te(n))
|
|
354
|
+
(Array.isArray(n) ? n : [n]).forEach((a) => {
|
|
355
|
+
t.push({ name: o, ...Ie(a) });
|
|
355
356
|
});
|
|
356
357
|
else
|
|
357
358
|
throw Error(`Unhandled value for "${o}"`);
|
|
358
359
|
}), {
|
|
359
|
-
...
|
|
360
|
+
...s,
|
|
360
361
|
...t.length > 0 ? { group: t } : {},
|
|
361
362
|
...r.length > 0 ? { field: r } : {}
|
|
362
363
|
};
|
|
363
|
-
},
|
|
364
|
-
const { start: t = "-INF", end: r = "+INF", base:
|
|
364
|
+
}, He = (e) => {
|
|
365
|
+
const { start: t = "-INF", end: r = "+INF", base: s = void 0, ...o } = e, { group: n, field: a } = Ie(o);
|
|
365
366
|
return {
|
|
366
|
-
...
|
|
367
|
+
...n ? { group: n } : {},
|
|
367
368
|
...a ? { field: a } : {},
|
|
368
369
|
start: t.toString(),
|
|
369
370
|
end: r.toString(),
|
|
370
|
-
...
|
|
371
|
+
...s ? { base: s } : {}
|
|
371
372
|
};
|
|
372
|
-
},
|
|
373
|
-
timespan: (Array.isArray(e) ? e : [e || {}]).map((t) =>
|
|
374
|
-
}),
|
|
375
|
-
var o,
|
|
376
|
-
const [r] = ((o = e == null ? void 0 : e.start) == null ? void 0 : o.split("@")) || [], [
|
|
377
|
-
return Number(r) < Number(
|
|
378
|
-
},
|
|
373
|
+
}, Qt = (e) => ({
|
|
374
|
+
timespan: (Array.isArray(e) ? e : [e || {}]).map((t) => He(t))
|
|
375
|
+
}), Ye = (e, t) => {
|
|
376
|
+
var o, n;
|
|
377
|
+
const [r] = ((o = e == null ? void 0 : e.start) == null ? void 0 : o.split("@")) || [], [s] = ((n = t == null ? void 0 : t.start) == null ? void 0 : n.split("@")) || [];
|
|
378
|
+
return Number(r) < Number(s) ? -1 : Number(r) > Number(s) ? 1 : 0;
|
|
379
|
+
}, D = (e) => Array.isArray(e) ? e : e && [e] || [], oe = (e) => Array.isArray(e) ? e.pop() : e, Ke = (e) => (e == null ? void 0 : e.every((t) => typeof t == "string")) || !1, Oe = {
|
|
379
380
|
includeValueAttributes: !1
|
|
380
381
|
};
|
|
381
|
-
function
|
|
382
|
+
function ze(e, t) {
|
|
382
383
|
const { includeValueAttributes: r } = {
|
|
383
384
|
...Oe,
|
|
384
385
|
...t || {}
|
|
385
386
|
};
|
|
386
387
|
if (r === !1)
|
|
387
388
|
return e == null ? void 0 : e.value;
|
|
388
|
-
const { value:
|
|
389
|
+
const { value: s, ...o } = e;
|
|
389
390
|
return { ...r === !0 && o || Array.isArray(r) && Object.fromEntries(
|
|
390
391
|
Object.entries(o).filter(
|
|
391
392
|
([a]) => r.includes(a)
|
|
392
393
|
)
|
|
393
|
-
) || {}, value:
|
|
394
|
+
) || {}, value: s };
|
|
394
395
|
}
|
|
395
|
-
const
|
|
396
|
+
const Se = {
|
|
396
397
|
...Oe,
|
|
397
398
|
joinValue: void 0,
|
|
398
399
|
arrayOnSingleValue: !0
|
|
399
400
|
};
|
|
400
|
-
function
|
|
401
|
-
const { joinValue: r, arrayOnSingleValue:
|
|
402
|
-
...
|
|
401
|
+
function Je(e, t) {
|
|
402
|
+
const { joinValue: r, arrayOnSingleValue: s, ...o } = {
|
|
403
|
+
...Se,
|
|
403
404
|
...t || {}
|
|
404
|
-
},
|
|
405
|
-
return
|
|
405
|
+
}, n = e == null ? void 0 : e.map((a) => ze(a, o));
|
|
406
|
+
return Ke(n) && r ? n == null ? void 0 : n.join(r) : s !== !0 && (n == null ? void 0 : n.length) <= 1 ? n == null ? void 0 : n[0] : n;
|
|
406
407
|
}
|
|
407
|
-
const
|
|
408
|
+
const ge = {
|
|
408
409
|
includeFieldAttributes: !1,
|
|
409
|
-
...
|
|
410
|
-
},
|
|
411
|
-
const { includeFieldAttributes: r, ...
|
|
412
|
-
...
|
|
410
|
+
...Se
|
|
411
|
+
}, Xe = (e, t) => {
|
|
412
|
+
const { includeFieldAttributes: r, ...s } = {
|
|
413
|
+
...ge,
|
|
413
414
|
...t || {}
|
|
414
|
-
}, { value: o, ...
|
|
415
|
-
Object.entries(
|
|
415
|
+
}, { value: o, ...n } = e, a = Je(o, s), i = r === !0 && n || Array.isArray(r) && Object.fromEntries(
|
|
416
|
+
Object.entries(n).filter(
|
|
416
417
|
([c]) => r.includes(c)
|
|
417
418
|
)
|
|
418
419
|
) || {};
|
|
419
420
|
return r ? { ...i, value: a } : a;
|
|
420
|
-
},
|
|
421
|
-
...
|
|
421
|
+
}, $ = {
|
|
422
|
+
...ge,
|
|
422
423
|
fieldAsList: !1,
|
|
423
424
|
arrayOnSingleField: !1,
|
|
424
425
|
overrideField: void 0
|
|
425
|
-
},
|
|
426
|
+
}, Re = (e, t) => {
|
|
426
427
|
const r = {
|
|
427
|
-
|
|
428
|
+
...$,
|
|
428
429
|
...t || {}
|
|
429
|
-
}, { fieldAsList:
|
|
430
|
+
}, { fieldAsList: s, arrayOnSingleField: o, overrideField: n } = r, a = n === !0 && s === !1, i = {};
|
|
430
431
|
return e == null || e.forEach((c) => {
|
|
431
|
-
const { name:
|
|
432
|
-
|
|
433
|
-
}),
|
|
434
|
-
},
|
|
435
|
-
|
|
432
|
+
const { name: p } = c, d = Xe(c, r), l = o === !0 ? D(d) : d, _ = i[p];
|
|
433
|
+
_ ? a ? i[p] = d : i[p] = [D(_), D(d)].flat() : i[p] = l;
|
|
434
|
+
}), s === !0 ? Object.values(i).flat() : i;
|
|
435
|
+
}, be = {
|
|
436
|
+
...$,
|
|
436
437
|
includeGroupAttributes: !1,
|
|
437
438
|
groupAsList: !1,
|
|
438
439
|
arrayOnSingleGroup: !1,
|
|
439
440
|
overrideGroup: void 0
|
|
440
|
-
},
|
|
441
|
+
}, qe = (e, t) => {
|
|
441
442
|
const r = {
|
|
442
|
-
...
|
|
443
|
+
...be,
|
|
443
444
|
...t || {}
|
|
444
|
-
}, { includeGroupAttributes:
|
|
445
|
+
}, { includeGroupAttributes: s } = r, o = Object.fromEntries(
|
|
445
446
|
Object.entries(r).filter(
|
|
446
|
-
([
|
|
447
|
+
([l]) => Object.keys($).includes(l)
|
|
447
448
|
)
|
|
448
|
-
), { field:
|
|
449
|
+
), { field: n, group: a, ...i } = e, c = n && Re(n, o), p = a && Ne(a, r);
|
|
449
450
|
return {
|
|
450
|
-
...
|
|
451
|
+
...s === !0 && i || Array.isArray(s) && Object.fromEntries(
|
|
451
452
|
Object.entries(i).filter(
|
|
452
|
-
([
|
|
453
|
+
([l]) => s.includes(l)
|
|
453
454
|
)
|
|
454
455
|
) || {},
|
|
455
456
|
...o != null && o.fieldAsList ? c && { field: c } || {} : c,
|
|
456
|
-
...r != null && r.groupAsList ?
|
|
457
|
+
...r != null && r.groupAsList ? p && { group: p } || {} : p
|
|
457
458
|
};
|
|
458
|
-
},
|
|
459
|
-
const r = { ...
|
|
459
|
+
}, X = be, Ne = (e, t) => {
|
|
460
|
+
const r = { ...X, ...t || {} }, { groupAsList: s, arrayOnSingleGroup: o, overrideGroup: n } = r, a = n === !0 && s === !1, i = {};
|
|
460
461
|
return e == null || e.forEach((c) => {
|
|
461
|
-
const { name:
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
].flat() : i[
|
|
466
|
-
}),
|
|
467
|
-
},
|
|
468
|
-
...
|
|
462
|
+
const { name: p } = c, d = qe(c, r), l = o === !0 ? D(d) : d, _ = i[p];
|
|
463
|
+
_ ? a ? i[p] = d : i[p] = [
|
|
464
|
+
D(_),
|
|
465
|
+
D(d)
|
|
466
|
+
].flat() : i[p] = l;
|
|
467
|
+
}), s ? Object.values(i).flat() : i;
|
|
468
|
+
}, De = {
|
|
469
|
+
...X,
|
|
469
470
|
includeTimespanAttributes: !1,
|
|
470
471
|
flat: !1,
|
|
471
472
|
arrayOnSingle: !1,
|
|
472
473
|
arrayOnSingleValue: !0,
|
|
473
474
|
arrayOnSingleGroup: void 0,
|
|
474
475
|
arrayOnSingleField: void 0
|
|
475
|
-
},
|
|
476
|
+
}, Qe = (e, t) => {
|
|
476
477
|
const r = {
|
|
477
|
-
...
|
|
478
|
+
...De,
|
|
478
479
|
...t || {}
|
|
479
|
-
}, { includeTimespanAttributes:
|
|
480
|
+
}, { includeTimespanAttributes: s, arrayOnSingle: o, flat: n } = r, a = Object.fromEntries(
|
|
480
481
|
Object.entries(t).map(([u, m]) => {
|
|
481
|
-
if (Object.keys(
|
|
482
|
-
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(u) && (m !== void 0 ? m : o === !0) ? [u, !0] : ["overrideGroup", "overrideField"].includes(u) && (m !== void 0 ? m :
|
|
482
|
+
if (Object.keys(X).includes(u))
|
|
483
|
+
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(u) && (m !== void 0 ? m : o === !0) ? [u, !0] : ["overrideGroup", "overrideField"].includes(u) && (m !== void 0 ? m : n === !0) ? [u, !0] : [u, m];
|
|
483
484
|
}).filter((u) => !!u)
|
|
484
485
|
), i = Object.fromEntries(
|
|
485
486
|
Object.entries(t).map(([u, m]) => {
|
|
486
|
-
if (Object.keys(
|
|
487
|
-
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(u) && (m !== void 0 ? m : o === !0) ? [u, !0] : ["overrideField"].includes(u) && (m !== void 0 ? m :
|
|
487
|
+
if (Object.keys($).includes(u))
|
|
488
|
+
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(u) && (m !== void 0 ? m : o === !0) ? [u, !0] : ["overrideField"].includes(u) && (m !== void 0 ? m : n === !0) ? [u, !0] : [u, m];
|
|
488
489
|
}).filter((u) => !!u)
|
|
489
|
-
), { field: c, group:
|
|
490
|
+
), { field: c, group: p, ...d } = e || {}, l = c && Re(c, i), _ = p && Ne(p, a);
|
|
490
491
|
return {
|
|
491
|
-
...
|
|
492
|
+
...s === !0 && d || Array.isArray(s) && Object.fromEntries(
|
|
492
493
|
Object.entries(d).filter(
|
|
493
|
-
([u]) =>
|
|
494
|
+
([u]) => s.includes(u)
|
|
494
495
|
)
|
|
495
496
|
) || {},
|
|
496
|
-
...i != null && i.fieldAsList ? { field:
|
|
497
|
-
...a != null && a.groupAsList ? { group:
|
|
497
|
+
...i != null && i.fieldAsList ? { field: l } : l,
|
|
498
|
+
...a != null && a.groupAsList ? { group: _ } : _
|
|
498
499
|
};
|
|
499
|
-
},
|
|
500
|
-
...
|
|
500
|
+
}, q = {
|
|
501
|
+
...De,
|
|
501
502
|
timespanAsList: !1,
|
|
502
503
|
joinTimespan: "_",
|
|
503
504
|
sortTimespan: !1,
|
|
504
505
|
flat: !1,
|
|
505
506
|
flatTimespan: void 0
|
|
506
|
-
},
|
|
507
|
+
}, Me = (e, t) => {
|
|
507
508
|
const r = {
|
|
508
|
-
...
|
|
509
|
+
...q,
|
|
509
510
|
...t || {}
|
|
510
|
-
}, { timespanAsList:
|
|
511
|
-
|
|
512
|
-
const d = (i !== void 0 ? i === !0 : a === !0) &&
|
|
513
|
-
return e == null || e.forEach((
|
|
514
|
-
const { start: f, end: u } =
|
|
515
|
-
|
|
516
|
-
}),
|
|
517
|
-
},
|
|
518
|
-
...
|
|
511
|
+
}, { timespanAsList: s, joinTimespan: o, sortTimespan: n, flat: a, flatTimespan: i, ...c } = r, p = { flat: a, ...c };
|
|
512
|
+
n && e.sort(Ye);
|
|
513
|
+
const d = (i !== void 0 ? i === !0 : a === !0) && s === !1, l = {};
|
|
514
|
+
return e == null || e.forEach((_) => {
|
|
515
|
+
const { start: f, end: u } = _, m = d ? "flat" : [f, u].join(o), E = Qe(_, p), T = l[m];
|
|
516
|
+
T ? d ? f === "-INF" && u === "+INF" ? l[m] = { ...oe(T), ...E } : l[m] = { ...E, ...oe(T) } : l[m] = [...D(T), E] : l[m] = E;
|
|
517
|
+
}), s === !0 ? Object.values(l) : d ? Object.values(l).pop() : l;
|
|
518
|
+
}, Ze = {
|
|
519
|
+
...q,
|
|
519
520
|
includeMetadataAttributes: !1,
|
|
520
521
|
flat: !1
|
|
521
522
|
};
|
|
522
|
-
function
|
|
523
|
+
function et(e, t) {
|
|
523
524
|
const r = {
|
|
524
|
-
...
|
|
525
|
+
...Ze,
|
|
525
526
|
...t || {}
|
|
526
|
-
}, { includeMetadataAttributes:
|
|
527
|
-
Object.entries(t).map(([d,
|
|
528
|
-
if (Object.keys(
|
|
529
|
-
return ["onlyGeneric", "overrideGroup", "overrideField"].includes(d) && (
|
|
527
|
+
}, { includeMetadataAttributes: s, flat: o } = r, { timespan: n = [], ...a } = e || {}, i = Object.fromEntries(
|
|
528
|
+
Object.entries(t).map(([d, l]) => {
|
|
529
|
+
if (Object.keys(q).includes(d))
|
|
530
|
+
return ["onlyGeneric", "overrideGroup", "overrideField"].includes(d) && (l !== void 0 ? l : o === !0) ? [d, !0] : [d, l];
|
|
530
531
|
}).filter((d) => !!d)
|
|
531
|
-
), c =
|
|
532
|
-
|
|
532
|
+
), c = Me(
|
|
533
|
+
n,
|
|
533
534
|
i
|
|
534
535
|
);
|
|
535
536
|
return {
|
|
536
|
-
...
|
|
537
|
+
...s === !0 && {
|
|
537
538
|
...a,
|
|
538
539
|
...a.revision ? { revision: a.revision.split(",") } : {}
|
|
539
|
-
} || Array.isArray(
|
|
540
|
-
Object.entries(a).map(([d,
|
|
541
|
-
if (
|
|
540
|
+
} || Array.isArray(s) && Object.fromEntries(
|
|
541
|
+
Object.entries(a).map(([d, l]) => {
|
|
542
|
+
if (s.includes(d))
|
|
542
543
|
return [
|
|
543
544
|
d,
|
|
544
|
-
d === "revision" && typeof
|
|
545
|
+
d === "revision" && typeof l == "string" ? l.split(",") : l
|
|
545
546
|
];
|
|
546
547
|
}).filter((d) => !!d)
|
|
547
548
|
) || {},
|
|
548
549
|
...i != null && i.timespanAsList ? { timespan: c } : c
|
|
549
550
|
};
|
|
550
551
|
}
|
|
551
|
-
const
|
|
552
|
+
const Zt = (e) => {
|
|
552
553
|
const { field: t = [] } = e || {};
|
|
553
|
-
return
|
|
554
|
-
},
|
|
554
|
+
return M(t);
|
|
555
|
+
}, Q = {
|
|
555
556
|
PAL: { denominator: 25, numerator: 1 },
|
|
556
557
|
NTSC: { denominator: 3e4, numerator: 1001 },
|
|
557
558
|
NTSC30: { denominator: 30, numerator: 1 },
|
|
@@ -559,7 +560,7 @@ const xt = (e) => {
|
|
|
559
560
|
59.94: { denominator: 6e4, numerator: 1001 },
|
|
560
561
|
23.976: { denominator: 48e3, numerator: 2002 },
|
|
561
562
|
23.98: { denominator: 48e3, numerator: 2002 }
|
|
562
|
-
},
|
|
563
|
+
}, se = Object.keys(Q), ne = {
|
|
563
564
|
toText: {
|
|
564
565
|
constant: !1,
|
|
565
566
|
fraction: !1
|
|
@@ -569,7 +570,7 @@ const xt = (e) => {
|
|
|
569
570
|
rounded: !1
|
|
570
571
|
}
|
|
571
572
|
};
|
|
572
|
-
class
|
|
573
|
+
class S {
|
|
573
574
|
/**
|
|
574
575
|
* Constructor for TimeBase
|
|
575
576
|
*
|
|
@@ -577,8 +578,8 @@ class I {
|
|
|
577
578
|
*/
|
|
578
579
|
constructor(t) {
|
|
579
580
|
this.numerator = 1, this.denominator = 1;
|
|
580
|
-
const { numerator: r = 1, denominator:
|
|
581
|
-
this.numerator = Number(r), this.denominator = Number(
|
|
581
|
+
const { numerator: r = 1, denominator: s = 1 } = t || {};
|
|
582
|
+
this.numerator = Number(r), this.denominator = Number(s);
|
|
582
583
|
}
|
|
583
584
|
/**
|
|
584
585
|
* Get TimeBase in a constant representation (e.g. "PAL") if possible, otherwise undefined
|
|
@@ -586,9 +587,9 @@ class I {
|
|
|
586
587
|
*/
|
|
587
588
|
toConstant() {
|
|
588
589
|
let t;
|
|
589
|
-
return Object.entries(
|
|
590
|
-
const [
|
|
591
|
-
return
|
|
590
|
+
return Object.entries(Q).find((r) => {
|
|
591
|
+
const [s, o] = r, { numerator: n, denominator: a } = o;
|
|
592
|
+
return n === this.numerator && a === this.denominator ? (t = s, !0) : !1;
|
|
592
593
|
}), t;
|
|
593
594
|
}
|
|
594
595
|
/**
|
|
@@ -603,13 +604,13 @@ class I {
|
|
|
603
604
|
* @returns Text representation of the TimeBase
|
|
604
605
|
*/
|
|
605
606
|
toText(t) {
|
|
606
|
-
const { constant: r, fraction:
|
|
607
|
+
const { constant: r, fraction: s } = { ...ne.toText, ...t };
|
|
607
608
|
if (r) {
|
|
608
|
-
const
|
|
609
|
-
if (
|
|
610
|
-
return
|
|
609
|
+
const n = this.toConstant();
|
|
610
|
+
if (n)
|
|
611
|
+
return n;
|
|
611
612
|
}
|
|
612
|
-
return
|
|
613
|
+
return s || this.numerator > 1 ? [this.denominator, this.numerator].join(":") : String(this.denominator);
|
|
613
614
|
}
|
|
614
615
|
/**
|
|
615
616
|
* Output TimeBase as frame rate (by default max 16 decimal places)
|
|
@@ -627,8 +628,8 @@ class I {
|
|
|
627
628
|
const r = this.denominator / this.numerator;
|
|
628
629
|
if (Number.isInteger(r))
|
|
629
630
|
return r;
|
|
630
|
-
const { rounded:
|
|
631
|
-
return
|
|
631
|
+
const { rounded: s, fixed: o } = { ...ne.toRate, ...t || {} };
|
|
632
|
+
return s ? Math.round(r) : o === !0 || typeof o == "number" ? Number(r.toFixed(typeof o == "boolean" ? 2 : o)) : r;
|
|
632
633
|
}
|
|
633
634
|
/**
|
|
634
635
|
* Get TimeBase in a object representation
|
|
@@ -650,39 +651,39 @@ class I {
|
|
|
650
651
|
return console.warn("Deprecated - use toObject instead"), this.toObject();
|
|
651
652
|
}
|
|
652
653
|
}
|
|
653
|
-
const
|
|
654
|
+
const Z = (e) => {
|
|
654
655
|
if (e === void 0)
|
|
655
|
-
return new
|
|
656
|
+
return new S();
|
|
656
657
|
if (typeof e == "number")
|
|
657
|
-
return new
|
|
658
|
+
return new S({ denominator: e });
|
|
658
659
|
if (typeof e == "string" && e.includes(":")) {
|
|
659
660
|
const [t, r] = e.split(":");
|
|
660
|
-
return new
|
|
661
|
+
return new S({ denominator: t, numerator: r });
|
|
661
662
|
}
|
|
662
|
-
if (
|
|
663
|
-
return new
|
|
663
|
+
if (se.includes(e))
|
|
664
|
+
return new S(Q[e]);
|
|
664
665
|
if (!["string", "number"].includes(typeof e) || Number.isNaN(Number(e)))
|
|
665
666
|
throw new Error(
|
|
666
|
-
`timeBaseText must be a number or ${
|
|
667
|
+
`timeBaseText must be a number or ${se.join(",")} - is ${JSON.stringify(
|
|
667
668
|
e
|
|
668
669
|
)}`
|
|
669
670
|
);
|
|
670
|
-
return new
|
|
671
|
-
},
|
|
671
|
+
return new S({ denominator: Number(e) });
|
|
672
|
+
}, B = (e) => new S(e), j = (e) => e instanceof S ? e : typeof e == "string" || typeof e == "number" ? Z(e) : B(e), ee = (e) => {
|
|
672
673
|
const t = e.toConstant();
|
|
673
674
|
return t === "59.94" && 4 || ["NTSC", "29.97"].includes(t) && 2 || void 0;
|
|
674
|
-
}, Fe = (e) =>
|
|
675
|
-
const { samples: t, timeBase: r } = e,
|
|
676
|
-
if (!
|
|
675
|
+
}, Fe = (e) => ee(e) > 0, ie = (e) => {
|
|
676
|
+
const { samples: t, timeBase: r } = e, s = ee(r);
|
|
677
|
+
if (!s)
|
|
677
678
|
return 0;
|
|
678
|
-
const o = r.toRate({ rounded: !0 }),
|
|
679
|
+
const o = r.toRate({ rounded: !0 }), n = 60 * o, a = 60 * o - s, i = 10 * (n - s) + s, c = Math.floor((t + 1) / i), p = Math.max(
|
|
679
680
|
0,
|
|
680
|
-
(t + 1) % i -
|
|
681
|
+
(t + 1) % i - n
|
|
681
682
|
), d = Math.floor(
|
|
682
|
-
|
|
683
|
-
),
|
|
684
|
-
return c * 9 *
|
|
685
|
-
},
|
|
683
|
+
p / a
|
|
684
|
+
), _ = p % a > 0 ? s : 0;
|
|
685
|
+
return c * 9 * s + d * s + _;
|
|
686
|
+
}, V = {
|
|
686
687
|
conformTimeBase: {
|
|
687
688
|
dropFrame: void 0,
|
|
688
689
|
frameSeparator: void 0
|
|
@@ -696,7 +697,7 @@ const q = (e) => {
|
|
|
696
697
|
format: void 0
|
|
697
698
|
}
|
|
698
699
|
};
|
|
699
|
-
class
|
|
700
|
+
class R {
|
|
700
701
|
/**
|
|
701
702
|
* Constructor for TimeCode
|
|
702
703
|
*
|
|
@@ -704,16 +705,16 @@ class g {
|
|
|
704
705
|
* @param options Options for the timeCode
|
|
705
706
|
*/
|
|
706
707
|
constructor(t, r) {
|
|
707
|
-
this.samples = 0, this.timeBase = new
|
|
708
|
-
const { samples:
|
|
709
|
-
if (
|
|
710
|
-
if (typeof
|
|
711
|
-
this.samples =
|
|
712
|
-
else if (typeof
|
|
713
|
-
|
|
708
|
+
this.samples = 0, this.timeBase = new S();
|
|
709
|
+
const { samples: s, timeBase: o } = t || {};
|
|
710
|
+
if (s !== void 0)
|
|
711
|
+
if (typeof s == "number")
|
|
712
|
+
this.samples = s;
|
|
713
|
+
else if (typeof s == "string")
|
|
714
|
+
s === "-INF" ? this.samples = -1 / 0 : s === "+INF" ? this.samples = 1 / 0 : this.samples = Number(s);
|
|
714
715
|
else
|
|
715
|
-
throw new Error(`samples is not number/string/-Inf/+Inf is: ${
|
|
716
|
-
o !== void 0 && (o instanceof
|
|
716
|
+
throw new Error(`samples is not number/string/-Inf/+Inf is: ${s}`);
|
|
717
|
+
o !== void 0 && (o instanceof S ? this.timeBase = o : this.timeBase = j(o)), this.dropFrame = (r == null ? void 0 : r.dropFrame) ?? Fe(this.timeBase), this.frameSeparator = (r == null ? void 0 : r.frameSeparator) ?? (this.dropFrame ? ";" : ":");
|
|
717
718
|
}
|
|
718
719
|
/**
|
|
719
720
|
* Return this TimeCode added with the supplied timeCodeType
|
|
@@ -733,11 +734,11 @@ class g {
|
|
|
733
734
|
add(t) {
|
|
734
735
|
if (!(t != null && t.timeBase) || (t == null ? void 0 : t.samples) === void 0)
|
|
735
736
|
throw Error("Invalid timeCodeType, cannot be added");
|
|
736
|
-
const { numerator: r, denominator:
|
|
737
|
+
const { numerator: r, denominator: s } = (t == null ? void 0 : t.timeBase) || {};
|
|
737
738
|
let o = t;
|
|
738
|
-
(r !== this.timeBase.numerator ||
|
|
739
|
-
const { samples:
|
|
740
|
-
return new
|
|
739
|
+
(r !== this.timeBase.numerator || s !== this.timeBase.denominator) && (o = t.conformTimeBase(this.timeBase));
|
|
740
|
+
const { samples: n } = o;
|
|
741
|
+
return new R({ samples: this.samples + n, timeBase: this.timeBase });
|
|
741
742
|
}
|
|
742
743
|
/**
|
|
743
744
|
* Return this TimeCode subtracted with the supplied timeCodeType
|
|
@@ -757,33 +758,43 @@ class g {
|
|
|
757
758
|
subtract(t) {
|
|
758
759
|
if (!(t != null && t.timeBase) || (t == null ? void 0 : t.samples) === void 0)
|
|
759
760
|
throw Error("Invalid timeCodeType, cannot be subtracted");
|
|
760
|
-
const { timeBase: { numerator: r, denominator:
|
|
761
|
+
const { timeBase: { numerator: r, denominator: s } = {} } = t;
|
|
761
762
|
let o = t;
|
|
762
|
-
(r !== this.timeBase.numerator ||
|
|
763
|
-
const { samples:
|
|
764
|
-
return new
|
|
763
|
+
(r !== this.timeBase.numerator || s !== this.timeBase.denominator) && (o = t.conformTimeBase(this.timeBase));
|
|
764
|
+
const { samples: n } = o;
|
|
765
|
+
return new R({ samples: this.samples - n, timeBase: this.timeBase });
|
|
765
766
|
}
|
|
766
767
|
/**
|
|
767
768
|
* Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
|
|
768
769
|
*
|
|
769
770
|
* @remarks
|
|
770
|
-
*
|
|
771
|
+
* It floors samples when conforming to a less granular time base (can be changed with `options.mode`)
|
|
772
|
+
*
|
|
771
773
|
* - e.g. "51@50".conformTo("PAL") => "25@PAL" (not "26@PAL")
|
|
772
774
|
*
|
|
773
775
|
* @param timeBase The TimeBase it should conform the TimeCode to
|
|
774
|
-
* @param options Explicitly set
|
|
776
|
+
* @param options Explicitly set conform options, by default these are derived from `timeBase`
|
|
775
777
|
* @returns A new TimeCode instance with the conformTo timeBase applied
|
|
776
778
|
*/
|
|
777
779
|
conformTimeBase(t, r) {
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
780
|
+
const s = t instanceof S ? t : j(t), o = (r == null ? void 0 : r.roundingMode) ?? "floor";
|
|
781
|
+
if (!["floor", "ceil", "round"].includes(o))
|
|
782
|
+
throw Error(
|
|
783
|
+
`Invalid mode selection "${o}". Has to be one of "${[
|
|
784
|
+
"floor",
|
|
785
|
+
"ceil",
|
|
786
|
+
"round"
|
|
787
|
+
].join(", ")}"`
|
|
788
|
+
);
|
|
789
|
+
const n = Math[o](
|
|
790
|
+
this.samples / (this.timeBase.toRate({ fixed: !1 }) / s.toRate({ fixed: !1 }))
|
|
791
|
+
), a = { ...V.conformTimeBase, ...r || {} };
|
|
792
|
+
return new R(
|
|
782
793
|
{
|
|
783
|
-
samples:
|
|
784
|
-
timeBase:
|
|
794
|
+
samples: n,
|
|
795
|
+
timeBase: s
|
|
785
796
|
},
|
|
786
|
-
|
|
797
|
+
a
|
|
787
798
|
);
|
|
788
799
|
}
|
|
789
800
|
/**
|
|
@@ -799,7 +810,7 @@ class g {
|
|
|
799
810
|
*/
|
|
800
811
|
toText(t) {
|
|
801
812
|
let r = `${this.samples}`;
|
|
802
|
-
const
|
|
813
|
+
const s = { ...V.toText, ...t || {} }, o = this.timeBase.toText(s);
|
|
803
814
|
return (t != null && t.includeTimeBaseForSeconds || !["1", "1:1"].includes(o)) && (r = [this.samples, o].join("@")), r;
|
|
804
815
|
}
|
|
805
816
|
/**
|
|
@@ -818,14 +829,14 @@ class g {
|
|
|
818
829
|
seconds: 1 / 0,
|
|
819
830
|
frames: 1 / 0
|
|
820
831
|
};
|
|
821
|
-
const t = this.samples + (this.dropFrame ?
|
|
832
|
+
const t = this.samples + (this.dropFrame ? ie(this) : 0);
|
|
822
833
|
let r = this.timeBase.toRate({ rounded: !0 });
|
|
823
834
|
["23.976", "23.98"].includes(this.timeBase.toConstant()) && (r = this.timeBase.toRate({ fixed: !0 }));
|
|
824
|
-
const
|
|
835
|
+
const s = Math.floor(t / (3600 * r)), o = Math.floor(t / (60 * r)) % 60, n = Math.floor(t / r) % 60, a = Math.floor(t % r);
|
|
825
836
|
return {
|
|
826
|
-
hours:
|
|
837
|
+
hours: s,
|
|
827
838
|
minutes: o,
|
|
828
|
-
seconds:
|
|
839
|
+
seconds: n,
|
|
829
840
|
frames: a
|
|
830
841
|
};
|
|
831
842
|
}
|
|
@@ -837,10 +848,10 @@ class g {
|
|
|
837
848
|
* @returns Time for the time code
|
|
838
849
|
*/
|
|
839
850
|
toTime() {
|
|
840
|
-
const t = this.samples +
|
|
851
|
+
const t = this.samples + ie(this), { hours: r, minutes: s, seconds: o } = this.toUnits(), n = this.timeBase.toRate({ rounded: !0 }), a = t % n, i = Math.floor(1e3 * a / n), c = a / n;
|
|
841
852
|
return {
|
|
842
853
|
hours: r,
|
|
843
|
-
minutes:
|
|
854
|
+
minutes: s,
|
|
844
855
|
seconds: o,
|
|
845
856
|
milliseconds: i,
|
|
846
857
|
partialSeconds: c
|
|
@@ -851,9 +862,9 @@ class g {
|
|
|
851
862
|
*
|
|
852
863
|
* @returns Total seconds for the time code
|
|
853
864
|
*/
|
|
854
|
-
toSeconds() {
|
|
855
|
-
const { numerator:
|
|
856
|
-
return Math.round(1e3 *
|
|
865
|
+
toSeconds(t) {
|
|
866
|
+
const { numerator: r, denominator: s } = this.timeBase, o = +(this.samples * r / s);
|
|
867
|
+
return t != null && t.round ? Math.round(1e3 * o) / 1e3 : o;
|
|
857
868
|
}
|
|
858
869
|
/**
|
|
859
870
|
* Get TimeCode in a duration representation
|
|
@@ -875,55 +886,55 @@ class g {
|
|
|
875
886
|
* @returns Duration representation of the TimeCode
|
|
876
887
|
*/
|
|
877
888
|
toDuration(t) {
|
|
878
|
-
const { format: r } = { ...
|
|
879
|
-
let { minutes:
|
|
889
|
+
const { format: r } = { ...V.toDuration, ...t || {} }, { hours: s, ...o } = this.toTime();
|
|
890
|
+
let { minutes: n, seconds: a, milliseconds: i } = o;
|
|
880
891
|
if (r && typeof r != "string")
|
|
881
892
|
throw Error("format has to be a string");
|
|
882
|
-
const c = (
|
|
893
|
+
const c = (_, f) => !r.includes(_) || !f.some((u) => r.includes(u) && r.lastIndexOf(_) > r.indexOf(u));
|
|
883
894
|
if (r && !(c("h", ["m", "s", "S"]) && c("m", ["s", "S"]) && c("s", ["S"])))
|
|
884
895
|
throw Error("format order is unsupported (has to be h, m, s then S)");
|
|
885
896
|
if (!r)
|
|
886
|
-
return `${
|
|
887
|
-
const
|
|
888
|
-
let u =
|
|
897
|
+
return `${s > 0 ? `${s}:${`${n}`.padStart(2, "0")}` : n}:${`${a}`.padStart(2, "0")}`;
|
|
898
|
+
const p = (_, f) => {
|
|
899
|
+
let u = _;
|
|
889
900
|
for (; f[u] === f[u + 1]; )
|
|
890
901
|
u += 1;
|
|
891
|
-
return u -
|
|
892
|
-
}, d = ["h", "m", "s", "S"],
|
|
893
|
-
return [...r].forEach((
|
|
894
|
-
switch (
|
|
902
|
+
return u - _ + 1;
|
|
903
|
+
}, d = ["h", "m", "s", "S"], l = [];
|
|
904
|
+
return [...r].forEach((_, f, u) => {
|
|
905
|
+
switch (_) {
|
|
895
906
|
case "h": {
|
|
896
907
|
if (u[f - 1] === "h")
|
|
897
908
|
break;
|
|
898
|
-
const m =
|
|
899
|
-
|
|
909
|
+
const m = p(f, u);
|
|
910
|
+
l.push(`${s}`.padStart(m, "0")), d.includes(u[f + m]) && l.push(":");
|
|
900
911
|
break;
|
|
901
912
|
}
|
|
902
913
|
case "m": {
|
|
903
914
|
if (u[f - 1] === "m")
|
|
904
915
|
break;
|
|
905
|
-
const m =
|
|
906
|
-
r.includes("h") || (
|
|
916
|
+
const m = p(f, u);
|
|
917
|
+
r.includes("h") || (n += s * 60), l.push(`${n}`.padStart(m, "0")), d.includes(u[f + m]) && l.push(":");
|
|
907
918
|
break;
|
|
908
919
|
}
|
|
909
920
|
case "s": {
|
|
910
921
|
if (u[f - 1] === "s")
|
|
911
922
|
break;
|
|
912
|
-
const m =
|
|
913
|
-
r.includes("m") || (a +=
|
|
923
|
+
const m = p(f, u);
|
|
924
|
+
r.includes("m") || (a += n * 60), l.push(`${a}`.padStart(m, "0")), d.includes(u[f + m]) && l.push(".");
|
|
914
925
|
break;
|
|
915
926
|
}
|
|
916
927
|
case "S": {
|
|
917
928
|
if (u[f - 1] === "S")
|
|
918
929
|
break;
|
|
919
|
-
const m =
|
|
920
|
-
r.includes("s") || (i += a * 1e3),
|
|
930
|
+
const m = p(f, u);
|
|
931
|
+
r.includes("s") || (i += a * 1e3), l.push(`${Math.round(i / 10 ** (3 - m))}`.padStart(m, "0"));
|
|
921
932
|
break;
|
|
922
933
|
}
|
|
923
934
|
default:
|
|
924
|
-
|
|
935
|
+
l.push(_);
|
|
925
936
|
}
|
|
926
|
-
}),
|
|
937
|
+
}), l.join("");
|
|
927
938
|
}
|
|
928
939
|
/**
|
|
929
940
|
* Get TimeCode in a smpte representation
|
|
@@ -933,12 +944,12 @@ class g {
|
|
|
933
944
|
toSmpte() {
|
|
934
945
|
if (this.samples === -1 / 0)
|
|
935
946
|
return "00:00:00:00";
|
|
936
|
-
const { hours: t, minutes: r, seconds:
|
|
947
|
+
const { hours: t, minutes: r, seconds: s, frames: o } = this.toUnits(), n = [
|
|
937
948
|
t.toFixed().padStart(2, "0"),
|
|
938
949
|
r.toFixed().padStart(2, "0"),
|
|
939
|
-
|
|
950
|
+
s.toFixed().padStart(2, "0")
|
|
940
951
|
].join(":"), a = Math.max(2, `${this.timeBase.toRate({ rounded: !0 }) - 1}`.length);
|
|
941
|
-
return [
|
|
952
|
+
return [n, `${o}`.padStart(a, "0")].join(this.frameSeparator);
|
|
942
953
|
}
|
|
943
954
|
/**
|
|
944
955
|
* Get TimeCode as a VidiCore TimeCodeType object
|
|
@@ -960,123 +971,123 @@ class g {
|
|
|
960
971
|
return console.warn("Deprecated - use toObject instead"), this.toObject();
|
|
961
972
|
}
|
|
962
973
|
}
|
|
963
|
-
const
|
|
964
|
-
let r = Math.abs(e),
|
|
965
|
-
for (; r &&
|
|
966
|
-
r >
|
|
967
|
-
return r ||
|
|
968
|
-
},
|
|
969
|
-
const { timeBase: r, useGCD:
|
|
970
|
-
if (Number.isNaN(+
|
|
974
|
+
const tt = (e, t) => {
|
|
975
|
+
let r = Math.abs(e), s = Math.abs(t);
|
|
976
|
+
for (; r && s && r !== s; )
|
|
977
|
+
r > s ? [r, s] = [r - s, s] : [r, s] = [r, s - r];
|
|
978
|
+
return r || s;
|
|
979
|
+
}, rt = (e, t) => {
|
|
980
|
+
const { timeBase: r, useGCD: s = !1, roundingMode: o, ...n } = t || {}, a = `${e}`.replace(/,/g, ".");
|
|
981
|
+
if (Number.isNaN(+a))
|
|
971
982
|
throw new Error(`seconds must be digits, is ${e}`);
|
|
972
|
-
let
|
|
973
|
-
if (Number.isInteger(+
|
|
974
|
-
|
|
983
|
+
let i = 1, c;
|
|
984
|
+
if (Number.isInteger(+a))
|
|
985
|
+
c = +a * i;
|
|
975
986
|
else {
|
|
976
|
-
const [,
|
|
977
|
-
|
|
987
|
+
const [, d] = a.split("."), l = Math.min((d == null ? void 0 : d.length) ?? 0, 16);
|
|
988
|
+
i *= 10 ** l, c = Math.round(Number(a) * i);
|
|
978
989
|
}
|
|
979
|
-
if (r === void 0 &&
|
|
980
|
-
const
|
|
981
|
-
|
|
990
|
+
if (r === void 0 && s) {
|
|
991
|
+
const d = tt(i, c);
|
|
992
|
+
c /= d, i /= d;
|
|
982
993
|
}
|
|
983
|
-
const
|
|
984
|
-
{ samples:
|
|
985
|
-
|
|
994
|
+
const p = new R(
|
|
995
|
+
{ samples: c, timeBase: { denominator: i, numerator: 1 } },
|
|
996
|
+
n
|
|
986
997
|
);
|
|
987
|
-
return r !== void 0 ?
|
|
988
|
-
},
|
|
989
|
-
const a =
|
|
998
|
+
return r !== void 0 ? p.conformTimeBase(r, { ...n, roundingMode: o }) : p;
|
|
999
|
+
}, ot = ([e, t, r, s], o, n) => {
|
|
1000
|
+
const a = n.toRate({ rounded: !0 }), i = ee(n);
|
|
990
1001
|
if (o === 0 || !i)
|
|
991
1002
|
return 0;
|
|
992
|
-
const c = t % 10 !== 0,
|
|
993
|
-
if (
|
|
1003
|
+
const c = t % 10 !== 0, p = c && r === 0, d = e * (3600 * a - 54 * i), l = t * 60 * a - (t - Math.ceil(t / 10)) * i, _ = r * a - (c && r > 1 ? i : 0);
|
|
1004
|
+
if (p && s < i)
|
|
994
1005
|
throw new Error(
|
|
995
|
-
`Frame does not exist for ${
|
|
1006
|
+
`Frame does not exist for ${n.toConstant() || n.toRate()} drop-frame`
|
|
996
1007
|
);
|
|
997
|
-
const f =
|
|
1008
|
+
const f = p ? s - i : s, u = d + l + _ + f;
|
|
998
1009
|
return o - u;
|
|
999
|
-
},
|
|
1000
|
-
const [
|
|
1001
|
-
return c - (r ?
|
|
1002
|
-
},
|
|
1010
|
+
}, k = (e, t, r) => {
|
|
1011
|
+
const [s, o, n, a] = e, i = t.toRate({ rounded: !0 }), c = s * 3600 * i + o * 60 * i + n * i + a;
|
|
1012
|
+
return c - (r ? ot(e, c, t) : 0);
|
|
1013
|
+
}, st = (e) => {
|
|
1003
1014
|
const [t] = (e == null ? void 0 : e.match(/[^0-9:\-_]/)) || [];
|
|
1004
1015
|
let r = [];
|
|
1005
1016
|
if (t) {
|
|
1006
|
-
const [o,
|
|
1007
|
-
r = [...o.split(":"),
|
|
1017
|
+
const [o, n] = e.split(t);
|
|
1018
|
+
r = [...o.split(":"), n];
|
|
1008
1019
|
} else
|
|
1009
1020
|
r = e.split(":");
|
|
1010
1021
|
if (r.length !== 4)
|
|
1011
1022
|
throw new Error('Invalid format, must be "##:##:##:##');
|
|
1012
1023
|
if (r.some((o) => Number.isNaN(o)))
|
|
1013
1024
|
throw new Error("Invalid format, values must be numbers");
|
|
1014
|
-
const
|
|
1025
|
+
const s = t || ":";
|
|
1015
1026
|
return {
|
|
1016
1027
|
smpteValues: r.map(Number),
|
|
1017
|
-
smpteFrameSeparator:
|
|
1028
|
+
smpteFrameSeparator: s
|
|
1018
1029
|
};
|
|
1019
|
-
},
|
|
1030
|
+
}, nt = ["error", "add", "ignore"], it = {
|
|
1020
1031
|
exceedingMode: "error",
|
|
1021
1032
|
timeBase: void 0,
|
|
1022
1033
|
dropFrame: void 0,
|
|
1023
1034
|
frameSeparator: void 0
|
|
1024
|
-
},
|
|
1025
|
-
const { exceedingMode: r, timeBase:
|
|
1035
|
+
}, at = (e, t) => {
|
|
1036
|
+
const { exceedingMode: r, timeBase: s, ...o } = { ...it, ...t };
|
|
1026
1037
|
if ([null, void 0].includes(e))
|
|
1027
1038
|
throw new Error("smpte cannot be undefined or null");
|
|
1028
1039
|
if (typeof e != "string")
|
|
1029
1040
|
throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);
|
|
1030
|
-
const { smpteValues:
|
|
1041
|
+
const { smpteValues: n, smpteFrameSeparator: a } = st(e), i = j(s), c = {
|
|
1031
1042
|
...o,
|
|
1032
1043
|
frameSeparator: (o == null ? void 0 : o.frameSeparator) || a,
|
|
1033
1044
|
...(o == null ? void 0 : o.dropFrame) === void 0 ? {
|
|
1034
|
-
dropFrame:
|
|
1045
|
+
dropFrame: s !== void 0 ? Fe(i) : [";", ","].includes(a)
|
|
1035
1046
|
} : {}
|
|
1036
|
-
},
|
|
1037
|
-
if (
|
|
1047
|
+
}, p = i.toRate({ rounded: !0 }), d = Math.max(0, p - 1);
|
|
1048
|
+
if (n.some((_) => _ < 0))
|
|
1038
1049
|
throw new Error("Negative values are not supported");
|
|
1039
|
-
let
|
|
1050
|
+
let l;
|
|
1040
1051
|
switch (r) {
|
|
1041
1052
|
case "error": {
|
|
1042
|
-
const [
|
|
1043
|
-
if (
|
|
1053
|
+
const [_, f, u, m] = n;
|
|
1054
|
+
if (_ >= 100 || f >= 60)
|
|
1044
1055
|
throw Error("Minutes has to be less than 60");
|
|
1045
1056
|
if (u >= 60)
|
|
1046
1057
|
throw Error("Seconds has to be less than 60");
|
|
1047
1058
|
if (m > d)
|
|
1048
1059
|
throw Error(`Frames has to be less or equal to ${d}`);
|
|
1049
|
-
|
|
1060
|
+
l = k(n, i, c == null ? void 0 : c.dropFrame);
|
|
1050
1061
|
break;
|
|
1051
1062
|
}
|
|
1052
1063
|
case "ignore": {
|
|
1053
|
-
const [
|
|
1054
|
-
Math.min(100,
|
|
1064
|
+
const [_, f, u, m] = n, E = [
|
|
1065
|
+
Math.min(100, _),
|
|
1055
1066
|
Math.min(59, f),
|
|
1056
1067
|
Math.min(59, u),
|
|
1057
1068
|
Math.min(d, m)
|
|
1058
1069
|
];
|
|
1059
|
-
|
|
1060
|
-
|
|
1070
|
+
l = k(
|
|
1071
|
+
E,
|
|
1061
1072
|
i,
|
|
1062
1073
|
c == null ? void 0 : c.dropFrame
|
|
1063
1074
|
);
|
|
1064
1075
|
break;
|
|
1065
1076
|
}
|
|
1066
1077
|
case "add": {
|
|
1067
|
-
|
|
1078
|
+
l = k(n, i, c == null ? void 0 : c.dropFrame);
|
|
1068
1079
|
break;
|
|
1069
1080
|
}
|
|
1070
1081
|
default:
|
|
1071
|
-
throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(
|
|
1082
|
+
throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(nt)}`);
|
|
1072
1083
|
}
|
|
1073
|
-
return new
|
|
1074
|
-
},
|
|
1084
|
+
return new R({ samples: l, timeBase: i }, c);
|
|
1085
|
+
}, ct = {
|
|
1075
1086
|
timeBase: void 0,
|
|
1076
1087
|
dropFrame: void 0,
|
|
1077
1088
|
frameSeparator: void 0
|
|
1078
|
-
},
|
|
1079
|
-
const { timeBase: r, ...
|
|
1089
|
+
}, U = (e, t) => {
|
|
1090
|
+
const { timeBase: r, ...s } = { ...ct, ...t };
|
|
1080
1091
|
let o;
|
|
1081
1092
|
if (e === void 0)
|
|
1082
1093
|
o = { samples: 0 };
|
|
@@ -1084,41 +1095,40 @@ const Je = (e, t) => {
|
|
|
1084
1095
|
o = { samples: e };
|
|
1085
1096
|
else if (e.includes("@")) {
|
|
1086
1097
|
const [a, i] = e.split("@");
|
|
1087
|
-
o = { samples: Number(a), timeBase:
|
|
1098
|
+
o = { samples: Number(a), timeBase: Z(i) };
|
|
1088
1099
|
} else
|
|
1089
1100
|
e === "-INF" ? o = { samples: -1 / 0 } : e === "+INF" ? o = { samples: 1 / 0 } : o = { samples: Number(e) };
|
|
1090
|
-
if (Number.isNaN(o == null ? void 0 : o.samples) || o.timeBase && !(o.timeBase instanceof
|
|
1101
|
+
if (Number.isNaN(o == null ? void 0 : o.samples) || o.timeBase && !(o.timeBase instanceof S))
|
|
1091
1102
|
throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);
|
|
1092
|
-
const
|
|
1093
|
-
return r ?
|
|
1094
|
-
},
|
|
1103
|
+
const n = new R(o, s);
|
|
1104
|
+
return r ? n.conformTimeBase(j(r), s) : n;
|
|
1105
|
+
}, dt = {
|
|
1095
1106
|
dropFrame: void 0,
|
|
1096
1107
|
frameSeparator: void 0
|
|
1097
|
-
},
|
|
1098
|
-
if (e instanceof
|
|
1108
|
+
}, L = (e, t) => new R(e, { ...dt, ...t }), ut = (e) => !!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/), lt = (e) => !Number.isNaN(Number(e)), x = (e, t) => {
|
|
1109
|
+
if (e instanceof R)
|
|
1099
1110
|
return e;
|
|
1100
1111
|
if (typeof e != "string" && typeof e != "number")
|
|
1101
|
-
return
|
|
1102
|
-
if (typeof e == "string" &&
|
|
1103
|
-
return
|
|
1104
|
-
if (["string", "number"].includes(typeof e) &&
|
|
1105
|
-
return
|
|
1112
|
+
return L(e, t);
|
|
1113
|
+
if (typeof e == "string" && ut(e))
|
|
1114
|
+
return at(e, t);
|
|
1115
|
+
if (["string", "number"].includes(typeof e) && lt(e))
|
|
1116
|
+
return rt(e, t);
|
|
1106
1117
|
if (typeof e == "string")
|
|
1107
|
-
return
|
|
1118
|
+
return U(e, t);
|
|
1108
1119
|
};
|
|
1109
|
-
function
|
|
1110
|
-
const o = e.toFixed().padStart(2, "0"),
|
|
1111
|
-
return `${o}:${
|
|
1120
|
+
function ae({ hours: e = 0, minutes: t = 0, seconds: r = 0, partialSeconds: s = 0 }) {
|
|
1121
|
+
const o = e.toFixed().padStart(2, "0"), n = t.toFixed().padStart(2, "0"), a = r.toFixed().padStart(2, "0"), i = (s * 10).toFixed().padStart(3, "0");
|
|
1122
|
+
return `${o}:${n}:${a}.${i}`;
|
|
1112
1123
|
}
|
|
1113
|
-
const
|
|
1124
|
+
const _t = {
|
|
1114
1125
|
subtitleGroup: "stl_subtitle",
|
|
1115
1126
|
subtitleField: "stl_text"
|
|
1116
|
-
},
|
|
1117
|
-
const { subtitleGroup: r, subtitleField:
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
${ye(o, {
|
|
1127
|
+
}, er = (e, t) => {
|
|
1128
|
+
const { subtitleGroup: r, subtitleField: s } = { ..._t, ...t || {} }, { timespan: o = [] } = e || {};
|
|
1129
|
+
if (o.length === 0)
|
|
1130
|
+
return "";
|
|
1131
|
+
const a = Me(o, {
|
|
1122
1132
|
includeTimespanAttributes: !0,
|
|
1123
1133
|
sortTimespan: !0,
|
|
1124
1134
|
timespanAsList: !0,
|
|
@@ -1127,174 +1137,179 @@ ${ye(o, {
|
|
|
1127
1137
|
}).map((i) => {
|
|
1128
1138
|
const {
|
|
1129
1139
|
start: c,
|
|
1130
|
-
end:
|
|
1131
|
-
[r]: { [
|
|
1140
|
+
end: p,
|
|
1141
|
+
[r]: { [s]: d } = {}
|
|
1132
1142
|
} = (Array.isArray(i) ? i[0] : i) || {};
|
|
1133
1143
|
if (!d)
|
|
1134
1144
|
return "";
|
|
1135
|
-
const
|
|
1136
|
-
return `${
|
|
1137
|
-
})
|
|
1145
|
+
const l = ae(U(c).toTime()), _ = ae(U(p).toTime());
|
|
1146
|
+
return `${l} --> ${_} line:0%\r${d}\r`;
|
|
1147
|
+
});
|
|
1148
|
+
if (a.some((i) => !!i))
|
|
1149
|
+
return `WEBVTT
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
${a.join(`
|
|
1138
1153
|
`)}`;
|
|
1139
|
-
},
|
|
1140
|
-
const r = { ...
|
|
1141
|
-
return e.map((
|
|
1142
|
-
field:
|
|
1143
|
-
name:
|
|
1144
|
-
count:
|
|
1145
|
-
...o === !0 ? { exclude: [
|
|
1146
|
-
} :
|
|
1147
|
-
},
|
|
1154
|
+
}, mt = { count: !0, exclude: !0 }, tr = (e = [], t = {}) => {
|
|
1155
|
+
const r = { ...mt, ...t }, { count: s, exclude: o } = r;
|
|
1156
|
+
return e.map((n) => typeof n == "string" ? {
|
|
1157
|
+
field: n,
|
|
1158
|
+
name: n,
|
|
1159
|
+
count: s,
|
|
1160
|
+
...o === !0 ? { exclude: [n] } : {}
|
|
1161
|
+
} : n);
|
|
1162
|
+
}, rr = (e = []) => e == null ? void 0 : e.map(({ name: t, field: r, count: s, range: o }) => ({
|
|
1148
1163
|
facetName: t,
|
|
1149
1164
|
fieldName: r,
|
|
1150
|
-
count:
|
|
1165
|
+
count: s == null ? void 0 : s.reduce((n, { fieldValue: a, value: i }) => ({ ...n, [a]: i }), {}),
|
|
1151
1166
|
...o ? {
|
|
1152
|
-
range: o.map(({ value:
|
|
1167
|
+
range: o.map(({ value: n, start: a, end: i }) => ({
|
|
1153
1168
|
start: Number.isNaN(+a) ? a : Number(a),
|
|
1154
1169
|
end: Number.isNaN(+i) ? i : Number(i),
|
|
1155
|
-
count: Number(
|
|
1170
|
+
count: Number(n) || 0
|
|
1156
1171
|
}))
|
|
1157
1172
|
} : {}
|
|
1158
|
-
})),
|
|
1173
|
+
})), or = (e = []) => {
|
|
1159
1174
|
const t = {};
|
|
1160
|
-
return e.forEach(({ name: r, field:
|
|
1161
|
-
t[r ||
|
|
1162
|
-
(
|
|
1175
|
+
return e.forEach(({ name: r, field: s, count: o }) => {
|
|
1176
|
+
t[r || s] = o.reduce(
|
|
1177
|
+
(n, { fieldValue: a, value: i }) => ({ ...n, [a]: i }),
|
|
1163
1178
|
{}
|
|
1164
1179
|
);
|
|
1165
1180
|
}), t;
|
|
1166
|
-
},
|
|
1181
|
+
}, ye = {
|
|
1167
1182
|
arrayOnSingle: !0,
|
|
1168
1183
|
joinValue: void 0,
|
|
1169
1184
|
timespanAsList: !1
|
|
1170
|
-
},
|
|
1185
|
+
}, H = (e, t) => {
|
|
1171
1186
|
const {
|
|
1172
1187
|
arrayOnSingle: r = !0,
|
|
1173
|
-
joinValue:
|
|
1188
|
+
joinValue: s = void 0,
|
|
1174
1189
|
timespanAsList: o = !1
|
|
1175
|
-
} = { ...
|
|
1176
|
-
return
|
|
1177
|
-
const { name:
|
|
1190
|
+
} = { ...ye, ...t || {} }, { field: n = [], start: a, end: i } = e || {}, c = o ? { start: a, end: i } : {};
|
|
1191
|
+
return n.reduce((d, l) => {
|
|
1192
|
+
const { name: _, value: f = [] } = l;
|
|
1178
1193
|
if (f.length === 0)
|
|
1179
1194
|
return d;
|
|
1180
1195
|
let u;
|
|
1181
|
-
return r === !1 && f.length === 1 ? [u] = f :
|
|
1196
|
+
return r === !1 && f.length === 1 ? [u] = f : s ? u = f.join(s) : u = f, { ...d, [_]: u };
|
|
1182
1197
|
}, c);
|
|
1183
|
-
},
|
|
1184
|
-
...
|
|
1198
|
+
}, pt = {
|
|
1199
|
+
...ye,
|
|
1185
1200
|
timespanAsList: !1,
|
|
1186
1201
|
joinTimespan: "_",
|
|
1187
1202
|
flat: !1,
|
|
1188
1203
|
flatTimespan: !1
|
|
1189
|
-
},
|
|
1204
|
+
}, sr = (e = [], t) => {
|
|
1190
1205
|
const {
|
|
1191
1206
|
timespanAsList: r,
|
|
1192
|
-
joinTimespan:
|
|
1207
|
+
joinTimespan: s = "_",
|
|
1193
1208
|
flat: o,
|
|
1194
|
-
flatTimespan:
|
|
1209
|
+
flatTimespan: n,
|
|
1195
1210
|
...a
|
|
1196
|
-
} = { ...
|
|
1211
|
+
} = { ...pt, ...t || {} };
|
|
1197
1212
|
return r === !0 ? e.map(
|
|
1198
|
-
(i) =>
|
|
1199
|
-
) : o === !0 ||
|
|
1200
|
-
(i, c) => ({ ...i, ...
|
|
1213
|
+
(i) => H(i, { ...a, timespanAsList: r })
|
|
1214
|
+
) : o === !0 || n === !0 ? e.reduce(
|
|
1215
|
+
(i, c) => ({ ...i, ...H(c, t) }),
|
|
1201
1216
|
{}
|
|
1202
1217
|
) : e.reduce(
|
|
1203
1218
|
(i, c) => ({
|
|
1204
1219
|
...i,
|
|
1205
|
-
[[c.start, c.end].join(
|
|
1220
|
+
[[c.start, c.end].join(s)]: H(
|
|
1206
1221
|
c,
|
|
1207
1222
|
t
|
|
1208
1223
|
)
|
|
1209
1224
|
}),
|
|
1210
1225
|
{}
|
|
1211
1226
|
);
|
|
1212
|
-
},
|
|
1213
|
-
const r =
|
|
1227
|
+
}, ft = (e, t) => {
|
|
1228
|
+
const r = x(t).toSeconds(), { thumbnails: s = {} } = e || {}, { uri: o = [] } = s, n = o.map((i) => {
|
|
1214
1229
|
const c = i.split("/").pop().split("?").shift();
|
|
1215
|
-
return
|
|
1216
|
-
}), a =
|
|
1217
|
-
(i, c,
|
|
1230
|
+
return U(c).toSeconds();
|
|
1231
|
+
}), a = n.reduce(
|
|
1232
|
+
(i, c, p) => Math.abs(c - r) < Math.abs(n[i] - r) ? p : i,
|
|
1218
1233
|
0
|
|
1219
1234
|
);
|
|
1220
1235
|
return o[a];
|
|
1221
|
-
},
|
|
1236
|
+
}, Et = {
|
|
1222
1237
|
includeGroupMetadata: !1,
|
|
1223
1238
|
flatEvents: !1,
|
|
1224
1239
|
includeEntityType: !1,
|
|
1225
1240
|
includeNearestThumbnail: !1
|
|
1226
|
-
},
|
|
1241
|
+
}, Tt = ({
|
|
1227
1242
|
start: e,
|
|
1228
1243
|
end: t,
|
|
1229
1244
|
group: r = [{ id: "unknown", name: "unknown" }]
|
|
1230
1245
|
}) => {
|
|
1231
|
-
const [{ id:
|
|
1232
|
-
return { start: e, end: t, startSeconds:
|
|
1233
|
-
},
|
|
1234
|
-
const { entry: r = [] } = e,
|
|
1235
|
-
...
|
|
1246
|
+
const [{ id: s, name: o }] = r, n = x(e).toSeconds(), a = x(t).toSeconds();
|
|
1247
|
+
return { start: e, end: t, startSeconds: n, endSeconds: a, group: { uuid: s, name: o } };
|
|
1248
|
+
}, nr = (e = {}, t) => {
|
|
1249
|
+
const { entry: r = [] } = e, s = {
|
|
1250
|
+
...Et,
|
|
1236
1251
|
...t || {}
|
|
1237
|
-
}, { includeGroupMetadata: o, flatEvents:
|
|
1238
|
-
const { type: d, item: { metadata:
|
|
1239
|
-
let
|
|
1240
|
-
(
|
|
1252
|
+
}, { includeGroupMetadata: o, flatEvents: n, includeEntityType: a, includeNearestThumbnail: i } = s, c = r.map((p) => {
|
|
1253
|
+
const { type: d, item: { metadata: l = {}, id: _, thumbnails: f = {} } = {}, timespan: u, item: m } = p;
|
|
1254
|
+
let E = u.map(
|
|
1255
|
+
(T) => Tt(T)
|
|
1241
1256
|
);
|
|
1242
|
-
if (i && d === "Item" && f.uri && (
|
|
1243
|
-
const { start: h } =
|
|
1244
|
-
return { ...
|
|
1257
|
+
if (i && d === "Item" && f.uri && (E = E.map((T) => {
|
|
1258
|
+
const { start: h } = T, I = ft(m, x(h));
|
|
1259
|
+
return { ...T, thumbnail: I };
|
|
1245
1260
|
})), o && d === "Item") {
|
|
1246
|
-
const { timespan:
|
|
1247
|
-
(
|
|
1261
|
+
const { timespan: T = [] } = l, h = T.flatMap(
|
|
1262
|
+
(I) => I.group
|
|
1248
1263
|
);
|
|
1249
1264
|
if (h.length > 0) {
|
|
1250
|
-
const
|
|
1265
|
+
const I = E.map((A) => {
|
|
1251
1266
|
const {
|
|
1252
|
-
group: { uuid:
|
|
1253
|
-
} = A, [
|
|
1254
|
-
({ uuid:
|
|
1267
|
+
group: { uuid: O }
|
|
1268
|
+
} = A, [N] = O.split("/"), { field: F = [], group: y = [] } = h.find(
|
|
1269
|
+
({ uuid: b }) => b === N
|
|
1255
1270
|
);
|
|
1256
1271
|
return {
|
|
1257
1272
|
...A,
|
|
1258
1273
|
group: {
|
|
1259
1274
|
...A.group,
|
|
1260
|
-
field:
|
|
1261
|
-
group:
|
|
1275
|
+
field: F,
|
|
1276
|
+
group: y
|
|
1262
1277
|
}
|
|
1263
1278
|
};
|
|
1264
1279
|
});
|
|
1265
1280
|
return {
|
|
1266
1281
|
entityType: "Item",
|
|
1267
|
-
entityId:
|
|
1268
|
-
events:
|
|
1282
|
+
entityId: _,
|
|
1283
|
+
events: I.sort((A, O) => A.startSeconds - O.startSeconds),
|
|
1269
1284
|
...a ? { itemType: m } : {}
|
|
1270
1285
|
};
|
|
1271
1286
|
}
|
|
1272
1287
|
}
|
|
1273
1288
|
return {
|
|
1274
1289
|
entityType: d === "Item" ? "Item" : "Collection",
|
|
1275
|
-
entityId:
|
|
1276
|
-
events:
|
|
1290
|
+
entityId: _,
|
|
1291
|
+
events: E.sort((T, h) => T.startSeconds - h.startSeconds),
|
|
1277
1292
|
...a && d === "Item" ? { itemType: m } : {},
|
|
1278
1293
|
...a && d === "Collection" ? { collectionType: m } : {}
|
|
1279
1294
|
};
|
|
1280
1295
|
});
|
|
1281
|
-
return
|
|
1282
|
-
({ events:
|
|
1296
|
+
return n ? c.flatMap(
|
|
1297
|
+
({ events: p, entityType: d, entityId: l, itemType: _, collectionType: f }) => p.map(
|
|
1283
1298
|
(u) => ({
|
|
1284
1299
|
...u,
|
|
1285
1300
|
entityType: d,
|
|
1286
|
-
entityId:
|
|
1287
|
-
...
|
|
1301
|
+
entityId: l,
|
|
1302
|
+
..._ && { itemType: _ },
|
|
1288
1303
|
...f && { collectionType: f }
|
|
1289
1304
|
})
|
|
1290
1305
|
)
|
|
1291
|
-
).sort((
|
|
1292
|
-
},
|
|
1306
|
+
).sort((p, d) => p.startSeconds - d.startSeconds) : c;
|
|
1307
|
+
}, ir = (e = "NOW") => {
|
|
1293
1308
|
if (e.startsWith("NOW")) {
|
|
1294
1309
|
if (e === "NOW")
|
|
1295
1310
|
return /* @__PURE__ */ new Date();
|
|
1296
|
-
const t = e[3], r = Number(e.match(/(\d+)/)[0]),
|
|
1297
|
-
switch (
|
|
1311
|
+
const t = e[3], r = Number(e.match(/(\d+)/)[0]), s = e.match(/(\d.*)/)[0].replace(/\d/g, ""), o = /* @__PURE__ */ new Date();
|
|
1312
|
+
switch (s) {
|
|
1298
1313
|
case "HOUR":
|
|
1299
1314
|
case "HOURS":
|
|
1300
1315
|
t === "+" && o.setHours(o.getHours() + r), t === "-" && o.setHours(o.getHours() - r);
|
|
@@ -1315,46 +1330,44 @@ ${ye(o, {
|
|
|
1315
1330
|
return o;
|
|
1316
1331
|
}
|
|
1317
1332
|
return new Date(e);
|
|
1318
|
-
},
|
|
1333
|
+
}, G = (e) => {
|
|
1319
1334
|
const { property: t = [], ...r } = e || {};
|
|
1320
|
-
return { ...
|
|
1321
|
-
},
|
|
1322
|
-
var
|
|
1335
|
+
return { ...M(t), ...r };
|
|
1336
|
+
}, ht = (e) => G(e), At = (e) => G(e), It = { kB: "kHz", B: "Hz", mB: "mHz" }, ce = { kB: "kbps", B: "bps", MB: "mbps" }, Ot = (e) => {
|
|
1337
|
+
var E;
|
|
1323
1338
|
const {
|
|
1324
1339
|
timeBase: t,
|
|
1325
1340
|
channelCount: r,
|
|
1326
|
-
codec:
|
|
1341
|
+
codec: s,
|
|
1327
1342
|
mediaInfo: o,
|
|
1328
|
-
bitrate:
|
|
1343
|
+
bitrate: n,
|
|
1329
1344
|
metadata: a
|
|
1330
|
-
} = e, i =
|
|
1345
|
+
} = e, i = ht(o), {
|
|
1331
1346
|
Format: c,
|
|
1332
|
-
Resolution:
|
|
1347
|
+
Resolution: p,
|
|
1333
1348
|
Bit_rate_mode: d
|
|
1334
|
-
} = i,
|
|
1349
|
+
} = i, l = M(a || []), _ = t != null && t.denominator ? ((t == null ? void 0 : t.denominator) || 1) / ((t == null ? void 0 : t.numerator) || 1) : void 0, f = _ !== void 0 ? v(_, {
|
|
1335
1350
|
base: 10,
|
|
1336
1351
|
round: 1,
|
|
1337
|
-
|
|
1338
|
-
symbols: pt
|
|
1352
|
+
symbols: It
|
|
1339
1353
|
}) : void 0;
|
|
1340
1354
|
let u, m;
|
|
1341
|
-
return
|
|
1342
|
-
|
|
1343
|
-
(T = y(s, { exponent: 1, symbols: ae }).split(" kbps")) == null ? void 0 : T[0]
|
|
1355
|
+
return n !== void 0 && (u = v(n, { round: 2, symbols: ce }), m = Number(
|
|
1356
|
+
(E = v(n, { exponent: 1, symbols: ce }).split(" kbps")) == null ? void 0 : E[0]
|
|
1344
1357
|
)), {
|
|
1345
1358
|
audioFormat: c,
|
|
1346
|
-
audioCodec:
|
|
1359
|
+
audioCodec: s,
|
|
1347
1360
|
audioSamplerate: f,
|
|
1348
|
-
audioSamplerateSamples:
|
|
1349
|
-
audioBitDepth:
|
|
1361
|
+
audioSamplerateSamples: _,
|
|
1362
|
+
audioBitDepth: p,
|
|
1350
1363
|
audioBitrate: u,
|
|
1351
1364
|
audioBitrateKbps: m,
|
|
1352
1365
|
audioBitRateMode: d,
|
|
1353
1366
|
audioChannels: r,
|
|
1354
1367
|
audioMediaInfo: i,
|
|
1355
|
-
audioMetadata:
|
|
1368
|
+
audioMetadata: l
|
|
1356
1369
|
};
|
|
1357
|
-
},
|
|
1370
|
+
}, ar = {
|
|
1358
1371
|
/** Just created, not used. */
|
|
1359
1372
|
NONE: "NONE",
|
|
1360
1373
|
/** Discovered or created, not yet marked as finished. */
|
|
@@ -1377,203 +1390,217 @@ ${ye(o, {
|
|
|
1377
1390
|
ARCHIVED: "ARCHIVED",
|
|
1378
1391
|
/** File will be synchronized by multi-site agent. */
|
|
1379
1392
|
AWAITING_SYNC: "AWAITING_SYNC"
|
|
1380
|
-
},
|
|
1393
|
+
}, ve = (e) => {
|
|
1381
1394
|
const {
|
|
1382
1395
|
uri: t = [],
|
|
1383
1396
|
size: r,
|
|
1384
|
-
hash:
|
|
1397
|
+
hash: s,
|
|
1385
1398
|
path: o,
|
|
1386
|
-
id:
|
|
1399
|
+
id: n,
|
|
1387
1400
|
storage: a
|
|
1388
|
-
} = e, [i] = t, c = r !== void 0 ?
|
|
1401
|
+
} = e, [i] = t, c = r !== void 0 ? v(r, { base: 2, standard: "jedec" }) : "", p = (o == null ? void 0 : o.split("/")) || [], d = p.pop() || "", l = p.map((_) => `${_}/`).join("") || void 0;
|
|
1389
1402
|
return {
|
|
1390
1403
|
uri: i,
|
|
1391
|
-
hash:
|
|
1404
|
+
hash: s,
|
|
1392
1405
|
fileSize: c,
|
|
1393
1406
|
fileSizeBytes: r,
|
|
1394
1407
|
path: o,
|
|
1395
1408
|
fileName: d,
|
|
1396
|
-
fileId:
|
|
1409
|
+
fileId: n,
|
|
1397
1410
|
storageId: a,
|
|
1398
|
-
folderPath:
|
|
1411
|
+
folderPath: l
|
|
1399
1412
|
};
|
|
1400
|
-
},
|
|
1401
|
-
const { file: t, mediaInfo: r, metadata:
|
|
1402
|
-
let a = { binaryMetadata: o, binaryMediaInfo:
|
|
1413
|
+
}, St = (e = {}) => {
|
|
1414
|
+
const { file: t, mediaInfo: r, metadata: s = [] } = e, o = M(s), n = G(r);
|
|
1415
|
+
let a = { binaryMetadata: o, binaryMediaInfo: n };
|
|
1403
1416
|
if (t) {
|
|
1404
|
-
const [i] = t, c =
|
|
1417
|
+
const [i] = t, c = ve(i);
|
|
1405
1418
|
a = {
|
|
1406
1419
|
...a,
|
|
1407
1420
|
...c
|
|
1408
1421
|
};
|
|
1409
1422
|
}
|
|
1410
1423
|
return a;
|
|
1411
|
-
},
|
|
1424
|
+
}, gt = (e = {}) => {
|
|
1412
1425
|
const {
|
|
1413
1426
|
mediaInfo: t,
|
|
1414
1427
|
metadata: r,
|
|
1415
|
-
file:
|
|
1428
|
+
file: s,
|
|
1416
1429
|
duration: o,
|
|
1417
|
-
startTimestamp:
|
|
1430
|
+
startTimestamp: n,
|
|
1418
1431
|
startTimecode: a,
|
|
1419
1432
|
timeCodeTimeBase: i
|
|
1420
|
-
} = e, c =
|
|
1421
|
-
let { Format: d } =
|
|
1433
|
+
} = e, c = M(r || []), p = G(t);
|
|
1434
|
+
let { Format: d } = p;
|
|
1422
1435
|
const {
|
|
1423
|
-
Video_Format_List:
|
|
1424
|
-
Audio_Format_List:
|
|
1436
|
+
Video_Format_List: l,
|
|
1437
|
+
Audio_Format_List: _,
|
|
1425
1438
|
Text_Format_List: f
|
|
1426
|
-
} =
|
|
1439
|
+
} = p;
|
|
1427
1440
|
if (d === void 0) {
|
|
1428
1441
|
const { format: m } = e;
|
|
1429
1442
|
d = m, m && m.includes(",") && ([d] = m.split(","));
|
|
1430
1443
|
}
|
|
1431
1444
|
let u = {
|
|
1432
1445
|
containerFormat: d,
|
|
1433
|
-
videoFormat:
|
|
1434
|
-
audioFormat:
|
|
1446
|
+
videoFormat: l,
|
|
1447
|
+
audioFormat: _,
|
|
1435
1448
|
textFormat: f,
|
|
1436
1449
|
containerMetadata: c,
|
|
1437
|
-
containerMediaInfo:
|
|
1450
|
+
containerMediaInfo: p
|
|
1438
1451
|
};
|
|
1439
1452
|
if (c.componentOriginalFilename && (u.originalFilename = c.componentOriginalFilename), o !== void 0 && o.samples !== 0) {
|
|
1440
|
-
const m =
|
|
1453
|
+
const m = L(o);
|
|
1441
1454
|
u.durationTimeCode = m.toObject(), u.duration = m.toDuration();
|
|
1442
1455
|
}
|
|
1443
|
-
if (
|
|
1456
|
+
if (n && (u.startTimestamp = L(n).toObject()), a !== void 0 && i && (u.startTimecode = L({
|
|
1444
1457
|
samples: a,
|
|
1445
1458
|
timeBase: i
|
|
1446
|
-
})),
|
|
1447
|
-
const [m] =
|
|
1459
|
+
})), s) {
|
|
1460
|
+
const [m] = s, E = ve(m);
|
|
1448
1461
|
u = {
|
|
1449
1462
|
...u,
|
|
1450
|
-
...
|
|
1463
|
+
...E
|
|
1451
1464
|
};
|
|
1452
1465
|
}
|
|
1453
1466
|
return u;
|
|
1454
|
-
},
|
|
1455
|
-
var
|
|
1467
|
+
}, de = { kB: "kbps", B: "bps", MB: "mbps" }, Rt = (e = {}) => {
|
|
1468
|
+
var W;
|
|
1456
1469
|
const {
|
|
1457
1470
|
codec: t,
|
|
1458
1471
|
bitrate: r,
|
|
1459
|
-
fieldOrder:
|
|
1472
|
+
fieldOrder: s,
|
|
1460
1473
|
resolution: o,
|
|
1461
|
-
mediaInfo:
|
|
1474
|
+
mediaInfo: n,
|
|
1462
1475
|
metadata: a = []
|
|
1463
|
-
} = e, i =
|
|
1464
|
-
Format:
|
|
1476
|
+
} = e, i = At(n), c = M(a), {
|
|
1477
|
+
Format: p,
|
|
1465
1478
|
"Frame rate": d,
|
|
1466
|
-
"Color space":
|
|
1467
|
-
"Color primaries":
|
|
1479
|
+
"Color space": l,
|
|
1480
|
+
"Color primaries": _,
|
|
1468
1481
|
Colorimetry: f
|
|
1469
1482
|
} = i;
|
|
1470
1483
|
let u;
|
|
1471
|
-
const { averageFrameRate: m, realBaseFrameRate:
|
|
1472
|
-
|
|
1473
|
-
numerator:
|
|
1474
|
-
denominator:
|
|
1475
|
-
}) : d !== void 0 ? u =
|
|
1484
|
+
const { averageFrameRate: m, realBaseFrameRate: E } = e;
|
|
1485
|
+
E !== void 0 ? u = B({
|
|
1486
|
+
numerator: E.denominator,
|
|
1487
|
+
denominator: E.numerator
|
|
1488
|
+
}) : d !== void 0 ? u = Z(d) : m !== void 0 && (u = B({
|
|
1476
1489
|
numerator: m.denominator,
|
|
1477
1490
|
denominator: m.numerator
|
|
1478
1491
|
}));
|
|
1479
|
-
let { "Frame count":
|
|
1480
|
-
if (
|
|
1481
|
-
const { numberOfPackets:
|
|
1482
|
-
|
|
1492
|
+
let { "Frame count": T } = i;
|
|
1493
|
+
if (T === void 0) {
|
|
1494
|
+
const { numberOfPackets: re } = e;
|
|
1495
|
+
re !== void 0 && (T = re.toString());
|
|
1483
1496
|
}
|
|
1484
|
-
let h,
|
|
1485
|
-
|
|
1486
|
-
const { height:
|
|
1487
|
-
let
|
|
1488
|
-
return r !== void 0 && (
|
|
1489
|
-
|
|
1490
|
-
(ee = y(r, { exponent: 2, symbols: ce }).split(" mbps")) == null ? void 0 : ee[0]
|
|
1497
|
+
let h, I, A;
|
|
1498
|
+
T && u && (h = L({ samples: T, timeBase: u }), I = h.timeBase.toConstant() || h.timeBase.toRate(), A = h.toSmpte());
|
|
1499
|
+
const { height: O, width: N } = o || {}, F = K(o), y = `${N}x${O}`;
|
|
1500
|
+
let b, w;
|
|
1501
|
+
return r !== void 0 && (b = v(r, { round: 2, symbols: de }), w = Number(
|
|
1502
|
+
(W = v(r, { exponent: 2, symbols: de }).split(" mbps")) == null ? void 0 : W[0]
|
|
1491
1503
|
)), {
|
|
1492
|
-
videoFormat:
|
|
1493
|
-
dimension:
|
|
1494
|
-
frameRate:
|
|
1495
|
-
height:
|
|
1496
|
-
width:
|
|
1504
|
+
videoFormat: p,
|
|
1505
|
+
dimension: y,
|
|
1506
|
+
frameRate: I,
|
|
1507
|
+
height: O,
|
|
1508
|
+
width: N,
|
|
1497
1509
|
timeBase: u,
|
|
1498
1510
|
timeCode: h,
|
|
1499
1511
|
videoCodec: t,
|
|
1500
1512
|
smpte: A,
|
|
1501
|
-
videoBitrate:
|
|
1502
|
-
videoBitrateMbps:
|
|
1503
|
-
fieldOrder:
|
|
1504
|
-
colorSpace:
|
|
1513
|
+
videoBitrate: b,
|
|
1514
|
+
videoBitrateMbps: w,
|
|
1515
|
+
fieldOrder: s,
|
|
1516
|
+
colorSpace: l,
|
|
1505
1517
|
chromaSubsampling: f,
|
|
1506
|
-
aspectRatio:
|
|
1507
|
-
colorPrimaries:
|
|
1518
|
+
aspectRatio: F,
|
|
1519
|
+
colorPrimaries: _,
|
|
1508
1520
|
videoMetadata: c,
|
|
1509
1521
|
videoMediaInfo: i
|
|
1510
1522
|
};
|
|
1511
|
-
},
|
|
1512
|
-
let
|
|
1513
|
-
const {
|
|
1514
|
-
containerComponent:
|
|
1523
|
+
}, te = (e = {}, t = {}) => {
|
|
1524
|
+
let r = {};
|
|
1525
|
+
const { priority: s = ["container", "video", "audio", "binary"] } = t, {
|
|
1526
|
+
containerComponent: o,
|
|
1515
1527
|
videoComponent: n,
|
|
1516
|
-
audioComponent:
|
|
1517
|
-
binaryComponent:
|
|
1518
|
-
mimeType:
|
|
1519
|
-
tag:
|
|
1528
|
+
audioComponent: a,
|
|
1529
|
+
binaryComponent: i,
|
|
1530
|
+
mimeType: c = [],
|
|
1531
|
+
tag: p = []
|
|
1520
1532
|
} = e;
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1533
|
+
[r.tag] = p, [r.mimeType] = c;
|
|
1534
|
+
const d = (l, _) => Object.fromEntries(
|
|
1535
|
+
[.../* @__PURE__ */ new Set([...Object.keys(_), ...Object.keys(l)])].map((f) => [
|
|
1536
|
+
f,
|
|
1537
|
+
_[f] ?? l[f]
|
|
1538
|
+
])
|
|
1539
|
+
);
|
|
1540
|
+
return s.reverse().forEach((l) => {
|
|
1541
|
+
switch (l) {
|
|
1542
|
+
case "container":
|
|
1543
|
+
o && (r = d(
|
|
1544
|
+
r,
|
|
1545
|
+
gt(o)
|
|
1546
|
+
));
|
|
1547
|
+
break;
|
|
1548
|
+
case "video":
|
|
1549
|
+
if (n) {
|
|
1550
|
+
const [_] = n;
|
|
1551
|
+
r = d(
|
|
1552
|
+
r,
|
|
1553
|
+
Rt(_)
|
|
1554
|
+
);
|
|
1555
|
+
}
|
|
1556
|
+
break;
|
|
1557
|
+
case "audio":
|
|
1558
|
+
if (a) {
|
|
1559
|
+
const [_] = a;
|
|
1560
|
+
r = d(
|
|
1561
|
+
r,
|
|
1562
|
+
Ot(_)
|
|
1563
|
+
);
|
|
1564
|
+
}
|
|
1565
|
+
break;
|
|
1566
|
+
case "binary":
|
|
1567
|
+
if (i) {
|
|
1568
|
+
const [_] = i;
|
|
1569
|
+
r = d(
|
|
1570
|
+
r,
|
|
1571
|
+
St(_)
|
|
1572
|
+
);
|
|
1573
|
+
}
|
|
1574
|
+
break;
|
|
1575
|
+
}
|
|
1576
|
+
}), r;
|
|
1577
|
+
}, C = {
|
|
1551
1578
|
PDF: "PDF",
|
|
1552
1579
|
TEXT: "TEXT",
|
|
1553
1580
|
MSWORD: "MSWORD",
|
|
1554
1581
|
JSON: "JSON",
|
|
1555
1582
|
XML: "XML"
|
|
1556
|
-
},
|
|
1583
|
+
}, g = {
|
|
1557
1584
|
IMAGE: "IMAGE",
|
|
1558
1585
|
AUDIO: "AUDIO",
|
|
1559
1586
|
VIDEO: "VIDEO",
|
|
1560
1587
|
DOCUMENT: "DOCUMENT",
|
|
1561
1588
|
BINARY: "BINARY"
|
|
1562
|
-
},
|
|
1589
|
+
}, cr = (e = {}) => {
|
|
1563
1590
|
const { mimeType: t } = e, r = Array.isArray(t) ? t[0] : t;
|
|
1564
1591
|
if (r) {
|
|
1565
1592
|
if (r.endsWith("/pdf"))
|
|
1566
|
-
return
|
|
1593
|
+
return C.PDF;
|
|
1567
1594
|
if (r.startsWith("text/"))
|
|
1568
|
-
return
|
|
1595
|
+
return C.TEXT;
|
|
1569
1596
|
if (r.endsWith("/msword"))
|
|
1570
|
-
return
|
|
1597
|
+
return C.MSWORD;
|
|
1571
1598
|
if (r.endsWith("/json"))
|
|
1572
|
-
return
|
|
1599
|
+
return C.JSON;
|
|
1573
1600
|
if (r.endsWith("/xml"))
|
|
1574
|
-
return
|
|
1601
|
+
return C.XML;
|
|
1575
1602
|
}
|
|
1576
|
-
},
|
|
1603
|
+
}, bt = [
|
|
1577
1604
|
"image/apng",
|
|
1578
1605
|
"image/bmp",
|
|
1579
1606
|
"image/gif",
|
|
@@ -1581,7 +1608,7 @@ ${ye(o, {
|
|
|
1581
1608
|
"image/x-icon",
|
|
1582
1609
|
"image/png",
|
|
1583
1610
|
"image/svg+xml"
|
|
1584
|
-
],
|
|
1611
|
+
], Nt = ["video/mp4"], Dt = [
|
|
1585
1612
|
"audio/mp4",
|
|
1586
1613
|
"audio/mpeg",
|
|
1587
1614
|
"audio/x-aac",
|
|
@@ -1592,93 +1619,148 @@ ${ye(o, {
|
|
|
1592
1619
|
"audio/ogg",
|
|
1593
1620
|
"audio/webm",
|
|
1594
1621
|
"audio/x-flac"
|
|
1595
|
-
],
|
|
1622
|
+
], Mt = [...Nt, ...bt, ...Dt], Ft = ["http", "https"], yt = "video/mp4", vt = "video/quicktime", wt = "video/x-m4v", Ct = "MPEG-4", Lt = "mov", Bt = "h264", P = [
|
|
1596
1623
|
"__mp4",
|
|
1597
1624
|
"__mp3_160k",
|
|
1598
1625
|
"__png",
|
|
1599
1626
|
"__jpeg",
|
|
1600
1627
|
"__gif",
|
|
1601
1628
|
"original"
|
|
1602
|
-
].reverse(),
|
|
1629
|
+
].reverse(), ue = ({ parsedShape: { tag: e } }, { parsedShape: { tag: t } }) => P.includes(e) || P.includes(t) ? P.indexOf(t) - P.indexOf(e) : e.toLowerCase().localeCompare(t.toLowerCase()), dr = (e, t) => {
|
|
1603
1630
|
const {
|
|
1604
|
-
allowedMimeTypes: r =
|
|
1605
|
-
allowedMethods:
|
|
1606
|
-
sortPriority: o =
|
|
1607
|
-
sourceKey:
|
|
1631
|
+
allowedMimeTypes: r = Mt,
|
|
1632
|
+
allowedMethods: s = Ft,
|
|
1633
|
+
sortPriority: o = ue,
|
|
1634
|
+
sourceKey: n = "src",
|
|
1608
1635
|
mimeTypeKey: a = "type",
|
|
1609
1636
|
shapeKey: i = "shape",
|
|
1610
1637
|
parsedShapeKey: c = "parsedShape"
|
|
1611
|
-
} = t || {}, { shape:
|
|
1638
|
+
} = t || {}, { shape: p = [] } = e || {}, d = p.reduce((l, _) => {
|
|
1612
1639
|
let f, u;
|
|
1613
|
-
const m =
|
|
1614
|
-
if (
|
|
1615
|
-
if (
|
|
1616
|
-
const [A] =
|
|
1617
|
-
|
|
1640
|
+
const m = te(_), { uri: E, mimeType: T, containerFormat: h, videoCodec: I } = m;
|
|
1641
|
+
if (T && (f = T, (T === vt || T === wt) && (h === Ct || h === Lt) && I === Bt && (f = yt)), E)
|
|
1642
|
+
if (s) {
|
|
1643
|
+
const [A] = E.split("://");
|
|
1644
|
+
s.includes(A) && (u = E);
|
|
1618
1645
|
} else
|
|
1619
|
-
u =
|
|
1620
|
-
return u && r.includes(f) &&
|
|
1621
|
-
[
|
|
1646
|
+
u = E;
|
|
1647
|
+
return u && r.includes(f) && l.push({
|
|
1648
|
+
[n]: u,
|
|
1622
1649
|
[a]: f,
|
|
1623
|
-
[i]:
|
|
1650
|
+
[i]: _,
|
|
1624
1651
|
[c]: m
|
|
1625
|
-
}),
|
|
1652
|
+
}), l;
|
|
1626
1653
|
}, []);
|
|
1627
|
-
return typeof o == "function" && d.sort(
|
|
1628
|
-
},
|
|
1629
|
-
const t =
|
|
1654
|
+
return typeof o == "function" && d.sort(ue), d;
|
|
1655
|
+
}, ur = (e) => {
|
|
1656
|
+
const t = te(e), { mimeType: r, videoCodec: s, audioCodec: o } = t;
|
|
1630
1657
|
if (r) {
|
|
1631
1658
|
if (r.startsWith("audio/") && o !== void 0)
|
|
1632
|
-
return
|
|
1659
|
+
return g.AUDIO;
|
|
1633
1660
|
if (r.startsWith("video/")) {
|
|
1634
|
-
if (
|
|
1635
|
-
return
|
|
1661
|
+
if (s !== void 0)
|
|
1662
|
+
return g.VIDEO;
|
|
1636
1663
|
if (o !== void 0)
|
|
1637
|
-
return
|
|
1664
|
+
return g.AUDIO;
|
|
1638
1665
|
}
|
|
1639
1666
|
if (r.startsWith("image/"))
|
|
1640
|
-
return
|
|
1667
|
+
return g.IMAGE;
|
|
1641
1668
|
if (r.endsWith("/pdf") || r.startsWith("text/") || r.endsWith("/msword") || r.endsWith("/json") || r.endsWith("/xml"))
|
|
1642
|
-
return
|
|
1669
|
+
return g.DOCUMENT;
|
|
1643
1670
|
if (r.endsWith("/octet-stream"))
|
|
1644
|
-
return
|
|
1671
|
+
return g.BINARY;
|
|
1645
1672
|
}
|
|
1646
|
-
},
|
|
1673
|
+
}, we = "video/mp4", Ce = "video/quicktime", Le = "video/x-m4v", xt = "MPEG-4", Wt = "mov", Pt = "h264", jt = [we, Ce, Le], Be = [
|
|
1674
|
+
"video/x-mxf-h264",
|
|
1675
|
+
"video/x-mxf-h264-aac",
|
|
1676
|
+
"video/x-mxf-h264-pcm_s24le",
|
|
1677
|
+
"video/x-mxf-mpeg2video-pcm_s24le",
|
|
1678
|
+
"video/x-mxf-mpeg2video-pcm_s16le",
|
|
1679
|
+
"video/x-mxf-prores-pcm_s16le",
|
|
1680
|
+
"video/x-mxf-h264-pcm_s16le"
|
|
1681
|
+
], Ut = [...jt, ...Be], $t = [
|
|
1682
|
+
"audio/mp4",
|
|
1683
|
+
"audio/mpeg",
|
|
1684
|
+
"audio/x-aac",
|
|
1685
|
+
"audio/aac",
|
|
1686
|
+
"audio/x-wav",
|
|
1687
|
+
"audio/wav",
|
|
1688
|
+
"audio/accp",
|
|
1689
|
+
"audio/ogg",
|
|
1690
|
+
"audio/webm",
|
|
1691
|
+
"audio/x-flac"
|
|
1692
|
+
], Gt = [...Ut, ...$t], Vt = ["http", "https"], kt = ({
|
|
1693
|
+
streamingServers: e,
|
|
1694
|
+
url: t,
|
|
1695
|
+
ending: r
|
|
1696
|
+
}) => xe(e[0], window.btoa(t), `.${r}`), lr = (e, t) => {
|
|
1697
|
+
const {
|
|
1698
|
+
allowedMimeTypes: r = Gt,
|
|
1699
|
+
allowedMethods: s = Vt,
|
|
1700
|
+
streamingServers: o = []
|
|
1701
|
+
} = t || {}, { shape: n = [] } = e || {}, { startTimeCode: a } = et(e == null ? void 0 : e.metadata, {
|
|
1702
|
+
flat: !0,
|
|
1703
|
+
arrayOnSingleValue: !1
|
|
1704
|
+
});
|
|
1705
|
+
return n.reduce((c, p) => {
|
|
1706
|
+
var N, F, y;
|
|
1707
|
+
let d, l, _;
|
|
1708
|
+
const f = te(p), { uri: u, mimeType: m, containerFormat: E, videoCodec: T } = f;
|
|
1709
|
+
if (!(r != null && r.includes(m)) || !(s != null && s.includes((N = u == null ? void 0 : u.split("://")) == null ? void 0 : N[0])))
|
|
1710
|
+
return c;
|
|
1711
|
+
if (_ = f.tag, !_) {
|
|
1712
|
+
const b = (y = (F = m == null ? void 0 : m.split) == null ? void 0 : F.call(m, "/")) == null ? void 0 : y.pop(), w = c.filter((W) => W.label === b).length;
|
|
1713
|
+
w === 0 ? _ = b : _ = b + (w + 1);
|
|
1714
|
+
}
|
|
1715
|
+
const { timeBase: h, startTimecode: I } = f, A = a ?? I, O = A && x(A);
|
|
1716
|
+
return l = u, d = m, (m === Ce || m === Le) && (E === xt || E === Wt) && T === Pt && (d = we), o != null && o.length && Be.includes(m) && (l = kt({
|
|
1717
|
+
url: u,
|
|
1718
|
+
streamingServers: o,
|
|
1719
|
+
ending: "mpd"
|
|
1720
|
+
}), d = "application/dash+xml"), l && c.push({
|
|
1721
|
+
src: l,
|
|
1722
|
+
...d ? { type: d } : {},
|
|
1723
|
+
..._ ? { label: _ } : {},
|
|
1724
|
+
...h ? { timeBase: h } : {},
|
|
1725
|
+
...O ? { startTimeCode: O } : {}
|
|
1726
|
+
}), c;
|
|
1727
|
+
}, []);
|
|
1728
|
+
}, Ht = (e) => {
|
|
1647
1729
|
const t = {}, { outputSetting: r = [] } = e || {};
|
|
1648
1730
|
if (r.length === 0)
|
|
1649
1731
|
return t;
|
|
1650
|
-
const
|
|
1651
|
-
if (o && (t.containerFormat = o.Container),
|
|
1652
|
-
const { CodecSettings: i = {} } =
|
|
1732
|
+
const s = JSON.parse(r[0]), { Settings: { ContainerSettings: o, VideoDescription: n, AudioDescriptions: a } = {} } = s;
|
|
1733
|
+
if (o && (t.containerFormat = o.Container), n) {
|
|
1734
|
+
const { CodecSettings: i = {} } = n, { Codec: c, ...p } = i;
|
|
1653
1735
|
t.videoFormat = c;
|
|
1654
|
-
const { Height: d, Width:
|
|
1655
|
-
t.height = d, t.width =
|
|
1656
|
-
const [
|
|
1657
|
-
if (
|
|
1658
|
-
t.fieldOrder =
|
|
1659
|
-
const f =
|
|
1736
|
+
const { Height: d, Width: l } = n;
|
|
1737
|
+
t.height = d, t.width = l, d && l && (t.dimension = `${l}x${d}`, t.aspectRatio = K({ height: d, width: l }));
|
|
1738
|
+
const [_] = Object.values(p);
|
|
1739
|
+
if (_) {
|
|
1740
|
+
t.fieldOrder = _.InterlaceMode, t.fieldOrder && t.fieldOrder.includes("TOP") && (t.fieldOrder = "interlaced"), t.videoBitrate = _.Bitrate;
|
|
1741
|
+
const f = _.FramerateDenominator, u = _.FramerateNumerator, m = B({ denominator: u, numerator: f });
|
|
1660
1742
|
t.timeBase = m, t.frameRate = m.toConstant() || m.toRate();
|
|
1661
1743
|
}
|
|
1662
1744
|
}
|
|
1663
1745
|
if (a && a.length > 0) {
|
|
1664
|
-
const { CodecSettings: i = {} } = a[0], { Codec: c, ...
|
|
1746
|
+
const { CodecSettings: i = {} } = a[0], { Codec: c, ...p } = i;
|
|
1665
1747
|
t.audioFormat = c;
|
|
1666
|
-
const [d] = Object.values(
|
|
1748
|
+
const [d] = Object.values(p);
|
|
1667
1749
|
d && (t.audioSamplerate = d.SampleRate, t.audioBitrate = d.Bitrate, t.audioBitRateMode = d.RateControlMode);
|
|
1668
1750
|
}
|
|
1669
1751
|
return t;
|
|
1670
|
-
},
|
|
1671
|
-
const t = {}, { description: r, format:
|
|
1752
|
+
}, _r = (e) => {
|
|
1753
|
+
const t = {}, { description: r, format: s, audio: o, video: n, mediaconvert: a } = e || {};
|
|
1672
1754
|
if (a)
|
|
1673
|
-
return { description: r, ...
|
|
1674
|
-
if (t.description = r, t.containerFormat =
|
|
1675
|
-
if (t.videoFormat =
|
|
1676
|
-
const i =
|
|
1755
|
+
return { description: r, ...Ht(a) };
|
|
1756
|
+
if (t.description = r, t.containerFormat = s, n) {
|
|
1757
|
+
if (t.videoFormat = n.codec, t.videoBitrate = n.bitrate, n.framerate) {
|
|
1758
|
+
const i = B(n.framerate);
|
|
1677
1759
|
t.timeBase = i, t.frameRate = i.toConstant() || i.toRate();
|
|
1678
1760
|
}
|
|
1679
|
-
if (
|
|
1680
|
-
const { height: i, width: c } =
|
|
1681
|
-
t.height = i, t.width = c, i && c && (t.dimension = `${c}x${i}`, t.aspectRatio =
|
|
1761
|
+
if (n.scaling) {
|
|
1762
|
+
const { height: i, width: c } = n.scaling;
|
|
1763
|
+
t.height = i, t.width = c, i && c && (t.dimension = `${c}x${i}`, t.aspectRatio = K({ height: i, width: c }));
|
|
1682
1764
|
}
|
|
1683
1765
|
}
|
|
1684
1766
|
if (o) {
|
|
@@ -1686,41 +1768,41 @@ ${ye(o, {
|
|
|
1686
1768
|
t.audioFormat = i, c && (t.audioChannels = c.length);
|
|
1687
1769
|
}
|
|
1688
1770
|
return t;
|
|
1689
|
-
},
|
|
1771
|
+
}, Yt = (e) => {
|
|
1690
1772
|
if (!e)
|
|
1691
1773
|
return;
|
|
1692
1774
|
const {
|
|
1693
1775
|
name: t,
|
|
1694
1776
|
type: r,
|
|
1695
|
-
defaultValue:
|
|
1777
|
+
defaultValue: s,
|
|
1696
1778
|
stringRestriction: o,
|
|
1697
|
-
floatRestriction:
|
|
1779
|
+
floatRestriction: n,
|
|
1698
1780
|
integerRestriction: a,
|
|
1699
1781
|
longRestriction: i,
|
|
1700
1782
|
data: c,
|
|
1701
|
-
values:
|
|
1783
|
+
values: p,
|
|
1702
1784
|
system: d
|
|
1703
|
-
} = e, { minLength:
|
|
1704
|
-
label:
|
|
1785
|
+
} = e, { minLength: l, maxLength: _, pattern: f } = o || {}, { minInclusive: u, maxInclusive: m } = n || a || i || {}, E = ((p == null ? void 0 : p.field) || []).map(({ key: A, value: O }) => ({
|
|
1786
|
+
label: O ?? A,
|
|
1705
1787
|
value: A
|
|
1706
|
-
})), h = ((A) => Object.fromEntries(Object.entries(A).filter(([,
|
|
1788
|
+
})), h = ((A) => Object.fromEntries(Object.entries(A).filter(([, O]) => O !== void 0)))({
|
|
1707
1789
|
min: u,
|
|
1708
1790
|
max: m,
|
|
1709
|
-
minLength:
|
|
1710
|
-
maxLength:
|
|
1791
|
+
minLength: l,
|
|
1792
|
+
maxLength: _,
|
|
1711
1793
|
pattern: f ? new RegExp(f) : void 0
|
|
1712
|
-
}),
|
|
1794
|
+
}), I = M(c);
|
|
1713
1795
|
return {
|
|
1714
1796
|
name: t,
|
|
1715
1797
|
type: r,
|
|
1716
|
-
defaultValue:
|
|
1717
|
-
required: u !== void 0 ||
|
|
1798
|
+
defaultValue: s,
|
|
1799
|
+
required: u !== void 0 || l !== void 0 && l > 0,
|
|
1718
1800
|
restrictions: h,
|
|
1719
|
-
data:
|
|
1720
|
-
options:
|
|
1801
|
+
data: I,
|
|
1802
|
+
options: E,
|
|
1721
1803
|
system: d === "true"
|
|
1722
1804
|
};
|
|
1723
|
-
},
|
|
1805
|
+
}, mr = (e) => e == null ? void 0 : e.map(Yt).filter((t) => !!t), pr = [
|
|
1724
1806
|
"date",
|
|
1725
1807
|
"float",
|
|
1726
1808
|
"integer",
|
|
@@ -1731,54 +1813,55 @@ ${ye(o, {
|
|
|
1731
1813
|
"timeCode"
|
|
1732
1814
|
];
|
|
1733
1815
|
export {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1816
|
+
C as DOCUMENT_TYPES,
|
|
1817
|
+
Pe as FIELD_ATTRIBUTE_KEYS,
|
|
1818
|
+
pr as FIELD_DEFINITION_TYPES,
|
|
1819
|
+
We as FIELD_VALUE_ATTRIBUTE_KEYS,
|
|
1820
|
+
ar as FILE_STATES,
|
|
1821
|
+
je as GROUP_ATTRIBUTE_KEYS,
|
|
1822
|
+
Jt as ROLE_NAMES,
|
|
1823
|
+
g as SHAPE_MEDIA_TYPES,
|
|
1824
|
+
Xt as SYSTEM_FIELDGROUPS,
|
|
1825
|
+
qt as SYSTEM_FIELDS,
|
|
1826
|
+
S as TimeBase,
|
|
1827
|
+
R as TimeCode,
|
|
1828
|
+
Qt as createMetadataType,
|
|
1829
|
+
tr as createSearchFacetList,
|
|
1830
|
+
j as createTimeBase,
|
|
1831
|
+
x as createTimeCode,
|
|
1832
|
+
Et as defaultOptions,
|
|
1833
|
+
dr as filterShapeSource,
|
|
1834
|
+
ft as findNearestThumbnail,
|
|
1835
|
+
Z as formatTimeBaseText,
|
|
1836
|
+
B as formatTimeBaseType,
|
|
1837
|
+
rt as formatTimeCodeSeconds,
|
|
1838
|
+
at as formatTimeCodeSmpte,
|
|
1839
|
+
U as formatTimeCodeText,
|
|
1840
|
+
L as formatTimeCodeType,
|
|
1841
|
+
lr as getPlayerSources,
|
|
1842
|
+
cr as getShapeDocumentType,
|
|
1843
|
+
ur as getShapeMediaType,
|
|
1844
|
+
er as metadataTypeToWebVtt,
|
|
1845
|
+
Ot as parseAudioComponent,
|
|
1846
|
+
St as parseBinaryComponent,
|
|
1847
|
+
gt as parseContainerComponent,
|
|
1848
|
+
rr as parseFacetList,
|
|
1849
|
+
or as parseFacetType,
|
|
1850
|
+
mr as parseFieldDefinitionList,
|
|
1851
|
+
Re as parseFieldList,
|
|
1852
|
+
ve as parseFileType,
|
|
1853
|
+
Ne as parseGroupList,
|
|
1854
|
+
H as parseHighlightTimespan,
|
|
1855
|
+
sr as parseHighlightTimespanList,
|
|
1856
|
+
M as parseKeyValuePairType,
|
|
1857
|
+
Ht as parseMediaConvertPreset,
|
|
1858
|
+
et as parseMetadataType,
|
|
1859
|
+
ir as parseNowDate,
|
|
1860
|
+
nr as parseSearchResultEvents,
|
|
1861
|
+
te as parseShapeType,
|
|
1862
|
+
Zt as parseSimpleMetadataType,
|
|
1863
|
+
Qe as parseTimespan,
|
|
1864
|
+
Me as parseTimespanList,
|
|
1865
|
+
_r as parseTranscodePreset,
|
|
1866
|
+
Rt as parseVideoComponent
|
|
1784
1867
|
};
|