@anu3ev/fabric-image-editor 0.3.0 → 0.4.0

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 (3) hide show
  1. package/dist/main.js +542 -494
  2. package/package.json +1 -1
  3. package/readme.md +67 -1
package/dist/main.js CHANGED
@@ -1,25 +1,25 @@
1
- var we = Object.defineProperty, De = Object.defineProperties;
2
- var Oe = Object.getOwnPropertyDescriptors;
1
+ var De = Object.defineProperty, Oe = Object.defineProperties;
2
+ var Te = Object.getOwnPropertyDescriptors;
3
3
  var pt = Object.getOwnPropertySymbols;
4
- var he = Object.prototype.hasOwnProperty, ue = Object.prototype.propertyIsEnumerable;
5
- var le = (l, t, e) => t in l ? we(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e, D = (l, t) => {
4
+ var ge = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
5
+ var ue = (h, t, e) => t in h ? De(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, E = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
- he.call(t, e) && le(l, e, t[e]);
7
+ ge.call(t, e) && ue(h, e, t[e]);
8
8
  if (pt)
9
9
  for (var e of pt(t))
10
- ue.call(t, e) && le(l, e, t[e]);
11
- return l;
12
- }, ge = (l, t) => De(l, Oe(t));
13
- var X = (l, t) => {
10
+ fe.call(t, e) && ue(h, e, t[e]);
11
+ return h;
12
+ }, me = (h, t) => Oe(h, Te(t));
13
+ var X = (h, t) => {
14
14
  var e = {};
15
- for (var s in l)
16
- he.call(l, s) && t.indexOf(s) < 0 && (e[s] = l[s]);
17
- if (l != null && pt)
18
- for (var s of pt(l))
19
- t.indexOf(s) < 0 && ue.call(l, s) && (e[s] = l[s]);
15
+ for (var s in h)
16
+ ge.call(h, s) && t.indexOf(s) < 0 && (e[s] = h[s]);
17
+ if (h != null && pt)
18
+ for (var s of pt(h))
19
+ t.indexOf(s) < 0 && fe.call(h, s) && (e[s] = h[s]);
20
20
  return e;
21
21
  };
22
- var C = (l, t, e) => new Promise((s, n) => {
22
+ var C = (h, t, e) => new Promise((s, n) => {
23
23
  var o = (r) => {
24
24
  try {
25
25
  i(e.next(r));
@@ -33,14 +33,14 @@ var C = (l, t, e) => new Promise((s, n) => {
33
33
  n(c);
34
34
  }
35
35
  }, i = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(o, a);
36
- i((e = e.apply(l, t)).next());
36
+ i((e = e.apply(h, t)).next());
37
37
  });
38
- import { ActiveSelection as O, Textbox as gt, util as mt, controlsUtils as fe, InteractiveFabricObject as me, loadSVGFromURL as Ee, FabricImage as ht, Point as yt, Gradient as pe, Rect as Ne, Circle as Le, Triangle as Te, Group as $, Canvas as ke, Pattern as xe } from "fabric";
39
- import { create as Be } from "jsondiffpatch";
40
- import _e from "diff-match-patch";
41
- var Re = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", N = function() {
38
+ import { ActiveSelection as D, Textbox as gt, util as mt, controlsUtils as pe, InteractiveFabricObject as Me, loadSVGFromURL as Ne, FabricImage as ht, Point as bt, Gradient as ye, Rect as Le, Circle as xe, Triangle as ke, Group as $, Canvas as _e, Pattern as Be } from "fabric";
39
+ import { create as Re } from "jsondiffpatch";
40
+ import Ue from "diff-match-patch";
41
+ var ze = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", x = function() {
42
42
  for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 21, e = "", s = crypto.getRandomValues(new Uint8Array(t |= 0)); t--; )
43
- e += Re[s[t] & 63];
43
+ e += ze[s[t] & 63];
44
44
  return e;
45
45
  };
46
46
  class ft {
@@ -98,7 +98,7 @@ class ft {
98
98
  if (n.length === 1)
99
99
  this.canvas.setActiveObject(n[0]);
100
100
  else {
101
- const a = new O(n, {
101
+ const a = new D(n, {
102
102
  canvas: this.canvas
103
103
  });
104
104
  this.canvas.setActiveObject(a);
@@ -106,7 +106,7 @@ class ft {
106
106
  this.canvas.requestRenderAll();
107
107
  return;
108
108
  }
109
- const o = new O(t, {
109
+ const o = new D(t, {
110
110
  canvas: this.canvas
111
111
  });
112
112
  this.editor.objectLockManager.lockObject({
@@ -120,16 +120,16 @@ class ft {
120
120
  * Срабатывают при изменении объектов (перемещение, изменение размера и т.д.).
121
121
  */
122
122
  handleObjectModifiedHistory() {
123
- this.editor.historyManager.skipHistory || this.editor.historyManager.saveState();
123
+ this.editor.historyManager.skipHistory || this.editor.textManager.isTextEditingActive || this.editor.historyManager.saveState();
124
124
  }
125
125
  handleObjectRotatingHistory() {
126
- this.editor.historyManager.skipHistory || this.editor.historyManager.saveState();
126
+ this.editor.historyManager.skipHistory || this.editor.textManager.isTextEditingActive || this.editor.historyManager.saveState();
127
127
  }
128
128
  handleObjectAddedHistory() {
129
- this.editor.historyManager.skipHistory || this.editor.historyManager.saveState();
129
+ this.editor.historyManager.skipHistory || this.editor.textManager.isTextEditingActive || this.editor.historyManager.saveState();
130
130
  }
131
131
  handleObjectRemovedHistory() {
132
- this.editor.historyManager.skipHistory || this.editor.historyManager.saveState();
132
+ this.editor.historyManager.skipHistory || this.editor.textManager.isTextEditingActive || this.editor.historyManager.saveState();
133
133
  }
134
134
  /**
135
135
  * Обновление overlayMask при добавлении объектов или выделении.
@@ -220,7 +220,7 @@ class ft {
220
220
  if (n || o) return;
221
221
  this.isSpacePressed = !0, t.preventDefault();
222
222
  const a = e.getActiveObject() || null;
223
- a instanceof O ? this.savedSelection = a.getObjects().slice() : a && (this.savedSelection = [a]), e.discardActiveObject(), e.set({
223
+ a instanceof D ? this.savedSelection = a.getObjects().slice() : a && (this.savedSelection = [a]), e.discardActiveObject(), e.set({
224
224
  selection: !1,
225
225
  defaultCursor: "grab"
226
226
  }), e.setCursor("grab"), s.canvasManager.getObjects().forEach((i) => {
@@ -259,7 +259,7 @@ class ft {
259
259
  e.setActiveObject(t[0]);
260
260
  return;
261
261
  }
262
- const n = t.filter((a) => s.canvasManager.getObjects().includes(a)), o = new O(n, { canvas: e });
262
+ const n = t.filter((a) => s.canvasManager.getObjects().includes(a)), o = new D(n, { canvas: e });
263
263
  e.setActiveObject(o);
264
264
  }
265
265
  // --- Обработчики для событий canvas (Fabric) ---
@@ -342,7 +342,12 @@ class ft {
342
342
  const e = document.activeElement, s = t.target, n = ["input", "textarea", "select"];
343
343
  if (s) {
344
344
  const a = s.tagName.toLowerCase();
345
- if (n.includes(a) || s.contentEditable === "true") return !0;
345
+ if (t.type === "paste" && n.includes(a)) {
346
+ const i = e == null ? void 0 : e.tagName.toLowerCase();
347
+ return !!(i && n.includes(i));
348
+ }
349
+ if (n.includes(a) || s.contentEditable === "true")
350
+ return !0;
346
351
  }
347
352
  if (e && e !== s) {
348
353
  const a = e.tagName.toLowerCase();
@@ -356,11 +361,11 @@ class ft {
356
361
  if (c != null && c.length && r)
357
362
  for (const d of c)
358
363
  try {
359
- const h = r;
360
- if (h.matches && h.matches(d) || h.closest && h.closest(d))
364
+ const l = r;
365
+ if (l.matches && l.matches(d) || l.closest && l.closest(d))
361
366
  return !0;
362
- } catch (h) {
363
- console.warn(`Error checking selection container with selector "${d}":`, h);
367
+ } catch (l) {
368
+ console.warn(`Error checking selection container with selector "${d}":`, l);
364
369
  }
365
370
  }
366
371
  return !1;
@@ -386,7 +391,7 @@ class ft {
386
391
  };
387
392
  }
388
393
  }
389
- class Ue {
394
+ class Ye {
390
395
  /**
391
396
  * Класс для динамической загрузки внешних модулей.
392
397
  */
@@ -404,21 +409,21 @@ class Ue {
404
409
  return this.loaders[t] ? (this.cache.has(t) || this.cache.set(t, this.loaders[t]()), this.cache.get(t)) : Promise.reject(new Error(`Unknown module "${t}"`));
405
410
  }
406
411
  }
407
- function ze(l) {
412
+ function Fe(h) {
408
413
  return new Worker(
409
414
  "" + new URL("assets/worker-CN39s7P7.js", import.meta.url).href,
410
415
  {
411
- name: l == null ? void 0 : l.name
416
+ name: h == null ? void 0 : h.name
412
417
  }
413
418
  );
414
419
  }
415
- class Ye {
420
+ class He {
416
421
  /**
417
422
  * @param scriptUrl — URL скрипта воркера.
418
423
  * По-умолчанию использует DefaultWorker из соседнего файла
419
424
  */
420
425
  constructor(t) {
421
- t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new ze(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
426
+ t ? this.worker = new Worker(t, { type: "module" }) : this.worker = new Fe(), this._callbacks = /* @__PURE__ */ new Map(), this.worker.onmessage = this._handleMessage.bind(this);
422
427
  }
423
428
  /**
424
429
  * Обработчик сообщений от воркера
@@ -446,7 +451,7 @@ class Ye {
446
451
  * @returns Promise, который будет выполнен, когда воркер вернет ответ
447
452
  */
448
453
  post(t, e, s = []) {
449
- const n = `${t}:${N(8)}`;
454
+ const n = `${t}:${x(8)}`;
450
455
  return new Promise((o, a) => {
451
456
  this._callbacks.set(n, { resolve: o, reject: a }), this.worker.postMessage({ action: t, payload: e, requestId: n }, s);
452
457
  });
@@ -458,26 +463,26 @@ class Ye {
458
463
  this.worker.terminate();
459
464
  }
460
465
  }
461
- const F = 12, Fe = 2, Dt = 8, Ot = 20, He = 100, Et = 20, Nt = 8, Ze = 100, bt = 32, Tt = 1, We = "#2B2D33", kt = "#3D8BF4", xt = "#FFFFFF";
462
- function Mt(l, t, e, s, n) {
463
- const o = F, a = Fe;
464
- l.save(), l.translate(t, e), l.rotate(mt.degreesToRadians(n.angle)), l.fillStyle = xt, l.strokeStyle = kt, l.lineWidth = Tt, l.beginPath(), l.roundRect(-o / 2, -o / 2, o, o, a), l.fill(), l.stroke(), l.restore();
466
+ const F = 12, Ze = 2, Dt = 8, Ot = 20, We = 100, Tt = 20, Nt = 8, Pe = 100, vt = 32, xt = 1, Ve = "#2B2D33", kt = "#3D8BF4", _t = "#FFFFFF";
467
+ function Mt(h, t, e, s, n) {
468
+ const o = F, a = Ze;
469
+ h.save(), h.translate(t, e), h.rotate(mt.degreesToRadians(n.angle)), h.fillStyle = _t, h.strokeStyle = kt, h.lineWidth = xt, h.beginPath(), h.roundRect(-o / 2, -o / 2, o, o, a), h.fill(), h.stroke(), h.restore();
465
470
  }
466
- function Me(l, t, e, s, n) {
467
- const o = Dt, a = Ot, i = He;
468
- l.save(), l.translate(t, e), l.rotate(mt.degreesToRadians(n.angle)), l.fillStyle = xt, l.strokeStyle = kt, l.lineWidth = Tt, l.beginPath(), l.roundRect(-o / 2, -a / 2, o, a, i), l.fill(), l.stroke(), l.restore();
471
+ function be(h, t, e, s, n) {
472
+ const o = Dt, a = Ot, i = We;
473
+ h.save(), h.translate(t, e), h.rotate(mt.degreesToRadians(n.angle)), h.fillStyle = _t, h.strokeStyle = kt, h.lineWidth = xt, h.beginPath(), h.roundRect(-o / 2, -a / 2, o, a, i), h.fill(), h.stroke(), h.restore();
469
474
  }
470
- function ye(l, t, e, s, n) {
471
- const o = Et, a = Nt, i = Ze;
472
- l.save(), l.translate(t, e), l.rotate(mt.degreesToRadians(n.angle)), l.fillStyle = xt, l.strokeStyle = kt, l.lineWidth = Tt, l.beginPath(), l.roundRect(-o / 2, -a / 2, o, a, i), l.fill(), l.stroke(), l.restore();
475
+ function ve(h, t, e, s, n) {
476
+ const o = Tt, a = Nt, i = Pe;
477
+ h.save(), h.translate(t, e), h.rotate(mt.degreesToRadians(n.angle)), h.fillStyle = _t, h.strokeStyle = kt, h.lineWidth = xt, h.beginPath(), h.roundRect(-o / 2, -a / 2, o, a, i), h.fill(), h.stroke(), h.restore();
473
478
  }
474
- const Pe = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", Ce = new Image();
475
- Ce.src = Pe;
476
- function Ve(l, t, e, s, n) {
477
- const a = bt / 2;
478
- l.save(), l.translate(t, e), l.rotate(mt.degreesToRadians(n.angle)), l.fillStyle = We, l.beginPath(), l.arc(0, 0, a, 0, 2 * Math.PI), l.fill(), l.drawImage(Ce, -a / 2, -a / 2, a, a), l.restore();
479
+ const Ge = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", we = new Image();
480
+ we.src = Ge;
481
+ function Xe(h, t, e, s, n) {
482
+ const a = vt / 2;
483
+ h.save(), h.translate(t, e), h.rotate(mt.degreesToRadians(n.angle)), h.fillStyle = Ve, h.beginPath(), h.arc(0, 0, a, 0, 2 * Math.PI), h.fill(), h.drawImage(we, -a / 2, -a / 2, a, a), h.restore();
479
484
  }
480
- const Ge = {
485
+ const Ke = {
481
486
  // Угловые точки
482
487
  tl: {
483
488
  render: Mt,
@@ -509,14 +514,14 @@ const Ge = {
509
514
  },
510
515
  // Середина вертикалей
511
516
  ml: {
512
- render: Me,
517
+ render: be,
513
518
  sizeX: Dt,
514
519
  sizeY: Ot,
515
520
  offsetX: 0,
516
521
  offsetY: 0
517
522
  },
518
523
  mr: {
519
- render: Me,
524
+ render: be,
520
525
  sizeX: Dt,
521
526
  sizeY: Ot,
522
527
  offsetX: 0,
@@ -524,31 +529,31 @@ const Ge = {
524
529
  },
525
530
  // Середина горизонталей
526
531
  mt: {
527
- render: ye,
528
- sizeX: Et,
532
+ render: ve,
533
+ sizeX: Tt,
529
534
  sizeY: Nt,
530
535
  offsetX: 0,
531
536
  offsetY: 0
532
537
  },
533
538
  mb: {
534
- render: ye,
535
- sizeX: Et,
539
+ render: ve,
540
+ sizeX: Tt,
536
541
  sizeY: Nt,
537
542
  offsetX: 0,
538
543
  offsetY: 0
539
544
  },
540
545
  // Специальный «rotate» контрол
541
546
  mtr: {
542
- render: Ve,
543
- sizeX: bt,
544
- sizeY: bt,
547
+ render: Xe,
548
+ sizeX: vt,
549
+ sizeY: vt,
545
550
  offsetX: 0,
546
- offsetY: -bt
551
+ offsetY: -vt
547
552
  }
548
553
  };
549
- class vt {
554
+ class jt {
550
555
  static applyControlOverrides(t) {
551
- Object.entries(Ge).forEach(([e, s]) => {
556
+ Object.entries(Ke).forEach(([e, s]) => {
552
557
  const n = t[e];
553
558
  n && (Object.assign(n, s), e === "mtr" && (n.cursorStyle = "grab", n.mouseDownHandler = (o, a, i, r) => {
554
559
  var d;
@@ -558,13 +563,13 @@ class vt {
558
563
  });
559
564
  }
560
565
  static apply() {
561
- const t = fe.createObjectDefaultControls();
562
- vt.applyControlOverrides(t), me.ownDefaults.controls = t;
563
- const e = fe.createTextboxDefaultControls();
564
- vt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), gt.ownDefaults.controls = e, me.ownDefaults.snapAngle = 1;
566
+ const t = pe.createObjectDefaultControls();
567
+ jt.applyControlOverrides(t), Me.ownDefaults.controls = t;
568
+ const e = pe.createTextboxDefaultControls();
569
+ jt.applyControlOverrides(e), e.mt && (e.mt.visible = !1), e.mb && (e.mb.visible = !1), gt.ownDefaults.controls = e, Me.ownDefaults.snapAngle = 1;
565
570
  }
566
571
  }
567
- const I = class I {
572
+ const j = class j {
568
573
  constructor(t = []) {
569
574
  this.fonts = t;
570
575
  }
@@ -578,7 +583,7 @@ const I = class I {
578
583
  if (!t.length) return;
579
584
  const e = typeof document != "undefined" ? document : void 0;
580
585
  if (!e) return;
581
- const s = t.map((o) => I.loadFont(o, e));
586
+ const s = t.map((o) => j.loadFont(o, e));
582
587
  yield Promise.allSettled(s);
583
588
  });
584
589
  }
@@ -587,21 +592,21 @@ const I = class I {
587
592
  var c, d;
588
593
  const s = typeof FontFace != "undefined", n = (c = t.family) == null ? void 0 : c.trim(), o = (d = t.source) == null ? void 0 : d.trim();
589
594
  if (!n || !o) return;
590
- const a = I.normalizeFontSource(o), i = I.getDescriptorSnapshot(t.descriptors), r = I.getFontRegistrationKey(n, a, i);
591
- if (!I.registeredFontKeys.has(r)) {
592
- if (I.isFontFaceAlreadyApplied(e, n, i)) {
593
- I.registeredFontKeys.add(r);
595
+ const a = j.normalizeFontSource(o), i = j.getDescriptorSnapshot(t.descriptors), r = j.getFontRegistrationKey(n, a, i);
596
+ if (!j.registeredFontKeys.has(r)) {
597
+ if (j.isFontFaceAlreadyApplied(e, n, i)) {
598
+ j.registeredFontKeys.add(r);
594
599
  return;
595
600
  }
596
601
  if (s && e.fonts && typeof e.fonts.add == "function")
597
602
  try {
598
603
  const u = yield new FontFace(n, a, t.descriptors).load();
599
- e.fonts.add(u), I.registeredFontKeys.add(r);
604
+ e.fonts.add(u), j.registeredFontKeys.add(r);
600
605
  return;
601
- } catch (h) {
602
- console.warn(`Не удалось загрузить шрифт "${n}" через FontFace API`, h);
606
+ } catch (l) {
607
+ console.warn(`Не удалось загрузить шрифт "${n}" через FontFace API`, l);
603
608
  }
604
- I.injectFontFace({
609
+ j.injectFontFace({
605
610
  font: t,
606
611
  source: a,
607
612
  doc: e,
@@ -621,15 +626,15 @@ const I = class I {
621
626
  if (!a) return;
622
627
  const i = s.createElement("style");
623
628
  i.setAttribute("data-editor-font", a), i.setAttribute("data-editor-font-key", n);
624
- const r = I.descriptorsToCss(o), c = [
629
+ const r = j.descriptorsToCss(o), c = [
625
630
  "@font-face {",
626
- ` font-family: ${I.formatFontFamilyForCss(a)};`,
631
+ ` font-family: ${j.formatFontFamilyForCss(a)};`,
627
632
  ` src: ${e};`,
628
- ...r.map((h) => ` ${h}`),
633
+ ...r.map((l) => ` ${l}`),
629
634
  "}"
630
635
  ];
631
636
  i.textContent = c.join(`
632
- `), s.head.appendChild(i), I.registeredFontKeys.add(n);
637
+ `), s.head.appendChild(i), j.registeredFontKeys.add(n);
633
638
  }
634
639
  static normalizeFontSource(t) {
635
640
  const e = t.trim();
@@ -652,15 +657,15 @@ const I = class I {
652
657
  return t ? t.trim().replace(/^['"]+|['"]+$/g, "").toLowerCase() : "";
653
658
  }
654
659
  static getDescriptorSnapshot(t) {
655
- const e = I.descriptorDefaults;
660
+ const e = j.descriptorDefaults;
656
661
  return {
657
- style: I.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
658
- weight: I.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
659
- stretch: I.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
660
- unicodeRange: I.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
661
- variant: I.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
662
- featureSettings: I.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
663
- display: I.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
662
+ style: j.normalizeDescriptorValue(t == null ? void 0 : t.style, e.style),
663
+ weight: j.normalizeDescriptorValue(t == null ? void 0 : t.weight, e.weight),
664
+ stretch: j.normalizeDescriptorValue(t == null ? void 0 : t.stretch, e.stretch),
665
+ unicodeRange: j.normalizeDescriptorValue(t == null ? void 0 : t.unicodeRange, e.unicodeRange),
666
+ variant: j.normalizeDescriptorValue(t == null ? void 0 : t.variant, e.variant),
667
+ featureSettings: j.normalizeDescriptorValue(t == null ? void 0 : t.featureSettings, e.featureSettings),
668
+ display: j.normalizeDescriptorValue(t == null ? void 0 : t.display, e.display)
664
669
  };
665
670
  }
666
671
  static areDescriptorSnapshotsEqual(t, e) {
@@ -668,7 +673,7 @@ const I = class I {
668
673
  }
669
674
  static getFontRegistrationKey(t, e, s) {
670
675
  return [
671
- I.normalizeFamilyName(t),
676
+ j.normalizeFamilyName(t),
672
677
  e,
673
678
  s.style,
674
679
  s.weight,
@@ -682,12 +687,12 @@ const I = class I {
682
687
  static isFontFaceAlreadyApplied(t, e, s) {
683
688
  const n = t.fonts;
684
689
  if (!n || typeof n.forEach != "function") return !1;
685
- const o = I.normalizeFamilyName(e);
690
+ const o = j.normalizeFamilyName(e);
686
691
  let a = !1;
687
692
  try {
688
693
  n.forEach((i) => {
689
- if (a || I.normalizeFamilyName(i.family) !== o) return;
690
- const c = I.getDescriptorSnapshot({
694
+ if (a || j.normalizeFamilyName(i.family) !== o) return;
695
+ const c = j.getDescriptorSnapshot({
691
696
  style: i.style,
692
697
  weight: i.weight,
693
698
  stretch: i.stretch,
@@ -696,7 +701,7 @@ const I = class I {
696
701
  featureSettings: i.featureSettings,
697
702
  display: i.display
698
703
  });
699
- I.areDescriptorSnapshotsEqual(s, c) && (a = !0);
704
+ j.areDescriptorSnapshotsEqual(s, c) && (a = !0);
700
705
  });
701
706
  } catch (i) {
702
707
  return console.warn("Не удалось проверить, загружен ли шрифт ранее через FontFaceSet", i), !1;
@@ -723,7 +728,7 @@ const I = class I {
723
728
  });
724
729
  }
725
730
  };
726
- I.registeredFontKeys = /* @__PURE__ */ new Set(), I.descriptorDefaults = {
731
+ j.registeredFontKeys = /* @__PURE__ */ new Set(), j.descriptorDefaults = {
727
732
  style: "normal",
728
733
  weight: "normal",
729
734
  stretch: "normal",
@@ -732,8 +737,8 @@ I.registeredFontKeys = /* @__PURE__ */ new Set(), I.descriptorDefaults = {
732
737
  featureSettings: "normal",
733
738
  display: "auto"
734
739
  };
735
- let Lt = I;
736
- const Xe = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNNi44NzUgMi41YS42MjUuNjI1IDAgMCAwLS42MjUuNjI0VjYuMjVIMy4xMjVhLjYyNS42MjUgMCAwIDAtLjYyNS42MjV2MTBjMCAuMzQ1LjI4LjYyNS42MjUuNjI1aDEwYy4zNDUgMCAuNjI1LS4yOC42MjUtLjYyNXYtMy4xMjZoMy4xMjVjLjM0NSAwIC42MjUtLjI4LjYyNS0uNjI1di0xMGEuNjI1LjYyNSAwIDAgMC0uNjI1LS42MjVoLTEwWm02Ljg3NSAxMGgyLjVWMy43NUg3LjV2Mi41aDUuNjI1Yy4zNDUgMCAuNjI1LjI4LjYyNS42MjV2NS42MjRabS0xMCAzLjc1VjcuNWg4Ljc1djguNzVIMy43NVoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==", Ke = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMi41IDcuN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lbm9kZCIvPjwvc3ZnPg==", ut = {
737
742
  style: {
738
743
  position: "absolute",
739
744
  display: "none",
@@ -800,54 +805,54 @@ const Xe = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMj
800
805
  ],
801
806
  offsetTop: 50,
802
807
  icons: {
803
- copyPaste: Xe,
804
- delete: es,
805
- lock: Ke,
806
- unlock: $e,
807
- bringToFront: qe,
808
- sendToBack: ts,
809
- bringForward: Qe,
810
- sendBackwards: Je
808
+ copyPaste: $e,
809
+ delete: ns,
810
+ lock: Qe,
811
+ unlock: Je,
812
+ bringToFront: es,
813
+ sendToBack: ss,
814
+ bringForward: qe,
815
+ sendBackwards: ts
811
816
  },
812
817
  handlers: {
813
- copyPaste: (l) => C(null, null, function* () {
814
- l.clipboardManager.copyPaste();
818
+ copyPaste: (h) => C(null, null, function* () {
819
+ h.clipboardManager.copyPaste();
815
820
  }),
816
- delete: (l) => {
817
- l.deletionManager.deleteSelectedObjects();
821
+ delete: (h) => {
822
+ h.deletionManager.deleteSelectedObjects();
818
823
  },
819
- lock: (l) => {
820
- l.objectLockManager.lockObject();
824
+ lock: (h) => {
825
+ h.objectLockManager.lockObject();
821
826
  },
822
- unlock: (l) => {
823
- l.objectLockManager.unlockObject();
827
+ unlock: (h) => {
828
+ h.objectLockManager.unlockObject();
824
829
  },
825
- bringForward: (l) => {
826
- l.layerManager.bringForward();
830
+ bringForward: (h) => {
831
+ h.layerManager.bringForward();
827
832
  },
828
- bringToFront: (l) => {
829
- l.layerManager.bringToFront();
833
+ bringToFront: (h) => {
834
+ h.layerManager.bringToFront();
830
835
  },
831
- sendToBack: (l) => {
832
- l.layerManager.sendToBack();
836
+ sendToBack: (h) => {
837
+ h.layerManager.sendToBack();
833
838
  },
834
- sendBackwards: (l) => {
835
- l.layerManager.sendBackwards();
839
+ sendBackwards: (h) => {
840
+ h.layerManager.sendBackwards();
836
841
  }
837
842
  }
838
843
  };
839
- class ss {
844
+ class os {
840
845
  constructor({ editor: t }) {
841
846
  this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._initToolbar();
842
847
  }
843
848
  _initToolbar() {
844
849
  if (!this.options.showToolbar) return;
845
850
  const t = this.options.toolbar || {};
846
- this.config = ge(D(D({}, ut), t), {
847
- style: D(D({}, ut.style), t.style || {}),
848
- btnStyle: D(D({}, ut.btnStyle), t.btnStyle || {}),
849
- icons: D(D({}, ut.icons), t.icons || {}),
850
- handlers: D(D({}, ut.handlers), t.handlers || {})
851
+ this.config = me(E(E({}, ut), t), {
852
+ style: E(E({}, ut.style), t.style || {}),
853
+ btnStyle: E(E({}, ut.btnStyle), t.btnStyle || {}),
854
+ icons: E(E({}, ut.icons), t.icons || {}),
855
+ handlers: E(E({}, ut.handlers), t.handlers || {})
851
856
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
852
857
  this.el.style.display = "none";
853
858
  }, this._createDOM(), this._bindEvents();
@@ -952,7 +957,7 @@ class ss {
952
957
  this.el.removeEventListener("mouseover", this._onBtnOver), this.el.removeEventListener("mouseout", this._onBtnOut), this.canvas.off("mouse:down", this._onMouseDown), this.canvas.off("object:moving", this._onObjectMoving), this.canvas.off("object:scaling", this._onObjectScaling), this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:created", this._onSelectionChange), this.canvas.off("selection:updated", this._onSelectionChange), this.canvas.off("after:render", this._onSelectionChange), this.canvas.off("selection:cleared", this._onSelectionClear), this.el.remove();
953
958
  }
954
959
  }
955
- const ns = {
960
+ const as = {
956
961
  position: "absolute",
957
962
  display: "none",
958
963
  background: "#2B2D33",
@@ -966,7 +971,7 @@ const ns = {
966
971
  "pointer-events": "none",
967
972
  "white-space": "nowrap",
968
973
  "box-shadow": "0 2px 8px rgba(0, 0, 0, 0.2)"
969
- }, be = 16, ve = 16, os = "fabric-editor-angle-indicator";
974
+ }, je = 16, Ie = 16, is = "fabric-editor-angle-indicator";
970
975
  class Bt {
971
976
  constructor({ editor: t }) {
972
977
  this.isActive = !1, this.currentAngle = 0, this.editor = t, this.canvas = t.canvas, this.options = t.options, this._createDOM(), this._bindEvents();
@@ -975,7 +980,7 @@ class Bt {
975
980
  * Создание DOM-элемента индикатора
976
981
  */
977
982
  _createDOM() {
978
- this.el = document.createElement("div"), this.el.className = os, Object.entries(ns).forEach(([t, e]) => {
983
+ this.el = document.createElement("div"), this.el.className = is, Object.entries(as).forEach(([t, e]) => {
979
984
  this.el.style.setProperty(t, e);
980
985
  }), this.canvas.wrapperEl.appendChild(this.el);
981
986
  }
@@ -1026,9 +1031,9 @@ class Bt {
1026
1031
  */
1027
1032
  _positionIndicator(t) {
1028
1033
  const e = this.canvas.wrapperEl.getBoundingClientRect();
1029
- let s = t.clientX - e.left + be, n = t.clientY - e.top + ve;
1034
+ let s = t.clientX - e.left + je, n = t.clientY - e.top + Ie;
1030
1035
  const o = this.el.getBoundingClientRect(), a = o.width, i = o.height;
1031
- s + a > e.width && (s = t.clientX - e.left - a - be), n + i > e.height && (n = t.clientY - e.top - i - ve), this.el.style.left = `${s}px`, this.el.style.top = `${n}px`;
1036
+ s + a > e.width && (s = t.clientX - e.left - a - je), n + i > e.height && (n = t.clientY - e.top - i - Ie), this.el.style.left = `${s}px`, this.el.style.top = `${n}px`;
1032
1037
  }
1033
1038
  /**
1034
1039
  * Показать индикатор
@@ -1059,7 +1064,7 @@ class Bt {
1059
1064
  this.canvas && (this.canvas.off("object:rotating", this._onObjectRotating), this.canvas.off("mouse:up", this._onMouseUp), this.canvas.off("object:modified", this._onObjectModified), this.canvas.off("selection:cleared", this._onSelectionCleared)), (t = this.el) != null && t.parentNode && this.el.parentNode.removeChild(this.el), this.el = null, this.editor = null, this.canvas = null, this.options = null;
1060
1065
  }
1061
1066
  }
1062
- const as = [
1067
+ const rs = [
1063
1068
  "selectable",
1064
1069
  "evented",
1065
1070
  "id",
@@ -1076,9 +1081,11 @@ const as = [
1076
1081
  "lockScalingX",
1077
1082
  "lockScalingY",
1078
1083
  "lockSkewingX",
1079
- "lockSkewingY"
1084
+ "lockSkewingY",
1085
+ "textCaseRaw",
1086
+ "uppercase"
1080
1087
  ];
1081
- class jt {
1088
+ class It {
1082
1089
  constructor({ editor: t }) {
1083
1090
  this.editor = t, this.canvas = t.canvas, this._historySuspendCount = 0, this.baseState = null, this.patches = [], this.currentIndex = 0, this.maxHistoryLength = t.options.maxHistoryLength, this.totalChangesCount = 0, this.baseStateChangesCount = 0, this._createDiffPatcher();
1084
1091
  }
@@ -1090,7 +1097,7 @@ class jt {
1090
1097
  return this.patches[this.currentIndex - 1] || null;
1091
1098
  }
1092
1099
  _createDiffPatcher() {
1093
- this.diffPatcher = Be({
1100
+ this.diffPatcher = Re({
1094
1101
  objectHash(t) {
1095
1102
  const e = t, s = t;
1096
1103
  return [
@@ -1109,6 +1116,7 @@ class jt {
1109
1116
  e.scaleY,
1110
1117
  e.angle,
1111
1118
  e.opacity,
1119
+ s.text,
1112
1120
  s.textCaseRaw,
1113
1121
  s.uppercase,
1114
1122
  s.underline,
@@ -1125,7 +1133,7 @@ class jt {
1125
1133
  includeValueOnMove: !1
1126
1134
  },
1127
1135
  textDiff: {
1128
- diffMatchPatch: _e,
1136
+ diffMatchPatch: Ue,
1129
1137
  minLength: 60
1130
1138
  }
1131
1139
  });
@@ -1166,7 +1174,7 @@ class jt {
1166
1174
  saveState() {
1167
1175
  if (console.log("saveState"), this.skipHistory) return;
1168
1176
  console.time("saveState");
1169
- const t = this.canvas.toDatalessObject([...as]);
1177
+ const t = this.canvas.toDatalessObject([...rs]);
1170
1178
  if (console.timeEnd("saveState"), !this.baseState) {
1171
1179
  this.baseState = t, this.patches = [], this.currentIndex = 0, console.log("Базовое состояние сохранено.");
1172
1180
  return;
@@ -1176,7 +1184,7 @@ class jt {
1176
1184
  console.log("Нет изменений для сохранения.");
1177
1185
  return;
1178
1186
  }
1179
- console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: N(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1187
+ console.log("baseState", this.baseState), this.currentIndex < this.patches.length && this.patches.splice(this.currentIndex), console.log("diff", s), this.totalChangesCount += 1, this.patches.push({ id: x(), diff: s }), this.currentIndex += 1, this.patches.length > this.maxHistoryLength && (this.baseState = this.diffPatcher.patch(this.baseState, this.patches[0].diff), this.patches.shift(), this.currentIndex -= 1, this.baseStateChangesCount += 1), console.log("Состояние сохранено. Текущий индекс истории:", this.currentIndex);
1180
1188
  }
1181
1189
  /**
1182
1190
  * Сериализует customData объектов в строку. Это необходимо чтобы при вызове loadFromJSON fabricjs не пытался обрабатывать свойства внутри customData, как свойства FabricObject, если их названия совпадают с зарезервированными.
@@ -1213,14 +1221,14 @@ class jt {
1213
1221
  if (!t) return;
1214
1222
  console.log("loadStateFromFullState fullState", t);
1215
1223
  const { canvas: e, canvasManager: s, interactionBlocker: n, backgroundManager: o } = this.editor, { width: a, height: i } = e;
1216
- n.overlayMask = null, jt._serializeCustomData(t), yield e.loadFromJSON(t, (h, u) => {
1217
- jt._deserializeCustomData(h, u);
1224
+ n.overlayMask = null, It._serializeCustomData(t), yield e.loadFromJSON(t, (l, u) => {
1225
+ It._deserializeCustomData(l, u);
1218
1226
  });
1219
- const r = e.getObjects().find((h) => h.id === "montage-area");
1227
+ const r = e.getObjects().find((l) => l.id === "montage-area");
1220
1228
  r && (this.editor.montageArea = r, (a !== e.getWidth() || i !== e.getHeight()) && s.updateCanvas());
1221
- const c = e.getObjects().find((h) => h.id === "overlay-mask");
1229
+ const c = e.getObjects().find((l) => l.id === "overlay-mask");
1222
1230
  c && (n.overlayMask = c, n.overlayMask.visible = !1);
1223
- const d = e.getObjects().find((h) => h.id === "background");
1231
+ const d = e.getObjects().find((l) => l.id === "background");
1224
1232
  d ? (o.backgroundObject = d, o.refresh()) : o.removeBackground({ withoutSave: !0 }), e.renderAll(), e.fire("editor:history-state-loaded", {
1225
1233
  fullState: t,
1226
1234
  currentIndex: this.currentIndex,
@@ -1306,7 +1314,7 @@ class jt {
1306
1314
  });
1307
1315
  }
1308
1316
  }
1309
- const is = 0.1, rs = 2, je = 0.1, cs = 90, J = 16, q = 16, P = 4096, V = 4096, Ie = "application/image-editor:";
1317
+ const cs = 0.1, ds = 2, Ae = 0.1, ls = 90, J = 16, q = 16, P = 4096, V = 4096, Ce = "application/image-editor:", yt = ["format", "uppercase", "textCaseRaw"], hs = 50;
1310
1318
  class H {
1311
1319
  constructor({ editor: t }) {
1312
1320
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
@@ -1334,7 +1342,7 @@ class H {
1334
1342
  withoutSelection: i = !1
1335
1343
  } = t;
1336
1344
  if (!e) return null;
1337
- const { canvas: r, montageArea: c, transformManager: d, historyManager: h, errorManager: u } = this.editor, g = yield this.getContentType(e), f = H.getFormatFromContentType(g), { acceptContentTypes: m, acceptFormats: y } = this;
1345
+ const { canvas: r, montageArea: c, transformManager: d, historyManager: l, errorManager: u } = this.editor, g = yield this.getContentType(e), f = H.getFormatFromContentType(g), { acceptContentTypes: m, acceptFormats: b } = this;
1338
1346
  if (!this.isAllowedContentType(g)) {
1339
1347
  const p = `Неверный contentType для изображения: ${g}. Ожидается один из: ${this.acceptContentTypes.join(", ")}.`;
1340
1348
  return u.emitError({
@@ -1347,21 +1355,21 @@ class H {
1347
1355
  format: f,
1348
1356
  contentType: g,
1349
1357
  acceptContentTypes: m,
1350
- acceptFormats: y,
1358
+ acceptFormats: b,
1351
1359
  fromClipboard: o,
1352
1360
  isBackground: a,
1353
1361
  withoutSelection: i
1354
1362
  }
1355
1363
  }), null;
1356
1364
  }
1357
- h.suspendHistory();
1365
+ l.suspendHistory();
1358
1366
  try {
1359
1367
  let p, M;
1360
1368
  if (e instanceof File)
1361
1369
  p = URL.createObjectURL(e);
1362
1370
  else if (typeof e == "string") {
1363
- const j = yield (yield fetch(e, { mode: "cors" })).blob();
1364
- p = URL.createObjectURL(j);
1371
+ const A = yield (yield fetch(e, { mode: "cors" })).blob();
1372
+ p = URL.createObjectURL(A);
1365
1373
  } else
1366
1374
  return u.emitError({
1367
1375
  origin: "ImageManager",
@@ -1373,37 +1381,37 @@ class H {
1373
1381
  format: f,
1374
1382
  contentType: g,
1375
1383
  acceptContentTypes: m,
1376
- acceptFormats: y,
1384
+ acceptFormats: b,
1377
1385
  fromClipboard: o,
1378
1386
  isBackground: a,
1379
1387
  withoutSelection: i
1380
1388
  }
1381
1389
  }), null;
1382
1390
  if (this._createdBlobUrls.push(p), f === "svg") {
1383
- const A = yield Ee(p);
1384
- M = mt.groupSVGElements(A.objects, A.options);
1391
+ const y = yield Ne(p);
1392
+ M = mt.groupSVGElements(y.objects, y.options);
1385
1393
  } else
1386
1394
  M = yield ht.fromURL(p, { crossOrigin: "anonymous" });
1387
- const { width: S, height: E } = M;
1395
+ const { width: S, height: O } = M;
1388
1396
  if (M instanceof ht) {
1389
- const A = M.getElement();
1390
- let j = "";
1391
- if (A instanceof HTMLImageElement ? j = A.src : A instanceof HTMLCanvasElement && (j = A.toDataURL()), E > V || S > P) {
1392
- const L = yield this.resizeImageToBoundaries(j, "max"), w = URL.createObjectURL(L);
1393
- this._createdBlobUrls.push(w), M = yield ht.fromURL(w, { crossOrigin: "anonymous" });
1394
- } else if (E < q || S < J) {
1395
- const L = yield this.resizeImageToBoundaries(j, "min"), w = URL.createObjectURL(L);
1396
- this._createdBlobUrls.push(w), M = yield ht.fromURL(w, { crossOrigin: "anonymous" });
1397
+ const y = M.getElement();
1398
+ let A = "";
1399
+ if (y instanceof HTMLImageElement ? A = y.src : y instanceof HTMLCanvasElement && (A = y.toDataURL()), O > V || S > P) {
1400
+ const N = yield this.resizeImageToBoundaries(A, "max"), I = URL.createObjectURL(N);
1401
+ this._createdBlobUrls.push(I), M = yield ht.fromURL(I, { crossOrigin: "anonymous" });
1402
+ } else if (O < q || S < J) {
1403
+ const N = yield this.resizeImageToBoundaries(A, "min"), I = URL.createObjectURL(N);
1404
+ this._createdBlobUrls.push(I), M = yield ht.fromURL(I, { crossOrigin: "anonymous" });
1397
1405
  }
1398
1406
  }
1399
- if (M.set("id", `${M.type}-${N()}`), M.set("format", f), s === "scale-montage")
1407
+ if (M.set("id", `${M.type}-${x()}`), M.set("format", f), s === "scale-montage")
1400
1408
  this.editor.canvasManager.scaleMontageAreaToImage({ object: M, withoutSave: !0 });
1401
1409
  else {
1402
- const { width: A, height: j } = c, L = this.calculateScaleFactor({ imageObject: M, scaleType: s });
1403
- s === "image-contain" && L < 1 ? d.fitObject({ object: M, type: "contain", withoutSave: !0 }) : s === "image-cover" && (S > A || E > j) && d.fitObject({ object: M, type: "cover", withoutSave: !0 });
1410
+ const { width: y, height: A } = c, N = this.calculateScaleFactor({ imageObject: M, scaleType: s });
1411
+ s === "image-contain" && N < 1 ? d.fitObject({ object: M, type: "contain", withoutSave: !0 }) : s === "image-cover" && (S > y || O > A) && d.fitObject({ object: M, type: "cover", withoutSave: !0 });
1404
1412
  }
1405
- r.add(M), r.centerObject(M), i || r.setActiveObject(M), r.renderAll(), h.resumeHistory(), n || h.saveState();
1406
- const v = {
1413
+ r.add(M), r.centerObject(M), i || r.setActiveObject(M), r.renderAll(), l.resumeHistory(), n || l.saveState();
1414
+ const T = {
1407
1415
  image: M,
1408
1416
  format: f,
1409
1417
  contentType: g,
@@ -1414,7 +1422,7 @@ class H {
1414
1422
  isBackground: a,
1415
1423
  withoutSelection: i
1416
1424
  };
1417
- return r.fire("editor:image-imported", v), v;
1425
+ return r.fire("editor:image-imported", T), T;
1418
1426
  } catch (p) {
1419
1427
  return u.emitError({
1420
1428
  origin: "ImageManager",
@@ -1431,7 +1439,7 @@ class H {
1431
1439
  isBackground: a,
1432
1440
  withoutSelection: i
1433
1441
  }
1434
- }), h.resumeHistory(), null;
1442
+ }), l.resumeHistory(), null;
1435
1443
  }
1436
1444
  });
1437
1445
  }
@@ -1484,22 +1492,22 @@ class H {
1484
1492
  exportAsBlob: o = !1
1485
1493
  } = t, { canvas: a, montageArea: i, workerManager: r, interactionBlocker: c } = this.editor;
1486
1494
  try {
1487
- const d = s === "application/pdf", h = d ? "image/jpg" : s, u = H.getFormatFromContentType(h);
1495
+ const d = s === "application/pdf", l = d ? "image/jpg" : s, u = H.getFormatFromContentType(l);
1488
1496
  i.setCoords();
1489
- const { left: g, top: f, width: m, height: y } = i.getBoundingRect(), p = yield a.clone(["id", "format", "locked"]);
1490
- p.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(h) && (p.backgroundColor = "#ffffff");
1491
- const M = p.getObjects().find((b) => b.id === i.id);
1497
+ const { left: g, top: f, width: m, height: b } = i.getBoundingRect(), p = yield a.clone(["id", "format", "locked"]);
1498
+ p.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(l) && (p.backgroundColor = "#ffffff");
1499
+ const M = p.getObjects().find((v) => v.id === i.id);
1492
1500
  if (M && (M.visible = !1), c != null && c.isBlocked) {
1493
- const b = p.getObjects().find((T) => T.id === c.overlayMask.id);
1494
- b && (b.visible = !1);
1501
+ const v = p.getObjects().find((w) => w.id === c.overlayMask.id);
1502
+ v && (v.visible = !1);
1495
1503
  }
1496
- p.viewportTransform = [1, 0, 0, 1, -g, -f], p.setDimensions({ width: m, height: y }, { backstoreOnly: !0 }), p.renderAll();
1497
- const S = p.getObjects().filter((b) => b.format).every((b) => b.format === "svg");
1504
+ p.viewportTransform = [1, 0, 0, 1, -g, -f], p.setDimensions({ width: m, height: b }, { backstoreOnly: !0 }), p.renderAll();
1505
+ const S = p.getObjects().filter((v) => v.format).every((v) => v.format === "svg");
1498
1506
  if (u === "svg" && S) {
1499
- const b = p.toSVG();
1507
+ const v = p.toSVG();
1500
1508
  p.dispose();
1501
- const k = {
1502
- image: H._exportSVGStringAsFile(b, {
1509
+ const L = {
1510
+ image: H._exportSVGStringAsFile(v, {
1503
1511
  exportAsBase64: n,
1504
1512
  exportAsBlob: o,
1505
1513
  fileName: e
@@ -1508,34 +1516,34 @@ class H {
1508
1516
  contentType: "image/svg+xml",
1509
1517
  fileName: e.replace(/\.[^/.]+$/, ".svg")
1510
1518
  };
1511
- return a.fire("editor:canvas-exported", k), k;
1519
+ return a.fire("editor:canvas-exported", L), L;
1512
1520
  }
1513
- const E = yield new Promise((b, T) => {
1514
- p.getElement().toBlob((k) => {
1515
- k ? b(k) : T(new Error("Failed to create Blob from canvas"));
1521
+ const O = yield new Promise((v, w) => {
1522
+ p.getElement().toBlob((L) => {
1523
+ L ? v(L) : w(new Error("Failed to create Blob from canvas"));
1516
1524
  });
1517
1525
  });
1518
1526
  if (p.dispose(), o) {
1519
- const b = {
1520
- image: E,
1527
+ const v = {
1528
+ image: O,
1521
1529
  format: u,
1522
- contentType: h,
1530
+ contentType: l,
1523
1531
  fileName: e
1524
1532
  };
1525
- return a.fire("editor:canvas-exported", b), b;
1533
+ return a.fire("editor:canvas-exported", v), v;
1526
1534
  }
1527
- const v = yield createImageBitmap(E), A = yield r.post(
1535
+ const T = yield createImageBitmap(O), y = yield r.post(
1528
1536
  "toDataURL",
1529
- { format: u, quality: 1, bitmap: v },
1530
- [v]
1537
+ { format: u, quality: 1, bitmap: T },
1538
+ [T]
1531
1539
  );
1532
1540
  if (d) {
1533
- const T = m * 0.264583, k = y * 0.264583, x = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Y = new x({
1534
- orientation: T > k ? "landscape" : "portrait",
1541
+ const w = m * 0.264583, L = b * 0.264583, _ = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, Y = new _({
1542
+ orientation: w > L ? "landscape" : "portrait",
1535
1543
  unit: "mm",
1536
- format: [T, k]
1544
+ format: [w, L]
1537
1545
  });
1538
- if (Y.addImage(String(A), "JPG", 0, 0, T, k), n) {
1546
+ if (Y.addImage(String(y), "JPG", 0, 0, w, L), n) {
1539
1547
  const W = {
1540
1548
  image: Y.output("datauristring"),
1541
1549
  format: "pdf",
@@ -1544,8 +1552,8 @@ class H {
1544
1552
  };
1545
1553
  return a.fire("editor:canvas-exported", W), W;
1546
1554
  }
1547
- const _ = Y.output("blob"), Z = {
1548
- image: new File([_], e, { type: "application/pdf" }),
1555
+ const B = Y.output("blob"), Z = {
1556
+ image: new File([B], e, { type: "application/pdf" }),
1549
1557
  format: "pdf",
1550
1558
  contentType: "application/pdf",
1551
1559
  fileName: e
@@ -1553,21 +1561,21 @@ class H {
1553
1561
  return a.fire("editor:canvas-exported", Z), Z;
1554
1562
  }
1555
1563
  if (n) {
1556
- const b = {
1557
- image: A,
1564
+ const v = {
1565
+ image: y,
1558
1566
  format: u,
1559
- contentType: h,
1567
+ contentType: l,
1560
1568
  fileName: e
1561
1569
  };
1562
- return a.fire("editor:canvas-exported", b), b;
1570
+ return a.fire("editor:canvas-exported", v), v;
1563
1571
  }
1564
- const j = u === "svg" && !S ? e.replace(/\.[^/.]+$/, ".png") : e, w = {
1565
- image: new File([E], j, { type: h }),
1572
+ const A = u === "svg" && !S ? e.replace(/\.[^/.]+$/, ".png") : e, I = {
1573
+ image: new File([O], A, { type: l }),
1566
1574
  format: u,
1567
- contentType: h,
1568
- fileName: j
1575
+ contentType: l,
1576
+ fileName: A
1569
1577
  };
1570
- return a.fire("editor:canvas-exported", w), w;
1578
+ return a.fire("editor:canvas-exported", I), I;
1571
1579
  } catch (d) {
1572
1580
  return this.editor.errorManager.emitError({
1573
1581
  origin: "ImageManager",
@@ -1610,13 +1618,13 @@ class H {
1610
1618
  try {
1611
1619
  const d = H.getFormatFromContentType(n);
1612
1620
  if (d === "svg") {
1613
- const m = c.toSVG(), y = H._exportSVGStringAsFile(m, {
1621
+ const m = c.toSVG(), b = H._exportSVGStringAsFile(m, {
1614
1622
  exportAsBase64: o,
1615
1623
  exportAsBlob: a,
1616
1624
  fileName: s
1617
1625
  }), p = {
1618
1626
  object: c,
1619
- image: y,
1627
+ image: b,
1620
1628
  format: d,
1621
1629
  contentType: "image/svg+xml",
1622
1630
  fileName: s.replace(/\.[^/.]+$/, ".svg")
@@ -1624,7 +1632,7 @@ class H {
1624
1632
  return i.fire("editor:object-exported", p), p;
1625
1633
  }
1626
1634
  if (o && c instanceof ht) {
1627
- const m = yield createImageBitmap(c.getElement()), y = yield r.post(
1635
+ const m = yield createImageBitmap(c.getElement()), b = yield r.post(
1628
1636
  "toDataURL",
1629
1637
  {
1630
1638
  format: d,
@@ -1634,18 +1642,18 @@ class H {
1634
1642
  [m]
1635
1643
  ), p = {
1636
1644
  object: c,
1637
- image: y,
1645
+ image: b,
1638
1646
  format: d,
1639
1647
  contentType: n,
1640
1648
  fileName: s
1641
1649
  };
1642
1650
  return i.fire("editor:object-exported", p), p;
1643
1651
  }
1644
- const h = c.toCanvasElement({
1652
+ const l = c.toCanvasElement({
1645
1653
  enableRetinaScaling: !1
1646
- }), u = yield new Promise((m, y) => {
1647
- h.toBlob((p) => {
1648
- p ? m(p) : y(new Error("Failed to create Blob from canvas"));
1654
+ }), u = yield new Promise((m, b) => {
1655
+ l.toBlob((p) => {
1656
+ p ? m(p) : b(new Error("Failed to create Blob from canvas"));
1649
1657
  });
1650
1658
  });
1651
1659
  if (a) {
@@ -1794,11 +1802,11 @@ class H {
1794
1802
  return e ? e[1] : "";
1795
1803
  }
1796
1804
  }
1797
- const K = (l, t, e) => Math.max(Math.min(l, e), t), Ae = (l, t) => l * t, ds = (l, t) => new yt(l / 2, t / 2);
1798
- function ls(l) {
1799
- return ((l == null ? void 0 : l.type) === "image" || (l == null ? void 0 : l.format) === "svg") && typeof (l == null ? void 0 : l.width) == "number" && typeof (l == null ? void 0 : l.height) == "number";
1805
+ const K = (h, t, e) => Math.max(Math.min(h, e), t), Se = (h, t) => h * t, us = (h, t) => new bt(h / 2, t / 2);
1806
+ function gs(h) {
1807
+ return ((h == null ? void 0 : h.type) === "image" || (h == null ? void 0 : h.format) === "svg") && typeof (h == null ? void 0 : h.width) == "number" && typeof (h == null ? void 0 : h.height) == "number";
1800
1808
  }
1801
- class hs {
1809
+ class fs {
1802
1810
  /**
1803
1811
  * @param options
1804
1812
  * @param options.editor – экземпляр редактора
@@ -1831,12 +1839,12 @@ class hs {
1831
1839
  options: { canvasBackstoreWidth: i }
1832
1840
  } = this.editor, { width: r, height: c } = a, d = K(Number(t), J, P);
1833
1841
  if (!i || i === "auto" || n ? this.adaptCanvasToContainer() : i ? this.setCanvasBackstoreWidth(Number(i)) : this.setCanvasBackstoreWidth(d), a.set({ width: d }), (f = o.clipPath) == null || f.set({ width: d }), e) {
1834
- const m = d / r, y = Ae(c, m);
1835
- this.setResolutionHeight(y);
1842
+ const m = d / r, b = Se(c, m);
1843
+ this.setResolutionHeight(b);
1836
1844
  return;
1837
1845
  }
1838
- const { left: h, top: u } = this.getObjectDefaultCoords(a), g = o.getZoom();
1839
- o.setViewportTransform([g, 0, 0, g, h, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-width-changed", {
1846
+ const { left: l, top: u } = this.getObjectDefaultCoords(a), g = o.getZoom();
1847
+ o.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-width-changed", {
1840
1848
  width: d,
1841
1849
  preserveProportional: e,
1842
1850
  withoutSave: s,
@@ -1861,12 +1869,12 @@ class hs {
1861
1869
  options: { canvasBackstoreHeight: i }
1862
1870
  } = this.editor, { width: r, height: c } = a, d = K(Number(t), q, V);
1863
1871
  if (!i || i === "auto" || n ? this.adaptCanvasToContainer() : i ? this.setCanvasBackstoreHeight(Number(i)) : this.setCanvasBackstoreHeight(d), a.set({ height: d }), (f = o.clipPath) == null || f.set({ height: d }), e) {
1864
- const m = d / c, y = Ae(r, m);
1865
- this.setResolutionWidth(y);
1872
+ const m = d / c, b = Se(r, m);
1873
+ this.setResolutionWidth(b);
1866
1874
  return;
1867
1875
  }
1868
- const { left: h, top: u } = this.getObjectDefaultCoords(a), g = o.getZoom();
1869
- o.setViewportTransform([g, 0, 0, g, h, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-height-changed", {
1876
+ const { left: l, top: u } = this.getObjectDefaultCoords(a), g = o.getZoom();
1877
+ o.setViewportTransform([g, 0, 0, g, l, u]), this.centerMontageArea(), s || this.editor.historyManager.saveState(), o.fire("editor:resolution-height-changed", {
1870
1878
  height: d,
1871
1879
  preserveProportional: e,
1872
1880
  withoutSave: s,
@@ -1879,7 +1887,7 @@ class hs {
1879
1887
  */
1880
1888
  centerMontageArea() {
1881
1889
  var r;
1882
- const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), n = t.getHeight(), o = t.getZoom(), a = ds(s, n);
1890
+ const { canvas: t, montageArea: e } = this.editor, s = t.getWidth(), n = t.getHeight(), o = t.getZoom(), a = us(s, n);
1883
1891
  e.set({
1884
1892
  left: s / 2,
1885
1893
  top: n / 2
@@ -1952,22 +1960,22 @@ class hs {
1952
1960
  if (i !== 0 || r !== 0) {
1953
1961
  const c = t.getActiveObject(), d = [];
1954
1962
  if ((c == null ? void 0 : c.type) === "activeselection") {
1955
- const h = c;
1956
- d.push(...h.getObjects()), t.discardActiveObject();
1963
+ const l = c;
1964
+ d.push(...l.getObjects()), t.discardActiveObject();
1957
1965
  }
1958
- if (t.getObjects().forEach((h) => {
1959
- h.id === "montage-area" || h.id === "overlay-mask" || h.id === "background" || (h.set({
1960
- left: h.left + i,
1961
- top: h.top + r
1962
- }), h.setCoords());
1966
+ if (t.getObjects().forEach((l) => {
1967
+ l.id === "montage-area" || l.id === "overlay-mask" || l.id === "background" || (l.set({
1968
+ left: l.left + i,
1969
+ top: l.top + r
1970
+ }), l.setCoords());
1963
1971
  }), d.length > 0)
1964
1972
  if (d.length === 1)
1965
1973
  t.setActiveObject(d[0]);
1966
1974
  else {
1967
- const h = new O(d, {
1975
+ const l = new D(d, {
1968
1976
  canvas: t
1969
1977
  });
1970
- t.setActiveObject(h);
1978
+ t.setActiveObject(l);
1971
1979
  }
1972
1980
  }
1973
1981
  t.renderAll(), t.fire("editor:canvas-updated", {
@@ -2130,17 +2138,17 @@ class hs {
2130
2138
  montageAreaHeight: r
2131
2139
  }
2132
2140
  } = this.editor, c = t || n.getActiveObject();
2133
- if (!ls(c)) return;
2134
- const { width: d, height: h } = c;
2135
- let u = Math.min(d, P), g = Math.min(h, V);
2141
+ if (!gs(c)) return;
2142
+ const { width: d, height: l } = c;
2143
+ let u = Math.min(d, P), g = Math.min(l, V);
2136
2144
  if (e) {
2137
2145
  const {
2138
2146
  width: f,
2139
2147
  height: m
2140
- } = o, y = d / f, p = h / m, M = Math.max(y, p);
2148
+ } = o, b = d / f, p = l / m, M = Math.max(b, p);
2141
2149
  u = f * M, g = m * M;
2142
2150
  }
2143
- this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > i || h > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), a.resetObject({ object: c, withoutSave: !0 }), n.centerObject(c), n.renderAll(), s || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
2151
+ this.setResolutionWidth(u, { withoutSave: !0 }), this.setResolutionHeight(g, { withoutSave: !0 }), this.editor.backgroundManager.backgroundObject && this.editor.backgroundManager.refresh(), (d > i || l > r) && this.editor.zoomManager.calculateAndApplyDefaultZoom(), a.resetObject({ object: c, withoutSave: !0 }), n.centerObject(c), n.renderAll(), s || this.editor.historyManager.saveState(), n.fire("editor:montage-area-scaled-to-image", {
2144
2152
  object: c,
2145
2153
  width: u,
2146
2154
  height: g,
@@ -2190,7 +2198,7 @@ class hs {
2190
2198
  );
2191
2199
  }
2192
2200
  }
2193
- class us {
2201
+ class ms {
2194
2202
  constructor({ editor: t }) {
2195
2203
  this.editor = t, this.options = t.options;
2196
2204
  }
@@ -2201,7 +2209,7 @@ class us {
2201
2209
  * @param options.withoutSave - Не сохранять состояние
2202
2210
  * @fires editor:object-rotated
2203
2211
  */
2204
- rotate(t = cs, { withoutSave: e } = {}) {
2212
+ rotate(t = ls, { withoutSave: e } = {}) {
2205
2213
  const { canvas: s, historyManager: n } = this.editor, o = s.getActiveObject();
2206
2214
  if (!o) return;
2207
2215
  const a = o.angle + t;
@@ -2251,7 +2259,7 @@ class us {
2251
2259
  withoutSave: s
2252
2260
  } = {}) {
2253
2261
  const { canvas: n, historyManager: o } = this.editor, a = t || n.getActiveObject();
2254
- a && (a instanceof O ? a.getObjects().forEach((i) => {
2262
+ a && (a instanceof D ? a.getObjects().forEach((i) => {
2255
2263
  i.set("opacity", e);
2256
2264
  }) : a.set("opacity", e), n.renderAll(), s || o.saveState(), n.fire("editor:object-opacity-changed", {
2257
2265
  object: a,
@@ -2278,12 +2286,12 @@ class us {
2278
2286
  } = {}) {
2279
2287
  const { canvas: o, historyManager: a } = this.editor, i = t || o.getActiveObject();
2280
2288
  if (i) {
2281
- if (i instanceof O && !n) {
2289
+ if (i instanceof D && !n) {
2282
2290
  const r = i.getObjects();
2283
2291
  o.discardActiveObject(), r.forEach((d) => {
2284
2292
  this._fitSingleObject(d, e);
2285
2293
  });
2286
- const c = new O(r, { canvas: o });
2294
+ const c = new D(r, { canvas: o });
2287
2295
  o.setActiveObject(c);
2288
2296
  } else
2289
2297
  this._fitSingleObject(i, e);
@@ -2302,9 +2310,9 @@ class us {
2302
2310
  * @private
2303
2311
  */
2304
2312
  _fitSingleObject(t, e) {
2305
- const { canvas: s, montageArea: n } = this.editor, { width: o, height: a, scaleX: i = 1, scaleY: r = 1, angle: c = 0 } = t, d = o * Math.abs(i), h = a * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), m = d * g + h * f, y = d * f + h * g, p = n.width, M = n.height;
2313
+ const { canvas: s, montageArea: n } = this.editor, { width: o, height: a, scaleX: i = 1, scaleY: r = 1, angle: c = 0 } = t, d = o * Math.abs(i), l = a * Math.abs(r), u = c * Math.PI / 180, g = Math.abs(Math.cos(u)), f = Math.abs(Math.sin(u)), m = d * g + l * f, b = d * f + l * g, p = n.width, M = n.height;
2306
2314
  let S;
2307
- e === "contain" ? S = Math.min(p / m, M / y) : S = Math.max(p / m, M / y), t.set({
2315
+ e === "contain" ? S = Math.min(p / m, M / b) : S = Math.max(p / m, M / b), t.set({
2308
2316
  scaleX: i * S,
2309
2317
  scaleY: r * S
2310
2318
  }), s.centerObject(t);
@@ -2343,11 +2351,11 @@ class us {
2343
2351
  }), e)
2344
2352
  this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 });
2345
2353
  else {
2346
- const { width: h, height: u } = o, { width: g, height: f } = c, m = a.calculateScaleFactor({
2354
+ const { width: l, height: u } = o, { width: g, height: f } = c, m = a.calculateScaleFactor({
2347
2355
  imageObject: c,
2348
2356
  scaleType: r
2349
2357
  });
2350
- r === "contain" && m < 1 || r === "cover" && (g > h || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2358
+ r === "contain" && m < 1 || r === "cover" && (g > l || f > u) ? this.fitObject({ object: c, withoutSave: !0, fitAsOneObject: !0 }) : c.set({ scaleX: 1, scaleY: 1 });
2351
2359
  }
2352
2360
  c.set({ flipX: !1, flipY: !1, angle: 0 }), n.centerObject(c), n.renderAll(), i.resumeHistory(), s || i.saveState(), n.fire("editor:object-reset", {
2353
2361
  object: c,
@@ -2356,9 +2364,9 @@ class us {
2356
2364
  });
2357
2365
  }
2358
2366
  }
2359
- class gs {
2367
+ class ps {
2360
2368
  constructor({ editor: t }) {
2361
- this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || is, this.maxZoom = this.options.maxZoom || rs, this.defaultZoom = this.options.defaultScale;
2369
+ this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || cs, this.maxZoom = this.options.maxZoom || ds, this.defaultZoom = this.options.defaultScale;
2362
2370
  }
2363
2371
  /**
2364
2372
  * Вспомогательный метод для вычисления размеров масштабированной монтажной области
@@ -2380,10 +2388,10 @@ class gs {
2380
2388
  * @private
2381
2389
  */
2382
2390
  _getClampedPointerCoordinates(t) {
2383
- const { canvas: e, montageArea: s } = this.editor, n = e.getPointer(t, !0), o = e.viewportTransform, a = e.getZoom(), i = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, h = i * a + o[4], u = r * a + o[4], g = c * a + o[5], f = d * a + o[5], m = Math.max(h, Math.min(u, n.x)), y = Math.max(g, Math.min(f, n.y));
2391
+ const { canvas: e, montageArea: s } = this.editor, n = e.getPointer(t, !0), o = e.viewportTransform, a = e.getZoom(), i = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = i * a + o[4], u = r * a + o[4], g = c * a + o[5], f = d * a + o[5], m = Math.max(l, Math.min(u, n.x)), b = Math.max(g, Math.min(f, n.y));
2384
2392
  return {
2385
2393
  x: m,
2386
- y
2394
+ y: b
2387
2395
  };
2388
2396
  }
2389
2397
  /**
@@ -2415,10 +2423,10 @@ class gs {
2415
2423
  * @private
2416
2424
  */
2417
2425
  _calculateEmptySpaceRatio(t) {
2418
- const { canvas: e, montageArea: s } = this.editor, n = e.viewportTransform, o = e.getWidth(), a = e.getHeight(), i = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, h = -n[4] / t, u = (-n[4] + o) / t, g = -n[5] / t, f = (-n[5] + a) / t, m = h < i, y = u > r, p = g < c, M = f > d;
2419
- if (!(m || y || p || M)) return 0;
2420
- const E = Math.max(0, i - h), v = Math.max(0, u - r), A = Math.max(0, c - g), j = Math.max(0, f - d), L = Math.max(E, v), w = Math.max(A, j), b = L / o, T = w / a;
2421
- return Math.max(b, T);
2426
+ const { canvas: e, montageArea: s } = this.editor, n = e.viewportTransform, o = e.getWidth(), a = e.getHeight(), i = s.left - s.width / 2, r = s.left + s.width / 2, c = s.top - s.height / 2, d = s.top + s.height / 2, l = -n[4] / t, u = (-n[4] + o) / t, g = -n[5] / t, f = (-n[5] + a) / t, m = l < i, b = u > r, p = g < c, M = f > d;
2427
+ if (!(m || b || p || M)) return 0;
2428
+ const O = Math.max(0, i - l), T = Math.max(0, u - r), y = Math.max(0, c - g), A = Math.max(0, f - d), N = Math.max(O, T), I = Math.max(y, A), v = N / o, w = I / a;
2429
+ return Math.max(v, w);
2422
2430
  }
2423
2431
  /**
2424
2432
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -2431,11 +2439,11 @@ class gs {
2431
2439
  * @private
2432
2440
  */
2433
2441
  _calculateSmoothCenteringStep(t, e, s, n, o) {
2434
- const { canvas: a, montageArea: i } = this.editor, r = a.viewportTransform, c = a.getWidth(), d = a.getHeight(), h = t.x - r[4], u = t.y - r[5], g = Math.abs(n), f = e - s;
2442
+ const { canvas: a, montageArea: i } = this.editor, r = a.viewportTransform, c = a.getWidth(), d = a.getHeight(), l = t.x - r[4], u = t.y - r[5], g = Math.abs(n), f = e - s;
2435
2443
  if (Math.abs(f) / g <= 0.1)
2436
- return { x: h, y: u };
2437
- const y = c / 2, p = d / 2, M = i.left, S = i.top, E = y - M * s, v = p - S * s, A = (E - r[4]) / (e - s), j = (v - r[5]) / (e - s), L = A * g, w = j * g, b = L * o, T = w * o, k = Math.abs(b) > Math.abs(h) ? h : b, x = Math.abs(T) > Math.abs(u) ? u : T;
2438
- return { x: k, y: x };
2444
+ return { x: l, y: u };
2445
+ const b = c / 2, p = d / 2, M = i.left, S = i.top, O = b - M * s, T = p - S * s, y = (O - r[4]) / (e - s), A = (T - r[5]) / (e - s), N = y * g, I = A * g, v = N * o, w = I * o, L = Math.abs(v) > Math.abs(l) ? l : v, _ = Math.abs(w) > Math.abs(u) ? u : w;
2446
+ return { x: L, y: _ };
2439
2447
  }
2440
2448
  /**
2441
2449
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -2447,7 +2455,7 @@ class gs {
2447
2455
  * @returns true если центрирование было применено
2448
2456
  * @private
2449
2457
  */
2450
- _applyViewportCentering(t, e = !1, s = je) {
2458
+ _applyViewportCentering(t, e = !1, s = Ae) {
2451
2459
  const { canvas: n } = this.editor, o = this._getScaledMontageDimensions(t), a = n.getWidth(), i = n.getHeight(), r = o.width > a || o.height > i, c = this._calculateFitZoom(), d = t - c;
2452
2460
  if (!(!r || d) && !e)
2453
2461
  return !1;
@@ -2508,10 +2516,10 @@ class gs {
2508
2516
  });
2509
2517
  return;
2510
2518
  }
2511
- const h = this._getClampedPointerCoordinates(e);
2519
+ const l = this._getClampedPointerCoordinates(e);
2512
2520
  this.zoom(t, {
2513
- pointX: h.x,
2514
- pointY: h.y
2521
+ pointX: l.x,
2522
+ pointY: l.y
2515
2523
  });
2516
2524
  }
2517
2525
  /**
@@ -2522,16 +2530,16 @@ class gs {
2522
2530
  * @param options.pointY - Координата Y точки зума
2523
2531
  * @fires editor:zoom-changed
2524
2532
  */
2525
- zoom(t = je, e = {}) {
2533
+ zoom(t = Ae, e = {}) {
2526
2534
  var g, f;
2527
2535
  if (!t) return;
2528
- const { minZoom: s, maxZoom: n } = this, { canvas: o } = this.editor, a = t < 0, i = o.getZoom(), r = o.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, h = new yt(c, d);
2536
+ const { minZoom: s, maxZoom: n } = this, { canvas: o } = this.editor, a = t < 0, i = o.getZoom(), r = o.getCenterPoint(), c = (g = e.pointX) != null ? g : r.x, d = (f = e.pointY) != null ? f : r.y, l = new bt(c, d);
2529
2537
  this.editor.montageArea.setCoords(), this.editor.canvas.requestRenderAll();
2530
2538
  let u = Number((i + Number(t)).toFixed(3));
2531
- u > n && (u = n), u < s && (u = s), o.zoomToPoint(h, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, a, t), o.fire("editor:zoom-changed", {
2539
+ u > n && (u = n), u < s && (u = s), o.zoomToPoint(l, u), this.editor.panConstraintManager.updateBounds(), this._applyViewportCentering(u, a, t), o.fire("editor:zoom-changed", {
2532
2540
  currentZoom: o.getZoom(),
2533
2541
  zoom: u,
2534
- point: h
2542
+ point: l
2535
2543
  });
2536
2544
  }
2537
2545
  /**
@@ -2540,7 +2548,7 @@ class gs {
2540
2548
  * @fires editor:zoom-changed
2541
2549
  */
2542
2550
  setZoom(t = this.defaultZoom) {
2543
- const { minZoom: e, maxZoom: s } = this, { canvas: n } = this.editor, o = new yt(n.getCenterPoint());
2551
+ const { minZoom: e, maxZoom: s } = this, { canvas: n } = this.editor, o = new bt(n.getCenterPoint());
2544
2552
  let a = t;
2545
2553
  t > s && (a = s), t < e && (a = e), n.zoomToPoint(o, a), n.fire("editor:zoom-changed", {
2546
2554
  currentZoom: n.getZoom(),
@@ -2553,14 +2561,14 @@ class gs {
2553
2561
  * @fires editor:zoom-changed
2554
2562
  */
2555
2563
  resetZoom() {
2556
- const { canvas: t } = this.editor, e = new yt(t.getCenterPoint());
2564
+ const { canvas: t } = this.editor, e = new bt(t.getCenterPoint());
2557
2565
  t.zoomToPoint(e, this.defaultZoom), this.editor.canvas.fire("editor:zoom-changed", {
2558
2566
  currentZoom: t.getZoom(),
2559
2567
  point: e
2560
2568
  }), this.editor.panConstraintManager.updateBounds();
2561
2569
  }
2562
2570
  }
2563
- class fs {
2571
+ class Ms {
2564
2572
  constructor({ editor: t }) {
2565
2573
  this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
2566
2574
  }
@@ -2642,7 +2650,7 @@ class Q {
2642
2650
  }
2643
2651
  a.set({
2644
2652
  fill: t,
2645
- backgroundId: `background-${N()}`
2653
+ backgroundId: `background-${x()}`
2646
2654
  }), this.editor.canvas.requestRenderAll();
2647
2655
  } else
2648
2656
  this._removeCurrentBackground(), this._createColorBackground(t);
@@ -2679,7 +2687,7 @@ class Q {
2679
2687
  }
2680
2688
  a.set({
2681
2689
  fill: i,
2682
- backgroundId: `background-${N()}`
2690
+ backgroundId: `background-${x()}`
2683
2691
  }), this.editor.canvas.requestRenderAll();
2684
2692
  } else
2685
2693
  this._removeCurrentBackground(), this._createGradientBackground(t);
@@ -2826,7 +2834,7 @@ class Q {
2826
2834
  hasControls: !1,
2827
2835
  id: "background",
2828
2836
  backgroundType: "color",
2829
- backgroundId: `background-${N()}`
2837
+ backgroundId: `background-${x()}`
2830
2838
  }, { withoutSelection: !0 }), this.refresh();
2831
2839
  }
2832
2840
  /**
@@ -2843,7 +2851,7 @@ class Q {
2843
2851
  hasControls: !1,
2844
2852
  id: "background",
2845
2853
  backgroundType: "gradient",
2846
- backgroundId: `background-${N()}`
2854
+ backgroundId: `background-${x()}`
2847
2855
  }, { withoutSelection: !0 }), this.refresh();
2848
2856
  const e = Q._createFabricGradient(t);
2849
2857
  this.backgroundObject.set("fill", e), this.editor.canvas.requestRenderAll();
@@ -2871,7 +2879,7 @@ class Q {
2871
2879
  hasControls: !1,
2872
2880
  id: "background",
2873
2881
  backgroundType: "image",
2874
- backgroundId: `background-${N()}`,
2882
+ backgroundId: `background-${x()}`,
2875
2883
  customData: e
2876
2884
  }), this._removeCurrentBackground(), this.backgroundObject = s, this.refresh();
2877
2885
  });
@@ -2897,8 +2905,8 @@ class Q {
2897
2905
  { offset: o / 100, color: s }
2898
2906
  ];
2899
2907
  if (t.type === "linear") {
2900
- const h = t.angle * Math.PI / 180, u = Q._angleToCoords(h);
2901
- return new pe({
2908
+ const l = t.angle * Math.PI / 180, u = Q._angleToCoords(l);
2909
+ return new ye({
2902
2910
  type: "linear",
2903
2911
  gradientUnits: "percentage",
2904
2912
  coords: u,
@@ -2917,7 +2925,7 @@ class Q {
2917
2925
  r1: 0,
2918
2926
  r2: c / 100
2919
2927
  };
2920
- return new pe({
2928
+ return new ye({
2921
2929
  type: "radial",
2922
2930
  gradientUnits: "percentage",
2923
2931
  coords: d,
@@ -2952,7 +2960,7 @@ class Q {
2952
2960
  }) ? !1 : t.type === "linear" && e.type === "linear" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 : t.type === "radial" && e.type === "radial" ? Math.abs(t.coords.x1 - e.coords.x1) < 1e-4 && Math.abs(t.coords.y1 - e.coords.y1) < 1e-4 && Math.abs(t.coords.x2 - e.coords.x2) < 1e-4 && Math.abs(t.coords.y2 - e.coords.y2) < 1e-4 && Math.abs(t.coords.r1 - e.coords.r1) < 1e-4 && Math.abs(t.coords.r2 - e.coords.r2) < 1e-4 : !1;
2953
2961
  }
2954
2962
  }
2955
- class It {
2963
+ class At {
2956
2964
  constructor({ editor: t }) {
2957
2965
  this.editor = t;
2958
2966
  }
@@ -2967,7 +2975,7 @@ class It {
2967
2975
  const { canvas: s, historyManager: n } = this.editor;
2968
2976
  n.suspendHistory();
2969
2977
  const o = t || s.getActiveObject();
2970
- o && (o instanceof O ? o.getObjects().forEach((a) => {
2978
+ o && (o instanceof D ? o.getObjects().forEach((a) => {
2971
2979
  s.bringObjectToFront(a);
2972
2980
  }) : s.bringObjectToFront(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-to-front", {
2973
2981
  object: o,
@@ -2985,7 +2993,7 @@ class It {
2985
2993
  const { canvas: s, historyManager: n } = this.editor;
2986
2994
  n.suspendHistory();
2987
2995
  const o = t || s.getActiveObject();
2988
- o && (o instanceof O ? It._moveSelectionForward(s, o) : s.bringObjectForward(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-forward", {
2996
+ o && (o instanceof D ? At._moveSelectionForward(s, o) : s.bringObjectForward(o), s.renderAll(), n.resumeHistory(), e || n.saveState(), s.fire("editor:object-bring-forward", {
2989
2997
  object: o,
2990
2998
  withoutSave: e
2991
2999
  }));
@@ -3008,7 +3016,7 @@ class It {
3008
3016
  o.suspendHistory();
3009
3017
  const r = t || s.getActiveObject();
3010
3018
  if (r) {
3011
- if (r instanceof O) {
3019
+ if (r instanceof D) {
3012
3020
  const c = r.getObjects();
3013
3021
  for (let d = c.length - 1; d >= 0; d -= 1)
3014
3022
  s.sendObjectToBack(c[d]);
@@ -3036,7 +3044,7 @@ class It {
3036
3044
  } = this.editor;
3037
3045
  o.suspendHistory();
3038
3046
  const r = t || s.getActiveObject();
3039
- r && (r instanceof O ? It._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), i && s.sendObjectToBack(i), s.sendObjectToBack(n), a && s.sendObjectToBack(a), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-send-backwards", {
3047
+ r && (r instanceof D ? At._moveSelectionBackwards(s, r) : s.sendObjectBackwards(r), i && s.sendObjectToBack(i), s.sendObjectToBack(n), a && s.sendObjectToBack(a), s.renderAll(), o.resumeHistory(), e || o.saveState(), s.fire("editor:object-send-backwards", {
3040
3048
  object: r,
3041
3049
  withoutSave: e
3042
3050
  }));
@@ -3080,7 +3088,7 @@ class It {
3080
3088
  });
3081
3089
  }
3082
3090
  }
3083
- class ms {
3091
+ class ys {
3084
3092
  /**
3085
3093
  * Менеджер фигур для редактора.
3086
3094
  * @param options - Опции и настройки менеджера фигур.
@@ -3105,14 +3113,14 @@ class ms {
3105
3113
  * @param flags.withoutAdding - Не добавлять объект в canvas
3106
3114
  */
3107
3115
  addRectangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3108
- var h = d, {
3109
- id: t = `rect-${N()}`,
3116
+ var l = d, {
3117
+ id: t = `rect-${x()}`,
3110
3118
  left: e,
3111
3119
  top: s,
3112
3120
  width: n = 100,
3113
3121
  height: o = 100,
3114
3122
  fill: a = "blue"
3115
- } = h, i = X(h, [
3123
+ } = l, i = X(l, [
3116
3124
  "id",
3117
3125
  "left",
3118
3126
  "top",
@@ -3120,7 +3128,7 @@ class ms {
3120
3128
  "height",
3121
3129
  "fill"
3122
3130
  ]);
3123
- const { canvas: u } = this.editor, g = new Ne(D({
3131
+ const { canvas: u } = this.editor, g = new Le(E({
3124
3132
  id: t,
3125
3133
  left: e,
3126
3134
  top: s,
@@ -3148,7 +3156,7 @@ class ms {
3148
3156
  */
3149
3157
  addCircle(c = {}, { withoutSelection: i, withoutAdding: r } = {}) {
3150
3158
  var d = c, {
3151
- id: t = `circle-${N()}`,
3159
+ id: t = `circle-${x()}`,
3152
3160
  left: e,
3153
3161
  top: s,
3154
3162
  radius: n = 50,
@@ -3160,14 +3168,14 @@ class ms {
3160
3168
  "radius",
3161
3169
  "fill"
3162
3170
  ]);
3163
- const { canvas: h } = this.editor, u = new Le(D({
3171
+ const { canvas: l } = this.editor, u = new xe(E({
3164
3172
  id: t,
3165
3173
  left: e,
3166
3174
  top: s,
3167
3175
  fill: o,
3168
3176
  radius: n
3169
3177
  }, a));
3170
- return !e && !s && h.centerObject(u), r || (h.add(u), i || h.setActiveObject(u), h.renderAll()), u;
3178
+ return !e && !s && l.centerObject(u), r || (l.add(u), i || l.setActiveObject(u), l.renderAll()), u;
3171
3179
  }
3172
3180
  /**
3173
3181
  * Добавление треугольника
@@ -3187,14 +3195,14 @@ class ms {
3187
3195
  * @param flags.withoutAdding - Не добавлять объект в canvas
3188
3196
  */
3189
3197
  addTriangle(d = {}, { withoutSelection: r, withoutAdding: c } = {}) {
3190
- var h = d, {
3191
- id: t = `triangle-${N()}`,
3198
+ var l = d, {
3199
+ id: t = `triangle-${x()}`,
3192
3200
  left: e,
3193
3201
  top: s,
3194
3202
  width: n = 100,
3195
3203
  height: o = 100,
3196
3204
  fill: a = "yellow"
3197
- } = h, i = X(h, [
3205
+ } = l, i = X(l, [
3198
3206
  "id",
3199
3207
  "left",
3200
3208
  "top",
@@ -3202,7 +3210,7 @@ class ms {
3202
3210
  "height",
3203
3211
  "fill"
3204
3212
  ]);
3205
- const { canvas: u } = this.editor, g = new Te(D({
3213
+ const { canvas: u } = this.editor, g = new ke(E({
3206
3214
  id: t,
3207
3215
  left: e,
3208
3216
  top: s,
@@ -3213,7 +3221,7 @@ class ms {
3213
3221
  return !e && !s && u.centerObject(g), c || (u.add(g), r || u.setActiveObject(g), u.renderAll()), g;
3214
3222
  }
3215
3223
  }
3216
- class ps {
3224
+ class bs {
3217
3225
  /**
3218
3226
  * @param options
3219
3227
  * @param options.editor - экземпляр редактора с доступом к canvas
@@ -3244,7 +3252,7 @@ class ps {
3244
3252
  return C(this, null, function* () {
3245
3253
  const { canvas: e, errorManager: s } = this.editor;
3246
3254
  try {
3247
- const n = yield t.clone(["format"]);
3255
+ const n = yield t.clone(yt);
3248
3256
  this.clipboard = n, e.fire("editor:object-copied", { object: n });
3249
3257
  } catch (n) {
3250
3258
  s.emitError({
@@ -3271,7 +3279,7 @@ class ps {
3271
3279
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3272
3280
  }), !1;
3273
3281
  try {
3274
- const s = t.toObject(["format"]), n = JSON.stringify(s);
3282
+ const s = t.toObject(yt), n = JSON.stringify(s);
3275
3283
  return t.type === "image" ? this._copyImageToClipboard(t, n) : this._copyTextToClipboard(n);
3276
3284
  } catch (s) {
3277
3285
  return e.emitError({
@@ -3291,8 +3299,8 @@ class ps {
3291
3299
  return C(this, null, function* () {
3292
3300
  try {
3293
3301
  const n = t.toCanvasElement({ enableRetinaScaling: !1 }).toDataURL(), o = n.slice(5).split(";")[0], a = n.split(",")[1], i = atob(a), r = new Uint8Array(i.length);
3294
- for (let h = 0; h < i.length; h += 1)
3295
- r[h] = i.charCodeAt(h);
3302
+ for (let l = 0; l < i.length; l += 1)
3303
+ r[l] = i.charCodeAt(l);
3296
3304
  const c = new Blob([r.buffer], { type: o }), d = new ClipboardItem({ [o]: c });
3297
3305
  return yield navigator.clipboard.write([d]), console.info("Image copied to clipboard successfully"), !0;
3298
3306
  } catch (s) {
@@ -3312,7 +3320,7 @@ class ps {
3312
3320
  _copyTextToClipboard(t) {
3313
3321
  return C(this, null, function* () {
3314
3322
  try {
3315
- const e = `${Ie}${t}`;
3323
+ const e = `${Ce}${t}`;
3316
3324
  return yield navigator.clipboard.writeText(e), console.info("Text copied to clipboard successfully"), !0;
3317
3325
  } catch (e) {
3318
3326
  const { errorManager: s } = this.editor;
@@ -3332,7 +3340,7 @@ class ps {
3332
3340
  */
3333
3341
  _addClonedObjectToCanvas(t) {
3334
3342
  const { canvas: e, historyManager: s } = this.editor;
3335
- if (e.discardActiveObject(), t instanceof O) {
3343
+ if (e.discardActiveObject(), t instanceof D) {
3336
3344
  s.suspendHistory(), t.canvas = e, t.forEachObject((n) => {
3337
3345
  e.add(n);
3338
3346
  }), e.setActiveObject(t), e.requestRenderAll(), s.resumeHistory(), s.saveState();
@@ -3365,14 +3373,14 @@ class ps {
3365
3373
  const { canvas: e } = this.editor, s = t || e.getActiveObject();
3366
3374
  if (!s || s.locked) return !1;
3367
3375
  try {
3368
- const n = yield s.clone(["format"]);
3369
- return n instanceof O && n.forEachObject((o) => {
3376
+ const n = yield s.clone(yt);
3377
+ return n instanceof D && n.forEachObject((o) => {
3370
3378
  o.set({
3371
- id: `${o.type}-${N()}`,
3379
+ id: `${o.type}-${x()}`,
3372
3380
  evented: !0
3373
3381
  });
3374
3382
  }), n.set({
3375
- id: `${n.type}-${N()}`,
3383
+ id: `${n.type}-${x()}`,
3376
3384
  left: n.left + 10,
3377
3385
  top: n.top + 10,
3378
3386
  evented: !0
@@ -3403,7 +3411,7 @@ class ps {
3403
3411
  return;
3404
3412
  }
3405
3413
  const s = t.getData("text/plain");
3406
- if (s && s.startsWith(Ie)) {
3414
+ if (s && s.startsWith(Ce)) {
3407
3415
  this.paste();
3408
3416
  return;
3409
3417
  }
@@ -3411,13 +3419,13 @@ class ps {
3411
3419
  if (o.type !== "text/html" && a) {
3412
3420
  const c = new FileReader();
3413
3421
  c.onload = (d) => {
3414
- d.target && this._handleImageImport(d.target.result).catch((h) => {
3422
+ d.target && this._handleImageImport(d.target.result).catch((l) => {
3415
3423
  this.editor.errorManager.emitError({
3416
3424
  origin: "ClipboardManager",
3417
3425
  method: "handlePasteEvent",
3418
3426
  code: "PASTE_IMAGE_FAILED",
3419
3427
  message: "Ошибка вставки изображения из буфера обмена",
3420
- data: h
3428
+ data: l
3421
3429
  });
3422
3430
  });
3423
3431
  }, c.readAsDataURL(a);
@@ -3425,9 +3433,9 @@ class ps {
3425
3433
  }
3426
3434
  const i = t.getData("text/html");
3427
3435
  if (i) {
3428
- const h = new DOMParser().parseFromString(i, "text/html").querySelector("img");
3429
- if (h != null && h.src) {
3430
- this._handleImageImport(h.src).catch((u) => {
3436
+ const l = new DOMParser().parseFromString(i, "text/html").querySelector("img");
3437
+ if (l != null && l.src) {
3438
+ this._handleImageImport(l.src).catch((u) => {
3431
3439
  this.editor.errorManager.emitError({
3432
3440
  origin: "ClipboardManager",
3433
3441
  method: "handlePasteEvent",
@@ -3451,14 +3459,14 @@ class ps {
3451
3459
  const { canvas: t } = this.editor;
3452
3460
  if (!this.clipboard) return !1;
3453
3461
  try {
3454
- const e = yield this.clipboard.clone(["format"]);
3455
- return t.discardActiveObject(), e instanceof O && e.forEachObject((s) => {
3462
+ const e = yield this.clipboard.clone(yt);
3463
+ return t.discardActiveObject(), e instanceof D && e.forEachObject((s) => {
3456
3464
  s.set({
3457
- id: `${s.type}-${N()}`,
3465
+ id: `${s.type}-${x()}`,
3458
3466
  evented: !0
3459
3467
  });
3460
3468
  }), e.set({
3461
- id: `${e.type}-${N()}`,
3469
+ id: `${e.type}-${x()}`,
3462
3470
  left: e.left + 10,
3463
3471
  top: e.top + 10,
3464
3472
  evented: !0
@@ -3476,7 +3484,7 @@ class ps {
3476
3484
  });
3477
3485
  }
3478
3486
  }
3479
- class At {
3487
+ class Ct {
3480
3488
  constructor({ editor: t }) {
3481
3489
  this.editor = t;
3482
3490
  }
@@ -3501,7 +3509,7 @@ class At {
3501
3509
  lockSkewingY: !0,
3502
3510
  locked: !0
3503
3511
  };
3504
- a.set(i), !e && At._isGroupOrSelection(a) && a.getObjects().forEach((c) => {
3512
+ a.set(i), !e && Ct._isGroupOrSelection(a) && a.getObjects().forEach((c) => {
3505
3513
  c.set(i);
3506
3514
  }), n.renderAll(), s || o.saveState(), n.fire("editor:object-locked", {
3507
3515
  object: a,
@@ -3529,7 +3537,7 @@ class At {
3529
3537
  lockSkewingY: !1,
3530
3538
  locked: !1
3531
3539
  };
3532
- o.set(a), At._isGroupOrSelection(o) && o.getObjects().forEach((i) => {
3540
+ o.set(a), Ct._isGroupOrSelection(o) && o.getObjects().forEach((i) => {
3533
3541
  i.set(a);
3534
3542
  }), s.renderAll(), e || n.saveState(), s.fire("editor:object-unlocked", {
3535
3543
  object: o,
@@ -3537,10 +3545,10 @@ class At {
3537
3545
  });
3538
3546
  }
3539
3547
  static _isGroupOrSelection(t) {
3540
- return t instanceof O || t instanceof $;
3548
+ return t instanceof D || t instanceof $;
3541
3549
  }
3542
3550
  }
3543
- class Ms {
3551
+ class vs {
3544
3552
  constructor({ editor: t }) {
3545
3553
  this.editor = t;
3546
3554
  }
@@ -3552,7 +3560,7 @@ class Ms {
3552
3560
  if (Array.isArray(t))
3553
3561
  return t.length > 0 ? t : null;
3554
3562
  const e = t || this.editor.canvas.getActiveObject();
3555
- return !e || !(e instanceof O) ? null : e.getObjects();
3563
+ return !e || !(e instanceof D) ? null : e.getObjects();
3556
3564
  }
3557
3565
  /**
3558
3566
  * Получить группы для разгруппировки
@@ -3563,13 +3571,13 @@ class Ms {
3563
3571
  const s = t.filter((n) => n instanceof $);
3564
3572
  return s.length > 0 ? s : null;
3565
3573
  }
3566
- if (t instanceof O) {
3574
+ if (t instanceof D) {
3567
3575
  const s = t.getObjects().filter((n) => n instanceof $);
3568
3576
  return s.length > 0 ? s : null;
3569
3577
  }
3570
3578
  const e = t || this.editor.canvas.getActiveObject();
3571
3579
  if (!e) return null;
3572
- if (e instanceof O) {
3580
+ if (e instanceof D) {
3573
3581
  const s = e.getObjects().filter((n) => n instanceof $);
3574
3582
  return s.length > 0 ? s : null;
3575
3583
  }
@@ -3591,7 +3599,7 @@ class Ms {
3591
3599
  try {
3592
3600
  n.suspendHistory();
3593
3601
  const a = new $(o, {
3594
- id: `group-${N()}`
3602
+ id: `group-${x()}`
3595
3603
  });
3596
3604
  o.forEach((r) => s.remove(r)), s.add(a), s.setActiveObject(a), s.requestRenderAll();
3597
3605
  const i = {
@@ -3622,11 +3630,11 @@ class Ms {
3622
3630
  const a = [];
3623
3631
  o.forEach((c) => {
3624
3632
  const d = c.removeAll();
3625
- s.remove(c), d.forEach((h) => {
3626
- s.add(h), a.push(h);
3633
+ s.remove(c), d.forEach((l) => {
3634
+ s.add(l), a.push(l);
3627
3635
  });
3628
3636
  });
3629
- const i = new O(a, {
3637
+ const i = new D(a, {
3630
3638
  canvas: s
3631
3639
  });
3632
3640
  s.setActiveObject(i), s.requestRenderAll();
@@ -3641,7 +3649,7 @@ class Ms {
3641
3649
  }
3642
3650
  }
3643
3651
  }
3644
- class ys {
3652
+ class js {
3645
3653
  constructor({ editor: t }) {
3646
3654
  this.editor = t;
3647
3655
  }
@@ -3652,11 +3660,11 @@ class ys {
3652
3660
  selectAll() {
3653
3661
  const { canvas: t, canvasManager: e, objectLockManager: s } = this.editor;
3654
3662
  t.discardActiveObject();
3655
- const n = e.getObjects(), o = n.some((i) => i.locked), a = n.length > 1 ? new O(e.getObjects(), { canvas: t }) : n[0];
3663
+ const n = e.getObjects(), o = n.some((i) => i.locked), a = n.length > 1 ? new D(e.getObjects(), { canvas: t }) : n[0];
3656
3664
  o && s.lockObject({ object: a, skipInnerObjects: !0, withoutSave: !0 }), t.setActiveObject(a), t.requestRenderAll(), t.fire("editor:all-objects-selected", { selected: a });
3657
3665
  }
3658
3666
  }
3659
- class _t {
3667
+ class Rt {
3660
3668
  constructor({ editor: t }) {
3661
3669
  this.editor = t;
3662
3670
  }
@@ -3703,9 +3711,9 @@ class _t {
3703
3711
  s || o.suspendHistory();
3704
3712
  const r = [];
3705
3713
  if (i.forEach((d) => {
3706
- if (_t._isUngroupableGroup(d)) {
3707
- const h = this._handleGroupDeletion(d);
3708
- r.push(...h);
3714
+ if (Rt._isUngroupableGroup(d)) {
3715
+ const l = this._handleGroupDeletion(d);
3716
+ r.push(...l);
3709
3717
  return;
3710
3718
  }
3711
3719
  n.remove(d), r.push(d);
@@ -3718,7 +3726,7 @@ class _t {
3718
3726
  return n.fire("editor:objects-deleted", c), c;
3719
3727
  }
3720
3728
  }
3721
- const bs = {
3729
+ const Is = {
3722
3730
  IMAGE_MANAGER: {
3723
3731
  /**
3724
3732
  * Некорректный Content-Type изображения
@@ -3817,7 +3825,7 @@ const bs = {
3817
3825
  INVALID_GRADIENT_FORMAT: "INVALID_GRADIENT_FORMAT"
3818
3826
  }
3819
3827
  };
3820
- class Ct {
3828
+ class St {
3821
3829
  constructor({ editor: t }) {
3822
3830
  this._buffer = [], this.editor = t;
3823
3831
  }
@@ -3844,7 +3852,7 @@ class Ct {
3844
3852
  * @fires editor:error
3845
3853
  */
3846
3854
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, data: n, message: o }) {
3847
- if (!Ct.isValidErrorCode(s)) {
3855
+ if (!St.isValidErrorCode(s)) {
3848
3856
  console.warn("Неизвестный код ошибки: ", { code: s, origin: t, method: e });
3849
3857
  return;
3850
3858
  }
@@ -3858,7 +3866,7 @@ class Ct {
3858
3866
  message: a,
3859
3867
  data: n
3860
3868
  };
3861
- this._buffer.push(D({
3869
+ this._buffer.push(E({
3862
3870
  type: "editor:error"
3863
3871
  }, i)), this.editor.canvas.fire("editor:error", i);
3864
3872
  }
@@ -3873,7 +3881,7 @@ class Ct {
3873
3881
  * @fires editor:warning
3874
3882
  */
3875
3883
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: s, message: n, data: o }) {
3876
- if (!Ct.isValidErrorCode(s)) {
3884
+ if (!St.isValidErrorCode(s)) {
3877
3885
  console.warn("Неизвестный код предупреждения: ", { code: s, origin: t, method: e });
3878
3886
  return;
3879
3887
  }
@@ -3886,7 +3894,7 @@ class Ct {
3886
3894
  message: a,
3887
3895
  data: o
3888
3896
  };
3889
- this._buffer.push(D({
3897
+ this._buffer.push(E({
3890
3898
  type: "editor:warning"
3891
3899
  }, i)), this.editor.canvas.fire("editor:warning", i);
3892
3900
  }
@@ -3896,10 +3904,10 @@ class Ct {
3896
3904
  * @returns true, если код допустим, иначе false
3897
3905
  */
3898
3906
  static isValidErrorCode(t) {
3899
- return t ? Object.values(bs).some((e) => Object.values(e).includes(t)) : !1;
3907
+ return t ? Object.values(Is).some((e) => Object.values(e).includes(t)) : !1;
3900
3908
  }
3901
3909
  }
3902
- class vs {
3910
+ class As {
3903
3911
  constructor({ editor: t }) {
3904
3912
  this.currentBounds = null, this.editor = t;
3905
3913
  }
@@ -3949,12 +3957,12 @@ class vs {
3949
3957
  constrainPan(t, e) {
3950
3958
  if (!this.currentBounds || !this.currentBounds.canPan)
3951
3959
  return { x: 0, y: 0 };
3952
- const { canvas: s, montageArea: n } = this.editor, o = s.getZoom(), a = n.left, i = n.top, r = s.getWidth() / 2, c = s.getHeight() / 2, d = a * o + t - r, h = i * o + e - c, u = Math.max(
3960
+ const { canvas: s, montageArea: n } = this.editor, o = s.getZoom(), a = n.left, i = n.top, r = s.getWidth() / 2, c = s.getHeight() / 2, d = a * o + t - r, l = i * o + e - c, u = Math.max(
3953
3961
  this.currentBounds.minX,
3954
3962
  Math.min(this.currentBounds.maxX, d)
3955
3963
  ), g = Math.max(
3956
3964
  this.currentBounds.minY,
3957
- Math.min(this.currentBounds.maxY, h)
3965
+ Math.min(this.currentBounds.maxY, l)
3958
3966
  ), f = u + r - a * o, m = g + c - i * o;
3959
3967
  return {
3960
3968
  x: f,
@@ -3984,56 +3992,83 @@ class vs {
3984
3992
  this.currentBounds = this.calculatePanBounds();
3985
3993
  }
3986
3994
  }
3987
- const wt = 0.01;
3988
- class B {
3995
+ const Et = 0.01;
3996
+ class k {
3989
3997
  constructor({ editor: t }) {
3990
3998
  var e;
3991
- this.handleObjectScaling = (s) => {
3999
+ this._handleTextEditingEntered = () => {
4000
+ this.isTextEditingActive = !0;
4001
+ }, this._handleTextChanged = (s) => {
4002
+ var r, c;
4003
+ const { target: n } = s;
4004
+ if (!k._isTextbox(n)) return;
4005
+ const o = (r = n.text) != null ? r : "", a = !!n.uppercase, i = (c = n.textCaseRaw) != null ? c : "";
4006
+ if (a) {
4007
+ const d = k._toUpperCase(o);
4008
+ d !== o && (n.set({ text: d }), this.canvas.requestRenderAll());
4009
+ const l = i.length, u = o.length;
4010
+ if (u > l) {
4011
+ const g = o.slice(l).toLocaleLowerCase();
4012
+ n.textCaseRaw = i + g;
4013
+ } else u < l ? n.textCaseRaw = i.slice(0, u) : n.textCaseRaw = o.toLocaleLowerCase();
4014
+ } else
4015
+ n.textCaseRaw = o;
4016
+ }, this._handleTextEditingExited = (s) => {
4017
+ var i, r;
4018
+ const { target: n } = s;
4019
+ if (!k._isTextbox(n)) return;
4020
+ const o = (i = n.text) != null ? i : "";
4021
+ if (!!n.uppercase) {
4022
+ const c = (r = n.textCaseRaw) != null ? r : o.toLocaleLowerCase();
4023
+ n.textCaseRaw = c;
4024
+ } else
4025
+ n.textCaseRaw = o;
4026
+ n.locked || n.set({
4027
+ lockMovementX: !1,
4028
+ lockMovementY: !1
4029
+ }), setTimeout(() => {
4030
+ this.isTextEditingActive = !1, this.editor.historyManager.saveState();
4031
+ }, hs);
4032
+ }, this._handleObjectScaling = (s) => {
3992
4033
  var Z, G, W, tt, et, st, nt, ot, at, it, rt, ct, dt, lt;
3993
4034
  const { target: n, transform: o } = s;
3994
- if (!B._isTextbox(n) || !o) return;
3995
- const a = this._ensureScalingState(n), { baseWidth: i, baseLeft: r, baseFontSize: c } = a, d = typeof ((Z = o.original) == null ? void 0 : Z.width) == "number" ? o.original.width : void 0, h = typeof ((G = o.original) == null ? void 0 : G.left) == "number" ? o.original.left : void 0, u = d != null ? d : i, g = h != null ? h : r, f = (W = o.corner) != null ? W : "", m = (tt = o.action) != null ? tt : "", y = ["ml", "mr"].includes(f) || m === "scaleX", p = ["mt", "mb"].includes(f) || m === "scaleY", M = ["tl", "tr", "bl", "br"].includes(f) || m === "scale";
3996
- if (!y && !p && !M) return;
3997
- const S = Math.abs((st = (et = n.scaleX) != null ? et : o.scaleX) != null ? st : 1) || 1, E = Math.abs((ot = (nt = n.scaleY) != null ? nt : o.scaleY) != null ? ot : 1) || 1, v = Math.max(1, u * S), A = Math.max(1, c * E), j = (it = (at = o.originX) != null ? at : n.originX) != null ? it : "left", L = g + u, w = g + u / 2, b = (rt = n.width) != null ? rt : u, T = Math.abs(v - b) > wt, k = Math.abs(A - ((ct = n.fontSize) != null ? ct : c)) > wt;
3998
- if (!T && !k) {
4035
+ if (!k._isTextbox(n) || !o) return;
4036
+ const a = this._ensureScalingState(n), { baseWidth: i, baseLeft: r, baseFontSize: c } = a, d = typeof ((Z = o.original) == null ? void 0 : Z.width) == "number" ? o.original.width : void 0, l = typeof ((G = o.original) == null ? void 0 : G.left) == "number" ? o.original.left : void 0, u = d != null ? d : i, g = l != null ? l : r, f = (W = o.corner) != null ? W : "", m = (tt = o.action) != null ? tt : "", b = ["ml", "mr"].includes(f) || m === "scaleX", p = ["mt", "mb"].includes(f) || m === "scaleY", M = ["tl", "tr", "bl", "br"].includes(f) || m === "scale";
4037
+ if (!b && !p && !M) return;
4038
+ const S = Math.abs((st = (et = n.scaleX) != null ? et : o.scaleX) != null ? st : 1) || 1, O = Math.abs((ot = (nt = n.scaleY) != null ? nt : o.scaleY) != null ? ot : 1) || 1, T = Math.max(1, u * S), y = Math.max(1, c * O), A = (it = (at = o.originX) != null ? at : n.originX) != null ? it : "left", N = g + u, I = g + u / 2, v = (rt = n.width) != null ? rt : u, w = Math.abs(T - v) > Et, L = Math.abs(y - ((ct = n.fontSize) != null ? ct : c)) > Et;
4039
+ if (!w && !L) {
3999
4040
  n.set({ scaleX: 1, scaleY: 1 }), o.scaleX = 1, o.scaleY = 1;
4000
4041
  return;
4001
4042
  }
4002
4043
  n.set({
4003
- width: v,
4004
- fontSize: M || p ? A : c,
4044
+ width: T,
4045
+ fontSize: M || p ? y : c,
4005
4046
  scaleX: 1,
4006
4047
  scaleY: 1
4007
4048
  });
4008
- const x = (dt = n.width) != null ? dt : v, Y = Math.abs(x - b) > wt;
4009
- let _ = g;
4010
- Y && (y || M) && (j === "right" ? _ = L - x : j === "center" && (_ = w - x / 2)), n.set({ left: _ }), a.baseLeft = _, o.scaleX = 1, o.scaleY = 1;
4049
+ const _ = (dt = n.width) != null ? dt : T, Y = Math.abs(_ - v) > Et;
4050
+ let B = g;
4051
+ Y && (b || M) && (A === "right" ? B = N - _ : A === "center" && (B = I - _ / 2)), n.set({ left: B }), a.baseLeft = B, o.scaleX = 1, o.scaleY = 1;
4011
4052
  const { original: R } = o;
4012
- R && (R.scaleX = 1, R.scaleY = 1, R.width = x, R.height = n.height, R.left = _), n.setCoords(), this.canvas.requestRenderAll(), a.baseWidth = x, a.baseFontSize = (lt = n.fontSize) != null ? lt : A, a.hasWidthChange = Y || k;
4013
- }, this.handleObjectModified = (s) => {
4053
+ R && (R.scaleX = 1, R.scaleY = 1, R.width = _, R.height = n.height, R.left = B), n.setCoords(), this.canvas.requestRenderAll(), a.baseWidth = _, a.baseFontSize = (lt = n.fontSize) != null ? lt : y, a.hasWidthChange = Y || L;
4054
+ }, this._handleObjectModified = (s) => {
4014
4055
  var r, c, d;
4015
4056
  const { target: n } = s;
4016
- if (!B._isTextbox(n)) return;
4057
+ if (!k._isTextbox(n)) return;
4017
4058
  const o = this.scalingState.get(n);
4018
4059
  if (this.scalingState.delete(n), !(o != null && o.hasWidthChange)) return;
4019
4060
  const a = (r = n.width) != null ? r : n.calcTextWidth(), i = (d = (c = n.fontSize) != null ? c : o == null ? void 0 : o.baseFontSize) != null ? d : 16;
4020
- this.updateText(n, { width: a, fontSize: i }), n.set({ scaleX: 1, scaleY: 1 }), n.setCoords();
4021
- }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this._bindEvents();
4022
- }
4023
- /**
4024
- * Уничтожает менеджер и снимает слушатели.
4025
- */
4026
- destroy() {
4027
- this.canvas.off("object:scaling", this.handleObjectScaling), this.canvas.off("object:modified", this.handleObjectModified);
4061
+ this.updateText({ target: n, style: { width: a, fontSize: i } }), n.set({ scaleX: 1, scaleY: 1 }), n.setCoords();
4062
+ }, this.editor = t, this.canvas = t.canvas, this.fonts = (e = t.options.fonts) != null ? e : [], this.scalingState = /* @__PURE__ */ new WeakMap(), this.isTextEditingActive = !1, this._bindEvents();
4028
4063
  }
4029
4064
  /**
4030
4065
  * Добавляет новый текстовый объект на канвас.
4031
4066
  * @param options — настройки текста
4032
4067
  * @param flags — флаги поведения
4033
4068
  */
4034
- addText(M = {}, { withoutSelection: y, withoutAdding: p } = {}) {
4035
- var S = M, {
4036
- id: t = `text-${N()}`,
4069
+ addText(S = {}, { withoutSelection: b = !1, withoutSave: p = !1, withoutAdding: M = !1 } = {}) {
4070
+ var O = S, {
4071
+ id: t = `text-${x()}`,
4037
4072
  text: e = "Новый текст",
4038
4073
  fontFamily: s,
4039
4074
  fontSize: n = 48,
@@ -4043,11 +4078,11 @@ class B {
4043
4078
  uppercase: r = !1,
4044
4079
  strikethrough: c = !1,
4045
4080
  align: d = "left",
4046
- color: h = "#000000",
4081
+ color: l = "#000000",
4047
4082
  strokeColor: u,
4048
4083
  strokeWidth: g = 0,
4049
4084
  opacity: f = 1
4050
- } = S, m = X(S, [
4085
+ } = O, m = X(O, [
4051
4086
  "id",
4052
4087
  "text",
4053
4088
  "fontFamily",
@@ -4064,12 +4099,14 @@ class B {
4064
4099
  "opacity"
4065
4100
  ]);
4066
4101
  var w;
4067
- const E = s != null ? s : this._getDefaultFontFamily(), v = B._resolveStrokeWidth(g), A = B._resolveStrokeColor(
4102
+ const { historyManager: T } = this.editor;
4103
+ T.suspendHistory();
4104
+ const y = s != null ? s : this._getDefaultFontFamily(), A = k._resolveStrokeWidth(g), N = k._resolveStrokeColor(
4068
4105
  u,
4069
- v
4070
- ), j = new gt(e, D({
4106
+ A
4107
+ ), I = new gt(e, E({
4071
4108
  id: t,
4072
- fontFamily: E,
4109
+ fontFamily: y,
4073
4110
  fontSize: n,
4074
4111
  fontWeight: o ? "bold" : "normal",
4075
4112
  fontStyle: a ? "italic" : "normal",
@@ -4077,21 +4114,21 @@ class B {
4077
4114
  uppercase: r,
4078
4115
  linethrough: c,
4079
4116
  textAlign: d,
4080
- fill: h,
4081
- stroke: A,
4082
- strokeWidth: v,
4117
+ fill: l,
4118
+ stroke: N,
4119
+ strokeWidth: A,
4083
4120
  strokeUniform: !0,
4084
4121
  opacity: f
4085
4122
  }, m));
4086
- if (j.textCaseRaw = (w = j.text) != null ? w : "", r) {
4087
- const b = B._toUpperCase(j.textCaseRaw);
4088
- b !== j.text && j.set({ text: b });
4123
+ if (I.textCaseRaw = (w = I.text) != null ? w : "", r) {
4124
+ const L = k._toUpperCase(I.textCaseRaw);
4125
+ L !== I.text && I.set({ text: L });
4089
4126
  }
4090
- m.left === void 0 && m.top === void 0 && this.canvas.centerObject(j), p || this.canvas.add(j), y || this.canvas.setActiveObject(j), this.canvas.requestRenderAll();
4091
- const L = D({
4127
+ m.left === void 0 && m.top === void 0 && this.canvas.centerObject(I), M || this.canvas.add(I), b || this.canvas.setActiveObject(I), this.canvas.requestRenderAll(), T.resumeHistory(), p || T.saveState();
4128
+ const v = E({
4092
4129
  id: t,
4093
4130
  text: e,
4094
- fontFamily: E,
4131
+ fontFamily: y,
4095
4132
  fontSize: n,
4096
4133
  bold: o,
4097
4134
  italic: a,
@@ -4099,68 +4136,73 @@ class B {
4099
4136
  uppercase: r,
4100
4137
  strikethrough: c,
4101
4138
  align: d,
4102
- color: h,
4103
- strokeColor: A,
4104
- strokeWidth: v,
4139
+ color: l,
4140
+ strokeColor: N,
4141
+ strokeWidth: A,
4105
4142
  opacity: f
4106
4143
  }, m);
4107
4144
  return this.canvas.fire("editor:text-added", {
4108
- textbox: j,
4109
- options: L,
4145
+ textbox: I,
4146
+ options: v,
4110
4147
  flags: {
4111
- withoutSelection: !!y,
4112
- withoutAdding: !!p
4148
+ withoutSelection: !!b,
4149
+ withoutSave: !!p,
4150
+ withoutAdding: !!M
4113
4151
  }
4114
- }), j;
4152
+ }), I;
4115
4153
  }
4116
4154
  /**
4117
4155
  * Обновляет текстовый объект.
4118
- * @param target — объект, его id или активный объект (если не передан)
4119
- * @param style — стиль, который нужно применить
4120
4156
  * @param options — настройки обновления
4157
+ * @param options.target — объект, его id или активный объект (если не передан)
4158
+ * @param options.style — стиль, который нужно применить
4159
+ * @param options.withoutSave — не сохранять состояние в историю
4160
+ * @param options.skipRender — не вызывать перерисовку канваса
4121
4161
  */
4122
- updateText(t, e = {}, { withoutSave: s, skipRender: n } = {}) {
4123
- var x, Y, _, R, Z, G, W, tt, et, st, nt, ot, at, it, rt, ct, dt, lt, Ut, Yt, Ft, Ht, Zt, Wt, Pt, Vt, Gt, Xt, Kt, $t, Qt, Jt, qt, te, ee, se, ne, oe, ae, ie, re, ce;
4162
+ updateText({ target: t, style: e = {}, withoutSave: s, skipRender: n } = {}) {
4163
+ var Y, B, R, Z, G, W, tt, et, st, nt, ot, at, it, rt, ct, dt, lt, zt, Yt, Ht, Zt, Wt, Pt, Vt, Gt, Xt, Kt, $t, Qt, Jt, qt, te, ee, se, ne, oe, ae, ie, re, ce, de, le;
4124
4164
  const o = this._resolveTextObject(t);
4125
4165
  if (!o) return null;
4126
- const a = {
4166
+ const { historyManager: a } = this.editor;
4167
+ a.suspendHistory();
4168
+ const i = {
4127
4169
  id: o.id,
4128
- text: (x = o.text) != null ? x : void 0,
4129
- textCaseRaw: (Y = o.textCaseRaw) != null ? Y : void 0,
4170
+ text: (Y = o.text) != null ? Y : void 0,
4171
+ textCaseRaw: (B = o.textCaseRaw) != null ? B : void 0,
4130
4172
  uppercase: !!o.uppercase,
4131
- fontFamily: (_ = o.fontFamily) != null ? _ : void 0,
4132
- fontSize: (R = o.fontSize) != null ? R : void 0,
4133
- fontWeight: (Z = o.fontWeight) != null ? Z : void 0,
4134
- fontStyle: (G = o.fontStyle) != null ? G : void 0,
4135
- underline: (W = o.underline) != null ? W : void 0,
4136
- linethrough: (tt = o.linethrough) != null ? tt : void 0,
4173
+ fontFamily: (R = o.fontFamily) != null ? R : void 0,
4174
+ fontSize: (Z = o.fontSize) != null ? Z : void 0,
4175
+ fontWeight: (G = o.fontWeight) != null ? G : void 0,
4176
+ fontStyle: (W = o.fontStyle) != null ? W : void 0,
4177
+ underline: (tt = o.underline) != null ? tt : void 0,
4178
+ linethrough: (et = o.linethrough) != null ? et : void 0,
4137
4179
  textAlign: o.textAlign,
4138
- fill: (et = o.fill) != null ? et : void 0,
4139
- stroke: (st = o.stroke) != null ? st : void 0,
4140
- strokeWidth: (nt = o.strokeWidth) != null ? nt : void 0,
4141
- opacity: (ot = o.opacity) != null ? ot : void 0,
4142
- left: (at = o.left) != null ? at : void 0,
4143
- top: (it = o.top) != null ? it : void 0,
4144
- width: (rt = o.width) != null ? rt : void 0,
4145
- height: (ct = o.height) != null ? ct : void 0,
4146
- angle: (dt = o.angle) != null ? dt : void 0,
4147
- scaleX: (lt = o.scaleX) != null ? lt : void 0,
4148
- scaleY: (Ut = o.scaleY) != null ? Ut : void 0
4149
- }, zt = e, {
4150
- text: i,
4151
- fontFamily: r,
4152
- fontSize: c,
4153
- bold: d,
4154
- italic: h,
4155
- underline: u,
4156
- uppercase: g,
4157
- strikethrough: f,
4158
- align: m,
4159
- color: y,
4160
- strokeColor: p,
4161
- strokeWidth: M,
4162
- opacity: S
4163
- } = zt, E = X(zt, [
4180
+ fill: (st = o.fill) != null ? st : void 0,
4181
+ stroke: (nt = o.stroke) != null ? nt : void 0,
4182
+ strokeWidth: (ot = o.strokeWidth) != null ? ot : void 0,
4183
+ opacity: (at = o.opacity) != null ? at : void 0,
4184
+ left: (it = o.left) != null ? it : void 0,
4185
+ top: (rt = o.top) != null ? rt : void 0,
4186
+ width: (ct = o.width) != null ? ct : void 0,
4187
+ height: (dt = o.height) != null ? dt : void 0,
4188
+ angle: (lt = o.angle) != null ? lt : void 0,
4189
+ scaleX: (zt = o.scaleX) != null ? zt : void 0,
4190
+ scaleY: (Yt = o.scaleY) != null ? Yt : void 0
4191
+ }, Ft = e, {
4192
+ text: r,
4193
+ fontFamily: c,
4194
+ fontSize: d,
4195
+ bold: l,
4196
+ italic: u,
4197
+ underline: g,
4198
+ uppercase: f,
4199
+ strikethrough: m,
4200
+ align: b,
4201
+ color: p,
4202
+ strokeColor: M,
4203
+ strokeWidth: S,
4204
+ opacity: O
4205
+ } = Ft, T = X(Ft, [
4164
4206
  "text",
4165
4207
  "fontFamily",
4166
4208
  "fontSize",
@@ -4174,41 +4216,41 @@ class B {
4174
4216
  "strokeColor",
4175
4217
  "strokeWidth",
4176
4218
  "opacity"
4177
- ]), v = D({}, E);
4178
- if (r !== void 0 && (v.fontFamily = r), c !== void 0 && (v.fontSize = c), d !== void 0 && (v.fontWeight = d ? "bold" : "normal"), h !== void 0 && (v.fontStyle = h ? "italic" : "normal"), u !== void 0 && (v.underline = u), f !== void 0 && (v.linethrough = f), m !== void 0 && (v.textAlign = m), y !== void 0 && (v.fill = y), p !== void 0 || M !== void 0) {
4179
- const St = (Yt = M != null ? M : o.strokeWidth) != null ? Yt : 0, de = B._resolveStrokeWidth(St), Se = (Ft = p != null ? p : o.stroke) != null ? Ft : void 0;
4180
- v.stroke = B._resolveStrokeColor(Se, de), v.strokeWidth = de;
4219
+ ]), y = E({}, T);
4220
+ if (c !== void 0 && (y.fontFamily = c), d !== void 0 && (y.fontSize = d), l !== void 0 && (y.fontWeight = l ? "bold" : "normal"), u !== void 0 && (y.fontStyle = u ? "italic" : "normal"), g !== void 0 && (y.underline = g), m !== void 0 && (y.linethrough = m), b !== void 0 && (y.textAlign = b), p !== void 0 && (y.fill = p), M !== void 0 || S !== void 0) {
4221
+ const wt = (Ht = S != null ? S : o.strokeWidth) != null ? Ht : 0, he = k._resolveStrokeWidth(wt), Ee = (Zt = M != null ? M : o.stroke) != null ? Zt : void 0;
4222
+ y.stroke = k._resolveStrokeColor(Ee, he), y.strokeWidth = he;
4181
4223
  }
4182
- S !== void 0 && (v.opacity = S);
4183
- const A = (Zt = o.textCaseRaw) != null ? Zt : (Ht = o.text) != null ? Ht : "", j = !!o.uppercase, L = i !== void 0, w = L ? i != null ? i : "" : A, b = g != null ? g : j;
4184
- if (L || b !== j) {
4185
- const St = b ? B._toUpperCase(w) : w;
4186
- v.text = St, o.textCaseRaw = w;
4224
+ O !== void 0 && (y.opacity = O);
4225
+ const A = (Pt = o.textCaseRaw) != null ? Pt : (Wt = o.text) != null ? Wt : "", N = !!o.uppercase, I = r !== void 0, v = I ? r != null ? r : "" : A, w = f != null ? f : N;
4226
+ if (I || w !== N) {
4227
+ const wt = w ? k._toUpperCase(v) : v;
4228
+ y.text = wt, o.textCaseRaw = v;
4187
4229
  } else o.textCaseRaw === void 0 && (o.textCaseRaw = A);
4188
- o.uppercase = b, o.set(v), o.setCoords(), n || this.canvas.requestRenderAll(), s || this.editor.historyManager.saveState();
4189
- const k = {
4230
+ o.uppercase = w, o.set(y), o.setCoords(), n || this.canvas.requestRenderAll(), a.resumeHistory(), s || a.saveState();
4231
+ const _ = {
4190
4232
  id: o.id,
4191
- text: (Wt = o.text) != null ? Wt : void 0,
4192
- textCaseRaw: (Pt = o.textCaseRaw) != null ? Pt : void 0,
4233
+ text: (Vt = o.text) != null ? Vt : void 0,
4234
+ textCaseRaw: (Gt = o.textCaseRaw) != null ? Gt : void 0,
4193
4235
  uppercase: !!o.uppercase,
4194
- fontFamily: (Vt = o.fontFamily) != null ? Vt : void 0,
4195
- fontSize: (Gt = o.fontSize) != null ? Gt : void 0,
4196
- fontWeight: (Xt = o.fontWeight) != null ? Xt : void 0,
4197
- fontStyle: (Kt = o.fontStyle) != null ? Kt : void 0,
4198
- underline: ($t = o.underline) != null ? $t : void 0,
4199
- linethrough: (Qt = o.linethrough) != null ? Qt : void 0,
4236
+ fontFamily: (Xt = o.fontFamily) != null ? Xt : void 0,
4237
+ fontSize: (Kt = o.fontSize) != null ? Kt : void 0,
4238
+ fontWeight: ($t = o.fontWeight) != null ? $t : void 0,
4239
+ fontStyle: (Qt = o.fontStyle) != null ? Qt : void 0,
4240
+ underline: (Jt = o.underline) != null ? Jt : void 0,
4241
+ linethrough: (qt = o.linethrough) != null ? qt : void 0,
4200
4242
  textAlign: o.textAlign,
4201
- fill: (Jt = o.fill) != null ? Jt : void 0,
4202
- stroke: (qt = o.stroke) != null ? qt : void 0,
4203
- strokeWidth: (te = o.strokeWidth) != null ? te : void 0,
4204
- opacity: (ee = o.opacity) != null ? ee : void 0,
4205
- left: (se = o.left) != null ? se : void 0,
4206
- top: (ne = o.top) != null ? ne : void 0,
4207
- width: (oe = o.width) != null ? oe : void 0,
4208
- height: (ae = o.height) != null ? ae : void 0,
4209
- angle: (ie = o.angle) != null ? ie : void 0,
4210
- scaleX: (re = o.scaleX) != null ? re : void 0,
4211
- scaleY: (ce = o.scaleY) != null ? ce : void 0
4243
+ fill: (te = o.fill) != null ? te : void 0,
4244
+ stroke: (ee = o.stroke) != null ? ee : void 0,
4245
+ strokeWidth: (se = o.strokeWidth) != null ? se : void 0,
4246
+ opacity: (ne = o.opacity) != null ? ne : void 0,
4247
+ left: (oe = o.left) != null ? oe : void 0,
4248
+ top: (ae = o.top) != null ? ae : void 0,
4249
+ width: (ie = o.width) != null ? ie : void 0,
4250
+ height: (re = o.height) != null ? re : void 0,
4251
+ angle: (ce = o.angle) != null ? ce : void 0,
4252
+ scaleX: (de = o.scaleX) != null ? de : void 0,
4253
+ scaleY: (le = o.scaleY) != null ? le : void 0
4212
4254
  };
4213
4255
  return this.canvas.fire("editor:text-updated", {
4214
4256
  textbox: o,
@@ -4218,11 +4260,17 @@ class B {
4218
4260
  withoutSave: !!s,
4219
4261
  skipRender: !!n
4220
4262
  },
4221
- updates: v,
4222
- before: a,
4223
- after: k
4263
+ updates: y,
4264
+ before: i,
4265
+ after: _
4224
4266
  }), o;
4225
4267
  }
4268
+ /**
4269
+ * Уничтожает менеджер и снимает слушатели.
4270
+ */
4271
+ destroy() {
4272
+ this.canvas.off("object:scaling", this._handleObjectScaling), this.canvas.off("object:modified", this._handleObjectModified), this.canvas.off("text:editing:exited", this._handleTextEditingExited), this.canvas.off("text:editing:entered", this._handleTextEditingEntered), this.canvas.off("text:changed", this._handleTextChanged);
4273
+ }
4226
4274
  /**
4227
4275
  * Возвращает активный текст или ищет по id.
4228
4276
  */
@@ -4230,10 +4278,10 @@ class B {
4230
4278
  if (t instanceof gt) return t;
4231
4279
  if (!t) {
4232
4280
  const e = this.canvas.getActiveObject();
4233
- return B._isTextbox(e) ? e : null;
4281
+ return k._isTextbox(e) ? e : null;
4234
4282
  }
4235
4283
  if (typeof t == "string") {
4236
- const e = this.canvas.getObjects().find((s) => B._isTextbox(s) && s.id === t);
4284
+ const e = this.canvas.getObjects().find((s) => k._isTextbox(s) && s.id === t);
4237
4285
  return e != null ? e : null;
4238
4286
  }
4239
4287
  return null;
@@ -4242,7 +4290,7 @@ class B {
4242
4290
  return !!t && t instanceof gt;
4243
4291
  }
4244
4292
  _bindEvents() {
4245
- this.canvas.on("object:scaling", this.handleObjectScaling), this.canvas.on("object:modified", this.handleObjectModified);
4293
+ this.canvas.on("object:scaling", this._handleObjectScaling), this.canvas.on("object:modified", this._handleObjectModified), this.canvas.on("text:editing:entered", this._handleTextEditingEntered), this.canvas.on("text:editing:exited", this._handleTextEditingExited), this.canvas.on("text:changed", this._handleTextChanged);
4246
4294
  }
4247
4295
  _ensureScalingState(t) {
4248
4296
  var s, n, o;
@@ -4273,14 +4321,14 @@ class B {
4273
4321
  return (e = (t = this.fonts[0]) == null ? void 0 : t.family) != null ? e : "Arial";
4274
4322
  }
4275
4323
  }
4276
- class Rt {
4324
+ class Ut {
4277
4325
  /**
4278
4326
  * Конструктор класса ImageEditor.
4279
4327
  * @param canvasId - идентификатор канваса, в котором будет создан редактор
4280
4328
  * @param options - опции и настройки редактора
4281
4329
  */
4282
4330
  constructor(t, e) {
4283
- this.options = e, this.containerId = t, this.editorId = `${t}-${N()}`, this.clipboard = null, this.init();
4331
+ this.options = e, this.containerId = t, this.editorId = `${t}-${x()}`, this.clipboard = null, this.init();
4284
4332
  }
4285
4333
  /**
4286
4334
  * Инициализация редактора.
@@ -4301,9 +4349,9 @@ class Rt {
4301
4349
  initialStateJSON: r,
4302
4350
  scaleType: c,
4303
4351
  showRotationAngle: d,
4304
- _onReadyCallback: h
4352
+ _onReadyCallback: l
4305
4353
  } = this.options;
4306
- if (vt.apply(), this.canvas = new ke(this.containerId, this.options), this.moduleLoader = new Ue(), this.workerManager = new Ye(), this.errorManager = new Ct({ editor: this }), this.historyManager = new jt({ editor: this }), this.toolbar = new ss({ editor: this }), this.transformManager = new us({ editor: this }), this.zoomManager = new gs({ editor: this }), this.canvasManager = new hs({ editor: this }), this.imageManager = new H({ editor: this }), this.layerManager = new It({ editor: this }), this.shapeManager = new ms({ editor: this }), this.interactionBlocker = new fs({ editor: this }), this.backgroundManager = new Q({ editor: this }), this.clipboardManager = new ps({ editor: this }), this.objectLockManager = new At({ editor: this }), this.groupingManager = new Ms({ editor: this }), this.selectionManager = new ys({ editor: this }), this.deletionManager = new _t({ editor: this }), this.panConstraintManager = new vs({ editor: this }), this.fontManager = new Lt((u = this.options.fonts) != null ? u : []), yield this.fontManager.loadFonts(), this.textManager = new B({ editor: this }), d && (this.angleIndicator = new Bt({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new ft({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(a), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), i != null && i.source) {
4354
+ if (jt.apply(), this.canvas = new _e(this.containerId, this.options), this.moduleLoader = new Ye(), this.workerManager = new He(), this.errorManager = new St({ editor: this }), this.historyManager = new It({ editor: this }), this.toolbar = new os({ editor: this }), this.transformManager = new ms({ editor: this }), this.zoomManager = new ps({ editor: this }), this.canvasManager = new fs({ editor: this }), this.imageManager = new H({ editor: this }), this.layerManager = new At({ editor: this }), this.shapeManager = new ys({ editor: this }), this.interactionBlocker = new Ms({ editor: this }), this.backgroundManager = new Q({ editor: this }), this.clipboardManager = new bs({ editor: this }), this.objectLockManager = new Ct({ editor: this }), this.groupingManager = new vs({ editor: this }), this.selectionManager = new js({ editor: this }), this.deletionManager = new Rt({ editor: this }), this.panConstraintManager = new As({ editor: this }), this.fontManager = new Lt((u = this.options.fonts) != null ? u : []), this.textManager = new k({ editor: this }), d && (this.angleIndicator = new Bt({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new ft({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(s), this.canvasManager.setCanvasWrapperHeight(n), this.canvasManager.setCanvasCSSWidth(o), this.canvasManager.setCanvasCSSHeight(a), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), i != null && i.source) {
4307
4355
  const {
4308
4356
  source: g,
4309
4357
  scale: f = `image-${c}`,
@@ -4311,7 +4359,7 @@ class Rt {
4311
4359
  } = i;
4312
4360
  yield this.imageManager.importImage({ source: g, scale: f, withoutSave: m });
4313
4361
  }
4314
- r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof h == "function" && h(this);
4362
+ r && this.historyManager.loadStateFromFullState(r), this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof l == "function" && l(this);
4315
4363
  });
4316
4364
  }
4317
4365
  /**
@@ -4325,7 +4373,7 @@ class Rt {
4325
4373
  this.montageArea = this.shapeManager.addRectangle({
4326
4374
  width: t,
4327
4375
  height: e,
4328
- fill: Rt._createMosaicPattern(),
4376
+ fill: Ut._createMosaicPattern(),
4329
4377
  stroke: null,
4330
4378
  strokeWidth: 0,
4331
4379
  selectable: !1,
@@ -4376,7 +4424,7 @@ class Rt {
4376
4424
  const t = document.createElement("canvas");
4377
4425
  t.width = 20, t.height = 20;
4378
4426
  const e = t.getContext("2d");
4379
- return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new xe({
4427
+ return e.fillStyle = "#ddd", e.fillRect(0, 0, 40, 40), e.fillStyle = "#ccc", e.fillRect(0, 0, 10, 10), e.fillRect(10, 10, 10, 10), new Be({
4380
4428
  source: t,
4381
4429
  repeat: "repeat"
4382
4430
  });
@@ -4408,7 +4456,7 @@ const U = [
4408
4456
  "U+0490-0491",
4409
4457
  "U+04B0-04B1",
4410
4458
  "U+2116"
4411
- ].join(", "), js = [
4459
+ ].join(", "), Cs = [
4412
4460
  {
4413
4461
  family: "Arial",
4414
4462
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -4618,7 +4666,7 @@ const U = [
4618
4666
  unicodeRange: U
4619
4667
  }
4620
4668
  }
4621
- ], Is = {
4669
+ ], Ss = {
4622
4670
  /**
4623
4671
  * Опции редактора
4624
4672
  */
@@ -4710,20 +4758,20 @@ const U = [
4710
4758
  /**
4711
4759
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
4712
4760
  */
4713
- fonts: js
4761
+ fonts: Cs
4714
4762
  };
4715
- function Ds(l, t = {}) {
4716
- const e = D(D({}, Is), t), s = document.getElementById(l);
4763
+ function Ts(h, t = {}) {
4764
+ const e = E(E({}, Ss), t), s = document.getElementById(h);
4717
4765
  if (!s)
4718
- return Promise.reject(new Error(`Контейнер с ID "${l}" не найден.`));
4766
+ return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
4719
4767
  const n = document.createElement("canvas");
4720
- return n.id = `${l}-canvas`, s.appendChild(n), e.editorContainer = s, new Promise((o) => {
4768
+ return n.id = `${h}-canvas`, s.appendChild(n), e.editorContainer = s, new Promise((o) => {
4721
4769
  e._onReadyCallback = o;
4722
- const a = new Rt(n.id, e);
4723
- window[l] = a;
4770
+ const a = new Ut(n.id, e);
4771
+ window[h] = a;
4724
4772
  });
4725
4773
  }
4726
4774
  export {
4727
- Ds as default
4775
+ Ts as default
4728
4776
  };
4729
4777
  //# sourceMappingURL=main.js.map