@snowcone-app/canvas 0.40.13 → 0.40.15

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.
@@ -1,14 +1,14 @@
1
1
  import { jsx as r, jsxs as y, Fragment as Pn } from "react/jsx-runtime";
2
2
  import * as $n from "react";
3
- import je, { useState as le, useEffect as Pe, useCallback as ft, useMemo as xs, useContext as Ar, createContext as Nr, useRef as we, useImperativeHandle as nr, forwardRef as Dr } from "react";
3
+ import je, { useState as le, useEffect as Ie, useCallback as ft, useMemo as xs, useContext as Ar, createContext as Dr, useRef as we, useImperativeHandle as nr, forwardRef as Nr } from "react";
4
4
  import { b as rs, o as sr, t as _s, v as $s, d as Ts, j as Br, c as Or, m as zr } from "./design-builder-CoCtjIwj.js";
5
- import { l as rr, I as ze, s as Xr, u as or, c as Fn, v as Qt, i as _e, J as Yr, G as Hr, H as Lr, F as _r, W as $r, T as dn, q as un, r as hn, B as Ct, Y as Fr, Z as Wr, _ as Vr, D as ir, k as Kr, b as ar } from "./useCommands-CLnk8kvW.js";
6
- import { I as Yt, G as Re, b5 as Is, aO as ys, ab as cr, b6 as Fs, b7 as Ur, Y as Cn, b8 as Gr, b9 as us, P as wn, c as zn, a1 as en, $ as ms, ba as qr, T as Qe, u as jr, bb as Jn, bc as Zr, bd as Jr, be as Qr, a0 as lr, _ as eo, bf as Es, Z as to, g as no, S as Qn, at as so, x as Bn } from "./FontAnalyzer-DWHS41ba.js";
5
+ import { l as rr, I as ze, s as Xr, u as or, c as Fn, v as Qt, i as _e, J as Lr, G as Yr, H as Hr, F as _r, W as $r, T as dn, q as un, r as hn, B as Ct, Y as Fr, Z as Wr, _ as Vr, D as ir, k as Kr, b as ar } from "./useCommands-CLnk8kvW.js";
6
+ import { I as Lt, G as Re, b5 as Is, aO as ys, ab as cr, b6 as Fs, b7 as Ur, Y as Cn, b8 as Gr, b9 as us, P as wn, c as zn, a1 as en, $ as ms, ba as qr, T as Qe, u as jr, bb as Jn, bc as Zr, bd as Jr, be as Qr, a0 as lr, _ as eo, bf as Es, Z as to, g as no, S as Qn, at as so, x as Bn } from "./FontAnalyzer-DWHS41ba.js";
7
7
  import { createPortal as dr } from "react-dom";
8
8
  import { b as ro, n as ur, g as _n, c as oo, r as io, d as ao, C as Ws, e as Vs, f as gs, T as co, a as lo, A as uo, S as ho, I as fo } from "./CanvasRenderer-COHWEK1r.js";
9
9
  import { u as po } from "./ThemeContext-Rjz25x9X.js";
10
10
  import { renderToStaticMarkup as mo } from "react-dom/server";
11
- import { D as Ps, n as As, o as hr, p as Ns, e as go, q as Mt } from "./ContextualToolbars-D-EX9Q9L.js";
11
+ import { D as Ps, n as As, o as hr, p as Ds, e as go, q as Mt } from "./ContextualToolbars-D-EX9Q9L.js";
12
12
  import { L as Tt, S as fr, T as Ot, I as xo } from "./custom-icons-DHew1GPV.js";
13
13
  import * as ts from "@radix-ui/react-radio-group";
14
14
  import { S as yo, U as Ks, V as Us } from "./ExportManager-DLOH2Kzk.js";
@@ -151,10 +151,10 @@ function So(e) {
151
151
  }
152
152
  return e;
153
153
  }
154
- const gr = Nr(null);
155
- function Wa({ kit: e, children: t }) {
154
+ const gr = Dr(null);
155
+ function Va({ kit: e, children: t }) {
156
156
  const [n, s] = le(e);
157
- Pe(() => {
157
+ Ie(() => {
158
158
  s(e);
159
159
  }, [e]);
160
160
  const o = ft((a) => {
@@ -171,16 +171,16 @@ function Eo() {
171
171
  if (!e) throw new Error("useKit must be used within a KitProvider");
172
172
  return e;
173
173
  }
174
- function Va() {
174
+ function Ka() {
175
175
  const { kit: e } = Eo();
176
176
  return e.capabilities;
177
177
  }
178
178
  function ko(e, t) {
179
- if (t instanceof Yt && t.isCropping || e instanceof Yt && e.isCropping)
179
+ if (t instanceof Lt && t.isCropping || e instanceof Lt && e.isCropping)
180
180
  return !0;
181
181
  if (e instanceof Re) {
182
182
  for (const n of e.children)
183
- if (n instanceof Yt && n.isCropping)
183
+ if (n instanceof Lt && n.isCropping)
184
184
  return !0;
185
185
  }
186
186
  return !1;
@@ -211,7 +211,7 @@ function Ro(e) {
211
211
  isToolbarMenuOpen: C,
212
212
  artboardManager: R
213
213
  } = rs(), E = sr(), { duplicateLayer: A } = rr();
214
- Pe(() => {
214
+ Ie(() => {
215
215
  if (!t) return;
216
216
  const T = (g) => {
217
217
  var O;
@@ -243,8 +243,8 @@ function Ro(e) {
243
243
  return;
244
244
  }
245
245
  if ((g.metaKey || g.ctrlKey) && g.key === "d") {
246
- g.preventDefault(), n ? A(n.id) : o.length > 0 && o.forEach((N) => {
247
- A(N);
246
+ g.preventDefault(), n ? A(n.id) : o.length > 0 && o.forEach((D) => {
247
+ A(D);
248
248
  });
249
249
  return;
250
250
  }
@@ -273,19 +273,19 @@ function Ro(e) {
273
273
  if (g.key === "ArrowUp" || g.key === "ArrowDown" || g.key === "ArrowLeft" || g.key === "ArrowRight") {
274
274
  if (o.length > 0) {
275
275
  g.preventDefault(), x(!0);
276
- const N = g.shiftKey ? 10 : 1;
276
+ const D = g.shiftKey ? 10 : 1;
277
277
  let w = 0, ne = 0;
278
- g.key === "ArrowLeft" && (w = -N), g.key === "ArrowRight" && (w = N), g.key === "ArrowUp" && (ne = -N), g.key === "ArrowDown" && (ne = N), i.filter((D) => o.includes(D.id)).forEach((D) => {
279
- const u = D.clone();
278
+ g.key === "ArrowLeft" && (w = -D), g.key === "ArrowRight" && (w = D), g.key === "ArrowUp" && (ne = -D), g.key === "ArrowDown" && (ne = D), i.filter((N) => o.includes(N.id)).forEach((N) => {
279
+ const u = N.clone();
280
280
  u.x += w, u.y += ne, a(u);
281
281
  });
282
282
  return;
283
283
  }
284
284
  if (n) {
285
285
  g.preventDefault(), x(!0);
286
- const N = g.shiftKey ? 10 : 1;
286
+ const D = g.shiftKey ? 10 : 1;
287
287
  let w = 0, ne = 0;
288
- g.key === "ArrowLeft" && (w = -N), g.key === "ArrowRight" && (w = N), g.key === "ArrowUp" && (ne = -N), g.key === "ArrowDown" && (ne = N);
288
+ g.key === "ArrowLeft" && (w = -D), g.key === "ArrowRight" && (w = D), g.key === "ArrowUp" && (ne = -D), g.key === "ArrowDown" && (ne = D);
289
289
  const V = n.clone();
290
290
  V.x += w, V.y += ne, a(V);
291
291
  return;
@@ -324,7 +324,7 @@ function Io(e, t = Mo) {
324
324
  const [n, s] = le(e), o = we(n);
325
325
  o.current = n;
326
326
  const i = we(null), a = e ? `${e.x},${e.y},${e.width},${e.height}` : "none";
327
- return Pe(() => {
327
+ return Ie(() => {
328
328
  if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), !e) {
329
329
  s(null);
330
330
  return;
@@ -350,6 +350,15 @@ function Io(e, t = Mo) {
350
350
  };
351
351
  }, [a, t]), n;
352
352
  }
353
+ function Po(e) {
354
+ const t = () => {
355
+ }, n = (s) => {
356
+ s.cancelable && s.preventDefault();
357
+ };
358
+ return e.addEventListener("touchstart", t, { passive: !1 }), e.addEventListener("touchmove", n, { passive: !1 }), () => {
359
+ e.removeEventListener("touchstart", t), e.removeEventListener("touchmove", n);
360
+ };
361
+ }
353
362
  function yr(e, t) {
354
363
  if (e.length === 0)
355
364
  return { start: 0, end: 0 };
@@ -383,7 +392,7 @@ function yr(e, t) {
383
392
  i++;
384
393
  return { start: o, end: i };
385
394
  }
386
- function Po(e, t) {
395
+ function Ao(e, t) {
387
396
  const { fontSize: n, fontFamily: s, bold: o, italic: i, textAlign: a } = e, l = e.letterSpacing ?? 0, c = e.getRichText(), d = e.getVisualBoundingBox().width;
388
397
  let m = d, p = 0;
389
398
  e.transformType === "custom" && (p = cr, m = d - p * 2);
@@ -422,10 +431,10 @@ function Po(e, t) {
422
431
  let P = p;
423
432
  a === "center" ? P = (d - g) / 2 : a === "right" && (P = d - p - g);
424
433
  let O = P;
425
- const N = Math.min(R, C.length);
426
- for (let w = 0; w < N; w++) {
434
+ const D = Math.min(R, C.length);
435
+ for (let w = 0; w < D; w++) {
427
436
  if (!T && w < A) continue;
428
- const ne = C[w], V = x + w, D = c.getStyleAt(V), u = D.fontSize || n, j = D.fontFamily || s, G = D.bold !== void 0 ? D.bold : o, te = D.italic !== void 0 ? D.italic : i, ae = D.letterSpacing !== void 0 ? D.letterSpacing : l;
437
+ const ne = C[w], V = x + w, N = c.getStyleAt(V), u = N.fontSize || n, j = N.fontFamily || s, G = N.bold !== void 0 ? N.bold : o, te = N.italic !== void 0 ? N.italic : i, ae = N.letterSpacing !== void 0 ? N.letterSpacing : l;
429
438
  O += ys(ne, u, j, G, te, ae);
430
439
  }
431
440
  return {
@@ -435,8 +444,8 @@ function Po(e, t) {
435
444
  lineStartIndex: x
436
445
  };
437
446
  }
438
- function Ao(e, t, n) {
439
- const { fontSize: s } = e, o = e.lineHeight ?? 1.2, i = s * o, a = Po(e, t), l = n === "up" ? Math.max(0, a.lineIndex - 1) : Math.min(a.lineCount - 1, a.lineIndex + 1);
447
+ function Do(e, t, n) {
448
+ const { fontSize: s } = e, o = e.lineHeight ?? 1.2, i = s * o, a = Ao(e, t), l = n === "up" ? Math.max(0, a.lineIndex - 1) : Math.min(a.lineCount - 1, a.lineIndex + 1);
440
449
  if (l === a.lineIndex)
441
450
  return t;
442
451
  const c = l * i + i / 2;
@@ -465,39 +474,39 @@ function Sn(e, t) {
465
474
  let C = 0, R = 0;
466
475
  if (t.y < 0)
467
476
  return 0;
468
- for (let D = 0; D < b.length; D++) {
477
+ for (let N = 0; N < b.length; N++) {
469
478
  if (t.y >= R && t.y < R + v) {
470
- C = D;
479
+ C = N;
471
480
  break;
472
481
  }
473
- R += v, D === b.length - 1 && (C = D);
482
+ R += v, N === b.length - 1 && (C = N);
474
483
  }
475
484
  let E = 0;
476
- for (let D = 0; D < C; D++)
477
- E += b[D].length + 1;
485
+ for (let N = 0; N < C; N++)
486
+ E += b[N].length + 1;
478
487
  const A = b[C];
479
488
  let T = A, I = 0, g = 0;
480
489
  const P = C === 0, O = C === b.length - 1;
481
490
  if (!P) {
482
- const D = A.match(/^ +/);
483
- I = D ? D[0].length : 0, I > 0 && (T = T.substring(I));
491
+ const N = A.match(/^ +/);
492
+ I = N ? N[0].length : 0, I > 0 && (T = T.substring(I));
484
493
  }
485
494
  if (!O) {
486
- const D = T.match(/ +$/);
487
- g = D ? D[0].length : 0, g > 0 && (T = T.substring(0, T.length - g));
495
+ const N = T.match(/ +$/);
496
+ g = N ? N[0].length : 0, g > 0 && (T = T.substring(0, T.length - g));
488
497
  }
489
- const N = ys(T, n, s, o, i, l);
498
+ const D = ys(T, n, s, o, i, l);
490
499
  let w = p;
491
- a === "center" ? w = (d - N) / 2 : a === "right" && (w = d - p - N);
500
+ a === "center" ? w = (d - D) / 2 : a === "right" && (w = d - p - D);
492
501
  const ne = t.x - w;
493
502
  if (ne <= 0)
494
503
  return E + I;
495
- if (ne >= N)
504
+ if (ne >= D)
496
505
  return E + A.length - g;
497
506
  let V = 0;
498
- for (let D = 0; D < A.length; D++) {
499
- if (!P && D < I || !O && D >= A.length - g) continue;
500
- const u = A[D], j = E + D, G = c.getStyleAt(j), te = G.fontSize || n, ae = G.fontFamily || s, $ = G.bold !== void 0 ? G.bold : o, xe = G.italic !== void 0 ? G.italic : i, ie = G.letterSpacing !== void 0 ? G.letterSpacing : l, be = ys(u, te, ae, $, xe, ie);
507
+ for (let N = 0; N < A.length; N++) {
508
+ if (!P && N < I || !O && N >= A.length - g) continue;
509
+ const u = A[N], j = E + N, G = c.getStyleAt(j), te = G.fontSize || n, ae = G.fontFamily || s, $ = G.bold !== void 0 ? G.bold : o, me = G.italic !== void 0 ? G.italic : i, ie = G.letterSpacing !== void 0 ? G.letterSpacing : l, be = ys(u, te, ae, $, me, ie);
501
510
  if (ne < V + be / 2)
502
511
  return j;
503
512
  V += be;
@@ -512,7 +521,7 @@ function No() {
512
521
  x: 0,
513
522
  y: 0
514
523
  }), [a, l] = le([]);
515
- return Pe(() => {
524
+ return Ie(() => {
516
525
  }, [e]), {
517
526
  isMarqueeSelecting: e,
518
527
  marqueeStart: n,
@@ -539,7 +548,7 @@ function No() {
539
548
  }
540
549
  };
541
550
  }
542
- class Do {
551
+ class Bo {
543
552
  constructor() {
544
553
  this.state = {
545
554
  active: !1,
@@ -765,10 +774,10 @@ class Do {
765
774
  t.restore();
766
775
  }
767
776
  }
768
- const Bo = zn("usePenTool");
769
- function Oo({ selectedElement: e }) {
770
- const [t] = le(() => new Do()), [n, s] = le("crosshair");
771
- return Pe(() => {
777
+ const Oo = zn("usePenTool");
778
+ function zo({ selectedElement: e }) {
779
+ const [t] = le(() => new Bo()), [n, s] = le("crosshair");
780
+ return Ie(() => {
772
781
  try {
773
782
  const o = mo(/* @__PURE__ */ r(ze, { icon: "lucide:pen-tool", width: 24, height: 24 })).replace(
774
783
  /<svg[^>]*>|<\/svg>/g,
@@ -787,16 +796,16 @@ function Oo({ selectedElement: e }) {
787
796
  `.trim(), l = `data:image/svg+xml,${encodeURIComponent(i)}`;
788
797
  s(`url('${l}') 0 0, crosshair`);
789
798
  } catch (o) {
790
- Bo.error("Failed to create pen cursor:", o), s("crosshair");
799
+ Oo.error("Failed to create pen cursor:", o), s("crosshair");
791
800
  }
792
- }, []), Pe(() => {
801
+ }, []), Ie(() => {
793
802
  e instanceof wn && e.transformData.points.length === 0 && !t.isActive() && t.startPath(e);
794
803
  }, [e, t]), {
795
804
  penTool: t,
796
805
  penCursor: n
797
806
  };
798
807
  }
799
- function zo({
808
+ function Xo({
800
809
  elements: e,
801
810
  selectedElement: t,
802
811
  transformHandles: n,
@@ -808,7 +817,7 @@ function zo({
808
817
  },
809
818
  [s]
810
819
  );
811
- return Pe(() => {
820
+ return Ie(() => {
812
821
  if (o && t instanceof Re) {
813
822
  const c = t.children.find((f) => f.id === o.id);
814
823
  c && c !== o && (c instanceof Re || (i(c), s == null || s(c), n.update(c)));
@@ -820,7 +829,7 @@ function zo({
820
829
  editingChildIdRef: a
821
830
  };
822
831
  }
823
- function Xo({ onHoverChange: e }) {
832
+ function Lo({ onHoverChange: e }) {
824
833
  const [t, n] = le({
825
834
  type: null,
826
835
  data: null,
@@ -835,7 +844,7 @@ function Xo({ onHoverChange: e }) {
835
844
  };
836
845
  });
837
846
  }, []);
838
- return Pe(() => {
847
+ return Ie(() => {
839
848
  if (!e) return;
840
849
  let o = null;
841
850
  if (t.type === "element" || t.type === "group-sibling") {
@@ -848,7 +857,7 @@ function Xo({ onHoverChange: e }) {
848
857
  setHoverState: s
849
858
  };
850
859
  }
851
- class Ds {
860
+ class Ns {
852
861
  /**
853
862
  * @param x - Center X position in world space
854
863
  * @param y - Center Y position in world space
@@ -908,7 +917,7 @@ class Ds {
908
917
  * @returns CoordinateTransform
909
918
  */
910
919
  static fromElement(t) {
911
- return new Ds(
920
+ return new Ns(
912
921
  t.x,
913
922
  t.y,
914
923
  t.rotation || 0,
@@ -927,11 +936,11 @@ class Yo {
927
936
  const T = f.flipHorizontal ? -1 : 1, I = f.flipVertical ? -1 : 1;
928
937
  E *= T, A *= I;
929
938
  const g = -E / d, P = -A / m;
930
- let O = p + g, N = b + P;
939
+ let O = p + g, D = b + P;
931
940
  const w = 1 - x, ne = 1 - v;
932
- return O = Math.max(0, Math.min(w, O)), N = Math.max(0, Math.min(ne, N)), {
941
+ return O = Math.max(0, Math.min(w, O)), D = Math.max(0, Math.min(ne, D)), {
933
942
  cropX: O,
934
- cropY: N,
943
+ cropY: D,
935
944
  cropWidth: x,
936
945
  cropHeight: v,
937
946
  x: l,
@@ -947,18 +956,18 @@ class Yo {
947
956
  let I = A * v - T * C, g = A * C + T * v;
948
957
  I *= R, g *= E;
949
958
  const P = o.startX - p, O = o.startY - b;
950
- let N = P * v - O * C, w = P * C + O * v;
951
- N *= R, w *= E;
952
- const ne = I - N, V = g - w, D = l.cropX, u = l.cropY, j = l.cropWidth, G = l.cropHeight, te = l.width, ae = l.height, $ = ne / te, xe = V / ae, ie = this._calculateNewCropValues(
959
+ let D = P * v - O * C, w = P * C + O * v;
960
+ D *= R, w *= E;
961
+ const ne = I - D, V = g - w, N = l.cropX, u = l.cropY, j = l.cropWidth, G = l.cropHeight, te = l.width, ae = l.height, $ = ne / te, me = V / ae, ie = this._calculateNewCropValues(
953
962
  n,
954
- D,
963
+ N,
955
964
  u,
956
965
  j,
957
966
  G,
958
967
  $,
959
- xe
968
+ me
960
969
  ), be = this._calculateCropCenterOffset(
961
- D,
970
+ N,
962
971
  u,
963
972
  j,
964
973
  G,
@@ -1033,7 +1042,7 @@ class Yo {
1033
1042
  * Get the world position of a crop box handle
1034
1043
  */
1035
1044
  getCropBoxHandlePosition(t, n) {
1036
- const s = Ds.fromElement(t), o = t.transformData, i = o.width, a = o.height, l = o.cropX || 0, c = o.cropY || 0, f = o.cropWidth || 1, d = o.cropHeight || 1;
1045
+ const s = Ns.fromElement(t), o = t.transformData, i = o.width, a = o.height, l = o.cropX || 0, c = o.cropY || 0, f = o.cropWidth || 1, d = o.cropHeight || 1;
1037
1046
  let m = 0, p = 0;
1038
1047
  return n.includes("left") ? m = (l - 0.5) * i : n.includes("right") ? m = (l + f - 0.5) * i : m = (l + f / 2 - 0.5) * i, n.includes("top") ? p = (c - 0.5) * a : n.includes("bottom") ? p = (c + d - 0.5) * a : p = (c + d / 2 - 0.5) * a, s.localToWorld(m, p);
1039
1048
  }
@@ -1044,9 +1053,9 @@ function Ho() {
1044
1053
  cropController: e
1045
1054
  };
1046
1055
  }
1047
- function Lo(e) {
1056
+ function _o(e) {
1048
1057
  const t = we(null), n = we(null);
1049
- return Pe(() => {
1058
+ return Ie(() => {
1050
1059
  n.current = null;
1051
1060
  }, [e]), {
1052
1061
  multiSelectionGroupBoundsRef: t,
@@ -1056,18 +1065,18 @@ function Lo(e) {
1056
1065
  function js(e) {
1057
1066
  return e != null && e instanceof Qe;
1058
1067
  }
1059
- function _o({ selectedElement: e, ref: t }) {
1068
+ function $o({ selectedElement: e, ref: t }) {
1060
1069
  const [n, s] = le(!1), [o, i] = le(""), [a, l] = le({ x: 0, y: 0, width: 200, height: 50 }), [c, f] = le(0), [d, m] = le(0), [p, b] = le(0), x = we(1), v = we(performance.now()), C = we(0), R = we(!1), [E, A] = le(null), [T, I] = le(null), g = we(null), P = ft(
1061
1070
  (w) => {
1062
1071
  if (!n || !E)
1063
1072
  return;
1064
1073
  const ne = Math.min(d, p), V = Math.max(d, p);
1065
1074
  if (ne === V) {
1066
- const D = E.clone(), u = D.getText().length;
1067
- D.applyStyle(0, u, w), g.current = D, A(D), i(D.getText()), I((j) => ({ ...j, ...w }));
1075
+ const N = E.clone(), u = N.getText().length;
1076
+ N.applyStyle(0, u, w), g.current = N, A(N), i(N.getText()), I((j) => ({ ...j, ...w }));
1068
1077
  } else {
1069
- const D = E.clone();
1070
- D.applyStyle(ne, V, w), g.current = D, A(D), i(D.getText()), I((u) => ({ ...u, ...w }));
1078
+ const N = E.clone();
1079
+ N.applyStyle(ne, V, w), g.current = N, A(N), i(N.getText()), I((u) => ({ ...u, ...w }));
1071
1080
  }
1072
1081
  },
1073
1082
  [n, E, d, p]
@@ -1075,7 +1084,7 @@ function _o({ selectedElement: e, ref: t }) {
1075
1084
  if (!n || !E || !e) return null;
1076
1085
  const w = Math.min(d, p), ne = Math.max(d, p);
1077
1086
  return w === ne ? w === 0 ? js(e) ? e.getDefaultStyle() : {} : E.getStyleAt(Math.max(0, w - 1)) : E.getStyleAt(w);
1078
- }, [n, E, d, p, e]), N = ft(
1087
+ }, [n, E, d, p, e]), D = ft(
1079
1088
  (w) => {
1080
1089
  if (!n || !E || !e) return;
1081
1090
  const ne = O(), u = !{ ...js(e) ? e.getDefaultStyle() : {}, ...ne }[w];
@@ -1090,12 +1099,12 @@ function _o({ selectedElement: e, ref: t }) {
1090
1099
  P(w);
1091
1100
  },
1092
1101
  toggleFormattingProperty: (w) => {
1093
- N(w);
1102
+ D(w);
1094
1103
  },
1095
1104
  isEditingText: () => n,
1096
1105
  getSelectionStyle: () => O()
1097
1106
  }),
1098
- [P, N, n, O]
1107
+ [P, D, n, O]
1099
1108
  ), {
1100
1109
  isEditing: n,
1101
1110
  setIsEditing: s,
@@ -1125,10 +1134,10 @@ function _o({ selectedElement: e, ref: t }) {
1125
1134
  setCurrentFormattingStyle: I,
1126
1135
  applyFormattingToSelection: P,
1127
1136
  getSelectionStyle: O,
1128
- toggleFormattingProperty: N
1137
+ toggleFormattingProperty: D
1129
1138
  };
1130
1139
  }
1131
- function $o({
1140
+ function Fo({
1132
1141
  width: e,
1133
1142
  height: t,
1134
1143
  zoom: n,
@@ -1142,14 +1151,14 @@ function $o({
1142
1151
  focusedPieceRect: d
1143
1152
  }) {
1144
1153
  const [m, p] = le(!1);
1145
- Pe(() => {
1154
+ Ie(() => {
1146
1155
  const V = "ontouchstart" in window || navigator.maxTouchPoints > 0;
1147
1156
  p(V);
1148
1157
  }, []);
1149
1158
  const b = we(null);
1150
- Pe(() => {
1151
- const V = (D) => {
1152
- b.current = D.target, setTimeout(() => {
1159
+ Ie(() => {
1160
+ const V = (N) => {
1161
+ b.current = N.target, setTimeout(() => {
1153
1162
  b.current = null;
1154
1163
  }, 500);
1155
1164
  };
@@ -1161,7 +1170,7 @@ function $o({
1161
1170
  width: e ?? window.innerWidth,
1162
1171
  height: t ?? window.innerHeight
1163
1172
  });
1164
- Pe(() => {
1173
+ Ie(() => {
1165
1174
  if (d) {
1166
1175
  v({ width: d.width, height: d.height });
1167
1176
  return;
@@ -1172,20 +1181,20 @@ function $o({
1172
1181
  }
1173
1182
  const V = f.getActiveArtboard();
1174
1183
  V && v({ width: V.width, height: V.height });
1175
- }, [e, t, c, f, d]), Pe(() => {
1184
+ }, [e, t, c, f, d]), Ie(() => {
1176
1185
  const V = () => {
1177
1186
  if (d) {
1178
1187
  v({ width: d.width, height: d.height });
1179
1188
  return;
1180
1189
  }
1181
1190
  if (e === void 0 && t === void 0) {
1182
- const D = f.getActiveArtboard();
1183
- v(D ? { width: D.width, height: D.height } : { width: window.innerWidth, height: window.innerHeight });
1191
+ const N = f.getActiveArtboard();
1192
+ v(N ? { width: N.width, height: N.height } : { width: window.innerWidth, height: window.innerHeight });
1184
1193
  }
1185
1194
  };
1186
1195
  return window.addEventListener("resize", V), () => window.removeEventListener("resize", V);
1187
1196
  }, [e, t, f, d]);
1188
- const C = Math.max(0.1, Math.min(1, s)), R = a ?? i, E = l ?? i, A = R !== void 0 && n > 0 ? R / n : 0, T = E !== void 0 && n > 0 ? E / n : 0, I = R !== void 0 ? x.width + A * 2 : x.width / C, g = E !== void 0 ? x.height + T * 2 : x.height / C, P = R !== void 0 ? A : (I - x.width) / 2, O = E !== void 0 ? T : (g - x.height) / 2, N = d ? P - d.x : P, w = d ? O - d.y : O, ne = n > 0 ? o / n : o;
1197
+ const C = Math.max(0.1, Math.min(1, s)), R = a ?? i, E = l ?? i, A = R !== void 0 && n > 0 ? R / n : 0, T = E !== void 0 && n > 0 ? E / n : 0, I = R !== void 0 ? x.width + A * 2 : x.width / C, g = E !== void 0 ? x.height + T * 2 : x.height / C, P = R !== void 0 ? A : (I - x.width) / 2, O = E !== void 0 ? T : (g - x.height) / 2, D = d ? P - d.x : P, w = d ? O - d.y : O, ne = n > 0 ? o / n : o;
1189
1198
  return {
1190
1199
  isTouchDevice: m,
1191
1200
  canvasSize: x,
@@ -1193,12 +1202,12 @@ function $o({
1193
1202
  effectiveViewPadding: C,
1194
1203
  paddedCanvasWidth: I,
1195
1204
  paddedCanvasHeight: g,
1196
- paddingOffsetX: N,
1205
+ paddingOffsetX: D,
1197
1206
  paddingOffsetY: w,
1198
1207
  zoomInvariantBorderRadius: ne
1199
1208
  };
1200
1209
  }
1201
- function Fo() {
1210
+ function Wo() {
1202
1211
  const [e, t] = le([]), [n, s] = le([]), [o, i] = le(!1), [a, l] = le(!1), [c, f] = le(0), [d, m] = le(0), [, p] = le(0);
1203
1212
  return {
1204
1213
  snapGuides: e,
@@ -1215,11 +1224,11 @@ function Fo() {
1215
1224
  setRotatingElementVersion: p
1216
1225
  };
1217
1226
  }
1218
- function Wo({ elements: e }) {
1227
+ function Vo({ elements: e }) {
1219
1228
  const [, t] = le({}), [n, s] = le(0), [o, i] = le(0), [a, l] = le(0), c = ft(() => {
1220
1229
  i((f) => f + 1);
1221
1230
  }, []);
1222
- return Pe(() => jr((d) => {
1231
+ return Ie(() => jr((d) => {
1223
1232
  e.some((p) => p.id === d) && i((p) => p + 1);
1224
1233
  }), [e]), {
1225
1234
  renderVersion: o,
@@ -1281,7 +1290,7 @@ const jn = {
1281
1290
  labelHaloColor: "#ffffff"
1282
1291
  };
1283
1292
  let In = null;
1284
- function Vo(e) {
1293
+ function Ko(e) {
1285
1294
  const t = e.width, n = e.height;
1286
1295
  if (t <= 0 || n <= 0) return null;
1287
1296
  In || (In = document.createElement("canvas")), In.width !== t && (In.width = t), In.height !== n && (In.height = n);
@@ -1294,7 +1303,7 @@ function ks(e, t) {
1294
1303
  const s = n.slice(4, -1), [o, ...i] = s.split(","), a = o.trim(), l = i.length > 0 ? i.join(",").trim() : "", c = t ?? document.documentElement;
1295
1304
  return getComputedStyle(c).getPropertyValue(a).trim() || l || "#333";
1296
1305
  }
1297
- function Ko(e) {
1306
+ function Uo(e) {
1298
1307
  if (typeof document > "u") return !1;
1299
1308
  const t = document.documentElement;
1300
1309
  return !!(t.classList.contains("dark") || t.getAttribute("data-theme") === "dark");
@@ -1334,7 +1343,7 @@ function es(e, t) {
1334
1343
  }
1335
1344
  e.beginPath(), os(e, t), e.stroke();
1336
1345
  }
1337
- function Uo(e, t) {
1346
+ function Go(e, t) {
1338
1347
  t.kind !== "path" && os(e, t);
1339
1348
  }
1340
1349
  function bs(e, t) {
@@ -1355,7 +1364,7 @@ function bs(e, t) {
1355
1364
  }
1356
1365
  e.addPath(new Path2D(t.d));
1357
1366
  }
1358
- function Go(e, t, n) {
1367
+ function qo(e, t, n) {
1359
1368
  return (e == null ? void 0 : e.boundary) ?? {
1360
1369
  kind: "rect",
1361
1370
  x: 0,
@@ -1364,7 +1373,7 @@ function Go(e, t, n) {
1364
1373
  height: n
1365
1374
  };
1366
1375
  }
1367
- function qo(e, t, n, s) {
1376
+ function jo(e, t, n, s) {
1368
1377
  if (e != null && e.safeArea) return e.safeArea;
1369
1378
  if (t.safeAreaInsetPx && t.safeAreaInsetPx > 0) {
1370
1379
  const o = t.safeAreaInsetPx;
@@ -1378,7 +1387,7 @@ function qo(e, t, n, s) {
1378
1387
  }
1379
1388
  return null;
1380
1389
  }
1381
- function jo(e) {
1390
+ function Zo(e) {
1382
1391
  var R, E, A, T, I, g, P;
1383
1392
  const { ctx: t, pieces: n, pieceGuides: s, artboardOrigin: o, zoom: i } = e;
1384
1393
  if (!n.length) return;
@@ -1388,7 +1397,7 @@ function jo(e) {
1388
1397
  boundary: ((A = e.show) == null ? void 0 : A.boundary) ?? !0,
1389
1398
  safeArea: ((T = e.show) == null ? void 0 : T.safeArea) ?? !0,
1390
1399
  labels: ((I = e.show) == null ? void 0 : I.labels) ?? !0
1391
- }, l = t.canvas, c = l instanceof HTMLCanvasElement ? l : null, f = Ko(), m = { ...{
1400
+ }, l = t.canvas, c = l instanceof HTMLCanvasElement ? l : null, f = Uo(), m = { ...{
1392
1401
  ...jn,
1393
1402
  bleedFill: f ? "#ffffff" : "#000000"
1394
1403
  }, ...e.style };
@@ -1399,22 +1408,22 @@ function jo(e) {
1399
1408
  f && _s(p) ? p = "#ffffff" : !f && $s(p) && (p = "#000000"), f && _s(x) ? x = "#ffffff" : !f && $s(x) && (x = "#000000");
1400
1409
  const C = n.some(
1401
1410
  (O) => {
1402
- var N;
1403
- return (((N = s == null ? void 0 : s[O.id]) == null ? void 0 : N.zones) ?? []).some((w) => w.kind === "dieCut");
1411
+ var D;
1412
+ return (((D = s == null ? void 0 : s[O.id]) == null ? void 0 : D.zones) ?? []).some((w) => w.kind === "dieCut");
1404
1413
  }
1405
- ) && c ? Vo(c) : null;
1414
+ ) && c ? Ko(c) : null;
1406
1415
  t.save(), t.translate(o.x, o.y);
1407
1416
  for (const O of n) {
1408
1417
  if (e.focusedPieceId != null && O.id !== e.focusedPieceId)
1409
1418
  continue;
1410
- const N = s == null ? void 0 : s[O.id], w = (N == null ? void 0 : N.zones) ?? [], ne = (N == null ? void 0 : N.labels) ?? [];
1419
+ const D = s == null ? void 0 : s[O.id], w = (D == null ? void 0 : D.zones) ?? [], ne = (D == null ? void 0 : D.labels) ?? [];
1411
1420
  t.save(), t.translate(O.x, O.y), ro(t, O);
1412
- const { width: V, height: D } = ur(O), u = Go(N, V, D), j = qo(N, O, V, D), G = !0, te = Math.max(0, (N == null ? void 0 : N.outerRadius) ?? 0), ae = N != null && N.boundary && N.boundary.kind === "path" ? N.boundary : null, $ = ae ?? (te > 0 ? {
1421
+ const { width: V, height: N } = ur(O), u = qo(D, V, N), j = jo(D, O, V, N), G = !0, te = Math.max(0, (D == null ? void 0 : D.outerRadius) ?? 0), ae = D != null && D.boundary && D.boundary.kind === "path" ? D.boundary : null, $ = ae ?? (te > 0 ? {
1413
1422
  kind: "roundedRect",
1414
1423
  x: 0,
1415
1424
  y: 0,
1416
1425
  width: V,
1417
- height: D,
1426
+ height: N,
1418
1427
  rx: te,
1419
1428
  ry: te
1420
1429
  } : {
@@ -1422,23 +1431,23 @@ function jo(e) {
1422
1431
  x: 0,
1423
1432
  y: 0,
1424
1433
  width: V,
1425
- height: D
1426
- }), xe = te > 0 || ae !== null;
1427
- if (xe && (t.save(), ae ? t.clip(new Path2D(ae.d), "nonzero") : (t.beginPath(), Uo(t, $), t.clip())), a.bleed && m.bleedOpacity > 0) {
1434
+ height: N
1435
+ }), me = te > 0 || ae !== null;
1436
+ if (me && (t.save(), ae ? t.clip(new Path2D(ae.d), "nonzero") : (t.beginPath(), Go(t, $), t.clip())), a.bleed && m.bleedOpacity > 0) {
1428
1437
  const ie = m.bleedInnerEdge === "safeArea" && j ? j : u;
1429
1438
  if (ie) {
1430
1439
  const be = f ? "screen" : "multiply", Se = m.bleedOpacity;
1431
- m.bleedMode === "solid" ? Jo(
1440
+ m.bleedMode === "solid" ? Qo(
1432
1441
  t,
1433
1442
  $,
1434
1443
  ie,
1435
1444
  p,
1436
1445
  Se,
1437
1446
  be
1438
- ) : Zo(
1447
+ ) : Jo(
1439
1448
  t,
1440
1449
  V,
1441
- D,
1450
+ N,
1442
1451
  $,
1443
1452
  ie,
1444
1453
  p,
@@ -1458,7 +1467,7 @@ function jo(e) {
1458
1467
  ), es(t, ie.path), t.setLineDash([]), t.restore());
1459
1468
  if (a.zones)
1460
1469
  for (const ie of w)
1461
- ie.kind === "dieCut" && (m.dieCutMode === "knockout" ? ni(
1470
+ ie.kind === "dieCut" && (m.dieCutMode === "knockout" ? si(
1462
1471
  t,
1463
1472
  ie,
1464
1473
  m.dieCutStroke,
@@ -1467,7 +1476,7 @@ function jo(e) {
1467
1476
  G,
1468
1477
  C,
1469
1478
  m.dieCutBlurPx
1470
- ) : ei(
1479
+ ) : ti(
1471
1480
  t,
1472
1481
  ie,
1473
1482
  C,
@@ -1477,15 +1486,15 @@ function jo(e) {
1477
1486
  m.dieCutStroke,
1478
1487
  m.dieCutStrokeWidthPx
1479
1488
  ));
1480
- a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, u), t.restore()), a.safeArea && j && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, j), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && si(t, ne, m, i), xe && t.restore(), t.restore();
1489
+ a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, u), t.restore()), a.safeArea && j && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, j), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && ri(t, ne, m, i), me && t.restore(), t.restore();
1481
1490
  }
1482
1491
  t.restore();
1483
1492
  }
1484
- function Zo(e, t, n, s, o, i, a, l, c, f = "source-over") {
1493
+ function Jo(e, t, n, s, o, i, a, l, c, f = "source-over") {
1485
1494
  const d = Math.max(
1486
1495
  6,
1487
1496
  Math.round(Math.min(t, n) * l)
1488
- ), m = c > 0 ? d * c : d, p = typeof window < "u" && window.devicePixelRatio || 1, b = d, x = t + 2 * b, v = n + 2 * b, C = Math.max(1, Math.ceil(x * c * p)), R = Math.max(1, Math.ceil(v * c * p)), E = Qo(C, R);
1497
+ ), m = c > 0 ? d * c : d, p = typeof window < "u" && window.devicePixelRatio || 1, b = d, x = t + 2 * b, v = n + 2 * b, C = Math.max(1, Math.ceil(x * c * p)), R = Math.max(1, Math.ceil(v * c * p)), E = ei(C, R);
1489
1498
  if (!E) return;
1490
1499
  const A = E.getContext("2d");
1491
1500
  if (!A) return;
@@ -1497,16 +1506,16 @@ function Zo(e, t, n, s, o, i, a, l, c, f = "source-over") {
1497
1506
  const g = e.globalCompositeOperation;
1498
1507
  e.globalCompositeOperation = f, e.drawImage(E, -b, -b, x, v), e.globalCompositeOperation = g;
1499
1508
  }
1500
- function Jo(e, t, n, s, o, i = "source-over") {
1509
+ function Qo(e, t, n, s, o, i = "source-over") {
1501
1510
  e.save(), e.globalAlpha = e.globalAlpha * o, e.globalCompositeOperation = i, e.fillStyle = s;
1502
1511
  const a = new Path2D();
1503
1512
  bs(a, t), bs(a, n), e.fill(a, "evenodd"), e.restore();
1504
1513
  }
1505
- let Dn = null;
1506
- function Qo(e, t) {
1507
- return typeof document > "u" ? null : (Dn || (Dn = document.createElement("canvas")), Dn.width !== e && (Dn.width = e), Dn.height !== t && (Dn.height = t), Dn);
1514
+ let Nn = null;
1515
+ function ei(e, t) {
1516
+ return typeof document > "u" ? null : (Nn || (Nn = document.createElement("canvas")), Nn.width !== e && (Nn.width = e), Nn.height !== t && (Nn.height = t), Nn);
1508
1517
  }
1509
- function ei(e, t, n, s, o, i, a, l) {
1518
+ function ti(e, t, n, s, o, i, a, l) {
1510
1519
  const c = t.path;
1511
1520
  if (e.save(), e.beginPath(), os(e, c), e.clip(), n && (e.save(), e.globalCompositeOperation = "destination-out", e.fillStyle = "#000", c.kind === "path" ? ns(e, c) : e.fillRect(c.x, c.y, c.width, c.height), e.restore(), i > 0)) {
1512
1521
  const f = e.globalAlpha, d = e.getTransform();
@@ -1518,8 +1527,8 @@ function ei(e, t, n, s, o, i, a, l) {
1518
1527
  }
1519
1528
  e.restore(), a && (e.save(), e.strokeStyle = a, Jn(e, l), es(e, c), e.restore());
1520
1529
  }
1521
- const ti = 0.3;
1522
- function ni(e, t, n, s, o, i = !0, a, l = 0) {
1530
+ const ni = 0.3;
1531
+ function si(e, t, n, s, o, i = !0, a, l = 0) {
1523
1532
  const c = t.path;
1524
1533
  if (i)
1525
1534
  if (o && a && l > 0) {
@@ -1527,25 +1536,25 @@ function ni(e, t, n, s, o, i = !0, a, l = 0) {
1527
1536
  const f = e.globalAlpha, d = e.getTransform();
1528
1537
  e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.filter = `blur(${l}px)`, e.globalAlpha = f * 0.4, e.drawImage(a, 0, 0), e.filter = "none", e.globalAlpha = f, e.setTransform(d), e.restore(), e.restore();
1529
1538
  } else
1530
- e.save(), e.globalCompositeOperation = "destination-out", e.globalAlpha = o ? 1 - ti : 1, e.fillStyle = "#000", c.kind === "path" || c.kind === "roundedRect" ? ns(e, c) : e.fillRect(c.x, c.y, c.width, c.height), e.restore();
1539
+ e.save(), e.globalCompositeOperation = "destination-out", e.globalAlpha = o ? 1 - ni : 1, e.fillStyle = "#000", c.kind === "path" || c.kind === "roundedRect" ? ns(e, c) : e.fillRect(c.x, c.y, c.width, c.height), e.restore();
1531
1540
  n && (e.save(), e.strokeStyle = n, Jn(e, s), es(e, c), e.restore());
1532
1541
  }
1533
- function si(e, t, n, s) {
1542
+ function ri(e, t, n, s) {
1534
1543
  const o = s > 0 ? n.labelFontSizePx / s : n.labelFontSizePx, i = Math.max(2, n.labelFontSizePx * 0.25), a = s > 0 ? i / s : i;
1535
1544
  e.save(), e.font = `${o}px ${n.labelFontFamily}`;
1536
1545
  for (const l of t) {
1537
1546
  const c = l.anchor ?? "c";
1538
- e.textAlign = ri(c), e.textBaseline = oi(c), e.lineJoin = "round", e.strokeStyle = n.labelHaloColor, e.lineWidth = a, e.strokeText(l.text, l.x, l.y), e.fillStyle = n.labelColor, e.fillText(l.text, l.x, l.y);
1547
+ e.textAlign = oi(c), e.textBaseline = ii(c), e.lineJoin = "round", e.strokeStyle = n.labelHaloColor, e.lineWidth = a, e.strokeText(l.text, l.x, l.y), e.fillStyle = n.labelColor, e.fillText(l.text, l.x, l.y);
1539
1548
  }
1540
1549
  e.restore();
1541
1550
  }
1542
- function ri(e) {
1551
+ function oi(e) {
1543
1552
  return e.endsWith("l") ? "start" : e.endsWith("r") ? "end" : "center";
1544
1553
  }
1545
- function oi(e) {
1554
+ function ii(e) {
1546
1555
  return e.startsWith("t") ? "hanging" : e.startsWith("b") ? "alphabetic" : "middle";
1547
1556
  }
1548
- function ii(e) {
1557
+ function ai(e) {
1549
1558
  const {
1550
1559
  ctx: t,
1551
1560
  displaySelection: n,
@@ -1584,7 +1593,7 @@ function ii(e) {
1584
1593
  { x: Se.x + Se.width, y: Se.y + Se.height }
1585
1594
  ];
1586
1595
  if (be.rotation !== 0) {
1587
- const Oe = be.getRotationAnchor(), De = -be.rotation * Math.PI / 180, $e = Math.cos(De), at = Math.sin(De);
1596
+ const Oe = be.getRotationAnchor(), Ne = -be.rotation * Math.PI / 180, $e = Math.cos(Ne), at = Math.sin(Ne);
1588
1597
  Te.forEach((pt) => {
1589
1598
  const ct = pt.x - Oe.x, Pt = pt.y - Oe.y;
1590
1599
  pt.x = Oe.x + (ct * $e - Pt * at), pt.y = Oe.y + (ct * at + Pt * $e);
@@ -1614,40 +1623,40 @@ function ii(e) {
1614
1623
  } else
1615
1624
  P = { ...P, centerX: I, centerY: g };
1616
1625
  }
1617
- const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width, V = P.height, D = P.centerX, u = P.centerY, j = D - ne / 2, G = u - V / 2, te = D + ne / 2, ae = u + V / 2;
1618
- let $ = D, xe = ae + Zr;
1626
+ const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width, V = P.height, N = P.centerX, u = P.centerY, j = N - ne / 2, G = u - V / 2, te = N + ne / 2, ae = u + V / 2;
1627
+ let $ = N, me = ae + Zr;
1619
1628
  if (w !== 0) {
1620
- const be = -w * Math.PI / 180, Se = Math.cos(be), Te = Math.sin(be), Oe = $ - D, De = xe - u;
1621
- $ = D + (Oe * Se - De * Te), xe = u + (Oe * Te + De * Se);
1629
+ const be = -w * Math.PI / 180, Se = Math.cos(be), Te = Math.sin(be), Oe = $ - N, Ne = me - u;
1630
+ $ = N + (Oe * Se - Ne * Te), me = u + (Oe * Te + Ne * Se);
1622
1631
  }
1623
1632
  const ie = {
1624
1633
  minX: j,
1625
1634
  minY: G,
1626
1635
  maxX: te,
1627
1636
  maxY: ae,
1628
- centerX: D,
1637
+ centerX: N,
1629
1638
  centerY: u,
1630
1639
  rotationHandleX: $,
1631
- rotationHandleY: xe,
1640
+ rotationHandleY: me,
1632
1641
  rotation: w
1633
1642
  };
1634
- return t.save(), t.translate(D, u), t.rotate(-w * Math.PI / 180), t.translate(-D, -u), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.setLineDash(oo(d)), t.strokeRect(j, G, ne, V), t.restore(), f || ai(t, {
1643
+ return t.save(), t.translate(N, u), t.rotate(-w * Math.PI / 180), t.translate(-N, -u), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.setLineDash(oo(d)), t.strokeRect(j, G, ne, V), t.restore(), f || ci(t, {
1635
1644
  renderMinX: j,
1636
1645
  renderMinY: G,
1637
1646
  renderMaxX: te,
1638
1647
  renderMaxY: ae,
1639
- renderCenterX: D,
1648
+ renderCenterX: N,
1640
1649
  renderCenterY: u,
1641
1650
  renderWidth: ne,
1642
1651
  renderHeight: V,
1643
1652
  groupRotation: w,
1644
1653
  rotationHandleX: $,
1645
- rotationHandleY: xe,
1654
+ rotationHandleY: me,
1646
1655
  stateMachine: i,
1647
1656
  zoom: d
1648
1657
  }), { updatedOBB: P, groupBounds: ie };
1649
1658
  }
1650
- function ai(e, t) {
1659
+ function ci(e, t) {
1651
1660
  var A;
1652
1661
  const {
1653
1662
  renderMinX: n,
@@ -1674,28 +1683,28 @@ function ai(e, t) {
1674
1683
  return;
1675
1684
  let I = T.x, g = T.y;
1676
1685
  if (d !== 0) {
1677
- const P = -d * Math.PI / 180, O = Math.cos(P), N = Math.sin(P), w = T.x - a, ne = T.y - l;
1678
- I = a + (w * O - ne * N), g = l + (w * N + ne * O);
1686
+ const P = -d * Math.PI / 180, O = Math.cos(P), D = Math.sin(P), w = T.x - a, ne = T.y - l;
1687
+ I = a + (w * O - ne * D), g = l + (w * D + ne * O);
1679
1688
  }
1680
1689
  e.save(), e.beginPath(), e.arc(I, g, v, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill(), e.strokeStyle = Cn(), e.lineWidth = R && E && T.anchor === E ? _n(x) * 1.25 : _n(x), e.stroke(), e.restore();
1681
- }), R || io(e, m, p, x, Cn()), b.getMode() === "resize" && ci(e, a, i, c, f);
1690
+ }), R || io(e, m, p, x, Cn()), b.getMode() === "resize" && li(e, a, i, c, f);
1682
1691
  }
1683
- function ci(e, t, n, s, o) {
1692
+ function li(e, t, n, s, o) {
1684
1693
  const i = `${Math.round(s)} × ${Math.round(o)}`, a = t, l = n + 30;
1685
1694
  e.save(), e.font = "10px system-ui, -apple-system, sans-serif";
1686
1695
  const f = e.measureText(i).width + 12, d = 18;
1687
1696
  e.shadowColor = "rgba(0,0,0,0.2)", e.shadowBlur = 4, e.shadowOffsetY = 1, e.fillStyle = "#333", e.beginPath(), e.roundRect(a - f / 2, l - d / 2, f, d, 3), e.fill(), e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetY = 0, e.fillStyle = "#fff", e.textAlign = "center", e.textBaseline = "middle", e.fillText(i, a, l + 0.5), e.restore();
1688
1697
  }
1689
- function li(e) {
1698
+ function di(e) {
1690
1699
  const { ctx: t, marqueeStart: n, marqueeEnd: s, zoom: o = 1 } = e, i = Math.min(n.x, s.x), a = Math.max(n.x, s.x), l = Math.min(n.y, s.y), c = Math.max(n.y, s.y);
1691
1700
  t.save(), t.strokeStyle = Cn(), t.lineWidth = _n(o), t.strokeRect(i, l, a - i, c - l), t.fillStyle = Jr(0.1), t.fillRect(i, l, a - i, c - l), t.restore();
1692
1701
  }
1693
- function di(e) {
1702
+ function ui(e) {
1694
1703
  const { ctx: t, hoveredChild: n, zoom: s = 1 } = e, o = n.getVisualBoundingBox();
1695
1704
  t.save(), t.translate(o.x + o.width / 2, o.y + o.height / 2), t.rotate(-n.rotation * Math.PI / 180), t.translate(-(o.x + o.width / 2), -(o.y + o.height / 2)), t.strokeStyle = Qr(), t.lineWidth = _n(s), t.setLineDash([]), t.strokeRect(o.x, o.y, o.width, o.height), t.restore();
1696
1705
  }
1697
- const ui = 60;
1698
- class Ln {
1706
+ const hi = 60;
1707
+ class Hn {
1699
1708
  constructor() {
1700
1709
  this.frameTimes = [], this.metrics = {
1701
1710
  frameTime: 0,
@@ -1706,14 +1715,14 @@ class Ln {
1706
1715
  };
1707
1716
  }
1708
1717
  static getInstance() {
1709
- return Ln.instance || (Ln.instance = new Ln()), Ln.instance;
1718
+ return Hn.instance || (Hn.instance = new Hn()), Hn.instance;
1710
1719
  }
1711
1720
  /**
1712
1721
  * Record a single frame's render duration. Maintains a rolling window
1713
1722
  * of the last 60 values and recomputes the average.
1714
1723
  */
1715
1724
  recordFrameTime(t) {
1716
- this.frameTimes.push(t), this.frameTimes.length > ui && this.frameTimes.shift(), this.metrics.frameCount++, this.metrics.frameTime = this._average(this.frameTimes);
1725
+ this.frameTimes.push(t), this.frameTimes.length > hi && this.frameTimes.shift(), this.metrics.frameCount++, this.metrics.frameTime = this._average(this.frameTimes);
1717
1726
  }
1718
1727
  /** Record the duration of an export operation. */
1719
1728
  recordExportDuration(t) {
@@ -1750,7 +1759,7 @@ class Ln {
1750
1759
  return n / t.length;
1751
1760
  }
1752
1761
  }
1753
- function hi(e, t, n) {
1762
+ function fi(e, t, n) {
1754
1763
  if (e.length === 0 || !e.every((a) => {
1755
1764
  var c;
1756
1765
  const l = (c = t == null ? void 0 : t[a.id]) == null ? void 0 : c.boundary;
@@ -1773,14 +1782,14 @@ function hi(e, t, n) {
1773
1782
  })
1774
1783
  };
1775
1784
  }
1776
- function fi(e) {
1785
+ function pi(e) {
1777
1786
  const t = we(e);
1778
1787
  t.current = e;
1779
1788
  const n = we(!0), s = we(null), o = we("#0a0a0a");
1780
- Pe(() => {
1789
+ Ie(() => {
1781
1790
  const i = t.current.canvasRef.current ?? document.documentElement, a = getComputedStyle(i).getPropertyValue("--color-canvas-bg").trim();
1782
1791
  o.current = a || "#0a0a0a";
1783
- }, [e.resolvedTheme]), Pe(() => {
1792
+ }, [e.resolvedTheme]), Ie(() => {
1784
1793
  n.current = !0;
1785
1794
  }, [
1786
1795
  e.elementsByArtboard,
@@ -1793,7 +1802,7 @@ function fi(e) {
1793
1802
  e.renderVersion,
1794
1803
  e.resolvedTheme,
1795
1804
  e.pieceGuides
1796
- ]), Pe(() => {
1805
+ ]), Ie(() => {
1797
1806
  n.current = !0;
1798
1807
  }, [
1799
1808
  e.transformHandles,
@@ -1818,21 +1827,21 @@ function fi(e) {
1818
1827
  e.isAltKeyPressed,
1819
1828
  e.penTool,
1820
1829
  e.cursorAnimationFrame
1821
- ]), Pe(() => {
1830
+ ]), Ie(() => {
1822
1831
  let i;
1823
1832
  const l = () => {
1824
1833
  const { hoverState: c } = t.current;
1825
1834
  if (c.startTime !== null && c.type !== null && performance.now() - c.startTime < 150 && (n.current = !0), n.current) {
1826
1835
  n.current = !1;
1827
1836
  const f = performance.now();
1828
- pi(t.current, o, s), Ln.getInstance().recordFrameTime(performance.now() - f);
1837
+ mi(t.current, o, s), Hn.getInstance().recordFrameTime(performance.now() - f);
1829
1838
  }
1830
1839
  i = requestAnimationFrame(l);
1831
1840
  };
1832
1841
  return i = requestAnimationFrame(l), () => cancelAnimationFrame(i);
1833
1842
  }, []);
1834
1843
  }
1835
- function pi(e, t, n) {
1844
+ function mi(e, t, n) {
1836
1845
  var rn, on, Ut;
1837
1846
  const {
1838
1847
  canvasRef: s,
@@ -1857,24 +1866,24 @@ function pi(e, t, n) {
1857
1866
  showRotationHandle: g,
1858
1867
  isRotating: P,
1859
1868
  currentRotation: O,
1860
- hoverState: N,
1869
+ hoverState: D,
1861
1870
  isEditing: w,
1862
1871
  editText: ne,
1863
1872
  editRichText: V,
1864
- cursorPosition: D,
1873
+ cursorPosition: N,
1865
1874
  selectionStart: u,
1866
1875
  selectionEnd: j,
1867
1876
  cursorOpacityRef: G,
1868
1877
  cursorStartTimeRef: te,
1869
1878
  isTouchDevice: ae,
1870
1879
  selectionHandlePositionsRef: $,
1871
- multiClickSelectionRef: xe,
1880
+ multiClickSelectionRef: me,
1872
1881
  lastMultiClickTimeRef: ie,
1873
1882
  MULTI_CLICK_DEBOUNCE: be,
1874
1883
  snapGuides: Se,
1875
1884
  spacingIndicators: Te,
1876
1885
  isAltKeyPressed: Oe,
1877
- multiSelection: De,
1886
+ multiSelection: Ne,
1878
1887
  multiSelectionOBBRef: $e,
1879
1888
  multiSelectionGroupBoundsRef: at,
1880
1889
  isMarqueeSelecting: pt,
@@ -1889,28 +1898,28 @@ function pi(e, t, n) {
1889
1898
  const se = lt.getContext("2d");
1890
1899
  if (!se) return;
1891
1900
  if (w) {
1892
- const Ue = (me) => me < 0.5 ? 4 * me * me * me : 1 - Math.pow(-2 * me + 2, 3) / 2, K = (performance.now() - te.current) % 1060 / 1060, ue = K < 0.5 ? 1 - Ue(K * 2) : Ue((K - 0.5) * 2);
1901
+ const Ue = (ge) => ge < 0.5 ? 4 * ge * ge * ge : 1 - Math.pow(-2 * ge + 2, 3) / 2, K = (performance.now() - te.current) % 1060 / 1060, ue = K < 0.5 ? 1 - Ue(K * 2) : Ue((K - 0.5) * 2);
1893
1902
  G.current = ue;
1894
1903
  } else
1895
1904
  G.current = 1;
1896
1905
  const h = window.devicePixelRatio || 1, U = v * A, re = C * A;
1897
1906
  if (U <= 0 || re <= 0) return;
1898
- const he = 4096, L = U * h, Ce = re * h, Ie = Math.max(L, Ce), Ve = Ie > he ? he / Ie : 1, Xe = h * Ve;
1907
+ const he = 4096, H = U * h, Ce = re * h, Pe = Math.max(H, Ce), Ve = Pe > he ? he / Pe : 1, Xe = h * Ve;
1899
1908
  lt.width = U * Xe, lt.height = re * Xe, se.setTransform(1, 0, 0, 1, 0, 0), se.clearRect(0, 0, lt.width, lt.height);
1900
- const H = t.current;
1909
+ const Y = t.current;
1901
1910
  se.scale(Xe, Xe), A !== 1 && se.scale(A, A), (R !== 0 || E !== 0) && se.translate(R, E);
1902
- const _ = a.find((Ke) => Ke.id === l.getActiveArtboardId()), ot = (_ == null ? void 0 : _.id) ?? null, rt = Ee && _ ? hi(
1911
+ const _ = a.find((Ke) => Ke.id === l.getActiveArtboardId()), ot = (_ == null ? void 0 : _.id) ?? null, rt = Ee && _ ? fi(
1903
1912
  Ee.pieces,
1904
1913
  Ee.guides,
1905
1914
  e.focusedPieceId ?? null
1906
1915
  ) : void 0;
1907
1916
  let Ze = Ee ? 0 : T;
1908
1917
  if (Ee && Ee.pieces.length === 1 && _) {
1909
- const Ke = Ee.pieces[0].id, Ae = (rn = Ee.guides) == null ? void 0 : rn[Ke], K = Ae == null ? void 0 : Ae.outerRadius, ue = Ae == null ? void 0 : Ae.boundary, me = ue && typeof ue == "object" && ue.kind === "roundedRect" ? ue.rx ?? ue.ry : void 0, Be = typeof K == "number" && K > 0 ? K : typeof me == "number" && me > 0 ? me : 0;
1918
+ const Ke = Ee.pieces[0].id, Ae = (rn = Ee.guides) == null ? void 0 : rn[Ke], K = Ae == null ? void 0 : Ae.outerRadius, ue = Ae == null ? void 0 : Ae.boundary, ge = ue && typeof ue == "object" && ue.kind === "roundedRect" ? ue.rx ?? ue.ry : void 0, Be = typeof K == "number" && K > 0 ? K : typeof ge == "number" && ge > 0 ? ge : 0;
1910
1919
  Be > 0 && (Ze = Be);
1911
1920
  }
1912
1921
  if (_ && !Ee)
1913
- if (se.fillStyle = H, rt && typeof rt == "object" && rt.type === "path")
1922
+ if (se.fillStyle = Y, rt && typeof rt == "object" && rt.type === "path")
1914
1923
  try {
1915
1924
  const Ke = new Path2D(rt.d);
1916
1925
  se.save(), se.translate(_.x, _.y), se.fill(Ke), se.restore();
@@ -1935,10 +1944,10 @@ function pi(e, t, n) {
1935
1944
  _.height
1936
1945
  );
1937
1946
  _ && !Ee && c.render(se, _, !0);
1938
- let gt = m || d, Nt = i.get(ot) || [];
1947
+ let gt = m || d, Dt = i.get(ot) || [];
1939
1948
  if (x.getMode() === "drag" && d) {
1940
1949
  const Ue = x.getContext()._cachedElement;
1941
- Ue && Ue[d.id] && (Nt = Nt.map(
1950
+ Ue && Ue[d.id] && (Dt = Dt.map(
1942
1951
  (Ae) => Ae.id === d.id ? Ue[d.id] : Ae
1943
1952
  ), m || (gt = Ue[d.id]));
1944
1953
  }
@@ -1947,18 +1956,18 @@ function pi(e, t, n) {
1947
1956
  if (!(Ue !== null && Ue.elementId === d.id && Ue.childId === Ke && Ue.editRichText === V)) {
1948
1957
  let K = null;
1949
1958
  if (Ke && d instanceof Re) {
1950
- const ue = Nt.find(
1951
- (me) => me.id === d.id && me instanceof Re
1959
+ const ue = Dt.find(
1960
+ (ge) => ge.id === d.id && ge instanceof Re
1952
1961
  );
1953
1962
  if (ue) {
1954
- const me = ue.clone();
1955
- me.children = me.children.map((Be) => {
1963
+ const ge = ue.clone();
1964
+ ge.children = ge.children.map((Be) => {
1956
1965
  if (Be.id === Ke && V && Be instanceof Qe) {
1957
1966
  const Je = Be.clone();
1958
1967
  return Je.setRichText(V), Je;
1959
1968
  }
1960
1969
  return Be;
1961
- }), K = me;
1970
+ }), K = ge;
1962
1971
  }
1963
1972
  } else if (V && d instanceof Qe) {
1964
1973
  const ue = d.clone();
@@ -1968,27 +1977,27 @@ function pi(e, t, n) {
1968
1977
  }
1969
1978
  if (n.current) {
1970
1979
  const { clonedElement: K } = n.current;
1971
- Nt = Nt.map(
1980
+ Dt = Dt.map(
1972
1981
  (ue) => ue.id === d.id ? K : ue
1973
1982
  );
1974
1983
  }
1975
1984
  } else
1976
1985
  n.current = null;
1977
- const Dt = We || At.isActive() && d instanceof wn || w;
1986
+ const Nt = We || At.isActive() && d instanceof wn || w;
1978
1987
  if (Ws.render({
1979
1988
  ctx: se,
1980
- elements: Nt,
1989
+ elements: Dt,
1981
1990
  selectedId: f,
1982
1991
  selectedElement: gt || null,
1983
1992
  transformHandles: b,
1984
1993
  currentRotation: O,
1985
1994
  isRotating: P,
1986
- hoverState: N,
1995
+ hoverState: D,
1987
1996
  isEditing: w,
1988
1997
  stateMachine: x,
1989
1998
  snapGuides: Se,
1990
1999
  spacingIndicators: Te,
1991
- hideHandles: Dt,
2000
+ hideHandles: Nt,
1992
2001
  isAltKeyPressed: Oe,
1993
2002
  artboardBackgroundColor: _ == null ? void 0 : _.backgroundColor,
1994
2003
  distressTexture: _ == null ? void 0 : _.distressTexture,
@@ -2014,9 +2023,9 @@ function pi(e, t, n) {
2014
2023
  suppressOverflowDim: !1,
2015
2024
  showRotationHandle: g,
2016
2025
  editModeData: w ? (() => {
2017
- const Ke = xe.current, Ue = Date.now() - ie.current < be, Ae = Ke && Ue;
2026
+ const Ke = me.current, Ue = Date.now() - ie.current < be, Ae = Ke && Ue;
2018
2027
  return {
2019
- cursorPosition: Ae ? Ke.cursor : D,
2028
+ cursorPosition: Ae ? Ke.cursor : N,
2020
2029
  selectionStart: Ae ? Ke.start : u,
2021
2030
  selectionEnd: Ae ? Ke.end : j,
2022
2031
  editText: ne,
@@ -2031,8 +2040,8 @@ function pi(e, t, n) {
2031
2040
  const Ue = gt ?? null;
2032
2041
  if (Ue && Ee) {
2033
2042
  const ue = Ue.getVisualBoundingBox();
2034
- e: for (const me of Ee.pieces) {
2035
- const Be = ((Ut = (on = Ee.guides) == null ? void 0 : on[me.id]) == null ? void 0 : Ut.zones) ?? [];
2043
+ e: for (const ge of Ee.pieces) {
2044
+ const Be = ((Ut = (on = Ee.guides) == null ? void 0 : on[ge.id]) == null ? void 0 : Ut.zones) ?? [];
2036
2045
  for (const Je of Be) {
2037
2046
  if (Je.kind !== "dieCut") continue;
2038
2047
  const Ge = Je.path;
@@ -2040,7 +2049,7 @@ function pi(e, t, n) {
2040
2049
  Ke = !0;
2041
2050
  break e;
2042
2051
  }
2043
- const Fe = me.x + (Ge.x ?? 0), nt = me.y + (Ge.y ?? 0), st = Ge.width ?? 0, xt = Ge.height ?? 0;
2052
+ const Fe = ge.x + (Ge.x ?? 0), nt = ge.y + (Ge.y ?? 0), st = Ge.width ?? 0, xt = Ge.height ?? 0;
2044
2053
  if (ue.x < Fe + st && ue.x + ue.width > Fe && ue.y < nt + xt && ue.y + ue.height > nt) {
2045
2054
  Ke = !0;
2046
2055
  break e;
@@ -2055,7 +2064,7 @@ function pi(e, t, n) {
2055
2064
  _.width,
2056
2065
  _.height,
2057
2066
  Ze
2058
- ), se.clip()), jo({
2067
+ ), se.clip()), Zo({
2059
2068
  ctx: se,
2060
2069
  artboardOrigin: { x: _.x, y: _.y },
2061
2070
  artboardWidth: _.width,
@@ -2068,11 +2077,11 @@ function pi(e, t, n) {
2068
2077
  interacting: Ae,
2069
2078
  focusedPieceId: e.focusedPieceId ?? null
2070
2079
  }), K && se.restore(), e.focusedPieceId && Ee.pieces.length > 1) {
2071
- const ue = e.focusedPieceRect ?? Ee.pieces.find((me) => me.id === e.focusedPieceId) ?? null;
2080
+ const ue = e.focusedPieceRect ?? Ee.pieces.find((ge) => ge.id === e.focusedPieceId) ?? null;
2072
2081
  if (ue) {
2073
2082
  se.save(), se.translate(_.x, _.y), se.globalCompositeOperation = "destination-out";
2074
- const me = !!d;
2075
- se.globalAlpha = me ? 1 - 0.3 : 1, se.fillStyle = "#000", se.beginPath();
2083
+ const ge = !!d;
2084
+ se.globalAlpha = ge ? 1 - 0.3 : 1, se.fillStyle = "#000", se.beginPath();
2076
2085
  const Be = 1e7;
2077
2086
  se.rect(-Be, -Be, 2 * Be, 2 * Be), se.rect(
2078
2087
  ue.x,
@@ -2090,9 +2099,9 @@ function pi(e, t, n) {
2090
2099
  stateMachine: x,
2091
2100
  currentRotation: O,
2092
2101
  isRotating: P,
2093
- hoverState: N,
2102
+ hoverState: D,
2094
2103
  selectedId: f,
2095
- hideHandles: Dt,
2104
+ hideHandles: Nt,
2096
2105
  isEditing: w,
2097
2106
  isAltKeyPressed: Oe,
2098
2107
  artboardBackgroundColor: _.backgroundColor,
@@ -2113,11 +2122,11 @@ function pi(e, t, n) {
2113
2122
  zoom: A,
2114
2123
  paddingOffset: { x: R, y: E }
2115
2124
  });
2116
- const tn = pt ? zt : De, Ht = new Set(Nt.map((Ke) => Ke.id)), { updatedOBB: wt, groupBounds: Xt } = ii({
2125
+ const tn = pt ? zt : Ne, Yt = new Set(Dt.map((Ke) => Ke.id)), { updatedOBB: wt, groupBounds: Xt } = ai({
2117
2126
  ctx: se,
2118
2127
  displaySelection: tn,
2119
2128
  elements: o,
2120
- activeArtboardElementIds: Ht,
2129
+ activeArtboardElementIds: Yt,
2121
2130
  stateMachine: x,
2122
2131
  multiSelectionOBB: $e.current,
2123
2132
  isRotating: P,
@@ -2125,9 +2134,9 @@ function pi(e, t, n) {
2125
2134
  isMarqueeSelecting: pt,
2126
2135
  zoom: A
2127
2136
  });
2128
- wt && $e.current !== wt && ($e.current = wt), at.current = Xt, pt && li({ ctx: se, marqueeStart: ct, marqueeEnd: Pt, zoom: A }), N.type === "group-sibling" && N.data && di({ ctx: se, hoveredChild: N.data, zoom: A }), At.isActive() && d instanceof wn && At.renderPreview(se, d);
2137
+ wt && $e.current !== wt && ($e.current = wt), at.current = Xt, pt && di({ ctx: se, marqueeStart: ct, marqueeEnd: Pt, zoom: A }), D.type === "group-sibling" && D.data && ui({ ctx: se, hoveredChild: D.data, zoom: A }), At.isActive() && d instanceof wn && At.renderPreview(se, d);
2129
2138
  }
2130
- class mi {
2139
+ class gi {
2131
2140
  /**
2132
2141
  * Apply the pinch gesture to `element` in place and return it. The
2133
2142
  * element is expected to already be a clone (the state machine
@@ -2150,7 +2159,7 @@ class mi {
2150
2159
  return E = (E % 360 + 360) % 360, E > 180 && (E -= 360), l && (E = l(E, t)), t.setRotation(E), t;
2151
2160
  }
2152
2161
  }
2153
- function gi(e) {
2162
+ function xi(e) {
2154
2163
  const { x: t, y: n, bounds: s, zoom: o = 1 } = e, i = eo / o, a = s.rotation || 0, c = [
2155
2164
  { x: s.minX, y: s.minY, anchor: "top-left" },
2156
2165
  { x: s.maxX, y: s.minY, anchor: "top-right" },
@@ -2184,7 +2193,7 @@ function gi(e) {
2184
2193
  }
2185
2194
  return m >= s.minX && m <= s.maxX && p >= s.minY && p <= s.maxY ? { type: "bounds-drag" } : { type: "none" };
2186
2195
  }
2187
- function xi(e) {
2196
+ function yi(e) {
2188
2197
  const { multiSelection: t, elements: n, bounds: s, anchor: o, corner: i, x: a, y: l, stateMachine: c } = e, f = t.map((d) => n.find((m) => m.id === d)).filter((d) => d !== void 0 && !d.locked);
2189
2198
  return f.length === 0 ? !1 : (c._multiSelectionResizeContext = {
2190
2199
  anchor: o,
@@ -2219,7 +2228,7 @@ function xi(e) {
2219
2228
  }
2220
2229
  ), !0);
2221
2230
  }
2222
- function yi(e) {
2231
+ function bi(e) {
2223
2232
  const {
2224
2233
  multiSelection: t,
2225
2234
  elements: n,
@@ -2250,7 +2259,7 @@ function yi(e) {
2250
2259
  // Initial rotation for the group
2251
2260
  ), !0;
2252
2261
  }
2253
- function bi(e) {
2262
+ function vi(e) {
2254
2263
  const { multiSelection: t, elements: n, x: s, y: o, stateMachine: i, dragOriginalElementsRef: a, setHoverState: l } = e, c = t.map((f) => n.find((d) => d.id === f)).filter((f) => f !== void 0 && !f.locked);
2255
2264
  return c.length === 0 ? !1 : (i._multiSelectionDragContext = {
2256
2265
  startX: s,
@@ -2265,20 +2274,20 @@ function bi(e) {
2265
2274
  a.current.set(f.id, f.clone());
2266
2275
  }), i.startDrag(c[0], s, o), l({ type: null, data: null }), !0);
2267
2276
  }
2268
- function vi(e) {
2277
+ function Ci(e) {
2269
2278
  const { selectedElement: t, activeChildElement: n } = e;
2270
2279
  let s = null, o = -1;
2271
- if (n instanceof Yt && n.isCropping)
2280
+ if (n instanceof Lt && n.isCropping)
2272
2281
  s = n, t instanceof Re && (o = t.children.findIndex((a) => a.id === n.id));
2273
2282
  else if (t instanceof Re)
2274
2283
  for (let a = 0; a < t.children.length; a++) {
2275
2284
  const l = t.children[a];
2276
- if (l.visible !== !1 && l instanceof Yt && l.isCropping) {
2285
+ if (l.visible !== !1 && l instanceof Lt && l.isCropping) {
2277
2286
  s = l, o = a;
2278
2287
  break;
2279
2288
  }
2280
2289
  }
2281
- const i = s || (t instanceof Yt && t.isCropping ? t : null);
2290
+ const i = s || (t instanceof Lt && t.isCropping ? t : null);
2282
2291
  return i ? {
2283
2292
  croppingImage: i,
2284
2293
  croppingChild: s,
@@ -2286,14 +2295,14 @@ function vi(e) {
2286
2295
  isChildInGroup: s !== null
2287
2296
  } : null;
2288
2297
  }
2289
- function Ci(e) {
2298
+ function wi(e) {
2290
2299
  const { x: t, y: n, cropContext: s, transformHandles: o, zoom: i = 1 } = e, { croppingImage: a } = s, l = a.hitTestCropHandle(t, n, i);
2291
2300
  if (l)
2292
2301
  return { type: "crop-handle", handle: l };
2293
2302
  const c = o.hitTestResize(t, n, i);
2294
2303
  return c ? { type: "image-handle", handle: c } : a.hitTest(t, n) ? { type: "image-drag" } : { type: "exit-crop" };
2295
2304
  }
2296
- function wi(e) {
2305
+ function Si(e) {
2297
2306
  const { cropContext: t, cropHandle: n, x: s, y: o, selectedElement: i, activeChildElement: a, stateMachine: l } = e, { croppingImage: c, croppingChild: f, croppingChildIndex: d } = t, m = c.getCropBoxBounds();
2298
2307
  m && (l.startResize(
2299
2308
  c,
@@ -2319,7 +2328,7 @@ function wi(e) {
2319
2328
  childIndex: d
2320
2329
  }));
2321
2330
  }
2322
- function Si(e) {
2331
+ function Ei(e) {
2323
2332
  const { cropContext: t, imageHandle: n, x: s, y: o, selectedElement: i, activeChildElement: a, stateMachine: l } = e, { croppingImage: c, croppingChild: f, croppingChildIndex: d } = t, m = c.getBoundingBox(), p = c.getVisualBoundingBox();
2324
2333
  l.startResize(c, n, s, o, m, p), f && (a && a.id === f.id ? l._activeChildContext = {
2325
2334
  group: i,
@@ -2329,7 +2338,7 @@ function Si(e) {
2329
2338
  childIndex: d
2330
2339
  });
2331
2340
  }
2332
- function Ei(e) {
2341
+ function ki(e) {
2333
2342
  const { cropContext: t, x: n, y: s, selectedElement: o, activeChildElement: i, stateMachine: a, dragOriginalElementsRef: l, setHoverState: c } = e, { croppingImage: f, croppingChild: d, croppingChildIndex: m } = t;
2334
2343
  l.current = /* @__PURE__ */ new Map(), d && o ? l.current.set(o.id, o.clone()) : l.current.set(f.id, f.clone()), a.startDrag(f, n, s, "crop-image-drag"), c({ type: null, data: null }), d && (i && i.id === d.id ? a._activeChildContext = {
2335
2344
  group: o,
@@ -2339,7 +2348,7 @@ function Ei(e) {
2339
2348
  childIndex: m
2340
2349
  });
2341
2350
  }
2342
- function ki(e) {
2351
+ function Ri(e) {
2343
2352
  const { cropContext: t, selectedElement: n, onElementUpdate: s, transformHandles: o, updateActiveChild: i, zoom: a } = e, { croppingImage: l, croppingChild: c, croppingChildIndex: f } = t;
2344
2353
  if (c && n instanceof Re) {
2345
2354
  const d = c.clone();
@@ -2351,7 +2360,7 @@ function ki(e) {
2351
2360
  d.exitCropMode(), s(d), o.update(d, a);
2352
2361
  }
2353
2362
  }
2354
- function Ri(e) {
2363
+ function Mi(e) {
2355
2364
  const {
2356
2365
  x: t,
2357
2366
  y: n,
@@ -2380,7 +2389,7 @@ function Zs(e) {
2380
2389
  const { updateActiveChild: t, selectedElement: n, transformHandles: s, setHandlesVersion: o, zoom: i } = e;
2381
2390
  t(null), n && (s.update(n, i), o((a) => a + 1));
2382
2391
  }
2383
- function Mi(e) {
2392
+ function Ti(e) {
2384
2393
  const {
2385
2394
  x: t,
2386
2395
  y: n,
@@ -2428,7 +2437,7 @@ function Mi(e) {
2428
2437
  }
2429
2438
  return !1;
2430
2439
  }
2431
- const Ti = 900;
2440
+ const Ii = 900;
2432
2441
  function hs(e, t, n, s) {
2433
2442
  if (!s) return !0;
2434
2443
  const o = e.getVisualBoundingBox(), i = Math.max(o.x, s.x), a = Math.max(o.y, s.y), l = Math.min(
@@ -2438,9 +2447,9 @@ function hs(e, t, n, s) {
2438
2447
  o.y + o.height,
2439
2448
  s.y + s.height
2440
2449
  );
2441
- return Math.max(0, l - i) * Math.max(0, c - a) < Ti ? !0 : t >= s.x && t <= s.x + s.width && n >= s.y && n <= s.y + s.height;
2450
+ return Math.max(0, l - i) * Math.max(0, c - a) < Ii ? !0 : t >= s.x && t <= s.x + s.width && n >= s.y && n <= s.y + s.height;
2442
2451
  }
2443
- function Ii(e) {
2452
+ function Pi(e) {
2444
2453
  const {
2445
2454
  canvasRef: t,
2446
2455
  inputRef: n,
@@ -2466,24 +2475,24 @@ function Ii(e) {
2466
2475
  isEditing: g,
2467
2476
  editText: P,
2468
2477
  isTouchDevice: O,
2469
- selectionStart: N,
2478
+ selectionStart: D,
2470
2479
  selectionEnd: w,
2471
2480
  isRotating: ne,
2472
2481
  isMarqueeSelecting: V,
2473
- isAltKeyPressed: D,
2482
+ isAltKeyPressed: N,
2474
2483
  selectedElement: u,
2475
2484
  activeChildElement: j,
2476
2485
  elements: G,
2477
2486
  multiSelection: te,
2478
2487
  multiSelectionOBBRef: ae,
2479
2488
  zoom: $,
2480
- paddingOffsetX: xe,
2489
+ paddingOffsetX: me,
2481
2490
  paddingOffsetY: ie,
2482
2491
  spacingIndicators: be,
2483
2492
  focusedPieceRect: Se,
2484
2493
  setCursorPosition: Te,
2485
2494
  setSelectionStart: Oe,
2486
- setSelectionEnd: De,
2495
+ setSelectionEnd: Ne,
2487
2496
  setIsRotating: $e,
2488
2497
  setRotationStartAngle: at,
2489
2498
  setCurrentRotation: pt,
@@ -2499,31 +2508,31 @@ function Ii(e) {
2499
2508
  transformHandles: U,
2500
2509
  snapSystem: re,
2501
2510
  spacingSystem: he,
2502
- penTool: L,
2511
+ penTool: H,
2503
2512
  cropController: Ce,
2504
- onElementUpdate: Ie,
2513
+ onElementUpdate: Pe,
2505
2514
  executeElementUpdate: Ve,
2506
2515
  onSelectionChange: Xe,
2507
- onMultiSelectionChange: H,
2516
+ onMultiSelectionChange: Y,
2508
2517
  onRotationStateChange: _,
2509
2518
  onCropModeEnter: ot,
2510
2519
  onContextMenuRequest: rt,
2511
2520
  updateActiveChild: Ze,
2512
2521
  getActiveArtboardElements: gt,
2513
- startMarqueeSelection: Nt,
2514
- updateMarqueeSelection: Dt,
2522
+ startMarqueeSelection: Dt,
2523
+ updateMarqueeSelection: Nt,
2515
2524
  finishMarqueeSelection: tn,
2516
- enterTextEditMode: Ht,
2525
+ enterTextEditMode: Yt,
2517
2526
  setEditPosition: wt,
2518
2527
  setEditText: Xt,
2519
2528
  setEditRichText: rn,
2520
2529
  setIsEditing: on,
2521
2530
  setCurrentFormattingStyle: Ut,
2522
2531
  getWrappedTextForEditing: Ke
2523
- } = e, Ue = we(null), Ae = we(/* @__PURE__ */ new Map()), K = we(null), ue = we(null), me = we(null), Be = we(null), Je = we(null), Ge = we(null), Fe = we(null), { userZoom: nt, setUserZoom: st, panOffset: xt, setPanOffset: yt } = Ts(), Lt = we(nt);
2524
- Lt.current = nt;
2532
+ } = e, Ue = we(null), Ae = we(/* @__PURE__ */ new Map()), K = we(null), ue = we(null), ge = we(null), Be = we(null), Je = we(null), Ge = we(null), Fe = we(null), { userZoom: nt, setUserZoom: st, panOffset: xt, setPanOffset: yt } = Ts(), Ht = we(nt);
2533
+ Ht.current = nt;
2525
2534
  const ve = we(xt);
2526
- ve.current = xt, Pe(() => {
2535
+ ve.current = xt, Ie(() => {
2527
2536
  const z = t.current;
2528
2537
  if (!z) return;
2529
2538
  const fe = () => {
@@ -2532,7 +2541,7 @@ function Ii(e) {
2532
2541
  return fe(), window.addEventListener("scroll", fe, { passive: !0, capture: !0 }), window.addEventListener("resize", fe, { passive: !0 }), () => {
2533
2542
  window.removeEventListener("scroll", fe, { capture: !0 }), window.removeEventListener("resize", fe);
2534
2543
  };
2535
- }, [t]), Pe(() => {
2544
+ }, [t]), Ie(() => {
2536
2545
  const z = t.current;
2537
2546
  z && (Ue.current = z.getBoundingClientRect());
2538
2547
  }, [$, t]);
@@ -2544,16 +2553,16 @@ function Ii(e) {
2544
2553
  if (!fe) return;
2545
2554
  const dt = fe.getBoundingClientRect();
2546
2555
  Ue.current = dt;
2547
- const W = (z.clientX - dt.left) / $ - xe, Z = (z.clientY - dt.top) / $ - ie;
2548
- Ae.current.size === 0 && (me.current = (u == null ? void 0 : u.id) ?? null), Ae.current.set(z.pointerId, {
2556
+ const W = (z.clientX - dt.left) / $ - me, Z = (z.clientY - dt.top) / $ - ie;
2557
+ Ae.current.size === 0 && (ge.current = (u == null ? void 0 : u.id) ?? null), Ae.current.set(z.pointerId, {
2549
2558
  x: W,
2550
2559
  y: Z,
2551
2560
  clientX: z.clientX,
2552
2561
  clientY: z.clientY
2553
2562
  });
2554
- const et = g || u instanceof Yt && u.isCropping || L.isActive();
2563
+ const et = g || u instanceof Lt && u.isCropping || H.isActive();
2555
2564
  if (Ae.current.size === 2 && !et) {
2556
- const k = Array.from(Ae.current.keys()), X = Ae.current.get(k[0]), M = Ae.current.get(k[1]), F = me.current !== null;
2565
+ const k = Array.from(Ae.current.keys()), X = Ae.current.get(k[0]), M = Ae.current.get(k[1]), F = ge.current !== null;
2557
2566
  if (!(F && u && !u.locked && (u.hitTest(X.x, X.y) || u.hitTest(M.x, M.y)))) {
2558
2567
  if (b.current && b.current.size > 0) {
2559
2568
  const Bt = b.current;
@@ -2565,17 +2574,17 @@ function Ii(e) {
2565
2574
  ), b.current = null;
2566
2575
  }
2567
2576
  !F && u && Xe(null), h.isInteracting() && h.end(), Fe.current = null, Be.current = null, Je.current = null, delete h._pendingTextEditMode, delete h._pendingChildSelection;
2568
- const oe = M.clientX - X.clientX, Me = M.clientY - X.clientY, Ye = Math.hypot(oe, Me), bt = (((q = fe.parentElement) == null ? void 0 : q.parentElement) ?? fe).getBoundingClientRect();
2577
+ const oe = M.clientX - X.clientX, Me = M.clientY - X.clientY, Le = Math.hypot(oe, Me), bt = (((q = fe.parentElement) == null ? void 0 : q.parentElement) ?? fe).getBoundingClientRect();
2569
2578
  Ge.current = {
2570
2579
  pointerA: k[0],
2571
2580
  pointerB: k[1],
2572
- startUserZoom: Lt.current,
2581
+ startUserZoom: Ht.current,
2573
2582
  startPanOffset: { ...ve.current },
2574
2583
  startCentroidClient: {
2575
2584
  x: (X.clientX + M.clientX) / 2,
2576
2585
  y: (X.clientY + M.clientY) / 2
2577
2586
  },
2578
- startDistance: Math.max(Ye, 1),
2587
+ startDistance: Math.max(Le, 1),
2579
2588
  containerRect: { left: bt.left, top: bt.top }
2580
2589
  };
2581
2590
  try {
@@ -2609,10 +2618,10 @@ function Ii(e) {
2609
2618
  return;
2610
2619
  }
2611
2620
  if (g && u instanceof Qe) {
2612
- if (O && N !== w) {
2621
+ if (O && D !== w) {
2613
2622
  const k = m.current;
2614
2623
  if (k.start || k.end) {
2615
- const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ce = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Ye = F * oe - ce * Me, it = F * Me + ce * oe, bt = Ye, Bt = it, St = 44 / $;
2624
+ const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ce = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Le = F * oe - ce * Me, it = F * Me + ce * oe, bt = Le, Bt = it, St = 44 / $;
2616
2625
  if (k.start && Math.sqrt(
2617
2626
  Math.pow(bt - k.start.center.x, 2) + Math.pow(Bt - k.start.center.y, 2)
2618
2627
  ) <= St) {
@@ -2629,7 +2638,7 @@ function Ii(e) {
2629
2638
  }
2630
2639
  if (u.hitTest(W, Z)) {
2631
2640
  z.preventDefault(), s.current = !0;
2632
- const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ce = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Ye = F * oe - ce * Me, it = F * Me + ce * oe, bt = Ye + k.width / 2, Bt = it + k.height / 2, St = Sn(u, { x: bt, y: Bt }), Et = Date.now();
2641
+ const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ce = Z - M.y, oe = Math.cos(X), Me = Math.sin(X), Le = F * oe - ce * Me, it = F * Me + ce * oe, bt = Le + k.width / 2, Bt = it + k.height / 2, St = Sn(u, { x: bt, y: Bt }), Et = Date.now();
2633
2642
  if (Et - a.current < I) {
2634
2643
  (ee = n.current) == null || ee.focus();
2635
2644
  return;
@@ -2637,32 +2646,32 @@ function Ii(e) {
2637
2646
  a.current = Et, Et - l.current >= T && (c.current = null), Et - o.current < A ? i.current += 1 : i.current = 1, o.current = Et;
2638
2647
  const ut = P;
2639
2648
  if (i.current >= 3)
2640
- z.preventDefault(), l.current = Et, c.current = { start: 0, end: ut.length, cursor: ut.length }, f.current = !0, i.current = 0, Te(ut.length), Oe(0), De(ut.length), n.current && (n.current.focus(), n.current.setSelectionRange(0, ut.length));
2649
+ z.preventDefault(), l.current = Et, c.current = { start: 0, end: ut.length, cursor: ut.length }, f.current = !0, i.current = 0, Te(ut.length), Oe(0), Ne(ut.length), n.current && (n.current.focus(), n.current.setSelectionRange(0, ut.length));
2641
2650
  else if (i.current === 2) {
2642
2651
  z.preventDefault(), l.current = Et, f.current = !0;
2643
2652
  const kt = yr(ut, St);
2644
- c.current = { start: kt.start, end: kt.end, cursor: kt.end }, Te(kt.end), Oe(kt.start), De(kt.end), n.current && (n.current.focus(), n.current.setSelectionRange(kt.start, kt.end));
2653
+ c.current = { start: kt.start, end: kt.end, cursor: kt.end }, Te(kt.end), Oe(kt.start), Ne(kt.end), n.current && (n.current.focus(), n.current.setSelectionRange(kt.start, kt.end));
2645
2654
  } else
2646
- c.current = null, Te(St), Oe(St), De(St), n.current && (n.current.focus(), n.current.setSelectionRange(St, St)), f.current = !1;
2655
+ c.current = null, Te(St), Oe(St), Ne(St), n.current && (n.current.focus(), n.current.setSelectionRange(St, St)), f.current = !1;
2647
2656
  return;
2648
2657
  }
2649
2658
  c.current = null, (J = n.current) == null || J.blur();
2650
2659
  return;
2651
2660
  }
2652
2661
  if (g) return;
2653
- if (z.target.setPointerCapture(z.pointerId), L.isActive() && u instanceof wn) {
2662
+ if (z.target.setPointerCapture(z.pointerId), H.isActive() && u instanceof wn) {
2654
2663
  const k = W - u.x, X = Z - u.y;
2655
- if (L.canClosePath(k, X, 15)) {
2656
- L.startClosing(k, X), L.startDraggingHandle(), We((M) => M + 1);
2664
+ if (H.canClosePath(k, X, 15)) {
2665
+ H.startClosing(k, X), H.startDraggingHandle(), We((M) => M + 1);
2657
2666
  return;
2658
2667
  }
2659
- L.addPoint(k, X), L.startDraggingHandle(), We((M) => M + 1);
2668
+ H.addPoint(k, X), H.startDraggingHandle(), We((M) => M + 1);
2660
2669
  return;
2661
2670
  }
2662
2671
  if (te.length > 0 && E.current) {
2663
- const k = E.current, X = gi({ x: W, y: Z, bounds: k, zoom: $ });
2672
+ const k = E.current, X = xi({ x: W, y: Z, bounds: k, zoom: $ });
2664
2673
  if (X.type === "corner-handle") {
2665
- if (xi({
2674
+ if (yi({
2666
2675
  multiSelection: te,
2667
2676
  elements: G,
2668
2677
  bounds: k,
@@ -2676,7 +2685,7 @@ function Ii(e) {
2676
2685
  return;
2677
2686
  }
2678
2687
  } else if (X.type === "rotation-handle") {
2679
- if (yi({
2688
+ if (bi({
2680
2689
  multiSelection: te,
2681
2690
  elements: G,
2682
2691
  bounds: k,
@@ -2690,7 +2699,7 @@ function Ii(e) {
2690
2699
  se({});
2691
2700
  return;
2692
2701
  }
2693
- } else if (X.type === "bounds-drag" && bi({
2702
+ } else if (X.type === "bounds-drag" && vi({
2694
2703
  multiSelection: te,
2695
2704
  elements: G,
2696
2705
  x: W,
@@ -2705,11 +2714,11 @@ function Ii(e) {
2705
2714
  }
2706
2715
  const B = j || u;
2707
2716
  if (B && B.visible !== !1 && !B.locked && (te.length === 0 || j)) {
2708
- const k = vi({ selectedElement: u || null, activeChildElement: j });
2717
+ const k = Ci({ selectedElement: u || null, activeChildElement: j });
2709
2718
  if (k) {
2710
- const M = Ci({ x: W, y: Z, cropContext: k, transformHandles: U, zoom: $ });
2719
+ const M = wi({ x: W, y: Z, cropContext: k, transformHandles: U, zoom: $ });
2711
2720
  if (M.type === "crop-handle") {
2712
- wi({
2721
+ Si({
2713
2722
  cropContext: k,
2714
2723
  cropHandle: M.handle,
2715
2724
  x: W,
@@ -2720,7 +2729,7 @@ function Ii(e) {
2720
2729
  }), se({});
2721
2730
  return;
2722
2731
  } else if (M.type === "image-handle") {
2723
- Si({
2732
+ Ei({
2724
2733
  cropContext: k,
2725
2734
  imageHandle: M.handle,
2726
2735
  x: W,
@@ -2731,7 +2740,7 @@ function Ii(e) {
2731
2740
  }), se({});
2732
2741
  return;
2733
2742
  } else if (M.type === "image-drag") {
2734
- Ei({
2743
+ ki({
2735
2744
  cropContext: k,
2736
2745
  x: W,
2737
2746
  y: Z,
@@ -2743,10 +2752,10 @@ function Ii(e) {
2743
2752
  }), se({});
2744
2753
  return;
2745
2754
  } else if (M.type === "exit-crop") {
2746
- ki({
2755
+ Ri({
2747
2756
  cropContext: k,
2748
2757
  selectedElement: u || null,
2749
- onElementUpdate: Ie,
2758
+ onElementUpdate: Pe,
2750
2759
  transformHandles: U,
2751
2760
  updateActiveChild: Ze,
2752
2761
  zoom: $
@@ -2793,7 +2802,7 @@ function Ii(e) {
2793
2802
  }
2794
2803
  }
2795
2804
  if (j && u instanceof Re) {
2796
- if (Ri({
2805
+ if (Mi({
2797
2806
  x: W,
2798
2807
  y: Z,
2799
2808
  activeChildElement: j,
@@ -2854,24 +2863,24 @@ function Ii(e) {
2854
2863
  z.preventDefault();
2855
2864
  return;
2856
2865
  }
2857
- const ge = gt();
2858
- if (Mi({
2866
+ const xe = gt();
2867
+ if (Ti({
2859
2868
  x: W,
2860
2869
  y: Z,
2861
2870
  shiftKey: z.shiftKey,
2862
- activeArtboardElements: ge,
2871
+ activeArtboardElements: xe,
2863
2872
  selectedElement: u || null,
2864
2873
  multiSelection: te,
2865
2874
  onSelectionChange: Xe,
2866
- onMultiSelectionChange: H,
2875
+ onMultiSelectionChange: Y,
2867
2876
  stateMachine: h,
2868
2877
  dragOriginalElementsRef: b,
2869
2878
  setHoverState: Ee,
2870
2879
  forceUpdate: se
2871
2880
  })) return;
2872
- const Y = Xr.shouldProtectClick(), Q = Br(z.target);
2873
- if (!Y && !Q)
2874
- if (Lt.current > 1.001) {
2881
+ const L = Xr.shouldProtectClick(), Q = Br(z.target);
2882
+ if (!L && !Q)
2883
+ if (Ht.current > 1.001) {
2875
2884
  Fe.current = {
2876
2885
  pointerId: z.pointerId,
2877
2886
  startClientX: z.clientX,
@@ -2886,25 +2895,25 @@ function Ii(e) {
2886
2895
  }
2887
2896
  z.preventDefault();
2888
2897
  } else
2889
- Xe(null), H([]), Nt(W, Z);
2898
+ Xe(null), Y([]), Dt(W, Z);
2890
2899
  },
2891
2900
  [
2892
2901
  g,
2893
2902
  u,
2894
2903
  gt,
2895
2904
  Xe,
2896
- H,
2905
+ Y,
2897
2906
  U,
2898
2907
  j,
2899
2908
  te,
2900
2909
  h,
2901
- L,
2910
+ H,
2902
2911
  Ve,
2903
2912
  We,
2904
2913
  $,
2905
2914
  Te,
2906
2915
  Oe,
2907
- De,
2916
+ Ne,
2908
2917
  // Canvas-zoom pinch entry uses these setters / refs.
2909
2918
  t,
2910
2919
  lt,
@@ -2916,21 +2925,21 @@ function Ii(e) {
2916
2925
  if (z.buttons === 2) return;
2917
2926
  const fe = t.current;
2918
2927
  if (!fe) return;
2919
- const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / $ - xe, Z = (z.clientY - dt.top) / $ - ie;
2928
+ const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / $ - me, Z = (z.clientY - dt.top) / $ - ie;
2920
2929
  if (p.current = { x: W, y: Z }, Ae.current.has(z.pointerId) && Ae.current.set(z.pointerId, {
2921
2930
  x: W,
2922
2931
  y: Z,
2923
2932
  clientX: z.clientX,
2924
2933
  clientY: z.clientY
2925
2934
  }), Ge.current) {
2926
- const B = Ge.current, ge = Ae.current.get(B.pointerA), S = Ae.current.get(B.pointerB);
2927
- if (ge && S) {
2928
- const Y = S.clientX - ge.clientX, Q = S.clientY - ge.clientY, pe = Math.hypot(Y, Q) / B.startDistance, ke = Math.min(
2935
+ const B = Ge.current, xe = Ae.current.get(B.pointerA), S = Ae.current.get(B.pointerB);
2936
+ if (xe && S) {
2937
+ const L = S.clientX - xe.clientX, Q = S.clientY - xe.clientY, pe = Math.hypot(L, Q) / B.startDistance, ke = Math.min(
2929
2938
  Math.max(B.startUserZoom * pe, 0.25),
2930
2939
  8
2931
- ), ee = B.startCentroidClient.x - B.containerRect.left, J = B.startCentroidClient.y - B.containerRect.top, k = (ge.clientX + S.clientX) / 2 - B.containerRect.left, X = (ge.clientY + S.clientY) / 2 - B.containerRect.top, M = ke / B.startUserZoom, F = k - (ee - B.startPanOffset.x) * M, ce = X - (J - B.startPanOffset.y) * M, oe = t.current;
2940
+ ), ee = B.startCentroidClient.x - B.containerRect.left, J = B.startCentroidClient.y - B.containerRect.top, k = (xe.clientX + S.clientX) / 2 - B.containerRect.left, X = (xe.clientY + S.clientY) / 2 - B.containerRect.top, M = ke / B.startUserZoom, F = k - (ee - B.startPanOffset.x) * M, ce = X - (J - B.startPanOffset.y) * M, oe = t.current;
2932
2941
  if (oe) {
2933
- const Me = oe.getBoundingClientRect(), Ye = (et = oe.parentElement) == null ? void 0 : et.parentElement, it = (Ye == null ? void 0 : Ye.clientWidth) ?? Me.width, bt = (Ye == null ? void 0 : Ye.clientHeight) ?? Me.height, Bt = 80, St = ke / Math.max(Lt.current, 1e-4), Et = Me.width * St, Gt = Me.height * St, ut = ve.current.x, kt = ve.current.y, kn = Me.left - B.containerRect.left, Ft = Me.top - B.containerRect.top, qt = kn + (F - ut), jt = Ft + (ce - kt), _t = Math.min(
2942
+ const Me = oe.getBoundingClientRect(), Le = (et = oe.parentElement) == null ? void 0 : et.parentElement, it = (Le == null ? void 0 : Le.clientWidth) ?? Me.width, bt = (Le == null ? void 0 : Le.clientHeight) ?? Me.height, Bt = 80, St = ke / Math.max(Ht.current, 1e-4), Et = Me.width * St, Gt = Me.height * St, ut = ve.current.x, kt = ve.current.y, kn = Me.left - B.containerRect.left, Ft = Me.top - B.containerRect.top, qt = kn + (F - ut), jt = Ft + (ce - kt), _t = Math.min(
2934
2943
  Math.max(qt, -Et + Bt),
2935
2944
  it - Bt
2936
2945
  ), $t = Math.min(
@@ -2947,24 +2956,24 @@ function Ii(e) {
2947
2956
  return;
2948
2957
  }
2949
2958
  if (Fe.current && Fe.current.pointerId === z.pointerId) {
2950
- const B = Fe.current, ge = z.clientX - B.startClientX, S = z.clientY - B.startClientY;
2959
+ const B = Fe.current, xe = z.clientX - B.startClientX, S = z.clientY - B.startClientY;
2951
2960
  if (!B.movedPastThreshold)
2952
- if (Math.hypot(ge, S) > 5)
2961
+ if (Math.hypot(xe, S) > 5)
2953
2962
  B.movedPastThreshold = !0, B.pendingTap = null;
2954
2963
  else
2955
2964
  return;
2956
- if (Lt.current <= 1.001) return;
2965
+ if (Ht.current <= 1.001) return;
2957
2966
  yt({
2958
- x: B.startPanOffset.x + ge,
2967
+ x: B.startPanOffset.x + xe,
2959
2968
  y: B.startPanOffset.y + S
2960
2969
  });
2961
2970
  return;
2962
2971
  }
2963
2972
  if (h.getMode() === "pinch" && K.current) {
2964
- const { a: B, b: ge } = K.current, S = Ae.current.get(B), Y = Ae.current.get(ge);
2965
- if (S && Y) {
2966
- const Q = h.updatePinch(S, Y), { element: q, startData: pe } = h.getPinchContext();
2967
- mi.calculatePinch({
2973
+ const { a: B, b: xe } = K.current, S = Ae.current.get(B), L = Ae.current.get(xe);
2974
+ if (S && L) {
2975
+ const Q = h.updatePinch(S, L), { element: q, startData: pe } = h.getPinchContext();
2976
+ gi.calculatePinch({
2968
2977
  element: q,
2969
2978
  startData: pe,
2970
2979
  scale: Q.scale,
@@ -2982,57 +2991,57 @@ function Ii(e) {
2982
2991
  return;
2983
2992
  }
2984
2993
  if (d.current && u instanceof Qe) {
2985
- const B = u.getVisualBoundingBox(), ge = u.getRotationAnchor(), S = en.toRadiansInverse(u.rotation), Y = W - ge.x, Q = Z - ge.y, q = Math.cos(S), pe = Math.sin(S), ke = Y * q - Q * pe, ee = Y * pe + Q * q, J = m.current;
2994
+ const B = u.getVisualBoundingBox(), xe = u.getRotationAnchor(), S = en.toRadiansInverse(u.rotation), L = W - xe.x, Q = Z - xe.y, q = Math.cos(S), pe = Math.sin(S), ke = L * q - Q * pe, ee = L * pe + Q * q, J = m.current;
2986
2995
  let k = 0;
2987
2996
  d.current === "start" && (J != null && J.start) ? k = J.start.textEdge.y - J.start.center.y : d.current === "end" && (J != null && J.end) && (k = J.end.textEdge.y - J.end.center.y);
2988
2997
  const X = ke + B.width / 2, M = ee + k + B.height / 2, F = Sn(u, { x: X, y: M });
2989
- if (d.current === "start" ? F <= w ? (Oe(F), Te(F)) : (Oe(w), De(F), Te(F), d.current = "end") : F >= N ? (De(F), Te(F)) : (De(N), Oe(F), Te(F), d.current = "start"), n.current) {
2990
- const ce = Math.min(N, w), oe = Math.max(N, w);
2998
+ if (d.current === "start" ? F <= w ? (Oe(F), Te(F)) : (Oe(w), Ne(F), Te(F), d.current = "end") : F >= D ? (Ne(F), Te(F)) : (Ne(D), Oe(F), Te(F), d.current = "start"), n.current) {
2999
+ const ce = Math.min(D, w), oe = Math.max(D, w);
2991
3000
  n.current.setSelectionRange(ce, oe);
2992
3001
  }
2993
3002
  return;
2994
3003
  }
2995
- if (L.isActive() && u instanceof wn) {
2996
- L.isDraggingHandle() ? (L.updateHandle(W - u.x, Z - u.y), We((B) => B + 1)) : (L.setPreviewPoint(W - u.x, Z - u.y), We((B) => B + 1));
3004
+ if (H.isActive() && u instanceof wn) {
3005
+ H.isDraggingHandle() ? (H.updateHandle(W - u.x, Z - u.y), We((B) => B + 1)) : (H.setPreviewPoint(W - u.x, Z - u.y), We((B) => B + 1));
2997
3006
  return;
2998
3007
  }
2999
- if (z.altKey !== D && Pt(z.altKey), V) {
3000
- Dt(W, Z, G);
3008
+ if (z.altKey !== N && Pt(z.altKey), V) {
3009
+ Nt(W, Z, G);
3001
3010
  return;
3002
3011
  }
3003
3012
  if (h.getMode() === "drag") {
3004
3013
  const B = h._multiSelectionDragContext;
3005
3014
  if (B && te.length > 0) {
3006
- const { dx: ge, dy: S } = Vs(
3015
+ const { dx: xe, dy: S } = Vs(
3007
3016
  W - B.startX,
3008
3017
  Z - B.startY,
3009
3018
  { shift: z.shiftKey }
3010
3019
  );
3011
3020
  B.currentElements || (B.currentElements = /* @__PURE__ */ new Map());
3012
- const Y = [];
3021
+ const L = [];
3013
3022
  B.elementsStartData.forEach((Q) => {
3014
3023
  const q = Q.element, pe = Q.startData, ke = q.clone();
3015
- ke.x = pe.x + ge, ke.y = pe.y + S, B.currentElements.set(ke.id, ke), Y.push(ke);
3016
- }), lt((Q) => Q.map((q) => Y.find((pe) => pe.id === q.id) || q)), B.currentDelta = { dx: ge, dy: S }, !B.startOBB && ae.current && (B.startOBB = { ...ae.current }), We((Q) => Q + 1), se({});
3024
+ ke.x = pe.x + xe, ke.y = pe.y + S, B.currentElements.set(ke.id, ke), L.push(ke);
3025
+ }), lt((Q) => Q.map((q) => L.find((pe) => pe.id === q.id) || q)), B.currentDelta = { dx: xe, dy: S }, !B.startOBB && ae.current && (B.startOBB = { ...ae.current }), We((Q) => Q + 1), se({});
3017
3026
  return;
3018
3027
  }
3019
3028
  }
3020
3029
  if (h.getMode() === "drag" && u) {
3021
3030
  if (h.getDragMode() === "crop-image-drag") {
3022
3031
  const ee = h.getContext(), J = ee.element;
3023
- if (J instanceof Yt && J.isCropping) {
3032
+ if (J instanceof Lt && J.isCropping) {
3024
3033
  const k = Ce.handleCropImageDrag(J, ee, W, Z), X = h._cropGroupContext, M = h._activeChildContext, F = X || M;
3025
3034
  if (F && u instanceof Re) {
3026
3035
  const ce = J.clone();
3027
3036
  ce.x = k.x, ce.y = k.y, ce.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1);
3028
3037
  const oe = u.clone(), Me = X ? X.childIndex : oe.children.findIndex((it) => it.id === F.childId);
3029
3038
  Me >= 0 && (oe.children[Me] = ce, oe.updateBoundsFromChildren(!0)), lt((it) => it.map((bt) => bt.id === oe.id ? oe : bt));
3030
- const Ye = h.getContext();
3031
- Ye._cachedElement || (Ye._cachedElement = {}), Ye._cachedElement[oe.id] = oe, M && Me >= 0 && (Ze(oe.children[Me]), U.update(ce, $)), We((it) => it + 1);
3039
+ const Le = h.getContext();
3040
+ Le._cachedElement || (Le._cachedElement = {}), Le._cachedElement[oe.id] = oe, M && Me >= 0 && (Ze(oe.children[Me]), U.update(ce, $)), We((it) => it + 1);
3032
3041
  } else {
3033
3042
  const ce = J.clone();
3034
3043
  ce.x = k.x, ce.y = k.y, ce.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1), lt(
3035
- (Me) => Me.map((Ye) => Ye.id === ce.id ? ce : Ye)
3044
+ (Me) => Me.map((Le) => Le.id === ce.id ? ce : Le)
3036
3045
  );
3037
3046
  const oe = h.getContext();
3038
3047
  oe._cachedElement || (oe._cachedElement = {}), oe._cachedElement[ce.id] = ce, U.update(ce, $), We((Me) => Me + 1);
@@ -3040,19 +3049,19 @@ function Ii(e) {
3040
3049
  return;
3041
3050
  }
3042
3051
  }
3043
- const ge = h._activeChildContext, S = gt(), Y = [];
3052
+ const xe = h._activeChildContext, S = gt(), L = [];
3044
3053
  S.forEach((ee) => {
3045
- ee instanceof Re ? Y.push(...ee.children) : Y.push(ee);
3054
+ ee instanceof Re ? L.push(...ee.children) : L.push(ee);
3046
3055
  });
3047
3056
  const Q = { shift: z.shiftKey };
3048
- let q = h.updateDrag(W, Z, Y, Q);
3049
- const pe = ge && u instanceof Re ? u.children.find((ee) => ee.id === ge.childId) : u;
3050
- if (pe && (q = he.snapToSpacing(q, pe, Y), Q.shift)) {
3057
+ let q = h.updateDrag(W, Z, L, Q);
3058
+ const pe = xe && u instanceof Re ? u.children.find((ee) => ee.id === xe.childId) : u;
3059
+ if (pe && (q = he.snapToSpacing(q, pe, L), Q.shift)) {
3051
3060
  const ee = h.getContext(), J = ee.startData, { lockedAxis: k } = Vs(W - ee.startX, Z - ee.startY, Q);
3052
3061
  k === "x" ? q.x = J.x : k === "y" && (q.y = J.y);
3053
3062
  }
3054
- if (ge && u instanceof Re) {
3055
- const ee = u.clone(), J = ee.children.findIndex((X) => X.id === ge.childId);
3063
+ if (xe && u instanceof Re) {
3064
+ const ee = u.clone(), J = ee.children.findIndex((X) => X.id === xe.childId);
3056
3065
  if (J >= 0) {
3057
3066
  const X = ee.children[J].clone();
3058
3067
  X.x = q.x, X.y = q.y, ee.children[J] = X, ee.updateBoundsFromChildren(!0);
@@ -3077,20 +3086,20 @@ function Ii(e) {
3077
3086
  }
3078
3087
  We((ee) => ee + 1), zt(re.getGuides());
3079
3088
  let ke;
3080
- if (ge && u instanceof Re)
3081
- ke = u.children.find((ee) => ee.id === ge.childId);
3089
+ if (xe && u instanceof Re)
3090
+ ke = u.children.find((ee) => ee.id === xe.childId);
3082
3091
  else {
3083
3092
  const ee = h.getContext();
3084
3093
  ee._cachedElement && u ? ke = ee._cachedElement[u.id] : ke = u || void 0;
3085
3094
  }
3086
3095
  if (ke) {
3087
- const ee = he.detectSpacing(ke, Y, D);
3096
+ const ee = he.detectSpacing(ke, L, N);
3088
3097
  At(ee);
3089
3098
  }
3090
3099
  } else if (h.getMode() === "resize") {
3091
- const { dx: B, dy: ge } = h.updateResize(W, Z), S = h.getResizeContext(), Y = h._multiSelectionResizeContext;
3092
- if (Y && te.length > 0) {
3093
- const k = Y.startBounds, X = Y.anchor;
3100
+ const { dx: B, dy: xe } = h.updateResize(W, Z), S = h.getResizeContext(), L = h._multiSelectionResizeContext;
3101
+ if (L && te.length > 0) {
3102
+ const k = L.startBounds, X = L.anchor;
3094
3103
  let M, F, ce, oe;
3095
3104
  switch (X) {
3096
3105
  case "top-left":
@@ -3108,7 +3117,7 @@ function Ii(e) {
3108
3117
  default:
3109
3118
  M = k.minX, F = k.minY, ce = k.maxX, oe = k.maxY;
3110
3119
  }
3111
- const Me = ce + B, Ye = oe + ge, it = Math.abs(ce - M), bt = Math.abs(oe - F), Bt = Math.abs(Me - M), St = Math.abs(Ye - F), Et = it > 0 ? Bt / it : 1, Gt = bt > 0 ? St / bt : 1, ut = (Et + Gt) / 2, kt = k.maxX - k.minX, kn = k.maxY - k.minY, Ft = kt * ut, qt = kn * ut;
3120
+ const Me = ce + B, Le = oe + xe, it = Math.abs(ce - M), bt = Math.abs(oe - F), Bt = Math.abs(Me - M), St = Math.abs(Le - F), Et = it > 0 ? Bt / it : 1, Gt = bt > 0 ? St / bt : 1, ut = (Et + Gt) / 2, kt = k.maxX - k.minX, kn = k.maxY - k.minY, Ft = kt * ut, qt = kn * ut;
3112
3121
  let jt = M, _t = F, $t = M, an = F;
3113
3122
  switch (X) {
3114
3123
  case "top-left":
@@ -3124,9 +3133,9 @@ function Ii(e) {
3124
3133
  jt = M, _t = F, $t = M + Ft, an = F + qt;
3125
3134
  break;
3126
3135
  }
3127
- if (Y.elementsStartData.forEach((Yn) => {
3128
- const Vn = Yn.element, nn = Yn.startData, ls = nn.x - M, ds = nn.y - F, Kn = M + ls * ut, Un = F + ds * ut, Wt = Vn.clone();
3129
- if (Wt instanceof Yt) {
3136
+ if (L.elementsStartData.forEach((Ln) => {
3137
+ const Vn = Ln.element, nn = Ln.startData, ls = nn.x - M, ds = nn.y - F, Kn = M + ls * ut, Un = F + ds * ut, Wt = Vn.clone();
3138
+ if (Wt instanceof Lt) {
3130
3139
  Wt.x = Kn, Wt.y = Un;
3131
3140
  const Rn = Wt.transformData, yn = nn.transformData;
3132
3141
  Rn.width = yn.width * ut, Rn.height = yn.height * ut;
@@ -3138,11 +3147,11 @@ function Ii(e) {
3138
3147
  const Rn = nn.width * ut, yn = nn.height * ut;
3139
3148
  Wt.resize(X, Rn, yn, nn), Wt.x = Kn, Wt.y = Un;
3140
3149
  }
3141
- Ie(Wt);
3150
+ Pe(Wt);
3142
3151
  }), ae.current) {
3143
- const Yn = (jt + $t) / 2, Vn = (_t + an) / 2;
3152
+ const Ln = (jt + $t) / 2, Vn = (_t + an) / 2;
3144
3153
  ae.current = {
3145
- centerX: Yn,
3154
+ centerX: Ln,
3146
3155
  centerY: Vn,
3147
3156
  width: $t - jt,
3148
3157
  height: an - _t,
@@ -3152,18 +3161,18 @@ function Ii(e) {
3152
3161
  return;
3153
3162
  }
3154
3163
  const Q = S.element;
3155
- if (Q instanceof Yt && Q.isCropping && S.handle.anchor && S.handle.anchor.startsWith("crop-")) {
3164
+ if (Q instanceof Lt && Q.isCropping && S.handle.anchor && S.handle.anchor.startsWith("crop-")) {
3156
3165
  const k = S.handle.anchor.replace("crop-", ""), X = h.getContext(), M = Ce.handleCropBoxResize(Q, k, S, X, W, Z);
3157
3166
  fe.style.cursor = M.cursor;
3158
3167
  const F = h._cropGroupContext, ce = h._activeChildContext, oe = F || ce;
3159
3168
  if (oe && u instanceof Re) {
3160
3169
  const Me = Q.clone();
3161
3170
  Me.x = M.x, Me.y = M.y, Me.rotation = M.rotation, Me.transformData.width = M.width, Me.transformData.height = M.height, Me.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1);
3162
- const Ye = u.clone(), it = F ? F.childIndex : Ye.children.findIndex((bt) => bt.id === oe.childId);
3163
- it >= 0 && (Ye.children[it] = Me, Ye.updateBoundsFromChildren(!0)), Ie(Ye), ce && it >= 0 && Ze(Ye.children[it]);
3171
+ const Le = u.clone(), it = F ? F.childIndex : Le.children.findIndex((bt) => bt.id === oe.childId);
3172
+ it >= 0 && (Le.children[it] = Me, Le.updateBoundsFromChildren(!0)), Pe(Le), ce && it >= 0 && Ze(Le.children[it]);
3164
3173
  } else {
3165
3174
  const Me = Q.clone();
3166
- Me.x = M.x, Me.y = M.y, Me.rotation = M.rotation, Me.transformData.width = M.width, Me.transformData.height = M.height, Me.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1), Ie(Me);
3175
+ Me.x = M.x, Me.y = M.y, Me.rotation = M.rotation, Me.transformData.width = M.width, Me.transformData.height = M.height, Me.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1), Pe(Me);
3167
3176
  }
3168
3177
  return;
3169
3178
  }
@@ -3176,7 +3185,7 @@ function Ii(e) {
3176
3185
  element: S.element,
3177
3186
  handle: S.handle,
3178
3187
  dx: B,
3179
- dy: ge,
3188
+ dy: xe,
3180
3189
  startData: S.startData,
3181
3190
  allElements: ke,
3182
3191
  snapSystem: re,
@@ -3185,9 +3194,9 @@ function Ii(e) {
3185
3194
  }).element;
3186
3195
  if (h.updateResizeElement(J), pe) {
3187
3196
  const k = u.clone(), X = k.children.findIndex((M) => M.id === q.childId);
3188
- X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Ie(k), X >= 0 && (Ze(k.children[X]), U.update(k.children[X], $));
3197
+ X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Pe(k), X >= 0 && (Ze(k.children[X]), U.update(k.children[X], $));
3189
3198
  } else
3190
- Ie(J), U.update(J, $);
3199
+ Pe(J), U.update(J, $);
3191
3200
  We((k) => k + 1), zt(re.getGuides());
3192
3201
  } else if (h.getMode() === "rotate") {
3193
3202
  fe.style.cursor = "grabbing", ne || ($e(!0), _ == null || _(!0));
@@ -3202,26 +3211,26 @@ function Ii(e) {
3202
3211
  J.centerY,
3203
3212
  k
3204
3213
  ), oe = M.clone();
3205
- oe.x = ce.x, oe.y = ce.y, oe.setRotation(F.rotation + k), Ie(oe);
3214
+ oe.x = ce.x, oe.y = ce.y, oe.setRotation(F.rotation + k), Pe(oe);
3206
3215
  });
3207
3216
  return;
3208
3217
  }
3209
- const ge = h._activeChildContext, S = ge ? j : u;
3218
+ const xe = h._activeChildContext, S = xe ? j : u;
3210
3219
  if (!S) return;
3211
- const Y = S.getBoundingBox(), Q = Es(Y), q = Q.x, pe = Q.y, ke = h.updateRotate(W, Z, Q.x, Q.y, { shift: z.shiftKey }), ee = S.clone();
3220
+ const L = S.getBoundingBox(), Q = Es(L), q = Q.x, pe = Q.y, ke = h.updateRotate(W, Z, Q.x, Q.y, { shift: z.shiftKey }), ee = S.clone();
3212
3221
  if (ee.setRotation(ke), !(ee instanceof Re)) {
3213
3222
  const J = ee.getBoundingBox(), k = Es(J), X = q - k.x, M = pe - k.y;
3214
3223
  ee.x += X, ee.y += M;
3215
3224
  }
3216
- if (x.current = ee, pt(ee.rotation), ct((J) => J + 1), ge && u instanceof Re) {
3217
- const J = u.clone(), k = J.children.findIndex((X) => X.id === ge.childId);
3218
- k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Ie(J), k >= 0 && (Ze(J.children[k]), U.update(J.children[k], $));
3225
+ if (x.current = ee, pt(ee.rotation), ct((J) => J + 1), xe && u instanceof Re) {
3226
+ const J = u.clone(), k = J.children.findIndex((X) => X.id === xe.childId);
3227
+ k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Pe(J), k >= 0 && (Ze(J.children[k]), U.update(J.children[k], $));
3219
3228
  } else
3220
- Ie(ee), U.update(ee, $);
3229
+ Pe(ee), U.update(ee, $);
3221
3230
  We((J) => J + 1);
3222
3231
  } else {
3223
3232
  if (te.length > 0 && E.current) {
3224
- const S = E.current, Y = 16 / $, Q = [
3233
+ const S = E.current, L = 16 / $, Q = [
3225
3234
  { x: S.minX, y: S.minY, anchor: "top-left", cursor: "nwse-resize" },
3226
3235
  { x: S.maxX, y: S.minY, anchor: "top-right", cursor: "nesw-resize" },
3227
3236
  { x: S.minX, y: S.maxY, anchor: "bottom-left", cursor: "nesw-resize" },
@@ -3240,7 +3249,7 @@ function Ii(e) {
3240
3249
  });
3241
3250
  for (const X of pe) {
3242
3251
  const M = W - X.x, F = Z - X.y;
3243
- if (Math.sqrt(M * M + F * F) <= Y) {
3252
+ if (Math.sqrt(M * M + F * F) <= L) {
3244
3253
  fe.style.cursor = X.cursor, Ee({ type: "multi-selection-handle", data: X });
3245
3254
  return;
3246
3255
  }
@@ -3264,9 +3273,9 @@ function Ii(e) {
3264
3273
  }
3265
3274
  if (z.altKey) {
3266
3275
  let S = null;
3267
- const Y = gt();
3268
- for (let Q = Y.length - 1; Q >= 0; Q--) {
3269
- const q = Y[Q];
3276
+ const L = gt();
3277
+ for (let Q = L.length - 1; Q >= 0; Q--) {
3278
+ const q = L[Q];
3270
3279
  if (q.visible !== !1) {
3271
3280
  if (q instanceof Re)
3272
3281
  for (let pe = q.children.length - 1; pe >= 0; pe--) {
@@ -3290,7 +3299,7 @@ function Ii(e) {
3290
3299
  }
3291
3300
  if (S) {
3292
3301
  const Q = [];
3293
- Y.forEach((pe) => {
3302
+ L.forEach((pe) => {
3294
3303
  pe instanceof Re ? Q.push(...pe.children) : Q.push(pe);
3295
3304
  });
3296
3305
  const q = he.detectSpacing(S, Q, !0);
@@ -3301,7 +3310,7 @@ function Ii(e) {
3301
3310
  be.length > 0 && At([]);
3302
3311
  const B = j || u;
3303
3312
  if (B && B.visible !== !1)
3304
- if (B instanceof Yt && B.isCropping) {
3313
+ if (B instanceof Lt && B.isCropping) {
3305
3314
  const S = B.hitTestCropHandle(W, Z, $);
3306
3315
  if (S) {
3307
3316
  const Q = to(
@@ -3316,9 +3325,9 @@ function Ii(e) {
3316
3325
  fe.style.cursor = Q, Ee({ type: "crop-handle", data: S });
3317
3326
  return;
3318
3327
  }
3319
- const Y = U.hitTestResize(W, Z, $);
3320
- if (Y) {
3321
- fe.style.cursor = Y.cursor, Ee({ type: "resize-handle", data: Y });
3328
+ const L = U.hitTestResize(W, Z, $);
3329
+ if (L) {
3330
+ fe.style.cursor = L.cursor, Ee({ type: "resize-handle", data: L });
3322
3331
  return;
3323
3332
  }
3324
3333
  if (B.hitTest(W, Z)) {
@@ -3342,18 +3351,18 @@ function Ii(e) {
3342
3351
  }
3343
3352
  if (j && u instanceof Re)
3344
3353
  for (let S = u.children.length - 1; S >= 0; S--) {
3345
- const Y = u.children[S];
3346
- if (!(Y.visible === !1 || Y.id === j.id) && Y.hitTest(W, Z)) {
3347
- fe.style.cursor = "pointer", Ee({ type: "group-sibling", data: Y });
3354
+ const L = u.children[S];
3355
+ if (!(L.visible === !1 || L.id === j.id) && L.hitTest(W, Z)) {
3356
+ fe.style.cursor = "pointer", Ee({ type: "group-sibling", data: L });
3348
3357
  return;
3349
3358
  }
3350
3359
  }
3351
- const ge = gt();
3352
- for (let S = ge.length - 1; S >= 0; S--)
3353
- if (ge[S].visible !== !1 && !ge[S].locked && ge[S].hitTest(W, Z)) {
3354
- if (!hs(ge[S], W, Z, Se))
3360
+ const xe = gt();
3361
+ for (let S = xe.length - 1; S >= 0; S--)
3362
+ if (xe[S].visible !== !1 && !xe[S].locked && xe[S].hitTest(W, Z)) {
3363
+ if (!hs(xe[S], W, Z, Se))
3355
3364
  continue;
3356
- fe.style.cursor = "pointer", Ee({ type: "element", data: ge[S] });
3365
+ fe.style.cursor = "pointer", Ee({ type: "element", data: xe[S] });
3357
3366
  return;
3358
3367
  }
3359
3368
  fe.style.cursor = "default", Ee({ type: null, data: null });
@@ -3363,17 +3372,17 @@ function Ii(e) {
3363
3372
  h,
3364
3373
  u,
3365
3374
  gt,
3366
- Ie,
3375
+ Pe,
3367
3376
  U,
3368
3377
  V,
3369
3378
  re,
3370
3379
  te,
3371
3380
  ae,
3372
3381
  j,
3373
- L,
3382
+ H,
3374
3383
  We,
3375
3384
  $,
3376
- xe,
3385
+ me,
3377
3386
  ie,
3378
3387
  Ee,
3379
3388
  he,
@@ -3385,7 +3394,7 @@ function Ii(e) {
3385
3394
  yt
3386
3395
  ]
3387
3396
  ), En = ft((z) => {
3388
- var W, Z, et, B, ge;
3397
+ var W, Z, et, B, xe;
3389
3398
  if (z.button === 2) return;
3390
3399
  if (z.target.releasePointerCapture(z.pointerId), Ae.current.delete(z.pointerId), Ge.current && (z.pointerId === Ge.current.pointerA || z.pointerId === Ge.current.pointerB)) {
3391
3400
  Ge.current = null, Ae.current.clear();
@@ -3393,12 +3402,12 @@ function Ii(e) {
3393
3402
  }
3394
3403
  if (Fe.current && Fe.current.pointerId === z.pointerId) {
3395
3404
  const S = Fe.current;
3396
- Fe.current = null, S.movedPastThreshold || (((W = S.pendingTap) == null ? void 0 : W.kind) === "select-element" ? (Xe(S.pendingTap.elementId), H([])) : ((Z = S.pendingTap) == null ? void 0 : Z.kind) === "deselect" && (Xe(null), H([])));
3405
+ Fe.current = null, S.movedPastThreshold || (((W = S.pendingTap) == null ? void 0 : W.kind) === "select-element" ? (Xe(S.pendingTap.elementId), Y([])) : ((Z = S.pendingTap) == null ? void 0 : Z.kind) === "deselect" && (Xe(null), Y([])));
3397
3406
  return;
3398
3407
  }
3399
3408
  if (h.getMode() === "pinch" && K.current) {
3400
- const { a: S, b: Y } = K.current;
3401
- if (z.pointerId === S || z.pointerId === Y) {
3409
+ const { a: S, b: L } = K.current;
3410
+ if (z.pointerId === S || z.pointerId === L) {
3402
3411
  const q = h.getContext().element, pe = ue.current ?? void 0;
3403
3412
  q && Ve(
3404
3413
  pe,
@@ -3407,22 +3416,22 @@ function Ii(e) {
3407
3416
  return;
3408
3417
  }
3409
3418
  }
3410
- if (d.current && (d.current = null), L.isActive() && L.isDraggingHandle()) {
3411
- const S = L.isClosingPath();
3412
- if (L.finishDraggingHandle(), S && u instanceof wn) {
3413
- const Y = u.clone();
3414
- Ve(u, Y);
3419
+ if (d.current && (d.current = null), H.isActive() && H.isDraggingHandle()) {
3420
+ const S = H.isClosingPath();
3421
+ if (H.finishDraggingHandle(), S && u instanceof wn) {
3422
+ const L = u.clone();
3423
+ Ve(u, L);
3415
3424
  }
3416
- We((Y) => Y + 1);
3425
+ We((L) => L + 1);
3417
3426
  return;
3418
3427
  }
3419
3428
  if (V) {
3420
- tn(H);
3429
+ tn(Y);
3421
3430
  return;
3422
3431
  }
3423
- b.current && h.getMode() === "drag" && (b.current.forEach((Y, Q) => {
3432
+ b.current && h.getMode() === "drag" && (b.current.forEach((L, Q) => {
3424
3433
  const q = G.find((pe) => pe.id === Q);
3425
- q && (Y.x !== q.x || Y.y !== q.y || Y instanceof Re && q instanceof Re && JSON.stringify(Y.children.map((ke) => ({ x: ke.x, y: ke.y }))) !== JSON.stringify(q.children.map((ke) => ({ x: ke.x, y: ke.y })))) && Ve(Y, q);
3434
+ q && (L.x !== q.x || L.y !== q.y || L instanceof Re && q instanceof Re && JSON.stringify(L.children.map((ke) => ({ x: ke.x, y: ke.y }))) !== JSON.stringify(q.children.map((ke) => ({ x: ke.x, y: ke.y })))) && Ve(L, q);
3426
3435
  }), b.current = null);
3427
3436
  const fe = t.current;
3428
3437
  if (fe && (fe.style.cursor = "default"), re.clearGuides(), re.clearSnapState(), zt([]), he.clearIndicators(), At([]), h._cropGroupContext && delete h._cropGroupContext, h._activeChildContext) {
@@ -3434,16 +3443,16 @@ function Ii(e) {
3434
3443
  }
3435
3444
  if (h._multiSelectionResizeContext && delete h._multiSelectionResizeContext, G.forEach((S) => {
3436
3445
  if (S instanceof no && S._lockedLineCount !== void 0) {
3437
- const Y = S.clone();
3438
- Y._lockedLineCount = void 0, Ie(Y);
3446
+ const L = S.clone();
3447
+ L._lockedLineCount = void 0, Pe(L);
3439
3448
  }
3440
3449
  }), h._multiSelectionDragContext) {
3441
3450
  const S = h._multiSelectionDragContext;
3442
3451
  if (S.startOBB && S.currentDelta) {
3443
- const { dx: Y, dy: Q } = S.currentDelta, q = S.startOBB;
3452
+ const { dx: L, dy: Q } = S.currentDelta, q = S.startOBB;
3444
3453
  ae.current = {
3445
3454
  ...q,
3446
- centerX: q.centerX + Y,
3455
+ centerX: q.centerX + L,
3447
3456
  centerY: q.centerY + Q
3448
3457
  };
3449
3458
  }
@@ -3462,27 +3471,27 @@ function Ii(e) {
3462
3471
  const dt = h.getContext();
3463
3472
  if (dt._cachedElement && delete dt._cachedElement, h._pendingChildSelection) {
3464
3473
  const S = h._pendingChildSelection;
3465
- let Y = !0;
3474
+ let L = !0;
3466
3475
  if (u instanceof Re) {
3467
3476
  const Q = h._groupDragOriginalElement;
3468
- Q && (Y = !(Math.abs(u.x - Q.x) > 0.1 || Math.abs(u.y - Q.y) > 0.1));
3477
+ Q && (L = !(Math.abs(u.x - Q.x) > 0.1 || Math.abs(u.y - Q.y) > 0.1));
3469
3478
  }
3470
- Y && (Ze(S), U.update(S, $), We((Q) => Q + 1)), delete h._pendingChildSelection;
3479
+ L && (Ze(S), U.update(S, $), We((Q) => Q + 1)), delete h._pendingChildSelection;
3471
3480
  }
3472
3481
  if (h._pendingTextEditMode) {
3473
- const S = h._pendingTextEditMode, Y = G.find((q) => q.id === S.elementId);
3474
- !(Y && (Math.abs(Y.x - S.originalX) > 0.1 || Math.abs(Y.y - S.originalY) > 0.1)) && Y instanceof Qe && !(Y instanceof Yt) && !(Y instanceof Qn) && Ht(Y, S.clickX, S.clickY), delete h._pendingTextEditMode;
3482
+ const S = h._pendingTextEditMode, L = G.find((q) => q.id === S.elementId);
3483
+ !(L && (Math.abs(L.x - S.originalX) > 0.1 || Math.abs(L.y - S.originalY) > 0.1)) && L instanceof Qe && !(L instanceof Lt) && !(L instanceof Qn) && Yt(L, S.clickX, S.clickY), delete h._pendingTextEditMode;
3475
3484
  }
3476
3485
  if (Be.current) {
3477
- const S = Be.current, Y = Je.current, Q = G.find((ee) => ee.id === S), q = (et = b.current) == null ? void 0 : et.get(S), pe = !!(Q && q && (Math.abs(Q.x - q.x) > 0.1 || Math.abs(Q.y - q.y) > 0.1)), ke = Y ? Math.hypot(
3478
- (z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) / $ - xe - Y.x,
3479
- (z.clientY - (((ge = Ue.current) == null ? void 0 : ge.top) ?? 0)) / $ - ie - Y.y
3486
+ const S = Be.current, L = Je.current, Q = G.find((ee) => ee.id === S), q = (et = b.current) == null ? void 0 : et.get(S), pe = !!(Q && q && (Math.abs(Q.x - q.x) > 0.1 || Math.abs(Q.y - q.y) > 0.1)), ke = L ? Math.hypot(
3487
+ (z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) / $ - me - L.x,
3488
+ (z.clientY - (((xe = Ue.current) == null ? void 0 : xe.top) ?? 0)) / $ - ie - L.y
3480
3489
  ) > 4 / Math.max($, 1e-4) : !1;
3481
- if (!pe && !ke && S === (u == null ? void 0 : u.id) && Y) {
3490
+ if (!pe && !ke && S === (u == null ? void 0 : u.id) && L) {
3482
3491
  const ee = gt(), J = [];
3483
3492
  for (let X = ee.length - 1; X >= 0; X--) {
3484
3493
  const M = ee[X];
3485
- M.visible !== !1 && M.hitTest(Y.x, Y.y) && hs(M, Y.x, Y.y, Se) && J.push(M);
3494
+ M.visible !== !1 && M.hitTest(L.x, L.y) && hs(M, L.x, L.y, Se) && J.push(M);
3486
3495
  }
3487
3496
  const k = J.findIndex((X) => X.id === S);
3488
3497
  k !== -1 && k + 1 < J.length ? Xe(J[k + 1].id) : Xe(null);
@@ -3494,7 +3503,7 @@ function Ii(e) {
3494
3503
  h,
3495
3504
  re,
3496
3505
  V,
3497
- H,
3506
+ Y,
3498
3507
  te,
3499
3508
  ae,
3500
3509
  j,
@@ -3502,13 +3511,13 @@ function Ii(e) {
3502
3511
  Ze,
3503
3512
  U,
3504
3513
  t,
3505
- L,
3514
+ H,
3506
3515
  We,
3507
3516
  $,
3508
- xe,
3517
+ me,
3509
3518
  ie,
3510
3519
  _,
3511
- Ht,
3520
+ Yt,
3512
3521
  G,
3513
3522
  Xe,
3514
3523
  Ve,
@@ -3518,38 +3527,38 @@ function Ii(e) {
3518
3527
  if (!u) return;
3519
3528
  const fe = t.current;
3520
3529
  if (!fe) return;
3521
- const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / $ - xe, Z = (z.clientY - dt.top) / $ - ie;
3530
+ const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / $ - me, Z = (z.clientY - dt.top) / $ - ie;
3522
3531
  if (u.hitTest(W, Z)) {
3523
3532
  if (u instanceof Re) {
3524
3533
  const oe = u.hitTestChild(W, Z);
3525
3534
  if (oe) {
3526
3535
  if (!(j && j.id === oe.id)) return;
3527
3536
  if (oe instanceof Qe && !(oe instanceof Re) && !(oe instanceof Qn)) {
3528
- const Ye = oe.getVisualBoundingBox(), it = en.toRadiansInverse(oe.rotation), bt = oe.getRotationAnchor(), Bt = W - bt.x, St = Z - bt.y, Et = Math.cos(it), Gt = Math.sin(it), ut = Bt * Et - St * Gt, kt = Bt * Gt + St * Et, kn = ut + Ye.width / 2, Ft = kt + Ye.height / 2, qt = Sn(oe, { x: kn, y: Ft }), jt = Ye.height + 16, _t = 6;
3537
+ const Le = oe.getVisualBoundingBox(), it = en.toRadiansInverse(oe.rotation), bt = oe.getRotationAnchor(), Bt = W - bt.x, St = Z - bt.y, Et = Math.cos(it), Gt = Math.sin(it), ut = Bt * Et - St * Gt, kt = Bt * Gt + St * Et, kn = ut + Le.width / 2, Ft = kt + Le.height / 2, qt = Sn(oe, { x: kn, y: Ft }), jt = Le.height + 16, _t = 6;
3529
3538
  wt({
3530
- x: dt.left + (Ye.x + xe) * $ - _t,
3531
- y: dt.top + (Ye.y + ie) * $ - _t,
3532
- width: Math.max(20, Ye.width * $),
3539
+ x: dt.left + (Le.x + me) * $ - _t,
3540
+ y: dt.top + (Le.y + ie) * $ - _t,
3541
+ width: Math.max(20, Le.width * $),
3533
3542
  height: Math.max(jt * $, 50)
3534
3543
  }), Xt(Ke(oe));
3535
3544
  const $t = oe.getRichText().clone();
3536
3545
  C.current = $t, rn($t);
3537
3546
  const an = oe.getRichText().getStyleAt(Math.max(0, oe.text.length - 1));
3538
- Ut({ ...oe.getDefaultStyle(), ...an }), Te(qt), Oe(qt), De(qt), on(!0), R.current = Date.now(), v.current = oe.id;
3547
+ Ut({ ...oe.getDefaultStyle(), ...an }), Te(qt), Oe(qt), Ne(qt), on(!0), R.current = Date.now(), v.current = oe.id;
3539
3548
  return;
3540
3549
  }
3541
3550
  }
3542
3551
  return;
3543
3552
  }
3544
3553
  if (u instanceof wn) {
3545
- L.editPath(u), We((oe) => oe + 1);
3554
+ H.editPath(u), We((oe) => oe + 1);
3546
3555
  return;
3547
3556
  }
3548
3557
  if (u instanceof Qn || !(u instanceof Qe))
3549
3558
  return;
3550
- const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), ge = u.getRotationAnchor(), S = W - ge.x, Y = Z - ge.y, Q = Math.cos(B), q = Math.sin(B), pe = S * Q - Y * q, ke = S * q + Y * Q, ee = pe + et.width / 2, J = ke + et.height / 2, k = Sn(u, { x: ee, y: J }), X = et.height + 16, M = 6;
3559
+ const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), xe = u.getRotationAnchor(), S = W - xe.x, L = Z - xe.y, Q = Math.cos(B), q = Math.sin(B), pe = S * Q - L * q, ke = S * q + L * Q, ee = pe + et.width / 2, J = ke + et.height / 2, k = Sn(u, { x: ee, y: J }), X = et.height + 16, M = 6;
3551
3560
  wt({
3552
- x: dt.left + (et.x + xe) * $ - M,
3561
+ x: dt.left + (et.x + me) * $ - M,
3553
3562
  y: dt.top + (et.y + ie) * $ - M,
3554
3563
  width: Math.max(20, et.width * $),
3555
3564
  height: Math.max(X * $, 50)
@@ -3557,18 +3566,18 @@ function Ii(e) {
3557
3566
  const F = u.getRichText().clone();
3558
3567
  C.current = F, rn(F);
3559
3568
  const ce = u.getRichText().getStyleAt(Math.max(0, u.text.length - 1));
3560
- Ut({ ...u.getDefaultStyle(), ...ce }), Te(k), Oe(k), De(k), on(!0), R.current = Date.now();
3569
+ Ut({ ...u.getDefaultStyle(), ...ce }), Te(k), Oe(k), Ne(k), on(!0), R.current = Date.now();
3561
3570
  }
3562
3571
  },
3563
3572
  [
3564
3573
  u,
3565
- Ie,
3574
+ Pe,
3566
3575
  j,
3567
3576
  U,
3568
- L,
3577
+ H,
3569
3578
  We,
3570
3579
  $,
3571
- xe,
3580
+ me,
3572
3581
  ie,
3573
3582
  wt,
3574
3583
  Xt,
@@ -3576,7 +3585,7 @@ function Ii(e) {
3576
3585
  Ut,
3577
3586
  Te,
3578
3587
  Oe,
3579
- De,
3588
+ Ne,
3580
3589
  on,
3581
3590
  Ze,
3582
3591
  ot,
@@ -3632,7 +3641,7 @@ function Ii(e) {
3632
3641
  },
3633
3642
  [En, t, h]
3634
3643
  );
3635
- Pe(() => (document.addEventListener("pointermove", Xn), document.addEventListener("pointerup", Wn), () => {
3644
+ Ie(() => (document.addEventListener("pointermove", Xn), document.addEventListener("pointerup", Wn), () => {
3636
3645
  document.removeEventListener("pointermove", Xn), document.removeEventListener("pointerup", Wn);
3637
3646
  }), [Xn, Wn]);
3638
3647
  const xn = ft(
@@ -3640,26 +3649,26 @@ function Ii(e) {
3640
3649
  if (!rt) return;
3641
3650
  z.preventDefault();
3642
3651
  const fe = t.current;
3643
- if (!fe || g || u instanceof Yt && u.isCropping || L.isActive()) return;
3644
- const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) / $ - xe, et = (z.clientY - W.top) / $ - ie, B = gt();
3645
- let ge = null;
3652
+ if (!fe || g || u instanceof Lt && u.isCropping || H.isActive()) return;
3653
+ const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) / $ - me, et = (z.clientY - W.top) / $ - ie, B = gt();
3654
+ let xe = null;
3646
3655
  for (let S = B.length - 1; S >= 0; S--) {
3647
- const Y = B[S];
3648
- if (Y.visible !== !1 && Y.hitTest(Z, et) && hs(Y, Z, et, Se)) {
3649
- ge = Y;
3656
+ const L = B[S];
3657
+ if (L.visible !== !1 && L.hitTest(Z, et) && hs(L, Z, et, Se)) {
3658
+ xe = L;
3650
3659
  break;
3651
3660
  }
3652
3661
  }
3653
- if (ge) {
3654
- const S = te.includes(ge.id), Y = (u == null ? void 0 : u.id) === ge.id;
3655
- !S && !Y && (Xe(ge.id), H([]));
3662
+ if (xe) {
3663
+ const S = te.includes(xe.id), L = (u == null ? void 0 : u.id) === xe.id;
3664
+ !S && !L && (Xe(xe.id), Y([]));
3656
3665
  }
3657
3666
  rt({
3658
3667
  clientX: z.clientX,
3659
3668
  clientY: z.clientY,
3660
3669
  worldX: Z,
3661
3670
  worldY: et,
3662
- elementId: ge ? ge.id : null
3671
+ elementId: xe ? xe.id : null
3663
3672
  });
3664
3673
  },
3665
3674
  [
@@ -3667,15 +3676,15 @@ function Ii(e) {
3667
3676
  t,
3668
3677
  g,
3669
3678
  u,
3670
- L,
3679
+ H,
3671
3680
  $,
3672
- xe,
3681
+ me,
3673
3682
  ie,
3674
3683
  gt,
3675
3684
  Se,
3676
3685
  te,
3677
3686
  Xe,
3678
- H
3687
+ Y
3679
3688
  ]
3680
3689
  );
3681
3690
  return {
@@ -3703,7 +3712,7 @@ function fs(e) {
3703
3712
  ).join(`
3704
3713
  `);
3705
3714
  }
3706
- function Pi(e) {
3715
+ function Ai(e) {
3707
3716
  const {
3708
3717
  canvasRef: t,
3709
3718
  inputRef: n,
@@ -3729,53 +3738,53 @@ function Pi(e) {
3729
3738
  selectedId: g,
3730
3739
  selectedElement: P,
3731
3740
  activeChildElement: O,
3732
- elements: N,
3741
+ elements: D,
3733
3742
  zoom: w,
3734
3743
  paddingOffsetX: ne,
3735
3744
  paddingOffsetY: V,
3736
- setIsEditing: D,
3745
+ setIsEditing: N,
3737
3746
  setEditText: u,
3738
3747
  setEditRichText: j,
3739
3748
  setCursorPosition: G,
3740
3749
  setSelectionStart: te,
3741
3750
  setSelectionEnd: ae,
3742
3751
  setEditPosition: $,
3743
- setCurrentFormattingStyle: xe,
3752
+ setCurrentFormattingStyle: me,
3744
3753
  setCursorAnimationFrame: ie,
3745
3754
  setHandlesVersion: be,
3746
3755
  setElements: Se,
3747
3756
  onElementUpdate: Te,
3748
3757
  onTextSelectionChange: Oe,
3749
- transformHandles: De,
3758
+ transformHandles: Ne,
3750
3759
  updateActiveChild: $e
3751
3760
  } = e, at = ft(
3752
3761
  (h, U, re) => {
3753
3762
  const he = t.current;
3754
3763
  if (!he) return;
3755
- const L = he.getBoundingClientRect(), Ce = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation), Ve = h.getRotationAnchor(), Xe = U - Ve.x, H = re - Ve.y, _ = Math.cos(Ie), ot = Math.sin(Ie), rt = Xe * _ - H * ot, Ze = Xe * ot + H * _, gt = rt + Ce.width / 2, Nt = Ze + Ce.height / 2, Dt = Sn(h, { x: gt, y: Nt }), tn = Ce.height + 16, Ht = 6;
3764
+ const H = he.getBoundingClientRect(), Ce = h.getVisualBoundingBox(), Pe = en.toRadiansInverse(h.rotation), Ve = h.getRotationAnchor(), Xe = U - Ve.x, Y = re - Ve.y, _ = Math.cos(Pe), ot = Math.sin(Pe), rt = Xe * _ - Y * ot, Ze = Xe * ot + Y * _, gt = rt + Ce.width / 2, Dt = Ze + Ce.height / 2, Nt = Sn(h, { x: gt, y: Dt }), tn = Ce.height + 16, Yt = 6;
3756
3765
  $({
3757
- x: L.left + (Ce.x + ne) * w - Ht,
3758
- y: L.top + (Ce.y + V) * w - Ht,
3766
+ x: H.left + (Ce.x + ne) * w - Yt,
3767
+ y: H.top + (Ce.y + V) * w - Yt,
3759
3768
  width: Math.max(20, Ce.width * w),
3760
3769
  height: Math.max(tn * w, 50)
3761
3770
  }), u(fs(h));
3762
3771
  const wt = h.getRichText().clone();
3763
3772
  o.current = wt, j(wt);
3764
3773
  const Xt = h.getRichText().getStyleAt(Math.max(0, h.text.length - 1));
3765
- xe({ ...h.getDefaultStyle(), ...Xt }), G(Dt), te(Dt), ae(Dt), D(!0), p.current = Date.now();
3774
+ me({ ...h.getDefaultStyle(), ...Xt }), G(Nt), te(Nt), ae(Nt), N(!0), p.current = Date.now();
3766
3775
  },
3767
- [w, $, u, j, xe, G, te, ae, D]
3776
+ [w, $, u, j, me, G, te, ae, N]
3768
3777
  ), pt = ft(
3769
3778
  (h) => {
3770
3779
  if (!C || !E)
3771
3780
  return;
3772
3781
  const U = Math.min(T, I), re = Math.max(T, I);
3773
3782
  if (U === re) {
3774
- const he = E.clone(), L = he.getText().length;
3775
- he.applyStyle(0, L, h), o.current = he, j(he), u(he.getText()), xe((Ce) => ({ ...Ce, ...h }));
3783
+ const he = E.clone(), H = he.getText().length;
3784
+ he.applyStyle(0, H, h), o.current = he, j(he), u(he.getText()), me((Ce) => ({ ...Ce, ...h }));
3776
3785
  } else {
3777
3786
  const he = E.clone();
3778
- he.applyStyle(U, re, h), o.current = he, j(he), u(he.getText()), xe((L) => ({ ...L, ...h }));
3787
+ he.applyStyle(U, re, h), o.current = he, j(he), u(he.getText()), me((H) => ({ ...H, ...h }));
3779
3788
  }
3780
3789
  },
3781
3790
  [C, E, T, I]
@@ -3786,8 +3795,8 @@ function Pi(e) {
3786
3795
  }, [C, E, T, I, P]), Pt = ft(
3787
3796
  (h) => {
3788
3797
  if (!C || !E || !P) return;
3789
- const U = ct(), L = !{ ...P instanceof Qe ? P.getDefaultStyle() : {}, ...U }[h];
3790
- pt({ [h]: L });
3798
+ const U = ct(), H = !{ ...P instanceof Qe ? P.getDefaultStyle() : {}, ...U }[h];
3799
+ pt({ [h]: H });
3791
3800
  },
3792
3801
  [C, E, P, ct, pt]
3793
3802
  ), zt = ft(() => {
@@ -3802,15 +3811,15 @@ function Pi(e) {
3802
3811
  Ce instanceof Qe && Ce.setRichText(h), re.updateBoundsFromChildren(!0);
3803
3812
  }
3804
3813
  Te(re);
3805
- const L = re.children[he];
3806
- L && ($e(L), De.update(L, w), be((Ce) => Ce + 1));
3814
+ const H = re.children[he];
3815
+ H && ($e(H), Ne.update(H, w), be((Ce) => Ce + 1));
3807
3816
  } else if (P instanceof Qe) {
3808
3817
  const re = P.clone();
3809
- re.setRichText(h), Te(re), De.update(re, w), be((he) => he + 1);
3818
+ re.setRichText(h), Te(re), Ne.update(re, w), be((he) => he + 1);
3810
3819
  }
3811
3820
  }
3812
- c.current = null, D(!1), u(""), j(null), o.current = null, xe(null), s.current = null;
3813
- }, [C, R, E, o, P, Te, De, $e, w]), At = ft(() => {
3821
+ c.current = null, N(!1), u(""), j(null), o.current = null, me(null), s.current = null;
3822
+ }, [C, R, E, o, P, Te, Ne, $e, w]), At = ft(() => {
3814
3823
  if (Date.now() - l.current < x) {
3815
3824
  if (n.current) {
3816
3825
  n.current.focus();
@@ -3820,54 +3829,54 @@ function Pi(e) {
3820
3829
  return;
3821
3830
  }
3822
3831
  setTimeout(() => {
3823
- var Ie, Ve, Xe;
3832
+ var Pe, Ve, Xe;
3824
3833
  if (Date.now() - p.current < v) {
3825
- (Ie = n.current) == null || Ie.focus();
3834
+ (Pe = n.current) == null || Pe.focus();
3826
3835
  return;
3827
3836
  }
3828
3837
  if (m.current) {
3829
3838
  m.current = !1, (Ve = n.current) == null || Ve.focus(), n.current && n.current.setSelectionRange(T, I);
3830
3839
  return;
3831
3840
  }
3832
- let L = document.activeElement, Ce = !1;
3833
- for (; L; ) {
3834
- const H = L.classList, _ = L.getAttribute("data-slot");
3841
+ let H = document.activeElement, Ce = !1;
3842
+ for (; H; ) {
3843
+ const Y = H.classList, _ = H.getAttribute("data-slot");
3835
3844
  if (_ && (_.includes("popover") || _.includes("dialog"))) {
3836
3845
  Ce = !0;
3837
3846
  break;
3838
3847
  }
3839
- if (L.hasAttribute("data-preserve-selection")) {
3848
+ if (H.hasAttribute("data-preserve-selection")) {
3840
3849
  Ce = !0;
3841
3850
  break;
3842
3851
  }
3843
- if (H && (H.contains("sc-toolbar") || H.contains("sc-toolbar-items") || H.contains("sc-toolbar-btn") || H.contains("sc-toolbar-btn-sm") || H.contains("sc-toolbar-btn-icon") || H.contains("sc-toolbar-color") || H.contains("sc-toolbar-label") || H.contains("sc-toolbar-select") || H.contains("sc-toolbar-select-sm") || H.contains("sc-toolbar-group") || H.contains("sc-toolbar-scroll") || H.contains("sc-toolbar-color-label") || H.contains("sc-toolbar-color-square") || H.contains("sc-color-picker-dropdown") || H.contains("sc-text-color-panel") || H.contains("sc-tooltip-wrapper") || H.contains("sc-font-dropdown-with-label") || H.contains("sc-font-family-select-button") || H.contains("sc-more-menu-btn") || H.contains("sc-more-menu-toolbar") || H.contains("sc-font-drawer-overlay") || H.contains("sc-font-drawer-content") || H.contains("sc-font-drawer-handle") || H.contains("sc-font-drawer-handle-bar") || H.contains("sc-font-dropdown-list-container") || H.contains("sc-font-dropdown-search") || H.contains("sc-font-search-input") || H.contains("sc-font-category-filters") || H.contains("sc-font-category-btn") || H.contains("sc-font-grid-option") || H.contains("sc-font-section") || H.contains("sc-font-section-header") || H.contains("sc-font-section-used") || H.contains("sc-font-section-header-used") || H.contains("sc-font-dropdown-list-grid") || H.contains("sc-font-dropdown-list-grid-used") || H.contains("sc-font-preview") || H.contains("sc-font-name-label") || H.contains("sc-font-size-slider-container") || H.contains("sc-font-size-slider") || H.contains("sc-font-size-icon-small") || H.contains("sc-font-size-icon-large") || H.contains("sc-font-icon-toggle") || H.contains("sc-font-dropdown-empty") || H.contains("vaul-drawer-wrapper") || H.contains("vaul-overlay"))) {
3852
+ if (Y && (Y.contains("sc-toolbar") || Y.contains("sc-toolbar-items") || Y.contains("sc-toolbar-btn") || Y.contains("sc-toolbar-btn-sm") || Y.contains("sc-toolbar-btn-icon") || Y.contains("sc-toolbar-color") || Y.contains("sc-toolbar-label") || Y.contains("sc-toolbar-select") || Y.contains("sc-toolbar-select-sm") || Y.contains("sc-toolbar-group") || Y.contains("sc-toolbar-scroll") || Y.contains("sc-toolbar-color-label") || Y.contains("sc-toolbar-color-square") || Y.contains("sc-color-picker-dropdown") || Y.contains("sc-text-color-panel") || Y.contains("sc-tooltip-wrapper") || Y.contains("sc-font-dropdown-with-label") || Y.contains("sc-font-family-select-button") || Y.contains("sc-more-menu-btn") || Y.contains("sc-more-menu-toolbar") || Y.contains("sc-font-drawer-overlay") || Y.contains("sc-font-drawer-content") || Y.contains("sc-font-drawer-handle") || Y.contains("sc-font-drawer-handle-bar") || Y.contains("sc-font-dropdown-list-container") || Y.contains("sc-font-dropdown-search") || Y.contains("sc-font-search-input") || Y.contains("sc-font-category-filters") || Y.contains("sc-font-category-btn") || Y.contains("sc-font-grid-option") || Y.contains("sc-font-section") || Y.contains("sc-font-section-header") || Y.contains("sc-font-section-used") || Y.contains("sc-font-section-header-used") || Y.contains("sc-font-dropdown-list-grid") || Y.contains("sc-font-dropdown-list-grid-used") || Y.contains("sc-font-preview") || Y.contains("sc-font-name-label") || Y.contains("sc-font-size-slider-container") || Y.contains("sc-font-size-slider") || Y.contains("sc-font-size-icon-small") || Y.contains("sc-font-size-icon-large") || Y.contains("sc-font-icon-toggle") || Y.contains("sc-font-dropdown-empty") || Y.contains("vaul-drawer-wrapper") || Y.contains("vaul-overlay"))) {
3844
3853
  Ce = !0;
3845
3854
  break;
3846
3855
  }
3847
- L = L.parentElement;
3856
+ H = H.parentElement;
3848
3857
  }
3849
3858
  if (!Ce && b.current)
3850
- for (L = b.current; L; ) {
3851
- const H = L.classList, _ = L.getAttribute("data-slot");
3859
+ for (H = b.current; H; ) {
3860
+ const Y = H.classList, _ = H.getAttribute("data-slot");
3852
3861
  if (_ && (_.includes("popover") || _.includes("dialog"))) {
3853
3862
  Ce = !0;
3854
3863
  break;
3855
3864
  }
3856
- if (L.hasAttribute("data-preserve-selection")) {
3865
+ if (H.hasAttribute("data-preserve-selection")) {
3857
3866
  Ce = !0;
3858
3867
  break;
3859
3868
  }
3860
- if (H && (H.contains("sc-toolbar") || H.contains("sc-toolbar-items") || H.contains("sc-toolbar-btn") || H.contains("sc-toolbar-btn-sm") || H.contains("sc-toolbar-btn-icon") || H.contains("sc-toolbar-color") || H.contains("sc-toolbar-label") || H.contains("sc-toolbar-select") || H.contains("sc-toolbar-select-sm") || H.contains("sc-toolbar-group") || H.contains("sc-toolbar-scroll") || H.contains("sc-toolbar-color-label") || H.contains("sc-toolbar-color-square") || H.contains("sc-color-picker-dropdown") || H.contains("sc-text-color-panel") || H.contains("sc-tooltip-wrapper") || H.contains("sc-font-dropdown-with-label") || H.contains("sc-font-family-select-button") || H.contains("sc-more-menu-btn") || H.contains("sc-more-menu-toolbar") || H.contains("vaul-drawer-wrapper") || H.contains("vaul-overlay"))) {
3869
+ if (Y && (Y.contains("sc-toolbar") || Y.contains("sc-toolbar-items") || Y.contains("sc-toolbar-btn") || Y.contains("sc-toolbar-btn-sm") || Y.contains("sc-toolbar-btn-icon") || Y.contains("sc-toolbar-color") || Y.contains("sc-toolbar-label") || Y.contains("sc-toolbar-select") || Y.contains("sc-toolbar-select-sm") || Y.contains("sc-toolbar-group") || Y.contains("sc-toolbar-scroll") || Y.contains("sc-toolbar-color-label") || Y.contains("sc-toolbar-color-square") || Y.contains("sc-color-picker-dropdown") || Y.contains("sc-text-color-panel") || Y.contains("sc-tooltip-wrapper") || Y.contains("sc-font-dropdown-with-label") || Y.contains("sc-font-family-select-button") || Y.contains("sc-more-menu-btn") || Y.contains("sc-more-menu-toolbar") || Y.contains("vaul-drawer-wrapper") || Y.contains("vaul-overlay"))) {
3861
3870
  Ce = !0;
3862
3871
  break;
3863
3872
  }
3864
- L = L.parentElement;
3873
+ H = H.parentElement;
3865
3874
  }
3866
3875
  if (!Ce)
3867
3876
  zt();
3868
3877
  else {
3869
- const H = T, _ = I;
3870
- (Xe = n.current) == null || Xe.focus(), n.current && n.current.setSelectionRange(H, _);
3878
+ const Y = T, _ = I;
3879
+ (Xe = n.current) == null || Xe.focus(), n.current && n.current.setSelectionRange(Y, _);
3871
3880
  }
3872
3881
  }, 0);
3873
3882
  }, [zt, T, I]), We = ft(
@@ -3876,7 +3885,7 @@ function Pi(e) {
3876
3885
  if (h.key === "Enter" && (h.metaKey || h.ctrlKey))
3877
3886
  h.preventDefault(), zt();
3878
3887
  else if (h.key === "Escape")
3879
- h.preventDefault(), h.stopPropagation(), D(!1), u(""), j(null), o.current = null, xe(null), s.current = null;
3888
+ h.preventDefault(), h.stopPropagation(), N(!1), u(""), j(null), o.current = null, me(null), s.current = null;
3880
3889
  else if ((h.metaKey || h.ctrlKey) && h.key.toLowerCase() === "b")
3881
3890
  h.preventDefault(), Pt("bold");
3882
3891
  else if ((h.metaKey || h.ctrlKey) && h.key.toLowerCase() === "i")
@@ -3891,7 +3900,7 @@ function Pi(e) {
3891
3900
  else if (h.key === "ArrowUp" || h.key === "ArrowDown") {
3892
3901
  if (P && P instanceof Qe) {
3893
3902
  h.preventDefault();
3894
- const re = h.key === "ArrowUp" ? "up" : "down", he = Ao(P, A, re);
3903
+ const re = h.key === "ArrowUp" ? "up" : "down", he = Do(P, A, re);
3895
3904
  G(he), te(he), ae(he), i.current = he, U.setSelectionRange(he, he);
3896
3905
  }
3897
3906
  } else (h.key === "Home" || h.key === "End") && setTimeout(() => {
@@ -3901,18 +3910,18 @@ function Pi(e) {
3901
3910
  },
3902
3911
  [zt, Pt, G, te, ae, i, A, P]
3903
3912
  );
3904
- Pe(() => {
3913
+ Ie(() => {
3905
3914
  C && (a.current = performance.now());
3906
- }, [C, A, a]), Pe(() => {
3915
+ }, [C, A, a]), Ie(() => {
3907
3916
  if (!C) return;
3908
3917
  let h, U = 0;
3909
- const re = 33, he = (L) => {
3910
- L - U >= re && (ie((Ce) => (Ce + 1) % 1e3), U = L), h = requestAnimationFrame(he);
3918
+ const re = 33, he = (H) => {
3919
+ H - U >= re && (ie((Ce) => (Ce + 1) % 1e3), U = H), h = requestAnimationFrame(he);
3911
3920
  };
3912
3921
  return h = requestAnimationFrame(he), () => cancelAnimationFrame(h);
3913
3922
  }, [C]);
3914
3923
  const Ee = we(!1);
3915
- Pe(() => {
3924
+ Ie(() => {
3916
3925
  if (C && !Ee.current && n.current) {
3917
3926
  n.current.focus();
3918
3927
  const h = R.length;
@@ -3921,7 +3930,7 @@ function Pi(e) {
3921
3930
  Ee.current = C;
3922
3931
  }, [C, R]);
3923
3932
  const lt = we(null), se = (h, U) => h === U ? !0 : !h || !U ? !1 : h.color === U.color && h.fontFamily === U.fontFamily && h.fontSize === U.fontSize && h.bold === U.bold && h.italic === U.italic && h.underline === U.underline && h.strikethrough === U.strikethrough;
3924
- return Pe(() => {
3933
+ return Ie(() => {
3925
3934
  if (!C || !E) return;
3926
3935
  const h = Math.min(T, I), U = Math.max(T, I);
3927
3936
  if (h === U) {
@@ -3929,17 +3938,17 @@ function Pi(e) {
3929
3938
  if (h > 0)
3930
3939
  re = E.getStyleAt(h - 1);
3931
3940
  else {
3932
- const he = N.find((L) => L.id === g);
3941
+ const he = D.find((H) => H.id === g);
3933
3942
  he instanceof Qe && (re = he.getDefaultStyle());
3934
3943
  }
3935
- re && !se(re, lt.current) && (lt.current = re, xe(re));
3944
+ re && !se(re, lt.current) && (lt.current = re, me(re));
3936
3945
  }
3937
- }, [C, E, T, I, g]), Pe(() => {
3946
+ }, [C, E, T, I, g]), Ie(() => {
3938
3947
  if (!C || !n.current) return;
3939
3948
  const h = n.current;
3940
3949
  (h.selectionStart !== T || h.selectionEnd !== I) && (T !== I ? h.setSelectionRange(T, I) : h.setSelectionRange(A, A));
3941
- }, [R, C, A, T, I]), Pe(() => {
3942
- const h = N.find((U) => U.id === g);
3950
+ }, [R, C, A, T, I]), Ie(() => {
3951
+ const h = D.find((U) => U.id === g);
3943
3952
  if (!(!C || !h || !t.current || !n.current))
3944
3953
  return f.current && clearTimeout(f.current), f.current = setTimeout(() => {
3945
3954
  let U = h;
@@ -3950,28 +3959,28 @@ function Pi(e) {
3950
3959
  if (!(U instanceof Qe)) return;
3951
3960
  const re = U.clone();
3952
3961
  E && re.setRichText(E);
3953
- const he = re.getVisualBoundingBox(), L = t.current.getBoundingClientRect(), Ce = he.height + 16, Ie = 6;
3962
+ const he = re.getVisualBoundingBox(), H = t.current.getBoundingClientRect(), Ce = he.height + 16, Pe = 6;
3954
3963
  if ($({
3955
- x: L.left + (he.x + ne) * w - Ie,
3956
- y: L.top + (he.y + V) * w - Ie,
3964
+ x: H.left + (he.x + ne) * w - Pe,
3965
+ y: H.top + (he.y + V) * w - Pe,
3957
3966
  width: Math.max(20, he.width * w),
3958
3967
  height: Math.max(Ce * w, 50)
3959
3968
  }), s.current && h instanceof Re) {
3960
- const Ve = h.clone(), Xe = Ve.children.findIndex((H) => H.id === s.current);
3961
- Xe >= 0 && (Ve.children[Xe] = re, Ve.updateBoundsFromChildren(!0)), Se((H) => H.map((_) => _.id === Ve.id ? Ve : _)), De.update(re, w);
3969
+ const Ve = h.clone(), Xe = Ve.children.findIndex((Y) => Y.id === s.current);
3970
+ Xe >= 0 && (Ve.children[Xe] = re, Ve.updateBoundsFromChildren(!0)), Se((Y) => Y.map((_) => _.id === Ve.id ? Ve : _)), Ne.update(re, w);
3962
3971
  } else
3963
- Se((Ve) => Ve.map((Xe) => Xe.id === re.id ? re : Xe)), De.update(re, w);
3972
+ Se((Ve) => Ve.map((Xe) => Xe.id === re.id ? re : Xe)), Ne.update(re, w);
3964
3973
  be((Ve) => Ve + 1);
3965
3974
  }, 50), () => {
3966
3975
  f.current && clearTimeout(f.current);
3967
3976
  };
3968
- }, [R, E, C, g, w]), Pe(() => {
3977
+ }, [R, E, C, g, w]), Ie(() => {
3969
3978
  if (!C || !n.current) return;
3970
3979
  const h = n.current, U = () => {
3971
3980
  if (d.current || Date.now() - l.current < x)
3972
3981
  return;
3973
- const L = h.selectionStart || 0, Ce = h.selectionEnd || 0;
3974
- G((Ie) => Ie === Ce ? Ie : Ce), te((Ie) => Ie === L ? Ie : L), ae((Ie) => Ie === Ce ? Ie : Ce), Oe == null || Oe();
3982
+ const H = h.selectionStart || 0, Ce = h.selectionEnd || 0;
3983
+ G((Pe) => Pe === Ce ? Pe : Ce), te((Pe) => Pe === H ? Pe : H), ae((Pe) => Pe === Ce ? Pe : Ce), Oe == null || Oe();
3975
3984
  };
3976
3985
  h.addEventListener("click", U), h.addEventListener("keyup", U), h.addEventListener("select", U), h.addEventListener("mouseup", U);
3977
3986
  const re = () => {
@@ -3980,31 +3989,31 @@ function Pi(e) {
3980
3989
  return document.addEventListener("selectionchange", re), U(), () => {
3981
3990
  h.removeEventListener("click", U), h.removeEventListener("keyup", U), h.removeEventListener("select", U), h.removeEventListener("mouseup", U), document.removeEventListener("selectionchange", re);
3982
3991
  };
3983
- }, [C]), Pe(() => {
3992
+ }, [C]), Ie(() => {
3984
3993
  const h = (U) => {
3985
3994
  const re = U.target;
3986
3995
  if (re.tagName === "INPUT" || re.tagName === "TEXTAREA" || U.key !== "Enter" || C || !t.current) return;
3987
3996
  const he = t.current.getBoundingClientRect();
3988
- if (O && O instanceof Qe && !(O instanceof Re) && !(O instanceof Yt) && !(O instanceof Qn)) {
3997
+ if (O && O instanceof Qe && !(O instanceof Re) && !(O instanceof Lt) && !(O instanceof Qn)) {
3989
3998
  U.preventDefault();
3990
- const L = O.getVisualBoundingBox(), Ce = L.height + 16, Ie = 6;
3999
+ const H = O.getVisualBoundingBox(), Ce = H.height + 16, Pe = 6;
3991
4000
  $({
3992
- x: he.left + (L.x + ne) * w - Ie,
3993
- y: he.top + (L.y + V) * w - Ie,
3994
- width: Math.max(200, L.width * w),
4001
+ x: he.left + (H.x + ne) * w - Pe,
4002
+ y: he.top + (H.y + V) * w - Pe,
4003
+ width: Math.max(200, H.width * w),
3995
4004
  height: Math.max(Ce * w, 50)
3996
- }), u(fs(O)), D(!0), p.current = Date.now(), s.current = O.id;
4005
+ }), u(fs(O)), N(!0), p.current = Date.now(), s.current = O.id;
3997
4006
  return;
3998
4007
  }
3999
- if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Yt) && !(P instanceof Qn)) {
4008
+ if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Lt) && !(P instanceof Qn)) {
4000
4009
  U.preventDefault();
4001
- const L = P.getVisualBoundingBox(), Ce = L.height + 16, Ie = 6;
4010
+ const H = P.getVisualBoundingBox(), Ce = H.height + 16, Pe = 6;
4002
4011
  $({
4003
- x: he.left + (L.x + ne) * w - Ie,
4004
- y: he.top + (L.y + V) * w - Ie,
4005
- width: Math.max(200, L.width * w),
4012
+ x: he.left + (H.x + ne) * w - Pe,
4013
+ y: he.top + (H.y + V) * w - Pe,
4014
+ width: Math.max(200, H.width * w),
4006
4015
  height: Math.max(Ce * w, 50)
4007
- }), u(fs(P)), D(!0), p.current = Date.now();
4016
+ }), u(fs(P)), N(!0), p.current = Date.now();
4008
4017
  }
4009
4018
  };
4010
4019
  return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
@@ -4019,7 +4028,7 @@ function Pi(e) {
4019
4028
  getWrappedTextForEditing: fs
4020
4029
  };
4021
4030
  }
4022
- const br = Dr(
4031
+ const br = Nr(
4023
4032
  ({
4024
4033
  elements: e,
4025
4034
  artboards: t,
@@ -4046,22 +4055,22 @@ const br = Dr(
4046
4055
  offsetY: g = 0,
4047
4056
  viewPadding: P = 1,
4048
4057
  artboardBorderRadius: O = 0,
4049
- fixedMargin: N,
4058
+ fixedMargin: D,
4050
4059
  fixedMarginX: w,
4051
4060
  fixedMarginY: ne,
4052
4061
  showRotationHandle: V = !0,
4053
- canvasCutouts: D,
4062
+ canvasCutouts: N,
4054
4063
  pieceGuides: u,
4055
4064
  pieceFocus: j,
4056
4065
  focusedPieceRect: G
4057
4066
  }, te) => {
4058
- const { resolvedTheme: ae } = po(), $ = we(null), xe = R || $, ie = we(null), be = we(!1), Se = we(0), Te = we(0), Oe = we(0), De = we(!1), $e = we(0), at = we(null), pt = we(0), ct = we(null), Pt = we({ start: null, end: null }), zt = we(null), At = we(null), We = we(null), Ee = we(null), lt = 400, se = 300, h = 50, U = 200, re = je.useMemo(() => {
4067
+ const { resolvedTheme: ae } = po(), $ = we(null), me = R || $, ie = we(null), be = we(!1), Se = we(0), Te = we(0), Oe = we(0), Ne = we(!1), $e = we(0), at = we(null), pt = we(0), ct = we(null), Pt = we({ start: null, end: null }), zt = we(null), At = we(null), We = we(null), Ee = we(null), lt = 400, se = 300, h = 50, U = 200, re = je.useMemo(() => {
4059
4068
  if (!j || j === "spread") return null;
4060
4069
  const ye = (u == null ? void 0 : u.pieces) ?? [];
4061
4070
  if (ye.length <= 1) return null;
4062
- const de = ye.find((He) => He.id === j.pieceId);
4071
+ const de = ye.find((Ye) => Ye.id === j.pieceId);
4063
4072
  return de ? { x: de.x, y: de.y, width: de.width, height: de.height } : null;
4064
- }, [j, u]), he = G !== void 0 ? G : re, L = je.useMemo(() => {
4073
+ }, [j, u]), he = G !== void 0 ? G : re, H = je.useMemo(() => {
4065
4074
  if (he) return he;
4066
4075
  const ye = (u == null ? void 0 : u.pieces) ?? [];
4067
4076
  if (ye.length === 1) {
@@ -4071,21 +4080,21 @@ const br = Dr(
4071
4080
  return null;
4072
4081
  }, [he, u]), {
4073
4082
  isTouchDevice: Ce,
4074
- canvasSize: Ie,
4083
+ canvasSize: Pe,
4075
4084
  lastTouchTargetRef: Ve,
4076
4085
  effectiveViewPadding: Xe,
4077
- paddedCanvasWidth: H,
4086
+ paddedCanvasWidth: Y,
4078
4087
  paddedCanvasHeight: _,
4079
4088
  paddingOffsetX: ot,
4080
4089
  paddingOffsetY: rt,
4081
4090
  zoomInvariantBorderRadius: Ze
4082
- } = $o({
4091
+ } = Fo({
4083
4092
  width: E,
4084
4093
  height: A,
4085
4094
  zoom: T,
4086
4095
  viewPadding: P,
4087
4096
  artboardBorderRadius: O,
4088
- fixedMargin: N,
4097
+ fixedMargin: D,
4089
4098
  fixedMarginX: w,
4090
4099
  fixedMarginY: ne,
4091
4100
  artboards: t,
@@ -4093,10 +4102,10 @@ const br = Dr(
4093
4102
  focusedPieceRect: he
4094
4103
  }), {
4095
4104
  snapGuides: gt,
4096
- setSnapGuides: Nt,
4097
- spacingIndicators: Dt,
4105
+ setSnapGuides: Dt,
4106
+ spacingIndicators: Nt,
4098
4107
  setSpacingIndicators: tn,
4099
- isAltKeyPressed: Ht,
4108
+ isAltKeyPressed: Yt,
4100
4109
  setIsAltKeyPressed: wt,
4101
4110
  isRotating: Xt,
4102
4111
  setIsRotating: rn,
@@ -4104,65 +4113,65 @@ const br = Dr(
4104
4113
  currentRotation: Ut,
4105
4114
  setCurrentRotation: Ke,
4106
4115
  setRotatingElementVersion: Ue
4107
- } = Fo(), {
4116
+ } = Wo(), {
4108
4117
  renderVersion: Ae,
4109
4118
  forceRender: K,
4110
4119
  handlesVersion: ue,
4111
- setHandlesVersion: me,
4120
+ setHandlesVersion: ge,
4112
4121
  forceUpdate: Be,
4113
4122
  cursorAnimationFrame: Je,
4114
4123
  setCursorAnimationFrame: Ge
4115
- } = Wo({ elements: e }), [Fe] = le(() => new co()), [nt] = le(() => new lo({ showBorder: !1, showLabel: !1 })), [st] = le(() => new uo({ enabled: !0, showGuides: !0 })), [xt] = le(() => new ho({ enabled: !0, showLabels: !0 })), [yt] = le(() => {
4124
+ } = Vo({ elements: e }), [Fe] = le(() => new co()), [nt] = le(() => new lo({ showBorder: !1, showLabel: !1 })), [st] = le(() => new uo({ enabled: !0, showGuides: !0 })), [xt] = le(() => new ho({ enabled: !0, showLabels: !0 })), [yt] = le(() => {
4116
4125
  const ye = new fo();
4117
4126
  return ye.setResizePipeline(gs), ye.setSnapHandler(st), ye;
4118
4127
  });
4119
- Pe(() => {
4128
+ Ie(() => {
4120
4129
  nt.setOptions({ borderRadius: Ze });
4121
- }, [Ze, nt]), Pe(() => {
4130
+ }, [Ze, nt]), Ie(() => {
4122
4131
  const ye = G !== void 0 ? G : re;
4123
4132
  st.setExtraSnapRects(
4124
4133
  ye ? [{ id: "focused-piece", ...ye }] : []
4125
4134
  );
4126
4135
  }, [st, G, re]);
4127
- const Lt = we(e);
4128
- Lt.current = e;
4136
+ const Ht = we(e);
4137
+ Ht.current = e;
4129
4138
  const ve = e.find((ye) => ye.id === s), as = we(ve);
4130
4139
  as.current = ve;
4131
4140
  const [An, En] = le("");
4132
- Pe(() => {
4141
+ Ie(() => {
4133
4142
  var de;
4134
4143
  if (!s) return;
4135
- const ye = e.find((He) => He.id === s);
4144
+ const ye = e.find((Ye) => Ye.id === s);
4136
4145
  if (ye)
4137
4146
  if (ye instanceof Qe) {
4138
- const He = ((de = ye.text) == null ? void 0 : de.slice(0, 40)) || "empty";
4139
- En(`Selected text element: ${He}`);
4140
- } else ye instanceof Yt ? En("Selected image element") : ye instanceof Re ? En("Selected group") : En("Selected element");
4147
+ const Ye = ((de = ye.text) == null ? void 0 : de.slice(0, 40)) || "empty";
4148
+ En(`Selected text element: ${Ye}`);
4149
+ } else ye instanceof Lt ? En("Selected image element") : ye instanceof Re ? En("Selected group") : En("Selected element");
4141
4150
  }, [s, e]);
4142
4151
  const cs = we(n);
4143
4152
  cs.current = n;
4144
4153
  const Xn = we(/* @__PURE__ */ new Map());
4145
- Pe(() => {
4154
+ Ie(() => {
4146
4155
  const ye = (de) => {
4147
- const He = de, Le = cs.current.getActiveArtboardId(), tt = Xn.current.get(Le) || [], vt = [];
4156
+ const Ye = de, He = cs.current.getActiveArtboardId(), tt = Xn.current.get(He) || [], vt = [];
4148
4157
  return tt.forEach((Rt) => {
4149
4158
  Rt instanceof Re ? vt.push(...Rt.children) : vt.push(Rt);
4150
- }), st.snapDimensions(He, vt, He.startData);
4159
+ }), st.snapDimensions(Ye, vt, Ye.startData);
4151
4160
  };
4152
4161
  return gs.addHook("afterResize", ye), () => {
4153
4162
  gs.removeHook("afterResize", ye);
4154
4163
  };
4155
4164
  }, [st]);
4156
- const { cropController: Wn } = Ho(), { penTool: xn, penCursor: z } = Oo({ selectedElement: ve }), {
4165
+ const { cropController: Wn } = Ho(), { penTool: xn, penCursor: z } = zo({ selectedElement: ve }), {
4157
4166
  isEditing: fe,
4158
4167
  setIsEditing: dt,
4159
4168
  editText: W,
4160
4169
  setEditText: Z,
4161
4170
  editPosition: et,
4162
4171
  setEditPosition: B,
4163
- cursorPosition: ge,
4172
+ cursorPosition: xe,
4164
4173
  setCursorPosition: S,
4165
- selectionStart: Y,
4174
+ selectionStart: L,
4166
4175
  setSelectionStart: Q,
4167
4176
  selectionEnd: q,
4168
4177
  setSelectionEnd: pe,
@@ -4175,28 +4184,28 @@ const br = Dr(
4175
4184
  editRichTextRef: F,
4176
4185
  currentFormattingStyle: ce,
4177
4186
  setCurrentFormattingStyle: oe
4178
- } = _o({ selectedElement: ve, ref: te });
4179
- Pe(() => {
4187
+ } = $o({ selectedElement: ve, ref: te });
4188
+ Ie(() => {
4180
4189
  const ye = Date.now() - $e.current, de = at.current;
4181
- de && ye < se ? (Y !== de.start || q !== de.end) && (S(de.cursor), Q(de.start), pe(de.end), ie.current && ie.current.setSelectionRange(de.start, de.end)) : de && ye >= se && (at.current = null);
4182
- }, [Y, q, ge]), Pe(() => {
4190
+ de && ye < se ? (L !== de.start || q !== de.end) && (S(de.cursor), Q(de.start), pe(de.end), ie.current && ie.current.setSelectionRange(de.start, de.end)) : de && ye >= se && (at.current = null);
4191
+ }, [L, q, xe]), Ie(() => {
4183
4192
  if (!fe) return;
4184
- const ye = xe.current;
4193
+ const ye = me.current;
4185
4194
  if (!ye) return;
4186
4195
  let de = ye.getBoundingClientRect();
4187
- const He = () => {
4188
- const Le = ie.current, tt = xe.current;
4189
- if (!Le || !tt) return;
4196
+ const Ye = () => {
4197
+ const He = ie.current, tt = me.current;
4198
+ if (!He || !tt) return;
4190
4199
  const vt = tt.getBoundingClientRect(), Rt = vt.left - de.left, ht = vt.top - de.top;
4191
- Rt === 0 && ht === 0 || (de = vt, Le.style.left = `${parseFloat(Le.style.left || "0") + Rt}px`, Le.style.top = `${parseFloat(Le.style.top || "0") + ht}px`);
4200
+ Rt === 0 && ht === 0 || (de = vt, He.style.left = `${parseFloat(He.style.left || "0") + Rt}px`, He.style.top = `${parseFloat(He.style.top || "0") + ht}px`);
4192
4201
  };
4193
- return window.addEventListener("scroll", He, { passive: !0, capture: !0 }), window.addEventListener("resize", He), () => {
4194
- window.removeEventListener("scroll", He, { capture: !0 }), window.removeEventListener("resize", He);
4202
+ return window.addEventListener("scroll", Ye, { passive: !0, capture: !0 }), window.addEventListener("resize", Ye), () => {
4203
+ window.removeEventListener("scroll", Ye, { capture: !0 }), window.removeEventListener("resize", Ye);
4195
4204
  };
4196
4205
  }, [fe]);
4197
4206
  const {
4198
4207
  isMarqueeSelecting: Me,
4199
- marqueeStart: Ye,
4208
+ marqueeStart: Le,
4200
4209
  marqueeEnd: it,
4201
4210
  marqueePreviewSelection: bt,
4202
4211
  startMarqueeSelection: Bt,
@@ -4205,15 +4214,15 @@ const br = Dr(
4205
4214
  } = No(), {
4206
4215
  multiSelectionGroupBoundsRef: Gt,
4207
4216
  multiSelectionOBBRef: ut
4208
- } = Lo(o), {
4217
+ } = _o(o), {
4209
4218
  activeChildElement: kt,
4210
4219
  updateActiveChild: kn,
4211
4220
  editingChildIdRef: Ft
4212
- } = zo({ elements: e, selectedElement: ve, transformHandles: Fe, onActiveChildChange: d }), { hoverState: qt, setHoverState: jt } = Xo({ onHoverChange: p }), _t = xs(() => {
4221
+ } = Xo({ elements: e, selectedElement: ve, transformHandles: Fe, onActiveChildChange: d }), { hoverState: qt, setHoverState: jt } = Lo({ onHoverChange: p }), _t = xs(() => {
4213
4222
  const ye = /* @__PURE__ */ new Map();
4214
4223
  return e.forEach((de) => {
4215
- const He = n.getArtboardIdForElement(de.id);
4216
- ye.has(He) || ye.set(He, []), ye.get(He).push(de);
4224
+ const Ye = n.getArtboardIdForElement(de.id);
4225
+ ye.has(Ye) || ye.set(Ye, []), ye.get(Ye).push(de);
4217
4226
  }), ye;
4218
4227
  }, [e, n]);
4219
4228
  Xn.current = _t;
@@ -4221,36 +4230,36 @@ const br = Dr(
4221
4230
  const ye = n.getActiveArtboardId();
4222
4231
  return _t.get(ye) || [];
4223
4232
  }, [_t, n]);
4224
- Pe(() => {
4225
- const ye = (Le) => {
4233
+ Ie(() => {
4234
+ const ye = (He) => {
4226
4235
  if (!fe) {
4227
4236
  if (xn.isActive() && ve instanceof wn) {
4228
- if (Le.key === "Escape") {
4229
- Le.preventDefault(), xn.finishPath();
4237
+ if (He.key === "Escape") {
4238
+ He.preventDefault(), xn.finishPath();
4230
4239
  const tt = ve.clone();
4231
- l(ve, tt), me((vt) => vt + 1);
4240
+ l(ve, tt), ge((vt) => vt + 1);
4232
4241
  return;
4233
- } else if (Le.key === "Backspace" || Le.key === "Delete") {
4234
- Le.preventDefault(), xn.deleteLastPoint(), me((tt) => tt + 1);
4242
+ } else if (He.key === "Backspace" || He.key === "Delete") {
4243
+ He.preventDefault(), xn.deleteLastPoint(), ge((tt) => tt + 1);
4235
4244
  return;
4236
4245
  }
4237
4246
  }
4238
- Le.altKey && wt(!0);
4247
+ He.altKey && wt(!0);
4239
4248
  }
4240
- }, de = (Le) => {
4241
- Le.altKey || wt(!1);
4242
- }, He = (Le) => {
4243
- (!Le.relatedTarget || !Le.relatedTarget.ownerDocument) && wt(!1);
4249
+ }, de = (He) => {
4250
+ He.altKey || wt(!1);
4251
+ }, Ye = (He) => {
4252
+ (!He.relatedTarget || !He.relatedTarget.ownerDocument) && wt(!1);
4244
4253
  };
4245
- return window.addEventListener("keydown", ye), window.addEventListener("keyup", de), window.addEventListener("blur", He), () => {
4246
- window.removeEventListener("keydown", ye), window.removeEventListener("keyup", de), window.removeEventListener("blur", He);
4254
+ return window.addEventListener("keydown", ye), window.addEventListener("keyup", de), window.addEventListener("blur", Ye), () => {
4255
+ window.removeEventListener("keydown", ye), window.removeEventListener("keyup", de), window.removeEventListener("blur", Ye);
4247
4256
  };
4248
- }, [xn, ve, l, me, fe]), Pe(() => {
4249
- if (!xe.current || !zt.current || yt.getMode() === "drag" || yt.getMode() === "resize")
4257
+ }, [xn, ve, l, ge, fe]), Ie(() => {
4258
+ if (!me.current || !zt.current || yt.getMode() === "drag" || yt.getMode() === "resize")
4250
4259
  return;
4251
- const { x: de, y: He } = zt.current;
4252
- if (Ht) {
4253
- let Le = null;
4260
+ const { x: de, y: Ye } = zt.current;
4261
+ if (Yt) {
4262
+ let He = null;
4254
4263
  const tt = $t();
4255
4264
  for (let vt = tt.length - 1; vt >= 0; vt--) {
4256
4265
  const Rt = tt[vt];
@@ -4259,51 +4268,51 @@ const br = Dr(
4259
4268
  for (let ht = Rt.children.length - 1; ht >= 0; ht--) {
4260
4269
  const qe = Rt.children[ht];
4261
4270
  if (qe.visible === !1) continue;
4262
- const Ne = qe.getVisualBoundingBox();
4263
- if (de >= Ne.x && de <= Ne.x + Ne.width && He >= Ne.y && He <= Ne.y + Ne.height) {
4264
- Le = qe;
4271
+ const De = qe.getVisualBoundingBox();
4272
+ if (de >= De.x && de <= De.x + De.width && Ye >= De.y && Ye <= De.y + De.height) {
4273
+ He = qe;
4265
4274
  break;
4266
4275
  }
4267
4276
  }
4268
4277
  else {
4269
4278
  const ht = Rt.getVisualBoundingBox();
4270
- if (de >= ht.x && de <= ht.x + ht.width && He >= ht.y && He <= ht.y + ht.height) {
4271
- Le = Rt;
4279
+ if (de >= ht.x && de <= ht.x + ht.width && Ye >= ht.y && Ye <= ht.y + ht.height) {
4280
+ He = Rt;
4272
4281
  break;
4273
4282
  }
4274
4283
  }
4275
- if (Le) break;
4284
+ if (He) break;
4276
4285
  }
4277
4286
  }
4278
- if (Le) {
4287
+ if (He) {
4279
4288
  const vt = [];
4280
4289
  tt.forEach((ht) => {
4281
4290
  ht instanceof Re ? vt.push(...ht.children) : vt.push(ht);
4282
4291
  });
4283
- const Rt = xt.detectSpacing(Le, vt, !0);
4292
+ const Rt = xt.detectSpacing(He, vt, !0);
4284
4293
  tn(Rt);
4285
4294
  }
4286
4295
  } else
4287
4296
  tn([]);
4288
- }, [Ht, $t, xt, yt]);
4297
+ }, [Yt, $t, xt, yt]);
4289
4298
  const an = we(null);
4290
- Pe(() => {
4291
- const ye = e.find((He) => He.id === s), de = kt || ye;
4299
+ Ie(() => {
4300
+ const ye = e.find((Ye) => Ye.id === s), de = kt || ye;
4292
4301
  if (de) {
4293
- const He = de.getBoundingBox(), Le = `${de.id}-${He.x}-${He.y}-${He.width}-${He.height}-${de.rotation}`;
4294
- an.current !== Le && (an.current = Le, Fe.update(de, T), me((tt) => tt + 1));
4302
+ const Ye = de.getBoundingBox(), He = `${de.id}-${Ye.x}-${Ye.y}-${Ye.width}-${Ye.height}-${de.rotation}`;
4303
+ an.current !== He && (an.current = He, Fe.update(de, T), ge((tt) => tt + 1));
4295
4304
  }
4296
4305
  }, [s, kt, Fe, T, e]);
4297
4306
  const {
4298
- handleTextEditBlur: Yn,
4307
+ handleTextEditBlur: Ln,
4299
4308
  handleTextKeyDown: Vn,
4300
4309
  applyFormattingToSelection: nn,
4301
4310
  getSelectionStyle: ls,
4302
4311
  toggleFormattingProperty: ds,
4303
4312
  enterTextEditMode: Kn,
4304
4313
  getWrappedTextForEditing: Un
4305
- } = Pi({
4306
- canvasRef: xe,
4314
+ } = Ai({
4315
+ canvasRef: me,
4307
4316
  inputRef: ie,
4308
4317
  editingChildIdRef: Ft,
4309
4318
  editRichTextRef: F,
@@ -4321,8 +4330,8 @@ const br = Dr(
4321
4330
  isEditing: fe,
4322
4331
  editText: W,
4323
4332
  editRichText: X,
4324
- cursorPosition: ge,
4325
- selectionStart: Y,
4333
+ cursorPosition: xe,
4334
+ selectionStart: L,
4326
4335
  selectionEnd: q,
4327
4336
  selectedId: s,
4328
4337
  selectedElement: ve,
@@ -4340,7 +4349,7 @@ const br = Dr(
4340
4349
  setEditPosition: B,
4341
4350
  setCurrentFormattingStyle: oe,
4342
4351
  setCursorAnimationFrame: Ge,
4343
- setHandlesVersion: me,
4352
+ setHandlesVersion: ge,
4344
4353
  setElements: a,
4345
4354
  onElementUpdate: i,
4346
4355
  onTextSelectionChange: m,
@@ -4352,8 +4361,8 @@ const br = Dr(
4352
4361
  handlePointerUp: yn,
4353
4362
  handleDoubleClick: wr,
4354
4363
  handleContextMenu: Sr
4355
- } = Ii({
4356
- canvasRef: xe,
4364
+ } = Pi({
4365
+ canvasRef: me,
4357
4366
  inputRef: ie,
4358
4367
  repositioningCursorRef: be,
4359
4368
  lastClickTimeRef: Se,
@@ -4361,7 +4370,7 @@ const br = Dr(
4361
4370
  lastProcessedClickTimeRef: pt,
4362
4371
  lastMultiClickTimeRef: $e,
4363
4372
  multiClickSelectionRef: at,
4364
- skipDragSelectionRef: De,
4373
+ skipDragSelectionRef: Ne,
4365
4374
  draggingSelectionHandleRef: ct,
4366
4375
  selectionHandlePositionsRef: Pt,
4367
4376
  lastMousePosRef: zt,
@@ -4377,11 +4386,11 @@ const br = Dr(
4377
4386
  isEditing: fe,
4378
4387
  editText: W,
4379
4388
  isTouchDevice: Ce,
4380
- selectionStart: Y,
4389
+ selectionStart: L,
4381
4390
  selectionEnd: q,
4382
4391
  isRotating: Xt,
4383
4392
  isMarqueeSelecting: Me,
4384
- isAltKeyPressed: Ht,
4393
+ isAltKeyPressed: Yt,
4385
4394
  selectedElement: ve,
4386
4395
  activeChildElement: kt,
4387
4396
  elements: e,
@@ -4390,8 +4399,8 @@ const br = Dr(
4390
4399
  zoom: T,
4391
4400
  paddingOffsetX: ot,
4392
4401
  paddingOffsetY: rt,
4393
- spacingIndicators: Dt,
4394
- focusedPieceRect: L,
4402
+ spacingIndicators: Nt,
4403
+ focusedPieceRect: H,
4395
4404
  setCursorPosition: S,
4396
4405
  setSelectionStart: Q,
4397
4406
  setSelectionEnd: pe,
@@ -4400,9 +4409,9 @@ const br = Dr(
4400
4409
  setCurrentRotation: Ke,
4401
4410
  setRotatingElementVersion: Ue,
4402
4411
  setIsAltKeyPressed: wt,
4403
- setSnapGuides: Nt,
4412
+ setSnapGuides: Dt,
4404
4413
  setSpacingIndicators: tn,
4405
- setHandlesVersion: me,
4414
+ setHandlesVersion: ge,
4406
4415
  setHoverState: jt,
4407
4416
  setElements: a,
4408
4417
  forceUpdate: Be,
@@ -4432,8 +4441,8 @@ const br = Dr(
4432
4441
  setCurrentFormattingStyle: oe,
4433
4442
  getWrappedTextForEditing: Un
4434
4443
  });
4435
- fi({
4436
- canvasRef: xe,
4444
+ pi({
4445
+ canvasRef: me,
4437
4446
  elements: e,
4438
4447
  elementsByArtboard: _t,
4439
4448
  artboards: t,
@@ -4445,8 +4454,8 @@ const br = Dr(
4445
4454
  editingChildIdRef: Ft,
4446
4455
  transformHandles: Fe,
4447
4456
  stateMachine: yt,
4448
- canvasSize: Ie,
4449
- paddedCanvasWidth: H,
4457
+ canvasSize: Pe,
4458
+ paddedCanvasWidth: Y,
4450
4459
  paddedCanvasHeight: _,
4451
4460
  paddingOffsetX: ot,
4452
4461
  paddingOffsetY: rt,
@@ -4460,8 +4469,8 @@ const br = Dr(
4460
4469
  isEditing: fe,
4461
4470
  editText: W,
4462
4471
  editRichText: X,
4463
- cursorPosition: ge,
4464
- selectionStart: Y,
4472
+ cursorPosition: xe,
4473
+ selectionStart: L,
4465
4474
  selectionEnd: q,
4466
4475
  cursorOpacityRef: ke,
4467
4476
  cursorStartTimeRef: ee,
@@ -4471,13 +4480,13 @@ const br = Dr(
4471
4480
  lastMultiClickTimeRef: $e,
4472
4481
  MULTI_CLICK_DEBOUNCE: se,
4473
4482
  snapGuides: gt,
4474
- spacingIndicators: Dt,
4475
- isAltKeyPressed: Ht,
4483
+ spacingIndicators: Nt,
4484
+ isAltKeyPressed: Yt,
4476
4485
  multiSelection: o,
4477
4486
  multiSelectionOBBRef: ut,
4478
4487
  multiSelectionGroupBoundsRef: Gt,
4479
4488
  isMarqueeSelecting: Me,
4480
- marqueeStart: Ye,
4489
+ marqueeStart: Le,
4481
4490
  marqueeEnd: it,
4482
4491
  marqueePreviewSelection: bt,
4483
4492
  penTool: xn,
@@ -4506,36 +4515,36 @@ const br = Dr(
4506
4515
  getEditingState: () => ({
4507
4516
  isEditing: fe,
4508
4517
  editText: W,
4509
- cursorPosition: ge,
4510
- selectionStart: Y,
4518
+ cursorPosition: xe,
4519
+ selectionStart: L,
4511
4520
  selectionEnd: q
4512
4521
  }),
4513
4522
  getCropState: () => ({
4514
- isCropping: ve instanceof Yt && ve.isCropping,
4523
+ isCropping: ve instanceof Lt && ve.isCropping,
4515
4524
  elementId: (ve == null ? void 0 : ve.id) || null
4516
4525
  }),
4517
4526
  getPaddingOffset: () => ({ x: ot, y: rt })
4518
4527
  }),
4519
- [nn, ds, fe, Xt, ls, T, K, W, ge, Y, q, ve, ot, rt]
4528
+ [nn, ds, fe, Xt, ls, T, K, W, xe, L, q, ve, ot, rt]
4520
4529
  );
4521
4530
  const Er = xs(() => {
4522
- if (!D || D.length === 0) return;
4523
- const ye = H * T, de = _ * T, He = `M 0 0 h ${ye} v ${de} h ${-ye} Z`, Le = D.map((tt) => {
4531
+ if (!N || N.length === 0) return;
4532
+ const ye = Y * T, de = _ * T, Ye = `M 0 0 h ${ye} v ${de} h ${-ye} Z`, He = N.map((tt) => {
4524
4533
  if (tt.kind === "rect" || tt.kind === "roundedRect") {
4525
4534
  const vt = (ot + tt.x) * T, Rt = (rt + tt.y) * T, ht = tt.width * T, qe = tt.height * T;
4526
4535
  if (tt.kind === "roundedRect") {
4527
- const Ne = (tt.rx ?? tt.ry ?? 0) * T, mt = (tt.ry ?? tt.rx ?? 0) * T;
4528
- if (Ne > 0 || mt > 0)
4536
+ const De = (tt.rx ?? tt.ry ?? 0) * T, mt = (tt.ry ?? tt.rx ?? 0) * T;
4537
+ if (De > 0 || mt > 0)
4529
4538
  return [
4530
- `M ${vt + Ne} ${Rt}`,
4531
- `h ${ht - 2 * Ne}`,
4532
- `a ${Ne} ${mt} 0 0 1 ${Ne} ${mt}`,
4539
+ `M ${vt + De} ${Rt}`,
4540
+ `h ${ht - 2 * De}`,
4541
+ `a ${De} ${mt} 0 0 1 ${De} ${mt}`,
4533
4542
  `v ${qe - 2 * mt}`,
4534
- `a ${Ne} ${mt} 0 0 1 ${-Ne} ${mt}`,
4535
- `h ${-(ht - 2 * Ne)}`,
4536
- `a ${Ne} ${mt} 0 0 1 ${-Ne} ${-mt}`,
4543
+ `a ${De} ${mt} 0 0 1 ${-De} ${mt}`,
4544
+ `h ${-(ht - 2 * De)}`,
4545
+ `a ${De} ${mt} 0 0 1 ${-De} ${-mt}`,
4537
4546
  `v ${-(qe - 2 * mt)}`,
4538
- `a ${Ne} ${mt} 0 0 1 ${Ne} ${-mt}`,
4547
+ `a ${De} ${mt} 0 0 1 ${De} ${-mt}`,
4539
4548
  "Z"
4540
4549
  ].join(" ");
4541
4550
  }
@@ -4543,10 +4552,14 @@ const br = Dr(
4543
4552
  }
4544
4553
  return "";
4545
4554
  }).filter(Boolean);
4546
- if (Le.length !== 0)
4547
- return `path(evenodd, "${He} ${Le.join(" ")}")`;
4548
- }, [D, H, _, ot, rt, T]);
4549
- return /* @__PURE__ */ y(Pn, { children: [
4555
+ if (He.length !== 0)
4556
+ return `path(evenodd, "${Ye} ${He.join(" ")}")`;
4557
+ }, [N, Y, _, ot, rt, T]);
4558
+ return Ie(() => {
4559
+ const ye = me.current;
4560
+ if (ye)
4561
+ return Po(ye);
4562
+ }, [me]), /* @__PURE__ */ y(Pn, { children: [
4550
4563
  /* @__PURE__ */ r(
4551
4564
  "div",
4552
4565
  {
@@ -4562,7 +4575,7 @@ const br = Dr(
4562
4575
  {
4563
4576
  role: "application",
4564
4577
  "aria-label": "Design editor canvas. Use mouse or touch to select, move, and resize elements.",
4565
- ref: xe,
4578
+ ref: me,
4566
4579
  onPointerDown: Wt,
4567
4580
  onPointerMove: Rn,
4568
4581
  onPointerUp: yn,
@@ -4583,7 +4596,7 @@ const br = Dr(
4583
4596
  // products keep the legacy editor-surface fill so the
4584
4597
  // design canvas still reads as a distinct surface.
4585
4598
  background: u ? "transparent" : "var(--color-canvas-bg)",
4586
- width: `${H * T}px`,
4599
+ width: `${Y * T}px`,
4587
4600
  height: `${_ * T}px`,
4588
4601
  cursor: xn.isActive() && ve instanceof wn ? z : void 0,
4589
4602
  position: "absolute",
@@ -4597,37 +4610,37 @@ const br = Dr(
4597
4610
  fe && (() => {
4598
4611
  let ye = ve;
4599
4612
  if (Ft.current && ve instanceof Re) {
4600
- const qe = ve.children.find((Ne) => Ne.id === Ft.current);
4613
+ const qe = ve.children.find((De) => De.id === Ft.current);
4601
4614
  qe && (ye = qe);
4602
4615
  }
4603
- const de = ye instanceof Qe ? ye : null, He = (de == null ? void 0 : de.fontSize) || 24, Le = (de == null ? void 0 : de.fontFamily) || "Arial", tt = (de == null ? void 0 : de.bold) || !1, vt = (de == null ? void 0 : de.italic) || !1, Rt = (de == null ? void 0 : de.textAlign) || "center", ht = /* @__PURE__ */ r(
4616
+ const de = ye instanceof Qe ? ye : null, Ye = (de == null ? void 0 : de.fontSize) || 24, He = (de == null ? void 0 : de.fontFamily) || "Arial", tt = (de == null ? void 0 : de.bold) || !1, vt = (de == null ? void 0 : de.italic) || !1, Rt = (de == null ? void 0 : de.textAlign) || "center", ht = /* @__PURE__ */ r(
4604
4617
  "textarea",
4605
4618
  {
4606
4619
  ref: ie,
4607
4620
  "data-preserve-selection": "",
4608
4621
  value: W,
4609
4622
  onChange: (qe) => {
4610
- const Ne = qe.target.value;
4623
+ const De = qe.target.value;
4611
4624
  if (!X) {
4612
- const Jt = so.fromPlainText(Ne, {});
4613
- F.current = Jt, M(Jt), Z(Ne);
4625
+ const Jt = so.fromPlainText(De, {});
4626
+ F.current = Jt, M(Jt), Z(De);
4614
4627
  const Gn = qe.target.selectionEnd;
4615
4628
  S(Gn), Q(qe.target.selectionStart), pe(qe.target.selectionEnd);
4616
4629
  return;
4617
4630
  }
4618
4631
  const mt = W, bn = X.clone();
4619
4632
  let Vt = 0;
4620
- for (; Vt < mt.length && Vt < Ne.length && mt[Vt] === Ne[Vt]; )
4633
+ for (; Vt < mt.length && Vt < De.length && mt[Vt] === De[Vt]; )
4621
4634
  Vt++;
4622
4635
  let Zt = 0;
4623
- for (; Zt < mt.length - Vt && Zt < Ne.length - Vt && mt[mt.length - 1 - Zt] === Ne[Ne.length - 1 - Zt]; )
4636
+ for (; Zt < mt.length - Vt && Zt < De.length - Vt && mt[mt.length - 1 - Zt] === De[De.length - 1 - Zt]; )
4624
4637
  Zt++;
4625
- const cn = Vt, Mn = mt.length - Zt, Tn = Ne.substring(Vt, Ne.length - Zt);
4638
+ const cn = Vt, Mn = mt.length - Zt, Tn = De.substring(Vt, De.length - Zt);
4626
4639
  if (Mn > cn && bn.delete(cn, Mn), Tn.length > 0) {
4627
4640
  let Jt;
4628
4641
  ce ? Jt = ce : cn > 0 ? Jt = bn.getStyleAt(cn - 1) : ve instanceof Qe ? Jt = ve.getDefaultStyle() : Jt = {}, bn.insert(cn, Tn, Jt);
4629
4642
  }
4630
- F.current = bn, M(bn), Z(Ne);
4643
+ F.current = bn, M(bn), Z(De);
4631
4644
  const fn = qe.target.selectionEnd;
4632
4645
  S(fn), Q(qe.target.selectionStart), pe(qe.target.selectionEnd), J.current = fn;
4633
4646
  const vn = qe.target;
@@ -4635,42 +4648,42 @@ const br = Dr(
4635
4648
  vn && document.activeElement === vn && vn.setSelectionRange(fn, fn);
4636
4649
  }, 0);
4637
4650
  },
4638
- onBlur: Yn,
4651
+ onBlur: Ln,
4639
4652
  onKeyDown: Vn,
4640
4653
  onPointerDown: (qe) => {
4641
- if (qe.preventDefault(), !ve || !(ve instanceof Qe) || !xe.current) return;
4642
- const Ne = Date.now();
4643
- if (Ne - pt.current < h) return;
4644
- pt.current = Ne, Ne - $e.current >= se && (at.current = null);
4645
- const mt = xe.current.getBoundingClientRect(), bn = (qe.clientX - mt.left) / T - ot, Vt = (qe.clientY - mt.top) / T - rt, Zt = ve.getVisualBoundingBox(), cn = ve.getRotationAnchor(), Mn = en.toRadiansInverse(ve.rotation), Tn = bn - cn.x, fn = Vt - cn.y, vn = Math.cos(Mn), Jt = Math.sin(Mn), Gn = Tn * vn - fn * Jt, Cs = Tn * Jt + fn * vn, ws = Gn + Zt.width / 2, Nn = Cs + Zt.height / 2, sn = Sn(ve, { x: ws, y: Nn });
4646
- Ne - Se.current < lt ? Te.current += 1 : Te.current = 1, Se.current = Ne;
4654
+ if (qe.preventDefault(), !ve || !(ve instanceof Qe) || !me.current) return;
4655
+ const De = Date.now();
4656
+ if (De - pt.current < h) return;
4657
+ pt.current = De, De - $e.current >= se && (at.current = null);
4658
+ const mt = me.current.getBoundingClientRect(), bn = (qe.clientX - mt.left) / T - ot, Vt = (qe.clientY - mt.top) / T - rt, Zt = ve.getVisualBoundingBox(), cn = ve.getRotationAnchor(), Mn = en.toRadiansInverse(ve.rotation), Tn = bn - cn.x, fn = Vt - cn.y, vn = Math.cos(Mn), Jt = Math.sin(Mn), Gn = Tn * vn - fn * Jt, Cs = Tn * Jt + fn * vn, ws = Gn + Zt.width / 2, Dn = Cs + Zt.height / 2, sn = Sn(ve, { x: ws, y: Dn });
4659
+ De - Se.current < lt ? Te.current += 1 : Te.current = 1, Se.current = De;
4647
4660
  const pn = W;
4648
4661
  if (k.current = !1, Te.current >= 3)
4649
- qe.preventDefault(), $e.current = Ne, at.current = { start: 0, end: pn.length, cursor: pn.length }, De.current = !0, Te.current = 0, J.current = 0, S(pn.length), Q(0), pe(pn.length), ie.current && (ie.current.focus(), ie.current.setSelectionRange(0, pn.length));
4662
+ qe.preventDefault(), $e.current = De, at.current = { start: 0, end: pn.length, cursor: pn.length }, Ne.current = !0, Te.current = 0, J.current = 0, S(pn.length), Q(0), pe(pn.length), ie.current && (ie.current.focus(), ie.current.setSelectionRange(0, pn.length));
4650
4663
  else if (Te.current === 2) {
4651
4664
  qe.preventDefault();
4652
4665
  const ln = yr(pn, sn);
4653
- $e.current = Ne, at.current = { start: ln.start, end: ln.end, cursor: ln.end }, De.current = !0, J.current = ln.start, S(ln.end), Q(ln.start), pe(ln.end), ie.current && (ie.current.focus(), ie.current.setSelectionRange(ln.start, ln.end));
4666
+ $e.current = De, at.current = { start: ln.start, end: ln.end, cursor: ln.end }, Ne.current = !0, J.current = ln.start, S(ln.end), Q(ln.start), pe(ln.end), ie.current && (ie.current.focus(), ie.current.setSelectionRange(ln.start, ln.end));
4654
4667
  } else
4655
- at.current = null, J.current = sn, Q(sn), S(sn), pe(sn), ie.current && (ie.current.focus(), ie.current.setSelectionRange(sn, sn)), De.current = !1;
4668
+ at.current = null, J.current = sn, Q(sn), S(sn), pe(sn), ie.current && (ie.current.focus(), ie.current.setSelectionRange(sn, sn)), Ne.current = !1;
4656
4669
  },
4657
4670
  onPointerMove: (qe) => {
4658
4671
  if (qe.buttons !== 1) return;
4659
- if (ct.current && ve instanceof Qe && xe.current) {
4660
- const qn = xe.current.getBoundingClientRect(), pn = (qe.clientX - qn.left) / T - ot, ln = (qe.clientY - qn.top) / T - rt, Bs = ve.getVisualBoundingBox(), Os = ve.getRotationAnchor(), zs = en.toRadiansInverse(ve.rotation), Xs = pn - Os.x, Ys = ln - Os.y, Hs = Math.cos(zs), Ls = Math.sin(zs), kr = Xs * Hs - Ys * Ls, Rr = Xs * Ls + Ys * Hs, mn = Pt.current;
4672
+ if (ct.current && ve instanceof Qe && me.current) {
4673
+ const qn = me.current.getBoundingClientRect(), pn = (qe.clientX - qn.left) / T - ot, ln = (qe.clientY - qn.top) / T - rt, Bs = ve.getVisualBoundingBox(), Os = ve.getRotationAnchor(), zs = en.toRadiansInverse(ve.rotation), Xs = pn - Os.x, Ls = ln - Os.y, Ys = Math.cos(zs), Hs = Math.sin(zs), kr = Xs * Ys - Ls * Hs, Rr = Xs * Hs + Ls * Ys, mn = Pt.current;
4661
4674
  let Ss = 0;
4662
4675
  ct.current === "start" && (mn != null && mn.start) ? Ss = mn.start.textEdge.y - mn.start.center.y : ct.current === "end" && (mn != null && mn.end) && (Ss = mn.end.textEdge.y - mn.end.center.y);
4663
4676
  const Mr = kr + Bs.width / 2, Tr = Rr + Ss + Bs.height / 2, gn = Sn(ve, { x: Mr, y: Tr });
4664
- if (ct.current === "start" ? gn <= q ? (Q(gn), S(gn)) : (Q(q), pe(gn), S(gn), ct.current = "end") : gn >= Y ? (pe(gn), S(gn)) : (pe(Y), Q(gn), S(gn), ct.current = "start"), ie.current) {
4665
- const Ir = Math.min(Y, q), Pr = Math.max(Y, q);
4677
+ if (ct.current === "start" ? gn <= q ? (Q(gn), S(gn)) : (Q(q), pe(gn), S(gn), ct.current = "end") : gn >= L ? (pe(gn), S(gn)) : (pe(L), Q(gn), S(gn), ct.current = "start"), ie.current) {
4678
+ const Ir = Math.min(L, q), Pr = Math.max(L, q);
4666
4679
  ie.current.setSelectionRange(Ir, Pr);
4667
4680
  }
4668
4681
  return;
4669
4682
  }
4670
- if (De.current || !ve || !(ve instanceof Qe) || !xe.current) return;
4671
- const Ne = xe.current.getBoundingClientRect(), mt = (qe.clientX - Ne.left) / T - ot, bn = (qe.clientY - Ne.top) / T - rt, Vt = ve.getVisualBoundingBox(), Zt = ve.getRotationAnchor(), cn = en.toRadiansInverse(ve.rotation), Mn = mt - Zt.x, Tn = bn - Zt.y, fn = Math.cos(cn), vn = Math.sin(cn), Jt = Mn * fn - Tn * vn, Gn = Mn * vn + Tn * fn, Cs = Jt + Vt.width / 2, ws = Gn + Vt.height / 2, Nn = Sn(ve, { x: Cs, y: ws }), sn = J.current;
4672
- if (sn !== Nn && (k.current = !0), pe(Nn), S(Nn), Q(sn), ie.current) {
4673
- const qn = Math.min(sn, Nn), pn = Math.max(sn, Nn);
4683
+ if (Ne.current || !ve || !(ve instanceof Qe) || !me.current) return;
4684
+ const De = me.current.getBoundingClientRect(), mt = (qe.clientX - De.left) / T - ot, bn = (qe.clientY - De.top) / T - rt, Vt = ve.getVisualBoundingBox(), Zt = ve.getRotationAnchor(), cn = en.toRadiansInverse(ve.rotation), Mn = mt - Zt.x, Tn = bn - Zt.y, fn = Math.cos(cn), vn = Math.sin(cn), Jt = Mn * fn - Tn * vn, Gn = Mn * vn + Tn * fn, Cs = Jt + Vt.width / 2, ws = Gn + Vt.height / 2, Dn = Sn(ve, { x: Cs, y: ws }), sn = J.current;
4685
+ if (sn !== Dn && (k.current = !0), pe(Dn), S(Dn), Q(sn), ie.current) {
4686
+ const qn = Math.min(sn, Dn), pn = Math.max(sn, Dn);
4674
4687
  ie.current.setSelectionRange(qn, pn);
4675
4688
  }
4676
4689
  },
@@ -4678,7 +4691,7 @@ const br = Dr(
4678
4691
  ct.current && (ct.current = null);
4679
4692
  },
4680
4693
  onClick: () => {
4681
- k.current = !1, De.current = !1;
4694
+ k.current = !1, Ne.current = !1;
4682
4695
  },
4683
4696
  onSelect: () => {
4684
4697
  },
@@ -4690,8 +4703,8 @@ const br = Dr(
4690
4703
  top: `${et.y}px`,
4691
4704
  width: `${et.width}px`,
4692
4705
  height: `${et.height || 50}px`,
4693
- fontSize: `${He * T}px`,
4694
- fontFamily: `"${Le}", Arial, sans-serif`,
4706
+ fontSize: `${Ye * T}px`,
4707
+ fontFamily: `"${He}", Arial, sans-serif`,
4695
4708
  fontWeight: tt ? 700 : 400,
4696
4709
  fontStyle: vt ? "italic" : "normal",
4697
4710
  textAlign: Rt,
@@ -4719,7 +4732,7 @@ const br = Dr(
4719
4732
  }
4720
4733
  );
4721
4734
  br.displayName = "CanvasEditor";
4722
- const Ai = pr(
4735
+ const Di = pr(
4723
4736
  "sc:inline-flex sc:items-center sc:rounded-badge sc:border sc:px-2.5 sc:py-0.5 sc:text-xs sc:transition-colors sc:focus:outline-none sc:focus:ring-2 sc:focus:ring-ring sc:focus:ring-offset-2 sc:font-caption",
4724
4737
  {
4725
4738
  variants: {
@@ -4744,7 +4757,7 @@ const Ai = pr(
4744
4757
  }
4745
4758
  }
4746
4759
  );
4747
- function Hn({
4760
+ function Yn({
4748
4761
  className: e,
4749
4762
  variant: t,
4750
4763
  size: n,
@@ -4771,7 +4784,7 @@ function Hn({
4771
4784
  "div",
4772
4785
  {
4773
4786
  className: Fn(
4774
- Ai({ variant: b, size: n }),
4787
+ Di({ variant: b, size: n }),
4775
4788
  x.secondary,
4776
4789
  x.outline,
4777
4790
  e
@@ -4880,7 +4893,7 @@ const Kt = $n.forwardRef(
4880
4893
  ] }) : /* @__PURE__ */ r(Ms, { ref: o, className: t, variant: n, ...s })
4881
4894
  );
4882
4895
  Kt.displayName = "Radio";
4883
- const Di = pr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-spin sc:size-6 sc:text-primary", {
4896
+ const Bi = pr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-spin sc:size-6 sc:text-primary", {
4884
4897
  variants: {
4885
4898
  size: {
4886
4899
  sm: "sc:size-4",
@@ -4898,14 +4911,14 @@ const Di = pr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-sp
4898
4911
  }
4899
4912
  }
4900
4913
  });
4901
- function Bi({ className: e, size: t, color: n, label: s = "Loading", ...o }) {
4914
+ function Oi({ className: e, size: t, color: n, label: s = "Loading", ...o }) {
4902
4915
  const i = $n.useId();
4903
4916
  return /* @__PURE__ */ r(
4904
4917
  "span",
4905
4918
  {
4906
4919
  role: "status",
4907
4920
  "aria-label": s,
4908
- className: Fn(Di({ size: t, color: n }), e),
4921
+ className: Fn(Bi({ size: t, color: n }), e),
4909
4922
  ...o,
4910
4923
  children: /* @__PURE__ */ y("svg", { viewBox: "0 0 24 24", className: "sc:size-full", "aria-hidden": !0, children: [
4911
4924
  /* @__PURE__ */ y("defs", { children: [
@@ -4941,7 +4954,7 @@ function Bi({ className: e, size: t, color: n, label: s = "Loading", ...o }) {
4941
4954
  }
4942
4955
  );
4943
4956
  }
4944
- const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platform ?? ""), Zn = Oi ? "⌘" : "Ctrl+", ps = () => /* @__PURE__ */ r("div", { className: "sc:h-[1px] sc:bg-border-primary sc:my-xs" }), zi = ({ menu: e, onClose: t }) => {
4957
+ const zi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platform ?? ""), Zn = zi ? "⌘" : "Ctrl+", ps = () => /* @__PURE__ */ r("div", { className: "sc:h-[1px] sc:bg-border-primary sc:my-xs" }), Xi = ({ menu: e, onClose: t }) => {
4945
4958
  const {
4946
4959
  multiSelection: n,
4947
4960
  handleCopyElements: s,
@@ -4963,21 +4976,21 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
4963
4976
  ungroupLayer: E,
4964
4977
  findElementById: A
4965
4978
  } = rr(), T = sr(), I = we(null);
4966
- Pe(() => {
4979
+ Ie(() => {
4967
4980
  var u;
4968
4981
  (u = I.current) == null || u.focus();
4969
- }, []), Pe(() => {
4982
+ }, []), Ie(() => {
4970
4983
  const u = (j) => {
4971
4984
  I.current && j.target instanceof Node && I.current.contains(j.target) || t();
4972
4985
  };
4973
4986
  return document.addEventListener("pointerdown", u), () => document.removeEventListener("pointerdown", u);
4974
4987
  }, [t]);
4975
- const g = e.targetId ? A(e.targetId) : null, P = xs(() => e.targetId ? n.length > 1 && n.includes(e.targetId) ? n : [e.targetId] : [], [e.targetId, n]), O = !!(g != null && g.locked), N = P.some((u) => {
4988
+ const g = e.targetId ? A(e.targetId) : null, P = xs(() => e.targetId ? n.length > 1 && n.includes(e.targetId) ? n : [e.targetId] : [], [e.targetId, n]), O = !!(g != null && g.locked), D = P.some((u) => {
4976
4989
  var j;
4977
4990
  return !!((j = A(u)) != null && j.locked);
4978
4991
  }), w = g instanceof Re, ne = P.length > 1, V = (u) => () => {
4979
4992
  u(), t();
4980
- }, D = /* @__PURE__ */ r(
4993
+ }, N = /* @__PURE__ */ r(
4981
4994
  "div",
4982
4995
  {
4983
4996
  ref: I,
@@ -5085,7 +5098,7 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5085
5098
  "data-testid": "context-menu-group",
5086
5099
  icon: /* @__PURE__ */ r(ze, { icon: _e.group, className: "sc:size-3.5" }),
5087
5100
  label: "Group",
5088
- disabled: N,
5101
+ disabled: D,
5089
5102
  onClick: V(() => R(P))
5090
5103
  }
5091
5104
  ),
@@ -5149,10 +5162,10 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5149
5162
  }
5150
5163
  );
5151
5164
  return dr(
5152
- /* @__PURE__ */ r("div", { className: "sc-root", style: { display: "contents" }, children: D }),
5165
+ /* @__PURE__ */ r("div", { className: "sc-root", style: { display: "contents" }, children: N }),
5153
5166
  document.body
5154
5167
  );
5155
- }, Xi = 0.25, Yi = 8, Hi = 0.1, Li = 4, _i = 1e-3, Ka = ({
5168
+ }, Li = 0.25, Yi = 8, Hi = 0.1, _i = 4, $i = 1e-3, Ua = ({
5156
5169
  className: e,
5157
5170
  style: t,
5158
5171
  width: n,
@@ -5182,11 +5195,11 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5182
5195
  } = rs(), {
5183
5196
  zoom: P,
5184
5197
  setZoom: O,
5185
- panOffset: N,
5198
+ panOffset: D,
5186
5199
  setPanOffset: w,
5187
5200
  isPanning: ne,
5188
5201
  setIsPanning: V,
5189
- userZoom: D,
5202
+ userZoom: N,
5190
5203
  setUserZoom: u,
5191
5204
  resetUserView: j
5192
5205
  } = Ts(), {
@@ -5194,7 +5207,7 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5194
5207
  multiSelection: te,
5195
5208
  handleSelectionChange: ae,
5196
5209
  setMultiSelection: $,
5197
- handleActiveChildChange: xe,
5210
+ handleActiveChildChange: me,
5198
5211
  setHoveredElementId: ie,
5199
5212
  hideHandles: be
5200
5213
  } = Or(), {
@@ -5202,7 +5215,7 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5202
5215
  setExpandedPanelType: Te
5203
5216
  } = zr(), Oe = je.useCallback(() => {
5204
5217
  Te("crop");
5205
- }, [Te]), De = je.useRef(null), [$e, at] = je.useState(0), [pt, ct] = je.useState(0), [Pt, zt] = je.useState(!1), At = je.useRef(P), We = je.useRef(!1), [Ee, lt] = je.useState(!1), se = je.useRef(null);
5218
+ }, [Te]), Ne = je.useRef(null), [$e, at] = je.useState(0), [pt, ct] = je.useState(0), [Pt, zt] = je.useState(!1), At = je.useRef(P), We = je.useRef(!1), [Ee, lt] = je.useState(!1), se = je.useRef(null);
5206
5219
  Ro({ enabled: m });
5207
5220
  const [h, U] = je.useState(null), re = je.useCallback(
5208
5221
  (K) => {
@@ -5213,64 +5226,64 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5213
5226
  });
5214
5227
  },
5215
5228
  []
5216
- ), he = je.useCallback(() => U(null), []), L = A.getActiveArtboard(), Ce = je.useCallback(
5229
+ ), he = je.useCallback(() => U(null), []), H = A.getActiveArtboard(), Ce = je.useCallback(
5217
5230
  (K) => {
5218
5231
  if (!(a || K.ctrlKey || K.metaKey)) return;
5219
5232
  K.preventDefault();
5220
- const me = De.current;
5221
- if (!me) return;
5222
- const Be = me.getBoundingClientRect(), Je = K.clientX - Be.left, Ge = K.clientY - Be.top, Fe = -K.deltaY * _i;
5233
+ const ge = Ne.current;
5234
+ if (!ge) return;
5235
+ const Be = ge.getBoundingClientRect(), Je = K.clientX - Be.left, Ge = K.clientY - Be.top, Fe = -K.deltaY * $i;
5223
5236
  if (a) {
5224
- const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Hi), Li);
5237
+ const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Hi), _i);
5225
5238
  if (st === nt) return;
5226
- const xt = st / nt, yt = Je - (Je - N.x) * xt, Lt = Ge - (Ge - N.y) * xt;
5227
- at(st), w({ x: yt, y: Lt });
5239
+ const xt = st / nt, yt = Je - (Je - D.x) * xt, Ht = Ge - (Ge - D.y) * xt;
5240
+ at(st), w({ x: yt, y: Ht });
5228
5241
  } else {
5229
- const nt = D, st = Math.min(
5230
- Math.max(nt * (1 + Fe), Xi),
5242
+ const nt = N, st = Math.min(
5243
+ Math.max(nt * (1 + Fe), Li),
5231
5244
  Yi
5232
5245
  );
5233
5246
  if (st === nt) return;
5234
- const xt = st / nt, yt = Je - (Je - N.x) * xt, Lt = Ge - (Ge - N.y) * xt;
5235
- u(st), w({ x: yt, y: Lt });
5247
+ const xt = st / nt, yt = Je - (Je - D.x) * xt, Ht = Ge - (Ge - D.y) * xt;
5248
+ u(st), w({ x: yt, y: Ht });
5236
5249
  }
5237
5250
  },
5238
- [a, $e, N, w, D, u]
5251
+ [a, $e, D, w, N, u]
5239
5252
  );
5240
5253
  je.useEffect(() => {
5241
- const K = De.current;
5254
+ const K = Ne.current;
5242
5255
  if (K)
5243
5256
  return K.addEventListener("wheel", Ce, { passive: !1 }), () => K.removeEventListener("wheel", Ce);
5244
5257
  }, [Ce]), je.useEffect(() => {
5245
5258
  if (!a) return;
5246
- const K = (me) => {
5247
- me.code === "Space" && !me.repeat && lt(!0);
5248
- }, ue = (me) => {
5249
- me.code === "Space" && (lt(!1), se.current = null);
5259
+ const K = (ge) => {
5260
+ ge.code === "Space" && !ge.repeat && lt(!0);
5261
+ }, ue = (ge) => {
5262
+ ge.code === "Space" && (lt(!1), se.current = null);
5250
5263
  };
5251
5264
  return window.addEventListener("keydown", K), window.addEventListener("keyup", ue), () => {
5252
5265
  window.removeEventListener("keydown", K), window.removeEventListener("keyup", ue);
5253
5266
  };
5254
5267
  }, [a]);
5255
- const Ie = je.useCallback(
5268
+ const Pe = je.useCallback(
5256
5269
  (K) => {
5257
5270
  if (!a) return;
5258
- const ue = K.button === 1, me = Ee && K.button === 0;
5259
- (ue || me) && (K.preventDefault(), K.target.setPointerCapture(K.pointerId), V(!0), se.current = {
5271
+ const ue = K.button === 1, ge = Ee && K.button === 0;
5272
+ (ue || ge) && (K.preventDefault(), K.target.setPointerCapture(K.pointerId), V(!0), se.current = {
5260
5273
  x: K.clientX,
5261
5274
  y: K.clientY,
5262
- panX: N.x,
5263
- panY: N.y
5275
+ panX: D.x,
5276
+ panY: D.y
5264
5277
  });
5265
5278
  },
5266
- [a, Ee, N, V]
5279
+ [a, Ee, D, V]
5267
5280
  ), Ve = je.useCallback(
5268
5281
  (K) => {
5269
5282
  if (!ne || !se.current) return;
5270
- const ue = K.clientX - se.current.x, me = K.clientY - se.current.y;
5283
+ const ue = K.clientX - se.current.x, ge = K.clientY - se.current.y;
5271
5284
  w({
5272
5285
  x: se.current.panX + ue,
5273
- y: se.current.panY + me
5286
+ y: se.current.panY + ge
5274
5287
  });
5275
5288
  },
5276
5289
  [ne, w]
@@ -5284,38 +5297,38 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5284
5297
  };
5285
5298
  return window.addEventListener("pointerup", K), () => window.removeEventListener("pointerup", K);
5286
5299
  }, [a, ne, V]);
5287
- const H = je.useMemo(() => {
5300
+ const Y = je.useMemo(() => {
5288
5301
  if (!x || !b) return null;
5289
5302
  const K = b.pieces ?? [];
5290
5303
  if (K.length <= 1) return null;
5291
5304
  if (x === "spread")
5292
- return L ? {
5305
+ return H ? {
5293
5306
  x: 0,
5294
5307
  y: 0,
5295
- width: L.width,
5296
- height: L.height
5308
+ width: H.width,
5309
+ height: H.height
5297
5310
  } : null;
5298
- const ue = K.find((me) => me.id === x.pieceId);
5311
+ const ue = K.find((ge) => ge.id === x.pieceId);
5299
5312
  return ue ? { x: ue.x, y: ue.y, width: ue.width, height: ue.height } : null;
5300
- }, [x, b, L]), _ = Io(H);
5313
+ }, [x, b, H]), _ = Io(Y);
5301
5314
  je.useEffect(() => {
5302
5315
  if (o !== void 0) {
5303
5316
  at(o);
5304
5317
  return;
5305
5318
  }
5306
- if (!De.current || !L)
5319
+ if (!Ne.current || !H)
5307
5320
  return;
5308
5321
  let K = 0;
5309
5322
  const ue = () => {
5310
- if (!De.current || !L) return;
5311
- const Je = De.current.clientWidth;
5323
+ if (!Ne.current || !H) return;
5324
+ const Je = Ne.current.clientWidth;
5312
5325
  if (Je === 0)
5313
5326
  return;
5314
- let Ge = L.width, Fe = L.height;
5327
+ let Ge = H.width, Fe = H.height;
5315
5328
  if (x && x !== "spread" && b) {
5316
5329
  const xt = b.pieces ?? [];
5317
5330
  if (xt.length > 1) {
5318
- const yt = xt.find((Lt) => Lt.id === x.pieceId);
5331
+ const yt = xt.find((Ht) => Ht.id === x.pieceId);
5319
5332
  yt && (Ge = yt.width, Fe = yt.height);
5320
5333
  }
5321
5334
  }
@@ -5323,7 +5336,7 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5323
5336
  if (c !== void 0) {
5324
5337
  const xt = Je - c * 2, yt = Math.min(xt / Ge, 1);
5325
5338
  if (_ && f !== void 0) {
5326
- const Lt = f - c * 2, ve = Math.min(Lt / Fe, 1);
5339
+ const Ht = f - c * 2, ve = Math.min(Ht / Fe, 1);
5327
5340
  nt = Math.min(yt, ve), st = ve <= yt;
5328
5341
  } else if (nt = yt, f !== void 0 && Fe * nt + c * 2 > f) {
5329
5342
  const An = (f - c * 2) / Fe;
@@ -5333,20 +5346,20 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5333
5346
  nt = Math.min(Je * i / Ge, 1);
5334
5347
  at(nt), ct(Je), zt(st);
5335
5348
  };
5336
- let me = !1;
5349
+ let ge = !1;
5337
5350
  We.current ? ue() : K = requestAnimationFrame(() => {
5338
5351
  K = requestAnimationFrame(() => {
5339
- me || (ue(), We.current = !0);
5352
+ ge || (ue(), We.current = !0);
5340
5353
  });
5341
5354
  });
5342
5355
  const Be = new ResizeObserver(() => {
5343
5356
  ue();
5344
5357
  });
5345
- return Be.observe(De.current), () => {
5346
- me = !0, cancelAnimationFrame(K), Be.disconnect();
5358
+ return Be.observe(Ne.current), () => {
5359
+ ge = !0, cancelAnimationFrame(K), Be.disconnect();
5347
5360
  };
5348
- }, [o, L, i, c, f, x, b, _]);
5349
- const ot = $e > 0 && D > 0 ? $e * D : $e;
5361
+ }, [o, H, i, c, f, x, b, _]);
5362
+ const ot = $e > 0 && N > 0 ? $e * N : $e;
5350
5363
  je.useEffect(() => {
5351
5364
  if (!(P === At.current || P <= 0)) {
5352
5365
  if (a)
@@ -5365,22 +5378,22 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5365
5378
  const K = _ && "id" in _ ? _.id ?? null : null;
5366
5379
  K !== rt.current && (rt.current !== null && j(), rt.current = K);
5367
5380
  }, [_, j]);
5368
- const Ze = _ ? _.width : (L == null ? void 0 : L.width) ?? 0, gt = _ ? _.height : (L == null ? void 0 : L.height) ?? 0, Nt = Ze * ot, Dt = gt * ot, tn = Ze * $e;
5369
- let Ht = L ? c !== void 0 ? Dt + c * 2 : Dt / i : 0;
5370
- f !== void 0 && Ht > f && (Ht = f);
5381
+ const Ze = _ ? _.width : (H == null ? void 0 : H.width) ?? 0, gt = _ ? _.height : (H == null ? void 0 : H.height) ?? 0, Dt = Ze * ot, Nt = gt * ot, tn = Ze * $e;
5382
+ let Yt = H ? c !== void 0 ? Nt + c * 2 : Nt / i : 0;
5383
+ f !== void 0 && Yt > f && (Yt = f);
5371
5384
  let wt = c, Xt = c;
5372
- const rn = ((Ae = De.current) == null ? void 0 : Ae.clientWidth) || pt;
5385
+ const rn = ((Ae = Ne.current) == null ? void 0 : Ae.clientWidth) || pt;
5373
5386
  c !== void 0 && Pt && rn > 0 && tn > 0 && (wt = (rn - tn) / 2);
5374
- const on = Ht, Ut = je.useRef({ w: 0, h: 0 });
5387
+ const on = Yt, Ut = je.useRef({ w: 0, h: 0 });
5375
5388
  je.useEffect(() => {
5376
- const K = De.current;
5389
+ const K = Ne.current;
5377
5390
  if (!K) return;
5378
5391
  Ut.current = {
5379
5392
  w: K.clientWidth,
5380
5393
  h: K.clientHeight
5381
5394
  };
5382
- const ue = new ResizeObserver((me) => {
5383
- const Be = me[0];
5395
+ const ue = new ResizeObserver((ge) => {
5396
+ const Be = ge[0];
5384
5397
  Be && (Ut.current = {
5385
5398
  w: Be.contentRect.width,
5386
5399
  h: Be.contentRect.height
@@ -5389,20 +5402,20 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5389
5402
  return ue.observe(K), () => ue.disconnect();
5390
5403
  }, []), je.useEffect(() => {
5391
5404
  if (a) return;
5392
- if (D <= 1.001) {
5393
- (N.x !== 0 || N.y !== 0) && w({ x: 0, y: 0 });
5405
+ if (N <= 1.001) {
5406
+ (D.x !== 0 || D.y !== 0) && w({ x: 0, y: 0 });
5394
5407
  return;
5395
5408
  }
5396
5409
  const K = Ut.current.w, ue = Ut.current.h;
5397
- if (K === 0 || ue === 0 || Nt === 0 || Dt === 0) return;
5398
- const me = 0.25 * Math.min(Nt, K), Be = 0.25 * Math.min(Dt, ue), Je = me - (wt ?? 0) - Nt, Ge = K - me - (wt ?? 0), Fe = Be - (Xt ?? 0) - Dt, nt = ue - Be - (Xt ?? 0), st = Math.max(Je, Math.min(Ge, N.x)), xt = Math.max(Fe, Math.min(nt, N.y));
5399
- (st !== N.x || xt !== N.y) && w({ x: st, y: xt });
5410
+ if (K === 0 || ue === 0 || Dt === 0 || Nt === 0) return;
5411
+ const ge = 0.25 * Math.min(Dt, K), Be = 0.25 * Math.min(Nt, ue), Je = ge - (wt ?? 0) - Dt, Ge = K - ge - (wt ?? 0), Fe = Be - (Xt ?? 0) - Nt, nt = ue - Be - (Xt ?? 0), st = Math.max(Je, Math.min(Ge, D.x)), xt = Math.max(Fe, Math.min(nt, D.y));
5412
+ (st !== D.x || xt !== D.y) && w({ x: st, y: xt });
5400
5413
  }, [
5401
5414
  a,
5402
- D,
5403
5415
  N,
5404
- Nt,
5416
+ D,
5405
5417
  Dt,
5418
+ Nt,
5406
5419
  wt,
5407
5420
  Xt,
5408
5421
  w
@@ -5436,25 +5449,25 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5436
5449
  position: "absolute",
5437
5450
  left: 0,
5438
5451
  top: 0,
5439
- transform: `translate(${N.x}px, ${N.y}px)`,
5452
+ transform: `translate(${D.x}px, ${D.y}px)`,
5440
5453
  transformOrigin: "0 0",
5441
5454
  // Prevent pointer events during pan for smoother experience
5442
5455
  pointerEvents: ne ? "none" : "auto"
5443
5456
  } : {
5444
- transform: N.x !== 0 || N.y !== 0 ? `translate(${N.x}px, ${N.y}px)` : void 0,
5457
+ transform: D.x !== 0 || D.y !== 0 ? `translate(${D.x}px, ${D.y}px)` : void 0,
5445
5458
  transformOrigin: "0 0",
5446
5459
  // Critical: `will-change: transform` keeps the wrapper on its
5447
5460
  // own compositor layer so panning feels smooth even at high
5448
5461
  // zoom (canvas DOM is bigger than container).
5449
- willChange: N.x !== 0 || N.y !== 0 ? "transform" : void 0
5462
+ willChange: D.x !== 0 || D.y !== 0 ? "transform" : void 0
5450
5463
  };
5451
5464
  return /* @__PURE__ */ y(
5452
5465
  "div",
5453
5466
  {
5454
- ref: De,
5467
+ ref: Ne,
5455
5468
  className: e,
5456
5469
  style: Ke,
5457
- onPointerDown: a ? Ie : void 0,
5470
+ onPointerDown: a ? Pe : void 0,
5458
5471
  onPointerMove: a ? Ve : void 0,
5459
5472
  onPointerUp: a ? Xe : void 0,
5460
5473
  onPointerLeave: a ? Xe : void 0,
@@ -5474,15 +5487,15 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5474
5487
  executeElementUpdate: g,
5475
5488
  onSelectionChange: ae,
5476
5489
  onMultiSelectionChange: $,
5477
- onActiveChildChange: xe,
5490
+ onActiveChildChange: me,
5478
5491
  onTextSelectionChange: () => Se((K) => K + 1),
5479
5492
  onHoverChange: ie,
5480
5493
  onCropModeEnter: Oe,
5481
5494
  onContextMenuRequest: re,
5482
5495
  hideHandles: be,
5483
5496
  canvasRef: C,
5484
- width: L == null ? void 0 : L.width,
5485
- height: L == null ? void 0 : L.height,
5497
+ width: H == null ? void 0 : H.width,
5498
+ height: H == null ? void 0 : H.height,
5486
5499
  zoom: ot,
5487
5500
  viewPadding: i,
5488
5501
  artboardBorderRadius: l,
@@ -5496,25 +5509,25 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5496
5509
  focusedPieceRect: _
5497
5510
  }
5498
5511
  ) }),
5499
- h && /* @__PURE__ */ r(zi, { menu: h, onClose: he }),
5500
- !a && (D < 0.999 || D > 1.001) && /* @__PURE__ */ r(
5501
- Fi,
5512
+ h && /* @__PURE__ */ r(Xi, { menu: h, onClose: he }),
5513
+ !a && (N < 0.999 || N > 1.001) && /* @__PURE__ */ r(
5514
+ Wi,
5502
5515
  {
5503
- userZoom: D,
5516
+ userZoom: N,
5504
5517
  onSetZoom: (K) => {
5505
5518
  if (K <= 1.001) {
5506
5519
  j();
5507
5520
  return;
5508
5521
  }
5509
- const ue = De.current;
5522
+ const ue = Ne.current;
5510
5523
  if (!ue) {
5511
5524
  u(K);
5512
5525
  return;
5513
5526
  }
5514
- const me = ue.getBoundingClientRect(), Be = me.width / 2, Je = me.height / 2, Ge = K / Math.max(D, 1e-4);
5527
+ const ge = ue.getBoundingClientRect(), Be = ge.width / 2, Je = ge.height / 2, Ge = K / Math.max(N, 1e-4);
5515
5528
  u(K), w({
5516
- x: Be - (Be - N.x) * Ge,
5517
- y: Je - (Je - N.y) * Ge
5529
+ x: Be - (Be - D.x) * Ge,
5530
+ y: Je - (Je - D.y) * Ge
5518
5531
  });
5519
5532
  }
5520
5533
  }
@@ -5522,8 +5535,8 @@ const Oi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5522
5535
  ]
5523
5536
  }
5524
5537
  );
5525
- }, $i = [1, 2, 4, 8];
5526
- function Fi({
5538
+ }, Fi = [1, 2, 4, 8];
5539
+ function Wi({
5527
5540
  userZoom: e,
5528
5541
  onSetZoom: t
5529
5542
  }) {
@@ -5565,7 +5578,7 @@ function Fi({
5565
5578
  backdropFilter: "blur(6px)"
5566
5579
  },
5567
5580
  className: "sc:flex sc:flex-col sc:rounded-2xl sc:border sc:border-border/40 sc:bg-popover/95 sc:p-1 sc:shadow-lg",
5568
- children: $i.map((i) => {
5581
+ children: Fi.map((i) => {
5569
5582
  const a = i * 100, l = Math.abs(e - i) < 0.05;
5570
5583
  return /* @__PURE__ */ y(
5571
5584
  "button",
@@ -5618,20 +5631,20 @@ const is = /* @__PURE__ */ new Map();
5618
5631
  function It(e, t) {
5619
5632
  is.set(e, t);
5620
5633
  }
5621
- function Ua(e) {
5634
+ function Ga(e) {
5622
5635
  return is.get(e);
5623
5636
  }
5624
- function Ga() {
5637
+ function qa() {
5625
5638
  return Array.from(is.keys());
5626
5639
  }
5627
- function qa() {
5640
+ function ja() {
5628
5641
  return Array.from(is.entries());
5629
5642
  }
5630
- function ja(e) {
5643
+ function Za(e) {
5631
5644
  is.delete(e);
5632
5645
  }
5633
5646
  let vs = !1;
5634
- async function Za() {
5647
+ async function Ja() {
5635
5648
  if (vs) return;
5636
5649
  vs = !0, vr();
5637
5650
  const [
@@ -5644,13 +5657,13 @@ async function Za() {
5644
5657
  { ZoomControls: a },
5645
5658
  { CropPanel: l }
5646
5659
  ] = await Promise.all([
5647
- Promise.resolve().then(() => ba),
5648
- Promise.resolve().then(() => Ca),
5660
+ Promise.resolve().then(() => va),
5661
+ Promise.resolve().then(() => wa),
5649
5662
  import("./ImagePanel-BIzwlaf5.js"),
5650
- Promise.resolve().then(() => ka),
5651
- Promise.resolve().then(() => Ma),
5652
- import("./ContextualToolbars-D-EX9Q9L.js").then((c) => c.s),
5663
+ Promise.resolve().then(() => Ra),
5653
5664
  Promise.resolve().then(() => Ta),
5665
+ import("./ContextualToolbars-D-EX9Q9L.js").then((c) => c.s),
5666
+ Promise.resolve().then(() => Ia),
5654
5667
  import("./ContextualToolbars-D-EX9Q9L.js").then((c) => c.r)
5655
5668
  ]);
5656
5669
  It("effects-panel", {
@@ -5696,17 +5709,17 @@ async function Za() {
5696
5709
  }
5697
5710
  function vr() {
5698
5711
  It("layers-panel", {
5699
- component: Yr,
5712
+ component: Lr,
5700
5713
  label: "Layers",
5701
5714
  icon: "gravity-ui:layers",
5702
5715
  position: "left"
5703
5716
  }), It("menu-button", {
5704
- component: Hr,
5717
+ component: Yr,
5705
5718
  label: "Menu",
5706
5719
  icon: "gravity-ui:bars",
5707
5720
  position: "topbar"
5708
5721
  }), It("undo-redo-controls", {
5709
- component: Lr,
5722
+ component: Hr,
5710
5723
  label: "Undo / Redo",
5711
5724
  icon: "lucide:undo-2",
5712
5725
  position: "topbar"
@@ -5717,7 +5730,7 @@ function vr() {
5717
5730
  position: "topbar"
5718
5731
  });
5719
5732
  }
5720
- function Ja(e) {
5733
+ function Qa(e) {
5721
5734
  vs || (vs = !0, vr(), It("effects-panel", {
5722
5735
  component: e.EffectsPanel,
5723
5736
  label: "Effects",
@@ -5759,7 +5772,7 @@ function Ja(e) {
5759
5772
  position: "right"
5760
5773
  }));
5761
5774
  }
5762
- const Wi = ({ stroke: e, onChange: t }) => {
5775
+ const Vi = ({ stroke: e, onChange: t }) => {
5763
5776
  const [n, s] = le((e == null ? void 0 : e.enabled) || !1), o = (e == null ? void 0 : e.enabled) || !1, i = (e == null ? void 0 : e.color) || "#000000", a = (e == null ? void 0 : e.width) || 5, l = (e == null ? void 0 : e.lineCap) || "butt", c = (e == null ? void 0 : e.lineJoin) || "miter", f = (e == null ? void 0 : e.opacity) !== void 0 ? e.opacity : 1, d = (C) => {
5764
5777
  t(C ? {
5765
5778
  enabled: !0,
@@ -5800,7 +5813,7 @@ const Wi = ({ stroke: e, onChange: t }) => {
5800
5813
  /* @__PURE__ */ r(Tt, { children: "Stroke" }),
5801
5814
  /* @__PURE__ */ r(hr, { checked: o, onCheckedChange: d })
5802
5815
  ] }) }),
5803
- /* @__PURE__ */ y(Ns, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
5816
+ /* @__PURE__ */ y(Ds, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
5804
5817
  /* @__PURE__ */ r(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: /* @__PURE__ */ y("div", { className: "sc:flex sc:items-center sc:justify-between", children: [
5805
5818
  /* @__PURE__ */ r(Tt, { children: "Color" }),
5806
5819
  /* @__PURE__ */ r(go, { value: i, onChange: m })
@@ -5877,7 +5890,7 @@ const Wi = ({ stroke: e, onChange: t }) => {
5877
5890
  ] })
5878
5891
  ] })
5879
5892
  ] });
5880
- }, Vi = ({ mask: e, index: t, isFirst: n, isLast: s, onUpdate: o, onRemove: i, onReorder: a }) => {
5893
+ }, Ki = ({ mask: e, index: t, isFirst: n, isLast: s, onUpdate: o, onRemove: i, onReorder: a }) => {
5881
5894
  var T;
5882
5895
  const [l, c] = le(!1), f = (I) => {
5883
5896
  switch (I) {
@@ -6263,12 +6276,12 @@ const Wi = ({ stroke: e, onChange: t }) => {
6263
6276
  ] })
6264
6277
  ] })
6265
6278
  ] });
6266
- }, Ki = ({ masks: e = [], onChange: t }) => {
6279
+ }, Ui = ({ masks: e = [], onChange: t }) => {
6267
6280
  const [n, s] = le(e.length > 0), [o, i] = le(!1), a = (d) => {
6268
6281
  const m = {
6269
6282
  id: `mask-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
6270
6283
  type: d,
6271
- maskElement: Ui(d),
6284
+ maskElement: Gi(d),
6272
6285
  inverted: !1,
6273
6286
  feather: 0,
6274
6287
  opacity: 1
@@ -6371,7 +6384,7 @@ const Wi = ({ stroke: e, onChange: t }) => {
6371
6384
  )
6372
6385
  ] }),
6373
6386
  n && e.length > 0 && /* @__PURE__ */ r("div", { className: "sc:mt-xl sc:flex sc:flex-col sc:gap-md", children: e.map((d, m) => /* @__PURE__ */ r(
6374
- Vi,
6387
+ Ki,
6375
6388
  {
6376
6389
  mask: d,
6377
6390
  index: m,
@@ -6389,7 +6402,7 @@ const Wi = ({ stroke: e, onChange: t }) => {
6389
6402
  ] })
6390
6403
  ] });
6391
6404
  };
6392
- function Ui(e) {
6405
+ function Gi(e) {
6393
6406
  switch (e) {
6394
6407
  case "clip":
6395
6408
  return {
@@ -6447,7 +6460,7 @@ function Ui(e) {
6447
6460
  };
6448
6461
  }
6449
6462
  }
6450
- const Gi = {
6463
+ const qi = {
6451
6464
  enabled: !0,
6452
6465
  style: "worn",
6453
6466
  intensity: 30,
@@ -6456,7 +6469,7 @@ const Gi = {
6456
6469
  edgeWear: 40,
6457
6470
  seed: void 0
6458
6471
  // Will be generated when applied
6459
- }, qi = {
6472
+ }, ji = {
6460
6473
  enabled: !0,
6461
6474
  style: "worn",
6462
6475
  intensity: 55,
@@ -6464,7 +6477,7 @@ const Gi = {
6464
6477
  grainAmount: 25,
6465
6478
  edgeWear: 60,
6466
6479
  seed: void 0
6467
- }, ji = {
6480
+ }, Zi = {
6468
6481
  enabled: !0,
6469
6482
  style: "worn",
6470
6483
  intensity: 75,
@@ -6472,96 +6485,96 @@ const Gi = {
6472
6485
  grainAmount: 40,
6473
6486
  edgeWear: 80,
6474
6487
  seed: void 0
6475
- }, Zi = {
6488
+ }, Ji = {
6476
6489
  enabled: !0,
6477
6490
  style: "cracked",
6478
6491
  intensity: 25,
6479
6492
  scratchAmount: 30,
6480
6493
  edgeWear: 20,
6481
6494
  seed: void 0
6482
- }, Ji = {
6495
+ }, Qi = {
6483
6496
  enabled: !0,
6484
6497
  style: "cracked",
6485
6498
  intensity: 50,
6486
6499
  scratchAmount: 50,
6487
6500
  edgeWear: 35,
6488
6501
  seed: void 0
6489
- }, Qi = {
6502
+ }, ea = {
6490
6503
  enabled: !0,
6491
6504
  style: "cracked",
6492
6505
  intensity: 80,
6493
6506
  scratchAmount: 75,
6494
6507
  edgeWear: 60,
6495
6508
  seed: void 0
6496
- }, ea = {
6509
+ }, ta = {
6497
6510
  enabled: !0,
6498
6511
  style: "grunge",
6499
6512
  intensity: 35,
6500
6513
  grainAmount: 40,
6501
6514
  fadeAmount: 25,
6502
6515
  seed: void 0
6503
- }, ta = {
6516
+ }, na = {
6504
6517
  enabled: !0,
6505
6518
  style: "grunge",
6506
6519
  intensity: 60,
6507
6520
  grainAmount: 60,
6508
6521
  fadeAmount: 40,
6509
6522
  seed: void 0
6510
- }, na = {
6523
+ }, sa = {
6511
6524
  enabled: !0,
6512
6525
  style: "grunge",
6513
6526
  intensity: 85,
6514
6527
  grainAmount: 80,
6515
6528
  fadeAmount: 55,
6516
6529
  seed: void 0
6517
- }, sa = {
6530
+ }, ra = {
6518
6531
  enabled: !0,
6519
6532
  style: "retro",
6520
6533
  intensity: 30,
6521
6534
  fadeAmount: 30,
6522
6535
  grainAmount: 25,
6523
6536
  seed: void 0
6524
- }, ra = {
6537
+ }, oa = {
6525
6538
  enabled: !0,
6526
6539
  style: "retro",
6527
6540
  intensity: 55,
6528
6541
  fadeAmount: 45,
6529
6542
  grainAmount: 40,
6530
6543
  seed: void 0
6531
- }, oa = {
6544
+ }, ia = {
6532
6545
  enabled: !0,
6533
6546
  style: "retro",
6534
6547
  intensity: 75,
6535
6548
  fadeAmount: 60,
6536
6549
  grainAmount: 55,
6537
6550
  seed: void 0
6538
- }, ia = {
6551
+ }, aa = {
6539
6552
  worn: {
6540
- light: Gi,
6541
- medium: qi,
6542
- heavy: ji
6553
+ light: qi,
6554
+ medium: ji,
6555
+ heavy: Zi
6543
6556
  },
6544
6557
  cracked: {
6545
- light: Zi,
6546
- medium: Ji,
6547
- heavy: Qi
6558
+ light: Ji,
6559
+ medium: Qi,
6560
+ heavy: ea
6548
6561
  },
6549
6562
  grunge: {
6550
- light: ea,
6551
- medium: ta,
6552
- heavy: na
6563
+ light: ta,
6564
+ medium: na,
6565
+ heavy: sa
6553
6566
  },
6554
6567
  retro: {
6555
- light: sa,
6556
- medium: ra,
6557
- heavy: oa
6568
+ light: ra,
6569
+ medium: oa,
6570
+ heavy: ia
6558
6571
  }
6559
6572
  };
6560
- function aa(e, t) {
6561
- const n = { ...ia[e][t] };
6573
+ function ca(e, t) {
6574
+ const n = { ...aa[e][t] };
6562
6575
  return n.seed = Date.now(), n;
6563
6576
  }
6564
- const ca = ({ distressEffect: e, onChange: t }) => {
6577
+ const la = ({ distressEffect: e, onChange: t }) => {
6565
6578
  yo();
6566
6579
  const [n, s] = le(!1), o = (e == null ? void 0 : e.enabled) || !1, i = (e == null ? void 0 : e.style) || "worn", a = (e == null ? void 0 : e.intensity) || 50, l = (e == null ? void 0 : e.fadeAmount) || 30, c = (e == null ? void 0 : e.grainAmount) || 30, f = (e == null ? void 0 : e.scratchAmount) || 30, d = (e == null ? void 0 : e.edgeWear) || 40, m = (g) => {
6567
6580
  t(g ? {
@@ -6575,7 +6588,7 @@ const ca = ({ distressEffect: e, onChange: t }) => {
6575
6588
  seed: Date.now()
6576
6589
  } : void 0);
6577
6590
  }, p = (g, P) => {
6578
- const O = aa(g, P);
6591
+ const O = ca(g, P);
6579
6592
  t(O), s(!1);
6580
6593
  }, b = (g) => {
6581
6594
  if (e)
@@ -6649,7 +6662,7 @@ const ca = ({ distressEffect: e, onChange: t }) => {
6649
6662
  }
6650
6663
  )
6651
6664
  ] }) }),
6652
- /* @__PURE__ */ y(Ns, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
6665
+ /* @__PURE__ */ y(Ds, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
6653
6666
  /* @__PURE__ */ r("div", { className: "sc:flex sc:gap-sm", children: /* @__PURE__ */ r(
6654
6667
  Ct,
6655
6668
  {
@@ -6928,21 +6941,21 @@ const ca = ({ distressEffect: e, onChange: t }) => {
6928
6941
  function Cr(e) {
6929
6942
  return e ? !!(e.fill || e.stroke) : !1;
6930
6943
  }
6931
- function la(e) {
6944
+ function da(e) {
6932
6945
  if (!e) return [];
6933
6946
  const t = [];
6934
6947
  return e.fill && t.push("fill"), e.stroke && t.push("stroke"), t;
6935
6948
  }
6936
- function da(e, t = "knockout") {
6949
+ function ua(e, t = "knockout") {
6937
6950
  if (!e || !Cr(e))
6938
6951
  return "No compositing";
6939
- const n = la(e), s = e.scope || "group", o = t === "clip" ? "clip" : "knockout";
6952
+ const n = da(e), s = e.scope || "group", o = t === "clip" ? "clip" : "knockout";
6940
6953
  return n.length === 0 ? "No compositing" : n.length === 1 ? `${n[0]} ${o} (${s})` : `${n.slice(0, -1).join(", ") + " & " + n[n.length - 1]} ${o} (${s})`;
6941
6954
  }
6942
- function ua(e) {
6943
- return !e || !Cr(e) ? "No knockout" : da(e, "knockout");
6955
+ function ha(e) {
6956
+ return !e || !Cr(e) ? "No knockout" : ua(e, "knockout");
6944
6957
  }
6945
- const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
6958
+ const fa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
6946
6959
  const s = e === "knockout" || e === "clip", [o, i] = le(s), a = s, l = (t == null ? void 0 : t.fill) || !1, c = (t == null ? void 0 : t.stroke) || !1, f = (t == null ? void 0 : t.scope) || "group", d = (x) => {
6947
6960
  x === "knockout" || x === "clip" ? (n(x, {
6948
6961
  fill: !1,
@@ -6973,7 +6986,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
6973
6986
  className: "sc:mb-xl",
6974
6987
  children: [
6975
6988
  /* @__PURE__ */ r(As, { className: "sc:w-full", children: /* @__PURE__ */ r("div", { className: "sc:flex sc:items-center sc:justify-between sc:w-full", children: /* @__PURE__ */ r(Tt, { children: "Compositing" }) }) }),
6976
- /* @__PURE__ */ y(Ns, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
6989
+ /* @__PURE__ */ y(Ds, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
6977
6990
  /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6978
6991
  /* @__PURE__ */ r(Tt, { children: "Blend Mode" }),
6979
6992
  /* @__PURE__ */ y(ss, { value: e, onValueChange: d, orientation: "horizontal", children: [
@@ -7047,7 +7060,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7047
7060
  /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-md", children: [
7048
7061
  /* @__PURE__ */ y("div", { className: "sc:rounded-lg sc:border sc:border-border-primary sc:bg-bg-tertiary sc:p-md", children: [
7049
7062
  /* @__PURE__ */ r("strong", { className: "sc:text-sm sc:font-semibold sc:uppercase sc:tracking-wide sc:text-accent-primary", children: "Effect:" }),
7050
- /* @__PURE__ */ r("p", { className: "sc:mt-xs sc:text-base sc:text-text-secondary", children: ua(t) })
7063
+ /* @__PURE__ */ r("p", { className: "sc:mt-xs sc:text-base sc:text-text-secondary", children: ha(t) })
7051
7064
  ] }),
7052
7065
  /* @__PURE__ */ r("div", { className: "sc:rounded-sm sc:border-l-2 sc:border-accent-primary sc:bg-accent-light sc:p-md", children: /* @__PURE__ */ y("small", { className: "sc:text-sm sc:leading-relaxed sc:text-text-secondary", children: [
7053
7066
  /* @__PURE__ */ r("strong", { children: "Tip:" }),
@@ -7064,7 +7077,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7064
7077
  ]
7065
7078
  }
7066
7079
  );
7067
- }, fa = zn("GlyphPicker"), pa = ({
7080
+ }, pa = zn("GlyphPicker"), ma = ({
7068
7081
  isOpen: e,
7069
7082
  onClose: t,
7070
7083
  character: n,
@@ -7076,14 +7089,14 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7076
7089
  browseAll: c = !1
7077
7090
  }) => {
7078
7091
  const [f, d] = le([]), [m, p] = le(!1), [b, x] = le(null);
7079
- Pe(() => {
7092
+ Ie(() => {
7080
7093
  if (!e) return;
7081
7094
  p(!0), x(null), (c ? Bn.getAllGlyphs(o, i) : Bn.getGlyphAlternates(o, n, i)).then((E) => {
7082
7095
  E.length === 0 && x(
7083
7096
  c ? `No glyphs found in ${o}` : `No alternates found for "${n}" in ${o}`
7084
7097
  ), d(E), p(!1);
7085
7098
  }).catch((E) => {
7086
- fa.error("Error loading glyphs:", E), x(c ? "Failed to load glyphs" : "Failed to load glyph alternates"), p(!1);
7099
+ pa.error("Error loading glyphs:", E), x(c ? "Failed to load glyphs" : "Failed to load glyph alternates"), p(!1);
7087
7100
  });
7088
7101
  }, [e, n, o, i, c]);
7089
7102
  const v = (R) => {
@@ -7171,7 +7184,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7171
7184
  ]
7172
7185
  }
7173
7186
  ) });
7174
- }, Rs = zn("OpenTypeFeaturesPanel"), ma = [
7187
+ }, Rs = zn("OpenTypeFeaturesPanel"), ga = [
7175
7188
  // Ligatures
7176
7189
  { tag: "liga", label: "Standard Ligatures", description: "Common ligatures like fi, fl", category: "ligatures" },
7177
7190
  {
@@ -7212,7 +7225,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7212
7225
  { tag: "kern", label: "Kerning", description: "Adjust spacing between letter pairs", category: "stylistic" },
7213
7226
  { tag: "mark", label: "Mark Positioning", description: "Position diacritical marks", category: "stylistic" },
7214
7227
  { tag: "mkmk", label: "Mark to Mark", description: "Position marks relative to marks", category: "stylistic" }
7215
- ], ga = ({
7228
+ ], xa = ({
7216
7229
  fontFamily: e,
7217
7230
  fontWeight: t = 400,
7218
7231
  text: n = "",
@@ -7222,7 +7235,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7222
7235
  onGlyphOverridesChange: a
7223
7236
  }) => {
7224
7237
  const [l, c] = le(!1), [f, d] = le([]), [m, p] = le(!1), [b, x] = le(!1), [v, C] = le(0), [R, E] = le(""), [A, T] = le(!1), [I, g] = le(/* @__PURE__ */ new Map()), [P, O] = le(!1);
7225
- Pe(() => {
7238
+ Ie(() => {
7226
7239
  if (!e) {
7227
7240
  d([]);
7228
7241
  return;
@@ -7232,7 +7245,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7232
7245
  }).catch((G) => {
7233
7246
  Rs.error("Error loading OpenType features:", G), d([]), p(!1);
7234
7247
  });
7235
- }, [e, t]), Pe(() => {
7248
+ }, [e, t]), Ie(() => {
7236
7249
  if (!n || !e) {
7237
7250
  g(/* @__PURE__ */ new Map());
7238
7251
  return;
@@ -7246,15 +7259,15 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7246
7259
  const ae = /* @__PURE__ */ new Map();
7247
7260
  for (const $ of G)
7248
7261
  try {
7249
- const xe = await Bn.getGlyphAlternates(e, $, t), ie = xe.length > 0 ? xe.length - 1 : 0;
7262
+ const me = await Bn.getGlyphAlternates(e, $, t), ie = me.length > 0 ? me.length - 1 : 0;
7250
7263
  ae.set($, ie);
7251
- } catch (xe) {
7252
- Rs.error(`Error loading alternates for '${$}':`, xe), ae.set($, 0);
7264
+ } catch (me) {
7265
+ Rs.error(`Error loading alternates for '${$}':`, me), ae.set($, 0);
7253
7266
  }
7254
7267
  g(ae), O(!1);
7255
7268
  })();
7256
7269
  }, [n, e, t]);
7257
- const N = (G) => {
7270
+ const D = (G) => {
7258
7271
  const te = s == null ? void 0 : s[G], ae = {
7259
7272
  ...s,
7260
7273
  [G]: !te
@@ -7277,7 +7290,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7277
7290
  } else
7278
7291
  te = te.filter((ae) => ae.charIndex !== v);
7279
7292
  a(te.length > 0 ? te : void 0);
7280
- }, D = s ? Object.values(s).filter(Boolean).length : 0, u = o.length, j = ma.reduce(
7293
+ }, N = s ? Object.values(s).filter(Boolean).length : 0, u = o.length, j = ga.reduce(
7281
7294
  (G, te) => (G[te.category] || (G[te.category] = []), G[te.category].push(te), G),
7282
7295
  {}
7283
7296
  );
@@ -7291,7 +7304,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7291
7304
  /* @__PURE__ */ y("div", { className: "sc:flex sc:items-center sc:gap-sm", children: [
7292
7305
  /* @__PURE__ */ r(ze, { icon: _e.text, className: "sc:size-4" }),
7293
7306
  /* @__PURE__ */ r("span", { className: "sc:text-xl sc:font-medium", children: "OpenType Features" }),
7294
- D > 0 && /* @__PURE__ */ r("span", { className: "sc:rounded-full sc:bg-info sc:px-xs sc:py-[2px] sc:text-2xs sc:font-semibold sc:text-info-foreground", children: D })
7307
+ N > 0 && /* @__PURE__ */ r("span", { className: "sc:rounded-full sc:bg-info sc:px-xs sc:py-[2px] sc:text-2xs sc:font-semibold sc:text-info-foreground", children: N })
7295
7308
  ] }),
7296
7309
  /* @__PURE__ */ r("button", { className: "sc:cursor-pointer sc:border-none sc:bg-transparent sc:p-xs sc:text-xs", children: l ? "▼" : "▶" })
7297
7310
  ]
@@ -7323,7 +7336,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7323
7336
  const ae = o.some((ie) => ie.charIndex === te);
7324
7337
  if (G === " ")
7325
7338
  return /* @__PURE__ */ r("div", { className: "sc:h-4xl sc:w-sm" }, te);
7326
- const xe = I.get(G) || 0;
7339
+ const me = I.get(G) || 0;
7327
7340
  return /* @__PURE__ */ y(
7328
7341
  "button",
7329
7342
  {
@@ -7335,11 +7348,11 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7335
7348
  style: { fontFamily: e },
7336
7349
  children: [
7337
7350
  G,
7338
- xe > 0 && /* @__PURE__ */ r(
7351
+ me > 0 && /* @__PURE__ */ r(
7339
7352
  "span",
7340
7353
  {
7341
7354
  className: `sc:absolute sc:-right-[4px] sc:-top-[4px] sc:min-w-lg sc:rounded-full sc:border-2 sc:border-surface sc:px-xs sc:py-[2px] sc:text-center sc:text-3xs sc:font-semibold sc:leading-none sc:shadow-md ${ae ? "sc:bg-success sc:text-success-foreground" : "sc:bg-info sc:text-info-foreground"}`,
7342
- children: xe
7355
+ children: me
7343
7356
  }
7344
7357
  )
7345
7358
  ]
@@ -7362,7 +7375,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7362
7375
  {
7363
7376
  type: "checkbox",
7364
7377
  checked: (s == null ? void 0 : s[$.tag]) || !1,
7365
- onChange: () => N($.tag),
7378
+ onChange: () => D($.tag),
7366
7379
  className: "sc:mt-[2px] sc:h-4 sc:w-4 sc:cursor-pointer sc:rounded sc:border-border-primary sc:bg-bg-input sc:accent-accent-primary"
7367
7380
  }
7368
7381
  ),
@@ -7378,7 +7391,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7378
7391
  }) })
7379
7392
  ] }),
7380
7393
  e && /* @__PURE__ */ r(
7381
- pa,
7394
+ ma,
7382
7395
  {
7383
7396
  isOpen: b,
7384
7397
  onClose: () => x(!1),
@@ -7392,7 +7405,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7392
7405
  }
7393
7406
  )
7394
7407
  ] });
7395
- }, xa = ({ element: e, onElementUpdate: t, isOpen: n, onClose: s }) => {
7408
+ }, ya = ({ element: e, onElementUpdate: t, isOpen: n, onClose: s }) => {
7396
7409
  var p, b;
7397
7410
  const [o, i] = le("stroke");
7398
7411
  if (!e) return null;
@@ -7418,37 +7431,37 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7418
7431
  /* @__PURE__ */ y(Ot.Tab, { id: "stroke", children: [
7419
7432
  /* @__PURE__ */ r(ze, { icon: _e.minus, className: "sc:size-4" }),
7420
7433
  "Stroke",
7421
- a && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7434
+ a && /* @__PURE__ */ r(Yn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7422
7435
  /* @__PURE__ */ r(Ot.Indicator, {})
7423
7436
  ] }),
7424
7437
  /* @__PURE__ */ y(Ot.Tab, { id: "masks", children: [
7425
7438
  /* @__PURE__ */ r(ze, { icon: _e.group, className: "sc:size-4" }),
7426
7439
  "Masks",
7427
- l && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7440
+ l && /* @__PURE__ */ r(Yn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7428
7441
  /* @__PURE__ */ r(Ot.Indicator, {})
7429
7442
  ] }),
7430
7443
  /* @__PURE__ */ y(Ot.Tab, { id: "distress", children: [
7431
7444
  /* @__PURE__ */ r(ze, { icon: "lucide:cloud", className: "sc:size-4" }),
7432
7445
  "Distress",
7433
- c && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7446
+ c && /* @__PURE__ */ r(Yn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7434
7447
  /* @__PURE__ */ r(Ot.Indicator, {})
7435
7448
  ] }),
7436
7449
  /* @__PURE__ */ y(Ot.Tab, { id: "compositing", children: [
7437
7450
  /* @__PURE__ */ r(ze, { icon: _e.scissors, className: "sc:size-4" }),
7438
7451
  "Knockout",
7439
- f && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7452
+ f && /* @__PURE__ */ r(Yn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7440
7453
  /* @__PURE__ */ r(Ot.Indicator, {})
7441
7454
  ] }),
7442
7455
  d && /* @__PURE__ */ y(Ot.Tab, { id: "typography", children: [
7443
7456
  /* @__PURE__ */ r(ze, { icon: _e.text, className: "sc:size-4" }),
7444
7457
  "Typography",
7445
- m && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7458
+ m && /* @__PURE__ */ r(Yn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7446
7459
  /* @__PURE__ */ r(Ot.Indicator, {})
7447
7460
  ] })
7448
7461
  ] }) }),
7449
7462
  /* @__PURE__ */ y(Ot.Panel, { id: "stroke", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7450
7463
  /* @__PURE__ */ r(
7451
- Wi,
7464
+ Vi,
7452
7465
  {
7453
7466
  stroke: e.stroke,
7454
7467
  onChange: (x) => {
@@ -7464,7 +7477,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7464
7477
  ] }),
7465
7478
  /* @__PURE__ */ y(Ot.Panel, { id: "masks", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7466
7479
  /* @__PURE__ */ r(
7467
- Ki,
7480
+ Ui,
7468
7481
  {
7469
7482
  masks: e.masks,
7470
7483
  onChange: (x) => {
@@ -7480,7 +7493,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7480
7493
  ] }),
7481
7494
  /* @__PURE__ */ y(Ot.Panel, { id: "distress", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7482
7495
  /* @__PURE__ */ r(
7483
- ca,
7496
+ la,
7484
7497
  {
7485
7498
  distressEffect: e.distressEffect,
7486
7499
  onChange: (x) => {
@@ -7496,7 +7509,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7496
7509
  ] }),
7497
7510
  /* @__PURE__ */ y(Ot.Panel, { id: "compositing", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7498
7511
  /* @__PURE__ */ r(
7499
- ha,
7512
+ fa,
7500
7513
  {
7501
7514
  blendMode: e.blendMode,
7502
7515
  knockoutParts: e.knockoutParts,
@@ -7513,7 +7526,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7513
7526
  ] }),
7514
7527
  d && /* @__PURE__ */ y(Ot.Panel, { id: "typography", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7515
7528
  /* @__PURE__ */ r(
7516
- ga,
7529
+ xa,
7517
7530
  {
7518
7531
  fontFamily: e.fontFamily,
7519
7532
  fontWeight: e.bold ? 700 : 400,
@@ -7540,7 +7553,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7540
7553
  )
7541
7554
  }
7542
7555
  );
7543
- }, ya = ({
7556
+ }, ba = ({
7544
7557
  isOpen: e,
7545
7558
  onClose: t,
7546
7559
  element: n,
@@ -7555,7 +7568,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7555
7568
  [s, l, c]
7556
7569
  );
7557
7570
  return /* @__PURE__ */ r("div", { style: o, className: i, children: /* @__PURE__ */ r(
7558
- xa,
7571
+ ya,
7559
7572
  {
7560
7573
  element: c,
7561
7574
  onElementUpdate: f,
@@ -7563,10 +7576,10 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7563
7576
  onClose: t
7564
7577
  }
7565
7578
  ) });
7566
- }, ba = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7579
+ }, va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7567
7580
  __proto__: null,
7568
- EffectsPanel: ya
7569
- }, Symbol.toStringTag, { value: "Module" })), Js = zn("ExportPanel"), va = ({
7581
+ EffectsPanel: ba
7582
+ }, Symbol.toStringTag, { value: "Module" })), Js = zn("ExportPanel"), Ca = ({
7570
7583
  showContinuousExport: e = !0,
7571
7584
  defaultScale: t = 3,
7572
7585
  defaultFormat: n = "png",
@@ -7587,22 +7600,22 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7587
7600
  } = Kr(), { artboardsInfo: v, activeArtboardId: C } = ar(), [R, E] = le(t), [A, T] = le(n), [I, g] = le(500), P = async () => {
7588
7601
  if (C)
7589
7602
  try {
7590
- const w = await a(C, { scale: R, format: A }), ne = document.createElement("a"), V = v.find((j) => j.id === C), D = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), u = (V == null ? void 0 : V.name) || "artboard";
7591
- ne.download = `${u}-${D}.${A}`, ne.href = w, ne.click(), s && s({ [C]: w });
7603
+ const w = await a(C, { scale: R, format: A }), ne = document.createElement("a"), V = v.find((j) => j.id === C), N = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), u = (V == null ? void 0 : V.name) || "artboard";
7604
+ ne.download = `${u}-${N}.${A}`, ne.href = w, ne.click(), s && s({ [C]: w });
7592
7605
  } catch (w) {
7593
7606
  Js.error("Export failed:", w), alert("Export failed. Please try again.");
7594
7607
  }
7595
7608
  }, O = async () => {
7596
7609
  try {
7597
7610
  const w = await l({ scale: R, format: A }), ne = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
7598
- Object.entries(w).forEach(([V, D]) => {
7611
+ Object.entries(w).forEach(([V, N]) => {
7599
7612
  const u = v.find((te) => te.id === V), j = (u == null ? void 0 : u.name) || V, G = document.createElement("a");
7600
- G.download = `${j}-${ne}.${A}`, G.href = D, G.click();
7613
+ G.download = `${j}-${ne}.${A}`, G.href = N, G.click();
7601
7614
  }), s && s(w);
7602
7615
  } catch (w) {
7603
7616
  Js.error("Export all failed:", w), alert("Export failed. Please try again.");
7604
7617
  }
7605
- }, N = () => {
7618
+ }, D = () => {
7606
7619
  m ? f() : c({
7607
7620
  interval: I,
7608
7621
  scale: R,
@@ -7799,7 +7812,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7799
7812
  e && /* @__PURE__ */ y(
7800
7813
  "button",
7801
7814
  {
7802
- onClick: N,
7815
+ onClick: D,
7803
7816
  style: {
7804
7817
  display: "flex",
7805
7818
  alignItems: "center",
@@ -7876,10 +7889,10 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7876
7889
  ]
7877
7890
  }
7878
7891
  );
7879
- }, Ca = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7892
+ }, wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7880
7893
  __proto__: null,
7881
- ExportPanel: va
7882
- }, Symbol.toStringTag, { value: "Module" })), wa = zn("GlyphBrowserDrawer"), Sa = ({
7894
+ ExportPanel: Ca
7895
+ }, Symbol.toStringTag, { value: "Module" })), Sa = zn("GlyphBrowserDrawer"), Ea = ({
7883
7896
  isOpen: e,
7884
7897
  onClose: t,
7885
7898
  fontFamily: n,
@@ -7887,11 +7900,11 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7887
7900
  onInsertGlyph: o
7888
7901
  }) => {
7889
7902
  const [i, a] = le([]), [l, c] = le(!1), [f, d] = le(null), [m, p] = le("");
7890
- Pe(() => {
7903
+ Ie(() => {
7891
7904
  e && (c(!0), d(null), p(""), Bn.getAllGlyphs(n, s).then((v) => {
7892
7905
  v.length === 0 && d(`No alternate glyphs found in ${n}`), a(v), c(!1);
7893
7906
  }).catch((v) => {
7894
- wa.error("Error loading glyphs:", v), d("Failed to load glyphs"), c(!1);
7907
+ Sa.error("Error loading glyphs:", v), d("Failed to load glyphs"), c(!1);
7895
7908
  }));
7896
7909
  }, [e, n, s]);
7897
7910
  const b = (v) => {
@@ -7937,7 +7950,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7937
7950
  ] }) }),
7938
7951
  /* @__PURE__ */ y("div", { className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7939
7952
  l && /* @__PURE__ */ y("div", { className: "sc:py-12 sc:text-center sc:text-muted", children: [
7940
- /* @__PURE__ */ r(Bi, { size: "lg", className: "sc:mx-auto sc:mb-4" }),
7953
+ /* @__PURE__ */ r(Oi, { size: "lg", className: "sc:mx-auto sc:mb-4" }),
7941
7954
  /* @__PURE__ */ r("div", { className: "sc:text-sm", children: "Loading glyphs..." })
7942
7955
  ] }),
7943
7956
  f && /* @__PURE__ */ y("div", { className: "sc:py-12 sc:text-center", children: [
@@ -7962,7 +7975,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7962
7975
  v.previewDataUrl ? /* @__PURE__ */ r("img", { src: v.previewDataUrl, alt: v.name, className: "sc:h-auto sc:w-full sc:object-contain" }) : /* @__PURE__ */ r("div", { className: "sc:text-5xl sc:leading-none", style: { fontFamily: n }, children: v.unicode }),
7963
7976
  /* @__PURE__ */ r("div", { className: "sc:w-full sc:overflow-hidden sc:text-ellipsis sc:whitespace-nowrap sc:text-center sc:text-xs sc:text-muted", children: v.name }),
7964
7977
  v.category !== "default" && /* @__PURE__ */ r(
7965
- Hn,
7978
+ Yn,
7966
7979
  {
7967
7980
  size: "sm",
7968
7981
  color: v.category === "swash" ? "warning" : v.category === "stylistic" ? "primary" : "success",
@@ -7985,7 +7998,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7985
7998
  ]
7986
7999
  }
7987
8000
  );
7988
- }, Qs = zn("GlyphPanel"), Ea = ({
8001
+ }, Qs = zn("GlyphPanel"), ka = ({
7989
8002
  isOpen: e,
7990
8003
  onClose: t,
7991
8004
  fontFamily: n,
@@ -8014,7 +8027,7 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8014
8027
  [o, c, f, d, l]
8015
8028
  );
8016
8029
  return /* @__PURE__ */ r(
8017
- Sa,
8030
+ Ea,
8018
8031
  {
8019
8032
  isOpen: e,
8020
8033
  onClose: t,
@@ -8023,10 +8036,10 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8023
8036
  onInsertGlyph: m
8024
8037
  }
8025
8038
  );
8026
- }, ka = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8039
+ }, Ra = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8027
8040
  __proto__: null,
8028
- GlyphPanel: Ea
8029
- }, Symbol.toStringTag, { value: "Module" })), Ra = ({
8041
+ GlyphPanel: ka
8042
+ }, Symbol.toStringTag, { value: "Module" })), Ma = ({
8030
8043
  orientation: e = "horizontal",
8031
8044
  showAddButton: t = !0,
8032
8045
  showCloseButtons: n = !1,
@@ -8042,8 +8055,8 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8042
8055
  createArtboard: d,
8043
8056
  deleteArtboard: m,
8044
8057
  renameArtboard: p
8045
- } = ar(), [b, x] = le(null), [v, C] = le(""), R = (O, N) => {
8046
- x(O), C(N);
8058
+ } = ar(), [b, x] = le(null), [v, C] = le(""), R = (O, D) => {
8059
+ x(O), C(D);
8047
8060
  }, E = () => {
8048
8061
  b && v.trim() && p(b, v.trim()), x(null), C("");
8049
8062
  }, A = () => {
@@ -8055,8 +8068,8 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8055
8068
  const O = c[c.length];
8056
8069
  O && a(O.id);
8057
8070
  }, 10);
8058
- }, I = (O, N) => {
8059
- if (N.stopPropagation(), c.length <= 1) {
8071
+ }, I = (O, D) => {
8072
+ if (D.stopPropagation(), c.length <= 1) {
8060
8073
  alert("Cannot delete the last artboard");
8061
8074
  return;
8062
8075
  }
@@ -8101,15 +8114,15 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8101
8114
  });
8102
8115
  return /* @__PURE__ */ y("div", { className: `artboard-tabs ${i}`, style: g, children: [
8103
8116
  c.map((O) => {
8104
- const N = b === O.id;
8117
+ const D = b === O.id;
8105
8118
  return /* @__PURE__ */ y(
8106
8119
  "div",
8107
8120
  {
8108
8121
  style: P(O.isActive),
8109
- onClick: () => !N && f(O.id),
8122
+ onClick: () => !D && f(O.id),
8110
8123
  onDoubleClick: () => R(O.id, O.name),
8111
8124
  children: [
8112
- N ? /* @__PURE__ */ r(
8125
+ D ? /* @__PURE__ */ r(
8113
8126
  "input",
8114
8127
  {
8115
8128
  type: "text",
@@ -8202,9 +8215,9 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8202
8215
  }
8203
8216
  )
8204
8217
  ] });
8205
- }, Ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8218
+ }, Ta = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8206
8219
  __proto__: null,
8207
- ArtboardTabs: Ra
8220
+ ArtboardTabs: Ma
8208
8221
  }, Symbol.toStringTag, { value: "Module" })), er = ({
8209
8222
  className: e,
8210
8223
  position: t = "bottom-right",
@@ -8319,23 +8332,23 @@ const ha = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8319
8332
  ]
8320
8333
  }
8321
8334
  );
8322
- }, Ta = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8335
+ }, Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8323
8336
  __proto__: null,
8324
8337
  ZoomControls: er,
8325
8338
  default: er
8326
- }, Symbol.toStringTag, { value: "Module" })), tr = zn("AutoExportManager"), Ia = {
8339
+ }, Symbol.toStringTag, { value: "Module" })), tr = zn("AutoExportManager"), Pa = {
8327
8340
  enabled: !0,
8328
8341
  debounceMs: 100,
8329
8342
  maxWaitMs: 1e3
8330
8343
  };
8331
- class Qa {
8344
+ class ec {
8332
8345
  constructor(t = {}) {
8333
8346
  this.onExportCallback = null, this.onExportScheduledCallback = null, this.revision = 0, this.lastExportedRevision = -1, this.stats = {
8334
8347
  totalExports: 0,
8335
8348
  skippedExports: 0,
8336
8349
  lastExportTime: null,
8337
8350
  avgExportInterval: 0
8338
- }, this.exportTimestamps = [], this.config = { ...Ia, ...t }, this.debouncedExport = Gs(
8351
+ }, this.exportTimestamps = [], this.config = { ...Pa, ...t }, this.debouncedExport = Gs(
8339
8352
  () => this.performExport(),
8340
8353
  this.config.debounceMs,
8341
8354
  {
@@ -8458,7 +8471,7 @@ class Qa {
8458
8471
  this.debouncedExport.cancel(), this.onExportCallback = null, this.onExportScheduledCallback = null, this.lastExportedRevision = -1;
8459
8472
  }
8460
8473
  }
8461
- function ec({ width: e = 800, height: t = 600, style: n }) {
8474
+ function tc({ width: e = 800, height: t = 600, style: n }) {
8462
8475
  return /* @__PURE__ */ y(
8463
8476
  "div",
8464
8477
  {
@@ -8501,7 +8514,7 @@ function ec({ width: e = 800, height: t = 600, style: n }) {
8501
8514
  }
8502
8515
  );
8503
8516
  }
8504
- function tc({ itemCount: e = 5, style: t }) {
8517
+ function nc({ itemCount: e = 5, style: t }) {
8505
8518
  return /* @__PURE__ */ y(
8506
8519
  "div",
8507
8520
  {
@@ -8554,7 +8567,7 @@ function tc({ itemCount: e = 5, style: t }) {
8554
8567
  }
8555
8568
  );
8556
8569
  }
8557
- function nc({ style: e }) {
8570
+ function sc({ style: e }) {
8558
8571
  return /* @__PURE__ */ y(
8559
8572
  "div",
8560
8573
  {
@@ -8609,7 +8622,7 @@ function nc({ style: e }) {
8609
8622
  }
8610
8623
  );
8611
8624
  }
8612
- function sc({ size: e = 32, color: t = "var(--primary)" }) {
8625
+ function rc({ size: e = 32, color: t = "var(--primary)" }) {
8613
8626
  return /* @__PURE__ */ r(
8614
8627
  "div",
8615
8628
  {
@@ -8630,7 +8643,7 @@ function sc({ size: e = 32, color: t = "var(--primary)" }) {
8630
8643
  }
8631
8644
  );
8632
8645
  }
8633
- function rc(e) {
8646
+ function oc(e) {
8634
8647
  var i;
8635
8648
  const t = [], n = [];
8636
8649
  (!e.name || e.name.trim() === "") && t.push("Kit name is required"), e.behavior.toolbar === "none" && ((i = e.layout.slots.topbar) != null && i.length) && n.push('Toolbar mode is "none" but topbar has sections — topbar sections will be ignored'), e.behavior.selection === "multi" && !e.capabilities.tools.includes("select") && n.push('Multi-selection enabled but "select" tool not in capabilities'), e.capabilities.elements.length === 0 && t.push("At least one element type must be enabled in capabilities.elements"), e.capabilities.transforms.length === 0 && t.push("At least one transform type must be enabled in capabilities.transforms"), e.behavior.autoExport && !e.capabilities.features.export && n.push("autoExport is enabled but features.export is false — exports will not be produced");
@@ -8651,34 +8664,34 @@ function rc(e) {
8651
8664
  export {
8652
8665
  bo as A,
8653
8666
  vo as C,
8654
- Ia as D,
8667
+ Pa as D,
8655
8668
  wo as E,
8656
- Ea as G,
8657
- Wa as K,
8658
- tc as L,
8669
+ ka as G,
8670
+ Va as K,
8671
+ nc as L,
8659
8672
  mr as M,
8660
8673
  Co as P,
8661
- sc as S,
8662
- nc as T,
8674
+ rc as S,
8675
+ sc as T,
8663
8676
  er as Z,
8664
- Ja as a,
8665
- ya as b,
8666
- va as c,
8667
- Ra as d,
8668
- Qa as e,
8669
- Ka as f,
8670
- Ua as g,
8671
- ec as h,
8677
+ Qa as a,
8678
+ ba as b,
8679
+ Ca as c,
8680
+ Ma as d,
8681
+ ec as e,
8682
+ Ua as f,
8683
+ Ga as g,
8684
+ tc as h,
8672
8685
  qs as i,
8673
- qa as j,
8674
- Ga as k,
8675
- Za as l,
8686
+ ja as j,
8687
+ qa as k,
8688
+ Ja as l,
8676
8689
  It as m,
8677
- jo as n,
8678
- Va as o,
8690
+ Zo as n,
8691
+ Ka as o,
8679
8692
  Eo as p,
8680
8693
  So as r,
8681
- ja as u,
8682
- rc as v
8694
+ Za as u,
8695
+ oc as v
8683
8696
  };
8684
- //# sourceMappingURL=validation-Q1_OcfJ_.js.map
8697
+ //# sourceMappingURL=validation-Ds2Df_gS.js.map