@anu3ev/fabric-image-editor 0.5.31 → 0.5.33

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/main.js CHANGED
@@ -35,12 +35,12 @@ var G = (h, t, e) => new Promise((n, s) => {
35
35
  }, a = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(o, i);
36
36
  a((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as X, Textbox as ct, util as yt, controlsUtils as Xe, InteractiveFabricObject as Ke, Point as lt, FitContentLayout as qe, loadSVGFromURL as En, FabricImage as Jt, Gradient as Je, Rect as Dn, Circle as Ln, Triangle as _n, Group as zt, Color as xn, classRegistry as Qe, loadSVGFromString as Rn, Canvas as kn, Pattern as Bn } from "fabric";
38
+ import { ActiveSelection as X, Textbox as ct, util as vt, controlsUtils as Xe, InteractiveFabricObject as Ke, Point as lt, FitContentLayout as qe, loadSVGFromURL as En, FabricImage as Kt, Gradient as Je, Rect as Dn, Circle as Ln, Triangle as _n, Group as Nt, Color as xn, classRegistry as Qe, loadSVGFromString as Rn, Canvas as kn, Pattern as Bn } from "fabric";
39
39
  import { create as Nn } from "jsondiffpatch";
40
- import Pn from "diff-match-patch";
41
- var zn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", et = function() {
40
+ import zn from "diff-match-patch";
41
+ var Pn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", et = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
- e += zn[n[t] & 63];
43
+ e += Pn[n[t] & 63];
44
44
  return e;
45
45
  };
46
46
  const $e = 300;
@@ -451,7 +451,7 @@ class Fn {
451
451
  }
452
452
  function Wn(h) {
453
453
  return new Worker(
454
- "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
454
+ "" + new URL("assets/worker-2TM2HcqM.js", import.meta.url).href,
455
455
  {
456
456
  name: h == null ? void 0 : h.name
457
457
  }
@@ -503,52 +503,52 @@ class Un {
503
503
  this.worker.terminate();
504
504
  }
505
505
  }
506
- const Mt = 12, Yn = 2, Ie = 8, Te = 20, Hn = 100, Oe = 20, Ee = 8, Zn = 100, ge = 32, Ne = 1, Gn = "#2B2D33", Pe = "#3D8BF4", ze = "#FFFFFF";
506
+ const St = 12, Yn = 2, Ie = 8, Te = 20, Hn = 100, Oe = 20, Ee = 8, Zn = 100, ge = 32, Ne = 1, Gn = "#2B2D33", ze = "#3D8BF4", Pe = "#FFFFFF";
507
507
  function le(h, t, e, n, s) {
508
- const o = Mt, i = Yn;
509
- h.save(), h.translate(t, e), h.rotate(yt.degreesToRadians(s.angle)), h.fillStyle = ze, h.strokeStyle = Pe, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
508
+ const o = St, i = Yn;
509
+ h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Pe, h.strokeStyle = ze, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
510
510
  }
511
511
  function tn(h, t, e, n, s) {
512
512
  const o = Ie, i = Te, a = Hn;
513
- h.save(), h.translate(t, e), h.rotate(yt.degreesToRadians(s.angle)), h.fillStyle = ze, h.strokeStyle = Pe, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
513
+ h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Pe, h.strokeStyle = ze, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
514
514
  }
515
515
  function en(h, t, e, n, s) {
516
516
  const o = Oe, i = Ee, a = Zn;
517
- h.save(), h.translate(t, e), h.rotate(yt.degreesToRadians(s.angle)), h.fillStyle = ze, h.strokeStyle = Pe, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
517
+ h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Pe, h.strokeStyle = ze, h.lineWidth = Ne, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
518
518
  }
519
519
  const Vn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", bn = new Image();
520
520
  bn.src = Vn;
521
521
  function Xn(h, t, e, n, s) {
522
522
  const i = ge / 2;
523
- h.save(), h.translate(t, e), h.rotate(yt.degreesToRadians(s.angle)), h.fillStyle = Gn, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(bn, -i / 2, -i / 2, i, i), h.restore();
523
+ h.save(), h.translate(t, e), h.rotate(vt.degreesToRadians(s.angle)), h.fillStyle = Gn, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(bn, -i / 2, -i / 2, i, i), h.restore();
524
524
  }
525
525
  const Kn = {
526
526
  // Угловые точки
527
527
  tl: {
528
528
  render: le,
529
- sizeX: Mt,
530
- sizeY: Mt,
529
+ sizeX: St,
530
+ sizeY: St,
531
531
  offsetX: 0,
532
532
  offsetY: 0
533
533
  },
534
534
  tr: {
535
535
  render: le,
536
- sizeX: Mt,
537
- sizeY: Mt,
536
+ sizeX: St,
537
+ sizeY: St,
538
538
  offsetX: 0,
539
539
  offsetY: 0
540
540
  },
541
541
  bl: {
542
542
  render: le,
543
- sizeX: Mt,
544
- sizeY: Mt,
543
+ sizeX: St,
544
+ sizeY: St,
545
545
  offsetX: 0,
546
546
  offsetY: 0
547
547
  },
548
548
  br: {
549
549
  render: le,
550
- sizeX: Mt,
551
- sizeY: Mt,
550
+ sizeX: St,
551
+ sizeY: St,
552
552
  offsetX: 0,
553
553
  offsetY: 0
554
554
  },
@@ -895,7 +895,7 @@ V.registeredFontKeys = /* @__PURE__ */ new Set(), V.descriptorDefaults = {
895
895
  display: "auto"
896
896
  };
897
897
  let De = V;
898
- const qn = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI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AwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", qt = {
899
899
  style: {
900
900
  position: "absolute",
901
901
  display: "none",
@@ -1005,11 +1005,11 @@ class is {
1005
1005
  _initToolbar() {
1006
1006
  if (!this.options.showToolbar) return;
1007
1007
  const t = this.options.toolbar || {};
1008
- this.config = Ot(F(F({}, Qt), t), {
1009
- style: F(F({}, Qt.style), t.style || {}),
1010
- btnStyle: F(F({}, Qt.btnStyle), t.btnStyle || {}),
1011
- icons: F(F({}, Qt.icons), t.icons || {}),
1012
- handlers: F(F({}, Qt.handlers), t.handlers || {})
1008
+ this.config = Ot(F(F({}, qt), t), {
1009
+ style: F(F({}, qt.style), t.style || {}),
1010
+ btnStyle: F(F({}, qt.btnStyle), t.btnStyle || {}),
1011
+ icons: F(F({}, qt.icons), t.icons || {}),
1012
+ handlers: F(F({}, qt.handlers), t.handlers || {})
1013
1013
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
1014
1014
  this.el.style.display = "none";
1015
1015
  }, this._createDOM(), this._bindEvents();
@@ -1239,6 +1239,7 @@ const Le = [
1239
1239
  "customData",
1240
1240
  "backgroundType",
1241
1241
  "format",
1242
+ "contentType",
1242
1243
  "width",
1243
1244
  "height",
1244
1245
  "locked",
@@ -1292,7 +1293,7 @@ class J {
1292
1293
  includeValueOnMove: !1
1293
1294
  },
1294
1295
  textDiff: {
1295
- diffMatchPatch: Pn,
1296
+ diffMatchPatch: zn,
1296
1297
  minLength: 60
1297
1298
  }
1298
1299
  });
@@ -1822,7 +1823,7 @@ class J {
1822
1823
  }
1823
1824
  }
1824
1825
  }
1825
- const rs = 0.1, cs = 2, on = 0.1, ls = 90, Yt = 16, Ht = 16, Lt = 4096, _t = 4096, an = "application/image-editor:", de = [
1826
+ const rs = 0.1, cs = 2, on = 0.1, ls = 90, Qt = 16, $t = 16, zt = 4096, Pt = 4096, an = "application/image-editor:", de = [
1826
1827
  "format",
1827
1828
  "uppercase",
1828
1829
  "textCaseRaw",
@@ -1838,7 +1839,7 @@ const rs = 0.1, cs = 2, on = 0.1, ls = 90, Yt = 16, Ht = 16, Lt = 4096, _t = 409
1838
1839
  "radiusBottomLeft",
1839
1840
  "lineFontDefaults"
1840
1841
  ], ds = 50;
1841
- class St {
1842
+ class pt {
1842
1843
  constructor({ editor: t }) {
1843
1844
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1844
1845
  }
@@ -1867,14 +1868,14 @@ class St {
1867
1868
  customData: c = null
1868
1869
  } = t;
1869
1870
  if (!e) return null;
1870
- const { canvas: l, montageArea: d, transformManager: u, historyManager: f, errorManager: g } = this.editor, m = yield this.getContentType(e), p = St.getFormatFromContentType(m), { acceptContentTypes: y, acceptFormats: v } = this;
1871
+ const { canvas: l, montageArea: d, transformManager: u, historyManager: f, errorManager: g } = this.editor, m = yield this.getContentType(e), p = pt.getFormatFromContentType(m), { acceptContentTypes: y, acceptFormats: v } = this;
1871
1872
  if (!this.isAllowedContentType(m)) {
1872
- const C = `Неверный contentType для изображения: ${m}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1873
+ const j = `Неверный contentType для изображения: ${m}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1873
1874
  return g.emitError({
1874
1875
  origin: "ImageManager",
1875
1876
  method: "importImage",
1876
1877
  code: "INVALID_CONTENT_TYPE",
1877
- message: C,
1878
+ message: j,
1878
1879
  data: {
1879
1880
  source: e,
1880
1881
  format: p,
@@ -1891,12 +1892,12 @@ class St {
1891
1892
  }
1892
1893
  f.suspendHistory();
1893
1894
  try {
1894
- let C, b;
1895
+ let j, b;
1895
1896
  if (e instanceof File)
1896
- C = URL.createObjectURL(e);
1897
+ j = URL.createObjectURL(e);
1897
1898
  else if (typeof e == "string") {
1898
- const I = yield (yield fetch(e, { mode: "cors" })).blob();
1899
- C = URL.createObjectURL(I);
1899
+ const C = yield (yield fetch(e, { mode: "cors" })).blob();
1900
+ j = URL.createObjectURL(C);
1900
1901
  } else
1901
1902
  return g.emitError({
1902
1903
  origin: "ImageManager",
@@ -1915,31 +1916,39 @@ class St {
1915
1916
  withoutAdding: r,
1916
1917
  customData: c
1917
1918
  }
1918
- }), null;
1919
- if (this._createdBlobUrls.push(C), p === "svg") {
1920
- const w = yield En(C);
1921
- b = yt.groupSVGElements(w.objects, w.options);
1919
+ }), f.resumeHistory(), null;
1920
+ if (this._createdBlobUrls.push(j), p === "svg") {
1921
+ const w = yield En(j);
1922
+ b = vt.groupSVGElements(w.objects, w.options);
1922
1923
  } else
1923
- b = yield Jt.fromURL(C, { crossOrigin: "anonymous" });
1924
- const { width: T, height: M } = b;
1925
- if (b instanceof Jt) {
1924
+ b = yield Kt.fromURL(j, { crossOrigin: "anonymous" });
1925
+ const { width: T, height: S } = b;
1926
+ if (b instanceof Kt) {
1926
1927
  const w = b.getElement();
1927
- let I = "";
1928
- if (w instanceof HTMLImageElement ? I = w.src : w instanceof HTMLCanvasElement && (I = w.toDataURL()), M > _t || T > Lt) {
1929
- const S = yield this.resizeImageToBoundaries(I, "max"), j = URL.createObjectURL(S);
1930
- this._createdBlobUrls.push(j), b = yield Jt.fromURL(j, { crossOrigin: "anonymous" });
1931
- } else if (M < Ht || T < Yt) {
1932
- const S = yield this.resizeImageToBoundaries(I, "min"), j = URL.createObjectURL(S);
1933
- this._createdBlobUrls.push(j), b = yield Jt.fromURL(j, { crossOrigin: "anonymous" });
1928
+ let C = "";
1929
+ if (w instanceof HTMLImageElement ? C = w.src : w instanceof HTMLCanvasElement && (C = w.toDataURL()), S > Pt || T > zt) {
1930
+ const A = yield this.resizeImageToBoundaries({
1931
+ dataURL: C,
1932
+ sizeType: "max",
1933
+ contentType: m
1934
+ }), I = URL.createObjectURL(A);
1935
+ this._createdBlobUrls.push(I), b = yield Kt.fromURL(I, { crossOrigin: "anonymous" });
1936
+ } else if (S < $t || T < Qt) {
1937
+ const A = yield this.resizeImageToBoundaries({
1938
+ dataURL: C,
1939
+ sizeType: "min",
1940
+ contentType: m
1941
+ }), I = URL.createObjectURL(A);
1942
+ this._createdBlobUrls.push(I), b = yield Kt.fromURL(I, { crossOrigin: "anonymous" });
1934
1943
  }
1935
1944
  }
1936
- if (b.set("id", `${b.type}-${et()}`), b.set("format", p), b.set("customData", c || null), n === "scale-montage")
1945
+ if (b.set("id", `${b.type}-${et()}`), b.set("format", p), b.set("contentType", m), b.set("customData", c || null), n === "scale-montage")
1937
1946
  this.editor.canvasManager.scaleMontageAreaToImage({ object: b, withoutSave: !0 });
1938
1947
  else {
1939
- const { width: w, height: I } = d, S = this.calculateScaleFactor({ imageObject: b, scaleType: n });
1940
- n === "image-contain" && S < 1 ? u.fitObject({ object: b, type: "contain", withoutSave: !0 }) : n === "image-cover" && (T > w || M > I) && u.fitObject({ object: b, type: "cover", withoutSave: !0 });
1948
+ const { width: w, height: C } = d, A = this.calculateScaleFactor({ imageObject: b, scaleType: n });
1949
+ n === "image-contain" && A < 1 ? u.fitObject({ object: b, type: "contain", withoutSave: !0 }) : n === "image-cover" && (T > w || S > C) && u.fitObject({ object: b, type: "cover", withoutSave: !0 });
1941
1950
  }
1942
- const A = {
1951
+ const M = {
1943
1952
  image: b,
1944
1953
  format: p,
1945
1954
  contentType: m,
@@ -1952,13 +1961,13 @@ class St {
1952
1961
  withoutAdding: r,
1953
1962
  customData: c
1954
1963
  };
1955
- return r ? (f.resumeHistory(), l.fire("editor:image-imported", A), A) : (l.add(b), l.centerObject(b), a || l.setActiveObject(b), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", A), A);
1956
- } catch (C) {
1964
+ return r ? (f.resumeHistory(), l.fire("editor:image-imported", M), M) : (l.add(b), l.centerObject(b), a || l.setActiveObject(b), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", M), M);
1965
+ } catch (j) {
1957
1966
  return g.emitError({
1958
1967
  origin: "ImageManager",
1959
1968
  method: "importImage",
1960
1969
  code: "IMPORT_FAILED",
1961
- message: `Ошибка импорта изображения: ${C.message}`,
1970
+ message: `Ошибка импорта изображения: ${j.message}`,
1962
1971
  data: {
1963
1972
  source: e,
1964
1973
  format: p,
@@ -1976,32 +1985,65 @@ class St {
1976
1985
  });
1977
1986
  }
1978
1987
  /**
1979
- * Функция для ресайза изображения до максимальных размеров,
1980
- * если оно их превышает. Сохраняет пропорции.
1988
+ * Ресайзит изображение до заданных максимальных или минимальных размеров,
1989
+ * сохраняя пропорции. По умолчанию использует границы канваса.
1981
1990
  *
1982
- * @param dataURL - dataURL изображения
1983
- * @param size ('max | min') - максимальный или минимальный размер
1984
- * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1991
+ * @param options - опции
1992
+ * @param options.dataURL - dataURL изображения
1993
+ * @param options.sizeType - максимальный или минимальный размер ('max' | 'min')
1994
+ * @param options.maxWidth - максимальная ширина (по умолчанию CANVAS_MAX_WIDTH)
1995
+ * @param options.maxHeight - максимальная высота (по умолчанию CANVAS_MAX_HEIGHT)
1996
+ * @param options.minWidth - минимальная ширина (по умолчанию CANVAS_MIN_WIDTH)
1997
+ * @param options.minHeight - минимальная высота (по умолчанию CANVAS_MIN_HEIGHT)
1998
+ * @param options.asBase64 - вернуть base64 вместо Blob
1999
+ * @param options.emitMessage - выводить предупреждение в случае ресайза
2000
+ * @param options.contentType - тип контента
2001
+ * @param options.quality - качество изображения от 0 до 1 (для JPEG/WebP)
2002
+ * @returns возвращает Promise с Blob или base64 в зависимости от опций
1985
2003
  */
1986
- resizeImageToBoundaries(t, e = "max") {
2004
+ resizeImageToBoundaries(t) {
1987
2005
  return G(this, null, function* () {
1988
- let n = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${Lt}x${_t}`;
1989
- e === "min" && (n = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Yt}x${Ht}`);
1990
- const s = {
1991
- dataURL: t,
1992
- sizeType: e,
1993
- maxWidth: Lt,
1994
- maxHeight: _t,
1995
- minWidth: Yt,
1996
- minHeight: Ht
2006
+ const {
2007
+ dataURL: e,
2008
+ sizeType: n = "max",
2009
+ contentType: s = "image/png",
2010
+ quality: o = 1,
2011
+ maxWidth: i = zt,
2012
+ maxHeight: a = Pt,
2013
+ minWidth: r = Qt,
2014
+ minHeight: c = $t,
2015
+ asBase64: l = !1,
2016
+ emitMessage: d = !0
2017
+ } = t, { errorManager: u, workerManager: f } = this.editor, g = {
2018
+ dataURL: e,
2019
+ sizeType: n,
2020
+ contentType: s,
2021
+ quality: o,
2022
+ maxWidth: i,
2023
+ maxHeight: a,
2024
+ minWidth: r,
2025
+ minHeight: c
1997
2026
  };
1998
- return this.editor.errorManager.emitWarning({
1999
- origin: "ImageManager",
2000
- method: "resizeImageToBoundaries",
2001
- code: "IMAGE_RESIZE_WARNING",
2002
- message: n,
2003
- data: s
2004
- }), this.editor.workerManager.post("resizeImage", s);
2027
+ if (d) {
2028
+ let p = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${i}x${a}`;
2029
+ n === "min" && (p = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${r}x${c}`), u.emitWarning({
2030
+ origin: "ImageManager",
2031
+ method: "resizeImageToBoundaries",
2032
+ code: "IMAGE_RESIZE_WARNING",
2033
+ message: p,
2034
+ data: g
2035
+ });
2036
+ }
2037
+ const m = yield f.post("resizeImage", g);
2038
+ if (l) {
2039
+ const p = yield createImageBitmap(m);
2040
+ return yield f.post(
2041
+ "toDataURL",
2042
+ { contentType: s, quality: o, bitmap: p },
2043
+ [p]
2044
+ );
2045
+ }
2046
+ return m;
2005
2047
  });
2006
2048
  }
2007
2049
  /**
@@ -2024,22 +2066,22 @@ class St {
2024
2066
  exportAsBlob: o = !1
2025
2067
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
2026
2068
  try {
2027
- const l = n === "application/pdf", d = l ? "image/jpg" : n, u = St.getFormatFromContentType(d);
2069
+ const l = n === "application/pdf", d = l ? "image/jpg" : n, u = pt.getFormatFromContentType(d);
2028
2070
  a.setCoords();
2029
2071
  const { left: f, top: g, width: m, height: p } = a.getBoundingRect(), y = yield i.clone(["id", "format", "locked"]);
2030
2072
  y.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(d) && (y.backgroundColor = "#ffffff");
2031
- const v = y.getObjects().find((S) => S.id === a.id);
2073
+ const v = y.getObjects().find((A) => A.id === a.id);
2032
2074
  if (v && (v.visible = !1), c != null && c.isBlocked) {
2033
- const S = y.getObjects().find((j) => j.id === c.overlayMask.id);
2034
- S && (S.visible = !1);
2075
+ const A = y.getObjects().find((I) => I.id === c.overlayMask.id);
2076
+ A && (A.visible = !1);
2035
2077
  }
2036
2078
  y.viewportTransform = [1, 0, 0, 1, -f, -g], y.setDimensions({ width: m, height: p }, { backstoreOnly: !0 }), y.renderAll();
2037
- const C = y.getObjects().filter((S) => S.format).every((S) => S.format === "svg");
2038
- if (u === "svg" && C) {
2039
- const S = y.toSVG();
2079
+ const j = y.getObjects().filter((A) => A.format).every((A) => A.format === "svg");
2080
+ if (u === "svg" && j) {
2081
+ const A = y.toSVG();
2040
2082
  y.dispose();
2041
2083
  const O = {
2042
- image: St._exportSVGStringAsFile(S, {
2084
+ image: pt._exportSVGStringAsFile(A, {
2043
2085
  exportAsBase64: s,
2044
2086
  exportAsBlob: o,
2045
2087
  fileName: e
@@ -2050,32 +2092,40 @@ class St {
2050
2092
  };
2051
2093
  return i.fire("editor:canvas-exported", O), O;
2052
2094
  }
2053
- const b = yield new Promise((S, j) => {
2054
- y.getElement().toBlob((O) => {
2055
- O ? S(O) : j(new Error("Failed to create Blob from canvas"));
2056
- });
2095
+ const b = yield new Promise((A, I) => {
2096
+ y.getElement().toBlob(
2097
+ (O) => {
2098
+ O ? A(O) : I(new Error("Failed to create Blob from canvas"));
2099
+ },
2100
+ d,
2101
+ 1
2102
+ );
2057
2103
  });
2058
2104
  if (y.dispose(), o) {
2059
- const S = {
2105
+ const A = {
2060
2106
  image: b,
2061
2107
  format: u,
2062
2108
  contentType: d,
2063
2109
  fileName: e
2064
2110
  };
2065
- return i.fire("editor:canvas-exported", S), S;
2111
+ return i.fire("editor:canvas-exported", A), A;
2066
2112
  }
2067
- const T = yield createImageBitmap(b), M = yield r.post(
2113
+ const T = yield createImageBitmap(b), S = yield r.post(
2068
2114
  "toDataURL",
2069
- { format: u, quality: 1, bitmap: T },
2115
+ {
2116
+ contentType: d,
2117
+ quality: 1,
2118
+ bitmap: T
2119
+ },
2070
2120
  [T]
2071
2121
  );
2072
2122
  if (l) {
2073
- const j = m * 0.264583, O = p * 0.264583, k = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, D = new k({
2074
- orientation: j > O ? "landscape" : "portrait",
2123
+ const I = m * 0.264583, O = p * 0.264583, k = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, D = new k({
2124
+ orientation: I > O ? "landscape" : "portrait",
2075
2125
  unit: "mm",
2076
- format: [j, O]
2126
+ format: [I, O]
2077
2127
  });
2078
- if (D.addImage(String(M), "JPG", 0, 0, j, O), s) {
2128
+ if (D.addImage(String(S), "JPG", 0, 0, I, O), s) {
2079
2129
  const B = {
2080
2130
  image: D.output("datauristring"),
2081
2131
  format: "pdf",
@@ -2093,21 +2143,21 @@ class St {
2093
2143
  return i.fire("editor:canvas-exported", L), L;
2094
2144
  }
2095
2145
  if (s) {
2096
- const S = {
2097
- image: M,
2146
+ const A = {
2147
+ image: S,
2098
2148
  format: u,
2099
2149
  contentType: d,
2100
2150
  fileName: e
2101
2151
  };
2102
- return i.fire("editor:canvas-exported", S), S;
2152
+ return i.fire("editor:canvas-exported", A), A;
2103
2153
  }
2104
- const A = u === "svg" && !C ? e.replace(/\.[^/.]+$/, ".png") : e, I = {
2105
- image: new File([b], A, { type: d }),
2154
+ const M = u === "svg" && !j ? e.replace(/\.[^/.]+$/, ".png") : e, C = {
2155
+ image: new File([b], M, { type: d }),
2106
2156
  format: u,
2107
2157
  contentType: d,
2108
- fileName: A
2158
+ fileName: M
2109
2159
  };
2110
- return i.fire("editor:canvas-exported", I), I;
2160
+ return i.fire("editor:canvas-exported", C), C;
2111
2161
  } catch (l) {
2112
2162
  return this.editor.errorManager.emitError({
2113
2163
  origin: "ImageManager",
@@ -2132,87 +2182,93 @@ class St {
2132
2182
  */
2133
2183
  exportObjectAsImageFile() {
2134
2184
  return G(this, arguments, function* (t = {}) {
2185
+ var v;
2135
2186
  const {
2136
2187
  object: e,
2137
- fileName: n = "image.png",
2138
- contentType: s = "image/png",
2188
+ fileName: n,
2189
+ contentType: s,
2139
2190
  exportAsBase64: o = !1,
2140
2191
  exportAsBlob: i = !1
2141
- } = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject();
2192
+ } = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject(), l = s != null ? s : "image/png", d = pt.getFormatFromContentType(l) || "png", u = n != null ? n : `image.${d}`;
2142
2193
  if (!c)
2143
2194
  return this.editor.errorManager.emitError({
2144
2195
  origin: "ImageManager",
2145
2196
  method: "exportObjectAsImageFile",
2146
2197
  code: "NO_OBJECT_SELECTED",
2147
2198
  message: "Не выбран объект для экспорта",
2148
- data: { contentType: s, fileName: n, exportAsBase64: o, exportAsBlob: i }
2199
+ data: { contentType: l, fileName: u, exportAsBase64: o, exportAsBlob: i }
2149
2200
  }), null;
2201
+ const { contentType: f, format: g = "" } = c, m = (v = s != null ? s : f) != null ? v : "image/png", p = pt.getFormatFromContentType(m) || g || "png", y = n != null ? n : `image.${p}`;
2150
2202
  try {
2151
- const l = St.getFormatFromContentType(s);
2152
- if (l === "svg") {
2153
- const m = c.toSVG(), p = St._exportSVGStringAsFile(m, {
2203
+ if (p === "svg") {
2204
+ const M = c.toSVG(), w = pt._exportSVGStringAsFile(M, {
2154
2205
  exportAsBase64: o,
2155
2206
  exportAsBlob: i,
2156
- fileName: n
2157
- }), y = {
2207
+ fileName: y
2208
+ }), C = {
2158
2209
  object: c,
2159
- image: p,
2160
- format: l,
2210
+ image: w,
2211
+ format: p,
2161
2212
  contentType: "image/svg+xml",
2162
- fileName: n.replace(/\.[^/.]+$/, ".svg")
2213
+ fileName: y.replace(/\.[^/.]+$/, ".svg")
2163
2214
  };
2164
- return a.fire("editor:object-exported", y), y;
2215
+ return a.fire("editor:object-exported", C), C;
2165
2216
  }
2166
- if (o && c instanceof Jt) {
2167
- const m = yield createImageBitmap(c.getElement()), p = yield r.post(
2217
+ if (o && c instanceof Kt) {
2218
+ const M = yield createImageBitmap(c.getElement()), w = yield r.post(
2168
2219
  "toDataURL",
2169
2220
  {
2170
- format: l,
2221
+ contentType: m,
2171
2222
  quality: 1,
2172
- bitmap: m
2223
+ bitmap: M
2173
2224
  },
2174
- [m]
2175
- ), y = {
2225
+ [M]
2226
+ ), C = {
2176
2227
  object: c,
2177
- image: p,
2178
- format: l,
2179
- contentType: s,
2180
- fileName: n
2228
+ image: w,
2229
+ format: p,
2230
+ contentType: m,
2231
+ fileName: y
2181
2232
  };
2182
- return a.fire("editor:object-exported", y), y;
2233
+ return a.fire("editor:object-exported", C), C;
2183
2234
  }
2184
- const d = c.toCanvasElement({
2235
+ const j = c.toCanvasElement({
2185
2236
  enableRetinaScaling: !1
2186
- }), u = yield new Promise((m, p) => {
2187
- d.toBlob((y) => {
2188
- y ? m(y) : p(new Error("Failed to create Blob from canvas"));
2237
+ }), b = yield new Promise((M, w) => {
2238
+ j.toBlob((C) => {
2239
+ C ? M(C) : w(new Error("Failed to create Blob from canvas"));
2189
2240
  });
2190
2241
  });
2191
2242
  if (i) {
2192
- const m = {
2243
+ const M = {
2193
2244
  object: c,
2194
- image: u,
2195
- format: l,
2196
- contentType: s,
2197
- fileName: n
2245
+ image: b,
2246
+ format: p,
2247
+ contentType: m,
2248
+ fileName: y
2198
2249
  };
2199
- return a.fire("editor:object-exported", m), m;
2250
+ return a.fire("editor:object-exported", M), M;
2200
2251
  }
2201
- const f = new File([u], n, { type: s }), g = {
2252
+ const T = new File([b], y, { type: m }), S = {
2202
2253
  object: c,
2203
- image: f,
2204
- format: l,
2205
- contentType: s,
2206
- fileName: n
2254
+ image: T,
2255
+ format: p,
2256
+ contentType: m,
2257
+ fileName: y
2207
2258
  };
2208
- return a.fire("editor:object-exported", g), g;
2209
- } catch (l) {
2259
+ return a.fire("editor:object-exported", S), S;
2260
+ } catch (j) {
2210
2261
  return this.editor.errorManager.emitError({
2211
2262
  origin: "ImageManager",
2212
2263
  method: "exportObjectAsImageFile",
2213
2264
  code: "IMAGE_EXPORT_FAILED",
2214
- message: `Ошибка экспорта объекта: ${l.message}`,
2215
- data: { contentType: s, fileName: n, exportAsBase64: o, exportAsBlob: i }
2265
+ message: `Ошибка экспорта объекта: ${j.message}`,
2266
+ data: {
2267
+ contentType: m,
2268
+ fileName: y,
2269
+ exportAsBase64: o,
2270
+ exportAsBlob: i
2271
+ }
2216
2272
  }), null;
2217
2273
  }
2218
2274
  });
@@ -2228,7 +2284,7 @@ class St {
2228
2284
  * @returns массив допустимых форматов изображений
2229
2285
  */
2230
2286
  getAllowedFormatsFromContentTypes() {
2231
- return this.acceptContentTypes.map((t) => St.getFormatFromContentType(t)).filter((t) => t);
2287
+ return this.acceptContentTypes.map((t) => pt.getFormatFromContentType(t)).filter((t) => t);
2232
2288
  }
2233
2289
  /**
2234
2290
  * Проверяет, является ли contentType допустимым типом изображения.
@@ -2281,7 +2337,7 @@ class St {
2281
2337
  try {
2282
2338
  const s = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), o = {};
2283
2339
  return this.acceptContentTypes.forEach((i) => {
2284
- const a = St.getFormatFromContentType(i);
2340
+ const a = pt.getFormatFromContentType(i);
2285
2341
  a && (o[a] = i);
2286
2342
  }), s && o[s] || "application/octet-stream";
2287
2343
  } catch (n) {
@@ -2385,7 +2441,7 @@ class fs {
2385
2441
  canvas: o,
2386
2442
  montageArea: i,
2387
2443
  options: { canvasBackstoreWidth: a }
2388
- } = this.editor, { width: r, height: c } = i, l = Ct(Number(t), Yt, Lt);
2444
+ } = this.editor, { width: r, height: c } = i, l = Ct(Number(t), Qt, zt);
2389
2445
  if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(l), i.set({ width: l }), (g = o.clipPath) == null || g.set({ width: l }), e) {
2390
2446
  const m = l / r, p = rn(c, m);
2391
2447
  this.setResolutionHeight(p);
@@ -2415,7 +2471,7 @@ class fs {
2415
2471
  canvas: o,
2416
2472
  montageArea: i,
2417
2473
  options: { canvasBackstoreHeight: a }
2418
- } = this.editor, { width: r, height: c } = i, l = Ct(Number(t), Ht, _t);
2474
+ } = this.editor, { width: r, height: c } = i, l = Ct(Number(t), $t, Pt);
2419
2475
  if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(l), i.set({ height: l }), (g = o.clipPath) == null || g.set({ height: l }), e) {
2420
2476
  const m = l / c, p = rn(r, m);
2421
2477
  this.setResolutionWidth(p);
@@ -2468,7 +2524,7 @@ class fs {
2468
2524
  */
2469
2525
  setCanvasBackstoreWidth(t) {
2470
2526
  if (!t || typeof t != "number") return;
2471
- const e = Ct(t, Yt, Lt);
2527
+ const e = Ct(t, Qt, zt);
2472
2528
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2473
2529
  }
2474
2530
  /**
@@ -2477,7 +2533,7 @@ class fs {
2477
2533
  */
2478
2534
  setCanvasBackstoreHeight(t) {
2479
2535
  if (!t || typeof t != "number") return;
2480
- const e = Ct(t, Ht, _t);
2536
+ const e = Ct(t, $t, Pt);
2481
2537
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2482
2538
  }
2483
2539
  /**
@@ -2486,7 +2542,7 @@ class fs {
2486
2542
  * с учётом минимальных и максимальных значений.
2487
2543
  */
2488
2544
  adaptCanvasToContainer() {
2489
- const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o = Ct(n, Yt, Lt), i = Ct(s, Ht, _t);
2545
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, o = Ct(n, Qt, zt), i = Ct(s, $t, Pt);
2490
2546
  t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
2491
2547
  }
2492
2548
  /**
@@ -2688,7 +2744,7 @@ class fs {
2688
2744
  } = this.editor, c = t || s.getActiveObject();
2689
2745
  if (!us(c)) return;
2690
2746
  const { width: l, height: d } = c;
2691
- let u = Math.min(l, Lt), f = Math.min(d, _t);
2747
+ let u = Math.min(l, zt), f = Math.min(d, Pt);
2692
2748
  if (e) {
2693
2749
  const {
2694
2750
  width: g,
@@ -2859,10 +2915,10 @@ class gs {
2859
2915
  */
2860
2916
  _fitSingleObject(t, e) {
2861
2917
  const { canvas: n, montageArea: s } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, l = o * Math.abs(a), d = i * Math.abs(r), u = c * Math.PI / 180, f = Math.abs(Math.cos(u)), g = Math.abs(Math.sin(u)), m = l * f + d * g, p = l * g + d * f, y = s.width, v = s.height;
2862
- let C;
2863
- e === "contain" ? C = Math.min(y / m, v / p) : C = Math.max(y / m, v / p), t.set({
2864
- scaleX: a * C,
2865
- scaleY: r * C
2918
+ let j;
2919
+ e === "contain" ? j = Math.min(y / m, v / p) : j = Math.max(y / m, v / p), t.set({
2920
+ scaleX: a * j,
2921
+ scaleY: r * j
2866
2922
  }), n.centerObject(t);
2867
2923
  }
2868
2924
  /**
@@ -2982,8 +3038,8 @@ class ps {
2982
3038
  _calculateEmptySpaceRatio(t) {
2983
3039
  const { canvas: e, montageArea: n } = this.editor, s = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, d = -s[4] / t, u = (-s[4] + o) / t, f = -s[5] / t, g = (-s[5] + i) / t, m = d < a, p = u > r, y = f < c, v = g > l;
2984
3040
  if (!(m || p || y || v)) return 0;
2985
- const b = Math.max(0, a - d), T = Math.max(0, u - r), M = Math.max(0, c - f), A = Math.max(0, g - l), w = Math.max(b, T), I = Math.max(M, A), S = w / o, j = I / i;
2986
- return Math.max(S, j);
3041
+ const b = Math.max(0, a - d), T = Math.max(0, u - r), S = Math.max(0, c - f), M = Math.max(0, g - l), w = Math.max(b, T), C = Math.max(S, M), A = w / o, I = C / i;
3042
+ return Math.max(A, I);
2987
3043
  }
2988
3044
  /**
2989
3045
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2999,7 +3055,7 @@ class ps {
2999
3055
  const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), l = i.getHeight(), d = t.x - r[4], u = t.y - r[5], f = Math.abs(s), g = e - n;
3000
3056
  if (Math.abs(g) / f <= 0.1)
3001
3057
  return { x: d, y: u };
3002
- const p = c / 2, y = l / 2, v = a.left, C = a.top, b = p - v * n, T = y - C * n, M = (b - r[4]) / (e - n), A = (T - r[5]) / (e - n), w = M * f, I = A * f, S = w * o, j = I * o, O = Math.abs(S) > Math.abs(d) ? d : S, k = Math.abs(j) > Math.abs(u) ? u : j;
3058
+ const p = c / 2, y = l / 2, v = a.left, j = a.top, b = p - v * n, T = y - j * n, S = (b - r[4]) / (e - n), M = (T - r[5]) / (e - n), w = S * f, C = M * f, A = w * o, I = C * o, O = Math.abs(A) > Math.abs(d) ? d : A, k = Math.abs(I) > Math.abs(u) ? u : I;
3003
3059
  return { x: O, y: k };
3004
3060
  }
3005
3061
  /**
@@ -4131,7 +4187,7 @@ class me {
4131
4187
  });
4132
4188
  }
4133
4189
  static _isGroupOrSelection(t) {
4134
- return t instanceof X || t instanceof zt;
4190
+ return t instanceof X || t instanceof Nt;
4135
4191
  }
4136
4192
  }
4137
4193
  class bs {
@@ -4154,20 +4210,20 @@ class bs {
4154
4210
  */
4155
4211
  _getGroupsToUngroup(t) {
4156
4212
  if (Array.isArray(t)) {
4157
- const n = t.filter((s) => s instanceof zt);
4213
+ const n = t.filter((s) => s instanceof Nt);
4158
4214
  return n.length > 0 ? n : null;
4159
4215
  }
4160
4216
  if (t instanceof X) {
4161
- const n = t.getObjects().filter((s) => s instanceof zt);
4217
+ const n = t.getObjects().filter((s) => s instanceof Nt);
4162
4218
  return n.length > 0 ? n : null;
4163
4219
  }
4164
4220
  const e = t || this.editor.canvas.getActiveObject();
4165
4221
  if (!e) return null;
4166
4222
  if (e instanceof X) {
4167
- const n = e.getObjects().filter((s) => s instanceof zt);
4223
+ const n = e.getObjects().filter((s) => s instanceof Nt);
4168
4224
  return n.length > 0 ? n : null;
4169
4225
  }
4170
- return e instanceof zt ? [e] : null;
4226
+ return e instanceof Nt ? [e] : null;
4171
4227
  }
4172
4228
  /**
4173
4229
  * Группировка объектов
@@ -4184,7 +4240,7 @@ class bs {
4184
4240
  if (!o) return null;
4185
4241
  try {
4186
4242
  s.suspendHistory();
4187
- const i = new zt(o, {
4243
+ const i = new Nt(o, {
4188
4244
  id: `group-${et()}`
4189
4245
  });
4190
4246
  o.forEach((r) => n.remove(r)), n.add(i), n.setActiveObject(i), n.requestRenderAll();
@@ -4623,7 +4679,7 @@ const ws = ({ textbox: h }) => {
4623
4679
  );
4624
4680
  if (n.length)
4625
4681
  return (s = n[0]) == null ? void 0 : s[e];
4626
- }, _e = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, we = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", bt = ({
4682
+ }, _e = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, we = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", Mt = ({
4627
4683
  value: h,
4628
4684
  min: t,
4629
4685
  max: e
@@ -4715,42 +4771,42 @@ const ws = ({ textbox: h }) => {
4715
4771
  l += v;
4716
4772
  continue;
4717
4773
  }
4718
- const C = c[p], b = v / o, T = this._getLineLeftOffset(p);
4719
- let M = 0, A = 0, w = this.getValueOfPropertyAt(p, 0, e), I = this._getDecorationColorAt(p, 0), S = this.getValueOfPropertyAt(p, 0, "textDecorationThickness"), j = w, O = I, k = S;
4774
+ const j = c[p], b = v / o, T = this._getLineLeftOffset(p);
4775
+ let S = 0, M = 0, w = this.getValueOfPropertyAt(p, 0, e), C = this._getDecorationColorAt(p, 0), A = this.getValueOfPropertyAt(p, 0, "textDecorationThickness"), I = w, O = C, k = A;
4720
4776
  const D = l + b * (1 - r);
4721
4777
  let W = this.getHeightOfChar(p, 0), E = this.getValueOfPropertyAt(p, 0, "deltaY");
4722
- for (let B = 0, z = C.length; B < z; B += 1) {
4778
+ for (let B = 0, P = j.length; B < P; B += 1) {
4723
4779
  const x = this.__charBounds[p][B];
4724
- j = this.getValueOfPropertyAt(p, B, e), O = this._getDecorationColorAt(p, B), k = this.getValueOfPropertyAt(p, B, "textDecorationThickness");
4780
+ I = this.getValueOfPropertyAt(p, B, e), O = this._getDecorationColorAt(p, B), k = this.getValueOfPropertyAt(p, B, "textDecorationThickness");
4725
4781
  const _ = this.getHeightOfChar(p, B), R = this.getValueOfPropertyAt(p, B, "deltaY");
4726
- if (u && j && O) {
4782
+ if (u && I && O) {
4727
4783
  const N = s * k / 1e3;
4728
- t.save(), t.fillStyle = I, t.translate(x.renderLeft, x.renderTop), t.rotate(x.angle), t.fillRect(
4784
+ t.save(), t.fillStyle = C, t.translate(x.renderLeft, x.renderTop), t.rotate(x.angle), t.fillRect(
4729
4785
  -x.kernedWidth / 2,
4730
4786
  g * _ + R - m * N,
4731
4787
  x.kernedWidth,
4732
4788
  N
4733
4789
  ), t.restore();
4734
- } else if ((j !== w || O !== I || _ !== W || k !== S || R !== E) && A > 0) {
4735
- const N = s * S / 1e3;
4736
- let K = d + T + M;
4737
- n === "rtl" && (K = a - K - A), w && I && S && (t.fillStyle = I, t.fillRect(
4790
+ } else if ((I !== w || O !== C || _ !== W || k !== A || R !== E) && M > 0) {
4791
+ const N = s * A / 1e3;
4792
+ let K = d + T + S;
4793
+ n === "rtl" && (K = a - K - M), w && C && A && (t.fillStyle = C, t.fillRect(
4738
4794
  K,
4739
4795
  D + g * W + E - m * N,
4740
- A,
4796
+ M,
4741
4797
  N
4742
- )), M = x.left, A = x.width, w = j, S = k, I = O, W = _, E = R;
4798
+ )), S = x.left, M = x.width, w = I, A = k, C = O, W = _, E = R;
4743
4799
  } else
4744
- A += x.kernedWidth;
4800
+ M += x.kernedWidth;
4745
4801
  }
4746
- let L = d + T + M;
4747
- n === "rtl" && (L = a - L - A), t.fillStyle = O;
4748
- const P = s * k / 1e3;
4749
- j && O && k && t.fillRect(
4802
+ let L = d + T + S;
4803
+ n === "rtl" && (L = a - L - M), t.fillStyle = O;
4804
+ const z = s * k / 1e3;
4805
+ I && O && k && t.fillRect(
4750
4806
  L,
4751
- D + g * W + E - m * P,
4752
- A - f,
4753
- P
4807
+ D + g * W + E - m * z,
4808
+ M - f,
4809
+ z
4754
4810
  ), l += v;
4755
4811
  }
4756
4812
  this._removeShadow(t);
@@ -4779,10 +4835,10 @@ const ws = ({ textbox: h }) => {
4779
4835
  var i, a, r, c;
4780
4836
  const n = t / 2, s = e / 2, o = Math.min(n, s);
4781
4837
  return {
4782
- bottomLeft: bt({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
4783
- bottomRight: bt({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
4784
- topLeft: bt({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
4785
- topRight: bt({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
4838
+ bottomLeft: Mt({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
4839
+ bottomRight: Mt({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
4840
+ topLeft: Mt({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
4841
+ topRight: Mt({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
4786
4842
  };
4787
4843
  }
4788
4844
  _getPadding() {
@@ -4798,7 +4854,7 @@ const ws = ({ textbox: h }) => {
4798
4854
  var s;
4799
4855
  const t = this.backgroundColor;
4800
4856
  if (!t) return null;
4801
- const e = bt({ value: (s = this.backgroundOpacity) != null ? s : 1, min: 0, max: 1 });
4857
+ const e = Mt({ value: (s = this.backgroundOpacity) != null ? s : 1, min: 0, max: 1 });
4802
4858
  let n;
4803
4859
  try {
4804
4860
  n = new xn(t);
@@ -4826,7 +4882,7 @@ const ws = ({ textbox: h }) => {
4826
4882
  topRight: l,
4827
4883
  bottomRight: d,
4828
4884
  bottomLeft: u
4829
- } = s, f = bt({ value: c, min: 0, max: i }), g = bt({ value: l, min: 0, max: i }), m = bt({ value: d, min: 0, max: i }), p = bt({ value: u, min: 0, max: i });
4885
+ } = s, f = Mt({ value: c, min: 0, max: i }), g = Mt({ value: l, min: 0, max: i }), m = Mt({ value: d, min: 0, max: i }), p = Mt({ value: u, min: 0, max: i });
4830
4886
  t.beginPath(), t.moveTo(n + f, o), t.lineTo(a - g, o), t.quadraticCurveTo(a, o, a, o + g), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(n + p, r), t.quadraticCurveTo(n, r, n, r - p), t.lineTo(n, o + f), t.quadraticCurveTo(n, o, n + f, o), t.closePath();
4831
4887
  }
4832
4888
  /**
@@ -5181,10 +5237,10 @@ class rt {
5181
5237
  s.set({ width: m });
5182
5238
  const { width: p = 0 } = s, y = g - p;
5183
5239
  if (y !== 0 && o && o.corner === "ml") {
5184
- const C = ((l = s.angle) != null ? l : 0) * Math.PI / 180, b = Math.cos(C), T = Math.sin(C), M = (d = s.scaleX) != null ? d : 1, A = y * M;
5240
+ const j = ((l = s.angle) != null ? l : 0) * Math.PI / 180, b = Math.cos(j), T = Math.sin(j), S = (d = s.scaleX) != null ? d : 1, M = y * S;
5185
5241
  s.set({
5186
- left: ((u = s.left) != null ? u : 0) + A * b,
5187
- top: ((f = s.top) != null ? f : 0) + A * T
5242
+ left: ((u = s.left) != null ? u : 0) + M * b,
5243
+ top: ((f = s.top) != null ? f : 0) + M * T
5188
5244
  });
5189
5245
  }
5190
5246
  }
@@ -5195,7 +5251,7 @@ class rt {
5195
5251
  event: i != null ? i : null
5196
5252
  });
5197
5253
  }, this._handleObjectScaling = (n) => {
5198
- var ne, ve, se, ie, oe, Bt, be, ae, Gt, Vt, Xt, Kt, qt;
5254
+ var ne, ve, se, ie, oe, Rt, be, ae, Ht, Zt, Gt, Vt, Xt;
5199
5255
  const { target: s, transform: o } = n;
5200
5256
  if (s instanceof X || !rt._isTextbox(s) || !o) return;
5201
5257
  s.isScaling = !0;
@@ -5207,57 +5263,57 @@ class rt {
5207
5263
  baseRadii: d,
5208
5264
  baseStyles: u,
5209
5265
  baseLineFontDefaults: f
5210
- } = i, g = typeof ((ne = o.original) == null ? void 0 : ne.width) == "number" ? o.original.width : void 0, m = typeof ((ve = o.original) == null ? void 0 : ve.left) == "number" ? o.original.left : void 0, p = g != null ? g : a, y = m != null ? m : r, v = (se = o.corner) != null ? se : "", C = (ie = o.action) != null ? ie : "", b = ["ml", "mr"].includes(v) || C === "scaleX", T = ["mt", "mb"].includes(v) || C === "scaleY", M = ["tl", "tr", "bl", "br"].includes(v) || C === "scale", A = M || T;
5211
- if (!b && !T && !M) return;
5212
- const w = Math.abs((Bt = (oe = s.scaleX) != null ? oe : o.scaleX) != null ? Bt : 1) || 1, I = Math.abs((ae = (be = s.scaleY) != null ? be : o.scaleY) != null ? ae : 1) || 1, S = Math.max(1, p * w), j = Math.max(1, Math.round(S)), O = Math.max(1, c * I), {
5266
+ } = i, g = typeof ((ne = o.original) == null ? void 0 : ne.width) == "number" ? o.original.width : void 0, m = typeof ((ve = o.original) == null ? void 0 : ve.left) == "number" ? o.original.left : void 0, p = g != null ? g : a, y = m != null ? m : r, v = (se = o.corner) != null ? se : "", j = (ie = o.action) != null ? ie : "", b = ["ml", "mr"].includes(v) || j === "scaleX", T = ["mt", "mb"].includes(v) || j === "scaleY", S = ["tl", "tr", "bl", "br"].includes(v) || j === "scale", M = S || T;
5267
+ if (!b && !T && !S) return;
5268
+ const w = Math.abs((Rt = (oe = s.scaleX) != null ? oe : o.scaleX) != null ? Rt : 1) || 1, C = Math.abs((ae = (be = s.scaleY) != null ? be : o.scaleY) != null ? ae : 1) || 1, A = Math.max(1, p * w), I = Math.max(1, Math.round(A)), O = Math.max(1, c * C), {
5213
5269
  paddingTop: k = 0,
5214
5270
  paddingRight: D = 0,
5215
5271
  paddingBottom: W = 0,
5216
5272
  paddingLeft: E = 0,
5217
5273
  radiusTopLeft: L = 0,
5218
- radiusTopRight: P = 0,
5274
+ radiusTopRight: z = 0,
5219
5275
  radiusBottomRight: B = 0,
5220
- radiusBottomLeft: z = 0,
5276
+ radiusBottomLeft: P = 0,
5221
5277
  fontSize: x,
5222
5278
  width: _,
5223
5279
  originX: R = "left"
5224
- } = s, N = M || T, K = M || T, H = N ? {
5225
- top: Math.max(0, l.top * I),
5226
- right: Math.max(0, l.right * I),
5227
- bottom: Math.max(0, l.bottom * I),
5228
- left: Math.max(0, l.left * I)
5280
+ } = s, N = S || T, K = S || T, H = N ? {
5281
+ top: Math.max(0, l.top * C),
5282
+ right: Math.max(0, l.right * C),
5283
+ bottom: Math.max(0, l.bottom * C),
5284
+ left: Math.max(0, l.left * C)
5229
5285
  } : l, q = K ? {
5230
- topLeft: Math.max(0, d.topLeft * I),
5231
- topRight: Math.max(0, d.topRight * I),
5232
- bottomRight: Math.max(0, d.bottomRight * I),
5233
- bottomLeft: Math.max(0, d.bottomLeft * I)
5286
+ topLeft: Math.max(0, d.topLeft * C),
5287
+ topRight: Math.max(0, d.topRight * C),
5288
+ bottomRight: Math.max(0, d.bottomRight * C),
5289
+ bottomLeft: Math.max(0, d.bottomLeft * C)
5234
5290
  } : d, tt = Object.keys(u).length > 0;
5235
5291
  let at;
5236
- if (A && tt) {
5237
- const Nt = {};
5292
+ if (M && tt) {
5293
+ const kt = {};
5238
5294
  Object.entries(u).forEach(([re, Q]) => {
5239
5295
  if (!Q) return;
5240
5296
  const st = {};
5241
- Object.entries(Q).forEach(([Me, Pt]) => {
5242
- if (!Pt) return;
5243
- const He = F({}, Pt);
5244
- typeof Pt.fontSize == "number" && (He.fontSize = Math.max(1, Pt.fontSize * I)), st[Me] = He;
5245
- }), Object.keys(st).length && (Nt[re] = st);
5246
- }), Object.keys(Nt).length && (at = Nt);
5297
+ Object.entries(Q).forEach(([Me, Bt]) => {
5298
+ if (!Bt) return;
5299
+ const He = F({}, Bt);
5300
+ typeof Bt.fontSize == "number" && (He.fontSize = Math.max(1, Bt.fontSize * C)), st[Me] = He;
5301
+ }), Object.keys(st).length && (kt[re] = st);
5302
+ }), Object.keys(kt).length && (at = kt);
5247
5303
  }
5248
5304
  let ft;
5249
- A && (ft = hn({
5305
+ M && (ft = hn({
5250
5306
  lineFontDefaults: f,
5251
- scale: I
5307
+ scale: C
5252
5308
  }));
5253
- const wt = (Vt = (Gt = o.originX) != null ? Gt : R) != null ? Vt : "left", dt = y + p, ht = y + p / 2, It = _ != null ? _ : p, At = j !== It, xt = Math.abs(O - (x != null ? x : c)) > it, Rt = Math.abs(H.top - k) > it || Math.abs(H.right - D) > it || Math.abs(H.bottom - W) > it || Math.abs(H.left - E) > it, kt = Math.abs(q.topLeft - L) > it || Math.abs(q.topRight - P) > it || Math.abs(q.bottomRight - B) > it || Math.abs(q.bottomLeft - z) > it;
5254
- if (!At && !xt && !Rt && !kt) {
5309
+ const wt = (Zt = (Ht = o.originX) != null ? Ht : R) != null ? Zt : "left", dt = y + p, ht = y + p / 2, It = _ != null ? _ : p, At = I !== It, Lt = Math.abs(O - (x != null ? x : c)) > it, _t = Math.abs(H.top - k) > it || Math.abs(H.right - D) > it || Math.abs(H.bottom - W) > it || Math.abs(H.left - E) > it, xt = Math.abs(q.topLeft - L) > it || Math.abs(q.topRight - z) > it || Math.abs(q.bottomRight - B) > it || Math.abs(q.bottomLeft - P) > it;
5310
+ if (!At && !Lt && !_t && !xt) {
5255
5311
  s.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
5256
5312
  return;
5257
5313
  }
5258
5314
  at && (s.styles = at), ft && (s.lineFontDefaults = ft), s.set({
5259
- width: j,
5260
- fontSize: A ? O : c,
5315
+ width: I,
5316
+ fontSize: M ? O : c,
5261
5317
  paddingTop: H.top,
5262
5318
  paddingRight: H.right,
5263
5319
  paddingBottom: H.bottom,
@@ -5269,13 +5325,13 @@ class rt {
5269
5325
  scaleX: 1,
5270
5326
  scaleY: 1
5271
5327
  });
5272
- const Zt = Et({ textbox: s });
5273
- Zt && (s.dirty = !0);
5274
- const gt = (Xt = s.width) != null ? Xt : j, ee = gt !== It;
5328
+ const Yt = Et({ textbox: s });
5329
+ Yt && (s.dirty = !0);
5330
+ const gt = (Gt = s.width) != null ? Gt : I, ee = gt !== It;
5275
5331
  let Tt = y;
5276
- ee && (b || M) && (wt === "right" ? Tt = dt - gt : wt === "center" && (Tt = ht - gt / 2)), s.set({ left: Tt }), i.baseLeft = Tt, o.scaleX = 1, o.scaleY = 1;
5277
- const { original: vt } = o;
5278
- vt && (vt.scaleX = 1, vt.scaleY = 1, vt.width = gt, vt.height = s.height, vt.left = Tt), s.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = gt, i.baseFontSize = (Kt = s.fontSize) != null ? Kt : O, i.baseStyles = JSON.parse(JSON.stringify((qt = s.styles) != null ? qt : {})), i.baseLineFontDefaults = dn({
5332
+ ee && (b || S) && (wt === "right" ? Tt = dt - gt : wt === "center" && (Tt = ht - gt / 2)), s.set({ left: Tt }), i.baseLeft = Tt, o.scaleX = 1, o.scaleY = 1;
5333
+ const { original: bt } = o;
5334
+ bt && (bt.scaleX = 1, bt.scaleY = 1, bt.width = gt, bt.height = s.height, bt.left = Tt), s.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = gt, i.baseFontSize = (Vt = s.fontSize) != null ? Vt : O, i.baseStyles = JSON.parse(JSON.stringify((Xt = s.styles) != null ? Xt : {})), i.baseLineFontDefaults = dn({
5279
5335
  lineFontDefaults: s.lineFontDefaults
5280
5336
  }), i.basePadding = {
5281
5337
  top: H.top,
@@ -5287,20 +5343,20 @@ class rt {
5287
5343
  topRight: q.topRight,
5288
5344
  bottomRight: q.bottomRight,
5289
5345
  bottomLeft: q.bottomLeft
5290
- }, i.hasWidthChange = ee || xt || Rt || kt || Zt;
5346
+ }, i.hasWidthChange = ee || Lt || _t || xt || Yt;
5291
5347
  }, this._handleObjectModified = (n) => {
5292
- var v, C, b;
5348
+ var v, j, b;
5293
5349
  const { target: s } = n;
5294
5350
  if (s instanceof X) {
5295
5351
  const T = s.getObjects();
5296
- if (!T.some((S) => rt._isTextbox(S))) return;
5297
- const { scaleX: A = 1, scaleY: w = 1 } = s;
5298
- if (Math.abs(A - 1) < it && Math.abs(w - 1) < it) return;
5299
- this.canvas.discardActiveObject(), T.forEach((S) => {
5300
- var j, O, k, D;
5301
- if (rt._isTextbox(S)) {
5302
- const W = (j = S.scaleX) != null ? j : 1, E = (O = S.scaleY) != null ? O : 1, L = ((k = S.fontSize) != null ? k : 16) * E, P = ((D = S.width) != null ? D : 0) * W, B = E, {
5303
- paddingTop: z = 0,
5352
+ if (!T.some((A) => rt._isTextbox(A))) return;
5353
+ const { scaleX: M = 1, scaleY: w = 1 } = s;
5354
+ if (Math.abs(M - 1) < it && Math.abs(w - 1) < it) return;
5355
+ this.canvas.discardActiveObject(), T.forEach((A) => {
5356
+ var I, O, k, D;
5357
+ if (rt._isTextbox(A)) {
5358
+ const W = (I = A.scaleX) != null ? I : 1, E = (O = A.scaleY) != null ? O : 1, L = ((k = A.fontSize) != null ? k : 16) * E, z = ((D = A.width) != null ? D : 0) * W, B = E, {
5359
+ paddingTop: P = 0,
5304
5360
  paddingRight: x = 0,
5305
5361
  paddingBottom: _ = 0,
5306
5362
  paddingLeft: R = 0,
@@ -5309,8 +5365,8 @@ class rt {
5309
5365
  radiusBottomRight: H = 0,
5310
5366
  radiusBottomLeft: q = 0,
5311
5367
  styles: tt
5312
- } = S, at = {
5313
- paddingTop: Math.max(0, z * B),
5368
+ } = A, at = {
5369
+ paddingTop: Math.max(0, P * B),
5314
5370
  paddingRight: Math.max(0, x * B),
5315
5371
  paddingBottom: Math.max(0, _ * B),
5316
5372
  paddingLeft: Math.max(0, R * B)
@@ -5327,31 +5383,31 @@ class rt {
5327
5383
  });
5328
5384
  }));
5329
5385
  const dt = hn({
5330
- lineFontDefaults: S.lineFontDefaults,
5386
+ lineFontDefaults: A.lineFontDefaults,
5331
5387
  scale: B
5332
5388
  }), ht = Ot(F(F({
5333
5389
  fontSize: L,
5334
- width: P,
5390
+ width: z,
5335
5391
  scaleX: 1,
5336
5392
  scaleY: 1
5337
5393
  }, at), ft), {
5338
5394
  styles: wt
5339
5395
  });
5340
- dt && (ht.lineFontDefaults = dt), S.set(ht), Et({ textbox: S });
5396
+ dt && (ht.lineFontDefaults = dt), A.set(ht), Et({ textbox: A });
5341
5397
  }
5342
- S.setCoords();
5398
+ A.setCoords();
5343
5399
  });
5344
- const I = new X(T, {
5400
+ const C = new X(T, {
5345
5401
  canvas: this.canvas
5346
5402
  });
5347
- this.canvas.setActiveObject(I), this.canvas.requestRenderAll();
5403
+ this.canvas.setActiveObject(C), this.canvas.requestRenderAll();
5348
5404
  return;
5349
5405
  }
5350
5406
  if (!rt._isTextbox(s)) return;
5351
5407
  s.isScaling = !1;
5352
5408
  const o = this.scalingState.get(s);
5353
5409
  if (this.scalingState.delete(s), !(o != null && o.hasWidthChange)) return;
5354
- const i = (v = s.width) != null ? v : s.calcTextWidth(), a = (b = (C = s.fontSize) != null ? C : o == null ? void 0 : o.baseFontSize) != null ? b : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
5410
+ const i = (v = s.width) != null ? v : s.calcTextWidth(), a = (b = (j = s.fontSize) != null ? j : o == null ? void 0 : o.baseFontSize) != null ? b : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
5355
5411
  paddingTop: c = 0,
5356
5412
  paddingRight: l = 0,
5357
5413
  paddingBottom: d = 0,
@@ -5382,7 +5438,7 @@ class rt {
5382
5438
  * @param options — настройки текста
5383
5439
  * @param flags — флаги поведения
5384
5440
  */
5385
- addText(D = {}, { withoutSelection: j = !1, withoutSave: O = !1, withoutAdding: k = !1 } = {}) {
5441
+ addText(D = {}, { withoutSelection: I = !1, withoutSave: O = !1, withoutAdding: k = !1 } = {}) {
5386
5442
  var W = D, {
5387
5443
  id: t = `text-${et()}`,
5388
5444
  text: e = "Новый текст",
@@ -5402,14 +5458,14 @@ class rt {
5402
5458
  backgroundColor: p,
5403
5459
  backgroundOpacity: y = 1,
5404
5460
  paddingTop: v = 0,
5405
- paddingRight: C = 0,
5461
+ paddingRight: j = 0,
5406
5462
  paddingBottom: b = 0,
5407
5463
  paddingLeft: T = 0,
5408
- radiusTopLeft: M = 0,
5409
- radiusTopRight: A = 0,
5464
+ radiusTopLeft: S = 0,
5465
+ radiusTopRight: M = 0,
5410
5466
  radiusBottomRight: w = 0,
5411
- radiusBottomLeft: I = 0
5412
- } = W, S = jt(W, [
5467
+ radiusBottomLeft: C = 0
5468
+ } = W, A = jt(W, [
5413
5469
  "id",
5414
5470
  "text",
5415
5471
  "autoExpand",
@@ -5439,12 +5495,12 @@ class rt {
5439
5495
  var K;
5440
5496
  const { historyManager: E } = this.editor, { canvas: L } = this;
5441
5497
  E.suspendHistory();
5442
- const P = s != null ? s : this._getDefaultFontFamily(), B = xe({ width: g }), z = _e({
5498
+ const z = s != null ? s : this._getDefaultFontFamily(), B = xe({ width: g }), P = _e({
5443
5499
  strokeColor: f,
5444
5500
  width: B
5445
5501
  }), x = F({
5446
5502
  id: t,
5447
- fontFamily: P,
5503
+ fontFamily: z,
5448
5504
  fontSize: o,
5449
5505
  fontWeight: i ? "bold" : "normal",
5450
5506
  fontStyle: a ? "italic" : "normal",
@@ -5453,26 +5509,26 @@ class rt {
5453
5509
  linethrough: l,
5454
5510
  textAlign: d,
5455
5511
  fill: u,
5456
- stroke: z,
5512
+ stroke: P,
5457
5513
  strokeWidth: B,
5458
5514
  strokeUniform: !0,
5459
5515
  opacity: m,
5460
5516
  backgroundColor: p,
5461
5517
  backgroundOpacity: y,
5462
5518
  paddingTop: v,
5463
- paddingRight: C,
5519
+ paddingRight: j,
5464
5520
  paddingBottom: b,
5465
5521
  paddingLeft: T,
5466
- radiusTopLeft: M,
5467
- radiusTopRight: A,
5522
+ radiusTopLeft: S,
5523
+ radiusTopRight: M,
5468
5524
  radiusBottomRight: w,
5469
- radiusBottomLeft: I
5470
- }, S), _ = new ye(e, x), R = n !== !1;
5525
+ radiusBottomLeft: C
5526
+ }, A), _ = new ye(e, x), R = n !== !1;
5471
5527
  if (_.autoExpand = R, _.textCaseRaw = (K = _.text) != null ? K : "", c) {
5472
5528
  const H = we({ value: _.textCaseRaw });
5473
5529
  H !== _.text && _.set({ text: H });
5474
5530
  }
5475
- return Et({ textbox: _ }) && (_.dirty = !0), S.left === void 0 && S.top === void 0 && L.centerObject(_), k || L.add(_), j || L.setActiveObject(_), L.requestRenderAll(), E.resumeHistory(), O || E.saveState(), L.fire("editor:text-added", {
5531
+ return Et({ textbox: _ }) && (_.dirty = !0), A.left === void 0 && A.top === void 0 && L.centerObject(_), k || L.add(_), I || L.setActiveObject(_), L.requestRenderAll(), E.resumeHistory(), O || E.saveState(), L.fire("editor:text-added", {
5476
5532
  textbox: _,
5477
5533
  options: Ot(F({}, x), {
5478
5534
  text: e,
@@ -5481,11 +5537,11 @@ class rt {
5481
5537
  strikethrough: l,
5482
5538
  align: d,
5483
5539
  color: u,
5484
- strokeColor: z,
5540
+ strokeColor: P,
5485
5541
  strokeWidth: B
5486
5542
  }),
5487
5543
  flags: {
5488
- withoutSelection: !!j,
5544
+ withoutSelection: !!I,
5489
5545
  withoutSave: !!O,
5490
5546
  withoutAdding: !!k
5491
5547
  }
@@ -5507,41 +5563,41 @@ class rt {
5507
5563
  skipRender: s,
5508
5564
  selectionRange: o
5509
5565
  } = {}) {
5510
- var Gt, Xt, Kt, qt, Nt, re;
5566
+ var Ht, Gt, Vt, Xt, kt, re;
5511
5567
  const i = this._resolveTextObject(t);
5512
5568
  if (!i) return null;
5513
5569
  const { text: a = "" } = i, { historyManager: r } = this.editor, { canvas: c } = this;
5514
5570
  r.suspendHistory();
5515
- const l = rt._getSnapshot(i), d = (Gt = i.originY) != null ? Gt : "top", u = i.getPointByOrigin("center", d), f = {
5571
+ const l = rt._getSnapshot(i), d = (Ht = i.originY) != null ? Ht : "top", u = i.getPointByOrigin("center", d), f = {
5516
5572
  originY: d,
5517
5573
  x: u.x,
5518
5574
  y: u.y
5519
- }, Vt = e, {
5575
+ }, Zt = e, {
5520
5576
  text: g,
5521
5577
  autoExpand: m,
5522
5578
  fontFamily: p,
5523
5579
  fontSize: y,
5524
5580
  bold: v,
5525
- italic: C,
5581
+ italic: j,
5526
5582
  underline: b,
5527
5583
  uppercase: T,
5528
- strikethrough: M,
5529
- align: A,
5584
+ strikethrough: S,
5585
+ align: M,
5530
5586
  color: w,
5531
- strokeColor: I,
5532
- strokeWidth: S,
5533
- opacity: j,
5587
+ strokeColor: C,
5588
+ strokeWidth: A,
5589
+ opacity: I,
5534
5590
  backgroundColor: O,
5535
5591
  backgroundOpacity: k,
5536
5592
  paddingTop: D,
5537
5593
  paddingRight: W,
5538
5594
  paddingBottom: E,
5539
5595
  paddingLeft: L,
5540
- radiusTopLeft: P,
5596
+ radiusTopLeft: z,
5541
5597
  radiusTopRight: B,
5542
- radiusBottomRight: z,
5598
+ radiusBottomRight: P,
5543
5599
  radiusBottomLeft: x
5544
- } = Vt, _ = jt(Vt, [
5600
+ } = Zt, _ = jt(Zt, [
5545
5601
  "text",
5546
5602
  "autoExpand",
5547
5603
  "fontFamily",
@@ -5576,26 +5632,26 @@ class rt {
5576
5632
  const Q = v ? "bold" : "normal";
5577
5633
  N && (H.fontWeight = Q), dt && (R.fontWeight = Q, ht && (tt.fontWeight = Q));
5578
5634
  }
5579
- if (C !== void 0) {
5580
- const Q = C ? "italic" : "normal";
5635
+ if (j !== void 0) {
5636
+ const Q = j ? "italic" : "normal";
5581
5637
  N && (H.fontStyle = Q), dt && (R.fontStyle = Q, ht && (tt.fontStyle = Q));
5582
5638
  }
5583
- if (b !== void 0 && (N && (H.underline = b), dt && (R.underline = b, ht && (tt.underline = b))), M !== void 0 && (N && (H.linethrough = M), dt && (R.linethrough = M, ht && (tt.linethrough = M))), A !== void 0 && (R.textAlign = A), w !== void 0 && (N && (H.fill = w), dt && (R.fill = w, ht && (tt.fill = w))), I !== void 0 || S !== void 0) {
5584
- const Q = N ? cn({ textbox: i, range: N, property: "strokeWidth" }) : void 0, st = N ? cn({ textbox: i, range: N, property: "stroke" }) : void 0, Me = (Kt = (Xt = S != null ? S : Q) != null ? Xt : i.strokeWidth) != null ? Kt : 0;
5639
+ if (b !== void 0 && (N && (H.underline = b), dt && (R.underline = b, ht && (tt.underline = b))), S !== void 0 && (N && (H.linethrough = S), dt && (R.linethrough = S, ht && (tt.linethrough = S))), M !== void 0 && (R.textAlign = M), w !== void 0 && (N && (H.fill = w), dt && (R.fill = w, ht && (tt.fill = w))), C !== void 0 || A !== void 0) {
5640
+ const Q = N ? cn({ textbox: i, range: N, property: "strokeWidth" }) : void 0, st = N ? cn({ textbox: i, range: N, property: "stroke" }) : void 0, Me = (Vt = (Gt = A != null ? A : Q) != null ? Gt : i.strokeWidth) != null ? Vt : 0;
5585
5641
  ft = xe({ width: Me });
5586
- const Pt = (Nt = (qt = I != null ? I : st) != null ? qt : i.stroke) != null ? Nt : void 0;
5642
+ const Bt = (kt = (Xt = C != null ? C : st) != null ? Xt : i.stroke) != null ? kt : void 0;
5587
5643
  at = _e({
5588
- strokeColor: Pt,
5644
+ strokeColor: Bt,
5589
5645
  width: ft
5590
5646
  }), N && (H.stroke = at, H.strokeWidth = ft), dt && (R.stroke = at, R.strokeWidth = ft, ht && (tt.stroke = at, tt.strokeWidth = ft));
5591
5647
  }
5592
- j !== void 0 && (R.opacity = j), O !== void 0 && (R.backgroundColor = O), k !== void 0 && (R.backgroundOpacity = k), D !== void 0 && (R.paddingTop = D), W !== void 0 && (R.paddingRight = W), E !== void 0 && (R.paddingBottom = E), L !== void 0 && (R.paddingLeft = L), P !== void 0 && (R.radiusTopLeft = P), B !== void 0 && (R.radiusTopRight = B), z !== void 0 && (R.radiusBottomRight = z), x !== void 0 && (R.radiusBottomLeft = x);
5593
- const It = (re = i.textCaseRaw) != null ? re : a, At = !!i.uppercase, xt = g !== void 0, Rt = xt ? g != null ? g : "" : It, kt = T != null ? T : At, Zt = kt !== At;
5594
- if (xt || Zt) {
5595
- const Q = kt ? we({ value: Rt }) : Rt;
5596
- R.text = Q, i.textCaseRaw = Rt;
5648
+ I !== void 0 && (R.opacity = I), O !== void 0 && (R.backgroundColor = O), k !== void 0 && (R.backgroundOpacity = k), D !== void 0 && (R.paddingTop = D), W !== void 0 && (R.paddingRight = W), E !== void 0 && (R.paddingBottom = E), L !== void 0 && (R.paddingLeft = L), z !== void 0 && (R.radiusTopLeft = z), B !== void 0 && (R.radiusTopRight = B), P !== void 0 && (R.radiusBottomRight = P), x !== void 0 && (R.radiusBottomLeft = x);
5649
+ const It = (re = i.textCaseRaw) != null ? re : a, At = !!i.uppercase, Lt = g !== void 0, _t = Lt ? g != null ? g : "" : It, xt = T != null ? T : At, Yt = xt !== At;
5650
+ if (Lt || Yt) {
5651
+ const Q = xt ? we({ value: _t }) : _t;
5652
+ R.text = Q, i.textCaseRaw = _t;
5597
5653
  } else i.textCaseRaw === void 0 && (i.textCaseRaw = It);
5598
- i.uppercase = kt, i.set(R);
5654
+ i.uppercase = xt, i.set(R);
5599
5655
  let gt = !1;
5600
5656
  if (N) {
5601
5657
  const Q = Se({ textbox: i, styles: H, range: N }), st = K ? Se({ textbox: i, styles: q, range: K }) : !1;
@@ -5622,18 +5678,18 @@ class rt {
5622
5678
  updates: st
5623
5679
  });
5624
5680
  }
5625
- if (N && (w !== void 0 || I !== void 0 || S !== void 0)) {
5681
+ if (N && (w !== void 0 || C !== void 0 || A !== void 0)) {
5626
5682
  const Q = Ls({
5627
5683
  textbox: i,
5628
5684
  range: N
5629
5685
  }), st = {};
5630
- w !== void 0 && (st.fill = w), (I !== void 0 || S !== void 0) && (at === null && (st.stroke = null), at != null && (st.stroke = at)), ln({
5686
+ w !== void 0 && (st.fill = w), (C !== void 0 || A !== void 0) && (at === null && (st.stroke = null), at != null && (st.stroke = at)), ln({
5631
5687
  textbox: i,
5632
5688
  lineIndices: Q,
5633
5689
  updates: st
5634
5690
  });
5635
5691
  }
5636
- ee && (i.initDimensions(), i.dirty = !0), (O !== void 0 || k !== void 0 || D !== void 0 || W !== void 0 || E !== void 0 || L !== void 0 || P !== void 0 || B !== void 0 || z !== void 0 || x !== void 0) && (i.dirty = !0);
5692
+ ee && (i.initDimensions(), i.dirty = !0), (O !== void 0 || k !== void 0 || D !== void 0 || W !== void 0 || E !== void 0 || L !== void 0 || z !== void 0 || B !== void 0 || P !== void 0 || x !== void 0) && (i.dirty = !0);
5637
5693
  const Tt = fn({
5638
5694
  stylesList: [
5639
5695
  R,
@@ -5641,13 +5697,13 @@ class rt {
5641
5697
  q,
5642
5698
  tt
5643
5699
  ]
5644
- }), { autoExpand: vt } = i, ne = m !== void 0, se = (m != null ? m : vt) !== !1;
5645
- ne ? i.autoExpand = m !== !1 : vt === void 0 && (i.autoExpand = !0);
5646
- const ie = Object.prototype.hasOwnProperty.call(R, "width"), oe = se && !ie && (xt || Zt || Tt);
5647
- let Bt = !1;
5648
- oe && (Bt = this._autoExpandTextboxWidth(i, {
5700
+ }), { autoExpand: bt } = i, ne = m !== void 0, se = (m != null ? m : bt) !== !1;
5701
+ ne ? i.autoExpand = m !== !1 : bt === void 0 && (i.autoExpand = !0);
5702
+ const ie = Object.prototype.hasOwnProperty.call(R, "width"), oe = se && !ie && (Lt || Yt || Tt);
5703
+ let Rt = !1;
5704
+ oe && (Rt = this._autoExpandTextboxWidth(i, {
5649
5705
  anchor: f
5650
- }), Bt && (i.dirty = !0)), (Bt ? !1 : Et({ textbox: i })) && (i.dirty = !0), i.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
5706
+ }), Rt && (i.dirty = !0)), (Rt ? !1 : Et({ textbox: i })) && (i.dirty = !0), i.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
5651
5707
  const ae = rt._getSnapshot(i);
5652
5708
  return c.fire("editor:text-updated", {
5653
5709
  textbox: i,
@@ -5669,7 +5725,7 @@ class rt {
5669
5725
  */
5670
5726
  // eslint-disable-next-line class-methods-use-this
5671
5727
  stylesFromArray(t, e) {
5672
- return yt.stylesFromArray(t, e);
5728
+ return vt.stylesFromArray(t, e);
5673
5729
  }
5674
5730
  /**
5675
5731
  * Уничтожает менеджер и снимает слушатели.
@@ -5725,8 +5781,8 @@ class rt {
5725
5781
  } = t, d = e, u = (k = t.__lineDefaultsPrevText) != null ? k : d, f = u.split(`
5726
5782
  `), g = d.split(`
5727
5783
  `), m = f.length, y = g.length - m;
5728
- let v = n, C = !1, b = !1;
5729
- const T = typeof a == "string" ? a : void 0, M = typeof r == "string" ? r : void 0;
5784
+ let v = n, j = !1, b = !1;
5785
+ const T = typeof a == "string" ? a : void 0, S = typeof r == "string" ? r : void 0;
5730
5786
  if (y !== 0 && n && Object.keys(n).length) {
5731
5787
  const E = _s({
5732
5788
  previous: u,
@@ -5736,13 +5792,13 @@ class rt {
5736
5792
  charIndex: E
5737
5793
  });
5738
5794
  if (y > 0) {
5739
- const P = Rs({
5795
+ const z = Rs({
5740
5796
  text: u,
5741
5797
  lineIndex: L
5742
5798
  });
5743
5799
  let B = L + 1;
5744
- E === P && (B = L);
5745
- const z = {};
5800
+ E === z && (B = L);
5801
+ const P = {};
5746
5802
  for (const x in n) {
5747
5803
  if (!Object.prototype.hasOwnProperty.call(n, x)) continue;
5748
5804
  const _ = Number(x);
@@ -5750,16 +5806,16 @@ class rt {
5750
5806
  const R = n[_];
5751
5807
  if (!R) continue;
5752
5808
  const N = _ >= B ? _ + y : _;
5753
- z[N] = F({}, R);
5809
+ P[N] = F({}, R);
5754
5810
  }
5755
- v = z, C = !0, b = !0;
5811
+ v = P, j = !0, b = !0;
5756
5812
  }
5757
5813
  if (y < 0) {
5758
- const P = Math.abs(y);
5814
+ const z = Math.abs(y);
5759
5815
  let B = L;
5760
5816
  u[E] === `
5761
5817
  ` && ((D = f[L]) != null ? D : "").length > 0 && (B = L + 1);
5762
- const x = B + P - 1, _ = {};
5818
+ const x = B + z - 1, _ = {};
5763
5819
  for (const R in n) {
5764
5820
  if (!Object.prototype.hasOwnProperty.call(n, R)) continue;
5765
5821
  const N = Number(R);
@@ -5767,36 +5823,36 @@ class rt {
5767
5823
  const K = n[N];
5768
5824
  K && (N < B && (_[N] = F({}, K)), N > x && (_[N + y] = F({}, K)));
5769
5825
  }
5770
- v = _, C = !0, b = !0;
5826
+ v = _, j = !0, b = !0;
5771
5827
  }
5772
5828
  }
5773
- let A = null;
5829
+ let M = null;
5774
5830
  if (l && typeof c == "number") {
5775
5831
  const E = t.get2DCursorLocation(c), { lineIndex: L } = E;
5776
- Number.isFinite(L) && (A = L);
5832
+ Number.isFinite(L) && (M = L);
5777
5833
  }
5778
- let w = s, I = !1, S = !1, j, O = null;
5834
+ let w = s, C = !1, A = !1, I, O = null;
5779
5835
  for (let E = 0; E < g.length; E += 1) {
5780
- const L = (W = g[E]) != null ? W : "", P = v ? v[E] : void 0;
5781
- if (P && (j = P), L.length !== 0) {
5782
- if (P) {
5836
+ const L = (W = g[E]) != null ? W : "", z = v ? v[E] : void 0;
5837
+ if (z && (I = z), L.length !== 0) {
5838
+ if (z) {
5783
5839
  const N = Is({
5784
5840
  lineText: L,
5785
5841
  lineStyles: w ? w[E] : void 0,
5786
- lineDefaults: P
5842
+ lineDefaults: z
5787
5843
  });
5788
- N.changed && (w || (w = {}, S = !0), S || (w = F({}, w), S = !0), N.lineStyles && (w[E] = N.lineStyles), !N.lineStyles && w[E] && delete w[E], I = !0);
5844
+ N.changed && (w || (w = {}, A = !0), A || (w = F({}, w), A = !0), N.lineStyles && (w[E] = N.lineStyles), !N.lineStyles && w[E] && delete w[E], C = !0);
5789
5845
  }
5790
5846
  continue;
5791
5847
  }
5792
- const z = P != null ? P : j, x = {};
5793
- (z == null ? void 0 : z.fontFamily) !== void 0 ? x.fontFamily = z.fontFamily : o !== void 0 && (x.fontFamily = o), (z == null ? void 0 : z.fontSize) !== void 0 ? x.fontSize = z.fontSize : i !== void 0 && (x.fontSize = i), (z == null ? void 0 : z.fill) !== void 0 ? x.fill = z.fill : T !== void 0 && (x.fill = T), (z == null ? void 0 : z.stroke) !== void 0 ? x.stroke = z.stroke : M !== void 0 && (x.stroke = M), !P && Object.keys(x).length && (v || (v = {}, b = !0), b || (v = F({}, v), b = !0), v[E] = x, C = !0, j = x), P && (j = P), A !== null && A === E && (O = x);
5848
+ const P = z != null ? z : I, x = {};
5849
+ (P == null ? void 0 : P.fontFamily) !== void 0 ? x.fontFamily = P.fontFamily : o !== void 0 && (x.fontFamily = o), (P == null ? void 0 : P.fontSize) !== void 0 ? x.fontSize = P.fontSize : i !== void 0 && (x.fontSize = i), (P == null ? void 0 : P.fill) !== void 0 ? x.fill = P.fill : T !== void 0 && (x.fill = T), (P == null ? void 0 : P.stroke) !== void 0 ? x.stroke = P.stroke : S !== void 0 && (x.stroke = S), !z && Object.keys(x).length && (v || (v = {}, b = !0), b || (v = F({}, v), b = !0), v[E] = x, j = !0, I = x), z && (I = z), M !== null && M === E && (O = x);
5794
5850
  const _ = {};
5795
5851
  x.fontFamily !== void 0 && (_.fontFamily = x.fontFamily), x.fontSize !== void 0 && (_.fontSize = x.fontSize), x.fill !== void 0 && (_.fill = x.fill), x.stroke !== void 0 && (_.stroke = x.stroke);
5796
5852
  const R = Object.keys(_).length > 0;
5797
- (R || w && w[E]) && (w || (w = {}, S = !0), S || (w = F({}, w), S = !0), R && (w[E] = { 0: _ }), !R && w[E] && delete w[E], I = !0);
5853
+ (R || w && w[E]) && (w || (w = {}, A = !0), A || (w = F({}, w), A = !0), R && (w[E] = { 0: _ }), !R && w[E] && delete w[E], C = !0);
5798
5854
  }
5799
- if (C && v && (t.lineFontDefaults = v), I && (t.styles = w, t.dirty = !0), O && typeof c == "number") {
5855
+ if (j && v && (t.lineFontDefaults = v), C && (t.styles = w, t.dirty = !0), O && typeof c == "number") {
5800
5856
  const E = {};
5801
5857
  if (O.fontFamily !== void 0 && (E.fontFamily = O.fontFamily), O.fontSize !== void 0 && (E.fontSize = O.fontSize), O.fill !== void 0 && (E.fill = O.fill), O.stroke !== void 0 && (E.stroke = O.stroke), Object.keys(E).length) {
5802
5858
  this.lineDefaultsSyncing.add(t);
@@ -5814,15 +5870,15 @@ class rt {
5814
5870
  * но не шире монтажной области, и удерживает объект в её пределах.
5815
5871
  */
5816
5872
  _autoExpandTextboxWidth(t, { anchor: e } = {}) {
5817
- var A, w, I, S, j, O, k, D, W, E, L, P, B;
5873
+ var M, w, C, A, I, O, k, D, W, E, L, z, B;
5818
5874
  const { montageArea: n } = this.editor;
5819
5875
  if (!n) return !1;
5820
5876
  const s = typeof t.text == "string" ? t.text : "";
5821
5877
  if (!s.length) return !1;
5822
5878
  n.setCoords();
5823
- const o = n.getBoundingRect(!1, !0), i = (A = o.width) != null ? A : 0;
5879
+ const o = n.getBoundingRect(!1, !0), i = (M = o.width) != null ? M : 0;
5824
5880
  if (!Number.isFinite(i) || i <= 0) return !1;
5825
- const a = e != null ? e : (w = this.editingAnchorState) == null ? void 0 : w.get(t), r = (S = (I = a == null ? void 0 : a.originY) != null ? I : t.originY) != null ? S : "top", c = Math.abs((j = t.scaleX) != null ? j : 1) || 1, l = (O = t.paddingLeft) != null ? O : 0, d = (k = t.paddingRight) != null ? k : 0, u = (D = t.strokeWidth) != null ? D : 0, f = Math.max(
5881
+ const a = e != null ? e : (w = this.editingAnchorState) == null ? void 0 : w.get(t), r = (A = (C = a == null ? void 0 : a.originY) != null ? C : t.originY) != null ? A : "top", c = Math.abs((I = t.scaleX) != null ? I : 1) || 1, l = (O = t.paddingLeft) != null ? O : 0, d = (k = t.paddingRight) != null ? k : 0, u = (D = t.strokeWidth) != null ? D : 0, f = Math.max(
5826
5882
  1,
5827
5883
  i / c - l - d - u
5828
5884
  );
@@ -5833,18 +5889,18 @@ class rt {
5833
5889
  Math.abs(((W = t.width) != null ? W : 0) - f) > it && (t.set({ width: f }), m = !0), t.initDimensions();
5834
5890
  const { textLines: p } = t, y = Array.isArray(p) && p.length > g, v = Math.ceil(
5835
5891
  ks({ textbox: t, text: s })
5836
- ), C = Math.min((E = t.minWidth) != null ? E : 1, f);
5892
+ ), j = Math.min((E = t.minWidth) != null ? E : 1, f);
5837
5893
  let b = Math.min(
5838
5894
  f,
5839
- Math.max(v, C)
5895
+ Math.max(v, j)
5840
5896
  );
5841
5897
  y && (b = f), Math.abs(((L = t.width) != null ? L : 0) - b) > it && (t.set({ width: b }), t.initDimensions(), m = !0), Et({ textbox: t }) && (m = !0), a && (t.setPositionByOrigin(new lt(a.x, a.y), "center", r), m = !0);
5842
- const M = Bs({
5898
+ const S = Bs({
5843
5899
  textbox: t,
5844
- montageLeft: (P = o.left) != null ? P : 0,
5900
+ montageLeft: (z = o.left) != null ? z : 0,
5845
5901
  montageRight: ((B = o.left) != null ? B : 0) + i
5846
5902
  });
5847
- return m || M;
5903
+ return m || S;
5848
5904
  }
5849
5905
  /**
5850
5906
  * Возвращает хранилище якорей редактирования, создавая его при необходимости.
@@ -5921,30 +5977,30 @@ class rt {
5921
5977
  stroke: p,
5922
5978
  strokeWidth: y,
5923
5979
  opacity: v,
5924
- backgroundColor: C,
5980
+ backgroundColor: j,
5925
5981
  backgroundOpacity: b,
5926
5982
  paddingTop: T,
5927
- paddingRight: M,
5928
- paddingBottom: A,
5983
+ paddingRight: S,
5984
+ paddingBottom: M,
5929
5985
  paddingLeft: w,
5930
- radiusTopLeft: I,
5931
- radiusTopRight: S,
5932
- radiusBottomRight: j,
5986
+ radiusTopLeft: C,
5987
+ radiusTopRight: A,
5988
+ radiusBottomRight: I,
5933
5989
  radiusBottomLeft: O,
5934
5990
  left: k,
5935
5991
  top: D,
5936
5992
  width: W,
5937
5993
  height: E,
5938
5994
  angle: L,
5939
- scaleX: P,
5995
+ scaleX: z,
5940
5996
  scaleY: B
5941
- } = t, z = {
5997
+ } = t, P = {
5942
5998
  id: n,
5943
5999
  uppercase: !!i,
5944
6000
  textAlign: g
5945
6001
  };
5946
6002
  return e({
5947
- snapshot: z,
6003
+ snapshot: P,
5948
6004
  entries: {
5949
6005
  text: s,
5950
6006
  textCaseRaw: o,
@@ -5959,25 +6015,25 @@ class rt {
5959
6015
  stroke: p,
5960
6016
  strokeWidth: y,
5961
6017
  opacity: v,
5962
- backgroundColor: C,
6018
+ backgroundColor: j,
5963
6019
  backgroundOpacity: b,
5964
6020
  paddingTop: T,
5965
- paddingRight: M,
5966
- paddingBottom: A,
6021
+ paddingRight: S,
6022
+ paddingBottom: M,
5967
6023
  paddingLeft: w,
5968
- radiusTopLeft: I,
5969
- radiusTopRight: S,
5970
- radiusBottomRight: j,
6024
+ radiusTopLeft: C,
6025
+ radiusTopRight: A,
6026
+ radiusBottomRight: I,
5971
6027
  radiusBottomLeft: O,
5972
6028
  left: k,
5973
6029
  top: D,
5974
6030
  width: W,
5975
6031
  height: E,
5976
6032
  angle: L,
5977
- scaleX: P,
6033
+ scaleX: z,
5978
6034
  scaleY: B
5979
6035
  }
5980
- }), z;
6036
+ }), P;
5981
6037
  }
5982
6038
  /**
5983
6039
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -6033,7 +6089,7 @@ const he = ({
6033
6089
  x: d + f / 2,
6034
6090
  y: u + g / 2
6035
6091
  };
6036
- }, Ps = ({
6092
+ }, zs = ({
6037
6093
  normalizedX: h,
6038
6094
  normalizedY: t,
6039
6095
  bounds: e,
@@ -6047,7 +6103,7 @@ const he = ({
6047
6103
  }
6048
6104
  const c = o + h * a, l = i + t * r;
6049
6105
  return new lt(c, l);
6050
- }, zs = ({
6106
+ }, Ps = ({
6051
6107
  object: h,
6052
6108
  montageArea: t,
6053
6109
  bounds: e
@@ -6062,7 +6118,7 @@ const he = ({
6062
6118
  } catch (n) {
6063
6119
  return null;
6064
6120
  }
6065
- }, pt = ({
6121
+ }, mt = ({
6066
6122
  object: h
6067
6123
  }) => {
6068
6124
  if (!h) return null;
@@ -6126,7 +6182,7 @@ const he = ({
6126
6182
  };
6127
6183
  }
6128
6184
  return null;
6129
- }, $t = "_templateCenterX", Ae = "_templateCenterY", fe = "_templateAnchorX", je = "_templateAnchorY";
6185
+ }, Jt = "_templateCenterX", Ae = "_templateCenterY", fe = "_templateAnchorX", je = "_templateAnchorY";
6130
6186
  class Z {
6131
6187
  constructor({ editor: t }) {
6132
6188
  this.editor = t;
@@ -6160,7 +6216,7 @@ class Z {
6160
6216
  baseWidth: p,
6161
6217
  baseHeight: y,
6162
6218
  montageArea: i != null ? i : null
6163
- })), C = Ot(F({}, n), {
6219
+ })), j = Ot(F({}, n), {
6164
6220
  baseWidth: p,
6165
6221
  baseHeight: y,
6166
6222
  positionsNormalized: !0,
@@ -6168,7 +6224,7 @@ class Z {
6168
6224
  });
6169
6225
  return {
6170
6226
  id: t != null ? t : `template-${et()}`,
6171
- meta: C,
6227
+ meta: j,
6172
6228
  objects: v
6173
6229
  };
6174
6230
  }
@@ -6215,17 +6271,17 @@ class Z {
6215
6271
  code: Dt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6216
6272
  message: "Не удалось создать объекты шаблона"
6217
6273
  }), null;
6218
- const { backgroundObject: C, contentObjects: b } = Z._extractBackgroundObject(v);
6219
- C && (y = yield Z._applyBackgroundFromObject({
6220
- backgroundObject: C,
6274
+ const { backgroundObject: j, contentObjects: b } = Z._extractBackgroundObject(v);
6275
+ j && (y = yield Z._applyBackgroundFromObject({
6276
+ backgroundObject: j,
6221
6277
  backgroundManager: a,
6222
6278
  errorManager: i
6223
6279
  }));
6224
- const T = b.map((M) => (this._adaptTextboxWidth({
6225
- object: M,
6280
+ const T = b.map((S) => (this._adaptTextboxWidth({
6281
+ object: S,
6226
6282
  baseWidth: f.baseWidth
6227
6283
  }), Z._transformObject({
6228
- object: M,
6284
+ object: S,
6229
6285
  scale: g,
6230
6286
  bounds: d,
6231
6287
  targetSize: u,
@@ -6233,10 +6289,10 @@ class Z {
6233
6289
  baseHeight: f.baseHeight,
6234
6290
  montageArea: s,
6235
6291
  useRelativePositions: m
6236
- }), M.set({
6237
- id: `${M.type}-${et()}`,
6292
+ }), S.set({
6293
+ id: `${S.type}-${et()}`,
6238
6294
  evented: !0
6239
- }), n.add(M), M));
6295
+ }), n.add(S), S));
6240
6296
  return !T.length && !y ? null : (p = T.length > 0 || y, T.length && Z._activateObjects({ canvas: n, objects: T }), n.requestRenderAll(), n.fire("editor:template-applied", {
6241
6297
  template: t,
6242
6298
  objects: T,
@@ -6293,7 +6349,7 @@ class Z {
6293
6349
  if (i)
6294
6350
  return Z._restoreImageScale({ revived: i, serialized: n }), i;
6295
6351
  }
6296
- const s = yield yt.enlivenObjects([n]), o = s == null ? void 0 : s[0];
6352
+ const s = yield vt.enlivenObjects([n]), o = s == null ? void 0 : s[0];
6297
6353
  return o ? (Z._restoreImageScale({ revived: o, serialized: n }), o) : null;
6298
6354
  })))).filter((n) => !!n);
6299
6355
  });
@@ -6322,21 +6378,21 @@ class Z {
6322
6378
  naturalHeight: 0,
6323
6379
  width: 0,
6324
6380
  height: 0
6325
- }, m = nt({ value: d || f || c.width, fallback: 0 }), p = nt({ value: u || g || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), v = nt({ value: o, fallback: p }), C = nt({ value: i, fallback: c.scaleX || 1 }), b = nt({ value: a, fallback: c.scaleY || 1 }), T = y * C, M = v * b, A = m > 0, w = p > 0, I = T > 0, S = M > 0, j = Z._resolveImageFit({ customData: r }), O = {};
6326
- if (A && (O.width = m), w && (O.height = p), !A || !w) {
6381
+ }, m = nt({ value: d || f || c.width, fallback: 0 }), p = nt({ value: u || g || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), v = nt({ value: o, fallback: p }), j = nt({ value: i, fallback: c.scaleX || 1 }), b = nt({ value: a, fallback: c.scaleY || 1 }), T = y * j, S = v * b, M = m > 0, w = p > 0, C = T > 0, A = S > 0, I = Z._resolveImageFit({ customData: r }), O = {};
6382
+ if (M && (O.width = m), w && (O.height = p), !M || !w) {
6327
6383
  c.set(O);
6328
6384
  return;
6329
6385
  }
6330
- if (j === "stretch") {
6331
- const D = I ? T / m : null, W = S ? M / p : null;
6386
+ if (I === "stretch") {
6387
+ const D = C ? T / m : null, W = A ? S / p : null;
6332
6388
  D && D > 0 && (O.scaleX = D), W && W > 0 && (O.scaleY = W), c.set(O);
6333
6389
  return;
6334
6390
  }
6335
- if (!I || !S) {
6391
+ if (!C || !A) {
6336
6392
  c.set(O);
6337
6393
  return;
6338
6394
  }
6339
- const k = Math.min(T / m, M / p);
6395
+ const k = Math.min(T / m, S / p);
6340
6396
  Number.isFinite(k) && k > 0 && (O.scaleX = k, O.scaleY = k), c.set(O);
6341
6397
  }
6342
6398
  /**
@@ -6363,7 +6419,7 @@ class Z {
6363
6419
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
6364
6420
  if (!e) return null;
6365
6421
  try {
6366
- const n = yield Rn(e), s = yt.groupSVGElements(n.objects, n.options), o = yield yt.enlivenObjectEnlivables(
6422
+ const n = yield Rn(e), s = vt.groupSVGElements(n.objects, n.options), o = yield vt.enlivenObjectEnlivables(
6367
6423
  Z._prepareSerializableProps(t)
6368
6424
  );
6369
6425
  return s.set(o), s.setCoords(), s;
@@ -6428,7 +6484,7 @@ class Z {
6428
6484
  baseHeight: i,
6429
6485
  useRelativePositions: r,
6430
6486
  centerKeys: {
6431
- x: $t,
6487
+ x: Jt,
6432
6488
  y: Ae
6433
6489
  }
6434
6490
  }), { scaleX: u, scaleY: f } = t, g = nt({ value: u, fallback: 1 }), m = nt({ value: f, fallback: 1 }), p = Z._getPositioningBounds({
@@ -6439,17 +6495,17 @@ class Z {
6439
6495
  useRelativePositions: r,
6440
6496
  anchorX: Z._resolveAnchor(c, fe),
6441
6497
  anchorY: Z._resolveAnchor(c, je)
6442
- }), y = Ps({
6498
+ }), y = zs({
6443
6499
  normalizedX: l,
6444
6500
  normalizedY: d,
6445
6501
  bounds: p,
6446
6502
  targetSize: s,
6447
6503
  montageArea: a
6448
- }), v = g * e, C = m * e;
6504
+ }), v = g * e, j = m * e;
6449
6505
  t.set({
6450
6506
  scaleX: v,
6451
- scaleY: C
6452
- }), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[$t], delete c[Ae], delete c[fe], delete c[je];
6507
+ scaleY: j
6508
+ }), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[Jt], delete c[Ae], delete c[fe], delete c[je];
6453
6509
  }
6454
6510
  /**
6455
6511
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -6548,16 +6604,16 @@ class Z {
6548
6604
  } = t, r = nt({ value: e, fallback: 0 }), c = t, l = nt({ value: c.paddingLeft, fallback: 0 }), d = nt({ value: c.paddingRight, fallback: 0 }), u = nt({ value: i, fallback: 1 }), f = nt({ value: a, fallback: 0 }) * u, g = nt({ value: o, fallback: 0 }), m = g * u, p = l * u, y = d * u, v = m + p + y + f;
6549
6605
  if (!s || !g || !r) return;
6550
6606
  t.setCoords();
6551
- const C = t, b = C[$t], T = typeof b == "number" ? b : null, M = Z._resolveAnchor(C, fe), A = v / r, w = T !== null ? T - A / 2 : null, I = T !== null ? T + A / 2 : null, S = t.getCenterPoint();
6607
+ const j = t, b = j[Jt], T = typeof b == "number" ? b : null, S = Z._resolveAnchor(j, fe), M = v / r, w = T !== null ? T - M / 2 : null, C = T !== null ? T + M / 2 : null, A = t.getCenterPoint();
6552
6608
  t.set("width", s), t.initDimensions();
6553
- const j = Z._getLongestLineWidth({
6609
+ const I = Z._getLongestLineWidth({
6554
6610
  textbox: t,
6555
6611
  text: n
6556
- }), O = j > g ? j + 1 : g;
6557
- t.set("width", O), t.initDimensions(), t.setPositionByOrigin(S, "center", "center"), t.setCoords();
6612
+ }), O = I > g ? I + 1 : g;
6613
+ t.set("width", O), t.initDimensions(), t.setPositionByOrigin(A, "center", "center"), t.setCoords();
6558
6614
  const D = (O * u + p + y + f) / r;
6559
6615
  let W = T;
6560
- M === "start" && w !== null ? W = Math.max(0, w) + D / 2 : M === "end" && I !== null && (W = Math.min(1, I) - D / 2), typeof W == "number" && (C[$t] = W);
6616
+ S === "start" && w !== null ? W = Math.max(0, w) + D / 2 : S === "end" && C !== null && (W = Math.min(1, C) - D / 2), typeof W == "number" && (j[Jt] = W);
6561
6617
  }
6562
6618
  /**
6563
6619
  * Возвращает ширину самой длинной строки текстового объекта.
@@ -6598,7 +6654,7 @@ class Z {
6598
6654
  top: r,
6599
6655
  width: c,
6600
6656
  height: l
6601
- } = e, d = t.getBoundingRect(!1, !0), u = n || c || 1, f = s || l || 1, g = zs({
6657
+ } = e, d = t.getBoundingRect(!1, !0), u = n || c || 1, f = s || l || 1, g = Ps({
6602
6658
  object: t,
6603
6659
  montageArea: o,
6604
6660
  bounds: e
@@ -6608,15 +6664,15 @@ class Z {
6608
6664
  x: (b.x - a) / u,
6609
6665
  y: (b.y - r) / f
6610
6666
  };
6611
- })(), p = (d.left - a) / u, y = (d.top - r) / f, v = p + d.width / u, C = y + d.height / f;
6612
- return i[$t] = m.x, i[Ae] = m.y, i[fe] = Z._detectAnchor({
6667
+ })(), p = (d.left - a) / u, y = (d.top - r) / f, v = p + d.width / u, j = y + d.height / f;
6668
+ return i[Jt] = m.x, i[Ae] = m.y, i[fe] = Z._detectAnchor({
6613
6669
  center: m.x,
6614
6670
  start: p,
6615
6671
  end: v
6616
6672
  }), i[je] = Z._detectAnchor({
6617
6673
  center: m.y,
6618
6674
  start: y,
6619
- end: C
6675
+ end: j
6620
6676
  }), i.left = p, i.top = y, i;
6621
6677
  }
6622
6678
  /**
@@ -6727,13 +6783,13 @@ class Z {
6727
6783
  */
6728
6784
  // eslint-disable-next-line class-methods-use-this
6729
6785
  enlivenObjectEnlivables(t) {
6730
- return yt.enlivenObjectEnlivables(t);
6786
+ return vt.enlivenObjectEnlivables(t);
6731
6787
  }
6732
6788
  }
6733
6789
  const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6734
6790
  value: h,
6735
6791
  step: t
6736
- }) => Math.round(h / t) * t, mt = ({
6792
+ }) => Math.round(h / t) * t, yt = ({
6737
6793
  value: h,
6738
6794
  step: t
6739
6795
  }) => Ue({ value: h, step: t }) === h, Sn = ({
@@ -6827,30 +6883,30 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6827
6883
  left: a,
6828
6884
  right: r
6829
6885
  } = h, c = [];
6830
- for (const M of t) {
6831
- const { left: A, right: w } = M;
6832
- Math.min(w, r) - Math.max(A, a) > 0 && c.push(M);
6886
+ for (const S of t) {
6887
+ const { left: M, right: w } = S;
6888
+ Math.min(w, r) - Math.max(M, a) > 0 && c.push(S);
6833
6889
  }
6834
6890
  if (!c.length)
6835
6891
  return { delta: 0, guide: null };
6836
6892
  const l = [];
6837
- for (const M of c)
6838
- l.push({ bounds: M, isActive: !1 });
6893
+ for (const S of c)
6894
+ l.push({ bounds: S, isActive: !1 });
6839
6895
  l.push({ bounds: h, isActive: !0 }), Sn({ items: l, axis: "top" });
6840
6896
  const d = wn({ items: l });
6841
6897
  if (d === -1)
6842
6898
  return { delta: 0, guide: null };
6843
6899
  const u = [], f = i - o, g = l[d - 1], m = l[d + 1];
6844
6900
  if (g && m) {
6845
- const { bounds: M } = g, { bounds: A } = m, { bottom: w } = M, { top: I } = A, j = I - w - f;
6846
- if (j >= 0) {
6847
- const O = j / 2;
6848
- if (mt({ value: O, step: ot })) {
6849
- const D = Ue({ value: O, step: ot }), W = o - w, E = I - i, L = Math.abs(W - D), P = Math.abs(E - D), B = Math.max(L, P);
6901
+ const { bounds: S } = g, { bounds: M } = m, { bottom: w } = S, { top: C } = M, I = C - w - f;
6902
+ if (I >= 0) {
6903
+ const O = I / 2;
6904
+ if (yt({ value: O, step: ot })) {
6905
+ const D = Ue({ value: O, step: ot }), W = o - w, E = C - i, L = Math.abs(W - D), z = Math.abs(E - D), B = Math.max(L, z);
6850
6906
  if (B <= e) {
6851
- const z = D - W;
6852
- if (mt({ value: z, step: ot })) {
6853
- const _ = i + z, R = {
6907
+ const P = D - W;
6908
+ if (yt({ value: P, step: ot })) {
6909
+ const _ = i + P, R = {
6854
6910
  type: "vertical",
6855
6911
  axis: s,
6856
6912
  refStart: w,
@@ -6859,65 +6915,65 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6859
6915
  activeEnd: _ + D,
6860
6916
  distance: D
6861
6917
  };
6862
- u.push({ delta: z, guide: R, diff: B });
6918
+ u.push({ delta: P, guide: R, diff: B });
6863
6919
  }
6864
6920
  }
6865
6921
  }
6866
6922
  }
6867
6923
  }
6868
6924
  const p = An({ items: l, axis: "vertical" });
6869
- let y = null, v = null, C = null, b = null;
6925
+ let y = null, v = null, j = null, b = null;
6870
6926
  if (g) {
6871
- C = g.bounds;
6872
- const { bottom: M } = C, A = o - M;
6873
- A >= 0 && (y = A);
6927
+ j = g.bounds;
6928
+ const { bottom: S } = j, M = o - S;
6929
+ M >= 0 && (y = M);
6874
6930
  }
6875
6931
  if (m) {
6876
6932
  b = m.bounds;
6877
- const { top: M } = b, A = M - i;
6878
- A >= 0 && (v = A);
6933
+ const { top: S } = b, M = S - i;
6934
+ M >= 0 && (v = M);
6879
6935
  }
6880
- for (const M of p) {
6936
+ for (const S of p) {
6881
6937
  const {
6882
- beforeIndex: A,
6938
+ beforeIndex: M,
6883
6939
  afterIndex: w,
6884
- start: I,
6885
- end: S,
6886
- distance: j
6887
- } = M;
6888
- if (!(A === d || w === d || !mt({ value: j, step: ot }))) {
6889
- if (y !== null && C) {
6890
- const k = Math.abs(y - j);
6940
+ start: C,
6941
+ end: A,
6942
+ distance: I
6943
+ } = S;
6944
+ if (!(M === d || w === d || !yt({ value: I, step: ot }))) {
6945
+ if (y !== null && j) {
6946
+ const k = Math.abs(y - I);
6891
6947
  if (k <= e) {
6892
- const D = j - y;
6893
- if (!mt({ value: D, step: ot })) continue;
6894
- const E = o + D, { bottom: L } = C, P = {
6948
+ const D = I - y;
6949
+ if (!yt({ value: D, step: ot })) continue;
6950
+ const E = o + D, { bottom: L } = j, z = {
6895
6951
  type: "vertical",
6896
6952
  axis: s,
6897
- refStart: I,
6898
- refEnd: S,
6953
+ refStart: C,
6954
+ refEnd: A,
6899
6955
  activeStart: L,
6900
6956
  activeEnd: E,
6901
- distance: j
6957
+ distance: I
6902
6958
  };
6903
- u.push({ delta: D, guide: P, diff: k });
6959
+ u.push({ delta: D, guide: z, diff: k });
6904
6960
  }
6905
6961
  }
6906
6962
  if (v !== null && b) {
6907
- const k = Math.abs(v - j);
6963
+ const k = Math.abs(v - I);
6908
6964
  if (k <= e) {
6909
- const D = v - j;
6910
- if (!mt({ value: D, step: ot })) continue;
6911
- const E = i + D, { top: L } = b, P = {
6965
+ const D = v - I;
6966
+ if (!yt({ value: D, step: ot })) continue;
6967
+ const E = i + D, { top: L } = b, z = {
6912
6968
  type: "vertical",
6913
6969
  axis: s,
6914
- refStart: I,
6915
- refEnd: S,
6970
+ refStart: C,
6971
+ refEnd: A,
6916
6972
  activeStart: E,
6917
6973
  activeEnd: L,
6918
- distance: j
6974
+ distance: I
6919
6975
  };
6920
- u.push({ delta: D, guide: P, diff: k });
6976
+ u.push({ delta: D, guide: z, diff: k });
6921
6977
  }
6922
6978
  }
6923
6979
  }
@@ -6925,9 +6981,9 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6925
6981
  if (!u.length)
6926
6982
  return { delta: 0, guide: null };
6927
6983
  let T = u[0];
6928
- for (let M = 1; M < u.length; M += 1) {
6929
- const A = u[M];
6930
- A.diff < T.diff && (T = A);
6984
+ for (let S = 1; S < u.length; S += 1) {
6985
+ const M = u[S];
6986
+ M.diff < T.diff && (T = M);
6931
6987
  }
6932
6988
  return {
6933
6989
  delta: T.delta,
@@ -6946,30 +7002,30 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6946
7002
  top: a,
6947
7003
  bottom: r
6948
7004
  } = h, c = [];
6949
- for (const M of t) {
6950
- const { top: A, bottom: w } = M;
6951
- Math.min(w, r) - Math.max(A, a) > 0 && c.push(M);
7005
+ for (const S of t) {
7006
+ const { top: M, bottom: w } = S;
7007
+ Math.min(w, r) - Math.max(M, a) > 0 && c.push(S);
6952
7008
  }
6953
7009
  if (!c.length)
6954
7010
  return { delta: 0, guide: null };
6955
7011
  const l = [];
6956
- for (const M of c)
6957
- l.push({ bounds: M, isActive: !1 });
7012
+ for (const S of c)
7013
+ l.push({ bounds: S, isActive: !1 });
6958
7014
  l.push({ bounds: h, isActive: !0 }), Sn({ items: l, axis: "left" });
6959
7015
  const d = wn({ items: l });
6960
7016
  if (d === -1)
6961
7017
  return { delta: 0, guide: null };
6962
7018
  const u = [], f = i - o, g = l[d - 1], m = l[d + 1];
6963
7019
  if (g && m) {
6964
- const { bounds: M } = g, { bounds: A } = m, { right: w } = M, { left: I } = A, j = I - w - f;
6965
- if (j >= 0) {
6966
- const O = j / 2;
6967
- if (mt({ value: O, step: ot })) {
6968
- const D = Ue({ value: O, step: ot }), W = o - w, E = I - i, L = Math.abs(W - D), P = Math.abs(E - D), B = Math.max(L, P);
7020
+ const { bounds: S } = g, { bounds: M } = m, { right: w } = S, { left: C } = M, I = C - w - f;
7021
+ if (I >= 0) {
7022
+ const O = I / 2;
7023
+ if (yt({ value: O, step: ot })) {
7024
+ const D = Ue({ value: O, step: ot }), W = o - w, E = C - i, L = Math.abs(W - D), z = Math.abs(E - D), B = Math.max(L, z);
6969
7025
  if (B <= e) {
6970
- const z = D - W;
6971
- if (mt({ value: z, step: ot })) {
6972
- const _ = i + z, R = {
7026
+ const P = D - W;
7027
+ if (yt({ value: P, step: ot })) {
7028
+ const _ = i + P, R = {
6973
7029
  type: "horizontal",
6974
7030
  axis: s,
6975
7031
  refStart: w,
@@ -6978,65 +7034,65 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
6978
7034
  activeEnd: _ + D,
6979
7035
  distance: D
6980
7036
  };
6981
- u.push({ delta: z, guide: R, diff: B });
7037
+ u.push({ delta: P, guide: R, diff: B });
6982
7038
  }
6983
7039
  }
6984
7040
  }
6985
7041
  }
6986
7042
  }
6987
7043
  const p = An({ items: l, axis: "horizontal" });
6988
- let y = null, v = null, C = null, b = null;
7044
+ let y = null, v = null, j = null, b = null;
6989
7045
  if (g) {
6990
- C = g.bounds;
6991
- const { right: M } = C, A = o - M;
6992
- A >= 0 && (y = A);
7046
+ j = g.bounds;
7047
+ const { right: S } = j, M = o - S;
7048
+ M >= 0 && (y = M);
6993
7049
  }
6994
7050
  if (m) {
6995
7051
  b = m.bounds;
6996
- const { left: M } = b, A = M - i;
6997
- A >= 0 && (v = A);
7052
+ const { left: S } = b, M = S - i;
7053
+ M >= 0 && (v = M);
6998
7054
  }
6999
- for (const M of p) {
7055
+ for (const S of p) {
7000
7056
  const {
7001
- beforeIndex: A,
7057
+ beforeIndex: M,
7002
7058
  afterIndex: w,
7003
- start: I,
7004
- end: S,
7005
- distance: j
7006
- } = M;
7007
- if (!(A === d || w === d || !mt({ value: j, step: ot }))) {
7008
- if (y !== null && C) {
7009
- const k = Math.abs(y - j);
7059
+ start: C,
7060
+ end: A,
7061
+ distance: I
7062
+ } = S;
7063
+ if (!(M === d || w === d || !yt({ value: I, step: ot }))) {
7064
+ if (y !== null && j) {
7065
+ const k = Math.abs(y - I);
7010
7066
  if (k <= e) {
7011
- const D = j - y;
7012
- if (!mt({ value: D, step: ot })) continue;
7013
- const E = o + D, { right: L } = C, P = {
7067
+ const D = I - y;
7068
+ if (!yt({ value: D, step: ot })) continue;
7069
+ const E = o + D, { right: L } = j, z = {
7014
7070
  type: "horizontal",
7015
7071
  axis: s,
7016
- refStart: I,
7017
- refEnd: S,
7072
+ refStart: C,
7073
+ refEnd: A,
7018
7074
  activeStart: L,
7019
7075
  activeEnd: E,
7020
- distance: j
7076
+ distance: I
7021
7077
  };
7022
- u.push({ delta: D, guide: P, diff: k });
7078
+ u.push({ delta: D, guide: z, diff: k });
7023
7079
  }
7024
7080
  }
7025
7081
  if (v !== null && b) {
7026
- const k = Math.abs(v - j);
7082
+ const k = Math.abs(v - I);
7027
7083
  if (k <= e) {
7028
- const D = v - j;
7029
- if (!mt({ value: D, step: ot })) continue;
7030
- const E = i + D, { left: L } = b, P = {
7084
+ const D = v - I;
7085
+ if (!yt({ value: D, step: ot })) continue;
7086
+ const E = i + D, { left: L } = b, z = {
7031
7087
  type: "horizontal",
7032
7088
  axis: s,
7033
- refStart: I,
7034
- refEnd: S,
7089
+ refStart: C,
7090
+ refEnd: A,
7035
7091
  activeStart: E,
7036
7092
  activeEnd: L,
7037
- distance: j
7093
+ distance: I
7038
7094
  };
7039
- u.push({ delta: D, guide: P, diff: k });
7095
+ u.push({ delta: D, guide: z, diff: k });
7040
7096
  }
7041
7097
  }
7042
7098
  }
@@ -7044,9 +7100,9 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7044
7100
  if (!u.length)
7045
7101
  return { delta: 0, guide: null };
7046
7102
  let T = u[0];
7047
- for (let M = 1; M < u.length; M += 1) {
7048
- const A = u[M];
7049
- A.diff < T.diff && (T = A);
7103
+ for (let S = 1; S < u.length; S += 1) {
7104
+ const M = u[S];
7105
+ M.diff < T.diff && (T = M);
7050
7106
  }
7051
7107
  return {
7052
7108
  delta: T.delta,
@@ -7101,14 +7157,14 @@ const Ce = 5, Mn = "#3D8BF4", Re = 1, ot = 2, Ue = ({
7101
7157
  offsetAlongAxis: f = 0,
7102
7158
  offsetPerpendicular: g = 0
7103
7159
  }) => {
7104
- const m = i || 1, p = 12 / m, y = d / m, v = u / m, C = (n + s) / 2 + f, b = t === "vertical" ? e + g : C, T = t === "vertical" ? C : e + g;
7160
+ const m = i || 1, p = 12 / m, y = d / m, v = u / m, j = (n + s) / 2 + f, b = t === "vertical" ? e + g : j, T = t === "vertical" ? j : e + g;
7105
7161
  h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = l / m, h.font = `${p}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
7106
- const A = h.measureText(o).width + y * 2, w = p + y * 2, I = b - A / 2, S = T - w / 2;
7162
+ const M = h.measureText(o).width + y * 2, w = p + y * 2, C = b - M / 2, A = T - w / 2;
7107
7163
  h.beginPath(), Gs({
7108
7164
  context: h,
7109
- x: I,
7110
- y: S,
7111
- width: A,
7165
+ x: C,
7166
+ y: A,
7167
+ width: M,
7112
7168
  height: w,
7113
7169
  radius: v
7114
7170
  }), h.fill(), h.fillStyle = r, h.fillText(o, b, T), h.restore();
@@ -7278,7 +7334,7 @@ class $ {
7278
7334
  return;
7279
7335
  }
7280
7336
  $._applyMovementStep({ target: e }), !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
7281
- let o = pt({ object: e });
7337
+ let o = mt({ object: e });
7282
7338
  if (!o) {
7283
7339
  this._clearGuides();
7284
7340
  return;
@@ -7293,9 +7349,9 @@ class $ {
7293
7349
  e.set({
7294
7350
  left: y + l,
7295
7351
  top: v + d
7296
- }), e.setCoords(), o = (m = pt({ object: e })) != null ? m : o;
7352
+ }), e.setCoords(), o = (m = mt({ object: e })) != null ? m : o;
7297
7353
  }
7298
- const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((y) => pt({ object: y })).filter((y) => !!y), g = Zs({
7354
+ const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((y) => mt({ object: y })).filter((y) => !!y), g = Zs({
7299
7355
  activeBounds: o,
7300
7356
  candidates: f,
7301
7357
  threshold: r,
@@ -7306,7 +7362,7 @@ class $ {
7306
7362
  e.set({
7307
7363
  left: y + g.deltaX,
7308
7364
  top: v + g.deltaY
7309
- }), e.setCoords(), o = (p = pt({ object: e })) != null ? p : o;
7365
+ }), e.setCoords(), o = (p = mt({ object: e })) != null ? p : o;
7310
7366
  }
7311
7367
  this._applyGuides({
7312
7368
  guides: u,
@@ -7340,7 +7396,7 @@ class $ {
7340
7396
  horizontal: d
7341
7397
  } = c;
7342
7398
  !l.length && !d.length && this._cacheAnchors({ activeObject: e });
7343
- const u = pt({ object: e });
7399
+ const u = mt({ object: e });
7344
7400
  if (!u) {
7345
7401
  this._clearGuides();
7346
7402
  return;
@@ -7350,52 +7406,52 @@ class $ {
7350
7406
  originY: y
7351
7407
  } = s, {
7352
7408
  originX: v = "left",
7353
- originY: C = "top",
7409
+ originY: j = "top",
7354
7410
  scaleX: b = 1,
7355
7411
  scaleY: T = 1
7356
- } = e, M = p != null ? p : v, A = y != null ? y : C, w = $._collectVerticalSnapCandidates({
7412
+ } = e, S = p != null ? p : v, M = y != null ? y : j, w = $._collectVerticalSnapCandidates({
7357
7413
  bounds: u,
7358
- originX: M,
7414
+ originX: S,
7359
7415
  shouldSnapX: i
7360
- }), I = $._collectHorizontalSnapCandidates({
7416
+ }), C = $._collectHorizontalSnapCandidates({
7361
7417
  bounds: u,
7362
- originY: A,
7418
+ originY: M,
7363
7419
  shouldSnapY: a
7364
- }), S = $._findAxisSnapCandidate({
7420
+ }), A = $._findAxisSnapCandidate({
7365
7421
  anchors: l,
7366
7422
  candidates: w,
7367
7423
  threshold: m
7368
- }), j = $._findAxisSnapCandidate({
7424
+ }), I = $._findAxisSnapCandidate({
7369
7425
  anchors: d,
7370
- candidates: I,
7426
+ candidates: C,
7371
7427
  threshold: m
7372
- }), { guidePosition: O } = S, { guidePosition: k } = j, D = O !== null, W = k !== null;
7428
+ }), { guidePosition: O } = A, { guidePosition: k } = I, D = O !== null, W = k !== null;
7373
7429
  if (!D && !W) {
7374
7430
  this._clearGuides();
7375
7431
  return;
7376
7432
  }
7377
7433
  const E = [];
7378
- let L = null, P = null;
7434
+ let L = null, z = null;
7379
7435
  if (r) {
7380
- const z = $._resolveUniformScale({
7436
+ const P = $._resolveUniformScale({
7381
7437
  bounds: u,
7382
- originX: M,
7383
- originY: A,
7384
- verticalSnap: S,
7385
- horizontalSnap: j
7438
+ originX: S,
7439
+ originY: M,
7440
+ verticalSnap: A,
7441
+ horizontalSnap: I
7386
7442
  });
7387
- if (z) {
7388
- const { scaleFactor: x, guide: _ } = z;
7389
- L = b * x, P = T * x, E.push(_);
7443
+ if (P) {
7444
+ const { scaleFactor: x, guide: _ } = P;
7445
+ L = b * x, z = T * x, E.push(_);
7390
7446
  }
7391
7447
  }
7392
7448
  if (!r) {
7393
- const { angle: z = 0 } = e, { width: x, height: _ } = $._resolveBaseDimensions({ target: e }), R = Math.abs(b) || 1, N = Math.abs(T) || 1;
7449
+ const { angle: P = 0 } = e, { width: x, height: _ } = $._resolveBaseDimensions({ target: e }), R = Math.abs(b) || 1, N = Math.abs(T) || 1;
7394
7450
  if (D) {
7395
7451
  const K = $._resolveDesiredWidth({
7396
7452
  bounds: u,
7397
- originX: M,
7398
- snap: S
7453
+ originX: S,
7454
+ snap: A
7399
7455
  });
7400
7456
  if (K !== null) {
7401
7457
  const H = $._resolveScaleForWidth({
@@ -7403,7 +7459,7 @@ class $ {
7403
7459
  baseWidth: x,
7404
7460
  baseHeight: _,
7405
7461
  scaleY: N,
7406
- angle: z
7462
+ angle: P
7407
7463
  });
7408
7464
  if (H !== null) {
7409
7465
  const q = b < 0 ? -1 : 1;
@@ -7417,8 +7473,8 @@ class $ {
7417
7473
  if (W) {
7418
7474
  const K = $._resolveDesiredHeight({
7419
7475
  bounds: u,
7420
- originY: A,
7421
- snap: j
7476
+ originY: M,
7477
+ snap: I
7422
7478
  });
7423
7479
  if (K !== null) {
7424
7480
  const H = $._resolveScaleForHeight({
@@ -7426,11 +7482,11 @@ class $ {
7426
7482
  baseWidth: x,
7427
7483
  baseHeight: _,
7428
7484
  scaleX: R,
7429
- angle: z
7485
+ angle: P
7430
7486
  });
7431
7487
  if (H !== null) {
7432
7488
  const q = T < 0 ? -1 : 1;
7433
- P = H * q, k !== null && E.push({
7489
+ z = H * q, k !== null && E.push({
7434
7490
  type: "horizontal",
7435
7491
  position: k
7436
7492
  });
@@ -7438,14 +7494,14 @@ class $ {
7438
7494
  }
7439
7495
  }
7440
7496
  }
7441
- const B = L !== null || P !== null;
7497
+ const B = L !== null || z !== null;
7442
7498
  if (!B && !E.length) {
7443
7499
  this._clearGuides();
7444
7500
  return;
7445
7501
  }
7446
7502
  if (B) {
7447
- const z = e.getRelativeCenterPoint(), x = e.translateToOriginPoint(z, M, A), _ = {};
7448
- L !== null && (_.scaleX = L, s.scaleX = L), P !== null && (_.scaleY = P, s.scaleY = P), Object.keys(_).length && (e.set(_), e.setPositionByOrigin(x, M, A), e.setCoords());
7503
+ const P = e.getRelativeCenterPoint(), x = e.translateToOriginPoint(P, S, M), _ = {};
7504
+ L !== null && (_.scaleX = L, s.scaleX = L), z !== null && (_.scaleY = z, s.scaleY = z), Object.keys(_).length && (e.set(_), e.setPositionByOrigin(x, S, M), e.setCoords());
7449
7505
  }
7450
7506
  this._applyGuides({
7451
7507
  guides: E,
@@ -7479,7 +7535,7 @@ class $ {
7479
7535
  horizontal: c
7480
7536
  } = a;
7481
7537
  !r.length && !c.length && this._cacheAnchors({ activeObject: t });
7482
- const l = pt({ object: t });
7538
+ const l = mt({ object: t });
7483
7539
  if (!l) {
7484
7540
  this._clearGuides();
7485
7541
  return;
@@ -7487,7 +7543,7 @@ class $ {
7487
7543
  const { canvas: d } = this, u = d.getZoom() || 1, f = Ce / u, { originX: g, originY: m } = e, {
7488
7544
  originX: p = "left",
7489
7545
  originY: y = "top"
7490
- } = t, v = g != null ? g : p, C = m != null ? m : y, b = $._collectVerticalSnapCandidates({
7546
+ } = t, v = g != null ? g : p, j = m != null ? m : y, b = $._collectVerticalSnapCandidates({
7491
7547
  bounds: l,
7492
7548
  originX: v,
7493
7549
  shouldSnapX: !0
@@ -7495,38 +7551,38 @@ class $ {
7495
7551
  anchors: r,
7496
7552
  candidates: b,
7497
7553
  threshold: f
7498
- }), { guidePosition: M } = T;
7499
- if (M === null) {
7554
+ }), { guidePosition: S } = T;
7555
+ if (S === null) {
7500
7556
  this._clearGuides();
7501
7557
  return;
7502
7558
  }
7503
- const A = $._resolveDesiredWidth({
7559
+ const M = $._resolveDesiredWidth({
7504
7560
  bounds: l,
7505
7561
  originX: v,
7506
7562
  snap: T
7507
7563
  });
7508
- if (A === null) {
7564
+ if (M === null) {
7509
7565
  this._clearGuides();
7510
7566
  return;
7511
7567
  }
7512
7568
  const w = $._resolveTextWidthForBounds({
7513
7569
  target: t,
7514
- boundsWidth: A
7570
+ boundsWidth: M
7515
7571
  });
7516
7572
  if (w === null) {
7517
7573
  this._clearGuides();
7518
7574
  return;
7519
7575
  }
7520
- const { width: I = 0 } = t;
7521
- if (w !== I) {
7522
- const S = t.getRelativeCenterPoint(), j = t.translateToOriginPoint(S, v, C);
7523
- t.set({ width: w }), t.setPositionByOrigin(j, v, C), t.setCoords();
7576
+ const { width: C = 0 } = t;
7577
+ if (w !== C) {
7578
+ const A = t.getRelativeCenterPoint(), I = t.translateToOriginPoint(A, v, j);
7579
+ t.set({ width: w }), t.setPositionByOrigin(I, v, j), t.setCoords();
7524
7580
  }
7525
7581
  this._applyGuides({
7526
7582
  guides: [
7527
7583
  {
7528
7584
  type: "vertical",
7529
- position: M
7585
+ position: S
7530
7586
  }
7531
7587
  ],
7532
7588
  spacingGuides: []
@@ -7698,31 +7754,31 @@ class $ {
7698
7754
  } = o;
7699
7755
  let p = null, y = null;
7700
7756
  if (u !== null && l > 0) {
7701
- const C = $._resolveDesiredWidth({
7757
+ const j = $._resolveDesiredWidth({
7702
7758
  bounds: t,
7703
7759
  originX: e,
7704
7760
  snap: s
7705
7761
  });
7706
- if (C !== null) {
7707
- const b = C / l;
7762
+ if (j !== null) {
7763
+ const b = j / l;
7708
7764
  Number.isFinite(b) && b > 0 && (p = b);
7709
7765
  }
7710
7766
  }
7711
7767
  if (g !== null && d > 0) {
7712
- const C = $._resolveDesiredHeight({
7768
+ const j = $._resolveDesiredHeight({
7713
7769
  bounds: t,
7714
7770
  originY: n,
7715
7771
  snap: o
7716
7772
  });
7717
- if (C !== null) {
7718
- const b = C / d;
7773
+ if (j !== null) {
7774
+ const b = j / d;
7719
7775
  Number.isFinite(b) && b > 0 && (y = b);
7720
7776
  }
7721
7777
  }
7722
7778
  let v = null;
7723
7779
  if (p !== null && y === null && (v = "x"), y !== null && p === null && (v = "y"), p !== null && y !== null) {
7724
- const C = Math.abs(f), b = Math.abs(m);
7725
- C <= b && (v = "x"), C > b && (v = "y");
7780
+ const j = Math.abs(f), b = Math.abs(m);
7781
+ j <= b && (v = "x"), j > b && (v = "y");
7726
7782
  }
7727
7783
  return v === "x" && p !== null && u !== null ? {
7728
7784
  scaleFactor: p,
@@ -7854,10 +7910,10 @@ class $ {
7854
7910
  _cacheAnchors({ activeObject: t }) {
7855
7911
  const e = this._collectTargets({ activeObject: t }), n = { vertical: [], horizontal: [] }, s = [];
7856
7912
  for (const a of e) {
7857
- const r = pt({ object: a });
7913
+ const r = mt({ object: a });
7858
7914
  r && (pn({ anchors: n, bounds: r }), s.push(r));
7859
7915
  }
7860
- const { montageArea: o } = this.editor, i = pt({ object: o });
7916
+ const { montageArea: o } = this.editor, i = mt({ object: o });
7861
7917
  if (i) {
7862
7918
  pn({ anchors: n, bounds: i });
7863
7919
  const { left: a, right: r, top: c, bottom: l } = i;
@@ -8006,7 +8062,7 @@ class Wt {
8006
8062
  this._clearGuides();
8007
8063
  return;
8008
8064
  }
8009
- const o = pt({ object: s });
8065
+ const o = mt({ object: s });
8010
8066
  if (!o) {
8011
8067
  this._clearGuides();
8012
8068
  return;
@@ -8014,7 +8070,7 @@ class Wt {
8014
8070
  const i = Wt._resolveTarget({
8015
8071
  event: t,
8016
8072
  activeObject: s
8017
- }), { montageArea: a } = n, r = i != null ? i : a, c = r === a, l = pt({ object: r });
8073
+ }), { montageArea: a } = n, r = i != null ? i : a, c = r === a, l = mt({ object: r });
8018
8074
  if (!l) {
8019
8075
  this._clearGuides();
8020
8076
  return;
@@ -8086,42 +8142,42 @@ class Wt {
8086
8142
  } = e, m = Math.max(a, u), p = Math.min(r, f), v = p >= m ? (m + p) / 2 : (c + g) / 2;
8087
8143
  if (l >= i) {
8088
8144
  if (n) return s;
8089
- const j = l - i;
8090
- return j > 0 && s.push({
8145
+ const I = l - i;
8146
+ return I > 0 && s.push({
8091
8147
  type: "horizontal",
8092
8148
  axis: v,
8093
8149
  start: i,
8094
8150
  end: l,
8095
- distance: j
8151
+ distance: I
8096
8152
  }), s;
8097
8153
  }
8098
8154
  if (d <= o) {
8099
8155
  if (n) return s;
8100
- const j = o - d;
8101
- return j > 0 && s.push({
8156
+ const I = o - d;
8157
+ return I > 0 && s.push({
8102
8158
  type: "horizontal",
8103
8159
  axis: v,
8104
8160
  start: d,
8105
8161
  end: o,
8106
- distance: j
8162
+ distance: I
8107
8163
  }), s;
8108
8164
  }
8109
8165
  if (!n) return s;
8110
- const C = o < l, b = i > d, T = Math.min(o, l), M = Math.max(o, l), A = M - T;
8111
- A > 0 && !C && s.push({
8166
+ const j = o < l, b = i > d, T = Math.min(o, l), S = Math.max(o, l), M = S - T;
8167
+ M > 0 && !j && s.push({
8112
8168
  type: "horizontal",
8113
8169
  axis: v,
8114
8170
  start: T,
8115
- end: M,
8116
- distance: A
8171
+ end: S,
8172
+ distance: M
8117
8173
  });
8118
- const w = Math.min(i, d), I = Math.max(i, d), S = I - w;
8119
- return S > 0 && !b && s.push({
8174
+ const w = Math.min(i, d), C = Math.max(i, d), A = C - w;
8175
+ return A > 0 && !b && s.push({
8120
8176
  type: "horizontal",
8121
8177
  axis: v,
8122
8178
  start: w,
8123
- end: I,
8124
- distance: S
8179
+ end: C,
8180
+ distance: A
8125
8181
  }), s;
8126
8182
  }
8127
8183
  /**
@@ -8147,42 +8203,42 @@ class Wt {
8147
8203
  } = e, m = Math.max(a, u), p = Math.min(r, f), v = p >= m ? (m + p) / 2 : (c + g) / 2;
8148
8204
  if (l >= i) {
8149
8205
  if (n) return s;
8150
- const j = l - i;
8151
- return j > 0 && s.push({
8206
+ const I = l - i;
8207
+ return I > 0 && s.push({
8152
8208
  type: "vertical",
8153
8209
  axis: v,
8154
8210
  start: i,
8155
8211
  end: l,
8156
- distance: j
8212
+ distance: I
8157
8213
  }), s;
8158
8214
  }
8159
8215
  if (d <= o) {
8160
8216
  if (n) return s;
8161
- const j = o - d;
8162
- return j > 0 && s.push({
8217
+ const I = o - d;
8218
+ return I > 0 && s.push({
8163
8219
  type: "vertical",
8164
8220
  axis: v,
8165
8221
  start: d,
8166
8222
  end: o,
8167
- distance: j
8223
+ distance: I
8168
8224
  }), s;
8169
8225
  }
8170
8226
  if (!n) return s;
8171
- const C = o < l, b = i > d, T = Math.min(o, l), M = Math.max(o, l), A = M - T;
8172
- A > 0 && !C && s.push({
8227
+ const j = o < l, b = i > d, T = Math.min(o, l), S = Math.max(o, l), M = S - T;
8228
+ M > 0 && !j && s.push({
8173
8229
  type: "vertical",
8174
8230
  axis: v,
8175
8231
  start: T,
8176
- end: M,
8177
- distance: A
8232
+ end: S,
8233
+ distance: M
8178
8234
  });
8179
- const w = Math.min(i, d), I = Math.max(i, d), S = I - w;
8180
- return S > 0 && !b && s.push({
8235
+ const w = Math.min(i, d), C = Math.max(i, d), A = C - w;
8236
+ return A > 0 && !b && s.push({
8181
8237
  type: "vertical",
8182
8238
  axis: v,
8183
8239
  start: w,
8184
- end: I,
8185
- distance: S
8240
+ end: C,
8241
+ distance: A
8186
8242
  }), s;
8187
8243
  }
8188
8244
  /**
@@ -8278,7 +8334,7 @@ class Ye {
8278
8334
  showRotationAngle: l,
8279
8335
  _onReadyCallback: d
8280
8336
  } = this.options;
8281
- if (ut.apply(), this.canvas = new kn(this.containerId, this.options), this.moduleLoader = new Fn(), this.workerManager = new Un(), this.errorManager = new te({ editor: this }), this.historyManager = new J({ editor: this }), this.toolbar = new is({ editor: this }), this.transformManager = new gs({ editor: this }), this.zoomManager = new ps({ editor: this }), this.canvasManager = new fs({ editor: this }), this.imageManager = new St({ editor: this }), this.layerManager = new pe({ editor: this }), this.shapeManager = new ys({ editor: this }), this.interactionBlocker = new ms({ editor: this }), this.backgroundManager = new Ft({ editor: this }), this.clipboardManager = new vs({ editor: this }), this.objectLockManager = new me({ editor: this }), this.groupingManager = new bs({ editor: this }), this.selectionManager = new Ms({ editor: this }), this.deletionManager = new We({ editor: this }), this.panConstraintManager = new Ss({ editor: this }), this.snappingManager = new $({ editor: this }), this.measurementManager = new Wt({ editor: this }), this.fontManager = new De((u = this.options.fonts) != null ? u : []), this.textManager = new rt({ editor: this }), this.templateManager = new Z({ editor: this }), l && (this.angleIndicator = new Fe({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Be({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
8337
+ if (ut.apply(), this.canvas = new kn(this.containerId, this.options), this.moduleLoader = new Fn(), this.workerManager = new Un(), this.errorManager = new te({ editor: this }), this.historyManager = new J({ editor: this }), this.toolbar = new is({ editor: this }), this.transformManager = new gs({ editor: this }), this.zoomManager = new ps({ editor: this }), this.canvasManager = new fs({ editor: this }), this.imageManager = new pt({ editor: this }), this.layerManager = new pe({ editor: this }), this.shapeManager = new ys({ editor: this }), this.interactionBlocker = new ms({ editor: this }), this.backgroundManager = new Ft({ editor: this }), this.clipboardManager = new vs({ editor: this }), this.objectLockManager = new me({ editor: this }), this.groupingManager = new bs({ editor: this }), this.selectionManager = new Ms({ editor: this }), this.deletionManager = new We({ editor: this }), this.panConstraintManager = new Ss({ editor: this }), this.snappingManager = new $({ editor: this }), this.measurementManager = new Wt({ editor: this }), this.fontManager = new De((u = this.options.fonts) != null ? u : []), this.textManager = new rt({ editor: this }), this.templateManager = new Z({ editor: this }), l && (this.angleIndicator = new Fe({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Be({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
8282
8338
  const f = a, {
8283
8339
  source: g,
8284
8340
  scale: m = `image-${c}`,