@anu3ev/fabric-image-editor 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.js +1084 -1047
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1,12 +1,12 @@
1
1
  var Wn = Object.defineProperty, Yn = Object.defineProperties;
2
2
  var Hn = Object.getOwnPropertyDescriptors;
3
- var de = Object.getOwnPropertySymbols;
3
+ var le = Object.getOwnPropertySymbols;
4
4
  var en = Object.prototype.hasOwnProperty, nn = Object.prototype.propertyIsEnumerable;
5
- var Oe = Math.pow, tn = (h, t, e) => t in h ? Wn(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, P = (h, t) => {
5
+ var Ie = Math.pow, tn = (h, t, e) => t in h ? Wn(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, z = (h, t) => {
6
6
  for (var e in t || (t = {}))
7
7
  en.call(t, e) && tn(h, e, t[e]);
8
- if (de)
9
- for (var e of de(t))
8
+ if (le)
9
+ for (var e of le(t))
10
10
  nn.call(t, e) && tn(h, e, t[e]);
11
11
  return h;
12
12
  }, yt = (h, t) => Yn(h, Hn(t));
@@ -14,8 +14,8 @@ var St = (h, t) => {
14
14
  var e = {};
15
15
  for (var n in h)
16
16
  en.call(h, n) && t.indexOf(n) < 0 && (e[n] = h[n]);
17
- if (h != null && de)
18
- for (var n of de(h))
17
+ if (h != null && le)
18
+ for (var n of le(h))
19
19
  t.indexOf(n) < 0 && nn.call(h, n) && (e[n] = h[n]);
20
20
  return e;
21
21
  };
@@ -457,8 +457,8 @@ class is {
457
457
  this.worker.terminate();
458
458
  }
459
459
  }
460
- const wt = 12, os = 2, Re = 8, ke = 20, as = 100, Be = 20, Ne = 8, rs = 100, pe = 32, Ge = 1, cs = "#2B2D33", Ze = "#3D8BF4", Ve = "#FFFFFF";
461
- function he(h, t, e, n, s) {
460
+ const wt = 12, os = 2, Re = 8, ke = 20, as = 100, Be = 20, Ne = 8, rs = 100, ge = 32, Ge = 1, cs = "#2B2D33", Ze = "#3D8BF4", Ve = "#FFFFFF";
461
+ function de(h, t, e, n, s) {
462
462
  const i = wt, o = os;
463
463
  h.save(), h.translate(t, e), h.rotate(bt.degreesToRadians(s.angle)), h.fillStyle = Ve, h.strokeStyle = Ze, h.lineWidth = Ge, h.beginPath(), h.roundRect(-i / 2, -i / 2, i, i, o), h.fill(), h.stroke(), h.restore();
464
464
  }
@@ -473,34 +473,34 @@ function hn(h, t, e, n, s) {
473
473
  const ls = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE4Ljc1IDQuMzc1djMuNzVhLjYyNS42MjUgMCAwIDEtLjYyNS42MjVoLTMuNzVhLjYyNS42MjUgMCAwIDEgMC0xLjI1aDIuMTRsLTIuMDc3LTEuOTAzLS4wMi0uMDE5YTYuMjUgNi4yNSAwIDEgMC0uMTMgOC45NjcuNjI2LjYyNiAwIDAgMSAuODYuOTA5QTcuNDU2IDcuNDU2IDAgMCAxIDEwIDE3LjVoLS4xMDNhNy41IDcuNSAwIDEgMSA1LjM5Ni0xMi44MTJMMTcuNSA2LjcwM1Y0LjM3NWEuNjI1LjYyNSAwIDAgMSAxLjI1IDBaIi8+PC9zdmc+", _n = new Image();
474
474
  _n.src = ls;
475
475
  function ds(h, t, e, n, s) {
476
- const o = pe / 2;
476
+ const o = ge / 2;
477
477
  h.save(), h.translate(t, e), h.rotate(bt.degreesToRadians(s.angle)), h.fillStyle = cs, h.beginPath(), h.arc(0, 0, o, 0, 2 * Math.PI), h.fill(), h.drawImage(_n, -o / 2, -o / 2, o, o), h.restore();
478
478
  }
479
479
  const hs = {
480
480
  // Угловые точки
481
481
  tl: {
482
- render: he,
482
+ render: de,
483
483
  sizeX: wt,
484
484
  sizeY: wt,
485
485
  offsetX: 0,
486
486
  offsetY: 0
487
487
  },
488
488
  tr: {
489
- render: he,
489
+ render: de,
490
490
  sizeX: wt,
491
491
  sizeY: wt,
492
492
  offsetX: 0,
493
493
  offsetY: 0
494
494
  },
495
495
  bl: {
496
- render: he,
496
+ render: de,
497
497
  sizeX: wt,
498
498
  sizeY: wt,
499
499
  offsetX: 0,
500
500
  offsetY: 0
501
501
  },
502
502
  br: {
503
- render: he,
503
+ render: de,
504
504
  sizeX: wt,
505
505
  sizeY: wt,
506
506
  offsetX: 0,
@@ -539,10 +539,10 @@ const hs = {
539
539
  // Специальный «rotate» контрол
540
540
  mtr: {
541
541
  render: ds,
542
- sizeX: pe,
543
- sizeY: pe,
542
+ sizeX: ge,
543
+ sizeY: ge,
544
544
  offsetX: 0,
545
- offsetY: -pe
545
+ offsetY: -ge
546
546
  }
547
547
  };
548
548
  class ut {
@@ -959,11 +959,11 @@ class Ss {
959
959
  _initToolbar() {
960
960
  if (!this.options.showToolbar) return;
961
961
  const t = this.options.toolbar || {};
962
- this.config = yt(P(P({}, qt), t), {
963
- style: P(P({}, qt.style), t.style || {}),
964
- btnStyle: P(P({}, qt.btnStyle), t.btnStyle || {}),
965
- icons: P(P({}, qt.icons), t.icons || {}),
966
- handlers: P(P({}, qt.handlers), t.handlers || {})
962
+ this.config = yt(z(z({}, qt), t), {
963
+ style: z(z({}, qt.style), t.style || {}),
964
+ btnStyle: z(z({}, qt.btnStyle), t.btnStyle || {}),
965
+ icons: z(z({}, qt.icons), t.icons || {}),
966
+ handlers: z(z({}, qt.handlers), t.handlers || {})
967
967
  }), this.currentTarget = null, this.currentLocked = !1, this.isTransforming = !1, this.isTemporarilyHidden = !1, this._onMouseDown = this._handleMouseDown.bind(this), this._onObjectMoving = this._startTransform.bind(this), this._onObjectScaling = this._startTransform.bind(this), this._onObjectRotating = this._startTransform.bind(this), this._onMouseUp = this._endTransform.bind(this), this._onObjectModified = this._endTransform.bind(this), this._onSelectionChange = this._updateToolbar.bind(this), this._onSelectionClear = () => {
968
968
  this.el.style.display = "none";
969
969
  }, this._createDOM(), this._bindEvents();
@@ -1800,7 +1800,7 @@ class $ {
1800
1800
  }
1801
1801
  }
1802
1802
  }
1803
- const As = 0.1, js = 2, gn = 0.1, Is = 90, $t = 16, Qt = 16, zt = 4096, Ft = 4096, pn = "application/image-editor:", ue = [
1803
+ const As = 0.1, js = 2, gn = 0.1, Cs = 90, $t = 16, Qt = 16, zt = 4096, Ft = 4096, pn = "application/image-editor:", he = [
1804
1804
  "format",
1805
1805
  "customData",
1806
1806
  "contentType",
@@ -1818,7 +1818,7 @@ const As = 0.1, js = 2, gn = 0.1, Is = 90, $t = 16, Qt = 16, zt = 4096, Ft = 409
1818
1818
  "radiusBottomRight",
1819
1819
  "radiusBottomLeft",
1820
1820
  "lineFontDefaults"
1821
- ], Cs = 50;
1821
+ ], Is = 50;
1822
1822
  class te {
1823
1823
  constructor({ editor: t }) {
1824
1824
  this.editor = t, this.options = t.options, this._createdBlobUrls = [], this.acceptContentTypes = this.editor.options.acceptContentTypes, this.acceptFormats = this.getAllowedFormatsFromContentTypes();
@@ -1946,7 +1946,7 @@ class te {
1946
1946
  }
1947
1947
  f.suspendHistory();
1948
1948
  try {
1949
- let w, v;
1949
+ let w, S;
1950
1950
  if (e instanceof File)
1951
1951
  w = URL.createObjectURL(e), this._createdBlobUrls.push(w);
1952
1952
  else if (typeof e == "string")
@@ -1971,38 +1971,38 @@ class te {
1971
1971
  }
1972
1972
  }), f.resumeHistory(), null;
1973
1973
  if (g === "svg") {
1974
- const S = yield Gn(w);
1975
- v = bt.groupSVGElements(S.objects, S.options);
1974
+ const M = yield Gn(w);
1975
+ S = bt.groupSVGElements(M.objects, M.options);
1976
1976
  } else
1977
- v = yield Kt.fromURL(w, { crossOrigin: "anonymous" });
1978
- const { width: C, height: O } = v;
1979
- if (v instanceof Kt) {
1980
- const S = v.getElement();
1981
- let A = "";
1982
- if (S instanceof HTMLImageElement ? A = S.src : S instanceof HTMLCanvasElement && (A = S.toDataURL()), O > Ft || C > zt) {
1983
- const M = yield this.resizeImageToBoundaries({
1984
- dataURL: A,
1977
+ S = yield Kt.fromURL(w, { crossOrigin: "anonymous" });
1978
+ const { width: I, height: j } = S;
1979
+ if (S instanceof Kt) {
1980
+ const M = S.getElement();
1981
+ let C = "";
1982
+ if (M instanceof HTMLImageElement ? C = M.src : M instanceof HTMLCanvasElement && (C = M.toDataURL()), j > Ft || I > zt) {
1983
+ const v = yield this.resizeImageToBoundaries({
1984
+ dataURL: C,
1985
1985
  sizeType: "max",
1986
1986
  contentType: m
1987
- }), E = URL.createObjectURL(M);
1988
- this._createdBlobUrls.push(E), v = yield Kt.fromURL(E, { crossOrigin: "anonymous" });
1989
- } else if (O < Qt || C < $t) {
1990
- const M = yield this.resizeImageToBoundaries({
1991
- dataURL: A,
1987
+ }), O = URL.createObjectURL(v);
1988
+ this._createdBlobUrls.push(O), S = yield Kt.fromURL(O, { crossOrigin: "anonymous" });
1989
+ } else if (j < Qt || I < $t) {
1990
+ const v = yield this.resizeImageToBoundaries({
1991
+ dataURL: C,
1992
1992
  sizeType: "min",
1993
1993
  contentType: m
1994
- }), E = URL.createObjectURL(M);
1995
- this._createdBlobUrls.push(E), v = yield Kt.fromURL(E, { crossOrigin: "anonymous" });
1994
+ }), O = URL.createObjectURL(v);
1995
+ this._createdBlobUrls.push(O), S = yield Kt.fromURL(O, { crossOrigin: "anonymous" });
1996
1996
  }
1997
1997
  }
1998
- if (v.set("id", `${v.type}-${et()}`), v.set("format", g), v.set("contentType", m), v.set("customData", c || null), n === "scale-montage")
1999
- this.editor.canvasManager.scaleMontageAreaToImage({ object: v, withoutSave: !0 });
1998
+ if (S.set("id", `${S.type}-${et()}`), S.set("format", g), S.set("contentType", m), S.set("customData", c || null), n === "scale-montage")
1999
+ this.editor.canvasManager.scaleMontageAreaToImage({ object: S, withoutSave: !0 });
2000
2000
  else {
2001
- const { width: S, height: A } = d, M = this.calculateScaleFactor({ imageObject: v, scaleType: n });
2002
- n === "image-contain" && M < 1 ? u.fitObject({ object: v, type: "contain", withoutSave: !0 }) : n === "image-cover" && (C > S || O > A) && u.fitObject({ object: v, type: "cover", withoutSave: !0 });
2001
+ const { width: M, height: C } = d, v = this.calculateScaleFactor({ imageObject: S, scaleType: n });
2002
+ n === "image-contain" && v < 1 ? u.fitObject({ object: S, type: "contain", withoutSave: !0 }) : n === "image-cover" && (I > M || j > C) && u.fitObject({ object: S, type: "cover", withoutSave: !0 });
2003
2003
  }
2004
- const j = {
2005
- image: v,
2004
+ const A = {
2005
+ image: S,
2006
2006
  format: g,
2007
2007
  contentType: m,
2008
2008
  scale: n,
@@ -2014,7 +2014,7 @@ class te {
2014
2014
  withoutAdding: r,
2015
2015
  customData: c
2016
2016
  };
2017
- return r ? (f.resumeHistory(), l.fire("editor:image-imported", j), j) : (l.add(v), l.centerObject(v), a || l.setActiveObject(v), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", j), j);
2017
+ return r ? (f.resumeHistory(), l.fire("editor:image-imported", A), A) : (l.add(S), l.centerObject(S), a || l.setActiveObject(S), l.renderAll(), f.resumeHistory(), s || f.saveState(), l.fire("editor:image-imported", A), A);
2018
2018
  } catch (w) {
2019
2019
  return p.emitError({
2020
2020
  origin: "ImageManager",
@@ -2123,18 +2123,18 @@ class te {
2123
2123
  a.setCoords();
2124
2124
  const { left: f, top: p, width: m, height: g } = a.getBoundingRect(), y = yield o.clone(["id", "format", "locked"]);
2125
2125
  y.enableRetinaScaling = !1, ["image/jpg", "image/jpeg"].includes(d) && (y.backgroundColor = "#ffffff");
2126
- const b = y.getObjects().find((M) => M.id === a.id);
2126
+ const b = y.getObjects().find((v) => v.id === a.id);
2127
2127
  if (b && (b.visible = !1), c != null && c.isBlocked) {
2128
- const M = y.getObjects().find((E) => E.id === c.overlayMask.id);
2129
- M && (M.visible = !1);
2128
+ const v = y.getObjects().find((O) => O.id === c.overlayMask.id);
2129
+ v && (v.visible = !1);
2130
2130
  }
2131
2131
  y.viewportTransform = [1, 0, 0, 1, -f, -p], y.setDimensions({ width: m, height: g }, { backstoreOnly: !0 }), y.renderAll();
2132
- const w = y.getObjects().filter((M) => M.format).every((M) => M.format === "svg");
2132
+ const w = y.getObjects().filter((v) => v.format).every((v) => v.format === "svg");
2133
2133
  if (u === "svg" && w) {
2134
- const M = y.toSVG();
2134
+ const v = y.toSVG();
2135
2135
  y.dispose();
2136
- const I = {
2137
- image: te._exportSVGStringAsFile(M, {
2136
+ const D = {
2137
+ image: te._exportSVGStringAsFile(v, {
2138
2138
  exportAsBase64: s,
2139
2139
  exportAsBlob: i,
2140
2140
  fileName: e
@@ -2143,74 +2143,74 @@ class te {
2143
2143
  contentType: "image/svg+xml",
2144
2144
  fileName: e.replace(/\.[^/.]+$/, ".svg")
2145
2145
  };
2146
- return o.fire("editor:canvas-exported", I), I;
2146
+ return o.fire("editor:canvas-exported", D), D;
2147
2147
  }
2148
- const v = yield new Promise((M, E) => {
2148
+ const S = yield new Promise((v, O) => {
2149
2149
  y.getElement().toBlob(
2150
- (I) => {
2151
- I ? M(I) : E(new Error("Failed to create Blob from canvas"));
2150
+ (D) => {
2151
+ D ? v(D) : O(new Error("Failed to create Blob from canvas"));
2152
2152
  },
2153
2153
  d,
2154
2154
  1
2155
2155
  );
2156
2156
  });
2157
2157
  if (y.dispose(), i) {
2158
- const M = {
2159
- image: v,
2158
+ const v = {
2159
+ image: S,
2160
2160
  format: u,
2161
2161
  contentType: d,
2162
2162
  fileName: e
2163
2163
  };
2164
- return o.fire("editor:canvas-exported", M), M;
2164
+ return o.fire("editor:canvas-exported", v), v;
2165
2165
  }
2166
- const C = yield createImageBitmap(v), O = yield r.post(
2166
+ const I = yield createImageBitmap(S), j = yield r.post(
2167
2167
  "toDataURL",
2168
2168
  {
2169
2169
  contentType: d,
2170
2170
  quality: 1,
2171
- bitmap: C
2171
+ bitmap: I
2172
2172
  },
2173
- [C]
2173
+ [I]
2174
2174
  );
2175
2175
  if (l) {
2176
- const E = m * 0.264583, I = g * 0.264583, z = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, F = new z({
2177
- orientation: E > I ? "landscape" : "portrait",
2176
+ const O = m * 0.264583, D = g * 0.264583, B = (yield this.editor.moduleLoader.loadModule("jspdf")).jsPDF, U = new B({
2177
+ orientation: O > D ? "landscape" : "portrait",
2178
2178
  unit: "mm",
2179
- format: [E, I]
2179
+ format: [O, D]
2180
2180
  });
2181
- if (F.addImage(String(O), "JPG", 0, 0, E, I), s) {
2182
- const R = {
2183
- image: F.output("datauristring"),
2181
+ if (U.addImage(String(j), "JPG", 0, 0, O, D), s) {
2182
+ const _ = {
2183
+ image: U.output("datauristring"),
2184
2184
  format: "pdf",
2185
2185
  contentType: "application/pdf",
2186
2186
  fileName: e
2187
2187
  };
2188
- return o.fire("editor:canvas-exported", R), R;
2188
+ return o.fire("editor:canvas-exported", _), _;
2189
2189
  }
2190
- const U = F.output("blob"), B = {
2191
- image: new File([U], e, { type: "application/pdf" }),
2190
+ const F = U.output("blob"), L = {
2191
+ image: new File([F], e, { type: "application/pdf" }),
2192
2192
  format: "pdf",
2193
2193
  contentType: "application/pdf",
2194
2194
  fileName: e
2195
2195
  };
2196
- return o.fire("editor:canvas-exported", B), B;
2196
+ return o.fire("editor:canvas-exported", L), L;
2197
2197
  }
2198
2198
  if (s) {
2199
- const M = {
2200
- image: O,
2199
+ const v = {
2200
+ image: j,
2201
2201
  format: u,
2202
2202
  contentType: d,
2203
2203
  fileName: e
2204
2204
  };
2205
- return o.fire("editor:canvas-exported", M), M;
2205
+ return o.fire("editor:canvas-exported", v), v;
2206
2206
  }
2207
- const j = u === "svg" && !w ? e.replace(/\.[^/.]+$/, ".png") : e, A = {
2208
- image: new File([v], j, { type: d }),
2207
+ const A = u === "svg" && !w ? e.replace(/\.[^/.]+$/, ".png") : e, C = {
2208
+ image: new File([S], A, { type: d }),
2209
2209
  format: u,
2210
2210
  contentType: d,
2211
- fileName: j
2211
+ fileName: A
2212
2212
  };
2213
- return o.fire("editor:canvas-exported", A), A;
2213
+ return o.fire("editor:canvas-exported", C), C;
2214
2214
  } catch (l) {
2215
2215
  return this.editor.errorManager.emitError({
2216
2216
  origin: "ImageManager",
@@ -2254,62 +2254,62 @@ class te {
2254
2254
  const { contentType: f, format: p = "" } = c, m = (b = s != null ? s : f) != null ? b : "image/png", g = this.getFormatFromContentType(m) || p || "png", y = n != null ? n : `image.${g}`;
2255
2255
  try {
2256
2256
  if (g === "svg") {
2257
- const j = c.toSVG(), S = te._exportSVGStringAsFile(j, {
2257
+ const A = c.toSVG(), M = te._exportSVGStringAsFile(A, {
2258
2258
  exportAsBase64: i,
2259
2259
  exportAsBlob: o,
2260
2260
  fileName: y
2261
- }), A = {
2261
+ }), C = {
2262
2262
  object: c,
2263
- image: S,
2263
+ image: M,
2264
2264
  format: g,
2265
2265
  contentType: "image/svg+xml",
2266
2266
  fileName: y.replace(/\.[^/.]+$/, ".svg")
2267
2267
  };
2268
- return a.fire("editor:object-exported", A), A;
2268
+ return a.fire("editor:object-exported", C), C;
2269
2269
  }
2270
2270
  if (i && c instanceof Kt) {
2271
- const j = yield createImageBitmap(c.getElement()), S = yield r.post(
2271
+ const A = yield createImageBitmap(c.getElement()), M = yield r.post(
2272
2272
  "toDataURL",
2273
2273
  {
2274
2274
  contentType: m,
2275
2275
  quality: 1,
2276
- bitmap: j
2276
+ bitmap: A
2277
2277
  },
2278
- [j]
2279
- ), A = {
2278
+ [A]
2279
+ ), C = {
2280
2280
  object: c,
2281
- image: S,
2281
+ image: M,
2282
2282
  format: g,
2283
2283
  contentType: m,
2284
2284
  fileName: y
2285
2285
  };
2286
- return a.fire("editor:object-exported", A), A;
2286
+ return a.fire("editor:object-exported", C), C;
2287
2287
  }
2288
2288
  const w = c.toCanvasElement({
2289
2289
  enableRetinaScaling: !1
2290
- }), v = yield new Promise((j, S) => {
2291
- w.toBlob((A) => {
2292
- A ? j(A) : S(new Error("Failed to create Blob from canvas"));
2290
+ }), S = yield new Promise((A, M) => {
2291
+ w.toBlob((C) => {
2292
+ C ? A(C) : M(new Error("Failed to create Blob from canvas"));
2293
2293
  });
2294
2294
  });
2295
2295
  if (o) {
2296
- const j = {
2296
+ const A = {
2297
2297
  object: c,
2298
- image: v,
2298
+ image: S,
2299
2299
  format: g,
2300
2300
  contentType: m,
2301
2301
  fileName: y
2302
2302
  };
2303
- return a.fire("editor:object-exported", j), j;
2303
+ return a.fire("editor:object-exported", A), A;
2304
2304
  }
2305
- const C = new File([v], y, { type: m }), O = {
2305
+ const I = new File([S], y, { type: m }), j = {
2306
2306
  object: c,
2307
- image: C,
2307
+ image: I,
2308
2308
  format: g,
2309
2309
  contentType: m,
2310
2310
  fileName: y
2311
2311
  };
2312
- return a.fire("editor:object-exported", O), O;
2312
+ return a.fire("editor:object-exported", j), j;
2313
2313
  } catch (w) {
2314
2314
  return this.editor.errorManager.emitError({
2315
2315
  origin: "ImageManager",
@@ -2443,7 +2443,7 @@ class te {
2443
2443
  return e ? e[1] : "";
2444
2444
  }
2445
2445
  }
2446
- const It = (h, t, e) => Math.max(Math.min(h, e), t), mn = (h, t) => h * t, Os = (h, t) => new ct(h / 2, t / 2);
2446
+ const Ct = (h, t, e) => Math.max(Math.min(h, e), t), mn = (h, t) => h * t, Os = (h, t) => new ct(h / 2, t / 2);
2447
2447
  function Es(h) {
2448
2448
  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";
2449
2449
  }
@@ -2467,11 +2467,11 @@ class Ts {
2467
2467
  * Если точка находится за пределами монтажной области, она проецируется на ближайшую границу монтажной области.
2468
2468
  */
2469
2469
  getVisibleCenterPoint() {
2470
- const { canvas: t, montageArea: e } = this.editor, n = t.getZoom(), s = t.viewportTransform, i = t.getWidth(), o = t.getHeight(), a = (i / 2 - s[4]) / n, r = (o / 2 - s[5]) / n, c = e.width / 2, l = e.height / 2, d = It(
2470
+ const { canvas: t, montageArea: e } = this.editor, n = t.getZoom(), s = t.viewportTransform, i = t.getWidth(), o = t.getHeight(), a = (i / 2 - s[4]) / n, r = (o / 2 - s[5]) / n, c = e.width / 2, l = e.height / 2, d = Ct(
2471
2471
  a,
2472
2472
  e.left - c,
2473
2473
  e.left + c
2474
- ), u = It(
2474
+ ), u = Ct(
2475
2475
  r,
2476
2476
  e.top - l,
2477
2477
  e.top + l
@@ -2494,7 +2494,7 @@ class Ts {
2494
2494
  canvas: i,
2495
2495
  montageArea: o,
2496
2496
  options: { canvasBackstoreWidth: a }
2497
- } = this.editor, { width: r, height: c } = o, l = It(Number(t), $t, zt);
2497
+ } = this.editor, { width: r, height: c } = o, l = Ct(Number(t), $t, zt);
2498
2498
  if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreWidth(Number(a)) : this.setCanvasBackstoreWidth(l), o.set({ width: l }), (p = i.clipPath) == null || p.set({ width: l }), e) {
2499
2499
  const m = l / r, g = mn(c, m);
2500
2500
  this.setResolutionHeight(g);
@@ -2524,7 +2524,7 @@ class Ts {
2524
2524
  canvas: i,
2525
2525
  montageArea: o,
2526
2526
  options: { canvasBackstoreHeight: a }
2527
- } = this.editor, { width: r, height: c } = o, l = It(Number(t), Qt, Ft);
2527
+ } = this.editor, { width: r, height: c } = o, l = Ct(Number(t), Qt, Ft);
2528
2528
  if (!a || a === "auto" || s ? this.adaptCanvasToContainer() : a ? this.setCanvasBackstoreHeight(Number(a)) : this.setCanvasBackstoreHeight(l), o.set({ height: l }), (p = i.clipPath) == null || p.set({ height: l }), e) {
2529
2529
  const m = l / c, g = mn(r, m);
2530
2530
  this.setResolutionWidth(g);
@@ -2577,7 +2577,7 @@ class Ts {
2577
2577
  */
2578
2578
  setCanvasBackstoreWidth(t) {
2579
2579
  if (!t || typeof t != "number") return;
2580
- const e = It(t, $t, zt);
2580
+ const e = Ct(t, $t, zt);
2581
2581
  this.editor.canvas.setDimensions({ width: e }, { backstoreOnly: !0 });
2582
2582
  }
2583
2583
  /**
@@ -2586,7 +2586,7 @@ class Ts {
2586
2586
  */
2587
2587
  setCanvasBackstoreHeight(t) {
2588
2588
  if (!t || typeof t != "number") return;
2589
- const e = It(t, Qt, Ft);
2589
+ const e = Ct(t, Qt, Ft);
2590
2590
  this.editor.canvas.setDimensions({ height: e }, { backstoreOnly: !0 });
2591
2591
  }
2592
2592
  /**
@@ -2595,7 +2595,7 @@ class Ts {
2595
2595
  * с учётом минимальных и максимальных значений.
2596
2596
  */
2597
2597
  adaptCanvasToContainer() {
2598
- const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, i = It(n, $t, zt), o = It(s, Qt, Ft);
2598
+ const { canvas: t } = this.editor, e = this.getEditorContainer(), n = e.clientWidth, s = e.clientHeight, i = Ct(n, $t, zt), o = Ct(s, Qt, Ft);
2599
2599
  t.setDimensions({ width: i, height: o }, { backstoreOnly: !0 });
2600
2600
  }
2601
2601
  /**
@@ -2855,7 +2855,7 @@ class Ts {
2855
2855
  );
2856
2856
  }
2857
2857
  }
2858
- class _s {
2858
+ class Ds {
2859
2859
  constructor({ editor: t }) {
2860
2860
  this.editor = t, this.options = t.options;
2861
2861
  }
@@ -2866,7 +2866,7 @@ class _s {
2866
2866
  * @param options.withoutSave - Не сохранять состояние
2867
2867
  * @fires editor:object-rotated
2868
2868
  */
2869
- rotate(t = Is, { withoutSave: e } = {}) {
2869
+ rotate(t = Cs, { withoutSave: e } = {}) {
2870
2870
  const { canvas: n, historyManager: s } = this.editor, i = n.getActiveObject();
2871
2871
  if (!i) return;
2872
2872
  const o = i.angle + t;
@@ -3021,7 +3021,7 @@ class _s {
3021
3021
  });
3022
3022
  }
3023
3023
  }
3024
- class Ds {
3024
+ class _s {
3025
3025
  constructor({ editor: t }) {
3026
3026
  this.editor = t, this.options = t.options, this.minZoom = this.options.minZoom || As, this.maxZoom = this.options.maxZoom || js, this.defaultZoom = this._normalizeDefaultZoom(this.options.defaultScale);
3027
3027
  }
@@ -3091,8 +3091,8 @@ class Ds {
3091
3091
  _calculateEmptySpaceRatio(t) {
3092
3092
  const { canvas: e, montageArea: n } = this.editor, s = e.viewportTransform, i = e.getWidth(), o = e.getHeight(), a = n.left - n.width / 2, r = n.left + n.width / 2, c = n.top - n.height / 2, l = n.top + n.height / 2, d = -s[4] / t, u = (-s[4] + i) / t, f = -s[5] / t, p = (-s[5] + o) / t, m = d < a, g = u > r, y = f < c, b = p > l;
3093
3093
  if (!(m || g || y || b)) return 0;
3094
- const v = Math.max(0, a - d), C = Math.max(0, u - r), O = Math.max(0, c - f), j = Math.max(0, p - l), S = Math.max(v, C), A = Math.max(O, j), M = S / i, E = A / o;
3095
- return Math.max(M, E);
3094
+ const S = Math.max(0, a - d), I = Math.max(0, u - r), j = Math.max(0, c - f), A = Math.max(0, p - l), M = Math.max(S, I), C = Math.max(j, A), v = M / i, O = C / o;
3095
+ return Math.max(v, O);
3096
3096
  }
3097
3097
  /**
3098
3098
  * Вычисляет плавный шаг перемещения viewport к центру с ускорением
@@ -3108,8 +3108,8 @@ class Ds {
3108
3108
  const { canvas: o, montageArea: a } = this.editor, r = o.viewportTransform, c = o.getWidth(), l = o.getHeight(), d = t.x - r[4], u = t.y - r[5], f = Math.abs(s), p = e - n;
3109
3109
  if (Math.abs(p) / f <= 0.1)
3110
3110
  return { x: d, y: u };
3111
- const g = c / 2, y = l / 2, b = a.left, w = a.top, v = g - b * n, C = y - w * n, O = (v - r[4]) / (e - n), j = (C - r[5]) / (e - n), S = O * f, A = j * f, M = S * i, E = A * i, I = Math.abs(M) > Math.abs(d) ? d : M, z = Math.abs(E) > Math.abs(u) ? u : E;
3112
- return { x: I, y: z };
3111
+ const g = c / 2, y = l / 2, b = a.left, w = a.top, S = g - b * n, I = y - w * n, j = (S - r[4]) / (e - n), A = (I - r[5]) / (e - n), M = j * f, C = A * f, v = M * i, O = C * i, D = Math.abs(v) > Math.abs(d) ? d : v, B = Math.abs(O) > Math.abs(u) ? u : O;
3112
+ return { x: D, y: B };
3113
3113
  }
3114
3114
  /**
3115
3115
  * Применяет плавное центрирование viewport при приближении к defaultZoom.
@@ -3234,7 +3234,7 @@ class Ds {
3234
3234
  }), this.editor.panConstraintManager.updateBounds();
3235
3235
  }
3236
3236
  }
3237
- class Ls {
3237
+ class xs {
3238
3238
  constructor({ editor: t }) {
3239
3239
  this.editor = t, this.isBlocked = !1, this.overlayMask = null, this._createOverlay();
3240
3240
  }
@@ -3653,7 +3653,7 @@ class Ut {
3653
3653
  }) ? !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;
3654
3654
  }
3655
3655
  }
3656
- class be {
3656
+ class ye {
3657
3657
  constructor({ editor: t }) {
3658
3658
  this.editor = t;
3659
3659
  }
@@ -3686,7 +3686,7 @@ class be {
3686
3686
  const { canvas: n, historyManager: s } = this.editor;
3687
3687
  s.suspendHistory();
3688
3688
  const i = t || n.getActiveObject();
3689
- i && (i instanceof q ? be._moveSelectionForward(n, i) : n.bringObjectForward(i), n.renderAll(), s.resumeHistory(), e || s.saveState(), n.fire("editor:object-bring-forward", {
3689
+ i && (i instanceof q ? ye._moveSelectionForward(n, i) : n.bringObjectForward(i), n.renderAll(), s.resumeHistory(), e || s.saveState(), n.fire("editor:object-bring-forward", {
3690
3690
  object: i,
3691
3691
  withoutSave: e
3692
3692
  }));
@@ -3737,7 +3737,7 @@ class be {
3737
3737
  } = this.editor;
3738
3738
  i.suspendHistory();
3739
3739
  const r = t || n.getActiveObject();
3740
- r && (r instanceof q ? be._moveSelectionBackwards(n, r) : n.sendObjectBackwards(r), a && n.sendObjectToBack(a), n.sendObjectToBack(s), o && n.sendObjectToBack(o), n.renderAll(), i.resumeHistory(), e || i.saveState(), n.fire("editor:object-send-backwards", {
3740
+ r && (r instanceof q ? ye._moveSelectionBackwards(n, r) : n.sendObjectBackwards(r), a && n.sendObjectToBack(a), n.sendObjectToBack(s), o && n.sendObjectToBack(o), n.renderAll(), i.resumeHistory(), e || i.saveState(), n.fire("editor:object-send-backwards", {
3741
3741
  object: r,
3742
3742
  withoutSave: e
3743
3743
  }));
@@ -3781,7 +3781,7 @@ class be {
3781
3781
  });
3782
3782
  }
3783
3783
  }
3784
- class xs {
3784
+ class Ls {
3785
3785
  /**
3786
3786
  * Менеджер фигур для редактора.
3787
3787
  * @param options - Опции и настройки менеджера фигур.
@@ -3821,7 +3821,7 @@ class xs {
3821
3821
  "height",
3822
3822
  "fill"
3823
3823
  ]);
3824
- const { canvas: u } = this.editor, f = new Zn(P({
3824
+ const { canvas: u } = this.editor, f = new Zn(z({
3825
3825
  id: t,
3826
3826
  left: e,
3827
3827
  top: n,
@@ -3861,7 +3861,7 @@ class xs {
3861
3861
  "radius",
3862
3862
  "fill"
3863
3863
  ]);
3864
- const { canvas: d } = this.editor, u = new Vn(P({
3864
+ const { canvas: d } = this.editor, u = new Vn(z({
3865
3865
  id: t,
3866
3866
  left: e,
3867
3867
  top: n,
@@ -3903,7 +3903,7 @@ class xs {
3903
3903
  "height",
3904
3904
  "fill"
3905
3905
  ]);
3906
- const { canvas: u } = this.editor, f = new Xn(P({
3906
+ const { canvas: u } = this.editor, f = new Xn(z({
3907
3907
  id: t,
3908
3908
  left: e,
3909
3909
  top: n,
@@ -3945,7 +3945,7 @@ class Rs {
3945
3945
  return G(this, null, function* () {
3946
3946
  const { canvas: e, errorManager: n } = this.editor;
3947
3947
  try {
3948
- const s = yield t.clone(ue);
3948
+ const s = yield t.clone(he);
3949
3949
  this.clipboard = s, e.fire("editor:object-copied", { object: s });
3950
3950
  } catch (s) {
3951
3951
  n.emitError({
@@ -3972,7 +3972,7 @@ class Rs {
3972
3972
  message: "navigator.clipboard не поддерживается в этом браузере или отсутствует HTTPS-соединение."
3973
3973
  }), !1;
3974
3974
  try {
3975
- const n = t.toObject(ue), s = JSON.stringify(n);
3975
+ const n = t.toObject(he), s = JSON.stringify(n);
3976
3976
  return t.type === "image" ? this._copyImageToClipboard(t, s) : this._copyTextToClipboard(s);
3977
3977
  } catch (n) {
3978
3978
  return e.emitError({
@@ -4089,7 +4089,7 @@ class Rs {
4089
4089
  importOptions: e = {}
4090
4090
  }) {
4091
4091
  var r;
4092
- const s = yt(P({
4092
+ const s = yt(z({
4093
4093
  source: t
4094
4094
  }, e), {
4095
4095
  fromClipboard: !0
@@ -4112,7 +4112,7 @@ class Rs {
4112
4112
  const { canvas: e } = this.editor, n = t || e.getActiveObject();
4113
4113
  if (!n || n.locked) return !1;
4114
4114
  try {
4115
- const s = yield n.clone(ue);
4115
+ const s = yield n.clone(he);
4116
4116
  return s instanceof q && s.forEachObject((i) => {
4117
4117
  i.set({
4118
4118
  id: `${i.type}-${et()}`,
@@ -4201,7 +4201,7 @@ class Rs {
4201
4201
  const { canvas: t } = this.editor;
4202
4202
  if (!this.clipboard) return !1;
4203
4203
  try {
4204
- const e = yield this.clipboard.clone(ue);
4204
+ const e = yield this.clipboard.clone(he);
4205
4205
  return t.discardActiveObject(), e instanceof q && e.forEachObject((n) => {
4206
4206
  n.set({
4207
4207
  id: `${n.type}-${et()}`,
@@ -4230,7 +4230,7 @@ class Rs {
4230
4230
  });
4231
4231
  }
4232
4232
  }
4233
- class ve {
4233
+ class be {
4234
4234
  constructor({ editor: t }) {
4235
4235
  this.editor = t;
4236
4236
  }
@@ -4256,7 +4256,7 @@ class ve {
4256
4256
  editable: !1,
4257
4257
  locked: !0
4258
4258
  };
4259
- o.set(a), !e && ve._isGroupOrSelection(o) && o.getObjects().forEach((c) => {
4259
+ o.set(a), !e && be._isGroupOrSelection(o) && o.getObjects().forEach((c) => {
4260
4260
  c.set(a);
4261
4261
  }), o instanceof rt && o.isEditing && o.exitEditing(), s.renderAll(), n || i.saveState(), s.fire("editor:object-locked", {
4262
4262
  object: o,
@@ -4285,7 +4285,7 @@ class ve {
4285
4285
  editable: !0,
4286
4286
  locked: !1
4287
4287
  };
4288
- i.set(o), ve._isGroupOrSelection(i) && i.getObjects().forEach((a) => {
4288
+ i.set(o), be._isGroupOrSelection(i) && i.getObjects().forEach((a) => {
4289
4289
  a.set(o);
4290
4290
  }), n.renderAll(), e || s.saveState(), n.fire("editor:object-unlocked", {
4291
4291
  object: i,
@@ -4752,7 +4752,7 @@ class Ke {
4752
4752
  return s.fire("editor:objects-deleted", c), c;
4753
4753
  }
4754
4754
  }
4755
- const Dt = {
4755
+ const _t = {
4756
4756
  IMAGE_MANAGER: {
4757
4757
  /**
4758
4758
  * Некорректный Content-Type изображения
@@ -4865,7 +4865,7 @@ const Dt = {
4865
4865
  APPLY_FAILED: "TEMPLATE_APPLY_FAILED"
4866
4866
  }
4867
4867
  };
4868
- class ne {
4868
+ class ee {
4869
4869
  constructor({ editor: t }) {
4870
4870
  this._buffer = [], this.editor = t;
4871
4871
  }
@@ -4892,7 +4892,7 @@ class ne {
4892
4892
  * @fires editor:error
4893
4893
  */
4894
4894
  emitError({ origin: t = "ImageEditor", method: e = "Unknown Method", code: n, data: s, message: i }) {
4895
- if (!ne.isValidErrorCode(n)) {
4895
+ if (!ee.isValidErrorCode(n)) {
4896
4896
  console.warn("Неизвестный код ошибки: ", { code: n, origin: t, method: e });
4897
4897
  return;
4898
4898
  }
@@ -4906,7 +4906,7 @@ class ne {
4906
4906
  message: o,
4907
4907
  data: s
4908
4908
  };
4909
- this._buffer.push(P({
4909
+ this._buffer.push(z({
4910
4910
  type: "editor:error"
4911
4911
  }, a)), this.editor.canvas.fire("editor:error", a);
4912
4912
  }
@@ -4921,7 +4921,7 @@ class ne {
4921
4921
  * @fires editor:warning
4922
4922
  */
4923
4923
  emitWarning({ origin: t = "ImageEditor", method: e = "Unknown Method", code: n, message: s, data: i }) {
4924
- if (!ne.isValidErrorCode(n)) {
4924
+ if (!ee.isValidErrorCode(n)) {
4925
4925
  console.warn("Неизвестный код предупреждения: ", { code: n, origin: t, method: e });
4926
4926
  return;
4927
4927
  }
@@ -4934,7 +4934,7 @@ class ne {
4934
4934
  message: o,
4935
4935
  data: i
4936
4936
  };
4937
- this._buffer.push(P({
4937
+ this._buffer.push(z({
4938
4938
  type: "editor:warning"
4939
4939
  }, a)), this.editor.canvas.fire("editor:warning", a);
4940
4940
  }
@@ -4944,7 +4944,7 @@ class ne {
4944
4944
  * @returns true, если код допустим, иначе false
4945
4945
  */
4946
4946
  static isValidErrorCode(t) {
4947
- return t ? Object.values(Dt).some((e) => Object.values(e).includes(t)) : !1;
4947
+ return t ? Object.values(_t).some((e) => Object.values(e).includes(t)) : !1;
4948
4948
  }
4949
4949
  }
4950
4950
  class Bs {
@@ -5049,7 +5049,7 @@ const Ns = ({ textbox: h }) => {
5049
5049
  if (!t) return !1;
5050
5050
  const e = (s = (n = h.text) == null ? void 0 : n.length) != null ? s : 0;
5051
5051
  return e <= 0 ? !1 : t.start <= 0 && t.end >= e;
5052
- }, Ee = ({
5052
+ }, Oe = ({
5053
5053
  textbox: h,
5054
5054
  styles: t,
5055
5055
  range: e
@@ -5071,7 +5071,7 @@ const Ns = ({ textbox: h }) => {
5071
5071
  );
5072
5072
  if (n.length)
5073
5073
  return (s = n[0]) == null ? void 0 : s[e];
5074
- }, Fe = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Ue = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, Te = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", Mt = ({
5074
+ }, Fe = ({ strokeColor: h, width: t }) => t <= 0 ? null : h != null ? h : "#000000", Ue = ({ width: h = 0 }) => h ? Math.max(0, h) : 0, Ee = ({ value: h }) => typeof h == "string" ? h.toLocaleUpperCase() : "", Mt = ({
5075
5075
  value: h,
5076
5076
  min: t,
5077
5077
  max: e
@@ -5100,7 +5100,7 @@ const Ns = ({ textbox: h }) => {
5100
5100
  }
5101
5101
  _getTransformedDimensions(t = {}) {
5102
5102
  const { width: e, height: n } = this._getBackgroundDimensions();
5103
- return super._getTransformedDimensions(yt(P({}, t), {
5103
+ return super._getTransformedDimensions(yt(z({}, t), {
5104
5104
  width: e,
5105
5105
  height: n
5106
5106
  }));
@@ -5110,7 +5110,7 @@ const Ns = ({ textbox: h }) => {
5110
5110
  */
5111
5111
  toObject(t = []) {
5112
5112
  const e = super.toObject(t);
5113
- return yt(P({}, e), {
5113
+ return yt(z({}, e), {
5114
5114
  backgroundOpacity: this.backgroundOpacity,
5115
5115
  lineFontDefaults: this.lineFontDefaults,
5116
5116
  paddingTop: this.paddingTop,
@@ -5163,41 +5163,41 @@ const Ns = ({ textbox: h }) => {
5163
5163
  l += b;
5164
5164
  continue;
5165
5165
  }
5166
- const w = c[g], v = b / i, C = this._getLineLeftOffset(g);
5167
- let O = 0, j = 0, S = this.getValueOfPropertyAt(g, 0, e), A = this._getDecorationColorAt(g, 0), M = this.getValueOfPropertyAt(g, 0, "textDecorationThickness"), E = S, I = A, z = M;
5168
- const F = l + v * (1 - r);
5169
- let U = this.getHeightOfChar(g, 0), D = this.getValueOfPropertyAt(g, 0, "deltaY");
5170
- for (let R = 0, k = w.length; R < k; R += 1) {
5171
- const T = this.__charBounds[g][R];
5172
- E = this.getValueOfPropertyAt(g, R, e), I = this._getDecorationColorAt(g, R), z = this.getValueOfPropertyAt(g, R, "textDecorationThickness");
5173
- const _ = this.getHeightOfChar(g, R), x = this.getValueOfPropertyAt(g, R, "deltaY");
5174
- if (u && E && I) {
5175
- const L = s * z / 1e3;
5176
- t.save(), t.fillStyle = A, t.translate(T.renderLeft, T.renderTop), t.rotate(T.angle), t.fillRect(
5166
+ const w = c[g], S = b / i, I = this._getLineLeftOffset(g);
5167
+ let j = 0, A = 0, M = this.getValueOfPropertyAt(g, 0, e), C = this._getDecorationColorAt(g, 0), v = this.getValueOfPropertyAt(g, 0, "textDecorationThickness"), O = M, D = C, B = v;
5168
+ const U = l + S * (1 - r);
5169
+ let F = this.getHeightOfChar(g, 0), E = this.getValueOfPropertyAt(g, 0, "deltaY");
5170
+ for (let _ = 0, R = w.length; _ < R; _ += 1) {
5171
+ const T = this.__charBounds[g][_];
5172
+ O = this.getValueOfPropertyAt(g, _, e), D = this._getDecorationColorAt(g, _), B = this.getValueOfPropertyAt(g, _, "textDecorationThickness");
5173
+ const x = this.getHeightOfChar(g, _), P = this.getValueOfPropertyAt(g, _, "deltaY");
5174
+ if (u && O && D) {
5175
+ const k = s * B / 1e3;
5176
+ t.save(), t.fillStyle = C, t.translate(T.renderLeft, T.renderTop), t.rotate(T.angle), t.fillRect(
5177
5177
  -T.kernedWidth / 2,
5178
- p * _ + x - m * L,
5178
+ p * x + P - m * k,
5179
5179
  T.kernedWidth,
5180
- L
5180
+ k
5181
5181
  ), t.restore();
5182
- } else if ((E !== S || I !== A || _ !== U || z !== M || x !== D) && j > 0) {
5183
- const L = s * M / 1e3;
5184
- let V = d + C + O;
5185
- n === "rtl" && (V = a - V - j), S && A && M && (t.fillStyle = A, t.fillRect(
5182
+ } else if ((O !== M || D !== C || x !== F || B !== v || P !== E) && A > 0) {
5183
+ const k = s * v / 1e3;
5184
+ let V = d + I + j;
5185
+ n === "rtl" && (V = a - V - A), M && C && v && (t.fillStyle = C, t.fillRect(
5186
5186
  V,
5187
- F + p * U + D - m * L,
5188
- j,
5189
- L
5190
- )), O = T.left, j = T.width, S = E, M = z, A = I, U = _, D = x;
5187
+ U + p * F + E - m * k,
5188
+ A,
5189
+ k
5190
+ )), j = T.left, A = T.width, M = O, v = B, C = D, F = x, E = P;
5191
5191
  } else
5192
- j += T.kernedWidth;
5192
+ A += T.kernedWidth;
5193
5193
  }
5194
- let B = d + C + O;
5195
- n === "rtl" && (B = a - B - j), t.fillStyle = I;
5196
- const N = s * z / 1e3;
5197
- E && I && z && t.fillRect(
5198
- B,
5199
- F + p * U + D - m * N,
5200
- j - f,
5194
+ let L = d + I + j;
5195
+ n === "rtl" && (L = a - L - A), t.fillStyle = D;
5196
+ const N = s * B / 1e3;
5197
+ O && D && B && t.fillRect(
5198
+ L,
5199
+ U + p * F + E - m * N,
5200
+ A - f,
5201
5201
  N
5202
5202
  ), l += b;
5203
5203
  }
@@ -5251,7 +5251,7 @@ const Ns = ({ textbox: h }) => {
5251
5251
  try {
5252
5252
  n = new Kn(t);
5253
5253
  } catch (i) {
5254
- return ne.emitError({
5254
+ return ee.emitError({
5255
5255
  origin: "BackgroundTextbox",
5256
5256
  method: "_getEffectiveBackgroundFill",
5257
5257
  code: "INVALID_COLOR_VALUE",
@@ -5315,10 +5315,10 @@ Wt.type = "background-textbox", Wt.cacheProperties = [
5315
5315
  "radiusBottomRight",
5316
5316
  "radiusBottomLeft"
5317
5317
  ];
5318
- let Se = Wt;
5318
+ let ve = Wt;
5319
5319
  const Fs = () => {
5320
5320
  var h;
5321
- (h = cn) != null && h.setClass && cn.setClass(Se, "background-textbox");
5321
+ (h = cn) != null && h.setClass && cn.setClass(ve, "background-textbox");
5322
5322
  }, it = 0.01, bn = ({
5323
5323
  textbox: h,
5324
5324
  lineIndices: t,
@@ -5337,9 +5337,9 @@ const Fs = () => {
5337
5337
  for (let u = 0; u < t.length; u += 1) {
5338
5338
  const f = t[u];
5339
5339
  if (!Number.isFinite(f)) continue;
5340
- const p = d ? c[f] : r == null ? void 0 : r[f], m = p ? P({}, p) : {};
5340
+ const p = d ? c[f] : r == null ? void 0 : r[f], m = p ? z({}, p) : {};
5341
5341
  let g = !1;
5342
- n !== void 0 && (p == null ? void 0 : p.fontFamily) !== n && (m.fontFamily = n, g = !0), s !== void 0 && (p == null ? void 0 : p.fontSize) !== s && (m.fontSize = s, g = !0), i !== void 0 && (p == null ? void 0 : p.fill) !== i && (m.fill = i, g = !0), o !== void 0 && (o === null && (p == null ? void 0 : p.stroke) !== void 0 && (delete m.stroke, g = !0), o !== null && (p == null ? void 0 : p.stroke) !== o && (m.stroke = o, g = !0)), g && (d || (c = P({}, c), d = !0), c[f] = m, l = !0);
5342
+ n !== void 0 && (p == null ? void 0 : p.fontFamily) !== n && (m.fontFamily = n, g = !0), s !== void 0 && (p == null ? void 0 : p.fontSize) !== s && (m.fontSize = s, g = !0), i !== void 0 && (p == null ? void 0 : p.fill) !== i && (m.fill = i, g = !0), o !== void 0 && (o === null && (p == null ? void 0 : p.stroke) !== void 0 && (delete m.stroke, g = !0), o !== null && (p == null ? void 0 : p.stroke) !== o && (m.stroke = o, g = !0)), g && (d || (c = z({}, c), d = !0), c[f] = m, l = !0);
5343
5343
  }
5344
5344
  return l && (h.lineFontDefaults = c), l;
5345
5345
  }, Us = ({
@@ -5365,16 +5365,16 @@ const Fs = () => {
5365
5365
  for (const f in t) {
5366
5366
  if (!Object.prototype.hasOwnProperty.call(t, f)) continue;
5367
5367
  const p = Number(f);
5368
- Number.isInteger(p) && p >= 0 && p < n || (u || (l = P({}, t), u = !0), l && Object.prototype.hasOwnProperty.call(l, f) && delete l[f], d = !0);
5368
+ Number.isInteger(p) && p >= 0 && p < n || (u || (l = z({}, t), u = !0), l && Object.prototype.hasOwnProperty.call(l, f) && delete l[f], d = !0);
5369
5369
  }
5370
5370
  for (let f = 0; f < n; f += 1) {
5371
5371
  const p = l != null ? l : t, m = p ? p[f] : void 0;
5372
5372
  if (!m) {
5373
- l || (l = {}, u = !0), u || (l = P({}, l), u = !0), l[f] = P({}, c), d = !0;
5373
+ l || (l = {}, u = !0), u || (l = z({}, l), u = !0), l[f] = z({}, c), d = !0;
5374
5374
  continue;
5375
5375
  }
5376
5376
  let g = null;
5377
- s !== void 0 && m.fontFamily === void 0 && (g = P({}, m), g.fontFamily = s), i !== void 0 && m.fontSize === void 0 && (g || (g = P({}, m)), g.fontSize = i), o !== void 0 && m.fill === void 0 && (g || (g = P({}, m)), g.fill = o), a !== void 0 && m.stroke === void 0 && (g || (g = P({}, m)), g.stroke = a), g && (l || (l = {}, u = !0), u || (l = P({}, l), u = !0), l[f] = g, d = !0);
5377
+ s !== void 0 && m.fontFamily === void 0 && (g = z({}, m), g.fontFamily = s), i !== void 0 && m.fontSize === void 0 && (g || (g = z({}, m)), g.fontSize = i), o !== void 0 && m.fill === void 0 && (g || (g = z({}, m)), g.fill = o), a !== void 0 && m.stroke === void 0 && (g || (g = z({}, m)), g.stroke = a), g && (l || (l = {}, u = !0), u || (l = z({}, l), u = !0), l[f] = g, d = !0);
5378
5378
  }
5379
5379
  return {
5380
5380
  lineStyles: l,
@@ -5390,7 +5390,7 @@ const Fs = () => {
5390
5390
  const n = Number(e);
5391
5391
  if (!Number.isFinite(n)) continue;
5392
5392
  const s = h[n];
5393
- s && (t[n] = P({}, s));
5393
+ s && (t[n] = z({}, s));
5394
5394
  }
5395
5395
  return t;
5396
5396
  }, Sn = ({
@@ -5406,7 +5406,7 @@ const Fs = () => {
5406
5406
  if (!Number.isFinite(o)) continue;
5407
5407
  const a = h[o];
5408
5408
  if (!a) continue;
5409
- const r = P({}, a);
5409
+ const r = z({}, a);
5410
5410
  typeof a.fontSize == "number" && (r.fontSize = Math.max(1, a.fontSize * t), s = !0), e[o] = r, n = !0;
5411
5411
  }
5412
5412
  if (!(!n || !s))
@@ -5553,7 +5553,7 @@ const Fs = () => {
5553
5553
  if (s !== void 0 || i !== void 0 || o !== void 0 || a !== void 0 || r !== void 0 || c !== void 0) return !0;
5554
5554
  }
5555
5555
  return !1;
5556
- }, _t = ({
5556
+ }, Dt = ({
5557
5557
  textbox: h
5558
5558
  }) => {
5559
5559
  const { width: t, height: e, calcTextWidth: n, calcTextHeight: s } = h, i = typeof n == "function" ? n.call(h) : void 0, o = typeof s == "function" ? s.call(h) : void 0, a = Mn({
@@ -5586,7 +5586,7 @@ class at {
5586
5586
  if (!at._isTextbox(s) || this.lineDefaultsSyncing.has(s)) return;
5587
5587
  const { text: i = "", uppercase: o, autoExpand: a } = s, r = !!o, c = a !== !1, l = i.toLocaleLowerCase();
5588
5588
  if (r) {
5589
- const f = Te({ value: l });
5589
+ const f = Ee({ value: l });
5590
5590
  f !== i && s.set({ text: f }), s.textCaseRaw = l;
5591
5591
  } else
5592
5592
  s.textCaseRaw = i;
@@ -5594,7 +5594,7 @@ class at {
5594
5594
  let d = !1;
5595
5595
  c && (d = this._autoExpandTextboxWidth(s));
5596
5596
  let u = !1;
5597
- d || (u = _t({ textbox: s })), (d || u) && (s.setCoords(), s.dirty = !0), this._syncLineFontDefaultsOnTextChanged({ textbox: s });
5597
+ d || (u = Dt({ textbox: s })), (d || u) && (s.setCoords(), s.dirty = !0), this._syncLineFontDefaultsOnTextChanged({ textbox: s });
5598
5598
  }, this._handleTextEditingExited = (n) => {
5599
5599
  var c, l, d;
5600
5600
  const { target: s } = n;
@@ -5606,13 +5606,13 @@ class at {
5606
5606
  s.textCaseRaw = u;
5607
5607
  } else
5608
5608
  s.textCaseRaw = i;
5609
- _t({ textbox: s }) && (s.setCoords(), s.dirty = !0, this.canvas.requestRenderAll()), s.locked || s.set({
5609
+ Dt({ textbox: s }) && (s.setCoords(), s.dirty = !0, this.canvas.requestRenderAll()), s.locked || s.set({
5610
5610
  lockMovementX: !1,
5611
5611
  lockMovementY: !1
5612
5612
  });
5613
5613
  const { historyManager: r } = this.editor;
5614
5614
  r.endAction({ reason: "text-edit" }), r.scheduleSaveState({
5615
- delayMs: Cs,
5615
+ delayMs: Is,
5616
5616
  reason: "text-edit"
5617
5617
  });
5618
5618
  }, this._handleObjectResizing = (n) => {
@@ -5629,10 +5629,10 @@ class at {
5629
5629
  s.set({ width: m });
5630
5630
  const { width: g = 0 } = s, y = p - g;
5631
5631
  if (y !== 0 && i && i.corner === "ml") {
5632
- const w = ((l = s.angle) != null ? l : 0) * Math.PI / 180, v = Math.cos(w), C = Math.sin(w), O = (d = s.scaleX) != null ? d : 1, j = y * O;
5632
+ const w = ((l = s.angle) != null ? l : 0) * Math.PI / 180, S = Math.cos(w), I = Math.sin(w), j = (d = s.scaleX) != null ? d : 1, A = y * j;
5633
5633
  s.set({
5634
- left: ((u = s.left) != null ? u : 0) + j * v,
5635
- top: ((f = s.top) != null ? f : 0) + j * C
5634
+ left: ((u = s.left) != null ? u : 0) + A * S,
5635
+ top: ((f = s.top) != null ? f : 0) + A * I
5636
5636
  });
5637
5637
  }
5638
5638
  }
@@ -5643,7 +5643,7 @@ class at {
5643
5643
  event: o != null ? o : null
5644
5644
  });
5645
5645
  }, this._handleObjectScaling = (n) => {
5646
- var ie, je, oe, ae, re, kt, Ie, ce, Ht, Gt, Zt, Vt, Xt;
5646
+ var se, Ae, ie, oe, ae, kt, je, re, Ht, Gt, Zt, Vt, Xt;
5647
5647
  const { target: s, transform: i } = n;
5648
5648
  if (s instanceof q || !at._isTextbox(s) || !i) return;
5649
5649
  s.isScaling = !0;
@@ -5655,61 +5655,61 @@ class at {
5655
5655
  baseRadii: d,
5656
5656
  baseStyles: u,
5657
5657
  baseLineFontDefaults: f
5658
- } = o, p = typeof ((ie = i.original) == null ? void 0 : ie.width) == "number" ? i.original.width : void 0, m = typeof ((je = i.original) == null ? void 0 : je.left) == "number" ? i.original.left : void 0, g = p != null ? p : a, y = m != null ? m : r, b = (oe = i.corner) != null ? oe : "", w = (ae = i.action) != null ? ae : "", v = ["ml", "mr"].includes(b) || w === "scaleX", C = ["mt", "mb"].includes(b) || w === "scaleY", O = ["tl", "tr", "bl", "br"].includes(b) || w === "scale", j = O || C;
5659
- if (!v && !C && !O) return;
5660
- const S = Math.abs((kt = (re = s.scaleX) != null ? re : i.scaleX) != null ? kt : 1) || 1, A = Math.abs((ce = (Ie = s.scaleY) != null ? Ie : i.scaleY) != null ? ce : 1) || 1, M = Math.max(1, g * S), E = Math.max(1, Math.round(M)), I = Math.max(1, c * A), {
5661
- paddingTop: z = 0,
5662
- paddingRight: F = 0,
5663
- paddingBottom: U = 0,
5664
- paddingLeft: D = 0,
5665
- radiusTopLeft: B = 0,
5658
+ } = o, p = typeof ((se = i.original) == null ? void 0 : se.width) == "number" ? i.original.width : void 0, m = typeof ((Ae = i.original) == null ? void 0 : Ae.left) == "number" ? i.original.left : void 0, g = p != null ? p : a, y = m != null ? m : r, b = (ie = i.corner) != null ? ie : "", w = (oe = i.action) != null ? oe : "", S = ["ml", "mr"].includes(b) || w === "scaleX", I = ["mt", "mb"].includes(b) || w === "scaleY", j = ["tl", "tr", "bl", "br"].includes(b) || w === "scale", A = j || I;
5659
+ if (!S && !I && !j) return;
5660
+ const M = Math.abs((kt = (ae = s.scaleX) != null ? ae : i.scaleX) != null ? kt : 1) || 1, C = Math.abs((re = (je = s.scaleY) != null ? je : i.scaleY) != null ? re : 1) || 1, v = Math.max(1, g * M), O = Math.max(1, Math.round(v)), D = Math.max(1, c * C), {
5661
+ paddingTop: B = 0,
5662
+ paddingRight: U = 0,
5663
+ paddingBottom: F = 0,
5664
+ paddingLeft: E = 0,
5665
+ radiusTopLeft: L = 0,
5666
5666
  radiusTopRight: N = 0,
5667
- radiusBottomRight: R = 0,
5668
- radiusBottomLeft: k = 0,
5667
+ radiusBottomRight: _ = 0,
5668
+ radiusBottomLeft: R = 0,
5669
5669
  fontSize: T,
5670
- width: _,
5671
- originX: x = "left"
5672
- } = s, L = O || C, V = O || C, W = L ? {
5673
- top: Math.max(0, l.top * A),
5674
- right: Math.max(0, l.right * A),
5675
- bottom: Math.max(0, l.bottom * A),
5676
- left: Math.max(0, l.left * A)
5670
+ width: x,
5671
+ originX: P = "left"
5672
+ } = s, k = j || I, V = j || I, H = k ? {
5673
+ top: Math.max(0, l.top * C),
5674
+ right: Math.max(0, l.right * C),
5675
+ bottom: Math.max(0, l.bottom * C),
5676
+ left: Math.max(0, l.left * C)
5677
5677
  } : l, J = V ? {
5678
- topLeft: Math.max(0, d.topLeft * A),
5679
- topRight: Math.max(0, d.topRight * A),
5680
- bottomRight: Math.max(0, d.bottomRight * A),
5681
- bottomLeft: Math.max(0, d.bottomLeft * A)
5678
+ topLeft: Math.max(0, d.topLeft * C),
5679
+ topRight: Math.max(0, d.topRight * C),
5680
+ bottomRight: Math.max(0, d.bottomRight * C),
5681
+ bottomLeft: Math.max(0, d.bottomLeft * C)
5682
5682
  } : d, tt = Object.keys(u).length > 0;
5683
5683
  let ot;
5684
- if (j && tt) {
5684
+ if (A && tt) {
5685
5685
  const Bt = {};
5686
- Object.entries(u).forEach(([le, Q]) => {
5686
+ Object.entries(u).forEach(([ce, Q]) => {
5687
5687
  if (!Q) return;
5688
5688
  const st = {};
5689
5689
  Object.entries(Q).forEach(([Ce, Nt]) => {
5690
5690
  if (!Nt) return;
5691
- const Qe = P({}, Nt);
5692
- typeof Nt.fontSize == "number" && (Qe.fontSize = Math.max(1, Nt.fontSize * A)), st[Ce] = Qe;
5693
- }), Object.keys(st).length && (Bt[le] = st);
5691
+ const Qe = z({}, Nt);
5692
+ typeof Nt.fontSize == "number" && (Qe.fontSize = Math.max(1, Nt.fontSize * C)), st[Ce] = Qe;
5693
+ }), Object.keys(st).length && (Bt[ce] = st);
5694
5694
  }), Object.keys(Bt).length && (ot = Bt);
5695
5695
  }
5696
5696
  let pt;
5697
- j && (pt = Sn({
5697
+ A && (pt = Sn({
5698
5698
  lineFontDefaults: f,
5699
- scale: A
5699
+ scale: C
5700
5700
  }));
5701
- const At = (Gt = (Ht = i.originX) != null ? Ht : x) != null ? Gt : "left", dt = y + g, ht = y + g / 2, Et = _ != null ? _ : g, jt = E !== Et, Lt = Math.abs(I - (T != null ? T : c)) > it, xt = Math.abs(W.top - z) > it || Math.abs(W.right - F) > it || Math.abs(W.bottom - U) > it || Math.abs(W.left - D) > it, Rt = Math.abs(J.topLeft - B) > it || Math.abs(J.topRight - N) > it || Math.abs(J.bottomRight - R) > it || Math.abs(J.bottomLeft - k) > it;
5702
- if (!jt && !Lt && !xt && !Rt) {
5701
+ const At = (Gt = (Ht = i.originX) != null ? Ht : P) != null ? Gt : "left", dt = y + g, ht = y + g / 2, Et = x != null ? x : g, jt = O !== Et, xt = Math.abs(D - (T != null ? T : c)) > it, Lt = Math.abs(H.top - B) > it || Math.abs(H.right - U) > it || Math.abs(H.bottom - F) > it || Math.abs(H.left - E) > it, Rt = Math.abs(J.topLeft - L) > it || Math.abs(J.topRight - N) > it || Math.abs(J.bottomRight - _) > it || Math.abs(J.bottomLeft - R) > it;
5702
+ if (!jt && !xt && !Lt && !Rt) {
5703
5703
  s.set({ scaleX: 1, scaleY: 1 }), i.scaleX = 1, i.scaleY = 1;
5704
5704
  return;
5705
5705
  }
5706
5706
  ot && (s.styles = ot), pt && (s.lineFontDefaults = pt), s.set({
5707
- width: E,
5708
- fontSize: j ? I : c,
5709
- paddingTop: W.top,
5710
- paddingRight: W.right,
5711
- paddingBottom: W.bottom,
5712
- paddingLeft: W.left,
5707
+ width: O,
5708
+ fontSize: A ? D : c,
5709
+ paddingTop: H.top,
5710
+ paddingRight: H.right,
5711
+ paddingBottom: H.bottom,
5712
+ paddingLeft: H.left,
5713
5713
  radiusTopLeft: J.topLeft,
5714
5714
  radiusTopRight: J.topRight,
5715
5715
  radiusBottomRight: J.bottomRight,
@@ -5717,89 +5717,89 @@ class at {
5717
5717
  scaleX: 1,
5718
5718
  scaleY: 1
5719
5719
  });
5720
- const Yt = _t({ textbox: s });
5720
+ const Yt = Dt({ textbox: s });
5721
5721
  Yt && (s.dirty = !0);
5722
- const mt = (Zt = s.width) != null ? Zt : E, se = mt !== Et;
5722
+ const mt = (Zt = s.width) != null ? Zt : O, ne = mt !== Et;
5723
5723
  let Tt = y;
5724
- se && (v || O) && (At === "right" ? Tt = dt - mt : At === "center" && (Tt = ht - mt / 2)), s.set({ left: Tt }), o.baseLeft = Tt, i.scaleX = 1, i.scaleY = 1;
5724
+ ne && (S || j) && (At === "right" ? Tt = dt - mt : At === "center" && (Tt = ht - mt / 2)), s.set({ left: Tt }), o.baseLeft = Tt, i.scaleX = 1, i.scaleY = 1;
5725
5725
  const { original: vt } = i;
5726
- vt && (vt.scaleX = 1, vt.scaleY = 1, vt.width = mt, vt.height = s.height, vt.left = Tt), s.setCoords(), this.canvas.requestRenderAll(), o.baseWidth = mt, o.baseFontSize = (Vt = s.fontSize) != null ? Vt : I, o.baseStyles = JSON.parse(JSON.stringify((Xt = s.styles) != null ? Xt : {})), o.baseLineFontDefaults = vn({
5726
+ vt && (vt.scaleX = 1, vt.scaleY = 1, vt.width = mt, vt.height = s.height, vt.left = Tt), s.setCoords(), this.canvas.requestRenderAll(), o.baseWidth = mt, o.baseFontSize = (Vt = s.fontSize) != null ? Vt : D, o.baseStyles = JSON.parse(JSON.stringify((Xt = s.styles) != null ? Xt : {})), o.baseLineFontDefaults = vn({
5727
5727
  lineFontDefaults: s.lineFontDefaults
5728
5728
  }), o.basePadding = {
5729
- top: W.top,
5730
- right: W.right,
5731
- bottom: W.bottom,
5732
- left: W.left
5729
+ top: H.top,
5730
+ right: H.right,
5731
+ bottom: H.bottom,
5732
+ left: H.left
5733
5733
  }, o.baseRadii = {
5734
5734
  topLeft: J.topLeft,
5735
5735
  topRight: J.topRight,
5736
5736
  bottomRight: J.bottomRight,
5737
5737
  bottomLeft: J.bottomLeft
5738
- }, o.hasWidthChange = se || Lt || xt || Rt || Yt;
5738
+ }, o.hasWidthChange = ne || xt || Lt || Rt || Yt;
5739
5739
  }, this._handleObjectModified = (n) => {
5740
- var b, w, v;
5740
+ var b, w, S;
5741
5741
  const { target: s } = n;
5742
5742
  if (s instanceof q) {
5743
- const C = s.getObjects();
5744
- if (!C.some((M) => at._isTextbox(M))) return;
5745
- const { scaleX: j = 1, scaleY: S = 1 } = s;
5746
- if (Math.abs(j - 1) < it && Math.abs(S - 1) < it) return;
5747
- this.canvas.discardActiveObject(), C.forEach((M) => {
5748
- var E, I, z, F;
5749
- if (at._isTextbox(M)) {
5750
- const U = (E = M.scaleX) != null ? E : 1, D = (I = M.scaleY) != null ? I : 1, B = ((z = M.fontSize) != null ? z : 16) * D, N = ((F = M.width) != null ? F : 0) * U, R = D, {
5751
- paddingTop: k = 0,
5743
+ const I = s.getObjects();
5744
+ if (!I.some((v) => at._isTextbox(v))) return;
5745
+ const { scaleX: A = 1, scaleY: M = 1 } = s;
5746
+ if (Math.abs(A - 1) < it && Math.abs(M - 1) < it) return;
5747
+ this.canvas.discardActiveObject(), I.forEach((v) => {
5748
+ var O, D, B, U;
5749
+ if (at._isTextbox(v)) {
5750
+ const F = (O = v.scaleX) != null ? O : 1, E = (D = v.scaleY) != null ? D : 1, L = ((B = v.fontSize) != null ? B : 16) * E, N = ((U = v.width) != null ? U : 0) * F, _ = E, {
5751
+ paddingTop: R = 0,
5752
5752
  paddingRight: T = 0,
5753
- paddingBottom: _ = 0,
5754
- paddingLeft: x = 0,
5755
- radiusTopLeft: L = 0,
5753
+ paddingBottom: x = 0,
5754
+ paddingLeft: P = 0,
5755
+ radiusTopLeft: k = 0,
5756
5756
  radiusTopRight: V = 0,
5757
- radiusBottomRight: W = 0,
5757
+ radiusBottomRight: H = 0,
5758
5758
  radiusBottomLeft: J = 0,
5759
5759
  styles: tt
5760
- } = M, ot = {
5761
- paddingTop: Math.max(0, k * R),
5762
- paddingRight: Math.max(0, T * R),
5763
- paddingBottom: Math.max(0, _ * R),
5764
- paddingLeft: Math.max(0, x * R)
5760
+ } = v, ot = {
5761
+ paddingTop: Math.max(0, R * _),
5762
+ paddingRight: Math.max(0, T * _),
5763
+ paddingBottom: Math.max(0, x * _),
5764
+ paddingLeft: Math.max(0, P * _)
5765
5765
  }, pt = {
5766
- radiusTopLeft: Math.max(0, L * R),
5767
- radiusTopRight: Math.max(0, V * R),
5768
- radiusBottomRight: Math.max(0, W * R),
5769
- radiusBottomLeft: Math.max(0, J * R)
5766
+ radiusTopLeft: Math.max(0, k * _),
5767
+ radiusTopRight: Math.max(0, V * _),
5768
+ radiusBottomRight: Math.max(0, H * _),
5769
+ radiusBottomLeft: Math.max(0, J * _)
5770
5770
  };
5771
5771
  let At = tt;
5772
5772
  tt && Object.keys(tt).length > 0 && (At = JSON.parse(JSON.stringify(tt)), Object.values(At).forEach((Et) => {
5773
5773
  Object.values(Et).forEach((jt) => {
5774
- typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * R));
5774
+ typeof jt.fontSize == "number" && (jt.fontSize = Math.max(1, jt.fontSize * _));
5775
5775
  });
5776
5776
  }));
5777
5777
  const dt = Sn({
5778
- lineFontDefaults: M.lineFontDefaults,
5779
- scale: R
5780
- }), ht = yt(P(P({
5781
- fontSize: B,
5778
+ lineFontDefaults: v.lineFontDefaults,
5779
+ scale: _
5780
+ }), ht = yt(z(z({
5781
+ fontSize: L,
5782
5782
  width: N,
5783
5783
  scaleX: 1,
5784
5784
  scaleY: 1
5785
5785
  }, ot), pt), {
5786
5786
  styles: At
5787
5787
  });
5788
- dt && (ht.lineFontDefaults = dt), M.set(ht), _t({ textbox: M });
5788
+ dt && (ht.lineFontDefaults = dt), v.set(ht), Dt({ textbox: v });
5789
5789
  }
5790
- M.setCoords();
5790
+ v.setCoords();
5791
5791
  });
5792
- const A = new q(C, {
5792
+ const C = new q(I, {
5793
5793
  canvas: this.canvas
5794
5794
  });
5795
- this.canvas.setActiveObject(A), this.canvas.requestRenderAll();
5795
+ this.canvas.setActiveObject(C), this.canvas.requestRenderAll();
5796
5796
  return;
5797
5797
  }
5798
5798
  if (!at._isTextbox(s)) return;
5799
5799
  s.isScaling = !1;
5800
5800
  const i = this.scalingState.get(s);
5801
5801
  if (this.scalingState.delete(s), !(i != null && i.hasWidthChange)) return;
5802
- const o = (b = s.width) != null ? b : s.calcTextWidth(), a = (v = (w = s.fontSize) != null ? w : i == null ? void 0 : i.baseFontSize) != null ? v : 16, r = !!(i.baseStyles && Object.keys(i.baseStyles).length), {
5802
+ const o = (b = s.width) != null ? b : s.calcTextWidth(), a = (S = (w = s.fontSize) != null ? w : i == null ? void 0 : i.baseFontSize) != null ? S : 16, r = !!(i.baseStyles && Object.keys(i.baseStyles).length), {
5803
5803
  paddingTop: c = 0,
5804
5804
  paddingRight: l = 0,
5805
5805
  paddingBottom: d = 0,
@@ -5830,8 +5830,8 @@ class at {
5830
5830
  * @param options — настройки текста
5831
5831
  * @param flags — флаги поведения
5832
5832
  */
5833
- addText(F = {}, { withoutSelection: E = !1, withoutSave: I = !1, withoutAdding: z = !1 } = {}) {
5834
- var U = F, {
5833
+ addText(U = {}, { withoutSelection: O = !1, withoutSave: D = !1, withoutAdding: B = !1 } = {}) {
5834
+ var F = U, {
5835
5835
  id: t = `text-${et()}`,
5836
5836
  text: e = "Новый текст",
5837
5837
  autoExpand: n = !0,
@@ -5851,13 +5851,13 @@ class at {
5851
5851
  backgroundOpacity: y = 1,
5852
5852
  paddingTop: b = 0,
5853
5853
  paddingRight: w = 0,
5854
- paddingBottom: v = 0,
5855
- paddingLeft: C = 0,
5856
- radiusTopLeft: O = 0,
5857
- radiusTopRight: j = 0,
5858
- radiusBottomRight: S = 0,
5859
- radiusBottomLeft: A = 0
5860
- } = U, M = St(U, [
5854
+ paddingBottom: S = 0,
5855
+ paddingLeft: I = 0,
5856
+ radiusTopLeft: j = 0,
5857
+ radiusTopRight: A = 0,
5858
+ radiusBottomRight: M = 0,
5859
+ radiusBottomLeft: C = 0
5860
+ } = F, v = St(F, [
5861
5861
  "id",
5862
5862
  "text",
5863
5863
  "autoExpand",
@@ -5885,12 +5885,12 @@ class at {
5885
5885
  "radiusBottomLeft"
5886
5886
  ]);
5887
5887
  var V;
5888
- const { historyManager: D } = this.editor, { canvas: B } = this;
5889
- D.suspendHistory();
5890
- const N = s != null ? s : this._getDefaultFontFamily(), R = Ue({ width: p }), k = Fe({
5888
+ const { historyManager: E } = this.editor, { canvas: L } = this;
5889
+ E.suspendHistory();
5890
+ const N = s != null ? s : this._getDefaultFontFamily(), _ = Ue({ width: p }), R = Fe({
5891
5891
  strokeColor: f,
5892
- width: R
5893
- }), T = P({
5892
+ width: _
5893
+ }), T = z({
5894
5894
  id: t,
5895
5895
  fontFamily: N,
5896
5896
  fontSize: i,
@@ -5901,43 +5901,43 @@ class at {
5901
5901
  linethrough: l,
5902
5902
  textAlign: d,
5903
5903
  fill: u,
5904
- stroke: k,
5905
- strokeWidth: R,
5904
+ stroke: R,
5905
+ strokeWidth: _,
5906
5906
  strokeUniform: !0,
5907
5907
  opacity: m,
5908
5908
  backgroundColor: g,
5909
5909
  backgroundOpacity: y,
5910
5910
  paddingTop: b,
5911
5911
  paddingRight: w,
5912
- paddingBottom: v,
5913
- paddingLeft: C,
5914
- radiusTopLeft: O,
5915
- radiusTopRight: j,
5916
- radiusBottomRight: S,
5917
- radiusBottomLeft: A
5918
- }, M), _ = new Se(e, T), x = n !== !1;
5919
- if (_.autoExpand = x, _.textCaseRaw = (V = _.text) != null ? V : "", c) {
5920
- const W = Te({ value: _.textCaseRaw });
5921
- W !== _.text && _.set({ text: W });
5922
- }
5923
- return _t({ textbox: _ }) && (_.dirty = !0), M.left === void 0 && M.top === void 0 && B.centerObject(_), z || B.add(_), E || B.setActiveObject(_), B.requestRenderAll(), D.resumeHistory(), I || D.saveState(), B.fire("editor:text-added", {
5924
- textbox: _,
5925
- options: yt(P({}, T), {
5912
+ paddingBottom: S,
5913
+ paddingLeft: I,
5914
+ radiusTopLeft: j,
5915
+ radiusTopRight: A,
5916
+ radiusBottomRight: M,
5917
+ radiusBottomLeft: C
5918
+ }, v), x = new ve(e, T), P = n !== !1;
5919
+ if (x.autoExpand = P, x.textCaseRaw = (V = x.text) != null ? V : "", c) {
5920
+ const H = Ee({ value: x.textCaseRaw });
5921
+ H !== x.text && x.set({ text: H });
5922
+ }
5923
+ return Dt({ textbox: x }) && (x.dirty = !0), v.left === void 0 && v.top === void 0 && L.centerObject(x), B || L.add(x), O || L.setActiveObject(x), L.requestRenderAll(), E.resumeHistory(), D || E.saveState(), L.fire("editor:text-added", {
5924
+ textbox: x,
5925
+ options: yt(z({}, T), {
5926
5926
  text: e,
5927
5927
  bold: o,
5928
5928
  italic: a,
5929
5929
  strikethrough: l,
5930
5930
  align: d,
5931
5931
  color: u,
5932
- strokeColor: k,
5933
- strokeWidth: R
5932
+ strokeColor: R,
5933
+ strokeWidth: _
5934
5934
  }),
5935
5935
  flags: {
5936
- withoutSelection: !!E,
5937
- withoutSave: !!I,
5938
- withoutAdding: !!z
5936
+ withoutSelection: !!O,
5937
+ withoutSave: !!D,
5938
+ withoutAdding: !!B
5939
5939
  }
5940
- }), _;
5940
+ }), x;
5941
5941
  }
5942
5942
  /**
5943
5943
  * Обновляет текстовый объект.
@@ -5955,7 +5955,7 @@ class at {
5955
5955
  skipRender: s,
5956
5956
  selectionRange: i
5957
5957
  } = {}) {
5958
- var Ht, Zt, Vt, Xt, Bt, le;
5958
+ var Ht, Zt, Vt, Xt, Bt, ce;
5959
5959
  const o = this._resolveTextObject(t);
5960
5960
  if (!o) return null;
5961
5961
  const { text: a = "" } = o, { historyManager: r } = this.editor, { canvas: c } = this;
@@ -5971,25 +5971,25 @@ class at {
5971
5971
  fontSize: y,
5972
5972
  bold: b,
5973
5973
  italic: w,
5974
- underline: v,
5975
- uppercase: C,
5976
- strikethrough: O,
5977
- align: j,
5978
- color: S,
5979
- strokeColor: A,
5980
- strokeWidth: M,
5981
- opacity: E,
5982
- backgroundColor: I,
5983
- backgroundOpacity: z,
5984
- paddingTop: F,
5985
- paddingRight: U,
5986
- paddingBottom: D,
5987
- paddingLeft: B,
5974
+ underline: S,
5975
+ uppercase: I,
5976
+ strikethrough: j,
5977
+ align: A,
5978
+ color: M,
5979
+ strokeColor: C,
5980
+ strokeWidth: v,
5981
+ opacity: O,
5982
+ backgroundColor: D,
5983
+ backgroundOpacity: B,
5984
+ paddingTop: U,
5985
+ paddingRight: F,
5986
+ paddingBottom: E,
5987
+ paddingLeft: L,
5988
5988
  radiusTopLeft: N,
5989
- radiusTopRight: R,
5990
- radiusBottomRight: k,
5989
+ radiusTopRight: _,
5990
+ radiusBottomRight: R,
5991
5991
  radiusBottomLeft: T
5992
- } = Gt, _ = St(Gt, [
5992
+ } = Gt, x = St(Gt, [
5993
5993
  "text",
5994
5994
  "autoExpand",
5995
5995
  "fontFamily",
@@ -6014,47 +6014,47 @@ class at {
6014
6014
  "radiusTopRight",
6015
6015
  "radiusBottomRight",
6016
6016
  "radiusBottomLeft"
6017
- ]), x = P({}, _), L = i !== void 0 ? Ys({
6017
+ ]), P = z({}, x), k = i !== void 0 ? Ys({
6018
6018
  text: a,
6019
6019
  range: i
6020
- }) : Ns({ textbox: o }), V = L ? Hs({ textbox: o, range: L }) : null, W = {}, J = {}, tt = {};
6020
+ }) : Ns({ textbox: o }), V = k ? Hs({ textbox: o, range: k }) : null, H = {}, J = {}, tt = {};
6021
6021
  let ot, pt;
6022
- const At = zs({ textbox: o, range: L }), dt = !L || At, ht = !L;
6023
- if (g !== void 0 && (V && (J.fontFamily = g), dt && (x.fontFamily = g, ht && (tt.fontFamily = g))), y !== void 0 && (V && (J.fontSize = y), dt && (x.fontSize = y, ht && (tt.fontSize = y))), b !== void 0) {
6022
+ const At = zs({ textbox: o, range: k }), dt = !k || At, ht = !k;
6023
+ if (g !== void 0 && (V && (J.fontFamily = g), dt && (P.fontFamily = g, ht && (tt.fontFamily = g))), y !== void 0 && (V && (J.fontSize = y), dt && (P.fontSize = y, ht && (tt.fontSize = y))), b !== void 0) {
6024
6024
  const Q = b ? "bold" : "normal";
6025
- L && (W.fontWeight = Q), dt && (x.fontWeight = Q, ht && (tt.fontWeight = Q));
6025
+ k && (H.fontWeight = Q), dt && (P.fontWeight = Q, ht && (tt.fontWeight = Q));
6026
6026
  }
6027
6027
  if (w !== void 0) {
6028
6028
  const Q = w ? "italic" : "normal";
6029
- L && (W.fontStyle = Q), dt && (x.fontStyle = Q, ht && (tt.fontStyle = Q));
6029
+ k && (H.fontStyle = Q), dt && (P.fontStyle = Q, ht && (tt.fontStyle = Q));
6030
6030
  }
6031
- if (v !== void 0 && (L && (W.underline = v), dt && (x.underline = v, ht && (tt.underline = v))), O !== void 0 && (L && (W.linethrough = O), dt && (x.linethrough = O, ht && (tt.linethrough = O))), j !== void 0 && (x.textAlign = j), S !== void 0 && (L && (W.fill = S), dt && (x.fill = S, ht && (tt.fill = S))), A !== void 0 || M !== void 0) {
6032
- const Q = L ? yn({ textbox: o, range: L, property: "strokeWidth" }) : void 0, st = L ? yn({ textbox: o, range: L, property: "stroke" }) : void 0, Ce = (Vt = (Zt = M != null ? M : Q) != null ? Zt : o.strokeWidth) != null ? Vt : 0;
6031
+ if (S !== void 0 && (k && (H.underline = S), dt && (P.underline = S, ht && (tt.underline = S))), j !== void 0 && (k && (H.linethrough = j), dt && (P.linethrough = j, ht && (tt.linethrough = j))), A !== void 0 && (P.textAlign = A), M !== void 0 && (k && (H.fill = M), dt && (P.fill = M, ht && (tt.fill = M))), C !== void 0 || v !== void 0) {
6032
+ const Q = k ? yn({ textbox: o, range: k, property: "strokeWidth" }) : void 0, st = k ? yn({ textbox: o, range: k, property: "stroke" }) : void 0, Ce = (Vt = (Zt = v != null ? v : Q) != null ? Zt : o.strokeWidth) != null ? Vt : 0;
6033
6033
  pt = Ue({ width: Ce });
6034
- const Nt = (Bt = (Xt = A != null ? A : st) != null ? Xt : o.stroke) != null ? Bt : void 0;
6034
+ const Nt = (Bt = (Xt = C != null ? C : st) != null ? Xt : o.stroke) != null ? Bt : void 0;
6035
6035
  ot = Fe({
6036
6036
  strokeColor: Nt,
6037
6037
  width: pt
6038
- }), L && (W.stroke = ot, W.strokeWidth = pt), dt && (x.stroke = ot, x.strokeWidth = pt, ht && (tt.stroke = ot, tt.strokeWidth = pt));
6038
+ }), k && (H.stroke = ot, H.strokeWidth = pt), dt && (P.stroke = ot, P.strokeWidth = pt, ht && (tt.stroke = ot, tt.strokeWidth = pt));
6039
6039
  }
6040
- E !== void 0 && (x.opacity = E), I !== void 0 && (x.backgroundColor = I), z !== void 0 && (x.backgroundOpacity = z), F !== void 0 && (x.paddingTop = F), U !== void 0 && (x.paddingRight = U), D !== void 0 && (x.paddingBottom = D), B !== void 0 && (x.paddingLeft = B), N !== void 0 && (x.radiusTopLeft = N), R !== void 0 && (x.radiusTopRight = R), k !== void 0 && (x.radiusBottomRight = k), T !== void 0 && (x.radiusBottomLeft = T);
6041
- const Et = (le = o.textCaseRaw) != null ? le : a, jt = !!o.uppercase, Lt = p !== void 0, xt = Lt ? p != null ? p : "" : Et, Rt = C != null ? C : jt, Yt = Rt !== jt;
6042
- if (Lt || Yt) {
6043
- const Q = Rt ? Te({ value: xt }) : xt;
6044
- x.text = Q, o.textCaseRaw = xt;
6040
+ O !== void 0 && (P.opacity = O), D !== void 0 && (P.backgroundColor = D), B !== void 0 && (P.backgroundOpacity = B), U !== void 0 && (P.paddingTop = U), F !== void 0 && (P.paddingRight = F), E !== void 0 && (P.paddingBottom = E), L !== void 0 && (P.paddingLeft = L), N !== void 0 && (P.radiusTopLeft = N), _ !== void 0 && (P.radiusTopRight = _), R !== void 0 && (P.radiusBottomRight = R), T !== void 0 && (P.radiusBottomLeft = T);
6041
+ const Et = (ce = o.textCaseRaw) != null ? ce : a, jt = !!o.uppercase, xt = p !== void 0, Lt = xt ? p != null ? p : "" : Et, Rt = I != null ? I : jt, Yt = Rt !== jt;
6042
+ if (xt || Yt) {
6043
+ const Q = Rt ? Ee({ value: Lt }) : Lt;
6044
+ P.text = Q, o.textCaseRaw = Lt;
6045
6045
  } else o.textCaseRaw === void 0 && (o.textCaseRaw = Et);
6046
- o.uppercase = Rt, o.set(x);
6046
+ o.uppercase = Rt, o.set(P);
6047
6047
  let mt = !1;
6048
- if (L) {
6049
- const Q = Ee({ textbox: o, styles: W, range: L }), st = V ? Ee({ textbox: o, styles: J, range: V }) : !1;
6048
+ if (k) {
6049
+ const Q = Oe({ textbox: o, styles: H, range: k }), st = V ? Oe({ textbox: o, styles: J, range: V }) : !1;
6050
6050
  mt = Q || st;
6051
6051
  } else if (Object.keys(tt).length) {
6052
6052
  const Q = Ps({ textbox: o });
6053
- Q && (mt = Ee({ textbox: o, styles: tt, range: Q }));
6053
+ Q && (mt = Oe({ textbox: o, styles: tt, range: Q }));
6054
6054
  }
6055
- const se = mt && wn({
6055
+ const ne = mt && wn({
6056
6056
  stylesList: [
6057
- W,
6057
+ H,
6058
6058
  J,
6059
6059
  tt
6060
6060
  ]
@@ -6070,33 +6070,33 @@ class at {
6070
6070
  updates: st
6071
6071
  });
6072
6072
  }
6073
- if (L && (S !== void 0 || A !== void 0 || M !== void 0)) {
6073
+ if (k && (M !== void 0 || C !== void 0 || v !== void 0)) {
6074
6074
  const Q = Zs({
6075
6075
  textbox: o,
6076
- range: L
6076
+ range: k
6077
6077
  }), st = {};
6078
- S !== void 0 && (st.fill = S), (A !== void 0 || M !== void 0) && (ot === null && (st.stroke = null), ot != null && (st.stroke = ot)), bn({
6078
+ M !== void 0 && (st.fill = M), (C !== void 0 || v !== void 0) && (ot === null && (st.stroke = null), ot != null && (st.stroke = ot)), bn({
6079
6079
  textbox: o,
6080
6080
  lineIndices: Q,
6081
6081
  updates: st
6082
6082
  });
6083
6083
  }
6084
- se && (o.initDimensions(), o.dirty = !0), (I !== void 0 || z !== void 0 || F !== void 0 || U !== void 0 || D !== void 0 || B !== void 0 || N !== void 0 || R !== void 0 || k !== void 0 || T !== void 0) && (o.dirty = !0);
6084
+ ne && (o.initDimensions(), o.dirty = !0), (D !== void 0 || B !== void 0 || U !== void 0 || F !== void 0 || E !== void 0 || L !== void 0 || N !== void 0 || _ !== void 0 || R !== void 0 || T !== void 0) && (o.dirty = !0);
6085
6085
  const Tt = wn({
6086
6086
  stylesList: [
6087
- x,
6088
- W,
6087
+ P,
6088
+ H,
6089
6089
  J,
6090
6090
  tt
6091
6091
  ]
6092
- }), { autoExpand: vt } = o, ie = m !== void 0, oe = (m != null ? m : vt) !== !1;
6093
- ie ? o.autoExpand = m !== !1 : vt === void 0 && (o.autoExpand = !0);
6094
- const ae = Object.prototype.hasOwnProperty.call(x, "width"), re = oe && !ae && (Lt || Yt || Tt);
6092
+ }), { autoExpand: vt } = o, se = m !== void 0, ie = (m != null ? m : vt) !== !1;
6093
+ se ? o.autoExpand = m !== !1 : vt === void 0 && (o.autoExpand = !0);
6094
+ const oe = Object.prototype.hasOwnProperty.call(P, "width"), ae = ie && !oe && (xt || Yt || Tt);
6095
6095
  let kt = !1;
6096
- re && (kt = this._autoExpandTextboxWidth(o, {
6096
+ ae && (kt = this._autoExpandTextboxWidth(o, {
6097
6097
  anchor: f
6098
- }), kt && (o.dirty = !0)), (kt ? !1 : _t({ textbox: o })) && (o.dirty = !0), o.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
6099
- const ce = at._getSnapshot(o);
6098
+ }), kt && (o.dirty = !0)), (kt ? !1 : Dt({ textbox: o })) && (o.dirty = !0), o.setCoords(), s || c.requestRenderAll(), r.resumeHistory(), n || r.saveState();
6099
+ const re = at._getSnapshot(o);
6100
6100
  return c.fire("editor:text-updated", {
6101
6101
  textbox: o,
6102
6102
  target: t,
@@ -6105,11 +6105,11 @@ class at {
6105
6105
  withoutSave: !!n,
6106
6106
  skipRender: !!s
6107
6107
  },
6108
- updates: x,
6108
+ updates: P,
6109
6109
  before: l,
6110
- after: ce,
6111
- selectionRange: L != null ? L : void 0,
6112
- selectionStyles: L && Object.keys(W).length ? W : void 0
6110
+ after: re,
6111
+ selectionRange: k != null ? k : void 0,
6112
+ selectionStyles: k && Object.keys(H).length ? H : void 0
6113
6113
  }), o;
6114
6114
  }
6115
6115
  /**
@@ -6159,7 +6159,7 @@ class at {
6159
6159
  * Синхронизирует lineFontDefaults при изменении текста и сохраняет typing style для пустых строк.
6160
6160
  */
6161
6161
  _syncLineFontDefaultsOnTextChanged({ textbox: t }) {
6162
- var z, F, U;
6162
+ var B, U, F;
6163
6163
  const {
6164
6164
  text: e = "",
6165
6165
  lineFontDefaults: n,
@@ -6170,86 +6170,86 @@ class at {
6170
6170
  stroke: r,
6171
6171
  selectionStart: c,
6172
6172
  isEditing: l
6173
- } = t, d = e, u = (z = t.__lineDefaultsPrevText) != null ? z : d, f = u.split(`
6173
+ } = t, d = e, u = (B = t.__lineDefaultsPrevText) != null ? B : d, f = u.split(`
6174
6174
  `), p = d.split(`
6175
6175
  `), m = f.length, y = p.length - m;
6176
- let b = n, w = !1, v = !1;
6177
- const C = typeof a == "string" ? a : void 0, O = typeof r == "string" ? r : void 0;
6176
+ let b = n, w = !1, S = !1;
6177
+ const I = typeof a == "string" ? a : void 0, j = typeof r == "string" ? r : void 0;
6178
6178
  if (y !== 0 && n && Object.keys(n).length) {
6179
- const D = Vs({
6179
+ const E = Vs({
6180
6180
  previous: u,
6181
6181
  next: d
6182
- }), B = Xs({
6182
+ }), L = Xs({
6183
6183
  text: u,
6184
- charIndex: D
6184
+ charIndex: E
6185
6185
  });
6186
6186
  if (y > 0) {
6187
6187
  const N = Ks({
6188
6188
  text: u,
6189
- lineIndex: B
6189
+ lineIndex: L
6190
6190
  });
6191
- let R = B + 1;
6192
- D === N && (R = B);
6193
- const k = {};
6191
+ let _ = L + 1;
6192
+ E === N && (_ = L);
6193
+ const R = {};
6194
6194
  for (const T in n) {
6195
6195
  if (!Object.prototype.hasOwnProperty.call(n, T)) continue;
6196
- const _ = Number(T);
6197
- if (!Number.isFinite(_)) continue;
6198
- const x = n[_];
6199
- if (!x) continue;
6200
- const L = _ >= R ? _ + y : _;
6201
- k[L] = P({}, x);
6196
+ const x = Number(T);
6197
+ if (!Number.isFinite(x)) continue;
6198
+ const P = n[x];
6199
+ if (!P) continue;
6200
+ const k = x >= _ ? x + y : x;
6201
+ R[k] = z({}, P);
6202
6202
  }
6203
- b = k, w = !0, v = !0;
6203
+ b = R, w = !0, S = !0;
6204
6204
  }
6205
6205
  if (y < 0) {
6206
6206
  const N = Math.abs(y);
6207
- let R = B;
6208
- u[D] === `
6209
- ` && ((F = f[B]) != null ? F : "").length > 0 && (R = B + 1);
6210
- const T = R + N - 1, _ = {};
6211
- for (const x in n) {
6212
- if (!Object.prototype.hasOwnProperty.call(n, x)) continue;
6213
- const L = Number(x);
6214
- if (!Number.isFinite(L)) continue;
6215
- const V = n[L];
6216
- V && (L < R && (_[L] = P({}, V)), L > T && (_[L + y] = P({}, V)));
6207
+ let _ = L;
6208
+ u[E] === `
6209
+ ` && ((U = f[L]) != null ? U : "").length > 0 && (_ = L + 1);
6210
+ const T = _ + N - 1, x = {};
6211
+ for (const P in n) {
6212
+ if (!Object.prototype.hasOwnProperty.call(n, P)) continue;
6213
+ const k = Number(P);
6214
+ if (!Number.isFinite(k)) continue;
6215
+ const V = n[k];
6216
+ V && (k < _ && (x[k] = z({}, V)), k > T && (x[k + y] = z({}, V)));
6217
6217
  }
6218
- b = _, w = !0, v = !0;
6218
+ b = x, w = !0, S = !0;
6219
6219
  }
6220
6220
  }
6221
- let j = null;
6221
+ let A = null;
6222
6222
  if (l && typeof c == "number") {
6223
- const D = t.get2DCursorLocation(c), { lineIndex: B } = D;
6224
- Number.isFinite(B) && (j = B);
6223
+ const E = t.get2DCursorLocation(c), { lineIndex: L } = E;
6224
+ Number.isFinite(L) && (A = L);
6225
6225
  }
6226
- let S = s, A = !1, M = !1, E, I = null;
6227
- for (let D = 0; D < p.length; D += 1) {
6228
- const B = (U = p[D]) != null ? U : "", N = b ? b[D] : void 0;
6229
- if (N && (E = N), B.length !== 0) {
6226
+ let M = s, C = !1, v = !1, O, D = null;
6227
+ for (let E = 0; E < p.length; E += 1) {
6228
+ const L = (F = p[E]) != null ? F : "", N = b ? b[E] : void 0;
6229
+ if (N && (O = N), L.length !== 0) {
6230
6230
  if (N) {
6231
- const L = Us({
6232
- lineText: B,
6233
- lineStyles: S ? S[D] : void 0,
6231
+ const k = Us({
6232
+ lineText: L,
6233
+ lineStyles: M ? M[E] : void 0,
6234
6234
  lineDefaults: N
6235
6235
  });
6236
- L.changed && (S || (S = {}, M = !0), M || (S = P({}, S), M = !0), L.lineStyles && (S[D] = L.lineStyles), !L.lineStyles && S[D] && delete S[D], A = !0);
6236
+ k.changed && (M || (M = {}, v = !0), v || (M = z({}, M), v = !0), k.lineStyles && (M[E] = k.lineStyles), !k.lineStyles && M[E] && delete M[E], C = !0);
6237
6237
  }
6238
6238
  continue;
6239
6239
  }
6240
- const k = N != null ? N : E, T = {};
6241
- (k == null ? void 0 : k.fontFamily) !== void 0 ? T.fontFamily = k.fontFamily : i !== void 0 && (T.fontFamily = i), (k == null ? void 0 : k.fontSize) !== void 0 ? T.fontSize = k.fontSize : o !== void 0 && (T.fontSize = o), (k == null ? void 0 : k.fill) !== void 0 ? T.fill = k.fill : C !== void 0 && (T.fill = C), (k == null ? void 0 : k.stroke) !== void 0 ? T.stroke = k.stroke : O !== void 0 && (T.stroke = O), !N && Object.keys(T).length && (b || (b = {}, v = !0), v || (b = P({}, b), v = !0), b[D] = T, w = !0, E = T), N && (E = N), j !== null && j === D && (I = T);
6242
- const _ = {};
6243
- T.fontFamily !== void 0 && (_.fontFamily = T.fontFamily), T.fontSize !== void 0 && (_.fontSize = T.fontSize), T.fill !== void 0 && (_.fill = T.fill), T.stroke !== void 0 && (_.stroke = T.stroke);
6244
- const x = Object.keys(_).length > 0;
6245
- (x || S && S[D]) && (S || (S = {}, M = !0), M || (S = P({}, S), M = !0), x && (S[D] = { 0: _ }), !x && S[D] && delete S[D], A = !0);
6246
- }
6247
- if (w && b && (t.lineFontDefaults = b), A && (t.styles = S, t.dirty = !0), I && typeof c == "number") {
6248
- const D = {};
6249
- if (I.fontFamily !== void 0 && (D.fontFamily = I.fontFamily), I.fontSize !== void 0 && (D.fontSize = I.fontSize), I.fill !== void 0 && (D.fill = I.fill), I.stroke !== void 0 && (D.stroke = I.stroke), Object.keys(D).length) {
6240
+ const R = N != null ? N : O, T = {};
6241
+ (R == null ? void 0 : R.fontFamily) !== void 0 ? T.fontFamily = R.fontFamily : i !== void 0 && (T.fontFamily = i), (R == null ? void 0 : R.fontSize) !== void 0 ? T.fontSize = R.fontSize : o !== void 0 && (T.fontSize = o), (R == null ? void 0 : R.fill) !== void 0 ? T.fill = R.fill : I !== void 0 && (T.fill = I), (R == null ? void 0 : R.stroke) !== void 0 ? T.stroke = R.stroke : j !== void 0 && (T.stroke = j), !N && Object.keys(T).length && (b || (b = {}, S = !0), S || (b = z({}, b), S = !0), b[E] = T, w = !0, O = T), N && (O = N), A !== null && A === E && (D = T);
6242
+ const x = {};
6243
+ T.fontFamily !== void 0 && (x.fontFamily = T.fontFamily), T.fontSize !== void 0 && (x.fontSize = T.fontSize), T.fill !== void 0 && (x.fill = T.fill), T.stroke !== void 0 && (x.stroke = T.stroke);
6244
+ const P = Object.keys(x).length > 0;
6245
+ (P || M && M[E]) && (M || (M = {}, v = !0), v || (M = z({}, M), v = !0), P && (M[E] = { 0: x }), !P && M[E] && delete M[E], C = !0);
6246
+ }
6247
+ if (w && b && (t.lineFontDefaults = b), C && (t.styles = M, t.dirty = !0), D && typeof c == "number") {
6248
+ const E = {};
6249
+ if (D.fontFamily !== void 0 && (E.fontFamily = D.fontFamily), D.fontSize !== void 0 && (E.fontSize = D.fontSize), D.fill !== void 0 && (E.fill = D.fill), D.stroke !== void 0 && (E.stroke = D.stroke), Object.keys(E).length) {
6250
6250
  this.lineDefaultsSyncing.add(t);
6251
6251
  try {
6252
- t.setSelectionStyles(D, c, c);
6252
+ t.setSelectionStyles(E, c, c);
6253
6253
  } finally {
6254
6254
  this.lineDefaultsSyncing.delete(t);
6255
6255
  }
@@ -6262,15 +6262,15 @@ class at {
6262
6262
  * но не шире монтажной области, и удерживает объект в её пределах.
6263
6263
  */
6264
6264
  _autoExpandTextboxWidth(t, { anchor: e } = {}) {
6265
- var j, S, A, M, E, I, z, F, U, D, B, N, R;
6265
+ var A, M, C, v, O, D, B, U, F, E, L, N, _;
6266
6266
  const { montageArea: n } = this.editor;
6267
6267
  if (!n) return !1;
6268
6268
  const s = typeof t.text == "string" ? t.text : "";
6269
6269
  if (!s.length) return !1;
6270
6270
  n.setCoords();
6271
- const i = n.getBoundingRect(!1, !0), o = (j = i.width) != null ? j : 0;
6271
+ const i = n.getBoundingRect(!1, !0), o = (A = i.width) != null ? A : 0;
6272
6272
  if (!Number.isFinite(o) || o <= 0) return !1;
6273
- const a = e != null ? e : (S = this.editingAnchorState) == null ? void 0 : S.get(t), r = (M = (A = a == null ? void 0 : a.originY) != null ? A : t.originY) != null ? M : "top", c = Math.abs((E = t.scaleX) != null ? E : 1) || 1, l = (I = t.paddingLeft) != null ? I : 0, d = (z = t.paddingRight) != null ? z : 0, u = (F = t.strokeWidth) != null ? F : 0, f = Math.max(
6273
+ const a = e != null ? e : (M = this.editingAnchorState) == null ? void 0 : M.get(t), r = (v = (C = a == null ? void 0 : a.originY) != null ? C : t.originY) != null ? v : "top", c = Math.abs((O = t.scaleX) != null ? O : 1) || 1, l = (D = t.paddingLeft) != null ? D : 0, d = (B = t.paddingRight) != null ? B : 0, u = (U = t.strokeWidth) != null ? U : 0, f = Math.max(
6274
6274
  1,
6275
6275
  o / c - l - d - u
6276
6276
  );
@@ -6278,21 +6278,21 @@ class at {
6278
6278
  const p = s.split(`
6279
6279
  `).length;
6280
6280
  let m = !1;
6281
- Math.abs(((U = t.width) != null ? U : 0) - f) > it && (t.set({ width: f }), m = !0), t.initDimensions();
6281
+ Math.abs(((F = t.width) != null ? F : 0) - f) > it && (t.set({ width: f }), m = !0), t.initDimensions();
6282
6282
  const { textLines: g } = t, y = Array.isArray(g) && g.length > p, b = Math.ceil(
6283
6283
  qs({ textbox: t, text: s })
6284
- ), w = Math.min((D = t.minWidth) != null ? D : 1, f);
6285
- let v = Math.min(
6284
+ ), w = Math.min((E = t.minWidth) != null ? E : 1, f);
6285
+ let S = Math.min(
6286
6286
  f,
6287
6287
  Math.max(b, w)
6288
6288
  );
6289
- y && (v = f), Math.abs(((B = t.width) != null ? B : 0) - v) > it && (t.set({ width: v }), t.initDimensions(), m = !0), _t({ textbox: t }) && (m = !0), a && (t.setPositionByOrigin(new ct(a.x, a.y), "center", r), m = !0);
6290
- const O = Js({
6289
+ y && (S = f), Math.abs(((L = t.width) != null ? L : 0) - S) > it && (t.set({ width: S }), t.initDimensions(), m = !0), Dt({ textbox: t }) && (m = !0), a && (t.setPositionByOrigin(new ct(a.x, a.y), "center", r), m = !0);
6290
+ const j = Js({
6291
6291
  textbox: t,
6292
6292
  montageLeft: (N = i.left) != null ? N : 0,
6293
- montageRight: ((R = i.left) != null ? R : 0) + o
6293
+ montageRight: ((_ = i.left) != null ? _ : 0) + o
6294
6294
  });
6295
- return m || O;
6295
+ return m || j;
6296
6296
  }
6297
6297
  /**
6298
6298
  * Возвращает хранилище якорей редактирования, создавая его при необходимости.
@@ -6347,10 +6347,10 @@ class at {
6347
6347
  static _getSnapshot(t) {
6348
6348
  const e = ({
6349
6349
  snapshot: T,
6350
- entries: _
6350
+ entries: x
6351
6351
  }) => {
6352
- Object.entries(_).forEach(([x, L]) => {
6353
- L != null && (T[x] = L);
6352
+ Object.entries(x).forEach(([P, k]) => {
6353
+ k != null && (T[P] = k);
6354
6354
  });
6355
6355
  }, {
6356
6356
  id: n,
@@ -6370,29 +6370,29 @@ class at {
6370
6370
  strokeWidth: y,
6371
6371
  opacity: b,
6372
6372
  backgroundColor: w,
6373
- backgroundOpacity: v,
6374
- paddingTop: C,
6375
- paddingRight: O,
6376
- paddingBottom: j,
6377
- paddingLeft: S,
6378
- radiusTopLeft: A,
6379
- radiusTopRight: M,
6380
- radiusBottomRight: E,
6381
- radiusBottomLeft: I,
6382
- left: z,
6383
- top: F,
6384
- width: U,
6385
- height: D,
6386
- angle: B,
6373
+ backgroundOpacity: S,
6374
+ paddingTop: I,
6375
+ paddingRight: j,
6376
+ paddingBottom: A,
6377
+ paddingLeft: M,
6378
+ radiusTopLeft: C,
6379
+ radiusTopRight: v,
6380
+ radiusBottomRight: O,
6381
+ radiusBottomLeft: D,
6382
+ left: B,
6383
+ top: U,
6384
+ width: F,
6385
+ height: E,
6386
+ angle: L,
6387
6387
  scaleX: N,
6388
- scaleY: R
6389
- } = t, k = {
6388
+ scaleY: _
6389
+ } = t, R = {
6390
6390
  id: n,
6391
6391
  uppercase: !!o,
6392
6392
  textAlign: p
6393
6393
  };
6394
6394
  return e({
6395
- snapshot: k,
6395
+ snapshot: R,
6396
6396
  entries: {
6397
6397
  text: s,
6398
6398
  textCaseRaw: i,
@@ -6408,24 +6408,24 @@ class at {
6408
6408
  strokeWidth: y,
6409
6409
  opacity: b,
6410
6410
  backgroundColor: w,
6411
- backgroundOpacity: v,
6412
- paddingTop: C,
6413
- paddingRight: O,
6414
- paddingBottom: j,
6415
- paddingLeft: S,
6416
- radiusTopLeft: A,
6417
- radiusTopRight: M,
6418
- radiusBottomRight: E,
6419
- radiusBottomLeft: I,
6420
- left: z,
6421
- top: F,
6422
- width: U,
6423
- height: D,
6424
- angle: B,
6411
+ backgroundOpacity: S,
6412
+ paddingTop: I,
6413
+ paddingRight: j,
6414
+ paddingBottom: A,
6415
+ paddingLeft: M,
6416
+ radiusTopLeft: C,
6417
+ radiusTopRight: v,
6418
+ radiusBottomRight: O,
6419
+ radiusBottomLeft: D,
6420
+ left: B,
6421
+ top: U,
6422
+ width: F,
6423
+ height: E,
6424
+ angle: L,
6425
6425
  scaleX: N,
6426
- scaleY: R
6426
+ scaleY: _
6427
6427
  }
6428
- }), k;
6428
+ }), R;
6429
6429
  }
6430
6430
  /**
6431
6431
  * Возвращает первый доступный шрифт или дефолтный Arial.
@@ -6438,7 +6438,7 @@ class at {
6438
6438
  const nt = ({
6439
6439
  value: h,
6440
6440
  fallback: t = 0
6441
- }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, fe = ({
6441
+ }) => typeof h == "number" && Number.isFinite(h) ? h : typeof t == "number" && Number.isFinite(t) ? t : 0, ue = ({
6442
6442
  value: h,
6443
6443
  dimension: t,
6444
6444
  useRelativePositions: e
@@ -6455,22 +6455,22 @@ const nt = ({
6455
6455
  const i = h;
6456
6456
  if (typeof i[s.x] == "number" && typeof i[s.y] == "number")
6457
6457
  return {
6458
- x: fe({
6458
+ x: ue({
6459
6459
  value: i[s.x],
6460
6460
  dimension: t,
6461
6461
  useRelativePositions: n
6462
6462
  }),
6463
- y: fe({
6463
+ y: ue({
6464
6464
  value: i[s.y],
6465
6465
  dimension: e,
6466
6466
  useRelativePositions: n
6467
6467
  })
6468
6468
  };
6469
- const { left: a, top: r, width: c, height: l } = h, d = fe({
6469
+ const { left: a, top: r, width: c, height: l } = h, d = ue({
6470
6470
  value: a,
6471
6471
  dimension: t,
6472
6472
  useRelativePositions: n
6473
- }), u = fe({
6473
+ }), u = ue({
6474
6474
  value: r,
6475
6475
  dimension: e,
6476
6476
  useRelativePositions: n
@@ -6572,7 +6572,7 @@ const nt = ({
6572
6572
  };
6573
6573
  }
6574
6574
  return null;
6575
- }, Jt = "_templateCenterX", _e = "_templateCenterY", ge = "_templateAnchorX", De = "_templateAnchorY";
6575
+ }, Jt = "_templateCenterX", Te = "_templateCenterY", fe = "_templateAnchorX", De = "_templateAnchorY";
6576
6576
  class Z {
6577
6577
  constructor({ editor: t }) {
6578
6578
  this.editor = t;
@@ -6597,16 +6597,16 @@ class Z {
6597
6597
  return a.emitWarning({
6598
6598
  origin: "TemplateManager",
6599
6599
  method: "serializeSelection",
6600
- code: Dt.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
6600
+ code: _t.TEMPLATE_MANAGER.NO_OBJECTS_SELECTED,
6601
6601
  message: "Нет объектов для сериализации шаблона"
6602
6602
  }), null;
6603
- const p = Z._getBounds(o), m = Z._getMontageSize({ montageArea: o, bounds: p }), g = m.width, y = m.height, b = f.map((C) => Z._serializeObject({
6604
- object: C,
6603
+ const p = Z._getBounds(o), m = Z._getMontageSize({ montageArea: o, bounds: p }), g = m.width, y = m.height, b = f.map((I) => Z._serializeObject({
6604
+ object: I,
6605
6605
  bounds: p,
6606
6606
  baseWidth: g,
6607
6607
  baseHeight: y,
6608
6608
  montageArea: o != null ? o : null
6609
- })), w = yt(P({}, n), {
6609
+ })), w = yt(z({}, n), {
6610
6610
  baseWidth: g,
6611
6611
  baseHeight: y,
6612
6612
  positionsNormalized: !0,
@@ -6638,7 +6638,7 @@ class Z {
6638
6638
  return o.emitWarning({
6639
6639
  origin: "TemplateManager",
6640
6640
  method: "applyTemplate",
6641
- code: Dt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6641
+ code: _t.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6642
6642
  message: "Шаблон не содержит объектов"
6643
6643
  }), null;
6644
6644
  const d = Z._getBounds(s);
@@ -6646,7 +6646,7 @@ class Z {
6646
6646
  return o.emitWarning({
6647
6647
  origin: "TemplateManager",
6648
6648
  method: "applyTemplate",
6649
- code: Dt.TEMPLATE_MANAGER.INVALID_TARGET,
6649
+ code: _t.TEMPLATE_MANAGER.INVALID_TARGET,
6650
6650
  message: "Не удалось определить границы монтажной области"
6651
6651
  }), null;
6652
6652
  const u = Z._getMontageSize({ montageArea: s, bounds: d }), f = Z._normalizeMeta({ meta: c, fallback: u }), p = Z._calculateScale({ meta: f, target: u }), m = !!f.positionsNormalized;
@@ -6658,20 +6658,20 @@ class Z {
6658
6658
  return o.emitWarning({
6659
6659
  origin: "TemplateManager",
6660
6660
  method: "applyTemplate",
6661
- code: Dt.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6661
+ code: _t.TEMPLATE_MANAGER.INVALID_TEMPLATE,
6662
6662
  message: "Не удалось создать объекты шаблона"
6663
6663
  }), null;
6664
- const { backgroundObject: w, contentObjects: v } = Z._extractBackgroundObject(b);
6664
+ const { backgroundObject: w, contentObjects: S } = Z._extractBackgroundObject(b);
6665
6665
  w && (y = yield Z._applyBackgroundFromObject({
6666
6666
  backgroundObject: w,
6667
6667
  backgroundManager: a,
6668
6668
  errorManager: o
6669
6669
  }));
6670
- const C = v.map((O) => (this._adaptTextboxWidth({
6671
- object: O,
6670
+ const I = S.map((j) => (this._adaptTextboxWidth({
6671
+ object: j,
6672
6672
  baseWidth: f.baseWidth
6673
6673
  }), Z._transformObject({
6674
- object: O,
6674
+ object: j,
6675
6675
  scale: p,
6676
6676
  bounds: d,
6677
6677
  targetSize: u,
@@ -6679,20 +6679,20 @@ class Z {
6679
6679
  baseHeight: f.baseHeight,
6680
6680
  montageArea: s,
6681
6681
  useRelativePositions: m
6682
- }), O.set({
6683
- id: `${O.type}-${et()}`,
6682
+ }), j.set({
6683
+ id: `${j.type}-${et()}`,
6684
6684
  evented: !0
6685
- }), n.add(O), O));
6686
- return !C.length && !y ? null : (g = C.length > 0 || y, C.length && Z._activateObjects({ canvas: n, objects: C }), n.requestRenderAll(), n.fire("editor:template-applied", {
6685
+ }), n.add(j), j));
6686
+ return !I.length && !y ? null : (g = I.length > 0 || y, I.length && Z._activateObjects({ canvas: n, objects: I }), n.requestRenderAll(), n.fire("editor:template-applied", {
6687
6687
  template: t,
6688
- objects: C,
6688
+ objects: I,
6689
6689
  bounds: d
6690
- }), C);
6690
+ }), I);
6691
6691
  } catch (b) {
6692
6692
  return o.emitError({
6693
6693
  origin: "TemplateManager",
6694
6694
  method: "applyTemplate",
6695
- code: Dt.TEMPLATE_MANAGER.APPLY_FAILED,
6695
+ code: _t.TEMPLATE_MANAGER.APPLY_FAILED,
6696
6696
  message: "Ошибка применения шаблона",
6697
6697
  data: {
6698
6698
  templateId: l,
@@ -6768,22 +6768,22 @@ class Z {
6768
6768
  naturalHeight: 0,
6769
6769
  width: 0,
6770
6770
  height: 0
6771
- }, m = nt({ value: d || f || c.width, fallback: 0 }), g = nt({ value: u || p || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), b = nt({ value: i, fallback: g }), w = nt({ value: o, fallback: c.scaleX || 1 }), v = nt({ value: a, fallback: c.scaleY || 1 }), C = y * w, O = b * v, j = m > 0, S = g > 0, A = C > 0, M = O > 0, E = Z._resolveImageFit({ customData: r }), I = {};
6772
- if (j && (I.width = m), S && (I.height = g), !j || !S) {
6773
- c.set(I);
6771
+ }, m = nt({ value: d || f || c.width, fallback: 0 }), g = nt({ value: u || p || c.height, fallback: 0 }), y = nt({ value: s, fallback: m }), b = nt({ value: i, fallback: g }), w = nt({ value: o, fallback: c.scaleX || 1 }), S = nt({ value: a, fallback: c.scaleY || 1 }), I = y * w, j = b * S, A = m > 0, M = g > 0, C = I > 0, v = j > 0, O = Z._resolveImageFit({ customData: r }), D = {};
6772
+ if (A && (D.width = m), M && (D.height = g), !A || !M) {
6773
+ c.set(D);
6774
6774
  return;
6775
6775
  }
6776
- if (E === "stretch") {
6777
- const F = A ? C / m : null, U = M ? O / g : null;
6778
- F && F > 0 && (I.scaleX = F), U && U > 0 && (I.scaleY = U), c.set(I);
6776
+ if (O === "stretch") {
6777
+ const U = C ? I / m : null, F = v ? j / g : null;
6778
+ U && U > 0 && (D.scaleX = U), F && F > 0 && (D.scaleY = F), c.set(D);
6779
6779
  return;
6780
6780
  }
6781
- if (!A || !M) {
6782
- c.set(I);
6781
+ if (!C || !v) {
6782
+ c.set(D);
6783
6783
  return;
6784
6784
  }
6785
- const z = Math.min(C / m, O / g);
6786
- Number.isFinite(z) && z > 0 && (I.scaleX = z, I.scaleY = z), c.set(I);
6785
+ const B = Math.min(I / m, j / g);
6786
+ Number.isFinite(B) && B > 0 && (D.scaleX = B, D.scaleY = B), c.set(D);
6787
6787
  }
6788
6788
  /**
6789
6789
  * Определяет режим вписывания изображения при восстановлении.
@@ -6822,7 +6822,7 @@ class Z {
6822
6822
  * Убирает технические поля сериализации, оставляя только применимые свойства.
6823
6823
  */
6824
6824
  static _prepareSerializableProps(t) {
6825
- const e = P({}, t);
6825
+ const e = z({}, t);
6826
6826
  return delete e.svgMarkup, delete e.objects, delete e.path, delete e.paths, delete e.type, delete e.version, e;
6827
6827
  }
6828
6828
  /**
@@ -6875,7 +6875,7 @@ class Z {
6875
6875
  useRelativePositions: r,
6876
6876
  centerKeys: {
6877
6877
  x: Jt,
6878
- y: _e
6878
+ y: Te
6879
6879
  }
6880
6880
  }), { scaleX: u, scaleY: f } = t, p = nt({ value: u, fallback: 1 }), m = nt({ value: f, fallback: 1 }), g = Z._getPositioningBounds({
6881
6881
  bounds: n,
@@ -6883,7 +6883,7 @@ class Z {
6883
6883
  baseHeight: o,
6884
6884
  scale: e,
6885
6885
  useRelativePositions: r,
6886
- anchorX: Z._resolveAnchor(c, ge),
6886
+ anchorX: Z._resolveAnchor(c, fe),
6887
6887
  anchorY: Z._resolveAnchor(c, De)
6888
6888
  }), y = Qs({
6889
6889
  normalizedX: l,
@@ -6895,7 +6895,7 @@ class Z {
6895
6895
  t.set({
6896
6896
  scaleX: b,
6897
6897
  scaleY: w
6898
- }), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[Jt], delete c[_e], delete c[ge], delete c[De];
6898
+ }), t.setPositionByOrigin(y, "center", "center"), t.setCoords(), delete c[Jt], delete c[Te], delete c[fe], delete c[De];
6899
6899
  }
6900
6900
  /**
6901
6901
  * Возвращает bounds, в которых должны позиционироваться нормализованные объекты.
@@ -6943,7 +6943,7 @@ class Z {
6943
6943
  fallback: e
6944
6944
  }) {
6945
6945
  const { width: n, height: s } = e, r = t || {}, { baseWidth: i = n, baseHeight: o = s } = r, a = St(r, ["baseWidth", "baseHeight"]);
6946
- return P({
6946
+ return z({
6947
6947
  baseWidth: i,
6948
6948
  baseHeight: o
6949
6949
  }, a);
@@ -6980,12 +6980,12 @@ class Z {
6980
6980
  object: t,
6981
6981
  baseWidth: e
6982
6982
  }) {
6983
- var D, B;
6983
+ var E, L;
6984
6984
  if (!(t instanceof rt)) return;
6985
6985
  const n = typeof t.text == "string" ? t.text : "";
6986
6986
  if (!n) return;
6987
6987
  const s = nt({
6988
- value: (B = (D = this.editor) == null ? void 0 : D.montageArea) == null ? void 0 : B.width,
6988
+ value: (L = (E = this.editor) == null ? void 0 : E.montageArea) == null ? void 0 : L.width,
6989
6989
  fallback: 0
6990
6990
  }), {
6991
6991
  width: i = 0,
@@ -6994,16 +6994,16 @@ class Z {
6994
6994
  } = t, r = nt({ value: e, fallback: 0 }), c = t, l = nt({ value: c.paddingLeft, fallback: 0 }), d = nt({ value: c.paddingRight, fallback: 0 }), u = nt({ value: o, fallback: 1 }), f = nt({ value: a, fallback: 0 }) * u, p = nt({ value: i, fallback: 0 }), m = p * u, g = l * u, y = d * u, b = m + g + y + f;
6995
6995
  if (!s || !p || !r) return;
6996
6996
  t.setCoords();
6997
- const w = t, v = w[Jt], C = typeof v == "number" ? v : null, O = Z._resolveAnchor(w, ge), j = b / r, S = C !== null ? C - j / 2 : null, A = C !== null ? C + j / 2 : null, M = t.getCenterPoint();
6997
+ const w = t, S = w[Jt], I = typeof S == "number" ? S : null, j = Z._resolveAnchor(w, fe), A = b / r, M = I !== null ? I - A / 2 : null, C = I !== null ? I + A / 2 : null, v = t.getCenterPoint();
6998
6998
  t.set("width", s), t.initDimensions();
6999
- const E = Z._getLongestLineWidth({
6999
+ const O = Z._getLongestLineWidth({
7000
7000
  textbox: t,
7001
7001
  text: n
7002
- }), I = E > p ? E + 1 : p;
7003
- t.set("width", I), t.initDimensions(), t.setPositionByOrigin(M, "center", "center"), t.setCoords();
7004
- const F = (I * u + g + y + f) / r;
7005
- let U = C;
7006
- O === "start" && S !== null ? U = Math.max(0, S) + F / 2 : O === "end" && A !== null && (U = Math.min(1, A) - F / 2), typeof U == "number" && (w[Jt] = U);
7002
+ }), D = O > p ? O + 1 : p;
7003
+ t.set("width", D), t.initDimensions(), t.setPositionByOrigin(v, "center", "center"), t.setCoords();
7004
+ const U = (D * u + g + y + f) / r;
7005
+ let F = I;
7006
+ j === "start" && M !== null ? F = Math.max(0, M) + U / 2 : j === "end" && C !== null && (F = Math.min(1, C) - U / 2), typeof F == "number" && (w[Jt] = F);
7007
7007
  }
7008
7008
  /**
7009
7009
  * Возвращает ширину самой длинной строки текстового объекта.
@@ -7035,8 +7035,8 @@ class Z {
7035
7035
  }) {
7036
7036
  const o = t.toDatalessObject([...ze]);
7037
7037
  if (Z._isSvgObject(t)) {
7038
- const v = Z._extractSvgMarkup(t);
7039
- v && (o.svgMarkup = v, delete o.objects, delete o.path);
7038
+ const S = Z._extractSvgMarkup(t);
7039
+ S && (o.svgMarkup = S, delete o.objects, delete o.path);
7040
7040
  }
7041
7041
  if (!e) return o;
7042
7042
  const {
@@ -7049,13 +7049,13 @@ class Z {
7049
7049
  montageArea: i,
7050
7050
  bounds: e
7051
7051
  }), m = p != null ? p : (() => {
7052
- const v = t.getCenterPoint();
7052
+ const S = t.getCenterPoint();
7053
7053
  return {
7054
- x: (v.x - a) / u,
7055
- y: (v.y - r) / f
7054
+ x: (S.x - a) / u,
7055
+ y: (S.y - r) / f
7056
7056
  };
7057
7057
  })(), g = (d.left - a) / u, y = (d.top - r) / f, b = g + d.width / u, w = y + d.height / f;
7058
- return o[Jt] = m.x, o[_e] = m.y, o[ge] = Z._detectAnchor({
7058
+ return o[Jt] = m.x, o[Te] = m.y, o[fe] = Z._detectAnchor({
7059
7059
  center: m.x,
7060
7060
  start: g,
7061
7061
  end: b
@@ -7117,7 +7117,7 @@ class Z {
7117
7117
  n.emitWarning({
7118
7118
  origin: "TemplateManager",
7119
7119
  method: "applyTemplate",
7120
- code: Dt.TEMPLATE_MANAGER.APPLY_FAILED,
7120
+ code: _t.TEMPLATE_MANAGER.APPLY_FAILED,
7121
7121
  message: "Не удалось применить фон из шаблона",
7122
7122
  data: i
7123
7123
  });
@@ -7147,7 +7147,7 @@ class Z {
7147
7147
  */
7148
7148
  static _cloneCustomData(t) {
7149
7149
  if (!(!t || typeof t != "object"))
7150
- return P({}, t);
7150
+ return z({}, t);
7151
7151
  }
7152
7152
  /**
7153
7153
  * Извлекает src изображения из FabricImage или его исходного элемента.
@@ -7176,7 +7176,7 @@ class Z {
7176
7176
  return bt.enlivenObjectEnlivables(t);
7177
7177
  }
7178
7178
  }
7179
- const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7179
+ const _e = 5, xn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Se = ({
7180
7180
  distance: h
7181
7181
  }) => {
7182
7182
  if (!Number.isFinite(h)) return 0;
@@ -7186,7 +7186,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7186
7186
  firstDistance: h,
7187
7187
  secondDistance: t
7188
7188
  }) => {
7189
- const e = Me({ distance: h }), n = Me({ distance: t }), s = Math.abs(e - n), i = Math.max(e, n);
7189
+ const e = Se({ distance: h }), n = Se({ distance: t }), s = Math.abs(e - n), i = Math.max(e, n);
7190
7190
  return {
7191
7191
  firstDisplayDistance: e,
7192
7192
  secondDisplayDistance: n,
@@ -7198,7 +7198,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7198
7198
  firstEnd: t,
7199
7199
  secondStart: e,
7200
7200
  secondEnd: n
7201
- }) => Math.min(t, n) - Math.max(h, e), xn = ({
7201
+ }) => Math.min(t, n) - Math.max(h, e), Rn = ({
7202
7202
  step: h
7203
7203
  }) => {
7204
7204
  const e = Math.abs(h).toString(), n = e.indexOf(".");
@@ -7207,15 +7207,15 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7207
7207
  value: h,
7208
7208
  step: t
7209
7209
  }) => {
7210
- const e = xn({ step: t }), n = Math.round(h / t) * t;
7210
+ const e = Rn({ step: t }), n = Math.round(h / t) * t;
7211
7211
  return Number(n.toFixed(e));
7212
- }, Rn = ({
7212
+ }, kn = ({
7213
7213
  value: h,
7214
7214
  step: t
7215
7215
  }) => {
7216
- const e = Ot({ value: h, step: t }), n = xn({ step: t }), s = Oe(10, -(n + 4));
7216
+ const e = Ot({ value: h, step: t }), n = Rn({ step: t }), s = Ie(10, -(n + 4));
7217
7217
  return Math.abs(e - h) <= s;
7218
- }, ee = ({
7218
+ }, xe = ({
7219
7219
  bounds: h,
7220
7220
  axis: t
7221
7221
  }) => {
@@ -7232,7 +7232,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7232
7232
  start: e,
7233
7233
  end: n
7234
7234
  };
7235
- }, kn = ({
7235
+ }, Bn = ({
7236
7236
  items: h,
7237
7237
  axis: t
7238
7238
  }) => {
@@ -7246,7 +7246,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7246
7246
  }
7247
7247
  h[o + 1] = n;
7248
7248
  }
7249
- }, we = ({
7249
+ }, Me = ({
7250
7250
  items: h,
7251
7251
  index: t,
7252
7252
  axis: e,
@@ -7254,7 +7254,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7254
7254
  }) => {
7255
7255
  const s = h[t];
7256
7256
  if (!s) return null;
7257
- const { bounds: i } = s, { start: o, end: a } = ee({
7257
+ const { bounds: i } = s, { start: o, end: a } = xe({
7258
7258
  bounds: i,
7259
7259
  axis: e
7260
7260
  });
@@ -7262,7 +7262,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7262
7262
  for (let r = t - 1; r >= 0; r -= 1) {
7263
7263
  const c = h[r];
7264
7264
  if (!c) continue;
7265
- const { bounds: l } = c, { end: d } = ee({
7265
+ const { bounds: l } = c, { end: d } = xe({
7266
7266
  bounds: l,
7267
7267
  axis: e
7268
7268
  });
@@ -7273,14 +7273,14 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7273
7273
  for (let r = t + 1; r < h.length; r += 1) {
7274
7274
  const c = h[r];
7275
7275
  if (!c) continue;
7276
- const { bounds: l } = c, { start: d } = ee({
7276
+ const { bounds: l } = c, { start: d } = xe({
7277
7277
  bounds: l,
7278
7278
  axis: e
7279
7279
  });
7280
7280
  if (d - a >= 0) return r;
7281
7281
  }
7282
7282
  return null;
7283
- }, Bn = ({
7283
+ }, Nn = ({
7284
7284
  items: h
7285
7285
  }) => {
7286
7286
  for (let t = 0; t < h.length; t += 1) {
@@ -7288,47 +7288,20 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7288
7288
  if (e) return t;
7289
7289
  }
7290
7290
  return -1;
7291
- }, Nn = ({
7292
- items: h,
7293
- axis: t
7294
- }) => {
7295
- const e = [];
7296
- for (let n = 0; n < h.length - 1; n += 1) {
7297
- const s = h[n];
7298
- if (!s) continue;
7299
- const { bounds: i } = s, { end: o } = ee({
7300
- bounds: i,
7301
- axis: t
7302
- });
7303
- for (let a = n + 1; a < h.length; a += 1) {
7304
- const r = h[a];
7305
- if (!r) continue;
7306
- const { bounds: c } = r, { start: l } = ee({
7307
- bounds: c,
7308
- axis: t
7309
- }), d = l - o;
7310
- if (!(d < 0)) {
7311
- e.push({
7312
- beforeIndex: n,
7313
- afterIndex: a,
7314
- start: o,
7315
- end: l,
7316
- distance: d
7317
- });
7318
- break;
7319
- }
7320
- }
7321
- }
7322
- return e;
7323
7291
  }, Pn = ({
7324
- beforeIndex: h,
7325
- afterIndex: t,
7326
- activeIndex: e
7327
- }) => h < e && t < e, zn = ({
7328
- beforeIndex: h,
7329
- afterIndex: t,
7330
- activeIndex: e
7331
- }) => h > e && t > e, ii = ({
7292
+ patternAxis: h,
7293
+ activeRangeStart: t,
7294
+ activeRangeEnd: e,
7295
+ tolerance: n = 0
7296
+ }) => {
7297
+ const s = Math.min(t, e), i = Math.max(t, e);
7298
+ return h >= s - n && h <= i + n;
7299
+ }, zn = ({
7300
+ patternStart: h,
7301
+ patternEnd: t,
7302
+ activeStart: e,
7303
+ activeEnd: n
7304
+ }) => t <= e ? "before" : h >= n ? "after" : null, ii = ({
7332
7305
  baseOption: h,
7333
7306
  candidateOption: t
7334
7307
  }) => {
@@ -7355,7 +7328,34 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7355
7328
  s < i && (t = n);
7356
7329
  }
7357
7330
  return t;
7358
- }, xe = ({
7331
+ }, An = ({
7332
+ currentOption: h,
7333
+ nextOption: t
7334
+ }) => {
7335
+ if (!h) return !0;
7336
+ const { contextDistance: e, diff: n, delta: s } = h, { contextDistance: i, diff: o, delta: a } = t;
7337
+ return i < e ? !0 : i > e ? !1 : o < n ? !0 : o > n ? !1 : Math.abs(a) < Math.abs(s);
7338
+ }, ai = ({
7339
+ options: h
7340
+ }) => {
7341
+ const t = [];
7342
+ let e = null, n = null;
7343
+ for (const s of h) {
7344
+ const { kind: i, side: o } = s;
7345
+ if (i !== "reference") {
7346
+ t.push(s);
7347
+ continue;
7348
+ }
7349
+ o === "before" && An({
7350
+ currentOption: e,
7351
+ nextOption: s
7352
+ }) && (e = s), o === "after" && An({
7353
+ currentOption: n,
7354
+ nextOption: s
7355
+ }) && (n = s);
7356
+ }
7357
+ return e && t.push(e), n && t.push(n), t;
7358
+ }, Le = ({
7359
7359
  options: h,
7360
7360
  side: t,
7361
7361
  baseOption: e
@@ -7375,7 +7375,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7375
7375
  o < a && (n = s);
7376
7376
  }
7377
7377
  return n;
7378
- }, ai = ({
7378
+ }, ri = ({
7379
7379
  guides: h,
7380
7380
  seenGuideKeys: t,
7381
7381
  guide: e
@@ -7398,30 +7398,33 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7398
7398
  delta: 0,
7399
7399
  guides: []
7400
7400
  };
7401
- const t = oi({ options: h }), e = xe({
7402
- options: h,
7401
+ const t = ai({ options: h }), e = [];
7402
+ for (const f of t)
7403
+ f.kind === "reference" && e.push(f);
7404
+ const n = e.length > 0, s = n ? e : t, i = oi({ options: s }), o = Le({
7405
+ options: s,
7403
7406
  side: "before",
7404
- baseOption: t
7405
- }), n = xe({
7406
- options: h,
7407
- side: "center",
7408
- baseOption: t
7409
- }), s = xe({
7410
- options: h,
7407
+ baseOption: i
7408
+ }), a = Le({
7409
+ options: s,
7411
7410
  side: "after",
7412
- baseOption: t
7413
- }), i = [];
7414
- e && s ? i.push(e, s) : (i.push(t), t.side === "before" && s && i.push(s), t.side === "after" && e && i.push(e), t.side === "center" && (e && !s && i.push(e), s && !e && i.push(s))), !i.length && n && i.push(n);
7415
- const o = [], a = /* @__PURE__ */ new Set();
7416
- for (const r of i)
7417
- ai({
7418
- guides: o,
7419
- seenGuideKeys: a,
7420
- guide: r.guide
7411
+ baseOption: i
7412
+ }), c = Le({
7413
+ options: n ? t : s,
7414
+ side: "center",
7415
+ baseOption: i
7416
+ }), l = [];
7417
+ o && a ? l.push(o, a) : (l.push(i), i.side === "before" && a && l.push(a), i.side === "after" && o && l.push(o), i.side === "center" && (o && !a && l.push(o), a && !o && l.push(a)), n && i.side === "before" && !a && c && l.push(c), n && i.side === "after" && !o && c && l.push(c)), !l.length && c && l.push(c);
7418
+ const d = [], u = /* @__PURE__ */ new Set();
7419
+ for (const f of l)
7420
+ ri({
7421
+ guides: d,
7422
+ seenGuideKeys: u,
7423
+ guide: f.guide
7421
7424
  });
7422
7425
  return {
7423
- delta: t.delta,
7424
- guides: o
7426
+ delta: i.delta,
7427
+ guides: d
7425
7428
  };
7426
7429
  }, Un = ({
7427
7430
  activeStart: h,
@@ -7446,30 +7449,29 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7446
7449
  Math.abs(m - e),
7447
7450
  Math.abs(g - e)
7448
7451
  ) > i) continue;
7449
- const v = Math.abs(m - g), C = Math.abs(u - a), O = v + y * 0.5 + C * 1e-3;
7450
- (!l || O < l.diff) && (l = {
7452
+ const S = Math.abs(m - g), I = Math.abs(u - a), j = S + y * 0.5 + I * 1e-3;
7453
+ (!l || j < l.diff) && (l = {
7451
7454
  delta: u,
7452
7455
  distance: b,
7453
- diff: O,
7456
+ diff: j,
7454
7457
  activeStart: p,
7455
7458
  activeEnd: p + b
7456
7459
  });
7457
7460
  }
7458
7461
  return l;
7459
- }, Ae = ({
7462
+ }, we = ({
7460
7463
  currentGap: h,
7461
7464
  referenceGap: t
7462
7465
  }) => {
7463
7466
  const {
7464
- secondDisplayDistance: e,
7465
- displayDistanceDiff: n,
7466
- commonDisplayDistance: s
7467
+ firstDisplayDistance: e,
7468
+ displayDistanceDiff: n
7467
7469
  } = Je({
7468
7470
  firstDistance: h,
7469
7471
  secondDistance: t
7470
7472
  });
7471
- return n > qe ? e : s;
7472
- }, An = ({
7473
+ return n > qe ? null : e;
7474
+ }, jn = ({
7473
7475
  anchors: h,
7474
7476
  positions: t,
7475
7477
  threshold: e
@@ -7484,16 +7486,16 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7484
7486
  delta: n,
7485
7487
  guidePosition: i
7486
7488
  };
7487
- }, jn = ({
7489
+ }, Cn = ({
7488
7490
  activeBounds: h,
7489
7491
  threshold: t,
7490
7492
  anchors: e
7491
7493
  }) => {
7492
- const { left: n, right: s, centerX: i, top: o, bottom: a, centerY: r } = h, c = An({
7494
+ const { left: n, right: s, centerX: i, top: o, bottom: a, centerY: r } = h, c = jn({
7493
7495
  anchors: e.vertical,
7494
7496
  positions: [n, i, s],
7495
7497
  threshold: t
7496
- }), l = An({
7498
+ }), l = jn({
7497
7499
  anchors: e.horizontal,
7498
7500
  positions: [o, r, a],
7499
7501
  threshold: t
@@ -7509,7 +7511,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7509
7511
  deltaY: l.delta,
7510
7512
  guides: d
7511
7513
  };
7512
- }, ri = ({
7514
+ }, ci = ({
7513
7515
  activeBounds: h,
7514
7516
  candidates: t,
7515
7517
  threshold: e,
@@ -7524,12 +7526,12 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7524
7526
  } = h, c = [];
7525
7527
  for (const j of t) {
7526
7528
  const {
7527
- left: S,
7528
- right: A
7529
+ left: A,
7530
+ right: M
7529
7531
  } = j;
7530
7532
  Ln({
7531
- firstStart: S,
7532
- firstEnd: A,
7533
+ firstStart: A,
7534
+ firstEnd: M,
7533
7535
  secondStart: a,
7534
7536
  secondEnd: r
7535
7537
  }) > 0 && c.push(j);
@@ -7539,138 +7541,150 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7539
7541
  const l = [];
7540
7542
  for (const j of c)
7541
7543
  l.push({ bounds: j, isActive: !1 });
7542
- l.push({ bounds: h, isActive: !0 }), kn({ items: l, axis: "top" });
7543
- const d = Bn({ items: l });
7544
+ l.push({ bounds: h, isActive: !0 }), Bn({ items: l, axis: "top" });
7545
+ const d = Nn({ items: l });
7544
7546
  if (d === -1)
7545
7547
  return { delta: 0, guides: [] };
7546
- const u = [], f = o - i, p = we({
7548
+ const u = [], f = o - i, p = Me({
7547
7549
  items: l,
7548
7550
  index: d,
7549
7551
  axis: "vertical",
7550
7552
  direction: "prev"
7551
- }), m = we({
7553
+ }), m = Me({
7552
7554
  items: l,
7553
7555
  index: d,
7554
7556
  axis: "vertical",
7555
7557
  direction: "next"
7556
7558
  }), g = p === null ? null : l[p], y = m === null ? null : l[m];
7557
7559
  if (g && y) {
7558
- const { bounds: j } = g, { bounds: S } = y, { bottom: A } = j, { top: M } = S, I = M - A - f;
7559
- if (I >= 0) {
7560
- const z = I / 2, F = Ot({ value: z, step: lt }), U = i - A, D = M - o, B = Math.abs(U - F), N = Math.abs(D - F);
7561
- if (Math.max(B, N) <= e) {
7562
- const k = Un({
7560
+ const { bounds: j } = g, { bounds: A } = y, { bottom: M } = j, { top: C } = A, O = C - M - f;
7561
+ if (O >= 0) {
7562
+ const D = O / 2, B = Ot({ value: D, step: lt }), U = i - M, F = C - o, E = Math.abs(U - B), L = Math.abs(F - B);
7563
+ if (Math.max(E, L) <= e) {
7564
+ const _ = Un({
7563
7565
  activeStart: i,
7564
7566
  activeEnd: o,
7565
- targetGap: F,
7566
- beforeEdge: A,
7567
- afterEdge: M,
7567
+ targetGap: B,
7568
+ beforeEdge: M,
7569
+ afterEdge: C,
7568
7570
  threshold: e,
7569
7571
  step: lt
7570
7572
  });
7571
- if (k) {
7573
+ if (_) {
7572
7574
  const {
7573
- delta: T,
7574
- distance: _,
7575
+ delta: R,
7576
+ distance: T,
7575
7577
  diff: x,
7576
- activeStart: L,
7577
- activeEnd: V
7578
- } = k, W = {
7578
+ activeStart: P,
7579
+ activeEnd: k
7580
+ } = _, V = {
7579
7581
  type: "vertical",
7580
7582
  axis: s,
7581
- refStart: A,
7582
- refEnd: A + _,
7583
- activeStart: L,
7584
- activeEnd: V,
7585
- distance: _
7583
+ refStart: M,
7584
+ refEnd: M + T,
7585
+ activeStart: P,
7586
+ activeEnd: k,
7587
+ distance: T
7586
7588
  };
7587
7589
  u.push({
7588
- delta: T,
7589
- guide: W,
7590
+ delta: R,
7591
+ guide: V,
7590
7592
  diff: x,
7591
- side: "center"
7593
+ side: "center",
7594
+ kind: "center",
7595
+ contextDistance: 0
7592
7596
  });
7593
7597
  }
7594
7598
  }
7595
7599
  }
7596
7600
  }
7597
- const b = Nn({ items: l, axis: "vertical" });
7598
- let w = null, v = null, C = null, O = null;
7601
+ let b = null, w = null, S = null, I = null;
7599
7602
  if (g) {
7600
- C = g.bounds;
7601
- const { bottom: j } = C, S = i - j;
7602
- S >= 0 && (w = S);
7603
+ S = g.bounds;
7604
+ const { bottom: j } = S, A = i - j;
7605
+ A >= 0 && (b = A);
7603
7606
  }
7604
7607
  if (y) {
7605
- O = y.bounds;
7606
- const { top: j } = O, S = j - o;
7607
- S >= 0 && (v = S);
7608
+ I = y.bounds;
7609
+ const { top: j } = I, A = j - o;
7610
+ A >= 0 && (w = A);
7608
7611
  }
7609
- for (const j of b) {
7612
+ for (const j of n) {
7610
7613
  const {
7611
- beforeIndex: S,
7612
- afterIndex: A,
7614
+ axis: A,
7613
7615
  start: M,
7614
- end: E,
7615
- distance: I
7616
+ end: C,
7617
+ distance: v
7616
7618
  } = j;
7617
- if (S === d || A === d || !Rn({ value: I, step: lt })) continue;
7618
- const F = Pn({
7619
- beforeIndex: S,
7620
- afterIndex: A,
7621
- activeIndex: d
7622
- }), U = zn({
7623
- beforeIndex: S,
7624
- afterIndex: A,
7625
- activeIndex: d
7619
+ if (!kn({ value: v, step: lt }) || !Pn({
7620
+ patternAxis: A,
7621
+ activeRangeStart: a,
7622
+ activeRangeEnd: r,
7623
+ tolerance: e
7624
+ })) continue;
7625
+ const B = zn({
7626
+ patternStart: M,
7627
+ patternEnd: C,
7628
+ activeStart: i,
7629
+ activeEnd: o
7626
7630
  });
7627
- if (w !== null && C && F && Math.abs(w - I) <= e) {
7628
- const B = I - w, N = Ot({ value: B, step: lt }), R = i + N, { bottom: k } = C, T = R - k, _ = Math.abs(T - I);
7629
- if (_ > e) continue;
7630
- const x = Ae({
7631
- currentGap: T,
7632
- referenceGap: I
7633
- }), L = {
7634
- type: "vertical",
7635
- axis: s,
7636
- refStart: M,
7637
- refEnd: E,
7638
- activeStart: k,
7639
- activeEnd: R,
7640
- distance: x
7641
- };
7642
- u.push({
7643
- delta: N,
7644
- guide: L,
7645
- diff: _,
7646
- side: "before"
7647
- });
7648
- }
7649
- if (v !== null && O && U && Math.abs(v - I) <= e) {
7650
- const B = v - I, N = Ot({ value: B, step: lt }), R = o + N, { top: k } = O, T = k - R, _ = Math.abs(T - I);
7651
- if (_ > e) continue;
7652
- const x = Ae({
7653
- currentGap: T,
7654
- referenceGap: I
7655
- }), L = {
7656
- type: "vertical",
7657
- axis: s,
7658
- refStart: M,
7659
- refEnd: E,
7660
- activeStart: R,
7661
- activeEnd: k,
7662
- distance: x
7663
- };
7664
- u.push({
7665
- delta: N,
7666
- guide: L,
7667
- diff: _,
7668
- side: "after"
7669
- });
7631
+ if (B) {
7632
+ if (b !== null && S && B === "before" && Math.abs(b - v) <= e) {
7633
+ const F = v - b, E = Ot({ value: F, step: lt }), L = i + E, { bottom: N } = S, _ = L - N, R = Math.abs(_ - v);
7634
+ if (R > e) continue;
7635
+ const T = we({
7636
+ currentGap: _,
7637
+ referenceGap: v
7638
+ });
7639
+ if (T === null) continue;
7640
+ const x = {
7641
+ type: "vertical",
7642
+ axis: s,
7643
+ refStart: M,
7644
+ refEnd: C,
7645
+ activeStart: N,
7646
+ activeEnd: L,
7647
+ distance: T
7648
+ };
7649
+ u.push({
7650
+ delta: E,
7651
+ guide: x,
7652
+ diff: R,
7653
+ side: "before",
7654
+ kind: "reference",
7655
+ contextDistance: i - C
7656
+ });
7657
+ }
7658
+ if (w !== null && I && B === "after" && Math.abs(w - v) <= e) {
7659
+ const F = w - v, E = Ot({ value: F, step: lt }), L = o + E, { top: N } = I, _ = N - L, R = Math.abs(_ - v);
7660
+ if (R > e) continue;
7661
+ const T = we({
7662
+ currentGap: _,
7663
+ referenceGap: v
7664
+ });
7665
+ if (T === null) continue;
7666
+ const x = {
7667
+ type: "vertical",
7668
+ axis: s,
7669
+ refStart: M,
7670
+ refEnd: C,
7671
+ activeStart: L,
7672
+ activeEnd: N,
7673
+ distance: T
7674
+ };
7675
+ u.push({
7676
+ delta: E,
7677
+ guide: x,
7678
+ diff: R,
7679
+ side: "after",
7680
+ kind: "reference",
7681
+ contextDistance: M - o
7682
+ });
7683
+ }
7670
7684
  }
7671
7685
  }
7672
7686
  return Fn({ options: u });
7673
- }, ci = ({
7687
+ }, li = ({
7674
7688
  activeBounds: h,
7675
7689
  candidates: t,
7676
7690
  threshold: e,
@@ -7685,12 +7699,12 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7685
7699
  } = h, c = [];
7686
7700
  for (const j of t) {
7687
7701
  const {
7688
- top: S,
7689
- bottom: A
7702
+ top: A,
7703
+ bottom: M
7690
7704
  } = j;
7691
7705
  Ln({
7692
- firstStart: S,
7693
- firstEnd: A,
7706
+ firstStart: A,
7707
+ firstEnd: M,
7694
7708
  secondStart: a,
7695
7709
  secondEnd: r
7696
7710
  }) > 0 && c.push(j);
@@ -7700,134 +7714,146 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7700
7714
  const l = [];
7701
7715
  for (const j of c)
7702
7716
  l.push({ bounds: j, isActive: !1 });
7703
- l.push({ bounds: h, isActive: !0 }), kn({ items: l, axis: "left" });
7704
- const d = Bn({ items: l });
7717
+ l.push({ bounds: h, isActive: !0 }), Bn({ items: l, axis: "left" });
7718
+ const d = Nn({ items: l });
7705
7719
  if (d === -1)
7706
7720
  return { delta: 0, guides: [] };
7707
- const u = [], f = o - i, p = we({
7721
+ const u = [], f = o - i, p = Me({
7708
7722
  items: l,
7709
7723
  index: d,
7710
7724
  axis: "horizontal",
7711
7725
  direction: "prev"
7712
- }), m = we({
7726
+ }), m = Me({
7713
7727
  items: l,
7714
7728
  index: d,
7715
7729
  axis: "horizontal",
7716
7730
  direction: "next"
7717
7731
  }), g = p === null ? null : l[p], y = m === null ? null : l[m];
7718
7732
  if (g && y) {
7719
- const { bounds: j } = g, { bounds: S } = y, { right: A } = j, { left: M } = S, I = M - A - f;
7720
- if (I >= 0) {
7721
- const z = I / 2, F = Ot({ value: z, step: lt }), U = i - A, D = M - o, B = Math.abs(U - F), N = Math.abs(D - F);
7722
- if (Math.max(B, N) <= e) {
7723
- const k = Un({
7733
+ const { bounds: j } = g, { bounds: A } = y, { right: M } = j, { left: C } = A, O = C - M - f;
7734
+ if (O >= 0) {
7735
+ const D = O / 2, B = Ot({ value: D, step: lt }), U = i - M, F = C - o, E = Math.abs(U - B), L = Math.abs(F - B);
7736
+ if (Math.max(E, L) <= e) {
7737
+ const _ = Un({
7724
7738
  activeStart: i,
7725
7739
  activeEnd: o,
7726
- targetGap: F,
7727
- beforeEdge: A,
7728
- afterEdge: M,
7740
+ targetGap: B,
7741
+ beforeEdge: M,
7742
+ afterEdge: C,
7729
7743
  threshold: e,
7730
7744
  step: lt
7731
7745
  });
7732
- if (k) {
7746
+ if (_) {
7733
7747
  const {
7734
- delta: T,
7735
- distance: _,
7748
+ delta: R,
7749
+ distance: T,
7736
7750
  diff: x,
7737
- activeStart: L,
7738
- activeEnd: V
7739
- } = k, W = {
7751
+ activeStart: P,
7752
+ activeEnd: k
7753
+ } = _, V = {
7740
7754
  type: "horizontal",
7741
7755
  axis: s,
7742
- refStart: A,
7743
- refEnd: A + _,
7744
- activeStart: L,
7745
- activeEnd: V,
7746
- distance: _
7756
+ refStart: M,
7757
+ refEnd: M + T,
7758
+ activeStart: P,
7759
+ activeEnd: k,
7760
+ distance: T
7747
7761
  };
7748
7762
  u.push({
7749
- delta: T,
7750
- guide: W,
7763
+ delta: R,
7764
+ guide: V,
7751
7765
  diff: x,
7752
- side: "center"
7766
+ side: "center",
7767
+ kind: "center",
7768
+ contextDistance: 0
7753
7769
  });
7754
7770
  }
7755
7771
  }
7756
7772
  }
7757
7773
  }
7758
- const b = Nn({ items: l, axis: "horizontal" });
7759
- let w = null, v = null, C = null, O = null;
7774
+ let b = null, w = null, S = null, I = null;
7760
7775
  if (g) {
7761
- C = g.bounds;
7762
- const { right: j } = C, S = i - j;
7763
- S >= 0 && (w = S);
7776
+ S = g.bounds;
7777
+ const { right: j } = S, A = i - j;
7778
+ A >= 0 && (b = A);
7764
7779
  }
7765
7780
  if (y) {
7766
- O = y.bounds;
7767
- const { left: j } = O, S = j - o;
7768
- S >= 0 && (v = S);
7781
+ I = y.bounds;
7782
+ const { left: j } = I, A = j - o;
7783
+ A >= 0 && (w = A);
7769
7784
  }
7770
- for (const j of b) {
7785
+ for (const j of n) {
7771
7786
  const {
7772
- beforeIndex: S,
7773
- afterIndex: A,
7787
+ axis: A,
7774
7788
  start: M,
7775
- end: E,
7776
- distance: I
7789
+ end: C,
7790
+ distance: v
7777
7791
  } = j;
7778
- if (S === d || A === d || !Rn({ value: I, step: lt })) continue;
7779
- const F = Pn({
7780
- beforeIndex: S,
7781
- afterIndex: A,
7782
- activeIndex: d
7783
- }), U = zn({
7784
- beforeIndex: S,
7785
- afterIndex: A,
7786
- activeIndex: d
7792
+ if (!kn({ value: v, step: lt }) || !Pn({
7793
+ patternAxis: A,
7794
+ activeRangeStart: a,
7795
+ activeRangeEnd: r,
7796
+ tolerance: e
7797
+ })) continue;
7798
+ const B = zn({
7799
+ patternStart: M,
7800
+ patternEnd: C,
7801
+ activeStart: i,
7802
+ activeEnd: o
7787
7803
  });
7788
- if (w !== null && C && F && Math.abs(w - I) <= e) {
7789
- const B = I - w, N = Ot({ value: B, step: lt }), R = i + N, { right: k } = C, T = R - k, _ = Math.abs(T - I);
7790
- if (_ > e) continue;
7791
- const x = Ae({
7792
- currentGap: T,
7793
- referenceGap: I
7794
- }), L = {
7795
- type: "horizontal",
7796
- axis: s,
7797
- refStart: M,
7798
- refEnd: E,
7799
- activeStart: k,
7800
- activeEnd: R,
7801
- distance: x
7802
- };
7803
- u.push({
7804
- delta: N,
7805
- guide: L,
7806
- diff: _,
7807
- side: "before"
7808
- });
7809
- }
7810
- if (v !== null && O && U && Math.abs(v - I) <= e) {
7811
- const B = v - I, N = Ot({ value: B, step: lt }), R = o + N, { left: k } = O, T = k - R, _ = Math.abs(T - I);
7812
- if (_ > e) continue;
7813
- const x = Ae({
7814
- currentGap: T,
7815
- referenceGap: I
7816
- }), L = {
7817
- type: "horizontal",
7818
- axis: s,
7819
- refStart: M,
7820
- refEnd: E,
7821
- activeStart: R,
7822
- activeEnd: k,
7823
- distance: x
7824
- };
7825
- u.push({
7826
- delta: N,
7827
- guide: L,
7828
- diff: _,
7829
- side: "after"
7830
- });
7804
+ if (B) {
7805
+ if (b !== null && S && B === "before" && Math.abs(b - v) <= e) {
7806
+ const F = v - b, E = Ot({ value: F, step: lt }), L = i + E, { right: N } = S, _ = L - N, R = Math.abs(_ - v);
7807
+ if (R > e) continue;
7808
+ const T = we({
7809
+ currentGap: _,
7810
+ referenceGap: v
7811
+ });
7812
+ if (T === null) continue;
7813
+ const x = {
7814
+ type: "horizontal",
7815
+ axis: s,
7816
+ refStart: M,
7817
+ refEnd: C,
7818
+ activeStart: N,
7819
+ activeEnd: L,
7820
+ distance: T
7821
+ };
7822
+ u.push({
7823
+ delta: E,
7824
+ guide: x,
7825
+ diff: R,
7826
+ side: "before",
7827
+ kind: "reference",
7828
+ contextDistance: i - C
7829
+ });
7830
+ }
7831
+ if (w !== null && I && B === "after" && Math.abs(w - v) <= e) {
7832
+ const F = w - v, E = Ot({ value: F, step: lt }), L = o + E, { left: N } = I, _ = N - L, R = Math.abs(_ - v);
7833
+ if (R > e) continue;
7834
+ const T = we({
7835
+ currentGap: _,
7836
+ referenceGap: v
7837
+ });
7838
+ if (T === null) continue;
7839
+ const x = {
7840
+ type: "horizontal",
7841
+ axis: s,
7842
+ refStart: M,
7843
+ refEnd: C,
7844
+ activeStart: L,
7845
+ activeEnd: N,
7846
+ distance: T
7847
+ };
7848
+ u.push({
7849
+ delta: E,
7850
+ guide: x,
7851
+ diff: R,
7852
+ side: "after",
7853
+ kind: "reference",
7854
+ contextDistance: M - o
7855
+ });
7856
+ }
7831
7857
  }
7832
7858
  }
7833
7859
  return Fn({ options: u });
@@ -7837,12 +7863,12 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7837
7863
  threshold: e,
7838
7864
  spacingPatterns: n
7839
7865
  }) => {
7840
- const s = ri({
7866
+ const s = ci({
7841
7867
  activeBounds: h,
7842
7868
  candidates: t,
7843
7869
  threshold: e,
7844
7870
  patterns: n.vertical
7845
- }), i = ci({
7871
+ }), i = li({
7846
7872
  activeBounds: h,
7847
7873
  candidates: t,
7848
7874
  threshold: e,
@@ -7857,7 +7883,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7857
7883
  deltaY: s.delta,
7858
7884
  guides: o
7859
7885
  };
7860
- }, li = ({
7886
+ }, di = ({
7861
7887
  context: h,
7862
7888
  x: t,
7863
7889
  y: e,
@@ -7884,18 +7910,18 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7884
7910
  offsetAlongAxis: f = 0,
7885
7911
  offsetPerpendicular: p = 0
7886
7912
  }) => {
7887
- const m = o || 1, g = 12 / m, y = d / m, b = u / m, w = (n + s) / 2 + f, v = t === "vertical" ? e + p : w, C = t === "vertical" ? w : e + p;
7913
+ const m = o || 1, g = 12 / m, y = d / m, b = u / m, w = (n + s) / 2 + f, S = t === "vertical" ? e + p : w, I = t === "vertical" ? w : e + p;
7888
7914
  h.save(), h.setLineDash([]), h.fillStyle = a, h.strokeStyle = a, h.lineWidth = l / m, h.font = `${g}px ${c}`, h.textAlign = "center", h.textBaseline = "middle";
7889
- const j = h.measureText(i).width + y * 2, S = g + y * 2, A = v - j / 2, M = C - S / 2;
7890
- h.beginPath(), li({
7915
+ const A = h.measureText(i).width + y * 2, M = g + y * 2, C = S - A / 2, v = I - M / 2;
7916
+ h.beginPath(), di({
7891
7917
  context: h,
7892
- x: A,
7893
- y: M,
7894
- width: j,
7895
- height: S,
7918
+ x: C,
7919
+ y: v,
7920
+ width: A,
7921
+ height: M,
7896
7922
  radius: b
7897
- }), h.fill(), h.fillStyle = r, h.fillText(i, v, C), h.restore();
7898
- }, di = ({
7923
+ }), h.fill(), h.fillStyle = r, h.fillText(i, S, I), h.restore();
7924
+ }, hi = ({
7899
7925
  context: h,
7900
7926
  guide: t,
7901
7927
  zoom: e
@@ -7908,9 +7934,9 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7908
7934
  activeStart: a,
7909
7935
  activeEnd: r,
7910
7936
  distance: c
7911
- } = t, l = Me({ distance: c }).toString();
7937
+ } = t, l = Se({ distance: c }).toString();
7912
7938
  h.beginPath(), n === "vertical" ? (h.moveTo(s, i), h.lineTo(s, o), h.moveTo(s, a), h.lineTo(s, r)) : (h.moveTo(i, s), h.lineTo(o, s), h.moveTo(a, s), h.lineTo(r, s)), h.stroke();
7913
- const d = Dn;
7939
+ const d = xn;
7914
7940
  Ye({
7915
7941
  context: h,
7916
7942
  type: n,
@@ -7932,7 +7958,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7932
7958
  color: d,
7933
7959
  lineWidth: We
7934
7960
  });
7935
- }, Cn = ({
7961
+ }, On = ({
7936
7962
  anchors: h,
7937
7963
  bounds: t
7938
7964
  }) => {
@@ -7945,7 +7971,7 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7945
7971
  centerY: a
7946
7972
  } = t;
7947
7973
  h.vertical.push(e, s, n), h.horizontal.push(i, a, o);
7948
- }, On = ({
7974
+ }, En = ({
7949
7975
  bounds: h,
7950
7976
  type: t,
7951
7977
  primaryStart: e,
@@ -7972,30 +7998,30 @@ const Le = 5, Dn = "#3D8BF4", We = 1, lt = 1, si = 0.01, Me = ({
7972
7998
  });
7973
7999
  }
7974
8000
  return s;
7975
- }, hi = ({
8001
+ }, ui = ({
7976
8002
  bounds: h
7977
8003
  }) => {
7978
- const t = On({
8004
+ const t = En({
7979
8005
  bounds: h,
7980
8006
  type: "vertical",
7981
8007
  primaryStart: "top",
7982
8008
  primaryEnd: "bottom"
7983
- }), e = On({
8009
+ }), e = En({
7984
8010
  bounds: h,
7985
8011
  type: "horizontal",
7986
8012
  primaryStart: "left",
7987
8013
  primaryEnd: "right"
7988
8014
  });
7989
8015
  return { vertical: t, horizontal: e };
7990
- }, ui = ["montage-area", "background", "interaction-blocker"], me = ({
8016
+ }, fi = ["montage-area", "background", "interaction-blocker"], pe = ({
7991
8017
  activeObject: h
7992
8018
  }) => {
7993
8019
  const t = /* @__PURE__ */ new Set();
7994
8020
  return h && (t.add(h), h instanceof q && h.getObjects().forEach((e) => t.add(e))), t;
7995
- }, ye = ({
8021
+ }, me = ({
7996
8022
  object: h,
7997
8023
  excluded: t,
7998
- ignoredIds: e = ui
8024
+ ignoredIds: e = fi
7999
8025
  }) => {
8000
8026
  if (t.has(h)) return !0;
8001
8027
  const { visible: n = !0 } = h;
@@ -8066,33 +8092,33 @@ class X {
8066
8092
  this._clearGuides();
8067
8093
  return;
8068
8094
  }
8069
- const { canvas: o } = this, a = o.getZoom() || 1, r = Le / a, c = jn({
8095
+ const { canvas: o } = this, a = o.getZoom() || 1, r = _e / a, c = Cn({
8070
8096
  activeBounds: i,
8071
8097
  threshold: r,
8072
8098
  anchors: this.anchors
8073
8099
  }), { deltaX: l, deltaY: d } = c;
8074
8100
  if (l !== 0 || d !== 0) {
8075
- const { left: v = 0, top: C = 0 } = e;
8101
+ const { left: S = 0, top: I = 0 } = e;
8076
8102
  e.set({
8077
- left: v + l,
8078
- top: C + d
8103
+ left: S + l,
8104
+ top: I + d
8079
8105
  }), e.setCoords(), i = (y = gt({ object: e })) != null ? y : i;
8080
8106
  }
8081
- const u = this.cachedTargetBounds.length ? this.cachedTargetBounds : this._collectTargets({ activeObject: e }).map((v) => gt({ object: v })).filter((v) => !!v), f = In({
8107
+ const u = this._resolveCurrentTargetBounds({ activeObject: e }), f = In({
8082
8108
  activeBounds: i,
8083
8109
  candidates: u,
8084
8110
  threshold: r,
8085
8111
  spacingPatterns: this.spacingPatterns
8086
8112
  });
8087
8113
  if (f.deltaX !== 0 || f.deltaY !== 0) {
8088
- const { left: v = 0, top: C = 0 } = e;
8114
+ const { left: S = 0, top: I = 0 } = e;
8089
8115
  e.set({
8090
- left: v + f.deltaX,
8091
- top: C + f.deltaY
8116
+ left: S + f.deltaX,
8117
+ top: I + f.deltaY
8092
8118
  }), e.setCoords(), i = (b = gt({ object: e })) != null ? b : i;
8093
8119
  }
8094
8120
  X._applyMovementStep({ target: e });
8095
- const p = (w = gt({ object: e })) != null ? w : i, m = jn({
8121
+ const p = (w = gt({ object: e })) != null ? w : i, m = Cn({
8096
8122
  activeBounds: p,
8097
8123
  threshold: r,
8098
8124
  anchors: this.anchors
@@ -8140,110 +8166,110 @@ class X {
8140
8166
  this._clearGuides();
8141
8167
  return;
8142
8168
  }
8143
- const { canvas: f } = this, p = f.getZoom() || 1, m = Le / p, {
8169
+ const { canvas: f } = this, p = f.getZoom() || 1, m = _e / p, {
8144
8170
  originX: g,
8145
8171
  originY: y
8146
8172
  } = s, {
8147
8173
  originX: b = "left",
8148
8174
  originY: w = "top",
8149
- scaleX: v = 1,
8150
- scaleY: C = 1
8151
- } = e, O = g != null ? g : b, j = y != null ? y : w, S = X._collectVerticalSnapCandidates({
8175
+ scaleX: S = 1,
8176
+ scaleY: I = 1
8177
+ } = e, j = g != null ? g : b, A = y != null ? y : w, M = X._collectVerticalSnapCandidates({
8152
8178
  bounds: u,
8153
- originX: O,
8179
+ originX: j,
8154
8180
  shouldSnapX: o
8155
- }), A = X._collectHorizontalSnapCandidates({
8181
+ }), C = X._collectHorizontalSnapCandidates({
8156
8182
  bounds: u,
8157
- originY: j,
8183
+ originY: A,
8158
8184
  shouldSnapY: a
8159
- }), M = X._findAxisSnapCandidate({
8185
+ }), v = X._findAxisSnapCandidate({
8160
8186
  anchors: l,
8161
- candidates: S,
8187
+ candidates: M,
8162
8188
  threshold: m
8163
- }), E = X._findAxisSnapCandidate({
8189
+ }), O = X._findAxisSnapCandidate({
8164
8190
  anchors: d,
8165
- candidates: A,
8191
+ candidates: C,
8166
8192
  threshold: m
8167
- }), { guidePosition: I } = M, { guidePosition: z } = E, F = I !== null, U = z !== null;
8168
- if (!F && !U) {
8193
+ }), { guidePosition: D } = v, { guidePosition: B } = O, U = D !== null, F = B !== null;
8194
+ if (!U && !F) {
8169
8195
  this._clearGuides();
8170
8196
  return;
8171
8197
  }
8172
- const D = [];
8173
- let B = null, N = null;
8198
+ const E = [];
8199
+ let L = null, N = null;
8174
8200
  if (r) {
8175
- const k = X._resolveUniformScale({
8201
+ const R = X._resolveUniformScale({
8176
8202
  bounds: u,
8177
- originX: O,
8178
- originY: j,
8179
- verticalSnap: M,
8180
- horizontalSnap: E
8203
+ originX: j,
8204
+ originY: A,
8205
+ verticalSnap: v,
8206
+ horizontalSnap: O
8181
8207
  });
8182
- if (k) {
8183
- const { scaleFactor: T, guide: _ } = k;
8184
- B = v * T, N = C * T, D.push(_);
8208
+ if (R) {
8209
+ const { scaleFactor: T, guide: x } = R;
8210
+ L = S * T, N = I * T, E.push(x);
8185
8211
  }
8186
8212
  }
8187
8213
  if (!r) {
8188
- const { angle: k = 0 } = e, { width: T, height: _ } = X._resolveBaseDimensions({ target: e }), x = Math.abs(v) || 1, L = Math.abs(C) || 1;
8189
- if (F) {
8214
+ const { angle: R = 0 } = e, { width: T, height: x } = X._resolveBaseDimensions({ target: e }), P = Math.abs(S) || 1, k = Math.abs(I) || 1;
8215
+ if (U) {
8190
8216
  const V = X._resolveDesiredWidth({
8191
8217
  bounds: u,
8192
- originX: O,
8193
- snap: M
8218
+ originX: j,
8219
+ snap: v
8194
8220
  });
8195
8221
  if (V !== null) {
8196
- const W = X._resolveScaleForWidth({
8222
+ const H = X._resolveScaleForWidth({
8197
8223
  desiredWidth: V,
8198
8224
  baseWidth: T,
8199
- baseHeight: _,
8200
- scaleY: L,
8201
- angle: k
8225
+ baseHeight: x,
8226
+ scaleY: k,
8227
+ angle: R
8202
8228
  });
8203
- if (W !== null) {
8204
- const J = v < 0 ? -1 : 1;
8205
- B = W * J, I !== null && D.push({
8229
+ if (H !== null) {
8230
+ const J = S < 0 ? -1 : 1;
8231
+ L = H * J, D !== null && E.push({
8206
8232
  type: "vertical",
8207
- position: I
8233
+ position: D
8208
8234
  });
8209
8235
  }
8210
8236
  }
8211
8237
  }
8212
- if (U) {
8238
+ if (F) {
8213
8239
  const V = X._resolveDesiredHeight({
8214
8240
  bounds: u,
8215
- originY: j,
8216
- snap: E
8241
+ originY: A,
8242
+ snap: O
8217
8243
  });
8218
8244
  if (V !== null) {
8219
- const W = X._resolveScaleForHeight({
8245
+ const H = X._resolveScaleForHeight({
8220
8246
  desiredHeight: V,
8221
8247
  baseWidth: T,
8222
- baseHeight: _,
8223
- scaleX: x,
8224
- angle: k
8248
+ baseHeight: x,
8249
+ scaleX: P,
8250
+ angle: R
8225
8251
  });
8226
- if (W !== null) {
8227
- const J = C < 0 ? -1 : 1;
8228
- N = W * J, z !== null && D.push({
8252
+ if (H !== null) {
8253
+ const J = I < 0 ? -1 : 1;
8254
+ N = H * J, B !== null && E.push({
8229
8255
  type: "horizontal",
8230
- position: z
8256
+ position: B
8231
8257
  });
8232
8258
  }
8233
8259
  }
8234
8260
  }
8235
8261
  }
8236
- const R = B !== null || N !== null;
8237
- if (!R && !D.length) {
8262
+ const _ = L !== null || N !== null;
8263
+ if (!_ && !E.length) {
8238
8264
  this._clearGuides();
8239
8265
  return;
8240
8266
  }
8241
- if (R) {
8242
- const k = e.getRelativeCenterPoint(), T = e.translateToOriginPoint(k, O, j), _ = {};
8243
- B !== null && (_.scaleX = B, s.scaleX = B), N !== null && (_.scaleY = N, s.scaleY = N), Object.keys(_).length && (e.set(_), e.setPositionByOrigin(T, O, j), e.setCoords());
8267
+ if (_) {
8268
+ const R = e.getRelativeCenterPoint(), T = e.translateToOriginPoint(R, j, A), x = {};
8269
+ L !== null && (x.scaleX = L, s.scaleX = L), N !== null && (x.scaleY = N, s.scaleY = N), Object.keys(x).length && (e.set(x), e.setPositionByOrigin(T, j, A), e.setCoords());
8244
8270
  }
8245
8271
  X._applyScalingStep({ target: e, transform: s }), X._applyMovementStep({ target: e }), this._applyGuides({
8246
- guides: D,
8272
+ guides: E,
8247
8273
  spacingGuides: []
8248
8274
  });
8249
8275
  }
@@ -8279,49 +8305,49 @@ class X {
8279
8305
  this._clearGuides();
8280
8306
  return;
8281
8307
  }
8282
- const { canvas: d } = this, u = d.getZoom() || 1, f = Le / u, { originX: p, originY: m } = e, {
8308
+ const { canvas: d } = this, u = d.getZoom() || 1, f = _e / u, { originX: p, originY: m } = e, {
8283
8309
  originX: g = "left",
8284
8310
  originY: y = "top"
8285
- } = t, b = p != null ? p : g, w = m != null ? m : y, v = X._collectVerticalSnapCandidates({
8311
+ } = t, b = p != null ? p : g, w = m != null ? m : y, S = X._collectVerticalSnapCandidates({
8286
8312
  bounds: l,
8287
8313
  originX: b,
8288
8314
  shouldSnapX: !0
8289
- }), C = X._findAxisSnapCandidate({
8315
+ }), I = X._findAxisSnapCandidate({
8290
8316
  anchors: r,
8291
- candidates: v,
8317
+ candidates: S,
8292
8318
  threshold: f
8293
- }), { guidePosition: O } = C;
8294
- if (O === null) {
8319
+ }), { guidePosition: j } = I;
8320
+ if (j === null) {
8295
8321
  this._clearGuides();
8296
8322
  return;
8297
8323
  }
8298
- const j = X._resolveDesiredWidth({
8324
+ const A = X._resolveDesiredWidth({
8299
8325
  bounds: l,
8300
8326
  originX: b,
8301
- snap: C
8327
+ snap: I
8302
8328
  });
8303
- if (j === null) {
8329
+ if (A === null) {
8304
8330
  this._clearGuides();
8305
8331
  return;
8306
8332
  }
8307
- const S = X._resolveTextWidthForBounds({
8333
+ const M = X._resolveTextWidthForBounds({
8308
8334
  target: t,
8309
- boundsWidth: j
8335
+ boundsWidth: A
8310
8336
  });
8311
- if (S === null) {
8337
+ if (M === null) {
8312
8338
  this._clearGuides();
8313
8339
  return;
8314
8340
  }
8315
- const { width: A = 0 } = t;
8316
- if (S !== A) {
8317
- const M = t.getRelativeCenterPoint(), E = t.translateToOriginPoint(M, b, w);
8318
- t.set({ width: S }), t.setPositionByOrigin(E, b, w), t.setCoords();
8341
+ const { width: C = 0 } = t;
8342
+ if (M !== C) {
8343
+ const v = t.getRelativeCenterPoint(), O = t.translateToOriginPoint(v, b, w);
8344
+ t.set({ width: M }), t.setPositionByOrigin(O, b, w), t.setCoords();
8319
8345
  }
8320
8346
  this._applyGuides({
8321
8347
  guides: [
8322
8348
  {
8323
8349
  type: "vertical",
8324
- position: O
8350
+ position: j
8325
8351
  }
8326
8352
  ],
8327
8353
  spacingGuides: []
@@ -8348,11 +8374,11 @@ class X {
8348
8374
  const { canvas: t, guideBounds: e } = this, n = t.getSelectionContext();
8349
8375
  if (!n) return;
8350
8376
  const s = e != null ? e : this._calculateViewportBounds(), { left: i, right: o, top: a, bottom: r } = s, { viewportTransform: c } = t, l = t.getZoom() || 1;
8351
- n.save(), Array.isArray(c) && n.transform(...c), n.lineWidth = We / l, n.strokeStyle = Dn, n.setLineDash([4, 4]);
8377
+ n.save(), Array.isArray(c) && n.transform(...c), n.lineWidth = We / l, n.strokeStyle = xn, n.setLineDash([4, 4]);
8352
8378
  for (const d of this.activeGuides)
8353
8379
  n.beginPath(), d.type === "vertical" ? (n.moveTo(d.position, a), n.lineTo(d.position, r)) : (n.moveTo(i, d.position), n.lineTo(o, d.position)), n.stroke();
8354
8380
  for (const d of this.activeSpacingGuides)
8355
- di({
8381
+ hi({
8356
8382
  context: n,
8357
8383
  guide: d,
8358
8384
  zoom: l
@@ -8499,8 +8525,8 @@ class X {
8499
8525
  snap: s
8500
8526
  });
8501
8527
  if (w !== null) {
8502
- const v = w / l;
8503
- Number.isFinite(v) && v > 0 && (g = v);
8528
+ const S = w / l;
8529
+ Number.isFinite(S) && S > 0 && (g = S);
8504
8530
  }
8505
8531
  }
8506
8532
  if (p !== null && d > 0) {
@@ -8510,14 +8536,14 @@ class X {
8510
8536
  snap: i
8511
8537
  });
8512
8538
  if (w !== null) {
8513
- const v = w / d;
8514
- Number.isFinite(v) && v > 0 && (y = v);
8539
+ const S = w / d;
8540
+ Number.isFinite(S) && S > 0 && (y = S);
8515
8541
  }
8516
8542
  }
8517
8543
  let b = null;
8518
8544
  if (g !== null && y === null && (b = "x"), y !== null && g === null && (b = "y"), g !== null && y !== null) {
8519
- const w = Math.abs(f), v = Math.abs(m);
8520
- w <= v && (b = "x"), w > v && (b = "y");
8545
+ const w = Math.abs(f), S = Math.abs(m);
8546
+ w <= S && (b = "x"), w > S && (b = "y");
8521
8547
  }
8522
8548
  return b === "x" && g !== null && u !== null ? {
8523
8549
  scaleFactor: g,
@@ -8665,7 +8691,7 @@ class X {
8665
8691
  static _snapScaleToStep({ value: t }) {
8666
8692
  const e = Math.abs(si);
8667
8693
  if (e === 0) return t;
8668
- const n = X._resolveStepPrecision({ step: e }), s = Oe(10, n), i = Math.round(e * s);
8694
+ const n = X._resolveStepPrecision({ step: e }), s = Ie(10, n), i = Math.round(e * s);
8669
8695
  if (i <= 0) return t;
8670
8696
  const o = Math.round(t * s), r = Math.round(o / i) * i / s, c = Number(r.toFixed(n));
8671
8697
  return c !== 0 ? c : t === 0 || t > 0 ? e : -e;
@@ -8684,11 +8710,11 @@ class X {
8684
8710
  const e = this._collectTargets({ activeObject: t }), n = { vertical: [], horizontal: [] }, s = [];
8685
8711
  for (const a of e) {
8686
8712
  const r = gt({ object: a });
8687
- r && (Cn({ anchors: n, bounds: r }), s.push(r));
8713
+ r && (On({ anchors: n, bounds: r }), s.push(r));
8688
8714
  }
8689
8715
  const { montageArea: i } = this.editor, o = gt({ object: i });
8690
8716
  if (o) {
8691
- Cn({ anchors: n, bounds: o });
8717
+ On({ anchors: n, bounds: o });
8692
8718
  const { left: a, right: r, top: c, bottom: l } = o;
8693
8719
  this.guideBounds = {
8694
8720
  left: a,
@@ -8698,17 +8724,28 @@ class X {
8698
8724
  };
8699
8725
  } else
8700
8726
  this.guideBounds = this._calculateViewportBounds();
8701
- this.anchors = n, this.spacingPatterns = hi({ bounds: s }), this.cachedTargetBounds = s;
8727
+ this.anchors = n, this.spacingPatterns = ui({ bounds: s }), this.cachedTargetBounds = s;
8702
8728
  }
8703
8729
  /**
8704
8730
  * Собирает объекты, подходящие для прилипания, исключая активный объект и запрещённые id.
8705
8731
  */
8706
8732
  _collectTargets({ activeObject: t }) {
8707
- const e = me({ activeObject: t }), n = [];
8733
+ const e = pe({ activeObject: t }), n = [];
8708
8734
  return this.canvas.forEachObject((s) => {
8709
- ye({ object: s, excluded: e }) || n.push(s);
8735
+ me({ object: s, excluded: e }) || n.push(s);
8710
8736
  }), n;
8711
8737
  }
8738
+ /**
8739
+ * Возвращает актуальные границы объектов-целей для расчёта равноудалённого прилипания.
8740
+ */
8741
+ _resolveCurrentTargetBounds({ activeObject: t }) {
8742
+ const e = this._collectTargets({ activeObject: t }), n = [];
8743
+ for (const s of e) {
8744
+ const i = gt({ object: s });
8745
+ i && n.push(i);
8746
+ }
8747
+ return n;
8748
+ }
8712
8749
  /**
8713
8750
  * Возвращает границы для рисования направляющих.
8714
8751
  */
@@ -8729,8 +8766,8 @@ class X {
8729
8766
  };
8730
8767
  }
8731
8768
  }
8732
- const En = "#3D8BF4", Tn = 1;
8733
- class Ct {
8769
+ const Tn = "#3D8BF4", Dn = 1;
8770
+ class It {
8734
8771
  /**
8735
8772
  * Создаёт менеджер измерений и инициализирует события.
8736
8773
  */
@@ -8840,7 +8877,7 @@ class Ct {
8840
8877
  this._clearGuides();
8841
8878
  return;
8842
8879
  }
8843
- const o = Ct._resolveTarget({
8880
+ const o = It._resolveTarget({
8844
8881
  event: t,
8845
8882
  activeObject: s
8846
8883
  }), { montageArea: a } = n, r = o != null ? o : a, c = r === a, l = gt({ object: r });
@@ -8852,7 +8889,7 @@ class Ct {
8852
8889
  this._clearGuides();
8853
8890
  return;
8854
8891
  }
8855
- const u = Ct._buildGuides({
8892
+ const u = It._buildGuides({
8856
8893
  activeBounds: i,
8857
8894
  targetBounds: l,
8858
8895
  targetIsMontageArea: c
@@ -8922,7 +8959,7 @@ class Ct {
8922
8959
  currentGap: r,
8923
8960
  oppositeGaps: [c, l]
8924
8961
  });
8925
- return d === null ? t : yt(P({}, t), {
8962
+ return d === null ? t : yt(z({}, t), {
8926
8963
  distance: d
8927
8964
  });
8928
8965
  }
@@ -8955,7 +8992,7 @@ class Ct {
8955
8992
  currentGap: r,
8956
8993
  oppositeGaps: [c, l]
8957
8994
  });
8958
- return d === null ? t : yt(P({}, t), {
8995
+ return d === null ? t : yt(z({}, t), {
8959
8996
  distance: d
8960
8997
  });
8961
8998
  }
@@ -8990,12 +9027,12 @@ class Ct {
8990
9027
  searchRightSide: s
8991
9028
  }) {
8992
9029
  var r, c, l, d, u, f, p, m;
8993
- const { montageArea: i } = this.editor, o = me({ activeObject: t });
9030
+ const { montageArea: i } = this.editor, o = pe({ activeObject: t });
8994
9031
  let a = Number.POSITIVE_INFINITY;
8995
9032
  for (const g of this.canvas.getObjects()) {
8996
- if (g === t || g === e || g === i || ye({ object: g, excluded: o })) continue;
9033
+ if (g === t || g === e || g === i || me({ object: g, excluded: o })) continue;
8997
9034
  const y = gt({ object: g });
8998
- if (!y || !Ct._hasVerticalOverlap({ a: n, b: y })) continue;
9035
+ if (!y || !It._hasVerticalOverlap({ a: n, b: y })) continue;
8999
9036
  let b = -1;
9000
9037
  s && ((r = y.left) != null ? r : 0) >= ((c = n.right) != null ? c : 0) && (b = ((l = y.left) != null ? l : 0) - ((d = n.right) != null ? d : 0)), !s && ((u = y.right) != null ? u : 0) <= ((f = n.left) != null ? f : 0) && (b = ((p = n.left) != null ? p : 0) - ((m = y.right) != null ? m : 0)), b > 0 && b < a && (a = b);
9001
9038
  }
@@ -9011,12 +9048,12 @@ class Ct {
9011
9048
  searchBottomSide: s
9012
9049
  }) {
9013
9050
  var r, c, l, d, u, f, p, m;
9014
- const { montageArea: i } = this.editor, o = me({ activeObject: t });
9051
+ const { montageArea: i } = this.editor, o = pe({ activeObject: t });
9015
9052
  let a = Number.POSITIVE_INFINITY;
9016
9053
  for (const g of this.canvas.getObjects()) {
9017
- if (g === t || g === e || g === i || ye({ object: g, excluded: o })) continue;
9054
+ if (g === t || g === e || g === i || me({ object: g, excluded: o })) continue;
9018
9055
  const y = gt({ object: g });
9019
- if (!y || !Ct._hasHorizontalOverlap({ a: n, b: y })) continue;
9056
+ if (!y || !It._hasHorizontalOverlap({ a: n, b: y })) continue;
9020
9057
  let b = -1;
9021
9058
  s && ((r = y.top) != null ? r : 0) >= ((c = n.bottom) != null ? c : 0) && (b = ((l = y.top) != null ? l : 0) - ((d = n.bottom) != null ? d : 0)), !s && ((u = y.bottom) != null ? u : 0) <= ((f = n.top) != null ? f : 0) && (b = ((p = n.top) != null ? p : 0) - ((m = y.bottom) != null ? m : 0)), b > 0 && b < a && (a = b);
9022
9059
  }
@@ -9051,8 +9088,8 @@ class Ct {
9051
9088
  event: t,
9052
9089
  activeObject: e
9053
9090
  }) {
9054
- const { target: n } = t, s = me({ activeObject: e });
9055
- return n && !ye({ object: n, excluded: s }) ? n : null;
9091
+ const { target: n } = t, s = pe({ activeObject: e });
9092
+ return n && !me({ object: n, excluded: s }) ? n : null;
9056
9093
  }
9057
9094
  /**
9058
9095
  * Собирает вертикальные и горизонтальные направляющие расстояний.
@@ -9062,11 +9099,11 @@ class Ct {
9062
9099
  targetBounds: e,
9063
9100
  targetIsMontageArea: n
9064
9101
  }) {
9065
- const s = Ct._buildHorizontalGuides({
9102
+ const s = It._buildHorizontalGuides({
9066
9103
  activeBounds: t,
9067
9104
  targetBounds: e,
9068
9105
  targetIsMontageArea: n
9069
- }), i = Ct._buildVerticalGuides({
9106
+ }), i = It._buildVerticalGuides({
9070
9107
  activeBounds: t,
9071
9108
  targetBounds: e,
9072
9109
  targetIsMontageArea: n
@@ -9096,42 +9133,42 @@ class Ct {
9096
9133
  } = e, m = Math.max(a, u), g = Math.min(r, f), b = g >= m ? (m + g) / 2 : (c + p) / 2;
9097
9134
  if (l >= o) {
9098
9135
  if (n) return s;
9099
- const E = l - o;
9100
- return E > 0 && s.push({
9136
+ const O = l - o;
9137
+ return O > 0 && s.push({
9101
9138
  type: "horizontal",
9102
9139
  axis: b,
9103
9140
  start: o,
9104
9141
  end: l,
9105
- distance: E
9142
+ distance: O
9106
9143
  }), s;
9107
9144
  }
9108
9145
  if (d <= i) {
9109
9146
  if (n) return s;
9110
- const E = i - d;
9111
- return E > 0 && s.push({
9147
+ const O = i - d;
9148
+ return O > 0 && s.push({
9112
9149
  type: "horizontal",
9113
9150
  axis: b,
9114
9151
  start: d,
9115
9152
  end: i,
9116
- distance: E
9153
+ distance: O
9117
9154
  }), s;
9118
9155
  }
9119
9156
  if (!n) return s;
9120
- const w = i < l, v = o > d, C = Math.min(i, l), O = Math.max(i, l), j = O - C;
9121
- j > 0 && !w && s.push({
9157
+ const w = i < l, S = o > d, I = Math.min(i, l), j = Math.max(i, l), A = j - I;
9158
+ A > 0 && !w && s.push({
9122
9159
  type: "horizontal",
9123
9160
  axis: b,
9124
- start: C,
9125
- end: O,
9126
- distance: j
9161
+ start: I,
9162
+ end: j,
9163
+ distance: A
9127
9164
  });
9128
- const S = Math.min(o, d), A = Math.max(o, d), M = A - S;
9129
- return M > 0 && !v && s.push({
9165
+ const M = Math.min(o, d), C = Math.max(o, d), v = C - M;
9166
+ return v > 0 && !S && s.push({
9130
9167
  type: "horizontal",
9131
9168
  axis: b,
9132
- start: S,
9133
- end: A,
9134
- distance: M
9169
+ start: M,
9170
+ end: C,
9171
+ distance: v
9135
9172
  }), s;
9136
9173
  }
9137
9174
  /**
@@ -9157,42 +9194,42 @@ class Ct {
9157
9194
  } = e, m = Math.max(a, u), g = Math.min(r, f), b = g >= m ? (m + g) / 2 : (c + p) / 2;
9158
9195
  if (l >= o) {
9159
9196
  if (n) return s;
9160
- const E = l - o;
9161
- return E > 0 && s.push({
9197
+ const O = l - o;
9198
+ return O > 0 && s.push({
9162
9199
  type: "vertical",
9163
9200
  axis: b,
9164
9201
  start: o,
9165
9202
  end: l,
9166
- distance: E
9203
+ distance: O
9167
9204
  }), s;
9168
9205
  }
9169
9206
  if (d <= i) {
9170
9207
  if (n) return s;
9171
- const E = i - d;
9172
- return E > 0 && s.push({
9208
+ const O = i - d;
9209
+ return O > 0 && s.push({
9173
9210
  type: "vertical",
9174
9211
  axis: b,
9175
9212
  start: d,
9176
9213
  end: i,
9177
- distance: E
9214
+ distance: O
9178
9215
  }), s;
9179
9216
  }
9180
9217
  if (!n) return s;
9181
- const w = i < l, v = o > d, C = Math.min(i, l), O = Math.max(i, l), j = O - C;
9182
- j > 0 && !w && s.push({
9218
+ const w = i < l, S = o > d, I = Math.min(i, l), j = Math.max(i, l), A = j - I;
9219
+ A > 0 && !w && s.push({
9183
9220
  type: "vertical",
9184
9221
  axis: b,
9185
- start: C,
9186
- end: O,
9187
- distance: j
9222
+ start: I,
9223
+ end: j,
9224
+ distance: A
9188
9225
  });
9189
- const S = Math.min(o, d), A = Math.max(o, d), M = A - S;
9190
- return M > 0 && !v && s.push({
9226
+ const M = Math.min(o, d), C = Math.max(o, d), v = C - M;
9227
+ return v > 0 && !S && s.push({
9191
9228
  type: "vertical",
9192
9229
  axis: b,
9193
- start: S,
9194
- end: A,
9195
- distance: M
9230
+ start: M,
9231
+ end: C,
9232
+ distance: v
9196
9233
  }), s;
9197
9234
  }
9198
9235
  /**
@@ -9220,7 +9257,7 @@ class Ct {
9220
9257
  const { canvas: t } = this, e = t.getSelectionContext();
9221
9258
  if (!e) return;
9222
9259
  const { viewportTransform: n } = t, s = t.getZoom() || 1, i = this.activeGuides.some((c) => c.type === "vertical"), o = this.activeGuides.some((c) => c.type === "horizontal"), a = i && o && !this.isTargetMontageArea, r = a ? 12 / s : 0;
9223
- e.save(), Array.isArray(n) && e.transform(...n), e.lineWidth = Tn / s, e.strokeStyle = En, e.setLineDash([]);
9260
+ e.save(), Array.isArray(n) && e.transform(...n), e.lineWidth = Dn / s, e.strokeStyle = Tn, e.setLineDash([]);
9224
9261
  for (const c of this.activeGuides) {
9225
9262
  const { type: l, axis: d, start: u, end: f, distance: p } = c, m = Math.abs(f - u), g = u <= f ? -1 : 1, y = a ? g * (m / 2 + r) : 0, b = 0;
9226
9263
  e.beginPath(), l === "vertical" ? (e.moveTo(d, u), e.lineTo(d, f)) : (e.moveTo(u, d), e.lineTo(f, d)), e.stroke(), Ye({
@@ -9229,10 +9266,10 @@ class Ct {
9229
9266
  axis: d,
9230
9267
  start: u,
9231
9268
  end: f,
9232
- text: Me({ distance: p }).toString(),
9269
+ text: Se({ distance: p }).toString(),
9233
9270
  zoom: s,
9234
- color: En,
9235
- lineWidth: Tn,
9271
+ color: Tn,
9272
+ lineWidth: Dn,
9236
9273
  offsetAlongAxis: y,
9237
9274
  offsetPerpendicular: b
9238
9275
  });
@@ -9288,7 +9325,7 @@ class $e {
9288
9325
  showRotationAngle: l,
9289
9326
  _onReadyCallback: d
9290
9327
  } = this.options;
9291
- if (ut.apply(), this.canvas = new Jn(this.containerId, this.options), this.moduleLoader = new ns(), this.workerManager = new is(), this.errorManager = new ne({ editor: this }), this.historyManager = new $({ editor: this }), this.toolbar = new Ss({ editor: this }), this.transformManager = new _s({ editor: this }), this.zoomManager = new Ds({ editor: this }), this.canvasManager = new Ts({ editor: this }), this.imageManager = new te({ editor: this }), this.layerManager = new be({ editor: this }), this.shapeManager = new xs({ editor: this }), this.interactionBlocker = new Ls({ editor: this }), this.backgroundManager = new Ut({ editor: this }), this.clipboardManager = new Rs({ editor: this }), this.objectLockManager = new ve({ editor: this }), this.groupingManager = new ks({ editor: this }), this.selectionManager = new ft({ editor: this }), this.deletionManager = new Ke({ editor: this }), this.panConstraintManager = new Bs({ editor: this }), this.snappingManager = new X({ editor: this }), this.measurementManager = new Ct({ editor: this }), this.fontManager = new Pe((u = this.options.fonts) != null ? u : []), this.textManager = new at({ editor: this }), this.templateManager = new Z({ editor: this }), l && (this.angleIndicator = new Xe({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new He({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(o), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), r) {
9328
+ if (ut.apply(), this.canvas = new Jn(this.containerId, this.options), this.moduleLoader = new ns(), this.workerManager = new is(), this.errorManager = new ee({ editor: this }), this.historyManager = new $({ editor: this }), this.toolbar = new Ss({ editor: this }), this.transformManager = new Ds({ editor: this }), this.zoomManager = new _s({ editor: this }), this.canvasManager = new Ts({ editor: this }), this.imageManager = new te({ editor: this }), this.layerManager = new ye({ editor: this }), this.shapeManager = new Ls({ editor: this }), this.interactionBlocker = new xs({ editor: this }), this.backgroundManager = new Ut({ editor: this }), this.clipboardManager = new Rs({ editor: this }), this.objectLockManager = new be({ editor: this }), this.groupingManager = new ks({ editor: this }), this.selectionManager = new ft({ editor: this }), this.deletionManager = new Ke({ editor: this }), this.panConstraintManager = new Bs({ editor: this }), this.snappingManager = new X({ editor: this }), this.measurementManager = new It({ editor: this }), this.fontManager = new Pe((u = this.options.fonts) != null ? u : []), this.textManager = new at({ editor: this }), this.templateManager = new Z({ editor: this }), l && (this.angleIndicator = new Xe({ editor: this })), this._createMontageArea(), this._createClippingArea(), this.listeners = new He({ editor: this, options: this.options }), this.canvasManager.setEditorContainerWidth(t), this.canvasManager.setEditorContainerHeight(e), this.canvasManager.setCanvasWrapperWidth(n), this.canvasManager.setCanvasWrapperHeight(s), this.canvasManager.setCanvasCSSWidth(i), this.canvasManager.setCanvasCSSHeight(o), this.canvasManager.updateCanvas(), this.zoomManager.calculateAndApplyDefaultZoom(), yield this.fontManager.loadFonts(), r) {
9292
9329
  this.historyManager.suspendHistory();
9293
9330
  try {
9294
9331
  const m = yield this.imageManager.prepareInitialState({
@@ -9306,7 +9343,7 @@ class $e {
9306
9343
  "scale",
9307
9344
  "withoutSave"
9308
9345
  ]);
9309
- yield this.imageManager.importImage(P({ source: g, scale: y, withoutSave: b }, w));
9346
+ yield this.imageManager.importImage(z({ source: g, scale: y, withoutSave: b }, w));
9310
9347
  }
9311
9348
  this.errorManager.emitError({
9312
9349
  origin: "ImageEditor",
@@ -9328,7 +9365,7 @@ class $e {
9328
9365
  "scale",
9329
9366
  "withoutSave"
9330
9367
  ]);
9331
- yield this.imageManager.importImage(P({ source: m, scale: g, withoutSave: y }, b));
9368
+ yield this.imageManager.importImage(z({ source: m, scale: g, withoutSave: y }, b));
9332
9369
  }
9333
9370
  this.historyManager.saveState(), console.log("editor:ready"), this.canvas.fire("editor:ready", this), typeof d == "function" && d(this);
9334
9371
  });
@@ -9401,7 +9438,7 @@ class $e {
9401
9438
  });
9402
9439
  }
9403
9440
  }
9404
- const Y = [
9441
+ const W = [
9405
9442
  "U+0000-00FF",
9406
9443
  "U+0100-02BA",
9407
9444
  "U+02BB-02BC",
@@ -9431,7 +9468,7 @@ const Y = [
9431
9468
  "U+A720-A7FF",
9432
9469
  "U+FEFF",
9433
9470
  "U+FFFD"
9434
- ].join(", "), H = [
9471
+ ].join(", "), Y = [
9435
9472
  "U+0301",
9436
9473
  "U+0400-052F",
9437
9474
  "U+1C80-1C8A",
@@ -9440,7 +9477,7 @@ const Y = [
9440
9477
  "U+A640-A69F",
9441
9478
  "U+FE2E-FE2F",
9442
9479
  "U+2116"
9443
- ].join(", "), fi = [
9480
+ ].join(", "), gi = [
9444
9481
  {
9445
9482
  family: "Arial",
9446
9483
  source: 'local("Arial"), local("Liberation Sans"), local("DejaVu Sans")',
@@ -9457,7 +9494,7 @@ const Y = [
9457
9494
  style: "normal",
9458
9495
  weight: "400",
9459
9496
  display: "swap",
9460
- unicodeRange: H
9497
+ unicodeRange: Y
9461
9498
  }
9462
9499
  },
9463
9500
  {
@@ -9467,7 +9504,7 @@ const Y = [
9467
9504
  style: "normal",
9468
9505
  weight: "400",
9469
9506
  display: "swap",
9470
- unicodeRange: Y
9507
+ unicodeRange: W
9471
9508
  }
9472
9509
  },
9473
9510
  {
@@ -9477,7 +9514,7 @@ const Y = [
9477
9514
  style: "normal",
9478
9515
  weight: "700",
9479
9516
  display: "swap",
9480
- unicodeRange: H
9517
+ unicodeRange: Y
9481
9518
  }
9482
9519
  },
9483
9520
  {
@@ -9487,7 +9524,7 @@ const Y = [
9487
9524
  style: "normal",
9488
9525
  weight: "700",
9489
9526
  display: "swap",
9490
- unicodeRange: Y
9527
+ unicodeRange: W
9491
9528
  }
9492
9529
  },
9493
9530
  {
@@ -9497,7 +9534,7 @@ const Y = [
9497
9534
  style: "normal",
9498
9535
  weight: "200 700",
9499
9536
  display: "swap",
9500
- unicodeRange: H
9537
+ unicodeRange: Y
9501
9538
  }
9502
9539
  },
9503
9540
  {
@@ -9507,7 +9544,7 @@ const Y = [
9507
9544
  style: "normal",
9508
9545
  weight: "200 700",
9509
9546
  display: "swap",
9510
- unicodeRange: Y
9547
+ unicodeRange: W
9511
9548
  }
9512
9549
  },
9513
9550
  {
@@ -9517,7 +9554,7 @@ const Y = [
9517
9554
  style: "normal",
9518
9555
  weight: "300 900",
9519
9556
  display: "swap",
9520
- unicodeRange: H
9557
+ unicodeRange: Y
9521
9558
  }
9522
9559
  },
9523
9560
  {
@@ -9527,7 +9564,7 @@ const Y = [
9527
9564
  style: "normal",
9528
9565
  weight: "300 900",
9529
9566
  display: "swap",
9530
- unicodeRange: Y
9567
+ unicodeRange: W
9531
9568
  }
9532
9569
  },
9533
9570
  {
@@ -9537,7 +9574,7 @@ const Y = [
9537
9574
  style: "normal",
9538
9575
  weight: "400 700",
9539
9576
  display: "swap",
9540
- unicodeRange: H
9577
+ unicodeRange: Y
9541
9578
  }
9542
9579
  },
9543
9580
  {
@@ -9547,7 +9584,7 @@ const Y = [
9547
9584
  style: "normal",
9548
9585
  weight: "400 700",
9549
9586
  display: "swap",
9550
- unicodeRange: Y
9587
+ unicodeRange: W
9551
9588
  }
9552
9589
  },
9553
9590
  {
@@ -9557,7 +9594,7 @@ const Y = [
9557
9594
  style: "normal",
9558
9595
  weight: "300 700",
9559
9596
  display: "swap",
9560
- unicodeRange: H
9597
+ unicodeRange: Y
9561
9598
  }
9562
9599
  },
9563
9600
  {
@@ -9567,7 +9604,7 @@ const Y = [
9567
9604
  style: "normal",
9568
9605
  weight: "300 700",
9569
9606
  display: "swap",
9570
- unicodeRange: Y
9607
+ unicodeRange: W
9571
9608
  }
9572
9609
  },
9573
9610
  {
@@ -9577,7 +9614,7 @@ const Y = [
9577
9614
  style: "normal",
9578
9615
  weight: "300 700",
9579
9616
  display: "swap",
9580
- unicodeRange: H
9617
+ unicodeRange: Y
9581
9618
  }
9582
9619
  },
9583
9620
  {
@@ -9587,7 +9624,7 @@ const Y = [
9587
9624
  style: "normal",
9588
9625
  weight: "300 700",
9589
9626
  display: "swap",
9590
- unicodeRange: Y
9627
+ unicodeRange: W
9591
9628
  }
9592
9629
  },
9593
9630
  {
@@ -9597,7 +9634,7 @@ const Y = [
9597
9634
  style: "normal",
9598
9635
  weight: "400",
9599
9636
  display: "swap",
9600
- unicodeRange: H
9637
+ unicodeRange: Y
9601
9638
  }
9602
9639
  },
9603
9640
  {
@@ -9607,7 +9644,7 @@ const Y = [
9607
9644
  style: "normal",
9608
9645
  weight: "400",
9609
9646
  display: "swap",
9610
- unicodeRange: Y
9647
+ unicodeRange: W
9611
9648
  }
9612
9649
  },
9613
9650
  {
@@ -9617,7 +9654,7 @@ const Y = [
9617
9654
  style: "normal",
9618
9655
  weight: "400 700",
9619
9656
  display: "swap",
9620
- unicodeRange: H
9657
+ unicodeRange: Y
9621
9658
  }
9622
9659
  },
9623
9660
  {
@@ -9627,7 +9664,7 @@ const Y = [
9627
9664
  style: "normal",
9628
9665
  weight: "400 700",
9629
9666
  display: "swap",
9630
- unicodeRange: Y
9667
+ unicodeRange: W
9631
9668
  }
9632
9669
  },
9633
9670
  {
@@ -9637,7 +9674,7 @@ const Y = [
9637
9674
  style: "normal",
9638
9675
  weight: "100 900",
9639
9676
  display: "swap",
9640
- unicodeRange: H
9677
+ unicodeRange: Y
9641
9678
  }
9642
9679
  },
9643
9680
  {
@@ -9647,7 +9684,7 @@ const Y = [
9647
9684
  style: "normal",
9648
9685
  weight: "100 900",
9649
9686
  display: "swap",
9650
- unicodeRange: Y
9687
+ unicodeRange: W
9651
9688
  }
9652
9689
  },
9653
9690
  {
@@ -9657,7 +9694,7 @@ const Y = [
9657
9694
  style: "normal",
9658
9695
  weight: "400",
9659
9696
  display: "swap",
9660
- unicodeRange: H
9697
+ unicodeRange: Y
9661
9698
  }
9662
9699
  },
9663
9700
  {
@@ -9667,7 +9704,7 @@ const Y = [
9667
9704
  style: "normal",
9668
9705
  weight: "400",
9669
9706
  display: "swap",
9670
- unicodeRange: Y
9707
+ unicodeRange: W
9671
9708
  }
9672
9709
  },
9673
9710
  {
@@ -9677,7 +9714,7 @@ const Y = [
9677
9714
  style: "normal",
9678
9715
  weight: "700",
9679
9716
  display: "swap",
9680
- unicodeRange: H
9717
+ unicodeRange: Y
9681
9718
  }
9682
9719
  },
9683
9720
  {
@@ -9687,7 +9724,7 @@ const Y = [
9687
9724
  style: "normal",
9688
9725
  weight: "700",
9689
9726
  display: "swap",
9690
- unicodeRange: Y
9727
+ unicodeRange: W
9691
9728
  }
9692
9729
  },
9693
9730
  {
@@ -9697,7 +9734,7 @@ const Y = [
9697
9734
  style: "normal",
9698
9735
  weight: "400 700",
9699
9736
  display: "swap",
9700
- unicodeRange: H
9737
+ unicodeRange: Y
9701
9738
  }
9702
9739
  },
9703
9740
  {
@@ -9707,7 +9744,7 @@ const Y = [
9707
9744
  style: "normal",
9708
9745
  weight: "400 700",
9709
9746
  display: "swap",
9710
- unicodeRange: Y
9747
+ unicodeRange: W
9711
9748
  }
9712
9749
  },
9713
9750
  {
@@ -9717,7 +9754,7 @@ const Y = [
9717
9754
  style: "normal",
9718
9755
  weight: "100 900",
9719
9756
  display: "swap",
9720
- unicodeRange: H
9757
+ unicodeRange: Y
9721
9758
  }
9722
9759
  },
9723
9760
  {
@@ -9727,7 +9764,7 @@ const Y = [
9727
9764
  style: "normal",
9728
9765
  weight: "100 900",
9729
9766
  display: "swap",
9730
- unicodeRange: Y
9767
+ unicodeRange: W
9731
9768
  }
9732
9769
  },
9733
9770
  {
@@ -9737,7 +9774,7 @@ const Y = [
9737
9774
  style: "normal",
9738
9775
  weight: "100",
9739
9776
  display: "swap",
9740
- unicodeRange: H
9777
+ unicodeRange: Y
9741
9778
  }
9742
9779
  },
9743
9780
  {
@@ -9747,7 +9784,7 @@ const Y = [
9747
9784
  style: "normal",
9748
9785
  weight: "100",
9749
9786
  display: "swap",
9750
- unicodeRange: Y
9787
+ unicodeRange: W
9751
9788
  }
9752
9789
  },
9753
9790
  {
@@ -9757,7 +9794,7 @@ const Y = [
9757
9794
  style: "normal",
9758
9795
  weight: "200",
9759
9796
  display: "swap",
9760
- unicodeRange: H
9797
+ unicodeRange: Y
9761
9798
  }
9762
9799
  },
9763
9800
  {
@@ -9767,7 +9804,7 @@ const Y = [
9767
9804
  style: "normal",
9768
9805
  weight: "200",
9769
9806
  display: "swap",
9770
- unicodeRange: Y
9807
+ unicodeRange: W
9771
9808
  }
9772
9809
  },
9773
9810
  {
@@ -9777,7 +9814,7 @@ const Y = [
9777
9814
  style: "normal",
9778
9815
  weight: "300",
9779
9816
  display: "swap",
9780
- unicodeRange: H
9817
+ unicodeRange: Y
9781
9818
  }
9782
9819
  },
9783
9820
  {
@@ -9787,7 +9824,7 @@ const Y = [
9787
9824
  style: "normal",
9788
9825
  weight: "300",
9789
9826
  display: "swap",
9790
- unicodeRange: Y
9827
+ unicodeRange: W
9791
9828
  }
9792
9829
  },
9793
9830
  {
@@ -9797,7 +9834,7 @@ const Y = [
9797
9834
  style: "normal",
9798
9835
  weight: "400",
9799
9836
  display: "swap",
9800
- unicodeRange: H
9837
+ unicodeRange: Y
9801
9838
  }
9802
9839
  },
9803
9840
  {
@@ -9807,7 +9844,7 @@ const Y = [
9807
9844
  style: "normal",
9808
9845
  weight: "400",
9809
9846
  display: "swap",
9810
- unicodeRange: Y
9847
+ unicodeRange: W
9811
9848
  }
9812
9849
  },
9813
9850
  {
@@ -9817,7 +9854,7 @@ const Y = [
9817
9854
  style: "normal",
9818
9855
  weight: "500",
9819
9856
  display: "swap",
9820
- unicodeRange: H
9857
+ unicodeRange: Y
9821
9858
  }
9822
9859
  },
9823
9860
  {
@@ -9827,7 +9864,7 @@ const Y = [
9827
9864
  style: "normal",
9828
9865
  weight: "500",
9829
9866
  display: "swap",
9830
- unicodeRange: Y
9867
+ unicodeRange: W
9831
9868
  }
9832
9869
  },
9833
9870
  {
@@ -9837,7 +9874,7 @@ const Y = [
9837
9874
  style: "normal",
9838
9875
  weight: "600",
9839
9876
  display: "swap",
9840
- unicodeRange: H
9877
+ unicodeRange: Y
9841
9878
  }
9842
9879
  },
9843
9880
  {
@@ -9847,7 +9884,7 @@ const Y = [
9847
9884
  style: "normal",
9848
9885
  weight: "600",
9849
9886
  display: "swap",
9850
- unicodeRange: Y
9887
+ unicodeRange: W
9851
9888
  }
9852
9889
  },
9853
9890
  {
@@ -9857,7 +9894,7 @@ const Y = [
9857
9894
  style: "normal",
9858
9895
  weight: "700",
9859
9896
  display: "swap",
9860
- unicodeRange: H
9897
+ unicodeRange: Y
9861
9898
  }
9862
9899
  },
9863
9900
  {
@@ -9867,7 +9904,7 @@ const Y = [
9867
9904
  style: "normal",
9868
9905
  weight: "700",
9869
9906
  display: "swap",
9870
- unicodeRange: Y
9907
+ unicodeRange: W
9871
9908
  }
9872
9909
  },
9873
9910
  {
@@ -9877,7 +9914,7 @@ const Y = [
9877
9914
  style: "normal",
9878
9915
  weight: "800",
9879
9916
  display: "swap",
9880
- unicodeRange: H
9917
+ unicodeRange: Y
9881
9918
  }
9882
9919
  },
9883
9920
  {
@@ -9887,7 +9924,7 @@ const Y = [
9887
9924
  style: "normal",
9888
9925
  weight: "800",
9889
9926
  display: "swap",
9890
- unicodeRange: Y
9927
+ unicodeRange: W
9891
9928
  }
9892
9929
  },
9893
9930
  {
@@ -9897,7 +9934,7 @@ const Y = [
9897
9934
  style: "normal",
9898
9935
  weight: "900",
9899
9936
  display: "swap",
9900
- unicodeRange: H
9937
+ unicodeRange: Y
9901
9938
  }
9902
9939
  },
9903
9940
  {
@@ -9907,7 +9944,7 @@ const Y = [
9907
9944
  style: "normal",
9908
9945
  weight: "900",
9909
9946
  display: "swap",
9910
- unicodeRange: Y
9947
+ unicodeRange: W
9911
9948
  }
9912
9949
  },
9913
9950
  {
@@ -9917,7 +9954,7 @@ const Y = [
9917
9954
  style: "normal",
9918
9955
  weight: "400",
9919
9956
  display: "swap",
9920
- unicodeRange: H
9957
+ unicodeRange: Y
9921
9958
  }
9922
9959
  },
9923
9960
  {
@@ -9927,7 +9964,7 @@ const Y = [
9927
9964
  style: "normal",
9928
9965
  weight: "400",
9929
9966
  display: "swap",
9930
- unicodeRange: Y
9967
+ unicodeRange: W
9931
9968
  }
9932
9969
  },
9933
9970
  {
@@ -9937,7 +9974,7 @@ const Y = [
9937
9974
  style: "normal",
9938
9975
  weight: "700",
9939
9976
  display: "swap",
9940
- unicodeRange: H
9977
+ unicodeRange: Y
9941
9978
  }
9942
9979
  },
9943
9980
  {
@@ -9947,7 +9984,7 @@ const Y = [
9947
9984
  style: "normal",
9948
9985
  weight: "700",
9949
9986
  display: "swap",
9950
- unicodeRange: Y
9987
+ unicodeRange: W
9951
9988
  }
9952
9989
  },
9953
9990
  {
@@ -9957,7 +9994,7 @@ const Y = [
9957
9994
  style: "normal",
9958
9995
  weight: "100 900",
9959
9996
  display: "swap",
9960
- unicodeRange: H
9997
+ unicodeRange: Y
9961
9998
  }
9962
9999
  },
9963
10000
  {
@@ -9967,7 +10004,7 @@ const Y = [
9967
10004
  style: "normal",
9968
10005
  weight: "100 900",
9969
10006
  display: "swap",
9970
- unicodeRange: Y
10007
+ unicodeRange: W
9971
10008
  }
9972
10009
  },
9973
10010
  {
@@ -9977,7 +10014,7 @@ const Y = [
9977
10014
  style: "normal",
9978
10015
  weight: "300 700",
9979
10016
  display: "swap",
9980
- unicodeRange: H
10017
+ unicodeRange: Y
9981
10018
  }
9982
10019
  },
9983
10020
  {
@@ -9987,7 +10024,7 @@ const Y = [
9987
10024
  style: "normal",
9988
10025
  weight: "300 700",
9989
10026
  display: "swap",
9990
- unicodeRange: Y
10027
+ unicodeRange: W
9991
10028
  }
9992
10029
  },
9993
10030
  {
@@ -9997,7 +10034,7 @@ const Y = [
9997
10034
  style: "normal",
9998
10035
  weight: "400",
9999
10036
  display: "swap",
10000
- unicodeRange: H
10037
+ unicodeRange: Y
10001
10038
  }
10002
10039
  },
10003
10040
  {
@@ -10007,7 +10044,7 @@ const Y = [
10007
10044
  style: "normal",
10008
10045
  weight: "400",
10009
10046
  display: "swap",
10010
- unicodeRange: Y
10047
+ unicodeRange: W
10011
10048
  }
10012
10049
  },
10013
10050
  {
@@ -10017,7 +10054,7 @@ const Y = [
10017
10054
  style: "normal",
10018
10055
  weight: "200 800",
10019
10056
  display: "swap",
10020
- unicodeRange: H
10057
+ unicodeRange: Y
10021
10058
  }
10022
10059
  },
10023
10060
  {
@@ -10027,7 +10064,7 @@ const Y = [
10027
10064
  style: "normal",
10028
10065
  weight: "200 800",
10029
10066
  display: "swap",
10030
- unicodeRange: Y
10067
+ unicodeRange: W
10031
10068
  }
10032
10069
  },
10033
10070
  {
@@ -10037,7 +10074,7 @@ const Y = [
10037
10074
  style: "normal",
10038
10075
  weight: "100 900",
10039
10076
  display: "swap",
10040
- unicodeRange: H
10077
+ unicodeRange: Y
10041
10078
  }
10042
10079
  },
10043
10080
  {
@@ -10047,7 +10084,7 @@ const Y = [
10047
10084
  style: "normal",
10048
10085
  weight: "100 900",
10049
10086
  display: "swap",
10050
- unicodeRange: Y
10087
+ unicodeRange: W
10051
10088
  }
10052
10089
  },
10053
10090
  {
@@ -10057,7 +10094,7 @@ const Y = [
10057
10094
  style: "normal",
10058
10095
  weight: "400",
10059
10096
  display: "swap",
10060
- unicodeRange: H
10097
+ unicodeRange: Y
10061
10098
  }
10062
10099
  },
10063
10100
  {
@@ -10067,7 +10104,7 @@ const Y = [
10067
10104
  style: "normal",
10068
10105
  weight: "400",
10069
10106
  display: "swap",
10070
- unicodeRange: Y
10107
+ unicodeRange: W
10071
10108
  }
10072
10109
  },
10073
10110
  {
@@ -10077,7 +10114,7 @@ const Y = [
10077
10114
  style: "normal",
10078
10115
  weight: "100 900",
10079
10116
  display: "swap",
10080
- unicodeRange: H
10117
+ unicodeRange: Y
10081
10118
  }
10082
10119
  },
10083
10120
  {
@@ -10087,7 +10124,7 @@ const Y = [
10087
10124
  style: "normal",
10088
10125
  weight: "100 900",
10089
10126
  display: "swap",
10090
- unicodeRange: Y
10127
+ unicodeRange: W
10091
10128
  }
10092
10129
  },
10093
10130
  {
@@ -10097,7 +10134,7 @@ const Y = [
10097
10134
  style: "normal",
10098
10135
  weight: "300 800",
10099
10136
  display: "swap",
10100
- unicodeRange: H
10137
+ unicodeRange: Y
10101
10138
  }
10102
10139
  },
10103
10140
  {
@@ -10107,7 +10144,7 @@ const Y = [
10107
10144
  style: "normal",
10108
10145
  weight: "300 800",
10109
10146
  display: "swap",
10110
- unicodeRange: Y
10147
+ unicodeRange: W
10111
10148
  }
10112
10149
  },
10113
10150
  {
@@ -10117,7 +10154,7 @@ const Y = [
10117
10154
  style: "normal",
10118
10155
  weight: "400",
10119
10156
  display: "swap",
10120
- unicodeRange: H
10157
+ unicodeRange: Y
10121
10158
  }
10122
10159
  },
10123
10160
  {
@@ -10127,7 +10164,7 @@ const Y = [
10127
10164
  style: "normal",
10128
10165
  weight: "400",
10129
10166
  display: "swap",
10130
- unicodeRange: Y
10167
+ unicodeRange: W
10131
10168
  }
10132
10169
  },
10133
10170
  {
@@ -10137,7 +10174,7 @@ const Y = [
10137
10174
  style: "normal",
10138
10175
  weight: "700",
10139
10176
  display: "swap",
10140
- unicodeRange: H
10177
+ unicodeRange: Y
10141
10178
  }
10142
10179
  },
10143
10180
  {
@@ -10147,7 +10184,7 @@ const Y = [
10147
10184
  style: "normal",
10148
10185
  weight: "700",
10149
10186
  display: "swap",
10150
- unicodeRange: Y
10187
+ unicodeRange: W
10151
10188
  }
10152
10189
  },
10153
10190
  {
@@ -10157,7 +10194,7 @@ const Y = [
10157
10194
  style: "normal",
10158
10195
  weight: "300 900",
10159
10196
  display: "swap",
10160
- unicodeRange: H
10197
+ unicodeRange: Y
10161
10198
  }
10162
10199
  },
10163
10200
  {
@@ -10167,7 +10204,7 @@ const Y = [
10167
10204
  style: "normal",
10168
10205
  weight: "300 900",
10169
10206
  display: "swap",
10170
- unicodeRange: Y
10207
+ unicodeRange: W
10171
10208
  }
10172
10209
  },
10173
10210
  {
@@ -10177,7 +10214,7 @@ const Y = [
10177
10214
  style: "normal",
10178
10215
  weight: "400",
10179
10216
  display: "swap",
10180
- unicodeRange: H
10217
+ unicodeRange: Y
10181
10218
  }
10182
10219
  },
10183
10220
  {
@@ -10187,7 +10224,7 @@ const Y = [
10187
10224
  style: "normal",
10188
10225
  weight: "400",
10189
10226
  display: "swap",
10190
- unicodeRange: Y
10227
+ unicodeRange: W
10191
10228
  }
10192
10229
  },
10193
10230
  {
@@ -10197,7 +10234,7 @@ const Y = [
10197
10234
  style: "normal",
10198
10235
  weight: "100 900",
10199
10236
  display: "swap",
10200
- unicodeRange: H
10237
+ unicodeRange: Y
10201
10238
  }
10202
10239
  },
10203
10240
  {
@@ -10207,7 +10244,7 @@ const Y = [
10207
10244
  style: "normal",
10208
10245
  weight: "100 900",
10209
10246
  display: "swap",
10210
- unicodeRange: Y
10247
+ unicodeRange: W
10211
10248
  }
10212
10249
  },
10213
10250
  {
@@ -10217,7 +10254,7 @@ const Y = [
10217
10254
  style: "normal",
10218
10255
  weight: "100 900",
10219
10256
  display: "swap",
10220
- unicodeRange: H
10257
+ unicodeRange: Y
10221
10258
  }
10222
10259
  },
10223
10260
  {
@@ -10227,10 +10264,10 @@ const Y = [
10227
10264
  style: "normal",
10228
10265
  weight: "100 900",
10229
10266
  display: "swap",
10230
- unicodeRange: Y
10267
+ unicodeRange: W
10231
10268
  }
10232
10269
  }
10233
- ], gi = {
10270
+ ], pi = {
10234
10271
  /**
10235
10272
  * Опции редактора
10236
10273
  */
@@ -10322,10 +10359,10 @@ const Y = [
10322
10359
  /**
10323
10360
  * Список шрифтов, которые будут доступны в редакторе по умолчанию.
10324
10361
  */
10325
- fonts: fi
10362
+ fonts: gi
10326
10363
  };
10327
- function vi(h, t = {}) {
10328
- const e = P(P({}, gi), t), n = document.getElementById(h);
10364
+ function Si(h, t = {}) {
10365
+ const e = z(z({}, pi), t), n = document.getElementById(h);
10329
10366
  if (!n)
10330
10367
  return Promise.reject(new Error(`Контейнер с ID "${h}" не найден.`));
10331
10368
  const s = document.createElement("canvas");
@@ -10336,6 +10373,6 @@ function vi(h, t = {}) {
10336
10373
  });
10337
10374
  }
10338
10375
  export {
10339
- vi as default
10376
+ Si as default
10340
10377
  };
10341
10378
  //# sourceMappingURL=main.js.map