@anu3ev/fabric-image-editor 0.5.24 → 0.5.25

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 +861 -844
  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
- var ne = Object.getOwnPropertySymbols;
4
- var xe = Object.prototype.hasOwnProperty, Ne = Object.prototype.propertyIsEnumerable;
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) => {
3
+ var ae = Object.getOwnPropertySymbols;
4
+ var Ne = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable;
5
+ var _e = (h, t, e) => t in h ? ds(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, z = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
- xe.call(t, e) && _e(h, e, t[e]);
8
- if (ne)
9
- for (var e of ne(t))
10
- Ne.call(t, e) && _e(h, e, t[e]);
7
+ Ne.call(t, e) && _e(h, e, t[e]);
8
+ if (ae)
9
+ for (var e of ae(t))
10
+ Be.call(t, e) && _e(h, e, t[e]);
11
11
  return h;
12
- }, St = (h, t) => ls(h, hs(t));
13
- var pt = (h, t) => {
12
+ }, wt = (h, t) => ls(h, hs(t));
13
+ var gt = (h, t) => {
14
14
  var e = {};
15
15
  for (var s in h)
16
- xe.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
- if (h != null && ne)
18
- for (var s of ne(h))
19
- t.indexOf(s) < 0 && Ne.call(h, s) && (e[s] = h[s]);
16
+ Ne.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
+ if (h != null && ae)
18
+ for (var s of ae(h))
19
+ t.indexOf(s) < 0 && Be.call(h, s) && (e[s] = h[s]);
20
20
  return e;
21
21
  };
22
- var P = (h, t, e) => new Promise((s, n) => {
22
+ var W = (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 P = (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 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";
38
+ import { ActiveSelection as F, Textbox as at, util as ht, controlsUtils as ke, InteractiveFabricObject as ze, Point as et, FitContentLayout as Pe, loadSVGFromURL as us, FabricImage as qt, Gradient as We, Rect as fs, Circle as gs, Triangle as ps, Group as xt, Color as ms, classRegistry as Ue, 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", X = function() {
41
+ var Ss = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", K = 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 Kt {
46
+ class $t {
47
47
  /**
48
48
  * Конструктор принимает редактор и опции.
49
49
  * @param params
@@ -61,7 +61,7 @@ class Kt {
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 = 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();
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 = $t.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 = $t.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = $t.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
  * Инициализация всех обработчиков согласно опциям.
@@ -98,7 +98,7 @@ class Kt {
98
98
  if (n.length === 1)
99
99
  this.canvas.setActiveObject(n[0]);
100
100
  else {
101
- const i = new U(n, {
101
+ const i = new F(n, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,7 +106,7 @@ class Kt {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const o = new U(t, {
109
+ const o = new F(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -175,7 +175,7 @@ class Kt {
175
175
  * @param event.code — код клавиши
176
176
  */
177
177
  handleUndoRedoEvent(t) {
178
- return P(this, null, function* () {
178
+ return W(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
  });
@@ -225,7 +225,7 @@ class Kt {
225
225
  if (o || i) return;
226
226
  n.historyManager.skipHistory || n.historyManager.saveState(), n.historyManager.suspendHistory(), this.isSpacePressed = !0, t.preventDefault();
227
227
  const a = s.getActiveObject() || null;
228
- a instanceof U ? this.savedSelection = a.getObjects().slice() : a && (this.savedSelection = [a]), s.discardActiveObject(), s.set({
228
+ a instanceof F ? this.savedSelection = a.getObjects().slice() : a && (this.savedSelection = [a]), s.discardActiveObject(), s.set({
229
229
  selection: !1,
230
230
  defaultCursor: "grab"
231
231
  }), s.setCursor("grab"), n.canvasManager.getObjects().forEach((r) => {
@@ -265,7 +265,7 @@ class Kt {
265
265
  e.setActiveObject(t[0]);
266
266
  return;
267
267
  }
268
- const n = t.filter((i) => s.canvasManager.getObjects().includes(i)), o = new U(n, { canvas: e });
268
+ const n = t.filter((i) => s.canvasManager.getObjects().includes(i)), o = new F(n, { canvas: e });
269
269
  n.some((i) => i.locked) && s.objectLockManager.lockObject({
270
270
  object: o,
271
271
  skipInnerObjects: !0,
@@ -347,7 +347,7 @@ class Kt {
347
347
  */
348
348
  handleResetObjectFit(t) {
349
349
  const e = t == null ? void 0 : t.target;
350
- !e || e instanceof it || this.editor.transformManager.resetObject({ object: e });
350
+ !e || e instanceof at || this.editor.transformManager.resetObject({ object: e });
351
351
  }
352
352
  /**
353
353
  * Проверяет, должно ли событие клавиатуры быть проигнорировано
@@ -468,7 +468,7 @@ class Cs {
468
468
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
469
469
  */
470
470
  post(t, e, s = []) {
471
- const n = `${t}:${X(8)}`;
471
+ const n = `${t}:${K(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,95 +480,95 @@ class Cs {
480
480
  this.worker.terminate();
481
481
  }
482
482
  }
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
- function oe(h, t, e, s, n) {
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
- }
488
- function Ue(h, t, e, s, n) {
489
- const o = ve, i = be, a = Ts;
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();
483
+ const dt = 12, Is = 2, we = 8, Se = 20, Es = 100, Ae = 20, je = 8, Ts = 100, ue = 32, Te = 1, Os = "#2B2D33", Oe = "#3D8BF4", Le = "#FFFFFF";
484
+ function re(h, t, e, s, n) {
485
+ const o = dt, i = Is;
486
+ h.save(), h.translate(t, e), h.rotate(ht.degreesToRadians(n.angle)), h.fillStyle = Le, h.strokeStyle = Oe, h.lineWidth = Te, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
491
487
  }
492
488
  function Fe(h, t, e, s, n) {
493
- const o = Me, i = we, a = Es;
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();
489
+ const o = we, i = Se, a = Es;
490
+ h.save(), h.translate(t, e), h.rotate(ht.degreesToRadians(n.angle)), h.fillStyle = Le, h.strokeStyle = Oe, h.lineWidth = Te, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
491
+ }
492
+ function Ye(h, t, e, s, n) {
493
+ const o = Ae, i = je, a = Ts;
494
+ h.save(), h.translate(t, e), h.rotate(ht.degreesToRadians(n.angle)), h.fillStyle = Le, h.strokeStyle = Oe, h.lineWidth = Te, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
495
495
  }
496
- const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ss = new Image();
497
- ss.src = Ls;
496
+ const Ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ns = new Image();
497
+ ns.src = Ls;
498
498
  function Ds(h, t, e, s, n) {
499
- const i = de / 2;
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();
499
+ const i = ue / 2;
500
+ h.save(), h.translate(t, e), h.rotate(ht.degreesToRadians(n.angle)), h.fillStyle = Os, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(ns, -i / 2, -i / 2, i, i), h.restore();
501
501
  }
502
502
  const Rs = {
503
503
  // Угловые точки
504
504
  tl: {
505
- render: oe,
506
- sizeX: ht,
507
- sizeY: ht,
505
+ render: re,
506
+ sizeX: dt,
507
+ sizeY: dt,
508
508
  offsetX: 0,
509
509
  offsetY: 0
510
510
  },
511
511
  tr: {
512
- render: oe,
513
- sizeX: ht,
514
- sizeY: ht,
512
+ render: re,
513
+ sizeX: dt,
514
+ sizeY: dt,
515
515
  offsetX: 0,
516
516
  offsetY: 0
517
517
  },
518
518
  bl: {
519
- render: oe,
520
- sizeX: ht,
521
- sizeY: ht,
519
+ render: re,
520
+ sizeX: dt,
521
+ sizeY: dt,
522
522
  offsetX: 0,
523
523
  offsetY: 0
524
524
  },
525
525
  br: {
526
- render: oe,
527
- sizeX: ht,
528
- sizeY: ht,
526
+ render: re,
527
+ sizeX: dt,
528
+ sizeY: dt,
529
529
  offsetX: 0,
530
530
  offsetY: 0
531
531
  },
532
532
  // Середина вертикалей
533
533
  ml: {
534
- render: Ue,
535
- sizeX: ve,
536
- sizeY: be,
534
+ render: Fe,
535
+ sizeX: we,
536
+ sizeY: Se,
537
537
  offsetX: 0,
538
538
  offsetY: 0
539
539
  },
540
540
  mr: {
541
- render: Ue,
542
- sizeX: ve,
543
- sizeY: be,
541
+ render: Fe,
542
+ sizeX: we,
543
+ sizeY: Se,
544
544
  offsetX: 0,
545
545
  offsetY: 0
546
546
  },
547
547
  // Середина горизонталей
548
548
  mt: {
549
- render: Fe,
550
- sizeX: Me,
551
- sizeY: we,
549
+ render: Ye,
550
+ sizeX: Ae,
551
+ sizeY: je,
552
552
  offsetX: 0,
553
553
  offsetY: 0
554
554
  },
555
555
  mb: {
556
- render: Fe,
557
- sizeX: Me,
558
- sizeY: we,
556
+ render: Ye,
557
+ sizeX: Ae,
558
+ sizeY: je,
559
559
  offsetX: 0,
560
560
  offsetY: 0
561
561
  },
562
562
  // Специальный «rotate» контрол
563
563
  mtr: {
564
564
  render: Ds,
565
- sizeX: de,
566
- sizeY: de,
565
+ sizeX: ue,
566
+ sizeY: ue,
567
567
  offsetX: 0,
568
- offsetY: -de
568
+ offsetY: -ue
569
569
  }
570
570
  };
571
- class st {
571
+ class ot {
572
572
  /**
573
573
  * Отключает изменение ширины по оси X для заблокированных объектов, сохраняя поведение остального хэндлера.
574
574
  */
@@ -597,24 +597,24 @@ class st {
597
597
  * Регистрирует контролы и настройки поведения выделений.
598
598
  */
599
599
  static apply() {
600
- const t = Be.createObjectDefaultControls();
601
- st.applyControlOverrides(t), ke.ownDefaults.controls = t;
602
- const e = Be.createTextboxDefaultControls();
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;
600
+ const t = ke.createObjectDefaultControls();
601
+ ot.applyControlOverrides(t), ze.ownDefaults.controls = t;
602
+ const e = ke.createTextboxDefaultControls();
603
+ ot.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), ot.wrapWidthControl(e.ml), ot.wrapWidthControl(e.mr), at.ownDefaults.controls = e, ot.patchActiveSelectionBounds(), ze.ownDefaults.snapAngle = 1;
604
604
  }
605
605
  /**
606
606
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
607
607
  */
608
608
  static patchActiveSelectionBounds() {
609
- const t = U.prototype, e = t._calcBoundsFromObjects;
609
+ const t = F.prototype, e = t._calcBoundsFromObjects;
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
- st.applyTextSelectionScalingLock({
613
+ ot.applyTextSelectionScalingLock({
614
614
  selection: this,
615
615
  objects: i
616
616
  });
617
- const a = st.calculateActiveSelectionBounds({
617
+ const a = ot.calculateActiveSelectionBounds({
618
618
  objects: i
619
619
  });
620
620
  if (!a)
@@ -633,11 +633,11 @@ class st {
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
- st.applyTextSelectionScalingLock({
636
+ ot.applyTextSelectionScalingLock({
637
637
  selection: this,
638
638
  objects: r
639
639
  });
640
- const c = st.calculateActiveSelectionBounds({
640
+ const c = ot.calculateActiveSelectionBounds({
641
641
  objects: r
642
642
  });
643
643
  if (!c) return a;
@@ -647,18 +647,18 @@ class st {
647
647
  height: f
648
648
  }), this.setPositionByOrigin(g, "center", "center"), this.setCoords(), a;
649
649
  };
650
- const n = ze.prototype.calcBoundingBox;
651
- ze.prototype.calcBoundingBox = function(o, i) {
650
+ const n = Pe.prototype.calcBoundingBox;
651
+ Pe.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
- if (!(a instanceof U))
655
+ if (!(a instanceof F))
656
656
  return n.call(this, o, i);
657
- st.applyTextSelectionScalingLock({
657
+ ot.applyTextSelectionScalingLock({
658
658
  selection: a,
659
659
  objects: o
660
660
  });
661
- const d = st.calculateActiveSelectionBounds({ objects: o });
661
+ const d = ot.calculateActiveSelectionBounds({ objects: o });
662
662
  if (!d)
663
663
  return n.call(this, o, i);
664
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);
@@ -694,7 +694,7 @@ class st {
694
694
  selection: t,
695
695
  objects: e
696
696
  }) {
697
- const s = e.some((n) => n instanceof it);
697
+ const s = e.some((n) => n instanceof at);
698
698
  t.setControlsVisibility({
699
699
  mt: !s,
700
700
  mb: !s,
@@ -703,7 +703,7 @@ class st {
703
703
  });
704
704
  }
705
705
  }
706
- const W = class W {
706
+ const U = class U {
707
707
  constructor(t = []) {
708
708
  this.fonts = t;
709
709
  }
@@ -711,36 +711,36 @@ const W = class W {
711
711
  this.fonts = t;
712
712
  }
713
713
  loadFonts() {
714
- return P(this, null, function* () {
714
+ return W(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) => W.loadFont(o, e));
720
+ const s = t.map((o) => U.loadFont(o, e));
721
721
  yield Promise.allSettled(s);
722
722
  });
723
723
  }
724
724
  static loadFont(t, e) {
725
- return P(this, null, function* () {
725
+ return W(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 = 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);
729
+ const i = U.normalizeFontSource(o), a = U.getDescriptorSnapshot(t.descriptors), r = U.getFontRegistrationKey(n, i, a);
730
+ if (!U.registeredFontKeys.has(r)) {
731
+ if (U.isFontFaceAlreadyApplied(e, n, a)) {
732
+ U.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), W.registeredFontKeys.add(r);
738
+ e.fonts.add(u), U.registeredFontKeys.add(r);
739
739
  return;
740
740
  } catch (l) {
741
741
  console.warn(`Не удалось загрузить шрифт "${n}" через FontFace API`, l);
742
742
  }
743
- W.injectFontFace({
743
+ U.injectFontFace({
744
744
  font: t,
745
745
  source: i,
746
746
  doc: e,
@@ -760,15 +760,15 @@ const W = class W {
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 = W.descriptorsToCss(o), c = [
763
+ const r = U.descriptorsToCss(o), c = [
764
764
  "@font-face {",
765
- ` font-family: ${W.formatFontFamilyForCss(i)};`,
765
+ ` font-family: ${U.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), W.registeredFontKeys.add(n);
771
+ `), s.head.appendChild(a), U.registeredFontKeys.add(n);
772
772
  }
773
773
  static normalizeFontSource(t) {
774
774
  const e = t.trim();
@@ -791,15 +791,15 @@ const W = class W {
791
791
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
792
792
  }
793
793
  static getDescriptorSnapshot(t) {
794
- const e = W.descriptorDefaults;
794
+ const e = U.descriptorDefaults;
795
795
  return {
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)
796
+ style: U.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
797
+ weight: U.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
798
+ stretch: U.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
799
+ unicodeRange: U.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
800
+ variant: U.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
801
+ featureSettings: U.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
802
+ display: U.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
803
803
  };
804
804
  }
805
805
  static areDescriptorSnapshotsEqual(t, e) {
@@ -807,7 +807,7 @@ const W = class W {
807
807
  }
808
808
  static getFontRegistrationKey(t, e, s) {
809
809
  return [
810
- W.normalizeFamilyName(t),
810
+ U.normalizeFamilyName(t),
811
811
  e,
812
812
  s.style,
813
813
  s.weight,
@@ -821,12 +821,12 @@ const W = class W {
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 = W.normalizeFamilyName(e);
824
+ const o = U.normalizeFamilyName(e);
825
825
  let i = !1;
826
826
  try {
827
827
  n.forEach((a) => {
828
- if (i || W.normalizeFamilyName(a.family) !== o) return;
829
- const c = W.getDescriptorSnapshot({
828
+ if (i || U.normalizeFamilyName(a.family) !== o) return;
829
+ const c = U.getDescriptorSnapshot({
830
830
  style: a.style,
831
831
  weight: a.weight,
832
832
  stretch: a.stretch,
@@ -835,7 +835,7 @@ const W = class W {
835
835
  featureSettings: a.featureSettings,
836
836
  display: a.display
837
837
  });
838
- W.areDescriptorSnapshotsEqual(s, c) && (i = !0);
838
+ U.areDescriptorSnapshotsEqual(s, c) && (i = !0);
839
839
  });
840
840
  } catch (a) {
841
841
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
@@ -862,7 +862,7 @@ const W = class W {
862
862
  });
863
863
  }
864
864
  };
865
- W.registeredFontKeys = /* @__PURE__ */ new Set(), W.descriptorDefaults = {
865
+ U.registeredFontKeys = /* @__PURE__ */ new Set(), U.descriptorDefaults = {
866
866
  style: "normal",
867
867
  weight: "normal",
868
868
  stretch: "normal",
@@ -871,8 +871,8 @@ W.registeredFontKeys = /* @__PURE__ */ new Set(), W.descriptorDefaults = {
871
871
  featureSettings: "normal",
872
872
  display: "auto"
873
873
  };
874
- let Se = W;
875
- const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", xs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuNWMwLS42OS41Ni0xLjI1IDEuMjUtMS4yNWgxMi41Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djguNzVjMCAuNjktLjU2IDEuMjUtMS4yNSAxLjI1SDMuNzVjLS42OSAwLTEuMjUtLjU2LTEuMjUtMS4yNVY3LjVabTEzLjc1IDBIMy43NXY4Ljc1aDEyLjVWNy41WiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PHBhdGggZmlsbD0iI2ZmZiIg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N2Zz4=", Ws = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Jt = {
876
876
  style: {
877
877
  position: "absolute",
878
878
  display: "none",
@@ -939,9 +939,9 @@ const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
939
939
  ],
940
940
  offsetTop: 50,
941
941
  icons: {
942
- copyPaste: _s,
942
+ copyPaste: xs,
943
943
  delete: Ws,
944
- lock: xs,
944
+ lock: _s,
945
945
  unlock: Ns,
946
946
  bringToFront: zs,
947
947
  sendToBack: Ps,
@@ -949,7 +949,7 @@ const _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
949
949
  sendBackwards: ks
950
950
  },
951
951
  handlers: {
952
- copyPaste: (h) => P(null, null, function* () {
952
+ copyPaste: (h) => W(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 = 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 || {})
985
+ this.config = wt(z(z({}, Jt), t), {
986
+ style: z(z({}, Jt.style), t.style || {}),
987
+ btnStyle: z(z({}, Jt.btnStyle), t.btnStyle || {}),
988
+ icons: z(z({}, Jt.icons), t.icons || {}),
989
+ handlers: z(z({}, Jt.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();
@@ -1117,8 +1117,8 @@ const Fs = {
1117
1117
  "pointer-events": "none",
1118
1118
  "white-space": "nowrap",
1119
1119
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1120
- }, Ye = 16, He = 16, Ys = "fabric-editor-angle-indicator";
1121
- class Ee {
1120
+ }, He = 16, Ze = 16, Ys = "fabric-editor-angle-indicator";
1121
+ class De {
1122
1122
  constructor({ editor: t }) {
1123
1123
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
1124
1124
  }
@@ -1146,7 +1146,7 @@ class Ee {
1146
1146
  return;
1147
1147
  }
1148
1148
  const s = e.angle || 0;
1149
- this.currentAngle = Ee._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1149
+ this.currentAngle = De._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1150
1150
  }
1151
1151
  /**
1152
1152
  * Обработчик отпускания кнопки мыши
@@ -1177,9 +1177,9 @@ class Ee {
1177
1177
  */
1178
1178
  _positionIndicator(t) {
1179
1179
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1180
- let s = t.clientX - e.left + Ye, n = t.clientY - e.top + He;
1180
+ let s = t.clientX - e.left + He, n = t.clientY - e.top + Ze;
1181
1181
  const o = this.el.getBoundingClientRect(), i = o.width, a = o.height;
1182
- s + i > e.width && (s = t.clientX - e.left - i - Ye), n + a > e.height && (n = t.clientY - e.top - a - He), this.el.style.left = `${s}px`, this.el.style.top = `${n}px`;
1182
+ s + i > e.width && (s = t.clientX - e.left - i - He), n + a > e.height && (n = t.clientY - e.top - a - Ze), this.el.style.left = `${s}px`, this.el.style.top = `${n}px`;
1183
1183
  }
1184
1184
  /**
1185
1185
  * Показать индикатор
@@ -1210,7 +1210,7 @@ class Ee {
1210
1210
  this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), (t = this.el) != null && t.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
1211
1211
  }
1212
1212
  }
1213
- const ns = [
1213
+ const os = [
1214
1214
  "id",
1215
1215
  "backgroundId",
1216
1216
  "customData",
@@ -1232,6 +1232,7 @@ const ns = [
1232
1232
  "styles",
1233
1233
  "textCaseRaw",
1234
1234
  "uppercase",
1235
+ "autoExpand",
1235
1236
  "linethrough",
1236
1237
  "underline",
1237
1238
  "fontStyle",
@@ -1246,7 +1247,7 @@ const ns = [
1246
1247
  "radiusBottomRight",
1247
1248
  "radiusBottomLeft"
1248
1249
  ];
1249
- class Z {
1250
+ class G {
1250
1251
  constructor({ editor: t }) {
1251
1252
  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
1253
  }
@@ -1310,7 +1311,7 @@ class Z {
1310
1311
  this._isSavingState = !0, console.time("saveState");
1311
1312
  try {
1312
1313
  const t = this._withTemporaryUnlock(
1313
- () => this.canvas.toDatalessObject([...ns])
1314
+ () => this.canvas.toDatalessObject([...os])
1314
1315
  );
1315
1316
  if (console.timeEnd("saveState"), !this.baseState) {
1316
1317
  this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
@@ -1321,7 +1322,7 @@ class Z {
1321
1322
  const {
1322
1323
  prevState: s,
1323
1324
  nextState: n
1324
- } = Z._prepareStatesForDiff({
1325
+ } = G._prepareStatesForDiff({
1325
1326
  prevState: e,
1326
1327
  nextState: t
1327
1328
  }), o = this.diffPatcher.diff(s, n);
@@ -1329,14 +1330,14 @@ class Z {
1329
1330
  console.log("Нет изменений для сохранения.");
1330
1331
  return;
1331
1332
  }
1332
- if (Z._areStatesEqual({
1333
+ if (G._areStatesEqual({
1333
1334
  prevState: s,
1334
1335
  nextState: n
1335
1336
  })) {
1336
1337
  console.log("statesEqual. Нет изменений для сохранения.");
1337
1338
  return;
1338
1339
  }
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);
1340
+ 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: K(), 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);
1340
1341
  } finally {
1341
1342
  this._isSavingState = !1;
1342
1343
  }
@@ -1350,11 +1351,11 @@ class Z {
1350
1351
  prevState: t,
1351
1352
  nextState: e
1352
1353
  }) {
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({
1354
+ const s = G._cloneState({ state: t }), n = G._cloneState({ state: e });
1355
+ return G._normalizeTextBackground({ objects: s.objects }), G._normalizeTextBackground({ objects: n.objects }), G._normalizeCanvasSize({
1355
1356
  prevState: s,
1356
1357
  nextState: n
1357
- }), Z._normalizeTranslation({
1358
+ }), G._normalizeTranslation({
1358
1359
  prevState: s,
1359
1360
  nextState: n
1360
1361
  }), {
@@ -1378,7 +1379,7 @@ class Z {
1378
1379
  prevState: t,
1379
1380
  nextState: e
1380
1381
  }) {
1381
- const s = Z._stableStringify({ value: t }), n = Z._stableStringify({ value: e });
1382
+ const s = G._stableStringify({ value: t }), n = G._stableStringify({ value: e });
1382
1383
  return s === n;
1383
1384
  }
1384
1385
  /**
@@ -1433,10 +1434,10 @@ class Z {
1433
1434
  const { width: s, height: n, objects: o } = t, { objects: i } = e, {
1434
1435
  width: a,
1435
1436
  height: r
1436
- } = Z._getMontageAreaSize({ objects: o }), {
1437
+ } = G._getMontageAreaSize({ objects: o }), {
1437
1438
  width: c,
1438
1439
  height: d
1439
- } = Z._getMontageAreaSize({ objects: i });
1440
+ } = G._getMontageAreaSize({ objects: i });
1440
1441
  a !== c || r !== d || (e.width = s, e.height = n);
1441
1442
  }
1442
1443
  /**
@@ -1449,22 +1450,22 @@ class Z {
1449
1450
  const { objects: s, clipPath: n } = t, { objects: o, clipPath: i } = e, {
1450
1451
  left: a,
1451
1452
  top: r
1452
- } = Z._getMontageAreaPosition({ objects: s }), {
1453
+ } = G._getMontageAreaPosition({ objects: s }), {
1453
1454
  left: c,
1454
1455
  top: d
1455
- } = Z._getMontageAreaPosition({ objects: o }), l = c - a, u = d - r;
1456
+ } = G._getMontageAreaPosition({ objects: o }), l = c - a, u = d - r;
1456
1457
  if (l === 0 && u === 0) return;
1457
- const f = Z._getObjectById({
1458
+ const f = G._getObjectById({
1458
1459
  objects: o,
1459
1460
  id: "montage-area"
1460
1461
  });
1461
1462
  f && (f.left = a, f.top = r);
1462
- const g = Z._getClipPathPosition({ clipPath: n });
1463
+ const g = G._getClipPathPosition({ clipPath: n });
1463
1464
  if (g && i && typeof i == "object") {
1464
1465
  const { left: m, top: v } = g, w = i;
1465
1466
  w.left = m, w.top = v;
1466
1467
  }
1467
- const p = Z._getTranslationIgnoredIds();
1468
+ const p = G._getTranslationIgnoredIds();
1468
1469
  for (let m = 0; m < o.length; m += 1) {
1469
1470
  const v = o[m], { id: w } = v;
1470
1471
  w && p.has(w) || (typeof v.left == "number" && (v.left -= l), typeof v.top == "number" && (v.top -= u));
@@ -1486,7 +1487,7 @@ class Z {
1486
1487
  static _getMontageAreaPosition({
1487
1488
  objects: t
1488
1489
  }) {
1489
- const e = Z._getObjectById({
1490
+ const e = G._getObjectById({
1490
1491
  objects: t,
1491
1492
  id: "montage-area"
1492
1493
  });
@@ -1501,7 +1502,7 @@ class Z {
1501
1502
  static _getMontageAreaSize({
1502
1503
  objects: t
1503
1504
  }) {
1504
- const e = Z._getObjectById({
1505
+ const e = G._getObjectById({
1505
1506
  objects: t,
1506
1507
  id: "montage-area"
1507
1508
  });
@@ -1570,7 +1571,7 @@ class Z {
1570
1571
  for (let c = 0; c < i.length; c += 1) {
1571
1572
  const d = i[c], { id: l } = d;
1572
1573
  let u;
1573
- typeof l == "string" && (u = n.get(l)), u || (u = o.get(c)), u && (d.customData = Z._cloneCustomData({ customData: u }));
1574
+ typeof l == "string" && (u = n.get(l)), u || (u = o.get(c)), u && (d.customData = G._cloneCustomData({ customData: u }));
1574
1575
  }
1575
1576
  }
1576
1577
  /**
@@ -1586,13 +1587,13 @@ class Z {
1586
1587
  * @fires editor:history-state-loaded
1587
1588
  */
1588
1589
  loadStateFromFullState(t) {
1589
- return P(this, null, function* () {
1590
+ return W(this, null, function* () {
1590
1591
  if (!t) return;
1591
1592
  console.log("loadStateFromFullState fullState", t);
1592
1593
  const { canvas: e, canvasManager: s, interactionBlocker: n, backgroundManager: o } = this.editor, { width: i, height: a } = e;
1593
1594
  n.overlayMask = null;
1594
- const r = Z._createLoadSafeState({ state: t });
1595
- yield e.loadFromJSON(r), Z._applyCustomDataFromState({ state: t, canvas: e });
1595
+ const r = G._createLoadSafeState({ state: t });
1596
+ yield e.loadFromJSON(r), G._applyCustomDataFromState({ state: t, canvas: e });
1596
1597
  const c = e.getObjects().find((u) => u.id === "montage-area");
1597
1598
  c && (this.editor.montageArea = c, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1598
1599
  const d = e.getObjects().find((u) => u.id === "overlay-mask");
@@ -1613,7 +1614,7 @@ class Z {
1613
1614
  * @fires editor:undo
1614
1615
  */
1615
1616
  undo() {
1616
- return P(this, null, function* () {
1617
+ return W(this, null, function* () {
1617
1618
  if (!this.skipHistory) {
1618
1619
  if (this.saveState(), this.currentIndex <= 0) {
1619
1620
  console.log("Нет предыдущих состояний для отмены.");
@@ -1650,7 +1651,7 @@ class Z {
1650
1651
  * @fires editor:redo
1651
1652
  */
1652
1653
  redo() {
1653
- return P(this, null, function* () {
1654
+ return W(this, null, function* () {
1654
1655
  if (!this.skipHistory) {
1655
1656
  if (this.currentIndex >= this.patches.length) {
1656
1657
  console.log("Нет состояний для повтора.");
@@ -1705,7 +1706,7 @@ class Z {
1705
1706
  }
1706
1707
  }
1707
1708
  }
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 = [
1709
+ const Hs = 0.1, Zs = 2, Ge = 0.1, Gs = 90, kt = 16, zt = 16, At = 4096, jt = 4096, Ve = "application/image-editor:", ce = [
1709
1710
  "format",
1710
1711
  "uppercase",
1711
1712
  "textCaseRaw",
@@ -1720,7 +1721,7 @@ const Hs = 0.1, Zs = 2, Ze = 0.1, Gs = 90, _t = 16, xt = 16, jt = 4096, Ct = 409
1720
1721
  "radiusBottomRight",
1721
1722
  "radiusBottomLeft"
1722
1723
  ], Vs = 50;
1723
- class ut {
1724
+ class lt {
1724
1725
  constructor({ editor: t }) {
1725
1726
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1726
1727
  }
@@ -1737,7 +1738,7 @@ class ut {
1737
1738
  * @returns возвращает Promise с объектом изображения или null в случае ошибки
1738
1739
  */
1739
1740
  importImage(t) {
1740
- return P(this, null, function* () {
1741
+ return W(this, null, function* () {
1741
1742
  const {
1742
1743
  source: e,
1743
1744
  scale: s = `image-${this.options.scaleType}`,
@@ -1749,7 +1750,7 @@ class ut {
1749
1750
  customData: c = null
1750
1751
  } = t;
1751
1752
  if (!e) return null;
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;
1753
+ const { canvas: d, montageArea: l, transformManager: u, historyManager: f, errorManager: g } = this.editor, p = yield this.getContentType(e), m = lt.getFormatFromContentType(p), { acceptContentTypes: v, acceptFormats: w } = this;
1753
1754
  if (!this.isAllowedContentType(p)) {
1754
1755
  const A = `Неверный contentType для изображения: ${p}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1755
1756
  return g.emitError({
@@ -1777,8 +1778,8 @@ class ut {
1777
1778
  if (e instanceof File)
1778
1779
  A = URL.createObjectURL(e);
1779
1780
  else if (typeof e == "string") {
1780
- const T = yield (yield fetch(e, { mode: "cors" })).blob();
1781
- A = URL.createObjectURL(T);
1781
+ const E = yield (yield fetch(e, { mode: "cors" })).blob();
1782
+ A = URL.createObjectURL(E);
1782
1783
  } else
1783
1784
  return g.emitError({
1784
1785
  origin: "ImageManager",
@@ -1800,26 +1801,26 @@ class ut {
1800
1801
  }), null;
1801
1802
  if (this._createdBlobUrls.push(A), m === "svg") {
1802
1803
  const S = yield us(A);
1803
- y = ft.groupSVGElements(S.objects, S.options);
1804
+ y = ht.groupSVGElements(S.objects, S.options);
1804
1805
  } else
1805
- y = yield Gt.fromURL(A, { crossOrigin: "anonymous" });
1806
- const { width: b, height: j } = y;
1807
- if (y instanceof Gt) {
1806
+ y = yield qt.fromURL(A, { crossOrigin: "anonymous" });
1807
+ const { width: M, height: j } = y;
1808
+ if (y instanceof qt) {
1808
1809
  const S = y.getElement();
1809
- let T = "";
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" });
1810
+ let E = "";
1811
+ if (S instanceof HTMLImageElement ? E = S.src : S instanceof HTMLCanvasElement && (E = S.toDataURL()), j > jt || M > At) {
1812
+ const b = yield this.resizeImageToBoundaries(E, "max"), I = URL.createObjectURL(b);
1813
+ this._createdBlobUrls.push(I), y = yield qt.fromURL(I, { crossOrigin: "anonymous" });
1814
+ } else if (j < zt || M < kt) {
1815
+ const b = yield this.resizeImageToBoundaries(E, "min"), I = URL.createObjectURL(b);
1816
+ this._createdBlobUrls.push(I), y = yield qt.fromURL(I, { crossOrigin: "anonymous" });
1816
1817
  }
1817
1818
  }
1818
- if (y.set("id", `${y.type}-${X()}`), y.set("format", m), y.set("customData", c || null), s === "scale-montage")
1819
+ if (y.set("id", `${y.type}-${K()}`), y.set("format", m), y.set("customData", c || null), s === "scale-montage")
1819
1820
  this.editor.canvasManager.scaleMontageAreaToImage({ object: y, withoutSave: !0 });
1820
1821
  else {
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 });
1822
+ const { width: S, height: E } = l, b = this.calculateScaleFactor({ imageObject: y, scaleType: s });
1823
+ s === "image-contain" && b < 1 ? u.fitObject({ object: y, type: "contain", withoutSave: !0 }) : s === "image-cover" && (M > S || j > E) && u.fitObject({ object: y, type: "cover", withoutSave: !0 });
1823
1824
  }
1824
1825
  const C = {
1825
1826
  image: y,
@@ -1866,16 +1867,16 @@ class ut {
1866
1867
  * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1867
1868
  */
1868
1869
  resizeImageToBoundaries(t, e = "max") {
1869
- return P(this, null, function* () {
1870
- let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${jt}x${Ct}`;
1871
- e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${_t}x${xt}`);
1870
+ return W(this, null, function* () {
1871
+ let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${At}x${jt}`;
1872
+ e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${kt}x${zt}`);
1872
1873
  const n = {
1873
1874
  dataURL: t,
1874
1875
  sizeType: e,
1875
- maxWidth: jt,
1876
- maxHeight: Ct,
1877
- minWidth: _t,
1878
- minHeight: xt
1876
+ maxWidth: At,
1877
+ maxHeight: jt,
1878
+ minWidth: kt,
1879
+ minHeight: zt
1879
1880
  };
1880
1881
  return this.editor.errorManager.emitWarning({
1881
1882
  origin: "ImageManager",
@@ -1898,7 +1899,7 @@ class ut {
1898
1899
  * @fires editor:canvas-exported
1899
1900
  */
1900
1901
  exportCanvasAsImageFile() {
1901
- return P(this, arguments, function* (t = {}) {
1902
+ return W(this, arguments, function* (t = {}) {
1902
1903
  const {
1903
1904
  fileName: e = "image.png",
1904
1905
  contentType: s = "image/png",
@@ -1906,22 +1907,22 @@ class ut {
1906
1907
  exportAsBlob: o = !1
1907
1908
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
1908
1909
  try {
1909
- const d = s === "application/pdf", l = d ? "image/jpg" : s, u = ut.getFormatFromContentType(l);
1910
+ const d = s === "application/pdf", l = d ? "image/jpg" : s, u = lt.getFormatFromContentType(l);
1910
1911
  a.setCoords();
1911
1912
  const { left: f, top: g, width: p, height: m } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
1912
1913
  v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (v.backgroundColor = "#ffffff");
1913
- const w = v.getObjects().find((M) => M.id === a.id);
1914
+ const w = v.getObjects().find((b) => b.id === a.id);
1914
1915
  if (w && (w.visible = !1), c != null && c.isBlocked) {
1915
- const M = v.getObjects().find((I) => I.id === c.overlayMask.id);
1916
- M && (M.visible = !1);
1916
+ const b = v.getObjects().find((I) => I.id === c.overlayMask.id);
1917
+ b && (b.visible = !1);
1917
1918
  }
1918
1919
  v.viewportTransform = [1, 0, 0, 1, -f, -g], v.setDimensions({ width: p, height: m }, { backstoreOnly: !0 }), v.renderAll();
1919
- const A = v.getObjects().filter((M) => M.format).every((M) => M.format === "svg");
1920
+ const A = v.getObjects().filter((b) => b.format).every((b) => b.format === "svg");
1920
1921
  if (u === "svg" && A) {
1921
- const M = v.toSVG();
1922
+ const b = v.toSVG();
1922
1923
  v.dispose();
1923
- const E = {
1924
- image: ut._exportSVGStringAsFile(M, {
1924
+ const T = {
1925
+ image: lt._exportSVGStringAsFile(b, {
1925
1926
  exportAsBase64: n,
1926
1927
  exportAsBlob: o,
1927
1928
  fileName: e
@@ -1930,66 +1931,66 @@ class ut {
1930
1931
  contentType: "image/svg+xml",
1931
1932
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1932
1933
  };
1933
- return i.fire("editor:canvas-exported", E), E;
1934
+ return i.fire("editor:canvas-exported", T), T;
1934
1935
  }
1935
- const y = yield new Promise((M, I) => {
1936
- v.getElement().toBlob((E) => {
1937
- E ? M(E) : I(new Error("Failed to create Blob from canvas"));
1936
+ const y = yield new Promise((b, I) => {
1937
+ v.getElement().toBlob((T) => {
1938
+ T ? b(T) : I(new Error("Failed to create Blob from canvas"));
1938
1939
  });
1939
1940
  });
1940
1941
  if (v.dispose(), o) {
1941
- const M = {
1942
+ const b = {
1942
1943
  image: y,
1943
1944
  format: u,
1944
1945
  contentType: l,
1945
1946
  fileName: e
1946
1947
  };
1947
- return i.fire("editor:canvas-exported", M), M;
1948
+ return i.fire("editor:canvas-exported", b), b;
1948
1949
  }
1949
- const b = yield createImageBitmap(y), j = yield r.post(
1950
+ const M = yield createImageBitmap(y), j = yield r.post(
1950
1951
  "toDataURL",
1951
- { format: u, quality: 1, bitmap: b },
1952
- [b]
1952
+ { format: u, quality: 1, bitmap: M },
1953
+ [M]
1953
1954
  );
1954
1955
  if (d) {
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",
1956
+ const I = p * 0.264583, T = m * 0.264583, _ = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, B = new _({
1957
+ orientation: I > T ? "landscape" : "portrait",
1957
1958
  unit: "mm",
1958
- format: [I, E]
1959
+ format: [I, T]
1959
1960
  });
1960
- if (x.addImage(String(j), "JPG", 0, 0, I, E), n) {
1961
- const H = {
1962
- image: x.output("datauristring"),
1961
+ if (B.addImage(String(j), "JPG", 0, 0, I, T), n) {
1962
+ const Y = {
1963
+ image: B.output("datauristring"),
1963
1964
  format: "pdf",
1964
1965
  contentType: "application/pdf",
1965
1966
  fileName: e
1966
1967
  };
1967
- return i.fire("editor:canvas-exported", H), H;
1968
+ return i.fire("editor:canvas-exported", Y), Y;
1968
1969
  }
1969
- const N = x.output("blob"), V = {
1970
+ const N = B.output("blob"), Z = {
1970
1971
  image: new File([N], e, { type: "application/pdf" }),
1971
1972
  format: "pdf",
1972
1973
  contentType: "application/pdf",
1973
1974
  fileName: e
1974
1975
  };
1975
- return i.fire("editor:canvas-exported", V), V;
1976
+ return i.fire("editor:canvas-exported", Z), Z;
1976
1977
  }
1977
1978
  if (n) {
1978
- const M = {
1979
+ const b = {
1979
1980
  image: j,
1980
1981
  format: u,
1981
1982
  contentType: l,
1982
1983
  fileName: e
1983
1984
  };
1984
- return i.fire("editor:canvas-exported", M), M;
1985
+ return i.fire("editor:canvas-exported", b), b;
1985
1986
  }
1986
- const C = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, T = {
1987
+ const C = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, E = {
1987
1988
  image: new File([y], C, { type: l }),
1988
1989
  format: u,
1989
1990
  contentType: l,
1990
1991
  fileName: C
1991
1992
  };
1992
- return i.fire("editor:canvas-exported", T), T;
1993
+ return i.fire("editor:canvas-exported", E), E;
1993
1994
  } catch (d) {
1994
1995
  return this.editor.errorManager.emitError({
1995
1996
  origin: "ImageManager",
@@ -2013,7 +2014,7 @@ class ut {
2013
2014
  * @fires editor:object-exported
2014
2015
  */
2015
2016
  exportObjectAsImageFile() {
2016
- return P(this, arguments, function* (t = {}) {
2017
+ return W(this, arguments, function* (t = {}) {
2017
2018
  const {
2018
2019
  object: e,
2019
2020
  fileName: s = "image.png",
@@ -2030,9 +2031,9 @@ class ut {
2030
2031
  data: { contentType: n, fileName: s, exportAsBase64: o, exportAsBlob: i }
2031
2032
  }), null;
2032
2033
  try {
2033
- const d = ut.getFormatFromContentType(n);
2034
+ const d = lt.getFormatFromContentType(n);
2034
2035
  if (d === "svg") {
2035
- const p = c.toSVG(), m = ut._exportSVGStringAsFile(p, {
2036
+ const p = c.toSVG(), m = lt._exportSVGStringAsFile(p, {
2036
2037
  exportAsBase64: o,
2037
2038
  exportAsBlob: i,
2038
2039
  fileName: s
@@ -2045,7 +2046,7 @@ class ut {
2045
2046
  };
2046
2047
  return a.fire("editor:object-exported", v), v;
2047
2048
  }
2048
- if (o && c instanceof Gt) {
2049
+ if (o && c instanceof qt) {
2049
2050
  const p = yield createImageBitmap(c.getElement()), m = yield r.post(
2050
2051
  "toDataURL",
2051
2052
  {
@@ -2110,7 +2111,7 @@ class ut {
2110
2111
  * @returns массив допустимых форматов изображений
2111
2112
  */
2112
2113
  getAllowedFormatsFromContentTypes() {
2113
- return this.acceptContentTypes.map((t) => ut.getFormatFromContentType(t)).filter((t) => t);
2114
+ return this.acceptContentTypes.map((t) => lt.getFormatFromContentType(t)).filter((t) => t);
2114
2115
  }
2115
2116
  /**
2116
2117
  * Проверяет, является ли contentType допустимым типом изображения.
@@ -2126,7 +2127,7 @@ class ut {
2126
2127
  * @public
2127
2128
  */
2128
2129
  getContentType(t) {
2129
- return P(this, null, function* () {
2130
+ return W(this, null, function* () {
2130
2131
  return typeof t == "string" ? this.getContentTypeFromUrl(t) : t.type || "application/octet-stream";
2131
2132
  });
2132
2133
  }
@@ -2137,7 +2138,7 @@ class ut {
2137
2138
  * @public
2138
2139
  */
2139
2140
  getContentTypeFromUrl(t) {
2140
- return P(this, null, function* () {
2141
+ return W(this, null, function* () {
2141
2142
  if (t.startsWith("data:")) {
2142
2143
  const e = t.match(/^data:([^;]+)/);
2143
2144
  return e ? e[1] : "application/octet-stream";
@@ -2163,7 +2164,7 @@ class ut {
2163
2164
  try {
2164
2165
  const n = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), o = {};
2165
2166
  return this.acceptContentTypes.forEach((i) => {
2166
- const a = ut.getFormatFromContentType(i);
2167
+ const a = lt.getFormatFromContentType(i);
2167
2168
  a && (o[a] = i);
2168
2169
  }), n && o[n] || "application/octet-stream";
2169
2170
  } catch (s) {
@@ -2216,7 +2217,7 @@ class ut {
2216
2217
  return e ? e[1] : "";
2217
2218
  }
2218
2219
  }
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);
2220
+ const pt = (h, t, e) => Math.max(Math.min(h, e), t), Xe = (h, t) => h * t, Xs = (h, t) => new et(h / 2, t / 2);
2220
2221
  function Ks(h) {
2221
2222
  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";
2222
2223
  }
@@ -2240,11 +2241,11 @@ class qs {
2240
2241
  * Если точка находится за пределами монтажной области, она проецируется на ближайшую границу монтажной области.
2241
2242
  */
2242
2243
  getVisibleCenterPoint() {
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(
2244
+ 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(
2244
2245
  a,
2245
2246
  e.left - c,
2246
2247
  e.left + c
2247
- ), u = mt(
2248
+ ), u = pt(
2248
2249
  r,
2249
2250
  e.top - d,
2250
2251
  e.top + d
@@ -2267,9 +2268,9 @@ class qs {
2267
2268
  canvas: o,
2268
2269
  montageArea: i,
2269
2270
  options: { canvasBackstoreWidth: a }
2270
- } = this.editor, { width: r, height: c } = i, d = mt(Number(t), _t, jt);
2271
+ } = this.editor, { width: r, height: c } = i, d = pt(Number(t), kt, At);
2271
2272
  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) {
2272
- const p = d / r, m = Ve(c, p);
2273
+ const p = d / r, m = Xe(c, p);
2273
2274
  this.setResolutionHeight(m);
2274
2275
  return;
2275
2276
  }
@@ -2297,9 +2298,9 @@ class qs {
2297
2298
  canvas: o,
2298
2299
  montageArea: i,
2299
2300
  options: { canvasBackstoreHeight: a }
2300
- } = this.editor, { width: r, height: c } = i, d = mt(Number(t), xt, Ct);
2301
+ } = this.editor, { width: r, height: c } = i, d = pt(Number(t), zt, jt);
2301
2302
  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) {
2302
- const p = d / c, m = Ve(r, p);
2303
+ const p = d / c, m = Xe(r, p);
2303
2304
  this.setResolutionWidth(m);
2304
2305
  return;
2305
2306
  }
@@ -2350,7 +2351,7 @@ class qs {
2350
2351
  */
2351
2352
  setCanvasBackstoreWidth(t) {
2352
2353
  if (!t || typeof t != "number") return;
2353
- const e = mt(t, _t, jt);
2354
+ const e = pt(t, kt, At);
2354
2355
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2355
2356
  }
2356
2357
  /**
@@ -2359,7 +2360,7 @@ class qs {
2359
2360
  */
2360
2361
  setCanvasBackstoreHeight(t) {
2361
2362
  if (!t || typeof t != "number") return;
2362
- const e = mt(t, xt, Ct);
2363
+ const e = pt(t, zt, jt);
2363
2364
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2364
2365
  }
2365
2366
  /**
@@ -2368,7 +2369,7 @@ class qs {
2368
2369
  * с учётом минимальных и максимальных значений.
2369
2370
  */
2370
2371
  adaptCanvasToContainer() {
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);
2372
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o = pt(s, kt, At), i = pt(n, zt, jt);
2372
2373
  t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
2373
2374
  }
2374
2375
  /**
@@ -2402,7 +2403,7 @@ class qs {
2402
2403
  if (d.length === 1)
2403
2404
  t.setActiveObject(d[0]);
2404
2405
  else {
2405
- const l = new U(d, {
2406
+ const l = new F(d, {
2406
2407
  canvas: t
2407
2408
  });
2408
2409
  t.setActiveObject(l);
@@ -2570,7 +2571,7 @@ class qs {
2570
2571
  } = this.editor, c = t || n.getActiveObject();
2571
2572
  if (!Ks(c)) return;
2572
2573
  const { width: d, height: l } = c;
2573
- let u = Math.min(d, jt), f = Math.min(l, Ct);
2574
+ let u = Math.min(d, At), f = Math.min(l, jt);
2574
2575
  if (e) {
2575
2576
  const {
2576
2577
  width: g,
@@ -2689,7 +2690,7 @@ class Js {
2689
2690
  withoutSave: s
2690
2691
  } = {}) {
2691
2692
  const { canvas: n, historyManager: o } = this.editor, i = t || n.getActiveObject();
2692
- i && (i instanceof U ? i.getObjects().forEach((a) => {
2693
+ i && (i instanceof F ? i.getObjects().forEach((a) => {
2693
2694
  a.set("opacity", e);
2694
2695
  }) : i.set("opacity", e), n.renderAll(), s || o.saveState(), n.fire("editor:object-opacity-changed", {
2695
2696
  object: i,
@@ -2716,12 +2717,12 @@ class Js {
2716
2717
  } = {}) {
2717
2718
  const { canvas: o, historyManager: i } = this.editor, a = t || o.getActiveObject();
2718
2719
  if (a) {
2719
- if (a instanceof U && !n) {
2720
+ if (a instanceof F && !n) {
2720
2721
  const r = a.getObjects();
2721
2722
  o.discardActiveObject(), r.forEach((d) => {
2722
2723
  this._fitSingleObject(d, e);
2723
2724
  });
2724
- const c = new U(r, { canvas: o });
2725
+ const c = new F(r, { canvas: o });
2725
2726
  o.setActiveObject(c);
2726
2727
  } else
2727
2728
  this._fitSingleObject(a, e);
@@ -2864,8 +2865,8 @@ class Qs {
2864
2865
  _calculateEmptySpaceRatio(t) {
2865
2866
  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
2867
  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);
2868
+ const y = Math.max(0, a - l), M = Math.max(0, u - r), j = Math.max(0, c - f), C = Math.max(0, g - d), S = Math.max(y, M), E = Math.max(j, C), b = S / o, I = E / i;
2869
+ return Math.max(b, I);
2869
2870
  }
2870
2871
  /**
2871
2872
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2881,8 +2882,8 @@ class Qs {
2881
2882
  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;
2882
2883
  if (Math.abs(g) / f <= 0.1)
2883
2884
  return { x: l, y: u };
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 };
2885
+ const m = c / 2, v = d / 2, w = a.left, A = a.top, y = m - w * s, M = v - A * s, j = (y - r[4]) / (e - s), C = (M - r[5]) / (e - s), S = j * f, E = C * f, b = S * o, I = E * o, T = Math.abs(b) > Math.abs(l) ? l : b, _ = Math.abs(I) > Math.abs(u) ? u : I;
2886
+ return { x: T, y: _ };
2886
2887
  }
2887
2888
  /**
2888
2889
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2894,7 +2895,7 @@ class Qs {
2894
2895
  * @returns true если центрирование было применено
2895
2896
  * @private
2896
2897
  */
2897
- _applyViewportCentering(t, e = !1, s = Ze) {
2898
+ _applyViewportCentering(t, e = !1, s = Ge) {
2898
2899
  const { canvas: n } = this.editor, o = this._getScaledMontageDimensions(t), i = n.getWidth(), a = n.getHeight(), r = o.width > i || o.height > a, c = this._calculateFitZoom(), d = t - c;
2899
2900
  if (!(!r || d) && !e)
2900
2901
  return !1;
@@ -2969,7 +2970,7 @@ class Qs {
2969
2970
  * @param options.pointY - Координата Y точки зума
2970
2971
  * @fires editor:zoom-changed
2971
2972
  */
2972
- zoom(t = Ze, e = {}) {
2973
+ zoom(t = Ge, e = {}) {
2973
2974
  var f, g;
2974
2975
  if (!t) return;
2975
2976
  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);
@@ -3064,7 +3065,7 @@ class $s {
3064
3065
  }), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), s.resumeHistory();
3065
3066
  }
3066
3067
  }
3067
- class Lt {
3068
+ class _t {
3068
3069
  constructor({ editor: t }) {
3069
3070
  this.editor = t, this.backgroundObject = null;
3070
3071
  }
@@ -3090,7 +3091,7 @@ class Lt {
3090
3091
  }
3091
3092
  a.set({
3092
3093
  fill: t,
3093
- backgroundId: `background-${X()}`
3094
+ backgroundId: `background-${K()}`
3094
3095
  }), this.editor.canvas.requestRenderAll();
3095
3096
  } else
3096
3097
  this._removeCurrentBackground(), this._createColorBackground(t);
@@ -3127,14 +3128,14 @@ class Lt {
3127
3128
  try {
3128
3129
  const { historyManager: i } = this.editor, { backgroundObject: a } = this;
3129
3130
  if (i.suspendHistory(), a && a.backgroundType === "gradient") {
3130
- const r = Lt._createFabricGradient(t);
3131
- if (Lt._isGradientEqual(a.fill, r)) {
3131
+ const r = _t._createFabricGradient(t);
3132
+ if (_t._isGradientEqual(a.fill, r)) {
3132
3133
  i.resumeHistory();
3133
3134
  return;
3134
3135
  }
3135
3136
  a.set({
3136
3137
  fill: r,
3137
- backgroundId: `background-${X()}`
3138
+ backgroundId: `background-${K()}`
3138
3139
  }), this.editor.canvas.requestRenderAll();
3139
3140
  } else
3140
3141
  this._removeCurrentBackground(), this._createGradientBackground(t);
@@ -3222,7 +3223,7 @@ class Lt {
3222
3223
  * @param options.withoutSave - Если true, не сохранять состояние в историю
3223
3224
  */
3224
3225
  setImageBackground(o) {
3225
- return P(this, arguments, function* ({
3226
+ return W(this, arguments, function* ({
3226
3227
  imageSource: t,
3227
3228
  customData: e = {},
3228
3229
  fromTemplate: s = !1,
@@ -3292,7 +3293,7 @@ class Lt {
3292
3293
  hasControls: !1,
3293
3294
  id: "background",
3294
3295
  backgroundType: "color",
3295
- backgroundId: `background-${X()}`
3296
+ backgroundId: `background-${K()}`
3296
3297
  }, { withoutSelection: !0 }), this.refresh();
3297
3298
  }
3298
3299
  /**
@@ -3309,9 +3310,9 @@ class Lt {
3309
3310
  hasControls: !1,
3310
3311
  id: "background",
3311
3312
  backgroundType: "gradient",
3312
- backgroundId: `background-${X()}`
3313
+ backgroundId: `background-${K()}`
3313
3314
  }, { withoutSelection: !0 }), this.refresh();
3314
- const e = Lt._createFabricGradient(t);
3315
+ const e = _t._createFabricGradient(t);
3315
3316
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
3316
3317
  }
3317
3318
  /**
@@ -3319,7 +3320,7 @@ class Lt {
3319
3320
  * @param source - источник изображения (URL или File)
3320
3321
  */
3321
3322
  _createImageBackground(t, e) {
3322
- return P(this, null, function* () {
3323
+ return W(this, null, function* () {
3323
3324
  var n;
3324
3325
  const { image: s } = (n = yield this.editor.imageManager.importImage({
3325
3326
  source: t,
@@ -3337,7 +3338,7 @@ class Lt {
3337
3338
  hasControls: !1,
3338
3339
  id: "background",
3339
3340
  backgroundType: "image",
3340
- backgroundId: `background-${X()}`,
3341
+ backgroundId: `background-${K()}`,
3341
3342
  customData: e
3342
3343
  }), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
3343
3344
  });
@@ -3371,8 +3372,8 @@ class Lt {
3371
3372
  { offset: 0, color: "#000000" },
3372
3373
  { offset: 1, color: "#ffffff" }
3373
3374
  ], t.type === "linear") {
3374
- const u = t.angle * Math.PI / 180, f = Lt._angleToCoords(u);
3375
- return new Pe({
3375
+ const u = t.angle * Math.PI / 180, f = _t._angleToCoords(u);
3376
+ return new We({
3376
3377
  type: "linear",
3377
3378
  gradientUnits: "percentage",
3378
3379
  coords: f,
@@ -3391,7 +3392,7 @@ class Lt {
3391
3392
  r1: 0,
3392
3393
  r2: d / 100
3393
3394
  };
3394
- return new Pe({
3395
+ return new We({
3395
3396
  type: "radial",
3396
3397
  gradientUnits: "percentage",
3397
3398
  coords: l,
@@ -3426,7 +3427,7 @@ class Lt {
3426
3427
  }) ? !1 : t.type === "linear" && e.type === "linear" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 : t.type === "radial" && e.type === "radial" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 && Math.abs(t.coords.r1 - e.coords.r1) < 1e-4 && Math.abs(t.coords.r2 - e.coords.r2) < 1e-4 : !1;
3427
3428
  }
3428
3429
  }
3429
- class le {
3430
+ class fe {
3430
3431
  constructor({ editor: t }) {
3431
3432
  this.editor = t;
3432
3433
  }
@@ -3441,7 +3442,7 @@ class le {
3441
3442
  const { canvas: s, historyManager: n } = this.editor;
3442
3443
  n.suspendHistory();
3443
3444
  const o = t || s.getActiveObject();
3444
- o && (o instanceof U ? o.getObjects().forEach((i) => {
3445
+ o && (o instanceof F ? o.getObjects().forEach((i) => {
3445
3446
  s.bringObjectToFront(i);
3446
3447
  }) : s.bringObjectToFront(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-to-front", {
3447
3448
  object: o,
@@ -3459,7 +3460,7 @@ class le {
3459
3460
  const { canvas: s, historyManager: n } = this.editor;
3460
3461
  n.suspendHistory();
3461
3462
  const o = t || s.getActiveObject();
3462
- o && (o instanceof U ? le._moveSelectionForward(s, o) : s.bringObjectForward(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-forward", {
3463
+ o && (o instanceof F ? fe._moveSelectionForward(s, o) : s.bringObjectForward(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-forward", {
3463
3464
  object: o,
3464
3465
  withoutSave: e
3465
3466
  }));
@@ -3482,7 +3483,7 @@ class le {
3482
3483
  o.suspendHistory();
3483
3484
  const r = t || s.getActiveObject();
3484
3485
  if (r) {
3485
- if (r instanceof U) {
3486
+ if (r instanceof F) {
3486
3487
  const c = r.getObjects();
3487
3488
  for (let d = c.length - 1; d >= 0; d -= 1)
3488
3489
  s.sendObjectToBack(c[d]);
@@ -3510,7 +3511,7 @@ class le {
3510
3511
  } = this.editor;
3511
3512
  o.suspendHistory();
3512
3513
  const r = t || s.getActiveObject();
3513
- r && (r instanceof U ? le._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(n), i && s.sendObjectToBack(i), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-send-backwards", {
3514
+ r && (r instanceof F ? fe._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(n), i && s.sendObjectToBack(i), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-send-backwards", {
3514
3515
  object: r,
3515
3516
  withoutSave: e
3516
3517
  }));
@@ -3580,13 +3581,13 @@ class tn {
3580
3581
  */
3581
3582
  addRectangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3582
3583
  var l = d, {
3583
- id: t = `rect-${X()}`,
3584
+ id: t = `rect-${K()}`,
3584
3585
  left: e,
3585
3586
  top: s,
3586
3587
  width: n = 100,
3587
3588
  height: o = 100,
3588
3589
  fill: i = "blue"
3589
- } = l, a = pt(l, [
3590
+ } = l, a = gt(l, [
3590
3591
  "id",
3591
3592
  "left",
3592
3593
  "top",
@@ -3594,7 +3595,7 @@ class tn {
3594
3595
  "height",
3595
3596
  "fill"
3596
3597
  ]);
3597
- const { canvas: u } = this.editor, f = new fs(B({
3598
+ const { canvas: u } = this.editor, f = new fs(z({
3598
3599
  id: t,
3599
3600
  left: e,
3600
3601
  top: s,
@@ -3622,19 +3623,19 @@ class tn {
3622
3623
  */
3623
3624
  addCircle(c = {}, { withoutSelection: a, withoutAdding: r } = {}) {
3624
3625
  var d = c, {
3625
- id: t = `circle-${X()}`,
3626
+ id: t = `circle-${K()}`,
3626
3627
  left: e,
3627
3628
  top: s,
3628
3629
  radius: n = 50,
3629
3630
  fill: o = "green"
3630
- } = d, i = pt(d, [
3631
+ } = d, i = gt(d, [
3631
3632
  "id",
3632
3633
  "left",
3633
3634
  "top",
3634
3635
  "radius",
3635
3636
  "fill"
3636
3637
  ]);
3637
- const { canvas: l } = this.editor, u = new gs(B({
3638
+ const { canvas: l } = this.editor, u = new gs(z({
3638
3639
  id: t,
3639
3640
  left: e,
3640
3641
  top: s,
@@ -3662,13 +3663,13 @@ class tn {
3662
3663
  */
3663
3664
  addTriangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3664
3665
  var l = d, {
3665
- id: t = `triangle-${X()}`,
3666
+ id: t = `triangle-${K()}`,
3666
3667
  left: e,
3667
3668
  top: s,
3668
3669
  width: n = 100,
3669
3670
  height: o = 100,
3670
3671
  fill: i = "yellow"
3671
- } = l, a = pt(l, [
3672
+ } = l, a = gt(l, [
3672
3673
  "id",
3673
3674
  "left",
3674
3675
  "top",
@@ -3676,7 +3677,7 @@ class tn {
3676
3677
  "height",
3677
3678
  "fill"
3678
3679
  ]);
3679
- const { canvas: u } = this.editor, f = new ps(B({
3680
+ const { canvas: u } = this.editor, f = new ps(z({
3680
3681
  id: t,
3681
3682
  left: e,
3682
3683
  top: s,
@@ -3715,10 +3716,10 @@ class en {
3715
3716
  * Асинхронное клонирование для внутреннего буфера
3716
3717
  */
3717
3718
  _cloneToInternalClipboard(t) {
3718
- return P(this, null, function* () {
3719
+ return W(this, null, function* () {
3719
3720
  const { canvas: e, errorManager: s } = this.editor;
3720
3721
  try {
3721
- const n = yield t.clone(ie);
3722
+ const n = yield t.clone(ce);
3722
3723
  this.clipboard = n, e.fire("editor:object-copied", { object: n });
3723
3724
  } catch (n) {
3724
3725
  s.emitError({
@@ -3735,7 +3736,7 @@ class en {
3735
3736
  * Копирование в системный буфер обмена
3736
3737
  */
3737
3738
  _copyToSystemClipboard(t) {
3738
- return P(this, null, function* () {
3739
+ return W(this, null, function* () {
3739
3740
  const { errorManager: e } = this.editor;
3740
3741
  if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
3741
3742
  return e.emitWarning({
@@ -3745,7 +3746,7 @@ class en {
3745
3746
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3746
3747
  }), !1;
3747
3748
  try {
3748
- const s = t.toObject(ie), n = JSON.stringify(s);
3749
+ const s = t.toObject(ce), n = JSON.stringify(s);
3749
3750
  return t.type === "image" ? this._copyImageToClipboard(t, n) : this._copyTextToClipboard(n);
3750
3751
  } catch (s) {
3751
3752
  return e.emitError({
@@ -3762,7 +3763,7 @@ class en {
3762
3763
  * Копирование изображения в буфер обмена
3763
3764
  */
3764
3765
  _copyImageToClipboard(t, e) {
3765
- return P(this, null, function* () {
3766
+ return W(this, null, function* () {
3766
3767
  try {
3767
3768
  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);
3768
3769
  for (let l = 0; l < a.length; l += 1)
@@ -3784,9 +3785,9 @@ class en {
3784
3785
  * Копирование текста в буфер обмена
3785
3786
  */
3786
3787
  _copyTextToClipboard(t) {
3787
- return P(this, null, function* () {
3788
+ return W(this, null, function* () {
3788
3789
  try {
3789
- const e = `${Ge}${t}`;
3790
+ const e = `${Ve}${t}`;
3790
3791
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3791
3792
  } catch (e) {
3792
3793
  const { errorManager: s } = this.editor;
@@ -3806,7 +3807,7 @@ class en {
3806
3807
  */
3807
3808
  _addClonedObjectToCanvas(t) {
3808
3809
  const { canvas: e, historyManager: s } = this.editor;
3809
- if (e.discardActiveObject(), t instanceof U) {
3810
+ if (e.discardActiveObject(), t instanceof F) {
3810
3811
  s.suspendHistory(), t.canvas = e, t.forEachObject((n) => {
3811
3812
  e.add(n);
3812
3813
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3819,7 +3820,7 @@ class en {
3819
3820
  * @param source - источник изображения (data URL или URL)
3820
3821
  */
3821
3822
  _handleImageImport(t) {
3822
- return P(this, null, function* () {
3823
+ return W(this, null, function* () {
3823
3824
  var s;
3824
3825
  const { image: e } = (s = yield this.editor.imageManager.importImage({
3825
3826
  source: t,
@@ -3835,18 +3836,18 @@ class en {
3835
3836
  * @fires editor:object-pasted
3836
3837
  */
3837
3838
  copyPaste(t) {
3838
- return P(this, null, function* () {
3839
+ return W(this, null, function* () {
3839
3840
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3840
3841
  if (!s || s.locked) return !1;
3841
3842
  try {
3842
- const n = yield s.clone(ie);
3843
- return n instanceof U && n.forEachObject((o) => {
3843
+ const n = yield s.clone(ce);
3844
+ return n instanceof F && n.forEachObject((o) => {
3844
3845
  o.set({
3845
- id: `${o.type}-${X()}`,
3846
+ id: `${o.type}-${K()}`,
3846
3847
  evented: !0
3847
3848
  });
3848
3849
  }), n.set({
3849
- id: `${n.type}-${X()}`,
3850
+ id: `${n.type}-${K()}`,
3850
3851
  left: n.left + 10,
3851
3852
  top: n.top + 10,
3852
3853
  evented: !0
@@ -3870,14 +3871,14 @@ class en {
3870
3871
  * @param event.clipboardData.items — элементы буфера обмена
3871
3872
  */
3872
3873
  handlePasteEvent(e) {
3873
- return P(this, arguments, function* ({ clipboardData: t }) {
3874
+ return W(this, arguments, function* ({ clipboardData: t }) {
3874
3875
  var r;
3875
3876
  if (!((r = t == null ? void 0 : t.items) != null && r.length)) {
3876
3877
  this.paste();
3877
3878
  return;
3878
3879
  }
3879
3880
  const s = t.getData("text/plain");
3880
- if (s && s.startsWith(Ge)) {
3881
+ if (s && s.startsWith(Ve)) {
3881
3882
  this.paste();
3882
3883
  return;
3883
3884
  }
@@ -3921,18 +3922,18 @@ class en {
3921
3922
  * @fires editor:object-pasted
3922
3923
  */
3923
3924
  paste() {
3924
- return P(this, null, function* () {
3925
+ return W(this, null, function* () {
3925
3926
  const { canvas: t } = this.editor;
3926
3927
  if (!this.clipboard) return !1;
3927
3928
  try {
3928
- const e = yield this.clipboard.clone(ie);
3929
- return t.discardActiveObject(), e instanceof U && e.forEachObject((s) => {
3929
+ const e = yield this.clipboard.clone(ce);
3930
+ return t.discardActiveObject(), e instanceof F && e.forEachObject((s) => {
3930
3931
  s.set({
3931
- id: `${s.type}-${X()}`,
3932
+ id: `${s.type}-${K()}`,
3932
3933
  evented: !0
3933
3934
  });
3934
3935
  }), e.set({
3935
- id: `${e.type}-${X()}`,
3936
+ id: `${e.type}-${K()}`,
3936
3937
  left: e.left + 10,
3937
3938
  top: e.top + 10,
3938
3939
  evented: !0
@@ -3950,7 +3951,7 @@ class en {
3950
3951
  });
3951
3952
  }
3952
3953
  }
3953
- class he {
3954
+ class ge {
3954
3955
  constructor({ editor: t }) {
3955
3956
  this.editor = t;
3956
3957
  }
@@ -3976,9 +3977,9 @@ class he {
3976
3977
  editable: !1,
3977
3978
  locked: !0
3978
3979
  };
3979
- i.set(a), !e && he._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3980
+ i.set(a), !e && ge._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3980
3981
  c.set(a);
3981
- }), i instanceof it && i.isEditing && i.exitEditing(), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
3982
+ }), i instanceof at && i.isEditing && i.exitEditing(), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
3982
3983
  object: i,
3983
3984
  skipInnerObjects: e,
3984
3985
  withoutSave: s
@@ -4005,7 +4006,7 @@ class he {
4005
4006
  editable: !0,
4006
4007
  locked: !1
4007
4008
  };
4008
- o.set(i), he._isGroupOrSelection(o) && o.getObjects().forEach((a) => {
4009
+ o.set(i), ge._isGroupOrSelection(o) && o.getObjects().forEach((a) => {
4009
4010
  a.set(i);
4010
4011
  }), s.renderAll(), e || n.saveState(), s.fire("editor:object-unlocked", {
4011
4012
  object: o,
@@ -4013,7 +4014,7 @@ class he {
4013
4014
  });
4014
4015
  }
4015
4016
  static _isGroupOrSelection(t) {
4016
- return t instanceof U || t instanceof Ot;
4017
+ return t instanceof F || t instanceof xt;
4017
4018
  }
4018
4019
  }
4019
4020
  class sn {
@@ -4028,7 +4029,7 @@ class sn {
4028
4029
  if (Array.isArray(t))
4029
4030
  return t.length > 0 ? t : null;
4030
4031
  const e = t || this.editor.canvas.getActiveObject();
4031
- return !e || !(e instanceof U) ? null : e.getObjects();
4032
+ return !e || !(e instanceof F) ? null : e.getObjects();
4032
4033
  }
4033
4034
  /**
4034
4035
  * Получить группы для разгруппировки
@@ -4036,20 +4037,20 @@ class sn {
4036
4037
  */
4037
4038
  _getGroupsToUngroup(t) {
4038
4039
  if (Array.isArray(t)) {
4039
- const s = t.filter((n) => n instanceof Ot);
4040
+ const s = t.filter((n) => n instanceof xt);
4040
4041
  return s.length > 0 ? s : null;
4041
4042
  }
4042
- if (t instanceof U) {
4043
- const s = t.getObjects().filter((n) => n instanceof Ot);
4043
+ if (t instanceof F) {
4044
+ const s = t.getObjects().filter((n) => n instanceof xt);
4044
4045
  return s.length > 0 ? s : null;
4045
4046
  }
4046
4047
  const e = t || this.editor.canvas.getActiveObject();
4047
4048
  if (!e) return null;
4048
- if (e instanceof U) {
4049
- const s = e.getObjects().filter((n) => n instanceof Ot);
4049
+ if (e instanceof F) {
4050
+ const s = e.getObjects().filter((n) => n instanceof xt);
4050
4051
  return s.length > 0 ? s : null;
4051
4052
  }
4052
- return e instanceof Ot ? [e] : null;
4053
+ return e instanceof xt ? [e] : null;
4053
4054
  }
4054
4055
  /**
4055
4056
  * Группировка объектов
@@ -4066,8 +4067,8 @@ class sn {
4066
4067
  if (!o) return null;
4067
4068
  try {
4068
4069
  n.suspendHistory();
4069
- const i = new Ot(o, {
4070
- id: `group-${X()}`
4070
+ const i = new xt(o, {
4071
+ id: `group-${K()}`
4071
4072
  });
4072
4073
  o.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
4073
4074
  const a = {
@@ -4102,7 +4103,7 @@ class sn {
4102
4103
  s.add(l), i.push(l);
4103
4104
  });
4104
4105
  });
4105
- const a = new U(i, {
4106
+ const a = new F(i, {
4106
4107
  canvas: s
4107
4108
  });
4108
4109
  s.setActiveObject(a), s.requestRenderAll();
@@ -4128,11 +4129,11 @@ class nn {
4128
4129
  selectAll() {
4129
4130
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
4130
4131
  t.discardActiveObject();
4131
- const n = e.getObjects(), o = n.some((a) => a.locked), i = n.length > 1 ? new U(e.getObjects(), { canvas: t }) : n[0];
4132
+ const n = e.getObjects(), o = n.some((a) => a.locked), i = n.length > 1 ? new F(e.getObjects(), { canvas: t }) : n[0];
4132
4133
  o && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
4133
4134
  }
4134
4135
  }
4135
- class Oe {
4136
+ class Re {
4136
4137
  constructor({ editor: t }) {
4137
4138
  this.editor = t;
4138
4139
  }
@@ -4179,7 +4180,7 @@ class Oe {
4179
4180
  s || o.suspendHistory();
4180
4181
  const r = [];
4181
4182
  if (a.forEach((d) => {
4182
- if (Oe._isUngroupableGroup(d)) {
4183
+ if (Re._isUngroupableGroup(d)) {
4183
4184
  const l = this._handleGroupDeletion(d);
4184
4185
  r.push(...l);
4185
4186
  return;
@@ -4194,7 +4195,7 @@ class Oe {
4194
4195
  return n.fire("editor:objects-deleted", c), c;
4195
4196
  }
4196
4197
  }
4197
- const At = {
4198
+ const St = {
4198
4199
  IMAGE_MANAGER: {
4199
4200
  /**
4200
4201
  * Некорректный Content-Type изображения
@@ -4299,7 +4300,7 @@ const At = {
4299
4300
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4300
4301
  }
4301
4302
  };
4302
- class qt {
4303
+ class te {
4303
4304
  constructor({ editor: t }) {
4304
4305
  this._buffer = [], this.editor = t;
4305
4306
  }
@@ -4326,7 +4327,7 @@ class qt {
4326
4327
  * @fires editor:error
4327
4328
  */
4328
4329
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: n, message: o }) {
4329
- if (!qt.isValidErrorCode(s)) {
4330
+ if (!te.isValidErrorCode(s)) {
4330
4331
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
4331
4332
  return;
4332
4333
  }
@@ -4340,7 +4341,7 @@ class qt {
4340
4341
  message: i,
4341
4342
  data: n
4342
4343
  };
4343
- this._buffer.push(B({
4344
+ this._buffer.push(z({
4344
4345
  type: "editor:error"
4345
4346
  }, a)), this.editor.canvas.fire("editor:error", a);
4346
4347
  }
@@ -4355,7 +4356,7 @@ class qt {
4355
4356
  * @fires editor:warning
4356
4357
  */
4357
4358
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: n, data: o }) {
4358
- if (!qt.isValidErrorCode(s)) {
4359
+ if (!te.isValidErrorCode(s)) {
4359
4360
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
4360
4361
  return;
4361
4362
  }
@@ -4368,7 +4369,7 @@ class qt {
4368
4369
  message: i,
4369
4370
  data: o
4370
4371
  };
4371
- this._buffer.push(B({
4372
+ this._buffer.push(z({
4372
4373
  type: "editor:warning"
4373
4374
  }, a)), this.editor.canvas.fire("editor:warning", a);
4374
4375
  }
@@ -4378,7 +4379,7 @@ class qt {
4378
4379
  * @returns true, если код допустим, иначе false
4379
4380
  */
4380
4381
  static isValidErrorCode(t) {
4381
- return t ? Object.values(At).some((e) => Object.values(e).includes(t)) : !1;
4382
+ return t ? Object.values(St).some((e) => Object.values(e).includes(t)) : !1;
4382
4383
  }
4383
4384
  }
4384
4385
  class on {
@@ -4466,11 +4467,11 @@ class on {
4466
4467
  this.currentBounds = this.calculatePanBounds();
4467
4468
  }
4468
4469
  }
4469
- const lt = ({
4470
+ const ct = ({
4470
4471
  value: h,
4471
4472
  min: t,
4472
4473
  max: e
4473
- }) => Math.min(Math.max(h, t), e), Rt = class Rt extends it {
4474
+ }) => Math.min(Math.max(h, t), e), Bt = class Bt extends at {
4474
4475
  constructor(t, e = {}) {
4475
4476
  var s, n, o, i, a, r, c, d, l;
4476
4477
  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();
@@ -4495,7 +4496,7 @@ const lt = ({
4495
4496
  }
4496
4497
  _getTransformedDimensions(t = {}) {
4497
4498
  const { width: e, height: s } = this._getBackgroundDimensions();
4498
- return super._getTransformedDimensions(St(B({}, t), {
4499
+ return super._getTransformedDimensions(wt(z({}, t), {
4499
4500
  width: e,
4500
4501
  height: s
4501
4502
  }));
@@ -4505,7 +4506,7 @@ const lt = ({
4505
4506
  */
4506
4507
  toObject(t = []) {
4507
4508
  const e = super.toObject(t);
4508
- return St(B({}, e), {
4509
+ return wt(z({}, e), {
4509
4510
  backgroundOpacity: this.backgroundOpacity,
4510
4511
  paddingTop: this.paddingTop,
4511
4512
  paddingRight: this.paddingRight,
@@ -4522,7 +4523,7 @@ const lt = ({
4522
4523
  const e = this._getEffectiveBackgroundFill();
4523
4524
  if (e && e) {
4524
4525
  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;
4525
- t.save(), Rt._renderRoundedRect({
4526
+ t.save(), Bt._renderRoundedRect({
4526
4527
  ctx: t,
4527
4528
  height: c,
4528
4529
  left: l,
@@ -4544,10 +4545,10 @@ const lt = ({
4544
4545
  var i, a, r, c;
4545
4546
  const s = t / 2, n = e / 2, o = Math.min(s, n);
4546
4547
  return {
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 })
4548
+ bottomLeft: ct({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
4549
+ bottomRight: ct({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
4550
+ topLeft: ct({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
4551
+ topRight: ct({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
4551
4552
  };
4552
4553
  }
4553
4554
  _getPadding() {
@@ -4563,12 +4564,12 @@ const lt = ({
4563
4564
  var n;
4564
4565
  const t = this.backgroundColor;
4565
4566
  if (!t) return null;
4566
- const e = lt({ value: (n = this.backgroundOpacity) != null ? n : 1, min: 0, max: 1 });
4567
+ const e = ct({ value: (n = this.backgroundOpacity) != null ? n : 1, min: 0, max: 1 });
4567
4568
  let s;
4568
4569
  try {
4569
4570
  s = new ms(t);
4570
4571
  } catch (o) {
4571
- return qt.emitError({
4572
+ return te.emitError({
4572
4573
  origin: "BackgroundTextbox",
4573
4574
  method: "_getEffectiveBackgroundFill",
4574
4575
  code: "INVALID_COLOR_VALUE",
@@ -4591,7 +4592,7 @@ const lt = ({
4591
4592
  topRight: d,
4592
4593
  bottomRight: l,
4593
4594
  bottomLeft: u
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 });
4595
+ } = n, f = ct({ value: c, min: 0, max: i }), g = ct({ value: d, min: 0, max: i }), p = ct({ value: l, min: 0, max: i }), m = ct({ value: u, min: 0, max: i });
4595
4596
  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();
4596
4597
  }
4597
4598
  /**
@@ -4605,8 +4606,8 @@ const lt = ({
4605
4606
  s !== t && (this.width = Math.max(0, s)), n !== e && (this.height = Math.max(0, n));
4606
4607
  }
4607
4608
  };
4608
- Rt.type = "background-textbox", Rt.cacheProperties = [
4609
- ...Array.isArray(it.cacheProperties) ? it.cacheProperties : [],
4609
+ Bt.type = "background-textbox", Bt.cacheProperties = [
4610
+ ...Array.isArray(at.cacheProperties) ? at.cacheProperties : [],
4610
4611
  "backgroundColor",
4611
4612
  "backgroundOpacity",
4612
4613
  "paddingTop",
@@ -4617,8 +4618,8 @@ Rt.type = "background-textbox", Rt.cacheProperties = [
4617
4618
  "radiusTopRight",
4618
4619
  "radiusBottomRight",
4619
4620
  "radiusBottomLeft"
4620
- ], Rt.stateProperties = [
4621
- ...Array.isArray(it.stateProperties) ? it.stateProperties : [],
4621
+ ], Bt.stateProperties = [
4622
+ ...Array.isArray(at.stateProperties) ? at.stateProperties : [],
4622
4623
  "backgroundColor",
4623
4624
  "backgroundOpacity",
4624
4625
  "paddingTop",
@@ -4630,10 +4631,10 @@ Rt.type = "background-textbox", Rt.cacheProperties = [
4630
4631
  "radiusBottomRight",
4631
4632
  "radiusBottomLeft"
4632
4633
  ];
4633
- let ue = Rt;
4634
+ let pe = Bt;
4634
4635
  const an = () => {
4635
4636
  var h;
4636
- (h = We) != null && h.setClass && We.setClass(ue, "background-textbox");
4637
+ (h = Ue) != null && h.setClass && Ue.setClass(pe, "background-textbox");
4637
4638
  }, rn = ({ textbox: h }) => {
4638
4639
  var s, n;
4639
4640
  if (!h.isEditing) return null;
@@ -4651,7 +4652,7 @@ const an = () => {
4651
4652
  if (!t) return !1;
4652
4653
  const e = (n = (s = h.text) == null ? void 0 : s.length) != null ? n : 0;
4653
4654
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4654
- }, ge = ({
4655
+ }, ye = ({
4655
4656
  textbox: h,
4656
4657
  styles: t,
4657
4658
  range: e
@@ -4659,7 +4660,7 @@ const an = () => {
4659
4660
  if (!t || !Object.keys(t).length) return !1;
4660
4661
  const { start: s, end: n } = e;
4661
4662
  return n <= s ? !1 : (h.setSelectionStyles(t, s, n), !0);
4662
- }, Xe = ({
4663
+ }, Ke = ({
4663
4664
  textbox: h,
4664
4665
  range: t,
4665
4666
  property: e
@@ -4673,15 +4674,15 @@ const an = () => {
4673
4674
  );
4674
4675
  if (s.length)
4675
4676
  return (n = s[0]) == null ? void 0 : n[e];
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;
4677
- class k {
4677
+ }, qe = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Je = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ve = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", tt = 0.01;
4678
+ class P {
4678
4679
  constructor({ editor: t }) {
4679
4680
  var e;
4680
4681
  this._handleTextEditingEntered = (s) => {
4681
4682
  var r;
4682
4683
  this.isTextEditingActive = !0;
4683
4684
  const { target: n } = s;
4684
- if (!k._isTextbox(n)) return;
4685
+ if (!P._isTextbox(n)) return;
4685
4686
  const o = (r = n.originY) != null ? r : "top", i = n.getPointByOrigin("center", o);
4686
4687
  this._ensureEditingAnchorState().set(n, {
4687
4688
  originY: o,
@@ -4690,19 +4691,22 @@ class k {
4690
4691
  });
4691
4692
  }, this._handleTextChanged = (s) => {
4692
4693
  const { target: n } = s;
4693
- if (!k._isTextbox(n)) return;
4694
- const { text: o = "", uppercase: i } = n, a = !!i, r = o.toLocaleLowerCase();
4695
- if (a) {
4696
- const l = pe({ value: r });
4697
- l !== o && n.set({ text: l }), n.textCaseRaw = r;
4694
+ if (!P._isTextbox(n)) return;
4695
+ const { text: o = "", uppercase: i, autoExpand: a } = n, r = !!i, c = a !== !1, d = o.toLocaleLowerCase();
4696
+ if (r) {
4697
+ const f = ve({ value: d });
4698
+ f !== o && n.set({ text: f }), n.textCaseRaw = d;
4698
4699
  } else
4699
4700
  n.textCaseRaw = o;
4700
- const c = this._autoExpandTextboxWidth(n), d = c ? !1 : k._roundTextboxDimensions({ textbox: n });
4701
- (c || d) && (n.setCoords(), n.dirty = !0);
4701
+ a === void 0 && (n.autoExpand = !0);
4702
+ let l = !1;
4703
+ c && (l = this._autoExpandTextboxWidth(n));
4704
+ let u = !1;
4705
+ l || (u = P._roundTextboxDimensions({ textbox: n })), (l || u) && (n.setCoords(), n.dirty = !0);
4702
4706
  }, this._handleTextEditingExited = (s) => {
4703
4707
  var r, c, d;
4704
4708
  const { target: n } = s;
4705
- if (!k._isTextbox(n)) return;
4709
+ if (!P._isTextbox(n)) return;
4706
4710
  (r = this.editingAnchorState) == null || r.delete(n);
4707
4711
  const o = (c = n.text) != null ? c : "";
4708
4712
  if (!!n.uppercase) {
@@ -4710,16 +4714,16 @@ class k {
4710
4714
  n.textCaseRaw = l;
4711
4715
  } else
4712
4716
  n.textCaseRaw = o;
4713
- k._roundTextboxDimensions({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
4717
+ P._roundTextboxDimensions({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
4714
4718
  lockMovementX: !1,
4715
4719
  lockMovementY: !1
4716
4720
  }), setTimeout(() => {
4717
4721
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4718
4722
  }, Vs);
4719
4723
  }, this._handleObjectScaling = (s) => {
4720
- var te, Bt, kt, zt, Pt, Wt, Ut, Ft, Yt, K, Et, ee, wt;
4724
+ var se, ne, oe, Et, me, ie, Ft, Yt, Ht, Zt, Gt, Vt, Xt;
4721
4725
  const { target: n, transform: o } = s;
4722
- if (n instanceof U || !k._isTextbox(n) || !o) return;
4726
+ if (n instanceof F || !P._isTextbox(n) || !o) return;
4723
4727
  n.isScaling = !0;
4724
4728
  const i = this._ensureScalingState(n), {
4725
4729
  baseWidth: a,
@@ -4728,135 +4732,135 @@ class k {
4728
4732
  basePadding: d,
4729
4733
  baseRadii: l,
4730
4734
  baseStyles: u
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;
4732
- if (!A && !y && !b) return;
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), {
4734
- paddingTop: E = 0,
4735
- paddingRight: z = 0,
4736
- paddingBottom: x = 0,
4735
+ } = i, f = typeof ((se = o.original) == null ? void 0 : se.width) == "number" ? o.original.width : void 0, g = typeof ((ne = o.original) == null ? void 0 : ne.left) == "number" ? o.original.left : void 0, p = f != null ? f : a, m = g != null ? g : r, v = (oe = o.corner) != null ? oe : "", w = (Et = o.action) != null ? Et : "", A = ["ml", "mr"].includes(v) || w === "scaleX", y = ["mt", "mb"].includes(v) || w === "scaleY", M = ["tl", "tr", "bl", "br"].includes(v) || w === "scale", j = M || y;
4736
+ if (!A && !y && !M) return;
4737
+ const C = Math.abs((ie = (me = n.scaleX) != null ? me : o.scaleX) != null ? ie : 1) || 1, S = Math.abs((Yt = (Ft = n.scaleY) != null ? Ft : o.scaleY) != null ? Yt : 1) || 1, E = Math.max(1, p * C), b = Math.max(1, Math.round(E)), I = Math.max(1, c * S), {
4738
+ paddingTop: T = 0,
4739
+ paddingRight: _ = 0,
4740
+ paddingBottom: B = 0,
4737
4741
  paddingLeft: N = 0,
4738
- radiusTopLeft: Y = 0,
4739
- radiusTopRight: V = 0,
4740
- radiusBottomRight: q = 0,
4741
- radiusBottomLeft: H = 0,
4742
- fontSize: R,
4743
- width: O,
4744
- originX: at = "left"
4745
- } = n, G = b || y, nt = b || y, F = G ? {
4742
+ radiusTopLeft: H = 0,
4743
+ radiusTopRight: Z = 0,
4744
+ radiusBottomRight: $ = 0,
4745
+ radiusBottomLeft: Y = 0,
4746
+ fontSize: st,
4747
+ width: R,
4748
+ originX: O = "left"
4749
+ } = n, it = M || y, X = M || y, V = it ? {
4746
4750
  top: Math.max(0, d.top * S),
4747
4751
  right: Math.max(0, d.right * S),
4748
4752
  bottom: Math.max(0, d.bottom * S),
4749
4753
  left: Math.max(0, d.left * S)
4750
- } : d, $ = nt ? {
4754
+ } : d, k = X ? {
4751
4755
  topLeft: Math.max(0, l.topLeft * S),
4752
4756
  topRight: Math.max(0, l.topRight * S),
4753
4757
  bottomRight: Math.max(0, l.bottomRight * S),
4754
4758
  bottomLeft: Math.max(0, l.bottomLeft * S)
4755
- } : l, ot = Object.keys(u).length > 0;
4759
+ } : l, Pt = Object.keys(u).length > 0;
4756
4760
  let Q;
4757
- if (j && ot) {
4758
- const Ht = {};
4759
- Object.entries(u).forEach(([Zt, De]) => {
4760
- if (!De) return;
4761
- const fe = {};
4762
- Object.entries(De).forEach(([cs, se]) => {
4763
- if (!se) return;
4764
- const Re = B({}, se);
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);
4761
+ if (j && Pt) {
4762
+ const Tt = {};
4763
+ Object.entries(u).forEach(([q, Ot]) => {
4764
+ if (!Ot) return;
4765
+ const Kt = {};
4766
+ Object.entries(Ot).forEach(([Lt, Dt]) => {
4767
+ if (!Dt) return;
4768
+ const Rt = z({}, Dt);
4769
+ typeof Dt.fontSize == "number" && (Rt.fontSize = Math.max(1, Dt.fontSize * S)), Kt[Lt] = Rt;
4770
+ }), Object.keys(Kt).length && (Tt[q] = Kt);
4771
+ }), Object.keys(Tt).length && (Q = Tt);
4768
4772
  }
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) {
4773
+ const nt = (Zt = (Ht = o.originX) != null ? Ht : O) != null ? Zt : "left", Ct = m + p, ut = m + p / 2, ft = R != null ? R : p, rt = b !== ft, It = Math.abs(I - (st != null ? st : c)) > tt, Wt = Math.abs(V.top - T) > tt || Math.abs(V.right - _) > tt || Math.abs(V.bottom - B) > tt || Math.abs(V.left - N) > tt, yt = Math.abs(k.topLeft - H) > tt || Math.abs(k.topRight - Z) > tt || Math.abs(k.bottomRight - $) > tt || Math.abs(k.bottomLeft - Y) > tt;
4774
+ if (!rt && !It && !Wt && !yt) {
4771
4775
  n.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
4772
4776
  return;
4773
4777
  }
4774
4778
  Q && (n.styles = Q), n.set({
4775
- width: M,
4779
+ width: b,
4776
4780
  fontSize: j ? I : c,
4777
- paddingTop: F.top,
4778
- paddingRight: F.right,
4779
- paddingBottom: F.bottom,
4780
- paddingLeft: F.left,
4781
- radiusTopLeft: $.topLeft,
4782
- radiusTopRight: $.topRight,
4783
- radiusBottomRight: $.bottomRight,
4784
- radiusBottomLeft: $.bottomLeft,
4781
+ paddingTop: V.top,
4782
+ paddingRight: V.right,
4783
+ paddingBottom: V.bottom,
4784
+ paddingLeft: V.left,
4785
+ radiusTopLeft: k.topLeft,
4786
+ radiusTopRight: k.topRight,
4787
+ radiusBottomRight: k.bottomRight,
4788
+ radiusBottomLeft: k.bottomLeft,
4785
4789
  scaleX: 1,
4786
4790
  scaleY: 1
4787
4791
  });
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;
4792
+ const ee = P._roundTextboxDimensions({ textbox: n });
4793
+ ee && (n.dirty = !0);
4794
+ const vt = (Gt = n.width) != null ? Gt : b, Ut = vt !== ft;
4795
+ let bt = m;
4796
+ Ut && (A || M) && (nt === "right" ? bt = Ct - vt : nt === "center" && (bt = ut - vt / 2)), n.set({ left: bt }), i.baseLeft = bt, o.scaleX = 1, o.scaleY = 1;
4793
4797
  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 = {
4795
- top: F.top,
4796
- right: F.right,
4797
- bottom: F.bottom,
4798
- left: F.left
4798
+ Mt && (Mt.scaleX = 1, Mt.scaleY = 1, Mt.width = vt, Mt.height = n.height, Mt.left = bt), n.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = vt, i.baseFontSize = (Vt = n.fontSize) != null ? Vt : I, i.baseStyles = JSON.parse(JSON.stringify((Xt = n.styles) != null ? Xt : {})), i.basePadding = {
4799
+ top: V.top,
4800
+ right: V.right,
4801
+ bottom: V.bottom,
4802
+ left: V.left
4799
4803
  }, i.baseRadii = {
4800
- topLeft: $.topLeft,
4801
- topRight: $.topRight,
4802
- bottomRight: $.bottomRight,
4803
- bottomLeft: $.bottomLeft
4804
- }, i.hasWidthChange = $t || Nt || bt || Jt || Qt;
4804
+ topLeft: k.topLeft,
4805
+ topRight: k.topRight,
4806
+ bottomRight: k.bottomRight,
4807
+ bottomLeft: k.bottomLeft
4808
+ }, i.hasWidthChange = Ut || It || Wt || yt || ee;
4805
4809
  }, this._handleObjectModified = (s) => {
4806
4810
  var w, A, y;
4807
4811
  const { target: n } = s;
4808
- if (n instanceof U) {
4809
- const b = n.getObjects();
4810
- if (!b.some((M) => k._isTextbox(M))) return;
4812
+ if (n instanceof F) {
4813
+ const M = n.getObjects();
4814
+ if (!M.some((b) => P._isTextbox(b))) return;
4811
4815
  const { scaleX: C = 1, scaleY: S = 1 } = n;
4812
4816
  if (Math.abs(C - 1) < tt && Math.abs(S - 1) < tt) return;
4813
- this.canvas.discardActiveObject(), b.forEach((M) => {
4814
- var I, E, z, x;
4815
- if (k._isTextbox(M)) {
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, {
4817
- paddingTop: R = 0,
4818
- paddingRight: O = 0,
4819
- paddingBottom: at = 0,
4820
- paddingLeft: G = 0,
4821
- radiusTopLeft: nt = 0,
4822
- radiusTopRight: F = 0,
4823
- radiusBottomRight: $ = 0,
4824
- radiusBottomLeft: ot = 0,
4817
+ this.canvas.discardActiveObject(), M.forEach((b) => {
4818
+ var I, T, _, B;
4819
+ if (P._isTextbox(b)) {
4820
+ const N = (I = b.scaleX) != null ? I : 1, H = (T = b.scaleY) != null ? T : 1, Z = ((_ = b.fontSize) != null ? _ : 16) * H, $ = ((B = b.width) != null ? B : 0) * N, Y = H, {
4821
+ paddingTop: st = 0,
4822
+ paddingRight: R = 0,
4823
+ paddingBottom: O = 0,
4824
+ paddingLeft: it = 0,
4825
+ radiusTopLeft: X = 0,
4826
+ radiusTopRight: V = 0,
4827
+ radiusBottomRight: k = 0,
4828
+ radiusBottomLeft: Pt = 0,
4825
4829
  styles: Q
4826
- } = M, vt = {
4827
- paddingTop: Math.max(0, R * H),
4828
- paddingRight: Math.max(0, O * H),
4829
- paddingBottom: Math.max(0, at * H),
4830
- paddingLeft: Math.max(0, G * H)
4831
- }, It = {
4832
- radiusTopLeft: Math.max(0, nt * H),
4833
- radiusTopRight: Math.max(0, F * H),
4834
- radiusBottomRight: Math.max(0, $ * H),
4835
- radiusBottomLeft: Math.max(0, ot * H)
4830
+ } = b, nt = {
4831
+ paddingTop: Math.max(0, st * Y),
4832
+ paddingRight: Math.max(0, R * Y),
4833
+ paddingBottom: Math.max(0, O * Y),
4834
+ paddingLeft: Math.max(0, it * Y)
4835
+ }, Ct = {
4836
+ radiusTopLeft: Math.max(0, X * Y),
4837
+ radiusTopRight: Math.max(0, V * Y),
4838
+ radiusBottomRight: Math.max(0, k * Y),
4839
+ radiusBottomLeft: Math.max(0, Pt * Y)
4836
4840
  };
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));
4841
+ let ut = Q;
4842
+ Q && Object.keys(Q).length > 0 && (ut = JSON.parse(JSON.stringify(Q)), Object.values(ut).forEach((ft) => {
4843
+ Object.values(ft).forEach((rt) => {
4844
+ typeof rt.fontSize == "number" && (rt.fontSize = Math.max(1, rt.fontSize * Y));
4841
4845
  });
4842
- })), M.set(St(B(B({
4843
- fontSize: V,
4844
- width: q,
4846
+ })), b.set(wt(z(z({
4847
+ fontSize: Z,
4848
+ width: $,
4845
4849
  scaleX: 1,
4846
4850
  scaleY: 1
4847
- }, vt), It), {
4848
- styles: rt
4849
- })), k._roundTextboxDimensions({ textbox: M });
4851
+ }, nt), Ct), {
4852
+ styles: ut
4853
+ })), P._roundTextboxDimensions({ textbox: b });
4850
4854
  }
4851
- M.setCoords();
4855
+ b.setCoords();
4852
4856
  });
4853
- const T = new U(b, {
4857
+ const E = new F(M, {
4854
4858
  canvas: this.canvas
4855
4859
  });
4856
- this.canvas.setActiveObject(T), this.canvas.requestRenderAll();
4860
+ this.canvas.setActiveObject(E), this.canvas.requestRenderAll();
4857
4861
  return;
4858
4862
  }
4859
- if (!k._isTextbox(n)) return;
4863
+ if (!P._isTextbox(n)) return;
4860
4864
  n.isScaling = !1;
4861
4865
  const o = this.scalingState.get(n);
4862
4866
  if (this.scalingState.delete(n), !(o != null && o.hasWidthChange)) return;
@@ -4891,35 +4895,37 @@ class k {
4891
4895
  * @param options — настройки текста
4892
4896
  * @param flags — флаги поведения
4893
4897
  */
4894
- addText(z = {}, { withoutSelection: M = !1, withoutSave: I = !1, withoutAdding: E = !1 } = {}) {
4895
- var x = z, {
4896
- id: t = `text-${X()}`,
4898
+ addText(B = {}, { withoutSelection: I = !1, withoutSave: T = !1, withoutAdding: _ = !1 } = {}) {
4899
+ var N = B, {
4900
+ id: t = `text-${K()}`,
4897
4901
  text: e = "Новый текст",
4898
- fontFamily: s,
4899
- fontSize: n = 48,
4900
- bold: o = !1,
4901
- italic: i = !1,
4902
- underline: a = !1,
4903
- uppercase: r = !1,
4904
- strikethrough: c = !1,
4905
- align: d = "left",
4906
- color: l = "#000000",
4907
- strokeColor: u,
4908
- strokeWidth: f = 0,
4909
- opacity: g = 1,
4910
- backgroundColor: p,
4911
- backgroundOpacity: m = 1,
4912
- paddingTop: v = 0,
4913
- paddingRight: w = 0,
4914
- paddingBottom: A = 0,
4915
- paddingLeft: y = 0,
4916
- radiusTopLeft: b = 0,
4917
- radiusTopRight: j = 0,
4918
- radiusBottomRight: C = 0,
4919
- radiusBottomLeft: S = 0
4920
- } = x, T = pt(x, [
4902
+ autoExpand: s = !0,
4903
+ fontFamily: n,
4904
+ fontSize: o = 48,
4905
+ bold: i = !1,
4906
+ italic: a = !1,
4907
+ underline: r = !1,
4908
+ uppercase: c = !1,
4909
+ strikethrough: d = !1,
4910
+ align: l = "left",
4911
+ color: u = "#000000",
4912
+ strokeColor: f,
4913
+ strokeWidth: g = 0,
4914
+ opacity: p = 1,
4915
+ backgroundColor: m,
4916
+ backgroundOpacity: v = 1,
4917
+ paddingTop: w = 0,
4918
+ paddingRight: A = 0,
4919
+ paddingBottom: y = 0,
4920
+ paddingLeft: M = 0,
4921
+ radiusTopLeft: j = 0,
4922
+ radiusTopRight: C = 0,
4923
+ radiusBottomRight: S = 0,
4924
+ radiusBottomLeft: E = 0
4925
+ } = N, b = gt(N, [
4921
4926
  "id",
4922
4927
  "text",
4928
+ "autoExpand",
4923
4929
  "fontFamily",
4924
4930
  "fontSize",
4925
4931
  "bold",
@@ -4943,58 +4949,58 @@ class k {
4943
4949
  "radiusBottomRight",
4944
4950
  "radiusBottomLeft"
4945
4951
  ]);
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({
4950
- strokeColor: u,
4951
- width: q
4952
- }), R = B({
4952
+ var V;
4953
+ const { historyManager: H } = this.editor, { canvas: Z } = this;
4954
+ H.suspendHistory();
4955
+ const $ = n != null ? n : this._getDefaultFontFamily(), Y = Je({ width: g }), st = qe({
4956
+ strokeColor: f,
4957
+ width: Y
4958
+ }), R = z({
4953
4959
  id: t,
4954
- fontFamily: V,
4955
- fontSize: n,
4956
- fontWeight: o ? "bold" : "normal",
4957
- fontStyle: i ? "italic" : "normal",
4958
- underline: a,
4959
- uppercase: r,
4960
- linethrough: c,
4961
- textAlign: d,
4962
- fill: l,
4963
- stroke: H,
4964
- strokeWidth: q,
4960
+ fontFamily: $,
4961
+ fontSize: o,
4962
+ fontWeight: i ? "bold" : "normal",
4963
+ fontStyle: a ? "italic" : "normal",
4964
+ underline: r,
4965
+ uppercase: c,
4966
+ linethrough: d,
4967
+ textAlign: l,
4968
+ fill: u,
4969
+ stroke: st,
4970
+ strokeWidth: Y,
4965
4971
  strokeUniform: !0,
4966
- opacity: g,
4967
- backgroundColor: p,
4968
- backgroundOpacity: m,
4969
- paddingTop: v,
4970
- paddingRight: w,
4971
- paddingBottom: A,
4972
- paddingLeft: y,
4973
- radiusTopLeft: b,
4974
- radiusTopRight: j,
4975
- radiusBottomRight: C,
4976
- radiusBottomLeft: S
4977
- }, T), O = new ue(e, R);
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 });
4981
- }
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", {
4972
+ opacity: p,
4973
+ backgroundColor: m,
4974
+ backgroundOpacity: v,
4975
+ paddingTop: w,
4976
+ paddingRight: A,
4977
+ paddingBottom: y,
4978
+ paddingLeft: M,
4979
+ radiusTopLeft: j,
4980
+ radiusTopRight: C,
4981
+ radiusBottomRight: S,
4982
+ radiusBottomLeft: E
4983
+ }, b), O = new pe(e, R), it = s !== !1;
4984
+ if (O.autoExpand = it, O.textCaseRaw = (V = O.text) != null ? V : "", c) {
4985
+ const k = ve({ value: O.textCaseRaw });
4986
+ k !== O.text && O.set({ text: k });
4987
+ }
4988
+ return P._roundTextboxDimensions({ textbox: O }) && (O.dirty = !0), b.left === void 0 && b.top === void 0 && Z.centerObject(O), _ || Z.add(O), I || Z.setActiveObject(O), Z.requestRenderAll(), H.resumeHistory(), T || H.saveState(), Z.fire("editor:text-added", {
4983
4989
  textbox: O,
4984
- options: St(B({}, R), {
4990
+ options: wt(z({}, R), {
4985
4991
  text: e,
4986
- bold: o,
4987
- italic: i,
4988
- strikethrough: c,
4989
- align: d,
4990
- color: l,
4991
- strokeColor: H,
4992
- strokeWidth: q
4992
+ bold: i,
4993
+ italic: a,
4994
+ strikethrough: d,
4995
+ align: l,
4996
+ color: u,
4997
+ strokeColor: st,
4998
+ strokeWidth: Y
4993
4999
  }),
4994
5000
  flags: {
4995
- withoutSelection: !!M,
4996
- withoutSave: !!I,
4997
- withoutAdding: !!E
5001
+ withoutSelection: !!I,
5002
+ withoutSave: !!T,
5003
+ withoutAdding: !!_
4998
5004
  }
4999
5005
  }), O;
5000
5006
  }
@@ -5006,42 +5012,49 @@ class k {
5006
5012
  * @param options.withoutSave — не сохранять состояние в историю
5007
5013
  * @param options.skipRender — не вызывать перерисовку канваса
5008
5014
  */
5009
- updateText({ target: t, style: e = {}, withoutSave: s, skipRender: n } = {}) {
5010
- var Bt, zt, Pt, Wt, Ut, Ft, Yt;
5015
+ updateText({
5016
+ target: t,
5017
+ style: e = {},
5018
+ withoutSave: s,
5019
+ skipRender: n
5020
+ } = {}) {
5021
+ var Ft, Ht, Zt, Gt, Vt, Xt, Tt;
5011
5022
  const o = this._resolveTextObject(t);
5012
5023
  if (!o) return null;
5013
5024
  const { historyManager: i } = this.editor, { canvas: a } = this;
5014
5025
  i.suspendHistory();
5015
- const r = k._getSnapshot(o), c = (Bt = o.originY) != null ? Bt : "top", d = o.getPointByOrigin("center", c), l = {
5026
+ const r = P._getSnapshot(o), c = (Ft = o.originY) != null ? Ft : "top", d = o.getPointByOrigin("center", c), l = {
5016
5027
  originY: c,
5017
5028
  x: d.x,
5018
5029
  y: d.y
5019
- }, kt = e, {
5030
+ }, Yt = e, {
5020
5031
  text: u,
5021
- fontFamily: f,
5022
- fontSize: g,
5023
- bold: p,
5024
- italic: m,
5025
- underline: v,
5026
- uppercase: w,
5027
- strikethrough: A,
5028
- align: y,
5029
- color: b,
5030
- strokeColor: j,
5031
- strokeWidth: C,
5032
- opacity: S,
5033
- backgroundColor: T,
5034
- backgroundOpacity: M,
5035
- paddingTop: I,
5036
- paddingRight: E,
5037
- paddingBottom: z,
5038
- paddingLeft: x,
5039
- radiusTopLeft: N,
5040
- radiusTopRight: Y,
5041
- radiusBottomRight: V,
5042
- radiusBottomLeft: q
5043
- } = kt, H = pt(kt, [
5032
+ autoExpand: f,
5033
+ fontFamily: g,
5034
+ fontSize: p,
5035
+ bold: m,
5036
+ italic: v,
5037
+ underline: w,
5038
+ uppercase: A,
5039
+ strikethrough: y,
5040
+ align: M,
5041
+ color: j,
5042
+ strokeColor: C,
5043
+ strokeWidth: S,
5044
+ opacity: E,
5045
+ backgroundColor: b,
5046
+ backgroundOpacity: I,
5047
+ paddingTop: T,
5048
+ paddingRight: _,
5049
+ paddingBottom: B,
5050
+ paddingLeft: N,
5051
+ radiusTopLeft: H,
5052
+ radiusTopRight: Z,
5053
+ radiusBottomRight: $,
5054
+ radiusBottomLeft: Y
5055
+ } = Yt, st = gt(Yt, [
5044
5056
  "text",
5057
+ "autoExpand",
5045
5058
  "fontFamily",
5046
5059
  "fontSize",
5047
5060
  "bold",
@@ -5064,58 +5077,60 @@ class k {
5064
5077
  "radiusTopRight",
5065
5078
  "radiusBottomRight",
5066
5079
  "radiusBottomLeft"
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));
5071
- }
5072
- if (m !== void 0) {
5073
- const K = m ? "italic" : "normal";
5074
- O && (G.fontStyle = K), ot && (R.fontStyle = K, Q && (F.fontStyle = K));
5075
- }
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
5080
+ ]), R = z({}, st), O = rn({ textbox: o }), it = O ? P._expandRangeToFullLines({ textbox: o, range: O }) : null, X = {}, V = {}, k = {}, Pt = dn({ textbox: o, range: O }), Q = !O || Pt, nt = !O;
5081
+ if (g !== void 0 && (it && (V.fontFamily = g), Q && (R.fontFamily = g, nt && (k.fontFamily = g))), p !== void 0 && (it && (V.fontSize = p), Q && (R.fontSize = p, nt && (k.fontSize = p))), m !== void 0) {
5082
+ const q = m ? "bold" : "normal";
5083
+ O && (X.fontWeight = q), Q && (R.fontWeight = q, nt && (k.fontWeight = q));
5084
+ }
5085
+ if (v !== void 0) {
5086
+ const q = v ? "italic" : "normal";
5087
+ O && (X.fontStyle = q), Q && (R.fontStyle = q, nt && (k.fontStyle = q));
5088
+ }
5089
+ if (w !== void 0 && (O && (X.underline = w), Q && (R.underline = w, nt && (k.underline = w))), y !== void 0 && (O && (X.linethrough = y), Q && (R.linethrough = y, nt && (k.linethrough = y))), M !== void 0 && (R.textAlign = M), j !== void 0 && (O && (X.fill = j), Q && (R.fill = j, nt && (k.fill = j))), C !== void 0 || S !== void 0) {
5090
+ const q = O ? Ke({ textbox: o, range: O, property: "strokeWidth" }) : void 0, Ot = O ? Ke({ textbox: o, range: O, property: "stroke" }) : void 0, Kt = (Zt = (Ht = S != null ? S : q) != null ? Ht : o.strokeWidth) != null ? Zt : 0, Lt = Je({ width: Kt }), Dt = (Vt = (Gt = C != null ? C : Ot) != null ? Gt : o.stroke) != null ? Vt : void 0, Rt = qe({
5091
+ strokeColor: Dt,
5092
+ width: Lt
5080
5093
  });
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;
5094
+ O && (X.stroke = Rt, X.strokeWidth = Lt), Q && (R.stroke = Rt, R.strokeWidth = Lt, nt && (k.stroke = Rt, k.strokeWidth = Lt));
5095
+ }
5096
+ E !== void 0 && (R.opacity = E), b !== void 0 && (R.backgroundColor = b), I !== void 0 && (R.backgroundOpacity = I), T !== void 0 && (R.paddingTop = T), _ !== void 0 && (R.paddingRight = _), B !== void 0 && (R.paddingBottom = B), N !== void 0 && (R.paddingLeft = N), H !== void 0 && (R.radiusTopLeft = H), Z !== void 0 && (R.radiusTopRight = Z), $ !== void 0 && (R.radiusBottomRight = $), Y !== void 0 && (R.radiusBottomLeft = Y);
5097
+ const Ct = (Tt = o.textCaseRaw) != null ? Tt : (Xt = o.text) != null ? Xt : "", ut = !!o.uppercase, ft = u !== void 0, rt = ft ? u != null ? u : "" : Ct, It = A != null ? A : ut, Wt = It !== ut;
5098
+ if (ft || Wt) {
5099
+ const q = It ? ve({ value: rt }) : rt;
5100
+ R.text = q, o.textCaseRaw = rt;
5101
+ } else o.textCaseRaw === void 0 && (o.textCaseRaw = Ct);
5102
+ o.uppercase = It, o.set(R);
5103
+ let yt = !1;
5091
5104
  if (O) {
5092
- const K = ge({ textbox: o, styles: G, range: O }), Et = at ? ge({ textbox: o, styles: nt, range: at }) : !1;
5093
- bt = K || Et;
5094
- } else if (Object.keys(F).length) {
5095
- const K = cn({ textbox: o });
5096
- K && (bt = ge({ textbox: o, styles: F, range: K }));
5105
+ const q = ye({ textbox: o, styles: X, range: O }), Ot = it ? ye({ textbox: o, styles: V, range: it }) : !1;
5106
+ yt = q || Ot;
5107
+ } else if (Object.keys(k).length) {
5108
+ const q = cn({ textbox: o });
5109
+ q && (yt = ye({ textbox: o, styles: k, range: q }));
5097
5110
  }
5098
- const Jt = bt && k._hasLayoutAffectingStyles({
5111
+ const ee = yt && P._hasLayoutAffectingStyles({
5099
5112
  stylesList: [
5100
- G,
5101
- nt,
5102
- F
5113
+ X,
5114
+ V,
5115
+ k
5103
5116
  ]
5104
5117
  });
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({
5118
+ yt && (o.dirty = !0), ee && (o.initDimensions(), o.dirty = !0), (b !== void 0 || I !== void 0 || T !== void 0 || _ !== void 0 || B !== void 0 || N !== void 0 || H !== void 0 || Z !== void 0 || $ !== void 0 || Y !== void 0) && (o.dirty = !0);
5119
+ const vt = P._hasLayoutAffectingStyles({
5107
5120
  stylesList: [
5108
5121
  R,
5109
- G,
5110
- nt,
5111
- F
5122
+ X,
5123
+ V,
5124
+ k
5112
5125
  ]
5113
- }), $t = !Object.prototype.hasOwnProperty.call(R, "width") && (rt || Nt || Qt);
5114
- let dt = !1;
5115
- $t && (dt = this._autoExpandTextboxWidth(o, {
5126
+ }), { autoExpand: Ut } = o, bt = f !== void 0, se = (f != null ? f : Ut) !== !1;
5127
+ bt ? o.autoExpand = f !== !1 : Ut === void 0 && (o.autoExpand = !0);
5128
+ const ne = Object.prototype.hasOwnProperty.call(R, "width"), oe = se && !ne && (ft || Wt || vt);
5129
+ let Et = !1;
5130
+ oe && (Et = this._autoExpandTextboxWidth(o, {
5116
5131
  anchor: l
5117
- }), dt && (o.dirty = !0)), (dt ? !1 : k._roundTextboxDimensions({ textbox: o })) && (o.dirty = !0), o.setCoords(), n || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
5118
- const te = k._getSnapshot(o);
5132
+ }), Et && (o.dirty = !0)), (Et ? !1 : P._roundTextboxDimensions({ textbox: o })) && (o.dirty = !0), o.setCoords(), n || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
5133
+ const ie = P._getSnapshot(o);
5119
5134
  return a.fire("editor:text-updated", {
5120
5135
  textbox: o,
5121
5136
  target: t,
@@ -5126,9 +5141,9 @@ class k {
5126
5141
  },
5127
5142
  updates: R,
5128
5143
  before: r,
5129
- after: te,
5144
+ after: ie,
5130
5145
  selectionRange: O != null ? O : void 0,
5131
- selectionStyles: O && Object.keys(G).length ? G : void 0
5146
+ selectionStyles: O && Object.keys(X).length ? X : void 0
5132
5147
  }), o;
5133
5148
  }
5134
5149
  /**
@@ -5136,20 +5151,20 @@ class k {
5136
5151
  */
5137
5152
  destroy() {
5138
5153
  const { canvas: t } = this;
5139
- t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", k._handleObjectResizing), t.off("object:modified", this._handleObjectModified), t.off("text:editing:exited", this._handleTextEditingExited), t.off("text:editing:entered", this._handleTextEditingEntered), t.off("text:changed", this._handleTextChanged);
5154
+ t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", P._handleObjectResizing), t.off("object:modified", this._handleObjectModified), t.off("text:editing:exited", this._handleTextEditingExited), t.off("text:editing:entered", this._handleTextEditingEntered), t.off("text:changed", this._handleTextChanged);
5140
5155
  }
5141
5156
  /**
5142
5157
  * Возвращает активный текст или ищет по id.
5143
5158
  */
5144
5159
  _resolveTextObject(t) {
5145
- if (t instanceof it) return t;
5160
+ if (t instanceof at) return t;
5146
5161
  const { canvas: e } = this;
5147
5162
  if (!t) {
5148
5163
  const s = e.getActiveObject();
5149
- return k._isTextbox(s) ? s : null;
5164
+ return P._isTextbox(s) ? s : null;
5150
5165
  }
5151
5166
  if (typeof t == "string") {
5152
- const s = e.getObjects().find((n) => k._isTextbox(n) && n.id === t);
5167
+ const s = e.getObjects().find((n) => P._isTextbox(n) && n.id === t);
5153
5168
  return s != null ? s : null;
5154
5169
  }
5155
5170
  return null;
@@ -5158,21 +5173,21 @@ class k {
5158
5173
  * Проверяет, является ли объект текстовым блоком редактора.
5159
5174
  */
5160
5175
  static _isTextbox(t) {
5161
- return !!t && t instanceof it;
5176
+ return !!t && t instanceof at;
5162
5177
  }
5163
5178
  /**
5164
5179
  * Вешает обработчики событий Fabric для работы с текстом.
5165
5180
  */
5166
5181
  _bindEvents() {
5167
5182
  const { canvas: t } = this;
5168
- t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", k._handleObjectResizing), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", this._handleTextChanged);
5183
+ t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", P._handleObjectResizing), t.on("object:modified", this._handleObjectModified), t.on("text:editing:entered", this._handleTextEditingEntered), t.on("text:editing:exited", this._handleTextEditingExited), t.on("text:changed", this._handleTextChanged);
5169
5184
  }
5170
5185
  /**
5171
5186
  * Автоматически увеличивает ширину текстового объекта до ширины текста,
5172
5187
  * но не шире монтажной области, и удерживает объект в её пределах.
5173
5188
  */
5174
5189
  _autoExpandTextboxWidth(t, { anchor: e } = {}) {
5175
- var C, S, T, M, I, E, z, x, N, Y, V, q, H;
5190
+ var C, S, E, b, I, T, _, B, N, H, Z, $, Y;
5176
5191
  const { montageArea: s } = this.editor;
5177
5192
  if (!s) return !1;
5178
5193
  const n = typeof t.text == "string" ? t.text : "";
@@ -5180,7 +5195,7 @@ class k {
5180
5195
  s.setCoords();
5181
5196
  const o = s.getBoundingRect(!1, !0), i = (C = o.width) != null ? C : 0;
5182
5197
  if (!Number.isFinite(i) || i <= 0) return !1;
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(
5198
+ const a = e != null ? e : (S = this.editingAnchorState) == null ? void 0 : S.get(t), r = (b = (E = a == null ? void 0 : a.originY) != null ? E : t.originY) != null ? b : "top", c = Math.abs((I = t.scaleX) != null ? I : 1) || 1, d = (T = t.paddingLeft) != null ? T : 0, l = (_ = t.paddingRight) != null ? _ : 0, u = (B = t.strokeWidth) != null ? B : 0, f = Math.max(
5184
5199
  1,
5185
5200
  i / c - d - l - u
5186
5201
  );
@@ -5190,17 +5205,17 @@ class k {
5190
5205
  let p = !1;
5191
5206
  Math.abs(((N = t.width) != null ? N : 0) - f) > tt && (t.set({ width: f }), p = !0), t.initDimensions();
5192
5207
  const { textLines: m } = t, v = Array.isArray(m) && m.length > g, w = Math.ceil(
5193
- k._getLongestLineWidth({ textbox: t, text: n })
5194
- ), A = Math.min((Y = t.minWidth) != null ? Y : 1, f);
5208
+ P._getLongestLineWidth({ textbox: t, text: n })
5209
+ ), A = Math.min((H = t.minWidth) != null ? H : 1, f);
5195
5210
  let y = Math.min(
5196
5211
  f,
5197
5212
  Math.max(w, A)
5198
5213
  );
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);
5200
- const j = k._clampTextboxToMontage({
5214
+ v && (y = f), Math.abs(((Z = t.width) != null ? Z : 0) - y) > tt && (t.set({ width: y }), t.initDimensions(), p = !0), P._roundTextboxDimensions({ textbox: t }) && (p = !0), a && (t.setPositionByOrigin(new et(a.x, a.y), "center", r), p = !0);
5215
+ const j = P._clampTextboxToMontage({
5201
5216
  textbox: t,
5202
- montageLeft: (q = o.left) != null ? q : 0,
5203
- montageRight: ((H = o.left) != null ? H : 0) + i
5217
+ montageLeft: ($ = o.left) != null ? $ : 0,
5218
+ montageRight: ((Y = o.left) != null ? Y : 0) + i
5204
5219
  });
5205
5220
  return p || j;
5206
5221
  }
@@ -5245,7 +5260,7 @@ class k {
5245
5260
  static _handleObjectResizing(t) {
5246
5261
  var l, u, f, g, p, m;
5247
5262
  const { target: e, transform: s } = t;
5248
- if (!k._isTextbox(e)) return;
5263
+ if (!P._isTextbox(e)) return;
5249
5264
  const {
5250
5265
  paddingLeft: n = 0,
5251
5266
  paddingRight: o = 0
@@ -5256,7 +5271,7 @@ class k {
5256
5271
  e.set({ width: r });
5257
5272
  const c = (u = e.width) != null ? u : 0, d = a - c;
5258
5273
  if (d !== 0 && s && s.corner === "ml") {
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;
5274
+ const w = ((f = e.angle) != null ? f : 0) * Math.PI / 180, A = Math.cos(w), y = Math.sin(w), M = (g = e.scaleX) != null ? g : 1, j = d * M;
5260
5275
  e.set({
5261
5276
  left: ((p = e.left) != null ? p : 0) + j * A,
5262
5277
  top: ((m = e.top) != null ? m : 0) + j * y
@@ -5291,7 +5306,7 @@ class k {
5291
5306
  textbox: t,
5292
5307
  range: e
5293
5308
  }) {
5294
- const s = k._getLineRanges({ textbox: t });
5309
+ const s = P._getLineRanges({ textbox: t });
5295
5310
  if (!s.length) return e;
5296
5311
  let { start: n } = e, { end: o } = e;
5297
5312
  return s.forEach(({ start: i, end: a }) => {
@@ -5376,10 +5391,10 @@ class k {
5376
5391
  static _roundTextboxDimensions({
5377
5392
  textbox: t
5378
5393
  }) {
5379
- const { width: e, height: s, calcTextWidth: n, calcTextHeight: o } = t, i = typeof n == "function" ? n.call(t) : void 0, a = typeof o == "function" ? o.call(t) : void 0, r = k._resolveDimension({
5394
+ const { width: e, height: s, calcTextWidth: n, calcTextHeight: o } = t, i = typeof n == "function" ? n.call(t) : void 0, a = typeof o == "function" ? o.call(t) : void 0, r = P._resolveDimension({
5380
5395
  rawValue: e,
5381
5396
  calculatedValue: i
5382
- }), c = k._resolveDimension({
5397
+ }), c = P._resolveDimension({
5383
5398
  rawValue: s,
5384
5399
  calculatedValue: a
5385
5400
  }), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
@@ -5393,81 +5408,83 @@ class k {
5393
5408
  snapshot: R,
5394
5409
  entries: O
5395
5410
  }) => {
5396
- Object.entries(O).forEach(([at, G]) => {
5397
- G != null && (R[at] = G);
5411
+ Object.entries(O).forEach(([it, X]) => {
5412
+ X != null && (R[it] = X);
5398
5413
  });
5399
5414
  }, {
5400
5415
  id: s,
5401
5416
  text: n,
5402
5417
  textCaseRaw: o,
5403
5418
  uppercase: i,
5404
- fontFamily: a,
5405
- fontSize: r,
5406
- fontWeight: c,
5407
- fontStyle: d,
5408
- underline: l,
5409
- linethrough: u,
5410
- textAlign: f,
5411
- fill: g,
5412
- stroke: p,
5413
- strokeWidth: m,
5414
- opacity: v,
5415
- backgroundColor: w,
5416
- backgroundOpacity: A,
5417
- paddingTop: y,
5418
- paddingRight: b,
5419
- paddingBottom: j,
5420
- paddingLeft: C,
5421
- radiusTopLeft: S,
5422
- radiusTopRight: T,
5423
- radiusBottomRight: M,
5424
- radiusBottomLeft: I,
5425
- left: E,
5426
- top: z,
5427
- width: x,
5428
- height: N,
5429
- angle: Y,
5430
- scaleX: V,
5431
- scaleY: q
5432
- } = t, H = {
5419
+ autoExpand: a,
5420
+ fontFamily: r,
5421
+ fontSize: c,
5422
+ fontWeight: d,
5423
+ fontStyle: l,
5424
+ underline: u,
5425
+ linethrough: f,
5426
+ textAlign: g,
5427
+ fill: p,
5428
+ stroke: m,
5429
+ strokeWidth: v,
5430
+ opacity: w,
5431
+ backgroundColor: A,
5432
+ backgroundOpacity: y,
5433
+ paddingTop: M,
5434
+ paddingRight: j,
5435
+ paddingBottom: C,
5436
+ paddingLeft: S,
5437
+ radiusTopLeft: E,
5438
+ radiusTopRight: b,
5439
+ radiusBottomRight: I,
5440
+ radiusBottomLeft: T,
5441
+ left: _,
5442
+ top: B,
5443
+ width: N,
5444
+ height: H,
5445
+ angle: Z,
5446
+ scaleX: $,
5447
+ scaleY: Y
5448
+ } = t, st = {
5433
5449
  id: s,
5434
5450
  uppercase: !!i,
5435
- textAlign: f
5451
+ textAlign: g
5436
5452
  };
5437
5453
  return e({
5438
- snapshot: H,
5454
+ snapshot: st,
5439
5455
  entries: {
5440
5456
  text: n,
5441
5457
  textCaseRaw: o,
5442
- fontFamily: a,
5443
- fontSize: r,
5444
- fontWeight: c,
5445
- fontStyle: d,
5446
- underline: l,
5447
- linethrough: u,
5448
- fill: g,
5449
- stroke: p,
5450
- strokeWidth: m,
5451
- opacity: v,
5452
- backgroundColor: w,
5453
- backgroundOpacity: A,
5454
- paddingTop: y,
5455
- paddingRight: b,
5456
- paddingBottom: j,
5457
- paddingLeft: C,
5458
- radiusTopLeft: S,
5459
- radiusTopRight: T,
5460
- radiusBottomRight: M,
5461
- radiusBottomLeft: I,
5462
- left: E,
5463
- top: z,
5464
- width: x,
5465
- height: N,
5466
- angle: Y,
5467
- scaleX: V,
5468
- scaleY: q
5458
+ autoExpand: a,
5459
+ fontFamily: r,
5460
+ fontSize: c,
5461
+ fontWeight: d,
5462
+ fontStyle: l,
5463
+ underline: u,
5464
+ linethrough: f,
5465
+ fill: p,
5466
+ stroke: m,
5467
+ strokeWidth: v,
5468
+ opacity: w,
5469
+ backgroundColor: A,
5470
+ backgroundOpacity: y,
5471
+ paddingTop: M,
5472
+ paddingRight: j,
5473
+ paddingBottom: C,
5474
+ paddingLeft: S,
5475
+ radiusTopLeft: E,
5476
+ radiusTopRight: b,
5477
+ radiusBottomRight: I,
5478
+ radiusBottomLeft: T,
5479
+ left: _,
5480
+ top: B,
5481
+ width: N,
5482
+ height: H,
5483
+ angle: Z,
5484
+ scaleX: $,
5485
+ scaleY: Y
5469
5486
  }
5470
- }), H;
5487
+ }), st;
5471
5488
  }
5472
5489
  /**
5473
5490
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -5480,7 +5497,7 @@ class k {
5480
5497
  const J = ({
5481
5498
  value: h,
5482
5499
  fallback: t = 0
5483
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, ae = ({
5500
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, de = ({
5484
5501
  value: h,
5485
5502
  dimension: t,
5486
5503
  useRelativePositions: e
@@ -5497,22 +5514,22 @@ const J = ({
5497
5514
  const o = h;
5498
5515
  if (typeof o[n.x] == "number" && typeof o[n.y] == "number")
5499
5516
  return {
5500
- x: ae({
5517
+ x: de({
5501
5518
  value: o[n.x],
5502
5519
  dimension: t,
5503
5520
  useRelativePositions: s
5504
5521
  }),
5505
- y: ae({
5522
+ y: de({
5506
5523
  value: o[n.y],
5507
5524
  dimension: e,
5508
5525
  useRelativePositions: s
5509
5526
  })
5510
5527
  };
5511
- const { left: a, top: r, width: c, height: d } = h, l = ae({
5528
+ const { left: a, top: r, width: c, height: d } = h, l = de({
5512
5529
  value: a,
5513
5530
  dimension: t,
5514
5531
  useRelativePositions: s
5515
- }), u = ae({
5532
+ }), u = de({
5516
5533
  value: r,
5517
5534
  dimension: e,
5518
5535
  useRelativePositions: s
@@ -5550,7 +5567,7 @@ const J = ({
5550
5567
  } catch (s) {
5551
5568
  return null;
5552
5569
  }
5553
- }, yt = ({
5570
+ }, mt = ({
5554
5571
  object: h
5555
5572
  }) => {
5556
5573
  if (!h) return null;
@@ -5614,8 +5631,8 @@ const J = ({
5614
5631
  };
5615
5632
  }
5616
5633
  return null;
5617
- }, Xt = "_templateCenterX", me = "_templateCenterY", re = "_templateAnchorX", ye = "_templateAnchorY";
5618
- class _ {
5634
+ }, Qt = "_templateCenterX", be = "_templateCenterY", le = "_templateAnchorX", Me = "_templateAnchorY";
5635
+ class x {
5619
5636
  constructor({ editor: t }) {
5620
5637
  this.editor = t;
5621
5638
  }
@@ -5634,28 +5651,28 @@ class _ {
5634
5651
  montageArea: i,
5635
5652
  errorManager: a,
5636
5653
  backgroundManager: r
5637
- } = this.editor, c = o.getActiveObject(), d = _._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = n && l ? [l] : [], f = [...d, ...u];
5654
+ } = this.editor, c = o.getActiveObject(), d = x._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = n && l ? [l] : [], f = [...d, ...u];
5638
5655
  if (!f.length)
5639
5656
  return a.emitWarning({
5640
5657
  origin: "TemplateManager",
5641
5658
  method: "serializeSelection",
5642
- code: At.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5659
+ code: St.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5643
5660
  message: "Нет объектов для сериализации шаблона"
5644
5661
  }), null;
5645
- const g = _._getBounds(i), p = _._getMontageSize({ montageArea: i, bounds: g }), m = p.width, v = p.height, w = f.map((b) => _._serializeObject({
5646
- object: b,
5662
+ const g = x._getBounds(i), p = x._getMontageSize({ montageArea: i, bounds: g }), m = p.width, v = p.height, w = f.map((M) => x._serializeObject({
5663
+ object: M,
5647
5664
  bounds: g,
5648
5665
  baseWidth: m,
5649
5666
  baseHeight: v,
5650
5667
  montageArea: i != null ? i : null
5651
- })), A = St(B({}, s), {
5668
+ })), A = wt(z({}, s), {
5652
5669
  baseWidth: m,
5653
5670
  baseHeight: v,
5654
5671
  positionsNormalized: !0,
5655
5672
  previewId: e != null ? e : s.previewId
5656
5673
  });
5657
5674
  return {
5658
- id: t != null ? t : `template-${X()}`,
5675
+ id: t != null ? t : `template-${K()}`,
5659
5676
  meta: A,
5660
5677
  objects: w
5661
5678
  };
@@ -5667,7 +5684,7 @@ class _ {
5667
5684
  * @param options.data - данные для заполнения текстов по customData.templateField
5668
5685
  */
5669
5686
  applyTemplate(s) {
5670
- return P(this, arguments, function* ({
5687
+ return W(this, arguments, function* ({
5671
5688
  template: t,
5672
5689
  data: e
5673
5690
  }) {
@@ -5682,39 +5699,39 @@ class _ {
5682
5699
  return a.emitWarning({
5683
5700
  origin: "TemplateManager",
5684
5701
  method: "applyTemplate",
5685
- code: At.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5702
+ code: St.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5686
5703
  message: "Шаблон не содержит объектов"
5687
5704
  }), null;
5688
- const u = _._getBounds(o);
5705
+ const u = x._getBounds(o);
5689
5706
  if (!u)
5690
5707
  return a.emitWarning({
5691
5708
  origin: "TemplateManager",
5692
5709
  method: "applyTemplate",
5693
- code: At.TEMPLATE_MANAGER.INVALID_TARGET,
5710
+ code: St.TEMPLATE_MANAGER.INVALID_TARGET,
5694
5711
  message: "Не удалось определить границы монтажной области"
5695
5712
  }), null;
5696
- const f = _._getMontageSize({ montageArea: o, bounds: u }), g = _._normalizeMeta({ meta: d, fallback: f }), p = _._calculateScale({ meta: g, target: f }), m = !!g.positionsNormalized;
5713
+ const f = x._getMontageSize({ montageArea: o, bounds: u }), g = x._normalizeMeta({ meta: d, fallback: f }), p = x._calculateScale({ meta: g, target: f }), m = !!g.positionsNormalized;
5697
5714
  let v = !1, w = !1;
5698
5715
  i.suspendHistory();
5699
5716
  try {
5700
- const A = yield _._enlivenObjects(c);
5717
+ const A = yield x._enlivenObjects(c);
5701
5718
  if (!A.length)
5702
5719
  return a.emitWarning({
5703
5720
  origin: "TemplateManager",
5704
5721
  method: "applyTemplate",
5705
- code: At.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5722
+ code: St.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5706
5723
  message: "Не удалось создать объекты шаблона"
5707
5724
  }), null;
5708
- const { backgroundObject: y, contentObjects: b } = _._extractBackgroundObject(A);
5709
- y && (w = yield _._applyBackgroundFromObject({
5725
+ const { backgroundObject: y, contentObjects: M } = x._extractBackgroundObject(A);
5726
+ y && (w = yield x._applyBackgroundFromObject({
5710
5727
  backgroundObject: y,
5711
5728
  backgroundManager: r,
5712
5729
  errorManager: a
5713
5730
  }));
5714
- const j = b.map((C) => (this._adaptTextboxWidth({
5731
+ const j = M.map((C) => (this._adaptTextboxWidth({
5715
5732
  object: C,
5716
5733
  baseWidth: g.baseWidth
5717
- }), _._transformObject({
5734
+ }), x._transformObject({
5718
5735
  object: C,
5719
5736
  scale: p,
5720
5737
  bounds: u,
@@ -5724,10 +5741,10 @@ class _ {
5724
5741
  montageArea: o,
5725
5742
  useRelativePositions: m
5726
5743
  }), C.set({
5727
- id: `${C.type}-${X()}`,
5744
+ id: `${C.type}-${K()}`,
5728
5745
  evented: !0
5729
5746
  }), 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", {
5747
+ return !j.length && !w ? null : (v = j.length > 0 || w, j.length && x._activateObjects({ canvas: n, objects: j }), n.requestRenderAll(), n.fire("editor:template-applied", {
5731
5748
  template: t,
5732
5749
  objects: j,
5733
5750
  bounds: u
@@ -5736,7 +5753,7 @@ class _ {
5736
5753
  return a.emitError({
5737
5754
  origin: "TemplateManager",
5738
5755
  method: "applyTemplate",
5739
- code: At.TEMPLATE_MANAGER.APPLY_FAILED,
5756
+ code: St.TEMPLATE_MANAGER.APPLY_FAILED,
5740
5757
  message: "Ошибка применения шаблона",
5741
5758
  data: {
5742
5759
  templateId: l,
@@ -5752,7 +5769,7 @@ class _ {
5752
5769
  * Подготавливает объекты для сериализации.
5753
5770
  */
5754
5771
  static _collectObjects(t) {
5755
- return t ? t instanceof U ? t.getObjects() : [t] : [];
5772
+ return t ? t instanceof F ? t.getObjects() : [t] : [];
5756
5773
  }
5757
5774
  /**
5758
5775
  * Возвращает габариты объекта.
@@ -5776,15 +5793,15 @@ class _ {
5776
5793
  * Превращает plain-описание объектов в Fabric объекты.
5777
5794
  */
5778
5795
  static _enlivenObjects(t) {
5779
- return P(this, null, function* () {
5780
- return (yield Promise.all(t.map((s) => P(null, null, function* () {
5781
- if (_._hasSerializedSvgMarkup(s)) {
5782
- const i = yield _._reviveSvgObject(s);
5796
+ return W(this, null, function* () {
5797
+ return (yield Promise.all(t.map((s) => W(null, null, function* () {
5798
+ if (x._hasSerializedSvgMarkup(s)) {
5799
+ const i = yield x._reviveSvgObject(s);
5783
5800
  if (i)
5784
- return _._restoreImageScale({ revived: i, serialized: s }), i;
5801
+ return x._restoreImageScale({ revived: i, serialized: s }), i;
5785
5802
  }
5786
- const n = yield ft.enlivenObjects([s]), o = n == null ? void 0 : n[0];
5787
- return o ? (_._restoreImageScale({ revived: o, serialized: s }), o) : null;
5803
+ const n = yield ht.enlivenObjects([s]), o = n == null ? void 0 : n[0];
5804
+ return o ? (x._restoreImageScale({ revived: o, serialized: s }), o) : null;
5788
5805
  })))).filter((s) => !!s);
5789
5806
  });
5790
5807
  }
@@ -5812,22 +5829,22 @@ class _ {
5812
5829
  naturalHeight: 0,
5813
5830
  width: 0,
5814
5831
  height: 0
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) {
5817
- c.set(E);
5832
+ }, 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 }), M = v * A, j = w * y, C = p > 0, S = m > 0, E = M > 0, b = j > 0, I = x._resolveImageFit({ customData: r }), T = {};
5833
+ if (C && (T.width = p), S && (T.height = m), !C || !S) {
5834
+ c.set(T);
5818
5835
  return;
5819
5836
  }
5820
5837
  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);
5838
+ const B = E ? M / p : null, N = b ? j / m : null;
5839
+ B && B > 0 && (T.scaleX = B), N && N > 0 && (T.scaleY = N), c.set(T);
5823
5840
  return;
5824
5841
  }
5825
- if (!T || !M) {
5826
- c.set(E);
5842
+ if (!E || !b) {
5843
+ c.set(T);
5827
5844
  return;
5828
5845
  }
5829
- const z = Math.min(b / p, j / m);
5830
- Number.isFinite(z) && z > 0 && (E.scaleX = z, E.scaleY = z), c.set(E);
5846
+ const _ = Math.min(M / p, j / m);
5847
+ Number.isFinite(_) && _ > 0 && (T.scaleX = _, T.scaleY = _), c.set(T);
5831
5848
  }
5832
5849
  /**
5833
5850
  * Определяет режим вписывания изображения при восстановлении.
@@ -5849,12 +5866,12 @@ class _ {
5849
5866
  * Восстанавливает SVG-объект из компактного описания.
5850
5867
  */
5851
5868
  static _reviveSvgObject(t) {
5852
- return P(this, null, function* () {
5869
+ return W(this, null, function* () {
5853
5870
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5854
5871
  if (!e) return null;
5855
5872
  try {
5856
- const s = yield ys(e), n = ft.groupSVGElements(s.objects, s.options), o = yield ft.enlivenObjectEnlivables(
5857
- _._prepareSerializableProps(t)
5873
+ const s = yield ys(e), n = ht.groupSVGElements(s.objects, s.options), o = yield ht.enlivenObjectEnlivables(
5874
+ x._prepareSerializableProps(t)
5858
5875
  );
5859
5876
  return n.set(o), n.setCoords(), n;
5860
5877
  } catch (s) {
@@ -5866,7 +5883,7 @@ class _ {
5866
5883
  * Убирает технические поля сериализации, оставляя только применимые свойства.
5867
5884
  */
5868
5885
  static _prepareSerializableProps(t) {
5869
- const e = B({}, t);
5886
+ const e = z({}, t);
5870
5887
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
5871
5888
  }
5872
5889
  /**
@@ -5918,17 +5935,17 @@ class _ {
5918
5935
  baseHeight: i,
5919
5936
  useRelativePositions: r,
5920
5937
  centerKeys: {
5921
- x: Xt,
5922
- y: me
5938
+ x: Qt,
5939
+ y: be
5923
5940
  }
5924
- }), { scaleX: u, scaleY: f } = t, g = J({ value: u, fallback: 1 }), p = J({ value: f, fallback: 1 }), m = _._getPositioningBounds({
5941
+ }), { scaleX: u, scaleY: f } = t, g = J({ value: u, fallback: 1 }), p = J({ value: f, fallback: 1 }), m = x._getPositioningBounds({
5925
5942
  bounds: s,
5926
5943
  baseWidth: o,
5927
5944
  baseHeight: i,
5928
5945
  scale: e,
5929
5946
  useRelativePositions: r,
5930
- anchorX: _._resolveAnchor(c, re),
5931
- anchorY: _._resolveAnchor(c, ye)
5947
+ anchorX: x._resolveAnchor(c, le),
5948
+ anchorY: x._resolveAnchor(c, Me)
5932
5949
  }), v = hn({
5933
5950
  normalizedX: d,
5934
5951
  normalizedY: l,
@@ -5939,7 +5956,7 @@ class _ {
5939
5956
  t.set({
5940
5957
  scaleX: w,
5941
5958
  scaleY: A
5942
- }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Xt], delete c[me], delete c[re], delete c[ye];
5959
+ }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Qt], delete c[be], delete c[le], delete c[Me];
5943
5960
  }
5944
5961
  /**
5945
5962
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -5955,7 +5972,7 @@ class _ {
5955
5972
  anchorY: a
5956
5973
  }) {
5957
5974
  if (!o) return t;
5958
- const r = (e || t.width) * n, c = (s || t.height) * n, d = t.width - r, l = t.height - c, u = t.left + _._calculateAnchorOffset(i, d), f = t.top + _._calculateAnchorOffset(a, l);
5975
+ const r = (e || t.width) * n, c = (s || t.height) * n, d = t.width - r, l = t.height - c, u = t.left + x._calculateAnchorOffset(i, d), f = t.top + x._calculateAnchorOffset(a, l);
5959
5976
  return {
5960
5977
  left: u,
5961
5978
  top: f,
@@ -5986,8 +6003,8 @@ class _ {
5986
6003
  meta: t,
5987
6004
  fallback: e
5988
6005
  }) {
5989
- const { width: s, height: n } = e, r = t || {}, { baseWidth: o = s, baseHeight: i = n } = r, a = pt(r, ["baseWidth", "baseHeight"]);
5990
- return B({
6006
+ const { width: s, height: n } = e, r = t || {}, { baseWidth: o = s, baseHeight: i = n } = r, a = gt(r, ["baseWidth", "baseHeight"]);
6007
+ return z({
5991
6008
  baseWidth: o,
5992
6009
  baseHeight: i
5993
6010
  }, a);
@@ -6014,7 +6031,7 @@ class _ {
6014
6031
  t.setActiveObject(e[0]);
6015
6032
  return;
6016
6033
  }
6017
- const s = new U(e, { canvas: t });
6034
+ const s = new F(e, { canvas: t });
6018
6035
  t.setActiveObject(s);
6019
6036
  }
6020
6037
  /**
@@ -6024,12 +6041,12 @@ class _ {
6024
6041
  object: t,
6025
6042
  baseWidth: e
6026
6043
  }) {
6027
- var Y, V;
6028
- if (!(t instanceof it)) return;
6044
+ var H, Z;
6045
+ if (!(t instanceof at)) return;
6029
6046
  const s = typeof t.text == "string" ? t.text : "";
6030
6047
  if (!s) return;
6031
6048
  const n = J({
6032
- value: (V = (Y = this.editor) == null ? void 0 : Y.montageArea) == null ? void 0 : V.width,
6049
+ value: (Z = (H = this.editor) == null ? void 0 : H.montageArea) == null ? void 0 : Z.width,
6033
6050
  fallback: 0
6034
6051
  }), {
6035
6052
  width: o = 0,
@@ -6038,16 +6055,16 @@ class _ {
6038
6055
  } = 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;
6039
6056
  if (!n || !g || !r) return;
6040
6057
  t.setCoords();
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();
6058
+ const A = t, y = A[Qt], M = typeof y == "number" ? y : null, j = x._resolveAnchor(A, le), C = w / r, S = M !== null ? M - C / 2 : null, E = M !== null ? M + C / 2 : null, b = t.getCenterPoint();
6042
6059
  t.set("width", n), t.initDimensions();
6043
- const I = _._getLongestLineWidth({
6060
+ const I = x._getLongestLineWidth({
6044
6061
  textbox: t,
6045
6062
  text: s
6046
- }), E = I > g ? I + 1 : g;
6047
- t.set("width", E), t.initDimensions(), t.setPositionByOrigin(M, "center", "center"), t.setCoords();
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);
6063
+ }), T = I > g ? I + 1 : g;
6064
+ t.set("width", T), t.initDimensions(), t.setPositionByOrigin(b, "center", "center"), t.setCoords();
6065
+ const B = (T * u + m + v + f) / r;
6066
+ let N = M;
6067
+ j === "start" && S !== null ? N = Math.max(0, S) + B / 2 : j === "end" && E !== null && (N = Math.min(1, E) - B / 2), typeof N == "number" && (A[Qt] = N);
6051
6068
  }
6052
6069
  /**
6053
6070
  * Возвращает ширину самой длинной строки текстового объекта.
@@ -6077,9 +6094,9 @@ class _ {
6077
6094
  baseHeight: n,
6078
6095
  montageArea: o
6079
6096
  }) {
6080
- const i = t.toDatalessObject([...ns]);
6081
- if (_._isSvgObject(t)) {
6082
- const y = _._extractSvgMarkup(t);
6097
+ const i = t.toDatalessObject([...os]);
6098
+ if (x._isSvgObject(t)) {
6099
+ const y = x._extractSvgMarkup(t);
6083
6100
  y && (i.svgMarkup = y, delete i.objects, delete i.path);
6084
6101
  }
6085
6102
  if (!e) return i;
@@ -6099,11 +6116,11 @@ class _ {
6099
6116
  y: (y.y - r) / f
6100
6117
  };
6101
6118
  })(), 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({
6119
+ return i[Qt] = p.x, i[be] = p.y, i[le] = x._detectAnchor({
6103
6120
  center: p.x,
6104
6121
  start: m,
6105
6122
  end: w
6106
- }), i[ye] = _._detectAnchor({
6123
+ }), i[Me] = x._detectAnchor({
6107
6124
  center: p.y,
6108
6125
  start: v,
6109
6126
  end: A
@@ -6123,13 +6140,13 @@ class _ {
6123
6140
  * Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
6124
6141
  */
6125
6142
  static _applyBackgroundFromObject(n) {
6126
- return P(this, arguments, function* ({
6143
+ return W(this, arguments, function* ({
6127
6144
  backgroundObject: t,
6128
6145
  backgroundManager: e,
6129
6146
  errorManager: s
6130
6147
  }) {
6131
6148
  try {
6132
- const { fill: o, customData: i } = t, { backgroundType: a } = t, r = _._cloneCustomData(i);
6149
+ const { fill: o, customData: i } = t, { backgroundType: a } = t, r = x._cloneCustomData(i);
6133
6150
  if (a === "color" && typeof o == "string")
6134
6151
  return e.setColorBackground({
6135
6152
  color: o,
@@ -6148,7 +6165,7 @@ class _ {
6148
6165
  }), !0;
6149
6166
  }
6150
6167
  if (a === "image") {
6151
- const c = _._getImageSource(t);
6168
+ const c = x._getImageSource(t);
6152
6169
  if (c)
6153
6170
  return yield e.setImageBackground({
6154
6171
  imageSource: c,
@@ -6161,7 +6178,7 @@ class _ {
6161
6178
  s.emitWarning({
6162
6179
  origin: "TemplateManager",
6163
6180
  method: "applyTemplate",
6164
- code: At.TEMPLATE_MANAGER.APPLY_FAILED,
6181
+ code: St.TEMPLATE_MANAGER.APPLY_FAILED,
6165
6182
  message: "Не удалось применить фон из шаблона",
6166
6183
  data: o
6167
6184
  });
@@ -6191,7 +6208,7 @@ class _ {
6191
6208
  */
6192
6209
  static _cloneCustomData(t) {
6193
6210
  if (!(!t || typeof t != "object"))
6194
- return B({}, t);
6211
+ return z({}, t);
6195
6212
  }
6196
6213
  /**
6197
6214
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -6217,10 +6234,10 @@ class _ {
6217
6234
  */
6218
6235
  // eslint-disable-next-line class-methods-use-this
6219
6236
  enlivenObjectEnlivables(t) {
6220
- return ft.enlivenObjectEnlivables(t);
6237
+ return ht.enlivenObjectEnlivables(t);
6221
6238
  }
6222
6239
  }
6223
- const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6240
+ const pn = 5, is = "#3D8BF4", Ie = 1, he = 1, Qe = ({
6224
6241
  anchors: h,
6225
6242
  positions: t,
6226
6243
  threshold: e
@@ -6240,11 +6257,11 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6240
6257
  threshold: t,
6241
6258
  anchors: e
6242
6259
  }) => {
6243
- const { left: s, right: n, centerX: o, top: i, bottom: a, centerY: r } = h, c = Je({
6260
+ const { left: s, right: n, centerX: o, top: i, bottom: a, centerY: r } = h, c = Qe({
6244
6261
  anchors: e.vertical,
6245
6262
  positions: [s, o, n],
6246
6263
  threshold: t
6247
- }), d = Je({
6264
+ }), d = Qe({
6248
6265
  anchors: e.horizontal,
6249
6266
  positions: [i, r, a],
6250
6267
  threshold: t
@@ -6260,7 +6277,7 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6260
6277
  deltaY: d.delta,
6261
6278
  guides: l
6262
6279
  };
6263
- }, is = ({
6280
+ }, as = ({
6264
6281
  activeBounds: h,
6265
6282
  aligned: t,
6266
6283
  threshold: e,
@@ -6351,47 +6368,47 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6351
6368
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
6352
6369
  { bounds: h, isActive: !0 }
6353
6370
  ];
6354
- d.sort((y, b) => y.bounds.top - b.bounds.top);
6371
+ d.sort((y, M) => y.bounds.top - M.bounds.top);
6355
6372
  const l = d.findIndex((y) => y.isActive);
6356
6373
  if (l === -1)
6357
6374
  return { delta: 0, guide: null };
6358
6375
  const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
6359
6376
  if (u && f) {
6360
- const { bounds: y } = u, { bounds: b } = f, j = y.top - b.bottom, C = o - y.bottom, S = Math.abs(C - j);
6377
+ const { bounds: y } = u, { bounds: M } = f, j = y.top - M.bottom, C = o - y.bottom, S = Math.abs(C - j);
6361
6378
  if (S <= e) {
6362
- const T = j - C, M = o + T, I = {
6379
+ const E = j - C, b = o + E, I = {
6363
6380
  type: "vertical",
6364
6381
  axis: n,
6365
- refStart: b.bottom,
6382
+ refStart: M.bottom,
6366
6383
  refEnd: y.top,
6367
6384
  activeStart: y.bottom,
6368
- activeEnd: M,
6385
+ activeEnd: b,
6369
6386
  distance: j
6370
6387
  };
6371
- m.push({ delta: T, guide: I, diff: S });
6388
+ m.push({ delta: E, guide: I, diff: S });
6372
6389
  }
6373
6390
  }
6374
6391
  if (g && p) {
6375
- const { bounds: y } = g, { bounds: b } = p, j = b.top - y.bottom, C = y.top - i, S = Math.abs(C - j);
6392
+ const { bounds: y } = g, { bounds: M } = p, j = M.top - y.bottom, C = y.top - i, S = Math.abs(C - j);
6376
6393
  if (S <= e) {
6377
- const T = C - j, M = i + T, I = {
6394
+ const E = C - j, b = i + E, I = {
6378
6395
  type: "vertical",
6379
6396
  axis: n,
6380
6397
  refStart: y.bottom,
6381
- refEnd: b.top,
6382
- activeStart: M,
6398
+ refEnd: M.top,
6399
+ activeStart: b,
6383
6400
  activeEnd: y.top,
6384
6401
  distance: j
6385
6402
  };
6386
- m.push({ delta: T, guide: I, diff: S });
6403
+ m.push({ delta: E, guide: I, diff: S });
6387
6404
  }
6388
6405
  }
6389
6406
  if (u && g) {
6390
- const { bounds: y } = u, { bounds: b } = g, C = b.top - y.bottom - v;
6407
+ const { bounds: y } = u, { bounds: M } = g, C = M.top - y.bottom - v;
6391
6408
  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 = {
6409
+ const S = C / 2, E = o - y.bottom, b = M.top - i, I = Math.abs(E - S), T = Math.abs(b - S), _ = Math.max(I, T);
6410
+ if (_ <= e) {
6411
+ const B = S - E, N = i + B, H = {
6395
6412
  type: "vertical",
6396
6413
  axis: n,
6397
6414
  refStart: y.bottom,
@@ -6400,11 +6417,11 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6400
6417
  activeEnd: N + S,
6401
6418
  distance: S
6402
6419
  };
6403
- m.push({ delta: x, guide: Y, diff: z });
6420
+ m.push({ delta: B, guide: H, diff: _ });
6404
6421
  }
6405
6422
  }
6406
6423
  }
6407
- const w = is({
6424
+ const w = as({
6408
6425
  activeBounds: h,
6409
6426
  aligned: c,
6410
6427
  threshold: e,
@@ -6413,7 +6430,7 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6413
6430
  });
6414
6431
  if (m.push(...w), !m.length)
6415
6432
  return { delta: 0, guide: null };
6416
- const A = m.reduce((y, b) => b.diff < y.diff ? b : y, m[0]);
6433
+ const A = m.reduce((y, M) => M.diff < y.diff ? M : y, m[0]);
6417
6434
  return {
6418
6435
  delta: A.delta,
6419
6436
  guide: A.guide
@@ -6437,47 +6454,47 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6437
6454
  ...c.map((y) => ({ bounds: y, isActive: !1 })),
6438
6455
  { bounds: h, isActive: !0 }
6439
6456
  ];
6440
- d.sort((y, b) => y.bounds.left - b.bounds.left);
6457
+ d.sort((y, M) => y.bounds.left - M.bounds.left);
6441
6458
  const l = d.findIndex((y) => y.isActive);
6442
6459
  if (l === -1)
6443
6460
  return { delta: 0, guide: null };
6444
6461
  const u = d[l - 1], f = d[l - 2], g = d[l + 1], p = d[l + 2], m = [], v = i - o;
6445
6462
  if (u && f) {
6446
- const { bounds: y } = u, { bounds: b } = f, j = y.left - b.right, C = o - y.right, S = Math.abs(C - j);
6463
+ const { bounds: y } = u, { bounds: M } = f, j = y.left - M.right, C = o - y.right, S = Math.abs(C - j);
6447
6464
  if (S <= e) {
6448
- const T = j - C, M = o + T, I = {
6465
+ const E = j - C, b = o + E, I = {
6449
6466
  type: "horizontal",
6450
6467
  axis: n,
6451
- refStart: b.right,
6468
+ refStart: M.right,
6452
6469
  refEnd: y.left,
6453
6470
  activeStart: y.right,
6454
- activeEnd: M,
6471
+ activeEnd: b,
6455
6472
  distance: j
6456
6473
  };
6457
- m.push({ delta: T, guide: I, diff: S });
6474
+ m.push({ delta: E, guide: I, diff: S });
6458
6475
  }
6459
6476
  }
6460
6477
  if (g && p) {
6461
- const { bounds: y } = g, { bounds: b } = p, j = b.left - y.right, C = y.left - i, S = Math.abs(C - j);
6478
+ const { bounds: y } = g, { bounds: M } = p, j = M.left - y.right, C = y.left - i, S = Math.abs(C - j);
6462
6479
  if (S <= e) {
6463
- const T = C - j, M = i + T, I = {
6480
+ const E = C - j, b = i + E, I = {
6464
6481
  type: "horizontal",
6465
6482
  axis: n,
6466
6483
  refStart: y.right,
6467
- refEnd: b.left,
6468
- activeStart: M,
6484
+ refEnd: M.left,
6485
+ activeStart: b,
6469
6486
  activeEnd: y.left,
6470
6487
  distance: j
6471
6488
  };
6472
- m.push({ delta: T, guide: I, diff: S });
6489
+ m.push({ delta: E, guide: I, diff: S });
6473
6490
  }
6474
6491
  }
6475
6492
  if (u && g) {
6476
- const { bounds: y } = u, { bounds: b } = g, C = b.left - y.right - v;
6493
+ const { bounds: y } = u, { bounds: M } = g, C = M.left - y.right - v;
6477
6494
  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 = {
6495
+ const S = C / 2, E = o - y.right, b = M.left - i, I = Math.abs(E - S), T = Math.abs(b - S), _ = Math.max(I, T);
6496
+ if (_ <= e) {
6497
+ const B = S - E, N = i + B, H = {
6481
6498
  type: "horizontal",
6482
6499
  axis: n,
6483
6500
  refStart: y.right,
@@ -6486,11 +6503,11 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6486
6503
  activeEnd: N + S,
6487
6504
  distance: S
6488
6505
  };
6489
- m.push({ delta: x, guide: Y, diff: z });
6506
+ m.push({ delta: B, guide: H, diff: _ });
6490
6507
  }
6491
6508
  }
6492
6509
  }
6493
- const w = is({
6510
+ const w = as({
6494
6511
  activeBounds: h,
6495
6512
  aligned: c,
6496
6513
  threshold: e,
@@ -6499,7 +6516,7 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6499
6516
  });
6500
6517
  if (m.push(...w), !m.length)
6501
6518
  return { delta: 0, guide: null };
6502
- const A = m.reduce((y, b) => b.diff < y.diff ? b : y, m[0]);
6519
+ const A = m.reduce((y, M) => M.diff < y.diff ? M : y, m[0]);
6503
6520
  return {
6504
6521
  delta: A.delta,
6505
6522
  guide: A.guide
@@ -6536,7 +6553,7 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6536
6553
  }) => {
6537
6554
  const i = Math.min(o, s / 2, n / 2);
6538
6555
  h.moveTo(t + i, e), h.lineTo(t + s - i, e), h.quadraticCurveTo(t + s, e, t + s, e + i), h.lineTo(t + s, e + n - i), h.quadraticCurveTo(t + s, e + n, t + s - i, e + n), h.lineTo(t + i, e + n), h.quadraticCurveTo(t, e + n, t, e + n - i), h.lineTo(t, e + i), h.quadraticCurveTo(t, e, t + i, e), h.closePath();
6539
- }, je = ({
6556
+ }, Ee = ({
6540
6557
  context: h,
6541
6558
  type: t,
6542
6559
  axis: e,
@@ -6553,17 +6570,17 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6553
6570
  offsetAlongAxis: f = 0,
6554
6571
  offsetPerpendicular: g = 0
6555
6572
  }) => {
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;
6573
+ const p = i || 1, m = 12 / p, v = l / p, w = u / p, A = (s + n) / 2 + f, y = t === "vertical" ? e + g : A, M = t === "vertical" ? A : e + g;
6557
6574
  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";
6558
- const C = h.measureText(o).width + v * 2, S = m + v * 2, T = y - C / 2, M = b - S / 2;
6575
+ const C = h.measureText(o).width + v * 2, S = m + v * 2, E = y - C / 2, b = M - S / 2;
6559
6576
  h.beginPath(), Mn({
6560
6577
  context: h,
6561
- x: T,
6562
- y: M,
6578
+ x: E,
6579
+ y: b,
6563
6580
  width: C,
6564
6581
  height: S,
6565
6582
  radius: w
6566
- }), h.fill(), h.fillStyle = r, h.fillText(o, y, b), h.restore();
6583
+ }), h.fill(), h.fillStyle = r, h.fillText(o, y, M), h.restore();
6567
6584
  }, wn = ({
6568
6585
  context: h,
6569
6586
  guide: t,
@@ -6579,8 +6596,8 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6579
6596
  distance: c
6580
6597
  } = t, d = Math.round(c).toString();
6581
6598
  h.beginPath(), s === "vertical" ? (h.moveTo(n, o), h.lineTo(n, i), h.moveTo(n, a), h.lineTo(n, r)) : (h.moveTo(o, n), h.lineTo(i, n), h.moveTo(a, n), h.lineTo(r, n)), h.stroke();
6582
- const l = os;
6583
- je({
6599
+ const l = is;
6600
+ Ee({
6584
6601
  context: h,
6585
6602
  type: s,
6586
6603
  axis: n,
@@ -6589,8 +6606,8 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6589
6606
  text: d,
6590
6607
  zoom: e,
6591
6608
  color: l,
6592
- lineWidth: Ae
6593
- }), je({
6609
+ lineWidth: Ie
6610
+ }), Ee({
6594
6611
  context: h,
6595
6612
  type: s,
6596
6613
  axis: n,
@@ -6599,9 +6616,9 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6599
6616
  text: d,
6600
6617
  zoom: e,
6601
6618
  color: l,
6602
- lineWidth: Ae
6619
+ lineWidth: Ie
6603
6620
  });
6604
- }, Qe = ({
6621
+ }, $e = ({
6605
6622
  anchors: h,
6606
6623
  bounds: t
6607
6624
  }) => {
@@ -6614,7 +6631,7 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6614
6631
  centerY: a
6615
6632
  } = t;
6616
6633
  h.vertical.push(e, n, s), h.horizontal.push(o, a, i);
6617
- }, $e = ({
6634
+ }, ts = ({
6618
6635
  bounds: h,
6619
6636
  type: t,
6620
6637
  primaryStart: e,
@@ -6644,24 +6661,24 @@ const pn = 5, os = "#3D8BF4", Ae = 1, ce = 1, Je = ({
6644
6661
  }, Sn = ({
6645
6662
  bounds: h
6646
6663
  }) => {
6647
- const t = $e({
6664
+ const t = ts({
6648
6665
  bounds: h,
6649
6666
  type: "vertical",
6650
6667
  primaryStart: "top",
6651
6668
  primaryEnd: "bottom"
6652
- }), e = $e({
6669
+ }), e = ts({
6653
6670
  bounds: h,
6654
6671
  type: "horizontal",
6655
6672
  primaryStart: "left",
6656
6673
  primaryEnd: "right"
6657
6674
  });
6658
6675
  return { vertical: t, horizontal: e };
6659
- }, An = ["montage-area", "background", "interaction-blocker"], as = ({
6676
+ }, An = ["montage-area", "background", "interaction-blocker"], rs = ({
6660
6677
  activeObject: h
6661
6678
  }) => {
6662
6679
  const t = /* @__PURE__ */ new Set();
6663
- return h && (t.add(h), h instanceof U && h.getObjects().forEach((e) => t.add(e))), t;
6664
- }, rs = ({
6680
+ return h && (t.add(h), h instanceof F && h.getObjects().forEach((e) => t.add(e))), t;
6681
+ }, cs = ({
6665
6682
  object: h,
6666
6683
  excluded: t,
6667
6684
  ignoredIds: e = An
@@ -6730,7 +6747,7 @@ class jn {
6730
6747
  return;
6731
6748
  }
6732
6749
  !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
6733
- let o = yt({ object: e });
6750
+ let o = mt({ object: e });
6734
6751
  if (!o) {
6735
6752
  this._clearGuides();
6736
6753
  return;
@@ -6745,9 +6762,9 @@ class jn {
6745
6762
  e.set({
6746
6763
  left: v + d,
6747
6764
  top: w + l
6748
- }), e.setCoords(), o = (p = yt({ object: e })) != null ? p : o;
6765
+ }), e.setCoords(), o = (p = mt({ object: e })) != null ? p : o;
6749
6766
  }
6750
- const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => yt({ object: v })).filter((v) => !!v), g = bn({
6767
+ const f = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => mt({ object: v })).filter((v) => !!v), g = bn({
6751
6768
  activeBounds: o,
6752
6769
  candidates: f,
6753
6770
  threshold: r,
@@ -6758,7 +6775,7 @@ class jn {
6758
6775
  e.set({
6759
6776
  left: v + g.deltaX,
6760
6777
  top: w + g.deltaY
6761
- }), e.setCoords(), o = (m = yt({ object: e })) != null ? m : o;
6778
+ }), e.setCoords(), o = (m = mt({ object: e })) != null ? m : o;
6762
6779
  }
6763
6780
  this._applyGuides({
6764
6781
  guides: u,
@@ -6786,7 +6803,7 @@ class jn {
6786
6803
  const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
6787
6804
  if (!s) return;
6788
6805
  const n = e != null ? e : this._calculateViewportBounds(), { left: o, right: i, top: a, bottom: r } = n, { viewportTransform: c } = t, d = t.getZoom() || 1;
6789
- s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = Ae / d, s.strokeStyle = os, s.setLineDash([4, 4]);
6806
+ s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = Ie / d, s.strokeStyle = is, s.setLineDash([4, 4]);
6790
6807
  for (const l of this.activeGuides)
6791
6808
  s.beginPath(), l.type === "vertical" ? (s.moveTo(l.position, a), s.lineTo(l.position, r)) : (s.moveTo(o, l.position), s.lineTo(i, l.position)), s.stroke();
6792
6809
  for (const l of this.activeSpacingGuides)
@@ -6826,7 +6843,7 @@ class jn {
6826
6843
  * Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
6827
6844
  */
6828
6845
  _applyMovementStep({ target: t }) {
6829
- const { left: e = 0, top: s = 0 } = t, n = Math.round(e / ce) * ce, o = Math.round(s / ce) * ce;
6846
+ const { left: e = 0, top: s = 0 } = t, n = Math.round(e / he) * he, o = Math.round(s / he) * he;
6830
6847
  n === e && o === s || (t.set({
6831
6848
  left: n,
6832
6849
  top: o
@@ -6838,12 +6855,12 @@ class jn {
6838
6855
  _cacheAnchors({ activeObject: t }) {
6839
6856
  const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, n = [];
6840
6857
  for (const a of e) {
6841
- const r = yt({ object: a });
6842
- r && (Qe({ anchors: s, bounds: r }), n.push(r));
6858
+ const r = mt({ object: a });
6859
+ r && ($e({ anchors: s, bounds: r }), n.push(r));
6843
6860
  }
6844
- const { montageArea: o } = this.editor, i = yt({ object: o });
6861
+ const { montageArea: o } = this.editor, i = mt({ object: o });
6845
6862
  if (i) {
6846
- Qe({ anchors: s, bounds: i });
6863
+ $e({ anchors: s, bounds: i });
6847
6864
  const { left: a, right: r, top: c, bottom: d } = i;
6848
6865
  this.guideBounds = {
6849
6866
  left: a,
@@ -6859,9 +6876,9 @@ class jn {
6859
6876
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
6860
6877
  */
6861
6878
  _collectTargets({ activeObject: t }) {
6862
- const e = as({ activeObject: t }), s = [];
6879
+ const e = rs({ activeObject: t }), s = [];
6863
6880
  return this.canvas.forEachObject((n) => {
6864
- rs({ object: n, excluded: e }) || s.push(n);
6881
+ cs({ object: n, excluded: e }) || s.push(n);
6865
6882
  }), s;
6866
6883
  }
6867
6884
  /**
@@ -6884,8 +6901,8 @@ class jn {
6884
6901
  };
6885
6902
  }
6886
6903
  }
6887
- const ts = "#3D8BF4", es = 1;
6888
- class Dt {
6904
+ const es = "#3D8BF4", ss = 1;
6905
+ class Nt {
6889
6906
  /**
6890
6907
  * Создаёт менеджер измерений и инициализирует события.
6891
6908
  */
@@ -6990,15 +7007,15 @@ class Dt {
6990
7007
  this._clearGuides();
6991
7008
  return;
6992
7009
  }
6993
- const o = yt({ object: n });
7010
+ const o = mt({ object: n });
6994
7011
  if (!o) {
6995
7012
  this._clearGuides();
6996
7013
  return;
6997
7014
  }
6998
- const i = Dt._resolveTarget({
7015
+ const i = Nt._resolveTarget({
6999
7016
  event: t,
7000
7017
  activeObject: n
7001
- }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = yt({ object: r });
7018
+ }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = mt({ object: r });
7002
7019
  if (!d) {
7003
7020
  this._clearGuides();
7004
7021
  return;
@@ -7007,7 +7024,7 @@ class Dt {
7007
7024
  this._clearGuides();
7008
7025
  return;
7009
7026
  }
7010
- const u = Dt._buildGuides({
7027
+ const u = Nt._buildGuides({
7011
7028
  activeBounds: o,
7012
7029
  targetBounds: d,
7013
7030
  targetIsMontageArea: c
@@ -7025,8 +7042,8 @@ class Dt {
7025
7042
  event: t,
7026
7043
  activeObject: e
7027
7044
  }) {
7028
- const { target: s } = t, n = as({ activeObject: e });
7029
- return s && !rs({ object: s, excluded: n }) ? s : null;
7045
+ const { target: s } = t, n = rs({ activeObject: e });
7046
+ return s && !cs({ object: s, excluded: n }) ? s : null;
7030
7047
  }
7031
7048
  /**
7032
7049
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -7036,11 +7053,11 @@ class Dt {
7036
7053
  targetBounds: e,
7037
7054
  targetIsMontageArea: s
7038
7055
  }) {
7039
- const n = Dt._buildHorizontalGuides({
7056
+ const n = Nt._buildHorizontalGuides({
7040
7057
  activeBounds: t,
7041
7058
  targetBounds: e,
7042
7059
  targetIsMontageArea: s
7043
- }), o = Dt._buildVerticalGuides({
7060
+ }), o = Nt._buildVerticalGuides({
7044
7061
  activeBounds: t,
7045
7062
  targetBounds: e,
7046
7063
  targetIsMontageArea: s
@@ -7091,21 +7108,21 @@ class Dt {
7091
7108
  }), n;
7092
7109
  }
7093
7110
  if (!s) return n;
7094
- const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), C = j - b;
7111
+ const A = o < d, y = i > l, M = Math.min(o, d), j = Math.max(o, d), C = j - M;
7095
7112
  C > 0 && !A && n.push({
7096
7113
  type: "horizontal",
7097
7114
  axis: w,
7098
- start: b,
7115
+ start: M,
7099
7116
  end: j,
7100
7117
  distance: C
7101
7118
  });
7102
- const S = Math.min(i, l), T = Math.max(i, l), M = T - S;
7103
- return M > 0 && !y && n.push({
7119
+ const S = Math.min(i, l), E = Math.max(i, l), b = E - S;
7120
+ return b > 0 && !y && n.push({
7104
7121
  type: "horizontal",
7105
7122
  axis: w,
7106
7123
  start: S,
7107
- end: T,
7108
- distance: M
7124
+ end: E,
7125
+ distance: b
7109
7126
  }), n;
7110
7127
  }
7111
7128
  /**
@@ -7152,21 +7169,21 @@ class Dt {
7152
7169
  }), n;
7153
7170
  }
7154
7171
  if (!s) return n;
7155
- const A = o < d, y = i > l, b = Math.min(o, d), j = Math.max(o, d), C = j - b;
7172
+ const A = o < d, y = i > l, M = Math.min(o, d), j = Math.max(o, d), C = j - M;
7156
7173
  C > 0 && !A && n.push({
7157
7174
  type: "vertical",
7158
7175
  axis: w,
7159
- start: b,
7176
+ start: M,
7160
7177
  end: j,
7161
7178
  distance: C
7162
7179
  });
7163
- const S = Math.min(i, l), T = Math.max(i, l), M = T - S;
7164
- return M > 0 && !y && n.push({
7180
+ const S = Math.min(i, l), E = Math.max(i, l), b = E - S;
7181
+ return b > 0 && !y && n.push({
7165
7182
  type: "vertical",
7166
7183
  axis: w,
7167
7184
  start: S,
7168
- end: T,
7169
- distance: M
7185
+ end: E,
7186
+ distance: b
7170
7187
  }), n;
7171
7188
  }
7172
7189
  /**
@@ -7194,10 +7211,10 @@ class Dt {
7194
7211
  const { canvas: t } = this, e = t.getSelectionContext();
7195
7212
  if (!e) return;
7196
7213
  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;
7197
- e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = es / n, e.strokeStyle = ts, e.setLineDash([]);
7214
+ e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = ss / n, e.strokeStyle = es, e.setLineDash([]);
7198
7215
  for (const c of this.activeGuides) {
7199
7216
  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;
7200
- e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, f)) : (e.moveTo(u, l), e.lineTo(f, l)), e.stroke(), je({
7217
+ e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, f)) : (e.moveTo(u, l), e.lineTo(f, l)), e.stroke(), Ee({
7201
7218
  context: e,
7202
7219
  type: d,
7203
7220
  axis: l,
@@ -7205,8 +7222,8 @@ class Dt {
7205
7222
  end: f,
7206
7223
  text: Math.round(g).toString(),
7207
7224
  zoom: n,
7208
- color: ts,
7209
- lineWidth: es,
7225
+ color: es,
7226
+ lineWidth: ss,
7210
7227
  offsetAlongAxis: v,
7211
7228
  offsetPerpendicular: w
7212
7229
  });
@@ -7232,14 +7249,14 @@ class Dt {
7232
7249
  (e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
7233
7250
  }
7234
7251
  }
7235
- class Le {
7252
+ class xe {
7236
7253
  /**
7237
7254
  * Конструктор класса ImageEditor.
7238
7255
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
7239
7256
  * @param options - опции и настройки редактора
7240
7257
  */
7241
7258
  constructor(t, e) {
7242
- this.options = e, this.containerId = t, this.editorId = `${t}-${X()}`, this.clipboard = null, this.init();
7259
+ this.options = e, this.containerId = t, this.editorId = `${t}-${K()}`, this.clipboard = null, this.init();
7243
7260
  }
7244
7261
  /**
7245
7262
  * Инициализация редактора.
@@ -7247,7 +7264,7 @@ class Le {
7247
7264
  * @fires editor:ready
7248
7265
  */
7249
7266
  init() {
7250
- return P(this, null, function* () {
7267
+ return W(this, null, function* () {
7251
7268
  var u;
7252
7269
  const {
7253
7270
  editorContainerWidth: t,
@@ -7262,17 +7279,17 @@ class Le {
7262
7279
  showRotationAngle: d,
7263
7280
  _onReadyCallback: l
7264
7281
  } = this.options;
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) {
7282
+ if (ot.apply(), this.canvas = new vs(this.containerId, this.options), this.moduleLoader = new As(), this.workerManager = new Cs(), this.errorManager = new te({ editor: this }), this.historyManager = new G({ 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 lt({ editor: this }), this.layerManager = new fe({ editor: this }), this.shapeManager = new tn({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new _t({ editor: this }), this.clipboardManager = new en({ editor: this }), this.objectLockManager = new ge({ editor: this }), this.groupingManager = new sn({ editor: this }), this.selectionManager = new nn({ editor: this }), this.deletionManager = new Re({ editor: this }), this.panConstraintManager = new on({ editor: this }), this.snappingManager = new jn({ editor: this }), this.measurementManager = new Nt({ editor: this }), this.fontManager = new Ce((u = this.options.fonts) != null ? u : []), this.textManager = new P({ editor: this }), this.templateManager = new x({ editor: this }), d && (this.angleIndicator = new De({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new $t({ 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) {
7266
7283
  const f = a, {
7267
7284
  source: g,
7268
7285
  scale: p = `image-${c}`,
7269
7286
  withoutSave: m = !0
7270
- } = f, v = pt(f, [
7287
+ } = f, v = gt(f, [
7271
7288
  "source",
7272
7289
  "scale",
7273
7290
  "withoutSave"
7274
7291
  ]);
7275
- yield this.imageManager.importImage(B({ source: g, scale: p, withoutSave: m }, v));
7292
+ yield this.imageManager.importImage(z({ source: g, scale: p, withoutSave: m }, v));
7276
7293
  }
7277
7294
  r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
7278
7295
  });
@@ -7288,7 +7305,7 @@ class Le {
7288
7305
  this.montageArea = this.shapeManager.addRectangle({
7289
7306
  width: t,
7290
7307
  height: e,
7291
- fill: Le._createMosaicPattern(),
7308
+ fill: xe._createMosaicPattern(),
7292
7309
  stroke: null,
7293
7310
  strokeWidth: 0,
7294
7311
  selectable: !1,
@@ -8269,13 +8286,13 @@ const L = [
8269
8286
  fonts: Cn
8270
8287
  };
8271
8288
  function Dn(h, t = {}) {
8272
- const e = B(B({}, In), t), s = document.getElementById(h);
8289
+ const e = z(z({}, In), t), s = document.getElementById(h);
8273
8290
  if (!s)
8274
8291
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
8275
8292
  const n = document.createElement("canvas");
8276
8293
  return n.id = `${h}-canvas`, s.appendChild(n), e.editorContainer = s, new Promise((o) => {
8277
8294
  e._onReadyCallback = o;
8278
- const i = new Le(n.id, e);
8295
+ const i = new xe(n.id, e);
8279
8296
  window[h] = i;
8280
8297
  });
8281
8298
  }