@twick/video-editor 0.14.20 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -130,26 +130,28 @@ const p = () => g || (g = { document, window, isTouchSupported: "ontouchstart" i
130
130
  };
131
131
  const _ = new class {
132
132
  constructor() {
133
- t(this, "charWidthsCache", {}), t(this, "boundsOfCurveCache", {});
133
+ t(this, "boundsOfCurveCache", {}), this.charWidthsCache = /* @__PURE__ */ new Map();
134
134
  }
135
135
  getFontCache(t2) {
136
136
  let { fontFamily: e3, fontStyle: s2, fontWeight: i2 } = t2;
137
- e3 = e3.toLowerCase(), this.charWidthsCache[e3] || (this.charWidthsCache[e3] = {});
138
- const r2 = this.charWidthsCache[e3], n2 = "".concat(s2.toLowerCase(), "_").concat((i2 + "").toLowerCase());
139
- return r2[n2] || (r2[n2] = {}), r2[n2];
137
+ e3 = e3.toLowerCase();
138
+ const r2 = this.charWidthsCache;
139
+ r2.has(e3) || r2.set(e3, /* @__PURE__ */ new Map());
140
+ const n2 = r2.get(e3), o2 = "".concat(s2.toLowerCase(), "_").concat((i2 + "").toLowerCase());
141
+ return n2.has(o2) || n2.set(o2, /* @__PURE__ */ new Map()), n2.get(o2);
140
142
  }
141
143
  clearFontCache(t2) {
142
- (t2 = (t2 || "").toLowerCase()) ? this.charWidthsCache[t2] && delete this.charWidthsCache[t2] : this.charWidthsCache = {};
144
+ t2 ? this.charWidthsCache.delete((t2 || "").toLowerCase()) : this.charWidthsCache = /* @__PURE__ */ new Map();
143
145
  }
144
146
  limitDimsByArea(t2) {
145
147
  const { perfLimitSizeTotal: e3 } = o, s2 = Math.sqrt(e3 * t2);
146
148
  return [Math.floor(s2), Math.floor(e3 / s2)];
147
149
  }
148
150
  }();
149
- const x = "6.6.6";
151
+ const x = "6.9.1";
150
152
  function C() {
151
153
  }
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", 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";
154
+ 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";
153
155
  const tt = new class {
154
156
  constructor() {
155
157
  this[Z] = /* @__PURE__ */ new Map(), this[$] = /* @__PURE__ */ new Map();
@@ -562,7 +564,7 @@ const Et = function(t2) {
562
564
  i2 && (r2 = Tt(r2, Pt({ angle: i2 })));
563
565
  const n2 = Lt(t2);
564
566
  return bt(n2) || (r2 = Tt(r2, n2)), r2;
565
- }, Bt = function(t2) {
567
+ }, It = function(t2) {
566
568
  let { signal: e3, crossOrigin: s2 = null } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
567
569
  return new Promise(function(i2, r2) {
568
570
  if (e3 && e3.aborted) return r2(new c("loadImage"));
@@ -578,7 +580,7 @@ const Et = function(t2) {
578
580
  o2 && (null == e3 || e3.removeEventListener("abort", o2)), r2(new h("Error loading ".concat(n2.src)));
579
581
  }, s2 && (n2.crossOrigin = s2), n2.src = t2) : a2();
580
582
  });
581
- }, It = function(t2) {
583
+ }, Bt = function(t2) {
582
584
  let { signal: e3, reviver: s2 = C } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
583
585
  return new Promise((i2, r2) => {
584
586
  const n2 = [];
@@ -595,7 +597,7 @@ const Et = function(t2) {
595
597
  return new Promise((s2, i2) => {
596
598
  const r2 = [];
597
599
  e3 && e3.addEventListener("abort", i2, { once: true });
598
- const n2 = Object.values(t2).map((t3) => t3 && t3.type && tt.has(t3.type) ? It([t3], { signal: e3 }).then((t4) => {
600
+ const n2 = Object.values(t2).map((t3) => t3 && t3.type && tt.has(t3.type) ? Bt([t3], { signal: e3 }).then((t4) => {
599
601
  let [e4] = t4;
600
602
  return r2.push(e4), e4;
601
603
  }) : t3), o2 = Object.keys(t2);
@@ -674,8 +676,8 @@ class te {
674
676
  p().dispose(this.lower.el), delete this.lower;
675
677
  }
676
678
  }
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] };
678
- class se extends ct(lt) {
679
+ 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"];
680
+ class ie extends ct(lt) {
679
681
  get lowerCanvasEl() {
680
682
  var t2;
681
683
  return null === (t2 = this.elements.lower) || void 0 === t2 ? void 0 : t2.el;
@@ -685,7 +687,7 @@ class se extends ct(lt) {
685
687
  return null === (t2 = this.elements.lower) || void 0 === t2 ? void 0 : t2.ctx;
686
688
  }
687
689
  static getDefaults() {
688
- return se.ownDefaults;
690
+ return ie.ownDefaults;
689
691
  }
690
692
  constructor(t2) {
691
693
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
@@ -961,10 +963,10 @@ class se extends ct(lt) {
961
963
  loadFromJSON(t2, e3) {
962
964
  let { signal: s2 } = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
963
965
  if (!t2) return Promise.reject(new h("`json` is undefined"));
964
- 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;
965
- 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) => {
966
+ 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;
967
+ 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) => {
966
968
  let [e4, s3] = t3;
967
- return this.clear(), this.add(...e4), this.set(i2), this.set(s3), this.renderOnAddRemove = u2, this;
969
+ return this.clear(), this.add(...e4), this.set(o2), this.set(s3), this.renderOnAddRemove = g2, this;
968
970
  });
969
971
  }
970
972
  clone(t2) {
@@ -1005,60 +1007,60 @@ class se extends ct(lt) {
1005
1007
  return "#<Canvas (".concat(this.complexity(), "): { objects: ").concat(this._objects.length, " }>");
1006
1008
  }
1007
1009
  }
1008
- t(se, "ownDefaults", ee);
1009
- const ie = ["touchstart", "touchmove", "touchend"];
1010
- const re = (t2) => {
1010
+ t(ie, "ownDefaults", ee);
1011
+ const re = ["touchstart", "touchmove", "touchend"];
1012
+ const ne = (t2) => {
1011
1013
  const e3 = qt(t2.target), s2 = function(t3) {
1012
1014
  const e4 = t3.changedTouches;
1013
1015
  return e4 && e4[0] ? e4[0] : t3;
1014
1016
  }(t2);
1015
1017
  return new ot(s2.clientX + e3.left, s2.clientY + e3.top);
1016
- }, ne = (t2) => ie.includes(t2.type) || "touch" === t2.pointerType, oe = (t2) => {
1018
+ }, oe = (t2) => re.includes(t2.type) || "touch" === t2.pointerType, ae = (t2) => {
1017
1019
  t2.preventDefault(), t2.stopPropagation();
1018
- }, ae = (t2) => {
1020
+ }, he = (t2) => {
1019
1021
  let e3 = 0, s2 = 0, i2 = 0, r2 = 0;
1020
1022
  for (let n2 = 0, o2 = t2.length; n2 < o2; n2++) {
1021
1023
  const { x: o3, y: a2 } = t2[n2];
1022
1024
  (o3 > i2 || !n2) && (i2 = o3), (o3 < e3 || !n2) && (e3 = o3), (a2 > r2 || !n2) && (r2 = a2), (a2 < s2 || !n2) && (s2 = a2);
1023
1025
  }
1024
1026
  return { left: e3, top: s2, width: i2 - e3, height: r2 - s2 };
1025
- }, he = ["translateX", "translateY", "scaleX", "scaleY"], ce = (t2, e3) => le(t2, Tt(e3, t2.calcOwnMatrix())), le = (t2, e3) => {
1026
- const s2 = Dt(e3), { translateX: r2, translateY: n2, scaleX: o2, scaleY: a2 } = s2, h2 = i(s2, he), c2 = new ot(r2, n2);
1027
+ }, ce = ["translateX", "translateY", "scaleX", "scaleY"], le = (t2, e3) => ue(t2, Tt(e3, t2.calcOwnMatrix())), ue = (t2, e3) => {
1028
+ const s2 = Dt(e3), { translateX: r2, translateY: n2, scaleX: o2, scaleY: a2 } = s2, h2 = i(s2, ce), c2 = new ot(r2, n2);
1027
1029
  t2.flipX = false, t2.flipY = false, Object.assign(t2, h2), t2.set({ scaleX: o2, scaleY: a2 }), t2.setPositionByOrigin(c2, D, D);
1028
- }, ue = (t2) => {
1030
+ }, de = (t2) => {
1029
1031
  t2.scaleX = 1, t2.scaleY = 1, t2.skewX = 0, t2.skewY = 0, t2.flipX = false, t2.flipY = false, t2.rotate(0);
1030
- }, 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) => {
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 = ae(n2);
1032
+ }, 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) => {
1033
+ 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);
1032
1034
  return new ot(o2.width, o2.height);
1033
- }, fe = function() {
1035
+ }, pe = function() {
1034
1036
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : T;
1035
1037
  return Tt(wt(arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : T), t2);
1036
- }, pe = function(t2) {
1037
- let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : T, s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : T;
1038
- return t2.transform(fe(e3, s2));
1039
1038
  }, me = function(t2) {
1040
1039
  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(fe(e3, s2), true);
1042
- }, ve = (t2, e3, s2) => {
1043
- const i2 = fe(e3, s2);
1044
- return le(t2, Tt(i2, t2.calcOwnMatrix())), i2;
1045
- }, ye = (t2, e3) => {
1040
+ return t2.transform(pe(e3, s2));
1041
+ }, ve = function(t2) {
1042
+ let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : T, s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : T;
1043
+ return t2.transform(pe(e3, s2), true);
1044
+ }, ye = (t2, e3, s2) => {
1045
+ const i2 = pe(e3, s2);
1046
+ return ue(t2, Tt(i2, t2.calcOwnMatrix())), i2;
1047
+ }, _e = (t2, e3) => {
1046
1048
  var i2;
1047
1049
  const { transform: { target: r2 } } = e3;
1048
1050
  null === (i2 = r2.canvas) || void 0 === i2 || i2.fire("object:".concat(t2), s(s({}, e3), {}, { target: r2 })), r2.fire(t2, e3);
1049
- }, _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";
1050
- function be(t2) {
1051
- return xe(t2.originX) === xe(D) && xe(t2.originY) === xe(D);
1052
- }
1051
+ }, 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";
1053
1052
  function Se(t2) {
1054
- return 0.5 - xe(t2);
1053
+ return Ce(t2.originX) === Ce(D) && Ce(t2.originY) === Ce(D);
1055
1054
  }
1056
- const we = (t2, e3) => t2[e3], Te = (t2, e3, s2, i2) => ({ e: t2, transform: e3, pointer: new ot(s2, i2) });
1057
- function Oe(t2, e3) {
1055
+ function we(t2) {
1056
+ return 0.5 - Ce(t2);
1057
+ }
1058
+ const Te = (t2, e3) => t2[e3], Oe = (t2, e3, s2, i2) => ({ e: t2, transform: e3, pointer: new ot(s2, i2) });
1059
+ function ke(t2, e3) {
1058
1060
  const s2 = t2.getTotalAngle() + Ct(Math.atan2(e3.y, e3.x)) + 360;
1059
1061
  return Math.round(s2 % 360 / 45);
1060
1062
  }
1061
- function ke(t2, e3, s2, i2, r2) {
1063
+ function De(t2, e3, s2, i2, r2) {
1062
1064
  var n2;
1063
1065
  let { target: o2, corner: a2 } = t2;
1064
1066
  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) {
@@ -1067,10 +1069,10 @@ function ke(t2, e3, s2, i2, r2) {
1067
1069
  }(o2, new ot(i2, r2), e3, s2);
1068
1070
  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;
1069
1071
  }
1070
- const De = (t2, e3, s2, i2) => {
1071
- 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;
1072
- return c2 && r2.set(M, a2), l2 && r2.set(P, h2), (c2 || l2) && ye(L, Te(t2, e3, s2, i2)), c2 || l2;
1073
- }, 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) => {
1072
+ const Me = (t2, e3, s2, i2) => {
1073
+ 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;
1074
+ return c2 && r2.set(M, a2), l2 && r2.set(P, h2), (c2 || l2) && _e(L, Oe(t2, e3, s2, i2)), c2 || l2;
1075
+ }, 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) => {
1074
1076
  t2 /= 255, e3 /= 255, s2 /= 255;
1075
1077
  const r2 = Math.max(t2, e3, s2), n2 = Math.min(t2, e3, s2);
1076
1078
  let o2, a2;
@@ -1091,17 +1093,17 @@ const De = (t2, e3, s2, i2) => {
1091
1093
  o2 /= 6;
1092
1094
  }
1093
1095
  return [Math.round(360 * o2), Math.round(100 * a2), Math.round(100 * h2), i2];
1094
- }, Ae = function() {
1096
+ }, Fe = function() {
1095
1097
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "1";
1096
1098
  return parseFloat(t2) / (t2.endsWith("%") ? 100 : 1);
1097
- }, je = (t2) => Math.min(Math.round(t2), 255).toString(16).toUpperCase().padStart(2, "0"), Fe = (t2) => {
1099
+ }, Le = (t2) => Math.min(Math.round(t2), 255).toString(16).toUpperCase().padStart(2, "0"), Re = (t2) => {
1098
1100
  let [e3, s2, i2, r2 = 1] = t2;
1099
1101
  const n2 = Math.round(0.3 * e3 + 0.59 * s2 + 0.11 * i2);
1100
1102
  return [n2, n2, n2, r2];
1101
1103
  };
1102
- class Le {
1104
+ class Ie {
1103
1105
  constructor(e3) {
1104
- if (t(this, "isUnrecognised", false), e3) if (e3 instanceof Le) this.setSource([...e3._source]);
1106
+ if (t(this, "isUnrecognised", false), e3) if (e3 instanceof Ie) this.setSource([...e3._source]);
1105
1107
  else if (Array.isArray(e3)) {
1106
1108
  const [t2, s2, i2, r2 = 1] = e3;
1107
1109
  this.setSource([t2, s2, i2, r2]);
@@ -1109,7 +1111,7 @@ class Le {
1109
1111
  else this.setSource([0, 0, 0, 1]);
1110
1112
  }
1111
1113
  _tryParsingColor(t2) {
1112
- 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];
1114
+ 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];
1113
1115
  }
1114
1116
  getSource() {
1115
1117
  return this._source;
@@ -1125,11 +1127,11 @@ class Le {
1125
1127
  return "rgba(".concat(this.getSource().join(","), ")");
1126
1128
  }
1127
1129
  toHsl() {
1128
- const [t2, e3, s2] = Ee(...this.getSource());
1130
+ const [t2, e3, s2] = je(...this.getSource());
1129
1131
  return "hsl(".concat(t2, ",").concat(e3, "%,").concat(s2, "%)");
1130
1132
  }
1131
1133
  toHsla() {
1132
- const [t2, e3, s2, i2] = Ee(...this.getSource());
1134
+ const [t2, e3, s2, i2] = je(...this.getSource());
1133
1135
  return "hsla(".concat(t2, ",").concat(e3, "%,").concat(s2, "%,").concat(i2, ")");
1134
1136
  }
1135
1137
  toHex() {
@@ -1137,7 +1139,7 @@ class Le {
1137
1139
  }
1138
1140
  toHexa() {
1139
1141
  const [t2, e3, s2, i2] = this.getSource();
1140
- return "".concat(je(t2)).concat(je(e3)).concat(je(s2)).concat(je(Math.round(255 * i2)));
1142
+ return "".concat(Le(t2)).concat(Le(e3)).concat(Le(s2)).concat(Le(Math.round(255 * i2)));
1141
1143
  }
1142
1144
  getAlpha() {
1143
1145
  return this.getSource()[3];
@@ -1146,53 +1148,53 @@ class Le {
1146
1148
  return this._source[3] = t2, this;
1147
1149
  }
1148
1150
  toGrayscale() {
1149
- return this.setSource(Fe(this.getSource())), this;
1151
+ return this.setSource(Re(this.getSource())), this;
1150
1152
  }
1151
1153
  toBlackWhite(t2) {
1152
- const [e3, , , s2] = Fe(this.getSource()), i2 = e3 < (t2 || 127) ? 0 : 255;
1154
+ const [e3, , , s2] = Re(this.getSource()), i2 = e3 < (t2 || 127) ? 0 : 255;
1153
1155
  return this.setSource([i2, i2, i2, s2]), this;
1154
1156
  }
1155
1157
  overlayWith(t2) {
1156
- t2 instanceof Le || (t2 = new Le(t2));
1158
+ t2 instanceof Ie || (t2 = new Ie(t2));
1157
1159
  const e3 = this.getSource(), s2 = t2.getSource(), [i2, r2, n2] = e3.map((t3, e4) => Math.round(0.5 * t3 + 0.5 * s2[e4]));
1158
1160
  return this.setSource([i2, r2, n2, e3[3]]), this;
1159
1161
  }
1160
1162
  static fromRgb(t2) {
1161
- return Le.fromRgba(t2);
1163
+ return Ie.fromRgba(t2);
1162
1164
  }
1163
1165
  static fromRgba(t2) {
1164
- return new Le(Le.sourceFromRgb(t2));
1166
+ return new Ie(Ie.sourceFromRgb(t2));
1165
1167
  }
1166
1168
  static sourceFromRgb(t2) {
1167
- 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);
1169
+ 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);
1168
1170
  if (e3) {
1169
1171
  const [t3, s2, i2] = e3.slice(1, 4).map((t4) => {
1170
1172
  const e4 = parseFloat(t4);
1171
1173
  return t4.endsWith("%") ? Math.round(2.55 * e4) : e4;
1172
1174
  });
1173
- return [t3, s2, i2, Ae(e3[4])];
1175
+ return [t3, s2, i2, Fe(e3[4])];
1174
1176
  }
1175
1177
  }
1176
1178
  static fromHsl(t2) {
1177
- return Le.fromHsla(t2);
1179
+ return Ie.fromHsla(t2);
1178
1180
  }
1179
1181
  static fromHsla(t2) {
1180
- return new Le(Le.sourceFromHsl(t2));
1182
+ return new Ie(Ie.sourceFromHsl(t2));
1181
1183
  }
1182
1184
  static sourceFromHsl(t2) {
1183
- 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);
1185
+ 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);
1184
1186
  if (!e3) return;
1185
- const s2 = (Le.parseAngletoDegrees(e3[1]) % 360 + 360) % 360 / 360, i2 = parseFloat(e3[2]) / 100, r2 = parseFloat(e3[3]) / 100;
1187
+ const s2 = (Ie.parseAngletoDegrees(e3[1]) % 360 + 360) % 360 / 360, i2 = parseFloat(e3[2]) / 100, r2 = parseFloat(e3[3]) / 100;
1186
1188
  let n2, o2, a2;
1187
1189
  if (0 === i2) n2 = o2 = a2 = r2;
1188
1190
  else {
1189
1191
  const t3 = r2 <= 0.5 ? r2 * (i2 + 1) : r2 + i2 - r2 * i2, e4 = 2 * r2 - t3;
1190
- n2 = Pe(e4, t3, s2 + 1 / 3), o2 = Pe(e4, t3, s2), a2 = Pe(e4, t3, s2 - 1 / 3);
1192
+ n2 = Ae(e4, t3, s2 + 1 / 3), o2 = Ae(e4, t3, s2), a2 = Ae(e4, t3, s2 - 1 / 3);
1191
1193
  }
1192
- return [Math.round(255 * n2), Math.round(255 * o2), Math.round(255 * a2), Ae(e3[4])];
1194
+ return [Math.round(255 * n2), Math.round(255 * o2), Math.round(255 * a2), Fe(e3[4])];
1193
1195
  }
1194
1196
  static fromHex(t2) {
1195
- return new Le(Le.sourceFromHex(t2));
1197
+ return new Ie(Ie.sourceFromHex(t2));
1196
1198
  }
1197
1199
  static sourceFromHex(t2) {
1198
1200
  if (t2.match(/^#?(([0-9a-f]){3,4}|([0-9a-f]{2}){3,4})$/i)) {
@@ -1208,7 +1210,7 @@ class Le {
1208
1210
  return e3.includes("rad") ? Ct(s2) : e3.includes("turn") ? 360 * s2 : s2;
1209
1211
  }
1210
1212
  }
1211
- const Re = function(t2) {
1213
+ const Be = function(t2) {
1212
1214
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : O;
1213
1215
  const s2 = /\D{0,2}$/.exec(t2), i2 = parseFloat(t2), r2 = o.DPI;
1214
1216
  switch (null == s2 ? void 0 : s2[0]) {
@@ -1227,24 +1229,24 @@ const Re = function(t2) {
1227
1229
  default:
1228
1230
  return i2;
1229
1231
  }
1230
- }, Be = (t2) => {
1232
+ }, Xe = (t2) => {
1231
1233
  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"];
1232
1234
  var n2;
1233
1235
  return { meetOrSlice: s2 || "meet", alignX: i2, alignY: r2 };
1234
- }, Ie = function(t2, e3) {
1236
+ }, Ye = function(t2, e3) {
1235
1237
  let s2, i2, r2 = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];
1236
1238
  if (e3) if (e3.toLive) s2 = "url(#SVGID_".concat(e3.id, ")");
1237
1239
  else {
1238
- const t3 = new Le(e3), r3 = t3.getAlpha();
1240
+ const t3 = new Ie(e3), r3 = t3.getAlpha();
1239
1241
  s2 = t3.toRgb(), 1 !== r3 && (i2 = r3.toString());
1240
1242
  }
1241
1243
  else s2 = "none";
1242
1244
  return r2 ? "".concat(t2, ": ").concat(s2, "; ").concat(i2 ? "".concat(t2, "-opacity: ").concat(i2, "; ") : "") : "".concat(t2, '="').concat(s2, '" ').concat(i2 ? "".concat(t2, '-opacity="').concat(i2, '" ') : "");
1243
1245
  };
1244
- class Xe {
1246
+ class We {
1245
1247
  getSvgStyles(t2) {
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 = Ie(K, this.fill);
1247
- 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("");
1248
+ 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);
1249
+ 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("");
1248
1250
  }
1249
1251
  getSvgFilter() {
1250
1252
  return this.shadow ? "filter: url(#SVGID_".concat(this.shadow.id, ");") : "";
@@ -1283,52 +1285,55 @@ class Xe {
1283
1285
  return this.paintFirst !== K ? ' paint-order="'.concat(this.paintFirst, '" ') : "";
1284
1286
  }
1285
1287
  }
1286
- function Ye(t2) {
1288
+ function Ve(t2) {
1287
1289
  return new RegExp("^(" + t2.join("|") + ")\\b", "i");
1288
1290
  }
1289
- var We;
1290
- 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";
1291
- Ye(["path", "circle", "polygon", "polyline", "ellipse", "rect", "line", "image", "text"]);
1292
- Ye(["symbol", "image", "marker", "pattern", "view", "svg"]);
1293
- 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) {
1291
+ 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";
1292
+ var ts, es, ss;
1293
+ 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";
1294
+ Ve(["path", "circle", "polygon", "polyline", "ellipse", "rect", "line", "image", "text"]);
1295
+ Ve(["symbol", "image", "marker", "pattern", "view", "svg"]);
1296
+ const ds = Ve(["symbol", "g", "a", "svg", "clipPath", "defs"]);
1297
+ new RegExp(String.raw(ss || (ss = r(["^s*(", ")", "(", ")", "(", ")", "(", ")s*$"], ["^\\s*(", ")", "(", ")", "(", ")", "(", ")\\s*$"])), is, rs, is, rs, is, rs, is));
1298
+ 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) {
1294
1299
  let e3 = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
1295
- return ns(new ot(-t2.y, t2.x).scalarMultiply(e3 ? 1 : -1));
1296
- }, 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) => {
1300
+ return Cs(new ot(-t2.y, t2.x).scalarMultiply(e3 ? 1 : -1));
1301
+ }, 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) => {
1297
1302
  if (t2.eq(e3) || t2.eq(s2)) return true;
1298
- const i2 = as(e3, s2), r2 = as(e3, t2), n2 = as(s2, t2);
1303
+ const i2 = Ss(e3, s2), r2 = Ss(e3, t2), n2 = Ss(s2, t2);
1299
1304
  return i2 >= 0 ? r2 >= 0 && n2 <= 0 : !(r2 <= 0 && n2 >= 0);
1300
- }, ls = "(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?", us = new RegExp("(?:\\s|^)" + ls + ls + "(" + Ve + "?(?:px)?)?(?:\\s?|$)(?:$|\\s)");
1301
- class ds {
1305
+ }, Os = "(-?\\d+(?:\\.\\d*)?(?:px)?(?:\\s?|$))?", ks = new RegExp("(?:\\s|^)" + Os + Os + "(" + is + "?(?:px)?)?(?:\\s?|$)(?:$|\\s)");
1306
+ class Ds {
1302
1307
  constructor(t2) {
1303
- const e3 = "string" == typeof t2 ? ds.parseShadow(t2) : t2;
1304
- Object.assign(this, ds.ownDefaults, e3), this.id = ft();
1308
+ const e3 = "string" == typeof t2 ? Ds.parseShadow(t2) : t2;
1309
+ Object.assign(this, Ds.ownDefaults, e3), this.id = ft();
1305
1310
  }
1306
1311
  static parseShadow(t2) {
1307
- const e3 = t2.trim(), [, s2 = 0, i2 = 0, r2 = 0] = (us.exec(e3) || []).map((t3) => parseFloat(t3) || 0);
1308
- return { color: (e3.replace(us, "") || "rgb(0,0,0)").trim(), offsetX: s2, offsetY: i2, blur: r2 };
1312
+ const e3 = t2.trim(), [, s2 = 0, i2 = 0, r2 = 0] = (ks.exec(e3) || []).map((t3) => parseFloat(t3) || 0);
1313
+ return { color: (e3.replace(ks, "") || "rgb(0,0,0)").trim(), offsetX: s2, offsetY: i2, blur: r2 };
1309
1314
  }
1310
1315
  toString() {
1311
1316
  return [this.offsetX, this.offsetY, this.blur, this.color].join("px ");
1312
1317
  }
1313
1318
  toSVG(t2) {
1314
- const e3 = ts(new ot(this.offsetX, this.offsetY), xt(-t2.angle)), s2 = new Le(this.color);
1319
+ const e3 = ms(new ot(this.offsetX, this.offsetY), xt(-t2.angle)), s2 = new Ie(this.color);
1315
1320
  let i2 = 40, r2 = 40;
1316
1321
  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');
1317
1322
  }
1318
1323
  toObject() {
1319
- 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;
1324
+ 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;
1320
1325
  return this.includeDefaultValues ? t2 : Wt(t2, (t3, s2) => t3 !== e3[s2]);
1321
1326
  }
1322
1327
  static async fromObject(t2) {
1323
1328
  return new this(t2);
1324
1329
  }
1325
1330
  }
1326
- 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");
1327
- 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;
1328
- const Ss = () => false;
1329
- class ws {
1331
+ 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");
1332
+ 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;
1333
+ const Xs = () => false;
1334
+ class Ys {
1330
1335
  constructor(e3) {
1331
- 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;
1336
+ 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;
1332
1337
  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);
1333
1338
  }
1334
1339
  get state() {
@@ -1359,49 +1364,49 @@ class ws {
1359
1364
  this._state = "aborted", this.unregister();
1360
1365
  }
1361
1366
  }
1362
- const Ts = ["startValue", "endValue"];
1363
- class Os extends ws {
1367
+ const Ws = ["startValue", "endValue"];
1368
+ class Vs extends Ys {
1364
1369
  constructor(t2) {
1365
1370
  let { startValue: e3 = 0, endValue: r2 = 100 } = t2;
1366
- super(s(s({}, i(t2, Ts)), {}, { startValue: e3, byValue: r2 - e3 }));
1371
+ super(s(s({}, i(t2, Ws)), {}, { startValue: e3, byValue: r2 - e3 }));
1367
1372
  }
1368
1373
  calculate(t2) {
1369
1374
  const e3 = this.easing(t2, this.startValue, this.byValue, this.duration);
1370
1375
  return { value: e3, valueProgress: Math.abs((e3 - this.startValue) / this.byValue) };
1371
1376
  }
1372
1377
  }
1373
- const ks = ["startValue", "endValue"];
1374
- class Ds extends ws {
1378
+ const zs = ["startValue", "endValue"];
1379
+ class Gs extends Ys {
1375
1380
  constructor(t2) {
1376
1381
  let { startValue: e3 = [0], endValue: r2 = [100] } = t2;
1377
- super(s(s({}, i(t2, ks)), {}, { startValue: e3, byValue: r2.map((t3, s2) => t3 - e3[s2]) }));
1382
+ super(s(s({}, i(t2, zs)), {}, { startValue: e3, byValue: r2.map((t3, s2) => t3 - e3[s2]) }));
1378
1383
  }
1379
1384
  calculate(t2) {
1380
1385
  const e3 = this.startValue.map((e4, s2) => this.easing(t2, e4, this.byValue[s2], this.duration, s2));
1381
1386
  return { value: e3, valueProgress: Math.abs((e3[0] - this.startValue[0]) / this.byValue[0]) };
1382
1387
  }
1383
1388
  }
1384
- 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));
1385
- class As extends ws {
1389
+ 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));
1390
+ class qs extends Ys {
1386
1391
  constructor(t2) {
1387
- let { startValue: e3, endValue: r2, easing: n2 = Ps, onChange: o2, onComplete: a2, abort: h2 } = t2, c2 = i(t2, Ms);
1388
- const l2 = new Le(e3).getSource(), u2 = new Le(r2).getSource();
1389
- 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) }));
1392
+ let { startValue: e3, endValue: r2, easing: n2 = Ns, onChange: o2, onComplete: a2, abort: h2 } = t2, c2 = i(t2, Hs);
1393
+ const l2 = new Ie(e3).getSource(), u2 = new Ie(r2).getSource();
1394
+ 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) }));
1390
1395
  }
1391
1396
  calculate(t2) {
1392
- 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)];
1397
+ 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)];
1393
1398
  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 };
1394
1399
  }
1395
1400
  }
1396
- function js(t2) {
1397
- const e3 = ((t3) => Array.isArray(t3.startValue) || Array.isArray(t3.endValue))(t2) ? new Ds(t2) : new Os(t2);
1401
+ function Ks(t2) {
1402
+ const e3 = ((t3) => Array.isArray(t3.startValue) || Array.isArray(t3.endValue))(t2) ? new Gs(t2) : new Vs(t2);
1398
1403
  return e3.start(), e3;
1399
1404
  }
1400
- function Fs(t2) {
1401
- const e3 = new As(t2);
1405
+ function Js(t2) {
1406
+ const e3 = new qs(t2);
1402
1407
  return e3.start(), e3;
1403
1408
  }
1404
- class Ls {
1409
+ class Qs {
1405
1410
  constructor(t2) {
1406
1411
  this.status = t2, this.points = [];
1407
1412
  }
@@ -1418,7 +1423,7 @@ class Ls {
1418
1423
  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));
1419
1424
  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));
1420
1425
  {
1421
- const r2 = es(e3, s2), n2 = es(e3, t2).divide(r2);
1426
+ const r2 = vs(e3, s2), n2 = vs(e3, t2).divide(r2);
1422
1427
  return i2 ? Math.abs(n2.x) === Math.abs(n2.y) : n2.x === n2.y && n2.x >= 0 && n2.x <= 1;
1423
1428
  }
1424
1429
  }
@@ -1437,46 +1442,46 @@ class Ls {
1437
1442
  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;
1438
1443
  if (0 !== f) {
1439
1444
  const e4 = d2 / f, s3 = g2 / f;
1440
- 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();
1445
+ 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();
1441
1446
  }
1442
1447
  if (0 === d2 || 0 === g2) {
1443
- const o3 = r2 || n2 || Ls.isPointContained(t2, s2, i2) || Ls.isPointContained(e3, s2, i2) || Ls.isPointContained(s2, t2, e3) || Ls.isPointContained(i2, t2, e3);
1444
- return new Ls(o3 ? "Coincident" : void 0);
1448
+ const o3 = r2 || n2 || Qs.isPointContained(t2, s2, i2) || Qs.isPointContained(e3, s2, i2) || Qs.isPointContained(s2, t2, e3) || Qs.isPointContained(i2, t2, e3);
1449
+ return new Qs(o3 ? "Coincident" : void 0);
1445
1450
  }
1446
- return new Ls("Parallel");
1451
+ return new Qs("Parallel");
1447
1452
  }
1448
1453
  static intersectSegmentLine(t2, e3, s2, i2) {
1449
- return Ls.intersectLineLine(t2, e3, s2, i2, false, true);
1454
+ return Qs.intersectLineLine(t2, e3, s2, i2, false, true);
1450
1455
  }
1451
1456
  static intersectSegmentSegment(t2, e3, s2, i2) {
1452
- return Ls.intersectLineLine(t2, e3, s2, i2, false, false);
1457
+ return Qs.intersectLineLine(t2, e3, s2, i2, false, false);
1453
1458
  }
1454
1459
  static intersectLinePolygon(t2, e3, s2) {
1455
1460
  let i2 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3];
1456
- const r2 = new Ls(), n2 = s2.length;
1461
+ const r2 = new Qs(), n2 = s2.length;
1457
1462
  for (let o2, a2, h2, c2 = 0; c2 < n2; c2++) {
1458
- if (o2 = s2[c2], a2 = s2[(c2 + 1) % n2], h2 = Ls.intersectLineLine(t2, e3, o2, a2, i2, false), "Coincident" === h2.status) return h2;
1463
+ if (o2 = s2[c2], a2 = s2[(c2 + 1) % n2], h2 = Qs.intersectLineLine(t2, e3, o2, a2, i2, false), "Coincident" === h2.status) return h2;
1459
1464
  r2.append(...h2.points);
1460
1465
  }
1461
1466
  return r2.points.length > 0 && (r2.status = "Intersection"), r2;
1462
1467
  }
1463
1468
  static intersectSegmentPolygon(t2, e3, s2) {
1464
- return Ls.intersectLinePolygon(t2, e3, s2, false);
1469
+ return Qs.intersectLinePolygon(t2, e3, s2, false);
1465
1470
  }
1466
1471
  static intersectPolygonPolygon(t2, e3) {
1467
- const s2 = new Ls(), i2 = t2.length, r2 = [];
1472
+ const s2 = new Qs(), i2 = t2.length, r2 = [];
1468
1473
  for (let n2 = 0; n2 < i2; n2++) {
1469
- const o2 = t2[n2], a2 = t2[(n2 + 1) % i2], h2 = Ls.intersectSegmentPolygon(o2, a2, e3);
1474
+ const o2 = t2[n2], a2 = t2[(n2 + 1) % i2], h2 = Qs.intersectSegmentPolygon(o2, a2, e3);
1470
1475
  "Coincident" === h2.status ? (r2.push(h2), s2.append(o2, a2)) : s2.append(...h2.points);
1471
1476
  }
1472
- return r2.length > 0 && r2.length === t2.length ? new Ls("Coincident") : (s2.points.length > 0 && (s2.status = "Intersection"), s2);
1477
+ return r2.length > 0 && r2.length === t2.length ? new Qs("Coincident") : (s2.points.length > 0 && (s2.status = "Intersection"), s2);
1473
1478
  }
1474
1479
  static intersectPolygonRectangle(t2, e3, s2) {
1475
1480
  const i2 = e3.min(s2), r2 = e3.max(s2), n2 = new ot(r2.x, i2.y), o2 = new ot(i2.x, r2.y);
1476
- return Ls.intersectPolygonPolygon(t2, [i2, n2, r2, o2]);
1481
+ return Qs.intersectPolygonPolygon(t2, [i2, n2, r2, o2]);
1477
1482
  }
1478
1483
  }
1479
- class Rs extends lt {
1484
+ class Zs extends lt {
1480
1485
  getX() {
1481
1486
  return this.getXY().x;
1482
1487
  }
@@ -1527,10 +1532,10 @@ class Rs extends lt {
1527
1532
  return r2;
1528
1533
  }
1529
1534
  intersectsWithRect(t2, e3) {
1530
- return "Intersection" === Ls.intersectPolygonRectangle(this.getCoords(), t2, e3).status;
1535
+ return "Intersection" === Qs.intersectPolygonRectangle(this.getCoords(), t2, e3).status;
1531
1536
  }
1532
1537
  intersectsWithObject(t2) {
1533
- const e3 = Ls.intersectPolygonPolygon(this.getCoords(), t2.getCoords());
1538
+ const e3 = Qs.intersectPolygonPolygon(this.getCoords(), t2.getCoords());
1534
1539
  return "Intersection" === e3.status || "Coincident" === e3.status || t2.isContainedWithinObject(this) || this.isContainedWithinObject(t2);
1535
1540
  }
1536
1541
  isContainedWithinObject(t2) {
@@ -1544,7 +1549,7 @@ class Rs extends lt {
1544
1549
  return this.intersectsWithObject(t2) || this.isContainedWithinObject(t2) || t2.isContainedWithinObject(this);
1545
1550
  }
1546
1551
  containsPoint(t2) {
1547
- return Ls.isPointInPolygon(t2, this.getCoords());
1552
+ return Qs.isPointInPolygon(t2, this.getCoords());
1548
1553
  }
1549
1554
  isOnScreen() {
1550
1555
  if (!this.canvas) return false;
@@ -1558,7 +1563,7 @@ class Rs extends lt {
1558
1563
  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));
1559
1564
  }
1560
1565
  getBoundingRect() {
1561
- return ae(this.getCoords());
1566
+ return he(this.getCoords());
1562
1567
  }
1563
1568
  getScaledWidth() {
1564
1569
  return this._getTransformedDimensions().x;
@@ -1597,7 +1602,7 @@ class Rs extends lt {
1597
1602
  }
1598
1603
  transformMatrixKey() {
1599
1604
  let t2 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], e3 = [];
1600
- 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;
1605
+ 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;
1601
1606
  }
1602
1607
  calcTransformMatrix() {
1603
1608
  let t2 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], e3 = this.calcOwnMatrix();
@@ -1624,11 +1629,11 @@ class Rs extends lt {
1624
1629
  this.strokeUniform && (r2 = 0, n2 = i2);
1625
1630
  const o2 = e3.width + r2, a2 = e3.height + r2;
1626
1631
  let h2;
1627
- return h2 = 0 === e3.skewX && 0 === e3.skewY ? new ot(o2 * e3.scaleX, a2 * e3.scaleY) : ge(o2, a2, Lt(e3)), h2.scalarAdd(n2);
1632
+ return h2 = 0 === e3.skewX && 0 === e3.skewY ? new ot(o2 * e3.scaleX, a2 * e3.scaleY) : fe(o2, a2, Lt(e3)), h2.scalarAdd(n2);
1628
1633
  }
1629
1634
  translateToGivenOrigin(t2, e3, s2, i2, r2) {
1630
1635
  let n2 = t2.x, o2 = t2.y;
1631
- const a2 = xe(i2) - xe(e3), h2 = xe(r2) - xe(s2);
1636
+ const a2 = Ce(i2) - Ce(e3), h2 = Ce(r2) - Ce(s2);
1632
1637
  if (a2 || h2) {
1633
1638
  const t3 = this._getTransformedDimensions();
1634
1639
  n2 += a2 * t3.x, o2 += h2 * t3.y;
@@ -1662,8 +1667,8 @@ class Rs extends lt {
1662
1667
  return this.translateToOriginPoint(this.getRelativeCenterPoint(), M, P);
1663
1668
  }
1664
1669
  }
1665
- const Bs = ["type"], Is = ["extraParam"];
1666
- let Xs = class e2 extends Rs {
1670
+ const $s = ["type"], ti = ["extraParam"];
1671
+ let ei = class e2 extends Zs {
1667
1672
  static getDefaults() {
1668
1673
  return e2.ownDefaults;
1669
1674
  }
@@ -1683,7 +1688,7 @@ let Xs = class e2 extends Rs {
1683
1688
  _limitCacheSize(t2) {
1684
1689
  const e3 = t2.width, s2 = t2.height, i2 = o.maxCacheSideLimit, r2 = o.minCacheSideLimit;
1685
1690
  if (e3 <= i2 && s2 <= i2 && e3 * s2 <= o.perfLimitSizeTotal) return e3 < r2 && (t2.width = r2), s2 < r2 && (t2.height = r2), t2;
1686
- const n2 = e3 / s2, [a2, h2] = _.limitDimsByArea(n2), c2 = gs(r2, a2, i2), l2 = gs(r2, h2, i2);
1691
+ const n2 = e3 / s2, [a2, h2] = _.limitDimsByArea(n2), c2 = Ms(r2, a2, i2), l2 = Ms(r2, h2, i2);
1687
1692
  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;
1688
1693
  }
1689
1694
  _getCacheCanvasDimensions() {
@@ -1729,7 +1734,7 @@ let Xs = class e2 extends Rs {
1729
1734
  return Math.abs(t2) < this.minScaleLimit ? t2 < 0 ? -this.minScaleLimit : this.minScaleLimit : 0 === t2 ? 1e-4 : t2;
1730
1735
  }
1731
1736
  _set(t2, e3) {
1732
- 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));
1737
+ 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));
1733
1738
  const s2 = this[t2] !== e3;
1734
1739
  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;
1735
1740
  }
@@ -1867,8 +1872,8 @@ let Xs = class e2 extends Rs {
1867
1872
  }
1868
1873
  toCanvasElement() {
1869
1874
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
1870
- 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 }));
1871
- delete this.group, t2.withoutTransform && ue(this), t2.withoutShadow && (this.shadow = null), t2.viewportTransform && ve(this, this.getViewportTransform()), this.setCoords();
1875
+ 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 }));
1876
+ delete this.group, t2.withoutTransform && de(this), t2.withoutShadow && (this.shadow = null), t2.viewportTransform && ye(this, this.getViewportTransform()), this.setCoords();
1872
1877
  const h2 = pt(), c2 = this.getBoundingRect(), l2 = this.shadow, u2 = new ot();
1873
1878
  if (l2) {
1874
1879
  const t3 = l2.blur, e4 = l2.nonScaling ? new ot(1, 1) : this.getObjectScaling();
@@ -1933,7 +1938,7 @@ let Xs = class e2 extends Rs {
1933
1938
  }, onComplete: (t3, e4, s2) => {
1934
1939
  this.setCoords(), c2 && c2(t3, e4, s2);
1935
1940
  } });
1936
- return n2 ? Fs(l2) : js(l2);
1941
+ return n2 ? Js(l2) : Ks(l2);
1937
1942
  }
1938
1943
  isDescendantOf(t2) {
1939
1944
  const { parent: e3, group: s2 } = this;
@@ -1979,8 +1984,8 @@ let Xs = class e2 extends Rs {
1979
1984
  let i2;
1980
1985
  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;
1981
1986
  n2 && !n2.excludeFromExport && (i2 = n2.toObject(t2.concat("inverted", "absolutePositioned")));
1982
- 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);
1983
- return this.includeDefaultValues ? I2 : this._removeDefaultValues(I2);
1987
+ 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);
1988
+ return this.includeDefaultValues ? B2 : this._removeDefaultValues(B2);
1984
1989
  }
1985
1990
  toDatalessObject(t2) {
1986
1991
  return this.toObject(t2);
@@ -1997,53 +2002,53 @@ let Xs = class e2 extends Rs {
1997
2002
  return "#<".concat(this.constructor.type, ">");
1998
2003
  }
1999
2004
  static _fromObject(t2) {
2000
- let e3 = i(t2, Bs), s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { extraParam: r2 } = s2, n2 = i(s2, Is);
2005
+ let e3 = i(t2, $s), s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { extraParam: r2 } = s2, n2 = i(s2, ti);
2001
2006
  return Xt(e3, n2).then((t3) => r2 ? (delete t3[r2], new this(e3[r2], t3)) : new this(t3));
2002
2007
  }
2003
2008
  static fromObject(t2, e3) {
2004
2009
  return this._fromObject(t2, e3);
2005
2010
  }
2006
2011
  };
2007
- 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");
2008
- const Ys = (t2, e3, i2) => (r2, n2, o2, a2) => {
2012
+ 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");
2013
+ const si = (t2, e3, i2) => (r2, n2, o2, a2) => {
2009
2014
  const h2 = e3(r2, n2, o2, a2);
2010
- return h2 && ye(t2, s(s({}, Te(r2, n2, o2, a2)), i2)), h2;
2015
+ return h2 && _e(t2, s(s({}, Oe(r2, n2, o2, a2)), i2)), h2;
2011
2016
  };
2012
- function Ws(t2) {
2017
+ function ii(t2) {
2013
2018
  return (e3, s2, i2, r2) => {
2014
2019
  const { target: n2, originX: o2, originY: a2 } = s2, h2 = n2.getRelativeCenterPoint(), c2 = n2.translateToOriginPoint(h2, o2, a2), l2 = t2(e3, s2, i2, r2);
2015
2020
  return n2.setPositionByOrigin(c2, s2.originX, s2.originY), l2;
2016
2021
  };
2017
2022
  }
2018
- const Vs = Ys(Y, Ws((t2, e3, s2, i2) => {
2019
- const r2 = ke(e3, e3.originX, e3.originY, s2, i2);
2020
- if (xe(e3.originX) === xe(D) || xe(e3.originX) === xe(A) && r2.x < 0 || xe(e3.originX) === xe(M) && r2.x > 0) {
2021
- 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;
2023
+ const ri = si(Y, ii((t2, e3, s2, i2) => {
2024
+ const r2 = De(e3, e3.originX, e3.originY, s2, i2);
2025
+ if (Ce(e3.originX) === Ce(D) || Ce(e3.originX) === Ce(A) && r2.x < 0 || Ce(e3.originX) === Ce(M) && r2.x > 0) {
2026
+ 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;
2022
2027
  return t3.set("width", Math.max(o2, 1)), n2 !== t3.width;
2023
2028
  }
2024
2029
  return false;
2025
2030
  }));
2026
- function zs(t2, e3, s2, i2, r2) {
2031
+ function ni(t2, e3, s2, i2, r2) {
2027
2032
  i2 = i2 || {};
2028
2033
  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);
2029
2034
  let l2, u2 = e3, d2 = s2;
2030
2035
  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();
2031
2036
  }
2032
- function Gs(t2, e3, s2, i2, r2) {
2037
+ function oi(t2, e3, s2, i2, r2) {
2033
2038
  i2 = i2 || {};
2034
2039
  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;
2035
2040
  t2.save(), t2.fillStyle = i2.cornerColor || r2.cornerColor || "", t2.strokeStyle = i2.cornerStrokeColor || r2.cornerStrokeColor || "", t2.translate(e3, s2);
2036
2041
  const d2 = r2.getTotalAngle();
2037
2042
  t2.rotate(xt(d2)), t2["".concat(h2, "Rect")](-l2, -u2, n2, o2), c2 && t2.strokeRect(-l2, -u2, n2, o2), t2.restore();
2038
2043
  }
2039
- class Hs {
2044
+ class ai {
2040
2045
  constructor(e3) {
2041
2046
  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);
2042
2047
  }
2043
2048
  shouldActivate(t2, e3, s2, i2) {
2044
2049
  var r2;
2045
2050
  let { tl: n2, tr: o2, br: a2, bl: h2 } = i2;
2046
- return (null === (r2 = e3.canvas) || void 0 === r2 ? void 0 : r2.getActiveObject()) === e3 && e3.isControlVisible(t2) && Ls.isPointInPolygon(s2, [n2, o2, a2, h2]);
2051
+ return (null === (r2 = e3.canvas) || void 0 === r2 ? void 0 : r2.getActiveObject()) === e3 && e3.isControlVisible(t2) && Qs.isPointInPolygon(s2, [n2, o2, a2, h2]);
2047
2052
  }
2048
2053
  getActionHandler(t2, e3, s2) {
2049
2054
  return this.actionHandler;
@@ -2075,14 +2080,14 @@ class Hs {
2075
2080
  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) };
2076
2081
  }
2077
2082
  render(t2, e3, s2, i2, r2) {
2078
- if ("circle" === ((i2 = i2 || {}).cornerStyle || r2.cornerStyle)) zs.call(this, t2, e3, s2, i2, r2);
2079
- else Gs.call(this, t2, e3, s2, i2, r2);
2083
+ if ("circle" === ((i2 = i2 || {}).cornerStyle || r2.cornerStyle)) ni.call(this, t2, e3, s2, i2, r2);
2084
+ else oi.call(this, t2, e3, s2, i2, r2);
2080
2085
  }
2081
2086
  }
2082
- const Ns = (t2, e3, s2) => s2.lockRotation ? Ce : e3.cursorStyle, Us = Ys(B, Ws((t2, e3, s2, i2) => {
2087
+ const hi = (t2, e3, s2) => s2.lockRotation ? be : e3.cursorStyle, ci = si(I, ii((t2, e3, s2, i2) => {
2083
2088
  let { target: r2, ex: n2, ey: o2, theta: a2, originX: h2, originY: c2 } = e3;
2084
2089
  const l2 = r2.translateToOriginPoint(r2.getRelativeCenterPoint(), h2, c2);
2085
- if (we(r2, "lockRotation")) return false;
2090
+ if (Te(r2, "lockRotation")) return false;
2086
2091
  const u2 = Math.atan2(o2 - l2.y, n2 - l2.x), d2 = Math.atan2(i2 - l2.y, s2 - l2.x);
2087
2092
  let g2 = Ct(d2 - u2 + a2);
2088
2093
  if (r2.snapAngle && r2.snapAngle > 0) {
@@ -2093,12 +2098,12 @@ const Ns = (t2, e3, s2) => s2.lockRotation ? Ce : e3.cursorStyle, Us = Ys(B, Ws(
2093
2098
  const f = r2.angle !== g2;
2094
2099
  return r2.angle = g2, f;
2095
2100
  }));
2096
- function qs(t2, e3) {
2101
+ function li(t2, e3) {
2097
2102
  const s2 = e3.canvas, i2 = t2[s2.uniScaleKey];
2098
2103
  return s2.uniformScaling && !i2 || !s2.uniformScaling && i2;
2099
2104
  }
2100
- function Ks(t2, e3, s2) {
2101
- const i2 = we(t2, "lockScalingX"), r2 = we(t2, "lockScalingY");
2105
+ function ui(t2, e3, s2) {
2106
+ const i2 = Te(t2, "lockScalingX"), r2 = Te(t2, "lockScalingY");
2102
2107
  if (i2 && r2) return true;
2103
2108
  if (!e3 && (i2 || r2) && s2) return true;
2104
2109
  if (i2 && "x" === e3) return true;
@@ -2106,41 +2111,41 @@ function Ks(t2, e3, s2) {
2106
2111
  const { width: n2, height: o2, strokeWidth: a2 } = t2;
2107
2112
  return 0 === n2 && 0 === a2 && "y" !== e3 || 0 === o2 && 0 === a2 && "x" !== e3;
2108
2113
  }
2109
- const Js = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"], Qs = (t2, e3, s2) => {
2110
- const i2 = qs(t2, s2);
2111
- if (Ks(s2, 0 !== e3.x && 0 === e3.y ? "x" : 0 === e3.x && 0 !== e3.y ? "y" : "", i2)) return Ce;
2112
- const r2 = Oe(s2, e3);
2113
- return "".concat(Js[r2], "-resize");
2114
+ const di = ["e", "se", "s", "sw", "w", "nw", "n", "ne", "e"], gi = (t2, e3, s2) => {
2115
+ const i2 = li(t2, s2);
2116
+ if (ui(s2, 0 !== e3.x && 0 === e3.y ? "x" : 0 === e3.x && 0 !== e3.y ? "y" : "", i2)) return be;
2117
+ const r2 = ke(s2, e3);
2118
+ return "".concat(di[r2], "-resize");
2114
2119
  };
2115
- function Zs(t2, e3, s2, i2) {
2120
+ function fi(t2, e3, s2, i2) {
2116
2121
  let r2 = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {};
2117
- const n2 = e3.target, o2 = r2.by, a2 = qs(t2, n2);
2122
+ const n2 = e3.target, o2 = r2.by, a2 = li(t2, n2);
2118
2123
  let h2, c2, l2, u2, d2, g2;
2119
- if (Ks(n2, o2, a2)) return false;
2124
+ if (ui(n2, o2, a2)) return false;
2120
2125
  if (e3.gestureScale) c2 = e3.scaleX * e3.gestureScale, l2 = e3.scaleY * e3.gestureScale;
2121
2126
  else {
2122
- 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;
2127
+ 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;
2123
2128
  if (u2 = n2._getTransformedDimensions(), a2 && !o2) {
2124
2129
  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));
2125
2130
  c2 = s3.scaleX * i3, l2 = s3.scaleY * i3;
2126
2131
  } else c2 = Math.abs(h2.x * n2.scaleX / u2.x), l2 = Math.abs(h2.y * n2.scaleY / u2.y);
2127
- 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);
2132
+ 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);
2128
2133
  }
2129
2134
  const f = n2.scaleX, p2 = n2.scaleY;
2130
- 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;
2135
+ 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;
2131
2136
  }
2132
- 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) => {
2133
- if (0 !== e3.x && we(s2, "lockSkewingY")) return Ce;
2134
- if (0 !== e3.y && we(s2, "lockSkewingX")) return Ce;
2135
- const i2 = Oe(s2, e3) % 4;
2136
- return "".concat(ri[i2], "-resize");
2137
+ 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) => {
2138
+ if (0 !== e3.x && Te(s2, "lockSkewingY")) return be;
2139
+ if (0 !== e3.y && Te(s2, "lockSkewingX")) return be;
2140
+ const i2 = ke(s2, e3) % 4;
2141
+ return "".concat(xi[i2], "-resize");
2137
2142
  };
2138
- function oi(t2, e3, r2, n2, o2) {
2139
- const { target: a2 } = r2, { counterAxis: h2, origin: c2, lockSkewing: l2, skew: u2, flip: d2 } = ii[t2];
2140
- if (we(a2, l2)) return false;
2141
- 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) {
2142
- let { target: r4, ex: n4, ey: o3, skewingSide: a3 } = e5, h3 = i(e5, si);
2143
- 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));
2143
+ function bi(t2, e3, r2, n2, o2) {
2144
+ const { target: a2 } = r2, { counterAxis: h2, origin: c2, lockSkewing: l2, skew: u2, flip: d2 } = _i[t2];
2145
+ if (Te(a2, l2)) return false;
2146
+ 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) {
2147
+ let { target: r4, ex: n4, ey: o3, skewingSide: a3 } = e5, h3 = i(e5, yi);
2148
+ 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));
2144
2149
  r4.set(c3, m3);
2145
2150
  const v3 = u3 !== r4[c3];
2146
2151
  if (v3 && "y" === t3) {
@@ -2151,23 +2156,23 @@ function oi(t2, e3, r2, n2, o2) {
2151
2156
  }(t2, s2, new ot(r3, n3))));
2152
2157
  return y2(e3, s(s({}, r2), {}, { [c2]: v2, skewingSide: m2 }), n2, o2);
2153
2158
  }
2154
- const ai = (t2, e3, s2, i2) => oi("x", t2, e3, s2, i2), hi = (t2, e3, s2, i2) => oi("y", t2, e3, s2, i2);
2155
- function ci(t2, e3) {
2159
+ const Si = (t2, e3, s2, i2) => bi("x", t2, e3, s2, i2), wi = (t2, e3, s2, i2) => bi("y", t2, e3, s2, i2);
2160
+ function Ti(t2, e3) {
2156
2161
  return t2[e3.canvas.altActionKey];
2157
2162
  }
2158
- const li = (t2, e3, s2) => {
2159
- const i2 = ci(t2, s2);
2163
+ const Oi = (t2, e3, s2) => {
2164
+ const i2 = Ti(t2, s2);
2160
2165
  return 0 === e3.x ? i2 ? U : N : 0 === e3.y ? i2 ? q : H : "";
2161
- }, 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());
2162
- class vi extends Xs {
2166
+ }, 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());
2167
+ class ji extends ei {
2163
2168
  static getDefaults() {
2164
- return s(s({}, super.getDefaults()), vi.ownDefaults);
2169
+ return s(s({}, super.getDefaults()), ji.ownDefaults);
2165
2170
  }
2166
2171
  constructor(t2) {
2167
- super(), Object.assign(this, this.constructor.createControls(), vi.ownDefaults), this.setOptions(t2);
2172
+ super(), Object.assign(this, this.constructor.createControls(), ji.ownDefaults), this.setOptions(t2);
2168
2173
  }
2169
2174
  static createControls() {
2170
- return { controls: fi() };
2175
+ return { controls: Pi() };
2171
2176
  }
2172
2177
  _updateCacheCanvas() {
2173
2178
  const t2 = this.canvas;
@@ -2232,7 +2237,7 @@ class vi extends Xs {
2232
2237
  drawBorders(t2, e3, s2) {
2233
2238
  let i2;
2234
2239
  if (s2 && s2.forActiveSelection || this.group) {
2235
- 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);
2240
+ 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);
2236
2241
  i2 = t3.add(s3).scalarAdd(this.borderScaleFactor).scalarAdd(2 * this.padding);
2237
2242
  } else i2 = this._calculateCurrentDimensions().scalarAdd(this.borderScaleFactor);
2238
2243
  this._drawBorders(t2, i2, s2);
@@ -2296,30 +2301,30 @@ class vi extends Xs {
2296
2301
  renderDropTargetEffect(t2) {
2297
2302
  }
2298
2303
  }
2299
- function yi(t2, e3) {
2304
+ function Fi(t2, e3) {
2300
2305
  return e3.forEach((e4) => {
2301
2306
  Object.getOwnPropertyNames(e4.prototype).forEach((s2) => {
2302
2307
  "constructor" !== s2 && Object.defineProperty(t2.prototype, s2, Object.getOwnPropertyDescriptor(e4.prototype, s2) || /* @__PURE__ */ Object.create(null));
2303
2308
  });
2304
2309
  }), t2;
2305
2310
  }
2306
- 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 });
2307
- class _i extends vi {
2311
+ 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 });
2312
+ class Li extends ji {
2308
2313
  }
2309
- yi(_i, [Xe]), tt.setClass(_i), tt.setClass(_i, "object");
2310
- const xi = (t2, e3, s2, i2) => {
2314
+ Fi(Li, [We]), tt.setClass(Li), tt.setClass(Li, "object");
2315
+ const Ri = (t2, e3, s2, i2) => {
2311
2316
  const r2 = 2 * (i2 = Math.round(i2)) + 1, { data: n2 } = t2.getImageData(e3 - i2, s2 - i2, r2, r2);
2312
2317
  for (let t3 = 3; t3 < n2.length; t3 += 4) {
2313
2318
  if (n2[t3] > 0) return false;
2314
2319
  }
2315
2320
  return true;
2316
2321
  };
2317
- class Ci {
2322
+ class Ii {
2318
2323
  constructor(t2) {
2319
2324
  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);
2320
2325
  }
2321
2326
  createSideVector(t2, e3) {
2322
- const s2 = es(t2, e3);
2327
+ const s2 = vs(t2, e3);
2323
2328
  return this.options.strokeUniform ? s2.multiply(this.scale) : s2;
2324
2329
  }
2325
2330
  projectOrthogonally(t2, e3, s2) {
@@ -2336,18 +2341,18 @@ class Ci {
2336
2341
  return t2.multiply(this.strokeUniformScalar).scalarMultiply(e3);
2337
2342
  }
2338
2343
  }
2339
- const bi = new ot();
2340
- class Si extends Ci {
2344
+ const Bi = new ot();
2345
+ class Xi extends Ii {
2341
2346
  static getOrthogonalRotationFactor(t2, e3) {
2342
- const s2 = e3 ? is(t2, e3) : rs(t2);
2347
+ const s2 = e3 ? _s(t2, e3) : xs(t2);
2343
2348
  return Math.abs(s2) < b ? -1 : 1;
2344
2349
  }
2345
2350
  constructor(e3, s2, i2, r2) {
2346
- 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));
2351
+ 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));
2347
2352
  }
2348
2353
  calcOrthogonalProjection(t2, e3) {
2349
2354
  let s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.strokeProjectionMagnitude;
2350
- const i2 = this.createSideVector(t2, e3), r2 = os(i2), n2 = Si.getOrthogonalRotationFactor(r2, this.bisector);
2355
+ const i2 = this.createSideVector(t2, e3), r2 = bs(i2), n2 = Xi.getOrthogonalRotationFactor(r2, this.bisector);
2351
2356
  return this.scaleUnitVector(r2, s2 * n2);
2352
2357
  }
2353
2358
  projectBevel() {
@@ -2357,25 +2362,25 @@ class Si extends Ci {
2357
2362
  }), t2;
2358
2363
  }
2359
2364
  projectMiter() {
2360
- 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;
2361
- return ss(i2) / this.strokeProjectionMagnitude <= r2 && t2.push(this.applySkew(this.A.add(i2))), t2.push(...this.projectBevel()), t2;
2365
+ 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;
2366
+ return ys(i2) / this.strokeProjectionMagnitude <= r2 && t2.push(this.applySkew(this.A.add(i2))), t2.push(...this.projectBevel()), t2;
2362
2367
  }
2363
2368
  projectRoundNoSkew(t2, e3) {
2364
- const s2 = [], i2 = new ot(Si.getOrthogonalRotationFactor(this.bisector), Si.getOrthogonalRotationFactor(new ot(this.bisector.y, this.bisector.x)));
2369
+ const s2 = [], i2 = new ot(Xi.getOrthogonalRotationFactor(this.bisector), Xi.getOrthogonalRotationFactor(new ot(this.bisector.y, this.bisector.x)));
2365
2370
  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) => {
2366
- cs(i3, t2, e3) && s2.push(this.A.add(i3));
2371
+ Ts(i3, t2, e3) && s2.push(this.A.add(i3));
2367
2372
  }), s2;
2368
2373
  }
2369
2374
  projectRoundWithSkew(t2, e3) {
2370
2375
  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)));
2371
2376
  return [g2, g2.scalarMultiply(-1), u2, u2.scalarMultiply(-1)].map((t3) => this.applySkew(a2 ? t3.multiply(this.strokeUniformScalar) : t3)).forEach((i3) => {
2372
- cs(i3, t2, e3) && s2.push(this.applySkew(this.A).add(i3));
2377
+ Ts(i3, t2, e3) && s2.push(this.applySkew(this.A).add(i3));
2373
2378
  }), s2;
2374
2379
  }
2375
2380
  projectRound() {
2376
2381
  const t2 = [];
2377
2382
  t2.push(...this.projectBevel());
2378
- 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;
2383
+ 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;
2379
2384
  return this.isSkewed() ? t2.push(...this.projectRoundWithSkew(a2, h2)) : t2.push(...this.projectRoundNoSkew(a2, h2)), t2;
2380
2385
  }
2381
2386
  projectPoints() {
@@ -2392,14 +2397,14 @@ class Si extends Ci {
2392
2397
  return this.projectPoints().map((t2) => ({ originPoint: this.A, projectedPoint: t2, angle: this.alpha, bisector: this.bisector }));
2393
2398
  }
2394
2399
  }
2395
- class wi extends Ci {
2400
+ class Yi extends Ii {
2396
2401
  constructor(t2, e3, s2) {
2397
2402
  super(s2), this.A = new ot(t2), this.T = new ot(e3);
2398
2403
  }
2399
2404
  calcOrthogonalProjection(t2, e3) {
2400
2405
  let s2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.strokeProjectionMagnitude;
2401
2406
  const i2 = this.createSideVector(t2, e3);
2402
- return this.scaleUnitVector(os(i2), s2);
2407
+ return this.scaleUnitVector(bs(i2), s2);
2403
2408
  }
2404
2409
  projectButt() {
2405
2410
  return [this.projectOrthogonally(this.A, this.T, this.strokeProjectionMagnitude), this.projectOrthogonally(this.A, this.T, -this.strokeProjectionMagnitude)];
@@ -2409,7 +2414,7 @@ class wi extends Ci {
2409
2414
  if (!this.isSkewed() && this.A.eq(this.T)) {
2410
2415
  const e3 = new ot(1, 1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);
2411
2416
  t2.push(this.applySkew(this.A.add(e3)), this.applySkew(this.A.subtract(e3)));
2412
- } else t2.push(...new Si(this.A, this.T, this.T, this.options).projectRound());
2417
+ } else t2.push(...new Xi(this.A, this.T, this.T, this.options).projectRound());
2413
2418
  return t2;
2414
2419
  }
2415
2420
  projectSquare() {
@@ -2418,7 +2423,7 @@ class wi extends Ci {
2418
2423
  const e3 = new ot(1, 1).scalarMultiply(this.strokeProjectionMagnitude).multiply(this.strokeUniformScalar);
2419
2424
  t2.push(this.A.add(e3), this.A.subtract(e3));
2420
2425
  } else {
2421
- 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);
2426
+ 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);
2422
2427
  t2.push(i2.add(e3), i2.subtract(e3));
2423
2428
  }
2424
2429
  return t2.map((t3) => this.applySkew(t3));
@@ -2437,7 +2442,7 @@ class wi extends Ci {
2437
2442
  return this.projectPoints().map((t2) => ({ originPoint: this.A, projectedPoint: t2 }));
2438
2443
  }
2439
2444
  }
2440
- const Ti = function(t2, e3) {
2445
+ const Wi = function(t2, e3) {
2441
2446
  let s2 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
2442
2447
  const i2 = [];
2443
2448
  if (0 === t2.length) return i2;
@@ -2452,31 +2457,31 @@ const Ti = function(t2, e3) {
2452
2457
  }
2453
2458
  return r2.forEach((t3, r3, n2) => {
2454
2459
  let o2, a2;
2455
- 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());
2460
+ 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());
2456
2461
  }), i2;
2457
- }, Oi = (t2) => {
2462
+ }, Vi = (t2) => {
2458
2463
  const e3 = {};
2459
2464
  return Object.keys(t2).forEach((i2) => {
2460
2465
  e3[i2] = {}, Object.keys(t2[i2]).forEach((r2) => {
2461
2466
  e3[i2][r2] = s({}, t2[i2][r2]);
2462
2467
  });
2463
2468
  }), e3;
2464
- }, ki = (t2) => t2.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2465
- let Di;
2466
- const Mi = (t2) => {
2467
- if (Di || Di || (Di = "Intl" in v() && "Segmenter" in Intl && new Intl.Segmenter(void 0, { granularity: "grapheme" })), Di) {
2468
- const e3 = Di.segment(t2);
2469
+ }, zi = (t2) => t2.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2470
+ let Gi;
2471
+ const Hi = (t2) => {
2472
+ if (Gi || Gi || (Gi = "Intl" in v() && "Segmenter" in Intl && new Intl.Segmenter(void 0, { granularity: "grapheme" })), Gi) {
2473
+ const e3 = Gi.segment(t2);
2469
2474
  return Array.from(e3).map((t3) => {
2470
2475
  let { segment: e4 } = t3;
2471
2476
  return e4;
2472
2477
  });
2473
2478
  }
2474
- return Pi(t2);
2475
- }, Pi = (t2) => {
2479
+ return Ni(t2);
2480
+ }, Ni = (t2) => {
2476
2481
  const e3 = [];
2477
- for (let s2, i2 = 0; i2 < t2.length; i2++) false !== (s2 = Ei(t2, i2)) && e3.push(s2);
2482
+ for (let s2, i2 = 0; i2 < t2.length; i2++) false !== (s2 = Ui(t2, i2)) && e3.push(s2);
2478
2483
  return e3;
2479
- }, Ei = (t2, e3) => {
2484
+ }, Ui = (t2, e3) => {
2480
2485
  const s2 = t2.charCodeAt(e3);
2481
2486
  if (isNaN(s2)) return "";
2482
2487
  if (s2 < 55296 || s2 > 57343) return t2.charAt(e3);
@@ -2491,34 +2496,34 @@ const Mi = (t2) => {
2491
2496
  if (55296 > i2 || i2 > 56319) throw "Low surrogate without preceding high surrogate";
2492
2497
  return false;
2493
2498
  };
2494
- const ji = function(t2, e3) {
2499
+ const Ki = function(t2, e3) {
2495
2500
  let s2 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
2496
- 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);
2497
- }, Fi = (t2, e3) => {
2501
+ 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);
2502
+ }, Ji = (t2, e3) => {
2498
2503
  const s2 = e3.split("\n"), i2 = [];
2499
2504
  let r2 = -1, n2 = {};
2500
- t2 = Oi(t2);
2505
+ t2 = Vi(t2);
2501
2506
  for (let e4 = 0; e4 < s2.length; e4++) {
2502
- const o2 = Mi(s2[e4]);
2507
+ const o2 = Hi(s2[e4]);
2503
2508
  if (t2[e4]) for (let s3 = 0; s3 < o2.length; s3++) {
2504
2509
  r2++;
2505
2510
  const o3 = t2[e4][s3];
2506
- 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 || {};
2511
+ 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 || {};
2507
2512
  }
2508
2513
  else r2 += o2.length, n2 = {};
2509
2514
  }
2510
2515
  return i2;
2511
- }, Li = (t2, e3) => {
2512
- if (!Array.isArray(t2)) return Oi(t2);
2516
+ }, Qi = (t2, e3) => {
2517
+ if (!Array.isArray(t2)) return Vi(t2);
2513
2518
  const i2 = e3.split(F), r2 = {};
2514
2519
  let n2 = -1, o2 = 0;
2515
2520
  for (let e4 = 0; e4 < i2.length; e4++) {
2516
- const a2 = Mi(i2[e4]);
2521
+ const a2 = Hi(i2[e4]);
2517
2522
  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++);
2518
2523
  }
2519
2524
  return r2;
2520
- }, 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"];
2521
- function Bi(t2, e3) {
2525
+ }, 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"];
2526
+ function $i(t2, e3) {
2522
2527
  const s2 = t2.nodeName, i2 = t2.getAttribute("class"), r2 = t2.getAttribute("id"), n2 = "(?![a-zA-Z\\-]+)";
2523
2528
  let o2;
2524
2529
  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) {
@@ -2527,26 +2532,26 @@ function Bi(t2, e3) {
2527
2532
  }
2528
2533
  return 0 === e3.length;
2529
2534
  }
2530
- function Ii(t2, e3) {
2535
+ function tr(t2, e3) {
2531
2536
  let s2 = true;
2532
- const i2 = Bi(t2, e3.pop());
2537
+ const i2 = $i(t2, e3.pop());
2533
2538
  return i2 && e3.length && (s2 = function(t3, e4) {
2534
2539
  let s3, i3 = true;
2535
- for (; t3.parentElement && 1 === t3.parentElement.nodeType && e4.length; ) i3 && (s3 = e4.pop()), i3 = Bi(t3 = t3.parentElement, s3);
2540
+ for (; t3.parentElement && 1 === t3.parentElement.nodeType && e4.length; ) i3 && (s3 = e4.pop()), i3 = $i(t3 = t3.parentElement, s3);
2536
2541
  return 0 === e4.length;
2537
2542
  }(t2, e3)), i2 && s2 && 0 === e3.length;
2538
2543
  }
2539
- const Xi = (t2) => {
2544
+ const er = (t2) => {
2540
2545
  var e3;
2541
- return null !== (e3 = He[t2]) && void 0 !== e3 ? e3 : t2;
2542
- }, Yi = new RegExp("(".concat(Ve, ")"), "gi"), Wi = (t2) => t2.replace(Yi, " $1 ").replace(/,/gi, " ").replace(/\s+/gi, " ");
2543
- var Vi, zi, Gi, Hi, Ni, Ui, qi;
2544
- 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");
2545
- function hr(t2) {
2546
+ return null !== (e3 = as[t2]) && void 0 !== e3 ? e3 : t2;
2547
+ }, sr = new RegExp("(".concat(is, ")"), "gi"), ir = (t2) => Pe(t2.replace(sr, " $1 ").replace(/,/gi, " "));
2548
+ var rr, nr, or, ar, hr, cr, lr;
2549
+ 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");
2550
+ function wr(t2) {
2546
2551
  const e3 = [];
2547
- if (!(t2 = Wi(t2).replace(/\s*([()])\s*/gi, "$1")) || t2 && !nr.test(t2)) return [...T];
2548
- for (const s2 of t2.matchAll(ar)) {
2549
- const t3 = or.exec(s2[0]);
2552
+ if (!(t2 = ir(t2).replace(/\s*([()])\s*/gi, "$1")) || t2 && !Cr.test(t2)) return [...T];
2553
+ for (const s2 of t2.matchAll(Sr)) {
2554
+ const t3 = br.exec(s2[0]);
2550
2555
  if (!t3) continue;
2551
2556
  let i2 = T;
2552
2557
  const r2 = t3.filter((t4) => !!t4), [, n2, ...o2] = r2, [a2, h2, c2, l2, u2, d2] = o2.map((t4) => parseFloat(t4));
@@ -2554,7 +2559,7 @@ function hr(t2) {
2554
2559
  case "translate":
2555
2560
  i2 = Mt(a2, h2);
2556
2561
  break;
2557
- case I:
2562
+ case B:
2558
2563
  i2 = Pt({ angle: a2 }, { x: h2, y: c2 });
2559
2564
  break;
2560
2565
  case G:
@@ -2573,74 +2578,74 @@ function hr(t2) {
2573
2578
  }
2574
2579
  return Ot(e3);
2575
2580
  }
2576
- function cr(t2, e3, s2, i2) {
2581
+ function Tr(t2, e3, s2, i2) {
2577
2582
  const r2 = Array.isArray(e3);
2578
2583
  let n2, o2 = e3;
2579
2584
  if (t2 !== K && t2 !== J || e3 !== j) {
2580
2585
  if ("strokeUniform" === t2) return "non-scaling-stroke" === e3;
2581
2586
  if ("strokeDashArray" === t2) o2 = e3 === j ? null : e3.replace(/,/g, " ").split(/\s+/).map(parseFloat);
2582
- else if ("transformMatrix" === t2) o2 = s2 && s2.transformMatrix ? Tt(s2.transformMatrix, hr(e3)) : hr(e3);
2587
+ else if ("transformMatrix" === t2) o2 = s2 && s2.transformMatrix ? Tt(s2.transformMatrix, wr(e3)) : wr(e3);
2583
2588
  else if ("visible" === t2) o2 = e3 !== j && "hidden" !== e3, s2 && false === s2.visible && (o2 = false);
2584
2589
  else if ("opacity" === t2) o2 = parseFloat(e3), s2 && void 0 !== s2.opacity && (o2 *= s2.opacity);
2585
2590
  else if ("textAnchor" === t2) o2 = "start" === e3 ? M : "end" === e3 ? A : D;
2586
- else if ("charSpacing" === t2) n2 = Re(e3, i2) / i2 * 1e3;
2591
+ else if ("charSpacing" === t2 || t2 === ze) n2 = Be(e3, i2) / i2 * 1e3;
2587
2592
  else if ("paintFirst" === t2) {
2588
2593
  const t3 = e3.indexOf(K), s3 = e3.indexOf(J);
2589
2594
  o2 = K, (t3 > -1 && s3 > -1 && s3 < t3 || -1 === t3 && s3 > -1) && (o2 = J);
2590
2595
  } else {
2591
2596
  if ("href" === t2 || "xlink:href" === t2 || "font" === t2 || "id" === t2) return e3;
2592
2597
  if ("imageSmoothing" === t2) return "optimizeQuality" === e3;
2593
- n2 = r2 ? e3.map(Re) : Re(e3, i2);
2598
+ n2 = r2 ? e3.map(Be) : Be(e3, i2);
2594
2599
  }
2595
2600
  } else o2 = "";
2596
2601
  return !r2 && isNaN(n2) ? o2 : n2;
2597
2602
  }
2598
- function lr(t2, e3) {
2599
- const s2 = t2.match(Ge);
2603
+ function Or(t2, e3) {
2604
+ const s2 = t2.match(os);
2600
2605
  if (!s2) return;
2601
2606
  const i2 = s2[1], r2 = s2[3], n2 = s2[4], o2 = s2[5], a2 = s2[6];
2602
- 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);
2607
+ 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);
2603
2608
  }
2604
- function ur(t2, e3) {
2609
+ function kr(t2, e3) {
2605
2610
  t2.replace(/;\s*$/, "").split(";").forEach((t3) => {
2606
2611
  if (!t3) return;
2607
2612
  const [s2, i2] = t3.split(":");
2608
2613
  e3[s2.trim().toLowerCase()] = i2.trim();
2609
2614
  });
2610
2615
  }
2611
- function dr(t2) {
2616
+ function Dr(t2) {
2612
2617
  const e3 = {}, s2 = t2.getAttribute("style");
2613
- return s2 ? ("string" == typeof s2 ? ur(s2, e3) : function(t3, e4) {
2618
+ return s2 ? ("string" == typeof s2 ? kr(s2, e3) : function(t3, e4) {
2614
2619
  Object.entries(t3).forEach((t4) => {
2615
2620
  let [s3, i2] = t4;
2616
2621
  void 0 !== i2 && (e4[s3.toLowerCase()] = i2);
2617
2622
  });
2618
2623
  }(s2, e3), e3) : e3;
2619
2624
  }
2620
- const gr = { stroke: "strokeOpacity", fill: "fillOpacity" };
2621
- function fr(t2, e3, i2) {
2625
+ const Mr = { stroke: "strokeOpacity", fill: "fillOpacity" };
2626
+ function Pr(t2, e3, i2) {
2622
2627
  if (!t2) return {};
2623
2628
  let r2, n2 = {}, o2 = O;
2624
- t2.parentNode && Je.test(t2.parentNode.nodeName) && (n2 = fr(t2.parentElement, e3, i2), n2.fontSize && (r2 = o2 = Re(n2.fontSize)));
2629
+ t2.parentNode && ds.test(t2.parentNode.nodeName) && (n2 = Pr(t2.parentElement, e3, i2), n2.fontSize && (r2 = o2 = Be(n2.fontSize)));
2625
2630
  const a2 = s(s(s({}, e3.reduce((e4, s2) => {
2626
2631
  const i3 = t2.getAttribute(s2);
2627
2632
  return i3 && (e4[s2] = i3), e4;
2628
2633
  }, {})), function(t3) {
2629
2634
  let e4 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i3 = {};
2630
- for (const r3 in e4) Ii(t3, r3.split(" ")) && (i3 = s(s({}, i3), e4[r3]));
2635
+ for (const r3 in e4) tr(t3, r3.split(" ")) && (i3 = s(s({}, i3), e4[r3]));
2631
2636
  return i3;
2632
- }(t2, i2)), dr(t2));
2633
- a2[Ue] && t2.setAttribute(Ue, a2[Ue]), a2[Ne] && (r2 = Re(a2[Ne], o2), a2[Ne] = "".concat(r2));
2637
+ }(t2, i2)), Dr(t2));
2638
+ a2[cs] && t2.setAttribute(cs, a2[cs]), a2[hs] && (r2 = Be(a2[hs], o2), a2[hs] = "".concat(r2));
2634
2639
  const h2 = {};
2635
2640
  for (const t3 in a2) {
2636
- const e4 = Xi(t3), s2 = cr(e4, a2[t3], n2, r2);
2641
+ const e4 = er(t3), s2 = Tr(e4, a2[t3], n2, r2);
2637
2642
  h2[e4] = s2;
2638
2643
  }
2639
- h2 && h2.font && lr(h2.font, h2);
2644
+ h2 && h2.font && Or(h2.font, h2);
2640
2645
  const c2 = s(s({}, n2), h2);
2641
- return Je.test(t2.nodeName) ? c2 : function(t3) {
2642
- const e4 = _i.getDefaults();
2643
- return Object.entries(gr).forEach((s2) => {
2646
+ return ds.test(t2.nodeName) ? c2 : function(t3) {
2647
+ const e4 = Li.getDefaults();
2648
+ return Object.entries(Mr).forEach((s2) => {
2644
2649
  let [i3, r3] = s2;
2645
2650
  if (void 0 === t3[r3] || "" === t3[i3]) return;
2646
2651
  if (void 0 === t3[i3]) {
@@ -2648,18 +2653,18 @@ function fr(t2, e3, i2) {
2648
2653
  t3[i3] = e4[i3];
2649
2654
  }
2650
2655
  if (0 === t3[i3].indexOf("url(")) return;
2651
- const n3 = new Le(t3[i3]);
2656
+ const n3 = new Ie(t3[i3]);
2652
2657
  t3[i3] = n3.setAlpha(Vt(n3.getAlpha() * t3[r3], 2)).toRgba();
2653
2658
  }), t3;
2654
2659
  }(c2);
2655
2660
  }
2656
- const pr = ["left", "top", "width", "height", "visible"], mr = ["rx", "ry"];
2657
- class vr extends _i {
2661
+ const Er = ["left", "top", "width", "height", "visible"], Ar = ["rx", "ry"];
2662
+ class jr extends Li {
2658
2663
  static getDefaults() {
2659
- return s(s({}, super.getDefaults()), vr.ownDefaults);
2664
+ return s(s({}, super.getDefaults()), jr.ownDefaults);
2660
2665
  }
2661
2666
  constructor(t2) {
2662
- super(), Object.assign(this, vr.ownDefaults), this.setOptions(t2), this._initRxRy();
2667
+ super(), Object.assign(this, jr.ownDefaults), this.setOptions(t2), this._initRxRy();
2663
2668
  }
2664
2669
  _initRxRy() {
2665
2670
  const { rx: t2, ry: e3 } = this;
@@ -2671,60 +2676,60 @@ class vr extends _i {
2671
2676
  }
2672
2677
  toObject() {
2673
2678
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
2674
- return super.toObject([...mr, ...t2]);
2679
+ return super.toObject([...Ar, ...t2]);
2675
2680
  }
2676
2681
  _toSVG() {
2677
2682
  const { width: t2, height: e3, rx: s2, ry: i2 } = this;
2678
2683
  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')];
2679
2684
  }
2680
2685
  static async fromElement(t2, e3, r2) {
2681
- 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);
2686
+ 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);
2682
2687
  return new this(s(s(s({}, e3), u2), {}, { left: o2, top: a2, width: h2, height: c2, visible: Boolean(l2 && h2 && c2) }));
2683
2688
  }
2684
2689
  }
2685
- 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);
2686
- const yr = "initialization", _r = "added", xr = "removed", Cr = "imperative", br = (t2, e3) => {
2687
- 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);
2690
+ 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);
2691
+ const Fr = "initialization", Lr = "added", Rr = "removed", Ir = "imperative", Br = (t2, e3) => {
2692
+ 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);
2688
2693
  return [h2.subtract(d2), h2.add(d2)];
2689
2694
  };
2690
- class Sr {
2695
+ class Xr {
2691
2696
  calcLayoutResult(t2, e3) {
2692
2697
  if (this.shouldPerformLayout(t2)) return this.calcBoundingBox(e3, t2);
2693
2698
  }
2694
2699
  shouldPerformLayout(t2) {
2695
2700
  let { type: e3, prevStrategy: s2, strategy: i2 } = t2;
2696
- return e3 === yr || e3 === Cr || !!s2 && i2 !== s2;
2701
+ return e3 === Fr || e3 === Ir || !!s2 && i2 !== s2;
2697
2702
  }
2698
2703
  shouldLayoutClipPath(t2) {
2699
2704
  let { type: e3, target: { clipPath: s2 } } = t2;
2700
- return e3 !== yr && s2 && !s2.absolutePositioned;
2705
+ return e3 !== Fr && s2 && !s2.absolutePositioned;
2701
2706
  }
2702
2707
  getInitialSize(t2, e3) {
2703
2708
  return e3.size;
2704
2709
  }
2705
2710
  calcBoundingBox(t2, e3) {
2706
2711
  const { type: s2, target: i2 } = e3;
2707
- if (s2 === Cr && e3.overrides) return e3.overrides;
2712
+ if (s2 === Ir && e3.overrides) return e3.overrides;
2708
2713
  if (0 === t2.length) return;
2709
- 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));
2710
- if (s2 === yr) {
2714
+ 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));
2715
+ if (s2 === Fr) {
2711
2716
  const t3 = this.getInitialSize(e3, { size: h2, center: c2 });
2712
2717
  return { center: c2, relativeCorrection: new ot(0, 0), size: t3 };
2713
2718
  }
2714
2719
  return { center: c2.transform(i2.calcOwnMatrix()), size: h2 };
2715
2720
  }
2716
2721
  }
2717
- t(Sr, "type", "strategy");
2718
- class wr extends Sr {
2722
+ t(Xr, "type", "strategy");
2723
+ class Yr extends Xr {
2719
2724
  shouldPerformLayout(t2) {
2720
2725
  return true;
2721
2726
  }
2722
2727
  }
2723
- t(wr, "type", "fit-content"), tt.setClass(wr);
2724
- const Tr = ["strategy"], Or = ["target", "strategy", "bubbles", "prevStrategy"], kr = "layoutManager";
2725
- class Dr {
2728
+ t(Yr, "type", "fit-content"), tt.setClass(Yr);
2729
+ const Wr = ["strategy"], Vr = ["target", "strategy", "bubbles", "prevStrategy"], zr = "layoutManager";
2730
+ class Gr {
2726
2731
  constructor() {
2727
- let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new wr();
2732
+ let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new Yr();
2728
2733
  t(this, "strategy", void 0), this.strategy = e3, this._subscriptions = /* @__PURE__ */ new Map();
2729
2734
  }
2730
2735
  performLayout(t2) {
@@ -2737,7 +2742,7 @@ class Dr {
2737
2742
  }
2738
2743
  attachHandlers(t2, e3) {
2739
2744
  const { target: s2 } = e3;
2740
- 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 })));
2745
+ 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 })));
2741
2746
  }
2742
2747
  subscribe(t2, e3) {
2743
2748
  this.unsubscribe(t2, e3);
@@ -2755,21 +2760,21 @@ class Dr {
2755
2760
  }
2756
2761
  onBeforeLayout(t2) {
2757
2762
  const { target: e3, type: r2 } = t2, { canvas: n2 } = e3;
2758
- 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) {
2759
- const r3 = i(t2, Tr);
2763
+ 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) {
2764
+ const r3 = i(t2, Wr);
2760
2765
  e3.forEachObject((t3) => t3.layoutManager && t3.layoutManager.performLayout(s(s({}, r3), {}, { bubbles: false, target: t3 })));
2761
2766
  }
2762
2767
  }
2763
2768
  getLayoutResult(t2) {
2764
2769
  const { target: e3, strategy: s2, type: i2 } = t2, r2 = s2.calcLayoutResult(t2, e3.getObjects());
2765
2770
  if (!r2) return;
2766
- 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);
2771
+ 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);
2767
2772
  return { result: r2, prevCenter: n2, nextCenter: o2, offset: c2 };
2768
2773
  }
2769
2774
  commitLayout(t2, e3) {
2770
2775
  const { target: s2 } = t2, { result: { size: i2 }, nextCenter: r2 } = e3;
2771
2776
  var n2, o2;
2772
- (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));
2777
+ (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));
2773
2778
  }
2774
2779
  layoutObjects(t2, e3) {
2775
2780
  const { target: s2 } = t2;
@@ -2782,7 +2787,7 @@ class Dr {
2782
2787
  s2.set({ left: s2.left + i2.x, top: s2.top + i2.y });
2783
2788
  }
2784
2789
  onAfterLayout(t2, e3) {
2785
- const { target: r2, strategy: n2, bubbles: o2, prevStrategy: a2 } = t2, h2 = i(t2, Or), { canvas: c2 } = r2;
2790
+ const { target: r2, strategy: n2, bubbles: o2, prevStrategy: a2 } = t2, h2 = i(t2, Vr), { canvas: c2 } = r2;
2786
2791
  r2.fire("layout:after", { context: t2, result: e3 }), c2 && c2.fire("object:layout:after", { context: t2, result: e3, target: r2 });
2787
2792
  const l2 = r2.parent;
2788
2793
  o2 && null != l2 && l2.layoutManager && ((h2.path || (h2.path = [])).push(r2), l2.layoutManager.performLayout(s(s({}, h2), {}, { target: l2 }))), r2.set("dirty", true);
@@ -2792,31 +2797,31 @@ class Dr {
2792
2797
  t2.forEach((t3) => t3.forEach((t4) => t4())), t2.clear();
2793
2798
  }
2794
2799
  toObject() {
2795
- return { type: kr, strategy: this.strategy.constructor.type };
2800
+ return { type: zr, strategy: this.strategy.constructor.type };
2796
2801
  }
2797
2802
  toJSON() {
2798
2803
  return this.toObject();
2799
2804
  }
2800
2805
  }
2801
- tt.setClass(Dr, kr);
2802
- const Mr = ["type", "objects", "layoutManager"];
2803
- class Pr extends Dr {
2806
+ tt.setClass(Gr, zr);
2807
+ const Hr = ["type", "objects", "layoutManager"];
2808
+ class Nr extends Gr {
2804
2809
  performLayout() {
2805
2810
  }
2806
2811
  }
2807
- class Er extends ct(_i) {
2812
+ class Ur extends ct(Li) {
2808
2813
  static getDefaults() {
2809
- return s(s({}, super.getDefaults()), Er.ownDefaults);
2814
+ return s(s({}, super.getDefaults()), Ur.ownDefaults);
2810
2815
  }
2811
2816
  constructor() {
2812
2817
  let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
2813
- 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);
2818
+ 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);
2814
2819
  }
2815
2820
  groupInit(t2, e3) {
2816
2821
  var s2;
2817
2822
  this._objects = [...t2], this.__objectSelectionTracker = this.__objectSelectionMonitor.bind(this, true), this.__objectSelectionDisposer = this.__objectSelectionMonitor.bind(this, false), this.forEachObject((t3) => {
2818
2823
  this.enterGroup(t3, false);
2819
- }), 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 });
2824
+ }), 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 });
2820
2825
  }
2821
2826
  canEnterGroup(t2) {
2822
2827
  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);
@@ -2827,16 +2832,16 @@ class Er extends ct(_i) {
2827
2832
  add() {
2828
2833
  for (var t2 = arguments.length, e3 = new Array(t2), s2 = 0; s2 < t2; s2++) e3[s2] = arguments[s2];
2829
2834
  const i2 = this._filterObjectsBeforeEnteringGroup(e3), r2 = super.add(...i2);
2830
- return this._onAfterObjectsChange(_r, i2), r2;
2835
+ return this._onAfterObjectsChange(Lr, i2), r2;
2831
2836
  }
2832
2837
  insertAt(t2) {
2833
2838
  for (var e3 = arguments.length, s2 = new Array(e3 > 1 ? e3 - 1 : 0), i2 = 1; i2 < e3; i2++) s2[i2 - 1] = arguments[i2];
2834
2839
  const r2 = this._filterObjectsBeforeEnteringGroup(s2), n2 = super.insertAt(t2, ...r2);
2835
- return this._onAfterObjectsChange(_r, r2), n2;
2840
+ return this._onAfterObjectsChange(Lr, r2), n2;
2836
2841
  }
2837
2842
  remove() {
2838
2843
  const t2 = super.remove(...arguments);
2839
- return this._onAfterObjectsChange(xr, t2), t2;
2844
+ return this._onAfterObjectsChange(Rr, t2), t2;
2840
2845
  }
2841
2846
  _onObjectAdded(t2) {
2842
2847
  this.enterGroup(t2, true), this.fire("object:added", { target: t2 }), t2.fire("added", { target: this });
@@ -2878,7 +2883,7 @@ class Er extends ct(_i) {
2878
2883
  t2.group && t2.group.remove(t2), t2._set("parent", this), this._enterGroup(t2, e3);
2879
2884
  }
2880
2885
  _enterGroup(t2, e3) {
2881
- 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);
2886
+ 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);
2882
2887
  const s2 = this.canvas && this.canvas.getActiveObject && this.canvas.getActiveObject();
2883
2888
  s2 && (s2 === t2 || t2.isDescendantOf(s2)) && this._activeObjects.push(t2);
2884
2889
  }
@@ -2886,12 +2891,12 @@ class Er extends ct(_i) {
2886
2891
  this._exitGroup(t2, e3), t2._set("parent", void 0), t2._set("canvas", void 0);
2887
2892
  }
2888
2893
  _exitGroup(t2, e3) {
2889
- t2._set("group", void 0), e3 || (le(t2, Tt(this.calcTransformMatrix(), t2.calcTransformMatrix())), t2.setCoords()), this._watchObject(false, t2);
2894
+ t2._set("group", void 0), e3 || (ue(t2, Tt(this.calcTransformMatrix(), t2.calcTransformMatrix())), t2.setCoords()), this._watchObject(false, t2);
2890
2895
  const s2 = this._activeObjects.length > 0 ? this._activeObjects.indexOf(t2) : -1;
2891
2896
  s2 > -1 && this._activeObjects.splice(s2, 1);
2892
2897
  }
2893
2898
  shouldCache() {
2894
- const t2 = _i.prototype.shouldCache.call(this);
2899
+ const t2 = Li.prototype.shouldCache.call(this);
2895
2900
  if (t2) {
2896
2901
  for (let t3 = 0; t3 < this._objects.length; t3++) if (this._objects[t3].willDrawShadow()) return this.ownCaching = false, false;
2897
2902
  }
@@ -2919,7 +2924,7 @@ class Er extends ct(_i) {
2919
2924
  }
2920
2925
  triggerLayout() {
2921
2926
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
2922
- this.layoutManager.performLayout(s({ target: this, type: Cr }, t2));
2927
+ this.layoutManager.performLayout(s({ target: this, type: Ir }, t2));
2923
2928
  }
2924
2929
  render(t2) {
2925
2930
  this._transformDone = true, super.render(t2), this._transformDone = false;
@@ -2950,7 +2955,7 @@ class Er extends ct(_i) {
2950
2955
  }
2951
2956
  _createSVGBgRect(t2) {
2952
2957
  if (!this.backgroundColor) return "";
2953
- const e3 = vr.prototype._toSVG.call(this), s2 = e3.indexOf("COMMON_PARTS");
2958
+ const e3 = jr.prototype._toSVG.call(this), s2 = e3.indexOf("COMMON_PARTS");
2954
2959
  e3[s2] = 'for="group" ';
2955
2960
  const i2 = e3.join("");
2956
2961
  return t2 ? t2(i2) : i2;
@@ -2972,27 +2977,27 @@ class Er extends ct(_i) {
2972
2977
  return this._createBaseClipPathSVGMarkup(e3, { reviver: t2 });
2973
2978
  }
2974
2979
  static fromObject(t2, e3) {
2975
- let { type: r2, objects: n2 = [], layoutManager: o2 } = t2, a2 = i(t2, Mr);
2976
- return Promise.all([It(n2, e3), Xt(a2, e3)]).then((t3) => {
2980
+ let { type: r2, objects: n2 = [], layoutManager: o2 } = t2, a2 = i(t2, Hr);
2981
+ return Promise.all([Bt(n2, e3), Xt(a2, e3)]).then((t3) => {
2977
2982
  let [e4, i2] = t3;
2978
- const r3 = new this(e4, s(s(s({}, a2), i2), {}, { layoutManager: new Pr() }));
2983
+ const r3 = new this(e4, s(s(s({}, a2), i2), {}, { layoutManager: new Nr() }));
2979
2984
  if (o2) {
2980
2985
  const t4 = tt.getClass(o2.type), e5 = tt.getClass(o2.strategy);
2981
2986
  r3.layoutManager = new t4(new e5());
2982
- } else r3.layoutManager = new Dr();
2983
- return r3.layoutManager.subscribeTargets({ type: yr, target: r3, targets: r3.getObjects() }), r3.setCoords(), r3;
2987
+ } else r3.layoutManager = new Gr();
2988
+ return r3.layoutManager.subscribeTargets({ type: Fr, target: r3, targets: r3.getObjects() }), r3.setCoords(), r3;
2984
2989
  });
2985
2990
  }
2986
2991
  }
2987
- t(Er, "type", "Group"), t(Er, "ownDefaults", { strokeWidth: 0, subTargetCheck: false, interactive: false }), tt.setClass(Er);
2988
- 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) => {
2992
+ t(Ur, "type", "Group"), t(Ur, "ownDefaults", { strokeWidth: 0, subTargetCheck: false, interactive: false }), tt.setClass(Ur);
2993
+ 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) => {
2989
2994
  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;
2990
2995
  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];
2991
- }, Xr = (t2, e3, s2, i2) => {
2996
+ }, en = (t2, e3, s2, i2) => {
2992
2997
  const r2 = Math.atan2(e3, t2), n2 = Math.atan2(i2, s2);
2993
2998
  return n2 >= r2 ? n2 - r2 : 2 * Math.PI - (r2 - n2);
2994
2999
  };
2995
- function Yr(t2, e3, s2, i2, r2, n2, a2, h2) {
3000
+ function sn(t2, e3, s2, i2, r2, n2, a2, h2) {
2996
3001
  let c2;
2997
3002
  if (o.cachesBoundsOfCurve && (c2 = [...arguments].join(), _.boundsOfCurveCache[c2])) return _.boundsOfCurveCache[c2];
2998
3003
  const l2 = Math.sqrt, u2 = Math.abs, d2 = [], g2 = [[0, 0], [0, 0]];
@@ -3012,7 +3017,7 @@ function Yr(t2, e3, s2, i2, r2, n2, a2, h2) {
3012
3017
  0 < a3 && a3 < 1 && d2.push(a3);
3013
3018
  }
3014
3019
  let v2 = d2.length;
3015
- const y2 = v2, x2 = Gr(t2, e3, s2, i2, r2, n2, a2, h2);
3020
+ const y2 = v2, x2 = an(t2, e3, s2, i2, r2, n2, a2, h2);
3016
3021
  for (; v2--; ) {
3017
3022
  const { x: t3, y: e4 } = x2(d2[v2]);
3018
3023
  g2[0][v2] = t3, g2[1][v2] = e4;
@@ -3021,7 +3026,7 @@ function Yr(t2, e3, s2, i2, r2, n2, a2, h2) {
3021
3026
  const C2 = [new ot(Math.min(...g2[0]), Math.min(...g2[1])), new ot(Math.max(...g2[0]), Math.max(...g2[1]))];
3022
3027
  return o.cachesBoundsOfCurve && (_.boundsOfCurveCache[c2] = C2), C2;
3023
3028
  }
3024
- const Wr = (t2, e3, s2) => {
3029
+ const rn = (t2, e3, s2) => {
3025
3030
  let [i2, r2, n2, o2, a2, h2, c2, l2] = s2;
3026
3031
  const u2 = ((t3, e4, s3, i3, r3, n3, o3) => {
3027
3032
  if (0 === s3 || 0 === i3) return [];
@@ -3033,16 +3038,16 @@ const Wr = (t2, e3, s2) => {
3033
3038
  C2 *= t4, b2 *= t4;
3034
3039
  } else c3 = (r3 === n3 ? -1 : 1) * Math.sqrt(x2 / (m2 * y2 + v2 * _2));
3035
3040
  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;
3036
- 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);
3041
+ 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);
3037
3042
  0 === n3 && M2 > 0 ? M2 -= 2 * l3 : 1 === n3 && M2 < 0 && (M2 += 2 * l3);
3038
3043
  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);
3039
3044
  let F2 = D2 + A2;
3040
- 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;
3045
+ 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;
3041
3046
  return E2;
3042
3047
  })(c2 - t2, l2 - e3, r2, n2, a2, h2, o2);
3043
3048
  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;
3044
3049
  return u2;
3045
- }, Vr = (t2) => {
3050
+ }, nn = (t2) => {
3046
3051
  let e3 = 0, s2 = 0, i2 = 0, r2 = 0;
3047
3052
  const n2 = [];
3048
3053
  let o2, a2 = 0, h2 = 0;
@@ -3093,7 +3098,7 @@ const Wr = (t2, e3, s2) => {
3093
3098
  case "a":
3094
3099
  t3[6] += e3, t3[7] += s2;
3095
3100
  case "A":
3096
- Wr(e3, s2, t3).forEach((t4) => n2.push(t4)), e3 = t3[6], s2 = t3[7];
3101
+ rn(e3, s2, t3).forEach((t4) => n2.push(t4)), e3 = t3[6], s2 = t3[7];
3097
3102
  break;
3098
3103
  case "z":
3099
3104
  case "Z":
@@ -3102,31 +3107,31 @@ const Wr = (t2, e3, s2) => {
3102
3107
  l2 ? (n2.push(l2), o2 = l2[0]) : o2 = "";
3103
3108
  }
3104
3109
  return n2;
3105
- }, zr = (t2, e3, s2, i2) => Math.sqrt((s2 - t2) ** 2 + (i2 - e3) ** 2), Gr = (t2, e3, s2, i2, r2, n2, o2, a2) => (h2) => {
3110
+ }, on = (t2, e3, s2, i2) => Math.sqrt((s2 - t2) ** 2 + (i2 - e3) ** 2), an = (t2, e3, s2, i2, r2, n2, o2, a2) => (h2) => {
3106
3111
  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);
3107
3112
  return new ot(o2 * c2 + r2 * l2 + s2 * u2 + t2 * d2, a2 * c2 + n2 * l2 + i2 * u2 + e3 * d2);
3108
- }, 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) => {
3109
- 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));
3113
+ }, 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) => {
3114
+ 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));
3110
3115
  return Math.atan2(g2, d2);
3111
- }, Kr = (t2, e3, s2, i2, r2, n2) => (o2) => {
3112
- const a2 = Hr(o2), h2 = Nr(o2), c2 = Ur(o2);
3116
+ }, dn = (t2, e3, s2, i2, r2, n2) => (o2) => {
3117
+ const a2 = hn(o2), h2 = cn(o2), c2 = ln(o2);
3113
3118
  return new ot(r2 * a2 + s2 * h2 + t2 * c2, n2 * a2 + i2 * h2 + e3 * c2);
3114
- }, Jr = (t2, e3, s2, i2, r2, n2) => (o2) => {
3119
+ }, gn = (t2, e3, s2, i2, r2, n2) => (o2) => {
3115
3120
  const a2 = 1 - o2, h2 = 2 * (a2 * (s2 - t2) + o2 * (r2 - s2)), c2 = 2 * (a2 * (i2 - e3) + o2 * (n2 - i2));
3116
3121
  return Math.atan2(c2, h2);
3117
- }, Qr = (t2, e3, s2) => {
3122
+ }, fn = (t2, e3, s2) => {
3118
3123
  let i2 = new ot(e3, s2), r2 = 0;
3119
3124
  for (let e4 = 1; e4 <= 100; e4 += 1) {
3120
3125
  const s3 = t2(e4 / 100);
3121
- r2 += zr(i2.x, i2.y, s3.x, s3.y), i2 = s3;
3126
+ r2 += on(i2.x, i2.y, s3.x, s3.y), i2 = s3;
3122
3127
  }
3123
3128
  return r2;
3124
- }, Zr = (t2, e3) => {
3129
+ }, pn = (t2, e3) => {
3125
3130
  let i2, r2 = 0, n2 = 0, o2 = { x: t2.x, y: t2.y }, a2 = s({}, o2), h2 = 0.01, c2 = 0;
3126
3131
  const l2 = t2.iterator, u2 = t2.angleFinder;
3127
- 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);
3132
+ 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);
3128
3133
  return s(s({}, a2), {}, { angle: u2(c2) });
3129
- }, $r = (t2) => {
3134
+ }, mn = (t2) => {
3130
3135
  let e3, s2, i2 = 0, r2 = 0, n2 = 0, o2 = 0, a2 = 0;
3131
3136
  const h2 = [];
3132
3137
  for (const c2 of t2) {
@@ -3136,22 +3141,22 @@ const Wr = (t2, e3, s2) => {
3136
3141
  s2 = t3, s2.x = o2 = r2 = c2[1], s2.y = a2 = n2 = c2[2];
3137
3142
  break;
3138
3143
  case "L":
3139
- s2 = t3, s2.length = zr(r2, n2, c2[1], c2[2]), r2 = c2[1], n2 = c2[2];
3144
+ s2 = t3, s2.length = on(r2, n2, c2[1], c2[2]), r2 = c2[1], n2 = c2[2];
3140
3145
  break;
3141
3146
  case "C":
3142
- 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];
3147
+ 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];
3143
3148
  break;
3144
3149
  case "Q":
3145
- 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];
3150
+ 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];
3146
3151
  break;
3147
3152
  case "Z":
3148
- s2 = t3, s2.destX = o2, s2.destY = a2, s2.length = zr(r2, n2, o2, a2), r2 = o2, n2 = a2;
3153
+ s2 = t3, s2.destX = o2, s2.destY = a2, s2.length = on(r2, n2, o2, a2), r2 = o2, n2 = a2;
3149
3154
  }
3150
3155
  i2 += s2.length, h2.push(s2);
3151
3156
  }
3152
3157
  return h2.push({ length: i2, x: r2, y: n2 }), h2;
3153
- }, tn = function(t2, e3) {
3154
- let i2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : $r(t2), r2 = 0;
3158
+ }, vn = function(t2, e3) {
3159
+ let i2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : mn(t2), r2 = 0;
3155
3160
  for (; e3 - i2[r2].length > 0 && r2 < i2.length - 2; ) e3 -= i2[r2].length, r2++;
3156
3161
  const n2 = i2[r2], o2 = e3 / n2.length, a2 = t2[r2];
3157
3162
  switch (n2.command) {
@@ -3163,40 +3168,40 @@ const Wr = (t2, e3, s2) => {
3163
3168
  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) });
3164
3169
  case "C":
3165
3170
  case "Q":
3166
- return Zr(n2, e3);
3171
+ return pn(n2, e3);
3167
3172
  }
3168
- }, 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) => {
3173
+ }, 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) => {
3169
3174
  var e3;
3170
- const s2 = [], i2 = null !== (e3 = t2.match(en)) && void 0 !== e3 ? e3 : [];
3175
+ const s2 = [], i2 = null !== (e3 = t2.match(yn)) && void 0 !== e3 ? e3 : [];
3171
3176
  for (const t3 of i2) {
3172
3177
  const e4 = t3[0];
3173
3178
  if ("z" === e4 || "Z" === e4) {
3174
3179
  s2.push([e4]);
3175
3180
  continue;
3176
3181
  }
3177
- const i3 = nn[e4.toLowerCase()];
3182
+ const i3 = Cn[e4.toLowerCase()];
3178
3183
  let r2 = [];
3179
3184
  if ("a" === e4 || "A" === e4) {
3180
- sn.lastIndex = 0;
3181
- for (let e5 = null; e5 = sn.exec(t3); ) r2.push(...e5.slice(1));
3182
- } else r2 = t3.match(rn) || [];
3185
+ _n.lastIndex = 0;
3186
+ for (let e5 = null; e5 = _n.exec(t3); ) r2.push(...e5.slice(1));
3187
+ } else r2 = t3.match(xn) || [];
3183
3188
  for (let t4 = 0; t4 < r2.length; t4 += i3) {
3184
- const n2 = new Array(i3), o2 = Br[e4];
3189
+ const n2 = new Array(i3), o2 = $r[e4];
3185
3190
  n2[0] = t4 > 0 && o2 ? o2 : e4;
3186
3191
  for (let e5 = 0; e5 < i3; e5++) n2[e5 + 1] = parseFloat(r2[t4 + e5]);
3187
3192
  s2.push(n2);
3188
3193
  }
3189
3194
  }
3190
3195
  return s2;
3191
- }, hn = (t2, e3) => t2.map((t3) => t3.map((t4, s2) => 0 === s2 || void 0 === e3 ? t4 : Vt(t4, e3)).join(" ")).join(" ");
3192
- function cn(t2, e3) {
3196
+ }, wn = (t2, e3) => t2.map((t3) => t3.map((t4, s2) => 0 === s2 || void 0 === e3 ? t4 : Vt(t4, e3)).join(" ")).join(" ");
3197
+ function Tn(t2, e3) {
3193
3198
  const s2 = t2.style;
3194
3199
  s2 && e3 && ("string" == typeof e3 ? s2.cssText += ";" + e3 : Object.entries(e3).forEach((t3) => {
3195
3200
  let [e4, i2] = t3;
3196
3201
  return s2.setProperty(e4, i2);
3197
3202
  }));
3198
3203
  }
3199
- class fn extends te {
3204
+ class Pn extends te {
3200
3205
  constructor(e3) {
3201
3206
  let { allowTouchScrolling: s2 = false, containerClass: i2 = "" } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
3202
3207
  super(e3), t(this, "upper", void 0), t(this, "container", void 0);
@@ -3211,11 +3216,11 @@ class fn extends te {
3211
3216
  }
3212
3217
  createContainerElement() {
3213
3218
  const t2 = m().createElement("div");
3214
- return t2.setAttribute("data-fabric", "wrapper"), cn(t2, { position: "relative" }), $t(t2), t2;
3219
+ return t2.setAttribute("data-fabric", "wrapper"), Tn(t2, { position: "relative" }), $t(t2), t2;
3215
3220
  }
3216
3221
  applyCanvasStyle(t2, e3) {
3217
3222
  const { styles: i2, allowTouchScrolling: r2 } = e3;
3218
- cn(t2, s(s({}, i2), {}, { "touch-action": r2 ? "manipulation" : j })), $t(t2);
3223
+ Tn(t2, s(s({}, i2), {}, { "touch-action": r2 ? "manipulation" : j })), $t(t2);
3219
3224
  }
3220
3225
  setDimensions(t2, e3) {
3221
3226
  super.setDimensions(t2, e3);
@@ -3233,12 +3238,12 @@ class fn extends te {
3233
3238
  super.dispose(), p().dispose(this.upper.el), delete this.upper, delete this.container;
3234
3239
  }
3235
3240
  }
3236
- class pn extends se {
3241
+ class En extends ie {
3237
3242
  constructor() {
3238
- 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);
3243
+ super(...arguments), t(this, "targets", []), t(this, "_hoveredTargets", []), t(this, "_currentTransform", null), t(this, "_groupSelector", null), t(this, "contextTopDirty", false);
3239
3244
  }
3240
3245
  static getDefaults() {
3241
- return s(s({}, super.getDefaults()), pn.ownDefaults);
3246
+ return s(s({}, super.getDefaults()), En.ownDefaults);
3242
3247
  }
3243
3248
  get upperCanvasEl() {
3244
3249
  var t2;
@@ -3252,7 +3257,7 @@ class pn extends se {
3252
3257
  return this.elements.container;
3253
3258
  }
3254
3259
  initElements(t2) {
3255
- this.elements = new fn(t2, { allowTouchScrolling: this.allowTouchScrolling, containerClass: this.containerClass }), this._createCacheCanvas();
3260
+ this.elements = new Pn(t2, { allowTouchScrolling: this.allowTouchScrolling, containerClass: this.containerClass }), this._createCacheCanvas();
3256
3261
  }
3257
3262
  _onObjectAdded(t2) {
3258
3263
  this._objectsToRender = void 0, super._onObjectAdded(t2);
@@ -3288,7 +3293,7 @@ class pn extends se {
3288
3293
  const n2 = t2.selectionBackgroundColor;
3289
3294
  t2.selectionBackgroundColor = "", t2.render(r2), t2.selectionBackgroundColor = n2, r2.restore();
3290
3295
  const o2 = Math.round(i2 * this.getRetinaScaling());
3291
- return xi(r2, o2, o2, o2);
3296
+ return Ri(r2, o2, o2, o2);
3292
3297
  }
3293
3298
  _isSelectionKeyPressed(t2) {
3294
3299
  const e3 = this.selectionKey;
@@ -3301,7 +3306,7 @@ class pn extends se {
3301
3306
  _shouldCenterTransform(t2, e3, s2) {
3302
3307
  if (!t2) return;
3303
3308
  let i2;
3304
- return e3 === G || e3 === H || e3 === N || e3 === Y ? i2 = this.centeredScaling || t2.centeredScaling : e3 === I && (i2 = this.centeredRotation || t2.centeredRotation), i2 ? !s2 : s2;
3309
+ return e3 === G || e3 === H || e3 === N || e3 === Y ? i2 = this.centeredScaling || t2.centeredScaling : e3 === B && (i2 = this.centeredRotation || t2.centeredRotation), i2 ? !s2 : s2;
3305
3310
  }
3306
3311
  _getOriginFromCorner(t2, e3) {
3307
3312
  const s2 = { x: t2.originX, y: t2.originY };
@@ -3309,11 +3314,11 @@ class pn extends se {
3309
3314
  }
3310
3315
  _setupCurrentTransform(t2, e3, i2) {
3311
3316
  var r2;
3312
- 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) => {
3317
+ 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) => {
3313
3318
  if (!e4 || !t3) return "drag";
3314
3319
  const r3 = i3.controls[e4];
3315
3320
  return r3.getActionName(s2, r3, i3);
3316
- })(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 }) };
3321
+ })(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 }) };
3317
3322
  this._currentTransform = d2, this.fire("before:transform", { e: t2, transform: d2 });
3318
3323
  }
3319
3324
  setCursor(t2) {
@@ -3322,13 +3327,13 @@ class pn extends se {
3322
3327
  _drawSelection(t2) {
3323
3328
  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;
3324
3329
  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);
3325
- 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));
3330
+ 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));
3326
3331
  }
3327
3332
  findTarget(t2) {
3328
3333
  if (this.skipTargetFind) return;
3329
3334
  const e3 = this.getViewportPoint(t2), s2 = this._activeObject, i2 = this.getActiveObjects();
3330
3335
  if (this.targets = [], s2 && i2.length >= 1) {
3331
- if (s2.findControl(e3, ne(t2))) return s2;
3336
+ if (s2.findControl(e3, oe(t2))) return s2;
3332
3337
  if (i2.length > 1 && this.searchPossibleTargets([s2], e3)) return s2;
3333
3338
  if (s2 === this.searchPossibleTargets([s2], e3)) {
3334
3339
  if (this.preserveObjectStacking) {
@@ -3349,10 +3354,10 @@ class pn extends se {
3349
3354
  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;
3350
3355
  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)];
3351
3356
  }
3352
- return Ls.isPointInPolygon(e3, s2);
3357
+ return Qs.isPointInPolygon(e3, s2);
3353
3358
  }
3354
3359
  _checkTarget(t2, e3) {
3355
- if (t2 && t2.visible && t2.evented && this._pointIsInObjectSelectionArea(t2, pe(e3, void 0, this.viewportTransform))) {
3360
+ if (t2 && t2.visible && t2.evented && this._pointIsInObjectSelectionArea(t2, me(e3, void 0, this.viewportTransform))) {
3356
3361
  if (!this.perPixelTargetFind && !t2.perPixelTargetFind || t2.isEditing) return true;
3357
3362
  if (!this.isTargetTransparent(t2, e3.x, e3.y)) return true;
3358
3363
  }
@@ -3392,8 +3397,8 @@ class pn extends se {
3392
3397
  getPointer(t2) {
3393
3398
  let e3 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
3394
3399
  const s2 = this.upperCanvasEl, i2 = s2.getBoundingClientRect();
3395
- let r2 = re(t2), n2 = i2.width || 0, o2 = i2.height || 0;
3396
- 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));
3400
+ let r2 = ne(t2), n2 = i2.width || 0, o2 = i2.height || 0;
3401
+ 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));
3397
3402
  const a2 = this.getRetinaScaling();
3398
3403
  1 !== a2 && (r2.x /= a2, r2.y /= a2);
3399
3404
  const h2 = 0 === n2 || 0 === o2 ? new ot(1, 1) : new ot(s2.width / n2, s2.height / o2);
@@ -3480,7 +3485,7 @@ class pn extends se {
3480
3485
  const { group: e3 } = t2;
3481
3486
  if (e3 && Ut(e3) && this._activeObject === e3) {
3482
3487
  const s2 = Yt(t2, ["angle", "flipX", "flipY", M, H, N, U, q, P]);
3483
- return ce(t2, e3.calcOwnMatrix()), s2;
3488
+ return le(t2, e3.calcOwnMatrix()), s2;
3484
3489
  }
3485
3490
  return {};
3486
3491
  }
@@ -3489,8 +3494,8 @@ class pn extends se {
3489
3494
  super._setSVGObject(t2, e3, s2), e3.set(i2);
3490
3495
  }
3491
3496
  }
3492
- 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 });
3493
- class mn {
3497
+ 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 });
3498
+ class An {
3494
3499
  constructor(e3) {
3495
3500
  t(this, "targets", []), t(this, "__disposer", void 0);
3496
3501
  const s2 = () => {
@@ -3527,45 +3532,45 @@ class mn {
3527
3532
  this.clear(), this.__disposer(), delete this.__disposer;
3528
3533
  }
3529
3534
  }
3530
- const vn = ["target", "oldTarget", "fireCanvas", "e"], yn = { passive: false }, _n = (t2, e3) => {
3535
+ const jn = ["target", "oldTarget", "fireCanvas", "e"], Fn = { passive: false }, Ln = (t2, e3) => {
3531
3536
  const s2 = t2.getViewportPoint(e3), i2 = t2.getScenePoint(e3);
3532
3537
  return { viewportPoint: s2, scenePoint: i2, pointer: s2, absolutePointer: i2 };
3533
- }, xn = function(t2) {
3538
+ }, Rn = function(t2) {
3534
3539
  for (var e3 = arguments.length, s2 = new Array(e3 > 1 ? e3 - 1 : 0), i2 = 1; i2 < e3; i2++) s2[i2 - 1] = arguments[i2];
3535
3540
  return t2.addEventListener(...s2);
3536
- }, Cn = function(t2) {
3541
+ }, In = function(t2) {
3537
3542
  for (var e3 = arguments.length, s2 = new Array(e3 > 1 ? e3 - 1 : 0), i2 = 1; i2 < e3; i2++) s2[i2 - 1] = arguments[i2];
3538
3543
  return t2.removeEventListener(...s2);
3539
- }, 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" } };
3540
- class Sn extends pn {
3544
+ }, 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" } };
3545
+ class Xn extends En {
3541
3546
  constructor(e3) {
3542
- 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) => {
3547
+ 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) => {
3543
3548
  this[t2] = this[t2].bind(this);
3544
- }), this.addOrRemove(xn, "add");
3549
+ }), this.addOrRemove(Rn, "add");
3545
3550
  }
3546
3551
  _getEventPrefix() {
3547
3552
  return this.enablePointerEvents ? "pointer" : "mouse";
3548
3553
  }
3549
3554
  addOrRemove(t2, e3) {
3550
3555
  const s2 = this.upperCanvasEl, i2 = this._getEventPrefix();
3551
- 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);
3556
+ 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);
3552
3557
  }
3553
3558
  removeListeners() {
3554
- this.addOrRemove(Cn, "remove");
3559
+ this.addOrRemove(In, "remove");
3555
3560
  const t2 = this._getEventPrefix(), e3 = Kt(this.upperCanvasEl);
3556
- 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);
3561
+ 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);
3557
3562
  }
3558
3563
  _onMouseWheel(t2) {
3559
3564
  this.__onMouseWheel(t2);
3560
3565
  }
3561
3566
  _onMouseOut(t2) {
3562
- const e3 = this._hoveredTarget, i2 = s({ e: t2 }, _n(this, t2));
3567
+ const e3 = this._hoveredTarget, i2 = s({ e: t2 }, Ln(this, t2));
3563
3568
  this.fire("mouse:out", s(s({}, i2), {}, { target: e3 })), this._hoveredTarget = void 0, e3 && e3.fire("mouseout", s({}, i2)), this._hoveredTargets.forEach((t3) => {
3564
3569
  this.fire("mouse:out", s(s({}, i2), {}, { target: t3 })), t3 && t3.fire("mouseout", s({}, i2));
3565
3570
  }), this._hoveredTargets = [];
3566
3571
  }
3567
3572
  _onMouseEnter(t2) {
3568
- this._currentTransform || this.findTarget(t2) || (this.fire("mouse:over", s({ e: t2 }, _n(this, t2))), this._hoveredTarget = void 0, this._hoveredTargets = []);
3573
+ this._currentTransform || this.findTarget(t2) || (this.fire("mouse:over", s({ e: t2 }, Ln(this, t2))), this._hoveredTarget = void 0, this._hoveredTargets = []);
3569
3574
  }
3570
3575
  _onDragStart(t2) {
3571
3576
  this._isClick = false;
@@ -3573,9 +3578,9 @@ class Sn extends pn {
3573
3578
  if (e3 && e3.onDragStart(t2)) {
3574
3579
  this._dragSource = e3;
3575
3580
  const s2 = { e: t2, target: e3 };
3576
- return this.fire("dragstart", s2), e3.fire("dragstart", s2), void xn(this.upperCanvasEl, "drag", this._onDragProgress);
3581
+ return this.fire("dragstart", s2), e3.fire("dragstart", s2), void Rn(this.upperCanvasEl, "drag", this._onDragProgress);
3577
3582
  }
3578
- oe(t2);
3583
+ ae(t2);
3579
3584
  }
3580
3585
  _renderDragEffects(t2, e3, s2) {
3581
3586
  let i2 = false;
@@ -3586,7 +3591,7 @@ class Sn extends pn {
3586
3591
  }
3587
3592
  _onDragEnd(t2) {
3588
3593
  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 };
3589
- Cn(this.upperCanvasEl, "drag", this._onDragProgress), this.fire("dragend", i2), this._dragSource && this._dragSource.fire("dragend", i2), delete this._dragSource, this._onMouseUp(t2);
3594
+ In(this.upperCanvasEl, "drag", this._onDragProgress), this.fire("dragend", i2), this._dragSource && this._dragSource.fire("dragend", i2), delete this._dragSource, this._onMouseUp(t2);
3590
3595
  }
3591
3596
  _onDragProgress(t2) {
3592
3597
  const e3 = { e: t2, target: this._dragSource, dragSource: this._dragSource, dropTarget: this._draggedoverTarget };
@@ -3615,12 +3620,12 @@ class Sn extends pn {
3615
3620
  this.fire("dragleave", e3), this._fireEnterLeaveEvents(void 0, e3), this._renderDragEffects(t2, this._dragSource), this._dropTarget = void 0, this.targets = [], this._hoveredTargets = [];
3616
3621
  }
3617
3622
  _onDrop(t2) {
3618
- 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)));
3623
+ 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)));
3619
3624
  r2.didDrop = false, r2.dropTarget = void 0, this._basicEventHandler("drop", r2), this.fire("drop:after", r2);
3620
3625
  }
3621
3626
  _onContextMenu(t2) {
3622
3627
  const e3 = this.findTarget(t2), s2 = this.targets || [], i2 = this._basicEventHandler("contextmenu:before", { e: t2, target: e3, subTargets: s2 });
3623
- return this.stopContextMenu && oe(t2), this._basicEventHandler("contextmenu", i2), false;
3628
+ return this.stopContextMenu && ae(t2), this._basicEventHandler("contextmenu", i2), false;
3624
3629
  }
3625
3630
  _onClick(t2) {
3626
3631
  const e3 = t2.detail;
@@ -3638,21 +3643,21 @@ class Sn extends pn {
3638
3643
  const s2 = this._activeObject;
3639
3644
  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();
3640
3645
  const i2 = this.upperCanvasEl, r2 = this._getEventPrefix(), n2 = Kt(i2);
3641
- xn(n2, "touchend", this._onTouchEnd, yn), e3 && xn(n2, "touchmove", this._onMouseMove, yn), Cn(i2, "".concat(r2, "down"), this._onMouseDown);
3646
+ Rn(n2, "touchend", this._onTouchEnd, Fn), e3 && Rn(n2, "touchmove", this._onMouseMove, Fn), In(i2, "".concat(r2, "down"), this._onMouseDown);
3642
3647
  }
3643
3648
  _onMouseDown(t2) {
3644
3649
  this.__onMouseDown(t2), this._resetTransformEventData();
3645
3650
  const e3 = this.upperCanvasEl, s2 = this._getEventPrefix();
3646
- Cn(e3, "".concat(s2, "move"), this._onMouseMove, yn);
3651
+ In(e3, "".concat(s2, "move"), this._onMouseMove, Fn);
3647
3652
  const i2 = Kt(e3);
3648
- xn(i2, "".concat(s2, "up"), this._onMouseUp), xn(i2, "".concat(s2, "move"), this._onMouseMove, yn);
3653
+ Rn(i2, "".concat(s2, "up"), this._onMouseUp), Rn(i2, "".concat(s2, "move"), this._onMouseMove, Fn);
3649
3654
  }
3650
3655
  _onTouchEnd(t2) {
3651
3656
  if (t2.touches.length > 0) return;
3652
3657
  this.__onMouseUp(t2), this._resetTransformEventData(), delete this.mainTouchId;
3653
3658
  const e3 = this._getEventPrefix(), s2 = Kt(this.upperCanvasEl);
3654
- Cn(s2, "touchend", this._onTouchEnd, yn), Cn(s2, "touchmove", this._onMouseMove, yn), this._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(() => {
3655
- xn(this.upperCanvasEl, "".concat(e3, "down"), this._onMouseDown), this._willAddMouseDown = 0;
3659
+ In(s2, "touchend", this._onTouchEnd, Fn), In(s2, "touchmove", this._onMouseMove, Fn), this._willAddMouseDown && clearTimeout(this._willAddMouseDown), this._willAddMouseDown = setTimeout(() => {
3660
+ Rn(this.upperCanvasEl, "".concat(e3, "down"), this._onMouseDown), this._willAddMouseDown = 0;
3656
3661
  }, 400);
3657
3662
  }
3658
3663
  _onMouseUp(t2) {
@@ -3660,7 +3665,7 @@ class Sn extends pn {
3660
3665
  const e3 = this.upperCanvasEl, s2 = this._getEventPrefix();
3661
3666
  if (this._isMainEvent(t2)) {
3662
3667
  const t3 = Kt(this.upperCanvasEl);
3663
- Cn(t3, "".concat(s2, "up"), this._onMouseUp), Cn(t3, "".concat(s2, "move"), this._onMouseMove, yn), xn(e3, "".concat(s2, "move"), this._onMouseMove, yn);
3668
+ In(t3, "".concat(s2, "up"), this._onMouseUp), In(t3, "".concat(s2, "move"), this._onMouseMove, Fn), Rn(e3, "".concat(s2, "move"), this._onMouseMove, Fn);
3664
3669
  }
3665
3670
  }
3666
3671
  _onMouseMove(t2) {
@@ -3687,7 +3692,7 @@ class Sn extends pn {
3687
3692
  this.handleSelection(t2), h2 || (h2 = this._shouldRender(r2) || !e4 && r2 === this._activeObject);
3688
3693
  }
3689
3694
  if (r2) {
3690
- const e4 = r2.findControl(this.getViewportPoint(t2), ne(t2)), { key: i3, control: n3 } = e4 || {};
3695
+ const e4 = r2.findControl(this.getViewportPoint(t2), oe(t2)), { key: i3, control: n3 } = e4 || {};
3691
3696
  if (a2 = i3, r2.selectable && r2 !== this._activeObject && "up" === r2.activeOn) this.setActiveObject(r2, t2), h2 = true;
3692
3697
  else if (n3) {
3693
3698
  const e5 = n3.getMouseUpHandler(t2, r2, n3);
@@ -3708,7 +3713,7 @@ class Sn extends pn {
3708
3713
  return e3;
3709
3714
  }
3710
3715
  _handleEvent(t2, e3, i2) {
3711
- 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 : {});
3716
+ 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 : {});
3712
3717
  this.fire("mouse:".concat(e3), o2), r2 && r2.fire("mouse".concat(e3), o2);
3713
3718
  for (let t3 = 0; t3 < n2.length; t3++) n2[t3] !== r2 && n2[t3].fire("mouse".concat(e3), o2);
3714
3719
  }
@@ -3743,7 +3748,7 @@ class Sn extends pn {
3743
3748
  }
3744
3749
  if (s2 = !!e3 && e3 === this._activeObject, e3) {
3745
3750
  e3.selectable && "down" === e3.activeOn && this.setActiveObject(e3, t2);
3746
- const i3 = e3.findControl(this.getViewportPoint(t2), ne(t2));
3751
+ const i3 = e3.findControl(this.getViewportPoint(t2), oe(t2));
3747
3752
  if (e3 === this._activeObject && (i3 || !n2)) {
3748
3753
  this._setupCurrentTransform(t2, e3, s2);
3749
3754
  const r3 = i3 ? i3.control : void 0, n3 = this.getScenePoint(t2), o2 = r3 && r3.getMouseDownHandler(t2, e3, r3);
@@ -3756,7 +3761,7 @@ class Sn extends pn {
3756
3761
  this._target = this._pointer = this._absolutePointer = void 0;
3757
3762
  }
3758
3763
  _cacheTransformEventData(t2) {
3759
- 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);
3764
+ 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);
3760
3765
  }
3761
3766
  __onMouseMove(t2) {
3762
3767
  if (this._isClick = false, this._cacheTransformEventData(t2), this._handleEvent(t2, "move:before"), this.isDrawingMode) return void this._onMouseMoveInDrawingMode(t2);
@@ -3775,7 +3780,7 @@ class Sn extends pn {
3775
3780
  _fireOverOutEvents(t2, e3) {
3776
3781
  const s2 = this._hoveredTarget, i2 = this._hoveredTargets, r2 = this.targets, n2 = Math.max(i2.length, r2.length);
3777
3782
  this.fireSyntheticInOutEvents("mouse", { e: t2, target: e3, oldTarget: s2, fireCanvas: true });
3778
- for (let e4 = 0; e4 < n2; e4++) this.fireSyntheticInOutEvents("mouse", { e: t2, target: r2[e4], oldTarget: i2[e4] });
3783
+ 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] });
3779
3784
  this._hoveredTarget = e3, this._hoveredTargets = this.targets.concat();
3780
3785
  }
3781
3786
  _fireEnterLeaveEvents(t2, e3) {
@@ -3785,14 +3790,14 @@ class Sn extends pn {
3785
3790
  this._draggedoverTarget = t2;
3786
3791
  }
3787
3792
  fireSyntheticInOutEvents(t2, e3) {
3788
- let { target: r2, oldTarget: n2, fireCanvas: o2, e: a2 } = e3, h2 = i(e3, vn);
3789
- const { targetIn: c2, targetOut: l2, canvasIn: u2, canvasOut: d2 } = bn[t2], g2 = n2 !== r2;
3793
+ let { target: r2, oldTarget: n2, fireCanvas: o2, e: a2 } = e3, h2 = i(e3, jn);
3794
+ const { targetIn: c2, targetOut: l2, canvasIn: u2, canvasOut: d2 } = Bn[t2], g2 = n2 !== r2;
3790
3795
  if (n2 && g2) {
3791
- const t3 = s(s({}, h2), {}, { e: a2, target: n2, nextTarget: r2 }, _n(this, a2));
3796
+ const t3 = s(s({}, h2), {}, { e: a2, target: n2, nextTarget: r2 }, Ln(this, a2));
3792
3797
  o2 && this.fire(d2, t3), n2.fire(l2, t3);
3793
3798
  }
3794
3799
  if (r2 && g2) {
3795
- const t3 = s(s({}, h2), {}, { e: a2, target: r2, previousTarget: n2 }, _n(this, a2));
3800
+ const t3 = s(s({}, h2), {}, { e: a2, target: r2, previousTarget: n2 }, Ln(this, a2));
3796
3801
  o2 && this.fire(u2, t3), r2.fire(c2, t3);
3797
3802
  }
3798
3803
  }
@@ -3800,7 +3805,7 @@ class Sn extends pn {
3800
3805
  this._cacheTransformEventData(t2), this._handleEvent(t2, "wheel"), this._resetTransformEventData();
3801
3806
  }
3802
3807
  _transformObject(t2) {
3803
- const e3 = this.getScenePoint(t2), s2 = this._currentTransform, i2 = s2.target, r2 = i2.group ? pe(e3, void 0, i2.group.calcTransformMatrix()) : e3;
3808
+ const e3 = this.getScenePoint(t2), s2 = this._currentTransform, i2 = s2.target, r2 = i2.group ? me(e3, void 0, i2.group.calcTransformMatrix()) : e3;
3804
3809
  s2.shiftKey = t2.shiftKey, s2.altKey = !!this.centeredKey && t2[this.centeredKey], this._performTransformAction(t2, s2, r2), s2.actionPerformed && this.requestRenderAll();
3805
3810
  }
3806
3811
  _performTransformAction(t2, e3, s2) {
@@ -3847,6 +3852,13 @@ class Sn extends pn {
3847
3852
  }
3848
3853
  return this._groupSelector = null, true;
3849
3854
  }
3855
+ toCanvasElement() {
3856
+ let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, e3 = arguments.length > 1 ? arguments[1] : void 0;
3857
+ const { upper: s2 } = this.elements;
3858
+ s2.ctx = void 0;
3859
+ const i2 = super.toCanvasElement(t2, e3);
3860
+ return s2.ctx = s2.el.getContext("2d"), i2;
3861
+ }
3850
3862
  clear() {
3851
3863
  this.textEditingManager.clear(), super.clear();
3852
3864
  }
@@ -3854,64 +3866,70 @@ class Sn extends pn {
3854
3866
  this.removeListeners(), this.textEditingManager.dispose(), super.destroy();
3855
3867
  }
3856
3868
  }
3857
- 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+)%$/;
3858
- function Dn(t2) {
3859
- return t2 && kn.test(t2);
3869
+ 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;
3870
+ function zn(t2) {
3871
+ return t2 && /%$/.test(t2) && Number.isFinite(parseFloat(t2));
3860
3872
  }
3861
- function Mn(t2, e3) {
3862
- const s2 = "number" == typeof t2 ? t2 : "string" == typeof t2 ? parseFloat(t2) / (Dn(t2) ? 100 : 1) : NaN;
3863
- return gs(0, On(s2, e3), 1);
3873
+ function Gn(t2, e3) {
3874
+ const s2 = "number" == typeof t2 ? t2 : "string" == typeof t2 ? parseFloat(t2) / (zn(t2) ? 100 : 1) : NaN;
3875
+ return Ms(0, Vn(s2, e3), 1);
3864
3876
  }
3865
- const Pn = /\s*;\s*/, En = /\s*:\s*/;
3866
- function An(t2, e3) {
3877
+ const Hn = /\s*;\s*/, Nn = /\s*:\s*/;
3878
+ function Un(t2, e3) {
3867
3879
  let s2, i2;
3868
3880
  const r2 = t2.getAttribute("style");
3869
3881
  if (r2) {
3870
- const t3 = r2.split(Pn);
3882
+ const t3 = r2.split(Hn);
3871
3883
  "" === t3[t3.length - 1] && t3.pop();
3872
3884
  for (let e4 = t3.length; e4--; ) {
3873
- const [r3, n3] = t3[e4].split(En).map((t4) => t4.trim());
3885
+ const [r3, n3] = t3[e4].split(Nn).map((t4) => t4.trim());
3874
3886
  "stop-color" === r3 ? s2 = n3 : "stop-opacity" === r3 && (i2 = n3);
3875
3887
  }
3876
3888
  }
3877
- const n2 = new Le(s2 || t2.getAttribute("stop-color") || "rgb(0,0,0)");
3878
- return { offset: Mn(t2.getAttribute("offset"), 0), color: n2.toRgb(), opacity: On(parseFloat(i2 || t2.getAttribute("stop-opacity") || ""), 1) * n2.getAlpha() * e3 };
3889
+ const n2 = new Ie(s2 || t2.getAttribute("stop-color") || "rgb(0,0,0)");
3890
+ return { offset: Gn(t2.getAttribute("offset"), 0), color: n2.toRgb(), opacity: Vn(parseFloat(i2 || t2.getAttribute("stop-opacity") || ""), 1) * n2.getAlpha() * e3 };
3879
3891
  }
3880
- function jn(t2, e3) {
3881
- const s2 = [], i2 = t2.getElementsByTagName("stop"), r2 = Mn(e3, 1);
3882
- for (let t3 = i2.length; t3--; ) s2.push(An(i2[t3], r2));
3892
+ function qn(t2, e3) {
3893
+ const s2 = [], i2 = t2.getElementsByTagName("stop"), r2 = Gn(e3, 1);
3894
+ for (let t3 = i2.length; t3--; ) s2.push(Un(i2[t3], r2));
3883
3895
  return s2;
3884
3896
  }
3885
- function Fn(t2) {
3897
+ function Kn(t2) {
3886
3898
  return "linearGradient" === t2.nodeName || "LINEARGRADIENT" === t2.nodeName ? "linear" : "radial";
3887
3899
  }
3888
- function Ln(t2) {
3900
+ function Jn(t2) {
3889
3901
  return "userSpaceOnUse" === t2.getAttribute("gradientUnits") ? "pixels" : "percentage";
3890
3902
  }
3891
- function Rn(t2, e3) {
3903
+ function Qn(t2, e3) {
3892
3904
  return t2.getAttribute(e3);
3893
3905
  }
3894
- function Bn(t2, e3) {
3906
+ function Zn(t2, e3) {
3895
3907
  return function(t3, e4) {
3896
3908
  let s2, { width: i2, height: r2, gradientUnits: n2 } = e4;
3897
- return Object.keys(t3).reduce((e5, o2) => {
3898
- const a2 = t3[o2];
3899
- 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;
3909
+ return Object.entries(t3).reduce((t4, e5) => {
3910
+ let [o2, a2] = e5;
3911
+ if ("Infinity" === a2) s2 = 1;
3912
+ else if ("-Infinity" === a2) s2 = 0;
3913
+ else {
3914
+ const t5 = "string" == typeof a2;
3915
+ 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)));
3916
+ }
3917
+ return t4[o2] = s2, t4;
3900
3918
  }, {});
3901
- }("linear" === Fn(t2) ? function(t3) {
3902
- return { x1: Rn(t3, "x1") || 0, y1: Rn(t3, "y1") || 0, x2: Rn(t3, "x2") || "100%", y2: Rn(t3, "y2") || 0 };
3919
+ }("linear" === Kn(t2) ? function(t3) {
3920
+ return { x1: Qn(t3, "x1") || 0, y1: Qn(t3, "y1") || 0, x2: Qn(t3, "x2") || "100%", y2: Qn(t3, "y2") || 0 };
3903
3921
  }(t2) : function(t3) {
3904
- 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%" };
3905
- }(t2), s(s({}, e3), {}, { gradientUnits: Ln(t2) }));
3922
+ 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%" };
3923
+ }(t2), s(s({}, e3), {}, { gradientUnits: Jn(t2) }));
3906
3924
  }
3907
- class In {
3925
+ class $n {
3908
3926
  constructor(t2) {
3909
3927
  const { type: e3 = "linear", gradientUnits: i2 = "pixels", coords: r2 = {}, colorStops: n2 = [], offsetX: o2 = 0, offsetY: a2 = 0, gradientTransform: h2, id: c2 } = t2 || {};
3910
- 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() });
3928
+ 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() });
3911
3929
  }
3912
3930
  addColorStop(t2) {
3913
3931
  for (const e3 in t2) {
3914
- const s2 = new Le(t2[e3]);
3932
+ const s2 = new Ie(t2[e3]);
3915
3933
  this.colorStops.push({ offset: parseFloat(e3), color: s2.toRgb(), opacity: s2.getAlpha() });
3916
3934
  }
3917
3935
  return this;
@@ -3951,7 +3969,7 @@ class In {
3951
3969
  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);
3952
3970
  return this.colorStops.forEach((t3) => {
3953
3971
  let { color: e4, opacity: s3, offset: i3 } = t3;
3954
- a2.addColorStop(i3, void 0 !== s3 ? new Le(e4).setAlpha(s3).toRgba() : e4);
3972
+ a2.addColorStop(i3, void 0 !== s3 ? new Ie(e4).setAlpha(s3).toRgba() : e4);
3955
3973
  }), a2;
3956
3974
  }
3957
3975
  static async fromObject(t2) {
@@ -3959,13 +3977,13 @@ class In {
3959
3977
  return new this(s(s({}, t2), {}, { colorStops: e3 ? e3.map((t3) => s({}, t3)) : void 0, gradientTransform: i2 ? [...i2] : void 0 }));
3960
3978
  }
3961
3979
  static fromElement(t2, e3, i2) {
3962
- const r2 = Ln(t2), n2 = e3._findCenterFromElement();
3963
- 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 }));
3980
+ const r2 = Jn(t2), n2 = e3._findCenterFromElement();
3981
+ 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 }));
3964
3982
  }
3965
3983
  }
3966
- t(In, "type", "Gradient"), tt.setClass(In, "gradient"), tt.setClass(In, "linear"), tt.setClass(In, "radial");
3967
- const Xn = ["type", "source", "patternTransform"];
3968
- class Yn {
3984
+ t($n, "type", "Gradient"), tt.setClass($n, "gradient"), tt.setClass($n, "linear"), tt.setClass($n, "radial");
3985
+ const to = ["type", "source", "patternTransform"];
3986
+ class eo {
3969
3987
  get type() {
3970
3988
  return "pattern";
3971
3989
  }
@@ -3994,24 +4012,24 @@ class Yn {
3994
4012
  }
3995
4013
  toSVG(t2) {
3996
4014
  let { width: e3, height: s2 } = t2;
3997
- 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);
4015
+ 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);
3998
4016
  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");
3999
4017
  }
4000
4018
  static async fromObject(t2, e3) {
4001
- let { type: r2, source: n2, patternTransform: o2 } = t2, a2 = i(t2, Xn);
4002
- const h2 = await Bt(n2, s(s({}, e3), {}, { crossOrigin: a2.crossOrigin }));
4019
+ let { type: r2, source: n2, patternTransform: o2 } = t2, a2 = i(t2, to);
4020
+ const h2 = await It(n2, s(s({}, e3), {}, { crossOrigin: a2.crossOrigin }));
4003
4021
  return new this(s(s({}, a2), {}, { patternTransform: o2 && o2.slice(0), source: h2 }));
4004
4022
  }
4005
4023
  }
4006
- t(Yn, "type", "Pattern"), tt.setClass(Yn), tt.setClass(Yn, "pattern");
4007
- const Vn = ["path", "left", "top"], zn = ["d"];
4008
- class Gn extends _i {
4024
+ t(eo, "type", "Pattern"), tt.setClass(eo), tt.setClass(eo, "pattern");
4025
+ const io = ["path", "left", "top"], ro = ["d"];
4026
+ class no extends Li {
4009
4027
  constructor(t2) {
4010
- let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { path: s2, left: r2, top: n2 } = e3, o2 = i(e3, Vn);
4011
- 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);
4028
+ let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, { path: s2, left: r2, top: n2 } = e3, o2 = i(e3, io);
4029
+ 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);
4012
4030
  }
4013
4031
  _setPath(t2, e3) {
4014
- this.path = Vr(Array.isArray(t2) ? t2 : on(t2)), this.setBoundingBox(e3);
4032
+ this.path = nn(Array.isArray(t2) ? t2 : bn(t2)), this.setBoundingBox(e3);
4015
4033
  }
4016
4034
  _findCenterFromElement() {
4017
4035
  const t2 = this._calcBoundsFromPath();
@@ -4053,7 +4071,7 @@ class Gn extends _i {
4053
4071
  return this.sourcePath && (delete e3.path, e3.sourcePath = this.sourcePath), e3;
4054
4072
  }
4055
4073
  _toSVG() {
4056
- const t2 = hn(this.path, o.NUM_FRACTION_DIGITS);
4074
+ const t2 = wn(this.path, o.NUM_FRACTION_DIGITS);
4057
4075
  return ["<path ", "COMMON_PARTS", 'd="'.concat(t2, '" stroke-linecap="round" />\n')];
4058
4076
  }
4059
4077
  _getOffsetTransform() {
@@ -4089,15 +4107,15 @@ class Gn extends _i {
4089
4107
  i2 = n2[1], r2 = n2[2], e3 = i2, s2 = r2;
4090
4108
  break;
4091
4109
  case "C":
4092
- t2.push(...Yr(i2, r2, n2[1], n2[2], n2[3], n2[4], n2[5], n2[6])), i2 = n2[5], r2 = n2[6];
4110
+ t2.push(...sn(i2, r2, n2[1], n2[2], n2[3], n2[4], n2[5], n2[6])), i2 = n2[5], r2 = n2[6];
4093
4111
  break;
4094
4112
  case "Q":
4095
- t2.push(...Yr(i2, r2, n2[1], n2[2], n2[1], n2[2], n2[3], n2[4])), i2 = n2[3], r2 = n2[4];
4113
+ t2.push(...sn(i2, r2, n2[1], n2[2], n2[1], n2[2], n2[3], n2[4])), i2 = n2[3], r2 = n2[4];
4096
4114
  break;
4097
4115
  case "Z":
4098
4116
  i2 = e3, r2 = s2;
4099
4117
  }
4100
- return ae(t2);
4118
+ return he(t2);
4101
4119
  }
4102
4120
  _calcDimensions() {
4103
4121
  const t2 = this._calcBoundsFromPath();
@@ -4107,18 +4125,18 @@ class Gn extends _i {
4107
4125
  return this._fromObject(t2, { extraParam: "path" });
4108
4126
  }
4109
4127
  static async fromElement(t2, e3, r2) {
4110
- const n2 = fr(t2, this.ATTRIBUTE_NAMES, r2), { d: o2 } = n2;
4111
- return new this(o2, s(s(s({}, i(n2, zn)), e3), {}, { left: void 0, top: void 0 }));
4128
+ const n2 = Pr(t2, this.ATTRIBUTE_NAMES, r2), { d: o2 } = n2;
4129
+ return new this(o2, s(s(s({}, i(n2, ro)), e3), {}, { left: void 0, top: void 0 }));
4112
4130
  }
4113
4131
  }
4114
- t(Gn, "type", "Path"), t(Gn, "cacheProperties", [...ps, "path", "fillRule"]), t(Gn, "ATTRIBUTE_NAMES", [...Ri, "d"]), tt.setClass(Gn), tt.setSVGClass(Gn);
4115
- const Nn = ["left", "top", "radius"], Un = ["radius", "startAngle", "endAngle", "counterClockwise"];
4116
- class qn extends _i {
4132
+ t(no, "type", "Path"), t(no, "cacheProperties", [...Es, "path", "fillRule"]), t(no, "ATTRIBUTE_NAMES", [...Zi, "d"]), tt.setClass(no), tt.setSVGClass(no);
4133
+ const ao = ["left", "top", "radius"], ho = ["radius", "startAngle", "endAngle", "counterClockwise"];
4134
+ class co extends Li {
4117
4135
  static getDefaults() {
4118
- return s(s({}, super.getDefaults()), qn.ownDefaults);
4136
+ return s(s({}, super.getDefaults()), co.ownDefaults);
4119
4137
  }
4120
4138
  constructor(t2) {
4121
- super(), Object.assign(this, qn.ownDefaults), this.setOptions(t2);
4139
+ super(), Object.assign(this, co.ownDefaults), this.setOptions(t2);
4122
4140
  }
4123
4141
  _set(t2, e3) {
4124
4142
  return super._set(t2, e3), "radius" === t2 && this.setRadius(e3), this;
@@ -4137,7 +4155,7 @@ class qn extends _i {
4137
4155
  }
4138
4156
  toObject() {
4139
4157
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
4140
- return super.toObject([...Un, ...t2]);
4158
+ return super.toObject([...ho, ...t2]);
4141
4159
  }
4142
4160
  _toSVG() {
4143
4161
  const t2 = (this.endAngle - this.startAngle) % 360;
@@ -4148,30 +4166,30 @@ class qn extends _i {
4148
4166
  }
4149
4167
  }
4150
4168
  static async fromElement(t2, e3, r2) {
4151
- const n2 = fr(t2, this.ATTRIBUTE_NAMES, r2), { left: o2 = 0, top: a2 = 0, radius: h2 = 0 } = n2;
4152
- return new this(s(s({}, i(n2, Nn)), {}, { radius: h2, left: o2 - h2, top: a2 - h2 }));
4169
+ const n2 = Pr(t2, this.ATTRIBUTE_NAMES, r2), { left: o2 = 0, top: a2 = 0, radius: h2 = 0 } = n2;
4170
+ return new this(s(s({}, i(n2, ao)), {}, { radius: h2, left: o2 - h2, top: a2 - h2 }));
4153
4171
  }
4154
4172
  static fromObject(t2) {
4155
4173
  return super._fromObject(t2);
4156
4174
  }
4157
4175
  }
4158
- 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);
4159
- const Zn = ["x1", "y1", "x2", "y2"], $n = ["x1", "y1", "x2", "y2"], to = ["x1", "x2", "y1", "y2"];
4160
- class eo extends _i {
4176
+ 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);
4177
+ const fo = ["x1", "y1", "x2", "y2"], po = ["x1", "y1", "x2", "y2"], mo = ["x1", "x2", "y1", "y2"];
4178
+ class vo extends Li {
4161
4179
  constructor() {
4162
4180
  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] : {};
4163
- super(), Object.assign(this, eo.ownDefaults), this.setOptions(r2), this.x1 = t2, this.x2 = s2, this.y1 = e3, this.y2 = i2, this._setWidthHeight();
4181
+ super(), Object.assign(this, vo.ownDefaults), this.setOptions(r2), this.x1 = t2, this.x2 = s2, this.y1 = e3, this.y2 = i2, this._setWidthHeight();
4164
4182
  const { left: n2, top: o2 } = r2;
4165
4183
  "number" == typeof n2 && this.set(M, n2), "number" == typeof o2 && this.set(P, o2);
4166
4184
  }
4167
4185
  _setWidthHeight() {
4168
4186
  const { x1: t2, y1: e3, x2: s2, y2: i2 } = this;
4169
4187
  this.width = Math.abs(s2 - t2), this.height = Math.abs(i2 - e3);
4170
- 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);
4188
+ 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);
4171
4189
  this.setPositionByOrigin(h2, D, D);
4172
4190
  }
4173
4191
  _set(t2, e3) {
4174
- return super._set(t2, e3), to.includes(t2) && this._setWidthHeight(), this;
4192
+ return super._set(t2, e3), mo.includes(t2) && this._setWidthHeight(), this;
4175
4193
  }
4176
4194
  _render(t2) {
4177
4195
  t2.beginPath();
@@ -4202,21 +4220,21 @@ class eo extends _i {
4202
4220
  return ["<line ", "COMMON_PARTS", 'x1="'.concat(t2, '" y1="').concat(s2, '" x2="').concat(e3, '" y2="').concat(i2, '" />\n')];
4203
4221
  }
4204
4222
  static async fromElement(t2, e3, s2) {
4205
- const r2 = fr(t2, this.ATTRIBUTE_NAMES, s2), { x1: n2 = 0, y1: o2 = 0, x2: a2 = 0, y2: h2 = 0 } = r2;
4206
- return new this([n2, o2, a2, h2], i(r2, Zn));
4223
+ const r2 = Pr(t2, this.ATTRIBUTE_NAMES, s2), { x1: n2 = 0, y1: o2 = 0, x2: a2 = 0, y2: h2 = 0 } = r2;
4224
+ return new this([n2, o2, a2, h2], i(r2, fo));
4207
4225
  }
4208
4226
  static fromObject(t2) {
4209
- let { x1: e3, y1: r2, x2: n2, y2: o2 } = t2, a2 = i(t2, $n);
4227
+ let { x1: e3, y1: r2, x2: n2, y2: o2 } = t2, a2 = i(t2, po);
4210
4228
  return this._fromObject(s(s({}, a2), {}, { points: [e3, r2, n2, o2] }), { extraParam: "points" });
4211
4229
  }
4212
4230
  }
4213
- t(eo, "type", "Line"), t(eo, "cacheProperties", [...ps, ...to]), t(eo, "ATTRIBUTE_NAMES", Ri.concat(to)), tt.setClass(eo), tt.setSVGClass(eo);
4214
- class so extends _i {
4231
+ t(vo, "type", "Line"), t(vo, "cacheProperties", [...Es, ...mo]), t(vo, "ATTRIBUTE_NAMES", Zi.concat(mo)), tt.setClass(vo), tt.setSVGClass(vo);
4232
+ class yo extends Li {
4215
4233
  static getDefaults() {
4216
- return s(s({}, super.getDefaults()), so.ownDefaults);
4234
+ return s(s({}, super.getDefaults()), yo.ownDefaults);
4217
4235
  }
4218
4236
  constructor(t2) {
4219
- super(), Object.assign(this, so.ownDefaults), this.setOptions(t2);
4237
+ super(), Object.assign(this, yo.ownDefaults), this.setOptions(t2);
4220
4238
  }
4221
4239
  _render(t2) {
4222
4240
  const e3 = this.width / 2, s2 = this.height / 2;
@@ -4227,14 +4245,14 @@ class so extends _i {
4227
4245
  return ["<polygon ", "COMMON_PARTS", 'points="', "".concat(-t2, " ").concat(e3, ",0 ").concat(-e3, ",").concat(t2, " ").concat(e3), '" />'];
4228
4246
  }
4229
4247
  }
4230
- t(so, "type", "Triangle"), t(so, "ownDefaults", { width: 100, height: 100 }), tt.setClass(so), tt.setSVGClass(so);
4231
- const io = ["rx", "ry"];
4232
- class ro extends _i {
4248
+ t(yo, "type", "Triangle"), t(yo, "ownDefaults", { width: 100, height: 100 }), tt.setClass(yo), tt.setSVGClass(yo);
4249
+ const _o = ["rx", "ry"];
4250
+ class xo extends Li {
4233
4251
  static getDefaults() {
4234
- return s(s({}, super.getDefaults()), ro.ownDefaults);
4252
+ return s(s({}, super.getDefaults()), xo.ownDefaults);
4235
4253
  }
4236
4254
  constructor(t2) {
4237
- super(), Object.assign(this, ro.ownDefaults), this.setOptions(t2);
4255
+ super(), Object.assign(this, xo.ownDefaults), this.setOptions(t2);
4238
4256
  }
4239
4257
  _set(t2, e3) {
4240
4258
  switch (super._set(t2, e3), t2) {
@@ -4254,7 +4272,7 @@ class ro extends _i {
4254
4272
  }
4255
4273
  toObject() {
4256
4274
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
4257
- return super.toObject([...io, ...t2]);
4275
+ return super.toObject([..._o, ...t2]);
4258
4276
  }
4259
4277
  _toSVG() {
4260
4278
  return ["<ellipse ", "COMMON_PARTS", 'cx="0" cy="0" rx="'.concat(this.rx, '" ry="').concat(this.ry, '" />\n')];
@@ -4263,25 +4281,25 @@ class ro extends _i {
4263
4281
  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);
4264
4282
  }
4265
4283
  static async fromElement(t2, e3, s2) {
4266
- const i2 = fr(t2, this.ATTRIBUTE_NAMES, s2);
4284
+ const i2 = Pr(t2, this.ATTRIBUTE_NAMES, s2);
4267
4285
  return i2.left = (i2.left || 0) - i2.rx, i2.top = (i2.top || 0) - i2.ry, new this(i2);
4268
4286
  }
4269
4287
  }
4270
- function no(t2) {
4288
+ function Co(t2) {
4271
4289
  if (!t2) return [];
4272
4290
  const e3 = t2.replace(/,/g, " ").trim().split(/\s+/), s2 = [];
4273
4291
  for (let t3 = 0; t3 < e3.length; t3 += 2) s2.push({ x: parseFloat(e3[t3]), y: parseFloat(e3[t3 + 1]) });
4274
4292
  return s2;
4275
4293
  }
4276
- 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);
4277
- const oo = ["left", "top"], ao = { exactBoundingBox: false };
4278
- class ho extends _i {
4294
+ 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);
4295
+ const bo = ["left", "top"], So = { exactBoundingBox: false };
4296
+ class wo extends Li {
4279
4297
  static getDefaults() {
4280
- return s(s({}, super.getDefaults()), ho.ownDefaults);
4298
+ return s(s({}, super.getDefaults()), wo.ownDefaults);
4281
4299
  }
4282
4300
  constructor() {
4283
4301
  let e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
4284
- super(), t(this, "strokeDiff", void 0), Object.assign(this, ho.ownDefaults), this.setOptions(s2), this.points = e3;
4302
+ super(), t(this, "strokeDiff", void 0), Object.assign(this, wo.ownDefaults), this.setOptions(s2), this.points = e3;
4285
4303
  const { left: i2, top: r2 } = s2;
4286
4304
  this.initialized = true, this.setBoundingBox(true), "number" == typeof i2 && this.set(M, i2), "number" == typeof r2 && this.set(P, r2);
4287
4305
  }
@@ -4289,18 +4307,18 @@ class ho extends _i {
4289
4307
  return true;
4290
4308
  }
4291
4309
  _projectStrokeOnPoints(t2) {
4292
- return Ti(this.points, t2, this.isOpen());
4310
+ return Wi(this.points, t2, this.isOpen());
4293
4311
  }
4294
4312
  _calcDimensions(t2) {
4295
4313
  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 || {});
4296
4314
  const e3 = this.exactBoundingBox ? this._projectStrokeOnPoints(t2).map((t3) => t3.projectedPoint) : this.points;
4297
4315
  if (0 === e3.length) return { left: 0, top: 0, width: 0, height: 0, pathOffset: new ot(), strokeOffset: new ot(), strokeDiff: new ot() };
4298
- 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);
4316
+ 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);
4299
4317
  let a2 = i2.left + i2.width / 2, h2 = i2.top + i2.height / 2;
4300
4318
  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) });
4301
4319
  }
4302
4320
  _findCenterFromElement() {
4303
- const t2 = ae(this.points);
4321
+ const t2 = he(this.points);
4304
4322
  return new ot(t2.left + t2.width / 2, t2.top + t2.height / 2);
4305
4323
  }
4306
4324
  setDimensions() {
@@ -4363,21 +4381,20 @@ class ho extends _i {
4363
4381
  return this.points.length;
4364
4382
  }
4365
4383
  static async fromElement(t2, e3, r2) {
4366
- return new this(no(t2.getAttribute("points")), s(s({}, i(fr(t2, this.ATTRIBUTE_NAMES, r2), oo)), e3));
4384
+ return new this(Co(t2.getAttribute("points")), s(s({}, i(Pr(t2, this.ATTRIBUTE_NAMES, r2), bo)), e3));
4367
4385
  }
4368
4386
  static fromObject(t2) {
4369
4387
  return this._fromObject(t2, { extraParam: "points" });
4370
4388
  }
4371
4389
  }
4372
- 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);
4373
- class co extends ho {
4390
+ 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);
4391
+ class To extends wo {
4374
4392
  isOpen() {
4375
4393
  return false;
4376
4394
  }
4377
4395
  }
4378
- t(co, "ownDefaults", ao), t(co, "type", "Polygon"), tt.setClass(co), tt.setSVGClass(co);
4379
- 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";
4380
- class Co extends _i {
4396
+ t(To, "ownDefaults", So), t(To, "type", "Polygon"), tt.setClass(To), tt.setSVGClass(To);
4397
+ class Oo extends Li {
4381
4398
  isEmptyStyles(t2) {
4382
4399
  if (!this.styles) return true;
4383
4400
  if (void 0 !== t2 && !this.styles[t2]) return true;
@@ -4459,38 +4476,38 @@ class Co extends _i {
4459
4476
  delete this.styles[t2];
4460
4477
  }
4461
4478
  }
4462
- t(Co, "_styleProperties", po);
4463
- const bo = / +/g, So = /"/g;
4464
- function wo(t2, e3, s2, i2, r2) {
4479
+ t(Oo, "_styleProperties", qe);
4480
+ const ko = / +/g, Do = /"/g;
4481
+ function Mo(t2, e3, s2, i2, r2) {
4465
4482
  return " ".concat(function(t3, e4) {
4466
4483
  let { left: s3, top: i3, width: r3, height: n2 } = e4, a2 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : o.NUM_FRACTION_DIGITS;
4467
- const h2 = Ie(K, t3, false), [c2, l2, u2, d2] = [s3, i3, r3, n2].map((t4) => Vt(t4, a2));
4484
+ const h2 = Ye(K, t3, false), [c2, l2, u2, d2] = [s3, i3, r3, n2].map((t4) => Vt(t4, a2));
4468
4485
  return "<rect ".concat(h2, ' x="').concat(c2, '" y="').concat(l2, '" width="').concat(u2, '" height="').concat(d2, '"></rect>');
4469
4486
  }(t2, { left: e3, top: s2, width: i2, height: r2 }), "\n");
4470
4487
  }
4471
- const To = ["textAnchor", "textDecoration", "dx", "dy", "top", "left", "fontSize", "strokeWidth"];
4472
- let Oo;
4473
- class ko extends Co {
4488
+ const Po = ["textAnchor", "textDecoration", "dx", "dy", "top", "left", "fontSize", "strokeWidth"];
4489
+ let Eo;
4490
+ class Ao extends Oo {
4474
4491
  static getDefaults() {
4475
- return s(s({}, super.getDefaults()), ko.ownDefaults);
4492
+ return s(s({}, super.getDefaults()), Ao.ownDefaults);
4476
4493
  }
4477
4494
  constructor(e3, s2) {
4478
- 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();
4495
+ 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();
4479
4496
  }
4480
4497
  setPathInfo() {
4481
4498
  const t2 = this.path;
4482
- t2 && (t2.segmentsInfo = $r(t2.path));
4499
+ t2 && (t2.segmentsInfo = mn(t2.path));
4483
4500
  }
4484
4501
  _splitText() {
4485
4502
  const t2 = this._splitTextIntoLines(this.text);
4486
4503
  return this.textLines = t2.lines, this._textLines = t2.graphemeLines, this._unwrappedTextLines = t2._unwrappedLines, this._text = t2.graphemeText, t2;
4487
4504
  }
4488
4505
  initDimensions() {
4489
- 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();
4506
+ 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();
4490
4507
  }
4491
4508
  enlargeSpaces() {
4492
4509
  let t2, e3, s2, i2, r2, n2, o2;
4493
- 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)))) {
4510
+ 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)))) {
4494
4511
  s2 = o2.length, t2 = (this.width - e3) / s2;
4495
4512
  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;
4496
4513
  }
@@ -4560,26 +4577,27 @@ class ko extends Co {
4560
4577
  }
4561
4578
  const n2 = this._textLines[e4].length, o2 = this._getLineLeftOffset(e4);
4562
4579
  let a2, h2, c2 = 0, l2 = 0, u2 = this.getValueOfPropertyAt(e4, 0, "textBackgroundColor");
4563
- for (let d2 = 0; d2 < n2; d2++) {
4564
- const n3 = this.__charBounds[e4][d2];
4565
- 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;
4580
+ const d2 = this.getHeightOfLineImpl(e4);
4581
+ for (let r4 = 0; r4 < n2; r4++) {
4582
+ const n3 = this.__charBounds[e4][r4];
4583
+ 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;
4566
4584
  }
4567
- 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;
4585
+ 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;
4568
4586
  }
4569
4587
  t2.fillStyle = e3, this._removeShadow(t2);
4570
4588
  }
4571
4589
  _measureChar(t2, e3, s2, i2) {
4572
- const r2 = _.getFontCache(e3), n2 = this._getFontDeclaration(e3), o2 = s2 + t2, a2 = s2 && n2 === this._getFontDeclaration(i2), h2 = e3.fontSize / this.CACHE_FONT_SIZE;
4590
+ 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;
4573
4591
  let c2, l2, u2, d2;
4574
- 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) {
4592
+ 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) {
4575
4593
  const i3 = function() {
4576
- if (!Oo) {
4594
+ if (!Eo) {
4577
4595
  const t3 = vt({ width: 0, height: 0 });
4578
- Oo = t3.getContext("2d");
4596
+ Eo = t3.getContext("2d");
4579
4597
  }
4580
- return Oo;
4598
+ return Eo;
4581
4599
  }();
4582
- 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);
4600
+ 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);
4583
4601
  }
4584
4602
  return { width: c2 * h2, kernedWidth: d2 * h2 };
4585
4603
  }
@@ -4617,7 +4635,7 @@ class ko extends Co {
4617
4635
  return { width: i2, numOfSpaces: 0 };
4618
4636
  }
4619
4637
  _setGraphemeOnPath(t2, e3) {
4620
- const s2 = t2 + e3.kernedWidth / 2, i2 = this.path, r2 = tn(i2.path, s2, i2.segmentsInfo);
4638
+ const s2 = t2 + e3.kernedWidth / 2, i2 = this.path, r2 = vn(i2.path, s2, i2.segmentsInfo);
4621
4639
  e3.renderLeft = r2.x - i2.pathOffset.x, e3.renderTop = r2.y - i2.pathOffset.y, e3.angle = r2.angle + (this.pathSide === A ? Math.PI : 0);
4622
4640
  }
4623
4641
  _getGraphemeBox(t2, e3, s2, i2, r2) {
@@ -4631,16 +4649,20 @@ class ko extends Co {
4631
4649
  }
4632
4650
  return u2;
4633
4651
  }
4652
+ getHeightOfLineImpl(t2) {
4653
+ const e3 = this.__lineHeights;
4654
+ if (e3[t2]) return e3[t2];
4655
+ let s2 = this.getHeightOfChar(t2, 0);
4656
+ for (let e4 = 1, i2 = this._textLines[t2].length; e4 < i2; e4++) s2 = Math.max(this.getHeightOfChar(t2, e4), s2);
4657
+ return e3[t2] = s2 * this._fontSizeMult;
4658
+ }
4634
4659
  getHeightOfLine(t2) {
4635
- if (this.__lineHeights[t2]) return this.__lineHeights[t2];
4636
- let e3 = this.getHeightOfChar(t2, 0);
4637
- for (let s2 = 1, i2 = this._textLines[t2].length; s2 < i2; s2++) e3 = Math.max(this.getHeightOfChar(t2, s2), e3);
4638
- return this.__lineHeights[t2] = e3 * this.lineHeight * this._fontSizeMult;
4660
+ return this.getHeightOfLineImpl(t2) * this.lineHeight;
4639
4661
  }
4640
4662
  calcTextHeight() {
4641
- let t2, e3 = 0;
4642
- for (let s2 = 0, i2 = this._textLines.length; s2 < i2; s2++) t2 = this.getHeightOfLine(s2), e3 += s2 === i2 - 1 ? t2 / this.lineHeight : t2;
4643
- return e3;
4663
+ let t2 = 0;
4664
+ for (let e3 = 0, s2 = this._textLines.length; e3 < s2; e3++) t2 += e3 === s2 - 1 ? this.getHeightOfLineImpl(e3) : this.getHeightOfLine(e3);
4665
+ return t2;
4644
4666
  }
4645
4667
  _getLeftOffset() {
4646
4668
  return "ltr" === this.direction ? -this.width / 2 : this.width / 2;
@@ -4652,10 +4674,7 @@ class ko extends Co {
4652
4674
  t2.save();
4653
4675
  let s2 = 0;
4654
4676
  const i2 = this._getLeftOffset(), r2 = this._getTopOffset();
4655
- for (let n2 = 0, o2 = this._textLines.length; n2 < o2; n2++) {
4656
- const o3 = this.getHeightOfLine(n2), a2 = o3 / this.lineHeight, h2 = this._getLineLeftOffset(n2);
4657
- this._renderTextLine(e3, t2, this._textLines[n2], i2 + h2, r2 + s2 + a2, n2), s2 += o3;
4658
- }
4677
+ 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);
4659
4678
  t2.restore();
4660
4679
  }
4661
4680
  _renderTextFill(t2) {
@@ -4665,10 +4684,10 @@ class ko extends Co {
4665
4684
  (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());
4666
4685
  }
4667
4686
  _renderChars(t2, e3, s2, i2, r2, n2) {
4668
- 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;
4669
- let g2, f, p2, m2, v2, y2 = "", _2 = 0;
4670
- 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();
4671
- 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);
4687
+ 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;
4688
+ let d2, g2, f, p2, m2, v2 = "", y2 = 0;
4689
+ 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();
4690
+ 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);
4672
4691
  e3.restore();
4673
4692
  }
4674
4693
  _applyPatternGradientTransformText(t2) {
@@ -4714,7 +4733,7 @@ class ko extends Co {
4714
4733
  _getLineLeftOffset(t2) {
4715
4734
  const e3 = this.getLineWidth(t2), s2 = this.width - e3, i2 = this.textAlign, r2 = this.direction, n2 = this.isEndOfWrapping(t2);
4716
4735
  let o2 = 0;
4717
- 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);
4736
+ 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);
4718
4737
  }
4719
4738
  _clearCache() {
4720
4739
  this._forceClearCache = false, this.__lineWidths = [], this.__lineHeights = [], this.__charBounds = [];
@@ -4734,42 +4753,47 @@ class ko extends Co {
4734
4753
  _renderTextDecoration(t2, e3) {
4735
4754
  if (!this[e3] && !this.styleHas(e3)) return;
4736
4755
  let s2 = this._getTopOffset();
4737
- const i2 = this._getLeftOffset(), r2 = this.path, n2 = this._getWidthOfCharSpacing(), o2 = this.offsets[e3];
4738
- for (let a2 = 0, h2 = this._textLines.length; a2 < h2; a2++) {
4739
- const h3 = this.getHeightOfLine(a2);
4740
- if (!this[e3] && !this.styleHas(e3, a2)) {
4741
- s2 += h3;
4756
+ const i2 = this._getLeftOffset(), r2 = this.path, n2 = this._getWidthOfCharSpacing(), o2 = "linethrough" === e3 ? 0.5 : "overline" === e3 ? 1 : 0, a2 = this.offsets[e3];
4757
+ for (let h2 = 0, c2 = this._textLines.length; h2 < c2; h2++) {
4758
+ const c3 = this.getHeightOfLine(h2);
4759
+ if (!this[e3] && !this.styleHas(e3, h2)) {
4760
+ s2 += c3;
4742
4761
  continue;
4743
4762
  }
4744
- const c2 = this._textLines[a2], l2 = h3 / this.lineHeight, u2 = this._getLineLeftOffset(a2);
4745
- let d2, g2, f = 0, p2 = 0, m2 = this.getValueOfPropertyAt(a2, 0, e3), v2 = this.getValueOfPropertyAt(a2, 0, K);
4746
- const y2 = s2 + l2 * (1 - this._fontSizeFraction);
4747
- let _2 = this.getHeightOfChar(a2, 0), x2 = this.getValueOfPropertyAt(a2, 0, "deltaY");
4748
- for (let s3 = 0, n3 = c2.length; s3 < n3; s3++) {
4749
- const n4 = this.__charBounds[a2][s3];
4750
- d2 = this.getValueOfPropertyAt(a2, s3, e3), g2 = this.getValueOfPropertyAt(a2, s3, K);
4751
- const h4 = this.getHeightOfChar(a2, s3), c3 = this.getValueOfPropertyAt(a2, s3, "deltaY");
4752
- 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();
4753
- else if ((d2 !== m2 || g2 !== v2 || h4 !== _2 || c3 !== x2) && p2 > 0) {
4754
- let e4 = i2 + u2 + f;
4755
- "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;
4756
- } else p2 += n4.kernedWidth;
4763
+ const l2 = this._textLines[h2], u2 = c3 / this.lineHeight, d2 = this._getLineLeftOffset(h2);
4764
+ 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;
4765
+ const C2 = s2 + u2 * (1 - this._fontSizeFraction);
4766
+ let b2 = this.getHeightOfChar(h2, 0), S2 = this.getValueOfPropertyAt(h2, 0, "deltaY");
4767
+ for (let s3 = 0, n3 = l2.length; s3 < n3; s3++) {
4768
+ const n4 = this.__charBounds[h2][s3];
4769
+ y2 = this.getValueOfPropertyAt(h2, s3, e3), _2 = this.getValueOfPropertyAt(h2, s3, K), x2 = this.getValueOfPropertyAt(h2, s3, ze);
4770
+ const c4 = this.getHeightOfChar(h2, s3), l3 = this.getValueOfPropertyAt(h2, s3, "deltaY");
4771
+ if (r2 && y2 && _2) {
4772
+ const e4 = this.fontSize * x2 / 1e3;
4773
+ 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();
4774
+ } else if ((y2 !== p2 || _2 !== m2 || c4 !== b2 || x2 !== v2 || l3 !== S2) && f > 0) {
4775
+ const e4 = this.fontSize * v2 / 1e3;
4776
+ let s4 = i2 + d2 + g2;
4777
+ "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;
4778
+ } else f += n4.kernedWidth;
4757
4779
  }
4758
- let C2 = i2 + u2 + f;
4759
- "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;
4780
+ let w2 = i2 + d2 + g2;
4781
+ "rtl" === this.direction && (w2 = this.width - w2 - f), t2.fillStyle = _2;
4782
+ const T2 = this.fontSize * x2 / 1e3;
4783
+ y2 && _2 && x2 && t2.fillRect(w2, C2 + a2 * b2 + S2 - o2 * T2, f - n2, T2), s2 += c3;
4760
4784
  }
4761
4785
  this._removeShadow(t2);
4762
4786
  }
4763
4787
  _getFontDeclaration() {
4764
4788
  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;
4765
- const n2 = t2.includes("'") || t2.includes('"') || t2.includes(",") || ko.genericFonts.includes(t2.toLowerCase()) ? t2 : '"'.concat(t2, '"');
4789
+ const n2 = t2.includes("'") || t2.includes('"') || t2.includes(",") || Ao.genericFonts.includes(t2.toLowerCase()) ? t2 : '"'.concat(t2, '"');
4766
4790
  return [e3, s2, "".concat(r2 ? this.CACHE_FONT_SIZE : i2, "px"), n2].join(" ");
4767
4791
  }
4768
4792
  render(t2) {
4769
4793
  this.visible && (this.canvas && this.canvas.skipOffscreen && !this.group && !this.isOnScreen() || (this._forceClearCache && this.initDimensions(), super.render(t2)));
4770
4794
  }
4771
4795
  graphemeSplit(t2) {
4772
- return Mi(t2);
4796
+ return Hi(t2);
4773
4797
  }
4774
4798
  _splitTextIntoLines(t2) {
4775
4799
  const e3 = t2.split(this._reNewline), s2 = new Array(e3.length), i2 = ["\n"];
@@ -4779,7 +4803,7 @@ class ko extends Co {
4779
4803
  }
4780
4804
  toObject() {
4781
4805
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
4782
- return s(s({}, super.toObject([...fo, ...t2])), {}, { styles: Fi(this.styles, this.text) }, this.path ? { path: this.path.toObject() } : {});
4806
+ return s(s({}, super.toObject([...Ue, ...t2])), {}, { styles: Ji(this.styles, this.text) }, this.path ? { path: this.path.toObject() } : {});
4783
4807
  }
4784
4808
  set(t2, e3) {
4785
4809
  const { textLayoutProperties: s2 } = this.constructor;
@@ -4793,15 +4817,15 @@ class ko extends Co {
4793
4817
  return 1;
4794
4818
  }
4795
4819
  static async fromElement(t2, e3, r2) {
4796
- 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;
4820
+ 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;
4797
4821
  let x2 = 0;
4798
4822
  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;
4799
4823
  }
4800
4824
  static fromObject(t2) {
4801
- return this._fromObject(s(s({}, t2), {}, { styles: Li(t2.styles || {}, t2.text) }), { extraParam: "text" });
4825
+ return this._fromObject(s(s({}, t2), {}, { styles: Qi(t2.styles || {}, t2.text) }), { extraParam: "text" });
4802
4826
  }
4803
4827
  }
4804
- 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 {
4828
+ 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 {
4805
4829
  _toSVG() {
4806
4830
  const t2 = this._getSVGLeftTopOffsets(), e3 = this._getSVGTextAndBg(t2.textTop, t2.textLeft);
4807
4831
  return this._wrapSVGTextAndBg(e3);
@@ -4816,17 +4840,17 @@ t(ko, "textLayoutProperties", go), t(ko, "cacheProperties", [...ps, ...fo]), t(k
4816
4840
  _wrapSVGTextAndBg(t2) {
4817
4841
  let { textBgRects: e3, textSpans: s2 } = t2;
4818
4842
  const i2 = this.getSvgTextDecoration(this);
4819
- 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"];
4843
+ 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"];
4820
4844
  }
4821
4845
  _getSVGTextAndBg(t2, e3) {
4822
4846
  const s2 = [], i2 = [];
4823
4847
  let r2, n2 = t2;
4824
- this.backgroundColor && i2.push(...wo(this.backgroundColor, -this.width / 2, -this.height / 2, this.width, this.height));
4848
+ this.backgroundColor && i2.push(...Mo(this.backgroundColor, -this.width / 2, -this.height / 2, this.width, this.height));
4825
4849
  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);
4826
4850
  return { textSpans: s2, textBgRects: i2 };
4827
4851
  }
4828
4852
  _createTextCharSpan(t2, e3, s2, i2, r2) {
4829
- 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;
4853
+ 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;
4830
4854
  let p2 = "";
4831
4855
  if (void 0 !== d2) {
4832
4856
  const t3 = f / 2;
@@ -4836,22 +4860,22 @@ t(ko, "textLayoutProperties", go), t(ko, "cacheProperties", [...ps, ...fo]), t(k
4836
4860
  const r3 = new ot(-t3, 0).transform(e4);
4837
4861
  s2 = r3.x, i2 = r3.y;
4838
4862
  }
4839
- return '<tspan x="'.concat(Vt(s2, n2), '" y="').concat(Vt(i2, n2), '" ').concat(l2).concat(p2).concat(h2, ">").concat(ki(t2), "</tspan>");
4863
+ return '<tspan x="'.concat(Vt(s2, n2), '" y="').concat(Vt(i2, n2), '" ').concat(l2).concat(p2).concat(h2, ">").concat(zi(t2), "</tspan>");
4840
4864
  }
4841
4865
  _setSVGTextLineText(t2, e3, s2, i2) {
4842
- const r2 = this.getHeightOfLine(e3), n2 = this.textAlign.includes(vo), o2 = this._textLines[e3];
4866
+ const r2 = this.getHeightOfLine(e3), n2 = this.textAlign.includes(Je), o2 = this._textLines[e3];
4843
4867
  let a2, h2, c2, l2, u2, d2 = "", g2 = 0;
4844
4868
  i2 += r2 * (1 - this._fontSizeFraction) / this.lineHeight;
4845
- 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);
4869
+ 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);
4846
4870
  }
4847
4871
  _setSVGTextLineBg(t2, e3, s2, i2) {
4848
4872
  const r2 = this._textLines[e3], n2 = this.getHeightOfLine(e3) / this.lineHeight;
4849
4873
  let o2, a2 = 0, h2 = 0, c2 = this.getValueOfPropertyAt(e3, 0, "textBackgroundColor");
4850
4874
  for (let l2 = 0; l2 < r2.length; l2++) {
4851
4875
  const { left: r3, width: u2, kernedWidth: d2 } = this.__charBounds[e3][l2];
4852
- 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;
4876
+ 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;
4853
4877
  }
4854
- o2 && t2.push(...wo(c2, s2 + h2, i2, a2, n2));
4878
+ o2 && t2.push(...Mo(c2, s2 + h2, i2, a2, n2));
4855
4879
  }
4856
4880
  _getSVGLineTopOffset(t2) {
4857
4881
  let e3, s2 = 0;
@@ -4860,17 +4884,17 @@ t(ko, "textLayoutProperties", go), t(ko, "cacheProperties", [...ps, ...fo]), t(k
4860
4884
  return { lineTop: s2, offset: (this._fontSizeMult - this._fontSizeFraction) * i2 / (this.lineHeight * this._fontSizeMult) };
4861
4885
  }
4862
4886
  getSvgStyles(t2) {
4863
- return "".concat(super.getSvgStyles(t2), " white-space: pre;");
4887
+ return "".concat(super.getSvgStyles(t2), " text-decoration-thickness: ").concat(Vt(this.textDecorationThickness * this.getObjectScaling().y / 10, o.NUM_FRACTION_DIGITS), "%; white-space: pre;");
4864
4888
  }
4865
4889
  getSvgSpanStyles(t2, e3) {
4866
- const { fontFamily: s2, strokeWidth: i2, stroke: r2, fill: n2, fontSize: o2, fontStyle: a2, fontWeight: h2, deltaY: c2 } = t2, l2 = this.getSvgTextDecoration(t2);
4867
- 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("");
4890
+ 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;
4891
+ 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("");
4868
4892
  }
4869
4893
  getSvgTextDecoration(t2) {
4870
4894
  return ["overline", "underline", "line-through"].filter((e3) => t2[e3.replace("-", "")]).join(" ");
4871
4895
  }
4872
- }]), tt.setClass(ko), tt.setSVGClass(ko);
4873
- class Do {
4896
+ }]), tt.setClass(Ao), tt.setSVGClass(Ao);
4897
+ class jo {
4874
4898
  constructor(e3) {
4875
4899
  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;
4876
4900
  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))];
@@ -4898,12 +4922,12 @@ class Do {
4898
4922
  setDragImage(t2, e3) {
4899
4923
  var s2;
4900
4924
  let { selectionStart: i2, selectionEnd: r2 } = e3;
4901
- 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);
4925
+ 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);
4902
4926
  n2.backgroundColor = "";
4903
4927
  const y2 = { stroke: "transparent", fill: "transparent", textBackgroundColor: "transparent" };
4904
4928
  n2.setSelectionStyles(y2, 0, i2), n2.setSelectionStyles(y2, r2, n2.text.length), n2.dirty = true;
4905
4929
  const _2 = n2.toCanvasElement({ enableRetinaScaling: o2.enableRetinaScaling, viewportTransform: true });
4906
- 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 = () => {
4930
+ 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 = () => {
4907
4931
  _2.remove();
4908
4932
  }, Kt(t2.target || this.target.hiddenTextarea).body.appendChild(_2), null === (s2 = t2.dataTransfer) || void 0 === s2 || s2.setDragImage(_2, p2.x, p2.y);
4909
4933
  }
@@ -4970,8 +4994,8 @@ class Do {
4970
4994
  this._dispose && this._dispose();
4971
4995
  }
4972
4996
  }
4973
- const Mo = /[ \n\.,;!\?\-]/;
4974
- class Po extends ko {
4997
+ const Fo = /[ \n\.,;!\?\-]/;
4998
+ class Lo extends Ao {
4975
4999
  constructor() {
4976
5000
  super(...arguments), t(this, "_currentCursorOpacity", 1);
4977
5001
  }
@@ -4983,7 +5007,7 @@ class Po extends ko {
4983
5007
  }
4984
5008
  _animateCursor(t2) {
4985
5009
  let { toValue: e3, duration: s2, delay: i2, onComplete: r2 } = t2;
4986
- return js({ startValue: this._currentCursorOpacity, endValue: e3, duration: s2, delay: i2, onComplete: r2, abort: () => !this.canvas || this.selectionStart !== this.selectionEnd, onChange: (t3) => {
5010
+ return Ks({ startValue: this._currentCursorOpacity, endValue: e3, duration: s2, delay: i2, onComplete: r2, abort: () => !this.canvas || this.selectionStart !== this.selectionEnd, onChange: (t3) => {
4987
5011
  this._currentCursorOpacity = t3, this.renderCursorOrSelection();
4988
5012
  } });
4989
5013
  }
@@ -5040,8 +5064,8 @@ class Po extends ko {
5040
5064
  searchWordBoundary(t2, e3) {
5041
5065
  const s2 = this._text;
5042
5066
  let i2 = t2 > 0 && this._reSpace.test(s2[t2]) && (-1 === e3 || !F.test(s2[t2 - 1])) ? t2 - 1 : t2, r2 = s2[i2];
5043
- for (; i2 > 0 && i2 < s2.length && !Mo.test(r2); ) i2 += e3, r2 = s2[i2];
5044
- return -1 === e3 && Mo.test(r2) && i2++, i2;
5067
+ for (; i2 > 0 && i2 < s2.length && !Fo.test(r2); ) i2 += e3, r2 = s2[i2];
5068
+ return -1 === e3 && Fo.test(r2) && i2++, i2;
5045
5069
  }
5046
5070
  selectWord(t2) {
5047
5071
  var e3;
@@ -5206,10 +5230,10 @@ class Po extends ko {
5206
5230
  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);
5207
5231
  }
5208
5232
  }
5209
- class Eo extends Po {
5233
+ class Ro extends Lo {
5210
5234
  initHiddenTextarea() {
5211
5235
  const t2 = this.canvas && Kt(this.canvas.getElement()) || m(), e3 = t2.createElement("textarea");
5212
- Object.entries({ autocapitalize: "off", autocorrect: "off", autocomplete: "off", spellcheck: "false", "data-fabric": "textarea", wrap: "off" }).map((t3) => {
5236
+ Object.entries({ autocapitalize: "off", autocorrect: "off", autocomplete: "off", spellcheck: "false", "data-fabric": "textarea", wrap: "off", name: "fabricTextarea" }).map((t3) => {
5213
5237
  let [s3, i3] = t3;
5214
5238
  return e3.setAttribute(s3, i3);
5215
5239
  });
@@ -5312,7 +5336,7 @@ class Eo extends Po {
5312
5336
  const s2 = this["get".concat(t2, "CursorOffset")](e3, this._selectionDirection === A);
5313
5337
  if (e3.shiftKey ? this.moveCursorWithShift(s2) : this.moveCursorWithoutShift(s2), 0 !== s2) {
5314
5338
  const t3 = this.text.length;
5315
- this.selectionStart = gs(0, this.selectionStart, t3), this.selectionEnd = gs(0, this.selectionEnd, t3), this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea();
5339
+ this.selectionStart = Ms(0, this.selectionStart, t3), this.selectionEnd = Ms(0, this.selectionEnd, t3), this.abortCursorAnimation(), this.initDelayedCursor(), this._fireSelectionChanged(), this._updateTextarea();
5316
5340
  }
5317
5341
  }
5318
5342
  moveCursorWithShift(t2) {
@@ -5362,13 +5386,13 @@ class Eo extends Po {
5362
5386
  return this._selectionDirection = A, this.selectionStart === this.selectionEnd ? (e3 = this._moveRight(t2, "selectionStart"), this.selectionEnd = this.selectionStart) : this.selectionStart = this.selectionEnd, e3;
5363
5387
  }
5364
5388
  }
5365
- const Ao = (t2) => !!t2.button;
5366
- class jo extends Eo {
5389
+ const Io = (t2) => !!t2.button;
5390
+ class Bo extends Ro {
5367
5391
  constructor() {
5368
5392
  super(...arguments), t(this, "draggableTextDelegate", void 0);
5369
5393
  }
5370
5394
  initBehavior() {
5371
- 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();
5395
+ 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();
5372
5396
  }
5373
5397
  shouldStartDragging() {
5374
5398
  return this.draggableTextDelegate.isActive();
@@ -5387,7 +5411,7 @@ class jo extends Eo {
5387
5411
  }
5388
5412
  _mouseDownHandler(t2) {
5389
5413
  let { e: e3, alreadySelected: s2 } = t2;
5390
- 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)));
5414
+ 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)));
5391
5415
  }
5392
5416
  mouseUpHandler(t2) {
5393
5417
  let { e: e3, transform: s2 } = t2;
@@ -5397,7 +5421,7 @@ class jo extends Eo {
5397
5421
  const t3 = this.canvas._activeObject;
5398
5422
  if (t3 && t3 !== this) return;
5399
5423
  }
5400
- !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());
5424
+ !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());
5401
5425
  }
5402
5426
  setCursorByClick(t2) {
5403
5427
  const e3 = this.getSelectionStartFromPointer(t2), s2 = this.selectionStart, i2 = this.selectionEnd;
@@ -5420,25 +5444,25 @@ class jo extends Eo {
5420
5444
  return Math.min(this.flipX ? o2 - i2 : i2, this._text.length);
5421
5445
  }
5422
5446
  }
5423
- const Fo = "moveCursorUp", Lo = "moveCursorDown", Ro = "moveCursorLeft", Bo = "moveCursorRight", Io = "exitEditing", Xo = (t2, e3) => {
5447
+ const Xo = "moveCursorUp", Yo = "moveCursorDown", Wo = "moveCursorLeft", Vo = "moveCursorRight", zo = "exitEditing", Go = (t2, e3) => {
5424
5448
  const s2 = e3.getRetinaScaling();
5425
5449
  t2.setTransform(s2, 0, 0, s2, 0, 0);
5426
5450
  const i2 = e3.viewportTransform;
5427
5451
  t2.transform(i2[0], i2[1], i2[2], i2[3], i2[4], i2[5]);
5428
- }, 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 });
5429
- class Wo extends jo {
5452
+ }, 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 });
5453
+ class No extends Bo {
5430
5454
  static getDefaults() {
5431
- return s(s({}, super.getDefaults()), Wo.ownDefaults);
5455
+ return s(s({}, super.getDefaults()), No.ownDefaults);
5432
5456
  }
5433
5457
  get type() {
5434
5458
  const t2 = super.type;
5435
5459
  return "itext" === t2 ? "i-text" : t2;
5436
5460
  }
5437
5461
  constructor(t2, e3) {
5438
- super(t2, s(s({}, Wo.ownDefaults), e3)), this.initBehavior();
5462
+ super(t2, s(s({}, No.ownDefaults), e3)), this.initBehavior();
5439
5463
  }
5440
5464
  _set(t2, e3) {
5441
- 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));
5465
+ 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));
5442
5466
  }
5443
5467
  setSelectionStart(t2) {
5444
5468
  t2 = Math.max(t2, 0), this._updateAndFire("selectionStart", t2);
@@ -5483,13 +5507,13 @@ class Wo extends jo {
5483
5507
  const e3 = this._getCursorBoundaries(), s2 = this.findAncestorsWithClipPath(), i2 = s2.length > 0;
5484
5508
  let r2, n2 = t2;
5485
5509
  if (i2) {
5486
- r2 = vt(t2.canvas), n2 = r2.getContext("2d"), Xo(n2, this.canvas);
5510
+ r2 = vt(t2.canvas), n2 = r2.getContext("2d"), Go(n2, this.canvas);
5487
5511
  const e4 = this.calcTransformMatrix();
5488
5512
  n2.transform(e4[0], e4[1], e4[2], e4[3], e4[4], e4[5]);
5489
5513
  }
5490
5514
  if (this.selectionStart !== this.selectionEnd || this.inCompositionMode ? this.renderSelection(n2, e3) : this.renderCursor(n2, e3), i2) for (const e4 of s2) {
5491
5515
  const s3 = e4.clipPath, i3 = vt(t2.canvas), r3 = i3.getContext("2d");
5492
- if (Xo(r3, this.canvas), !s3.absolutePositioned) {
5516
+ if (Go(r3, this.canvas), !s3.absolutePositioned) {
5493
5517
  const t3 = e4.calcTransformMatrix();
5494
5518
  r3.transform(t3[0], t3[1], t3[2], t3[3], t3[4], t3[5]);
5495
5519
  }
@@ -5518,7 +5542,7 @@ class Wo extends jo {
5518
5542
  const n2 = this._getLineLeftOffset(r2), o2 = this.__charBounds[r2][i2];
5519
5543
  o2 && (s2 = o2.left), 0 !== this.charSpacing && i2 === this._textLines[r2].length && (s2 -= this._getWidthOfCharSpacing());
5520
5544
  const a2 = { top: e3, left: n2 + (s2 > 0 ? s2 : 0) };
5521
- 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;
5545
+ 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;
5522
5546
  }
5523
5547
  renderCursorAt(t2) {
5524
5548
  this._renderCursor(this.canvas.contextTop, this._getCursorBoundaries(t2, true), t2);
@@ -5548,7 +5572,7 @@ class Wo extends jo {
5548
5572
  this.renderCursorAt(e3);
5549
5573
  }
5550
5574
  _renderSelection(t2, e3, s2) {
5551
- 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;
5575
+ 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;
5552
5576
  for (let e4 = h2; e4 <= c2; e4++) {
5553
5577
  const i3 = this._getLineLeftOffset(e4) || 0;
5554
5578
  let r3 = this.getHeightOfLine(e4), o3 = 0, a3 = 0, d2 = 0;
@@ -5561,7 +5585,7 @@ class Wo extends jo {
5561
5585
  o3 = r3, (this.lineHeight < 1 || e4 === c2 && this.lineHeight > 1) && (r3 /= this.lineHeight);
5562
5586
  let g2 = s2.left + i3 + a3, f = r3, p2 = 0;
5563
5587
  const m2 = d2 - a3;
5564
- 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;
5588
+ 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;
5565
5589
  }
5566
5590
  }
5567
5591
  getCurrentCharFontSize() {
@@ -5580,19 +5604,19 @@ class Wo extends jo {
5580
5604
  this.exitEditingImpl(), this.draggableTextDelegate.dispose(), super.dispose();
5581
5605
  }
5582
5606
  }
5583
- t(Wo, "ownDefaults", Yo), t(Wo, "type", "IText"), tt.setClass(Wo), tt.setClass(Wo, "i-text");
5584
- class Vo extends Wo {
5607
+ t(No, "ownDefaults", Ho), t(No, "type", "IText"), tt.setClass(No), tt.setClass(No, "i-text");
5608
+ class Uo extends No {
5585
5609
  static getDefaults() {
5586
- return s(s({}, super.getDefaults()), Vo.ownDefaults);
5610
+ return s(s({}, super.getDefaults()), Uo.ownDefaults);
5587
5611
  }
5588
5612
  constructor(t2, e3) {
5589
- super(t2, s(s({}, Vo.ownDefaults), e3));
5613
+ super(t2, s(s({}, Uo.ownDefaults), e3));
5590
5614
  }
5591
5615
  static createControls() {
5592
- return { controls: mi() };
5616
+ return { controls: Ai() };
5593
5617
  }
5594
5618
  initDimensions() {
5595
- 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());
5619
+ 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());
5596
5620
  }
5597
5621
  _generateStyleMap(t2) {
5598
5622
  let e3 = 0, s2 = 0, i2 = 0;
@@ -5714,8 +5738,8 @@ class Vo extends Wo {
5714
5738
  return super.toObject(["minWidth", "splitByGrapheme", ...t2]);
5715
5739
  }
5716
5740
  }
5717
- 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);
5718
- class zo extends Sr {
5741
+ 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);
5742
+ class qo extends Xr {
5719
5743
  shouldPerformLayout(t2) {
5720
5744
  return !!t2.target.clipPath && super.shouldPerformLayout(t2);
5721
5745
  }
@@ -5725,9 +5749,9 @@ class zo extends Sr {
5725
5749
  calcLayoutResult(t2, e3) {
5726
5750
  const { target: s2 } = t2, { clipPath: i2, group: r2 } = s2;
5727
5751
  if (!i2 || !this.shouldPerformLayout(t2)) return;
5728
- const { width: n2, height: o2 } = ae(br(s2, i2)), a2 = new ot(n2, o2);
5752
+ const { width: n2, height: o2 } = he(Br(s2, i2)), a2 = new ot(n2, o2);
5729
5753
  if (i2.absolutePositioned) {
5730
- return { center: pe(i2.getRelativeCenterPoint(), void 0, r2 ? r2.calcTransformMatrix() : void 0), size: a2 };
5754
+ return { center: me(i2.getRelativeCenterPoint(), void 0, r2 ? r2.calcTransformMatrix() : void 0), size: a2 };
5731
5755
  }
5732
5756
  {
5733
5757
  const r3 = i2.getRelativeCenterPoint().transform(s2.calcOwnMatrix(), true);
@@ -5739,15 +5763,15 @@ class zo extends Sr {
5739
5763
  }
5740
5764
  }
5741
5765
  }
5742
- t(zo, "type", "clip-path"), tt.setClass(zo);
5743
- class Go extends Sr {
5766
+ t(qo, "type", "clip-path"), tt.setClass(qo);
5767
+ class Ko extends Xr {
5744
5768
  getInitialSize(t2, e3) {
5745
5769
  let { target: s2 } = t2, { size: i2 } = e3;
5746
5770
  return new ot(s2.width || i2.x, s2.height || i2.y);
5747
5771
  }
5748
5772
  }
5749
- t(Go, "type", "fixed"), tt.setClass(Go);
5750
- class Ho extends Dr {
5773
+ t(Ko, "type", "fixed"), tt.setClass(Ko);
5774
+ class Jo extends Gr {
5751
5775
  subscribeTargets(t2) {
5752
5776
  const e3 = t2.target;
5753
5777
  t2.targets.reduce((t3, e4) => (e4.parent && t3.add(e4.parent), t3), /* @__PURE__ */ new Set()).forEach((t3) => {
@@ -5761,15 +5785,15 @@ class Ho extends Dr {
5761
5785
  });
5762
5786
  }
5763
5787
  }
5764
- class No extends Er {
5788
+ class Qo extends Ur {
5765
5789
  static getDefaults() {
5766
- return s(s({}, super.getDefaults()), No.ownDefaults);
5790
+ return s(s({}, super.getDefaults()), Qo.ownDefaults);
5767
5791
  }
5768
5792
  constructor() {
5769
5793
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
5770
- super(), Object.assign(this, No.ownDefaults), this.setOptions(e3);
5794
+ super(), Object.assign(this, Qo.ownDefaults), this.setOptions(e3);
5771
5795
  const { left: s2, top: i2, layoutManager: r2 } = e3;
5772
- this.groupInit(t2, { left: s2, top: i2, layoutManager: null != r2 ? r2 : new Ho() });
5796
+ this.groupInit(t2, { left: s2, top: i2, layoutManager: null != r2 ? r2 : new Jo() });
5773
5797
  }
5774
5798
  _shouldSetNestedCoords() {
5775
5799
  return true;
@@ -5798,8 +5822,8 @@ class No extends Er {
5798
5822
  e3.forEach((t3) => {
5799
5823
  const { parent: e4 } = t3;
5800
5824
  e4 && s2.add(e4);
5801
- }), t2 === xr ? s2.forEach((t3) => {
5802
- t3._onAfterObjectsChange(_r, e3);
5825
+ }), t2 === Rr ? s2.forEach((t3) => {
5826
+ t3._onAfterObjectsChange(Lr, e3);
5803
5827
  }) : s2.forEach((t3) => {
5804
5828
  t3._set("dirty", true);
5805
5829
  });
@@ -5823,8 +5847,8 @@ class No extends Er {
5823
5847
  super._renderControls(t2, e3), t2.restore();
5824
5848
  }
5825
5849
  }
5826
- t(No, "type", "ActiveSelection"), t(No, "ownDefaults", { multiSelectionStacking: "canvas-stacking" }), tt.setClass(No), tt.setClass(No, "activeSelection");
5827
- class Uo {
5850
+ t(Qo, "type", "ActiveSelection"), t(Qo, "ownDefaults", { multiSelectionStacking: "canvas-stacking" }), tt.setClass(Qo), tt.setClass(Qo, "activeSelection");
5851
+ class Zo {
5828
5852
  constructor() {
5829
5853
  t(this, "resources", {});
5830
5854
  }
@@ -5840,7 +5864,7 @@ class Uo {
5840
5864
  return a2.width === s2 && a2.height === i2 || (r2.width = a2.width, r2.height = a2.height), n2.putImageData(a2, 0, 0), o2;
5841
5865
  }
5842
5866
  }
5843
- class qo {
5867
+ class $o {
5844
5868
  constructor() {
5845
5869
  let { tileSize: e3 = o.textureSize } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
5846
5870
  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();
@@ -5913,21 +5937,21 @@ class qo {
5913
5937
  return this.gpuInfo = e3, e3;
5914
5938
  }
5915
5939
  }
5916
- let Ko;
5917
- function Jo() {
5940
+ let ta;
5941
+ function ea() {
5918
5942
  const { WebGLProbe: t2 } = p();
5919
- return t2.queryWebGL(pt()), o.enableGLFiltering && t2.isSupported(o.textureSize) ? new qo({ tileSize: o.textureSize }) : new Uo();
5943
+ return t2.queryWebGL(pt()), o.enableGLFiltering && t2.isSupported(o.textureSize) ? new $o({ tileSize: o.textureSize }) : new Zo();
5920
5944
  }
5921
- function Qo() {
5922
- return !Ko && (!(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]) && (Ko = Jo()), Ko;
5945
+ function sa() {
5946
+ return !ta && (!(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]) && (ta = ea()), ta;
5923
5947
  }
5924
- const $o = ["filters", "resizeFilter", "src", "crossOrigin", "type"], ta = ["cropX", "cropY"];
5925
- class ea extends _i {
5948
+ const ra = ["filters", "resizeFilter", "src", "crossOrigin", "type"], na = ["cropX", "cropY"];
5949
+ class oa extends Li {
5926
5950
  static getDefaults() {
5927
- return s(s({}, super.getDefaults()), ea.ownDefaults);
5951
+ return s(s({}, super.getDefaults()), oa.ownDefaults);
5928
5952
  }
5929
5953
  constructor(e3, s2) {
5930
- 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);
5954
+ 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);
5931
5955
  }
5932
5956
  getElement() {
5933
5957
  return this._element;
@@ -5935,11 +5959,11 @@ class ea extends _i {
5935
5959
  setElement(t2) {
5936
5960
  var e3;
5937
5961
  let s2 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
5938
- 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();
5962
+ 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();
5939
5963
  }
5940
5964
  removeTexture(t2) {
5941
- const e3 = Qo(false);
5942
- e3 instanceof qo && e3.evictCachesForKey(t2);
5965
+ const e3 = sa(false);
5966
+ e3 instanceof $o && e3.evictCachesForKey(t2);
5943
5967
  }
5944
5968
  dispose() {
5945
5969
  super.dispose(), this.removeTexture(this.cacheKey), this.removeTexture("".concat(this.cacheKey, "_filtered")), this._cacheContext = null, ["_originalElement", "_element", "_filteredEl", "_cacheCanvas"].forEach((t2) => {
@@ -5964,7 +5988,7 @@ class ea extends _i {
5964
5988
  const e3 = [];
5965
5989
  return this.filters.forEach((t3) => {
5966
5990
  t3 && e3.push(t3.toObject());
5967
- }), s(s({}, super.toObject([...ta, ...t2])), {}, { src: this.getSrc(), crossOrigin: this.getCrossOrigin(), filters: e3 }, this.resizeFilter ? { resizeFilter: this.resizeFilter.toObject() } : {});
5991
+ }), s(s({}, super.toObject([...na, ...t2])), {}, { src: this.getSrc(), crossOrigin: this.getCrossOrigin(), filters: e3 }, this.resizeFilter ? { resizeFilter: this.resizeFilter.toObject() } : {});
5968
5992
  }
5969
5993
  hasCrop() {
5970
5994
  return !!this.cropX || !!this.cropY || this.width < this._element.width || this.height < this._element.height;
@@ -5992,7 +6016,7 @@ class ea extends _i {
5992
6016
  }
5993
6017
  setSrc(t2) {
5994
6018
  let { crossOrigin: e3, signal: s2 } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
5995
- return Bt(t2, { crossOrigin: e3, signal: s2 }).then((t3) => {
6019
+ return It(t2, { crossOrigin: e3, signal: s2 }).then((t3) => {
5996
6020
  void 0 !== e3 && this.set({ crossOrigin: e3 }), this.setElement(t3);
5997
6021
  });
5998
6022
  }
@@ -6003,7 +6027,7 @@ class ea extends _i {
6003
6027
  const t2 = this.resizeFilter, e3 = this.minimumScaleTrigger, s2 = this.getTotalObjectScaling(), i2 = s2.x, r2 = s2.y, n2 = this._filteredEl || this._originalElement;
6004
6028
  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);
6005
6029
  const o2 = vt(n2), { width: a2, height: h2 } = n2;
6006
- 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;
6030
+ 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;
6007
6031
  }
6008
6032
  applyFilters() {
6009
6033
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.filters || [];
@@ -6013,7 +6037,7 @@ class ea extends _i {
6013
6037
  const t3 = vt({ width: s2, height: i2 });
6014
6038
  this._element = t3, this._filteredEl = t3;
6015
6039
  } else this._filteredEl && (this._element = this._filteredEl, this._filteredEl.getContext("2d").clearRect(0, 0, s2, i2), this._lastScaleX = 1, this._lastScaleY = 1);
6016
- 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);
6040
+ 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);
6017
6041
  }
6018
6042
  _render(t2) {
6019
6043
  t2.imageSmoothingEnabled = this.imageSmoothing, true !== this.isMoving && this.resizeFilter && this._needsResize() && this.applyResizeFilters(), this._stroke(t2), this._renderPaintInOrder(t2);
@@ -6043,57 +6067,57 @@ class ea extends _i {
6043
6067
  this.width = t2 || s2.width, this.height = e3 || s2.height;
6044
6068
  }
6045
6069
  parsePreserveAspectRatioAttribute() {
6046
- const t2 = Be(this.preserveAspectRatio || ""), e3 = this.width, s2 = this.height, i2 = { width: e3, height: s2 };
6070
+ const t2 = Xe(this.preserveAspectRatio || ""), e3 = this.width, s2 = this.height, i2 = { width: e3, height: s2 };
6047
6071
  let r2, n2 = this._element.width, o2 = this._element.height, a2 = 1, h2 = 1, c2 = 0, l2 = 0, u2 = 0, d2 = 0;
6048
- 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 };
6072
+ 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 };
6049
6073
  }
6050
6074
  static fromObject(t2, e3) {
6051
- let { filters: r2, resizeFilter: n2, src: o2, crossOrigin: a2, type: h2 } = t2, c2 = i(t2, $o);
6052
- return Promise.all([Bt(o2, s(s({}, e3), {}, { crossOrigin: a2 })), r2 && It(r2, e3), n2 && It([n2], e3), Xt(c2, e3)]).then((t3) => {
6075
+ let { filters: r2, resizeFilter: n2, src: o2, crossOrigin: a2, type: h2 } = t2, c2 = i(t2, ra);
6076
+ return Promise.all([It(o2, s(s({}, e3), {}, { crossOrigin: a2 })), r2 && Bt(r2, e3), n2 && Bt([n2], e3), Xt(c2, e3)]).then((t3) => {
6053
6077
  let [e4, i2 = [], [r3] = [], n3 = {}] = t3;
6054
6078
  return new this(e4, s(s({}, c2), {}, { src: o2, filters: i2, resizeFilter: r3 }, n3));
6055
6079
  });
6056
6080
  }
6057
6081
  static fromURL(t2) {
6058
6082
  let { crossOrigin: e3 = null, signal: s2 } = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i2 = arguments.length > 2 ? arguments[2] : void 0;
6059
- return Bt(t2, { crossOrigin: e3, signal: s2 }).then((t3) => new this(t3, i2));
6083
+ return It(t2, { crossOrigin: e3, signal: s2 }).then((t3) => new this(t3, i2));
6060
6084
  }
6061
6085
  static async fromElement(t2) {
6062
6086
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, s2 = arguments.length > 2 ? arguments[2] : void 0;
6063
- const i2 = fr(t2, this.ATTRIBUTE_NAMES, s2);
6087
+ const i2 = Pr(t2, this.ATTRIBUTE_NAMES, s2);
6064
6088
  return this.fromURL(i2["xlink:href"] || i2.href, e3, i2).catch((t3) => (a("log", "Unable to parse Image", t3), null));
6065
6089
  }
6066
6090
  }
6067
- 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);
6068
- Ye(["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"]);
6069
- const ya = W, _a = (t2) => function(e3, s2, i2) {
6091
+ 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);
6092
+ Ve(["pattern", "defs", "symbol", "metadata", "clipPath", "mask", "desc"]);
6093
+ const Sa = W, wa = (t2) => function(e3, s2, i2) {
6070
6094
  const { points: r2, pathOffset: n2 } = i2;
6071
6095
  return new ot(r2[t2]).subtract(n2).transform(Tt(i2.getViewportTransform(), i2.calcTransformMatrix()));
6072
- }, xa = (t2, e3, s2, i2) => {
6073
- const { target: r2, pointIndex: n2 } = e3, o2 = r2, a2 = pe(new ot(s2, i2), void 0, o2.calcOwnMatrix());
6096
+ }, Ta = (t2, e3, s2, i2) => {
6097
+ const { target: r2, pointIndex: n2 } = e3, o2 = r2, a2 = me(new ot(s2, i2), void 0, o2.calcOwnMatrix());
6074
6098
  return o2.points[n2] = a2.add(o2.pathOffset), o2.setDimensions(), o2.set("dirty", true), true;
6075
- }, Ca = (t2, e3) => function(i2, r2, n2, o2) {
6099
+ }, Oa = (t2, e3) => function(i2, r2, n2, o2) {
6076
6100
  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);
6077
6101
  return a2.left -= u2.x, a2.top -= u2.y, l2;
6078
- }, ba = (t2) => Ys(ya, Ca(t2, xa));
6079
- const Sa = (t2, e3, s2) => {
6102
+ }, ka = (t2) => si(Sa, Oa(t2, Ta));
6103
+ const Da = (t2, e3, s2) => {
6080
6104
  const { path: i2, pathOffset: r2 } = t2, n2 = i2[e3];
6081
6105
  return new ot(n2[s2] - r2.x, n2[s2 + 1] - r2.y).transform(Tt(t2.getViewportTransform(), t2.calcTransformMatrix()));
6082
6106
  };
6083
- function wa(t2, e3, s2) {
6107
+ function Ma(t2, e3, s2) {
6084
6108
  const { commandIndex: i2, pointIndex: r2 } = this;
6085
- return Sa(s2, i2, r2);
6109
+ return Da(s2, i2, r2);
6086
6110
  }
6087
- function Ta(t2, e3, i2, r2) {
6111
+ function Pa(t2, e3, i2, r2) {
6088
6112
  const { target: n2 } = e3, { commandIndex: o2, pointIndex: a2 } = this, h2 = ((t3, e4, s2, i3, r3) => {
6089
- 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());
6113
+ 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());
6090
6114
  n3[i3][r3] = l2.x + o3.x, n3[i3][r3 + 1] = l2.y + o3.y, t3.setDimensions();
6091
6115
  const u2 = h3.subtract(t3.pathOffset).transform(t3.calcOwnMatrix()).subtract(c2);
6092
6116
  return t3.left -= u2.x, t3.top -= u2.y, t3.set("dirty", true), true;
6093
6117
  })(n2, i2, r2, o2, a2);
6094
- return ye(this.actionName, s(s({}, Te(t2, e3, i2, r2)), {}, { commandIndex: o2, pointIndex: a2 })), h2;
6118
+ return _e(this.actionName, s(s({}, Oe(t2, e3, i2, r2)), {}, { commandIndex: o2, pointIndex: a2 })), h2;
6095
6119
  }
6096
- class Oa extends Hs {
6120
+ class Ea extends ai {
6097
6121
  constructor(t2) {
6098
6122
  super(t2);
6099
6123
  }
@@ -6102,54 +6126,54 @@ class Oa extends Hs {
6102
6126
  super.render(t2, e3, i2, o2, n2);
6103
6127
  }
6104
6128
  }
6105
- class ka extends Oa {
6129
+ class Aa extends Ea {
6106
6130
  constructor(t2) {
6107
6131
  super(t2);
6108
6132
  }
6109
6133
  render(t2, e3, s2, i2, r2) {
6110
6134
  const { path: n2 } = r2, { commandIndex: o2, pointIndex: a2, connectToCommandIndex: h2, connectToPointIndex: c2 } = this;
6111
6135
  t2.save(), t2.strokeStyle = this.controlStroke, this.connectionDashArray && t2.setLineDash(this.connectionDashArray);
6112
- const [l2] = n2[o2], u2 = Sa(r2, h2, c2);
6136
+ const [l2] = n2[o2], u2 = Da(r2, h2, c2);
6113
6137
  if ("Q" === l2) {
6114
- const i3 = Sa(r2, o2, a2 + 2);
6138
+ const i3 = Da(r2, o2, a2 + 2);
6115
6139
  t2.moveTo(i3.x, i3.y), t2.lineTo(e3, s2);
6116
6140
  } else t2.moveTo(e3, s2);
6117
6141
  t2.lineTo(u2.x, u2.y), t2.stroke(), t2.restore(), super.render(t2, e3, s2, i2, r2);
6118
6142
  }
6119
6143
  }
6120
- 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));
6121
- var Ma = Object.freeze({ __proto__: null, changeWidth: Vs, createObjectDefaultControls: fi, createPathControls: function(t2) {
6144
+ 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));
6145
+ var Fa = Object.freeze({ __proto__: null, changeWidth: ri, createObjectDefaultControls: Pi, createPathControls: function(t2) {
6122
6146
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
6123
6147
  const s2 = {};
6124
6148
  let i2 = "M";
6125
6149
  return t2.path.forEach((t3, r2) => {
6126
6150
  const n2 = t3[0];
6127
- switch ("Z" !== n2 && (s2["c_".concat(r2, "_").concat(n2)] = Da(r2, t3.length - 2, false, e3)), n2) {
6151
+ switch ("Z" !== n2 && (s2["c_".concat(r2, "_").concat(n2)] = ja(r2, t3.length - 2, false, e3)), n2) {
6128
6152
  case "C":
6129
- 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);
6153
+ 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);
6130
6154
  break;
6131
6155
  case "Q":
6132
- s2["c_".concat(r2, "_Q_CP_1")] = Da(r2, 1, true, e3, r2, 3);
6156
+ s2["c_".concat(r2, "_Q_CP_1")] = ja(r2, 1, true, e3, r2, 3);
6133
6157
  }
6134
6158
  i2 = n2;
6135
6159
  }), s2;
6136
- }, createPolyActionHandler: ba, createPolyControls: function(t2) {
6160
+ }, createPolyActionHandler: ka, createPolyControls: function(t2) {
6137
6161
  let e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
6138
6162
  const i2 = {};
6139
- 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));
6163
+ 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));
6140
6164
  return i2;
6141
- }, 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 });
6142
- 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");
6143
- class Ba {
6165
+ }, 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 });
6166
+ 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");
6167
+ class Va {
6144
6168
  get type() {
6145
6169
  return this.constructor.type;
6146
6170
  }
6147
6171
  constructor() {
6148
- let t2 = i(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, Fa);
6172
+ let t2 = i(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, Xa);
6149
6173
  Object.assign(this, this.constructor.defaults, t2);
6150
6174
  }
6151
6175
  getFragmentSource() {
6152
- return ja;
6176
+ return Ba;
6153
6177
  }
6154
6178
  getVertexSource() {
6155
6179
  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 }";
@@ -6157,7 +6181,7 @@ class Ba {
6157
6181
  createProgram(t2) {
6158
6182
  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();
6159
6183
  const { WebGLProbe: { GLPrecision: i2 = "highp" } } = p();
6160
- "highp" !== i2 && (e3 = e3.replace(Ra, Aa.replace("highp", i2)));
6184
+ "highp" !== i2 && (e3 = e3.replace(Wa, Ia.replace("highp", i2)));
6161
6185
  const r2 = t2.createShader(t2.VERTEX_SHADER), n2 = t2.createShader(t2.FRAGMENT_SHADER), o2 = t2.createProgram();
6162
6186
  if (!r2 || !n2 || !o2) throw new h("Vertex, fragment shader or program creation error");
6163
6187
  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)));
@@ -6194,7 +6218,7 @@ class Ba {
6194
6218
  return false;
6195
6219
  }
6196
6220
  applyTo(t2) {
6197
- Pa(t2) ? (this._setupFrameBuffer(t2), this.applyToWebGL(t2), this._swapTextures(t2)) : this.applyTo2d(t2);
6221
+ La(t2) ? (this._setupFrameBuffer(t2), this.applyToWebGL(t2), this._swapTextures(t2)) : this.applyTo2d(t2);
6198
6222
  }
6199
6223
  applyTo2d(t2) {
6200
6224
  }
@@ -6231,21 +6255,21 @@ class Ba {
6231
6255
  return this.toObject();
6232
6256
  }
6233
6257
  static async fromObject(t2, e3) {
6234
- return new this(i(t2, La));
6258
+ return new this(i(t2, Ya));
6235
6259
  }
6236
6260
  }
6237
- t(Ba, "type", "BaseFilter"), t(Ba, "uniformLocations", []);
6238
- 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 " };
6239
- class Xa extends Ba {
6261
+ t(Va, "type", "BaseFilter"), t(Va, "uniformLocations", []);
6262
+ 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 " };
6263
+ class Ga extends Va {
6240
6264
  getCacheKey() {
6241
6265
  return "".concat(this.type, "_").concat(this.mode);
6242
6266
  }
6243
6267
  getFragmentSource() {
6244
- 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 ");
6268
+ 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 ");
6245
6269
  }
6246
6270
  applyTo2d(t2) {
6247
6271
  let { imageData: { data: e3 } } = t2;
6248
- 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;
6272
+ 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;
6249
6273
  for (let t3 = 0; t3 < e3.length; t3 += 4) {
6250
6274
  const s3 = e3[t3], i3 = e3[t3 + 1], h2 = e3[t3 + 2];
6251
6275
  let c2, l2, u2;
@@ -6284,18 +6308,18 @@ class Xa extends Ba {
6284
6308
  }
6285
6309
  }
6286
6310
  sendUniformData(t2, e3) {
6287
- const s2 = new Le(this.color).getSource();
6311
+ const s2 = new Ie(this.color).getSource();
6288
6312
  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);
6289
6313
  }
6290
6314
  }
6291
- t(Xa, "defaults", { color: "#F95C63", mode: "multiply", alpha: 1 }), t(Xa, "type", "BlendColor"), t(Xa, "uniformLocations", ["uColor"]), tt.setClass(Xa);
6292
- 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"];
6293
- class Va extends Ba {
6315
+ t(Ga, "defaults", { color: "#F95C63", mode: "multiply", alpha: 1 }), t(Ga, "type", "BlendColor"), t(Ga, "uniformLocations", ["uColor"]), tt.setClass(Ga);
6316
+ 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"];
6317
+ class Ua extends Va {
6294
6318
  getCacheKey() {
6295
6319
  return "".concat(this.type, "_").concat(this.mode);
6296
6320
  }
6297
6321
  getFragmentSource() {
6298
- return Ya[this.mode];
6322
+ return Ha[this.mode];
6299
6323
  }
6300
6324
  getVertexSource() {
6301
6325
  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 ";
@@ -6337,17 +6361,17 @@ class Va extends Ba {
6337
6361
  return s(s({}, super.toObject()), {}, { image: this.image && this.image.toObject() });
6338
6362
  }
6339
6363
  static async fromObject(t2, e3) {
6340
- let { type: r2, image: n2 } = t2, o2 = i(t2, Wa);
6341
- return ea.fromObject(n2, e3).then((t3) => new this(s(s({}, o2), {}, { image: t3 })));
6364
+ let { type: r2, image: n2 } = t2, o2 = i(t2, Na);
6365
+ return oa.fromObject(n2, e3).then((t3) => new this(s(s({}, o2), {}, { image: t3 })));
6342
6366
  }
6343
6367
  }
6344
- t(Va, "type", "BlendImage"), t(Va, "defaults", { mode: "multiply", alpha: 1 }), t(Va, "uniformLocations", ["uTransformMatrix", "uImage"]), tt.setClass(Va);
6345
- class za extends Ba {
6368
+ t(Ua, "type", "BlendImage"), t(Ua, "defaults", { mode: "multiply", alpha: 1 }), t(Ua, "uniformLocations", ["uTransformMatrix", "uImage"]), tt.setClass(Ua);
6369
+ class qa extends Va {
6346
6370
  getFragmentSource() {
6347
6371
  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 ";
6348
6372
  }
6349
6373
  applyTo(t2) {
6350
- 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);
6374
+ 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);
6351
6375
  }
6352
6376
  applyTo2d(t2) {
6353
6377
  let { imageData: { data: e3, width: s2, height: i2 } } = t2;
@@ -6397,8 +6421,8 @@ class za extends Ba {
6397
6421
  return this.horizontal ? [t2, 0] : [0, t2];
6398
6422
  }
6399
6423
  }
6400
- t(za, "type", "Blur"), t(za, "defaults", { blur: 0 }), t(za, "uniformLocations", ["uDelta"]), tt.setClass(za);
6401
- class Ga extends Ba {
6424
+ t(qa, "type", "Blur"), t(qa, "defaults", { blur: 0 }), t(qa, "uniformLocations", ["uDelta"]), tt.setClass(qa);
6425
+ class Ka extends Va {
6402
6426
  getFragmentSource() {
6403
6427
  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";
6404
6428
  }
@@ -6414,9 +6438,9 @@ class Ga extends Ba {
6414
6438
  t2.uniform1f(e3.uBrightness, this.brightness);
6415
6439
  }
6416
6440
  }
6417
- t(Ga, "type", "Brightness"), t(Ga, "defaults", { brightness: 0 }), t(Ga, "uniformLocations", ["uBrightness"]), tt.setClass(Ga);
6418
- 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 };
6419
- class Na extends Ba {
6441
+ t(Ka, "type", "Brightness"), t(Ka, "defaults", { brightness: 0 }), t(Ka, "uniformLocations", ["uBrightness"]), tt.setClass(Ka);
6442
+ 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 };
6443
+ class Qa extends Va {
6420
6444
  getFragmentSource() {
6421
6445
  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 }";
6422
6446
  }
@@ -6438,30 +6462,30 @@ class Na extends Ba {
6438
6462
  return s(s({}, super.toObject()), {}, { matrix: [...this.matrix] });
6439
6463
  }
6440
6464
  }
6441
- function Ua(e3, s2) {
6465
+ function Za(e3, s2) {
6442
6466
  var i2;
6443
- const r2 = (t(i2 = class extends Na {
6467
+ const r2 = (t(i2 = class extends Qa {
6444
6468
  toObject() {
6445
6469
  return { type: this.type, colorsOnly: this.colorsOnly };
6446
6470
  }
6447
6471
  }, "type", e3), t(i2, "defaults", { colorsOnly: false, matrix: s2 }), i2);
6448
6472
  return tt.setClass(r2, e3), r2;
6449
6473
  }
6450
- t(Na, "type", "ColorMatrix"), t(Na, "defaults", Ha), t(Na, "uniformLocations", ["uColorMatrix", "uConstants"]), tt.setClass(Na);
6451
- 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]);
6452
- 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]);
6453
- 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]);
6454
- 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]);
6455
- 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]);
6456
- 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]);
6457
- 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]);
6458
- class eh extends Ba {
6474
+ t(Qa, "type", "ColorMatrix"), t(Qa, "defaults", Ja), t(Qa, "uniformLocations", ["uColorMatrix", "uConstants"]), tt.setClass(Qa);
6475
+ 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]);
6476
+ 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]);
6477
+ 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]);
6478
+ 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]);
6479
+ 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]);
6480
+ 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]);
6481
+ 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]);
6482
+ class oh extends Va {
6459
6483
  constructor() {
6460
6484
  let t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
6461
6485
  super(t2), this.subFilters = t2.subFilters || [];
6462
6486
  }
6463
6487
  applyTo(t2) {
6464
- Pa(t2) && (t2.passes += this.subFilters.length - 1), this.subFilters.forEach((e3) => {
6488
+ La(t2) && (t2.passes += this.subFilters.length - 1), this.subFilters.forEach((e3) => {
6465
6489
  e3.applyTo(t2);
6466
6490
  });
6467
6491
  }
@@ -6475,8 +6499,8 @@ class eh extends Ba {
6475
6499
  return Promise.all((t2.subFilters || []).map((t3) => tt.getClass(t3.type).fromObject(t3, e3))).then((t3) => new this({ subFilters: t3 }));
6476
6500
  }
6477
6501
  }
6478
- t(eh, "type", "Composed"), tt.setClass(eh);
6479
- class sh extends Ba {
6502
+ t(oh, "type", "Composed"), tt.setClass(oh);
6503
+ class ah extends Va {
6480
6504
  getFragmentSource() {
6481
6505
  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 }";
6482
6506
  }
@@ -6492,14 +6516,14 @@ class sh extends Ba {
6492
6516
  t2.uniform1f(e3.uContrast, this.contrast);
6493
6517
  }
6494
6518
  }
6495
- t(sh, "type", "Contrast"), t(sh, "defaults", { contrast: 0 }), t(sh, "uniformLocations", ["uContrast"]), tt.setClass(sh);
6496
- 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 " };
6497
- class rh extends Ba {
6519
+ t(ah, "type", "Contrast"), t(ah, "defaults", { contrast: 0 }), t(ah, "uniformLocations", ["uContrast"]), tt.setClass(ah);
6520
+ 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 " };
6521
+ class ch extends Va {
6498
6522
  getCacheKey() {
6499
6523
  return "".concat(this.type, "_").concat(Math.sqrt(this.matrix.length), "_").concat(this.opaque ? 1 : 0);
6500
6524
  }
6501
6525
  getFragmentSource() {
6502
- return ih[this.getCacheKey()];
6526
+ return hh[this.getCacheKey()];
6503
6527
  }
6504
6528
  applyTo2d(t2) {
6505
6529
  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;
@@ -6517,9 +6541,9 @@ class rh extends Ba {
6517
6541
  return s(s({}, super.toObject()), {}, { opaque: this.opaque, matrix: [...this.matrix] });
6518
6542
  }
6519
6543
  }
6520
- 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);
6521
- const nh = "Gamma";
6522
- class oh extends Ba {
6544
+ 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);
6545
+ const lh = "Gamma";
6546
+ class uh extends Va {
6523
6547
  getFragmentSource() {
6524
6548
  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";
6525
6549
  }
@@ -6543,12 +6567,12 @@ class oh extends Ba {
6543
6567
  return 1 === t2[0] && 1 === t2[1] && 1 === t2[2];
6544
6568
  }
6545
6569
  toObject() {
6546
- return { type: nh, gamma: this.gamma.concat() };
6570
+ return { type: lh, gamma: this.gamma.concat() };
6547
6571
  }
6548
6572
  }
6549
- t(oh, "type", nh), t(oh, "defaults", { gamma: [1, 1, 1] }), t(oh, "uniformLocations", ["uGamma"]), tt.setClass(oh);
6550
- 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 " };
6551
- class hh extends Ba {
6573
+ t(uh, "type", lh), t(uh, "defaults", { gamma: [1, 1, 1] }), t(uh, "uniformLocations", ["uGamma"]), tt.setClass(uh);
6574
+ 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 " };
6575
+ class gh extends Va {
6552
6576
  applyTo2d(t2) {
6553
6577
  let { imageData: { data: e3 } } = t2;
6554
6578
  for (let t3, s2 = 0; s2 < e3.length; s2 += 4) {
@@ -6570,7 +6594,7 @@ class hh extends Ba {
6570
6594
  return "".concat(this.type, "_").concat(this.mode);
6571
6595
  }
6572
6596
  getFragmentSource() {
6573
- return ah[this.mode];
6597
+ return dh[this.mode];
6574
6598
  }
6575
6599
  sendUniformData(t2, e3) {
6576
6600
  t2.uniform1i(e3.uMode, 1);
@@ -6579,9 +6603,9 @@ class hh extends Ba {
6579
6603
  return false;
6580
6604
  }
6581
6605
  }
6582
- t(hh, "type", "Grayscale"), t(hh, "defaults", { mode: "average" }), t(hh, "uniformLocations", ["uMode"]), tt.setClass(hh);
6583
- const ch = s(s({}, Ha), {}, { rotation: 0 });
6584
- class lh extends Na {
6606
+ t(gh, "type", "Grayscale"), t(gh, "defaults", { mode: "average" }), t(gh, "uniformLocations", ["uMode"]), tt.setClass(gh);
6607
+ const fh = s(s({}, Ja), {}, { rotation: 0 });
6608
+ class ph extends Qa {
6585
6609
  calculateMatrix() {
6586
6610
  const t2 = this.rotation * Math.PI, e3 = rt(t2), s2 = nt(t2), i2 = 1 / 3, r2 = Math.sqrt(i2) * s2, n2 = 1 - e3;
6587
6611
  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];
@@ -6596,8 +6620,8 @@ class lh extends Na {
6596
6620
  return { type: this.type, rotation: this.rotation };
6597
6621
  }
6598
6622
  }
6599
- t(lh, "type", "HueRotation"), t(lh, "defaults", ch), tt.setClass(lh);
6600
- class uh extends Ba {
6623
+ t(ph, "type", "HueRotation"), t(ph, "defaults", fh), tt.setClass(ph);
6624
+ class mh extends Va {
6601
6625
  applyTo2d(t2) {
6602
6626
  let { imageData: { data: e3 } } = t2;
6603
6627
  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]);
@@ -6612,8 +6636,8 @@ class uh extends Ba {
6612
6636
  t2.uniform1i(e3.uInvert, Number(this.invert)), t2.uniform1i(e3.uAlpha, Number(this.alpha));
6613
6637
  }
6614
6638
  }
6615
- t(uh, "type", "Invert"), t(uh, "defaults", { alpha: false, invert: true }), t(uh, "uniformLocations", ["uInvert", "uAlpha"]), tt.setClass(uh);
6616
- class dh extends Ba {
6639
+ t(mh, "type", "Invert"), t(mh, "defaults", { alpha: false, invert: true }), t(mh, "uniformLocations", ["uInvert", "uAlpha"]), tt.setClass(mh);
6640
+ let vh$1 = class vh extends Va {
6617
6641
  getFragmentSource() {
6618
6642
  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";
6619
6643
  }
@@ -6631,9 +6655,9 @@ class dh extends Ba {
6631
6655
  isNeutralState() {
6632
6656
  return 0 === this.noise;
6633
6657
  }
6634
- }
6635
- t(dh, "type", "Noise"), t(dh, "defaults", { noise: 0 }), t(dh, "uniformLocations", ["uNoise", "uSeed"]), tt.setClass(dh);
6636
- class gh extends Ba {
6658
+ };
6659
+ t(vh$1, "type", "Noise"), t(vh$1, "defaults", { noise: 0 }), t(vh$1, "uniformLocations", ["uNoise", "uSeed"]), tt.setClass(vh$1);
6660
+ class yh extends Va {
6637
6661
  applyTo2d(t2) {
6638
6662
  let { imageData: { data: e3, width: s2, height: i2 } } = t2;
6639
6663
  for (let t3 = 0; t3 < i2; t3 += this.blocksize) for (let r2 = 0; r2 < s2; r2 += this.blocksize) {
@@ -6654,26 +6678,26 @@ class gh extends Ba {
6654
6678
  t2.uniform1f(e3.uBlocksize, this.blocksize);
6655
6679
  }
6656
6680
  }
6657
- t(gh, "type", "Pixelate"), t(gh, "defaults", { blocksize: 4 }), t(gh, "uniformLocations", ["uBlocksize"]), tt.setClass(gh);
6658
- class fh extends Ba {
6681
+ t(yh, "type", "Pixelate"), t(yh, "defaults", { blocksize: 4 }), t(yh, "uniformLocations", ["uBlocksize"]), tt.setClass(yh);
6682
+ class _h extends Va {
6659
6683
  getFragmentSource() {
6660
6684
  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";
6661
6685
  }
6662
6686
  applyTo2d(t2) {
6663
6687
  let { imageData: { data: e3 } } = t2;
6664
- 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];
6688
+ 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];
6665
6689
  for (let t3 = 0; t3 < e3.length; t3 += 4) {
6666
6690
  const s3 = e3[t3], i3 = e3[t3 + 1], o2 = e3[t3 + 2];
6667
6691
  s3 > r2[0] && i3 > r2[1] && o2 > r2[2] && s3 < n2[0] && i3 < n2[1] && o2 < n2[2] && (e3[t3 + 3] = 0);
6668
6692
  }
6669
6693
  }
6670
6694
  sendUniformData(t2, e3) {
6671
- 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];
6695
+ 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];
6672
6696
  t2.uniform4fv(e3.uLow, r2), t2.uniform4fv(e3.uHigh, n2);
6673
6697
  }
6674
6698
  }
6675
- t(fh, "type", "RemoveColor"), t(fh, "defaults", { color: "#FFFFFF", distance: 0.02, useAlpha: false }), t(fh, "uniformLocations", ["uLow", "uHigh"]), tt.setClass(fh);
6676
- class ph extends Ba {
6699
+ t(_h, "type", "RemoveColor"), t(_h, "defaults", { color: "#FFFFFF", distance: 0.02, useAlpha: false }), t(_h, "uniformLocations", ["uLow", "uHigh"]), tt.setClass(_h);
6700
+ class xh extends Va {
6677
6701
  sendUniformData(t2, e3) {
6678
6702
  t2.uniform2fv(e3.uDelta, this.horizontal ? [1 / this.width, 0] : [0, 1 / this.height]), t2.uniform1fv(e3.uTaps, this.taps);
6679
6703
  }
@@ -6703,7 +6727,7 @@ class ph extends Ba {
6703
6727
  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;
6704
6728
  }
6705
6729
  applyTo(t2) {
6706
- Pa(t2) ? this.applyToForWebgl(t2) : this.applyTo2d(t2);
6730
+ La(t2) ? this.applyToForWebgl(t2) : this.applyTo2d(t2);
6707
6731
  }
6708
6732
  isNeutralState() {
6709
6733
  return 1 === this.scaleX && 1 === this.scaleY;
@@ -6776,8 +6800,8 @@ class ph extends Ba {
6776
6800
  return l2;
6777
6801
  }
6778
6802
  }
6779
- t(ph, "type", "Resize"), t(ph, "defaults", { resizeType: "hermite", scaleX: 1, scaleY: 1, lanczosLobes: 3 }), t(ph, "uniformLocations", ["uDelta", "uTaps"]), tt.setClass(ph);
6780
- class mh extends Ba {
6803
+ t(xh, "type", "Resize"), t(xh, "defaults", { resizeType: "hermite", scaleX: 1, scaleY: 1, lanczosLobes: 3 }), t(xh, "uniformLocations", ["uDelta", "uTaps"]), tt.setClass(xh);
6804
+ class Ch extends Va {
6781
6805
  getFragmentSource() {
6782
6806
  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";
6783
6807
  }
@@ -6796,8 +6820,8 @@ class mh extends Ba {
6796
6820
  return 0 === this.saturation;
6797
6821
  }
6798
6822
  }
6799
- t(mh, "type", "Saturation"), t(mh, "defaults", { saturation: 0 }), t(mh, "uniformLocations", ["uSaturation"]), tt.setClass(mh);
6800
- let vh$1 = class vh extends Ba {
6823
+ t(Ch, "type", "Saturation"), t(Ch, "defaults", { saturation: 0 }), t(Ch, "uniformLocations", ["uSaturation"]), tt.setClass(Ch);
6824
+ class bh extends Va {
6801
6825
  getFragmentSource() {
6802
6826
  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";
6803
6827
  }
@@ -6815,8 +6839,8 @@ let vh$1 = class vh extends Ba {
6815
6839
  isNeutralState() {
6816
6840
  return 0 === this.vibrance;
6817
6841
  }
6818
- };
6819
- t(vh$1, "type", "Vibrance"), t(vh$1, "defaults", { vibrance: 0 }), t(vh$1, "uniformLocations", ["uVibrance"]), tt.setClass(vh$1);
6842
+ }
6843
+ t(bh, "type", "Vibrance"), t(bh, "defaults", { vibrance: 0 }), t(bh, "uniformLocations", ["uVibrance"]), tt.setClass(bh);
6820
6844
  const DEFAULT_TEXT_PROPS = {
6821
6845
  /** Font family for text elements */
6822
6846
  family: "Poppins",
@@ -6903,7 +6927,7 @@ const createCanvas = ({
6903
6927
  scaleX: Number((canvasSize.width / videoSize.width).toFixed(2)),
6904
6928
  scaleY: Number((canvasSize.height / videoSize.height).toFixed(2))
6905
6929
  };
6906
- const canvas = new Sn(canvasRef, {
6930
+ const canvas = new Xn(canvasRef, {
6907
6931
  backgroundColor,
6908
6932
  width: canvasSize.width,
6909
6933
  height: canvasSize.height,
@@ -6943,8 +6967,8 @@ const reorderElementsByZIndex = (canvas) => {
6943
6967
  canvas.renderAll();
6944
6968
  };
6945
6969
  const getCanvasContext = (canvas) => {
6946
- var _a2, _b, _c, _d;
6947
- if (!canvas || !((_b = (_a2 = canvas.elements) == null ? void 0 : _a2.lower) == null ? void 0 : _b.ctx)) return;
6970
+ var _a, _b, _c, _d;
6971
+ if (!canvas || !((_b = (_a = canvas.elements) == null ? void 0 : _a.lower) == null ? void 0 : _b.ctx)) return;
6948
6972
  return (_d = (_c = canvas.elements) == null ? void 0 : _c.lower) == null ? void 0 : _d.ctx;
6949
6973
  };
6950
6974
  const clearCanvas = (canvas) => {
@@ -6969,9 +6993,9 @@ const convertToVideoPosition = (x2, y2, canvasMetadata, videoSize) => {
6969
6993
  };
6970
6994
  };
6971
6995
  const getCurrentFrameEffect = (item, seekTime) => {
6972
- var _a2;
6996
+ var _a;
6973
6997
  let currentFrameEffect;
6974
- for (let i2 = 0; i2 < ((_a2 = item == null ? void 0 : item.frameEffects) == null ? void 0 : _a2.length); i2++) {
6998
+ for (let i2 = 0; i2 < ((_a = item == null ? void 0 : item.frameEffects) == null ? void 0 : _a.length); i2++) {
6975
6999
  if (item.frameEffects[i2].s <= seekTime && item.frameEffects[i2].e >= seekTime) {
6976
7000
  currentFrameEffect = item.frameEffects[i2];
6977
7001
  break;
@@ -6979,7 +7003,7 @@ const getCurrentFrameEffect = (item, seekTime) => {
6979
7003
  }
6980
7004
  return currentFrameEffect;
6981
7005
  };
6982
- const disabledControl = new Hs({
7006
+ const disabledControl = new ai({
6983
7007
  /** X position offset */
6984
7008
  x: 0,
6985
7009
  /** Y position offset */
@@ -7004,7 +7028,7 @@ const disabledControl = new Hs({
7004
7028
  ctx.restore();
7005
7029
  }
7006
7030
  });
7007
- const rotateControl = new Hs({
7031
+ const rotateControl = new ai({
7008
7032
  /** X position offset */
7009
7033
  x: 0,
7010
7034
  /** Y position offset */
@@ -7014,7 +7038,7 @@ const rotateControl = new Hs({
7014
7038
  /** Cursor style when hovering */
7015
7039
  cursorStyle: "crosshair",
7016
7040
  /** Action handler with rotation and snapping */
7017
- actionHandler: Ma.rotationWithSnapping,
7041
+ actionHandler: Fa.rotationWithSnapping,
7018
7042
  /** Name of the action */
7019
7043
  actionName: "rotate",
7020
7044
  /** Whether to show connection line */
@@ -7043,9 +7067,9 @@ const getThumbnail = async (videoUrl, seekTime = 0.1, playbackRate = 1) => {
7043
7067
  if (timeoutId) clearTimeout(timeoutId);
7044
7068
  };
7045
7069
  const handleError = () => {
7046
- var _a2;
7070
+ var _a;
7047
7071
  cleanup();
7048
- reject(new Error(`Failed to load video: ${((_a2 = video.error) == null ? void 0 : _a2.message) || "Unknown error"}`));
7072
+ reject(new Error(`Failed to load video: ${((_a = video.error) == null ? void 0 : _a.message) || "Unknown error"}`));
7049
7073
  };
7050
7074
  const handleSeeked = () => {
7051
7075
  try {
@@ -7151,9 +7175,9 @@ const addTextElement = ({
7151
7175
  canvas,
7152
7176
  canvasMetadata
7153
7177
  }) => {
7154
- 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;
7178
+ 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;
7155
7179
  const { x: x2, y: y2 } = convertToCanvasPosition(
7156
- ((_a2 = element.props) == null ? void 0 : _a2.x) || 0,
7180
+ ((_a = element.props) == null ? void 0 : _a.x) || 0,
7157
7181
  ((_b = element.props) == null ? void 0 : _b.y) || 0,
7158
7182
  canvasMetadata
7159
7183
  );
@@ -7161,7 +7185,7 @@ const addTextElement = ({
7161
7185
  if ((_d = element.props) == null ? void 0 : _d.maxWidth) {
7162
7186
  width = Math.min(width, element.props.maxWidth * canvasMetadata.scaleX);
7163
7187
  }
7164
- const text = new Vo(((_e2 = element.props) == null ? void 0 : _e2.text) || element.t || "", {
7188
+ const text = new Uo(((_e2 = element.props) == null ? void 0 : _e2.text) || element.t || "", {
7165
7189
  left: x2,
7166
7190
  top: y2,
7167
7191
  originX: "center",
@@ -7170,7 +7194,7 @@ const addTextElement = ({
7170
7194
  fontSize: Math.floor(
7171
7195
  (((_g = element.props) == null ? void 0 : _g.fontSize) || DEFAULT_TEXT_PROPS.size) * canvasMetadata.scaleX
7172
7196
  ),
7173
- fontFamily: ((_h = element.props) == null ? void 0 : _h.fontFamily) || DEFAULT_TEXT_PROPS.family,
7197
+ fontFamily: ((_h2 = element.props) == null ? void 0 : _h2.fontFamily) || DEFAULT_TEXT_PROPS.family,
7174
7198
  fontStyle: ((_i2 = element.props) == null ? void 0 : _i2.fontStyle) || "normal",
7175
7199
  fontWeight: ((_j = element.props) == null ? void 0 : _j.fontWeight) || "normal",
7176
7200
  fill: ((_k = element.props) == null ? void 0 : _k.fill) || DEFAULT_TEXT_PROPS.fill,
@@ -7180,7 +7204,7 @@ const addTextElement = ({
7180
7204
  textAlign: ((_m = element.props) == null ? void 0 : _m.textAlign) || "center",
7181
7205
  stroke: ((_n2 = element.props) == null ? void 0 : _n2.stroke) || DEFAULT_TEXT_PROPS.stroke,
7182
7206
  strokeWidth: ((_o2 = element.props) == null ? void 0 : _o2.lineWidth) || DEFAULT_TEXT_PROPS.lineWidth,
7183
- shadow: ((_p = element.props) == null ? void 0 : _p.shadowColor) ? new ds({
7207
+ shadow: ((_p = element.props) == null ? void 0 : _p.shadowColor) ? new Ds({
7184
7208
  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,
7185
7209
  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,
7186
7210
  blur: (((_x = element.props) == null ? void 0 : _x.shadowBlur) || 2) / 2,
@@ -7207,8 +7231,8 @@ const setImageProps = ({
7207
7231
  index,
7208
7232
  canvasMetadata
7209
7233
  }) => {
7210
- var _a2, _b, _c, _d, _e2;
7211
- const width = (((_a2 = element.props) == null ? void 0 : _a2.width) || 0) * canvasMetadata.scaleX || canvasMetadata.width;
7234
+ var _a, _b, _c, _d, _e2;
7235
+ const width = (((_a = element.props) == null ? void 0 : _a.width) || 0) * canvasMetadata.scaleX || canvasMetadata.width;
7212
7236
  const height = (((_b = element.props) == null ? void 0 : _b.height) || 0) * canvasMetadata.scaleY || canvasMetadata.height;
7213
7237
  const { x: x2, y: y2 } = convertToCanvasPosition(
7214
7238
  ((_c = element.props) == null ? void 0 : _c.x) || 0,
@@ -7234,27 +7258,27 @@ const addCaptionElement = ({
7234
7258
  captionProps,
7235
7259
  canvasMetadata
7236
7260
  }) => {
7237
- 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;
7261
+ 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;
7238
7262
  const { x: x2, y: y2 } = convertToCanvasPosition(
7239
- ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.x : (_a2 = element.props) == null ? void 0 : _a2.x) ?? 0,
7263
+ ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.x : (_a = element.props) == null ? void 0 : _a.x) ?? 0,
7240
7264
  ((captionProps == null ? void 0 : captionProps.applyToAll) ? captionProps == null ? void 0 : captionProps.y : (_b = element.props) == null ? void 0 : _b.y) ?? 0,
7241
7265
  canvasMetadata
7242
7266
  );
7243
- const caption = new ko(((_c = element.props) == null ? void 0 : _c.text) || element.t || "", {
7267
+ const caption = new Ao(((_c = element.props) == null ? void 0 : _c.text) || element.t || "", {
7244
7268
  left: x2,
7245
7269
  top: y2,
7246
7270
  originX: "center",
7247
7271
  originY: "center",
7248
7272
  angle: ((_d = element.props) == null ? void 0 : _d.rotation) || 0,
7249
7273
  fontSize: Math.round(
7250
- (((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
7274
+ (((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
7251
7275
  ),
7252
7276
  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,
7253
7277
  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,
7254
7278
  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,
7255
7279
  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,
7256
7280
  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,
7257
- shadow: new ds({
7281
+ shadow: new Ds({
7258
7282
  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]),
7259
7283
  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]),
7260
7284
  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,
@@ -7284,10 +7308,10 @@ const addVideoElement = async ({
7284
7308
  canvasMetadata,
7285
7309
  currentFrameEffect
7286
7310
  }) => {
7287
- var _a2;
7311
+ var _a;
7288
7312
  try {
7289
7313
  const thumbnailUrl = await getThumbnail(
7290
- ((_a2 = element == null ? void 0 : element.props) == null ? void 0 : _a2.src) || "",
7314
+ ((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.src) || "",
7291
7315
  snapTime
7292
7316
  );
7293
7317
  if (!thumbnailUrl) {
@@ -7315,7 +7339,7 @@ const addImageElement = async ({
7315
7339
  currentFrameEffect
7316
7340
  }) => {
7317
7341
  try {
7318
- const img = await ea.fromURL(imageUrl || element.props.src || "");
7342
+ const img = await oa.fromURL(imageUrl || element.props.src || "");
7319
7343
  img.set({
7320
7344
  originX: "center",
7321
7345
  originY: "center",
@@ -7351,14 +7375,14 @@ const addMediaGroup = ({
7351
7375
  canvasMetadata,
7352
7376
  currentFrameEffect
7353
7377
  }) => {
7354
- var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k, _l, _m, _n2;
7378
+ var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k, _l, _m, _n2;
7355
7379
  let frameSize;
7356
7380
  let angle;
7357
7381
  let framePosition;
7358
7382
  let frameRadius = 0;
7359
7383
  if (currentFrameEffect) {
7360
7384
  frameSize = {
7361
- width: (((_a2 = currentFrameEffect.props.frameSize) == null ? void 0 : _a2[0]) || 0) * canvasMetadata.scaleX || canvasMetadata.width,
7385
+ width: (((_a = currentFrameEffect.props.frameSize) == null ? void 0 : _a[0]) || 0) * canvasMetadata.scaleX || canvasMetadata.width,
7362
7386
  height: (((_b = currentFrameEffect.props.frameSize) == null ? void 0 : _b[1]) || 0) * canvasMetadata.scaleY || canvasMetadata.height
7363
7387
  };
7364
7388
  angle = currentFrameEffect.props.rotation || 0;
@@ -7372,7 +7396,7 @@ const addMediaGroup = ({
7372
7396
  frameRadius = ((_d = element == null ? void 0 : element.frame) == null ? void 0 : _d.radius) || 0;
7373
7397
  frameSize = {
7374
7398
  width: (((_f = (_e2 = element == null ? void 0 : element.frame) == null ? void 0 : _e2.size) == null ? void 0 : _f[0]) || 0) * canvasMetadata.scaleX || canvasMetadata.width,
7375
- height: (((_h = (_g = element == null ? void 0 : element.frame) == null ? void 0 : _g.size) == null ? void 0 : _h[1]) || 0) * canvasMetadata.scaleY || canvasMetadata.height
7399
+ height: (((_h2 = (_g = element == null ? void 0 : element.frame) == null ? void 0 : _g.size) == null ? void 0 : _h2[1]) || 0) * canvasMetadata.scaleY || canvasMetadata.height
7376
7400
  };
7377
7401
  angle = ((_i2 = element == null ? void 0 : element.frame) == null ? void 0 : _i2.rotation) || 0;
7378
7402
  framePosition = {
@@ -7385,7 +7409,7 @@ const addMediaGroup = ({
7385
7409
  { width: img.width, height: img.height },
7386
7410
  frameSize
7387
7411
  );
7388
- const frameRect = new vr({
7412
+ const frameRect = new jr({
7389
7413
  originX: "center",
7390
7414
  originY: "center",
7391
7415
  lockMovementX: false,
@@ -7421,7 +7445,7 @@ const addMediaGroup = ({
7421
7445
  height: frameSize.height,
7422
7446
  angle
7423
7447
  };
7424
- const group = new Er([frameRect, img], {
7448
+ const group = new Ur([frameRect, img], {
7425
7449
  ...groupProps,
7426
7450
  originX: "center",
7427
7451
  originY: "center",
@@ -7447,13 +7471,13 @@ const addRectElement = ({
7447
7471
  canvas,
7448
7472
  canvasMetadata
7449
7473
  }) => {
7450
- var _a2, _b, _c, _d, _e2, _f, _g, _h, _i2, _j, _k;
7474
+ var _a, _b, _c, _d, _e2, _f, _g, _h2, _i2, _j, _k;
7451
7475
  const { x: x2, y: y2 } = convertToCanvasPosition(
7452
- ((_a2 = element.props) == null ? void 0 : _a2.x) || 0,
7476
+ ((_a = element.props) == null ? void 0 : _a.x) || 0,
7453
7477
  ((_b = element.props) == null ? void 0 : _b.y) || 0,
7454
7478
  canvasMetadata
7455
7479
  );
7456
- const rect = new vr({
7480
+ const rect = new jr({
7457
7481
  left: x2,
7458
7482
  // X-coordinate on the canvas
7459
7483
  top: y2,
@@ -7472,7 +7496,7 @@ const addRectElement = ({
7472
7496
  // Stroke color
7473
7497
  strokeWidth: (((_g = element.props) == null ? void 0 : _g.lineWidth) || 0) * canvasMetadata.scaleX,
7474
7498
  // Scaled stroke width
7475
- fill: ((_h = element.props) == null ? void 0 : _h.fill) || "#000000",
7499
+ fill: ((_h2 = element.props) == null ? void 0 : _h2.fill) || "#000000",
7476
7500
  // Fill color
7477
7501
  opacity: ((_i2 = element.props) == null ? void 0 : _i2.opacity) || 1,
7478
7502
  // Opacity level
@@ -7493,13 +7517,13 @@ const addCircleElement = ({
7493
7517
  canvas,
7494
7518
  canvasMetadata
7495
7519
  }) => {
7496
- var _a2, _b, _c, _d, _e2, _f;
7520
+ var _a, _b, _c, _d, _e2, _f;
7497
7521
  const { x: x2, y: y2 } = convertToCanvasPosition(
7498
- ((_a2 = element.props) == null ? void 0 : _a2.x) || 0,
7522
+ ((_a = element.props) == null ? void 0 : _a.x) || 0,
7499
7523
  ((_b = element.props) == null ? void 0 : _b.y) || 0,
7500
7524
  canvasMetadata
7501
7525
  );
7502
- const circle = new qn({
7526
+ const circle = new co({
7503
7527
  left: x2,
7504
7528
  // X-coordinate on the canvas
7505
7529
  top: y2,
@@ -7527,7 +7551,7 @@ const addBackgroundColor = ({
7527
7551
  canvas,
7528
7552
  canvasMetadata
7529
7553
  }) => {
7530
- const bgRect = new vr({
7554
+ const bgRect = new jr({
7531
7555
  width: canvasMetadata.width,
7532
7556
  height: canvasMetadata.height,
7533
7557
  left: canvasMetadata.width / 2,
@@ -7639,11 +7663,11 @@ const useTwickCanvas = ({
7639
7663
  }
7640
7664
  };
7641
7665
  const handleMouseUp = (event) => {
7642
- var _a2, _b, _c;
7666
+ var _a, _b, _c;
7643
7667
  if (event.target) {
7644
7668
  const object = event.target;
7645
7669
  const elementId = object.get("id");
7646
- if (((_a2 = event.transform) == null ? void 0 : _a2.action) === "drag") {
7670
+ if (((_a = event.transform) == null ? void 0 : _a.action) === "drag") {
7647
7671
  const original = event.transform.original;
7648
7672
  if (object.left === original.left && object.top === original.top) {
7649
7673
  onCanvasOperation == null ? void 0 : onCanvasOperation(
@@ -7842,7 +7866,7 @@ const useTwickCanvas = ({
7842
7866
  seekTime,
7843
7867
  captionProps
7844
7868
  }) => {
7845
- var _a2, _b;
7869
+ var _a, _b;
7846
7870
  if (!twickCanvas) {
7847
7871
  console.warn("Canvas not initialized");
7848
7872
  return;
@@ -7854,7 +7878,7 @@ const useTwickCanvas = ({
7854
7878
  seekTime || 0
7855
7879
  );
7856
7880
  elementFrameMap.current[element.id] = currentFrameEffect;
7857
- 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);
7881
+ 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);
7858
7882
  await addVideoElement({
7859
7883
  element,
7860
7884
  index,
@@ -7979,14 +8003,14 @@ const usePlayerManager = ({
7979
8003
  onCanvasOperation: handleCanvasOperation
7980
8004
  });
7981
8005
  const updateCanvas = (seekTime) => {
7982
- var _a2;
8006
+ var _a;
7983
8007
  if (changeLog === currentChangeLog.current && seekTime === prevSeekTime.current) {
7984
8008
  return;
7985
8009
  }
7986
8010
  prevSeekTime.current = seekTime;
7987
8011
  const elements = timeline.getCurrentElements(
7988
8012
  seekTime,
7989
- ((_a2 = editor.getTimelineData()) == null ? void 0 : _a2.tracks) ?? []
8013
+ ((_a = editor.getTimelineData()) == null ? void 0 : _a.tracks) ?? []
7990
8014
  );
7991
8015
  let captionProps = {};
7992
8016
  (elements || []).forEach((element) => {
@@ -8004,18 +8028,18 @@ const usePlayerManager = ({
8004
8028
  currentChangeLog.current = changeLog;
8005
8029
  };
8006
8030
  const onPlayerUpdate = (event) => {
8007
- var _a2;
8008
- if (((_a2 = event == null ? void 0 : event.detail) == null ? void 0 : _a2.status) === "ready") {
8031
+ var _a;
8032
+ if (((_a = event == null ? void 0 : event.detail) == null ? void 0 : _a.status) === "ready") {
8009
8033
  setPlayerUpdating(false);
8010
8034
  setTimelineAction(timeline.TIMELINE_ACTION.ON_PLAYER_UPDATED, null);
8011
8035
  }
8012
8036
  };
8013
8037
  React.useEffect(() => {
8014
- var _a2, _b, _c, _d, _e2;
8038
+ var _a, _b, _c, _d, _e2;
8015
8039
  switch (timelineAction.type) {
8016
8040
  case timeline.TIMELINE_ACTION.UPDATE_PLAYER_DATA:
8017
8041
  if (videoProps) {
8018
- if (((_a2 = timelineAction.payload) == null ? void 0 : _a2.forceUpdate) || editor.getLatestVersion() !== ((_b = projectData == null ? void 0 : projectData.input) == null ? void 0 : _b.version)) {
8042
+ if (((_a = timelineAction.payload) == null ? void 0 : _a.forceUpdate) || editor.getLatestVersion() !== ((_b = projectData == null ? void 0 : projectData.input) == null ? void 0 : _b.version)) {
8019
8043
  setPlayerUpdating(true);
8020
8044
  const _latestProjectData = {
8021
8045
  input: {
@@ -9493,6 +9517,7 @@ function SeekTrack({
9493
9517
  const pinHeight = 2 + timelineCount * (2.75 + 0.5);
9494
9518
  React.useEffect(() => {
9495
9519
  if (!isDragging2) {
9520
+ console.log("currentTime", currentTime);
9496
9521
  setSeekPosition(currentTime * pixelsPerSecond);
9497
9522
  }
9498
9523
  }, [currentTime, pixelsPerSecond, isDragging2]);
@@ -10231,7 +10256,7 @@ function loadExternalIsValidProp(isValidProp) {
10231
10256
  }
10232
10257
  try {
10233
10258
  loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
10234
- } catch (_a2) {
10259
+ } catch (_a) {
10235
10260
  }
10236
10261
  function filterProps(props, isDom, forwardMotionProps) {
10237
10262
  const filteredProps = {};
@@ -10358,7 +10383,7 @@ const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId
10358
10383
  const { schedule: microtask } = createRenderBatcher(queueMicrotask, false);
10359
10384
  const SwitchLayoutGroupContext = React.createContext({});
10360
10385
  function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
10361
- var _a2, _b;
10386
+ var _a, _b;
10362
10387
  const { visualElement: parent } = React.useContext(MotionContext);
10363
10388
  const lazyContext = React.useContext(LazyContext);
10364
10389
  const presenceContext = React.useContext(PresenceContext);
@@ -10387,7 +10412,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
10387
10412
  }
10388
10413
  });
10389
10414
  const optimisedAppearId = props[optimizedAppearDataAttribute];
10390
- const wantsHandoff = React.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)));
10415
+ const wantsHandoff = React.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)));
10391
10416
  useIsomorphicLayoutEffect(() => {
10392
10417
  if (!visualElement)
10393
10418
  return;
@@ -10407,8 +10432,8 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
10407
10432
  }
10408
10433
  if (wantsHandoff.current) {
10409
10434
  queueMicrotask(() => {
10410
- var _a3;
10411
- (_a3 = window.MotionHandoffMarkAsComplete) === null || _a3 === void 0 ? void 0 : _a3.call(window, optimisedAppearId);
10435
+ var _a2;
10436
+ (_a2 = window.MotionHandoffMarkAsComplete) === null || _a2 === void 0 ? void 0 : _a2.call(window, optimisedAppearId);
10412
10437
  });
10413
10438
  wantsHandoff.current = false;
10414
10439
  }
@@ -10442,7 +10467,7 @@ function getClosestProjectingNode(visualElement) {
10442
10467
  return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent);
10443
10468
  }
10444
10469
  function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component }) {
10445
- var _a2, _b;
10470
+ var _a, _b;
10446
10471
  preloadedFeatures && loadFeatures(preloadedFeatures);
10447
10472
  function MotionComponent(props, externalRef) {
10448
10473
  let MeasureLayout2;
@@ -10462,7 +10487,7 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
10462
10487
  }
10463
10488
  return jsxRuntime.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout2 && context.visualElement ? jsxRuntime.jsx(MeasureLayout2, { visualElement: context.visualElement, ...configAndProps }) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] });
10464
10489
  }
10465
- MotionComponent.displayName = `motion.${typeof Component === "string" ? Component : `create(${(_b = (_a2 = Component.displayName) !== null && _a2 !== void 0 ? _a2 : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
10490
+ MotionComponent.displayName = `motion.${typeof Component === "string" ? Component : `create(${(_b = (_a = Component.displayName) !== null && _a !== void 0 ? _a : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
10466
10491
  const ForwardRefMotionComponent = React.forwardRef(MotionComponent);
10467
10492
  ForwardRefMotionComponent[motionComponentSymbol] = Component;
10468
10493
  return ForwardRefMotionComponent;
@@ -10975,11 +11000,11 @@ function isForcedMotionValue(key, { layout: layout2, layoutId }) {
10975
11000
  return transformProps.has(key) || key.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity");
10976
11001
  }
10977
11002
  function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
10978
- var _a2;
11003
+ var _a;
10979
11004
  const { style } = props;
10980
11005
  const newValues = {};
10981
11006
  for (const key in style) {
10982
- 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) {
11007
+ 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) {
10983
11008
  newValues[key] = style[key];
10984
11009
  }
10985
11010
  }
@@ -11257,8 +11282,8 @@ const supportsFlags = {
11257
11282
  function memoSupports(callback, supportsFlag) {
11258
11283
  const memoized = /* @__PURE__ */ memo(callback);
11259
11284
  return () => {
11260
- var _a2;
11261
- return (_a2 = supportsFlags[supportsFlag]) !== null && _a2 !== void 0 ? _a2 : memoized();
11285
+ var _a;
11286
+ return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized();
11262
11287
  };
11263
11288
  }
11264
11289
  const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
@@ -11313,12 +11338,12 @@ function isDragActive() {
11313
11338
  return isDragging.x || isDragging.y;
11314
11339
  }
11315
11340
  function resolveElements(elementOrSelector, scope, selectorCache) {
11316
- var _a2;
11341
+ var _a;
11317
11342
  if (elementOrSelector instanceof Element) {
11318
11343
  return [elementOrSelector];
11319
11344
  } else if (typeof elementOrSelector === "string") {
11320
11345
  let root = document;
11321
- const elements = (_a2 = void 0) !== null && _a2 !== void 0 ? _a2 : root.querySelectorAll(elementOrSelector);
11346
+ const elements = (_a = void 0) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
11322
11347
  return elements ? Array.from(elements) : [];
11323
11348
  }
11324
11349
  return Array.from(elementOrSelector);
@@ -11964,8 +11989,8 @@ const color = {
11964
11989
  };
11965
11990
  const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
11966
11991
  function test(v2) {
11967
- var _a2, _b;
11968
- 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;
11992
+ var _a, _b;
11993
+ 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;
11969
11994
  }
11970
11995
  const NUMBER_TOKEN = "number";
11971
11996
  const COLOR_TOKEN = "color";
@@ -12167,8 +12192,8 @@ function measureAllKeyframes() {
12167
12192
  const restore = transformsToRestore.get(element);
12168
12193
  if (restore) {
12169
12194
  restore.forEach(([key, value]) => {
12170
- var _a2;
12171
- (_a2 = element.getValue(key)) === null || _a2 === void 0 ? void 0 : _a2.set(value);
12195
+ var _a;
12196
+ (_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
12172
12197
  });
12173
12198
  }
12174
12199
  });
@@ -12377,7 +12402,7 @@ class DOMKeyframesResolver extends KeyframeResolver {
12377
12402
  }
12378
12403
  }
12379
12404
  measureEndState() {
12380
- var _a2;
12405
+ var _a;
12381
12406
  const { element, name, unresolvedKeyframes } = this;
12382
12407
  if (!element || !element.current)
12383
12408
  return;
@@ -12389,7 +12414,7 @@ class DOMKeyframesResolver extends KeyframeResolver {
12389
12414
  if (finalKeyframe !== null && this.finalKeyframe === void 0) {
12390
12415
  this.finalKeyframe = finalKeyframe;
12391
12416
  }
12392
- if ((_a2 = this.removedTransforms) === null || _a2 === void 0 ? void 0 : _a2.length) {
12417
+ if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
12393
12418
  this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
12394
12419
  element.getValue(unsetTransformName).set(unsetTransformValue);
12395
12420
  });
@@ -12658,13 +12683,13 @@ function mixObject(a2, b2) {
12658
12683
  };
12659
12684
  }
12660
12685
  function matchOrder(origin, target) {
12661
- var _a2;
12686
+ var _a;
12662
12687
  const orderedOrigin = [];
12663
12688
  const pointers = { color: 0, var: 0, number: 0 };
12664
12689
  for (let i2 = 0; i2 < target.values.length; i2++) {
12665
12690
  const type = target.types[i2];
12666
12691
  const originIndex = origin.indexes[type][pointers[type]];
12667
- const originValue = (_a2 = origin.values[originIndex]) !== null && _a2 !== void 0 ? _a2 : 0;
12692
+ const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0;
12668
12693
  orderedOrigin[i2] = originValue;
12669
12694
  pointers[type]++;
12670
12695
  }
@@ -13298,13 +13323,13 @@ class MainThreadAnimation extends BaseAnimation {
13298
13323
  this.driver.start();
13299
13324
  }
13300
13325
  pause() {
13301
- var _a2;
13326
+ var _a;
13302
13327
  if (!this._resolved) {
13303
13328
  this.pendingPlayState = "paused";
13304
13329
  return;
13305
13330
  }
13306
13331
  this.state = "paused";
13307
- this.holdTime = (_a2 = this.currentTime) !== null && _a2 !== void 0 ? _a2 : 0;
13332
+ this.holdTime = (_a = this.currentTime) !== null && _a !== void 0 ? _a : 0;
13308
13333
  }
13309
13334
  complete() {
13310
13335
  if (this.state !== "running") {
@@ -13697,14 +13722,14 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
13697
13722
  return shouldBlock;
13698
13723
  }
13699
13724
  function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type } = {}) {
13700
- var _a2;
13725
+ var _a;
13701
13726
  let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
13702
13727
  if (transitionOverride)
13703
13728
  transition = transitionOverride;
13704
13729
  const animations2 = [];
13705
13730
  const animationTypeState = type && visualElement.animationState && visualElement.animationState.getState()[type];
13706
13731
  for (const key in target) {
13707
- const value = visualElement.getValue(key, (_a2 = visualElement.latestValues[key]) !== null && _a2 !== void 0 ? _a2 : null);
13732
+ const value = visualElement.getValue(key, (_a = visualElement.latestValues[key]) !== null && _a !== void 0 ? _a : null);
13708
13733
  const valueTarget = target[key];
13709
13734
  if (valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key)) {
13710
13735
  continue;
@@ -13741,8 +13766,8 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
13741
13766
  return animations2;
13742
13767
  }
13743
13768
  function animateVariant(visualElement, variant, options = {}) {
13744
- var _a2;
13745
- const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
13769
+ var _a;
13770
+ const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : void 0);
13746
13771
  let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
13747
13772
  if (options.transitionOverride) {
13748
13773
  transition = options.transitionOverride;
@@ -13823,8 +13848,8 @@ function createAnimationState(visualElement) {
13823
13848
  let state = createState();
13824
13849
  let isInitialRender = true;
13825
13850
  const buildResolvedTypeValues = (type) => (acc, definition) => {
13826
- var _a2;
13827
- const resolved = resolveVariant(visualElement, definition, type === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
13851
+ var _a;
13852
+ const resolved = resolveVariant(visualElement, definition, type === "exit" ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom : void 0);
13828
13853
  if (resolved) {
13829
13854
  const { transition, transitionEnd, ...target } = resolved;
13830
13855
  acc = { ...acc, ...target, ...transitionEnd };
@@ -13946,12 +13971,12 @@ function createAnimationState(visualElement) {
13946
13971
  return shouldAnimate ? animate(animations2) : Promise.resolve();
13947
13972
  }
13948
13973
  function setActive(type, isActive) {
13949
- var _a2;
13974
+ var _a;
13950
13975
  if (state[type].isActive === isActive)
13951
13976
  return Promise.resolve();
13952
- (_a2 = visualElement.variantChildren) === null || _a2 === void 0 ? void 0 : _a2.forEach((child) => {
13953
- var _a3;
13954
- return (_a3 = child.animationState) === null || _a3 === void 0 ? void 0 : _a3.setActive(type, isActive);
13977
+ (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
13978
+ var _a2;
13979
+ return (_a2 = child.animationState) === null || _a2 === void 0 ? void 0 : _a2.setActive(type, isActive);
13955
13980
  });
13956
13981
  state[type].isActive = isActive;
13957
13982
  const animations2 = animateChanges(type);
@@ -14036,9 +14061,9 @@ class AnimationFeature extends Feature {
14036
14061
  }
14037
14062
  }
14038
14063
  unmount() {
14039
- var _a2;
14064
+ var _a;
14040
14065
  this.node.animationState.reset();
14041
- (_a2 = this.unmountControls) === null || _a2 === void 0 ? void 0 : _a2.call(this);
14066
+ (_a = this.unmountControls) === null || _a === void 0 ? void 0 : _a.call(this);
14042
14067
  }
14043
14068
  }
14044
14069
  let id$1 = 0;
@@ -14557,8 +14582,8 @@ class VisualElementDragControls {
14557
14582
  };
14558
14583
  const onSessionEnd = (event, info) => this.stop(event, info);
14559
14584
  const resumeAnimation = () => eachAxis((axis) => {
14560
- var _a2;
14561
- return this.getAnimationState(axis) === "paused" && ((_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.play());
14585
+ var _a;
14586
+ return this.getAnimationState(axis) === "paused" && ((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
14562
14587
  });
14563
14588
  const { dragSnapToOrigin } = this.getProps();
14564
14589
  this.panSession = new PanSession(originEvent, {
@@ -14612,9 +14637,9 @@ class VisualElementDragControls {
14612
14637
  axisValue.set(next);
14613
14638
  }
14614
14639
  resolveConstraints() {
14615
- var _a2;
14640
+ var _a;
14616
14641
  const { dragConstraints, dragElastic } = this.getProps();
14617
- 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;
14642
+ 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;
14618
14643
  const prevConstraints = this.constraints;
14619
14644
  if (dragConstraints && isRefObject(dragConstraints)) {
14620
14645
  if (!this.constraints) {
@@ -14693,13 +14718,13 @@ class VisualElementDragControls {
14693
14718
  }
14694
14719
  pauseAnimation() {
14695
14720
  eachAxis((axis) => {
14696
- var _a2;
14697
- return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.pause();
14721
+ var _a;
14722
+ return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause();
14698
14723
  });
14699
14724
  }
14700
14725
  getAnimationState(axis) {
14701
- var _a2;
14702
- return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.state;
14726
+ var _a;
14727
+ return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state;
14703
14728
  }
14704
14729
  /**
14705
14730
  * Drag works differently depending on which props are provided.
@@ -15702,12 +15727,12 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15702
15727
  };
15703
15728
  }
15704
15729
  measurePageBox() {
15705
- var _a2;
15730
+ var _a;
15706
15731
  const { visualElement } = this.options;
15707
15732
  if (!visualElement)
15708
15733
  return createBox();
15709
15734
  const box = visualElement.measureViewportBox();
15710
- const wasInScrollRoot = ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) || this.path.some(checkNodeWasScrollRoot);
15735
+ const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
15711
15736
  if (!wasInScrollRoot) {
15712
15737
  const { scroll } = this.root;
15713
15738
  if (scroll) {
@@ -15718,10 +15743,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15718
15743
  return box;
15719
15744
  }
15720
15745
  removeElementScroll(box) {
15721
- var _a2;
15746
+ var _a;
15722
15747
  const boxWithoutScroll = createBox();
15723
15748
  copyBoxInto(boxWithoutScroll, box);
15724
- if ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) {
15749
+ if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
15725
15750
  return boxWithoutScroll;
15726
15751
  }
15727
15752
  for (let i2 = 0; i2 < this.path.length; i2++) {
@@ -15806,13 +15831,13 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15806
15831
  }
15807
15832
  }
15808
15833
  resolveTargetDelta(forceRecalculation = false) {
15809
- var _a2;
15834
+ var _a;
15810
15835
  const lead = this.getLead();
15811
15836
  this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
15812
15837
  this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
15813
15838
  this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
15814
15839
  const isShared = Boolean(this.resumingFrom) || this !== lead;
15815
- const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
15840
+ const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
15816
15841
  if (canSkip)
15817
15842
  return;
15818
15843
  const { layout: layout2, layoutId } = this.options;
@@ -15883,11 +15908,11 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15883
15908
  return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
15884
15909
  }
15885
15910
  calcProjection() {
15886
- var _a2;
15911
+ var _a;
15887
15912
  const lead = this.getLead();
15888
15913
  const isShared = Boolean(this.resumingFrom) || this !== lead;
15889
15914
  let canSkip = true;
15890
- if (this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty)) {
15915
+ if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
15891
15916
  canSkip = false;
15892
15917
  }
15893
15918
  if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
@@ -15944,8 +15969,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
15944
15969
  this.isVisible = true;
15945
15970
  }
15946
15971
  scheduleRender(notifyAll = true) {
15947
- var _a2;
15948
- (_a2 = this.options.visualElement) === null || _a2 === void 0 ? void 0 : _a2.scheduleRender();
15972
+ var _a;
15973
+ (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
15949
15974
  if (notifyAll) {
15950
15975
  const stack = this.getStack();
15951
15976
  stack && stack.scheduleRender();
@@ -16083,14 +16108,14 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16083
16108
  return stack ? stack.lead === this : true;
16084
16109
  }
16085
16110
  getLead() {
16086
- var _a2;
16111
+ var _a;
16087
16112
  const { layoutId } = this.options;
16088
- return layoutId ? ((_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.lead) || this : this;
16113
+ return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
16089
16114
  }
16090
16115
  getPrevLead() {
16091
- var _a2;
16116
+ var _a;
16092
16117
  const { layoutId } = this.options;
16093
- return layoutId ? (_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.prevLead : void 0;
16118
+ return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : void 0;
16094
16119
  }
16095
16120
  getStack() {
16096
16121
  const { layoutId } = this.options;
@@ -16145,7 +16170,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16145
16170
  visualElement.scheduleRender();
16146
16171
  }
16147
16172
  getProjectionStyles(styleProp) {
16148
- var _a2, _b;
16173
+ var _a, _b;
16149
16174
  if (!this.instance || this.isSVG)
16150
16175
  return void 0;
16151
16176
  if (!this.isVisible) {
@@ -16184,7 +16209,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16184
16209
  const { x: x2, y: y2 } = this.projectionDelta;
16185
16210
  styles.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`;
16186
16211
  if (lead.animationValues) {
16187
- 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;
16212
+ 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;
16188
16213
  } else {
16189
16214
  styles.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
16190
16215
  }
@@ -16213,8 +16238,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
16213
16238
  // Only run on root
16214
16239
  resetTree() {
16215
16240
  this.root.nodes.forEach((node) => {
16216
- var _a2;
16217
- return (_a2 = node.currentAnimation) === null || _a2 === void 0 ? void 0 : _a2.stop();
16241
+ var _a;
16242
+ return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
16218
16243
  });
16219
16244
  this.root.nodes.forEach(clearMeasurements);
16220
16245
  this.root.sharedNodes.clear();
@@ -16225,8 +16250,8 @@ function updateLayout(node) {
16225
16250
  node.updateLayout();
16226
16251
  }
16227
16252
  function notifyLayoutUpdate(node) {
16228
- var _a2;
16229
- const snapshot = ((_a2 = node.resumeFrom) === null || _a2 === void 0 ? void 0 : _a2.snapshot) || node.snapshot;
16253
+ var _a;
16254
+ const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
16230
16255
  if (node.isLead() && node.layout && snapshot && node.hasListeners("didUpdate")) {
16231
16256
  const { layoutBox: layout2, measuredBox: measuredLayout } = node.layout;
16232
16257
  const { animationType } = node.options;
@@ -16376,8 +16401,8 @@ function shouldAnimatePositionOnly(animationType, snapshot, layout2) {
16376
16401
  return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout2), 0.2);
16377
16402
  }
16378
16403
  function checkNodeWasScrollRoot(node) {
16379
- var _a2;
16380
- return node !== node.root && ((_a2 = node.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot);
16404
+ var _a;
16405
+ return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
16381
16406
  }
16382
16407
  const DocumentProjectionNode = createProjectionNode({
16383
16408
  attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
@@ -16948,8 +16973,8 @@ class VisualElement {
16948
16973
  * directly from the instance (which might have performance implications).
16949
16974
  */
16950
16975
  readValue(key, target) {
16951
- var _a2;
16952
- 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);
16976
+ var _a;
16977
+ 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);
16953
16978
  if (value !== void 0 && value !== null) {
16954
16979
  if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) {
16955
16980
  value = parseFloat(value);
@@ -16972,11 +16997,11 @@ class VisualElement {
16972
16997
  * props.
16973
16998
  */
16974
16999
  getBaseTarget(key) {
16975
- var _a2;
17000
+ var _a;
16976
17001
  const { initial } = this.props;
16977
17002
  let valueFromInitial;
16978
17003
  if (typeof initial === "string" || typeof initial === "object") {
16979
- const variant = resolveVariantFromProps(this.props, initial, (_a2 = this.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom);
17004
+ const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom);
16980
17005
  if (variant) {
16981
17006
  valueFromInitial = variant[key];
16982
17007
  }
@@ -17404,9 +17429,9 @@ const TrackElementView = ({
17404
17429
  lastPosRef.current = position;
17405
17430
  };
17406
17431
  const sendUpdate = () => {
17407
- var _a2, _b;
17432
+ var _a, _b;
17408
17433
  setIsDragging(false);
17409
- if (((_a2 = lastPosRef.current) == null ? void 0 : _a2.start) !== position.start || ((_b = lastPosRef.current) == null ? void 0 : _b.end) !== position.end) {
17434
+ if (((_a = lastPosRef.current) == null ? void 0 : _a.start) !== position.start || ((_b = lastPosRef.current) == null ? void 0 : _b.end) !== position.end) {
17410
17435
  onDrag({
17411
17436
  element,
17412
17437
  updates: {
@@ -17701,8 +17726,8 @@ const useTimelineManager = () => {
17701
17726
  setSelectedItem(selectedItem2);
17702
17727
  };
17703
17728
  const onAddTrack = () => {
17704
- var _a2;
17705
- const tracks = ((_a2 = editor.getTimelineData()) == null ? void 0 : _a2.tracks) || [];
17729
+ var _a;
17730
+ const tracks = ((_a = editor.getTimelineData()) == null ? void 0 : _a.tracks) || [];
17706
17731
  editor.addTrack(`Track_${tracks.length + 1}`);
17707
17732
  };
17708
17733
  return {
@@ -17721,7 +17746,7 @@ const TimelineManager = ({
17721
17746
  timelineTickConfigs,
17722
17747
  elementColors
17723
17748
  }) => {
17724
- var _a2;
17749
+ var _a;
17725
17750
  const { timelineData, totalDuration, selectedItem, onAddTrack, onReorder, onElementDrag, onSeek, onSelectionChange } = useTimelineManager();
17726
17751
  return /* @__PURE__ */ jsxRuntime.jsx(
17727
17752
  TimelineView,
@@ -17744,7 +17769,7 @@ const TimelineManager = ({
17744
17769
  duration: totalDuration,
17745
17770
  zoom: trackZoom,
17746
17771
  onSeek,
17747
- timelineCount: ((_a2 = timelineData == null ? void 0 : timelineData.tracks) == null ? void 0 : _a2.length) ?? 0,
17772
+ timelineCount: ((_a = timelineData == null ? void 0 : timelineData.tracks) == null ? void 0 : _a.length) ?? 0,
17748
17773
  timelineTickConfigs
17749
17774
  }
17750
17775
  )
@@ -18250,8 +18275,8 @@ class BrowserMediaManager extends BaseMediaManager {
18250
18275
  const matchesType = !options.type || item.type === options.type;
18251
18276
  const matchesMetadata = !options.metadata || Object.entries(options.metadata).every(
18252
18277
  ([key, value]) => {
18253
- var _a2;
18254
- return ((_a2 = item.metadata) == null ? void 0 : _a2[key]) === value;
18278
+ var _a;
18279
+ return ((_a = item.metadata) == null ? void 0 : _a[key]) === value;
18255
18280
  }
18256
18281
  );
18257
18282
  return matchesQuery && matchesType && matchesMetadata;