@anu3ev/fabric-image-editor 0.4.7 → 0.4.8

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 +1580 -901
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,25 +1,25 @@
1
- var Re = Object.defineProperty, xe = Object.defineProperties;
2
- var Be = Object.getOwnPropertyDescriptors;
3
- var zt = Object.getOwnPropertySymbols;
4
- var me = Object.prototype.hasOwnProperty, pe = Object.prototype.propertyIsEnumerable;
5
- var fe = (d, t, e) => t in d ? Re(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, k = (d, t) => {
1
+ var Fe = Object.defineProperty, We = Object.defineProperties;
2
+ var He = Object.getOwnPropertyDescriptors;
3
+ var Ut = Object.getOwnPropertySymbols;
4
+ var ye = Object.prototype.hasOwnProperty, ve = Object.prototype.propertyIsEnumerable;
5
+ var me = (d, t, e) => t in d ? Fe(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e, x = (d, t) => {
6
6
  for (var e in t || (t = {}))
7
- me.call(t, e) && fe(d, e, t[e]);
8
- if (zt)
9
- for (var e of zt(t))
10
- pe.call(t, e) && fe(d, e, t[e]);
7
+ ye.call(t, e) && me(d, e, t[e]);
8
+ if (Ut)
9
+ for (var e of Ut(t))
10
+ ve.call(t, e) && me(d, e, t[e]);
11
11
  return d;
12
- }, Tt = (d, t) => xe(d, Be(t));
12
+ }, pt = (d, t) => We(d, He(t));
13
13
  var rt = (d, t) => {
14
14
  var e = {};
15
15
  for (var s in d)
16
- me.call(d, s) && t.indexOf(s) < 0 && (e[s] = d[s]);
17
- if (d != null && zt)
18
- for (var s of zt(d))
19
- t.indexOf(s) < 0 && pe.call(d, s) && (e[s] = d[s]);
16
+ ye.call(d, s) && t.indexOf(s) < 0 && (e[s] = d[s]);
17
+ if (d != null && Ut)
18
+ for (var s of Ut(d))
19
+ t.indexOf(s) < 0 && ve.call(d, s) && (e[s] = d[s]);
20
20
  return e;
21
21
  };
22
- var O = (d, t, e) => new Promise((s, o) => {
22
+ var R = (d, t, e) => new Promise((s, o) => {
23
23
  var n = (r) => {
24
24
  try {
25
25
  a(e.next(r));
@@ -35,15 +35,15 @@ var O = (d, t, e) => new Promise((s, o) => {
35
35
  }, a = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(n, i);
36
36
  a((e = e.apply(d, t)).next());
37
37
  });
38
- import { ActiveSelection as U, Textbox as st, util as it, controlsUtils as ye, InteractiveFabricObject as Me, loadSVGFromURL as _e, FabricImage as Ot, Point as ht, Gradient as ve, Rect as Ue, Circle as ze, Triangle as Ye, Group as pt, Color as Pe, classRegistry as be, loadSVGFromString as Fe, Canvas as We, Pattern as He } from "fabric";
39
- import { create as Ze } from "jsondiffpatch";
40
- import Ve from "diff-match-patch";
41
- var Ge = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", P = function() {
38
+ import { ActiveSelection as z, Textbox as st, util as it, controlsUtils as be, InteractiveFabricObject as Me, loadSVGFromURL as Ze, FabricImage as Dt, Point as ht, Gradient as we, Rect as Ve, Circle as Ge, Triangle as Xe, Group as vt, Color as Ke, classRegistry as je, loadSVGFromString as Qe, Canvas as $e, Pattern as Je } from "fabric";
39
+ import { create as qe } from "jsondiffpatch";
40
+ import ts from "diff-match-patch";
41
+ var es = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", F = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", s = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
- e += Ge[s[t] & 63];
43
+ e += es[s[t] & 63];
44
44
  return e;
45
45
  };
46
- class Lt {
46
+ class Nt {
47
47
  /**
48
48
  * Конструктор принимает редактор и опции.
49
49
  * @param params
@@ -61,7 +61,7 @@ class Lt {
61
61
  * @param params.options.adaptCanvasToContainerOnResize — адаптировать канвас к размерам контейнера при изменении размеров окна
62
62
  */
63
63
  constructor({ editor: t, options: e = {} }) {
64
- this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Lt.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = Lt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Lt.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
64
+ this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, this.savedSelection = [], this.canvasDragging = !1, this.mouseWheelZooming = !1, this.bringToFrontOnSelection = !1, this.resetObjectFitByDoubleClick = !1, this.copyObjectsByHotkey = !1, this.pasteImageFromClipboard = !1, this.undoRedoByHotKeys = !1, this.selectAllByHotkey = !1, this.deleteObjectsByHotkey = !1, this.adaptCanvasToContainerOnResize = !1, this.editor = t, this.canvas = t.canvas, this.options = e, this.handleContainerResizeBound = Nt.debounce(this.handleContainerResize.bind(this), 500), this.handleCopyEventBound = this.handleCopyEvent.bind(this), this.handlePasteEventBound = this.handlePasteEvent.bind(this), this.handleUndoRedoEventBound = this.handleUndoRedoEvent.bind(this), this.handleUndoRedoKeyUpBound = this.handleUndoRedoKeyUp.bind(this), this.handleSelectAllEventBound = this.handleSelectAllEvent.bind(this), this.handleDeleteObjectsEventBound = this.handleDeleteObjectsEvent.bind(this), this.handleSpaceKeyDownBound = this.handleSpaceKeyDown.bind(this), this.handleSpaceKeyUpBound = this.handleSpaceKeyUp.bind(this), this.handleObjectModifiedHistoryBound = Nt.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = Nt.debounce(this.handleObjectRotatingHistory.bind(this), 300), this.handleObjectAddedHistoryBound = this.handleObjectAddedHistory.bind(this), this.handleObjectRemovedHistoryBound = this.handleObjectRemovedHistory.bind(this), this.handleOverlayUpdateBound = this.handleOverlayUpdate.bind(this), this.handleBackgroundUpdateBound = this.handleBackgroundUpdate.bind(this), this.handleCanvasDragStartBound = this.handleCanvasDragStart.bind(this), this.handleCanvasDraggingBound = this.handleCanvasDragging.bind(this), this.handleCanvasDragEndBound = this.handleCanvasDragEnd.bind(this), this.handleMouseWheelZoomBound = this.handleMouseWheelZoom.bind(this), this.handleBringToFrontBound = this.handleBringToFront.bind(this), this.handleResetObjectFitBound = this.handleResetObjectFit.bind(this), this.handleLockedSelectionBound = this._filterLockedSelection.bind(this), this.init();
65
65
  }
66
66
  /**
67
67
  * Инициализация всех обработчиков согласно опциям.
@@ -77,9 +77,9 @@ class Lt {
77
77
  undoRedoByHotKeys: a,
78
78
  selectAllByHotkey: r,
79
79
  deleteObjectsByHotkey: c,
80
- resetObjectFitByDoubleClick: h
80
+ resetObjectFitByDoubleClick: l
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)), h && 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), o && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && 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);
83
83
  }
84
84
  /**
85
85
  * При массовом выделении объектов удаляем из него залоченные.
@@ -98,7 +98,7 @@ class Lt {
98
98
  if (o.length === 1)
99
99
  this.canvas.setActiveObject(o[0]);
100
100
  else {
101
- const i = new U(o, {
101
+ const i = new z(o, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(i);
@@ -106,7 +106,7 @@ class Lt {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const n = new U(t, {
109
+ const n = new z(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -175,7 +175,7 @@ class Lt {
175
175
  * @param event.code — код клавиши
176
176
  */
177
177
  handleUndoRedoEvent(t) {
178
- return O(this, null, function* () {
178
+ return R(this, null, function* () {
179
179
  const { ctrlKey: e, metaKey: s, code: o, repeat: n } = t;
180
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()));
181
181
  });
@@ -220,7 +220,7 @@ class Lt {
220
220
  if (o || n) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const i = e.getActiveObject() || null;
223
- i instanceof U ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
223
+ i instanceof z ? this.savedSelection = i.getObjects().slice() : i && (this.savedSelection = [i]), e.discardActiveObject(), e.set({
224
224
  selection: !1,
225
225
  defaultCursor: "grab"
226
226
  }), e.setCursor("grab"), s.canvasManager.getObjects().forEach((a) => {
@@ -259,7 +259,7 @@ class Lt {
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 });
262
+ const o = t.filter((i) => s.canvasManager.getObjects().includes(i)), n = new z(o, { canvas: e });
263
263
  e.setActiveObject(n);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
@@ -359,13 +359,13 @@ class Lt {
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)
362
- for (const h of c)
362
+ for (const l of c)
363
363
  try {
364
- const l = r;
365
- if (l.matches && l.matches(h) || l.closest && l.closest(h))
364
+ const h = r;
365
+ if (h.matches && h.matches(l) || h.closest && h.closest(l))
366
366
  return !0;
367
- } catch (l) {
368
- console.warn(`Error checking selection container with selector "${h}":`, l);
367
+ } catch (h) {
368
+ console.warn(`Error checking selection container with selector "${l}":`, h);
369
369
  }
370
370
  }
371
371
  return !1;
@@ -391,7 +391,7 @@ class Lt {
391
391
  };
392
392
  }
393
393
  }
394
- class Xe {
394
+ class ss {
395
395
  /**
396
396
  * Класс для динамической загрузки внешних модулей.
397
397
  */
@@ -409,7 +409,7 @@ class Xe {
409
409
  return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
410
410
  }
411
411
  }
412
- function Ke(d) {
412
+ function os(d) {
413
413
  return new Worker(
414
414
  "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
415
415
  {
@@ -417,13 +417,13 @@ function Ke(d) {
417
417
  }
418
418
  );
419
419
  }
420
- class Qe {
420
+ class ns {
421
421
  /**
422
422
  * @param scriptUrl — URL скрипта воркера.
423
423
  * По-умолчанию использует DefaultWorker из соседнего файла
424
424
  */
425
425
  constructor(t) {
426
- t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Ke(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
426
+ t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new os(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
427
427
  }
428
428
  /**
429
429
  * Обработчик сообщений от воркера
@@ -451,7 +451,7 @@ class Qe {
451
451
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
452
452
  */
453
453
  post(t, e, s = []) {
454
- const o = `${t}:${P(8)}`;
454
+ const o = `${t}:${F(8)}`;
455
455
  return new Promise((n, i) => {
456
456
  this._callbacks.set(o, { resolve: n, reject: i }), this.worker.postMessage({ action: t, payload: e, requestId: o }, s);
457
457
  });
@@ -463,26 +463,26 @@ class Qe {
463
463
  this.worker.terminate();
464
464
  }
465
465
  }
466
- const tt = 12, $e = 2, te = 8, ee = 20, Je = 100, se = 20, oe = 8, qe = 100, Wt = 32, ie = 1, ts = "#2B2D33", ae = "#3D8BF4", re = "#FFFFFF";
466
+ const tt = 12, is = 2, ee = 8, se = 20, as = 100, oe = 20, ne = 8, rs = 100, Ht = 32, re = 1, cs = "#2B2D33", ce = "#3D8BF4", de = "#FFFFFF";
467
467
  function Yt(d, t, e, s, o) {
468
- const n = tt, i = $e;
469
- d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = re, d.strokeStyle = ae, d.lineWidth = ie, d.beginPath(), d.roundRect(-n / 2, -n / 2, n, n, i), d.fill(), d.stroke(), d.restore();
468
+ const n = tt, i = is;
469
+ d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = de, d.strokeStyle = ce, d.lineWidth = re, d.beginPath(), d.roundRect(-n / 2, -n / 2, n, n, i), d.fill(), d.stroke(), d.restore();
470
470
  }
471
- function we(d, t, e, s, o) {
472
- const n = te, i = ee, a = Je;
473
- d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = re, d.strokeStyle = ae, d.lineWidth = ie, d.beginPath(), d.roundRect(-n / 2, -i / 2, n, i, a), d.fill(), d.stroke(), d.restore();
471
+ function Se(d, t, e, s, o) {
472
+ const n = ee, i = se, a = as;
473
+ d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = de, d.strokeStyle = ce, d.lineWidth = re, d.beginPath(), d.roundRect(-n / 2, -i / 2, n, i, a), d.fill(), d.stroke(), d.restore();
474
474
  }
475
- function je(d, t, e, s, o) {
476
- const n = se, i = oe, a = qe;
477
- d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = re, d.strokeStyle = ae, d.lineWidth = ie, d.beginPath(), d.roundRect(-n / 2, -i / 2, n, i, a), d.fill(), d.stroke(), d.restore();
475
+ function Ae(d, t, e, s, o) {
476
+ const n = oe, i = ne, a = rs;
477
+ d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = de, d.strokeStyle = ce, d.lineWidth = re, d.beginPath(), d.roundRect(-n / 2, -i / 2, n, i, a), d.fill(), d.stroke(), d.restore();
478
478
  }
479
- const es = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Ne = new Image();
480
- Ne.src = es;
481
- function ss(d, t, e, s, o) {
482
- const i = Wt / 2;
483
- d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = ts, d.beginPath(), d.arc(0, 0, i, 0, 2 * Math.PI), d.fill(), d.drawImage(Ne, -i / 2, -i / 2, i, i), d.restore();
479
+ const ds = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Pe = new Image();
480
+ Pe.src = ds;
481
+ function ls(d, t, e, s, o) {
482
+ const i = Ht / 2;
483
+ d.save(), d.translate(t, e), d.rotate(it.degreesToRadians(o.angle)), d.fillStyle = cs, d.beginPath(), d.arc(0, 0, i, 0, 2 * Math.PI), d.fill(), d.drawImage(Pe, -i / 2, -i / 2, i, i), d.restore();
484
484
  }
485
- const os = {
485
+ const hs = {
486
486
  // Угловые точки
487
487
  tl: {
488
488
  render: Yt,
@@ -514,44 +514,44 @@ const os = {
514
514
  },
515
515
  // Середина вертикалей
516
516
  ml: {
517
- render: we,
518
- sizeX: te,
519
- sizeY: ee,
517
+ render: Se,
518
+ sizeX: ee,
519
+ sizeY: se,
520
520
  offsetX: 0,
521
521
  offsetY: 0
522
522
  },
523
523
  mr: {
524
- render: we,
525
- sizeX: te,
526
- sizeY: ee,
524
+ render: Se,
525
+ sizeX: ee,
526
+ sizeY: se,
527
527
  offsetX: 0,
528
528
  offsetY: 0
529
529
  },
530
530
  // Середина горизонталей
531
531
  mt: {
532
- render: je,
533
- sizeX: se,
534
- sizeY: oe,
532
+ render: Ae,
533
+ sizeX: oe,
534
+ sizeY: ne,
535
535
  offsetX: 0,
536
536
  offsetY: 0
537
537
  },
538
538
  mb: {
539
- render: je,
540
- sizeX: se,
541
- sizeY: oe,
539
+ render: Ae,
540
+ sizeX: oe,
541
+ sizeY: ne,
542
542
  offsetX: 0,
543
543
  offsetY: 0
544
544
  },
545
545
  // Специальный «rotate» контрол
546
546
  mtr: {
547
- render: ss,
548
- sizeX: Wt,
549
- sizeY: Wt,
547
+ render: ls,
548
+ sizeX: Ht,
549
+ sizeY: Ht,
550
550
  offsetX: 0,
551
- offsetY: -Wt
551
+ offsetY: -Ht
552
552
  }
553
553
  };
554
- class yt {
554
+ class bt {
555
555
  static wrapWidthControl(t) {
556
556
  if (!(t != null && t.actionHandler)) return;
557
557
  const e = t.actionHandler;
@@ -561,23 +561,23 @@ class yt {
561
561
  };
562
562
  }
563
563
  static applyControlOverrides(t) {
564
- Object.entries(os).forEach(([e, s]) => {
564
+ Object.entries(hs).forEach(([e, s]) => {
565
565
  const o = t[e];
566
566
  o && (Object.assign(o, s), e === "mtr" && (o.cursorStyle = "grab", o.mouseDownHandler = (n, i, a, r) => {
567
- var h;
567
+ var l;
568
568
  const c = i == null ? void 0 : i.target;
569
- (h = c == null ? void 0 : c.canvas) == null || h.setCursor("grabbing");
569
+ (l = c == null ? void 0 : c.canvas) == null || l.setCursor("grabbing");
570
570
  }));
571
571
  });
572
572
  }
573
573
  static apply() {
574
- const t = ye.createObjectDefaultControls();
575
- yt.applyControlOverrides(t), Me.ownDefaults.controls = t;
576
- const e = ye.createTextboxDefaultControls();
577
- yt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), yt.wrapWidthControl(e.ml), yt.wrapWidthControl(e.mr), st.ownDefaults.controls = e, Me.ownDefaults.snapAngle = 1;
574
+ const t = be.createObjectDefaultControls();
575
+ bt.applyControlOverrides(t), Me.ownDefaults.controls = t;
576
+ const e = be.createTextboxDefaultControls();
577
+ bt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), bt.wrapWidthControl(e.ml), bt.wrapWidthControl(e.mr), st.ownDefaults.controls = e, Me.ownDefaults.snapAngle = 1;
578
578
  }
579
579
  }
580
- const D = class D {
580
+ const k = class k {
581
581
  constructor(t = []) {
582
582
  this.fonts = t;
583
583
  }
@@ -585,36 +585,36 @@ const D = class D {
585
585
  this.fonts = t;
586
586
  }
587
587
  loadFonts() {
588
- return O(this, null, function* () {
588
+ return R(this, null, function* () {
589
589
  var o;
590
590
  const t = (o = this.fonts) != null ? o : [];
591
591
  if (!t.length) return;
592
592
  const e = typeof document != "undefined" ? document : void 0;
593
593
  if (!e) return;
594
- const s = t.map((n) => D.loadFont(n, e));
594
+ const s = t.map((n) => k.loadFont(n, e));
595
595
  yield Promise.allSettled(s);
596
596
  });
597
597
  }
598
598
  static loadFont(t, e) {
599
- return O(this, null, function* () {
600
- var c, h;
601
- const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (h = t.source) == null ? void 0 : h.trim();
599
+ return R(this, null, function* () {
600
+ var c, l;
601
+ const s = typeof FontFace != "undefined", o = (c = t.family) == null ? void 0 : c.trim(), n = (l = t.source) == null ? void 0 : l.trim();
602
602
  if (!o || !n) return;
603
- const i = D.normalizeFontSource(n), a = D.getDescriptorSnapshot(t.descriptors), r = D.getFontRegistrationKey(o, i, a);
604
- if (!D.registeredFontKeys.has(r)) {
605
- if (D.isFontFaceAlreadyApplied(e, o, a)) {
606
- D.registeredFontKeys.add(r);
603
+ const i = k.normalizeFontSource(n), a = k.getDescriptorSnapshot(t.descriptors), r = k.getFontRegistrationKey(o, i, a);
604
+ if (!k.registeredFontKeys.has(r)) {
605
+ if (k.isFontFaceAlreadyApplied(e, o, a)) {
606
+ k.registeredFontKeys.add(r);
607
607
  return;
608
608
  }
609
609
  if (s && e.fonts && typeof e.fonts.add == "function")
610
610
  try {
611
611
  const u = yield new FontFace(o, i, t.descriptors).load();
612
- e.fonts.add(u), D.registeredFontKeys.add(r);
612
+ e.fonts.add(u), k.registeredFontKeys.add(r);
613
613
  return;
614
- } catch (l) {
615
- console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, l);
614
+ } catch (h) {
615
+ console.warn(`Не удалось загрузить шрифт "${o}" через FontFace API`, h);
616
616
  }
617
- D.injectFontFace({
617
+ k.injectFontFace({
618
618
  font: t,
619
619
  source: i,
620
620
  doc: e,
@@ -629,20 +629,20 @@ const D = class D {
629
629
  doc: s,
630
630
  registrationKey: o
631
631
  }) {
632
- var h;
633
- const { descriptors: n } = t, i = (h = t.family) == null ? void 0 : h.trim();
632
+ var l;
633
+ const { descriptors: n } = t, i = (l = t.family) == null ? void 0 : l.trim();
634
634
  if (!i) return;
635
635
  const a = s.createElement("style");
636
636
  a.setAttribute("data-editor-font", i), a.setAttribute("data-editor-font-key", o);
637
- const r = D.descriptorsToCss(n), c = [
637
+ const r = k.descriptorsToCss(n), c = [
638
638
  "@font-face {",
639
- ` font-family: ${D.formatFontFamilyForCss(i)};`,
639
+ ` font-family: ${k.formatFontFamilyForCss(i)};`,
640
640
  ` src: ${e};`,
641
- ...r.map((l) => ` ${l}`),
641
+ ...r.map((h) => ` ${h}`),
642
642
  "}"
643
643
  ];
644
644
  a.textContent = c.join(`
645
- `), s.head.appendChild(a), D.registeredFontKeys.add(o);
645
+ `), s.head.appendChild(a), k.registeredFontKeys.add(o);
646
646
  }
647
647
  static normalizeFontSource(t) {
648
648
  const e = t.trim();
@@ -665,15 +665,15 @@ const D = class D {
665
665
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
666
666
  }
667
667
  static getDescriptorSnapshot(t) {
668
- const e = D.descriptorDefaults;
668
+ const e = k.descriptorDefaults;
669
669
  return {
670
- style: D.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
671
- weight: D.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
672
- stretch: D.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
673
- unicodeRange: D.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
674
- variant: D.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
675
- featureSettings: D.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
676
- display: D.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
670
+ style: k.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
671
+ weight: k.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
672
+ stretch: k.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
673
+ unicodeRange: k.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
674
+ variant: k.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
675
+ featureSettings: k.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
676
+ display: k.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
677
677
  };
678
678
  }
679
679
  static areDescriptorSnapshotsEqual(t, e) {
@@ -681,7 +681,7 @@ const D = class D {
681
681
  }
682
682
  static getFontRegistrationKey(t, e, s) {
683
683
  return [
684
- D.normalizeFamilyName(t),
684
+ k.normalizeFamilyName(t),
685
685
  e,
686
686
  s.style,
687
687
  s.weight,
@@ -695,12 +695,12 @@ const D = class D {
695
695
  static isFontFaceAlreadyApplied(t, e, s) {
696
696
  const o = t.fonts;
697
697
  if (!o || typeof o.forEach != "function") return !1;
698
- const n = D.normalizeFamilyName(e);
698
+ const n = k.normalizeFamilyName(e);
699
699
  let i = !1;
700
700
  try {
701
701
  o.forEach((a) => {
702
- if (i || D.normalizeFamilyName(a.family) !== n) return;
703
- const c = D.getDescriptorSnapshot({
702
+ if (i || k.normalizeFamilyName(a.family) !== n) return;
703
+ const c = k.getDescriptorSnapshot({
704
704
  style: a.style,
705
705
  weight: a.weight,
706
706
  stretch: a.stretch,
@@ -709,7 +709,7 @@ const D = class D {
709
709
  featureSettings: a.featureSettings,
710
710
  display: a.display
711
711
  });
712
- D.areDescriptorSnapshotsEqual(s, c) && (i = !0);
712
+ k.areDescriptorSnapshotsEqual(s, c) && (i = !0);
713
713
  });
714
714
  } catch (a) {
715
715
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", a), !1;
@@ -736,7 +736,7 @@ const D = class D {
736
736
  });
737
737
  }
738
738
  };
739
- D.registeredFontKeys = /* @__PURE__ */ new Set(), D.descriptorDefaults = {
739
+ k.registeredFontKeys = /* @__PURE__ */ new Set(), k.descriptorDefaults = {
740
740
  style: "normal",
741
741
  weight: "normal",
742
742
  stretch: "normal",
@@ -745,8 +745,8 @@ D.registeredFontKeys = /* @__PURE__ */ new Set(), D.descriptorDefaults = {
745
745
  featureSettings: "normal",
746
746
  display: "auto"
747
747
  };
748
- let ne = D;
749
- const ns = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm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NDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Lt = {
750
750
  style: {
751
751
  position: "absolute",
752
752
  display: "none",
@@ -813,17 +813,17 @@ const ns = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
813
813
  ],
814
814
  offsetTop: 50,
815
815
  icons: {
816
- copyPaste: ns,
817
- delete: hs,
818
- lock: is,
819
- unlock: as,
820
- bringToFront: ds,
821
- sendToBack: ls,
822
- bringForward: rs,
823
- sendBackwards: cs
816
+ copyPaste: us,
817
+ delete: bs,
818
+ lock: gs,
819
+ unlock: fs,
820
+ bringToFront: ys,
821
+ sendToBack: vs,
822
+ bringForward: ps,
823
+ sendBackwards: ms
824
824
  },
825
825
  handlers: {
826
- copyPaste: (d) => O(null, null, function* () {
826
+ copyPaste: (d) => R(null, null, function* () {
827
827
  d.clipboardManager.copyPaste();
828
828
  }),
829
829
  delete: (d) => {
@@ -849,18 +849,18 @@ const ns = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
849
849
  }
850
850
  }
851
851
  };
852
- class us {
852
+ class Ms {
853
853
  constructor({ editor: t }) {
854
854
  this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._initToolbar();
855
855
  }
856
856
  _initToolbar() {
857
857
  if (!this.options.showToolbar) return;
858
858
  const t = this.options.toolbar || {};
859
- this.config = Tt(k(k({}, Dt), t), {
860
- style: k(k({}, Dt.style), t.style || {}),
861
- btnStyle: k(k({}, Dt.btnStyle), t.btnStyle || {}),
862
- icons: k(k({}, Dt.icons), t.icons || {}),
863
- handlers: k(k({}, Dt.handlers), t.handlers || {})
859
+ this.config = pt(x(x({}, Lt), t), {
860
+ style: x(x({}, Lt.style), t.style || {}),
861
+ btnStyle: x(x({}, Lt.btnStyle), t.btnStyle || {}),
862
+ icons: x(x({}, Lt.icons), t.icons || {}),
863
+ handlers: x(x({}, Lt.handlers), t.handlers || {})
864
864
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !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 = () => {
865
865
  this.el.style.display = "none";
866
866
  }, this._createDOM(), this._bindEvents();
@@ -951,7 +951,7 @@ class us {
951
951
  }
952
952
  const { el: e, config: s, canvas: o } = this;
953
953
  t.setCoords();
954
- const n = o.getZoom(), [, , , , i, a] = o.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: h } = t.getBoundingRect(), u = r * n + i - e.offsetWidth / 2, g = s.offsetTop || 0, f = (c + h) * n + a + g;
954
+ const n = o.getZoom(), [, , , , i, a] = o.viewportTransform, { x: r } = t.getCenterPoint(), { top: c, height: l } = t.getBoundingRect(), u = r * n + i - e.offsetWidth / 2, g = s.offsetTop || 0, f = (c + l) * n + a + g;
955
955
  Object.assign(e.style, {
956
956
  left: `${u}px`,
957
957
  top: `${f}px`,
@@ -965,7 +965,7 @@ class us {
965
965
  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();
966
966
  }
967
967
  }
968
- const gs = {
968
+ const ws = {
969
969
  position: "absolute",
970
970
  display: "none",
971
971
  background: "#2B2D33",
@@ -979,8 +979,8 @@ const gs = {
979
979
  "pointer-events": "none",
980
980
  "white-space": "nowrap",
981
981
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
982
- }, Ae = 16, Se = 16, fs = "fabric-editor-angle-indicator";
983
- class ce {
982
+ }, Ie = 16, Ce = 16, js = "fabric-editor-angle-indicator";
983
+ class le {
984
984
  constructor({ editor: t }) {
985
985
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
986
986
  }
@@ -988,7 +988,7 @@ class ce {
988
988
  * Создание DOM-элемента индикатора
989
989
  */
990
990
  _createDOM() {
991
- this.el = document.createElement("div"), this.el.className = fs, Object.entries(gs).forEach(([t, e]) => {
991
+ this.el = document.createElement("div"), this.el.className = js, Object.entries(ws).forEach(([t, e]) => {
992
992
  this.el.style.setProperty(t, e);
993
993
  }), this.canvas.wrapperEl.appendChild(this.el);
994
994
  }
@@ -1008,7 +1008,7 @@ class ce {
1008
1008
  return;
1009
1009
  }
1010
1010
  const s = e.angle || 0;
1011
- this.currentAngle = ce._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1011
+ this.currentAngle = le._normalizeAngle(s), this.el.textContent = `${this.currentAngle}°`, this._positionIndicator(t.e), this.isActive || this._showIndicator();
1012
1012
  }
1013
1013
  /**
1014
1014
  * Обработчик отпускания кнопки мыши
@@ -1039,9 +1039,9 @@ class ce {
1039
1039
  */
1040
1040
  _positionIndicator(t) {
1041
1041
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1042
- let s = t.clientX - e.left + Ae, o = t.clientY - e.top + Se;
1042
+ let s = t.clientX - e.left + Ie, o = t.clientY - e.top + Ce;
1043
1043
  const n = this.el.getBoundingClientRect(), i = n.width, a = n.height;
1044
- s + i > e.width && (s = t.clientX - e.left - i - Ae), o + a > e.height && (o = t.clientY - e.top - a - Se), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1044
+ s + i > e.width && (s = t.clientX - e.left - i - Ie), o + a > e.height && (o = t.clientY - e.top - a - Ce), this.el.style.left = `${s}px`, this.el.style.top = `${o}px`;
1045
1045
  }
1046
1046
  /**
1047
1047
  * Показать индикатор
@@ -1072,7 +1072,7 @@ class ce {
1072
1072
  this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), (t = this.el) != null && t.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
1073
1073
  }
1074
1074
  }
1075
- const ke = [
1075
+ const ze = [
1076
1076
  "selectable",
1077
1077
  "evented",
1078
1078
  "id",
@@ -1108,7 +1108,7 @@ const ke = [
1108
1108
  "radiusBottomRight",
1109
1109
  "radiusBottomLeft"
1110
1110
  ];
1111
- class Ht {
1111
+ class Zt {
1112
1112
  constructor({ editor: t }) {
1113
1113
  this.editor = t, this.canvas = t.canvas, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = t.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
1114
1114
  }
@@ -1120,7 +1120,7 @@ class Ht {
1120
1120
  return this.patches[this.currentIndex - 1] || null;
1121
1121
  }
1122
1122
  _createDiffPatcher() {
1123
- this.diffPatcher = Ze({
1123
+ this.diffPatcher = qe({
1124
1124
  objectHash(t) {
1125
1125
  const e = t, s = t, o = s.styles ? JSON.stringify(s.styles) : "";
1126
1126
  return [
@@ -1170,7 +1170,7 @@ class Ht {
1170
1170
  includeValueOnMove: !1
1171
1171
  },
1172
1172
  textDiff: {
1173
- diffMatchPatch: Ve,
1173
+ diffMatchPatch: ts,
1174
1174
  minLength: 60
1175
1175
  }
1176
1176
  });
@@ -1212,7 +1212,7 @@ class Ht {
1212
1212
  if (console.log("saveState"), this.skipHistory) return;
1213
1213
  console.time("saveState");
1214
1214
  const t = this._withTemporaryUnlock(
1215
- () => this.canvas.toDatalessObject([...ke])
1215
+ () => this.canvas.toDatalessObject([...ze])
1216
1216
  );
1217
1217
  if (console.timeEnd("saveState"), !this.baseState) {
1218
1218
  this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
@@ -1223,7 +1223,7 @@ class Ht {
1223
1223
  console.log("Нет изменений для сохранения.");
1224
1224
  return;
1225
1225
  }
1226
- console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: P(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1226
+ console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: F(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1227
1227
  }
1228
1228
  /**
1229
1229
  * Сериализует customData объектов в строку. Это необходимо чтобы при вызове loadFromJSON fabricjs не пытался обрабатывать свойства внутри customData, как свойства FabricObject, если их названия совпадают с зарезервированными.
@@ -1256,19 +1256,19 @@ class Ht {
1256
1256
  * @fires editor:history-state-loaded
1257
1257
  */
1258
1258
  loadStateFromFullState(t) {
1259
- return O(this, null, function* () {
1259
+ return R(this, null, function* () {
1260
1260
  if (!t) return;
1261
1261
  console.log("loadStateFromFullState fullState", t);
1262
1262
  const { canvas: e, canvasManager: s, interactionBlocker: o, backgroundManager: n } = this.editor, { width: i, height: a } = e;
1263
- o.overlayMask = null, Ht._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
1264
- Ht._deserializeCustomData(l, u);
1263
+ o.overlayMask = null, Zt._serializeCustomData(t), yield e.loadFromJSON(t, (h, u) => {
1264
+ Zt._deserializeCustomData(h, u);
1265
1265
  });
1266
- const r = e.getObjects().find((l) => l.id === "montage-area");
1266
+ const r = e.getObjects().find((h) => h.id === "montage-area");
1267
1267
  r && (this.editor.montageArea = r, (i !== e.getWidth() || a !== e.getHeight()) && s.updateCanvas());
1268
- const c = e.getObjects().find((l) => l.id === "overlay-mask");
1268
+ const c = e.getObjects().find((h) => h.id === "overlay-mask");
1269
1269
  c && (o.overlayMask = c, o.overlayMask.visible = !1);
1270
- const h = e.getObjects().find((l) => l.id === "background");
1271
- h ? (n.backgroundObject = h, n.refresh()) : n.removeBackground({ withoutSave: !0 }), e.renderAll(), e.fire("editor:history-state-loaded", {
1270
+ const l = e.getObjects().find((h) => h.id === "background");
1271
+ l ? (n.backgroundObject = l, n.refresh()) : n.removeBackground({ withoutSave: !0 }), e.renderAll(), e.fire("editor:history-state-loaded", {
1272
1272
  fullState: t,
1273
1273
  currentIndex: this.currentIndex,
1274
1274
  totalChangesCount: this.totalChangesCount,
@@ -1283,7 +1283,7 @@ class Ht {
1283
1283
  * @fires editor:undo
1284
1284
  */
1285
1285
  undo() {
1286
- return O(this, null, function* () {
1286
+ return R(this, null, function* () {
1287
1287
  if (!this.skipHistory) {
1288
1288
  if (this.currentIndex <= 0) {
1289
1289
  console.log("Нет предыдущих состояний для отмены.");
@@ -1320,7 +1320,7 @@ class Ht {
1320
1320
  * @fires editor:redo
1321
1321
  */
1322
1322
  redo() {
1323
- return O(this, null, function* () {
1323
+ return R(this, null, function* () {
1324
1324
  if (!this.skipHistory) {
1325
1325
  if (this.currentIndex >= this.patches.length) {
1326
1326
  console.log("Нет состояний для повтора.");
@@ -1358,8 +1358,8 @@ class Ht {
1358
1358
  ((i = (n = (o = this.canvas).getObjects) == null ? void 0 : n.call(o)) != null ? i : []).forEach((a) => {
1359
1359
  const r = typeof a.type == "string" ? a.type.toLowerCase() : "";
1360
1360
  if (!(r === "textbox" || r === "i-text" || typeof a.isEditing == "boolean") || a.locked) return;
1361
- const h = !!a.lockMovementX, l = !!a.lockMovementY;
1362
- !h && !l || (e.push({
1361
+ const l = !!a.lockMovementX, h = !!a.lockMovementY;
1362
+ !l && !h || (e.push({
1363
1363
  object: a,
1364
1364
  lockMovementX: a.lockMovementX,
1365
1365
  lockMovementY: a.lockMovementY,
@@ -1369,13 +1369,13 @@ class Ht {
1369
1369
  try {
1370
1370
  return t();
1371
1371
  } finally {
1372
- e.forEach(({ object: a, lockMovementX: r, lockMovementY: c, selectable: h }) => {
1373
- a.lockMovementX = r, a.lockMovementY = c, a.selectable = h;
1372
+ e.forEach(({ object: a, lockMovementX: r, lockMovementY: c, selectable: l }) => {
1373
+ a.lockMovementX = r, a.lockMovementY = c, a.selectable = l;
1374
1374
  });
1375
1375
  }
1376
1376
  }
1377
1377
  }
1378
- const ms = 0.1, ps = 2, Ie = 0.1, ys = 90, bt = 16, wt = 16, dt = 4096, lt = 4096, Ce = "application/image-editor:", Pt = [
1378
+ const Ss = 0.1, As = 2, Te = 0.1, Is = 90, jt = 16, St = 16, dt = 4096, lt = 4096, Ee = "application/image-editor:", Ft = [
1379
1379
  "format",
1380
1380
  "uppercase",
1381
1381
  "textCaseRaw",
@@ -1389,7 +1389,7 @@ const ms = 0.1, ps = 2, Ie = 0.1, ys = 90, bt = 16, wt = 16, dt = 4096, lt = 409
1389
1389
  "radiusTopRight",
1390
1390
  "radiusBottomRight",
1391
1391
  "radiusBottomLeft"
1392
- ], Ms = 50;
1392
+ ], Cs = 50;
1393
1393
  class et {
1394
1394
  constructor({ editor: t }) {
1395
1395
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
@@ -1407,7 +1407,7 @@ class et {
1407
1407
  * @returns возвращает Promise с объектом изображения или null в случае ошибки
1408
1408
  */
1409
1409
  importImage(t) {
1410
- return O(this, null, function* () {
1410
+ return R(this, null, function* () {
1411
1411
  const {
1412
1412
  source: e,
1413
1413
  scale: s = `image-${this.options.scaleType}`,
@@ -1417,34 +1417,34 @@ class et {
1417
1417
  withoutSelection: a = !1
1418
1418
  } = t;
1419
1419
  if (!e) return null;
1420
- const { canvas: r, montageArea: c, transformManager: h, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = et.getFormatFromContentType(g), { acceptContentTypes: m, acceptFormats: y } = this;
1420
+ const { canvas: r, montageArea: c, transformManager: l, historyManager: h, errorManager: u } = this.editor, g = yield this.getContentType(e), f = et.getFormatFromContentType(g), { acceptContentTypes: m, acceptFormats: p } = this;
1421
1421
  if (!this.isAllowedContentType(g)) {
1422
- const p = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1422
+ const v = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1423
1423
  return u.emitError({
1424
1424
  origin: "ImageManager",
1425
1425
  method: "importImage",
1426
1426
  code: "INVALID_CONTENT_TYPE",
1427
- message: p,
1427
+ message: v,
1428
1428
  data: {
1429
1429
  source: e,
1430
1430
  format: f,
1431
1431
  contentType: g,
1432
1432
  acceptContentTypes: m,
1433
- acceptFormats: y,
1433
+ acceptFormats: p,
1434
1434
  fromClipboard: n,
1435
1435
  isBackground: i,
1436
1436
  withoutSelection: a
1437
1437
  }
1438
1438
  }), null;
1439
1439
  }
1440
- l.suspendHistory();
1440
+ h.suspendHistory();
1441
1441
  try {
1442
- let p, M;
1442
+ let v, b;
1443
1443
  if (e instanceof File)
1444
- p = URL.createObjectURL(e);
1444
+ v = URL.createObjectURL(e);
1445
1445
  else if (typeof e == "string") {
1446
- const S = yield (yield fetch(e, { mode: "cors" })).blob();
1447
- p = URL.createObjectURL(S);
1446
+ const w = yield (yield fetch(e, { mode: "cors" })).blob();
1447
+ v = URL.createObjectURL(w);
1448
1448
  } else
1449
1449
  return u.emitError({
1450
1450
  origin: "ImageManager",
@@ -1456,38 +1456,38 @@ class et {
1456
1456
  format: f,
1457
1457
  contentType: g,
1458
1458
  acceptContentTypes: m,
1459
- acceptFormats: y,
1459
+ acceptFormats: p,
1460
1460
  fromClipboard: n,
1461
1461
  isBackground: i,
1462
1462
  withoutSelection: a
1463
1463
  }
1464
1464
  }), null;
1465
- if (this._createdBlobUrls.push(p), f === "svg") {
1466
- const v = yield _e(p);
1467
- M = it.groupSVGElements(v.objects, v.options);
1465
+ if (this._createdBlobUrls.push(v), f === "svg") {
1466
+ const M = yield Ze(v);
1467
+ b = it.groupSVGElements(M.objects, M.options);
1468
1468
  } else
1469
- M = yield Ot.fromURL(p, { crossOrigin: "anonymous" });
1470
- const { width: b, height: A } = M;
1471
- if (M instanceof Ot) {
1472
- const v = M.getElement();
1473
- let S = "";
1474
- if (v instanceof HTMLImageElement ? S = v.src : v instanceof HTMLCanvasElement && (S = v.toDataURL()), A > lt || b > dt) {
1475
- const L = yield this.resizeImageToBoundaries(S, "max"), B = URL.createObjectURL(L);
1476
- this._createdBlobUrls.push(B), M = yield Ot.fromURL(B, { crossOrigin: "anonymous" });
1477
- } else if (A < wt || b < bt) {
1478
- const L = yield this.resizeImageToBoundaries(S, "min"), B = URL.createObjectURL(L);
1479
- this._createdBlobUrls.push(B), M = yield Ot.fromURL(B, { crossOrigin: "anonymous" });
1469
+ b = yield Dt.fromURL(v, { crossOrigin: "anonymous" });
1470
+ const { width: A, height: y } = b;
1471
+ if (b instanceof Dt) {
1472
+ const M = b.getElement();
1473
+ let w = "";
1474
+ if (M instanceof HTMLImageElement ? w = M.src : M instanceof HTMLCanvasElement && (w = M.toDataURL()), y > lt || A > dt) {
1475
+ const S = yield this.resizeImageToBoundaries(w, "max"), C = URL.createObjectURL(S);
1476
+ this._createdBlobUrls.push(C), b = yield Dt.fromURL(C, { crossOrigin: "anonymous" });
1477
+ } else if (y < St || A < jt) {
1478
+ const S = yield this.resizeImageToBoundaries(w, "min"), C = URL.createObjectURL(S);
1479
+ this._createdBlobUrls.push(C), b = yield Dt.fromURL(C, { crossOrigin: "anonymous" });
1480
1480
  }
1481
1481
  }
1482
- if (M.set("id", `${M.type}-${P()}`), M.set("format", f), s === "scale-montage")
1483
- this.editor.canvasManager.scaleMontageAreaToImage({ object: M, withoutSave: !0 });
1482
+ if (b.set("id", `${b.type}-${F()}`), b.set("format", f), s === "scale-montage")
1483
+ this.editor.canvasManager.scaleMontageAreaToImage({ object: b, withoutSave: !0 });
1484
1484
  else {
1485
- const { width: v, height: S } = c, L = this.calculateScaleFactor({ imageObject: M, scaleType: s });
1486
- s === "image-contain" && L < 1 ? h.fitObject({ object: M, type: "contain", withoutSave: !0 }) : s === "image-cover" && (b > v || A > S) && h.fitObject({ object: M, type: "cover", withoutSave: !0 });
1485
+ const { width: M, height: w } = c, S = this.calculateScaleFactor({ imageObject: b, scaleType: s });
1486
+ s === "image-contain" && S < 1 ? l.fitObject({ object: b, type: "contain", withoutSave: !0 }) : s === "image-cover" && (A > M || y > w) && l.fitObject({ object: b, type: "cover", withoutSave: !0 });
1487
1487
  }
1488
- r.add(M), r.centerObject(M), a || r.setActiveObject(M), r.renderAll(), l.resumeHistory(), o || l.saveState();
1489
- const x = {
1490
- image: M,
1488
+ r.add(b), r.centerObject(b), a || r.setActiveObject(b), r.renderAll(), h.resumeHistory(), o || h.saveState();
1489
+ const j = {
1490
+ image: b,
1491
1491
  format: f,
1492
1492
  contentType: g,
1493
1493
  scale: s,
@@ -1497,13 +1497,13 @@ class et {
1497
1497
  isBackground: i,
1498
1498
  withoutSelection: a
1499
1499
  };
1500
- return r.fire("editor:image-imported", x), x;
1501
- } catch (p) {
1500
+ return r.fire("editor:image-imported", j), j;
1501
+ } catch (v) {
1502
1502
  return u.emitError({
1503
1503
  origin: "ImageManager",
1504
1504
  method: "importImage",
1505
1505
  code: "IMPORT_FAILED",
1506
- message: `Ошибка импорта изображения: ${p.message}`,
1506
+ message: `Ошибка импорта изображения: ${v.message}`,
1507
1507
  data: {
1508
1508
  source: e,
1509
1509
  format: f,
@@ -1514,7 +1514,7 @@ class et {
1514
1514
  isBackground: i,
1515
1515
  withoutSelection: a
1516
1516
  }
1517
- }), l.resumeHistory(), null;
1517
+ }), h.resumeHistory(), null;
1518
1518
  }
1519
1519
  });
1520
1520
  }
@@ -1527,16 +1527,16 @@ class et {
1527
1527
  * @returns возвращает Promise с Blob-объектом уменьшенного изображения
1528
1528
  */
1529
1529
  resizeImageToBoundaries(t, e = "max") {
1530
- return O(this, null, function* () {
1530
+ return R(this, null, function* () {
1531
1531
  let s = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${dt}x${lt}`;
1532
- e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${bt}x${wt}`);
1532
+ e === "min" && (s = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${jt}x${St}`);
1533
1533
  const o = {
1534
1534
  dataURL: t,
1535
1535
  sizeType: e,
1536
1536
  maxWidth: dt,
1537
1537
  maxHeight: lt,
1538
- minWidth: bt,
1539
- minHeight: wt
1538
+ minWidth: jt,
1539
+ minHeight: St
1540
1540
  };
1541
1541
  return this.editor.errorManager.emitWarning({
1542
1542
  origin: "ImageManager",
@@ -1559,7 +1559,7 @@ class et {
1559
1559
  * @fires editor:canvas-exported
1560
1560
  */
1561
1561
  exportCanvasAsImageFile() {
1562
- return O(this, arguments, function* (t = {}) {
1562
+ return R(this, arguments, function* (t = {}) {
1563
1563
  const {
1564
1564
  fileName: e = "image.png",
1565
1565
  contentType: s = "image/png",
@@ -1567,21 +1567,21 @@ class et {
1567
1567
  exportAsBlob: n = !1
1568
1568
  } = t, { canvas: i, montageArea: a, workerManager: r, interactionBlocker: c } = this.editor;
1569
1569
  try {
1570
- const h = s === "application/pdf", l = h ? "image/jpg" : s, u = et.getFormatFromContentType(l);
1570
+ const l = s === "application/pdf", h = l ? "image/jpg" : s, u = et.getFormatFromContentType(h);
1571
1571
  a.setCoords();
1572
- const { left: g, top: f, width: m, height: y } = a.getBoundingRect(), p = yield i.clone(["id", "format", "locked"]);
1573
- p.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (p.backgroundColor = "#ffffff");
1574
- const M = p.getObjects().find((I) => I.id === a.id);
1575
- if (M && (M.visible = !1), c != null && c.isBlocked) {
1576
- const I = p.getObjects().find((_) => _.id === c.overlayMask.id);
1572
+ const { left: g, top: f, width: m, height: p } = a.getBoundingRect(), v = yield i.clone(["id", "format", "locked"]);
1573
+ v.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(h) && (v.backgroundColor = "#ffffff");
1574
+ const b = v.getObjects().find((I) => I.id === a.id);
1575
+ if (b && (b.visible = !1), c != null && c.isBlocked) {
1576
+ const I = v.getObjects().find((O) => O.id === c.overlayMask.id);
1577
1577
  I && (I.visible = !1);
1578
1578
  }
1579
- p.viewportTransform = [1, 0, 0, 1, -g, -f], p.setDimensions({ width: m, height: y }, { backstoreOnly: !0 }), p.renderAll();
1580
- const b = p.getObjects().filter((I) => I.format).every((I) => I.format === "svg");
1581
- if (u === "svg" && b) {
1582
- const I = p.toSVG();
1583
- p.dispose();
1584
- const z = {
1579
+ v.viewportTransform = [1, 0, 0, 1, -g, -f], v.setDimensions({ width: m, height: p }, { backstoreOnly: !0 }), v.renderAll();
1580
+ const A = v.getObjects().filter((I) => I.format).every((I) => I.format === "svg");
1581
+ if (u === "svg" && A) {
1582
+ const I = v.toSVG();
1583
+ v.dispose();
1584
+ const _ = {
1585
1585
  image: et._exportSVGStringAsFile(I, {
1586
1586
  exportAsBase64: o,
1587
1587
  exportAsBlob: n,
@@ -1591,72 +1591,72 @@ class et {
1591
1591
  contentType: "image/svg+xml",
1592
1592
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1593
1593
  };
1594
- return i.fire("editor:canvas-exported", z), z;
1594
+ return i.fire("editor:canvas-exported", _), _;
1595
1595
  }
1596
- const A = yield new Promise((I, _) => {
1597
- p.getElement().toBlob((z) => {
1598
- z ? I(z) : _(new Error("Failed to create Blob from canvas"));
1596
+ const y = yield new Promise((I, O) => {
1597
+ v.getElement().toBlob((_) => {
1598
+ _ ? I(_) : O(new Error("Failed to create Blob from canvas"));
1599
1599
  });
1600
1600
  });
1601
- if (p.dispose(), n) {
1601
+ if (v.dispose(), n) {
1602
1602
  const I = {
1603
- image: A,
1603
+ image: y,
1604
1604
  format: u,
1605
- contentType: l,
1605
+ contentType: h,
1606
1606
  fileName: e
1607
1607
  };
1608
1608
  return i.fire("editor:canvas-exported", I), I;
1609
1609
  }
1610
- const x = yield createImageBitmap(A), v = yield r.post(
1610
+ const j = yield createImageBitmap(y), M = yield r.post(
1611
1611
  "toDataURL",
1612
- { format: u, quality: 1, bitmap: x },
1613
- [x]
1612
+ { format: u, quality: 1, bitmap: j },
1613
+ [j]
1614
1614
  );
1615
- if (h) {
1616
- const _ = m * 0.264583, z = y * 0.264583, G = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Z = new G({
1617
- orientation: _ > z ? "landscape" : "portrait",
1615
+ if (l) {
1616
+ const O = m * 0.264583, _ = p * 0.264583, H = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Y = new H({
1617
+ orientation: O > _ ? "landscape" : "portrait",
1618
1618
  unit: "mm",
1619
- format: [_, z]
1619
+ format: [O, _]
1620
1620
  });
1621
- if (Z.addImage(String(v), "JPG", 0, 0, _, z), o) {
1622
- const Y = {
1623
- image: Z.output("datauristring"),
1621
+ if (Y.addImage(String(M), "JPG", 0, 0, O, _), o) {
1622
+ const U = {
1623
+ image: Y.output("datauristring"),
1624
1624
  format: "pdf",
1625
1625
  contentType: "application/pdf",
1626
1626
  fileName: e
1627
1627
  };
1628
- return i.fire("editor:canvas-exported", Y), Y;
1628
+ return i.fire("editor:canvas-exported", U), U;
1629
1629
  }
1630
- const V = Z.output("blob"), C = {
1631
- image: new File([V], e, { type: "application/pdf" }),
1630
+ const W = Y.output("blob"), D = {
1631
+ image: new File([W], e, { type: "application/pdf" }),
1632
1632
  format: "pdf",
1633
1633
  contentType: "application/pdf",
1634
1634
  fileName: e
1635
1635
  };
1636
- return i.fire("editor:canvas-exported", C), C;
1636
+ return i.fire("editor:canvas-exported", D), D;
1637
1637
  }
1638
1638
  if (o) {
1639
1639
  const I = {
1640
- image: v,
1640
+ image: M,
1641
1641
  format: u,
1642
- contentType: l,
1642
+ contentType: h,
1643
1643
  fileName: e
1644
1644
  };
1645
1645
  return i.fire("editor:canvas-exported", I), I;
1646
1646
  }
1647
- const S = u === "svg" && !b ? e.replace(/\.[^/.]+$/, ".png") : e, B = {
1648
- image: new File([A], S, { type: l }),
1647
+ const w = u === "svg" && !A ? e.replace(/\.[^/.]+$/, ".png") : e, C = {
1648
+ image: new File([y], w, { type: h }),
1649
1649
  format: u,
1650
- contentType: l,
1651
- fileName: S
1650
+ contentType: h,
1651
+ fileName: w
1652
1652
  };
1653
- return i.fire("editor:canvas-exported", B), B;
1654
- } catch (h) {
1653
+ return i.fire("editor:canvas-exported", C), C;
1654
+ } catch (l) {
1655
1655
  return this.editor.errorManager.emitError({
1656
1656
  origin: "ImageManager",
1657
1657
  method: "exportCanvasAsImageFile",
1658
1658
  code: "IMAGE_EXPORT_FAILED",
1659
- message: `Ошибка экспорта изображения: ${h.message}`,
1659
+ message: `Ошибка экспорта изображения: ${l.message}`,
1660
1660
  data: { contentType: s, fileName: e, exportAsBase64: o, exportAsBlob: n }
1661
1661
  }), null;
1662
1662
  }
@@ -1674,7 +1674,7 @@ class et {
1674
1674
  * @fires editor:object-exported
1675
1675
  */
1676
1676
  exportObjectAsImageFile() {
1677
- return O(this, arguments, function* (t = {}) {
1677
+ return R(this, arguments, function* (t = {}) {
1678
1678
  const {
1679
1679
  object: e,
1680
1680
  fileName: s = "image.png",
@@ -1691,51 +1691,51 @@ class et {
1691
1691
  data: { contentType: o, fileName: s, exportAsBase64: n, exportAsBlob: i }
1692
1692
  }), null;
1693
1693
  try {
1694
- const h = et.getFormatFromContentType(o);
1695
- if (h === "svg") {
1696
- const m = c.toSVG(), y = et._exportSVGStringAsFile(m, {
1694
+ const l = et.getFormatFromContentType(o);
1695
+ if (l === "svg") {
1696
+ const m = c.toSVG(), p = et._exportSVGStringAsFile(m, {
1697
1697
  exportAsBase64: n,
1698
1698
  exportAsBlob: i,
1699
1699
  fileName: s
1700
- }), p = {
1700
+ }), v = {
1701
1701
  object: c,
1702
- image: y,
1703
- format: h,
1702
+ image: p,
1703
+ format: l,
1704
1704
  contentType: "image/svg+xml",
1705
1705
  fileName: s.replace(/\.[^/.]+$/, ".svg")
1706
1706
  };
1707
- return a.fire("editor:object-exported", p), p;
1707
+ return a.fire("editor:object-exported", v), v;
1708
1708
  }
1709
- if (n && c instanceof Ot) {
1710
- const m = yield createImageBitmap(c.getElement()), y = yield r.post(
1709
+ if (n && c instanceof Dt) {
1710
+ const m = yield createImageBitmap(c.getElement()), p = yield r.post(
1711
1711
  "toDataURL",
1712
1712
  {
1713
- format: h,
1713
+ format: l,
1714
1714
  quality: 1,
1715
1715
  bitmap: m
1716
1716
  },
1717
1717
  [m]
1718
- ), p = {
1718
+ ), v = {
1719
1719
  object: c,
1720
- image: y,
1721
- format: h,
1720
+ image: p,
1721
+ format: l,
1722
1722
  contentType: o,
1723
1723
  fileName: s
1724
1724
  };
1725
- return a.fire("editor:object-exported", p), p;
1725
+ return a.fire("editor:object-exported", v), v;
1726
1726
  }
1727
- const l = c.toCanvasElement({
1727
+ const h = c.toCanvasElement({
1728
1728
  enableRetinaScaling: !1
1729
- }), u = yield new Promise((m, y) => {
1730
- l.toBlob((p) => {
1731
- p ? m(p) : y(new Error("Failed to create Blob from canvas"));
1729
+ }), u = yield new Promise((m, p) => {
1730
+ h.toBlob((v) => {
1731
+ v ? m(v) : p(new Error("Failed to create Blob from canvas"));
1732
1732
  });
1733
1733
  });
1734
1734
  if (i) {
1735
1735
  const m = {
1736
1736
  object: c,
1737
1737
  image: u,
1738
- format: h,
1738
+ format: l,
1739
1739
  contentType: o,
1740
1740
  fileName: s
1741
1741
  };
@@ -1744,17 +1744,17 @@ class et {
1744
1744
  const g = new File([u], s, { type: o }), f = {
1745
1745
  object: c,
1746
1746
  image: g,
1747
- format: h,
1747
+ format: l,
1748
1748
  contentType: o,
1749
1749
  fileName: s
1750
1750
  };
1751
1751
  return a.fire("editor:object-exported", f), f;
1752
- } catch (h) {
1752
+ } catch (l) {
1753
1753
  return this.editor.errorManager.emitError({
1754
1754
  origin: "ImageManager",
1755
1755
  method: "exportObjectAsImageFile",
1756
1756
  code: "IMAGE_EXPORT_FAILED",
1757
- message: `Ошибка экспорта объекта: ${h.message}`,
1757
+ message: `Ошибка экспорта объекта: ${l.message}`,
1758
1758
  data: { contentType: o, fileName: s, exportAsBase64: n, exportAsBlob: i }
1759
1759
  }), null;
1760
1760
  }
@@ -1787,7 +1787,7 @@ class et {
1787
1787
  * @public
1788
1788
  */
1789
1789
  getContentType(t) {
1790
- return O(this, null, function* () {
1790
+ return R(this, null, function* () {
1791
1791
  return typeof t == "string" ? this.getContentTypeFromUrl(t) : t.type || "application/octet-stream";
1792
1792
  });
1793
1793
  }
@@ -1798,7 +1798,7 @@ class et {
1798
1798
  * @public
1799
1799
  */
1800
1800
  getContentTypeFromUrl(t) {
1801
- return O(this, null, function* () {
1801
+ return R(this, null, function* () {
1802
1802
  if (t.startsWith("data:")) {
1803
1803
  const e = t.match(/^data:([^;]+)/);
1804
1804
  return e ? e[1] : "application/octet-stream";
@@ -1877,11 +1877,11 @@ class et {
1877
1877
  return e ? e[1] : "";
1878
1878
  }
1879
1879
  }
1880
- const mt = (d, t, e) => Math.max(Math.min(d, e), t), Ee = (d, t) => d * t, vs = (d, t) => new ht(d / 2, t / 2);
1881
- function bs(d) {
1880
+ const mt = (d, t, e) => Math.max(Math.min(d, e), t), Oe = (d, t) => d * t, Ts = (d, t) => new ht(d / 2, t / 2);
1881
+ function Es(d) {
1882
1882
  return ((d == null ? void 0 : d.type) === "image" || (d == null ? void 0 : d.format) === "svg") && typeof (d == null ? void 0 : d.width) == "number" && typeof (d == null ? void 0 : d.height) == "number";
1883
1883
  }
1884
- class ws {
1884
+ class Os {
1885
1885
  /**
1886
1886
  * @param options
1887
1887
  * @param options.editor – экземпляр редактора
@@ -1912,15 +1912,15 @@ class ws {
1912
1912
  canvas: n,
1913
1913
  montageArea: i,
1914
1914
  options: { canvasBackstoreWidth: a }
1915
- } = this.editor, { width: r, height: c } = i, h = mt(Number(t), bt, dt);
1916
- if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(h), i.set({ width: h }), (f = n.clipPath) == null || f.set({ width: h }), e) {
1917
- const m = h / r, y = Ee(c, m);
1918
- this.setResolutionHeight(y);
1915
+ } = this.editor, { width: r, height: c } = i, l = mt(Number(t), jt, dt);
1916
+ if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(l), i.set({ width: l }), (f = n.clipPath) == null || f.set({ width: l }), e) {
1917
+ const m = l / r, p = Oe(c, m);
1918
+ this.setResolutionHeight(p);
1919
1919
  return;
1920
1920
  }
1921
- const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
1922
- n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-width-changed", {
1923
- width: h,
1921
+ const { left: h, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
1922
+ n.setViewportTransform([g, 0, 0, g, h, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-width-changed", {
1923
+ width: l,
1924
1924
  preserveProportional: e,
1925
1925
  withoutSave: s,
1926
1926
  adaptCanvasToContainer: o
@@ -1942,15 +1942,15 @@ class ws {
1942
1942
  canvas: n,
1943
1943
  montageArea: i,
1944
1944
  options: { canvasBackstoreHeight: a }
1945
- } = this.editor, { width: r, height: c } = i, h = mt(Number(t), wt, lt);
1946
- if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(h), i.set({ height: h }), (f = n.clipPath) == null || f.set({ height: h }), e) {
1947
- const m = h / c, y = Ee(r, m);
1948
- this.setResolutionWidth(y);
1945
+ } = this.editor, { width: r, height: c } = i, l = mt(Number(t), St, lt);
1946
+ if (!a || a === "auto" || o ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(l), i.set({ height: l }), (f = n.clipPath) == null || f.set({ height: l }), e) {
1947
+ const m = l / c, p = Oe(r, m);
1948
+ this.setResolutionWidth(p);
1949
1949
  return;
1950
1950
  }
1951
- const { left: l, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
1952
- n.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-height-changed", {
1953
- height: h,
1951
+ const { left: h, top: u } = this.getObjectDefaultCoords(i), g = n.getZoom();
1952
+ n.setViewportTransform([g, 0, 0, g, h, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), n.fire("editor:resolution-height-changed", {
1953
+ height: l,
1954
1954
  preserveProportional: e,
1955
1955
  withoutSave: s,
1956
1956
  adaptCanvasToContainer: o
@@ -1962,7 +1962,7 @@ class ws {
1962
1962
  */
1963
1963
  centerMontageArea() {
1964
1964
  var r;
1965
- const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = vs(s, o);
1965
+ const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), o = t.getHeight(), n = t.getZoom(), i = Ts(s, o);
1966
1966
  e.set({
1967
1967
  left: s / 2,
1968
1968
  top: o / 2
@@ -1995,7 +1995,7 @@ class ws {
1995
1995
  */
1996
1996
  setCanvasBackstoreWidth(t) {
1997
1997
  if (!t || typeof t != "number") return;
1998
- const e = mt(t, bt, dt);
1998
+ const e = mt(t, jt, dt);
1999
1999
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2000
2000
  }
2001
2001
  /**
@@ -2004,7 +2004,7 @@ class ws {
2004
2004
  */
2005
2005
  setCanvasBackstoreHeight(t) {
2006
2006
  if (!t || typeof t != "number") return;
2007
- const e = mt(t, wt, lt);
2007
+ const e = mt(t, St, lt);
2008
2008
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2009
2009
  }
2010
2010
  /**
@@ -2013,7 +2013,7 @@ class ws {
2013
2013
  * с учётом минимальных и максимальных значений.
2014
2014
  */
2015
2015
  adaptCanvasToContainer() {
2016
- const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = mt(s, bt, dt), i = mt(o, wt, lt);
2016
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), s = e.clientWidth, o = e.clientHeight, n = mt(s, jt, dt), i = mt(o, St, lt);
2017
2017
  t.setDimensions({ width: n, height: i }, { backstoreOnly: !0 });
2018
2018
  }
2019
2019
  /**
@@ -2033,24 +2033,24 @@ class ws {
2033
2033
  this.setResolutionWidth(s, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.setResolutionHeight(o, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.centerMontageArea();
2034
2034
  const a = e.left - n, r = e.top - i;
2035
2035
  if (a !== 0 || r !== 0) {
2036
- const c = t.getActiveObject(), h = [];
2036
+ const c = t.getActiveObject(), l = [];
2037
2037
  if ((c == null ? void 0 : c.type) === "activeselection") {
2038
- const l = c;
2039
- h.push(...l.getObjects()), t.discardActiveObject();
2038
+ const h = c;
2039
+ l.push(...h.getObjects()), t.discardActiveObject();
2040
2040
  }
2041
- if (t.getObjects().forEach((l) => {
2042
- l.id === "montage-area" || l.id === "overlay-mask" || l.id === "background" || (l.set({
2043
- left: l.left + a,
2044
- top: l.top + r
2045
- }), l.setCoords());
2046
- }), h.length > 0)
2047
- if (h.length === 1)
2048
- t.setActiveObject(h[0]);
2041
+ if (t.getObjects().forEach((h) => {
2042
+ h.id === "montage-area" || h.id === "overlay-mask" || h.id === "background" || (h.set({
2043
+ left: h.left + a,
2044
+ top: h.top + r
2045
+ }), h.setCoords());
2046
+ }), l.length > 0)
2047
+ if (l.length === 1)
2048
+ t.setActiveObject(l[0]);
2049
2049
  else {
2050
- const l = new U(h, {
2050
+ const h = new z(l, {
2051
2051
  canvas: t
2052
2052
  });
2053
- t.setActiveObject(l);
2053
+ t.setActiveObject(h);
2054
2054
  }
2055
2055
  }
2056
2056
  t.renderAll(), t.fire("editor:canvas-updated", {
@@ -2213,17 +2213,17 @@ class ws {
2213
2213
  montageAreaHeight: r
2214
2214
  }
2215
2215
  } = this.editor, c = t || o.getActiveObject();
2216
- if (!bs(c)) return;
2217
- const { width: h, height: l } = c;
2218
- let u = Math.min(h, dt), g = Math.min(l, lt);
2216
+ if (!Es(c)) return;
2217
+ const { width: l, height: h } = c;
2218
+ let u = Math.min(l, dt), g = Math.min(h, lt);
2219
2219
  if (e) {
2220
2220
  const {
2221
2221
  width: f,
2222
2222
  height: m
2223
- } = n, y = h / f, p = l / m, M = Math.max(y, p);
2224
- u = f * M, g = m * M;
2223
+ } = n, p = l / f, v = h / m, b = Math.max(p, v);
2224
+ u = f * b, g = m * b;
2225
2225
  }
2226
- this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (h > 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", {
2226
+ this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (l > a || h > 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", {
2227
2227
  object: c,
2228
2228
  width: u,
2229
2229
  height: g,
@@ -2273,7 +2273,7 @@ class ws {
2273
2273
  );
2274
2274
  }
2275
2275
  }
2276
- class js {
2276
+ class Ds {
2277
2277
  constructor({ editor: t }) {
2278
2278
  this.editor = t, this.options = t.options;
2279
2279
  }
@@ -2284,7 +2284,7 @@ class js {
2284
2284
  * @param options.withoutSave - Не сохранять состояние
2285
2285
  * @fires editor:object-rotated
2286
2286
  */
2287
- rotate(t = ys, { withoutSave: e } = {}) {
2287
+ rotate(t = Is, { withoutSave: e } = {}) {
2288
2288
  const { canvas: s, historyManager: o } = this.editor, n = s.getActiveObject();
2289
2289
  if (!n) return;
2290
2290
  const i = n.angle + t;
@@ -2334,7 +2334,7 @@ class js {
2334
2334
  withoutSave: s
2335
2335
  } = {}) {
2336
2336
  const { canvas: o, historyManager: n } = this.editor, i = t || o.getActiveObject();
2337
- i && (i instanceof U ? i.getObjects().forEach((a) => {
2337
+ i && (i instanceof z ? i.getObjects().forEach((a) => {
2338
2338
  a.set("opacity", e);
2339
2339
  }) : i.set("opacity", e), o.renderAll(), s || n.saveState(), o.fire("editor:object-opacity-changed", {
2340
2340
  object: i,
@@ -2361,12 +2361,12 @@ class js {
2361
2361
  } = {}) {
2362
2362
  const { canvas: n, historyManager: i } = this.editor, a = t || n.getActiveObject();
2363
2363
  if (a) {
2364
- if (a instanceof U && !o) {
2364
+ if (a instanceof z && !o) {
2365
2365
  const r = a.getObjects();
2366
- n.discardActiveObject(), r.forEach((h) => {
2367
- this._fitSingleObject(h, e);
2366
+ n.discardActiveObject(), r.forEach((l) => {
2367
+ this._fitSingleObject(l, e);
2368
2368
  });
2369
- const c = new U(r, { canvas: n });
2369
+ const c = new z(r, { canvas: n });
2370
2370
  n.setActiveObject(c);
2371
2371
  } else
2372
2372
  this._fitSingleObject(a, e);
@@ -2385,11 +2385,11 @@ class js {
2385
2385
  * @private
2386
2386
  */
2387
2387
  _fitSingleObject(t, e) {
2388
- const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, h = 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)), m = h * g + l * f, y = h * f + l * g, p = o.width, M = o.height;
2389
- let b;
2390
- e === "contain" ? b = Math.min(p / m, M / y) : b = Math.max(p / m, M / y), t.set({
2391
- scaleX: a * b,
2392
- scaleY: r * b
2388
+ const { canvas: s, montageArea: o } = this.editor, { width: n, height: i, scaleX: a = 1, scaleY: r = 1, angle: c = 0 } = t, l = n * Math.abs(a), h = i * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), m = l * g + h * f, p = l * f + h * g, v = o.width, b = o.height;
2389
+ let A;
2390
+ e === "contain" ? A = Math.min(v / m, b / p) : A = Math.max(v / m, b / p), t.set({
2391
+ scaleX: a * A,
2392
+ scaleY: r * A
2393
2393
  }), s.centerObject(t);
2394
2394
  }
2395
2395
  /**
@@ -2426,11 +2426,11 @@ class js {
2426
2426
  }), e)
2427
2427
  this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
2428
2428
  else {
2429
- const { width: l, height: u } = n, { width: g, height: f } = c, m = i.calculateScaleFactor({
2429
+ const { width: h, height: u } = n, { width: g, height: f } = c, m = i.calculateScaleFactor({
2430
2430
  imageObject: c,
2431
2431
  scaleType: r
2432
2432
  });
2433
- r === "contain" && m < 1 || r === "cover" && (g > l || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2433
+ r === "contain" && m < 1 || r === "cover" && (g > h || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2434
2434
  }
2435
2435
  c.set({ flipX: !1, flipY: !1, angle: 0 }), o.centerObject(c), o.renderAll(), a.resumeHistory(), s || a.saveState(), o.fire("editor:object-reset", {
2436
2436
  object: c,
@@ -2439,9 +2439,9 @@ class js {
2439
2439
  });
2440
2440
  }
2441
2441
  }
2442
- class As {
2442
+ class Ls {
2443
2443
  constructor({ editor: t }) {
2444
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || ms, this.maxZoom = this.options.maxZoom || ps, this.defaultZoom = this.options.defaultScale;
2444
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || Ss, this.maxZoom = this.options.maxZoom || As, this.defaultZoom = this.options.defaultScale;
2445
2445
  }
2446
2446
  /**
2447
2447
  * Вспомогательный метод для вычисления размеров масштабированной монтажной области
@@ -2463,10 +2463,10 @@ class As {
2463
2463
  * @private
2464
2464
  */
2465
2465
  _getClampedPointerCoordinates(t) {
2466
- 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, h = s.top + s.height / 2, l = a * i + n[4], u = r * i + n[4], g = c * i + n[5], f = h * i + n[5], m = Math.max(l, Math.min(u, o.x)), y = Math.max(g, Math.min(f, o.y));
2466
+ 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, l = s.top + s.height / 2, h = a * i + n[4], u = r * i + n[4], g = c * i + n[5], f = l * i + n[5], m = Math.max(h, Math.min(u, o.x)), p = Math.max(g, Math.min(f, o.y));
2467
2467
  return {
2468
2468
  x: m,
2469
- y
2469
+ y: p
2470
2470
  };
2471
2471
  }
2472
2472
  /**
@@ -2498,10 +2498,10 @@ class As {
2498
2498
  * @private
2499
2499
  */
2500
2500
  _calculateEmptySpaceRatio(t) {
2501
- 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, h = s.top + s.height / 2, l = -o[4] / t, u = (-o[4] + n) / t, g = -o[5] / t, f = (-o[5] + i) / t, m = l < a, y = u > r, p = g < c, M = f > h;
2502
- if (!(m || y || p || M)) return 0;
2503
- const A = Math.max(0, a - l), x = Math.max(0, u - r), v = Math.max(0, c - g), S = Math.max(0, f - h), L = Math.max(A, x), B = Math.max(v, S), I = L / n, _ = B / i;
2504
- return Math.max(I, _);
2501
+ 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, l = s.top + s.height / 2, h = -o[4] / t, u = (-o[4] + n) / t, g = -o[5] / t, f = (-o[5] + i) / t, m = h < a, p = u > r, v = g < c, b = f > l;
2502
+ if (!(m || p || v || b)) return 0;
2503
+ const y = Math.max(0, a - h), j = Math.max(0, u - r), M = Math.max(0, c - g), w = Math.max(0, f - l), S = Math.max(y, j), C = Math.max(M, w), I = S / n, O = C / i;
2504
+ return Math.max(I, O);
2505
2505
  }
2506
2506
  /**
2507
2507
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2514,11 +2514,11 @@ class As {
2514
2514
  * @private
2515
2515
  */
2516
2516
  _calculateSmoothCenteringStep(t, e, s, o, n) {
2517
- const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), h = i.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2517
+ const { canvas: i, montageArea: a } = this.editor, r = i.viewportTransform, c = i.getWidth(), l = i.getHeight(), h = t.x - r[4], u = t.y - r[5], g = Math.abs(o), f = e - s;
2518
2518
  if (Math.abs(f) / g <= 0.1)
2519
- return { x: l, y: u };
2520
- const y = c / 2, p = h / 2, M = a.left, b = a.top, A = y - M * s, x = p - b * s, v = (A - r[4]) / (e - s), S = (x - r[5]) / (e - s), L = v * g, B = S * g, I = L * n, _ = B * n, z = Math.abs(I) > Math.abs(l) ? l : I, G = Math.abs(_) > Math.abs(u) ? u : _;
2521
- return { x: z, y: G };
2519
+ return { x: h, y: u };
2520
+ const p = c / 2, v = l / 2, b = a.left, A = a.top, y = p - b * s, j = v - A * s, M = (y - r[4]) / (e - s), w = (j - r[5]) / (e - s), S = M * g, C = w * g, I = S * n, O = C * n, _ = Math.abs(I) > Math.abs(h) ? h : I, H = Math.abs(O) > Math.abs(u) ? u : O;
2521
+ return { x: _, y: H };
2522
2522
  }
2523
2523
  /**
2524
2524
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2530,9 +2530,9 @@ class As {
2530
2530
  * @returns true если центрирование было применено
2531
2531
  * @private
2532
2532
  */
2533
- _applyViewportCentering(t, e = !1, s = Ie) {
2534
- 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(), h = t - c;
2535
- if (!(!r || h) && !e)
2533
+ _applyViewportCentering(t, e = !1, s = Te) {
2534
+ 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(), l = t - c;
2535
+ if (!(!r || l) && !e)
2536
2536
  return !1;
2537
2537
  const u = o.viewportTransform, g = this._calculateTargetViewportPosition(t);
2538
2538
  if (!r)
@@ -2568,9 +2568,9 @@ class As {
2568
2568
  * @fires editor:zoom-changed
2569
2569
  */
2570
2570
  handleMouseWheelZoom(t, e) {
2571
- const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = t < 0, a = this._getScaledMontageDimensions(n), r = s.getWidth(), c = s.getHeight(), h = a.width > r || a.height > c;
2571
+ const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = t < 0, a = this._getScaledMontageDimensions(n), r = s.getWidth(), c = s.getHeight(), l = a.width > r || a.height > c;
2572
2572
  if (i) {
2573
- if (!h)
2573
+ if (!l)
2574
2574
  this.zoom(t, {
2575
2575
  pointX: o.left,
2576
2576
  pointY: o.top
@@ -2584,17 +2584,17 @@ class As {
2584
2584
  }
2585
2585
  return;
2586
2586
  }
2587
- if (t < 0 || !h) {
2587
+ if (t < 0 || !l) {
2588
2588
  this.zoom(t, {
2589
2589
  pointX: o.left,
2590
2590
  pointY: o.top
2591
2591
  });
2592
2592
  return;
2593
2593
  }
2594
- const l = this._getClampedPointerCoordinates(e);
2594
+ const h = this._getClampedPointerCoordinates(e);
2595
2595
  this.zoom(t, {
2596
- pointX: l.x,
2597
- pointY: l.y
2596
+ pointX: h.x,
2597
+ pointY: h.y
2598
2598
  });
2599
2599
  }
2600
2600
  /**
@@ -2605,16 +2605,16 @@ class As {
2605
2605
  * @param options.pointY - Координата Y точки зума
2606
2606
  * @fires editor:zoom-changed
2607
2607
  */
2608
- zoom(t = Ie, e = {}) {
2608
+ zoom(t = Te, e = {}) {
2609
2609
  var g, f;
2610
2610
  if (!t) return;
2611
- 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, h = (f = e.pointY) != null ? f : r.y, l = new ht(c, h);
2611
+ 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, l = (f = e.pointY) != null ? f : r.y, h = new ht(c, l);
2612
2612
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2613
2613
  let u = Number((a + Number(t)).toFixed(3));
2614
- 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", {
2614
+ u > o && (u = o), u < s && (u = s), n.zoomToPoint(h, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, i, t), n.fire("editor:zoom-changed", {
2615
2615
  currentZoom: n.getZoom(),
2616
2616
  zoom: u,
2617
- point: l
2617
+ point: h
2618
2618
  });
2619
2619
  }
2620
2620
  /**
@@ -2643,7 +2643,7 @@ class As {
2643
2643
  }), this.editor.panConstraintManager.updateBounds();
2644
2644
  }
2645
2645
  }
2646
- class Ss {
2646
+ class Ns {
2647
2647
  constructor({ editor: t }) {
2648
2648
  this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
2649
2649
  }
@@ -2725,7 +2725,7 @@ class Mt {
2725
2725
  }
2726
2726
  i.set({
2727
2727
  fill: t,
2728
- backgroundId: `background-${P()}`
2728
+ backgroundId: `background-${F()}`
2729
2729
  }), this.editor.canvas.requestRenderAll();
2730
2730
  } else
2731
2731
  this._removeCurrentBackground(), this._createColorBackground(t);
@@ -2762,7 +2762,7 @@ class Mt {
2762
2762
  }
2763
2763
  i.set({
2764
2764
  fill: a,
2765
- backgroundId: `background-${P()}`
2765
+ backgroundId: `background-${F()}`
2766
2766
  }), this.editor.canvas.requestRenderAll();
2767
2767
  } else
2768
2768
  this._removeCurrentBackground(), this._createGradientBackground(t);
@@ -2843,7 +2843,7 @@ class Mt {
2843
2843
  * @param options.withoutSave - Если true, не сохранять состояние в историю
2844
2844
  */
2845
2845
  setImageBackground(o) {
2846
- return O(this, arguments, function* ({
2846
+ return R(this, arguments, function* ({
2847
2847
  imageSource: t,
2848
2848
  customData: e = {},
2849
2849
  withoutSave: s = !1
@@ -2909,7 +2909,7 @@ class Mt {
2909
2909
  hasControls: !1,
2910
2910
  id: "background",
2911
2911
  backgroundType: "color",
2912
- backgroundId: `background-${P()}`
2912
+ backgroundId: `background-${F()}`
2913
2913
  }, { withoutSelection: !0 }), this.refresh();
2914
2914
  }
2915
2915
  /**
@@ -2926,7 +2926,7 @@ class Mt {
2926
2926
  hasControls: !1,
2927
2927
  id: "background",
2928
2928
  backgroundType: "gradient",
2929
- backgroundId: `background-${P()}`
2929
+ backgroundId: `background-${F()}`
2930
2930
  }, { withoutSelection: !0 }), this.refresh();
2931
2931
  const e = Mt._createFabricGradient(t);
2932
2932
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
@@ -2936,7 +2936,7 @@ class Mt {
2936
2936
  * @param source - источник изображения (URL или File)
2937
2937
  */
2938
2938
  _createImageBackground(t, e) {
2939
- return O(this, null, function* () {
2939
+ return R(this, null, function* () {
2940
2940
  var o;
2941
2941
  const { image: s } = (o = yield this.editor.imageManager.importImage({
2942
2942
  source: t,
@@ -2954,7 +2954,7 @@ class Mt {
2954
2954
  hasControls: !1,
2955
2955
  id: "background",
2956
2956
  backgroundType: "image",
2957
- backgroundId: `background-${P()}`,
2957
+ backgroundId: `background-${F()}`,
2958
2958
  customData: e
2959
2959
  }), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
2960
2960
  });
@@ -2980,8 +2980,8 @@ class Mt {
2980
2980
  { offset: n / 100, color: s }
2981
2981
  ];
2982
2982
  if (t.type === "linear") {
2983
- const l = t.angle * Math.PI / 180, u = Mt._angleToCoords(l);
2984
- return new ve({
2983
+ const h = t.angle * Math.PI / 180, u = Mt._angleToCoords(h);
2984
+ return new we({
2985
2985
  type: "linear",
2986
2986
  gradientUnits: "percentage",
2987
2987
  coords: u,
@@ -2992,7 +2992,7 @@ class Mt {
2992
2992
  centerX: a = 50,
2993
2993
  centerY: r = 50,
2994
2994
  radius: c = 50
2995
- } = t, h = {
2995
+ } = t, l = {
2996
2996
  x1: a / 100,
2997
2997
  y1: r / 100,
2998
2998
  x2: a / 100,
@@ -3000,10 +3000,10 @@ class Mt {
3000
3000
  r1: 0,
3001
3001
  r2: c / 100
3002
3002
  };
3003
- return new ve({
3003
+ return new we({
3004
3004
  type: "radial",
3005
3005
  gradientUnits: "percentage",
3006
- coords: h,
3006
+ coords: l,
3007
3007
  colorStops: i
3008
3008
  });
3009
3009
  }
@@ -3035,7 +3035,7 @@ class Mt {
3035
3035
  }) ? !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;
3036
3036
  }
3037
3037
  }
3038
- class Zt {
3038
+ class Vt {
3039
3039
  constructor({ editor: t }) {
3040
3040
  this.editor = t;
3041
3041
  }
@@ -3050,7 +3050,7 @@ class Zt {
3050
3050
  const { canvas: s, historyManager: o } = this.editor;
3051
3051
  o.suspendHistory();
3052
3052
  const n = t || s.getActiveObject();
3053
- n && (n instanceof U ? n.getObjects().forEach((i) => {
3053
+ n && (n instanceof z ? n.getObjects().forEach((i) => {
3054
3054
  s.bringObjectToFront(i);
3055
3055
  }) : s.bringObjectToFront(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-to-front", {
3056
3056
  object: n,
@@ -3068,7 +3068,7 @@ class Zt {
3068
3068
  const { canvas: s, historyManager: o } = this.editor;
3069
3069
  o.suspendHistory();
3070
3070
  const n = t || s.getActiveObject();
3071
- n && (n instanceof U ? Zt._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3071
+ n && (n instanceof z ? Vt._moveSelectionForward(s, n) : s.bringObjectForward(n), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-bring-forward", {
3072
3072
  object: n,
3073
3073
  withoutSave: e
3074
3074
  }));
@@ -3091,10 +3091,10 @@ class Zt {
3091
3091
  n.suspendHistory();
3092
3092
  const r = t || s.getActiveObject();
3093
3093
  if (r) {
3094
- if (r instanceof U) {
3094
+ if (r instanceof z) {
3095
3095
  const c = r.getObjects();
3096
- for (let h = c.length - 1; h >= 0; h -= 1)
3097
- s.sendObjectToBack(c[h]);
3096
+ for (let l = c.length - 1; l >= 0; l -= 1)
3097
+ s.sendObjectToBack(c[l]);
3098
3098
  } else
3099
3099
  s.sendObjectToBack(r);
3100
3100
  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", {
@@ -3119,7 +3119,7 @@ class Zt {
3119
3119
  } = this.editor;
3120
3120
  n.suspendHistory();
3121
3121
  const r = t || s.getActiveObject();
3122
- r && (r instanceof U ? Zt._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", {
3122
+ r && (r instanceof z ? Vt._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", {
3123
3123
  object: r,
3124
3124
  withoutSave: e
3125
3125
  }));
@@ -3163,7 +3163,7 @@ class Zt {
3163
3163
  });
3164
3164
  }
3165
3165
  }
3166
- class Is {
3166
+ class Rs {
3167
3167
  /**
3168
3168
  * Менеджер фигур для редактора.
3169
3169
  * @param options - Опции и настройки менеджера фигур.
@@ -3187,15 +3187,15 @@ class Is {
3187
3187
  * @param flags.withoutSelection - Не выделять объект
3188
3188
  * @param flags.withoutAdding - Не добавлять объект в canvas
3189
3189
  */
3190
- addRectangle(h = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3191
- var l = h, {
3192
- id: t = `rect-${P()}`,
3190
+ addRectangle(l = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3191
+ var h = l, {
3192
+ id: t = `rect-${F()}`,
3193
3193
  left: e,
3194
3194
  top: s,
3195
3195
  width: o = 100,
3196
3196
  height: n = 100,
3197
3197
  fill: i = "blue"
3198
- } = l, a = rt(l, [
3198
+ } = h, a = rt(h, [
3199
3199
  "id",
3200
3200
  "left",
3201
3201
  "top",
@@ -3203,7 +3203,7 @@ class Is {
3203
3203
  "height",
3204
3204
  "fill"
3205
3205
  ]);
3206
- const { canvas: u } = this.editor, g = new Ue(k({
3206
+ const { canvas: u } = this.editor, g = new Ve(x({
3207
3207
  id: t,
3208
3208
  left: e,
3209
3209
  top: s,
@@ -3230,27 +3230,27 @@ class Is {
3230
3230
  * @param flags.withoutAdding - Не добавлять объект в canvas
3231
3231
  */
3232
3232
  addCircle(c = {}, { withoutSelection: a, withoutAdding: r } = {}) {
3233
- var h = c, {
3234
- id: t = `circle-${P()}`,
3233
+ var l = c, {
3234
+ id: t = `circle-${F()}`,
3235
3235
  left: e,
3236
3236
  top: s,
3237
3237
  radius: o = 50,
3238
3238
  fill: n = "green"
3239
- } = h, i = rt(h, [
3239
+ } = l, i = rt(l, [
3240
3240
  "id",
3241
3241
  "left",
3242
3242
  "top",
3243
3243
  "radius",
3244
3244
  "fill"
3245
3245
  ]);
3246
- const { canvas: l } = this.editor, u = new ze(k({
3246
+ const { canvas: h } = this.editor, u = new Ge(x({
3247
3247
  id: t,
3248
3248
  left: e,
3249
3249
  top: s,
3250
3250
  fill: n,
3251
3251
  radius: o
3252
3252
  }, i));
3253
- return !e && !s && l.centerObject(u), r || (l.add(u), a || l.setActiveObject(u), l.renderAll()), u;
3253
+ return !e && !s && h.centerObject(u), r || (h.add(u), a || h.setActiveObject(u), h.renderAll()), u;
3254
3254
  }
3255
3255
  /**
3256
3256
  * Добавление треугольника
@@ -3269,15 +3269,15 @@ class Is {
3269
3269
  * @param flags.withoutSelection - Не выделять объект
3270
3270
  * @param flags.withoutAdding - Не добавлять объект в canvas
3271
3271
  */
3272
- addTriangle(h = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3273
- var l = h, {
3274
- id: t = `triangle-${P()}`,
3272
+ addTriangle(l = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3273
+ var h = l, {
3274
+ id: t = `triangle-${F()}`,
3275
3275
  left: e,
3276
3276
  top: s,
3277
3277
  width: o = 100,
3278
3278
  height: n = 100,
3279
3279
  fill: i = "yellow"
3280
- } = l, a = rt(l, [
3280
+ } = h, a = rt(h, [
3281
3281
  "id",
3282
3282
  "left",
3283
3283
  "top",
@@ -3285,7 +3285,7 @@ class Is {
3285
3285
  "height",
3286
3286
  "fill"
3287
3287
  ]);
3288
- const { canvas: u } = this.editor, g = new Ye(k({
3288
+ const { canvas: u } = this.editor, g = new Xe(x({
3289
3289
  id: t,
3290
3290
  left: e,
3291
3291
  top: s,
@@ -3296,7 +3296,7 @@ class Is {
3296
3296
  return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
3297
3297
  }
3298
3298
  }
3299
- class Cs {
3299
+ class ks {
3300
3300
  /**
3301
3301
  * @param options
3302
3302
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -3324,10 +3324,10 @@ class Cs {
3324
3324
  * Асинхронное клонирование для внутреннего буфера
3325
3325
  */
3326
3326
  _cloneToInternalClipboard(t) {
3327
- return O(this, null, function* () {
3327
+ return R(this, null, function* () {
3328
3328
  const { canvas: e, errorManager: s } = this.editor;
3329
3329
  try {
3330
- const o = yield t.clone(Pt);
3330
+ const o = yield t.clone(Ft);
3331
3331
  this.clipboard = o, e.fire("editor:object-copied", { object: o });
3332
3332
  } catch (o) {
3333
3333
  s.emitError({
@@ -3344,7 +3344,7 @@ class Cs {
3344
3344
  * Копирование в системный буфер обмена
3345
3345
  */
3346
3346
  _copyToSystemClipboard(t) {
3347
- return O(this, null, function* () {
3347
+ return R(this, null, function* () {
3348
3348
  const { errorManager: e } = this.editor;
3349
3349
  if (typeof ClipboardItem == "undefined" || !navigator.clipboard)
3350
3350
  return e.emitWarning({
@@ -3354,7 +3354,7 @@ class Cs {
3354
3354
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3355
3355
  }), !1;
3356
3356
  try {
3357
- const s = t.toObject(Pt), o = JSON.stringify(s);
3357
+ const s = t.toObject(Ft), o = JSON.stringify(s);
3358
3358
  return t.type === "image" ? this._copyImageToClipboard(t, o) : this._copyTextToClipboard(o);
3359
3359
  } catch (s) {
3360
3360
  return e.emitError({
@@ -3371,13 +3371,13 @@ class Cs {
3371
3371
  * Копирование изображения в буфер обмена
3372
3372
  */
3373
3373
  _copyImageToClipboard(t, e) {
3374
- return O(this, null, function* () {
3374
+ return R(this, null, function* () {
3375
3375
  try {
3376
3376
  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);
3377
- for (let l = 0; l < a.length; l += 1)
3378
- r[l] = a.charCodeAt(l);
3379
- const c = new Blob([r.buffer], { type: n }), h = new ClipboardItem({ [n]: c });
3380
- return yield navigator.clipboard.write([h]), console.info("Image copied to clipboard successfully"), !0;
3377
+ for (let h = 0; h < a.length; h += 1)
3378
+ r[h] = a.charCodeAt(h);
3379
+ const c = new Blob([r.buffer], { type: n }), l = new ClipboardItem({ [n]: c });
3380
+ return yield navigator.clipboard.write([l]), console.info("Image copied to clipboard successfully"), !0;
3381
3381
  } catch (s) {
3382
3382
  return this.editor.errorManager.emitWarning({
3383
3383
  origin: "ClipboardManager",
@@ -3393,9 +3393,9 @@ class Cs {
3393
3393
  * Копирование текста в буфер обмена
3394
3394
  */
3395
3395
  _copyTextToClipboard(t) {
3396
- return O(this, null, function* () {
3396
+ return R(this, null, function* () {
3397
3397
  try {
3398
- const e = `${Ce}${t}`;
3398
+ const e = `${Ee}${t}`;
3399
3399
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3400
3400
  } catch (e) {
3401
3401
  const { errorManager: s } = this.editor;
@@ -3415,7 +3415,7 @@ class Cs {
3415
3415
  */
3416
3416
  _addClonedObjectToCanvas(t) {
3417
3417
  const { canvas: e, historyManager: s } = this.editor;
3418
- if (e.discardActiveObject(), t instanceof U) {
3418
+ if (e.discardActiveObject(), t instanceof z) {
3419
3419
  s.suspendHistory(), t.canvas = e, t.forEachObject((o) => {
3420
3420
  e.add(o);
3421
3421
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3428,7 +3428,7 @@ class Cs {
3428
3428
  * @param source - источник изображения (data URL или URL)
3429
3429
  */
3430
3430
  _handleImageImport(t) {
3431
- return O(this, null, function* () {
3431
+ return R(this, null, function* () {
3432
3432
  var s;
3433
3433
  const { image: e } = (s = yield this.editor.imageManager.importImage({
3434
3434
  source: t,
@@ -3444,18 +3444,18 @@ class Cs {
3444
3444
  * @fires editor:object-pasted
3445
3445
  */
3446
3446
  copyPaste(t) {
3447
- return O(this, null, function* () {
3447
+ return R(this, null, function* () {
3448
3448
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3449
3449
  if (!s || s.locked) return !1;
3450
3450
  try {
3451
- const o = yield s.clone(Pt);
3452
- return o instanceof U && o.forEachObject((n) => {
3451
+ const o = yield s.clone(Ft);
3452
+ return o instanceof z && o.forEachObject((n) => {
3453
3453
  n.set({
3454
- id: `${n.type}-${P()}`,
3454
+ id: `${n.type}-${F()}`,
3455
3455
  evented: !0
3456
3456
  });
3457
3457
  }), o.set({
3458
- id: `${o.type}-${P()}`,
3458
+ id: `${o.type}-${F()}`,
3459
3459
  left: o.left + 10,
3460
3460
  top: o.top + 10,
3461
3461
  evented: !0
@@ -3479,28 +3479,28 @@ class Cs {
3479
3479
  * @param event.clipboardData.items — элементы буфера обмена
3480
3480
  */
3481
3481
  handlePasteEvent(e) {
3482
- return O(this, arguments, function* ({ clipboardData: t }) {
3482
+ return R(this, arguments, function* ({ clipboardData: t }) {
3483
3483
  var r;
3484
3484
  if (!((r = t == null ? void 0 : t.items) != null && r.length)) {
3485
3485
  this.paste();
3486
3486
  return;
3487
3487
  }
3488
3488
  const s = t.getData("text/plain");
3489
- if (s && s.startsWith(Ce)) {
3489
+ if (s && s.startsWith(Ee)) {
3490
3490
  this.paste();
3491
3491
  return;
3492
3492
  }
3493
3493
  const { items: o } = t, n = o[o.length - 1], i = n.getAsFile();
3494
3494
  if (n.type !== "text/html" && i) {
3495
3495
  const c = new FileReader();
3496
- c.onload = (h) => {
3497
- h.target && this._handleImageImport(h.target.result).catch((l) => {
3496
+ c.onload = (l) => {
3497
+ l.target && this._handleImageImport(l.target.result).catch((h) => {
3498
3498
  this.editor.errorManager.emitError({
3499
3499
  origin: "ClipboardManager",
3500
3500
  method: "handlePasteEvent",
3501
3501
  code: "PASTE_IMAGE_FAILED",
3502
3502
  message: "Ошибка вставки изображения из буфера обмена",
3503
- data: l
3503
+ data: h
3504
3504
  });
3505
3505
  });
3506
3506
  }, c.readAsDataURL(i);
@@ -3508,9 +3508,9 @@ class Cs {
3508
3508
  }
3509
3509
  const a = t.getData("text/html");
3510
3510
  if (a) {
3511
- const l = new DOMParser().parseFromString(a, "text/html").querySelector("img");
3512
- if (l != null && l.src) {
3513
- this._handleImageImport(l.src).catch((u) => {
3511
+ const h = new DOMParser().parseFromString(a, "text/html").querySelector("img");
3512
+ if (h != null && h.src) {
3513
+ this._handleImageImport(h.src).catch((u) => {
3514
3514
  this.editor.errorManager.emitError({
3515
3515
  origin: "ClipboardManager",
3516
3516
  method: "handlePasteEvent",
@@ -3530,18 +3530,18 @@ class Cs {
3530
3530
  * @fires editor:object-pasted
3531
3531
  */
3532
3532
  paste() {
3533
- return O(this, null, function* () {
3533
+ return R(this, null, function* () {
3534
3534
  const { canvas: t } = this.editor;
3535
3535
  if (!this.clipboard) return !1;
3536
3536
  try {
3537
- const e = yield this.clipboard.clone(Pt);
3538
- return t.discardActiveObject(), e instanceof U && e.forEachObject((s) => {
3537
+ const e = yield this.clipboard.clone(Ft);
3538
+ return t.discardActiveObject(), e instanceof z && e.forEachObject((s) => {
3539
3539
  s.set({
3540
- id: `${s.type}-${P()}`,
3540
+ id: `${s.type}-${F()}`,
3541
3541
  evented: !0
3542
3542
  });
3543
3543
  }), e.set({
3544
- id: `${e.type}-${P()}`,
3544
+ id: `${e.type}-${F()}`,
3545
3545
  left: e.left + 10,
3546
3546
  top: e.top + 10,
3547
3547
  evented: !0
@@ -3559,7 +3559,7 @@ class Cs {
3559
3559
  });
3560
3560
  }
3561
3561
  }
3562
- class Vt {
3562
+ class Gt {
3563
3563
  constructor({ editor: t }) {
3564
3564
  this.editor = t;
3565
3565
  }
@@ -3585,7 +3585,7 @@ class Vt {
3585
3585
  editable: !1,
3586
3586
  locked: !0
3587
3587
  };
3588
- i.set(a), !e && Vt._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3588
+ i.set(a), !e && Gt._isGroupOrSelection(i) && i.getObjects().forEach((c) => {
3589
3589
  c.set(a);
3590
3590
  }), o.renderAll(), s || n.saveState(), o.fire("editor:object-locked", {
3591
3591
  object: i,
@@ -3614,7 +3614,7 @@ class Vt {
3614
3614
  editable: !0,
3615
3615
  locked: !1
3616
3616
  };
3617
- n.set(i), Vt._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3617
+ n.set(i), Gt._isGroupOrSelection(n) && n.getObjects().forEach((a) => {
3618
3618
  a.set(i);
3619
3619
  }), s.renderAll(), e || o.saveState(), s.fire("editor:object-unlocked", {
3620
3620
  object: n,
@@ -3622,10 +3622,10 @@ class Vt {
3622
3622
  });
3623
3623
  }
3624
3624
  static _isGroupOrSelection(t) {
3625
- return t instanceof U || t instanceof pt;
3625
+ return t instanceof z || t instanceof vt;
3626
3626
  }
3627
3627
  }
3628
- class Es {
3628
+ class Bs {
3629
3629
  constructor({ editor: t }) {
3630
3630
  this.editor = t;
3631
3631
  }
@@ -3637,7 +3637,7 @@ class Es {
3637
3637
  if (Array.isArray(t))
3638
3638
  return t.length > 0 ? t : null;
3639
3639
  const e = t || this.editor.canvas.getActiveObject();
3640
- return !e || !(e instanceof U) ? null : e.getObjects();
3640
+ return !e || !(e instanceof z) ? null : e.getObjects();
3641
3641
  }
3642
3642
  /**
3643
3643
  * Получить группы для разгруппировки
@@ -3645,20 +3645,20 @@ class Es {
3645
3645
  */
3646
3646
  _getGroupsToUngroup(t) {
3647
3647
  if (Array.isArray(t)) {
3648
- const s = t.filter((o) => o instanceof pt);
3648
+ const s = t.filter((o) => o instanceof vt);
3649
3649
  return s.length > 0 ? s : null;
3650
3650
  }
3651
- if (t instanceof U) {
3652
- const s = t.getObjects().filter((o) => o instanceof pt);
3651
+ if (t instanceof z) {
3652
+ const s = t.getObjects().filter((o) => o instanceof vt);
3653
3653
  return s.length > 0 ? s : null;
3654
3654
  }
3655
3655
  const e = t || this.editor.canvas.getActiveObject();
3656
3656
  if (!e) return null;
3657
- if (e instanceof U) {
3658
- const s = e.getObjects().filter((o) => o instanceof pt);
3657
+ if (e instanceof z) {
3658
+ const s = e.getObjects().filter((o) => o instanceof vt);
3659
3659
  return s.length > 0 ? s : null;
3660
3660
  }
3661
- return e instanceof pt ? [e] : null;
3661
+ return e instanceof vt ? [e] : null;
3662
3662
  }
3663
3663
  /**
3664
3664
  * Группировка объектов
@@ -3675,8 +3675,8 @@ class Es {
3675
3675
  if (!n) return null;
3676
3676
  try {
3677
3677
  o.suspendHistory();
3678
- const i = new pt(n, {
3679
- id: `group-${P()}`
3678
+ const i = new vt(n, {
3679
+ id: `group-${F()}`
3680
3680
  });
3681
3681
  n.forEach((r) => s.remove(r)), s.add(i), s.setActiveObject(i), s.requestRenderAll();
3682
3682
  const a = {
@@ -3706,12 +3706,12 @@ class Es {
3706
3706
  o.suspendHistory();
3707
3707
  const i = [];
3708
3708
  n.forEach((c) => {
3709
- const h = c.removeAll();
3710
- s.remove(c), h.forEach((l) => {
3711
- s.add(l), i.push(l);
3709
+ const l = c.removeAll();
3710
+ s.remove(c), l.forEach((h) => {
3711
+ s.add(h), i.push(h);
3712
3712
  });
3713
3713
  });
3714
- const a = new U(i, {
3714
+ const a = new z(i, {
3715
3715
  canvas: s
3716
3716
  });
3717
3717
  s.setActiveObject(a), s.requestRenderAll();
@@ -3726,7 +3726,7 @@ class Es {
3726
3726
  }
3727
3727
  }
3728
3728
  }
3729
- class Ts {
3729
+ class xs {
3730
3730
  constructor({ editor: t }) {
3731
3731
  this.editor = t;
3732
3732
  }
@@ -3737,11 +3737,11 @@ class Ts {
3737
3737
  selectAll() {
3738
3738
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3739
3739
  t.discardActiveObject();
3740
- const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new U(e.getObjects(), { canvas: t }) : o[0];
3740
+ const o = e.getObjects(), n = o.some((a) => a.locked), i = o.length > 1 ? new z(e.getObjects(), { canvas: t }) : o[0];
3741
3741
  n && s.lockObject({ object: i, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(i), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: i });
3742
3742
  }
3743
3743
  }
3744
- class de {
3744
+ class he {
3745
3745
  constructor({ editor: t }) {
3746
3746
  this.editor = t;
3747
3747
  }
@@ -3783,17 +3783,17 @@ class de {
3783
3783
  withoutSave: e = !1,
3784
3784
  _isRecursiveCall: s = !1
3785
3785
  } = {}) {
3786
- const { canvas: o, historyManager: n } = this.editor, a = (t || o.getActiveObjects()).filter((h) => !h.locked);
3786
+ const { canvas: o, historyManager: n } = this.editor, a = (t || o.getActiveObjects()).filter((l) => !l.locked);
3787
3787
  if (!(a != null && a.length)) return null;
3788
3788
  s || n.suspendHistory();
3789
3789
  const r = [];
3790
- if (a.forEach((h) => {
3791
- if (de._isUngroupableGroup(h)) {
3792
- const l = this._handleGroupDeletion(h);
3793
- r.push(...l);
3790
+ if (a.forEach((l) => {
3791
+ if (he._isUngroupableGroup(l)) {
3792
+ const h = this._handleGroupDeletion(l);
3793
+ r.push(...h);
3794
3794
  return;
3795
3795
  }
3796
- o.remove(h), r.push(h);
3796
+ o.remove(l), r.push(l);
3797
3797
  }), s) return null;
3798
3798
  o.discardActiveObject(), o.renderAll(), n.resumeHistory(), e || n.saveState();
3799
3799
  const c = {
@@ -3908,7 +3908,7 @@ const ct = {
3908
3908
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
3909
3909
  }
3910
3910
  };
3911
- class Nt {
3911
+ class Rt {
3912
3912
  constructor({ editor: t }) {
3913
3913
  this._buffer = [], this.editor = t;
3914
3914
  }
@@ -3935,7 +3935,7 @@ class Nt {
3935
3935
  * @fires editor:error
3936
3936
  */
3937
3937
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: o, message: n }) {
3938
- if (!Nt.isValidErrorCode(s)) {
3938
+ if (!Rt.isValidErrorCode(s)) {
3939
3939
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
3940
3940
  return;
3941
3941
  }
@@ -3949,7 +3949,7 @@ class Nt {
3949
3949
  message: i,
3950
3950
  data: o
3951
3951
  };
3952
- this._buffer.push(k({
3952
+ this._buffer.push(x({
3953
3953
  type: "editor:error"
3954
3954
  }, a)), this.editor.canvas.fire("editor:error", a);
3955
3955
  }
@@ -3964,7 +3964,7 @@ class Nt {
3964
3964
  * @fires editor:warning
3965
3965
  */
3966
3966
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: o, data: n }) {
3967
- if (!Nt.isValidErrorCode(s)) {
3967
+ if (!Rt.isValidErrorCode(s)) {
3968
3968
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
3969
3969
  return;
3970
3970
  }
@@ -3977,7 +3977,7 @@ class Nt {
3977
3977
  message: i,
3978
3978
  data: n
3979
3979
  };
3980
- this._buffer.push(k({
3980
+ this._buffer.push(x({
3981
3981
  type: "editor:warning"
3982
3982
  }, a)), this.editor.canvas.fire("editor:warning", a);
3983
3983
  }
@@ -3990,7 +3990,7 @@ class Nt {
3990
3990
  return t ? Object.values(ct).some((e) => Object.values(e).includes(t)) : !1;
3991
3991
  }
3992
3992
  }
3993
- class Os {
3993
+ class _s {
3994
3994
  constructor({ editor: t }) {
3995
3995
  this.currentBounds = null, this.editor = t;
3996
3996
  }
@@ -4040,12 +4040,12 @@ class Os {
4040
4040
  constrainPan(t, e) {
4041
4041
  if (!this.currentBounds || !this.currentBounds.canPan)
4042
4042
  return { x: 0, y: 0 };
4043
- const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, h = i * n + t - r, l = a * n + e - c, u = Math.max(
4043
+ const { canvas: s, montageArea: o } = this.editor, n = s.getZoom(), i = o.left, a = o.top, r = s.getWidth() / 2, c = s.getHeight() / 2, l = i * n + t - r, h = a * n + e - c, u = Math.max(
4044
4044
  this.currentBounds.minX,
4045
- Math.min(this.currentBounds.maxX, h)
4045
+ Math.min(this.currentBounds.maxX, l)
4046
4046
  ), g = Math.max(
4047
4047
  this.currentBounds.minY,
4048
- Math.min(this.currentBounds.maxY, l)
4048
+ Math.min(this.currentBounds.maxY, h)
4049
4049
  ), f = u + r - i * n, m = g + c - a * n;
4050
4050
  return {
4051
4051
  x: f,
@@ -4064,8 +4064,8 @@ class Os {
4064
4064
  * @returns Объект с координатами смещения
4065
4065
  */
4066
4066
  getCurrentOffset() {
4067
- 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, h = i * s + o[5] - r;
4068
- return { x: c, y: h };
4067
+ 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, l = i * s + o[5] - r;
4068
+ return { x: c, y: l };
4069
4069
  }
4070
4070
  /**
4071
4071
  * Обновить границы перетаскивания.
@@ -4079,10 +4079,10 @@ const q = ({
4079
4079
  value: d,
4080
4080
  min: t,
4081
4081
  max: e
4082
- }) => Math.min(Math.max(d, t), e), vt = class vt extends st {
4082
+ }) => Math.min(Math.max(d, t), e), wt = class wt extends st {
4083
4083
  constructor(t, e = {}) {
4084
- var s, o, n, i, a, r, c, h, l;
4085
- 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 = (h = e.radiusBottomRight) != null ? h : 0, this.radiusBottomLeft = (l = e.radiusBottomLeft) != null ? l : 0;
4084
+ var s, o, n, i, a, r, c, l, h;
4085
+ 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 = (l = e.radiusBottomRight) != null ? l : 0, this.radiusBottomLeft = (h = e.radiusBottomLeft) != null ? h : 0;
4086
4086
  }
4087
4087
  _getLeftOffset() {
4088
4088
  const { width: t } = this._getBackgroundDimensions(), { left: e } = this._getPadding();
@@ -4098,21 +4098,38 @@ const q = ({
4098
4098
  }
4099
4099
  _getTransformedDimensions(t = {}) {
4100
4100
  const { width: e, height: s } = this._getBackgroundDimensions();
4101
- return super._getTransformedDimensions(Tt(k({}, t), {
4101
+ return super._getTransformedDimensions(pt(x({}, t), {
4102
4102
  width: e,
4103
4103
  height: s
4104
4104
  }));
4105
4105
  }
4106
+ /**
4107
+ * Возвращает сериализованное представление с учётом фона, отступов и скруглений.
4108
+ */
4109
+ toObject(t = []) {
4110
+ const e = super.toObject(t);
4111
+ return pt(x({}, e), {
4112
+ backgroundOpacity: this.backgroundOpacity,
4113
+ paddingTop: this.paddingTop,
4114
+ paddingRight: this.paddingRight,
4115
+ paddingBottom: this.paddingBottom,
4116
+ paddingLeft: this.paddingLeft,
4117
+ radiusTopLeft: this.radiusTopLeft,
4118
+ radiusTopRight: this.radiusTopRight,
4119
+ radiusBottomRight: this.radiusBottomRight,
4120
+ radiusBottomLeft: this.radiusBottomLeft
4121
+ });
4122
+ }
4106
4123
  _renderBackground(t) {
4107
4124
  var s, o;
4108
4125
  const e = this._getEffectiveBackgroundFill();
4109
4126
  if (e && e) {
4110
- 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, h = this._getCornerRadii({ width: r, height: c }), l = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4111
- t.save(), vt._renderRoundedRect({
4127
+ 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, l = this._getCornerRadii({ width: r, height: c }), h = this._getLeftOffset() - n.left, u = this._getTopOffset() - n.top;
4128
+ t.save(), wt._renderRoundedRect({
4112
4129
  ctx: t,
4113
4130
  height: c,
4114
- left: l,
4115
- radii: h,
4131
+ left: h,
4132
+ radii: l,
4116
4133
  top: u,
4117
4134
  width: r
4118
4135
  }), t.fillStyle = e, t.fill(), t.restore();
@@ -4152,9 +4169,9 @@ const q = ({
4152
4169
  const e = q({ value: (o = this.backgroundOpacity) != null ? o : 1, min: 0, max: 1 });
4153
4170
  let s;
4154
4171
  try {
4155
- s = new Pe(t);
4172
+ s = new Ke(t);
4156
4173
  } catch (n) {
4157
- return Nt.emitError({
4174
+ return Rt.emitError({
4158
4175
  origin: "BackgroundTextbox",
4159
4176
  method: "_getEffectiveBackgroundFill",
4160
4177
  code: "INVALID_COLOR_VALUE",
@@ -4174,14 +4191,14 @@ const q = ({
4174
4191
  }) {
4175
4192
  const a = s + i, r = n + e, {
4176
4193
  topLeft: c,
4177
- topRight: h,
4178
- bottomRight: l,
4194
+ topRight: l,
4195
+ bottomRight: h,
4179
4196
  bottomLeft: u
4180
- } = o, g = q({ value: c, min: 0, max: i }), f = q({ value: h, min: 0, max: i }), m = q({ value: l, min: 0, max: i }), y = q({ value: u, min: 0, max: i });
4181
- t.beginPath(), t.moveTo(s + g, n), t.lineTo(a - f, n), t.quadraticCurveTo(a, n, a, n + f), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(s + y, r), t.quadraticCurveTo(s, r, s, r - y), t.lineTo(s, n + g), t.quadraticCurveTo(s, n, s + g, n), t.closePath();
4197
+ } = o, g = q({ value: c, min: 0, max: i }), f = q({ value: l, min: 0, max: i }), m = q({ value: h, min: 0, max: i }), p = q({ value: u, min: 0, max: i });
4198
+ t.beginPath(), t.moveTo(s + g, n), t.lineTo(a - f, n), t.quadraticCurveTo(a, n, a, n + f), t.lineTo(a, r - m), t.quadraticCurveTo(a, r, a - m, r), t.lineTo(s + p, r), t.quadraticCurveTo(s, r, s, r - p), t.lineTo(s, n + g), t.quadraticCurveTo(s, n, s + g, n), t.closePath();
4182
4199
  }
4183
4200
  };
4184
- vt.type = "background-textbox", vt.cacheProperties = [
4201
+ wt.type = "background-textbox", wt.cacheProperties = [
4185
4202
  ...Array.isArray(st.cacheProperties) ? st.cacheProperties : [],
4186
4203
  "backgroundColor",
4187
4204
  "backgroundOpacity",
@@ -4193,7 +4210,7 @@ vt.type = "background-textbox", vt.cacheProperties = [
4193
4210
  "radiusTopRight",
4194
4211
  "radiusBottomRight",
4195
4212
  "radiusBottomLeft"
4196
- ], vt.stateProperties = [
4213
+ ], wt.stateProperties = [
4197
4214
  ...Array.isArray(st.stateProperties) ? st.stateProperties : [],
4198
4215
  "backgroundColor",
4199
4216
  "backgroundOpacity",
@@ -4206,11 +4223,11 @@ vt.type = "background-textbox", vt.cacheProperties = [
4206
4223
  "radiusBottomRight",
4207
4224
  "radiusBottomLeft"
4208
4225
  ];
4209
- let Gt = vt;
4210
- const Ds = () => {
4226
+ let Xt = wt;
4227
+ const Ps = () => {
4211
4228
  var d;
4212
- (d = be) != null && d.setClass && be.setClass(Gt, "background-textbox");
4213
- }, Ls = ({ textbox: d }) => {
4229
+ (d = je) != null && d.setClass && je.setClass(Xt, "background-textbox");
4230
+ }, zs = ({ textbox: d }) => {
4214
4231
  var s, o;
4215
4232
  if (!d.isEditing) return null;
4216
4233
  const t = (s = d.selectionStart) != null ? s : 0, e = (o = d.selectionEnd) != null ? o : t;
@@ -4218,16 +4235,16 @@ const Ds = () => {
4218
4235
  start: Math.min(t, e),
4219
4236
  end: Math.max(t, e)
4220
4237
  };
4221
- }, Ns = ({ textbox: d }) => {
4238
+ }, Us = ({ textbox: d }) => {
4222
4239
  var e, s;
4223
4240
  const t = (s = (e = d.text) == null ? void 0 : e.length) != null ? s : 0;
4224
4241
  return t <= 0 ? null : { start: 0, end: t };
4225
- }, ks = ({ textbox: d, range: t }) => {
4242
+ }, Ys = ({ textbox: d, range: t }) => {
4226
4243
  var s, o;
4227
4244
  if (!t) return !1;
4228
4245
  const e = (o = (s = d.text) == null ? void 0 : s.length) != null ? o : 0;
4229
4246
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
4230
- }, Te = ({
4247
+ }, De = ({
4231
4248
  textbox: d,
4232
4249
  styles: t,
4233
4250
  range: e
@@ -4235,7 +4252,7 @@ const Ds = () => {
4235
4252
  if (!t || !Object.keys(t).length) return !1;
4236
4253
  const { start: s, end: o } = e;
4237
4254
  return o <= s ? !1 : (d.setSelectionStyles(t, s, o), !0);
4238
- }, Oe = ({
4255
+ }, Le = ({
4239
4256
  textbox: d,
4240
4257
  range: t,
4241
4258
  property: e
@@ -4249,10 +4266,10 @@ const Ds = () => {
4249
4266
  );
4250
4267
  if (s.length)
4251
4268
  return (o = s[0]) == null ? void 0 : o[e];
4252
- }, De = ({ strokeColor: d, width: t }) => {
4269
+ }, Ne = ({ strokeColor: d, width: t }) => {
4253
4270
  if (!(t <= 0))
4254
4271
  return d != null ? d : "#000000";
4255
- }, Le = ({ width: d = 0 }) => d ? Math.max(0, d) : 0, Kt = ({ value: d }) => typeof d == "string" ? d.toLocaleUpperCase() : "", K = 0.01;
4272
+ }, Re = ({ width: d = 0 }) => d ? Math.max(0, d) : 0, Qt = ({ value: d }) => typeof d == "string" ? d.toLocaleUpperCase() : "", K = 0.01;
4256
4273
  class Q {
4257
4274
  constructor({ editor: t }) {
4258
4275
  var e;
@@ -4273,9 +4290,9 @@ class Q {
4273
4290
  lockMovementY: !1
4274
4291
  }), setTimeout(() => {
4275
4292
  this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4276
- }, Ms);
4293
+ }, Cs);
4277
4294
  }, this._handleObjectScaling = (s) => {
4278
- var It, Ct, Et, W, Bt, _t, at, Ut, ft, he, ue, ge;
4295
+ var Tt, Et, Ot, V, _t, Pt, at, zt, ft, ge, fe, pe;
4279
4296
  const { target: o, transform: n } = s;
4280
4297
  if (!Q._isTextbox(o) || !n) return;
4281
4298
  o.isScaling = !0;
@@ -4283,78 +4300,78 @@ class Q {
4283
4300
  baseWidth: a,
4284
4301
  baseLeft: r,
4285
4302
  baseFontSize: c,
4286
- basePadding: h,
4287
- baseRadii: l
4288
- } = i, u = typeof ((It = n.original) == null ? void 0 : It.width) == "number" ? n.original.width : void 0, g = typeof ((Ct = n.original) == null ? void 0 : Ct.left) == "number" ? n.original.left : void 0, f = u != null ? u : a, m = g != null ? g : r, y = (Et = n.corner) != null ? Et : "", p = (W = n.action) != null ? W : "", M = ["ml", "mr"].includes(y) || p === "scaleX", b = ["mt", "mb"].includes(y) || p === "scaleY", A = ["tl", "tr", "bl", "br"].includes(y) || p === "scale";
4289
- if (!M && !b && !A) return;
4290
- const x = Math.abs((_t = (Bt = o.scaleX) != null ? Bt : n.scaleX) != null ? _t : 1) || 1, v = Math.abs((Ut = (at = o.scaleY) != null ? at : n.scaleY) != null ? Ut : 1) || 1, S = Math.max(1, f * x), L = Math.max(1, c * v), {
4291
- paddingTop: B = 0,
4303
+ basePadding: l,
4304
+ baseRadii: h
4305
+ } = i, u = typeof ((Tt = n.original) == null ? void 0 : Tt.width) == "number" ? n.original.width : void 0, g = typeof ((Et = n.original) == null ? void 0 : Et.left) == "number" ? n.original.left : void 0, f = u != null ? u : a, m = g != null ? g : r, p = (Ot = n.corner) != null ? Ot : "", v = (V = n.action) != null ? V : "", b = ["ml", "mr"].includes(p) || v === "scaleX", A = ["mt", "mb"].includes(p) || v === "scaleY", y = ["tl", "tr", "bl", "br"].includes(p) || v === "scale";
4306
+ if (!b && !A && !y) return;
4307
+ const j = Math.abs((Pt = (_t = o.scaleX) != null ? _t : n.scaleX) != null ? Pt : 1) || 1, M = Math.abs((zt = (at = o.scaleY) != null ? at : n.scaleY) != null ? zt : 1) || 1, w = Math.max(1, f * j), S = Math.max(1, c * M), {
4308
+ paddingTop: C = 0,
4292
4309
  paddingRight: I = 0,
4293
- paddingBottom: _ = 0,
4294
- paddingLeft: z = 0,
4295
- radiusTopLeft: G = 0,
4296
- radiusTopRight: Z = 0,
4297
- radiusBottomRight: V = 0,
4298
- radiusBottomLeft: X = 0,
4299
- fontSize: C,
4300
- width: T,
4301
- originX: Y = "left"
4302
- } = o, F = A || b, H = A || b, R = F ? {
4303
- top: Math.max(0, h.top * v),
4304
- right: Math.max(0, h.right * v),
4305
- bottom: Math.max(0, h.bottom * v),
4306
- left: Math.max(0, h.left * v)
4307
- } : h, N = H ? {
4308
- topLeft: Math.max(0, l.topLeft * v),
4309
- topRight: Math.max(0, l.topRight * v),
4310
- bottomRight: Math.max(0, l.bottomRight * v),
4311
- bottomLeft: Math.max(0, l.bottomLeft * v)
4312
- } : l, jt = (he = (ft = n.originX) != null ? ft : Y) != null ? he : "left", kt = m + f, Rt = m + f / 2, ut = T != null ? T : f, At = Math.abs(S - ut) > K, Xt = Math.abs(L - (C != null ? C : c)) > K, gt = Math.abs(R.top - B) > K || Math.abs(R.right - I) > K || Math.abs(R.bottom - _) > K || Math.abs(R.left - z) > K, xt = Math.abs(N.topLeft - G) > K || Math.abs(N.topRight - Z) > K || Math.abs(N.bottomRight - V) > K || Math.abs(N.bottomLeft - X) > K;
4313
- if (!At && !Xt && !gt && !xt) {
4310
+ paddingBottom: O = 0,
4311
+ paddingLeft: _ = 0,
4312
+ radiusTopLeft: H = 0,
4313
+ radiusTopRight: Y = 0,
4314
+ radiusBottomRight: W = 0,
4315
+ radiusBottomLeft: G = 0,
4316
+ fontSize: D,
4317
+ width: N,
4318
+ originX: U = "left"
4319
+ } = o, Z = y || A, X = y || A, P = Z ? {
4320
+ top: Math.max(0, l.top * M),
4321
+ right: Math.max(0, l.right * M),
4322
+ bottom: Math.max(0, l.bottom * M),
4323
+ left: Math.max(0, l.left * M)
4324
+ } : l, B = X ? {
4325
+ topLeft: Math.max(0, h.topLeft * M),
4326
+ topRight: Math.max(0, h.topRight * M),
4327
+ bottomRight: Math.max(0, h.bottomRight * M),
4328
+ bottomLeft: Math.max(0, h.bottomLeft * M)
4329
+ } : h, At = (ge = (ft = n.originX) != null ? ft : U) != null ? ge : "left", kt = m + f, Bt = m + f / 2, ut = N != null ? N : f, It = Math.abs(w - ut) > K, Kt = Math.abs(S - (D != null ? D : c)) > K, gt = Math.abs(P.top - C) > K || Math.abs(P.right - I) > K || Math.abs(P.bottom - O) > K || Math.abs(P.left - _) > K, xt = Math.abs(B.topLeft - H) > K || Math.abs(B.topRight - Y) > K || Math.abs(B.bottomRight - W) > K || Math.abs(B.bottomLeft - G) > K;
4330
+ if (!It && !Kt && !gt && !xt) {
4314
4331
  o.set({ scaleX: 1, scaleY: 1 }), n.scaleX = 1, n.scaleY = 1;
4315
4332
  return;
4316
4333
  }
4317
4334
  o.set({
4318
- width: S,
4319
- fontSize: A || b ? L : c,
4320
- paddingTop: R.top,
4321
- paddingRight: R.right,
4322
- paddingBottom: R.bottom,
4323
- paddingLeft: R.left,
4324
- radiusTopLeft: N.topLeft,
4325
- radiusTopRight: N.topRight,
4326
- radiusBottomRight: N.bottomRight,
4327
- radiusBottomLeft: N.bottomLeft,
4335
+ width: w,
4336
+ fontSize: y || A ? S : c,
4337
+ paddingTop: P.top,
4338
+ paddingRight: P.right,
4339
+ paddingBottom: P.bottom,
4340
+ paddingLeft: P.left,
4341
+ radiusTopLeft: B.topLeft,
4342
+ radiusTopRight: B.topRight,
4343
+ radiusBottomRight: B.bottomRight,
4344
+ radiusBottomLeft: B.bottomLeft,
4328
4345
  scaleX: 1,
4329
4346
  scaleY: 1
4330
4347
  });
4331
- const ot = (ue = o.width) != null ? ue : S, St = Math.abs(ot - ut) > K;
4348
+ const ot = (fe = o.width) != null ? fe : w, Ct = Math.abs(ot - ut) > K;
4332
4349
  let nt = m;
4333
- St && (M || A) && (jt === "right" ? nt = kt - ot : jt === "center" && (nt = Rt - ot / 2)), o.set({ left: nt }), i.baseLeft = nt, n.scaleX = 1, n.scaleY = 1;
4350
+ Ct && (b || y) && (At === "right" ? nt = kt - ot : At === "center" && (nt = Bt - ot / 2)), o.set({ left: nt }), i.baseLeft = nt, n.scaleX = 1, n.scaleY = 1;
4334
4351
  const { original: J } = n;
4335
- J && (J.scaleX = 1, J.scaleY = 1, J.width = ot, J.height = o.height, J.left = nt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ot, i.baseFontSize = (ge = o.fontSize) != null ? ge : L, i.basePadding = {
4336
- top: R.top,
4337
- right: R.right,
4338
- bottom: R.bottom,
4339
- left: R.left
4352
+ J && (J.scaleX = 1, J.scaleY = 1, J.width = ot, J.height = o.height, J.left = nt), o.setCoords(), this.canvas.requestRenderAll(), i.baseWidth = ot, i.baseFontSize = (pe = o.fontSize) != null ? pe : S, i.basePadding = {
4353
+ top: P.top,
4354
+ right: P.right,
4355
+ bottom: P.bottom,
4356
+ left: P.left
4340
4357
  }, i.baseRadii = {
4341
- topLeft: N.topLeft,
4342
- topRight: N.topRight,
4343
- bottomRight: N.bottomRight,
4344
- bottomLeft: N.bottomLeft
4345
- }, i.hasWidthChange = St || Xt || gt || xt;
4358
+ topLeft: B.topLeft,
4359
+ topRight: B.topRight,
4360
+ bottomRight: B.bottomRight,
4361
+ bottomLeft: B.bottomLeft
4362
+ }, i.hasWidthChange = Ct || Kt || gt || xt;
4346
4363
  }, this._handleObjectModified = (s) => {
4347
- var y, p, M;
4364
+ var p, v, b;
4348
4365
  const { target: o } = s;
4349
4366
  if (!Q._isTextbox(o)) return;
4350
4367
  o.isScaling = !1;
4351
4368
  const n = this.scalingState.get(o);
4352
4369
  if (this.scalingState.delete(o), !(n != null && n.hasWidthChange)) return;
4353
- const i = (y = o.width) != null ? y : o.calcTextWidth(), a = (M = (p = o.fontSize) != null ? p : n == null ? void 0 : n.baseFontSize) != null ? M : 16, {
4370
+ const i = (p = o.width) != null ? p : o.calcTextWidth(), a = (b = (v = o.fontSize) != null ? v : n == null ? void 0 : n.baseFontSize) != null ? b : 16, {
4354
4371
  paddingTop: r = 0,
4355
4372
  paddingRight: c = 0,
4356
- paddingBottom: h = 0,
4357
- paddingLeft: l = 0,
4373
+ paddingBottom: l = 0,
4374
+ paddingLeft: h = 0,
4358
4375
  radiusTopLeft: u = 0,
4359
4376
  radiusTopRight: g = 0,
4360
4377
  radiusBottomRight: f = 0,
@@ -4367,24 +4384,24 @@ class Q {
4367
4384
  fontSize: a,
4368
4385
  paddingTop: r,
4369
4386
  paddingRight: c,
4370
- paddingBottom: h,
4371
- paddingLeft: l,
4387
+ paddingBottom: l,
4388
+ paddingLeft: h,
4372
4389
  radiusTopLeft: u,
4373
4390
  radiusTopRight: g,
4374
4391
  radiusBottomRight: f,
4375
4392
  radiusBottomLeft: m
4376
4393
  }
4377
4394
  }), o.set({ scaleX: 1, scaleY: 1 }), o.setCoords();
4378
- }, 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(), Ds();
4395
+ }, 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(), Ps();
4379
4396
  }
4380
4397
  /**
4381
4398
  * Добавляет новый текстовый объект на канвас.
4382
4399
  * @param options — настройки текста
4383
4400
  * @param flags — флаги поведения
4384
4401
  */
4385
- addText(G = {}, { withoutSelection: I = !1, withoutSave: _ = !1, withoutAdding: z = !1 } = {}) {
4386
- var Z = G, {
4387
- id: t = `text-${P()}`,
4402
+ addText(H = {}, { withoutSelection: I = !1, withoutSave: O = !1, withoutAdding: _ = !1 } = {}) {
4403
+ var Y = H, {
4404
+ id: t = `text-${F()}`,
4388
4405
  text: e = "Новый текст",
4389
4406
  fontFamily: s,
4390
4407
  fontSize: o = 48,
@@ -4393,22 +4410,22 @@ class Q {
4393
4410
  underline: a = !1,
4394
4411
  uppercase: r = !1,
4395
4412
  strikethrough: c = !1,
4396
- align: h = "left",
4397
- color: l = "#000000",
4413
+ align: l = "left",
4414
+ color: h = "#000000",
4398
4415
  strokeColor: u,
4399
4416
  strokeWidth: g = 0,
4400
4417
  opacity: f = 1,
4401
4418
  backgroundColor: m,
4402
- backgroundOpacity: y = 1,
4403
- paddingTop: p = 0,
4404
- paddingRight: M = 0,
4405
- paddingBottom: b = 0,
4406
- paddingLeft: A = 0,
4407
- radiusTopLeft: x = 0,
4408
- radiusTopRight: v = 0,
4409
- radiusBottomRight: S = 0,
4410
- radiusBottomLeft: L = 0
4411
- } = Z, B = rt(Z, [
4419
+ backgroundOpacity: p = 1,
4420
+ paddingTop: v = 0,
4421
+ paddingRight: b = 0,
4422
+ paddingBottom: A = 0,
4423
+ paddingLeft: y = 0,
4424
+ radiusTopLeft: j = 0,
4425
+ radiusTopRight: M = 0,
4426
+ radiusBottomRight: w = 0,
4427
+ radiusBottomLeft: S = 0
4428
+ } = Y, C = rt(Y, [
4412
4429
  "id",
4413
4430
  "text",
4414
4431
  "fontFamily",
@@ -4434,60 +4451,60 @@ class Q {
4434
4451
  "radiusBottomRight",
4435
4452
  "radiusBottomLeft"
4436
4453
  ]);
4437
- var R;
4438
- const { historyManager: V } = this.editor, { canvas: X } = this;
4439
- V.suspendHistory();
4440
- const C = s != null ? s : this._getDefaultFontFamily(), T = Le({ width: g }), Y = De({
4454
+ var P;
4455
+ const { historyManager: W } = this.editor, { canvas: G } = this;
4456
+ W.suspendHistory();
4457
+ const D = s != null ? s : this._getDefaultFontFamily(), N = Re({ width: g }), U = Ne({
4441
4458
  strokeColor: u,
4442
- width: T
4443
- }), F = k({
4459
+ width: N
4460
+ }), Z = x({
4444
4461
  id: t,
4445
- fontFamily: C,
4462
+ fontFamily: D,
4446
4463
  fontSize: o,
4447
4464
  fontWeight: n ? "bold" : "normal",
4448
4465
  fontStyle: i ? "italic" : "normal",
4449
4466
  underline: a,
4450
4467
  uppercase: r,
4451
4468
  linethrough: c,
4452
- textAlign: h,
4453
- fill: l,
4454
- stroke: Y,
4455
- strokeWidth: T,
4469
+ textAlign: l,
4470
+ fill: h,
4471
+ stroke: U,
4472
+ strokeWidth: N,
4456
4473
  strokeUniform: !0,
4457
4474
  opacity: f,
4458
4475
  backgroundColor: m,
4459
- backgroundOpacity: y,
4460
- paddingTop: p,
4461
- paddingRight: M,
4462
- paddingBottom: b,
4463
- paddingLeft: A,
4464
- radiusTopLeft: x,
4465
- radiusTopRight: v,
4466
- radiusBottomRight: S,
4467
- radiusBottomLeft: L
4468
- }, B), H = new Gt(e, F);
4469
- if (H.textCaseRaw = (R = H.text) != null ? R : "", r) {
4470
- const N = Kt({ value: H.textCaseRaw });
4471
- N !== H.text && H.set({ text: N });
4472
- }
4473
- return B.left === void 0 && B.top === void 0 && X.centerObject(H), z || X.add(H), I || X.setActiveObject(H), X.requestRenderAll(), V.resumeHistory(), _ || V.saveState(), X.fire("editor:text-added", {
4474
- textbox: H,
4475
- options: Tt(k({}, F), {
4476
+ backgroundOpacity: p,
4477
+ paddingTop: v,
4478
+ paddingRight: b,
4479
+ paddingBottom: A,
4480
+ paddingLeft: y,
4481
+ radiusTopLeft: j,
4482
+ radiusTopRight: M,
4483
+ radiusBottomRight: w,
4484
+ radiusBottomLeft: S
4485
+ }, C), X = new Xt(e, Z);
4486
+ if (X.textCaseRaw = (P = X.text) != null ? P : "", r) {
4487
+ const B = Qt({ value: X.textCaseRaw });
4488
+ B !== X.text && X.set({ text: B });
4489
+ }
4490
+ return C.left === void 0 && C.top === void 0 && G.centerObject(X), _ || G.add(X), I || G.setActiveObject(X), G.requestRenderAll(), W.resumeHistory(), O || W.saveState(), G.fire("editor:text-added", {
4491
+ textbox: X,
4492
+ options: pt(x({}, Z), {
4476
4493
  text: e,
4477
4494
  bold: n,
4478
4495
  italic: i,
4479
4496
  strikethrough: c,
4480
- align: h,
4481
- color: l,
4482
- strokeColor: Y,
4483
- strokeWidth: T
4497
+ align: l,
4498
+ color: h,
4499
+ strokeColor: U,
4500
+ strokeWidth: N
4484
4501
  }),
4485
4502
  flags: {
4486
4503
  withoutSelection: !!I,
4487
- withoutSave: !!_,
4488
- withoutAdding: !!z
4504
+ withoutSave: !!O,
4505
+ withoutAdding: !!_
4489
4506
  }
4490
- }), H;
4507
+ }), X;
4491
4508
  }
4492
4509
  /**
4493
4510
  * Обновляет текстовый объект.
@@ -4498,36 +4515,36 @@ class Q {
4498
4515
  * @param options.skipRender — не вызывать перерисовку канваса
4499
4516
  */
4500
4517
  updateText({ target: t, style: e = {}, withoutSave: s, skipRender: o } = {}) {
4501
- var St, nt, J, It, Ct, Et;
4518
+ var Ct, nt, J, Tt, Et, Ot;
4502
4519
  const n = this._resolveTextObject(t);
4503
4520
  if (!n) return null;
4504
4521
  const { historyManager: i } = this.editor, { canvas: a } = this;
4505
4522
  i.suspendHistory();
4506
4523
  const r = Q._getSnapshot(n), ot = e, {
4507
4524
  text: c,
4508
- fontFamily: h,
4509
- fontSize: l,
4525
+ fontFamily: l,
4526
+ fontSize: h,
4510
4527
  bold: u,
4511
4528
  italic: g,
4512
4529
  underline: f,
4513
4530
  uppercase: m,
4514
- strikethrough: y,
4515
- align: p,
4516
- color: M,
4517
- strokeColor: b,
4518
- strokeWidth: A,
4519
- opacity: x,
4520
- backgroundColor: v,
4521
- backgroundOpacity: S,
4522
- paddingTop: L,
4523
- paddingRight: B,
4531
+ strikethrough: p,
4532
+ align: v,
4533
+ color: b,
4534
+ strokeColor: A,
4535
+ strokeWidth: y,
4536
+ opacity: j,
4537
+ backgroundColor: M,
4538
+ backgroundOpacity: w,
4539
+ paddingTop: S,
4540
+ paddingRight: C,
4524
4541
  paddingBottom: I,
4525
- paddingLeft: _,
4526
- radiusTopLeft: z,
4527
- radiusTopRight: G,
4528
- radiusBottomRight: Z,
4529
- radiusBottomLeft: V
4530
- } = ot, X = rt(ot, [
4542
+ paddingLeft: O,
4543
+ radiusTopLeft: _,
4544
+ radiusTopRight: H,
4545
+ radiusBottomRight: Y,
4546
+ radiusBottomLeft: W
4547
+ } = ot, G = rt(ot, [
4531
4548
  "text",
4532
4549
  "fontFamily",
4533
4550
  "fontSize",
@@ -4551,37 +4568,37 @@ class Q {
4551
4568
  "radiusTopRight",
4552
4569
  "radiusBottomRight",
4553
4570
  "radiusBottomLeft"
4554
- ]), C = k({}, X), T = Ls({ textbox: n }), Y = {}, F = {}, H = ks({ textbox: n, range: T }), R = !T || H, N = !T;
4555
- if (h !== void 0 && (T && (Y.fontFamily = h), R && (C.fontFamily = h, N && (F.fontFamily = h))), l !== void 0 && (C.fontSize = l), u !== void 0) {
4556
- const W = u ? "bold" : "normal";
4557
- T && (Y.fontWeight = W), R && (C.fontWeight = W, N && (F.fontWeight = W));
4571
+ ]), D = x({}, G), N = zs({ textbox: n }), U = {}, Z = {}, X = Ys({ textbox: n, range: N }), P = !N || X, B = !N;
4572
+ if (l !== void 0 && (N && (U.fontFamily = l), P && (D.fontFamily = l, B && (Z.fontFamily = l))), h !== void 0 && (D.fontSize = h), u !== void 0) {
4573
+ const V = u ? "bold" : "normal";
4574
+ N && (U.fontWeight = V), P && (D.fontWeight = V, B && (Z.fontWeight = V));
4558
4575
  }
4559
4576
  if (g !== void 0) {
4560
- const W = g ? "italic" : "normal";
4561
- T && (Y.fontStyle = W), R && (C.fontStyle = W, N && (F.fontStyle = W));
4577
+ const V = g ? "italic" : "normal";
4578
+ N && (U.fontStyle = V), P && (D.fontStyle = V, B && (Z.fontStyle = V));
4562
4579
  }
4563
- if (f !== void 0 && (T && (Y.underline = f), R && (C.underline = f, N && (F.underline = f))), y !== void 0 && (T && (Y.linethrough = y), R && (C.linethrough = y, N && (F.linethrough = y))), p !== void 0 && (C.textAlign = p), M !== void 0 && (T && (Y.fill = M), R && (C.fill = M, N && (F.fill = M))), b !== void 0 || A !== void 0) {
4564
- const W = T ? Oe({ textbox: n, range: T, property: "strokeWidth" }) : void 0, Bt = T ? Oe({ textbox: n, range: T, property: "stroke" }) : void 0, _t = (nt = (St = A != null ? A : W) != null ? St : n.strokeWidth) != null ? nt : 0, at = Le({ width: _t }), Ut = (It = (J = b != null ? b : Bt) != null ? J : n.stroke) != null ? It : void 0, ft = De({
4565
- strokeColor: Ut,
4580
+ if (f !== void 0 && (N && (U.underline = f), P && (D.underline = f, B && (Z.underline = f))), p !== void 0 && (N && (U.linethrough = p), P && (D.linethrough = p, B && (Z.linethrough = p))), v !== void 0 && (D.textAlign = v), b !== void 0 && (N && (U.fill = b), P && (D.fill = b, B && (Z.fill = b))), A !== void 0 || y !== void 0) {
4581
+ const V = N ? Le({ textbox: n, range: N, property: "strokeWidth" }) : void 0, _t = N ? Le({ textbox: n, range: N, property: "stroke" }) : void 0, Pt = (nt = (Ct = y != null ? y : V) != null ? Ct : n.strokeWidth) != null ? nt : 0, at = Re({ width: Pt }), zt = (Tt = (J = A != null ? A : _t) != null ? J : n.stroke) != null ? Tt : void 0, ft = Ne({
4582
+ strokeColor: zt,
4566
4583
  width: at
4567
4584
  });
4568
- T && (Y.stroke = ft, Y.strokeWidth = at), R && (C.stroke = ft, C.strokeWidth = at, N && (F.stroke = ft, F.strokeWidth = at));
4569
- }
4570
- x !== void 0 && (C.opacity = x), v !== void 0 && (C.backgroundColor = v), S !== void 0 && (C.backgroundOpacity = S), L !== void 0 && (C.paddingTop = L), B !== void 0 && (C.paddingRight = B), I !== void 0 && (C.paddingBottom = I), _ !== void 0 && (C.paddingLeft = _), z !== void 0 && (C.radiusTopLeft = z), G !== void 0 && (C.radiusTopRight = G), Z !== void 0 && (C.radiusBottomRight = Z), V !== void 0 && (C.radiusBottomLeft = V);
4571
- const jt = (Et = n.textCaseRaw) != null ? Et : (Ct = n.text) != null ? Ct : "", kt = !!n.uppercase, Rt = c !== void 0, ut = Rt ? c != null ? c : "" : jt, At = m != null ? m : kt;
4572
- if (Rt || At !== kt) {
4573
- const W = At ? Kt({ value: ut }) : ut;
4574
- C.text = W, n.textCaseRaw = ut;
4575
- } else n.textCaseRaw === void 0 && (n.textCaseRaw = jt);
4576
- n.uppercase = At, n.set(C);
4585
+ N && (U.stroke = ft, U.strokeWidth = at), P && (D.stroke = ft, D.strokeWidth = at, B && (Z.stroke = ft, Z.strokeWidth = at));
4586
+ }
4587
+ j !== void 0 && (D.opacity = j), M !== void 0 && (D.backgroundColor = M), w !== void 0 && (D.backgroundOpacity = w), S !== void 0 && (D.paddingTop = S), C !== void 0 && (D.paddingRight = C), I !== void 0 && (D.paddingBottom = I), O !== void 0 && (D.paddingLeft = O), _ !== void 0 && (D.radiusTopLeft = _), H !== void 0 && (D.radiusTopRight = H), Y !== void 0 && (D.radiusBottomRight = Y), W !== void 0 && (D.radiusBottomLeft = W);
4588
+ const At = (Ot = n.textCaseRaw) != null ? Ot : (Et = n.text) != null ? Et : "", kt = !!n.uppercase, Bt = c !== void 0, ut = Bt ? c != null ? c : "" : At, It = m != null ? m : kt;
4589
+ if (Bt || It !== kt) {
4590
+ const V = It ? Qt({ value: ut }) : ut;
4591
+ D.text = V, n.textCaseRaw = ut;
4592
+ } else n.textCaseRaw === void 0 && (n.textCaseRaw = At);
4593
+ n.uppercase = It, n.set(D);
4577
4594
  let gt = !1;
4578
- if (T)
4579
- gt = Te({ textbox: n, styles: Y, range: T });
4580
- else if (Object.keys(F).length) {
4581
- const W = Ns({ textbox: n });
4582
- W && (gt = Te({ textbox: n, styles: F, range: W }));
4595
+ if (N)
4596
+ gt = De({ textbox: n, styles: U, range: N });
4597
+ else if (Object.keys(Z).length) {
4598
+ const V = Us({ textbox: n });
4599
+ V && (gt = De({ textbox: n, styles: Z, range: V }));
4583
4600
  }
4584
- gt && (n.dirty = !0), (v !== void 0 || S !== void 0 || L !== void 0 || B !== void 0 || I !== void 0 || _ !== void 0 || z !== void 0 || G !== void 0 || Z !== void 0 || V !== void 0) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4601
+ gt && (n.dirty = !0), (M !== void 0 || w !== void 0 || S !== void 0 || C !== void 0 || I !== void 0 || O !== void 0 || _ !== void 0 || H !== void 0 || Y !== void 0 || W !== void 0) && (n.dirty = !0), n.setCoords(), o || a.requestRenderAll(), i.resumeHistory(), s || i.saveState();
4585
4602
  const xt = Q._getSnapshot(n);
4586
4603
  return a.fire("editor:text-updated", {
4587
4604
  textbox: n,
@@ -4591,11 +4608,11 @@ class Q {
4591
4608
  withoutSave: !!s,
4592
4609
  skipRender: !!o
4593
4610
  },
4594
- updates: C,
4611
+ updates: D,
4595
4612
  before: r,
4596
4613
  after: xt,
4597
- selectionRange: T != null ? T : void 0,
4598
- selectionStyles: T && Object.keys(Y).length ? Y : void 0
4614
+ selectionRange: N != null ? N : void 0,
4615
+ selectionStyles: N && Object.keys(U).length ? U : void 0
4599
4616
  }), n;
4600
4617
  }
4601
4618
  /**
@@ -4643,7 +4660,7 @@ class Q {
4643
4660
  if (!Q._isTextbox(e)) return;
4644
4661
  const s = (i = e.text) != null ? i : "", o = !!e.uppercase, n = s.toLocaleLowerCase();
4645
4662
  if (o) {
4646
- const a = Kt({ value: n });
4663
+ const a = Qt({ value: n });
4647
4664
  a !== s && e.set({ text: a }), e.textCaseRaw = n;
4648
4665
  return;
4649
4666
  }
@@ -4658,14 +4675,14 @@ class Q {
4658
4675
  if (!e) {
4659
4676
  const i = (s = t.width) != null ? s : t.calcTextWidth(), a = (o = t.left) != null ? o : 0, r = (n = t.fontSize) != null ? n : 16, {
4660
4677
  paddingTop: c = 0,
4661
- paddingRight: h = 0,
4662
- paddingBottom: l = 0,
4678
+ paddingRight: l = 0,
4679
+ paddingBottom: h = 0,
4663
4680
  paddingLeft: u = 0
4664
4681
  } = t, {
4665
4682
  radiusTopLeft: g = 0,
4666
4683
  radiusTopRight: f = 0,
4667
4684
  radiusBottomRight: m = 0,
4668
- radiusBottomLeft: y = 0
4685
+ radiusBottomLeft: p = 0
4669
4686
  } = t;
4670
4687
  e = {
4671
4688
  baseWidth: i,
@@ -4673,15 +4690,15 @@ class Q {
4673
4690
  baseLeft: a,
4674
4691
  basePadding: {
4675
4692
  top: c,
4676
- right: h,
4677
- bottom: l,
4693
+ right: l,
4694
+ bottom: h,
4678
4695
  left: u
4679
4696
  },
4680
4697
  baseRadii: {
4681
4698
  topLeft: g,
4682
4699
  topRight: f,
4683
4700
  bottomRight: m,
4684
- bottomLeft: y
4701
+ bottomLeft: p
4685
4702
  },
4686
4703
  hasWidthChange: !1
4687
4704
  }, this.scalingState.set(t, e);
@@ -4693,11 +4710,11 @@ class Q {
4693
4710
  */
4694
4711
  static _getSnapshot(t) {
4695
4712
  const e = ({
4696
- snapshot: F,
4697
- entries: H
4713
+ snapshot: Z,
4714
+ entries: X
4698
4715
  }) => {
4699
- Object.entries(H).forEach(([R, N]) => {
4700
- N != null && (F[R] = N);
4716
+ Object.entries(X).forEach(([P, B]) => {
4717
+ B != null && (Z[P] = B);
4701
4718
  });
4702
4719
  }, {
4703
4720
  id: s,
@@ -4707,70 +4724,70 @@ class Q {
4707
4724
  fontFamily: a,
4708
4725
  fontSize: r,
4709
4726
  fontWeight: c,
4710
- fontStyle: h,
4711
- underline: l,
4727
+ fontStyle: l,
4728
+ underline: h,
4712
4729
  linethrough: u,
4713
4730
  textAlign: g,
4714
4731
  fill: f,
4715
4732
  stroke: m,
4716
- strokeWidth: y,
4717
- opacity: p,
4718
- backgroundColor: M,
4719
- backgroundOpacity: b,
4720
- paddingTop: A,
4721
- paddingRight: x,
4722
- paddingBottom: v,
4723
- paddingLeft: S,
4724
- radiusTopLeft: L,
4725
- radiusTopRight: B,
4733
+ strokeWidth: p,
4734
+ opacity: v,
4735
+ backgroundColor: b,
4736
+ backgroundOpacity: A,
4737
+ paddingTop: y,
4738
+ paddingRight: j,
4739
+ paddingBottom: M,
4740
+ paddingLeft: w,
4741
+ radiusTopLeft: S,
4742
+ radiusTopRight: C,
4726
4743
  radiusBottomRight: I,
4727
- radiusBottomLeft: _,
4728
- left: z,
4729
- top: G,
4730
- width: Z,
4731
- height: V,
4732
- angle: X,
4733
- scaleX: C,
4734
- scaleY: T
4735
- } = t, Y = {
4744
+ radiusBottomLeft: O,
4745
+ left: _,
4746
+ top: H,
4747
+ width: Y,
4748
+ height: W,
4749
+ angle: G,
4750
+ scaleX: D,
4751
+ scaleY: N
4752
+ } = t, U = {
4736
4753
  id: s,
4737
4754
  uppercase: !!i,
4738
4755
  textAlign: g
4739
4756
  };
4740
4757
  return e({
4741
- snapshot: Y,
4758
+ snapshot: U,
4742
4759
  entries: {
4743
4760
  text: o,
4744
4761
  textCaseRaw: n,
4745
4762
  fontFamily: a,
4746
4763
  fontSize: r,
4747
4764
  fontWeight: c,
4748
- fontStyle: h,
4749
- underline: l,
4765
+ fontStyle: l,
4766
+ underline: h,
4750
4767
  linethrough: u,
4751
4768
  fill: f,
4752
4769
  stroke: m,
4753
- strokeWidth: y,
4754
- opacity: p,
4755
- backgroundColor: M,
4756
- backgroundOpacity: b,
4757
- paddingTop: A,
4758
- paddingRight: x,
4759
- paddingBottom: v,
4760
- paddingLeft: S,
4761
- radiusTopLeft: L,
4762
- radiusTopRight: B,
4770
+ strokeWidth: p,
4771
+ opacity: v,
4772
+ backgroundColor: b,
4773
+ backgroundOpacity: A,
4774
+ paddingTop: y,
4775
+ paddingRight: j,
4776
+ paddingBottom: M,
4777
+ paddingLeft: w,
4778
+ radiusTopLeft: S,
4779
+ radiusTopRight: C,
4763
4780
  radiusBottomRight: I,
4764
- radiusBottomLeft: _,
4765
- left: z,
4766
- top: G,
4767
- width: Z,
4768
- height: V,
4769
- angle: X,
4770
- scaleX: C,
4771
- scaleY: T
4781
+ radiusBottomLeft: O,
4782
+ left: _,
4783
+ top: H,
4784
+ width: Y,
4785
+ height: W,
4786
+ angle: G,
4787
+ scaleX: D,
4788
+ scaleY: N
4772
4789
  }
4773
- }), Y;
4790
+ }), U;
4774
4791
  }
4775
4792
  /**
4776
4793
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -4783,14 +4800,14 @@ class Q {
4783
4800
  const $ = ({
4784
4801
  value: d,
4785
4802
  fallback: t = 0
4786
- }) => typeof d == "number" && Number.isFinite(d) ? d : typeof t == "number" && Number.isFinite(t) ? t : 0, Ft = ({
4803
+ }) => typeof d == "number" && Number.isFinite(d) ? d : typeof t == "number" && Number.isFinite(t) ? t : 0, Wt = ({
4787
4804
  value: d,
4788
4805
  dimension: t,
4789
4806
  useRelativePositions: e
4790
4807
  }) => {
4791
4808
  const s = $({ value: d });
4792
4809
  return e ? s : s / (t || 1);
4793
- }, Rs = ({
4810
+ }, Fs = ({
4794
4811
  object: d,
4795
4812
  baseWidth: t,
4796
4813
  baseHeight: e,
@@ -4800,31 +4817,31 @@ const $ = ({
4800
4817
  const n = d;
4801
4818
  if (typeof n[o.x] == "number" && typeof n[o.y] == "number")
4802
4819
  return {
4803
- x: Ft({
4820
+ x: Wt({
4804
4821
  value: n[o.x],
4805
4822
  dimension: t,
4806
4823
  useRelativePositions: s
4807
4824
  }),
4808
- y: Ft({
4825
+ y: Wt({
4809
4826
  value: n[o.y],
4810
4827
  dimension: e,
4811
4828
  useRelativePositions: s
4812
4829
  })
4813
4830
  };
4814
- const { left: a, top: r, width: c, height: h } = d, l = Ft({
4831
+ const { left: a, top: r, width: c, height: l } = d, h = Wt({
4815
4832
  value: a,
4816
4833
  dimension: t,
4817
4834
  useRelativePositions: s
4818
- }), u = Ft({
4835
+ }), u = Wt({
4819
4836
  value: r,
4820
4837
  dimension: e,
4821
4838
  useRelativePositions: s
4822
- }), g = $({ value: c }) / (t || 1), f = $({ value: h }) / (e || 1);
4839
+ }), g = $({ value: c }) / (t || 1), f = $({ value: l }) / (e || 1);
4823
4840
  return {
4824
- x: l + g / 2,
4841
+ x: h + g / 2,
4825
4842
  y: u + f / 2
4826
4843
  };
4827
- }, xs = ({
4844
+ }, Ws = ({
4828
4845
  normalizedX: d,
4829
4846
  normalizedY: t,
4830
4847
  bounds: e,
@@ -4833,64 +4850,87 @@ const $ = ({
4833
4850
  }) => {
4834
4851
  const { left: n, top: i, width: a, height: r } = e;
4835
4852
  if (!o) {
4836
- const { width: l, height: u } = s, g = n + d * (l || a), f = i + t * (u || r);
4853
+ const { width: h, height: u } = s, g = n + d * (h || a), f = i + t * (u || r);
4837
4854
  return new ht(g, f);
4838
4855
  }
4839
- const c = n + d * a, h = i + t * r;
4840
- return new ht(c, h);
4841
- }, Bs = ({
4856
+ const c = n + d * a, l = i + t * r;
4857
+ return new ht(c, l);
4858
+ }, Hs = ({
4842
4859
  object: d,
4843
4860
  montageArea: t,
4844
4861
  bounds: e
4845
4862
  }) => {
4846
4863
  if (!t || !e) return null;
4847
4864
  try {
4848
- const s = d.getCenterPoint(), { left: o, top: n, width: i, height: a } = e, r = s.x - o, c = s.y - n, h = r / i, l = c / a;
4865
+ const s = d.getCenterPoint(), { left: o, top: n, width: i, height: a } = e, r = s.x - o, c = s.y - n, l = r / i, h = c / a;
4849
4866
  return {
4850
- x: h,
4851
- y: l
4867
+ x: l,
4868
+ y: h
4852
4869
  };
4853
4870
  } catch (s) {
4854
4871
  return null;
4855
4872
  }
4856
- }, _s = ({
4873
+ }, yt = ({
4874
+ object: d
4875
+ }) => {
4876
+ if (!d) return null;
4877
+ try {
4878
+ d.setCoords();
4879
+ const t = d.getBoundingRect(!1, !0), {
4880
+ left: e = 0,
4881
+ top: s = 0,
4882
+ width: o = 0,
4883
+ height: n = 0
4884
+ } = t, i = e + o, a = s + n, r = e + o / 2, c = s + n / 2;
4885
+ return {
4886
+ left: e,
4887
+ right: i,
4888
+ top: s,
4889
+ bottom: a,
4890
+ centerX: r,
4891
+ centerY: c
4892
+ };
4893
+ } catch (t) {
4894
+ return null;
4895
+ }
4896
+ }, Zs = ({
4857
4897
  x1: d,
4858
4898
  y1: t,
4859
4899
  x2: e,
4860
4900
  y2: s
4861
- }) => (Math.atan2(s - t, e - d) * 180 / Math.PI + 360) % 360, Us = (d) => {
4901
+ }) => (Math.atan2(s - t, e - d) * 180 / Math.PI + 360) % 360, Vs = (d) => {
4862
4902
  if (!d || typeof d != "object") return null;
4863
- const { type: t, coords: e, colorStops: s } = d, 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, h = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0;
4903
+ const { type: t, coords: e, colorStops: s } = d, 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, l = typeof (i == null ? void 0 : i.offset) == "number" ? i.offset * 100 : void 0;
4864
4904
  if (!a || !r || !e) return null;
4865
4905
  if (t === "linear") {
4866
- const { x1: l, y1: u, x2: g, y2: f } = e;
4867
- if (typeof l == "number" && typeof u == "number" && typeof g == "number" && typeof f == "number")
4906
+ const { x1: h, y1: u, x2: g, y2: f } = e;
4907
+ if (typeof h == "number" && typeof u == "number" && typeof g == "number" && typeof f == "number")
4868
4908
  return {
4869
4909
  type: "linear",
4870
- angle: _s({ x1: l, y1: u, x2: g, y2: f }),
4910
+ angle: Zs({ x1: h, y1: u, x2: g, y2: f }),
4871
4911
  startColor: a,
4872
4912
  endColor: r,
4873
4913
  startPosition: c,
4874
- endPosition: h
4914
+ endPosition: l
4875
4915
  };
4876
4916
  }
4877
4917
  if (t === "radial") {
4878
- const { x1: l, y1: u, r2: g } = e;
4879
- if (typeof l == "number" && typeof u == "number" && typeof g == "number")
4918
+ const { x1: h, y1: u, r2: g } = e;
4919
+ if (typeof h == "number" && typeof u == "number" && typeof g == "number")
4880
4920
  return {
4881
4921
  type: "radial",
4882
- centerX: l * 100,
4922
+ centerX: h * 100,
4883
4923
  centerY: u * 100,
4884
4924
  radius: g * 100,
4885
4925
  startColor: a,
4886
4926
  endColor: r,
4887
4927
  startPosition: c,
4888
- endPosition: h
4928
+ endPosition: l
4889
4929
  };
4890
4930
  }
4891
4931
  return null;
4892
- }, Qt = "_templateCenterX", $t = "_templateCenterY", Jt = "_templateAnchorX", qt = "_templateAnchorY";
4893
- class E {
4932
+ }, $t = "_templateCenterX", Jt = "_templateCenterY", qt = "_templateAnchorX", te = "_templateAnchorY";
4933
+ class L {
4894
4934
  constructor({ editor: t }) {
4895
4935
  this.editor = t;
4896
4936
  }
@@ -4909,7 +4949,7 @@ class E {
4909
4949
  montageArea: i,
4910
4950
  errorManager: a,
4911
4951
  backgroundManager: r
4912
- } = this.editor, c = n.getActiveObject(), h = E._collectObjects(c), { backgroundObject: l } = r != null ? r : {}, u = o && l ? [l] : [], g = [...h, ...u];
4952
+ } = this.editor, c = n.getActiveObject(), l = L._collectObjects(c), { backgroundObject: h } = r != null ? r : {}, u = o && h ? [h] : [], g = [...l, ...u];
4913
4953
  if (!g.length)
4914
4954
  return a.emitWarning({
4915
4955
  origin: "TemplateManager",
@@ -4917,22 +4957,22 @@ class E {
4917
4957
  code: ct.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
4918
4958
  message: "Нет объектов для сериализации шаблона"
4919
4959
  }), null;
4920
- const f = E._getBounds(i), m = E._getMontageSize({ montageArea: i, bounds: f }), y = m.width, p = m.height, M = g.map((x) => E._serializeObject({
4921
- object: x,
4960
+ const f = L._getBounds(i), m = L._getMontageSize({ montageArea: i, bounds: f }), p = m.width, v = m.height, b = g.map((j) => L._serializeObject({
4961
+ object: j,
4922
4962
  bounds: f,
4923
- baseWidth: y,
4924
- baseHeight: p,
4963
+ baseWidth: p,
4964
+ baseHeight: v,
4925
4965
  montageArea: i != null ? i : null
4926
- })), b = Tt(k({}, s), {
4927
- baseWidth: y,
4928
- baseHeight: p,
4966
+ })), A = pt(x({}, s), {
4967
+ baseWidth: p,
4968
+ baseHeight: v,
4929
4969
  positionsNormalized: !0,
4930
4970
  previewId: e != null ? e : s.previewId
4931
4971
  });
4932
4972
  return {
4933
- id: t != null ? t : `template-${P()}`,
4934
- meta: b,
4935
- objects: M
4973
+ id: t != null ? t : `template-${F()}`,
4974
+ meta: A,
4975
+ objects: b
4936
4976
  };
4937
4977
  }
4938
4978
  /**
@@ -4942,7 +4982,7 @@ class E {
4942
4982
  * @param options.data - данные для заполнения текстов по customData.templateField
4943
4983
  */
4944
4984
  applyTemplate(s) {
4945
- return O(this, arguments, function* ({
4985
+ return R(this, arguments, function* ({
4946
4986
  template: t,
4947
4987
  data: e
4948
4988
  }) {
@@ -4952,7 +4992,7 @@ class E {
4952
4992
  historyManager: i,
4953
4993
  errorManager: a,
4954
4994
  backgroundManager: r
4955
- } = this.editor, { objects: c, meta: h, id: l } = t != null ? t : {};
4995
+ } = this.editor, { objects: c, meta: l, id: h } = t != null ? t : {};
4956
4996
  if (!(c != null && c.length))
4957
4997
  return a.emitWarning({
4958
4998
  origin: "TemplateManager",
@@ -4960,7 +5000,7 @@ class E {
4960
5000
  code: ct.TEMPLATE_MANAGER.INVALID_TEMPLATE,
4961
5001
  message: "Шаблон не содержит объектов"
4962
5002
  }), null;
4963
- const u = E._getBounds(n);
5003
+ const u = L._getBounds(n);
4964
5004
  if (!u)
4965
5005
  return a.emitWarning({
4966
5006
  origin: "TemplateManager",
@@ -4968,55 +5008,55 @@ class E {
4968
5008
  code: ct.TEMPLATE_MANAGER.INVALID_TARGET,
4969
5009
  message: "Не удалось определить границы монтажной области"
4970
5010
  }), null;
4971
- const g = E._getMontageSize({ montageArea: n, bounds: u }), f = E._normalizeMeta({ meta: h, fallback: g }), m = E._calculateScale({ meta: f, target: g }), y = !!f.positionsNormalized;
4972
- let p = !1, M = !1;
5011
+ const g = L._getMontageSize({ montageArea: n, bounds: u }), f = L._normalizeMeta({ meta: l, fallback: g }), m = L._calculateScale({ meta: f, target: g }), p = !!f.positionsNormalized;
5012
+ let v = !1, b = !1;
4973
5013
  i.suspendHistory();
4974
5014
  try {
4975
- const b = yield E._enlivenObjects(c);
4976
- if (!b.length)
5015
+ const A = yield L._enlivenObjects(c);
5016
+ if (!A.length)
4977
5017
  return a.emitWarning({
4978
5018
  origin: "TemplateManager",
4979
5019
  method: "applyTemplate",
4980
5020
  code: ct.TEMPLATE_MANAGER.INVALID_TEMPLATE,
4981
5021
  message: "Не удалось создать объекты шаблона"
4982
5022
  }), null;
4983
- const { backgroundObject: A, contentObjects: x } = E._extractBackgroundObject(b);
4984
- A && (M = yield E._applyBackgroundFromObject({
4985
- backgroundObject: A,
5023
+ const { backgroundObject: y, contentObjects: j } = L._extractBackgroundObject(A);
5024
+ y && (b = yield L._applyBackgroundFromObject({
5025
+ backgroundObject: y,
4986
5026
  backgroundManager: r,
4987
5027
  errorManager: a
4988
5028
  }));
4989
- const v = x.map((S) => (E._applyTextOverrides({ object: S, data: e }), E._transformObject({
4990
- object: S,
5029
+ const M = j.map((w) => (L._applyTextOverrides({ object: w, data: e }), L._transformObject({
5030
+ object: w,
4991
5031
  scale: m,
4992
5032
  bounds: u,
4993
5033
  targetSize: g,
4994
5034
  baseWidth: f.baseWidth,
4995
5035
  baseHeight: f.baseHeight,
4996
5036
  montageArea: n,
4997
- useRelativePositions: y
4998
- }), S.set({
4999
- id: `${S.type}-${P()}`,
5037
+ useRelativePositions: p
5038
+ }), w.set({
5039
+ id: `${w.type}-${F()}`,
5000
5040
  evented: !0
5001
- }), o.add(S), S));
5002
- return !v.length && !M ? null : (p = v.length > 0 || M, v.length && E._activateObjects({ canvas: o, objects: v }), o.requestRenderAll(), o.fire("editor:template-applied", {
5041
+ }), o.add(w), w));
5042
+ return !M.length && !b ? null : (v = M.length > 0 || b, M.length && L._activateObjects({ canvas: o, objects: M }), o.requestRenderAll(), o.fire("editor:template-applied", {
5003
5043
  template: t,
5004
- objects: v,
5044
+ objects: M,
5005
5045
  bounds: u
5006
- }), v);
5007
- } catch (b) {
5046
+ }), M);
5047
+ } catch (A) {
5008
5048
  return a.emitError({
5009
5049
  origin: "TemplateManager",
5010
5050
  method: "applyTemplate",
5011
5051
  code: ct.TEMPLATE_MANAGER.APPLY_FAILED,
5012
5052
  message: "Ошибка применения шаблона",
5013
5053
  data: {
5014
- templateId: l,
5015
- error: b
5054
+ templateId: h,
5055
+ error: A
5016
5056
  }
5017
5057
  }), null;
5018
5058
  } finally {
5019
- i.resumeHistory(), p && i.saveState();
5059
+ i.resumeHistory(), v && i.saveState();
5020
5060
  }
5021
5061
  });
5022
5062
  }
@@ -5024,7 +5064,7 @@ class E {
5024
5064
  * Подготавливает объекты для сериализации.
5025
5065
  */
5026
5066
  static _collectObjects(t) {
5027
- return t ? t instanceof U ? t.getObjects() : [t] : [];
5067
+ return t ? t instanceof z ? t.getObjects() : [t] : [];
5028
5068
  }
5029
5069
  /**
5030
5070
  * Возвращает габариты объекта.
@@ -5048,15 +5088,15 @@ class E {
5048
5088
  * Превращает plain-описание объектов в Fabric объекты.
5049
5089
  */
5050
5090
  static _enlivenObjects(t) {
5051
- return O(this, null, function* () {
5052
- return (yield Promise.all(t.map((s) => O(null, null, function* () {
5053
- if (E._hasSerializedSvgMarkup(s)) {
5054
- const i = yield E._reviveSvgObject(s);
5091
+ return R(this, null, function* () {
5092
+ return (yield Promise.all(t.map((s) => R(null, null, function* () {
5093
+ if (L._hasSerializedSvgMarkup(s)) {
5094
+ const i = yield L._reviveSvgObject(s);
5055
5095
  if (i)
5056
- return E._restoreImageScale({ revived: i, serialized: s }), i;
5096
+ return L._restoreImageScale({ revived: i, serialized: s }), i;
5057
5097
  }
5058
5098
  const o = yield it.enlivenObjects([s]), n = o == null ? void 0 : o[0];
5059
- return n ? (E._restoreImageScale({ revived: n, serialized: s }), n) : null;
5099
+ return n ? (L._restoreImageScale({ revived: n, serialized: s }), n) : null;
5060
5100
  })))).filter((s) => !!s);
5061
5101
  });
5062
5102
  }
@@ -5074,8 +5114,8 @@ class E {
5074
5114
  scaleX: i,
5075
5115
  scaleY: a
5076
5116
  } = e, r = t, c = "getElement" in r && typeof r.getElement == "function" ? r.getElement() : null, {
5077
- naturalWidth: h = 0,
5078
- naturalHeight: l = 0,
5117
+ naturalWidth: l = 0,
5118
+ naturalHeight: h = 0,
5079
5119
  width: u = 0,
5080
5120
  height: g = 0
5081
5121
  } = c instanceof HTMLImageElement ? c : {
@@ -5083,8 +5123,8 @@ class E {
5083
5123
  naturalHeight: 0,
5084
5124
  width: 0,
5085
5125
  height: 0
5086
- }, f = $({ value: h || u || r.width, fallback: 0 }), m = $({ value: l || g || r.height, fallback: 0 }), y = $({ value: o, fallback: f }), p = $({ value: n, fallback: m }), M = $({ value: i, fallback: r.scaleX || 1 }), b = $({ value: a, fallback: r.scaleY || 1 }), A = y * M, x = p * b, v = f ? A / f : null, S = m ? x / m : null, L = {};
5087
- f > 0 && (L.width = f), m > 0 && (L.height = m), v && v > 0 && (L.scaleX = v), S && S > 0 && (L.scaleY = S), r.set(L);
5126
+ }, f = $({ value: l || u || r.width, fallback: 0 }), m = $({ value: h || g || r.height, fallback: 0 }), p = $({ value: o, fallback: f }), v = $({ value: n, fallback: m }), b = $({ value: i, fallback: r.scaleX || 1 }), A = $({ value: a, fallback: r.scaleY || 1 }), y = p * b, j = v * A, M = f ? y / f : null, w = m ? j / m : null, S = {};
5127
+ f > 0 && (S.width = f), m > 0 && (S.height = m), M && M > 0 && (S.scaleX = M), w && w > 0 && (S.scaleY = w), r.set(S);
5088
5128
  }
5089
5129
  /**
5090
5130
  * Проверяет, содержит ли сериализованный объект инлайн SVG.
@@ -5096,11 +5136,11 @@ class E {
5096
5136
  * Восстанавливает SVG-объект из компактного описания.
5097
5137
  */
5098
5138
  static _reviveSvgObject(t) {
5099
- return O(this, null, function* () {
5139
+ return R(this, null, function* () {
5100
5140
  const e = typeof t.svgMarkup == "string" ? t.svgMarkup : null;
5101
5141
  if (!e) return null;
5102
5142
  try {
5103
- const s = yield Fe(e), o = it.groupSVGElements(s.objects, s.options), n = E._prepareSerializableProps(t), i = yield E._reviveClipPath(n.clipPath);
5143
+ const s = yield Qe(e), o = it.groupSVGElements(s.objects, s.options), n = L._prepareSerializableProps(t), i = yield L._reviveClipPath(n.clipPath);
5104
5144
  return i ? n.clipPath = i : "clipPath" in n && delete n.clipPath, o.set(n), o.setCoords(), o;
5105
5145
  } catch (s) {
5106
5146
  return null;
@@ -5111,7 +5151,7 @@ class E {
5111
5151
  * Восстанавливает clipPath из сериализованного объекта в инстанс FabricObject.
5112
5152
  */
5113
5153
  static _reviveClipPath(t) {
5114
- return O(this, null, function* () {
5154
+ return R(this, null, function* () {
5115
5155
  var e;
5116
5156
  if (!t || typeof t != "object") return null;
5117
5157
  try {
@@ -5126,7 +5166,7 @@ class E {
5126
5166
  * Убирает технические поля сериализации, оставляя только применимые свойства.
5127
5167
  */
5128
5168
  static _prepareSerializableProps(t) {
5129
- const e = k({}, t);
5169
+ const e = x({}, t);
5130
5170
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
5131
5171
  }
5132
5172
  /**
@@ -5172,34 +5212,34 @@ class E {
5172
5212
  montageArea: a,
5173
5213
  useRelativePositions: r
5174
5214
  }) {
5175
- const c = t, { x: h, y: l } = Rs({
5215
+ const c = t, { x: l, y: h } = Fs({
5176
5216
  object: t,
5177
5217
  baseWidth: n,
5178
5218
  baseHeight: i,
5179
5219
  useRelativePositions: r,
5180
5220
  centerKeys: {
5181
- x: Qt,
5182
- y: $t
5221
+ x: $t,
5222
+ y: Jt
5183
5223
  }
5184
- }), { scaleX: u, scaleY: g } = t, f = $({ value: u, fallback: 1 }), m = $({ value: g, fallback: 1 }), y = E._getPositioningBounds({
5224
+ }), { scaleX: u, scaleY: g } = t, f = $({ value: u, fallback: 1 }), m = $({ value: g, fallback: 1 }), p = L._getPositioningBounds({
5185
5225
  bounds: s,
5186
5226
  baseWidth: n,
5187
5227
  baseHeight: i,
5188
5228
  scale: e,
5189
5229
  useRelativePositions: r,
5190
- anchorX: E._resolveAnchor(c, Jt),
5191
- anchorY: E._resolveAnchor(c, qt)
5192
- }), p = xs({
5193
- normalizedX: h,
5194
- normalizedY: l,
5195
- bounds: y,
5230
+ anchorX: L._resolveAnchor(c, qt),
5231
+ anchorY: L._resolveAnchor(c, te)
5232
+ }), v = Ws({
5233
+ normalizedX: l,
5234
+ normalizedY: h,
5235
+ bounds: p,
5196
5236
  targetSize: o,
5197
5237
  montageArea: a
5198
- }), M = f * e, b = m * e;
5238
+ }), b = f * e, A = m * e;
5199
5239
  t.set({
5200
- scaleX: M,
5201
- scaleY: b
5202
- }), t.setPositionByOrigin(p, "center", "center"), t.setCoords(), delete c[Qt], delete c[$t], delete c[Jt], delete c[qt];
5240
+ scaleX: b,
5241
+ scaleY: A
5242
+ }), t.setPositionByOrigin(v, "center", "center"), t.setCoords(), delete c[$t], delete c[Jt], delete c[qt], delete c[te];
5203
5243
  }
5204
5244
  /**
5205
5245
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -5215,7 +5255,7 @@ class E {
5215
5255
  anchorY: a
5216
5256
  }) {
5217
5257
  if (!n) return t;
5218
- const r = (e || t.width) * o, c = (s || t.height) * o, h = t.width - r, l = t.height - c, u = t.left + E._calculateAnchorOffset(i, h), g = t.top + E._calculateAnchorOffset(a, l);
5258
+ const r = (e || t.width) * o, c = (s || t.height) * o, l = t.width - r, h = t.height - c, u = t.left + L._calculateAnchorOffset(i, l), g = t.top + L._calculateAnchorOffset(a, h);
5219
5259
  return {
5220
5260
  left: u,
5221
5261
  top: g,
@@ -5239,8 +5279,8 @@ class E {
5239
5279
  return a >= 0.98 ? "center" : r <= c ? "start" : "end";
5240
5280
  if (s || n) return "start";
5241
5281
  if (o || i) return "end";
5242
- const h = r - c;
5243
- return Math.abs(h) <= 0.1 ? "center" : h < 0 ? "start" : "end";
5282
+ const l = r - c;
5283
+ return Math.abs(l) <= 0.1 ? "center" : l < 0 ? "start" : "end";
5244
5284
  }
5245
5285
  /**
5246
5286
  * Нормализует мета-данные шаблона.
@@ -5250,7 +5290,7 @@ class E {
5250
5290
  fallback: e
5251
5291
  }) {
5252
5292
  const { width: s, height: o } = e, r = t || {}, { baseWidth: n = s, baseHeight: i = o } = r, a = rt(r, ["baseWidth", "baseHeight"]);
5253
- return k({
5293
+ return x({
5254
5294
  baseWidth: n,
5255
5295
  baseHeight: i
5256
5296
  }, a);
@@ -5277,7 +5317,7 @@ class E {
5277
5317
  t.setActiveObject(e[0]);
5278
5318
  return;
5279
5319
  }
5280
- const s = new U(e, { canvas: t });
5320
+ const s = new z(e, { canvas: t });
5281
5321
  t.setActiveObject(s);
5282
5322
  }
5283
5323
  /**
@@ -5301,37 +5341,37 @@ class E {
5301
5341
  baseHeight: o,
5302
5342
  montageArea: n
5303
5343
  }) {
5304
- const i = t.toDatalessObject([...ke]);
5305
- if (E._isSvgObject(t)) {
5306
- const A = E._extractSvgMarkup(t);
5307
- A && (i.svgMarkup = A, delete i.objects, delete i.path);
5344
+ const i = t.toDatalessObject([...ze]);
5345
+ if (L._isSvgObject(t)) {
5346
+ const y = L._extractSvgMarkup(t);
5347
+ y && (i.svgMarkup = y, delete i.objects, delete i.path);
5308
5348
  }
5309
5349
  if (!e) return i;
5310
5350
  const {
5311
5351
  left: a,
5312
5352
  top: r,
5313
5353
  width: c,
5314
- height: h
5315
- } = e, l = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || h || 1, f = Bs({
5354
+ height: l
5355
+ } = e, h = t.getBoundingRect(!1, !0), u = s || c || 1, g = o || l || 1, f = Hs({
5316
5356
  object: t,
5317
5357
  montageArea: n,
5318
5358
  bounds: e
5319
5359
  }), m = f != null ? f : (() => {
5320
- const A = t.getCenterPoint();
5360
+ const y = t.getCenterPoint();
5321
5361
  return {
5322
- x: (A.x - a) / u,
5323
- y: (A.y - r) / g
5362
+ x: (y.x - a) / u,
5363
+ y: (y.y - r) / g
5324
5364
  };
5325
- })(), y = (l.left - a) / u, p = (l.top - r) / g, M = y + l.width / u, b = p + l.height / g;
5326
- return i[Qt] = m.x, i[$t] = m.y, i[Jt] = E._detectAnchor({
5365
+ })(), p = (h.left - a) / u, v = (h.top - r) / g, b = p + h.width / u, A = v + h.height / g;
5366
+ return i[$t] = m.x, i[Jt] = m.y, i[qt] = L._detectAnchor({
5327
5367
  center: m.x,
5328
- start: y,
5329
- end: M
5330
- }), i[qt] = E._detectAnchor({
5331
- center: m.y,
5332
5368
  start: p,
5333
5369
  end: b
5334
- }), i.left = y, i.top = p, i;
5370
+ }), i[te] = L._detectAnchor({
5371
+ center: m.y,
5372
+ start: v,
5373
+ end: A
5374
+ }), i.left = p, i.top = v, i;
5335
5375
  }
5336
5376
  /**
5337
5377
  * Делит список объектов на фон и контент по id === 'background'.
@@ -5347,13 +5387,13 @@ class E {
5347
5387
  * Применяет фоновый объект шаблона к текущему холсту через BackgroundManager.
5348
5388
  */
5349
5389
  static _applyBackgroundFromObject(o) {
5350
- return O(this, arguments, function* ({
5390
+ return R(this, arguments, function* ({
5351
5391
  backgroundObject: t,
5352
5392
  backgroundManager: e,
5353
5393
  errorManager: s
5354
5394
  }) {
5355
5395
  try {
5356
- const { fill: n, customData: i } = t, { backgroundType: a } = t, r = E._cloneCustomData(i);
5396
+ const { fill: n, customData: i } = t, { backgroundType: a } = t, r = L._cloneCustomData(i);
5357
5397
  if (a === "color" && typeof n == "string")
5358
5398
  return e.setColorBackground({
5359
5399
  color: n,
@@ -5361,7 +5401,7 @@ class E {
5361
5401
  withoutSave: !0
5362
5402
  }), !0;
5363
5403
  if (a === "gradient") {
5364
- const c = Us(n);
5404
+ const c = Vs(n);
5365
5405
  if (c)
5366
5406
  return e.setGradientBackground({
5367
5407
  gradient: c,
@@ -5370,7 +5410,7 @@ class E {
5370
5410
  }), !0;
5371
5411
  }
5372
5412
  if (a === "image") {
5373
- const c = E._getImageSource(t);
5413
+ const c = L._getImageSource(t);
5374
5414
  if (c)
5375
5415
  return yield e.setImageBackground({
5376
5416
  imageSource: c,
@@ -5412,7 +5452,7 @@ class E {
5412
5452
  */
5413
5453
  static _cloneCustomData(t) {
5414
5454
  if (!(!t || typeof t != "object"))
5415
- return k({}, t);
5455
+ return x({}, t);
5416
5456
  }
5417
5457
  /**
5418
5458
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -5432,14 +5472,653 @@ class E {
5432
5472
  return typeof s.src == "string" ? s.src : null;
5433
5473
  }
5434
5474
  }
5435
- class le {
5475
+ const Gs = 5, ae = "#3D8BF4", Ue = 1, Xs = ["montage-area", "background", "interaction-blocker"], ke = ({
5476
+ anchors: d,
5477
+ positions: t,
5478
+ threshold: e
5479
+ }) => {
5480
+ let s = 0, o = e + 1, n = null;
5481
+ for (const i of t)
5482
+ for (const a of d) {
5483
+ const r = Math.abs(a - i);
5484
+ r > e || r >= o || (s = a - i, o = r, n = a);
5485
+ }
5486
+ return {
5487
+ delta: s,
5488
+ guidePosition: n
5489
+ };
5490
+ }, Ks = ({
5491
+ activeBounds: d,
5492
+ threshold: t,
5493
+ anchors: e
5494
+ }) => {
5495
+ const { left: s, right: o, centerX: n, top: i, bottom: a, centerY: r } = d, c = ke({
5496
+ anchors: e.vertical,
5497
+ positions: [s, n, o],
5498
+ threshold: t
5499
+ }), l = ke({
5500
+ anchors: e.horizontal,
5501
+ positions: [i, r, a],
5502
+ threshold: t
5503
+ }), h = [];
5504
+ return c.guidePosition !== null && h.push({
5505
+ type: "vertical",
5506
+ position: c.guidePosition
5507
+ }), l.guidePosition !== null && h.push({
5508
+ type: "horizontal",
5509
+ position: l.guidePosition
5510
+ }), {
5511
+ deltaX: c.delta,
5512
+ deltaY: l.delta,
5513
+ guides: h
5514
+ };
5515
+ }, Ye = ({
5516
+ activeBounds: d,
5517
+ aligned: t,
5518
+ threshold: e,
5519
+ patterns: s,
5520
+ type: o
5521
+ }) => {
5522
+ if (!t.length || !s.length) return [];
5523
+ const {
5524
+ top: n,
5525
+ bottom: i,
5526
+ left: a,
5527
+ right: r
5528
+ } = d, c = [];
5529
+ for (const l of s)
5530
+ for (const h of t)
5531
+ if (o === "vertical") {
5532
+ const u = n - h.bottom, g = Math.abs(u - l.distance);
5533
+ if (g <= e) {
5534
+ const p = l.distance - u, v = {
5535
+ type: o,
5536
+ axis: l.axis,
5537
+ refStart: l.start,
5538
+ refEnd: l.end,
5539
+ activeStart: h.bottom,
5540
+ activeEnd: h.bottom + l.distance,
5541
+ distance: l.distance
5542
+ };
5543
+ c.push({ delta: p, guide: v, diff: g });
5544
+ }
5545
+ const f = h.top - i, m = Math.abs(f - l.distance);
5546
+ if (m <= e) {
5547
+ const p = l.distance - f, v = {
5548
+ type: o,
5549
+ axis: l.axis,
5550
+ refStart: l.start,
5551
+ refEnd: l.end,
5552
+ activeStart: h.top - l.distance,
5553
+ activeEnd: h.top,
5554
+ distance: l.distance
5555
+ };
5556
+ c.push({ delta: p, guide: v, diff: m });
5557
+ }
5558
+ } else {
5559
+ const u = a - h.right, g = Math.abs(u - l.distance);
5560
+ if (g <= e) {
5561
+ const p = l.distance - u, v = {
5562
+ type: o,
5563
+ axis: l.axis,
5564
+ refStart: l.start,
5565
+ refEnd: l.end,
5566
+ activeStart: h.right,
5567
+ activeEnd: h.right + l.distance,
5568
+ distance: l.distance
5569
+ };
5570
+ c.push({ delta: p, guide: v, diff: g });
5571
+ }
5572
+ const f = h.left - r, m = Math.abs(f - l.distance);
5573
+ if (m <= e) {
5574
+ const p = l.distance - f, v = {
5575
+ type: o,
5576
+ axis: l.axis,
5577
+ refStart: l.start,
5578
+ refEnd: l.end,
5579
+ activeStart: h.left - l.distance,
5580
+ activeEnd: h.left,
5581
+ distance: l.distance
5582
+ };
5583
+ c.push({ delta: p, guide: v, diff: m });
5584
+ }
5585
+ }
5586
+ return c;
5587
+ }, Qs = ({
5588
+ activeBounds: d,
5589
+ candidates: t,
5590
+ threshold: e,
5591
+ patterns: s
5592
+ }) => {
5593
+ const {
5594
+ centerX: o,
5595
+ top: n,
5596
+ bottom: i,
5597
+ left: a,
5598
+ right: r
5599
+ } = d, c = t.filter((y) => Math.min(y.right, r) - Math.max(y.left, a) >= -e);
5600
+ if (!c.length)
5601
+ return { delta: 0, guide: null };
5602
+ const l = [
5603
+ ...c.map((y) => ({ bounds: y, isActive: !1 })),
5604
+ { bounds: d, isActive: !0 }
5605
+ ];
5606
+ l.sort((y, j) => y.bounds.top - j.bounds.top);
5607
+ const h = l.findIndex((y) => y.isActive);
5608
+ if (h === -1)
5609
+ return { delta: 0, guide: null };
5610
+ const u = l[h - 1], g = l[h - 2], f = l[h + 1], m = l[h + 2], p = [], v = i - n;
5611
+ if (u && g) {
5612
+ const { bounds: y } = u, { bounds: j } = g, M = y.top - j.bottom, w = n - y.bottom, S = Math.abs(w - M);
5613
+ if (S <= e) {
5614
+ const C = M - w, I = n + C, O = {
5615
+ type: "vertical",
5616
+ axis: o,
5617
+ refStart: j.bottom,
5618
+ refEnd: y.top,
5619
+ activeStart: y.bottom,
5620
+ activeEnd: I,
5621
+ distance: M
5622
+ };
5623
+ p.push({ delta: C, guide: O, diff: S });
5624
+ }
5625
+ }
5626
+ if (f && m) {
5627
+ const { bounds: y } = f, { bounds: j } = m, M = j.top - y.bottom, w = y.top - i, S = Math.abs(w - M);
5628
+ if (S <= e) {
5629
+ const C = w - M, I = i + C, O = {
5630
+ type: "vertical",
5631
+ axis: o,
5632
+ refStart: y.bottom,
5633
+ refEnd: j.top,
5634
+ activeStart: I,
5635
+ activeEnd: y.top,
5636
+ distance: M
5637
+ };
5638
+ p.push({ delta: C, guide: O, diff: S });
5639
+ }
5640
+ }
5641
+ if (u && f) {
5642
+ const { bounds: y } = u, { bounds: j } = f, w = j.top - y.bottom - v;
5643
+ if (w >= 0) {
5644
+ const S = w / 2, C = n - y.bottom, I = j.top - i, O = Math.abs(C - S), _ = Math.abs(I - S), H = Math.max(O, _);
5645
+ if (H <= e) {
5646
+ const Y = S - C, W = i + Y, G = {
5647
+ type: "vertical",
5648
+ axis: o,
5649
+ refStart: y.bottom,
5650
+ refEnd: y.bottom + S,
5651
+ activeStart: W,
5652
+ activeEnd: W + S,
5653
+ distance: S
5654
+ };
5655
+ p.push({ delta: Y, guide: G, diff: H });
5656
+ }
5657
+ }
5658
+ }
5659
+ const b = Ye({
5660
+ activeBounds: d,
5661
+ aligned: c,
5662
+ threshold: e,
5663
+ patterns: s,
5664
+ type: "vertical"
5665
+ });
5666
+ if (p.push(...b), !p.length)
5667
+ return { delta: 0, guide: null };
5668
+ const A = p.reduce((y, j) => j.diff < y.diff ? j : y, p[0]);
5669
+ return {
5670
+ delta: A.delta,
5671
+ guide: A.guide
5672
+ };
5673
+ }, $s = ({
5674
+ activeBounds: d,
5675
+ candidates: t,
5676
+ threshold: e,
5677
+ patterns: s
5678
+ }) => {
5679
+ const {
5680
+ centerY: o,
5681
+ left: n,
5682
+ right: i,
5683
+ top: a,
5684
+ bottom: r
5685
+ } = d, c = t.filter((y) => Math.min(y.bottom, r) - Math.max(y.top, a) >= -e);
5686
+ if (!c.length)
5687
+ return { delta: 0, guide: null };
5688
+ const l = [
5689
+ ...c.map((y) => ({ bounds: y, isActive: !1 })),
5690
+ { bounds: d, isActive: !0 }
5691
+ ];
5692
+ l.sort((y, j) => y.bounds.left - j.bounds.left);
5693
+ const h = l.findIndex((y) => y.isActive);
5694
+ if (h === -1)
5695
+ return { delta: 0, guide: null };
5696
+ const u = l[h - 1], g = l[h - 2], f = l[h + 1], m = l[h + 2], p = [], v = i - n;
5697
+ if (u && g) {
5698
+ const { bounds: y } = u, { bounds: j } = g, M = y.left - j.right, w = n - y.right, S = Math.abs(w - M);
5699
+ if (S <= e) {
5700
+ const C = M - w, I = n + C, O = {
5701
+ type: "horizontal",
5702
+ axis: o,
5703
+ refStart: j.right,
5704
+ refEnd: y.left,
5705
+ activeStart: y.right,
5706
+ activeEnd: I,
5707
+ distance: M
5708
+ };
5709
+ p.push({ delta: C, guide: O, diff: S });
5710
+ }
5711
+ }
5712
+ if (f && m) {
5713
+ const { bounds: y } = f, { bounds: j } = m, M = j.left - y.right, w = y.left - i, S = Math.abs(w - M);
5714
+ if (S <= e) {
5715
+ const C = w - M, I = i + C, O = {
5716
+ type: "horizontal",
5717
+ axis: o,
5718
+ refStart: y.right,
5719
+ refEnd: j.left,
5720
+ activeStart: I,
5721
+ activeEnd: y.left,
5722
+ distance: M
5723
+ };
5724
+ p.push({ delta: C, guide: O, diff: S });
5725
+ }
5726
+ }
5727
+ if (u && f) {
5728
+ const { bounds: y } = u, { bounds: j } = f, w = j.left - y.right - v;
5729
+ if (w >= 0) {
5730
+ const S = w / 2, C = n - y.right, I = j.left - i, O = Math.abs(C - S), _ = Math.abs(I - S), H = Math.max(O, _);
5731
+ if (H <= e) {
5732
+ const Y = S - C, W = i + Y, G = {
5733
+ type: "horizontal",
5734
+ axis: o,
5735
+ refStart: y.right,
5736
+ refEnd: y.right + S,
5737
+ activeStart: W,
5738
+ activeEnd: W + S,
5739
+ distance: S
5740
+ };
5741
+ p.push({ delta: Y, guide: G, diff: H });
5742
+ }
5743
+ }
5744
+ }
5745
+ const b = Ye({
5746
+ activeBounds: d,
5747
+ aligned: c,
5748
+ threshold: e,
5749
+ patterns: s,
5750
+ type: "horizontal"
5751
+ });
5752
+ if (p.push(...b), !p.length)
5753
+ return { delta: 0, guide: null };
5754
+ const A = p.reduce((y, j) => j.diff < y.diff ? j : y, p[0]);
5755
+ return {
5756
+ delta: A.delta,
5757
+ guide: A.guide
5758
+ };
5759
+ }, Js = ({
5760
+ activeBounds: d,
5761
+ candidates: t,
5762
+ threshold: e,
5763
+ spacingPatterns: s
5764
+ }) => {
5765
+ const o = Qs({
5766
+ activeBounds: d,
5767
+ candidates: t,
5768
+ threshold: e,
5769
+ patterns: s.vertical
5770
+ }), n = $s({
5771
+ activeBounds: d,
5772
+ candidates: t,
5773
+ threshold: e,
5774
+ patterns: s.horizontal
5775
+ }), i = [];
5776
+ return o.guide && i.push(o.guide), n.guide && i.push(n.guide), {
5777
+ deltaX: n.delta,
5778
+ deltaY: o.delta,
5779
+ guides: i
5780
+ };
5781
+ }, qs = ({
5782
+ context: d,
5783
+ x: t,
5784
+ y: e,
5785
+ width: s,
5786
+ height: o,
5787
+ radius: n
5788
+ }) => {
5789
+ const i = Math.min(n, s / 2, o / 2);
5790
+ d.moveTo(t + i, e), d.lineTo(t + s - i, e), d.quadraticCurveTo(t + s, e, t + s, e + i), d.lineTo(t + s, e + o - i), d.quadraticCurveTo(t + s, e + o, t + s - i, e + o), d.lineTo(t + i, e + o), d.quadraticCurveTo(t, e + o, t, e + o - i), d.lineTo(t, e + i), d.quadraticCurveTo(t, e, t + i, e), d.closePath();
5791
+ }, Be = ({
5792
+ context: d,
5793
+ type: t,
5794
+ axis: e,
5795
+ start: s,
5796
+ end: o,
5797
+ text: n,
5798
+ zoom: i
5799
+ }) => {
5800
+ const a = 12 / i, r = 4 / i, c = 4 / i, l = (s + o) / 2;
5801
+ d.save(), d.setLineDash([]), d.fillStyle = ae, d.strokeStyle = ae, d.lineWidth = Ue / i, d.font = `${a}px sans-serif`, d.textAlign = "center", d.textBaseline = "middle";
5802
+ const h = d.measureText(n).width + r * 2, u = a + r * 2, g = t === "vertical" ? e : l, f = t === "vertical" ? l : e, m = g - h / 2, p = f - u / 2;
5803
+ d.beginPath(), qs({
5804
+ context: d,
5805
+ x: m,
5806
+ y: p,
5807
+ width: h,
5808
+ height: u,
5809
+ radius: c
5810
+ }), d.fill(), d.fillStyle = "#ffffff", d.fillText(n, g, f), d.restore();
5811
+ }, to = ({
5812
+ context: d,
5813
+ guide: t,
5814
+ zoom: e
5815
+ }) => {
5816
+ const {
5817
+ type: s,
5818
+ axis: o,
5819
+ refStart: n,
5820
+ refEnd: i,
5821
+ activeStart: a,
5822
+ activeEnd: r,
5823
+ distance: c
5824
+ } = t, l = Math.round(c).toString();
5825
+ d.beginPath(), s === "vertical" ? (d.moveTo(o, n), d.lineTo(o, i), d.moveTo(o, a), d.lineTo(o, r)) : (d.moveTo(n, o), d.lineTo(i, o), d.moveTo(a, o), d.lineTo(r, o)), d.stroke(), Be({
5826
+ context: d,
5827
+ type: s,
5828
+ axis: o,
5829
+ start: n,
5830
+ end: i,
5831
+ text: l,
5832
+ zoom: e
5833
+ }), Be({
5834
+ context: d,
5835
+ type: s,
5836
+ axis: o,
5837
+ start: a,
5838
+ end: r,
5839
+ text: l,
5840
+ zoom: e
5841
+ });
5842
+ }, eo = ({
5843
+ activeObject: d
5844
+ }) => {
5845
+ const t = /* @__PURE__ */ new Set();
5846
+ return d && (t.add(d), d instanceof z && d.getObjects().forEach((e) => t.add(e))), t;
5847
+ }, so = ({
5848
+ object: d,
5849
+ excluded: t
5850
+ }) => {
5851
+ if (t.has(d)) return !0;
5852
+ const { visible: e = !0 } = d;
5853
+ if (!e) return !0;
5854
+ const { id: s } = d;
5855
+ return !!(s && Xs.includes(s));
5856
+ }, xe = ({
5857
+ anchors: d,
5858
+ bounds: t
5859
+ }) => {
5860
+ const {
5861
+ left: e,
5862
+ right: s,
5863
+ centerX: o,
5864
+ top: n,
5865
+ bottom: i,
5866
+ centerY: a
5867
+ } = t;
5868
+ d.vertical.push(e, o, s), d.horizontal.push(n, a, i);
5869
+ }, _e = ({
5870
+ bounds: d,
5871
+ type: t,
5872
+ primaryStart: e,
5873
+ primaryEnd: s
5874
+ }) => {
5875
+ const o = [], n = e === "top" ? "left" : "top", i = s === "bottom" ? "right" : "bottom", a = [...d].sort((r, c) => r[e] - c[e]);
5876
+ for (let r = 0; r < a.length; r += 1) {
5877
+ const c = a[r];
5878
+ let l = null, h = Number.POSITIVE_INFINITY;
5879
+ for (let m = r + 1; m < a.length; m += 1) {
5880
+ const p = a[m];
5881
+ if (Math.min(c[i], p[i]) - Math.max(c[n], p[n]) < 0) continue;
5882
+ const b = p[e] - c[s];
5883
+ b < 0 || b < h && (h = b, l = p);
5884
+ }
5885
+ if (!l || h === Number.POSITIVE_INFINITY) continue;
5886
+ const u = Math.max(c[n], l[n]), g = Math.min(c[i], l[i]), f = (u + g) / 2;
5887
+ o.push({
5888
+ type: t,
5889
+ axis: f,
5890
+ start: c[s],
5891
+ end: l[e],
5892
+ distance: l[e] - c[s]
5893
+ });
5894
+ }
5895
+ return o;
5896
+ }, oo = ({
5897
+ bounds: d
5898
+ }) => {
5899
+ const t = _e({
5900
+ bounds: d,
5901
+ type: "vertical",
5902
+ primaryStart: "top",
5903
+ primaryEnd: "bottom"
5904
+ }), e = _e({
5905
+ bounds: d,
5906
+ type: "horizontal",
5907
+ primaryStart: "left",
5908
+ primaryEnd: "right"
5909
+ });
5910
+ return { vertical: t, horizontal: e };
5911
+ };
5912
+ class no {
5913
+ /**
5914
+ * Создаёт менеджер прилипания и инициализирует слушатели событий.
5915
+ */
5916
+ constructor({ editor: t }) {
5917
+ this.anchors = { vertical: [], horizontal: [] }, this.spacingPatterns = {
5918
+ vertical: [],
5919
+ horizontal: []
5920
+ }, this.cachedTargetBounds = [], this.activeGuides = [], this.activeSpacingGuides = [], this.guideBounds = null, this.editor = t;
5921
+ const { canvas: e } = t;
5922
+ this.canvas = e, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._handleObjectMoving.bind(this), this._onMouseUp = this._handleMouseUp.bind(this), this._onBeforeRender = this._handleBeforeRender.bind(this), this._onAfterRender = this._handleAfterRender.bind(this), this._bindEvents();
5923
+ }
5924
+ /**
5925
+ * Удаляет слушатели и очищает временные данные.
5926
+ */
5927
+ destroy() {
5928
+ this._unbindEvents(), this._clearGuides(), this._clearAnchors();
5929
+ }
5930
+ /**
5931
+ * Навешивает обработчики событий канваса.
5932
+ */
5933
+ _bindEvents() {
5934
+ const { canvas: t } = this;
5935
+ t.on("mouse:down", this._onMouseDown), t.on("object:moving", this._onObjectMoving), t.on("mouse:up", this._onMouseUp), t.on("before:render", this._onBeforeRender), t.on("after:render", this._onAfterRender);
5936
+ }
5937
+ /**
5938
+ * Удаляет обработчики событий канваса.
5939
+ */
5940
+ _unbindEvents() {
5941
+ const { canvas: t } = this;
5942
+ t.off("mouse:down", this._onMouseDown), t.off("object:moving", this._onObjectMoving), t.off("mouse:up", this._onMouseUp), t.off("before:render", this._onBeforeRender), t.off("after:render", this._onAfterRender);
5943
+ }
5944
+ /**
5945
+ * Кеширует набор опорных линий в момент начала перетаскивания.
5946
+ */
5947
+ _handleMouseDown(t) {
5948
+ const { target: e } = t;
5949
+ if (!e) {
5950
+ this._clearAnchors();
5951
+ return;
5952
+ }
5953
+ this._cacheAnchors({ activeObject: e });
5954
+ }
5955
+ /**
5956
+ * Выполняет привязку объекта к ближайшим линиям при его перемещении.
5957
+ */
5958
+ _handleObjectMoving(t) {
5959
+ var f, m;
5960
+ const { target: e, e: s } = t;
5961
+ if (!e) {
5962
+ this._clearGuides();
5963
+ return;
5964
+ }
5965
+ if (s != null && s.ctrlKey) {
5966
+ this._clearGuides();
5967
+ return;
5968
+ }
5969
+ !this.anchors.vertical.length && !this.anchors.horizontal.length && this._cacheAnchors({ activeObject: e });
5970
+ let o = yt({ object: e });
5971
+ if (!o) {
5972
+ this._clearGuides();
5973
+ return;
5974
+ }
5975
+ const { canvas: n } = this, i = n.getZoom() || 1, a = Gs / i, r = Ks({
5976
+ activeBounds: o,
5977
+ threshold: a,
5978
+ anchors: this.anchors
5979
+ }), { deltaX: c, deltaY: l, guides: h } = r;
5980
+ if (c !== 0 || l !== 0) {
5981
+ const { left: p = 0, top: v = 0 } = e;
5982
+ e.set({
5983
+ left: p + c,
5984
+ top: v + l
5985
+ }), e.setCoords(), o = (f = yt({ object: e })) != null ? f : o;
5986
+ }
5987
+ const u = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((p) => yt({ object: p })).filter((p) => !!p), g = Js({
5988
+ activeBounds: o,
5989
+ candidates: u,
5990
+ threshold: a,
5991
+ spacingPatterns: this.spacingPatterns
5992
+ });
5993
+ if (g.deltaX !== 0 || g.deltaY !== 0) {
5994
+ const { left: p = 0, top: v = 0 } = e;
5995
+ e.set({
5996
+ left: p + g.deltaX,
5997
+ top: v + g.deltaY
5998
+ }), e.setCoords(), o = (m = yt({ object: e })) != null ? m : o;
5999
+ }
6000
+ this._applyGuides({
6001
+ guides: h,
6002
+ spacingGuides: g.guides
6003
+ });
6004
+ }
6005
+ /**
6006
+ * Очищает направляющие и кеш после окончания перетаскивания.
6007
+ */
6008
+ _handleMouseUp() {
6009
+ this._clearGuides(), this._clearAnchors();
6010
+ }
6011
+ /**
6012
+ * Очищает вспомогательный слой перед рендером.
6013
+ */
6014
+ _handleBeforeRender() {
6015
+ const { canvas: t } = this, { contextTop: e } = t;
6016
+ e && t.clearContext(e);
6017
+ }
6018
+ /**
6019
+ * Отрисовывает активные направляющие после рендера канваса.
6020
+ */
6021
+ _handleAfterRender() {
6022
+ if (!this.activeGuides.length && !this.activeSpacingGuides.length) return;
6023
+ const { canvas: t, guideBounds: e } = this, s = t.getSelectionContext();
6024
+ if (!s) return;
6025
+ const o = e != null ? e : this._calculateViewportBounds(), { left: n, right: i, top: a, bottom: r } = o, { viewportTransform: c } = t, l = t.getZoom() || 1;
6026
+ s.save(), Array.isArray(c) && s.transform(...c), s.lineWidth = Ue / l, s.strokeStyle = ae, s.setLineDash([4, 4]);
6027
+ for (const h of this.activeGuides)
6028
+ s.beginPath(), h.type === "vertical" ? (s.moveTo(h.position, a), s.lineTo(h.position, r)) : (s.moveTo(n, h.position), s.lineTo(i, h.position)), s.stroke();
6029
+ for (const h of this.activeSpacingGuides)
6030
+ to({
6031
+ context: s,
6032
+ guide: h,
6033
+ zoom: l
6034
+ });
6035
+ s.restore();
6036
+ }
6037
+ /**
6038
+ * Применяет найденные направляющие или очищает их, если ничего нет.
6039
+ */
6040
+ _applyGuides({
6041
+ guides: t,
6042
+ spacingGuides: e
6043
+ }) {
6044
+ if (!t.length && !e.length) {
6045
+ this._clearGuides();
6046
+ return;
6047
+ }
6048
+ this.activeGuides = t, this.activeSpacingGuides = e, this.canvas.requestRenderAll();
6049
+ }
6050
+ /**
6051
+ * Сбрасывает все активные направляющие и инициирует перерисовку.
6052
+ */
6053
+ _clearGuides() {
6054
+ !this.activeGuides.length && !this.activeSpacingGuides.length || (this.activeGuides = [], this.activeSpacingGuides = [], this.canvas.requestRenderAll());
6055
+ }
6056
+ /**
6057
+ * Обнуляет кеш опорных линий.
6058
+ */
6059
+ _clearAnchors() {
6060
+ this.anchors = { vertical: [], horizontal: [] }, this.spacingPatterns = { vertical: [], horizontal: [] }, this.cachedTargetBounds = [];
6061
+ }
6062
+ /**
6063
+ * Сохраняет линии для прилипания от всех доступных объектов и монтажной области.
6064
+ */
6065
+ _cacheAnchors({ activeObject: t }) {
6066
+ const e = this._collectTargets({ activeObject: t }), s = { vertical: [], horizontal: [] }, o = [];
6067
+ for (const a of e) {
6068
+ const r = yt({ object: a });
6069
+ r && (xe({ anchors: s, bounds: r }), o.push(r));
6070
+ }
6071
+ const { montageArea: n } = this.editor, i = yt({ object: n });
6072
+ if (i) {
6073
+ xe({ anchors: s, bounds: i });
6074
+ const { left: a, right: r, top: c, bottom: l } = i;
6075
+ this.guideBounds = {
6076
+ left: a,
6077
+ right: r,
6078
+ top: c,
6079
+ bottom: l
6080
+ };
6081
+ } else
6082
+ this.guideBounds = this._calculateViewportBounds();
6083
+ this.anchors = s, this.spacingPatterns = oo({ bounds: o }), this.cachedTargetBounds = o;
6084
+ }
6085
+ /**
6086
+ * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
6087
+ */
6088
+ _collectTargets({ activeObject: t }) {
6089
+ const e = eo({ activeObject: t }), s = [];
6090
+ return this.canvas.forEachObject((o) => {
6091
+ so({ object: o, excluded: e }) || s.push(o);
6092
+ }), s;
6093
+ }
6094
+ /**
6095
+ * Возвращает границы для рисования направляющих.
6096
+ */
6097
+ _calculateViewportBounds() {
6098
+ const { canvas: t } = this, { viewportTransform: e } = t, s = t.getWidth(), o = t.getHeight(), [
6099
+ n = 1,
6100
+ ,
6101
+ ,
6102
+ i = 1,
6103
+ a = 0,
6104
+ r = 0
6105
+ ] = e != null ? e : [], c = (0 - a) / n, l = (0 - r) / i, h = (s - a) / n, u = (o - r) / i;
6106
+ return {
6107
+ left: c,
6108
+ right: h,
6109
+ top: l,
6110
+ bottom: u
6111
+ };
6112
+ }
6113
+ }
6114
+ class ue {
5436
6115
  /**
5437
6116
  * Конструктор класса ImageEditor.
5438
6117
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
5439
6118
  * @param options - опции и настройки редактора
5440
6119
  */
5441
6120
  constructor(t, e) {
5442
- this.options = e, this.containerId = t, this.editorId = `${t}-${P()}`, this.clipboard = null, this.init();
6121
+ this.options = e, this.containerId = t, this.editorId = `${t}-${F()}`, this.clipboard = null, this.init();
5443
6122
  }
5444
6123
  /**
5445
6124
  * Инициализация редактора.
@@ -5447,7 +6126,7 @@ class le {
5447
6126
  * @fires editor:ready
5448
6127
  */
5449
6128
  init() {
5450
- return O(this, null, function* () {
6129
+ return R(this, null, function* () {
5451
6130
  var u;
5452
6131
  const {
5453
6132
  editorContainerWidth: t,
@@ -5459,10 +6138,10 @@ class le {
5459
6138
  initialImage: a,
5460
6139
  initialStateJSON: r,
5461
6140
  scaleType: c,
5462
- showRotationAngle: h,
5463
- _onReadyCallback: l
6141
+ showRotationAngle: l,
6142
+ _onReadyCallback: h
5464
6143
  } = this.options;
5465
- if (yt.apply(), this.canvas = new We(this.containerId, this.options), this.moduleLoader = new Xe(), this.workerManager = new Qe(), this.errorManager = new Nt({ editor: this }), this.historyManager = new Ht({ editor: this }), this.toolbar = new us({ editor: this }), this.transformManager = new js({ editor: this }), this.zoomManager = new As({ editor: this }), this.canvasManager = new ws({ editor: this }), this.imageManager = new et({ editor: this }), this.layerManager = new Zt({ editor: this }), this.shapeManager = new Is({ editor: this }), this.interactionBlocker = new Ss({ editor: this }), this.backgroundManager = new Mt({ editor: this }), this.clipboardManager = new Cs({ editor: this }), this.objectLockManager = new Vt({ editor: this }), this.groupingManager = new Es({ editor: this }), this.selectionManager = new Ts({ editor: this }), this.deletionManager = new de({ editor: this }), this.panConstraintManager = new Os({ editor: this }), this.fontManager = new ne((u = this.options.fonts) != null ? u : []), this.textManager = new Q({ editor: this }), this.templateManager = new E({ editor: this }), h && (this.angleIndicator = new ce({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Lt({ 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) {
6144
+ if (bt.apply(), this.canvas = new $e(this.containerId, this.options), this.moduleLoader = new ss(), this.workerManager = new ns(), this.errorManager = new Rt({ editor: this }), this.historyManager = new Zt({ editor: this }), this.toolbar = new Ms({ editor: this }), this.transformManager = new Ds({ editor: this }), this.zoomManager = new Ls({ editor: this }), this.canvasManager = new Os({ editor: this }), this.imageManager = new et({ editor: this }), this.layerManager = new Vt({ editor: this }), this.shapeManager = new Rs({ editor: this }), this.interactionBlocker = new Ns({ editor: this }), this.backgroundManager = new Mt({ editor: this }), this.clipboardManager = new ks({ editor: this }), this.objectLockManager = new Gt({ editor: this }), this.groupingManager = new Bs({ editor: this }), this.selectionManager = new xs({ editor: this }), this.deletionManager = new he({ editor: this }), this.panConstraintManager = new _s({ editor: this }), this.snappingManager = new no({ editor: this }), this.fontManager = new ie((u = this.options.fonts) != null ? u : []), this.textManager = new Q({ editor: this }), this.templateManager = new L({ editor: this }), l && (this.angleIndicator = new le({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new Nt({ 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) {
5466
6145
  const {
5467
6146
  source: g,
5468
6147
  scale: f = `image-${c}`,
@@ -5470,7 +6149,7 @@ class le {
5470
6149
  } = a;
5471
6150
  yield this.imageManager.importImage({ source: g, scale: f, withoutSave: m });
5472
6151
  }
5473
- r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
6152
+ r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof h == "function" && h(this);
5474
6153
  });
5475
6154
  }
5476
6155
  /**
@@ -5484,7 +6163,7 @@ class le {
5484
6163
  this.montageArea = this.shapeManager.addRectangle({
5485
6164
  width: t,
5486
6165
  height: e,
5487
- fill: le._createMosaicPattern(),
6166
+ fill: ue._createMosaicPattern(),
5488
6167
  stroke: null,
5489
6168
  strokeWidth: 0,
5490
6169
  selectable: !1,
@@ -5524,8 +6203,8 @@ class le {
5524
6203
  * Метод для удаления редактора и всех слушателей.
5525
6204
  */
5526
6205
  destroy() {
5527
- var t, e;
5528
- this.listeners.destroy(), this.toolbar.destroy(), (t = this.angleIndicator) == null || t.destroy(), (e = this.textManager) == null || e.destroy(), this.canvas.dispose(), this.workerManager.worker.terminate(), this.imageManager.revokeBlobUrls(), this.errorManager.cleanBuffer();
6206
+ var t, e, s;
6207
+ this.listeners.destroy(), (t = this.snappingManager) == null || t.destroy(), this.toolbar.destroy(), (e = this.angleIndicator) == null || e.destroy(), (s = this.textManager) == null || s.destroy(), this.canvas.dispose(), this.workerManager.worker.terminate(), this.imageManager.revokeBlobUrls(), this.errorManager.cleanBuffer();
5529
6208
  }
5530
6209
  /**
5531
6210
  * Создает паттерн мозаики.
@@ -5535,13 +6214,13 @@ class le {
5535
6214
  const t = document.createElement("canvas");
5536
6215
  t.width = 20, t.height = 20;
5537
6216
  const e = t.getContext("2d");
5538
- return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new He({
6217
+ return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new Je({
5539
6218
  source: t,
5540
6219
  repeat: "repeat"
5541
6220
  });
5542
6221
  }
5543
6222
  }
5544
- const w = [
6223
+ const T = [
5545
6224
  "U+0000-00FF",
5546
6225
  "U+0131",
5547
6226
  "U+0152-0153",
@@ -5561,13 +6240,13 @@ const w = [
5561
6240
  "U+2215",
5562
6241
  "U+FEFF",
5563
6242
  "U+FFFD"
5564
- ].join(", "), j = [
6243
+ ].join(", "), E = [
5565
6244
  "U+0301",
5566
6245
  "U+0400-045F",
5567
6246
  "U+0490-0491",
5568
6247
  "U+04B0-04B1",
5569
6248
  "U+2116"
5570
- ].join(", "), zs = [
6249
+ ].join(", "), io = [
5571
6250
  {
5572
6251
  family: "Arial",
5573
6252
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -5584,7 +6263,7 @@ const w = [
5584
6263
  style: "normal",
5585
6264
  weight: "400",
5586
6265
  display: "swap",
5587
- unicodeRange: j
6266
+ unicodeRange: E
5588
6267
  }
5589
6268
  },
5590
6269
  {
@@ -5594,7 +6273,7 @@ const w = [
5594
6273
  style: "normal",
5595
6274
  weight: "400",
5596
6275
  display: "swap",
5597
- unicodeRange: w
6276
+ unicodeRange: T
5598
6277
  }
5599
6278
  },
5600
6279
  {
@@ -5604,7 +6283,7 @@ const w = [
5604
6283
  style: "normal",
5605
6284
  weight: "700",
5606
6285
  display: "swap",
5607
- unicodeRange: j
6286
+ unicodeRange: E
5608
6287
  }
5609
6288
  },
5610
6289
  {
@@ -5614,7 +6293,7 @@ const w = [
5614
6293
  style: "normal",
5615
6294
  weight: "700",
5616
6295
  display: "swap",
5617
- unicodeRange: w
6296
+ unicodeRange: T
5618
6297
  }
5619
6298
  },
5620
6299
  {
@@ -5624,7 +6303,7 @@ const w = [
5624
6303
  style: "normal",
5625
6304
  weight: "200 700",
5626
6305
  display: "swap",
5627
- unicodeRange: j
6306
+ unicodeRange: E
5628
6307
  }
5629
6308
  },
5630
6309
  {
@@ -5634,7 +6313,7 @@ const w = [
5634
6313
  style: "normal",
5635
6314
  weight: "200 700",
5636
6315
  display: "swap",
5637
- unicodeRange: w
6316
+ unicodeRange: T
5638
6317
  }
5639
6318
  },
5640
6319
  {
@@ -5644,7 +6323,7 @@ const w = [
5644
6323
  style: "normal",
5645
6324
  weight: "300 900",
5646
6325
  display: "swap",
5647
- unicodeRange: j
6326
+ unicodeRange: E
5648
6327
  }
5649
6328
  },
5650
6329
  {
@@ -5654,7 +6333,7 @@ const w = [
5654
6333
  style: "normal",
5655
6334
  weight: "300 900",
5656
6335
  display: "swap",
5657
- unicodeRange: w
6336
+ unicodeRange: T
5658
6337
  }
5659
6338
  },
5660
6339
  {
@@ -5664,7 +6343,7 @@ const w = [
5664
6343
  style: "normal",
5665
6344
  weight: "400 700",
5666
6345
  display: "swap",
5667
- unicodeRange: j
6346
+ unicodeRange: E
5668
6347
  }
5669
6348
  },
5670
6349
  {
@@ -5674,7 +6353,7 @@ const w = [
5674
6353
  style: "normal",
5675
6354
  weight: "400 700",
5676
6355
  display: "swap",
5677
- unicodeRange: w
6356
+ unicodeRange: T
5678
6357
  }
5679
6358
  },
5680
6359
  {
@@ -5684,7 +6363,7 @@ const w = [
5684
6363
  style: "normal",
5685
6364
  weight: "300 700",
5686
6365
  display: "swap",
5687
- unicodeRange: j
6366
+ unicodeRange: E
5688
6367
  }
5689
6368
  },
5690
6369
  {
@@ -5694,7 +6373,7 @@ const w = [
5694
6373
  style: "normal",
5695
6374
  weight: "300 700",
5696
6375
  display: "swap",
5697
- unicodeRange: w
6376
+ unicodeRange: T
5698
6377
  }
5699
6378
  },
5700
6379
  {
@@ -5704,7 +6383,7 @@ const w = [
5704
6383
  style: "normal",
5705
6384
  weight: "300 700",
5706
6385
  display: "swap",
5707
- unicodeRange: j
6386
+ unicodeRange: E
5708
6387
  }
5709
6388
  },
5710
6389
  {
@@ -5714,7 +6393,7 @@ const w = [
5714
6393
  style: "normal",
5715
6394
  weight: "300 700",
5716
6395
  display: "swap",
5717
- unicodeRange: w
6396
+ unicodeRange: T
5718
6397
  }
5719
6398
  },
5720
6399
  {
@@ -5724,7 +6403,7 @@ const w = [
5724
6403
  style: "normal",
5725
6404
  weight: "400",
5726
6405
  display: "swap",
5727
- unicodeRange: j
6406
+ unicodeRange: E
5728
6407
  }
5729
6408
  },
5730
6409
  {
@@ -5734,7 +6413,7 @@ const w = [
5734
6413
  style: "normal",
5735
6414
  weight: "400",
5736
6415
  display: "swap",
5737
- unicodeRange: w
6416
+ unicodeRange: T
5738
6417
  }
5739
6418
  },
5740
6419
  {
@@ -5744,7 +6423,7 @@ const w = [
5744
6423
  style: "normal",
5745
6424
  weight: "400 700",
5746
6425
  display: "swap",
5747
- unicodeRange: j
6426
+ unicodeRange: E
5748
6427
  }
5749
6428
  },
5750
6429
  {
@@ -5754,7 +6433,7 @@ const w = [
5754
6433
  style: "normal",
5755
6434
  weight: "400 700",
5756
6435
  display: "swap",
5757
- unicodeRange: w
6436
+ unicodeRange: T
5758
6437
  }
5759
6438
  },
5760
6439
  {
@@ -5764,7 +6443,7 @@ const w = [
5764
6443
  style: "normal",
5765
6444
  weight: "100 900",
5766
6445
  display: "swap",
5767
- unicodeRange: j
6446
+ unicodeRange: E
5768
6447
  }
5769
6448
  },
5770
6449
  {
@@ -5774,7 +6453,7 @@ const w = [
5774
6453
  style: "normal",
5775
6454
  weight: "100 900",
5776
6455
  display: "swap",
5777
- unicodeRange: w
6456
+ unicodeRange: T
5778
6457
  }
5779
6458
  },
5780
6459
  {
@@ -5784,7 +6463,7 @@ const w = [
5784
6463
  style: "normal",
5785
6464
  weight: "400",
5786
6465
  display: "swap",
5787
- unicodeRange: j
6466
+ unicodeRange: E
5788
6467
  }
5789
6468
  },
5790
6469
  {
@@ -5794,7 +6473,7 @@ const w = [
5794
6473
  style: "normal",
5795
6474
  weight: "400",
5796
6475
  display: "swap",
5797
- unicodeRange: w
6476
+ unicodeRange: T
5798
6477
  }
5799
6478
  },
5800
6479
  {
@@ -5804,7 +6483,7 @@ const w = [
5804
6483
  style: "normal",
5805
6484
  weight: "700",
5806
6485
  display: "swap",
5807
- unicodeRange: j
6486
+ unicodeRange: E
5808
6487
  }
5809
6488
  },
5810
6489
  {
@@ -5814,7 +6493,7 @@ const w = [
5814
6493
  style: "normal",
5815
6494
  weight: "700",
5816
6495
  display: "swap",
5817
- unicodeRange: w
6496
+ unicodeRange: T
5818
6497
  }
5819
6498
  },
5820
6499
  {
@@ -5824,7 +6503,7 @@ const w = [
5824
6503
  style: "normal",
5825
6504
  weight: "400 700",
5826
6505
  display: "swap",
5827
- unicodeRange: j
6506
+ unicodeRange: E
5828
6507
  }
5829
6508
  },
5830
6509
  {
@@ -5834,7 +6513,7 @@ const w = [
5834
6513
  style: "normal",
5835
6514
  weight: "400 700",
5836
6515
  display: "swap",
5837
- unicodeRange: w
6516
+ unicodeRange: T
5838
6517
  }
5839
6518
  },
5840
6519
  {
@@ -5844,7 +6523,7 @@ const w = [
5844
6523
  style: "normal",
5845
6524
  weight: "100 900",
5846
6525
  display: "swap",
5847
- unicodeRange: j
6526
+ unicodeRange: E
5848
6527
  }
5849
6528
  },
5850
6529
  {
@@ -5854,7 +6533,7 @@ const w = [
5854
6533
  style: "normal",
5855
6534
  weight: "100 900",
5856
6535
  display: "swap",
5857
- unicodeRange: w
6536
+ unicodeRange: T
5858
6537
  }
5859
6538
  },
5860
6539
  {
@@ -5864,7 +6543,7 @@ const w = [
5864
6543
  style: "normal",
5865
6544
  weight: "100",
5866
6545
  display: "swap",
5867
- unicodeRange: j
6546
+ unicodeRange: E
5868
6547
  }
5869
6548
  },
5870
6549
  {
@@ -5874,7 +6553,7 @@ const w = [
5874
6553
  style: "normal",
5875
6554
  weight: "100",
5876
6555
  display: "swap",
5877
- unicodeRange: w
6556
+ unicodeRange: T
5878
6557
  }
5879
6558
  },
5880
6559
  {
@@ -5884,7 +6563,7 @@ const w = [
5884
6563
  style: "normal",
5885
6564
  weight: "200",
5886
6565
  display: "swap",
5887
- unicodeRange: j
6566
+ unicodeRange: E
5888
6567
  }
5889
6568
  },
5890
6569
  {
@@ -5894,7 +6573,7 @@ const w = [
5894
6573
  style: "normal",
5895
6574
  weight: "200",
5896
6575
  display: "swap",
5897
- unicodeRange: w
6576
+ unicodeRange: T
5898
6577
  }
5899
6578
  },
5900
6579
  {
@@ -5904,7 +6583,7 @@ const w = [
5904
6583
  style: "normal",
5905
6584
  weight: "300",
5906
6585
  display: "swap",
5907
- unicodeRange: j
6586
+ unicodeRange: E
5908
6587
  }
5909
6588
  },
5910
6589
  {
@@ -5914,7 +6593,7 @@ const w = [
5914
6593
  style: "normal",
5915
6594
  weight: "300",
5916
6595
  display: "swap",
5917
- unicodeRange: w
6596
+ unicodeRange: T
5918
6597
  }
5919
6598
  },
5920
6599
  {
@@ -5924,7 +6603,7 @@ const w = [
5924
6603
  style: "normal",
5925
6604
  weight: "400",
5926
6605
  display: "swap",
5927
- unicodeRange: j
6606
+ unicodeRange: E
5928
6607
  }
5929
6608
  },
5930
6609
  {
@@ -5934,7 +6613,7 @@ const w = [
5934
6613
  style: "normal",
5935
6614
  weight: "400",
5936
6615
  display: "swap",
5937
- unicodeRange: w
6616
+ unicodeRange: T
5938
6617
  }
5939
6618
  },
5940
6619
  {
@@ -5944,7 +6623,7 @@ const w = [
5944
6623
  style: "normal",
5945
6624
  weight: "500",
5946
6625
  display: "swap",
5947
- unicodeRange: j
6626
+ unicodeRange: E
5948
6627
  }
5949
6628
  },
5950
6629
  {
@@ -5954,7 +6633,7 @@ const w = [
5954
6633
  style: "normal",
5955
6634
  weight: "500",
5956
6635
  display: "swap",
5957
- unicodeRange: w
6636
+ unicodeRange: T
5958
6637
  }
5959
6638
  },
5960
6639
  {
@@ -5964,7 +6643,7 @@ const w = [
5964
6643
  style: "normal",
5965
6644
  weight: "600",
5966
6645
  display: "swap",
5967
- unicodeRange: j
6646
+ unicodeRange: E
5968
6647
  }
5969
6648
  },
5970
6649
  {
@@ -5974,7 +6653,7 @@ const w = [
5974
6653
  style: "normal",
5975
6654
  weight: "600",
5976
6655
  display: "swap",
5977
- unicodeRange: w
6656
+ unicodeRange: T
5978
6657
  }
5979
6658
  },
5980
6659
  {
@@ -5984,7 +6663,7 @@ const w = [
5984
6663
  style: "normal",
5985
6664
  weight: "700",
5986
6665
  display: "swap",
5987
- unicodeRange: j
6666
+ unicodeRange: E
5988
6667
  }
5989
6668
  },
5990
6669
  {
@@ -5994,7 +6673,7 @@ const w = [
5994
6673
  style: "normal",
5995
6674
  weight: "700",
5996
6675
  display: "swap",
5997
- unicodeRange: w
6676
+ unicodeRange: T
5998
6677
  }
5999
6678
  },
6000
6679
  {
@@ -6004,7 +6683,7 @@ const w = [
6004
6683
  style: "normal",
6005
6684
  weight: "800",
6006
6685
  display: "swap",
6007
- unicodeRange: j
6686
+ unicodeRange: E
6008
6687
  }
6009
6688
  },
6010
6689
  {
@@ -6014,7 +6693,7 @@ const w = [
6014
6693
  style: "normal",
6015
6694
  weight: "800",
6016
6695
  display: "swap",
6017
- unicodeRange: w
6696
+ unicodeRange: T
6018
6697
  }
6019
6698
  },
6020
6699
  {
@@ -6024,7 +6703,7 @@ const w = [
6024
6703
  style: "normal",
6025
6704
  weight: "900",
6026
6705
  display: "swap",
6027
- unicodeRange: j
6706
+ unicodeRange: E
6028
6707
  }
6029
6708
  },
6030
6709
  {
@@ -6034,7 +6713,7 @@ const w = [
6034
6713
  style: "normal",
6035
6714
  weight: "900",
6036
6715
  display: "swap",
6037
- unicodeRange: w
6716
+ unicodeRange: T
6038
6717
  }
6039
6718
  },
6040
6719
  {
@@ -6044,7 +6723,7 @@ const w = [
6044
6723
  style: "normal",
6045
6724
  weight: "400",
6046
6725
  display: "swap",
6047
- unicodeRange: j
6726
+ unicodeRange: E
6048
6727
  }
6049
6728
  },
6050
6729
  {
@@ -6054,7 +6733,7 @@ const w = [
6054
6733
  style: "normal",
6055
6734
  weight: "400",
6056
6735
  display: "swap",
6057
- unicodeRange: w
6736
+ unicodeRange: T
6058
6737
  }
6059
6738
  },
6060
6739
  {
@@ -6064,7 +6743,7 @@ const w = [
6064
6743
  style: "normal",
6065
6744
  weight: "700",
6066
6745
  display: "swap",
6067
- unicodeRange: j
6746
+ unicodeRange: E
6068
6747
  }
6069
6748
  },
6070
6749
  {
@@ -6074,7 +6753,7 @@ const w = [
6074
6753
  style: "normal",
6075
6754
  weight: "700",
6076
6755
  display: "swap",
6077
- unicodeRange: w
6756
+ unicodeRange: T
6078
6757
  }
6079
6758
  },
6080
6759
  {
@@ -6084,7 +6763,7 @@ const w = [
6084
6763
  style: "normal",
6085
6764
  weight: "100 900",
6086
6765
  display: "swap",
6087
- unicodeRange: j
6766
+ unicodeRange: E
6088
6767
  }
6089
6768
  },
6090
6769
  {
@@ -6094,7 +6773,7 @@ const w = [
6094
6773
  style: "normal",
6095
6774
  weight: "100 900",
6096
6775
  display: "swap",
6097
- unicodeRange: w
6776
+ unicodeRange: T
6098
6777
  }
6099
6778
  },
6100
6779
  {
@@ -6104,7 +6783,7 @@ const w = [
6104
6783
  style: "normal",
6105
6784
  weight: "300 700",
6106
6785
  display: "swap",
6107
- unicodeRange: j
6786
+ unicodeRange: E
6108
6787
  }
6109
6788
  },
6110
6789
  {
@@ -6114,7 +6793,7 @@ const w = [
6114
6793
  style: "normal",
6115
6794
  weight: "300 700",
6116
6795
  display: "swap",
6117
- unicodeRange: w
6796
+ unicodeRange: T
6118
6797
  }
6119
6798
  },
6120
6799
  {
@@ -6124,7 +6803,7 @@ const w = [
6124
6803
  style: "normal",
6125
6804
  weight: "400",
6126
6805
  display: "swap",
6127
- unicodeRange: j
6806
+ unicodeRange: E
6128
6807
  }
6129
6808
  },
6130
6809
  {
@@ -6134,7 +6813,7 @@ const w = [
6134
6813
  style: "normal",
6135
6814
  weight: "400",
6136
6815
  display: "swap",
6137
- unicodeRange: w
6816
+ unicodeRange: T
6138
6817
  }
6139
6818
  },
6140
6819
  {
@@ -6144,7 +6823,7 @@ const w = [
6144
6823
  style: "normal",
6145
6824
  weight: "200 800",
6146
6825
  display: "swap",
6147
- unicodeRange: j
6826
+ unicodeRange: E
6148
6827
  }
6149
6828
  },
6150
6829
  {
@@ -6154,7 +6833,7 @@ const w = [
6154
6833
  style: "normal",
6155
6834
  weight: "200 800",
6156
6835
  display: "swap",
6157
- unicodeRange: w
6836
+ unicodeRange: T
6158
6837
  }
6159
6838
  },
6160
6839
  {
@@ -6164,7 +6843,7 @@ const w = [
6164
6843
  style: "normal",
6165
6844
  weight: "100 900",
6166
6845
  display: "swap",
6167
- unicodeRange: j
6846
+ unicodeRange: E
6168
6847
  }
6169
6848
  },
6170
6849
  {
@@ -6174,7 +6853,7 @@ const w = [
6174
6853
  style: "normal",
6175
6854
  weight: "100 900",
6176
6855
  display: "swap",
6177
- unicodeRange: w
6856
+ unicodeRange: T
6178
6857
  }
6179
6858
  },
6180
6859
  {
@@ -6184,7 +6863,7 @@ const w = [
6184
6863
  style: "normal",
6185
6864
  weight: "400",
6186
6865
  display: "swap",
6187
- unicodeRange: j
6866
+ unicodeRange: E
6188
6867
  }
6189
6868
  },
6190
6869
  {
@@ -6194,7 +6873,7 @@ const w = [
6194
6873
  style: "normal",
6195
6874
  weight: "400",
6196
6875
  display: "swap",
6197
- unicodeRange: w
6876
+ unicodeRange: T
6198
6877
  }
6199
6878
  },
6200
6879
  {
@@ -6204,7 +6883,7 @@ const w = [
6204
6883
  style: "normal",
6205
6884
  weight: "100 900",
6206
6885
  display: "swap",
6207
- unicodeRange: j
6886
+ unicodeRange: E
6208
6887
  }
6209
6888
  },
6210
6889
  {
@@ -6214,7 +6893,7 @@ const w = [
6214
6893
  style: "normal",
6215
6894
  weight: "100 900",
6216
6895
  display: "swap",
6217
- unicodeRange: w
6896
+ unicodeRange: T
6218
6897
  }
6219
6898
  },
6220
6899
  {
@@ -6224,7 +6903,7 @@ const w = [
6224
6903
  style: "normal",
6225
6904
  weight: "300 800",
6226
6905
  display: "swap",
6227
- unicodeRange: j
6906
+ unicodeRange: E
6228
6907
  }
6229
6908
  },
6230
6909
  {
@@ -6234,7 +6913,7 @@ const w = [
6234
6913
  style: "normal",
6235
6914
  weight: "300 800",
6236
6915
  display: "swap",
6237
- unicodeRange: w
6916
+ unicodeRange: T
6238
6917
  }
6239
6918
  },
6240
6919
  {
@@ -6244,7 +6923,7 @@ const w = [
6244
6923
  style: "normal",
6245
6924
  weight: "400",
6246
6925
  display: "swap",
6247
- unicodeRange: j
6926
+ unicodeRange: E
6248
6927
  }
6249
6928
  },
6250
6929
  {
@@ -6254,7 +6933,7 @@ const w = [
6254
6933
  style: "normal",
6255
6934
  weight: "400",
6256
6935
  display: "swap",
6257
- unicodeRange: w
6936
+ unicodeRange: T
6258
6937
  }
6259
6938
  },
6260
6939
  {
@@ -6264,7 +6943,7 @@ const w = [
6264
6943
  style: "normal",
6265
6944
  weight: "700",
6266
6945
  display: "swap",
6267
- unicodeRange: j
6946
+ unicodeRange: E
6268
6947
  }
6269
6948
  },
6270
6949
  {
@@ -6274,7 +6953,7 @@ const w = [
6274
6953
  style: "normal",
6275
6954
  weight: "700",
6276
6955
  display: "swap",
6277
- unicodeRange: w
6956
+ unicodeRange: T
6278
6957
  }
6279
6958
  },
6280
6959
  {
@@ -6284,7 +6963,7 @@ const w = [
6284
6963
  style: "normal",
6285
6964
  weight: "300 900",
6286
6965
  display: "swap",
6287
- unicodeRange: j
6966
+ unicodeRange: E
6288
6967
  }
6289
6968
  },
6290
6969
  {
@@ -6294,7 +6973,7 @@ const w = [
6294
6973
  style: "normal",
6295
6974
  weight: "300 900",
6296
6975
  display: "swap",
6297
- unicodeRange: w
6976
+ unicodeRange: T
6298
6977
  }
6299
6978
  },
6300
6979
  {
@@ -6304,7 +6983,7 @@ const w = [
6304
6983
  style: "normal",
6305
6984
  weight: "400",
6306
6985
  display: "swap",
6307
- unicodeRange: j
6986
+ unicodeRange: E
6308
6987
  }
6309
6988
  },
6310
6989
  {
@@ -6314,7 +6993,7 @@ const w = [
6314
6993
  style: "normal",
6315
6994
  weight: "400",
6316
6995
  display: "swap",
6317
- unicodeRange: w
6996
+ unicodeRange: T
6318
6997
  }
6319
6998
  },
6320
6999
  {
@@ -6324,7 +7003,7 @@ const w = [
6324
7003
  style: "normal",
6325
7004
  weight: "100 900",
6326
7005
  display: "swap",
6327
- unicodeRange: j
7006
+ unicodeRange: E
6328
7007
  }
6329
7008
  },
6330
7009
  {
@@ -6334,7 +7013,7 @@ const w = [
6334
7013
  style: "normal",
6335
7014
  weight: "100 900",
6336
7015
  display: "swap",
6337
- unicodeRange: w
7016
+ unicodeRange: T
6338
7017
  }
6339
7018
  },
6340
7019
  {
@@ -6344,7 +7023,7 @@ const w = [
6344
7023
  style: "normal",
6345
7024
  weight: "100 900",
6346
7025
  display: "swap",
6347
- unicodeRange: j
7026
+ unicodeRange: E
6348
7027
  }
6349
7028
  },
6350
7029
  {
@@ -6354,10 +7033,10 @@ const w = [
6354
7033
  style: "normal",
6355
7034
  weight: "100 900",
6356
7035
  display: "swap",
6357
- unicodeRange: w
7036
+ unicodeRange: T
6358
7037
  }
6359
7038
  }
6360
- ], Ys = {
7039
+ ], ao = {
6361
7040
  /**
6362
7041
  * Опции редактора
6363
7042
  */
@@ -6449,20 +7128,20 @@ const w = [
6449
7128
  /**
6450
7129
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
6451
7130
  */
6452
- fonts: zs
7131
+ fonts: io
6453
7132
  };
6454
- function Zs(d, t = {}) {
6455
- const e = k(k({}, Ys), t), s = document.getElementById(d);
7133
+ function uo(d, t = {}) {
7134
+ const e = x(x({}, ao), t), s = document.getElementById(d);
6456
7135
  if (!s)
6457
7136
  return Promise.reject(new Error(`Контейнер с ID "${d}" не найден.`));
6458
7137
  const o = document.createElement("canvas");
6459
7138
  return o.id = `${d}-canvas`, s.appendChild(o), e.editorContainer = s, new Promise((n) => {
6460
7139
  e._onReadyCallback = n;
6461
- const i = new le(o.id, e);
7140
+ const i = new ue(o.id, e);
6462
7141
  window[d] = i;
6463
7142
  });
6464
7143
  }
6465
7144
  export {
6466
- Zs as default
7145
+ uo as default
6467
7146
  };
6468
7147
  //# sourceMappingURL=main.js.map