@anu3ev/fabric-image-editor 0.1.45 → 0.1.46

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 +824 -954
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,48 +1,48 @@
1
- var Le = Object.defineProperty;
2
- var X = Object.getOwnPropertySymbols;
3
- var ve = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
4
- var me = (o, e, t) => e in o ? Le(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, C = (o, e) => {
1
+ var fe = Object.defineProperty;
2
+ var _ = Object.getOwnPropertySymbols;
3
+ var re = Object.prototype.hasOwnProperty, ce = Object.prototype.propertyIsEnumerable;
4
+ var oe = (r, e, t) => e in r ? fe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, N = (r, e) => {
5
5
  for (var t in e || (e = {}))
6
- ve.call(e, t) && me(o, t, e[t]);
7
- if (X)
8
- for (var t of X(e))
9
- fe.call(e, t) && me(o, t, e[t]);
10
- return o;
6
+ re.call(e, t) && oe(r, t, e[t]);
7
+ if (_)
8
+ for (var t of _(e))
9
+ ce.call(e, t) && oe(r, t, e[t]);
10
+ return r;
11
11
  };
12
- var Q = (o, e) => {
12
+ var Y = (r, e) => {
13
13
  var t = {};
14
- for (var a in o)
15
- ve.call(o, a) && e.indexOf(a) < 0 && (t[a] = o[a]);
16
- if (o != null && X)
17
- for (var a of X(o))
18
- e.indexOf(a) < 0 && fe.call(o, a) && (t[a] = o[a]);
14
+ for (var a in r)
15
+ re.call(r, a) && e.indexOf(a) < 0 && (t[a] = r[a]);
16
+ if (r != null && _)
17
+ for (var a of _(r))
18
+ e.indexOf(a) < 0 && ce.call(r, a) && (t[a] = r[a]);
19
19
  return t;
20
20
  };
21
- var O = (o, e, t) => new Promise((a, n) => {
21
+ var b = (r, e, t) => new Promise((a, s) => {
22
22
  var i = (c) => {
23
23
  try {
24
- r(t.next(c));
25
- } catch (u) {
26
- n(u);
24
+ o(t.next(c));
25
+ } catch (d) {
26
+ s(d);
27
27
  }
28
- }, s = (c) => {
28
+ }, n = (c) => {
29
29
  try {
30
- r(t.throw(c));
31
- } catch (u) {
32
- n(u);
30
+ o(t.throw(c));
31
+ } catch (d) {
32
+ s(d);
33
33
  }
34
- }, r = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(i, s);
35
- r((t = t.apply(o, e)).next());
34
+ }, o = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(i, n);
35
+ o((t = t.apply(r, e)).next());
36
36
  });
37
- import { ActiveSelection as N, util as W, controlsUtils as we, InteractiveFabricObject as Oe, loadSVGFromURL as Te, FabricImage as ee, Point as K, Rect as ke, Circle as xe, Triangle as Be, Group as je, Canvas as Ze, Pattern as ze } from "fabric";
38
- import { create as Ue } from "jsondiffpatch";
39
- import Re from "diff-match-patch";
40
- var _e = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", A = function() {
37
+ import { ActiveSelection as E, util as H, controlsUtils as ve, InteractiveFabricObject as be, loadSVGFromURL as ye, FabricImage as Z, Point as W, Rect as pe, Circle as Ie, Triangle as Ae, Group as de, Canvas as Se, Pattern as Ce } from "fabric";
38
+ import { create as De } from "jsondiffpatch";
39
+ import we from "diff-match-patch";
40
+ var Le = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", D = function() {
41
41
  for (var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, t = "", a = crypto.getRandomValues(new Uint8Array(e |= 0)); e--; )
42
- t += _e[a[e] & 63];
42
+ t += Le[a[e] & 63];
43
43
  return t;
44
44
  };
45
- class P {
45
+ class R {
46
46
  /**
47
47
  * Конструктор принимает редактор и опции.
48
48
  * @param {Object} params
@@ -59,7 +59,7 @@ class P {
59
59
  * @param {Boolean} [params.options.resetObjectFitByDoubleClick] — сброс фита объекта по двойному клику
60
60
  */
61
61
  constructor({ editor: e, options: t = {} }) {
62
- this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, 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 = e, this.canvas = e.canvas, this.options = t, this.handleContainerResizeBound = P.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 = P.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = P.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.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();
62
+ this.isDragging = !1, this.lastMouseX = 0, this.lastMouseY = 0, this.isUndoRedoKeyPressed = !1, this.isSpacePressed = !1, 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 = e, this.canvas = e.canvas, this.options = t, this.handleContainerResizeBound = R.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 = R.debounce(this.handleObjectModifiedHistory.bind(this), 300), this.handleObjectRotatingHistoryBound = R.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.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();
63
63
  }
64
64
  /**
65
65
  * Инициализация всех обработчиков согласно опциям.
@@ -69,15 +69,15 @@ class P {
69
69
  adaptCanvasToContainerOnResize: e,
70
70
  canvasDragging: t,
71
71
  mouseWheelZooming: a,
72
- bringToFrontOnSelection: n,
72
+ bringToFrontOnSelection: s,
73
73
  copyObjectsByHotkey: i,
74
- pasteImageFromClipboard: s,
75
- undoRedoByHotKeys: r,
74
+ pasteImageFromClipboard: n,
75
+ undoRedoByHotKeys: o,
76
76
  selectAllByHotkey: c,
77
- deleteObjectsByHotkey: u,
77
+ deleteObjectsByHotkey: d,
78
78
  resetObjectFitByDoubleClick: l
79
79
  } = this.options;
80
- t && (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 })), a && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), n && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), e && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), i && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), s && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), r && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), c && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), u && 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);
80
+ t && (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 })), a && this.canvas.on("mouse:wheel", this.handleMouseWheelZoomBound), s && (this.canvas.on("selection:created", this.handleBringToFrontBound), this.canvas.on("selection:updated", this.handleBringToFrontBound)), l && this.canvas.on("mouse:dblclick", this.handleResetObjectFitBound), e && window.addEventListener("resize", this.handleContainerResizeBound, { capture: !0 }), i && document.addEventListener("keydown", this.handleCopyEventBound, { capture: !0 }), n && document.addEventListener("paste", this.handlePasteEventBound, { capture: !0 }), o && (document.addEventListener("keydown", this.handleUndoRedoEventBound, { capture: !0 }), document.addEventListener("keyup", this.handleUndoRedoKeyUpBound, { capture: !0 })), c && document.addEventListener("keydown", this.handleSelectAllEventBound, { capture: !0 }), d && 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);
81
81
  }
82
82
  /**
83
83
  * При массовом выделении объектов удаляем из него залоченные.
@@ -86,17 +86,17 @@ class P {
86
86
  * @param {TPointerEvent} [params.e] - событие указателя (опционально)
87
87
  */
88
88
  _filterLockedSelection({ selected: e, e: t }) {
89
- if (!(e != null && e.length) || !(t instanceof MouseEvent) || e.length === 1 || !e.some((s) => s.locked)) return;
90
- const n = e.filter((s) => !s.locked);
91
- if (n.length === 0) {
89
+ if (!(e != null && e.length) || !(t instanceof MouseEvent) || e.length === 1 || !e.some((n) => n.locked)) return;
90
+ const s = e.filter((n) => !n.locked);
91
+ if (s.length === 0) {
92
92
  this.canvas.discardActiveObject();
93
93
  return;
94
94
  }
95
- if (n.length === 1) {
96
- this.canvas.setActiveObject(n[0]);
95
+ if (s.length === 1) {
96
+ this.canvas.setActiveObject(s[0]);
97
97
  return;
98
98
  }
99
- const i = new N(n, {
99
+ const i = new E(s, {
100
100
  canvas: this.canvas
101
101
  });
102
102
  this.canvas.setActiveObject(i), this.canvas.requestRenderAll();
@@ -140,8 +140,8 @@ class P {
140
140
  * @param {String} event.code — код клавиши
141
141
  */
142
142
  handleCopyEvent(e) {
143
- const { ctrlKey: t, metaKey: a, code: n } = e;
144
- !t && !a || n !== "KeyC" || (e.preventDefault(), this.editor.clipboardManager.copy());
143
+ const { ctrlKey: t, metaKey: a, code: s } = e;
144
+ !t && !a || s !== "KeyC" || (e.preventDefault(), this.editor.clipboardManager.copy());
145
145
  }
146
146
  /**
147
147
  * Обработчик вставки объекта или изображения из буфера обмена.
@@ -158,9 +158,9 @@ class P {
158
158
  * @param {String} event.code — код клавиши
159
159
  */
160
160
  handleUndoRedoEvent(e) {
161
- return O(this, null, function* () {
162
- const { ctrlKey: t, metaKey: a, code: n, repeat: i } = e;
163
- !t && !a || i || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (n === "KeyZ" ? (e.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : n === "KeyY" && (e.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
161
+ return b(this, null, function* () {
162
+ const { ctrlKey: t, metaKey: a, code: s, repeat: i } = e;
163
+ !t && !a || i || !/Mac/i.test(navigator.userAgent) && this.isUndoRedoKeyPressed || (s === "KeyZ" ? (e.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.undo()) : s === "KeyY" && (e.preventDefault(), this.isUndoRedoKeyPressed = !0, yield this.editor.historyManager.redo()));
164
164
  });
165
165
  }
166
166
  /**
@@ -179,8 +179,8 @@ class P {
179
179
  * @param {String} event.code — код клавиши
180
180
  */
181
181
  handleSelectAllEvent(e) {
182
- const { ctrlKey: t, metaKey: a, code: n } = e;
183
- !t && !a || n !== "KeyA" || (e.preventDefault(), this.editor.selectionManager.selectAll());
182
+ const { ctrlKey: t, metaKey: a, code: s } = e;
183
+ !t && !a || s !== "KeyA" || (e.preventDefault(), this.editor.selectionManager.selectAll());
184
184
  }
185
185
  /**
186
186
  * Обработчик для удаления объектов (Delete).
@@ -198,12 +198,12 @@ class P {
198
198
  */
199
199
  handleSpaceKeyDown(e) {
200
200
  if (e.code !== "Space") return;
201
- const { canvas: t, editor: a, isSpacePressed: n, isDragging: i } = this;
202
- n || i || (this.isSpacePressed = !0, e.preventDefault(), t.set({
201
+ const { canvas: t, editor: a, isSpacePressed: s, isDragging: i } = this;
202
+ s || i || (this.isSpacePressed = !0, e.preventDefault(), t.set({
203
203
  selection: !1,
204
204
  defaultCursor: "grab"
205
- }), t.setCursor("grab"), a.canvasManager.getObjects().forEach((s) => {
206
- s.set({
205
+ }), t.setCursor("grab"), a.canvasManager.getObjects().forEach((n) => {
206
+ n.set({
207
207
  selectable: !1,
208
208
  evented: !1
209
209
  });
@@ -297,14 +297,14 @@ class P {
297
297
  */
298
298
  static debounce(e, t) {
299
299
  let a = null;
300
- return function(...n) {
300
+ return function(...s) {
301
301
  a !== null && clearTimeout(a), a = setTimeout(() => {
302
- e.apply(this, n);
302
+ e.apply(this, s);
303
303
  }, t);
304
304
  };
305
305
  }
306
306
  }
307
- class He {
307
+ class Ne {
308
308
  /**
309
309
  * @description Класс для динамической загрузки внешних модулей.
310
310
  */
@@ -322,7 +322,7 @@ class He {
322
322
  return this.loaders[e] ? (this.cache.has(e) || this.cache.set(e, this.loaders[e]()), this.cache.get(e)) : Promise.reject(new Error('Unknown module "'.concat(e, '"')));
323
323
  }
324
324
  }
325
- class Ye {
325
+ class Ee {
326
326
  /**
327
327
  * @param {string|URL} [scriptUrl] — URL скрипта воркера.
328
328
  * По-умолчанию использует файл рядом с этим модулем
@@ -348,11 +348,11 @@ class Ye {
348
348
  data: t
349
349
  } = e, {
350
350
  requestId: a,
351
- success: n,
351
+ success: s,
352
352
  data: i,
353
- error: s
354
- } = t, r = this._callbacks.get(a);
355
- r && (n ? r.resolve(i) : r.reject(new Error(s)), this._callbacks.delete(a));
353
+ error: n
354
+ } = t, o = this._callbacks.get(a);
355
+ o && (s ? o.resolve(i) : o.reject(new Error(n)), this._callbacks.delete(a));
356
356
  }
357
357
  /**
358
358
  * Универсальный метод отправки команды в воркер
@@ -362,15 +362,15 @@ class Ye {
362
362
  * @returns {Promise<any>}
363
363
  */
364
364
  post(e, t) {
365
- var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [], n = "".concat(e, ":").concat(A(8));
366
- return new Promise((i, s) => {
367
- this._callbacks.set(n, {
365
+ var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [], s = "".concat(e, ":").concat(D(8));
366
+ return new Promise((i, n) => {
367
+ this._callbacks.set(s, {
368
368
  resolve: i,
369
- reject: s
369
+ reject: n
370
370
  }), this.worker.postMessage({
371
371
  action: e,
372
372
  payload: t,
373
- requestId: n
373
+ requestId: s
374
374
  }, a);
375
375
  });
376
376
  }
@@ -381,136 +381,136 @@ class Ye {
381
381
  this.worker.terminate();
382
382
  }
383
383
  }
384
- const I = 12, Pe = 2, te = 8, ae = 20, We = 100, ne = 20, ie = 8, Fe = 100, se = 32, re = 1, Ve = "#2B2D33", oe = "#3D8BF4", ce = "#FFFFFF";
385
- function J(o, e, t, a, n) {
386
- const i = I, s = Pe;
387
- o.save(), o.translate(e, t), o.rotate(W.degreesToRadians(n.angle)), o.fillStyle = ce, o.strokeStyle = oe, o.lineWidth = re, o.beginPath(), o.roundRect(-12 / 2, -12 / 2, i, i, s), o.fill(), o.stroke(), o.restore();
384
+ const S = 12, Oe = 2, X = 8, Q = 20, Te = 100, J = 20, $ = 8, ke = 100, K = 32, q = 1, xe = "#2B2D33", ee = "#3D8BF4", te = "#FFFFFF";
385
+ function P(r, e, t, a, s) {
386
+ const i = S, n = Oe;
387
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(s.angle)), r.fillStyle = te, r.strokeStyle = ee, r.lineWidth = q, r.beginPath(), r.roundRect(-12 / 2, -12 / 2, i, i, n), r.fill(), r.stroke(), r.restore();
388
388
  }
389
- function ye(o, e, t, a, n) {
390
- const i = te, s = ae, r = We;
391
- o.save(), o.translate(e, t), o.rotate(W.degreesToRadians(n.angle)), o.fillStyle = ce, o.strokeStyle = oe, o.lineWidth = re, o.beginPath(), o.roundRect(-8 / 2, -20 / 2, i, s, r), o.fill(), o.stroke(), o.restore();
389
+ function le(r, e, t, a, s) {
390
+ const i = X, n = Q, o = Te;
391
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(s.angle)), r.fillStyle = te, r.strokeStyle = ee, r.lineWidth = q, r.beginPath(), r.roundRect(-8 / 2, -20 / 2, i, n, o), r.fill(), r.stroke(), r.restore();
392
392
  }
393
- function be(o, e, t, a, n) {
394
- const i = ne, s = ie, r = Fe;
395
- o.save(), o.translate(e, t), o.rotate(W.degreesToRadians(n.angle)), o.fillStyle = ce, o.strokeStyle = oe, o.lineWidth = re, o.beginPath(), o.roundRect(-20 / 2, -8 / 2, i, s, r), o.fill(), o.stroke(), o.restore();
393
+ function he(r, e, t, a, s) {
394
+ const i = J, n = $, o = ke;
395
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(s.angle)), r.fillStyle = te, r.strokeStyle = ee, r.lineWidth = q, r.beginPath(), r.roundRect(-20 / 2, -8 / 2, i, n, o), r.fill(), r.stroke(), r.restore();
396
396
  }
397
- const Ge = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Se = new Image();
398
- Se.src = Ge;
399
- function Xe(o, e, t, a, n) {
400
- const s = se / 2;
401
- o.save(), o.translate(e, t), o.rotate(W.degreesToRadians(n.angle)), o.fillStyle = Ve, o.beginPath(), o.arc(0, 0, s, 0, 2 * Math.PI), o.fill(), o.drawImage(Se, -16 / 2, -16 / 2, s, s), o.restore();
397
+ const Be = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Me = new Image();
398
+ Me.src = Be;
399
+ function Ue(r, e, t, a, s) {
400
+ const n = K / 2;
401
+ r.save(), r.translate(e, t), r.rotate(H.degreesToRadians(s.angle)), r.fillStyle = xe, r.beginPath(), r.arc(0, 0, n, 0, 2 * Math.PI), r.fill(), r.drawImage(Me, -16 / 2, -16 / 2, n, n), r.restore();
402
402
  }
403
- const Qe = {
403
+ const Ze = {
404
404
  // Угловые точки
405
405
  tl: {
406
- render: J,
407
- sizeX: I,
408
- sizeY: I,
406
+ render: P,
407
+ sizeX: S,
408
+ sizeY: S,
409
409
  offsetX: 0,
410
410
  offsetY: 0
411
411
  },
412
412
  tr: {
413
- render: J,
414
- sizeX: I,
415
- sizeY: I,
413
+ render: P,
414
+ sizeX: S,
415
+ sizeY: S,
416
416
  offsetX: 0,
417
417
  offsetY: 0
418
418
  },
419
419
  bl: {
420
- render: J,
421
- sizeX: I,
422
- sizeY: I,
420
+ render: P,
421
+ sizeX: S,
422
+ sizeY: S,
423
423
  offsetX: 0,
424
424
  offsetY: 0
425
425
  },
426
426
  br: {
427
- render: J,
428
- sizeX: I,
429
- sizeY: I,
427
+ render: P,
428
+ sizeX: S,
429
+ sizeY: S,
430
430
  offsetX: 0,
431
431
  offsetY: 0
432
432
  },
433
433
  // Середина вертикалей
434
434
  ml: {
435
- render: ye,
436
- sizeX: te,
437
- sizeY: ae,
435
+ render: le,
436
+ sizeX: X,
437
+ sizeY: Q,
438
438
  offsetX: 0,
439
439
  offsetY: 0
440
440
  },
441
441
  mr: {
442
- render: ye,
443
- sizeX: te,
444
- sizeY: ae,
442
+ render: le,
443
+ sizeX: X,
444
+ sizeY: Q,
445
445
  offsetX: 0,
446
446
  offsetY: 0
447
447
  },
448
448
  // Середина горизонталей
449
449
  mt: {
450
- render: be,
451
- sizeX: ne,
452
- sizeY: ie,
450
+ render: he,
451
+ sizeX: J,
452
+ sizeY: $,
453
453
  offsetX: 0,
454
454
  offsetY: 0
455
455
  },
456
456
  mb: {
457
- render: be,
458
- sizeX: ne,
459
- sizeY: ie,
457
+ render: he,
458
+ sizeX: J,
459
+ sizeY: $,
460
460
  offsetX: 0,
461
461
  offsetY: 0
462
462
  },
463
463
  // Специальный «rotate» контрол
464
464
  mtr: {
465
- render: Xe,
466
- sizeX: se,
467
- sizeY: se,
465
+ render: Ue,
466
+ sizeX: K,
467
+ sizeY: K,
468
468
  offsetX: 0,
469
469
  offsetY: -32
470
470
  }
471
471
  };
472
- class Je {
472
+ class ze {
473
473
  static apply() {
474
- const e = we.createObjectDefaultControls();
475
- Object.entries(Qe).forEach(([t, a]) => {
474
+ const e = ve.createObjectDefaultControls();
475
+ Object.entries(Ze).forEach(([t, a]) => {
476
476
  Object.assign(e[t], {
477
477
  render: a.render,
478
478
  sizeX: a.sizeX,
479
479
  sizeY: a.sizeY,
480
480
  offsetX: a.offsetX,
481
481
  offsetY: a.offsetY
482
- }), t === "mtr" && (e[t].cursorStyle = "grab", e[t].mouseDownHandler = (i, s, r, c) => {
482
+ }), t === "mtr" && (e[t].cursorStyle = "grab", e[t].mouseDownHandler = (i, n, o, c) => {
483
483
  var l;
484
- (l = s.target.canvas) == null || l.setCursor("grabbing");
484
+ (l = n.target.canvas) == null || l.setCursor("grabbing");
485
485
  });
486
- }), Oe.ownDefaults.controls = e;
486
+ }), be.ownDefaults.controls = e;
487
487
  }
488
488
  }
489
- var Ke = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42Mj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jI1aC42MjV2MTEuMjVBMS4yNSAxLjI1IDAgMCAwIDUgMTcuNWgxMGExLjI1IDEuMjUgMCAwIDAgMS4yNS0xLjI1VjVoLjYyNWEuNjI1LjYyNSAwIDAgMCAwLTEuMjVIMTMuNzV2LS42MjVhMS44NzUgMS44NzUgMCAwIDAtMS44NzUtMS44NzVoLTMuNzVabTQuMzc1IDIuNXYtLjYyNWEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2LjYyNWg1Wk01IDE2LjI1VjVoMTB2MTEuMjVINVpNOC4xMjUgNy41Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NWEuNjI1LjYyNSAwIDEgMS0xLjI1IDB2LTVjMC0uMzQ1LjI4LS42MjUuNjI1LS42MjVabTQuMzc1IDUuNjI1di01YS42MjUuNjI1IDAgMCAwLTEuMjUgMHY1YS42MjUuNjI1IDAgMSAwIDEuMjUgMFoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==";
490
+ function ge(r, e, t, a, s, i, n) {
491
491
  try {
492
- var r = o[i](s), c = r.value;
493
- } catch (u) {
494
- return void t(u);
492
+ var o = r[i](n), c = o.value;
493
+ } catch (d) {
494
+ return void t(d);
495
495
  }
496
- r.done ? e(c) : Promise.resolve(c).then(a, n);
496
+ o.done ? e(c) : Promise.resolve(c).then(a, s);
497
497
  }
498
- function st(o) {
498
+ function Ge(r) {
499
499
  return function() {
500
500
  var e = this, t = arguments;
501
- return new Promise(function(a, n) {
502
- var i = o.apply(e, t);
503
- function s(c) {
504
- pe(i, a, n, s, r, "next", c);
501
+ return new Promise(function(a, s) {
502
+ var i = r.apply(e, t);
503
+ function n(c) {
504
+ ge(i, a, s, n, o, "next", c);
505
505
  }
506
- function r(c) {
507
- pe(i, a, n, s, r, "throw", c);
506
+ function o(c) {
507
+ ge(i, a, s, n, o, "throw", c);
508
508
  }
509
- s(void 0);
509
+ n(void 0);
510
510
  });
511
511
  };
512
512
  }
513
- const Y = {
513
+ const z = {
514
514
  style: {
515
515
  position: "absolute",
516
516
  display: "none",
@@ -569,87 +569,87 @@ const Y = {
569
569
  }],
570
570
  offsetTop: 50,
571
571
  icons: {
572
- copyPaste: Ke,
573
- delete: it,
574
- lock: $e,
575
- unlock: qe,
576
- bringToFront: at,
577
- sendToBack: nt,
578
- bringForward: et,
579
- sendBackwards: tt
572
+ copyPaste: Re,
573
+ delete: Ve,
574
+ lock: He,
575
+ unlock: _e,
576
+ bringToFront: We,
577
+ sendToBack: Fe,
578
+ bringForward: Ye,
579
+ sendBackwards: Pe
580
580
  },
581
581
  handlers: {
582
582
  copyPaste: function() {
583
- var o = st(function* (t) {
583
+ var r = Ge(function* (t) {
584
584
  yield t.clipboardManager.copy(), yield t.clipboardManager.paste();
585
585
  });
586
586
  function e(t) {
587
- return o.apply(this, arguments);
587
+ return r.apply(this, arguments);
588
588
  }
589
589
  return e;
590
590
  }(),
591
- delete: (o) => {
592
- o.deletionManager.deleteSelectedObjects();
591
+ delete: (r) => {
592
+ r.deletionManager.deleteSelectedObjects();
593
593
  },
594
- lock: (o) => {
595
- o.objectLockManager.lockObject();
594
+ lock: (r) => {
595
+ r.objectLockManager.lockObject();
596
596
  },
597
- unlock: (o) => {
598
- o.objectLockManager.unlockObject();
597
+ unlock: (r) => {
598
+ r.objectLockManager.unlockObject();
599
599
  },
600
- bringForward: (o) => {
601
- o.layerManager.bringForward();
600
+ bringForward: (r) => {
601
+ r.layerManager.bringForward();
602
602
  },
603
- bringToFront: (o) => {
604
- o.layerManager.bringToFront();
603
+ bringToFront: (r) => {
604
+ r.layerManager.bringToFront();
605
605
  },
606
- sendToBack: (o) => {
607
- o.layerManager.sendToBack();
606
+ sendToBack: (r) => {
607
+ r.layerManager.sendToBack();
608
608
  },
609
- sendBackwards: (o) => {
610
- o.layerManager.sendBackwards();
609
+ sendBackwards: (r) => {
610
+ r.layerManager.sendBackwards();
611
611
  }
612
612
  }
613
613
  };
614
- function Ie(o, e) {
615
- var t = Object.keys(o);
614
+ function ue(r, e) {
615
+ var t = Object.keys(r);
616
616
  if (Object.getOwnPropertySymbols) {
617
- var a = Object.getOwnPropertySymbols(o);
618
- e && (a = a.filter(function(n) {
619
- return Object.getOwnPropertyDescriptor(o, n).enumerable;
617
+ var a = Object.getOwnPropertySymbols(r);
618
+ e && (a = a.filter(function(s) {
619
+ return Object.getOwnPropertyDescriptor(r, s).enumerable;
620
620
  })), t.push.apply(t, a);
621
621
  }
622
622
  return t;
623
623
  }
624
- function j(o) {
624
+ function p(r) {
625
625
  for (var e = 1; e < arguments.length; e++) {
626
626
  var t = arguments[e] != null ? arguments[e] : {};
627
- e % 2 ? Ie(Object(t), !0).forEach(function(a) {
628
- rt(o, a, t[a]);
629
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(t)) : Ie(Object(t)).forEach(function(a) {
630
- Object.defineProperty(o, a, Object.getOwnPropertyDescriptor(t, a));
627
+ e % 2 ? ue(Object(t), !0).forEach(function(a) {
628
+ Xe(r, a, t[a]);
629
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : ue(Object(t)).forEach(function(a) {
630
+ Object.defineProperty(r, a, Object.getOwnPropertyDescriptor(t, a));
631
631
  });
632
632
  }
633
- return o;
633
+ return r;
634
634
  }
635
- function rt(o, e, t) {
636
- return (e = ot(e)) in o ? Object.defineProperty(o, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : o[e] = t, o;
635
+ function Xe(r, e, t) {
636
+ return (e = Qe(e)) in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
637
637
  }
638
- function ot(o) {
639
- var e = ct(o, "string");
638
+ function Qe(r) {
639
+ var e = Je(r, "string");
640
640
  return typeof e == "symbol" ? e : e + "";
641
641
  }
642
- function ct(o, e) {
643
- if (typeof o != "object" || !o) return o;
644
- var t = o[Symbol.toPrimitive];
642
+ function Je(r, e) {
643
+ if (typeof r != "object" || !r) return r;
644
+ var t = r[Symbol.toPrimitive];
645
645
  if (t !== void 0) {
646
- var a = t.call(o, e);
646
+ var a = t.call(r, e);
647
647
  if (typeof a != "object") return a;
648
648
  throw new TypeError("@@toPrimitive must return a primitive value.");
649
649
  }
650
- return (e === "string" ? String : Number)(o);
650
+ return (e === "string" ? String : Number)(r);
651
651
  }
652
- class ut {
652
+ class $e {
653
653
  /**
654
654
  * @param {object} options
655
655
  * @param {ImageEditor} options.editor - экземпляр редактора с доступом к canvas
@@ -661,11 +661,11 @@ class ut {
661
661
  if (this.options = t.options, !!this.options.showToolbar) {
662
662
  this.editor = t, this.canvas = t.canvas;
663
663
  var a = this.options.toolbar || {};
664
- this.config = j(j(j({}, Y), a), {}, {
665
- style: j(j({}, Y.style), a.style || {}),
666
- btnStyle: j(j({}, Y.btnStyle), a.btnStyle || {}),
667
- icons: j(j({}, Y.icons), a.icons || {}),
668
- handlers: j(j({}, Y.handlers), a.handlers || {})
664
+ this.config = p(p(p({}, z), a), {}, {
665
+ style: p(p({}, z.style), a.style || {}),
666
+ btnStyle: p(p({}, z.btnStyle), a.btnStyle || {}),
667
+ icons: p(p({}, z.icons), a.icons || {}),
668
+ handlers: p(p({}, z.handlers), a.handlers || {})
669
669
  }), this.currentTarget = null, this.currentLocked = null, 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 = () => {
670
670
  this.el.style.display = "none";
671
671
  }, this._createDOM(), this._bindEvents();
@@ -699,19 +699,19 @@ class ut {
699
699
  this.el.innerHTML = "";
700
700
  var a = function() {
701
701
  var {
702
- name: s,
703
- handle: r
704
- } = n, {
702
+ name: n,
703
+ handle: o
704
+ } = s, {
705
705
  icons: c,
706
- btnStyle: u,
706
+ btnStyle: d,
707
707
  handlers: l
708
- } = t.config, d = document.createElement("button");
709
- d.innerHTML = c[r] ? '<img src="'.concat(c[r], '" title="').concat(s, '" />') : s, Object.assign(d.style, u), d.onclick = () => {
710
- var h;
711
- return (h = l[r]) === null || h === void 0 ? void 0 : h.call(l, t.editor);
712
- }, t.el.appendChild(d);
708
+ } = t.config, h = document.createElement("button");
709
+ h.innerHTML = c[o] ? '<img src="'.concat(c[o], '" title="').concat(n, '" />') : n, Object.assign(h.style, d), h.onclick = () => {
710
+ var g;
711
+ return (g = l[o]) === null || g === void 0 ? void 0 : g.call(l, t.editor);
712
+ }, t.el.appendChild(h);
713
713
  };
714
- for (var n of e)
714
+ for (var s of e)
715
715
  a();
716
716
  }
717
717
  /**
@@ -778,18 +778,18 @@ class ut {
778
778
  var {
779
779
  el: t,
780
780
  config: a,
781
- canvas: n
781
+ canvas: s
782
782
  } = this;
783
783
  e.setCoords();
784
- var i = n.getZoom(), [, , , , s, r] = n.viewportTransform, {
784
+ var i = s.getZoom(), [, , , , n, o] = s.viewportTransform, {
785
785
  x: c
786
786
  } = e.getCenterPoint(), {
787
- top: u,
787
+ top: d,
788
788
  height: l
789
- } = e.getBoundingRect(!1, !0), d = c * i + s, h = d - t.offsetWidth / 2, g = (u + l) * i + r + a.offsetTop;
789
+ } = e.getBoundingRect(!1, !0), h = c * i + n, g = h - t.offsetWidth / 2, u = (d + l) * i + o + a.offsetTop;
790
790
  Object.assign(t.style, {
791
- left: "".concat(h, "px"),
792
- top: "".concat(g, "px"),
791
+ left: "".concat(g, "px"),
792
+ top: "".concat(u, "px"),
793
793
  display: "flex"
794
794
  });
795
795
  }
@@ -801,7 +801,7 @@ class ut {
801
801
  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("selection:changed", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
802
802
  }
803
803
  }
804
- class dt {
804
+ class Ke {
805
805
  constructor({ editor: e }) {
806
806
  this.editor = e, this.canvas = e.canvas, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = e.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
807
807
  }
@@ -813,7 +813,7 @@ class dt {
813
813
  return this.patches[this.currentIndex - 1] || null;
814
814
  }
815
815
  _createDiffPatcher() {
816
- this.diffPatcher = Ue({
816
+ this.diffPatcher = De({
817
817
  objectHash(e) {
818
818
  const t = e;
819
819
  return [
@@ -837,7 +837,7 @@ class dt {
837
837
  includeValueOnMove: !1
838
838
  },
839
839
  textDiff: {
840
- diffMatchPatch: Re,
840
+ diffMatchPatch: we,
841
841
  minLength: 60
842
842
  }
843
843
  });
@@ -869,10 +869,10 @@ class dt {
869
869
  */
870
870
  getFullState() {
871
871
  const { baseState: e, currentIndex: t, patches: a } = this;
872
- let n = JSON.parse(JSON.stringify(e));
872
+ let s = JSON.parse(JSON.stringify(e));
873
873
  for (let i = 0; i < t; i += 1)
874
- n = this.diffPatcher.patch(n, a[i].diff);
875
- return console.log("getFullState state", n), n;
874
+ s = this.diffPatcher.patch(s, a[i].diff);
875
+ return console.log("getFullState state", s), s;
876
876
  }
877
877
  /**
878
878
  * Сохраняем текущее состояние в виде диффа от последнего сохранённого полного состояния.
@@ -905,7 +905,7 @@ class dt {
905
905
  console.log("Нет изменений для сохранения.");
906
906
  return;
907
907
  }
908
- console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", a), this.totalChangesCount += 1, this.patches.push({ id: A(), diff: a }), 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);
908
+ console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", a), this.totalChangesCount += 1, this.patches.push({ id: D(), diff: a }), 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);
909
909
  }
910
910
  /**
911
911
  * Функция загрузки состояния в канвас.
@@ -913,15 +913,15 @@ class dt {
913
913
  * @fires editor:history-state-loaded
914
914
  */
915
915
  loadStateFromFullState(e) {
916
- return O(this, null, function* () {
916
+ return b(this, null, function* () {
917
917
  if (!e) return;
918
918
  console.log("loadStateFromFullState fullState", e);
919
- const { canvas: t, canvasManager: a, interactionBlocker: n } = this.editor, { width: i, height: s } = t;
919
+ const { canvas: t, canvasManager: a, interactionBlocker: s } = this.editor, { width: i, height: n } = t;
920
920
  yield t.loadFromJSON(e);
921
- const r = t.getObjects().find((u) => u.id === "montage-area");
922
- r && (this.editor.montageArea = r, (i !== e.width || s !== e.height) && a.updateCanvasAndFitObjects());
923
- const c = t.getObjects().find((u) => u.id === "overlay-mask");
924
- c && (n.overlayMask = c, n.overlayMask.visible = !1), t.renderAll(), t.fire("editor:history-state-loaded", {
921
+ const o = t.getObjects().find((d) => d.id === "montage-area");
922
+ o && (this.editor.montageArea = o, (i !== e.width || n !== e.height) && a.updateCanvasAndFitObjects());
923
+ const c = t.getObjects().find((d) => d.id === "overlay-mask");
924
+ c && (s.overlayMask = c, s.overlayMask.visible = !1), t.renderAll(), t.fire("editor:history-state-loaded", {
925
925
  fullState: e,
926
926
  currentIndex: this.currentIndex,
927
927
  totalChangesCount: this.totalChangesCount,
@@ -936,7 +936,7 @@ class dt {
936
936
  * @fires editor:undo
937
937
  */
938
938
  undo() {
939
- return O(this, null, function* () {
939
+ return b(this, null, function* () {
940
940
  if (!this.skipHistory) {
941
941
  if (this.currentIndex <= 0) {
942
942
  console.log("Нет предыдущих состояний для отмены.");
@@ -973,7 +973,7 @@ class dt {
973
973
  * @fires editor:redo
974
974
  */
975
975
  redo() {
976
- return O(this, null, function* () {
976
+ return b(this, null, function* () {
977
977
  if (!this.skipHistory) {
978
978
  if (this.currentIndex >= this.patches.length) {
979
979
  console.log("Нет состояний для повтора.");
@@ -1006,585 +1006,455 @@ class dt {
1006
1006
  });
1007
1007
  }
1008
1008
  }
1009
- const lt = 0.1, ht = 2, gt = 0.1, Mt = 90, B = 16, Z = 16, T = 4096, k = 4096;
1010
- function Ae(o, e, t, a, n, i, s) {
1011
- try {
1012
- var r = o[i](s), c = r.value;
1013
- } catch (u) {
1014
- return void t(u);
1015
- }
1016
- r.done ? e(c) : Promise.resolve(c).then(a, n);
1017
- }
1018
- function x(o) {
1019
- return function() {
1020
- var e = this, t = arguments;
1021
- return new Promise(function(a, n) {
1022
- var i = o.apply(e, t);
1023
- function s(c) {
1024
- Ae(i, a, n, s, r, "next", c);
1025
- }
1026
- function r(c) {
1027
- Ae(i, a, n, s, r, "throw", c);
1028
- }
1029
- s(void 0);
1030
- });
1031
- };
1032
- }
1033
- class D {
1034
- /**
1035
- * @param {object} options
1036
- * @param {ImageEditor} options.editor - экземпляр редактора с доступом к canvas
1037
- */
1038
- constructor(e) {
1039
- var {
1040
- editor: t
1041
- } = e;
1042
- this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1009
+ const qe = 0.1, et = 2, tt = 0.1, at = 90, B = 16, U = 16, O = 4096, T = 4096;
1010
+ class C {
1011
+ constructor({ editor: e }) {
1012
+ this.editor = e, this.options = e.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
1043
1013
  }
1044
1014
  /**
1045
1015
  * Импорт изображения
1046
- * @param {Object} options
1047
- * @param {File|string} [options.source] - URL изображения или объект File
1048
- * @param {String} [options.scale] - Если изображение не вписывается в допустимые размеры, то как масштабировать:
1016
+ * @param options
1017
+ * @param options.source - URL изображения или объект File
1018
+ * @param options.scale - Если изображение не вписывается в допустимые размеры, то как масштабировать:
1049
1019
  * 'image-contain' - скейлит картинку, чтобы она вписалась в монтажную область
1050
1020
  * 'image-cover' - скейлит картинку, чтобы она вписалась в монтажную область
1051
1021
  * 'scale-montage' - Обновляет backstore-резолюцию монтажной области (масштабирует
1052
1022
  * экспортный размер канваса под размер изображения)
1053
- * @param {Boolean} [options.withoutSave] - Не сохранять в историю изменений
1054
- * @returns {Promise<Object|null>} - возвращает Promise с объектом изображения или null в случае ошибки
1023
+ * @param options.withoutSave - Не сохранять в историю изменений
1024
+ * @returns возвращает Promise с объектом изображения или null в случае ошибки
1055
1025
  */
1056
- importImage(e) {
1057
- var t = this;
1058
- return x(function* () {
1059
- var {
1060
- source: a,
1061
- scale: n = "image-".concat(t.options.scaleType),
1062
- withoutSave: i = !1
1063
- } = e;
1064
- if (!a) return null;
1065
- var {
1066
- canvas: s,
1067
- montageArea: r,
1068
- transformManager: c,
1069
- historyManager: u,
1070
- errorManager: l
1071
- } = t.editor, d = yield t.getContentType(a), h = D.getFormatFromContentType(d), {
1072
- acceptContentTypes: g,
1073
- acceptFormats: m
1074
- } = t;
1075
- if (!t.isAllowedContentType(d)) {
1076
- var f = "Неверный contentType для изображения: ".concat(d, ". Ожидается один из: ").concat(t.acceptContentTypes.join(", "), ".");
1077
- return l.emitError({
1026
+ importImage(s) {
1027
+ return b(this, arguments, function* ({
1028
+ source: e,
1029
+ scale: t = `image-${this.options.scaleType}`,
1030
+ withoutSave: a = !1
1031
+ }) {
1032
+ if (!e) return null;
1033
+ const { canvas: i, montageArea: n, transformManager: o, historyManager: c, errorManager: d } = this.editor, l = yield this.getContentType(e), h = C.getFormatFromContentType(l), { acceptContentTypes: g, acceptFormats: u } = this;
1034
+ if (!this.isAllowedContentType(l)) {
1035
+ const m = `Неверный contentType для изображения: ${l}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1036
+ return d.emitError({
1078
1037
  origin: "ImageManager",
1079
1038
  method: "importImage",
1080
1039
  code: "INVALID_CONTENT_TYPE",
1081
- message: f,
1082
- data: {
1083
- source: a,
1084
- format: h,
1085
- contentType: d,
1086
- acceptContentTypes: g,
1087
- acceptFormats: m
1088
- }
1040
+ message: m,
1041
+ data: { source: e, format: h, contentType: l, acceptContentTypes: g, acceptFormats: u }
1089
1042
  }), null;
1090
1043
  }
1091
- u.suspendHistory();
1044
+ c.suspendHistory();
1092
1045
  try {
1093
- var v, M;
1094
- if (a instanceof File)
1095
- v = URL.createObjectURL(a);
1096
- else if (typeof a == "string") {
1097
- var S = yield fetch(a, {
1098
- mode: "cors"
1099
- }), E = yield S.blob({
1100
- type: d,
1101
- quality: 1
1102
- });
1103
- v = URL.createObjectURL(E);
1046
+ let m, M;
1047
+ if (e instanceof File)
1048
+ m = URL.createObjectURL(e);
1049
+ else if (typeof e == "string") {
1050
+ const y = yield (yield fetch(e, { mode: "cors" })).blob();
1051
+ m = URL.createObjectURL(y);
1104
1052
  } else
1105
- return l.emitError({
1053
+ return d.emitError({
1106
1054
  origin: "ImageManager",
1107
1055
  method: "importImage",
1108
1056
  code: "INVALID_SOURCE_TYPE",
1109
1057
  message: "Неверный тип источника изображения. Ожидается URL или объект File.",
1110
- data: {
1111
- source: a,
1112
- format: h,
1113
- contentType: d,
1114
- acceptContentTypes: g,
1115
- acceptFormats: m
1116
- }
1058
+ data: { source: e, format: h, contentType: l, acceptContentTypes: g, acceptFormats: u }
1117
1059
  }), null;
1118
- if (t._createdBlobUrls.push(v), h === "svg") {
1119
- var L = yield Te(v);
1120
- M = W.groupSVGElements(L.objects, L.options);
1060
+ if (this._createdBlobUrls.push(m), h === "svg") {
1061
+ const v = yield ye(m);
1062
+ M = H.groupSVGElements(v.objects, v.options);
1121
1063
  } else
1122
- M = yield ee.fromURL(v, {
1123
- crossOrigin: "anonymous"
1124
- });
1125
- var {
1126
- width: w,
1127
- height: y
1128
- } = M;
1129
- if (y > k || w > T) {
1130
- var b = yield t.resizeImageToBoundaries(M._element.src, "max"), z = URL.createObjectURL(b);
1131
- t._createdBlobUrls.push(z), M = yield ee.fromURL(z, {
1132
- crossOrigin: "anonymous"
1133
- });
1134
- } else if (y < Z || w < B) {
1135
- var F = yield t.resizeImageToBoundaries(M._element.src, "min"), U = URL.createObjectURL(F);
1136
- t._createdBlobUrls.push(U), M = yield ee.fromURL(U, {
1137
- crossOrigin: "anonymous"
1138
- });
1064
+ M = yield Z.fromURL(m, { crossOrigin: "anonymous" });
1065
+ const { width: j, height: w } = M;
1066
+ if (M instanceof Z) {
1067
+ const v = M.getElement();
1068
+ let y = "";
1069
+ if (v instanceof HTMLImageElement ? y = v.src : v instanceof HTMLCanvasElement && (y = v.toDataURL()), w > T || j > O) {
1070
+ const L = yield this.resizeImageToBoundaries(y, "max"), k = URL.createObjectURL(L);
1071
+ this._createdBlobUrls.push(k), M = yield Z.fromURL(k, { crossOrigin: "anonymous" });
1072
+ } else if (w < U || j < B) {
1073
+ const L = yield this.resizeImageToBoundaries(y, "min"), k = URL.createObjectURL(L);
1074
+ this._createdBlobUrls.push(k), M = yield Z.fromURL(k, { crossOrigin: "anonymous" });
1075
+ }
1139
1076
  }
1140
- if (M.set("id", "".concat(M.type, "-").concat(A())), M.set("format", h), n === "scale-montage")
1141
- t.editor.canvasManager.scaleMontageAreaToImage({
1142
- object: M,
1143
- withoutSave: !0
1144
- });
1077
+ if (M.set("id", `${M.type}-${D()}`), M.set("format", h), t === "scale-montage")
1078
+ this.editor.canvasManager.scaleMontageAreaToImage({ object: M, withoutSave: !0 });
1145
1079
  else {
1146
- var {
1147
- width: V,
1148
- height: R
1149
- } = r, _ = t.calculateScaleFactor({
1150
- imageObject: M,
1151
- scaleType: n
1152
- });
1153
- n === "image-contain" && _ < 1 ? c.fitObject({
1154
- object: M,
1155
- type: "contain",
1156
- withoutSave: !0
1157
- }) : n === "image-cover" && (w > V || y > R) && c.fitObject({
1158
- object: M,
1159
- type: "cover",
1160
- withoutSave: !0
1161
- });
1080
+ const { width: v, height: y } = n, L = this.calculateScaleFactor({ imageObject: M, scaleType: t });
1081
+ t === "image-contain" && L < 1 ? o.fitObject({ object: M, type: "contain", withoutSave: !0 }) : t === "image-cover" && (j > v || w > y) && o.fitObject({ object: M, type: "cover", withoutSave: !0 });
1162
1082
  }
1163
- s.add(M), s.centerObject(M), s.setActiveObject(M), s.renderAll(), u.resumeHistory(), i || u.saveState();
1164
- var G = {
1083
+ i.add(M), i.centerObject(M), i.setActiveObject(M), i.renderAll(), c.resumeHistory(), a || c.saveState();
1084
+ const I = {
1165
1085
  image: M,
1166
1086
  format: h,
1167
- contentType: d,
1168
- scale: n,
1169
- withoutSave: i,
1170
- source: a
1087
+ contentType: l,
1088
+ scale: t,
1089
+ withoutSave: a,
1090
+ source: e
1171
1091
  };
1172
- return s.fire("editor:image-imported", G), G;
1173
- } catch (H) {
1174
- return l.emitError({
1092
+ return i.fire("editor:image-imported", I), I;
1093
+ } catch (m) {
1094
+ return d.emitError({
1175
1095
  origin: "ImageManager",
1176
1096
  method: "importImage",
1177
1097
  code: "IMPORT_FAILED",
1178
- message: "Ошибка импорта изображения: ".concat(H.message),
1179
- data: {
1180
- source: a,
1181
- format: h,
1182
- contentType: d,
1183
- scale: n,
1184
- withoutSave: i
1185
- }
1186
- }), u.resumeHistory(), null;
1098
+ message: `Ошибка импорта изображения: ${m.message}`,
1099
+ data: { source: e, format: h, contentType: l, scale: t, withoutSave: a }
1100
+ }), c.resumeHistory(), null;
1187
1101
  }
1188
- })();
1102
+ });
1189
1103
  }
1190
1104
  /**
1191
1105
  * Функция для ресайза изображения до максимальных размеров,
1192
1106
  * если оно их превышает. Сохраняет пропорции.
1193
1107
  *
1194
- * @param {HTMLImageElement} imageEl - HTML элемент изображения
1108
+ * @param {string} dataURL - dataURL изображения
1195
1109
  * @param {string} [size='max | min'] - максимальный или минимальный размер
1196
- * @returns {Promise<string>} - возвращает Promise с новым dataURL
1197
- */
1198
- resizeImageToBoundaries(e) {
1199
- var t = arguments, a = this;
1200
- return x(function* () {
1201
- var n = t.length > 1 && t[1] !== void 0 ? t[1] : "max", i = "Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ".concat(T, "x").concat(k);
1202
- n === "min" && (i = "Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ".concat(B, "x").concat(Z));
1203
- var s = {
1110
+ * @returns {Promise<Blob>} - возвращает Promise с Blob-объектом уменьшенного изображения
1111
+ */
1112
+ resizeImageToBoundaries(e, t = "max") {
1113
+ return b(this, null, function* () {
1114
+ let a = `Размер изображения больше максимального размера канваса, поэтому оно будет уменьшено до максимальных размеров c сохранением пропорций: ${O}x${T}`;
1115
+ t === "min" && (a = `Размер изображения меньше минимального размера канваса, поэтому оно будет увеличено до минимальных размеров c сохранением пропорций: ${B}x${U}`);
1116
+ const s = {
1204
1117
  dataURL: e,
1205
- sizeType: n,
1206
- maxWidth: T,
1207
- maxHeight: k,
1118
+ sizeType: t,
1119
+ maxWidth: O,
1120
+ maxHeight: T,
1208
1121
  minWidth: B,
1209
- minHeight: Z
1122
+ minHeight: U
1210
1123
  };
1211
- return a.editor.errorManager.emitWarning({
1124
+ return this.editor.errorManager.emitWarning({
1212
1125
  origin: "ImageManager",
1213
1126
  method: "resizeImageToBoundaries",
1214
1127
  code: "IMAGE_RESIZE_WARNING",
1215
- message: i,
1128
+ message: a,
1216
1129
  data: s
1217
- }), a.editor.workerManager.post("resizeImage", s);
1218
- })();
1130
+ }), this.editor.workerManager.post("resizeImage", s);
1131
+ });
1219
1132
  }
1220
1133
  /**
1221
1134
  * Экспорт изображения в файл – экспортируется содержимое монтажной области.
1222
1135
  * Независимо от текущего зума, экспортируется монтажная область в исходном масштабе. Можно экспортировать как base64.
1223
- * @param {Object} options - опции
1224
- * @param {string} options.fileName - имя файла
1225
- * @param {string} options.contentType - тип контента
1226
- * @param {Boolean} options.exportAsBase64 - экспортировать как base64
1227
- * @param {Boolean} options.exportAsBlob - экспортировать как blob
1228
- * @returns {Promise<File> | String} - файл или base64
1136
+ * @param options - опции
1137
+ * @param options.fileName - имя файла
1138
+ * @param options.contentType - тип контента
1139
+ * @param options.exportAsBase64 - экспортировать как base64
1140
+ * @param options.exportAsBlob - экспортировать как blob
1141
+ * @returns возвращает Promise с объектом файла или null в случае ошибки
1229
1142
  * @fires editor:canvas-exported
1230
1143
  */
1231
1144
  exportCanvasAsImageFile() {
1232
- var e = arguments, t = this;
1233
- return x(function* () {
1234
- var {
1235
- fileName: a = "image.png",
1236
- contentType: n = "image/png",
1237
- exportAsBase64: i = !1,
1238
- exportAsBlob: s = !1
1239
- } = e.length > 0 && e[0] !== void 0 ? e[0] : {}, {
1240
- canvas: r,
1241
- montageArea: c,
1242
- workerManager: u
1243
- } = t.editor;
1145
+ return b(this, arguments, function* ({
1146
+ fileName: e = "image.png",
1147
+ contentType: t = "image/png",
1148
+ exportAsBase64: a = !1,
1149
+ exportAsBlob: s = !1
1150
+ } = {}) {
1151
+ const { canvas: i, montageArea: n, workerManager: o } = this.editor;
1244
1152
  try {
1245
- var l = n === "application/pdf", d = l ? "image/jpg" : n, h = D.getFormatFromContentType(d);
1246
- c.setCoords();
1247
- var {
1248
- left: g,
1249
- top: m,
1250
- width: f,
1251
- height: v
1252
- } = c.getBoundingRect(), M = yield r.clone(["id", "format", "locked"]);
1153
+ const c = t === "application/pdf", d = c ? "image/jpg" : t, l = C.getFormatFromContentType(d);
1154
+ n.setCoords();
1155
+ const { left: h, top: g, width: u, height: m } = n.getBoundingRect(), M = yield i.clone(["id", "format", "locked"]);
1253
1156
  ["image/jpg", "image/jpeg"].includes(d) && (M.backgroundColor = "#ffffff");
1254
- var S = M.getObjects().find((p) => p.id === c.id);
1255
- S.visible = !1, M.viewportTransform = [1, 0, 0, 1, -g, -m], M.setDimensions({
1256
- width: f,
1257
- height: v
1258
- }, {
1259
- backstoreOnly: !0
1260
- }), M.renderAll();
1261
- var E = M.getObjects().filter((p) => p.format).every((p) => p.format === "svg");
1262
- if (h === "svg" && E) {
1263
- var L = M.toSVG();
1157
+ const j = M.getObjects().find((f) => f.id === n.id);
1158
+ j && (j.visible = !1), M.viewportTransform = [1, 0, 0, 1, -h, -g], M.setDimensions({ width: u, height: m }, { backstoreOnly: !0 }), M.renderAll();
1159
+ const w = M.getObjects().filter((f) => f.format).every((f) => f.format === "svg");
1160
+ if (l === "svg" && w) {
1161
+ const f = M.toSVG();
1264
1162
  M.dispose();
1265
- var w = D._exportSVGStringAsFile(L, {
1266
- exportAsBase64: i,
1267
- exportAsBlob: s,
1268
- fileName: a
1269
- }), y = {
1270
- image: w,
1163
+ const A = {
1164
+ image: C._exportSVGStringAsFile(f, {
1165
+ exportAsBase64: a,
1166
+ exportAsBlob: s,
1167
+ fileName: e
1168
+ }),
1271
1169
  format: "svg",
1272
1170
  contentType: "image/svg+xml",
1273
- fileName: a.replace(/\.[^/.]+$/, ".svg")
1171
+ fileName: e.replace(/\.[^/.]+$/, ".svg")
1274
1172
  };
1275
- return r.fire("editor:canvas-exported", y), y;
1173
+ return i.fire("editor:canvas-exported", A), A;
1276
1174
  }
1277
- var b = yield new Promise((p) => {
1278
- M.getElement().toBlob(p);
1175
+ const I = yield new Promise((f, x) => {
1176
+ M.getElement().toBlob((A) => {
1177
+ A ? f(A) : x(new Error("Failed to create Blob from canvas"));
1178
+ });
1279
1179
  });
1280
1180
  if (M.dispose(), s) {
1281
- var z = {
1282
- image: b,
1283
- format: h,
1181
+ const f = {
1182
+ image: I,
1183
+ format: l,
1284
1184
  contentType: d,
1285
- fileName: a
1185
+ fileName: e
1286
1186
  };
1287
- return r.fire("editor:canvas-exported", z), z;
1187
+ return i.fire("editor:canvas-exported", f), f;
1288
1188
  }
1289
- var F = yield createImageBitmap(b), U = yield u.post("toDataURL", {
1290
- format: h,
1291
- quality: 1,
1292
- bitmap: F
1293
- }, [F]);
1294
- if (l) {
1295
- var V = 0.264583, R = f * V, _ = v * V, G = (yield t.editor.moduleLoader.loadModule("jspdf")).jsPDF, H = new G({
1296
- orientation: R > _ ? "landscape" : "portrait",
1189
+ const v = yield createImageBitmap(I), y = yield o.post(
1190
+ "toDataURL",
1191
+ { format: l, quality: 1, bitmap: v },
1192
+ [v]
1193
+ );
1194
+ if (c) {
1195
+ const x = u * 0.264583, A = m * 0.264583, me = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, G = new me({
1196
+ orientation: x > A ? "landscape" : "portrait",
1297
1197
  unit: "mm",
1298
- format: [R, _]
1198
+ format: [x, A]
1299
1199
  });
1300
- if (H.addImage(U, "JPG", 0, 0, R, _), i) {
1301
- var Ce = H.output("datauristring"), de = {
1302
- image: Ce,
1200
+ if (G.addImage(y, "JPG", 0, 0, x, A), a) {
1201
+ const ne = {
1202
+ image: G.output("datauristring"),
1303
1203
  format: "pdf",
1304
1204
  contentType: "application/pdf",
1305
- fileName: a
1205
+ fileName: e
1306
1206
  };
1307
- return r.fire("editor:canvas-exported", de), de;
1207
+ return i.fire("editor:canvas-exported", ne), ne;
1308
1208
  }
1309
- var De = H.output("blob"), Ne = new File([De], a, {
1310
- type: "application/pdf"
1311
- }), le = {
1312
- image: Ne,
1209
+ const je = G.output("blob"), ie = {
1210
+ image: new File([je], e, { type: "application/pdf" }),
1313
1211
  format: "pdf",
1314
1212
  contentType: "application/pdf",
1315
- fileName: a
1213
+ fileName: e
1316
1214
  };
1317
- return r.fire("editor:canvas-exported", le), le;
1215
+ return i.fire("editor:canvas-exported", ie), ie;
1318
1216
  }
1319
- if (i) {
1320
- var he = {
1321
- image: U,
1322
- format: h,
1217
+ if (a) {
1218
+ const f = {
1219
+ image: y,
1220
+ format: l,
1323
1221
  contentType: d,
1324
- fileName: a
1222
+ fileName: e
1325
1223
  };
1326
- return r.fire("editor:canvas-exported", he), he;
1224
+ return i.fire("editor:canvas-exported", f), f;
1327
1225
  }
1328
- var ge = h === "svg" && !E ? a.replace(/\.[^/.]+$/, ".png") : a, Ee = new File([b], ge, {
1329
- type: d
1330
- }), Me = {
1331
- image: Ee,
1332
- format: h,
1226
+ const L = l === "svg" && !w ? e.replace(/\.[^/.]+$/, ".png") : e, se = {
1227
+ image: new File([I], L, { type: d }),
1228
+ format: l,
1333
1229
  contentType: d,
1334
- fileName: ge
1230
+ fileName: L
1335
1231
  };
1336
- return r.fire("editor:canvas-exported", Me), Me;
1337
- } catch (p) {
1338
- return t.editor.errorManager.emitError({
1232
+ return i.fire("editor:canvas-exported", se), se;
1233
+ } catch (c) {
1234
+ return this.editor.errorManager.emitError({
1339
1235
  origin: "ImageManager",
1340
1236
  method: "exportCanvasAsImageFile",
1341
1237
  code: "IMAGE_EXPORT_FAILED",
1342
- message: "Ошибка экспорта изображения: ".concat(p.message),
1343
- data: {
1344
- contentType: n,
1345
- fileName: a,
1346
- exportAsBase64: i,
1347
- exportAsBlob: s
1348
- }
1349
- }), "";
1238
+ message: `Ошибка экспорта изображения: ${c.message}`,
1239
+ data: { contentType: t, fileName: e, exportAsBase64: a, exportAsBlob: s }
1240
+ }), null;
1350
1241
  }
1351
- })();
1242
+ });
1352
1243
  }
1353
1244
  /**
1354
1245
  * Экспорт выбранного объекта в виде изображения или base64
1355
- * @param {Object} options - опции
1356
- * @param {fabric.Object} options.object - объект для экспорта
1357
- * @param {String} options.fileName - имя файла
1358
- * @param {String} options.contentType - тип контента
1359
- * @param {Boolean} options.exportAsBase64 - экспортировать как base64
1360
- * @param {Boolean} options.exportAsBlob - экспортировать как blob
1361
- * @returns {String} base64
1246
+ * @param options - опции
1247
+ * @param options.object - объект для экспорта
1248
+ * @param options.fileName - имя файла
1249
+ * @param options.contentType - тип контента
1250
+ * @param options.exportAsBase64 - экспортировать как base64
1251
+ * @param options.exportAsBlob - экспортировать как blob
1252
+ * @returns - возвращает Promise с объектом файла или null в случае ошибки
1362
1253
  * @fires editor:object-exported
1363
1254
  */
1364
1255
  exportObjectAsImageFile() {
1365
- var e = arguments, t = this;
1366
- return x(function* () {
1367
- var {
1368
- object: a,
1369
- fileName: n = "image.png",
1370
- contentType: i = "image/png",
1371
- exportAsBase64: s = !1,
1372
- exportAsBlob: r = !1
1373
- } = e.length > 0 && e[0] !== void 0 ? e[0] : {}, {
1374
- canvas: c,
1375
- workerManager: u
1376
- } = t.editor, l = a || c.getActiveObject();
1377
- if (!l)
1378
- return t.editor.errorManager.emitError({
1256
+ return b(this, arguments, function* ({
1257
+ object: e,
1258
+ fileName: t = "image.png",
1259
+ contentType: a = "image/png",
1260
+ exportAsBase64: s = !1,
1261
+ exportAsBlob: i = !1
1262
+ } = {}) {
1263
+ const { canvas: n, workerManager: o } = this.editor, c = e || n.getActiveObject();
1264
+ if (!c)
1265
+ return this.editor.errorManager.emitError({
1379
1266
  origin: "ImageManager",
1380
1267
  method: "exportObjectAsImageFile",
1381
1268
  code: "NO_OBJECT_SELECTED",
1382
1269
  message: "Не выбран объект для экспорта",
1383
- data: {
1384
- contentType: i,
1385
- fileName: n,
1386
- exportAsBase64: s,
1387
- exportAsBlob: r
1388
- }
1389
- }), "";
1270
+ data: { contentType: a, fileName: t, exportAsBase64: s, exportAsBlob: i }
1271
+ }), null;
1390
1272
  try {
1391
- var d = D.getFormatFromContentType(i);
1273
+ const d = C.getFormatFromContentType(a);
1392
1274
  if (d === "svg") {
1393
- var h = l.toSVG(), g = t._exportSVGStringAsFile(h, {
1275
+ const m = c.toSVG(), M = C._exportSVGStringAsFile(m, {
1394
1276
  exportAsBase64: s,
1395
- exportAsBlob: r,
1396
- fileName: n
1397
- }), m = {
1398
- image: g,
1277
+ exportAsBlob: i,
1278
+ fileName: t
1279
+ }), j = {
1280
+ object: c,
1281
+ image: M,
1399
1282
  format: d,
1400
1283
  contentType: "image/svg+xml",
1401
- fileName: n.replace(/\.[^/.]+$/, ".svg")
1284
+ fileName: t.replace(/\.[^/.]+$/, ".svg")
1402
1285
  };
1403
- return c.fire("editor:object-exported", m), m;
1286
+ return n.fire("editor:object-exported", j), j;
1404
1287
  }
1405
- if (s) {
1406
- var f = yield createImageBitmap(l._element), v = yield u.post("toDataURL", {
1288
+ if (s && c instanceof Z) {
1289
+ const m = yield createImageBitmap(c.getElement()), M = yield o.post(
1290
+ "toDataURL",
1291
+ {
1292
+ format: d,
1293
+ quality: 1,
1294
+ bitmap: m
1295
+ },
1296
+ [m]
1297
+ ), j = {
1298
+ object: c,
1299
+ image: M,
1407
1300
  format: d,
1408
- quality: 1,
1409
- bitmap: f
1410
- }, [f]), M = {
1411
- image: v,
1412
- format: d,
1413
- contentType: i,
1414
- fileName: n
1301
+ contentType: a,
1302
+ fileName: t
1415
1303
  };
1416
- return c.fire("editor:object-exported", M), M;
1304
+ return n.fire("editor:object-exported", j), j;
1417
1305
  }
1418
- var S = l.toCanvasElement(), E = yield new Promise((b) => {
1419
- S.toBlob(b);
1306
+ const l = c.toCanvasElement(), h = yield new Promise((m, M) => {
1307
+ l.toBlob((j) => {
1308
+ j ? m(j) : M(new Error("Failed to create Blob from canvas"));
1309
+ });
1420
1310
  });
1421
- if (r) {
1422
- var L = {
1423
- image: E,
1311
+ if (i) {
1312
+ const m = {
1313
+ object: c,
1314
+ image: h,
1424
1315
  format: d,
1425
- contentType: i,
1426
- fileName: n
1316
+ contentType: a,
1317
+ fileName: t
1427
1318
  };
1428
- return c.fire("editor:object-exported", L), L;
1319
+ return n.fire("editor:object-exported", m), m;
1429
1320
  }
1430
- var w = new File([E], n, {
1431
- type: i
1432
- }), y = {
1433
- image: w,
1321
+ const g = new File([h], t, { type: a }), u = {
1322
+ object: c,
1323
+ image: g,
1434
1324
  format: d,
1435
- contentType: i,
1436
- fileName: n
1325
+ contentType: a,
1326
+ fileName: t
1437
1327
  };
1438
- return c.fire("editor:object-exported", y), y;
1439
- } catch (b) {
1440
- return t.editor.errorManager.emitError({
1328
+ return n.fire("editor:object-exported", u), u;
1329
+ } catch (d) {
1330
+ return this.editor.errorManager.emitError({
1441
1331
  origin: "ImageManager",
1442
1332
  method: "exportObjectAsImageFile",
1443
1333
  code: "IMAGE_EXPORT_FAILED",
1444
- message: "Ошибка экспорта объекта: ".concat(b.message),
1445
- data: {
1446
- contentType: i,
1447
- fileName: n,
1448
- exportAsBase64: s,
1449
- exportAsBlob: r
1450
- }
1451
- }), "";
1334
+ message: `Ошибка экспорта объекта: ${d.message}`,
1335
+ data: { contentType: a, fileName: t, exportAsBase64: s, exportAsBlob: i }
1336
+ }), null;
1452
1337
  }
1453
- })();
1338
+ });
1454
1339
  }
1455
1340
  /**
1456
1341
  * Удаляет все созданные blobURL
1457
- * @returns {void}
1458
1342
  */
1459
1343
  revokeBlobUrls() {
1460
1344
  this._createdBlobUrls.forEach(URL.revokeObjectURL), this._createdBlobUrls = [];
1461
1345
  }
1462
- /**
1463
- * Преобразует SVG-строку в Blob, файл, или base64
1464
- * @param {string} svgString - SVG-строка
1465
- * @param {Object} options - опции
1466
- * @param {Boolean} options.exportAsBase64 - экспортировать как base64
1467
- * @param {Boolean} options.exportAsBlob - экспортировать как blob
1468
- * @param {String} options.fileName - имя файла
1469
- * @returns {Blob|String|File} - Blob, base64 или файл
1470
- * @private
1471
- * @static
1472
- */
1473
- static _exportSVGStringAsFile(e) {
1474
- var {
1475
- exportAsBase64: t,
1476
- exportAsBlob: a,
1477
- fileName: n
1478
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1479
- return a ? new Blob([e], {
1480
- type: "image/svg+xml"
1481
- }) : t ? "data:image/svg+xml;base64,".concat(btoa(e)) : new File([e], n.replace(/\.[^/.]+$/, ".svg"), {
1482
- type: "image/svg+xml"
1483
- });
1484
- }
1485
1346
  /**
1486
1347
  * Получает список допустимых форматов изображений
1487
- * @returns {string[]} - массив допустимых форматов изображений
1348
+ * @returns массив допустимых форматов изображений
1488
1349
  */
1489
1350
  getAllowedFormatsFromContentTypes() {
1490
- return this.acceptContentTypes.map((e) => D.getFormatFromContentType(e)).filter((e) => e);
1491
- }
1492
- /**
1493
- * Извлекает чистый формат (subtype) из contentType,
1494
- * отбросив любую часть после «+» или «;»
1495
- * @param {string} contentType
1496
- * @returns {string} формат, например 'png', 'jpeg', 'svg'
1497
- * @static
1498
- */
1499
- static getFormatFromContentType() {
1500
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", t = e.match(/^[^/]+\/([^+;]+)/);
1501
- return t ? t[1] : "";
1351
+ return this.acceptContentTypes.map((e) => C.getFormatFromContentType(e)).filter((e) => e);
1502
1352
  }
1503
1353
  /**
1504
1354
  * Проверяет, является ли contentType допустимым типом изображения.
1505
- * @param {string} contentType - тип контента
1506
- * @returns {boolean} true, если contentType допустим, иначе false
1355
+ * @returns true, если contentType допустим, иначе false
1507
1356
  */
1508
- isAllowedContentType() {
1509
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
1357
+ isAllowedContentType(e = "") {
1510
1358
  return this.acceptContentTypes.includes(e);
1511
1359
  }
1512
1360
  /**
1513
1361
  * Получает contentType изображения из источника
1514
- * @param {File|string} source - URL изображения или объект File
1515
- * @returns {Promise<string>|string} - MIME-тип изображения
1362
+ * @param source - URL изображения или объект File
1363
+ * @returns MIME-тип изображения
1516
1364
  * @public
1517
1365
  */
1518
1366
  getContentType(e) {
1519
- var t = this;
1520
- return x(function* () {
1521
- return typeof e == "string" ? t.getContentTypeFromUrl(e) : e.type || "application/octet-stream";
1522
- })();
1367
+ return b(this, null, function* () {
1368
+ return typeof e == "string" ? this.getContentTypeFromUrl(e) : e.type || "application/octet-stream";
1369
+ });
1523
1370
  }
1524
1371
  /**
1525
1372
  * Получает contentType изображения через HTTP HEAD запрос или анализ URL
1526
- * @param {string} src - URL изображения
1527
- * @returns {Promise<string>} - MIME-тип изображения
1373
+ * @param src - URL изображения
1374
+ * @returns MIME-тип изображения
1528
1375
  * @public
1529
1376
  */
1530
1377
  getContentTypeFromUrl(e) {
1531
- var t = this;
1532
- return x(function* () {
1378
+ return b(this, null, function* () {
1533
1379
  if (e.startsWith("data:")) {
1534
- var a = e.match(/^data:([^;]+)/);
1535
- return a ? a[1] : "application/octet-stream";
1380
+ const t = e.match(/^data:([^;]+)/);
1381
+ return t ? t[1] : "application/octet-stream";
1536
1382
  }
1537
1383
  try {
1538
- var n = yield fetch(e, {
1539
- method: "HEAD"
1540
- }), i = n.headers.get("content-type");
1541
- if (i && i.startsWith("image/"))
1542
- return i.split(";")[0];
1543
- } catch (s) {
1544
- console.warn("HEAD запрос неудачен, определяем тип по расширению:", s);
1384
+ const a = (yield fetch(e, { method: "HEAD" })).headers.get("content-type");
1385
+ if (a && a.startsWith("image/"))
1386
+ return a.split(";")[0];
1387
+ } catch (t) {
1388
+ console.warn("HEAD запрос неудачен, определяем тип по расширению:", t);
1545
1389
  }
1546
- return t.getContentTypeFromExtension(e);
1547
- })();
1390
+ return this.getContentTypeFromExtension(e);
1391
+ });
1548
1392
  }
1549
1393
  /**
1550
1394
  * Определяет contentType по расширению файла в URL
1551
- * @param {string} url - URL файла
1552
- * @returns {string} - MIME-тип
1395
+ * @param url - URL файла
1396
+ * @returns - MIME-тип
1553
1397
  * @public
1554
1398
  */
1555
1399
  getContentTypeFromExtension(e) {
1400
+ var t;
1556
1401
  try {
1557
- var t, a = new URL(e), n = (t = a.pathname.split(".").pop()) === null || t === void 0 ? void 0 : t.toLowerCase(), i = {};
1558
- return this.acceptContentTypes.forEach((s) => {
1559
- var r = D.getFormatFromContentType(s);
1560
- r && (i[r] = s);
1561
- }), i[n] || "application/octet-stream";
1562
- } catch (s) {
1563
- return console.warn("Не удалось определить расширение из URL:", e, s), "application/octet-stream";
1402
+ const s = (t = new URL(e).pathname.split(".").pop()) == null ? void 0 : t.toLowerCase(), i = {};
1403
+ return this.acceptContentTypes.forEach((n) => {
1404
+ const o = C.getFormatFromContentType(n);
1405
+ o && (i[o] = n);
1406
+ }), s && i[s] || "application/octet-stream";
1407
+ } catch (a) {
1408
+ return console.warn("Не удалось определить расширение из URL:", e, a), "application/octet-stream";
1564
1409
  }
1565
1410
  }
1566
1411
  /**
1567
1412
  * Рассчитывает коэффициент масштабирования изображения.
1568
- * @param {object} imageObject - объект изображения
1569
- * @param {string} scaleType - тип масштабирования ('contain' или 'cover')
1570
- * @returns {number} коэффициент масштабирования
1413
+ * @param options - опции
1414
+ * @param options.imageObject - объект изображения
1415
+ * @param options.scaleType - тип масштабирования ('contain' или 'cover')
1416
+ * @returns коэффициент масштабирования
1571
1417
  */
1572
- calculateScaleFactor(e) {
1573
- var {
1574
- imageObject: t,
1575
- scaleType: a = "contain"
1576
- } = e, {
1577
- montageArea: n
1578
- } = this.editor;
1579
- if (!n || !t) return 1;
1580
- var i = n.width, s = n.height, {
1581
- width: r,
1582
- height: c
1583
- } = t;
1584
- return a === "contain" || a === "image-contain" ? Math.min(i / r, s / c) : a === "cover" || a === "image-cover" ? Math.max(i / r, s / c) : 1;
1418
+ calculateScaleFactor({
1419
+ imageObject: e,
1420
+ scaleType: t = "contain"
1421
+ }) {
1422
+ const { montageArea: a } = this.editor;
1423
+ if (!a || !e) return 1;
1424
+ const s = a.width, i = a.height, { width: n, height: o } = e;
1425
+ return t === "contain" || t === "image-contain" ? Math.min(s / n, i / o) : t === "cover" || t === "image-cover" ? Math.max(s / n, i / o) : 1;
1426
+ }
1427
+ /**
1428
+ * Преобразует SVG-строку в Blob, файл, или base64
1429
+ * @param svgString - SVG-строка
1430
+ * @param options - опции
1431
+ * @param options.exportAsBase64 - экспортировать как base64
1432
+ * @param options.exportAsBlob - экспортировать как blob
1433
+ * @param options.fileName - имя файла
1434
+ * @returns Blob, base64 или файл
1435
+ * @private
1436
+ * @static
1437
+ */
1438
+ static _exportSVGStringAsFile(e, {
1439
+ exportAsBase64: t,
1440
+ exportAsBlob: a,
1441
+ fileName: s = "image.svg"
1442
+ } = {}) {
1443
+ return a ? new Blob([e], { type: "image/svg+xml" }) : t ? `data:image/svg+xml;base64,${window.btoa(encodeURIComponent(e))}` : new File([e], s.replace(/\.[^/.]+$/, ".svg"), { type: "image/svg+xml" });
1444
+ }
1445
+ /**
1446
+ * Извлекает чистый формат (subtype) из contentType,
1447
+ * отбросив любую часть после «+» или «;»
1448
+ * @param contentType
1449
+ * @returns формат, например 'png', 'jpeg', 'svg'
1450
+ * @static
1451
+ */
1452
+ static getFormatFromContentType(e = "") {
1453
+ const t = e.match(/^[^/]+\/([^+;]+)/);
1454
+ return t ? t[1] : "";
1585
1455
  }
1586
1456
  }
1587
- class mt {
1457
+ class st {
1588
1458
  /**
1589
1459
  * @param {object} options
1590
1460
  * @param {ImageEditor} options.editor – экземпляр редактора
@@ -1601,25 +1471,25 @@ class mt {
1601
1471
  * @param {Boolean} [options.adaptCanvasToContainer] - Адаптировать канвас к контейнеру
1602
1472
  * @fires editor:resolution-width-changed
1603
1473
  */
1604
- setResolutionWidth(e, { preserveProportional: t, withoutSave: a, adaptCanvasToContainer: n } = {}) {
1474
+ setResolutionWidth(e, { preserveProportional: t, withoutSave: a, adaptCanvasToContainer: s } = {}) {
1605
1475
  var m;
1606
1476
  if (!e) return;
1607
1477
  const {
1608
1478
  canvas: i,
1609
- montageArea: s,
1610
- options: { canvasBackstoreWidth: r }
1611
- } = this.editor, { width: c, height: u } = s, l = Math.max(Math.min(Number(e), T), B);
1612
- if (!r || r === "auto" || n ? this.adaptCanvasToContainer() : r ? this.setCanvasBackstoreWidth(Number(r)) : this.setCanvasBackstoreWidth(l), s.set({ width: l }), (m = i.clipPath) == null || m.set({ width: l }), t) {
1613
- const f = l / c, v = u * f;
1614
- this.setResolutionHeight(v);
1479
+ montageArea: n,
1480
+ options: { canvasBackstoreWidth: o }
1481
+ } = this.editor, { width: c, height: d } = n, l = Math.max(Math.min(Number(e), O), B);
1482
+ if (!o || o === "auto" || s ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreWidth(Number(o)) : this.setCanvasBackstoreWidth(l), n.set({ width: l }), (m = i.clipPath) == null || m.set({ width: l }), t) {
1483
+ const M = l / c, j = d * M;
1484
+ this.setResolutionHeight(j);
1615
1485
  return;
1616
1486
  }
1617
- const { left: d, top: h } = this.getObjectDefaultCoords(s), g = i.getZoom();
1618
- i.setViewportTransform([g, 0, 0, g, d, h]), this.centerMontageArea(), a || this.editor.historyManager.saveState(), i.fire("editor:resolution-width-changed", {
1487
+ const { left: h, top: g } = this.getObjectDefaultCoords(n), u = i.getZoom();
1488
+ i.setViewportTransform([u, 0, 0, u, h, g]), this.centerMontageArea(), a || this.editor.historyManager.saveState(), i.fire("editor:resolution-width-changed", {
1619
1489
  width: l,
1620
1490
  preserveProportional: t,
1621
1491
  withoutSave: a,
1622
- adaptCanvasToContainer: n
1492
+ adaptCanvasToContainer: s
1623
1493
  });
1624
1494
  }
1625
1495
  /**
@@ -1631,25 +1501,25 @@ class mt {
1631
1501
  * @param {Boolean} [options.adaptCanvasToContainer] - Адаптировать канвас к контейнеру
1632
1502
  * @fires editor:resolution-height-changed
1633
1503
  */
1634
- setResolutionHeight(e, { preserveProportional: t, withoutSave: a, adaptCanvasToContainer: n } = {}) {
1504
+ setResolutionHeight(e, { preserveProportional: t, withoutSave: a, adaptCanvasToContainer: s } = {}) {
1635
1505
  var m;
1636
1506
  if (!e) return;
1637
1507
  const {
1638
1508
  canvas: i,
1639
- montageArea: s,
1640
- options: { canvasBackstoreHeight: r }
1641
- } = this.editor, { width: c, height: u } = s, l = Math.max(Math.min(Number(e), k), Z);
1642
- if (!r || r === "auto" || n ? this.adaptCanvasToContainer() : r ? this.setCanvasBackstoreHeight(Number(r)) : this.setCanvasBackstoreHeight(l), s.set({ height: l }), (m = i.clipPath) == null || m.set({ height: l }), t) {
1643
- const f = l / u, v = c * f;
1644
- this.setResolutionWidth(v);
1509
+ montageArea: n,
1510
+ options: { canvasBackstoreHeight: o }
1511
+ } = this.editor, { width: c, height: d } = n, l = Math.max(Math.min(Number(e), T), U);
1512
+ if (!o || o === "auto" || s ? this.adaptCanvasToContainer() : o ? this.setCanvasBackstoreHeight(Number(o)) : this.setCanvasBackstoreHeight(l), n.set({ height: l }), (m = i.clipPath) == null || m.set({ height: l }), t) {
1513
+ const M = l / d, j = c * M;
1514
+ this.setResolutionWidth(j);
1645
1515
  return;
1646
1516
  }
1647
- const { left: d, top: h } = this.getObjectDefaultCoords(s), g = i.getZoom();
1648
- i.setViewportTransform([g, 0, 0, g, d, h]), this.centerMontageArea(), a || this.editor.historyManager.saveState(), i.fire("editor:resolution-height-changed", {
1517
+ const { left: h, top: g } = this.getObjectDefaultCoords(n), u = i.getZoom();
1518
+ i.setViewportTransform([u, 0, 0, u, h, g]), this.centerMontageArea(), a || this.editor.historyManager.saveState(), i.fire("editor:resolution-height-changed", {
1649
1519
  height: l,
1650
1520
  preserveProportional: t,
1651
1521
  withoutSave: a,
1652
- adaptCanvasToContainer: n
1522
+ adaptCanvasToContainer: s
1653
1523
  });
1654
1524
  }
1655
1525
  /**
@@ -1658,16 +1528,16 @@ class mt {
1658
1528
  */
1659
1529
  centerMontageArea() {
1660
1530
  var c;
1661
- const { canvas: e, montageArea: t } = this.editor, a = e.getWidth(), n = e.getHeight(), i = e.getZoom(), s = new K(a / 2, n / 2);
1531
+ const { canvas: e, montageArea: t } = this.editor, a = e.getWidth(), s = e.getHeight(), i = e.getZoom(), n = new W(a / 2, s / 2);
1662
1532
  t.set({
1663
1533
  left: a / 2,
1664
- top: n / 2
1534
+ top: s / 2
1665
1535
  }), (c = e.clipPath) == null || c.set({
1666
1536
  left: a / 2,
1667
- top: n / 2
1537
+ top: s / 2
1668
1538
  }), e.renderAll();
1669
- const r = e.viewportTransform;
1670
- r[4] = a / 2 - s.x * i, r[5] = n / 2 - s.y * i, e.setViewportTransform(r), e.renderAll();
1539
+ const o = e.viewportTransform;
1540
+ o[4] = a / 2 - n.x * i, o[5] = s / 2 - n.y * i, e.setViewportTransform(o), e.renderAll();
1671
1541
  }
1672
1542
  /**
1673
1543
  * Метод для получения координат объекта с учетом текущего зума
@@ -1683,8 +1553,8 @@ class mt {
1683
1553
  code: "NO_ACTIVE_OBJECT",
1684
1554
  message: "Не выбран объект для получения координат"
1685
1555
  }), { left: 0, top: 0 };
1686
- const { width: n, height: i } = a, s = t.getZoom(), r = (n - n * s) / 2, c = (i - i * s) / 2;
1687
- return { left: r, top: c };
1556
+ const { width: s, height: i } = a, n = t.getZoom(), o = (s - s * n) / 2, c = (i - i * n) / 2;
1557
+ return { left: o, top: c };
1688
1558
  }
1689
1559
  /**
1690
1560
  * Устанавливаем ширину канваса в backstore (для экспорта)
@@ -1692,7 +1562,7 @@ class mt {
1692
1562
  */
1693
1563
  setCanvasBackstoreWidth(e) {
1694
1564
  if (!e || typeof e != "number") return;
1695
- const t = Math.max(Math.min(e, T), B);
1565
+ const t = Math.max(Math.min(e, O), B);
1696
1566
  this.editor.canvas.setDimensions({ width: t }, { backstoreOnly: !0 });
1697
1567
  }
1698
1568
  /**
@@ -1701,7 +1571,7 @@ class mt {
1701
1571
  */
1702
1572
  setCanvasBackstoreHeight(e) {
1703
1573
  if (!e || typeof e != "number") return;
1704
- const t = Math.max(Math.min(e, k), Z);
1574
+ const t = Math.max(Math.min(e, T), U);
1705
1575
  this.editor.canvas.setDimensions({ height: t }, { backstoreOnly: !0 });
1706
1576
  }
1707
1577
  /**
@@ -1710,8 +1580,8 @@ class mt {
1710
1580
  * с учётом минимальных и максимальных значений.
1711
1581
  */
1712
1582
  adaptCanvasToContainer() {
1713
- const { canvas: e } = this.editor, t = e.editorContainer, a = t.clientWidth, n = t.clientHeight, i = Math.max(Math.min(a, T), B), s = Math.max(Math.min(n, k), Z);
1714
- console.log("adaptCanvasToContainer newWidth", i), console.log("adaptCanvasToContainer newHeight", s), e.setDimensions({ width: i, height: s }, { backstoreOnly: !0 });
1583
+ const { canvas: e } = this.editor, t = e.editorContainer, a = t.clientWidth, s = t.clientHeight, i = Math.max(Math.min(a, O), B), n = Math.max(Math.min(s, T), U);
1584
+ console.log("adaptCanvasToContainer newWidth", i), console.log("adaptCanvasToContainer newHeight", n), e.setDimensions({ width: i, height: n }, { backstoreOnly: !0 });
1715
1585
  }
1716
1586
  /**
1717
1587
  * Обновляет размеры канваса и вписывает объекты в монтажную область.
@@ -1724,12 +1594,12 @@ class mt {
1724
1594
  selectionManager: t,
1725
1595
  transformManager: a,
1726
1596
  montageArea: {
1727
- width: n,
1597
+ width: s,
1728
1598
  height: i
1729
1599
  }
1730
1600
  } = this.editor;
1731
- this.setResolutionWidth(n, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.setResolutionHeight(i, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.centerMontageArea(), t.selectAll(), a.fitObject({ fitAsOneObject: !0, withoutSave: !0 }), e.fire("editor:canvas-updated", {
1732
- width: n,
1601
+ this.setResolutionWidth(s, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.setResolutionHeight(i, { adaptCanvasToContainer: !0, withoutSave: !0 }), this.centerMontageArea(), t.selectAll(), a.fitObject({ fitAsOneObject: !0, withoutSave: !0 }), e.fire("editor:canvas-updated", {
1602
+ width: s,
1733
1603
  height: i
1734
1604
  });
1735
1605
  }
@@ -1745,11 +1615,11 @@ class mt {
1745
1615
  * @param {Number} zoom — текущее значение zoom (например, 1, 1.2, 2 и т.д.)
1746
1616
  */
1747
1617
  updateCssDimensionsForZoom(e) {
1748
- const { canvas: t, montageArea: a } = this.editor, n = a.width * e, i = a.height * e, s = t.wrapperEl.parentNode;
1749
- if (!(s instanceof HTMLElement)) return;
1750
- const r = n <= s.clientWidth ? "100%" : n, c = i <= s.clientHeight ? "100%" : i;
1618
+ const { canvas: t, montageArea: a } = this.editor, s = a.width * e, i = a.height * e, n = t.wrapperEl.parentNode;
1619
+ if (!(n instanceof HTMLElement)) return;
1620
+ const o = s <= n.clientWidth ? "100%" : s, c = i <= n.clientHeight ? "100%" : i;
1751
1621
  t.setDimensions(
1752
- { width: r, height: c },
1622
+ { width: o, height: c },
1753
1623
  { cssOnly: !0 }
1754
1624
  );
1755
1625
  }
@@ -1836,32 +1706,32 @@ class mt {
1836
1706
  */
1837
1707
  setDisplayDimension({ element: e = "canvas", dimension: t, value: a } = {}) {
1838
1708
  if (!a) return;
1839
- const { canvas: n, options: { editorContainer: i } } = this.editor, s = [];
1709
+ const { canvas: s, options: { editorContainer: i } } = this.editor, n = [];
1840
1710
  switch (e) {
1841
1711
  case "canvas":
1842
- s.push(n.lowerCanvasEl, n.upperCanvasEl);
1712
+ n.push(s.lowerCanvasEl, s.upperCanvasEl);
1843
1713
  break;
1844
1714
  case "wrapper":
1845
- s.push(n.wrapperEl);
1715
+ n.push(s.wrapperEl);
1846
1716
  break;
1847
1717
  case "container":
1848
- s.push(i);
1718
+ n.push(i);
1849
1719
  break;
1850
1720
  default:
1851
- s.push(n.lowerCanvasEl, n.upperCanvasEl);
1721
+ n.push(s.lowerCanvasEl, s.upperCanvasEl);
1852
1722
  }
1853
- const r = t === "width" ? "width" : "height";
1723
+ const o = t === "width" ? "width" : "height";
1854
1724
  if (typeof a == "string") {
1855
- s.forEach((u) => {
1856
- u.style[r] = a;
1725
+ n.forEach((d) => {
1726
+ d.style[o] = a;
1857
1727
  });
1858
1728
  return;
1859
1729
  }
1860
1730
  if (isNaN(a)) return;
1861
1731
  const c = `${a}px`;
1862
- s.forEach((u) => {
1863
- u.style[r] = c;
1864
- }), n.fire(`editor:display-${e}-${r}-changed`, {
1732
+ n.forEach((d) => {
1733
+ d.style[o] = c;
1734
+ }), s.fire(`editor:display-${e}-${o}-changed`, {
1865
1735
  element: e,
1866
1736
  value: a
1867
1737
  });
@@ -1876,28 +1746,28 @@ class mt {
1876
1746
  */
1877
1747
  scaleMontageAreaToImage({ object: e, preserveAspectRatio: t, withoutSave: a } = {}) {
1878
1748
  const {
1879
- canvas: n,
1749
+ canvas: s,
1880
1750
  montageArea: i,
1881
- transformManager: s,
1751
+ transformManager: n,
1882
1752
  options: {
1883
- montageAreaWidth: r,
1753
+ montageAreaWidth: o,
1884
1754
  montageAreaHeight: c
1885
1755
  }
1886
- } = this.editor, u = e || n.getActiveObject();
1887
- if (!u || u.type !== "image" && u.format !== "svg") return;
1888
- const { width: l, height: d } = u;
1889
- let h = Math.min(l, T), g = Math.min(d, k);
1756
+ } = this.editor, d = e || s.getActiveObject();
1757
+ if (!d || d.type !== "image" && d.format !== "svg") return;
1758
+ const { width: l, height: h } = d;
1759
+ let g = Math.min(l, O), u = Math.min(h, T);
1890
1760
  if (t) {
1891
1761
  const {
1892
1762
  width: m,
1893
- height: f
1894
- } = i, v = l / m, M = d / f, S = Math.max(v, M);
1895
- h = m * S, g = f * S;
1763
+ height: M
1764
+ } = i, j = l / m, w = h / M, I = Math.max(j, w);
1765
+ g = m * I, u = M * I;
1896
1766
  }
1897
- this.setResolutionWidth(h, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), (l > r || d > c) && s.calculateAndApplyDefaultZoom(), s.resetObject(u, { withoutSave: !0 }), n.centerObject(u), n.renderAll(), a || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
1898
- object: u,
1899
- width: h,
1900
- height: g,
1767
+ this.setResolutionWidth(g, { withoutSave: !0 }), this.setResolutionHeight(u, { withoutSave: !0 }), (l > o || h > c) && n.calculateAndApplyDefaultZoom(), n.resetObject(d, { withoutSave: !0 }), s.centerObject(d), s.renderAll(), a || this.editor.historyManager.saveState(), s.fire("editor:montage-area-scaled-to-image", {
1768
+ object: d,
1769
+ width: g,
1770
+ height: u,
1901
1771
  preserveAspectRatio: t,
1902
1772
  withoutSave: a
1903
1773
  });
@@ -1920,13 +1790,13 @@ class mt {
1920
1790
  const {
1921
1791
  canvas: t,
1922
1792
  transformManager: a,
1923
- historyManager: n,
1793
+ historyManager: s,
1924
1794
  options: {
1925
1795
  montageAreaWidth: i,
1926
- montageAreaHeight: s
1796
+ montageAreaHeight: n
1927
1797
  }
1928
1798
  } = this.editor;
1929
- a.resetZoom(), this.setResolutionWidth(i, { withoutSave: !0 }), this.setResolutionHeight(s, { withoutSave: !0 }), t.renderAll(), a.resetObjects(), e || n.saveState(), t.fire("editor:default-scale-set");
1799
+ a.resetZoom(), this.setResolutionWidth(i, { withoutSave: !0 }), this.setResolutionHeight(n, { withoutSave: !0 }), t.renderAll(), a.resetObjects(), e || s.saveState(), t.fire("editor:default-scale-set");
1930
1800
  }
1931
1801
  /**
1932
1802
  * Получение всех объектов внутри монтажной области редактора
@@ -1937,9 +1807,9 @@ class mt {
1937
1807
  return e.getObjects().filter((i) => i.id !== t.id && i.id !== a.id);
1938
1808
  }
1939
1809
  }
1940
- class vt {
1810
+ class it {
1941
1811
  constructor({ editor: e }) {
1942
- this.editor = e, this.options = e.options, this.minZoom = this.options.minZoom || lt, this.maxZoom = this.options.maxZoom || ht, this.defaultZoom = this.options.defaultScale, this.maxZoomFactor = this.options.maxZoomFactor;
1812
+ this.editor = e, this.options = e.options, this.minZoom = this.options.minZoom || qe, this.maxZoom = this.options.maxZoom || et, this.defaultZoom = this.options.defaultScale, this.maxZoomFactor = this.options.maxZoomFactor;
1943
1813
  }
1944
1814
  /**
1945
1815
  * Метод рассчитывает и применяет зум по умолчанию для монтажной области редактора.
@@ -1949,10 +1819,10 @@ class vt {
1949
1819
  * @param {Number} [scale] - Желаемый масштаб относительно размеров контейнера редактора.
1950
1820
  */
1951
1821
  calculateAndApplyDefaultZoom(e = this.options.defaultScale) {
1952
- const { canvas: t } = this.editor, a = t.editorContainer, n = a.clientWidth, i = a.clientHeight, { width: s, height: r } = this.editor.montageArea, c = n / s * e, u = i / r * e;
1953
- this.defaultZoom = Math.min(c, u);
1954
- const { defaultZoom: l, maxZoomFactor: d, minZoom: h, maxZoom: g } = this;
1955
- this.minZoom = Math.min(l / d, h), this.maxZoom = Math.max(l * d, g), this.setZoom();
1822
+ const { canvas: t } = this.editor, a = t.editorContainer, s = a.clientWidth, i = a.clientHeight, { width: n, height: o } = this.editor.montageArea, c = s / n * e, d = i / o * e;
1823
+ this.defaultZoom = Math.min(c, d);
1824
+ const { defaultZoom: l, maxZoomFactor: h, minZoom: g, maxZoom: u } = this;
1825
+ this.minZoom = Math.min(l / h, g), this.maxZoom = Math.max(l * h, u), this.setZoom();
1956
1826
  }
1957
1827
  /**
1958
1828
  * Увеличение/уменьшение масштаба
@@ -1963,18 +1833,18 @@ class vt {
1963
1833
  * @fires editor:zoom-changed
1964
1834
  * Если передавать координаты курсора, то нужно быть аккуратнее, так как юзер может выйти за пределы рабочей области
1965
1835
  */
1966
- zoom(e = gt, t = {}) {
1967
- var h, g;
1836
+ zoom(e = tt, t = {}) {
1837
+ var g, u;
1968
1838
  if (!e) return;
1969
- const { minZoom: a, maxZoom: n } = this, { canvas: i } = this.editor, s = i.getZoom(), r = i.getCenterPoint(), c = (h = t.pointX) != null ? h : r.x, u = (g = t.pointY) != null ? g : r.y, l = new K(c, u);
1970
- let d = Number((s + Number(e)).toFixed(2));
1971
- d > n && (d = n), d < a && (d = a), i.zoomToPoint(l, d), console.log({
1972
- currentZoom: s,
1973
- zoom: d,
1839
+ const { minZoom: a, maxZoom: s } = this, { canvas: i } = this.editor, n = i.getZoom(), o = i.getCenterPoint(), c = (g = t.pointX) != null ? g : o.x, d = (u = t.pointY) != null ? u : o.y, l = new W(c, d);
1840
+ let h = Number((n + Number(e)).toFixed(2));
1841
+ h > s && (h = s), h < a && (h = a), i.zoomToPoint(l, h), console.log({
1842
+ currentZoom: n,
1843
+ zoom: h,
1974
1844
  point: l
1975
1845
  }), i.fire("editor:zoom-changed", {
1976
1846
  currentZoom: i.getZoom(),
1977
- zoom: d,
1847
+ zoom: h,
1978
1848
  point: l
1979
1849
  });
1980
1850
  }
@@ -1984,11 +1854,11 @@ class vt {
1984
1854
  * @fires editor:zoom-changed
1985
1855
  */
1986
1856
  setZoom(e = this.defaultZoom) {
1987
- const { minZoom: t, maxZoom: a } = this, { canvas: n } = this.editor, i = new K(n.getCenterPoint());
1988
- let s = e;
1989
- e > a && (s = a), e < t && (s = t), n.zoomToPoint(i, s), n.fire("editor:zoom-changed", {
1990
- currentZoom: n.getZoom(),
1991
- zoom: s,
1857
+ const { minZoom: t, maxZoom: a } = this, { canvas: s } = this.editor, i = new W(s.getCenterPoint());
1858
+ let n = e;
1859
+ e > a && (n = a), e < t && (n = t), s.zoomToPoint(i, n), s.fire("editor:zoom-changed", {
1860
+ currentZoom: s.getZoom(),
1861
+ zoom: n,
1992
1862
  point: i
1993
1863
  });
1994
1864
  }
@@ -1997,7 +1867,7 @@ class vt {
1997
1867
  * @fires editor:zoom-changed
1998
1868
  */
1999
1869
  resetZoom() {
2000
- const { canvas: e } = this.editor, t = new K(e.getCenterPoint());
1870
+ const { canvas: e } = this.editor, t = new W(e.getCenterPoint());
2001
1871
  e.zoomToPoint(t, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
2002
1872
  currentZoom: e.getZoom(),
2003
1873
  point: t
@@ -2010,14 +1880,14 @@ class vt {
2010
1880
  * @param {Boolean} options.withoutSave - Не сохранять состояние
2011
1881
  * @fires editor:object-rotated
2012
1882
  */
2013
- rotate(e = Mt, { withoutSave: t } = {}) {
2014
- const { canvas: a, historyManager: n } = this.editor, i = a.getActiveObject();
1883
+ rotate(e = at, { withoutSave: t } = {}) {
1884
+ const { canvas: a, historyManager: s } = this.editor, i = a.getActiveObject();
2015
1885
  if (!i) return;
2016
- const s = i.angle + e;
2017
- i.rotate(s), i.setCoords(), a.renderAll(), t || n.saveState(), a.fire("editor:object-rotated", {
1886
+ const n = i.angle + e;
1887
+ i.rotate(n), i.setCoords(), a.renderAll(), t || s.saveState(), a.fire("editor:object-rotated", {
2018
1888
  object: i,
2019
1889
  withoutSave: t,
2020
- angle: s
1890
+ angle: n
2021
1891
  });
2022
1892
  }
2023
1893
  /**
@@ -2027,9 +1897,9 @@ class vt {
2027
1897
  * @fires editor:object-flipped-x
2028
1898
  */
2029
1899
  flipX({ withoutSave: e } = {}) {
2030
- const { canvas: t, historyManager: a } = this.editor, n = t.getActiveObject();
2031
- n && (n.flipX = !n.flipX, t.renderAll(), e || a.saveState(), t.fire("editor:object-flipped-x", {
2032
- object: n,
1900
+ const { canvas: t, historyManager: a } = this.editor, s = t.getActiveObject();
1901
+ s && (s.flipX = !s.flipX, t.renderAll(), e || a.saveState(), t.fire("editor:object-flipped-x", {
1902
+ object: s,
2033
1903
  withoutSave: e
2034
1904
  }));
2035
1905
  }
@@ -2040,9 +1910,9 @@ class vt {
2040
1910
  * @fires editor:object-flipped-y
2041
1911
  */
2042
1912
  flipY({ withoutSave: e } = {}) {
2043
- const { canvas: t, historyManager: a } = this.editor, n = t.getActiveObject();
2044
- n && (n.flipY = !n.flipY, t.renderAll(), e || a.saveState(), t.fire("editor:object-flipped-y", {
2045
- object: n,
1913
+ const { canvas: t, historyManager: a } = this.editor, s = t.getActiveObject();
1914
+ s && (s.flipY = !s.flipY, t.renderAll(), e || a.saveState(), t.fire("editor:object-flipped-y", {
1915
+ object: s,
2046
1916
  withoutSave: e
2047
1917
  }));
2048
1918
  }
@@ -2056,11 +1926,11 @@ class vt {
2056
1926
  opacity: t = 1,
2057
1927
  withoutSave: a
2058
1928
  } = {}) {
2059
- const { canvas: n, historyManager: i } = this.editor, s = e || n.getActiveObject();
2060
- s && (s instanceof N ? s.getObjects().forEach((r) => {
2061
- r.set("opacity", t);
2062
- }) : s.set("opacity", t), n.renderAll(), a || i.saveState(), n.fire("editor:object-opacity-changed", {
2063
- object: s,
1929
+ const { canvas: s, historyManager: i } = this.editor, n = e || s.getActiveObject();
1930
+ n && (n instanceof E ? n.getObjects().forEach((o) => {
1931
+ o.set("opacity", t);
1932
+ }) : n.set("opacity", t), s.renderAll(), a || i.saveState(), s.fire("editor:object-opacity-changed", {
1933
+ object: n,
2064
1934
  opacity: t,
2065
1935
  withoutSave: a
2066
1936
  }));
@@ -2080,30 +1950,30 @@ class vt {
2080
1950
  object: e,
2081
1951
  type: t = this.options.scaleType,
2082
1952
  withoutSave: a,
2083
- fitAsOneObject: n
1953
+ fitAsOneObject: s
2084
1954
  } = {}) {
2085
- const { canvas: i, imageManager: s, historyManager: r } = this.editor, c = e || i.getActiveObject();
1955
+ const { canvas: i, imageManager: n, historyManager: o } = this.editor, c = e || i.getActiveObject();
2086
1956
  if (c) {
2087
- if (c.set("angle", 0), c instanceof N && !n) {
2088
- const u = c.getObjects();
2089
- i.discardActiveObject(), u.forEach((d) => {
2090
- const h = s.calculateScaleFactor({ imageObject: d, scaleType: t });
2091
- d.scale(h), i.centerObject(d);
1957
+ if (c.set("angle", 0), c instanceof E && !s) {
1958
+ const d = c.getObjects();
1959
+ i.discardActiveObject(), d.forEach((h) => {
1960
+ const g = n.calculateScaleFactor({ imageObject: h, scaleType: t });
1961
+ h.scale(g), i.centerObject(h);
2092
1962
  });
2093
- const l = new N(u, { canvas: i });
1963
+ const l = new E(d, { canvas: i });
2094
1964
  i.setActiveObject(l);
2095
1965
  } else {
2096
- const u = s.calculateScaleFactor({
1966
+ const d = n.calculateScaleFactor({
2097
1967
  imageObject: c,
2098
1968
  scaleType: t
2099
1969
  });
2100
- c.scale(u), i.centerObject(c);
1970
+ c.scale(d), i.centerObject(c);
2101
1971
  }
2102
- i.renderAll(), a || r.saveState(), i.fire("editor:object-fitted", {
1972
+ i.renderAll(), a || o.saveState(), i.fire("editor:object-fitted", {
2103
1973
  object: c,
2104
1974
  type: t,
2105
1975
  withoutSave: a,
2106
- fitAsOneObject: n
1976
+ fitAsOneObject: s
2107
1977
  });
2108
1978
  }
2109
1979
  }
@@ -2126,36 +1996,36 @@ class vt {
2126
1996
  */
2127
1997
  resetObject(e, { alwaysFitObject: t = !1, withoutSave: a = !1 } = {}) {
2128
1998
  const {
2129
- canvas: n,
1999
+ canvas: s,
2130
2000
  montageArea: i,
2131
- imageManager: s,
2132
- historyManager: r,
2001
+ imageManager: n,
2002
+ historyManager: o,
2133
2003
  options: { scaleType: c }
2134
- } = this.editor, u = e || n.getActiveObject();
2135
- if (!u || u.locked) return;
2136
- if (r.suspendHistory(), u.type === "image" || u.format === "svg" || u.set({
2004
+ } = this.editor, d = e || s.getActiveObject();
2005
+ if (!d || d.locked) return;
2006
+ if (o.suspendHistory(), d.type === "image" || d.format === "svg" || d.set({
2137
2007
  scaleX: 1,
2138
2008
  scaleY: 1,
2139
2009
  flipX: !1,
2140
2010
  flipY: !1,
2141
2011
  angle: 0
2142
2012
  }), t)
2143
- this.fitObject({ object: u, withoutSave: !0, fitAsOneObject: !0 });
2013
+ this.fitObject({ object: d, withoutSave: !0, fitAsOneObject: !0 });
2144
2014
  else {
2145
- const { width: d, height: h } = i, { width: g, height: m } = u, f = s.calculateScaleFactor({
2146
- imageObject: u,
2015
+ const { width: h, height: g } = i, { width: u, height: m } = d, M = n.calculateScaleFactor({
2016
+ imageObject: d,
2147
2017
  scaleType: c
2148
2018
  });
2149
- c === "contain" && f < 1 || c === "cover" && (g > d || m > h) ? this.fitObject({ object: u, withoutSave: !0, fitAsOneObject: !0 }) : u.set({ scaleX: 1, scaleY: 1 });
2019
+ c === "contain" && M < 1 || c === "cover" && (u > h || m > g) ? this.fitObject({ object: d, withoutSave: !0, fitAsOneObject: !0 }) : d.set({ scaleX: 1, scaleY: 1 });
2150
2020
  }
2151
- u.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(u), n.renderAll(), r.resumeHistory(), a || r.saveState(), n.fire("editor:object-reset", {
2152
- object: u,
2021
+ d.set({ flipX: !1, flipY: !1, angle: 0 }), s.centerObject(d), s.renderAll(), o.resumeHistory(), a || o.saveState(), s.fire("editor:object-reset", {
2022
+ object: d,
2153
2023
  withoutSave: a,
2154
2024
  alwaysFitObject: t
2155
2025
  });
2156
2026
  }
2157
2027
  }
2158
- class ft {
2028
+ class nt {
2159
2029
  /**
2160
2030
  * @param {object} options
2161
2031
  * @param {ImageEditor} options.editor – экземпляр редактора
@@ -2204,16 +2074,16 @@ class ft {
2204
2074
  if (!(!t || !this.overlayMask)) {
2205
2075
  a.suspendHistory(), t.setCoords();
2206
2076
  var {
2207
- left: n,
2077
+ left: s,
2208
2078
  top: i,
2209
- width: s,
2210
- height: r
2079
+ width: n,
2080
+ height: o
2211
2081
  } = t.getBoundingRect();
2212
2082
  this.overlayMask.set({
2213
- left: n,
2083
+ left: s,
2214
2084
  top: i,
2215
- width: s,
2216
- height: r
2085
+ width: n,
2086
+ height: o
2217
2087
  }), e.discardActiveObject(), this.editor.layerManager.bringToFront(this.overlayMask, {
2218
2088
  withoutSave: !0
2219
2089
  }), a.resumeHistory();
@@ -2233,8 +2103,8 @@ class ft {
2233
2103
  canvasManager: t,
2234
2104
  historyManager: a
2235
2105
  } = this.editor;
2236
- a.suspendHistory(), this.isBlocked = !0, e.discardActiveObject(), e.selection = !1, e.skipTargetFind = !0, t.getObjects().forEach((n) => {
2237
- n.evented = !1, n.selectable = !1;
2106
+ a.suspendHistory(), this.isBlocked = !0, e.discardActiveObject(), e.selection = !1, e.skipTargetFind = !0, t.getObjects().forEach((s) => {
2107
+ s.evented = !1, s.selectable = !1;
2238
2108
  }), e.upperCanvasEl.style.pointerEvents = "none", e.lowerCanvasEl.style.pointerEvents = "none", this.overlayMask.visible = !0, this.refresh(), e.fire("editor:disabled"), a.resumeHistory();
2239
2109
  }
2240
2110
  }
@@ -2249,13 +2119,13 @@ class ft {
2249
2119
  canvasManager: t,
2250
2120
  historyManager: a
2251
2121
  } = this.editor;
2252
- a.suspendHistory(), this.isBlocked = !1, e.selection = !0, e.skipTargetFind = !1, t.getObjects().forEach((n) => {
2253
- n.evented = !0, n.selectable = !0;
2122
+ a.suspendHistory(), this.isBlocked = !1, e.selection = !0, e.skipTargetFind = !1, t.getObjects().forEach((s) => {
2123
+ s.evented = !0, s.selectable = !0;
2254
2124
  }), e.upperCanvasEl.style.pointerEvents = "", e.lowerCanvasEl.style.pointerEvents = "", this.overlayMask.visible = !1, e.requestRenderAll(), e.fire("editor:enabled"), a.resumeHistory();
2255
2125
  }
2256
2126
  }
2257
2127
  }
2258
- class $ {
2128
+ class F {
2259
2129
  /**
2260
2130
  * @param {object} options
2261
2131
  * @param {ImageEditor} options.editor - экземпляр редактора с доступом к canvas
@@ -2278,13 +2148,13 @@ class $ {
2278
2148
  withoutSave: t
2279
2149
  } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, {
2280
2150
  canvas: a,
2281
- historyManager: n
2151
+ historyManager: s
2282
2152
  } = this.editor;
2283
- n.suspendHistory();
2153
+ s.suspendHistory();
2284
2154
  var i = e || a.getActiveObject();
2285
- i && (i.type === "activeselection" ? i.getObjects().forEach((s) => {
2286
- a.bringObjectToFront(s);
2287
- }) : a.bringObjectToFront(i), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:object-bring-to-front", {
2155
+ i && (i.type === "activeselection" ? i.getObjects().forEach((n) => {
2156
+ a.bringObjectToFront(n);
2157
+ }) : a.bringObjectToFront(i), a.renderAll(), s.resumeHistory(), t || s.saveState(), a.fire("editor:object-bring-to-front", {
2288
2158
  object: i,
2289
2159
  withoutSave: t
2290
2160
  }));
@@ -2301,11 +2171,11 @@ class $ {
2301
2171
  withoutSave: t
2302
2172
  } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, {
2303
2173
  canvas: a,
2304
- historyManager: n
2174
+ historyManager: s
2305
2175
  } = this.editor;
2306
- n.suspendHistory();
2176
+ s.suspendHistory();
2307
2177
  var i = e || a.getActiveObject();
2308
- i && (i.type === "activeselection" ? $._moveSelectionForward(a, i) : a.bringObjectForward(i), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:object-bring-forward", {
2178
+ i && (i.type === "activeselection" ? F._moveSelectionForward(a, i) : a.bringObjectForward(i), a.renderAll(), s.resumeHistory(), t || s.saveState(), a.fire("editor:object-bring-forward", {
2309
2179
  object: i,
2310
2180
  withoutSave: t
2311
2181
  }));
@@ -2322,22 +2192,22 @@ class $ {
2322
2192
  withoutSave: t
2323
2193
  } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, {
2324
2194
  canvas: a,
2325
- montageArea: n,
2195
+ montageArea: s,
2326
2196
  historyManager: i,
2327
2197
  interactionBlocker: {
2328
- overlayMask: s
2198
+ overlayMask: n
2329
2199
  }
2330
2200
  } = this.editor;
2331
2201
  i.suspendHistory();
2332
- var r = e || a.getActiveObject();
2333
- if (r) {
2334
- if (r.type === "activeselection")
2335
- for (var c = r.getObjects(), u = c.length - 1; u >= 0; u -= 1)
2336
- a.sendObjectToBack(c[u]);
2202
+ var o = e || a.getActiveObject();
2203
+ if (o) {
2204
+ if (o.type === "activeselection")
2205
+ for (var c = o.getObjects(), d = c.length - 1; d >= 0; d -= 1)
2206
+ a.sendObjectToBack(c[d]);
2337
2207
  else
2338
- a.sendObjectToBack(r);
2339
- a.sendObjectToBack(n), a.sendObjectToBack(s), a.renderAll(), i.resumeHistory(), t || i.saveState(), a.fire("editor:object-send-to-back", {
2340
- object: r,
2208
+ a.sendObjectToBack(o);
2209
+ a.sendObjectToBack(s), a.sendObjectToBack(n), a.renderAll(), i.resumeHistory(), t || i.saveState(), a.fire("editor:object-send-to-back", {
2210
+ object: o,
2341
2211
  withoutSave: t
2342
2212
  });
2343
2213
  }
@@ -2353,16 +2223,16 @@ class $ {
2353
2223
  withoutSave: t
2354
2224
  } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, {
2355
2225
  canvas: a,
2356
- montageArea: n,
2226
+ montageArea: s,
2357
2227
  historyManager: i,
2358
2228
  interactionBlocker: {
2359
- overlayMask: s
2229
+ overlayMask: n
2360
2230
  }
2361
2231
  } = this.editor;
2362
2232
  i.suspendHistory();
2363
- var r = e || a.getActiveObject();
2364
- r && (r.type === "activeselection" ? $._moveSelectionBackwards(a, r) : a.sendObjectBackwards(r), a.sendObjectToBack(n), a.sendObjectToBack(s), a.renderAll(), i.resumeHistory(), t || i.saveState(), a.fire("editor:object-send-backwards", {
2365
- object: r,
2233
+ var o = e || a.getActiveObject();
2234
+ o && (o.type === "activeselection" ? F._moveSelectionBackwards(a, o) : a.sendObjectBackwards(o), a.sendObjectToBack(s), a.sendObjectToBack(n), a.renderAll(), i.resumeHistory(), t || i.saveState(), a.fire("editor:object-send-backwards", {
2235
+ object: o,
2366
2236
  withoutSave: t
2367
2237
  }));
2368
2238
  }
@@ -2374,20 +2244,20 @@ class $ {
2374
2244
  * @private
2375
2245
  */
2376
2246
  static _moveSelectionForward(e, t) {
2377
- for (var a = e.getObjects(), n = t.getObjects(), i = n.map((l) => a.indexOf(l)), s = -1, r = function(d) {
2378
- var h = a[d];
2379
- if (!n.includes(h) && i.some((g) => d > g))
2380
- return s = d, 1;
2381
- }, c = 0; c < a.length && !r(c); c += 1)
2247
+ for (var a = e.getObjects(), s = t.getObjects(), i = s.map((l) => a.indexOf(l)), n = -1, o = function(h) {
2248
+ var g = a[h];
2249
+ if (!s.includes(g) && i.some((u) => h > u))
2250
+ return n = h, 1;
2251
+ }, c = 0; c < a.length && !o(c); c += 1)
2382
2252
  ;
2383
- if (s !== -1) {
2384
- var u = n.map((l) => ({
2253
+ if (n !== -1) {
2254
+ var d = s.map((l) => ({
2385
2255
  obj: l,
2386
2256
  index: a.indexOf(l)
2387
- })).sort((l, d) => d.index - l.index);
2388
- u.forEach((l) => {
2389
- var d = a.indexOf(l.obj);
2390
- d < s && (e.moveObjectTo(l.obj, s), s = d);
2257
+ })).sort((l, h) => h.index - l.index);
2258
+ d.forEach((l) => {
2259
+ var h = a.indexOf(l.obj);
2260
+ h < n && (e.moveObjectTo(l.obj, n), n = h);
2391
2261
  });
2392
2262
  }
2393
2263
  }
@@ -2399,11 +2269,11 @@ class $ {
2399
2269
  * @private
2400
2270
  */
2401
2271
  static _moveSelectionBackwards(e, t) {
2402
- for (var a = e.getObjects(), n = t.getObjects(), i = Math.min(...n.map((r) => a.indexOf(r))), s = n.length - 1; s >= 0; s -= 1)
2403
- e.moveObjectTo(n[s], i - 1);
2272
+ for (var a = e.getObjects(), s = t.getObjects(), i = Math.min(...s.map((o) => a.indexOf(o))), n = s.length - 1; n >= 0; n -= 1)
2273
+ e.moveObjectTo(s[n], i - 1);
2404
2274
  }
2405
2275
  }
2406
- class jt {
2276
+ class ot {
2407
2277
  /**
2408
2278
  * Менеджер фигур для редактора.
2409
2279
  * @param {Object} options - Опции и настройки менеджера фигур.
@@ -2427,15 +2297,15 @@ class jt {
2427
2297
  * @param {Object} flags.withoutSelection - Не выделять объект
2428
2298
  * @param {Object} flags.withoutAdding - Не добавлять объект в canvas
2429
2299
  */
2430
- addRectangle(l = {}, { withoutSelection: c, withoutAdding: u } = {}) {
2431
- var d = l, {
2432
- id: e = `rect-${A()}`,
2300
+ addRectangle(l = {}, { withoutSelection: c, withoutAdding: d } = {}) {
2301
+ var h = l, {
2302
+ id: e = `rect-${D()}`,
2433
2303
  left: t,
2434
2304
  top: a,
2435
- width: n = 100,
2305
+ width: s = 100,
2436
2306
  height: i = 100,
2437
- fill: s = "blue"
2438
- } = d, r = Q(d, [
2307
+ fill: n = "blue"
2308
+ } = h, o = Y(h, [
2439
2309
  "id",
2440
2310
  "left",
2441
2311
  "top",
@@ -2443,15 +2313,15 @@ class jt {
2443
2313
  "height",
2444
2314
  "fill"
2445
2315
  ]);
2446
- const { canvas: h } = this.editor, g = new ke(C({
2316
+ const { canvas: g } = this.editor, u = new pe(N({
2447
2317
  id: e,
2448
2318
  left: t,
2449
2319
  top: a,
2450
- width: n,
2320
+ width: s,
2451
2321
  height: i,
2452
- fill: s
2453
- }, r));
2454
- return !t && !a && h.centerObject(g), u || (h.add(g), c || h.setActiveObject(g), h.renderAll()), g;
2322
+ fill: n
2323
+ }, o));
2324
+ return !t && !a && g.centerObject(u), d || (g.add(u), c || g.setActiveObject(u), g.renderAll()), u;
2455
2325
  }
2456
2326
  /**
2457
2327
  * Добавление круга
@@ -2469,28 +2339,28 @@ class jt {
2469
2339
  * @param {Object} flags.withoutSelection - Не выделять объект
2470
2340
  * @param {Object} flags.withoutAdding - Не добавлять объект в canvas
2471
2341
  */
2472
- addCircle(u = {}, { withoutSelection: r, withoutAdding: c } = {}) {
2473
- var l = u, {
2474
- id: e = `circle-${A()}`,
2342
+ addCircle(d = {}, { withoutSelection: o, withoutAdding: c } = {}) {
2343
+ var l = d, {
2344
+ id: e = `circle-${D()}`,
2475
2345
  left: t,
2476
2346
  top: a,
2477
- radius: n = 50,
2347
+ radius: s = 50,
2478
2348
  fill: i = "green"
2479
- } = l, s = Q(l, [
2349
+ } = l, n = Y(l, [
2480
2350
  "id",
2481
2351
  "left",
2482
2352
  "top",
2483
2353
  "radius",
2484
2354
  "fill"
2485
2355
  ]);
2486
- const { canvas: d } = this.editor, h = new xe(C({
2356
+ const { canvas: h } = this.editor, g = new Ie(N({
2487
2357
  id: e,
2488
2358
  left: t,
2489
2359
  top: a,
2490
2360
  fill: i,
2491
- radius: n
2492
- }, s));
2493
- return !t && !a && d.centerObject(h), c || (d.add(h), r || d.setActiveObject(h), d.renderAll()), h;
2361
+ radius: s
2362
+ }, n));
2363
+ return !t && !a && h.centerObject(g), c || (h.add(g), o || h.setActiveObject(g), h.renderAll()), g;
2494
2364
  }
2495
2365
  /**
2496
2366
  * Добавление треугольника
@@ -2509,15 +2379,15 @@ class jt {
2509
2379
  * @param {Object} flags.withoutSelection - Не выделять объект
2510
2380
  * @param {Object} flags.withoutAdding - Не добавлять объект в canvas
2511
2381
  */
2512
- addTriangle(l = {}, { withoutSelection: c, withoutAdding: u } = {}) {
2513
- var d = l, {
2514
- id: e = `triangle-${A()}`,
2382
+ addTriangle(l = {}, { withoutSelection: c, withoutAdding: d } = {}) {
2383
+ var h = l, {
2384
+ id: e = `triangle-${D()}`,
2515
2385
  left: t,
2516
2386
  top: a,
2517
- width: n = 100,
2387
+ width: s = 100,
2518
2388
  height: i = 100,
2519
- fill: s = "yellow"
2520
- } = d, r = Q(d, [
2389
+ fill: n = "yellow"
2390
+ } = h, o = Y(h, [
2521
2391
  "id",
2522
2392
  "left",
2523
2393
  "top",
@@ -2525,18 +2395,18 @@ class jt {
2525
2395
  "height",
2526
2396
  "fill"
2527
2397
  ]);
2528
- const { canvas: h } = this.editor, g = new Be(C({
2398
+ const { canvas: g } = this.editor, u = new Ae(N({
2529
2399
  id: e,
2530
2400
  left: t,
2531
2401
  top: a,
2532
- fill: s,
2533
- width: n,
2402
+ fill: n,
2403
+ width: s,
2534
2404
  height: i
2535
- }, r));
2536
- return !t && !a && h.centerObject(g), u || (h.add(g), c || h.setActiveObject(g), h.renderAll()), g;
2405
+ }, o));
2406
+ return !t && !a && g.centerObject(u), d || (g.add(u), c || g.setActiveObject(u), g.renderAll()), u;
2537
2407
  }
2538
2408
  }
2539
- class yt {
2409
+ class rt {
2540
2410
  /**
2541
2411
  * @param {object} options
2542
2412
  * @param {ImageEditor} options.editor - экземпляр редактора с доступом к canvas
@@ -2562,28 +2432,28 @@ class yt {
2562
2432
  return;
2563
2433
  }
2564
2434
  if (a.type !== "image") {
2565
- const h = `application/image-editor:${JSON.stringify(a.toObject(["format"]))}`;
2566
- navigator.clipboard.writeText(h).catch((g) => {
2435
+ const g = `application/image-editor:${JSON.stringify(a.toObject(["format"]))}`;
2436
+ navigator.clipboard.writeText(g).catch((u) => {
2567
2437
  t.emitWarning({
2568
2438
  origin: "ClipboardManager",
2569
2439
  method: "copy",
2570
2440
  code: "CLIPBOARD_WRITE_TEXT_FAILED",
2571
- message: `Ошибка записи текстового объекта в буфер обмена: ${g.message}`,
2572
- data: g
2441
+ message: `Ошибка записи текстового объекта в буфер обмена: ${u.message}`,
2442
+ data: u
2573
2443
  });
2574
2444
  }), this._cloneAndFire(e, a);
2575
2445
  return;
2576
2446
  }
2577
- const i = a.toCanvasElement().toDataURL(), s = i.slice(5).split(";")[0], r = i.split(",")[1], c = atob(r), u = new Uint8Array(c.length);
2578
- for (let h = 0; h < c.length; h += 1)
2579
- u[h] = c.charCodeAt(h);
2580
- const l = new Blob([u.buffer], { type: s }), d = new ClipboardItem({ [s]: l });
2581
- navigator.clipboard.write([d]).catch((h) => {
2447
+ const i = a.toCanvasElement().toDataURL(), n = i.slice(5).split(";")[0], o = i.split(",")[1], c = atob(o), d = new Uint8Array(c.length);
2448
+ for (let g = 0; g < c.length; g += 1)
2449
+ d[g] = c.charCodeAt(g);
2450
+ const l = new Blob([d.buffer], { type: n }), h = new ClipboardItem({ [n]: l });
2451
+ navigator.clipboard.write([h]).catch((g) => {
2582
2452
  t.emitWarning({
2583
2453
  origin: "ClipboardManager",
2584
2454
  method: "copy",
2585
2455
  code: "CLIPBOARD_WRITE_IMAGE_FAILED",
2586
- message: `Ошибка записи изображения в буфер обмена: ${h.message}`
2456
+ message: `Ошибка записи изображения в буфер обмена: ${g.message}`
2587
2457
  });
2588
2458
  }), this._cloneAndFire(e, a);
2589
2459
  }
@@ -2612,23 +2482,23 @@ class yt {
2612
2482
  * @param {Array} event.clipboardData.items — элементы буфера обмена
2613
2483
  */
2614
2484
  handlePasteEvent({ clipboardData: e }) {
2615
- var s;
2616
- if (!((s = e == null ? void 0 : e.items) != null && s.length)) return;
2617
- const { imageManager: t } = this.editor, { items: a } = e, n = a[a.length - 1];
2618
- if (n.type !== "text/html") {
2619
- const r = n.getAsFile();
2620
- if (!r) return;
2485
+ var n;
2486
+ if (!((n = e == null ? void 0 : e.items) != null && n.length)) return;
2487
+ const { imageManager: t } = this.editor, { items: a } = e, s = a[a.length - 1];
2488
+ if (s.type !== "text/html") {
2489
+ const o = s.getAsFile();
2490
+ if (!o) return;
2621
2491
  const c = new FileReader();
2622
- c.onload = (u) => {
2623
- u.target && this.editor.imageManager.importImage({ source: u.target.result });
2624
- }, c.readAsDataURL(r);
2492
+ c.onload = (d) => {
2493
+ d.target && this.editor.imageManager.importImage({ source: d.target.result });
2494
+ }, c.readAsDataURL(o);
2625
2495
  return;
2626
2496
  }
2627
2497
  const i = e.getData("text/html");
2628
2498
  if (i) {
2629
- const u = new DOMParser().parseFromString(i, "text/html").querySelector("img");
2630
- if (u != null && u.src) {
2631
- t.importImage({ source: u.src });
2499
+ const d = new DOMParser().parseFromString(i, "text/html").querySelector("img");
2500
+ if (d != null && d.src) {
2501
+ t.importImage({ source: d.src });
2632
2502
  return;
2633
2503
  }
2634
2504
  }
@@ -2639,22 +2509,22 @@ class yt {
2639
2509
  * @fires editor:object-pasted
2640
2510
  */
2641
2511
  paste() {
2642
- return O(this, null, function* () {
2512
+ return b(this, null, function* () {
2643
2513
  const { canvas: e } = this.editor;
2644
2514
  if (!this.clipboard) return;
2645
2515
  const t = yield this.clipboard.clone(["format"]);
2646
2516
  e.discardActiveObject(), t.set({
2647
- id: `${t.type}-${A()}`,
2517
+ id: `${t.type}-${D()}`,
2648
2518
  left: t.left + 10,
2649
2519
  top: t.top + 10,
2650
2520
  evented: !0
2651
- }), t instanceof N ? (t.canvas = e, t.forEachObject((a) => {
2521
+ }), t instanceof E ? (t.canvas = e, t.forEachObject((a) => {
2652
2522
  e.add(a);
2653
2523
  })) : e.add(t), e.setActiveObject(t), e.requestRenderAll(), e.fire("editor:object-pasted", { object: t });
2654
2524
  });
2655
2525
  }
2656
2526
  }
2657
- class bt {
2527
+ class ct {
2658
2528
  /**
2659
2529
  * @param {object} options
2660
2530
  * @param {ImageEditor} options.editor - экземпляр редактора с доступом к canvas
@@ -2679,11 +2549,11 @@ class bt {
2679
2549
  skipInnerObjects: t,
2680
2550
  withoutSave: a
2681
2551
  } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, {
2682
- canvas: n,
2552
+ canvas: s,
2683
2553
  historyManager: i
2684
- } = this.editor, s = e || n.getActiveObject();
2685
- if (!(!s || s.locked)) {
2686
- var r = {
2554
+ } = this.editor, n = e || s.getActiveObject();
2555
+ if (!(!n || n.locked)) {
2556
+ var o = {
2687
2557
  lockMovementX: !0,
2688
2558
  lockMovementY: !0,
2689
2559
  lockRotation: !0,
@@ -2693,12 +2563,12 @@ class bt {
2693
2563
  lockSkewingY: !0,
2694
2564
  locked: !0
2695
2565
  };
2696
- s.set(r);
2697
- var c = !t && ["activeselection", "group"].includes(s.type);
2698
- c && s.getObjects().forEach((u) => {
2699
- u.set(r);
2700
- }), n.renderAll(), a || i.saveState(), n.fire("editor:object-locked", {
2701
- object: s,
2566
+ n.set(o);
2567
+ var c = !t && ["activeselection", "group"].includes(n.type);
2568
+ c && n.getObjects().forEach((d) => {
2569
+ d.set(o);
2570
+ }), s.renderAll(), a || i.saveState(), s.fire("editor:object-locked", {
2571
+ object: n,
2702
2572
  skipInnerObjects: t,
2703
2573
  withoutSave: a
2704
2574
  });
@@ -2718,10 +2588,10 @@ class bt {
2718
2588
  withoutSave: t
2719
2589
  } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, {
2720
2590
  canvas: a,
2721
- historyManager: n
2591
+ historyManager: s
2722
2592
  } = this.editor, i = e || a.getActiveObject();
2723
2593
  if (i) {
2724
- var s = {
2594
+ var n = {
2725
2595
  lockMovementX: !1,
2726
2596
  lockMovementY: !1,
2727
2597
  lockRotation: !1,
@@ -2731,16 +2601,16 @@ class bt {
2731
2601
  lockSkewingY: !1,
2732
2602
  locked: !1
2733
2603
  };
2734
- i.set(s), ["activeselection", "group"].includes(i.type) && i.getObjects().forEach((r) => {
2735
- r.set(s);
2736
- }), a.renderAll(), t || n.saveState(), a.fire("editor:object-unlocked", {
2604
+ i.set(n), ["activeselection", "group"].includes(i.type) && i.getObjects().forEach((o) => {
2605
+ o.set(n);
2606
+ }), a.renderAll(), t || s.saveState(), a.fire("editor:object-unlocked", {
2737
2607
  object: i,
2738
2608
  withoutSave: t
2739
2609
  });
2740
2610
  }
2741
2611
  }
2742
2612
  }
2743
- class pt {
2613
+ class dt {
2744
2614
  constructor({ editor: e }) {
2745
2615
  this.editor = e;
2746
2616
  }
@@ -2755,14 +2625,14 @@ class pt {
2755
2625
  object: e,
2756
2626
  withoutSave: t
2757
2627
  } = {}) {
2758
- const { canvas: a, historyManager: n } = this.editor;
2759
- n.suspendHistory();
2628
+ const { canvas: a, historyManager: s } = this.editor;
2629
+ s.suspendHistory();
2760
2630
  const i = e || a.getActiveObject();
2761
- if (!i || !(i instanceof N)) return;
2762
- const s = i.getObjects(), r = new je(s);
2763
- s.forEach((c) => a.remove(c)), r.set("id", `${r.type}-${A()}`), a.add(r), a.setActiveObject(r), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:objects-grouped", {
2631
+ if (!i || !(i instanceof E)) return;
2632
+ const n = i.getObjects(), o = new de(n);
2633
+ n.forEach((c) => a.remove(c)), o.set("id", `${o.type}-${D()}`), a.add(o), a.setActiveObject(o), a.renderAll(), s.resumeHistory(), t || s.saveState(), a.fire("editor:objects-grouped", {
2764
2634
  object: i,
2765
- group: r,
2635
+ group: o,
2766
2636
  withoutSave: t
2767
2637
  });
2768
2638
  }
@@ -2777,23 +2647,23 @@ class pt {
2777
2647
  object: e,
2778
2648
  withoutSave: t
2779
2649
  } = {}) {
2780
- const { canvas: a, historyManager: n } = this.editor;
2781
- n.suspendHistory();
2650
+ const { canvas: a, historyManager: s } = this.editor;
2651
+ s.suspendHistory();
2782
2652
  const i = e || a.getActiveObject();
2783
- if (!(i instanceof je)) return;
2784
- const s = i.removeAll();
2785
- a.remove(i), s.forEach((c) => a.add(c));
2786
- const r = new N(s, {
2653
+ if (!(i instanceof de)) return;
2654
+ const n = i.removeAll();
2655
+ a.remove(i), n.forEach((c) => a.add(c));
2656
+ const o = new E(n, {
2787
2657
  canvas: a
2788
2658
  });
2789
- a.setActiveObject(r), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:objects-ungrouped", {
2659
+ a.setActiveObject(o), a.renderAll(), s.resumeHistory(), t || s.saveState(), a.fire("editor:objects-ungrouped", {
2790
2660
  object: i,
2791
- selection: r,
2661
+ selection: o,
2792
2662
  withoutSave: t
2793
2663
  });
2794
2664
  }
2795
2665
  }
2796
- class It {
2666
+ class lt {
2797
2667
  /**
2798
2668
  * @param {object} options
2799
2669
  * @param {ImageEditor} options.editor - экземпляр редактора с доступом к canvas
@@ -2815,19 +2685,19 @@ class It {
2815
2685
  objectLockManager: a
2816
2686
  } = this.editor;
2817
2687
  e.discardActiveObject();
2818
- var n = t.getObjects(), i = n.some((r) => r.locked), s = n.length > 1 ? new N(t.getObjects(), {
2688
+ var s = t.getObjects(), i = s.some((o) => o.locked), n = s.length > 1 ? new E(t.getObjects(), {
2819
2689
  canvas: e
2820
- }) : n[0];
2690
+ }) : s[0];
2821
2691
  i && a.lockObject({
2822
- object: s,
2692
+ object: n,
2823
2693
  skipInnerObjects: !0,
2824
2694
  withoutSave: !0
2825
- }), e.setActiveObject(s), e.requestRenderAll(), e.fire("editor:all-objects-selected", {
2826
- selected: s
2695
+ }), e.setActiveObject(n), e.requestRenderAll(), e.fire("editor:all-objects-selected", {
2696
+ selected: n
2827
2697
  });
2828
2698
  }
2829
2699
  }
2830
- class At {
2700
+ class ht {
2831
2701
  constructor({ editor: e }) {
2832
2702
  this.editor = e;
2833
2703
  }
@@ -2842,20 +2712,20 @@ class At {
2842
2712
  objects: e,
2843
2713
  withoutSave: t
2844
2714
  } = {}) {
2845
- const { canvas: a, historyManager: n, groupingManager: i } = this.editor, s = (e || a.getActiveObjects()).filter((r) => !r.locked);
2846
- s != null && s.length && (n.suspendHistory(), s.forEach((r) => {
2847
- if (r.type === "group" && r.format !== "svg") {
2848
- i.ungroup({ object: r, withoutSave: t }), this.deleteSelectedObjects();
2715
+ const { canvas: a, historyManager: s, groupingManager: i } = this.editor, n = (e || a.getActiveObjects()).filter((o) => !o.locked);
2716
+ n != null && n.length && (s.suspendHistory(), n.forEach((o) => {
2717
+ if (o.type === "group" && o.format !== "svg") {
2718
+ i.ungroup({ object: o, withoutSave: t }), this.deleteSelectedObjects();
2849
2719
  return;
2850
2720
  }
2851
- a.remove(r);
2852
- }), a.discardActiveObject(), a.renderAll(), n.resumeHistory(), t || n.saveState(), a.fire("editor:objects-deleted", {
2853
- objects: s,
2721
+ a.remove(o);
2722
+ }), a.discardActiveObject(), a.renderAll(), s.resumeHistory(), t || s.saveState(), a.fire("editor:objects-deleted", {
2723
+ objects: n,
2854
2724
  withoutSave: t
2855
2725
  }));
2856
2726
  }
2857
2727
  }
2858
- const St = {
2728
+ const gt = {
2859
2729
  IMAGE_MANAGER: {
2860
2730
  /**
2861
2731
  * Некорректный Content-Type изображения
@@ -2917,7 +2787,7 @@ const St = {
2917
2787
  REDO_ERROR: "REDO_ERROR"
2918
2788
  }
2919
2789
  };
2920
- class q {
2790
+ class V {
2921
2791
  constructor({ editor: e }) {
2922
2792
  this._buffer = [], this.editor = e;
2923
2793
  }
@@ -2937,24 +2807,24 @@ class q {
2937
2807
  * @param {string} [options.message] — текст ошибки (опционально, если не передан, то используется код ошибки)
2938
2808
  * @fires editor:error
2939
2809
  */
2940
- emitError({ origin: e = "ImageEditor", method: t = "Unknown Method", code: a, data: n, message: i }) {
2941
- if (!q.isValidErrorCode(a)) {
2810
+ emitError({ origin: e = "ImageEditor", method: t = "Unknown Method", code: a, data: s, message: i }) {
2811
+ if (!V.isValidErrorCode(a)) {
2942
2812
  console.warn("Неизвестный код ошибки: ", { code: a, origin: e, method: t });
2943
2813
  return;
2944
2814
  }
2945
2815
  if (!a) return;
2946
- const s = i || a;
2947
- console.error(`${e}. ${t}. ${a}. ${s}`, n);
2948
- const r = {
2816
+ const n = i || a;
2817
+ console.error(`${e}. ${t}. ${a}. ${n}`, s);
2818
+ const o = {
2949
2819
  code: a,
2950
2820
  origin: e,
2951
2821
  method: t,
2952
- message: s,
2953
- data: n
2822
+ message: n,
2823
+ data: s
2954
2824
  };
2955
- this._buffer.push(C({
2825
+ this._buffer.push(N({
2956
2826
  type: "editor:error"
2957
- }, r)), this.editor.canvas.fire("editor:error", r);
2827
+ }, o)), this.editor.canvas.fire("editor:error", o);
2958
2828
  }
2959
2829
  /**
2960
2830
  * Эмитит предупреждение через fabricjs
@@ -2966,58 +2836,58 @@ class q {
2966
2836
  * @param {string} [options.message] — текст предупреждения (опционально, если не передан, то используется код предупреждения)
2967
2837
  * @fires editor:warning
2968
2838
  */
2969
- emitWarning({ origin: e = "ImageEditor", method: t = "Unknown Method", code: a, message: n, data: i }) {
2970
- if (!q.isValidErrorCode(a)) {
2839
+ emitWarning({ origin: e = "ImageEditor", method: t = "Unknown Method", code: a, message: s, data: i }) {
2840
+ if (!V.isValidErrorCode(a)) {
2971
2841
  console.warn("Неизвестный код предупреждения: ", { code: a, origin: e, method: t });
2972
2842
  return;
2973
2843
  }
2974
- const s = n || a;
2975
- console.warn(`${e}. ${t}. ${a}. ${s}`, i);
2976
- const r = {
2844
+ const n = s || a;
2845
+ console.warn(`${e}. ${t}. ${a}. ${n}`, i);
2846
+ const o = {
2977
2847
  code: a,
2978
2848
  origin: e,
2979
2849
  method: t,
2980
- message: s,
2850
+ message: n,
2981
2851
  data: i
2982
2852
  };
2983
- this._buffer.push(C({
2853
+ this._buffer.push(N({
2984
2854
  type: "editor:warning"
2985
- }, r)), this.editor.canvas.fire("editor:warning", r);
2855
+ }, o)), this.editor.canvas.fire("editor:warning", o);
2986
2856
  }
2987
2857
  static isValidErrorCode(e) {
2988
- return e ? Object.values(St).some((t) => Object.values(t).includes(e)) : !1;
2858
+ return e ? Object.values(gt).some((t) => Object.values(t).includes(e)) : !1;
2989
2859
  }
2990
2860
  }
2991
- class ue {
2861
+ class ae {
2992
2862
  /**
2993
2863
  * Конструктор класса ImageEditor.
2994
2864
  * @param {string} canvasId - идентификатор канваса, в котором будет создан редактор
2995
2865
  * @param {CanvasOptions} options - опции и настройки редактора
2996
2866
  */
2997
2867
  constructor(e, t) {
2998
- this.options = t, this.containerId = e, this.editorId = `${e}-${A()}`, this.clipboard = null, this.init();
2868
+ this.options = t, this.containerId = e, this.editorId = `${e}-${D()}`, this.clipboard = null, this.init();
2999
2869
  }
3000
2870
  init() {
3001
- return O(this, null, function* () {
2871
+ return b(this, null, function* () {
3002
2872
  const {
3003
2873
  editorContainerWidth: e,
3004
2874
  editorContainerHeight: t,
3005
2875
  canvasWrapperWidth: a,
3006
- canvasWrapperHeight: n,
2876
+ canvasWrapperHeight: s,
3007
2877
  canvasCSSWidth: i,
3008
- canvasCSSHeight: s,
3009
- initialImage: r,
2878
+ canvasCSSHeight: n,
2879
+ initialImage: o,
3010
2880
  initialStateJSON: c,
3011
- scaleType: u,
2881
+ scaleType: d,
3012
2882
  _onReadyCallback: l
3013
2883
  } = this.options;
3014
- if (Je.apply(), this.canvas = new Ze(this.containerId, this.options), this.moduleLoader = new He(), this.workerManager = new Ye(), this.errorManager = new q({ editor: this }), this.historyManager = new dt({ editor: this }), this.toolbar = new ut({ editor: this }), this.transformManager = new vt({ editor: this }), this.canvasManager = new mt({ editor: this }), this.imageManager = new D({ editor: this }), this.layerManager = new $({ editor: this }), this.shapeManager = new jt({ editor: this }), this.interactionBlocker = new ft({ editor: this }), this.clipboardManager = new yt({ editor: this }), this.objectLockManager = new bt({ editor: this }), this.groupingManager = new pt({ editor: this }), this.selectionManager = new It({ editor: this }), this.deletionManager = new At({ editor: this }), this._createMontageArea(), this._createClippingArea(), this.listeners = new P({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(t), this.canvasManager.setCanvasWrapperWidth(a), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(s), r != null && r.source) {
2884
+ if (ze.apply(), this.canvas = new Se(this.containerId, this.options), this.moduleLoader = new Ne(), this.workerManager = new Ee(), this.errorManager = new V({ editor: this }), this.historyManager = new Ke({ editor: this }), this.toolbar = new $e({ editor: this }), this.transformManager = new it({ editor: this }), this.canvasManager = new st({ editor: this }), this.imageManager = new C({ editor: this }), this.layerManager = new F({ editor: this }), this.shapeManager = new ot({ editor: this }), this.interactionBlocker = new nt({ editor: this }), this.clipboardManager = new rt({ editor: this }), this.objectLockManager = new ct({ editor: this }), this.groupingManager = new dt({ editor: this }), this.selectionManager = new lt({ editor: this }), this.deletionManager = new ht({ editor: this }), this._createMontageArea(), this._createClippingArea(), this.listeners = new R({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(e), this.canvasManager.setEditorContainerHeight(t), this.canvasManager.setCanvasWrapperWidth(a), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(n), o != null && o.source) {
3015
2885
  const {
3016
- source: d,
3017
- scale: h = `image-${u}`,
3018
- withoutSave: g = !0
3019
- } = r;
3020
- yield this.imageManager.importImage({ source: d, scale: h, withoutSave: g });
2886
+ source: h,
2887
+ scale: g = `image-${d}`,
2888
+ withoutSave: u = !0
2889
+ } = o;
2890
+ yield this.imageManager.importImage({ source: h, scale: g, withoutSave: u });
3021
2891
  } else
3022
2892
  this.canvasManager.setDefaultScale({ withoutSave: !0 });
3023
2893
  c && this.historyManager.loadStateFromFullState(c), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
@@ -3031,7 +2901,7 @@ class ue {
3031
2901
  this.montageArea = this.shapeManager.addRectangle({
3032
2902
  width: e,
3033
2903
  height: t,
3034
- fill: ue._createMosaicPattern(),
2904
+ fill: ae._createMosaicPattern(),
3035
2905
  stroke: null,
3036
2906
  strokeWidth: 0,
3037
2907
  selectable: !1,
@@ -3075,13 +2945,13 @@ class ue {
3075
2945
  const e = document.createElement("canvas");
3076
2946
  e.width = 20, e.height = 20;
3077
2947
  const t = e.getContext("2d");
3078
- return t.fillStyle = "#ddd", t.fillRect(0, 0, 40, 40), t.fillStyle = "#ccc", t.fillRect(0, 0, 10, 10), t.fillRect(10, 10, 10, 10), new ze({
2948
+ return t.fillStyle = "#ddd", t.fillRect(0, 0, 40, 40), t.fillStyle = "#ccc", t.fillRect(0, 0, 10, 10), t.fillRect(10, 10, 10, 10), new Ce({
3079
2949
  source: e,
3080
2950
  repeat: "repeat"
3081
2951
  });
3082
2952
  }
3083
2953
  }
3084
- const Ct = {
2954
+ const ut = {
3085
2955
  /**
3086
2956
  * Опции редактора
3087
2957
  */
@@ -3169,18 +3039,18 @@ const Ct = {
3169
3039
  deleteObjectsByHotkey: !0,
3170
3040
  resetObjectFitByDoubleClick: !0
3171
3041
  };
3172
- function wt(o, e = {}) {
3173
- const t = C(C({}, Ct), e), a = document.getElementById(o);
3042
+ function yt(r, e = {}) {
3043
+ const t = N(N({}, ut), e), a = document.getElementById(r);
3174
3044
  if (!a)
3175
- return Promise.reject(new Error(`Контейнер с ID "${o}" не найден.`));
3176
- const n = document.createElement("canvas");
3177
- return n.id = `${o}-canvas`, a.appendChild(n), t.editorContainer = a, new Promise((i) => {
3045
+ return Promise.reject(new Error(`Контейнер с ID "${r}" не найден.`));
3046
+ const s = document.createElement("canvas");
3047
+ return s.id = `${r}-canvas`, a.appendChild(s), t.editorContainer = a, new Promise((i) => {
3178
3048
  t._onReadyCallback = i;
3179
- const s = new ue(n.id, t);
3180
- window[o] = s;
3049
+ const n = new ae(s.id, t);
3050
+ window[r] = n;
3181
3051
  });
3182
3052
  }
3183
3053
  export {
3184
- wt as default
3054
+ yt as default
3185
3055
  };
3186
3056
  //# sourceMappingURL=main.js.map