@vidispine/vdt-js 24.2.0 → 24.3.0-pre.2

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.js CHANGED
@@ -5,16 +5,16 @@ const pt = (e, t) => t ? pt(t, e % t) : e, J = (e) => {
5
5
  const { width: t, height: s } = e || {};
6
6
  if (t === void 0 || s === void 0)
7
7
  return;
8
- const n = pt(t, s);
9
- let r = t / n, i = s / n;
10
- return r > 21 && (i = 1, r = (t / s).toFixed(2)), [r, i].join(":");
8
+ const i = pt(t, s);
9
+ let r = t / i, n = s / i;
10
+ return r > 21 && (n = 1, r = (t / s).toFixed(2)), [r, n].join(":");
11
11
  }, F = (e) => Object.fromEntries((e == null ? void 0 : e.map(({ key: t, value: s }) => [t, s])) || []), Gt = (e, t, s) => {
12
- let n;
12
+ let i;
13
13
  return (r) => {
14
14
  const o = () => {
15
- n = null, s || e.apply(void 0, r);
16
- }, a = s && !n;
17
- clearTimeout(n), n = setTimeout(o, t), a && e.apply(void 0, r);
15
+ i = null, s || e.apply(void 0, r);
16
+ }, a = s && !i;
17
+ clearTimeout(i), i = setTimeout(o, t), a && e.apply(void 0, r);
18
18
  };
19
19
  };
20
20
  function zt() {
@@ -321,7 +321,7 @@ const os = {
321
321
  const t = (s) => Kt(s) && s.value === void 0 && !!Object.entries(e);
322
322
  return Array.isArray(e) ? e.every(It) : t(e);
323
323
  }, Jt = (e, t) => e + (t.length > 1 ? "s" : ""), Ot = (e, t) => {
324
- const s = e.filter((n) => !t.includes(n));
324
+ const s = e.filter((i) => !t.includes(i));
325
325
  if (s.length)
326
326
  throw Error(
327
327
  `Unsupported ${Jt("key", s)} (${s.join(", ")})`
@@ -344,8 +344,8 @@ const os = {
344
344
  Ot(Object.keys(e), Ht);
345
345
  const t = X(e == null ? void 0 : e.value);
346
346
  if (t === void 0) {
347
- const { value: s, ...n } = e;
348
- return n;
347
+ const { value: s, ...i } = e;
348
+ return i;
349
349
  }
350
350
  return {
351
351
  ...e,
@@ -359,42 +359,42 @@ const os = {
359
359
  return { value: [...Array.isArray(t) ? t : [t]] };
360
360
  }, Rt = (e) => {
361
361
  const t = [], s = [];
362
- let n = {};
363
- return Object.entries(e || {}).forEach(([r, i]) => {
362
+ let i = {};
363
+ return Object.entries(e || {}).forEach(([r, n]) => {
364
364
  if (Yt.includes(r))
365
- n = { ...n, [r]: i };
366
- else if (At(i))
365
+ i = { ...i, [r]: n };
366
+ else if (At(n))
367
367
  try {
368
- s.push({ name: r, ...Qt(i) });
368
+ s.push({ name: r, ...Qt(n) });
369
369
  } catch (o) {
370
370
  throw Error(o.message + (r ? ` for field "${r}"` : ""));
371
371
  }
372
- else if (It(i))
373
- (Array.isArray(i) ? i : [i]).forEach((o) => {
372
+ else if (It(n))
373
+ (Array.isArray(n) ? n : [n]).forEach((o) => {
374
374
  t.push({ name: r, ...Rt(o) });
375
375
  });
376
376
  else
377
377
  throw Error(`Unhandled value for "${r}"`);
378
378
  }), {
379
- ...n,
379
+ ...i,
380
380
  ...t.length > 0 ? { group: t } : {},
381
381
  ...s.length > 0 ? { field: s } : {}
382
382
  };
383
383
  }, Zt = (e) => {
384
- const { start: t = "-INF", end: s = "+INF", base: n = void 0, ...r } = e, { group: i, field: o } = Rt(r);
384
+ const { start: t = "-INF", end: s = "+INF", base: i = void 0, ...r } = e, { group: n, field: o } = Rt(r);
385
385
  return {
386
- ...i ? { group: i } : {},
386
+ ...n ? { group: n } : {},
387
387
  ...o ? { field: o } : {},
388
388
  start: t.toString(),
389
389
  end: s.toString(),
390
- ...n ? { base: n } : {}
390
+ ...i ? { base: i } : {}
391
391
  };
392
- }, ls = (e) => ({
392
+ }, ds = (e) => ({
393
393
  timespan: (Array.isArray(e) ? e : [e || {}]).map((t) => Zt(t))
394
394
  }), te = (e, t) => {
395
- var r, i;
396
- const [s] = ((r = e == null ? void 0 : e.start) == null ? void 0 : r.split("@")) || [], [n] = ((i = t == null ? void 0 : t.start) == null ? void 0 : i.split("@")) || [];
397
- return Number(s) < Number(n) ? -1 : Number(s) > Number(n) ? 1 : 0;
395
+ var r, n;
396
+ const [s] = ((r = e == null ? void 0 : e.start) == null ? void 0 : r.split("@")) || [], [i] = ((n = t == null ? void 0 : t.start) == null ? void 0 : n.split("@")) || [];
397
+ return Number(s) < Number(i) ? -1 : Number(s) > Number(i) ? 1 : 0;
398
398
  }, D = (e) => Array.isArray(e) ? e : e && [e] || [], at = (e) => Array.isArray(e) ? e.pop() : e, ee = (e) => (e == null ? void 0 : e.every((t) => typeof t == "string")) || !1, yt = {
399
399
  includeValueAttributes: !1
400
400
  };
@@ -405,12 +405,12 @@ function se(e, t) {
405
405
  };
406
406
  if (s === !1)
407
407
  return e == null ? void 0 : e.value;
408
- const { value: n, ...r } = e;
408
+ const { value: i, ...r } = e;
409
409
  return { ...s === !0 && r || Array.isArray(s) && Object.fromEntries(
410
410
  Object.entries(r).filter(
411
411
  ([o]) => s.includes(o)
412
412
  )
413
- ) || {}, value: n };
413
+ ) || {}, value: i };
414
414
  }
415
415
  const St = {
416
416
  ...yt,
@@ -418,21 +418,21 @@ const St = {
418
418
  arrayOnSingleValue: !0
419
419
  };
420
420
  function re(e, t) {
421
- const { joinValue: s, arrayOnSingleValue: n, ...r } = {
421
+ const { joinValue: s, arrayOnSingleValue: i, ...r } = {
422
422
  ...St,
423
423
  ...t || {}
424
- }, i = e == null ? void 0 : e.map((o) => se(o, r));
425
- return ee(i) && s ? i == null ? void 0 : i.join(s) : n !== !0 && (i == null ? void 0 : i.length) <= 1 ? i == null ? void 0 : i[0] : i;
424
+ }, n = e == null ? void 0 : e.map((o) => se(o, r));
425
+ return ee(n) && s ? n == null ? void 0 : n.join(s) : i !== !0 && (n == null ? void 0 : n.length) <= 1 ? n == null ? void 0 : n[0] : n;
426
426
  }
427
427
  const vt = {
428
428
  includeFieldAttributes: !1,
429
429
  ...St
430
- }, ne = (e, t) => {
431
- const { includeFieldAttributes: s, ...n } = {
430
+ }, ie = (e, t) => {
431
+ const { includeFieldAttributes: s, ...i } = {
432
432
  ...vt,
433
433
  ...t || {}
434
- }, { value: r, ...i } = e, o = re(r, n), a = s === !0 && i || Array.isArray(s) && Object.fromEntries(
435
- Object.entries(i).filter(
434
+ }, { value: r, ...n } = e, o = re(r, i), a = s === !0 && n || Array.isArray(s) && Object.fromEntries(
435
+ Object.entries(n).filter(
436
436
  ([c]) => s.includes(c)
437
437
  )
438
438
  ) || {};
@@ -446,44 +446,44 @@ const vt = {
446
446
  const s = {
447
447
  ...G,
448
448
  ...t || {}
449
- }, { fieldAsList: n, arrayOnSingleField: r, overrideField: i } = s, o = i === !0 && n === !1, a = {};
449
+ }, { fieldAsList: i, arrayOnSingleField: r, overrideField: n } = s, o = n === !0 && i === !1, a = {};
450
450
  return e == null || e.forEach((c) => {
451
- const { name: d } = c, u = ne(c, s), f = r === !0 ? D(u) : u, m = a[d];
452
- m ? o ? a[d] = u : a[d] = [D(m), D(u)].flat() : a[d] = f;
453
- }), n === !0 ? Object.values(a).flat() : a;
451
+ const { name: l } = c, u = ie(c, s), f = r === !0 ? D(u) : u, m = a[l];
452
+ m ? o ? a[l] = u : a[l] = [D(m), D(u)].flat() : a[l] = f;
453
+ }), i === !0 ? Object.values(a).flat() : a;
454
454
  }, Dt = {
455
455
  ...G,
456
456
  includeGroupAttributes: !1,
457
457
  groupAsList: !1,
458
458
  arrayOnSingleGroup: !1,
459
459
  overrideGroup: void 0
460
- }, ie = (e, t) => {
460
+ }, ne = (e, t) => {
461
461
  const s = {
462
462
  ...Dt,
463
463
  ...t || {}
464
- }, { includeGroupAttributes: n } = s, r = Object.fromEntries(
464
+ }, { includeGroupAttributes: i } = s, r = Object.fromEntries(
465
465
  Object.entries(s).filter(
466
466
  ([f]) => Object.keys(G).includes(f)
467
467
  )
468
- ), { field: i, group: o, ...a } = e, c = i && Mt(i, r), d = o && Ft(o, s);
468
+ ), { field: n, group: o, ...a } = e, c = n && Mt(n, r), l = o && Ft(o, s);
469
469
  return {
470
- ...n === !0 && a || Array.isArray(n) && Object.fromEntries(
470
+ ...i === !0 && a || Array.isArray(i) && Object.fromEntries(
471
471
  Object.entries(a).filter(
472
- ([f]) => n.includes(f)
472
+ ([f]) => i.includes(f)
473
473
  )
474
474
  ) || {},
475
475
  ...r != null && r.fieldAsList ? c && { field: c } || {} : c,
476
- ...s != null && s.groupAsList ? d && { group: d } || {} : d
476
+ ...s != null && s.groupAsList ? l && { group: l } || {} : l
477
477
  };
478
478
  }, Q = Dt, Ft = (e, t) => {
479
- const s = { ...Q, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: r, overrideGroup: i } = s, o = i === !0 && n === !1, a = {};
479
+ const s = { ...Q, ...t || {} }, { groupAsList: i, arrayOnSingleGroup: r, overrideGroup: n } = s, o = n === !0 && i === !1, a = {};
480
480
  return e == null || e.forEach((c) => {
481
- const { name: d } = c, u = ie(c, s), f = r === !0 ? D(u) : u, m = a[d];
482
- m ? o ? a[d] = u : a[d] = [
481
+ const { name: l } = c, u = ne(c, s), f = r === !0 ? D(u) : u, m = a[l];
482
+ m ? o ? a[l] = u : a[l] = [
483
483
  D(m),
484
484
  D(u)
485
- ].flat() : a[d] = f;
486
- }), n ? Object.values(a).flat() : a;
485
+ ].flat() : a[l] = f;
486
+ }), i ? Object.values(a).flat() : a;
487
487
  }, Nt = {
488
488
  ...Q,
489
489
  includeTimespanAttributes: !1,
@@ -496,21 +496,21 @@ const vt = {
496
496
  const s = {
497
497
  ...Nt,
498
498
  ...t || {}
499
- }, { includeTimespanAttributes: n, arrayOnSingle: r, flat: i } = s, o = Object.fromEntries(
500
- Object.entries(t).map(([l, h]) => {
501
- if (Object.keys(Q).includes(l))
502
- return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideGroup", "overrideField"].includes(l) && (h !== void 0 ? h : i === !0) ? [l, !0] : [l, h];
503
- }).filter((l) => !!l)
499
+ }, { includeTimespanAttributes: i, arrayOnSingle: r, flat: n } = s, o = Object.fromEntries(
500
+ Object.entries(t).map(([d, h]) => {
501
+ if (Object.keys(Q).includes(d))
502
+ return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(d) && (h !== void 0 ? h : r === !0) ? [d, !0] : ["overrideGroup", "overrideField"].includes(d) && (h !== void 0 ? h : n === !0) ? [d, !0] : [d, h];
503
+ }).filter((d) => !!d)
504
504
  ), a = Object.fromEntries(
505
- Object.entries(t).map(([l, h]) => {
506
- if (Object.keys(G).includes(l))
507
- return ["arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideField"].includes(l) && (h !== void 0 ? h : i === !0) ? [l, !0] : [l, h];
508
- }).filter((l) => !!l)
509
- ), { field: c, group: d, ...u } = e || {}, f = c && Mt(c, a), m = d && Ft(d, o);
505
+ Object.entries(t).map(([d, h]) => {
506
+ if (Object.keys(G).includes(d))
507
+ return ["arrayOnSingleField", "arrayOnSingleValue"].includes(d) && (h !== void 0 ? h : r === !0) ? [d, !0] : ["overrideField"].includes(d) && (h !== void 0 ? h : n === !0) ? [d, !0] : [d, h];
508
+ }).filter((d) => !!d)
509
+ ), { field: c, group: l, ...u } = e || {}, f = c && Mt(c, a), m = l && Ft(l, o);
510
510
  return {
511
- ...n === !0 && u || Array.isArray(n) && Object.fromEntries(
511
+ ...i === !0 && u || Array.isArray(i) && Object.fromEntries(
512
512
  Object.entries(u).filter(
513
- ([l]) => n.includes(l)
513
+ ([d]) => i.includes(d)
514
514
  )
515
515
  ) || {},
516
516
  ...a != null && a.fieldAsList ? { field: f } : f,
@@ -527,13 +527,13 @@ const vt = {
527
527
  const s = {
528
528
  ...Z,
529
529
  ...t || {}
530
- }, { timespanAsList: n, joinTimespan: r, sortTimespan: i, flat: o, flatTimespan: a, ...c } = s, d = { flat: o, ...c };
531
- i && e.sort(te);
532
- const u = (a !== void 0 ? a === !0 : o === !0) && n === !1, f = {};
530
+ }, { timespanAsList: i, joinTimespan: r, sortTimespan: n, flat: o, flatTimespan: a, ...c } = s, l = { flat: o, ...c };
531
+ n && e.sort(te);
532
+ const u = (a !== void 0 ? a === !0 : o === !0) && i === !1, f = {};
533
533
  return e == null || e.forEach((m) => {
534
- const { start: p, end: l } = m, h = u ? "flat" : [p, l].join(r), g = ae(m, d), E = f[h];
535
- E ? u ? p === "-INF" && l === "+INF" ? f[h] = { ...at(E), ...g } : f[h] = { ...g, ...at(E) } : f[h] = [...D(E), g] : f[h] = g;
536
- }), n === !0 ? Object.values(f) : u ? Object.values(f).pop() : f;
534
+ const { start: p, end: d } = m, h = u ? "flat" : [p, d].join(r), g = ae(m, l), E = f[h];
535
+ E ? u ? p === "-INF" && d === "+INF" ? f[h] = { ...at(E), ...g } : f[h] = { ...g, ...at(E) } : f[h] = [...D(E), g] : f[h] = g;
536
+ }), i === !0 ? Object.values(f) : u ? Object.values(f).pop() : f;
537
537
  }, oe = {
538
538
  ...Z,
539
539
  includeMetadataAttributes: !1,
@@ -543,22 +543,22 @@ function ce(e, t) {
543
543
  const s = {
544
544
  ...oe,
545
545
  ...t || {}
546
- }, { includeMetadataAttributes: n, flat: r } = s, { timespan: i = [], ...o } = e || {}, a = Object.fromEntries(
546
+ }, { includeMetadataAttributes: i, flat: r } = s, { timespan: n = [], ...o } = e || {}, a = Object.fromEntries(
547
547
  Object.entries(s).map(([u, f]) => {
548
548
  if (Object.keys(Z).includes(u))
549
549
  return ["onlyGeneric", "overrideGroup", "overrideField"].includes(u) && (f !== void 0 ? f : r === !0) ? [u, !0] : [u, f];
550
550
  }).filter((u) => !!u)
551
551
  ), c = Ct(
552
- i,
552
+ n,
553
553
  a
554
554
  );
555
555
  return {
556
- ...n === !0 && {
556
+ ...i === !0 && {
557
557
  ...o,
558
558
  ...o.revision ? { revision: o.revision.split(",") } : {}
559
- } || Array.isArray(n) && Object.fromEntries(
559
+ } || Array.isArray(i) && Object.fromEntries(
560
560
  Object.entries(o).map(([u, f]) => {
561
- if (n.includes(u))
561
+ if (i.includes(u))
562
562
  return [
563
563
  u,
564
564
  u === "revision" && typeof f == "string" ? f.split(",") : f
@@ -568,7 +568,7 @@ function ce(e, t) {
568
568
  ...a != null && a.timespanAsList ? { timespan: c } : c
569
569
  };
570
570
  }
571
- const ds = (e) => {
571
+ const ls = (e) => {
572
572
  const { field: t = [] } = e || {};
573
573
  return F(t);
574
574
  }, tt = {
@@ -597,8 +597,8 @@ class R {
597
597
  */
598
598
  constructor(t) {
599
599
  this.numerator = 1, this.denominator = 1;
600
- const { numerator: s = 1, denominator: n = 1 } = t || {};
601
- this.numerator = Number(s), this.denominator = Number(n);
600
+ const { numerator: s = 1, denominator: i = 1 } = t || {};
601
+ this.numerator = Number(s), this.denominator = Number(i);
602
602
  }
603
603
  /**
604
604
  * Get TimeBase in a constant representation (e.g. "PAL") if possible, otherwise undefined
@@ -607,8 +607,8 @@ class R {
607
607
  toConstant() {
608
608
  let t;
609
609
  return Object.entries(tt).find((s) => {
610
- const [n, r] = s, { numerator: i, denominator: o } = r;
611
- return i === this.numerator && o === this.denominator ? (t = n, !0) : !1;
610
+ const [i, r] = s, { numerator: n, denominator: o } = r;
611
+ return n === this.numerator && o === this.denominator ? (t = i, !0) : !1;
612
612
  }), t;
613
613
  }
614
614
  /**
@@ -623,13 +623,13 @@ class R {
623
623
  * @returns Text representation of the TimeBase
624
624
  */
625
625
  toText(t) {
626
- const { constant: s, fraction: n } = { ...ct.toText, ...t };
626
+ const { constant: s, fraction: i } = { ...ct.toText, ...t };
627
627
  if (s) {
628
- const i = this.toConstant();
629
- if (i)
630
- return i;
628
+ const n = this.toConstant();
629
+ if (n)
630
+ return n;
631
631
  }
632
- return n || this.numerator > 1 ? [this.denominator, this.numerator].join(":") : String(this.denominator);
632
+ return i || this.numerator > 1 ? [this.denominator, this.numerator].join(":") : String(this.denominator);
633
633
  }
634
634
  /**
635
635
  * Output TimeBase as frame rate (by default max 16 decimal places)
@@ -647,8 +647,8 @@ class R {
647
647
  const s = this.denominator / this.numerator;
648
648
  if (Number.isInteger(s))
649
649
  return s;
650
- const { rounded: n, fixed: r } = { ...ct.toRate, ...t || {} };
651
- return n ? Math.round(s) : r === !0 || typeof r == "number" ? Number(s.toFixed(typeof r == "boolean" ? 2 : r)) : s;
650
+ const { rounded: i, fixed: r } = { ...ct.toRate, ...t || {} };
651
+ return i ? Math.round(s) : r === !0 || typeof r == "number" ? Number(s.toFixed(typeof r == "boolean" ? 2 : r)) : s;
652
652
  }
653
653
  /**
654
654
  * Get TimeBase in a object representation
@@ -679,8 +679,8 @@ const et = (e) => {
679
679
  if (typeof e == "number")
680
680
  return new R({ denominator: e });
681
681
  if (typeof e == "string" && e.includes(":")) {
682
- const [s, n] = e.split(":");
683
- return new R({ denominator: s, numerator: n });
682
+ const [s, i] = e.split(":");
683
+ return new R({ denominator: s, numerator: i });
684
684
  }
685
685
  if (!["string", "number"].includes(typeof e) || Number.isNaN(Number(e)))
686
686
  throw new Error(
@@ -693,16 +693,16 @@ const et = (e) => {
693
693
  const t = e.toConstant();
694
694
  return t === "59.94" && 4 || ["NTSC", "29.97"].includes(t) && 2 || void 0;
695
695
  }, wt = (e) => st(e) > 0, ut = (e) => {
696
- const { samples: t, timeBase: s } = e, n = st(s);
697
- if (!n)
696
+ const { samples: t, timeBase: s } = e, i = st(s);
697
+ if (!i)
698
698
  return 0;
699
- const r = s.toRate({ rounded: !0 }), i = 60 * r, o = 60 * r - n, a = 10 * (i - n) + n, c = Math.floor((t + 1) / a), d = Math.max(
699
+ const r = s.toRate({ rounded: !0 }), n = 60 * r, o = 60 * r - i, a = 10 * (n - i) + i, c = Math.floor((t + 1) / a), l = Math.max(
700
700
  0,
701
- (t + 1) % a - i
701
+ (t + 1) % a - n
702
702
  ), u = Math.floor(
703
- d / o
704
- ), m = d % o > 0 ? n : 0;
705
- return c * 9 * n + u * n + m;
703
+ l / o
704
+ ), m = l % o > 0 ? i : 0;
705
+ return c * 9 * i + u * i + m;
706
706
  }, V = {
707
707
  conformTimeBase: {
708
708
  dropFrame: void 0,
@@ -726,14 +726,14 @@ class S {
726
726
  */
727
727
  constructor(t, s) {
728
728
  this.samples = 0, this.timeBase = new R();
729
- const { samples: n, timeBase: r } = t || {};
730
- if (n !== void 0)
731
- if (typeof n == "number")
732
- this.samples = n;
733
- else if (typeof n == "string")
734
- n === "-INF" ? this.samples = -1 / 0 : n === "+INF" ? this.samples = 1 / 0 : this.samples = Number(n);
729
+ const { samples: i, timeBase: r } = t || {};
730
+ if (i !== void 0)
731
+ if (typeof i == "number")
732
+ this.samples = i;
733
+ else if (typeof i == "string")
734
+ i === "-INF" ? this.samples = -1 / 0 : i === "+INF" ? this.samples = 1 / 0 : this.samples = Number(i);
735
735
  else
736
- throw new Error(`samples is not number/string/-Inf/+Inf is: ${n}`);
736
+ throw new Error(`samples is not number/string/-Inf/+Inf is: ${i}`);
737
737
  r !== void 0 && (r instanceof R ? this.timeBase = r : this.timeBase = $(r)), this.dropFrame = (s == null ? void 0 : s.dropFrame) ?? wt(this.timeBase), this.frameSeparator = (s == null ? void 0 : s.frameSeparator) ?? (this.dropFrame ? ";" : ":");
738
738
  }
739
739
  /**
@@ -754,11 +754,11 @@ class S {
754
754
  add(t) {
755
755
  if (!(t != null && t.timeBase) || (t == null ? void 0 : t.samples) === void 0)
756
756
  throw Error("Invalid timeCodeType, cannot be added");
757
- const { numerator: s, denominator: n } = (t == null ? void 0 : t.timeBase) || {};
757
+ const { numerator: s, denominator: i } = (t == null ? void 0 : t.timeBase) || {};
758
758
  let r = t;
759
- (s !== this.timeBase.numerator || n !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
760
- const { samples: i } = r;
761
- return new S({ samples: this.samples + i, timeBase: this.timeBase });
759
+ (s !== this.timeBase.numerator || i !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
760
+ const { samples: n } = r;
761
+ return new S({ samples: this.samples + n, timeBase: this.timeBase });
762
762
  }
763
763
  /**
764
764
  * Return this TimeCode subtracted with the supplied timeCodeType
@@ -778,11 +778,11 @@ class S {
778
778
  subtract(t) {
779
779
  if (!(t != null && t.timeBase) || (t == null ? void 0 : t.samples) === void 0)
780
780
  throw Error("Invalid timeCodeType, cannot be subtracted");
781
- const { timeBase: { numerator: s, denominator: n } = {} } = t;
781
+ const { timeBase: { numerator: s, denominator: i } = {} } = t;
782
782
  let r = t;
783
- (s !== this.timeBase.numerator || n !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
784
- const { samples: i } = r;
785
- return new S({ samples: this.samples - i, timeBase: this.timeBase });
783
+ (s !== this.timeBase.numerator || i !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
784
+ const { samples: n } = r;
785
+ return new S({ samples: this.samples - n, timeBase: this.timeBase });
786
786
  }
787
787
  /**
788
788
  * Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
@@ -797,7 +797,7 @@ class S {
797
797
  * @returns A new TimeCode instance with the conformTo timeBase applied
798
798
  */
799
799
  conformTimeBase(t, s) {
800
- const n = t instanceof R ? t : $(t), r = (s == null ? void 0 : s.roundingMode) ?? "floor";
800
+ const i = t instanceof R ? t : $(t), r = (s == null ? void 0 : s.roundingMode) ?? "floor";
801
801
  if (!["floor", "ceil", "round"].includes(r))
802
802
  throw Error(
803
803
  `Invalid mode selection "${r}". Has to be one of "${[
@@ -806,13 +806,13 @@ class S {
806
806
  "round"
807
807
  ].join(", ")}"`
808
808
  );
809
- const i = Math[r](
810
- this.samples / (this.timeBase.toRate({ fixed: !1 }) / n.toRate({ fixed: !1 }))
809
+ const n = Math[r](
810
+ this.samples / (this.timeBase.toRate({ fixed: !1 }) / i.toRate({ fixed: !1 }))
811
811
  ), o = { ...V.conformTimeBase, ...s || {} };
812
812
  return new S(
813
813
  {
814
- samples: i,
815
- timeBase: n
814
+ samples: n,
815
+ timeBase: i
816
816
  },
817
817
  o
818
818
  );
@@ -830,7 +830,7 @@ class S {
830
830
  */
831
831
  toText(t) {
832
832
  let s = `${this.samples}`;
833
- const n = { ...V.toText, ...t || {} }, r = this.timeBase.toText(n);
833
+ const i = { ...V.toText, ...t || {} }, r = this.timeBase.toText(i);
834
834
  return (t != null && t.includeTimeBaseForSeconds || !["1", "1:1"].includes(r)) && (s = [this.samples, r].join("@")), s;
835
835
  }
836
836
  /**
@@ -852,11 +852,11 @@ class S {
852
852
  const t = this.samples + (this.dropFrame ? ut(this) : 0);
853
853
  let s = this.timeBase.toRate({ rounded: !0 });
854
854
  ["23.976", "23.98"].includes(this.timeBase.toConstant()) && (s = this.timeBase.toRate({ fixed: !0 }));
855
- const n = Math.floor(t / (3600 * s)), r = Math.floor(t / (60 * s)) % 60, i = Math.floor(t / s) % 60, o = Math.floor(t % s);
855
+ const i = Math.floor(t / (3600 * s)), r = Math.floor(t / (60 * s)) % 60, n = Math.floor(t / s) % 60, o = Math.floor(t % s);
856
856
  return {
857
- hours: n,
857
+ hours: i,
858
858
  minutes: r,
859
- seconds: i,
859
+ seconds: n,
860
860
  frames: o
861
861
  };
862
862
  }
@@ -868,10 +868,10 @@ class S {
868
868
  * @returns Time for the time code
869
869
  */
870
870
  toTime() {
871
- const t = this.samples + ut(this), { hours: s, minutes: n, seconds: r } = this.toUnits(), i = this.timeBase.toRate({ rounded: !0 }), o = t % i, a = Math.floor(1e3 * o / i), c = o / i;
871
+ const t = this.samples + ut(this), { hours: s, minutes: i, seconds: r } = this.toUnits(), n = this.timeBase.toRate({ rounded: !0 }), o = t % n, a = Math.floor(1e3 * o / n), c = o / n;
872
872
  return {
873
873
  hours: s,
874
- minutes: n,
874
+ minutes: i,
875
875
  seconds: r,
876
876
  milliseconds: a,
877
877
  partialSeconds: c
@@ -883,7 +883,7 @@ class S {
883
883
  * @returns Total seconds for the time code
884
884
  */
885
885
  toSeconds(t) {
886
- const { numerator: s, denominator: n } = this.timeBase, r = +(this.samples * s / n);
886
+ const { numerator: s, denominator: i } = this.timeBase, r = +(this.samples * s / i);
887
887
  return t != null && t.round ? Math.round(1e3 * r) / 1e3 : r;
888
888
  }
889
889
  /**
@@ -906,48 +906,48 @@ class S {
906
906
  * @returns Duration representation of the TimeCode
907
907
  */
908
908
  toDuration(t) {
909
- const { format: s } = { ...V.toDuration, ...t || {} }, { hours: n, ...r } = this.toTime();
910
- let { minutes: i, seconds: o, milliseconds: a } = r;
909
+ const { format: s } = { ...V.toDuration, ...t || {} }, { hours: i, ...r } = this.toTime();
910
+ let { minutes: n, seconds: o, milliseconds: a } = r;
911
911
  if (s && typeof s != "string")
912
912
  throw Error("format has to be a string");
913
- const c = (m, p) => !s.includes(m) || !p.some((l) => s.includes(l) && s.lastIndexOf(m) > s.indexOf(l));
913
+ const c = (m, p) => !s.includes(m) || !p.some((d) => s.includes(d) && s.lastIndexOf(m) > s.indexOf(d));
914
914
  if (s && !(c("h", ["m", "s", "S"]) && c("m", ["s", "S"]) && c("s", ["S"])))
915
915
  throw Error("format order is unsupported (has to be h, m, s then S)");
916
916
  if (!s)
917
- return `${n > 0 ? `${n}:${`${i}`.padStart(2, "0")}` : i}:${`${o}`.padStart(2, "0")}`;
918
- const d = (m, p) => {
919
- let l = m;
920
- for (; p[l] === p[l + 1]; )
921
- l += 1;
922
- return l - m + 1;
917
+ return `${i > 0 ? `${i}:${`${n}`.padStart(2, "0")}` : n}:${`${o}`.padStart(2, "0")}`;
918
+ const l = (m, p) => {
919
+ let d = m;
920
+ for (; p[d] === p[d + 1]; )
921
+ d += 1;
922
+ return d - m + 1;
923
923
  }, u = ["h", "m", "s", "S"], f = [];
924
- return [...s].forEach((m, p, l) => {
924
+ return [...s].forEach((m, p, d) => {
925
925
  switch (m) {
926
926
  case "h": {
927
- if (l[p - 1] === "h")
927
+ if (d[p - 1] === "h")
928
928
  break;
929
- const h = d(p, l);
930
- f.push(`${n}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(":");
929
+ const h = l(p, d);
930
+ f.push(`${i}`.padStart(h, "0")), u.includes(d[p + h]) && f.push(":");
931
931
  break;
932
932
  }
933
933
  case "m": {
934
- if (l[p - 1] === "m")
934
+ if (d[p - 1] === "m")
935
935
  break;
936
- const h = d(p, l);
937
- s.includes("h") || (i += n * 60), f.push(`${i}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(":");
936
+ const h = l(p, d);
937
+ s.includes("h") || (n += i * 60), f.push(`${n}`.padStart(h, "0")), u.includes(d[p + h]) && f.push(":");
938
938
  break;
939
939
  }
940
940
  case "s": {
941
- if (l[p - 1] === "s")
941
+ if (d[p - 1] === "s")
942
942
  break;
943
- const h = d(p, l);
944
- s.includes("m") || (o += i * 60), f.push(`${o}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(".");
943
+ const h = l(p, d);
944
+ s.includes("m") || (o += n * 60), f.push(`${o}`.padStart(h, "0")), u.includes(d[p + h]) && f.push(".");
945
945
  break;
946
946
  }
947
947
  case "S": {
948
- if (l[p - 1] === "S")
948
+ if (d[p - 1] === "S")
949
949
  break;
950
- const h = d(p, l);
950
+ const h = l(p, d);
951
951
  s.includes("s") || (a += o * 1e3), f.push(`${Math.round(a / 10 ** (3 - h))}`.padStart(h, "0"));
952
952
  break;
953
953
  }
@@ -970,12 +970,12 @@ class S {
970
970
  };
971
971
  if (this.samples === -1 / 0)
972
972
  return "00:00:00:00";
973
- const { hours: n, minutes: r, seconds: i, frames: o } = this.toUnits(), a = s ? this.frameSeparator : ":", c = [
974
- n.toFixed().padStart(2, "0"),
973
+ const { hours: i, minutes: r, seconds: n, frames: o } = this.toUnits(), a = s ? this.frameSeparator : ":", c = [
974
+ i.toFixed().padStart(2, "0"),
975
975
  r.toFixed().padStart(2, "0"),
976
- i.toFixed().padStart(2, "0")
977
- ].join(a), d = Math.max(2, `${this.timeBase.toRate({ rounded: !0 }) - 1}`.length);
978
- return [c, `${o}`.padStart(d, "0")].join(this.frameSeparator);
976
+ n.toFixed().padStart(2, "0")
977
+ ].join(a), l = Math.max(2, `${this.timeBase.toRate({ rounded: !0 }) - 1}`.length);
978
+ return [c, `${o}`.padStart(l, "0")].join(this.frameSeparator);
979
979
  }
980
980
  /**
981
981
  * Get TimeCode as a VidiCore TimeCodeType object
@@ -998,12 +998,12 @@ class S {
998
998
  }
999
999
  }
1000
1000
  const ue = (e, t) => {
1001
- let s = Math.abs(e), n = Math.abs(t);
1002
- for (; s && n && s !== n; )
1003
- s > n ? [s, n] = [s - n, n] : [s, n] = [s, n - s];
1004
- return s || n;
1005
- }, le = (e, t) => {
1006
- const { timeBase: s, useGCD: n = !1, roundingMode: r, ...i } = t || {}, o = `${e}`.replace(/,/g, ".");
1001
+ let s = Math.abs(e), i = Math.abs(t);
1002
+ for (; s && i && s !== i; )
1003
+ s > i ? [s, i] = [s - i, i] : [s, i] = [s, i - s];
1004
+ return s || i;
1005
+ }, de = (e, t) => {
1006
+ const { timeBase: s, useGCD: i = !1, roundingMode: r, ...n } = t || {}, o = `${e}`.replace(/,/g, ".");
1007
1007
  if (Number.isNaN(+o))
1008
1008
  throw new Error(`seconds must be digits, is ${e}`);
1009
1009
  let a = 1, c;
@@ -1013,45 +1013,45 @@ const ue = (e, t) => {
1013
1013
  const [, u] = o.split("."), f = Math.min((u == null ? void 0 : u.length) ?? 0, 16);
1014
1014
  a *= 10 ** f, c = Math.round(Number(o) * a);
1015
1015
  }
1016
- if (s === void 0 && n) {
1016
+ if (s === void 0 && i) {
1017
1017
  const u = ue(a, c);
1018
1018
  c /= u, a /= u;
1019
1019
  }
1020
- const d = new S(
1020
+ const l = new S(
1021
1021
  { samples: c, timeBase: { denominator: a, numerator: 1 } },
1022
- i
1022
+ n
1023
1023
  );
1024
- return s !== void 0 ? d.conformTimeBase(s, { ...i, roundingMode: r }) : d;
1025
- }, de = ([e, t, s, n], r, i) => {
1026
- const o = i.toRate({ rounded: !0 }), a = st(i);
1024
+ return s !== void 0 ? l.conformTimeBase(s, { ...n, roundingMode: r }) : l;
1025
+ }, le = ([e, t, s, i], r, n) => {
1026
+ const o = n.toRate({ rounded: !0 }), a = st(n);
1027
1027
  if (r === 0 || !a)
1028
1028
  return 0;
1029
- const c = t % 10 !== 0, d = c && s === 0, u = e * (3600 * o - 54 * a), f = t * 60 * o - (t - Math.ceil(t / 10)) * a, m = s * o - (c && s > 1 ? a : 0);
1030
- if (d && n < a)
1029
+ const c = t % 10 !== 0, l = c && s === 0, u = e * (3600 * o - 54 * a), f = t * 60 * o - (t - Math.ceil(t / 10)) * a, m = s * o - (c && s > 1 ? a : 0);
1030
+ if (l && i < a)
1031
1031
  throw new Error(
1032
- `Frame does not exist for ${i.toConstant() || i.toRate()} drop-frame`
1032
+ `Frame does not exist for ${n.toConstant() || n.toRate()} drop-frame`
1033
1033
  );
1034
- const p = d ? n - a : n, l = u + f + m + p;
1035
- return r - l;
1034
+ const p = l ? i - a : i, d = u + f + m + p;
1035
+ return r - d;
1036
1036
  }, H = (e, t, s) => {
1037
- const [n, r, i, o] = e, a = t.toRate({ rounded: !0 }), c = n * 3600 * a + r * 60 * a + i * a + o;
1038
- return c - (s ? de(e, c, t) : 0);
1037
+ const [i, r, n, o] = e, a = t.toRate({ rounded: !0 }), c = i * 3600 * a + r * 60 * a + n * a + o;
1038
+ return c - (s ? le(e, c, t) : 0);
1039
1039
  }, fe = (e) => {
1040
1040
  const [t] = (e == null ? void 0 : e.match(/[^0-9:\-_]/)) || [];
1041
1041
  let s = [];
1042
1042
  if (t) {
1043
- const [r, i] = e.split(t);
1044
- s = [...r.split(":"), i];
1043
+ const [r, n] = e.split(t);
1044
+ s = [...r.split(":"), n];
1045
1045
  } else
1046
1046
  s = e.split(":");
1047
1047
  if (s.length !== 4)
1048
1048
  throw new Error('Invalid format, must be "##:##:##:##');
1049
1049
  if (s.some((r) => Number.isNaN(r)))
1050
1050
  throw new Error("Invalid format, values must be numbers");
1051
- const n = t || ":";
1051
+ const i = t || ":";
1052
1052
  return {
1053
1053
  smpteValues: s.map(Number),
1054
- smpteFrameSeparator: n
1054
+ smpteFrameSeparator: i
1055
1055
  };
1056
1056
  }, me = ["error", "add", "ignore"], he = {
1057
1057
  exceedingMode: "error",
@@ -1059,38 +1059,38 @@ const ue = (e, t) => {
1059
1059
  dropFrame: void 0,
1060
1060
  frameSeparator: void 0
1061
1061
  }, pe = (e, t) => {
1062
- const { exceedingMode: s, timeBase: n, ...r } = { ...he, ...t };
1062
+ const { exceedingMode: s, timeBase: i, ...r } = { ...he, ...t };
1063
1063
  if ([null, void 0].includes(e))
1064
1064
  throw new Error("smpte cannot be undefined or null");
1065
1065
  if (typeof e != "string")
1066
1066
  throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);
1067
- const { smpteValues: i, smpteFrameSeparator: o } = fe(e), a = $(n), c = {
1067
+ const { smpteValues: n, smpteFrameSeparator: o } = fe(e), a = $(i), c = {
1068
1068
  ...r,
1069
1069
  frameSeparator: (r == null ? void 0 : r.frameSeparator) || o,
1070
1070
  ...(r == null ? void 0 : r.dropFrame) === void 0 ? {
1071
- dropFrame: n !== void 0 ? wt(a) : [";", ","].includes(o)
1071
+ dropFrame: i !== void 0 ? wt(a) : [";", ","].includes(o)
1072
1072
  } : {}
1073
- }, d = a.toRate({ rounded: !0 }), u = Math.max(0, d - 1);
1074
- if (i.some((m) => m < 0))
1073
+ }, l = a.toRate({ rounded: !0 }), u = Math.max(0, l - 1);
1074
+ if (n.some((m) => m < 0))
1075
1075
  throw new Error("Negative values are not supported");
1076
1076
  let f;
1077
1077
  switch (s) {
1078
1078
  case "error": {
1079
- const [m, p, l, h] = i;
1079
+ const [m, p, d, h] = n;
1080
1080
  if (m >= 100 || p >= 60)
1081
1081
  throw Error("Minutes has to be less than 60");
1082
- if (l >= 60)
1082
+ if (d >= 60)
1083
1083
  throw Error("Seconds has to be less than 60");
1084
1084
  if (h > u)
1085
1085
  throw Error(`Frames has to be less or equal to ${u}`);
1086
- f = H(i, a, c == null ? void 0 : c.dropFrame);
1086
+ f = H(n, a, c == null ? void 0 : c.dropFrame);
1087
1087
  break;
1088
1088
  }
1089
1089
  case "ignore": {
1090
- const [m, p, l, h] = i, g = [
1090
+ const [m, p, d, h] = n, g = [
1091
1091
  Math.min(100, m),
1092
1092
  Math.min(59, p),
1093
- Math.min(59, l),
1093
+ Math.min(59, d),
1094
1094
  Math.min(u, h)
1095
1095
  ];
1096
1096
  f = H(
@@ -1101,7 +1101,7 @@ const ue = (e, t) => {
1101
1101
  break;
1102
1102
  }
1103
1103
  case "add": {
1104
- f = H(i, a, c == null ? void 0 : c.dropFrame);
1104
+ f = H(n, a, c == null ? void 0 : c.dropFrame);
1105
1105
  break;
1106
1106
  }
1107
1107
  default:
@@ -1113,7 +1113,7 @@ const ue = (e, t) => {
1113
1113
  dropFrame: void 0,
1114
1114
  frameSeparator: void 0
1115
1115
  }, U = (e, t) => {
1116
- const { timeBase: s, ...n } = { ..._e, ...t };
1116
+ const { timeBase: s, ...i } = { ..._e, ...t };
1117
1117
  let r;
1118
1118
  if (e === void 0)
1119
1119
  r = { samples: 0 };
@@ -1126,8 +1126,8 @@ const ue = (e, t) => {
1126
1126
  e === "-INF" ? r = { samples: -1 / 0 } : e === "+INF" ? r = { samples: 1 / 0 } : r = { samples: Number(e) };
1127
1127
  if (Number.isNaN(r == null ? void 0 : r.samples) || r.timeBase && !(r.timeBase instanceof R))
1128
1128
  throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);
1129
- const i = new S(r, n);
1130
- return s ? i.conformTimeBase($(s), n) : i;
1129
+ const n = new S(r, i);
1130
+ return s ? n.conformTimeBase($(s), i) : n;
1131
1131
  }, Te = {
1132
1132
  dropFrame: void 0,
1133
1133
  frameSeparator: void 0
@@ -1139,19 +1139,19 @@ const ue = (e, t) => {
1139
1139
  if (typeof e == "string" && ge(e))
1140
1140
  return pe(e, t);
1141
1141
  if (["string", "number"].includes(typeof e) && Ee(e))
1142
- return le(e, t);
1142
+ return de(e, t);
1143
1143
  if (typeof e == "string")
1144
1144
  return U(e, t);
1145
1145
  };
1146
- function lt({ hours: e = 0, minutes: t = 0, seconds: s = 0, partialSeconds: n = 0 }) {
1147
- const r = e.toFixed().padStart(2, "0"), i = t.toFixed().padStart(2, "0"), o = s.toFixed().padStart(2, "0"), a = (n * 10).toFixed().padStart(3, "0");
1148
- return `${r}:${i}:${o}.${a}`;
1146
+ function dt({ hours: e = 0, minutes: t = 0, seconds: s = 0, partialSeconds: i = 0 }) {
1147
+ const r = e.toFixed().padStart(2, "0"), n = t.toFixed().padStart(2, "0"), o = s.toFixed().padStart(2, "0"), a = (i * 10).toFixed().padStart(3, "0");
1148
+ return `${r}:${n}:${o}.${a}`;
1149
1149
  }
1150
1150
  const Ae = {
1151
1151
  subtitleGroup: "stl_subtitle",
1152
1152
  subtitleField: "stl_text"
1153
1153
  }, fs = (e, t) => {
1154
- const { subtitleGroup: s, subtitleField: n } = { ...Ae, ...t || {} }, { timespan: r = [] } = e || {};
1154
+ const { subtitleGroup: s, subtitleField: i } = { ...Ae, ...t || {} }, { timespan: r = [] } = e || {};
1155
1155
  if (r.length === 0)
1156
1156
  return "";
1157
1157
  const o = Ct(r, {
@@ -1163,12 +1163,12 @@ const Ae = {
1163
1163
  }).map((a) => {
1164
1164
  const {
1165
1165
  start: c,
1166
- end: d,
1167
- [s]: { [n]: u } = {}
1166
+ end: l,
1167
+ [s]: { [i]: u } = {}
1168
1168
  } = (Array.isArray(a) ? a[0] : a) || {};
1169
1169
  if (!u)
1170
1170
  return "";
1171
- const f = lt(U(c).toTime()), m = lt(U(d).toTime());
1171
+ const f = dt(U(c).toTime()), m = dt(U(l).toTime());
1172
1172
  return `${f} --> ${m} line:0%\r${u}\r`;
1173
1173
  });
1174
1174
  if (o.some((a) => !!a))
@@ -1178,29 +1178,29 @@ const Ae = {
1178
1178
  ${o.join(`
1179
1179
  `)}`;
1180
1180
  }, Ie = { count: !0, exclude: !0 }, ms = (e = [], t = {}) => {
1181
- const s = { ...Ie, ...t }, { count: n, exclude: r } = s;
1182
- return e.map((i) => typeof i == "string" ? {
1183
- field: i,
1184
- name: i,
1185
- count: n,
1186
- ...r === !0 ? { exclude: [i] } : {}
1187
- } : i);
1188
- }, hs = (e = []) => e == null ? void 0 : e.map(({ name: t, field: s, count: n, range: r }) => ({
1181
+ const s = { ...Ie, ...t }, { count: i, exclude: r } = s;
1182
+ return e.map((n) => typeof n == "string" ? {
1183
+ field: n,
1184
+ name: n,
1185
+ count: i,
1186
+ ...r === !0 ? { exclude: [n] } : {}
1187
+ } : n);
1188
+ }, hs = (e = []) => e == null ? void 0 : e.map(({ name: t, field: s, count: i, range: r }) => ({
1189
1189
  facetName: t,
1190
1190
  fieldName: s,
1191
- count: n == null ? void 0 : n.reduce((i, { fieldValue: o, value: a }) => ({ ...i, [o]: a }), {}),
1191
+ count: i == null ? void 0 : i.reduce((n, { fieldValue: o, value: a }) => ({ ...n, [o]: a }), {}),
1192
1192
  ...r ? {
1193
- range: r.map(({ value: i, start: o, end: a }) => ({
1193
+ range: r.map(({ value: n, start: o, end: a }) => ({
1194
1194
  start: Number.isNaN(+o) ? o : Number(o),
1195
1195
  end: Number.isNaN(+a) ? a : Number(a),
1196
- count: Number(i) || 0
1196
+ count: Number(n) || 0
1197
1197
  }))
1198
1198
  } : {}
1199
1199
  })), ps = (e = []) => {
1200
1200
  const t = {};
1201
- return e.forEach(({ name: s, field: n, count: r }) => {
1202
- t[s || n] = r.reduce(
1203
- (i, { fieldValue: o, value: a }) => ({ ...i, [o]: a }),
1201
+ return e.forEach(({ name: s, field: i, count: r }) => {
1202
+ t[s || i] = r.reduce(
1203
+ (n, { fieldValue: o, value: a }) => ({ ...n, [o]: a }),
1204
1204
  {}
1205
1205
  );
1206
1206
  }), t;
@@ -1211,15 +1211,15 @@ ${o.join(`
1211
1211
  }, Y = (e, t) => {
1212
1212
  const {
1213
1213
  arrayOnSingle: s = !0,
1214
- joinValue: n = void 0,
1214
+ joinValue: i = void 0,
1215
1215
  timespanAsList: r = !1
1216
- } = { ...Bt, ...t || {} }, { field: i = [], start: o, end: a } = e || {}, c = r ? { start: o, end: a } : {};
1217
- return i.reduce((u, f) => {
1216
+ } = { ...Bt, ...t || {} }, { field: n = [], start: o, end: a } = e || {}, c = r ? { start: o, end: a } : {};
1217
+ return n.reduce((u, f) => {
1218
1218
  const { name: m, value: p = [] } = f;
1219
1219
  if (p.length === 0)
1220
1220
  return u;
1221
- let l;
1222
- return s === !1 && p.length === 1 ? [l] = p : n ? l = p.join(n) : l = p, { ...u, [m]: l };
1221
+ let d;
1222
+ return s === !1 && p.length === 1 ? [d] = p : i ? d = p.join(i) : d = p, { ...u, [m]: d };
1223
1223
  }, c);
1224
1224
  }, Oe = {
1225
1225
  ...Bt,
@@ -1230,20 +1230,20 @@ ${o.join(`
1230
1230
  }, _s = (e = [], t) => {
1231
1231
  const {
1232
1232
  timespanAsList: s,
1233
- joinTimespan: n = "_",
1233
+ joinTimespan: i = "_",
1234
1234
  flat: r,
1235
- flatTimespan: i,
1235
+ flatTimespan: n,
1236
1236
  ...o
1237
1237
  } = { ...Oe, ...t || {} };
1238
1238
  return s === !0 ? e.map(
1239
1239
  (a) => Y(a, { ...o, timespanAsList: s })
1240
- ) : r === !0 || i === !0 ? e.reduce(
1240
+ ) : r === !0 || n === !0 ? e.reduce(
1241
1241
  (a, c) => ({ ...a, ...Y(c, t) }),
1242
1242
  {}
1243
1243
  ) : e.reduce(
1244
1244
  (a, c) => ({
1245
1245
  ...a,
1246
- [[c.start, c.end].join(n)]: Y(
1246
+ [[c.start, c.end].join(i)]: Y(
1247
1247
  c,
1248
1248
  t
1249
1249
  )
@@ -1251,11 +1251,11 @@ ${o.join(`
1251
1251
  {}
1252
1252
  );
1253
1253
  }, be = (e, t) => {
1254
- const s = j(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: r = [] } = n, i = r.map((a) => {
1254
+ const s = j(t).toSeconds(), { thumbnails: i = {} } = e || {}, { uri: r = [] } = i, n = r.map((a) => {
1255
1255
  const c = a.split("/").pop().split("?").shift();
1256
1256
  return U(c).toSeconds();
1257
- }), o = i.reduce(
1258
- (a, c, d) => Math.abs(c - s) < Math.abs(i[a] - s) ? d : a,
1257
+ }), o = n.reduce(
1258
+ (a, c, l) => Math.abs(c - s) < Math.abs(n[a] - s) ? l : a,
1259
1259
  0
1260
1260
  );
1261
1261
  return r[o];
@@ -1269,15 +1269,15 @@ ${o.join(`
1269
1269
  end: t,
1270
1270
  group: s = [{ id: "unknown", name: "unknown" }]
1271
1271
  }) => {
1272
- const [{ id: n, name: r }] = s, i = j(e).toSeconds(), o = j(t).toSeconds();
1273
- return { start: e, end: t, startSeconds: i, endSeconds: o, group: { uuid: n, name: r } };
1272
+ const [{ id: i, name: r }] = s, n = j(e).toSeconds(), o = j(t).toSeconds();
1273
+ return { start: e, end: t, startSeconds: n, endSeconds: o, group: { uuid: i, name: r } };
1274
1274
  }, Ts = (e = {}, t) => {
1275
- const { entry: s = [] } = e, n = {
1275
+ const { entry: s = [] } = e, i = {
1276
1276
  ...Re,
1277
1277
  ...t || {}
1278
- }, { includeGroupMetadata: r, flatEvents: i, includeEntityType: o, includeNearestThumbnail: a } = n, c = s.map((d) => {
1279
- const { type: u, item: { metadata: f = {}, id: m, thumbnails: p = {} } = {}, timespan: l, item: h } = d;
1280
- let g = l.map(
1278
+ }, { includeGroupMetadata: r, flatEvents: n, includeEntityType: o, includeNearestThumbnail: a } = i, c = s.map((l) => {
1279
+ const { type: u, item: { metadata: f = {}, id: m, thumbnails: p = {} } = {}, timespan: d, item: h } = l;
1280
+ let g = d.map(
1281
1281
  (E) => ye(E)
1282
1282
  );
1283
1283
  if (a && u === "Item" && p.uri && (g = g.map((E) => {
@@ -1319,23 +1319,23 @@ ${o.join(`
1319
1319
  ...o && u === "Collection" ? { collectionType: h } : {}
1320
1320
  };
1321
1321
  });
1322
- return i ? c.flatMap(
1323
- ({ events: d, entityType: u, entityId: f, itemType: m, collectionType: p }) => d.map(
1324
- (l) => ({
1325
- ...l,
1322
+ return n ? c.flatMap(
1323
+ ({ events: l, entityType: u, entityId: f, itemType: m, collectionType: p }) => l.map(
1324
+ (d) => ({
1325
+ ...d,
1326
1326
  entityType: u,
1327
1327
  entityId: f,
1328
1328
  ...m && { itemType: m },
1329
1329
  ...p && { collectionType: p }
1330
1330
  })
1331
1331
  )
1332
- ).sort((d, u) => d.startSeconds - u.startSeconds) : c;
1332
+ ).sort((l, u) => l.startSeconds - u.startSeconds) : c;
1333
1333
  }, gs = (e = "NOW") => {
1334
1334
  if (e.startsWith("NOW")) {
1335
1335
  if (e === "NOW")
1336
1336
  return /* @__PURE__ */ new Date();
1337
- const t = e[3], s = Number(e.match(/(\d+)/)[0]), n = e.match(/(\d.*)/)[0].replace(/\d/g, ""), r = /* @__PURE__ */ new Date();
1338
- switch (n) {
1337
+ const t = e[3], s = Number(e.match(/(\d+)/)[0]), i = e.match(/(\d.*)/)[0].replace(/\d/g, ""), r = /* @__PURE__ */ new Date();
1338
+ switch (i) {
1339
1339
  case "HOUR":
1340
1340
  case "HOURS":
1341
1341
  t === "+" && r.setHours(r.getHours() + s), t === "-" && r.setHours(r.getHours() - s);
@@ -1359,34 +1359,34 @@ ${o.join(`
1359
1359
  }, z = (e) => {
1360
1360
  const { property: t = [], ...s } = e || {};
1361
1361
  return { ...F(t), ...s };
1362
- }, Se = (e) => z(e), ve = (e) => z(e), Me = { kB: "kHz", B: "Hz", mB: "mHz" }, dt = { kB: "kbps", B: "bps", MB: "mbps" }, De = (e) => {
1362
+ }, Se = (e) => z(e), ve = (e) => z(e), Me = { kB: "kHz", B: "Hz", mB: "mHz" }, lt = { kB: "kbps", B: "bps", MB: "mbps" }, De = (e) => {
1363
1363
  var g;
1364
1364
  const {
1365
1365
  timeBase: t,
1366
1366
  channelCount: s,
1367
- codec: n,
1367
+ codec: i,
1368
1368
  mediaInfo: r,
1369
- bitrate: i,
1369
+ bitrate: n,
1370
1370
  metadata: o
1371
1371
  } = e, a = Se(r), {
1372
1372
  Format: c,
1373
- Resolution: d,
1373
+ Resolution: l,
1374
1374
  Bit_rate_mode: u
1375
1375
  } = a, f = F(o || []), m = t != null && t.denominator ? ((t == null ? void 0 : t.denominator) || 1) / ((t == null ? void 0 : t.numerator) || 1) : void 0, p = m !== void 0 ? w(m, {
1376
1376
  base: 10,
1377
1377
  round: 1,
1378
1378
  symbols: Me
1379
1379
  }) : void 0;
1380
- let l, h;
1381
- return i !== void 0 && (l = w(i, { round: 2, symbols: dt }), h = Number(
1382
- (g = w(i, { exponent: 1, symbols: dt }).split(" kbps")) == null ? void 0 : g[0]
1380
+ let d, h;
1381
+ return n !== void 0 && (d = w(n, { round: 2, symbols: lt }), h = Number(
1382
+ (g = w(n, { exponent: 1, symbols: lt }).split(" kbps")) == null ? void 0 : g[0]
1383
1383
  )), {
1384
1384
  audioFormat: c,
1385
- audioCodec: n,
1385
+ audioCodec: i,
1386
1386
  audioSamplerate: p,
1387
1387
  audioSamplerateSamples: m,
1388
- audioBitDepth: d,
1389
- audioBitrate: l,
1388
+ audioBitDepth: l,
1389
+ audioBitrate: d,
1390
1390
  audioBitrateKbps: h,
1391
1391
  audioBitRateMode: u,
1392
1392
  audioChannels: s,
@@ -1420,25 +1420,25 @@ ${o.join(`
1420
1420
  const {
1421
1421
  uri: t = [],
1422
1422
  size: s,
1423
- hash: n,
1423
+ hash: i,
1424
1424
  path: r,
1425
- id: i,
1425
+ id: n,
1426
1426
  storage: o
1427
- } = e, [a] = t, c = s !== void 0 ? w(s, { base: 2, standard: "jedec" }) : "", d = (r == null ? void 0 : r.split("/")) || [], u = d.pop() || "", f = d.map((m) => `${m}/`).join("") || void 0;
1427
+ } = e, [a] = t, c = s !== void 0 ? w(s, { base: 2, standard: "jedec" }) : "", l = (r == null ? void 0 : r.split("/")) || [], u = l.pop() || "", f = l.map((m) => `${m}/`).join("") || void 0;
1428
1428
  return {
1429
1429
  uri: a,
1430
- hash: n,
1430
+ hash: i,
1431
1431
  fileSize: c,
1432
1432
  fileSizeBytes: s,
1433
1433
  path: r,
1434
1434
  fileName: u,
1435
- fileId: i,
1435
+ fileId: n,
1436
1436
  storageId: o,
1437
1437
  folderPath: f
1438
1438
  };
1439
1439
  }, Fe = (e = {}) => {
1440
- const { file: t, mediaInfo: s, metadata: n = [] } = e, r = F(n), i = z(s);
1441
- let o = { binaryMetadata: r, binaryMediaInfo: i };
1440
+ const { file: t, mediaInfo: s, metadata: i = [] } = e, r = F(i), n = z(s);
1441
+ let o = { binaryMetadata: r, binaryMediaInfo: n };
1442
1442
  if (t) {
1443
1443
  const [a] = t, c = Pt(a);
1444
1444
  o = {
@@ -1451,94 +1451,94 @@ ${o.join(`
1451
1451
  const {
1452
1452
  mediaInfo: t,
1453
1453
  metadata: s,
1454
- file: n,
1454
+ file: i,
1455
1455
  duration: r,
1456
- startTimestamp: i,
1456
+ startTimestamp: n,
1457
1457
  startTimecode: o,
1458
1458
  timeCodeTimeBase: a
1459
- } = e, c = F(s || []), d = z(t);
1460
- let { Format: u } = d;
1459
+ } = e, c = F(s || []), l = z(t);
1460
+ let { Format: u } = l;
1461
1461
  const {
1462
1462
  Video_Format_List: f,
1463
1463
  Audio_Format_List: m,
1464
1464
  Text_Format_List: p
1465
- } = d;
1465
+ } = l;
1466
1466
  if (u === void 0) {
1467
1467
  const { format: h } = e;
1468
1468
  u = h, h && h.includes(",") && ([u] = h.split(","));
1469
1469
  }
1470
- let l = {
1470
+ let d = {
1471
1471
  containerFormat: u,
1472
1472
  videoFormat: f,
1473
1473
  audioFormat: m,
1474
1474
  textFormat: p,
1475
1475
  containerMetadata: c,
1476
- containerMediaInfo: d
1476
+ containerMediaInfo: l
1477
1477
  };
1478
- if (c.componentOriginalFilename && (l.originalFilename = c.componentOriginalFilename), r !== void 0 && r.samples !== 0) {
1478
+ if (c.componentOriginalFilename && (d.originalFilename = c.componentOriginalFilename), r !== void 0 && r.samples !== 0) {
1479
1479
  const h = L(r);
1480
- l.durationTimeCode = h.toObject(), l.duration = h.toDuration();
1480
+ d.durationTimeCode = h.toObject(), d.duration = h.toDuration();
1481
1481
  }
1482
- if (i && (l.startTimestamp = L(i).toObject()), o !== void 0 && a && (l.startTimecode = L({
1482
+ if (n && (d.startTimestamp = L(n).toObject()), o !== void 0 && a && (d.startTimecode = L({
1483
1483
  samples: o,
1484
1484
  timeBase: a
1485
- })), n) {
1486
- const [h] = n, g = Pt(h);
1487
- l = {
1488
- ...l,
1485
+ })), i) {
1486
+ const [h] = i, g = Pt(h);
1487
+ d = {
1488
+ ...d,
1489
1489
  ...g
1490
1490
  };
1491
1491
  }
1492
- return l;
1492
+ return d;
1493
1493
  }, ft = { kB: "kbps", B: "bps", MB: "mbps" }, Ce = (e = {}) => {
1494
1494
  var k;
1495
1495
  const {
1496
1496
  codec: t,
1497
1497
  bitrate: s,
1498
- fieldOrder: n,
1498
+ fieldOrder: i,
1499
1499
  resolution: r,
1500
- mediaInfo: i,
1500
+ mediaInfo: n,
1501
1501
  metadata: o = []
1502
- } = e, a = ve(i), c = F(o), {
1503
- Format: d,
1502
+ } = e, a = ve(n), c = F(o), {
1503
+ Format: l,
1504
1504
  "Frame rate": u,
1505
1505
  "Color space": f,
1506
1506
  "Color primaries": m,
1507
1507
  Colorimetry: p
1508
1508
  } = a;
1509
- let l;
1509
+ let d;
1510
1510
  const { averageFrameRate: h, realBaseFrameRate: g } = e;
1511
- g !== void 0 ? l = x({
1511
+ g !== void 0 ? d = x({
1512
1512
  numerator: g.denominator,
1513
1513
  denominator: g.numerator
1514
- }) : u !== void 0 ? l = et(u) : h !== void 0 && (l = x({
1514
+ }) : u !== void 0 ? d = et(u) : h !== void 0 && (d = x({
1515
1515
  numerator: h.denominator,
1516
1516
  denominator: h.numerator
1517
1517
  }));
1518
1518
  let { "Frame count": E } = a;
1519
1519
  if (E === void 0) {
1520
- const { numberOfPackets: it } = e;
1521
- it !== void 0 && (E = it.toString());
1520
+ const { numberOfPackets: nt } = e;
1521
+ nt !== void 0 && (E = nt.toString());
1522
1522
  }
1523
1523
  let A, O, I;
1524
- E && l && (A = L({ samples: E, timeBase: l }), O = A.timeBase.toConstant() || A.timeBase.toRate(), I = A.toSmpte());
1524
+ E && d && (A = L({ samples: E, timeBase: d }), O = A.timeBase.toConstant() || A.timeBase.toRate(), I = A.toSmpte());
1525
1525
  const { height: b, width: M } = r || {}, N = J(r), C = `${M}x${b}`;
1526
1526
  let v, B;
1527
1527
  return s !== void 0 && (v = w(s, { round: 2, symbols: ft }), B = Number(
1528
1528
  (k = w(s, { exponent: 2, symbols: ft }).split(" mbps")) == null ? void 0 : k[0]
1529
1529
  )), {
1530
- videoFormat: d,
1530
+ videoFormat: l,
1531
1531
  dimension: C,
1532
1532
  frameRate: O,
1533
1533
  height: b,
1534
1534
  width: M,
1535
- timeBase: l,
1535
+ timeBase: d,
1536
1536
  timeCode: A,
1537
1537
  videoCodec: t,
1538
1538
  smpte: I,
1539
1539
  videoBitrate: v,
1540
1540
  videoBitrateMbps: B,
1541
- fieldOrder: n,
1541
+ fieldOrder: i,
1542
1542
  colorSpace: f,
1543
1543
  chromaSubsampling: p,
1544
1544
  aspectRatio: N,
@@ -1548,22 +1548,22 @@ ${o.join(`
1548
1548
  };
1549
1549
  }, rt = (e = {}, t = {}) => {
1550
1550
  let s = {};
1551
- const { priority: n = ["container", "video", "audio", "binary"] } = t, {
1551
+ const { priority: i = ["container", "video", "audio", "binary"] } = t, {
1552
1552
  containerComponent: r,
1553
- videoComponent: i,
1553
+ videoComponent: n,
1554
1554
  audioComponent: o,
1555
1555
  binaryComponent: a,
1556
1556
  mimeType: c = [],
1557
- tag: d = []
1557
+ tag: l = []
1558
1558
  } = e;
1559
- [s.tag] = d, [s.mimeType] = c;
1559
+ [s.tag] = l, [s.mimeType] = c;
1560
1560
  const u = (f, m) => Object.fromEntries(
1561
1561
  [.../* @__PURE__ */ new Set([...Object.keys(m), ...Object.keys(f)])].map((p) => [
1562
1562
  p,
1563
1563
  m[p] ?? f[p]
1564
1564
  ])
1565
1565
  );
1566
- return n.reverse().forEach((f) => {
1566
+ return i.reverse().forEach((f) => {
1567
1567
  switch (f) {
1568
1568
  case "container":
1569
1569
  r && (s = u(
@@ -1572,8 +1572,8 @@ ${o.join(`
1572
1572
  ));
1573
1573
  break;
1574
1574
  case "video":
1575
- if (i) {
1576
- const [m] = i;
1575
+ if (n) {
1576
+ const [m] = n;
1577
1577
  s = u(
1578
1578
  s,
1579
1579
  Ce(m)
@@ -1655,23 +1655,23 @@ ${o.join(`
1655
1655
  ].reverse(), mt = ({ parsedShape: { tag: e } }, { parsedShape: { tag: t } }) => W.includes(e) || W.includes(t) ? W.indexOf(t) - W.indexOf(e) : e.toLowerCase().localeCompare(t.toLowerCase()), Is = (e, t) => {
1656
1656
  const {
1657
1657
  allowedMimeTypes: s = Le,
1658
- allowedMethods: n = xe,
1658
+ allowedMethods: i = xe,
1659
1659
  sortPriority: r = mt,
1660
- sourceKey: i = "src",
1660
+ sourceKey: n = "src",
1661
1661
  mimeTypeKey: o = "type",
1662
1662
  shapeKey: a = "shape",
1663
1663
  parsedShapeKey: c = "parsedShape"
1664
- } = t || {}, { shape: d = [] } = e || {}, u = d.reduce((f, m) => {
1665
- let p, l;
1664
+ } = t || {}, { shape: l = [] } = e || {}, u = l.reduce((f, m) => {
1665
+ let p, d;
1666
1666
  const h = rt(m), { uri: g, mimeType: E, containerFormat: A, videoCodec: O } = h;
1667
1667
  if (E && (p = E, (E === ke || E === We) && (A === $e || A === Ue) && O === Ge && (p = je)), g)
1668
- if (n) {
1668
+ if (i) {
1669
1669
  const [I] = g.split("://");
1670
- n.includes(I) && (l = g);
1670
+ i.includes(I) && (d = g);
1671
1671
  } else
1672
- l = g;
1673
- return l && s.includes(p) && f.push({
1674
- [i]: l,
1672
+ d = g;
1673
+ return d && s.includes(p) && f.push({
1674
+ [n]: d,
1675
1675
  [o]: p,
1676
1676
  [a]: m,
1677
1677
  [c]: h
@@ -1679,12 +1679,12 @@ ${o.join(`
1679
1679
  }, []);
1680
1680
  return typeof r == "function" && u.sort(mt), u;
1681
1681
  }, Os = (e) => {
1682
- const t = rt(e), { mimeType: s, videoCodec: n, audioCodec: r } = t;
1682
+ const t = rt(e), { mimeType: s, videoCodec: i, audioCodec: r } = t;
1683
1683
  if (s) {
1684
1684
  if (s.startsWith("audio/") && r !== void 0)
1685
1685
  return y.AUDIO;
1686
1686
  if (s.startsWith("video/")) {
1687
- if (n !== void 0)
1687
+ if (i !== void 0)
1688
1688
  return y.VIDEO;
1689
1689
  if (r !== void 0)
1690
1690
  return y.AUDIO;
@@ -1722,25 +1722,25 @@ ${o.join(`
1722
1722
  }) => $t(e[0], window.btoa(t), `.${s}`), bs = (e, t) => {
1723
1723
  const {
1724
1724
  allowedMimeTypes: s = qe,
1725
- allowedMethods: n = Xe,
1725
+ allowedMethods: i = Xe,
1726
1726
  streamingServers: r = []
1727
- } = t || {}, { shape: i = [] } = e || {}, { startTimeCode: o } = ce(e == null ? void 0 : e.metadata, {
1727
+ } = t || {}, { shape: n = [] } = e || {}, { startTimeCode: o } = ce(e == null ? void 0 : e.metadata, {
1728
1728
  flat: !0,
1729
1729
  arrayOnSingleValue: !1
1730
1730
  });
1731
- return i.reduce((c, d) => {
1731
+ return n.reduce((c, l) => {
1732
1732
  var M, N, C;
1733
1733
  let u, f, m;
1734
- const p = rt(d), { uri: l, mimeType: h, containerFormat: g, videoCodec: E } = p;
1735
- if (!(s != null && s.includes(h)) || !(n != null && n.includes((M = l == null ? void 0 : l.split("://")) == null ? void 0 : M[0])))
1734
+ const p = rt(l), { uri: d, mimeType: h, containerFormat: g, videoCodec: E } = p;
1735
+ if (!(s != null && s.includes(h)) || !(i != null && i.includes((M = d == null ? void 0 : d.split("://")) == null ? void 0 : M[0])))
1736
1736
  return c;
1737
1737
  if (m = p.tag, !m) {
1738
1738
  const v = (C = (N = h == null ? void 0 : h.split) == null ? void 0 : N.call(h, "/")) == null ? void 0 : C.pop(), B = c.filter((k) => k.label === v).length;
1739
1739
  B === 0 ? m = v : m = v + (B + 1);
1740
1740
  }
1741
1741
  const { timeBase: A, startTimecode: O } = p, I = o ?? O, b = I && j(I);
1742
- return f = l, u = h, (h === xt || h === jt) && (g === ze || g === Ve) && E === He && (u = Lt), r != null && r.length && kt.includes(h) && (f = Qe({
1743
- url: l,
1742
+ return f = d, u = h, (h === xt || h === jt) && (g === ze || g === Ve) && E === He && (u = Lt), r != null && r.length && kt.includes(h) && (f = Qe({
1743
+ url: d,
1744
1744
  streamingServers: r,
1745
1745
  ending: "mpd"
1746
1746
  }), u = "application/dash+xml"), f && c.push({
@@ -1755,37 +1755,37 @@ ${o.join(`
1755
1755
  const t = {}, { outputSetting: s = [] } = e || {};
1756
1756
  if (s.length === 0)
1757
1757
  return t;
1758
- const n = JSON.parse(s[0]), { Settings: { ContainerSettings: r, VideoDescription: i, AudioDescriptions: o } = {} } = n;
1759
- if (r && (t.containerFormat = r.Container), i) {
1760
- const { CodecSettings: a = {} } = i, { Codec: c, ...d } = a;
1758
+ const i = JSON.parse(s[0]), { Settings: { ContainerSettings: r, VideoDescription: n, AudioDescriptions: o } = {} } = i;
1759
+ if (r && (t.containerFormat = r.Container), n) {
1760
+ const { CodecSettings: a = {} } = n, { Codec: c, ...l } = a;
1761
1761
  t.videoFormat = c;
1762
- const { Height: u, Width: f } = i;
1762
+ const { Height: u, Width: f } = n;
1763
1763
  t.height = u, t.width = f, u && f && (t.dimension = `${f}x${u}`, t.aspectRatio = J({ height: u, width: f }));
1764
- const [m] = Object.values(d);
1764
+ const [m] = Object.values(l);
1765
1765
  if (m) {
1766
1766
  t.fieldOrder = m.InterlaceMode, t.fieldOrder && t.fieldOrder.includes("TOP") && (t.fieldOrder = "interlaced"), t.videoBitrate = m.Bitrate;
1767
- const p = m.FramerateDenominator, l = m.FramerateNumerator, h = x({ denominator: l, numerator: p });
1767
+ const p = m.FramerateDenominator, d = m.FramerateNumerator, h = x({ denominator: d, numerator: p });
1768
1768
  t.timeBase = h, t.frameRate = h.toConstant() || h.toRate();
1769
1769
  }
1770
1770
  }
1771
1771
  if (o && o.length > 0) {
1772
- const { CodecSettings: a = {} } = o[0], { Codec: c, ...d } = a;
1772
+ const { CodecSettings: a = {} } = o[0], { Codec: c, ...l } = a;
1773
1773
  t.audioFormat = c;
1774
- const [u] = Object.values(d);
1774
+ const [u] = Object.values(l);
1775
1775
  u && (t.audioSamplerate = u.SampleRate, t.audioBitrate = u.Bitrate, t.audioBitRateMode = u.RateControlMode);
1776
1776
  }
1777
1777
  return t;
1778
1778
  }, Rs = (e) => {
1779
- const t = {}, { description: s, format: n, audio: r, video: i, mediaconvert: o } = e || {};
1779
+ const t = {}, { description: s, format: i, audio: r, video: n, mediaconvert: o } = e || {};
1780
1780
  if (o)
1781
1781
  return { description: s, ...Ze(o) };
1782
- if (t.description = s, t.containerFormat = n, i) {
1783
- if (t.videoFormat = i.codec, t.videoBitrate = i.bitrate, i.framerate) {
1784
- const a = x(i.framerate);
1782
+ if (t.description = s, t.containerFormat = i, n) {
1783
+ if (t.videoFormat = n.codec, t.videoBitrate = n.bitrate, n.framerate) {
1784
+ const a = x(n.framerate);
1785
1785
  t.timeBase = a, t.frameRate = a.toConstant() || a.toRate();
1786
1786
  }
1787
- if (i.scaling) {
1788
- const { height: a, width: c } = i.scaling;
1787
+ if (n.scaling) {
1788
+ const { height: a, width: c } = n.scaling;
1789
1789
  t.height = a, t.width = c, a && c && (t.dimension = `${c}x${a}`, t.aspectRatio = J({ height: a, width: c }));
1790
1790
  }
1791
1791
  }
@@ -1800,19 +1800,19 @@ ${o.join(`
1800
1800
  const {
1801
1801
  name: t,
1802
1802
  type: s,
1803
- defaultValue: n,
1803
+ defaultValue: i,
1804
1804
  stringRestriction: r,
1805
- floatRestriction: i,
1805
+ floatRestriction: n,
1806
1806
  integerRestriction: o,
1807
1807
  longRestriction: a,
1808
1808
  data: c,
1809
- values: d,
1809
+ values: l,
1810
1810
  system: u
1811
- } = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive: l, maxInclusive: h } = i || o || a || {}, g = ((d == null ? void 0 : d.field) || []).map(({ key: I, value: b }) => ({
1811
+ } = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive: d, maxInclusive: h } = n || o || a || {}, g = ((l == null ? void 0 : l.field) || []).map(({ key: I, value: b }) => ({
1812
1812
  label: b ?? I,
1813
1813
  value: I
1814
1814
  })), A = ((I) => Object.fromEntries(Object.entries(I).filter(([, b]) => b !== void 0)))({
1815
- min: l,
1815
+ min: d,
1816
1816
  max: h,
1817
1817
  minLength: f,
1818
1818
  maxLength: m,
@@ -1821,8 +1821,8 @@ ${o.join(`
1821
1821
  return {
1822
1822
  name: t,
1823
1823
  type: s,
1824
- defaultValue: n,
1825
- required: l !== void 0 || f !== void 0 && f > 0,
1824
+ defaultValue: i,
1825
+ required: d !== void 0 || f !== void 0 && f > 0,
1826
1826
  restrictions: A,
1827
1827
  data: O,
1828
1828
  options: g,
@@ -1838,7 +1838,7 @@ ${o.join(`
1838
1838
  "boolean",
1839
1839
  "timeCode"
1840
1840
  ];
1841
- class nt {
1841
+ class it {
1842
1842
  // custom events model
1843
1843
  constructor() {
1844
1844
  this.events = {};
@@ -1850,8 +1850,8 @@ class nt {
1850
1850
  * @param callback function receiving state of chunk, transfer manager or chunked upload instance
1851
1851
  */
1852
1852
  on(t, s) {
1853
- const n = this.events[t] || [];
1854
- n.push(s), this.events[t] = n;
1853
+ const i = this.events[t] || [];
1854
+ i.push(s), this.events[t] = i;
1855
1855
  }
1856
1856
  /**
1857
1857
  * Remove all callbacks for a specific event type
@@ -1868,10 +1868,10 @@ class nt {
1868
1868
  * @param data
1869
1869
  * @returns
1870
1870
  */
1871
- trigger(t, s, n) {
1871
+ trigger(t, s, i) {
1872
1872
  const r = this.events[t];
1873
- !r || r.length < 1 || r.forEach((i) => {
1874
- i(s, n);
1873
+ !r || r.length < 1 || r.forEach((n) => {
1874
+ n(s, i);
1875
1875
  });
1876
1876
  }
1877
1877
  }
@@ -1885,7 +1885,7 @@ class es {
1885
1885
  completeTime: null,
1886
1886
  response: null,
1887
1887
  bytesTransferred: null
1888
- }, this.eventBus = new nt();
1888
+ }, this.eventBus = new it();
1889
1889
  }
1890
1890
  /**
1891
1891
  * Attempt to transfer chunk with some fault resilience.
@@ -1897,16 +1897,16 @@ class es {
1897
1897
  */
1898
1898
  tryTransfer() {
1899
1899
  return this.state.status = _.transferring, this.state.startTime = performance.now(), new Promise((t, s) => {
1900
- const n = () => {
1900
+ const i = () => {
1901
1901
  this.transfer().then((r) => {
1902
1902
  this.state.response = r, this.onComplete(), t(this);
1903
1903
  }).catch(() => {
1904
1904
  this.state.retries > 3 ? (this.state.status = _.failed, s(new Error(`Chunk ${this.start}-${this.end} failed`))) : this.state.status !== _.paused ? (this.state.retries += 1, this.tryTimeout = setTimeout(() => {
1905
- n();
1905
+ i();
1906
1906
  }, 1e3)) : clearTimeout(this.tryTimeout);
1907
1907
  });
1908
1908
  };
1909
- n(), window.addEventListener(T.online, () => {
1909
+ i(), window.addEventListener(T.online, () => {
1910
1910
  this.resume();
1911
1911
  }), window.addEventListener(T.offline, () => {
1912
1912
  this.pause();
@@ -1955,7 +1955,7 @@ class es {
1955
1955
  }
1956
1956
  class ht {
1957
1957
  constructor(t, s) {
1958
- var n, r, i, o, a, c;
1958
+ var i, r, n, o, a, c;
1959
1959
  if (this.DEFAULT_OPTIONS = Object.freeze({
1960
1960
  targetRate: 4e6,
1961
1961
  // 4mb sec,
@@ -1971,18 +1971,18 @@ class ht {
1971
1971
  autoResume: !0,
1972
1972
  // ChunkedTransferManager -> automatically resume transfers on network
1973
1973
  api: void 0
1974
- }), this.eventBus = new nt(), !s.api.method)
1974
+ }), this.eventBus = new it(), !s.api.method)
1975
1975
  throw new Error("No api method specified");
1976
- console.log(s), this.options = {
1976
+ this.options = {
1977
1977
  ...this.DEFAULT_OPTIONS,
1978
1978
  ...s,
1979
1979
  api: {
1980
1980
  ...s.api ?? {},
1981
1981
  props: {
1982
- ...((n = s.api) == null ? void 0 : n.props) ?? {},
1982
+ ...((i = s.api) == null ? void 0 : i.props) ?? {},
1983
1983
  queryParams: {
1984
1984
  transferId: zt(),
1985
- ...((i = (r = s.api) == null ? void 0 : r.props) == null ? void 0 : i.queryParams) ?? {}
1985
+ ...((n = (r = s.api) == null ? void 0 : r.props) == null ? void 0 : n.queryParams) ?? {}
1986
1986
  }
1987
1987
  }
1988
1988
  }
@@ -2004,52 +2004,52 @@ class ht {
2004
2004
  }
2005
2005
  upload() {
2006
2006
  const { status: t } = this.state;
2007
- if (console.log("status", t), t !== _.complete)
2007
+ if (t !== _.complete)
2008
2008
  if (t === _.idle || t === _.transferring) {
2009
2009
  this.state.transferPromises = [];
2010
2010
  const s = () => {
2011
- const n = this.state.chunks[0].state.status, r = this.state.transferPromises.length < this.state.maxConcurrentTransfers && n !== _.transferring;
2012
- return console.log("isOK", r), console.log("this.state", this.state), r;
2011
+ const i = this.state.chunks[0].state.status;
2012
+ return this.state.transferPromises.length < this.state.maxConcurrentTransfers && i !== _.transferring;
2013
2013
  };
2014
- s() && (console.log("this.state.chunks", this.state.chunks), this.state.chunks.forEach((n) => {
2015
- n.state.status !== _.complete && n.state.status !== _.transferring && s() && (this.state.status = _.transferring, this.state.transferPromises.push(n.tryTransfer()));
2014
+ s() && (this.state.chunks.forEach((i) => {
2015
+ i.state.status !== _.complete && i.state.status !== _.transferring && s() && (this.state.status = _.transferring, this.state.transferPromises.push(i.tryTransfer()));
2016
2016
  }), this.state.transferPromises.length > 0 && Promise.all(this.state.transferPromises).then(() => {
2017
2017
  this.upload();
2018
- }).catch((n) => {
2019
- console.log(
2020
- "Failed on this upload() cycle, check connectivity and try to resume :(",
2021
- n
2022
- ), this.state.status !== _.offline ? (this.state.status = _.failed, this.eventBus.trigger(T.failed, this.state, n)) : setTimeout(() => this.retry(), 5e3);
2018
+ }).catch((i) => {
2019
+ console.error(
2020
+ "Failed on this upload() cycle, check connectivity and try to resume",
2021
+ i
2022
+ ), this.state.status !== _.offline ? (this.state.status = _.failed, this.eventBus.trigger(T.failed, this.state, i), this.options.onFail && this.options.onFail(i)) : setTimeout(() => this.retry(), 5e3);
2023
2023
  }));
2024
2024
  } else
2025
2025
  this.retry();
2026
2026
  }
2027
2027
  // get all byte ranges for splitting in chunks
2028
2028
  getByteRangesForChunks(t, s = this.options.chunkSize) {
2029
- const n = [], { minChunkSize: r } = this.options;
2029
+ const i = [], { minChunkSize: r } = this.options;
2030
2030
  let o = s >= r ? s : r, a = Math.floor(t.size / o);
2031
2031
  if (t.size - (t.size - t.size / a) >= r || (a -= 1, o = Math.floor(t.size / a)), a < 2 || t.size < this.options.minFileSize)
2032
- n.push({ start: 0, end: t.size });
2032
+ i.push({ start: 0, end: t.size });
2033
2033
  else
2034
2034
  for (let c = 0; c <= a; c += 1) {
2035
- const d = o * c;
2035
+ const l = o * c;
2036
2036
  let u = o * c + o;
2037
2037
  t.size - o * c <= r && (u = t.size);
2038
2038
  const m = {
2039
- start: d,
2039
+ start: l,
2040
2040
  end: u
2041
2041
  };
2042
- if (n.push(m), u === t.size)
2042
+ if (i.push(m), u === t.size)
2043
2043
  break;
2044
2044
  }
2045
- return n;
2045
+ return i;
2046
2046
  }
2047
2047
  addChunksFromBlob(t) {
2048
- this.getByteRangesForChunks(t).forEach((n) => {
2048
+ this.getByteRangesForChunks(t).forEach((i) => {
2049
2049
  const r = new es({
2050
- start: n.start,
2051
- end: n.end,
2052
- blobSlice: t.slice(n.start, n.end),
2050
+ start: i.start,
2051
+ end: i.end,
2052
+ blobSlice: t.slice(i.start, i.end),
2053
2053
  fileSize: t.size,
2054
2054
  api: this.options.api
2055
2055
  });
@@ -2096,10 +2096,10 @@ class ht {
2096
2096
  else if (s < 0.3)
2097
2097
  this.state.maxConcurrentTransfers = 1;
2098
2098
  else {
2099
- const n = this.options.maxConcurrentTransfers - 1;
2099
+ const i = this.options.maxConcurrentTransfers - 1;
2100
2100
  this.state.maxConcurrentTransfers = Math.max(
2101
2101
  this.options.maxConcurrentTransfers,
2102
- Math.min(n, this.options.maxConcurrentTransfers)
2102
+ Math.min(i, this.options.maxConcurrentTransfers)
2103
2103
  );
2104
2104
  }
2105
2105
  }
@@ -2124,17 +2124,17 @@ class ht {
2124
2124
  }
2125
2125
  getStats() {
2126
2126
  const t = this.state.chunks.length, s = this.state.chunks.filter(
2127
- (d) => d.state.status === _.complete
2128
- ), n = this.state.chunks.filter(
2129
- (d) => d.state.status === _.transferring
2127
+ (l) => l.state.status === _.complete
2128
+ ), i = this.state.chunks.filter(
2129
+ (l) => l.state.status === _.transferring
2130
2130
  ), r = s.length;
2131
- let i = 0, o = 0;
2132
- s.forEach((d) => {
2133
- i += d.transferRate, o += d.blobSlice.size;
2134
- }), n.forEach((d) => {
2135
- o += d.state.bytesTransferred;
2131
+ let n = 0, o = 0;
2132
+ s.forEach((l) => {
2133
+ n += l.transferRate, o += l.blobSlice.size;
2134
+ }), i.forEach((l) => {
2135
+ o += l.state.bytesTransferred;
2136
2136
  });
2137
- const a = i / r, c = {
2137
+ const a = n / r, c = {
2138
2138
  totalChunks: t,
2139
2139
  completedChunks: r,
2140
2140
  totalBytes: this.state.blob.size,
@@ -2156,8 +2156,8 @@ class ht {
2156
2156
  }
2157
2157
  get finalResponse() {
2158
2158
  const t = this.state.chunks.length - 1, s = !1;
2159
- for (let n = t; n >= 0; n -= 1) {
2160
- const r = this.state.chunks[n];
2159
+ for (let i = t; i >= 0; i -= 1) {
2160
+ const r = this.state.chunks[i];
2161
2161
  if (typeof r.state.response.data == "object")
2162
2162
  return r.state.response;
2163
2163
  }
@@ -2189,7 +2189,7 @@ class vs {
2189
2189
  }), this.state = { ...this.initialState }, this.options = {
2190
2190
  ...rs,
2191
2191
  ...t
2192
- }, this.events = new nt(), this.bindNetworkEvents();
2192
+ }, this.events = new it(), this.bindNetworkEvents();
2193
2193
  }
2194
2194
  get transfers() {
2195
2195
  return Object.values(this.state.transfers) || [];
@@ -2231,12 +2231,12 @@ class vs {
2231
2231
  }));
2232
2232
  }
2233
2233
  addChunkedUpload(t) {
2234
- console.log("chunkedUpload", t), t.transferId !== null && (this.state.transfers[t.transferId] = t, t.eventBus.on(T.progress, () => {
2234
+ t.transferId !== null && (this.state.transfers[t.transferId] = t, t.eventBus.on(T.progress, () => {
2235
2235
  this.onProgress();
2236
2236
  }), t.eventBus.on(T.complete, () => {
2237
2237
  this.upload(), this.onProgress();
2238
- }), t.eventBus.on(T.failed, (s, n) => {
2239
- this.onFail(n, s);
2238
+ }), t.eventBus.on(T.failed, (s, i) => {
2239
+ this.onFail(i, s);
2240
2240
  }), t.eventBus.on(T.retry, () => {
2241
2241
  this.events.trigger(T.retry, this.state);
2242
2242
  }), t.eventBus.on(T.paused, () => {
@@ -2245,12 +2245,12 @@ class vs {
2245
2245
  }
2246
2246
  // param can be file or a reference to transfer, or a transferId
2247
2247
  removeChunkedUpload(t, s = !1) {
2248
- const n = (r) => r ? r.state.status === _.complete && !s ? (console.error(
2248
+ const i = (r) => r ? r.state.status === _.complete && !s ? (console.error(
2249
2249
  "Can't cancel complete transfers, pass true as a second argument in .removeChunkedUpload() to force removal."
2250
- ), !1) : (Object.keys(this.state.transfers).forEach((i) => {
2251
- r === this.state.transfers[i] && delete this.state.transfers[i];
2250
+ ), !1) : (Object.keys(this.state.transfers).forEach((n) => {
2251
+ r === this.state.transfers[n] && delete this.state.transfers[n];
2252
2252
  }), this.events.trigger(T.removed, this.state), r.cancel(), !0) : (console.error("Could not find a matching transfer to cancel."), !1);
2253
- t instanceof ht ? n(t) : t instanceof File ? n(this.exists(t)) : typeof t == "string" ? n(this.transfers.find((r) => r.transferId === t)) : console.error(
2253
+ t instanceof ht ? i(t) : t instanceof File ? i(this.exists(t)) : typeof t == "string" ? i(this.transfers.find((r) => r.transferId === t)) : console.error(
2254
2254
  "Invalid object to remove - has to be either ChunkedUpload, File or transferId"
2255
2255
  );
2256
2256
  }
@@ -2262,8 +2262,8 @@ class vs {
2262
2262
  }
2263
2263
  exists(t) {
2264
2264
  let s;
2265
- for (let n = 0; n < this.transfers.length; n += 1) {
2266
- const r = this.transfers[n];
2265
+ for (let i = 0; i < this.transfers.length; i += 1) {
2266
+ const r = this.transfers[i];
2267
2267
  if (r.state.blob.name === t.name && r.state.blob.lastModified === t.lastModified && r.state.blob.size && t.size)
2268
2268
  return s = r, s;
2269
2269
  }
@@ -2278,8 +2278,8 @@ class vs {
2278
2278
  if (!this.paused) {
2279
2279
  this.events.trigger(T.pausing, this.state);
2280
2280
  const s = [];
2281
- this.transfers.forEach((n) => {
2282
- s.push(n.pause());
2281
+ this.transfers.forEach((i) => {
2282
+ s.push(i.pause());
2283
2283
  }), t = Promise.all(s), t.then(() => {
2284
2284
  this.events.trigger(T.paused, this.state);
2285
2285
  });
@@ -2296,9 +2296,9 @@ class vs {
2296
2296
  }
2297
2297
  upload() {
2298
2298
  let t = 0;
2299
- console.log("this.transfers", this.transfers), console.log("this.options.maxConcurrentFileTransfers", this.options.maxConcurrentFileTransfers), console.log("before ongoingTransfers", t), this.transfers.forEach((s) => {
2299
+ this.transfers.forEach((s) => {
2300
2300
  this.isTransferAvailable(s) ? t < this.options.maxConcurrentFileTransfers && (this.events.trigger(T.update, this.state), s.upload(), t += 1) : s.state.status !== _.complete && (t += 1);
2301
- }), t > 0 && (this.status = _.transferring), t < this.options.maxConcurrentFileTransfers && this.transfers.length < t && this.upload(), console.log("after ongoingTransfers", t);
2301
+ }), t > 0 && (this.status = _.transferring), t < this.options.maxConcurrentFileTransfers && this.transfers.length < t && this.upload();
2302
2302
  }
2303
2303
  onFail(t, s) {
2304
2304
  this.status = _.failed, this.events.trigger(T.error, s, t);
@@ -2327,12 +2327,12 @@ class vs {
2327
2327
  get fileList() {
2328
2328
  const t = [];
2329
2329
  return this.transfers.forEach((s) => {
2330
- const n = s.getStats(), { totalChunks: r, completedChunks: i } = n, o = {
2330
+ const i = s.getStats(), { totalChunks: r, completedChunks: n } = i, o = {
2331
2331
  name: s.state.blob.name,
2332
- bytesDone: n.transferredBytes,
2332
+ bytesDone: i.transferredBytes,
2333
2333
  bytesTotal: s.state.blob.size,
2334
2334
  totalChunks: r,
2335
- completedChunks: i,
2335
+ completedChunks: n,
2336
2336
  transfer: s
2337
2337
  };
2338
2338
  t.push(o);
@@ -2340,16 +2340,16 @@ class vs {
2340
2340
  }
2341
2341
  }
2342
2342
  const Wt = (e, t, s = "") => {
2343
- const n = (a) => {
2344
- const c = a.startsWith("/") ? a.slice(1) : a, d = (c == null ? void 0 : c.search("/")) ?? -1;
2345
- return d === -1 ? [c] : [c.slice(0, d), c.slice(d + 1)];
2346
- }, [r, i] = n(t), o = [s, r].filter(Boolean).join("/");
2347
- return i ? {
2343
+ const i = (a) => {
2344
+ const c = a.startsWith("/") ? a.slice(1) : a, l = (c == null ? void 0 : c.search("/")) ?? -1;
2345
+ return l === -1 ? [c] : [c.slice(0, l), c.slice(l + 1)];
2346
+ }, [r, n] = i(t), o = [s, r].filter(Boolean).join("/");
2347
+ return n ? {
2348
2348
  [r]: {
2349
2349
  file: new File([e], r, { ...e, type: "folder" }),
2350
2350
  path: o,
2351
2351
  progress: { totalBytes: e.size ?? 0, transferredBytes: 0 },
2352
- files: Wt(e, i, o)
2352
+ files: Wt(e, n, o)
2353
2353
  }
2354
2354
  } : {
2355
2355
  [r]: {
@@ -2363,7 +2363,7 @@ export {
2363
2363
  es as Chunk,
2364
2364
  vs as ChunkedTransferManager,
2365
2365
  ht as ChunkedUpload,
2366
- nt as ChunkedUploadEventBus,
2366
+ it as ChunkedUploadEventBus,
2367
2367
  P as DOCUMENT_TYPES,
2368
2368
  T as EVENTS,
2369
2369
  Ht as FIELD_ATTRIBUTE_KEYS,
@@ -2378,7 +2378,7 @@ export {
2378
2378
  us as SYSTEM_FIELDS,
2379
2379
  R as TimeBase,
2380
2380
  S as TimeCode,
2381
- ls as createMetadataType,
2381
+ ds as createMetadataType,
2382
2382
  ms as createSearchFacetList,
2383
2383
  $ as createTimeBase,
2384
2384
  j as createTimeCode,
@@ -2387,7 +2387,7 @@ export {
2387
2387
  be as findNearestThumbnail,
2388
2388
  et as formatTimeBaseText,
2389
2389
  x as formatTimeBaseType,
2390
- le as formatTimeCodeSeconds,
2390
+ de as formatTimeCodeSeconds,
2391
2391
  pe as formatTimeCodeSmpte,
2392
2392
  U as formatTimeCodeText,
2393
2393
  L as formatTimeCodeType,
@@ -2412,7 +2412,7 @@ export {
2412
2412
  gs as parseNowDate,
2413
2413
  Ts as parseSearchResultEvents,
2414
2414
  rt as parseShapeType,
2415
- ds as parseSimpleMetadataType,
2415
+ ls as parseSimpleMetadataType,
2416
2416
  ae as parseTimespan,
2417
2417
  Ct as parseTimespanList,
2418
2418
  Rs as parseTranscodePreset,