@twick/video-editor 0.14.20 → 0.15.0

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.mjs CHANGED
@@ -128,26 +128,28 @@ const p = () => g || (g = { document, window, isTouchSupported: "ontouchstart" i
128
128
  };
129
129
  const _ = new class {
130
130
  constructor() {
131
- t(this, "charWidthsCache", {}), t(this, "boundsOfCurveCache", {});
131
+ t(this, "boundsOfCurveCache", {}), this.charWidthsCache = /* @__PURE__ */ new Map();
132
132
  }
133
133
  getFontCache(t2) {
134
134
  let { fontFamily: e3, fontStyle: s2, fontWeight: i2 } = t2;
135
- e3 = e3.toLowerCase(), this.charWidthsCache[e3] || (this.charWidthsCache[e3] = {});
136
- const r2 = this.charWidthsCache[e3], n2 = "".concat(s2.toLowerCase(), "_").concat((i2 + "").toLowerCase());
137
- return r2[n2] || (r2[n2] = {}), r2[n2];
135
+ e3 = e3.toLowerCase();
136
+ const r2 = this.charWidthsCache;
137
+ r2.has(e3) || r2.set(e3, /* @__PURE__ */ new Map());
138
+ const n2 = r2.get(e3), o2 = "".concat(s2.toLowerCase(), "_").concat((i2 + "").toLowerCase());
139
+ return n2.has(o2) || n2.set(o2, /* @__PURE__ */ new Map()), n2.get(o2);
138
140
  }
139
141
  clearFontCache(t2) {
140
- (t2 = (t2 || "").toLowerCase()) ? this.charWidthsCache[t2] && delete this.charWidthsCache[t2] : this.charWidthsCache = {};
142
+ t2 ? this.charWidthsCache.delete((t2 || "").toLowerCase()) : this.charWidthsCache = /* @__PURE__ */ new Map();
141
143
  }
142
144
  limitDimsByArea(t2) {
143
145
  const { perfLimitSizeTotal: e3 } = o, s2 = Math.sqrt(e3 * t2);
144
146
  return [Math.floor(s2), Math.floor(e3 / s2)];
145
147
  }
146
148
  }();
147
- const x = "6.6.6";
149
+ const x = "6.9.1";
148
150
  function C() {
149
151
  }
150
- const b = Math.PI / 2, S = 2 * Math.PI, w = Math.PI / 180, T = Object.freeze([1, 0, 0, 1, 0, 0]), O = 16, k = 0.4477152502, D = "center", M = "left", P = "top", E = "bottom", A = "right", j = "none", F = /\r?\n/, L = "moving", R = "scaling", B = "rotating", I = "rotate", X = "skewing", Y = "resizing", W = "modifyPoly", V$1 = "modifyPath", z = "changed", G = "scale", H = "scaleX", N = "scaleY", U = "skewX", q = "skewY", K = "fill", J = "stroke", Q = "modified", Z = "json", $ = "svg";
152
+ const b = Math.PI / 2, S = 2 * Math.PI, w = Math.PI / 180, T = Object.freeze([1, 0, 0, 1, 0, 0]), O = 16, k = 0.4477152502, D = "center", M = "left", P = "top", E = "bottom", A = "right", j = "none", F = /\r?\n/, L = "moving", R = "scaling", I = "rotating", B = "rotate", X = "skewing", Y = "resizing", W = "modifyPoly", V$1 = "modifyPath", z = "changed", G = "scale", H = "scaleX", N = "scaleY", U = "skewX", q = "skewY", K = "fill", J = "stroke", Q = "modified", Z = "json", $ = "svg";
151
153
  const tt = new class {
152
154
  constructor() {
153
155
  this[Z] = /* @__PURE__ */ new Map(), this[$] = /* @__PURE__ */ new Map();
@@ -560,7 +562,7 @@ const Et = function(t2) {
560
562
  i2 && (r2 = Tt(r2, Pt({ angle: i2 })));
561
563
  const n2 = Lt(t2);
562
564
  return bt(n2) || (r2 = Tt(r2, n2)), r2;
563
- }, Bt = function(t2) {
565
+ }, It = function(t2) {
564
566
  let { signal: e3, crossOrigin: s2 = null } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
565
567
  return new Promise(function(i2, r2) {
566
568
  if (e3 && e3.aborted) return r2(new c("loadImage"));
@@ -576,7 +578,7 @@ const Et = function(t2) {
576
578
  o2 && (null == e3 || e3.removeEventListener("abort", o2)), r2(new h("Error loading ".concat(n2.src)));
577
579
  }, s2 && (n2.crossOrigin = s2), n2.src = t2) : a2();
578
580
  });
579
- }, It = function(t2) {
581
+ }, Bt = function(t2) {
580
582
  let { signal: e3, reviver: s2 = C } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
581
583
  return new Promise((i2, r2) => {
582
584
  const n2 = [];
@@ -593,7 +595,7 @@ const Et = function(t2) {
593
595
  return new Promise((s2, i2) => {
594
596
  const r2 = [];
595
597
  e3 && e3.addEventListener("abort", i2, { once: true });
596
- const n2 = Object.values(t2).map((t3) => t3 && t3.type && tt.has(t3.type) ? It([t3], { signal: e3 }).then((t4) => {
598
+ const n2 = Object.values(t2).map((t3) => t3 && t3.type && tt.has(t3.type) ? Bt([t3], { signal: e3 }).then((t4) => {
597
599
  let [e4] = t4;
598
600
  return r2.push(e4), e4;
599
601
  }) : t3), o2 = Object.keys(t2);
@@ -672,8 +674,8 @@ class te {
672
674
  p().dispose(this.lower.el), delete this.lower;
673
675
  }
674
676
  }
675
- const ee = { backgroundVpt: true, backgroundColor: "", overlayVpt: true, overlayColor: "", includeDefaultValues: true, svgViewportTransformation: true, renderOnAddRemove: true, skipOffscreen: true, enableRetinaScaling: true, imageSmoothingEnabled: true, controlsAboveOverlay: false, allowTouchScrolling: false, viewportTransform: [...T] };
676
- class se extends ct(lt) {
677
+ const ee = { backgroundVpt: true, backgroundColor: "", overlayVpt: true, overlayColor: "", includeDefaultValues: true, svgViewportTransformation: true, renderOnAddRemove: true, skipOffscreen: true, enableRetinaScaling: true, imageSmoothingEnabled: true, controlsAboveOverlay: false, allowTouchScrolling: false, viewportTransform: [...T] }, se = ["objects"];
678
+ class ie extends ct(lt) {
677
679
  get lowerCanvasEl() {
678
680
  var t2;
679
681
  return null === (t2 = this.elements.lower) || void 0 === t2 ? void 0 : t2.el;
@@ -683,7 +685,7 @@ class se extends ct(lt) {
683
685
  return null === (t2 = this.elements.lower) || void 0 === t2 ? void 0 : t2.ctx;
684
686
  }
685
687
  static getDefaults() {
686
- return se.ownDefaults;
688
+ return ie.ownDefaults;
687
689
  }
688
690
  constructor(t2) {
689
691
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
@@ -959,10 +961,10 @@ class se extends ct(lt) {
959
961
  loadFromJSON(t2, e3) {
960
962
  let { signal: s2 } = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
961
963
  if (!t2) return Promise.reject(new h("`json` is undefined"));
962
- const i2 = "string" == typeof t2 ? JSON.parse(t2) : t2, { objects: r2 = [], backgroundImage: n2, background: o2, overlayImage: a2, overlay: c2, clipPath: l2 } = i2, u2 = this.renderOnAddRemove;
963
- return this.renderOnAddRemove = false, Promise.all([It(r2, { reviver: e3, signal: s2 }), Xt({ backgroundImage: n2, backgroundColor: o2, overlayImage: a2, overlayColor: c2, clipPath: l2 }, { signal: s2 })]).then((t3) => {
964
+ const r2 = "string" == typeof t2 ? JSON.parse(t2) : t2, { objects: n2 = [] } = r2, o2 = i(r2, se), { backgroundImage: a2, background: c2, overlayImage: l2, overlay: u2, clipPath: d2 } = o2, g2 = this.renderOnAddRemove;
965
+ return this.renderOnAddRemove = false, Promise.all([Bt(n2, { reviver: e3, signal: s2 }), Xt({ backgroundImage: a2, backgroundColor: c2, overlayImage: l2, overlayColor: u2, clipPath: d2 }, { signal: s2 })]).then((t3) => {
964
966
  let [e4, s3] = t3;
965
- return this.clear(), this.add(...e4), this.set(i2), this.set(s3), this.renderOnAddRemove = u2, this;
967
+ return this.clear(), this.add(...e4), this.set(o2), this.set(s3), this.renderOnAddRemove = g2, this;
966
968
  });
967
969
  }
968
970
  clone(t2) {
@@ -1003,60 +1005,60 @@ class se extends ct(lt) {
1003
1005
  return "#<Canvas (".concat(this.complexity(), "): { objects: ").concat(this._objects.length, " }>");
1004
1006
  }
1005
1007
  }
1006
- t(se, "ownDefaults", ee);
1007
- const ie = ["touchstart", "touchmove", "touchend"];
1008
- const re = (t2) => {
1008
+ t(ie, "ownDefaults", ee);
1009
+ const re = ["touchstart", "touchmove", "touchend"];
1010
+ const ne = (t2) => {
1009
1011
  const e3 = qt(t2.target), s2 = function(t3) {
1010
1012
  const e4 = t3.changedTouches;
1011
1013
  return e4 && e4[0] ? e4[0] : t3;
1012
1014
  }(t2);
1013
1015
  return new ot(s2.clientX + e3.left, s2.clientY + e3.top);
1014
- }, ne = (t2) => ie.includes(t2.type) || "touch" === t2.pointerType, oe = (t2) => {
1016
+ }, oe = (t2) => re.includes(t2.type) || "touch" === t2.pointerType, ae = (t2) => {
1015
1017
  t2.preventDefault(), t2.stopPropagation();
1016
- }, ae = (t2) => {
1018
+ }, he = (t2) => {
1017
1019
  let e3 = 0, s2 = 0, i2 = 0, r2 = 0;
1018
1020
  for (let n2 = 0, o2 = t2.length; n2 < o2; n2++) {
1019
1021
  const { x: o3, y: a2 } = t2[n2];
1020
1022
  (o3 > i2 || !n2) && (i2 = o3), (o3 < e3 || !n2) && (e3 = o3), (a2 > r2 || !n2) && (r2 = a2), (a2 < s2 || !n2) && (s2 = a2);
1021
1023
  }
1022
1024
  return { left: e3, top: s2, width: i2 - e3, height: r2 - s2 };
1023
- }, he = ["translateX", "translateY", "scaleX", "scaleY"], ce = (t2, e3) => le(t2, Tt(e3, t2.calcOwnMatrix())), le = (t2, e3) => {
1024
- const s2 = Dt(e3), { translateX: r2, translateY: n2, scaleX: o2, scaleY: a2 } = s2, h2 = i(s2, he), c2 = new ot(r2, n2);
1025
+ }, ce = ["translateX", "translateY", "scaleX", "scaleY"], le = (t2, e3) => ue(t2, Tt(e3, t2.calcOwnMatrix())), ue = (t2, e3) => {
1026
+ const s2 = Dt(e3), { translateX: r2, translateY: n2, scaleX: o2, scaleY: a2 } = s2, h2 = i(s2, ce), c2 = new ot(r2, n2);
1025
1027
  t2.flipX = false, t2.flipY = false, Object.assign(t2, h2), t2.set({ scaleX: o2, scaleY: a2 }), t2.setPositionByOrigin(c2, D, D);
1026
- }, ue = (t2) => {
1028
+ }, de = (t2) => {
1027
1029
  t2.scaleX = 1, t2.scaleY = 1, t2.skewX = 0, t2.skewY = 0, t2.flipX = false, t2.flipY = false, t2.rotate(0);
1028
- }, de = (t2) => ({ scaleX: t2.scaleX, scaleY: t2.scaleY, skewX: t2.skewX, skewY: t2.skewY, angle: t2.angle, left: t2.left, flipX: t2.flipX, flipY: t2.flipY, top: t2.top }), ge = (t2, e3, s2) => {
1029
- const i2 = t2 / 2, r2 = e3 / 2, n2 = [new ot(-i2, -r2), new ot(i2, -r2), new ot(-i2, r2), new ot(i2, r2)].map((t3) => t3.transform(s2)), o2 = ae(n2);
1030
+ }, ge = (t2) => ({ scaleX: t2.scaleX, scaleY: t2.scaleY, skewX: t2.skewX, skewY: t2.skewY, angle: t2.angle, left: t2.left, flipX: t2.flipX, flipY: t2.flipY, top: t2.top }), fe = (t2, e3, s2) => {
1031
+ const i2 = t2 / 2, r2 = e3 / 2, n2 = [new ot(-i2, -r2), new ot(i2, -r2), new ot(-i2, r2), new ot(i2, r2)].map((t3) => t3.transform(s2)), o2 = he(n2);
1030
1032
  return new ot(o2.width, o2.height);
1031
- }, fe = function() {
1033
+ }, pe = function() {
1032
1034
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : T;
1033
1035
  return Tt(wt(arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : T), t2);
1034
- }, pe = function(t2) {
1035
- let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : T, s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : T;
1036
- return t2.transform(fe(e3, s2));
1037
1036
  }, me = function(t2) {
1038
1037
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : T, s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : T;
1039
- return t2.transform(fe(e3, s2), true);
1040
- }, ve = (t2, e3, s2) => {
1041
- const i2 = fe(e3, s2);
1042
- return le(t2, Tt(i2, t2.calcOwnMatrix())), i2;
1043
- }, ye = (t2, e3) => {
1038
+ return t2.transform(pe(e3, s2));
1039
+ }, ve = function(t2) {
1040
+ let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : T, s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : T;
1041
+ return t2.transform(pe(e3, s2), true);
1042
+ }, ye = (t2, e3, s2) => {
1043
+ const i2 = pe(e3, s2);
1044
+ return ue(t2, Tt(i2, t2.calcOwnMatrix())), i2;
1045
+ }, _e = (t2, e3) => {
1044
1046
  var i2;
1045
1047
  const { transform: { target: r2 } } = e3;
1046
1048
  null === (i2 = r2.canvas) || void 0 === i2 || i2.fire("object:".concat(t2), s(s({}, e3), {}, { target: r2 })), r2.fire(t2, e3);
1047
- }, _e = { left: -0.5, top: -0.5, center: 0, bottom: 0.5, right: 0.5 }, xe = (t2) => "string" == typeof t2 ? _e[t2] : t2 - 0.5, Ce = "not-allowed";
1048
- function be(t2) {
1049
- return xe(t2.originX) === xe(D) && xe(t2.originY) === xe(D);
1050
- }
1049
+ }, xe = { left: -0.5, top: -0.5, center: 0, bottom: 0.5, right: 0.5 }, Ce = (t2) => "string" == typeof t2 ? xe[t2] : t2 - 0.5, be = "not-allowed";
1051
1050
  function Se(t2) {
1052
- return 0.5 - xe(t2);
1051
+ return Ce(t2.originX) === Ce(D) && Ce(t2.originY) === Ce(D);
1053
1052
  }
1054
- const we = (t2, e3) => t2[e3], Te = (t2, e3, s2, i2) => ({ e: t2, transform: e3, pointer: new ot(s2, i2) });
1055
- function Oe(t2, e3) {
1053
+ function we(t2) {
1054
+ return 0.5 - Ce(t2);
1055
+ }
1056
+ const Te = (t2, e3) => t2[e3], Oe = (t2, e3, s2, i2) => ({ e: t2, transform: e3, pointer: new ot(s2, i2) });
1057
+ function ke(t2, e3) {
1056
1058
  const s2 = t2.getTotalAngle() + Ct(Math.atan2(e3.y, e3.x)) + 360;
1057
1059
  return Math.round(s2 % 360 / 45);
1058
1060
  }
1059
- function ke(t2, e3, s2, i2, r2) {
1061
+ function De(t2, e3, s2, i2, r2) {
1060
1062
  var n2;
1061
1063
  let { target: o2, corner: a2 } = t2;
1062
1064
  const h2 = o2.controls[a2], c2 = (null === (n2 = o2.canvas) || void 0 === n2 ? void 0 : n2.getZoom()) || 1, l2 = o2.padding / c2, u2 = function(t3, e4, s3, i3) {
@@ -1065,10 +1067,10 @@ function ke(t2, e3, s2, i2, r2) {
1065
1067
  }(o2, new ot(i2, r2), e3, s2);
1066
1068
  return u2.x >= l2 && (u2.x -= l2), u2.x <= -l2 && (u2.x += l2), u2.y >= l2 && (u2.y -= l2), u2.y <= l2 && (u2.y += l2), u2.x -= h2.offsetX, u2.y -= h2.offsetY, u2;
1067
1069
  }
1068
- const De = (t2, e3, s2, i2) => {
1069
- const { target: r2, offsetX: n2, offsetY: o2 } = e3, a2 = s2 - n2, h2 = i2 - o2, c2 = !we(r2, "lockMovementX") && r2.left !== a2, l2 = !we(r2, "lockMovementY") && r2.top !== h2;
1070
- return c2 && r2.set(M, a2), l2 && r2.set(P, h2), (c2 || l2) && ye(L, Te(t2, e3, s2, i2)), c2 || l2;
1071
- }, Me = { aliceblue: "#F0F8FF", antiquewhite: "#FAEBD7", aqua: "#0FF", aquamarine: "#7FFFD4", azure: "#F0FFFF", beige: "#F5F5DC", bisque: "#FFE4C4", black: "#000", blanchedalmond: "#FFEBCD", blue: "#00F", blueviolet: "#8A2BE2", brown: "#A52A2A", burlywood: "#DEB887", cadetblue: "#5F9EA0", chartreuse: "#7FFF00", chocolate: "#D2691E", coral: "#FF7F50", cornflowerblue: "#6495ED", cornsilk: "#FFF8DC", crimson: "#DC143C", cyan: "#0FF", darkblue: "#00008B", darkcyan: "#008B8B", darkgoldenrod: "#B8860B", darkgray: "#A9A9A9", darkgrey: "#A9A9A9", darkgreen: "#006400", darkkhaki: "#BDB76B", darkmagenta: "#8B008B", darkolivegreen: "#556B2F", darkorange: "#FF8C00", darkorchid: "#9932CC", darkred: "#8B0000", darksalmon: "#E9967A", darkseagreen: "#8FBC8F", darkslateblue: "#483D8B", darkslategray: "#2F4F4F", darkslategrey: "#2F4F4F", darkturquoise: "#00CED1", darkviolet: "#9400D3", deeppink: "#FF1493", deepskyblue: "#00BFFF", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1E90FF", firebrick: "#B22222", floralwhite: "#FFFAF0", forestgreen: "#228B22", fuchsia: "#F0F", gainsboro: "#DCDCDC", ghostwhite: "#F8F8FF", gold: "#FFD700", goldenrod: "#DAA520", gray: "#808080", grey: "#808080", green: "#008000", greenyellow: "#ADFF2F", honeydew: "#F0FFF0", hotpink: "#FF69B4", indianred: "#CD5C5C", indigo: "#4B0082", ivory: "#FFFFF0", khaki: "#F0E68C", lavender: "#E6E6FA", lavenderblush: "#FFF0F5", lawngreen: "#7CFC00", lemonchiffon: "#FFFACD", lightblue: "#ADD8E6", lightcoral: "#F08080", lightcyan: "#E0FFFF", lightgoldenrodyellow: "#FAFAD2", lightgray: "#D3D3D3", lightgrey: "#D3D3D3", lightgreen: "#90EE90", lightpink: "#FFB6C1", lightsalmon: "#FFA07A", lightseagreen: "#20B2AA", lightskyblue: "#87CEFA", lightslategray: "#789", lightslategrey: "#789", lightsteelblue: "#B0C4DE", lightyellow: "#FFFFE0", lime: "#0F0", limegreen: "#32CD32", linen: "#FAF0E6", magenta: "#F0F", maroon: "#800000", mediumaquamarine: "#66CDAA", mediumblue: "#0000CD", mediumorchid: "#BA55D3", mediumpurple: "#9370DB", mediumseagreen: "#3CB371", mediumslateblue: "#7B68EE", mediumspringgreen: "#00FA9A", mediumturquoise: "#48D1CC", mediumvioletred: "#C71585", midnightblue: "#191970", mintcream: "#F5FFFA", mistyrose: "#FFE4E1", moccasin: "#FFE4B5", navajowhite: "#FFDEAD", navy: "#000080", oldlace: "#FDF5E6", olive: "#808000", olivedrab: "#6B8E23", orange: "#FFA500", orangered: "#FF4500", orchid: "#DA70D6", palegoldenrod: "#EEE8AA", palegreen: "#98FB98", paleturquoise: "#AFEEEE", palevioletred: "#DB7093", papayawhip: "#FFEFD5", peachpuff: "#FFDAB9", peru: "#CD853F", pink: "#FFC0CB", plum: "#DDA0DD", powderblue: "#B0E0E6", purple: "#800080", rebeccapurple: "#639", red: "#F00", rosybrown: "#BC8F8F", royalblue: "#4169E1", saddlebrown: "#8B4513", salmon: "#FA8072", sandybrown: "#F4A460", seagreen: "#2E8B57", seashell: "#FFF5EE", sienna: "#A0522D", silver: "#C0C0C0", skyblue: "#87CEEB", slateblue: "#6A5ACD", slategray: "#708090", slategrey: "#708090", snow: "#FFFAFA", springgreen: "#00FF7F", steelblue: "#4682B4", tan: "#D2B48C", teal: "#008080", thistle: "#D8BFD8", tomato: "#FF6347", turquoise: "#40E0D0", violet: "#EE82EE", wheat: "#F5DEB3", white: "#FFF", whitesmoke: "#F5F5F5", yellow: "#FF0", yellowgreen: "#9ACD32" }, Pe = (t2, e3, s2) => (s2 < 0 && (s2 += 1), s2 > 1 && (s2 -= 1), s2 < 1 / 6 ? t2 + 6 * (e3 - t2) * s2 : s2 < 0.5 ? e3 : s2 < 2 / 3 ? t2 + (e3 - t2) * (2 / 3 - s2) * 6 : t2), Ee = (t2, e3, s2, i2) => {
1070
+ const Me = (t2, e3, s2, i2) => {
1071
+ const { target: r2, offsetX: n2, offsetY: o2 } = e3, a2 = s2 - n2, h2 = i2 - o2, c2 = !Te(r2, "lockMovementX") && r2.left !== a2, l2 = !Te(r2, "lockMovementY") && r2.top !== h2;
1072
+ return c2 && r2.set(M, a2), l2 && r2.set(P, h2), (c2 || l2) && _e(L, Oe(t2, e3, s2, i2)), c2 || l2;
1073
+ }, Pe = (t2) => t2.replace(/\s+/g, " "), Ee = { aliceblue: "#F0F8FF", antiquewhite: "#FAEBD7", aqua: "#0FF", aquamarine: "#7FFFD4", azure: "#F0FFFF", beige: "#F5F5DC", bisque: "#FFE4C4", black: "#000", blanchedalmond: "#FFEBCD", blue: "#00F", blueviolet: "#8A2BE2", brown: "#A52A2A", burlywood: "#DEB887", cadetblue: "#5F9EA0", chartreuse: "#7FFF00", chocolate: "#D2691E", coral: "#FF7F50", cornflowerblue: "#6495ED", cornsilk: "#FFF8DC", crimson: "#DC143C", cyan: "#0FF", darkblue: "#00008B", darkcyan: "#008B8B", darkgoldenrod: "#B8860B", darkgray: "#A9A9A9", darkgrey: "#A9A9A9", darkgreen: "#006400", darkkhaki: "#BDB76B", darkmagenta: "#8B008B", darkolivegreen: "#556B2F", darkorange: "#FF8C00", darkorchid: "#9932CC", darkred: "#8B0000", darksalmon: "#E9967A", darkseagreen: "#8FBC8F", darkslateblue: "#483D8B", darkslategray: "#2F4F4F", darkslategrey: "#2F4F4F", darkturquoise: "#00CED1", darkviolet: "#9400D3", deeppink: "#FF1493", deepskyblue: "#00BFFF", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1E90FF", firebrick: "#B22222", floralwhite: "#FFFAF0", forestgreen: "#228B22", fuchsia: "#F0F", gainsboro: "#DCDCDC", ghostwhite: "#F8F8FF", gold: "#FFD700", goldenrod: "#DAA520", gray: "#808080", grey: "#808080", green: "#008000", greenyellow: "#ADFF2F", honeydew: "#F0FFF0", hotpink: "#FF69B4", indianred: "#CD5C5C", indigo: "#4B0082", ivory: "#FFFFF0", khaki: "#F0E68C", lavender: "#E6E6FA", lavenderblush: "#FFF0F5", lawngreen: "#7CFC00", lemonchiffon: "#FFFACD", lightblue: "#ADD8E6", lightcoral: "#F08080", lightcyan: "#E0FFFF", lightgoldenrodyellow: "#FAFAD2", lightgray: "#D3D3D3", lightgrey: "#D3D3D3", lightgreen: "#90EE90", lightpink: "#FFB6C1", lightsalmon: "#FFA07A", lightseagreen: "#20B2AA", lightskyblue: "#87CEFA", lightslategray: "#789", lightslategrey: "#789", lightsteelblue: "#B0C4DE", lightyellow: "#FFFFE0", lime: "#0F0", limegreen: "#32CD32", linen: "#FAF0E6", magenta: "#F0F", maroon: "#800000", mediumaquamarine: "#66CDAA", mediumblue: "#0000CD", mediumorchid: "#BA55D3", mediumpurple: "#9370DB", mediumseagreen: "#3CB371", mediumslateblue: "#7B68EE", mediumspringgreen: "#00FA9A", mediumturquoise: "#48D1CC", mediumvioletred: "#C71585", midnightblue: "#191970", mintcream: "#F5FFFA", mistyrose: "#FFE4E1", moccasin: "#FFE4B5", navajowhite: "#FFDEAD", navy: "#000080", oldlace: "#FDF5E6", olive: "#808000", olivedrab: "#6B8E23", orange: "#FFA500", orangered: "#FF4500", orchid: "#DA70D6", palegoldenrod: "#EEE8AA", palegreen: "#98FB98", paleturquoise: "#AFEEEE", palevioletred: "#DB7093", papayawhip: "#FFEFD5", peachpuff: "#FFDAB9", peru: "#CD853F", pink: "#FFC0CB", plum: "#DDA0DD", powderblue: "#B0E0E6", purple: "#800080", rebeccapurple: "#639", red: "#F00", rosybrown: "#BC8F8F", royalblue: "#4169E1", saddlebrown: "#8B4513", salmon: "#FA8072", sandybrown: "#F4A460", seagreen: "#2E8B57", seashell: "#FFF5EE", sienna: "#A0522D", silver: "#C0C0C0", skyblue: "#87CEEB", slateblue: "#6A5ACD", slategray: "#708090", slategrey: "#708090", snow: "#FFFAFA", springgreen: "#00FF7F", steelblue: "#4682B4", tan: "#D2B48C", teal: "#008080", thistle: "#D8BFD8", tomato: "#FF6347", turquoise: "#40E0D0", violet: "#EE82EE", wheat: "#F5DEB3", white: "#FFF", whitesmoke: "#F5F5F5", yellow: "#FF0", yellowgreen: "#9ACD32" }, Ae = (t2, e3, s2) => (s2 < 0 && (s2 += 1), s2 > 1 && (s2 -= 1), s2 < 1 / 6 ? t2 + 6 * (e3 - t2) * s2 : s2 < 0.5 ? e3 : s2 < 2 / 3 ? t2 + (e3 - t2) * (2 / 3 - s2) * 6 : t2), je = (t2, e3, s2, i2) => {
1072
1074
  t2 /= 255, e3 /= 255, s2 /= 255;
1073
1075
  const r2 = Math.max(t2, e3, s2), n2 = Math.min(t2, e3, s2);
1074
1076
  let o2, a2;
@@ -1089,17 +1091,17 @@ const De = (t2, e3, s2, i2) => {
1089
1091
  o2 /= 6;
1090
1092
  }
1091
1093
  return [Math.round(360 * o2), Math.round(100 * a2), Math.round(100 * h2), i2];
1092
- }, Ae = function() {
1094
+ }, Fe = function() {
1093
1095
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "1";
1094
1096
  return parseFloat(t2) / (t2.endsWith("%") ? 100 : 1);
1095
- }, je = (t2) => Math.min(Math.round(t2), 255).toString(16).toUpperCase().padStart(2, "0"), Fe = (t2) => {
1097
+ }, Le = (t2) => Math.min(Math.round(t2), 255).toString(16).toUpperCase().padStart(2, "0"), Re = (t2) => {
1096
1098
  let [e3, s2, i2, r2 = 1] = t2;
1097
1099
  const n2 = Math.round(0.3 * e3 + 0.59 * s2 + 0.11 * i2);
1098
1100
  return [n2, n2, n2, r2];
1099
1101
  };
1100
- class Le {
1102
+ class Ie {
1101
1103
  constructor(e3) {
1102
- if (t(this, "isUnrecognised", false), e3) if (e3 instanceof Le) this.setSource([...e3._source]);
1104
+ if (t(this, "isUnrecognised", false), e3) if (e3 instanceof Ie) this.setSource([...e3._source]);
1103
1105
  else if (Array.isArray(e3)) {
1104
1106
  const [t2, s2, i2, r2 = 1] = e3;
1105
1107
  this.setSource([t2, s2, i2, r2]);
@@ -1107,7 +1109,7 @@ class Le {
1107
1109
  else this.setSource([0, 0, 0, 1]);
1108
1110
  }
1109
1111
  _tryParsingColor(t2) {
1110
- return (t2 = t2.toLowerCase()) in Me && (t2 = Me[t2]), "transparent" === t2 ? [255, 255, 255, 0] : Le.sourceFromHex(t2) || Le.sourceFromRgb(t2) || Le.sourceFromHsl(t2) || (this.isUnrecognised = true) && [0, 0, 0, 1];
1112
+ return (t2 = t2.toLowerCase()) in Ee && (t2 = Ee[t2]), "transparent" === t2 ? [255, 255, 255, 0] : Ie.sourceFromHex(t2) || Ie.sourceFromRgb(t2) || Ie.sourceFromHsl(t2) || (this.isUnrecognised = true) && [0, 0, 0, 1];
1111
1113
  }
1112
1114
  getSource() {
1113
1115
  return this._source;
@@ -1123,11 +1125,11 @@ class Le {
1123
1125
  return "rgba(".concat(this.getSource().join(","), ")");
1124
1126
  }
1125
1127
  toHsl() {
1126
- const [t2, e3, s2] = Ee(...this.getSource());
1128
+ const [t2, e3, s2] = je(...this.getSource());
1127
1129
  return "hsl(".concat(t2, ",").concat(e3, "%,").concat(s2, "%)");
1128
1130
  }
1129
1131
  toHsla() {
1130
- const [t2, e3, s2, i2] = Ee(...this.getSource());
1132
+ const [t2, e3, s2, i2] = je(...this.getSource());
1131
1133
  return "hsla(".concat(t2, ",").concat(e3, "%,").concat(s2, "%,").concat(i2, ")");
1132
1134
  }
1133
1135
  toHex() {
@@ -1135,7 +1137,7 @@ class Le {
1135
1137
  }
1136
1138
  toHexa() {
1137
1139
  const [t2, e3, s2, i2] = this.getSource();
1138
- return "".concat(je(t2)).concat(je(e3)).concat(je(s2)).concat(je(Math.round(255 * i2)));
1140
+ return "".concat(Le(t2)).concat(Le(e3)).concat(Le(s2)).concat(Le(Math.round(255 * i2)));
1139
1141
  }
1140
1142
  getAlpha() {
1141
1143
  return this.getSource()[3];
@@ -1144,53 +1146,53 @@ class Le {
1144
1146
  return this._source[3] = t2, this;
1145
1147
  }
1146
1148
  toGrayscale() {
1147
- return this.setSource(Fe(this.getSource())), this;
1149
+ return this.setSource(Re(this.getSource())), this;
1148
1150
  }
1149
1151
  toBlackWhite(t2) {
1150
- const [e3, , , s2] = Fe(this.getSource()), i2 = e3 < (t2 || 127) ? 0 : 255;
1152
+ const [e3, , , s2] = Re(this.getSource()), i2 = e3 < (t2 || 127) ? 0 : 255;
1151
1153
  return this.setSource([i2, i2, i2, s2]), this;
1152
1154
  }
1153
1155
  overlayWith(t2) {
1154
- t2 instanceof Le || (t2 = new Le(t2));
1156
+ t2 instanceof Ie || (t2 = new Ie(t2));
1155
1157
  const e3 = this.getSource(), s2 = t2.getSource(), [i2, r2, n2] = e3.map((t3, e4) => Math.round(0.5 * t3 + 0.5 * s2[e4]));
1156
1158
  return this.setSource([i2, r2, n2, e3[3]]), this;
1157
1159
  }
1158
1160
  static fromRgb(t2) {
1159
- return Le.fromRgba(t2);
1161
+ return Ie.fromRgba(t2);
1160
1162
  }
1161
1163
  static fromRgba(t2) {
1162
- return new Le(Le.sourceFromRgb(t2));
1164
+ return new Ie(Ie.sourceFromRgb(t2));
1163
1165
  }
1164
1166
  static sourceFromRgb(t2) {
1165
- const e3 = t2.match(/^rgba?\(\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*(?:\s*[,/]\s*(\d{0,3}(?:\.\d+)?%?)\s*)?\)$/i);
1167
+ const e3 = Pe(t2).match(/^rgba?\(\s?(\d{0,3}(?:\.\d+)?%?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?(?:\s?[,/]\s?(\d{0,3}(?:\.\d+)?%?)\s?)?\)$/i);
1166
1168
  if (e3) {
1167
1169
  const [t3, s2, i2] = e3.slice(1, 4).map((t4) => {
1168
1170
  const e4 = parseFloat(t4);
1169
1171
  return t4.endsWith("%") ? Math.round(2.55 * e4) : e4;
1170
1172
  });
1171
- return [t3, s2, i2, Ae(e3[4])];
1173
+ return [t3, s2, i2, Fe(e3[4])];
1172
1174
  }
1173
1175
  }
1174
1176
  static fromHsl(t2) {
1175
- return Le.fromHsla(t2);
1177
+ return Ie.fromHsla(t2);
1176
1178
  }
1177
1179
  static fromHsla(t2) {
1178
- return new Le(Le.sourceFromHsl(t2));
1180
+ return new Ie(Ie.sourceFromHsl(t2));
1179
1181
  }
1180
1182
  static sourceFromHsl(t2) {
1181
- const e3 = t2.match(/^hsla?\(\s*([+-]?\d{0,3}(?:\.\d+)?(?:deg|turn|rad)?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*[\s|,]\s*(\d{0,3}(?:\.\d+)?%?)\s*(?:\s*[,/]\s*(\d*(?:\.\d+)?%?)\s*)?\)$/i);
1183
+ const e3 = Pe(t2).match(/^hsla?\(\s?([+-]?\d{0,3}(?:\.\d+)?(?:deg|turn|rad)?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?[\s|,]\s?(\d{0,3}(?:\.\d+)?%?)\s?(?:\s?[,/]\s?(\d*(?:\.\d+)?%?)\s?)?\)$/i);
1182
1184
  if (!e3) return;
1183
- const s2 = (Le.parseAngletoDegrees(e3[1]) % 360 + 360) % 360 / 360, i2 = parseFloat(e3[2]) / 100, r2 = parseFloat(e3[3]) / 100;
1185
+ const s2 = (Ie.parseAngletoDegrees(e3[1]) % 360 + 360) % 360 / 360, i2 = parseFloat(e3[2]) / 100, r2 = parseFloat(e3[3]) / 100;
1184
1186
  let n2, o2, a2;
1185
1187
  if (0 === i2) n2 = o2 = a2 = r2;
1186
1188
  else {
1187
1189
  const t3 = r2 <= 0.5 ? r2 * (i2 + 1) : r2 + i2 - r2 * i2, e4 = 2 * r2 - t3;
1188
- n2 = Pe(e4, t3, s2 + 1 / 3), o2 = Pe(e4, t3, s2), a2 = Pe(e4, t3, s2 - 1 / 3);
1190
+ n2 = Ae(e4, t3, s2 + 1 / 3), o2 = Ae(e4, t3, s2), a2 = Ae(e4, t3, s2 - 1 / 3);
1189
1191
  }
1190
- return [Math.round(255 * n2), Math.round(255 * o2), Math.round(255 * a2), Ae(e3[4])];
1192
+ return [Math.round(255 * n2), Math.round(255 * o2), Math.round(255 * a2), Fe(e3[4])];
1191
1193
  }
1192
1194
  static fromHex(t2) {
1193
- return new Le(Le.sourceFromHex(t2));
1195
+ return new Ie(Ie.sourceFromHex(t2));
1194
1196
  }
1195
1197
  static sourceFromHex(t2) {
1196
1198
  if (t2.match(/^#?(([0-9a-f]){3,4}|([0-9a-f]{2}){3,4})$/i)) {
@@ -1206,7 +1208,7 @@ class Le {
1206
1208
  return e3.includes("rad") ? Ct(s2) : e3.includes("turn") ? 360 * s2 : s2;
1207
1209
  }
1208
1210
  }
1209
- const Re = function(t2) {
1211
+ const Be = function(t2) {
1210
1212
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : O;
1211
1213
  const s2 = /\D{0,2}$/.exec(t2), i2 = parseFloat(t2), r2 = o.DPI;
1212
1214
  switch (null == s2 ? void 0 : s2[0]) {
@@ -1225,24 +1227,24 @@ const Re = function(t2) {
1225
1227
  default:
1226
1228
  return i2;
1227
1229
  }
1228
- }, Be = (t2) => {
1230
+ }, Xe = (t2) => {
1229
1231
  const [e3, s2] = t2.trim().split(" "), [i2, r2] = (n2 = e3) && n2 !== j ? [n2.slice(1, 4), n2.slice(5, 8)] : n2 === j ? [n2, n2] : ["Mid", "Mid"];
1230
1232
  var n2;
1231
1233
  return { meetOrSlice: s2 || "meet", alignX: i2, alignY: r2 };
1232
- }, Ie = function(t2, e3) {
1234
+ }, Ye = function(t2, e3) {
1233
1235
  let s2, i2, r2 = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];
1234
1236
  if (e3) if (e3.toLive) s2 = "url(#SVGID_".concat(e3.id, ")");
1235
1237
  else {
1236
- const t3 = new Le(e3), r3 = t3.getAlpha();
1238
+ const t3 = new Ie(e3), r3 = t3.getAlpha();
1237
1239
  s2 = t3.toRgb(), 1 !== r3 && (i2 = r3.toString());
1238
1240
  }
1239
1241
  else s2 = "none";
1240
1242
  return r2 ? "".concat(t2, ": ").concat(s2, "; ").concat(i2 ? "".concat(t2, "-opacity: ").concat(i2, "; ") : "") : "".concat(t2, '="').concat(s2, '" ').concat(i2 ? "".concat(t2, '-opacity="').concat(i2, '" ') : "");
1241
1243
  };
1242
- class Xe {
1244
+ class We {
1243
1245
  getSvgStyles(t2) {
1244
- const e3 = this.fillRule ? this.fillRule : "nonzero", s2 = this.strokeWidth ? this.strokeWidth : "0", i2 = this.strokeDashArray ? this.strokeDashArray.join(" ") : j, r2 = this.strokeDashOffset ? this.strokeDashOffset : "0", n2 = this.strokeLineCap ? this.strokeLineCap : "butt", o2 = this.strokeLineJoin ? this.strokeLineJoin : "miter", a2 = this.strokeMiterLimit ? this.strokeMiterLimit : "4", h2 = void 0 !== this.opacity ? this.opacity : "1", c2 = this.visible ? "" : " visibility: hidden;", l2 = t2 ? "" : this.getSvgFilter(), u2 = Ie(K, this.fill);
1245
- return [Ie(J, this.stroke), "stroke-width: ", s2, "; ", "stroke-dasharray: ", i2, "; ", "stroke-linecap: ", n2, "; ", "stroke-dashoffset: ", r2, "; ", "stroke-linejoin: ", o2, "; ", "stroke-miterlimit: ", a2, "; ", u2, "fill-rule: ", e3, "; ", "opacity: ", h2, ";", l2, c2].join("");
1246
+ const e3 = this.fillRule ? this.fillRule : "nonzero", s2 = this.strokeWidth ? this.strokeWidth : "0", i2 = this.strokeDashArray ? this.strokeDashArray.join(" ") : j, r2 = this.strokeDashOffset ? this.strokeDashOffset : "0", n2 = this.strokeLineCap ? this.strokeLineCap : "butt", o2 = this.strokeLineJoin ? this.strokeLineJoin : "miter", a2 = this.strokeMiterLimit ? this.strokeMiterLimit : "4", h2 = void 0 !== this.opacity ? this.opacity : "1", c2 = this.visible ? "" : " visibility: hidden;", l2 = t2 ? "" : this.getSvgFilter(), u2 = Ye(K, this.fill);
1247
+ return [Ye(J, this.stroke), "stroke-width: ", s2, "; ", "stroke-dasharray: ", i2, "; ", "stroke-linecap: ", n2, "; ", "stroke-dashoffset: ", r2, "; ", "stroke-linejoin: ", o2, "; ", "stroke-miterlimit: ", a2, "; ", u2, "fill-rule: ", e3, "; ", "opacity: ", h2, ";", l2, c2].join("");
1246
1248
  }
1247
1249
  getSvgFilter() {
1248
1250
  return this.shadow ? "filter: url(#SVGID_".concat(this.shadow.id, ");") : "";
@@ -1281,52 +1283,55 @@ class Xe {
1281
1283
  return this.paintFirst !== K ? ' paint-order="'.concat(this.paintFirst, '" ') : "";
1282
1284
  }
1283
1285
  }
1284
- function Ye(t2) {
1286
+ function Ve(t2) {
1285
1287
  return new RegExp("^(" + t2.join("|") + ")\\b", "i");
1286
1288
  }
1287
- var We;
1288
- const Ve = String.raw(We || (We = r(["(?:[-+]?(?:d*.d+|d+.?)(?:[eE][-+]?d+)?)"], ["(?:[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?)"]))), Ge = new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(" + Ve + "(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|" + Ve + "))?\\s+(.*)"), He = { cx: M, x: M, r: "radius", cy: P, y: P, display: "visible", visibility: "visible", transform: "transformMatrix", "fill-opacity": "fillOpacity", "fill-rule": "fillRule", "font-family": "fontFamily", "font-size": "fontSize", "font-style": "fontStyle", "font-weight": "fontWeight", "letter-spacing": "charSpacing", "paint-order": "paintFirst", "stroke-dasharray": "strokeDashArray", "stroke-dashoffset": "strokeDashOffset", "stroke-linecap": "strokeLineCap", "stroke-linejoin": "strokeLineJoin", "stroke-miterlimit": "strokeMiterLimit", "stroke-opacity": "strokeOpacity", "stroke-width": "strokeWidth", "text-decoration": "textDecoration", "text-anchor": "textAnchor", opacity: "opacity", "clip-path": "clipPath", "clip-rule": "clipRule", "vector-effect": "strokeUniform", "image-rendering": "imageSmoothing" }, Ne = "font-size", Ue = "clip-path";
1289
- Ye(["path", "circle", "polygon", "polyline", "ellipse", "rect", "line", "image", "text"]);
1290
- Ye(["symbol", "image", "marker", "pattern", "view", "svg"]);
1291
- const Je = Ye(["symbol", "g", "a", "svg", "clipPath", "defs"]), Ze = new ot(1, 0), $e = new ot(), ts = (t2, e3) => t2.rotate(e3), es = (t2, e3) => new ot(e3).subtract(t2), ss = (t2) => t2.distanceFrom($e), is = (t2, e3) => Math.atan2(as(t2, e3), hs(t2, e3)), rs = (t2) => is(Ze, t2), ns = (t2) => t2.eq($e) ? t2 : t2.scalarDivide(ss(t2)), os = function(t2) {
1289
+ const ze = "textDecorationThickness", Ge = ["fontSize", "fontWeight", "fontFamily", "fontStyle"], He = ["underline", "overline", "linethrough"], Ne = [...Ge, "lineHeight", "text", "charSpacing", "textAlign", "styles", "path", "pathStartOffset", "pathSide", "pathAlign"], Ue = [...Ne, ...He, "textBackgroundColor", "direction", ze], qe = [...Ge, ...He, J, "strokeWidth", K, "deltaY", "textBackgroundColor", ze], Ke = { _reNewline: F, _reSpacesAndTabs: /[ \t\r]/g, _reSpaceAndTab: /[ \t\r]/, _reWords: /\S+/g, fontSize: 40, fontWeight: "normal", fontFamily: "Times New Roman", underline: false, overline: false, linethrough: false, textAlign: M, fontStyle: "normal", lineHeight: 1.16, textBackgroundColor: "", stroke: null, shadow: null, path: void 0, pathStartOffset: 0, pathSide: M, pathAlign: "baseline", charSpacing: 0, deltaY: 0, direction: "ltr", CACHE_FONT_SIZE: 400, MIN_TEXT_WIDTH: 2, superscript: { size: 0.6, baseline: -0.35 }, subscript: { size: 0.6, baseline: 0.11 }, _fontSizeFraction: 0.222, offsets: { underline: 0.1, linethrough: -0.28167, overline: -0.81333 }, _fontSizeMult: 1.13, [ze]: 66.667 }, Je = "justify", Qe = "justify-left", Ze = "justify-right", $e = "justify-center";
1290
+ var ts, es, ss;
1291
+ const is = String.raw(ts || (ts = r(["[-+]?(?:d*.d+|d+.?)(?:[eE][-+]?d+)?"], ["[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?"]))), rs = String.raw(es || (es = r(["(?:s*,?s+|s*,s*)"], ["(?:\\s*,?\\s+|\\s*,\\s*)"]))), os = new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(" + is + "(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|" + is + "))?\\s+(.*)"), as = { cx: M, x: M, r: "radius", cy: P, y: P, display: "visible", visibility: "visible", transform: "transformMatrix", "fill-opacity": "fillOpacity", "fill-rule": "fillRule", "font-family": "fontFamily", "font-size": "fontSize", "font-style": "fontStyle", "font-weight": "fontWeight", "letter-spacing": "charSpacing", "paint-order": "paintFirst", "stroke-dasharray": "strokeDashArray", "stroke-dashoffset": "strokeDashOffset", "stroke-linecap": "strokeLineCap", "stroke-linejoin": "strokeLineJoin", "stroke-miterlimit": "strokeMiterLimit", "stroke-opacity": "strokeOpacity", "stroke-width": "strokeWidth", "text-decoration": "textDecoration", "text-anchor": "textAnchor", opacity: "opacity", "clip-path": "clipPath", "clip-rule": "clipRule", "vector-effect": "strokeUniform", "image-rendering": "imageSmoothing", "text-decoration-thickness": ze }, hs = "font-size", cs = "clip-path";
1292
+ Ve(["path", "circle", "polygon", "polyline", "ellipse", "rect", "line", "image", "text"]);
1293
+ Ve(["symbol", "image", "marker", "pattern", "view", "svg"]);
1294
+ const ds = Ve(["symbol", "g", "a", "svg", "clipPath", "defs"]);
1295
+ new RegExp(String.raw(ss || (ss = r(["^s*(", ")", "(", ")", "(", ")", "(", ")s*$"], ["^\\s*(", ")", "(", ")", "(", ")", "(", ")\\s*$"])), is, rs, is, rs, is, rs, is));
1296
+ const fs = new ot(1, 0), ps = new ot(), ms = (t2, e3) => t2.rotate(e3), vs = (t2, e3) => new ot(e3).subtract(t2), ys = (t2) => t2.distanceFrom(ps), _s = (t2, e3) => Math.atan2(Ss(t2, e3), ws(t2, e3)), xs = (t2) => _s(fs, t2), Cs = (t2) => t2.eq(ps) ? t2 : t2.scalarDivide(ys(t2)), bs = function(t2) {
1292
1297
  let e3 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
1293
- return ns(new ot(-t2.y, t2.x).scalarMultiply(e3 ? 1 : -1));
1294
- }, as = (t2, e3) => t2.x * e3.y - t2.y * e3.x, hs = (t2, e3) => t2.x * e3.x + t2.y * e3.y, cs = (t2, e3, s2) => {
1298
+ return Cs(new ot(-t2.y, t2.x).scalarMultiply(e3 ? 1 : -1));
1299
+ }, Ss = (t2, e3) => t2.x * e3.y - t2.y * e3.x, ws = (t2, e3) => t2.x * e3.x + t2.y * e3.y, Ts = (t2, e3, s2) => {
1295
1300
  if (t2.eq(e3) || t2.eq(s2)) return true;
1296
- const i2 = as(e3, s2), r2 = as(e3, t2), n2 = as(s2, t2);
1301
+ const i2 = Ss(e3, s2), r2 = Ss(e3, t2), n2 = Ss(s2, t2);
1297
1302
  return i2 >= 0 ? r2 >= 0 && n2 <= 0 : !(r2 <= 0 && n2 >= 0);
1298
- }, ls = "(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?", us = new RegExp("(?:\\s|^)" + ls + ls + "(" + Ve + "?(?:px)?)?(?:\\s?|$)(?:$|\\s)");
1299
- class ds {
1303
+ }, Os = "(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?", ks = new RegExp("(?:\\s|^)" + Os + Os + "(" + is + "?(?:px)?)?(?:\\s?|$)(?:$|\\s)");
1304
+ class Ds {
1300
1305
  constructor(t2) {
1301
- const e3 = "string" == typeof t2 ? ds.parseShadow(t2) : t2;
1302
- Object.assign(this, ds.ownDefaults, e3), this.id = ft();
1306
+ const e3 = "string" == typeof t2 ? Ds.parseShadow(t2) : t2;
1307
+ Object.assign(this, Ds.ownDefaults, e3), this.id = ft();
1303
1308
  }
1304
1309
  static parseShadow(t2) {
1305
- const e3 = t2.trim(), [, s2 = 0, i2 = 0, r2 = 0] = (us.exec(e3) || []).map((t3) => parseFloat(t3) || 0);
1306
- return { color: (e3.replace(us, "") || "rgb(0,0,0)").trim(), offsetX: s2, offsetY: i2, blur: r2 };
1310
+ const e3 = t2.trim(), [, s2 = 0, i2 = 0, r2 = 0] = (ks.exec(e3) || []).map((t3) => parseFloat(t3) || 0);
1311
+ return { color: (e3.replace(ks, "") || "rgb(0,0,0)").trim(), offsetX: s2, offsetY: i2, blur: r2 };
1307
1312
  }
1308
1313
  toString() {
1309
1314
  return [this.offsetX, this.offsetY, this.blur, this.color].join("px ");
1310
1315
  }
1311
1316
  toSVG(t2) {
1312
- const e3 = ts(new ot(this.offsetX, this.offsetY), xt(-t2.angle)), s2 = new Le(this.color);
1317
+ const e3 = ms(new ot(this.offsetX, this.offsetY), xt(-t2.angle)), s2 = new Ie(this.color);
1313
1318
  let i2 = 40, r2 = 40;
1314
1319
  return t2.width && t2.height && (i2 = 100 * Vt((Math.abs(e3.x) + this.blur) / t2.width, o.NUM_FRACTION_DIGITS) + 20, r2 = 100 * Vt((Math.abs(e3.y) + this.blur) / t2.height, o.NUM_FRACTION_DIGITS) + 20), t2.flipX && (e3.x *= -1), t2.flipY && (e3.y *= -1), '<filter id="SVGID_'.concat(this.id, '" y="-').concat(r2, '%" height="').concat(100 + 2 * r2, '%" x="-').concat(i2, '%" width="').concat(100 + 2 * i2, '%" >\n <feGaussianBlur in="SourceAlpha" stdDeviation="').concat(Vt(this.blur ? this.blur / 2 : 0, o.NUM_FRACTION_DIGITS), '"></feGaussianBlur>\n <feOffset dx="').concat(Vt(e3.x, o.NUM_FRACTION_DIGITS), '" dy="').concat(Vt(e3.y, o.NUM_FRACTION_DIGITS), '" result="oBlur" ></feOffset>\n <feFlood flood-color="').concat(s2.toRgb(), '" flood-opacity="').concat(s2.getAlpha(), '"/>\n <feComposite in2="oBlur" operator="in" />\n <feMerge>\n <feMergeNode></feMergeNode>\n <feMergeNode in="SourceGraphic"></feMergeNode>\n </feMerge>\n</filter>\n');
1315
1320
  }
1316
1321
  toObject() {
1317
- const t2 = { color: this.color, blur: this.blur, offsetX: this.offsetX, offsetY: this.offsetY, affectStroke: this.affectStroke, nonScaling: this.nonScaling, type: this.constructor.type }, e3 = ds.ownDefaults;
1322
+ const t2 = { color: this.color, blur: this.blur, offsetX: this.offsetX, offsetY: this.offsetY, affectStroke: this.affectStroke, nonScaling: this.nonScaling, type: this.constructor.type }, e3 = Ds.ownDefaults;
1318
1323
  return this.includeDefaultValues ? t2 : Wt(t2, (t3, s2) => t3 !== e3[s2]);
1319
1324
  }
1320
1325
  static async fromObject(t2) {
1321
1326
  return new this(t2);
1322
1327
  }
1323
1328
  }
1324
- t(ds, "ownDefaults", { color: "rgb(0,0,0)", blur: 0, offsetX: 0, offsetY: 0, affectStroke: false, includeDefaultValues: true, nonScaling: false }), t(ds, "type", "shadow"), tt.setClass(ds, "shadow");
1325
- const gs = (t2, e3, s2) => Math.max(t2, Math.min(e3, s2)), fs = [P, M, H, N, "flipX", "flipY", "originX", "originY", "angle", "opacity", "globalCompositeOperation", "shadow", "visible", U, q], ps = [K, J, "strokeWidth", "strokeDashArray", "width", "height", "paintFirst", "strokeUniform", "strokeLineCap", "strokeDashOffset", "strokeLineJoin", "strokeMiterLimit", "backgroundColor", "clipPath"], ms = { top: 0, left: 0, width: 0, height: 0, angle: 0, flipX: false, flipY: false, scaleX: 1, scaleY: 1, minScaleLimit: 0, skewX: 0, skewY: 0, originX: M, originY: P, strokeWidth: 1, strokeUniform: false, padding: 0, opacity: 1, paintFirst: K, fill: "rgb(0,0,0)", fillRule: "nonzero", stroke: null, strokeDashArray: null, strokeDashOffset: 0, strokeLineCap: "butt", strokeLineJoin: "miter", strokeMiterLimit: 4, globalCompositeOperation: "source-over", backgroundColor: "", shadow: null, visible: true, includeDefaultValues: true, excludeFromExport: false, objectCaching: true, clipPath: void 0, inverted: false, absolutePositioned: false, centeredRotation: true, centeredScaling: false, dirty: true }, _s = (t2, e3, s2, i2) => -s2 * Math.cos(t2 / i2 * b) + s2 + e3;
1326
- const Ss = () => false;
1327
- class ws {
1329
+ t(Ds, "ownDefaults", { color: "rgb(0,0,0)", blur: 0, offsetX: 0, offsetY: 0, affectStroke: false, includeDefaultValues: true, nonScaling: false }), t(Ds, "type", "shadow"), tt.setClass(Ds, "shadow");
1330
+ const Ms = (t2, e3, s2) => Math.max(t2, Math.min(e3, s2)), Ps = [P, M, H, N, "flipX", "flipY", "originX", "originY", "angle", "opacity", "globalCompositeOperation", "shadow", "visible", U, q], Es = [K, J, "strokeWidth", "strokeDashArray", "width", "height", "paintFirst", "strokeUniform", "strokeLineCap", "strokeDashOffset", "strokeLineJoin", "strokeMiterLimit", "backgroundColor", "clipPath"], As = { top: 0, left: 0, width: 0, height: 0, angle: 0, flipX: false, flipY: false, scaleX: 1, scaleY: 1, minScaleLimit: 0, skewX: 0, skewY: 0, originX: M, originY: P, strokeWidth: 1, strokeUniform: false, padding: 0, opacity: 1, paintFirst: K, fill: "rgb(0,0,0)", fillRule: "nonzero", stroke: null, strokeDashArray: null, strokeDashOffset: 0, strokeLineCap: "butt", strokeLineJoin: "miter", strokeMiterLimit: 4, globalCompositeOperation: "source-over", backgroundColor: "", shadow: null, visible: true, includeDefaultValues: true, excludeFromExport: false, objectCaching: true, clipPath: void 0, inverted: false, absolutePositioned: false, centeredRotation: true, centeredScaling: false, dirty: true }, Ls = (t2, e3, s2, i2) => -s2 * Math.cos(t2 / i2 * b) + s2 + e3;
1331
+ const Xs = () => false;
1332
+ class Ys {
1328
1333
  constructor(e3) {
1329
- let { startValue: s2, byValue: i2, duration: r2 = 500, delay: n2 = 0, easing: o2 = _s, onStart: a2 = C, onChange: h2 = C, onComplete: c2 = C, abort: l2 = Ss, target: u2 } = e3;
1334
+ let { startValue: s2, byValue: i2, duration: r2 = 500, delay: n2 = 0, easing: o2 = Ls, onStart: a2 = C, onChange: h2 = C, onComplete: c2 = C, abort: l2 = Xs, target: u2 } = e3;
1330
1335
  t(this, "_state", "pending"), t(this, "durationProgress", 0), t(this, "valueProgress", 0), this.tick = this.tick.bind(this), this.duration = r2, this.delay = n2, this.easing = o2, this._onStart = a2, this._onChange = h2, this._onComplete = c2, this._abort = l2, this.target = u2, this.startValue = s2, this.byValue = i2, this.value = this.startValue, this.endValue = Object.freeze(this.calculate(this.duration).value);
1331
1336
  }
1332
1337
  get state() {
@@ -1357,49 +1362,49 @@ class ws {
1357
1362
  this._state = "aborted", this.unregister();
1358
1363
  }
1359
1364
  }
1360
- const Ts = ["startValue", "endValue"];
1361
- class Os extends ws {
1365
+ const Ws = ["startValue", "endValue"];
1366
+ class Vs extends Ys {
1362
1367
  constructor(t2) {
1363
1368
  let { startValue: e3 = 0, endValue: r2 = 100 } = t2;
1364
- super(s(s({}, i(t2, Ts)), {}, { startValue: e3, byValue: r2 - e3 }));
1369
+ super(s(s({}, i(t2, Ws)), {}, { startValue: e3, byValue: r2 - e3 }));
1365
1370
  }
1366
1371
  calculate(t2) {
1367
1372
  const e3 = this.easing(t2, this.startValue, this.byValue, this.duration);
1368
1373
  return { value: e3, valueProgress: Math.abs((e3 - this.startValue) / this.byValue) };
1369
1374
  }
1370
1375
  }
1371
- const ks = ["startValue", "endValue"];
1372
- class Ds extends ws {
1376
+ const zs = ["startValue", "endValue"];
1377
+ class Gs extends Ys {
1373
1378
  constructor(t2) {
1374
1379
  let { startValue: e3 = [0], endValue: r2 = [100] } = t2;
1375
- super(s(s({}, i(t2, ks)), {}, { startValue: e3, byValue: r2.map((t3, s2) => t3 - e3[s2]) }));
1380
+ super(s(s({}, i(t2, zs)), {}, { startValue: e3, byValue: r2.map((t3, s2) => t3 - e3[s2]) }));
1376
1381
  }
1377
1382
  calculate(t2) {
1378
1383
  const e3 = this.startValue.map((e4, s2) => this.easing(t2, e4, this.byValue[s2], this.duration, s2));
1379
1384
  return { value: e3, valueProgress: Math.abs((e3[0] - this.startValue[0]) / this.byValue[0]) };
1380
1385
  }
1381
1386
  }
1382
- const Ms = ["startValue", "endValue", "easing", "onChange", "onComplete", "abort"], Ps = (t2, e3, s2, i2) => e3 + s2 * (1 - Math.cos(t2 / i2 * b)), Es = (t2) => t2 && ((e3, s2, i2) => t2(new Le(e3).toRgba(), s2, i2));
1383
- class As extends ws {
1387
+ const Hs = ["startValue", "endValue", "easing", "onChange", "onComplete", "abort"], Ns = (t2, e3, s2, i2) => e3 + s2 * (1 - Math.cos(t2 / i2 * b)), Us = (t2) => t2 && ((e3, s2, i2) => t2(new Ie(e3).toRgba(), s2, i2));
1388
+ class qs extends Ys {
1384
1389
  constructor(t2) {
1385
- let { startValue: e3, endValue: r2, easing: n2 = Ps, onChange: o2, onComplete: a2, abort: h2 } = t2, c2 = i(t2, Ms);
1386
- const l2 = new Le(e3).getSource(), u2 = new Le(r2).getSource();
1387
- super(s(s({}, c2), {}, { startValue: l2, byValue: u2.map((t3, e4) => t3 - l2[e4]), easing: n2, onChange: Es(o2), onComplete: Es(a2), abort: Es(h2) }));
1390
+ let { startValue: e3, endValue: r2, easing: n2 = Ns, onChange: o2, onComplete: a2, abort: h2 } = t2, c2 = i(t2, Hs);
1391
+ const l2 = new Ie(e3).getSource(), u2 = new Ie(r2).getSource();
1392
+ super(s(s({}, c2), {}, { startValue: l2, byValue: u2.map((t3, e4) => t3 - l2[e4]), easing: n2, onChange: Us(o2), onComplete: Us(a2), abort: Us(h2) }));
1388
1393
  }
1389
1394
  calculate(t2) {
1390
- const [e3, s2, i2, r2] = this.startValue.map((e4, s3) => this.easing(t2, e4, this.byValue[s3], this.duration, s3)), n2 = [...[e3, s2, i2].map(Math.round), gs(0, r2, 1)];
1395
+ const [e3, s2, i2, r2] = this.startValue.map((e4, s3) => this.easing(t2, e4, this.byValue[s3], this.duration, s3)), n2 = [...[e3, s2, i2].map(Math.round), Ms(0, r2, 1)];
1391
1396
  return { value: n2, valueProgress: n2.map((t3, e4) => 0 !== this.byValue[e4] ? Math.abs((t3 - this.startValue[e4]) / this.byValue[e4]) : 0).find((t3) => 0 !== t3) || 0 };
1392
1397
  }
1393
1398
  }
1394
- function js(t2) {
1395
- const e3 = ((t3) => Array.isArray(t3.startValue) || Array.isArray(t3.endValue))(t2) ? new Ds(t2) : new Os(t2);
1399
+ function Ks(t2) {
1400
+ const e3 = ((t3) => Array.isArray(t3.startValue) || Array.isArray(t3.endValue))(t2) ? new Gs(t2) : new Vs(t2);
1396
1401
  return e3.start(), e3;
1397
1402
  }
1398
- function Fs(t2) {
1399
- const e3 = new As(t2);
1403
+ function Js(t2) {
1404
+ const e3 = new qs(t2);
1400
1405
  return e3.start(), e3;
1401
1406
  }
1402
- class Ls {
1407
+ class Qs {
1403
1408
  constructor(t2) {
1404
1409
  this.status = t2, this.points = [];
1405
1410
  }
@@ -1416,7 +1421,7 @@ class Ls {
1416
1421
  if (e3.x === s2.x) return t2.x === e3.x && (i2 || t2.y >= Math.min(e3.y, s2.y) && t2.y <= Math.max(e3.y, s2.y));
1417
1422
  if (e3.y === s2.y) return t2.y === e3.y && (i2 || t2.x >= Math.min(e3.x, s2.x) && t2.x <= Math.max(e3.x, s2.x));
1418
1423
  {
1419
- const r2 = es(e3, s2), n2 = es(e3, t2).divide(r2);
1424
+ const r2 = vs(e3, s2), n2 = vs(e3, t2).divide(r2);
1420
1425
  return i2 ? Math.abs(n2.x) === Math.abs(n2.y) : n2.x === n2.y && n2.x >= 0 && n2.x <= 1;
1421
1426
  }
1422
1427
  }
@@ -1435,46 +1440,46 @@ class Ls {
1435
1440
  const o2 = e3.x - t2.x, a2 = e3.y - t2.y, h2 = i2.x - s2.x, c2 = i2.y - s2.y, l2 = t2.x - s2.x, u2 = t2.y - s2.y, d2 = h2 * u2 - c2 * l2, g2 = o2 * u2 - a2 * l2, f = c2 * o2 - h2 * a2;
1436
1441
  if (0 !== f) {
1437
1442
  const e4 = d2 / f, s3 = g2 / f;
1438
- return (r2 || 0 <= e4 && e4 <= 1) && (n2 || 0 <= s3 && s3 <= 1) ? new Ls("Intersection").append(new ot(t2.x + e4 * o2, t2.y + e4 * a2)) : new Ls();
1443
+ return (r2 || 0 <= e4 && e4 <= 1) && (n2 || 0 <= s3 && s3 <= 1) ? new Qs("Intersection").append(new ot(t2.x + e4 * o2, t2.y + e4 * a2)) : new Qs();
1439
1444
  }
1440
1445
  if (0 === d2 || 0 === g2) {
1441
- const o3 = r2 || n2 || Ls.isPointContained(t2, s2, i2) || Ls.isPointContained(e3, s2, i2) || Ls.isPointContained(s2, t2, e3) || Ls.isPointContained(i2, t2, e3);
1442
- return new Ls(o3 ? "Coincident" : void 0);
1446
+ const o3 = r2 || n2 || Qs.isPointContained(t2, s2, i2) || Qs.isPointContained(e3, s2, i2) || Qs.isPointContained(s2, t2, e3) || Qs.isPointContained(i2, t2, e3);
1447
+ return new Qs(o3 ? "Coincident" : void 0);
1443
1448
  }
1444
- return new Ls("Parallel");
1449
+ return new Qs("Parallel");
1445
1450
  }
1446
1451
  static intersectSegmentLine(t2, e3, s2, i2) {
1447
- return Ls.intersectLineLine(t2, e3, s2, i2, false, true);
1452
+ return Qs.intersectLineLine(t2, e3, s2, i2, false, true);
1448
1453
  }
1449
1454
  static intersectSegmentSegment(t2, e3, s2, i2) {
1450
- return Ls.intersectLineLine(t2, e3, s2, i2, false, false);
1455
+ return Qs.intersectLineLine(t2, e3, s2, i2, false, false);
1451
1456
  }
1452
1457
  static intersectLinePolygon(t2, e3, s2) {
1453
1458
  let i2 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3];
1454
- const r2 = new Ls(), n2 = s2.length;
1459
+ const r2 = new Qs(), n2 = s2.length;
1455
1460
  for (let o2, a2, h2, c2 = 0; c2 < n2; c2++) {
1456
- if (o2 = s2[c2], a2 = s2[(c2 + 1) % n2], h2 = Ls.intersectLineLine(t2, e3, o2, a2, i2, false), "Coincident" === h2.status) return h2;
1461
+ if (o2 = s2[c2], a2 = s2[(c2 + 1) % n2], h2 = Qs.intersectLineLine(t2, e3, o2, a2, i2, false), "Coincident" === h2.status) return h2;
1457
1462
  r2.append(...h2.points);
1458
1463
  }
1459
1464
  return r2.points.length > 0 && (r2.status = "Intersection"), r2;
1460
1465
  }
1461
1466
  static intersectSegmentPolygon(t2, e3, s2) {
1462
- return Ls.intersectLinePolygon(t2, e3, s2, false);
1467
+ return Qs.intersectLinePolygon(t2, e3, s2, false);
1463
1468
  }
1464
1469
  static intersectPolygonPolygon(t2, e3) {
1465
- const s2 = new Ls(), i2 = t2.length, r2 = [];
1470
+ const s2 = new Qs(), i2 = t2.length, r2 = [];
1466
1471
  for (let n2 = 0; n2 < i2; n2++) {
1467
- const o2 = t2[n2], a2 = t2[(n2 + 1) % i2], h2 = Ls.intersectSegmentPolygon(o2, a2, e3);
1472
+ const o2 = t2[n2], a2 = t2[(n2 + 1) % i2], h2 = Qs.intersectSegmentPolygon(o2, a2, e3);
1468
1473
  "Coincident" === h2.status ? (r2.push(h2), s2.append(o2, a2)) : s2.append(...h2.points);
1469
1474
  }
1470
- return r2.length > 0 && r2.length === t2.length ? new Ls("Coincident") : (s2.points.length > 0 && (s2.status = "Intersection"), s2);
1475
+ return r2.length > 0 && r2.length === t2.length ? new Qs("Coincident") : (s2.points.length > 0 && (s2.status = "Intersection"), s2);
1471
1476
  }
1472
1477
  static intersectPolygonRectangle(t2, e3, s2) {
1473
1478
  const i2 = e3.min(s2), r2 = e3.max(s2), n2 = new ot(r2.x, i2.y), o2 = new ot(i2.x, r2.y);
1474
- return Ls.intersectPolygonPolygon(t2, [i2, n2, r2, o2]);
1479
+ return Qs.intersectPolygonPolygon(t2, [i2, n2, r2, o2]);
1475
1480
  }
1476
1481
  }
1477
- class Rs extends lt {
1482
+ class Zs extends lt {
1478
1483
  getX() {
1479
1484
  return this.getXY().x;
1480
1485
  }
@@ -1525,10 +1530,10 @@ class Rs extends lt {
1525
1530
  return r2;
1526
1531
  }
1527
1532
  intersectsWithRect(t2, e3) {
1528
- return "Intersection" === Ls.intersectPolygonRectangle(this.getCoords(), t2, e3).status;
1533
+ return "Intersection" === Qs.intersectPolygonRectangle(this.getCoords(), t2, e3).status;
1529
1534
  }
1530
1535
  intersectsWithObject(t2) {
1531
- const e3 = Ls.intersectPolygonPolygon(this.getCoords(), t2.getCoords());
1536
+ const e3 = Qs.intersectPolygonPolygon(this.getCoords(), t2.getCoords());
1532
1537
  return "Intersection" === e3.status || "Coincident" === e3.status || t2.isContainedWithinObject(this) || this.isContainedWithinObject(t2);
1533
1538
  }
1534
1539
  isContainedWithinObject(t2) {
@@ -1542,7 +1547,7 @@ class Rs extends lt {
1542
1547
  return this.intersectsWithObject(t2) || this.isContainedWithinObject(t2) || t2.isContainedWithinObject(this);
1543
1548
  }
1544
1549
  containsPoint(t2) {
1545
- return Ls.isPointInPolygon(t2, this.getCoords());
1550
+ return Qs.isPointInPolygon(t2, this.getCoords());
1546
1551
  }
1547
1552
  isOnScreen() {
1548
1553
  if (!this.canvas) return false;
@@ -1556,7 +1561,7 @@ class Rs extends lt {
1556
1561
  return this.getCoords().every((s2) => (s2.x >= e3.x || s2.x <= t2.x) && (s2.y >= e3.y || s2.y <= t2.y)) && this.containsPoint(t2.midPointFrom(e3));
1557
1562
  }
1558
1563
  getBoundingRect() {
1559
- return ae(this.getCoords());
1564
+ return he(this.getCoords());
1560
1565
  }
1561
1566
  getScaledWidth() {
1562
1567
  return this._getTransformedDimensions().x;
@@ -1595,7 +1600,7 @@ class Rs extends lt {
1595
1600
  }
1596
1601
  transformMatrixKey() {
1597
1602
  let t2 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], e3 = [];
1598
- return !t2 && this.group && (e3 = this.group.transformMatrixKey(t2)), e3.push(this.top, this.left, this.width, this.height, this.scaleX, this.scaleY, this.angle, this.strokeWidth, this.skewX, this.skewY, +this.flipX, +this.flipY, xe(this.originX), xe(this.originY)), e3;
1603
+ return !t2 && this.group && (e3 = this.group.transformMatrixKey(t2)), e3.push(this.top, this.left, this.width, this.height, this.scaleX, this.scaleY, this.angle, this.strokeWidth, this.skewX, this.skewY, +this.flipX, +this.flipY, Ce(this.originX), Ce(this.originY)), e3;
1599
1604
  }
1600
1605
  calcTransformMatrix() {
1601
1606
  let t2 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], e3 = this.calcOwnMatrix();
@@ -1622,11 +1627,11 @@ class Rs extends lt {
1622
1627
  this.strokeUniform && (r2 = 0, n2 = i2);
1623
1628
  const o2 = e3.width + r2, a2 = e3.height + r2;
1624
1629
  let h2;
1625
- return h2 = 0 === e3.skewX && 0 === e3.skewY ? new ot(o2 * e3.scaleX, a2 * e3.scaleY) : ge(o2, a2, Lt(e3)), h2.scalarAdd(n2);
1630
+ return h2 = 0 === e3.skewX && 0 === e3.skewY ? new ot(o2 * e3.scaleX, a2 * e3.scaleY) : fe(o2, a2, Lt(e3)), h2.scalarAdd(n2);
1626
1631
  }
1627
1632
  translateToGivenOrigin(t2, e3, s2, i2, r2) {
1628
1633
  let n2 = t2.x, o2 = t2.y;
1629
- const a2 = xe(i2) - xe(e3), h2 = xe(r2) - xe(s2);
1634
+ const a2 = Ce(i2) - Ce(e3), h2 = Ce(r2) - Ce(s2);
1630
1635
  if (a2 || h2) {
1631
1636
  const t3 = this._getTransformedDimensions();
1632
1637
  n2 += a2 * t3.x, o2 += h2 * t3.y;
@@ -1660,8 +1665,8 @@ class Rs extends lt {
1660
1665
  return this.translateToOriginPoint(this.getRelativeCenterPoint(), M, P);
1661
1666
  }
1662
1667
  }
1663
- const Bs = ["type"], Is = ["extraParam"];
1664
- let Xs = class e2 extends Rs {
1668
+ const $s = ["type"], ti = ["extraParam"];
1669
+ let ei = class e2 extends Zs {
1665
1670
  static getDefaults() {
1666
1671
  return e2.ownDefaults;
1667
1672
  }
@@ -1681,7 +1686,7 @@ let Xs = class e2 extends Rs {
1681
1686
  _limitCacheSize(t2) {
1682
1687
  const e3 = t2.width, s2 = t2.height, i2 = o.maxCacheSideLimit, r2 = o.minCacheSideLimit;
1683
1688
  if (e3 <= i2 && s2 <= i2 && e3 * s2 <= o.perfLimitSizeTotal) return e3 < r2 && (t2.width = r2), s2 < r2 && (t2.height = r2), t2;
1684
- const n2 = e3 / s2, [a2, h2] = _.limitDimsByArea(n2), c2 = gs(r2, a2, i2), l2 = gs(r2, h2, i2);
1689
+ const n2 = e3 / s2, [a2, h2] = _.limitDimsByArea(n2), c2 = Ms(r2, a2, i2), l2 = Ms(r2, h2, i2);
1685
1690
  return e3 > c2 && (t2.zoomX /= e3 / c2, t2.width = c2, t2.capped = true), s2 > l2 && (t2.zoomY /= s2 / l2, t2.height = l2, t2.capped = true), t2;
1686
1691
  }
1687
1692
  _getCacheCanvasDimensions() {
@@ -1727,7 +1732,7 @@ let Xs = class e2 extends Rs {
1727
1732
  return Math.abs(t2) < this.minScaleLimit ? t2 < 0 ? -this.minScaleLimit : this.minScaleLimit : 0 === t2 ? 1e-4 : t2;
1728
1733
  }
1729
1734
  _set(t2, e3) {
1730
- t2 !== H && t2 !== N || (e3 = this._constrainScale(e3)), t2 === H && e3 < 0 ? (this.flipX = !this.flipX, e3 *= -1) : "scaleY" === t2 && e3 < 0 ? (this.flipY = !this.flipY, e3 *= -1) : "shadow" !== t2 || !e3 || e3 instanceof ds || (e3 = new ds(e3));
1735
+ t2 !== H && t2 !== N || (e3 = this._constrainScale(e3)), t2 === H && e3 < 0 ? (this.flipX = !this.flipX, e3 *= -1) : "scaleY" === t2 && e3 < 0 ? (this.flipY = !this.flipY, e3 *= -1) : "shadow" !== t2 || !e3 || e3 instanceof Ds || (e3 = new Ds(e3));
1731
1736
  const s2 = this[t2] !== e3;
1732
1737
  return this[t2] = e3, s2 && this.constructor.cacheProperties.includes(t2) && (this.dirty = true), this.parent && (this.dirty || s2 && this.constructor.stateProperties.includes(t2)) && this.parent._set("dirty", true), this;
1733
1738
  }
@@ -1865,8 +1870,8 @@ let Xs = class e2 extends Rs {
1865
1870
  }
1866
1871
  toCanvasElement() {
1867
1872
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
1868
- const e3 = de(this), s2 = this.group, i2 = this.shadow, r2 = Math.abs, n2 = t2.enableRetinaScaling ? y() : 1, o2 = (t2.multiplier || 1) * n2, a2 = t2.canvasProvider || ((t3) => new se(t3, { enableRetinaScaling: false, renderOnAddRemove: false, skipOffscreen: false }));
1869
- delete this.group, t2.withoutTransform && ue(this), t2.withoutShadow && (this.shadow = null), t2.viewportTransform && ve(this, this.getViewportTransform()), this.setCoords();
1873
+ const e3 = ge(this), s2 = this.group, i2 = this.shadow, r2 = Math.abs, n2 = t2.enableRetinaScaling ? y() : 1, o2 = (t2.multiplier || 1) * n2, a2 = t2.canvasProvider || ((t3) => new ie(t3, { enableRetinaScaling: false, renderOnAddRemove: false, skipOffscreen: false }));
1874
+ delete this.group, t2.withoutTransform && de(this), t2.withoutShadow && (this.shadow = null), t2.viewportTransform && ye(this, this.getViewportTransform()), this.setCoords();
1870
1875
  const h2 = pt(), c2 = this.getBoundingRect(), l2 = this.shadow, u2 = new ot();
1871
1876
  if (l2) {
1872
1877
  const t3 = l2.blur, e4 = l2.nonScaling ? new ot(1, 1) : this.getObjectScaling();
@@ -1931,7 +1936,7 @@ let Xs = class e2 extends Rs {
1931
1936
  }, onComplete: (t3, e4, s2) => {
1932
1937
  this.setCoords(), c2 && c2(t3, e4, s2);
1933
1938
  } });
1934
- return n2 ? Fs(l2) : js(l2);
1939
+ return n2 ? Js(l2) : Ks(l2);
1935
1940
  }
1936
1941
  isDescendantOf(t2) {
1937
1942
  const { parent: e3, group: s2 } = this;
@@ -1977,8 +1982,8 @@ let Xs = class e2 extends Rs {
1977
1982
  let i2;
1978
1983
  const r2 = o.NUM_FRACTION_DIGITS, { clipPath: n2, fill: a2, stroke: h2, shadow: c2, strokeDashArray: l2, left: u2, top: d2, originX: g2, originY: f, width: p2, height: m2, strokeWidth: v2, strokeLineCap: y2, strokeDashOffset: _2, strokeLineJoin: C2, strokeUniform: b2, strokeMiterLimit: S2, scaleX: w2, scaleY: T2, angle: O2, flipX: k2, flipY: D2, opacity: M2, visible: P2, backgroundColor: E2, fillRule: A2, paintFirst: j2, globalCompositeOperation: F2, skewX: L2, skewY: R2 } = this;
1979
1984
  n2 && !n2.excludeFromExport && (i2 = n2.toObject(t2.concat("inverted", "absolutePositioned")));
1980
- const B2 = (t3) => Vt(t3, r2), I2 = s(s({}, Yt(this, t2)), {}, { type: this.constructor.type, version: x, originX: g2, originY: f, left: B2(u2), top: B2(d2), width: B2(p2), height: B2(m2), fill: Ht(a2) ? a2.toObject() : a2, stroke: Ht(h2) ? h2.toObject() : h2, strokeWidth: B2(v2), strokeDashArray: l2 ? l2.concat() : l2, strokeLineCap: y2, strokeDashOffset: _2, strokeLineJoin: C2, strokeUniform: b2, strokeMiterLimit: B2(S2), scaleX: B2(w2), scaleY: B2(T2), angle: B2(O2), flipX: k2, flipY: D2, opacity: B2(M2), shadow: c2 ? c2.toObject() : c2, visible: P2, backgroundColor: E2, fillRule: A2, paintFirst: j2, globalCompositeOperation: F2, skewX: B2(L2), skewY: B2(R2) }, i2 ? { clipPath: i2 } : null);
1981
- return this.includeDefaultValues ? I2 : this._removeDefaultValues(I2);
1985
+ const I2 = (t3) => Vt(t3, r2), B2 = s(s({}, Yt(this, t2)), {}, { type: this.constructor.type, version: x, originX: g2, originY: f, left: I2(u2), top: I2(d2), width: I2(p2), height: I2(m2), fill: Ht(a2) ? a2.toObject() : a2, stroke: Ht(h2) ? h2.toObject() : h2, strokeWidth: I2(v2), strokeDashArray: l2 ? l2.concat() : l2, strokeLineCap: y2, strokeDashOffset: _2, strokeLineJoin: C2, strokeUniform: b2, strokeMiterLimit: I2(S2), scaleX: I2(w2), scaleY: I2(T2), angle: I2(O2), flipX: k2, flipY: D2, opacity: I2(M2), shadow: c2 ? c2.toObject() : c2, visible: P2, backgroundColor: E2, fillRule: A2, paintFirst: j2, globalCompositeOperation: F2, skewX: I2(L2), skewY: I2(R2) }, i2 ? { clipPath: i2 } : null);
1986
+ return this.includeDefaultValues ? B2 : this._removeDefaultValues(B2);
1982
1987
  }
1983
1988
  toDatalessObject(t2) {
1984
1989
  return this.toObject(t2);
@@ -1995,53 +2000,53 @@ let Xs = class e2 extends Rs {
1995
2000
  return "#<".concat(this.constructor.type, ">");
1996
2001
  }
1997
2002
  static _fromObject(t2) {
1998
- let e3 = i(t2, Bs), s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { extraParam: r2 } = s2, n2 = i(s2, Is);
2003
+ let e3 = i(t2, $s), s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { extraParam: r2 } = s2, n2 = i(s2, ti);
1999
2004
  return Xt(e3, n2).then((t3) => r2 ? (delete t3[r2], new this(e3[r2], t3)) : new this(t3));
2000
2005
  }
2001
2006
  static fromObject(t2, e3) {
2002
2007
  return this._fromObject(t2, e3);
2003
2008
  }
2004
2009
  };
2005
- t(Xs, "stateProperties", fs), t(Xs, "cacheProperties", ps), t(Xs, "ownDefaults", ms), t(Xs, "type", "FabricObject"), t(Xs, "colorProperties", [K, J, "backgroundColor"]), t(Xs, "customProperties", []), tt.setClass(Xs), tt.setClass(Xs, "object");
2006
- const Ys = (t2, e3, i2) => (r2, n2, o2, a2) => {
2010
+ t(ei, "stateProperties", Ps), t(ei, "cacheProperties", Es), t(ei, "ownDefaults", As), t(ei, "type", "FabricObject"), t(ei, "colorProperties", [K, J, "backgroundColor"]), t(ei, "customProperties", []), tt.setClass(ei), tt.setClass(ei, "object");
2011
+ const si = (t2, e3, i2) => (r2, n2, o2, a2) => {
2007
2012
  const h2 = e3(r2, n2, o2, a2);
2008
- return h2 && ye(t2, s(s({}, Te(r2, n2, o2, a2)), i2)), h2;
2013
+ return h2 && _e(t2, s(s({}, Oe(r2, n2, o2, a2)), i2)), h2;
2009
2014
  };
2010
- function Ws(t2) {
2015
+ function ii(t2) {
2011
2016
  return (e3, s2, i2, r2) => {
2012
2017
  const { target: n2, originX: o2, originY: a2 } = s2, h2 = n2.getRelativeCenterPoint(), c2 = n2.translateToOriginPoint(h2, o2, a2), l2 = t2(e3, s2, i2, r2);
2013
2018
  return n2.setPositionByOrigin(c2, s2.originX, s2.originY), l2;
2014
2019
  };
2015
2020
  }
2016
- const Vs = Ys(Y, Ws((t2, e3, s2, i2) => {
2017
- const r2 = ke(e3, e3.originX, e3.originY, s2, i2);
2018
- if (xe(e3.originX) === xe(D) || xe(e3.originX) === xe(A) && r2.x < 0 || xe(e3.originX) === xe(M) && r2.x > 0) {
2019
- const { target: t3 } = e3, s3 = t3.strokeWidth / (t3.strokeUniform ? t3.scaleX : 1), i3 = be(e3) ? 2 : 1, n2 = t3.width, o2 = Math.abs(r2.x * i3 / t3.scaleX) - s3;
2021
+ const ri = si(Y, ii((t2, e3, s2, i2) => {
2022
+ const r2 = De(e3, e3.originX, e3.originY, s2, i2);
2023
+ if (Ce(e3.originX) === Ce(D) || Ce(e3.originX) === Ce(A) && r2.x < 0 || Ce(e3.originX) === Ce(M) && r2.x > 0) {
2024
+ const { target: t3 } = e3, s3 = t3.strokeWidth / (t3.strokeUniform ? t3.scaleX : 1), i3 = Se(e3) ? 2 : 1, n2 = t3.width, o2 = Math.abs(r2.x * i3 / t3.scaleX) - s3;
2020
2025
  return t3.set("width", Math.max(o2, 1)), n2 !== t3.width;
2021
2026
  }
2022
2027
  return false;
2023
2028
  }));
2024
- function zs(t2, e3, s2, i2, r2) {
2029
+ function ni(t2, e3, s2, i2, r2) {
2025
2030
  i2 = i2 || {};
2026
2031
  const n2 = this.sizeX || i2.cornerSize || r2.cornerSize, o2 = this.sizeY || i2.cornerSize || r2.cornerSize, a2 = void 0 !== i2.transparentCorners ? i2.transparentCorners : r2.transparentCorners, h2 = a2 ? J : K, c2 = !a2 && (i2.cornerStrokeColor || r2.cornerStrokeColor);
2027
2032
  let l2, u2 = e3, d2 = s2;
2028
2033
  t2.save(), t2.fillStyle = i2.cornerColor || r2.cornerColor || "", t2.strokeStyle = i2.cornerStrokeColor || r2.cornerStrokeColor || "", n2 > o2 ? (l2 = n2, t2.scale(1, o2 / n2), d2 = s2 * n2 / o2) : o2 > n2 ? (l2 = o2, t2.scale(n2 / o2, 1), u2 = e3 * o2 / n2) : l2 = n2, t2.beginPath(), t2.arc(u2, d2, l2 / 2, 0, S, false), t2[h2](), c2 && t2.stroke(), t2.restore();
2029
2034
  }
2030
- function Gs(t2, e3, s2, i2, r2) {
2035
+ function oi(t2, e3, s2, i2, r2) {
2031
2036
  i2 = i2 || {};
2032
2037
  const n2 = this.sizeX || i2.cornerSize || r2.cornerSize, o2 = this.sizeY || i2.cornerSize || r2.cornerSize, a2 = void 0 !== i2.transparentCorners ? i2.transparentCorners : r2.transparentCorners, h2 = a2 ? J : K, c2 = !a2 && (i2.cornerStrokeColor || r2.cornerStrokeColor), l2 = n2 / 2, u2 = o2 / 2;
2033
2038
  t2.save(), t2.fillStyle = i2.cornerColor || r2.cornerColor || "", t2.strokeStyle = i2.cornerStrokeColor || r2.cornerStrokeColor || "", t2.translate(e3, s2);
2034
2039
  const d2 = r2.getTotalAngle();
2035
2040
  t2.rotate(xt(d2)), t2["".concat(h2, "Rect")](-l2, -u2, n2, o2), c2 && t2.strokeRect(-l2, -u2, n2, o2), t2.restore();
2036
2041
  }
2037
- class Hs {
2042
+ class ai {
2038
2043
  constructor(e3) {
2039
2044
  t(this, "visible", true), t(this, "actionName", G), t(this, "angle", 0), t(this, "x", 0), t(this, "y", 0), t(this, "offsetX", 0), t(this, "offsetY", 0), t(this, "sizeX", 0), t(this, "sizeY", 0), t(this, "touchSizeX", 0), t(this, "touchSizeY", 0), t(this, "cursorStyle", "crosshair"), t(this, "withConnection", false), Object.assign(this, e3);
2040
2045
  }
2041
2046
  shouldActivate(t2, e3, s2, i2) {
2042
2047
  var r2;
2043
2048
  let { tl: n2, tr: o2, br: a2, bl: h2 } = i2;
2044
- return (null === (r2 = e3.canvas) || void 0 === r2 ? void 0 : r2.getActiveObject()) === e3 && e3.isControlVisible(t2) && Ls.isPointInPolygon(s2, [n2, o2, a2, h2]);
2049
+ return (null === (r2 = e3.canvas) || void 0 === r2 ? void 0 : r2.getActiveObject()) === e3 && e3.isControlVisible(t2) && Qs.isPointInPolygon(s2, [n2, o2, a2, h2]);
2045
2050
  }
2046
2051
  getActionHandler(t2, e3, s2) {
2047
2052
  return this.actionHandler;
@@ -2073,14 +2078,14 @@ class Hs {
2073
2078
  return { tl: new ot(-0.5, -0.5).transform(o2), tr: new ot(0.5, -0.5).transform(o2), br: new ot(0.5, 0.5).transform(o2), bl: new ot(-0.5, 0.5).transform(o2) };
2074
2079
  }
2075
2080
  render(t2, e3, s2, i2, r2) {
2076
- if ("circle" === ((i2 = i2 || {}).cornerStyle || r2.cornerStyle)) zs.call(this, t2, e3, s2, i2, r2);
2077
- else Gs.call(this, t2, e3, s2, i2, r2);
2081
+ if ("circle" === ((i2 = i2 || {}).cornerStyle || r2.cornerStyle)) ni.call(this, t2, e3, s2, i2, r2);
2082
+ else oi.call(this, t2, e3, s2, i2, r2);
2078
2083
  }
2079
2084
  }
2080
- const Ns = (t2, e3, s2) => s2.lockRotation ? Ce : e3.cursorStyle, Us = Ys(B, Ws((t2, e3, s2, i2) => {
2085
+ const hi = (t2, e3, s2) => s2.lockRotation ? be : e3.cursorStyle, ci = si(I, ii((t2, e3, s2, i2) => {
2081
2086
  let { target: r2, ex: n2, ey: o2, theta: a2, originX: h2, originY: c2 } = e3;
2082
2087
  const l2 = r2.translateToOriginPoint(r2.getRelativeCenterPoint(), h2, c2);
2083
- if (we(r2, "lockRotation")) return false;
2088
+ if (Te(r2, "lockRotation")) return false;
2084
2089
  const u2 = Math.atan2(o2 - l2.y, n2 - l2.x), d2 = Math.atan2(i2 - l2.y, s2 - l2.x);
2085
2090
  let g2 = Ct(d2 - u2 + a2);
2086
2091
  if (r2.snapAngle && r2.snapAngle > 0) {
@@ -2091,12 +2096,12 @@ const Ns = (t2, e3, s2) => s2.lockRotation ? Ce : e3.cursorStyle, Us = Ys(B, Ws(
2091
2096
  const f = r2.angle !== g2;
2092
2097
  return r2.angle = g2, f;
2093
2098
  }));
2094
- function qs(t2, e3) {
2099
+ function li(t2, e3) {
2095
2100
  const s2 = e3.canvas, i2 = t2[s2.uniScaleKey];
2096
2101
  return s2.uniformScaling && !i2 || !s2.uniformScaling && i2;
2097
2102
  }
2098
- function Ks(t2, e3, s2) {
2099
- const i2 = we(t2, "lockScalingX"), r2 = we(t2, "lockScalingY");
2103
+ function ui(t2, e3, s2) {
2104
+ const i2 = Te(t2, "lockScalingX"), r2 = Te(t2, "lockScalingY");
2100
2105
  if (i2 && r2) return true;
2101
2106
  if (!e3 && (i2 || r2) && s2) return true;
2102
2107
  if (i2 && "x" === e3) return true;
@@ -2104,41 +2109,41 @@ function Ks(t2, e3, s2) {
2104
2109
  const { width: n2, height: o2, strokeWidth: a2 } = t2;
2105
2110
  return 0 === n2 && 0 === a2 && "y" !== e3 || 0 === o2 && 0 === a2 && "x" !== e3;
2106
2111
  }
2107
- const Js = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"], Qs = (t2, e3, s2) => {
2108
- const i2 = qs(t2, s2);
2109
- if (Ks(s2, 0 !== e3.x && 0 === e3.y ? "x" : 0 === e3.x && 0 !== e3.y ? "y" : "", i2)) return Ce;
2110
- const r2 = Oe(s2, e3);
2111
- return "".concat(Js[r2], "-resize");
2112
+ const di = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"], gi = (t2, e3, s2) => {
2113
+ const i2 = li(t2, s2);
2114
+ if (ui(s2, 0 !== e3.x && 0 === e3.y ? "x" : 0 === e3.x && 0 !== e3.y ? "y" : "", i2)) return be;
2115
+ const r2 = ke(s2, e3);
2116
+ return "".concat(di[r2], "-resize");
2112
2117
  };
2113
- function Zs(t2, e3, s2, i2) {
2118
+ function fi(t2, e3, s2, i2) {
2114
2119
  let r2 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {};
2115
- const n2 = e3.target, o2 = r2.by, a2 = qs(t2, n2);
2120
+ const n2 = e3.target, o2 = r2.by, a2 = li(t2, n2);
2116
2121
  let h2, c2, l2, u2, d2, g2;
2117
- if (Ks(n2, o2, a2)) return false;
2122
+ if (ui(n2, o2, a2)) return false;
2118
2123
  if (e3.gestureScale) c2 = e3.scaleX * e3.gestureScale, l2 = e3.scaleY * e3.gestureScale;
2119
2124
  else {
2120
- if (h2 = ke(e3, e3.originX, e3.originY, s2, i2), d2 = "y" !== o2 ? Math.sign(h2.x || e3.signX || 1) : 1, g2 = "x" !== o2 ? Math.sign(h2.y || e3.signY || 1) : 1, e3.signX || (e3.signX = d2), e3.signY || (e3.signY = g2), we(n2, "lockScalingFlip") && (e3.signX !== d2 || e3.signY !== g2)) return false;
2125
+ if (h2 = De(e3, e3.originX, e3.originY, s2, i2), d2 = "y" !== o2 ? Math.sign(h2.x || e3.signX || 1) : 1, g2 = "x" !== o2 ? Math.sign(h2.y || e3.signY || 1) : 1, e3.signX || (e3.signX = d2), e3.signY || (e3.signY = g2), Te(n2, "lockScalingFlip") && (e3.signX !== d2 || e3.signY !== g2)) return false;
2121
2126
  if (u2 = n2._getTransformedDimensions(), a2 && !o2) {
2122
2127
  const t3 = Math.abs(h2.x) + Math.abs(h2.y), { original: s3 } = e3, i3 = t3 / (Math.abs(u2.x * s3.scaleX / n2.scaleX) + Math.abs(u2.y * s3.scaleY / n2.scaleY));
2123
2128
  c2 = s3.scaleX * i3, l2 = s3.scaleY * i3;
2124
2129
  } else c2 = Math.abs(h2.x * n2.scaleX / u2.x), l2 = Math.abs(h2.y * n2.scaleY / u2.y);
2125
- be(e3) && (c2 *= 2, l2 *= 2), e3.signX !== d2 && "y" !== o2 && (e3.originX = Se(e3.originX), c2 *= -1, e3.signX = d2), e3.signY !== g2 && "x" !== o2 && (e3.originY = Se(e3.originY), l2 *= -1, e3.signY = g2);
2130
+ Se(e3) && (c2 *= 2, l2 *= 2), e3.signX !== d2 && "y" !== o2 && (e3.originX = we(e3.originX), c2 *= -1, e3.signX = d2), e3.signY !== g2 && "x" !== o2 && (e3.originY = we(e3.originY), l2 *= -1, e3.signY = g2);
2126
2131
  }
2127
2132
  const f = n2.scaleX, p2 = n2.scaleY;
2128
- return o2 ? ("x" === o2 && n2.set(H, c2), "y" === o2 && n2.set(N, l2)) : (!we(n2, "lockScalingX") && n2.set(H, c2), !we(n2, "lockScalingY") && n2.set(N, l2)), f !== n2.scaleX || p2 !== n2.scaleY;
2133
+ return o2 ? ("x" === o2 && n2.set(H, c2), "y" === o2 && n2.set(N, l2)) : (!Te(n2, "lockScalingX") && n2.set(H, c2), !Te(n2, "lockScalingY") && n2.set(N, l2)), f !== n2.scaleX || p2 !== n2.scaleY;
2129
2134
  }
2130
- const $s = Ys(R, Ws((t2, e3, s2, i2) => Zs(t2, e3, s2, i2))), ti = Ys(R, Ws((t2, e3, s2, i2) => Zs(t2, e3, s2, i2, { by: "x" }))), ei = Ys(R, Ws((t2, e3, s2, i2) => Zs(t2, e3, s2, i2, { by: "y" }))), si = ["target", "ex", "ey", "skewingSide"], ii = { x: { counterAxis: "y", scale: H, skew: U, lockSkewing: "lockSkewingX", origin: "originX", flip: "flipX" }, y: { counterAxis: "x", scale: N, skew: q, lockSkewing: "lockSkewingY", origin: "originY", flip: "flipY" } }, ri = ["ns", "nesw", "ew", "nwse"], ni = (t2, e3, s2) => {
2131
- if (0 !== e3.x && we(s2, "lockSkewingY")) return Ce;
2132
- if (0 !== e3.y && we(s2, "lockSkewingX")) return Ce;
2133
- const i2 = Oe(s2, e3) % 4;
2134
- return "".concat(ri[i2], "-resize");
2135
+ const pi = si(R, ii((t2, e3, s2, i2) => fi(t2, e3, s2, i2))), mi = si(R, ii((t2, e3, s2, i2) => fi(t2, e3, s2, i2, { by: "x" }))), vi = si(R, ii((t2, e3, s2, i2) => fi(t2, e3, s2, i2, { by: "y" }))), yi = ["target", "ex", "ey", "skewingSide"], _i = { x: { counterAxis: "y", scale: H, skew: U, lockSkewing: "lockSkewingX", origin: "originX", flip: "flipX" }, y: { counterAxis: "x", scale: N, skew: q, lockSkewing: "lockSkewingY", origin: "originY", flip: "flipY" } }, xi = ["ns", "nesw", "ew", "nwse"], Ci = (t2, e3, s2) => {
2136
+ if (0 !== e3.x && Te(s2, "lockSkewingY")) return be;
2137
+ if (0 !== e3.y && Te(s2, "lockSkewingX")) return be;
2138
+ const i2 = ke(s2, e3) % 4;
2139
+ return "".concat(xi[i2], "-resize");
2135
2140
  };
2136
- function oi(t2, e3, r2, n2, o2) {
2137
- const { target: a2 } = r2, { counterAxis: h2, origin: c2, lockSkewing: l2, skew: u2, flip: d2 } = ii[t2];
2138
- if (we(a2, l2)) return false;
2139
- const { origin: g2, flip: f } = ii[h2], p2 = xe(r2[g2]) * (a2[f] ? -1 : 1), m2 = -Math.sign(p2) * (a2[d2] ? -1 : 1), v2 = 0.5 * -((0 === a2[u2] && ke(r2, D, D, n2, o2)[t2] > 0 || a2[u2] > 0 ? 1 : -1) * m2) + 0.5, y2 = Ys(X, Ws((e4, s2, r3, n3) => function(t3, e5, s3) {
2140
- let { target: r4, ex: n4, ey: o3, skewingSide: a3 } = e5, h3 = i(e5, si);
2141
- const { skew: c3 } = ii[t3], l3 = s3.subtract(new ot(n4, o3)).divide(new ot(r4.scaleX, r4.scaleY))[t3], u3 = r4[c3], d3 = h3[c3], g3 = Math.tan(xt(d3)), f2 = "y" === t3 ? r4._getTransformedDimensions({ scaleX: 1, scaleY: 1, skewX: 0 }).x : r4._getTransformedDimensions({ scaleX: 1, scaleY: 1 }).y, p3 = 2 * l3 * a3 / Math.max(f2, 1) + g3, m3 = Ct(Math.atan(p3));
2141
+ function bi(t2, e3, r2, n2, o2) {
2142
+ const { target: a2 } = r2, { counterAxis: h2, origin: c2, lockSkewing: l2, skew: u2, flip: d2 } = _i[t2];
2143
+ if (Te(a2, l2)) return false;
2144
+ const { origin: g2, flip: f } = _i[h2], p2 = Ce(r2[g2]) * (a2[f] ? -1 : 1), m2 = -Math.sign(p2) * (a2[d2] ? -1 : 1), v2 = 0.5 * -((0 === a2[u2] && De(r2, D, D, n2, o2)[t2] > 0 || a2[u2] > 0 ? 1 : -1) * m2) + 0.5, y2 = si(X, ii((e4, s2, r3, n3) => function(t3, e5, s3) {
2145
+ let { target: r4, ex: n4, ey: o3, skewingSide: a3 } = e5, h3 = i(e5, yi);
2146
+ const { skew: c3 } = _i[t3], l3 = s3.subtract(new ot(n4, o3)).divide(new ot(r4.scaleX, r4.scaleY))[t3], u3 = r4[c3], d3 = h3[c3], g3 = Math.tan(xt(d3)), f2 = "y" === t3 ? r4._getTransformedDimensions({ scaleX: 1, scaleY: 1, skewX: 0 }).x : r4._getTransformedDimensions({ scaleX: 1, scaleY: 1 }).y, p3 = 2 * l3 * a3 / Math.max(f2, 1) + g3, m3 = Ct(Math.atan(p3));
2142
2147
  r4.set(c3, m3);
2143
2148
  const v3 = u3 !== r4[c3];
2144
2149
  if (v3 && "y" === t3) {
@@ -2149,23 +2154,23 @@ function oi(t2, e3, r2, n2, o2) {
2149
2154
  }(t2, s2, new ot(r3, n3))));
2150
2155
  return y2(e3, s(s({}, r2), {}, { [c2]: v2, skewingSide: m2 }), n2, o2);
2151
2156
  }
2152
- const ai = (t2, e3, s2, i2) => oi("x", t2, e3, s2, i2), hi = (t2, e3, s2, i2) => oi("y", t2, e3, s2, i2);
2153
- function ci(t2, e3) {
2157
+ const Si = (t2, e3, s2, i2) => bi("x", t2, e3, s2, i2), wi = (t2, e3, s2, i2) => bi("y", t2, e3, s2, i2);
2158
+ function Ti(t2, e3) {
2154
2159
  return t2[e3.canvas.altActionKey];
2155
2160
  }
2156
- const li = (t2, e3, s2) => {
2157
- const i2 = ci(t2, s2);
2161
+ const Oi = (t2, e3, s2) => {
2162
+ const i2 = Ti(t2, s2);
2158
2163
  return 0 === e3.x ? i2 ? U : N : 0 === e3.y ? i2 ? q : H : "";
2159
- }, ui = (t2, e3, s2) => ci(t2, s2) ? ni(0, e3, s2) : Qs(t2, e3, s2), di = (t2, e3, s2, i2) => ci(t2, e3.target) ? hi(t2, e3, s2, i2) : ti(t2, e3, s2, i2), gi = (t2, e3, s2, i2) => ci(t2, e3.target) ? ai(t2, e3, s2, i2) : ei(t2, e3, s2, i2), fi = () => ({ ml: new Hs({ x: -0.5, y: 0, cursorStyleHandler: ui, actionHandler: di, getActionName: li }), mr: new Hs({ x: 0.5, y: 0, cursorStyleHandler: ui, actionHandler: di, getActionName: li }), mb: new Hs({ x: 0, y: 0.5, cursorStyleHandler: ui, actionHandler: gi, getActionName: li }), mt: new Hs({ x: 0, y: -0.5, cursorStyleHandler: ui, actionHandler: gi, getActionName: li }), tl: new Hs({ x: -0.5, y: -0.5, cursorStyleHandler: Qs, actionHandler: $s }), tr: new Hs({ x: 0.5, y: -0.5, cursorStyleHandler: Qs, actionHandler: $s }), bl: new Hs({ x: -0.5, y: 0.5, cursorStyleHandler: Qs, actionHandler: $s }), br: new Hs({ x: 0.5, y: 0.5, cursorStyleHandler: Qs, actionHandler: $s }), mtr: new Hs({ x: 0, y: -0.5, actionHandler: Us, cursorStyleHandler: Ns, offsetY: -40, withConnection: true, actionName: I }) }), pi = () => ({ mr: new Hs({ x: 0.5, y: 0, actionHandler: Vs, cursorStyleHandler: ui, actionName: Y }), ml: new Hs({ x: -0.5, y: 0, actionHandler: Vs, cursorStyleHandler: ui, actionName: Y }) }), mi = () => s(s({}, fi()), pi());
2160
- class vi extends Xs {
2164
+ }, ki = (t2, e3, s2) => Ti(t2, s2) ? Ci(0, e3, s2) : gi(t2, e3, s2), Di = (t2, e3, s2, i2) => Ti(t2, e3.target) ? wi(t2, e3, s2, i2) : mi(t2, e3, s2, i2), Mi = (t2, e3, s2, i2) => Ti(t2, e3.target) ? Si(t2, e3, s2, i2) : vi(t2, e3, s2, i2), Pi = () => ({ ml: new ai({ x: -0.5, y: 0, cursorStyleHandler: ki, actionHandler: Di, getActionName: Oi }), mr: new ai({ x: 0.5, y: 0, cursorStyleHandler: ki, actionHandler: Di, getActionName: Oi }), mb: new ai({ x: 0, y: 0.5, cursorStyleHandler: ki, actionHandler: Mi, getActionName: Oi }), mt: new ai({ x: 0, y: -0.5, cursorStyleHandler: ki, actionHandler: Mi, getActionName: Oi }), tl: new ai({ x: -0.5, y: -0.5, cursorStyleHandler: gi, actionHandler: pi }), tr: new ai({ x: 0.5, y: -0.5, cursorStyleHandler: gi, actionHandler: pi }), bl: new ai({ x: -0.5, y: 0.5, cursorStyleHandler: gi, actionHandler: pi }), br: new ai({ x: 0.5, y: 0.5, cursorStyleHandler: gi, actionHandler: pi }), mtr: new ai({ x: 0, y: -0.5, actionHandler: ci, cursorStyleHandler: hi, offsetY: -40, withConnection: true, actionName: B }) }), Ei = () => ({ mr: new ai({ x: 0.5, y: 0, actionHandler: ri, cursorStyleHandler: ki, actionName: Y }), ml: new ai({ x: -0.5, y: 0, actionHandler: ri, cursorStyleHandler: ki, actionName: Y }) }), Ai = () => s(s({}, Pi()), Ei());
2165
+ class ji extends ei {
2161
2166
  static getDefaults() {
2162
- return s(s({}, super.getDefaults()), vi.ownDefaults);
2167
+ return s(s({}, super.getDefaults()), ji.ownDefaults);
2163
2168
  }
2164
2169
  constructor(t2) {
2165
- super(), Object.assign(this, this.constructor.createControls(), vi.ownDefaults), this.setOptions(t2);
2170
+ super(), Object.assign(this, this.constructor.createControls(), ji.ownDefaults), this.setOptions(t2);
2166
2171
  }
2167
2172
  static createControls() {
2168
- return { controls: fi() };
2173
+ return { controls: Pi() };
2169
2174
  }
2170
2175
  _updateCacheCanvas() {
2171
2176
  const t2 = this.canvas;
@@ -2230,7 +2235,7 @@ class vi extends Xs {
2230
2235
  drawBorders(t2, e3, s2) {
2231
2236
  let i2;
2232
2237
  if (s2 && s2.forActiveSelection || this.group) {
2233
- const t3 = ge(this.width, this.height, Lt(e3)), s3 = this.isStrokeAccountedForInDimensions() ? at : (this.strokeUniform ? new ot().scalarAdd(this.canvas ? this.canvas.getZoom() : 1) : new ot(e3.scaleX, e3.scaleY)).scalarMultiply(this.strokeWidth);
2238
+ const t3 = fe(this.width, this.height, Lt(e3)), s3 = this.isStrokeAccountedForInDimensions() ? at : (this.strokeUniform ? new ot().scalarAdd(this.canvas ? this.canvas.getZoom() : 1) : new ot(e3.scaleX, e3.scaleY)).scalarMultiply(this.strokeWidth);
2234
2239
  i2 = t3.add(s3).scalarAdd(this.borderScaleFactor).scalarAdd(2 * this.padding);
2235
2240
  } else i2 = this._calculateCurrentDimensions().scalarAdd(this.borderScaleFactor);
2236
2241
  this._drawBorders(t2, i2, s2);
@@ -2294,30 +2299,30 @@ class vi extends Xs {
2294
2299
  renderDropTargetEffect(t2) {
2295
2300
  }
2296
2301
  }
2297
- function yi(t2, e3) {
2302
+ function Fi(t2, e3) {
2298
2303
  return e3.forEach((e4) => {
2299
2304
  Object.getOwnPropertyNames(e4.prototype).forEach((s2) => {
2300
2305
  "constructor" !== s2 && Object.defineProperty(t2.prototype, s2, Object.getOwnPropertyDescriptor(e4.prototype, s2) || /* @__PURE__ */ Object.create(null));
2301
2306
  });
2302
2307
  }), t2;
2303
2308
  }
2304
- t(vi, "ownDefaults", { noScaleCache: true, lockMovementX: false, lockMovementY: false, lockRotation: false, lockScalingX: false, lockScalingY: false, lockSkewingX: false, lockSkewingY: false, lockScalingFlip: false, cornerSize: 13, touchCornerSize: 24, transparentCorners: true, cornerColor: "rgb(178,204,255)", cornerStrokeColor: "", cornerStyle: "rect", cornerDashArray: null, hasControls: true, borderColor: "rgb(178,204,255)", borderDashArray: null, borderOpacityWhenMoving: 0.4, borderScaleFactor: 1, hasBorders: true, selectionBackgroundColor: "", selectable: true, evented: true, perPixelTargetFind: false, activeOn: "down", hoverCursor: null, moveCursor: null });
2305
- class _i extends vi {
2309
+ t(ji, "ownDefaults", { noScaleCache: true, lockMovementX: false, lockMovementY: false, lockRotation: false, lockScalingX: false, lockScalingY: false, lockSkewingX: false, lockSkewingY: false, lockScalingFlip: false, cornerSize: 13, touchCornerSize: 24, transparentCorners: true, cornerColor: "rgb(178,204,255)", cornerStrokeColor: "", cornerStyle: "rect", cornerDashArray: null, hasControls: true, borderColor: "rgb(178,204,255)", borderDashArray: null, borderOpacityWhenMoving: 0.4, borderScaleFactor: 1, hasBorders: true, selectionBackgroundColor: "", selectable: true, evented: true, perPixelTargetFind: false, activeOn: "down", hoverCursor: null, moveCursor: null });
2310
+ class Li extends ji {
2306
2311
  }
2307
- yi(_i, [Xe]), tt.setClass(_i), tt.setClass(_i, "object");
2308
- const xi = (t2, e3, s2, i2) => {
2312
+ Fi(Li, [We]), tt.setClass(Li), tt.setClass(Li, "object");
2313
+ const Ri = (t2, e3, s2, i2) => {
2309
2314
  const r2 = 2 * (i2 = Math.round(i2)) + 1, { data: n2 } = t2.getImageData(e3 - i2, s2 - i2, r2, r2);
2310
2315
  for (let t3 = 3; t3 < n2.length; t3 += 4) {
2311
2316
  if (n2[t3] > 0) return false;
2312
2317
  }
2313
2318
  return true;
2314
2319
  };
2315
- class Ci {
2320
+ class Ii {
2316
2321
  constructor(t2) {
2317
2322
  this.options = t2, this.strokeProjectionMagnitude = this.options.strokeWidth / 2, this.scale = new ot(this.options.scaleX, this.options.scaleY), this.strokeUniformScalar = this.options.strokeUniform ? new ot(1 / this.options.scaleX, 1 / this.options.scaleY) : new ot(1, 1);
2318
2323
  }
2319
2324
  createSideVector(t2, e3) {
2320
- const s2 = es(t2, e3);
2325
+ const s2 = vs(t2, e3);
2321
2326
  return this.options.strokeUniform ? s2.multiply(this.scale) : s2;
2322
2327
  }
2323
2328
  projectOrthogonally(t2, e3, s2) {
@@ -2334,18 +2339,18 @@ class Ci {
2334
2339
  return t2.multiply(this.strokeUniformScalar).scalarMultiply(e3);
2335
2340
  }
2336
2341
  }
2337
- const bi = new ot();
2338
- class Si extends Ci {
2342
+ const Bi = new ot();
2343
+ class Xi extends Ii {
2339
2344
  static getOrthogonalRotationFactor(t2, e3) {
2340
- const s2 = e3 ? is(t2, e3) : rs(t2);
2345
+ const s2 = e3 ? _s(t2, e3) : xs(t2);
2341
2346
  return Math.abs(s2) < b ? -1 : 1;
2342
2347
  }
2343
2348
  constructor(e3, s2, i2, r2) {
2344
- super(r2), t(this, "AB", void 0), t(this, "AC", void 0), t(this, "alpha", void 0), t(this, "bisector", void 0), this.A = new ot(e3), this.B = new ot(s2), this.C = new ot(i2), this.AB = this.createSideVector(this.A, this.B), this.AC = this.createSideVector(this.A, this.C), this.alpha = is(this.AB, this.AC), this.bisector = ns(ts(this.AB.eq(bi) ? this.AC : this.AB, this.alpha / 2));
2349
+ super(r2), t(this, "AB", void 0), t(this, "AC", void 0), t(this, "alpha", void 0), t(this, "bisector", void 0), this.A = new ot(e3), this.B = new ot(s2), this.C = new ot(i2), this.AB = this.createSideVector(this.A, this.B), this.AC = this.createSideVector(this.A, this.C), this.alpha = _s(this.AB, this.AC), this.bisector = Cs(ms(this.AB.eq(Bi) ? this.AC : this.AB, this.alpha / 2));
2345
2350
  }
2346
2351
  calcOrthogonalProjection(t2, e3) {
2347
2352
  let s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.strokeProjectionMagnitude;
2348
- const i2 = this.createSideVector(t2, e3), r2 = os(i2), n2 = Si.getOrthogonalRotationFactor(r2, this.bisector);
2353
+ const i2 = this.createSideVector(t2, e3), r2 = bs(i2), n2 = Xi.getOrthogonalRotationFactor(r2, this.bisector);
2349
2354
  return this.scaleUnitVector(r2, s2 * n2);
2350
2355
  }
2351
2356
  projectBevel() {
@@ -2355,25 +2360,25 @@ class Si extends Ci {
2355
2360
  }), t2;
2356
2361
  }
2357
2362
  projectMiter() {
2358
- const t2 = [], e3 = Math.abs(this.alpha), s2 = 1 / Math.sin(e3 / 2), i2 = this.scaleUnitVector(this.bisector, -this.strokeProjectionMagnitude * s2), r2 = this.options.strokeUniform ? ss(this.scaleUnitVector(this.bisector, this.options.strokeMiterLimit)) : this.options.strokeMiterLimit;
2359
- return ss(i2) / this.strokeProjectionMagnitude <= r2 && t2.push(this.applySkew(this.A.add(i2))), t2.push(...this.projectBevel()), t2;
2363
+ const t2 = [], e3 = Math.abs(this.alpha), s2 = 1 / Math.sin(e3 / 2), i2 = this.scaleUnitVector(this.bisector, -this.strokeProjectionMagnitude * s2), r2 = this.options.strokeUniform ? ys(this.scaleUnitVector(this.bisector, this.options.strokeMiterLimit)) : this.options.strokeMiterLimit;
2364
+ return ys(i2) / this.strokeProjectionMagnitude <= r2 && t2.push(this.applySkew(this.A.add(i2))), t2.push(...this.projectBevel()), t2;
2360
2365
  }
2361
2366
  projectRoundNoSkew(t2, e3) {
2362
- const s2 = [], i2 = new ot(Si.getOrthogonalRotationFactor(this.bisector), Si.getOrthogonalRotationFactor(new ot(this.bisector.y, this.bisector.x)));
2367
+ const s2 = [], i2 = new ot(Xi.getOrthogonalRotationFactor(this.bisector), Xi.getOrthogonalRotationFactor(new ot(this.bisector.y, this.bisector.x)));
2363
2368
  return [new ot(1, 0).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(i2), new ot(0, 1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar).multiply(i2)].forEach((i3) => {
2364
- cs(i3, t2, e3) && s2.push(this.A.add(i3));
2369
+ Ts(i3, t2, e3) && s2.push(this.A.add(i3));
2365
2370
  }), s2;
2366
2371
  }
2367
2372
  projectRoundWithSkew(t2, e3) {
2368
2373
  const s2 = [], { skewX: i2, skewY: r2, scaleX: n2, scaleY: o2, strokeUniform: a2 } = this.options, h2 = new ot(Math.tan(xt(i2)), Math.tan(xt(r2))), c2 = this.strokeProjectionMagnitude, l2 = a2 ? c2 / o2 / Math.sqrt(1 / o2 ** 2 + 1 / n2 ** 2 * h2.y ** 2) : c2 / Math.sqrt(1 + h2.y ** 2), u2 = new ot(Math.sqrt(Math.max(c2 ** 2 - l2 ** 2, 0)), l2), d2 = a2 ? c2 / Math.sqrt(1 + h2.x ** 2 * (1 / o2) ** 2 / (1 / n2 + 1 / n2 * h2.x * h2.y) ** 2) : c2 / Math.sqrt(1 + h2.x ** 2 / (1 + h2.x * h2.y) ** 2), g2 = new ot(d2, Math.sqrt(Math.max(c2 ** 2 - d2 ** 2, 0)));
2369
2374
  return [g2, g2.scalarMultiply(-1), u2, u2.scalarMultiply(-1)].map((t3) => this.applySkew(a2 ? t3.multiply(this.strokeUniformScalar) : t3)).forEach((i3) => {
2370
- cs(i3, t2, e3) && s2.push(this.applySkew(this.A).add(i3));
2375
+ Ts(i3, t2, e3) && s2.push(this.applySkew(this.A).add(i3));
2371
2376
  }), s2;
2372
2377
  }
2373
2378
  projectRound() {
2374
2379
  const t2 = [];
2375
2380
  t2.push(...this.projectBevel());
2376
- const e3 = this.alpha % S == 0, s2 = this.applySkew(this.A), i2 = t2[e3 ? 0 : 2].subtract(s2), r2 = t2[e3 ? 1 : 0].subtract(s2), n2 = e3 ? this.applySkew(this.AB.scalarMultiply(-1)) : this.applySkew(this.bisector.multiply(this.strokeUniformScalar).scalarMultiply(-1)), o2 = as(i2, n2) > 0, a2 = o2 ? i2 : r2, h2 = o2 ? r2 : i2;
2381
+ const e3 = this.alpha % S == 0, s2 = this.applySkew(this.A), i2 = t2[e3 ? 0 : 2].subtract(s2), r2 = t2[e3 ? 1 : 0].subtract(s2), n2 = e3 ? this.applySkew(this.AB.scalarMultiply(-1)) : this.applySkew(this.bisector.multiply(this.strokeUniformScalar).scalarMultiply(-1)), o2 = Ss(i2, n2) > 0, a2 = o2 ? i2 : r2, h2 = o2 ? r2 : i2;
2377
2382
  return this.isSkewed() ? t2.push(...this.projectRoundWithSkew(a2, h2)) : t2.push(...this.projectRoundNoSkew(a2, h2)), t2;
2378
2383
  }
2379
2384
  projectPoints() {
@@ -2390,14 +2395,14 @@ class Si extends Ci {
2390
2395
  return this.projectPoints().map((t2) => ({ originPoint: this.A, projectedPoint: t2, angle: this.alpha, bisector: this.bisector }));
2391
2396
  }
2392
2397
  }
2393
- class wi extends Ci {
2398
+ class Yi extends Ii {
2394
2399
  constructor(t2, e3, s2) {
2395
2400
  super(s2), this.A = new ot(t2), this.T = new ot(e3);
2396
2401
  }
2397
2402
  calcOrthogonalProjection(t2, e3) {
2398
2403
  let s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.strokeProjectionMagnitude;
2399
2404
  const i2 = this.createSideVector(t2, e3);
2400
- return this.scaleUnitVector(os(i2), s2);
2405
+ return this.scaleUnitVector(bs(i2), s2);
2401
2406
  }
2402
2407
  projectButt() {
2403
2408
  return [this.projectOrthogonally(this.A, this.T, this.strokeProjectionMagnitude), this.projectOrthogonally(this.A, this.T, -this.strokeProjectionMagnitude)];
@@ -2407,7 +2412,7 @@ class wi extends Ci {
2407
2412
  if (!this.isSkewed() && this.A.eq(this.T)) {
2408
2413
  const e3 = new ot(1, 1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);
2409
2414
  t2.push(this.applySkew(this.A.add(e3)), this.applySkew(this.A.subtract(e3)));
2410
- } else t2.push(...new Si(this.A, this.T, this.T, this.options).projectRound());
2415
+ } else t2.push(...new Xi(this.A, this.T, this.T, this.options).projectRound());
2411
2416
  return t2;
2412
2417
  }
2413
2418
  projectSquare() {
@@ -2416,7 +2421,7 @@ class wi extends Ci {
2416
2421
  const e3 = new ot(1, 1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);
2417
2422
  t2.push(this.A.add(e3), this.A.subtract(e3));
2418
2423
  } else {
2419
- const e3 = this.calcOrthogonalProjection(this.A, this.T, this.strokeProjectionMagnitude), s2 = this.scaleUnitVector(ns(this.createSideVector(this.A, this.T)), -this.strokeProjectionMagnitude), i2 = this.A.add(s2);
2424
+ const e3 = this.calcOrthogonalProjection(this.A, this.T, this.strokeProjectionMagnitude), s2 = this.scaleUnitVector(Cs(this.createSideVector(this.A, this.T)), -this.strokeProjectionMagnitude), i2 = this.A.add(s2);
2420
2425
  t2.push(i2.add(e3), i2.subtract(e3));
2421
2426
  }
2422
2427
  return t2.map((t3) => this.applySkew(t3));
@@ -2435,7 +2440,7 @@ class wi extends Ci {
2435
2440
  return this.projectPoints().map((t2) => ({ originPoint: this.A, projectedPoint: t2 }));
2436
2441
  }
2437
2442
  }
2438
- const Ti = function(t2, e3) {
2443
+ const Wi = function(t2, e3) {
2439
2444
  let s2 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
2440
2445
  const i2 = [];
2441
2446
  if (0 === t2.length) return i2;
@@ -2450,31 +2455,31 @@ const Ti = function(t2, e3) {
2450
2455
  }
2451
2456
  return r2.forEach((t3, r3, n2) => {
2452
2457
  let o2, a2;
2453
- 0 === r3 ? (a2 = n2[1], o2 = s2 ? t3 : n2[n2.length - 1]) : r3 === n2.length - 1 ? (o2 = n2[r3 - 1], a2 = s2 ? t3 : n2[0]) : (o2 = n2[r3 - 1], a2 = n2[r3 + 1]), s2 && 1 === n2.length ? i2.push(...new wi(t3, t3, e3).project()) : !s2 || 0 !== r3 && r3 !== n2.length - 1 ? i2.push(...new Si(t3, o2, a2, e3).project()) : i2.push(...new wi(t3, 0 === r3 ? a2 : o2, e3).project());
2458
+ 0 === r3 ? (a2 = n2[1], o2 = s2 ? t3 : n2[n2.length - 1]) : r3 === n2.length - 1 ? (o2 = n2[r3 - 1], a2 = s2 ? t3 : n2[0]) : (o2 = n2[r3 - 1], a2 = n2[r3 + 1]), s2 && 1 === n2.length ? i2.push(...new Yi(t3, t3, e3).project()) : !s2 || 0 !== r3 && r3 !== n2.length - 1 ? i2.push(...new Xi(t3, o2, a2, e3).project()) : i2.push(...new Yi(t3, 0 === r3 ? a2 : o2, e3).project());
2454
2459
  }), i2;
2455
- }, Oi = (t2) => {
2460
+ }, Vi = (t2) => {
2456
2461
  const e3 = {};
2457
2462
  return Object.keys(t2).forEach((i2) => {
2458
2463
  e3[i2] = {}, Object.keys(t2[i2]).forEach((r2) => {
2459
2464
  e3[i2][r2] = s({}, t2[i2][r2]);
2460
2465
  });
2461
2466
  }), e3;
2462
- }, ki = (t2) => t2.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2463
- let Di;
2464
- const Mi = (t2) => {
2465
- if (Di || Di || (Di = "Intl" in v() && "Segmenter" in Intl && new Intl.Segmenter(void 0, { granularity: "grapheme" })), Di) {
2466
- const e3 = Di.segment(t2);
2467
+ }, zi = (t2) => t2.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2468
+ let Gi;
2469
+ const Hi = (t2) => {
2470
+ if (Gi || Gi || (Gi = "Intl" in v() && "Segmenter" in Intl && new Intl.Segmenter(void 0, { granularity: "grapheme" })), Gi) {
2471
+ const e3 = Gi.segment(t2);
2467
2472
  return Array.from(e3).map((t3) => {
2468
2473
  let { segment: e4 } = t3;
2469
2474
  return e4;
2470
2475
  });
2471
2476
  }
2472
- return Pi(t2);
2473
- }, Pi = (t2) => {
2477
+ return Ni(t2);
2478
+ }, Ni = (t2) => {
2474
2479
  const e3 = [];
2475
- for (let s2, i2 = 0; i2 < t2.length; i2++) false !== (s2 = Ei(t2, i2)) && e3.push(s2);
2480
+ for (let s2, i2 = 0; i2 < t2.length; i2++) false !== (s2 = Ui(t2, i2)) && e3.push(s2);
2476
2481
  return e3;
2477
- }, Ei = (t2, e3) => {
2482
+ }, Ui = (t2, e3) => {
2478
2483
  const s2 = t2.charCodeAt(e3);
2479
2484
  if (isNaN(s2)) return "";
2480
2485
  if (s2 < 55296 || s2 > 57343) return t2.charAt(e3);
@@ -2489,34 +2494,34 @@ const Mi = (t2) => {
2489
2494
  if (55296 > i2 || i2 > 56319) throw "Low surrogate without preceding high surrogate";
2490
2495
  return false;
2491
2496
  };
2492
- const ji = function(t2, e3) {
2497
+ const Ki = function(t2, e3) {
2493
2498
  let s2 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
2494
- return t2.fill !== e3.fill || t2.stroke !== e3.stroke || t2.strokeWidth !== e3.strokeWidth || t2.fontSize !== e3.fontSize || t2.fontFamily !== e3.fontFamily || t2.fontWeight !== e3.fontWeight || t2.fontStyle !== e3.fontStyle || t2.textBackgroundColor !== e3.textBackgroundColor || t2.deltaY !== e3.deltaY || s2 && (t2.overline !== e3.overline || t2.underline !== e3.underline || t2.linethrough !== e3.linethrough);
2495
- }, Fi = (t2, e3) => {
2499
+ return t2.fill !== e3.fill || t2.stroke !== e3.stroke || t2.strokeWidth !== e3.strokeWidth || t2.fontSize !== e3.fontSize || t2.fontFamily !== e3.fontFamily || t2.fontWeight !== e3.fontWeight || t2.fontStyle !== e3.fontStyle || t2.textDecorationThickness !== e3.textDecorationThickness || t2.textBackgroundColor !== e3.textBackgroundColor || t2.deltaY !== e3.deltaY || s2 && (t2.overline !== e3.overline || t2.underline !== e3.underline || t2.linethrough !== e3.linethrough);
2500
+ }, Ji = (t2, e3) => {
2496
2501
  const s2 = e3.split("\n"), i2 = [];
2497
2502
  let r2 = -1, n2 = {};
2498
- t2 = Oi(t2);
2503
+ t2 = Vi(t2);
2499
2504
  for (let e4 = 0; e4 < s2.length; e4++) {
2500
- const o2 = Mi(s2[e4]);
2505
+ const o2 = Hi(s2[e4]);
2501
2506
  if (t2[e4]) for (let s3 = 0; s3 < o2.length; s3++) {
2502
2507
  r2++;
2503
2508
  const o3 = t2[e4][s3];
2504
- o3 && Object.keys(o3).length > 0 && (ji(n2, o3, true) ? i2.push({ start: r2, end: r2 + 1, style: o3 }) : i2[i2.length - 1].end++), n2 = o3 || {};
2509
+ o3 && Object.keys(o3).length > 0 && (Ki(n2, o3, true) ? i2.push({ start: r2, end: r2 + 1, style: o3 }) : i2[i2.length - 1].end++), n2 = o3 || {};
2505
2510
  }
2506
2511
  else r2 += o2.length, n2 = {};
2507
2512
  }
2508
2513
  return i2;
2509
- }, Li = (t2, e3) => {
2510
- if (!Array.isArray(t2)) return Oi(t2);
2514
+ }, Qi = (t2, e3) => {
2515
+ if (!Array.isArray(t2)) return Vi(t2);
2511
2516
  const i2 = e3.split(F), r2 = {};
2512
2517
  let n2 = -1, o2 = 0;
2513
2518
  for (let e4 = 0; e4 < i2.length; e4++) {
2514
- const a2 = Mi(i2[e4]);
2519
+ const a2 = Hi(i2[e4]);
2515
2520
  for (let i3 = 0; i3 < a2.length; i3++) n2++, t2[o2] && t2[o2].start <= n2 && n2 < t2[o2].end && (r2[e4] = r2[e4] || {}, r2[e4][i3] = s({}, t2[o2].style), n2 === t2[o2].end - 1 && o2++);
2516
2521
  }
2517
2522
  return r2;
2518
- }, Ri = ["display", "transform", K, "fill-opacity", "fill-rule", "opacity", J, "stroke-dasharray", "stroke-linecap", "stroke-dashoffset", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "id", "paint-order", "vector-effect", "instantiated_by_use", "clip-path"];
2519
- function Bi(t2, e3) {
2523
+ }, Zi = ["display", "transform", K, "fill-opacity", "fill-rule", "opacity", J, "stroke-dasharray", "stroke-linecap", "stroke-dashoffset", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-width", "id", "paint-order", "vector-effect", "instantiated_by_use", "clip-path"];
2524
+ function $i(t2, e3) {
2520
2525
  const s2 = t2.nodeName, i2 = t2.getAttribute("class"), r2 = t2.getAttribute("id"), n2 = "(?![a-zA-Z\\-]+)";
2521
2526
  let o2;
2522
2527
  if (o2 = new RegExp("^" + s2, "i"), e3 = e3.replace(o2, ""), r2 && e3.length && (o2 = new RegExp("#" + r2 + n2, "i"), e3 = e3.replace(o2, "")), i2 && e3.length) {
@@ -2525,26 +2530,26 @@ function Bi(t2, e3) {
2525
2530
  }
2526
2531
  return 0 === e3.length;
2527
2532
  }
2528
- function Ii(t2, e3) {
2533
+ function tr(t2, e3) {
2529
2534
  let s2 = true;
2530
- const i2 = Bi(t2, e3.pop());
2535
+ const i2 = $i(t2, e3.pop());
2531
2536
  return i2 && e3.length && (s2 = function(t3, e4) {
2532
2537
  let s3, i3 = true;
2533
- for (; t3.parentElement && 1 === t3.parentElement.nodeType && e4.length; ) i3 && (s3 = e4.pop()), i3 = Bi(t3 = t3.parentElement, s3);
2538
+ for (; t3.parentElement && 1 === t3.parentElement.nodeType && e4.length; ) i3 && (s3 = e4.pop()), i3 = $i(t3 = t3.parentElement, s3);
2534
2539
  return 0 === e4.length;
2535
2540
  }(t2, e3)), i2 && s2 && 0 === e3.length;
2536
2541
  }
2537
- const Xi = (t2) => {
2542
+ const er = (t2) => {
2538
2543
  var e3;
2539
- return null !== (e3 = He[t2]) && void 0 !== e3 ? e3 : t2;
2540
- }, Yi = new RegExp("(".concat(Ve, ")"), "gi"), Wi = (t2) => t2.replace(Yi, " $1 ").replace(/,/gi, " ").replace(/\s+/gi, " ");
2541
- var Vi, zi, Gi, Hi, Ni, Ui, qi;
2542
- const Ki = "(".concat(Ve, ")"), Ji = String.raw(Vi || (Vi = r(["(skewX)(", ")"], ["(skewX)\\(", "\\)"])), Ki), Qi = String.raw(zi || (zi = r(["(skewY)(", ")"], ["(skewY)\\(", "\\)"])), Ki), Zi = String.raw(Gi || (Gi = r(["(rotate)(", "(?: ", " ", ")?)"], ["(rotate)\\(", "(?: ", " ", ")?\\)"])), Ki, Ki, Ki), $i = String.raw(Hi || (Hi = r(["(scale)(", "(?: ", ")?)"], ["(scale)\\(", "(?: ", ")?\\)"])), Ki, Ki), tr = String.raw(Ni || (Ni = r(["(translate)(", "(?: ", ")?)"], ["(translate)\\(", "(?: ", ")?\\)"])), Ki, Ki), er = String.raw(Ui || (Ui = r(["(matrix)(", " ", " ", " ", " ", " ", ")"], ["(matrix)\\(", " ", " ", " ", " ", " ", "\\)"])), Ki, Ki, Ki, Ki, Ki, Ki), sr = "(?:".concat(er, "|").concat(tr, "|").concat(Zi, "|").concat($i, "|").concat(Ji, "|").concat(Qi, ")"), ir = "(?:".concat(sr, "*)"), rr = String.raw(qi || (qi = r(["^s*(?:", "?)s*$"], ["^\\s*(?:", "?)\\s*$"])), ir), nr = new RegExp(rr), or = new RegExp(sr), ar = new RegExp(sr, "g");
2543
- function hr(t2) {
2544
+ return null !== (e3 = as[t2]) && void 0 !== e3 ? e3 : t2;
2545
+ }, sr = new RegExp("(".concat(is, ")"), "gi"), ir = (t2) => Pe(t2.replace(sr, " $1 ").replace(/,/gi, " "));
2546
+ var rr, nr, or, ar, hr, cr, lr;
2547
+ const ur = "(".concat(is, ")"), dr = String.raw(rr || (rr = r(["(skewX)(", ")"], ["(skewX)\\(", "\\)"])), ur), gr = String.raw(nr || (nr = r(["(skewY)(", ")"], ["(skewY)\\(", "\\)"])), ur), fr = String.raw(or || (or = r(["(rotate)(", "(?: ", " ", ")?)"], ["(rotate)\\(", "(?: ", " ", ")?\\)"])), ur, ur, ur), pr = String.raw(ar || (ar = r(["(scale)(", "(?: ", ")?)"], ["(scale)\\(", "(?: ", ")?\\)"])), ur, ur), mr = String.raw(hr || (hr = r(["(translate)(", "(?: ", ")?)"], ["(translate)\\(", "(?: ", ")?\\)"])), ur, ur), vr = String.raw(cr || (cr = r(["(matrix)(", " ", " ", " ", " ", " ", ")"], ["(matrix)\\(", " ", " ", " ", " ", " ", "\\)"])), ur, ur, ur, ur, ur, ur), yr = "(?:".concat(vr, "|").concat(mr, "|").concat(fr, "|").concat(pr, "|").concat(dr, "|").concat(gr, ")"), _r = "(?:".concat(yr, "*)"), xr = String.raw(lr || (lr = r(["^s*(?:", "?)s*$"], ["^\\s*(?:", "?)\\s*$"])), _r), Cr = new RegExp(xr), br = new RegExp(yr), Sr = new RegExp(yr, "g");
2548
+ function wr(t2) {
2544
2549
  const e3 = [];
2545
- if (!(t2 = Wi(t2).replace(/\s*([()])\s*/gi, "$1")) || t2 && !nr.test(t2)) return [...T];
2546
- for (const s2 of t2.matchAll(ar)) {
2547
- const t3 = or.exec(s2[0]);
2550
+ if (!(t2 = ir(t2).replace(/\s*([()])\s*/gi, "$1")) || t2 && !Cr.test(t2)) return [...T];
2551
+ for (const s2 of t2.matchAll(Sr)) {
2552
+ const t3 = br.exec(s2[0]);
2548
2553
  if (!t3) continue;
2549
2554
  let i2 = T;
2550
2555
  const r2 = t3.filter((t4) => !!t4), [, n2, ...o2] = r2, [a2, h2, c2, l2, u2, d2] = o2.map((t4) => parseFloat(t4));
@@ -2552,7 +2557,7 @@ function hr(t2) {
2552
2557
  case "translate":
2553
2558
  i2 = Mt(a2, h2);
2554
2559
  break;
2555
- case I:
2560
+ case B:
2556
2561
  i2 = Pt({ angle: a2 }, { x: h2, y: c2 });
2557
2562
  break;
2558
2563
  case G:
@@ -2571,74 +2576,74 @@ function hr(t2) {
2571
2576
  }
2572
2577
  return Ot(e3);
2573
2578
  }
2574
- function cr(t2, e3, s2, i2) {
2579
+ function Tr(t2, e3, s2, i2) {
2575
2580
  const r2 = Array.isArray(e3);
2576
2581
  let n2, o2 = e3;
2577
2582
  if (t2 !== K && t2 !== J || e3 !== j) {
2578
2583
  if ("strokeUniform" === t2) return "non-scaling-stroke" === e3;
2579
2584
  if ("strokeDashArray" === t2) o2 = e3 === j ? null : e3.replace(/,/g, " ").split(/\s+/).map(parseFloat);
2580
- else if ("transformMatrix" === t2) o2 = s2 && s2.transformMatrix ? Tt(s2.transformMatrix, hr(e3)) : hr(e3);
2585
+ else if ("transformMatrix" === t2) o2 = s2 && s2.transformMatrix ? Tt(s2.transformMatrix, wr(e3)) : wr(e3);
2581
2586
  else if ("visible" === t2) o2 = e3 !== j && "hidden" !== e3, s2 && false === s2.visible && (o2 = false);
2582
2587
  else if ("opacity" === t2) o2 = parseFloat(e3), s2 && void 0 !== s2.opacity && (o2 *= s2.opacity);
2583
2588
  else if ("textAnchor" === t2) o2 = "start" === e3 ? M : "end" === e3 ? A : D;
2584
- else if ("charSpacing" === t2) n2 = Re(e3, i2) / i2 * 1e3;
2589
+ else if ("charSpacing" === t2 || t2 === ze) n2 = Be(e3, i2) / i2 * 1e3;
2585
2590
  else if ("paintFirst" === t2) {
2586
2591
  const t3 = e3.indexOf(K), s3 = e3.indexOf(J);
2587
2592
  o2 = K, (t3 > -1 && s3 > -1 && s3 < t3 || -1 === t3 && s3 > -1) && (o2 = J);
2588
2593
  } else {
2589
2594
  if ("href" === t2 || "xlink:href" === t2 || "font" === t2 || "id" === t2) return e3;
2590
2595
  if ("imageSmoothing" === t2) return "optimizeQuality" === e3;
2591
- n2 = r2 ? e3.map(Re) : Re(e3, i2);
2596
+ n2 = r2 ? e3.map(Be) : Be(e3, i2);
2592
2597
  }
2593
2598
  } else o2 = "";
2594
2599
  return !r2 && isNaN(n2) ? o2 : n2;
2595
2600
  }
2596
- function lr(t2, e3) {
2597
- const s2 = t2.match(Ge);
2601
+ function Or(t2, e3) {
2602
+ const s2 = t2.match(os);
2598
2603
  if (!s2) return;
2599
2604
  const i2 = s2[1], r2 = s2[3], n2 = s2[4], o2 = s2[5], a2 = s2[6];
2600
- i2 && (e3.fontStyle = i2), r2 && (e3.fontWeight = isNaN(parseFloat(r2)) ? r2 : parseFloat(r2)), n2 && (e3.fontSize = Re(n2)), a2 && (e3.fontFamily = a2), o2 && (e3.lineHeight = "normal" === o2 ? 1 : o2);
2605
+ i2 && (e3.fontStyle = i2), r2 && (e3.fontWeight = isNaN(parseFloat(r2)) ? r2 : parseFloat(r2)), n2 && (e3.fontSize = Be(n2)), a2 && (e3.fontFamily = a2), o2 && (e3.lineHeight = "normal" === o2 ? 1 : o2);
2601
2606
  }
2602
- function ur(t2, e3) {
2607
+ function kr(t2, e3) {
2603
2608
  t2.replace(/;\s*$/, "").split(";").forEach((t3) => {
2604
2609
  if (!t3) return;
2605
2610
  const [s2, i2] = t3.split(":");
2606
2611
  e3[s2.trim().toLowerCase()] = i2.trim();
2607
2612
  });
2608
2613
  }
2609
- function dr(t2) {
2614
+ function Dr(t2) {
2610
2615
  const e3 = {}, s2 = t2.getAttribute("style");
2611
- return s2 ? ("string" == typeof s2 ? ur(s2, e3) : function(t3, e4) {
2616
+ return s2 ? ("string" == typeof s2 ? kr(s2, e3) : function(t3, e4) {
2612
2617
  Object.entries(t3).forEach((t4) => {
2613
2618
  let [s3, i2] = t4;
2614
2619
  void 0 !== i2 && (e4[s3.toLowerCase()] = i2);
2615
2620
  });
2616
2621
  }(s2, e3), e3) : e3;
2617
2622
  }
2618
- const gr = { stroke: "strokeOpacity", fill: "fillOpacity" };
2619
- function fr(t2, e3, i2) {
2623
+ const Mr = { stroke: "strokeOpacity", fill: "fillOpacity" };
2624
+ function Pr(t2, e3, i2) {
2620
2625
  if (!t2) return {};
2621
2626
  let r2, n2 = {}, o2 = O;
2622
- t2.parentNode && Je.test(t2.parentNode.nodeName) && (n2 = fr(t2.parentElement, e3, i2), n2.fontSize && (r2 = o2 = Re(n2.fontSize)));
2627
+ t2.parentNode && ds.test(t2.parentNode.nodeName) && (n2 = Pr(t2.parentElement, e3, i2), n2.fontSize && (r2 = o2 = Be(n2.fontSize)));
2623
2628
  const a2 = s(s(s({}, e3.reduce((e4, s2) => {
2624
2629
  const i3 = t2.getAttribute(s2);
2625
2630
  return i3 && (e4[s2] = i3), e4;
2626
2631
  }, {})), function(t3) {
2627
2632
  let e4 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i3 = {};
2628
- for (const r3 in e4) Ii(t3, r3.split(" ")) && (i3 = s(s({}, i3), e4[r3]));
2633
+ for (const r3 in e4) tr(t3, r3.split(" ")) && (i3 = s(s({}, i3), e4[r3]));
2629
2634
  return i3;
2630
- }(t2, i2)), dr(t2));
2631
- a2[Ue] && t2.setAttribute(Ue, a2[Ue]), a2[Ne] && (r2 = Re(a2[Ne], o2), a2[Ne] = "".concat(r2));
2635
+ }(t2, i2)), Dr(t2));
2636
+ a2[cs] && t2.setAttribute(cs, a2[cs]), a2[hs] && (r2 = Be(a2[hs], o2), a2[hs] = "".concat(r2));
2632
2637
  const h2 = {};
2633
2638
  for (const t3 in a2) {
2634
- const e4 = Xi(t3), s2 = cr(e4, a2[t3], n2, r2);
2639
+ const e4 = er(t3), s2 = Tr(e4, a2[t3], n2, r2);
2635
2640
  h2[e4] = s2;
2636
2641
  }
2637
- h2 && h2.font && lr(h2.font, h2);
2642
+ h2 && h2.font && Or(h2.font, h2);
2638
2643
  const c2 = s(s({}, n2), h2);
2639
- return Je.test(t2.nodeName) ? c2 : function(t3) {
2640
- const e4 = _i.getDefaults();
2641
- return Object.entries(gr).forEach((s2) => {
2644
+ return ds.test(t2.nodeName) ? c2 : function(t3) {
2645
+ const e4 = Li.getDefaults();
2646
+ return Object.entries(Mr).forEach((s2) => {
2642
2647
  let [i3, r3] = s2;
2643
2648
  if (void 0 === t3[r3] || "" === t3[i3]) return;
2644
2649
  if (void 0 === t3[i3]) {
@@ -2646,18 +2651,18 @@ function fr(t2, e3, i2) {
2646
2651
  t3[i3] = e4[i3];
2647
2652
  }
2648
2653
  if (0 === t3[i3].indexOf("url(")) return;
2649
- const n3 = new Le(t3[i3]);
2654
+ const n3 = new Ie(t3[i3]);
2650
2655
  t3[i3] = n3.setAlpha(Vt(n3.getAlpha() * t3[r3], 2)).toRgba();
2651
2656
  }), t3;
2652
2657
  }(c2);
2653
2658
  }
2654
- const pr = ["left", "top", "width", "height", "visible"], mr = ["rx", "ry"];
2655
- class vr extends _i {
2659
+ const Er = ["left", "top", "width", "height", "visible"], Ar = ["rx", "ry"];
2660
+ class jr extends Li {
2656
2661
  static getDefaults() {
2657
- return s(s({}, super.getDefaults()), vr.ownDefaults);
2662
+ return s(s({}, super.getDefaults()), jr.ownDefaults);
2658
2663
  }
2659
2664
  constructor(t2) {
2660
- super(), Object.assign(this, vr.ownDefaults), this.setOptions(t2), this._initRxRy();
2665
+ super(), Object.assign(this, jr.ownDefaults), this.setOptions(t2), this._initRxRy();
2661
2666
  }
2662
2667
  _initRxRy() {
2663
2668
  const { rx: t2, ry: e3 } = this;
@@ -2669,60 +2674,60 @@ class vr extends _i {
2669
2674
  }
2670
2675
  toObject() {
2671
2676
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
2672
- return super.toObject([...mr, ...t2]);
2677
+ return super.toObject([...Ar, ...t2]);
2673
2678
  }
2674
2679
  _toSVG() {
2675
2680
  const { width: t2, height: e3, rx: s2, ry: i2 } = this;
2676
2681
  return ["<rect ", "COMMON_PARTS", 'x="'.concat(-t2 / 2, '" y="').concat(-e3 / 2, '" rx="').concat(s2, '" ry="').concat(i2, '" width="').concat(t2, '" height="').concat(e3, '" />\n')];
2677
2682
  }
2678
2683
  static async fromElement(t2, e3, r2) {
2679
- const n2 = fr(t2, this.ATTRIBUTE_NAMES, r2), { left: o2 = 0, top: a2 = 0, width: h2 = 0, height: c2 = 0, visible: l2 = true } = n2, u2 = i(n2, pr);
2684
+ const n2 = Pr(t2, this.ATTRIBUTE_NAMES, r2), { left: o2 = 0, top: a2 = 0, width: h2 = 0, height: c2 = 0, visible: l2 = true } = n2, u2 = i(n2, Er);
2680
2685
  return new this(s(s(s({}, e3), u2), {}, { left: o2, top: a2, width: h2, height: c2, visible: Boolean(l2 && h2 && c2) }));
2681
2686
  }
2682
2687
  }
2683
- t(vr, "type", "Rect"), t(vr, "cacheProperties", [...ps, ...mr]), t(vr, "ownDefaults", { rx: 0, ry: 0 }), t(vr, "ATTRIBUTE_NAMES", [...Ri, "x", "y", "rx", "ry", "width", "height"]), tt.setClass(vr), tt.setSVGClass(vr);
2684
- const yr = "initialization", _r = "added", xr = "removed", Cr = "imperative", br = (t2, e3) => {
2685
- const { strokeUniform: s2, strokeWidth: i2, width: r2, height: n2, group: o2 } = e3, a2 = o2 && o2 !== t2 ? fe(o2.calcTransformMatrix(), t2.calcTransformMatrix()) : null, h2 = a2 ? e3.getRelativeCenterPoint().transform(a2) : e3.getRelativeCenterPoint(), c2 = !e3.isStrokeAccountedForInDimensions(), l2 = s2 && c2 ? me(new ot(i2, i2), void 0, t2.calcTransformMatrix()) : at, u2 = !s2 && c2 ? i2 : 0, d2 = ge(r2 + u2, n2 + u2, Ot([a2, e3.calcOwnMatrix()], true)).add(l2).scalarDivide(2);
2688
+ t(jr, "type", "Rect"), t(jr, "cacheProperties", [...Es, ...Ar]), t(jr, "ownDefaults", { rx: 0, ry: 0 }), t(jr, "ATTRIBUTE_NAMES", [...Zi, "x", "y", "rx", "ry", "width", "height"]), tt.setClass(jr), tt.setSVGClass(jr);
2689
+ const Fr = "initialization", Lr = "added", Rr = "removed", Ir = "imperative", Br = (t2, e3) => {
2690
+ const { strokeUniform: s2, strokeWidth: i2, width: r2, height: n2, group: o2 } = e3, a2 = o2 && o2 !== t2 ? pe(o2.calcTransformMatrix(), t2.calcTransformMatrix()) : null, h2 = a2 ? e3.getRelativeCenterPoint().transform(a2) : e3.getRelativeCenterPoint(), c2 = !e3.isStrokeAccountedForInDimensions(), l2 = s2 && c2 ? ve(new ot(i2, i2), void 0, t2.calcTransformMatrix()) : at, u2 = !s2 && c2 ? i2 : 0, d2 = fe(r2 + u2, n2 + u2, Ot([a2, e3.calcOwnMatrix()], true)).add(l2).scalarDivide(2);
2686
2691
  return [h2.subtract(d2), h2.add(d2)];
2687
2692
  };
2688
- class Sr {
2693
+ class Xr {
2689
2694
  calcLayoutResult(t2, e3) {
2690
2695
  if (this.shouldPerformLayout(t2)) return this.calcBoundingBox(e3, t2);
2691
2696
  }
2692
2697
  shouldPerformLayout(t2) {
2693
2698
  let { type: e3, prevStrategy: s2, strategy: i2 } = t2;
2694
- return e3 === yr || e3 === Cr || !!s2 && i2 !== s2;
2699
+ return e3 === Fr || e3 === Ir || !!s2 && i2 !== s2;
2695
2700
  }
2696
2701
  shouldLayoutClipPath(t2) {
2697
2702
  let { type: e3, target: { clipPath: s2 } } = t2;
2698
- return e3 !== yr && s2 && !s2.absolutePositioned;
2703
+ return e3 !== Fr && s2 && !s2.absolutePositioned;
2699
2704
  }
2700
2705
  getInitialSize(t2, e3) {
2701
2706
  return e3.size;
2702
2707
  }
2703
2708
  calcBoundingBox(t2, e3) {
2704
2709
  const { type: s2, target: i2 } = e3;
2705
- if (s2 === Cr && e3.overrides) return e3.overrides;
2710
+ if (s2 === Ir && e3.overrides) return e3.overrides;
2706
2711
  if (0 === t2.length) return;
2707
- const { left: r2, top: n2, width: o2, height: a2 } = ae(t2.map((t3) => br(i2, t3)).reduce((t3, e4) => t3.concat(e4), [])), h2 = new ot(o2, a2), c2 = new ot(r2, n2).add(h2.scalarDivide(2));
2708
- if (s2 === yr) {
2712
+ const { left: r2, top: n2, width: o2, height: a2 } = he(t2.map((t3) => Br(i2, t3)).reduce((t3, e4) => t3.concat(e4), [])), h2 = new ot(o2, a2), c2 = new ot(r2, n2).add(h2.scalarDivide(2));
2713
+ if (s2 === Fr) {
2709
2714
  const t3 = this.getInitialSize(e3, { size: h2, center: c2 });
2710
2715
  return { center: c2, relativeCorrection: new ot(0, 0), size: t3 };
2711
2716
  }
2712
2717
  return { center: c2.transform(i2.calcOwnMatrix()), size: h2 };
2713
2718
  }
2714
2719
  }
2715
- t(Sr, "type", "strategy");
2716
- class wr extends Sr {
2720
+ t(Xr, "type", "strategy");
2721
+ class Yr extends Xr {
2717
2722
  shouldPerformLayout(t2) {
2718
2723
  return true;
2719
2724
  }
2720
2725
  }
2721
- t(wr, "type", "fit-content"), tt.setClass(wr);
2722
- const Tr = ["strategy"], Or = ["target", "strategy", "bubbles", "prevStrategy"], kr = "layoutManager";
2723
- class Dr {
2726
+ t(Yr, "type", "fit-content"), tt.setClass(Yr);
2727
+ const Wr = ["strategy"], Vr = ["target", "strategy", "bubbles", "prevStrategy"], zr = "layoutManager";
2728
+ class Gr {
2724
2729
  constructor() {
2725
- let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new wr();
2730
+ let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new Yr();
2726
2731
  t(this, "strategy", void 0), this.strategy = e3, this._subscriptions = /* @__PURE__ */ new Map();
2727
2732
  }
2728
2733
  performLayout(t2) {
@@ -2735,7 +2740,7 @@ class Dr {
2735
2740
  }
2736
2741
  attachHandlers(t2, e3) {
2737
2742
  const { target: s2 } = e3;
2738
- return [Q, L, Y, B, R, X, z, W, V$1].map((e4) => t2.on(e4, (t3) => this.performLayout(e4 === Q ? { type: "object_modified", trigger: e4, e: t3, target: s2 } : { type: "object_modifying", trigger: e4, e: t3, target: s2 })));
2743
+ return [Q, L, Y, I, R, X, z, W, V$1].map((e4) => t2.on(e4, (t3) => this.performLayout(e4 === Q ? { type: "object_modified", trigger: e4, e: t3, target: s2 } : { type: "object_modifying", trigger: e4, e: t3, target: s2 })));
2739
2744
  }
2740
2745
  subscribe(t2, e3) {
2741
2746
  this.unsubscribe(t2, e3);
@@ -2753,21 +2758,21 @@ class Dr {
2753
2758
  }
2754
2759
  onBeforeLayout(t2) {
2755
2760
  const { target: e3, type: r2 } = t2, { canvas: n2 } = e3;
2756
- if (r2 === yr || r2 === _r ? this.subscribeTargets(t2) : r2 === xr && this.unsubscribeTargets(t2), e3.fire("layout:before", { context: t2 }), n2 && n2.fire("object:layout:before", { target: e3, context: t2 }), r2 === Cr && t2.deep) {
2757
- const r3 = i(t2, Tr);
2761
+ if (r2 === Fr || r2 === Lr ? this.subscribeTargets(t2) : r2 === Rr && this.unsubscribeTargets(t2), e3.fire("layout:before", { context: t2 }), n2 && n2.fire("object:layout:before", { target: e3, context: t2 }), r2 === Ir && t2.deep) {
2762
+ const r3 = i(t2, Wr);
2758
2763
  e3.forEachObject((t3) => t3.layoutManager && t3.layoutManager.performLayout(s(s({}, r3), {}, { bubbles: false, target: t3 })));
2759
2764
  }
2760
2765
  }
2761
2766
  getLayoutResult(t2) {
2762
2767
  const { target: e3, strategy: s2, type: i2 } = t2, r2 = s2.calcLayoutResult(t2, e3.getObjects());
2763
2768
  if (!r2) return;
2764
- const n2 = i2 === yr ? new ot() : e3.getRelativeCenterPoint(), { center: o2, correction: a2 = new ot(), relativeCorrection: h2 = new ot() } = r2, c2 = n2.subtract(o2).add(a2).transform(i2 === yr ? T : wt(e3.calcOwnMatrix()), true).add(h2);
2769
+ const n2 = i2 === Fr ? new ot() : e3.getRelativeCenterPoint(), { center: o2, correction: a2 = new ot(), relativeCorrection: h2 = new ot() } = r2, c2 = n2.subtract(o2).add(a2).transform(i2 === Fr ? T : wt(e3.calcOwnMatrix()), true).add(h2);
2765
2770
  return { result: r2, prevCenter: n2, nextCenter: o2, offset: c2 };
2766
2771
  }
2767
2772
  commitLayout(t2, e3) {
2768
2773
  const { target: s2 } = t2, { result: { size: i2 }, nextCenter: r2 } = e3;
2769
2774
  var n2, o2;
2770
- (s2.set({ width: i2.x, height: i2.y }), this.layoutObjects(t2, e3), t2.type === yr) ? s2.set({ left: null !== (n2 = t2.x) && void 0 !== n2 ? n2 : r2.x + i2.x * xe(s2.originX), top: null !== (o2 = t2.y) && void 0 !== o2 ? o2 : r2.y + i2.y * xe(s2.originY) }) : (s2.setPositionByOrigin(r2, D, D), s2.setCoords(), s2.set("dirty", true));
2775
+ (s2.set({ width: i2.x, height: i2.y }), this.layoutObjects(t2, e3), t2.type === Fr) ? s2.set({ left: null !== (n2 = t2.x) && void 0 !== n2 ? n2 : r2.x + i2.x * Ce(s2.originX), top: null !== (o2 = t2.y) && void 0 !== o2 ? o2 : r2.y + i2.y * Ce(s2.originY) }) : (s2.setPositionByOrigin(r2, D, D), s2.setCoords(), s2.set("dirty", true));
2771
2776
  }
2772
2777
  layoutObjects(t2, e3) {
2773
2778
  const { target: s2 } = t2;
@@ -2780,7 +2785,7 @@ class Dr {
2780
2785
  s2.set({ left: s2.left + i2.x, top: s2.top + i2.y });
2781
2786
  }
2782
2787
  onAfterLayout(t2, e3) {
2783
- const { target: r2, strategy: n2, bubbles: o2, prevStrategy: a2 } = t2, h2 = i(t2, Or), { canvas: c2 } = r2;
2788
+ const { target: r2, strategy: n2, bubbles: o2, prevStrategy: a2 } = t2, h2 = i(t2, Vr), { canvas: c2 } = r2;
2784
2789
  r2.fire("layout:after", { context: t2, result: e3 }), c2 && c2.fire("object:layout:after", { context: t2, result: e3, target: r2 });
2785
2790
  const l2 = r2.parent;
2786
2791
  o2 && null != l2 && l2.layoutManager && ((h2.path || (h2.path = [])).push(r2), l2.layoutManager.performLayout(s(s({}, h2), {}, { target: l2 }))), r2.set("dirty", true);
@@ -2790,31 +2795,31 @@ class Dr {
2790
2795
  t2.forEach((t3) => t3.forEach((t4) => t4())), t2.clear();
2791
2796
  }
2792
2797
  toObject() {
2793
- return { type: kr, strategy: this.strategy.constructor.type };
2798
+ return { type: zr, strategy: this.strategy.constructor.type };
2794
2799
  }
2795
2800
  toJSON() {
2796
2801
  return this.toObject();
2797
2802
  }
2798
2803
  }
2799
- tt.setClass(Dr, kr);
2800
- const Mr = ["type", "objects", "layoutManager"];
2801
- class Pr extends Dr {
2804
+ tt.setClass(Gr, zr);
2805
+ const Hr = ["type", "objects", "layoutManager"];
2806
+ class Nr extends Gr {
2802
2807
  performLayout() {
2803
2808
  }
2804
2809
  }
2805
- class Er extends ct(_i) {
2810
+ class Ur extends ct(Li) {
2806
2811
  static getDefaults() {
2807
- return s(s({}, super.getDefaults()), Er.ownDefaults);
2812
+ return s(s({}, super.getDefaults()), Ur.ownDefaults);
2808
2813
  }
2809
2814
  constructor() {
2810
2815
  let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
2811
- super(), t(this, "_activeObjects", []), t(this, "__objectSelectionTracker", void 0), t(this, "__objectSelectionDisposer", void 0), Object.assign(this, Er.ownDefaults), this.setOptions(s2), this.groupInit(e3, s2);
2816
+ super(), t(this, "_activeObjects", []), t(this, "__objectSelectionTracker", void 0), t(this, "__objectSelectionDisposer", void 0), Object.assign(this, Ur.ownDefaults), this.setOptions(s2), this.groupInit(e3, s2);
2812
2817
  }
2813
2818
  groupInit(t2, e3) {
2814
2819
  var s2;
2815
2820
  this._objects = [...t2], this.__objectSelectionTracker = this.__objectSelectionMonitor.bind(this, true), this.__objectSelectionDisposer = this.__objectSelectionMonitor.bind(this, false), this.forEachObject((t3) => {
2816
2821
  this.enterGroup(t3, false);
2817
- }), this.layoutManager = null !== (s2 = e3.layoutManager) && void 0 !== s2 ? s2 : new Dr(), this.layoutManager.performLayout({ type: yr, target: this, targets: [...t2], x: e3.left, y: e3.top });
2822
+ }), this.layoutManager = null !== (s2 = e3.layoutManager) && void 0 !== s2 ? s2 : new Gr(), this.layoutManager.performLayout({ type: Fr, target: this, targets: [...t2], x: e3.left, y: e3.top });
2818
2823
  }
2819
2824
  canEnterGroup(t2) {
2820
2825
  return t2 === this || this.isDescendantOf(t2) ? (a("error", "Group: circular object trees are not supported, this call has no effect"), false) : -1 === this._objects.indexOf(t2) || (a("error", "Group: duplicate objects are not supported inside group, this call has no effect"), false);
@@ -2825,16 +2830,16 @@ class Er extends ct(_i) {
2825
2830
  add() {
2826
2831
  for (var t2 = arguments.length, e3 = new Array(t2), s2 = 0; s2 < t2; s2++) e3[s2] = arguments[s2];
2827
2832
  const i2 = this._filterObjectsBeforeEnteringGroup(e3), r2 = super.add(...i2);
2828
- return this._onAfterObjectsChange(_r, i2), r2;
2833
+ return this._onAfterObjectsChange(Lr, i2), r2;
2829
2834
  }
2830
2835
  insertAt(t2) {
2831
2836
  for (var e3 = arguments.length, s2 = new Array(e3 > 1 ? e3 - 1 : 0), i2 = 1; i2 < e3; i2++) s2[i2 - 1] = arguments[i2];
2832
2837
  const r2 = this._filterObjectsBeforeEnteringGroup(s2), n2 = super.insertAt(t2, ...r2);
2833
- return this._onAfterObjectsChange(_r, r2), n2;
2838
+ return this._onAfterObjectsChange(Lr, r2), n2;
2834
2839
  }
2835
2840
  remove() {
2836
2841
  const t2 = super.remove(...arguments);
2837
- return this._onAfterObjectsChange(xr, t2), t2;
2842
+ return this._onAfterObjectsChange(Rr, t2), t2;
2838
2843
  }
2839
2844
  _onObjectAdded(t2) {
2840
2845
  this.enterGroup(t2, true), this.fire("object:added", { target: t2 }), t2.fire("added", { target: this });
@@ -2876,7 +2881,7 @@ class Er extends ct(_i) {
2876
2881
  t2.group && t2.group.remove(t2), t2._set("parent", this), this._enterGroup(t2, e3);
2877
2882
  }
2878
2883
  _enterGroup(t2, e3) {
2879
- e3 && le(t2, Tt(wt(this.calcTransformMatrix()), t2.calcTransformMatrix())), this._shouldSetNestedCoords() && t2.setCoords(), t2._set("group", this), t2._set("canvas", this.canvas), this._watchObject(true, t2);
2884
+ e3 && ue(t2, Tt(wt(this.calcTransformMatrix()), t2.calcTransformMatrix())), this._shouldSetNestedCoords() && t2.setCoords(), t2._set("group", this), t2._set("canvas", this.canvas), this._watchObject(true, t2);
2880
2885
  const s2 = this.canvas && this.canvas.getActiveObject && this.canvas.getActiveObject();
2881
2886
  s2 && (s2 === t2 || t2.isDescendantOf(s2)) && this._activeObjects.push(t2);
2882
2887
  }
@@ -2884,12 +2889,12 @@ class Er extends ct(_i) {
2884
2889
  this._exitGroup(t2, e3), t2._set("parent", void 0), t2._set("canvas", void 0);
2885
2890
  }
2886
2891
  _exitGroup(t2, e3) {
2887
- t2._set("group", void 0), e3 || (le(t2, Tt(this.calcTransformMatrix(), t2.calcTransformMatrix())), t2.setCoords()), this._watchObject(false, t2);
2892
+ t2._set("group", void 0), e3 || (ue(t2, Tt(this.calcTransformMatrix(), t2.calcTransformMatrix())), t2.setCoords()), this._watchObject(false, t2);
2888
2893
  const s2 = this._activeObjects.length > 0 ? this._activeObjects.indexOf(t2) : -1;
2889
2894
  s2 > -1 && this._activeObjects.splice(s2, 1);
2890
2895
  }
2891
2896
  shouldCache() {
2892
- const t2 = _i.prototype.shouldCache.call(this);
2897
+ const t2 = Li.prototype.shouldCache.call(this);
2893
2898
  if (t2) {
2894
2899
  for (let t3 = 0; t3 < this._objects.length; t3++) if (this._objects[t3].willDrawShadow()) return this.ownCaching = false, false;
2895
2900
  }
@@ -2917,7 +2922,7 @@ class Er extends ct(_i) {
2917
2922
  }
2918
2923
  triggerLayout() {
2919
2924
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
2920
- this.layoutManager.performLayout(s({ target: this, type: Cr }, t2));
2925
+ this.layoutManager.performLayout(s({ target: this, type: Ir }, t2));
2921
2926
  }
2922
2927
  render(t2) {
2923
2928
  this._transformDone = true, super.render(t2), this._transformDone = false;
@@ -2948,7 +2953,7 @@ class Er extends ct(_i) {
2948
2953
  }
2949
2954
  _createSVGBgRect(t2) {
2950
2955
  if (!this.backgroundColor) return "";
2951
- const e3 = vr.prototype._toSVG.call(this), s2 = e3.indexOf("COMMON_PARTS");
2956
+ const e3 = jr.prototype._toSVG.call(this), s2 = e3.indexOf("COMMON_PARTS");
2952
2957
  e3[s2] = 'for="group" ';
2953
2958
  const i2 = e3.join("");
2954
2959
  return t2 ? t2(i2) : i2;
@@ -2970,27 +2975,27 @@ class Er extends ct(_i) {
2970
2975
  return this._createBaseClipPathSVGMarkup(e3, { reviver: t2 });
2971
2976
  }
2972
2977
  static fromObject(t2, e3) {
2973
- let { type: r2, objects: n2 = [], layoutManager: o2 } = t2, a2 = i(t2, Mr);
2974
- return Promise.all([It(n2, e3), Xt(a2, e3)]).then((t3) => {
2978
+ let { type: r2, objects: n2 = [], layoutManager: o2 } = t2, a2 = i(t2, Hr);
2979
+ return Promise.all([Bt(n2, e3), Xt(a2, e3)]).then((t3) => {
2975
2980
  let [e4, i2] = t3;
2976
- const r3 = new this(e4, s(s(s({}, a2), i2), {}, { layoutManager: new Pr() }));
2981
+ const r3 = new this(e4, s(s(s({}, a2), i2), {}, { layoutManager: new Nr() }));
2977
2982
  if (o2) {
2978
2983
  const t4 = tt.getClass(o2.type), e5 = tt.getClass(o2.strategy);
2979
2984
  r3.layoutManager = new t4(new e5());
2980
- } else r3.layoutManager = new Dr();
2981
- return r3.layoutManager.subscribeTargets({ type: yr, target: r3, targets: r3.getObjects() }), r3.setCoords(), r3;
2985
+ } else r3.layoutManager = new Gr();
2986
+ return r3.layoutManager.subscribeTargets({ type: Fr, target: r3, targets: r3.getObjects() }), r3.setCoords(), r3;
2982
2987
  });
2983
2988
  }
2984
2989
  }
2985
- t(Er, "type", "Group"), t(Er, "ownDefaults", { strokeWidth: 0, subTargetCheck: false, interactive: false }), tt.setClass(Er);
2986
- const Ar = (t2, e3) => Math.min(e3.width / t2.width, e3.height / t2.height), jr = (t2, e3) => Math.max(e3.width / t2.width, e3.height / t2.height), Fr = "\\s*,?\\s*", Lr = "".concat(Fr, "(").concat(Ve, ")"), Rr = "".concat(Lr).concat(Lr).concat(Lr).concat(Fr, "([01])").concat(Fr, "([01])").concat(Lr).concat(Lr), Br = { m: "l", M: "L" }, Ir = (t2, e3, s2, i2, r2, n2, o2, a2, h2, c2, l2) => {
2990
+ t(Ur, "type", "Group"), t(Ur, "ownDefaults", { strokeWidth: 0, subTargetCheck: false, interactive: false }), tt.setClass(Ur);
2991
+ const qr = (t2, e3) => Math.min(e3.width / t2.width, e3.height / t2.height), Kr = (t2, e3) => Math.max(e3.width / t2.width, e3.height / t2.height), Jr = "\\s*,?\\s*", Qr = "".concat(Jr, "(").concat(is, ")"), Zr = "".concat(Qr).concat(Qr).concat(Qr).concat(Jr, "([01])").concat(Jr, "([01])").concat(Qr).concat(Qr), $r = { m: "l", M: "L" }, tn = (t2, e3, s2, i2, r2, n2, o2, a2, h2, c2, l2) => {
2987
2992
  const u2 = rt(t2), d2 = nt(t2), g2 = rt(e3), f = nt(e3), p2 = s2 * r2 * g2 - i2 * n2 * f + o2, m2 = i2 * r2 * g2 + s2 * n2 * f + a2;
2988
2993
  return ["C", c2 + h2 * (-s2 * r2 * d2 - i2 * n2 * u2), l2 + h2 * (-i2 * r2 * d2 + s2 * n2 * u2), p2 + h2 * (s2 * r2 * f + i2 * n2 * g2), m2 + h2 * (i2 * r2 * f - s2 * n2 * g2), p2, m2];
2989
- }, Xr = (t2, e3, s2, i2) => {
2994
+ }, en = (t2, e3, s2, i2) => {
2990
2995
  const r2 = Math.atan2(e3, t2), n2 = Math.atan2(i2, s2);
2991
2996
  return n2 >= r2 ? n2 - r2 : 2 * Math.PI - (r2 - n2);
2992
2997
  };
2993
- function Yr(t2, e3, s2, i2, r2, n2, a2, h2) {
2998
+ function sn(t2, e3, s2, i2, r2, n2, a2, h2) {
2994
2999
  let c2;
2995
3000
  if (o.cachesBoundsOfCurve && (c2 = [...arguments].join(), _.boundsOfCurveCache[c2])) return _.boundsOfCurveCache[c2];
2996
3001
  const l2 = Math.sqrt, u2 = Math.abs, d2 = [], g2 = [[0, 0], [0, 0]];
@@ -3010,7 +3015,7 @@ function Yr(t2, e3, s2, i2, r2, n2, a2, h2) {
3010
3015
  0 < a3 && a3 < 1 && d2.push(a3);
3011
3016
  }
3012
3017
  let v2 = d2.length;
3013
- const y2 = v2, x2 = Gr(t2, e3, s2, i2, r2, n2, a2, h2);
3018
+ const y2 = v2, x2 = an(t2, e3, s2, i2, r2, n2, a2, h2);
3014
3019
  for (; v2--; ) {
3015
3020
  const { x: t3, y: e4 } = x2(d2[v2]);
3016
3021
  g2[0][v2] = t3, g2[1][v2] = e4;
@@ -3019,7 +3024,7 @@ function Yr(t2, e3, s2, i2, r2, n2, a2, h2) {
3019
3024
  const C2 = [new ot(Math.min(...g2[0]), Math.min(...g2[1])), new ot(Math.max(...g2[0]), Math.max(...g2[1]))];
3020
3025
  return o.cachesBoundsOfCurve && (_.boundsOfCurveCache[c2] = C2), C2;
3021
3026
  }
3022
- const Wr = (t2, e3, s2) => {
3027
+ const rn = (t2, e3, s2) => {
3023
3028
  let [i2, r2, n2, o2, a2, h2, c2, l2] = s2;
3024
3029
  const u2 = ((t3, e4, s3, i3, r3, n3, o3) => {
3025
3030
  if (0 === s3 || 0 === i3) return [];
@@ -3031,16 +3036,16 @@ const Wr = (t2, e3, s2) => {
3031
3036
  C2 *= t4, b2 *= t4;
3032
3037
  } else c3 = (r3 === n3 ? -1 : 1) * Math.sqrt(x2 / (m2 * y2 + v2 * _2));
3033
3038
  const S2 = c3 * C2 * p2 / b2, T2 = -c3 * b2 * f / C2, O2 = g2 * S2 - d2 * T2 + 0.5 * t3, k2 = d2 * S2 + g2 * T2 + 0.5 * e4;
3034
- let D2 = Xr(1, 0, (f - S2) / C2, (p2 - T2) / b2), M2 = Xr((f - S2) / C2, (p2 - T2) / b2, (-f - S2) / C2, (-p2 - T2) / b2);
3039
+ let D2 = en(1, 0, (f - S2) / C2, (p2 - T2) / b2), M2 = en((f - S2) / C2, (p2 - T2) / b2, (-f - S2) / C2, (-p2 - T2) / b2);
3035
3040
  0 === n3 && M2 > 0 ? M2 -= 2 * l3 : 1 === n3 && M2 < 0 && (M2 += 2 * l3);
3036
3041
  const P2 = Math.ceil(Math.abs(M2 / l3 * 2)), E2 = [], A2 = M2 / P2, j2 = 8 / 3 * Math.sin(A2 / 4) * Math.sin(A2 / 4) / Math.sin(A2 / 2);
3037
3042
  let F2 = D2 + A2;
3038
- for (let t4 = 0; t4 < P2; t4++) E2[t4] = Ir(D2, F2, g2, d2, C2, b2, O2, k2, j2, a3, h3), a3 = E2[t4][5], h3 = E2[t4][6], D2 = F2, F2 += A2;
3043
+ for (let t4 = 0; t4 < P2; t4++) E2[t4] = tn(D2, F2, g2, d2, C2, b2, O2, k2, j2, a3, h3), a3 = E2[t4][5], h3 = E2[t4][6], D2 = F2, F2 += A2;
3039
3044
  return E2;
3040
3045
  })(c2 - t2, l2 - e3, r2, n2, a2, h2, o2);
3041
3046
  for (let s3 = 0, i3 = u2.length; s3 < i3; s3++) u2[s3][1] += t2, u2[s3][2] += e3, u2[s3][3] += t2, u2[s3][4] += e3, u2[s3][5] += t2, u2[s3][6] += e3;
3042
3047
  return u2;
3043
- }, Vr = (t2) => {
3048
+ }, nn = (t2) => {
3044
3049
  let e3 = 0, s2 = 0, i2 = 0, r2 = 0;
3045
3050
  const n2 = [];
3046
3051
  let o2, a2 = 0, h2 = 0;
@@ -3091,7 +3096,7 @@ const Wr = (t2, e3, s2) => {
3091
3096
  case "a":
3092
3097
  t3[6] += e3, t3[7] += s2;
3093
3098
  case "A":
3094
- Wr(e3, s2, t3).forEach((t4) => n2.push(t4)), e3 = t3[6], s2 = t3[7];
3099
+ rn(e3, s2, t3).forEach((t4) => n2.push(t4)), e3 = t3[6], s2 = t3[7];
3095
3100
  break;
3096
3101
  case "z":
3097
3102
  case "Z":
@@ -3100,31 +3105,31 @@ const Wr = (t2, e3, s2) => {
3100
3105
  l2 ? (n2.push(l2), o2 = l2[0]) : o2 = "";
3101
3106
  }
3102
3107
  return n2;
3103
- }, zr = (t2, e3, s2, i2) => Math.sqrt((s2 - t2) ** 2 + (i2 - e3) ** 2), Gr = (t2, e3, s2, i2, r2, n2, o2, a2) => (h2) => {
3108
+ }, on = (t2, e3, s2, i2) => Math.sqrt((s2 - t2) ** 2 + (i2 - e3) ** 2), an = (t2, e3, s2, i2, r2, n2, o2, a2) => (h2) => {
3104
3109
  const c2 = h2 ** 3, l2 = ((t3) => 3 * t3 ** 2 * (1 - t3))(h2), u2 = ((t3) => 3 * t3 * (1 - t3) ** 2)(h2), d2 = ((t3) => (1 - t3) ** 3)(h2);
3105
3110
  return new ot(o2 * c2 + r2 * l2 + s2 * u2 + t2 * d2, a2 * c2 + n2 * l2 + i2 * u2 + e3 * d2);
3106
- }, Hr = (t2) => t2 ** 2, Nr = (t2) => 2 * t2 * (1 - t2), Ur = (t2) => (1 - t2) ** 2, qr = (t2, e3, s2, i2, r2, n2, o2, a2) => (h2) => {
3107
- const c2 = Hr(h2), l2 = Nr(h2), u2 = Ur(h2), d2 = 3 * (u2 * (s2 - t2) + l2 * (r2 - s2) + c2 * (o2 - r2)), g2 = 3 * (u2 * (i2 - e3) + l2 * (n2 - i2) + c2 * (a2 - n2));
3111
+ }, hn = (t2) => t2 ** 2, cn = (t2) => 2 * t2 * (1 - t2), ln = (t2) => (1 - t2) ** 2, un = (t2, e3, s2, i2, r2, n2, o2, a2) => (h2) => {
3112
+ const c2 = hn(h2), l2 = cn(h2), u2 = ln(h2), d2 = 3 * (u2 * (s2 - t2) + l2 * (r2 - s2) + c2 * (o2 - r2)), g2 = 3 * (u2 * (i2 - e3) + l2 * (n2 - i2) + c2 * (a2 - n2));
3108
3113
  return Math.atan2(g2, d2);
3109
- }, Kr = (t2, e3, s2, i2, r2, n2) => (o2) => {
3110
- const a2 = Hr(o2), h2 = Nr(o2), c2 = Ur(o2);
3114
+ }, dn = (t2, e3, s2, i2, r2, n2) => (o2) => {
3115
+ const a2 = hn(o2), h2 = cn(o2), c2 = ln(o2);
3111
3116
  return new ot(r2 * a2 + s2 * h2 + t2 * c2, n2 * a2 + i2 * h2 + e3 * c2);
3112
- }, Jr = (t2, e3, s2, i2, r2, n2) => (o2) => {
3117
+ }, gn = (t2, e3, s2, i2, r2, n2) => (o2) => {
3113
3118
  const a2 = 1 - o2, h2 = 2 * (a2 * (s2 - t2) + o2 * (r2 - s2)), c2 = 2 * (a2 * (i2 - e3) + o2 * (n2 - i2));
3114
3119
  return Math.atan2(c2, h2);
3115
- }, Qr = (t2, e3, s2) => {
3120
+ }, fn = (t2, e3, s2) => {
3116
3121
  let i2 = new ot(e3, s2), r2 = 0;
3117
3122
  for (let e4 = 1; e4 <= 100; e4 += 1) {
3118
3123
  const s3 = t2(e4 / 100);
3119
- r2 += zr(i2.x, i2.y, s3.x, s3.y), i2 = s3;
3124
+ r2 += on(i2.x, i2.y, s3.x, s3.y), i2 = s3;
3120
3125
  }
3121
3126
  return r2;
3122
- }, Zr = (t2, e3) => {
3127
+ }, pn = (t2, e3) => {
3123
3128
  let i2, r2 = 0, n2 = 0, o2 = { x: t2.x, y: t2.y }, a2 = s({}, o2), h2 = 0.01, c2 = 0;
3124
3129
  const l2 = t2.iterator, u2 = t2.angleFinder;
3125
- for (; n2 < e3 && h2 > 1e-4; ) a2 = l2(r2), c2 = r2, i2 = zr(o2.x, o2.y, a2.x, a2.y), i2 + n2 > e3 ? (r2 -= h2, h2 /= 2) : (o2 = a2, r2 += h2, n2 += i2);
3130
+ for (; n2 < e3 && h2 > 1e-4; ) a2 = l2(r2), c2 = r2, i2 = on(o2.x, o2.y, a2.x, a2.y), i2 + n2 > e3 ? (r2 -= h2, h2 /= 2) : (o2 = a2, r2 += h2, n2 += i2);
3126
3131
  return s(s({}, a2), {}, { angle: u2(c2) });
3127
- }, $r = (t2) => {
3132
+ }, mn = (t2) => {
3128
3133
  let e3, s2, i2 = 0, r2 = 0, n2 = 0, o2 = 0, a2 = 0;
3129
3134
  const h2 = [];
3130
3135
  for (const c2 of t2) {
@@ -3134,22 +3139,22 @@ const Wr = (t2, e3, s2) => {
3134
3139
  s2 = t3, s2.x = o2 = r2 = c2[1], s2.y = a2 = n2 = c2[2];
3135
3140
  break;
3136
3141
  case "L":
3137
- s2 = t3, s2.length = zr(r2, n2, c2[1], c2[2]), r2 = c2[1], n2 = c2[2];
3142
+ s2 = t3, s2.length = on(r2, n2, c2[1], c2[2]), r2 = c2[1], n2 = c2[2];
3138
3143
  break;
3139
3144
  case "C":
3140
- e3 = Gr(r2, n2, c2[1], c2[2], c2[3], c2[4], c2[5], c2[6]), s2 = t3, s2.iterator = e3, s2.angleFinder = qr(r2, n2, c2[1], c2[2], c2[3], c2[4], c2[5], c2[6]), s2.length = Qr(e3, r2, n2), r2 = c2[5], n2 = c2[6];
3145
+ e3 = an(r2, n2, c2[1], c2[2], c2[3], c2[4], c2[5], c2[6]), s2 = t3, s2.iterator = e3, s2.angleFinder = un(r2, n2, c2[1], c2[2], c2[3], c2[4], c2[5], c2[6]), s2.length = fn(e3, r2, n2), r2 = c2[5], n2 = c2[6];
3141
3146
  break;
3142
3147
  case "Q":
3143
- e3 = Kr(r2, n2, c2[1], c2[2], c2[3], c2[4]), s2 = t3, s2.iterator = e3, s2.angleFinder = Jr(r2, n2, c2[1], c2[2], c2[3], c2[4]), s2.length = Qr(e3, r2, n2), r2 = c2[3], n2 = c2[4];
3148
+ e3 = dn(r2, n2, c2[1], c2[2], c2[3], c2[4]), s2 = t3, s2.iterator = e3, s2.angleFinder = gn(r2, n2, c2[1], c2[2], c2[3], c2[4]), s2.length = fn(e3, r2, n2), r2 = c2[3], n2 = c2[4];
3144
3149
  break;
3145
3150
  case "Z":
3146
- s2 = t3, s2.destX = o2, s2.destY = a2, s2.length = zr(r2, n2, o2, a2), r2 = o2, n2 = a2;
3151
+ s2 = t3, s2.destX = o2, s2.destY = a2, s2.length = on(r2, n2, o2, a2), r2 = o2, n2 = a2;
3147
3152
  }
3148
3153
  i2 += s2.length, h2.push(s2);
3149
3154
  }
3150
3155
  return h2.push({ length: i2, x: r2, y: n2 }), h2;
3151
- }, tn = function(t2, e3) {
3152
- let i2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : $r(t2), r2 = 0;
3156
+ }, vn = function(t2, e3) {
3157
+ let i2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : mn(t2), r2 = 0;
3153
3158
  for (; e3 - i2[r2].length > 0 && r2 < i2.length - 2; ) e3 -= i2[r2].length, r2++;
3154
3159
  const n2 = i2[r2], o2 = e3 / n2.length, a2 = t2[r2];
3155
3160
  switch (n2.command) {
@@ -3161,40 +3166,40 @@ const Wr = (t2, e3, s2) => {
3161
3166
  return s(s({}, new ot(n2.x, n2.y).lerp(new ot(a2[1], a2[2]), o2)), {}, { angle: Math.atan2(a2[2] - n2.y, a2[1] - n2.x) });
3162
3167
  case "C":
3163
3168
  case "Q":
3164
- return Zr(n2, e3);
3169
+ return pn(n2, e3);
3165
3170
  }
3166
- }, en = new RegExp("[mzlhvcsqta][^mzlhvcsqta]*", "gi"), sn = new RegExp(Rr, "g"), rn = new RegExp(Ve, "gi"), nn = { m: 2, l: 2, h: 1, v: 1, c: 6, s: 4, q: 4, t: 2, a: 7 }, on = (t2) => {
3171
+ }, yn = new RegExp("[mzlhvcsqta][^mzlhvcsqta]*", "gi"), _n = new RegExp(Zr, "g"), xn = new RegExp(is, "gi"), Cn = { m: 2, l: 2, h: 1, v: 1, c: 6, s: 4, q: 4, t: 2, a: 7 }, bn = (t2) => {
3167
3172
  var e3;
3168
- const s2 = [], i2 = null !== (e3 = t2.match(en)) && void 0 !== e3 ? e3 : [];
3173
+ const s2 = [], i2 = null !== (e3 = t2.match(yn)) && void 0 !== e3 ? e3 : [];
3169
3174
  for (const t3 of i2) {
3170
3175
  const e4 = t3[0];
3171
3176
  if ("z" === e4 || "Z" === e4) {
3172
3177
  s2.push([e4]);
3173
3178
  continue;
3174
3179
  }
3175
- const i3 = nn[e4.toLowerCase()];
3180
+ const i3 = Cn[e4.toLowerCase()];
3176
3181
  let r2 = [];
3177
3182
  if ("a" === e4 || "A" === e4) {
3178
- sn.lastIndex = 0;
3179
- for (let e5 = null; e5 = sn.exec(t3); ) r2.push(...e5.slice(1));
3180
- } else r2 = t3.match(rn) || [];
3183
+ _n.lastIndex = 0;
3184
+ for (let e5 = null; e5 = _n.exec(t3); ) r2.push(...e5.slice(1));
3185
+ } else r2 = t3.match(xn) || [];
3181
3186
  for (let t4 = 0; t4 < r2.length; t4 += i3) {
3182
- const n2 = new Array(i3), o2 = Br[e4];
3187
+ const n2 = new Array(i3), o2 = $r[e4];
3183
3188
  n2[0] = t4 > 0 && o2 ? o2 : e4;
3184
3189
  for (let e5 = 0; e5 < i3; e5++) n2[e5 + 1] = parseFloat(r2[t4 + e5]);
3185
3190
  s2.push(n2);
3186
3191
  }
3187
3192
  }
3188
3193
  return s2;
3189
- }, hn = (t2, e3) => t2.map((t3) => t3.map((t4, s2) => 0 === s2 || void 0 === e3 ? t4 : Vt(t4, e3)).join(" ")).join(" ");
3190
- function cn(t2, e3) {
3194
+ }, wn = (t2, e3) => t2.map((t3) => t3.map((t4, s2) => 0 === s2 || void 0 === e3 ? t4 : Vt(t4, e3)).join(" ")).join(" ");
3195
+ function Tn(t2, e3) {
3191
3196
  const s2 = t2.style;
3192
3197
  s2 && e3 && ("string" == typeof e3 ? s2.cssText += ";" + e3 : Object.entries(e3).forEach((t3) => {
3193
3198
  let [e4, i2] = t3;
3194
3199
  return s2.setProperty(e4, i2);
3195
3200
  }));
3196
3201
  }
3197
- class fn extends te {
3202
+ class Pn extends te {
3198
3203
  constructor(e3) {
3199
3204
  let { allowTouchScrolling: s2 = false, containerClass: i2 = "" } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3200
3205
  super(e3), t(this, "upper", void 0), t(this, "container", void 0);
@@ -3209,11 +3214,11 @@ class fn extends te {
3209
3214
  }
3210
3215
  createContainerElement() {
3211
3216
  const t2 = m().createElement("div");
3212
- return t2.setAttribute("data-fabric", "wrapper"), cn(t2, { position: "relative" }), $t(t2), t2;
3217
+ return t2.setAttribute("data-fabric", "wrapper"), Tn(t2, { position: "relative" }), $t(t2), t2;
3213
3218
  }
3214
3219
  applyCanvasStyle(t2, e3) {
3215
3220
  const { styles: i2, allowTouchScrolling: r2 } = e3;
3216
- cn(t2, s(s({}, i2), {}, { "touch-action": r2 ? "manipulation" : j })), $t(t2);
3221
+ Tn(t2, s(s({}, i2), {}, { "touch-action": r2 ? "manipulation" : j })), $t(t2);
3217
3222
  }
3218
3223
  setDimensions(t2, e3) {
3219
3224
  super.setDimensions(t2, e3);
@@ -3231,12 +3236,12 @@ class fn extends te {
3231
3236
  super.dispose(), p().dispose(this.upper.el), delete this.upper, delete this.container;
3232
3237
  }
3233
3238
  }
3234
- class pn extends se {
3239
+ class En extends ie {
3235
3240
  constructor() {
3236
- super(...arguments), t(this, "targets", []), t(this, "_hoveredTargets", []), t(this, "_objectsToRender", void 0), t(this, "_currentTransform", null), t(this, "_groupSelector", null), t(this, "contextTopDirty", false);
3241
+ super(...arguments), t(this, "targets", []), t(this, "_hoveredTargets", []), t(this, "_currentTransform", null), t(this, "_groupSelector", null), t(this, "contextTopDirty", false);
3237
3242
  }
3238
3243
  static getDefaults() {
3239
- return s(s({}, super.getDefaults()), pn.ownDefaults);
3244
+ return s(s({}, super.getDefaults()), En.ownDefaults);
3240
3245
  }
3241
3246
  get upperCanvasEl() {
3242
3247
  var t2;
@@ -3250,7 +3255,7 @@ class pn extends se {
3250
3255
  return this.elements.container;
3251
3256
  }
3252
3257
  initElements(t2) {
3253
- this.elements = new fn(t2, { allowTouchScrolling: this.allowTouchScrolling, containerClass: this.containerClass }), this._createCacheCanvas();
3258
+ this.elements = new Pn(t2, { allowTouchScrolling: this.allowTouchScrolling, containerClass: this.containerClass }), this._createCacheCanvas();
3254
3259
  }
3255
3260
  _onObjectAdded(t2) {
3256
3261
  this._objectsToRender = void 0, super._onObjectAdded(t2);
@@ -3286,7 +3291,7 @@ class pn extends se {
3286
3291
  const n2 = t2.selectionBackgroundColor;
3287
3292
  t2.selectionBackgroundColor = "", t2.render(r2), t2.selectionBackgroundColor = n2, r2.restore();
3288
3293
  const o2 = Math.round(i2 * this.getRetinaScaling());
3289
- return xi(r2, o2, o2, o2);
3294
+ return Ri(r2, o2, o2, o2);
3290
3295
  }
3291
3296
  _isSelectionKeyPressed(t2) {
3292
3297
  const e3 = this.selectionKey;
@@ -3299,7 +3304,7 @@ class pn extends se {
3299
3304
  _shouldCenterTransform(t2, e3, s2) {
3300
3305
  if (!t2) return;
3301
3306
  let i2;
3302
- return e3 === G || e3 === H || e3 === N || e3 === Y ? i2 = this.centeredScaling || t2.centeredScaling : e3 === I && (i2 = this.centeredRotation || t2.centeredRotation), i2 ? !s2 : s2;
3307
+ return e3 === G || e3 === H || e3 === N || e3 === Y ? i2 = this.centeredScaling || t2.centeredScaling : e3 === B && (i2 = this.centeredRotation || t2.centeredRotation), i2 ? !s2 : s2;
3303
3308
  }
3304
3309
  _getOriginFromCorner(t2, e3) {
3305
3310
  const s2 = { x: t2.originX, y: t2.originY };
@@ -3307,11 +3312,11 @@ class pn extends se {
3307
3312
  }
3308
3313
  _setupCurrentTransform(t2, e3, i2) {
3309
3314
  var r2;
3310
- const n2 = e3.group ? pe(this.getScenePoint(t2), void 0, e3.group.calcTransformMatrix()) : this.getScenePoint(t2), { key: o2 = "", control: a2 } = e3.getActiveControl() || {}, h2 = i2 && a2 ? null === (r2 = a2.getActionHandler(t2, e3, a2)) || void 0 === r2 ? void 0 : r2.bind(a2) : De, c2 = ((t3, e4, s2, i3) => {
3315
+ const n2 = e3.group ? me(this.getScenePoint(t2), void 0, e3.group.calcTransformMatrix()) : this.getScenePoint(t2), { key: o2 = "", control: a2 } = e3.getActiveControl() || {}, h2 = i2 && a2 ? null === (r2 = a2.getActionHandler(t2, e3, a2)) || void 0 === r2 ? void 0 : r2.bind(a2) : Me, c2 = ((t3, e4, s2, i3) => {
3311
3316
  if (!e4 || !t3) return "drag";
3312
3317
  const r3 = i3.controls[e4];
3313
3318
  return r3.getActionName(s2, r3, i3);
3314
- })(i2, o2, t2, e3), l2 = t2[this.centeredKey], u2 = this._shouldCenterTransform(e3, c2, l2) ? { x: D, y: D } : this._getOriginFromCorner(e3, o2), d2 = { target: e3, action: c2, actionHandler: h2, actionPerformed: false, corner: o2, scaleX: e3.scaleX, scaleY: e3.scaleY, skewX: e3.skewX, skewY: e3.skewY, offsetX: n2.x - e3.left, offsetY: n2.y - e3.top, originX: u2.x, originY: u2.y, ex: n2.x, ey: n2.y, lastX: n2.x, lastY: n2.y, theta: xt(e3.angle), width: e3.width, height: e3.height, shiftKey: t2.shiftKey, altKey: l2, original: s(s({}, de(e3)), {}, { originX: u2.x, originY: u2.y }) };
3319
+ })(i2, o2, t2, e3), l2 = t2[this.centeredKey], u2 = this._shouldCenterTransform(e3, c2, l2) ? { x: D, y: D } : this._getOriginFromCorner(e3, o2), d2 = { target: e3, action: c2, actionHandler: h2, actionPerformed: false, corner: o2, scaleX: e3.scaleX, scaleY: e3.scaleY, skewX: e3.skewX, skewY: e3.skewY, offsetX: n2.x - e3.left, offsetY: n2.y - e3.top, originX: u2.x, originY: u2.y, ex: n2.x, ey: n2.y, lastX: n2.x, lastY: n2.y, theta: xt(e3.angle), width: e3.width, height: e3.height, shiftKey: t2.shiftKey, altKey: l2, original: s(s({}, ge(e3)), {}, { originX: u2.x, originY: u2.y }) };
3315
3320
  this._currentTransform = d2, this.fire("before:transform", { e: t2, transform: d2 });
3316
3321
  }
3317
3322
  setCursor(t2) {
@@ -3320,13 +3325,13 @@ class pn extends se {
3320
3325
  _drawSelection(t2) {
3321
3326
  const { x: e3, y: s2, deltaX: i2, deltaY: r2 } = this._groupSelector, n2 = new ot(e3, s2).transform(this.viewportTransform), o2 = new ot(e3 + i2, s2 + r2).transform(this.viewportTransform), a2 = this.selectionLineWidth / 2;
3322
3327
  let h2 = Math.min(n2.x, o2.x), c2 = Math.min(n2.y, o2.y), l2 = Math.max(n2.x, o2.x), u2 = Math.max(n2.y, o2.y);
3323
- this.selectionColor && (t2.fillStyle = this.selectionColor, t2.fillRect(h2, c2, l2 - h2, u2 - c2)), this.selectionLineWidth && this.selectionBorderColor && (t2.lineWidth = this.selectionLineWidth, t2.strokeStyle = this.selectionBorderColor, h2 += a2, c2 += a2, l2 -= a2, u2 -= a2, _i.prototype._setLineDash.call(this, t2, this.selectionDashArray), t2.strokeRect(h2, c2, l2 - h2, u2 - c2));
3328
+ this.selectionColor && (t2.fillStyle = this.selectionColor, t2.fillRect(h2, c2, l2 - h2, u2 - c2)), this.selectionLineWidth && this.selectionBorderColor && (t2.lineWidth = this.selectionLineWidth, t2.strokeStyle = this.selectionBorderColor, h2 += a2, c2 += a2, l2 -= a2, u2 -= a2, Li.prototype._setLineDash.call(this, t2, this.selectionDashArray), t2.strokeRect(h2, c2, l2 - h2, u2 - c2));
3324
3329
  }
3325
3330
  findTarget(t2) {
3326
3331
  if (this.skipTargetFind) return;
3327
3332
  const e3 = this.getViewportPoint(t2), s2 = this._activeObject, i2 = this.getActiveObjects();
3328
3333
  if (this.targets = [], s2 && i2.length >= 1) {
3329
- if (s2.findControl(e3, ne(t2))) return s2;
3334
+ if (s2.findControl(e3, oe(t2))) return s2;
3330
3335
  if (i2.length > 1 && this.searchPossibleTargets([s2], e3)) return s2;
3331
3336
  if (s2 === this.searchPossibleTargets([s2], e3)) {
3332
3337
  if (this.preserveObjectStacking) {
@@ -3347,10 +3352,10 @@ class pn extends se {
3347
3352
  const [t3, e4, i3, n2] = s2, o2 = Math.atan2(e4.y - t3.y, e4.x - t3.x), a2 = rt(o2) * r2, h2 = nt(o2) * r2, c2 = a2 + h2, l2 = a2 - h2;
3348
3353
  s2 = [new ot(t3.x - l2, t3.y - c2), new ot(e4.x + c2, e4.y - l2), new ot(i3.x + l2, i3.y + c2), new ot(n2.x - c2, n2.y + l2)];
3349
3354
  }
3350
- return Ls.isPointInPolygon(e3, s2);
3355
+ return Qs.isPointInPolygon(e3, s2);
3351
3356
  }
3352
3357
  _checkTarget(t2, e3) {
3353
- if (t2 && t2.visible && t2.evented && this._pointIsInObjectSelectionArea(t2, pe(e3, void 0, this.viewportTransform))) {
3358
+ if (t2 && t2.visible && t2.evented && this._pointIsInObjectSelectionArea(t2, me(e3, void 0, this.viewportTransform))) {
3354
3359
  if (!this.perPixelTargetFind && !t2.perPixelTargetFind || t2.isEditing) return true;
3355
3360
  if (!this.isTargetTransparent(t2, e3.x, e3.y)) return true;
3356
3361
  }
@@ -3390,8 +3395,8 @@ class pn extends se {
3390
3395
  getPointer(t2) {
3391
3396
  let e3 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
3392
3397
  const s2 = this.upperCanvasEl, i2 = s2.getBoundingClientRect();
3393
- let r2 = re(t2), n2 = i2.width || 0, o2 = i2.height || 0;
3394
- n2 && o2 || (P in i2 && E in i2 && (o2 = Math.abs(i2.top - i2.bottom)), A in i2 && M in i2 && (n2 = Math.abs(i2.right - i2.left))), this.calcOffset(), r2.x = r2.x - this._offset.left, r2.y = r2.y - this._offset.top, e3 || (r2 = pe(r2, void 0, this.viewportTransform));
3398
+ let r2 = ne(t2), n2 = i2.width || 0, o2 = i2.height || 0;
3399
+ n2 && o2 || (P in i2 && E in i2 && (o2 = Math.abs(i2.top - i2.bottom)), A in i2 && M in i2 && (n2 = Math.abs(i2.right - i2.left))), this.calcOffset(), r2.x = r2.x - this._offset.left, r2.y = r2.y - this._offset.top, e3 || (r2 = me(r2, void 0, this.viewportTransform));
3395
3400
  const a2 = this.getRetinaScaling();
3396
3401
  1 !== a2 && (r2.x /= a2, r2.y /= a2);
3397
3402
  const h2 = 0 === n2 || 0 === o2 ? new ot(1, 1) : new ot(s2.width / n2, s2.height / o2);
@@ -3478,7 +3483,7 @@ class pn extends se {
3478
3483
  const { group: e3 } = t2;
3479
3484
  if (e3 && Ut(e3) && this._activeObject === e3) {
3480
3485
  const s2 = Yt(t2, ["angle", "flipX", "flipY", M, H, N, U, q, P]);
3481
- return ce(t2, e3.calcOwnMatrix()), s2;
3486
+ return le(t2, e3.calcOwnMatrix()), s2;
3482
3487
  }
3483
3488
  return {};
3484
3489
  }
@@ -3487,8 +3492,8 @@ class pn extends se {
3487
3492
  super._setSVGObject(t2, e3, s2), e3.set(i2);
3488
3493
  }
3489
3494
  }
3490
- t(pn, "ownDefaults", { uniformScaling: true, uniScaleKey: "shiftKey", centeredScaling: false, centeredRotation: false, centeredKey: "altKey", altActionKey: "shiftKey", selection: true, selectionKey: "shiftKey", selectionColor: "rgba(100, 100, 255, 0.3)", selectionDashArray: [], selectionBorderColor: "rgba(255, 255, 255, 0.3)", selectionLineWidth: 1, selectionFullyContained: false, hoverCursor: "move", moveCursor: "move", defaultCursor: "default", freeDrawingCursor: "crosshair", notAllowedCursor: "not-allowed", perPixelTargetFind: false, targetFindTolerance: 0, skipTargetFind: false, stopContextMenu: false, fireRightClick: false, fireMiddleClick: false, enablePointerEvents: false, containerClass: "canvas-container", preserveObjectStacking: false });
3491
- class mn {
3495
+ t(En, "ownDefaults", { uniformScaling: true, uniScaleKey: "shiftKey", centeredScaling: false, centeredRotation: false, centeredKey: "altKey", altActionKey: "shiftKey", selection: true, selectionKey: "shiftKey", selectionColor: "rgba(100, 100, 255, 0.3)", selectionDashArray: [], selectionBorderColor: "rgba(255, 255, 255, 0.3)", selectionLineWidth: 1, selectionFullyContained: false, hoverCursor: "move", moveCursor: "move", defaultCursor: "default", freeDrawingCursor: "crosshair", notAllowedCursor: "not-allowed", perPixelTargetFind: false, targetFindTolerance: 0, skipTargetFind: false, stopContextMenu: false, fireRightClick: false, fireMiddleClick: false, enablePointerEvents: false, containerClass: "canvas-container", preserveObjectStacking: false });
3496
+ class An {
3492
3497
  constructor(e3) {
3493
3498
  t(this, "targets", []), t(this, "__disposer", void 0);
3494
3499
  const s2 = () => {
@@ -3525,45 +3530,45 @@ class mn {
3525
3530
  this.clear(), this.__disposer(), delete this.__disposer;
3526
3531
  }
3527
3532
  }
3528
- const vn = ["target", "oldTarget", "fireCanvas", "e"], yn = { passive: false }, _n = (t2, e3) => {
3533
+ const jn = ["target", "oldTarget", "fireCanvas", "e"], Fn = { passive: false }, Ln = (t2, e3) => {
3529
3534
  const s2 = t2.getViewportPoint(e3), i2 = t2.getScenePoint(e3);
3530
3535
  return { viewportPoint: s2, scenePoint: i2, pointer: s2, absolutePointer: i2 };
3531
- }, xn = function(t2) {
3536
+ }, Rn = function(t2) {
3532
3537
  for (var e3 = arguments.length, s2 = new Array(e3 > 1 ? e3 - 1 : 0), i2 = 1; i2 < e3; i2++) s2[i2 - 1] = arguments[i2];
3533
3538
  return t2.addEventListener(...s2);
3534
- }, Cn = function(t2) {
3539
+ }, In = function(t2) {
3535
3540
  for (var e3 = arguments.length, s2 = new Array(e3 > 1 ? e3 - 1 : 0), i2 = 1; i2 < e3; i2++) s2[i2 - 1] = arguments[i2];
3536
3541
  return t2.removeEventListener(...s2);
3537
- }, bn = { mouse: { in: "over", out: "out", targetIn: "mouseover", targetOut: "mouseout", canvasIn: "mouse:over", canvasOut: "mouse:out" }, drag: { in: "enter", out: "leave", targetIn: "dragenter", targetOut: "dragleave", canvasIn: "drag:enter", canvasOut: "drag:leave" } };
3538
- class Sn extends pn {
3542
+ }, Bn = { mouse: { in: "over", out: "out", targetIn: "mouseover", targetOut: "mouseout", canvasIn: "mouse:over", canvasOut: "mouse:out" }, drag: { in: "enter", out: "leave", targetIn: "dragenter", targetOut: "dragleave", canvasIn: "drag:enter", canvasOut: "drag:leave" } };
3543
+ class Xn extends En {
3539
3544
  constructor(e3) {
3540
- super(e3, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}), t(this, "_isClick", void 0), t(this, "textEditingManager", new mn(this)), ["_onMouseDown", "_onTouchStart", "_onMouseMove", "_onMouseUp", "_onTouchEnd", "_onResize", "_onMouseWheel", "_onMouseOut", "_onMouseEnter", "_onContextMenu", "_onClick", "_onDragStart", "_onDragEnd", "_onDragProgress", "_onDragOver", "_onDragEnter", "_onDragLeave", "_onDrop"].forEach((t2) => {
3545
+ super(e3, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}), t(this, "_isClick", void 0), t(this, "textEditingManager", new An(this)), ["_onMouseDown", "_onTouchStart", "_onMouseMove", "_onMouseUp", "_onTouchEnd", "_onResize", "_onMouseWheel", "_onMouseOut", "_onMouseEnter", "_onContextMenu", "_onClick", "_onDragStart", "_onDragEnd", "_onDragProgress", "_onDragOver", "_onDragEnter", "_onDragLeave", "_onDrop"].forEach((t2) => {
3541
3546
  this[t2] = this[t2].bind(this);
3542
- }), this.addOrRemove(xn, "add");
3547
+ }), this.addOrRemove(Rn, "add");
3543
3548
  }
3544
3549
  _getEventPrefix() {
3545
3550
  return this.enablePointerEvents ? "pointer" : "mouse";
3546
3551
  }
3547
3552
  addOrRemove(t2, e3) {
3548
3553
  const s2 = this.upperCanvasEl, i2 = this._getEventPrefix();
3549
- t2(Jt(s2), "resize", this._onResize), t2(s2, i2 + "down", this._onMouseDown), t2(s2, "".concat(i2, "move"), this._onMouseMove, yn), t2(s2, "".concat(i2, "out"), this._onMouseOut), t2(s2, "".concat(i2, "enter"), this._onMouseEnter), t2(s2, "wheel", this._onMouseWheel), t2(s2, "contextmenu", this._onContextMenu), t2(s2, "click", this._onClick), t2(s2, "dblclick", this._onClick), t2(s2, "dragstart", this._onDragStart), t2(s2, "dragend", this._onDragEnd), t2(s2, "dragover", this._onDragOver), t2(s2, "dragenter", this._onDragEnter), t2(s2, "dragleave", this._onDragLeave), t2(s2, "drop", this._onDrop), this.enablePointerEvents || t2(s2, "touchstart", this._onTouchStart, yn);
3554
+ t2(Jt(s2), "resize", this._onResize), t2(s2, i2 + "down", this._onMouseDown), t2(s2, "".concat(i2, "move"), this._onMouseMove, Fn), t2(s2, "".concat(i2, "out"), this._onMouseOut), t2(s2, "".concat(i2, "enter"), this._onMouseEnter), t2(s2, "wheel", this._onMouseWheel, { passive: false }), t2(s2, "contextmenu", this._onContextMenu), t2(s2, "click", this._onClick), t2(s2, "dblclick", this._onClick), t2(s2, "dragstart", this._onDragStart), t2(s2, "dragend", this._onDragEnd), t2(s2, "dragover", this._onDragOver), t2(s2, "dragenter", this._onDragEnter), t2(s2, "dragleave", this._onDragLeave), t2(s2, "drop", this._onDrop), this.enablePointerEvents || t2(s2, "touchstart", this._onTouchStart, Fn);
3550
3555
  }
3551
3556
  removeListeners() {
3552
- this.addOrRemove(Cn, "remove");
3557
+ this.addOrRemove(In, "remove");
3553
3558
  const t2 = this._getEventPrefix(), e3 = Kt(this.upperCanvasEl);
3554
- Cn(e3, "".concat(t2, "up"), this._onMouseUp), Cn(e3, "touchend", this._onTouchEnd, yn), Cn(e3, "".concat(t2, "move"), this._onMouseMove, yn), Cn(e3, "touchmove", this._onMouseMove, yn), clearTimeout(this._willAddMouseDown);
3559
+ In(e3, "".concat(t2, "up"), this._onMouseUp), In(e3, "touchend", this._onTouchEnd, Fn), In(e3, "".concat(t2, "move"), this._onMouseMove, Fn), In(e3, "touchmove", this._onMouseMove, Fn), clearTimeout(this._willAddMouseDown);
3555
3560
  }
3556
3561
  _onMouseWheel(t2) {
3557
3562
  this.__onMouseWheel(t2);
3558
3563
  }
3559
3564
  _onMouseOut(t2) {
3560
- const e3 = this._hoveredTarget, i2 = s({ e: t2 }, _n(this, t2));
3565
+ const e3 = this._hoveredTarget, i2 = s({ e: t2 }, Ln(this, t2));
3561
3566
  this.fire("mouse:out", s(s({}, i2), {}, { target: e3 })), this._hoveredTarget = void 0, e3 && e3.fire("mouseout", s({}, i2)), this._hoveredTargets.forEach((t3) => {
3562
3567
  this.fire("mouse:out", s(s({}, i2), {}, { target: t3 })), t3 && t3.fire("mouseout", s({}, i2));
3563
3568
  }), this._hoveredTargets = [];
3564
3569
  }
3565
3570
  _onMouseEnter(t2) {
3566
- this._currentTransform || this.findTarget(t2) || (this.fire("mouse:over", s({ e: t2 }, _n(this, t2))), this._hoveredTarget = void 0, this._hoveredTargets = []);
3571
+ this._currentTransform || this.findTarget(t2) || (this.fire("mouse:over", s({ e: t2 }, Ln(this, t2))), this._hoveredTarget = void 0, this._hoveredTargets = []);
3567
3572
  }
3568
3573
  _onDragStart(t2) {
3569
3574
  this._isClick = false;
@@ -3571,9 +3576,9 @@ class Sn extends pn {
3571
3576
  if (e3 && e3.onDragStart(t2)) {
3572
3577
  this._dragSource = e3;
3573
3578
  const s2 = { e: t2, target: e3 };
3574
- return this.fire("dragstart", s2), e3.fire("dragstart", s2), void xn(this.upperCanvasEl, "drag", this._onDragProgress);
3579
+ return this.fire("dragstart", s2), e3.fire("dragstart", s2), void Rn(this.upperCanvasEl, "drag", this._onDragProgress);
3575
3580
  }
3576
- oe(t2);
3581
+ ae(t2);
3577
3582
  }
3578
3583
  _renderDragEffects(t2, e3, s2) {
3579
3584
  let i2 = false;
@@ -3584,7 +3589,7 @@ class Sn extends pn {
3584
3589
  }
3585
3590
  _onDragEnd(t2) {
3586
3591
  const e3 = !!t2.dataTransfer && t2.dataTransfer.dropEffect !== j, s2 = e3 ? this._activeObject : void 0, i2 = { e: t2, target: this._dragSource, subTargets: this.targets, dragSource: this._dragSource, didDrop: e3, dropTarget: s2 };
3587
- Cn(this.upperCanvasEl, "drag", this._onDragProgress), this.fire("dragend", i2), this._dragSource && this._dragSource.fire("dragend", i2), delete this._dragSource, this._onMouseUp(t2);
3592
+ In(this.upperCanvasEl, "drag", this._onDragProgress), this.fire("dragend", i2), this._dragSource && this._dragSource.fire("dragend", i2), delete this._dragSource, this._onMouseUp(t2);
3588
3593
  }
3589
3594
  _onDragProgress(t2) {
3590
3595
  const e3 = { e: t2, target: this._dragSource, dragSource: this._dragSource, dropTarget: this._draggedoverTarget };
@@ -3613,12 +3618,12 @@ class Sn extends pn {
3613
3618
  this.fire("dragleave", e3), this._fireEnterLeaveEvents(void 0, e3), this._renderDragEffects(t2, this._dragSource), this._dropTarget = void 0, this.targets = [], this._hoveredTargets = [];
3614
3619
  }
3615
3620
  _onDrop(t2) {
3616
- const { target: e3, targets: i2 } = this.findDragTargets(t2), r2 = this._basicEventHandler("drop:before", s({ e: t2, target: e3, subTargets: i2, dragSource: this._dragSource }, _n(this, t2)));
3621
+ const { target: e3, targets: i2 } = this.findDragTargets(t2), r2 = this._basicEventHandler("drop:before", s({ e: t2, target: e3, subTargets: i2, dragSource: this._dragSource }, Ln(this, t2)));
3617
3622
  r2.didDrop = false, r2.dropTarget = void 0, this._basicEventHandler("drop", r2), this.fire("drop:after", r2);
3618
3623
  }
3619
3624
  _onContextMenu(t2) {
3620
3625
  const e3 = this.findTarget(t2), s2 = this.targets || [], i2 = this._basicEventHandler("contextmenu:before", { e: t2, target: e3, subTargets: s2 });
3621
- return this.stopContextMenu && oe(t2), this._basicEventHandler("contextmenu", i2), false;
3626
+ return this.stopContextMenu && ae(t2), this._basicEventHandler("contextmenu", i2), false;
3622
3627
  }
3623
3628
  _onClick(t2) {
3624
3629
  const e3 = t2.detail;
@@ -3636,21 +3641,21 @@ class Sn extends pn {
3636
3641
  const s2 = this._activeObject;
3637
3642
  void 0 === this.mainTouchId && (this.mainTouchId = this.getPointerId(t2)), this.__onMouseDown(t2), (this.isDrawingMode || s2 && this._target === s2) && (e3 = true), e3 && t2.preventDefault(), this._resetTransformEventData();
3638
3643
  const i2 = this.upperCanvasEl, r2 = this._getEventPrefix(), n2 = Kt(i2);
3639
- xn(n2, "touchend", this._onTouchEnd, yn), e3 && xn(n2, "touchmove", this._onMouseMove, yn), Cn(i2, "".concat(r2, "down"), this._onMouseDown);
3644
+ Rn(n2, "touchend", this._onTouchEnd, Fn), e3 && Rn(n2, "touchmove", this._onMouseMove, Fn), In(i2, "".concat(r2, "down"), this._onMouseDown);
3640
3645
  }
3641
3646
  _onMouseDown(t2) {
3642
3647
  this.__onMouseDown(t2), this._resetTransformEventData();
3643
3648
  const e3 = this.upperCanvasEl, s2 = this._getEventPrefix();
3644
- Cn(e3, "".concat(s2, "move"), this._onMouseMove, yn);
3649
+ In(e3, "".concat(s2, "move"), this._onMouseMove, Fn);
3645
3650
  const i2 = Kt(e3);
3646
- xn(i2, "".concat(s2, "up"), this._onMouseUp), xn(i2, "".concat(s2, "move"), this._onMouseMove, yn);
3651
+ Rn(i2, "".concat(s2, "up"), this._onMouseUp), Rn(i2, "".concat(s2, "move"), this._onMouseMove, Fn);
3647
3652
  }
3648
3653
  _onTouchEnd(t2) {
3649
3654
  if (t2.touches.length > 0) return;
3650
3655
  this.__onMouseUp(t2), this._resetTransformEventData(), delete this.mainTouchId;
3651
3656
  const e3 = this._getEventPrefix(), s2 = Kt(this.upperCanvasEl);
3652
- Cn(s2, "touchend", this._onTouchEnd, yn), Cn(s2, "touchmove", this._onMouseMove, yn), this._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(() => {
3653
- xn(this.upperCanvasEl, "".concat(e3, "down"), this._onMouseDown), this._willAddMouseDown = 0;
3657
+ In(s2, "touchend", this._onTouchEnd, Fn), In(s2, "touchmove", this._onMouseMove, Fn), this._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(() => {
3658
+ Rn(this.upperCanvasEl, "".concat(e3, "down"), this._onMouseDown), this._willAddMouseDown = 0;
3654
3659
  }, 400);
3655
3660
  }
3656
3661
  _onMouseUp(t2) {
@@ -3658,7 +3663,7 @@ class Sn extends pn {
3658
3663
  const e3 = this.upperCanvasEl, s2 = this._getEventPrefix();
3659
3664
  if (this._isMainEvent(t2)) {
3660
3665
  const t3 = Kt(this.upperCanvasEl);
3661
- Cn(t3, "".concat(s2, "up"), this._onMouseUp), Cn(t3, "".concat(s2, "move"), this._onMouseMove, yn), xn(e3, "".concat(s2, "move"), this._onMouseMove, yn);
3666
+ In(t3, "".concat(s2, "up"), this._onMouseUp), In(t3, "".concat(s2, "move"), this._onMouseMove, Fn), Rn(e3, "".concat(s2, "move"), this._onMouseMove, Fn);
3662
3667
  }
3663
3668
  }
3664
3669
  _onMouseMove(t2) {
@@ -3685,7 +3690,7 @@ class Sn extends pn {
3685
3690
  this.handleSelection(t2), h2 || (h2 = this._shouldRender(r2) || !e4 && r2 === this._activeObject);
3686
3691
  }
3687
3692
  if (r2) {
3688
- const e4 = r2.findControl(this.getViewportPoint(t2), ne(t2)), { key: i3, control: n3 } = e4 || {};
3693
+ const e4 = r2.findControl(this.getViewportPoint(t2), oe(t2)), { key: i3, control: n3 } = e4 || {};
3689
3694
  if (a2 = i3, r2.selectable && r2 !== this._activeObject && "up" === r2.activeOn) this.setActiveObject(r2, t2), h2 = true;
3690
3695
  else if (n3) {
3691
3696
  const e5 = n3.getMouseUpHandler(t2, r2, n3);
@@ -3706,7 +3711,7 @@ class Sn extends pn {
3706
3711
  return e3;
3707
3712
  }
3708
3713
  _handleEvent(t2, e3, i2) {
3709
- const r2 = this._target, n2 = this.targets || [], o2 = s(s(s({ e: t2, target: r2, subTargets: n2 }, _n(this, t2)), {}, { transform: this._currentTransform }, "up:before" === e3 || "up" === e3 ? { isClick: this._isClick, currentTarget: this.findTarget(t2), currentSubTargets: this.targets } : {}), "down:before" === e3 || "down" === e3 ? i2 : {});
3714
+ const r2 = this._target, n2 = this.targets || [], o2 = s(s(s({ e: t2, target: r2, subTargets: n2 }, Ln(this, t2)), {}, { transform: this._currentTransform }, "up:before" === e3 || "up" === e3 ? { isClick: this._isClick, currentTarget: this.findTarget(t2), currentSubTargets: this.targets } : {}), "down:before" === e3 || "down" === e3 ? i2 : {});
3710
3715
  this.fire("mouse:".concat(e3), o2), r2 && r2.fire("mouse".concat(e3), o2);
3711
3716
  for (let t3 = 0; t3 < n2.length; t3++) n2[t3] !== r2 && n2[t3].fire("mouse".concat(e3), o2);
3712
3717
  }
@@ -3741,7 +3746,7 @@ class Sn extends pn {
3741
3746
  }
3742
3747
  if (s2 = !!e3 && e3 === this._activeObject, e3) {
3743
3748
  e3.selectable && "down" === e3.activeOn && this.setActiveObject(e3, t2);
3744
- const i3 = e3.findControl(this.getViewportPoint(t2), ne(t2));
3749
+ const i3 = e3.findControl(this.getViewportPoint(t2), oe(t2));
3745
3750
  if (e3 === this._activeObject && (i3 || !n2)) {
3746
3751
  this._setupCurrentTransform(t2, e3, s2);
3747
3752
  const r3 = i3 ? i3.control : void 0, n3 = this.getScenePoint(t2), o2 = r3 && r3.getMouseDownHandler(t2, e3, r3);
@@ -3754,7 +3759,7 @@ class Sn extends pn {
3754
3759
  this._target = this._pointer = this._absolutePointer = void 0;
3755
3760
  }
3756
3761
  _cacheTransformEventData(t2) {
3757
- this._resetTransformEventData(), this._pointer = this.getViewportPoint(t2), this._absolutePointer = pe(this._pointer, void 0, this.viewportTransform), this._target = this._currentTransform ? this._currentTransform.target : this.findTarget(t2);
3762
+ this._resetTransformEventData(), this._pointer = this.getViewportPoint(t2), this._absolutePointer = me(this._pointer, void 0, this.viewportTransform), this._target = this._currentTransform ? this._currentTransform.target : this.findTarget(t2);
3758
3763
  }
3759
3764
  __onMouseMove(t2) {
3760
3765
  if (this._isClick = false, this._cacheTransformEventData(t2), this._handleEvent(t2, "move:before"), this.isDrawingMode) return void this._onMouseMoveInDrawingMode(t2);
@@ -3773,7 +3778,7 @@ class Sn extends pn {
3773
3778
  _fireOverOutEvents(t2, e3) {
3774
3779
  const s2 = this._hoveredTarget, i2 = this._hoveredTargets, r2 = this.targets, n2 = Math.max(i2.length, r2.length);
3775
3780
  this.fireSyntheticInOutEvents("mouse", { e: t2, target: e3, oldTarget: s2, fireCanvas: true });
3776
- for (let e4 = 0; e4 < n2; e4++) this.fireSyntheticInOutEvents("mouse", { e: t2, target: r2[e4], oldTarget: i2[e4] });
3781
+ for (let o2 = 0; o2 < n2; o2++) r2[o2] === e3 || i2[o2] && i2[o2] === s2 || this.fireSyntheticInOutEvents("mouse", { e: t2, target: r2[o2], oldTarget: i2[o2] });
3777
3782
  this._hoveredTarget = e3, this._hoveredTargets = this.targets.concat();
3778
3783
  }
3779
3784
  _fireEnterLeaveEvents(t2, e3) {
@@ -3783,14 +3788,14 @@ class Sn extends pn {
3783
3788
  this._draggedoverTarget = t2;
3784
3789
  }
3785
3790
  fireSyntheticInOutEvents(t2, e3) {
3786
- let { target: r2, oldTarget: n2, fireCanvas: o2, e: a2 } = e3, h2 = i(e3, vn);
3787
- const { targetIn: c2, targetOut: l2, canvasIn: u2, canvasOut: d2 } = bn[t2], g2 = n2 !== r2;
3791
+ let { target: r2, oldTarget: n2, fireCanvas: o2, e: a2 } = e3, h2 = i(e3, jn);
3792
+ const { targetIn: c2, targetOut: l2, canvasIn: u2, canvasOut: d2 } = Bn[t2], g2 = n2 !== r2;
3788
3793
  if (n2 && g2) {
3789
- const t3 = s(s({}, h2), {}, { e: a2, target: n2, nextTarget: r2 }, _n(this, a2));
3794
+ const t3 = s(s({}, h2), {}, { e: a2, target: n2, nextTarget: r2 }, Ln(this, a2));
3790
3795
  o2 && this.fire(d2, t3), n2.fire(l2, t3);
3791
3796
  }
3792
3797
  if (r2 && g2) {
3793
- const t3 = s(s({}, h2), {}, { e: a2, target: r2, previousTarget: n2 }, _n(this, a2));
3798
+ const t3 = s(s({}, h2), {}, { e: a2, target: r2, previousTarget: n2 }, Ln(this, a2));
3794
3799
  o2 && this.fire(u2, t3), r2.fire(c2, t3);
3795
3800
  }
3796
3801
  }
@@ -3798,7 +3803,7 @@ class Sn extends pn {
3798
3803
  this._cacheTransformEventData(t2), this._handleEvent(t2, "wheel"), this._resetTransformEventData();
3799
3804
  }
3800
3805
  _transformObject(t2) {
3801
- const e3 = this.getScenePoint(t2), s2 = this._currentTransform, i2 = s2.target, r2 = i2.group ? pe(e3, void 0, i2.group.calcTransformMatrix()) : e3;
3806
+ const e3 = this.getScenePoint(t2), s2 = this._currentTransform, i2 = s2.target, r2 = i2.group ? me(e3, void 0, i2.group.calcTransformMatrix()) : e3;
3802
3807
  s2.shiftKey = t2.shiftKey, s2.altKey = !!this.centeredKey && t2[this.centeredKey], this._performTransformAction(t2, s2, r2), s2.actionPerformed && this.requestRenderAll();
3803
3808
  }
3804
3809
  _performTransformAction(t2, e3, s2) {
@@ -3845,6 +3850,13 @@ class Sn extends pn {
3845
3850
  }
3846
3851
  return this._groupSelector = null, true;
3847
3852
  }
3853
+ toCanvasElement() {
3854
+ let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, e3 = arguments.length > 1 ? arguments[1] : void 0;
3855
+ const { upper: s2 } = this.elements;
3856
+ s2.ctx = void 0;
3857
+ const i2 = super.toCanvasElement(t2, e3);
3858
+ return s2.ctx = s2.el.getContext("2d"), i2;
3859
+ }
3848
3860
  clear() {
3849
3861
  this.textEditingManager.clear(), super.clear();
3850
3862
  }
@@ -3852,64 +3864,70 @@ class Sn extends pn {
3852
3864
  this.removeListeners(), this.textEditingManager.dispose(), super.destroy();
3853
3865
  }
3854
3866
  }
3855
- const wn = { x1: 0, y1: 0, x2: 0, y2: 0 }, Tn = s(s({}, wn), {}, { r1: 0, r2: 0 }), On = (t2, e3) => isNaN(t2) && "number" == typeof e3 ? e3 : t2, kn = /^(\d+\.\d+)%|(\d+)%$/;
3856
- function Dn(t2) {
3857
- return t2 && kn.test(t2);
3867
+ const Yn = { x1: 0, y1: 0, x2: 0, y2: 0 }, Wn = s(s({}, Yn), {}, { r1: 0, r2: 0 }), Vn = (t2, e3) => isNaN(t2) && "number" == typeof e3 ? e3 : t2;
3868
+ function zn(t2) {
3869
+ return t2 && /%$/.test(t2) && Number.isFinite(parseFloat(t2));
3858
3870
  }
3859
- function Mn(t2, e3) {
3860
- const s2 = "number" == typeof t2 ? t2 : "string" == typeof t2 ? parseFloat(t2) / (Dn(t2) ? 100 : 1) : NaN;
3861
- return gs(0, On(s2, e3), 1);
3871
+ function Gn(t2, e3) {
3872
+ const s2 = "number" == typeof t2 ? t2 : "string" == typeof t2 ? parseFloat(t2) / (zn(t2) ? 100 : 1) : NaN;
3873
+ return Ms(0, Vn(s2, e3), 1);
3862
3874
  }
3863
- const Pn = /\s*;\s*/, En = /\s*:\s*/;
3864
- function An(t2, e3) {
3875
+ const Hn = /\s*;\s*/, Nn = /\s*:\s*/;
3876
+ function Un(t2, e3) {
3865
3877
  let s2, i2;
3866
3878
  const r2 = t2.getAttribute("style");
3867
3879
  if (r2) {
3868
- const t3 = r2.split(Pn);
3880
+ const t3 = r2.split(Hn);
3869
3881
  "" === t3[t3.length - 1] && t3.pop();
3870
3882
  for (let e4 = t3.length; e4--; ) {
3871
- const [r3, n3] = t3[e4].split(En).map((t4) => t4.trim());
3883
+ const [r3, n3] = t3[e4].split(Nn).map((t4) => t4.trim());
3872
3884
  "stop-color" === r3 ? s2 = n3 : "stop-opacity" === r3 && (i2 = n3);
3873
3885
  }
3874
3886
  }
3875
- const n2 = new Le(s2 || t2.getAttribute("stop-color") || "rgb(0,0,0)");
3876
- return { offset: Mn(t2.getAttribute("offset"), 0), color: n2.toRgb(), opacity: On(parseFloat(i2 || t2.getAttribute("stop-opacity") || ""), 1) * n2.getAlpha() * e3 };
3887
+ const n2 = new Ie(s2 || t2.getAttribute("stop-color") || "rgb(0,0,0)");
3888
+ return { offset: Gn(t2.getAttribute("offset"), 0), color: n2.toRgb(), opacity: Vn(parseFloat(i2 || t2.getAttribute("stop-opacity") || ""), 1) * n2.getAlpha() * e3 };
3877
3889
  }
3878
- function jn(t2, e3) {
3879
- const s2 = [], i2 = t2.getElementsByTagName("stop"), r2 = Mn(e3, 1);
3880
- for (let t3 = i2.length; t3--; ) s2.push(An(i2[t3], r2));
3890
+ function qn(t2, e3) {
3891
+ const s2 = [], i2 = t2.getElementsByTagName("stop"), r2 = Gn(e3, 1);
3892
+ for (let t3 = i2.length; t3--; ) s2.push(Un(i2[t3], r2));
3881
3893
  return s2;
3882
3894
  }
3883
- function Fn(t2) {
3895
+ function Kn(t2) {
3884
3896
  return "linearGradient" === t2.nodeName || "LINEARGRADIENT" === t2.nodeName ? "linear" : "radial";
3885
3897
  }
3886
- function Ln(t2) {
3898
+ function Jn(t2) {
3887
3899
  return "userSpaceOnUse" === t2.getAttribute("gradientUnits") ? "pixels" : "percentage";
3888
3900
  }
3889
- function Rn(t2, e3) {
3901
+ function Qn(t2, e3) {
3890
3902
  return t2.getAttribute(e3);
3891
3903
  }
3892
- function Bn(t2, e3) {
3904
+ function Zn(t2, e3) {
3893
3905
  return function(t3, e4) {
3894
3906
  let s2, { width: i2, height: r2, gradientUnits: n2 } = e4;
3895
- return Object.keys(t3).reduce((e5, o2) => {
3896
- const a2 = t3[o2];
3897
- return "Infinity" === a2 ? s2 = 1 : "-Infinity" === a2 ? s2 = 0 : (s2 = "string" == typeof a2 ? parseFloat(a2) : a2, "string" == typeof a2 && Dn(a2) && (s2 *= 0.01, "pixels" === n2 && ("x1" !== o2 && "x2" !== o2 && "r2" !== o2 || (s2 *= i2), "y1" !== o2 && "y2" !== o2 || (s2 *= r2)))), e5[o2] = s2, e5;
3907
+ return Object.entries(t3).reduce((t4, e5) => {
3908
+ let [o2, a2] = e5;
3909
+ if ("Infinity" === a2) s2 = 1;
3910
+ else if ("-Infinity" === a2) s2 = 0;
3911
+ else {
3912
+ const t5 = "string" == typeof a2;
3913
+ s2 = t5 ? parseFloat(a2) : a2, t5 && zn(a2) && (s2 *= 0.01, "pixels" === n2 && ("x1" !== o2 && "x2" !== o2 && "r2" !== o2 || (s2 *= i2), "y1" !== o2 && "y2" !== o2 || (s2 *= r2)));
3914
+ }
3915
+ return t4[o2] = s2, t4;
3898
3916
  }, {});
3899
- }("linear" === Fn(t2) ? function(t3) {
3900
- return { x1: Rn(t3, "x1") || 0, y1: Rn(t3, "y1") || 0, x2: Rn(t3, "x2") || "100%", y2: Rn(t3, "y2") || 0 };
3917
+ }("linear" === Kn(t2) ? function(t3) {
3918
+ return { x1: Qn(t3, "x1") || 0, y1: Qn(t3, "y1") || 0, x2: Qn(t3, "x2") || "100%", y2: Qn(t3, "y2") || 0 };
3901
3919
  }(t2) : function(t3) {
3902
- return { x1: Rn(t3, "fx") || Rn(t3, "cx") || "50%", y1: Rn(t3, "fy") || Rn(t3, "cy") || "50%", r1: 0, x2: Rn(t3, "cx") || "50%", y2: Rn(t3, "cy") || "50%", r2: Rn(t3, "r") || "50%" };
3903
- }(t2), s(s({}, e3), {}, { gradientUnits: Ln(t2) }));
3920
+ return { x1: Qn(t3, "fx") || Qn(t3, "cx") || "50%", y1: Qn(t3, "fy") || Qn(t3, "cy") || "50%", r1: 0, x2: Qn(t3, "cx") || "50%", y2: Qn(t3, "cy") || "50%", r2: Qn(t3, "r") || "50%" };
3921
+ }(t2), s(s({}, e3), {}, { gradientUnits: Jn(t2) }));
3904
3922
  }
3905
- class In {
3923
+ class $n {
3906
3924
  constructor(t2) {
3907
3925
  const { type: e3 = "linear", gradientUnits: i2 = "pixels", coords: r2 = {}, colorStops: n2 = [], offsetX: o2 = 0, offsetY: a2 = 0, gradientTransform: h2, id: c2 } = t2 || {};
3908
- Object.assign(this, { type: e3, gradientUnits: i2, coords: s(s({}, "radial" === e3 ? Tn : wn), r2), colorStops: n2, offsetX: o2, offsetY: a2, gradientTransform: h2, id: c2 ? "".concat(c2, "_").concat(ft()) : ft() });
3926
+ Object.assign(this, { type: e3, gradientUnits: i2, coords: s(s({}, "radial" === e3 ? Wn : Yn), r2), colorStops: n2, offsetX: o2, offsetY: a2, gradientTransform: h2, id: c2 ? "".concat(c2, "_").concat(ft()) : ft() });
3909
3927
  }
3910
3928
  addColorStop(t2) {
3911
3929
  for (const e3 in t2) {
3912
- const s2 = new Le(t2[e3]);
3930
+ const s2 = new Ie(t2[e3]);
3913
3931
  this.colorStops.push({ offset: parseFloat(e3), color: s2.toRgb(), opacity: s2.getAlpha() });
3914
3932
  }
3915
3933
  return this;
@@ -3949,7 +3967,7 @@ class In {
3949
3967
  const { x1: e3, y1: s2, x2: i2, y2: r2, r1: n2, r2: o2 } = this.coords, a2 = "linear" === this.type ? t2.createLinearGradient(e3, s2, i2, r2) : t2.createRadialGradient(e3, s2, n2, i2, r2, o2);
3950
3968
  return this.colorStops.forEach((t3) => {
3951
3969
  let { color: e4, opacity: s3, offset: i3 } = t3;
3952
- a2.addColorStop(i3, void 0 !== s3 ? new Le(e4).setAlpha(s3).toRgba() : e4);
3970
+ a2.addColorStop(i3, void 0 !== s3 ? new Ie(e4).setAlpha(s3).toRgba() : e4);
3953
3971
  }), a2;
3954
3972
  }
3955
3973
  static async fromObject(t2) {
@@ -3957,13 +3975,13 @@ class In {
3957
3975
  return new this(s(s({}, t2), {}, { colorStops: e3 ? e3.map((t3) => s({}, t3)) : void 0, gradientTransform: i2 ? [...i2] : void 0 }));
3958
3976
  }
3959
3977
  static fromElement(t2, e3, i2) {
3960
- const r2 = Ln(t2), n2 = e3._findCenterFromElement();
3961
- return new this(s({ id: t2.getAttribute("id") || void 0, type: Fn(t2), coords: Bn(t2, { width: i2.viewBoxWidth || i2.width, height: i2.viewBoxHeight || i2.height }), colorStops: jn(t2, i2.opacity), gradientUnits: r2, gradientTransform: hr(t2.getAttribute("gradientTransform") || "") }, "pixels" === r2 ? { offsetX: e3.width / 2 - n2.x, offsetY: e3.height / 2 - n2.y } : { offsetX: 0, offsetY: 0 }));
3978
+ const r2 = Jn(t2), n2 = e3._findCenterFromElement();
3979
+ return new this(s({ id: t2.getAttribute("id") || void 0, type: Kn(t2), coords: Zn(t2, { width: i2.viewBoxWidth || i2.width, height: i2.viewBoxHeight || i2.height }), colorStops: qn(t2, i2.opacity), gradientUnits: r2, gradientTransform: wr(t2.getAttribute("gradientTransform") || "") }, "pixels" === r2 ? { offsetX: e3.width / 2 - n2.x, offsetY: e3.height / 2 - n2.y } : { offsetX: 0, offsetY: 0 }));
3962
3980
  }
3963
3981
  }
3964
- t(In, "type", "Gradient"), tt.setClass(In, "gradient"), tt.setClass(In, "linear"), tt.setClass(In, "radial");
3965
- const Xn = ["type", "source", "patternTransform"];
3966
- class Yn {
3982
+ t($n, "type", "Gradient"), tt.setClass($n, "gradient"), tt.setClass($n, "linear"), tt.setClass($n, "radial");
3983
+ const to = ["type", "source", "patternTransform"];
3984
+ class eo {
3967
3985
  get type() {
3968
3986
  return "pattern";
3969
3987
  }
@@ -3992,24 +4010,24 @@ class Yn {
3992
4010
  }
3993
4011
  toSVG(t2) {
3994
4012
  let { width: e3, height: s2 } = t2;
3995
- const { source: i2, repeat: r2, id: n2 } = this, o2 = On(this.offsetX / e3, 0), a2 = On(this.offsetY / s2, 0), h2 = "repeat-y" === r2 || "no-repeat" === r2 ? 1 + Math.abs(o2 || 0) : On(i2.width / e3, 0), c2 = "repeat-x" === r2 || "no-repeat" === r2 ? 1 + Math.abs(a2 || 0) : On(i2.height / s2, 0);
4013
+ const { source: i2, repeat: r2, id: n2 } = this, o2 = Vn(this.offsetX / e3, 0), a2 = Vn(this.offsetY / s2, 0), h2 = "repeat-y" === r2 || "no-repeat" === r2 ? 1 + Math.abs(o2 || 0) : Vn(i2.width / e3, 0), c2 = "repeat-x" === r2 || "no-repeat" === r2 ? 1 + Math.abs(a2 || 0) : Vn(i2.height / s2, 0);
3996
4014
  return ['<pattern id="SVGID_'.concat(n2, '" x="').concat(o2, '" y="').concat(a2, '" width="').concat(h2, '" height="').concat(c2, '">'), '<image x="0" y="0" width="'.concat(i2.width, '" height="').concat(i2.height, '" xlink:href="').concat(this.sourceToString(), '"></image>'), "</pattern>", ""].join("\n");
3997
4015
  }
3998
4016
  static async fromObject(t2, e3) {
3999
- let { type: r2, source: n2, patternTransform: o2 } = t2, a2 = i(t2, Xn);
4000
- const h2 = await Bt(n2, s(s({}, e3), {}, { crossOrigin: a2.crossOrigin }));
4017
+ let { type: r2, source: n2, patternTransform: o2 } = t2, a2 = i(t2, to);
4018
+ const h2 = await It(n2, s(s({}, e3), {}, { crossOrigin: a2.crossOrigin }));
4001
4019
  return new this(s(s({}, a2), {}, { patternTransform: o2 && o2.slice(0), source: h2 }));
4002
4020
  }
4003
4021
  }
4004
- t(Yn, "type", "Pattern"), tt.setClass(Yn), tt.setClass(Yn, "pattern");
4005
- const Vn = ["path", "left", "top"], zn = ["d"];
4006
- class Gn extends _i {
4022
+ t(eo, "type", "Pattern"), tt.setClass(eo), tt.setClass(eo, "pattern");
4023
+ const io = ["path", "left", "top"], ro = ["d"];
4024
+ class no extends Li {
4007
4025
  constructor(t2) {
4008
- let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { path: s2, left: r2, top: n2 } = e3, o2 = i(e3, Vn);
4009
- super(), Object.assign(this, Gn.ownDefaults), this.setOptions(o2), this._setPath(t2 || [], true), "number" == typeof r2 && this.set(M, r2), "number" == typeof n2 && this.set(P, n2);
4026
+ let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { path: s2, left: r2, top: n2 } = e3, o2 = i(e3, io);
4027
+ super(), Object.assign(this, no.ownDefaults), this.setOptions(o2), this._setPath(t2 || [], true), "number" == typeof r2 && this.set(M, r2), "number" == typeof n2 && this.set(P, n2);
4010
4028
  }
4011
4029
  _setPath(t2, e3) {
4012
- this.path = Vr(Array.isArray(t2) ? t2 : on(t2)), this.setBoundingBox(e3);
4030
+ this.path = nn(Array.isArray(t2) ? t2 : bn(t2)), this.setBoundingBox(e3);
4013
4031
  }
4014
4032
  _findCenterFromElement() {
4015
4033
  const t2 = this._calcBoundsFromPath();
@@ -4051,7 +4069,7 @@ class Gn extends _i {
4051
4069
  return this.sourcePath && (delete e3.path, e3.sourcePath = this.sourcePath), e3;
4052
4070
  }
4053
4071
  _toSVG() {
4054
- const t2 = hn(this.path, o.NUM_FRACTION_DIGITS);
4072
+ const t2 = wn(this.path, o.NUM_FRACTION_DIGITS);
4055
4073
  return ["<path ", "COMMON_PARTS", 'd="'.concat(t2, '" stroke-linecap="round" />\n')];
4056
4074
  }
4057
4075
  _getOffsetTransform() {
@@ -4087,15 +4105,15 @@ class Gn extends _i {
4087
4105
  i2 = n2[1], r2 = n2[2], e3 = i2, s2 = r2;
4088
4106
  break;
4089
4107
  case "C":
4090
- t2.push(...Yr(i2, r2, n2[1], n2[2], n2[3], n2[4], n2[5], n2[6])), i2 = n2[5], r2 = n2[6];
4108
+ t2.push(...sn(i2, r2, n2[1], n2[2], n2[3], n2[4], n2[5], n2[6])), i2 = n2[5], r2 = n2[6];
4091
4109
  break;
4092
4110
  case "Q":
4093
- t2.push(...Yr(i2, r2, n2[1], n2[2], n2[1], n2[2], n2[3], n2[4])), i2 = n2[3], r2 = n2[4];
4111
+ t2.push(...sn(i2, r2, n2[1], n2[2], n2[1], n2[2], n2[3], n2[4])), i2 = n2[3], r2 = n2[4];
4094
4112
  break;
4095
4113
  case "Z":
4096
4114
  i2 = e3, r2 = s2;
4097
4115
  }
4098
- return ae(t2);
4116
+ return he(t2);
4099
4117
  }
4100
4118
  _calcDimensions() {
4101
4119
  const t2 = this._calcBoundsFromPath();
@@ -4105,18 +4123,18 @@ class Gn extends _i {
4105
4123
  return this._fromObject(t2, { extraParam: "path" });
4106
4124
  }
4107
4125
  static async fromElement(t2, e3, r2) {
4108
- const n2 = fr(t2, this.ATTRIBUTE_NAMES, r2), { d: o2 } = n2;
4109
- return new this(o2, s(s(s({}, i(n2, zn)), e3), {}, { left: void 0, top: void 0 }));
4126
+ const n2 = Pr(t2, this.ATTRIBUTE_NAMES, r2), { d: o2 } = n2;
4127
+ return new this(o2, s(s(s({}, i(n2, ro)), e3), {}, { left: void 0, top: void 0 }));
4110
4128
  }
4111
4129
  }
4112
- t(Gn, "type", "Path"), t(Gn, "cacheProperties", [...ps, "path", "fillRule"]), t(Gn, "ATTRIBUTE_NAMES", [...Ri, "d"]), tt.setClass(Gn), tt.setSVGClass(Gn);
4113
- const Nn = ["left", "top", "radius"], Un = ["radius", "startAngle", "endAngle", "counterClockwise"];
4114
- class qn extends _i {
4130
+ t(no, "type", "Path"), t(no, "cacheProperties", [...Es, "path", "fillRule"]), t(no, "ATTRIBUTE_NAMES", [...Zi, "d"]), tt.setClass(no), tt.setSVGClass(no);
4131
+ const ao = ["left", "top", "radius"], ho = ["radius", "startAngle", "endAngle", "counterClockwise"];
4132
+ class co extends Li {
4115
4133
  static getDefaults() {
4116
- return s(s({}, super.getDefaults()), qn.ownDefaults);
4134
+ return s(s({}, super.getDefaults()), co.ownDefaults);
4117
4135
  }
4118
4136
  constructor(t2) {
4119
- super(), Object.assign(this, qn.ownDefaults), this.setOptions(t2);
4137
+ super(), Object.assign(this, co.ownDefaults), this.setOptions(t2);
4120
4138
  }
4121
4139
  _set(t2, e3) {
4122
4140
  return super._set(t2, e3), "radius" === t2 && this.setRadius(e3), this;
@@ -4135,7 +4153,7 @@ class qn extends _i {
4135
4153
  }
4136
4154
  toObject() {
4137
4155
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
4138
- return super.toObject([...Un, ...t2]);
4156
+ return super.toObject([...ho, ...t2]);
4139
4157
  }
4140
4158
  _toSVG() {
4141
4159
  const t2 = (this.endAngle - this.startAngle) % 360;
@@ -4146,30 +4164,30 @@ class qn extends _i {
4146
4164
  }
4147
4165
  }
4148
4166
  static async fromElement(t2, e3, r2) {
4149
- const n2 = fr(t2, this.ATTRIBUTE_NAMES, r2), { left: o2 = 0, top: a2 = 0, radius: h2 = 0 } = n2;
4150
- return new this(s(s({}, i(n2, Nn)), {}, { radius: h2, left: o2 - h2, top: a2 - h2 }));
4167
+ const n2 = Pr(t2, this.ATTRIBUTE_NAMES, r2), { left: o2 = 0, top: a2 = 0, radius: h2 = 0 } = n2;
4168
+ return new this(s(s({}, i(n2, ao)), {}, { radius: h2, left: o2 - h2, top: a2 - h2 }));
4151
4169
  }
4152
4170
  static fromObject(t2) {
4153
4171
  return super._fromObject(t2);
4154
4172
  }
4155
4173
  }
4156
- t(qn, "type", "Circle"), t(qn, "cacheProperties", [...ps, ...Un]), t(qn, "ownDefaults", { radius: 0, startAngle: 0, endAngle: 360, counterClockwise: false }), t(qn, "ATTRIBUTE_NAMES", ["cx", "cy", "r", ...Ri]), tt.setClass(qn), tt.setSVGClass(qn);
4157
- const Zn = ["x1", "y1", "x2", "y2"], $n = ["x1", "y1", "x2", "y2"], to = ["x1", "x2", "y1", "y2"];
4158
- class eo extends _i {
4174
+ t(co, "type", "Circle"), t(co, "cacheProperties", [...Es, ...ho]), t(co, "ownDefaults", { radius: 0, startAngle: 0, endAngle: 360, counterClockwise: false }), t(co, "ATTRIBUTE_NAMES", ["cx", "cy", "r", ...Zi]), tt.setClass(co), tt.setSVGClass(co);
4175
+ const fo = ["x1", "y1", "x2", "y2"], po = ["x1", "y1", "x2", "y2"], mo = ["x1", "x2", "y1", "y2"];
4176
+ class vo extends Li {
4159
4177
  constructor() {
4160
4178
  let [t2, e3, s2, i2] = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [0, 0, 0, 0], r2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
4161
- super(), Object.assign(this, eo.ownDefaults), this.setOptions(r2), this.x1 = t2, this.x2 = s2, this.y1 = e3, this.y2 = i2, this._setWidthHeight();
4179
+ super(), Object.assign(this, vo.ownDefaults), this.setOptions(r2), this.x1 = t2, this.x2 = s2, this.y1 = e3, this.y2 = i2, this._setWidthHeight();
4162
4180
  const { left: n2, top: o2 } = r2;
4163
4181
  "number" == typeof n2 && this.set(M, n2), "number" == typeof o2 && this.set(P, o2);
4164
4182
  }
4165
4183
  _setWidthHeight() {
4166
4184
  const { x1: t2, y1: e3, x2: s2, y2: i2 } = this;
4167
4185
  this.width = Math.abs(s2 - t2), this.height = Math.abs(i2 - e3);
4168
- const { left: r2, top: n2, width: o2, height: a2 } = ae([{ x: t2, y: e3 }, { x: s2, y: i2 }]), h2 = new ot(r2 + o2 / 2, n2 + a2 / 2);
4186
+ const { left: r2, top: n2, width: o2, height: a2 } = he([{ x: t2, y: e3 }, { x: s2, y: i2 }]), h2 = new ot(r2 + o2 / 2, n2 + a2 / 2);
4169
4187
  this.setPositionByOrigin(h2, D, D);
4170
4188
  }
4171
4189
  _set(t2, e3) {
4172
- return super._set(t2, e3), to.includes(t2) && this._setWidthHeight(), this;
4190
+ return super._set(t2, e3), mo.includes(t2) && this._setWidthHeight(), this;
4173
4191
  }
4174
4192
  _render(t2) {
4175
4193
  t2.beginPath();
@@ -4200,21 +4218,21 @@ class eo extends _i {
4200
4218
  return ["<line ", "COMMON_PARTS", 'x1="'.concat(t2, '" y1="').concat(s2, '" x2="').concat(e3, '" y2="').concat(i2, '" />\n')];
4201
4219
  }
4202
4220
  static async fromElement(t2, e3, s2) {
4203
- const r2 = fr(t2, this.ATTRIBUTE_NAMES, s2), { x1: n2 = 0, y1: o2 = 0, x2: a2 = 0, y2: h2 = 0 } = r2;
4204
- return new this([n2, o2, a2, h2], i(r2, Zn));
4221
+ const r2 = Pr(t2, this.ATTRIBUTE_NAMES, s2), { x1: n2 = 0, y1: o2 = 0, x2: a2 = 0, y2: h2 = 0 } = r2;
4222
+ return new this([n2, o2, a2, h2], i(r2, fo));
4205
4223
  }
4206
4224
  static fromObject(t2) {
4207
- let { x1: e3, y1: r2, x2: n2, y2: o2 } = t2, a2 = i(t2, $n);
4225
+ let { x1: e3, y1: r2, x2: n2, y2: o2 } = t2, a2 = i(t2, po);
4208
4226
  return this._fromObject(s(s({}, a2), {}, { points: [e3, r2, n2, o2] }), { extraParam: "points" });
4209
4227
  }
4210
4228
  }
4211
- t(eo, "type", "Line"), t(eo, "cacheProperties", [...ps, ...to]), t(eo, "ATTRIBUTE_NAMES", Ri.concat(to)), tt.setClass(eo), tt.setSVGClass(eo);
4212
- class so extends _i {
4229
+ t(vo, "type", "Line"), t(vo, "cacheProperties", [...Es, ...mo]), t(vo, "ATTRIBUTE_NAMES", Zi.concat(mo)), tt.setClass(vo), tt.setSVGClass(vo);
4230
+ class yo extends Li {
4213
4231
  static getDefaults() {
4214
- return s(s({}, super.getDefaults()), so.ownDefaults);
4232
+ return s(s({}, super.getDefaults()), yo.ownDefaults);
4215
4233
  }
4216
4234
  constructor(t2) {
4217
- super(), Object.assign(this, so.ownDefaults), this.setOptions(t2);
4235
+ super(), Object.assign(this, yo.ownDefaults), this.setOptions(t2);
4218
4236
  }
4219
4237
  _render(t2) {
4220
4238
  const e3 = this.width / 2, s2 = this.height / 2;
@@ -4225,14 +4243,14 @@ class so extends _i {
4225
4243
  return ["<polygon ", "COMMON_PARTS", 'points="', "".concat(-t2, " ").concat(e3, ",0 ").concat(-e3, ",").concat(t2, " ").concat(e3), '" />'];
4226
4244
  }
4227
4245
  }
4228
- t(so, "type", "Triangle"), t(so, "ownDefaults", { width: 100, height: 100 }), tt.setClass(so), tt.setSVGClass(so);
4229
- const io = ["rx", "ry"];
4230
- class ro extends _i {
4246
+ t(yo, "type", "Triangle"), t(yo, "ownDefaults", { width: 100, height: 100 }), tt.setClass(yo), tt.setSVGClass(yo);
4247
+ const _o = ["rx", "ry"];
4248
+ class xo extends Li {
4231
4249
  static getDefaults() {
4232
- return s(s({}, super.getDefaults()), ro.ownDefaults);
4250
+ return s(s({}, super.getDefaults()), xo.ownDefaults);
4233
4251
  }
4234
4252
  constructor(t2) {
4235
- super(), Object.assign(this, ro.ownDefaults), this.setOptions(t2);
4253
+ super(), Object.assign(this, xo.ownDefaults), this.setOptions(t2);
4236
4254
  }
4237
4255
  _set(t2, e3) {
4238
4256
  switch (super._set(t2, e3), t2) {
@@ -4252,7 +4270,7 @@ class ro extends _i {
4252
4270
  }
4253
4271
  toObject() {
4254
4272
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
4255
- return super.toObject([...io, ...t2]);
4273
+ return super.toObject([..._o, ...t2]);
4256
4274
  }
4257
4275
  _toSVG() {
4258
4276
  return ["<ellipse ", "COMMON_PARTS", 'cx="0" cy="0" rx="'.concat(this.rx, '" ry="').concat(this.ry, '" />\n')];
@@ -4261,25 +4279,25 @@ class ro extends _i {
4261
4279
  t2.beginPath(), t2.save(), t2.transform(1, 0, 0, this.ry / this.rx, 0, 0), t2.arc(0, 0, this.rx, 0, S, false), t2.restore(), this._renderPaintInOrder(t2);
4262
4280
  }
4263
4281
  static async fromElement(t2, e3, s2) {
4264
- const i2 = fr(t2, this.ATTRIBUTE_NAMES, s2);
4282
+ const i2 = Pr(t2, this.ATTRIBUTE_NAMES, s2);
4265
4283
  return i2.left = (i2.left || 0) - i2.rx, i2.top = (i2.top || 0) - i2.ry, new this(i2);
4266
4284
  }
4267
4285
  }
4268
- function no(t2) {
4286
+ function Co(t2) {
4269
4287
  if (!t2) return [];
4270
4288
  const e3 = t2.replace(/,/g, " ").trim().split(/\s+/), s2 = [];
4271
4289
  for (let t3 = 0; t3 < e3.length; t3 += 2) s2.push({ x: parseFloat(e3[t3]), y: parseFloat(e3[t3 + 1]) });
4272
4290
  return s2;
4273
4291
  }
4274
- t(ro, "type", "Ellipse"), t(ro, "cacheProperties", [...ps, ...io]), t(ro, "ownDefaults", { rx: 0, ry: 0 }), t(ro, "ATTRIBUTE_NAMES", [...Ri, "cx", "cy", "rx", "ry"]), tt.setClass(ro), tt.setSVGClass(ro);
4275
- const oo = ["left", "top"], ao = { exactBoundingBox: false };
4276
- class ho extends _i {
4292
+ t(xo, "type", "Ellipse"), t(xo, "cacheProperties", [...Es, ..._o]), t(xo, "ownDefaults", { rx: 0, ry: 0 }), t(xo, "ATTRIBUTE_NAMES", [...Zi, "cx", "cy", "rx", "ry"]), tt.setClass(xo), tt.setSVGClass(xo);
4293
+ const bo = ["left", "top"], So = { exactBoundingBox: false };
4294
+ class wo extends Li {
4277
4295
  static getDefaults() {
4278
- return s(s({}, super.getDefaults()), ho.ownDefaults);
4296
+ return s(s({}, super.getDefaults()), wo.ownDefaults);
4279
4297
  }
4280
4298
  constructor() {
4281
4299
  let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
4282
- super(), t(this, "strokeDiff", void 0), Object.assign(this, ho.ownDefaults), this.setOptions(s2), this.points = e3;
4300
+ super(), t(this, "strokeDiff", void 0), Object.assign(this, wo.ownDefaults), this.setOptions(s2), this.points = e3;
4283
4301
  const { left: i2, top: r2 } = s2;
4284
4302
  this.initialized = true, this.setBoundingBox(true), "number" == typeof i2 && this.set(M, i2), "number" == typeof r2 && this.set(P, r2);
4285
4303
  }
@@ -4287,18 +4305,18 @@ class ho extends _i {
4287
4305
  return true;
4288
4306
  }
4289
4307
  _projectStrokeOnPoints(t2) {
4290
- return Ti(this.points, t2, this.isOpen());
4308
+ return Wi(this.points, t2, this.isOpen());
4291
4309
  }
4292
4310
  _calcDimensions(t2) {
4293
4311
  t2 = s({ scaleX: this.scaleX, scaleY: this.scaleY, skewX: this.skewX, skewY: this.skewY, strokeLineCap: this.strokeLineCap, strokeLineJoin: this.strokeLineJoin, strokeMiterLimit: this.strokeMiterLimit, strokeUniform: this.strokeUniform, strokeWidth: this.strokeWidth }, t2 || {});
4294
4312
  const e3 = this.exactBoundingBox ? this._projectStrokeOnPoints(t2).map((t3) => t3.projectedPoint) : this.points;
4295
4313
  if (0 === e3.length) return { left: 0, top: 0, width: 0, height: 0, pathOffset: new ot(), strokeOffset: new ot(), strokeDiff: new ot() };
4296
- const i2 = ae(e3), r2 = Lt(s(s({}, t2), {}, { scaleX: 1, scaleY: 1 })), n2 = ae(this.points.map((t3) => St(t3, r2, true))), o2 = new ot(this.scaleX, this.scaleY);
4314
+ const i2 = he(e3), r2 = Lt(s(s({}, t2), {}, { scaleX: 1, scaleY: 1 })), n2 = he(this.points.map((t3) => St(t3, r2, true))), o2 = new ot(this.scaleX, this.scaleY);
4297
4315
  let a2 = i2.left + i2.width / 2, h2 = i2.top + i2.height / 2;
4298
4316
  return this.exactBoundingBox && (a2 -= h2 * Math.tan(xt(this.skewX)), h2 -= a2 * Math.tan(xt(this.skewY))), s(s({}, i2), {}, { pathOffset: new ot(a2, h2), strokeOffset: new ot(n2.left, n2.top).subtract(new ot(i2.left, i2.top)).multiply(o2), strokeDiff: new ot(i2.width, i2.height).subtract(new ot(n2.width, n2.height)).multiply(o2) });
4299
4317
  }
4300
4318
  _findCenterFromElement() {
4301
- const t2 = ae(this.points);
4319
+ const t2 = he(this.points);
4302
4320
  return new ot(t2.left + t2.width / 2, t2.top + t2.height / 2);
4303
4321
  }
4304
4322
  setDimensions() {
@@ -4361,21 +4379,20 @@ class ho extends _i {
4361
4379
  return this.points.length;
4362
4380
  }
4363
4381
  static async fromElement(t2, e3, r2) {
4364
- return new this(no(t2.getAttribute("points")), s(s({}, i(fr(t2, this.ATTRIBUTE_NAMES, r2), oo)), e3));
4382
+ return new this(Co(t2.getAttribute("points")), s(s({}, i(Pr(t2, this.ATTRIBUTE_NAMES, r2), bo)), e3));
4365
4383
  }
4366
4384
  static fromObject(t2) {
4367
4385
  return this._fromObject(t2, { extraParam: "points" });
4368
4386
  }
4369
4387
  }
4370
- t(ho, "ownDefaults", ao), t(ho, "type", "Polyline"), t(ho, "layoutProperties", [U, q, "strokeLineCap", "strokeLineJoin", "strokeMiterLimit", "strokeWidth", "strokeUniform", "points"]), t(ho, "cacheProperties", [...ps, "points"]), t(ho, "ATTRIBUTE_NAMES", [...Ri]), tt.setClass(ho), tt.setSVGClass(ho);
4371
- class co extends ho {
4388
+ t(wo, "ownDefaults", So), t(wo, "type", "Polyline"), t(wo, "layoutProperties", [U, q, "strokeLineCap", "strokeLineJoin", "strokeMiterLimit", "strokeWidth", "strokeUniform", "points"]), t(wo, "cacheProperties", [...Es, "points"]), t(wo, "ATTRIBUTE_NAMES", [...Zi]), tt.setClass(wo), tt.setSVGClass(wo);
4389
+ class To extends wo {
4372
4390
  isOpen() {
4373
4391
  return false;
4374
4392
  }
4375
4393
  }
4376
- t(co, "ownDefaults", ao), t(co, "type", "Polygon"), tt.setClass(co), tt.setSVGClass(co);
4377
- const lo = ["fontSize", "fontWeight", "fontFamily", "fontStyle"], uo = ["underline", "overline", "linethrough"], go = [...lo, "lineHeight", "text", "charSpacing", "textAlign", "styles", "path", "pathStartOffset", "pathSide", "pathAlign"], fo = [...go, ...uo, "textBackgroundColor", "direction"], po = [...lo, ...uo, J, "strokeWidth", K, "deltaY", "textBackgroundColor"], mo = { _reNewline: F, _reSpacesAndTabs: /[ \t\r]/g, _reSpaceAndTab: /[ \t\r]/, _reWords: /\S+/g, fontSize: 40, fontWeight: "normal", fontFamily: "Times New Roman", underline: false, overline: false, linethrough: false, textAlign: M, fontStyle: "normal", lineHeight: 1.16, superscript: { size: 0.6, baseline: -0.35 }, subscript: { size: 0.6, baseline: 0.11 }, textBackgroundColor: "", stroke: null, shadow: null, path: void 0, pathStartOffset: 0, pathSide: M, pathAlign: "baseline", _fontSizeFraction: 0.222, offsets: { underline: 0.1, linethrough: -0.315, overline: -0.88 }, _fontSizeMult: 1.13, charSpacing: 0, deltaY: 0, direction: "ltr", CACHE_FONT_SIZE: 400, MIN_TEXT_WIDTH: 2 }, vo = "justify", yo = "justify-left", _o = "justify-right", xo = "justify-center";
4378
- class Co extends _i {
4394
+ t(To, "ownDefaults", So), t(To, "type", "Polygon"), tt.setClass(To), tt.setSVGClass(To);
4395
+ class Oo extends Li {
4379
4396
  isEmptyStyles(t2) {
4380
4397
  if (!this.styles) return true;
4381
4398
  if (void 0 !== t2 && !this.styles[t2]) return true;
@@ -4457,38 +4474,38 @@ class Co extends _i {
4457
4474
  delete this.styles[t2];
4458
4475
  }
4459
4476
  }
4460
- t(Co, "_styleProperties", po);
4461
- const bo = / +/g, So = /"/g;
4462
- function wo(t2, e3, s2, i2, r2) {
4477
+ t(Oo, "_styleProperties", qe);
4478
+ const ko = / +/g, Do = /"/g;
4479
+ function Mo(t2, e3, s2, i2, r2) {
4463
4480
  return " ".concat(function(t3, e4) {
4464
4481
  let { left: s3, top: i3, width: r3, height: n2 } = e4, a2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : o.NUM_FRACTION_DIGITS;
4465
- const h2 = Ie(K, t3, false), [c2, l2, u2, d2] = [s3, i3, r3, n2].map((t4) => Vt(t4, a2));
4482
+ const h2 = Ye(K, t3, false), [c2, l2, u2, d2] = [s3, i3, r3, n2].map((t4) => Vt(t4, a2));
4466
4483
  return "<rect ".concat(h2, ' x="').concat(c2, '" y="').concat(l2, '" width="').concat(u2, '" height="').concat(d2, '"></rect>');
4467
4484
  }(t2, { left: e3, top: s2, width: i2, height: r2 }), "\n");
4468
4485
  }
4469
- const To = ["textAnchor", "textDecoration", "dx", "dy", "top", "left", "fontSize", "strokeWidth"];
4470
- let Oo;
4471
- class ko extends Co {
4486
+ const Po = ["textAnchor", "textDecoration", "dx", "dy", "top", "left", "fontSize", "strokeWidth"];
4487
+ let Eo;
4488
+ class Ao extends Oo {
4472
4489
  static getDefaults() {
4473
- return s(s({}, super.getDefaults()), ko.ownDefaults);
4490
+ return s(s({}, super.getDefaults()), Ao.ownDefaults);
4474
4491
  }
4475
4492
  constructor(e3, s2) {
4476
- super(), t(this, "__charBounds", []), Object.assign(this, ko.ownDefaults), this.setOptions(s2), this.styles || (this.styles = {}), this.text = e3, this.initialized = true, this.path && this.setPathInfo(), this.initDimensions(), this.setCoords();
4493
+ super(), t(this, "__charBounds", []), Object.assign(this, Ao.ownDefaults), this.setOptions(s2), this.styles || (this.styles = {}), this.text = e3, this.initialized = true, this.path && this.setPathInfo(), this.initDimensions(), this.setCoords();
4477
4494
  }
4478
4495
  setPathInfo() {
4479
4496
  const t2 = this.path;
4480
- t2 && (t2.segmentsInfo = $r(t2.path));
4497
+ t2 && (t2.segmentsInfo = mn(t2.path));
4481
4498
  }
4482
4499
  _splitText() {
4483
4500
  const t2 = this._splitTextIntoLines(this.text);
4484
4501
  return this.textLines = t2.lines, this._textLines = t2.graphemeLines, this._unwrappedTextLines = t2._unwrappedLines, this._text = t2.graphemeText, t2;
4485
4502
  }
4486
4503
  initDimensions() {
4487
- this._splitText(), this._clearCache(), this.dirty = true, this.path ? (this.width = this.path.width, this.height = this.path.height) : (this.width = this.calcTextWidth() || this.cursorWidth || this.MIN_TEXT_WIDTH, this.height = this.calcTextHeight()), this.textAlign.includes(vo) && this.enlargeSpaces();
4504
+ this._splitText(), this._clearCache(), this.dirty = true, this.path ? (this.width = this.path.width, this.height = this.path.height) : (this.width = this.calcTextWidth() || this.cursorWidth || this.MIN_TEXT_WIDTH, this.height = this.calcTextHeight()), this.textAlign.includes(Je) && this.enlargeSpaces();
4488
4505
  }
4489
4506
  enlargeSpaces() {
4490
4507
  let t2, e3, s2, i2, r2, n2, o2;
4491
- for (let a2 = 0, h2 = this._textLines.length; a2 < h2; a2++) if ((this.textAlign === vo || a2 !== h2 - 1 && !this.isEndOfWrapping(a2)) && (i2 = 0, r2 = this._textLines[a2], e3 = this.getLineWidth(a2), e3 < this.width && (o2 = this.textLines[a2].match(this._reSpacesAndTabs)))) {
4508
+ for (let a2 = 0, h2 = this._textLines.length; a2 < h2; a2++) if ((this.textAlign === Je || a2 !== h2 - 1 && !this.isEndOfWrapping(a2)) && (i2 = 0, r2 = this._textLines[a2], e3 = this.getLineWidth(a2), e3 < this.width && (o2 = this.textLines[a2].match(this._reSpacesAndTabs)))) {
4492
4509
  s2 = o2.length, t2 = (this.width - e3) / s2;
4493
4510
  for (let e4 = 0; e4 <= r2.length; e4++) n2 = this.__charBounds[a2][e4], this._reSpaceAndTab.test(r2[e4]) ? (n2.width += t2, n2.kernedWidth += t2, n2.left += i2, i2 += t2) : n2.left += i2;
4494
4511
  }
@@ -4558,26 +4575,27 @@ class ko extends Co {
4558
4575
  }
4559
4576
  const n2 = this._textLines[e4].length, o2 = this._getLineLeftOffset(e4);
4560
4577
  let a2, h2, c2 = 0, l2 = 0, u2 = this.getValueOfPropertyAt(e4, 0, "textBackgroundColor");
4561
- for (let d2 = 0; d2 < n2; d2++) {
4562
- const n3 = this.__charBounds[e4][d2];
4563
- h2 = this.getValueOfPropertyAt(e4, d2, "textBackgroundColor"), this.path ? (t2.save(), t2.translate(n3.renderLeft, n3.renderTop), t2.rotate(n3.angle), t2.fillStyle = h2, h2 && t2.fillRect(-n3.width / 2, -r3 / this.lineHeight * (1 - this._fontSizeFraction), n3.width, r3 / this.lineHeight), t2.restore()) : h2 !== u2 ? (a2 = s2 + o2 + l2, "rtl" === this.direction && (a2 = this.width - a2 - c2), t2.fillStyle = u2, u2 && t2.fillRect(a2, i2, c2, r3 / this.lineHeight), l2 = n3.left, c2 = n3.width, u2 = h2) : c2 += n3.kernedWidth;
4578
+ const d2 = this.getHeightOfLineImpl(e4);
4579
+ for (let r4 = 0; r4 < n2; r4++) {
4580
+ const n3 = this.__charBounds[e4][r4];
4581
+ h2 = this.getValueOfPropertyAt(e4, r4, "textBackgroundColor"), this.path ? (t2.save(), t2.translate(n3.renderLeft, n3.renderTop), t2.rotate(n3.angle), t2.fillStyle = h2, h2 && t2.fillRect(-n3.width / 2, -d2 * (1 - this._fontSizeFraction), n3.width, d2), t2.restore()) : h2 !== u2 ? (a2 = s2 + o2 + l2, "rtl" === this.direction && (a2 = this.width - a2 - c2), t2.fillStyle = u2, u2 && t2.fillRect(a2, i2, c2, d2), l2 = n3.left, c2 = n3.width, u2 = h2) : c2 += n3.kernedWidth;
4564
4582
  }
4565
- h2 && !this.path && (a2 = s2 + o2 + l2, "rtl" === this.direction && (a2 = this.width - a2 - c2), t2.fillStyle = h2, t2.fillRect(a2, i2, c2, r3 / this.lineHeight)), i2 += r3;
4583
+ h2 && !this.path && (a2 = s2 + o2 + l2, "rtl" === this.direction && (a2 = this.width - a2 - c2), t2.fillStyle = h2, t2.fillRect(a2, i2, c2, d2)), i2 += r3;
4566
4584
  }
4567
4585
  t2.fillStyle = e3, this._removeShadow(t2);
4568
4586
  }
4569
4587
  _measureChar(t2, e3, s2, i2) {
4570
- const r2 = _.getFontCache(e3), n2 = this._getFontDeclaration(e3), o2 = s2 + t2, a2 = s2 && n2 === this._getFontDeclaration(i2), h2 = e3.fontSize / this.CACHE_FONT_SIZE;
4588
+ const r2 = _.getFontCache(e3), n2 = this._getFontDeclaration(e3), o2 = s2 ? s2 + t2 : t2, a2 = s2 && n2 === this._getFontDeclaration(i2), h2 = e3.fontSize / this.CACHE_FONT_SIZE;
4571
4589
  let c2, l2, u2, d2;
4572
- if (s2 && void 0 !== r2[s2] && (u2 = r2[s2]), void 0 !== r2[t2] && (d2 = c2 = r2[t2]), a2 && void 0 !== r2[o2] && (l2 = r2[o2], d2 = l2 - u2), void 0 === c2 || void 0 === u2 || void 0 === l2) {
4590
+ if (s2 && r2.has(s2) && (u2 = r2.get(s2)), r2.has(t2) && (d2 = c2 = r2.get(t2)), a2 && r2.has(o2) && (l2 = r2.get(o2), d2 = l2 - u2), void 0 === c2 || void 0 === u2 || void 0 === l2) {
4573
4591
  const i3 = function() {
4574
- if (!Oo) {
4592
+ if (!Eo) {
4575
4593
  const t3 = vt({ width: 0, height: 0 });
4576
- Oo = t3.getContext("2d");
4594
+ Eo = t3.getContext("2d");
4577
4595
  }
4578
- return Oo;
4596
+ return Eo;
4579
4597
  }();
4580
- this._setTextStyles(i3, e3, true), void 0 === c2 && (d2 = c2 = i3.measureText(t2).width, r2[t2] = c2), void 0 === u2 && a2 && s2 && (u2 = i3.measureText(s2).width, r2[s2] = u2), a2 && void 0 === l2 && (l2 = i3.measureText(o2).width, r2[o2] = l2, d2 = l2 - u2);
4598
+ this._setTextStyles(i3, e3, true), void 0 === c2 && (d2 = c2 = i3.measureText(t2).width, r2.set(t2, c2)), void 0 === u2 && a2 && s2 && (u2 = i3.measureText(s2).width, r2.set(s2, u2)), a2 && void 0 === l2 && (l2 = i3.measureText(o2).width, r2.set(o2, l2), d2 = l2 - u2);
4581
4599
  }
4582
4600
  return { width: c2 * h2, kernedWidth: d2 * h2 };
4583
4601
  }
@@ -4615,7 +4633,7 @@ class ko extends Co {
4615
4633
  return { width: i2, numOfSpaces: 0 };
4616
4634
  }
4617
4635
  _setGraphemeOnPath(t2, e3) {
4618
- const s2 = t2 + e3.kernedWidth / 2, i2 = this.path, r2 = tn(i2.path, s2, i2.segmentsInfo);
4636
+ const s2 = t2 + e3.kernedWidth / 2, i2 = this.path, r2 = vn(i2.path, s2, i2.segmentsInfo);
4619
4637
  e3.renderLeft = r2.x - i2.pathOffset.x, e3.renderTop = r2.y - i2.pathOffset.y, e3.angle = r2.angle + (this.pathSide === A ? Math.PI : 0);
4620
4638
  }
4621
4639
  _getGraphemeBox(t2, e3, s2, i2, r2) {
@@ -4629,16 +4647,20 @@ class ko extends Co {
4629
4647
  }
4630
4648
  return u2;
4631
4649
  }
4650
+ getHeightOfLineImpl(t2) {
4651
+ const e3 = this.__lineHeights;
4652
+ if (e3[t2]) return e3[t2];
4653
+ let s2 = this.getHeightOfChar(t2, 0);
4654
+ for (let e4 = 1, i2 = this._textLines[t2].length; e4 < i2; e4++) s2 = Math.max(this.getHeightOfChar(t2, e4), s2);
4655
+ return e3[t2] = s2 * this._fontSizeMult;
4656
+ }
4632
4657
  getHeightOfLine(t2) {
4633
- if (this.__lineHeights[t2]) return this.__lineHeights[t2];
4634
- let e3 = this.getHeightOfChar(t2, 0);
4635
- for (let s2 = 1, i2 = this._textLines[t2].length; s2 < i2; s2++) e3 = Math.max(this.getHeightOfChar(t2, s2), e3);
4636
- return this.__lineHeights[t2] = e3 * this.lineHeight * this._fontSizeMult;
4658
+ return this.getHeightOfLineImpl(t2) * this.lineHeight;
4637
4659
  }
4638
4660
  calcTextHeight() {
4639
- let t2, e3 = 0;
4640
- for (let s2 = 0, i2 = this._textLines.length; s2 < i2; s2++) t2 = this.getHeightOfLine(s2), e3 += s2 === i2 - 1 ? t2 / this.lineHeight : t2;
4641
- return e3;
4661
+ let t2 = 0;
4662
+ for (let e3 = 0, s2 = this._textLines.length; e3 < s2; e3++) t2 += e3 === s2 - 1 ? this.getHeightOfLineImpl(e3) : this.getHeightOfLine(e3);
4663
+ return t2;
4642
4664
  }
4643
4665
  _getLeftOffset() {
4644
4666
  return "ltr" === this.direction ? -this.width / 2 : this.width / 2;
@@ -4650,10 +4672,7 @@ class ko extends Co {
4650
4672
  t2.save();
4651
4673
  let s2 = 0;
4652
4674
  const i2 = this._getLeftOffset(), r2 = this._getTopOffset();
4653
- for (let n2 = 0, o2 = this._textLines.length; n2 < o2; n2++) {
4654
- const o3 = this.getHeightOfLine(n2), a2 = o3 / this.lineHeight, h2 = this._getLineLeftOffset(n2);
4655
- this._renderTextLine(e3, t2, this._textLines[n2], i2 + h2, r2 + s2 + a2, n2), s2 += o3;
4656
- }
4675
+ for (let n2 = 0, o2 = this._textLines.length; n2 < o2; n2++) this._renderTextLine(e3, t2, this._textLines[n2], i2 + this._getLineLeftOffset(n2), r2 + s2 + this.getHeightOfLineImpl(n2), n2), s2 += this.getHeightOfLine(n2);
4657
4676
  t2.restore();
4658
4677
  }
4659
4678
  _renderTextFill(t2) {
@@ -4663,10 +4682,10 @@ class ko extends Co {
4663
4682
  (this.stroke && 0 !== this.strokeWidth || !this.isEmptyStyles()) && (this.shadow && !this.shadow.affectStroke && this._removeShadow(t2), t2.save(), this._setLineDash(t2, this.strokeDashArray), t2.beginPath(), this._renderTextCommon(t2, "strokeText"), t2.closePath(), t2.restore());
4664
4683
  }
4665
4684
  _renderChars(t2, e3, s2, i2, r2, n2) {
4666
- const o2 = this.getHeightOfLine(n2), a2 = this.textAlign.includes(vo), h2 = this.path, c2 = !a2 && 0 === this.charSpacing && this.isEmptyStyles(n2) && !h2, l2 = "ltr" === this.direction, u2 = "ltr" === this.direction ? 1 : -1, d2 = e3.direction;
4667
- let g2, f, p2, m2, v2, y2 = "", _2 = 0;
4668
- if (e3.save(), d2 !== this.direction && (e3.canvas.setAttribute("dir", l2 ? "ltr" : "rtl"), e3.direction = l2 ? "ltr" : "rtl", e3.textAlign = l2 ? M : A), r2 -= o2 * this._fontSizeFraction / this.lineHeight, c2) return this._renderChar(t2, e3, n2, 0, s2.join(""), i2, r2), void e3.restore();
4669
- for (let o3 = 0, c3 = s2.length - 1; o3 <= c3; o3++) m2 = o3 === c3 || this.charSpacing || h2, y2 += s2[o3], p2 = this.__charBounds[n2][o3], 0 === _2 ? (i2 += u2 * (p2.kernedWidth - p2.width), _2 += p2.width) : _2 += p2.kernedWidth, a2 && !m2 && this._reSpaceAndTab.test(s2[o3]) && (m2 = true), m2 || (g2 = g2 || this.getCompleteStyleDeclaration(n2, o3), f = this.getCompleteStyleDeclaration(n2, o3 + 1), m2 = ji(g2, f, false)), m2 && (h2 ? (e3.save(), e3.translate(p2.renderLeft, p2.renderTop), e3.rotate(p2.angle), this._renderChar(t2, e3, n2, o3, y2, -_2 / 2, 0), e3.restore()) : (v2 = i2, this._renderChar(t2, e3, n2, o3, y2, v2, r2)), y2 = "", g2 = f, i2 += u2 * _2, _2 = 0);
4685
+ const o2 = this.textAlign.includes(Je), a2 = this.path, h2 = !o2 && 0 === this.charSpacing && this.isEmptyStyles(n2) && !a2, c2 = "ltr" === this.direction, l2 = "ltr" === this.direction ? 1 : -1, u2 = e3.direction;
4686
+ let d2, g2, f, p2, m2, v2 = "", y2 = 0;
4687
+ if (e3.save(), u2 !== this.direction && (e3.canvas.setAttribute("dir", c2 ? "ltr" : "rtl"), e3.direction = c2 ? "ltr" : "rtl", e3.textAlign = c2 ? M : A), r2 -= this.getHeightOfLineImpl(n2) * this._fontSizeFraction, h2) return this._renderChar(t2, e3, n2, 0, s2.join(""), i2, r2), void e3.restore();
4688
+ for (let h3 = 0, c3 = s2.length - 1; h3 <= c3; h3++) p2 = h3 === c3 || this.charSpacing || a2, v2 += s2[h3], f = this.__charBounds[n2][h3], 0 === y2 ? (i2 += l2 * (f.kernedWidth - f.width), y2 += f.width) : y2 += f.kernedWidth, o2 && !p2 && this._reSpaceAndTab.test(s2[h3]) && (p2 = true), p2 || (d2 = d2 || this.getCompleteStyleDeclaration(n2, h3), g2 = this.getCompleteStyleDeclaration(n2, h3 + 1), p2 = Ki(d2, g2, false)), p2 && (a2 ? (e3.save(), e3.translate(f.renderLeft, f.renderTop), e3.rotate(f.angle), this._renderChar(t2, e3, n2, h3, v2, -y2 / 2, 0), e3.restore()) : (m2 = i2, this._renderChar(t2, e3, n2, h3, v2, m2, r2)), v2 = "", d2 = g2, i2 += l2 * y2, y2 = 0);
4670
4689
  e3.restore();
4671
4690
  }
4672
4691
  _applyPatternGradientTransformText(t2) {
@@ -4712,7 +4731,7 @@ class ko extends Co {
4712
4731
  _getLineLeftOffset(t2) {
4713
4732
  const e3 = this.getLineWidth(t2), s2 = this.width - e3, i2 = this.textAlign, r2 = this.direction, n2 = this.isEndOfWrapping(t2);
4714
4733
  let o2 = 0;
4715
- return i2 === vo || i2 === xo && !n2 || i2 === _o && !n2 || i2 === yo && !n2 ? 0 : (i2 === D && (o2 = s2 / 2), i2 === A && (o2 = s2), i2 === xo && (o2 = s2 / 2), i2 === _o && (o2 = s2), "rtl" === r2 && (i2 === A || i2 === vo || i2 === _o ? o2 = 0 : i2 === M || i2 === yo ? o2 = -s2 : i2 !== D && i2 !== xo || (o2 = -s2 / 2)), o2);
4734
+ return i2 === Je || i2 === $e && !n2 || i2 === Ze && !n2 || i2 === Qe && !n2 ? 0 : (i2 === D && (o2 = s2 / 2), i2 === A && (o2 = s2), i2 === $e && (o2 = s2 / 2), i2 === Ze && (o2 = s2), "rtl" === r2 && (i2 === A || i2 === Je || i2 === Ze ? o2 = 0 : i2 === M || i2 === Qe ? o2 = -s2 : i2 !== D && i2 !== $e || (o2 = -s2 / 2)), o2);
4716
4735
  }
4717
4736
  _clearCache() {
4718
4737
  this._forceClearCache = false, this.__lineWidths = [], this.__lineHeights = [], this.__charBounds = [];
@@ -4732,42 +4751,47 @@ class ko extends Co {
4732
4751
  _renderTextDecoration(t2, e3) {
4733
4752
  if (!this[e3] && !this.styleHas(e3)) return;
4734
4753
  let s2 = this._getTopOffset();
4735
- const i2 = this._getLeftOffset(), r2 = this.path, n2 = this._getWidthOfCharSpacing(), o2 = this.offsets[e3];
4736
- for (let a2 = 0, h2 = this._textLines.length; a2 < h2; a2++) {
4737
- const h3 = this.getHeightOfLine(a2);
4738
- if (!this[e3] && !this.styleHas(e3, a2)) {
4739
- s2 += h3;
4754
+ const i2 = this._getLeftOffset(), r2 = this.path, n2 = this._getWidthOfCharSpacing(), o2 = "linethrough" === e3 ? 0.5 : "overline" === e3 ? 1 : 0, a2 = this.offsets[e3];
4755
+ for (let h2 = 0, c2 = this._textLines.length; h2 < c2; h2++) {
4756
+ const c3 = this.getHeightOfLine(h2);
4757
+ if (!this[e3] && !this.styleHas(e3, h2)) {
4758
+ s2 += c3;
4740
4759
  continue;
4741
4760
  }
4742
- const c2 = this._textLines[a2], l2 = h3 / this.lineHeight, u2 = this._getLineLeftOffset(a2);
4743
- let d2, g2, f = 0, p2 = 0, m2 = this.getValueOfPropertyAt(a2, 0, e3), v2 = this.getValueOfPropertyAt(a2, 0, K);
4744
- const y2 = s2 + l2 * (1 - this._fontSizeFraction);
4745
- let _2 = this.getHeightOfChar(a2, 0), x2 = this.getValueOfPropertyAt(a2, 0, "deltaY");
4746
- for (let s3 = 0, n3 = c2.length; s3 < n3; s3++) {
4747
- const n4 = this.__charBounds[a2][s3];
4748
- d2 = this.getValueOfPropertyAt(a2, s3, e3), g2 = this.getValueOfPropertyAt(a2, s3, K);
4749
- const h4 = this.getHeightOfChar(a2, s3), c3 = this.getValueOfPropertyAt(a2, s3, "deltaY");
4750
- if (r2 && d2 && g2) t2.save(), t2.fillStyle = v2, t2.translate(n4.renderLeft, n4.renderTop), t2.rotate(n4.angle), t2.fillRect(-n4.kernedWidth / 2, o2 * h4 + c3, n4.kernedWidth, this.fontSize / 15), t2.restore();
4751
- else if ((d2 !== m2 || g2 !== v2 || h4 !== _2 || c3 !== x2) && p2 > 0) {
4752
- let e4 = i2 + u2 + f;
4753
- "rtl" === this.direction && (e4 = this.width - e4 - p2), m2 && v2 && (t2.fillStyle = v2, t2.fillRect(e4, y2 + o2 * _2 + x2, p2, this.fontSize / 15)), f = n4.left, p2 = n4.width, m2 = d2, v2 = g2, _2 = h4, x2 = c3;
4754
- } else p2 += n4.kernedWidth;
4761
+ const l2 = this._textLines[h2], u2 = c3 / this.lineHeight, d2 = this._getLineLeftOffset(h2);
4762
+ let g2 = 0, f = 0, p2 = this.getValueOfPropertyAt(h2, 0, e3), m2 = this.getValueOfPropertyAt(h2, 0, K), v2 = this.getValueOfPropertyAt(h2, 0, ze), y2 = p2, _2 = m2, x2 = v2;
4763
+ const C2 = s2 + u2 * (1 - this._fontSizeFraction);
4764
+ let b2 = this.getHeightOfChar(h2, 0), S2 = this.getValueOfPropertyAt(h2, 0, "deltaY");
4765
+ for (let s3 = 0, n3 = l2.length; s3 < n3; s3++) {
4766
+ const n4 = this.__charBounds[h2][s3];
4767
+ y2 = this.getValueOfPropertyAt(h2, s3, e3), _2 = this.getValueOfPropertyAt(h2, s3, K), x2 = this.getValueOfPropertyAt(h2, s3, ze);
4768
+ const c4 = this.getHeightOfChar(h2, s3), l3 = this.getValueOfPropertyAt(h2, s3, "deltaY");
4769
+ if (r2 && y2 && _2) {
4770
+ const e4 = this.fontSize * x2 / 1e3;
4771
+ t2.save(), t2.fillStyle = m2, t2.translate(n4.renderLeft, n4.renderTop), t2.rotate(n4.angle), t2.fillRect(-n4.kernedWidth / 2, a2 * c4 + l3 - o2 * e4, n4.kernedWidth, e4), t2.restore();
4772
+ } else if ((y2 !== p2 || _2 !== m2 || c4 !== b2 || x2 !== v2 || l3 !== S2) && f > 0) {
4773
+ const e4 = this.fontSize * v2 / 1e3;
4774
+ let s4 = i2 + d2 + g2;
4775
+ "rtl" === this.direction && (s4 = this.width - s4 - f), p2 && m2 && v2 && (t2.fillStyle = m2, t2.fillRect(s4, C2 + a2 * b2 + S2 - o2 * e4, f, e4)), g2 = n4.left, f = n4.width, p2 = y2, v2 = x2, m2 = _2, b2 = c4, S2 = l3;
4776
+ } else f += n4.kernedWidth;
4755
4777
  }
4756
- let C2 = i2 + u2 + f;
4757
- "rtl" === this.direction && (C2 = this.width - C2 - p2), t2.fillStyle = g2, d2 && g2 && t2.fillRect(C2, y2 + o2 * _2 + x2, p2 - n2, this.fontSize / 15), s2 += h3;
4778
+ let w2 = i2 + d2 + g2;
4779
+ "rtl" === this.direction && (w2 = this.width - w2 - f), t2.fillStyle = _2;
4780
+ const T2 = this.fontSize * x2 / 1e3;
4781
+ y2 && _2 && x2 && t2.fillRect(w2, C2 + a2 * b2 + S2 - o2 * T2, f - n2, T2), s2 += c3;
4758
4782
  }
4759
4783
  this._removeShadow(t2);
4760
4784
  }
4761
4785
  _getFontDeclaration() {
4762
4786
  let { fontFamily: t2 = this.fontFamily, fontStyle: e3 = this.fontStyle, fontWeight: s2 = this.fontWeight, fontSize: i2 = this.fontSize } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, r2 = arguments.length > 1 ? arguments[1] : void 0;
4763
- const n2 = t2.includes("'") || t2.includes('"') || t2.includes(",") || ko.genericFonts.includes(t2.toLowerCase()) ? t2 : '"'.concat(t2, '"');
4787
+ const n2 = t2.includes("'") || t2.includes('"') || t2.includes(",") || Ao.genericFonts.includes(t2.toLowerCase()) ? t2 : '"'.concat(t2, '"');
4764
4788
  return [e3, s2, "".concat(r2 ? this.CACHE_FONT_SIZE : i2, "px"), n2].join(" ");
4765
4789
  }
4766
4790
  render(t2) {
4767
4791
  this.visible && (this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (this._forceClearCache && this.initDimensions(), super.render(t2)));
4768
4792
  }
4769
4793
  graphemeSplit(t2) {
4770
- return Mi(t2);
4794
+ return Hi(t2);
4771
4795
  }
4772
4796
  _splitTextIntoLines(t2) {
4773
4797
  const e3 = t2.split(this._reNewline), s2 = new Array(e3.length), i2 = ["\n"];
@@ -4777,7 +4801,7 @@ class ko extends Co {
4777
4801
  }
4778
4802
  toObject() {
4779
4803
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
4780
- return s(s({}, super.toObject([...fo, ...t2])), {}, { styles: Fi(this.styles, this.text) }, this.path ? { path: this.path.toObject() } : {});
4804
+ return s(s({}, super.toObject([...Ue, ...t2])), {}, { styles: Ji(this.styles, this.text) }, this.path ? { path: this.path.toObject() } : {});
4781
4805
  }
4782
4806
  set(t2, e3) {
4783
4807
  const { textLayoutProperties: s2 } = this.constructor;
@@ -4791,15 +4815,15 @@ class ko extends Co {
4791
4815
  return 1;
4792
4816
  }
4793
4817
  static async fromElement(t2, e3, r2) {
4794
- const n2 = fr(t2, ko.ATTRIBUTE_NAMES, r2), o2 = s(s({}, e3), n2), { textAnchor: a2 = M, textDecoration: h2 = "", dx: c2 = 0, dy: l2 = 0, top: u2 = 0, left: d2 = 0, fontSize: g2 = O, strokeWidth: f = 1 } = o2, p2 = i(o2, To), m2 = new this((t2.textContent || "").replace(/^\s+|\s+$|\n+/g, "").replace(/\s+/g, " "), s({ left: d2 + c2, top: u2 + l2, underline: h2.includes("underline"), overline: h2.includes("overline"), linethrough: h2.includes("line-through"), strokeWidth: 0, fontSize: g2 }, p2)), v2 = m2.getScaledHeight() / m2.height, y2 = ((m2.height + m2.strokeWidth) * m2.lineHeight - m2.height) * v2, _2 = m2.getScaledHeight() + y2;
4818
+ const n2 = Pr(t2, Ao.ATTRIBUTE_NAMES, r2), o2 = s(s({}, e3), n2), { textAnchor: a2 = M, textDecoration: h2 = "", dx: c2 = 0, dy: l2 = 0, top: u2 = 0, left: d2 = 0, fontSize: g2 = O, strokeWidth: f = 1 } = o2, p2 = i(o2, Po), m2 = new this(Pe(t2.textContent || "").trim(), s({ left: d2 + c2, top: u2 + l2, underline: h2.includes("underline"), overline: h2.includes("overline"), linethrough: h2.includes("line-through"), strokeWidth: 0, fontSize: g2 }, p2)), v2 = m2.getScaledHeight() / m2.height, y2 = ((m2.height + m2.strokeWidth) * m2.lineHeight - m2.height) * v2, _2 = m2.getScaledHeight() + y2;
4795
4819
  let x2 = 0;
4796
4820
  return a2 === D && (x2 = m2.getScaledWidth() / 2), a2 === A && (x2 = m2.getScaledWidth()), m2.set({ left: m2.left - x2, top: m2.top - (_2 - m2.fontSize * (0.07 + m2._fontSizeFraction)) / m2.lineHeight, strokeWidth: f }), m2;
4797
4821
  }
4798
4822
  static fromObject(t2) {
4799
- return this._fromObject(s(s({}, t2), {}, { styles: Li(t2.styles || {}, t2.text) }), { extraParam: "text" });
4823
+ return this._fromObject(s(s({}, t2), {}, { styles: Qi(t2.styles || {}, t2.text) }), { extraParam: "text" });
4800
4824
  }
4801
4825
  }
4802
- t(ko, "textLayoutProperties", go), t(ko, "cacheProperties", [...ps, ...fo]), t(ko, "ownDefaults", mo), t(ko, "type", "Text"), t(ko, "genericFonts", ["serif", "sans-serif", "monospace", "cursive", "fantasy", "system-ui", "ui-serif", "ui-sans-serif", "ui-monospace", "ui-rounded", "math", "emoji", "fangsong"]), t(ko, "ATTRIBUTE_NAMES", Ri.concat("x", "y", "dx", "dy", "font-family", "font-style", "font-weight", "font-size", "letter-spacing", "text-decoration", "text-anchor")), yi(ko, [class extends Xe {
4826
+ t(Ao, "textLayoutProperties", Ne), t(Ao, "cacheProperties", [...Es, ...Ue]), t(Ao, "ownDefaults", Ke), t(Ao, "type", "Text"), t(Ao, "genericFonts", ["serif", "sans-serif", "monospace", "cursive", "fantasy", "system-ui", "ui-serif", "ui-sans-serif", "ui-monospace", "ui-rounded", "math", "emoji", "fangsong"]), t(Ao, "ATTRIBUTE_NAMES", Zi.concat("x", "y", "dx", "dy", "font-family", "font-style", "font-weight", "font-size", "letter-spacing", "text-decoration", "text-anchor")), Fi(Ao, [class extends We {
4803
4827
  _toSVG() {
4804
4828
  const t2 = this._getSVGLeftTopOffsets(), e3 = this._getSVGTextAndBg(t2.textTop, t2.textLeft);
4805
4829
  return this._wrapSVGTextAndBg(e3);
@@ -4814,17 +4838,17 @@ t(ko, "textLayoutProperties", go), t(ko, "cacheProperties", [...ps, ...fo]), t(k
4814
4838
  _wrapSVGTextAndBg(t2) {
4815
4839
  let { textBgRects: e3, textSpans: s2 } = t2;
4816
4840
  const i2 = this.getSvgTextDecoration(this);
4817
- return [e3.join(""), ' <text xml:space="preserve" ', this.fontFamily ? 'font-family="'.concat(this.fontFamily.replace(So, "'"), '" ') : "", this.fontSize ? 'font-size="'.concat(this.fontSize, '" ') : "", this.fontStyle ? 'font-style="'.concat(this.fontStyle, '" ') : "", this.fontWeight ? 'font-weight="'.concat(this.fontWeight, '" ') : "", i2 ? 'text-decoration="'.concat(i2, '" ') : "", "rtl" === this.direction ? 'direction="'.concat(this.direction, '" ') : "", 'style="', this.getSvgStyles(true), '"', this.addPaintOrder(), " >", s2.join(""), "</text>\n"];
4841
+ return [e3.join(""), ' <text xml:space="preserve" ', 'font-family="'.concat(this.fontFamily.replace(Do, "'"), '" '), 'font-size="'.concat(this.fontSize, '" '), this.fontStyle ? 'font-style="'.concat(this.fontStyle, '" ') : "", this.fontWeight ? 'font-weight="'.concat(this.fontWeight, '" ') : "", i2 ? 'text-decoration="'.concat(i2, '" ') : "", "rtl" === this.direction ? 'direction="'.concat(this.direction, '" ') : "", 'style="', this.getSvgStyles(true), '"', this.addPaintOrder(), " >", s2.join(""), "</text>\n"];
4818
4842
  }
4819
4843
  _getSVGTextAndBg(t2, e3) {
4820
4844
  const s2 = [], i2 = [];
4821
4845
  let r2, n2 = t2;
4822
- this.backgroundColor && i2.push(...wo(this.backgroundColor, -this.width / 2, -this.height / 2, this.width, this.height));
4846
+ this.backgroundColor && i2.push(...Mo(this.backgroundColor, -this.width / 2, -this.height / 2, this.width, this.height));
4823
4847
  for (let t3 = 0, o2 = this._textLines.length; t3 < o2; t3++) r2 = this._getLineLeftOffset(t3), "rtl" === this.direction && (r2 += this.width), (this.textBackgroundColor || this.styleHas("textBackgroundColor", t3)) && this._setSVGTextLineBg(i2, t3, e3 + r2, n2), this._setSVGTextLineText(s2, t3, e3 + r2, n2), n2 += this.getHeightOfLine(t3);
4824
4848
  return { textSpans: s2, textBgRects: i2 };
4825
4849
  }
4826
4850
  _createTextCharSpan(t2, e3, s2, i2, r2) {
4827
- const n2 = o.NUM_FRACTION_DIGITS, a2 = this.getSvgSpanStyles(e3, t2 !== t2.trim() || !!t2.match(bo)), h2 = a2 ? 'style="'.concat(a2, '"') : "", c2 = e3.deltaY, l2 = c2 ? ' dy="'.concat(Vt(c2, n2), '" ') : "", { angle: u2, renderLeft: d2, renderTop: g2, width: f } = r2;
4851
+ const n2 = o.NUM_FRACTION_DIGITS, a2 = this.getSvgSpanStyles(e3, t2 !== t2.trim() || !!t2.match(ko)), h2 = a2 ? 'style="'.concat(a2, '"') : "", c2 = e3.deltaY, l2 = c2 ? ' dy="'.concat(Vt(c2, n2), '" ') : "", { angle: u2, renderLeft: d2, renderTop: g2, width: f } = r2;
4828
4852
  let p2 = "";
4829
4853
  if (void 0 !== d2) {
4830
4854
  const t3 = f / 2;
@@ -4834,22 +4858,22 @@ t(ko, "textLayoutProperties", go), t(ko, "cacheProperties", [...ps, ...fo]), t(k
4834
4858
  const r3 = new ot(-t3, 0).transform(e4);
4835
4859
  s2 = r3.x, i2 = r3.y;
4836
4860
  }
4837
- return '<tspan x="'.concat(Vt(s2, n2), '" y="').concat(Vt(i2, n2), '" ').concat(l2).concat(p2).concat(h2, ">").concat(ki(t2), "</tspan>");
4861
+ return '<tspan x="'.concat(Vt(s2, n2), '" y="').concat(Vt(i2, n2), '" ').concat(l2).concat(p2).concat(h2, ">").concat(zi(t2), "</tspan>");
4838
4862
  }
4839
4863
  _setSVGTextLineText(t2, e3, s2, i2) {
4840
- const r2 = this.getHeightOfLine(e3), n2 = this.textAlign.includes(vo), o2 = this._textLines[e3];
4864
+ const r2 = this.getHeightOfLine(e3), n2 = this.textAlign.includes(Je), o2 = this._textLines[e3];
4841
4865
  let a2, h2, c2, l2, u2, d2 = "", g2 = 0;
4842
4866
  i2 += r2 * (1 - this._fontSizeFraction) / this.lineHeight;
4843
- for (let r3 = 0, f = o2.length - 1; r3 <= f; r3++) u2 = r3 === f || this.charSpacing || this.path, d2 += o2[r3], c2 = this.__charBounds[e3][r3], 0 === g2 ? (s2 += c2.kernedWidth - c2.width, g2 += c2.width) : g2 += c2.kernedWidth, n2 && !u2 && this._reSpaceAndTab.test(o2[r3]) && (u2 = true), u2 || (a2 = a2 || this.getCompleteStyleDeclaration(e3, r3), h2 = this.getCompleteStyleDeclaration(e3, r3 + 1), u2 = ji(a2, h2, true)), u2 && (l2 = this._getStyleDeclaration(e3, r3), t2.push(this._createTextCharSpan(d2, l2, s2, i2, c2)), d2 = "", a2 = h2, "rtl" === this.direction ? s2 -= g2 : s2 += g2, g2 = 0);
4867
+ for (let r3 = 0, f = o2.length - 1; r3 <= f; r3++) u2 = r3 === f || this.charSpacing || this.path, d2 += o2[r3], c2 = this.__charBounds[e3][r3], 0 === g2 ? (s2 += c2.kernedWidth - c2.width, g2 += c2.width) : g2 += c2.kernedWidth, n2 && !u2 && this._reSpaceAndTab.test(o2[r3]) && (u2 = true), u2 || (a2 = a2 || this.getCompleteStyleDeclaration(e3, r3), h2 = this.getCompleteStyleDeclaration(e3, r3 + 1), u2 = Ki(a2, h2, true)), u2 && (l2 = this._getStyleDeclaration(e3, r3), t2.push(this._createTextCharSpan(d2, l2, s2, i2, c2)), d2 = "", a2 = h2, "rtl" === this.direction ? s2 -= g2 : s2 += g2, g2 = 0);
4844
4868
  }
4845
4869
  _setSVGTextLineBg(t2, e3, s2, i2) {
4846
4870
  const r2 = this._textLines[e3], n2 = this.getHeightOfLine(e3) / this.lineHeight;
4847
4871
  let o2, a2 = 0, h2 = 0, c2 = this.getValueOfPropertyAt(e3, 0, "textBackgroundColor");
4848
4872
  for (let l2 = 0; l2 < r2.length; l2++) {
4849
4873
  const { left: r3, width: u2, kernedWidth: d2 } = this.__charBounds[e3][l2];
4850
- o2 = this.getValueOfPropertyAt(e3, l2, "textBackgroundColor"), o2 !== c2 ? (c2 && t2.push(...wo(c2, s2 + h2, i2, a2, n2)), h2 = r3, a2 = u2, c2 = o2) : a2 += d2;
4874
+ o2 = this.getValueOfPropertyAt(e3, l2, "textBackgroundColor"), o2 !== c2 ? (c2 && t2.push(...Mo(c2, s2 + h2, i2, a2, n2)), h2 = r3, a2 = u2, c2 = o2) : a2 += d2;
4851
4875
  }
4852
- o2 && t2.push(...wo(c2, s2 + h2, i2, a2, n2));
4876
+ o2 && t2.push(...Mo(c2, s2 + h2, i2, a2, n2));
4853
4877
  }
4854
4878
  _getSVGLineTopOffset(t2) {
4855
4879
  let e3, s2 = 0;
@@ -4858,17 +4882,17 @@ t(ko, "textLayoutProperties", go), t(ko, "cacheProperties", [...ps, ...fo]), t(k
4858
4882
  return { lineTop: s2, offset: (this._fontSizeMult - this._fontSizeFraction) * i2 / (this.lineHeight * this._fontSizeMult) };
4859
4883
  }
4860
4884
  getSvgStyles(t2) {
4861
- return "".concat(super.getSvgStyles(t2), " white-space: pre;");
4885
+ return "".concat(super.getSvgStyles(t2), " text-decoration-thickness: ").concat(Vt(this.textDecorationThickness * this.getObjectScaling().y / 10, o.NUM_FRACTION_DIGITS), "%; white-space: pre;");
4862
4886
  }
4863
4887
  getSvgSpanStyles(t2, e3) {
4864
- const { fontFamily: s2, strokeWidth: i2, stroke: r2, fill: n2, fontSize: o2, fontStyle: a2, fontWeight: h2, deltaY: c2 } = t2, l2 = this.getSvgTextDecoration(t2);
4865
- return [r2 ? Ie(J, r2) : "", i2 ? "stroke-width: ".concat(i2, "; ") : "", s2 ? "font-family: ".concat(s2.includes("'") || s2.includes('"') ? s2 : "'".concat(s2, "'"), "; ") : "", o2 ? "font-size: ".concat(o2, "px; ") : "", a2 ? "font-style: ".concat(a2, "; ") : "", h2 ? "font-weight: ".concat(h2, "; ") : "", l2 ? "text-decoration: ".concat(l2, "; ") : l2, n2 ? Ie(K, n2) : "", c2 ? "baseline-shift: ".concat(-c2, "; ") : "", e3 ? "white-space: pre; " : ""].join("");
4888
+ const { fontFamily: s2, strokeWidth: i2, stroke: r2, fill: n2, fontSize: a2, fontStyle: h2, fontWeight: c2, deltaY: l2, textDecorationThickness: u2, linethrough: d2, overline: g2, underline: f } = t2, p2 = this.getSvgTextDecoration({ underline: null != f ? f : this.underline, overline: null != g2 ? g2 : this.overline, linethrough: null != d2 ? d2 : this.linethrough }), m2 = u2 || this.textDecorationThickness;
4889
+ return [r2 ? Ye(J, r2) : "", i2 ? "stroke-width: ".concat(i2, "; ") : "", s2 ? "font-family: ".concat(s2.includes("'") || s2.includes('"') ? s2 : "'".concat(s2, "'"), "; ") : "", a2 ? "font-size: ".concat(a2, "px; ") : "", h2 ? "font-style: ".concat(h2, "; ") : "", c2 ? "font-weight: ".concat(c2, "; ") : "", p2 ? "text-decoration: ".concat(p2, "; text-decoration-thickness: ").concat(Vt(m2 * this.getObjectScaling().y / 10, o.NUM_FRACTION_DIGITS), "%; ") : "", n2 ? Ye(K, n2) : "", l2 ? "baseline-shift: ".concat(-l2, "; ") : "", e3 ? "white-space: pre; " : ""].join("");
4866
4890
  }
4867
4891
  getSvgTextDecoration(t2) {
4868
4892
  return ["overline", "underline", "line-through"].filter((e3) => t2[e3.replace("-", "")]).join(" ");
4869
4893
  }
4870
- }]), tt.setClass(ko), tt.setSVGClass(ko);
4871
- class Do {
4894
+ }]), tt.setClass(Ao), tt.setSVGClass(Ao);
4895
+ class jo {
4872
4896
  constructor(e3) {
4873
4897
  t(this, "target", void 0), t(this, "__mouseDownInPlace", false), t(this, "__dragStartFired", false), t(this, "__isDraggingOver", false), t(this, "__dragStartSelection", void 0), t(this, "__dragImageDisposer", void 0), t(this, "_dispose", void 0), this.target = e3;
4874
4898
  const s2 = [this.target.on("dragenter", this.dragEnterHandler.bind(this)), this.target.on("dragover", this.dragOverHandler.bind(this)), this.target.on("dragleave", this.dragLeaveHandler.bind(this)), this.target.on("dragend", this.dragEndHandler.bind(this)), this.target.on("drop", this.dropHandler.bind(this))];
@@ -4896,12 +4920,12 @@ class Do {
4896
4920
  setDragImage(t2, e3) {
4897
4921
  var s2;
4898
4922
  let { selectionStart: i2, selectionEnd: r2 } = e3;
4899
- const n2 = this.target, o2 = n2.canvas, a2 = new ot(n2.flipX ? -1 : 1, n2.flipY ? -1 : 1), h2 = n2._getCursorBoundaries(i2), c2 = new ot(h2.left + h2.leftOffset, h2.top + h2.topOffset).multiply(a2).transform(n2.calcTransformMatrix()), l2 = o2.getScenePoint(t2).subtract(c2), u2 = n2.getCanvasRetinaScaling(), d2 = n2.getBoundingRect(), g2 = c2.subtract(new ot(d2.left, d2.top)), f = o2.viewportTransform, p2 = g2.add(l2).transform(f, true), m2 = n2.backgroundColor, v2 = Oi(n2.styles);
4923
+ const n2 = this.target, o2 = n2.canvas, a2 = new ot(n2.flipX ? -1 : 1, n2.flipY ? -1 : 1), h2 = n2._getCursorBoundaries(i2), c2 = new ot(h2.left + h2.leftOffset, h2.top + h2.topOffset).multiply(a2).transform(n2.calcTransformMatrix()), l2 = o2.getScenePoint(t2).subtract(c2), u2 = n2.getCanvasRetinaScaling(), d2 = n2.getBoundingRect(), g2 = c2.subtract(new ot(d2.left, d2.top)), f = o2.viewportTransform, p2 = g2.add(l2).transform(f, true), m2 = n2.backgroundColor, v2 = Vi(n2.styles);
4900
4924
  n2.backgroundColor = "";
4901
4925
  const y2 = { stroke: "transparent", fill: "transparent", textBackgroundColor: "transparent" };
4902
4926
  n2.setSelectionStyles(y2, 0, i2), n2.setSelectionStyles(y2, r2, n2.text.length), n2.dirty = true;
4903
4927
  const _2 = n2.toCanvasElement({ enableRetinaScaling: o2.enableRetinaScaling, viewportTransform: true });
4904
- n2.backgroundColor = m2, n2.styles = v2, n2.dirty = true, cn(_2, { position: "fixed", left: "".concat(-_2.width, "px"), border: j, width: "".concat(_2.width / u2, "px"), height: "".concat(_2.height / u2, "px") }), this.__dragImageDisposer && this.__dragImageDisposer(), this.__dragImageDisposer = () => {
4928
+ n2.backgroundColor = m2, n2.styles = v2, n2.dirty = true, Tn(_2, { position: "fixed", left: "".concat(-_2.width, "px"), border: j, width: "".concat(_2.width / u2, "px"), height: "".concat(_2.height / u2, "px") }), this.__dragImageDisposer && this.__dragImageDisposer(), this.__dragImageDisposer = () => {
4905
4929
  _2.remove();
4906
4930
  }, Kt(t2.target || this.target.hiddenTextarea).body.appendChild(_2), null === (s2 = t2.dataTransfer) || void 0 === s2 || s2.setDragImage(_2, p2.x, p2.y);
4907
4931
  }
@@ -4968,8 +4992,8 @@ class Do {
4968
4992
  this._dispose && this._dispose();
4969
4993
  }
4970
4994
  }
4971
- const Mo = /[ \n\.,;!\?\-]/;
4972
- class Po extends ko {
4995
+ const Fo = /[ \n\.,;!\?\-]/;
4996
+ class Lo extends Ao {
4973
4997
  constructor() {
4974
4998
  super(...arguments), t(this, "_currentCursorOpacity", 1);
4975
4999
  }
@@ -4981,7 +5005,7 @@ class Po extends ko {
4981
5005
  }
4982
5006
  _animateCursor(t2) {
4983
5007
  let { toValue: e3, duration: s2, delay: i2, onComplete: r2 } = t2;
4984
- return js({ startValue: this._currentCursorOpacity, endValue: e3, duration: s2, delay: i2, onComplete: r2, abort: () => !this.canvas || this.selectionStart !== this.selectionEnd, onChange: (t3) => {
5008
+ return Ks({ startValue: this._currentCursorOpacity, endValue: e3, duration: s2, delay: i2, onComplete: r2, abort: () => !this.canvas || this.selectionStart !== this.selectionEnd, onChange: (t3) => {
4985
5009
  this._currentCursorOpacity = t3, this.renderCursorOrSelection();
4986
5010
  } });
4987
5011
  }
@@ -5038,8 +5062,8 @@ class Po extends ko {
5038
5062
  searchWordBoundary(t2, e3) {
5039
5063
  const s2 = this._text;
5040
5064
  let i2 = t2 > 0 && this._reSpace.test(s2[t2]) && (-1 === e3 || !F.test(s2[t2 - 1])) ? t2 - 1 : t2, r2 = s2[i2];
5041
- for (; i2 > 0 && i2 < s2.length && !Mo.test(r2); ) i2 += e3, r2 = s2[i2];
5042
- return -1 === e3 && Mo.test(r2) && i2++, i2;
5065
+ for (; i2 > 0 && i2 < s2.length && !Fo.test(r2); ) i2 += e3, r2 = s2[i2];
5066
+ return -1 === e3 && Fo.test(r2) && i2++, i2;
5043
5067
  }
5044
5068
  selectWord(t2) {
5045
5069
  var e3;
@@ -5204,10 +5228,10 @@ class Po extends ko {
5204
5228
  s2 <= t2 ? (e3 === t2 ? this._selectionDirection = M : this._selectionDirection === A && (this._selectionDirection = M, this.selectionEnd = t2), this.selectionStart = s2) : s2 > t2 && s2 < e3 ? this._selectionDirection === A ? this.selectionEnd = s2 : this.selectionStart = s2 : (e3 === t2 ? this._selectionDirection = A : this._selectionDirection === M && (this._selectionDirection = A, this.selectionStart = e3), this.selectionEnd = s2);
5205
5229
  }
5206
5230
  }
5207
- class Eo extends Po {
5231
+ class Ro extends Lo {
5208
5232
  initHiddenTextarea() {
5209
5233
  const t2 = this.canvas && Kt(this.canvas.getElement()) || m(), e3 = t2.createElement("textarea");
5210
- Object.entries({ autocapitalize: "off", autocorrect: "off", autocomplete: "off", spellcheck: "false", "data-fabric": "textarea", wrap: "off" }).map((t3) => {
5234
+ Object.entries({ autocapitalize: "off", autocorrect: "off", autocomplete: "off", spellcheck: "false", "data-fabric": "textarea", wrap: "off", name: "fabricTextarea" }).map((t3) => {
5211
5235
  let [s3, i3] = t3;
5212
5236
  return e3.setAttribute(s3, i3);
5213
5237
  });
@@ -5310,7 +5334,7 @@ class Eo extends Po {
5310
5334
  const s2 = this["get".concat(t2, "CursorOffset")](e3, this._selectionDirection === A);
5311
5335
  if (e3.shiftKey ? this.moveCursorWithShift(s2) : this.moveCursorWithoutShift(s2), 0 !== s2) {
5312
5336
  const t3 = this.text.length;
5313
- this.selectionStart = gs(0, this.selectionStart, t3), this.selectionEnd = gs(0, this.selectionEnd, t3), this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea();
5337
+ this.selectionStart = Ms(0, this.selectionStart, t3), this.selectionEnd = Ms(0, this.selectionEnd, t3), this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea();
5314
5338
  }
5315
5339
  }
5316
5340
  moveCursorWithShift(t2) {
@@ -5360,13 +5384,13 @@ class Eo extends Po {
5360
5384
  return this._selectionDirection = A, this.selectionStart === this.selectionEnd ? (e3 = this._moveRight(t2, "selectionStart"), this.selectionEnd = this.selectionStart) : this.selectionStart = this.selectionEnd, e3;
5361
5385
  }
5362
5386
  }
5363
- const Ao = (t2) => !!t2.button;
5364
- class jo extends Eo {
5387
+ const Io = (t2) => !!t2.button;
5388
+ class Bo extends Ro {
5365
5389
  constructor() {
5366
5390
  super(...arguments), t(this, "draggableTextDelegate", void 0);
5367
5391
  }
5368
5392
  initBehavior() {
5369
- this.on("mousedown", this._mouseDownHandler), this.on("mouseup", this.mouseUpHandler), this.on("mousedblclick", this.doubleClickHandler), this.on("mousetripleclick", this.tripleClickHandler), this.draggableTextDelegate = new Do(this), super.initBehavior();
5393
+ this.on("mousedown", this._mouseDownHandler), this.on("mouseup", this.mouseUpHandler), this.on("mousedblclick", this.doubleClickHandler), this.on("mousetripleclick", this.tripleClickHandler), this.draggableTextDelegate = new jo(this), super.initBehavior();
5370
5394
  }
5371
5395
  shouldStartDragging() {
5372
5396
  return this.draggableTextDelegate.isActive();
@@ -5385,7 +5409,7 @@ class jo extends Eo {
5385
5409
  }
5386
5410
  _mouseDownHandler(t2) {
5387
5411
  let { e: e3, alreadySelected: s2 } = t2;
5388
- this.canvas && this.editable && !Ao(e3) && !this.getActiveControl() && (this.draggableTextDelegate.start(e3) || (this.canvas.textEditingManager.register(this), s2 && (this.inCompositionMode = false, this.setCursorByClick(e3)), this.isEditing && (this.__selectionStartOnMouseDown = this.selectionStart, this.selectionStart === this.selectionEnd && this.abortCursorAnimation(), this.renderCursorOrSelection()), this.selected || (this.selected = s2 || this.isEditing)));
5412
+ this.canvas && this.editable && !Io(e3) && !this.getActiveControl() && (this.draggableTextDelegate.start(e3) || (this.canvas.textEditingManager.register(this), s2 && (this.inCompositionMode = false, this.setCursorByClick(e3)), this.isEditing && (this.__selectionStartOnMouseDown = this.selectionStart, this.selectionStart === this.selectionEnd && this.abortCursorAnimation(), this.renderCursorOrSelection()), this.selected || (this.selected = s2 || this.isEditing)));
5389
5413
  }
5390
5414
  mouseUpHandler(t2) {
5391
5415
  let { e: e3, transform: s2 } = t2;
@@ -5395,7 +5419,7 @@ class jo extends Eo {
5395
5419
  const t3 = this.canvas._activeObject;
5396
5420
  if (t3 && t3 !== this) return;
5397
5421
  }
5398
- !this.editable || this.group && !this.group.interactive || s2 && s2.actionPerformed || Ao(e3) || i2 || this.selected && !this.getActiveControl() && (this.enterEditing(e3), this.selectionStart === this.selectionEnd ? this.initDelayedCursor(true) : this.renderCursorOrSelection());
5422
+ !this.editable || this.group && !this.group.interactive || s2 && s2.actionPerformed || Io(e3) || i2 || this.selected && !this.getActiveControl() && (this.enterEditing(e3), this.selectionStart === this.selectionEnd ? this.initDelayedCursor(true) : this.renderCursorOrSelection());
5399
5423
  }
5400
5424
  setCursorByClick(t2) {
5401
5425
  const e3 = this.getSelectionStartFromPointer(t2), s2 = this.selectionStart, i2 = this.selectionEnd;
@@ -5418,25 +5442,25 @@ class jo extends Eo {
5418
5442
  return Math.min(this.flipX ? o2 - i2 : i2, this._text.length);
5419
5443
  }
5420
5444
  }
5421
- const Fo = "moveCursorUp", Lo = "moveCursorDown", Ro = "moveCursorLeft", Bo = "moveCursorRight", Io = "exitEditing", Xo = (t2, e3) => {
5445
+ const Xo = "moveCursorUp", Yo = "moveCursorDown", Wo = "moveCursorLeft", Vo = "moveCursorRight", zo = "exitEditing", Go = (t2, e3) => {
5422
5446
  const s2 = e3.getRetinaScaling();
5423
5447
  t2.setTransform(s2, 0, 0, s2, 0, 0);
5424
5448
  const i2 = e3.viewportTransform;
5425
5449
  t2.transform(i2[0], i2[1], i2[2], i2[3], i2[4], i2[5]);
5426
- }, Yo = s({ selectionStart: 0, selectionEnd: 0, selectionColor: "rgba(17,119,255,0.3)", isEditing: false, editable: true, editingBorderColor: "rgba(102,153,255,0.25)", cursorWidth: 2, cursorColor: "", cursorDelay: 1e3, cursorDuration: 600, caching: true, hiddenTextareaContainer: null, keysMap: { 9: Io, 27: Io, 33: Fo, 34: Lo, 35: Bo, 36: Ro, 37: Ro, 38: Fo, 39: Bo, 40: Lo }, keysMapRtl: { 9: Io, 27: Io, 33: Fo, 34: Lo, 35: Ro, 36: Bo, 37: Bo, 38: Fo, 39: Ro, 40: Lo }, ctrlKeysMapDown: { 65: "cmdAll" }, ctrlKeysMapUp: { 67: "copy", 88: "cut" } }, { _selectionDirection: null, _reSpace: /\s|\r?\n/, inCompositionMode: false });
5427
- class Wo extends jo {
5450
+ }, Ho = s({ selectionStart: 0, selectionEnd: 0, selectionColor: "rgba(17,119,255,0.3)", isEditing: false, editable: true, editingBorderColor: "rgba(102,153,255,0.25)", cursorWidth: 2, cursorColor: "", cursorDelay: 1e3, cursorDuration: 600, caching: true, hiddenTextareaContainer: null, keysMap: { 9: zo, 27: zo, 33: Xo, 34: Yo, 35: Vo, 36: Wo, 37: Wo, 38: Xo, 39: Vo, 40: Yo }, keysMapRtl: { 9: zo, 27: zo, 33: Xo, 34: Yo, 35: Wo, 36: Vo, 37: Vo, 38: Xo, 39: Wo, 40: Yo }, ctrlKeysMapDown: { 65: "cmdAll" }, ctrlKeysMapUp: { 67: "copy", 88: "cut" } }, { _selectionDirection: null, _reSpace: /\s|\r?\n/, inCompositionMode: false });
5451
+ class No extends Bo {
5428
5452
  static getDefaults() {
5429
- return s(s({}, super.getDefaults()), Wo.ownDefaults);
5453
+ return s(s({}, super.getDefaults()), No.ownDefaults);
5430
5454
  }
5431
5455
  get type() {
5432
5456
  const t2 = super.type;
5433
5457
  return "itext" === t2 ? "i-text" : t2;
5434
5458
  }
5435
5459
  constructor(t2, e3) {
5436
- super(t2, s(s({}, Wo.ownDefaults), e3)), this.initBehavior();
5460
+ super(t2, s(s({}, No.ownDefaults), e3)), this.initBehavior();
5437
5461
  }
5438
5462
  _set(t2, e3) {
5439
- return this.isEditing && this._savedProps && t2 in this._savedProps ? (this._savedProps[t2] = e3, this) : ("canvas" === t2 && (this.canvas instanceof Sn && this.canvas.textEditingManager.remove(this), e3 instanceof Sn && e3.textEditingManager.add(this)), super._set(t2, e3));
5463
+ return this.isEditing && this._savedProps && t2 in this._savedProps ? (this._savedProps[t2] = e3, this) : ("canvas" === t2 && (this.canvas instanceof Xn && this.canvas.textEditingManager.remove(this), e3 instanceof Xn && e3.textEditingManager.add(this)), super._set(t2, e3));
5440
5464
  }
5441
5465
  setSelectionStart(t2) {
5442
5466
  t2 = Math.max(t2, 0), this._updateAndFire("selectionStart", t2);
@@ -5481,13 +5505,13 @@ class Wo extends jo {
5481
5505
  const e3 = this._getCursorBoundaries(), s2 = this.findAncestorsWithClipPath(), i2 = s2.length > 0;
5482
5506
  let r2, n2 = t2;
5483
5507
  if (i2) {
5484
- r2 = vt(t2.canvas), n2 = r2.getContext("2d"), Xo(n2, this.canvas);
5508
+ r2 = vt(t2.canvas), n2 = r2.getContext("2d"), Go(n2, this.canvas);
5485
5509
  const e4 = this.calcTransformMatrix();
5486
5510
  n2.transform(e4[0], e4[1], e4[2], e4[3], e4[4], e4[5]);
5487
5511
  }
5488
5512
  if (this.selectionStart !== this.selectionEnd || this.inCompositionMode ? this.renderSelection(n2, e3) : this.renderCursor(n2, e3), i2) for (const e4 of s2) {
5489
5513
  const s3 = e4.clipPath, i3 = vt(t2.canvas), r3 = i3.getContext("2d");
5490
- if (Xo(r3, this.canvas), !s3.absolutePositioned) {
5514
+ if (Go(r3, this.canvas), !s3.absolutePositioned) {
5491
5515
  const t3 = e4.calcTransformMatrix();
5492
5516
  r3.transform(t3[0], t3[1], t3[2], t3[3], t3[4], t3[5]);
5493
5517
  }
@@ -5516,7 +5540,7 @@ class Wo extends jo {
5516
5540
  const n2 = this._getLineLeftOffset(r2), o2 = this.__charBounds[r2][i2];
5517
5541
  o2 && (s2 = o2.left), 0 !== this.charSpacing && i2 === this._textLines[r2].length && (s2 -= this._getWidthOfCharSpacing());
5518
5542
  const a2 = { top: e3, left: n2 + (s2 > 0 ? s2 : 0) };
5519
- return "rtl" === this.direction && (this.textAlign === A || this.textAlign === vo || this.textAlign === _o ? a2.left *= -1 : this.textAlign === M || this.textAlign === yo ? a2.left = n2 - (s2 > 0 ? s2 : 0) : this.textAlign !== D && this.textAlign !== xo || (a2.left = n2 - (s2 > 0 ? s2 : 0))), a2;
5543
+ return "rtl" === this.direction && (this.textAlign === A || this.textAlign === Je || this.textAlign === Ze ? a2.left *= -1 : this.textAlign === M || this.textAlign === Qe ? a2.left = n2 - (s2 > 0 ? s2 : 0) : this.textAlign !== D && this.textAlign !== $e || (a2.left = n2 - (s2 > 0 ? s2 : 0))), a2;
5520
5544
  }
5521
5545
  renderCursorAt(t2) {
5522
5546
  this._renderCursor(this.canvas.contextTop, this._getCursorBoundaries(t2, true), t2);
@@ -5546,7 +5570,7 @@ class Wo extends jo {
5546
5570
  this.renderCursorAt(e3);
5547
5571
  }
5548
5572
  _renderSelection(t2, e3, s2) {
5549
- const i2 = e3.selectionStart, r2 = e3.selectionEnd, n2 = this.textAlign.includes(vo), o2 = this.get2DCursorLocation(i2), a2 = this.get2DCursorLocation(r2), h2 = o2.lineIndex, c2 = a2.lineIndex, l2 = o2.charIndex < 0 ? 0 : o2.charIndex, u2 = a2.charIndex < 0 ? 0 : a2.charIndex;
5573
+ const i2 = e3.selectionStart, r2 = e3.selectionEnd, n2 = this.textAlign.includes(Je), o2 = this.get2DCursorLocation(i2), a2 = this.get2DCursorLocation(r2), h2 = o2.lineIndex, c2 = a2.lineIndex, l2 = o2.charIndex < 0 ? 0 : o2.charIndex, u2 = a2.charIndex < 0 ? 0 : a2.charIndex;
5550
5574
  for (let e4 = h2; e4 <= c2; e4++) {
5551
5575
  const i3 = this._getLineLeftOffset(e4) || 0;
5552
5576
  let r3 = this.getHeightOfLine(e4), o3 = 0, a3 = 0, d2 = 0;
@@ -5559,7 +5583,7 @@ class Wo extends jo {
5559
5583
  o3 = r3, (this.lineHeight < 1 || e4 === c2 && this.lineHeight > 1) && (r3 /= this.lineHeight);
5560
5584
  let g2 = s2.left + i3 + a3, f = r3, p2 = 0;
5561
5585
  const m2 = d2 - a3;
5562
- this.inCompositionMode ? (t2.fillStyle = this.compositionColor || "black", f = 1, p2 = r3) : t2.fillStyle = this.selectionColor, "rtl" === this.direction && (this.textAlign === A || this.textAlign === vo || this.textAlign === _o ? g2 = this.width - g2 - m2 : this.textAlign === M || this.textAlign === yo ? g2 = s2.left + i3 - d2 : this.textAlign !== D && this.textAlign !== xo || (g2 = s2.left + i3 - d2)), t2.fillRect(g2, s2.top + s2.topOffset + p2, m2, f), s2.topOffset += o3;
5586
+ this.inCompositionMode ? (t2.fillStyle = this.compositionColor || "black", f = 1, p2 = r3) : t2.fillStyle = this.selectionColor, "rtl" === this.direction && (this.textAlign === A || this.textAlign === Je || this.textAlign === Ze ? g2 = this.width - g2 - m2 : this.textAlign === M || this.textAlign === Qe ? g2 = s2.left + i3 - d2 : this.textAlign !== D && this.textAlign !== $e || (g2 = s2.left + i3 - d2)), t2.fillRect(g2, s2.top + s2.topOffset + p2, m2, f), s2.topOffset += o3;
5563
5587
  }
5564
5588
  }
5565
5589
  getCurrentCharFontSize() {
@@ -5578,19 +5602,19 @@ class Wo extends jo {
5578
5602
  this.exitEditingImpl(), this.draggableTextDelegate.dispose(), super.dispose();
5579
5603
  }
5580
5604
  }
5581
- t(Wo, "ownDefaults", Yo), t(Wo, "type", "IText"), tt.setClass(Wo), tt.setClass(Wo, "i-text");
5582
- class Vo extends Wo {
5605
+ t(No, "ownDefaults", Ho), t(No, "type", "IText"), tt.setClass(No), tt.setClass(No, "i-text");
5606
+ class Uo extends No {
5583
5607
  static getDefaults() {
5584
- return s(s({}, super.getDefaults()), Vo.ownDefaults);
5608
+ return s(s({}, super.getDefaults()), Uo.ownDefaults);
5585
5609
  }
5586
5610
  constructor(t2, e3) {
5587
- super(t2, s(s({}, Vo.ownDefaults), e3));
5611
+ super(t2, s(s({}, Uo.ownDefaults), e3));
5588
5612
  }
5589
5613
  static createControls() {
5590
- return { controls: mi() };
5614
+ return { controls: Ai() };
5591
5615
  }
5592
5616
  initDimensions() {
5593
- this.initialized && (this.isEditing && this.initDelayedCursor(), this._clearCache(), this.dynamicMinWidth = 0, this._styleMap = this._generateStyleMap(this._splitText()), this.dynamicMinWidth > this.width && this._set("width", this.dynamicMinWidth), this.textAlign.includes(vo) && this.enlargeSpaces(), this.height = this.calcTextHeight());
5617
+ this.initialized && (this.isEditing && this.initDelayedCursor(), this._clearCache(), this.dynamicMinWidth = 0, this._styleMap = this._generateStyleMap(this._splitText()), this.dynamicMinWidth > this.width && this._set("width", this.dynamicMinWidth), this.textAlign.includes(Je) && this.enlargeSpaces(), this.height = this.calcTextHeight());
5594
5618
  }
5595
5619
  _generateStyleMap(t2) {
5596
5620
  let e3 = 0, s2 = 0, i2 = 0;
@@ -5712,8 +5736,8 @@ class Vo extends Wo {
5712
5736
  return super.toObject(["minWidth", "splitByGrapheme", ...t2]);
5713
5737
  }
5714
5738
  }
5715
- t(Vo, "type", "Textbox"), t(Vo, "textLayoutProperties", [...Wo.textLayoutProperties, "width"]), t(Vo, "ownDefaults", { minWidth: 20, dynamicMinWidth: 2, lockScalingFlip: true, noScaleCache: false, _wordJoiners: /[ \t\r]/, splitByGrapheme: false }), tt.setClass(Vo);
5716
- class zo extends Sr {
5739
+ t(Uo, "type", "Textbox"), t(Uo, "textLayoutProperties", [...No.textLayoutProperties, "width"]), t(Uo, "ownDefaults", { minWidth: 20, dynamicMinWidth: 2, lockScalingFlip: true, noScaleCache: false, _wordJoiners: /[ \t\r]/, splitByGrapheme: false }), tt.setClass(Uo);
5740
+ class qo extends Xr {
5717
5741
  shouldPerformLayout(t2) {
5718
5742
  return !!t2.target.clipPath && super.shouldPerformLayout(t2);
5719
5743
  }
@@ -5723,9 +5747,9 @@ class zo extends Sr {
5723
5747
  calcLayoutResult(t2, e3) {
5724
5748
  const { target: s2 } = t2, { clipPath: i2, group: r2 } = s2;
5725
5749
  if (!i2 || !this.shouldPerformLayout(t2)) return;
5726
- const { width: n2, height: o2 } = ae(br(s2, i2)), a2 = new ot(n2, o2);
5750
+ const { width: n2, height: o2 } = he(Br(s2, i2)), a2 = new ot(n2, o2);
5727
5751
  if (i2.absolutePositioned) {
5728
- return { center: pe(i2.getRelativeCenterPoint(), void 0, r2 ? r2.calcTransformMatrix() : void 0), size: a2 };
5752
+ return { center: me(i2.getRelativeCenterPoint(), void 0, r2 ? r2.calcTransformMatrix() : void 0), size: a2 };
5729
5753
  }
5730
5754
  {
5731
5755
  const r3 = i2.getRelativeCenterPoint().transform(s2.calcOwnMatrix(), true);
@@ -5737,15 +5761,15 @@ class zo extends Sr {
5737
5761
  }
5738
5762
  }
5739
5763
  }
5740
- t(zo, "type", "clip-path"), tt.setClass(zo);
5741
- class Go extends Sr {
5764
+ t(qo, "type", "clip-path"), tt.setClass(qo);
5765
+ class Ko extends Xr {
5742
5766
  getInitialSize(t2, e3) {
5743
5767
  let { target: s2 } = t2, { size: i2 } = e3;
5744
5768
  return new ot(s2.width || i2.x, s2.height || i2.y);
5745
5769
  }
5746
5770
  }
5747
- t(Go, "type", "fixed"), tt.setClass(Go);
5748
- class Ho extends Dr {
5771
+ t(Ko, "type", "fixed"), tt.setClass(Ko);
5772
+ class Jo extends Gr {
5749
5773
  subscribeTargets(t2) {
5750
5774
  const e3 = t2.target;
5751
5775
  t2.targets.reduce((t3, e4) => (e4.parent && t3.add(e4.parent), t3), /* @__PURE__ */ new Set()).forEach((t3) => {
@@ -5759,15 +5783,15 @@ class Ho extends Dr {
5759
5783
  });
5760
5784
  }
5761
5785
  }
5762
- class No extends Er {
5786
+ class Qo extends Ur {
5763
5787
  static getDefaults() {
5764
- return s(s({}, super.getDefaults()), No.ownDefaults);
5788
+ return s(s({}, super.getDefaults()), Qo.ownDefaults);
5765
5789
  }
5766
5790
  constructor() {
5767
5791
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
5768
- super(), Object.assign(this, No.ownDefaults), this.setOptions(e3);
5792
+ super(), Object.assign(this, Qo.ownDefaults), this.setOptions(e3);
5769
5793
  const { left: s2, top: i2, layoutManager: r2 } = e3;
5770
- this.groupInit(t2, { left: s2, top: i2, layoutManager: null != r2 ? r2 : new Ho() });
5794
+ this.groupInit(t2, { left: s2, top: i2, layoutManager: null != r2 ? r2 : new Jo() });
5771
5795
  }
5772
5796
  _shouldSetNestedCoords() {
5773
5797
  return true;
@@ -5796,8 +5820,8 @@ class No extends Er {
5796
5820
  e3.forEach((t3) => {
5797
5821
  const { parent: e4 } = t3;
5798
5822
  e4 && s2.add(e4);
5799
- }), t2 === xr ? s2.forEach((t3) => {
5800
- t3._onAfterObjectsChange(_r, e3);
5823
+ }), t2 === Rr ? s2.forEach((t3) => {
5824
+ t3._onAfterObjectsChange(Lr, e3);
5801
5825
  }) : s2.forEach((t3) => {
5802
5826
  t3._set("dirty", true);
5803
5827
  });
@@ -5821,8 +5845,8 @@ class No extends Er {
5821
5845
  super._renderControls(t2, e3), t2.restore();
5822
5846
  }
5823
5847
  }
5824
- t(No, "type", "ActiveSelection"), t(No, "ownDefaults", { multiSelectionStacking: "canvas-stacking" }), tt.setClass(No), tt.setClass(No, "activeSelection");
5825
- class Uo {
5848
+ t(Qo, "type", "ActiveSelection"), t(Qo, "ownDefaults", { multiSelectionStacking: "canvas-stacking" }), tt.setClass(Qo), tt.setClass(Qo, "activeSelection");
5849
+ class Zo {
5826
5850
  constructor() {
5827
5851
  t(this, "resources", {});
5828
5852
  }
@@ -5838,7 +5862,7 @@ class Uo {
5838
5862
  return a2.width === s2 && a2.height === i2 || (r2.width = a2.width, r2.height = a2.height), n2.putImageData(a2, 0, 0), o2;
5839
5863
  }
5840
5864
  }
5841
- class qo {
5865
+ class $o {
5842
5866
  constructor() {
5843
5867
  let { tileSize: e3 = o.textureSize } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
5844
5868
  t(this, "aPosition", new Float32Array([0, 0, 0, 1, 1, 0, 1, 1])), t(this, "resources", {}), this.tileSize = e3, this.setupGLContext(e3, e3), this.captureGPUInfo();
@@ -5911,21 +5935,21 @@ class qo {
5911
5935
  return this.gpuInfo = e3, e3;
5912
5936
  }
5913
5937
  }
5914
- let Ko;
5915
- function Jo() {
5938
+ let ta;
5939
+ function ea() {
5916
5940
  const { WebGLProbe: t2 } = p();
5917
- return t2.queryWebGL(pt()), o.enableGLFiltering && t2.isSupported(o.textureSize) ? new qo({ tileSize: o.textureSize }) : new Uo();
5941
+ return t2.queryWebGL(pt()), o.enableGLFiltering && t2.isSupported(o.textureSize) ? new $o({ tileSize: o.textureSize }) : new Zo();
5918
5942
  }
5919
- function Qo() {
5920
- return !Ko && (!(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]) && (Ko = Jo()), Ko;
5943
+ function sa() {
5944
+ return !ta && (!(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]) && (ta = ea()), ta;
5921
5945
  }
5922
- const $o = ["filters", "resizeFilter", "src", "crossOrigin", "type"], ta = ["cropX", "cropY"];
5923
- class ea extends _i {
5946
+ const ra = ["filters", "resizeFilter", "src", "crossOrigin", "type"], na = ["cropX", "cropY"];
5947
+ class oa extends Li {
5924
5948
  static getDefaults() {
5925
- return s(s({}, super.getDefaults()), ea.ownDefaults);
5949
+ return s(s({}, super.getDefaults()), oa.ownDefaults);
5926
5950
  }
5927
5951
  constructor(e3, s2) {
5928
- super(), t(this, "_lastScaleX", 1), t(this, "_lastScaleY", 1), t(this, "_filterScalingX", 1), t(this, "_filterScalingY", 1), this.filters = [], Object.assign(this, ea.ownDefaults), this.setOptions(s2), this.cacheKey = "texture".concat(ft()), this.setElement("string" == typeof e3 ? (this.canvas && Kt(this.canvas.getElement()) || m()).getElementById(e3) : e3, s2);
5952
+ super(), t(this, "_lastScaleX", 1), t(this, "_lastScaleY", 1), t(this, "_filterScalingX", 1), t(this, "_filterScalingY", 1), this.filters = [], Object.assign(this, oa.ownDefaults), this.setOptions(s2), this.cacheKey = "texture".concat(ft()), this.setElement("string" == typeof e3 ? (this.canvas && Kt(this.canvas.getElement()) || m()).getElementById(e3) : e3, s2);
5929
5953
  }
5930
5954
  getElement() {
5931
5955
  return this._element;
@@ -5933,11 +5957,11 @@ class ea extends _i {
5933
5957
  setElement(t2) {
5934
5958
  var e3;
5935
5959
  let s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
5936
- this.removeTexture(this.cacheKey), this.removeTexture("".concat(this.cacheKey, "_filtered")), this._element = t2, this._originalElement = t2, this._setWidthHeight(s2), null === (e3 = t2.classList) || void 0 === e3 || e3.add(ea.CSS_CANVAS), 0 !== this.filters.length && this.applyFilters(), this.resizeFilter && this.applyResizeFilters();
5960
+ this.removeTexture(this.cacheKey), this.removeTexture("".concat(this.cacheKey, "_filtered")), this._element = t2, this._originalElement = t2, this._setWidthHeight(s2), null === (e3 = t2.classList) || void 0 === e3 || e3.add(oa.CSS_CANVAS), 0 !== this.filters.length && this.applyFilters(), this.resizeFilter && this.applyResizeFilters();
5937
5961
  }
5938
5962
  removeTexture(t2) {
5939
- const e3 = Qo(false);
5940
- e3 instanceof qo && e3.evictCachesForKey(t2);
5963
+ const e3 = sa(false);
5964
+ e3 instanceof $o && e3.evictCachesForKey(t2);
5941
5965
  }
5942
5966
  dispose() {
5943
5967
  super.dispose(), this.removeTexture(this.cacheKey), this.removeTexture("".concat(this.cacheKey, "_filtered")), this._cacheContext = null, ["_originalElement", "_element", "_filteredEl", "_cacheCanvas"].forEach((t2) => {
@@ -5962,7 +5986,7 @@ class ea extends _i {
5962
5986
  const e3 = [];
5963
5987
  return this.filters.forEach((t3) => {
5964
5988
  t3 && e3.push(t3.toObject());
5965
- }), s(s({}, super.toObject([...ta, ...t2])), {}, { src: this.getSrc(), crossOrigin: this.getCrossOrigin(), filters: e3 }, this.resizeFilter ? { resizeFilter: this.resizeFilter.toObject() } : {});
5989
+ }), s(s({}, super.toObject([...na, ...t2])), {}, { src: this.getSrc(), crossOrigin: this.getCrossOrigin(), filters: e3 }, this.resizeFilter ? { resizeFilter: this.resizeFilter.toObject() } : {});
5966
5990
  }
5967
5991
  hasCrop() {
5968
5992
  return !!this.cropX || !!this.cropY || this.width < this._element.width || this.height < this._element.height;
@@ -5990,7 +6014,7 @@ class ea extends _i {
5990
6014
  }
5991
6015
  setSrc(t2) {
5992
6016
  let { crossOrigin: e3, signal: s2 } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
5993
- return Bt(t2, { crossOrigin: e3, signal: s2 }).then((t3) => {
6017
+ return It(t2, { crossOrigin: e3, signal: s2 }).then((t3) => {
5994
6018
  void 0 !== e3 && this.set({ crossOrigin: e3 }), this.setElement(t3);
5995
6019
  });
5996
6020
  }
@@ -6001,7 +6025,7 @@ class ea extends _i {
6001
6025
  const t2 = this.resizeFilter, e3 = this.minimumScaleTrigger, s2 = this.getTotalObjectScaling(), i2 = s2.x, r2 = s2.y, n2 = this._filteredEl || this._originalElement;
6002
6026
  if (this.group && this.set("dirty", true), !t2 || i2 > e3 && r2 > e3) return this._element = n2, this._filterScalingX = 1, this._filterScalingY = 1, this._lastScaleX = i2, void (this._lastScaleY = r2);
6003
6027
  const o2 = vt(n2), { width: a2, height: h2 } = n2;
6004
- this._element = o2, this._lastScaleX = t2.scaleX = i2, this._lastScaleY = t2.scaleY = r2, Qo().applyFilters([t2], n2, a2, h2, this._element), this._filterScalingX = o2.width / this._originalElement.width, this._filterScalingY = o2.height / this._originalElement.height;
6028
+ this._element = o2, this._lastScaleX = t2.scaleX = i2, this._lastScaleY = t2.scaleY = r2, sa().applyFilters([t2], n2, a2, h2, this._element), this._filterScalingX = o2.width / this._originalElement.width, this._filterScalingY = o2.height / this._originalElement.height;
6005
6029
  }
6006
6030
  applyFilters() {
6007
6031
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.filters || [];
@@ -6011,7 +6035,7 @@ class ea extends _i {
6011
6035
  const t3 = vt({ width: s2, height: i2 });
6012
6036
  this._element = t3, this._filteredEl = t3;
6013
6037
  } else this._filteredEl && (this._element = this._filteredEl, this._filteredEl.getContext("2d").clearRect(0, 0, s2, i2), this._lastScaleX = 1, this._lastScaleY = 1);
6014
- Qo().applyFilters(t2, this._originalElement, s2, i2, this._element, this.cacheKey), this._originalElement.width === this._element.width && this._originalElement.height === this._element.height || (this._filterScalingX = this._element.width / this._originalElement.width, this._filterScalingY = this._element.height / this._originalElement.height);
6038
+ sa().applyFilters(t2, this._originalElement, s2, i2, this._element, this.cacheKey), this._originalElement.width === this._element.width && this._originalElement.height === this._element.height || (this._filterScalingX = this._element.width / this._originalElement.width, this._filterScalingY = this._element.height / this._originalElement.height);
6015
6039
  }
6016
6040
  _render(t2) {
6017
6041
  t2.imageSmoothingEnabled = this.imageSmoothing, true !== this.isMoving && this.resizeFilter && this._needsResize() && this.applyResizeFilters(), this._stroke(t2), this._renderPaintInOrder(t2);
@@ -6041,57 +6065,57 @@ class ea extends _i {
6041
6065
  this.width = t2 || s2.width, this.height = e3 || s2.height;
6042
6066
  }
6043
6067
  parsePreserveAspectRatioAttribute() {
6044
- const t2 = Be(this.preserveAspectRatio || ""), e3 = this.width, s2 = this.height, i2 = { width: e3, height: s2 };
6068
+ const t2 = Xe(this.preserveAspectRatio || ""), e3 = this.width, s2 = this.height, i2 = { width: e3, height: s2 };
6045
6069
  let r2, n2 = this._element.width, o2 = this._element.height, a2 = 1, h2 = 1, c2 = 0, l2 = 0, u2 = 0, d2 = 0;
6046
- return !t2 || t2.alignX === j && t2.alignY === j ? (a2 = e3 / n2, h2 = s2 / o2) : ("meet" === t2.meetOrSlice && (a2 = h2 = Ar(this._element, i2), r2 = (e3 - n2 * a2) / 2, "Min" === t2.alignX && (c2 = -r2), "Max" === t2.alignX && (c2 = r2), r2 = (s2 - o2 * h2) / 2, "Min" === t2.alignY && (l2 = -r2), "Max" === t2.alignY && (l2 = r2)), "slice" === t2.meetOrSlice && (a2 = h2 = jr(this._element, i2), r2 = n2 - e3 / a2, "Mid" === t2.alignX && (u2 = r2 / 2), "Max" === t2.alignX && (u2 = r2), r2 = o2 - s2 / h2, "Mid" === t2.alignY && (d2 = r2 / 2), "Max" === t2.alignY && (d2 = r2), n2 = e3 / a2, o2 = s2 / h2)), { width: n2, height: o2, scaleX: a2, scaleY: h2, offsetLeft: c2, offsetTop: l2, cropX: u2, cropY: d2 };
6070
+ return !t2 || t2.alignX === j && t2.alignY === j ? (a2 = e3 / n2, h2 = s2 / o2) : ("meet" === t2.meetOrSlice && (a2 = h2 = qr(this._element, i2), r2 = (e3 - n2 * a2) / 2, "Min" === t2.alignX && (c2 = -r2), "Max" === t2.alignX && (c2 = r2), r2 = (s2 - o2 * h2) / 2, "Min" === t2.alignY && (l2 = -r2), "Max" === t2.alignY && (l2 = r2)), "slice" === t2.meetOrSlice && (a2 = h2 = Kr(this._element, i2), r2 = n2 - e3 / a2, "Mid" === t2.alignX && (u2 = r2 / 2), "Max" === t2.alignX && (u2 = r2), r2 = o2 - s2 / h2, "Mid" === t2.alignY && (d2 = r2 / 2), "Max" === t2.alignY && (d2 = r2), n2 = e3 / a2, o2 = s2 / h2)), { width: n2, height: o2, scaleX: a2, scaleY: h2, offsetLeft: c2, offsetTop: l2, cropX: u2, cropY: d2 };
6047
6071
  }
6048
6072
  static fromObject(t2, e3) {
6049
- let { filters: r2, resizeFilter: n2, src: o2, crossOrigin: a2, type: h2 } = t2, c2 = i(t2, $o);
6050
- return Promise.all([Bt(o2, s(s({}, e3), {}, { crossOrigin: a2 })), r2 && It(r2, e3), n2 && It([n2], e3), Xt(c2, e3)]).then((t3) => {
6073
+ let { filters: r2, resizeFilter: n2, src: o2, crossOrigin: a2, type: h2 } = t2, c2 = i(t2, ra);
6074
+ return Promise.all([It(o2, s(s({}, e3), {}, { crossOrigin: a2 })), r2 && Bt(r2, e3), n2 && Bt([n2], e3), Xt(c2, e3)]).then((t3) => {
6051
6075
  let [e4, i2 = [], [r3] = [], n3 = {}] = t3;
6052
6076
  return new this(e4, s(s({}, c2), {}, { src: o2, filters: i2, resizeFilter: r3 }, n3));
6053
6077
  });
6054
6078
  }
6055
6079
  static fromURL(t2) {
6056
6080
  let { crossOrigin: e3 = null, signal: s2 } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i2 = arguments.length > 2 ? arguments[2] : void 0;
6057
- return Bt(t2, { crossOrigin: e3, signal: s2 }).then((t3) => new this(t3, i2));
6081
+ return It(t2, { crossOrigin: e3, signal: s2 }).then((t3) => new this(t3, i2));
6058
6082
  }
6059
6083
  static async fromElement(t2) {
6060
6084
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, s2 = arguments.length > 2 ? arguments[2] : void 0;
6061
- const i2 = fr(t2, this.ATTRIBUTE_NAMES, s2);
6085
+ const i2 = Pr(t2, this.ATTRIBUTE_NAMES, s2);
6062
6086
  return this.fromURL(i2["xlink:href"] || i2.href, e3, i2).catch((t3) => (a("log", "Unable to parse Image", t3), null));
6063
6087
  }
6064
6088
  }
6065
- t(ea, "type", "Image"), t(ea, "cacheProperties", [...ps, ...ta]), t(ea, "ownDefaults", { strokeWidth: 0, srcFromAttribute: false, minimumScaleTrigger: 0.5, cropX: 0, cropY: 0, imageSmoothing: true }), t(ea, "CSS_CANVAS", "canvas-img"), t(ea, "ATTRIBUTE_NAMES", [...Ri, "x", "y", "width", "height", "preserveAspectRatio", "xlink:href", "href", "crossOrigin", "image-rendering"]), tt.setClass(ea), tt.setSVGClass(ea);
6066
- Ye(["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"]);
6067
- const ya = W, _a = (t2) => function(e3, s2, i2) {
6089
+ t(oa, "type", "Image"), t(oa, "cacheProperties", [...Es, ...na]), t(oa, "ownDefaults", { strokeWidth: 0, srcFromAttribute: false, minimumScaleTrigger: 0.5, cropX: 0, cropY: 0, imageSmoothing: true }), t(oa, "CSS_CANVAS", "canvas-img"), t(oa, "ATTRIBUTE_NAMES", [...Zi, "x", "y", "width", "height", "preserveAspectRatio", "xlink:href", "href", "crossOrigin", "image-rendering"]), tt.setClass(oa), tt.setSVGClass(oa);
6090
+ Ve(["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"]);
6091
+ const Sa = W, wa = (t2) => function(e3, s2, i2) {
6068
6092
  const { points: r2, pathOffset: n2 } = i2;
6069
6093
  return new ot(r2[t2]).subtract(n2).transform(Tt(i2.getViewportTransform(), i2.calcTransformMatrix()));
6070
- }, xa = (t2, e3, s2, i2) => {
6071
- const { target: r2, pointIndex: n2 } = e3, o2 = r2, a2 = pe(new ot(s2, i2), void 0, o2.calcOwnMatrix());
6094
+ }, Ta = (t2, e3, s2, i2) => {
6095
+ const { target: r2, pointIndex: n2 } = e3, o2 = r2, a2 = me(new ot(s2, i2), void 0, o2.calcOwnMatrix());
6072
6096
  return o2.points[n2] = a2.add(o2.pathOffset), o2.setDimensions(), o2.set("dirty", true), true;
6073
- }, Ca = (t2, e3) => function(i2, r2, n2, o2) {
6097
+ }, Oa = (t2, e3) => function(i2, r2, n2, o2) {
6074
6098
  const a2 = r2.target, h2 = new ot(a2.points[(t2 > 0 ? t2 : a2.points.length) - 1]), c2 = h2.subtract(a2.pathOffset).transform(a2.calcOwnMatrix()), l2 = e3(i2, s(s({}, r2), {}, { pointIndex: t2 }), n2, o2), u2 = h2.subtract(a2.pathOffset).transform(a2.calcOwnMatrix()).subtract(c2);
6075
6099
  return a2.left -= u2.x, a2.top -= u2.y, l2;
6076
- }, ba = (t2) => Ys(ya, Ca(t2, xa));
6077
- const Sa = (t2, e3, s2) => {
6100
+ }, ka = (t2) => si(Sa, Oa(t2, Ta));
6101
+ const Da = (t2, e3, s2) => {
6078
6102
  const { path: i2, pathOffset: r2 } = t2, n2 = i2[e3];
6079
6103
  return new ot(n2[s2] - r2.x, n2[s2 + 1] - r2.y).transform(Tt(t2.getViewportTransform(), t2.calcTransformMatrix()));
6080
6104
  };
6081
- function wa(t2, e3, s2) {
6105
+ function Ma(t2, e3, s2) {
6082
6106
  const { commandIndex: i2, pointIndex: r2 } = this;
6083
- return Sa(s2, i2, r2);
6107
+ return Da(s2, i2, r2);
6084
6108
  }
6085
- function Ta(t2, e3, i2, r2) {
6109
+ function Pa(t2, e3, i2, r2) {
6086
6110
  const { target: n2 } = e3, { commandIndex: o2, pointIndex: a2 } = this, h2 = ((t3, e4, s2, i3, r3) => {
6087
- const { path: n3, pathOffset: o3 } = t3, a3 = n3[(i3 > 0 ? i3 : n3.length) - 1], h3 = new ot(a3[r3], a3[r3 + 1]), c2 = h3.subtract(o3).transform(t3.calcOwnMatrix()), l2 = pe(new ot(e4, s2), void 0, t3.calcOwnMatrix());
6111
+ const { path: n3, pathOffset: o3 } = t3, a3 = n3[(i3 > 0 ? i3 : n3.length) - 1], h3 = new ot(a3[r3], a3[r3 + 1]), c2 = h3.subtract(o3).transform(t3.calcOwnMatrix()), l2 = me(new ot(e4, s2), void 0, t3.calcOwnMatrix());
6088
6112
  n3[i3][r3] = l2.x + o3.x, n3[i3][r3 + 1] = l2.y + o3.y, t3.setDimensions();
6089
6113
  const u2 = h3.subtract(t3.pathOffset).transform(t3.calcOwnMatrix()).subtract(c2);
6090
6114
  return t3.left -= u2.x, t3.top -= u2.y, t3.set("dirty", true), true;
6091
6115
  })(n2, i2, r2, o2, a2);
6092
- return ye(this.actionName, s(s({}, Te(t2, e3, i2, r2)), {}, { commandIndex: o2, pointIndex: a2 })), h2;
6116
+ return _e(this.actionName, s(s({}, Oe(t2, e3, i2, r2)), {}, { commandIndex: o2, pointIndex: a2 })), h2;
6093
6117
  }
6094
- class Oa extends Hs {
6118
+ class Ea extends ai {
6095
6119
  constructor(t2) {
6096
6120
  super(t2);
6097
6121
  }
@@ -6100,54 +6124,54 @@ class Oa extends Hs {
6100
6124
  super.render(t2, e3, i2, o2, n2);
6101
6125
  }
6102
6126
  }
6103
- class ka extends Oa {
6127
+ class Aa extends Ea {
6104
6128
  constructor(t2) {
6105
6129
  super(t2);
6106
6130
  }
6107
6131
  render(t2, e3, s2, i2, r2) {
6108
6132
  const { path: n2 } = r2, { commandIndex: o2, pointIndex: a2, connectToCommandIndex: h2, connectToPointIndex: c2 } = this;
6109
6133
  t2.save(), t2.strokeStyle = this.controlStroke, this.connectionDashArray && t2.setLineDash(this.connectionDashArray);
6110
- const [l2] = n2[o2], u2 = Sa(r2, h2, c2);
6134
+ const [l2] = n2[o2], u2 = Da(r2, h2, c2);
6111
6135
  if ("Q" === l2) {
6112
- const i3 = Sa(r2, o2, a2 + 2);
6136
+ const i3 = Da(r2, o2, a2 + 2);
6113
6137
  t2.moveTo(i3.x, i3.y), t2.lineTo(e3, s2);
6114
6138
  } else t2.moveTo(e3, s2);
6115
6139
  t2.lineTo(u2.x, u2.y), t2.stroke(), t2.restore(), super.render(t2, e3, s2, i2, r2);
6116
6140
  }
6117
6141
  }
6118
- const Da = (t2, e3, i2, r2, n2, o2) => new (i2 ? ka : Oa)(s(s({ commandIndex: t2, pointIndex: e3, actionName: "modifyPath", positionHandler: wa, actionHandler: Ta, connectToCommandIndex: n2, connectToPointIndex: o2 }, r2), i2 ? r2.controlPointStyle : r2.pointStyle));
6119
- var Ma = Object.freeze({ __proto__: null, changeWidth: Vs, createObjectDefaultControls: fi, createPathControls: function(t2) {
6142
+ const ja = (t2, e3, i2, r2, n2, o2) => new (i2 ? Aa : Ea)(s(s({ commandIndex: t2, pointIndex: e3, actionName: "modifyPath", positionHandler: Ma, actionHandler: Pa, connectToCommandIndex: n2, connectToPointIndex: o2 }, r2), i2 ? r2.controlPointStyle : r2.pointStyle));
6143
+ var Fa = Object.freeze({ __proto__: null, changeWidth: ri, createObjectDefaultControls: Pi, createPathControls: function(t2) {
6120
6144
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
6121
6145
  const s2 = {};
6122
6146
  let i2 = "M";
6123
6147
  return t2.path.forEach((t3, r2) => {
6124
6148
  const n2 = t3[0];
6125
- switch ("Z" !== n2 && (s2["c_".concat(r2, "_").concat(n2)] = Da(r2, t3.length - 2, false, e3)), n2) {
6149
+ switch ("Z" !== n2 && (s2["c_".concat(r2, "_").concat(n2)] = ja(r2, t3.length - 2, false, e3)), n2) {
6126
6150
  case "C":
6127
- s2["c_".concat(r2, "_C_CP_1")] = Da(r2, 1, true, e3, r2 - 1, /* @__PURE__ */ ((t4) => "C" === t4 ? 5 : "Q" === t4 ? 3 : 1)(i2)), s2["c_".concat(r2, "_C_CP_2")] = Da(r2, 3, true, e3, r2, 5);
6151
+ s2["c_".concat(r2, "_C_CP_1")] = ja(r2, 1, true, e3, r2 - 1, /* @__PURE__ */ ((t4) => "C" === t4 ? 5 : "Q" === t4 ? 3 : 1)(i2)), s2["c_".concat(r2, "_C_CP_2")] = ja(r2, 3, true, e3, r2, 5);
6128
6152
  break;
6129
6153
  case "Q":
6130
- s2["c_".concat(r2, "_Q_CP_1")] = Da(r2, 1, true, e3, r2, 3);
6154
+ s2["c_".concat(r2, "_Q_CP_1")] = ja(r2, 1, true, e3, r2, 3);
6131
6155
  }
6132
6156
  i2 = n2;
6133
6157
  }), s2;
6134
- }, createPolyActionHandler: ba, createPolyControls: function(t2) {
6158
+ }, createPolyActionHandler: ka, createPolyControls: function(t2) {
6135
6159
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
6136
6160
  const i2 = {};
6137
- for (let r2 = 0; r2 < ("number" == typeof t2 ? t2 : t2.points.length); r2++) i2["p".concat(r2)] = new Hs(s({ actionName: ya, positionHandler: _a(r2), actionHandler: ba(r2) }, e3));
6161
+ for (let r2 = 0; r2 < ("number" == typeof t2 ? t2 : t2.points.length); r2++) i2["p".concat(r2)] = new ai(s({ actionName: Sa, positionHandler: wa(r2), actionHandler: ka(r2) }, e3));
6138
6162
  return i2;
6139
- }, createPolyPositionHandler: _a, createResizeControls: pi, createTextboxDefaultControls: mi, dragHandler: De, factoryPolyActionHandler: Ca, getLocalPoint: ke, polyActionHandler: xa, renderCircleControl: zs, renderSquareControl: Gs, rotationStyleHandler: Ns, rotationWithSnapping: Us, scaleCursorStyleHandler: Qs, scaleOrSkewActionName: li, scaleSkewCursorStyleHandler: ui, scalingEqually: $s, scalingX: ti, scalingXOrSkewingY: di, scalingY: ei, scalingYOrSkewingX: gi, skewCursorStyleHandler: ni, skewHandlerX: ai, skewHandlerY: hi, wrapWithFireEvent: Ys, wrapWithFixedAnchor: Ws });
6140
- const Pa = (t2) => void 0 !== t2.webgl, Aa = "precision highp float", ja = "\n ".concat(Aa, ";\n varying vec2 vTexCoord;\n uniform sampler2D uTexture;\n void main() {\n gl_FragColor = texture2D(uTexture, vTexCoord);\n }"), Fa = ["type"], La = ["type"], Ra = new RegExp(Aa, "g");
6141
- class Ba {
6163
+ }, createPolyPositionHandler: wa, createResizeControls: Ei, createTextboxDefaultControls: Ai, dragHandler: Me, factoryPolyActionHandler: Oa, getLocalPoint: De, polyActionHandler: Ta, renderCircleControl: ni, renderSquareControl: oi, rotationStyleHandler: hi, rotationWithSnapping: ci, scaleCursorStyleHandler: gi, scaleOrSkewActionName: Oi, scaleSkewCursorStyleHandler: ki, scalingEqually: pi, scalingX: mi, scalingXOrSkewingY: Di, scalingY: vi, scalingYOrSkewingX: Mi, skewCursorStyleHandler: Ci, skewHandlerX: Si, skewHandlerY: wi, wrapWithFireEvent: si, wrapWithFixedAnchor: ii });
6164
+ const La = (t2) => void 0 !== t2.webgl, Ia = "precision highp float", Ba = "\n ".concat(Ia, ";\n varying vec2 vTexCoord;\n uniform sampler2D uTexture;\n void main() {\n gl_FragColor = texture2D(uTexture, vTexCoord);\n }"), Xa = ["type"], Ya = ["type"], Wa = new RegExp(Ia, "g");
6165
+ class Va {
6142
6166
  get type() {
6143
6167
  return this.constructor.type;
6144
6168
  }
6145
6169
  constructor() {
6146
- let t2 = i(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, Fa);
6170
+ let t2 = i(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, Xa);
6147
6171
  Object.assign(this, this.constructor.defaults, t2);
6148
6172
  }
6149
6173
  getFragmentSource() {
6150
- return ja;
6174
+ return Ba;
6151
6175
  }
6152
6176
  getVertexSource() {
6153
6177
  return "\n attribute vec2 aPosition;\n varying vec2 vTexCoord;\n void main() {\n vTexCoord = aPosition;\n gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n }";
@@ -6155,7 +6179,7 @@ class Ba {
6155
6179
  createProgram(t2) {
6156
6180
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.getFragmentSource(), s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.getVertexSource();
6157
6181
  const { WebGLProbe: { GLPrecision: i2 = "highp" } } = p();
6158
- "highp" !== i2 && (e3 = e3.replace(Ra, Aa.replace("highp", i2)));
6182
+ "highp" !== i2 && (e3 = e3.replace(Wa, Ia.replace("highp", i2)));
6159
6183
  const r2 = t2.createShader(t2.VERTEX_SHADER), n2 = t2.createShader(t2.FRAGMENT_SHADER), o2 = t2.createProgram();
6160
6184
  if (!r2 || !n2 || !o2) throw new h("Vertex, fragment shader or program creation error");
6161
6185
  if (t2.shaderSource(r2, s2), t2.compileShader(r2), !t2.getShaderParameter(r2, t2.COMPILE_STATUS)) throw new h("Vertex shader compile error for ".concat(this.type, ": ").concat(t2.getShaderInfoLog(r2)));
@@ -6192,7 +6216,7 @@ class Ba {
6192
6216
  return false;
6193
6217
  }
6194
6218
  applyTo(t2) {
6195
- Pa(t2) ? (this._setupFrameBuffer(t2), this.applyToWebGL(t2), this._swapTextures(t2)) : this.applyTo2d(t2);
6219
+ La(t2) ? (this._setupFrameBuffer(t2), this.applyToWebGL(t2), this._swapTextures(t2)) : this.applyTo2d(t2);
6196
6220
  }
6197
6221
  applyTo2d(t2) {
6198
6222
  }
@@ -6229,21 +6253,21 @@ class Ba {
6229
6253
  return this.toObject();
6230
6254
  }
6231
6255
  static async fromObject(t2, e3) {
6232
- return new this(i(t2, La));
6256
+ return new this(i(t2, Ya));
6233
6257
  }
6234
6258
  }
6235
- t(Ba, "type", "BaseFilter"), t(Ba, "uniformLocations", []);
6236
- const Ia = { multiply: "gl_FragColor.rgb *= uColor.rgb;\n", screen: "gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n", add: "gl_FragColor.rgb += uColor.rgb;\n", difference: "gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n", subtract: "gl_FragColor.rgb -= uColor.rgb;\n", lighten: "gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n", darken: "gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n", exclusion: "gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n", overlay: "\n if (uColor.r < 0.5) {\n gl_FragColor.r *= 2.0 * uColor.r;\n } else {\n gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n }\n if (uColor.g < 0.5) {\n gl_FragColor.g *= 2.0 * uColor.g;\n } else {\n gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n }\n if (uColor.b < 0.5) {\n gl_FragColor.b *= 2.0 * uColor.b;\n } else {\n gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n }\n ", tint: "\n gl_FragColor.rgb *= (1.0 - uColor.a);\n gl_FragColor.rgb += uColor.rgb;\n " };
6237
- class Xa extends Ba {
6259
+ t(Va, "type", "BaseFilter"), t(Va, "uniformLocations", []);
6260
+ const za = { multiply: "gl_FragColor.rgb *= uColor.rgb;\n", screen: "gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n", add: "gl_FragColor.rgb += uColor.rgb;\n", difference: "gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n", subtract: "gl_FragColor.rgb -= uColor.rgb;\n", lighten: "gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n", darken: "gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n", exclusion: "gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n", overlay: "\n if (uColor.r < 0.5) {\n gl_FragColor.r *= 2.0 * uColor.r;\n } else {\n gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n }\n if (uColor.g < 0.5) {\n gl_FragColor.g *= 2.0 * uColor.g;\n } else {\n gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n }\n if (uColor.b < 0.5) {\n gl_FragColor.b *= 2.0 * uColor.b;\n } else {\n gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n }\n ", tint: "\n gl_FragColor.rgb *= (1.0 - uColor.a);\n gl_FragColor.rgb += uColor.rgb;\n " };
6261
+ class Ga extends Va {
6238
6262
  getCacheKey() {
6239
6263
  return "".concat(this.type, "_").concat(this.mode);
6240
6264
  }
6241
6265
  getFragmentSource() {
6242
- return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n gl_FragColor = color;\n if (color.a > 0.0) {\n ".concat(Ia[this.mode], "\n }\n }\n ");
6266
+ return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n gl_FragColor = color;\n if (color.a > 0.0) {\n ".concat(za[this.mode], "\n }\n }\n ");
6243
6267
  }
6244
6268
  applyTo2d(t2) {
6245
6269
  let { imageData: { data: e3 } } = t2;
6246
- const s2 = new Le(this.color).getSource(), i2 = this.alpha, r2 = s2[0] * i2, n2 = s2[1] * i2, o2 = s2[2] * i2, a2 = 1 - i2;
6270
+ const s2 = new Ie(this.color).getSource(), i2 = this.alpha, r2 = s2[0] * i2, n2 = s2[1] * i2, o2 = s2[2] * i2, a2 = 1 - i2;
6247
6271
  for (let t3 = 0; t3 < e3.length; t3 += 4) {
6248
6272
  const s3 = e3[t3], i3 = e3[t3 + 1], h2 = e3[t3 + 2];
6249
6273
  let c2, l2, u2;
@@ -6282,18 +6306,18 @@ class Xa extends Ba {
6282
6306
  }
6283
6307
  }
6284
6308
  sendUniformData(t2, e3) {
6285
- const s2 = new Le(this.color).getSource();
6309
+ const s2 = new Ie(this.color).getSource();
6286
6310
  s2[0] = this.alpha * s2[0] / 255, s2[1] = this.alpha * s2[1] / 255, s2[2] = this.alpha * s2[2] / 255, s2[3] = this.alpha, t2.uniform4fv(e3.uColor, s2);
6287
6311
  }
6288
6312
  }
6289
- t(Xa, "defaults", { color: "#F95C63", mode: "multiply", alpha: 1 }), t(Xa, "type", "BlendColor"), t(Xa, "uniformLocations", ["uColor"]), tt.setClass(Xa);
6290
- const Ya = { multiply: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform sampler2D uImage;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n varying vec2 vTexCoord2;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n vec4 color2 = texture2D(uImage, vTexCoord2);\n color.rgba *= color2.rgba;\n gl_FragColor = color;\n }\n ", mask: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform sampler2D uImage;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n varying vec2 vTexCoord2;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n vec4 color2 = texture2D(uImage, vTexCoord2);\n color.a = color2.a;\n gl_FragColor = color;\n }\n " }, Wa = ["type", "image"];
6291
- class Va extends Ba {
6313
+ t(Ga, "defaults", { color: "#F95C63", mode: "multiply", alpha: 1 }), t(Ga, "type", "BlendColor"), t(Ga, "uniformLocations", ["uColor"]), tt.setClass(Ga);
6314
+ const Ha = { multiply: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform sampler2D uImage;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n varying vec2 vTexCoord2;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n vec4 color2 = texture2D(uImage, vTexCoord2);\n color.rgba *= color2.rgba;\n gl_FragColor = color;\n }\n ", mask: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform sampler2D uImage;\n uniform vec4 uColor;\n varying vec2 vTexCoord;\n varying vec2 vTexCoord2;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n vec4 color2 = texture2D(uImage, vTexCoord2);\n color.a = color2.a;\n gl_FragColor = color;\n }\n " }, Na = ["type", "image"];
6315
+ class Ua extends Va {
6292
6316
  getCacheKey() {
6293
6317
  return "".concat(this.type, "_").concat(this.mode);
6294
6318
  }
6295
6319
  getFragmentSource() {
6296
- return Ya[this.mode];
6320
+ return Ha[this.mode];
6297
6321
  }
6298
6322
  getVertexSource() {
6299
6323
  return "\n attribute vec2 aPosition;\n varying vec2 vTexCoord;\n varying vec2 vTexCoord2;\n uniform mat3 uTransformMatrix;\n void main() {\n vTexCoord = aPosition;\n vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\n gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n }\n ";
@@ -6335,17 +6359,17 @@ class Va extends Ba {
6335
6359
  return s(s({}, super.toObject()), {}, { image: this.image && this.image.toObject() });
6336
6360
  }
6337
6361
  static async fromObject(t2, e3) {
6338
- let { type: r2, image: n2 } = t2, o2 = i(t2, Wa);
6339
- return ea.fromObject(n2, e3).then((t3) => new this(s(s({}, o2), {}, { image: t3 })));
6362
+ let { type: r2, image: n2 } = t2, o2 = i(t2, Na);
6363
+ return oa.fromObject(n2, e3).then((t3) => new this(s(s({}, o2), {}, { image: t3 })));
6340
6364
  }
6341
6365
  }
6342
- t(Va, "type", "BlendImage"), t(Va, "defaults", { mode: "multiply", alpha: 1 }), t(Va, "uniformLocations", ["uTransformMatrix", "uImage"]), tt.setClass(Va);
6343
- class za extends Ba {
6366
+ t(Ua, "type", "BlendImage"), t(Ua, "defaults", { mode: "multiply", alpha: 1 }), t(Ua, "uniformLocations", ["uTransformMatrix", "uImage"]), tt.setClass(Ua);
6367
+ class qa extends Va {
6344
6368
  getFragmentSource() {
6345
6369
  return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec2 uDelta;\n varying vec2 vTexCoord;\n const float nSamples = 15.0;\n vec3 v3offset = vec3(12.9898, 78.233, 151.7182);\n float random(vec3 scale) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n }\n void main() {\n vec4 color = vec4(0.0);\n float totalC = 0.0;\n float totalA = 0.0;\n float offset = random(v3offset);\n for (float t = -nSamples; t <= nSamples; t++) {\n float percent = (t + offset - 0.5) / nSamples;\n vec4 sample = texture2D(uTexture, vTexCoord + uDelta * percent);\n float weight = 1.0 - abs(percent);\n float alpha = weight * sample.a;\n color.rgb += sample.rgb * alpha;\n color.a += alpha;\n totalA += weight;\n totalC += alpha;\n }\n gl_FragColor.rgb = color.rgb / totalC;\n gl_FragColor.a = color.a / totalA;\n }\n ";
6346
6370
  }
6347
6371
  applyTo(t2) {
6348
- Pa(t2) ? (this.aspectRatio = t2.sourceWidth / t2.sourceHeight, t2.passes++, this._setupFrameBuffer(t2), this.horizontal = true, this.applyToWebGL(t2), this._swapTextures(t2), this._setupFrameBuffer(t2), this.horizontal = false, this.applyToWebGL(t2), this._swapTextures(t2)) : this.applyTo2d(t2);
6372
+ La(t2) ? (this.aspectRatio = t2.sourceWidth / t2.sourceHeight, t2.passes++, this._setupFrameBuffer(t2), this.horizontal = true, this.applyToWebGL(t2), this._swapTextures(t2), this._setupFrameBuffer(t2), this.horizontal = false, this.applyToWebGL(t2), this._swapTextures(t2)) : this.applyTo2d(t2);
6349
6373
  }
6350
6374
  applyTo2d(t2) {
6351
6375
  let { imageData: { data: e3, width: s2, height: i2 } } = t2;
@@ -6395,8 +6419,8 @@ class za extends Ba {
6395
6419
  return this.horizontal ? [t2, 0] : [0, t2];
6396
6420
  }
6397
6421
  }
6398
- t(za, "type", "Blur"), t(za, "defaults", { blur: 0 }), t(za, "uniformLocations", ["uDelta"]), tt.setClass(za);
6399
- class Ga extends Ba {
6422
+ t(qa, "type", "Blur"), t(qa, "defaults", { blur: 0 }), t(qa, "uniformLocations", ["uDelta"]), tt.setClass(qa);
6423
+ class Ka extends Va {
6400
6424
  getFragmentSource() {
6401
6425
  return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uBrightness;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n color.rgb += uBrightness;\n gl_FragColor = color;\n }\n";
6402
6426
  }
@@ -6412,9 +6436,9 @@ class Ga extends Ba {
6412
6436
  t2.uniform1f(e3.uBrightness, this.brightness);
6413
6437
  }
6414
6438
  }
6415
- t(Ga, "type", "Brightness"), t(Ga, "defaults", { brightness: 0 }), t(Ga, "uniformLocations", ["uBrightness"]), tt.setClass(Ga);
6416
- const Ha = { matrix: [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], colorsOnly: true };
6417
- class Na extends Ba {
6439
+ t(Ka, "type", "Brightness"), t(Ka, "defaults", { brightness: 0 }), t(Ka, "uniformLocations", ["uBrightness"]), tt.setClass(Ka);
6440
+ const Ja = { matrix: [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], colorsOnly: true };
6441
+ class Qa extends Va {
6418
6442
  getFragmentSource() {
6419
6443
  return "\n precision highp float;\n uniform sampler2D uTexture;\n varying vec2 vTexCoord;\n uniform mat4 uColorMatrix;\n uniform vec4 uConstants;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n color *= uColorMatrix;\n color += uConstants;\n gl_FragColor = color;\n }";
6420
6444
  }
@@ -6436,30 +6460,30 @@ class Na extends Ba {
6436
6460
  return s(s({}, super.toObject()), {}, { matrix: [...this.matrix] });
6437
6461
  }
6438
6462
  }
6439
- function Ua(e3, s2) {
6463
+ function Za(e3, s2) {
6440
6464
  var i2;
6441
- const r2 = (t(i2 = class extends Na {
6465
+ const r2 = (t(i2 = class extends Qa {
6442
6466
  toObject() {
6443
6467
  return { type: this.type, colorsOnly: this.colorsOnly };
6444
6468
  }
6445
6469
  }, "type", e3), t(i2, "defaults", { colorsOnly: false, matrix: s2 }), i2);
6446
6470
  return tt.setClass(r2, e3), r2;
6447
6471
  }
6448
- t(Na, "type", "ColorMatrix"), t(Na, "defaults", Ha), t(Na, "uniformLocations", ["uColorMatrix", "uConstants"]), tt.setClass(Na);
6449
- Ua("Brownie", [0.5997, 0.34553, -0.27082, 0, 0.186, -0.0377, 0.86095, 0.15059, 0, -0.1449, 0.24113, -0.07441, 0.44972, 0, -0.02965, 0, 0, 0, 1, 0]);
6450
- Ua("Vintage", [0.62793, 0.32021, -0.03965, 0, 0.03784, 0.02578, 0.64411, 0.03259, 0, 0.02926, 0.0466, -0.08512, 0.52416, 0, 0.02023, 0, 0, 0, 1, 0]);
6451
- Ua("Kodachrome", [1.12855, -0.39673, -0.03992, 0, 0.24991, -0.16404, 1.08352, -0.05498, 0, 0.09698, -0.16786, -0.56034, 1.60148, 0, 0.13972, 0, 0, 0, 1, 0]);
6452
- Ua("Technicolor", [1.91252, -0.85453, -0.09155, 0, 0.04624, -0.30878, 1.76589, -0.10601, 0, -0.27589, -0.2311, -0.75018, 1.84759, 0, 0.12137, 0, 0, 0, 1, 0]);
6453
- Ua("Polaroid", [1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016, 1.483, 0, 0, 0, 0, 0, 1, 0]);
6454
- Ua("Sepia", [0.393, 0.769, 0.189, 0, 0, 0.349, 0.686, 0.168, 0, 0, 0.272, 0.534, 0.131, 0, 0, 0, 0, 0, 1, 0]);
6455
- Ua("BlackWhite", [1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0, 1, 0]);
6456
- class eh extends Ba {
6472
+ t(Qa, "type", "ColorMatrix"), t(Qa, "defaults", Ja), t(Qa, "uniformLocations", ["uColorMatrix", "uConstants"]), tt.setClass(Qa);
6473
+ Za("Brownie", [0.5997, 0.34553, -0.27082, 0, 0.186, -0.0377, 0.86095, 0.15059, 0, -0.1449, 0.24113, -0.07441, 0.44972, 0, -0.02965, 0, 0, 0, 1, 0]);
6474
+ Za("Vintage", [0.62793, 0.32021, -0.03965, 0, 0.03784, 0.02578, 0.64411, 0.03259, 0, 0.02926, 0.0466, -0.08512, 0.52416, 0, 0.02023, 0, 0, 0, 1, 0]);
6475
+ Za("Kodachrome", [1.12855, -0.39673, -0.03992, 0, 0.24991, -0.16404, 1.08352, -0.05498, 0, 0.09698, -0.16786, -0.56034, 1.60148, 0, 0.13972, 0, 0, 0, 1, 0]);
6476
+ Za("Technicolor", [1.91252, -0.85453, -0.09155, 0, 0.04624, -0.30878, 1.76589, -0.10601, 0, -0.27589, -0.2311, -0.75018, 1.84759, 0, 0.12137, 0, 0, 0, 1, 0]);
6477
+ Za("Polaroid", [1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016, 1.483, 0, 0, 0, 0, 0, 1, 0]);
6478
+ Za("Sepia", [0.393, 0.769, 0.189, 0, 0, 0.349, 0.686, 0.168, 0, 0, 0.272, 0.534, 0.131, 0, 0, 0, 0, 0, 1, 0]);
6479
+ Za("BlackWhite", [1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 1.5, 1.5, 1.5, 0, -1, 0, 0, 0, 1, 0]);
6480
+ class oh extends Va {
6457
6481
  constructor() {
6458
6482
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
6459
6483
  super(t2), this.subFilters = t2.subFilters || [];
6460
6484
  }
6461
6485
  applyTo(t2) {
6462
- Pa(t2) && (t2.passes += this.subFilters.length - 1), this.subFilters.forEach((e3) => {
6486
+ La(t2) && (t2.passes += this.subFilters.length - 1), this.subFilters.forEach((e3) => {
6463
6487
  e3.applyTo(t2);
6464
6488
  });
6465
6489
  }
@@ -6473,8 +6497,8 @@ class eh extends Ba {
6473
6497
  return Promise.all((t2.subFilters || []).map((t3) => tt.getClass(t3.type).fromObject(t3, e3))).then((t3) => new this({ subFilters: t3 }));
6474
6498
  }
6475
6499
  }
6476
- t(eh, "type", "Composed"), tt.setClass(eh);
6477
- class sh extends Ba {
6500
+ t(oh, "type", "Composed"), tt.setClass(oh);
6501
+ class ah extends Va {
6478
6502
  getFragmentSource() {
6479
6503
  return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uContrast;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\n color.rgb = contrastF * (color.rgb - 0.5) + 0.5;\n gl_FragColor = color;\n }";
6480
6504
  }
@@ -6490,14 +6514,14 @@ class sh extends Ba {
6490
6514
  t2.uniform1f(e3.uContrast, this.contrast);
6491
6515
  }
6492
6516
  }
6493
- t(sh, "type", "Contrast"), t(sh, "defaults", { contrast: 0 }), t(sh, "uniformLocations", ["uContrast"]), tt.setClass(sh);
6494
- const ih = { Convolute_3_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[9];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 3.0; h+=1.0) {\n for (float w = 0.0; w < 3.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_3_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[9];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 3.0; h+=1.0) {\n for (float w = 0.0; w < 3.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n ", Convolute_5_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[25];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 5.0; h+=1.0) {\n for (float w = 0.0; w < 5.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_5_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[25];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 5.0; h+=1.0) {\n for (float w = 0.0; w < 5.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n ", Convolute_7_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[49];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 7.0; h+=1.0) {\n for (float w = 0.0; w < 7.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_7_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[49];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 7.0; h+=1.0) {\n for (float w = 0.0; w < 7.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n ", Convolute_9_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[81];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 9.0; h+=1.0) {\n for (float w = 0.0; w < 9.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_9_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[81];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 9.0; h+=1.0) {\n for (float w = 0.0; w < 9.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n " };
6495
- class rh extends Ba {
6517
+ t(ah, "type", "Contrast"), t(ah, "defaults", { contrast: 0 }), t(ah, "uniformLocations", ["uContrast"]), tt.setClass(ah);
6518
+ const hh = { Convolute_3_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[9];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 3.0; h+=1.0) {\n for (float w = 0.0; w < 3.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_3_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[9];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 3.0; h+=1.0) {\n for (float w = 0.0; w < 3.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n ", Convolute_5_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[25];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 5.0; h+=1.0) {\n for (float w = 0.0; w < 5.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_5_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[25];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 5.0; h+=1.0) {\n for (float w = 0.0; w < 5.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n ", Convolute_7_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[49];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 7.0; h+=1.0) {\n for (float w = 0.0; w < 7.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_7_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[49];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 7.0; h+=1.0) {\n for (float w = 0.0; w < 7.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n ", Convolute_9_1: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[81];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 0);\n for (float h = 0.0; h < 9.0; h+=1.0) {\n for (float w = 0.0; w < 9.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\n color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n }\n }\n gl_FragColor = color;\n }\n ", Convolute_9_0: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uMatrix[81];\n uniform float uStepW;\n uniform float uStepH;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = vec4(0, 0, 0, 1);\n for (float h = 0.0; h < 9.0; h+=1.0) {\n for (float w = 0.0; w < 9.0; w+=1.0) {\n vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\n color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n }\n }\n float alpha = texture2D(uTexture, vTexCoord).a;\n gl_FragColor = color;\n gl_FragColor.a = alpha;\n }\n " };
6519
+ class ch extends Va {
6496
6520
  getCacheKey() {
6497
6521
  return "".concat(this.type, "_").concat(Math.sqrt(this.matrix.length), "_").concat(this.opaque ? 1 : 0);
6498
6522
  }
6499
6523
  getFragmentSource() {
6500
- return ih[this.getCacheKey()];
6524
+ return hh[this.getCacheKey()];
6501
6525
  }
6502
6526
  applyTo2d(t2) {
6503
6527
  const e3 = t2.imageData, s2 = e3.data, i2 = this.matrix, r2 = Math.round(Math.sqrt(i2.length)), n2 = Math.floor(r2 / 2), o2 = e3.width, a2 = e3.height, h2 = t2.ctx.createImageData(o2, a2), c2 = h2.data, l2 = this.opaque ? 1 : 0;
@@ -6515,9 +6539,9 @@ class rh extends Ba {
6515
6539
  return s(s({}, super.toObject()), {}, { opaque: this.opaque, matrix: [...this.matrix] });
6516
6540
  }
6517
6541
  }
6518
- t(rh, "type", "Convolute"), t(rh, "defaults", { opaque: false, matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0] }), t(rh, "uniformLocations", ["uMatrix", "uOpaque", "uHalfSize", "uSize"]), tt.setClass(rh);
6519
- const nh = "Gamma";
6520
- class oh extends Ba {
6542
+ t(ch, "type", "Convolute"), t(ch, "defaults", { opaque: false, matrix: [0, 0, 0, 0, 1, 0, 0, 0, 0] }), t(ch, "uniformLocations", ["uMatrix", "uOpaque", "uHalfSize", "uSize"]), tt.setClass(ch);
6543
+ const lh = "Gamma";
6544
+ class uh extends Va {
6521
6545
  getFragmentSource() {
6522
6546
  return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform vec3 uGamma;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n vec3 correction = (1.0 / uGamma);\n color.r = pow(color.r, correction.r);\n color.g = pow(color.g, correction.g);\n color.b = pow(color.b, correction.b);\n gl_FragColor = color;\n gl_FragColor.rgb *= color.a;\n }\n";
6523
6547
  }
@@ -6541,12 +6565,12 @@ class oh extends Ba {
6541
6565
  return 1 === t2[0] && 1 === t2[1] && 1 === t2[2];
6542
6566
  }
6543
6567
  toObject() {
6544
- return { type: nh, gamma: this.gamma.concat() };
6568
+ return { type: lh, gamma: this.gamma.concat() };
6545
6569
  }
6546
6570
  }
6547
- t(oh, "type", nh), t(oh, "defaults", { gamma: [1, 1, 1] }), t(oh, "uniformLocations", ["uGamma"]), tt.setClass(oh);
6548
- const ah = { average: "\n precision highp float;\n uniform sampler2D uTexture;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float average = (color.r + color.b + color.g) / 3.0;\n gl_FragColor = vec4(average, average, average, color.a);\n }\n ", lightness: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n ", luminosity: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n " };
6549
- class hh extends Ba {
6571
+ t(uh, "type", lh), t(uh, "defaults", { gamma: [1, 1, 1] }), t(uh, "uniformLocations", ["uGamma"]), tt.setClass(uh);
6572
+ const dh = { average: "\n precision highp float;\n uniform sampler2D uTexture;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float average = (color.r + color.b + color.g) / 3.0;\n gl_FragColor = vec4(average, average, average, color.a);\n }\n ", lightness: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n ", luminosity: "\n precision highp float;\n uniform sampler2D uTexture;\n uniform int uMode;\n varying vec2 vTexCoord;\n void main() {\n vec4 col = texture2D(uTexture, vTexCoord);\n float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\n gl_FragColor = vec4(average, average, average, col.a);\n }\n " };
6573
+ class gh extends Va {
6550
6574
  applyTo2d(t2) {
6551
6575
  let { imageData: { data: e3 } } = t2;
6552
6576
  for (let t3, s2 = 0; s2 < e3.length; s2 += 4) {
@@ -6568,7 +6592,7 @@ class hh extends Ba {
6568
6592
  return "".concat(this.type, "_").concat(this.mode);
6569
6593
  }
6570
6594
  getFragmentSource() {
6571
- return ah[this.mode];
6595
+ return dh[this.mode];
6572
6596
  }
6573
6597
  sendUniformData(t2, e3) {
6574
6598
  t2.uniform1i(e3.uMode, 1);
@@ -6577,9 +6601,9 @@ class hh extends Ba {
6577
6601
  return false;
6578
6602
  }
6579
6603
  }
6580
- t(hh, "type", "Grayscale"), t(hh, "defaults", { mode: "average" }), t(hh, "uniformLocations", ["uMode"]), tt.setClass(hh);
6581
- const ch = s(s({}, Ha), {}, { rotation: 0 });
6582
- class lh extends Na {
6604
+ t(gh, "type", "Grayscale"), t(gh, "defaults", { mode: "average" }), t(gh, "uniformLocations", ["uMode"]), tt.setClass(gh);
6605
+ const fh = s(s({}, Ja), {}, { rotation: 0 });
6606
+ class ph extends Qa {
6583
6607
  calculateMatrix() {
6584
6608
  const t2 = this.rotation * Math.PI, e3 = rt(t2), s2 = nt(t2), i2 = 1 / 3, r2 = Math.sqrt(i2) * s2, n2 = 1 - e3;
6585
6609
  this.matrix = [e3 + n2 / 3, i2 * n2 - r2, i2 * n2 + r2, 0, 0, i2 * n2 + r2, e3 + i2 * n2, i2 * n2 - r2, 0, 0, i2 * n2 - r2, i2 * n2 + r2, e3 + i2 * n2, 0, 0, 0, 0, 0, 1, 0];
@@ -6594,8 +6618,8 @@ class lh extends Na {
6594
6618
  return { type: this.type, rotation: this.rotation };
6595
6619
  }
6596
6620
  }
6597
- t(lh, "type", "HueRotation"), t(lh, "defaults", ch), tt.setClass(lh);
6598
- class uh extends Ba {
6621
+ t(ph, "type", "HueRotation"), t(ph, "defaults", fh), tt.setClass(ph);
6622
+ class mh extends Va {
6599
6623
  applyTo2d(t2) {
6600
6624
  let { imageData: { data: e3 } } = t2;
6601
6625
  for (let t3 = 0; t3 < e3.length; t3 += 4) e3[t3] = 255 - e3[t3], e3[t3 + 1] = 255 - e3[t3 + 1], e3[t3 + 2] = 255 - e3[t3 + 2], this.alpha && (e3[t3 + 3] = 255 - e3[t3 + 3]);
@@ -6610,8 +6634,8 @@ class uh extends Ba {
6610
6634
  t2.uniform1i(e3.uInvert, Number(this.invert)), t2.uniform1i(e3.uAlpha, Number(this.alpha));
6611
6635
  }
6612
6636
  }
6613
- t(uh, "type", "Invert"), t(uh, "defaults", { alpha: false, invert: true }), t(uh, "uniformLocations", ["uInvert", "uAlpha"]), tt.setClass(uh);
6614
- class dh extends Ba {
6637
+ t(mh, "type", "Invert"), t(mh, "defaults", { alpha: false, invert: true }), t(mh, "uniformLocations", ["uInvert", "uAlpha"]), tt.setClass(mh);
6638
+ let vh$1 = class vh extends Va {
6615
6639
  getFragmentSource() {
6616
6640
  return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uStepH;\n uniform float uNoise;\n uniform float uSeed;\n varying vec2 vTexCoord;\n float rand(vec2 co, float seed, float vScale) {\n return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n }\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\n gl_FragColor = color;\n }\n";
6617
6641
  }
@@ -6629,9 +6653,9 @@ class dh extends Ba {
6629
6653
  isNeutralState() {
6630
6654
  return 0 === this.noise;
6631
6655
  }
6632
- }
6633
- t(dh, "type", "Noise"), t(dh, "defaults", { noise: 0 }), t(dh, "uniformLocations", ["uNoise", "uSeed"]), tt.setClass(dh);
6634
- class gh extends Ba {
6656
+ };
6657
+ t(vh$1, "type", "Noise"), t(vh$1, "defaults", { noise: 0 }), t(vh$1, "uniformLocations", ["uNoise", "uSeed"]), tt.setClass(vh$1);
6658
+ class yh extends Va {
6635
6659
  applyTo2d(t2) {
6636
6660
  let { imageData: { data: e3, width: s2, height: i2 } } = t2;
6637
6661
  for (let t3 = 0; t3 < i2; t3 += this.blocksize) for (let r2 = 0; r2 < s2; r2 += this.blocksize) {
@@ -6652,26 +6676,26 @@ class gh extends Ba {
6652
6676
  t2.uniform1f(e3.uBlocksize, this.blocksize);
6653
6677
  }
6654
6678
  }
6655
- t(gh, "type", "Pixelate"), t(gh, "defaults", { blocksize: 4 }), t(gh, "uniformLocations", ["uBlocksize"]), tt.setClass(gh);
6656
- class fh extends Ba {
6679
+ t(yh, "type", "Pixelate"), t(yh, "defaults", { blocksize: 4 }), t(yh, "uniformLocations", ["uBlocksize"]), tt.setClass(yh);
6680
+ class _h extends Va {
6657
6681
  getFragmentSource() {
6658
6682
  return "\nprecision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\n gl_FragColor = texture2D(uTexture, vTexCoord);\n if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\n gl_FragColor.a = 0.0;\n }\n}\n";
6659
6683
  }
6660
6684
  applyTo2d(t2) {
6661
6685
  let { imageData: { data: e3 } } = t2;
6662
- const s2 = 255 * this.distance, i2 = new Le(this.color).getSource(), r2 = [i2[0] - s2, i2[1] - s2, i2[2] - s2], n2 = [i2[0] + s2, i2[1] + s2, i2[2] + s2];
6686
+ const s2 = 255 * this.distance, i2 = new Ie(this.color).getSource(), r2 = [i2[0] - s2, i2[1] - s2, i2[2] - s2], n2 = [i2[0] + s2, i2[1] + s2, i2[2] + s2];
6663
6687
  for (let t3 = 0; t3 < e3.length; t3 += 4) {
6664
6688
  const s3 = e3[t3], i3 = e3[t3 + 1], o2 = e3[t3 + 2];
6665
6689
  s3 > r2[0] && i3 > r2[1] && o2 > r2[2] && s3 < n2[0] && i3 < n2[1] && o2 < n2[2] && (e3[t3 + 3] = 0);
6666
6690
  }
6667
6691
  }
6668
6692
  sendUniformData(t2, e3) {
6669
- const s2 = new Le(this.color).getSource(), i2 = this.distance, r2 = [0 + s2[0] / 255 - i2, 0 + s2[1] / 255 - i2, 0 + s2[2] / 255 - i2, 1], n2 = [s2[0] / 255 + i2, s2[1] / 255 + i2, s2[2] / 255 + i2, 1];
6693
+ const s2 = new Ie(this.color).getSource(), i2 = this.distance, r2 = [0 + s2[0] / 255 - i2, 0 + s2[1] / 255 - i2, 0 + s2[2] / 255 - i2, 1], n2 = [s2[0] / 255 + i2, s2[1] / 255 + i2, s2[2] / 255 + i2, 1];
6670
6694
  t2.uniform4fv(e3.uLow, r2), t2.uniform4fv(e3.uHigh, n2);
6671
6695
  }
6672
6696
  }
6673
- t(fh, "type", "RemoveColor"), t(fh, "defaults", { color: "#FFFFFF", distance: 0.02, useAlpha: false }), t(fh, "uniformLocations", ["uLow", "uHigh"]), tt.setClass(fh);
6674
- class ph extends Ba {
6697
+ t(_h, "type", "RemoveColor"), t(_h, "defaults", { color: "#FFFFFF", distance: 0.02, useAlpha: false }), t(_h, "uniformLocations", ["uLow", "uHigh"]), tt.setClass(_h);
6698
+ class xh extends Va {
6675
6699
  sendUniformData(t2, e3) {
6676
6700
  t2.uniform2fv(e3.uDelta, this.horizontal ? [1 / this.width, 0] : [0, 1 / this.height]), t2.uniform1fv(e3.uTaps, this.taps);
6677
6701
  }
@@ -6701,7 +6725,7 @@ class ph extends Ba {
6701
6725
  t2.passes++, this.width = t2.sourceWidth, this.horizontal = true, this.dW = Math.round(this.width * this.scaleX), this.dH = t2.sourceHeight, this.tempScale = this.dW / this.width, this.taps = this.getTaps(), t2.destinationWidth = this.dW, super.applyTo(t2), t2.sourceWidth = t2.destinationWidth, this.height = t2.sourceHeight, this.horizontal = false, this.dH = Math.round(this.height * this.scaleY), this.tempScale = this.dH / this.height, this.taps = this.getTaps(), t2.destinationHeight = this.dH, super.applyTo(t2), t2.sourceHeight = t2.destinationHeight;
6702
6726
  }
6703
6727
  applyTo(t2) {
6704
- Pa(t2) ? this.applyToForWebgl(t2) : this.applyTo2d(t2);
6728
+ La(t2) ? this.applyToForWebgl(t2) : this.applyTo2d(t2);
6705
6729
  }
6706
6730
  isNeutralState() {
6707
6731
  return 1 === this.scaleX && 1 === this.scaleY;
@@ -6774,8 +6798,8 @@ class ph extends Ba {
6774
6798
  return l2;
6775
6799
  }
6776
6800
  }
6777
- t(ph, "type", "Resize"), t(ph, "defaults", { resizeType: "hermite", scaleX: 1, scaleY: 1, lanczosLobes: 3 }), t(ph, "uniformLocations", ["uDelta", "uTaps"]), tt.setClass(ph);
6778
- class mh extends Ba {
6801
+ t(xh, "type", "Resize"), t(xh, "defaults", { resizeType: "hermite", scaleX: 1, scaleY: 1, lanczosLobes: 3 }), t(xh, "uniformLocations", ["uDelta", "uTaps"]), tt.setClass(xh);
6802
+ class Ch extends Va {
6779
6803
  getFragmentSource() {
6780
6804
  return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uSaturation;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float rgMax = max(color.r, color.g);\n float rgbMax = max(rgMax, color.b);\n color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\n color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\n color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\n gl_FragColor = color;\n }\n";
6781
6805
  }
@@ -6794,8 +6818,8 @@ class mh extends Ba {
6794
6818
  return 0 === this.saturation;
6795
6819
  }
6796
6820
  }
6797
- t(mh, "type", "Saturation"), t(mh, "defaults", { saturation: 0 }), t(mh, "uniformLocations", ["uSaturation"]), tt.setClass(mh);
6798
- let vh$1 = class vh extends Ba {
6821
+ t(Ch, "type", "Saturation"), t(Ch, "defaults", { saturation: 0 }), t(Ch, "uniformLocations", ["uSaturation"]), tt.setClass(Ch);
6822
+ class bh extends Va {
6799
6823
  getFragmentSource() {
6800
6824
  return "\n precision highp float;\n uniform sampler2D uTexture;\n uniform float uVibrance;\n varying vec2 vTexCoord;\n void main() {\n vec4 color = texture2D(uTexture, vTexCoord);\n float max = max(color.r, max(color.g, color.b));\n float avg = (color.r + color.g + color.b) / 3.0;\n float amt = (abs(max - avg) * 2.0) * uVibrance;\n color.r += max != color.r ? (max - color.r) * amt : 0.00;\n color.g += max != color.g ? (max - color.g) * amt : 0.00;\n color.b += max != color.b ? (max - color.b) * amt : 0.00;\n gl_FragColor = color;\n }\n";
6801
6825
  }
@@ -6813,8 +6837,8 @@ let vh$1 = class vh extends Ba {
6813
6837
  isNeutralState() {
6814
6838
  return 0 === this.vibrance;
6815
6839
  }
6816
- };
6817
- t(vh$1, "type", "Vibrance"), t(vh$1, "defaults", { vibrance: 0 }), t(vh$1, "uniformLocations", ["uVibrance"]), tt.setClass(vh$1);
6840
+ }
6841
+ t(bh, "type", "Vibrance"), t(bh, "defaults", { vibrance: 0 }), t(bh, "uniformLocations", ["uVibrance"]), tt.setClass(bh);
6818
6842
  const DEFAULT_TEXT_PROPS = {
6819
6843
  /** Font family for text elements */
6820
6844
  family: "Poppins",
@@ -6901,7 +6925,7 @@ const createCanvas = ({
6901
6925
  scaleX: Number((canvasSize.width / videoSize.width).toFixed(2)),
6902
6926
  scaleY: Number((canvasSize.height / videoSize.height).toFixed(2))
6903
6927
  };
6904
- const canvas = new Sn(canvasRef, {
6928
+ const canvas = new Xn(canvasRef, {
6905
6929
  backgroundColor,
6906
6930
  width: canvasSize.width,
6907
6931
  height: canvasSize.height,
@@ -6941,8 +6965,8 @@ const reorderElementsByZIndex = (canvas) => {
6941
6965
  canvas.renderAll();
6942
6966
  };
6943
6967
  const getCanvasContext = (canvas) => {
6944
- var _a2, _b, _c, _d;
6945
- if (!canvas || !((_b = (_a2 = canvas.elements) == null ? void 0 : _a2.lower) == null ? void 0 : _b.ctx)) return;
6968
+ var _a, _b, _c, _d;
6969
+ if (!canvas || !((_b = (_a = canvas.elements) == null ? void 0 : _a.lower) == null ? void 0 : _b.ctx)) return;
6946
6970
  return (_d = (_c = canvas.elements) == null ? void 0 : _c.lower) == null ? void 0 : _d.ctx;
6947
6971
  };
6948
6972
  const clearCanvas = (canvas) => {
@@ -6967,9 +6991,9 @@ const convertToVideoPosition = (x2, y2, canvasMetadata, videoSize) => {
6967
6991
  };
6968
6992
  };
6969
6993
  const getCurrentFrameEffect = (item, seekTime) => {
6970
- var _a2;
6994
+ var _a;
6971
6995
  let currentFrameEffect;
6972
- for (let i2 = 0; i2 < ((_a2 = item == null ? void 0 : item.frameEffects) == null ? void 0 : _a2.length); i2++) {
6996
+ for (let i2 = 0; i2 < ((_a = item == null ? void 0 : item.frameEffects) == null ? void 0 : _a.length); i2++) {
6973
6997
  if (item.frameEffects[i2].s <= seekTime && item.frameEffects[i2].e >= seekTime) {
6974
6998
  currentFrameEffect = item.frameEffects[i2];
6975
6999
  break;
@@ -6977,7 +7001,7 @@ const getCurrentFrameEffect = (item, seekTime) => {
6977
7001
  }
6978
7002
  return currentFrameEffect;
6979
7003
  };
6980
- const disabledControl = new Hs({
7004
+ const disabledControl = new ai({
6981
7005
  /** X position offset */
6982
7006
  x: 0,
6983
7007
  /** Y position offset */
@@ -7002,7 +7026,7 @@ const disabledControl = new Hs({
7002
7026
  ctx.restore();
7003
7027
  }
7004
7028
  });
7005
- const rotateControl = new Hs({
7029
+ const rotateControl = new ai({
7006
7030
  /** X position offset */
7007
7031
  x: 0,
7008
7032
  /** Y position offset */
@@ -7012,7 +7036,7 @@ const rotateControl = new Hs({
7012
7036
  /** Cursor style when hovering */
7013
7037
  cursorStyle: "crosshair",
7014
7038
  /** Action handler with rotation and snapping */
7015
- actionHandler: Ma.rotationWithSnapping,
7039
+ actionHandler: Fa.rotationWithSnapping,
7016
7040
  /** Name of the action */
7017
7041
  actionName: "rotate",
7018
7042
  /** Whether to show connection line */
@@ -7041,9 +7065,9 @@ const getThumbnail = async (videoUrl, seekTime = 0.1, playbackRate = 1) => {
7041
7065
  if (timeoutId) clearTimeout(timeoutId);
7042
7066
  };
7043
7067
  const handleError = () => {
7044
- var _a2;
7068
+ var _a;
7045
7069
  cleanup();
7046
- reject(new Error(`Failed to load video: ${((_a2 = video.error) == null ? void 0 : _a2.message) || "Unknown error"}`));
7070
+ reject(new Error(`Failed to load video: ${((_a = video.error) == null ? void 0 : _a.message) || "Unknown error"}`));
7047
7071
  };
7048
7072
  const handleSeeked = () => {
7049
7073
  try {
@@ -7149,9 +7173,9 @@ const addTextElement = ({
7149
7173
  canvas,
7150
7174
  canvasMetadata
7151
7175
  }) => {
7152
- var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y;
7176
+ var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y;
7153
7177
  const { x: x2, y: y2 } = convertToCanvasPosition(
7154
- ((_a2 = element.props) == null ? void 0 : _a2.x) || 0,
7178
+ ((_a = element.props) == null ? void 0 : _a.x) || 0,
7155
7179
  ((_b = element.props) == null ? void 0 : _b.y) || 0,
7156
7180
  canvasMetadata
7157
7181
  );
@@ -7159,7 +7183,7 @@ const addTextElement = ({
7159
7183
  if ((_d = element.props) == null ? void 0 : _d.maxWidth) {
7160
7184
  width = Math.min(width, element.props.maxWidth * canvasMetadata.scaleX);
7161
7185
  }
7162
- const text = new Vo(((_e2 = element.props) == null ? void 0 : _e2.text) || element.t || "", {
7186
+ const text = new Uo(((_e2 = element.props) == null ? void 0 : _e2.text) || element.t || "", {
7163
7187
  left: x2,
7164
7188
  top: y2,
7165
7189
  originX: "center",
@@ -7168,7 +7192,7 @@ const addTextElement = ({
7168
7192
  fontSize: Math.floor(
7169
7193
  (((_g = element.props) == null ? void 0 : _g.fontSize) || DEFAULT_TEXT_PROPS.size) * canvasMetadata.scaleX
7170
7194
  ),
7171
- fontFamily: ((_h = element.props) == null ? void 0 : _h.fontFamily) || DEFAULT_TEXT_PROPS.family,
7195
+ fontFamily: ((_h2 = element.props) == null ? void 0 : _h2.fontFamily) || DEFAULT_TEXT_PROPS.family,
7172
7196
  fontStyle: ((_i2 = element.props) == null ? void 0 : _i2.fontStyle) || "normal",
7173
7197
  fontWeight: ((_j = element.props) == null ? void 0 : _j.fontWeight) || "normal",
7174
7198
  fill: ((_k = element.props) == null ? void 0 : _k.fill) || DEFAULT_TEXT_PROPS.fill,
@@ -7178,7 +7202,7 @@ const addTextElement = ({
7178
7202
  textAlign: ((_m = element.props) == null ? void 0 : _m.textAlign) || "center",
7179
7203
  stroke: ((_n2 = element.props) == null ? void 0 : _n2.stroke) || DEFAULT_TEXT_PROPS.stroke,
7180
7204
  strokeWidth: ((_o2 = element.props) == null ? void 0 : _o2.lineWidth) || DEFAULT_TEXT_PROPS.lineWidth,
7181
- shadow: ((_p = element.props) == null ? void 0 : _p.shadowColor) ? new ds({
7205
+ shadow: ((_p = element.props) == null ? void 0 : _p.shadowColor) ? new Ds({
7182
7206
  offsetX: ((_r2 = (_q = element.props) == null ? void 0 : _q.shadowOffset) == null ? void 0 : _r2.length) && ((_t2 = (_s2 = element.props) == null ? void 0 : _s2.shadowOffset) == null ? void 0 : _t2.length) > 1 ? element.props.shadowOffset[0] / 2 : 1,
7183
7207
  offsetY: ((_v = (_u = element.props) == null ? void 0 : _u.shadowOffset) == null ? void 0 : _v.length) && ((_w = element.props) == null ? void 0 : _w.shadowOffset.length) > 1 ? element.props.shadowOffset[1] / 2 : 1,
7184
7208
  blur: (((_x = element.props) == null ? void 0 : _x.shadowBlur) || 2) / 2,
@@ -7205,8 +7229,8 @@ const setImageProps = ({
7205
7229
  index,
7206
7230
  canvasMetadata
7207
7231
  }) => {
7208
- var _a2, _b, _c, _d, _e2;
7209
- const width = (((_a2 = element.props) == null ? void 0 : _a2.width) || 0) * canvasMetadata.scaleX || canvasMetadata.width;
7232
+ var _a, _b, _c, _d, _e2;
7233
+ const width = (((_a = element.props) == null ? void 0 : _a.width) || 0) * canvasMetadata.scaleX || canvasMetadata.width;
7210
7234
  const height = (((_b = element.props) == null ? void 0 : _b.height) || 0) * canvasMetadata.scaleY || canvasMetadata.height;
7211
7235
  const { x: x2, y: y2 } = convertToCanvasPosition(
7212
7236
  ((_c = element.props) == null ? void 0 : _c.x) || 0,
@@ -7232,27 +7256,27 @@ const addCaptionElement = ({
7232
7256
  captionProps,
7233
7257
  canvasMetadata
7234
7258
  }) => {
7235
- var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
7259
+ var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k, _l, _m, _n2, _o2, _p, _q, _r2, _s2, _t2, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
7236
7260
  const { x: x2, y: y2 } = convertToCanvasPosition(
7237
- ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.x : (_a2 = element.props) == null ? void 0 : _a2.x) ?? 0,
7261
+ ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.x : (_a = element.props) == null ? void 0 : _a.x) ?? 0,
7238
7262
  ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.y : (_b = element.props) == null ? void 0 : _b.y) ?? 0,
7239
7263
  canvasMetadata
7240
7264
  );
7241
- const caption = new ko(((_c = element.props) == null ? void 0 : _c.text) || element.t || "", {
7265
+ const caption = new Ao(((_c = element.props) == null ? void 0 : _c.text) || element.t || "", {
7242
7266
  left: x2,
7243
7267
  top: y2,
7244
7268
  originX: "center",
7245
7269
  originY: "center",
7246
7270
  angle: ((_d = element.props) == null ? void 0 : _d.rotation) || 0,
7247
7271
  fontSize: Math.round(
7248
- (((captionProps == null ? void 0 : captionProps.applyToAll) ? (_e2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _e2.size : ((_g = (_f = element.props) == null ? void 0 : _f.font) == null ? void 0 : _g.size) ?? ((_h = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _h.size)) ?? DEFAULT_CAPTION_PROPS.size) * canvasMetadata.scaleX
7272
+ (((captionProps == null ? void 0 : captionProps.applyToAll) ? (_e2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _e2.size : ((_g = (_f = element.props) == null ? void 0 : _f.font) == null ? void 0 : _g.size) ?? ((_h2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _h2.size)) ?? DEFAULT_CAPTION_PROPS.size) * canvasMetadata.scaleX
7249
7273
  ),
7250
7274
  fontFamily: ((captionProps == null ? void 0 : captionProps.applyToAll) ? (_i2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _i2.family : ((_k = (_j = element.props) == null ? void 0 : _j.font) == null ? void 0 : _k.family) ?? ((_l = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _l.family)) ?? DEFAULT_CAPTION_PROPS.family,
7251
7275
  fill: ((captionProps == null ? void 0 : captionProps.applyToAll) ? (_m = captionProps.color) == null ? void 0 : _m.text : ((_n2 = element.props) == null ? void 0 : _n2.fill) ?? ((_o2 = captionProps.color) == null ? void 0 : _o2.text)) ?? DEFAULT_CAPTION_PROPS.fill,
7252
7276
  fontWeight: ((captionProps == null ? void 0 : captionProps.applyToAll) ? (_p = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _p.weight : ((_q = element.props) == null ? void 0 : _q.fontWeight) ?? ((_r2 = captionProps == null ? void 0 : captionProps.font) == null ? void 0 : _r2.weight)) ?? DEFAULT_CAPTION_PROPS.fontWeight,
7253
7277
  stroke: ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.stroke : ((_s2 = element.props) == null ? void 0 : _s2.stroke) ?? (captionProps == null ? void 0 : captionProps.stroke)) ?? DEFAULT_CAPTION_PROPS.stroke,
7254
7278
  opacity: ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.opacity : ((_t2 = element.props) == null ? void 0 : _t2.opacity) ?? (captionProps == null ? void 0 : captionProps.opacity)) ?? 1,
7255
- shadow: new ds({
7279
+ shadow: new Ds({
7256
7280
  offsetX: ((captionProps == null ? void 0 : captionProps.applyToAll) ? (_u = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _u[0] : ((_w = (_v = element.props) == null ? void 0 : _v.shadowOffset) == null ? void 0 : _w[0]) ?? ((_x = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _x[0])) ?? ((_y = DEFAULT_CAPTION_PROPS.shadowOffset) == null ? void 0 : _y[0]),
7257
7281
  offsetY: ((captionProps == null ? void 0 : captionProps.applyToAll) ? (_z = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _z[1] : ((_B = (_A = element.props) == null ? void 0 : _A.shadowOffset) == null ? void 0 : _B[1]) ?? ((_C = captionProps == null ? void 0 : captionProps.shadowOffset) == null ? void 0 : _C[1])) ?? ((_D = DEFAULT_CAPTION_PROPS.shadowOffset) == null ? void 0 : _D[1]),
7258
7282
  blur: ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.shadowBlur : ((_E = element.props) == null ? void 0 : _E.shadowBlur) ?? (captionProps == null ? void 0 : captionProps.shadowBlur)) ?? DEFAULT_CAPTION_PROPS.shadowBlur,
@@ -7282,10 +7306,10 @@ const addVideoElement = async ({
7282
7306
  canvasMetadata,
7283
7307
  currentFrameEffect
7284
7308
  }) => {
7285
- var _a2;
7309
+ var _a;
7286
7310
  try {
7287
7311
  const thumbnailUrl = await getThumbnail(
7288
- ((_a2 = element == null ? void 0 : element.props) == null ? void 0 : _a2.src) || "",
7312
+ ((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.src) || "",
7289
7313
  snapTime
7290
7314
  );
7291
7315
  if (!thumbnailUrl) {
@@ -7313,7 +7337,7 @@ const addImageElement = async ({
7313
7337
  currentFrameEffect
7314
7338
  }) => {
7315
7339
  try {
7316
- const img = await ea.fromURL(imageUrl || element.props.src || "");
7340
+ const img = await oa.fromURL(imageUrl || element.props.src || "");
7317
7341
  img.set({
7318
7342
  originX: "center",
7319
7343
  originY: "center",
@@ -7349,14 +7373,14 @@ const addMediaGroup = ({
7349
7373
  canvasMetadata,
7350
7374
  currentFrameEffect
7351
7375
  }) => {
7352
- var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2;
7376
+ var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k, _l, _m, _n2;
7353
7377
  let frameSize;
7354
7378
  let angle;
7355
7379
  let framePosition;
7356
7380
  let frameRadius = 0;
7357
7381
  if (currentFrameEffect) {
7358
7382
  frameSize = {
7359
- width: (((_a2 = currentFrameEffect.props.frameSize) == null ? void 0 : _a2[0]) || 0) * canvasMetadata.scaleX || canvasMetadata.width,
7383
+ width: (((_a = currentFrameEffect.props.frameSize) == null ? void 0 : _a[0]) || 0) * canvasMetadata.scaleX || canvasMetadata.width,
7360
7384
  height: (((_b = currentFrameEffect.props.frameSize) == null ? void 0 : _b[1]) || 0) * canvasMetadata.scaleY || canvasMetadata.height
7361
7385
  };
7362
7386
  angle = currentFrameEffect.props.rotation || 0;
@@ -7370,7 +7394,7 @@ const addMediaGroup = ({
7370
7394
  frameRadius = ((_d = element == null ? void 0 : element.frame) == null ? void 0 : _d.radius) || 0;
7371
7395
  frameSize = {
7372
7396
  width: (((_f = (_e2 = element == null ? void 0 : element.frame) == null ? void 0 : _e2.size) == null ? void 0 : _f[0]) || 0) * canvasMetadata.scaleX || canvasMetadata.width,
7373
- height: (((_h = (_g = element == null ? void 0 : element.frame) == null ? void 0 : _g.size) == null ? void 0 : _h[1]) || 0) * canvasMetadata.scaleY || canvasMetadata.height
7397
+ height: (((_h2 = (_g = element == null ? void 0 : element.frame) == null ? void 0 : _g.size) == null ? void 0 : _h2[1]) || 0) * canvasMetadata.scaleY || canvasMetadata.height
7374
7398
  };
7375
7399
  angle = ((_i2 = element == null ? void 0 : element.frame) == null ? void 0 : _i2.rotation) || 0;
7376
7400
  framePosition = {
@@ -7383,7 +7407,7 @@ const addMediaGroup = ({
7383
7407
  { width: img.width, height: img.height },
7384
7408
  frameSize
7385
7409
  );
7386
- const frameRect = new vr({
7410
+ const frameRect = new jr({
7387
7411
  originX: "center",
7388
7412
  originY: "center",
7389
7413
  lockMovementX: false,
@@ -7419,7 +7443,7 @@ const addMediaGroup = ({
7419
7443
  height: frameSize.height,
7420
7444
  angle
7421
7445
  };
7422
- const group = new Er([frameRect, img], {
7446
+ const group = new Ur([frameRect, img], {
7423
7447
  ...groupProps,
7424
7448
  originX: "center",
7425
7449
  originY: "center",
@@ -7445,13 +7469,13 @@ const addRectElement = ({
7445
7469
  canvas,
7446
7470
  canvasMetadata
7447
7471
  }) => {
7448
- var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
7472
+ var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k;
7449
7473
  const { x: x2, y: y2 } = convertToCanvasPosition(
7450
- ((_a2 = element.props) == null ? void 0 : _a2.x) || 0,
7474
+ ((_a = element.props) == null ? void 0 : _a.x) || 0,
7451
7475
  ((_b = element.props) == null ? void 0 : _b.y) || 0,
7452
7476
  canvasMetadata
7453
7477
  );
7454
- const rect = new vr({
7478
+ const rect = new jr({
7455
7479
  left: x2,
7456
7480
  // X-coordinate on the canvas
7457
7481
  top: y2,
@@ -7470,7 +7494,7 @@ const addRectElement = ({
7470
7494
  // Stroke color
7471
7495
  strokeWidth: (((_g = element.props) == null ? void 0 : _g.lineWidth) || 0) * canvasMetadata.scaleX,
7472
7496
  // Scaled stroke width
7473
- fill: ((_h = element.props) == null ? void 0 : _h.fill) || "#000000",
7497
+ fill: ((_h2 = element.props) == null ? void 0 : _h2.fill) || "#000000",
7474
7498
  // Fill color
7475
7499
  opacity: ((_i2 = element.props) == null ? void 0 : _i2.opacity) || 1,
7476
7500
  // Opacity level
@@ -7491,13 +7515,13 @@ const addCircleElement = ({
7491
7515
  canvas,
7492
7516
  canvasMetadata
7493
7517
  }) => {
7494
- var _a2, _b, _c, _d, _e2, _f;
7518
+ var _a, _b, _c, _d, _e2, _f;
7495
7519
  const { x: x2, y: y2 } = convertToCanvasPosition(
7496
- ((_a2 = element.props) == null ? void 0 : _a2.x) || 0,
7520
+ ((_a = element.props) == null ? void 0 : _a.x) || 0,
7497
7521
  ((_b = element.props) == null ? void 0 : _b.y) || 0,
7498
7522
  canvasMetadata
7499
7523
  );
7500
- const circle = new qn({
7524
+ const circle = new co({
7501
7525
  left: x2,
7502
7526
  // X-coordinate on the canvas
7503
7527
  top: y2,
@@ -7525,7 +7549,7 @@ const addBackgroundColor = ({
7525
7549
  canvas,
7526
7550
  canvasMetadata
7527
7551
  }) => {
7528
- const bgRect = new vr({
7552
+ const bgRect = new jr({
7529
7553
  width: canvasMetadata.width,
7530
7554
  height: canvasMetadata.height,
7531
7555
  left: canvasMetadata.width / 2,
@@ -7637,11 +7661,11 @@ const useTwickCanvas = ({
7637
7661
  }
7638
7662
  };
7639
7663
  const handleMouseUp = (event) => {
7640
- var _a2, _b, _c;
7664
+ var _a, _b, _c;
7641
7665
  if (event.target) {
7642
7666
  const object = event.target;
7643
7667
  const elementId = object.get("id");
7644
- if (((_a2 = event.transform) == null ? void 0 : _a2.action) === "drag") {
7668
+ if (((_a = event.transform) == null ? void 0 : _a.action) === "drag") {
7645
7669
  const original = event.transform.original;
7646
7670
  if (object.left === original.left && object.top === original.top) {
7647
7671
  onCanvasOperation == null ? void 0 : onCanvasOperation(
@@ -7840,7 +7864,7 @@ const useTwickCanvas = ({
7840
7864
  seekTime,
7841
7865
  captionProps
7842
7866
  }) => {
7843
- var _a2, _b;
7867
+ var _a, _b;
7844
7868
  if (!twickCanvas) {
7845
7869
  console.warn("Canvas not initialized");
7846
7870
  return;
@@ -7852,7 +7876,7 @@ const useTwickCanvas = ({
7852
7876
  seekTime || 0
7853
7877
  );
7854
7878
  elementFrameMap.current[element.id] = currentFrameEffect;
7855
- const snapTime = ((seekTime || 0) - ((element == null ? void 0 : element.s) || 0)) * (((_a2 = element == null ? void 0 : element.props) == null ? void 0 : _a2.playbackRate) || 1) + (((_b = element == null ? void 0 : element.props) == null ? void 0 : _b.time) || 0);
7879
+ const snapTime = ((seekTime || 0) - ((element == null ? void 0 : element.s) || 0)) * (((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.playbackRate) || 1) + (((_b = element == null ? void 0 : element.props) == null ? void 0 : _b.time) || 0);
7856
7880
  await addVideoElement({
7857
7881
  element,
7858
7882
  index,
@@ -7977,14 +8001,14 @@ const usePlayerManager = ({
7977
8001
  onCanvasOperation: handleCanvasOperation
7978
8002
  });
7979
8003
  const updateCanvas = (seekTime) => {
7980
- var _a2;
8004
+ var _a;
7981
8005
  if (changeLog === currentChangeLog.current && seekTime === prevSeekTime.current) {
7982
8006
  return;
7983
8007
  }
7984
8008
  prevSeekTime.current = seekTime;
7985
8009
  const elements = getCurrentElements(
7986
8010
  seekTime,
7987
- ((_a2 = editor.getTimelineData()) == null ? void 0 : _a2.tracks) ?? []
8011
+ ((_a = editor.getTimelineData()) == null ? void 0 : _a.tracks) ?? []
7988
8012
  );
7989
8013
  let captionProps = {};
7990
8014
  (elements || []).forEach((element) => {
@@ -8002,18 +8026,18 @@ const usePlayerManager = ({
8002
8026
  currentChangeLog.current = changeLog;
8003
8027
  };
8004
8028
  const onPlayerUpdate = (event) => {
8005
- var _a2;
8006
- if (((_a2 = event == null ? void 0 : event.detail) == null ? void 0 : _a2.status) === "ready") {
8029
+ var _a;
8030
+ if (((_a = event == null ? void 0 : event.detail) == null ? void 0 : _a.status) === "ready") {
8007
8031
  setPlayerUpdating(false);
8008
8032
  setTimelineAction(TIMELINE_ACTION.ON_PLAYER_UPDATED, null);
8009
8033
  }
8010
8034
  };
8011
8035
  useEffect(() => {
8012
- var _a2, _b, _c, _d, _e2;
8036
+ var _a, _b, _c, _d, _e2;
8013
8037
  switch (timelineAction.type) {
8014
8038
  case TIMELINE_ACTION.UPDATE_PLAYER_DATA:
8015
8039
  if (videoProps) {
8016
- if (((_a2 = timelineAction.payload) == null ? void 0 : _a2.forceUpdate) || editor.getLatestVersion() !== ((_b = projectData == null ? void 0 : projectData.input) == null ? void 0 : _b.version)) {
8040
+ if (((_a = timelineAction.payload) == null ? void 0 : _a.forceUpdate) || editor.getLatestVersion() !== ((_b = projectData == null ? void 0 : projectData.input) == null ? void 0 : _b.version)) {
8017
8041
  setPlayerUpdating(true);
8018
8042
  const _latestProjectData = {
8019
8043
  input: {
@@ -9491,6 +9515,7 @@ function SeekTrack({
9491
9515
  const pinHeight = 2 + timelineCount * (2.75 + 0.5);
9492
9516
  useEffect(() => {
9493
9517
  if (!isDragging2) {
9518
+ console.log("currentTime", currentTime);
9494
9519
  setSeekPosition(currentTime * pixelsPerSecond);
9495
9520
  }
9496
9521
  }, [currentTime, pixelsPerSecond, isDragging2]);
@@ -10229,7 +10254,7 @@ function loadExternalIsValidProp(isValidProp) {
10229
10254
  }
10230
10255
  try {
10231
10256
  loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
10232
- } catch (_a2) {
10257
+ } catch (_a) {
10233
10258
  }
10234
10259
  function filterProps(props, isDom, forwardMotionProps) {
10235
10260
  const filteredProps = {};
@@ -10356,7 +10381,7 @@ const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId
10356
10381
  const { schedule: microtask } = createRenderBatcher(queueMicrotask, false);
10357
10382
  const SwitchLayoutGroupContext = createContext({});
10358
10383
  function useVisualElement(Component2, visualState, props, createVisualElement, ProjectionNodeConstructor) {
10359
- var _a2, _b;
10384
+ var _a, _b;
10360
10385
  const { visualElement: parent } = useContext(MotionContext);
10361
10386
  const lazyContext = useContext(LazyContext);
10362
10387
  const presenceContext = useContext(PresenceContext);
@@ -10385,7 +10410,7 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
10385
10410
  }
10386
10411
  });
10387
10412
  const optimisedAppearId = props[optimizedAppearDataAttribute];
10388
- const wantsHandoff = useRef(Boolean(optimisedAppearId) && !((_a2 = window.MotionHandoffIsComplete) === null || _a2 === void 0 ? void 0 : _a2.call(window, optimisedAppearId)) && ((_b = window.MotionHasOptimisedAnimation) === null || _b === void 0 ? void 0 : _b.call(window, optimisedAppearId)));
10413
+ const wantsHandoff = useRef(Boolean(optimisedAppearId) && !((_a = window.MotionHandoffIsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)) && ((_b = window.MotionHasOptimisedAnimation) === null || _b === void 0 ? void 0 : _b.call(window, optimisedAppearId)));
10389
10414
  useIsomorphicLayoutEffect(() => {
10390
10415
  if (!visualElement)
10391
10416
  return;
@@ -10405,8 +10430,8 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
10405
10430
  }
10406
10431
  if (wantsHandoff.current) {
10407
10432
  queueMicrotask(() => {
10408
- var _a3;
10409
- (_a3 = window.MotionHandoffMarkAsComplete) === null || _a3 === void 0 ? void 0 : _a3.call(window, optimisedAppearId);
10433
+ var _a2;
10434
+ (_a2 = window.MotionHandoffMarkAsComplete) === null || _a2 === void 0 ? void 0 : _a2.call(window, optimisedAppearId);
10410
10435
  });
10411
10436
  wantsHandoff.current = false;
10412
10437
  }
@@ -10440,7 +10465,7 @@ function getClosestProjectingNode(visualElement) {
10440
10465
  return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent);
10441
10466
  }
10442
10467
  function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component: Component2 }) {
10443
- var _a2, _b;
10468
+ var _a, _b;
10444
10469
  preloadedFeatures && loadFeatures(preloadedFeatures);
10445
10470
  function MotionComponent(props, externalRef) {
10446
10471
  let MeasureLayout2;
@@ -10460,7 +10485,7 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
10460
10485
  }
10461
10486
  return jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout2 && context.visualElement ? jsx(MeasureLayout2, { visualElement: context.visualElement, ...configAndProps }) : null, useRender(Component2, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] });
10462
10487
  }
10463
- MotionComponent.displayName = `motion.${typeof Component2 === "string" ? Component2 : `create(${(_b = (_a2 = Component2.displayName) !== null && _a2 !== void 0 ? _a2 : Component2.name) !== null && _b !== void 0 ? _b : ""})`}`;
10488
+ MotionComponent.displayName = `motion.${typeof Component2 === "string" ? Component2 : `create(${(_b = (_a = Component2.displayName) !== null && _a !== void 0 ? _a : Component2.name) !== null && _b !== void 0 ? _b : ""})`}`;
10464
10489
  const ForwardRefMotionComponent = forwardRef(MotionComponent);
10465
10490
  ForwardRefMotionComponent[motionComponentSymbol] = Component2;
10466
10491
  return ForwardRefMotionComponent;
@@ -10973,11 +10998,11 @@ function isForcedMotionValue(key, { layout: layout2, layoutId }) {
10973
10998
  return transformProps.has(key) || key.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity");
10974
10999
  }
10975
11000
  function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
10976
- var _a2;
11001
+ var _a;
10977
11002
  const { style } = props;
10978
11003
  const newValues = {};
10979
11004
  for (const key in style) {
10980
- if (isMotionValue(style[key]) || prevProps.style && isMotionValue(prevProps.style[key]) || isForcedMotionValue(key, props) || ((_a2 = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a2 === void 0 ? void 0 : _a2.liveStyle) !== void 0) {
11005
+ if (isMotionValue(style[key]) || prevProps.style && isMotionValue(prevProps.style[key]) || isForcedMotionValue(key, props) || ((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== void 0) {
10981
11006
  newValues[key] = style[key];
10982
11007
  }
10983
11008
  }
@@ -11255,8 +11280,8 @@ const supportsFlags = {
11255
11280
  function memoSupports(callback, supportsFlag) {
11256
11281
  const memoized = /* @__PURE__ */ memo(callback);
11257
11282
  return () => {
11258
- var _a2;
11259
- return (_a2 = supportsFlags[supportsFlag]) !== null && _a2 !== void 0 ? _a2 : memoized();
11283
+ var _a;
11284
+ return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized();
11260
11285
  };
11261
11286
  }
11262
11287
  const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
@@ -11311,12 +11336,12 @@ function isDragActive() {
11311
11336
  return isDragging.x || isDragging.y;
11312
11337
  }
11313
11338
  function resolveElements(elementOrSelector, scope, selectorCache) {
11314
- var _a2;
11339
+ var _a;
11315
11340
  if (elementOrSelector instanceof Element) {
11316
11341
  return [elementOrSelector];
11317
11342
  } else if (typeof elementOrSelector === "string") {
11318
11343
  let root = document;
11319
- const elements = (_a2 = void 0) !== null && _a2 !== void 0 ? _a2 : root.querySelectorAll(elementOrSelector);
11344
+ const elements = (_a = void 0) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
11320
11345
  return elements ? Array.from(elements) : [];
11321
11346
  }
11322
11347
  return Array.from(elementOrSelector);
@@ -11962,8 +11987,8 @@ const color = {
11962
11987
  };
11963
11988
  const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
11964
11989
  function test(v2) {
11965
- var _a2, _b;
11966
- return isNaN(v2) && typeof v2 === "string" && (((_a2 = v2.match(floatRegex)) === null || _a2 === void 0 ? void 0 : _a2.length) || 0) + (((_b = v2.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0;
11990
+ var _a, _b;
11991
+ return isNaN(v2) && typeof v2 === "string" && (((_a = v2.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) + (((_b = v2.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0;
11967
11992
  }
11968
11993
  const NUMBER_TOKEN = "number";
11969
11994
  const COLOR_TOKEN = "color";
@@ -12165,8 +12190,8 @@ function measureAllKeyframes() {
12165
12190
  const restore = transformsToRestore.get(element);
12166
12191
  if (restore) {
12167
12192
  restore.forEach(([key, value]) => {
12168
- var _a2;
12169
- (_a2 = element.getValue(key)) === null || _a2 === void 0 ? void 0 : _a2.set(value);
12193
+ var _a;
12194
+ (_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
12170
12195
  });
12171
12196
  }
12172
12197
  });
@@ -12375,7 +12400,7 @@ class DOMKeyframesResolver extends KeyframeResolver {
12375
12400
  }
12376
12401
  }
12377
12402
  measureEndState() {
12378
- var _a2;
12403
+ var _a;
12379
12404
  const { element, name, unresolvedKeyframes } = this;
12380
12405
  if (!element || !element.current)
12381
12406
  return;
@@ -12387,7 +12412,7 @@ class DOMKeyframesResolver extends KeyframeResolver {
12387
12412
  if (finalKeyframe !== null && this.finalKeyframe === void 0) {
12388
12413
  this.finalKeyframe = finalKeyframe;
12389
12414
  }
12390
- if ((_a2 = this.removedTransforms) === null || _a2 === void 0 ? void 0 : _a2.length) {
12415
+ if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
12391
12416
  this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
12392
12417
  element.getValue(unsetTransformName).set(unsetTransformValue);
12393
12418
  });
@@ -12656,13 +12681,13 @@ function mixObject(a2, b2) {
12656
12681
  };
12657
12682
  }
12658
12683
  function matchOrder(origin, target) {
12659
- var _a2;
12684
+ var _a;
12660
12685
  const orderedOrigin = [];
12661
12686
  const pointers = { color: 0, var: 0, number: 0 };
12662
12687
  for (let i2 = 0; i2 < target.values.length; i2++) {
12663
12688
  const type = target.types[i2];
12664
12689
  const originIndex = origin.indexes[type][pointers[type]];
12665
- const originValue = (_a2 = origin.values[originIndex]) !== null && _a2 !== void 0 ? _a2 : 0;
12690
+ const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0;
12666
12691
  orderedOrigin[i2] = originValue;
12667
12692
  pointers[type]++;
12668
12693
  }
@@ -13296,13 +13321,13 @@ class MainThreadAnimation extends BaseAnimation {
13296
13321
  this.driver.start();
13297
13322
  }
13298
13323
  pause() {
13299
- var _a2;
13324
+ var _a;
13300
13325
  if (!this._resolved) {
13301
13326
  this.pendingPlayState = "paused";
13302
13327
  return;
13303
13328
  }
13304
13329
  this.state = "paused";
13305
- this.holdTime = (_a2 = this.currentTime) !== null && _a2 !== void 0 ? _a2 : 0;
13330
+ this.holdTime = (_a = this.currentTime) !== null && _a !== void 0 ? _a : 0;
13306
13331
  }
13307
13332
  complete() {
13308
13333
  if (this.state !== "running") {
@@ -13695,14 +13720,14 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
13695
13720
  return shouldBlock;
13696
13721
  }
13697
13722
  function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type } = {}) {
13698
- var _a2;
13723
+ var _a;
13699
13724
  let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
13700
13725
  if (transitionOverride)
13701
13726
  transition = transitionOverride;
13702
13727
  const animations2 = [];
13703
13728
  const animationTypeState = type && visualElement.animationState && visualElement.animationState.getState()[type];
13704
13729
  for (const key in target) {
13705
- const value = visualElement.getValue(key, (_a2 = visualElement.latestValues[key]) !== null && _a2 !== void 0 ? _a2 : null);
13730
+ const value = visualElement.getValue(key, (_a = visualElement.latestValues[key]) !== null && _a !== void 0 ? _a : null);
13706
13731
  const valueTarget = target[key];
13707
13732
  if (valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key)) {
13708
13733
  continue;
@@ -13739,8 +13764,8 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
13739
13764
  return animations2;
13740
13765
  }
13741
13766
  function animateVariant(visualElement, variant, options = {}) {
13742
- var _a2;
13743
- const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
13767
+ var _a;
13768
+ const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : void 0);
13744
13769
  let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
13745
13770
  if (options.transitionOverride) {
13746
13771
  transition = options.transitionOverride;
@@ -13821,8 +13846,8 @@ function createAnimationState(visualElement) {
13821
13846
  let state = createState();
13822
13847
  let isInitialRender = true;
13823
13848
  const buildResolvedTypeValues = (type) => (acc, definition) => {
13824
- var _a2;
13825
- const resolved = resolveVariant(visualElement, definition, type === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
13849
+ var _a;
13850
+ const resolved = resolveVariant(visualElement, definition, type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : void 0);
13826
13851
  if (resolved) {
13827
13852
  const { transition, transitionEnd, ...target } = resolved;
13828
13853
  acc = { ...acc, ...target, ...transitionEnd };
@@ -13944,12 +13969,12 @@ function createAnimationState(visualElement) {
13944
13969
  return shouldAnimate ? animate(animations2) : Promise.resolve();
13945
13970
  }
13946
13971
  function setActive(type, isActive) {
13947
- var _a2;
13972
+ var _a;
13948
13973
  if (state[type].isActive === isActive)
13949
13974
  return Promise.resolve();
13950
- (_a2 = visualElement.variantChildren) === null || _a2 === void 0 ? void 0 : _a2.forEach((child) => {
13951
- var _a3;
13952
- return (_a3 = child.animationState) === null || _a3 === void 0 ? void 0 : _a3.setActive(type, isActive);
13975
+ (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
13976
+ var _a2;
13977
+ return (_a2 = child.animationState) === null || _a2 === void 0 ? void 0 : _a2.setActive(type, isActive);
13953
13978
  });
13954
13979
  state[type].isActive = isActive;
13955
13980
  const animations2 = animateChanges(type);
@@ -14034,9 +14059,9 @@ class AnimationFeature extends Feature {
14034
14059
  }
14035
14060
  }
14036
14061
  unmount() {
14037
- var _a2;
14062
+ var _a;
14038
14063
  this.node.animationState.reset();
14039
- (_a2 = this.unmountControls) === null || _a2 === void 0 ? void 0 : _a2.call(this);
14064
+ (_a = this.unmountControls) === null || _a === void 0 ? void 0 : _a.call(this);
14040
14065
  }
14041
14066
  }
14042
14067
  let id$1 = 0;
@@ -14555,8 +14580,8 @@ class VisualElementDragControls {
14555
14580
  };
14556
14581
  const onSessionEnd = (event, info) => this.stop(event, info);
14557
14582
  const resumeAnimation = () => eachAxis((axis) => {
14558
- var _a2;
14559
- return this.getAnimationState(axis) === "paused" && ((_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.play());
14583
+ var _a;
14584
+ return this.getAnimationState(axis) === "paused" && ((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
14560
14585
  });
14561
14586
  const { dragSnapToOrigin } = this.getProps();
14562
14587
  this.panSession = new PanSession(originEvent, {
@@ -14610,9 +14635,9 @@ class VisualElementDragControls {
14610
14635
  axisValue.set(next);
14611
14636
  }
14612
14637
  resolveConstraints() {
14613
- var _a2;
14638
+ var _a;
14614
14639
  const { dragConstraints, dragElastic } = this.getProps();
14615
- const layout2 = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : (_a2 = this.visualElement.projection) === null || _a2 === void 0 ? void 0 : _a2.layout;
14640
+ const layout2 = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout;
14616
14641
  const prevConstraints = this.constraints;
14617
14642
  if (dragConstraints && isRefObject(dragConstraints)) {
14618
14643
  if (!this.constraints) {
@@ -14691,13 +14716,13 @@ class VisualElementDragControls {
14691
14716
  }
14692
14717
  pauseAnimation() {
14693
14718
  eachAxis((axis) => {
14694
- var _a2;
14695
- return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.pause();
14719
+ var _a;
14720
+ return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause();
14696
14721
  });
14697
14722
  }
14698
14723
  getAnimationState(axis) {
14699
- var _a2;
14700
- return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.state;
14724
+ var _a;
14725
+ return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state;
14701
14726
  }
14702
14727
  /**
14703
14728
  * Drag works differently depending on which props are provided.
@@ -15700,12 +15725,12 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15700
15725
  };
15701
15726
  }
15702
15727
  measurePageBox() {
15703
- var _a2;
15728
+ var _a;
15704
15729
  const { visualElement } = this.options;
15705
15730
  if (!visualElement)
15706
15731
  return createBox();
15707
15732
  const box = visualElement.measureViewportBox();
15708
- const wasInScrollRoot = ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) || this.path.some(checkNodeWasScrollRoot);
15733
+ const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
15709
15734
  if (!wasInScrollRoot) {
15710
15735
  const { scroll } = this.root;
15711
15736
  if (scroll) {
@@ -15716,10 +15741,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15716
15741
  return box;
15717
15742
  }
15718
15743
  removeElementScroll(box) {
15719
- var _a2;
15744
+ var _a;
15720
15745
  const boxWithoutScroll = createBox();
15721
15746
  copyBoxInto(boxWithoutScroll, box);
15722
- if ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) {
15747
+ if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
15723
15748
  return boxWithoutScroll;
15724
15749
  }
15725
15750
  for (let i2 = 0; i2 < this.path.length; i2++) {
@@ -15804,13 +15829,13 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15804
15829
  }
15805
15830
  }
15806
15831
  resolveTargetDelta(forceRecalculation = false) {
15807
- var _a2;
15832
+ var _a;
15808
15833
  const lead = this.getLead();
15809
15834
  this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
15810
15835
  this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
15811
15836
  this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
15812
15837
  const isShared = Boolean(this.resumingFrom) || this !== lead;
15813
- const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
15838
+ const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
15814
15839
  if (canSkip)
15815
15840
  return;
15816
15841
  const { layout: layout2, layoutId } = this.options;
@@ -15881,11 +15906,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15881
15906
  return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
15882
15907
  }
15883
15908
  calcProjection() {
15884
- var _a2;
15909
+ var _a;
15885
15910
  const lead = this.getLead();
15886
15911
  const isShared = Boolean(this.resumingFrom) || this !== lead;
15887
15912
  let canSkip = true;
15888
- if (this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty)) {
15913
+ if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
15889
15914
  canSkip = false;
15890
15915
  }
15891
15916
  if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
@@ -15942,8 +15967,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15942
15967
  this.isVisible = true;
15943
15968
  }
15944
15969
  scheduleRender(notifyAll = true) {
15945
- var _a2;
15946
- (_a2 = this.options.visualElement) === null || _a2 === void 0 ? void 0 : _a2.scheduleRender();
15970
+ var _a;
15971
+ (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
15947
15972
  if (notifyAll) {
15948
15973
  const stack = this.getStack();
15949
15974
  stack && stack.scheduleRender();
@@ -16081,14 +16106,14 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16081
16106
  return stack ? stack.lead === this : true;
16082
16107
  }
16083
16108
  getLead() {
16084
- var _a2;
16109
+ var _a;
16085
16110
  const { layoutId } = this.options;
16086
- return layoutId ? ((_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.lead) || this : this;
16111
+ return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
16087
16112
  }
16088
16113
  getPrevLead() {
16089
- var _a2;
16114
+ var _a;
16090
16115
  const { layoutId } = this.options;
16091
- return layoutId ? (_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.prevLead : void 0;
16116
+ return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : void 0;
16092
16117
  }
16093
16118
  getStack() {
16094
16119
  const { layoutId } = this.options;
@@ -16143,7 +16168,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16143
16168
  visualElement.scheduleRender();
16144
16169
  }
16145
16170
  getProjectionStyles(styleProp) {
16146
- var _a2, _b;
16171
+ var _a, _b;
16147
16172
  if (!this.instance || this.isSVG)
16148
16173
  return void 0;
16149
16174
  if (!this.isVisible) {
@@ -16182,7 +16207,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16182
16207
  const { x: x2, y: y2 } = this.projectionDelta;
16183
16208
  styles.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`;
16184
16209
  if (lead.animationValues) {
16185
- styles.opacity = lead === this ? (_b = (_a2 = valuesToRender.opacity) !== null && _a2 !== void 0 ? _a2 : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
16210
+ styles.opacity = lead === this ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
16186
16211
  } else {
16187
16212
  styles.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
16188
16213
  }
@@ -16211,8 +16236,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16211
16236
  // Only run on root
16212
16237
  resetTree() {
16213
16238
  this.root.nodes.forEach((node) => {
16214
- var _a2;
16215
- return (_a2 = node.currentAnimation) === null || _a2 === void 0 ? void 0 : _a2.stop();
16239
+ var _a;
16240
+ return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
16216
16241
  });
16217
16242
  this.root.nodes.forEach(clearMeasurements);
16218
16243
  this.root.sharedNodes.clear();
@@ -16223,8 +16248,8 @@ function updateLayout(node) {
16223
16248
  node.updateLayout();
16224
16249
  }
16225
16250
  function notifyLayoutUpdate(node) {
16226
- var _a2;
16227
- const snapshot = ((_a2 = node.resumeFrom) === null || _a2 === void 0 ? void 0 : _a2.snapshot) || node.snapshot;
16251
+ var _a;
16252
+ const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
16228
16253
  if (node.isLead() && node.layout && snapshot && node.hasListeners("didUpdate")) {
16229
16254
  const { layoutBox: layout2, measuredBox: measuredLayout } = node.layout;
16230
16255
  const { animationType } = node.options;
@@ -16374,8 +16399,8 @@ function shouldAnimatePositionOnly(animationType, snapshot, layout2) {
16374
16399
  return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout2), 0.2);
16375
16400
  }
16376
16401
  function checkNodeWasScrollRoot(node) {
16377
- var _a2;
16378
- return node !== node.root && ((_a2 = node.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot);
16402
+ var _a;
16403
+ return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
16379
16404
  }
16380
16405
  const DocumentProjectionNode = createProjectionNode({
16381
16406
  attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
@@ -16946,8 +16971,8 @@ class VisualElement {
16946
16971
  * directly from the instance (which might have performance implications).
16947
16972
  */
16948
16973
  readValue(key, target) {
16949
- var _a2;
16950
- let value = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : (_a2 = this.getBaseTargetFromProps(this.props, key)) !== null && _a2 !== void 0 ? _a2 : this.readValueFromInstance(this.current, key, this.options);
16974
+ var _a;
16975
+ let value = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options);
16951
16976
  if (value !== void 0 && value !== null) {
16952
16977
  if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) {
16953
16978
  value = parseFloat(value);
@@ -16970,11 +16995,11 @@ class VisualElement {
16970
16995
  * props.
16971
16996
  */
16972
16997
  getBaseTarget(key) {
16973
- var _a2;
16998
+ var _a;
16974
16999
  const { initial } = this.props;
16975
17000
  let valueFromInitial;
16976
17001
  if (typeof initial === "string" || typeof initial === "object") {
16977
- const variant = resolveVariantFromProps(this.props, initial, (_a2 = this.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom);
17002
+ const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom);
16978
17003
  if (variant) {
16979
17004
  valueFromInitial = variant[key];
16980
17005
  }
@@ -17402,9 +17427,9 @@ const TrackElementView = ({
17402
17427
  lastPosRef.current = position;
17403
17428
  };
17404
17429
  const sendUpdate = () => {
17405
- var _a2, _b;
17430
+ var _a, _b;
17406
17431
  setIsDragging(false);
17407
- if (((_a2 = lastPosRef.current) == null ? void 0 : _a2.start) !== position.start || ((_b = lastPosRef.current) == null ? void 0 : _b.end) !== position.end) {
17432
+ if (((_a = lastPosRef.current) == null ? void 0 : _a.start) !== position.start || ((_b = lastPosRef.current) == null ? void 0 : _b.end) !== position.end) {
17408
17433
  onDrag({
17409
17434
  element,
17410
17435
  updates: {
@@ -17699,8 +17724,8 @@ const useTimelineManager = () => {
17699
17724
  setSelectedItem(selectedItem2);
17700
17725
  };
17701
17726
  const onAddTrack = () => {
17702
- var _a2;
17703
- const tracks = ((_a2 = editor.getTimelineData()) == null ? void 0 : _a2.tracks) || [];
17727
+ var _a;
17728
+ const tracks = ((_a = editor.getTimelineData()) == null ? void 0 : _a.tracks) || [];
17704
17729
  editor.addTrack(`Track_${tracks.length + 1}`);
17705
17730
  };
17706
17731
  return {
@@ -17719,7 +17744,7 @@ const TimelineManager = ({
17719
17744
  timelineTickConfigs,
17720
17745
  elementColors
17721
17746
  }) => {
17722
- var _a2;
17747
+ var _a;
17723
17748
  const { timelineData, totalDuration, selectedItem, onAddTrack, onReorder, onElementDrag, onSeek, onSelectionChange } = useTimelineManager();
17724
17749
  return /* @__PURE__ */ jsx(
17725
17750
  TimelineView,
@@ -17742,7 +17767,7 @@ const TimelineManager = ({
17742
17767
  duration: totalDuration,
17743
17768
  zoom: trackZoom,
17744
17769
  onSeek,
17745
- timelineCount: ((_a2 = timelineData == null ? void 0 : timelineData.tracks) == null ? void 0 : _a2.length) ?? 0,
17770
+ timelineCount: ((_a = timelineData == null ? void 0 : timelineData.tracks) == null ? void 0 : _a.length) ?? 0,
17746
17771
  timelineTickConfigs
17747
17772
  }
17748
17773
  )
@@ -18248,8 +18273,8 @@ class BrowserMediaManager extends BaseMediaManager {
18248
18273
  const matchesType = !options.type || item.type === options.type;
18249
18274
  const matchesMetadata = !options.metadata || Object.entries(options.metadata).every(
18250
18275
  ([key, value]) => {
18251
- var _a2;
18252
- return ((_a2 = item.metadata) == null ? void 0 : _a2[key]) === value;
18276
+ var _a;
18277
+ return ((_a = item.metadata) == null ? void 0 : _a[key]) === value;
18253
18278
  }
18254
18279
  );
18255
18280
  return matchesQuery && matchesType && matchesMetadata;