@snowcone-app/canvas 0.29.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 (92) hide show
  1. package/ERROR_CONTRACT.md +13 -0
  2. package/STYLING_CONTRACT.md +2 -2
  3. package/dist/{CanvasRenderer-_lFoIoz5.js → CanvasRenderer-hpJ05JGO.js} +4 -4
  4. package/dist/{CanvasRenderer-_lFoIoz5.js.map → CanvasRenderer-hpJ05JGO.js.map} +1 -1
  5. package/dist/{CanvasStateV1-BMxr6xb8.js → CanvasStateV1-jLOibojY.js} +876 -844
  6. package/dist/{CanvasStateV1-BMxr6xb8.js.map → CanvasStateV1-jLOibojY.js.map} +1 -1
  7. package/dist/ContextualToolbars-DRbuUE7W.js +6061 -0
  8. package/dist/ContextualToolbars-DRbuUE7W.js.map +1 -0
  9. package/dist/{EditorCanvasImpl-BNz8TPFs.js → EditorCanvasImpl-P2GHPNA3.js} +19 -20
  10. package/dist/{EditorCanvasImpl-BNz8TPFs.js.map → EditorCanvasImpl-P2GHPNA3.js.map} +1 -1
  11. package/dist/{ExportManager-B8Td7uR5.js → ExportManager-Bkzzyxgw.js} +973 -576
  12. package/dist/ExportManager-Bkzzyxgw.js.map +1 -0
  13. package/dist/{FontAnalyzer-D4Sg-P6_.js → FontAnalyzer-BYhwxDhe.js} +542 -477
  14. package/dist/FontAnalyzer-BYhwxDhe.js.map +1 -0
  15. package/dist/{ImagePanel-CN2Bu3hf.js → ImagePanel-CEr0_FYy.js} +38 -38
  16. package/dist/{ImagePanel-CN2Bu3hf.js.map → ImagePanel-CEr0_FYy.js.map} +1 -1
  17. package/dist/SnowconeCanvas-Fa0isFpO.js +1192 -0
  18. package/dist/SnowconeCanvas-Fa0isFpO.js.map +1 -0
  19. package/dist/advanced.mjs +14 -14
  20. package/dist/api/embed.d.ts +2 -0
  21. package/dist/api/stable.d.ts +2 -0
  22. package/dist/components/CanvasContextMenu.d.ts +15 -0
  23. package/dist/components/CanvasEditor/hooks/useCanvasInteraction.d.ts +27 -0
  24. package/dist/components/CanvasEditor.d.ts +8 -0
  25. package/dist/components/ImageToolbar.d.ts +4 -0
  26. package/dist/components/embed/SnowconeCanvas.d.ts +13 -0
  27. package/dist/components/embed/kernel.d.ts +8 -0
  28. package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +2 -0
  29. package/dist/components/toolbars/SecondaryPanels.d.ts +17 -1
  30. package/dist/components/toolbars/index.d.ts +2 -2
  31. package/dist/components/ui/SliderRow.d.ts +6 -0
  32. package/dist/components/ui/icons.d.ts +2 -0
  33. package/dist/components/ui/toolbar-button.d.ts +2 -2
  34. package/dist/contexts/CanvasServicesContext.d.ts +17 -0
  35. package/dist/contexts/EditorContext.d.ts +7 -0
  36. package/dist/core/image-adjustments.d.ts +32 -0
  37. package/dist/{custom-icons-B5TRC1Ed.js → custom-icons-Co4rcW0S.js} +7 -7
  38. package/dist/{custom-icons-B5TRC1Ed.js.map → custom-icons-Co4rcW0S.js.map} +1 -1
  39. package/dist/design-builder-CBG2hKc8.js +1672 -0
  40. package/dist/design-builder-CBG2hKc8.js.map +1 -0
  41. package/dist/{embed-BTRtoktw.js → embed-D4TIzO7g.js} +20 -20
  42. package/dist/{embed-BTRtoktw.js.map → embed-D4TIzO7g.js.map} +1 -1
  43. package/dist/embed.mjs +51 -46
  44. package/dist/embed.mjs.map +1 -1
  45. package/dist/errors/editorError.d.ts +8 -0
  46. package/dist/{guards-uQtEQJbs.js → guards-DgZuwVgu.js} +2 -2
  47. package/dist/{guards-uQtEQJbs.js.map → guards-DgZuwVgu.js.map} +1 -1
  48. package/dist/hooks/elementPatch.d.ts +7 -2
  49. package/dist/hooks/useKeyboardShortcuts.d.ts +15 -2
  50. package/dist/hooks/useLayers.d.ts +2 -0
  51. package/dist/index.mjs +57 -52
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/internals.mjs +201 -132
  54. package/dist/internals.mjs.map +1 -1
  55. package/dist/rendering/element-painters.d.ts +0 -13
  56. package/dist/rendering/element-serializer.d.ts +3 -1
  57. package/dist/rendering/image-adjustments.d.ts +24 -0
  58. package/dist/rendering/renderer-types.d.ts +8 -1
  59. package/dist/state/CanvasStateV1.d.ts +36 -3
  60. package/dist/state/index.d.ts +2 -2
  61. package/dist/template-fields-CvFcr5zy.js +505 -0
  62. package/dist/template-fields-CvFcr5zy.js.map +1 -0
  63. package/dist/testing.mjs +46 -47
  64. package/dist/testing.mjs.map +1 -1
  65. package/dist/types/index.d.ts +21 -0
  66. package/dist/{UnifiedFontService-CgYnYTj7.js → useCommands-bPXY9rCh.js} +2429 -2145
  67. package/dist/useCommands-bPXY9rCh.js.map +1 -0
  68. package/dist/{usePieceGuideBundle-CTQszfKA.js → usePieceGuideBundle-Bj98nPk0.js} +2 -2
  69. package/dist/{usePieceGuideBundle-CTQszfKA.js.map → usePieceGuideBundle-Bj98nPk0.js.map} +1 -1
  70. package/dist/utils/custom-fonts.d.ts +99 -0
  71. package/dist/utils/featureApplied.d.ts +2 -0
  72. package/dist/validation-CsTlSvJJ.js +8686 -0
  73. package/dist/validation-CsTlSvJJ.js.map +1 -0
  74. package/dist/workers/export-protocol.d.ts +13 -0
  75. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  76. package/example/package.json +1 -1
  77. package/package.json +1 -1
  78. package/dist/ContextualToolbars-0jWvnQgp.js +0 -5833
  79. package/dist/ContextualToolbars-0jWvnQgp.js.map +0 -1
  80. package/dist/ExportManager-B8Td7uR5.js.map +0 -1
  81. package/dist/FontAnalyzer-D4Sg-P6_.js.map +0 -1
  82. package/dist/SnowconeCanvas-CR_LdRFP.js +0 -1173
  83. package/dist/SnowconeCanvas-CR_LdRFP.js.map +0 -1
  84. package/dist/UnifiedFontService-CgYnYTj7.js.map +0 -1
  85. package/dist/design-builder-COj0zkxu.js +0 -470
  86. package/dist/design-builder-COj0zkxu.js.map +0 -1
  87. package/dist/editorErrors-CCvoKj_P.js +0 -1219
  88. package/dist/editorErrors-CCvoKj_P.js.map +0 -1
  89. package/dist/template-fields-BLRp84Ny.js +0 -716
  90. package/dist/template-fields-BLRp84Ny.js.map +0 -1
  91. package/dist/validation-eCebhplp.js +0 -8402
  92. package/dist/validation-eCebhplp.js.map +0 -1
@@ -1,29 +1,29 @@
1
- function se(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, Y;
5
- function xt() {
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 St() {
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 = xt;
13
+ typeof setTimeout == "function" ? X = setTimeout : X = Ct;
14
14
  } catch {
15
- X = xt;
15
+ X = Ct;
16
16
  }
17
17
  try {
18
- typeof clearTimeout == "function" ? Y = clearTimeout : Y = St;
18
+ typeof clearTimeout == "function" ? N = clearTimeout : N = vt;
19
19
  } catch {
20
- Y = St;
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 === xt || !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 oe(r) {
39
- if (Y === clearTimeout)
38
+ function ae(r) {
39
+ if (N === clearTimeout)
40
40
  return clearTimeout(r);
41
- if ((Y === St || !Y) && clearTimeout)
42
- return Y = clearTimeout, clearTimeout(r);
41
+ if ((N === vt || !N) && clearTimeout)
42
+ return N = clearTimeout, clearTimeout(r);
43
43
  try {
44
- return Y(r);
44
+ return N(r);
45
45
  } catch {
46
46
  try {
47
- return Y.call(null, r);
47
+ return N.call(null, r);
48
48
  } catch {
49
- return Y.call(this, r);
49
+ return N.call(this, r);
50
50
  }
51
51
  }
52
52
  }
53
53
  var _ = [], K = !1, V, dt = -1;
54
- function re() {
55
- !K || !V || (K = !1, V.length ? _ = V.concat(_) : dt = -1, _.length && Lt());
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
61
  for (var t = _.length; t; ) {
62
62
  for (V = _, _ = []; ++dt < t; )
63
63
  V && V[dt].run();
64
64
  dt = -1, t = _.length;
65
65
  }
66
- V = null, K = !1, oe(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
- _.push(new Wt(r, t)), _.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 It = /* @__PURE__ */ se(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
@@ -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
  }
@@ -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)
@@ -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,26 +2282,26 @@ 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 si(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("#")) {
@@ -2310,71 +2310,71 @@ function si(r = 0.1, t) {
2310
2310
  }
2311
2311
  return e;
2312
2312
  }
2313
- function oi(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, Yt = 1.2, _t = 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,12 +2395,12 @@ 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
- this.level = 0, this.enabled = typeof It < "u" && ((t = It.env) == null ? void 0 : t.NODE_ENV) !== "production";
2403
+ this.level = 0, this.enabled = typeof ft < "u" && ((t = ft.env) == null ? void 0 : t.NODE_ENV) !== "production";
2404
2404
  }
2405
2405
  // Only enabled in development by default
2406
2406
  /**
@@ -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,18 +2474,18 @@ class Ce {
2474
2474
  this.logger.error(`[${this.scopeName}] ${t}`, ...e);
2475
2475
  }
2476
2476
  }
2477
- const Te = new Se(), mt = (r) => Te.scope(r), ve = mt("ImageLoadEvents"), Ct = /* @__PURE__ */ new Set();
2478
- function vi(r) {
2479
- return Ct.add(r), () => {
2480
- Ct.delete(r);
2477
+ const Ae = new Te(), pt = (r) => Ae.scope(r), Me = pt("ImageLoadEvents"), Tt = /* @__PURE__ */ new Set();
2478
+ function Ii(r) {
2479
+ return Tt.add(r), () => {
2480
+ Tt.delete(r);
2481
2481
  };
2482
2482
  }
2483
2483
  function et(r) {
2484
- Ct.forEach((t) => {
2484
+ Tt.forEach((t) => {
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
  }
@@ -2571,26 +2571,62 @@ class J {
2571
2571
  this.cache.clear();
2572
2572
  }
2573
2573
  }
2574
- const it = mt("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
- class pt extends Q {
2612
+ class yt extends Q {
2579
2613
  // Track URL acquired from ImageCache for release on destroy
2580
2614
  constructor(t = {}) {
2581
- var e, i, s, o, 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,
2586
- cropX: ((s = t.transformData) == null ? void 0 : s.cropX) ?? 0,
2587
- cropY: ((o = t.transformData) == null ? void 0 : o.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);
2618
+ width: ((i = t.transformData) == null ? void 0 : i.width) || 200,
2619
+ height: ((s = t.transformData) == null ? void 0 : s.height) || 200,
2620
+ cropX: ((o = t.transformData) == null ? void 0 : o.cropX) ?? 0,
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
@@ -2638,21 +2674,21 @@ class pt extends Q {
2638
2674
  }, this.loadTimeoutId = setTimeout(() => {
2639
2675
  if (s) return;
2640
2676
  o(), i.src = "";
2641
- const l = new Error(`Image load timed out after ${Et}ms: ${t}`);
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), !s && 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
@@ -2789,57 +2825,61 @@ class pt 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 s = this.transformData.flipHorizontal ? -1 : 1, o = this.transformData.flipVertical ? -1 : 1;
2794
- if (t.scale(s, o), 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();
@@ -2889,14 +2929,14 @@ class pt extends Q {
2889
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);
2890
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
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, Dt = new P(this).worldDeltaToLocal(W, z), Zt = Dt.dx, Kt = Dt.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;
@@ -2998,7 +3038,7 @@ class pt extends Q {
2998
3038
  if (!this.isCropping) return null;
2999
3039
  const s = this.getCropBoxBounds();
3000
3040
  if (!s) return null;
3001
- const o = this.worldToLocal(t, e), a = 1 / i, n = fe * a, h = ue * a, l = me * a, c = [
3041
+ const o = this.worldToLocal(t, e), a = 1 / i, n = pe * a, h = ye * a, l = we * a, c = [
3002
3042
  { x: s.x, y: s.y, anchor: "top-left" },
3003
3043
  { x: s.x + s.width, y: s.y, anchor: "top-right" },
3004
3044
  { x: s.x, y: s.y + s.height, anchor: "bottom-left" },
@@ -3189,7 +3229,7 @@ class pt extends Q {
3189
3229
  * Clone this element
3190
3230
  */
3191
3231
  clone() {
3192
- const t = this.toJSON(), { imageUrl: e, ...i } = t, s = new pt(i);
3232
+ const t = this.toJSON(), { imageUrl: e, ...i } = t, s = new yt(i);
3193
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
  /**
@@ -3212,7 +3252,12 @@ class pt 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 pt 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 Tt = 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
- Tt = r;
3287
+ function Ri(r) {
3288
+ At = r;
3244
3289
  }
3245
- function Ae() {
3246
- if (!Tt) throw Ut("group clipping");
3247
- return Tt;
3290
+ function Ee() {
3291
+ if (!At) throw Vt("group clipping");
3292
+ return At;
3248
3293
  }
3249
3294
  class L {
3250
3295
  constructor(t = []) {
@@ -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 Yi(r) {
3532
+ function qi(r) {
3488
3533
  return r.type === "shape";
3489
3534
  }
3490
- function _i(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
  }
@@ -3612,7 +3657,7 @@ class q extends Q {
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
@@ -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
- function yt(r, t, e) {
3653
- return e ? r + e * Me(t) : r;
3697
+ function wt(r, t, e) {
3698
+ return e ? r + e * Oe(t) : r;
3654
3699
  }
3655
- function De(r, t, e) {
3700
+ function Be(r, t, e) {
3656
3701
  const i = Array.from(t), s = [0];
3657
3702
  let o = "";
3658
3703
  for (let a = 0; a < i.length; a++)
3659
3704
  o += i[a], s.push(r.measureText(o).width + e * (a + 1));
3660
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,26 +3715,26 @@ function Ie(r, t, e) {
3670
3715
  return t;
3671
3716
  }
3672
3717
  }
3673
- function Gt(r, t, e, i, s, o) {
3718
+ function Jt(r, t, e, i, s, o) {
3674
3719
  if (!o || e.length === 0) {
3675
3720
  t[r](e, i, s);
3676
3721
  return;
3677
3722
  }
3678
- const a = De(t, e, o), 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
3727
  t[r](c[g], h + a[g], s);
3683
3728
  t.textAlign = l;
3684
3729
  }
3685
- function Vi(r, t, e, i, s) {
3686
- Gt("fillText", r, t, e, i, s);
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, s) {
3689
- Gt("strokeText", r, t, e, i, s);
3733
+ function is(r, t, e, i, s) {
3734
+ Jt("strokeText", r, t, e, i, s);
3690
3735
  }
3691
3736
  let ht = null;
3692
- function wt() {
3737
+ function bt() {
3693
3738
  if (!ht)
3694
3739
  if (typeof document < "u")
3695
3740
  ht = document.createElement("canvas");
@@ -3703,10 +3748,10 @@ function at(r, t, e = !1, i = !1) {
3703
3748
  const s = [];
3704
3749
  return i && s.push("italic"), e && s.push("bold"), s.push(`${r}px`), s.push(t), s.join(" ");
3705
3750
  }
3706
- function Ft(r, t, e, i, s = !1, o = !1, a, n = !1, h) {
3707
- const c = wt().getContext("2d");
3751
+ function It(r, t, e, i, s = !1, o = !1, a, n = !1, h) {
3752
+ const c = bt().getContext("2d");
3708
3753
  c.font = at(e, i, s, o);
3709
- const g = (h == null ? void 0 : h.letterSpacing) ?? 0, d = (A) => yt(c.measureText(A).width, A, g);
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];
3712
3757
  if (r.includes(`
@@ -3714,7 +3759,7 @@ function Ft(r, t, e, i, s = !1, o = !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 = Ft(H, t, e, i, s, o, 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 Ft(r, t, e, i, s = !1, o = !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, s = !1, o = 0) {
3768
- const n = wt().getContext("2d");
3769
- return n.font = at(t, e, i, s), yt(n.measureText(r).width, r, o);
3812
+ function Pt(r, t, e, i = !1, s = !1, o = 0) {
3813
+ const n = bt().getContext("2d");
3814
+ return n.font = at(t, e, i, s), wt(n.measureText(r).width, r, o);
3770
3815
  }
3771
- function vt(r, t, e = !1, i = !1) {
3772
- const o = wt().getContext("2d");
3816
+ function Mt(r, t, e = !1, i = !1) {
3817
+ const o = bt().getContext("2d");
3773
3818
  o.font = at(r, t, e, i);
3774
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, s = !1, o = !1, a, n = !1, h) {
3778
- const l = (h == null ? void 0 : h.letterSpacing) ?? 0, c = Ft(r, t, e, i, s, o, a, n, h), g = r.includes(`
3779
- `), d = c.map((b, T) => ({
3780
- isParagraphStart: !g && T === 0,
3781
- isParagraphEnd: !g && T === c.length - 1
3782
- })), u = wt().getContext("2d");
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
3827
+ })), u = bt().getContext("2d");
3783
3828
  u.font = at(e, i, s, o);
3784
3829
  let m = 0;
3785
- const p = vt(e, i, s, o);
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 = yt(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) ?? Yt;
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, s = !1, o = !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(), s = [], o = (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), yt(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 });
@@ -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 + o(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 = o(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,26 +3931,26 @@ 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;
3950
+ }), u += v;
3906
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) => {
@@ -3919,10 +3964,10 @@ function Oe(r) {
3919
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) {
3970
+ function We(r, t, e) {
3926
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") {
@@ -3937,31 +3982,31 @@ function Be(r, t, e) {
3937
3982
  const c = r.transformData;
3938
3983
  if (st(c) !== void 0 && s !== void 0) {
3939
3984
  const d = n > 0 ? l / n : a, f = s * d;
3940
- $t(c, Math.max(20, Math.ceil(f)));
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
3992
  const s = r.transformData;
3948
3993
  if (st(s) !== void 0) {
3949
- $t(s, Math.max(_t, e));
3994
+ qt(s, Math.max(Gt, e));
3950
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, s) {
3999
+ function jt(r, t, e, i, s) {
3955
4000
  const o = t.includes("top") || t.includes("bottom"), a = t.includes("middle");
3956
- o ? Be(r, e, s) : a && Re(r, t, e, s);
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
- _t,
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,9 +4019,9 @@ 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), s = [];
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,
@@ -3990,15 +4035,15 @@ class He extends q {
3990
4035
  let o = 0, a = 0;
3991
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 = vt(c, g, d, f);
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);
3994
4039
  o = Math.max(o, u.height), a = Math.max(a, u.ascent);
3995
4040
  });
3996
4041
  });
3997
- const n = this.fontSize * (this.lineHeight ?? Yt);
4042
+ const n = this.fontSize * (this.lineHeight ?? Ut);
3998
4043
  if (s.length === 1)
3999
4044
  return o;
4000
4045
  {
4001
- const h = vt(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));
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,
@@ -4114,7 +4159,7 @@ class He extends q {
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 = Ft(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;
@@ -4125,8 +4170,8 @@ class He extends q {
4125
4170
  * Side handles: only width changes - text re-wraps naturally
4126
4171
  */
4127
4172
  resize(t, e, i, s) {
4128
- if (t === "top-left" || t === "top-right" || t === "bottom-left" || t === "bottom-right" || (this._lockedLineCount = void 0), Vt(this, t, e, i, s), this._lockedLineCount !== void 0 && this._lockedLineCount > 0) {
4129
- const n = Bt(
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,7 +4223,7 @@ class He extends q {
4178
4223
  };
4179
4224
  }
4180
4225
  }
4181
- function Pe(r, t, e, i) {
4226
+ function Ne(r, t, e, i) {
4182
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);
@@ -4188,14 +4233,14 @@ function Pe(r, t, e, i) {
4188
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 s = r.width / 2, o = r.height + ge / 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;
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) {
4243
+ function os(r, t, e) {
4199
4244
  const i = I.toRadians(t), s = Math.cos(i), o = Math.sin(i), a = (c, g) => {
4200
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 {
@@ -4203,7 +4248,7 @@ function ji(r, t, e) {
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,11 +4277,11 @@ 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, s) {
4280
+ function rs(r, t, e, i, s) {
4236
4281
  const o = r - e, a = t - i;
4237
4282
  return o * o + a * a <= s * s;
4238
4283
  }
4239
- function Ki(r, t, e, i) {
4284
+ function ns(r, t, e, i) {
4240
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
  }
@@ -4244,19 +4289,19 @@ function tt(r, t, e = "Arial", i = !1, s = !1) {
4244
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 ts(r, t, e, i) {
4298
+ function hs(r, t, e, i) {
4254
4299
  return Math.atan2(i - t, e - r);
4255
4300
  }
4256
- function es(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, s, o = 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
4307
  if (l = (l % 360 + 360) % 360, s === "corner") {
@@ -4273,17 +4318,17 @@ function Le(r, t, e, i, s, o = 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 is(r, t, e = []) {
4283
- const i = We(r);
4327
+ function cs(r, t, e = []) {
4328
+ const i = Ye(r);
4284
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;
@@ -4339,7 +4384,7 @@ class ze extends q {
4339
4384
  resize(t, e, i, s) {
4340
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
4389
  x: s.x - o.radius * o.scale,
4345
4390
  y: s.y - o.radius * o.scale,
@@ -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;
@@ -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 * o * 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;
@@ -4518,14 +4563,14 @@ const ot = {
4518
4563
  frequency: 2,
4519
4564
  // Standard flag frequency
4520
4565
  width: 200
4521
- }, Ye = {
4566
+ }, $e = {
4522
4567
  archHeight: 0.5
4523
- }, _e = {
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;
@@ -4560,7 +4605,7 @@ class Ue extends q {
4560
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
  });
@@ -4573,7 +4618,7 @@ class Ue extends q {
4573
4618
  };
4574
4619
  }
4575
4620
  resize(t, e, i, s) {
4576
- Vt(this, 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;
@@ -4618,7 +4663,7 @@ class Ge extends q {
4618
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 * s * 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
  });
@@ -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;
@@ -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;
@@ -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 + o * 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;
@@ -4873,7 +4918,7 @@ class Ve extends q {
4873
4918
  };
4874
4919
  }
4875
4920
  }
4876
- class At extends Q {
4921
+ class kt extends Q {
4877
4922
  constructor(t = {}) {
4878
4923
  var i, s, o, a, n, h, l, c, g, d, f;
4879
4924
  super(t), this.transformType = "shape";
@@ -4890,7 +4935,7 @@ class At 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
  }
@@ -5338,7 +5383,7 @@ class At extends Q {
5338
5383
  * Clone this element
5339
5384
  */
5340
5385
  clone() {
5341
- return new At(this.toJSON());
5386
+ return new kt(this.toJSON());
5342
5387
  }
5343
5388
  /**
5344
5389
  * Serialize to JSON
@@ -5360,7 +5405,7 @@ class At extends Q {
5360
5405
  };
5361
5406
  }
5362
5407
  }
5363
- class Mt extends Q {
5408
+ class Et extends Q {
5364
5409
  constructor(t = {}) {
5365
5410
  var e, i, s, o, a, n, h, l, c, g;
5366
5411
  super(t), this.transformType = "path", this.transformData = {
@@ -5370,7 +5415,7 @@ class Mt extends Q {
5370
5415
  width: ((s = t.transformData) == null ? void 0 : s.width) || 200,
5371
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",
@@ -5447,8 +5492,8 @@ class Mt 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);
5495
+ for (let v = 0; v <= b; v++) {
5496
+ const C = v / b, M = this.bezierPoint(p, y, w, S, C);
5452
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
  }
@@ -5636,7 +5681,7 @@ class Mt extends Q {
5636
5681
  * Clone this element
5637
5682
  */
5638
5683
  clone() {
5639
- return new Mt(this.toJSON());
5684
+ return new Et(this.toJSON());
5640
5685
  }
5641
5686
  /**
5642
5687
  * Serialize to JSON
@@ -5666,7 +5711,7 @@ class Mt 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: Ye.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,
@@ -5732,7 +5777,7 @@ const Je = {
5732
5777
  {
5733
5778
  key: "leanAmount",
5734
5779
  label: "Lean Amount",
5735
- defaultInternalValue: _e.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,53 +5865,53 @@ 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: At },
5835
- { id: "path", label: "PATH", Component: Mt },
5836
- { id: "image", label: "IMAGE", Component: pt },
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 },
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.
5839
5884
  // The getter defers access until runtime when both modules are fully initialized.
5840
5885
  { id: "group", label: "GROUP", get Component() {
5841
- return ut;
5886
+ return mt;
5842
5887
  } }
5843
- ], qt = new Set(Jt.map((r) => r.id)), ft = /* @__PURE__ */ new Map();
5844
- function ss(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
  );
5849
- if (ft.has(r))
5894
+ if (ut.has(r))
5850
5895
  throw new Error(
5851
5896
  `Cannot register transform type "${r}": already registered as a custom type`
5852
5897
  );
5853
- ft.set(r, t);
5898
+ ut.set(r, t);
5854
5899
  }
5855
- function os(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
- return ft.delete(r);
5905
+ return ut.delete(r);
5861
5906
  }
5862
- function qe(r) {
5863
- const t = Jt.find((e) => e.id === r);
5864
- return t || ft.get(r);
5907
+ function ti(r) {
5908
+ const t = Zt.find((e) => e.id === r);
5909
+ return t || ut.get(r);
5865
5910
  }
5866
- function rs(r) {
5867
- return Je[r] || [];
5911
+ function fs(r) {
5912
+ return Qe[r] || [];
5868
5913
  }
5869
- class ut extends Q {
5914
+ class mt extends Q {
5870
5915
  constructor(t = {}) {
5871
5916
  super(t), this.isGroup = !0, this._baseBBoxWidth = 0, this._baseBBoxHeight = 0, this._rotationCenterX = 0, this._rotationCenterY = 0, this.transformType = "group";
5872
5917
  const e = t.children || [];
@@ -5881,7 +5926,7 @@ class ut 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);
@@ -5968,7 +6013,7 @@ class ut extends Q {
5968
6013
  */
5969
6014
  render(t, e = !1, i = !1) {
5970
6015
  const s = this.children.filter((a) => a.visible !== !1);
5971
- s.some((a) => a.isClipping) ? Ae()(t, s) : s.forEach((a) => {
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,7 +6023,7 @@ class ut 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]);
6026
+ t.save(), t.globalAlpha = e, t.strokeStyle = _t(), t.lineWidth = 2, t.setLineDash([5, 5]);
5982
6027
  const s = this._rotationCenterX || this.x, o = this._rotationCenterY || this.y;
5983
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
  }
@@ -6055,16 +6100,16 @@ class ut extends Q {
6055
6100
  }
6056
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 = s.childrenStartData[w], b = S.x - f, T = S.y - u, C = f + b * n, M = u + T * n;
6059
- if (y.x = C, y.y = M, y instanceof pt) {
6060
- const F = S.transformData, v = F.width * n, D = F.height * n;
6061
- y.transformData.width = v, y.transformData.height = D;
6062
- } else if (y instanceof ut) {
6063
- const F = (S.width ?? 0) * n, v = (S.height ?? 0) * n;
6064
- y.resize(t, F, v, S);
6103
+ const S = s.childrenStartData[w], b = S.x - f, v = S.y - u, C = f + b * n, M = u + v * n;
6104
+ if (y.x = C, y.y = M, y instanceof yt) {
6105
+ const F = S.transformData, T = F.width * n, D = F.height * n;
6106
+ y.transformData.width = T, y.transformData.height = D;
6107
+ } else if (y instanceof mt) {
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
6114
  }), this._baseBBoxWidth = s.width * n, this._baseBBoxHeight = s.height * n;
6070
6115
  const m = s.x - f, p = s.y - u;
@@ -6121,7 +6166,7 @@ class ut extends Q {
6121
6166
  * Clone the group (deep copy with children)
6122
6167
  */
6123
6168
  clone() {
6124
- const t = this.children.map((i) => i.clone()), e = new ut({
6169
+ const t = this.children.map((i) => i.clone()), e = new mt({
6125
6170
  id: this.id,
6126
6171
  x: this.x,
6127
6172
  y: this.y,
@@ -6311,6 +6356,18 @@ class Z {
6311
6356
  return t.byId = new Map(this.byId), t.order = [...this.order], t;
6312
6357
  }
6313
6358
  }
6359
+ class us extends Error {
6360
+ constructor(t, e, i = {}) {
6361
+ super(`[Editor] ${t}: ${e}`), this.name = "EditorError", this.code = t, this.data = { code: t, ...i };
6362
+ }
6363
+ }
6364
+ function ms(r) {
6365
+ return r instanceof Error && r.name === "EditorError" && "code" in r;
6366
+ }
6367
+ function ps() {
6368
+ var r;
6369
+ return typeof ft < "u" && ((r = ft.env) == null ? void 0 : r.NODE_ENV) !== "production";
6370
+ }
6314
6371
  class $ {
6315
6372
  /**
6316
6373
  * Execute the command
@@ -6325,7 +6382,7 @@ class $ {
6325
6382
  throw new Error("Command.undo() must be implemented");
6326
6383
  }
6327
6384
  }
6328
- class ns extends $ {
6385
+ class ys extends $ {
6329
6386
  constructor(t, e, i, s) {
6330
6387
  super(), this.elementId = t, this.oldElement = e ? e.clone() : null, this.newElement = i ? i.clone() : null, this.onUpdate = s;
6331
6388
  }
@@ -6336,7 +6393,7 @@ class ns extends $ {
6336
6393
  this.oldElement && this.onUpdate(this.oldElement);
6337
6394
  }
6338
6395
  }
6339
- class as extends $ {
6396
+ class ws extends $ {
6340
6397
  constructor(t, e, i) {
6341
6398
  super(), this.element = t.clone(), this.onAdd = e, this.onRemove = i;
6342
6399
  }
@@ -6347,7 +6404,7 @@ class as extends $ {
6347
6404
  this.onRemove(this.element.id);
6348
6405
  }
6349
6406
  }
6350
- class hs extends $ {
6407
+ class bs extends $ {
6351
6408
  constructor(t, e, i) {
6352
6409
  super(), this.element = t.clone(), this.onAdd = e, this.onRemove = i;
6353
6410
  }
@@ -6358,7 +6415,7 @@ class hs extends $ {
6358
6415
  this.onAdd(this.element);
6359
6416
  }
6360
6417
  }
6361
- class je extends $ {
6418
+ class ei extends $ {
6362
6419
  constructor(t) {
6363
6420
  super(), this.commands = t;
6364
6421
  }
@@ -6390,7 +6447,7 @@ class ct {
6390
6447
  executeBatch(t) {
6391
6448
  if (t.length === 0)
6392
6449
  return;
6393
- const e = new je(t);
6450
+ const e = new ei(t);
6394
6451
  this.execute(e);
6395
6452
  }
6396
6453
  /**
@@ -6435,7 +6492,7 @@ class ct {
6435
6492
  };
6436
6493
  }
6437
6494
  }
6438
- class ls extends $ {
6495
+ class xs extends $ {
6439
6496
  constructor(t, e) {
6440
6497
  super(), this.artboard = t.clone(), this.artboardManager = e;
6441
6498
  }
@@ -6455,7 +6512,7 @@ class ls extends $ {
6455
6512
  this.artboardManager.deleteArtboard(this.artboard.id);
6456
6513
  }
6457
6514
  }
6458
- class cs extends $ {
6515
+ class Ss extends $ {
6459
6516
  constructor(t, e) {
6460
6517
  super(), this.artboard = t.clone(), this.artboardManager = e, this.elementsOnArtboard = t.getElementIds();
6461
6518
  }
@@ -6478,7 +6535,7 @@ class cs extends $ {
6478
6535
  });
6479
6536
  }
6480
6537
  }
6481
- class ds extends $ {
6538
+ class Cs extends $ {
6482
6539
  constructor(t, e, i, s) {
6483
6540
  super(), this.artboardId = t, this.oldProperties = { ...e }, this.newProperties = { ...i }, this.artboardManager = s;
6484
6541
  }
@@ -6489,7 +6546,7 @@ class ds extends $ {
6489
6546
  this.artboardManager.updateArtboard(this.artboardId, this.oldProperties);
6490
6547
  }
6491
6548
  }
6492
- class gs extends $ {
6549
+ class vs extends $ {
6493
6550
  constructor(t, e, i, s, o) {
6494
6551
  super(), this.draggedId = t, this.targetId = e, this.position = i, this.oldOrder = [...s], this.onReorder = o, this.newOrder = this.calculateNewOrder();
6495
6552
  }
@@ -6509,8 +6566,8 @@ class gs extends $ {
6509
6566
  this.onReorder(this.oldOrder);
6510
6567
  }
6511
6568
  }
6512
- const Ze = mt("HybridHistoryManager");
6513
- class fs {
6569
+ const ii = pt("HybridHistoryManager");
6570
+ class Ts {
6514
6571
  constructor(t, e = 50) {
6515
6572
  this.commandExecutedCallbacks = [], this.globalHistory = new ct(e), this.artboardHistories = /* @__PURE__ */ new Map(), this.lastOperation = null, this.artboardManager = t, this.maxHistorySize = e;
6516
6573
  }
@@ -6532,7 +6589,7 @@ class fs {
6532
6589
  try {
6533
6590
  s(t, e, i);
6534
6591
  } catch (o) {
6535
- Ze.error("Error in command executed callback:", o);
6592
+ ii.error("Error in command executed callback:", o);
6536
6593
  }
6537
6594
  }
6538
6595
  /**
@@ -6804,12 +6861,12 @@ class fs {
6804
6861
  return this.canRedoGlobal() ? "Redo artboard operation" : "Nothing to redo";
6805
6862
  }
6806
6863
  }
6807
- const G = mt("FontAnalyzer");
6808
- let bt = null;
6809
- async function Ke() {
6810
- return bt || (bt = await import("./browser-module-DFvKXBUE.js")), bt;
6864
+ const G = pt("FontAnalyzer");
6865
+ let St = null;
6866
+ async function si() {
6867
+ return St || (St = await import("./browser-module-DFvKXBUE.js")), St;
6811
6868
  }
6812
- class Qe {
6869
+ class oi {
6813
6870
  constructor() {
6814
6871
  this.fontCache = /* @__PURE__ */ new Map(), this.failedFonts = /* @__PURE__ */ new Set(), this.CACHE_DURATION = 1e3 * 60 * 30, this.MAX_CACHE_SIZE = 5;
6815
6872
  }
@@ -6829,7 +6886,7 @@ class Qe {
6829
6886
  * Check if a font is a system font
6830
6887
  */
6831
6888
  isSystemFont(t) {
6832
- return we.has(t);
6889
+ return Se.has(t);
6833
6890
  }
6834
6891
  /**
6835
6892
  * Get Google Fonts API URL for a specific font family
@@ -6877,7 +6934,7 @@ class Qe {
6877
6934
  const a = await fetch(o);
6878
6935
  if (!a.ok)
6879
6936
  return G.error(`Font fetch failed: ${a.status} ${a.statusText}`), this.failedFonts.add(i), null;
6880
- 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;
6881
6938
  return this.fontCache.set(i, {
6882
6939
  font: g,
6883
6940
  url: o,
@@ -7022,13 +7079,13 @@ class Qe {
7022
7079
  const S = w.coverage;
7023
7080
  if (!S) continue;
7024
7081
  if (this.getCoverageIndex(S, n.id) !== -1) {
7025
- const T = this.getSubstituteGlyph(w, n.id);
7026
- T !== null && o.push({
7027
- glyphIndex: T,
7082
+ const v = this.getSubstituteGlyph(w, n.id);
7083
+ v !== null && o.push({
7084
+ glyphIndex: v,
7028
7085
  unicode: e,
7029
7086
  name: `${e} (${m})`,
7030
7087
  category: this.categorizeFeature(m),
7031
- previewDataUrl: this.generateGlyphPreview(s, T, 80)
7088
+ previewDataUrl: this.generateGlyphPreview(s, v, 80)
7032
7089
  });
7033
7090
  }
7034
7091
  }
@@ -7036,9 +7093,9 @@ class Qe {
7036
7093
  for (const w of y.subtables || []) {
7037
7094
  const S = w.coverage;
7038
7095
  if (!S) continue;
7039
- const b = this.getCoverageIndex(S, n.id), T = w;
7040
- if (b !== -1 && T.alternateSets) {
7041
- 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];
7042
7099
  if (C)
7043
7100
  for (const M of C)
7044
7101
  o.push({
@@ -7228,126 +7285,134 @@ class Qe {
7228
7285
  };
7229
7286
  }
7230
7287
  }
7231
- const us = new Qe();
7288
+ const Fs = new oi();
7232
7289
  export {
7233
- Te as $,
7290
+ ve as $,
7234
7291
  nt as A,
7235
7292
  Q as B,
7236
- he as C,
7237
- Xe as D,
7238
- ti as E,
7239
- Ti as F,
7240
- ut as G,
7241
- Ve as H,
7242
- pt as I,
7243
- ze as J,
7244
- He as K,
7245
- Z as L,
7246
- Ge as M,
7247
- fs as N,
7248
- $e as O,
7249
- Mt as P,
7250
- xe as Q,
7293
+ Fs as C,
7294
+ ps as D,
7295
+ us as E,
7296
+ Di as F,
7297
+ mt as G,
7298
+ de as H,
7299
+ yt as I,
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,
7251
7308
  L as R,
7252
- At as S,
7309
+ kt as S,
7253
7310
  q as T,
7254
- ns as U,
7255
- Pe as V,
7256
- Ue as W,
7257
- ji as X,
7258
- qi as Y,
7259
- Zi as Z,
7260
- Ki as _,
7261
- Ui as a,
7262
- _e as a$,
7263
- Oe as a0,
7264
- Ee as a1,
7265
- at as a2,
7266
- Bt as a3,
7267
- vt as a4,
7268
- Rt as a5,
7269
- Yt as a6,
7270
- Ji as a7,
7271
- j as a8,
7272
- yt as a9,
7273
- is as aA,
7274
- ge as aB,
7275
- si as aC,
7276
- ci as aD,
7277
- ts as aE,
7278
- fe as aF,
7279
- Qi as aG,
7280
- Le as aH,
7281
- es as aI,
7282
- wi as aJ,
7283
- hi as aK,
7284
- li as aL,
7285
- ai as aM,
7286
- de as aN,
7287
- ni as aO,
7288
- ri as aP,
7289
- ii as aQ,
7290
- xi as aR,
7291
- bi as aS,
7292
- oi as aT,
7293
- pi as aU,
7294
- yi as aV,
7295
- ui as aW,
7296
- ei as aX,
7297
- Jt as aY,
7298
- rs as aZ,
7299
- Ci as a_,
7300
- Vi as aa,
7301
- be as ab,
7302
- Fi as ac,
7303
- Ai as ad,
7304
- J as ae,
7305
- as as af,
7306
- hs as ag,
7307
- ls as ah,
7308
- cs as ai,
7309
- ds as aj,
7310
- gs as ak,
7311
- pe as al,
7312
- ye as am,
7313
- mi as an,
7314
- Ye as ao,
7315
- ot as ap,
7316
- vi as aq,
7317
- Ft as ar,
7318
- Xt as as,
7319
- di as at,
7320
- zt as au,
7321
- gi as av,
7322
- fi as aw,
7323
- I as ax,
7324
- P as ay,
7325
- Si as az,
7326
- Ni as b,
7327
- rt as b0,
7328
- mt as c,
7329
- Li as d,
7330
- Di as e,
7331
- Pi as f,
7332
- qe as g,
7333
- $i as h,
7334
- Ii as i,
7335
- Mi as j,
7336
- Ei as k,
7337
- Wi as l,
7338
- Bi as m,
7339
- Hi as n,
7340
- Oi as o,
7341
- Gi as p,
7342
- Xi as q,
7343
- ss as r,
7344
- _i as s,
7345
- zi as t,
7346
- os as u,
7347
- Yi as v,
7348
- Ri as w,
7349
- ki as x,
7350
- It as y,
7351
- us as z
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,
7393
+ pt as c,
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,
7416
+ ft as z
7352
7417
  };
7353
- //# sourceMappingURL=FontAnalyzer-D4Sg-P6_.js.map
7418
+ //# sourceMappingURL=FontAnalyzer-BYhwxDhe.js.map