@anu3ev/fabric-image-editor 0.5.22 → 0.5.24

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.
Files changed (2) hide show
  1. package/dist/main.js +797 -638
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,25 +1,25 @@
1
1
  var ds = Object.defineProperty, ls = Object.defineProperties;
2
2
  var hs = Object.getOwnPropertyDescriptors;
3
3
  var ne = Object.getOwnPropertySymbols;
4
- var Ne = Object.prototype.hasOwnProperty, xe = Object.prototype.propertyIsEnumerable;
4
+ var xe = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
5
5
  var _e = (h, t, e) => t in h ? ds(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, B = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
- Ne.call(t, e) && _e(h, e, t[e]);
7
+ xe.call(t, e) && _e(h, e, t[e]);
8
8
  if (ne)
9
9
  for (var e of ne(t))
10
- xe.call(t, e) && _e(h, e, t[e]);
10
+ Ne.call(t, e) && _e(h, e, t[e]);
11
11
  return h;
12
- }, wt = (h, t) => ls(h, hs(t));
13
- var gt = (h, t) => {
12
+ }, St = (h, t) => ls(h, hs(t));
13
+ var pt = (h, t) => {
14
14
  var e = {};
15
15
  for (var s in h)
16
- Ne.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
16
+ xe.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
17
  if (h != null && ne)
18
18
  for (var s of ne(h))
19
- t.indexOf(s) < 0 && xe.call(h, s) && (e[s] = h[s]);
19
+ t.indexOf(s) < 0 && Ne.call(h, s) && (e[s] = h[s]);
20
20
  return e;
21
21
  };
22
- var z = (h, t, e) => new Promise((s, n) => {
22
+ var P = (h, t, e) => new Promise((s, n) => {
23
23
  var o = (r) => {
24
24
  try {
25
25
  a(e.next(r));
@@ -35,15 +35,15 @@ var z = (h, t, e) => new Promise((s, n) => {
35
35
  }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(o, i);
36
36
  a((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as U, Textbox as ot, util as ut, controlsUtils as Be, InteractiveFabricObject as ke, Point as tt, FitContentLayout as We, loadSVGFromURL as us, FabricImage as Zt, Gradient as ze, Rect as fs, Circle as gs, Triangle as ps, Group as Et, Color as ms, classRegistry as Pe, loadSVGFromString as ys, Canvas as vs, Pattern as bs } from "fabric";
38
+ import { ActiveSelection as U, Textbox as it, util as ft, controlsUtils as Be, InteractiveFabricObject as ke, Point as et, FitContentLayout as ze, loadSVGFromURL as us, FabricImage as Gt, Gradient as Pe, Rect as fs, Circle as gs, Triangle as ps, Group as Ot, Color as ms, classRegistry as We, loadSVGFromString as ys, Canvas as vs, Pattern as bs } from "fabric";
39
39
  import { create as Ms } from "jsondiffpatch";
40
40
  import ws from "diff-match-patch";
41
- var Ss = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", V = function() {
41
+ var Ss = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", X = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", s = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
43
  e += Ss[s[t] & 63];
44
44
  return e;
45
45
  };
46
- class Xt {
46
+ class Kt {
47
47
  /**
48
48
  * Конструктор принимает редактор и опции.
49
49
  * @param params
@@ -61,7 +61,7 @@ class Xt {
61
61
  * @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
62
62
  */
63
63
  constructor({ editor: t, options: e = {} }) {
64
- this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Xt.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = Xt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Xt.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
64
+ this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Kt.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = Kt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Kt.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
65
65
  }
66
66
  /**
67
67
  * Инициализация всех обработчиков согласно опциям.
@@ -175,7 +175,7 @@ class Xt {
175
175
  * @param event.code — код клавиши
176
176
  */
177
177
  handleUndoRedoEvent(t) {
178
- return z(this, null, function* () {
178
+ return P(this, null, function* () {
179
179
  const { ctrlKey: e, metaKey: s, code: n, repeat: o } = t;
180
180
  this._shouldIgnoreKeyboardEvent(t) || !e && !s || o || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (n === "KeyZ" ? (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : n === "KeyY" && (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
181
181
  });
@@ -347,7 +347,7 @@ class Xt {
347
347
  */
348
348
  handleResetObjectFit(t) {
349
349
  const e = t == null ? void 0 : t.target;
350
- !e || e instanceof ot || this.editor.transformManager.resetObject({ object: e });
350
+ !e || e instanceof it || this.editor.transformManager.resetObject({ object: e });
351
351
  }
352
352
  /**
353
353
  * Проверяет, должно ли событие клавиатуры быть проигнорировано
@@ -434,7 +434,7 @@ function js(h) {
434
434
  }
435
435
  );
436
436
  }
437
- class Is {
437
+ class Cs {
438
438
  /**
439
439
  * @param scriptUrl — URL скрипта воркера.
440
440
  * По-умолчанию использует DefaultWorker из соседнего файла
@@ -468,7 +468,7 @@ class Is {
468
468
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
469
469
  */
470
470
  post(t, e, s = []) {
471
- const n = `${t}:${V(8)}`;
471
+ const n = `${t}:${X(8)}`;
472
472
  return new Promise((o, i) => {
473
473
  this._callbacks.set(n, { resolve: o, reject: i }), this.worker.postMessage({ action: t, payload: e, requestId: n }, s);
474
474
  });
@@ -480,52 +480,52 @@ class Is {
480
480
  this.worker.terminate();
481
481
  }
482
482
  }
483
- const lt = 12, Cs = 2, ve = 8, be = 20, Ts = 100, Me = 20, we = 8, Es = 100, de = 32, Ie = 1, Os = "#2B2D33", Ce = "#3D8BF4", Te = "#FFFFFF";
483
+ const ht = 12, Is = 2, ve = 8, be = 20, Ts = 100, Me = 20, we = 8, Es = 100, de = 32, Ce = 1, Os = "#2B2D33", Ie = "#3D8BF4", Te = "#FFFFFF";
484
484
  function oe(h, t, e, s, n) {
485
- const o = lt, i = Cs;
486
- h.save(), h.translate(t, e), h.rotate(ut.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ce, h.lineWidth = Ie, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
485
+ const o = ht, i = Is;
486
+ h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ie, h.lineWidth = Ce, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
487
487
  }
488
488
  function Ue(h, t, e, s, n) {
489
489
  const o = ve, i = be, a = Ts;
490
- h.save(), h.translate(t, e), h.rotate(ut.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ce, h.lineWidth = Ie, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
490
+ h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ie, h.lineWidth = Ce, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
491
491
  }
492
492
  function Fe(h, t, e, s, n) {
493
493
  const o = Me, i = we, a = Es;
494
- h.save(), h.translate(t, e), h.rotate(ut.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ce, h.lineWidth = Ie, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
494
+ h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Te, h.strokeStyle = Ie, h.lineWidth = Ce, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
495
495
  }
496
496
  const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ss = new Image();
497
497
  ss.src = Ls;
498
498
  function Ds(h, t, e, s, n) {
499
499
  const i = de / 2;
500
- h.save(), h.translate(t, e), h.rotate(ut.degreesToRadians(n.angle)), h.fillStyle = Os, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(ss, -i / 2, -i / 2, i, i), h.restore();
500
+ h.save(), h.translate(t, e), h.rotate(ft.degreesToRadians(n.angle)), h.fillStyle = Os, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(ss, -i / 2, -i / 2, i, i), h.restore();
501
501
  }
502
502
  const Rs = {
503
503
  // Угловые точки
504
504
  tl: {
505
505
  render: oe,
506
- sizeX: lt,
507
- sizeY: lt,
506
+ sizeX: ht,
507
+ sizeY: ht,
508
508
  offsetX: 0,
509
509
  offsetY: 0
510
510
  },
511
511
  tr: {
512
512
  render: oe,
513
- sizeX: lt,
514
- sizeY: lt,
513
+ sizeX: ht,
514
+ sizeY: ht,
515
515
  offsetX: 0,
516
516
  offsetY: 0
517
517
  },
518
518
  bl: {
519
519
  render: oe,
520
- sizeX: lt,
521
- sizeY: lt,
520
+ sizeX: ht,
521
+ sizeY: ht,
522
522
  offsetX: 0,
523
523
  offsetY: 0
524
524
  },
525
525
  br: {
526
526
  render: oe,
527
- sizeX: lt,
528
- sizeY: lt,
527
+ sizeX: ht,
528
+ sizeY: ht,
529
529
  offsetX: 0,
530
530
  offsetY: 0
531
531
  },
@@ -568,7 +568,7 @@ const Rs = {
568
568
  offsetY: -de
569
569
  }
570
570
  };
571
- class et {
571
+ class st {
572
572
  /**
573
573
  * Отключает изменение ширины по оси X для заблокированных объектов, сохраняя поведение остального хэндлера.
574
574
  */
@@ -598,9 +598,9 @@ class et {
598
598
  */
599
599
  static apply() {
600
600
  const t = Be.createObjectDefaultControls();
601
- et.applyControlOverrides(t), ke.ownDefaults.controls = t;
601
+ st.applyControlOverrides(t), ke.ownDefaults.controls = t;
602
602
  const e = Be.createTextboxDefaultControls();
603
- et.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), et.wrapWidthControl(e.ml), et.wrapWidthControl(e.mr), ot.ownDefaults.controls = e, et.patchActiveSelectionBounds(), ke.ownDefaults.snapAngle = 1;
603
+ st.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), st.wrapWidthControl(e.ml), st.wrapWidthControl(e.mr), it.ownDefaults.controls = e, st.patchActiveSelectionBounds(), ke.ownDefaults.snapAngle = 1;
604
604
  }
605
605
  /**
606
606
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
@@ -610,11 +610,11 @@ class et {
610
610
  t._calcBoundsFromObjects = function(...o) {
611
611
  var f, g;
612
612
  const i = (g = (f = this.getObjects) == null ? void 0 : f.call(this)) != null ? g : [];
613
- et.applyTextSelectionScalingLock({
613
+ st.applyTextSelectionScalingLock({
614
614
  selection: this,
615
615
  objects: i
616
616
  });
617
- const a = et.calculateActiveSelectionBounds({
617
+ const a = st.calculateActiveSelectionBounds({
618
618
  objects: i
619
619
  });
620
620
  if (!a)
@@ -626,45 +626,45 @@ class et {
626
626
  width: d,
627
627
  height: l
628
628
  });
629
- const u = new tt(r + d / 2, c + l / 2);
629
+ const u = new et(r + d / 2, c + l / 2);
630
630
  return this.setPositionByOrigin(u, "center", "center"), a;
631
631
  };
632
632
  const s = t._onAfterObjectsChange;
633
633
  t._onAfterObjectsChange = function(o, i) {
634
634
  var p, m;
635
635
  const a = s ? s.call(this, o, i) : void 0, r = (m = (p = this.getObjects) == null ? void 0 : p.call(this)) != null ? m : [];
636
- et.applyTextSelectionScalingLock({
636
+ st.applyTextSelectionScalingLock({
637
637
  selection: this,
638
638
  objects: r
639
639
  });
640
- const c = et.calculateActiveSelectionBounds({
640
+ const c = st.calculateActiveSelectionBounds({
641
641
  objects: r
642
642
  });
643
643
  if (!c) return a;
644
- const { left: d, top: l, width: u, height: f } = c, g = new tt(d + u / 2, l + f / 2);
644
+ const { left: d, top: l, width: u, height: f } = c, g = new et(d + u / 2, l + f / 2);
645
645
  return this.set({
646
646
  width: u,
647
647
  height: f
648
648
  }), this.setPositionByOrigin(g, "center", "center"), this.setCoords(), a;
649
649
  };
650
- const n = We.prototype.calcBoundingBox;
651
- We.prototype.calcBoundingBox = function(o, i) {
650
+ const n = ze.prototype.calcBoundingBox;
651
+ ze.prototype.calcBoundingBox = function(o, i) {
652
652
  const { target: a, type: r, overrides: c } = i;
653
653
  if (r === "imperative" && c)
654
654
  return c;
655
655
  if (!(a instanceof U))
656
656
  return n.call(this, o, i);
657
- et.applyTextSelectionScalingLock({
657
+ st.applyTextSelectionScalingLock({
658
658
  selection: a,
659
659
  objects: o
660
660
  });
661
- const d = et.calculateActiveSelectionBounds({ objects: o });
661
+ const d = st.calculateActiveSelectionBounds({ objects: o });
662
662
  if (!d)
663
663
  return n.call(this, o, i);
664
- const { left: l, top: u, width: f, height: g } = d, p = new tt(f, g), m = new tt(l + f / 2, u + g / 2);
664
+ const { left: l, top: u, width: f, height: g } = d, p = new et(f, g), m = new et(l + f / 2, u + g / 2);
665
665
  return r === "initialization" ? {
666
666
  center: m,
667
- relativeCorrection: new tt(0, 0),
667
+ relativeCorrection: new et(0, 0),
668
668
  size: p
669
669
  } : {
670
670
  center: m,
@@ -694,7 +694,7 @@ class et {
694
694
  selection: t,
695
695
  objects: e
696
696
  }) {
697
- const s = e.some((n) => n instanceof ot);
697
+ const s = e.some((n) => n instanceof it);
698
698
  t.setControlsVisibility({
699
699
  mt: !s,
700
700
  mb: !s,
@@ -703,7 +703,7 @@ class et {
703
703
  });
704
704
  }
705
705
  }
706
- const P = class P {
706
+ const W = class W {
707
707
  constructor(t = []) {
708
708
  this.fonts = t;
709
709
  }
@@ -711,36 +711,36 @@ const P = class P {
711
711
  this.fonts = t;
712
712
  }
713
713
  loadFonts() {
714
- return z(this, null, function* () {
714
+ return P(this, null, function* () {
715
715
  var n;
716
716
  const t = (n = this.fonts) != null ? n : [];
717
717
  if (!t.length) return;
718
718
  const e = typeof document != "undefined" ? document : void 0;
719
719
  if (!e) return;
720
- const s = t.map((o) => P.loadFont(o, e));
720
+ const s = t.map((o) => W.loadFont(o, e));
721
721
  yield Promise.allSettled(s);
722
722
  });
723
723
  }
724
724
  static loadFont(t, e) {
725
- return z(this, null, function* () {
725
+ return P(this, null, function* () {
726
726
  var c, d;
727
727
  const s = typeof FontFace != "undefined", n = (c = t.family) == null ? void 0 : c.trim(), o = (d = t.source) == null ? void 0 : d.trim();
728
728
  if (!n || !o) return;
729
- const i = P.normalizeFontSource(o), a = P.getDescriptorSnapshot(t.descriptors), r = P.getFontRegistrationKey(n, i, a);
730
- if (!P.registeredFontKeys.has(r)) {
731
- if (P.isFontFaceAlreadyApplied(e, n, a)) {
732
- P.registeredFontKeys.add(r);
729
+ const i = W.normalizeFontSource(o), a = W.getDescriptorSnapshot(t.descriptors), r = W.getFontRegistrationKey(n, i, a);
730
+ if (!W.registeredFontKeys.has(r)) {
731
+ if (W.isFontFaceAlreadyApplied(e, n, a)) {
732
+ W.registeredFontKeys.add(r);
733
733
  return;
734
734
  }
735
735
  if (s && e.fonts && typeof e.fonts.add == "function")
736
736
  try {
737
737
  const u = yield new FontFace(n, i, t.descriptors).load();
738
- e.fonts.add(u), P.registeredFontKeys.add(r);
738
+ e.fonts.add(u), W.registeredFontKeys.add(r);
739
739
  return;
740
740
  } catch (l) {
741
741
  console.warn(`Не удалось загрузить шрифт "${n}" через FontFace API`, l);
742
742
  }
743
- P.injectFontFace({
743
+ W.injectFontFace({
744
744
  font: t,
745
745
  source: i,
746
746
  doc: e,
@@ -760,15 +760,15 @@ const P = class P {
760
760
  if (!i) return;
761
761
  const a = s.createElement("style");
762
762
  a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", n);
763
- const r = P.descriptorsToCss(o), c = [
763
+ const r = W.descriptorsToCss(o), c = [
764
764
  "@font-face {",
765
- ` font-family: ${P.formatFontFamilyForCss(i)};`,
765
+ ` font-family: ${W.formatFontFamilyForCss(i)};`,
766
766
  ` src: ${e};`,
767
767
  ...r.map((l) => ` ${l}`),
768
768
  "}"
769
769
  ];
770
770
  a.textContent = c.join(`
771
- `), s.head.appendChild(a), P.registeredFontKeys.add(n);
771
+ `), s.head.appendChild(a), W.registeredFontKeys.add(n);
772
772
  }
773
773
  static normalizeFontSource(t) {
774
774
  const e = t.trim();
@@ -791,15 +791,15 @@ const P = class P {
791
791
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
792
792
  }
793
793
  static getDescriptorSnapshot(t) {
794
- const e = P.descriptorDefaults;
794
+ const e = W.descriptorDefaults;
795
795
  return {
796
- style: P.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
797
- weight: P.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
798
- stretch: P.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
799
- unicodeRange: P.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
800
- variant: P.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
801
- featureSettings: P.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
802
- display: P.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
796
+ style: W.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
797
+ weight: W.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
798
+ stretch: W.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
799
+ unicodeRange: W.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
800
+ variant: W.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
801
+ featureSettings: W.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
802
+ display: W.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
803
803
  };
804
804
  }
805
805
  static areDescriptorSnapshotsEqual(t, e) {
@@ -807,7 +807,7 @@ const P = class P {
807
807
  }
808
808
  static getFontRegistrationKey(t, e, s) {
809
809
  return [
810
- P.normalizeFamilyName(t),
810
+ W.normalizeFamilyName(t),
811
811
  e,
812
812
  s.style,
813
813
  s.weight,
@@ -821,12 +821,12 @@ const P = class P {
821
821
  static isFontFaceAlreadyApplied(t, e, s) {
822
822
  const n = t.fonts;
823
823
  if (!n || typeof n.forEach != "function") return !1;
824
- const o = P.normalizeFamilyName(e);
824
+ const o = W.normalizeFamilyName(e);
825
825
  let i = !1;
826
826
  try {
827
827
  n.forEach((a) => {
828
- if (i || P.normalizeFamilyName(a.family) !== o) return;
829
- const c = P.getDescriptorSnapshot({
828
+ if (i || W.normalizeFamilyName(a.family) !== o) return;
829
+ const c = W.getDescriptorSnapshot({
830
830
  style: a.style,
831
831
  weight: a.weight,
832
832
  stretch: a.stretch,
@@ -835,7 +835,7 @@ const P = class P {
835
835
  featureSettings: a.featureSettings,
836
836
  display: a.display
837
837
  });
838
- P.areDescriptorSnapshotsEqual(s, c) && (i = !0);
838
+ W.areDescriptorSnapshotsEqual(s, c) && (i = !0);
839
839
  });
840
840
  } catch (a) {
841
841
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
@@ -862,7 +862,7 @@ const P = class P {
862
862
  });
863
863
  }
864
864
  };
865
- P.registeredFontKeys = /* @__PURE__ */ new Set(), P.descriptorDefaults = {
865
+ W.registeredFontKeys = /* @__PURE__ */ new Set(), W.descriptorDefaults = {
866
866
  style: "normal",
867
867
  weight: "normal",
868
868
  stretch: "normal",
@@ -871,8 +871,8 @@ P.registeredFontKeys = /* @__PURE__ */ new Set(), P.descriptorDefaults = {
871
871
  featureSettings: "normal",
872
872
  display: "auto"
873
873
  };
874
- let Se = P;
875
- const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Ns = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWx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SAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Vt = {
876
876
  style: {
877
877
  position: "absolute",
878
878
  display: "none",
@@ -940,16 +940,16 @@ const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
940
940
  offsetTop: 50,
941
941
  icons: {
942
942
  copyPaste: _s,
943
- delete: Ps,
944
- lock: Ns,
945
- unlock: xs,
946
- bringToFront: Ws,
947
- sendToBack: zs,
943
+ delete: Ws,
944
+ lock: xs,
945
+ unlock: Ns,
946
+ bringToFront: zs,
947
+ sendToBack: Ps,
948
948
  bringForward: Bs,
949
949
  sendBackwards: ks
950
950
  },
951
951
  handlers: {
952
- copyPaste: (h) => z(null, null, function* () {
952
+ copyPaste: (h) => P(null, null, function* () {
953
953
  h.clipboardManager.copyPaste();
954
954
  }),
955
955
  delete: (h) => {
@@ -982,11 +982,11 @@ class Us {
982
982
  _initToolbar() {
983
983
  if (!this.options.showToolbar) return;
984
984
  const t = this.options.toolbar || {};
985
- this.config = wt(B(B({}, Gt), t), {
986
- style: B(B({}, Gt.style), t.style || {}),
987
- btnStyle: B(B({}, Gt.btnStyle), t.btnStyle || {}),
988
- icons: B(B({}, Gt.icons), t.icons || {}),
989
- handlers: B(B({}, Gt.handlers), t.handlers || {})
985
+ this.config = St(B(B({}, Vt), t), {
986
+ style: B(B({}, Vt.style), t.style || {}),
987
+ btnStyle: B(B({}, Vt.btnStyle), t.btnStyle || {}),
988
+ icons: B(B({}, Vt.icons), t.icons || {}),
989
+ handlers: B(B({}, Vt.handlers), t.handlers || {})
990
990
  }), 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 = () => {
991
991
  this.el.style.display = "none";
992
992
  }, this._createDOM(), this._bindEvents();
@@ -1211,8 +1211,6 @@ class Ee {
1211
1211
  }
1212
1212
  }
1213
1213
  const ns = [
1214
- "selectable",
1215
- "evented",
1216
1214
  "id",
1217
1215
  "backgroundId",
1218
1216
  "customData",
@@ -1222,6 +1220,8 @@ const ns = [
1222
1220
  "height",
1223
1221
  "locked",
1224
1222
  "editable",
1223
+ "evented",
1224
+ "selectable",
1225
1225
  "lockMovementX",
1226
1226
  "lockMovementY",
1227
1227
  "lockRotation",
@@ -1246,7 +1246,7 @@ const ns = [
1246
1246
  "radiusBottomRight",
1247
1247
  "radiusBottomLeft"
1248
1248
  ];
1249
- class Kt {
1249
+ class Z {
1250
1250
  constructor({ editor: t }) {
1251
1251
  this.editor = t, this.canvas = t.canvas, this._isSavingState = !1, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = t.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
1252
1252
  }
@@ -1260,48 +1260,7 @@ class Kt {
1260
1260
  _createDiffPatcher() {
1261
1261
  this.diffPatcher = Ms({
1262
1262
  objectHash(t) {
1263
- const e = t, s = t, n = s.styles ? JSON.stringify(s.styles) : "", o = e.customData ? JSON.stringify(e.customData) : "";
1264
- return [
1265
- e.id,
1266
- e.backgroundId,
1267
- e.format,
1268
- e.locked,
1269
- e.left,
1270
- e.top,
1271
- e.width,
1272
- e.height,
1273
- e.flipX,
1274
- e.flipY,
1275
- e.scaleX,
1276
- e.scaleY,
1277
- e.angle,
1278
- e.opacity,
1279
- o,
1280
- s.text,
1281
- s.textCaseRaw,
1282
- s.uppercase,
1283
- s.fontFamily,
1284
- s.fontSize,
1285
- s.fontWeight,
1286
- s.fontStyle,
1287
- s.underline,
1288
- s.linethrough,
1289
- s.textAlign,
1290
- s.fill,
1291
- s.stroke,
1292
- s.strokeWidth,
1293
- n,
1294
- s.paddingTop,
1295
- s.paddingRight,
1296
- s.paddingBottom,
1297
- s.paddingLeft,
1298
- s.backgroundColor,
1299
- s.backgroundOpacity,
1300
- s.radiusTopLeft,
1301
- s.radiusTopRight,
1302
- s.radiusBottomRight,
1303
- s.radiusBottomLeft
1304
- ].join("-");
1263
+ return [JSON.stringify(t)].join("-");
1305
1264
  },
1306
1265
  arrays: {
1307
1266
  detectMove: !0,
@@ -1359,17 +1318,217 @@ class Kt {
1359
1318
  }
1360
1319
  const e = this.getFullState();
1361
1320
  console.log("prevState", e);
1362
- const s = this.diffPatcher.diff(e, t);
1363
- if (!s) {
1321
+ const {
1322
+ prevState: s,
1323
+ nextState: n
1324
+ } = Z._prepareStatesForDiff({
1325
+ prevState: e,
1326
+ nextState: t
1327
+ }), o = this.diffPatcher.diff(s, n);
1328
+ if (!o) {
1364
1329
  console.log("Нет изменений для сохранения.");
1365
1330
  return;
1366
1331
  }
1367
- console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: V(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1332
+ if (Z._areStatesEqual({
1333
+ prevState: s,
1334
+ nextState: n
1335
+ })) {
1336
+ console.log("statesEqual. Нет изменений для сохранения.");
1337
+ return;
1338
+ }
1339
+ console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", o), this.totalChangesCount += 1, this.patches.push({ id: X(), diff: o }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1368
1340
  } finally {
1369
1341
  this._isSavingState = !1;
1370
1342
  }
1371
1343
  }
1372
1344
  }
1345
+ /**
1346
+ * Подготавливает состояния для расчёта diff: нормализует технические изменения
1347
+ * и компенсирует смещения при ресайзе окна.
1348
+ */
1349
+ static _prepareStatesForDiff({
1350
+ prevState: t,
1351
+ nextState: e
1352
+ }) {
1353
+ const s = Z._cloneState({ state: t }), n = Z._cloneState({ state: e });
1354
+ return Z._normalizeTextBackground({ objects: s.objects }), Z._normalizeTextBackground({ objects: n.objects }), Z._normalizeCanvasSize({
1355
+ prevState: s,
1356
+ nextState: n
1357
+ }), Z._normalizeTranslation({
1358
+ prevState: s,
1359
+ nextState: n
1360
+ }), {
1361
+ prevState: s,
1362
+ nextState: n
1363
+ };
1364
+ }
1365
+ /**
1366
+ * Делает глубокую копию состояния канваса.
1367
+ * @param state - исходное состояние
1368
+ */
1369
+ static _cloneState({ state: t }) {
1370
+ return JSON.parse(JSON.stringify(t));
1371
+ }
1372
+ /**
1373
+ * Проверяет, равны ли два состояния после нормализации с учётом устойчивого порядка ключей.
1374
+ * @param prevState - предыдущее состояние
1375
+ * @param nextState - следующее состояние
1376
+ */
1377
+ static _areStatesEqual({
1378
+ prevState: t,
1379
+ nextState: e
1380
+ }) {
1381
+ const s = Z._stableStringify({ value: t }), n = Z._stableStringify({ value: e });
1382
+ return s === n;
1383
+ }
1384
+ /**
1385
+ * Делает устойчивую сериализацию значения с сортировкой ключей объектов.
1386
+ * @param value - значение для сериализации
1387
+ */
1388
+ static _stableStringify({ value: t }) {
1389
+ const e = ({ value: s }) => {
1390
+ if (Array.isArray(s)) {
1391
+ const n = [];
1392
+ for (let o = 0; o < s.length; o += 1)
1393
+ n.push(e({ value: s[o] }));
1394
+ return n;
1395
+ }
1396
+ if (s && typeof s == "object") {
1397
+ const n = {}, o = Object.keys(s).sort();
1398
+ for (let i = 0; i < o.length; i += 1) {
1399
+ const a = o[i];
1400
+ n[a] = e({
1401
+ value: s[a]
1402
+ });
1403
+ }
1404
+ return n;
1405
+ }
1406
+ return s;
1407
+ };
1408
+ return JSON.stringify(e({ value: t }));
1409
+ }
1410
+ /**
1411
+ * Нормализует backgroundColor у текстовых объектов без фона, чтобы избежать шумовых диффов.
1412
+ * @param objects - список объектов канваса
1413
+ */
1414
+ static _normalizeTextBackground({ objects: t }) {
1415
+ for (let e = 0; e < t.length; e += 1) {
1416
+ const s = t[e], {
1417
+ type: n,
1418
+ backgroundOpacity: o,
1419
+ backgroundColor: i,
1420
+ textBackgroundColor: a
1421
+ } = s, r = typeof o == "number" ? o : 0, c = typeof i == "string" ? i : "", d = typeof a == "string" ? a : "", l = n === "textbox" || n === "i-text" || n === "text" || n === "background-textbox", u = c.length > 0 || d.length > 0;
1422
+ l && (r > 0 && u || (s.backgroundColor = null, s.textBackgroundColor = null));
1423
+ }
1424
+ }
1425
+ /**
1426
+ * Игнорирует изменения размеров канваса, если размер монтажной области не менялся.
1427
+ * Это устраняет диффы от ресайза окна без влияния на историю документа.
1428
+ */
1429
+ static _normalizeCanvasSize({
1430
+ prevState: t,
1431
+ nextState: e
1432
+ }) {
1433
+ const { width: s, height: n, objects: o } = t, { objects: i } = e, {
1434
+ width: a,
1435
+ height: r
1436
+ } = Z._getMontageAreaSize({ objects: o }), {
1437
+ width: c,
1438
+ height: d
1439
+ } = Z._getMontageAreaSize({ objects: i });
1440
+ a !== c || r !== d || (e.width = s, e.height = n);
1441
+ }
1442
+ /**
1443
+ * Компенсирует смещение монтажной области, чтобы не сохранять ресайз как изменение истории.
1444
+ */
1445
+ static _normalizeTranslation({
1446
+ prevState: t,
1447
+ nextState: e
1448
+ }) {
1449
+ const { objects: s, clipPath: n } = t, { objects: o, clipPath: i } = e, {
1450
+ left: a,
1451
+ top: r
1452
+ } = Z._getMontageAreaPosition({ objects: s }), {
1453
+ left: c,
1454
+ top: d
1455
+ } = Z._getMontageAreaPosition({ objects: o }), l = c - a, u = d - r;
1456
+ if (l === 0 && u === 0) return;
1457
+ const f = Z._getObjectById({
1458
+ objects: o,
1459
+ id: "montage-area"
1460
+ });
1461
+ f && (f.left = a, f.top = r);
1462
+ const g = Z._getClipPathPosition({ clipPath: n });
1463
+ if (g && i && typeof i == "object") {
1464
+ const { left: m, top: v } = g, w = i;
1465
+ w.left = m, w.top = v;
1466
+ }
1467
+ const p = Z._getTranslationIgnoredIds();
1468
+ for (let m = 0; m < o.length; m += 1) {
1469
+ const v = o[m], { id: w } = v;
1470
+ w && p.has(w) || (typeof v.left == "number" && (v.left -= l), typeof v.top == "number" && (v.top -= u));
1471
+ }
1472
+ }
1473
+ /**
1474
+ * Возвращает позицию clipPath из состояния, если она доступна.
1475
+ */
1476
+ static _getClipPathPosition({
1477
+ clipPath: t
1478
+ }) {
1479
+ if (!t || typeof t != "object") return null;
1480
+ const { left: e, top: s } = t;
1481
+ return typeof e != "number" || typeof s != "number" ? null : { left: e, top: s };
1482
+ }
1483
+ /**
1484
+ * Возвращает позицию монтажной области из списка объектов.
1485
+ */
1486
+ static _getMontageAreaPosition({
1487
+ objects: t
1488
+ }) {
1489
+ const e = Z._getObjectById({
1490
+ objects: t,
1491
+ id: "montage-area"
1492
+ });
1493
+ if (!e)
1494
+ return { left: 0, top: 0 };
1495
+ const { left: s = 0, top: n = 0 } = e;
1496
+ return { left: s, top: n };
1497
+ }
1498
+ /**
1499
+ * Возвращает размеры монтажной области из списка объектов.
1500
+ */
1501
+ static _getMontageAreaSize({
1502
+ objects: t
1503
+ }) {
1504
+ const e = Z._getObjectById({
1505
+ objects: t,
1506
+ id: "montage-area"
1507
+ });
1508
+ if (!e)
1509
+ return { width: 0, height: 0 };
1510
+ const { width: s = 0, height: n = 0 } = e;
1511
+ return { width: s, height: n };
1512
+ }
1513
+ /**
1514
+ * Находит объект по id в массиве объектов канваса.
1515
+ */
1516
+ static _getObjectById({
1517
+ objects: t,
1518
+ id: e
1519
+ }) {
1520
+ for (let s = 0; s < t.length; s += 1) {
1521
+ const n = t[s];
1522
+ if (n.id === e) return n;
1523
+ }
1524
+ return null;
1525
+ }
1526
+ /**
1527
+ * Возвращает набор id объектов, которые не должны сдвигаться при нормализации.
1528
+ */
1529
+ static _getTranslationIgnoredIds() {
1530
+ return /* @__PURE__ */ new Set(["montage-area", "overlay-mask", "background"]);
1531
+ }
1373
1532
  /**
1374
1533
  * Создаёт безопасную копию состояния для загрузки в canvas.
1375
1534
  * customData сериализуется, чтобы Fabric не обрабатывал её как параметры объекта.
@@ -1411,7 +1570,7 @@ class Kt {
1411
1570
  for (let c = 0; c < i.length; c += 1) {
1412
1571
  const d = i[c], { id: l } = d;
1413
1572
  let u;
1414
- typeof l == "string" && (u = n.get(l)), u || (u = o.get(c)), u && (d.customData = Kt._cloneCustomData({ customData: u }));
1573
+ typeof l == "string" && (u = n.get(l)), u || (u = o.get(c)), u && (d.customData = Z._cloneCustomData({ customData: u }));
1415
1574
  }
1416
1575
  }
1417
1576
  /**
@@ -1427,13 +1586,13 @@ class Kt {
1427
1586
  * @fires editor:history-state-loaded
1428
1587
  */
1429
1588
  loadStateFromFullState(t) {
1430
- return z(this, null, function* () {
1589
+ return P(this, null, function* () {
1431
1590
  if (!t) return;
1432
1591
  console.log("loadStateFromFullState fullState", t);
1433
1592
  const { canvas: e, canvasManager: s, interactionBlocker: n, backgroundManager: o } = this.editor, { width: i, height: a } = e;
1434
1593
  n.overlayMask = null;
1435
- const r = Kt._createLoadSafeState({ state: t });
1436
- yield e.loadFromJSON(r), Kt._applyCustomDataFromState({ state: t, canvas: e });
1594
+ const r = Z._createLoadSafeState({ state: t });
1595
+ yield e.loadFromJSON(r), Z._applyCustomDataFromState({ state: t, canvas: e });
1437
1596
  const c = e.getObjects().find((u) => u.id === "montage-area");
1438
1597
  c && (this.editor.montageArea = c, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1439
1598
  const d = e.getObjects().find((u) => u.id === "overlay-mask");
@@ -1454,7 +1613,7 @@ class Kt {
1454
1613
  * @fires editor:undo
1455
1614
  */
1456
1615
  undo() {
1457
- return z(this, null, function* () {
1616
+ return P(this, null, function* () {
1458
1617
  if (!this.skipHistory) {
1459
1618
  if (this.saveState(), this.currentIndex <= 0) {
1460
1619
  console.log("Нет предыдущих состояний для отмены.");
@@ -1491,9 +1650,9 @@ class Kt {
1491
1650
  * @fires editor:redo
1492
1651
  */
1493
1652
  redo() {
1494
- return z(this, null, function* () {
1653
+ return P(this, null, function* () {
1495
1654
  if (!this.skipHistory) {
1496
- if (this.saveState(), this.currentIndex >= this.patches.length) {
1655
+ if (this.currentIndex >= this.patches.length) {
1497
1656
  console.log("Нет состояний для повтора.");
1498
1657
  return;
1499
1658
  }
@@ -1528,7 +1687,7 @@ class Kt {
1528
1687
  const e = [];
1529
1688
  ((i = (o = (n = this.canvas).getObjects) == null ? void 0 : o.call(n)) != null ? i : []).forEach((a) => {
1530
1689
  const r = typeof a.type == "string" ? a.type.toLowerCase() : "";
1531
- if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean") || a.locked) return;
1690
+ if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean" || r === "background-textbox") || a.locked) return;
1532
1691
  const d = !!a.lockMovementX, l = !!a.lockMovementY;
1533
1692
  !d && !l || (e.push({
1534
1693
  object: a,
@@ -1546,7 +1705,7 @@ class Kt {
1546
1705
  }
1547
1706
  }
1548
1707
  }
1549
- const Hs = 0.1, Zs = 2, Ze = 0.1, Gs = 90, Rt = 16, _t = 16, At = 4096, jt = 4096, Ge = "application/image-editor:", ie = [
1708
+ const Hs = 0.1, Zs = 2, Ze = 0.1, Gs = 90, _t = 16, xt = 16, jt = 4096, Ct = 4096, Ge = "application/image-editor:", ie = [
1550
1709
  "format",
1551
1710
  "uppercase",
1552
1711
  "textCaseRaw",
@@ -1561,7 +1720,7 @@ const Hs = 0.1, Zs = 2, Ze = 0.1, Gs = 90, Rt = 16, _t = 16, At = 4096, jt = 409
1561
1720
  "radiusBottomRight",
1562
1721
  "radiusBottomLeft"
1563
1722
  ], Vs = 50;
1564
- class ht {
1723
+ class ut {
1565
1724
  constructor({ editor: t }) {
1566
1725
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1567
1726
  }
@@ -1578,7 +1737,7 @@ class ht {
1578
1737
  * @returns возвращает Promise с объектом изображения или null в случае ошибки
1579
1738
  */
1580
1739
  importImage(t) {
1581
- return z(this, null, function* () {
1740
+ return P(this, null, function* () {
1582
1741
  const {
1583
1742
  source: e,
1584
1743
  scale: s = `image-${this.options.scaleType}`,
@@ -1590,7 +1749,7 @@ class ht {
1590
1749
  customData: c = null
1591
1750
  } = t;
1592
1751
  if (!e) return null;
1593
- const { canvas: d, montageArea: l, transformManager: u, historyManager: f, errorManager: g } = this.editor, p = yield this.getContentType(e), m = ht.getFormatFromContentType(p), { acceptContentTypes: v, acceptFormats: S } = this;
1752
+ const { canvas: d, montageArea: l, transformManager: u, historyManager: f, errorManager: g } = this.editor, p = yield this.getContentType(e), m = ut.getFormatFromContentType(p), { acceptContentTypes: v, acceptFormats: w } = this;
1594
1753
  if (!this.isAllowedContentType(p)) {
1595
1754
  const A = `Неверный contentType для изображения: ${p}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1596
1755
  return g.emitError({
@@ -1603,7 +1762,7 @@ class ht {
1603
1762
  format: m,
1604
1763
  contentType: p,
1605
1764
  acceptContentTypes: v,
1606
- acceptFormats: S,
1765
+ acceptFormats: w,
1607
1766
  fromClipboard: o,
1608
1767
  isBackground: i,
1609
1768
  withoutSelection: a,
@@ -1631,7 +1790,7 @@ class ht {
1631
1790
  format: m,
1632
1791
  contentType: p,
1633
1792
  acceptContentTypes: v,
1634
- acceptFormats: S,
1793
+ acceptFormats: w,
1635
1794
  fromClipboard: o,
1636
1795
  isBackground: i,
1637
1796
  withoutSelection: a,
@@ -1640,29 +1799,29 @@ class ht {
1640
1799
  }
1641
1800
  }), null;
1642
1801
  if (this._createdBlobUrls.push(A), m === "svg") {
1643
- const w = yield us(A);
1644
- y = ut.groupSVGElements(w.objects, w.options);
1802
+ const S = yield us(A);
1803
+ y = ft.groupSVGElements(S.objects, S.options);
1645
1804
  } else
1646
- y = yield Zt.fromURL(A, { crossOrigin: "anonymous" });
1805
+ y = yield Gt.fromURL(A, { crossOrigin: "anonymous" });
1647
1806
  const { width: b, height: j } = y;
1648
- if (y instanceof Zt) {
1649
- const w = y.getElement();
1807
+ if (y instanceof Gt) {
1808
+ const S = y.getElement();
1650
1809
  let T = "";
1651
- if (w instanceof HTMLImageElement ? T = w.src : w instanceof HTMLCanvasElement && (T = w.toDataURL()), j > jt || b > At) {
1652
- const M = yield this.resizeImageToBoundaries(T, "max"), C = URL.createObjectURL(M);
1653
- this._createdBlobUrls.push(C), y = yield Zt.fromURL(C, { crossOrigin: "anonymous" });
1654
- } else if (j < _t || b < Rt) {
1655
- const M = yield this.resizeImageToBoundaries(T, "min"), C = URL.createObjectURL(M);
1656
- this._createdBlobUrls.push(C), y = yield Zt.fromURL(C, { crossOrigin: "anonymous" });
1810
+ if (S instanceof HTMLImageElement ? T = S.src : S instanceof HTMLCanvasElement && (T = S.toDataURL()), j > Ct || b > jt) {
1811
+ const M = yield this.resizeImageToBoundaries(T, "max"), I = URL.createObjectURL(M);
1812
+ this._createdBlobUrls.push(I), y = yield Gt.fromURL(I, { crossOrigin: "anonymous" });
1813
+ } else if (j < xt || b < _t) {
1814
+ const M = yield this.resizeImageToBoundaries(T, "min"), I = URL.createObjectURL(M);
1815
+ this._createdBlobUrls.push(I), y = yield Gt.fromURL(I, { crossOrigin: "anonymous" });
1657
1816
  }
1658
1817
  }
1659
- if (y.set("id", `${y.type}-${V()}`), y.set("format", m), y.set("customData", c || null), s === "scale-montage")
1818
+ if (y.set("id", `${y.type}-${X()}`), y.set("format", m), y.set("customData", c || null), s === "scale-montage")
1660
1819
  this.editor.canvasManager.scaleMontageAreaToImage({ object: y, withoutSave: !0 });
1661
1820
  else {
1662
- const { width: w, height: T } = l, M = this.calculateScaleFactor({ imageObject: y, scaleType: s });
1663
- s === "image-contain" && M < 1 ? u.fitObject({ object: y, type: "contain", withoutSave: !0 }) : s === "image-cover" && (b > w || j > T) && u.fitObject({ object: y, type: "cover", withoutSave: !0 });
1821
+ const { width: S, height: T } = l, M = this.calculateScaleFactor({ imageObject: y, scaleType: s });
1822
+ s === "image-contain" && M < 1 ? u.fitObject({ object: y, type: "contain", withoutSave: !0 }) : s === "image-cover" && (b > S || j > T) && u.fitObject({ object: y, type: "cover", withoutSave: !0 });
1664
1823
  }
1665
- const I = {
1824
+ const C = {
1666
1825
  image: y,
1667
1826
  format: m,
1668
1827
  contentType: p,
@@ -1675,7 +1834,7 @@ class ht {
1675
1834
  withoutAdding: r,
1676
1835
  customData: c
1677
1836
  };
1678
- return r ? (f.resumeHistory(), d.fire("editor:image-imported", I), I) : (d.add(y), d.centerObject(y), a || d.setActiveObject(y), d.renderAll(), f.resumeHistory(), n || f.saveState(), d.fire("editor:image-imported", I), I);
1837
+ return r ? (f.resumeHistory(), d.fire("editor:image-imported", C), C) : (d.add(y), d.centerObject(y), a || d.setActiveObject(y), d.renderAll(), f.resumeHistory(), n || f.saveState(), d.fire("editor:image-imported", C), C);
1679
1838
  } catch (A) {
1680
1839
  return g.emitError({
1681
1840
  origin: "ImageManager",
@@ -1707,16 +1866,16 @@ class ht {
1707
1866
  * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1708
1867
  */
1709
1868
  resizeImageToBoundaries(t, e = "max") {
1710
- return z(this, null, function* () {
1711
- let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${At}x${jt}`;
1712
- e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Rt}x${_t}`);
1869
+ return P(this, null, function* () {
1870
+ let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${jt}x${Ct}`;
1871
+ e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${_t}x${xt}`);
1713
1872
  const n = {
1714
1873
  dataURL: t,
1715
1874
  sizeType: e,
1716
- maxWidth: At,
1717
- maxHeight: jt,
1718
- minWidth: Rt,
1719
- minHeight: _t
1875
+ maxWidth: jt,
1876
+ maxHeight: Ct,
1877
+ minWidth: _t,
1878
+ minHeight: xt
1720
1879
  };
1721
1880
  return this.editor.errorManager.emitWarning({
1722
1881
  origin: "ImageManager",
@@ -1739,7 +1898,7 @@ class ht {
1739
1898
  * @fires editor:canvas-exported
1740
1899
  */
1741
1900
  exportCanvasAsImageFile() {
1742
- return z(this, arguments, function* (t = {}) {
1901
+ return P(this, arguments, function* (t = {}) {
1743
1902
  const {
1744
1903
  fileName: e = "image.png",
1745
1904
  contentType: s = "image/png",
@@ -1747,13 +1906,13 @@ class ht {
1747
1906
  exportAsBlob: o = !1
1748
1907
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
1749
1908
  try {
1750
- const d = s === "application/pdf", l = d ? "image/jpg" : s, u = ht.getFormatFromContentType(l);
1909
+ const d = s === "application/pdf", l = d ? "image/jpg" : s, u = ut.getFormatFromContentType(l);
1751
1910
  a.setCoords();
1752
1911
  const { left: f, top: g, width: p, height: m } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
1753
1912
  v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
1754
- const S = v.getObjects().find((M) => M.id === a.id);
1755
- if (S && (S.visible = !1), c != null && c.isBlocked) {
1756
- const M = v.getObjects().find((C) => C.id === c.overlayMask.id);
1913
+ const w = v.getObjects().find((M) => M.id === a.id);
1914
+ if (w && (w.visible = !1), c != null && c.isBlocked) {
1915
+ const M = v.getObjects().find((I) => I.id === c.overlayMask.id);
1757
1916
  M && (M.visible = !1);
1758
1917
  }
1759
1918
  v.viewportTransform = [1, 0, 0, 1, -f, -g], v.setDimensions({ width: p, height: m }, { backstoreOnly: !0 }), v.renderAll();
@@ -1762,7 +1921,7 @@ class ht {
1762
1921
  const M = v.toSVG();
1763
1922
  v.dispose();
1764
1923
  const E = {
1765
- image: ht._exportSVGStringAsFile(M, {
1924
+ image: ut._exportSVGStringAsFile(M, {
1766
1925
  exportAsBase64: n,
1767
1926
  exportAsBlob: o,
1768
1927
  fileName: e
@@ -1773,9 +1932,9 @@ class ht {
1773
1932
  };
1774
1933
  return i.fire("editor:canvas-exported", E), E;
1775
1934
  }
1776
- const y = yield new Promise((M, C) => {
1935
+ const y = yield new Promise((M, I) => {
1777
1936
  v.getElement().toBlob((E) => {
1778
- E ? M(E) : C(new Error("Failed to create Blob from canvas"));
1937
+ E ? M(E) : I(new Error("Failed to create Blob from canvas"));
1779
1938
  });
1780
1939
  });
1781
1940
  if (v.dispose(), o) {
@@ -1793,27 +1952,27 @@ class ht {
1793
1952
  [b]
1794
1953
  );
1795
1954
  if (d) {
1796
- const C = p * 0.264583, E = m * 0.264583, W = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, N = new W({
1797
- orientation: C > E ? "landscape" : "portrait",
1955
+ const I = p * 0.264583, E = m * 0.264583, z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, x = new z({
1956
+ orientation: I > E ? "landscape" : "portrait",
1798
1957
  unit: "mm",
1799
- format: [C, E]
1958
+ format: [I, E]
1800
1959
  });
1801
- if (N.addImage(String(j), "JPG", 0, 0, C, E), n) {
1960
+ if (x.addImage(String(j), "JPG", 0, 0, I, E), n) {
1802
1961
  const H = {
1803
- image: N.output("datauristring"),
1962
+ image: x.output("datauristring"),
1804
1963
  format: "pdf",
1805
1964
  contentType: "application/pdf",
1806
1965
  fileName: e
1807
1966
  };
1808
1967
  return i.fire("editor:canvas-exported", H), H;
1809
1968
  }
1810
- const x = N.output("blob"), G = {
1811
- image: new File([x], e, { type: "application/pdf" }),
1969
+ const N = x.output("blob"), V = {
1970
+ image: new File([N], e, { type: "application/pdf" }),
1812
1971
  format: "pdf",
1813
1972
  contentType: "application/pdf",
1814
1973
  fileName: e
1815
1974
  };
1816
- return i.fire("editor:canvas-exported", G), G;
1975
+ return i.fire("editor:canvas-exported", V), V;
1817
1976
  }
1818
1977
  if (n) {
1819
1978
  const M = {
@@ -1824,11 +1983,11 @@ class ht {
1824
1983
  };
1825
1984
  return i.fire("editor:canvas-exported", M), M;
1826
1985
  }
1827
- const I = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1828
- image: new File([y], I, { type: l }),
1986
+ const C = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1987
+ image: new File([y], C, { type: l }),
1829
1988
  format: u,
1830
1989
  contentType: l,
1831
- fileName: I
1990
+ fileName: C
1832
1991
  };
1833
1992
  return i.fire("editor:canvas-exported", T), T;
1834
1993
  } catch (d) {
@@ -1854,7 +2013,7 @@ class ht {
1854
2013
  * @fires editor:object-exported
1855
2014
  */
1856
2015
  exportObjectAsImageFile() {
1857
- return z(this, arguments, function* (t = {}) {
2016
+ return P(this, arguments, function* (t = {}) {
1858
2017
  const {
1859
2018
  object: e,
1860
2019
  fileName: s = "image.png",
@@ -1871,9 +2030,9 @@ class ht {
1871
2030
  data: { contentType: n, fileName: s, exportAsBase64: o, exportAsBlob: i }
1872
2031
  }), null;
1873
2032
  try {
1874
- const d = ht.getFormatFromContentType(n);
2033
+ const d = ut.getFormatFromContentType(n);
1875
2034
  if (d === "svg") {
1876
- const p = c.toSVG(), m = ht._exportSVGStringAsFile(p, {
2035
+ const p = c.toSVG(), m = ut._exportSVGStringAsFile(p, {
1877
2036
  exportAsBase64: o,
1878
2037
  exportAsBlob: i,
1879
2038
  fileName: s
@@ -1886,7 +2045,7 @@ class ht {
1886
2045
  };
1887
2046
  return a.fire("editor:object-exported", v), v;
1888
2047
  }
1889
- if (o && c instanceof Zt) {
2048
+ if (o && c instanceof Gt) {
1890
2049
  const p = yield createImageBitmap(c.getElement()), m = yield r.post(
1891
2050
  "toDataURL",
1892
2051
  {
@@ -1951,7 +2110,7 @@ class ht {
1951
2110
  * @returns массив допустимых форматов изображений
1952
2111
  */
1953
2112
  getAllowedFormatsFromContentTypes() {
1954
- return this.acceptContentTypes.map((t) => ht.getFormatFromContentType(t)).filter((t) => t);
2113
+ return this.acceptContentTypes.map((t) => ut.getFormatFromContentType(t)).filter((t) => t);
1955
2114
  }
1956
2115
  /**
1957
2116
  * Проверяет, является ли contentType допустимым типом изображения.
@@ -1967,7 +2126,7 @@ class ht {
1967
2126
  * @public
1968
2127
  */
1969
2128
  getContentType(t) {
1970
- return z(this, null, function* () {
2129
+ return P(this, null, function* () {
1971
2130
  return typeof t == "string" ? this.getContentTypeFromUrl(t) : t.type || "application/octet-stream";
1972
2131
  });
1973
2132
  }
@@ -1978,7 +2137,7 @@ class ht {
1978
2137
  * @public
1979
2138
  */
1980
2139
  getContentTypeFromUrl(t) {
1981
- return z(this, null, function* () {
2140
+ return P(this, null, function* () {
1982
2141
  if (t.startsWith("data:")) {
1983
2142
  const e = t.match(/^data:([^;]+)/);
1984
2143
  return e ? e[1] : "application/octet-stream";
@@ -2004,7 +2163,7 @@ class ht {
2004
2163
  try {
2005
2164
  const n = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), o = {};
2006
2165
  return this.acceptContentTypes.forEach((i) => {
2007
- const a = ht.getFormatFromContentType(i);
2166
+ const a = ut.getFormatFromContentType(i);
2008
2167
  a && (o[a] = i);
2009
2168
  }), n && o[n] || "application/octet-stream";
2010
2169
  } catch (s) {
@@ -2057,11 +2216,11 @@ class ht {
2057
2216
  return e ? e[1] : "";
2058
2217
  }
2059
2218
  }
2060
- const pt = (h, t, e) => Math.max(Math.min(h, e), t), Ve = (h, t) => h * t, Xs = (h, t) => new tt(h / 2, t / 2);
2219
+ const mt = (h, t, e) => Math.max(Math.min(h, e), t), Ve = (h, t) => h * t, Xs = (h, t) => new et(h / 2, t / 2);
2061
2220
  function Ks(h) {
2062
2221
  return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
2063
2222
  }
2064
- class Qs {
2223
+ class qs {
2065
2224
  /**
2066
2225
  * @param options
2067
2226
  * @param options.editor – экземпляр редактора
@@ -2081,16 +2240,16 @@ class Qs {
2081
2240
  * Если точка находится за пределами монтажной области, она проецируется на ближайшую границу монтажной области.
2082
2241
  */
2083
2242
  getVisibleCenterPoint() {
2084
- const { canvas: t, montageArea: e } = this.editor, s = t.getZoom(), n = t.viewportTransform, o = t.getWidth(), i = t.getHeight(), a = (o / 2 - n[4]) / s, r = (i / 2 - n[5]) / s, c = e.width / 2, d = e.height / 2, l = pt(
2243
+ const { canvas: t, montageArea: e } = this.editor, s = t.getZoom(), n = t.viewportTransform, o = t.getWidth(), i = t.getHeight(), a = (o / 2 - n[4]) / s, r = (i / 2 - n[5]) / s, c = e.width / 2, d = e.height / 2, l = mt(
2085
2244
  a,
2086
2245
  e.left - c,
2087
2246
  e.left + c
2088
- ), u = pt(
2247
+ ), u = mt(
2089
2248
  r,
2090
2249
  e.top - d,
2091
2250
  e.top + d
2092
2251
  );
2093
- return new tt(l, u);
2252
+ return new et(l, u);
2094
2253
  }
2095
2254
  /**
2096
2255
  * Устанавливаем внутреннюю ширину канваса (для экспорта)
@@ -2108,7 +2267,7 @@ class Qs {
2108
2267
  canvas: o,
2109
2268
  montageArea: i,
2110
2269
  options: { canvasBackstoreWidth: a }
2111
- } = this.editor, { width: r, height: c } = i, d = pt(Number(t), Rt, At);
2270
+ } = this.editor, { width: r, height: c } = i, d = mt(Number(t), _t, jt);
2112
2271
  if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (g = o.clipPath) == null || g.set({ width: d }), e) {
2113
2272
  const p = d / r, m = Ve(c, p);
2114
2273
  this.setResolutionHeight(m);
@@ -2138,7 +2297,7 @@ class Qs {
2138
2297
  canvas: o,
2139
2298
  montageArea: i,
2140
2299
  options: { canvasBackstoreHeight: a }
2141
- } = this.editor, { width: r, height: c } = i, d = pt(Number(t), _t, jt);
2300
+ } = this.editor, { width: r, height: c } = i, d = mt(Number(t), xt, Ct);
2142
2301
  if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (g = o.clipPath) == null || g.set({ height: d }), e) {
2143
2302
  const p = d / c, m = Ve(r, p);
2144
2303
  this.setResolutionWidth(m);
@@ -2191,7 +2350,7 @@ class Qs {
2191
2350
  */
2192
2351
  setCanvasBackstoreWidth(t) {
2193
2352
  if (!t || typeof t != "number") return;
2194
- const e = pt(t, Rt, At);
2353
+ const e = mt(t, _t, jt);
2195
2354
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2196
2355
  }
2197
2356
  /**
@@ -2200,7 +2359,7 @@ class Qs {
2200
2359
  */
2201
2360
  setCanvasBackstoreHeight(t) {
2202
2361
  if (!t || typeof t != "number") return;
2203
- const e = pt(t, _t, jt);
2362
+ const e = mt(t, xt, Ct);
2204
2363
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2205
2364
  }
2206
2365
  /**
@@ -2209,7 +2368,7 @@ class Qs {
2209
2368
  * с учётом минимальных и максимальных значений.
2210
2369
  */
2211
2370
  adaptCanvasToContainer() {
2212
- const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o = pt(s, Rt, At), i = pt(n, _t, jt);
2371
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o = mt(s, _t, jt), i = mt(n, xt, Ct);
2213
2372
  t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
2214
2373
  }
2215
2374
  /**
@@ -2411,13 +2570,13 @@ class Qs {
2411
2570
  } = this.editor, c = t || n.getActiveObject();
2412
2571
  if (!Ks(c)) return;
2413
2572
  const { width: d, height: l } = c;
2414
- let u = Math.min(d, At), f = Math.min(l, jt);
2573
+ let u = Math.min(d, jt), f = Math.min(l, Ct);
2415
2574
  if (e) {
2416
2575
  const {
2417
2576
  width: g,
2418
2577
  height: p
2419
- } = o, m = d / g, v = l / p, S = Math.max(m, v);
2420
- u = g * S, f = p * S;
2578
+ } = o, m = d / g, v = l / p, w = Math.max(m, v);
2579
+ u = g * w, f = p * w;
2421
2580
  }
2422
2581
  this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(f, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), n.centerObject(c), n.renderAll(), s || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
2423
2582
  object: c,
@@ -2581,9 +2740,9 @@ class Js {
2581
2740
  * @private
2582
2741
  */
2583
2742
  _fitSingleObject(t, e) {
2584
- const { canvas: s, montageArea: n } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = o * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, f = Math.abs(Math.cos(u)), g = Math.abs(Math.sin(u)), p = d * f + l * g, m = d * g + l * f, v = n.width, S = n.height;
2743
+ const { canvas: s, montageArea: n } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = o * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, f = Math.abs(Math.cos(u)), g = Math.abs(Math.sin(u)), p = d * f + l * g, m = d * g + l * f, v = n.width, w = n.height;
2585
2744
  let A;
2586
- e === "contain" ? A = Math.min(v / p, S / m) : A = Math.max(v / p, S / m), t.set({
2745
+ e === "contain" ? A = Math.min(v / p, w / m) : A = Math.max(v / p, w / m), t.set({
2587
2746
  scaleX: a * A,
2588
2747
  scaleY: r * A
2589
2748
  }), s.centerObject(t);
@@ -2635,7 +2794,7 @@ class Js {
2635
2794
  });
2636
2795
  }
2637
2796
  }
2638
- class qs {
2797
+ class Qs {
2639
2798
  constructor({ editor: t }) {
2640
2799
  this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Hs, this.maxZoom = this.options.maxZoom || Zs, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
2641
2800
  }
@@ -2703,10 +2862,10 @@ class qs {
2703
2862
  * @private
2704
2863
  */
2705
2864
  _calculateEmptySpaceRatio(t) {
2706
- const { canvas: e, montageArea: s } = this.editor, n = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = -n[4] / t, u = (-n[4] + o) / t, f = -n[5] / t, g = (-n[5] + i) / t, p = l < a, m = u > r, v = f < c, S = g > d;
2707
- if (!(p || m || v || S)) return 0;
2708
- const y = Math.max(0, a - l), b = Math.max(0, u - r), j = Math.max(0, c - f), I = Math.max(0, g - d), w = Math.max(y, b), T = Math.max(j, I), M = w / o, C = T / i;
2709
- return Math.max(M, C);
2865
+ const { canvas: e, montageArea: s } = this.editor, n = e.viewportTransform, o = e.getWidth(), i = e.getHeight(), a = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = -n[4] / t, u = (-n[4] + o) / t, f = -n[5] / t, g = (-n[5] + i) / t, p = l < a, m = u > r, v = f < c, w = g > d;
2866
+ if (!(p || m || v || w)) return 0;
2867
+ const y = Math.max(0, a - l), b = Math.max(0, u - r), j = Math.max(0, c - f), C = Math.max(0, g - d), S = Math.max(y, b), T = Math.max(j, C), M = S / o, I = T / i;
2868
+ return Math.max(M, I);
2710
2869
  }
2711
2870
  /**
2712
2871
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2722,8 +2881,8 @@ class qs {
2722
2881
  const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), d = i.getHeight(), l = t.x - r[4], u = t.y - r[5], f = Math.abs(n), g = e - s;
2723
2882
  if (Math.abs(g) / f <= 0.1)
2724
2883
  return { x: l, y: u };
2725
- const m = c / 2, v = d / 2, S = a.left, A = a.top, y = m - S * s, b = v - A * s, j = (y - r[4]) / (e - s), I = (b - r[5]) / (e - s), w = j * f, T = I * f, M = w * o, C = T * o, E = Math.abs(M) > Math.abs(l) ? l : M, W = Math.abs(C) > Math.abs(u) ? u : C;
2726
- return { x: E, y: W };
2884
+ const m = c / 2, v = d / 2, w = a.left, A = a.top, y = m - w * s, b = v - A * s, j = (y - r[4]) / (e - s), C = (b - r[5]) / (e - s), S = j * f, T = C * f, M = S * o, I = T * o, E = Math.abs(M) > Math.abs(l) ? l : M, z = Math.abs(I) > Math.abs(u) ? u : I;
2885
+ return { x: E, y: z };
2727
2886
  }
2728
2887
  /**
2729
2888
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2813,7 +2972,7 @@ class qs {
2813
2972
  zoom(t = Ze, e = {}) {
2814
2973
  var f, g;
2815
2974
  if (!t) return;
2816
- const { minZoom: s, maxZoom: n } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (f = e.pointX) != null ? f : r.x, d = (g = e.pointY) != null ? g : r.y, l = new tt(c, d);
2975
+ const { minZoom: s, maxZoom: n } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (f = e.pointX) != null ? f : r.x, d = (g = e.pointY) != null ? g : r.y, l = new et(c, d);
2817
2976
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2818
2977
  let u = Number((a + Number(t)).toFixed(2));
2819
2978
  u > n && (u = n), u < s && (u = s), o.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), o.fire("editor:zoom-changed", {
@@ -2828,7 +2987,7 @@ class qs {
2828
2987
  * @fires editor:zoom-changed
2829
2988
  */
2830
2989
  setZoom(t = this.defaultZoom) {
2831
- const { minZoom: e, maxZoom: s } = this, { canvas: n } = this.editor, o = new tt(n.getCenterPoint());
2990
+ const { minZoom: e, maxZoom: s } = this, { canvas: n } = this.editor, o = new et(n.getCenterPoint());
2832
2991
  let i = t;
2833
2992
  t > s && (i = s), t < e && (i = e), n.zoomToPoint(o, i), n.fire("editor:zoom-changed", {
2834
2993
  currentZoom: n.getZoom(),
@@ -2841,7 +3000,7 @@ class qs {
2841
3000
  * @fires editor:zoom-changed
2842
3001
  */
2843
3002
  resetZoom() {
2844
- const { canvas: t } = this.editor, e = new tt(t.getCenterPoint());
3003
+ const { canvas: t } = this.editor, e = new et(t.getCenterPoint());
2845
3004
  t.zoomToPoint(e, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
2846
3005
  currentZoom: t.getZoom(),
2847
3006
  point: e
@@ -2905,7 +3064,7 @@ class $s {
2905
3064
  }), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), s.resumeHistory();
2906
3065
  }
2907
3066
  }
2908
- class Ot {
3067
+ class Lt {
2909
3068
  constructor({ editor: t }) {
2910
3069
  this.editor = t, this.backgroundObject = null;
2911
3070
  }
@@ -2931,7 +3090,7 @@ class Ot {
2931
3090
  }
2932
3091
  a.set({
2933
3092
  fill: t,
2934
- backgroundId: `background-${V()}`
3093
+ backgroundId: `background-${X()}`
2935
3094
  }), this.editor.canvas.requestRenderAll();
2936
3095
  } else
2937
3096
  this._removeCurrentBackground(), this._createColorBackground(t);
@@ -2968,14 +3127,14 @@ class Ot {
2968
3127
  try {
2969
3128
  const { historyManager: i } = this.editor, { backgroundObject: a } = this;
2970
3129
  if (i.suspendHistory(), a && a.backgroundType === "gradient") {
2971
- const r = Ot._createFabricGradient(t);
2972
- if (Ot._isGradientEqual(a.fill, r)) {
3130
+ const r = Lt._createFabricGradient(t);
3131
+ if (Lt._isGradientEqual(a.fill, r)) {
2973
3132
  i.resumeHistory();
2974
3133
  return;
2975
3134
  }
2976
3135
  a.set({
2977
3136
  fill: r,
2978
- backgroundId: `background-${V()}`
3137
+ backgroundId: `background-${X()}`
2979
3138
  }), this.editor.canvas.requestRenderAll();
2980
3139
  } else
2981
3140
  this._removeCurrentBackground(), this._createGradientBackground(t);
@@ -3063,7 +3222,7 @@ class Ot {
3063
3222
  * @param options.withoutSave - Если true, не сохранять состояние в историю
3064
3223
  */
3065
3224
  setImageBackground(o) {
3066
- return z(this, arguments, function* ({
3225
+ return P(this, arguments, function* ({
3067
3226
  imageSource: t,
3068
3227
  customData: e = {},
3069
3228
  fromTemplate: s = !1,
@@ -3133,7 +3292,7 @@ class Ot {
3133
3292
  hasControls: !1,
3134
3293
  id: "background",
3135
3294
  backgroundType: "color",
3136
- backgroundId: `background-${V()}`
3295
+ backgroundId: `background-${X()}`
3137
3296
  }, { withoutSelection: !0 }), this.refresh();
3138
3297
  }
3139
3298
  /**
@@ -3150,9 +3309,9 @@ class Ot {
3150
3309
  hasControls: !1,
3151
3310
  id: "background",
3152
3311
  backgroundType: "gradient",
3153
- backgroundId: `background-${V()}`
3312
+ backgroundId: `background-${X()}`
3154
3313
  }, { withoutSelection: !0 }), this.refresh();
3155
- const e = Ot._createFabricGradient(t);
3314
+ const e = Lt._createFabricGradient(t);
3156
3315
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
3157
3316
  }
3158
3317
  /**
@@ -3160,7 +3319,7 @@ class Ot {
3160
3319
  * @param source - источник изображения (URL или File)
3161
3320
  */
3162
3321
  _createImageBackground(t, e) {
3163
- return z(this, null, function* () {
3322
+ return P(this, null, function* () {
3164
3323
  var n;
3165
3324
  const { image: s } = (n = yield this.editor.imageManager.importImage({
3166
3325
  source: t,
@@ -3178,7 +3337,7 @@ class Ot {
3178
3337
  hasControls: !1,
3179
3338
  id: "background",
3180
3339
  backgroundType: "image",
3181
- backgroundId: `background-${V()}`,
3340
+ backgroundId: `background-${X()}`,
3182
3341
  customData: e
3183
3342
  }), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
3184
3343
  });
@@ -3212,8 +3371,8 @@ class Ot {
3212
3371
  { offset: 0, color: "#000000" },
3213
3372
  { offset: 1, color: "#ffffff" }
3214
3373
  ], t.type === "linear") {
3215
- const u = t.angle * Math.PI / 180, f = Ot._angleToCoords(u);
3216
- return new ze({
3374
+ const u = t.angle * Math.PI / 180, f = Lt._angleToCoords(u);
3375
+ return new Pe({
3217
3376
  type: "linear",
3218
3377
  gradientUnits: "percentage",
3219
3378
  coords: f,
@@ -3232,7 +3391,7 @@ class Ot {
3232
3391
  r1: 0,
3233
3392
  r2: d / 100
3234
3393
  };
3235
- return new ze({
3394
+ return new Pe({
3236
3395
  type: "radial",
3237
3396
  gradientUnits: "percentage",
3238
3397
  coords: l,
@@ -3421,13 +3580,13 @@ class tn {
3421
3580
  */
3422
3581
  addRectangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3423
3582
  var l = d, {
3424
- id: t = `rect-${V()}`,
3583
+ id: t = `rect-${X()}`,
3425
3584
  left: e,
3426
3585
  top: s,
3427
3586
  width: n = 100,
3428
3587
  height: o = 100,
3429
3588
  fill: i = "blue"
3430
- } = l, a = gt(l, [
3589
+ } = l, a = pt(l, [
3431
3590
  "id",
3432
3591
  "left",
3433
3592
  "top",
@@ -3463,12 +3622,12 @@ class tn {
3463
3622
  */
3464
3623
  addCircle(c = {}, { withoutSelection: a, withoutAdding: r } = {}) {
3465
3624
  var d = c, {
3466
- id: t = `circle-${V()}`,
3625
+ id: t = `circle-${X()}`,
3467
3626
  left: e,
3468
3627
  top: s,
3469
3628
  radius: n = 50,
3470
3629
  fill: o = "green"
3471
- } = d, i = gt(d, [
3630
+ } = d, i = pt(d, [
3472
3631
  "id",
3473
3632
  "left",
3474
3633
  "top",
@@ -3503,13 +3662,13 @@ class tn {
3503
3662
  */
3504
3663
  addTriangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3505
3664
  var l = d, {
3506
- id: t = `triangle-${V()}`,
3665
+ id: t = `triangle-${X()}`,
3507
3666
  left: e,
3508
3667
  top: s,
3509
3668
  width: n = 100,
3510
3669
  height: o = 100,
3511
3670
  fill: i = "yellow"
3512
- } = l, a = gt(l, [
3671
+ } = l, a = pt(l, [
3513
3672
  "id",
3514
3673
  "left",
3515
3674
  "top",
@@ -3556,7 +3715,7 @@ class en {
3556
3715
  * Асинхронное клонирование для внутреннего буфера
3557
3716
  */
3558
3717
  _cloneToInternalClipboard(t) {
3559
- return z(this, null, function* () {
3718
+ return P(this, null, function* () {
3560
3719
  const { canvas: e, errorManager: s } = this.editor;
3561
3720
  try {
3562
3721
  const n = yield t.clone(ie);
@@ -3576,7 +3735,7 @@ class en {
3576
3735
  * Копирование в системный буфер обмена
3577
3736
  */
3578
3737
  _copyToSystemClipboard(t) {
3579
- return z(this, null, function* () {
3738
+ return P(this, null, function* () {
3580
3739
  const { errorManager: e } = this.editor;
3581
3740
  if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
3582
3741
  return e.emitWarning({
@@ -3603,7 +3762,7 @@ class en {
3603
3762
  * Копирование изображения в буфер обмена
3604
3763
  */
3605
3764
  _copyImageToClipboard(t, e) {
3606
- return z(this, null, function* () {
3765
+ return P(this, null, function* () {
3607
3766
  try {
3608
3767
  const n = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(), o = n.slice(5).split(";")[0], i = n.split(",")[1], a = atob(i), r = new Uint8Array(a.length);
3609
3768
  for (let l = 0; l < a.length; l += 1)
@@ -3625,7 +3784,7 @@ class en {
3625
3784
  * Копирование текста в буфер обмена
3626
3785
  */
3627
3786
  _copyTextToClipboard(t) {
3628
- return z(this, null, function* () {
3787
+ return P(this, null, function* () {
3629
3788
  try {
3630
3789
  const e = `${Ge}${t}`;
3631
3790
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
@@ -3660,7 +3819,7 @@ class en {
3660
3819
  * @param source - источник изображения (data URL или URL)
3661
3820
  */
3662
3821
  _handleImageImport(t) {
3663
- return z(this, null, function* () {
3822
+ return P(this, null, function* () {
3664
3823
  var s;
3665
3824
  const { image: e } = (s = yield this.editor.imageManager.importImage({
3666
3825
  source: t,
@@ -3676,18 +3835,18 @@ class en {
3676
3835
  * @fires editor:object-pasted
3677
3836
  */
3678
3837
  copyPaste(t) {
3679
- return z(this, null, function* () {
3838
+ return P(this, null, function* () {
3680
3839
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3681
3840
  if (!s || s.locked) return !1;
3682
3841
  try {
3683
3842
  const n = yield s.clone(ie);
3684
3843
  return n instanceof U && n.forEachObject((o) => {
3685
3844
  o.set({
3686
- id: `${o.type}-${V()}`,
3845
+ id: `${o.type}-${X()}`,
3687
3846
  evented: !0
3688
3847
  });
3689
3848
  }), n.set({
3690
- id: `${n.type}-${V()}`,
3849
+ id: `${n.type}-${X()}`,
3691
3850
  left: n.left + 10,
3692
3851
  top: n.top + 10,
3693
3852
  evented: !0
@@ -3711,7 +3870,7 @@ class en {
3711
3870
  * @param event.clipboardData.items — элементы буфера обмена
3712
3871
  */
3713
3872
  handlePasteEvent(e) {
3714
- return z(this, arguments, function* ({ clipboardData: t }) {
3873
+ return P(this, arguments, function* ({ clipboardData: t }) {
3715
3874
  var r;
3716
3875
  if (!((r = t == null ? void 0 : t.items) != null && r.length)) {
3717
3876
  this.paste();
@@ -3762,18 +3921,18 @@ class en {
3762
3921
  * @fires editor:object-pasted
3763
3922
  */
3764
3923
  paste() {
3765
- return z(this, null, function* () {
3924
+ return P(this, null, function* () {
3766
3925
  const { canvas: t } = this.editor;
3767
3926
  if (!this.clipboard) return !1;
3768
3927
  try {
3769
3928
  const e = yield this.clipboard.clone(ie);
3770
3929
  return t.discardActiveObject(), e instanceof U && e.forEachObject((s) => {
3771
3930
  s.set({
3772
- id: `${s.type}-${V()}`,
3931
+ id: `${s.type}-${X()}`,
3773
3932
  evented: !0
3774
3933
  });
3775
3934
  }), e.set({
3776
- id: `${e.type}-${V()}`,
3935
+ id: `${e.type}-${X()}`,
3777
3936
  left: e.left + 10,
3778
3937
  top: e.top + 10,
3779
3938
  evented: !0
@@ -3819,7 +3978,7 @@ class he {
3819
3978
  };
3820
3979
  i.set(a), !e && he._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3821
3980
  c.set(a);
3822
- }), i instanceof ot && i.isEditing && i.exitEditing(), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
3981
+ }), i instanceof it && i.isEditing && i.exitEditing(), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
3823
3982
  object: i,
3824
3983
  skipInnerObjects: e,
3825
3984
  withoutSave: s
@@ -3854,7 +4013,7 @@ class he {
3854
4013
  });
3855
4014
  }
3856
4015
  static _isGroupOrSelection(t) {
3857
- return t instanceof U || t instanceof Et;
4016
+ return t instanceof U || t instanceof Ot;
3858
4017
  }
3859
4018
  }
3860
4019
  class sn {
@@ -3877,20 +4036,20 @@ class sn {
3877
4036
  */
3878
4037
  _getGroupsToUngroup(t) {
3879
4038
  if (Array.isArray(t)) {
3880
- const s = t.filter((n) => n instanceof Et);
4039
+ const s = t.filter((n) => n instanceof Ot);
3881
4040
  return s.length > 0 ? s : null;
3882
4041
  }
3883
4042
  if (t instanceof U) {
3884
- const s = t.getObjects().filter((n) => n instanceof Et);
4043
+ const s = t.getObjects().filter((n) => n instanceof Ot);
3885
4044
  return s.length > 0 ? s : null;
3886
4045
  }
3887
4046
  const e = t || this.editor.canvas.getActiveObject();
3888
4047
  if (!e) return null;
3889
4048
  if (e instanceof U) {
3890
- const s = e.getObjects().filter((n) => n instanceof Et);
4049
+ const s = e.getObjects().filter((n) => n instanceof Ot);
3891
4050
  return s.length > 0 ? s : null;
3892
4051
  }
3893
- return e instanceof Et ? [e] : null;
4052
+ return e instanceof Ot ? [e] : null;
3894
4053
  }
3895
4054
  /**
3896
4055
  * Группировка объектов
@@ -3907,8 +4066,8 @@ class sn {
3907
4066
  if (!o) return null;
3908
4067
  try {
3909
4068
  n.suspendHistory();
3910
- const i = new Et(o, {
3911
- id: `group-${V()}`
4069
+ const i = new Ot(o, {
4070
+ id: `group-${X()}`
3912
4071
  });
3913
4072
  o.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
3914
4073
  const a = {
@@ -4035,7 +4194,7 @@ class Oe {
4035
4194
  return n.fire("editor:objects-deleted", c), c;
4036
4195
  }
4037
4196
  }
4038
- const St = {
4197
+ const At = {
4039
4198
  IMAGE_MANAGER: {
4040
4199
  /**
4041
4200
  * Некорректный Content-Type изображения
@@ -4140,7 +4299,7 @@ const St = {
4140
4299
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4141
4300
  }
4142
4301
  };
4143
- class Qt {
4302
+ class qt {
4144
4303
  constructor({ editor: t }) {
4145
4304
  this._buffer = [], this.editor = t;
4146
4305
  }
@@ -4167,7 +4326,7 @@ class Qt {
4167
4326
  * @fires editor:error
4168
4327
  */
4169
4328
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: n, message: o }) {
4170
- if (!Qt.isValidErrorCode(s)) {
4329
+ if (!qt.isValidErrorCode(s)) {
4171
4330
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
4172
4331
  return;
4173
4332
  }
@@ -4196,7 +4355,7 @@ class Qt {
4196
4355
  * @fires editor:warning
4197
4356
  */
4198
4357
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: n, data: o }) {
4199
- if (!Qt.isValidErrorCode(s)) {
4358
+ if (!qt.isValidErrorCode(s)) {
4200
4359
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
4201
4360
  return;
4202
4361
  }
@@ -4219,7 +4378,7 @@ class Qt {
4219
4378
  * @returns true, если код допустим, иначе false
4220
4379
  */
4221
4380
  static isValidErrorCode(t) {
4222
- return t ? Object.values(St).some((e) => Object.values(e).includes(t)) : !1;
4381
+ return t ? Object.values(At).some((e) => Object.values(e).includes(t)) : !1;
4223
4382
  }
4224
4383
  }
4225
4384
  class on {
@@ -4307,11 +4466,11 @@ class on {
4307
4466
  this.currentBounds = this.calculatePanBounds();
4308
4467
  }
4309
4468
  }
4310
- const dt = ({
4469
+ const lt = ({
4311
4470
  value: h,
4312
4471
  min: t,
4313
4472
  max: e
4314
- }) => Math.min(Math.max(h, t), e), Dt = class Dt extends ot {
4473
+ }) => Math.min(Math.max(h, t), e), Rt = class Rt extends it {
4315
4474
  constructor(t, e = {}) {
4316
4475
  var s, n, o, i, a, r, c, d, l;
4317
4476
  super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (n = e.paddingTop) != null ? n : 0, this.paddingRight = (o = e.paddingRight) != null ? o : 0, this.paddingBottom = (i = e.paddingBottom) != null ? i : 0, this.paddingLeft = (a = e.paddingLeft) != null ? a : 0, this.radiusTopLeft = (r = e.radiusTopLeft) != null ? r : 0, this.radiusTopRight = (c = e.radiusTopRight) != null ? c : 0, this.radiusBottomRight = (d = e.radiusBottomRight) != null ? d : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0, this._roundDimensions();
@@ -4332,11 +4491,11 @@ const dt = ({
4332
4491
  }
4333
4492
  _getNonTransformedDimensions() {
4334
4493
  const { width: t, height: e } = this._getBackgroundDimensions();
4335
- return new tt(t, e).scalarAdd(this.strokeWidth);
4494
+ return new et(t, e).scalarAdd(this.strokeWidth);
4336
4495
  }
4337
4496
  _getTransformedDimensions(t = {}) {
4338
4497
  const { width: e, height: s } = this._getBackgroundDimensions();
4339
- return super._getTransformedDimensions(wt(B({}, t), {
4498
+ return super._getTransformedDimensions(St(B({}, t), {
4340
4499
  width: e,
4341
4500
  height: s
4342
4501
  }));
@@ -4346,7 +4505,7 @@ const dt = ({
4346
4505
  */
4347
4506
  toObject(t = []) {
4348
4507
  const e = super.toObject(t);
4349
- return wt(B({}, e), {
4508
+ return St(B({}, e), {
4350
4509
  backgroundOpacity: this.backgroundOpacity,
4351
4510
  paddingTop: this.paddingTop,
4352
4511
  paddingRight: this.paddingRight,
@@ -4363,7 +4522,7 @@ const dt = ({
4363
4522
  const e = this._getEffectiveBackgroundFill();
4364
4523
  if (e && e) {
4365
4524
  const o = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (n = this.height) != null ? n : 0, r = i + o.left + o.right, c = a + o.top + o.bottom, d = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - o.left, u = this._getTopOffset() - o.top;
4366
- t.save(), Dt._renderRoundedRect({
4525
+ t.save(), Rt._renderRoundedRect({
4367
4526
  ctx: t,
4368
4527
  height: c,
4369
4528
  left: l,
@@ -4385,10 +4544,10 @@ const dt = ({
4385
4544
  var i, a, r, c;
4386
4545
  const s = t / 2, n = e / 2, o = Math.min(s, n);
4387
4546
  return {
4388
- bottomLeft: dt({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
4389
- bottomRight: dt({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
4390
- topLeft: dt({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
4391
- topRight: dt({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
4547
+ bottomLeft: lt({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
4548
+ bottomRight: lt({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
4549
+ topLeft: lt({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
4550
+ topRight: lt({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
4392
4551
  };
4393
4552
  }
4394
4553
  _getPadding() {
@@ -4404,12 +4563,12 @@ const dt = ({
4404
4563
  var n;
4405
4564
  const t = this.backgroundColor;
4406
4565
  if (!t) return null;
4407
- const e = dt({ value: (n = this.backgroundOpacity) != null ? n : 1, min: 0, max: 1 });
4566
+ const e = lt({ value: (n = this.backgroundOpacity) != null ? n : 1, min: 0, max: 1 });
4408
4567
  let s;
4409
4568
  try {
4410
4569
  s = new ms(t);
4411
4570
  } catch (o) {
4412
- return Qt.emitError({
4571
+ return qt.emitError({
4413
4572
  origin: "BackgroundTextbox",
4414
4573
  method: "_getEffectiveBackgroundFill",
4415
4574
  code: "INVALID_COLOR_VALUE",
@@ -4432,7 +4591,7 @@ const dt = ({
4432
4591
  topRight: d,
4433
4592
  bottomRight: l,
4434
4593
  bottomLeft: u
4435
- } = n, f = dt({ value: c, min: 0, max: i }), g = dt({ value: d, min: 0, max: i }), p = dt({ value: l, min: 0, max: i }), m = dt({ value: u, min: 0, max: i });
4594
+ } = n, f = lt({ value: c, min: 0, max: i }), g = lt({ value: d, min: 0, max: i }), p = lt({ value: l, min: 0, max: i }), m = lt({ value: u, min: 0, max: i });
4436
4595
  t.beginPath(), t.moveTo(s + f, o), t.lineTo(a - g, o), t.quadraticCurveTo(a, o, a, o + g), t.lineTo(a, r - p), t.quadraticCurveTo(a, r, a - p, r), t.lineTo(s + m, r), t.quadraticCurveTo(s, r, s, r - m), t.lineTo(s, o + f), t.quadraticCurveTo(s, o, s + f, o), t.closePath();
4437
4596
  }
4438
4597
  /**
@@ -4446,8 +4605,8 @@ const dt = ({
4446
4605
  s !== t && (this.width = Math.max(0, s)), n !== e && (this.height = Math.max(0, n));
4447
4606
  }
4448
4607
  };
4449
- Dt.type = "background-textbox", Dt.cacheProperties = [
4450
- ...Array.isArray(ot.cacheProperties) ? ot.cacheProperties : [],
4608
+ Rt.type = "background-textbox", Rt.cacheProperties = [
4609
+ ...Array.isArray(it.cacheProperties) ? it.cacheProperties : [],
4451
4610
  "backgroundColor",
4452
4611
  "backgroundOpacity",
4453
4612
  "paddingTop",
@@ -4458,8 +4617,8 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
4458
4617
  "radiusTopRight",
4459
4618
  "radiusBottomRight",
4460
4619
  "radiusBottomLeft"
4461
- ], Dt.stateProperties = [
4462
- ...Array.isArray(ot.stateProperties) ? ot.stateProperties : [],
4620
+ ], Rt.stateProperties = [
4621
+ ...Array.isArray(it.stateProperties) ? it.stateProperties : [],
4463
4622
  "backgroundColor",
4464
4623
  "backgroundOpacity",
4465
4624
  "paddingTop",
@@ -4471,10 +4630,10 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
4471
4630
  "radiusBottomRight",
4472
4631
  "radiusBottomLeft"
4473
4632
  ];
4474
- let ue = Dt;
4633
+ let ue = Rt;
4475
4634
  const an = () => {
4476
4635
  var h;
4477
- (h = Pe) != null && h.setClass && Pe.setClass(ue, "background-textbox");
4636
+ (h = We) != null && h.setClass && We.setClass(ue, "background-textbox");
4478
4637
  }, rn = ({ textbox: h }) => {
4479
4638
  var s, n;
4480
4639
  if (!h.isEditing) return null;
@@ -4514,7 +4673,7 @@ const an = () => {
4514
4673
  );
4515
4674
  if (s.length)
4516
4675
  return (n = s[0]) == null ? void 0 : n[e];
4517
- }, Ke = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Qe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, pe = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", $ = 0.01;
4676
+ }, Ke = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", qe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, pe = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", tt = 0.01;
4518
4677
  class k {
4519
4678
  constructor({ editor: t }) {
4520
4679
  var e;
@@ -4558,7 +4717,7 @@ class k {
4558
4717
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4559
4718
  }, Vs);
4560
4719
  }, this._handleObjectScaling = (s) => {
4561
- var te, xt, Bt, kt, Wt, zt, Pt, Ut, Ft, X, Tt, ee, Mt;
4720
+ var te, Bt, kt, zt, Pt, Wt, Ut, Ft, Yt, K, Et, ee, wt;
4562
4721
  const { target: n, transform: o } = s;
4563
4722
  if (n instanceof U || !k._isTextbox(n) || !o) return;
4564
4723
  n.isScaling = !0;
@@ -4569,124 +4728,124 @@ class k {
4569
4728
  basePadding: d,
4570
4729
  baseRadii: l,
4571
4730
  baseStyles: u
4572
- } = i, f = typeof ((te = o.original) == null ? void 0 : te.width) == "number" ? o.original.width : void 0, g = typeof ((xt = o.original) == null ? void 0 : xt.left) == "number" ? o.original.left : void 0, p = f != null ? f : a, m = g != null ? g : r, v = (Bt = o.corner) != null ? Bt : "", S = (kt = o.action) != null ? kt : "", A = ["ml", "mr"].includes(v) || S === "scaleX", y = ["mt", "mb"].includes(v) || S === "scaleY", b = ["tl", "tr", "bl", "br"].includes(v) || S === "scale", j = b || y;
4731
+ } = i, f = typeof ((te = o.original) == null ? void 0 : te.width) == "number" ? o.original.width : void 0, g = typeof ((Bt = o.original) == null ? void 0 : Bt.left) == "number" ? o.original.left : void 0, p = f != null ? f : a, m = g != null ? g : r, v = (kt = o.corner) != null ? kt : "", w = (zt = o.action) != null ? zt : "", A = ["ml", "mr"].includes(v) || w === "scaleX", y = ["mt", "mb"].includes(v) || w === "scaleY", b = ["tl", "tr", "bl", "br"].includes(v) || w === "scale", j = b || y;
4573
4732
  if (!A && !y && !b) return;
4574
- const I = Math.abs((zt = (Wt = n.scaleX) != null ? Wt : o.scaleX) != null ? zt : 1) || 1, w = Math.abs((Ut = (Pt = n.scaleY) != null ? Pt : o.scaleY) != null ? Ut : 1) || 1, T = Math.max(1, p * I), M = Math.max(1, Math.round(T)), C = Math.max(1, c * w), {
4733
+ const C = Math.abs((Wt = (Pt = n.scaleX) != null ? Pt : o.scaleX) != null ? Wt : 1) || 1, S = Math.abs((Ft = (Ut = n.scaleY) != null ? Ut : o.scaleY) != null ? Ft : 1) || 1, T = Math.max(1, p * C), M = Math.max(1, Math.round(T)), I = Math.max(1, c * S), {
4575
4734
  paddingTop: E = 0,
4576
- paddingRight: W = 0,
4577
- paddingBottom: N = 0,
4578
- paddingLeft: x = 0,
4735
+ paddingRight: z = 0,
4736
+ paddingBottom: x = 0,
4737
+ paddingLeft: N = 0,
4579
4738
  radiusTopLeft: Y = 0,
4580
- radiusTopRight: G = 0,
4581
- radiusBottomRight: K = 0,
4739
+ radiusTopRight: V = 0,
4740
+ radiusBottomRight: q = 0,
4582
4741
  radiusBottomLeft: H = 0,
4583
4742
  fontSize: R,
4584
4743
  width: O,
4585
- originX: it = "left"
4586
- } = n, Z = b || y, st = b || y, F = Z ? {
4587
- top: Math.max(0, d.top * w),
4588
- right: Math.max(0, d.right * w),
4589
- bottom: Math.max(0, d.bottom * w),
4590
- left: Math.max(0, d.left * w)
4591
- } : d, q = st ? {
4592
- topLeft: Math.max(0, l.topLeft * w),
4593
- topRight: Math.max(0, l.topRight * w),
4594
- bottomRight: Math.max(0, l.bottomRight * w),
4595
- bottomLeft: Math.max(0, l.bottomLeft * w)
4596
- } : l, nt = Object.keys(u).length > 0;
4597
- let J;
4598
- if (j && nt) {
4599
- const Yt = {};
4600
- Object.entries(u).forEach(([Ht, De]) => {
4744
+ originX: at = "left"
4745
+ } = n, G = b || y, nt = b || y, F = G ? {
4746
+ top: Math.max(0, d.top * S),
4747
+ right: Math.max(0, d.right * S),
4748
+ bottom: Math.max(0, d.bottom * S),
4749
+ left: Math.max(0, d.left * S)
4750
+ } : d, $ = nt ? {
4751
+ topLeft: Math.max(0, l.topLeft * S),
4752
+ topRight: Math.max(0, l.topRight * S),
4753
+ bottomRight: Math.max(0, l.bottomRight * S),
4754
+ bottomLeft: Math.max(0, l.bottomLeft * S)
4755
+ } : l, ot = Object.keys(u).length > 0;
4756
+ let Q;
4757
+ if (j && ot) {
4758
+ const Ht = {};
4759
+ Object.entries(u).forEach(([Zt, De]) => {
4601
4760
  if (!De) return;
4602
4761
  const fe = {};
4603
4762
  Object.entries(De).forEach(([cs, se]) => {
4604
4763
  if (!se) return;
4605
4764
  const Re = B({}, se);
4606
- typeof se.fontSize == "number" && (Re.fontSize = Math.max(1, se.fontSize * w)), fe[cs] = Re;
4607
- }), Object.keys(fe).length && (Yt[Ht] = fe);
4608
- }), Object.keys(Yt).length && (J = Yt);
4765
+ typeof se.fontSize == "number" && (Re.fontSize = Math.max(1, se.fontSize * S)), fe[cs] = Re;
4766
+ }), Object.keys(fe).length && (Ht[Zt] = fe);
4767
+ }), Object.keys(Ht).length && (Q = Ht);
4609
4768
  }
4610
- const yt = (X = (Ft = o.originX) != null ? Ft : it) != null ? X : "left", It = m + p, at = m + p / 2, ft = O != null ? O : p, rt = M !== ft, Nt = Math.abs(C - (R != null ? R : c)) > $, vt = Math.abs(F.top - E) > $ || Math.abs(F.right - W) > $ || Math.abs(F.bottom - N) > $ || Math.abs(F.left - x) > $, Jt = Math.abs(q.topLeft - Y) > $ || Math.abs(q.topRight - G) > $ || Math.abs(q.bottomRight - K) > $ || Math.abs(q.bottomLeft - H) > $;
4611
- if (!rt && !Nt && !vt && !Jt) {
4769
+ const vt = (K = (Yt = o.originX) != null ? Yt : at) != null ? K : "left", It = m + p, rt = m + p / 2, gt = O != null ? O : p, ct = M !== gt, Nt = Math.abs(I - (R != null ? R : c)) > tt, bt = Math.abs(F.top - E) > tt || Math.abs(F.right - z) > tt || Math.abs(F.bottom - x) > tt || Math.abs(F.left - N) > tt, Jt = Math.abs($.topLeft - Y) > tt || Math.abs($.topRight - V) > tt || Math.abs($.bottomRight - q) > tt || Math.abs($.bottomLeft - H) > tt;
4770
+ if (!ct && !Nt && !bt && !Jt) {
4612
4771
  n.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
4613
4772
  return;
4614
4773
  }
4615
- J && (n.styles = J), n.set({
4774
+ Q && (n.styles = Q), n.set({
4616
4775
  width: M,
4617
- fontSize: j ? C : c,
4776
+ fontSize: j ? I : c,
4618
4777
  paddingTop: F.top,
4619
4778
  paddingRight: F.right,
4620
4779
  paddingBottom: F.bottom,
4621
4780
  paddingLeft: F.left,
4622
- radiusTopLeft: q.topLeft,
4623
- radiusTopRight: q.topRight,
4624
- radiusBottomRight: q.bottomRight,
4625
- radiusBottomLeft: q.bottomLeft,
4781
+ radiusTopLeft: $.topLeft,
4782
+ radiusTopRight: $.topRight,
4783
+ radiusBottomRight: $.bottomRight,
4784
+ radiusBottomLeft: $.bottomLeft,
4626
4785
  scaleX: 1,
4627
4786
  scaleY: 1
4628
4787
  });
4629
- const qt = k._roundTextboxDimensions({ textbox: n });
4630
- qt && (n.dirty = !0);
4631
- const Ct = (Tt = n.width) != null ? Tt : M, $t = Ct !== ft;
4632
- let ct = m;
4633
- $t && (A || b) && (yt === "right" ? ct = It - Ct : yt === "center" && (ct = at - Ct / 2)), n.set({ left: ct }), i.baseLeft = ct, o.scaleX = 1, o.scaleY = 1;
4634
- const { original: bt } = o;
4635
- bt && (bt.scaleX = 1, bt.scaleY = 1, bt.width = Ct, bt.height = n.height, bt.left = ct), n.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = Ct, i.baseFontSize = (ee = n.fontSize) != null ? ee : C, i.baseStyles = JSON.parse(JSON.stringify((Mt = n.styles) != null ? Mt : {})), i.basePadding = {
4788
+ const Qt = k._roundTextboxDimensions({ textbox: n });
4789
+ Qt && (n.dirty = !0);
4790
+ const Tt = (Et = n.width) != null ? Et : M, $t = Tt !== gt;
4791
+ let dt = m;
4792
+ $t && (A || b) && (vt === "right" ? dt = It - Tt : vt === "center" && (dt = rt - Tt / 2)), n.set({ left: dt }), i.baseLeft = dt, o.scaleX = 1, o.scaleY = 1;
4793
+ const { original: Mt } = o;
4794
+ Mt && (Mt.scaleX = 1, Mt.scaleY = 1, Mt.width = Tt, Mt.height = n.height, Mt.left = dt), n.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = Tt, i.baseFontSize = (ee = n.fontSize) != null ? ee : I, i.baseStyles = JSON.parse(JSON.stringify((wt = n.styles) != null ? wt : {})), i.basePadding = {
4636
4795
  top: F.top,
4637
4796
  right: F.right,
4638
4797
  bottom: F.bottom,
4639
4798
  left: F.left
4640
4799
  }, i.baseRadii = {
4641
- topLeft: q.topLeft,
4642
- topRight: q.topRight,
4643
- bottomRight: q.bottomRight,
4644
- bottomLeft: q.bottomLeft
4645
- }, i.hasWidthChange = $t || Nt || vt || Jt || qt;
4800
+ topLeft: $.topLeft,
4801
+ topRight: $.topRight,
4802
+ bottomRight: $.bottomRight,
4803
+ bottomLeft: $.bottomLeft
4804
+ }, i.hasWidthChange = $t || Nt || bt || Jt || Qt;
4646
4805
  }, this._handleObjectModified = (s) => {
4647
- var S, A, y;
4806
+ var w, A, y;
4648
4807
  const { target: n } = s;
4649
4808
  if (n instanceof U) {
4650
4809
  const b = n.getObjects();
4651
4810
  if (!b.some((M) => k._isTextbox(M))) return;
4652
- const { scaleX: I = 1, scaleY: w = 1 } = n;
4653
- if (Math.abs(I - 1) < $ && Math.abs(w - 1) < $) return;
4811
+ const { scaleX: C = 1, scaleY: S = 1 } = n;
4812
+ if (Math.abs(C - 1) < tt && Math.abs(S - 1) < tt) return;
4654
4813
  this.canvas.discardActiveObject(), b.forEach((M) => {
4655
- var C, E, W, N;
4814
+ var I, E, z, x;
4656
4815
  if (k._isTextbox(M)) {
4657
- const x = (C = M.scaleX) != null ? C : 1, Y = (E = M.scaleY) != null ? E : 1, G = ((W = M.fontSize) != null ? W : 16) * Y, K = ((N = M.width) != null ? N : 0) * x, H = Y, {
4816
+ const N = (I = M.scaleX) != null ? I : 1, Y = (E = M.scaleY) != null ? E : 1, V = ((z = M.fontSize) != null ? z : 16) * Y, q = ((x = M.width) != null ? x : 0) * N, H = Y, {
4658
4817
  paddingTop: R = 0,
4659
4818
  paddingRight: O = 0,
4660
- paddingBottom: it = 0,
4661
- paddingLeft: Z = 0,
4662
- radiusTopLeft: st = 0,
4819
+ paddingBottom: at = 0,
4820
+ paddingLeft: G = 0,
4821
+ radiusTopLeft: nt = 0,
4663
4822
  radiusTopRight: F = 0,
4664
- radiusBottomRight: q = 0,
4665
- radiusBottomLeft: nt = 0,
4666
- styles: J
4667
- } = M, yt = {
4823
+ radiusBottomRight: $ = 0,
4824
+ radiusBottomLeft: ot = 0,
4825
+ styles: Q
4826
+ } = M, vt = {
4668
4827
  paddingTop: Math.max(0, R * H),
4669
4828
  paddingRight: Math.max(0, O * H),
4670
- paddingBottom: Math.max(0, it * H),
4671
- paddingLeft: Math.max(0, Z * H)
4829
+ paddingBottom: Math.max(0, at * H),
4830
+ paddingLeft: Math.max(0, G * H)
4672
4831
  }, It = {
4673
- radiusTopLeft: Math.max(0, st * H),
4832
+ radiusTopLeft: Math.max(0, nt * H),
4674
4833
  radiusTopRight: Math.max(0, F * H),
4675
- radiusBottomRight: Math.max(0, q * H),
4676
- radiusBottomLeft: Math.max(0, nt * H)
4834
+ radiusBottomRight: Math.max(0, $ * H),
4835
+ radiusBottomLeft: Math.max(0, ot * H)
4677
4836
  };
4678
- let at = J;
4679
- J && Object.keys(J).length > 0 && (at = JSON.parse(JSON.stringify(J)), Object.values(at).forEach((ft) => {
4680
- Object.values(ft).forEach((rt) => {
4681
- typeof rt.fontSize == "number" && (rt.fontSize = Math.max(1, rt.fontSize * H));
4837
+ let rt = Q;
4838
+ Q && Object.keys(Q).length > 0 && (rt = JSON.parse(JSON.stringify(Q)), Object.values(rt).forEach((gt) => {
4839
+ Object.values(gt).forEach((ct) => {
4840
+ typeof ct.fontSize == "number" && (ct.fontSize = Math.max(1, ct.fontSize * H));
4682
4841
  });
4683
- })), M.set(wt(B(B({
4684
- fontSize: G,
4685
- width: K,
4842
+ })), M.set(St(B(B({
4843
+ fontSize: V,
4844
+ width: q,
4686
4845
  scaleX: 1,
4687
4846
  scaleY: 1
4688
- }, yt), It), {
4689
- styles: at
4847
+ }, vt), It), {
4848
+ styles: rt
4690
4849
  })), k._roundTextboxDimensions({ textbox: M });
4691
4850
  }
4692
4851
  M.setCoords();
@@ -4701,7 +4860,7 @@ class k {
4701
4860
  n.isScaling = !1;
4702
4861
  const o = this.scalingState.get(n);
4703
4862
  if (this.scalingState.delete(n), !(o != null && o.hasWidthChange)) return;
4704
- const i = (S = n.width) != null ? S : n.calcTextWidth(), a = (y = (A = n.fontSize) != null ? A : o == null ? void 0 : o.baseFontSize) != null ? y : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
4863
+ const i = (w = n.width) != null ? w : n.calcTextWidth(), a = (y = (A = n.fontSize) != null ? A : o == null ? void 0 : o.baseFontSize) != null ? y : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
4705
4864
  paddingTop: c = 0,
4706
4865
  paddingRight: d = 0,
4707
4866
  paddingBottom: l = 0,
@@ -4732,9 +4891,9 @@ class k {
4732
4891
  * @param options — настройки текста
4733
4892
  * @param flags — флаги поведения
4734
4893
  */
4735
- addText(W = {}, { withoutSelection: M = !1, withoutSave: C = !1, withoutAdding: E = !1 } = {}) {
4736
- var N = W, {
4737
- id: t = `text-${V()}`,
4894
+ addText(z = {}, { withoutSelection: M = !1, withoutSave: I = !1, withoutAdding: E = !1 } = {}) {
4895
+ var x = z, {
4896
+ id: t = `text-${X()}`,
4738
4897
  text: e = "Новый текст",
4739
4898
  fontFamily: s,
4740
4899
  fontSize: n = 48,
@@ -4751,14 +4910,14 @@ class k {
4751
4910
  backgroundColor: p,
4752
4911
  backgroundOpacity: m = 1,
4753
4912
  paddingTop: v = 0,
4754
- paddingRight: S = 0,
4913
+ paddingRight: w = 0,
4755
4914
  paddingBottom: A = 0,
4756
4915
  paddingLeft: y = 0,
4757
4916
  radiusTopLeft: b = 0,
4758
4917
  radiusTopRight: j = 0,
4759
- radiusBottomRight: I = 0,
4760
- radiusBottomLeft: w = 0
4761
- } = N, T = gt(N, [
4918
+ radiusBottomRight: C = 0,
4919
+ radiusBottomLeft: S = 0
4920
+ } = x, T = pt(x, [
4762
4921
  "id",
4763
4922
  "text",
4764
4923
  "fontFamily",
@@ -4784,15 +4943,15 @@ class k {
4784
4943
  "radiusBottomRight",
4785
4944
  "radiusBottomLeft"
4786
4945
  ]);
4787
- var Z;
4788
- const { historyManager: x } = this.editor, { canvas: Y } = this;
4789
- x.suspendHistory();
4790
- const G = s != null ? s : this._getDefaultFontFamily(), K = Qe({ width: f }), H = Ke({
4946
+ var G;
4947
+ const { historyManager: N } = this.editor, { canvas: Y } = this;
4948
+ N.suspendHistory();
4949
+ const V = s != null ? s : this._getDefaultFontFamily(), q = qe({ width: f }), H = Ke({
4791
4950
  strokeColor: u,
4792
- width: K
4951
+ width: q
4793
4952
  }), R = B({
4794
4953
  id: t,
4795
- fontFamily: G,
4954
+ fontFamily: V,
4796
4955
  fontSize: n,
4797
4956
  fontWeight: o ? "bold" : "normal",
4798
4957
  fontStyle: i ? "italic" : "normal",
@@ -4802,27 +4961,27 @@ class k {
4802
4961
  textAlign: d,
4803
4962
  fill: l,
4804
4963
  stroke: H,
4805
- strokeWidth: K,
4964
+ strokeWidth: q,
4806
4965
  strokeUniform: !0,
4807
4966
  opacity: g,
4808
4967
  backgroundColor: p,
4809
4968
  backgroundOpacity: m,
4810
4969
  paddingTop: v,
4811
- paddingRight: S,
4970
+ paddingRight: w,
4812
4971
  paddingBottom: A,
4813
4972
  paddingLeft: y,
4814
4973
  radiusTopLeft: b,
4815
4974
  radiusTopRight: j,
4816
- radiusBottomRight: I,
4817
- radiusBottomLeft: w
4975
+ radiusBottomRight: C,
4976
+ radiusBottomLeft: S
4818
4977
  }, T), O = new ue(e, R);
4819
- if (O.textCaseRaw = (Z = O.text) != null ? Z : "", r) {
4820
- const st = pe({ value: O.textCaseRaw });
4821
- st !== O.text && O.set({ text: st });
4978
+ if (O.textCaseRaw = (G = O.text) != null ? G : "", r) {
4979
+ const nt = pe({ value: O.textCaseRaw });
4980
+ nt !== O.text && O.set({ text: nt });
4822
4981
  }
4823
- return k._roundTextboxDimensions({ textbox: O }) && (O.dirty = !0), T.left === void 0 && T.top === void 0 && Y.centerObject(O), E || Y.add(O), M || Y.setActiveObject(O), Y.requestRenderAll(), x.resumeHistory(), C || x.saveState(), Y.fire("editor:text-added", {
4982
+ return k._roundTextboxDimensions({ textbox: O }) && (O.dirty = !0), T.left === void 0 && T.top === void 0 && Y.centerObject(O), E || Y.add(O), M || Y.setActiveObject(O), Y.requestRenderAll(), N.resumeHistory(), I || N.saveState(), Y.fire("editor:text-added", {
4824
4983
  textbox: O,
4825
- options: wt(B({}, R), {
4984
+ options: St(B({}, R), {
4826
4985
  text: e,
4827
4986
  bold: o,
4828
4987
  italic: i,
@@ -4830,11 +4989,11 @@ class k {
4830
4989
  align: d,
4831
4990
  color: l,
4832
4991
  strokeColor: H,
4833
- strokeWidth: K
4992
+ strokeWidth: q
4834
4993
  }),
4835
4994
  flags: {
4836
4995
  withoutSelection: !!M,
4837
- withoutSave: !!C,
4996
+ withoutSave: !!I,
4838
4997
  withoutAdding: !!E
4839
4998
  }
4840
4999
  }), O;
@@ -4848,40 +5007,40 @@ class k {
4848
5007
  * @param options.skipRender — не вызывать перерисовку канваса
4849
5008
  */
4850
5009
  updateText({ target: t, style: e = {}, withoutSave: s, skipRender: n } = {}) {
4851
- var xt, kt, Wt, zt, Pt, Ut, Ft;
5010
+ var Bt, zt, Pt, Wt, Ut, Ft, Yt;
4852
5011
  const o = this._resolveTextObject(t);
4853
5012
  if (!o) return null;
4854
5013
  const { historyManager: i } = this.editor, { canvas: a } = this;
4855
5014
  i.suspendHistory();
4856
- const r = k._getSnapshot(o), c = (xt = o.originY) != null ? xt : "top", d = o.getPointByOrigin("center", c), l = {
5015
+ const r = k._getSnapshot(o), c = (Bt = o.originY) != null ? Bt : "top", d = o.getPointByOrigin("center", c), l = {
4857
5016
  originY: c,
4858
5017
  x: d.x,
4859
5018
  y: d.y
4860
- }, Bt = e, {
5019
+ }, kt = e, {
4861
5020
  text: u,
4862
5021
  fontFamily: f,
4863
5022
  fontSize: g,
4864
5023
  bold: p,
4865
5024
  italic: m,
4866
5025
  underline: v,
4867
- uppercase: S,
5026
+ uppercase: w,
4868
5027
  strikethrough: A,
4869
5028
  align: y,
4870
5029
  color: b,
4871
5030
  strokeColor: j,
4872
- strokeWidth: I,
4873
- opacity: w,
5031
+ strokeWidth: C,
5032
+ opacity: S,
4874
5033
  backgroundColor: T,
4875
5034
  backgroundOpacity: M,
4876
- paddingTop: C,
5035
+ paddingTop: I,
4877
5036
  paddingRight: E,
4878
- paddingBottom: W,
4879
- paddingLeft: N,
4880
- radiusTopLeft: x,
5037
+ paddingBottom: z,
5038
+ paddingLeft: x,
5039
+ radiusTopLeft: N,
4881
5040
  radiusTopRight: Y,
4882
- radiusBottomRight: G,
4883
- radiusBottomLeft: K
4884
- } = Bt, H = gt(Bt, [
5041
+ radiusBottomRight: V,
5042
+ radiusBottomLeft: q
5043
+ } = kt, H = pt(kt, [
4885
5044
  "text",
4886
5045
  "fontFamily",
4887
5046
  "fontSize",
@@ -4905,57 +5064,57 @@ class k {
4905
5064
  "radiusTopRight",
4906
5065
  "radiusBottomRight",
4907
5066
  "radiusBottomLeft"
4908
- ]), R = B({}, H), O = rn({ textbox: o }), it = O ? k._expandRangeToFullLines({ textbox: o, range: O }) : null, Z = {}, st = {}, F = {}, q = dn({ textbox: o, range: O }), nt = !O || q, J = !O;
4909
- if (f !== void 0 && (it && (st.fontFamily = f), nt && (R.fontFamily = f, J && (F.fontFamily = f))), g !== void 0 && (it && (st.fontSize = g), nt && (R.fontSize = g, J && (F.fontSize = g))), p !== void 0) {
4910
- const X = p ? "bold" : "normal";
4911
- O && (Z.fontWeight = X), nt && (R.fontWeight = X, J && (F.fontWeight = X));
5067
+ ]), R = B({}, H), O = rn({ textbox: o }), at = O ? k._expandRangeToFullLines({ textbox: o, range: O }) : null, G = {}, nt = {}, F = {}, $ = dn({ textbox: o, range: O }), ot = !O || $, Q = !O;
5068
+ if (f !== void 0 && (at && (nt.fontFamily = f), ot && (R.fontFamily = f, Q && (F.fontFamily = f))), g !== void 0 && (at && (nt.fontSize = g), ot && (R.fontSize = g, Q && (F.fontSize = g))), p !== void 0) {
5069
+ const K = p ? "bold" : "normal";
5070
+ O && (G.fontWeight = K), ot && (R.fontWeight = K, Q && (F.fontWeight = K));
4912
5071
  }
4913
5072
  if (m !== void 0) {
4914
- const X = m ? "italic" : "normal";
4915
- O && (Z.fontStyle = X), nt && (R.fontStyle = X, J && (F.fontStyle = X));
5073
+ const K = m ? "italic" : "normal";
5074
+ O && (G.fontStyle = K), ot && (R.fontStyle = K, Q && (F.fontStyle = K));
4916
5075
  }
4917
- if (v !== void 0 && (O && (Z.underline = v), nt && (R.underline = v, J && (F.underline = v))), A !== void 0 && (O && (Z.linethrough = A), nt && (R.linethrough = A, J && (F.linethrough = A))), y !== void 0 && (R.textAlign = y), b !== void 0 && (O && (Z.fill = b), nt && (R.fill = b, J && (F.fill = b))), j !== void 0 || I !== void 0) {
4918
- const X = O ? Xe({ textbox: o, range: O, property: "strokeWidth" }) : void 0, Tt = O ? Xe({ textbox: o, range: O, property: "stroke" }) : void 0, ee = (Wt = (kt = I != null ? I : X) != null ? kt : o.strokeWidth) != null ? Wt : 0, Mt = Qe({ width: ee }), Yt = (Pt = (zt = j != null ? j : Tt) != null ? zt : o.stroke) != null ? Pt : void 0, Ht = Ke({
4919
- strokeColor: Yt,
4920
- width: Mt
5076
+ if (v !== void 0 && (O && (G.underline = v), ot && (R.underline = v, Q && (F.underline = v))), A !== void 0 && (O && (G.linethrough = A), ot && (R.linethrough = A, Q && (F.linethrough = A))), y !== void 0 && (R.textAlign = y), b !== void 0 && (O && (G.fill = b), ot && (R.fill = b, Q && (F.fill = b))), j !== void 0 || C !== void 0) {
5077
+ const K = O ? Xe({ textbox: o, range: O, property: "strokeWidth" }) : void 0, Et = O ? Xe({ textbox: o, range: O, property: "stroke" }) : void 0, ee = (Pt = (zt = C != null ? C : K) != null ? zt : o.strokeWidth) != null ? Pt : 0, wt = qe({ width: ee }), Ht = (Ut = (Wt = j != null ? j : Et) != null ? Wt : o.stroke) != null ? Ut : void 0, Zt = Ke({
5078
+ strokeColor: Ht,
5079
+ width: wt
4921
5080
  });
4922
- O && (Z.stroke = Ht, Z.strokeWidth = Mt), nt && (R.stroke = Ht, R.strokeWidth = Mt, J && (F.stroke = Ht, F.strokeWidth = Mt));
4923
- }
4924
- w !== void 0 && (R.opacity = w), T !== void 0 && (R.backgroundColor = T), M !== void 0 && (R.backgroundOpacity = M), C !== void 0 && (R.paddingTop = C), E !== void 0 && (R.paddingRight = E), W !== void 0 && (R.paddingBottom = W), N !== void 0 && (R.paddingLeft = N), x !== void 0 && (R.radiusTopLeft = x), Y !== void 0 && (R.radiusTopRight = Y), G !== void 0 && (R.radiusBottomRight = G), K !== void 0 && (R.radiusBottomLeft = K);
4925
- const yt = (Ft = o.textCaseRaw) != null ? Ft : (Ut = o.text) != null ? Ut : "", It = !!o.uppercase, at = u !== void 0, ft = at ? u != null ? u : "" : yt, rt = S != null ? S : It, Nt = rt !== It;
4926
- if (at || Nt) {
4927
- const X = rt ? pe({ value: ft }) : ft;
4928
- R.text = X, o.textCaseRaw = ft;
4929
- } else o.textCaseRaw === void 0 && (o.textCaseRaw = yt);
4930
- o.uppercase = rt, o.set(R);
4931
- let vt = !1;
5081
+ O && (G.stroke = Zt, G.strokeWidth = wt), ot && (R.stroke = Zt, R.strokeWidth = wt, Q && (F.stroke = Zt, F.strokeWidth = wt));
5082
+ }
5083
+ S !== void 0 && (R.opacity = S), T !== void 0 && (R.backgroundColor = T), M !== void 0 && (R.backgroundOpacity = M), I !== void 0 && (R.paddingTop = I), E !== void 0 && (R.paddingRight = E), z !== void 0 && (R.paddingBottom = z), x !== void 0 && (R.paddingLeft = x), N !== void 0 && (R.radiusTopLeft = N), Y !== void 0 && (R.radiusTopRight = Y), V !== void 0 && (R.radiusBottomRight = V), q !== void 0 && (R.radiusBottomLeft = q);
5084
+ const vt = (Yt = o.textCaseRaw) != null ? Yt : (Ft = o.text) != null ? Ft : "", It = !!o.uppercase, rt = u !== void 0, gt = rt ? u != null ? u : "" : vt, ct = w != null ? w : It, Nt = ct !== It;
5085
+ if (rt || Nt) {
5086
+ const K = ct ? pe({ value: gt }) : gt;
5087
+ R.text = K, o.textCaseRaw = gt;
5088
+ } else o.textCaseRaw === void 0 && (o.textCaseRaw = vt);
5089
+ o.uppercase = ct, o.set(R);
5090
+ let bt = !1;
4932
5091
  if (O) {
4933
- const X = ge({ textbox: o, styles: Z, range: O }), Tt = it ? ge({ textbox: o, styles: st, range: it }) : !1;
4934
- vt = X || Tt;
5092
+ const K = ge({ textbox: o, styles: G, range: O }), Et = at ? ge({ textbox: o, styles: nt, range: at }) : !1;
5093
+ bt = K || Et;
4935
5094
  } else if (Object.keys(F).length) {
4936
- const X = cn({ textbox: o });
4937
- X && (vt = ge({ textbox: o, styles: F, range: X }));
5095
+ const K = cn({ textbox: o });
5096
+ K && (bt = ge({ textbox: o, styles: F, range: K }));
4938
5097
  }
4939
- const Jt = vt && k._hasLayoutAffectingStyles({
5098
+ const Jt = bt && k._hasLayoutAffectingStyles({
4940
5099
  stylesList: [
4941
- Z,
4942
- st,
5100
+ G,
5101
+ nt,
4943
5102
  F
4944
5103
  ]
4945
5104
  });
4946
- vt && (o.dirty = !0), Jt && (o.initDimensions(), o.dirty = !0), (T !== void 0 || M !== void 0 || C !== void 0 || E !== void 0 || W !== void 0 || N !== void 0 || x !== void 0 || Y !== void 0 || G !== void 0 || K !== void 0) && (o.dirty = !0);
4947
- const qt = k._hasLayoutAffectingStyles({
5105
+ bt && (o.dirty = !0), Jt && (o.initDimensions(), o.dirty = !0), (T !== void 0 || M !== void 0 || I !== void 0 || E !== void 0 || z !== void 0 || x !== void 0 || N !== void 0 || Y !== void 0 || V !== void 0 || q !== void 0) && (o.dirty = !0);
5106
+ const Qt = k._hasLayoutAffectingStyles({
4948
5107
  stylesList: [
4949
5108
  R,
4950
- Z,
4951
- st,
5109
+ G,
5110
+ nt,
4952
5111
  F
4953
5112
  ]
4954
- }), $t = !Object.prototype.hasOwnProperty.call(R, "width") && (at || Nt || qt);
4955
- let ct = !1;
4956
- $t && (ct = this._autoExpandTextboxWidth(o, {
5113
+ }), $t = !Object.prototype.hasOwnProperty.call(R, "width") && (rt || Nt || Qt);
5114
+ let dt = !1;
5115
+ $t && (dt = this._autoExpandTextboxWidth(o, {
4957
5116
  anchor: l
4958
- }), ct && (o.dirty = !0)), (ct ? !1 : k._roundTextboxDimensions({ textbox: o })) && (o.dirty = !0), o.setCoords(), n || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
5117
+ }), dt && (o.dirty = !0)), (dt ? !1 : k._roundTextboxDimensions({ textbox: o })) && (o.dirty = !0), o.setCoords(), n || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4959
5118
  const te = k._getSnapshot(o);
4960
5119
  return a.fire("editor:text-updated", {
4961
5120
  textbox: o,
@@ -4969,7 +5128,7 @@ class k {
4969
5128
  before: r,
4970
5129
  after: te,
4971
5130
  selectionRange: O != null ? O : void 0,
4972
- selectionStyles: O && Object.keys(Z).length ? Z : void 0
5131
+ selectionStyles: O && Object.keys(G).length ? G : void 0
4973
5132
  }), o;
4974
5133
  }
4975
5134
  /**
@@ -4983,7 +5142,7 @@ class k {
4983
5142
  * Возвращает активный текст или ищет по id.
4984
5143
  */
4985
5144
  _resolveTextObject(t) {
4986
- if (t instanceof ot) return t;
5145
+ if (t instanceof it) return t;
4987
5146
  const { canvas: e } = this;
4988
5147
  if (!t) {
4989
5148
  const s = e.getActiveObject();
@@ -4999,7 +5158,7 @@ class k {
4999
5158
  * Проверяет, является ли объект текстовым блоком редактора.
5000
5159
  */
5001
5160
  static _isTextbox(t) {
5002
- return !!t && t instanceof ot;
5161
+ return !!t && t instanceof it;
5003
5162
  }
5004
5163
  /**
5005
5164
  * Вешает обработчики событий Fabric для работы с текстом.
@@ -5013,15 +5172,15 @@ class k {
5013
5172
  * но не шире монтажной области, и удерживает объект в её пределах.
5014
5173
  */
5015
5174
  _autoExpandTextboxWidth(t, { anchor: e } = {}) {
5016
- var I, w, T, M, C, E, W, N, x, Y, G, K, H;
5175
+ var C, S, T, M, I, E, z, x, N, Y, V, q, H;
5017
5176
  const { montageArea: s } = this.editor;
5018
5177
  if (!s) return !1;
5019
5178
  const n = typeof t.text == "string" ? t.text : "";
5020
5179
  if (!n.length) return !1;
5021
5180
  s.setCoords();
5022
- const o = s.getBoundingRect(!1, !0), i = (I = o.width) != null ? I : 0;
5181
+ const o = s.getBoundingRect(!1, !0), i = (C = o.width) != null ? C : 0;
5023
5182
  if (!Number.isFinite(i) || i <= 0) return !1;
5024
- const a = e != null ? e : (w = this.editingAnchorState) == null ? void 0 : w.get(t), r = (M = (T = a == null ? void 0 : a.originY) != null ? T : t.originY) != null ? M : "top", c = Math.abs((C = t.scaleX) != null ? C : 1) || 1, d = (E = t.paddingLeft) != null ? E : 0, l = (W = t.paddingRight) != null ? W : 0, u = (N = t.strokeWidth) != null ? N : 0, f = Math.max(
5183
+ const a = e != null ? e : (S = this.editingAnchorState) == null ? void 0 : S.get(t), r = (M = (T = a == null ? void 0 : a.originY) != null ? T : t.originY) != null ? M : "top", c = Math.abs((I = t.scaleX) != null ? I : 1) || 1, d = (E = t.paddingLeft) != null ? E : 0, l = (z = t.paddingRight) != null ? z : 0, u = (x = t.strokeWidth) != null ? x : 0, f = Math.max(
5025
5184
  1,
5026
5185
  i / c - d - l - u
5027
5186
  );
@@ -5029,18 +5188,18 @@ class k {
5029
5188
  const g = n.split(`
5030
5189
  `).length;
5031
5190
  let p = !1;
5032
- Math.abs(((x = t.width) != null ? x : 0) - f) > $ && (t.set({ width: f }), p = !0), t.initDimensions();
5033
- const { textLines: m } = t, v = Array.isArray(m) && m.length > g, S = Math.ceil(
5191
+ Math.abs(((N = t.width) != null ? N : 0) - f) > tt && (t.set({ width: f }), p = !0), t.initDimensions();
5192
+ const { textLines: m } = t, v = Array.isArray(m) && m.length > g, w = Math.ceil(
5034
5193
  k._getLongestLineWidth({ textbox: t, text: n })
5035
5194
  ), A = Math.min((Y = t.minWidth) != null ? Y : 1, f);
5036
5195
  let y = Math.min(
5037
5196
  f,
5038
- Math.max(S, A)
5197
+ Math.max(w, A)
5039
5198
  );
5040
- v && (y = f), Math.abs(((G = t.width) != null ? G : 0) - y) > $ && (t.set({ width: y }), t.initDimensions(), p = !0), k._roundTextboxDimensions({ textbox: t }) && (p = !0), a && (t.setPositionByOrigin(new tt(a.x, a.y), "center", r), p = !0);
5199
+ v && (y = f), Math.abs(((V = t.width) != null ? V : 0) - y) > tt && (t.set({ width: y }), t.initDimensions(), p = !0), k._roundTextboxDimensions({ textbox: t }) && (p = !0), a && (t.setPositionByOrigin(new et(a.x, a.y), "center", r), p = !0);
5041
5200
  const j = k._clampTextboxToMontage({
5042
5201
  textbox: t,
5043
- montageLeft: (K = o.left) != null ? K : 0,
5202
+ montageLeft: (q = o.left) != null ? q : 0,
5044
5203
  montageRight: ((H = o.left) != null ? H : 0) + i
5045
5204
  });
5046
5205
  return p || j;
@@ -5072,10 +5231,10 @@ class k {
5072
5231
  var c, d, l, u;
5073
5232
  t.setCoords();
5074
5233
  const n = t.getBoundingRect(!1, !0), o = (c = n.left) != null ? c : 0, i = o + ((d = n.width) != null ? d : 0), a = s - e;
5075
- if (a > 0 && ((l = n.width) != null ? l : 0) >= a - $)
5234
+ if (a > 0 && ((l = n.width) != null ? l : 0) >= a - tt)
5076
5235
  return !1;
5077
5236
  let r = 0;
5078
- return o < e ? r = e - o : i > s && (r = s - i), Math.abs(r) <= $ ? !1 : (t.set({ left: ((u = t.left) != null ? u : 0) + r }), !0);
5237
+ return o < e ? r = e - o : i > s && (r = s - i), Math.abs(r) <= tt ? !1 : (t.set({ left: ((u = t.left) != null ? u : 0) + r }), !0);
5079
5238
  }
5080
5239
  /**
5081
5240
  * Обрабатывает изменение ширины текстового объекта (resizing).
@@ -5097,7 +5256,7 @@ class k {
5097
5256
  e.set({ width: r });
5098
5257
  const c = (u = e.width) != null ? u : 0, d = a - c;
5099
5258
  if (d !== 0 && s && s.corner === "ml") {
5100
- const S = ((f = e.angle) != null ? f : 0) * Math.PI / 180, A = Math.cos(S), y = Math.sin(S), b = (g = e.scaleX) != null ? g : 1, j = d * b;
5259
+ const w = ((f = e.angle) != null ? f : 0) * Math.PI / 180, A = Math.cos(w), y = Math.sin(w), b = (g = e.scaleX) != null ? g : 1, j = d * b;
5101
5260
  e.set({
5102
5261
  left: ((p = e.left) != null ? p : 0) + j * A,
5103
5262
  top: ((m = e.top) != null ? m : 0) + j * y
@@ -5234,8 +5393,8 @@ class k {
5234
5393
  snapshot: R,
5235
5394
  entries: O
5236
5395
  }) => {
5237
- Object.entries(O).forEach(([it, Z]) => {
5238
- Z != null && (R[it] = Z);
5396
+ Object.entries(O).forEach(([at, G]) => {
5397
+ G != null && (R[at] = G);
5239
5398
  });
5240
5399
  }, {
5241
5400
  id: s,
@@ -5253,23 +5412,23 @@ class k {
5253
5412
  stroke: p,
5254
5413
  strokeWidth: m,
5255
5414
  opacity: v,
5256
- backgroundColor: S,
5415
+ backgroundColor: w,
5257
5416
  backgroundOpacity: A,
5258
5417
  paddingTop: y,
5259
5418
  paddingRight: b,
5260
5419
  paddingBottom: j,
5261
- paddingLeft: I,
5262
- radiusTopLeft: w,
5420
+ paddingLeft: C,
5421
+ radiusTopLeft: S,
5263
5422
  radiusTopRight: T,
5264
5423
  radiusBottomRight: M,
5265
- radiusBottomLeft: C,
5424
+ radiusBottomLeft: I,
5266
5425
  left: E,
5267
- top: W,
5268
- width: N,
5269
- height: x,
5426
+ top: z,
5427
+ width: x,
5428
+ height: N,
5270
5429
  angle: Y,
5271
- scaleX: G,
5272
- scaleY: K
5430
+ scaleX: V,
5431
+ scaleY: q
5273
5432
  } = t, H = {
5274
5433
  id: s,
5275
5434
  uppercase: !!i,
@@ -5290,23 +5449,23 @@ class k {
5290
5449
  stroke: p,
5291
5450
  strokeWidth: m,
5292
5451
  opacity: v,
5293
- backgroundColor: S,
5452
+ backgroundColor: w,
5294
5453
  backgroundOpacity: A,
5295
5454
  paddingTop: y,
5296
5455
  paddingRight: b,
5297
5456
  paddingBottom: j,
5298
- paddingLeft: I,
5299
- radiusTopLeft: w,
5457
+ paddingLeft: C,
5458
+ radiusTopLeft: S,
5300
5459
  radiusTopRight: T,
5301
5460
  radiusBottomRight: M,
5302
- radiusBottomLeft: C,
5461
+ radiusBottomLeft: I,
5303
5462
  left: E,
5304
- top: W,
5305
- width: N,
5306
- height: x,
5463
+ top: z,
5464
+ width: x,
5465
+ height: N,
5307
5466
  angle: Y,
5308
- scaleX: G,
5309
- scaleY: K
5467
+ scaleX: V,
5468
+ scaleY: q
5310
5469
  }
5311
5470
  }), H;
5312
5471
  }
@@ -5318,7 +5477,7 @@ class k {
5318
5477
  return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
5319
5478
  }
5320
5479
  }
5321
- const Q = ({
5480
+ const J = ({
5322
5481
  value: h,
5323
5482
  fallback: t = 0
5324
5483
  }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, ae = ({
@@ -5326,7 +5485,7 @@ const Q = ({
5326
5485
  dimension: t,
5327
5486
  useRelativePositions: e
5328
5487
  }) => {
5329
- const s = Q({ value: h });
5488
+ const s = J({ value: h });
5330
5489
  return e ? s : s / (t || 1);
5331
5490
  }, ln = ({
5332
5491
  object: h,
@@ -5357,7 +5516,7 @@ const Q = ({
5357
5516
  value: r,
5358
5517
  dimension: e,
5359
5518
  useRelativePositions: s
5360
- }), f = Q({ value: c }) / (t || 1), g = Q({ value: d }) / (e || 1);
5519
+ }), f = J({ value: c }) / (t || 1), g = J({ value: d }) / (e || 1);
5361
5520
  return {
5362
5521
  x: l + f / 2,
5363
5522
  y: u + g / 2
@@ -5372,10 +5531,10 @@ const Q = ({
5372
5531
  const { left: o, top: i, width: a, height: r } = e;
5373
5532
  if (!n) {
5374
5533
  const { width: l, height: u } = s, f = o + h * (l || a), g = i + t * (u || r);
5375
- return new tt(f, g);
5534
+ return new et(f, g);
5376
5535
  }
5377
5536
  const c = o + h * a, d = i + t * r;
5378
- return new tt(c, d);
5537
+ return new et(c, d);
5379
5538
  }, un = ({
5380
5539
  object: h,
5381
5540
  montageArea: t,
@@ -5391,7 +5550,7 @@ const Q = ({
5391
5550
  } catch (s) {
5392
5551
  return null;
5393
5552
  }
5394
- }, mt = ({
5553
+ }, yt = ({
5395
5554
  object: h
5396
5555
  }) => {
5397
5556
  if (!h) return null;
@@ -5455,7 +5614,7 @@ const Q = ({
5455
5614
  };
5456
5615
  }
5457
5616
  return null;
5458
- }, Vt = "_templateCenterX", me = "_templateCenterY", re = "_templateAnchorX", ye = "_templateAnchorY";
5617
+ }, Xt = "_templateCenterX", me = "_templateCenterY", re = "_templateAnchorX", ye = "_templateAnchorY";
5459
5618
  class _ {
5460
5619
  constructor({ editor: t }) {
5461
5620
  this.editor = t;
@@ -5480,25 +5639,25 @@ class _ {
5480
5639
  return a.emitWarning({
5481
5640
  origin: "TemplateManager",
5482
5641
  method: "serializeSelection",
5483
- code: St.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5642
+ code: At.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5484
5643
  message: "Нет объектов для сериализации шаблона"
5485
5644
  }), null;
5486
- const g = _._getBounds(i), p = _._getMontageSize({ montageArea: i, bounds: g }), m = p.width, v = p.height, S = f.map((b) => _._serializeObject({
5645
+ const g = _._getBounds(i), p = _._getMontageSize({ montageArea: i, bounds: g }), m = p.width, v = p.height, w = f.map((b) => _._serializeObject({
5487
5646
  object: b,
5488
5647
  bounds: g,
5489
5648
  baseWidth: m,
5490
5649
  baseHeight: v,
5491
5650
  montageArea: i != null ? i : null
5492
- })), A = wt(B({}, s), {
5651
+ })), A = St(B({}, s), {
5493
5652
  baseWidth: m,
5494
5653
  baseHeight: v,
5495
5654
  positionsNormalized: !0,
5496
5655
  previewId: e != null ? e : s.previewId
5497
5656
  });
5498
5657
  return {
5499
- id: t != null ? t : `template-${V()}`,
5658
+ id: t != null ? t : `template-${X()}`,
5500
5659
  meta: A,
5501
- objects: S
5660
+ objects: w
5502
5661
  };
5503
5662
  }
5504
5663
  /**
@@ -5508,7 +5667,7 @@ class _ {
5508
5667
  * @param options.data - данные для заполнения текстов по customData.templateField
5509
5668
  */
5510
5669
  applyTemplate(s) {
5511
- return z(this, arguments, function* ({
5670
+ return P(this, arguments, function* ({
5512
5671
  template: t,
5513
5672
  data: e
5514
5673
  }) {
@@ -5523,7 +5682,7 @@ class _ {
5523
5682
  return a.emitWarning({
5524
5683
  origin: "TemplateManager",
5525
5684
  method: "applyTemplate",
5526
- code: St.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5685
+ code: At.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5527
5686
  message: "Шаблон не содержит объектов"
5528
5687
  }), null;
5529
5688
  const u = _._getBounds(o);
@@ -5531,11 +5690,11 @@ class _ {
5531
5690
  return a.emitWarning({
5532
5691
  origin: "TemplateManager",
5533
5692
  method: "applyTemplate",
5534
- code: St.TEMPLATE_MANAGER.INVALID_TARGET,
5693
+ code: At.TEMPLATE_MANAGER.INVALID_TARGET,
5535
5694
  message: "Не удалось определить границы монтажной области"
5536
5695
  }), null;
5537
5696
  const f = _._getMontageSize({ montageArea: o, bounds: u }), g = _._normalizeMeta({ meta: d, fallback: f }), p = _._calculateScale({ meta: g, target: f }), m = !!g.positionsNormalized;
5538
- let v = !1, S = !1;
5697
+ let v = !1, w = !1;
5539
5698
  i.suspendHistory();
5540
5699
  try {
5541
5700
  const A = yield _._enlivenObjects(c);
@@ -5543,20 +5702,20 @@ class _ {
5543
5702
  return a.emitWarning({
5544
5703
  origin: "TemplateManager",
5545
5704
  method: "applyTemplate",
5546
- code: St.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5705
+ code: At.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5547
5706
  message: "Не удалось создать объекты шаблона"
5548
5707
  }), null;
5549
5708
  const { backgroundObject: y, contentObjects: b } = _._extractBackgroundObject(A);
5550
- y && (S = yield _._applyBackgroundFromObject({
5709
+ y && (w = yield _._applyBackgroundFromObject({
5551
5710
  backgroundObject: y,
5552
5711
  backgroundManager: r,
5553
5712
  errorManager: a
5554
5713
  }));
5555
- const j = b.map((I) => (this._adaptTextboxWidth({
5556
- object: I,
5714
+ const j = b.map((C) => (this._adaptTextboxWidth({
5715
+ object: C,
5557
5716
  baseWidth: g.baseWidth
5558
5717
  }), _._transformObject({
5559
- object: I,
5718
+ object: C,
5560
5719
  scale: p,
5561
5720
  bounds: u,
5562
5721
  targetSize: f,
@@ -5564,11 +5723,11 @@ class _ {
5564
5723
  baseHeight: g.baseHeight,
5565
5724
  montageArea: o,
5566
5725
  useRelativePositions: m
5567
- }), I.set({
5568
- id: `${I.type}-${V()}`,
5726
+ }), C.set({
5727
+ id: `${C.type}-${X()}`,
5569
5728
  evented: !0
5570
- }), n.add(I), I));
5571
- return !j.length && !S ? null : (v = j.length > 0 || S, j.length && _._activateObjects({ canvas: n, objects: j }), n.requestRenderAll(), n.fire("editor:template-applied", {
5729
+ }), n.add(C), C));
5730
+ return !j.length && !w ? null : (v = j.length > 0 || w, j.length && _._activateObjects({ canvas: n, objects: j }), n.requestRenderAll(), n.fire("editor:template-applied", {
5572
5731
  template: t,
5573
5732
  objects: j,
5574
5733
  bounds: u
@@ -5577,7 +5736,7 @@ class _ {
5577
5736
  return a.emitError({
5578
5737
  origin: "TemplateManager",
5579
5738
  method: "applyTemplate",
5580
- code: St.TEMPLATE_MANAGER.APPLY_FAILED,
5739
+ code: At.TEMPLATE_MANAGER.APPLY_FAILED,
5581
5740
  message: "Ошибка применения шаблона",
5582
5741
  data: {
5583
5742
  templateId: l,
@@ -5617,14 +5776,14 @@ class _ {
5617
5776
  * Превращает plain-описание объектов в Fabric объекты.
5618
5777
  */
5619
5778
  static _enlivenObjects(t) {
5620
- return z(this, null, function* () {
5621
- return (yield Promise.all(t.map((s) => z(null, null, function* () {
5779
+ return P(this, null, function* () {
5780
+ return (yield Promise.all(t.map((s) => P(null, null, function* () {
5622
5781
  if (_._hasSerializedSvgMarkup(s)) {
5623
5782
  const i = yield _._reviveSvgObject(s);
5624
5783
  if (i)
5625
5784
  return _._restoreImageScale({ revived: i, serialized: s }), i;
5626
5785
  }
5627
- const n = yield ut.enlivenObjects([s]), o = n == null ? void 0 : n[0];
5786
+ const n = yield ft.enlivenObjects([s]), o = n == null ? void 0 : n[0];
5628
5787
  return o ? (_._restoreImageScale({ revived: o, serialized: s }), o) : null;
5629
5788
  })))).filter((s) => !!s);
5630
5789
  });
@@ -5653,22 +5812,22 @@ class _ {
5653
5812
  naturalHeight: 0,
5654
5813
  width: 0,
5655
5814
  height: 0
5656
- }, p = Q({ value: l || f || c.width, fallback: 0 }), m = Q({ value: u || g || c.height, fallback: 0 }), v = Q({ value: n, fallback: p }), S = Q({ value: o, fallback: m }), A = Q({ value: i, fallback: c.scaleX || 1 }), y = Q({ value: a, fallback: c.scaleY || 1 }), b = v * A, j = S * y, I = p > 0, w = m > 0, T = b > 0, M = j > 0, C = _._resolveImageFit({ customData: r }), E = {};
5657
- if (I && (E.width = p), w && (E.height = m), !I || !w) {
5815
+ }, p = J({ value: l || f || c.width, fallback: 0 }), m = J({ value: u || g || c.height, fallback: 0 }), v = J({ value: n, fallback: p }), w = J({ value: o, fallback: m }), A = J({ value: i, fallback: c.scaleX || 1 }), y = J({ value: a, fallback: c.scaleY || 1 }), b = v * A, j = w * y, C = p > 0, S = m > 0, T = b > 0, M = j > 0, I = _._resolveImageFit({ customData: r }), E = {};
5816
+ if (C && (E.width = p), S && (E.height = m), !C || !S) {
5658
5817
  c.set(E);
5659
5818
  return;
5660
5819
  }
5661
- if (C === "stretch") {
5662
- const N = T ? b / p : null, x = M ? j / m : null;
5663
- N && N > 0 && (E.scaleX = N), x && x > 0 && (E.scaleY = x), c.set(E);
5820
+ if (I === "stretch") {
5821
+ const x = T ? b / p : null, N = M ? j / m : null;
5822
+ x && x > 0 && (E.scaleX = x), N && N > 0 && (E.scaleY = N), c.set(E);
5664
5823
  return;
5665
5824
  }
5666
5825
  if (!T || !M) {
5667
5826
  c.set(E);
5668
5827
  return;
5669
5828
  }
5670
- const W = Math.min(b / p, j / m);
5671
- Number.isFinite(W) && W > 0 && (E.scaleX = W, E.scaleY = W), c.set(E);
5829
+ const z = Math.min(b / p, j / m);
5830
+ Number.isFinite(z) && z > 0 && (E.scaleX = z, E.scaleY = z), c.set(E);
5672
5831
  }
5673
5832
  /**
5674
5833
  * Определяет режим вписывания изображения при восстановлении.
@@ -5690,11 +5849,11 @@ class _ {
5690
5849
  * Восстанавливает SVG-объект из компактного описания.
5691
5850
  */
5692
5851
  static _reviveSvgObject(t) {
5693
- return z(this, null, function* () {
5852
+ return P(this, null, function* () {
5694
5853
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5695
5854
  if (!e) return null;
5696
5855
  try {
5697
- const s = yield ys(e), n = ut.groupSVGElements(s.objects, s.options), o = yield ut.enlivenObjectEnlivables(
5856
+ const s = yield ys(e), n = ft.groupSVGElements(s.objects, s.options), o = yield ft.enlivenObjectEnlivables(
5698
5857
  _._prepareSerializableProps(t)
5699
5858
  );
5700
5859
  return n.set(o), n.setCoords(), n;
@@ -5759,10 +5918,10 @@ class _ {
5759
5918
  baseHeight: i,
5760
5919
  useRelativePositions: r,
5761
5920
  centerKeys: {
5762
- x: Vt,
5921
+ x: Xt,
5763
5922
  y: me
5764
5923
  }
5765
- }), { scaleX: u, scaleY: f } = t, g = Q({ value: u, fallback: 1 }), p = Q({ value: f, fallback: 1 }), m = _._getPositioningBounds({
5924
+ }), { scaleX: u, scaleY: f } = t, g = J({ value: u, fallback: 1 }), p = J({ value: f, fallback: 1 }), m = _._getPositioningBounds({
5766
5925
  bounds: s,
5767
5926
  baseWidth: o,
5768
5927
  baseHeight: i,
@@ -5776,11 +5935,11 @@ class _ {
5776
5935
  bounds: m,
5777
5936
  targetSize: n,
5778
5937
  montageArea: a
5779
- }), S = g * e, A = p * e;
5938
+ }), w = g * e, A = p * e;
5780
5939
  t.set({
5781
- scaleX: S,
5940
+ scaleX: w,
5782
5941
  scaleY: A
5783
- }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Vt], delete c[me], delete c[re], delete c[ye];
5942
+ }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Xt], delete c[me], delete c[re], delete c[ye];
5784
5943
  }
5785
5944
  /**
5786
5945
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -5827,7 +5986,7 @@ class _ {
5827
5986
  meta: t,
5828
5987
  fallback: e
5829
5988
  }) {
5830
- const { width: s, height: n } = e, r = t || {}, { baseWidth: o = s, baseHeight: i = n } = r, a = gt(r, ["baseWidth", "baseHeight"]);
5989
+ const { width: s, height: n } = e, r = t || {}, { baseWidth: o = s, baseHeight: i = n } = r, a = pt(r, ["baseWidth", "baseHeight"]);
5831
5990
  return B({
5832
5991
  baseWidth: o,
5833
5992
  baseHeight: i
@@ -5865,30 +6024,30 @@ class _ {
5865
6024
  object: t,
5866
6025
  baseWidth: e
5867
6026
  }) {
5868
- var Y, G;
5869
- if (!(t instanceof ot)) return;
6027
+ var Y, V;
6028
+ if (!(t instanceof it)) return;
5870
6029
  const s = typeof t.text == "string" ? t.text : "";
5871
6030
  if (!s) return;
5872
- const n = Q({
5873
- value: (G = (Y = this.editor) == null ? void 0 : Y.montageArea) == null ? void 0 : G.width,
6031
+ const n = J({
6032
+ value: (V = (Y = this.editor) == null ? void 0 : Y.montageArea) == null ? void 0 : V.width,
5874
6033
  fallback: 0
5875
6034
  }), {
5876
6035
  width: o = 0,
5877
6036
  scaleX: i = 1,
5878
6037
  strokeWidth: a = 0
5879
- } = t, r = Q({ value: e, fallback: 0 }), c = t, d = Q({ value: c.paddingLeft, fallback: 0 }), l = Q({ value: c.paddingRight, fallback: 0 }), u = Q({ value: i, fallback: 1 }), f = Q({ value: a, fallback: 0 }) * u, g = Q({ value: o, fallback: 0 }), p = g * u, m = d * u, v = l * u, S = p + m + v + f;
6038
+ } = t, r = J({ value: e, fallback: 0 }), c = t, d = J({ value: c.paddingLeft, fallback: 0 }), l = J({ value: c.paddingRight, fallback: 0 }), u = J({ value: i, fallback: 1 }), f = J({ value: a, fallback: 0 }) * u, g = J({ value: o, fallback: 0 }), p = g * u, m = d * u, v = l * u, w = p + m + v + f;
5880
6039
  if (!n || !g || !r) return;
5881
6040
  t.setCoords();
5882
- const A = t, y = A[Vt], b = typeof y == "number" ? y : null, j = _._resolveAnchor(A, re), I = S / r, w = b !== null ? b - I / 2 : null, T = b !== null ? b + I / 2 : null, M = t.getCenterPoint();
6041
+ const A = t, y = A[Xt], b = typeof y == "number" ? y : null, j = _._resolveAnchor(A, re), C = w / r, S = b !== null ? b - C / 2 : null, T = b !== null ? b + C / 2 : null, M = t.getCenterPoint();
5883
6042
  t.set("width", n), t.initDimensions();
5884
- const C = _._getLongestLineWidth({
6043
+ const I = _._getLongestLineWidth({
5885
6044
  textbox: t,
5886
6045
  text: s
5887
- }), E = C > g ? C + 1 : g;
6046
+ }), E = I > g ? I + 1 : g;
5888
6047
  t.set("width", E), t.initDimensions(), t.setPositionByOrigin(M, "center", "center"), t.setCoords();
5889
- const N = (E * u + m + v + f) / r;
5890
- let x = b;
5891
- j === "start" && w !== null ? x = Math.max(0, w) + N / 2 : j === "end" && T !== null && (x = Math.min(1, T) - N / 2), typeof x == "number" && (A[Vt] = x);
6048
+ const x = (E * u + m + v + f) / r;
6049
+ let N = b;
6050
+ j === "start" && S !== null ? N = Math.max(0, S) + x / 2 : j === "end" && T !== null && (N = Math.min(1, T) - x / 2), typeof N == "number" && (A[Xt] = N);
5892
6051
  }
5893
6052
  /**
5894
6053
  * Возвращает ширину самой длинной строки текстового объекта.
@@ -5939,11 +6098,11 @@ class _ {
5939
6098
  x: (y.x - a) / u,
5940
6099
  y: (y.y - r) / f
5941
6100
  };
5942
- })(), m = (l.left - a) / u, v = (l.top - r) / f, S = m + l.width / u, A = v + l.height / f;
5943
- return i[Vt] = p.x, i[me] = p.y, i[re] = _._detectAnchor({
6101
+ })(), m = (l.left - a) / u, v = (l.top - r) / f, w = m + l.width / u, A = v + l.height / f;
6102
+ return i[Xt] = p.x, i[me] = p.y, i[re] = _._detectAnchor({
5944
6103
  center: p.x,
5945
6104
  start: m,
5946
- end: S
6105
+ end: w
5947
6106
  }), i[ye] = _._detectAnchor({
5948
6107
  center: p.y,
5949
6108
  start: v,
@@ -5964,7 +6123,7 @@ class _ {
5964
6123
  * Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
5965
6124
  */
5966
6125
  static _applyBackgroundFromObject(n) {
5967
- return z(this, arguments, function* ({
6126
+ return P(this, arguments, function* ({
5968
6127
  backgroundObject: t,
5969
6128
  backgroundManager: e,
5970
6129
  errorManager: s
@@ -6002,7 +6161,7 @@ class _ {
6002
6161
  s.emitWarning({
6003
6162
  origin: "TemplateManager",
6004
6163
  method: "applyTemplate",
6005
- code: St.TEMPLATE_MANAGER.APPLY_FAILED,
6164
+ code: At.TEMPLATE_MANAGER.APPLY_FAILED,
6006
6165
  message: "Не удалось применить фон из шаблона",
6007
6166
  data: o
6008
6167
  });
@@ -6058,7 +6217,7 @@ class _ {
6058
6217
  */
6059
6218
  // eslint-disable-next-line class-methods-use-this
6060
6219
  enlivenObjectEnlivables(t) {
6061
- return ut.enlivenObjectEnlivables(t);
6220
+ return ft.enlivenObjectEnlivables(t);
6062
6221
  }
6063
6222
  }
6064
6223
  const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
@@ -6198,9 +6357,9 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6198
6357
  return { delta: 0, guide: null };
6199
6358
  const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
6200
6359
  if (u && f) {
6201
- const { bounds: y } = u, { bounds: b } = f, j = y.top - b.bottom, I = o - y.bottom, w = Math.abs(I - j);
6202
- if (w <= e) {
6203
- const T = j - I, M = o + T, C = {
6360
+ const { bounds: y } = u, { bounds: b } = f, j = y.top - b.bottom, C = o - y.bottom, S = Math.abs(C - j);
6361
+ if (S <= e) {
6362
+ const T = j - C, M = o + T, I = {
6204
6363
  type: "vertical",
6205
6364
  axis: n,
6206
6365
  refStart: b.bottom,
@@ -6209,13 +6368,13 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6209
6368
  activeEnd: M,
6210
6369
  distance: j
6211
6370
  };
6212
- m.push({ delta: T, guide: C, diff: w });
6371
+ m.push({ delta: T, guide: I, diff: S });
6213
6372
  }
6214
6373
  }
6215
6374
  if (g && p) {
6216
- const { bounds: y } = g, { bounds: b } = p, j = b.top - y.bottom, I = y.top - i, w = Math.abs(I - j);
6217
- if (w <= e) {
6218
- const T = I - j, M = i + T, C = {
6375
+ const { bounds: y } = g, { bounds: b } = p, j = b.top - y.bottom, C = y.top - i, S = Math.abs(C - j);
6376
+ if (S <= e) {
6377
+ const T = C - j, M = i + T, I = {
6219
6378
  type: "vertical",
6220
6379
  axis: n,
6221
6380
  refStart: y.bottom,
@@ -6224,35 +6383,35 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6224
6383
  activeEnd: y.top,
6225
6384
  distance: j
6226
6385
  };
6227
- m.push({ delta: T, guide: C, diff: w });
6386
+ m.push({ delta: T, guide: I, diff: S });
6228
6387
  }
6229
6388
  }
6230
6389
  if (u && g) {
6231
- const { bounds: y } = u, { bounds: b } = g, I = b.top - y.bottom - v;
6232
- if (I >= 0) {
6233
- const w = I / 2, T = o - y.bottom, M = b.top - i, C = Math.abs(T - w), E = Math.abs(M - w), W = Math.max(C, E);
6234
- if (W <= e) {
6235
- const N = w - T, x = i + N, Y = {
6390
+ const { bounds: y } = u, { bounds: b } = g, C = b.top - y.bottom - v;
6391
+ if (C >= 0) {
6392
+ const S = C / 2, T = o - y.bottom, M = b.top - i, I = Math.abs(T - S), E = Math.abs(M - S), z = Math.max(I, E);
6393
+ if (z <= e) {
6394
+ const x = S - T, N = i + x, Y = {
6236
6395
  type: "vertical",
6237
6396
  axis: n,
6238
6397
  refStart: y.bottom,
6239
- refEnd: y.bottom + w,
6240
- activeStart: x,
6241
- activeEnd: x + w,
6242
- distance: w
6398
+ refEnd: y.bottom + S,
6399
+ activeStart: N,
6400
+ activeEnd: N + S,
6401
+ distance: S
6243
6402
  };
6244
- m.push({ delta: N, guide: Y, diff: W });
6403
+ m.push({ delta: x, guide: Y, diff: z });
6245
6404
  }
6246
6405
  }
6247
6406
  }
6248
- const S = is({
6407
+ const w = is({
6249
6408
  activeBounds: h,
6250
6409
  aligned: c,
6251
6410
  threshold: e,
6252
6411
  patterns: s,
6253
6412
  type: "vertical"
6254
6413
  });
6255
- if (m.push(...S), !m.length)
6414
+ if (m.push(...w), !m.length)
6256
6415
  return { delta: 0, guide: null };
6257
6416
  const A = m.reduce((y, b) => b.diff < y.diff ? b : y, m[0]);
6258
6417
  return {
@@ -6284,9 +6443,9 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6284
6443
  return { delta: 0, guide: null };
6285
6444
  const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
6286
6445
  if (u && f) {
6287
- const { bounds: y } = u, { bounds: b } = f, j = y.left - b.right, I = o - y.right, w = Math.abs(I - j);
6288
- if (w <= e) {
6289
- const T = j - I, M = o + T, C = {
6446
+ const { bounds: y } = u, { bounds: b } = f, j = y.left - b.right, C = o - y.right, S = Math.abs(C - j);
6447
+ if (S <= e) {
6448
+ const T = j - C, M = o + T, I = {
6290
6449
  type: "horizontal",
6291
6450
  axis: n,
6292
6451
  refStart: b.right,
@@ -6295,13 +6454,13 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6295
6454
  activeEnd: M,
6296
6455
  distance: j
6297
6456
  };
6298
- m.push({ delta: T, guide: C, diff: w });
6457
+ m.push({ delta: T, guide: I, diff: S });
6299
6458
  }
6300
6459
  }
6301
6460
  if (g && p) {
6302
- const { bounds: y } = g, { bounds: b } = p, j = b.left - y.right, I = y.left - i, w = Math.abs(I - j);
6303
- if (w <= e) {
6304
- const T = I - j, M = i + T, C = {
6461
+ const { bounds: y } = g, { bounds: b } = p, j = b.left - y.right, C = y.left - i, S = Math.abs(C - j);
6462
+ if (S <= e) {
6463
+ const T = C - j, M = i + T, I = {
6305
6464
  type: "horizontal",
6306
6465
  axis: n,
6307
6466
  refStart: y.right,
@@ -6310,35 +6469,35 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6310
6469
  activeEnd: y.left,
6311
6470
  distance: j
6312
6471
  };
6313
- m.push({ delta: T, guide: C, diff: w });
6472
+ m.push({ delta: T, guide: I, diff: S });
6314
6473
  }
6315
6474
  }
6316
6475
  if (u && g) {
6317
- const { bounds: y } = u, { bounds: b } = g, I = b.left - y.right - v;
6318
- if (I >= 0) {
6319
- const w = I / 2, T = o - y.right, M = b.left - i, C = Math.abs(T - w), E = Math.abs(M - w), W = Math.max(C, E);
6320
- if (W <= e) {
6321
- const N = w - T, x = i + N, Y = {
6476
+ const { bounds: y } = u, { bounds: b } = g, C = b.left - y.right - v;
6477
+ if (C >= 0) {
6478
+ const S = C / 2, T = o - y.right, M = b.left - i, I = Math.abs(T - S), E = Math.abs(M - S), z = Math.max(I, E);
6479
+ if (z <= e) {
6480
+ const x = S - T, N = i + x, Y = {
6322
6481
  type: "horizontal",
6323
6482
  axis: n,
6324
6483
  refStart: y.right,
6325
- refEnd: y.right + w,
6326
- activeStart: x,
6327
- activeEnd: x + w,
6328
- distance: w
6484
+ refEnd: y.right + S,
6485
+ activeStart: N,
6486
+ activeEnd: N + S,
6487
+ distance: S
6329
6488
  };
6330
- m.push({ delta: N, guide: Y, diff: W });
6489
+ m.push({ delta: x, guide: Y, diff: z });
6331
6490
  }
6332
6491
  }
6333
6492
  }
6334
- const S = is({
6493
+ const w = is({
6335
6494
  activeBounds: h,
6336
6495
  aligned: c,
6337
6496
  threshold: e,
6338
6497
  patterns: s,
6339
6498
  type: "horizontal"
6340
6499
  });
6341
- if (m.push(...S), !m.length)
6500
+ if (m.push(...w), !m.length)
6342
6501
  return { delta: 0, guide: null };
6343
6502
  const A = m.reduce((y, b) => b.diff < y.diff ? b : y, m[0]);
6344
6503
  return {
@@ -6394,16 +6553,16 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6394
6553
  offsetAlongAxis: f = 0,
6395
6554
  offsetPerpendicular: g = 0
6396
6555
  }) => {
6397
- const p = i || 1, m = 12 / p, v = l / p, S = u / p, A = (s + n) / 2 + f, y = t === "vertical" ? e + g : A, b = t === "vertical" ? A : e + g;
6556
+ const p = i || 1, m = 12 / p, v = l / p, w = u / p, A = (s + n) / 2 + f, y = t === "vertical" ? e + g : A, b = t === "vertical" ? A : e + g;
6398
6557
  h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = d / p, h.font = `${m}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
6399
- const I = h.measureText(o).width + v * 2, w = m + v * 2, T = y - I / 2, M = b - w / 2;
6558
+ const C = h.measureText(o).width + v * 2, S = m + v * 2, T = y - C / 2, M = b - S / 2;
6400
6559
  h.beginPath(), Mn({
6401
6560
  context: h,
6402
6561
  x: T,
6403
6562
  y: M,
6404
- width: I,
6405
- height: w,
6406
- radius: S
6563
+ width: C,
6564
+ height: S,
6565
+ radius: w
6407
6566
  }), h.fill(), h.fillStyle = r, h.fillText(o, y, b), h.restore();
6408
6567
  }, wn = ({
6409
6568
  context: h,
@@ -6442,7 +6601,7 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6442
6601
  color: l,
6443
6602
  lineWidth: Ae
6444
6603
  });
6445
- }, qe = ({
6604
+ }, Qe = ({
6446
6605
  anchors: h,
6447
6606
  bounds: t
6448
6607
  }) => {
@@ -6468,8 +6627,8 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6468
6627
  for (let p = r + 1; p < a.length; p += 1) {
6469
6628
  const m = a[p];
6470
6629
  if (Math.min(c[i], m[i]) - Math.max(c[o], m[o]) < 0) continue;
6471
- const S = m[e] - c[s];
6472
- S < 0 || S < l && (l = S, d = m);
6630
+ const w = m[e] - c[s];
6631
+ w < 0 || w < l && (l = w, d = m);
6473
6632
  }
6474
6633
  if (!d || l === Number.POSITIVE_INFINITY) continue;
6475
6634
  const u = Math.max(c[o], d[o]), f = Math.min(c[i], d[i]), g = (u + f) / 2;
@@ -6571,7 +6730,7 @@ class jn {
6571
6730
  return;
6572
6731
  }
6573
6732
  !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
6574
- let o = mt({ object: e });
6733
+ let o = yt({ object: e });
6575
6734
  if (!o) {
6576
6735
  this._clearGuides();
6577
6736
  return;
@@ -6582,24 +6741,24 @@ class jn {
6582
6741
  anchors: this.anchors
6583
6742
  }), { deltaX: d, deltaY: l, guides: u } = c;
6584
6743
  if (d !== 0 || l !== 0) {
6585
- const { left: v = 0, top: S = 0 } = e;
6744
+ const { left: v = 0, top: w = 0 } = e;
6586
6745
  e.set({
6587
6746
  left: v + d,
6588
- top: S + l
6589
- }), e.setCoords(), o = (p = mt({ object: e })) != null ? p : o;
6747
+ top: w + l
6748
+ }), e.setCoords(), o = (p = yt({ object: e })) != null ? p : o;
6590
6749
  }
6591
- const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => mt({ object: v })).filter((v) => !!v), g = bn({
6750
+ const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => yt({ object: v })).filter((v) => !!v), g = bn({
6592
6751
  activeBounds: o,
6593
6752
  candidates: f,
6594
6753
  threshold: r,
6595
6754
  spacingPatterns: this.spacingPatterns
6596
6755
  });
6597
6756
  if (g.deltaX !== 0 || g.deltaY !== 0) {
6598
- const { left: v = 0, top: S = 0 } = e;
6757
+ const { left: v = 0, top: w = 0 } = e;
6599
6758
  e.set({
6600
6759
  left: v + g.deltaX,
6601
- top: S + g.deltaY
6602
- }), e.setCoords(), o = (m = mt({ object: e })) != null ? m : o;
6760
+ top: w + g.deltaY
6761
+ }), e.setCoords(), o = (m = yt({ object: e })) != null ? m : o;
6603
6762
  }
6604
6763
  this._applyGuides({
6605
6764
  guides: u,
@@ -6679,12 +6838,12 @@ class jn {
6679
6838
  _cacheAnchors({ activeObject: t }) {
6680
6839
  const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, n = [];
6681
6840
  for (const a of e) {
6682
- const r = mt({ object: a });
6683
- r && (qe({ anchors: s, bounds: r }), n.push(r));
6841
+ const r = yt({ object: a });
6842
+ r && (Qe({ anchors: s, bounds: r }), n.push(r));
6684
6843
  }
6685
- const { montageArea: o } = this.editor, i = mt({ object: o });
6844
+ const { montageArea: o } = this.editor, i = yt({ object: o });
6686
6845
  if (i) {
6687
- qe({ anchors: s, bounds: i });
6846
+ Qe({ anchors: s, bounds: i });
6688
6847
  const { left: a, right: r, top: c, bottom: d } = i;
6689
6848
  this.guideBounds = {
6690
6849
  left: a,
@@ -6726,7 +6885,7 @@ class jn {
6726
6885
  }
6727
6886
  }
6728
6887
  const ts = "#3D8BF4", es = 1;
6729
- class Lt {
6888
+ class Dt {
6730
6889
  /**
6731
6890
  * Создаёт менеджер измерений и инициализирует события.
6732
6891
  */
@@ -6831,15 +6990,15 @@ class Lt {
6831
6990
  this._clearGuides();
6832
6991
  return;
6833
6992
  }
6834
- const o = mt({ object: n });
6993
+ const o = yt({ object: n });
6835
6994
  if (!o) {
6836
6995
  this._clearGuides();
6837
6996
  return;
6838
6997
  }
6839
- const i = Lt._resolveTarget({
6998
+ const i = Dt._resolveTarget({
6840
6999
  event: t,
6841
7000
  activeObject: n
6842
- }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = mt({ object: r });
7001
+ }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = yt({ object: r });
6843
7002
  if (!d) {
6844
7003
  this._clearGuides();
6845
7004
  return;
@@ -6848,7 +7007,7 @@ class Lt {
6848
7007
  this._clearGuides();
6849
7008
  return;
6850
7009
  }
6851
- const u = Lt._buildGuides({
7010
+ const u = Dt._buildGuides({
6852
7011
  activeBounds: o,
6853
7012
  targetBounds: d,
6854
7013
  targetIsMontageArea: c
@@ -6877,11 +7036,11 @@ class Lt {
6877
7036
  targetBounds: e,
6878
7037
  targetIsMontageArea: s
6879
7038
  }) {
6880
- const n = Lt._buildHorizontalGuides({
7039
+ const n = Dt._buildHorizontalGuides({
6881
7040
  activeBounds: t,
6882
7041
  targetBounds: e,
6883
7042
  targetIsMontageArea: s
6884
- }), o = Lt._buildVerticalGuides({
7043
+ }), o = Dt._buildVerticalGuides({
6885
7044
  activeBounds: t,
6886
7045
  targetBounds: e,
6887
7046
  targetIsMontageArea: s
@@ -6908,43 +7067,43 @@ class Lt {
6908
7067
  top: u = 0,
6909
7068
  bottom: f = 0,
6910
7069
  centerY: g = 0
6911
- } = e, p = Math.max(a, u), m = Math.min(r, f), S = m >= p ? (p + m) / 2 : (c + g) / 2;
7070
+ } = e, p = Math.max(a, u), m = Math.min(r, f), w = m >= p ? (p + m) / 2 : (c + g) / 2;
6912
7071
  if (d >= i) {
6913
7072
  if (s) return n;
6914
- const C = d - i;
6915
- return C > 0 && n.push({
7073
+ const I = d - i;
7074
+ return I > 0 && n.push({
6916
7075
  type: "horizontal",
6917
- axis: S,
7076
+ axis: w,
6918
7077
  start: i,
6919
7078
  end: d,
6920
- distance: C
7079
+ distance: I
6921
7080
  }), n;
6922
7081
  }
6923
7082
  if (l <= o) {
6924
7083
  if (s) return n;
6925
- const C = o - l;
6926
- return C > 0 && n.push({
7084
+ const I = o - l;
7085
+ return I > 0 && n.push({
6927
7086
  type: "horizontal",
6928
- axis: S,
7087
+ axis: w,
6929
7088
  start: l,
6930
7089
  end: o,
6931
- distance: C
7090
+ distance: I
6932
7091
  }), n;
6933
7092
  }
6934
7093
  if (!s) return n;
6935
- const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), I = j - b;
6936
- I > 0 && !A && n.push({
7094
+ const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), C = j - b;
7095
+ C > 0 && !A && n.push({
6937
7096
  type: "horizontal",
6938
- axis: S,
7097
+ axis: w,
6939
7098
  start: b,
6940
7099
  end: j,
6941
- distance: I
7100
+ distance: C
6942
7101
  });
6943
- const w = Math.min(i, l), T = Math.max(i, l), M = T - w;
7102
+ const S = Math.min(i, l), T = Math.max(i, l), M = T - S;
6944
7103
  return M > 0 && !y && n.push({
6945
7104
  type: "horizontal",
6946
- axis: S,
6947
- start: w,
7105
+ axis: w,
7106
+ start: S,
6948
7107
  end: T,
6949
7108
  distance: M
6950
7109
  }), n;
@@ -6969,43 +7128,43 @@ class Lt {
6969
7128
  left: u = 0,
6970
7129
  right: f = 0,
6971
7130
  centerX: g = 0
6972
- } = e, p = Math.max(a, u), m = Math.min(r, f), S = m >= p ? (p + m) / 2 : (c + g) / 2;
7131
+ } = e, p = Math.max(a, u), m = Math.min(r, f), w = m >= p ? (p + m) / 2 : (c + g) / 2;
6973
7132
  if (d >= i) {
6974
7133
  if (s) return n;
6975
- const C = d - i;
6976
- return C > 0 && n.push({
7134
+ const I = d - i;
7135
+ return I > 0 && n.push({
6977
7136
  type: "vertical",
6978
- axis: S,
7137
+ axis: w,
6979
7138
  start: i,
6980
7139
  end: d,
6981
- distance: C
7140
+ distance: I
6982
7141
  }), n;
6983
7142
  }
6984
7143
  if (l <= o) {
6985
7144
  if (s) return n;
6986
- const C = o - l;
6987
- return C > 0 && n.push({
7145
+ const I = o - l;
7146
+ return I > 0 && n.push({
6988
7147
  type: "vertical",
6989
- axis: S,
7148
+ axis: w,
6990
7149
  start: l,
6991
7150
  end: o,
6992
- distance: C
7151
+ distance: I
6993
7152
  }), n;
6994
7153
  }
6995
7154
  if (!s) return n;
6996
- const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), I = j - b;
6997
- I > 0 && !A && n.push({
7155
+ const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), C = j - b;
7156
+ C > 0 && !A && n.push({
6998
7157
  type: "vertical",
6999
- axis: S,
7158
+ axis: w,
7000
7159
  start: b,
7001
7160
  end: j,
7002
- distance: I
7161
+ distance: C
7003
7162
  });
7004
- const w = Math.min(i, l), T = Math.max(i, l), M = T - w;
7163
+ const S = Math.min(i, l), T = Math.max(i, l), M = T - S;
7005
7164
  return M > 0 && !y && n.push({
7006
7165
  type: "vertical",
7007
- axis: S,
7008
- start: w,
7166
+ axis: w,
7167
+ start: S,
7009
7168
  end: T,
7010
7169
  distance: M
7011
7170
  }), n;
@@ -7037,7 +7196,7 @@ class Lt {
7037
7196
  const { viewportTransform: s } = t, n = t.getZoom() || 1, o = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = o && i && !this.isTargetMontageArea, r = a ? 12 / n : 0;
7038
7197
  e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = es / n, e.strokeStyle = ts, e.setLineDash([]);
7039
7198
  for (const c of this.activeGuides) {
7040
- const { type: d, axis: l, start: u, end: f, distance: g } = c, p = Math.abs(f - u), m = u <= f ? -1 : 1, v = a ? m * (p / 2 + r) : 0, S = 0;
7199
+ const { type: d, axis: l, start: u, end: f, distance: g } = c, p = Math.abs(f - u), m = u <= f ? -1 : 1, v = a ? m * (p / 2 + r) : 0, w = 0;
7041
7200
  e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, f)) : (e.moveTo(u, l), e.lineTo(f, l)), e.stroke(), je({
7042
7201
  context: e,
7043
7202
  type: d,
@@ -7049,7 +7208,7 @@ class Lt {
7049
7208
  color: ts,
7050
7209
  lineWidth: es,
7051
7210
  offsetAlongAxis: v,
7052
- offsetPerpendicular: S
7211
+ offsetPerpendicular: w
7053
7212
  });
7054
7213
  }
7055
7214
  e.restore();
@@ -7080,7 +7239,7 @@ class Le {
7080
7239
  * @param options - опции и настройки редактора
7081
7240
  */
7082
7241
  constructor(t, e) {
7083
- this.options = e, this.containerId = t, this.editorId = `${t}-${V()}`, this.clipboard = null, this.init();
7242
+ this.options = e, this.containerId = t, this.editorId = `${t}-${X()}`, this.clipboard = null, this.init();
7084
7243
  }
7085
7244
  /**
7086
7245
  * Инициализация редактора.
@@ -7088,7 +7247,7 @@ class Le {
7088
7247
  * @fires editor:ready
7089
7248
  */
7090
7249
  init() {
7091
- return z(this, null, function* () {
7250
+ return P(this, null, function* () {
7092
7251
  var u;
7093
7252
  const {
7094
7253
  editorContainerWidth: t,
@@ -7103,12 +7262,12 @@ class Le {
7103
7262
  showRotationAngle: d,
7104
7263
  _onReadyCallback: l
7105
7264
  } = this.options;
7106
- if (et.apply(), this.canvas = new vs(this.containerId, this.options), this.moduleLoader = new As(), this.workerManager = new Is(), this.errorManager = new Qt({ editor: this }), this.historyManager = new Kt({ editor: this }), this.toolbar = new Us({ editor: this }), this.transformManager = new Js({ editor: this }), this.zoomManager = new qs({ editor: this }), this.canvasManager = new Qs({ editor: this }), this.imageManager = new ht({ editor: this }), this.layerManager = new le({ editor: this }), this.shapeManager = new tn({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Ot({ editor: this }), this.clipboardManager = new en({ editor: this }), this.objectLockManager = new he({ editor: this }), this.groupingManager = new sn({ editor: this }), this.selectionManager = new nn({ editor: this }), this.deletionManager = new Oe({ editor: this }), this.panConstraintManager = new on({ editor: this }), this.snappingManager = new jn({ editor: this }), this.measurementManager = new Lt({ editor: this }), this.fontManager = new Se((u = this.options.fonts) != null ? u : []), this.textManager = new k({ editor: this }), this.templateManager = new _({ editor: this }), d && (this.angleIndicator = new Ee({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Xt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
7265
+ if (st.apply(), this.canvas = new vs(this.containerId, this.options), this.moduleLoader = new As(), this.workerManager = new Cs(), this.errorManager = new qt({ editor: this }), this.historyManager = new Z({ editor: this }), this.toolbar = new Us({ editor: this }), this.transformManager = new Js({ editor: this }), this.zoomManager = new Qs({ editor: this }), this.canvasManager = new qs({ editor: this }), this.imageManager = new ut({ editor: this }), this.layerManager = new le({ editor: this }), this.shapeManager = new tn({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Lt({ editor: this }), this.clipboardManager = new en({ editor: this }), this.objectLockManager = new he({ editor: this }), this.groupingManager = new sn({ editor: this }), this.selectionManager = new nn({ editor: this }), this.deletionManager = new Oe({ editor: this }), this.panConstraintManager = new on({ editor: this }), this.snappingManager = new jn({ editor: this }), this.measurementManager = new Dt({ editor: this }), this.fontManager = new Se((u = this.options.fonts) != null ? u : []), this.textManager = new k({ editor: this }), this.templateManager = new _({ editor: this }), d && (this.angleIndicator = new Ee({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Kt({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
7107
7266
  const f = a, {
7108
7267
  source: g,
7109
7268
  scale: p = `image-${c}`,
7110
7269
  withoutSave: m = !0
7111
- } = f, v = gt(f, [
7270
+ } = f, v = pt(f, [
7112
7271
  "source",
7113
7272
  "scale",
7114
7273
  "withoutSave"
@@ -7225,7 +7384,7 @@ const L = [
7225
7384
  "U+A640-A69F",
7226
7385
  "U+FE2E-FE2F",
7227
7386
  "U+2116"
7228
- ].join(", "), In = [
7387
+ ].join(", "), Cn = [
7229
7388
  {
7230
7389
  family: "Arial",
7231
7390
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -8015,7 +8174,7 @@ const L = [
8015
8174
  unicodeRange: L
8016
8175
  }
8017
8176
  }
8018
- ], Cn = {
8177
+ ], In = {
8019
8178
  /**
8020
8179
  * Опции редактора
8021
8180
  */
@@ -8107,10 +8266,10 @@ const L = [
8107
8266
  /**
8108
8267
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
8109
8268
  */
8110
- fonts: In
8269
+ fonts: Cn
8111
8270
  };
8112
8271
  function Dn(h, t = {}) {
8113
- const e = B(B({}, Cn), t), s = document.getElementById(h);
8272
+ const e = B(B({}, In), t), s = document.getElementById(h);
8114
8273
  if (!s)
8115
8274
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
8116
8275
  const n = document.createElement("canvas");