@vidispine/vdt-js 25.4.6 → 26.1.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
@@ -6,15 +6,15 @@ const pt = (e, t) => t ? pt(t, e % t) : e, J = (e) => {
6
6
  if (t === void 0 || s === void 0)
7
7
  return;
8
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(":");
9
+ let r = t / n, a = s / n;
10
+ return r > 21 && (a = 1, r = (t / s).toFixed(2)), [r, a].join(":");
11
11
  }, M = (e) => Object.fromEntries((e == null ? void 0 : e.map(({ key: t, value: s }) => [t, s])) || []), Gt = (e, t, s) => {
12
12
  let n;
13
13
  return (r) => {
14
14
  const o = () => {
15
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);
16
+ }, i = s && !n;
17
+ clearTimeout(n), n = setTimeout(o, t), i && e.apply(void 0, r);
18
18
  };
19
19
  };
20
20
  function zt() {
@@ -360,17 +360,17 @@ const os = {
360
360
  }, Rt = (e) => {
361
361
  const t = [], s = [];
362
362
  let n = {};
363
- return Object.entries(e || {}).forEach(([r, i]) => {
363
+ return Object.entries(e || {}).forEach(([r, a]) => {
364
364
  if (Yt.includes(r))
365
- n = { ...n, [r]: i };
366
- else if (At(i))
365
+ n = { ...n, [r]: a };
366
+ else if (At(a))
367
367
  try {
368
- s.push({ name: r, ...Qt(i) });
368
+ s.push({ name: r, ...Qt(a) });
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(a))
373
+ (Array.isArray(a) ? a : [a]).forEach((o) => {
374
374
  t.push({ name: r, ...Rt(o) });
375
375
  });
376
376
  else
@@ -381,9 +381,9 @@ const os = {
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: n = void 0, ...r } = e, { group: a, field: o } = Rt(r);
385
385
  return {
386
- ...i ? { group: i } : {},
386
+ ...a ? { group: a } : {},
387
387
  ...o ? { field: o } : {},
388
388
  start: t.toString(),
389
389
  end: s.toString(),
@@ -392,8 +392,8 @@ const os = {
392
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("@")) || [];
395
+ var r, a;
396
+ const [s] = ((r = e == null ? void 0 : e.start) == null ? void 0 : r.split("@")) || [], [n] = ((a = t == null ? void 0 : t.start) == null ? void 0 : a.split("@")) || [];
397
397
  return Number(s) < Number(n) ? -1 : Number(s) > Number(n) ? 1 : 0;
398
398
  }, F = (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
@@ -415,13 +415,17 @@ function se(e, t) {
415
415
  const St = {
416
416
  ...yt,
417
417
  joinValue: void 0,
418
- arrayOnSingleValue: !0
418
+ arrayOnSingleValue: !0,
419
+ selectedLang: void 0
419
420
  };
420
421
  function re(e, t) {
421
- const { joinValue: s, arrayOnSingleValue: n, ...r } = {
422
+ const { joinValue: s, arrayOnSingleValue: n, selectedLang: r, ...a } = {
422
423
  ...St,
423
424
  ...t || {}
424
- }, i = e == null ? void 0 : e.map((o) => se(o, r));
425
+ };
426
+ let o = e;
427
+ e && r && e.every((d) => d.lang !== void 0) && (o = e.filter((d) => d.lang === r));
428
+ const i = o == null ? void 0 : o.map((c) => se(c, a));
425
429
  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;
426
430
  }
427
431
  const vt = {
@@ -431,12 +435,12 @@ const vt = {
431
435
  const { includeFieldAttributes: s, ...n } = {
432
436
  ...vt,
433
437
  ...t || {}
434
- }, { value: r, ...i } = e, o = re(r, n), a = s === !0 && i || Array.isArray(s) && Object.fromEntries(
435
- Object.entries(i).filter(
438
+ }, { value: r, ...a } = e, o = re(r, n), i = s === !0 && a || Array.isArray(s) && Object.fromEntries(
439
+ Object.entries(a).filter(
436
440
  ([c]) => s.includes(c)
437
441
  )
438
442
  ) || {};
439
- return s ? { ...a, value: o } : o;
443
+ return s ? { ...i, value: o } : o;
440
444
  }, G = {
441
445
  ...vt,
442
446
  fieldAsList: !1,
@@ -446,11 +450,11 @@ const vt = {
446
450
  const s = {
447
451
  ...G,
448
452
  ...t || {}
449
- }, { fieldAsList: n, arrayOnSingleField: r, overrideField: i } = s, o = i === !0 && n === !1, a = {};
453
+ }, { fieldAsList: n, arrayOnSingleField: r, overrideField: a } = s, o = a === !0 && n === !1, i = {};
450
454
  return e == null || e.forEach((c) => {
451
- const { name: l } = c, u = ne(c, s), f = r === !0 ? F(u) : u, m = a[l];
452
- m ? o ? a[l] = u : a[l] = [F(m), F(u)].flat() : a[l] = f;
453
- }), n === !0 ? Object.values(a).flat() : a;
455
+ const { name: d } = c, u = ne(c, s), f = r === !0 ? F(u) : u, m = i[d];
456
+ m ? o ? i[d] = u : i[d] = [F(m), F(u)].flat() : i[d] = f;
457
+ }), n === !0 ? Object.values(i).flat() : i;
454
458
  }, Ft = {
455
459
  ...G,
456
460
  includeGroupAttributes: !1,
@@ -465,25 +469,25 @@ const vt = {
465
469
  Object.entries(s).filter(
466
470
  ([f]) => Object.keys(G).includes(f)
467
471
  )
468
- ), { field: i, group: o, ...a } = e, c = i && Dt(i, r), l = o && Mt(o, s);
472
+ ), { field: a, group: o, ...i } = e, c = a && Dt(a, r), d = o && Mt(o, s);
469
473
  return {
470
- ...n === !0 && a || Array.isArray(n) && Object.fromEntries(
471
- Object.entries(a).filter(
474
+ ...n === !0 && i || Array.isArray(n) && Object.fromEntries(
475
+ Object.entries(i).filter(
472
476
  ([f]) => n.includes(f)
473
477
  )
474
478
  ) || {},
475
479
  ...r != null && r.fieldAsList ? c && { field: c } || {} : c,
476
- ...s != null && s.groupAsList ? l && { group: l } || {} : l
480
+ ...s != null && s.groupAsList ? d && { group: d } || {} : d
477
481
  };
478
482
  }, Q = Ft, Mt = (e, t) => {
479
- const s = { ...Q, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: r, overrideGroup: i } = s, o = i === !0 && n === !1, a = {};
483
+ const s = { ...Q, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: r, overrideGroup: a } = s, o = a === !0 && n === !1, i = {};
480
484
  return e == null || e.forEach((c) => {
481
- const { name: l } = c, u = ie(c, s), f = r === !0 ? F(u) : u, m = a[l];
482
- m ? o ? a[l] = u : a[l] = [
485
+ const { name: d } = c, u = ie(c, s), f = r === !0 ? F(u) : u, m = i[d];
486
+ m ? o ? i[d] = u : i[d] = [
483
487
  F(m),
484
488
  F(u)
485
- ].flat() : a[l] = f;
486
- }), n ? Object.values(a).flat() : a;
489
+ ].flat() : i[d] = f;
490
+ }), n ? Object.values(i).flat() : i;
487
491
  }, Nt = {
488
492
  ...Q,
489
493
  includeTimespanAttributes: !1,
@@ -496,24 +500,24 @@ const vt = {
496
500
  const s = {
497
501
  ...Nt,
498
502
  ...t || {}
499
- }, { includeTimespanAttributes: n, arrayOnSingle: r, flat: i } = 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 : i === !0) ? [d, !0] : [d, h];
503
- }).filter((d) => !!d)
504
- ), a = Object.fromEntries(
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 : i === !0) ? [d, !0] : [d, h];
508
- }).filter((d) => !!d)
509
- ), { field: c, group: l, ...u } = e || {}, f = c && Dt(c, a), m = l && Mt(l, o);
503
+ }, { includeTimespanAttributes: n, arrayOnSingle: r, flat: a } = s, o = Object.fromEntries(
504
+ Object.entries(t).map(([l, h]) => {
505
+ if (Object.keys(Q).includes(l))
506
+ return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideGroup", "overrideField"].includes(l) && (h !== void 0 ? h : a === !0) ? [l, !0] : [l, h];
507
+ }).filter((l) => !!l)
508
+ ), i = Object.fromEntries(
509
+ Object.entries(t).map(([l, h]) => {
510
+ if (Object.keys(G).includes(l))
511
+ return ["arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideField"].includes(l) && (h !== void 0 ? h : a === !0) ? [l, !0] : [l, h];
512
+ }).filter((l) => !!l)
513
+ ), { field: c, group: d, ...u } = e || {}, f = c && Dt(c, i), m = d && Mt(d, o);
510
514
  return {
511
515
  ...n === !0 && u || Array.isArray(n) && Object.fromEntries(
512
516
  Object.entries(u).filter(
513
- ([d]) => n.includes(d)
517
+ ([l]) => n.includes(l)
514
518
  )
515
519
  ) || {},
516
- ...a != null && a.fieldAsList ? { field: f } : f,
520
+ ...i != null && i.fieldAsList ? { field: f } : f,
517
521
  ...o != null && o.groupAsList ? { group: m } : m
518
522
  };
519
523
  }, Z = {
@@ -527,12 +531,12 @@ const vt = {
527
531
  const s = {
528
532
  ...Z,
529
533
  ...t || {}
530
- }, { timespanAsList: n, joinTimespan: r, sortTimespan: i, flat: o, flatTimespan: a, ...c } = s, l = { flat: o, ...c };
531
- i && e.sort(te);
532
- const u = (a !== void 0 ? a === !0 : o === !0) && n === !1, f = {};
534
+ }, { timespanAsList: n, joinTimespan: r, sortTimespan: a, flat: o, flatTimespan: i, ...c } = s, d = { flat: o, ...c };
535
+ a && e.sort(te);
536
+ const u = (i !== void 0 ? i === !0 : o === !0) && n === !1, f = {};
533
537
  return e == null || e.forEach((m) => {
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] = [...F(E), g] : f[h] = g;
538
+ const { start: p, end: l } = m, h = u ? "flat" : [p, l].join(r), g = ae(m, d), E = f[h];
539
+ E ? u ? p === "-INF" && l === "+INF" ? f[h] = { ...at(E), ...g } : f[h] = { ...g, ...at(E) } : f[h] = [...F(E), g] : f[h] = g;
536
540
  }), n === !0 ? Object.values(f) : u ? Object.values(f).pop() : f;
537
541
  }, oe = {
538
542
  ...Z,
@@ -543,14 +547,14 @@ function ce(e, t) {
543
547
  const s = {
544
548
  ...oe,
545
549
  ...t || {}
546
- }, { includeMetadataAttributes: n, flat: r } = s, { timespan: i = [], ...o } = e || {}, a = Object.fromEntries(
550
+ }, { includeMetadataAttributes: n, flat: r } = s, { timespan: a = [], ...o } = e || {}, i = Object.fromEntries(
547
551
  Object.entries(s).map(([u, f]) => {
548
552
  if (Object.keys(Z).includes(u))
549
553
  return ["onlyGeneric", "overrideGroup", "overrideField"].includes(u) && (f !== void 0 ? f : r === !0) ? [u, !0] : [u, f];
550
554
  }).filter((u) => !!u)
551
555
  ), c = Ct(
552
- i,
553
- a
556
+ a,
557
+ i
554
558
  );
555
559
  return {
556
560
  ...n === !0 && {
@@ -565,7 +569,7 @@ function ce(e, t) {
565
569
  ];
566
570
  }).filter((u) => !!u)
567
571
  ) || {},
568
- ...a != null && a.timespanAsList ? { timespan: c } : c
572
+ ...i != null && i.timespanAsList ? { timespan: c } : c
569
573
  };
570
574
  }
571
575
  const ls = (e) => {
@@ -607,8 +611,8 @@ class R {
607
611
  toConstant() {
608
612
  let t;
609
613
  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;
614
+ const [n, r] = s, { numerator: a, denominator: o } = r;
615
+ return a === this.numerator && o === this.denominator ? (t = n, !0) : !1;
612
616
  }), t;
613
617
  }
614
618
  /**
@@ -625,9 +629,9 @@ class R {
625
629
  toText(t) {
626
630
  const { constant: s, fraction: n } = { ...ct.toText, ...t };
627
631
  if (s) {
628
- const i = this.toConstant();
629
- if (i)
630
- return i;
632
+ const a = this.toConstant();
633
+ if (a)
634
+ return a;
631
635
  }
632
636
  return n || this.numerator > 1 ? [this.denominator, this.numerator].join(":") : String(this.denominator);
633
637
  }
@@ -696,12 +700,12 @@ const et = (e) => {
696
700
  const { samples: t, timeBase: s } = e, n = st(s);
697
701
  if (!n)
698
702
  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), l = Math.max(
703
+ const r = s.toRate({ rounded: !0 }), a = 60 * r, o = 60 * r - n, i = 10 * (a - n) + n, c = Math.floor((t + 1) / i), d = Math.max(
700
704
  0,
701
- (t + 1) % a - i
705
+ (t + 1) % i - a
702
706
  ), u = Math.floor(
703
- l / o
704
- ), m = l % o > 0 ? n : 0;
707
+ d / o
708
+ ), m = d % o > 0 ? n : 0;
705
709
  return c * 9 * n + u * n + m;
706
710
  }, V = {
707
711
  conformTimeBase: {
@@ -757,8 +761,8 @@ class S {
757
761
  const { numerator: s, denominator: n } = (t == null ? void 0 : t.timeBase) || {};
758
762
  let r = t;
759
763
  (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 });
764
+ const { samples: a } = r;
765
+ return new S({ samples: this.samples + a, timeBase: this.timeBase });
762
766
  }
763
767
  /**
764
768
  * Return this TimeCode subtracted with the supplied timeCodeType
@@ -781,8 +785,8 @@ class S {
781
785
  const { timeBase: { numerator: s, denominator: n } = {} } = t;
782
786
  let r = t;
783
787
  (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 });
788
+ const { samples: a } = r;
789
+ return new S({ samples: this.samples - a, timeBase: this.timeBase });
786
790
  }
787
791
  /**
788
792
  * Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
@@ -806,12 +810,12 @@ class S {
806
810
  "round"
807
811
  ].join(", ")}"`
808
812
  );
809
- const i = Math[r](
813
+ const a = Math[r](
810
814
  this.samples / (this.timeBase.toRate({ fixed: !1 }) / n.toRate({ fixed: !1 }))
811
815
  ), o = { ...V.conformTimeBase, ...s || {} };
812
816
  return new S(
813
817
  {
814
- samples: i,
818
+ samples: a,
815
819
  timeBase: n
816
820
  },
817
821
  o
@@ -852,11 +856,11 @@ class S {
852
856
  const t = this.samples + (this.dropFrame ? ut(this) : 0);
853
857
  let s = this.timeBase.toRate({ rounded: !0 });
854
858
  ["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);
859
+ const n = Math.floor(t / (3600 * s)), r = Math.floor(t / (60 * s)) % 60, a = Math.floor(t / s) % 60, o = Math.floor(t % s);
856
860
  return {
857
861
  hours: n,
858
862
  minutes: r,
859
- seconds: i,
863
+ seconds: a,
860
864
  frames: o
861
865
  };
862
866
  }
@@ -868,12 +872,12 @@ class S {
868
872
  * @returns Time for the time code
869
873
  */
870
874
  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;
875
+ const t = this.samples + ut(this), { hours: s, minutes: n, seconds: r } = this.toUnits(), a = this.timeBase.toRate({ rounded: !0 }), o = t % a, i = Math.floor(1e3 * o / a), c = o / a;
872
876
  return {
873
877
  hours: s,
874
878
  minutes: n,
875
879
  seconds: r,
876
- milliseconds: a,
880
+ milliseconds: i,
877
881
  partialSeconds: c
878
882
  };
879
883
  }
@@ -907,48 +911,48 @@ class S {
907
911
  */
908
912
  toDuration(t) {
909
913
  const { format: s } = { ...V.toDuration, ...t || {} }, { hours: n, ...r } = this.toTime();
910
- let { minutes: i, seconds: o, milliseconds: a } = r;
914
+ let { minutes: a, seconds: o, milliseconds: i } = r;
911
915
  if (s && typeof s != "string")
912
916
  throw Error("format has to be a string");
913
- const c = (m, p) => !s.includes(m) || !p.some((d) => s.includes(d) && s.lastIndexOf(m) > s.indexOf(d));
917
+ const c = (m, p) => !s.includes(m) || !p.some((l) => s.includes(l) && s.lastIndexOf(m) > s.indexOf(l));
914
918
  if (s && !(c("h", ["m", "s", "S"]) && c("m", ["s", "S"]) && c("s", ["S"])))
915
919
  throw Error("format order is unsupported (has to be h, m, s then S)");
916
920
  if (!s)
917
- return `${n > 0 ? `${n}:${`${i}`.padStart(2, "0")}` : i}:${`${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;
921
+ return `${n > 0 ? `${n}:${`${a}`.padStart(2, "0")}` : a}:${`${o}`.padStart(2, "0")}`;
922
+ const d = (m, p) => {
923
+ let l = m;
924
+ for (; p[l] === p[l + 1]; )
925
+ l += 1;
926
+ return l - m + 1;
923
927
  }, u = ["h", "m", "s", "S"], f = [];
924
- return [...s].forEach((m, p, d) => {
928
+ return [...s].forEach((m, p, l) => {
925
929
  switch (m) {
926
930
  case "h": {
927
- if (d[p - 1] === "h")
931
+ if (l[p - 1] === "h")
928
932
  break;
929
- const h = l(p, d);
930
- f.push(`${n}`.padStart(h, "0")), u.includes(d[p + h]) && f.push(":");
933
+ const h = d(p, l);
934
+ f.push(`${n}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(":");
931
935
  break;
932
936
  }
933
937
  case "m": {
934
- if (d[p - 1] === "m")
938
+ if (l[p - 1] === "m")
935
939
  break;
936
- const h = l(p, d);
937
- s.includes("h") || (i += n * 60), f.push(`${i}`.padStart(h, "0")), u.includes(d[p + h]) && f.push(":");
940
+ const h = d(p, l);
941
+ s.includes("h") || (a += n * 60), f.push(`${a}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(":");
938
942
  break;
939
943
  }
940
944
  case "s": {
941
- if (d[p - 1] === "s")
945
+ if (l[p - 1] === "s")
942
946
  break;
943
- const h = l(p, d);
944
- s.includes("m") || (o += i * 60), f.push(`${o}`.padStart(h, "0")), u.includes(d[p + h]) && f.push(".");
947
+ const h = d(p, l);
948
+ s.includes("m") || (o += a * 60), f.push(`${o}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(".");
945
949
  break;
946
950
  }
947
951
  case "S": {
948
- if (d[p - 1] === "S")
952
+ if (l[p - 1] === "S")
949
953
  break;
950
- const h = l(p, d);
951
- s.includes("s") || (a += o * 1e3), f.push(`${Math.round(a / 10 ** (3 - h))}`.padStart(h, "0"));
954
+ const h = d(p, l);
955
+ s.includes("s") || (i += o * 1e3), f.push(`${Math.round(i / 10 ** (3 - h))}`.padStart(h, "0"));
952
956
  break;
953
957
  }
954
958
  default:
@@ -970,12 +974,12 @@ class S {
970
974
  };
971
975
  if (this.samples === -1 / 0)
972
976
  return "00:00:00:00";
973
- const { hours: n, minutes: r, seconds: i, frames: o } = this.toUnits(), a = s ? this.frameSeparator : ":", c = [
977
+ const { hours: n, minutes: r, seconds: a, frames: o } = this.toUnits(), i = s ? this.frameSeparator : ":", c = [
974
978
  n.toFixed().padStart(2, "0"),
975
979
  r.toFixed().padStart(2, "0"),
976
- i.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);
980
+ a.toFixed().padStart(2, "0")
981
+ ].join(i), d = Math.max(2, `${this.timeBase.toRate({ rounded: !0 }) - 1}`.length);
982
+ return [c, `${o}`.padStart(d, "0")].join(this.frameSeparator);
979
983
  }
980
984
  /**
981
985
  * Get TimeCode as a VidiCore TimeCodeType object
@@ -1003,45 +1007,45 @@ const ue = (e, t) => {
1003
1007
  s > n ? [s, n] = [s - n, n] : [s, n] = [s, n - s];
1004
1008
  return s || n;
1005
1009
  }, de = (e, t) => {
1006
- const { timeBase: s, useGCD: n = !1, roundingMode: r, ...i } = t || {}, o = `${e}`.replace(/,/g, ".");
1010
+ const { timeBase: s, useGCD: n = !1, roundingMode: r, ...a } = t || {}, o = `${e}`.replace(/,/g, ".");
1007
1011
  if (Number.isNaN(+o))
1008
1012
  throw new Error(`seconds must be digits, is ${e}`);
1009
- let a = 1, c;
1013
+ let i = 1, c;
1010
1014
  if (Number.isInteger(+o))
1011
- c = +o * a;
1015
+ c = +o * i;
1012
1016
  else {
1013
1017
  const [, u] = o.split("."), f = Math.min((u == null ? void 0 : u.length) ?? 0, 16);
1014
- a *= 10 ** f, c = Math.round(Number(o) * a);
1018
+ i *= 10 ** f, c = Math.round(Number(o) * i);
1015
1019
  }
1016
1020
  if (s === void 0 && n) {
1017
- const u = ue(a, c);
1018
- c /= u, a /= u;
1021
+ const u = ue(i, c);
1022
+ c /= u, i /= u;
1019
1023
  }
1020
- const l = new S(
1021
- { samples: c, timeBase: { denominator: a, numerator: 1 } },
1022
- i
1024
+ const d = new S(
1025
+ { samples: c, timeBase: { denominator: i, numerator: 1 } },
1026
+ a
1023
1027
  );
1024
- return s !== void 0 ? l.conformTimeBase(s, { ...i, roundingMode: r }) : l;
1025
- }, le = ([e, t, s, n], r, i) => {
1026
- const o = i.toRate({ rounded: !0 }), a = st(i);
1027
- if (r === 0 || !a)
1028
+ return s !== void 0 ? d.conformTimeBase(s, { ...a, roundingMode: r }) : d;
1029
+ }, le = ([e, t, s, n], r, a) => {
1030
+ const o = a.toRate({ rounded: !0 }), i = st(a);
1031
+ if (r === 0 || !i)
1028
1032
  return 0;
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 && n < a)
1033
+ const c = t % 10 !== 0, d = c && s === 0, u = e * (3600 * o - 54 * i), f = t * 60 * o - (t - Math.ceil(t / 10)) * i, m = s * o - (c && s > 1 ? i : 0);
1034
+ if (d && n < i)
1031
1035
  throw new Error(
1032
- `Frame does not exist for ${i.toConstant() || i.toRate()} drop-frame`
1036
+ `Frame does not exist for ${a.toConstant() || a.toRate()} drop-frame`
1033
1037
  );
1034
- const p = l ? n - a : n, d = u + f + m + p;
1035
- return r - d;
1038
+ const p = d ? n - i : n, l = u + f + m + p;
1039
+ return r - l;
1036
1040
  }, 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;
1041
+ const [n, r, a, o] = e, i = t.toRate({ rounded: !0 }), c = n * 3600 * i + r * 60 * i + a * i + o;
1038
1042
  return c - (s ? le(e, c, t) : 0);
1039
1043
  }, fe = (e) => {
1040
1044
  const [t] = (e == null ? void 0 : e.match(/[^0-9:\-_]/)) || [];
1041
1045
  let s = [];
1042
1046
  if (t) {
1043
- const [r, i] = e.split(t);
1044
- s = [...r.split(":"), i];
1047
+ const [r, a] = e.split(t);
1048
+ s = [...r.split(":"), a];
1045
1049
  } else
1046
1050
  s = e.split(":");
1047
1051
  if (s.length !== 4)
@@ -1064,50 +1068,50 @@ const ue = (e, t) => {
1064
1068
  throw new Error("smpte cannot be undefined or null");
1065
1069
  if (typeof e != "string")
1066
1070
  throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);
1067
- const { smpteValues: i, smpteFrameSeparator: o } = fe(e), a = $(n), c = {
1071
+ const { smpteValues: a, smpteFrameSeparator: o } = fe(e), i = $(n), c = {
1068
1072
  ...r,
1069
1073
  frameSeparator: (r == null ? void 0 : r.frameSeparator) || o,
1070
1074
  ...(r == null ? void 0 : r.dropFrame) === void 0 ? {
1071
- dropFrame: n !== void 0 ? wt(a) : [";", ","].includes(o)
1075
+ dropFrame: n !== void 0 ? wt(i) : [";", ","].includes(o)
1072
1076
  } : {}
1073
- }, l = a.toRate({ rounded: !0 }), u = Math.max(0, l - 1);
1074
- if (i.some((m) => m < 0))
1077
+ }, d = i.toRate({ rounded: !0 }), u = Math.max(0, d - 1);
1078
+ if (a.some((m) => m < 0))
1075
1079
  throw new Error("Negative values are not supported");
1076
1080
  let f;
1077
1081
  switch (s) {
1078
1082
  case "error": {
1079
- const [m, p, d, h] = i;
1083
+ const [m, p, l, h] = a;
1080
1084
  if (m >= 100 || p >= 60)
1081
1085
  throw Error("Minutes has to be less than 60");
1082
- if (d >= 60)
1086
+ if (l >= 60)
1083
1087
  throw Error("Seconds has to be less than 60");
1084
1088
  if (h > u)
1085
1089
  throw Error(`Frames has to be less or equal to ${u}`);
1086
- f = H(i, a, c == null ? void 0 : c.dropFrame);
1090
+ f = H(a, i, c == null ? void 0 : c.dropFrame);
1087
1091
  break;
1088
1092
  }
1089
1093
  case "ignore": {
1090
- const [m, p, d, h] = i, g = [
1094
+ const [m, p, l, h] = a, g = [
1091
1095
  Math.min(100, m),
1092
1096
  Math.min(59, p),
1093
- Math.min(59, d),
1097
+ Math.min(59, l),
1094
1098
  Math.min(u, h)
1095
1099
  ];
1096
1100
  f = H(
1097
1101
  g,
1098
- a,
1102
+ i,
1099
1103
  c == null ? void 0 : c.dropFrame
1100
1104
  );
1101
1105
  break;
1102
1106
  }
1103
1107
  case "add": {
1104
- f = H(i, a, c == null ? void 0 : c.dropFrame);
1108
+ f = H(a, i, c == null ? void 0 : c.dropFrame);
1105
1109
  break;
1106
1110
  }
1107
1111
  default:
1108
1112
  throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(me)}`);
1109
1113
  }
1110
- return new S({ samples: f, timeBase: a }, c);
1114
+ return new S({ samples: f, timeBase: i }, c);
1111
1115
  }, _e = {
1112
1116
  timeBase: void 0,
1113
1117
  dropFrame: void 0,
@@ -1120,22 +1124,22 @@ const ue = (e, t) => {
1120
1124
  else if (typeof e == "number")
1121
1125
  r = { samples: e };
1122
1126
  else if (e.includes("@")) {
1123
- const [o, a] = e.split("@");
1124
- r = { samples: Number(o), timeBase: et(a) };
1127
+ const [o, i] = e.split("@");
1128
+ r = { samples: Number(o), timeBase: et(i) };
1125
1129
  } else
1126
1130
  e === "-INF" ? r = { samples: -1 / 0 } : e === "+INF" ? r = { samples: 1 / 0 } : r = { samples: Number(e) };
1127
1131
  if (Number.isNaN(r == null ? void 0 : r.samples) || r.timeBase && !(r.timeBase instanceof R))
1128
1132
  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;
1133
+ const a = new S(r, n);
1134
+ return s ? a.conformTimeBase($(s), n) : a;
1131
1135
  }, Te = {
1132
1136
  dropFrame: void 0,
1133
1137
  frameSeparator: void 0
1134
- }, L = (e, t) => new S(e, { ...Te, ...t }), ge = (e) => !!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/), Ee = (e) => !Number.isNaN(Number(e)), j = (e, t) => {
1138
+ }, P = (e, t) => new S(e, { ...Te, ...t }), ge = (e) => !!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/), Ee = (e) => !Number.isNaN(Number(e)), j = (e, t) => {
1135
1139
  if (e instanceof S)
1136
1140
  return e;
1137
1141
  if (typeof e != "string" && typeof e != "number")
1138
- return L(e, t);
1142
+ return P(e, t);
1139
1143
  if (typeof e == "string" && ge(e))
1140
1144
  return pe(e, t);
1141
1145
  if (["string", "number"].includes(typeof e) && Ee(e))
@@ -1144,8 +1148,8 @@ const ue = (e, t) => {
1144
1148
  return U(e, t);
1145
1149
  };
1146
1150
  function dt({ 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}`;
1151
+ const r = e.toFixed().padStart(2, "0"), a = t.toFixed().padStart(2, "0"), o = s.toFixed().padStart(2, "0"), i = (n * 10).toFixed().padStart(3, "0");
1152
+ return `${r}:${a}:${o}.${i}`;
1149
1153
  }
1150
1154
  const Ae = {
1151
1155
  subtitleGroup: "stl_subtitle",
@@ -1160,18 +1164,18 @@ const Ae = {
1160
1164
  timespanAsList: !0,
1161
1165
  overrideGroup: !0,
1162
1166
  joinValue: ","
1163
- }).map((a) => {
1167
+ }).map((i) => {
1164
1168
  const {
1165
1169
  start: c,
1166
- end: l,
1170
+ end: d,
1167
1171
  [s]: { [n]: u } = {}
1168
- } = (Array.isArray(a) ? a[0] : a) || {};
1172
+ } = (Array.isArray(i) ? i[0] : i) || {};
1169
1173
  if (!u)
1170
1174
  return "";
1171
- const f = dt(U(c).toTime()), m = dt(U(l).toTime());
1175
+ const f = dt(U(c).toTime()), m = dt(U(d).toTime());
1172
1176
  return `${f} --> ${m} line:0%\r${u}\r`;
1173
1177
  });
1174
- if (o.some((a) => !!a))
1178
+ if (o.some((i) => !!i))
1175
1179
  return `WEBVTT
1176
1180
 
1177
1181
 
@@ -1179,32 +1183,32 @@ ${o.join(`
1179
1183
  `)}`;
1180
1184
  }, Ie = { count: !0, exclude: !0 }, ms = (e = [], t = {}) => {
1181
1185
  const s = { ...Ie, ...t }, { count: n, exclude: r } = s;
1182
- return e.map((i) => typeof i == "string" ? {
1183
- field: i,
1184
- name: i,
1186
+ return e.map((a) => typeof a == "string" ? {
1187
+ field: a,
1188
+ name: a,
1185
1189
  count: n,
1186
- ...r === !0 ? { exclude: [i] } : {}
1187
- } : i);
1190
+ ...r === !0 ? { exclude: [a] } : {}
1191
+ } : a);
1188
1192
  }, hs = (e = []) => e == null ? void 0 : e.map(({ name: t, field: s, count: n, range: r }) => ({
1189
1193
  facetName: t,
1190
1194
  fieldName: s,
1191
- count: n == null ? void 0 : n.reduce((i, { fieldValue: o, value: a }) => ({ ...i, [o]: a }), {}),
1195
+ count: n == null ? void 0 : n.reduce((a, { fieldValue: o, value: i }) => ({ ...a, [o]: i }), {}),
1192
1196
  ...r ? {
1193
- range: r.map(({ value: i, start: o, end: a }) => ({
1197
+ range: r.map(({ value: a, start: o, end: i }) => ({
1194
1198
  start: Number.isNaN(+o) ? o : Number(o),
1195
- end: Number.isNaN(+a) ? a : Number(a),
1196
- count: Number(i) || 0
1199
+ end: Number.isNaN(+i) ? i : Number(i),
1200
+ count: Number(a) || 0
1197
1201
  }))
1198
1202
  } : {}
1199
1203
  })), ps = (e = []) => {
1200
1204
  const t = {};
1201
1205
  return e.forEach(({ name: s, field: n, count: r }) => {
1202
1206
  t[s || n] = r.reduce(
1203
- (i, { fieldValue: o, value: a }) => ({ ...i, [o]: a }),
1207
+ (a, { fieldValue: o, value: i }) => ({ ...a, [o]: i }),
1204
1208
  {}
1205
1209
  );
1206
1210
  }), t;
1207
- }, Bt = {
1211
+ }, Lt = {
1208
1212
  arrayOnSingle: !0,
1209
1213
  joinValue: void 0,
1210
1214
  timespanAsList: !1
@@ -1213,16 +1217,16 @@ ${o.join(`
1213
1217
  arrayOnSingle: s = !0,
1214
1218
  joinValue: n = void 0,
1215
1219
  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) => {
1220
+ } = { ...Lt, ...t || {} }, { field: a = [], start: o, end: i } = e || {}, c = r ? { start: o, end: i } : {};
1221
+ return a.reduce((u, f) => {
1218
1222
  const { name: m, value: p = [] } = f;
1219
1223
  if (p.length === 0)
1220
1224
  return u;
1221
- let d;
1222
- return s === !1 && p.length === 1 ? [d] = p : n ? d = p.join(n) : d = p, { ...u, [m]: d };
1225
+ let l;
1226
+ return s === !1 && p.length === 1 ? [l] = p : n ? l = p.join(n) : l = p, { ...u, [m]: l };
1223
1227
  }, c);
1224
1228
  }, Oe = {
1225
- ...Bt,
1229
+ ...Lt,
1226
1230
  timespanAsList: !1,
1227
1231
  joinTimespan: "_",
1228
1232
  flat: !1,
@@ -1232,17 +1236,17 @@ ${o.join(`
1232
1236
  timespanAsList: s,
1233
1237
  joinTimespan: n = "_",
1234
1238
  flat: r,
1235
- flatTimespan: i,
1239
+ flatTimespan: a,
1236
1240
  ...o
1237
1241
  } = { ...Oe, ...t || {} };
1238
1242
  return s === !0 ? e.map(
1239
- (a) => Y(a, { ...o, timespanAsList: s })
1240
- ) : r === !0 || i === !0 ? e.reduce(
1241
- (a, c) => ({ ...a, ...Y(c, t) }),
1243
+ (i) => Y(i, { ...o, timespanAsList: s })
1244
+ ) : r === !0 || a === !0 ? e.reduce(
1245
+ (i, c) => ({ ...i, ...Y(c, t) }),
1242
1246
  {}
1243
1247
  ) : e.reduce(
1244
- (a, c) => ({
1245
- ...a,
1248
+ (i, c) => ({
1249
+ ...i,
1246
1250
  [[c.start, c.end].join(n)]: Y(
1247
1251
  c,
1248
1252
  t
@@ -1251,11 +1255,11 @@ ${o.join(`
1251
1255
  {}
1252
1256
  );
1253
1257
  }, be = (e, t) => {
1254
- const s = j(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: r = [] } = n, i = r.map((a) => {
1255
- const c = a.split("/").pop().split("?").shift();
1258
+ const s = j(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: r = [] } = n, a = r.map((i) => {
1259
+ const c = i.split("/").pop().split("?").shift();
1256
1260
  return U(c).toSeconds();
1257
- }), o = i.reduce(
1258
- (a, c, l) => Math.abs(c - s) < Math.abs(i[a] - s) ? l : a,
1261
+ }), o = a.reduce(
1262
+ (i, c, d) => Math.abs(c - s) < Math.abs(a[i] - s) ? d : i,
1259
1263
  0
1260
1264
  );
1261
1265
  return r[o];
@@ -1269,18 +1273,18 @@ ${o.join(`
1269
1273
  end: t,
1270
1274
  group: s = [{ id: "unknown", name: "unknown" }]
1271
1275
  }) => {
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 } };
1276
+ const [{ id: n, name: r }] = s, a = j(e).toSeconds(), o = j(t).toSeconds();
1277
+ return { start: e, end: t, startSeconds: a, endSeconds: o, group: { uuid: n, name: r } };
1274
1278
  }, Ts = (e = {}, t) => {
1275
1279
  const { entry: s = [] } = e, n = {
1276
1280
  ...Re,
1277
1281
  ...t || {}
1278
- }, { includeGroupMetadata: r, flatEvents: i, includeEntityType: o, includeNearestThumbnail: a } = n, 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(
1282
+ }, { includeGroupMetadata: r, flatEvents: a, includeEntityType: o, includeNearestThumbnail: i } = n, c = s.map((d) => {
1283
+ const { type: u, item: { metadata: f = {}, id: m, thumbnails: p = {} } = {}, timespan: l, item: h } = d;
1284
+ let g = l.map(
1281
1285
  (E) => ye(E)
1282
1286
  );
1283
- if (a && u === "Item" && p.uri && (g = g.map((E) => {
1287
+ if (i && u === "Item" && p.uri && (g = g.map((E) => {
1284
1288
  const { start: A } = E, O = be(h, j(A));
1285
1289
  return { ...E, thumbnail: O };
1286
1290
  })), r && u === "Item") {
@@ -1319,17 +1323,17 @@ ${o.join(`
1319
1323
  ...o && u === "Collection" ? { collectionType: h } : {}
1320
1324
  };
1321
1325
  });
1322
- return i ? c.flatMap(
1323
- ({ events: l, entityType: u, entityId: f, itemType: m, collectionType: p }) => l.map(
1324
- (d) => ({
1325
- ...d,
1326
+ return a ? c.flatMap(
1327
+ ({ events: d, entityType: u, entityId: f, itemType: m, collectionType: p }) => d.map(
1328
+ (l) => ({
1329
+ ...l,
1326
1330
  entityType: u,
1327
1331
  entityId: f,
1328
1332
  ...m && { itemType: m },
1329
1333
  ...p && { collectionType: p }
1330
1334
  })
1331
1335
  )
1332
- ).sort((l, u) => l.startSeconds - u.startSeconds) : c;
1336
+ ).sort((d, u) => d.startSeconds - u.startSeconds) : c;
1333
1337
  }, gs = (e = "NOW") => {
1334
1338
  if (e.startsWith("NOW")) {
1335
1339
  if (e === "NOW")
@@ -1366,31 +1370,31 @@ ${o.join(`
1366
1370
  channelCount: s,
1367
1371
  codec: n,
1368
1372
  mediaInfo: r,
1369
- bitrate: i,
1373
+ bitrate: a,
1370
1374
  metadata: o
1371
- } = e, a = Se(r), {
1375
+ } = e, i = Se(r), {
1372
1376
  Format: c,
1373
- Resolution: l,
1377
+ Resolution: d,
1374
1378
  Bit_rate_mode: u
1375
- } = a, f = M(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, {
1379
+ } = i, f = M(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
1380
  base: 10,
1377
1381
  round: 1,
1378
1382
  symbols: De
1379
1383
  }) : void 0;
1380
- let d, h;
1381
- return i !== void 0 && (d = w(i, { round: 2, symbols: lt }), h = Number(
1382
- (g = w(i, { exponent: 1, symbols: lt }).split(" kbps")) == null ? void 0 : g[0]
1384
+ let l, h;
1385
+ return a !== void 0 && (l = w(a, { round: 2, symbols: lt }), h = Number(
1386
+ (g = w(a, { exponent: 1, symbols: lt }).split(" kbps")) == null ? void 0 : g[0]
1383
1387
  )), {
1384
1388
  audioFormat: c,
1385
1389
  audioCodec: n,
1386
1390
  audioSamplerate: p,
1387
1391
  audioSamplerateSamples: m,
1388
- audioBitDepth: l,
1389
- audioBitrate: d,
1392
+ audioBitDepth: d,
1393
+ audioBitrate: l,
1390
1394
  audioBitrateKbps: h,
1391
1395
  audioBitRateMode: u,
1392
1396
  audioChannels: s,
1393
- audioMediaInfo: a,
1397
+ audioMediaInfo: i,
1394
1398
  audioMetadata: f
1395
1399
  };
1396
1400
  }, Es = {
@@ -1416,31 +1420,31 @@ ${o.join(`
1416
1420
  ARCHIVED: "ARCHIVED",
1417
1421
  /** File will be synchronized by multi-site agent. */
1418
1422
  AWAITING_SYNC: "AWAITING_SYNC"
1419
- }, Pt = (e) => {
1423
+ }, Bt = (e) => {
1420
1424
  const {
1421
1425
  uri: t = [],
1422
1426
  size: s,
1423
1427
  hash: n,
1424
1428
  path: r,
1425
- id: i,
1429
+ id: a,
1426
1430
  storage: o
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;
1431
+ } = e, [i] = 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;
1428
1432
  return {
1429
- uri: a,
1433
+ uri: i,
1430
1434
  hash: n,
1431
1435
  fileSize: c,
1432
1436
  fileSizeBytes: s,
1433
1437
  path: r,
1434
1438
  fileName: u,
1435
- fileId: i,
1439
+ fileId: a,
1436
1440
  storageId: o,
1437
1441
  folderPath: f
1438
1442
  };
1439
1443
  }, Me = (e = {}) => {
1440
- const { file: t, mediaInfo: s, metadata: n = [] } = e, r = M(n), i = z(s);
1441
- let o = { binaryMetadata: r, binaryMediaInfo: i };
1444
+ const { file: t, mediaInfo: s, metadata: n = [] } = e, r = M(n), a = z(s);
1445
+ let o = { binaryMetadata: r, binaryMediaInfo: a };
1442
1446
  if (t) {
1443
- const [a] = t, c = Pt(a);
1447
+ const [i] = t, c = Bt(i);
1444
1448
  o = {
1445
1449
  ...o,
1446
1450
  ...c
@@ -1453,43 +1457,43 @@ ${o.join(`
1453
1457
  metadata: s,
1454
1458
  file: n,
1455
1459
  duration: r,
1456
- startTimestamp: i,
1460
+ startTimestamp: a,
1457
1461
  startTimecode: o,
1458
- timeCodeTimeBase: a
1459
- } = e, c = M(s || []), l = z(t);
1460
- let { Format: u } = l;
1462
+ timeCodeTimeBase: i
1463
+ } = e, c = M(s || []), d = z(t);
1464
+ let { Format: u } = d;
1461
1465
  const {
1462
1466
  Video_Format_List: f,
1463
1467
  Audio_Format_List: m,
1464
1468
  Text_Format_List: p
1465
- } = l;
1469
+ } = d;
1466
1470
  if (u === void 0) {
1467
1471
  const { format: h } = e;
1468
1472
  u = h, h && h.includes(",") && ([u] = h.split(","));
1469
1473
  }
1470
- let d = {
1474
+ let l = {
1471
1475
  containerFormat: u,
1472
1476
  videoFormat: f,
1473
1477
  audioFormat: m,
1474
1478
  textFormat: p,
1475
1479
  containerMetadata: c,
1476
- containerMediaInfo: l
1480
+ containerMediaInfo: d
1477
1481
  };
1478
- if (c.componentOriginalFilename && (d.originalFilename = c.componentOriginalFilename), r !== void 0 && r.samples !== 0) {
1479
- const h = L(r);
1480
- d.durationTimeCode = h.toObject(), d.duration = h.toDuration();
1482
+ if (c.componentOriginalFilename && (l.originalFilename = c.componentOriginalFilename), r !== void 0 && r.samples !== 0) {
1483
+ const h = P(r);
1484
+ l.durationTimeCode = h.toObject(), l.duration = h.toDuration();
1481
1485
  }
1482
- if (i && (d.startTimestamp = L(i).toObject()), o !== void 0 && a && (d.startTimecode = L({
1486
+ if (a && (l.startTimestamp = P(a).toObject()), o !== void 0 && i && (l.startTimecode = P({
1483
1487
  samples: o,
1484
- timeBase: a
1488
+ timeBase: i
1485
1489
  })), n) {
1486
- const [h] = n, g = Pt(h);
1487
- d = {
1488
- ...d,
1490
+ const [h] = n, g = Bt(h);
1491
+ l = {
1492
+ ...l,
1489
1493
  ...g
1490
1494
  };
1491
1495
  }
1492
- return d;
1496
+ return l;
1493
1497
  }, ft = { kB: "kbps", B: "bps", MB: "mbps" }, Ce = (e = {}) => {
1494
1498
  var k;
1495
1499
  const {
@@ -1497,66 +1501,66 @@ ${o.join(`
1497
1501
  bitrate: s,
1498
1502
  fieldOrder: n,
1499
1503
  resolution: r,
1500
- mediaInfo: i,
1504
+ mediaInfo: a,
1501
1505
  metadata: o = []
1502
- } = e, a = ve(i), c = M(o), {
1503
- Format: l,
1506
+ } = e, i = ve(a), c = M(o), {
1507
+ Format: d,
1504
1508
  "Frame rate": u,
1505
1509
  "Color space": f,
1506
1510
  "Color primaries": m,
1507
1511
  Colorimetry: p
1508
- } = a;
1509
- let d;
1512
+ } = i;
1513
+ let l;
1510
1514
  const { averageFrameRate: h, realBaseFrameRate: g } = e;
1511
- g !== void 0 ? d = x({
1515
+ g !== void 0 ? l = x({
1512
1516
  numerator: g.denominator,
1513
1517
  denominator: g.numerator
1514
- }) : u !== void 0 ? d = et(u) : h !== void 0 && (d = x({
1518
+ }) : u !== void 0 ? l = et(u) : h !== void 0 && (l = x({
1515
1519
  numerator: h.denominator,
1516
1520
  denominator: h.numerator
1517
1521
  }));
1518
- let { "Frame count": E } = a;
1522
+ let { "Frame count": E } = i;
1519
1523
  if (E === void 0) {
1520
1524
  const { numberOfPackets: it } = e;
1521
1525
  it !== void 0 && (E = it.toString());
1522
1526
  }
1523
1527
  let A, O, I;
1524
- E && d && (A = L({ samples: E, timeBase: d }), O = A.timeBase.toConstant() || A.timeBase.toRate(), I = A.toSmpte());
1528
+ E && l && (A = P({ samples: E, timeBase: l }), O = A.timeBase.toConstant() || A.timeBase.toRate(), I = A.toSmpte());
1525
1529
  const { height: b, width: D } = r || {}, N = J(r), C = `${D}x${b}`;
1526
- let v, B;
1527
- return s !== void 0 && (v = w(s, { round: 2, symbols: ft }), B = Number(
1530
+ let v, L;
1531
+ return s !== void 0 && (v = w(s, { round: 2, symbols: ft }), L = Number(
1528
1532
  (k = w(s, { exponent: 2, symbols: ft }).split(" mbps")) == null ? void 0 : k[0]
1529
1533
  )), {
1530
- videoFormat: l,
1534
+ videoFormat: d,
1531
1535
  dimension: C,
1532
1536
  frameRate: O,
1533
1537
  height: b,
1534
1538
  width: D,
1535
- timeBase: d,
1539
+ timeBase: l,
1536
1540
  timeCode: A,
1537
1541
  videoCodec: t,
1538
1542
  smpte: I,
1539
1543
  videoBitrate: v,
1540
- videoBitrateMbps: B,
1544
+ videoBitrateMbps: L,
1541
1545
  fieldOrder: n,
1542
1546
  colorSpace: f,
1543
1547
  chromaSubsampling: p,
1544
1548
  aspectRatio: N,
1545
1549
  colorPrimaries: m,
1546
1550
  videoMetadata: c,
1547
- videoMediaInfo: a
1551
+ videoMediaInfo: i
1548
1552
  };
1549
1553
  }, rt = (e = {}, t = {}) => {
1550
1554
  let s = {};
1551
1555
  const { priority: n = ["container", "video", "audio", "binary"] } = t, {
1552
1556
  containerComponent: r,
1553
- videoComponent: i,
1557
+ videoComponent: a,
1554
1558
  audioComponent: o,
1555
- binaryComponent: a,
1559
+ binaryComponent: i,
1556
1560
  mimeType: c = [],
1557
- tag: l = []
1561
+ tag: d = []
1558
1562
  } = e;
1559
- [s.tag] = l, [s.mimeType] = c;
1563
+ [s.tag] = d, [s.mimeType] = c;
1560
1564
  const u = (f, m) => Object.fromEntries(
1561
1565
  [.../* @__PURE__ */ new Set([...Object.keys(m), ...Object.keys(f)])].map((p) => [
1562
1566
  p,
@@ -1572,8 +1576,8 @@ ${o.join(`
1572
1576
  ));
1573
1577
  break;
1574
1578
  case "video":
1575
- if (i) {
1576
- const [m] = i;
1579
+ if (a) {
1580
+ const [m] = a;
1577
1581
  s = u(
1578
1582
  s,
1579
1583
  Ce(m)
@@ -1590,8 +1594,8 @@ ${o.join(`
1590
1594
  }
1591
1595
  break;
1592
1596
  case "binary":
1593
- if (a) {
1594
- const [m] = a;
1597
+ if (i) {
1598
+ const [m] = i;
1595
1599
  s = u(
1596
1600
  s,
1597
1601
  Me(m)
@@ -1600,7 +1604,7 @@ ${o.join(`
1600
1604
  break;
1601
1605
  }
1602
1606
  }), s;
1603
- }, P = {
1607
+ }, B = {
1604
1608
  PDF: "PDF",
1605
1609
  TEXT: "TEXT",
1606
1610
  MSWORD: "MSWORD",
@@ -1616,15 +1620,15 @@ ${o.join(`
1616
1620
  const { mimeType: t } = e, s = Array.isArray(t) ? t[0] : t;
1617
1621
  if (s) {
1618
1622
  if (s.endsWith("/pdf"))
1619
- return P.PDF;
1623
+ return B.PDF;
1620
1624
  if (s.startsWith("text/"))
1621
- return P.TEXT;
1625
+ return B.TEXT;
1622
1626
  if (s.endsWith("/msword"))
1623
- return P.MSWORD;
1627
+ return B.MSWORD;
1624
1628
  if (s.endsWith("/json"))
1625
- return P.JSON;
1629
+ return B.JSON;
1626
1630
  if (s.endsWith("/xml"))
1627
- return P.XML;
1631
+ return B.XML;
1628
1632
  }
1629
1633
  }, we = [
1630
1634
  "image/apng",
@@ -1634,7 +1638,7 @@ ${o.join(`
1634
1638
  "image/x-icon",
1635
1639
  "image/png",
1636
1640
  "image/svg+xml"
1637
- ], Be = ["video/mp4"], Pe = [
1641
+ ], Le = ["video/mp4"], Be = [
1638
1642
  "audio/mp4",
1639
1643
  "audio/mpeg",
1640
1644
  "audio/x-aac",
@@ -1645,7 +1649,7 @@ ${o.join(`
1645
1649
  "audio/ogg",
1646
1650
  "audio/webm",
1647
1651
  "audio/x-flac"
1648
- ], Le = [...Be, ...we, ...Pe], xe = ["http", "https"], je = "video/mp4", ke = "video/quicktime", We = "video/x-m4v", $e = "MPEG-4", Ue = "mov", Ge = "h264", W = [
1652
+ ], Pe = [...Le, ...we, ...Be], xe = ["http", "https"], je = "video/mp4", ke = "video/quicktime", We = "video/x-m4v", $e = "MPEG-4", Ue = "mov", Ge = "h264", W = [
1649
1653
  "__mp4",
1650
1654
  "__mp3_160k",
1651
1655
  "__png",
@@ -1654,26 +1658,26 @@ ${o.join(`
1654
1658
  "original"
1655
1659
  ].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
1660
  const {
1657
- allowedMimeTypes: s = Le,
1661
+ allowedMimeTypes: s = Pe,
1658
1662
  allowedMethods: n = xe,
1659
1663
  sortPriority: r = mt,
1660
- sourceKey: i = "src",
1664
+ sourceKey: a = "src",
1661
1665
  mimeTypeKey: o = "type",
1662
- shapeKey: a = "shape",
1666
+ shapeKey: i = "shape",
1663
1667
  parsedShapeKey: c = "parsedShape"
1664
- } = t || {}, { shape: l = [] } = e || {}, u = l.reduce((f, m) => {
1665
- let p, d;
1668
+ } = t || {}, { shape: d = [] } = e || {}, u = d.reduce((f, m) => {
1669
+ let p, l;
1666
1670
  const h = rt(m), { uri: g, mimeType: E, containerFormat: A, videoCodec: O } = h;
1667
1671
  if (E && (p = E, (E === ke || E === We) && (A === $e || A === Ue) && O === Ge && (p = je)), g)
1668
1672
  if (n) {
1669
1673
  const [I] = g.split("://");
1670
- n.includes(I) && (d = g);
1674
+ n.includes(I) && (l = g);
1671
1675
  } else
1672
- d = g;
1673
- return d && s.includes(p) && f.push({
1674
- [i]: d,
1676
+ l = g;
1677
+ return l && s.includes(p) && f.push({
1678
+ [a]: l,
1675
1679
  [o]: p,
1676
- [a]: m,
1680
+ [i]: m,
1677
1681
  [c]: h
1678
1682
  }), f;
1679
1683
  }, []);
@@ -1696,7 +1700,7 @@ ${o.join(`
1696
1700
  if (s.endsWith("/octet-stream"))
1697
1701
  return y.BINARY;
1698
1702
  }
1699
- }, Lt = "video/mp4", xt = "video/quicktime", jt = "video/x-m4v", ze = "MPEG-4", Ve = "mov", He = "h264", Ye = [Lt, xt, jt], kt = [
1703
+ }, Pt = "video/mp4", xt = "video/quicktime", jt = "video/x-m4v", ze = "MPEG-4", Ve = "mov", He = "h264", Ye = [Pt, xt, jt], kt = [
1700
1704
  "video/x-mxf-h264",
1701
1705
  "video/x-mxf-h264-aac",
1702
1706
  "video/x-mxf-h264-pcm_s24le",
@@ -1724,23 +1728,23 @@ ${o.join(`
1724
1728
  allowedMimeTypes: s = qe,
1725
1729
  allowedMethods: n = Xe,
1726
1730
  streamingServers: r = []
1727
- } = t || {}, { shape: i = [] } = e || {}, { startTimeCode: o } = ce(e == null ? void 0 : e.metadata, {
1731
+ } = t || {}, { shape: a = [] } = e || {}, { startTimeCode: o } = ce(e == null ? void 0 : e.metadata, {
1728
1732
  flat: !0,
1729
1733
  arrayOnSingleValue: !1
1730
1734
  });
1731
- return i.reduce((c, l) => {
1735
+ return a.reduce((c, d) => {
1732
1736
  var D, N, C;
1733
1737
  let u, f, m;
1734
- const p = rt(l), { uri: d, mimeType: h, containerFormat: g, videoCodec: E } = p;
1735
- if (!(s != null && s.includes(h)) || !(n != null && n.includes((D = d == null ? void 0 : d.split("://")) == null ? void 0 : D[0])))
1738
+ const p = rt(d), { uri: l, mimeType: h, containerFormat: g, videoCodec: E } = p;
1739
+ if (!(s != null && s.includes(h)) || !(n != null && n.includes((D = l == null ? void 0 : l.split("://")) == null ? void 0 : D[0])))
1736
1740
  return c;
1737
1741
  if (m = p.tag, !m) {
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
- B === 0 ? m = v : m = v + (B + 1);
1742
+ const v = (C = (N = h == null ? void 0 : h.split) == null ? void 0 : N.call(h, "/")) == null ? void 0 : C.pop(), L = c.filter((k) => k.label === v).length;
1743
+ L === 0 ? m = v : m = v + (L + 1);
1740
1744
  }
1741
1745
  const { timeBase: A, startTimecode: O } = p, I = o ?? O, b = I && j(I);
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,
1746
+ return f = l, u = h, (h === xt || h === jt) && (g === ze || g === Ve) && E === He && (u = Pt), r != null && r.length && kt.includes(h) && (f = Qe({
1747
+ url: l,
1744
1748
  streamingServers: r,
1745
1749
  ending: "mpd"
1746
1750
  }), u = "application/dash+xml"), f && c.push({
@@ -1755,43 +1759,43 @@ ${o.join(`
1755
1759
  const t = {}, { outputSetting: s = [] } = e || {};
1756
1760
  if (s.length === 0)
1757
1761
  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, ...l } = a;
1762
+ const n = JSON.parse(s[0]), { Settings: { ContainerSettings: r, VideoDescription: a, AudioDescriptions: o } = {} } = n;
1763
+ if (r && (t.containerFormat = r.Container), a) {
1764
+ const { CodecSettings: i = {} } = a, { Codec: c, ...d } = i;
1761
1765
  t.videoFormat = c;
1762
- const { Height: u, Width: f } = i;
1766
+ const { Height: u, Width: f } = a;
1763
1767
  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(l);
1768
+ const [m] = Object.values(d);
1765
1769
  if (m) {
1766
1770
  t.fieldOrder = m.InterlaceMode, t.fieldOrder && t.fieldOrder.includes("TOP") && (t.fieldOrder = "interlaced"), t.videoBitrate = m.Bitrate;
1767
- const p = m.FramerateDenominator, d = m.FramerateNumerator, h = x({ denominator: d, numerator: p });
1771
+ const p = m.FramerateDenominator, l = m.FramerateNumerator, h = x({ denominator: l, numerator: p });
1768
1772
  t.timeBase = h, t.frameRate = h.toConstant() || h.toRate();
1769
1773
  }
1770
1774
  }
1771
1775
  if (o && o.length > 0) {
1772
- const { CodecSettings: a = {} } = o[0], { Codec: c, ...l } = a;
1776
+ const { CodecSettings: i = {} } = o[0], { Codec: c, ...d } = i;
1773
1777
  t.audioFormat = c;
1774
- const [u] = Object.values(l);
1778
+ const [u] = Object.values(d);
1775
1779
  u && (t.audioSamplerate = u.SampleRate, t.audioBitrate = u.Bitrate, t.audioBitRateMode = u.RateControlMode);
1776
1780
  }
1777
1781
  return t;
1778
1782
  }, Rs = (e) => {
1779
- const t = {}, { description: s, format: n, audio: r, video: i, mediaconvert: o } = e || {};
1783
+ const t = {}, { description: s, format: n, audio: r, video: a, mediaconvert: o } = e || {};
1780
1784
  if (o)
1781
1785
  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);
1785
- t.timeBase = a, t.frameRate = a.toConstant() || a.toRate();
1786
+ if (t.description = s, t.containerFormat = n, a) {
1787
+ if (t.videoFormat = a.codec, t.videoBitrate = a.bitrate, a.framerate) {
1788
+ const i = x(a.framerate);
1789
+ t.timeBase = i, t.frameRate = i.toConstant() || i.toRate();
1786
1790
  }
1787
- if (i.scaling) {
1788
- const { height: a, width: c } = i.scaling;
1789
- t.height = a, t.width = c, a && c && (t.dimension = `${c}x${a}`, t.aspectRatio = J({ height: a, width: c }));
1791
+ if (a.scaling) {
1792
+ const { height: i, width: c } = a.scaling;
1793
+ t.height = i, t.width = c, i && c && (t.dimension = `${c}x${i}`, t.aspectRatio = J({ height: i, width: c }));
1790
1794
  }
1791
1795
  }
1792
1796
  if (r) {
1793
- const { codec: a, channel: c } = r;
1794
- t.audioFormat = a, c && (t.audioChannels = c.length);
1797
+ const { codec: i, channel: c } = r;
1798
+ t.audioFormat = i, c && (t.audioChannels = c.length);
1795
1799
  }
1796
1800
  return t;
1797
1801
  }, ts = (e) => {
@@ -1802,17 +1806,17 @@ ${o.join(`
1802
1806
  type: s,
1803
1807
  defaultValue: n,
1804
1808
  stringRestriction: r,
1805
- floatRestriction: i,
1809
+ floatRestriction: a,
1806
1810
  integerRestriction: o,
1807
- longRestriction: a,
1811
+ longRestriction: i,
1808
1812
  data: c,
1809
- values: l,
1813
+ values: d,
1810
1814
  system: u
1811
- } = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive: d, maxInclusive: h } = i || o || a || {}, g = ((l == null ? void 0 : l.field) || []).map(({ key: I, value: b }) => ({
1815
+ } = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive: l, maxInclusive: h } = a || o || i || {}, g = ((d == null ? void 0 : d.field) || []).map(({ key: I, value: b }) => ({
1812
1816
  label: b ?? I,
1813
1817
  value: I
1814
1818
  })), A = ((I) => Object.fromEntries(Object.entries(I).filter(([, b]) => b !== void 0)))({
1815
- min: d,
1819
+ min: l,
1816
1820
  max: h,
1817
1821
  minLength: f,
1818
1822
  maxLength: m,
@@ -1822,7 +1826,7 @@ ${o.join(`
1822
1826
  name: t,
1823
1827
  type: s,
1824
1828
  defaultValue: n,
1825
- required: d !== void 0 || f !== void 0 && f > 0,
1829
+ required: l !== void 0 || f !== void 0 && f > 0,
1826
1830
  restrictions: A,
1827
1831
  data: O,
1828
1832
  options: g,
@@ -1870,8 +1874,8 @@ class nt {
1870
1874
  */
1871
1875
  trigger(t, s, n) {
1872
1876
  const r = this.events[t];
1873
- !r || r.length < 1 || r.forEach((i) => {
1874
- i(s, n);
1877
+ !r || r.length < 1 || r.forEach((a) => {
1878
+ a(s, n);
1875
1879
  });
1876
1880
  }
1877
1881
  }
@@ -1956,7 +1960,7 @@ class es {
1956
1960
  }
1957
1961
  class ht {
1958
1962
  constructor(t, s) {
1959
- var n, r, i, o, a, c;
1963
+ var n, r, a, o, i, c;
1960
1964
  if (this.DEFAULT_OPTIONS = Object.freeze({
1961
1965
  targetRate: 4e6,
1962
1966
  // 4mb sec,
@@ -1983,7 +1987,7 @@ class ht {
1983
1987
  ...((n = s.api) == null ? void 0 : n.props) ?? {},
1984
1988
  queryParams: {
1985
1989
  transferId: zt(),
1986
- ...((i = (r = s.api) == null ? void 0 : r.props) == null ? void 0 : i.queryParams) ?? {}
1990
+ ...((a = (r = s.api) == null ? void 0 : r.props) == null ? void 0 : a.queryParams) ?? {}
1987
1991
  }
1988
1992
  }
1989
1993
  }
@@ -1999,7 +2003,7 @@ class ht {
1999
2003
  maxConcurrentTransfers: this.options.maxConcurrentTransfers,
2000
2004
  mime: "",
2001
2005
  status: _.idle,
2002
- transferId: (c = (a = (o = s.api) == null ? void 0 : o.props) == null ? void 0 : a.queryParams) == null ? void 0 : c.transferId,
2006
+ transferId: (c = (i = (o = s.api) == null ? void 0 : o.props) == null ? void 0 : i.queryParams) == null ? void 0 : c.transferId,
2003
2007
  lastStats: {}
2004
2008
  }, typeof t == "object" ? (this.state.blob = t, this.state.mime = t.type, this.addChunksFromBlob(t)) : console.error(new Error(`Expected a File or a Blob object, but got ${typeof t}`));
2005
2009
  }
@@ -2011,19 +2015,19 @@ class ht {
2011
2015
  let n = 0;
2012
2016
  const r = () => {
2013
2017
  for (; this.state.transferPromises.length < this.state.maxConcurrentTransfers && n < s; ) {
2014
- const i = this.state.chunks[n];
2015
- if (n += 1, i.state.status !== _.complete && i.state.status !== _.transferring) {
2018
+ const a = this.state.chunks[n];
2019
+ if (n += 1, a.state.status !== _.complete && a.state.status !== _.transferring) {
2016
2020
  this.state.status = _.transferring;
2017
- const o = i.tryTransfer();
2021
+ const o = a.tryTransfer();
2018
2022
  this.state.transferPromises.push(o), o.then(() => {
2019
- const a = this.state.transferPromises.indexOf(o);
2020
- a !== -1 && this.state.transferPromises.splice(a, 1), this.state.status !== _.canceled && r();
2021
- }).catch((a) => {
2023
+ const i = this.state.transferPromises.indexOf(o);
2024
+ i !== -1 && this.state.transferPromises.splice(i, 1), this.state.status !== _.canceled && r();
2025
+ }).catch((i) => {
2022
2026
  const c = this.state.transferPromises.indexOf(o);
2023
2027
  c !== -1 && this.state.transferPromises.splice(c, 1), console.error(
2024
2028
  "Failed on this upload(), check connectivity and try to resume",
2025
- a
2026
- ), this.state.status !== _.offline ? (this.state.status = _.failed, this.eventBus.trigger(T.failed, this.state, a), this.options.onFail && this.options.onFail(a)) : setTimeout(() => this.retry(), 5e3);
2029
+ i
2030
+ ), 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);
2027
2031
  });
2028
2032
  }
2029
2033
  }
@@ -2035,16 +2039,16 @@ class ht {
2035
2039
  // get all byte ranges for splitting in chunks
2036
2040
  getByteRangesForChunks(t, s = this.options.chunkSize) {
2037
2041
  const n = [], { minChunkSize: r } = this.options;
2038
- let o = s >= r ? s : r, a = Math.floor(t.size / o);
2039
- if (t.size - (t.size - t.size / a) >= r || (a -= 1, o = Math.floor(t.size / a)), a < 2 || t.size < this.options.minFileSize)
2042
+ let o = s >= r ? s : r, i = Math.floor(t.size / o);
2043
+ if (t.size - (t.size - t.size / i) >= r || (i -= 1, o = Math.floor(t.size / i)), i < 2 || t.size < this.options.minFileSize)
2040
2044
  n.push({ start: 0, end: t.size });
2041
2045
  else
2042
- for (let c = 0; c <= a; c += 1) {
2043
- const l = o * c;
2046
+ for (let c = 0; c <= i; c += 1) {
2047
+ const d = o * c;
2044
2048
  let u = o * c + o;
2045
2049
  t.size - o * c <= r && (u = t.size);
2046
2050
  const m = {
2047
- start: l,
2051
+ start: d,
2048
2052
  end: u
2049
2053
  };
2050
2054
  if (n.push(m), u === t.size)
@@ -2131,22 +2135,22 @@ class ht {
2131
2135
  }
2132
2136
  getStats() {
2133
2137
  const t = this.state.chunks.length, s = this.state.chunks.filter(
2134
- (l) => l.state.status === _.complete
2138
+ (d) => d.state.status === _.complete
2135
2139
  ), n = this.state.chunks.filter(
2136
- (l) => l.state.status === _.transferring
2140
+ (d) => d.state.status === _.transferring
2137
2141
  ), r = s.length;
2138
- let i = 0, o = 0;
2139
- s.forEach((l) => {
2140
- i += l.transferRate, o += l.blobSlice.size;
2141
- }), n.forEach((l) => {
2142
- o += l.state.bytesTransferred;
2142
+ let a = 0, o = 0;
2143
+ s.forEach((d) => {
2144
+ a += d.transferRate, o += d.blobSlice.size;
2145
+ }), n.forEach((d) => {
2146
+ o += d.state.bytesTransferred;
2143
2147
  });
2144
- const a = i / r, c = {
2148
+ const i = a / r, c = {
2145
2149
  totalChunks: t,
2146
2150
  completedChunks: r,
2147
2151
  totalBytes: this.state.blob.size,
2148
2152
  transferredBytes: o,
2149
- avgTransferRate: a,
2153
+ avgTransferRate: i,
2150
2154
  concurrentTransfers: this.state.maxConcurrentTransfers
2151
2155
  };
2152
2156
  return this.state.rate = c.avgTransferRate, c;
@@ -2254,8 +2258,8 @@ class vs {
2254
2258
  removeChunkedUpload(t, s = !1) {
2255
2259
  const n = (r) => r ? r.state.status === _.complete && !s ? (console.error(
2256
2260
  "Can't cancel complete transfers, pass true as a second argument in .removeChunkedUpload() to force removal."
2257
- ), !1) : (Object.keys(this.state.transfers).forEach((i) => {
2258
- r === this.state.transfers[i] && delete this.state.transfers[i];
2261
+ ), !1) : (Object.keys(this.state.transfers).forEach((a) => {
2262
+ r === this.state.transfers[a] && delete this.state.transfers[a];
2259
2263
  }), this.events.trigger(T.removed, this.state), r.cancel(), !0) : (console.error("Could not find a matching transfer to cancel."), !1);
2260
2264
  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(
2261
2265
  "Invalid object to remove - has to be either ChunkedUpload, File or transferId"
@@ -2334,12 +2338,12 @@ class vs {
2334
2338
  get fileList() {
2335
2339
  const t = [];
2336
2340
  return this.transfers.forEach((s) => {
2337
- const n = s.getStats(), { totalChunks: r, completedChunks: i } = n, o = {
2341
+ const n = s.getStats(), { totalChunks: r, completedChunks: a } = n, o = {
2338
2342
  name: s.state.blob.name,
2339
2343
  bytesDone: n.transferredBytes,
2340
2344
  bytesTotal: s.state.blob.size,
2341
2345
  totalChunks: r,
2342
- completedChunks: i,
2346
+ completedChunks: a,
2343
2347
  transfer: s
2344
2348
  };
2345
2349
  t.push(o);
@@ -2347,16 +2351,16 @@ class vs {
2347
2351
  }
2348
2352
  }
2349
2353
  const Wt = (e, t, s = "") => {
2350
- const n = (a) => {
2351
- const c = a.startsWith("/") ? a.slice(1) : a, l = (c == null ? void 0 : c.search("/")) ?? -1;
2352
- return l === -1 ? [c] : [c.slice(0, l), c.slice(l + 1)];
2353
- }, [r, i] = n(t), o = [s, r].filter(Boolean).join("/");
2354
- return i ? {
2354
+ const n = (i) => {
2355
+ const c = i.startsWith("/") ? i.slice(1) : i, d = (c == null ? void 0 : c.search("/")) ?? -1;
2356
+ return d === -1 ? [c] : [c.slice(0, d), c.slice(d + 1)];
2357
+ }, [r, a] = n(t), o = [s, r].filter(Boolean).join("/");
2358
+ return a ? {
2355
2359
  [r]: {
2356
2360
  file: new File([e], r, { ...e, type: "folder" }),
2357
2361
  path: o,
2358
2362
  progress: { totalBytes: e.size ?? 0, transferredBytes: 0 },
2359
- files: Wt(e, i, o)
2363
+ files: Wt(e, a, o)
2360
2364
  }
2361
2365
  } : {
2362
2366
  [r]: {
@@ -2371,7 +2375,7 @@ export {
2371
2375
  vs as ChunkedTransferManager,
2372
2376
  ht as ChunkedUpload,
2373
2377
  nt as ChunkedUploadEventBus,
2374
- P as DOCUMENT_TYPES,
2378
+ B as DOCUMENT_TYPES,
2375
2379
  T as EVENTS,
2376
2380
  Ht as FIELD_ATTRIBUTE_KEYS,
2377
2381
  Ss as FIELD_DEFINITION_TYPES,
@@ -2397,7 +2401,7 @@ export {
2397
2401
  de as formatTimeCodeSeconds,
2398
2402
  pe as formatTimeCodeSmpte,
2399
2403
  U as formatTimeCodeText,
2400
- L as formatTimeCodeType,
2404
+ P as formatTimeCodeType,
2401
2405
  bs as getPlayerSources,
2402
2406
  As as getShapeDocumentType,
2403
2407
  Os as getShapeMediaType,
@@ -2409,7 +2413,7 @@ export {
2409
2413
  ps as parseFacetType,
2410
2414
  ys as parseFieldDefinitionList,
2411
2415
  Dt as parseFieldList,
2412
- Pt as parseFileType,
2416
+ Bt as parseFileType,
2413
2417
  Mt as parseGroupList,
2414
2418
  Y as parseHighlightTimespan,
2415
2419
  _s as parseHighlightTimespanList,