@snowcone-app/canvas 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/STYLING_CONTRACT.md +2 -2
  2. package/dist/{CanvasRenderer-BEf0hXeF.js → CanvasRenderer-hpJ05JGO.js} +4 -4
  3. package/dist/{CanvasRenderer-BEf0hXeF.js.map → CanvasRenderer-hpJ05JGO.js.map} +1 -1
  4. package/dist/{CanvasStateV1-BDSyYo4A.js → CanvasStateV1-jLOibojY.js} +11 -4
  5. package/dist/{CanvasStateV1-BDSyYo4A.js.map → CanvasStateV1-jLOibojY.js.map} +1 -1
  6. package/dist/{ContextualToolbars-C3D_6sep.js → ContextualToolbars-DRbuUE7W.js} +2086 -1985
  7. package/dist/ContextualToolbars-DRbuUE7W.js.map +1 -0
  8. package/dist/{EditorCanvasImpl-DXeBz2CX.js → EditorCanvasImpl-P2GHPNA3.js} +19 -20
  9. package/dist/{EditorCanvasImpl-DXeBz2CX.js.map → EditorCanvasImpl-P2GHPNA3.js.map} +1 -1
  10. package/dist/{ExportManager-DUdis6se.js → ExportManager-Bkzzyxgw.js} +400 -261
  11. package/dist/ExportManager-Bkzzyxgw.js.map +1 -0
  12. package/dist/{FontAnalyzer-DKG5JK0x.js → FontAnalyzer-BYhwxDhe.js} +1084 -1034
  13. package/dist/FontAnalyzer-BYhwxDhe.js.map +1 -0
  14. package/dist/{ImagePanel-CBgGqmVV.js → ImagePanel-CEr0_FYy.js} +49 -49
  15. package/dist/{ImagePanel-CBgGqmVV.js.map → ImagePanel-CEr0_FYy.js.map} +1 -1
  16. package/dist/{SnowconeCanvas-BWPBngvI.js → SnowconeCanvas-Fa0isFpO.js} +27 -27
  17. package/dist/{SnowconeCanvas-BWPBngvI.js.map → SnowconeCanvas-Fa0isFpO.js.map} +1 -1
  18. package/dist/advanced.mjs +14 -14
  19. package/dist/components/ImageToolbar.d.ts +4 -0
  20. package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +2 -0
  21. package/dist/components/toolbars/SecondaryPanels.d.ts +17 -1
  22. package/dist/components/toolbars/index.d.ts +2 -2
  23. package/dist/components/ui/SliderRow.d.ts +6 -0
  24. package/dist/components/ui/toolbar-button.d.ts +2 -2
  25. package/dist/core/image-adjustments.d.ts +32 -0
  26. package/dist/{custom-icons-BIaRovwG.js → custom-icons-Co4rcW0S.js} +7 -7
  27. package/dist/{custom-icons-BIaRovwG.js.map → custom-icons-Co4rcW0S.js.map} +1 -1
  28. package/dist/design-builder-CBG2hKc8.js +1672 -0
  29. package/dist/design-builder-CBG2hKc8.js.map +1 -0
  30. package/dist/{embed-Csez1hui.js → embed-D4TIzO7g.js} +110 -111
  31. package/dist/{embed-Csez1hui.js.map → embed-D4TIzO7g.js.map} +1 -1
  32. package/dist/embed.mjs +53 -54
  33. package/dist/embed.mjs.map +1 -1
  34. package/dist/{guards-BSoX73yg.js → guards-DgZuwVgu.js} +2 -2
  35. package/dist/{guards-BSoX73yg.js.map → guards-DgZuwVgu.js.map} +1 -1
  36. package/dist/hooks/elementPatch.d.ts +7 -2
  37. package/dist/index.mjs +41 -41
  38. package/dist/internals.mjs +196 -127
  39. package/dist/internals.mjs.map +1 -1
  40. package/dist/rendering/element-painters.d.ts +0 -13
  41. package/dist/rendering/element-serializer.d.ts +3 -1
  42. package/dist/rendering/image-adjustments.d.ts +24 -0
  43. package/dist/rendering/renderer-types.d.ts +8 -1
  44. package/dist/state/CanvasStateV1.d.ts +5 -0
  45. package/dist/template-fields-CvFcr5zy.js +505 -0
  46. package/dist/template-fields-CvFcr5zy.js.map +1 -0
  47. package/dist/testing.mjs +40 -41
  48. package/dist/testing.mjs.map +1 -1
  49. package/dist/types/index.d.ts +21 -0
  50. package/dist/{UnifiedFontService-Co9tQ59z.js → useCommands-bPXY9rCh.js} +2344 -2103
  51. package/dist/useCommands-bPXY9rCh.js.map +1 -0
  52. package/dist/{usePieceGuideBundle-CRLY2iQa.js → usePieceGuideBundle-Bj98nPk0.js} +2 -2
  53. package/dist/{usePieceGuideBundle-CRLY2iQa.js.map → usePieceGuideBundle-Bj98nPk0.js.map} +1 -1
  54. package/dist/utils/featureApplied.d.ts +2 -0
  55. package/dist/{validation-BGEl9rrE.js → validation-CsTlSvJJ.js} +465 -465
  56. package/dist/{validation-BGEl9rrE.js.map → validation-CsTlSvJJ.js.map} +1 -1
  57. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  58. package/example/package.json +1 -1
  59. package/package.json +1 -1
  60. package/dist/ContextualToolbars-C3D_6sep.js.map +0 -1
  61. package/dist/ExportManager-DUdis6se.js.map +0 -1
  62. package/dist/FontAnalyzer-DKG5JK0x.js.map +0 -1
  63. package/dist/UnifiedFontService-Co9tQ59z.js.map +0 -1
  64. package/dist/design-builder-JYLO_Hyi.js +0 -470
  65. package/dist/design-builder-JYLO_Hyi.js.map +0 -1
  66. package/dist/editorErrors-WzaNxU1Y.js +0 -1206
  67. package/dist/editorErrors-WzaNxU1Y.js.map +0 -1
  68. package/dist/template-fields-DYPW7bVU.js +0 -716
  69. package/dist/template-fields-DYPW7bVU.js.map +0 -1
@@ -1,29 +1,29 @@
1
- function oe(r) {
1
+ function ne(r) {
2
2
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
3
3
  }
4
- var Ht = { exports: {} }, O = Ht.exports = {}, X, _;
5
- function St() {
4
+ var Wt = { exports: {} }, O = Wt.exports = {}, X, N;
5
+ function Ct() {
6
6
  throw new Error("setTimeout has not been defined");
7
7
  }
8
- function Ct() {
8
+ function vt() {
9
9
  throw new Error("clearTimeout has not been defined");
10
10
  }
11
11
  (function() {
12
12
  try {
13
- typeof setTimeout == "function" ? X = setTimeout : X = St;
13
+ typeof setTimeout == "function" ? X = setTimeout : X = Ct;
14
14
  } catch {
15
- X = St;
15
+ X = Ct;
16
16
  }
17
17
  try {
18
- typeof clearTimeout == "function" ? _ = clearTimeout : _ = Ct;
18
+ typeof clearTimeout == "function" ? N = clearTimeout : N = vt;
19
19
  } catch {
20
- _ = Ct;
20
+ N = vt;
21
21
  }
22
22
  })();
23
- function Pt(r) {
23
+ function zt(r) {
24
24
  if (X === setTimeout)
25
25
  return setTimeout(r, 0);
26
- if ((X === St || !X) && setTimeout)
26
+ if ((X === Ct || !X) && setTimeout)
27
27
  return X = setTimeout, setTimeout(r, 0);
28
28
  try {
29
29
  return X(r, 0);
@@ -35,35 +35,35 @@ function Pt(r) {
35
35
  }
36
36
  }
37
37
  }
38
- function se(r) {
39
- if (_ === clearTimeout)
38
+ function ae(r) {
39
+ if (N === clearTimeout)
40
40
  return clearTimeout(r);
41
- if ((_ === Ct || !_) && clearTimeout)
42
- return _ = clearTimeout, clearTimeout(r);
41
+ if ((N === vt || !N) && clearTimeout)
42
+ return N = clearTimeout, clearTimeout(r);
43
43
  try {
44
- return _(r);
44
+ return N(r);
45
45
  } catch {
46
46
  try {
47
- return _.call(null, r);
47
+ return N.call(null, r);
48
48
  } catch {
49
- return _.call(this, r);
49
+ return N.call(this, r);
50
50
  }
51
51
  }
52
52
  }
53
- var Y = [], K = !1, V, dt = -1;
54
- function re() {
55
- !K || !V || (K = !1, V.length ? Y = V.concat(Y) : dt = -1, Y.length && Lt());
53
+ var _ = [], K = !1, V, dt = -1;
54
+ function he() {
55
+ !K || !V || (K = !1, V.length ? _ = V.concat(_) : dt = -1, _.length && Xt());
56
56
  }
57
- function Lt() {
57
+ function Xt() {
58
58
  if (!K) {
59
- var r = Pt(re);
59
+ var r = zt(he);
60
60
  K = !0;
61
- for (var t = Y.length; t; ) {
62
- for (V = Y, Y = []; ++dt < t; )
61
+ for (var t = _.length; t; ) {
62
+ for (V = _, _ = []; ++dt < t; )
63
63
  V && V[dt].run();
64
- dt = -1, t = Y.length;
64
+ dt = -1, t = _.length;
65
65
  }
66
- V = null, K = !1, se(r);
66
+ V = null, K = !1, ae(r);
67
67
  }
68
68
  }
69
69
  O.nextTick = function(r) {
@@ -71,12 +71,12 @@ O.nextTick = function(r) {
71
71
  if (arguments.length > 1)
72
72
  for (var e = 1; e < arguments.length; e++)
73
73
  t[e - 1] = arguments[e];
74
- Y.push(new Wt(r, t)), Y.length === 1 && !K && Pt(Lt);
74
+ _.push(new Nt(r, t)), _.length === 1 && !K && zt(Xt);
75
75
  };
76
- function Wt(r, t) {
76
+ function Nt(r, t) {
77
77
  this.fun = r, this.array = t;
78
78
  }
79
- Wt.prototype.run = function() {
79
+ Nt.prototype.run = function() {
80
80
  this.fun.apply(null, this.array);
81
81
  };
82
82
  O.title = "browser";
@@ -85,17 +85,17 @@ O.env = {};
85
85
  O.argv = [];
86
86
  O.version = "";
87
87
  O.versions = {};
88
- function N() {
89
- }
90
- O.on = N;
91
- O.addListener = N;
92
- O.once = N;
93
- O.off = N;
94
- O.removeListener = N;
95
- O.removeAllListeners = N;
96
- O.emit = N;
97
- O.prependListener = N;
98
- O.prependOnceListener = N;
88
+ function Y() {
89
+ }
90
+ O.on = Y;
91
+ O.addListener = Y;
92
+ O.once = Y;
93
+ O.off = Y;
94
+ O.removeListener = Y;
95
+ O.removeAllListeners = Y;
96
+ O.emit = Y;
97
+ O.prependListener = Y;
98
+ O.prependOnceListener = Y;
99
99
  O.listeners = function(r) {
100
100
  return [];
101
101
  };
@@ -111,12 +111,12 @@ O.chdir = function(r) {
111
111
  O.umask = function() {
112
112
  return 0;
113
113
  };
114
- var ne = Ht.exports;
115
- const ft = /* @__PURE__ */ oe(ne);
116
- let kt = 1;
114
+ var le = Wt.exports;
115
+ const ft = /* @__PURE__ */ ne(le);
116
+ let Bt = 1;
117
117
  class nt {
118
118
  constructor(t = {}) {
119
- this.transformType = "artboard", this.id = t.id || `artboard-${kt++}`, this.name = t.name || `Artboard ${kt}`, this.x = t.x !== void 0 ? t.x : 0, this.y = t.y !== void 0 ? t.y : 0, this.width = t.width || 1920, this.height = t.height || 1080, this.backgroundColor = t.backgroundColor || "#ffffff", t.backgroundType ? this.backgroundType = t.backgroundType : t.backgroundColor === "transparent" ? this.backgroundType = "transparent" : t.backgroundTexture ? this.backgroundType = "texture" : this.backgroundType = "color", this.backgroundTexture = t.backgroundTexture, this.exportBackground = t.exportBackground ?? !1, this.clipShape = t.clipShape, this.previewBackgroundColor = t.previewBackgroundColor, this.role = t.role, this.distressTexture = t.distressTexture ? { ...t.distressTexture } : void 0, this.imageMask = t.imageMask ? { ...t.imageMask } : void 0, this.elementIds = new Set(t.elementIds || []);
119
+ this.transformType = "artboard", this.id = t.id || `artboard-${Bt++}`, this.name = t.name || `Artboard ${Bt}`, this.x = t.x !== void 0 ? t.x : 0, this.y = t.y !== void 0 ? t.y : 0, this.width = t.width || 1920, this.height = t.height || 1080, this.backgroundColor = t.backgroundColor || "#ffffff", t.backgroundType ? this.backgroundType = t.backgroundType : t.backgroundColor === "transparent" ? this.backgroundType = "transparent" : t.backgroundTexture ? this.backgroundType = "texture" : this.backgroundType = "color", this.backgroundTexture = t.backgroundTexture, this.exportBackground = t.exportBackground ?? !1, this.clipShape = t.clipShape, this.previewBackgroundColor = t.previewBackgroundColor, this.role = t.role, this.distressTexture = t.distressTexture ? { ...t.distressTexture } : void 0, this.imageMask = t.imageMask ? { ...t.imageMask } : void 0, this.elementIds = new Set(t.elementIds || []);
120
120
  }
121
121
  /**
122
122
  * Get bounding box of the artboard
@@ -192,7 +192,7 @@ class nt {
192
192
  * Returns true if point is near the border (within tolerance)
193
193
  */
194
194
  hitTestBorder(t, e, i = 5) {
195
- const o = t >= this.x - i && t <= this.x + this.width + i, s = e >= this.y - i && e <= this.y + this.height + i, a = Math.abs(t - this.x) <= i && s, n = Math.abs(t - (this.x + this.width)) <= i && s, h = Math.abs(e - this.y) <= i && o, l = Math.abs(e - (this.y + this.height)) <= i && o;
195
+ const s = t >= this.x - i && t <= this.x + this.width + i, o = e >= this.y - i && e <= this.y + this.height + i, a = Math.abs(t - this.x) <= i && o, n = Math.abs(t - (this.x + this.width)) <= i && o, h = Math.abs(e - this.y) <= i && s, l = Math.abs(e - (this.y + this.height)) <= i && s;
196
196
  return a || n || h || l;
197
197
  }
198
198
  /**
@@ -274,7 +274,7 @@ class nt {
274
274
  this.x = t, this.y = e;
275
275
  }
276
276
  }
277
- class ti {
277
+ class ri {
278
278
  constructor() {
279
279
  this.artboards = /* @__PURE__ */ new Map(), this.elementToArtboard = /* @__PURE__ */ new Map(), this.activeArtboardId = null;
280
280
  }
@@ -302,11 +302,11 @@ class ti {
302
302
  if (!e)
303
303
  return [];
304
304
  const i = e.getElementIds();
305
- if (i.forEach((o) => {
306
- this.elementToArtboard.delete(o);
305
+ if (i.forEach((s) => {
306
+ this.elementToArtboard.delete(s);
307
307
  }), this.artboards.delete(t), this.activeArtboardId === t) {
308
- const o = Array.from(this.artboards.keys());
309
- this.activeArtboardId = o.length > 0 ? o[0] : null;
308
+ const s = Array.from(this.artboards.keys());
309
+ this.activeArtboardId = s.length > 0 ? s[0] : null;
310
310
  }
311
311
  return i;
312
312
  }
@@ -353,10 +353,10 @@ class ti {
353
353
  const i = this.artboards.get(e);
354
354
  if (!i)
355
355
  return !1;
356
- const o = this.elementToArtboard.get(t);
357
- if (o) {
358
- const s = this.artboards.get(o);
359
- s == null || s.removeElementId(t);
356
+ const s = this.elementToArtboard.get(t);
357
+ if (s) {
358
+ const o = this.artboards.get(s);
359
+ o == null || o.removeElementId(t);
360
360
  }
361
361
  return i.addElementId(t), this.elementToArtboard.set(t, e), !0;
362
362
  }
@@ -396,19 +396,19 @@ class ti {
396
396
  */
397
397
  findArtboardAtPoint(t, e) {
398
398
  const i = Array.from(this.artboards.values()).reverse();
399
- for (const o of i)
400
- if (o.containsPoint(t, e))
401
- return o;
399
+ for (const s of i)
400
+ if (s.containsPoint(t, e))
401
+ return s;
402
402
  return null;
403
403
  }
404
404
  /**
405
405
  * Find artboard border at point (for resize handles)
406
406
  */
407
407
  findArtboardBorderAtPoint(t, e, i = 5) {
408
- const o = Array.from(this.artboards.values()).reverse();
409
- for (const s of o)
410
- if (s.hitTestBorder(t, e, i))
411
- return s;
408
+ const s = Array.from(this.artboards.values()).reverse();
409
+ for (const o of s)
410
+ if (o.hitTestBorder(t, e, i))
411
+ return o;
412
412
  return null;
413
413
  }
414
414
  /**
@@ -449,8 +449,8 @@ class ti {
449
449
  reorderArtboards(t, e) {
450
450
  const i = Array.from(this.artboards.entries());
451
451
  if (t < 0 || t >= i.length || e < 0 || e >= i.length || t === e) return;
452
- const [o] = i.splice(t, 1);
453
- i.splice(e, 0, o), this.artboards = new Map(i);
452
+ const [s] = i.splice(t, 1);
453
+ i.splice(e, 0, s), this.artboards = new Map(i);
454
454
  }
455
455
  /**
456
456
  * Clear all artboards
@@ -473,8 +473,8 @@ class ti {
473
473
  fromJSON(t) {
474
474
  this.clear(), t.artboards.forEach((e) => {
475
475
  const i = nt.fromJSON(e);
476
- this.artboards.set(i.id, i), i.getElementIds().forEach((o) => {
477
- this.elementToArtboard.set(o, i.id);
476
+ this.artboards.set(i.id, i), i.getElementIds().forEach((s) => {
477
+ this.elementToArtboard.set(s, i.id);
478
478
  });
479
479
  }), this.activeArtboardId = t.activeArtboardId;
480
480
  }
@@ -484,11 +484,11 @@ class ti {
484
484
  */
485
485
  validateMappings(t) {
486
486
  const e = new Set(t.map((i) => i.id));
487
- for (const [i, o] of this.elementToArtboard.entries())
487
+ for (const [i, s] of this.elementToArtboard.entries())
488
488
  e.has(i) || this.removeElementFromArtboard(i);
489
489
  for (const i of this.artboards.values()) {
490
- const o = i.getElementIds().filter((s) => e.has(s));
491
- i.clearElementIds(), o.forEach((s) => i.addElementId(s));
490
+ const s = i.getElementIds().filter((o) => e.has(o));
491
+ i.clearElementIds(), s.forEach((o) => i.addElementId(o));
492
492
  }
493
493
  }
494
494
  }
@@ -521,7 +521,7 @@ const I = {
521
521
  return t > 180 && (t -= 360), t;
522
522
  }
523
523
  };
524
- let ae = 1;
524
+ let ce = 1;
525
525
  class Q {
526
526
  /** Whether this element clips content below it (derived from blendMode === 'clip') */
527
527
  get isClipping() {
@@ -531,7 +531,7 @@ class Q {
531
531
  t ? (this.blendMode = "clip", this.knockoutParts || (this.knockoutParts = { fill: !0, scope: "group" })) : this.blendMode === "clip" && (this.blendMode = "normal");
532
532
  }
533
533
  constructor(t = {}) {
534
- this.id = t.id || `element-${ae++}`, this.x = t.x !== void 0 ? t.x : 100, this.y = t.y !== void 0 ? t.y : 100, this.rotation = t.rotation !== void 0 ? t.rotation : 0, this.opacity = t.opacity !== void 0 ? t.opacity : 1, this.transformType = t.transformType || "custom", this.transformData = t.transformData || {}, this.blendMode = t.blendMode, this.knockoutParts = t.knockoutParts, this.stroke = t.stroke, this.masks = t.masks, this.distressEffect = t.distressEffect, t.isClipping && !t.blendMode && (this.blendMode = "clip", this.knockoutParts || (this.knockoutParts = { fill: !0, scope: "group" })), this.name = t.name, this.visible = t.visible !== void 0 ? t.visible : !0, this.locked = t.locked !== void 0 ? t.locked : !1;
534
+ this.id = t.id || `element-${ce++}`, this.x = t.x !== void 0 ? t.x : 100, this.y = t.y !== void 0 ? t.y : 100, this.rotation = t.rotation !== void 0 ? t.rotation : 0, this.opacity = t.opacity !== void 0 ? t.opacity : 1, this.transformType = t.transformType || "custom", this.transformData = t.transformData || {}, this.blendMode = t.blendMode, this.knockoutParts = t.knockoutParts, this.stroke = t.stroke, this.masks = t.masks, this.distressEffect = t.distressEffect, t.isClipping && !t.blendMode && (this.blendMode = "clip", this.knockoutParts || (this.knockoutParts = { fill: !0, scope: "group" })), this.name = t.name, this.visible = t.visible !== void 0 ? t.visible : !0, this.locked = t.locked !== void 0 ? t.locked : !1;
535
535
  }
536
536
  /**
537
537
  * Get visual bounding box (tight fit around actual rendered content)
@@ -554,7 +554,7 @@ class Q {
554
554
  * Uses visual bounding box for better user experience
555
555
  */
556
556
  hitTest(t, e) {
557
- const i = this.getVisualBoundingBox(), o = this.getRotationAnchor(), s = I.toRadiansInverse(this.rotation), a = Math.cos(s), n = Math.sin(s), h = t - o.x, l = e - o.y, c = h * a - l * n, g = h * n + l * a, d = o.x + c, f = o.y + g;
557
+ const i = this.getVisualBoundingBox(), s = this.getRotationAnchor(), o = I.toRadiansInverse(this.rotation), a = Math.cos(o), n = Math.sin(o), h = t - s.x, l = e - s.y, c = h * a - l * n, g = h * n + l * a, d = s.x + c, f = s.y + g;
558
558
  return d >= i.x && d <= i.x + i.width && f >= i.y && f <= i.y + i.height;
559
559
  }
560
560
  /**
@@ -665,10 +665,10 @@ class P {
665
665
  * @returns Point in local coordinates
666
666
  */
667
667
  worldToLocal(t, e) {
668
- const i = this.element.rotation * Math.PI / 180, o = Math.cos(i), s = Math.sin(i), a = t - this.element.x, n = e - this.element.y;
668
+ const i = this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i), a = t - this.element.x, n = e - this.element.y;
669
669
  return {
670
- x: a * o - n * s,
671
- y: a * s + n * o
670
+ x: a * s - n * o,
671
+ y: a * o + n * s
672
672
  };
673
673
  }
674
674
  /**
@@ -681,7 +681,7 @@ class P {
681
681
  * @returns Point in world coordinates
682
682
  */
683
683
  localToWorld(t, e) {
684
- const i = -this.element.rotation * Math.PI / 180, o = Math.cos(i), s = Math.sin(i), a = t * o - e * s, n = t * s + e * o;
684
+ const i = -this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i), a = t * s - e * o, n = t * o + e * s;
685
685
  return {
686
686
  x: this.element.x + a,
687
687
  y: this.element.y + n
@@ -697,10 +697,10 @@ class P {
697
697
  * @returns Delta in local space
698
698
  */
699
699
  worldDeltaToLocal(t, e) {
700
- const i = this.element.rotation * Math.PI / 180, o = Math.cos(i), s = Math.sin(i);
700
+ const i = this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i);
701
701
  return {
702
- dx: t * o - e * s,
703
- dy: t * s + e * o
702
+ dx: t * s - e * o,
703
+ dy: t * o + e * s
704
704
  };
705
705
  }
706
706
  /**
@@ -712,10 +712,10 @@ class P {
712
712
  * @returns Delta in world space
713
713
  */
714
714
  localDeltaToWorld(t, e) {
715
- const i = -this.element.rotation * Math.PI / 180, o = Math.cos(i), s = Math.sin(i);
715
+ const i = -this.element.rotation * Math.PI / 180, s = Math.cos(i), o = Math.sin(i);
716
716
  return {
717
- dx: t * o - e * s,
718
- dy: t * s + e * o
717
+ dx: t * s - e * o,
718
+ dy: t * o + e * s
719
719
  };
720
720
  }
721
721
  /**
@@ -729,11 +729,11 @@ class P {
729
729
  * @param angleDegrees - Rotation angle in degrees (positive = clockwise in UI)
730
730
  * @returns Rotated point in world space
731
731
  */
732
- static rotatePointAroundAnchor(t, e, i, o, s) {
733
- const a = -s * Math.PI / 180, n = Math.cos(a), h = Math.sin(a), l = t - i, c = e - o, g = l * n - c * h, d = l * h + c * n;
732
+ static rotatePointAroundAnchor(t, e, i, s, o) {
733
+ const a = -o * Math.PI / 180, n = Math.cos(a), h = Math.sin(a), l = t - i, c = e - s, g = l * n - c * h, d = l * h + c * n;
734
734
  return {
735
735
  x: i + g,
736
- y: o + d
736
+ y: s + d
737
737
  };
738
738
  }
739
739
  /**
@@ -791,7 +791,7 @@ class P {
791
791
  return new P(t);
792
792
  }
793
793
  }
794
- const he = [
794
+ const de = [
795
795
  // Bold/Display Fonts - Perfect for statements and headlines (49 fonts)
796
796
  {
797
797
  name: "Bebas Neue",
@@ -2267,10 +2267,10 @@ const he = [
2267
2267
  description: "Humanist monospace"
2268
2268
  }
2269
2269
  ];
2270
- function le() {
2271
- return he.map((r) => r.name);
2270
+ function ge() {
2271
+ return de.map((r) => r.name);
2272
2272
  }
2273
- const ei = {
2273
+ const ni = {
2274
2274
  system: "System Fonts",
2275
2275
  display: "Bold & Display",
2276
2276
  "sans-serif": "Sans Serif",
@@ -2282,99 +2282,99 @@ const ei = {
2282
2282
  decorative: "Decorative & Unique",
2283
2283
  monospace: "Monospace"
2284
2284
  };
2285
- function zt(r) {
2285
+ function _t(r) {
2286
2286
  if (typeof window > "u" || typeof document > "u")
2287
2287
  return "oklch(0% 0 0)";
2288
2288
  const t = r || document.documentElement;
2289
2289
  return getComputedStyle(t).getPropertyValue("--accent").trim() || "oklch(0% 0 0)";
2290
2290
  }
2291
- function ce(r) {
2291
+ function fe(r) {
2292
2292
  return typeof window > "u" || typeof document > "u" ? "light" : document.documentElement.getAttribute("data-theme") || "light";
2293
2293
  }
2294
- function Xt() {
2295
- return ce().includes("dark") ? "#60a5fa" : "#3b82f6";
2294
+ function Yt() {
2295
+ return fe().includes("dark") ? "#60a5fa" : "#3b82f6";
2296
2296
  }
2297
- function ii(r) {
2297
+ function ai(r) {
2298
2298
  if (typeof window > "u" || typeof document > "u")
2299
2299
  return "#FF0000";
2300
2300
  const t = r || document.documentElement;
2301
2301
  return getComputedStyle(t).getPropertyValue("--color-spacing-indicator").trim() || "#FF0000";
2302
2302
  }
2303
- function oi(r = 0.1, t) {
2304
- const e = zt(t);
2303
+ function hi(r = 0.1, t) {
2304
+ const e = _t(t);
2305
2305
  if (e.startsWith("oklch("))
2306
2306
  return `${e.slice(0, -1)} / ${r})`;
2307
2307
  if (e.startsWith("#")) {
2308
- const i = e.replace("#", ""), o = parseInt(i.substring(0, 2), 16), s = parseInt(i.substring(2, 4), 16), a = parseInt(i.substring(4, 6), 16);
2309
- return `rgba(${o}, ${s}, ${a}, ${r})`;
2308
+ const i = e.replace("#", ""), s = parseInt(i.substring(0, 2), 16), o = parseInt(i.substring(2, 4), 16), a = parseInt(i.substring(4, 6), 16);
2309
+ return `rgba(${s}, ${o}, ${a}, ${r})`;
2310
2310
  }
2311
2311
  return e;
2312
2312
  }
2313
- function si(r) {
2313
+ function li(r) {
2314
2314
  if (typeof window > "u" || typeof document > "u")
2315
2315
  return "oklch(0% 0 0 / 0.45)";
2316
2316
  const t = r || document.documentElement;
2317
2317
  return getComputedStyle(t).getPropertyValue("--color-text-selection").trim() || "oklch(0% 0 0 / 0.45)";
2318
2318
  }
2319
- function ri(r) {
2319
+ function ci(r) {
2320
2320
  if (typeof window > "u" || typeof document > "u")
2321
2321
  return "#b5f747";
2322
2322
  const t = r || document.documentElement;
2323
2323
  return getComputedStyle(t).getPropertyValue("--color-accent-hover").trim() || "#b5f747";
2324
2324
  }
2325
- function de(r) {
2325
+ function ue(r) {
2326
2326
  if (typeof window > "u" || typeof document > "u")
2327
2327
  return "oklch(0.2103 0.0059 285.89)";
2328
2328
  const t = r || document.documentElement;
2329
2329
  return getComputedStyle(t).getPropertyValue("--foreground").trim() || "oklch(0.2103 0.0059 285.89)";
2330
2330
  }
2331
- function ni(r) {
2331
+ function di(r) {
2332
2332
  if (typeof window > "u" || typeof document > "u")
2333
2333
  return "oklch(0.9607 0 0)";
2334
2334
  const t = r || document.documentElement;
2335
2335
  return getComputedStyle(t).getPropertyValue("--background").trim() || "oklch(0.9607 0 0)";
2336
2336
  }
2337
- function ai(r) {
2338
- const t = de(r);
2337
+ function gi(r) {
2338
+ const t = ue(r);
2339
2339
  return t.startsWith("oklch(") ? `${t.slice(0, -1)} / 0.2)` : "rgba(0,0,0,0.2)";
2340
2340
  }
2341
- function hi(r) {
2341
+ function fi(r) {
2342
2342
  if (typeof window > "u" || typeof document > "u")
2343
2343
  return "oklch(0% 0 0 / 0.2)";
2344
2344
  const t = document.documentElement;
2345
2345
  return getComputedStyle(t).getPropertyValue("--divider").trim() || "oklch(0% 0 0 / 0.2)";
2346
2346
  }
2347
- function li(r) {
2347
+ function ui(r) {
2348
2348
  if (typeof window > "u" || typeof document > "u")
2349
2349
  return "oklch(0% 0 0 / 0.5)";
2350
2350
  const t = document.documentElement, e = getComputedStyle(t).getPropertyValue("--foreground").trim();
2351
2351
  return e.startsWith("oklch(") ? `${e.slice(0, -1)} / 0.5)` : e || "oklch(0% 0 0 / 0.5)";
2352
2352
  }
2353
- function ci(r) {
2353
+ function mi(r) {
2354
2354
  if (typeof window > "u" || typeof document > "u")
2355
2355
  return "#b5f747";
2356
2356
  const t = document.documentElement;
2357
2357
  return getComputedStyle(t).getPropertyValue("--color-accent-hover-border").trim() || "#b5f747";
2358
2358
  }
2359
- function di(r) {
2359
+ function pi(r) {
2360
2360
  if (typeof window > "u" || typeof document > "u")
2361
2361
  return "oklch(0.2103 0.0059 285.89)";
2362
2362
  const t = document.documentElement;
2363
2363
  return getComputedStyle(t).getPropertyValue("--foreground").trim() || "oklch(0.2103 0.0059 285.89)";
2364
2364
  }
2365
- function gi(r) {
2365
+ function yi(r) {
2366
2366
  if (typeof window > "u" || typeof document > "u")
2367
2367
  return "oklch(1 0 0)";
2368
2368
  const t = document.documentElement;
2369
2369
  return getComputedStyle(t).getPropertyValue("--background").trim() || "oklch(1 0 0)";
2370
2370
  }
2371
- function fi(r) {
2371
+ function wi(r) {
2372
2372
  if (typeof window > "u" || typeof document > "u")
2373
2373
  return "oklch(0.2103 0.0059 285.89 / 0.5)";
2374
2374
  const t = document.documentElement, e = getComputedStyle(t).getPropertyValue("--foreground").trim();
2375
2375
  return e.startsWith("oklch(") ? `${e.slice(0, -1)} / 0.5)` : e || "oklch(0.2103 0.0059 285.89 / 0.5)";
2376
2376
  }
2377
- const ui = 1, mi = "#ffffff", ge = 20, pi = 6, yi = 24, fe = 16, ue = 36, me = 24, wi = 4, bi = "#FFFFFF", xi = 2, Si = 0.1, Ci = le(), Ti = [8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96, 128], j = 0, _t = 1.2, Yt = 50, pe = 8, ye = 999, we = /* @__PURE__ */ new Set([
2377
+ const bi = 1, xi = "#ffffff", me = 20, Si = 6, Ci = 24, pe = 16, ye = 36, we = 24, vi = 4, Ti = "#FFFFFF", Fi = 2, Ai = 0.1, Mi = ge(), Di = [8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96, 128], j = 0, Ut = 1.2, Gt = 50, be = 8, xe = 999, Se = /* @__PURE__ */ new Set([
2378
2378
  "Arial",
2379
2379
  "Arial Black",
2380
2380
  "Verdana",
@@ -2395,9 +2395,9 @@ const ui = 1, mi = "#ffffff", ge = 20, pi = 6, yi = 24, fe = 16, ue = 36, me = 2
2395
2395
  "Monaco",
2396
2396
  "Consolas",
2397
2397
  "Courier"
2398
- ]), be = 0.3;
2399
- var xe = /* @__PURE__ */ ((r) => (r[r.DEBUG = 0] = "DEBUG", r[r.INFO = 1] = "INFO", r[r.WARN = 2] = "WARN", r[r.ERROR = 3] = "ERROR", r[r.NONE = 4] = "NONE", r))(xe || {});
2400
- class Se {
2398
+ ]), Ce = 0.3;
2399
+ var ve = /* @__PURE__ */ ((r) => (r[r.DEBUG = 0] = "DEBUG", r[r.INFO = 1] = "INFO", r[r.WARN = 2] = "WARN", r[r.ERROR = 3] = "ERROR", r[r.NONE = 4] = "NONE", r))(ve || {});
2400
+ class Te {
2401
2401
  constructor() {
2402
2402
  var t;
2403
2403
  this.level = 0, this.enabled = typeof ft < "u" && ((t = ft.env) == null ? void 0 : t.NODE_ENV) !== "production";
@@ -2454,10 +2454,10 @@ class Se {
2454
2454
  * Create a scoped logger with a prefix for a specific module
2455
2455
  */
2456
2456
  scope(t) {
2457
- return new Ce(this, t);
2457
+ return new Fe(this, t);
2458
2458
  }
2459
2459
  }
2460
- class Ce {
2460
+ class Fe {
2461
2461
  constructor(t, e) {
2462
2462
  this.logger = t, this.scopeName = e;
2463
2463
  }
@@ -2474,8 +2474,8 @@ class Ce {
2474
2474
  this.logger.error(`[${this.scopeName}] ${t}`, ...e);
2475
2475
  }
2476
2476
  }
2477
- const Te = new Se(), pt = (r) => Te.scope(r), ve = pt("ImageLoadEvents"), Tt = /* @__PURE__ */ new Set();
2478
- function vi(r) {
2477
+ const Ae = new Te(), pt = (r) => Ae.scope(r), Me = pt("ImageLoadEvents"), Tt = /* @__PURE__ */ new Set();
2478
+ function Ii(r) {
2479
2479
  return Tt.add(r), () => {
2480
2480
  Tt.delete(r);
2481
2481
  };
@@ -2485,7 +2485,7 @@ function et(r) {
2485
2485
  try {
2486
2486
  t(r);
2487
2487
  } catch (e) {
2488
- ve.error("Listener error:", e);
2488
+ Me.error("Listener error:", e);
2489
2489
  }
2490
2490
  });
2491
2491
  }
@@ -2513,16 +2513,16 @@ class J {
2513
2513
  return e.refCount++, e.image;
2514
2514
  const i = new Image();
2515
2515
  i.crossOrigin = "anonymous";
2516
- const o = {
2516
+ const s = {
2517
2517
  image: i,
2518
2518
  refCount: 1,
2519
2519
  loaded: !1
2520
2520
  };
2521
2521
  return i.onload = () => {
2522
- o.loaded = !0;
2522
+ s.loaded = !0;
2523
2523
  }, i.onerror = () => {
2524
- o.loaded = !0;
2525
- }, this.cache.set(t, o), (!t.includes(":") || /^https?:\/\/|^data:|^blob:/.test(t)) && (i.src = t), i;
2524
+ s.loaded = !0;
2525
+ }, this.cache.set(t, s), (!t.includes(":") || /^https?:\/\/|^data:|^blob:/.test(t)) && (i.src = t), i;
2526
2526
  }
2527
2527
  /**
2528
2528
  * Release a reference to a cached image.
@@ -2571,26 +2571,62 @@ class J {
2571
2571
  this.cache.clear();
2572
2572
  }
2573
2573
  }
2574
- const it = pt("ImageElement"), Et = 3e4, Ot = 3, Fe = 1e3;
2574
+ const ki = Object.freeze({
2575
+ brightness: 1,
2576
+ contrast: 1,
2577
+ saturation: 1
2578
+ }), xt = 1e-3;
2579
+ function Dt(r) {
2580
+ return r ? Math.abs(r.brightness - 1) < xt && Math.abs(r.contrast - 1) < xt && Math.abs(r.saturation - 1) < xt : !0;
2581
+ }
2582
+ function De(r) {
2583
+ if (Dt(r)) return;
2584
+ const t = (e) => Math.round(e * 100) / 100;
2585
+ return {
2586
+ brightness: t(r.brightness),
2587
+ contrast: t(r.contrast),
2588
+ saturation: t(r.saturation)
2589
+ };
2590
+ }
2591
+ function Ei(r) {
2592
+ if (Dt(r)) return "neutral";
2593
+ const t = r;
2594
+ return `b${t.brightness}c${t.contrast}s${t.saturation}`;
2595
+ }
2596
+ let Ft = null;
2597
+ function Oi(r) {
2598
+ Ft = r;
2599
+ }
2600
+ function Ie(r, t) {
2601
+ if (Dt(t)) return r;
2602
+ if (!Ft)
2603
+ throw new Error(
2604
+ "[image-adjustments] no adjusted-source provider registered. Painting an image with non-neutral adjustments requires the rendering engine: import 'src/rendering/image-adjustments.js' (rendering/element-painters does this for every paint driver; a direct element.render() call in a test must import it too)."
2605
+ );
2606
+ return Ft(r, t);
2607
+ }
2608
+ const it = pt("ImageElement"), Rt = 3e4, Ht = 3, ke = 1e3;
2575
2609
  function x(r) {
2576
2610
  return r.transformData;
2577
2611
  }
2578
2612
  class yt extends Q {
2579
2613
  // Track URL acquired from ImageCache for release on destroy
2580
2614
  constructor(t = {}) {
2581
- var e, i, o, s, a, n, h, l, c, g;
2615
+ var i, s, o, a, n, h, l, c, g, d, f;
2582
2616
  super(t), this.svgBlobUrl = null, this.loadTimeoutId = null, this.retryAttempt = 0, this.cachedImageUrl = null, this.transformType = "image", this.transformData = {
2583
2617
  type: "image",
2584
- width: ((e = t.transformData) == null ? void 0 : e.width) || 200,
2585
- height: ((i = t.transformData) == null ? void 0 : i.height) || 200,
2618
+ width: ((i = t.transformData) == null ? void 0 : i.width) || 200,
2619
+ height: ((s = t.transformData) == null ? void 0 : s.height) || 200,
2586
2620
  cropX: ((o = t.transformData) == null ? void 0 : o.cropX) ?? 0,
2587
- cropY: ((s = t.transformData) == null ? void 0 : s.cropY) ?? 0,
2588
- cropWidth: ((a = t.transformData) == null ? void 0 : a.cropWidth) ?? 1,
2589
- cropHeight: ((n = t.transformData) == null ? void 0 : n.cropHeight) ?? 1,
2590
- flipHorizontal: ((h = t.transformData) == null ? void 0 : h.flipHorizontal) ?? !1,
2591
- flipVertical: ((l = t.transformData) == null ? void 0 : l.flipVertical) ?? !1,
2592
- borderRadius: ((c = t.transformData) == null ? void 0 : c.borderRadius) ?? 0
2593
- }, this.imageUrl = t.imageUrl || "", this.imageLoaded = !1, this.imageElement = null, this.imageAspectRatio = t.imageAspectRatio || 1, this.isSvg = ((g = t.imageUrl) == null ? void 0 : g.toLowerCase().endsWith(".svg")) || !1, this.preserveDimensions = t.preserveDimensions ?? !1, this.imageLoadState = t.imageUrl ? "loading" : "loaded", this.imageLoadError = null, this.isCropping = !1, this.onLoadCallback = t.onLoadCallback || null, this.imageUrl && this.loadImage(this.imageUrl);
2621
+ cropY: ((a = t.transformData) == null ? void 0 : a.cropY) ?? 0,
2622
+ cropWidth: ((n = t.transformData) == null ? void 0 : n.cropWidth) ?? 1,
2623
+ cropHeight: ((h = t.transformData) == null ? void 0 : h.cropHeight) ?? 1,
2624
+ flipHorizontal: ((l = t.transformData) == null ? void 0 : l.flipHorizontal) ?? !1,
2625
+ flipVertical: ((c = t.transformData) == null ? void 0 : c.flipVertical) ?? !1,
2626
+ borderRadius: ((g = t.transformData) == null ? void 0 : g.borderRadius) ?? 0
2627
+ };
2628
+ const e = De((d = t.transformData) == null ? void 0 : d.adjustments);
2629
+ e && (this.transformData.adjustments = e), this.imageUrl = t.imageUrl || "", this.imageLoaded = !1, this.imageElement = null, this.imageAspectRatio = t.imageAspectRatio || 1, this.isSvg = ((f = t.imageUrl) == null ? void 0 : f.toLowerCase().endsWith(".svg")) || !1, this.preserveDimensions = t.preserveDimensions ?? !1, this.imageLoadState = t.imageUrl ? "loading" : "loaded", this.imageLoadError = null, this.isCropping = !1, this.onLoadCallback = t.onLoadCallback || null, this.imageUrl && this.loadImage(this.imageUrl);
2594
2630
  }
2595
2631
  /**
2596
2632
  * Load image from URL
@@ -2619,40 +2655,40 @@ class yt extends Q {
2619
2655
  this.clearLoadTimeout(), this.releaseImageCache();
2620
2656
  const i = J.getInstance().acquire(t);
2621
2657
  this.cachedImageUrl = t;
2622
- let o = !1;
2623
- const s = () => {
2624
- o = !0, this.clearLoadTimeout();
2658
+ let s = !1;
2659
+ const o = () => {
2660
+ s = !0, this.clearLoadTimeout();
2625
2661
  };
2626
2662
  if (i.complete && i.naturalWidth > 0) {
2627
- s(), this.imageElement = i, this.imageLoaded = !0, this.imageLoadState = "loaded", this.imageLoadError = null, this.imageAspectRatio = i.naturalWidth / i.naturalHeight, this.preserveDimensions || (this.transformData.height = this.transformData.width / this.imageAspectRatio), this.onLoadCallback && this.onLoadCallback(this.clone()), et(this.id);
2663
+ o(), this.imageElement = i, this.imageLoaded = !0, this.imageLoadState = "loaded", this.imageLoadError = null, this.imageAspectRatio = i.naturalWidth / i.naturalHeight, this.preserveDimensions || (this.transformData.height = this.transformData.width / this.imageAspectRatio), this.onLoadCallback && this.onLoadCallback(this.clone()), et(this.id);
2628
2664
  return;
2629
2665
  }
2630
2666
  const a = i.onload, n = i.onerror;
2631
2667
  i.onload = (l) => {
2632
- o || (s(), this.imageElement = i, this.imageLoaded = !0, this.imageLoadState = "loaded", this.imageLoadError = null, this.imageAspectRatio = i.naturalWidth / i.naturalHeight, this.preserveDimensions || (this.transformData.height = this.transformData.width / this.imageAspectRatio), this.onLoadCallback && this.onLoadCallback(this.clone()), et(this.id), a && a !== i.onload && a(l));
2668
+ s || (o(), this.imageElement = i, this.imageLoaded = !0, this.imageLoadState = "loaded", this.imageLoadError = null, this.imageAspectRatio = i.naturalWidth / i.naturalHeight, this.preserveDimensions || (this.transformData.height = this.transformData.width / this.imageAspectRatio), this.onLoadCallback && this.onLoadCallback(this.clone()), et(this.id), a && a !== i.onload && a(l));
2633
2669
  }, i.onerror = (l) => {
2634
- if (o) return;
2635
- s();
2670
+ if (s) return;
2671
+ o();
2636
2672
  const c = new Error(`Failed to load image: ${t}`);
2637
2673
  this.handleLoadFailure(t, c), n && n !== i.onerror && n(l);
2638
2674
  }, this.loadTimeoutId = setTimeout(() => {
2639
- if (o) return;
2640
- s(), i.src = "";
2641
- const l = new Error(`Image load timed out after ${Et}ms: ${t}`);
2675
+ if (s) return;
2676
+ o(), i.src = "";
2677
+ const l = new Error(`Image load timed out after ${Rt}ms: ${t}`);
2642
2678
  this.handleLoadFailure(t, l);
2643
- }, Et), (!i.src || i.src !== t) && (i.src = t), !o && i.complete && i.naturalWidth > 0 && ((h = i.onload) == null || h.call(i, new Event("load")));
2679
+ }, Rt), (!i.src || i.src !== t) && (i.src = t), !s && i.complete && i.naturalWidth > 0 && ((h = i.onload) == null || h.call(i, new Event("load")));
2644
2680
  }
2645
2681
  /**
2646
2682
  * Handle a load failure - either retry with backoff or set error state.
2647
2683
  */
2648
2684
  handleLoadFailure(t, e) {
2649
- if (this.retryAttempt++, this.retryAttempt < Ot) {
2650
- const i = Fe * Math.pow(2, this.retryAttempt - 1);
2685
+ if (this.retryAttempt++, this.retryAttempt < Ht) {
2686
+ const i = ke * Math.pow(2, this.retryAttempt - 1);
2651
2687
  it.warn(`Image load attempt ${this.retryAttempt} failed, retrying in ${i}ms:`, t), this.imageLoadState = "retrying", this.imageLoadError = e, et(this.id), this.loadTimeoutId = setTimeout(() => {
2652
2688
  this.attemptLoadRegularImage(t);
2653
2689
  }, i);
2654
2690
  } else
2655
- it.error(`Image load failed after ${Ot} attempts:`, t), this.imageLoaded = !1, this.imageLoadState = "error", this.imageLoadError = e, et(this.id);
2691
+ it.error(`Image load failed after ${Ht} attempts:`, t), this.imageLoaded = !1, this.imageLoadState = "error", this.imageLoadError = e, et(this.id);
2656
2692
  }
2657
2693
  /**
2658
2694
  * Clear any pending load timeout
@@ -2689,10 +2725,10 @@ class yt extends Q {
2689
2725
  this.revokeSvgBlobUrl();
2690
2726
  const e = new Image();
2691
2727
  e.crossOrigin = "anonymous", e.onload = () => {
2692
- const o = document.createElement("canvas");
2693
- o.width = e.width * 4, o.height = e.height * 4;
2694
- const s = o.getContext("2d");
2695
- s.scale(4, 4), s.drawImage(e, 0, 0), o.toBlob((a) => {
2728
+ const s = document.createElement("canvas");
2729
+ s.width = e.width * 4, s.height = e.height * 4;
2730
+ const o = s.getContext("2d");
2731
+ o.scale(4, 4), o.drawImage(e, 0, 0), s.toBlob((a) => {
2696
2732
  if (!a) {
2697
2733
  it.error("Failed to convert SVG to blob"), this.imageLoaded = !1;
2698
2734
  return;
@@ -2713,10 +2749,10 @@ class yt extends Q {
2713
2749
  getBoundingBox() {
2714
2750
  if (this.isCropping) {
2715
2751
  const t = this.transformData.width * this.transformData.cropWidth, e = this.transformData.height * this.transformData.cropHeight;
2716
- let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), o = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
2717
- const s = this.transformData.flipHorizontal ? -1 : 1, a = this.transformData.flipVertical ? -1 : 1;
2718
- i *= s, o *= a;
2719
- const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n - o * h, c = i * h + o * n, g = this.x + l, d = this.y + c;
2752
+ let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), s = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
2753
+ const o = this.transformData.flipHorizontal ? -1 : 1, a = this.transformData.flipVertical ? -1 : 1;
2754
+ i *= o, s *= a;
2755
+ const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n - s * h, c = i * h + s * n, g = this.x + l, d = this.y + c;
2720
2756
  return {
2721
2757
  x: g - this.transformData.width / 2,
2722
2758
  y: d - this.transformData.height / 2,
@@ -2754,10 +2790,10 @@ class yt extends Q {
2754
2790
  getRotationAnchor() {
2755
2791
  if (this.isCropping) {
2756
2792
  const t = this.transformData.width * this.transformData.cropWidth, e = this.transformData.height * this.transformData.cropHeight;
2757
- let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), o = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
2758
- const s = this.transformData.flipHorizontal ? -1 : 1, a = this.transformData.flipVertical ? -1 : 1;
2759
- i *= s, o *= a;
2760
- const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n - o * h, c = i * h + o * n;
2793
+ let i = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + t / 2), s = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + e / 2);
2794
+ const o = this.transformData.flipHorizontal ? -1 : 1, a = this.transformData.flipVertical ? -1 : 1;
2795
+ i *= o, s *= a;
2796
+ const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = i * n - s * h, c = i * h + s * n;
2761
2797
  return {
2762
2798
  x: this.x + l,
2763
2799
  y: this.y + c
@@ -2774,10 +2810,10 @@ class yt extends Q {
2774
2810
  hitTest(t, e) {
2775
2811
  const i = this.worldToLocal(t, e);
2776
2812
  if (this.isCropping) {
2777
- const o = this.transformData.width * this.transformData.cropWidth, s = this.transformData.height * this.transformData.cropHeight, a = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + o / 2), n = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + s / 2), h = this.transformData.width / 2, l = this.transformData.height / 2;
2813
+ const s = this.transformData.width * this.transformData.cropWidth, o = this.transformData.height * this.transformData.cropHeight, a = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + s / 2), n = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + o / 2), h = this.transformData.width / 2, l = this.transformData.height / 2;
2778
2814
  return i.x >= a - h && i.x <= a + h && i.y >= n - l && i.y <= n + l;
2779
2815
  } else {
2780
- const o = this.transformData.width * this.transformData.cropWidth, s = this.transformData.height * this.transformData.cropHeight, a = o / 2, n = s / 2;
2816
+ const s = this.transformData.width * this.transformData.cropWidth, o = this.transformData.height * this.transformData.cropHeight, a = s / 2, n = o / 2;
2781
2817
  return i.x >= -a && i.x <= a && i.y >= -n && i.y <= n;
2782
2818
  }
2783
2819
  }
@@ -2789,57 +2825,61 @@ class yt extends Q {
2789
2825
  this.renderPlaceholder(t);
2790
2826
  return;
2791
2827
  }
2828
+ const s = Ie(
2829
+ this.imageElement,
2830
+ this.transformData.adjustments
2831
+ ), o = s.width, a = s.height;
2792
2832
  t.save(), this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = this.opacity), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
2793
- const o = this.transformData.flipHorizontal ? -1 : 1, s = this.transformData.flipVertical ? -1 : 1;
2794
- if (t.scale(o, s), this.isCropping) {
2795
- const a = this.transformData.width * this.transformData.cropWidth, n = this.transformData.height * this.transformData.cropHeight, h = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + a / 2), l = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + n / 2), c = h - this.transformData.width / 2, g = l - this.transformData.height / 2, d = this.transformData.borderRadius || 0;
2796
- if (d > 0) {
2833
+ const n = this.transformData.flipHorizontal ? -1 : 1, h = this.transformData.flipVertical ? -1 : 1;
2834
+ if (t.scale(n, h), this.isCropping) {
2835
+ const l = this.transformData.width * this.transformData.cropWidth, c = this.transformData.height * this.transformData.cropHeight, g = this.transformData.width / 2 - (this.transformData.cropX * this.transformData.width + l / 2), d = this.transformData.height / 2 - (this.transformData.cropY * this.transformData.height + c / 2), f = g - this.transformData.width / 2, u = d - this.transformData.height / 2, m = this.transformData.borderRadius || 0;
2836
+ if (m > 0) {
2797
2837
  t.save();
2798
- const f = Math.min(
2799
- d / 100 * Math.min(this.transformData.width, this.transformData.height),
2838
+ const p = Math.min(
2839
+ m / 100 * Math.min(this.transformData.width, this.transformData.height),
2800
2840
  this.transformData.width / 2,
2801
2841
  this.transformData.height / 2
2802
2842
  );
2803
- t.beginPath(), t.roundRect(c, g, this.transformData.width, this.transformData.height, f), t.clip();
2843
+ t.beginPath(), t.roundRect(f, u, this.transformData.width, this.transformData.height, p), t.clip();
2804
2844
  }
2805
2845
  t.drawImage(
2806
- this.imageElement,
2846
+ s,
2807
2847
  0,
2808
2848
  0,
2809
- this.imageElement.width,
2810
- this.imageElement.height,
2811
- c,
2812
- g,
2849
+ o,
2850
+ a,
2851
+ f,
2852
+ u,
2813
2853
  this.transformData.width,
2814
2854
  this.transformData.height
2815
- ), d > 0 && t.restore();
2855
+ ), m > 0 && t.restore();
2816
2856
  } else if (this.masks && this.masks.length > 0) {
2817
- const a = this.transformData.width * this.transformData.cropWidth, n = this.transformData.height * this.transformData.cropHeight, h = -a / 2, l = -n / 2, c = h - this.transformData.cropX * this.transformData.width, g = l - this.transformData.cropY * this.transformData.height;
2857
+ const l = this.transformData.width * this.transformData.cropWidth, c = this.transformData.height * this.transformData.cropHeight, g = -l / 2, d = -c / 2, f = g - this.transformData.cropX * this.transformData.width, u = d - this.transformData.cropY * this.transformData.height;
2818
2858
  t.drawImage(
2819
- this.imageElement,
2859
+ s,
2820
2860
  0,
2821
2861
  0,
2822
- this.imageElement.width,
2823
- this.imageElement.height,
2824
- c,
2825
- g,
2862
+ o,
2863
+ a,
2864
+ f,
2865
+ u,
2826
2866
  this.transformData.width,
2827
2867
  this.transformData.height
2828
2868
  );
2829
2869
  } else {
2830
- const a = this.transformData.width * this.transformData.cropWidth, n = this.transformData.height * this.transformData.cropHeight, h = -a / 2, l = -n / 2, c = this.transformData.borderRadius || 0;
2870
+ const l = this.transformData.width * this.transformData.cropWidth, c = this.transformData.height * this.transformData.cropHeight, g = -l / 2, d = -c / 2, f = this.transformData.borderRadius || 0;
2831
2871
  t.save();
2832
- const g = Math.min(c / 100 * Math.min(a, n), a / 2, n / 2);
2833
- t.beginPath(), t.roundRect(h, l, a, n, g), t.clip();
2834
- const d = h - this.transformData.cropX * this.transformData.width, f = l - this.transformData.cropY * this.transformData.height;
2872
+ const u = Math.min(f / 100 * Math.min(l, c), l / 2, c / 2);
2873
+ t.beginPath(), t.roundRect(g, d, l, c, u), t.clip();
2874
+ const m = g - this.transformData.cropX * this.transformData.width, p = d - this.transformData.cropY * this.transformData.height;
2835
2875
  t.drawImage(
2836
- this.imageElement,
2876
+ s,
2837
2877
  0,
2838
2878
  0,
2839
- this.imageElement.width,
2840
- this.imageElement.height,
2841
- d,
2842
- f,
2879
+ o,
2880
+ a,
2881
+ m,
2882
+ p,
2843
2883
  this.transformData.width,
2844
2884
  this.transformData.height
2845
2885
  ), t.restore();
@@ -2852,51 +2892,51 @@ class yt extends Q {
2852
2892
  */
2853
2893
  renderPlaceholder(t) {
2854
2894
  t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
2855
- const e = this.transformData.width * this.transformData.cropWidth, i = this.transformData.height * this.transformData.cropHeight, o = -e / 2, s = -i / 2;
2895
+ const e = this.transformData.width * this.transformData.cropWidth, i = this.transformData.height * this.transformData.cropHeight, s = -e / 2, o = -i / 2;
2856
2896
  let a, n, h;
2857
- this.imageLoadState === "error" ? (a = "#f0e0e0", n = "#993333", h = "Image failed to load") : this.imageLoadState === "retrying" ? (a = "#e0e0e0", n = "#666", h = "Retrying...") : this.imageLoadState === "loading" ? (a = "#e0e0e0", n = "#666", h = "Loading...") : (a = "#e0e0e0", n = "#666", h = this.imageUrl ? "Loading..." : "No image"), t.fillStyle = a, t.fillRect(o, s, e, i), t.fillStyle = n, t.font = "14px system-ui, -apple-system, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText(h, 0, 0), t.restore();
2897
+ this.imageLoadState === "error" ? (a = "#f0e0e0", n = "#993333", h = "Image failed to load") : this.imageLoadState === "retrying" ? (a = "#e0e0e0", n = "#666", h = "Retrying...") : this.imageLoadState === "loading" ? (a = "#e0e0e0", n = "#666", h = "Loading...") : (a = "#e0e0e0", n = "#666", h = this.imageUrl ? "Loading..." : "No image"), t.fillStyle = a, t.fillRect(s, o, e, i), t.fillStyle = n, t.font = "14px system-ui, -apple-system, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText(h, 0, 0), t.restore();
2858
2898
  }
2859
2899
  /**
2860
2900
  * Handle resize - maintain aspect ratio
2861
2901
  * @returns {boolean} true if resize was applied
2862
2902
  */
2863
- resize(t, e, i, o) {
2864
- let s, a;
2865
- this.isCropping ? (s = e / x(o).width, a = i / x(o).height) : (s = e / (o.width ?? 1), a = i / (o.height ?? 1));
2866
- const n = (s + a) / 2;
2903
+ resize(t, e, i, s) {
2904
+ let o, a;
2905
+ this.isCropping ? (o = e / x(s).width, a = i / x(s).height) : (o = e / (s.width ?? 1), a = i / (s.height ?? 1));
2906
+ const n = (o + a) / 2;
2867
2907
  let h = t;
2868
- this.isCropping && (h = this.remapAnchorForFlips(t, o));
2908
+ this.isCropping && (h = this.remapAnchorForFlips(t, s));
2869
2909
  let l = n;
2870
2910
  if (this.isCropping) {
2871
- const B = this.transformData.width / x(o).width;
2911
+ const B = this.transformData.width / x(s).width;
2872
2912
  n < B && (l = this.calculateMinScaleForCropBounds(
2873
2913
  h,
2874
- o,
2914
+ s,
2875
2915
  n,
2876
2916
  B
2877
2917
  ));
2878
2918
  }
2879
- this.transformData.width = x(o).width * l, this.transformData.height = this.transformData.width / this.imageAspectRatio, this.rotation = o.rotation;
2919
+ this.transformData.width = x(s).width * l, this.transformData.height = this.transformData.width / this.imageAspectRatio, this.rotation = s.rotation;
2880
2920
  let c, g;
2881
2921
  if (this.isCropping) {
2882
- const B = (x(o).cropX + x(o).cropWidth / 2) * x(o).width - x(o).width / 2, A = (x(o).cropY + x(o).cropHeight / 2) * x(o).height - x(o).height / 2, k = B, R = A, E = P.fromSnapshot(o).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
2883
- c = o.x - W, g = o.y - z;
2922
+ const B = (x(s).cropX + x(s).cropWidth / 2) * x(s).width - x(s).width / 2, A = (x(s).cropY + x(s).cropHeight / 2) * x(s).height - x(s).height / 2, k = B, R = A, E = P.fromSnapshot(s).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
2923
+ c = s.x - W, g = s.y - z;
2884
2924
  } else {
2885
- const B = (x(o).cropX + x(o).cropWidth / 2) * x(o).width - x(o).width / 2, A = (x(o).cropY + x(o).cropHeight / 2) * x(o).height - x(o).height / 2, k = B, R = A, E = P.fromSnapshot(o).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
2886
- c = o.x - W, g = o.y - z;
2925
+ const B = (x(s).cropX + x(s).cropWidth / 2) * x(s).width - x(s).width / 2, A = (x(s).cropY + x(s).cropHeight / 2) * x(s).height - x(s).height / 2, k = B, R = A, E = P.fromSnapshot(s).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
2926
+ c = s.x - W, g = s.y - z;
2887
2927
  }
2888
2928
  let d, f, u = 0, m = 0;
2889
- h === "top-left" ? (u = x(o).width / 2, m = x(o).height / 2) : h === "top-right" ? (u = -x(o).width / 2, m = x(o).height / 2) : h === "bottom-left" ? (u = x(o).width / 2, m = -x(o).height / 2) : h === "bottom-right" ? (u = -x(o).width / 2, m = -x(o).height / 2) : h === "middle-left" ? (u = x(o).width / 2, m = 0) : h === "middle-right" ? (u = -x(o).width / 2, m = 0) : h === "middle-top" ? (u = 0, m = x(o).height / 2) : h === "middle-bottom" && (u = 0, m = -x(o).height / 2);
2890
- const y = P.fromSnapshot(o).localDeltaToWorld(u, m), w = y.dx, S = y.dy;
2929
+ h === "top-left" ? (u = x(s).width / 2, m = x(s).height / 2) : h === "top-right" ? (u = -x(s).width / 2, m = x(s).height / 2) : h === "bottom-left" ? (u = x(s).width / 2, m = -x(s).height / 2) : h === "bottom-right" ? (u = -x(s).width / 2, m = -x(s).height / 2) : h === "middle-left" ? (u = x(s).width / 2, m = 0) : h === "middle-right" ? (u = -x(s).width / 2, m = 0) : h === "middle-top" ? (u = 0, m = x(s).height / 2) : h === "middle-bottom" && (u = 0, m = -x(s).height / 2);
2930
+ const y = P.fromSnapshot(s).localDeltaToWorld(u, m), w = y.dx, S = y.dy;
2891
2931
  d = c + w, f = g + S;
2892
- let b = 0, T = 0;
2893
- h === "top-left" ? (b = this.transformData.width / 2, T = this.transformData.height / 2) : h === "top-right" ? (b = -this.transformData.width / 2, T = this.transformData.height / 2) : h === "bottom-left" ? (b = this.transformData.width / 2, T = -this.transformData.height / 2) : h === "bottom-right" ? (b = -this.transformData.width / 2, T = -this.transformData.height / 2) : h === "middle-left" ? (b = this.transformData.width / 2, T = 0) : h === "middle-right" ? (b = -this.transformData.width / 2, T = 0) : h === "middle-top" ? (b = 0, T = this.transformData.height / 2) : h === "middle-bottom" && (b = 0, T = -this.transformData.height / 2);
2894
- const M = new P(this).localDeltaToWorld(b, T), F = M.dx, v = M.dy, D = d - F, U = f - v;
2932
+ let b = 0, v = 0;
2933
+ h === "top-left" ? (b = this.transformData.width / 2, v = this.transformData.height / 2) : h === "top-right" ? (b = -this.transformData.width / 2, v = this.transformData.height / 2) : h === "bottom-left" ? (b = this.transformData.width / 2, v = -this.transformData.height / 2) : h === "bottom-right" ? (b = -this.transformData.width / 2, v = -this.transformData.height / 2) : h === "middle-left" ? (b = this.transformData.width / 2, v = 0) : h === "middle-right" ? (b = -this.transformData.width / 2, v = 0) : h === "middle-top" ? (b = 0, v = this.transformData.height / 2) : h === "middle-bottom" && (b = 0, v = -this.transformData.height / 2);
2934
+ const M = new P(this).localDeltaToWorld(b, v), F = M.dx, T = M.dy, D = d - F, U = f - T;
2895
2935
  if (this.isCropping) {
2896
- const B = o.x, A = o.y, k = x(o).cropWidth * x(o).width, R = x(o).cropHeight * x(o).height;
2936
+ const B = s.x, A = s.y, k = x(s).cropWidth * x(s).width, R = x(s).cropHeight * x(s).height;
2897
2937
  this.x = B, this.y = A;
2898
- const H = k / this.transformData.width, E = R / this.transformData.height, W = B - D, z = A - U, It = new P(this).worldDeltaToLocal(W, z), Zt = It.dx, Kt = It.dy, Qt = this.transformData.width / 2 + Zt, te = this.transformData.height / 2 + Kt, ee = Qt / this.transformData.width - H / 2, ie = te / this.transformData.height - E / 2;
2899
- this.transformData.cropX = ee, this.transformData.cropY = ie, this.transformData.cropWidth = H, this.transformData.cropHeight = E;
2938
+ const H = k / this.transformData.width, E = R / this.transformData.height, W = B - D, z = A - U, Ot = new P(this).worldDeltaToLocal(W, z), te = Ot.dx, ee = Ot.dy, ie = this.transformData.width / 2 + te, se = this.transformData.height / 2 + ee, oe = ie / this.transformData.width - H / 2, re = se / this.transformData.height - E / 2;
2939
+ this.transformData.cropX = oe, this.transformData.cropY = re, this.transformData.cropWidth = H, this.transformData.cropHeight = E;
2900
2940
  } else {
2901
2941
  const B = (this.transformData.cropX + this.transformData.cropWidth / 2) * this.transformData.width - this.transformData.width / 2, A = (this.transformData.cropY + this.transformData.cropHeight / 2) * this.transformData.height - this.transformData.height / 2, k = B, R = A, E = new P(this).localDeltaToWorld(k, R), W = E.dx, z = E.dy;
2902
2942
  this.x = D + W, this.y = U + z;
@@ -2955,9 +2995,9 @@ class yt extends Q {
2955
2995
  // bottom-left
2956
2996
  { x: t.x + t.width, y: t.y + t.height }
2957
2997
  // bottom-right
2958
- ].map((s) => ({
2959
- x: this.x + s.x * e - s.y * i,
2960
- y: this.y + s.x * i + s.y * e
2998
+ ].map((o) => ({
2999
+ x: this.x + o.x * e - o.y * i,
3000
+ y: this.y + o.x * i + o.y * e
2961
3001
  }));
2962
3002
  }
2963
3003
  /**
@@ -2965,8 +3005,8 @@ class yt extends Q {
2965
3005
  * Local coordinates are relative to this.x, this.y (the center of the visible area)
2966
3006
  */
2967
3007
  worldToLocal(t, e) {
2968
- const i = t - this.x, o = e - this.y, s = Math.cos(I.toRadiansInverse(this.rotation)), a = Math.sin(I.toRadiansInverse(this.rotation));
2969
- let n = i * s - o * a, h = i * a + o * s;
3008
+ const i = t - this.x, s = e - this.y, o = Math.cos(I.toRadiansInverse(this.rotation)), a = Math.sin(I.toRadiansInverse(this.rotation));
3009
+ let n = i * o - s * a, h = i * a + s * o;
2970
3010
  const l = this.transformData.flipHorizontal ? -1 : 1, c = this.transformData.flipVertical ? -1 : 1;
2971
3011
  return n *= l, h *= c, {
2972
3012
  x: n,
@@ -2979,9 +3019,9 @@ class yt extends Q {
2979
3019
  * Canvas transformations are applied in reverse: scale -> rotate -> translate
2980
3020
  */
2981
3021
  localToWorld(t, e) {
2982
- const i = this.transformData.flipHorizontal ? -1 : 1, o = this.transformData.flipVertical ? -1 : 1;
2983
- let s = t * i, a = e * o;
2984
- const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = s * n - a * h, c = s * h + a * n;
3022
+ const i = this.transformData.flipHorizontal ? -1 : 1, s = this.transformData.flipVertical ? -1 : 1;
3023
+ let o = t * i, a = e * s;
3024
+ const n = Math.cos(I.toRadians(this.rotation)), h = Math.sin(I.toRadians(this.rotation)), l = o * n - a * h, c = o * h + a * n;
2985
3025
  return {
2986
3026
  x: this.x + l,
2987
3027
  y: this.y + c
@@ -2996,29 +3036,29 @@ class yt extends Q {
2996
3036
  */
2997
3037
  hitTestCropHandle(t, e, i = 1) {
2998
3038
  if (!this.isCropping) return null;
2999
- const o = this.getCropBoxBounds();
3000
- if (!o) return null;
3001
- const s = this.worldToLocal(t, e), a = 1 / i, n = fe * a, h = ue * a, l = me * a, c = [
3002
- { x: o.x, y: o.y, anchor: "top-left" },
3003
- { x: o.x + o.width, y: o.y, anchor: "top-right" },
3004
- { x: o.x, y: o.y + o.height, anchor: "bottom-left" },
3005
- { x: o.x + o.width, y: o.y + o.height, anchor: "bottom-right" }
3039
+ const s = this.getCropBoxBounds();
3040
+ if (!s) return null;
3041
+ const o = this.worldToLocal(t, e), a = 1 / i, n = pe * a, h = ye * a, l = we * a, c = [
3042
+ { x: s.x, y: s.y, anchor: "top-left" },
3043
+ { x: s.x + s.width, y: s.y, anchor: "top-right" },
3044
+ { x: s.x, y: s.y + s.height, anchor: "bottom-left" },
3045
+ { x: s.x + s.width, y: s.y + s.height, anchor: "bottom-right" }
3006
3046
  ];
3007
3047
  for (const d of c) {
3008
- const f = s.x - d.x, u = s.y - d.y;
3048
+ const f = o.x - d.x, u = o.y - d.y;
3009
3049
  if (Math.sqrt(f * f + u * u) <= n) {
3010
3050
  const p = this.localToWorld(d.x, d.y);
3011
3051
  return { type: "corner", anchor: d.anchor, worldX: p.x, worldY: p.y };
3012
3052
  }
3013
3053
  }
3014
3054
  const g = [
3015
- { x: o.x + o.width / 2, y: o.y, anchor: "top", orientation: "horizontal" },
3016
- { x: o.x + o.width / 2, y: o.y + o.height, anchor: "bottom", orientation: "horizontal" },
3017
- { x: o.x, y: o.y + o.height / 2, anchor: "left", orientation: "vertical" },
3018
- { x: o.x + o.width, y: o.y + o.height / 2, anchor: "right", orientation: "vertical" }
3055
+ { x: s.x + s.width / 2, y: s.y, anchor: "top", orientation: "horizontal" },
3056
+ { x: s.x + s.width / 2, y: s.y + s.height, anchor: "bottom", orientation: "horizontal" },
3057
+ { x: s.x, y: s.y + s.height / 2, anchor: "left", orientation: "vertical" },
3058
+ { x: s.x + s.width, y: s.y + s.height / 2, anchor: "right", orientation: "vertical" }
3019
3059
  ];
3020
3060
  for (const d of g) {
3021
- const f = s.x - d.x, u = s.y - d.y;
3061
+ const f = o.x - d.x, u = o.y - d.y;
3022
3062
  let m, p;
3023
3063
  if (d.orientation === "horizontal" ? (m = h / 2, p = l / 2) : (m = l / 2, p = h / 2), Math.abs(f) <= m && Math.abs(u) <= p) {
3024
3064
  const y = this.localToWorld(d.x, d.y);
@@ -3035,8 +3075,8 @@ class yt extends Q {
3035
3075
  if (!this.isCropping) return !1;
3036
3076
  const i = this.getCropBoxBounds();
3037
3077
  if (!i) return !1;
3038
- const o = this.worldToLocal(t, e);
3039
- return o.x >= i.x && o.x <= i.x + i.width && o.y >= i.y && o.y <= i.y + i.height;
3078
+ const s = this.worldToLocal(t, e);
3079
+ return s.x >= i.x && s.x <= i.x + i.width && s.y >= i.y && s.y <= i.y + i.height;
3040
3080
  }
3041
3081
  /**
3042
3082
  * Update crop box (normalized 0-1 coordinates)
@@ -3046,46 +3086,46 @@ class yt extends Q {
3046
3086
  * @param {number} cropHeight - Normalized height (0-1)
3047
3087
  * @param {boolean} adjustPosition - Whether to adjust this.x, this.y to keep visual position stable (default: false)
3048
3088
  */
3049
- updateCrop(t, e, i, o, s = !1) {
3050
- let n = Math.max(0.1, Math.min(1, i)), h = Math.max(0.1, Math.min(1, o)), l = Math.max(0, Math.min(1 - n, t)), c = Math.max(0, Math.min(1 - h, e));
3089
+ updateCrop(t, e, i, s, o = !1) {
3090
+ let n = Math.max(0.1, Math.min(1, i)), h = Math.max(0.1, Math.min(1, s)), l = Math.max(0, Math.min(1 - n, t)), c = Math.max(0, Math.min(1 - h, e));
3051
3091
  l + n > 1 && (n = 1 - l), c + h > 1 && (h = 1 - c);
3052
3092
  let g = 0, d = 0;
3053
- if (s) {
3093
+ if (o) {
3054
3094
  const f = this.transformData.cropX * this.transformData.width + this.transformData.cropWidth * this.transformData.width / 2, u = this.transformData.cropY * this.transformData.height + this.transformData.cropHeight * this.transformData.height / 2, m = l * this.transformData.width + n * this.transformData.width / 2, p = c * this.transformData.height + h * this.transformData.height / 2, y = m - f, w = p - u, S = Math.cos(I.toRadians(this.rotation)), b = Math.sin(I.toRadians(this.rotation));
3055
3095
  g = y * S - w * b, d = y * b + w * S;
3056
3096
  }
3057
- this.transformData.cropX = l, this.transformData.cropY = c, this.transformData.cropWidth = n, this.transformData.cropHeight = h, s && (this.x += g, this.y += d);
3097
+ this.transformData.cropX = l, this.transformData.cropY = c, this.transformData.cropWidth = n, this.transformData.cropHeight = h, o && (this.x += g, this.y += d);
3058
3098
  }
3059
3099
  /**
3060
3100
  * Get the local position of the corner opposite to the given anchor
3061
3101
  * Corners are relative to frame center
3062
3102
  */
3063
3103
  getOppositeCornerLocalPosition(t, e, i) {
3064
- const o = e / 2, s = i / 2;
3104
+ const s = e / 2, o = i / 2;
3065
3105
  return {
3066
- "top-left": { x: o, y: s },
3106
+ "top-left": { x: s, y: o },
3067
3107
  // Opposite is bottom-right
3068
- "top-right": { x: -o, y: s },
3108
+ "top-right": { x: -s, y: o },
3069
3109
  // Opposite is bottom-left
3070
- "bottom-left": { x: o, y: -s },
3110
+ "bottom-left": { x: s, y: -o },
3071
3111
  // Opposite is top-right
3072
- "bottom-right": { x: -o, y: -s },
3112
+ "bottom-right": { x: -s, y: -o },
3073
3113
  // Opposite is top-left
3074
- top: { x: 0, y: s },
3114
+ top: { x: 0, y: o },
3075
3115
  // Opposite is bottom edge
3076
- bottom: { x: 0, y: -s },
3116
+ bottom: { x: 0, y: -o },
3077
3117
  // Opposite is top edge
3078
- left: { x: o, y: 0 },
3118
+ left: { x: s, y: 0 },
3079
3119
  // Opposite is right edge
3080
- right: { x: -o, y: 0 },
3120
+ right: { x: -s, y: 0 },
3081
3121
  // Opposite is left edge
3082
- "middle-top": { x: 0, y: s },
3122
+ "middle-top": { x: 0, y: o },
3083
3123
  // Opposite is bottom edge
3084
- "middle-bottom": { x: 0, y: -s },
3124
+ "middle-bottom": { x: 0, y: -o },
3085
3125
  // Opposite is top edge
3086
- "middle-left": { x: o, y: 0 },
3126
+ "middle-left": { x: s, y: 0 },
3087
3127
  // Opposite is right edge
3088
- "middle-right": { x: -o, y: 0 }
3128
+ "middle-right": { x: -s, y: 0 }
3089
3129
  // Opposite is left edge
3090
3130
  }[t];
3091
3131
  }
@@ -3094,7 +3134,7 @@ class yt extends Q {
3094
3134
  * In crop mode, this.x/y is the crop center, not the frame center
3095
3135
  */
3096
3136
  calculateFrameCenterFromCropCenter(t) {
3097
- const e = x(t).width * x(t).cropWidth, i = x(t).height * x(t).cropHeight, o = x(t).width / 2 - (x(t).cropX * x(t).width + e / 2), s = x(t).height / 2 - (x(t).cropY * x(t).height + i / 2), n = new P(t).localDeltaToWorld(o, s);
3137
+ const e = x(t).width * x(t).cropWidth, i = x(t).height * x(t).cropHeight, s = x(t).width / 2 - (x(t).cropX * x(t).width + e / 2), o = x(t).height / 2 - (x(t).cropY * x(t).height + i / 2), n = new P(t).localDeltaToWorld(s, o);
3098
3138
  return {
3099
3139
  x: t.x + n.dx,
3100
3140
  y: t.y + n.dy
@@ -3108,10 +3148,10 @@ class yt extends Q {
3108
3148
  t,
3109
3149
  x(e).width,
3110
3150
  x(e).height
3111
- ), o = this.calculateFrameCenterFromCropCenter(e), a = new P(e).localDeltaToWorld(i.x, i.y);
3151
+ ), s = this.calculateFrameCenterFromCropCenter(e), a = new P(e).localDeltaToWorld(i.x, i.y);
3112
3152
  return {
3113
- x: o.x + a.dx,
3114
- y: o.y + a.dy
3153
+ x: s.x + a.dx,
3154
+ y: s.y + a.dy
3115
3155
  };
3116
3156
  }
3117
3157
  /**
@@ -3119,15 +3159,15 @@ class yt extends Q {
3119
3159
  * The opposite corner from the anchor stays fixed in world space
3120
3160
  */
3121
3161
  calculateFrameCenterAfterResize(t, e, i) {
3122
- const o = this.getFixedCornerWorldPosition(e, i), s = x(i).width * t, a = s / this.imageAspectRatio, n = this.getOppositeCornerLocalPosition(e, s, a), l = new P({
3162
+ const s = this.getFixedCornerWorldPosition(e, i), o = x(i).width * t, a = o / this.imageAspectRatio, n = this.getOppositeCornerLocalPosition(e, o, a), l = new P({
3123
3163
  x: 0,
3124
3164
  // Will calculate frame center
3125
3165
  y: 0,
3126
3166
  rotation: i.rotation
3127
3167
  }).localDeltaToWorld(n.x, n.y);
3128
3168
  return {
3129
- x: o.x - l.dx,
3130
- y: o.y - l.dy
3169
+ x: s.x - l.dx,
3170
+ y: s.y - l.dy
3131
3171
  };
3132
3172
  }
3133
3173
  /**
@@ -3136,7 +3176,7 @@ class yt extends Q {
3136
3176
  * would be positioned within the frame after resize.
3137
3177
  */
3138
3178
  calculateCropStateAtScale(t, e, i) {
3139
- const o = x(i).width * t, s = o / this.imageAspectRatio, a = x(i).cropWidth * x(i).width, n = x(i).cropHeight * x(i).height, h = a / o, l = n / s, c = this.calculateFrameCenterAfterResize(t, e, i), g = {
3179
+ const s = x(i).width * t, o = s / this.imageAspectRatio, a = x(i).cropWidth * x(i).width, n = x(i).cropHeight * x(i).height, h = a / s, l = n / o, c = this.calculateFrameCenterAfterResize(t, e, i), g = {
3140
3180
  x: i.x,
3141
3181
  // In crop mode, this.x/y is the crop center
3142
3182
  y: i.y
@@ -3144,7 +3184,7 @@ class yt extends Q {
3144
3184
  x: c.x,
3145
3185
  y: c.y,
3146
3186
  rotation: i.rotation
3147
- }).worldDeltaToLocal(d, f), p = o / 2 + m.dx, y = s / 2 + m.dy, w = p / o - h / 2, S = y / s - l / 2;
3187
+ }).worldDeltaToLocal(d, f), p = s / 2 + m.dx, y = o / 2 + m.dy, w = p / s - h / 2, S = y / o - l / 2;
3148
3188
  return {
3149
3189
  cropX: w,
3150
3190
  cropY: S,
@@ -3156,20 +3196,20 @@ class yt extends Q {
3156
3196
  * Check if a given scale keeps crop within frame bounds
3157
3197
  */
3158
3198
  isScaleValidForCropBounds(t, e, i) {
3159
- const s = this.calculateCropStateAtScale(t, e, i);
3160
- if (s.cropWidth > 1 + 1e-4 || s.cropHeight > 1 + 1e-4)
3199
+ const o = this.calculateCropStateAtScale(t, e, i);
3200
+ if (o.cropWidth > 1 + 1e-4 || o.cropHeight > 1 + 1e-4)
3161
3201
  return !1;
3162
- const a = s.cropX, n = s.cropX + s.cropWidth, h = s.cropY, l = s.cropY + s.cropHeight;
3202
+ const a = o.cropX, n = o.cropX + o.cropWidth, h = o.cropY, l = o.cropY + o.cropHeight;
3163
3203
  return a >= -1e-4 && h >= -1e-4 && n <= 1 + 1e-4 && l <= 1 + 1e-4;
3164
3204
  }
3165
3205
  /**
3166
3206
  * Calculate minimum scale that keeps crop within frame bounds
3167
3207
  * Uses binary search to find the largest scale >= proposedScale that satisfies constraints
3168
3208
  */
3169
- calculateMinScaleForCropBounds(t, e, i, o) {
3209
+ calculateMinScaleForCropBounds(t, e, i, s) {
3170
3210
  if (this.isScaleValidForCropBounds(i, t, e))
3171
3211
  return i;
3172
- let n = i, h = o;
3212
+ let n = i, h = s;
3173
3213
  for (let l = 0; l < 20; l++) {
3174
3214
  const c = (n + h) / 2;
3175
3215
  if (this.isScaleValidForCropBounds(c, t, e) ? h = c : n = c, Math.abs(h - n) < 1e-4)
@@ -3182,15 +3222,15 @@ class yt extends Q {
3182
3222
  */
3183
3223
  remapAnchorForFlips(t, e) {
3184
3224
  let i = t;
3185
- const o = x(e).flipHorizontal, s = x(e).flipVertical;
3186
- return o && (i.includes("left") ? i = i.replace("left", "right") : i.includes("right") && (i = i.replace("right", "left"))), s && (i.includes("top") ? i = i.replace("top", "bottom") : i.includes("bottom") && (i = i.replace("bottom", "top"))), i;
3225
+ const s = x(e).flipHorizontal, o = x(e).flipVertical;
3226
+ return s && (i.includes("left") ? i = i.replace("left", "right") : i.includes("right") && (i = i.replace("right", "left"))), o && (i.includes("top") ? i = i.replace("top", "bottom") : i.includes("bottom") && (i = i.replace("bottom", "top"))), i;
3187
3227
  }
3188
3228
  /**
3189
3229
  * Clone this element
3190
3230
  */
3191
3231
  clone() {
3192
- const t = this.toJSON(), { imageUrl: e, ...i } = t, o = new yt(i);
3193
- return o.imageUrl = this.imageUrl, o.imageElement = this.imageElement, o.imageLoaded = this.imageLoaded, o.imageAspectRatio = this.imageAspectRatio, o.isCropping = this.isCropping, o.onLoadCallback = this.onLoadCallback, o.isSvg = this.isSvg, o.imageLoadState = this.imageLoadState, o.imageLoadError = this.imageLoadError, o.preserveDimensions = this.preserveDimensions, o;
3232
+ const t = this.toJSON(), { imageUrl: e, ...i } = t, s = new yt(i);
3233
+ return s.imageUrl = this.imageUrl, s.imageElement = this.imageElement, s.imageLoaded = this.imageLoaded, s.imageAspectRatio = this.imageAspectRatio, s.isCropping = this.isCropping, s.onLoadCallback = this.onLoadCallback, s.isSvg = this.isSvg, s.imageLoadState = this.imageLoadState, s.imageLoadError = this.imageLoadError, s.preserveDimensions = this.preserveDimensions, s;
3194
3234
  }
3195
3235
  /**
3196
3236
  * Serialize to JSON
@@ -3212,7 +3252,12 @@ class yt extends Q {
3212
3252
  imageAspectRatio: this.imageAspectRatio,
3213
3253
  preserveDimensions: this.preserveDimensions,
3214
3254
  // dimension lock for cover crop must survive save→load
3215
- transformData: { ...this.transformData }
3255
+ transformData: {
3256
+ ...this.transformData,
3257
+ // Deep-copy the nested adjustments object so serialized state (and
3258
+ // clones built from it) never alias this element's live state.
3259
+ ...this.transformData.adjustments ? { adjustments: { ...this.transformData.adjustments } } : {}
3260
+ }
3216
3261
  };
3217
3262
  }
3218
3263
  /**
@@ -3224,27 +3269,27 @@ class yt extends Q {
3224
3269
  this.clearLoadTimeout(), this.releaseImageCache(), this.revokeSvgBlobUrl(), this.imageElement = null, this.onLoadCallback = null, this.imageLoadError = null;
3225
3270
  }
3226
3271
  }
3227
- const Nt = /* @__PURE__ */ new Map();
3228
- let vt = null;
3229
- function Ut(r) {
3272
+ const $t = /* @__PURE__ */ new Map();
3273
+ let At = null;
3274
+ function Vt(r) {
3230
3275
  return new Error(
3231
3276
  `[paint-registry] no painter registered for ${r}. Element painting requires the rendering engine: import 'src/rendering/element-painters.js' (every paint driver — CanvasRenderer, ExportManager, ElementPreviewRenderer — does this; a direct element.render() call in a test must import it too).`
3232
3277
  );
3233
3278
  }
3234
- function Fi(r, t) {
3235
- Nt.set(r, t);
3279
+ function Bi(r, t) {
3280
+ $t.set(r, t);
3236
3281
  }
3237
3282
  function gt(r) {
3238
- const t = Nt.get(r);
3239
- if (!t) throw Ut(`text transform "${r}"`);
3283
+ const t = $t.get(r);
3284
+ if (!t) throw Vt(`text transform "${r}"`);
3240
3285
  return t;
3241
3286
  }
3242
- function Ai(r) {
3243
- vt = r;
3287
+ function Ri(r) {
3288
+ At = r;
3244
3289
  }
3245
- function Ae() {
3246
- if (!vt) throw Ut("group clipping");
3247
- return vt;
3290
+ function Ee() {
3291
+ if (!At) throw Vt("group clipping");
3292
+ return At;
3248
3293
  }
3249
3294
  class L {
3250
3295
  constructor(t = []) {
@@ -3293,31 +3338,31 @@ class L {
3293
3338
  applyStyle(t, e, i) {
3294
3339
  if (t >= e || t < 0 || e > this.getLength())
3295
3340
  return;
3296
- const o = [];
3297
- let s = 0;
3341
+ const s = [];
3342
+ let o = 0;
3298
3343
  for (const a of this.spans) {
3299
- const n = s, h = s + a.text.length;
3344
+ const n = o, h = o + a.text.length;
3300
3345
  if (h <= t) {
3301
- o.push(a), s = h;
3346
+ s.push(a), o = h;
3302
3347
  continue;
3303
3348
  }
3304
3349
  if (n >= e) {
3305
- o.push(a), s = h;
3350
+ s.push(a), o = h;
3306
3351
  continue;
3307
3352
  }
3308
3353
  const l = Math.max(t, n), c = Math.min(e, h);
3309
- l > n && o.push({
3354
+ l > n && s.push({
3310
3355
  text: a.text.substring(0, l - n),
3311
3356
  style: a.style
3312
- }), o.push({
3357
+ }), s.push({
3313
3358
  text: a.text.substring(l - n, c - n),
3314
3359
  style: { ...a.style, ...i }
3315
- }), c < h && o.push({
3360
+ }), c < h && s.push({
3316
3361
  text: a.text.substring(c - n),
3317
3362
  style: a.style
3318
- }), s = h;
3363
+ }), o = h;
3319
3364
  }
3320
- this.spans = o, this.normalize();
3365
+ this.spans = s, this.normalize();
3321
3366
  }
3322
3367
  /**
3323
3368
  * Insert text at a specific position with a given style
@@ -3327,24 +3372,24 @@ class L {
3327
3372
  */
3328
3373
  insert(t, e, i) {
3329
3374
  if (e.length === 0) return;
3330
- const o = [];
3331
- let s = 0;
3375
+ const s = [];
3376
+ let o = 0;
3332
3377
  for (const a of this.spans) {
3333
- const n = s, h = s + a.text.length;
3334
- if (t <= n && o.length === 0 && o.push({ text: e, style: i }), t > n && t <= h) {
3378
+ const n = o, h = o + a.text.length;
3379
+ if (t <= n && s.length === 0 && s.push({ text: e, style: i }), t > n && t <= h) {
3335
3380
  const l = t - n;
3336
- o.push({
3381
+ s.push({
3337
3382
  text: a.text.substring(0, l),
3338
3383
  style: a.style
3339
- }), o.push({ text: e, style: i }), o.push({
3384
+ }), s.push({ text: e, style: i }), s.push({
3340
3385
  text: a.text.substring(l),
3341
3386
  style: a.style
3342
- }), s = h;
3387
+ }), o = h;
3343
3388
  continue;
3344
3389
  }
3345
- o.push(a), s = h;
3390
+ s.push(a), o = h;
3346
3391
  }
3347
- t >= this.getLength() && !o.some((a) => a.text === e) && o.push({ text: e, style: i }), this.spans = o, this.normalize();
3392
+ t >= this.getLength() && !s.some((a) => a.text === e) && s.push({ text: e, style: i }), this.spans = s, this.normalize();
3348
3393
  }
3349
3394
  /**
3350
3395
  * Delete text in a character range
@@ -3355,28 +3400,28 @@ class L {
3355
3400
  const i = this.getLength();
3356
3401
  if (t = Math.max(0, Math.min(t, i)), e = Math.max(0, Math.min(e, i)), t >= e)
3357
3402
  return;
3358
- const o = [];
3359
- let s = 0;
3403
+ const s = [];
3404
+ let o = 0;
3360
3405
  for (const a of this.spans) {
3361
- const n = s, h = s + a.text.length;
3406
+ const n = o, h = o + a.text.length;
3362
3407
  if (h <= t) {
3363
- o.push(a), s = h;
3408
+ s.push(a), o = h;
3364
3409
  continue;
3365
3410
  }
3366
3411
  if (n >= e) {
3367
- o.push(a), s = h;
3412
+ s.push(a), o = h;
3368
3413
  continue;
3369
3414
  }
3370
3415
  const l = Math.max(t, n), c = Math.min(e, h);
3371
- l > n && o.push({
3416
+ l > n && s.push({
3372
3417
  text: a.text.substring(0, l - n),
3373
3418
  style: a.style
3374
- }), c < h && o.push({
3419
+ }), c < h && s.push({
3375
3420
  text: a.text.substring(c - n),
3376
3421
  style: a.style
3377
- }), s = h;
3422
+ }), o = h;
3378
3423
  }
3379
- this.spans = o.length > 0 ? o : [{ text: "", style: {} }], this.normalize();
3424
+ this.spans = s.length > 0 ? s : [{ text: "", style: {} }], this.normalize();
3380
3425
  }
3381
3426
  /**
3382
3427
  * Normalize spans by:
@@ -3393,11 +3438,11 @@ class L {
3393
3438
  const t = [];
3394
3439
  let e = this.spans[0];
3395
3440
  for (let i = 1; i < this.spans.length; i++) {
3396
- const o = this.spans[i];
3397
- this.stylesEqual(e.style, o.style) ? e = {
3398
- text: e.text + o.text,
3441
+ const s = this.spans[i];
3442
+ this.stylesEqual(e.style, s.style) ? e = {
3443
+ text: e.text + s.text,
3399
3444
  style: e.style
3400
- } : (t.push(e), e = o);
3445
+ } : (t.push(e), e = s);
3401
3446
  }
3402
3447
  t.push(e), this.spans = t;
3403
3448
  }
@@ -3442,65 +3487,65 @@ class L {
3442
3487
  return new L(t.spans);
3443
3488
  }
3444
3489
  }
3445
- function Mi(r) {
3490
+ function Hi(r) {
3446
3491
  return r.type === "custom";
3447
3492
  }
3448
- function Di(r) {
3493
+ function Pi(r) {
3449
3494
  return r.type === "circle";
3450
3495
  }
3451
- function Ii(r) {
3496
+ function Li(r) {
3452
3497
  return r.type === "arch";
3453
3498
  }
3454
- function ki(r) {
3499
+ function Wi(r) {
3455
3500
  return r.type === "wave";
3456
3501
  }
3457
- function Ei(r) {
3502
+ function zi(r) {
3458
3503
  return r.type === "flag";
3459
3504
  }
3460
- function Oi(r) {
3505
+ function Xi(r) {
3461
3506
  return r.type === "image";
3462
3507
  }
3463
- function Bi(r) {
3508
+ function Ni(r) {
3464
3509
  return r.type === "group";
3465
3510
  }
3466
- function Ri(r) {
3511
+ function _i(r) {
3467
3512
  return r.transformType !== "image" && r.transformType !== "group";
3468
3513
  }
3469
- function Hi(r) {
3514
+ function Yi(r) {
3470
3515
  return r.transformType === "image";
3471
3516
  }
3472
- function Pi(r) {
3517
+ function Ui(r) {
3473
3518
  return r.transformType === "custom";
3474
3519
  }
3475
- function Li(r) {
3520
+ function Gi(r) {
3476
3521
  return r.transformType === "circle";
3477
3522
  }
3478
- function Wi(r) {
3523
+ function $i(r) {
3479
3524
  return r.transformType === "group";
3480
3525
  }
3481
- function zi(r) {
3526
+ function Vi(r) {
3482
3527
  return r.transformType === "shape";
3483
3528
  }
3484
- function Xi(r) {
3529
+ function Ji(r) {
3485
3530
  return r.transformType === "path";
3486
3531
  }
3487
- function _i(r) {
3532
+ function qi(r) {
3488
3533
  return r.type === "shape";
3489
3534
  }
3490
- function Yi(r) {
3535
+ function ji(r) {
3491
3536
  return r.type === "path";
3492
3537
  }
3493
- function Ni(r) {
3538
+ function Zi(r) {
3494
3539
  var t;
3495
3540
  return ((t = r.stroke) == null ? void 0 : t.enabled) === !0;
3496
3541
  }
3497
- function Ui(r) {
3542
+ function Ki(r) {
3498
3543
  return Array.isArray(r.masks) && r.masks.length > 0;
3499
3544
  }
3500
- function Gi(r) {
3545
+ function Qi(r) {
3501
3546
  return r.blendMode === "knockout" || r.blendMode === "clip";
3502
3547
  }
3503
- function $i(r) {
3548
+ function ts(r) {
3504
3549
  var t;
3505
3550
  return ((t = r.distressEffect) == null ? void 0 : t.enabled) === !0;
3506
3551
  }
@@ -3525,8 +3570,8 @@ class q extends Q {
3525
3570
  * handled by SelectionRenderer and HoverRenderer.
3526
3571
  */
3527
3572
  render(t, e = !1, i = !1) {
3528
- const o = t.globalAlpha;
3529
- this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = this.opacity), gt(this.transformType)(t, this.toJSON()), t.globalAlpha = o;
3573
+ const s = t.globalAlpha;
3574
+ this.opacity !== void 0 && this.opacity !== 1 && (t.globalAlpha = this.opacity), gt(this.transformType)(t, this.toJSON()), t.globalAlpha = s;
3530
3575
  }
3531
3576
  /**
3532
3577
  * Serialize to JSON
@@ -3605,14 +3650,14 @@ class q extends Q {
3605
3650
  * Apply character-level formatting to a text range
3606
3651
  */
3607
3652
  applyFormatting(t, e, i) {
3608
- const o = this.getRichText();
3609
- o.applyStyle(t, e, i), this.text = o.getText();
3653
+ const s = this.getRichText();
3654
+ s.applyStyle(t, e, i), this.text = s.getText();
3610
3655
  }
3611
3656
  /**
3612
3657
  * Update font size
3613
3658
  */
3614
3659
  setFontSize(t) {
3615
- this.fontSize = Math.max(pe, Math.min(ye, t));
3660
+ this.fontSize = Math.max(be, Math.min(xe, t));
3616
3661
  }
3617
3662
  /**
3618
3663
  * Update color
@@ -3622,15 +3667,15 @@ class q extends Q {
3622
3667
  const e = this.color;
3623
3668
  if (this.color = t, this.richText)
3624
3669
  for (let i = 0; i < this.richText.spans.length; i++) {
3625
- const o = this.richText.spans[i];
3626
- (o.style.color === void 0 || o.style.color === e) && (o.style.color = t);
3670
+ const s = this.richText.spans[i];
3671
+ (s.style.color === void 0 || s.style.color === e) && (s.style.color = t);
3627
3672
  }
3628
3673
  }
3629
3674
  /**
3630
3675
  * Handle resize transform
3631
3676
  * Must be implemented by subclasses
3632
3677
  */
3633
- resize(t, e, i, o) {
3678
+ resize(t, e, i, s) {
3634
3679
  throw new Error("resize() must be implemented by subclass");
3635
3680
  }
3636
3681
  /**
@@ -3646,20 +3691,20 @@ class q extends Q {
3646
3691
  };
3647
3692
  }
3648
3693
  }
3649
- function Me(r) {
3694
+ function Oe(r) {
3650
3695
  return Array.from(r).length;
3651
3696
  }
3652
3697
  function wt(r, t, e) {
3653
- return e ? r + e * Me(t) : r;
3698
+ return e ? r + e * Oe(t) : r;
3654
3699
  }
3655
- function De(r, t, e) {
3656
- const i = Array.from(t), o = [0];
3657
- let s = "";
3700
+ function Be(r, t, e) {
3701
+ const i = Array.from(t), s = [0];
3702
+ let o = "";
3658
3703
  for (let a = 0; a < i.length; a++)
3659
- s += i[a], o.push(r.measureText(s).width + e * (a + 1));
3660
- return o;
3704
+ o += i[a], s.push(r.measureText(o).width + e * (a + 1));
3705
+ return s;
3661
3706
  }
3662
- function Ie(r, t, e) {
3707
+ function Re(r, t, e) {
3663
3708
  switch (r.textAlign) {
3664
3709
  case "center":
3665
3710
  return t - e / 2;
@@ -3670,23 +3715,23 @@ function Ie(r, t, e) {
3670
3715
  return t;
3671
3716
  }
3672
3717
  }
3673
- function Gt(r, t, e, i, o, s) {
3674
- if (!s || e.length === 0) {
3675
- t[r](e, i, o);
3718
+ function Jt(r, t, e, i, s, o) {
3719
+ if (!o || e.length === 0) {
3720
+ t[r](e, i, s);
3676
3721
  return;
3677
3722
  }
3678
- const a = De(t, e, s), n = a[a.length - 1], h = Ie(t, i, n), l = t.textAlign;
3723
+ const a = Be(t, e, o), n = a[a.length - 1], h = Re(t, i, n), l = t.textAlign;
3679
3724
  t.textAlign = "left";
3680
3725
  const c = Array.from(e);
3681
3726
  for (let g = 0; g < c.length; g++)
3682
- t[r](c[g], h + a[g], o);
3727
+ t[r](c[g], h + a[g], s);
3683
3728
  t.textAlign = l;
3684
3729
  }
3685
- function Vi(r, t, e, i, o) {
3686
- Gt("fillText", r, t, e, i, o);
3730
+ function es(r, t, e, i, s) {
3731
+ Jt("fillText", r, t, e, i, s);
3687
3732
  }
3688
- function Ji(r, t, e, i, o) {
3689
- Gt("strokeText", r, t, e, i, o);
3733
+ function is(r, t, e, i, s) {
3734
+ Jt("strokeText", r, t, e, i, s);
3690
3735
  }
3691
3736
  let ht = null;
3692
3737
  function bt() {
@@ -3700,12 +3745,12 @@ function bt() {
3700
3745
  return ht;
3701
3746
  }
3702
3747
  function at(r, t, e = !1, i = !1) {
3703
- const o = [];
3704
- return i && o.push("italic"), e && o.push("bold"), o.push(`${r}px`), o.push(t), o.join(" ");
3748
+ const s = [];
3749
+ return i && s.push("italic"), e && s.push("bold"), s.push(`${r}px`), s.push(t), s.join(" ");
3705
3750
  }
3706
- function At(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
3751
+ function It(r, t, e, i, s = !1, o = !1, a, n = !1, h) {
3707
3752
  const c = bt().getContext("2d");
3708
- c.font = at(e, i, o, s);
3753
+ c.font = at(e, i, s, o);
3709
3754
  const g = (h == null ? void 0 : h.letterSpacing) ?? 0, d = (A) => wt(c.measureText(A).width, A, g);
3710
3755
  if (r.trim().length === 0)
3711
3756
  return [r];
@@ -3714,7 +3759,7 @@ function At(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
3714
3759
  const A = r.split(`
3715
3760
  `), k = [];
3716
3761
  for (let R = 0; R < A.length; R++) {
3717
- const H = A[R], E = At(H, t, e, i, o, s, void 0, n, h);
3762
+ const H = A[R], E = It(H, t, e, i, s, o, void 0, n, h);
3718
3763
  k.push(...E);
3719
3764
  }
3720
3765
  return k;
@@ -3730,78 +3775,78 @@ function At(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
3730
3775
  }
3731
3776
  return A.length > 0 && (A[0] = m + A[0], A[A.length - 1] = A[A.length - 1] + p), A;
3732
3777
  }
3733
- const S = w.join(" "), b = m + S + p, T = d(b), C = t < 200, F = n ? 0 : Math.max(20, t * (n ? 0 : C ? 0.08 : 0.05));
3734
- if (T <= t + F)
3778
+ const S = w.join(" "), b = m + S + p, v = d(b), C = t < 200, F = n ? 0 : Math.max(20, t * (n ? 0 : C ? 0.08 : 0.05));
3779
+ if (v <= t + F)
3735
3780
  return [b];
3736
- const v = [];
3781
+ const T = [];
3737
3782
  let D = "";
3738
3783
  const B = n ? 0 : Math.max(15, t * (n ? 0 : C ? 0.05 : 0.03));
3739
3784
  for (let A = 0; A < w.length; A++) {
3740
3785
  const k = w[A];
3741
3786
  if (d(k) > t + B) {
3742
- D.length > 0 && (v.push(D), D = "");
3787
+ D.length > 0 && (T.push(D), D = "");
3743
3788
  const H = Array.from(k);
3744
3789
  let E = "";
3745
3790
  for (const W of H) {
3746
3791
  const z = E + W;
3747
- d(z) > t + B && E.length > 0 ? (v.push(E), E = W) : E = z;
3792
+ d(z) > t + B && E.length > 0 ? (T.push(E), E = W) : E = z;
3748
3793
  }
3749
3794
  D = E;
3750
3795
  } else {
3751
3796
  const H = D.length > 0 ? D + " " + k : k;
3752
- d(H) > t + B && D.length > 0 ? (v.push(D), D = k) : D = H;
3797
+ d(H) > t + B && D.length > 0 ? (T.push(D), D = k) : D = H;
3753
3798
  }
3754
3799
  }
3755
- if (D.length > 0 && v.push(D), v.length > 0) {
3800
+ if (D.length > 0 && T.push(D), T.length > 0) {
3756
3801
  if (m.length > 0) {
3757
- const A = m + v[0];
3758
- d(A) > t + B ? v.unshift(m) : v[0] = A;
3802
+ const A = m + T[0];
3803
+ d(A) > t + B ? T.unshift(m) : T[0] = A;
3759
3804
  }
3760
3805
  if (p.length > 0) {
3761
- const A = v.length - 1, k = v[A] + p;
3762
- d(k) > t + B ? v.push(p) : v[A] = k;
3806
+ const A = T.length - 1, k = T[A] + p;
3807
+ d(k) > t + B ? T.push(p) : T[A] = k;
3763
3808
  }
3764
3809
  }
3765
- return v;
3810
+ return T;
3766
3811
  }
3767
- function Bt(r, t, e, i = !1, o = !1, s = 0) {
3812
+ function Pt(r, t, e, i = !1, s = !1, o = 0) {
3768
3813
  const n = bt().getContext("2d");
3769
- return n.font = at(t, e, i, o), wt(n.measureText(r).width, r, s);
3814
+ return n.font = at(t, e, i, s), wt(n.measureText(r).width, r, o);
3770
3815
  }
3771
- function Ft(r, t, e = !1, i = !1) {
3772
- const s = bt().getContext("2d");
3773
- s.font = at(r, t, e, i);
3774
- const n = s.measureText("ÁÉÍgjpqy"), h = n.actualBoundingBoxAscent || r * 0.8, l = n.actualBoundingBoxDescent || r * 0.2, c = h + l;
3816
+ function Mt(r, t, e = !1, i = !1) {
3817
+ const o = bt().getContext("2d");
3818
+ o.font = at(r, t, e, i);
3819
+ const n = o.measureText("ÁÉÍgjpqy"), h = n.actualBoundingBoxAscent || r * 0.8, l = n.actualBoundingBoxDescent || r * 0.2, c = h + l;
3775
3820
  return { ascent: h, descent: l, height: c };
3776
3821
  }
3777
- function Rt(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
3778
- const l = (h == null ? void 0 : h.letterSpacing) ?? 0, c = At(r, t, e, i, o, s, a, n, h), g = r.includes(`
3779
- `), d = c.map((b, T) => ({
3780
- isParagraphStart: !g && T === 0,
3781
- isParagraphEnd: !g && T === c.length - 1
3822
+ function Lt(r, t, e, i, s = !1, o = !1, a, n = !1, h) {
3823
+ const l = (h == null ? void 0 : h.letterSpacing) ?? 0, c = It(r, t, e, i, s, o, a, n, h), g = r.includes(`
3824
+ `), d = c.map((b, v) => ({
3825
+ isParagraphStart: !g && v === 0,
3826
+ isParagraphEnd: !g && v === c.length - 1
3782
3827
  })), u = bt().getContext("2d");
3783
- u.font = at(e, i, o, s);
3828
+ u.font = at(e, i, s, o);
3784
3829
  let m = 0;
3785
- const p = Ft(e, i, o, s);
3830
+ const p = Mt(e, i, s, o);
3786
3831
  let y = 0;
3787
- c.forEach((b, T) => {
3788
- const C = d[T].isParagraphStart, M = d[T].isParagraphEnd;
3832
+ c.forEach((b, v) => {
3833
+ const C = d[v].isParagraphStart, M = d[v].isParagraphEnd;
3789
3834
  let F = b;
3790
3835
  if (!C) {
3791
- const v = b.match(/^ +/), D = v ? v[0].length : 0;
3836
+ const T = b.match(/^ +/), D = T ? T[0].length : 0;
3792
3837
  D > 0 && (F = F.substring(D));
3793
3838
  }
3794
3839
  if (!M) {
3795
- const v = F.match(/ +$/), D = v ? v[0].length : 0;
3840
+ const T = F.match(/ +$/), D = T ? T[0].length : 0;
3796
3841
  D > 0 && (F = F.substring(0, F.length - D));
3797
3842
  }
3798
3843
  if (y++, F.length > 0) {
3799
- const v = wt(u.measureText(F).width, F, l);
3800
- m = Math.max(m, v);
3844
+ const T = wt(u.measureText(F).width, F, l);
3845
+ m = Math.max(m, T);
3801
3846
  }
3802
3847
  });
3803
3848
  let w;
3804
- const S = (h == null ? void 0 : h.lineHeight) ?? _t;
3849
+ const S = (h == null ? void 0 : h.lineHeight) ?? Ut;
3805
3850
  if (y === 1)
3806
3851
  w = p.height;
3807
3852
  else if (y === 0)
@@ -3817,7 +3862,7 @@ function Rt(r, t, e, i, o = !1, s = !1, a, n = !1, h) {
3817
3862
  };
3818
3863
  }
3819
3864
  let lt = null;
3820
- function ke() {
3865
+ function He() {
3821
3866
  if (!lt)
3822
3867
  if (typeof OffscreenCanvas < "u")
3823
3868
  lt = new OffscreenCanvas(1, 1).getContext("2d");
@@ -3827,10 +3872,10 @@ function ke() {
3827
3872
  throw new Error("No canvas context available");
3828
3873
  return lt;
3829
3874
  }
3830
- function Ee(r, t, e) {
3831
- const i = ke(), o = [], s = (p, y) => {
3832
- const w = y.fontSize || e.fontSize, S = y.fontFamily || e.fontFamily, b = y.bold !== void 0 ? y.bold : e.bold || !1, T = y.italic !== void 0 ? y.italic : e.italic || !1, C = y.letterSpacing !== void 0 ? y.letterSpacing : e.letterSpacing ?? 0;
3833
- return i.font = at(w, S, b, T), wt(i.measureText(p).width, p, C);
3875
+ function Pe(r, t, e) {
3876
+ const i = He(), s = [], o = (p, y) => {
3877
+ const w = y.fontSize || e.fontSize, S = y.fontFamily || e.fontFamily, b = y.bold !== void 0 ? y.bold : e.bold || !1, v = y.italic !== void 0 ? y.italic : e.italic || !1, C = y.letterSpacing !== void 0 ? y.letterSpacing : e.letterSpacing ?? 0;
3878
+ return i.font = at(w, S, b, v), wt(i.measureText(p).width, p, C);
3834
3879
  }, a = (p, y) => p.fontSize === y.fontSize && p.fontFamily === y.fontFamily && p.color === y.color && p.bold === y.bold && p.italic === y.italic && p.underline === y.underline && p.strikethrough === y.strikethrough && p.letterSpacing === y.letterSpacing, n = [];
3835
3880
  r.forEach((p) => {
3836
3881
  n.length > 0 && a(n[n.length - 1].style, p.style) ? n[n.length - 1].text += p.text : n.push({ text: p.text, style: p.style });
@@ -3850,7 +3895,7 @@ function Ee(r, t, e) {
3850
3895
  g.length > 0 && c.push({ text: g, startIdx: d, endIdx: h.length - 1 });
3851
3896
  let f = [], u = 0;
3852
3897
  const m = () => {
3853
- f.length > 0 && (o.push(f), f = [], u = 0);
3898
+ f.length > 0 && (s.push(f), f = [], u = 0);
3854
3899
  };
3855
3900
  return c.forEach((p, y) => {
3856
3901
  const w = [];
@@ -3860,21 +3905,21 @@ function Ee(r, t, e) {
3860
3905
  M !== S ? (w.push({ text: b, style: n[S].style }), b = h[C], S = M) : b += h[C];
3861
3906
  }
3862
3907
  b.length > 0 && w.push({ text: b, style: n[S].style });
3863
- const T = w.reduce((C, M) => C + s(M.text, M.style), 0);
3908
+ const v = w.reduce((C, M) => C + o(M.text, M.style), 0);
3864
3909
  if (p.text === " ") {
3865
3910
  if (f.length > 0) {
3866
3911
  const C = f[f.length - 1];
3867
3912
  a(C.style, w[0].style) ? C.text += " " : f.push({ text: " ", style: w[0].style });
3868
3913
  } else
3869
3914
  f.push({ text: " ", style: w[0].style });
3870
- u += T;
3871
- } else if (T > t) {
3915
+ u += v;
3916
+ } else if (v > t) {
3872
3917
  f.length > 0 && m();
3873
3918
  for (const C of w) {
3874
3919
  const M = Array.from(C.text);
3875
3920
  let F = "";
3876
- for (const v of M) {
3877
- const D = s(v, C.style);
3921
+ for (const T of M) {
3922
+ const D = o(T, C.style);
3878
3923
  if (u + D > t && u > 0) {
3879
3924
  if (F.length > 0) {
3880
3925
  if (f.length > 0) {
@@ -3886,44 +3931,44 @@ function Ee(r, t, e) {
3886
3931
  }
3887
3932
  m();
3888
3933
  }
3889
- F += v, u += D;
3934
+ F += T, u += D;
3890
3935
  }
3891
3936
  if (F.length > 0)
3892
3937
  if (f.length > 0) {
3893
- const v = f[f.length - 1];
3894
- a(v.style, C.style) ? v.text += F : f.push({ text: F, style: C.style });
3938
+ const T = f[f.length - 1];
3939
+ a(T.style, C.style) ? T.text += F : f.push({ text: F, style: C.style });
3895
3940
  } else
3896
3941
  f.push({ text: F, style: C.style });
3897
3942
  }
3898
3943
  } else
3899
- u + T > t && f.length > 0 && m(), w.forEach((C) => {
3944
+ u + v > t && f.length > 0 && m(), w.forEach((C) => {
3900
3945
  if (f.length > 0) {
3901
3946
  const M = f[f.length - 1];
3902
3947
  a(M.style, C.style) ? M.text += C.text : f.push({ ...C });
3903
3948
  } else
3904
3949
  f.push({ ...C });
3905
- }), u += T;
3906
- }), m(), o.length === 0 && o.push([]), o;
3950
+ }), u += v;
3951
+ }), m(), s.length === 0 && s.push([]), s;
3907
3952
  }
3908
- function Oe(r) {
3953
+ function Le(r) {
3909
3954
  const t = [];
3910
3955
  let e = [];
3911
3956
  return r.spans.forEach((i) => {
3912
- const o = i.text.split(`
3957
+ const s = i.text.split(`
3913
3958
  `);
3914
- o.forEach((s, a) => {
3915
- s.length > 0 && e.push({ text: s, style: i.style }), a < o.length - 1 && (t.push(e), e = []);
3959
+ s.forEach((o, a) => {
3960
+ o.length > 0 && e.push({ text: o, style: i.style }), a < s.length - 1 && (t.push(e), e = []);
3916
3961
  });
3917
3962
  }), e.length > 0 && t.push(e), t.length === 0 && t.push([]), t;
3918
3963
  }
3919
- function ot(r) {
3964
+ function st(r) {
3920
3965
  return typeof r.width == "number" ? r.width : void 0;
3921
3966
  }
3922
- function $t(r, t) {
3967
+ function qt(r, t) {
3923
3968
  r.width = t;
3924
3969
  }
3925
- function Be(r, t, e) {
3926
- const i = e.transformData, o = ot(i), s = o !== void 0 ? o : e.width ?? 0, a = t / s, n = e.fontSize ?? r.fontSize, h = n * a;
3970
+ function We(r, t, e) {
3971
+ const i = e.transformData, s = st(i), o = s !== void 0 ? s : e.width ?? 0, a = t / o, n = e.fontSize ?? r.fontSize, h = n * a;
3927
3972
  let l;
3928
3973
  if (h < 16 ? l = Math.round(h) : l = Math.round(h * 2) / 2, r.setFontSize(l), e.richText && e.richText instanceof L && typeof r.setRichText == "function") {
3929
3974
  const f = e.richText.clone();
@@ -3935,33 +3980,33 @@ function Be(r, t, e) {
3935
3980
  r.setRichText(f);
3936
3981
  }
3937
3982
  const c = r.transformData;
3938
- if (ot(c) !== void 0 && o !== void 0) {
3939
- const d = n > 0 ? l / n : a, f = o * d;
3940
- $t(c, Math.max(20, Math.ceil(f)));
3983
+ if (st(c) !== void 0 && s !== void 0) {
3984
+ const d = n > 0 ? l / n : a, f = s * d;
3985
+ qt(c, Math.max(20, Math.ceil(f)));
3941
3986
  }
3942
3987
  }
3943
- function Re(r, t, e, i) {
3988
+ function ze(r, t, e, i) {
3944
3989
  if (t !== "middle-left" && t !== "middle-right")
3945
3990
  return;
3946
3991
  r.fontSize = i.fontSize ?? r.fontSize;
3947
- const o = r.transformData;
3948
- if (ot(o) !== void 0) {
3949
- $t(o, Math.max(Yt, e));
3950
- const a = I.toRadiansInverse(r.rotation), n = Math.cos(a), h = Math.sin(a), l = i.transformData, g = ot(l) ?? i.width ?? 0, f = (ot(o) ?? 0) - g;
3992
+ const s = r.transformData;
3993
+ if (st(s) !== void 0) {
3994
+ qt(s, Math.max(Gt, e));
3995
+ const a = I.toRadiansInverse(r.rotation), n = Math.cos(a), h = Math.sin(a), l = i.transformData, g = st(l) ?? i.width ?? 0, f = (st(s) ?? 0) - g;
3951
3996
  t === "middle-left" ? (r.x = i.x - f / 2 * n, r.y = i.y - f / 2 * h) : t === "middle-right" && (r.x = i.x + f / 2 * n, r.y = i.y + f / 2 * h);
3952
3997
  }
3953
3998
  }
3954
- function Vt(r, t, e, i, o) {
3955
- const s = t.includes("top") || t.includes("bottom"), a = t.includes("middle");
3956
- s ? Be(r, e, o) : a && Re(r, t, e, o);
3999
+ function jt(r, t, e, i, s) {
4000
+ const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle");
4001
+ o ? We(r, e, s) : a && ze(r, t, e, s);
3957
4002
  }
3958
- class He extends q {
4003
+ class Xe extends q {
3959
4004
  // Temporary property used during resize operations only
3960
4005
  constructor(t = {}) {
3961
4006
  super(t), this.transformType = "custom";
3962
4007
  const e = t.transformData, i = (e == null ? void 0 : e.width) !== void 0 ? e.width : Math.max(
3963
- Yt,
3964
- Bt(this.text, this.fontSize, this.fontFamily, this.bold, this.italic, this.letterSpacing ?? 0) + j * 2
4008
+ Gt,
4009
+ Pt(this.text, this.fontSize, this.fontFamily, this.bold, this.italic, this.letterSpacing ?? 0) + j * 2
3965
4010
  );
3966
4011
  this.transformData = {
3967
4012
  type: "custom",
@@ -3974,31 +4019,31 @@ class He extends q {
3974
4019
  * Returns the total height based on the tallest font in each line
3975
4020
  */
3976
4021
  calculateRichTextHeight() {
3977
- const t = this.getRichText(), e = this.transformData.width - j * 2, i = Oe(t), o = [];
4022
+ const t = this.getRichText(), e = this.transformData.width - j * 2, i = Le(t), s = [];
3978
4023
  if (i.forEach((h) => {
3979
- Ee(h, e, {
4024
+ Pe(h, e, {
3980
4025
  fontSize: this.fontSize,
3981
4026
  fontFamily: this.fontFamily,
3982
4027
  bold: this.bold,
3983
4028
  italic: this.italic,
3984
4029
  letterSpacing: this.letterSpacing
3985
4030
  }).forEach((c) => {
3986
- o.push(c);
4031
+ s.push(c);
3987
4032
  });
3988
- }), o.length === 0)
4033
+ }), s.length === 0)
3989
4034
  return 0;
3990
- let s = 0, a = 0;
3991
- o.forEach((h) => {
4035
+ let o = 0, a = 0;
4036
+ s.forEach((h) => {
3992
4037
  h.forEach((l) => {
3993
- const c = l.style.fontSize !== void 0 ? l.style.fontSize : this.fontSize, g = l.style.fontFamily !== void 0 ? l.style.fontFamily : this.fontFamily, d = l.style.bold !== void 0 ? l.style.bold : this.bold, f = l.style.italic !== void 0 ? l.style.italic : this.italic, u = Ft(c, g, d, f);
3994
- s = Math.max(s, u.height), a = Math.max(a, u.ascent);
4038
+ const c = l.style.fontSize !== void 0 ? l.style.fontSize : this.fontSize, g = l.style.fontFamily !== void 0 ? l.style.fontFamily : this.fontFamily, d = l.style.bold !== void 0 ? l.style.bold : this.bold, f = l.style.italic !== void 0 ? l.style.italic : this.italic, u = Mt(c, g, d, f);
4039
+ o = Math.max(o, u.height), a = Math.max(a, u.ascent);
3995
4040
  });
3996
4041
  });
3997
- const n = this.fontSize * (this.lineHeight ?? _t);
3998
- if (o.length === 1)
3999
- return s;
4042
+ const n = this.fontSize * (this.lineHeight ?? Ut);
4043
+ if (s.length === 1)
4044
+ return o;
4000
4045
  {
4001
- const h = Ft(this.fontSize, this.fontFamily, this.bold, this.italic), l = (o.length - 1) * n + h.height, c = Math.max(0, a - h.ascent), g = Math.max(0, s - a - (h.height - h.ascent));
4046
+ const h = Mt(this.fontSize, this.fontFamily, this.bold, this.italic), l = (s.length - 1) * n + h.height, c = Math.max(0, a - h.ascent), g = Math.max(0, o - a - (h.height - h.ascent));
4002
4047
  return l + c + g;
4003
4048
  }
4004
4049
  }
@@ -4020,7 +4065,7 @@ class He extends q {
4020
4065
  getBoundingBox() {
4021
4066
  const t = this.transformData.width - j * 2;
4022
4067
  let e;
4023
- return this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e = Rt(
4068
+ return this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e = Lt(
4024
4069
  this.text,
4025
4070
  t,
4026
4071
  this.fontSize,
@@ -4047,7 +4092,7 @@ class He extends q {
4047
4092
  getVisualBoundingBox() {
4048
4093
  const t = this.transformData.width - j * 2;
4049
4094
  let e;
4050
- this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e = Rt(
4095
+ this.hasPerCharacterFormatting() ? e = this.calculateRichTextHeight() : e = Lt(
4051
4096
  this.text,
4052
4097
  t,
4053
4098
  this.fontSize,
@@ -4085,13 +4130,13 @@ class He extends q {
4085
4130
  */
4086
4131
  render(t, e = !1, i = !1) {
4087
4132
  var n;
4088
- const o = this.opacity ?? 1, s = !!((n = this.stroke) != null && n.enabled);
4089
- if (o < 1 && s) {
4090
- this.renderWithOffscreen(t, o);
4133
+ const s = this.opacity ?? 1, o = !!((n = this.stroke) != null && n.enabled);
4134
+ if (s < 1 && o) {
4135
+ this.renderWithOffscreen(t, s);
4091
4136
  return;
4092
4137
  }
4093
4138
  const a = t.globalAlpha;
4094
- o !== 1 && (t.globalAlpha = o), gt("custom")(t, this.toJSON()), t.globalAlpha = a;
4139
+ s !== 1 && (t.globalAlpha = s), gt("custom")(t, this.toJSON()), t.globalAlpha = a;
4095
4140
  }
4096
4141
  /**
4097
4142
  * Render stroke+fill to an offscreen canvas at full opacity, then composite
@@ -4099,7 +4144,7 @@ class He extends q {
4099
4144
  */
4100
4145
  renderWithOffscreen(t, e) {
4101
4146
  var d;
4102
- const o = (((d = this.stroke) == null ? void 0 : d.width) || 0) + 20, s = this.getVisualBoundingBox(), a = Math.ceil(s.width + o * 2), n = Math.ceil(s.height + o * 2), h = document.createElement("canvas");
4147
+ const s = (((d = this.stroke) == null ? void 0 : d.width) || 0) + 20, o = this.getVisualBoundingBox(), a = Math.ceil(o.width + s * 2), n = Math.ceil(o.height + s * 2), h = document.createElement("canvas");
4103
4148
  h.width = a, h.height = n;
4104
4149
  const l = h.getContext("2d");
4105
4150
  if (!l) {
@@ -4107,14 +4152,14 @@ class He extends q {
4107
4152
  t.globalAlpha = e, gt("custom")(t, this.toJSON()), t.globalAlpha = f;
4108
4153
  return;
4109
4154
  }
4110
- const c = s.x + s.width / 2, g = s.y + s.height / 2;
4155
+ const c = o.x + o.width / 2, g = o.y + o.height / 2;
4111
4156
  l.translate(a / 2 - c, n / 2 - g), gt("custom")(l, this.toJSON()), t.save(), t.globalAlpha = e, t.drawImage(h, c - a / 2, g - n / 2), t.restore();
4112
4157
  }
4113
4158
  /**
4114
4159
  * Override getTransformStartData to capture initial line count
4115
4160
  */
4116
4161
  getTransformStartData() {
4117
- const t = super.getTransformStartData(), e = this.transformData.width - j * 2, i = At(this.text, e, this.fontSize, this.fontFamily, this.bold, this.italic, void 0, !1, {
4162
+ const t = super.getTransformStartData(), e = this.transformData.width - j * 2, i = It(this.text, e, this.fontSize, this.fontFamily, this.bold, this.italic, void 0, !1, {
4118
4163
  letterSpacing: this.letterSpacing
4119
4164
  });
4120
4165
  return t.lineCount = i.length, t;
@@ -4124,9 +4169,9 @@ class He extends q {
4124
4169
  * Corner handles: uniform scale (fontSize and width both change) - line count locked
4125
4170
  * Side handles: only width changes - text re-wraps naturally
4126
4171
  */
4127
- resize(t, e, i, o) {
4128
- if (t === "top-left" || t === "top-right" || t === "bottom-left" || t === "bottom-right" || (this._lockedLineCount = void 0), Vt(this, t, e, i, o), this._lockedLineCount !== void 0 && this._lockedLineCount > 0) {
4129
- const n = Bt(
4172
+ resize(t, e, i, s) {
4173
+ if (t === "top-left" || t === "top-right" || t === "bottom-left" || t === "bottom-right" || (this._lockedLineCount = void 0), jt(this, t, e, i, s), this._lockedLineCount !== void 0 && this._lockedLineCount > 0) {
4174
+ const n = Pt(
4130
4175
  this.text,
4131
4176
  this.fontSize,
4132
4177
  this.fontFamily,
@@ -4178,32 +4223,32 @@ class He extends q {
4178
4223
  };
4179
4224
  }
4180
4225
  }
4181
- function Pe(r, t, e, i) {
4182
- const o = I.toRadians(i), s = Math.cos(o), a = Math.sin(o);
4226
+ function Ne(r, t, e, i) {
4227
+ const s = I.toRadians(i), o = Math.cos(s), a = Math.sin(s);
4183
4228
  let n = 0, h = 0;
4184
4229
  e === "top-left" ? (n = r.width, h = r.height) : e === "top-right" ? (n = 0, h = r.height) : e === "bottom-left" ? (n = r.width, h = 0) : e === "bottom-right" && (n = 0, h = 0);
4185
- const l = r.x + (n * s - h * a), c = r.y + (n * a + h * s);
4230
+ const l = r.x + (n * o - h * a), c = r.y + (n * a + h * o);
4186
4231
  let g = 0, d = 0;
4187
4232
  e === "top-left" ? (g = t.width, d = t.height) : e === "top-right" ? (g = 0, d = t.height) : e === "bottom-left" ? (g = t.width, d = 0) : e === "bottom-right" && (g = 0, d = 0);
4188
- const f = l - (g * s - d * a), u = c - (g * a + d * s);
4233
+ const f = l - (g * o - d * a), u = c - (g * a + d * o);
4189
4234
  return { x: f, y: u };
4190
4235
  }
4191
- function qi(r, t, e, i = 1) {
4192
- const o = r.width / 2, s = r.height + ge / i, a = r.x + o, n = r.y + s, h = I.toRadians(t), l = Math.cos(h), c = Math.sin(h), g = a - e.x, d = n - e.y, f = g * l - d * c, u = g * c + d * l;
4236
+ function ss(r, t, e, i = 1) {
4237
+ const s = r.width / 2, o = r.height + me / i, a = r.x + s, n = r.y + o, h = I.toRadians(t), l = Math.cos(h), c = Math.sin(h), g = a - e.x, d = n - e.y, f = g * l - d * c, u = g * c + d * l;
4193
4238
  return {
4194
4239
  x: e.x + f,
4195
4240
  y: e.y + u
4196
4241
  };
4197
4242
  }
4198
- function ji(r, t, e) {
4199
- const i = I.toRadians(t), o = Math.cos(i), s = Math.sin(i), a = (c, g) => {
4200
- const d = r.x + c, f = r.y + g, u = d - e.x, m = f - e.y, p = u * o - m * s, y = u * s + m * o;
4243
+ function os(r, t, e) {
4244
+ const i = I.toRadians(t), s = Math.cos(i), o = Math.sin(i), a = (c, g) => {
4245
+ const d = r.x + c, f = r.y + g, u = d - e.x, m = f - e.y, p = u * s - m * o, y = u * o + m * s;
4201
4246
  return {
4202
4247
  x: e.x + p,
4203
4248
  y: e.y + y
4204
4249
  };
4205
4250
  }, { width: n, height: h } = r, l = (c, g, d, f) => {
4206
- const u = a(d, f), m = Le(
4251
+ const u = a(d, f), m = _e(
4207
4252
  u.x,
4208
4253
  u.y,
4209
4254
  e.x,
@@ -4232,35 +4277,35 @@ function ji(r, t, e) {
4232
4277
  l("edge", "middle-bottom", n / 2, h)
4233
4278
  ];
4234
4279
  }
4235
- function Zi(r, t, e, i, o) {
4236
- const s = r - e, a = t - i;
4237
- return s * s + a * a <= o * o;
4280
+ function rs(r, t, e, i, s) {
4281
+ const o = r - e, a = t - i;
4282
+ return o * o + a * a <= s * s;
4238
4283
  }
4239
- function Ki(r, t, e, i) {
4240
- const o = I.toRadiansInverse(i), s = Math.cos(o), a = Math.sin(o), n = r - e.x, h = t - e.y, l = n * s - h * a, c = n * a + h * s;
4284
+ function ns(r, t, e, i) {
4285
+ const s = I.toRadiansInverse(i), o = Math.cos(s), a = Math.sin(s), n = r - e.x, h = t - e.y, l = n * o - h * a, c = n * a + h * o;
4241
4286
  return l >= 0 && l <= e.width && c >= 0 && c <= e.height;
4242
4287
  }
4243
- function tt(r, t, e = "Arial", i = !1, o = !1) {
4244
- const a = document.createElement("canvas").getContext("2d"), n = i ? "bold" : "normal", h = o ? "italic" : "normal";
4288
+ function tt(r, t, e = "Arial", i = !1, s = !1) {
4289
+ const a = document.createElement("canvas").getContext("2d"), n = i ? "bold" : "normal", h = s ? "italic" : "normal";
4245
4290
  return a.font = `${h} ${n} ${t}px ${e}`, a.measureText(r).width;
4246
4291
  }
4247
- function Qi(r) {
4292
+ function as(r) {
4248
4293
  return {
4249
4294
  x: r.x + r.width / 2,
4250
4295
  y: r.y + r.height / 2
4251
4296
  };
4252
4297
  }
4253
- function to(r, t, e, i) {
4298
+ function hs(r, t, e, i) {
4254
4299
  return Math.atan2(i - t, e - r);
4255
4300
  }
4256
- function eo(r, t, e) {
4301
+ function ls(r, t, e) {
4257
4302
  return Math.abs(r - t) <= e;
4258
4303
  }
4259
- function Le(r, t, e, i, o, s = 0, a = "") {
4304
+ function _e(r, t, e, i, s, o = 0, a = "") {
4260
4305
  const n = r - e, h = t - i;
4261
4306
  let l = Math.atan2(h, n) * (180 / Math.PI);
4262
- if (l = (l % 360 + 360) % 360, o === "corner") {
4263
- if (Math.abs(s) < 0.1) {
4307
+ if (l = (l % 360 + 360) % 360, s === "corner") {
4308
+ if (Math.abs(o) < 0.1) {
4264
4309
  if (a === "top-left" || a === "bottom-right")
4265
4310
  return "nwse-resize";
4266
4311
  if (a === "top-right" || a === "bottom-left")
@@ -4273,17 +4318,17 @@ function Le(r, t, e, i, o, s = 0, a = "") {
4273
4318
  return c >= 45 && c < 135 ? "ns-resize" : "ew-resize";
4274
4319
  }
4275
4320
  }
4276
- function We(r) {
4321
+ function Ye(r) {
4277
4322
  if (!r.getTransform)
4278
4323
  return 1;
4279
4324
  const t = r.getTransform();
4280
4325
  return Math.sqrt(t.a * t.a + t.b * t.b);
4281
4326
  }
4282
- function io(r, t, e = []) {
4283
- const i = We(r);
4284
- r.lineWidth = i > 0 ? t / i : t, e.length > 0 && r.setLineDash(i > 0 ? e.map((o) => o / i) : e);
4327
+ function cs(r, t, e = []) {
4328
+ const i = Ye(r);
4329
+ r.lineWidth = i > 0 ? t / i : t, e.length > 0 && r.setLineDash(i > 0 ? e.map((s) => s / i) : e);
4285
4330
  }
4286
- class ze extends q {
4331
+ class Ue extends q {
4287
4332
  constructor(t = {}) {
4288
4333
  super(t), this.transformType = "circle";
4289
4334
  const e = t.transformData;
@@ -4313,11 +4358,11 @@ class ze extends q {
4313
4358
  * For circular text, calculate the arc bounds where text actually appears
4314
4359
  */
4315
4360
  getVisualBoundingBox() {
4316
- const t = this.transformData.radius * this.transformData.scale, e = this.fontSize * this.transformData.scale, o = tt(this.text, e, this.fontFamily, this.bold, this.italic) / t, s = -Math.PI / 2 - o / 2, a = -Math.PI / 2 + o / 2, n = t > e / 2 ? t - e / 2 : t * 0.1, h = t + e / 2;
4361
+ const t = this.transformData.radius * this.transformData.scale, e = this.fontSize * this.transformData.scale, s = tt(this.text, e, this.fontFamily, this.bold, this.italic) / t, o = -Math.PI / 2 - s / 2, a = -Math.PI / 2 + s / 2, n = t > e / 2 ? t - e / 2 : t * 0.1, h = t + e / 2;
4317
4362
  let l = 1 / 0, c = -1 / 0, g = 1 / 0, d = -1 / 0;
4318
4363
  const f = 10;
4319
4364
  for (let u = 0; u <= f; u++) {
4320
- const m = s + (a - s) * (u / f), p = this.x + Math.cos(m) * n, y = this.y + Math.sin(m) * n, w = this.x + Math.cos(m) * h, S = this.y + Math.sin(m) * h;
4365
+ const m = o + (a - o) * (u / f), p = this.x + Math.cos(m) * n, y = this.y + Math.sin(m) * n, w = this.x + Math.cos(m) * h, S = this.y + Math.sin(m) * h;
4321
4366
  l = Math.min(l, p, w), c = Math.max(c, p, w), g = Math.min(g, y, S), d = Math.max(d, y, S);
4322
4367
  }
4323
4368
  return {
@@ -4336,15 +4381,15 @@ class ze extends q {
4336
4381
  * Handle resize
4337
4382
  * For circle, we maintain uniform scale and keep scale on the transform
4338
4383
  */
4339
- resize(t, e, i, o) {
4340
- const s = o.transformData, a = (e + i) / 2, n = (o.width + o.height) / 2, h = a / n, l = s.scale * h, c = Math.max(0.1, Math.min(10, l));
4384
+ resize(t, e, i, s) {
4385
+ const o = s.transformData, a = (e + i) / 2, n = (s.width + s.height) / 2, h = a / n, l = o.scale * h, c = Math.max(0.1, Math.min(10, l));
4341
4386
  this.transformData.scale = c;
4342
- const g = this.getBoundingBox(), d = Pe(
4387
+ const g = this.getBoundingBox(), d = Ne(
4343
4388
  {
4344
- x: o.x - s.radius * s.scale,
4345
- y: o.y - s.radius * s.scale,
4346
- width: s.radius * 2 * s.scale,
4347
- height: s.radius * 2 * s.scale
4389
+ x: s.x - o.radius * o.scale,
4390
+ y: s.y - o.radius * o.scale,
4391
+ width: o.radius * 2 * o.scale,
4392
+ height: o.radius * 2 * o.scale
4348
4393
  },
4349
4394
  { width: g.width, height: g.height },
4350
4395
  t,
@@ -4413,7 +4458,7 @@ class ze extends q {
4413
4458
  };
4414
4459
  }
4415
4460
  }
4416
- class Xe extends q {
4461
+ class Ge extends q {
4417
4462
  constructor(t = {}) {
4418
4463
  super(t), this.transformType = "arch";
4419
4464
  const e = t.transformData;
@@ -4433,10 +4478,10 @@ class Xe extends q {
4433
4478
  };
4434
4479
  }
4435
4480
  getVisualBoundingBox() {
4436
- const t = this.text.split(""), e = t.map((u) => tt(u, this.fontSize, this.fontFamily)), i = e.reduce((u, m) => u + m, 0), o = this.transformData.width / 2, s = 0.3, n = this.fontSize / 2;
4481
+ const t = this.text.split(""), e = t.map((u) => tt(u, this.fontSize, this.fontFamily)), i = e.reduce((u, m) => u + m, 0), s = this.transformData.width / 2, o = 0.3, n = this.fontSize / 2;
4437
4482
  let h = 1 / 0, l = -1 / 0, c = 1 / 0, g = -1 / 0, d = -i / 2;
4438
4483
  t.forEach((u, m) => {
4439
- const p = e[m], y = d + p / 2, w = y / o, S = (Math.pow(w, 2) - 1) * this.transformData.archHeight * this.fontSize, b = 2 * w * this.transformData.archHeight;
4484
+ const p = e[m], y = d + p / 2, w = y / s, S = (Math.pow(w, 2) - 1) * this.transformData.archHeight * this.fontSize, b = 2 * w * this.transformData.archHeight;
4440
4485
  [
4441
4486
  { x: -p / 2, y: -n },
4442
4487
  // top-left
@@ -4447,8 +4492,8 @@ class Xe extends q {
4447
4492
  { x: p / 2, y: n }
4448
4493
  // bottom-right
4449
4494
  ].forEach((C) => {
4450
- const M = C.x, F = C.y + b * s * C.x, v = y + M, D = S + F;
4451
- h = Math.min(h, v), l = Math.max(l, v), c = Math.min(c, D), g = Math.max(g, D);
4495
+ const M = C.x, F = C.y + b * o * C.x, T = y + M, D = S + F;
4496
+ h = Math.min(h, T), l = Math.max(l, T), c = Math.min(c, D), g = Math.max(g, D);
4452
4497
  }), d += p;
4453
4498
  });
4454
4499
  const f = 2;
@@ -4459,22 +4504,22 @@ class Xe extends q {
4459
4504
  height: g - c
4460
4505
  };
4461
4506
  }
4462
- resize(t, e, i, o) {
4463
- const s = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = o.transformData;
4464
- if (s) {
4465
- const h = e / o.width, l = o.fontSize * h;
4507
+ resize(t, e, i, s) {
4508
+ const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
4509
+ if (o) {
4510
+ const h = e / s.width, l = s.fontSize * h;
4466
4511
  this.setFontSize(l);
4467
4512
  const c = n.width * h;
4468
4513
  this.transformData.width = Math.max(50, c);
4469
4514
  } else if (a && (t === "middle-left" || t === "middle-right")) {
4470
- this.fontSize = o.fontSize, this.transformData.width = Math.max(50, e);
4471
- const h = e - o.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
4515
+ this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
4516
+ const h = e - s.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
4472
4517
  if (t === "middle-left") {
4473
4518
  const d = -h / 2;
4474
- this.x = o.x + d * c, this.y = o.y + d * g;
4519
+ this.x = s.x + d * c, this.y = s.y + d * g;
4475
4520
  } else if (t === "middle-right") {
4476
4521
  const d = h / 2;
4477
- this.x = o.x + d * c, this.y = o.y + d * g;
4522
+ this.x = s.x + d * c, this.y = s.y + d * g;
4478
4523
  }
4479
4524
  }
4480
4525
  }
@@ -4506,7 +4551,7 @@ class Xe extends q {
4506
4551
  };
4507
4552
  }
4508
4553
  }
4509
- const st = {
4554
+ const ot = {
4510
4555
  amplitude: 0.2,
4511
4556
  // 20% - subtle wave effect
4512
4557
  frequency: 1.2,
@@ -4518,22 +4563,22 @@ const st = {
4518
4563
  frequency: 2,
4519
4564
  // Standard flag frequency
4520
4565
  width: 200
4521
- }, _e = {
4566
+ }, $e = {
4522
4567
  archHeight: 0.5
4523
- }, Ye = {
4568
+ }, Ve = {
4524
4569
  leanAmount: 0
4525
- }, Ne = {
4570
+ }, Je = {
4526
4571
  ascendAngle: -15
4527
4572
  };
4528
- class Ue extends q {
4573
+ class qe extends q {
4529
4574
  constructor(t = {}) {
4530
4575
  super(t), this.transformType = "wave";
4531
4576
  const e = t.transformData;
4532
4577
  this.transformData = {
4533
4578
  type: "wave",
4534
- amplitude: (e == null ? void 0 : e.amplitude) ?? st.amplitude,
4535
- frequency: (e == null ? void 0 : e.frequency) ?? st.frequency,
4536
- width: (e == null ? void 0 : e.width) ?? st.width
4579
+ amplitude: (e == null ? void 0 : e.amplitude) ?? ot.amplitude,
4580
+ frequency: (e == null ? void 0 : e.frequency) ?? ot.frequency,
4581
+ width: (e == null ? void 0 : e.width) ?? ot.width
4537
4582
  };
4538
4583
  }
4539
4584
  getBoundingBox() {
@@ -4546,21 +4591,21 @@ class Ue extends q {
4546
4591
  };
4547
4592
  }
4548
4593
  getVisualBoundingBox() {
4549
- const t = this.text.split(""), e = t.map((d) => tt(d, this.fontSize, this.fontFamily)), i = e.reduce((d, f) => d + f, 0), s = this.fontSize / 2;
4594
+ const t = this.text.split(""), e = t.map((d) => tt(d, this.fontSize, this.fontFamily)), i = e.reduce((d, f) => d + f, 0), o = this.fontSize / 2;
4550
4595
  let a = 1 / 0, n = -1 / 0, h = 1 / 0, l = -1 / 0, c = -i / 2;
4551
4596
  t.forEach((d, f) => {
4552
4597
  const u = e[f], m = c + u / 2, p = m / (this.transformData.width / 2), y = this.transformData.amplitude * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * p), w = this.transformData.amplitude * this.transformData.frequency * Math.PI * Math.cos(this.transformData.frequency * Math.PI * p);
4553
4598
  [
4554
- { x: -u / 2, y: -s },
4599
+ { x: -u / 2, y: -o },
4555
4600
  // top-left
4556
- { x: u / 2, y: -s },
4601
+ { x: u / 2, y: -o },
4557
4602
  // top-right
4558
- { x: -u / 2, y: s },
4603
+ { x: -u / 2, y: o },
4559
4604
  // bottom-left
4560
- { x: u / 2, y: s }
4605
+ { x: u / 2, y: o }
4561
4606
  // bottom-right
4562
4607
  ].forEach((b) => {
4563
- const T = b.x, C = b.y + w * be * b.x, M = m + T, F = y + C;
4608
+ const v = b.x, C = b.y + w * Ce * b.x, M = m + v, F = y + C;
4564
4609
  a = Math.min(a, M), n = Math.max(n, M), h = Math.min(h, F), l = Math.max(l, F);
4565
4610
  }), c += u;
4566
4611
  });
@@ -4572,8 +4617,8 @@ class Ue extends q {
4572
4617
  height: l - h
4573
4618
  };
4574
4619
  }
4575
- resize(t, e, i, o) {
4576
- Vt(this, t, e, i, o);
4620
+ resize(t, e, i, s) {
4621
+ jt(this, t, e, i, s);
4577
4622
  }
4578
4623
  getEnabledAnchors() {
4579
4624
  return ["top-left", "top-right", "bottom-left", "bottom-right"];
@@ -4594,7 +4639,7 @@ class Ue extends q {
4594
4639
  };
4595
4640
  }
4596
4641
  }
4597
- class Ge extends q {
4642
+ class je extends q {
4598
4643
  constructor(t = {}) {
4599
4644
  super(t), this.transformType = "flag";
4600
4645
  const e = t.transformData;
@@ -4615,10 +4660,10 @@ class Ge extends q {
4615
4660
  };
4616
4661
  }
4617
4662
  getVisualBoundingBox() {
4618
- const t = this.text.split(""), e = t.map((f) => tt(f, this.fontSize, this.fontFamily)), i = e.reduce((f, u) => f + u, 0), o = 0.3, a = this.fontSize / 2;
4663
+ const t = this.text.split(""), e = t.map((f) => tt(f, this.fontSize, this.fontFamily)), i = e.reduce((f, u) => f + u, 0), s = 0.3, a = this.fontSize / 2;
4619
4664
  let n = 1 / 0, h = -1 / 0, l = 1 / 0, c = -1 / 0, g = -i / 2;
4620
4665
  t.forEach((f, u) => {
4621
- const m = e[u], p = g + m / 2, y = p / (this.transformData.width / 2), w = Math.abs(y), S = this.transformData.amplitude * w, b = S * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * y), T = S * this.transformData.frequency * Math.PI * Math.cos(this.transformData.frequency * Math.PI * y), C = this.transformData.amplitude * Math.sign(y) * Math.sin(this.transformData.frequency * Math.PI * y), M = T + C;
4666
+ const m = e[u], p = g + m / 2, y = p / (this.transformData.width / 2), w = Math.abs(y), S = this.transformData.amplitude * w, b = S * this.fontSize * Math.sin(this.transformData.frequency * Math.PI * y), v = S * this.transformData.frequency * Math.PI * Math.cos(this.transformData.frequency * Math.PI * y), C = this.transformData.amplitude * Math.sign(y) * Math.sin(this.transformData.frequency * Math.PI * y), M = v + C;
4622
4667
  [
4623
4668
  { x: -m / 2, y: -a },
4624
4669
  // top-left
@@ -4628,8 +4673,8 @@ class Ge extends q {
4628
4673
  // bottom-left
4629
4674
  { x: m / 2, y: a }
4630
4675
  // bottom-right
4631
- ].forEach((v) => {
4632
- const D = v.x, U = v.y + M * o * v.x, B = p + D, A = b + U;
4676
+ ].forEach((T) => {
4677
+ const D = T.x, U = T.y + M * s * T.x, B = p + D, A = b + U;
4633
4678
  n = Math.min(n, B), h = Math.max(h, B), l = Math.min(l, A), c = Math.max(c, A);
4634
4679
  }), g += m;
4635
4680
  });
@@ -4641,22 +4686,22 @@ class Ge extends q {
4641
4686
  height: c - l
4642
4687
  };
4643
4688
  }
4644
- resize(t, e, i, o) {
4645
- const s = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = o.transformData;
4646
- if (s) {
4647
- const h = e / o.width, l = o.fontSize * h;
4689
+ resize(t, e, i, s) {
4690
+ const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
4691
+ if (o) {
4692
+ const h = e / s.width, l = s.fontSize * h;
4648
4693
  this.setFontSize(l);
4649
4694
  const c = n.width * h;
4650
4695
  this.transformData.width = Math.max(50, c);
4651
4696
  } else if (a && (t === "middle-left" || t === "middle-right")) {
4652
- this.fontSize = o.fontSize, this.transformData.width = Math.max(50, e);
4653
- const h = e - o.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
4697
+ this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
4698
+ const h = e - s.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
4654
4699
  if (t === "middle-left") {
4655
4700
  const d = -h / 2;
4656
- this.x = o.x + d * c, this.y = o.y + d * g;
4701
+ this.x = s.x + d * c, this.y = s.y + d * g;
4657
4702
  } else if (t === "middle-right") {
4658
4703
  const d = h / 2;
4659
- this.x = o.x + d * c, this.y = o.y + d * g;
4704
+ this.x = s.x + d * c, this.y = s.y + d * g;
4660
4705
  }
4661
4706
  }
4662
4707
  }
@@ -4690,7 +4735,7 @@ class Ge extends q {
4690
4735
  };
4691
4736
  }
4692
4737
  }
4693
- class $e extends q {
4738
+ class Ze extends q {
4694
4739
  constructor(t = {}) {
4695
4740
  super(t), this.transformType = "lean";
4696
4741
  const e = t.transformData;
@@ -4710,7 +4755,7 @@ class $e extends q {
4710
4755
  };
4711
4756
  }
4712
4757
  getVisualBoundingBox() {
4713
- const e = tt(this.text, this.fontSize, this.fontFamily), i = this.fontSize * 1.2, o = -this.transformData.leanAmount * Math.PI / 4, s = Math.tan(o), a = [
4758
+ const e = tt(this.text, this.fontSize, this.fontFamily), i = this.fontSize * 1.2, s = -this.transformData.leanAmount * Math.PI / 4, o = Math.tan(s), a = [
4714
4759
  { x: -e / 2, y: -i / 2 },
4715
4760
  // top-left
4716
4761
  { x: e / 2, y: -i / 2 },
@@ -4722,7 +4767,7 @@ class $e extends q {
4722
4767
  ];
4723
4768
  let n = 1 / 0, h = -1 / 0, l = 1 / 0, c = -1 / 0;
4724
4769
  a.forEach((d) => {
4725
- const f = d.x + s * d.y, u = d.y;
4770
+ const f = d.x + o * d.y, u = d.y;
4726
4771
  n = Math.min(n, f), h = Math.max(h, f), l = Math.min(l, u), c = Math.max(c, u);
4727
4772
  });
4728
4773
  const g = 2;
@@ -4733,22 +4778,22 @@ class $e extends q {
4733
4778
  height: c - l
4734
4779
  };
4735
4780
  }
4736
- resize(t, e, i, o) {
4737
- const s = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = o.transformData;
4738
- if (s) {
4739
- const h = e / o.width, l = o.fontSize * h;
4781
+ resize(t, e, i, s) {
4782
+ const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
4783
+ if (o) {
4784
+ const h = e / s.width, l = s.fontSize * h;
4740
4785
  this.setFontSize(l);
4741
4786
  const c = n.width * h;
4742
4787
  this.transformData.width = Math.max(50, c);
4743
4788
  } else if (a && (t === "middle-left" || t === "middle-right")) {
4744
- this.fontSize = o.fontSize, this.transformData.width = Math.max(50, e);
4789
+ this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
4745
4790
  const h = e - n.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
4746
4791
  if (t === "middle-left") {
4747
4792
  const d = -h / 2;
4748
- this.x = o.x + d * c, this.y = o.y + d * g;
4793
+ this.x = s.x + d * c, this.y = s.y + d * g;
4749
4794
  } else if (t === "middle-right") {
4750
4795
  const d = h / 2;
4751
- this.x = o.x + d * c, this.y = o.y + d * g;
4796
+ this.x = s.x + d * c, this.y = s.y + d * g;
4752
4797
  }
4753
4798
  }
4754
4799
  }
@@ -4780,7 +4825,7 @@ class $e extends q {
4780
4825
  };
4781
4826
  }
4782
4827
  }
4783
- class Ve extends q {
4828
+ class Ke extends q {
4784
4829
  constructor(t = {}) {
4785
4830
  super(t), this.transformType = "ascend";
4786
4831
  const e = t.transformData;
@@ -4791,19 +4836,19 @@ class Ve extends q {
4791
4836
  };
4792
4837
  }
4793
4838
  getBoundingBox() {
4794
- const t = this.transformData.ascendAngle * Math.PI / 180, e = this.transformData.width, i = e * Math.tan(t), o = Math.abs(i) + this.fontSize * 1.2, s = i > 0 ? -o : 0;
4839
+ const t = this.transformData.ascendAngle * Math.PI / 180, e = this.transformData.width, i = e * Math.tan(t), s = Math.abs(i) + this.fontSize * 1.2, o = i > 0 ? -s : 0;
4795
4840
  return {
4796
4841
  x: this.x - e / 2,
4797
- y: this.y + s,
4842
+ y: this.y + o,
4798
4843
  width: e,
4799
- height: o
4844
+ height: s
4800
4845
  };
4801
4846
  }
4802
4847
  getVisualBoundingBox() {
4803
- const t = this.text.split(""), e = t.map((m) => tt(m, this.fontSize, this.fontFamily)), i = e.reduce((m, p) => m + p, 0), o = this.transformData.ascendAngle * Math.PI / 180, s = Math.tan(o), a = 1, h = this.fontSize / 2;
4848
+ const t = this.text.split(""), e = t.map((m) => tt(m, this.fontSize, this.fontFamily)), i = e.reduce((m, p) => m + p, 0), s = this.transformData.ascendAngle * Math.PI / 180, o = Math.tan(s), a = 1, h = this.fontSize / 2;
4804
4849
  let l = 1 / 0, c = -1 / 0, g = 1 / 0, d = -1 / 0, f = -i / 2;
4805
4850
  t.forEach((m, p) => {
4806
- const y = e[p], w = f + y / 2, S = w * s;
4851
+ const y = e[p], w = f + y / 2, S = w * o;
4807
4852
  [
4808
4853
  { x: -y / 2, y: -h },
4809
4854
  // top-left
@@ -4813,9 +4858,9 @@ class Ve extends q {
4813
4858
  // bottom-left
4814
4859
  { x: y / 2, y: h }
4815
4860
  // bottom-right
4816
- ].forEach((T) => {
4817
- const C = T.x, M = T.y + s * a * T.x, F = w + C, v = S + M;
4818
- l = Math.min(l, F), c = Math.max(c, F), g = Math.min(g, v), d = Math.max(d, v);
4861
+ ].forEach((v) => {
4862
+ const C = v.x, M = v.y + o * a * v.x, F = w + C, T = S + M;
4863
+ l = Math.min(l, F), c = Math.max(c, F), g = Math.min(g, T), d = Math.max(d, T);
4819
4864
  }), f += y;
4820
4865
  });
4821
4866
  const u = 2;
@@ -4826,22 +4871,22 @@ class Ve extends q {
4826
4871
  height: d - g
4827
4872
  };
4828
4873
  }
4829
- resize(t, e, i, o) {
4830
- const s = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = o.transformData;
4831
- if (s) {
4832
- const h = e / o.width, l = o.fontSize * h;
4874
+ resize(t, e, i, s) {
4875
+ const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle"), n = s.transformData;
4876
+ if (o) {
4877
+ const h = e / s.width, l = s.fontSize * h;
4833
4878
  this.setFontSize(l);
4834
4879
  const c = n.width * h;
4835
4880
  this.transformData.width = Math.max(50, c);
4836
4881
  } else if (a && (t === "middle-left" || t === "middle-right")) {
4837
- this.fontSize = o.fontSize, this.transformData.width = Math.max(50, e);
4838
- const h = e - o.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
4882
+ this.fontSize = s.fontSize, this.transformData.width = Math.max(50, e);
4883
+ const h = e - s.width, l = this.rotation * Math.PI / 180, c = Math.cos(l), g = Math.sin(l);
4839
4884
  if (t === "middle-left") {
4840
4885
  const d = -h / 2;
4841
- this.x = o.x + d * c, this.y = o.y + d * g;
4886
+ this.x = s.x + d * c, this.y = s.y + d * g;
4842
4887
  } else if (t === "middle-right") {
4843
4888
  const d = h / 2;
4844
- this.x = o.x + d * c, this.y = o.y + d * g;
4889
+ this.x = s.x + d * c, this.y = s.y + d * g;
4845
4890
  }
4846
4891
  }
4847
4892
  }
@@ -4873,16 +4918,16 @@ class Ve extends q {
4873
4918
  };
4874
4919
  }
4875
4920
  }
4876
- class Mt extends Q {
4921
+ class kt extends Q {
4877
4922
  constructor(t = {}) {
4878
- var i, o, s, a, n, h, l, c, g, d, f;
4923
+ var i, s, o, a, n, h, l, c, g, d, f;
4879
4924
  super(t), this.transformType = "shape";
4880
4925
  const e = "rectangle";
4881
4926
  this.transformData = {
4882
4927
  type: "shape",
4883
4928
  shapeType: ((i = t.transformData) == null ? void 0 : i.shapeType) || e,
4884
- width: ((o = t.transformData) == null ? void 0 : o.width) || 200,
4885
- height: ((s = t.transformData) == null ? void 0 : s.height) || 200,
4929
+ width: ((s = t.transformData) == null ? void 0 : s.width) || 200,
4930
+ height: ((o = t.transformData) == null ? void 0 : o.height) || 200,
4886
4931
  borderRadius: ((a = t.transformData) == null ? void 0 : a.borderRadius) ?? 3,
4887
4932
  // Default 3% radius (~6px on 200x200 shape, matches hover border)
4888
4933
  radiusX: (n = t.transformData) == null ? void 0 : n.radiusX,
@@ -4890,7 +4935,7 @@ class Mt extends Q {
4890
4935
  sides: ((l = t.transformData) == null ? void 0 : l.sides) ?? 5,
4891
4936
  points: ((c = t.transformData) == null ? void 0 : c.points) ?? 5,
4892
4937
  innerRadius: ((g = t.transformData) == null ? void 0 : g.innerRadius) ?? 0.4,
4893
- fillColor: ((d = t.transformData) == null ? void 0 : d.fillColor) || Xt(),
4938
+ fillColor: ((d = t.transformData) == null ? void 0 : d.fillColor) || Yt(),
4894
4939
  fillOpacity: ((f = t.transformData) == null ? void 0 : f.fillOpacity) ?? 1
4895
4940
  };
4896
4941
  }
@@ -4925,34 +4970,34 @@ class Mt extends Q {
4925
4970
  getVisualBoundingBox() {
4926
4971
  const { shapeType: t, width: e, height: i } = this.transformData;
4927
4972
  if (t === "circle") {
4928
- const o = Math.min(e, i) / 2;
4973
+ const s = Math.min(e, i) / 2;
4929
4974
  return {
4930
- x: this.x - o,
4931
- y: this.y - o,
4932
- width: o * 2,
4933
- height: o * 2
4975
+ x: this.x - s,
4976
+ y: this.y - s,
4977
+ width: s * 2,
4978
+ height: s * 2
4934
4979
  };
4935
4980
  }
4936
4981
  if (t === "polygon" || t === "star") {
4937
- const o = Math.min(e, i) / 2;
4938
- let s = 1 / 0, a = 1 / 0, n = -1 / 0, h = -1 / 0;
4982
+ const s = Math.min(e, i) / 2;
4983
+ let o = 1 / 0, a = 1 / 0, n = -1 / 0, h = -1 / 0;
4939
4984
  if (t === "polygon") {
4940
4985
  const l = this.transformData.sides || 5;
4941
4986
  for (let c = 0; c < l; c++) {
4942
- const g = c * 2 * Math.PI / l - Math.PI / 2, d = o * Math.cos(g), f = o * Math.sin(g);
4943
- d < s && (s = d), d > n && (n = d), f < a && (a = f), f > h && (h = f);
4987
+ const g = c * 2 * Math.PI / l - Math.PI / 2, d = s * Math.cos(g), f = s * Math.sin(g);
4988
+ d < o && (o = d), d > n && (n = d), f < a && (a = f), f > h && (h = f);
4944
4989
  }
4945
4990
  } else {
4946
- const l = this.transformData.points || 5, c = o, g = c * (this.transformData.innerRadius ?? 0.4);
4991
+ const l = this.transformData.points || 5, c = s, g = c * (this.transformData.innerRadius ?? 0.4);
4947
4992
  for (let d = 0; d < l * 2; d++) {
4948
4993
  const f = d * Math.PI / l - Math.PI / 2, u = d % 2 === 0 ? c : g, m = u * Math.cos(f), p = u * Math.sin(f);
4949
- m < s && (s = m), m > n && (n = m), p < a && (a = p), p > h && (h = p);
4994
+ m < o && (o = m), m > n && (n = m), p < a && (a = p), p > h && (h = p);
4950
4995
  }
4951
4996
  }
4952
4997
  return {
4953
- x: this.x + s,
4998
+ x: this.x + o,
4954
4999
  y: this.y + a,
4955
- width: n - s,
5000
+ width: n - o,
4956
5001
  height: h - a
4957
5002
  };
4958
5003
  }
@@ -4969,14 +5014,14 @@ class Mt extends Q {
4969
5014
  */
4970
5015
  render(t, e = !1, i = !1) {
4971
5016
  var n;
4972
- const o = this.opacity ?? 1, s = !!((n = this.stroke) != null && n.enabled);
4973
- if (o < 1 && s) {
4974
- this.renderWithOffscreen(t, o);
5017
+ const s = this.opacity ?? 1, o = !!((n = this.stroke) != null && n.enabled);
5018
+ if (s < 1 && o) {
5019
+ this.renderWithOffscreen(t, s);
4975
5020
  return;
4976
5021
  }
4977
5022
  t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation)), t.fillStyle = this.transformData.fillColor || "#3b82f6";
4978
5023
  const a = this.transformData.fillOpacity ?? 1;
4979
- t.globalAlpha = o * a, this.renderShape(t), t.restore(), s && this.renderStroke(t, o);
5024
+ t.globalAlpha = s * a, this.renderShape(t), t.restore(), o && this.renderStroke(t, s);
4980
5025
  }
4981
5026
  /**
4982
5027
  * Render fill+stroke to a temporary canvas at full opacity, then composite
@@ -4984,7 +5029,7 @@ class Mt extends Q {
4984
5029
  */
4985
5030
  renderWithOffscreen(t, e) {
4986
5031
  var f;
4987
- const { width: i, height: o } = this.transformData, a = (((f = this.stroke) == null ? void 0 : f.width) || 2) + 2, n = Math.ceil(i + a * 2), h = Math.ceil(o + a * 2), l = document.createElement("canvas");
5032
+ const { width: i, height: s } = this.transformData, a = (((f = this.stroke) == null ? void 0 : f.width) || 2) + 2, n = Math.ceil(i + a * 2), h = Math.ceil(s + a * 2), l = document.createElement("canvas");
4988
5033
  l.width = n, l.height = h;
4989
5034
  const c = l.getContext("2d");
4990
5035
  if (!c) {
@@ -5008,55 +5053,55 @@ class Mt extends Q {
5008
5053
  * Trace the shape path without filling or stroking — used by offscreen render
5009
5054
  */
5010
5055
  traceShapePath(t) {
5011
- const { shapeType: e, width: i, height: o } = this.transformData;
5056
+ const { shapeType: e, width: i, height: s } = this.transformData;
5012
5057
  switch (e) {
5013
5058
  case "rectangle": {
5014
- const s = this.transformData.borderRadius || 0, a = -i / 2, n = -o / 2;
5015
- if (s > 0) {
5016
- const h = Math.min(s / 100 * Math.min(i, o), i / 2, o / 2);
5017
- t.roundRect(a, n, i, o, h);
5059
+ const o = this.transformData.borderRadius || 0, a = -i / 2, n = -s / 2;
5060
+ if (o > 0) {
5061
+ const h = Math.min(o / 100 * Math.min(i, s), i / 2, s / 2);
5062
+ t.roundRect(a, n, i, s, h);
5018
5063
  } else
5019
- t.rect(a, n, i, o);
5064
+ t.rect(a, n, i, s);
5020
5065
  break;
5021
5066
  }
5022
5067
  case "circle": {
5023
- const s = Math.min(i, o) / 2;
5024
- t.arc(0, 0, s, 0, Math.PI * 2);
5068
+ const o = Math.min(i, s) / 2;
5069
+ t.arc(0, 0, o, 0, Math.PI * 2);
5025
5070
  break;
5026
5071
  }
5027
5072
  case "ellipse":
5028
- t.ellipse(0, 0, i / 2, o / 2, 0, 0, Math.PI * 2);
5073
+ t.ellipse(0, 0, i / 2, s / 2, 0, 0, Math.PI * 2);
5029
5074
  break;
5030
5075
  case "triangle": {
5031
- const s = i / 2, a = o / 2;
5032
- t.moveTo(0, -a), t.lineTo(s, a), t.lineTo(-s, a), t.closePath();
5076
+ const o = i / 2, a = s / 2;
5077
+ t.moveTo(0, -a), t.lineTo(o, a), t.lineTo(-o, a), t.closePath();
5033
5078
  break;
5034
5079
  }
5035
5080
  case "polygon": {
5036
- const s = this.transformData.sides || 5, a = Math.min(i, o) / 2;
5037
- for (let n = 0; n < s; n++) {
5038
- const h = n * 2 * Math.PI / s - Math.PI / 2, l = a * Math.cos(h), c = a * Math.sin(h);
5081
+ const o = this.transformData.sides || 5, a = Math.min(i, s) / 2;
5082
+ for (let n = 0; n < o; n++) {
5083
+ const h = n * 2 * Math.PI / o - Math.PI / 2, l = a * Math.cos(h), c = a * Math.sin(h);
5039
5084
  n === 0 ? t.moveTo(l, c) : t.lineTo(l, c);
5040
5085
  }
5041
5086
  t.closePath();
5042
5087
  break;
5043
5088
  }
5044
5089
  case "star": {
5045
- const s = this.transformData.points || 5, a = Math.min(i, o) / 2, n = a * (this.transformData.innerRadius || 0.4);
5046
- for (let h = 0; h < s * 2; h++) {
5047
- const l = h * Math.PI / s - Math.PI / 2, c = h % 2 === 0 ? a : n, g = c * Math.cos(l), d = c * Math.sin(l);
5090
+ const o = this.transformData.points || 5, a = Math.min(i, s) / 2, n = a * (this.transformData.innerRadius || 0.4);
5091
+ for (let h = 0; h < o * 2; h++) {
5092
+ const l = h * Math.PI / o - Math.PI / 2, c = h % 2 === 0 ? a : n, g = c * Math.cos(l), d = c * Math.sin(l);
5048
5093
  h === 0 ? t.moveTo(g, d) : t.lineTo(g, d);
5049
5094
  }
5050
5095
  t.closePath();
5051
5096
  break;
5052
5097
  }
5053
5098
  case "line": {
5054
- const s = i / 2, a = o / 2;
5055
- t.rect(-s, -a, i, o);
5099
+ const o = i / 2, a = s / 2;
5100
+ t.rect(-o, -a, i, s);
5056
5101
  break;
5057
5102
  }
5058
5103
  default:
5059
- t.rect(-i / 2, -o / 2, i, o);
5104
+ t.rect(-i / 2, -s / 2, i, s);
5060
5105
  }
5061
5106
  }
5062
5107
  /**
@@ -5066,32 +5111,32 @@ class Mt extends Q {
5066
5111
  t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
5067
5112
  const i = this.stroke;
5068
5113
  t.strokeStyle = i.color || "#000000", t.lineWidth = i.width || 2, t.lineCap = i.lineCap || "round", t.lineJoin = i.lineJoin || "round", t.globalAlpha = e * (i.opacity ?? 1), i.dashArray && i.dashArray.length > 0 && t.setLineDash(i.dashArray);
5069
- const { shapeType: o, width: s, height: a } = this.transformData;
5070
- switch (t.beginPath(), o) {
5114
+ const { shapeType: s, width: o, height: a } = this.transformData;
5115
+ switch (t.beginPath(), s) {
5071
5116
  case "rectangle": {
5072
- const n = this.transformData.borderRadius || 0, h = -s / 2, l = -a / 2;
5117
+ const n = this.transformData.borderRadius || 0, h = -o / 2, l = -a / 2;
5073
5118
  if (n > 0) {
5074
- const c = Math.min(n / 100 * Math.min(s, a), s / 2, a / 2);
5075
- t.roundRect(h, l, s, a, c);
5119
+ const c = Math.min(n / 100 * Math.min(o, a), o / 2, a / 2);
5120
+ t.roundRect(h, l, o, a, c);
5076
5121
  } else
5077
- t.rect(h, l, s, a);
5122
+ t.rect(h, l, o, a);
5078
5123
  break;
5079
5124
  }
5080
5125
  case "circle": {
5081
- const n = Math.min(s, a) / 2;
5126
+ const n = Math.min(o, a) / 2;
5082
5127
  t.arc(0, 0, n, 0, Math.PI * 2);
5083
5128
  break;
5084
5129
  }
5085
5130
  case "ellipse":
5086
- t.ellipse(0, 0, s / 2, a / 2, 0, 0, Math.PI * 2);
5131
+ t.ellipse(0, 0, o / 2, a / 2, 0, 0, Math.PI * 2);
5087
5132
  break;
5088
5133
  case "triangle": {
5089
- const n = s / 2, h = a / 2;
5134
+ const n = o / 2, h = a / 2;
5090
5135
  t.moveTo(0, -h), t.lineTo(n, h), t.lineTo(-n, h), t.closePath();
5091
5136
  break;
5092
5137
  }
5093
5138
  case "polygon": {
5094
- const n = this.transformData.sides || 5, h = Math.min(s, a) / 2;
5139
+ const n = this.transformData.sides || 5, h = Math.min(o, a) / 2;
5095
5140
  for (let l = 0; l < n; l++) {
5096
5141
  const c = l * 2 * Math.PI / n - Math.PI / 2, g = h * Math.cos(c), d = h * Math.sin(c);
5097
5142
  l === 0 ? t.moveTo(g, d) : t.lineTo(g, d);
@@ -5100,7 +5145,7 @@ class Mt extends Q {
5100
5145
  break;
5101
5146
  }
5102
5147
  case "star": {
5103
- const n = this.transformData.points || 5, h = Math.min(s, a) / 2, l = h * (this.transformData.innerRadius || 0.4);
5148
+ const n = this.transformData.points || 5, h = Math.min(o, a) / 2, l = h * (this.transformData.innerRadius || 0.4);
5104
5149
  for (let c = 0; c < n * 2; c++) {
5105
5150
  const g = c * Math.PI / n - Math.PI / 2, d = c % 2 === 0 ? h : l, f = d * Math.cos(g), u = d * Math.sin(g);
5106
5151
  c === 0 ? t.moveTo(f, u) : t.lineTo(f, u);
@@ -5109,12 +5154,12 @@ class Mt extends Q {
5109
5154
  break;
5110
5155
  }
5111
5156
  case "line": {
5112
- const n = s / 2, h = a / 2;
5113
- t.rect(-n, -h, s, a);
5157
+ const n = o / 2, h = a / 2;
5158
+ t.rect(-n, -h, o, a);
5114
5159
  break;
5115
5160
  }
5116
5161
  default:
5117
- t.rect(-s / 2, -a / 2, s, a);
5162
+ t.rect(-o / 2, -a / 2, o, a);
5118
5163
  }
5119
5164
  t.stroke(), t.restore();
5120
5165
  }
@@ -5122,32 +5167,32 @@ class Mt extends Q {
5122
5167
  * Render the specific shape based on shapeType
5123
5168
  */
5124
5169
  renderShape(t) {
5125
- const { shapeType: e, width: i, height: o } = this.transformData;
5170
+ const { shapeType: e, width: i, height: s } = this.transformData;
5126
5171
  switch (t.beginPath(), e) {
5127
5172
  case "rectangle":
5128
- this.renderRectangle(t, i, o);
5173
+ this.renderRectangle(t, i, s);
5129
5174
  break;
5130
5175
  case "circle":
5131
- this.renderCircle(t, Math.min(i, o) / 2);
5176
+ this.renderCircle(t, Math.min(i, s) / 2);
5132
5177
  break;
5133
5178
  case "ellipse":
5134
- this.renderEllipse(t, i / 2, o / 2);
5179
+ this.renderEllipse(t, i / 2, s / 2);
5135
5180
  break;
5136
5181
  case "triangle":
5137
- this.renderTriangle(t, i, o);
5182
+ this.renderTriangle(t, i, s);
5138
5183
  break;
5139
5184
  case "polygon":
5140
- this.renderPolygon(t, Math.min(i, o) / 2);
5185
+ this.renderPolygon(t, Math.min(i, s) / 2);
5141
5186
  break;
5142
5187
  case "star":
5143
- this.renderStar(t, Math.min(i, o) / 2);
5188
+ this.renderStar(t, Math.min(i, s) / 2);
5144
5189
  break;
5145
5190
  case "line":
5146
- this.renderLine(t, i, o);
5191
+ this.renderLine(t, i, s);
5147
5192
  return;
5148
5193
  // Line uses stroke, not fill
5149
5194
  default:
5150
- this.renderRectangle(t, i, o);
5195
+ this.renderRectangle(t, i, s);
5151
5196
  }
5152
5197
  t.fill();
5153
5198
  }
@@ -5155,12 +5200,12 @@ class Mt extends Q {
5155
5200
  * Render a rectangle (with optional border radius)
5156
5201
  */
5157
5202
  renderRectangle(t, e, i) {
5158
- const o = this.transformData.borderRadius || 0, s = -e / 2, a = -i / 2;
5159
- if (o > 0) {
5160
- const n = Math.min(o / 100 * Math.min(e, i), e / 2, i / 2);
5161
- t.roundRect(s, a, e, i, n);
5203
+ const s = this.transformData.borderRadius || 0, o = -e / 2, a = -i / 2;
5204
+ if (s > 0) {
5205
+ const n = Math.min(s / 100 * Math.min(e, i), e / 2, i / 2);
5206
+ t.roundRect(o, a, e, i, n);
5162
5207
  } else
5163
- t.rect(s, a, e, i);
5208
+ t.rect(o, a, e, i);
5164
5209
  }
5165
5210
  /**
5166
5211
  * Render a circle
@@ -5178,16 +5223,16 @@ class Mt extends Q {
5178
5223
  * Render a triangle (isosceles, pointing up)
5179
5224
  */
5180
5225
  renderTriangle(t, e, i) {
5181
- const o = e / 2, s = i / 2;
5182
- t.moveTo(0, -s), t.lineTo(o, s), t.lineTo(-o, s), t.closePath();
5226
+ const s = e / 2, o = i / 2;
5227
+ t.moveTo(0, -o), t.lineTo(s, o), t.lineTo(-s, o), t.closePath();
5183
5228
  }
5184
5229
  /**
5185
5230
  * Render a regular polygon
5186
5231
  */
5187
5232
  renderPolygon(t, e) {
5188
- const i = Math.max(3, Math.min(20, this.transformData.sides || 5)), o = Math.PI * 2 / i, s = -Math.PI / 2;
5233
+ const i = Math.max(3, Math.min(20, this.transformData.sides || 5)), s = Math.PI * 2 / i, o = -Math.PI / 2;
5189
5234
  for (let a = 0; a <= i; a++) {
5190
- const n = s + o * a, h = Math.cos(n) * e, l = Math.sin(n) * e;
5235
+ const n = o + s * a, h = Math.cos(n) * e, l = Math.sin(n) * e;
5191
5236
  a === 0 ? t.moveTo(h, l) : t.lineTo(h, l);
5192
5237
  }
5193
5238
  t.closePath();
@@ -5196,9 +5241,9 @@ class Mt extends Q {
5196
5241
  * Render a star
5197
5242
  */
5198
5243
  renderStar(t, e) {
5199
- const i = Math.max(3, Math.min(20, this.transformData.points || 5)), o = Math.max(0.1, Math.min(0.9, this.transformData.innerRadius || 0.4)), s = e * o, a = Math.PI / i, n = -Math.PI / 2;
5244
+ const i = Math.max(3, Math.min(20, this.transformData.points || 5)), s = Math.max(0.1, Math.min(0.9, this.transformData.innerRadius || 0.4)), o = e * s, a = Math.PI / i, n = -Math.PI / 2;
5200
5245
  for (let h = 0; h < i * 2; h++) {
5201
- const l = n + a * h, c = h % 2 === 0 ? e : s, g = Math.cos(l) * c, d = Math.sin(l) * c;
5246
+ const l = n + a * h, c = h % 2 === 0 ? e : o, g = Math.cos(l) * c, d = Math.sin(l) * c;
5202
5247
  h === 0 ? t.moveTo(g, d) : t.lineTo(g, d);
5203
5248
  }
5204
5249
  t.closePath();
@@ -5207,20 +5252,20 @@ class Mt extends Q {
5207
5252
  * Render a line
5208
5253
  */
5209
5254
  renderLine(t, e, i) {
5210
- const o = e / 2, s = i;
5211
- t.moveTo(-o, 0), t.lineTo(o, 0), t.strokeStyle = this.transformData.fillColor || "#3b82f6", t.lineWidth = s, t.lineCap = "round", t.stroke();
5255
+ const s = e / 2, o = i;
5256
+ t.moveTo(-s, 0), t.lineTo(s, 0), t.strokeStyle = this.transformData.fillColor || "#3b82f6", t.lineWidth = o, t.lineCap = "round", t.stroke();
5212
5257
  }
5213
5258
  /**
5214
5259
  * Handle resize - maintain aspect ratio for circles, free resize for others
5215
5260
  */
5216
- resize(t, e, i, o) {
5217
- const { shapeType: s } = this.transformData;
5218
- if (s === "circle" || s === "polygon" || s === "star") {
5219
- const c = Math.max(e / o.transformData.width, i / o.transformData.height);
5220
- this.transformData.width = o.transformData.width * c, this.transformData.height = o.transformData.height * c;
5221
- } else s === "line" ? (this.transformData.width = e, this.transformData.height = o.transformData.height) : (this.transformData.width = e, this.transformData.height = i);
5222
- this.rotation = o.rotation;
5223
- const a = this.getFixedCorner(t, o), n = this.getOppositeAnchor(t), h = this.getBoundingBox(), l = this.getCornerOffset(n, h);
5261
+ resize(t, e, i, s) {
5262
+ const { shapeType: o } = this.transformData;
5263
+ if (o === "circle" || o === "polygon" || o === "star") {
5264
+ const c = Math.max(e / s.transformData.width, i / s.transformData.height);
5265
+ this.transformData.width = s.transformData.width * c, this.transformData.height = s.transformData.height * c;
5266
+ } else o === "line" ? (this.transformData.width = e, this.transformData.height = s.transformData.height) : (this.transformData.width = e, this.transformData.height = i);
5267
+ this.rotation = s.rotation;
5268
+ const a = this.getFixedCorner(t, s), n = this.getOppositeAnchor(t), h = this.getBoundingBox(), l = this.getCornerOffset(n, h);
5224
5269
  return this.x = a.x - l.x, this.y = a.y - l.y, !0;
5225
5270
  }
5226
5271
  /**
@@ -5252,71 +5297,71 @@ class Mt extends Q {
5252
5297
  width: e.transformData.width,
5253
5298
  height: e.transformData.height
5254
5299
  };
5255
- let o, s;
5300
+ let s, o;
5256
5301
  switch (t) {
5257
5302
  case "top-left":
5258
- o = i.x + i.width, s = i.y + i.height;
5303
+ s = i.x + i.width, o = i.y + i.height;
5259
5304
  break;
5260
5305
  case "top-right":
5261
- o = i.x, s = i.y + i.height;
5306
+ s = i.x, o = i.y + i.height;
5262
5307
  break;
5263
5308
  case "bottom-left":
5264
- o = i.x + i.width, s = i.y;
5309
+ s = i.x + i.width, o = i.y;
5265
5310
  break;
5266
5311
  case "bottom-right":
5267
- o = i.x, s = i.y;
5312
+ s = i.x, o = i.y;
5268
5313
  break;
5269
5314
  case "middle-left":
5270
- o = i.x + i.width, s = i.y + i.height / 2;
5315
+ s = i.x + i.width, o = i.y + i.height / 2;
5271
5316
  break;
5272
5317
  case "middle-right":
5273
- o = i.x, s = i.y + i.height / 2;
5318
+ s = i.x, o = i.y + i.height / 2;
5274
5319
  break;
5275
5320
  case "middle-top":
5276
- o = i.x + i.width / 2, s = i.y + i.height;
5321
+ s = i.x + i.width / 2, o = i.y + i.height;
5277
5322
  break;
5278
5323
  case "middle-bottom":
5279
- o = i.x + i.width / 2, s = i.y;
5324
+ s = i.x + i.width / 2, o = i.y;
5280
5325
  break;
5281
5326
  default:
5282
- o = i.x + i.width / 2, s = i.y + i.height / 2;
5327
+ s = i.x + i.width / 2, o = i.y + i.height / 2;
5283
5328
  }
5284
- return { x: o, y: s };
5329
+ return { x: s, y: o };
5285
5330
  }
5286
5331
  /**
5287
5332
  * Get the offset of a corner from the center
5288
5333
  */
5289
5334
  getCornerOffset(t, e) {
5290
- let i, o;
5335
+ let i, s;
5291
5336
  switch (t) {
5292
5337
  case "top-left":
5293
- i = -e.width / 2, o = -e.height / 2;
5338
+ i = -e.width / 2, s = -e.height / 2;
5294
5339
  break;
5295
5340
  case "top-right":
5296
- i = e.width / 2, o = -e.height / 2;
5341
+ i = e.width / 2, s = -e.height / 2;
5297
5342
  break;
5298
5343
  case "bottom-left":
5299
- i = -e.width / 2, o = e.height / 2;
5344
+ i = -e.width / 2, s = e.height / 2;
5300
5345
  break;
5301
5346
  case "bottom-right":
5302
- i = e.width / 2, o = e.height / 2;
5347
+ i = e.width / 2, s = e.height / 2;
5303
5348
  break;
5304
5349
  case "middle-left":
5305
- i = -e.width / 2, o = 0;
5350
+ i = -e.width / 2, s = 0;
5306
5351
  break;
5307
5352
  case "middle-right":
5308
- i = e.width / 2, o = 0;
5353
+ i = e.width / 2, s = 0;
5309
5354
  break;
5310
5355
  case "middle-top":
5311
- i = 0, o = -e.height / 2;
5356
+ i = 0, s = -e.height / 2;
5312
5357
  break;
5313
5358
  case "middle-bottom":
5314
- i = 0, o = e.height / 2;
5359
+ i = 0, s = e.height / 2;
5315
5360
  break;
5316
5361
  default:
5317
- i = 0, o = 0;
5362
+ i = 0, s = 0;
5318
5363
  }
5319
- return { x: i, y: o };
5364
+ return { x: i, y: s };
5320
5365
  }
5321
5366
  /**
5322
5367
  * Get enabled anchors - all 8 anchors for most shapes, only corners for circles/polygons
@@ -5338,7 +5383,7 @@ class Mt extends Q {
5338
5383
  * Clone this element
5339
5384
  */
5340
5385
  clone() {
5341
- return new Mt(this.toJSON());
5386
+ return new kt(this.toJSON());
5342
5387
  }
5343
5388
  /**
5344
5389
  * Serialize to JSON
@@ -5360,17 +5405,17 @@ class Mt extends Q {
5360
5405
  };
5361
5406
  }
5362
5407
  }
5363
- class Dt extends Q {
5408
+ class Et extends Q {
5364
5409
  constructor(t = {}) {
5365
- var e, i, o, s, a, n, h, l, c, g;
5410
+ var e, i, s, o, a, n, h, l, c, g;
5366
5411
  super(t), this.transformType = "path", this.transformData = {
5367
5412
  type: "path",
5368
5413
  points: ((e = t.transformData) == null ? void 0 : e.points) || [],
5369
5414
  closed: ((i = t.transformData) == null ? void 0 : i.closed) ?? !1,
5370
- width: ((o = t.transformData) == null ? void 0 : o.width) || 200,
5371
- height: ((s = t.transformData) == null ? void 0 : s.height) || 200,
5415
+ width: ((s = t.transformData) == null ? void 0 : s.width) || 200,
5416
+ height: ((o = t.transformData) == null ? void 0 : o.height) || 200,
5372
5417
  fillEnabled: ((a = t.transformData) == null ? void 0 : a.fillEnabled) ?? !1,
5373
- fillColor: ((n = t.transformData) == null ? void 0 : n.fillColor) || Xt(),
5418
+ fillColor: ((n = t.transformData) == null ? void 0 : n.fillColor) || Yt(),
5374
5419
  fillOpacity: ((h = t.transformData) == null ? void 0 : h.fillOpacity) ?? 1,
5375
5420
  strokeEnabled: ((l = t.transformData) == null ? void 0 : l.strokeEnabled) ?? !0,
5376
5421
  strokeColor: ((c = t.transformData) == null ? void 0 : c.strokeColor) || "#000000",
@@ -5416,11 +5461,11 @@ class Dt extends Q {
5416
5461
  * @param p3 End point
5417
5462
  * @param t Parameter from 0 to 1
5418
5463
  */
5419
- bezierPoint(t, e, i, o, s) {
5420
- const a = 1 - s, n = a * a, h = n * a, l = s * s, c = l * s;
5464
+ bezierPoint(t, e, i, s, o) {
5465
+ const a = 1 - o, n = a * a, h = n * a, l = o * o, c = l * o;
5421
5466
  return {
5422
- x: h * t.x + 3 * n * s * e.x + 3 * a * l * i.x + c * o.x,
5423
- y: h * t.y + 3 * n * s * e.y + 3 * a * l * i.y + c * o.y
5467
+ x: h * t.x + 3 * n * o * e.x + 3 * a * l * i.x + c * s.x,
5468
+ y: h * t.y + 3 * n * o * e.y + 3 * a * l * i.y + c * s.y
5424
5469
  };
5425
5470
  }
5426
5471
  /**
@@ -5432,14 +5477,14 @@ class Dt extends Q {
5432
5477
  const { points: t } = this.transformData;
5433
5478
  if (t.length === 0)
5434
5479
  return { x: 0, y: 0, width: 0, height: 0 };
5435
- let e = 1 / 0, i = 1 / 0, o = -1 / 0, s = -1 / 0;
5480
+ let e = 1 / 0, i = 1 / 0, s = -1 / 0, o = -1 / 0;
5436
5481
  for (let d = 0; d < t.length; d++) {
5437
5482
  const f = t[d], u = t[(d + 1) % t.length];
5438
5483
  if (d === t.length - 1 && !this.transformData.closed) {
5439
- e = Math.min(e, f.x), i = Math.min(i, f.y), o = Math.max(o, f.x), s = Math.max(s, f.y);
5484
+ e = Math.min(e, f.x), i = Math.min(i, f.y), s = Math.max(s, f.x), o = Math.max(o, f.y);
5440
5485
  break;
5441
5486
  }
5442
- if (e = Math.min(e, f.x), i = Math.min(i, f.y), o = Math.max(o, f.x), s = Math.max(s, f.y), f.handleOut || u.handleIn) {
5487
+ if (e = Math.min(e, f.x), i = Math.min(i, f.y), s = Math.max(s, f.x), o = Math.max(o, f.y), f.handleOut || u.handleIn) {
5443
5488
  const p = { x: f.x, y: f.y }, y = {
5444
5489
  x: f.x + (((h = f.handleOut) == null ? void 0 : h.x) || 0),
5445
5490
  y: f.y + (((l = f.handleOut) == null ? void 0 : l.y) || 0)
@@ -5447,9 +5492,9 @@ class Dt extends Q {
5447
5492
  x: u.x + (((c = u.handleIn) == null ? void 0 : c.x) || 0),
5448
5493
  y: u.y + (((g = u.handleIn) == null ? void 0 : g.y) || 0)
5449
5494
  }, S = { x: u.x, y: u.y }, b = 20;
5450
- for (let T = 0; T <= b; T++) {
5451
- const C = T / b, M = this.bezierPoint(p, y, w, S, C);
5452
- e = Math.min(e, M.x), i = Math.min(i, M.y), o = Math.max(o, M.x), s = Math.max(s, M.y);
5495
+ for (let v = 0; v <= b; v++) {
5496
+ const C = v / b, M = this.bezierPoint(p, y, w, S, C);
5497
+ e = Math.min(e, M.x), i = Math.min(i, M.y), s = Math.max(s, M.x), o = Math.max(o, M.y);
5453
5498
  }
5454
5499
  }
5455
5500
  }
@@ -5457,8 +5502,8 @@ class Dt extends Q {
5457
5502
  return {
5458
5503
  x: e - n,
5459
5504
  y: i - n,
5460
- width: o - e + a,
5461
- height: s - i + a
5505
+ width: s - e + a,
5506
+ height: o - i + a
5462
5507
  };
5463
5508
  }
5464
5509
  /**
@@ -5472,28 +5517,28 @@ class Dt extends Q {
5472
5517
  * Render the path
5473
5518
  */
5474
5519
  render(t, e = !1, i = !1) {
5475
- const { points: o, closed: s, fillEnabled: a, fillColor: n, fillOpacity: h, strokeEnabled: l, strokeColor: c, strokeWidth: g } = this.transformData;
5476
- if (o.length === 0)
5520
+ const { points: s, closed: o, fillEnabled: a, fillColor: n, fillOpacity: h, strokeEnabled: l, strokeColor: c, strokeWidth: g } = this.transformData;
5521
+ if (s.length === 0)
5477
5522
  return;
5478
5523
  t.save(), t.translate(this.x, this.y), t.rotate(I.toRadians(this.rotation));
5479
5524
  const d = this.calculatePathBounds(), f = d.x + d.width / 2, u = d.y + d.height / 2;
5480
- t.translate(-f, -u), t.beginPath(), this.renderPath(t), a && s && n && (t.fillStyle = n, t.globalAlpha = h ?? 1, t.fill()), l && c && g && (t.strokeStyle = c, t.lineWidth = g, t.lineCap = "round", t.lineJoin = "round", t.globalAlpha = 1, t.stroke()), t.restore();
5525
+ t.translate(-f, -u), t.beginPath(), this.renderPath(t), a && o && n && (t.fillStyle = n, t.globalAlpha = h ?? 1, t.fill()), l && c && g && (t.strokeStyle = c, t.lineWidth = g, t.lineCap = "round", t.lineJoin = "round", t.globalAlpha = 1, t.stroke()), t.restore();
5481
5526
  }
5482
5527
  /**
5483
5528
  * Render the path using Canvas API bezier curves
5484
5529
  */
5485
5530
  renderPath(t) {
5486
- var s, a, n, h;
5531
+ var o, a, n, h;
5487
5532
  const { points: e, closed: i } = this.transformData;
5488
5533
  if (e.length === 0) return;
5489
- const o = e[0];
5490
- t.moveTo(o.x, o.y);
5534
+ const s = e[0];
5535
+ t.moveTo(s.x, s.y);
5491
5536
  for (let l = 0; l < e.length; l++) {
5492
5537
  const c = e[l], g = e[(l + 1) % e.length];
5493
5538
  if (l === e.length - 1 && !i)
5494
5539
  break;
5495
5540
  if (c.handleOut || g.handleIn) {
5496
- const f = c.x + (((s = c.handleOut) == null ? void 0 : s.x) || 0), u = c.y + (((a = c.handleOut) == null ? void 0 : a.y) || 0), m = g.x + (((n = g.handleIn) == null ? void 0 : n.x) || 0), p = g.y + (((h = g.handleIn) == null ? void 0 : h.y) || 0);
5541
+ const f = c.x + (((o = c.handleOut) == null ? void 0 : o.x) || 0), u = c.y + (((a = c.handleOut) == null ? void 0 : a.y) || 0), m = g.x + (((n = g.handleIn) == null ? void 0 : n.x) || 0), p = g.y + (((h = g.handleIn) == null ? void 0 : h.y) || 0);
5497
5542
  t.bezierCurveTo(f, u, m, p, g.x, g.y);
5498
5543
  } else
5499
5544
  t.lineTo(g.x, g.y);
@@ -5503,11 +5548,11 @@ class Dt extends Q {
5503
5548
  /**
5504
5549
  * Handle resize - scale all points relative to center
5505
5550
  */
5506
- resize(t, e, i, o) {
5507
- const s = o.transformData.width, a = o.transformData.height;
5508
- if (s === 0 || a === 0)
5551
+ resize(t, e, i, s) {
5552
+ const o = s.transformData.width, a = s.transformData.height;
5553
+ if (o === 0 || a === 0)
5509
5554
  return !1;
5510
- const n = e / s, h = i / a, l = o.transformData.points;
5555
+ const n = e / o, h = i / a, l = s.transformData.points;
5511
5556
  let c = 1 / 0, g = 1 / 0, d = -1 / 0, f = -1 / 0;
5512
5557
  for (const b of l)
5513
5558
  c = Math.min(c, b.x), g = Math.min(g, b.y), d = Math.max(d, b.x), f = Math.max(f, b.y);
@@ -5518,8 +5563,8 @@ class Dt extends Q {
5518
5563
  y: m + (b.y - m) * h,
5519
5564
  handleIn: b.handleIn ? { x: b.handleIn.x * n, y: b.handleIn.y * h } : void 0,
5520
5565
  handleOut: b.handleOut ? { x: b.handleOut.x * n, y: b.handleOut.y * h } : void 0
5521
- })), this.transformData.width = e, this.transformData.height = i, this.rotation = o.rotation;
5522
- const p = this.getFixedCorner(t, o), y = this.getOppositeAnchor(t), w = this.getBoundingBox(), S = this.getCornerOffset(y, w);
5566
+ })), this.transformData.width = e, this.transformData.height = i, this.rotation = s.rotation;
5567
+ const p = this.getFixedCorner(t, s), y = this.getOppositeAnchor(t), w = this.getBoundingBox(), S = this.getCornerOffset(y, w);
5523
5568
  return this.x = p.x - S.x, this.y = p.y - S.y, !0;
5524
5569
  }
5525
5570
  /**
@@ -5551,71 +5596,71 @@ class Dt extends Q {
5551
5596
  width: e.transformData.width,
5552
5597
  height: e.transformData.height
5553
5598
  };
5554
- let o, s;
5599
+ let s, o;
5555
5600
  switch (t) {
5556
5601
  case "top-left":
5557
- o = i.x + i.width, s = i.y + i.height;
5602
+ s = i.x + i.width, o = i.y + i.height;
5558
5603
  break;
5559
5604
  case "top-right":
5560
- o = i.x, s = i.y + i.height;
5605
+ s = i.x, o = i.y + i.height;
5561
5606
  break;
5562
5607
  case "bottom-left":
5563
- o = i.x + i.width, s = i.y;
5608
+ s = i.x + i.width, o = i.y;
5564
5609
  break;
5565
5610
  case "bottom-right":
5566
- o = i.x, s = i.y;
5611
+ s = i.x, o = i.y;
5567
5612
  break;
5568
5613
  case "middle-left":
5569
- o = i.x + i.width, s = i.y + i.height / 2;
5614
+ s = i.x + i.width, o = i.y + i.height / 2;
5570
5615
  break;
5571
5616
  case "middle-right":
5572
- o = i.x, s = i.y + i.height / 2;
5617
+ s = i.x, o = i.y + i.height / 2;
5573
5618
  break;
5574
5619
  case "middle-top":
5575
- o = i.x + i.width / 2, s = i.y + i.height;
5620
+ s = i.x + i.width / 2, o = i.y + i.height;
5576
5621
  break;
5577
5622
  case "middle-bottom":
5578
- o = i.x + i.width / 2, s = i.y;
5623
+ s = i.x + i.width / 2, o = i.y;
5579
5624
  break;
5580
5625
  default:
5581
- o = i.x + i.width / 2, s = i.y + i.height / 2;
5626
+ s = i.x + i.width / 2, o = i.y + i.height / 2;
5582
5627
  }
5583
- return { x: o, y: s };
5628
+ return { x: s, y: o };
5584
5629
  }
5585
5630
  /**
5586
5631
  * Get the offset of a corner from the center
5587
5632
  */
5588
5633
  getCornerOffset(t, e) {
5589
- let i, o;
5634
+ let i, s;
5590
5635
  switch (t) {
5591
5636
  case "top-left":
5592
- i = -e.width / 2, o = -e.height / 2;
5637
+ i = -e.width / 2, s = -e.height / 2;
5593
5638
  break;
5594
5639
  case "top-right":
5595
- i = e.width / 2, o = -e.height / 2;
5640
+ i = e.width / 2, s = -e.height / 2;
5596
5641
  break;
5597
5642
  case "bottom-left":
5598
- i = -e.width / 2, o = e.height / 2;
5643
+ i = -e.width / 2, s = e.height / 2;
5599
5644
  break;
5600
5645
  case "bottom-right":
5601
- i = e.width / 2, o = e.height / 2;
5646
+ i = e.width / 2, s = e.height / 2;
5602
5647
  break;
5603
5648
  case "middle-left":
5604
- i = -e.width / 2, o = 0;
5649
+ i = -e.width / 2, s = 0;
5605
5650
  break;
5606
5651
  case "middle-right":
5607
- i = e.width / 2, o = 0;
5652
+ i = e.width / 2, s = 0;
5608
5653
  break;
5609
5654
  case "middle-top":
5610
- i = 0, o = -e.height / 2;
5655
+ i = 0, s = -e.height / 2;
5611
5656
  break;
5612
5657
  case "middle-bottom":
5613
- i = 0, o = e.height / 2;
5658
+ i = 0, s = e.height / 2;
5614
5659
  break;
5615
5660
  default:
5616
- i = 0, o = 0;
5661
+ i = 0, s = 0;
5617
5662
  }
5618
- return { x: i, y: o };
5663
+ return { x: i, y: s };
5619
5664
  }
5620
5665
  /**
5621
5666
  * Get enabled anchors - all 8 anchors for free resize
@@ -5636,7 +5681,7 @@ class Dt extends Q {
5636
5681
  * Clone this element
5637
5682
  */
5638
5683
  clone() {
5639
- return new Dt(this.toJSON());
5684
+ return new Et(this.toJSON());
5640
5685
  }
5641
5686
  /**
5642
5687
  * Serialize to JSON
@@ -5666,7 +5711,7 @@ class Dt extends Q {
5666
5711
  };
5667
5712
  }
5668
5713
  }
5669
- const Je = {
5714
+ const Qe = {
5670
5715
  circle: [
5671
5716
  {
5672
5717
  key: "reverse",
@@ -5679,7 +5724,7 @@ const Je = {
5679
5724
  {
5680
5725
  key: "archHeight",
5681
5726
  label: "Arch Height",
5682
- defaultInternalValue: _e.archHeight,
5727
+ defaultInternalValue: $e.archHeight,
5683
5728
  // Slider 0-100 maps to internal -1 to 1
5684
5729
  toSlider: (r) => (r + 1) / 2 * 100,
5685
5730
  fromSlider: (r) => r / 100 * 2 - 1,
@@ -5690,7 +5735,7 @@ const Je = {
5690
5735
  {
5691
5736
  key: "amplitude",
5692
5737
  label: "Wave Amplitude",
5693
- defaultInternalValue: st.amplitude,
5738
+ defaultInternalValue: ot.amplitude,
5694
5739
  // Slider 0-100 maps to internal -0.5 to 0.5 (-50% to +50%)
5695
5740
  toSlider: (r) => (r + 0.5) * 100,
5696
5741
  fromSlider: (r) => r / 100 - 0.5,
@@ -5699,7 +5744,7 @@ const Je = {
5699
5744
  {
5700
5745
  key: "frequency",
5701
5746
  label: "Wave Frequency",
5702
- defaultInternalValue: st.frequency,
5747
+ defaultInternalValue: ot.frequency,
5703
5748
  step: 5,
5704
5749
  // 5% steps for smoother control
5705
5750
  // Slider 0-100 maps to internal 1 to 5
@@ -5732,7 +5777,7 @@ const Je = {
5732
5777
  {
5733
5778
  key: "leanAmount",
5734
5779
  label: "Lean Amount",
5735
- defaultInternalValue: Ye.leanAmount,
5780
+ defaultInternalValue: Ve.leanAmount,
5736
5781
  // Slider 0-100 maps to internal -0.5 to 0.5
5737
5782
  // Display as -100% to 100%
5738
5783
  toSlider: (r) => (r + 0.5) * 100,
@@ -5744,7 +5789,7 @@ const Je = {
5744
5789
  {
5745
5790
  key: "ascendAngle",
5746
5791
  label: "Ascend Amount",
5747
- defaultInternalValue: Ne.ascendAngle,
5792
+ defaultInternalValue: Je.ascendAngle,
5748
5793
  // Slider 0-100 maps to internal angle +30° to -30°
5749
5794
  // Display: slider 0 = -100% (down), slider 50 = 0%, slider 100 = +100% (up)
5750
5795
  toSlider: (r) => (30 - r) / 60 * 100,
@@ -5820,19 +5865,19 @@ const Je = {
5820
5865
  toDisplay: (r) => `${(r * 100).toFixed(0)}%`
5821
5866
  }
5822
5867
  ]
5823
- }, Jt = [
5824
- { id: "custom", label: "CUSTOM", Component: He },
5868
+ }, Zt = [
5869
+ { id: "custom", label: "CUSTOM", Component: Xe },
5825
5870
  // NOTE: distort transform is not yet implemented. Removed from registry
5826
5871
  // to prevent it from appearing in UI that iterates over registered transforms.
5827
5872
  // Re-add with a valid Component when implementation is ready.
5828
- { id: "circle", label: "CIRCLE", Component: ze },
5829
- { id: "lean", label: "LEAN", Component: $e },
5830
- { id: "arch", label: "ARCH", Component: Xe },
5831
- { id: "ascend", label: "ASCEND", Component: Ve },
5832
- { id: "wave", label: "WAVE", Component: Ue },
5833
- { id: "flag", label: "FLAG", Component: Ge },
5834
- { id: "shape", label: "SHAPE", Component: Mt },
5835
- { id: "path", label: "PATH", Component: Dt },
5873
+ { id: "circle", label: "CIRCLE", Component: Ue },
5874
+ { id: "lean", label: "LEAN", Component: Ze },
5875
+ { id: "arch", label: "ARCH", Component: Ge },
5876
+ { id: "ascend", label: "ASCEND", Component: Ke },
5877
+ { id: "wave", label: "WAVE", Component: qe },
5878
+ { id: "flag", label: "FLAG", Component: je },
5879
+ { id: "shape", label: "SHAPE", Component: kt },
5880
+ { id: "path", label: "PATH", Component: Et },
5836
5881
  { id: "image", label: "IMAGE", Component: yt },
5837
5882
  // Use a getter to break circular dependency: GroupElement imports getTransformById
5838
5883
  // from this module, so GroupElement may be in the TDZ during module evaluation.
@@ -5840,9 +5885,9 @@ const Je = {
5840
5885
  { id: "group", label: "GROUP", get Component() {
5841
5886
  return mt;
5842
5887
  } }
5843
- ], qt = new Set(Jt.map((r) => r.id)), ut = /* @__PURE__ */ new Map();
5844
- function oo(r, t) {
5845
- if (qt.has(r))
5888
+ ], Kt = new Set(Zt.map((r) => r.id)), ut = /* @__PURE__ */ new Map();
5889
+ function ds(r, t) {
5890
+ if (Kt.has(r))
5846
5891
  throw new Error(
5847
5892
  `Cannot register transform type "${r}": conflicts with built-in type`
5848
5893
  );
@@ -5852,19 +5897,19 @@ function oo(r, t) {
5852
5897
  );
5853
5898
  ut.set(r, t);
5854
5899
  }
5855
- function so(r) {
5856
- if (qt.has(r))
5900
+ function gs(r) {
5901
+ if (Kt.has(r))
5857
5902
  throw new Error(
5858
5903
  `Cannot unregister transform type "${r}": built-in types cannot be removed`
5859
5904
  );
5860
5905
  return ut.delete(r);
5861
5906
  }
5862
- function qe(r) {
5863
- const t = Jt.find((e) => e.id === r);
5907
+ function ti(r) {
5908
+ const t = Zt.find((e) => e.id === r);
5864
5909
  return t || ut.get(r);
5865
5910
  }
5866
- function ro(r) {
5867
- return Je[r] || [];
5911
+ function fs(r) {
5912
+ return Qe[r] || [];
5868
5913
  }
5869
5914
  class mt extends Q {
5870
5915
  constructor(t = {}) {
@@ -5881,7 +5926,7 @@ class mt extends Q {
5881
5926
  */
5882
5927
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- JSON deserialization: config comes from toJSON() and constructors accept Partial<Config> with varying signatures
5883
5928
  _reconstructChildFromJSON(t) {
5884
- const e = t.transformType || t.type, i = qe(e);
5929
+ const e = t.transformType || t.type, i = ti(e);
5885
5930
  if (!i || !i.Component)
5886
5931
  throw new Error(`Unknown transform type: ${e}`);
5887
5932
  return new i.Component(t);
@@ -5893,17 +5938,17 @@ class mt extends Q {
5893
5938
  getBoundingBox() {
5894
5939
  if (this.children.length === 0)
5895
5940
  return { x: this.x - 50, y: this.y - 50, width: 100, height: 100 };
5896
- let t = 1 / 0, e = 1 / 0, i = -1 / 0, o = -1 / 0;
5897
- return this.children.forEach((s) => {
5898
- const a = s.getVisualBoundingBox();
5899
- this._getRotatedCorners(s, a).forEach((h) => {
5900
- t = Math.min(t, h.x), e = Math.min(e, h.y), i = Math.max(i, h.x), o = Math.max(o, h.y);
5941
+ let t = 1 / 0, e = 1 / 0, i = -1 / 0, s = -1 / 0;
5942
+ return this.children.forEach((o) => {
5943
+ const a = o.getVisualBoundingBox();
5944
+ this._getRotatedCorners(o, a).forEach((h) => {
5945
+ t = Math.min(t, h.x), e = Math.min(e, h.y), i = Math.max(i, h.x), s = Math.max(s, h.y);
5901
5946
  });
5902
5947
  }), {
5903
5948
  x: t,
5904
5949
  y: e,
5905
5950
  width: i - t,
5906
- height: o - e
5951
+ height: s - e
5907
5952
  };
5908
5953
  }
5909
5954
  /**
@@ -5927,7 +5972,7 @@ class mt extends Q {
5927
5972
  * Get the four corners of an element's bounding box in world space
5928
5973
  */
5929
5974
  _getRotatedCorners(t, e) {
5930
- const i = new P(t), o = e.x + e.width / 2, s = e.y + e.height / 2, a = o - t.x, n = s - t.y;
5975
+ const i = new P(t), s = e.x + e.width / 2, o = e.y + e.height / 2, a = s - t.x, n = o - t.y;
5931
5976
  return [
5932
5977
  { localX: a - e.width / 2, localY: n - e.height / 2 },
5933
5978
  { localX: a + e.width / 2, localY: n - e.height / 2 },
@@ -5967,8 +6012,8 @@ class mt extends Q {
5967
6012
  * Elements with isClipping=true clip all elements below them in the group
5968
6013
  */
5969
6014
  render(t, e = !1, i = !1) {
5970
- const o = this.children.filter((a) => a.visible !== !1);
5971
- o.some((a) => a.isClipping) ? Ae()(t, o) : o.forEach((a) => {
6015
+ const s = this.children.filter((a) => a.visible !== !1);
6016
+ s.some((a) => a.isClipping) ? Ee()(t, s) : s.forEach((a) => {
5972
6017
  a.render(t, !1);
5973
6018
  }), e ? this._renderGroupOutline(t, 1) : i && this._renderGroupOutline(t, 0.3);
5974
6019
  }
@@ -5978,9 +6023,9 @@ class mt extends Q {
5978
6023
  */
5979
6024
  _renderGroupOutline(t, e = 1) {
5980
6025
  const i = this.getOrientedBoundingBox();
5981
- t.save(), t.globalAlpha = e, t.strokeStyle = zt(), t.lineWidth = 2, t.setLineDash([5, 5]);
5982
- const o = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
5983
- this.rotation !== 0 && (t.translate(o, s), t.rotate(-this.rotation * Math.PI / 180), t.translate(-o, -s)), t.strokeRect(i.x, i.y, i.width, i.height), t.setLineDash([]), t.restore();
6026
+ t.save(), t.globalAlpha = e, t.strokeStyle = _t(), t.lineWidth = 2, t.setLineDash([5, 5]);
6027
+ const s = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
6028
+ this.rotation !== 0 && (t.translate(s, o), t.rotate(-this.rotation * Math.PI / 180), t.translate(-s, -o)), t.strokeRect(i.x, i.y, i.width, i.height), t.setLineDash([]), t.restore();
5984
6029
  }
5985
6030
  /**
5986
6031
  * Get oriented bounding box (uses cached base dimensions for stability during rotation)
@@ -5997,13 +6042,13 @@ class mt extends Q {
5997
6042
  if (this._baseBBoxWidth > 0 && this._baseBBoxHeight > 0)
5998
6043
  t = this._baseBBoxWidth, e = this._baseBBoxHeight;
5999
6044
  else {
6000
- const s = this.getBoundingBox();
6001
- t = s.width, e = s.height, this._baseBBoxWidth = t, this._baseBBoxHeight = e;
6045
+ const o = this.getBoundingBox();
6046
+ t = o.width, e = o.height, this._baseBBoxWidth = t, this._baseBBoxHeight = e;
6002
6047
  }
6003
- const i = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
6048
+ const i = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
6004
6049
  return {
6005
6050
  x: i - t / 2,
6006
- y: o - e / 2,
6051
+ y: s - e / 2,
6007
6052
  width: t,
6008
6053
  height: e
6009
6054
  };
@@ -6022,52 +6067,52 @@ class mt extends Q {
6022
6067
  setRotation(t) {
6023
6068
  const e = t - this.rotation;
6024
6069
  this.rotation = t;
6025
- const i = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
6026
- this.children.forEach((s) => {
6027
- const a = P.rotatePointAroundAnchor(s.x, s.y, i, o, e);
6028
- s.x = a.x, s.y = a.y, s.setRotation(s.rotation + e);
6029
- }), this.x = i, this.y = o;
6070
+ const i = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
6071
+ this.children.forEach((o) => {
6072
+ const a = P.rotatePointAroundAnchor(o.x, o.y, i, s, e);
6073
+ o.x = a.x, o.y = a.y, o.setRotation(o.rotation + e);
6074
+ }), this.x = i, this.y = s;
6030
6075
  }
6031
6076
  /**
6032
6077
  * Resize the group (scales all children proportionally)
6033
6078
  * Uses the same fixed-corner approach as multi-selection resize
6034
6079
  */
6035
- resize(t, e, i, o) {
6036
- if (!o.childrenStartData || !o.width || !o.height)
6080
+ resize(t, e, i, s) {
6081
+ if (!s.childrenStartData || !s.width || !s.height)
6037
6082
  return;
6038
- const s = e / o.width, a = i / o.height, n = (s + a) / 2;
6083
+ const o = e / s.width, a = i / s.height, n = (o + a) / 2;
6039
6084
  let h, l;
6040
6085
  switch (t) {
6041
6086
  case "top-left":
6042
- h = o.width / 2, l = o.height / 2;
6087
+ h = s.width / 2, l = s.height / 2;
6043
6088
  break;
6044
6089
  case "top-right":
6045
- h = -o.width / 2, l = o.height / 2;
6090
+ h = -s.width / 2, l = s.height / 2;
6046
6091
  break;
6047
6092
  case "bottom-left":
6048
- h = o.width / 2, l = -o.height / 2;
6093
+ h = s.width / 2, l = -s.height / 2;
6049
6094
  break;
6050
6095
  case "bottom-right":
6051
- h = -o.width / 2, l = -o.height / 2;
6096
+ h = -s.width / 2, l = -s.height / 2;
6052
6097
  break;
6053
6098
  default:
6054
6099
  h = 0, l = 0;
6055
6100
  }
6056
- const c = -o.rotation * Math.PI / 180, g = Math.cos(c), d = Math.sin(c), f = o.x + (h * g - l * d), u = o.y + (h * d + l * g);
6101
+ const c = -s.rotation * Math.PI / 180, g = Math.cos(c), d = Math.sin(c), f = s.x + (h * g - l * d), u = s.y + (h * d + l * g);
6057
6102
  this.children.forEach((y, w) => {
6058
- const S = o.childrenStartData[w], b = S.x - f, T = S.y - u, C = f + b * n, M = u + T * n;
6103
+ const S = s.childrenStartData[w], b = S.x - f, v = S.y - u, C = f + b * n, M = u + v * n;
6059
6104
  if (y.x = C, y.y = M, y instanceof yt) {
6060
- const F = S.transformData, v = F.width * n, D = F.height * n;
6061
- y.transformData.width = v, y.transformData.height = D;
6105
+ const F = S.transformData, T = F.width * n, D = F.height * n;
6106
+ y.transformData.width = T, y.transformData.height = D;
6062
6107
  } else if (y instanceof mt) {
6063
- const F = (S.width ?? 0) * n, v = (S.height ?? 0) * n;
6064
- y.resize(t, F, v, S);
6108
+ const F = (S.width ?? 0) * n, T = (S.height ?? 0) * n;
6109
+ y.resize(t, F, T, S);
6065
6110
  } else {
6066
- const F = (S.width ?? 0) * n, v = (S.height ?? 0) * n;
6067
- y.resize(t, F, v, S);
6111
+ const F = (S.width ?? 0) * n, T = (S.height ?? 0) * n;
6112
+ y.resize(t, F, T, S);
6068
6113
  }
6069
- }), this._baseBBoxWidth = o.width * n, this._baseBBoxHeight = o.height * n;
6070
- const m = o.x - f, p = o.y - u;
6114
+ }), this._baseBBoxWidth = s.width * n, this._baseBBoxHeight = s.height * n;
6115
+ const m = s.x - f, p = s.y - u;
6071
6116
  this.x = f + m * n, this.y = u + p * n, this._rotationCenterX = this.x, this._rotationCenterY = this.y;
6072
6117
  }
6073
6118
  /**
@@ -6075,16 +6120,16 @@ class mt extends Q {
6075
6120
  * Use cached base dimensions instead of axis-aligned bbox for consistency with visual border
6076
6121
  */
6077
6122
  getTransformStartData() {
6078
- const t = this._baseBBoxWidth > 0 ? this._baseBBoxWidth : this.getBoundingBox().width, e = this._baseBBoxHeight > 0 ? this._baseBBoxHeight : this.getBoundingBox().height, i = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
6123
+ const t = this._baseBBoxWidth > 0 ? this._baseBBoxWidth : this.getBoundingBox().width, e = this._baseBBoxHeight > 0 ? this._baseBBoxHeight : this.getBoundingBox().height, i = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
6079
6124
  return {
6080
6125
  id: this.id,
6081
6126
  x: i,
6082
- y: o,
6127
+ y: s,
6083
6128
  width: t,
6084
6129
  height: e,
6085
6130
  rotation: this.rotation,
6086
6131
  transformData: this.transformData,
6087
- childrenStartData: this.children.map((s) => s.getTransformStartData())
6132
+ childrenStartData: this.children.map((o) => o.getTransformStartData())
6088
6133
  };
6089
6134
  }
6090
6135
  /**
@@ -6092,10 +6137,10 @@ class mt extends Q {
6092
6137
  * This allows clicking anywhere within the selection border to drag the group
6093
6138
  */
6094
6139
  hitTest(t, e) {
6095
- const i = this.getOrientedBoundingBox(), o = this._rotationCenterX || this.x, s = this._rotationCenterY || this.y;
6140
+ const i = this.getOrientedBoundingBox(), s = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
6096
6141
  if (this.rotation === 0)
6097
6142
  return t >= i.x && t <= i.x + i.width && e >= i.y && e <= i.y + i.height;
6098
- const a = this.rotation * Math.PI / 180, n = Math.cos(a), h = Math.sin(a), l = t - o, c = e - s, g = o + (l * n - c * h), d = s + (l * h + c * n);
6143
+ const a = this.rotation * Math.PI / 180, n = Math.cos(a), h = Math.sin(a), l = t - s, c = e - o, g = s + (l * n - c * h), d = o + (l * h + c * n);
6099
6144
  return g >= i.x && g <= i.x + i.width && d >= i.y && d <= i.y + i.height;
6100
6145
  }
6101
6146
  /**
@@ -6162,9 +6207,9 @@ class mt extends Q {
6162
6207
  */
6163
6208
  hitTestChild(t, e) {
6164
6209
  for (let i = this.children.length - 1; i >= 0; i--) {
6165
- const o = this.children[i];
6166
- if (o.hitTest(t, e))
6167
- return o;
6210
+ const s = this.children[i];
6211
+ if (s.hitTest(t, e))
6212
+ return s;
6168
6213
  }
6169
6214
  return null;
6170
6215
  }
@@ -6209,8 +6254,8 @@ class Z {
6209
6254
  getAllByName(t) {
6210
6255
  const e = [];
6211
6256
  for (const i of this.order) {
6212
- const o = this.byId.get(i);
6213
- o && o.name === t && e.push(o);
6257
+ const s = this.byId.get(i);
6258
+ s && s.name === t && e.push(s);
6214
6259
  }
6215
6260
  return e;
6216
6261
  }
@@ -6231,8 +6276,8 @@ class Z {
6231
6276
  const i = this.clone();
6232
6277
  if (t !== e.id) {
6233
6278
  i.byId.delete(t);
6234
- const o = i.order.indexOf(t);
6235
- o !== -1 && (i.order[o] = e.id);
6279
+ const s = i.order.indexOf(t);
6280
+ s !== -1 && (i.order[s] = e.id);
6236
6281
  }
6237
6282
  return i.byId.set(e.id, e), i;
6238
6283
  }
@@ -6245,8 +6290,8 @@ class Z {
6245
6290
  insertAfter(t, e) {
6246
6291
  const i = this.clone();
6247
6292
  i.byId.set(t.id, t);
6248
- const o = i.order.indexOf(e);
6249
- return o !== -1 ? i.order.splice(o + 1, 0, t.id) : i.order.push(t.id), i;
6293
+ const s = i.order.indexOf(e);
6294
+ return s !== -1 ? i.order.splice(s + 1, 0, t.id) : i.order.push(t.id), i;
6250
6295
  }
6251
6296
  /** Remove an element by ID. */
6252
6297
  remove(t) {
@@ -6257,7 +6302,7 @@ class Z {
6257
6302
  /** Reorder element to a new index in the render order. */
6258
6303
  reorder(t, e) {
6259
6304
  const i = this.clone();
6260
- return i.order = i.order.filter((o) => o !== t), i.order.splice(e, 0, t), i;
6305
+ return i.order = i.order.filter((s) => s !== t), i.order.splice(e, 0, t), i;
6261
6306
  }
6262
6307
  /**
6263
6308
  * Apply a batch update: replace elements whose IDs match.
@@ -6311,15 +6356,15 @@ class Z {
6311
6356
  return t.byId = new Map(this.byId), t.order = [...this.order], t;
6312
6357
  }
6313
6358
  }
6314
- class no extends Error {
6359
+ class us extends Error {
6315
6360
  constructor(t, e, i = {}) {
6316
6361
  super(`[Editor] ${t}: ${e}`), this.name = "EditorError", this.code = t, this.data = { code: t, ...i };
6317
6362
  }
6318
6363
  }
6319
- function ao(r) {
6364
+ function ms(r) {
6320
6365
  return r instanceof Error && r.name === "EditorError" && "code" in r;
6321
6366
  }
6322
- function ho() {
6367
+ function ps() {
6323
6368
  var r;
6324
6369
  return typeof ft < "u" && ((r = ft.env) == null ? void 0 : r.NODE_ENV) !== "production";
6325
6370
  }
@@ -6337,9 +6382,9 @@ class $ {
6337
6382
  throw new Error("Command.undo() must be implemented");
6338
6383
  }
6339
6384
  }
6340
- class lo extends $ {
6341
- constructor(t, e, i, o) {
6342
- super(), this.elementId = t, this.oldElement = e ? e.clone() : null, this.newElement = i ? i.clone() : null, this.onUpdate = o;
6385
+ class ys extends $ {
6386
+ constructor(t, e, i, s) {
6387
+ super(), this.elementId = t, this.oldElement = e ? e.clone() : null, this.newElement = i ? i.clone() : null, this.onUpdate = s;
6343
6388
  }
6344
6389
  execute() {
6345
6390
  this.newElement && this.onUpdate(this.newElement);
@@ -6348,7 +6393,7 @@ class lo extends $ {
6348
6393
  this.oldElement && this.onUpdate(this.oldElement);
6349
6394
  }
6350
6395
  }
6351
- class co extends $ {
6396
+ class ws extends $ {
6352
6397
  constructor(t, e, i) {
6353
6398
  super(), this.element = t.clone(), this.onAdd = e, this.onRemove = i;
6354
6399
  }
@@ -6359,7 +6404,7 @@ class co extends $ {
6359
6404
  this.onRemove(this.element.id);
6360
6405
  }
6361
6406
  }
6362
- class go extends $ {
6407
+ class bs extends $ {
6363
6408
  constructor(t, e, i) {
6364
6409
  super(), this.element = t.clone(), this.onAdd = e, this.onRemove = i;
6365
6410
  }
@@ -6370,7 +6415,7 @@ class go extends $ {
6370
6415
  this.onAdd(this.element);
6371
6416
  }
6372
6417
  }
6373
- class je extends $ {
6418
+ class ei extends $ {
6374
6419
  constructor(t) {
6375
6420
  super(), this.commands = t;
6376
6421
  }
@@ -6402,7 +6447,7 @@ class ct {
6402
6447
  executeBatch(t) {
6403
6448
  if (t.length === 0)
6404
6449
  return;
6405
- const e = new je(t);
6450
+ const e = new ei(t);
6406
6451
  this.execute(e);
6407
6452
  }
6408
6453
  /**
@@ -6447,7 +6492,7 @@ class ct {
6447
6492
  };
6448
6493
  }
6449
6494
  }
6450
- class fo extends $ {
6495
+ class xs extends $ {
6451
6496
  constructor(t, e) {
6452
6497
  super(), this.artboard = t.clone(), this.artboardManager = e;
6453
6498
  }
@@ -6467,7 +6512,7 @@ class fo extends $ {
6467
6512
  this.artboardManager.deleteArtboard(this.artboard.id);
6468
6513
  }
6469
6514
  }
6470
- class uo extends $ {
6515
+ class Ss extends $ {
6471
6516
  constructor(t, e) {
6472
6517
  super(), this.artboard = t.clone(), this.artboardManager = e, this.elementsOnArtboard = t.getElementIds();
6473
6518
  }
@@ -6490,9 +6535,9 @@ class uo extends $ {
6490
6535
  });
6491
6536
  }
6492
6537
  }
6493
- class mo extends $ {
6494
- constructor(t, e, i, o) {
6495
- super(), this.artboardId = t, this.oldProperties = { ...e }, this.newProperties = { ...i }, this.artboardManager = o;
6538
+ class Cs extends $ {
6539
+ constructor(t, e, i, s) {
6540
+ super(), this.artboardId = t, this.oldProperties = { ...e }, this.newProperties = { ...i }, this.artboardManager = s;
6496
6541
  }
6497
6542
  execute() {
6498
6543
  this.artboardManager.updateArtboard(this.artboardId, this.newProperties);
@@ -6501,9 +6546,9 @@ class mo extends $ {
6501
6546
  this.artboardManager.updateArtboard(this.artboardId, this.oldProperties);
6502
6547
  }
6503
6548
  }
6504
- class po extends $ {
6505
- constructor(t, e, i, o, s) {
6506
- super(), this.draggedId = t, this.targetId = e, this.position = i, this.oldOrder = [...o], this.onReorder = s, this.newOrder = this.calculateNewOrder();
6549
+ class vs extends $ {
6550
+ constructor(t, e, i, s, o) {
6551
+ super(), this.draggedId = t, this.targetId = e, this.position = i, this.oldOrder = [...s], this.onReorder = o, this.newOrder = this.calculateNewOrder();
6507
6552
  }
6508
6553
  calculateNewOrder() {
6509
6554
  const t = [...this.oldOrder], e = t.indexOf(this.draggedId);
@@ -6511,8 +6556,8 @@ class po extends $ {
6511
6556
  t.splice(e, 1);
6512
6557
  const i = t.indexOf(this.targetId);
6513
6558
  if (i === -1) return t;
6514
- const o = this.position === "before" ? i : i + 1;
6515
- return t.splice(o, 0, this.draggedId), t;
6559
+ const s = this.position === "before" ? i : i + 1;
6560
+ return t.splice(s, 0, this.draggedId), t;
6516
6561
  }
6517
6562
  execute() {
6518
6563
  this.onReorder(this.newOrder);
@@ -6521,8 +6566,8 @@ class po extends $ {
6521
6566
  this.onReorder(this.oldOrder);
6522
6567
  }
6523
6568
  }
6524
- const Ze = pt("HybridHistoryManager");
6525
- class yo {
6569
+ const ii = pt("HybridHistoryManager");
6570
+ class Ts {
6526
6571
  constructor(t, e = 50) {
6527
6572
  this.commandExecutedCallbacks = [], this.globalHistory = new ct(e), this.artboardHistories = /* @__PURE__ */ new Map(), this.lastOperation = null, this.artboardManager = t, this.maxHistorySize = e;
6528
6573
  }
@@ -6540,11 +6585,11 @@ class yo {
6540
6585
  * Notify all callbacks that a command was executed
6541
6586
  */
6542
6587
  notifyCommandExecuted(t, e, i) {
6543
- for (const o of this.commandExecutedCallbacks)
6588
+ for (const s of this.commandExecutedCallbacks)
6544
6589
  try {
6545
- o(t, e, i);
6546
- } catch (s) {
6547
- Ze.error("Error in command executed callback:", s);
6590
+ s(t, e, i);
6591
+ } catch (o) {
6592
+ ii.error("Error in command executed callback:", o);
6548
6593
  }
6549
6594
  }
6550
6595
  /**
@@ -6583,8 +6628,8 @@ class yo {
6583
6628
  artboardId: t,
6584
6629
  timestamp: Date.now()
6585
6630
  };
6586
- const o = i.history[i.currentIndex];
6587
- this.notifyCommandExecuted(o, "artboard", t);
6631
+ const s = i.history[i.currentIndex];
6632
+ this.notifyCommandExecuted(s, "artboard", t);
6588
6633
  }
6589
6634
  /**
6590
6635
  * Execute a command on a specific artboard
@@ -6750,12 +6795,12 @@ class yo {
6750
6795
  */
6751
6796
  getState() {
6752
6797
  const t = this.globalHistory.getState(), e = /* @__PURE__ */ new Map();
6753
- return this.artboardHistories.forEach((i, o) => {
6754
- const s = i.getState();
6755
- e.set(o, {
6756
- canUndo: s.canUndo,
6757
- canRedo: s.canRedo,
6758
- historySize: s.historySize
6798
+ return this.artboardHistories.forEach((i, s) => {
6799
+ const o = i.getState();
6800
+ e.set(s, {
6801
+ canUndo: o.canUndo,
6802
+ canRedo: o.canRedo,
6803
+ historySize: o.historySize
6759
6804
  });
6760
6805
  }), {
6761
6806
  global: {
@@ -6817,11 +6862,11 @@ class yo {
6817
6862
  }
6818
6863
  }
6819
6864
  const G = pt("FontAnalyzer");
6820
- let xt = null;
6821
- async function Ke() {
6822
- return xt || (xt = await import("./browser-module-DFvKXBUE.js")), xt;
6865
+ let St = null;
6866
+ async function si() {
6867
+ return St || (St = await import("./browser-module-DFvKXBUE.js")), St;
6823
6868
  }
6824
- class Qe {
6869
+ class oi {
6825
6870
  constructor() {
6826
6871
  this.fontCache = /* @__PURE__ */ new Map(), this.failedFonts = /* @__PURE__ */ new Set(), this.CACHE_DURATION = 1e3 * 60 * 30, this.MAX_CACHE_SIZE = 5;
6827
6872
  }
@@ -6833,15 +6878,15 @@ class Qe {
6833
6878
  evictOldestFont() {
6834
6879
  if (this.fontCache.size <= this.MAX_CACHE_SIZE) return;
6835
6880
  let t = null, e = Date.now();
6836
- this.fontCache.forEach((i, o) => {
6837
- i.timestamp < e && (e = i.timestamp, t = o);
6881
+ this.fontCache.forEach((i, s) => {
6882
+ i.timestamp < e && (e = i.timestamp, t = s);
6838
6883
  }), t && this.fontCache.delete(t);
6839
6884
  }
6840
6885
  /**
6841
6886
  * Check if a font is a system font
6842
6887
  */
6843
6888
  isSystemFont(t) {
6844
- return we.has(t);
6889
+ return Se.has(t);
6845
6890
  }
6846
6891
  /**
6847
6892
  * Get Google Fonts API URL for a specific font family
@@ -6854,7 +6899,7 @@ class Qe {
6854
6899
  */
6855
6900
  async extractFontFileUrl(t, e = 400) {
6856
6901
  try {
6857
- const i = this.getGoogleFontUrl(t, e), s = await (await fetch(i)).text(), a = /@font-face\s*{([^}]*)}/g, n = Array.from(s.matchAll(a));
6902
+ const i = this.getGoogleFontUrl(t, e), o = await (await fetch(i)).text(), a = /@font-face\s*{([^}]*)}/g, n = Array.from(o.matchAll(a));
6858
6903
  if (n.length === 0)
6859
6904
  return G.warn("No @font-face found in CSS"), null;
6860
6905
  let h = null, l = -1;
@@ -6879,24 +6924,24 @@ class Qe {
6879
6924
  const i = `${t}-${e}`;
6880
6925
  if (this.failedFonts.has(i))
6881
6926
  return null;
6882
- const o = this.fontCache.get(i);
6883
- if (o && Date.now() - o.timestamp < this.CACHE_DURATION)
6884
- return o.timestamp = Date.now(), o.font;
6927
+ const s = this.fontCache.get(i);
6928
+ if (s && Date.now() - s.timestamp < this.CACHE_DURATION)
6929
+ return s.timestamp = Date.now(), s.font;
6885
6930
  try {
6886
- const s = await this.extractFontFileUrl(t, e);
6887
- if (!s)
6931
+ const o = await this.extractFontFileUrl(t, e);
6932
+ if (!o)
6888
6933
  return this.failedFonts.add(i), null;
6889
- const a = await fetch(s);
6934
+ const a = await fetch(o);
6890
6935
  if (!a.ok)
6891
6936
  return G.error(`Font fetch failed: ${a.status} ${a.statusText}`), this.failedFonts.add(i), null;
6892
- const n = await a.arrayBuffer(), h = new Uint8Array(n), c = (await Ke()).create(h), g = "fonts" in c ? c.fonts[0] : c;
6937
+ const n = await a.arrayBuffer(), h = new Uint8Array(n), c = (await si()).create(h), g = "fonts" in c ? c.fonts[0] : c;
6893
6938
  return this.fontCache.set(i, {
6894
6939
  font: g,
6895
- url: s,
6940
+ url: o,
6896
6941
  timestamp: Date.now()
6897
6942
  }), this.evictOldestFont(), g;
6898
- } catch (s) {
6899
- return G.error(`Error loading font ${t}:`, s), this.failedFonts.add(i), null;
6943
+ } catch (o) {
6944
+ return G.error(`Error loading font ${t}:`, o), this.failedFonts.add(i), null;
6900
6945
  }
6901
6946
  }
6902
6947
  /**
@@ -6904,8 +6949,8 @@ class Qe {
6904
6949
  * Returns null if font is not cached - font should be pre-loaded before rendering
6905
6950
  */
6906
6951
  getFontSync(t, e = 400) {
6907
- const i = `${t}-${e}`, o = this.fontCache.get(i);
6908
- return o && Date.now() - o.timestamp < this.CACHE_DURATION ? (o.timestamp = Date.now(), o.font) : null;
6952
+ const i = `${t}-${e}`, s = this.fontCache.get(i);
6953
+ return s && Date.now() - s.timestamp < this.CACHE_DURATION ? (s.timestamp = Date.now(), s.font) : null;
6909
6954
  }
6910
6955
  /**
6911
6956
  * Clear font cache (useful for debugging or forcing reload)
@@ -6925,13 +6970,13 @@ class Qe {
6925
6970
  var n, h;
6926
6971
  if (this.isSystemFont(t))
6927
6972
  return [];
6928
- const o = await this.loadFont(t, e);
6929
- if (!o)
6973
+ const s = await this.loadFont(t, e);
6974
+ if (!s)
6930
6975
  return [];
6931
- const s = [], a = Math.min(o.numGlyphs, i);
6976
+ const o = [], a = Math.min(s.numGlyphs, i);
6932
6977
  for (let l = 0; l < a; l++)
6933
6978
  try {
6934
- const c = o.getGlyph(l);
6979
+ const c = s.getGlyph(l);
6935
6980
  if (!c || !c.name || c.name === ".notdef" || c.name.startsWith(".null"))
6936
6981
  continue;
6937
6982
  const g = c.codePoints || [];
@@ -6956,42 +7001,42 @@ class Qe {
6956
7001
  const m = c.name.toLowerCase();
6957
7002
  if (m.includes("swash") || m.includes("cswh") ? u = "swash" : c.name.match(/\.(alt|ss\d+|cv\d+|salt|ornament)/) || c.name.match(/_\d+$/) ? u = "stylistic" : m.match(/liga|dlig/) && (u = "ligature"), u === "default")
6958
7003
  continue;
6959
- d && d.length > 0 && s.push({
7004
+ d && d.length > 0 && o.push({
6960
7005
  glyphIndex: c.id,
6961
7006
  unicode: d,
6962
7007
  name: f,
6963
7008
  category: u,
6964
- previewDataUrl: this.generateGlyphPreview(o, c.id, 80)
7009
+ previewDataUrl: this.generateGlyphPreview(s, c.id, 80)
6965
7010
  });
6966
7011
  } catch {
6967
7012
  }
6968
- return s;
7013
+ return o;
6969
7014
  }
6970
7015
  /**
6971
7016
  * Get glyph alternates for a specific character
6972
7017
  */
6973
7018
  async getGlyphAlternates(t, e, i = 400) {
6974
7019
  var l, c, g, d;
6975
- const o = await this.loadFont(t, i);
6976
- if (!o)
7020
+ const s = await this.loadFont(t, i);
7021
+ if (!s)
6977
7022
  return [];
6978
- const s = [], a = e.codePointAt(0);
7023
+ const o = [], a = e.codePointAt(0);
6979
7024
  if (a === void 0)
6980
7025
  return [];
6981
- const n = o.glyphForCodePoint(a);
6982
- n && s.push({
7026
+ const n = s.glyphForCodePoint(a);
7027
+ n && o.push({
6983
7028
  glyphIndex: n.id,
6984
7029
  unicode: e,
6985
7030
  name: n.name || "Default",
6986
7031
  category: "default",
6987
- previewDataUrl: this.generateGlyphPreview(o, n.id, 80)
7032
+ previewDataUrl: this.generateGlyphPreview(s, n.id, 80)
6988
7033
  });
6989
7034
  const h = n == null ? void 0 : n.name;
6990
7035
  if (h) {
6991
7036
  let f = 0;
6992
- for (let u = 0; u < o.numGlyphs; u++)
7037
+ for (let u = 0; u < s.numGlyphs; u++)
6993
7038
  try {
6994
- const m = o.getGlyph(u);
7039
+ const m = s.getGlyph(u);
6995
7040
  if (!m || !m.name) continue;
6996
7041
  if ([
6997
7042
  new RegExp(`^${h}\\.(swash|alt|ss\\d+|salt|ornament)`, "i"),
@@ -7009,19 +7054,19 @@ class Qe {
7009
7054
  const S = (c = m.name.match(/\.ss(\d+)/)) == null ? void 0 : c[1];
7010
7055
  w = `${e} Stylistic Set ${S}`;
7011
7056
  }
7012
- s.push({
7057
+ o.push({
7013
7058
  glyphIndex: m.id,
7014
7059
  unicode: e,
7015
7060
  name: w,
7016
7061
  category: "stylistic",
7017
- previewDataUrl: this.generateGlyphPreview(o, m.id, 80)
7062
+ previewDataUrl: this.generateGlyphPreview(s, m.id, 80)
7018
7063
  });
7019
7064
  }
7020
7065
  } catch {
7021
7066
  }
7022
7067
  }
7023
- if (o.GSUB) {
7024
- const f = o.GSUB;
7068
+ if (s.GSUB) {
7069
+ const f = s.GSUB;
7025
7070
  if (f.featureList)
7026
7071
  for (const u of f.featureList) {
7027
7072
  const m = u.tag;
@@ -7034,13 +7079,13 @@ class Qe {
7034
7079
  const S = w.coverage;
7035
7080
  if (!S) continue;
7036
7081
  if (this.getCoverageIndex(S, n.id) !== -1) {
7037
- const T = this.getSubstituteGlyph(w, n.id);
7038
- T !== null && s.push({
7039
- glyphIndex: T,
7082
+ const v = this.getSubstituteGlyph(w, n.id);
7083
+ v !== null && o.push({
7084
+ glyphIndex: v,
7040
7085
  unicode: e,
7041
7086
  name: `${e} (${m})`,
7042
7087
  category: this.categorizeFeature(m),
7043
- previewDataUrl: this.generateGlyphPreview(o, T, 80)
7088
+ previewDataUrl: this.generateGlyphPreview(s, v, 80)
7044
7089
  });
7045
7090
  }
7046
7091
  }
@@ -7048,17 +7093,17 @@ class Qe {
7048
7093
  for (const w of y.subtables || []) {
7049
7094
  const S = w.coverage;
7050
7095
  if (!S) continue;
7051
- const b = this.getCoverageIndex(S, n.id), T = w;
7052
- if (b !== -1 && T.alternateSets) {
7053
- const C = T.alternateSets[b];
7096
+ const b = this.getCoverageIndex(S, n.id), v = w;
7097
+ if (b !== -1 && v.alternateSets) {
7098
+ const C = v.alternateSets[b];
7054
7099
  if (C)
7055
7100
  for (const M of C)
7056
- s.push({
7101
+ o.push({
7057
7102
  glyphIndex: M,
7058
7103
  unicode: e,
7059
7104
  name: `${e} (${m} alt)`,
7060
7105
  category: this.categorizeFeature(m),
7061
- previewDataUrl: this.generateGlyphPreview(o, M, 80)
7106
+ previewDataUrl: this.generateGlyphPreview(s, M, 80)
7062
7107
  });
7063
7108
  }
7064
7109
  }
@@ -7066,7 +7111,7 @@ class Qe {
7066
7111
  }
7067
7112
  }
7068
7113
  }
7069
- return s;
7114
+ return o;
7070
7115
  }
7071
7116
  /**
7072
7117
  * Get available OpenType features for a font
@@ -7076,38 +7121,38 @@ class Qe {
7076
7121
  if (!i)
7077
7122
  return G.warn(`Font ${t} failed to load`), [];
7078
7123
  try {
7079
- const o = [];
7124
+ const s = [];
7080
7125
  if (i.GSUB && i.GSUB.featureList) {
7081
- const s = /* @__PURE__ */ new Set();
7126
+ const o = /* @__PURE__ */ new Set();
7082
7127
  for (const a of i.GSUB.featureList)
7083
- a.tag && s.add(a.tag);
7084
- o.push(...Array.from(s));
7128
+ a.tag && o.add(a.tag);
7129
+ s.push(...Array.from(o));
7085
7130
  }
7086
7131
  if (i.GPOS && i.GPOS.featureList) {
7087
- const s = /* @__PURE__ */ new Set();
7132
+ const o = /* @__PURE__ */ new Set();
7088
7133
  for (const a of i.GPOS.featureList)
7089
- a.tag && s.add(a.tag);
7090
- o.push(...Array.from(s));
7134
+ a.tag && o.add(a.tag);
7135
+ s.push(...Array.from(o));
7091
7136
  }
7092
- return o;
7093
- } catch (o) {
7094
- return G.error(`Error getting features for ${t}:`, o), [];
7137
+ return s;
7138
+ } catch (s) {
7139
+ return G.error(`Error getting features for ${t}:`, s), [];
7095
7140
  }
7096
7141
  }
7097
7142
  /**
7098
7143
  * Generate a preview image for a glyph
7099
7144
  */
7100
7145
  generateGlyphPreview(t, e, i = 80) {
7101
- const o = document.createElement("canvas");
7102
- o.width = i, o.height = i;
7103
- const s = o.getContext("2d");
7104
- if (!s)
7146
+ const s = document.createElement("canvas");
7147
+ s.width = i, s.height = i;
7148
+ const o = s.getContext("2d");
7149
+ if (!o)
7105
7150
  return "";
7106
7151
  try {
7107
7152
  const a = t.getGlyph(e);
7108
7153
  if (!a)
7109
7154
  return "";
7110
- s.clearRect(0, 0, i, i);
7155
+ o.clearRect(0, 0, i, i);
7111
7156
  const n = a.bbox;
7112
7157
  if (!n)
7113
7158
  return "";
@@ -7118,7 +7163,7 @@ class Qe {
7118
7163
  if (!p)
7119
7164
  return "";
7120
7165
  const y = new Path2D(p);
7121
- return s.save(), s.translate(u, m), s.scale(g, -g), s.translate(-d, -f), s.fillStyle = "#000000", s.fill(y), s.restore(), o.toDataURL("image/png");
7166
+ return o.save(), o.translate(u, m), o.scale(g, -g), o.translate(-d, -f), o.fillStyle = "#000000", o.fill(y), o.restore(), s.toDataURL("image/png");
7122
7167
  } catch (a) {
7123
7168
  return G.error("Error generating glyph preview:", a), "";
7124
7169
  }
@@ -7181,10 +7226,10 @@ class Qe {
7181
7226
  return t.glyphs.indexOf(e);
7182
7227
  if (t.format === 2 && t.ranges) {
7183
7228
  const i = t.ranges;
7184
- for (let o = 0; o < i.length; o++) {
7185
- const s = i[o];
7186
- if (e >= s.start && e <= s.end)
7187
- return s.index + (e - s.start);
7229
+ for (let s = 0; s < i.length; s++) {
7230
+ const o = i[s];
7231
+ if (e >= o.start && e <= o.end)
7232
+ return o.index + (e - o.start);
7188
7233
  }
7189
7234
  }
7190
7235
  return -1;
@@ -7197,9 +7242,9 @@ class Qe {
7197
7242
  if (t.substFormat === 1 && typeof t.deltaGlyphId == "number")
7198
7243
  return e + t.deltaGlyphId;
7199
7244
  if (t.substFormat === 2 && t.substitute) {
7200
- const i = this.getCoverageIndex(t.coverage, e), o = t.substitute;
7201
- if (i !== -1 && o[i] !== void 0)
7202
- return o[i];
7245
+ const i = this.getCoverageIndex(t.coverage, e), s = t.substitute;
7246
+ if (i !== -1 && s[i] !== void 0)
7247
+ return s[i];
7203
7248
  }
7204
7249
  return null;
7205
7250
  }
@@ -7210,9 +7255,9 @@ class Qe {
7210
7255
  const i = await this.loadFont(t, e);
7211
7256
  if (!i)
7212
7257
  return 0;
7213
- let o = 0;
7214
- const s = Math.min(i.numGlyphs, 1500);
7215
- for (let a = 0; a < s; a++)
7258
+ let s = 0;
7259
+ const o = Math.min(i.numGlyphs, 1500);
7260
+ for (let a = 0; a < o; a++)
7216
7261
  try {
7217
7262
  const n = i.getGlyph(a);
7218
7263
  if (!n || !n.name || n.name === ".notdef" || n.name.startsWith(".null"))
@@ -7225,10 +7270,10 @@ class Qe {
7225
7270
  }
7226
7271
  let c = "default";
7227
7272
  const g = n.name.toLowerCase();
7228
- g.includes("swash") || g.includes("cswh") ? c = "swash" : n.name.match(/\.(alt|ss\d+|cv\d+|salt|ornament)/) || n.name.match(/_\d+$/) ? c = "stylistic" : g.match(/liga|dlig/) && (c = "ligature"), c !== "default" && l && l.length > 0 && o++;
7273
+ g.includes("swash") || g.includes("cswh") ? c = "swash" : n.name.match(/\.(alt|ss\d+|cv\d+|salt|ornament)/) || n.name.match(/_\d+$/) ? c = "stylistic" : g.match(/liga|dlig/) && (c = "ligature"), c !== "default" && l && l.length > 0 && s++;
7229
7274
  } catch {
7230
7275
  }
7231
- return o;
7276
+ return s;
7232
7277
  }
7233
7278
  /**
7234
7279
  * Get cache statistics
@@ -7240,129 +7285,134 @@ class Qe {
7240
7285
  };
7241
7286
  }
7242
7287
  }
7243
- const wo = new Qe();
7288
+ const Fs = new oi();
7244
7289
  export {
7245
- qi as $,
7290
+ ve as $,
7246
7291
  nt as A,
7247
7292
  Q as B,
7248
- wo as C,
7249
- ho as D,
7250
- no as E,
7251
- Ti as F,
7293
+ Fs as C,
7294
+ ps as D,
7295
+ us as E,
7296
+ Di as F,
7252
7297
  mt as G,
7253
- he as H,
7298
+ de as H,
7254
7299
  yt as I,
7255
- Xe as J,
7256
- ti as K,
7257
- Ve as L,
7258
- ze as M,
7259
- He as N,
7260
- Z as O,
7261
- Dt as P,
7262
- Ge as Q,
7300
+ De as J,
7301
+ Dt as K,
7302
+ Ei as L,
7303
+ Oi as M,
7304
+ Ge as N,
7305
+ ri as O,
7306
+ Et as P,
7307
+ Ke as Q,
7263
7308
  L as R,
7264
- Mt as S,
7309
+ kt as S,
7265
7310
  q as T,
7266
- lo as U,
7267
- yo as V,
7268
- $e as W,
7269
- xe as X,
7270
- Ue as Y,
7271
- Pe as Z,
7272
- ji as _,
7273
- Ui as a,
7274
- Jt as a$,
7275
- Zi as a0,
7276
- Ki as a1,
7277
- Te as a2,
7278
- Oe as a3,
7279
- Ee as a4,
7280
- at as a5,
7281
- Bt as a6,
7282
- Ft as a7,
7283
- Rt as a8,
7284
- _t as a9,
7285
- I as aA,
7286
- P as aB,
7287
- Si as aC,
7288
- io as aD,
7289
- ge as aE,
7290
- oi as aF,
7291
- ci as aG,
7292
- to as aH,
7293
- fe as aI,
7294
- Qi as aJ,
7295
- Le as aK,
7296
- eo as aL,
7297
- wi as aM,
7298
- hi as aN,
7299
- li as aO,
7300
- ai as aP,
7301
- de as aQ,
7302
- ni as aR,
7303
- ri as aS,
7304
- ii as aT,
7305
- xi as aU,
7306
- bi as aV,
7307
- si as aW,
7308
- pi as aX,
7309
- yi as aY,
7310
- ui as aZ,
7311
- ei as a_,
7312
- Ji as aa,
7313
- j as ab,
7314
- wt as ac,
7315
- Vi as ad,
7316
- be as ae,
7317
- Fi as af,
7318
- Ai as ag,
7319
- J as ah,
7320
- co as ai,
7321
- go as aj,
7322
- fo as ak,
7323
- uo as al,
7324
- mo as am,
7325
- po as an,
7326
- pe as ao,
7327
- ye as ap,
7328
- mi as aq,
7329
- _e as ar,
7330
- st as as,
7331
- vi as at,
7332
- At as au,
7333
- Xt as av,
7334
- di as aw,
7335
- zt as ax,
7336
- gi as ay,
7337
- fi as az,
7338
- Ni as b,
7339
- ro as b0,
7340
- Ci as b1,
7341
- Ye as b2,
7342
- rt as b3,
7311
+ ys as U,
7312
+ Ue as V,
7313
+ Xe as W,
7314
+ Z as X,
7315
+ je as Y,
7316
+ Ts as Z,
7317
+ Ze as _,
7318
+ Ki as a,
7319
+ Si as a$,
7320
+ qe as a0,
7321
+ Ne as a1,
7322
+ os as a2,
7323
+ ss as a3,
7324
+ rs as a4,
7325
+ ns as a5,
7326
+ Ae as a6,
7327
+ Le as a7,
7328
+ Pe as a8,
7329
+ at as a9,
7330
+ pi as aA,
7331
+ _t as aB,
7332
+ yi as aC,
7333
+ wi as aD,
7334
+ I as aE,
7335
+ P as aF,
7336
+ Ai as aG,
7337
+ cs as aH,
7338
+ me as aI,
7339
+ hi as aJ,
7340
+ mi as aK,
7341
+ hs as aL,
7342
+ pe as aM,
7343
+ as as aN,
7344
+ _e as aO,
7345
+ ls as aP,
7346
+ vi as aQ,
7347
+ fi as aR,
7348
+ ui as aS,
7349
+ gi as aT,
7350
+ ue as aU,
7351
+ di as aV,
7352
+ ci as aW,
7353
+ ai as aX,
7354
+ Fi as aY,
7355
+ Ti as aZ,
7356
+ li as a_,
7357
+ Pt as aa,
7358
+ Mt as ab,
7359
+ Lt as ac,
7360
+ Ut as ad,
7361
+ is as ae,
7362
+ j as af,
7363
+ wt as ag,
7364
+ es as ah,
7365
+ Ce as ai,
7366
+ Bi as aj,
7367
+ Ri as ak,
7368
+ J as al,
7369
+ ws as am,
7370
+ bs as an,
7371
+ xs as ao,
7372
+ Ss as ap,
7373
+ Cs as aq,
7374
+ vs as ar,
7375
+ be as as,
7376
+ xe as at,
7377
+ xi as au,
7378
+ $e as av,
7379
+ ot as aw,
7380
+ Ii as ax,
7381
+ It as ay,
7382
+ Yt as az,
7383
+ Zi as b,
7384
+ Ci as b0,
7385
+ bi as b1,
7386
+ ni as b2,
7387
+ Zt as b3,
7388
+ fs as b4,
7389
+ Mi as b5,
7390
+ Ve as b6,
7391
+ rt as b7,
7392
+ ki as b8,
7343
7393
  pt as c,
7344
- Li as d,
7345
- Di as e,
7346
- Pi as f,
7347
- qe as g,
7348
- $i as h,
7349
- Ii as i,
7350
- Mi as j,
7351
- Ei as k,
7352
- Wi as l,
7353
- Bi as m,
7354
- Hi as n,
7355
- Oi as o,
7356
- Gi as p,
7357
- Xi as q,
7358
- oo as r,
7359
- Yi as s,
7360
- zi as t,
7361
- so as u,
7362
- _i as v,
7363
- Ri as w,
7364
- ki as x,
7365
- ao as y,
7394
+ Gi as d,
7395
+ Pi as e,
7396
+ Ui as f,
7397
+ ti as g,
7398
+ ts as h,
7399
+ Li as i,
7400
+ Hi as j,
7401
+ zi as k,
7402
+ $i as l,
7403
+ Ni as m,
7404
+ Yi as n,
7405
+ Xi as o,
7406
+ Qi as p,
7407
+ Ji as q,
7408
+ ds as r,
7409
+ ji as s,
7410
+ Vi as t,
7411
+ gs as u,
7412
+ qi as v,
7413
+ _i as w,
7414
+ Wi as x,
7415
+ ms as y,
7366
7416
  ft as z
7367
7417
  };
7368
- //# sourceMappingURL=FontAnalyzer-DKG5JK0x.js.map
7418
+ //# sourceMappingURL=FontAnalyzer-BYhwxDhe.js.map