@anu3ev/fabric-image-editor 0.5.16 → 0.5.18

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 +1001 -981
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -1,41 +1,41 @@
1
1
  var cs = Object.defineProperty, ds = Object.defineProperties;
2
2
  var ls = Object.getOwnPropertyDescriptors;
3
- var Vt = Object.getOwnPropertySymbols;
3
+ var Xt = Object.getOwnPropertySymbols;
4
4
  var Re = Object.prototype.hasOwnProperty, _e = Object.prototype.propertyIsEnumerable;
5
5
  var De = (h, t, e) => t in h ? cs(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, B = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
7
  Re.call(t, e) && De(h, e, t[e]);
8
- if (Vt)
9
- for (var e of Vt(t))
8
+ if (Xt)
9
+ for (var e of Xt(t))
10
10
  _e.call(t, e) && De(h, e, t[e]);
11
11
  return h;
12
- }, yt = (h, t) => ds(h, ls(t));
13
- var vt = (h, t) => {
12
+ }, vt = (h, t) => ds(h, ls(t));
13
+ var bt = (h, t) => {
14
14
  var e = {};
15
15
  for (var s in h)
16
16
  Re.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
- if (h != null && Vt)
18
- for (var s of Vt(h))
17
+ if (h != null && Xt)
18
+ for (var s of Xt(h))
19
19
  t.indexOf(s) < 0 && _e.call(h, s) && (e[s] = h[s]);
20
20
  return e;
21
21
  };
22
- var k = (h, t, e) => new Promise((s, o) => {
23
- var n = (r) => {
22
+ var k = (h, t, e) => new Promise((s, n) => {
23
+ var o = (r) => {
24
24
  try {
25
25
  a(e.next(r));
26
26
  } catch (c) {
27
- o(c);
27
+ n(c);
28
28
  }
29
29
  }, i = (r) => {
30
30
  try {
31
31
  a(e.throw(r));
32
32
  } catch (c) {
33
- o(c);
33
+ n(c);
34
34
  }
35
- }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
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 nt, util as dt, controlsUtils as xe, InteractiveFabricObject as Ne, Point as et, FitContentLayout as Be, loadSVGFromURL as hs, FabricImage as zt, Gradient as ke, Rect as us, Circle as gs, Triangle as fs, Group as Et, Color as ps, classRegistry as ze, loadSVGFromString as ms, Canvas as ys, Pattern as vs } from "fabric";
38
+ import { ActiveSelection as U, Textbox as ot, util as dt, controlsUtils as xe, InteractiveFabricObject as Ne, Point as et, FitContentLayout as Be, loadSVGFromURL as hs, FabricImage as Ut, Gradient as ke, Rect as us, Circle as gs, Triangle as fs, Group as Et, Color as ps, classRegistry as ze, loadSVGFromString as ms, Canvas as ys, Pattern as vs } from "fabric";
39
39
  import { create as bs } from "jsondiffpatch";
40
40
  import Ms from "diff-match-patch";
41
41
  var ws = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", V = function() {
@@ -71,15 +71,15 @@ class Ft {
71
71
  adaptCanvasToContainerOnResize: t,
72
72
  canvasDragging: e,
73
73
  mouseWheelZooming: s,
74
- bringToFrontOnSelection: o,
75
- copyObjectsByHotkey: n,
74
+ bringToFrontOnSelection: n,
75
+ copyObjectsByHotkey: o,
76
76
  pasteImageFromClipboard: i,
77
77
  undoRedoByHotKeys: a,
78
78
  selectAllByHotkey: r,
79
79
  deleteObjectsByHotkey: c,
80
80
  resetObjectFitByDoubleClick: d
81
81
  } = this.options;
82
- e && (this.canvas.on("mouse:down", this.handleCanvasDragStartBound), this.canvas.on("mouse:move", this.handleCanvasDraggingBound), this.canvas.on("mouse:up", this.handleCanvasDragEndBound), document.addEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.addEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), s && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), o && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), d && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), t && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), n && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), i && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), a && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), r && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), c && document.addEventListener("keydown", this.handleDeleteObjectsEventBound, { capture: !0 }), this.canvas.on("object:modified", this.handleObjectModifiedHistoryBound), this.canvas.on("object:rotating", this.handleObjectRotatingHistoryBound), this.canvas.on("object:added", this.handleObjectAddedHistoryBound), this.canvas.on("object:removed", this.handleObjectRemovedHistoryBound), this.canvas.on("object:added", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleLockedSelectionBound), this.canvas.on("selection:updated", this.handleLockedSelectionBound), this.canvas.on("object:added", this.handleBackgroundUpdateBound), this.canvas.on("selection:created", this.handleBackgroundUpdateBound);
82
+ e && (this.canvas.on("mouse:down", this.handleCanvasDragStartBound), this.canvas.on("mouse:move", this.handleCanvasDraggingBound), this.canvas.on("mouse:up", this.handleCanvasDragEndBound), document.addEventListener("keydown", this.handleSpaceKeyDownBound, { capture: !0 }), document.addEventListener("keyup", this.handleSpaceKeyUpBound, { capture: !0 })), s && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), n && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), d && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), t && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), o && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), i && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), a && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), r && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), c && document.addEventListener("keydown", this.handleDeleteObjectsEventBound, { capture: !0 }), this.canvas.on("object:modified", this.handleObjectModifiedHistoryBound), this.canvas.on("object:rotating", this.handleObjectRotatingHistoryBound), this.canvas.on("object:added", this.handleObjectAddedHistoryBound), this.canvas.on("object:removed", this.handleObjectRemovedHistoryBound), this.canvas.on("object:added", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleOverlayUpdateBound), this.canvas.on("selection:created", this.handleLockedSelectionBound), this.canvas.on("selection:updated", this.handleLockedSelectionBound), this.canvas.on("object:added", this.handleBackgroundUpdateBound), this.canvas.on("selection:created", this.handleBackgroundUpdateBound);
83
83
  }
84
84
  /**
85
85
  * При массовом выделении объектов удаляем из него залоченные.
@@ -89,16 +89,16 @@ class Ft {
89
89
  */
90
90
  _filterLockedSelection({ selected: t, e }) {
91
91
  if (!(t != null && t.length) || !(e instanceof MouseEvent) || t.length === 1) return;
92
- const { lockedObjects: s, unlockedObjects: o } = t.reduce(
92
+ const { lockedObjects: s, unlockedObjects: n } = t.reduce(
93
93
  (i, a) => a.locked ? (i.lockedObjects.push(a), i) : (i.unlockedObjects.push(a), i),
94
94
  { lockedObjects: [], unlockedObjects: [] }
95
95
  );
96
96
  if (s.length === 0) return;
97
- if (o.length > 0) {
98
- if (o.length === 1)
99
- this.canvas.setActiveObject(o[0]);
97
+ if (n.length > 0) {
98
+ if (n.length === 1)
99
+ this.canvas.setActiveObject(n[0]);
100
100
  else {
101
- const i = new U(o, {
101
+ const i = new U(n, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,14 +106,14 @@ class Ft {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const n = new U(t, {
109
+ const o = new U(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
113
- object: n,
113
+ object: o,
114
114
  skipInnerObjects: !0,
115
115
  withoutSave: !0
116
- }), this.canvas.setActiveObject(n), this.canvas.requestRenderAll();
116
+ }), this.canvas.setActiveObject(o), this.canvas.requestRenderAll();
117
117
  }
118
118
  /**
119
119
  * Обработчики для сохранения состояния редактора в истории.
@@ -157,8 +157,8 @@ class Ft {
157
157
  * @param event.code — код клавиши
158
158
  */
159
159
  handleCopyEvent(t) {
160
- const { ctrlKey: e, metaKey: s, code: o } = t;
161
- this._shouldIgnoreKeyboardEvent(t) || !e && !s || o !== "KeyC" || (t.preventDefault(), this.editor.clipboardManager.copy());
160
+ const { ctrlKey: e, metaKey: s, code: n } = t;
161
+ this._shouldIgnoreKeyboardEvent(t) || !e && !s || n !== "KeyC" || (t.preventDefault(), this.editor.clipboardManager.copy());
162
162
  }
163
163
  /**
164
164
  * Обработчик вставки объекта или изображения из буфера обмена.
@@ -176,8 +176,8 @@ class Ft {
176
176
  */
177
177
  handleUndoRedoEvent(t) {
178
178
  return k(this, null, function* () {
179
- const { ctrlKey: e, metaKey: s, code: o, repeat: n } = t;
180
- this._shouldIgnoreKeyboardEvent(t) || !e && !s || n || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (o === "KeyZ" ? (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : o === "KeyY" && (t.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
179
+ const { ctrlKey: e, metaKey: s, code: n, repeat: o } = t;
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
  });
182
182
  }
183
183
  /**
@@ -197,8 +197,8 @@ class Ft {
197
197
  */
198
198
  handleSelectAllEvent(t) {
199
199
  if (this._shouldIgnoreKeyboardEvent(t)) return;
200
- const { ctrlKey: e, metaKey: s, code: o } = t;
201
- !e && !s || o !== "KeyA" || (t.preventDefault(), this.editor.selectionManager.selectAll());
200
+ const { ctrlKey: e, metaKey: s, code: n } = t;
201
+ !e && !s || n !== "KeyA" || (t.preventDefault(), this.editor.selectionManager.selectAll());
202
202
  }
203
203
  /**
204
204
  * Обработчик для удаления объектов (Delete или Backspace).
@@ -216,8 +216,8 @@ class Ft {
216
216
  */
217
217
  handleSpaceKeyDown(t) {
218
218
  if (t.code !== "Space" || this._shouldIgnoreKeyboardEvent(t)) return;
219
- const { canvas: e, editor: s, isSpacePressed: o, isDragging: n } = this;
220
- if (o || n) return;
219
+ const { canvas: e, editor: s, isSpacePressed: n, isDragging: o } = this;
220
+ if (n || o) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const i = e.getActiveObject() || null;
223
223
  i instanceof U ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
@@ -259,8 +259,8 @@ class Ft {
259
259
  e.setActiveObject(t[0]);
260
260
  return;
261
261
  }
262
- const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new U(o, { canvas: e });
263
- e.setActiveObject(n);
262
+ const n = t.filter((i) => s.canvasManager.getObjects().includes(i)), o = new U(n, { canvas: e });
263
+ e.setActiveObject(o);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
266
266
  /**
@@ -282,8 +282,8 @@ class Ft {
282
282
  const { panConstraintManager: e, montageArea: s } = this.editor;
283
283
  if (!e.isPanAllowed())
284
284
  return;
285
- const o = this.canvas.viewportTransform, n = o[4] + (t.clientX - this.lastMouseX), i = o[5] + (t.clientY - this.lastMouseY), a = e.constrainPan(n, i);
286
- o[4] = a.x, o[5] = a.y, s.setCoords(), this.canvas.requestRenderAll(), this.lastMouseX = t.clientX, this.lastMouseY = t.clientY;
285
+ const n = this.canvas.viewportTransform, o = n[4] + (t.clientX - this.lastMouseX), i = n[5] + (t.clientY - this.lastMouseY), a = e.constrainPan(o, i);
286
+ n[4] = a.x, n[5] = a.y, s.setCoords(), this.canvas.requestRenderAll(), this.lastMouseX = t.clientX, this.lastMouseY = t.clientY;
287
287
  }
288
288
  /**
289
289
  * Завершение перетаскивания канваса (mouse:up).
@@ -301,8 +301,8 @@ class Ft {
301
301
  * @returns Шаг изменения зума
302
302
  */
303
303
  _calculateAdaptiveZoomStep(t) {
304
- const e = this.canvas.getZoom(), s = 0.05, n = t / 100;
305
- return -(e * s * n);
304
+ const e = this.canvas.getZoom(), s = 0.05, o = t / 100;
305
+ return -(e * s * o);
306
306
  }
307
307
  /**
308
308
  * Обработчик зума колесиком мыши. Работает при зажатом Ctrl или Cmd.
@@ -330,7 +330,7 @@ class Ft {
330
330
  */
331
331
  handleResetObjectFit(t) {
332
332
  const e = t == null ? void 0 : t.target;
333
- !e || e instanceof nt || this.editor.transformManager.resetObject({ object: e });
333
+ !e || e instanceof ot || this.editor.transformManager.resetObject({ object: e });
334
334
  }
335
335
  /**
336
336
  * Проверяет, должно ли событие клавиатуры быть проигнорировано
@@ -339,23 +339,23 @@ class Ft {
339
339
  * @returns true если событие должно быть проигнорировано
340
340
  */
341
341
  _shouldIgnoreKeyboardEvent(t) {
342
- const e = document.activeElement, s = t.target, o = ["input", "textarea", "select"];
342
+ const e = document.activeElement, s = t.target, n = ["input", "textarea", "select"];
343
343
  if (s) {
344
344
  const i = s.tagName.toLowerCase();
345
- if (t.type === "paste" && o.includes(i)) {
345
+ if (t.type === "paste" && n.includes(i)) {
346
346
  const a = e == null ? void 0 : e.tagName.toLowerCase();
347
- return !!(a && o.includes(a));
347
+ return !!(a && n.includes(a));
348
348
  }
349
- if (o.includes(i) || s.contentEditable === "true")
349
+ if (n.includes(i) || s.contentEditable === "true")
350
350
  return !0;
351
351
  }
352
352
  if (e && e !== s) {
353
353
  const i = e.tagName.toLowerCase();
354
- if (o.includes(i) || e.contentEditable === "true") return !0;
354
+ if (n.includes(i) || e.contentEditable === "true") return !0;
355
355
  }
356
- const n = window.getSelection();
357
- if (n && !n.isCollapsed && n.rangeCount > 0) {
358
- let r = n.getRangeAt(0).commonAncestorContainer;
356
+ const o = window.getSelection();
357
+ if (o && !o.isCollapsed && o.rangeCount > 0) {
358
+ let r = o.getRangeAt(0).commonAncestorContainer;
359
359
  r.nodeType === Node.TEXT_NODE && (r = r.parentElement);
360
360
  const { keyboardIgnoreSelectors: c } = this.options;
361
361
  if (c != null && c.length && r)
@@ -384,9 +384,9 @@ class Ft {
384
384
  */
385
385
  static debounce(t, e) {
386
386
  let s = null;
387
- return function(...o) {
387
+ return function(...n) {
388
388
  s !== null && clearTimeout(s), s = setTimeout(() => {
389
- t.apply(this, o);
389
+ t.apply(this, n);
390
390
  }, e);
391
391
  };
392
392
  }
@@ -436,12 +436,12 @@ class js {
436
436
  * @returns
437
437
  */
438
438
  _handleMessage({ data: t }) {
439
- const { requestId: e, success: s, data: o, error: n } = t, i = this._callbacks.get(e);
439
+ const { requestId: e, success: s, data: n, error: o } = t, i = this._callbacks.get(e);
440
440
  if (!i) {
441
441
  console.warn(`No callback found for requestId: ${e}`);
442
442
  return;
443
443
  }
444
- s ? i.resolve(o) : i.reject(new Error(n)), this._callbacks.delete(e);
444
+ s ? i.resolve(n) : i.reject(new Error(o)), this._callbacks.delete(e);
445
445
  }
446
446
  /**
447
447
  * Универсальный метод отправки команды в воркер
@@ -451,9 +451,9 @@ class js {
451
451
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
452
452
  */
453
453
  post(t, e, s = []) {
454
- const o = `${t}:${V(8)}`;
455
- return new Promise((n, i) => {
456
- this._callbacks.set(o, { resolve: n, reject: i }), this.worker.postMessage({ action: t, payload: e, requestId: o }, s);
454
+ const n = `${t}:${V(8)}`;
455
+ return new Promise((o, i) => {
456
+ this._callbacks.set(n, { resolve: o, reject: i }), this.worker.postMessage({ action: t, payload: e, requestId: n }, s);
457
457
  });
458
458
  }
459
459
  /**
@@ -463,50 +463,50 @@ class js {
463
463
  this.worker.terminate();
464
464
  }
465
465
  }
466
- const rt = 12, Is = 2, de = 8, le = 20, Cs = 100, he = 20, ue = 8, Ts = 100, $t = 32, me = 1, Es = "#2B2D33", ye = "#3D8BF4", ve = "#FFFFFF";
467
- function Xt(h, t, e, s, o) {
468
- const n = rt, i = Is;
469
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -n / 2, n, n, i), h.fill(), h.stroke(), h.restore();
466
+ const rt = 12, Is = 2, he = 8, ue = 20, Cs = 100, ge = 20, fe = 8, Ts = 100, te = 32, ve = 1, Es = "#2B2D33", be = "#3D8BF4", Me = "#FFFFFF";
467
+ function Kt(h, t, e, s, n) {
468
+ const o = rt, i = Is;
469
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(n.angle)), h.fillStyle = Me, h.strokeStyle = be, h.lineWidth = ve, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, i), h.fill(), h.stroke(), h.restore();
470
470
  }
471
- function Ue(h, t, e, s, o) {
472
- const n = de, i = le, a = Cs;
473
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
471
+ function Ue(h, t, e, s, n) {
472
+ const o = he, i = ue, a = Cs;
473
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(n.angle)), h.fillStyle = Me, h.strokeStyle = be, h.lineWidth = ve, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
474
474
  }
475
- function Pe(h, t, e, s, o) {
476
- const n = he, i = ue, a = Ts;
477
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = ve, h.strokeStyle = ye, h.lineWidth = me, h.beginPath(), h.roundRect(-n / 2, -i / 2, n, i, a), h.fill(), h.stroke(), h.restore();
475
+ function Pe(h, t, e, s, n) {
476
+ const o = ge, i = fe, a = Ts;
477
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(n.angle)), h.fillStyle = Me, h.strokeStyle = be, h.lineWidth = ve, h.beginPath(), h.roundRect(-o / 2, -i / 2, o, i, a), h.fill(), h.stroke(), h.restore();
478
478
  }
479
479
  const Os = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", ts = new Image();
480
480
  ts.src = Os;
481
- function Ls(h, t, e, s, o) {
482
- const i = $t / 2;
483
- h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(o.angle)), h.fillStyle = Es, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(ts, -i / 2, -i / 2, i, i), h.restore();
481
+ function Ls(h, t, e, s, n) {
482
+ const i = te / 2;
483
+ h.save(), h.translate(t, e), h.rotate(dt.degreesToRadians(n.angle)), h.fillStyle = Es, h.beginPath(), h.arc(0, 0, i, 0, 2 * Math.PI), h.fill(), h.drawImage(ts, -i / 2, -i / 2, i, i), h.restore();
484
484
  }
485
485
  const Ds = {
486
486
  // Угловые точки
487
487
  tl: {
488
- render: Xt,
488
+ render: Kt,
489
489
  sizeX: rt,
490
490
  sizeY: rt,
491
491
  offsetX: 0,
492
492
  offsetY: 0
493
493
  },
494
494
  tr: {
495
- render: Xt,
495
+ render: Kt,
496
496
  sizeX: rt,
497
497
  sizeY: rt,
498
498
  offsetX: 0,
499
499
  offsetY: 0
500
500
  },
501
501
  bl: {
502
- render: Xt,
502
+ render: Kt,
503
503
  sizeX: rt,
504
504
  sizeY: rt,
505
505
  offsetX: 0,
506
506
  offsetY: 0
507
507
  },
508
508
  br: {
509
- render: Xt,
509
+ render: Kt,
510
510
  sizeX: rt,
511
511
  sizeY: rt,
512
512
  offsetX: 0,
@@ -515,40 +515,40 @@ const Ds = {
515
515
  // Середина вертикалей
516
516
  ml: {
517
517
  render: Ue,
518
- sizeX: de,
519
- sizeY: le,
518
+ sizeX: he,
519
+ sizeY: ue,
520
520
  offsetX: 0,
521
521
  offsetY: 0
522
522
  },
523
523
  mr: {
524
524
  render: Ue,
525
- sizeX: de,
526
- sizeY: le,
525
+ sizeX: he,
526
+ sizeY: ue,
527
527
  offsetX: 0,
528
528
  offsetY: 0
529
529
  },
530
530
  // Середина горизонталей
531
531
  mt: {
532
532
  render: Pe,
533
- sizeX: he,
534
- sizeY: ue,
533
+ sizeX: ge,
534
+ sizeY: fe,
535
535
  offsetX: 0,
536
536
  offsetY: 0
537
537
  },
538
538
  mb: {
539
539
  render: Pe,
540
- sizeX: he,
541
- sizeY: ue,
540
+ sizeX: ge,
541
+ sizeY: fe,
542
542
  offsetX: 0,
543
543
  offsetY: 0
544
544
  },
545
545
  // Специальный «rotate» контрол
546
546
  mtr: {
547
547
  render: Ls,
548
- sizeX: $t,
549
- sizeY: $t,
548
+ sizeX: te,
549
+ sizeY: te,
550
550
  offsetX: 0,
551
- offsetY: -$t
551
+ offsetY: -te
552
552
  }
553
553
  };
554
554
  class $ {
@@ -558,9 +558,9 @@ class $ {
558
558
  static wrapWidthControl(t) {
559
559
  if (!(t != null && t.actionHandler)) return;
560
560
  const e = t.actionHandler;
561
- t.actionHandler = (s, o, n, i) => {
562
- const a = o == null ? void 0 : o.target;
563
- return !a || a.locked || a.lockScalingX ? !1 : e(s, o, n, i);
561
+ t.actionHandler = (s, n, o, i) => {
562
+ const a = n == null ? void 0 : n.target;
563
+ return !a || a.locked || a.lockScalingX ? !1 : e(s, n, o, i);
564
564
  };
565
565
  }
566
566
  /**
@@ -568,8 +568,8 @@ class $ {
568
568
  */
569
569
  static applyControlOverrides(t) {
570
570
  Object.entries(Ds).forEach(([e, s]) => {
571
- const o = t[e];
572
- o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (n, i, a, r) => {
571
+ const n = t[e];
572
+ n && (Object.assign(n, s), e === "mtr" && (n.cursorStyle = "grab", n.mouseDownHandler = (o, i, a, r) => {
573
573
  var d;
574
574
  const c = i == null ? void 0 : i.target;
575
575
  (d = c == null ? void 0 : c.canvas) == null || d.setCursor("grabbing");
@@ -583,14 +583,14 @@ class $ {
583
583
  const t = xe.createObjectDefaultControls();
584
584
  $.applyControlOverrides(t), Ne.ownDefaults.controls = t;
585
585
  const e = xe.createTextboxDefaultControls();
586
- $.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), $.wrapWidthControl(e.ml), $.wrapWidthControl(e.mr), nt.ownDefaults.controls = e, $.patchActiveSelectionBounds(), Ne.ownDefaults.snapAngle = 1;
586
+ $.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), $.wrapWidthControl(e.ml), $.wrapWidthControl(e.mr), ot.ownDefaults.controls = e, $.patchActiveSelectionBounds(), Ne.ownDefaults.snapAngle = 1;
587
587
  }
588
588
  /**
589
589
  * Обновляет алгоритм расчёта границ ActiveSelection, чтобы учитывать фон и отступы текстовых объектов.
590
590
  */
591
591
  static patchActiveSelectionBounds() {
592
592
  const t = U.prototype, e = t._calcBoundsFromObjects;
593
- t._calcBoundsFromObjects = function(...n) {
593
+ t._calcBoundsFromObjects = function(...o) {
594
594
  var g, f;
595
595
  const i = (f = (g = this.getObjects) == null ? void 0 : g.call(this)) != null ? f : [];
596
596
  $.applyTextSelectionScalingLock({
@@ -601,7 +601,7 @@ class $ {
601
601
  objects: i
602
602
  });
603
603
  if (!a)
604
- return e ? e.apply(this, n) : void 0;
604
+ return e ? e.apply(this, o) : void 0;
605
605
  const { left: r, top: c, width: d, height: l } = a;
606
606
  this.set({
607
607
  flipX: !1,
@@ -613,9 +613,9 @@ class $ {
613
613
  return this.setPositionByOrigin(u, "center", "center"), a;
614
614
  };
615
615
  const s = t._onAfterObjectsChange;
616
- t._onAfterObjectsChange = function(n, i) {
616
+ t._onAfterObjectsChange = function(o, i) {
617
617
  var p, m;
618
- const a = s ? s.call(this, n, i) : void 0, r = (m = (p = this.getObjects) == null ? void 0 : p.call(this)) != null ? m : [];
618
+ const a = s ? s.call(this, o, i) : void 0, r = (m = (p = this.getObjects) == null ? void 0 : p.call(this)) != null ? m : [];
619
619
  $.applyTextSelectionScalingLock({
620
620
  selection: this,
621
621
  objects: r
@@ -630,20 +630,20 @@ class $ {
630
630
  height: g
631
631
  }), this.setPositionByOrigin(f, "center", "center"), this.setCoords(), a;
632
632
  };
633
- const o = Be.prototype.calcBoundingBox;
634
- Be.prototype.calcBoundingBox = function(n, i) {
633
+ const n = Be.prototype.calcBoundingBox;
634
+ Be.prototype.calcBoundingBox = function(o, i) {
635
635
  const { target: a, type: r, overrides: c } = i;
636
636
  if (r === "imperative" && c)
637
637
  return c;
638
638
  if (!(a instanceof U))
639
- return o.call(this, n, i);
639
+ return n.call(this, o, i);
640
640
  $.applyTextSelectionScalingLock({
641
641
  selection: a,
642
- objects: n
642
+ objects: o
643
643
  });
644
- const d = $.calculateActiveSelectionBounds({ objects: n });
644
+ const d = $.calculateActiveSelectionBounds({ objects: o });
645
645
  if (!d)
646
- return o.call(this, n, i);
646
+ return n.call(this, o, i);
647
647
  const { left: l, top: u, width: g, height: f } = d, p = new et(g, f), m = new et(l + g / 2, u + f / 2);
648
648
  return r === "initialization" ? {
649
649
  center: m,
@@ -662,12 +662,12 @@ class $ {
662
662
  objects: t
663
663
  }) {
664
664
  if (!t.length) return null;
665
- const e = t.map((a) => a.getBoundingRect()), s = Math.min(...e.map(({ left: a }) => a)), o = Math.min(...e.map(({ top: a }) => a)), n = Math.max(...e.map(({ left: a, width: r }) => a + r));
665
+ const e = t.map((a) => a.getBoundingRect()), s = Math.min(...e.map(({ left: a }) => a)), n = Math.min(...e.map(({ top: a }) => a)), o = Math.max(...e.map(({ left: a, width: r }) => a + r));
666
666
  return {
667
- height: Math.max(...e.map(({ top: a, height: r }) => a + r)) - o,
667
+ height: Math.max(...e.map(({ top: a, height: r }) => a + r)) - n,
668
668
  left: s,
669
- top: o,
670
- width: n - s
669
+ top: n,
670
+ width: o - s
671
671
  };
672
672
  }
673
673
  /**
@@ -677,7 +677,7 @@ class $ {
677
677
  selection: t,
678
678
  objects: e
679
679
  }) {
680
- const s = e.some((o) => o instanceof nt);
680
+ const s = e.some((n) => n instanceof ot);
681
681
  t.setControlsVisibility({
682
682
  mt: !s,
683
683
  mb: !s,
@@ -695,33 +695,33 @@ const z = class z {
695
695
  }
696
696
  loadFonts() {
697
697
  return k(this, null, function* () {
698
- var o;
699
- const t = (o = this.fonts) != null ? o : [];
698
+ var n;
699
+ const t = (n = this.fonts) != null ? n : [];
700
700
  if (!t.length) return;
701
701
  const e = typeof document != "undefined" ? document : void 0;
702
702
  if (!e) return;
703
- const s = t.map((n) => z.loadFont(n, e));
703
+ const s = t.map((o) => z.loadFont(o, e));
704
704
  yield Promise.allSettled(s);
705
705
  });
706
706
  }
707
707
  static loadFont(t, e) {
708
708
  return k(this, null, function* () {
709
709
  var c, d;
710
- const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (d = t.source) == null ? void 0 : d.trim();
711
- if (!o || !n) return;
712
- const i = z.normalizeFontSource(n), a = z.getDescriptorSnapshot(t.descriptors), r = z.getFontRegistrationKey(o, i, a);
710
+ const s = typeof FontFace != "undefined", n = (c = t.family) == null ? void 0 : c.trim(), o = (d = t.source) == null ? void 0 : d.trim();
711
+ if (!n || !o) return;
712
+ const i = z.normalizeFontSource(o), a = z.getDescriptorSnapshot(t.descriptors), r = z.getFontRegistrationKey(n, i, a);
713
713
  if (!z.registeredFontKeys.has(r)) {
714
- if (z.isFontFaceAlreadyApplied(e, o, a)) {
714
+ if (z.isFontFaceAlreadyApplied(e, n, a)) {
715
715
  z.registeredFontKeys.add(r);
716
716
  return;
717
717
  }
718
718
  if (s && e.fonts && typeof e.fonts.add == "function")
719
719
  try {
720
- const u = yield new FontFace(o, i, t.descriptors).load();
720
+ const u = yield new FontFace(n, i, t.descriptors).load();
721
721
  e.fonts.add(u), z.registeredFontKeys.add(r);
722
722
  return;
723
723
  } catch (l) {
724
- console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
724
+ console.warn(`Не удалось загрузить шрифт "${n}" через FontFace API`, l);
725
725
  }
726
726
  z.injectFontFace({
727
727
  font: t,
@@ -736,14 +736,14 @@ const z = class z {
736
736
  font: t,
737
737
  source: e,
738
738
  doc: s,
739
- registrationKey: o
739
+ registrationKey: n
740
740
  }) {
741
741
  var d;
742
- const { descriptors: n } = t, i = (d = t.family) == null ? void 0 : d.trim();
742
+ const { descriptors: o } = t, i = (d = t.family) == null ? void 0 : d.trim();
743
743
  if (!i) return;
744
744
  const a = s.createElement("style");
745
- a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", o);
746
- const r = z.descriptorsToCss(n), c = [
745
+ a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", n);
746
+ const r = z.descriptorsToCss(o), c = [
747
747
  "@font-face {",
748
748
  ` font-family: ${z.formatFontFamilyForCss(i)};`,
749
749
  ` src: ${e};`,
@@ -751,7 +751,7 @@ const z = class z {
751
751
  "}"
752
752
  ];
753
753
  a.textContent = c.join(`
754
- `), s.head.appendChild(a), z.registeredFontKeys.add(o);
754
+ `), s.head.appendChild(a), z.registeredFontKeys.add(n);
755
755
  }
756
756
  static normalizeFontSource(t) {
757
757
  const e = t.trim();
@@ -762,8 +762,8 @@ const z = class z {
762
762
  }
763
763
  static normalizeDescriptorValue(t, e) {
764
764
  if (typeof t == "string") {
765
- const o = t.trim();
766
- return o.length > 0 ? o : e;
765
+ const n = t.trim();
766
+ return n.length > 0 ? n : e;
767
767
  }
768
768
  if (t == null)
769
769
  return e;
@@ -802,13 +802,13 @@ const z = class z {
802
802
  ].join("::");
803
803
  }
804
804
  static isFontFaceAlreadyApplied(t, e, s) {
805
- const o = t.fonts;
806
- if (!o || typeof o.forEach != "function") return !1;
807
- const n = z.normalizeFamilyName(e);
805
+ const n = t.fonts;
806
+ if (!n || typeof n.forEach != "function") return !1;
807
+ const o = z.normalizeFamilyName(e);
808
808
  let i = !1;
809
809
  try {
810
- o.forEach((a) => {
811
- if (i || z.normalizeFamilyName(a.family) !== n) return;
810
+ n.forEach((a) => {
811
+ if (i || z.normalizeFamilyName(a.family) !== o) return;
812
812
  const c = z.getDescriptorSnapshot({
813
813
  style: a.style,
814
814
  weight: a.weight,
@@ -839,9 +839,9 @@ const z = class z {
839
839
  descentOverride: "descent-override",
840
840
  lineGapOverride: "line-gap-override"
841
841
  };
842
- return Object.entries(t).filter(([, s]) => s != null && `${s}`.length > 0).map(([s, o]) => {
842
+ return Object.entries(t).filter(([, s]) => s != null && `${s}`.length > 0).map(([s, n]) => {
843
843
  var i;
844
- return `${(i = e[s]) != null ? i : s}: ${o};`;
844
+ return `${(i = e[s]) != null ? i : s}: ${n};`;
845
845
  });
846
846
  }
847
847
  };
@@ -854,8 +854,8 @@ z.registeredFontKeys = /* @__PURE__ */ new Set(), z.descriptorDefaults = {
854
854
  featureSettings: "normal",
855
855
  display: "auto"
856
856
  };
857
- let ge = z;
858
- const Rs = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", _s = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuNWMwLS42OS41Ni0xLjI1IDEuMjUtMS4yNWgxMi41Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djguNzVjMCAuNjktLjU2IDEuMjUtMS4yNSAxLjI1SDMuNzVjLS42OSAwLTEuMjUtLjU2LTEuMjUtMS4yNVY3LjVabTEzLjc1IDBIMy43NXY4Ljc1aDEyLjVWNy41WiIgY2xpcC1ydWxl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IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", Us = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI0VDNEU0MCIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNOC4xMjUgMS4yNUExLjg3NSAxLjg3NSAwIDAgMCA2LjI1IDMuMTI1di42MjVIMy4xMjVhLjYyNS42MjUgMCAwIDAgMCAxLjI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Pt = {
859
859
  style: {
860
860
  position: "absolute",
861
861
  display: "none",
@@ -965,11 +965,11 @@ class Ps {
965
965
  _initToolbar() {
966
966
  if (!this.options.showToolbar) return;
967
967
  const t = this.options.toolbar || {};
968
- this.config = yt(B(B({}, Ut), t), {
969
- style: B(B({}, Ut.style), t.style || {}),
970
- btnStyle: B(B({}, Ut.btnStyle), t.btnStyle || {}),
971
- icons: B(B({}, Ut.icons), t.icons || {}),
972
- handlers: B(B({}, Ut.handlers), t.handlers || {})
968
+ this.config = vt(B(B({}, Pt), t), {
969
+ style: B(B({}, Pt.style), t.style || {}),
970
+ btnStyle: B(B({}, Pt.btnStyle), t.btnStyle || {}),
971
+ icons: B(B({}, Pt.icons), t.icons || {}),
972
+ handlers: B(B({}, Pt.handlers), t.handlers || {})
973
973
  }), 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 = () => {
974
974
  this.el.style.display = "none";
975
975
  }, this._createDOM(), this._bindEvents();
@@ -980,11 +980,11 @@ class Ps {
980
980
  _createDOM() {
981
981
  const { style: t } = this.config;
982
982
  this.el = document.createElement("div"), Object.assign(this.el.style, t), this.canvas.wrapperEl.appendChild(this.el), this._onBtnOver = (e) => {
983
- const o = e.target.closest("button");
984
- o && Object.assign(o.style, this.config.btnHover);
983
+ const n = e.target.closest("button");
984
+ n && Object.assign(n.style, this.config.btnHover);
985
985
  }, this._onBtnOut = (e) => {
986
- const o = e.target.closest("button");
987
- o && Object.assign(o.style, this.config.btnStyle);
986
+ const n = e.target.closest("button");
987
+ n && Object.assign(n.style, this.config.btnStyle);
988
988
  }, this.el.addEventListener("mouseover", this._onBtnOver), this.el.addEventListener("mouseout", this._onBtnOut);
989
989
  }
990
990
  /**
@@ -996,10 +996,10 @@ class Ps {
996
996
  _renderButtons(t) {
997
997
  this.el.innerHTML = "";
998
998
  for (const e of t) {
999
- const { name: s, handle: o } = e, { icons: n = {}, btnStyle: i, handlers: a = {} } = this.config, r = document.createElement("button");
1000
- r.innerHTML = n[o] ? `<img src="${n[o]}" title="${s}" />` : s, Object.assign(r.style, i), r.onclick = () => {
999
+ const { name: s, handle: n } = e, { icons: o = {}, btnStyle: i, handlers: a = {} } = this.config, r = document.createElement("button");
1000
+ r.innerHTML = o[n] ? `<img src="${o[n]}" title="${s}" />` : s, Object.assign(r.style, i), r.onclick = () => {
1001
1001
  var c;
1002
- return (c = a[o]) == null ? void 0 : c.call(a, this.editor);
1002
+ return (c = a[n]) == null ? void 0 : c.call(a, this.editor);
1003
1003
  }, r.onmousedown = (c) => {
1004
1004
  c.stopPropagation(), c.preventDefault();
1005
1005
  }, r.ondragstart = (c) => c.preventDefault(), this.el.appendChild(r);
@@ -1070,9 +1070,9 @@ class Ps {
1070
1070
  this.el.style.display = "none";
1071
1071
  return;
1072
1072
  }
1073
- const { el: e, config: s, canvas: o } = this;
1073
+ const { el: e, config: s, canvas: n } = this;
1074
1074
  t.setCoords();
1075
- const n = o.getZoom(), [, , , , i, a] = o.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: d } = t.getBoundingRect(), u = r * n + i - e.offsetWidth / 2, g = s.offsetTop || 0, f = (c + d) * n + a + g;
1075
+ const o = n.getZoom(), [, , , , i, a] = n.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: d } = t.getBoundingRect(), u = r * o + i - e.offsetWidth / 2, g = s.offsetTop || 0, f = (c + d) * o + a + g;
1076
1076
  Object.assign(e.style, {
1077
1077
  left: `${u}px`,
1078
1078
  top: `${f}px`,
@@ -1086,7 +1086,7 @@ class Ps {
1086
1086
  this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), 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:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
1087
1087
  }
1088
1088
  }
1089
- const Fs = {
1089
+ const Ws = {
1090
1090
  position: "absolute",
1091
1091
  display: "none",
1092
1092
  background: "#2B2D33",
@@ -1100,8 +1100,8 @@ const Fs = {
1100
1100
  "pointer-events": "none",
1101
1101
  "white-space": "nowrap",
1102
1102
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
1103
- }, Fe = 16, We = 16, Ws = "fabric-editor-angle-indicator";
1104
- class be {
1103
+ }, We = 16, Fe = 16, Fs = "fabric-editor-angle-indicator";
1104
+ class we {
1105
1105
  constructor({ editor: t }) {
1106
1106
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
1107
1107
  }
@@ -1109,7 +1109,7 @@ class be {
1109
1109
  * Создание DOM-элемента индикатора
1110
1110
  */
1111
1111
  _createDOM() {
1112
- this.el = document.createElement("div"), this.el.className = Ws, Object.entries(Fs).forEach(([t, e]) => {
1112
+ this.el = document.createElement("div"), this.el.className = Fs, Object.entries(Ws).forEach(([t, e]) => {
1113
1113
  this.el.style.setProperty(t, e);
1114
1114
  }), this.canvas.wrapperEl.appendChild(this.el);
1115
1115
  }
@@ -1129,7 +1129,7 @@ class be {
1129
1129
  return;
1130
1130
  }
1131
1131
  const s = e.angle || 0;
1132
- this.currentAngle = be._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1132
+ this.currentAngle = we._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1133
1133
  }
1134
1134
  /**
1135
1135
  * Обработчик отпускания кнопки мыши
@@ -1160,9 +1160,9 @@ class be {
1160
1160
  */
1161
1161
  _positionIndicator(t) {
1162
1162
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1163
- let s = t.clientX - e.left + Fe, o = t.clientY - e.top + We;
1164
- const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
1165
- s + i > e.width && (s = t.clientX - e.left - i - Fe), o + a > e.height && (o = t.clientY - e.top - a - We), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1163
+ let s = t.clientX - e.left + We, n = t.clientY - e.top + Fe;
1164
+ const o = this.el.getBoundingClientRect(), i = o.width, a = o.height;
1165
+ s + i > e.width && (s = t.clientX - e.left - i - We), n + a > e.height && (n = t.clientY - e.top - a - Fe), this.el.style.left = `${s}px`, this.el.style.top = `${n}px`;
1166
1166
  }
1167
1167
  /**
1168
1168
  * Показать индикатор
@@ -1242,7 +1242,7 @@ class Ys {
1242
1242
  _createDiffPatcher() {
1243
1243
  this.diffPatcher = bs({
1244
1244
  objectHash(t) {
1245
- const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "", n = e.customData ? JSON.stringify(e.customData) : "";
1245
+ const e = t, s = t, n = s.styles ? JSON.stringify(s.styles) : "", o = e.customData ? JSON.stringify(e.customData) : "";
1246
1246
  return [
1247
1247
  e.id,
1248
1248
  e.backgroundId,
@@ -1258,7 +1258,7 @@ class Ys {
1258
1258
  e.scaleY,
1259
1259
  e.angle,
1260
1260
  e.opacity,
1261
- n,
1261
+ o,
1262
1262
  s.text,
1263
1263
  s.textCaseRaw,
1264
1264
  s.uppercase,
@@ -1272,7 +1272,7 @@ class Ys {
1272
1272
  s.fill,
1273
1273
  s.stroke,
1274
1274
  s.strokeWidth,
1275
- o,
1275
+ n,
1276
1276
  s.paddingTop,
1277
1277
  s.paddingRight,
1278
1278
  s.paddingBottom,
@@ -1320,10 +1320,10 @@ class Ys {
1320
1320
  */
1321
1321
  getFullState() {
1322
1322
  const { baseState: t, currentIndex: e, patches: s } = this;
1323
- let o = JSON.parse(JSON.stringify(t));
1324
- for (let n = 0; n < e; n += 1)
1325
- o = this.diffPatcher.patch(o, s[n].diff);
1326
- return console.log("getFullState state", o), o;
1323
+ let n = JSON.parse(JSON.stringify(t));
1324
+ for (let o = 0; o < e; o += 1)
1325
+ n = this.diffPatcher.patch(n, s[o].diff);
1326
+ return console.log("getFullState state", n), n;
1327
1327
  }
1328
1328
  /**
1329
1329
  * Сохраняем текущее состояние в виде диффа от последнего сохранённого полного состояния.
@@ -1359,14 +1359,14 @@ class Ys {
1359
1359
  return k(this, null, function* () {
1360
1360
  if (!t) return;
1361
1361
  console.log("loadStateFromFullState fullState", t);
1362
- const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
1363
- o.overlayMask = null, yield e.loadFromJSON(t);
1362
+ const { canvas: e, canvasManager: s, interactionBlocker: n, backgroundManager: o } = this.editor, { width: i, height: a } = e;
1363
+ n.overlayMask = null, yield e.loadFromJSON(t);
1364
1364
  const r = e.getObjects().find((l) => l.id === "montage-area");
1365
1365
  r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1366
1366
  const c = e.getObjects().find((l) => l.id === "overlay-mask");
1367
- c && (o.overlayMask = c, o.overlayMask.visible = !1);
1367
+ c && (n.overlayMask = c, n.overlayMask.visible = !1);
1368
1368
  const d = e.getObjects().find((l) => l.id === "background");
1369
- d ? (n.backgroundObject = d, n.refresh()) : n.removeBackground({ withoutSave: !0 }), e.renderAll(), e.fire("editor:history-state-loaded", {
1369
+ d ? (o.backgroundObject = d, o.refresh()) : o.removeBackground({ withoutSave: !0 }), e.renderAll(), e.fire("editor:history-state-loaded", {
1370
1370
  fullState: t,
1371
1371
  currentIndex: this.currentIndex,
1372
1372
  totalChangesCount: this.totalChangesCount,
@@ -1451,9 +1451,9 @@ class Ys {
1451
1451
  });
1452
1452
  }
1453
1453
  _withTemporaryUnlock(t) {
1454
- var o, n, i;
1454
+ var n, o, i;
1455
1455
  const e = [];
1456
- ((i = (n = (o = this.canvas).getObjects) == null ? void 0 : n.call(o)) != null ? i : []).forEach((a) => {
1456
+ ((i = (o = (n = this.canvas).getObjects) == null ? void 0 : o.call(n)) != null ? i : []).forEach((a) => {
1457
1457
  const r = typeof a.type == "string" ? a.type.toLowerCase() : "";
1458
1458
  if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean") || a.locked) return;
1459
1459
  const d = !!a.lockMovementX, l = !!a.lockMovementY;
@@ -1473,7 +1473,7 @@ class Ys {
1473
1473
  }
1474
1474
  }
1475
1475
  }
1476
- const Hs = 0.1, Zs = 2, Ye = 0.1, Gs = 90, Rt = 16, _t = 16, Mt = 4096, wt = 4096, He = "application/image-editor:", Kt = [
1476
+ const Hs = 0.1, Zs = 2, Ye = 0.1, Gs = 90, Rt = 16, _t = 16, wt = 4096, St = 4096, He = "application/image-editor:", Qt = [
1477
1477
  "format",
1478
1478
  "uppercase",
1479
1479
  "textCaseRaw",
@@ -1509,8 +1509,8 @@ class ct {
1509
1509
  const {
1510
1510
  source: e,
1511
1511
  scale: s = `image-${this.options.scaleType}`,
1512
- withoutSave: o = !1,
1513
- fromClipboard: n = !1,
1512
+ withoutSave: n = !1,
1513
+ fromClipboard: o = !1,
1514
1514
  isBackground: i = !1,
1515
1515
  withoutSelection: a = !1,
1516
1516
  withoutAdding: r = !1
@@ -1530,7 +1530,7 @@ class ct {
1530
1530
  contentType: f,
1531
1531
  acceptContentTypes: m,
1532
1532
  acceptFormats: v,
1533
- fromClipboard: n,
1533
+ fromClipboard: o,
1534
1534
  isBackground: i,
1535
1535
  withoutSelection: a,
1536
1536
  withoutAdding: r
@@ -1557,7 +1557,7 @@ class ct {
1557
1557
  contentType: f,
1558
1558
  acceptContentTypes: m,
1559
1559
  acceptFormats: v,
1560
- fromClipboard: n,
1560
+ fromClipboard: o,
1561
1561
  isBackground: i,
1562
1562
  withoutSelection: a,
1563
1563
  withoutAdding: r
@@ -1567,17 +1567,17 @@ class ct {
1567
1567
  const j = yield hs(M);
1568
1568
  S = dt.groupSVGElements(j.objects, j.options);
1569
1569
  } else
1570
- S = yield zt.fromURL(M, { crossOrigin: "anonymous" });
1570
+ S = yield Ut.fromURL(M, { crossOrigin: "anonymous" });
1571
1571
  const { width: y, height: b } = S;
1572
- if (S instanceof zt) {
1572
+ if (S instanceof Ut) {
1573
1573
  const j = S.getElement();
1574
1574
  let A = "";
1575
- if (j instanceof HTMLImageElement ? A = j.src : j instanceof HTMLCanvasElement && (A = j.toDataURL()), b > wt || y > Mt) {
1575
+ if (j instanceof HTMLImageElement ? A = j.src : j instanceof HTMLCanvasElement && (A = j.toDataURL()), b > St || y > wt) {
1576
1576
  const C = yield this.resizeImageToBoundaries(A, "max"), w = URL.createObjectURL(C);
1577
- this._createdBlobUrls.push(w), S = yield zt.fromURL(w, { crossOrigin: "anonymous" });
1577
+ this._createdBlobUrls.push(w), S = yield Ut.fromURL(w, { crossOrigin: "anonymous" });
1578
1578
  } else if (b < _t || y < Rt) {
1579
1579
  const C = yield this.resizeImageToBoundaries(A, "min"), w = URL.createObjectURL(C);
1580
- this._createdBlobUrls.push(w), S = yield zt.fromURL(w, { crossOrigin: "anonymous" });
1580
+ this._createdBlobUrls.push(w), S = yield Ut.fromURL(w, { crossOrigin: "anonymous" });
1581
1581
  }
1582
1582
  }
1583
1583
  if (S.set("id", `${S.type}-${V()}`), S.set("format", p), s === "scale-montage")
@@ -1591,14 +1591,14 @@ class ct {
1591
1591
  format: p,
1592
1592
  contentType: f,
1593
1593
  scale: s,
1594
- withoutSave: o,
1594
+ withoutSave: n,
1595
1595
  source: e,
1596
- fromClipboard: n,
1596
+ fromClipboard: o,
1597
1597
  isBackground: i,
1598
1598
  withoutSelection: a,
1599
1599
  withoutAdding: r
1600
1600
  };
1601
- return r ? (u.resumeHistory(), c.fire("editor:image-imported", I), I) : (c.add(S), c.centerObject(S), a || c.setActiveObject(S), c.renderAll(), u.resumeHistory(), o || u.saveState(), c.fire("editor:image-imported", I), I);
1601
+ return r ? (u.resumeHistory(), c.fire("editor:image-imported", I), I) : (c.add(S), c.centerObject(S), a || c.setActiveObject(S), c.renderAll(), u.resumeHistory(), n || u.saveState(), c.fire("editor:image-imported", I), I);
1602
1602
  } catch (M) {
1603
1603
  return g.emitError({
1604
1604
  origin: "ImageManager",
@@ -1610,8 +1610,8 @@ class ct {
1610
1610
  format: p,
1611
1611
  contentType: f,
1612
1612
  scale: s,
1613
- withoutSave: o,
1614
- fromClipboard: n,
1613
+ withoutSave: n,
1614
+ fromClipboard: o,
1615
1615
  isBackground: i,
1616
1616
  withoutSelection: a,
1617
1617
  withoutAdding: r
@@ -1630,13 +1630,13 @@ class ct {
1630
1630
  */
1631
1631
  resizeImageToBoundaries(t, e = "max") {
1632
1632
  return k(this, null, function* () {
1633
- let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${Mt}x${wt}`;
1633
+ let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${wt}x${St}`;
1634
1634
  e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${Rt}x${_t}`);
1635
- const o = {
1635
+ const n = {
1636
1636
  dataURL: t,
1637
1637
  sizeType: e,
1638
- maxWidth: Mt,
1639
- maxHeight: wt,
1638
+ maxWidth: wt,
1639
+ maxHeight: St,
1640
1640
  minWidth: Rt,
1641
1641
  minHeight: _t
1642
1642
  };
@@ -1645,8 +1645,8 @@ class ct {
1645
1645
  method: "resizeImageToBoundaries",
1646
1646
  code: "IMAGE_RESIZE_WARNING",
1647
1647
  message: s,
1648
- data: o
1649
- }), this.editor.workerManager.post("resizeImage", o);
1648
+ data: n
1649
+ }), this.editor.workerManager.post("resizeImage", n);
1650
1650
  });
1651
1651
  }
1652
1652
  /**
@@ -1665,8 +1665,8 @@ class ct {
1665
1665
  const {
1666
1666
  fileName: e = "image.png",
1667
1667
  contentType: s = "image/png",
1668
- exportAsBase64: o = !1,
1669
- exportAsBlob: n = !1
1668
+ exportAsBase64: n = !1,
1669
+ exportAsBlob: o = !1
1670
1670
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
1671
1671
  try {
1672
1672
  const d = s === "application/pdf", l = d ? "image/jpg" : s, u = ct.getFormatFromContentType(l);
@@ -1685,8 +1685,8 @@ class ct {
1685
1685
  v.dispose();
1686
1686
  const E = {
1687
1687
  image: ct._exportSVGStringAsFile(w, {
1688
- exportAsBase64: o,
1689
- exportAsBlob: n,
1688
+ exportAsBase64: n,
1689
+ exportAsBlob: o,
1690
1690
  fileName: e
1691
1691
  }),
1692
1692
  format: "svg",
@@ -1700,7 +1700,7 @@ class ct {
1700
1700
  E ? w(E) : T(new Error("Failed to create Blob from canvas"));
1701
1701
  });
1702
1702
  });
1703
- if (v.dispose(), n) {
1703
+ if (v.dispose(), o) {
1704
1704
  const w = {
1705
1705
  image: y,
1706
1706
  format: u,
@@ -1720,14 +1720,14 @@ class ct {
1720
1720
  unit: "mm",
1721
1721
  format: [T, E]
1722
1722
  });
1723
- if (x.addImage(String(I), "JPG", 0, 0, T, E), o) {
1724
- const W = {
1723
+ if (x.addImage(String(I), "JPG", 0, 0, T, E), n) {
1724
+ const F = {
1725
1725
  image: x.output("datauristring"),
1726
1726
  format: "pdf",
1727
1727
  contentType: "application/pdf",
1728
1728
  fileName: e
1729
1729
  };
1730
- return i.fire("editor:canvas-exported", W), W;
1730
+ return i.fire("editor:canvas-exported", F), F;
1731
1731
  }
1732
1732
  const N = x.output("blob"), D = {
1733
1733
  image: new File([N], e, { type: "application/pdf" }),
@@ -1737,7 +1737,7 @@ class ct {
1737
1737
  };
1738
1738
  return i.fire("editor:canvas-exported", D), D;
1739
1739
  }
1740
- if (o) {
1740
+ if (n) {
1741
1741
  const w = {
1742
1742
  image: I,
1743
1743
  format: u,
@@ -1759,7 +1759,7 @@ class ct {
1759
1759
  method: "exportCanvasAsImageFile",
1760
1760
  code: "IMAGE_EXPORT_FAILED",
1761
1761
  message: `Ошибка экспорта изображения: ${d.message}`,
1762
- data: { contentType: s, fileName: e, exportAsBase64: o, exportAsBlob: n }
1762
+ data: { contentType: s, fileName: e, exportAsBase64: n, exportAsBlob: o }
1763
1763
  }), null;
1764
1764
  }
1765
1765
  });
@@ -1780,8 +1780,8 @@ class ct {
1780
1780
  const {
1781
1781
  object: e,
1782
1782
  fileName: s = "image.png",
1783
- contentType: o = "image/png",
1784
- exportAsBase64: n = !1,
1783
+ contentType: n = "image/png",
1784
+ exportAsBase64: o = !1,
1785
1785
  exportAsBlob: i = !1
1786
1786
  } = t, { canvas: a, workerManager: r } = this.editor, c = e || a.getActiveObject();
1787
1787
  if (!c)
@@ -1790,13 +1790,13 @@ class ct {
1790
1790
  method: "exportObjectAsImageFile",
1791
1791
  code: "NO_OBJECT_SELECTED",
1792
1792
  message: "Не выбран объект для экспорта",
1793
- data: { contentType: o, fileName: s, exportAsBase64: n, exportAsBlob: i }
1793
+ data: { contentType: n, fileName: s, exportAsBase64: o, exportAsBlob: i }
1794
1794
  }), null;
1795
1795
  try {
1796
- const d = ct.getFormatFromContentType(o);
1796
+ const d = ct.getFormatFromContentType(n);
1797
1797
  if (d === "svg") {
1798
1798
  const p = c.toSVG(), m = ct._exportSVGStringAsFile(p, {
1799
- exportAsBase64: n,
1799
+ exportAsBase64: o,
1800
1800
  exportAsBlob: i,
1801
1801
  fileName: s
1802
1802
  }), v = {
@@ -1808,7 +1808,7 @@ class ct {
1808
1808
  };
1809
1809
  return a.fire("editor:object-exported", v), v;
1810
1810
  }
1811
- if (n && c instanceof zt) {
1811
+ if (o && c instanceof Ut) {
1812
1812
  const p = yield createImageBitmap(c.getElement()), m = yield r.post(
1813
1813
  "toDataURL",
1814
1814
  {
@@ -1821,7 +1821,7 @@ class ct {
1821
1821
  object: c,
1822
1822
  image: m,
1823
1823
  format: d,
1824
- contentType: o,
1824
+ contentType: n,
1825
1825
  fileName: s
1826
1826
  };
1827
1827
  return a.fire("editor:object-exported", v), v;
@@ -1838,16 +1838,16 @@ class ct {
1838
1838
  object: c,
1839
1839
  image: u,
1840
1840
  format: d,
1841
- contentType: o,
1841
+ contentType: n,
1842
1842
  fileName: s
1843
1843
  };
1844
1844
  return a.fire("editor:object-exported", p), p;
1845
1845
  }
1846
- const g = new File([u], s, { type: o }), f = {
1846
+ const g = new File([u], s, { type: n }), f = {
1847
1847
  object: c,
1848
1848
  image: g,
1849
1849
  format: d,
1850
- contentType: o,
1850
+ contentType: n,
1851
1851
  fileName: s
1852
1852
  };
1853
1853
  return a.fire("editor:object-exported", f), f;
@@ -1857,7 +1857,7 @@ class ct {
1857
1857
  method: "exportObjectAsImageFile",
1858
1858
  code: "IMAGE_EXPORT_FAILED",
1859
1859
  message: `Ошибка экспорта объекта: ${d.message}`,
1860
- data: { contentType: o, fileName: s, exportAsBase64: n, exportAsBlob: i }
1860
+ data: { contentType: n, fileName: s, exportAsBase64: o, exportAsBlob: i }
1861
1861
  }), null;
1862
1862
  }
1863
1863
  });
@@ -1924,11 +1924,11 @@ class ct {
1924
1924
  getContentTypeFromExtension(t) {
1925
1925
  var e;
1926
1926
  try {
1927
- const o = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), n = {};
1927
+ const n = (e = new URL(t).pathname.split(".").pop()) == null ? void 0 : e.toLowerCase(), o = {};
1928
1928
  return this.acceptContentTypes.forEach((i) => {
1929
1929
  const a = ct.getFormatFromContentType(i);
1930
- a && (n[a] = i);
1931
- }), o && n[o] || "application/octet-stream";
1930
+ a && (o[a] = i);
1931
+ }), n && o[n] || "application/octet-stream";
1932
1932
  } catch (s) {
1933
1933
  return console.warn("Не удалось определить расширение из URL:", t, s), "application/octet-stream";
1934
1934
  }
@@ -1946,8 +1946,8 @@ class ct {
1946
1946
  }) {
1947
1947
  const { montageArea: s } = this.editor;
1948
1948
  if (!s || !t) return 1;
1949
- const o = s.width, n = s.height, { width: i, height: a } = t;
1950
- return e === "contain" || e === "image-contain" ? Math.min(o / i, n / a) : e === "cover" || e === "image-cover" ? Math.max(o / i, n / a) : 1;
1949
+ const n = s.width, o = s.height, { width: i, height: a } = t;
1950
+ return e === "contain" || e === "image-contain" ? Math.min(n / i, o / a) : e === "cover" || e === "image-cover" ? Math.max(n / i, o / a) : 1;
1951
1951
  }
1952
1952
  /**
1953
1953
  * Преобразует SVG-строку в Blob, файл, или base64
@@ -1963,9 +1963,9 @@ class ct {
1963
1963
  static _exportSVGStringAsFile(t, {
1964
1964
  exportAsBase64: e,
1965
1965
  exportAsBlob: s,
1966
- fileName: o = "image.svg"
1966
+ fileName: n = "image.svg"
1967
1967
  } = {}) {
1968
- return s ? new Blob([t], { type: "image/svg+xml" }) : e ? `data:image/svg+xml;base64,${window.btoa(encodeURIComponent(t))}` : new File([t], o.replace(/\.[^/.]+$/, ".svg"), { type: "image/svg+xml" });
1968
+ return s ? new Blob([t], { type: "image/svg+xml" }) : e ? `data:image/svg+xml;base64,${window.btoa(encodeURIComponent(t))}` : new File([t], n.replace(/\.[^/.]+$/, ".svg"), { type: "image/svg+xml" });
1969
1969
  }
1970
1970
  /**
1971
1971
  * Извлекает чистый формат (subtype) из contentType,
@@ -2007,25 +2007,25 @@ class Qs {
2007
2007
  * @param options.adaptCanvasToContainer - Адаптировать канвас к контейнеру
2008
2008
  * @fires editor:resolution-width-changed
2009
2009
  */
2010
- setResolutionWidth(t, { preserveProportional: e, withoutSave: s, adaptCanvasToContainer: o } = {}) {
2010
+ setResolutionWidth(t, { preserveProportional: e, withoutSave: s, adaptCanvasToContainer: n } = {}) {
2011
2011
  var f;
2012
2012
  if (!t) return;
2013
2013
  const {
2014
- canvas: n,
2014
+ canvas: o,
2015
2015
  montageArea: i,
2016
2016
  options: { canvasBackstoreWidth: a }
2017
- } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), Rt, Mt);
2018
- if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (f = n.clipPath) == null || f.set({ width: d }), e) {
2017
+ } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), Rt, wt);
2018
+ if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(d), i.set({ width: d }), (f = o.clipPath) == null || f.set({ width: d }), e) {
2019
2019
  const p = d / r, m = Ze(c, p);
2020
2020
  this.setResolutionHeight(m);
2021
2021
  return;
2022
2022
  }
2023
- const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
2024
- n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-width-changed", {
2023
+ const { left: l, top: u } = this.getObjectDefaultCoords(i), g = o.getZoom();
2024
+ o.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-width-changed", {
2025
2025
  width: d,
2026
2026
  preserveProportional: e,
2027
2027
  withoutSave: s,
2028
- adaptCanvasToContainer: o
2028
+ adaptCanvasToContainer: n
2029
2029
  }), this.editor.panConstraintManager.updateBounds();
2030
2030
  }
2031
2031
  /**
@@ -2037,25 +2037,25 @@ class Qs {
2037
2037
  * @param options.adaptCanvasToContainer - Адаптировать канвас к контейнеру
2038
2038
  * @fires editor:resolution-height-changed
2039
2039
  */
2040
- setResolutionHeight(t, { preserveProportional: e, withoutSave: s, adaptCanvasToContainer: o } = {}) {
2040
+ setResolutionHeight(t, { preserveProportional: e, withoutSave: s, adaptCanvasToContainer: n } = {}) {
2041
2041
  var f;
2042
2042
  if (!t) return;
2043
2043
  const {
2044
- canvas: n,
2044
+ canvas: o,
2045
2045
  montageArea: i,
2046
2046
  options: { canvasBackstoreHeight: a }
2047
- } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), _t, wt);
2048
- if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (f = n.clipPath) == null || f.set({ height: d }), e) {
2047
+ } = this.editor, { width: r, height: c } = i, d = Tt(Number(t), _t, St);
2048
+ if (!a || a === "auto" || n ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(d), i.set({ height: d }), (f = o.clipPath) == null || f.set({ height: d }), e) {
2049
2049
  const p = d / c, m = Ze(r, p);
2050
2050
  this.setResolutionWidth(m);
2051
2051
  return;
2052
2052
  }
2053
- const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
2054
- n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-height-changed", {
2053
+ const { left: l, top: u } = this.getObjectDefaultCoords(i), g = o.getZoom();
2054
+ o.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-height-changed", {
2055
2055
  height: d,
2056
2056
  preserveProportional: e,
2057
2057
  withoutSave: s,
2058
- adaptCanvasToContainer: o
2058
+ adaptCanvasToContainer: n
2059
2059
  }), this.editor.panConstraintManager.updateBounds();
2060
2060
  }
2061
2061
  /**
@@ -2064,16 +2064,16 @@ class Qs {
2064
2064
  */
2065
2065
  centerMontageArea() {
2066
2066
  var r;
2067
- const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = Xs(s, o);
2067
+ const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), n = t.getHeight(), o = t.getZoom(), i = Xs(s, n);
2068
2068
  e.set({
2069
2069
  left: s / 2,
2070
- top: o / 2
2070
+ top: n / 2
2071
2071
  }), (r = t.clipPath) == null || r.set({
2072
2072
  left: s / 2,
2073
- top: o / 2
2073
+ top: n / 2
2074
2074
  }), t.renderAll();
2075
2075
  const a = t.viewportTransform;
2076
- a[4] = s / 2 - i.x * n, a[5] = o / 2 - i.y * n, t.setViewportTransform(a), t.renderAll();
2076
+ a[4] = s / 2 - i.x * o, a[5] = n / 2 - i.y * o, t.setViewportTransform(a), t.renderAll();
2077
2077
  }
2078
2078
  /**
2079
2079
  * Метод для получения координат объекта с учетом текущего зума
@@ -2089,7 +2089,7 @@ class Qs {
2089
2089
  code: "NO_ACTIVE_OBJECT",
2090
2090
  message: "Не выбран объект для получения координат"
2091
2091
  }), { left: 0, top: 0 };
2092
- const { width: o, height: n } = s, i = e.getZoom(), a = (o - o * i) / 2, r = (n - n * i) / 2;
2092
+ const { width: n, height: o } = s, i = e.getZoom(), a = (n - n * i) / 2, r = (o - o * i) / 2;
2093
2093
  return { left: a, top: r };
2094
2094
  }
2095
2095
  /**
@@ -2097,7 +2097,7 @@ class Qs {
2097
2097
  */
2098
2098
  setCanvasBackstoreWidth(t) {
2099
2099
  if (!t || typeof t != "number") return;
2100
- const e = Tt(t, Rt, Mt);
2100
+ const e = Tt(t, Rt, wt);
2101
2101
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2102
2102
  }
2103
2103
  /**
@@ -2106,7 +2106,7 @@ class Qs {
2106
2106
  */
2107
2107
  setCanvasBackstoreHeight(t) {
2108
2108
  if (!t || typeof t != "number") return;
2109
- const e = Tt(t, _t, wt);
2109
+ const e = Tt(t, _t, St);
2110
2110
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2111
2111
  }
2112
2112
  /**
@@ -2115,8 +2115,8 @@ class Qs {
2115
2115
  * с учётом минимальных и максимальных значений.
2116
2116
  */
2117
2117
  adaptCanvasToContainer() {
2118
- const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = Tt(s, Rt, Mt), i = Tt(o, _t, wt);
2119
- t.setDimensions({ width: n, height: i }, { backstoreOnly: !0 });
2118
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, n = e.clientHeight, o = Tt(s, Rt, wt), i = Tt(n, _t, St);
2119
+ t.setDimensions({ width: o, height: i }, { backstoreOnly: !0 });
2120
2120
  }
2121
2121
  /**
2122
2122
  * Обновляет размеры канваса без изменения позиций объектов.
@@ -2129,11 +2129,11 @@ class Qs {
2129
2129
  montageArea: e,
2130
2130
  montageArea: {
2131
2131
  width: s,
2132
- height: o
2132
+ height: n
2133
2133
  }
2134
- } = this.editor, n = e.left, i = e.top;
2135
- this.setResolutionWidth(s, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.setResolutionHeight(o, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.centerMontageArea();
2136
- const a = e.left - n, r = e.top - i;
2134
+ } = this.editor, o = e.left, i = e.top;
2135
+ this.setResolutionWidth(s, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.setResolutionHeight(n, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.centerMontageArea();
2136
+ const a = e.left - o, r = e.top - i;
2137
2137
  if (a !== 0 || r !== 0) {
2138
2138
  const c = t.getActiveObject(), d = [];
2139
2139
  if ((c == null ? void 0 : c.type) === "activeselection") {
@@ -2157,7 +2157,7 @@ class Qs {
2157
2157
  }
2158
2158
  t.renderAll(), t.fire("editor:canvas-updated", {
2159
2159
  width: s,
2160
- height: o
2160
+ height: n
2161
2161
  }), this.editor.panConstraintManager.updateBounds();
2162
2162
  }
2163
2163
  /**
@@ -2267,32 +2267,32 @@ class Qs {
2267
2267
  */
2268
2268
  setDisplayDimension({ element: t = "canvas", dimension: e, value: s } = {}) {
2269
2269
  if (!s) return;
2270
- const { canvas: o } = this.editor, n = [];
2270
+ const { canvas: n } = this.editor, o = [];
2271
2271
  switch (t) {
2272
2272
  case "canvas":
2273
- n.push(o.lowerCanvasEl, o.upperCanvasEl);
2273
+ o.push(n.lowerCanvasEl, n.upperCanvasEl);
2274
2274
  break;
2275
2275
  case "wrapper":
2276
- n.push(o.wrapperEl);
2276
+ o.push(n.wrapperEl);
2277
2277
  break;
2278
2278
  case "container":
2279
- n.push(this.getEditorContainer());
2279
+ o.push(this.getEditorContainer());
2280
2280
  break;
2281
2281
  default:
2282
- n.push(o.lowerCanvasEl, o.upperCanvasEl);
2282
+ o.push(n.lowerCanvasEl, n.upperCanvasEl);
2283
2283
  }
2284
2284
  const i = e === "width" ? "width" : "height";
2285
2285
  if (typeof s == "string") {
2286
- n.forEach((r) => {
2286
+ o.forEach((r) => {
2287
2287
  r.style[i] = s;
2288
2288
  });
2289
2289
  return;
2290
2290
  }
2291
2291
  if (isNaN(s)) return;
2292
2292
  const a = `${s}px`;
2293
- n.forEach((r) => {
2293
+ o.forEach((r) => {
2294
2294
  r.style[i] = a;
2295
- }), o.fire(`editor:display-${t}-${i}-changed`, {
2295
+ }), n.fire(`editor:display-${t}-${i}-changed`, {
2296
2296
  element: t,
2297
2297
  value: s
2298
2298
  });
@@ -2307,25 +2307,25 @@ class Qs {
2307
2307
  */
2308
2308
  scaleMontageAreaToImage({ object: t, preserveAspectRatio: e, withoutSave: s } = {}) {
2309
2309
  const {
2310
- canvas: o,
2311
- montageArea: n,
2310
+ canvas: n,
2311
+ montageArea: o,
2312
2312
  transformManager: i,
2313
2313
  options: {
2314
2314
  montageAreaWidth: a,
2315
2315
  montageAreaHeight: r
2316
2316
  }
2317
- } = this.editor, c = t || o.getActiveObject();
2317
+ } = this.editor, c = t || n.getActiveObject();
2318
2318
  if (!Ks(c)) return;
2319
2319
  const { width: d, height: l } = c;
2320
- let u = Math.min(d, Mt), g = Math.min(l, wt);
2320
+ let u = Math.min(d, wt), g = Math.min(l, St);
2321
2321
  if (e) {
2322
2322
  const {
2323
2323
  width: f,
2324
2324
  height: p
2325
- } = n, m = d / f, v = l / p, M = Math.max(m, v);
2325
+ } = o, m = d / f, v = l / p, M = Math.max(m, v);
2326
2326
  u = f * M, g = p * M;
2327
2327
  }
2328
- this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), o.centerObject(c), o.renderAll(), s || this.editor.historyManager.saveState(), o.fire("editor:montage-area-scaled-to-image", {
2328
+ this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > a || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), i.resetObject({ object: c, withoutSave: !0 }), n.centerObject(c), n.renderAll(), s || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
2329
2329
  object: c,
2330
2330
  width: u,
2331
2331
  height: g,
@@ -2351,13 +2351,13 @@ class Qs {
2351
2351
  const {
2352
2352
  canvas: e,
2353
2353
  transformManager: s,
2354
- historyManager: o,
2354
+ historyManager: n,
2355
2355
  options: {
2356
- montageAreaWidth: n,
2356
+ montageAreaWidth: o,
2357
2357
  montageAreaHeight: i
2358
2358
  }
2359
2359
  } = this.editor;
2360
- this.editor.zoomManager.resetZoom(), this.setResolutionWidth(n, { withoutSave: !0 }), this.setResolutionHeight(i, { withoutSave: !0 }), e.renderAll(), s.resetObjects(), t || o.saveState(), e.fire("editor:default-scale-set");
2360
+ this.editor.zoomManager.resetZoom(), this.setResolutionWidth(o, { withoutSave: !0 }), this.setResolutionHeight(i, { withoutSave: !0 }), e.renderAll(), s.resetObjects(), t || n.saveState(), e.fire("editor:default-scale-set");
2361
2361
  }
2362
2362
  /**
2363
2363
  * Получение всех объектов внутри монтажной области редактора
@@ -2368,10 +2368,10 @@ class Qs {
2368
2368
  canvas: t,
2369
2369
  montageArea: e,
2370
2370
  interactionBlocker: { overlayMask: s },
2371
- backgroundManager: { backgroundObject: o }
2371
+ backgroundManager: { backgroundObject: n }
2372
2372
  } = this.editor;
2373
2373
  return t.getObjects().filter(
2374
- (i) => i.id !== e.id && i.id !== (s == null ? void 0 : s.id) && i.id !== (o == null ? void 0 : o.id)
2374
+ (i) => i.id !== e.id && i.id !== (s == null ? void 0 : s.id) && i.id !== (n == null ? void 0 : n.id)
2375
2375
  );
2376
2376
  }
2377
2377
  }
@@ -2387,11 +2387,11 @@ class qs {
2387
2387
  * @fires editor:object-rotated
2388
2388
  */
2389
2389
  rotate(t = Gs, { withoutSave: e } = {}) {
2390
- const { canvas: s, historyManager: o } = this.editor, n = s.getActiveObject();
2391
- if (!n) return;
2392
- const i = n.angle + t;
2393
- n.rotate(i), n.setCoords(), s.renderAll(), e || o.saveState(), s.fire("editor:object-rotated", {
2394
- object: n,
2390
+ const { canvas: s, historyManager: n } = this.editor, o = s.getActiveObject();
2391
+ if (!o) return;
2392
+ const i = o.angle + t;
2393
+ o.rotate(i), o.setCoords(), s.renderAll(), e || n.saveState(), s.fire("editor:object-rotated", {
2394
+ object: o,
2395
2395
  withoutSave: e,
2396
2396
  angle: i
2397
2397
  });
@@ -2403,9 +2403,9 @@ class qs {
2403
2403
  * @fires editor:object-flipped-x
2404
2404
  */
2405
2405
  flipX({ withoutSave: t } = {}) {
2406
- const { canvas: e, historyManager: s } = this.editor, o = e.getActiveObject();
2407
- o && (o.flipX = !o.flipX, e.renderAll(), t || s.saveState(), e.fire("editor:object-flipped-x", {
2408
- object: o,
2406
+ const { canvas: e, historyManager: s } = this.editor, n = e.getActiveObject();
2407
+ n && (n.flipX = !n.flipX, e.renderAll(), t || s.saveState(), e.fire("editor:object-flipped-x", {
2408
+ object: n,
2409
2409
  withoutSave: t
2410
2410
  }));
2411
2411
  }
@@ -2416,9 +2416,9 @@ class qs {
2416
2416
  * @fires editor:object-flipped-y
2417
2417
  */
2418
2418
  flipY({ withoutSave: t } = {}) {
2419
- const { canvas: e, historyManager: s } = this.editor, o = e.getActiveObject();
2420
- o && (o.flipY = !o.flipY, e.renderAll(), t || s.saveState(), e.fire("editor:object-flipped-y", {
2421
- object: o,
2419
+ const { canvas: e, historyManager: s } = this.editor, n = e.getActiveObject();
2420
+ n && (n.flipY = !n.flipY, e.renderAll(), t || s.saveState(), e.fire("editor:object-flipped-y", {
2421
+ object: n,
2422
2422
  withoutSave: t
2423
2423
  }));
2424
2424
  }
@@ -2435,10 +2435,10 @@ class qs {
2435
2435
  opacity: e = 1,
2436
2436
  withoutSave: s
2437
2437
  } = {}) {
2438
- const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
2438
+ const { canvas: n, historyManager: o } = this.editor, i = t || n.getActiveObject();
2439
2439
  i && (i instanceof U ? i.getObjects().forEach((a) => {
2440
2440
  a.set("opacity", e);
2441
- }) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
2441
+ }) : i.set("opacity", e), n.renderAll(), s || o.saveState(), n.fire("editor:object-opacity-changed", {
2442
2442
  object: i,
2443
2443
  opacity: e,
2444
2444
  withoutSave: s
@@ -2459,24 +2459,24 @@ class qs {
2459
2459
  object: t,
2460
2460
  type: e = this.options.scaleType,
2461
2461
  withoutSave: s,
2462
- fitAsOneObject: o
2462
+ fitAsOneObject: n
2463
2463
  } = {}) {
2464
- const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
2464
+ const { canvas: o, historyManager: i } = this.editor, a = t || o.getActiveObject();
2465
2465
  if (a) {
2466
- if (a instanceof U && !o) {
2466
+ if (a instanceof U && !n) {
2467
2467
  const r = a.getObjects();
2468
- n.discardActiveObject(), r.forEach((d) => {
2468
+ o.discardActiveObject(), r.forEach((d) => {
2469
2469
  this._fitSingleObject(d, e);
2470
2470
  });
2471
- const c = new U(r, { canvas: n });
2472
- n.setActiveObject(c);
2471
+ const c = new U(r, { canvas: o });
2472
+ o.setActiveObject(c);
2473
2473
  } else
2474
2474
  this._fitSingleObject(a, e);
2475
- n.renderAll(), s || i.saveState(), n.fire("editor:object-fitted", {
2475
+ o.renderAll(), s || i.saveState(), o.fire("editor:object-fitted", {
2476
2476
  object: a,
2477
2477
  type: e,
2478
2478
  withoutSave: s,
2479
- fitAsOneObject: o
2479
+ fitAsOneObject: n
2480
2480
  });
2481
2481
  }
2482
2482
  }
@@ -2487,7 +2487,7 @@ class qs {
2487
2487
  * @private
2488
2488
  */
2489
2489
  _fitSingleObject(t, e) {
2490
- const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = n * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), p = d * g + l * f, m = d * f + l * g, v = o.width, M = o.height;
2490
+ const { canvas: s, montageArea: n } = this.editor, { width: o, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, d = o * Math.abs(a), l = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), p = d * g + l * f, m = d * f + l * g, v = n.width, M = n.height;
2491
2491
  let S;
2492
2492
  e === "contain" ? S = Math.min(v / p, M / m) : S = Math.max(v / p, M / m), t.set({
2493
2493
  scaleX: a * S,
@@ -2512,12 +2512,12 @@ class qs {
2512
2512
  */
2513
2513
  resetObject({ object: t, alwaysFitObject: e = !1, withoutSave: s = !1 } = {}) {
2514
2514
  const {
2515
- canvas: o,
2516
- montageArea: n,
2515
+ canvas: n,
2516
+ montageArea: o,
2517
2517
  imageManager: i,
2518
2518
  historyManager: a,
2519
2519
  options: { scaleType: r }
2520
- } = this.editor, c = t || o.getActiveObject();
2520
+ } = this.editor, c = t || n.getActiveObject();
2521
2521
  if (!c || c.locked) return;
2522
2522
  if (a.suspendHistory(), c.type === "image" || c.format === "svg" || c.set({
2523
2523
  scaleX: 1,
@@ -2528,13 +2528,13 @@ class qs {
2528
2528
  }), e)
2529
2529
  this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
2530
2530
  else {
2531
- const { width: l, height: u } = n, { width: g, height: f } = c, p = i.calculateScaleFactor({
2531
+ const { width: l, height: u } = o, { width: g, height: f } = c, p = i.calculateScaleFactor({
2532
2532
  imageObject: c,
2533
2533
  scaleType: r
2534
2534
  });
2535
2535
  r === "contain" && p < 1 || r === "cover" && (g > l || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2536
2536
  }
2537
- c.set({ flipX: !1, flipY: !1, angle: 0 }), o.centerObject(c), o.renderAll(), a.resumeHistory(), s || a.saveState(), o.fire("editor:object-reset", {
2537
+ c.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(c), n.renderAll(), a.resumeHistory(), s || a.saveState(), n.fire("editor:object-reset", {
2538
2538
  object: c,
2539
2539
  withoutSave: s,
2540
2540
  alwaysFitObject: e
@@ -2565,7 +2565,7 @@ class Js {
2565
2565
  * @private
2566
2566
  */
2567
2567
  _getClampedPointerCoordinates(t) {
2568
- const { canvas: e, montageArea: s } = this.editor, o = e.getPointer(t, !0), n = e.viewportTransform, i = e.getZoom(), 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 = a * i + n[4], u = r * i + n[4], g = c * i + n[5], f = d * i + n[5], p = Math.max(l, Math.min(u, o.x)), m = Math.max(g, Math.min(f, o.y));
2568
+ const { canvas: e, montageArea: s } = this.editor, n = e.getPointer(t, !0), o = e.viewportTransform, i = e.getZoom(), 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 = a * i + o[4], u = r * i + o[4], g = c * i + o[5], f = d * i + o[5], p = Math.max(l, Math.min(u, n.x)), m = Math.max(g, Math.min(f, n.y));
2569
2569
  return {
2570
2570
  x: p,
2571
2571
  y: m
@@ -2577,8 +2577,8 @@ class Js {
2577
2577
  * @private
2578
2578
  */
2579
2579
  _calculateFitZoom() {
2580
- const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = s / e.width, i = o / e.height;
2581
- return Math.max(n, i);
2580
+ const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), n = t.getHeight(), o = s / e.width, i = n / e.height;
2581
+ return Math.max(o, i);
2582
2582
  }
2583
2583
  /**
2584
2584
  * Вычисляет целевую позицию viewport для центрирования монтажной области
@@ -2587,7 +2587,7 @@ class Js {
2587
2587
  * @private
2588
2588
  */
2589
2589
  _calculateTargetViewportPosition(t) {
2590
- const { canvas: e, montageArea: s } = this.editor, o = e.getWidth(), n = e.getHeight(), i = o / 2, a = n / 2, r = s.left, c = s.top;
2590
+ const { canvas: e, montageArea: s } = this.editor, n = e.getWidth(), o = e.getHeight(), i = n / 2, a = o / 2, r = s.left, c = s.top;
2591
2591
  return {
2592
2592
  x: i - r * t,
2593
2593
  y: a - c * t
@@ -2600,9 +2600,9 @@ class Js {
2600
2600
  * @private
2601
2601
  */
2602
2602
  _calculateEmptySpaceRatio(t) {
2603
- const { canvas: e, montageArea: s } = this.editor, o = e.viewportTransform, n = 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 = -o[4] / t, u = (-o[4] + n) / t, g = -o[5] / t, f = (-o[5] + i) / t, p = l < a, m = u > r, v = g < c, M = f > d;
2603
+ 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, g = -n[5] / t, f = (-n[5] + i) / t, p = l < a, m = u > r, v = g < c, M = f > d;
2604
2604
  if (!(p || m || v || M)) return 0;
2605
- const y = Math.max(0, a - l), b = Math.max(0, u - r), I = Math.max(0, c - g), j = Math.max(0, f - d), A = Math.max(y, b), C = Math.max(I, j), w = A / n, T = C / i;
2605
+ const y = Math.max(0, a - l), b = Math.max(0, u - r), I = Math.max(0, c - g), j = Math.max(0, f - d), A = Math.max(y, b), C = Math.max(I, j), w = A / o, T = C / i;
2606
2606
  return Math.max(w, T);
2607
2607
  }
2608
2608
  /**
@@ -2615,11 +2615,11 @@ class Js {
2615
2615
  * @returns Вычисленный шаг перемещения viewport
2616
2616
  * @private
2617
2617
  */
2618
- _calculateSmoothCenteringStep(t, e, s, o, n) {
2619
- 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], g = Math.abs(o), f = e - s;
2618
+ _calculateSmoothCenteringStep(t, e, s, n, o) {
2619
+ 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], g = Math.abs(n), f = e - s;
2620
2620
  if (Math.abs(f) / g <= 0.1)
2621
2621
  return { x: l, y: u };
2622
- const m = c / 2, v = d / 2, M = a.left, S = a.top, y = m - M * s, b = v - S * s, I = (y - r[4]) / (e - s), j = (b - r[5]) / (e - s), A = I * g, C = j * g, w = A * n, T = C * n, E = Math.abs(w) > Math.abs(l) ? l : w, P = Math.abs(T) > Math.abs(u) ? u : T;
2622
+ const m = c / 2, v = d / 2, M = a.left, S = a.top, y = m - M * s, b = v - S * s, I = (y - r[4]) / (e - s), j = (b - r[5]) / (e - s), A = I * g, C = j * g, w = A * o, T = C * o, E = Math.abs(w) > Math.abs(l) ? l : w, P = Math.abs(T) > Math.abs(u) ? u : T;
2623
2623
  return { x: E, y: P };
2624
2624
  }
2625
2625
  /**
@@ -2633,17 +2633,17 @@ class Js {
2633
2633
  * @private
2634
2634
  */
2635
2635
  _applyViewportCentering(t, e = !1, s = Ye) {
2636
- const { canvas: o } = this.editor, n = this._getScaledMontageDimensions(t), i = o.getWidth(), a = o.getHeight(), r = n.width > i || n.height > a, c = this._calculateFitZoom(), d = t - c;
2636
+ 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;
2637
2637
  if (!(!r || d) && !e)
2638
2638
  return !1;
2639
- const u = o.viewportTransform, g = this._calculateTargetViewportPosition(t);
2639
+ const u = n.viewportTransform, g = this._calculateTargetViewportPosition(t);
2640
2640
  if (!r)
2641
- return u[4] = g.x, u[5] = g.y, o.setViewportTransform(u), !0;
2641
+ return u[4] = g.x, u[5] = g.y, n.setViewportTransform(u), !0;
2642
2642
  if (e && !r) {
2643
2643
  const f = this._calculateEmptySpaceRatio(t);
2644
2644
  if (f > 0) {
2645
2645
  const p = this._calculateSmoothCenteringStep(g, t, c, s, f);
2646
- return u[4] += p.x, u[5] += p.y, o.setViewportTransform(u), !0;
2646
+ return u[4] += p.x, u[5] += p.y, n.setViewportTransform(u), !0;
2647
2647
  }
2648
2648
  }
2649
2649
  return !1;
@@ -2656,7 +2656,7 @@ class Js {
2656
2656
  * @param scale - Желаемый масштаб относительно размеров контейнера редактора.
2657
2657
  */
2658
2658
  calculateAndApplyDefaultZoom(t = this.options.defaultScale) {
2659
- const { canvas: e } = this.editor, s = e.editorContainer, o = s.clientWidth || e.getWidth(), n = s.clientHeight || e.getHeight(), { width: i, height: a } = this.editor.montageArea, r = o / i * t, c = n / a * t;
2659
+ const { canvas: e } = this.editor, s = e.editorContainer, n = s.clientWidth || e.getWidth(), o = s.clientHeight || e.getHeight(), { width: i, height: a } = this.editor.montageArea, r = n / i * t, c = o / a * t;
2660
2660
  this.defaultZoom = Math.min(r, c), this.setZoom(), this.editor.panConstraintManager.updateBounds();
2661
2661
  }
2662
2662
  /**
@@ -2670,12 +2670,12 @@ class Js {
2670
2670
  * @fires editor:zoom-changed
2671
2671
  */
2672
2672
  handleMouseWheelZoom(t, e) {
2673
- const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = t < 0, a = this._getScaledMontageDimensions(n), r = s.getWidth(), c = s.getHeight(), d = a.width > r || a.height > c;
2673
+ const { canvas: s, montageArea: n } = this.editor, o = s.getZoom(), i = t < 0, a = this._getScaledMontageDimensions(o), r = s.getWidth(), c = s.getHeight(), d = a.width > r || a.height > c;
2674
2674
  if (i) {
2675
2675
  if (!d)
2676
2676
  this.zoom(t, {
2677
- pointX: o.left,
2678
- pointY: o.top
2677
+ pointX: n.left,
2678
+ pointY: n.top
2679
2679
  });
2680
2680
  else {
2681
2681
  const u = this._getClampedPointerCoordinates(e);
@@ -2688,8 +2688,8 @@ class Js {
2688
2688
  }
2689
2689
  if (t < 0 || !d) {
2690
2690
  this.zoom(t, {
2691
- pointX: o.left,
2692
- pointY: o.top
2691
+ pointX: n.left,
2692
+ pointY: n.top
2693
2693
  });
2694
2694
  return;
2695
2695
  }
@@ -2710,11 +2710,11 @@ class Js {
2710
2710
  zoom(t = Ye, e = {}) {
2711
2711
  var g, f;
2712
2712
  if (!t) return;
2713
- const { minZoom: s, maxZoom: o } = this, { canvas: n } = this.editor, i = t < 0, a = n.getZoom(), r = n.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new et(c, d);
2713
+ const { minZoom: s, maxZoom: n } = this, { canvas: o } = this.editor, i = t < 0, a = o.getZoom(), r = o.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new et(c, d);
2714
2714
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2715
2715
  let u = Number((a + Number(t)).toFixed(3));
2716
- u > o && (u = o), u < s && (u = s), n.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
2717
- currentZoom: n.getZoom(),
2716
+ u > n && (u = n), u < s && (u = s), o.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), o.fire("editor:zoom-changed", {
2717
+ currentZoom: o.getZoom(),
2718
2718
  zoom: u,
2719
2719
  point: l
2720
2720
  });
@@ -2725,12 +2725,12 @@ class Js {
2725
2725
  * @fires editor:zoom-changed
2726
2726
  */
2727
2727
  setZoom(t = this.defaultZoom) {
2728
- const { minZoom: e, maxZoom: s } = this, { canvas: o } = this.editor, n = new et(o.getCenterPoint());
2728
+ const { minZoom: e, maxZoom: s } = this, { canvas: n } = this.editor, o = new et(n.getCenterPoint());
2729
2729
  let i = t;
2730
- t > s && (i = s), t < e && (i = e), o.zoomToPoint(n, i), o.fire("editor:zoom-changed", {
2731
- currentZoom: o.getZoom(),
2730
+ t > s && (i = s), t < e && (i = e), n.zoomToPoint(o, i), n.fire("editor:zoom-changed", {
2731
+ currentZoom: n.getZoom(),
2732
2732
  zoom: i,
2733
- point: n
2733
+ point: o
2734
2734
  }), this.editor.panConstraintManager.updateBounds();
2735
2735
  }
2736
2736
  /**
@@ -2775,8 +2775,8 @@ class $s {
2775
2775
  const { canvas: t, montageArea: e, historyManager: s } = this.editor;
2776
2776
  if (!e || !this.overlayMask) return;
2777
2777
  s.suspendHistory(), e.setCoords();
2778
- const { left: o, top: n, width: i, height: a } = e.getBoundingRect();
2779
- this.overlayMask.set({ left: o, top: n, width: i, height: a }), t.discardActiveObject(), this.editor.layerManager.bringToFront(this.overlayMask, { withoutSave: !0 }), s.resumeHistory();
2778
+ const { left: n, top: o, width: i, height: a } = e.getBoundingRect();
2779
+ this.overlayMask.set({ left: n, top: o, width: i, height: a }), t.discardActiveObject(), this.editor.layerManager.bringToFront(this.overlayMask, { withoutSave: !0 }), s.resumeHistory();
2780
2780
  }
2781
2781
  /**
2782
2782
  * Выключает редактор:
@@ -2787,8 +2787,8 @@ class $s {
2787
2787
  block() {
2788
2788
  if (this.isBlocked || !this.overlayMask) return;
2789
2789
  const { canvas: t, canvasManager: e, historyManager: s } = this.editor;
2790
- s.suspendHistory(), this.isBlocked = !0, t.discardActiveObject(), t.selection = !1, t.skipTargetFind = !0, e.getObjects().forEach((o) => {
2791
- o.evented = !1, o.selectable = !1;
2790
+ s.suspendHistory(), this.isBlocked = !0, t.discardActiveObject(), t.selection = !1, t.skipTargetFind = !0, e.getObjects().forEach((n) => {
2791
+ n.evented = !1, n.selectable = !1;
2792
2792
  }), t.upperCanvasEl.style.pointerEvents = "none", t.lowerCanvasEl.style.pointerEvents = "none", this.overlayMask.visible = !0, this.refresh(), t.fire("editor:disabled"), s.resumeHistory();
2793
2793
  }
2794
2794
  /**
@@ -2797,8 +2797,8 @@ class $s {
2797
2797
  unblock() {
2798
2798
  if (!this.isBlocked || !this.overlayMask) return;
2799
2799
  const { canvas: t, canvasManager: e, historyManager: s } = this.editor;
2800
- s.suspendHistory(), this.isBlocked = !1, t.selection = !0, t.skipTargetFind = !1, e.getObjects().forEach((o) => {
2801
- o.evented = !0, o.selectable = !0;
2800
+ s.suspendHistory(), this.isBlocked = !1, t.selection = !0, t.skipTargetFind = !1, e.getObjects().forEach((n) => {
2801
+ n.evented = !0, n.selectable = !0;
2802
2802
  }), t.upperCanvasEl.style.pointerEvents = "", t.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, t.requestRenderAll(), t.fire("editor:enabled"), s.resumeHistory();
2803
2803
  }
2804
2804
  }
@@ -2815,30 +2815,37 @@ class Ot {
2815
2815
  setColorBackground({
2816
2816
  color: t,
2817
2817
  customData: e = {},
2818
- withoutSave: s = !1
2818
+ fromTemplate: s = !1,
2819
+ withoutSave: n = !1
2819
2820
  }) {
2820
2821
  var o;
2821
2822
  try {
2822
- const { historyManager: n } = this.editor, { backgroundObject: i } = this;
2823
- if (n.suspendHistory(), i && i.backgroundType === "color") {
2824
- if (i.fill === t) {
2825
- n.resumeHistory();
2823
+ const { historyManager: i } = this.editor, { backgroundObject: a } = this;
2824
+ if (i.suspendHistory(), a && a.backgroundType === "color") {
2825
+ if (a.fill === t) {
2826
+ i.resumeHistory();
2826
2827
  return;
2827
2828
  }
2828
- i.set({
2829
+ a.set({
2829
2830
  fill: t,
2830
2831
  backgroundId: `background-${V()}`
2831
2832
  }), this.editor.canvas.requestRenderAll();
2832
2833
  } else
2833
2834
  this._removeCurrentBackground(), this._createColorBackground(t);
2834
- (o = this.backgroundObject) == null || o.set({ customData: e }), this.editor.canvas.fire("editor:background:changed", { type: "color", color: t }), n.resumeHistory(), s || n.saveState();
2835
- } catch (n) {
2835
+ (o = this.backgroundObject) == null || o.set({ customData: e }), this.editor.canvas.fire("editor:background:changed", {
2836
+ type: "color",
2837
+ color: t,
2838
+ customData: e,
2839
+ fromTemplate: s,
2840
+ withoutSave: n
2841
+ }), i.resumeHistory(), n || i.saveState();
2842
+ } catch (i) {
2836
2843
  this.editor.errorManager.emitError({
2837
2844
  code: "BACKGROUND_CREATION_FAILED",
2838
2845
  origin: "BackgroundManager",
2839
2846
  method: "setColorBackground",
2840
2847
  message: "Не удалось установить цветовой фон",
2841
- data: { error: n }
2848
+ data: { error: i, color: t, customData: e, fromTemplate: s, withoutSave: n }
2842
2849
  });
2843
2850
  }
2844
2851
  }
@@ -2851,34 +2858,38 @@ class Ot {
2851
2858
  setGradientBackground({
2852
2859
  gradient: t,
2853
2860
  customData: e = {},
2854
- withoutSave: s = !1
2861
+ fromTemplate: s = !1,
2862
+ withoutSave: n = !1
2855
2863
  }) {
2856
2864
  var o;
2857
2865
  try {
2858
- const { historyManager: n } = this.editor, { backgroundObject: i } = this;
2859
- if (n.suspendHistory(), i && i.backgroundType === "gradient") {
2860
- const a = Ot._createFabricGradient(t);
2861
- if (Ot._isGradientEqual(i.fill, a)) {
2862
- n.resumeHistory();
2866
+ const { historyManager: i } = this.editor, { backgroundObject: a } = this;
2867
+ if (i.suspendHistory(), a && a.backgroundType === "gradient") {
2868
+ const r = Ot._createFabricGradient(t);
2869
+ if (Ot._isGradientEqual(a.fill, r)) {
2870
+ i.resumeHistory();
2863
2871
  return;
2864
2872
  }
2865
- i.set({
2866
- fill: a,
2873
+ a.set({
2874
+ fill: r,
2867
2875
  backgroundId: `background-${V()}`
2868
2876
  }), this.editor.canvas.requestRenderAll();
2869
2877
  } else
2870
2878
  this._removeCurrentBackground(), this._createGradientBackground(t);
2871
2879
  (o = this.backgroundObject) == null || o.set({ customData: e }), this.editor.canvas.fire("editor:background:changed", {
2872
2880
  type: "gradient",
2881
+ customData: e,
2882
+ fromTemplate: s,
2883
+ withoutSave: n,
2873
2884
  gradientParams: t
2874
- }), n.resumeHistory(), s || n.saveState();
2875
- } catch (n) {
2885
+ }), i.resumeHistory(), n || i.saveState();
2886
+ } catch (i) {
2876
2887
  this.editor.errorManager.emitError({
2877
2888
  code: "BACKGROUND_CREATION_FAILED",
2878
2889
  origin: "BackgroundManager",
2879
2890
  method: "setGradientBackground",
2880
2891
  message: "Не удалось установить градиентный фон",
2881
- data: { error: n }
2892
+ data: { error: i, gradient: t, customData: e, fromTemplate: s, withoutSave: n }
2882
2893
  });
2883
2894
  }
2884
2895
  }
@@ -2890,8 +2901,8 @@ class Ot {
2890
2901
  angle: t,
2891
2902
  startColor: e,
2892
2903
  endColor: s,
2893
- startPosition: o,
2894
- endPosition: n,
2904
+ startPosition: n,
2905
+ endPosition: o,
2895
2906
  colorStops: i,
2896
2907
  customData: a = {},
2897
2908
  withoutSave: r = !1
@@ -2902,8 +2913,8 @@ class Ot {
2902
2913
  angle: t,
2903
2914
  startColor: e,
2904
2915
  endColor: s,
2905
- startPosition: o,
2906
- endPosition: n,
2916
+ startPosition: n,
2917
+ endPosition: o,
2907
2918
  colorStops: i
2908
2919
  },
2909
2920
  customData: a,
@@ -2918,8 +2929,8 @@ class Ot {
2918
2929
  centerX: t,
2919
2930
  centerY: e,
2920
2931
  radius: s,
2921
- startColor: o,
2922
- endColor: n,
2932
+ startColor: n,
2933
+ endColor: o,
2923
2934
  startPosition: i,
2924
2935
  endPosition: a,
2925
2936
  colorStops: r,
@@ -2932,8 +2943,8 @@ class Ot {
2932
2943
  centerX: t,
2933
2944
  centerY: e,
2934
2945
  radius: s,
2935
- startColor: o,
2936
- endColor: n,
2946
+ startColor: n,
2947
+ endColor: o,
2937
2948
  startPosition: i,
2938
2949
  endPosition: a,
2939
2950
  colorStops: r
@@ -2952,22 +2963,26 @@ class Ot {
2952
2963
  return k(this, arguments, function* ({
2953
2964
  imageSource: t,
2954
2965
  customData: e = {},
2955
- withoutSave: s = !1
2966
+ fromTemplate: s = !1,
2967
+ withoutSave: n = !1
2956
2968
  }) {
2957
2969
  try {
2958
- const { historyManager: n } = this.editor;
2959
- n.suspendHistory(), yield this._createImageBackground(t, e), this.editor.canvas.fire("editor:background:changed", {
2970
+ const { historyManager: i } = this.editor;
2971
+ i.suspendHistory(), yield this._createImageBackground(t, e), this.editor.canvas.fire("editor:background:changed", {
2960
2972
  type: "image",
2961
2973
  imageSource: t,
2974
+ customData: e,
2975
+ fromTemplate: s,
2976
+ withoutSave: n,
2962
2977
  backgroundObject: this.backgroundObject
2963
- }), n.resumeHistory(), s || n.saveState();
2964
- } catch (n) {
2978
+ }), i.resumeHistory(), n || i.saveState();
2979
+ } catch (i) {
2965
2980
  this.editor.errorManager.emitError({
2966
2981
  code: "BACKGROUND_CREATION_FAILED",
2967
2982
  origin: "BackgroundManager",
2968
2983
  method: "setImageBackground",
2969
2984
  message: "Не удалось установить изображение в качестве фона",
2970
- data: { error: n }
2985
+ data: { error: i, imageSource: t, customData: e, fromTemplate: s, withoutSave: n }
2971
2986
  });
2972
2987
  }
2973
2988
  });
@@ -2981,14 +2996,14 @@ class Ot {
2981
2996
  try {
2982
2997
  const { historyManager: e } = this.editor;
2983
2998
  if (!this.backgroundObject) return;
2984
- e.suspendHistory(), this._removeCurrentBackground(), this.editor.canvas.fire("editor:background:removed"), e.resumeHistory(), t || e.saveState();
2999
+ e.suspendHistory(), this._removeCurrentBackground(), this.editor.canvas.fire("editor:background:removed", { withoutSave: t }), e.resumeHistory(), t || e.saveState();
2985
3000
  } catch (e) {
2986
3001
  this.editor.errorManager.emitError({
2987
3002
  code: "BACKGROUND_REMOVAL_FAILED",
2988
3003
  origin: "BackgroundManager",
2989
3004
  method: "removeBackground",
2990
3005
  message: "Не удалось удалить фон",
2991
- data: { error: e }
3006
+ data: { error: e, withoutSave: t }
2992
3007
  });
2993
3008
  }
2994
3009
  }
@@ -2999,8 +3014,8 @@ class Ot {
2999
3014
  const { canvas: t, montageArea: e, historyManager: s } = this.editor;
3000
3015
  if (!e || !this.backgroundObject) return;
3001
3016
  s.suspendHistory(), this.editor.transformManager.fitObject({ object: this.backgroundObject, withoutSave: !0, type: "cover" });
3002
- const o = t.getObjects(), n = o.indexOf(e), i = o.indexOf(this.backgroundObject);
3003
- this.backgroundObject && i !== n + 1 && t.moveObjectTo(this.backgroundObject, n + 1), t.requestRenderAll(), s.resumeHistory();
3017
+ const n = t.getObjects(), o = n.indexOf(e), i = n.indexOf(this.backgroundObject);
3018
+ this.backgroundObject && i !== o + 1 && t.moveObjectTo(this.backgroundObject, o + 1), t.requestRenderAll(), s.resumeHistory();
3004
3019
  }
3005
3020
  /**
3006
3021
  * Создает цветовой фон.
@@ -3043,14 +3058,14 @@ class Ot {
3043
3058
  */
3044
3059
  _createImageBackground(t, e) {
3045
3060
  return k(this, null, function* () {
3046
- var o;
3047
- const { image: s } = (o = yield this.editor.imageManager.importImage({
3061
+ var n;
3062
+ const { image: s } = (n = yield this.editor.imageManager.importImage({
3048
3063
  source: t,
3049
3064
  withoutSave: !0,
3050
3065
  isBackground: !0,
3051
3066
  withoutSelection: !0,
3052
3067
  scale: "image-cover"
3053
- })) != null ? o : {};
3068
+ })) != null ? n : {};
3054
3069
  if (!s)
3055
3070
  throw new Error("Не удалось загрузить изображение");
3056
3071
  s.set({
@@ -3079,8 +3094,8 @@ class Ot {
3079
3094
  const {
3080
3095
  startColor: e,
3081
3096
  endColor: s,
3082
- startPosition: o = 0,
3083
- endPosition: n = 100,
3097
+ startPosition: n = 0,
3098
+ endPosition: o = 100,
3084
3099
  colorStops: i
3085
3100
  } = t;
3086
3101
  let a;
@@ -3088,8 +3103,8 @@ class Ot {
3088
3103
  offset: u.offset / 100,
3089
3104
  color: u.color
3090
3105
  })) : e && s ? a = [
3091
- { offset: o / 100, color: e },
3092
- { offset: n / 100, color: s }
3106
+ { offset: n / 100, color: e },
3107
+ { offset: o / 100, color: s }
3093
3108
  ] : a = [
3094
3109
  { offset: 0, color: "#000000" },
3095
3110
  { offset: 1, color: "#ffffff" }
@@ -3142,14 +3157,14 @@ class Ot {
3142
3157
  */
3143
3158
  static _isGradientEqual(t, e) {
3144
3159
  if (!t || !e || t.type !== e.type) return !1;
3145
- const s = t.colorStops || [], o = e.colorStops || [];
3146
- return s.length !== o.length || !s.every((i, a) => {
3147
- const r = o[a];
3160
+ const s = t.colorStops || [], n = e.colorStops || [];
3161
+ return s.length !== n.length || !s.every((i, a) => {
3162
+ const r = n[a];
3148
3163
  return i.color === r.color && Math.abs(i.offset - r.offset) < 1e-4;
3149
3164
  }) ? !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;
3150
3165
  }
3151
3166
  }
3152
- class te {
3167
+ class ee {
3153
3168
  constructor({ editor: t }) {
3154
3169
  this.editor = t;
3155
3170
  }
@@ -3161,13 +3176,13 @@ class te {
3161
3176
  * @fires editor:object-bring-to-front
3162
3177
  */
3163
3178
  bringToFront(t, { withoutSave: e } = {}) {
3164
- const { canvas: s, historyManager: o } = this.editor;
3165
- o.suspendHistory();
3166
- const n = t || s.getActiveObject();
3167
- n && (n instanceof U ? n.getObjects().forEach((i) => {
3179
+ const { canvas: s, historyManager: n } = this.editor;
3180
+ n.suspendHistory();
3181
+ const o = t || s.getActiveObject();
3182
+ o && (o instanceof U ? o.getObjects().forEach((i) => {
3168
3183
  s.bringObjectToFront(i);
3169
- }) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
3170
- object: n,
3184
+ }) : s.bringObjectToFront(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-to-front", {
3185
+ object: o,
3171
3186
  withoutSave: e
3172
3187
  }));
3173
3188
  }
@@ -3179,11 +3194,11 @@ class te {
3179
3194
  * @fires editor:object-bring-forward
3180
3195
  */
3181
3196
  bringForward(t, { withoutSave: e } = {}) {
3182
- const { canvas: s, historyManager: o } = this.editor;
3183
- o.suspendHistory();
3184
- const n = t || s.getActiveObject();
3185
- n && (n instanceof U ? te._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3186
- object: n,
3197
+ const { canvas: s, historyManager: n } = this.editor;
3198
+ n.suspendHistory();
3199
+ const o = t || s.getActiveObject();
3200
+ o && (o instanceof U ? ee._moveSelectionForward(s, o) : s.bringObjectForward(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-forward", {
3201
+ object: o,
3187
3202
  withoutSave: e
3188
3203
  }));
3189
3204
  }
@@ -3197,12 +3212,12 @@ class te {
3197
3212
  sendToBack(t, { withoutSave: e } = {}) {
3198
3213
  const {
3199
3214
  canvas: s,
3200
- montageArea: o,
3201
- historyManager: n,
3215
+ montageArea: n,
3216
+ historyManager: o,
3202
3217
  interactionBlocker: { overlayMask: i },
3203
3218
  backgroundManager: { backgroundObject: a }
3204
3219
  } = this.editor;
3205
- n.suspendHistory();
3220
+ o.suspendHistory();
3206
3221
  const r = t || s.getActiveObject();
3207
3222
  if (r) {
3208
3223
  if (r instanceof U) {
@@ -3211,7 +3226,7 @@ class te {
3211
3226
  s.sendObjectToBack(c[d]);
3212
3227
  } else
3213
3228
  s.sendObjectToBack(r);
3214
- a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-to-back", {
3229
+ a && s.sendObjectToBack(a), s.sendObjectToBack(n), i && s.sendObjectToBack(i), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-send-to-back", {
3215
3230
  object: r,
3216
3231
  withoutSave: e
3217
3232
  });
@@ -3226,14 +3241,14 @@ class te {
3226
3241
  sendBackwards(t, { withoutSave: e } = {}) {
3227
3242
  const {
3228
3243
  canvas: s,
3229
- montageArea: o,
3230
- historyManager: n,
3244
+ montageArea: n,
3245
+ historyManager: o,
3231
3246
  interactionBlocker: { overlayMask: i },
3232
3247
  backgroundManager: { backgroundObject: a }
3233
3248
  } = this.editor;
3234
- n.suspendHistory();
3249
+ o.suspendHistory();
3235
3250
  const r = t || s.getActiveObject();
3236
- r && (r instanceof U ? te._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), a && s.sendObjectToBack(a), s.sendObjectToBack(o), i && s.sendObjectToBack(i), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-send-backwards", {
3251
+ r && (r instanceof U ? ee._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", {
3237
3252
  object: r,
3238
3253
  withoutSave: e
3239
3254
  }));
@@ -3245,15 +3260,15 @@ class te {
3245
3260
  * @param activeSelection - активное выделение
3246
3261
  */
3247
3262
  static _moveSelectionForward(t, e) {
3248
- const s = t.getObjects(), o = e.getObjects();
3249
- if (!o.some((a) => {
3263
+ const s = t.getObjects(), n = e.getObjects();
3264
+ if (!n.some((a) => {
3250
3265
  const r = s.indexOf(a);
3251
3266
  for (let c = r + 1; c < s.length; c += 1)
3252
- if (!o.includes(s[c]))
3267
+ if (!n.includes(s[c]))
3253
3268
  return !0;
3254
3269
  return !1;
3255
3270
  })) return;
3256
- o.map((a) => ({ obj: a, index: s.indexOf(a) })).sort((a, r) => r.index - a.index).forEach((a) => {
3271
+ n.map((a) => ({ obj: a, index: s.indexOf(a) })).sort((a, r) => r.index - a.index).forEach((a) => {
3257
3272
  t.bringObjectForward(a.obj);
3258
3273
  });
3259
3274
  }
@@ -3264,20 +3279,20 @@ class te {
3264
3279
  * @param activeSelection - активное выделение
3265
3280
  */
3266
3281
  static _moveSelectionBackwards(t, e) {
3267
- const s = t.getObjects(), o = e.getObjects();
3268
- if (!o.some((a) => {
3282
+ const s = t.getObjects(), n = e.getObjects();
3283
+ if (!n.some((a) => {
3269
3284
  const r = s.indexOf(a);
3270
3285
  for (let c = r - 1; c >= 0; c -= 1)
3271
- if (!o.includes(s[c]))
3286
+ if (!n.includes(s[c]))
3272
3287
  return !0;
3273
3288
  return !1;
3274
3289
  })) return;
3275
- o.map((a) => ({ obj: a, index: s.indexOf(a) })).sort((a, r) => a.index - r.index).forEach((a) => {
3290
+ n.map((a) => ({ obj: a, index: s.indexOf(a) })).sort((a, r) => a.index - r.index).forEach((a) => {
3276
3291
  t.sendObjectBackwards(a.obj);
3277
3292
  });
3278
3293
  }
3279
3294
  }
3280
- class to {
3295
+ class tn {
3281
3296
  /**
3282
3297
  * Менеджер фигур для редактора.
3283
3298
  * @param options - Опции и настройки менеджера фигур.
@@ -3306,10 +3321,10 @@ class to {
3306
3321
  id: t = `rect-${V()}`,
3307
3322
  left: e,
3308
3323
  top: s,
3309
- width: o = 100,
3310
- height: n = 100,
3324
+ width: n = 100,
3325
+ height: o = 100,
3311
3326
  fill: i = "blue"
3312
- } = l, a = vt(l, [
3327
+ } = l, a = bt(l, [
3313
3328
  "id",
3314
3329
  "left",
3315
3330
  "top",
@@ -3321,8 +3336,8 @@ class to {
3321
3336
  id: t,
3322
3337
  left: e,
3323
3338
  top: s,
3324
- width: o,
3325
- height: n,
3339
+ width: n,
3340
+ height: o,
3326
3341
  fill: i
3327
3342
  }, a));
3328
3343
  return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
@@ -3348,9 +3363,9 @@ class to {
3348
3363
  id: t = `circle-${V()}`,
3349
3364
  left: e,
3350
3365
  top: s,
3351
- radius: o = 50,
3352
- fill: n = "green"
3353
- } = d, i = vt(d, [
3366
+ radius: n = 50,
3367
+ fill: o = "green"
3368
+ } = d, i = bt(d, [
3354
3369
  "id",
3355
3370
  "left",
3356
3371
  "top",
@@ -3361,8 +3376,8 @@ class to {
3361
3376
  id: t,
3362
3377
  left: e,
3363
3378
  top: s,
3364
- fill: n,
3365
- radius: o
3379
+ fill: o,
3380
+ radius: n
3366
3381
  }, i));
3367
3382
  return !e && !s && l.centerObject(u), r || (l.add(u), a || l.setActiveObject(u), l.renderAll()), u;
3368
3383
  }
@@ -3388,10 +3403,10 @@ class to {
3388
3403
  id: t = `triangle-${V()}`,
3389
3404
  left: e,
3390
3405
  top: s,
3391
- width: o = 100,
3392
- height: n = 100,
3406
+ width: n = 100,
3407
+ height: o = 100,
3393
3408
  fill: i = "yellow"
3394
- } = l, a = vt(l, [
3409
+ } = l, a = bt(l, [
3395
3410
  "id",
3396
3411
  "left",
3397
3412
  "top",
@@ -3404,13 +3419,13 @@ class to {
3404
3419
  left: e,
3405
3420
  top: s,
3406
3421
  fill: i,
3407
- width: o,
3408
- height: n
3422
+ width: n,
3423
+ height: o
3409
3424
  }, a));
3410
3425
  return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
3411
3426
  }
3412
3427
  }
3413
- class eo {
3428
+ class en {
3414
3429
  /**
3415
3430
  * @param options
3416
3431
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -3441,15 +3456,15 @@ class eo {
3441
3456
  return k(this, null, function* () {
3442
3457
  const { canvas: e, errorManager: s } = this.editor;
3443
3458
  try {
3444
- const o = yield t.clone(Kt);
3445
- this.clipboard = o, e.fire("editor:object-copied", { object: o });
3446
- } catch (o) {
3459
+ const n = yield t.clone(Qt);
3460
+ this.clipboard = n, e.fire("editor:object-copied", { object: n });
3461
+ } catch (n) {
3447
3462
  s.emitError({
3448
3463
  origin: "ClipboardManager",
3449
3464
  method: "_cloneToInternalClipboard",
3450
3465
  code: "CLONE_FAILED",
3451
3466
  message: "Ошибка клонирования объекта для внутреннего буфера",
3452
- data: o
3467
+ data: n
3453
3468
  });
3454
3469
  }
3455
3470
  });
@@ -3468,8 +3483,8 @@ class eo {
3468
3483
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3469
3484
  }), !1;
3470
3485
  try {
3471
- const s = t.toObject(Kt), o = JSON.stringify(s);
3472
- return t.type === "image" ? this._copyImageToClipboard(t, o) : this._copyTextToClipboard(o);
3486
+ const s = t.toObject(Qt), n = JSON.stringify(s);
3487
+ return t.type === "image" ? this._copyImageToClipboard(t, n) : this._copyTextToClipboard(n);
3473
3488
  } catch (s) {
3474
3489
  return e.emitError({
3475
3490
  origin: "ClipboardManager",
@@ -3487,10 +3502,10 @@ class eo {
3487
3502
  _copyImageToClipboard(t, e) {
3488
3503
  return k(this, null, function* () {
3489
3504
  try {
3490
- const o = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(), n = o.slice(5).split(";")[0], i = o.split(",")[1], a = atob(i), r = new Uint8Array(a.length);
3505
+ 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);
3491
3506
  for (let l = 0; l < a.length; l += 1)
3492
3507
  r[l] = a.charCodeAt(l);
3493
- const c = new Blob([r.buffer], { type: n }), d = new ClipboardItem({ [n]: c });
3508
+ const c = new Blob([r.buffer], { type: o }), d = new ClipboardItem({ [o]: c });
3494
3509
  return yield navigator.clipboard.write([d]), console.info("Image copied to clipboard successfully"), !0;
3495
3510
  } catch (s) {
3496
3511
  return this.editor.errorManager.emitWarning({
@@ -3530,8 +3545,8 @@ class eo {
3530
3545
  _addClonedObjectToCanvas(t) {
3531
3546
  const { canvas: e, historyManager: s } = this.editor;
3532
3547
  if (e.discardActiveObject(), t instanceof U) {
3533
- s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
3534
- e.add(o);
3548
+ s.suspendHistory(), t.canvas = e, t.forEachObject((n) => {
3549
+ e.add(n);
3535
3550
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
3536
3551
  return;
3537
3552
  }
@@ -3562,26 +3577,26 @@ class eo {
3562
3577
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3563
3578
  if (!s || s.locked) return !1;
3564
3579
  try {
3565
- const o = yield s.clone(Kt);
3566
- return o instanceof U && o.forEachObject((n) => {
3567
- n.set({
3568
- id: `${n.type}-${V()}`,
3580
+ const n = yield s.clone(Qt);
3581
+ return n instanceof U && n.forEachObject((o) => {
3582
+ o.set({
3583
+ id: `${o.type}-${V()}`,
3569
3584
  evented: !0
3570
3585
  });
3571
- }), o.set({
3572
- id: `${o.type}-${V()}`,
3573
- left: o.left + 10,
3574
- top: o.top + 10,
3586
+ }), n.set({
3587
+ id: `${n.type}-${V()}`,
3588
+ left: n.left + 10,
3589
+ top: n.top + 10,
3575
3590
  evented: !0
3576
- }), this._addClonedObjectToCanvas(o), e.fire("editor:object-duplicated", { object: o }), !0;
3577
- } catch (o) {
3578
- const { errorManager: n } = this.editor;
3579
- return n.emitError({
3591
+ }), this._addClonedObjectToCanvas(n), e.fire("editor:object-duplicated", { object: n }), !0;
3592
+ } catch (n) {
3593
+ const { errorManager: o } = this.editor;
3594
+ return o.emitError({
3580
3595
  origin: "ClipboardManager",
3581
3596
  method: "copyPaste",
3582
3597
  code: "COPY_PASTE_FAILED",
3583
3598
  message: "Ошибка создания копии объекта",
3584
- data: o
3599
+ data: n
3585
3600
  }), !1;
3586
3601
  }
3587
3602
  });
@@ -3604,8 +3619,8 @@ class eo {
3604
3619
  this.paste();
3605
3620
  return;
3606
3621
  }
3607
- const { items: o } = t, n = o[o.length - 1], i = n.getAsFile();
3608
- if (n.type !== "text/html" && i) {
3622
+ const { items: n } = t, o = n[n.length - 1], i = o.getAsFile();
3623
+ if (o.type !== "text/html" && i) {
3609
3624
  const c = new FileReader();
3610
3625
  c.onload = (d) => {
3611
3626
  d.target && this._handleImageImport(d.target.result).catch((l) => {
@@ -3648,7 +3663,7 @@ class eo {
3648
3663
  const { canvas: t } = this.editor;
3649
3664
  if (!this.clipboard) return !1;
3650
3665
  try {
3651
- const e = yield this.clipboard.clone(Kt);
3666
+ const e = yield this.clipboard.clone(Qt);
3652
3667
  return t.discardActiveObject(), e instanceof U && e.forEachObject((s) => {
3653
3668
  s.set({
3654
3669
  id: `${s.type}-${V()}`,
@@ -3673,7 +3688,7 @@ class eo {
3673
3688
  });
3674
3689
  }
3675
3690
  }
3676
- class ee {
3691
+ class se {
3677
3692
  constructor({ editor: t }) {
3678
3693
  this.editor = t;
3679
3694
  }
@@ -3686,7 +3701,7 @@ class ee {
3686
3701
  * @fires editor:object-locked
3687
3702
  */
3688
3703
  lockObject({ object: t, skipInnerObjects: e, withoutSave: s } = {}) {
3689
- const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
3704
+ const { canvas: n, historyManager: o } = this.editor, i = t || n.getActiveObject();
3690
3705
  if (!i || i.locked) return;
3691
3706
  const a = {
3692
3707
  lockMovementX: !0,
@@ -3699,9 +3714,9 @@ class ee {
3699
3714
  editable: !1,
3700
3715
  locked: !0
3701
3716
  };
3702
- i.set(a), !e && ee._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3717
+ i.set(a), !e && se._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3703
3718
  c.set(a);
3704
- }), o.renderAll(), s || n.saveState(), o.fire("editor:object-locked", {
3719
+ }), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
3705
3720
  object: i,
3706
3721
  skipInnerObjects: e,
3707
3722
  withoutSave: s
@@ -3715,8 +3730,8 @@ class ee {
3715
3730
  * @fires editor:object-unlocked
3716
3731
  */
3717
3732
  unlockObject({ object: t, withoutSave: e } = {}) {
3718
- const { canvas: s, historyManager: o } = this.editor, n = t || s.getActiveObject();
3719
- if (!n) return;
3733
+ const { canvas: s, historyManager: n } = this.editor, o = t || s.getActiveObject();
3734
+ if (!o) return;
3720
3735
  const i = {
3721
3736
  lockMovementX: !1,
3722
3737
  lockMovementY: !1,
@@ -3728,10 +3743,10 @@ class ee {
3728
3743
  editable: !0,
3729
3744
  locked: !1
3730
3745
  };
3731
- n.set(i), ee._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3746
+ o.set(i), se._isGroupOrSelection(o) && o.getObjects().forEach((a) => {
3732
3747
  a.set(i);
3733
- }), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
3734
- object: n,
3748
+ }), s.renderAll(), e || n.saveState(), s.fire("editor:object-unlocked", {
3749
+ object: o,
3735
3750
  withoutSave: e
3736
3751
  });
3737
3752
  }
@@ -3739,7 +3754,7 @@ class ee {
3739
3754
  return t instanceof U || t instanceof Et;
3740
3755
  }
3741
3756
  }
3742
- class so {
3757
+ class sn {
3743
3758
  constructor({ editor: t }) {
3744
3759
  this.editor = t;
3745
3760
  }
@@ -3759,17 +3774,17 @@ class so {
3759
3774
  */
3760
3775
  _getGroupsToUngroup(t) {
3761
3776
  if (Array.isArray(t)) {
3762
- const s = t.filter((o) => o instanceof Et);
3777
+ const s = t.filter((n) => n instanceof Et);
3763
3778
  return s.length > 0 ? s : null;
3764
3779
  }
3765
3780
  if (t instanceof U) {
3766
- const s = t.getObjects().filter((o) => o instanceof Et);
3781
+ const s = t.getObjects().filter((n) => n instanceof Et);
3767
3782
  return s.length > 0 ? s : null;
3768
3783
  }
3769
3784
  const e = t || this.editor.canvas.getActiveObject();
3770
3785
  if (!e) return null;
3771
3786
  if (e instanceof U) {
3772
- const s = e.getObjects().filter((o) => o instanceof Et);
3787
+ const s = e.getObjects().filter((n) => n instanceof Et);
3773
3788
  return s.length > 0 ? s : null;
3774
3789
  }
3775
3790
  return e instanceof Et ? [e] : null;
@@ -3785,21 +3800,21 @@ class so {
3785
3800
  target: t,
3786
3801
  withoutSave: e = !1
3787
3802
  } = {}) {
3788
- const { canvas: s, historyManager: o } = this.editor, n = this._getObjectsToGroup(t);
3789
- if (!n) return null;
3803
+ const { canvas: s, historyManager: n } = this.editor, o = this._getObjectsToGroup(t);
3804
+ if (!o) return null;
3790
3805
  try {
3791
- o.suspendHistory();
3792
- const i = new Et(n, {
3806
+ n.suspendHistory();
3807
+ const i = new Et(o, {
3793
3808
  id: `group-${V()}`
3794
3809
  });
3795
- n.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
3810
+ o.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
3796
3811
  const a = {
3797
3812
  group: i,
3798
3813
  withoutSave: e
3799
3814
  };
3800
3815
  return s.fire("editor:objects-grouped", a), a;
3801
3816
  } finally {
3802
- o.resumeHistory(), e || o.saveState();
3817
+ n.resumeHistory(), e || n.saveState();
3803
3818
  }
3804
3819
  }
3805
3820
  /**
@@ -3814,12 +3829,12 @@ class so {
3814
3829
  target: t,
3815
3830
  withoutSave: e = !1
3816
3831
  } = {}) {
3817
- const { canvas: s, historyManager: o } = this.editor, n = this._getGroupsToUngroup(t);
3818
- if (!n) return null;
3832
+ const { canvas: s, historyManager: n } = this.editor, o = this._getGroupsToUngroup(t);
3833
+ if (!o) return null;
3819
3834
  try {
3820
- o.suspendHistory();
3835
+ n.suspendHistory();
3821
3836
  const i = [];
3822
- n.forEach((c) => {
3837
+ o.forEach((c) => {
3823
3838
  const d = c.removeAll();
3824
3839
  s.remove(c), d.forEach((l) => {
3825
3840
  s.add(l), i.push(l);
@@ -3836,11 +3851,11 @@ class so {
3836
3851
  };
3837
3852
  return s.fire("editor:objects-ungrouped", r), r;
3838
3853
  } finally {
3839
- o.resumeHistory(), e || o.saveState();
3854
+ n.resumeHistory(), e || n.saveState();
3840
3855
  }
3841
3856
  }
3842
3857
  }
3843
- class oo {
3858
+ class nn {
3844
3859
  constructor({ editor: t }) {
3845
3860
  this.editor = t;
3846
3861
  }
@@ -3851,11 +3866,11 @@ class oo {
3851
3866
  selectAll() {
3852
3867
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3853
3868
  t.discardActiveObject();
3854
- const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new U(e.getObjects(), { canvas: t }) : o[0];
3855
- n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3869
+ const n = e.getObjects(), o = n.some((a) => a.locked), i = n.length > 1 ? new U(e.getObjects(), { canvas: t }) : n[0];
3870
+ o && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3856
3871
  }
3857
3872
  }
3858
- class Me {
3873
+ class Se {
3859
3874
  constructor({ editor: t }) {
3860
3875
  this.editor = t;
3861
3876
  }
@@ -3873,11 +3888,11 @@ class Me {
3873
3888
  * @returns массив всех удаленных объектов (включая саму группу)
3874
3889
  */
3875
3890
  _handleGroupDeletion(t) {
3876
- var o;
3877
- const { groupingManager: e } = this.editor, { ungroupedObjects: s = [] } = (o = e.ungroup({
3891
+ var n;
3892
+ const { groupingManager: e } = this.editor, { ungroupedObjects: s = [] } = (n = e.ungroup({
3878
3893
  object: t,
3879
3894
  withoutSave: !0
3880
- })) != null ? o : {};
3895
+ })) != null ? n : {};
3881
3896
  return this.deleteSelectedObjects({
3882
3897
  objects: s,
3883
3898
  withoutSave: !0,
@@ -3897,27 +3912,27 @@ class Me {
3897
3912
  withoutSave: e = !1,
3898
3913
  _isRecursiveCall: s = !1
3899
3914
  } = {}) {
3900
- const { canvas: o, historyManager: n } = this.editor, a = (t || o.getActiveObjects()).filter((d) => !d.locked);
3915
+ const { canvas: n, historyManager: o } = this.editor, a = (t || n.getActiveObjects()).filter((d) => !d.locked);
3901
3916
  if (!(a != null && a.length)) return null;
3902
- s || n.suspendHistory();
3917
+ s || o.suspendHistory();
3903
3918
  const r = [];
3904
3919
  if (a.forEach((d) => {
3905
- if (Me._isUngroupableGroup(d)) {
3920
+ if (Se._isUngroupableGroup(d)) {
3906
3921
  const l = this._handleGroupDeletion(d);
3907
3922
  r.push(...l);
3908
3923
  return;
3909
3924
  }
3910
- o.remove(d), r.push(d);
3925
+ n.remove(d), r.push(d);
3911
3926
  }), s) return null;
3912
- o.discardActiveObject(), o.renderAll(), n.resumeHistory(), e || n.saveState();
3927
+ n.discardActiveObject(), n.renderAll(), o.resumeHistory(), e || o.saveState();
3913
3928
  const c = {
3914
3929
  objects: r,
3915
3930
  withoutSave: e
3916
3931
  };
3917
- return o.fire("editor:objects-deleted", c), c;
3932
+ return n.fire("editor:objects-deleted", c), c;
3918
3933
  }
3919
3934
  }
3920
- const bt = {
3935
+ const Mt = {
3921
3936
  IMAGE_MANAGER: {
3922
3937
  /**
3923
3938
  * Некорректный Content-Type изображения
@@ -4022,7 +4037,7 @@ const bt = {
4022
4037
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4023
4038
  }
4024
4039
  };
4025
- class Wt {
4040
+ class Yt {
4026
4041
  constructor({ editor: t }) {
4027
4042
  this._buffer = [], this.editor = t;
4028
4043
  }
@@ -4048,20 +4063,20 @@ class Wt {
4048
4063
  * @param options.message — текст ошибки (опционально, если не передан, то используется код ошибки)
4049
4064
  * @fires editor:error
4050
4065
  */
4051
- emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message: n }) {
4052
- if (!Wt.isValidErrorCode(s)) {
4066
+ emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: n, message: o }) {
4067
+ if (!Yt.isValidErrorCode(s)) {
4053
4068
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
4054
4069
  return;
4055
4070
  }
4056
4071
  if (!s) return;
4057
- const i = n || s;
4058
- console.error(`${t}. ${e}. ${s}. ${i}`, o);
4072
+ const i = o || s;
4073
+ console.error(`${t}. ${e}. ${s}. ${i}`, n);
4059
4074
  const a = {
4060
4075
  code: s,
4061
4076
  origin: t,
4062
4077
  method: e,
4063
4078
  message: i,
4064
- data: o
4079
+ data: n
4065
4080
  };
4066
4081
  this._buffer.push(B({
4067
4082
  type: "editor:error"
@@ -4077,19 +4092,19 @@ class Wt {
4077
4092
  * @param options.message — текст предупреждения (опционально, если не передан, то используется код предупреждения)
4078
4093
  * @fires editor:warning
4079
4094
  */
4080
- emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data: n }) {
4081
- if (!Wt.isValidErrorCode(s)) {
4095
+ emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: n, data: o }) {
4096
+ if (!Yt.isValidErrorCode(s)) {
4082
4097
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
4083
4098
  return;
4084
4099
  }
4085
- const i = o || s;
4086
- console.warn(`${t}. ${e}. ${s}. ${i}`, n);
4100
+ const i = n || s;
4101
+ console.warn(`${t}. ${e}. ${s}. ${i}`, o);
4087
4102
  const a = {
4088
4103
  code: s,
4089
4104
  origin: t,
4090
4105
  method: e,
4091
4106
  message: i,
4092
- data: n
4107
+ data: o
4093
4108
  };
4094
4109
  this._buffer.push(B({
4095
4110
  type: "editor:warning"
@@ -4101,10 +4116,10 @@ class Wt {
4101
4116
  * @returns true, если код допустим, иначе false
4102
4117
  */
4103
4118
  static isValidErrorCode(t) {
4104
- return t ? Object.values(bt).some((e) => Object.values(e).includes(t)) : !1;
4119
+ return t ? Object.values(Mt).some((e) => Object.values(e).includes(t)) : !1;
4105
4120
  }
4106
4121
  }
4107
- class no {
4122
+ class on {
4108
4123
  constructor({ editor: t }) {
4109
4124
  this.currentBounds = null, this.editor = t;
4110
4125
  }
@@ -4117,8 +4132,8 @@ class no {
4117
4132
  * @returns Объект с границами перетаскивания
4118
4133
  */
4119
4134
  calculatePanBounds() {
4120
- const { canvas: t, montageArea: e, zoomManager: s } = this.editor, { defaultZoom: o } = s, n = t.getZoom();
4121
- if (n <= o)
4135
+ const { canvas: t, montageArea: e, zoomManager: s } = this.editor, { defaultZoom: n } = s, o = t.getZoom();
4136
+ if (o <= n)
4122
4137
  return {
4123
4138
  minX: 0,
4124
4139
  maxX: 0,
@@ -4126,7 +4141,7 @@ class no {
4126
4141
  maxY: 0,
4127
4142
  canPan: !1
4128
4143
  };
4129
- const i = e.width * n, a = e.height * n, r = i / 2, c = a / 2;
4144
+ const i = e.width * o, a = e.height * o, r = i / 2, c = a / 2;
4130
4145
  return {
4131
4146
  minX: -r,
4132
4147
  maxX: r,
@@ -4154,13 +4169,13 @@ class no {
4154
4169
  constrainPan(t, e) {
4155
4170
  if (!this.currentBounds || !this.currentBounds.canPan)
4156
4171
  return { x: 0, y: 0 };
4157
- const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, d = i * n + t - r, l = a * n + e - c, u = Math.max(
4172
+ const { canvas: s, montageArea: n } = this.editor, o = s.getZoom(), i = n.left, a = n.top, r = s.getWidth() / 2, c = s.getHeight() / 2, d = i * o + t - r, l = a * o + e - c, u = Math.max(
4158
4173
  this.currentBounds.minX,
4159
4174
  Math.min(this.currentBounds.maxX, d)
4160
4175
  ), g = Math.max(
4161
4176
  this.currentBounds.minY,
4162
4177
  Math.min(this.currentBounds.maxY, l)
4163
- ), f = u + r - i * n, p = g + c - a * n;
4178
+ ), f = u + r - i * o, p = g + c - a * o;
4164
4179
  return {
4165
4180
  x: f,
4166
4181
  y: p
@@ -4178,7 +4193,7 @@ class no {
4178
4193
  * @returns Объект с координатами смещения
4179
4194
  */
4180
4195
  getCurrentOffset() {
4181
- const { canvas: t, montageArea: e } = this.editor, s = t.getZoom(), o = t.viewportTransform, n = e.left, i = e.top, a = t.getWidth() / 2, r = t.getHeight() / 2, c = n * s + o[4] - a, d = i * s + o[5] - r;
4196
+ const { canvas: t, montageArea: e } = this.editor, s = t.getZoom(), n = t.viewportTransform, o = e.left, i = e.top, a = t.getWidth() / 2, r = t.getHeight() / 2, c = o * s + n[4] - a, d = i * s + n[5] - r;
4182
4197
  return { x: c, y: d };
4183
4198
  }
4184
4199
  /**
@@ -4193,10 +4208,10 @@ const at = ({
4193
4208
  value: h,
4194
4209
  min: t,
4195
4210
  max: e
4196
- }) => Math.min(Math.max(h, t), e), Dt = class Dt extends nt {
4211
+ }) => Math.min(Math.max(h, t), e), Dt = class Dt extends ot {
4197
4212
  constructor(t, e = {}) {
4198
- var s, o, n, i, a, r, c, d, l;
4199
- super(t, e), this.backgroundOpacity = (s = e.backgroundOpacity) != null ? s : 1, this.paddingTop = (o = e.paddingTop) != null ? o : 0, this.paddingRight = (n = e.paddingRight) != null ? n : 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();
4213
+ var s, n, o, i, a, r, c, d, l;
4214
+ 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();
4200
4215
  }
4201
4216
  /**
4202
4217
  * Пересчитывает размеры текста и округляет их до целых значений.
@@ -4218,7 +4233,7 @@ const at = ({
4218
4233
  }
4219
4234
  _getTransformedDimensions(t = {}) {
4220
4235
  const { width: e, height: s } = this._getBackgroundDimensions();
4221
- return super._getTransformedDimensions(yt(B({}, t), {
4236
+ return super._getTransformedDimensions(vt(B({}, t), {
4222
4237
  width: e,
4223
4238
  height: s
4224
4239
  }));
@@ -4228,7 +4243,7 @@ const at = ({
4228
4243
  */
4229
4244
  toObject(t = []) {
4230
4245
  const e = super.toObject(t);
4231
- return yt(B({}, e), {
4246
+ return vt(B({}, e), {
4232
4247
  backgroundOpacity: this.backgroundOpacity,
4233
4248
  paddingTop: this.paddingTop,
4234
4249
  paddingRight: this.paddingRight,
@@ -4241,10 +4256,10 @@ const at = ({
4241
4256
  });
4242
4257
  }
4243
4258
  _renderBackground(t) {
4244
- var s, o;
4259
+ var s, n;
4245
4260
  const e = this._getEffectiveBackgroundFill();
4246
4261
  if (e && e) {
4247
- const n = this._getPadding(), i = (s = this.width) != null ? s : 0, a = (o = this.height) != null ? o : 0, r = i + n.left + n.right, c = a + n.top + n.bottom, d = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4262
+ 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;
4248
4263
  t.save(), Dt._renderRoundedRect({
4249
4264
  ctx: t,
4250
4265
  height: c,
@@ -4256,8 +4271,8 @@ const at = ({
4256
4271
  }
4257
4272
  }
4258
4273
  _getBackgroundDimensions() {
4259
- var o, n, i, a;
4260
- const t = (n = (o = this.width) != null ? o : this.calcTextWidth()) != null ? n : 0, e = (a = (i = this.height) != null ? i : this.calcTextHeight()) != null ? a : 0, s = this._getPadding();
4274
+ var n, o, i, a;
4275
+ const t = (o = (n = this.width) != null ? n : this.calcTextWidth()) != null ? o : 0, e = (a = (i = this.height) != null ? i : this.calcTextHeight()) != null ? a : 0, s = this._getPadding();
4261
4276
  return {
4262
4277
  height: e + s.top + s.bottom,
4263
4278
  width: t + s.left + s.right
@@ -4265,38 +4280,38 @@ const at = ({
4265
4280
  }
4266
4281
  _getCornerRadii({ width: t, height: e }) {
4267
4282
  var i, a, r, c;
4268
- const s = t / 2, o = e / 2, n = Math.min(s, o);
4283
+ const s = t / 2, n = e / 2, o = Math.min(s, n);
4269
4284
  return {
4270
- bottomLeft: at({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: n }),
4271
- bottomRight: at({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: n }),
4272
- topLeft: at({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: n }),
4273
- topRight: at({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: n })
4285
+ bottomLeft: at({ value: (i = this.radiusBottomLeft) != null ? i : 0, min: 0, max: o }),
4286
+ bottomRight: at({ value: (a = this.radiusBottomRight) != null ? a : 0, min: 0, max: o }),
4287
+ topLeft: at({ value: (r = this.radiusTopLeft) != null ? r : 0, min: 0, max: o }),
4288
+ topRight: at({ value: (c = this.radiusTopRight) != null ? c : 0, min: 0, max: o })
4274
4289
  };
4275
4290
  }
4276
4291
  _getPadding() {
4277
- var t, e, s, o;
4292
+ var t, e, s, n;
4278
4293
  return {
4279
4294
  bottom: (t = this.paddingBottom) != null ? t : 0,
4280
4295
  left: (e = this.paddingLeft) != null ? e : 0,
4281
4296
  right: (s = this.paddingRight) != null ? s : 0,
4282
- top: (o = this.paddingTop) != null ? o : 0
4297
+ top: (n = this.paddingTop) != null ? n : 0
4283
4298
  };
4284
4299
  }
4285
4300
  _getEffectiveBackgroundFill() {
4286
- var o;
4301
+ var n;
4287
4302
  const t = this.backgroundColor;
4288
4303
  if (!t) return null;
4289
- const e = at({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
4304
+ const e = at({ value: (n = this.backgroundOpacity) != null ? n : 1, min: 0, max: 1 });
4290
4305
  let s;
4291
4306
  try {
4292
4307
  s = new ps(t);
4293
- } catch (n) {
4294
- return Wt.emitError({
4308
+ } catch (o) {
4309
+ return Yt.emitError({
4295
4310
  origin: "BackgroundTextbox",
4296
4311
  method: "_getEffectiveBackgroundFill",
4297
4312
  code: "INVALID_COLOR_VALUE",
4298
4313
  message: `Некорректное значение цвета фона: ${t}`,
4299
- data: { color: t, error: n }
4314
+ data: { color: t, error: o }
4300
4315
  }), null;
4301
4316
  }
4302
4317
  return s.setAlpha(e), s.toRgba();
@@ -4305,17 +4320,17 @@ const at = ({
4305
4320
  ctx: t,
4306
4321
  height: e,
4307
4322
  left: s,
4308
- radii: o,
4309
- top: n,
4323
+ radii: n,
4324
+ top: o,
4310
4325
  width: i
4311
4326
  }) {
4312
- const a = s + i, r = n + e, {
4327
+ const a = s + i, r = o + e, {
4313
4328
  topLeft: c,
4314
4329
  topRight: d,
4315
4330
  bottomRight: l,
4316
4331
  bottomLeft: u
4317
- } = o, g = at({ value: c, min: 0, max: i }), f = at({ value: d, min: 0, max: i }), p = at({ value: l, min: 0, max: i }), m = at({ value: u, min: 0, max: i });
4318
- t.beginPath(), t.moveTo(s + g, n), t.lineTo(a - f, n), t.quadraticCurveTo(a, n, a, n + f), 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, n + g), t.quadraticCurveTo(s, n, s + g, n), t.closePath();
4332
+ } = n, g = at({ value: c, min: 0, max: i }), f = at({ value: d, min: 0, max: i }), p = at({ value: l, min: 0, max: i }), m = at({ value: u, min: 0, max: i });
4333
+ t.beginPath(), t.moveTo(s + g, o), t.lineTo(a - f, o), t.quadraticCurveTo(a, o, a, o + f), 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 + g), t.quadraticCurveTo(s, o, s + g, o), t.closePath();
4319
4334
  }
4320
4335
  /**
4321
4336
  * Округляет текущие значения ширины и высоты до ближайших целых.
@@ -4324,12 +4339,12 @@ const at = ({
4324
4339
  const {
4325
4340
  width: t = 0,
4326
4341
  height: e = 0
4327
- } = this, s = Math.round(t), o = Math.round(e);
4328
- s !== t && (this.width = Math.max(0, s)), o !== e && (this.height = Math.max(0, o));
4342
+ } = this, s = Math.round(t), n = Math.round(e);
4343
+ s !== t && (this.width = Math.max(0, s)), n !== e && (this.height = Math.max(0, n));
4329
4344
  }
4330
4345
  };
4331
4346
  Dt.type = "background-textbox", Dt.cacheProperties = [
4332
- ...Array.isArray(nt.cacheProperties) ? nt.cacheProperties : [],
4347
+ ...Array.isArray(ot.cacheProperties) ? ot.cacheProperties : [],
4333
4348
  "backgroundColor",
4334
4349
  "backgroundOpacity",
4335
4350
  "paddingTop",
@@ -4341,7 +4356,7 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
4341
4356
  "radiusBottomRight",
4342
4357
  "radiusBottomLeft"
4343
4358
  ], Dt.stateProperties = [
4344
- ...Array.isArray(nt.stateProperties) ? nt.stateProperties : [],
4359
+ ...Array.isArray(ot.stateProperties) ? ot.stateProperties : [],
4345
4360
  "backgroundColor",
4346
4361
  "backgroundOpacity",
4347
4362
  "paddingTop",
@@ -4353,41 +4368,41 @@ Dt.type = "background-textbox", Dt.cacheProperties = [
4353
4368
  "radiusBottomRight",
4354
4369
  "radiusBottomLeft"
4355
4370
  ];
4356
- let se = Dt;
4357
- const io = () => {
4371
+ let ne = Dt;
4372
+ const an = () => {
4358
4373
  var h;
4359
- (h = ze) != null && h.setClass && ze.setClass(se, "background-textbox");
4360
- }, ao = ({ textbox: h }) => {
4361
- var s, o;
4374
+ (h = ze) != null && h.setClass && ze.setClass(ne, "background-textbox");
4375
+ }, rn = ({ textbox: h }) => {
4376
+ var s, n;
4362
4377
  if (!h.isEditing) return null;
4363
- const t = (s = h.selectionStart) != null ? s : 0, e = (o = h.selectionEnd) != null ? o : t;
4378
+ const t = (s = h.selectionStart) != null ? s : 0, e = (n = h.selectionEnd) != null ? n : t;
4364
4379
  return t === e ? null : {
4365
4380
  start: Math.min(t, e),
4366
4381
  end: Math.max(t, e)
4367
4382
  };
4368
- }, ro = ({ textbox: h }) => {
4383
+ }, cn = ({ textbox: h }) => {
4369
4384
  var e, s;
4370
4385
  const t = (s = (e = h.text) == null ? void 0 : e.length) != null ? s : 0;
4371
4386
  return t <= 0 ? null : { start: 0, end: t };
4372
- }, co = ({ textbox: h, range: t }) => {
4373
- var s, o;
4387
+ }, dn = ({ textbox: h, range: t }) => {
4388
+ var s, n;
4374
4389
  if (!t) return !1;
4375
- const e = (o = (s = h.text) == null ? void 0 : s.length) != null ? o : 0;
4390
+ const e = (n = (s = h.text) == null ? void 0 : s.length) != null ? n : 0;
4376
4391
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4377
- }, ie = ({
4392
+ }, re = ({
4378
4393
  textbox: h,
4379
4394
  styles: t,
4380
4395
  range: e
4381
4396
  }) => {
4382
4397
  if (!t || !Object.keys(t).length) return !1;
4383
- const { start: s, end: o } = e;
4384
- return o <= s ? !1 : (h.setSelectionStyles(t, s, o), !0);
4398
+ const { start: s, end: n } = e;
4399
+ return n <= s ? !1 : (h.setSelectionStyles(t, s, n), !0);
4385
4400
  }, Ge = ({
4386
4401
  textbox: h,
4387
4402
  range: t,
4388
4403
  property: e
4389
4404
  }) => {
4390
- var o;
4405
+ var n;
4391
4406
  if (!t) return;
4392
4407
  const s = h.getSelectionStyles(
4393
4408
  t.start,
@@ -4395,44 +4410,44 @@ const io = () => {
4395
4410
  !0
4396
4411
  );
4397
4412
  if (s.length)
4398
- return (o = s[0]) == null ? void 0 : o[e];
4399
- }, Ve = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ae = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", ot = 0.01;
4400
- class F {
4413
+ return (n = s[0]) == null ? void 0 : n[e];
4414
+ }, Ve = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Xe = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, ce = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", nt = 0.01;
4415
+ class W {
4401
4416
  constructor({ editor: t }) {
4402
4417
  var e;
4403
4418
  this._handleTextEditingEntered = () => {
4404
4419
  this.isTextEditingActive = !0;
4405
4420
  }, this._handleTextEditingExited = (s) => {
4406
4421
  var r, c;
4407
- const { target: o } = s;
4408
- if (!F._isTextbox(o)) return;
4409
- const n = (r = o.text) != null ? r : "";
4410
- if (!!o.uppercase) {
4411
- const d = (c = o.textCaseRaw) != null ? c : n.toLocaleLowerCase();
4412
- o.textCaseRaw = d;
4422
+ const { target: n } = s;
4423
+ if (!W._isTextbox(n)) return;
4424
+ const o = (r = n.text) != null ? r : "";
4425
+ if (!!n.uppercase) {
4426
+ const d = (c = n.textCaseRaw) != null ? c : o.toLocaleLowerCase();
4427
+ n.textCaseRaw = d;
4413
4428
  } else
4414
- o.textCaseRaw = n;
4415
- F._roundTextboxDimensions({ textbox: o }) && (o.setCoords(), o.dirty = !0, this.canvas.requestRenderAll()), o.locked || o.set({
4429
+ n.textCaseRaw = o;
4430
+ W._roundTextboxDimensions({ textbox: n }) && (n.setCoords(), n.dirty = !0, this.canvas.requestRenderAll()), n.locked || n.set({
4416
4431
  lockMovementX: !1,
4417
4432
  lockMovementY: !1
4418
4433
  }), setTimeout(() => {
4419
4434
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4420
4435
  }, Vs);
4421
4436
  }, this._handleObjectScaling = (s) => {
4422
- var X, It, Ht, mt, Zt, Ct, Se, Ae, je, Ie, Ce, Te, Ee;
4423
- const { target: o, transform: n } = s;
4424
- if (o instanceof U || !F._isTextbox(o) || !n) return;
4425
- o.isScaling = !0;
4426
- const i = this._ensureScalingState(o), {
4437
+ var kt, zt, X, It, Zt, yt, Gt, Ct, je, Ie, Ce, Te, Ee;
4438
+ const { target: n, transform: o } = s;
4439
+ if (n instanceof U || !W._isTextbox(n) || !o) return;
4440
+ n.isScaling = !0;
4441
+ const i = this._ensureScalingState(n), {
4427
4442
  baseWidth: a,
4428
4443
  baseLeft: r,
4429
4444
  baseFontSize: c,
4430
4445
  basePadding: d,
4431
4446
  baseRadii: l,
4432
4447
  baseStyles: u
4433
- } = i, g = typeof ((X = n.original) == null ? void 0 : X.width) == "number" ? n.original.width : void 0, f = typeof ((It = n.original) == null ? void 0 : It.left) == "number" ? n.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (Ht = n.corner) != null ? Ht : "", M = (mt = n.action) != null ? mt : "", S = ["ml", "mr"].includes(v) || M === "scaleX", y = ["mt", "mb"].includes(v) || M === "scaleY", b = ["tl", "tr", "bl", "br"].includes(v) || M === "scale", I = b || y;
4448
+ } = i, g = typeof ((kt = o.original) == null ? void 0 : kt.width) == "number" ? o.original.width : void 0, f = typeof ((zt = o.original) == null ? void 0 : zt.left) == "number" ? o.original.left : void 0, p = g != null ? g : a, m = f != null ? f : r, v = (X = o.corner) != null ? X : "", M = (It = o.action) != null ? It : "", S = ["ml", "mr"].includes(v) || M === "scaleX", y = ["mt", "mb"].includes(v) || M === "scaleY", b = ["tl", "tr", "bl", "br"].includes(v) || M === "scale", I = b || y;
4434
4449
  if (!S && !y && !b) return;
4435
- const j = Math.abs((Ct = (Zt = o.scaleX) != null ? Zt : n.scaleX) != null ? Ct : 1) || 1, A = Math.abs((Ae = (Se = o.scaleY) != null ? Se : n.scaleY) != null ? Ae : 1) || 1, C = Math.max(1, p * j), w = Math.max(1, Math.round(C)), T = Math.max(1, c * A), {
4450
+ const j = Math.abs((yt = (Zt = n.scaleX) != null ? Zt : o.scaleX) != null ? yt : 1) || 1, A = Math.abs((Ct = (Gt = n.scaleY) != null ? Gt : o.scaleY) != null ? Ct : 1) || 1, C = Math.max(1, p * j), w = Math.max(1, Math.round(C)), T = Math.max(1, c * A), {
4436
4451
  paddingTop: E = 0,
4437
4452
  paddingRight: P = 0,
4438
4453
  paddingBottom: x = 0,
@@ -4440,11 +4455,11 @@ class F {
4440
4455
  radiusTopLeft: Z = 0,
4441
4456
  radiusTopRight: D = 0,
4442
4457
  radiusBottomRight: _ = 0,
4443
- radiusBottomLeft: W = 0,
4458
+ radiusBottomLeft: F = 0,
4444
4459
  fontSize: G,
4445
4460
  width: Y,
4446
4461
  originX: K = "left"
4447
- } = o, tt = b || y, J = b || y, H = tt ? {
4462
+ } = n, tt = b || y, J = b || y, H = tt ? {
4448
4463
  top: Math.max(0, d.top * A),
4449
4464
  right: Math.max(0, d.right * A),
4450
4465
  bottom: Math.max(0, d.bottom * A),
@@ -4454,26 +4469,26 @@ class F {
4454
4469
  topRight: Math.max(0, l.topRight * A),
4455
4470
  bottomRight: Math.max(0, l.bottomRight * A),
4456
4471
  bottomLeft: Math.max(0, l.bottomLeft * A)
4457
- } : l, St = Object.keys(u).length > 0;
4472
+ } : l, At = Object.keys(u).length > 0;
4458
4473
  let st;
4459
- if (I && St) {
4460
- const oe = {};
4474
+ if (I && At) {
4475
+ const ie = {};
4461
4476
  Object.entries(u).forEach(([as, Oe]) => {
4462
4477
  if (!Oe) return;
4463
- const ne = {};
4464
- Object.entries(Oe).forEach(([rs, Gt]) => {
4465
- if (!Gt) return;
4466
- const Le = B({}, Gt);
4467
- typeof Gt.fontSize == "number" && (Le.fontSize = Math.max(1, Gt.fontSize * A)), ne[rs] = Le;
4468
- }), Object.keys(ne).length && (oe[as] = ne);
4469
- }), Object.keys(oe).length && (st = oe);
4478
+ const ae = {};
4479
+ Object.entries(Oe).forEach(([rs, Vt]) => {
4480
+ if (!Vt) return;
4481
+ const Le = B({}, Vt);
4482
+ typeof Vt.fontSize == "number" && (Le.fontSize = Math.max(1, Vt.fontSize * A)), ae[rs] = Le;
4483
+ }), Object.keys(ae).length && (ie[as] = ae);
4484
+ }), Object.keys(ie).length && (st = ie);
4470
4485
  }
4471
- const lt = (Ie = (je = n.originX) != null ? je : K) != null ? Ie : "left", pt = m + p, At = m + p / 2, ht = Y != null ? Y : p, jt = w !== ht, Yt = Math.abs(T - (G != null ? G : c)) > ot, xt = Math.abs(H.top - E) > ot || Math.abs(H.right - P) > ot || Math.abs(H.bottom - x) > ot || Math.abs(H.left - N) > ot, Nt = Math.abs(q.topLeft - Z) > ot || Math.abs(q.topRight - D) > ot || Math.abs(q.bottomRight - _) > ot || Math.abs(q.bottomLeft - W) > ot;
4472
- if (!jt && !Yt && !xt && !Nt) {
4473
- o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4486
+ const lt = (Ie = (je = o.originX) != null ? je : K) != null ? Ie : "left", mt = m + p, jt = m + p / 2, ht = Y != null ? Y : p, ut = w !== ht, oe = Math.abs(T - (G != null ? G : c)) > nt, Ht = Math.abs(H.top - E) > nt || Math.abs(H.right - P) > nt || Math.abs(H.bottom - x) > nt || Math.abs(H.left - N) > nt, xt = Math.abs(q.topLeft - Z) > nt || Math.abs(q.topRight - D) > nt || Math.abs(q.bottomRight - _) > nt || Math.abs(q.bottomLeft - F) > nt;
4487
+ if (!ut && !oe && !Ht && !xt) {
4488
+ n.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
4474
4489
  return;
4475
4490
  }
4476
- st && (o.styles = st), o.set({
4491
+ st && (n.styles = st), n.set({
4477
4492
  width: w,
4478
4493
  fontSize: I ? T : c,
4479
4494
  paddingTop: H.top,
@@ -4487,13 +4502,13 @@ class F {
4487
4502
  scaleX: 1,
4488
4503
  scaleY: 1
4489
4504
  });
4490
- const Bt = F._roundTextboxDimensions({ textbox: o });
4491
- Bt && (o.dirty = !0);
4492
- const ut = (Ce = o.width) != null ? Ce : w, kt = ut !== ht;
4493
- let gt = m;
4494
- kt && (S || b) && (lt === "right" ? gt = pt - ut : lt === "center" && (gt = At - ut / 2)), o.set({ left: gt }), i.baseLeft = gt, n.scaleX = 1, n.scaleY = 1;
4495
- const { original: it } = n;
4496
- it && (it.scaleX = 1, it.scaleY = 1, it.width = ut, it.height = o.height, it.left = gt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ut, i.baseFontSize = (Te = o.fontSize) != null ? Te : T, i.baseStyles = JSON.parse(JSON.stringify((Ee = o.styles) != null ? Ee : {})), i.basePadding = {
4505
+ const Nt = W._roundTextboxDimensions({ textbox: n });
4506
+ Nt && (n.dirty = !0);
4507
+ const gt = (Ce = n.width) != null ? Ce : w, Bt = gt !== ht;
4508
+ let ft = m;
4509
+ Bt && (S || b) && (lt === "right" ? ft = mt - gt : lt === "center" && (ft = jt - gt / 2)), n.set({ left: ft }), i.baseLeft = ft, o.scaleX = 1, o.scaleY = 1;
4510
+ const { original: it } = o;
4511
+ it && (it.scaleX = 1, it.scaleY = 1, it.width = gt, it.height = n.height, it.left = ft), n.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = gt, i.baseFontSize = (Te = n.fontSize) != null ? Te : T, i.baseStyles = JSON.parse(JSON.stringify((Ee = n.styles) != null ? Ee : {})), i.basePadding = {
4497
4512
  top: H.top,
4498
4513
  right: H.right,
4499
4514
  bottom: H.bottom,
@@ -4503,19 +4518,19 @@ class F {
4503
4518
  topRight: q.topRight,
4504
4519
  bottomRight: q.bottomRight,
4505
4520
  bottomLeft: q.bottomLeft
4506
- }, i.hasWidthChange = kt || Yt || xt || Nt || Bt;
4521
+ }, i.hasWidthChange = Bt || oe || Ht || xt || Nt;
4507
4522
  }, this._handleObjectModified = (s) => {
4508
4523
  var M, S, y;
4509
- const { target: o } = s;
4510
- if (o instanceof U) {
4511
- const b = o.getObjects();
4512
- if (!b.some((w) => F._isTextbox(w))) return;
4513
- const { scaleX: j = 1, scaleY: A = 1 } = o;
4514
- if (Math.abs(j - 1) < ot && Math.abs(A - 1) < ot) return;
4524
+ const { target: n } = s;
4525
+ if (n instanceof U) {
4526
+ const b = n.getObjects();
4527
+ if (!b.some((w) => W._isTextbox(w))) return;
4528
+ const { scaleX: j = 1, scaleY: A = 1 } = n;
4529
+ if (Math.abs(j - 1) < nt && Math.abs(A - 1) < nt) return;
4515
4530
  this.canvas.discardActiveObject(), b.forEach((w) => {
4516
4531
  var T, E, P, x;
4517
- if (F._isTextbox(w)) {
4518
- const N = (T = w.scaleX) != null ? T : 1, Z = (E = w.scaleY) != null ? E : 1, D = ((P = w.fontSize) != null ? P : 16) * Z, _ = ((x = w.width) != null ? x : 0) * N, W = Z, {
4532
+ if (W._isTextbox(w)) {
4533
+ const N = (T = w.scaleX) != null ? T : 1, Z = (E = w.scaleY) != null ? E : 1, D = ((P = w.fontSize) != null ? P : 16) * Z, _ = ((x = w.width) != null ? x : 0) * N, F = Z, {
4519
4534
  paddingTop: G = 0,
4520
4535
  paddingRight: Y = 0,
4521
4536
  paddingBottom: K = 0,
@@ -4523,32 +4538,32 @@ class F {
4523
4538
  radiusTopLeft: J = 0,
4524
4539
  radiusTopRight: H = 0,
4525
4540
  radiusBottomRight: q = 0,
4526
- radiusBottomLeft: St = 0,
4541
+ radiusBottomLeft: At = 0,
4527
4542
  styles: st
4528
4543
  } = w, lt = {
4529
- paddingTop: Math.max(0, G * W),
4530
- paddingRight: Math.max(0, Y * W),
4531
- paddingBottom: Math.max(0, K * W),
4532
- paddingLeft: Math.max(0, tt * W)
4533
- }, pt = {
4534
- radiusTopLeft: Math.max(0, J * W),
4535
- radiusTopRight: Math.max(0, H * W),
4536
- radiusBottomRight: Math.max(0, q * W),
4537
- radiusBottomLeft: Math.max(0, St * W)
4544
+ paddingTop: Math.max(0, G * F),
4545
+ paddingRight: Math.max(0, Y * F),
4546
+ paddingBottom: Math.max(0, K * F),
4547
+ paddingLeft: Math.max(0, tt * F)
4548
+ }, mt = {
4549
+ radiusTopLeft: Math.max(0, J * F),
4550
+ radiusTopRight: Math.max(0, H * F),
4551
+ radiusBottomRight: Math.max(0, q * F),
4552
+ radiusBottomLeft: Math.max(0, At * F)
4538
4553
  };
4539
- let At = st;
4540
- st && Object.keys(st).length > 0 && (At = JSON.parse(JSON.stringify(st)), Object.values(At).forEach((ht) => {
4541
- Object.values(ht).forEach((jt) => {
4542
- typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * W));
4554
+ let jt = st;
4555
+ st && Object.keys(st).length > 0 && (jt = JSON.parse(JSON.stringify(st)), Object.values(jt).forEach((ht) => {
4556
+ Object.values(ht).forEach((ut) => {
4557
+ typeof ut.fontSize == "number" && (ut.fontSize = Math.max(1, ut.fontSize * F));
4543
4558
  });
4544
- })), w.set(yt(B(B({
4559
+ })), w.set(vt(B(B({
4545
4560
  fontSize: D,
4546
4561
  width: _,
4547
4562
  scaleX: 1,
4548
4563
  scaleY: 1
4549
- }, lt), pt), {
4550
- styles: At
4551
- })), F._roundTextboxDimensions({ textbox: w });
4564
+ }, lt), mt), {
4565
+ styles: jt
4566
+ })), W._roundTextboxDimensions({ textbox: w });
4552
4567
  }
4553
4568
  w.setCoords();
4554
4569
  });
@@ -4558,11 +4573,11 @@ class F {
4558
4573
  this.canvas.setActiveObject(C), this.canvas.requestRenderAll();
4559
4574
  return;
4560
4575
  }
4561
- if (!F._isTextbox(o)) return;
4562
- o.isScaling = !1;
4563
- const n = this.scalingState.get(o);
4564
- if (this.scalingState.delete(o), !(n != null && n.hasWidthChange)) return;
4565
- const i = (M = o.width) != null ? M : o.calcTextWidth(), a = (y = (S = o.fontSize) != null ? S : n == null ? void 0 : n.baseFontSize) != null ? y : 16, r = !!(n.baseStyles && Object.keys(n.baseStyles).length), {
4576
+ if (!W._isTextbox(n)) return;
4577
+ n.isScaling = !1;
4578
+ const o = this.scalingState.get(n);
4579
+ if (this.scalingState.delete(n), !(o != null && o.hasWidthChange)) return;
4580
+ const i = (M = n.width) != null ? M : n.calcTextWidth(), a = (y = (S = n.fontSize) != null ? S : o == null ? void 0 : o.baseFontSize) != null ? y : 16, r = !!(o.baseStyles && Object.keys(o.baseStyles).length), {
4566
4581
  paddingTop: c = 0,
4567
4582
  paddingRight: d = 0,
4568
4583
  paddingBottom: l = 0,
@@ -4571,7 +4586,7 @@ class F {
4571
4586
  radiusTopRight: f = 0,
4572
4587
  radiusBottomRight: p = 0,
4573
4588
  radiusBottomLeft: m = 0
4574
- } = o, v = {
4589
+ } = n, v = {
4575
4590
  width: i,
4576
4591
  paddingTop: c,
4577
4592
  paddingRight: d,
@@ -4583,10 +4598,10 @@ class F {
4583
4598
  radiusBottomLeft: m
4584
4599
  };
4585
4600
  r || (v.fontSize = a), this.updateText({
4586
- target: o,
4601
+ target: n,
4587
4602
  style: v
4588
- }), o.set({ scaleX: 1, scaleY: 1 }), o.setCoords();
4589
- }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), io();
4603
+ }), n.set({ scaleX: 1, scaleY: 1 }), n.setCoords();
4604
+ }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents(), an();
4590
4605
  }
4591
4606
  /**
4592
4607
  * Добавляет новый текстовый объект на канвас.
@@ -4598,8 +4613,8 @@ class F {
4598
4613
  id: t = `text-${V()}`,
4599
4614
  text: e = "Новый текст",
4600
4615
  fontFamily: s,
4601
- fontSize: o = 48,
4602
- bold: n = !1,
4616
+ fontSize: n = 48,
4617
+ bold: o = !1,
4603
4618
  italic: i = !1,
4604
4619
  underline: a = !1,
4605
4620
  uppercase: r = !1,
@@ -4619,7 +4634,7 @@ class F {
4619
4634
  radiusTopRight: I = 0,
4620
4635
  radiusBottomRight: j = 0,
4621
4636
  radiusBottomLeft: A = 0
4622
- } = x, C = vt(x, [
4637
+ } = x, C = bt(x, [
4623
4638
  "id",
4624
4639
  "text",
4625
4640
  "fontFamily",
@@ -4648,21 +4663,21 @@ class F {
4648
4663
  var tt;
4649
4664
  const { historyManager: N } = this.editor, { canvas: Z } = this;
4650
4665
  N.suspendHistory();
4651
- const D = s != null ? s : this._getDefaultFontFamily(), _ = Xe({ width: g }), W = Ve({
4666
+ const D = s != null ? s : this._getDefaultFontFamily(), _ = Xe({ width: g }), F = Ve({
4652
4667
  strokeColor: u,
4653
4668
  width: _
4654
4669
  }), G = B({
4655
4670
  id: t,
4656
4671
  fontFamily: D,
4657
- fontSize: o,
4658
- fontWeight: n ? "bold" : "normal",
4672
+ fontSize: n,
4673
+ fontWeight: o ? "bold" : "normal",
4659
4674
  fontStyle: i ? "italic" : "normal",
4660
4675
  underline: a,
4661
4676
  uppercase: r,
4662
4677
  linethrough: c,
4663
4678
  textAlign: d,
4664
4679
  fill: l,
4665
- stroke: W,
4680
+ stroke: F,
4666
4681
  strokeWidth: _,
4667
4682
  strokeUniform: !0,
4668
4683
  opacity: f,
@@ -4676,21 +4691,21 @@ class F {
4676
4691
  radiusTopRight: I,
4677
4692
  radiusBottomRight: j,
4678
4693
  radiusBottomLeft: A
4679
- }, C), Y = new se(e, G);
4694
+ }, C), Y = new ne(e, G);
4680
4695
  if (Y.textCaseRaw = (tt = Y.text) != null ? tt : "", r) {
4681
- const J = ae({ value: Y.textCaseRaw });
4696
+ const J = ce({ value: Y.textCaseRaw });
4682
4697
  J !== Y.text && Y.set({ text: J });
4683
4698
  }
4684
- return F._roundTextboxDimensions({ textbox: Y }) && (Y.dirty = !0), C.left === void 0 && C.top === void 0 && Z.centerObject(Y), E || Z.add(Y), w || Z.setActiveObject(Y), Z.requestRenderAll(), N.resumeHistory(), T || N.saveState(), Z.fire("editor:text-added", {
4699
+ return W._roundTextboxDimensions({ textbox: Y }) && (Y.dirty = !0), C.left === void 0 && C.top === void 0 && Z.centerObject(Y), E || Z.add(Y), w || Z.setActiveObject(Y), Z.requestRenderAll(), N.resumeHistory(), T || N.saveState(), Z.fire("editor:text-added", {
4685
4700
  textbox: Y,
4686
- options: yt(B({}, G), {
4701
+ options: vt(B({}, G), {
4687
4702
  text: e,
4688
- bold: n,
4703
+ bold: o,
4689
4704
  italic: i,
4690
4705
  strikethrough: c,
4691
4706
  align: d,
4692
4707
  color: l,
4693
- strokeColor: W,
4708
+ strokeColor: F,
4694
4709
  strokeWidth: _
4695
4710
  }),
4696
4711
  flags: {
@@ -4708,13 +4723,13 @@ class F {
4708
4723
  * @param options.withoutSave — не сохранять состояние в историю
4709
4724
  * @param options.skipRender — не вызывать перерисовку канваса
4710
4725
  */
4711
- updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
4712
- var Nt, Bt, ut, kt, gt, it;
4713
- const n = this._resolveTextObject(t);
4714
- if (!n) return null;
4726
+ updateText({ target: t, style: e = {}, withoutSave: s, skipRender: n } = {}) {
4727
+ var Nt, gt, Bt, ft, it, kt, zt;
4728
+ const o = this._resolveTextObject(t);
4729
+ if (!o) return null;
4715
4730
  const { historyManager: i } = this.editor, { canvas: a } = this;
4716
4731
  i.suspendHistory();
4717
- const r = F._getSnapshot(n), xt = e, {
4732
+ const r = W._getSnapshot(o), xt = e, {
4718
4733
  text: c,
4719
4734
  fontFamily: d,
4720
4735
  fontSize: l,
@@ -4738,7 +4753,7 @@ class F {
4738
4753
  radiusTopRight: P,
4739
4754
  radiusBottomRight: x,
4740
4755
  radiusBottomLeft: N
4741
- } = xt, Z = vt(xt, [
4756
+ } = xt, Z = bt(xt, [
4742
4757
  "text",
4743
4758
  "fontFamily",
4744
4759
  "fontSize",
@@ -4762,8 +4777,8 @@ class F {
4762
4777
  "radiusTopRight",
4763
4778
  "radiusBottomRight",
4764
4779
  "radiusBottomLeft"
4765
- ]), D = B({}, Z), _ = ao({ textbox: n }), W = _ ? F._expandRangeToFullLines({ textbox: n, range: _ }) : null, G = {}, Y = {}, K = {}, tt = co({ textbox: n, range: _ }), J = !_ || tt, H = !_;
4766
- if (d !== void 0 && (W && (Y.fontFamily = d), J && (D.fontFamily = d, H && (K.fontFamily = d))), l !== void 0 && (W && (Y.fontSize = l), J && (D.fontSize = l, H && (K.fontSize = l))), u !== void 0) {
4780
+ ]), D = B({}, Z), _ = rn({ textbox: o }), F = _ ? W._expandRangeToFullLines({ textbox: o, range: _ }) : null, G = {}, Y = {}, K = {}, tt = dn({ textbox: o, range: _ }), J = !_ || tt, H = !_;
4781
+ if (d !== void 0 && (F && (Y.fontFamily = d), J && (D.fontFamily = d, H && (K.fontFamily = d))), l !== void 0 && (F && (Y.fontSize = l), J && (D.fontSize = l, H && (K.fontSize = l))), u !== void 0) {
4767
4782
  const X = u ? "bold" : "normal";
4768
4783
  _ && (G.fontWeight = X), J && (D.fontWeight = X, H && (K.fontWeight = X));
4769
4784
  }
@@ -4772,63 +4787,65 @@ class F {
4772
4787
  _ && (G.fontStyle = X), J && (D.fontStyle = X, H && (K.fontStyle = X));
4773
4788
  }
4774
4789
  if (f !== void 0 && (_ && (G.underline = f), J && (D.underline = f, H && (K.underline = f))), m !== void 0 && (_ && (G.linethrough = m), J && (D.linethrough = m, H && (K.linethrough = m))), v !== void 0 && (D.textAlign = v), M !== void 0 && (_ && (G.fill = M), J && (D.fill = M, H && (K.fill = M))), S !== void 0 || y !== void 0) {
4775
- const X = _ ? Ge({ textbox: n, range: _, property: "strokeWidth" }) : void 0, It = _ ? Ge({ textbox: n, range: _, property: "stroke" }) : void 0, Ht = (Bt = (Nt = y != null ? y : X) != null ? Nt : n.strokeWidth) != null ? Bt : 0, mt = Xe({ width: Ht }), Zt = (kt = (ut = S != null ? S : It) != null ? ut : n.stroke) != null ? kt : void 0, Ct = Ve({
4776
- strokeColor: Zt,
4777
- width: mt
4790
+ const X = _ ? Ge({ textbox: o, range: _, property: "strokeWidth" }) : void 0, It = _ ? Ge({ textbox: o, range: _, property: "stroke" }) : void 0, Zt = (gt = (Nt = y != null ? y : X) != null ? Nt : o.strokeWidth) != null ? gt : 0, yt = Xe({ width: Zt }), Gt = (ft = (Bt = S != null ? S : It) != null ? Bt : o.stroke) != null ? ft : void 0, Ct = Ve({
4791
+ strokeColor: Gt,
4792
+ width: yt
4778
4793
  });
4779
- _ && (G.stroke = Ct, G.strokeWidth = mt), J && (D.stroke = Ct, D.strokeWidth = mt, H && (K.stroke = Ct, K.strokeWidth = mt));
4794
+ _ && (G.stroke = Ct, G.strokeWidth = yt), J && (D.stroke = Ct, D.strokeWidth = yt, H && (K.stroke = Ct, K.strokeWidth = yt));
4780
4795
  }
4781
4796
  b !== void 0 && (D.opacity = b), I !== void 0 && (D.backgroundColor = I), j !== void 0 && (D.backgroundOpacity = j), A !== void 0 && (D.paddingTop = A), C !== void 0 && (D.paddingRight = C), w !== void 0 && (D.paddingBottom = w), T !== void 0 && (D.paddingLeft = T), E !== void 0 && (D.radiusTopLeft = E), P !== void 0 && (D.radiusTopRight = P), x !== void 0 && (D.radiusBottomRight = x), N !== void 0 && (D.radiusBottomLeft = N);
4782
- const q = (it = n.textCaseRaw) != null ? it : (gt = n.text) != null ? gt : "", St = !!n.uppercase, st = c !== void 0, lt = st ? c != null ? c : "" : q, pt = p != null ? p : St;
4783
- if (st || pt !== St) {
4784
- const X = pt ? ae({ value: lt }) : lt;
4785
- D.text = X, n.textCaseRaw = lt;
4786
- } else n.textCaseRaw === void 0 && (n.textCaseRaw = q);
4787
- n.uppercase = pt, n.set(D);
4797
+ const q = (kt = o.textCaseRaw) != null ? kt : (it = o.text) != null ? it : "", At = !!o.uppercase, st = c !== void 0, lt = st ? c != null ? c : "" : q, mt = p != null ? p : At;
4798
+ if (st || mt !== At) {
4799
+ const X = mt ? ce({ value: lt }) : lt;
4800
+ D.text = X, o.textCaseRaw = lt;
4801
+ } else o.textCaseRaw === void 0 && (o.textCaseRaw = q);
4802
+ o.uppercase = mt, o.set(D);
4788
4803
  let ht = !1;
4789
4804
  if (_) {
4790
- const X = ie({ textbox: n, styles: G, range: _ }), It = W ? ie({ textbox: n, styles: Y, range: W }) : !1;
4805
+ const X = re({ textbox: o, styles: G, range: _ }), It = F ? re({ textbox: o, styles: Y, range: F }) : !1;
4791
4806
  ht = X || It;
4792
4807
  } else if (Object.keys(K).length) {
4793
- const X = ro({ textbox: n });
4794
- X && (ht = ie({ textbox: n, styles: K, range: X }));
4808
+ const X = cn({ textbox: o });
4809
+ X && (ht = re({ textbox: o, styles: K, range: X }));
4795
4810
  }
4796
- ht && (n.dirty = !0), (I !== void 0 || j !== void 0 || A !== void 0 || C !== void 0 || w !== void 0 || T !== void 0 || E !== void 0 || P !== void 0 || x !== void 0 || N !== void 0) && (n.dirty = !0), F._roundTextboxDimensions({ textbox: n }) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4797
- const Yt = F._getSnapshot(n);
4811
+ ht && (o.dirty = !0), (I !== void 0 || j !== void 0 || A !== void 0 || C !== void 0 || w !== void 0 || T !== void 0 || E !== void 0 || P !== void 0 || x !== void 0 || N !== void 0) && (o.dirty = !0);
4812
+ const ut = o.calcTextWidth();
4813
+ ut > ((zt = o.width) != null ? zt : 0) && (o.set({ width: ut }), o.dirty = !0), W._roundTextboxDimensions({ textbox: o }) && (o.dirty = !0), o.setCoords(), n || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4814
+ const Ht = W._getSnapshot(o);
4798
4815
  return a.fire("editor:text-updated", {
4799
- textbox: n,
4816
+ textbox: o,
4800
4817
  target: t,
4801
4818
  style: e,
4802
4819
  options: {
4803
4820
  withoutSave: !!s,
4804
- skipRender: !!o
4821
+ skipRender: !!n
4805
4822
  },
4806
4823
  updates: D,
4807
4824
  before: r,
4808
- after: Yt,
4825
+ after: Ht,
4809
4826
  selectionRange: _ != null ? _ : void 0,
4810
4827
  selectionStyles: _ && Object.keys(G).length ? G : void 0
4811
- }), n;
4828
+ }), o;
4812
4829
  }
4813
4830
  /**
4814
4831
  * Уничтожает менеджер и снимает слушатели.
4815
4832
  */
4816
4833
  destroy() {
4817
4834
  const { canvas: t } = this;
4818
- t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", F._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", F._handleTextChanged);
4835
+ t.off("object:scaling", this._handleObjectScaling), t.off("object:resizing", W._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", W._handleTextChanged);
4819
4836
  }
4820
4837
  /**
4821
4838
  * Возвращает активный текст или ищет по id.
4822
4839
  */
4823
4840
  _resolveTextObject(t) {
4824
- if (t instanceof nt) return t;
4841
+ if (t instanceof ot) return t;
4825
4842
  const { canvas: e } = this;
4826
4843
  if (!t) {
4827
4844
  const s = e.getActiveObject();
4828
- return F._isTextbox(s) ? s : null;
4845
+ return W._isTextbox(s) ? s : null;
4829
4846
  }
4830
4847
  if (typeof t == "string") {
4831
- const s = e.getObjects().find((o) => F._isTextbox(o) && o.id === t);
4848
+ const s = e.getObjects().find((n) => W._isTextbox(n) && n.id === t);
4832
4849
  return s != null ? s : null;
4833
4850
  }
4834
4851
  return null;
@@ -4837,28 +4854,28 @@ class F {
4837
4854
  * Проверяет, является ли объект текстовым блоком редактора.
4838
4855
  */
4839
4856
  static _isTextbox(t) {
4840
- return !!t && t instanceof nt;
4857
+ return !!t && t instanceof ot;
4841
4858
  }
4842
4859
  /**
4843
4860
  * Вешает обработчики событий Fabric для работы с текстом.
4844
4861
  */
4845
4862
  _bindEvents() {
4846
4863
  const { canvas: t } = this;
4847
- t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", F._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", F._handleTextChanged);
4864
+ t.on("object:scaling", this._handleObjectScaling), t.on("object:resizing", W._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", W._handleTextChanged);
4848
4865
  }
4849
4866
  /**
4850
4867
  * Реагирует на изменение текста в режиме редактирования: синхронизирует textCaseRaw и uppercase.
4851
4868
  */
4852
4869
  static _handleTextChanged(t) {
4853
4870
  const { target: e } = t;
4854
- if (!F._isTextbox(e)) return;
4855
- const { text: s = "", uppercase: o } = e, n = !!o, i = s.toLocaleLowerCase();
4856
- if (n) {
4857
- const r = ae({ value: i });
4871
+ if (!W._isTextbox(e)) return;
4872
+ const { text: s = "", uppercase: n } = e, o = !!n, i = s.toLocaleLowerCase();
4873
+ if (o) {
4874
+ const r = ce({ value: i });
4858
4875
  r !== s && e.set({ text: r }), e.textCaseRaw = i;
4859
4876
  } else
4860
4877
  e.textCaseRaw = s;
4861
- F._roundTextboxDimensions({ textbox: e }) && (e.setCoords(), e.dirty = !0);
4878
+ W._roundTextboxDimensions({ textbox: e }) && (e.setCoords(), e.dirty = !0);
4862
4879
  }
4863
4880
  /**
4864
4881
  * Обрабатывает изменение ширины текстового объекта (resizing).
@@ -4869,11 +4886,11 @@ class F {
4869
4886
  static _handleObjectResizing(t) {
4870
4887
  var l, u, g, f, p, m;
4871
4888
  const { target: e, transform: s } = t;
4872
- if (!F._isTextbox(e)) return;
4889
+ if (!W._isTextbox(e)) return;
4873
4890
  const {
4874
- paddingLeft: o = 0,
4875
- paddingRight: n = 0
4876
- } = e, i = o + n;
4891
+ paddingLeft: n = 0,
4892
+ paddingRight: o = 0
4893
+ } = e, i = n + o;
4877
4894
  if (i === 0) return;
4878
4895
  const a = (l = e.width) != null ? l : 0, r = Math.max(0, a - i);
4879
4896
  if (a === r) return;
@@ -4891,15 +4908,15 @@ class F {
4891
4908
  * Возвращает диапазоны символов для каждой строки текста без учёта символов переноса.
4892
4909
  */
4893
4910
  static _getLineRanges({ textbox: t }) {
4894
- var n;
4895
- const e = (n = t.text) != null ? n : "";
4911
+ var o;
4912
+ const e = (o = t.text) != null ? o : "";
4896
4913
  if (!e.length) return [];
4897
4914
  const s = e.split(`
4898
4915
  `);
4899
- let o = 0;
4916
+ let n = 0;
4900
4917
  return s.map((i) => {
4901
- const a = o, r = o + i.length;
4902
- return o = r + 1, { start: a, end: r };
4918
+ const a = n, r = n + i.length;
4919
+ return n = r + 1, { start: a, end: r };
4903
4920
  });
4904
4921
  }
4905
4922
  /**
@@ -4909,21 +4926,21 @@ class F {
4909
4926
  textbox: t,
4910
4927
  range: e
4911
4928
  }) {
4912
- const s = F._getLineRanges({ textbox: t });
4929
+ const s = W._getLineRanges({ textbox: t });
4913
4930
  if (!s.length) return e;
4914
- let { start: o } = e, { end: n } = e;
4931
+ let { start: n } = e, { end: o } = e;
4915
4932
  return s.forEach(({ start: i, end: a }) => {
4916
- e.end > i && e.start < a && (o = Math.min(o, i), n = Math.max(n, a));
4917
- }), { start: o, end: n };
4933
+ e.end > i && e.start < a && (n = Math.min(n, i), o = Math.max(o, a));
4934
+ }), { start: n, end: o };
4918
4935
  }
4919
4936
  /**
4920
4937
  * Создаёт или возвращает сохранённое состояние для текущего цикла масштабирования текста.
4921
4938
  */
4922
4939
  _ensureScalingState(t) {
4923
- var s, o, n;
4940
+ var s, n, o;
4924
4941
  let e = this.scalingState.get(t);
4925
4942
  if (!e) {
4926
- const i = (s = t.width) != null ? s : t.calcTextWidth(), a = (o = t.left) != null ? o : 0, r = (n = t.fontSize) != null ? n : 16, { styles: c = {} } = t, {
4943
+ const i = (s = t.width) != null ? s : t.calcTextWidth(), a = (n = t.left) != null ? n : 0, r = (o = t.fontSize) != null ? o : 16, { styles: c = {} } = t, {
4927
4944
  paddingTop: d = 0,
4928
4945
  paddingRight: l = 0,
4929
4946
  paddingBottom: u = 0,
@@ -4971,10 +4988,10 @@ class F {
4971
4988
  static _roundTextboxDimensions({
4972
4989
  textbox: t
4973
4990
  }) {
4974
- const { width: e, height: s, calcTextWidth: o, calcTextHeight: n } = t, i = typeof o == "function" ? o.call(t) : void 0, a = typeof n == "function" ? n.call(t) : void 0, r = F._resolveDimension({
4991
+ 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 = W._resolveDimension({
4975
4992
  rawValue: e,
4976
4993
  calculatedValue: i
4977
- }), c = F._resolveDimension({
4994
+ }), c = W._resolveDimension({
4978
4995
  rawValue: s,
4979
4996
  calculatedValue: a
4980
4997
  }), d = Number.isFinite(r) ? Math.round(r) : null, l = Number.isFinite(c) ? Math.round(c) : null, u = {};
@@ -4993,8 +5010,8 @@ class F {
4993
5010
  });
4994
5011
  }, {
4995
5012
  id: s,
4996
- text: o,
4997
- textCaseRaw: n,
5013
+ text: n,
5014
+ textCaseRaw: o,
4998
5015
  uppercase: i,
4999
5016
  fontFamily: a,
5000
5017
  fontSize: r,
@@ -5024,16 +5041,16 @@ class F {
5024
5041
  angle: Z,
5025
5042
  scaleX: D,
5026
5043
  scaleY: _
5027
- } = t, W = {
5044
+ } = t, F = {
5028
5045
  id: s,
5029
5046
  uppercase: !!i,
5030
5047
  textAlign: g
5031
5048
  };
5032
5049
  return e({
5033
- snapshot: W,
5050
+ snapshot: F,
5034
5051
  entries: {
5035
- text: o,
5036
- textCaseRaw: n,
5052
+ text: n,
5053
+ textCaseRaw: o,
5037
5054
  fontFamily: a,
5038
5055
  fontSize: r,
5039
5056
  fontWeight: c,
@@ -5062,7 +5079,7 @@ class F {
5062
5079
  scaleX: D,
5063
5080
  scaleY: _
5064
5081
  }
5065
- }), W;
5082
+ }), F;
5066
5083
  }
5067
5084
  /**
5068
5085
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -5075,39 +5092,39 @@ class F {
5075
5092
  const Q = ({
5076
5093
  value: h,
5077
5094
  fallback: t = 0
5078
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, Qt = ({
5095
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, qt = ({
5079
5096
  value: h,
5080
5097
  dimension: t,
5081
5098
  useRelativePositions: e
5082
5099
  }) => {
5083
5100
  const s = Q({ value: h });
5084
5101
  return e ? s : s / (t || 1);
5085
- }, lo = ({
5102
+ }, ln = ({
5086
5103
  object: h,
5087
5104
  baseWidth: t,
5088
5105
  baseHeight: e,
5089
5106
  useRelativePositions: s,
5090
- centerKeys: o
5107
+ centerKeys: n
5091
5108
  }) => {
5092
- const n = h;
5093
- if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
5109
+ const o = h;
5110
+ if (typeof o[n.x] == "number" && typeof o[n.y] == "number")
5094
5111
  return {
5095
- x: Qt({
5096
- value: n[o.x],
5112
+ x: qt({
5113
+ value: o[n.x],
5097
5114
  dimension: t,
5098
5115
  useRelativePositions: s
5099
5116
  }),
5100
- y: Qt({
5101
- value: n[o.y],
5117
+ y: qt({
5118
+ value: o[n.y],
5102
5119
  dimension: e,
5103
5120
  useRelativePositions: s
5104
5121
  })
5105
5122
  };
5106
- const { left: a, top: r, width: c, height: d } = h, l = Qt({
5123
+ const { left: a, top: r, width: c, height: d } = h, l = qt({
5107
5124
  value: a,
5108
5125
  dimension: t,
5109
5126
  useRelativePositions: s
5110
- }), u = Qt({
5127
+ }), u = qt({
5111
5128
  value: r,
5112
5129
  dimension: e,
5113
5130
  useRelativePositions: s
@@ -5116,28 +5133,28 @@ const Q = ({
5116
5133
  x: l + g / 2,
5117
5134
  y: u + f / 2
5118
5135
  };
5119
- }, ho = ({
5136
+ }, hn = ({
5120
5137
  normalizedX: h,
5121
5138
  normalizedY: t,
5122
5139
  bounds: e,
5123
5140
  targetSize: s,
5124
- montageArea: o
5141
+ montageArea: n
5125
5142
  }) => {
5126
- const { left: n, top: i, width: a, height: r } = e;
5127
- if (!o) {
5128
- const { width: l, height: u } = s, g = n + h * (l || a), f = i + t * (u || r);
5143
+ const { left: o, top: i, width: a, height: r } = e;
5144
+ if (!n) {
5145
+ const { width: l, height: u } = s, g = o + h * (l || a), f = i + t * (u || r);
5129
5146
  return new et(g, f);
5130
5147
  }
5131
- const c = n + h * a, d = i + t * r;
5148
+ const c = o + h * a, d = i + t * r;
5132
5149
  return new et(c, d);
5133
- }, uo = ({
5150
+ }, un = ({
5134
5151
  object: h,
5135
5152
  montageArea: t,
5136
5153
  bounds: e
5137
5154
  }) => {
5138
5155
  if (!t || !e) return null;
5139
5156
  try {
5140
- const s = h.getCenterPoint(), { left: o, top: n, width: i, height: a } = e, r = s.x - o, c = s.y - n, d = r / i, l = c / a;
5157
+ const s = h.getCenterPoint(), { left: n, top: o, width: i, height: a } = e, r = s.x - n, c = s.y - o, d = r / i, l = c / a;
5141
5158
  return {
5142
5159
  x: d,
5143
5160
  y: l
@@ -5145,7 +5162,7 @@ const Q = ({
5145
5162
  } catch (s) {
5146
5163
  return null;
5147
5164
  }
5148
- }, ft = ({
5165
+ }, pt = ({
5149
5166
  object: h
5150
5167
  }) => {
5151
5168
  if (!h) return null;
@@ -5154,9 +5171,9 @@ const Q = ({
5154
5171
  const t = h.getBoundingRect(!1, !0), {
5155
5172
  left: e = 0,
5156
5173
  top: s = 0,
5157
- width: o = 0,
5158
- height: n = 0
5159
- } = t, i = e + o, a = s + n, r = e + o / 2, c = s + n / 2;
5174
+ width: n = 0,
5175
+ height: o = 0
5176
+ } = t, i = e + n, a = s + o, r = e + n / 2, c = s + o / 2;
5160
5177
  return {
5161
5178
  left: e,
5162
5179
  right: i,
@@ -5168,14 +5185,14 @@ const Q = ({
5168
5185
  } catch (t) {
5169
5186
  return null;
5170
5187
  }
5171
- }, go = ({
5188
+ }, gn = ({
5172
5189
  x1: h,
5173
5190
  y1: t,
5174
5191
  x2: e,
5175
5192
  y2: s
5176
- }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, fo = (h) => {
5193
+ }) => (Math.atan2(s - t, e - h) * 180 / Math.PI + 360) % 360, fn = (h) => {
5177
5194
  if (!h || typeof h != "object") return null;
5178
- const { type: t, coords: e, colorStops: s } = h, o = Array.isArray(s) ? s : [], n = o[0], i = o[o.length - 1], a = typeof (n == null ? void 0 : n.color) == "string" ? n.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (n == null ? void 0 : n.offset) == "number" ? n.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0, l = o.map((u) => ({
5195
+ const { type: t, coords: e, colorStops: s } = h, n = Array.isArray(s) ? s : [], o = n[0], i = n[n.length - 1], a = typeof (o == null ? void 0 : o.color) == "string" ? o.color : void 0, r = typeof (i == null ? void 0 : i.color) == "string" ? i.color : a, c = typeof (o == null ? void 0 : o.offset) == "number" ? o.offset * 100 : void 0, d = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0, l = n.map((u) => ({
5179
5196
  color: typeof u.color == "string" ? u.color : "#000000",
5180
5197
  offset: typeof u.offset == "number" ? u.offset * 100 : 0
5181
5198
  }));
@@ -5185,7 +5202,7 @@ const Q = ({
5185
5202
  if (typeof u == "number" && typeof g == "number" && typeof f == "number" && typeof p == "number")
5186
5203
  return {
5187
5204
  type: "linear",
5188
- angle: go({ x1: u, y1: g, x2: f, y2: p }),
5205
+ angle: gn({ x1: u, y1: g, x2: f, y2: p }),
5189
5206
  startColor: a,
5190
5207
  endColor: r,
5191
5208
  startPosition: c,
@@ -5209,7 +5226,7 @@ const Q = ({
5209
5226
  };
5210
5227
  }
5211
5228
  return null;
5212
- }, Pt = "_templateCenterX", re = "_templateCenterY", qt = "_templateAnchorX", ce = "_templateAnchorY";
5229
+ }, Wt = "_templateCenterX", de = "_templateCenterY", Jt = "_templateAnchorX", le = "_templateAnchorY";
5213
5230
  class R {
5214
5231
  constructor({ editor: t }) {
5215
5232
  this.editor = t;
@@ -5222,19 +5239,19 @@ class R {
5222
5239
  templateId: t,
5223
5240
  previewId: e,
5224
5241
  meta: s = {},
5225
- withBackground: o = !1
5242
+ withBackground: n = !1
5226
5243
  } = {}) {
5227
5244
  const {
5228
- canvas: n,
5245
+ canvas: o,
5229
5246
  montageArea: i,
5230
5247
  errorManager: a,
5231
5248
  backgroundManager: r
5232
- } = this.editor, c = n.getActiveObject(), d = R._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...d, ...u];
5249
+ } = this.editor, c = o.getActiveObject(), d = R._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = n && l ? [l] : [], g = [...d, ...u];
5233
5250
  if (!g.length)
5234
5251
  return a.emitWarning({
5235
5252
  origin: "TemplateManager",
5236
5253
  method: "serializeSelection",
5237
- code: bt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5254
+ code: Mt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
5238
5255
  message: "Нет объектов для сериализации шаблона"
5239
5256
  }), null;
5240
5257
  const f = R._getBounds(i), p = R._getMontageSize({ montageArea: i, bounds: f }), m = p.width, v = p.height, M = g.map((b) => R._serializeObject({
@@ -5243,7 +5260,7 @@ class R {
5243
5260
  baseWidth: m,
5244
5261
  baseHeight: v,
5245
5262
  montageArea: i != null ? i : null
5246
- })), S = yt(B({}, s), {
5263
+ })), S = vt(B({}, s), {
5247
5264
  baseWidth: m,
5248
5265
  baseHeight: v,
5249
5266
  positionsNormalized: !0,
@@ -5267,8 +5284,8 @@ class R {
5267
5284
  data: e
5268
5285
  }) {
5269
5286
  const {
5270
- canvas: o,
5271
- montageArea: n,
5287
+ canvas: n,
5288
+ montageArea: o,
5272
5289
  historyManager: i,
5273
5290
  errorManager: a,
5274
5291
  backgroundManager: r
@@ -5277,18 +5294,18 @@ class R {
5277
5294
  return a.emitWarning({
5278
5295
  origin: "TemplateManager",
5279
5296
  method: "applyTemplate",
5280
- code: bt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5297
+ code: Mt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5281
5298
  message: "Шаблон не содержит объектов"
5282
5299
  }), null;
5283
- const u = R._getBounds(n);
5300
+ const u = R._getBounds(o);
5284
5301
  if (!u)
5285
5302
  return a.emitWarning({
5286
5303
  origin: "TemplateManager",
5287
5304
  method: "applyTemplate",
5288
- code: bt.TEMPLATE_MANAGER.INVALID_TARGET,
5305
+ code: Mt.TEMPLATE_MANAGER.INVALID_TARGET,
5289
5306
  message: "Не удалось определить границы монтажной области"
5290
5307
  }), null;
5291
- const g = R._getMontageSize({ montageArea: n, bounds: u }), f = R._normalizeMeta({ meta: d, fallback: g }), p = R._calculateScale({ meta: f, target: g }), m = !!f.positionsNormalized;
5308
+ const g = R._getMontageSize({ montageArea: o, bounds: u }), f = R._normalizeMeta({ meta: d, fallback: g }), p = R._calculateScale({ meta: f, target: g }), m = !!f.positionsNormalized;
5292
5309
  let v = !1, M = !1;
5293
5310
  i.suspendHistory();
5294
5311
  try {
@@ -5297,7 +5314,7 @@ class R {
5297
5314
  return a.emitWarning({
5298
5315
  origin: "TemplateManager",
5299
5316
  method: "applyTemplate",
5300
- code: bt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5317
+ code: Mt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
5301
5318
  message: "Не удалось создать объекты шаблона"
5302
5319
  }), null;
5303
5320
  const { backgroundObject: y, contentObjects: b } = R._extractBackgroundObject(S);
@@ -5316,13 +5333,13 @@ class R {
5316
5333
  targetSize: g,
5317
5334
  baseWidth: f.baseWidth,
5318
5335
  baseHeight: f.baseHeight,
5319
- montageArea: n,
5336
+ montageArea: o,
5320
5337
  useRelativePositions: m
5321
5338
  }), j.set({
5322
5339
  id: `${j.type}-${V()}`,
5323
5340
  evented: !0
5324
- }), o.add(j), j));
5325
- return !I.length && !M ? null : (v = I.length > 0 || M, I.length && R._activateObjects({ canvas: o, objects: I }), o.requestRenderAll(), o.fire("editor:template-applied", {
5341
+ }), n.add(j), j));
5342
+ return !I.length && !M ? null : (v = I.length > 0 || M, I.length && R._activateObjects({ canvas: n, objects: I }), n.requestRenderAll(), n.fire("editor:template-applied", {
5326
5343
  template: t,
5327
5344
  objects: I,
5328
5345
  bounds: u
@@ -5331,7 +5348,7 @@ class R {
5331
5348
  return a.emitError({
5332
5349
  origin: "TemplateManager",
5333
5350
  method: "applyTemplate",
5334
- code: bt.TEMPLATE_MANAGER.APPLY_FAILED,
5351
+ code: Mt.TEMPLATE_MANAGER.APPLY_FAILED,
5335
5352
  message: "Ошибка применения шаблона",
5336
5353
  data: {
5337
5354
  templateId: l,
@@ -5378,8 +5395,8 @@ class R {
5378
5395
  if (i)
5379
5396
  return R._restoreImageScale({ revived: i, serialized: s }), i;
5380
5397
  }
5381
- const o = yield dt.enlivenObjects([s]), n = o == null ? void 0 : o[0];
5382
- return n ? (R._restoreImageScale({ revived: n, serialized: s }), n) : null;
5398
+ const n = yield dt.enlivenObjects([s]), o = n == null ? void 0 : n[0];
5399
+ return o ? (R._restoreImageScale({ revived: o, serialized: s }), o) : null;
5383
5400
  })))).filter((s) => !!s);
5384
5401
  });
5385
5402
  }
@@ -5392,8 +5409,8 @@ class R {
5392
5409
  }) {
5393
5410
  if ((typeof t.type == "string" ? t.type.toLowerCase() : "") !== "image") return;
5394
5411
  const {
5395
- width: o,
5396
- height: n,
5412
+ width: n,
5413
+ height: o,
5397
5414
  scaleX: i,
5398
5415
  scaleY: a,
5399
5416
  customData: r
@@ -5407,7 +5424,7 @@ class R {
5407
5424
  naturalHeight: 0,
5408
5425
  width: 0,
5409
5426
  height: 0
5410
- }, p = Q({ value: l || g || c.width, fallback: 0 }), m = Q({ value: u || f || c.height, fallback: 0 }), v = Q({ value: o, fallback: p }), M = Q({ value: n, fallback: m }), S = Q({ value: i, fallback: c.scaleX || 1 }), y = Q({ value: a, fallback: c.scaleY || 1 }), b = v * S, I = M * y, j = p > 0, A = m > 0, C = b > 0, w = I > 0, T = R._resolveImageFit({ customData: r }), E = {};
5427
+ }, p = Q({ value: l || g || c.width, fallback: 0 }), m = Q({ value: u || f || c.height, fallback: 0 }), v = Q({ value: n, fallback: p }), M = Q({ value: o, fallback: m }), S = Q({ value: i, fallback: c.scaleX || 1 }), y = Q({ value: a, fallback: c.scaleY || 1 }), b = v * S, I = M * y, j = p > 0, A = m > 0, C = b > 0, w = I > 0, T = R._resolveImageFit({ customData: r }), E = {};
5411
5428
  if (j && (E.width = p), A && (E.height = m), !j || !A) {
5412
5429
  c.set(E);
5413
5430
  return;
@@ -5448,10 +5465,10 @@ class R {
5448
5465
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5449
5466
  if (!e) return null;
5450
5467
  try {
5451
- const s = yield ms(e), o = dt.groupSVGElements(s.objects, s.options), n = yield dt.enlivenObjectEnlivables(
5468
+ const s = yield ms(e), n = dt.groupSVGElements(s.objects, s.options), o = yield dt.enlivenObjectEnlivables(
5452
5469
  R._prepareSerializableProps(t)
5453
5470
  );
5454
- return o.set(n), o.setCoords(), o;
5471
+ return n.set(o), n.setCoords(), n;
5455
5472
  } catch (s) {
5456
5473
  return null;
5457
5474
  }
@@ -5480,7 +5497,7 @@ class R {
5480
5497
  const s = e.call(t);
5481
5498
  if (!s) return null;
5482
5499
  if (/<svg[\s>]/i.test(s)) return s;
5483
- const { width: n, height: i } = t.getBoundingRect(!1, !0), a = n || t.width || 0, r = i || t.height || 0;
5500
+ const { width: o, height: i } = t.getBoundingRect(!1, !0), a = o || t.width || 0, r = i || t.height || 0;
5484
5501
  return `
5485
5502
  <svg
5486
5503
  xmlns="http://www.w3.org/2000/svg"
@@ -5501,40 +5518,40 @@ class R {
5501
5518
  object: t,
5502
5519
  scale: e,
5503
5520
  bounds: s,
5504
- targetSize: o,
5505
- baseWidth: n,
5521
+ targetSize: n,
5522
+ baseWidth: o,
5506
5523
  baseHeight: i,
5507
5524
  montageArea: a,
5508
5525
  useRelativePositions: r
5509
5526
  }) {
5510
- const c = t, { x: d, y: l } = lo({
5527
+ const c = t, { x: d, y: l } = ln({
5511
5528
  object: t,
5512
- baseWidth: n,
5529
+ baseWidth: o,
5513
5530
  baseHeight: i,
5514
5531
  useRelativePositions: r,
5515
5532
  centerKeys: {
5516
- x: Pt,
5517
- y: re
5533
+ x: Wt,
5534
+ y: de
5518
5535
  }
5519
5536
  }), { scaleX: u, scaleY: g } = t, f = Q({ value: u, fallback: 1 }), p = Q({ value: g, fallback: 1 }), m = R._getPositioningBounds({
5520
5537
  bounds: s,
5521
- baseWidth: n,
5538
+ baseWidth: o,
5522
5539
  baseHeight: i,
5523
5540
  scale: e,
5524
5541
  useRelativePositions: r,
5525
- anchorX: R._resolveAnchor(c, qt),
5526
- anchorY: R._resolveAnchor(c, ce)
5527
- }), v = ho({
5542
+ anchorX: R._resolveAnchor(c, Jt),
5543
+ anchorY: R._resolveAnchor(c, le)
5544
+ }), v = hn({
5528
5545
  normalizedX: d,
5529
5546
  normalizedY: l,
5530
5547
  bounds: m,
5531
- targetSize: o,
5548
+ targetSize: n,
5532
5549
  montageArea: a
5533
5550
  }), M = f * e, S = p * e;
5534
5551
  t.set({
5535
5552
  scaleX: M,
5536
5553
  scaleY: S
5537
- }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Pt], delete c[re], delete c[qt], delete c[ce];
5554
+ }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[Wt], delete c[de], delete c[Jt], delete c[le];
5538
5555
  }
5539
5556
  /**
5540
5557
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -5544,13 +5561,13 @@ class R {
5544
5561
  bounds: t,
5545
5562
  baseWidth: e,
5546
5563
  baseHeight: s,
5547
- scale: o,
5548
- useRelativePositions: n,
5564
+ scale: n,
5565
+ useRelativePositions: o,
5549
5566
  anchorX: i,
5550
5567
  anchorY: a
5551
5568
  }) {
5552
- if (!n) return t;
5553
- const r = (e || t.width) * o, c = (s || t.height) * o, d = t.width - r, l = t.height - c, u = t.left + R._calculateAnchorOffset(i, d), g = t.top + R._calculateAnchorOffset(a, l);
5569
+ if (!o) return t;
5570
+ const r = (e || t.width) * n, c = (s || t.height) * n, d = t.width - r, l = t.height - c, u = t.left + R._calculateAnchorOffset(i, d), g = t.top + R._calculateAnchorOffset(a, l);
5554
5571
  return {
5555
5572
  left: u,
5556
5573
  top: g,
@@ -5566,11 +5583,11 @@ class R {
5566
5583
  return s === "center" || s === "end" || s === "start" ? s : "start";
5567
5584
  }
5568
5585
  static _detectAnchor({ start: t, end: e }) {
5569
- const s = t <= 0.05, o = e >= 0.95, n = t < 0, i = e > 1, a = e - t, r = Math.max(0, t), c = Math.max(0, 1 - e), d = Math.abs(r - c) <= 0.02;
5570
- if (s && o || n && i)
5586
+ const s = t <= 0.05, n = e >= 0.95, o = t < 0, i = e > 1, a = e - t, r = Math.max(0, t), c = Math.max(0, 1 - e), d = Math.abs(r - c) <= 0.02;
5587
+ if (s && n || o && i)
5571
5588
  return d || a >= 0.9 ? "center" : r <= c ? "start" : "end";
5572
- if (s || n) return "start";
5573
- if (o || i) return "end";
5589
+ if (s || o) return "start";
5590
+ if (n || i) return "end";
5574
5591
  const l = r - c;
5575
5592
  return Math.abs(l) <= 0.1 ? "center" : l < 0 ? "start" : "end";
5576
5593
  }
@@ -5581,9 +5598,9 @@ class R {
5581
5598
  meta: t,
5582
5599
  fallback: e
5583
5600
  }) {
5584
- const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = vt(r, ["baseWidth", "baseHeight"]);
5601
+ const { width: s, height: n } = e, r = t || {}, { baseWidth: o = s, baseHeight: i = n } = r, a = bt(r, ["baseWidth", "baseHeight"]);
5585
5602
  return B({
5586
- baseWidth: n,
5603
+ baseWidth: o,
5587
5604
  baseHeight: i
5588
5605
  }, a);
5589
5606
  }
@@ -5594,7 +5611,7 @@ class R {
5594
5611
  meta: t,
5595
5612
  target: e
5596
5613
  }) {
5597
- const { width: s, height: o } = e, { baseWidth: n, baseHeight: i } = t, a = s / (n || s || 1), r = o / (i || o || 1);
5614
+ const { width: s, height: n } = e, { baseWidth: o, baseHeight: i } = t, a = s / (o || s || 1), r = n / (i || n || 1);
5598
5615
  return Math.min(a, r);
5599
5616
  }
5600
5617
  /**
@@ -5620,21 +5637,21 @@ class R {
5620
5637
  baseWidth: e
5621
5638
  }) {
5622
5639
  var Z, D;
5623
- if (!(t instanceof nt)) return;
5640
+ if (!(t instanceof ot)) return;
5624
5641
  const s = typeof t.text == "string" ? t.text : "";
5625
5642
  if (!s) return;
5626
- const o = Q({
5643
+ const n = Q({
5627
5644
  value: (D = (Z = this.editor) == null ? void 0 : Z.montageArea) == null ? void 0 : D.width,
5628
5645
  fallback: 0
5629
5646
  }), {
5630
- width: n = 0,
5647
+ width: o = 0,
5631
5648
  scaleX: i = 1,
5632
5649
  strokeWidth: a = 0
5633
- } = t, r = Q({ value: e, fallback: 0 }), c = t, d = Q({ value: c.paddingLeft, fallback: 0 }), l = Q({ value: c.paddingRight, fallback: 0 }), u = Q({ value: i, fallback: 1 }), g = Q({ value: a, fallback: 0 }) * u, f = Q({ value: n, fallback: 0 }), p = f * u, m = d * u, v = l * u, M = p + m + v + g;
5634
- if (!o || !f || !r) return;
5650
+ } = t, r = Q({ value: e, fallback: 0 }), c = t, d = Q({ value: c.paddingLeft, fallback: 0 }), l = Q({ value: c.paddingRight, fallback: 0 }), u = Q({ value: i, fallback: 1 }), g = Q({ value: a, fallback: 0 }) * u, f = Q({ value: o, fallback: 0 }), p = f * u, m = d * u, v = l * u, M = p + m + v + g;
5651
+ if (!n || !f || !r) return;
5635
5652
  t.setCoords();
5636
- const S = t, y = S[Pt], b = typeof y == "number" ? y : null, I = R._resolveAnchor(S, qt), j = M / r, A = b !== null ? b - j / 2 : null, C = b !== null ? b + j / 2 : null, w = t.getCenterPoint();
5637
- t.set("width", o), t.initDimensions();
5653
+ const S = t, y = S[Wt], b = typeof y == "number" ? y : null, I = R._resolveAnchor(S, Jt), j = M / r, A = b !== null ? b - j / 2 : null, C = b !== null ? b + j / 2 : null, w = t.getCenterPoint();
5654
+ t.set("width", n), t.initDimensions();
5638
5655
  const T = R._getLongestLineWidth({
5639
5656
  textbox: t,
5640
5657
  text: s
@@ -5642,7 +5659,7 @@ class R {
5642
5659
  t.set("width", E), t.initDimensions(), t.setPositionByOrigin(w, "center", "center"), t.setCoords();
5643
5660
  const x = (E * u + m + v + g) / r;
5644
5661
  let N = b;
5645
- I === "start" && A !== null ? N = Math.max(0, A) + x / 2 : I === "end" && C !== null && (N = Math.min(1, C) - x / 2), typeof N == "number" && (S[Pt] = N);
5662
+ I === "start" && A !== null ? N = Math.max(0, A) + x / 2 : I === "end" && C !== null && (N = Math.min(1, C) - x / 2), typeof N == "number" && (S[Wt] = N);
5646
5663
  }
5647
5664
  /**
5648
5665
  * Возвращает ширину самой длинной строки текстового объекта.
@@ -5653,14 +5670,14 @@ class R {
5653
5670
  }) {
5654
5671
  const {
5655
5672
  textLines: s
5656
- } = t, o = Array.isArray(s) && s.length > 0 ? s.length : Math.max(e.split(`
5673
+ } = t, n = Array.isArray(s) && s.length > 0 ? s.length : Math.max(e.split(`
5657
5674
  `).length, 1);
5658
- let n = 0;
5659
- for (let i = 0; i < o; i += 1) {
5675
+ let o = 0;
5676
+ for (let i = 0; i < n; i += 1) {
5660
5677
  const a = t.getLineWidth(i);
5661
- a > n && (n = a);
5678
+ a > o && (o = a);
5662
5679
  }
5663
- return n;
5680
+ return o;
5664
5681
  }
5665
5682
  /**
5666
5683
  * Сериализует объект относительно монтажной области.
@@ -5669,8 +5686,8 @@ class R {
5669
5686
  object: t,
5670
5687
  bounds: e,
5671
5688
  baseWidth: s,
5672
- baseHeight: o,
5673
- montageArea: n
5689
+ baseHeight: n,
5690
+ montageArea: o
5674
5691
  }) {
5675
5692
  const i = t.toDatalessObject([...es]);
5676
5693
  if (R._isSvgObject(t)) {
@@ -5683,9 +5700,9 @@ class R {
5683
5700
  top: r,
5684
5701
  width: c,
5685
5702
  height: d
5686
- } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || d || 1, f = uo({
5703
+ } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = n || d || 1, f = un({
5687
5704
  object: t,
5688
- montageArea: n,
5705
+ montageArea: o,
5689
5706
  bounds: e
5690
5707
  }), p = f != null ? f : (() => {
5691
5708
  const y = t.getCenterPoint();
@@ -5694,11 +5711,11 @@ class R {
5694
5711
  y: (y.y - r) / g
5695
5712
  };
5696
5713
  })(), m = (l.left - a) / u, v = (l.top - r) / g, M = m + l.width / u, S = v + l.height / g;
5697
- return i[Pt] = p.x, i[re] = p.y, i[qt] = R._detectAnchor({
5714
+ return i[Wt] = p.x, i[de] = p.y, i[Jt] = R._detectAnchor({
5698
5715
  center: p.x,
5699
5716
  start: m,
5700
5717
  end: M
5701
- }), i[ce] = R._detectAnchor({
5718
+ }), i[le] = R._detectAnchor({
5702
5719
  center: p.y,
5703
5720
  start: v,
5704
5721
  end: S
@@ -5708,35 +5725,37 @@ class R {
5708
5725
  * Делит список объектов на фон и контент по id === 'background'.
5709
5726
  */
5710
5727
  static _extractBackgroundObject(t) {
5711
- const e = t.findIndex((n) => n.id === "background");
5728
+ const e = t.findIndex((o) => o.id === "background");
5712
5729
  if (e === -1)
5713
5730
  return { backgroundObject: null, contentObjects: t };
5714
- const s = t[e], o = t.filter((n, i) => i !== e);
5715
- return { backgroundObject: s, contentObjects: o };
5731
+ const s = t[e], n = t.filter((o, i) => i !== e);
5732
+ return { backgroundObject: s, contentObjects: n };
5716
5733
  }
5717
5734
  /**
5718
5735
  * Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
5719
5736
  */
5720
- static _applyBackgroundFromObject(o) {
5737
+ static _applyBackgroundFromObject(n) {
5721
5738
  return k(this, arguments, function* ({
5722
5739
  backgroundObject: t,
5723
5740
  backgroundManager: e,
5724
5741
  errorManager: s
5725
5742
  }) {
5726
5743
  try {
5727
- const { fill: n, customData: i } = t, { backgroundType: a } = t, r = R._cloneCustomData(i);
5728
- if (a === "color" && typeof n == "string")
5744
+ const { fill: o, customData: i } = t, { backgroundType: a } = t, r = R._cloneCustomData(i);
5745
+ if (a === "color" && typeof o == "string")
5729
5746
  return e.setColorBackground({
5730
- color: n,
5747
+ color: o,
5731
5748
  customData: r,
5749
+ fromTemplate: !0,
5732
5750
  withoutSave: !0
5733
5751
  }), !0;
5734
5752
  if (a === "gradient") {
5735
- const c = fo(n);
5753
+ const c = fn(o);
5736
5754
  if (c)
5737
5755
  return e.setGradientBackground({
5738
5756
  gradient: c,
5739
5757
  customData: r,
5758
+ fromTemplate: !0,
5740
5759
  withoutSave: !0
5741
5760
  }), !0;
5742
5761
  }
@@ -5746,16 +5765,17 @@ class R {
5746
5765
  return yield e.setImageBackground({
5747
5766
  imageSource: c,
5748
5767
  customData: r,
5768
+ fromTemplate: !0,
5749
5769
  withoutSave: !0
5750
5770
  }), !0;
5751
5771
  }
5752
- } catch (n) {
5772
+ } catch (o) {
5753
5773
  s.emitWarning({
5754
5774
  origin: "TemplateManager",
5755
5775
  method: "applyTemplate",
5756
- code: bt.TEMPLATE_MANAGER.APPLY_FAILED,
5776
+ code: Mt.TEMPLATE_MANAGER.APPLY_FAILED,
5757
5777
  message: "Не удалось применить фон из шаблона",
5758
- data: n
5778
+ data: o
5759
5779
  });
5760
5780
  }
5761
5781
  return !1;
@@ -5768,14 +5788,14 @@ class R {
5768
5788
  montageArea: t,
5769
5789
  bounds: e
5770
5790
  }) {
5771
- var n, i;
5772
- const s = (e == null ? void 0 : e.width) || 0, o = (e == null ? void 0 : e.height) || 0;
5791
+ var o, i;
5792
+ const s = (e == null ? void 0 : e.width) || 0, n = (e == null ? void 0 : e.height) || 0;
5773
5793
  return t ? {
5774
- width: ((n = t.getScaledWidth) == null ? void 0 : n.call(t)) || t.width || s,
5775
- height: ((i = t.getScaledHeight) == null ? void 0 : i.call(t)) || t.height || o
5794
+ width: ((o = t.getScaledWidth) == null ? void 0 : o.call(t)) || t.width || s,
5795
+ height: ((i = t.getScaledHeight) == null ? void 0 : i.call(t)) || t.height || n
5776
5796
  } : {
5777
5797
  width: s,
5778
- height: o
5798
+ height: n
5779
5799
  };
5780
5800
  }
5781
5801
  /**
@@ -5791,13 +5811,13 @@ class R {
5791
5811
  static _getImageSource(t) {
5792
5812
  const e = t;
5793
5813
  if ("getSrc" in t && typeof e.getSrc == "function") {
5794
- const o = e.getSrc();
5795
- if (o) return o;
5814
+ const n = e.getSrc();
5815
+ if (n) return n;
5796
5816
  }
5797
5817
  if ("getElement" in t && typeof e.getElement == "function") {
5798
- const o = e.getElement();
5799
- if (o instanceof HTMLImageElement)
5800
- return o.currentSrc || o.src || null;
5818
+ const n = e.getElement();
5819
+ if (n instanceof HTMLImageElement)
5820
+ return n.currentSrc || n.src || null;
5801
5821
  }
5802
5822
  const s = t;
5803
5823
  return typeof s.src == "string" ? s.src : null;
@@ -5812,29 +5832,29 @@ class R {
5812
5832
  return dt.enlivenObjectEnlivables(t);
5813
5833
  }
5814
5834
  }
5815
- const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5835
+ const pn = 5, ss = "#3D8BF4", me = 1, $t = 1, Ke = ({
5816
5836
  anchors: h,
5817
5837
  positions: t,
5818
5838
  threshold: e
5819
5839
  }) => {
5820
- let s = 0, o = e + 1, n = null;
5840
+ let s = 0, n = e + 1, o = null;
5821
5841
  for (const i of t)
5822
5842
  for (const a of h) {
5823
5843
  const r = Math.abs(a - i);
5824
- r > e || r >= o || (s = a - i, o = r, n = a);
5844
+ r > e || r >= n || (s = a - i, n = r, o = a);
5825
5845
  }
5826
5846
  return {
5827
5847
  delta: s,
5828
- guidePosition: n
5848
+ guidePosition: o
5829
5849
  };
5830
- }, mo = ({
5850
+ }, mn = ({
5831
5851
  activeBounds: h,
5832
5852
  threshold: t,
5833
5853
  anchors: e
5834
5854
  }) => {
5835
- const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = h, c = Ke({
5855
+ const { left: s, right: n, centerX: o, top: i, bottom: a, centerY: r } = h, c = Ke({
5836
5856
  anchors: e.vertical,
5837
- positions: [s, n, o],
5857
+ positions: [s, o, n],
5838
5858
  threshold: t
5839
5859
  }), d = Ke({
5840
5860
  anchors: e.horizontal,
@@ -5852,27 +5872,27 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5852
5872
  deltaY: d.delta,
5853
5873
  guides: l
5854
5874
  };
5855
- }, os = ({
5875
+ }, ns = ({
5856
5876
  activeBounds: h,
5857
5877
  aligned: t,
5858
5878
  threshold: e,
5859
5879
  patterns: s,
5860
- type: o
5880
+ type: n
5861
5881
  }) => {
5862
5882
  if (!t.length || !s.length) return [];
5863
5883
  const {
5864
- top: n,
5884
+ top: o,
5865
5885
  bottom: i,
5866
5886
  left: a,
5867
5887
  right: r
5868
5888
  } = h, c = [];
5869
5889
  for (const d of s)
5870
5890
  for (const l of t)
5871
- if (o === "vertical") {
5872
- const u = n - l.bottom, g = Math.abs(u - d.distance);
5891
+ if (n === "vertical") {
5892
+ const u = o - l.bottom, g = Math.abs(u - d.distance);
5873
5893
  if (g <= e) {
5874
5894
  const m = d.distance - u, v = {
5875
- type: o,
5895
+ type: n,
5876
5896
  axis: d.axis,
5877
5897
  refStart: d.start,
5878
5898
  refEnd: d.end,
@@ -5885,7 +5905,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5885
5905
  const f = l.top - i, p = Math.abs(f - d.distance);
5886
5906
  if (p <= e) {
5887
5907
  const m = d.distance - f, v = {
5888
- type: o,
5908
+ type: n,
5889
5909
  axis: d.axis,
5890
5910
  refStart: d.start,
5891
5911
  refEnd: d.end,
@@ -5899,7 +5919,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5899
5919
  const u = a - l.right, g = Math.abs(u - d.distance);
5900
5920
  if (g <= e) {
5901
5921
  const m = d.distance - u, v = {
5902
- type: o,
5922
+ type: n,
5903
5923
  axis: d.axis,
5904
5924
  refStart: d.start,
5905
5925
  refEnd: d.end,
@@ -5912,7 +5932,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5912
5932
  const f = l.left - r, p = Math.abs(f - d.distance);
5913
5933
  if (p <= e) {
5914
5934
  const m = d.distance - f, v = {
5915
- type: o,
5935
+ type: n,
5916
5936
  axis: d.axis,
5917
5937
  refStart: d.start,
5918
5938
  refEnd: d.end,
@@ -5924,15 +5944,15 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5924
5944
  }
5925
5945
  }
5926
5946
  return c;
5927
- }, yo = ({
5947
+ }, yn = ({
5928
5948
  activeBounds: h,
5929
5949
  candidates: t,
5930
5950
  threshold: e,
5931
5951
  patterns: s
5932
5952
  }) => {
5933
5953
  const {
5934
- centerX: o,
5935
- top: n,
5954
+ centerX: n,
5955
+ top: o,
5936
5956
  bottom: i,
5937
5957
  left: a,
5938
5958
  right: r
@@ -5947,13 +5967,13 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5947
5967
  const l = d.findIndex((y) => y.isActive);
5948
5968
  if (l === -1)
5949
5969
  return { delta: 0, guide: null };
5950
- const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
5970
+ const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - o;
5951
5971
  if (u && g) {
5952
- const { bounds: y } = u, { bounds: b } = g, I = y.top - b.bottom, j = n - y.bottom, A = Math.abs(j - I);
5972
+ const { bounds: y } = u, { bounds: b } = g, I = y.top - b.bottom, j = o - y.bottom, A = Math.abs(j - I);
5953
5973
  if (A <= e) {
5954
- const C = I - j, w = n + C, T = {
5974
+ const C = I - j, w = o + C, T = {
5955
5975
  type: "vertical",
5956
- axis: o,
5976
+ axis: n,
5957
5977
  refStart: b.bottom,
5958
5978
  refEnd: y.top,
5959
5979
  activeStart: y.bottom,
@@ -5968,7 +5988,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5968
5988
  if (A <= e) {
5969
5989
  const C = j - I, w = i + C, T = {
5970
5990
  type: "vertical",
5971
- axis: o,
5991
+ axis: n,
5972
5992
  refStart: y.bottom,
5973
5993
  refEnd: b.top,
5974
5994
  activeStart: w,
@@ -5981,11 +6001,11 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5981
6001
  if (u && f) {
5982
6002
  const { bounds: y } = u, { bounds: b } = f, j = b.top - y.bottom - v;
5983
6003
  if (j >= 0) {
5984
- const A = j / 2, C = n - y.bottom, w = b.top - i, T = Math.abs(C - A), E = Math.abs(w - A), P = Math.max(T, E);
6004
+ const A = j / 2, C = o - y.bottom, w = b.top - i, T = Math.abs(C - A), E = Math.abs(w - A), P = Math.max(T, E);
5985
6005
  if (P <= e) {
5986
6006
  const x = A - C, N = i + x, Z = {
5987
6007
  type: "vertical",
5988
- axis: o,
6008
+ axis: n,
5989
6009
  refStart: y.bottom,
5990
6010
  refEnd: y.bottom + A,
5991
6011
  activeStart: N,
@@ -5996,7 +6016,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
5996
6016
  }
5997
6017
  }
5998
6018
  }
5999
- const M = os({
6019
+ const M = ns({
6000
6020
  activeBounds: h,
6001
6021
  aligned: c,
6002
6022
  threshold: e,
@@ -6010,15 +6030,15 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6010
6030
  delta: S.delta,
6011
6031
  guide: S.guide
6012
6032
  };
6013
- }, vo = ({
6033
+ }, vn = ({
6014
6034
  activeBounds: h,
6015
6035
  candidates: t,
6016
6036
  threshold: e,
6017
6037
  patterns: s
6018
6038
  }) => {
6019
6039
  const {
6020
- centerY: o,
6021
- left: n,
6040
+ centerY: n,
6041
+ left: o,
6022
6042
  right: i,
6023
6043
  top: a,
6024
6044
  bottom: r
@@ -6033,13 +6053,13 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6033
6053
  const l = d.findIndex((y) => y.isActive);
6034
6054
  if (l === -1)
6035
6055
  return { delta: 0, guide: null };
6036
- const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - n;
6056
+ const u = d[l - 1], g = d[l - 2], f = d[l + 1], p = d[l + 2], m = [], v = i - o;
6037
6057
  if (u && g) {
6038
- const { bounds: y } = u, { bounds: b } = g, I = y.left - b.right, j = n - y.right, A = Math.abs(j - I);
6058
+ const { bounds: y } = u, { bounds: b } = g, I = y.left - b.right, j = o - y.right, A = Math.abs(j - I);
6039
6059
  if (A <= e) {
6040
- const C = I - j, w = n + C, T = {
6060
+ const C = I - j, w = o + C, T = {
6041
6061
  type: "horizontal",
6042
- axis: o,
6062
+ axis: n,
6043
6063
  refStart: b.right,
6044
6064
  refEnd: y.left,
6045
6065
  activeStart: y.right,
@@ -6054,7 +6074,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6054
6074
  if (A <= e) {
6055
6075
  const C = j - I, w = i + C, T = {
6056
6076
  type: "horizontal",
6057
- axis: o,
6077
+ axis: n,
6058
6078
  refStart: y.right,
6059
6079
  refEnd: b.left,
6060
6080
  activeStart: w,
@@ -6067,11 +6087,11 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6067
6087
  if (u && f) {
6068
6088
  const { bounds: y } = u, { bounds: b } = f, j = b.left - y.right - v;
6069
6089
  if (j >= 0) {
6070
- const A = j / 2, C = n - y.right, w = b.left - i, T = Math.abs(C - A), E = Math.abs(w - A), P = Math.max(T, E);
6090
+ const A = j / 2, C = o - y.right, w = b.left - i, T = Math.abs(C - A), E = Math.abs(w - A), P = Math.max(T, E);
6071
6091
  if (P <= e) {
6072
6092
  const x = A - C, N = i + x, Z = {
6073
6093
  type: "horizontal",
6074
- axis: o,
6094
+ axis: n,
6075
6095
  refStart: y.right,
6076
6096
  refEnd: y.right + A,
6077
6097
  activeStart: N,
@@ -6082,7 +6102,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6082
6102
  }
6083
6103
  }
6084
6104
  }
6085
- const M = os({
6105
+ const M = ns({
6086
6106
  activeBounds: h,
6087
6107
  aligned: c,
6088
6108
  threshold: e,
@@ -6096,45 +6116,45 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6096
6116
  delta: S.delta,
6097
6117
  guide: S.guide
6098
6118
  };
6099
- }, bo = ({
6119
+ }, bn = ({
6100
6120
  activeBounds: h,
6101
6121
  candidates: t,
6102
6122
  threshold: e,
6103
6123
  spacingPatterns: s
6104
6124
  }) => {
6105
- const o = yo({
6125
+ const n = yn({
6106
6126
  activeBounds: h,
6107
6127
  candidates: t,
6108
6128
  threshold: e,
6109
6129
  patterns: s.vertical
6110
- }), n = vo({
6130
+ }), o = vn({
6111
6131
  activeBounds: h,
6112
6132
  candidates: t,
6113
6133
  threshold: e,
6114
6134
  patterns: s.horizontal
6115
6135
  }), i = [];
6116
- return o.guide && i.push(o.guide), n.guide && i.push(n.guide), {
6117
- deltaX: n.delta,
6118
- deltaY: o.delta,
6136
+ return n.guide && i.push(n.guide), o.guide && i.push(o.guide), {
6137
+ deltaX: o.delta,
6138
+ deltaY: n.delta,
6119
6139
  guides: i
6120
6140
  };
6121
- }, Mo = ({
6141
+ }, Mn = ({
6122
6142
  context: h,
6123
6143
  x: t,
6124
6144
  y: e,
6125
6145
  width: s,
6126
- height: o,
6127
- radius: n
6146
+ height: n,
6147
+ radius: o
6128
6148
  }) => {
6129
- const i = Math.min(n, s / 2, o / 2);
6130
- 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 + o - i), h.quadraticCurveTo(t + s, e + o, t + s - i, e + o), h.lineTo(t + i, e + o), h.quadraticCurveTo(t, e + o, t, e + o - i), h.lineTo(t, e + i), h.quadraticCurveTo(t, e, t + i, e), h.closePath();
6131
- }, pe = ({
6149
+ const i = Math.min(o, s / 2, n / 2);
6150
+ 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();
6151
+ }, ye = ({
6132
6152
  context: h,
6133
6153
  type: t,
6134
6154
  axis: e,
6135
6155
  start: s,
6136
- end: o,
6137
- text: n,
6156
+ end: n,
6157
+ text: o,
6138
6158
  zoom: i,
6139
6159
  color: a,
6140
6160
  textColor: r = "#ffffff",
@@ -6145,53 +6165,53 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6145
6165
  offsetAlongAxis: g = 0,
6146
6166
  offsetPerpendicular: f = 0
6147
6167
  }) => {
6148
- const p = i || 1, m = 12 / p, v = l / p, M = u / p, S = (s + o) / 2 + g, y = t === "vertical" ? e + f : S, b = t === "vertical" ? S : e + f;
6168
+ const p = i || 1, m = 12 / p, v = l / p, M = u / p, S = (s + n) / 2 + g, y = t === "vertical" ? e + f : S, b = t === "vertical" ? S : e + f;
6149
6169
  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";
6150
- const j = h.measureText(n).width + v * 2, A = m + v * 2, C = y - j / 2, w = b - A / 2;
6151
- h.beginPath(), Mo({
6170
+ const j = h.measureText(o).width + v * 2, A = m + v * 2, C = y - j / 2, w = b - A / 2;
6171
+ h.beginPath(), Mn({
6152
6172
  context: h,
6153
6173
  x: C,
6154
6174
  y: w,
6155
6175
  width: j,
6156
6176
  height: A,
6157
6177
  radius: M
6158
- }), h.fill(), h.fillStyle = r, h.fillText(n, y, b), h.restore();
6159
- }, wo = ({
6178
+ }), h.fill(), h.fillStyle = r, h.fillText(o, y, b), h.restore();
6179
+ }, wn = ({
6160
6180
  context: h,
6161
6181
  guide: t,
6162
6182
  zoom: e
6163
6183
  }) => {
6164
6184
  const {
6165
6185
  type: s,
6166
- axis: o,
6167
- refStart: n,
6186
+ axis: n,
6187
+ refStart: o,
6168
6188
  refEnd: i,
6169
6189
  activeStart: a,
6170
6190
  activeEnd: r,
6171
6191
  distance: c
6172
6192
  } = t, d = Math.round(c).toString();
6173
- h.beginPath(), s === "vertical" ? (h.moveTo(o, n), h.lineTo(o, i), h.moveTo(o, a), h.lineTo(o, r)) : (h.moveTo(n, o), h.lineTo(i, o), h.moveTo(a, o), h.lineTo(r, o)), h.stroke();
6193
+ 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();
6174
6194
  const l = ss;
6175
- pe({
6195
+ ye({
6176
6196
  context: h,
6177
6197
  type: s,
6178
- axis: o,
6179
- start: n,
6198
+ axis: n,
6199
+ start: o,
6180
6200
  end: i,
6181
6201
  text: d,
6182
6202
  zoom: e,
6183
6203
  color: l,
6184
- lineWidth: fe
6185
- }), pe({
6204
+ lineWidth: me
6205
+ }), ye({
6186
6206
  context: h,
6187
6207
  type: s,
6188
- axis: o,
6208
+ axis: n,
6189
6209
  start: a,
6190
6210
  end: r,
6191
6211
  text: d,
6192
6212
  zoom: e,
6193
6213
  color: l,
6194
- lineWidth: fe
6214
+ lineWidth: me
6195
6215
  });
6196
6216
  }, Qe = ({
6197
6217
  anchors: h,
@@ -6200,31 +6220,31 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6200
6220
  const {
6201
6221
  left: e,
6202
6222
  right: s,
6203
- centerX: o,
6204
- top: n,
6223
+ centerX: n,
6224
+ top: o,
6205
6225
  bottom: i,
6206
6226
  centerY: a
6207
6227
  } = t;
6208
- h.vertical.push(e, o, s), h.horizontal.push(n, a, i);
6228
+ h.vertical.push(e, n, s), h.horizontal.push(o, a, i);
6209
6229
  }, qe = ({
6210
6230
  bounds: h,
6211
6231
  type: t,
6212
6232
  primaryStart: e,
6213
6233
  primaryEnd: s
6214
6234
  }) => {
6215
- const o = [], n = e === "top" ? "left" : "top", i = s === "bottom" ? "right" : "bottom", a = [...h].sort((r, c) => r[e] - c[e]);
6235
+ const n = [], o = e === "top" ? "left" : "top", i = s === "bottom" ? "right" : "bottom", a = [...h].sort((r, c) => r[e] - c[e]);
6216
6236
  for (let r = 0; r < a.length; r += 1) {
6217
6237
  const c = a[r];
6218
6238
  let d = null, l = Number.POSITIVE_INFINITY;
6219
6239
  for (let p = r + 1; p < a.length; p += 1) {
6220
6240
  const m = a[p];
6221
- if (Math.min(c[i], m[i]) - Math.max(c[n], m[n]) < 0) continue;
6241
+ if (Math.min(c[i], m[i]) - Math.max(c[o], m[o]) < 0) continue;
6222
6242
  const M = m[e] - c[s];
6223
6243
  M < 0 || M < l && (l = M, d = m);
6224
6244
  }
6225
6245
  if (!d || l === Number.POSITIVE_INFINITY) continue;
6226
- const u = Math.max(c[n], d[n]), g = Math.min(c[i], d[i]), f = (u + g) / 2;
6227
- o.push({
6246
+ const u = Math.max(c[o], d[o]), g = Math.min(c[i], d[i]), f = (u + g) / 2;
6247
+ n.push({
6228
6248
  type: t,
6229
6249
  axis: f,
6230
6250
  start: c[s],
@@ -6232,8 +6252,8 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6232
6252
  distance: d[e] - c[s]
6233
6253
  });
6234
6254
  }
6235
- return o;
6236
- }, So = ({
6255
+ return n;
6256
+ }, Sn = ({
6237
6257
  bounds: h
6238
6258
  }) => {
6239
6259
  const t = qe({
@@ -6248,7 +6268,7 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6248
6268
  primaryEnd: "right"
6249
6269
  });
6250
6270
  return { vertical: t, horizontal: e };
6251
- }, Ao = ["montage-area", "background", "interaction-blocker"], ns = ({
6271
+ }, An = ["montage-area", "background", "interaction-blocker"], os = ({
6252
6272
  activeObject: h
6253
6273
  }) => {
6254
6274
  const t = /* @__PURE__ */ new Set();
@@ -6256,15 +6276,15 @@ const po = 5, ss = "#3D8BF4", fe = 1, Jt = 1, Ke = ({
6256
6276
  }, is = ({
6257
6277
  object: h,
6258
6278
  excluded: t,
6259
- ignoredIds: e = Ao
6279
+ ignoredIds: e = An
6260
6280
  }) => {
6261
6281
  if (t.has(h)) return !0;
6262
6282
  const { visible: s = !0 } = h;
6263
6283
  if (!s) return !0;
6264
- const { id: o } = h;
6265
- return !!(o && e.includes(o));
6284
+ const { id: n } = h;
6285
+ return !!(n && e.includes(n));
6266
6286
  };
6267
- class jo {
6287
+ class jn {
6268
6288
  /**
6269
6289
  * Создаёт менеджер прилипания и инициализирует слушатели событий.
6270
6290
  */
@@ -6322,13 +6342,13 @@ class jo {
6322
6342
  return;
6323
6343
  }
6324
6344
  !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
6325
- let n = ft({ object: e });
6326
- if (!n) {
6345
+ let o = pt({ object: e });
6346
+ if (!o) {
6327
6347
  this._clearGuides();
6328
6348
  return;
6329
6349
  }
6330
- const { canvas: i } = this, a = i.getZoom() || 1, r = po / a, c = mo({
6331
- activeBounds: n,
6350
+ const { canvas: i } = this, a = i.getZoom() || 1, r = pn / a, c = mn({
6351
+ activeBounds: o,
6332
6352
  threshold: r,
6333
6353
  anchors: this.anchors
6334
6354
  }), { deltaX: d, deltaY: l, guides: u } = c;
@@ -6337,10 +6357,10 @@ class jo {
6337
6357
  e.set({
6338
6358
  left: v + d,
6339
6359
  top: M + l
6340
- }), e.setCoords(), n = (p = ft({ object: e })) != null ? p : n;
6360
+ }), e.setCoords(), o = (p = pt({ object: e })) != null ? p : o;
6341
6361
  }
6342
- const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => ft({ object: v })).filter((v) => !!v), f = bo({
6343
- activeBounds: n,
6362
+ const g = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => pt({ object: v })).filter((v) => !!v), f = bn({
6363
+ activeBounds: o,
6344
6364
  candidates: g,
6345
6365
  threshold: r,
6346
6366
  spacingPatterns: this.spacingPatterns
@@ -6350,7 +6370,7 @@ class jo {
6350
6370
  e.set({
6351
6371
  left: v + f.deltaX,
6352
6372
  top: M + f.deltaY
6353
- }), e.setCoords(), n = (m = ft({ object: e })) != null ? m : n;
6373
+ }), e.setCoords(), o = (m = pt({ object: e })) != null ? m : o;
6354
6374
  }
6355
6375
  this._applyGuides({
6356
6376
  guides: u,
@@ -6377,12 +6397,12 @@ class jo {
6377
6397
  if (!this.activeGuides.length && !this.activeSpacingGuides.length) return;
6378
6398
  const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
6379
6399
  if (!s) return;
6380
- const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, d = t.getZoom() || 1;
6381
- s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = fe / d, s.strokeStyle = ss, s.setLineDash([4, 4]);
6400
+ const n = e != null ? e : this._calculateViewportBounds(), { left: o, right: i, top: a, bottom: r } = n, { viewportTransform: c } = t, d = t.getZoom() || 1;
6401
+ s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = me / d, s.strokeStyle = ss, s.setLineDash([4, 4]);
6382
6402
  for (const l of this.activeGuides)
6383
- s.beginPath(), l.type === "vertical" ? (s.moveTo(l.position, a), s.lineTo(l.position, r)) : (s.moveTo(n, l.position), s.lineTo(i, l.position)), s.stroke();
6403
+ 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();
6384
6404
  for (const l of this.activeSpacingGuides)
6385
- wo({
6405
+ wn({
6386
6406
  context: s,
6387
6407
  guide: l,
6388
6408
  zoom: d
@@ -6418,22 +6438,22 @@ class jo {
6418
6438
  * Применяет шаг перемещения, округляя координаты объекта к сетке MOVE_SNAP_STEP.
6419
6439
  */
6420
6440
  _applyMovementStep({ target: t }) {
6421
- const { left: e = 0, top: s = 0 } = t, o = Math.round(e / Jt) * Jt, n = Math.round(s / Jt) * Jt;
6422
- o === e && n === s || (t.set({
6423
- left: o,
6424
- top: n
6441
+ const { left: e = 0, top: s = 0 } = t, n = Math.round(e / $t) * $t, o = Math.round(s / $t) * $t;
6442
+ n === e && o === s || (t.set({
6443
+ left: n,
6444
+ top: o
6425
6445
  }), t.setCoords());
6426
6446
  }
6427
6447
  /**
6428
6448
  * Сохраняет линии для прилипания от всех доступных объектов и монтажной области.
6429
6449
  */
6430
6450
  _cacheAnchors({ activeObject: t }) {
6431
- const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, o = [];
6451
+ const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, n = [];
6432
6452
  for (const a of e) {
6433
- const r = ft({ object: a });
6434
- r && (Qe({ anchors: s, bounds: r }), o.push(r));
6453
+ const r = pt({ object: a });
6454
+ r && (Qe({ anchors: s, bounds: r }), n.push(r));
6435
6455
  }
6436
- const { montageArea: n } = this.editor, i = ft({ object: n });
6456
+ const { montageArea: o } = this.editor, i = pt({ object: o });
6437
6457
  if (i) {
6438
6458
  Qe({ anchors: s, bounds: i });
6439
6459
  const { left: a, right: r, top: c, bottom: d } = i;
@@ -6445,29 +6465,29 @@ class jo {
6445
6465
  };
6446
6466
  } else
6447
6467
  this.guideBounds = this._calculateViewportBounds();
6448
- this.anchors = s, this.spacingPatterns = So({ bounds: o }), this.cachedTargetBounds = o;
6468
+ this.anchors = s, this.spacingPatterns = Sn({ bounds: n }), this.cachedTargetBounds = n;
6449
6469
  }
6450
6470
  /**
6451
6471
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
6452
6472
  */
6453
6473
  _collectTargets({ activeObject: t }) {
6454
- const e = ns({ activeObject: t }), s = [];
6455
- return this.canvas.forEachObject((o) => {
6456
- is({ object: o, excluded: e }) || s.push(o);
6474
+ const e = os({ activeObject: t }), s = [];
6475
+ return this.canvas.forEachObject((n) => {
6476
+ is({ object: n, excluded: e }) || s.push(n);
6457
6477
  }), s;
6458
6478
  }
6459
6479
  /**
6460
6480
  * Возвращает границы для рисования направляющих.
6461
6481
  */
6462
6482
  _calculateViewportBounds() {
6463
- const { canvas: t } = this, { viewportTransform: e } = t, s = t.getWidth(), o = t.getHeight(), [
6464
- n = 1,
6483
+ const { canvas: t } = this, { viewportTransform: e } = t, s = t.getWidth(), n = t.getHeight(), [
6484
+ o = 1,
6465
6485
  ,
6466
6486
  ,
6467
6487
  i = 1,
6468
6488
  a = 0,
6469
6489
  r = 0
6470
- ] = e != null ? e : [], c = (0 - a) / n, d = (0 - r) / i, l = (s - a) / n, u = (o - r) / i;
6490
+ ] = e != null ? e : [], c = (0 - a) / o, d = (0 - r) / i, l = (s - a) / o, u = (n - r) / i;
6471
6491
  return {
6472
6492
  left: c,
6473
6493
  right: l,
@@ -6539,8 +6559,8 @@ class Lt {
6539
6559
  this._clearGuides();
6540
6560
  return;
6541
6561
  }
6542
- const { canvas: o } = this;
6543
- if (!o.getActiveObjects().length) {
6562
+ const { canvas: n } = this;
6563
+ if (!n.getActiveObjects().length) {
6544
6564
  this._clearGuides();
6545
6565
  return;
6546
6566
  }
@@ -6577,30 +6597,30 @@ class Lt {
6577
6597
  this._clearGuides();
6578
6598
  return;
6579
6599
  }
6580
- const { canvas: e, editor: s } = this, o = e.getActiveObject();
6581
- if (!o) {
6600
+ const { canvas: e, editor: s } = this, n = e.getActiveObject();
6601
+ if (!n) {
6582
6602
  this._clearGuides();
6583
6603
  return;
6584
6604
  }
6585
- const n = ft({ object: o });
6586
- if (!n) {
6605
+ const o = pt({ object: n });
6606
+ if (!o) {
6587
6607
  this._clearGuides();
6588
6608
  return;
6589
6609
  }
6590
6610
  const i = Lt._resolveTarget({
6591
6611
  event: t,
6592
- activeObject: o
6593
- }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = ft({ object: r });
6612
+ activeObject: n
6613
+ }), { montageArea: a } = s, r = i != null ? i : a, c = r === a, d = pt({ object: r });
6594
6614
  if (!d) {
6595
6615
  this._clearGuides();
6596
6616
  return;
6597
6617
  }
6598
- if (c && (n.right <= d.left || n.left >= d.right || n.bottom <= d.top || n.top >= d.bottom)) {
6618
+ if (c && (o.right <= d.left || o.left >= d.right || o.bottom <= d.top || o.top >= d.bottom)) {
6599
6619
  this._clearGuides();
6600
6620
  return;
6601
6621
  }
6602
6622
  const u = Lt._buildGuides({
6603
- activeBounds: n,
6623
+ activeBounds: o,
6604
6624
  targetBounds: d,
6605
6625
  targetIsMontageArea: c
6606
6626
  });
@@ -6617,8 +6637,8 @@ class Lt {
6617
6637
  event: t,
6618
6638
  activeObject: e
6619
6639
  }) {
6620
- const { target: s } = t, o = ns({ activeObject: e });
6621
- return s && !is({ object: s, excluded: o }) ? s : null;
6640
+ const { target: s } = t, n = os({ activeObject: e });
6641
+ return s && !is({ object: s, excluded: n }) ? s : null;
6622
6642
  }
6623
6643
  /**
6624
6644
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -6628,16 +6648,16 @@ class Lt {
6628
6648
  targetBounds: e,
6629
6649
  targetIsMontageArea: s
6630
6650
  }) {
6631
- const o = Lt._buildHorizontalGuides({
6651
+ const n = Lt._buildHorizontalGuides({
6632
6652
  activeBounds: t,
6633
6653
  targetBounds: e,
6634
6654
  targetIsMontageArea: s
6635
- }), n = Lt._buildVerticalGuides({
6655
+ }), o = Lt._buildVerticalGuides({
6636
6656
  activeBounds: t,
6637
6657
  targetBounds: e,
6638
6658
  targetIsMontageArea: s
6639
6659
  });
6640
- return [...o, ...n];
6660
+ return [...n, ...o];
6641
6661
  }
6642
6662
  /**
6643
6663
  * Строит горизонтальные направляющие (расстояние по оси X).
@@ -6647,8 +6667,8 @@ class Lt {
6647
6667
  targetBounds: e,
6648
6668
  targetIsMontageArea: s
6649
6669
  }) {
6650
- const o = [], {
6651
- left: n = 0,
6670
+ const n = [], {
6671
+ left: o = 0,
6652
6672
  right: i = 0,
6653
6673
  top: a = 0,
6654
6674
  bottom: r = 0,
@@ -6661,30 +6681,30 @@ class Lt {
6661
6681
  centerY: f = 0
6662
6682
  } = e, p = Math.max(a, u), m = Math.min(r, g), M = m >= p ? (p + m) / 2 : (c + f) / 2;
6663
6683
  if (d >= i) {
6664
- if (s) return o;
6684
+ if (s) return n;
6665
6685
  const T = d - i;
6666
- return T > 0 && o.push({
6686
+ return T > 0 && n.push({
6667
6687
  type: "horizontal",
6668
6688
  axis: M,
6669
6689
  start: i,
6670
6690
  end: d,
6671
6691
  distance: T
6672
- }), o;
6692
+ }), n;
6673
6693
  }
6674
- if (l <= n) {
6675
- if (s) return o;
6676
- const T = n - l;
6677
- return T > 0 && o.push({
6694
+ if (l <= o) {
6695
+ if (s) return n;
6696
+ const T = o - l;
6697
+ return T > 0 && n.push({
6678
6698
  type: "horizontal",
6679
6699
  axis: M,
6680
6700
  start: l,
6681
- end: n,
6701
+ end: o,
6682
6702
  distance: T
6683
- }), o;
6703
+ }), n;
6684
6704
  }
6685
- if (!s) return o;
6686
- const S = n < d, y = i > l, b = Math.min(n, d), I = Math.max(n, d), j = I - b;
6687
- j > 0 && !S && o.push({
6705
+ if (!s) return n;
6706
+ const S = o < d, y = i > l, b = Math.min(o, d), I = Math.max(o, d), j = I - b;
6707
+ j > 0 && !S && n.push({
6688
6708
  type: "horizontal",
6689
6709
  axis: M,
6690
6710
  start: b,
@@ -6692,13 +6712,13 @@ class Lt {
6692
6712
  distance: j
6693
6713
  });
6694
6714
  const A = Math.min(i, l), C = Math.max(i, l), w = C - A;
6695
- return w > 0 && !y && o.push({
6715
+ return w > 0 && !y && n.push({
6696
6716
  type: "horizontal",
6697
6717
  axis: M,
6698
6718
  start: A,
6699
6719
  end: C,
6700
6720
  distance: w
6701
- }), o;
6721
+ }), n;
6702
6722
  }
6703
6723
  /**
6704
6724
  * Строит вертикальные направляющие (расстояние по оси Y).
@@ -6708,8 +6728,8 @@ class Lt {
6708
6728
  targetBounds: e,
6709
6729
  targetIsMontageArea: s
6710
6730
  }) {
6711
- const o = [], {
6712
- top: n = 0,
6731
+ const n = [], {
6732
+ top: o = 0,
6713
6733
  bottom: i = 0,
6714
6734
  left: a = 0,
6715
6735
  right: r = 0,
@@ -6722,30 +6742,30 @@ class Lt {
6722
6742
  centerX: f = 0
6723
6743
  } = e, p = Math.max(a, u), m = Math.min(r, g), M = m >= p ? (p + m) / 2 : (c + f) / 2;
6724
6744
  if (d >= i) {
6725
- if (s) return o;
6745
+ if (s) return n;
6726
6746
  const T = d - i;
6727
- return T > 0 && o.push({
6747
+ return T > 0 && n.push({
6728
6748
  type: "vertical",
6729
6749
  axis: M,
6730
6750
  start: i,
6731
6751
  end: d,
6732
6752
  distance: T
6733
- }), o;
6753
+ }), n;
6734
6754
  }
6735
- if (l <= n) {
6736
- if (s) return o;
6737
- const T = n - l;
6738
- return T > 0 && o.push({
6755
+ if (l <= o) {
6756
+ if (s) return n;
6757
+ const T = o - l;
6758
+ return T > 0 && n.push({
6739
6759
  type: "vertical",
6740
6760
  axis: M,
6741
6761
  start: l,
6742
- end: n,
6762
+ end: o,
6743
6763
  distance: T
6744
- }), o;
6764
+ }), n;
6745
6765
  }
6746
- if (!s) return o;
6747
- const S = n < d, y = i > l, b = Math.min(n, d), I = Math.max(n, d), j = I - b;
6748
- j > 0 && !S && o.push({
6766
+ if (!s) return n;
6767
+ const S = o < d, y = i > l, b = Math.min(o, d), I = Math.max(o, d), j = I - b;
6768
+ j > 0 && !S && n.push({
6749
6769
  type: "vertical",
6750
6770
  axis: M,
6751
6771
  start: b,
@@ -6753,13 +6773,13 @@ class Lt {
6753
6773
  distance: j
6754
6774
  });
6755
6775
  const A = Math.min(i, l), C = Math.max(i, l), w = C - A;
6756
- return w > 0 && !y && o.push({
6776
+ return w > 0 && !y && n.push({
6757
6777
  type: "vertical",
6758
6778
  axis: M,
6759
6779
  start: A,
6760
6780
  end: C,
6761
6781
  distance: w
6762
- }), o;
6782
+ }), n;
6763
6783
  }
6764
6784
  /**
6765
6785
  * Сбрасывает активные направляющие и инициирует перерисовку.
@@ -6785,18 +6805,18 @@ class Lt {
6785
6805
  if (!this.activeGuides.length) return;
6786
6806
  const { canvas: t } = this, e = t.getSelectionContext();
6787
6807
  if (!e) return;
6788
- const { viewportTransform: s } = t, o = t.getZoom() || 1, n = this.activeGuides.some((c) => c.type === "vertical"), i = this.activeGuides.some((c) => c.type === "horizontal"), a = n && i && !this.isTargetMontageArea, r = a ? 12 / o : 0;
6789
- e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = $e / o, e.strokeStyle = Je, e.setLineDash([]);
6808
+ 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;
6809
+ e.save(), Array.isArray(s) && e.transform(...s), e.lineWidth = $e / n, e.strokeStyle = Je, e.setLineDash([]);
6790
6810
  for (const c of this.activeGuides) {
6791
6811
  const { type: d, axis: l, start: u, end: g, distance: f } = c, p = Math.abs(g - u), m = u <= g ? -1 : 1, v = a ? m * (p / 2 + r) : 0, M = 0;
6792
- e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), pe({
6812
+ e.beginPath(), d === "vertical" ? (e.moveTo(l, u), e.lineTo(l, g)) : (e.moveTo(u, l), e.lineTo(g, l)), e.stroke(), ye({
6793
6813
  context: e,
6794
6814
  type: d,
6795
6815
  axis: l,
6796
6816
  start: u,
6797
6817
  end: g,
6798
6818
  text: Math.round(f).toString(),
6799
- zoom: o,
6819
+ zoom: n,
6800
6820
  color: Je,
6801
6821
  lineWidth: $e,
6802
6822
  offsetAlongAxis: v,
@@ -6824,7 +6844,7 @@ class Lt {
6824
6844
  (e = t == null ? void 0 : t.showAfterTemporary) == null || e.call(t), this.isToolbarHidden = !1;
6825
6845
  }
6826
6846
  }
6827
- class we {
6847
+ class Ae {
6828
6848
  /**
6829
6849
  * Конструктор класса ImageEditor.
6830
6850
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
@@ -6845,8 +6865,8 @@ class we {
6845
6865
  editorContainerWidth: t,
6846
6866
  editorContainerHeight: e,
6847
6867
  canvasWrapperWidth: s,
6848
- canvasWrapperHeight: o,
6849
- canvasCSSWidth: n,
6868
+ canvasWrapperHeight: n,
6869
+ canvasCSSWidth: o,
6850
6870
  canvasCSSHeight: i,
6851
6871
  initialImage: a,
6852
6872
  initialStateJSON: r,
@@ -6854,7 +6874,7 @@ class we {
6854
6874
  showRotationAngle: d,
6855
6875
  _onReadyCallback: l
6856
6876
  } = this.options;
6857
- if ($.apply(), this.canvas = new ys(this.containerId, this.options), this.moduleLoader = new Ss(), this.workerManager = new js(), this.errorManager = new Wt({ editor: this }), this.historyManager = new Ys({ editor: this }), this.toolbar = new Ps({ editor: this }), this.transformManager = new qs({ editor: this }), this.zoomManager = new Js({ editor: this }), this.canvasManager = new Qs({ editor: this }), this.imageManager = new ct({ editor: this }), this.layerManager = new te({ editor: this }), this.shapeManager = new to({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Ot({ editor: this }), this.clipboardManager = new eo({ editor: this }), this.objectLockManager = new ee({ editor: this }), this.groupingManager = new so({ editor: this }), this.selectionManager = new oo({ editor: this }), this.deletionManager = new Me({ editor: this }), this.panConstraintManager = new no({ editor: this }), this.snappingManager = new jo({ editor: this }), this.measurementManager = new Lt({ editor: this }), this.fontManager = new ge((u = this.options.fonts) != null ? u : []), this.textManager = new F({ editor: this }), this.templateManager = new R({ editor: this }), d && (this.angleIndicator = new be({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Ft({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(o), this.canvasManager.setCanvasCSSWidth(n), this.canvasManager.setCanvasCSSHeight(i), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), a != null && a.source) {
6877
+ if ($.apply(), this.canvas = new ys(this.containerId, this.options), this.moduleLoader = new Ss(), this.workerManager = new js(), this.errorManager = new Yt({ editor: this }), this.historyManager = new Ys({ editor: this }), this.toolbar = new Ps({ editor: this }), this.transformManager = new qs({ editor: this }), this.zoomManager = new Js({ editor: this }), this.canvasManager = new Qs({ editor: this }), this.imageManager = new ct({ editor: this }), this.layerManager = new ee({ editor: this }), this.shapeManager = new tn({ editor: this }), this.interactionBlocker = new $s({ editor: this }), this.backgroundManager = new Ot({ editor: this }), this.clipboardManager = new en({ editor: this }), this.objectLockManager = new se({ editor: this }), this.groupingManager = new sn({ editor: this }), this.selectionManager = new nn({ editor: this }), this.deletionManager = new Se({ editor: this }), this.panConstraintManager = new on({ editor: this }), this.snappingManager = new jn({ editor: this }), this.measurementManager = new Lt({ editor: this }), this.fontManager = new pe((u = this.options.fonts) != null ? u : []), this.textManager = new W({ editor: this }), this.templateManager = new R({ editor: this }), d && (this.angleIndicator = new we({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Ft({ 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) {
6858
6878
  const {
6859
6879
  source: g,
6860
6880
  scale: f = `image-${c}`,
@@ -6876,7 +6896,7 @@ class we {
6876
6896
  this.montageArea = this.shapeManager.addRectangle({
6877
6897
  width: t,
6878
6898
  height: e,
6879
- fill: we._createMosaicPattern(),
6899
+ fill: Ae._createMosaicPattern(),
6880
6900
  stroke: null,
6881
6901
  strokeWidth: 0,
6882
6902
  selectable: !1,
@@ -6916,8 +6936,8 @@ class we {
6916
6936
  * Метод для удаления редактора и всех слушателей.
6917
6937
  */
6918
6938
  destroy() {
6919
- var t, e, s, o;
6920
- this.listeners.destroy(), (t = this.snappingManager) == null || t.destroy(), (e = this.measurementManager) == null || e.destroy(), this.toolbar.destroy(), (s = this.angleIndicator) == null || s.destroy(), (o = this.textManager) == null || o.destroy(), this.canvas.dispose(), this.workerManager.worker.terminate(), this.imageManager.revokeBlobUrls(), this.errorManager.cleanBuffer();
6939
+ var t, e, s, n;
6940
+ this.listeners.destroy(), (t = this.snappingManager) == null || t.destroy(), (e = this.measurementManager) == null || e.destroy(), this.toolbar.destroy(), (s = this.angleIndicator) == null || s.destroy(), (n = this.textManager) == null || n.destroy(), this.canvas.dispose(), this.workerManager.worker.terminate(), this.imageManager.revokeBlobUrls(), this.errorManager.cleanBuffer();
6921
6941
  }
6922
6942
  /**
6923
6943
  * Создает паттерн мозаики.
@@ -6972,7 +6992,7 @@ const O = [
6972
6992
  "U+A640-A69F",
6973
6993
  "U+FE2E-FE2F",
6974
6994
  "U+2116"
6975
- ].join(", "), Io = [
6995
+ ].join(", "), In = [
6976
6996
  {
6977
6997
  family: "Arial",
6978
6998
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -7762,7 +7782,7 @@ const O = [
7762
7782
  unicodeRange: O
7763
7783
  }
7764
7784
  }
7765
- ], Co = {
7785
+ ], Cn = {
7766
7786
  /**
7767
7787
  * Опции редактора
7768
7788
  */
@@ -7854,20 +7874,20 @@ const O = [
7854
7874
  /**
7855
7875
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
7856
7876
  */
7857
- fonts: Io
7877
+ fonts: In
7858
7878
  };
7859
- function Do(h, t = {}) {
7860
- const e = B(B({}, Co), t), s = document.getElementById(h);
7879
+ function Dn(h, t = {}) {
7880
+ const e = B(B({}, Cn), t), s = document.getElementById(h);
7861
7881
  if (!s)
7862
7882
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
7863
- const o = document.createElement("canvas");
7864
- return o.id = `${h}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
7865
- e._onReadyCallback = n;
7866
- const i = new we(o.id, e);
7883
+ const n = document.createElement("canvas");
7884
+ return n.id = `${h}-canvas`, s.appendChild(n), e.editorContainer = s, new Promise((o) => {
7885
+ e._onReadyCallback = o;
7886
+ const i = new Ae(n.id, e);
7867
7887
  window[h] = i;
7868
7888
  });
7869
7889
  }
7870
7890
  export {
7871
- Do as default
7891
+ Dn as default
7872
7892
  };
7873
7893
  //# sourceMappingURL=main.js.map