@shotstack/shotstack-studio 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -332,7 +332,7 @@ class yi {
332
332
  return 0;
333
333
  }
334
334
  }
335
- class Ci {
335
+ class vi {
336
336
  clipConfiguration;
337
337
  constructor(t) {
338
338
  this.clipConfiguration = t;
@@ -486,7 +486,7 @@ class Ci {
486
486
  }
487
487
  }
488
488
  }
489
- class vi {
489
+ class Ci {
490
490
  static ButtonLeftClick = 0;
491
491
  static ButtonRightClick = 3;
492
492
  }
@@ -653,7 +653,7 @@ class D extends ot {
653
653
  return;
654
654
  const t = [], e = [], i = [], s = [], n = [], a = new yi(this.clipConfiguration).build(this.edit.size, this.getSize());
655
655
  t.push(...a.offsetXKeyframes), e.push(...a.offsetYKeyframes), i.push(...a.opacityKeyframes), s.push(...a.scaleKeyframes), n.push(...a.rotationKeyframes);
656
- const o = new Ci(this.clipConfiguration).build();
656
+ const o = new vi(this.clipConfiguration).build();
657
657
  t.push(...o.offsetXKeyframes), e.push(...o.offsetYKeyframes), i.push(...o.opacityKeyframes), s.push(...o.scaleKeyframes), n.push(...o.rotationKeyframes), t.length && (this.offsetXKeyframeBuilder = new R(t, this.getLength())), e.length && (this.offsetYKeyframeBuilder = new R(e, this.getLength())), i.length && (this.opacityKeyframeBuilder = new R(i, this.getLength(), 1)), s.length && (this.scaleKeyframeBuilder = new R(s, this.getLength(), 1)), n.length && (this.rotationKeyframeBuilder = new R(n, this.getLength()));
658
658
  }
659
659
  async load() {
@@ -662,8 +662,8 @@ class D extends ot {
662
662
  update(t, e) {
663
663
  if (this.getContainer().visible = this.isActive(), this.getContainer().zIndex = 1e5 - this.layer * 100, !this.isActive())
664
664
  return;
665
- const i = this.getPivot(), s = this.getPosition(), n = this.getScale();
666
- this.getContainer().scale.set(n), this.getContainer().pivot.set(i.x, i.y), this.getContainer().position.set(s.x + i.x, s.y + i.y);
665
+ const i = this.getPivot(), s = this.getPosition(), n = this.getContainerScale();
666
+ this.getContainer().scale.set(n.x, n.y), this.getContainer().pivot.set(i.x, i.y), this.getContainer().position.set(s.x + i.x, s.y + i.y);
667
667
  const a = this.getRotation();
668
668
  this.contentContainer.alpha = this.getOpacity(), this.getContainer().angle = a, this.shouldDiscardFrame() && (this.contentContainer.alpha = 0);
669
669
  }
@@ -717,8 +717,10 @@ class D extends ot {
717
717
  }
718
718
  getFitScale() {
719
719
  switch (this.clipConfiguration.fit ?? "crop") {
720
- case "crop":
721
- return Math.max(this.edit.size.width / this.getSize().width, this.edit.size.height / this.getSize().height);
720
+ case "crop": {
721
+ const t = this.edit.size.width / this.getSize().width, e = this.edit.size.height / this.getSize().height;
722
+ return this.edit.size.height >= this.edit.size.width ? e : t;
723
+ }
722
724
  case "cover":
723
725
  return Math.max(this.edit.size.width / this.getSize().width, this.edit.size.height / this.getSize().height);
724
726
  case "contain":
@@ -731,6 +733,27 @@ class D extends ot {
731
733
  getScale() {
732
734
  return (this.scaleKeyframeBuilder?.getValue(this.getPlaybackTime()) ?? 1) * this.getFitScale();
733
735
  }
736
+ getContainerScale() {
737
+ const t = this.scaleKeyframeBuilder?.getValue(this.getPlaybackTime()) ?? 1, e = this.getSize(), i = this.clipConfiguration.fit ?? "crop";
738
+ if (e.width === 0 || e.height === 0)
739
+ return { x: t, y: t };
740
+ const s = this.edit.size.width / e.width, n = this.edit.size.height / e.height;
741
+ switch (i) {
742
+ case "contain": {
743
+ const a = Math.min(s, n) * t;
744
+ return { x: a, y: a };
745
+ }
746
+ case "crop": {
747
+ const o = (this.edit.size.height >= this.edit.size.width ? n : s) * t;
748
+ return { x: o, y: o };
749
+ }
750
+ case "cover":
751
+ return { x: s * t, y: n * t };
752
+ case "none":
753
+ default:
754
+ return { x: t, y: t };
755
+ }
756
+ }
734
757
  getRotation() {
735
758
  return this.rotationKeyframeBuilder?.getValue(this.getPlaybackTime()) ?? 0;
736
759
  }
@@ -741,7 +764,7 @@ class D extends ot {
741
764
  return this.getPlaybackTime() < D.DiscardedFrameCount;
742
765
  }
743
766
  onPointerStart(t) {
744
- if (t.button !== vi.ButtonLeftClick || (this.edit.events.emit("canvas:clip:clicked", { player: this }), this.initialClipConfiguration = structuredClone(this.clipConfiguration), this.clipHasKeyframes()))
767
+ if (t.button !== Ci.ButtonLeftClick || (this.edit.events.emit("canvas:clip:clicked", { player: this }), this.initialClipConfiguration = structuredClone(this.clipConfiguration), this.clipHasKeyframes()))
745
768
  return;
746
769
  if (this.scaleDirection = null, this.topLeftScaleHandle?.getBounds().containsPoint(t.globalX, t.globalY) && (this.scaleDirection = "topLeft"), this.topRightScaleHandle?.getBounds().containsPoint(t.globalX, t.globalY) && (this.scaleDirection = "topRight"), this.bottomRightScaleHandle?.getBounds().containsPoint(t.globalX, t.globalY) && (this.scaleDirection = "bottomRight"), this.bottomLeftScaleHandle?.getBounds().containsPoint(t.globalX, t.globalY) && (this.scaleDirection = "bottomLeft"), this.scaleDirection !== null) {
747
770
  this.scaleStart = this.getScale() / this.getFitScale();
@@ -788,12 +811,12 @@ class D extends ot {
788
811
  { x: n.x + this.getSize().width, y: n.y + this.getSize().height }
789
812
  ], h = { x: n.x + this.getSize().width / 2, y: n.y + this.getSize().height / 2 }, p = [...c, h];
790
813
  let f = D.SnapThreshold, y = D.SnapThreshold, S = null, b = null;
791
- for (const z of p)
814
+ for (const B of p)
792
815
  for (const it of l) {
793
- const $ = Math.abs(z.x - it.x);
794
- $ < f && (f = $, S = n.x + (it.x - z.x));
795
- const ft = Math.abs(z.y - it.y);
796
- ft < y && (y = ft, b = n.y + (it.y - z.y));
816
+ const $ = Math.abs(B.x - it.x);
817
+ $ < f && (f = $, S = n.x + (it.x - B.x));
818
+ const ft = Math.abs(B.y - it.y);
819
+ ft < y && (y = ft, b = n.y + (it.y - B.y));
797
820
  }
798
821
  S !== null && (n.x = S), b !== null && (n.y = b);
799
822
  const O = this.positionBuilder.absoluteToRelative(
@@ -1167,7 +1190,7 @@ ct(ee, "DEFAULT_OPTIONS", {
1167
1190
  });
1168
1191
  ct(ee, "MIN_SAMPLES", 1);
1169
1192
  ct(ee, "MAX_SAMPLES", 100);
1170
- let ve = ee;
1193
+ let Ce = ee;
1171
1194
  class _i extends D {
1172
1195
  background;
1173
1196
  text;
@@ -1202,7 +1225,7 @@ class _i extends D {
1202
1225
  x: o,
1203
1226
  y: l
1204
1227
  }, e.stroke.color && e.stroke.width) {
1205
- const c = new ve({
1228
+ const c = new Ce({
1206
1229
  thickness: e.stroke.width,
1207
1230
  color: e.stroke.color
1208
1231
  });
@@ -1385,7 +1408,7 @@ class Ei extends D {
1385
1408
  color: t.fill?.color ?? "#ffffff",
1386
1409
  alpha: t.fill?.opacity ?? 1
1387
1410
  }, n.fill(), t.stroke) {
1388
- const a = new ve({
1411
+ const a = new Ce({
1389
1412
  thickness: t.stroke.width,
1390
1413
  color: t.stroke.color
1391
1414
  });
@@ -1514,8 +1537,8 @@ class Et {
1514
1537
  let S = h;
1515
1538
  if (y !== "left") {
1516
1539
  const b = this.measureText(a, e), O = this.textElement.width;
1517
- let z = 0;
1518
- y === "center" ? z = (O - b) / 2 : y === "right" && (z = O - b), S = z + h;
1540
+ let B = 0;
1541
+ y === "center" ? B = (O - b) / 2 : y === "right" && (B = O - b), S = B + h;
1519
1542
  }
1520
1543
  this.pixelX = S;
1521
1544
  }
@@ -1837,7 +1860,7 @@ class Ai extends D {
1837
1860
  color: t.background.color,
1838
1861
  alpha: t.background.opacity
1839
1862
  }, this.background.rect(0, 0, t.width ?? this.edit.size.width, t.height ?? this.edit.size.height), this.background.fill()), this.text = new d.Text(t.text, this.createTextStyle(t)), this.positionText(t), t.stroke) {
1840
- const e = new ve({
1863
+ const e = new Ce({
1841
1864
  thickness: t.stroke.width,
1842
1865
  color: t.stroke.color
1843
1866
  });
@@ -2243,7 +2266,7 @@ class L {
2243
2266
  }
2244
2267
  const k = Object.freeze({
2245
2268
  status: "aborted"
2246
- }), St = (r) => ({ status: "dirty", value: r }), B = (r) => ({ status: "valid", value: r }), Ee = (r) => r.status === "aborted", Ae = (r) => r.status === "dirty", xt = (r) => r.status === "valid", Nt = (r) => typeof Promise < "u" && r instanceof Promise;
2269
+ }), St = (r) => ({ status: "dirty", value: r }), z = (r) => ({ status: "valid", value: r }), Ee = (r) => r.status === "aborted", Ae = (r) => r.status === "dirty", xt = (r) => r.status === "valid", Nt = (r) => typeof Promise < "u" && r instanceof Promise;
2247
2270
  function Vt(r, t, e, i) {
2248
2271
  if (typeof t == "function" ? r !== t || !0 : !t.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2249
2272
  return t.get(r);
@@ -2252,10 +2275,10 @@ function Ye(r, t, e, i, s) {
2252
2275
  if (typeof t == "function" ? r !== t || !0 : !t.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2253
2276
  return t.set(r, e), e;
2254
2277
  }
2255
- var C;
2278
+ var v;
2256
2279
  (function(r) {
2257
2280
  r.errToObj = (t) => typeof t == "string" ? { message: t } : t || {}, r.toString = (t) => typeof t == "string" ? t : t?.message;
2258
- })(C || (C = {}));
2281
+ })(v || (v = {}));
2259
2282
  var It, _t;
2260
2283
  class K {
2261
2284
  constructor(t, e, i, s) {
@@ -2512,7 +2535,7 @@ class w {
2512
2535
  return this.safeParse(null).success;
2513
2536
  }
2514
2537
  }
2515
- const Ri = /^c[^\s-]{8,}$/i, Li = /^[0-9a-z]+$/, Mi = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Hi = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Bi = /^[a-z0-9_-]{21}$/i, zi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fi = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ni = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Vi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
2538
+ const Ri = /^c[^\s-]{8,}$/i, Li = /^[0-9a-z]+$/, Mi = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Hi = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, zi = /^[a-z0-9_-]{21}$/i, Bi = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fi = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ni = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Vi = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
2516
2539
  let le;
2517
2540
  const Gi = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ui = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Zi = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Wi = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ki = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, $i = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Xe = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Yi = new RegExp(`^${Xe}$`);
2518
2541
  function je(r) {
@@ -2531,7 +2554,7 @@ function qi(r, t) {
2531
2554
  return !!((t === "v4" || !t) && Gi.test(r) || (t === "v6" || !t) && Zi.test(r));
2532
2555
  }
2533
2556
  function Qi(r, t) {
2534
- if (!zi.test(r))
2557
+ if (!Bi.test(r))
2535
2558
  return !1;
2536
2559
  try {
2537
2560
  const [e] = r.split("."), i = e.replace(/-/g, "+").replace(/_/g, "/").padEnd(e.length + (4 - e.length % 4) % 4, "="), s = JSON.parse(atob(i));
@@ -2610,7 +2633,7 @@ class q extends w {
2610
2633
  message: n.message
2611
2634
  }), i.dirty());
2612
2635
  else if (n.kind === "nanoid")
2613
- Bi.test(t.data) || (s = this._getOrReturnCtx(t, s), g(s, {
2636
+ zi.test(t.data) || (s = this._getOrReturnCtx(t, s), g(s, {
2614
2637
  validation: "nanoid",
2615
2638
  code: u.invalid_string,
2616
2639
  message: n.message
@@ -2702,7 +2725,7 @@ class q extends w {
2702
2725
  return this.refinement((s) => t.test(s), {
2703
2726
  validation: e,
2704
2727
  code: u.invalid_string,
2705
- ...C.errToObj(i)
2728
+ ...v.errToObj(i)
2706
2729
  });
2707
2730
  }
2708
2731
  _addCheck(t) {
@@ -2712,46 +2735,46 @@ class q extends w {
2712
2735
  });
2713
2736
  }
2714
2737
  email(t) {
2715
- return this._addCheck({ kind: "email", ...C.errToObj(t) });
2738
+ return this._addCheck({ kind: "email", ...v.errToObj(t) });
2716
2739
  }
2717
2740
  url(t) {
2718
- return this._addCheck({ kind: "url", ...C.errToObj(t) });
2741
+ return this._addCheck({ kind: "url", ...v.errToObj(t) });
2719
2742
  }
2720
2743
  emoji(t) {
2721
- return this._addCheck({ kind: "emoji", ...C.errToObj(t) });
2744
+ return this._addCheck({ kind: "emoji", ...v.errToObj(t) });
2722
2745
  }
2723
2746
  uuid(t) {
2724
- return this._addCheck({ kind: "uuid", ...C.errToObj(t) });
2747
+ return this._addCheck({ kind: "uuid", ...v.errToObj(t) });
2725
2748
  }
2726
2749
  nanoid(t) {
2727
- return this._addCheck({ kind: "nanoid", ...C.errToObj(t) });
2750
+ return this._addCheck({ kind: "nanoid", ...v.errToObj(t) });
2728
2751
  }
2729
2752
  cuid(t) {
2730
- return this._addCheck({ kind: "cuid", ...C.errToObj(t) });
2753
+ return this._addCheck({ kind: "cuid", ...v.errToObj(t) });
2731
2754
  }
2732
2755
  cuid2(t) {
2733
- return this._addCheck({ kind: "cuid2", ...C.errToObj(t) });
2756
+ return this._addCheck({ kind: "cuid2", ...v.errToObj(t) });
2734
2757
  }
2735
2758
  ulid(t) {
2736
- return this._addCheck({ kind: "ulid", ...C.errToObj(t) });
2759
+ return this._addCheck({ kind: "ulid", ...v.errToObj(t) });
2737
2760
  }
2738
2761
  base64(t) {
2739
- return this._addCheck({ kind: "base64", ...C.errToObj(t) });
2762
+ return this._addCheck({ kind: "base64", ...v.errToObj(t) });
2740
2763
  }
2741
2764
  base64url(t) {
2742
2765
  return this._addCheck({
2743
2766
  kind: "base64url",
2744
- ...C.errToObj(t)
2767
+ ...v.errToObj(t)
2745
2768
  });
2746
2769
  }
2747
2770
  jwt(t) {
2748
- return this._addCheck({ kind: "jwt", ...C.errToObj(t) });
2771
+ return this._addCheck({ kind: "jwt", ...v.errToObj(t) });
2749
2772
  }
2750
2773
  ip(t) {
2751
- return this._addCheck({ kind: "ip", ...C.errToObj(t) });
2774
+ return this._addCheck({ kind: "ip", ...v.errToObj(t) });
2752
2775
  }
2753
2776
  cidr(t) {
2754
- return this._addCheck({ kind: "cidr", ...C.errToObj(t) });
2777
+ return this._addCheck({ kind: "cidr", ...v.errToObj(t) });
2755
2778
  }
2756
2779
  datetime(t) {
2757
2780
  var e, i;
@@ -2766,7 +2789,7 @@ class q extends w {
2766
2789
  precision: typeof t?.precision > "u" ? null : t?.precision,
2767
2790
  offset: (e = t?.offset) !== null && e !== void 0 ? e : !1,
2768
2791
  local: (i = t?.local) !== null && i !== void 0 ? i : !1,
2769
- ...C.errToObj(t?.message)
2792
+ ...v.errToObj(t?.message)
2770
2793
  });
2771
2794
  }
2772
2795
  date(t) {
@@ -2780,17 +2803,17 @@ class q extends w {
2780
2803
  }) : this._addCheck({
2781
2804
  kind: "time",
2782
2805
  precision: typeof t?.precision > "u" ? null : t?.precision,
2783
- ...C.errToObj(t?.message)
2806
+ ...v.errToObj(t?.message)
2784
2807
  });
2785
2808
  }
2786
2809
  duration(t) {
2787
- return this._addCheck({ kind: "duration", ...C.errToObj(t) });
2810
+ return this._addCheck({ kind: "duration", ...v.errToObj(t) });
2788
2811
  }
2789
2812
  regex(t, e) {
2790
2813
  return this._addCheck({
2791
2814
  kind: "regex",
2792
2815
  regex: t,
2793
- ...C.errToObj(e)
2816
+ ...v.errToObj(e)
2794
2817
  });
2795
2818
  }
2796
2819
  includes(t, e) {
@@ -2798,49 +2821,49 @@ class q extends w {
2798
2821
  kind: "includes",
2799
2822
  value: t,
2800
2823
  position: e?.position,
2801
- ...C.errToObj(e?.message)
2824
+ ...v.errToObj(e?.message)
2802
2825
  });
2803
2826
  }
2804
2827
  startsWith(t, e) {
2805
2828
  return this._addCheck({
2806
2829
  kind: "startsWith",
2807
2830
  value: t,
2808
- ...C.errToObj(e)
2831
+ ...v.errToObj(e)
2809
2832
  });
2810
2833
  }
2811
2834
  endsWith(t, e) {
2812
2835
  return this._addCheck({
2813
2836
  kind: "endsWith",
2814
2837
  value: t,
2815
- ...C.errToObj(e)
2838
+ ...v.errToObj(e)
2816
2839
  });
2817
2840
  }
2818
2841
  min(t, e) {
2819
2842
  return this._addCheck({
2820
2843
  kind: "min",
2821
2844
  value: t,
2822
- ...C.errToObj(e)
2845
+ ...v.errToObj(e)
2823
2846
  });
2824
2847
  }
2825
2848
  max(t, e) {
2826
2849
  return this._addCheck({
2827
2850
  kind: "max",
2828
2851
  value: t,
2829
- ...C.errToObj(e)
2852
+ ...v.errToObj(e)
2830
2853
  });
2831
2854
  }
2832
2855
  length(t, e) {
2833
2856
  return this._addCheck({
2834
2857
  kind: "length",
2835
2858
  value: t,
2836
- ...C.errToObj(e)
2859
+ ...v.errToObj(e)
2837
2860
  });
2838
2861
  }
2839
2862
  /**
2840
2863
  * Equivalent to `.min(1)`
2841
2864
  */
2842
2865
  nonempty(t) {
2843
- return this.min(1, C.errToObj(t));
2866
+ return this.min(1, v.errToObj(t));
2844
2867
  }
2845
2868
  trim() {
2846
2869
  return new q({
@@ -2980,16 +3003,16 @@ class kt extends w {
2980
3003
  return { status: s.value, value: t.data };
2981
3004
  }
2982
3005
  gte(t, e) {
2983
- return this.setLimit("min", t, !0, C.toString(e));
3006
+ return this.setLimit("min", t, !0, v.toString(e));
2984
3007
  }
2985
3008
  gt(t, e) {
2986
- return this.setLimit("min", t, !1, C.toString(e));
3009
+ return this.setLimit("min", t, !1, v.toString(e));
2987
3010
  }
2988
3011
  lte(t, e) {
2989
- return this.setLimit("max", t, !0, C.toString(e));
3012
+ return this.setLimit("max", t, !0, v.toString(e));
2990
3013
  }
2991
3014
  lt(t, e) {
2992
- return this.setLimit("max", t, !1, C.toString(e));
3015
+ return this.setLimit("max", t, !1, v.toString(e));
2993
3016
  }
2994
3017
  setLimit(t, e, i, s) {
2995
3018
  return new kt({
@@ -3000,7 +3023,7 @@ class kt extends w {
3000
3023
  kind: t,
3001
3024
  value: e,
3002
3025
  inclusive: i,
3003
- message: C.toString(s)
3026
+ message: v.toString(s)
3004
3027
  }
3005
3028
  ]
3006
3029
  });
@@ -3014,7 +3037,7 @@ class kt extends w {
3014
3037
  int(t) {
3015
3038
  return this._addCheck({
3016
3039
  kind: "int",
3017
- message: C.toString(t)
3040
+ message: v.toString(t)
3018
3041
  });
3019
3042
  }
3020
3043
  positive(t) {
@@ -3022,7 +3045,7 @@ class kt extends w {
3022
3045
  kind: "min",
3023
3046
  value: 0,
3024
3047
  inclusive: !1,
3025
- message: C.toString(t)
3048
+ message: v.toString(t)
3026
3049
  });
3027
3050
  }
3028
3051
  negative(t) {
@@ -3030,7 +3053,7 @@ class kt extends w {
3030
3053
  kind: "max",
3031
3054
  value: 0,
3032
3055
  inclusive: !1,
3033
- message: C.toString(t)
3056
+ message: v.toString(t)
3034
3057
  });
3035
3058
  }
3036
3059
  nonpositive(t) {
@@ -3038,7 +3061,7 @@ class kt extends w {
3038
3061
  kind: "max",
3039
3062
  value: 0,
3040
3063
  inclusive: !0,
3041
- message: C.toString(t)
3064
+ message: v.toString(t)
3042
3065
  });
3043
3066
  }
3044
3067
  nonnegative(t) {
@@ -3046,20 +3069,20 @@ class kt extends w {
3046
3069
  kind: "min",
3047
3070
  value: 0,
3048
3071
  inclusive: !0,
3049
- message: C.toString(t)
3072
+ message: v.toString(t)
3050
3073
  });
3051
3074
  }
3052
3075
  multipleOf(t, e) {
3053
3076
  return this._addCheck({
3054
3077
  kind: "multipleOf",
3055
3078
  value: t,
3056
- message: C.toString(e)
3079
+ message: v.toString(e)
3057
3080
  });
3058
3081
  }
3059
3082
  finite(t) {
3060
3083
  return this._addCheck({
3061
3084
  kind: "finite",
3062
- message: C.toString(t)
3085
+ message: v.toString(t)
3063
3086
  });
3064
3087
  }
3065
3088
  safe(t) {
@@ -3067,12 +3090,12 @@ class kt extends w {
3067
3090
  kind: "min",
3068
3091
  inclusive: !0,
3069
3092
  value: Number.MIN_SAFE_INTEGER,
3070
- message: C.toString(t)
3093
+ message: v.toString(t)
3071
3094
  })._addCheck({
3072
3095
  kind: "max",
3073
3096
  inclusive: !0,
3074
3097
  value: Number.MAX_SAFE_INTEGER,
3075
- message: C.toString(t)
3098
+ message: v.toString(t)
3076
3099
  });
3077
3100
  }
3078
3101
  get minValue() {
@@ -3150,16 +3173,16 @@ class Tt extends w {
3150
3173
  }), k;
3151
3174
  }
3152
3175
  gte(t, e) {
3153
- return this.setLimit("min", t, !0, C.toString(e));
3176
+ return this.setLimit("min", t, !0, v.toString(e));
3154
3177
  }
3155
3178
  gt(t, e) {
3156
- return this.setLimit("min", t, !1, C.toString(e));
3179
+ return this.setLimit("min", t, !1, v.toString(e));
3157
3180
  }
3158
3181
  lte(t, e) {
3159
- return this.setLimit("max", t, !0, C.toString(e));
3182
+ return this.setLimit("max", t, !0, v.toString(e));
3160
3183
  }
3161
3184
  lt(t, e) {
3162
- return this.setLimit("max", t, !1, C.toString(e));
3185
+ return this.setLimit("max", t, !1, v.toString(e));
3163
3186
  }
3164
3187
  setLimit(t, e, i, s) {
3165
3188
  return new Tt({
@@ -3170,7 +3193,7 @@ class Tt extends w {
3170
3193
  kind: t,
3171
3194
  value: e,
3172
3195
  inclusive: i,
3173
- message: C.toString(s)
3196
+ message: v.toString(s)
3174
3197
  }
3175
3198
  ]
3176
3199
  });
@@ -3186,7 +3209,7 @@ class Tt extends w {
3186
3209
  kind: "min",
3187
3210
  value: BigInt(0),
3188
3211
  inclusive: !1,
3189
- message: C.toString(t)
3212
+ message: v.toString(t)
3190
3213
  });
3191
3214
  }
3192
3215
  negative(t) {
@@ -3194,7 +3217,7 @@ class Tt extends w {
3194
3217
  kind: "max",
3195
3218
  value: BigInt(0),
3196
3219
  inclusive: !1,
3197
- message: C.toString(t)
3220
+ message: v.toString(t)
3198
3221
  });
3199
3222
  }
3200
3223
  nonpositive(t) {
@@ -3202,7 +3225,7 @@ class Tt extends w {
3202
3225
  kind: "max",
3203
3226
  value: BigInt(0),
3204
3227
  inclusive: !0,
3205
- message: C.toString(t)
3228
+ message: v.toString(t)
3206
3229
  });
3207
3230
  }
3208
3231
  nonnegative(t) {
@@ -3210,14 +3233,14 @@ class Tt extends w {
3210
3233
  kind: "min",
3211
3234
  value: BigInt(0),
3212
3235
  inclusive: !0,
3213
- message: C.toString(t)
3236
+ message: v.toString(t)
3214
3237
  });
3215
3238
  }
3216
3239
  multipleOf(t, e) {
3217
3240
  return this._addCheck({
3218
3241
  kind: "multipleOf",
3219
3242
  value: t,
3220
- message: C.toString(e)
3243
+ message: v.toString(e)
3221
3244
  });
3222
3245
  }
3223
3246
  get minValue() {
@@ -3252,7 +3275,7 @@ class ue extends w {
3252
3275
  received: i.parsedType
3253
3276
  }), k;
3254
3277
  }
3255
- return B(t.data);
3278
+ return z(t.data);
3256
3279
  }
3257
3280
  }
3258
3281
  ue.create = (r) => new ue({
@@ -3309,14 +3332,14 @@ class Rt extends w {
3309
3332
  return this._addCheck({
3310
3333
  kind: "min",
3311
3334
  value: t.getTime(),
3312
- message: C.toString(e)
3335
+ message: v.toString(e)
3313
3336
  });
3314
3337
  }
3315
3338
  max(t, e) {
3316
3339
  return this._addCheck({
3317
3340
  kind: "max",
3318
3341
  value: t.getTime(),
3319
- message: C.toString(e)
3342
+ message: v.toString(e)
3320
3343
  });
3321
3344
  }
3322
3345
  get minDate() {
@@ -3348,7 +3371,7 @@ class pe extends w {
3348
3371
  received: i.parsedType
3349
3372
  }), k;
3350
3373
  }
3351
- return B(t.data);
3374
+ return z(t.data);
3352
3375
  }
3353
3376
  }
3354
3377
  pe.create = (r) => new pe({
@@ -3365,7 +3388,7 @@ class Gt extends w {
3365
3388
  received: i.parsedType
3366
3389
  }), k;
3367
3390
  }
3368
- return B(t.data);
3391
+ return z(t.data);
3369
3392
  }
3370
3393
  }
3371
3394
  Gt.create = (r) => new Gt({
@@ -3382,7 +3405,7 @@ class Ut extends w {
3382
3405
  received: i.parsedType
3383
3406
  }), k;
3384
3407
  }
3385
- return B(t.data);
3408
+ return z(t.data);
3386
3409
  }
3387
3410
  }
3388
3411
  Ut.create = (r) => new Ut({
@@ -3394,7 +3417,7 @@ class fe extends w {
3394
3417
  super(...arguments), this._any = !0;
3395
3418
  }
3396
3419
  _parse(t) {
3397
- return B(t.data);
3420
+ return z(t.data);
3398
3421
  }
3399
3422
  }
3400
3423
  fe.create = (r) => new fe({
@@ -3406,7 +3429,7 @@ class yt extends w {
3406
3429
  super(...arguments), this._unknown = !0;
3407
3430
  }
3408
3431
  _parse(t) {
3409
- return B(t.data);
3432
+ return z(t.data);
3410
3433
  }
3411
3434
  }
3412
3435
  yt.create = (r) => new yt({
@@ -3437,7 +3460,7 @@ class ge extends w {
3437
3460
  received: i.parsedType
3438
3461
  }), k;
3439
3462
  }
3440
- return B(t.data);
3463
+ return z(t.data);
3441
3464
  }
3442
3465
  }
3443
3466
  ge.create = (r) => new ge({
@@ -3490,19 +3513,19 @@ class W extends w {
3490
3513
  min(t, e) {
3491
3514
  return new W({
3492
3515
  ...this._def,
3493
- minLength: { value: t, message: C.toString(e) }
3516
+ minLength: { value: t, message: v.toString(e) }
3494
3517
  });
3495
3518
  }
3496
3519
  max(t, e) {
3497
3520
  return new W({
3498
3521
  ...this._def,
3499
- maxLength: { value: t, message: C.toString(e) }
3522
+ maxLength: { value: t, message: v.toString(e) }
3500
3523
  });
3501
3524
  }
3502
3525
  length(t, e) {
3503
3526
  return new W({
3504
3527
  ...this._def,
3505
- exactLength: { value: t, message: C.toString(e) }
3528
+ exactLength: { value: t, message: v.toString(e) }
3506
3529
  });
3507
3530
  }
3508
3531
  nonempty(t) {
@@ -3610,7 +3633,7 @@ class A extends w {
3610
3633
  return this._def.shape();
3611
3634
  }
3612
3635
  strict(t) {
3613
- return C.errToObj, new A({
3636
+ return v.errToObj, new A({
3614
3637
  ...this._def,
3615
3638
  unknownKeys: "strict",
3616
3639
  ...t !== void 0 ? {
@@ -3618,7 +3641,7 @@ class A extends w {
3618
3641
  var s, n, a, o;
3619
3642
  const l = (a = (n = (s = this._def).errorMap) === null || n === void 0 ? void 0 : n.call(s, e, i).message) !== null && a !== void 0 ? a : i.defaultError;
3620
3643
  return e.code === "unrecognized_keys" ? {
3621
- message: (o = C.errToObj(t).message) !== null && o !== void 0 ? o : l
3644
+ message: (o = v.errToObj(t).message) !== null && o !== void 0 ? o : l
3622
3645
  } : {
3623
3646
  message: l
3624
3647
  };
@@ -4200,13 +4223,13 @@ class wt extends w {
4200
4223
  min(t, e) {
4201
4224
  return new wt({
4202
4225
  ...this._def,
4203
- minSize: { value: t, message: C.toString(e) }
4226
+ minSize: { value: t, message: v.toString(e) }
4204
4227
  });
4205
4228
  }
4206
4229
  max(t, e) {
4207
4230
  return new wt({
4208
4231
  ...this._def,
4209
- maxSize: { value: t, message: C.toString(e) }
4232
+ maxSize: { value: t, message: v.toString(e) }
4210
4233
  });
4211
4234
  }
4212
4235
  size(t, e) {
@@ -4270,7 +4293,7 @@ class At extends w {
4270
4293
  const n = { errorMap: e.common.contextualErrorMap }, a = e.data;
4271
4294
  if (this._def.returns instanceof Lt) {
4272
4295
  const o = this;
4273
- return B(async function(...l) {
4296
+ return z(async function(...l) {
4274
4297
  const c = new N([]), h = await o._def.args.parseAsync(l, n).catch((y) => {
4275
4298
  throw c.addIssue(i(l, y)), c;
4276
4299
  }), p = await Reflect.apply(a, this, h);
@@ -4280,7 +4303,7 @@ class At extends w {
4280
4303
  });
4281
4304
  } else {
4282
4305
  const o = this;
4283
- return B(function(...l) {
4306
+ return z(function(...l) {
4284
4307
  const c = o._def.args.safeParse(l, n);
4285
4308
  if (!c.success)
4286
4309
  throw new N([i(l, c.error)]);
@@ -4387,7 +4410,7 @@ class ht extends w {
4387
4410
  options: i
4388
4411
  }), k;
4389
4412
  }
4390
- return B(t.data);
4413
+ return z(t.data);
4391
4414
  }
4392
4415
  get options() {
4393
4416
  return this._def.values;
@@ -4447,7 +4470,7 @@ class Xt extends w {
4447
4470
  options: s
4448
4471
  }), k;
4449
4472
  }
4450
- return B(t.data);
4473
+ return z(t.data);
4451
4474
  }
4452
4475
  get enum() {
4453
4476
  return this._def.values;
@@ -4472,7 +4495,7 @@ class Lt extends w {
4472
4495
  received: e.parsedType
4473
4496
  }), k;
4474
4497
  const i = e.parsedType === m.promise ? e.data : Promise.resolve(e.data);
4475
- return B(i.then((s) => this._def.type.parseAsync(s, {
4498
+ return z(i.then((s) => this._def.type.parseAsync(s, {
4476
4499
  path: e.path,
4477
4500
  errorMap: e.common.contextualErrorMap
4478
4501
  })));
@@ -4574,7 +4597,7 @@ et.createWithPreprocess = (r, t, e) => new et({
4574
4597
  });
4575
4598
  class J extends w {
4576
4599
  _parse(t) {
4577
- return this._getType(t) === m.undefined ? B(void 0) : this._def.innerType._parse(t);
4600
+ return this._getType(t) === m.undefined ? z(void 0) : this._def.innerType._parse(t);
4578
4601
  }
4579
4602
  unwrap() {
4580
4603
  return this._def.innerType;
@@ -4587,7 +4610,7 @@ J.create = (r, t) => new J({
4587
4610
  });
4588
4611
  class dt extends w {
4589
4612
  _parse(t) {
4590
- return this._getType(t) === m.null ? B(null) : this._def.innerType._parse(t);
4613
+ return this._getType(t) === m.null ? z(null) : this._def.innerType._parse(t);
4591
4614
  }
4592
4615
  unwrap() {
4593
4616
  return this._def.innerType;
@@ -4661,7 +4684,7 @@ qt.create = (r, t) => new qt({
4661
4684
  catchValue: typeof t.catch == "function" ? t.catch : () => t.catch,
4662
4685
  ...T(t)
4663
4686
  });
4664
- class Ce extends w {
4687
+ class ve extends w {
4665
4688
  _parse(t) {
4666
4689
  if (this._getType(t) !== m.nan) {
4667
4690
  const i = this._getOrReturnCtx(t);
@@ -4674,7 +4697,7 @@ class Ce extends w {
4674
4697
  return { status: "valid", value: t.data };
4675
4698
  }
4676
4699
  }
4677
- Ce.create = (r) => new Ce({
4700
+ ve.create = (r) => new ve({
4678
4701
  typeName: x.ZodNaN,
4679
4702
  ...T(r)
4680
4703
  });
@@ -4750,8 +4773,8 @@ var x;
4750
4773
  (function(r) {
4751
4774
  r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
4752
4775
  })(x || (x = {}));
4753
- const M = q.create, v = kt.create;
4754
- Ce.create;
4776
+ const M = q.create, C = kt.create;
4777
+ ve.create;
4755
4778
  Tt.create;
4756
4779
  ue.create;
4757
4780
  Rt.create;
@@ -4812,32 +4835,32 @@ const is = at(["linear", "bezier", "constant"]), ss = at([
4812
4835
  "easeInOutCirc",
4813
4836
  "easeInOutBack"
4814
4837
  ]), pt = P({
4815
- from: v(),
4816
- to: v(),
4817
- start: v().min(0),
4818
- length: v().positive(),
4838
+ from: C(),
4839
+ to: C(),
4840
+ start: C().min(0),
4841
+ length: C().positive(),
4819
4842
  interpolation: is.optional(),
4820
4843
  easing: ss.optional()
4821
4844
  }), ns = M().url("Invalid audio url format."), rs = pt.extend({
4822
- from: v().min(0).max(1),
4823
- to: v().min(0).max(1)
4824
- }).array().or(v().min(0).max(1)), De = P({
4845
+ from: C().min(0).max(1),
4846
+ to: C().min(0).max(1)
4847
+ }).array().or(C().min(0).max(1)), De = P({
4825
4848
  type: ut("audio"),
4826
4849
  src: ns,
4827
- trim: v().optional(),
4850
+ trim: C().optional(),
4828
4851
  volume: rs.optional()
4829
4852
  }), as = at(["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"]), Re = P({
4830
4853
  type: ut("html"),
4831
4854
  html: M(),
4832
4855
  css: M(),
4833
- width: v().positive().optional(),
4834
- height: v().positive().optional(),
4856
+ width: C().positive().optional(),
4857
+ height: C().positive().optional(),
4835
4858
  position: as.optional()
4836
4859
  }), os = M().url("Invalid image url format."), ls = P({
4837
- top: v().min(0).optional(),
4838
- right: v().min(0).optional(),
4839
- bottom: v().min(0).optional(),
4840
- left: v().min(0).optional()
4860
+ top: C().min(0).optional(),
4861
+ right: C().min(0).optional(),
4862
+ bottom: C().min(0).optional(),
4863
+ left: C().min(0).optional()
4841
4864
  }), Le = P({
4842
4865
  type: ut("image"),
4843
4866
  src: os,
@@ -4846,96 +4869,96 @@ const is = at(["linear", "bezier", "constant"]), ss = at([
4846
4869
  type: ut("luma"),
4847
4870
  src: cs
4848
4871
  }), Je = M().regex(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|transparent$/, "Invalid color format."), He = P({
4849
- width: v().positive(),
4850
- height: v().positive()
4851
- }), Be = P({
4852
- radius: v().positive()
4872
+ width: C().positive(),
4873
+ height: C().positive()
4853
4874
  }), ze = P({
4854
- length: v().positive(),
4855
- thickness: v().positive()
4875
+ radius: C().positive()
4876
+ }), Be = P({
4877
+ length: C().positive(),
4878
+ thickness: C().positive()
4856
4879
  }), hs = P({
4857
4880
  color: Je,
4858
- opacity: v().min(0).max(1)
4881
+ opacity: C().min(0).max(1)
4859
4882
  }), ds = P({
4860
4883
  color: Je,
4861
- width: v().positive()
4884
+ width: C().positive()
4862
4885
  }), Fe = P({
4863
4886
  type: ut("shape"),
4864
- width: v().positive().optional(),
4865
- height: v().positive().optional(),
4887
+ width: C().positive().optional(),
4888
+ height: C().positive().optional(),
4866
4889
  shape: at(["rectangle", "circle", "line"]),
4867
4890
  fill: hs.optional(),
4868
4891
  stroke: ds.optional(),
4869
4892
  rectangle: He.optional(),
4870
- circle: Be.optional(),
4871
- line: ze.optional()
4872
- }).refine((r) => r.shape === "rectangle" ? He.safeParse(r.rectangle) : r.shape === "circle" ? Be.safeParse(r.circle) : r.shape === "line" ? ze.safeParse(r.line) : !1), ke = M().regex(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|transparent$/, "Invalid color format."), us = P({
4893
+ circle: ze.optional(),
4894
+ line: Be.optional()
4895
+ }).refine((r) => r.shape === "rectangle" ? He.safeParse(r.rectangle) : r.shape === "circle" ? ze.safeParse(r.circle) : r.shape === "line" ? Be.safeParse(r.line) : !1), ke = M().regex(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|transparent$/, "Invalid color format."), us = P({
4873
4896
  color: ke.optional(),
4874
4897
  family: M().optional(),
4875
- size: v().positive().optional(),
4876
- weight: v().optional(),
4877
- lineHeight: v().optional()
4898
+ size: C().positive().optional(),
4899
+ weight: C().optional(),
4900
+ lineHeight: C().optional()
4878
4901
  }), ps = P({
4879
4902
  horizontal: at(["left", "center", "right"]).optional(),
4880
4903
  vertical: at(["top", "center", "bottom"]).optional()
4881
4904
  }), fs = P({
4882
4905
  color: ke,
4883
- opacity: v().min(0).max(1)
4906
+ opacity: C().min(0).max(1)
4884
4907
  }), gs = P({
4885
- width: v().positive(),
4908
+ width: C().positive(),
4886
4909
  color: ke
4887
4910
  }), Ne = P({
4888
4911
  type: ut("text"),
4889
4912
  text: M(),
4890
- width: v().positive().optional(),
4891
- height: v().positive().optional(),
4913
+ width: C().positive().optional(),
4914
+ height: C().positive().optional(),
4892
4915
  font: us.optional(),
4893
4916
  alignment: ps.optional(),
4894
4917
  background: fs.optional(),
4895
4918
  stroke: gs.optional()
4896
4919
  }), ms = M().url("Invalid video url format."), ys = P({
4897
- top: v().min(0).optional(),
4898
- right: v().min(0).optional(),
4899
- bottom: v().min(0).optional(),
4900
- left: v().min(0).optional()
4901
- }), Cs = pt.extend({
4902
- from: v().min(0).max(1),
4903
- to: v().min(0).max(1)
4904
- }).array().or(v().min(0).max(1)), Ve = P({
4920
+ top: C().min(0).optional(),
4921
+ right: C().min(0).optional(),
4922
+ bottom: C().min(0).optional(),
4923
+ left: C().min(0).optional()
4924
+ }), vs = pt.extend({
4925
+ from: C().min(0).max(1),
4926
+ to: C().min(0).max(1)
4927
+ }).array().or(C().min(0).max(1)), Ve = P({
4905
4928
  type: ut("video"),
4906
4929
  src: ms,
4907
- trim: v().optional(),
4930
+ trim: C().optional(),
4908
4931
  crop: ys.optional(),
4909
- volume: Cs.optional()
4910
- }), vs = es([Ne, Fe, Re, Le, Ve, Me, De]).refine((r) => r.type === "text" ? Ne.safeParse(r) : r.type === "shape" ? Fe.safeParse(r) : r.type === "html" ? Re.safeParse(r) : r.type === "image" ? Le.safeParse(r) : r.type === "video" ? Ve.safeParse(r) : r.type === "luma" ? Me.safeParse(r) : r.type === "audio" ? De.safeParse(r) : !1), xs = at(["topLeft", "top", "topRight", "left", "center", "right", "bottomLeft", "bottom", "bottomRight"]), ks = at(["crop", "cover", "contain", "none"]), Ct = v().min(-10).max(10).default(0), Ts = pt.extend({
4911
- from: Ct,
4912
- to: Ct
4913
- }).array().or(Ct), ws = pt.extend({
4914
- from: Ct,
4915
- to: Ct
4916
- }).array().or(Ct), bs = P({
4932
+ volume: vs.optional()
4933
+ }), Cs = es([Ne, Fe, Re, Le, Ve, Me, De]).refine((r) => r.type === "text" ? Ne.safeParse(r) : r.type === "shape" ? Fe.safeParse(r) : r.type === "html" ? Re.safeParse(r) : r.type === "image" ? Le.safeParse(r) : r.type === "video" ? Ve.safeParse(r) : r.type === "luma" ? Me.safeParse(r) : r.type === "audio" ? De.safeParse(r) : !1), xs = at(["topLeft", "top", "topRight", "left", "center", "right", "bottomLeft", "bottom", "bottomRight"]), ks = at(["crop", "cover", "contain", "none"]), vt = C().min(-10).max(10).default(0), Ts = pt.extend({
4934
+ from: vt,
4935
+ to: vt
4936
+ }).array().or(vt), ws = pt.extend({
4937
+ from: vt,
4938
+ to: vt
4939
+ }).array().or(vt), bs = P({
4917
4940
  x: Ts.default(0),
4918
4941
  y: ws.default(0)
4919
4942
  }), Ss = pt.extend({
4920
- from: v().min(0).max(1),
4921
- to: v().min(0).max(1)
4922
- }).array().or(v().min(0).max(1)), Is = pt.extend({
4923
- from: v().min(0),
4924
- to: v().min(0)
4925
- }).array().or(v().min(0)), _s = P({
4943
+ from: C().min(0).max(1),
4944
+ to: C().min(0).max(1)
4945
+ }).array().or(C().min(0).max(1)), Is = pt.extend({
4946
+ from: C().min(0),
4947
+ to: C().min(0)
4948
+ }).array().or(C().min(0)), _s = P({
4926
4949
  angle: pt.extend({
4927
- from: v(),
4928
- to: v()
4929
- }).array().or(v())
4950
+ from: C(),
4951
+ to: C()
4952
+ }).array().or(C())
4930
4953
  }), Ps = M(), Ge = M(), Es = P({
4931
4954
  in: Ge.optional(),
4932
4955
  out: Ge.optional()
4933
4956
  }), As = P({
4934
4957
  rotate: _s.default({ angle: 0 })
4935
4958
  }), ti = P({
4936
- asset: vs,
4937
- start: v().min(0),
4938
- length: v().positive(),
4959
+ asset: Cs,
4960
+ start: C().min(0),
4961
+ length: C().positive(),
4939
4962
  position: xs.default("center").optional(),
4940
4963
  fit: ks.default("crop").optional(),
4941
4964
  offset: bs.default({ x: 0, y: 0 }).optional(),
@@ -5122,7 +5145,7 @@ class Hs {
5122
5145
  });
5123
5146
  }
5124
5147
  }
5125
- class Bs {
5148
+ class zs {
5126
5149
  constructor(t, e, i) {
5127
5150
  this.trackIndex = t, this.clipIndex = e, this.splitTime = i;
5128
5151
  }
@@ -5186,7 +5209,7 @@ class Bs {
5186
5209
  }
5187
5210
  }
5188
5211
  }
5189
- class zs {
5212
+ class Bs {
5190
5213
  constructor(t, e, i) {
5191
5214
  this.clip = t, this.newText = e, this.initialConfig = i;
5192
5215
  const { asset: s } = this.clip.clipConfiguration;
@@ -5379,10 +5402,10 @@ const Ns = P({
5379
5402
  tracks: Ns.array()
5380
5403
  }), Zs = P({
5381
5404
  size: P({
5382
- width: v().positive(),
5383
- height: v().positive()
5405
+ width: C().positive(),
5406
+ height: C().positive()
5384
5407
  }),
5385
- fps: v().positive().optional(),
5408
+ fps: C().positive().optional(),
5386
5409
  format: M()
5387
5410
  }), Ws = P({
5388
5411
  timeline: Us,
@@ -5410,6 +5433,8 @@ class Pt extends ot {
5410
5433
  selectedClip;
5411
5434
  /** @internal */
5412
5435
  updatedClip;
5436
+ /** @internal */
5437
+ viewportMask;
5413
5438
  constructor(t, e = "#ffffff") {
5414
5439
  super(), this.assetLoader = new Jt(), this.edit = null, this.tracks = [], this.clipsToDispose = [], this.clips = [], this.events = new Mt(), this.size = t, this.playbackTime = 0, this.totalDuration = 0, this.isPlaying = !1, this.selectedClip = null, this.updatedClip = null, this.backgroundColor = e, this.setupIntentListeners();
5415
5440
  }
@@ -5417,7 +5442,7 @@ class Pt extends ot {
5417
5442
  const t = new d.Graphics();
5418
5443
  t.fillStyle = {
5419
5444
  color: this.backgroundColor
5420
- }, t.rect(0, 0, this.size.width, this.size.height), t.fill(), this.getContainer().addChild(t);
5445
+ }, t.rect(0, 0, this.size.width, this.size.height), t.fill(), this.getContainer().addChild(t), this.viewportMask = new d.Graphics(), this.viewportMask.rect(0, 0, this.size.width, this.size.height), this.viewportMask.fill(16777215), this.getContainer().addChild(this.viewportMask), this.getContainer().setMask({ mask: this.viewportMask });
5421
5446
  }
5422
5447
  /** @internal */
5423
5448
  update(t, e) {
@@ -5432,7 +5457,13 @@ class Pt extends ot {
5432
5457
  }
5433
5458
  /** @internal */
5434
5459
  dispose() {
5435
- this.clearClips();
5460
+ if (this.clearClips(), this.viewportMask) {
5461
+ try {
5462
+ this.getContainer().setMask(null);
5463
+ } catch {
5464
+ }
5465
+ this.viewportMask.destroy(), this.viewportMask = void 0;
5466
+ }
5436
5467
  }
5437
5468
  play() {
5438
5469
  this.isPlaying = !0, this.events.emit("playback:play", {});
@@ -5488,7 +5519,7 @@ class Pt extends ot {
5488
5519
  this.executeCommand(i);
5489
5520
  }
5490
5521
  splitClip(t, e, i) {
5491
- const s = new Bs(t, e, i);
5522
+ const s = new zs(t, e, i);
5492
5523
  this.executeCommand(s);
5493
5524
  }
5494
5525
  addTrack(t, e) {
@@ -5531,7 +5562,7 @@ class Pt extends ot {
5531
5562
  }
5532
5563
  /** @internal */
5533
5564
  updateTextContent(t, e, i) {
5534
- const s = new zs(t, e, i);
5565
+ const s = new Bs(t, e, i);
5535
5566
  this.executeCommand(s);
5536
5567
  }
5537
5568
  executeEditCommand(t) {
@@ -5998,7 +6029,7 @@ class Tn {
5998
6029
  n.visible = !1;
5999
6030
  const p = this.createProgressOverlay();
6000
6031
  try {
6001
- const f = this.edit.getSize ? this.edit.getSize() : { width: 1920, height: 1080 }, y = Math.ceil(this.edit.totalDuration * e / 1e3), S = 1e3 / e, b = 100, O = 50, z = 50, it = (_) => Math.round(_ / y * O);
6032
+ const f = this.edit.getSize ? this.edit.getSize() : { width: 1920, height: 1080 }, y = Math.ceil(this.edit.totalDuration * e / 1e3), S = 1e3 / e, b = 100, O = 50, B = 50, it = (_) => Math.round(_ / y * O);
6002
6033
  this.updateProgressOverlay(p, 0, b);
6003
6034
  const $ = document.createElement("canvas");
6004
6035
  $.width = f.width, $.height = f.height;
@@ -6061,12 +6092,12 @@ class Tn {
6061
6092
  if (V?.[1]) {
6062
6093
  const H = parseInt(V[1], 10);
6063
6094
  if (!Number.isNaN(H) && H > Te && (Te = H, H <= y)) {
6064
- const X = Math.round(H / y * z);
6095
+ const X = Math.round(H / y * B);
6065
6096
  this.updateProgressOverlay(p, O + X, b);
6066
6097
  }
6067
6098
  }
6068
6099
  };
6069
- this.ffmpeg.on("log", we), await this.ffmpeg.exec(st), this.ffmpeg.off("log", we), this.updateProgressOverlay(p, O + z, b);
6100
+ this.ffmpeg.on("log", we), await this.ffmpeg.exec(st), this.ffmpeg.off("log", we), this.updateProgressOverlay(p, O + B, b);
6070
6101
  const ae = await this.ffmpeg.readFile(re), ai = ae instanceof Uint8Array ? ae : new TextEncoder().encode(ae.toString()), oi = new Blob([ai], { type: "video/mp4" }), be = URL.createObjectURL(oi), oe = document.createElement("a");
6071
6102
  oe.href = be, oe.download = t, oe.click(), URL.revokeObjectURL(be);
6072
6103
  for (let _ = 0; _ < y; _ += 1)
@@ -6752,8 +6783,8 @@ class Js {
6752
6783
  [
6753
6784
  { time: S, aligns: [t, a] },
6754
6785
  { time: b, aligns: [t, a] }
6755
- ].forEach(({ time: O, aligns: z }) => {
6756
- z.some((it) => Math.abs(it - O) < 0.1) && (o.has(O) || o.set(O, { tracks: /* @__PURE__ */ new Set(), isPlayhead: !1 }), o.get(O).tracks.add(h));
6786
+ ].forEach(({ time: O, aligns: B }) => {
6787
+ B.some((it) => Math.abs(it - O) < 0.1) && (o.has(O) || o.set(O, { tracks: /* @__PURE__ */ new Set(), isPlayhead: !1 }), o.get(O).tracks.add(h));
6757
6788
  });
6758
6789
  });
6759
6790
  });
@@ -7086,18 +7117,18 @@ const F = {
7086
7117
  TRACK_PADDING: 2,
7087
7118
  MIN_CLIP_WIDTH: 50
7088
7119
  };
7089
- function Bt(r) {
7120
+ function zt(r) {
7090
7121
  const t = r.split("/");
7091
7122
  return t[t.length - 1] || r;
7092
7123
  }
7093
7124
  function rn(r) {
7094
7125
  switch (r.type) {
7095
7126
  case "video":
7096
- return r.src ? Bt(r.src) : "Video";
7127
+ return r.src ? zt(r.src) : "Video";
7097
7128
  case "audio":
7098
- return r.src ? Bt(r.src) : "Audio";
7129
+ return r.src ? zt(r.src) : "Audio";
7099
7130
  case "image":
7100
- return r.src ? Bt(r.src) : "Image";
7131
+ return r.src ? zt(r.src) : "Image";
7101
7132
  case "text":
7102
7133
  return r.text || "Text";
7103
7134
  case "shape":
@@ -7105,7 +7136,7 @@ function rn(r) {
7105
7136
  case "html":
7106
7137
  return "HTML";
7107
7138
  case "luma":
7108
- return r.src ? Bt(r.src) : "Luma";
7139
+ return r.src ? zt(r.src) : "Luma";
7109
7140
  default:
7110
7141
  return "Unknown Asset";
7111
7142
  }
@@ -7689,7 +7720,7 @@ class dn {
7689
7720
  this.animationFrameId !== null && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null), this.app && this.app.destroy(!0);
7690
7721
  }
7691
7722
  }
7692
- const vt = {
7723
+ const Ct = {
7693
7724
  RULER: {
7694
7725
  DEFAULT_HEIGHT: 40,
7695
7726
  LABEL_FONT_SIZE: 10,
@@ -7714,7 +7745,7 @@ class We extends ot {
7714
7745
  rulerHeight;
7715
7746
  theme;
7716
7747
  constructor(t) {
7717
- super(), this.events = new Mt(), this.pixelsPerSecond = t.pixelsPerSecond, this.timelineDuration = t.timelineDuration, this.rulerHeight = t.rulerHeight ?? vt.RULER.DEFAULT_HEIGHT, this.theme = t.theme, this.rulerContainer = new d.Container(), this.rulerBackground = new d.Graphics(), this.timeMarkers = new d.Graphics(), this.timeLabels = new d.Container();
7748
+ super(), this.events = new Mt(), this.pixelsPerSecond = t.pixelsPerSecond, this.timelineDuration = t.timelineDuration, this.rulerHeight = t.rulerHeight ?? Ct.RULER.DEFAULT_HEIGHT, this.theme = t.theme, this.rulerContainer = new d.Container(), this.rulerBackground = new d.Graphics(), this.timeMarkers = new d.Graphics(), this.timeLabels = new d.Container();
7718
7749
  }
7719
7750
  async load() {
7720
7751
  this.setupRuler(), this.draw();
@@ -7745,7 +7776,7 @@ class We extends ot {
7745
7776
  drawTimeLabels() {
7746
7777
  this.timeLabels.removeChildren();
7747
7778
  const t = this.getTimeInterval(), e = this.getVisibleDuration(), i = this.theme?.timeline.ruler.text || 16777215, s = {
7748
- fontSize: vt.RULER.LABEL_FONT_SIZE,
7779
+ fontSize: Ct.RULER.LABEL_FONT_SIZE,
7749
7780
  fill: i,
7750
7781
  fontFamily: "Arial"
7751
7782
  };
@@ -7754,7 +7785,7 @@ class We extends ot {
7754
7785
  text: this.formatTime(n),
7755
7786
  style: s
7756
7787
  }), o = n * this.pixelsPerSecond;
7757
- n === 0 ? (a.anchor.set(0, 0.5), a.x = o + vt.RULER.LABEL_PADDING_X) : (a.anchor.set(0.5, 0.5), a.x = o), a.y = this.rulerHeight * 0.5, this.timeLabels.addChild(a);
7788
+ n === 0 ? (a.anchor.set(0, 0.5), a.x = o + Ct.RULER.LABEL_PADDING_X) : (a.anchor.set(0.5, 0.5), a.x = o), a.y = this.rulerHeight * 0.5, this.timeLabels.addChild(a);
7758
7789
  }
7759
7790
  }
7760
7791
  onRulerPointerDown(t) {
@@ -7816,7 +7847,7 @@ class Ke extends ot {
7816
7847
  }
7817
7848
  /** @internal */
7818
7849
  drawPlayhead() {
7819
- const t = this.currentTime * this.options.pixelsPerSecond, e = this.options.theme?.timeline.playhead ?? 16729156, i = vt.PLAYHEAD.LINE_WIDTH, s = t + i / 2;
7850
+ const t = this.currentTime * this.options.pixelsPerSecond, e = this.options.theme?.timeline.playhead ?? 16729156, i = Ct.PLAYHEAD.LINE_WIDTH, s = t + i / 2;
7820
7851
  this.graphics.clear(), this.graphics.fill(e), this.graphics.rect(t, 0, i, this.options.timelineHeight);
7821
7852
  const n = 8;
7822
7853
  this.graphics.moveTo(s, 10), this.graphics.lineTo(s - n, 0), this.graphics.lineTo(s + n, 0), this.graphics.closePath(), this.graphics.fill();
@@ -7909,7 +7940,7 @@ class un {
7909
7940
  handleScroll(t) {
7910
7941
  let { deltaX: e } = t, { deltaY: i } = t;
7911
7942
  t.shiftKey && (e = i, i = 0);
7912
- const s = vt.SCROLL.HORIZONTAL_SPEED, n = vt.SCROLL.VERTICAL_SPEED;
7943
+ const s = Ct.SCROLL.HORIZONTAL_SPEED, n = Ct.SCROLL.VERTICAL_SPEED;
7913
7944
  this.scrollX += e * s, this.scrollY += i * n, this.scrollX = this.clampScrollX(this.scrollX), this.scrollY = this.clampScrollY(this.scrollY), this.timeline.setScroll(this.scrollX, this.scrollY), this.events.emit("scroll", { x: this.scrollX, y: this.scrollY });
7914
7945
  }
7915
7946
  setScroll(t, e) {
@@ -7996,7 +8027,7 @@ const E = {
7996
8027
  ACTIVE_ANIMATION_ALPHA: 0.3,
7997
8028
  DIVIDER_ALPHA: 0.5
7998
8029
  };
7999
- class zt {
8030
+ class Bt {
8000
8031
  static createIcon(t, e, i) {
8001
8032
  const s = i ? i / E.BUTTON_SIZE : 1;
8002
8033
  switch (t) {
@@ -8049,7 +8080,7 @@ class $e extends d.Container {
8049
8080
  constructor(t) {
8050
8081
  super(), this.size = t.size || E.BUTTON_SIZE, this.theme = t.theme, this.onClick = t.onClick, this.eventMode = "static", this.cursor = "pointer", this.background = new d.Graphics(), this.addChild(this.background), this.hoverBackground = new d.Graphics(), this.addChild(this.hoverBackground);
8051
8082
  const i = this.size * 0.6, s = (this.size - i) / 2;
8052
- t.iconType && (this.icon = zt.createIcon(t.iconType, this.theme, i), this.icon.position.set(s, s), this.addChild(this.icon)), t.alternateIconType && (this.alternateIcon = zt.createIcon(t.alternateIconType, this.theme, i), this.alternateIcon.position.set(s, s), this.alternateIcon.visible = !1, this.addChild(this.alternateIcon)), this.setupEventListeners(), this.updateVisuals();
8083
+ t.iconType && (this.icon = Bt.createIcon(t.iconType, this.theme, i), this.icon.position.set(s, s), this.addChild(this.icon)), t.alternateIconType && (this.alternateIcon = Bt.createIcon(t.alternateIconType, this.theme, i), this.alternateIcon.position.set(s, s), this.alternateIcon.visible = !1, this.addChild(this.alternateIcon)), this.setupEventListeners(), this.updateVisuals();
8053
8084
  }
8054
8085
  setupEventListeners() {
8055
8086
  this.on("pointerdown", this.handlePointerDown, this), this.on("pointerup", this.handlePointerUp, this), this.on("pointerupoutside", this.handlePointerUp, this), this.on("pointerover", this.handlePointerOver, this), this.on("pointerout", this.handlePointerOut, this);
@@ -8090,11 +8121,11 @@ class $e extends d.Container {
8090
8121
  const i = this.size * 0.6, s = (this.size - i) / 2;
8091
8122
  if (this.icon) {
8092
8123
  const n = this.getIconType(this.icon);
8093
- n && (this.removeChild(this.icon), this.icon = zt.createIcon(n, t, i), this.icon.position.set(s, s), this.addChild(this.icon));
8124
+ n && (this.removeChild(this.icon), this.icon = Bt.createIcon(n, t, i), this.icon.position.set(s, s), this.addChild(this.icon));
8094
8125
  }
8095
8126
  if (this.alternateIcon) {
8096
8127
  const n = this.getIconType(this.alternateIcon);
8097
- n && (this.removeChild(this.alternateIcon), this.alternateIcon = zt.createIcon(n, t, i), this.alternateIcon.position.set(s, s), this.alternateIcon.visible = this.state.isActive, this.addChild(this.alternateIcon));
8128
+ n && (this.removeChild(this.alternateIcon), this.alternateIcon = Bt.createIcon(n, t, i), this.alternateIcon.position.set(s, s), this.alternateIcon.visible = this.state.isActive, this.addChild(this.alternateIcon));
8098
8129
  }
8099
8130
  this.updateVisuals();
8100
8131
  }
@@ -8379,7 +8410,7 @@ class yn extends d.Container {
8379
8410
  this.edit.events.off("clip:selected", this.updateEditControls), this.edit.events.off("selection:cleared", this.updateEditControls), this.playbackControls.destroy(), this.timeDisplay.destroy(), this.editControls.destroy(), super.destroy();
8380
8411
  }
8381
8412
  }
8382
- class Cn {
8413
+ class vn {
8383
8414
  constructor(t, e, i, s, n, a) {
8384
8415
  this.edit = t, this.layout = e, this.renderer = i, this.viewportManager = s, this.eventHandler = n, this.getTimelineContext = a;
8385
8416
  }
@@ -8747,7 +8778,7 @@ class ri extends ot {
8747
8778
  () => this.optionsManager.getPixelsPerSecond(),
8748
8779
  () => this.optionsManager.getTrackHeight(),
8749
8780
  () => this.visualTrackManager.getVisualTracks()
8750
- ), this.featureManager = new Cn(this.edit, this.layout, this.renderer, this.viewportManager, this.eventHandler, () => this);
8781
+ ), this.featureManager = new vn(this.edit, this.layout, this.renderer, this.viewportManager, this.eventHandler, () => this);
8751
8782
  }
8752
8783
  async setupTimelineFeatures() {
8753
8784
  const t = this.getExtendedTimelineDuration();