@snowcone-app/canvas 0.44.0 → 0.44.1

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,15 +1,15 @@
1
1
  import { jsx as r, jsxs as y, Fragment as Dn } from "react/jsx-runtime";
2
2
  import * as Wn from "react";
3
- import Ze, { useState as le, useEffect as Te, useCallback as ft, useMemo as ys, useContext as Dr, createContext as Nr, useRef as Se, useImperativeHandle as sr, forwardRef as Br } from "react";
4
- import { E as zr, D as Is, n as Ps, o as rr, p as As, e as Or, q as Tt } from "./ContextualToolbars-rCZo-KCm.js";
5
- import { b as is, x as or, z as $s, A as Fs, e as Ds, q as Xr, c as Lr, v as Yr } from "./design-builder-DCHVrEFV.js";
6
- import { l as ir, I as Oe, s as Hr, u as ar, c as Vn, v as Qt, i as Fe, J as _r, G as $r, H as Fr, F as Wr, W as Vr, T as un, q as hn, r as fn, B as Ct, Y as Kr, Z as Ur, _ as Gr, D as cr, k as qr, b as lr } from "./useCommands-BrkGKdXr.js";
7
- import { I as Yt, G as Re, bb as Ns, x as bs, ah as dr, bc as Ws, bd as jr, a2 as En, be as Zr, bf as us, P as kn, c as Xn, a7 as en, a5 as ms, bg as Jr, T as Qe, u as Qr, bh as es, bi as eo, bj as to, bk as no, a6 as ur, a4 as so, bl as ks, a3 as ro, g as oo, S as ts, az as io, z as zn } from "./FontAnalyzer-Ds3Wdba7.js";
3
+ import Ze, { useState as le, useEffect as Me, useCallback as ft, useMemo as ys, useContext as Dr, createContext as Nr, useRef as Se, useImperativeHandle as sr, forwardRef as Br } from "react";
4
+ import { E as Or, D as Is, n as Ps, o as rr, p as As, e as zr, q as Mt } from "./ContextualToolbars-rCZo-KCm.js";
5
+ import { b as is, x as or, z as $s, A as Fs, e as Ds, q as Xr, c as Yr, v as Lr } from "./design-builder-DCHVrEFV.js";
6
+ import { l as ir, I as ze, s as Hr, u as ar, c as Vn, v as Qt, i as Fe, J as _r, G as $r, H as Fr, F as Wr, W as Vr, T as un, q as hn, r as fn, B as Ct, Y as Kr, Z as Ur, _ as Gr, D as cr, k as qr, b as lr } from "./useCommands-BrkGKdXr.js";
7
+ import { I as Lt, G as Re, bb as Ns, x as bs, ah as dr, bc as Ws, bd as jr, a2 as En, be as Zr, bf as us, P as kn, c as Xn, a7 as en, a5 as ms, bg as Jr, T as Qe, u as Qr, bh as es, bi as eo, bj as to, bk as no, a6 as ur, a4 as so, bl as ks, a3 as ro, g as oo, S as ts, az as io, z as On } from "./FontAnalyzer-Ds3Wdba7.js";
8
8
  import { createPortal as hr } from "react-dom";
9
9
  import { b as ao, n as fr, g as Fn, c as co, r as lo, d as uo, t as ho, C as Vs, e as Ks, f as gs, T as fo, a as po, A as mo, S as go, I as xo } from "./CanvasRenderer-B8BADU_r.js";
10
10
  import { u as yo } from "./ThemeContext-Rjz25x9X.js";
11
11
  import { renderToStaticMarkup as bo } from "react-dom/server";
12
- import { L as It, S as pr, T as Ot, I as vo } from "./custom-icons-C4bzABm2.js";
12
+ import { L as It, S as pr, T as zt, I as vo } from "./custom-icons-C4bzABm2.js";
13
13
  import * as ss from "@radix-ui/react-radio-group";
14
14
  import { S as Co, U as Us, V as Gs } from "./ExportManager-xRsXgyNo.js";
15
15
  import { cva as mr } from "class-variance-authority";
@@ -152,9 +152,9 @@ function Ro(e) {
152
152
  return e;
153
153
  }
154
154
  const xr = Nr(null);
155
- function qa({ kit: e, children: t }) {
155
+ function Za({ kit: e, children: t }) {
156
156
  const [n, s] = le(e);
157
- Te(() => {
157
+ Me(() => {
158
158
  s(e);
159
159
  }, [e]);
160
160
  const o = ft((a) => {
@@ -166,21 +166,21 @@ function qa({ kit: e, children: t }) {
166
166
  );
167
167
  return /* @__PURE__ */ r(xr.Provider, { value: i, children: t });
168
168
  }
169
- function Mo() {
169
+ function To() {
170
170
  const e = Dr(xr);
171
171
  if (!e) throw new Error("useKit must be used within a KitProvider");
172
172
  return e;
173
173
  }
174
- function ja() {
175
- const { kit: e } = Mo();
174
+ function Ja() {
175
+ const { kit: e } = To();
176
176
  return e.capabilities;
177
177
  }
178
- function To(e, t) {
179
- if (t instanceof Yt && t.isCropping || e instanceof Yt && e.isCropping)
178
+ function Mo(e, t) {
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,12 +211,12 @@ function Io(e) {
211
211
  isToolbarMenuOpen: w,
212
212
  artboardManager: k
213
213
  } = is(), S = or(), { duplicateLayer: A } = ir();
214
- Te(() => {
214
+ Me(() => {
215
215
  if (!t) return;
216
- const T = (g) => {
217
- var z;
216
+ const M = (g) => {
217
+ var O;
218
218
  const P = g.target;
219
- if (!(P.tagName === "INPUT" || P.tagName === "TEXTAREA") && !P.isContentEditable && !((z = P.closest) != null && z.call(P, '[role="listbox"], [role="menu"], [role="tablist"]'))) {
219
+ if (!(P.tagName === "INPUT" || P.tagName === "TEXTAREA") && !P.isContentEditable && !((O = P.closest) != null && O.call(P, '[role="listbox"], [role="menu"], [role="tablist"]'))) {
220
220
  if ((g.metaKey || g.ctrlKey) && g.key === "z" && !g.shiftKey) {
221
221
  g.preventDefault(), p();
222
222
  return;
@@ -257,7 +257,7 @@ function Io(e) {
257
257
  return;
258
258
  }
259
259
  if (g.key === "Delete" || g.key === "Backspace") {
260
- if (w || To(n, s))
260
+ if (w || Mo(n, s))
261
261
  return;
262
262
  if (g.preventDefault(), o.length > 0) {
263
263
  i.filter(
@@ -295,8 +295,8 @@ function Io(e) {
295
295
  }, I = (g) => {
296
296
  (g.key === "ArrowUp" || g.key === "ArrowDown" || g.key === "ArrowLeft" || g.key === "ArrowRight") && x(!1);
297
297
  };
298
- return window.addEventListener("keydown", T), window.addEventListener("keyup", I), () => {
299
- window.removeEventListener("keydown", T), window.removeEventListener("keyup", I);
298
+ return window.addEventListener("keydown", M), window.addEventListener("keyup", I), () => {
299
+ window.removeEventListener("keydown", M), window.removeEventListener("keyup", I);
300
300
  };
301
301
  }, [
302
302
  t,
@@ -324,7 +324,7 @@ function Do(e, t = Po) {
324
324
  const [n, s] = le(e), o = Se(n);
325
325
  o.current = n;
326
326
  const i = Se(null), a = e ? `${e.x},${e.y},${e.width},${e.height}` : "none";
327
- return Te(() => {
327
+ return Me(() => {
328
328
  if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), !e) {
329
329
  s(null);
330
330
  return;
@@ -418,8 +418,8 @@ function Bo(e, t) {
418
418
  }
419
419
  const w = C[b], k = t - x;
420
420
  let S = w, A = 0;
421
- const T = b === 0, I = b === C.length - 1;
422
- if (!T) {
421
+ const M = b === 0, I = b === C.length - 1;
422
+ if (!M) {
423
423
  const v = w.match(/^ +/);
424
424
  A = v ? v[0].length : 0, A > 0 && (S = S.substring(A));
425
425
  }
@@ -430,21 +430,21 @@ function Bo(e, t) {
430
430
  const g = bs(S, n, s, o, i, l);
431
431
  let P = p;
432
432
  a === "center" ? P = (d - g) / 2 : a === "right" && (P = d - p - g);
433
- let z = P;
433
+ let O = P;
434
434
  const D = Math.min(k, w.length);
435
435
  for (let v = 0; v < D; v++) {
436
- if (!T && v < A) continue;
436
+ if (!M && v < A) continue;
437
437
  const se = w[v], K = x + v, N = c.getStyleAt(K), u = N.fontSize || n, Q = N.fontFamily || s, G = N.bold !== void 0 ? N.bold : o, te = N.italic !== void 0 ? N.italic : i, ce = N.letterSpacing !== void 0 ? N.letterSpacing : l;
438
- z += bs(se, u, Q, G, te, ce);
438
+ O += bs(se, u, Q, G, te, ce);
439
439
  }
440
440
  return {
441
441
  lineIndex: b,
442
442
  lineCount: C.length,
443
- xPositionInLine: z,
443
+ xPositionInLine: O,
444
444
  lineStartIndex: x
445
445
  };
446
446
  }
447
- function zo(e, t, n) {
447
+ function Oo(e, t, n) {
448
448
  const { fontSize: s } = e, o = e.lineHeight ?? 1.2, i = s * o, a = Bo(e, t), l = n === "up" ? Math.max(0, a.lineIndex - 1) : Math.min(a.lineCount - 1, a.lineIndex + 1);
449
449
  if (l === a.lineIndex)
450
450
  return t;
@@ -485,17 +485,17 @@ function Rn(e, t) {
485
485
  for (let N = 0; N < w; N++)
486
486
  S += C[N].length + 1;
487
487
  const A = C[w];
488
- let T = A, I = 0, g = 0;
489
- const P = w === 0, z = w === C.length - 1;
488
+ let M = A, I = 0, g = 0;
489
+ const P = w === 0, O = w === C.length - 1;
490
490
  if (!P) {
491
491
  const N = A.match(/^ +/);
492
- I = N ? N[0].length : 0, I > 0 && (T = T.substring(I));
492
+ I = N ? N[0].length : 0, I > 0 && (M = M.substring(I));
493
493
  }
494
- if (!z) {
495
- const N = T.match(/ +$/);
496
- g = N ? N[0].length : 0, g > 0 && (T = T.substring(0, T.length - g));
494
+ if (!O) {
495
+ const N = M.match(/ +$/);
496
+ g = N ? N[0].length : 0, g > 0 && (M = M.substring(0, M.length - g));
497
497
  }
498
- const D = bs(T, n, s, o, i, l);
498
+ const D = bs(M, n, s, o, i, l);
499
499
  let v = p;
500
500
  a === "center" ? v = (d - D) / 2 : a === "right" && (v = d - p - D);
501
501
  const se = t.x - v;
@@ -505,7 +505,7 @@ function Rn(e, t) {
505
505
  return S + A.length - g;
506
506
  let K = 0;
507
507
  for (let N = 0; N < A.length; N++) {
508
- if (!P && N < I || !z && N >= A.length - g) continue;
508
+ if (!P && N < I || !O && N >= A.length - g) continue;
509
509
  const u = A[N], Q = S + N, G = c.getStyleAt(Q), te = G.fontSize || n, ce = G.fontFamily || s, W = G.bold !== void 0 ? G.bold : o, pe = G.italic !== void 0 ? G.italic : i, ae = G.letterSpacing !== void 0 ? G.letterSpacing : l, ve = bs(u, te, ce, W, pe, ae);
510
510
  if (se < K + ve / 2)
511
511
  return Q;
@@ -513,7 +513,7 @@ function Rn(e, t) {
513
513
  }
514
514
  return S + A.length;
515
515
  }
516
- function Oo() {
516
+ function zo() {
517
517
  const [e, t] = le(!1), [n, s] = le({
518
518
  x: 0,
519
519
  y: 0
@@ -521,7 +521,7 @@ function Oo() {
521
521
  x: 0,
522
522
  y: 0
523
523
  }), [a, l] = le([]);
524
- return Te(() => {
524
+ return Me(() => {
525
525
  }, [e]), {
526
526
  isMarqueeSelecting: e,
527
527
  marqueeStart: n,
@@ -535,10 +535,10 @@ function Oo() {
535
535
  const x = Math.min(n.x, m), b = Math.max(n.x, m), w = Math.min(n.y, p), k = Math.max(n.y, p), S = [];
536
536
  C.forEach((A) => {
537
537
  if (A.visible === !1) return;
538
- const T = A.getVisualBoundingBox(), I = T.x, g = T.x + T.width, P = T.y, z = T.y + T.height;
538
+ const M = A.getVisualBoundingBox(), I = M.x, g = M.x + M.width, P = M.y, O = M.y + M.height;
539
539
  !(g < x || // element is left of marquee
540
540
  I > b || // element is right of marquee
541
- z < w || // element is above marquee
541
+ O < w || // element is above marquee
542
542
  P > k) && S.push(A.id);
543
543
  }), l(S);
544
544
  },
@@ -735,8 +735,8 @@ class Xo {
735
735
  for (let w = 1; w < s.length; w++) {
736
736
  const k = s[w - 1], S = s[w];
737
737
  if (k.handleOut || S.handleIn) {
738
- const T = k.x + (((a = k.handleOut) == null ? void 0 : a.x) || 0), I = k.y + (((l = k.handleOut) == null ? void 0 : l.y) || 0), g = S.x + (((c = S.handleIn) == null ? void 0 : c.x) || 0), P = S.y + (((f = S.handleIn) == null ? void 0 : f.y) || 0);
739
- t.bezierCurveTo(T, I, g, P, S.x, S.y);
738
+ const M = k.x + (((a = k.handleOut) == null ? void 0 : a.x) || 0), I = k.y + (((l = k.handleOut) == null ? void 0 : l.y) || 0), g = S.x + (((c = S.handleIn) == null ? void 0 : c.x) || 0), P = S.y + (((f = S.handleIn) == null ? void 0 : f.y) || 0);
739
+ t.bezierCurveTo(M, I, g, P, S.x, S.y);
740
740
  } else
741
741
  t.lineTo(S.x, S.y);
742
742
  }
@@ -744,8 +744,8 @@ class Xo {
744
744
  if (b && s.length > 2) {
745
745
  const w = s[s.length - 1], k = s[0];
746
746
  if (w.handleOut || k.handleIn) {
747
- const A = w.x + (((d = w.handleOut) == null ? void 0 : d.x) || 0), T = w.y + (((m = w.handleOut) == null ? void 0 : m.y) || 0), I = k.x + (((p = k.handleIn) == null ? void 0 : p.x) || 0), g = k.y + (((C = k.handleIn) == null ? void 0 : C.y) || 0);
748
- t.bezierCurveTo(A, T, I, g, k.x, k.y);
747
+ const A = w.x + (((d = w.handleOut) == null ? void 0 : d.x) || 0), M = w.y + (((m = w.handleOut) == null ? void 0 : m.y) || 0), I = k.x + (((p = k.handleIn) == null ? void 0 : p.x) || 0), g = k.y + (((C = k.handleIn) == null ? void 0 : C.y) || 0);
748
+ t.bezierCurveTo(A, M, I, g, k.x, k.y);
749
749
  } else
750
750
  t.lineTo(k.x, k.y);
751
751
  } else o && !this.state.isDraggingHandle && t.lineTo(o.x, o.y);
@@ -774,12 +774,12 @@ class Xo {
774
774
  t.restore();
775
775
  }
776
776
  }
777
- const Lo = Xn("usePenTool");
778
- function Yo({ selectedElement: e }) {
777
+ const Yo = Xn("usePenTool");
778
+ function Lo({ selectedElement: e }) {
779
779
  const [t] = le(() => new Xo()), [n, s] = le("crosshair");
780
- return Te(() => {
780
+ return Me(() => {
781
781
  try {
782
- const o = bo(/* @__PURE__ */ r(Oe, { icon: "lucide:pen-tool", width: 24, height: 24 })).replace(
782
+ const o = bo(/* @__PURE__ */ r(ze, { icon: "lucide:pen-tool", width: 24, height: 24 })).replace(
783
783
  /<svg[^>]*>|<\/svg>/g,
784
784
  ""
785
785
  ), i = `
@@ -796,9 +796,9 @@ function Yo({ selectedElement: e }) {
796
796
  `.trim(), l = `data:image/svg+xml,${encodeURIComponent(i)}`;
797
797
  s(`url('${l}') 0 0, crosshair`);
798
798
  } catch (o) {
799
- Lo.error("Failed to create pen cursor:", o), s("crosshair");
799
+ Yo.error("Failed to create pen cursor:", o), s("crosshair");
800
800
  }
801
- }, []), Te(() => {
801
+ }, []), Me(() => {
802
802
  e instanceof kn && e.transformData.points.length === 0 && !t.isActive() && t.startPath(e);
803
803
  }, [e, t]), {
804
804
  penTool: t,
@@ -817,7 +817,7 @@ function Ho({
817
817
  },
818
818
  [s]
819
819
  );
820
- return Te(() => {
820
+ return Me(() => {
821
821
  if (o && t instanceof Re) {
822
822
  const c = t.children.find((f) => f.id === o.id);
823
823
  c && c !== o && (c instanceof Re || (i(c), s == null || s(c), n.update(c)));
@@ -844,7 +844,7 @@ function _o({ onHoverChange: e }) {
844
844
  };
845
845
  });
846
846
  }, []);
847
- return Te(() => {
847
+ return Me(() => {
848
848
  if (!e) return;
849
849
  let o = null;
850
850
  if (t.type === "element" || t.type === "group-sibling") {
@@ -933,13 +933,13 @@ class $o {
933
933
  handleCropImageDrag(t, n, s, o) {
934
934
  const i = s - n.startX, a = o - n.startY, l = n.startData.x, c = n.startData.y, f = n.startData.transformData, d = f.width, m = f.height, p = n.startData.cropX ?? 0, C = n.startData.cropY ?? 0, x = n.startData.cropWidth ?? 1, b = n.startData.cropHeight ?? 1, k = ms.fromSnapshot(n.startData).worldDeltaToLocal(i, a);
935
935
  let S = k.dx, A = k.dy;
936
- const T = f.flipHorizontal ? -1 : 1, I = f.flipVertical ? -1 : 1;
937
- S *= T, A *= I;
936
+ const M = f.flipHorizontal ? -1 : 1, I = f.flipVertical ? -1 : 1;
937
+ S *= M, A *= I;
938
938
  const g = -S / d, P = -A / m;
939
- let z = p + g, D = C + P;
939
+ let O = p + g, D = C + P;
940
940
  const v = 1 - x, se = 1 - b;
941
- return z = Math.max(0, Math.min(v, z)), D = Math.max(0, Math.min(se, D)), {
942
- cropX: z,
941
+ return O = Math.max(0, Math.min(v, O)), D = Math.max(0, Math.min(se, D)), {
942
+ cropX: O,
943
943
  cropY: D,
944
944
  cropWidth: x,
945
945
  cropHeight: b,
@@ -952,11 +952,11 @@ class $o {
952
952
  * Handle resizing the crop box
953
953
  */
954
954
  handleCropBoxResize(t, n, s, o, i, a) {
955
- const l = s.startData.transformData, c = l.flipHorizontal, f = l.flipVertical, d = this._getCropResizeCursor(n, !!c, !!f), m = s.startData.rotation, p = s.startData.x, C = s.startData.y, x = ms.fromSnapshot(s.startData), { cos: b, sin: w } = x.getInverseCosSin(), k = c ? -1 : 1, S = f ? -1 : 1, A = i - p, T = a - C;
956
- let I = A * b - T * w, g = A * w + T * b;
955
+ const l = s.startData.transformData, c = l.flipHorizontal, f = l.flipVertical, d = this._getCropResizeCursor(n, !!c, !!f), m = s.startData.rotation, p = s.startData.x, C = s.startData.y, x = ms.fromSnapshot(s.startData), { cos: b, sin: w } = x.getInverseCosSin(), k = c ? -1 : 1, S = f ? -1 : 1, A = i - p, M = a - C;
956
+ let I = A * b - M * w, g = A * w + M * b;
957
957
  I *= k, g *= S;
958
- const P = o.startX - p, z = o.startY - C;
959
- let D = P * b - z * w, v = P * w + z * b;
958
+ const P = o.startX - p, O = o.startY - C;
959
+ let D = P * b - O * w, v = P * w + O * b;
960
960
  D *= k, v *= S;
961
961
  const se = I - D, K = g - v, N = l.cropX, u = l.cropY, Q = l.cropWidth, G = l.cropHeight, te = l.width, ce = l.height, W = se / te, pe = K / ce, ae = this._calculateNewCropValues(
962
962
  n,
@@ -1055,7 +1055,7 @@ function Fo() {
1055
1055
  }
1056
1056
  function Wo(e) {
1057
1057
  const t = Se(null), n = Se(null);
1058
- return Te(() => {
1058
+ return Me(() => {
1059
1059
  n.current = null;
1060
1060
  }, [e]), {
1061
1061
  multiSelectionGroupBoundsRef: t,
@@ -1066,7 +1066,7 @@ function Zs(e) {
1066
1066
  return e != null && e instanceof Qe;
1067
1067
  }
1068
1068
  function Vo({ selectedElement: e, ref: t }) {
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, C] = le(0), x = Se(1), b = Se(performance.now()), w = Se(0), k = Se(!1), [S, A] = le(null), [T, I] = le(null), g = Se(null), P = ft(
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, C] = le(0), x = Se(1), b = Se(performance.now()), w = Se(0), k = Se(!1), [S, A] = le(null), [M, I] = le(null), g = Se(null), P = ft(
1070
1070
  (v) => {
1071
1071
  if (!n || !S)
1072
1072
  return;
@@ -1080,17 +1080,17 @@ function Vo({ selectedElement: e, ref: t }) {
1080
1080
  }
1081
1081
  },
1082
1082
  [n, S, d, p]
1083
- ), z = ft(() => {
1083
+ ), O = ft(() => {
1084
1084
  if (!n || !S || !e) return null;
1085
1085
  const v = Math.min(d, p), se = Math.max(d, p);
1086
1086
  return v === se ? v === 0 ? Zs(e) ? e.getDefaultStyle() : {} : S.getStyleAt(Math.max(0, v - 1)) : S.getStyleAt(v);
1087
1087
  }, [n, S, d, p, e]), D = ft(
1088
1088
  (v) => {
1089
1089
  if (!n || !S || !e) return;
1090
- const se = z(), u = !{ ...Zs(e) ? e.getDefaultStyle() : {}, ...se }[v];
1090
+ const se = O(), u = !{ ...Zs(e) ? e.getDefaultStyle() : {}, ...se }[v];
1091
1091
  P({ [v]: u });
1092
1092
  },
1093
- [n, S, e, z, P]
1093
+ [n, S, e, O, P]
1094
1094
  );
1095
1095
  return sr(
1096
1096
  t,
@@ -1102,9 +1102,9 @@ function Vo({ selectedElement: e, ref: t }) {
1102
1102
  D(v);
1103
1103
  },
1104
1104
  isEditingText: () => n,
1105
- getSelectionStyle: () => z()
1105
+ getSelectionStyle: () => O()
1106
1106
  }),
1107
- [P, D, n, z]
1107
+ [P, D, n, O]
1108
1108
  ), {
1109
1109
  isEditing: n,
1110
1110
  setIsEditing: s,
@@ -1130,10 +1130,10 @@ function Vo({ selectedElement: e, ref: t }) {
1130
1130
  setEditRichText: A,
1131
1131
  editRichTextRef: g,
1132
1132
  // Export ref for synchronous access in handleTextEditComplete
1133
- currentFormattingStyle: T,
1133
+ currentFormattingStyle: M,
1134
1134
  setCurrentFormattingStyle: I,
1135
1135
  applyFormattingToSelection: P,
1136
- getSelectionStyle: z,
1136
+ getSelectionStyle: O,
1137
1137
  toggleFormattingProperty: D
1138
1138
  };
1139
1139
  }
@@ -1151,12 +1151,12 @@ function Ko({
1151
1151
  focusedPieceRect: d
1152
1152
  }) {
1153
1153
  const [m, p] = le(!1);
1154
- Te(() => {
1154
+ Me(() => {
1155
1155
  const K = "ontouchstart" in window || navigator.maxTouchPoints > 0;
1156
1156
  p(K);
1157
1157
  }, []);
1158
1158
  const C = Se(null);
1159
- Te(() => {
1159
+ Me(() => {
1160
1160
  const K = (N) => {
1161
1161
  C.current = N.target, setTimeout(() => {
1162
1162
  C.current = null;
@@ -1170,7 +1170,7 @@ function Ko({
1170
1170
  width: e ?? window.innerWidth,
1171
1171
  height: t ?? window.innerHeight
1172
1172
  });
1173
- Te(() => {
1173
+ Me(() => {
1174
1174
  if (d) {
1175
1175
  b({ width: d.width, height: d.height });
1176
1176
  return;
@@ -1181,7 +1181,7 @@ function Ko({
1181
1181
  }
1182
1182
  const K = f.getActiveArtboard();
1183
1183
  K && b({ width: K.width, height: K.height });
1184
- }, [e, t, c, f, d]), Te(() => {
1184
+ }, [e, t, c, f, d]), Me(() => {
1185
1185
  const K = () => {
1186
1186
  if (d) {
1187
1187
  b({ width: d.width, height: d.height });
@@ -1194,7 +1194,7 @@ function Ko({
1194
1194
  };
1195
1195
  return window.addEventListener("resize", K), () => window.removeEventListener("resize", K);
1196
1196
  }, [e, t, f, d]);
1197
- const w = Math.max(0.1, Math.min(1, s)), k = a ?? i, S = l ?? i, A = k !== void 0 && n > 0 ? k / n : 0, T = S !== void 0 && n > 0 ? S / n : 0, I = k !== void 0 ? x.width + A * 2 : x.width / w, g = S !== void 0 ? x.height + T * 2 : x.height / w, P = k !== void 0 ? A : (I - x.width) / 2, z = S !== void 0 ? T : (g - x.height) / 2, D = d ? P - d.x : P, v = d ? z - d.y : z, se = n > 0 ? o / n : o;
1197
+ const w = Math.max(0.1, Math.min(1, s)), k = a ?? i, S = l ?? i, A = k !== void 0 && n > 0 ? k / n : 0, M = S !== void 0 && n > 0 ? S / n : 0, I = k !== void 0 ? x.width + A * 2 : x.width / w, g = S !== void 0 ? x.height + M * 2 : x.height / w, P = k !== void 0 ? A : (I - x.width) / 2, O = S !== void 0 ? M : (g - x.height) / 2, D = d ? P - d.x : P, v = d ? O - d.y : O, se = n > 0 ? o / n : o;
1198
1198
  return {
1199
1199
  isTouchDevice: m,
1200
1200
  canvasSize: x,
@@ -1228,7 +1228,7 @@ function Go({ elements: e }) {
1228
1228
  const [, t] = le({}), [n, s] = le(0), [o, i] = le(0), [a, l] = le(0), c = ft(() => {
1229
1229
  i((f) => f + 1);
1230
1230
  }, []);
1231
- return Te(() => Qr((d) => {
1231
+ return Me(() => Qr((d) => {
1232
1232
  e.some((p) => p.id === d) && i((p) => p + 1);
1233
1233
  }), [e]), {
1234
1234
  renderVersion: o,
@@ -1388,14 +1388,14 @@ function Qo(e, t, n, s) {
1388
1388
  return null;
1389
1389
  }
1390
1390
  function ei(e) {
1391
- var k, S, A, T, I, g, P;
1391
+ var k, S, A, M, I, g, P;
1392
1392
  const { ctx: t, pieces: n, pieceGuides: s, artboardOrigin: o, zoom: i } = e;
1393
1393
  if (!n.length) return;
1394
1394
  const a = {
1395
1395
  bleed: ((k = e.show) == null ? void 0 : k.bleed) ?? !0,
1396
1396
  zones: ((S = e.show) == null ? void 0 : S.zones) ?? !0,
1397
1397
  boundary: ((A = e.show) == null ? void 0 : A.boundary) ?? !0,
1398
- safeArea: ((T = e.show) == null ? void 0 : T.safeArea) ?? !0,
1398
+ safeArea: ((M = e.show) == null ? void 0 : M.safeArea) ?? !0,
1399
1399
  labels: ((I = e.show) == null ? void 0 : I.labels) ?? !0
1400
1400
  }, l = t.canvas, c = l instanceof HTMLCanvasElement ? l : null, f = jo(), m = { ...{
1401
1401
  ...Jn,
@@ -1407,18 +1407,18 @@ function ei(e) {
1407
1407
  let x = Rs(m.boundaryStroke, c);
1408
1408
  f && $s(p) ? p = "#ffffff" : !f && Fs(p) && (p = "#000000"), f && $s(x) ? x = "#ffffff" : !f && Fs(x) && (x = "#000000");
1409
1409
  const w = n.some(
1410
- (z) => {
1410
+ (O) => {
1411
1411
  var D;
1412
- return (((D = s == null ? void 0 : s[z.id]) == null ? void 0 : D.zones) ?? []).some((v) => v.kind === "dieCut");
1412
+ return (((D = s == null ? void 0 : s[O.id]) == null ? void 0 : D.zones) ?? []).some((v) => v.kind === "dieCut");
1413
1413
  }
1414
1414
  ) && c ? qo(c) : null;
1415
1415
  t.save(), t.translate(o.x, o.y);
1416
- for (const z of n) {
1417
- if (e.focusedPieceId != null && z.id !== e.focusedPieceId)
1416
+ for (const O of n) {
1417
+ if (e.focusedPieceId != null && O.id !== e.focusedPieceId)
1418
1418
  continue;
1419
- const D = s == null ? void 0 : s[z.id], v = (D == null ? void 0 : D.zones) ?? [], se = (D == null ? void 0 : D.labels) ?? [];
1420
- t.save(), t.translate(z.x, z.y), ao(t, z);
1421
- const { width: K, height: N } = fr(z), u = Jo(D, K, N), Q = Qo(D, z, K, N), G = !0, te = Math.max(0, (D == null ? void 0 : D.outerRadius) ?? 0), ce = D != null && D.boundary && D.boundary.kind === "path" ? D.boundary : null, W = ce ?? (te > 0 ? {
1419
+ const D = s == null ? void 0 : s[O.id], v = (D == null ? void 0 : D.zones) ?? [], se = (D == null ? void 0 : D.labels) ?? [];
1420
+ t.save(), t.translate(O.x, O.y), ao(t, O);
1421
+ const { width: K, height: N } = fr(O), u = Jo(D, K, N), Q = Qo(D, O, K, N), G = !0, te = Math.max(0, (D == null ? void 0 : D.outerRadius) ?? 0), ce = D != null && D.boundary && D.boundary.kind === "path" ? D.boundary : null, W = ce ?? (te > 0 ? {
1422
1422
  kind: "roundedRect",
1423
1423
  x: 0,
1424
1424
  y: 0,
@@ -1499,8 +1499,8 @@ function ti(e, t, n, s, o, i, a, l, c, f = "source-over") {
1499
1499
  const A = S.getContext("2d");
1500
1500
  if (!A) return;
1501
1501
  A.setTransform(1, 0, 0, 1, 0, 0), A.clearRect(0, 0, w, k), A.scale(c * p, c * p), A.translate(C, C), A.fillStyle = i, A.globalAlpha = a;
1502
- const T = new Path2D();
1503
- vs(T, s), A.fill(T), A.globalAlpha = 1, A.filter = `blur(${m * p}px)`, A.globalCompositeOperation = "destination-out", A.fillStyle = "#000";
1502
+ const M = new Path2D();
1503
+ vs(M, s), A.fill(M), A.globalAlpha = 1, A.filter = `blur(${m * p}px)`, A.globalCompositeOperation = "destination-out", A.fillStyle = "#000";
1504
1504
  const I = new Path2D();
1505
1505
  vs(I, o), A.fill(I), A.filter = "none", A.globalCompositeOperation = "source-over";
1506
1506
  const g = e.globalCompositeOperation;
@@ -1571,14 +1571,14 @@ function di(e) {
1571
1571
  return { updatedOBB: null, groupBounds: null };
1572
1572
  const p = i._multiSelectionDragContext, C = i.getMode() === "drag" && p;
1573
1573
  m.forEach((ve) => {
1574
- let Ee = s.find((Me) => Me.id === ve);
1574
+ let Ee = s.find((Te) => Te.id === ve);
1575
1575
  if (C && p.currentElements) {
1576
- const Me = p.currentElements.get(ve);
1577
- Me && (Ee = Me);
1576
+ const Te = p.currentElements.get(ve);
1577
+ Te && (Ee = Te);
1578
1578
  }
1579
1579
  if (Ee) {
1580
- const Me = Ee.getVisualBoundingBox(), Be = Ee.getRotationAnchor();
1581
- t.save(), Ee.rotation !== 0 && (t.translate(Be.x, Be.y), t.rotate(-Ee.rotation * Math.PI / 180), t.translate(-Be.x, -Be.y)), t.strokeStyle = En(), t.lineWidth = Fn(d), t.strokeRect(Me.x, Me.y, Me.width, Me.height), t.restore();
1580
+ const Te = Ee.getVisualBoundingBox(), Be = Ee.getRotationAnchor();
1581
+ t.save(), Ee.rotation !== 0 && (t.translate(Be.x, Be.y), t.rotate(-Ee.rotation * Math.PI / 180), t.translate(-Be.x, -Be.y)), t.strokeStyle = En(), t.lineWidth = Fn(d), t.strokeRect(Te.x, Te.y, Te.width, Te.height), t.restore();
1582
1582
  }
1583
1583
  });
1584
1584
  let x = m.map((ve) => s.find((Ee) => Ee.id === ve)).filter((ve) => ve !== void 0);
@@ -1586,7 +1586,7 @@ function di(e) {
1586
1586
  return { updatedOBB: null, groupBounds: null };
1587
1587
  let b = 1 / 0, w = 1 / 0, k = -1 / 0, S = -1 / 0;
1588
1588
  x.forEach((ve) => {
1589
- const Ee = ve.getVisualBoundingBox(), Me = [
1589
+ const Ee = ve.getVisualBoundingBox(), Te = [
1590
1590
  { x: Ee.x, y: Ee.y },
1591
1591
  { x: Ee.x + Ee.width, y: Ee.y },
1592
1592
  { x: Ee.x, y: Ee.y + Ee.height },
@@ -1594,31 +1594,31 @@ function di(e) {
1594
1594
  ];
1595
1595
  if (ve.rotation !== 0) {
1596
1596
  const Be = ve.getRotationAnchor(), De = -ve.rotation * Math.PI / 180, We = Math.cos(De), at = Math.sin(De);
1597
- Me.forEach((pt) => {
1597
+ Te.forEach((pt) => {
1598
1598
  const ct = pt.x - Be.x, At = pt.y - Be.y;
1599
1599
  pt.x = Be.x + (ct * We - At * at), pt.y = Be.y + (ct * at + At * We);
1600
1600
  });
1601
1601
  }
1602
- Me.forEach((Be) => {
1602
+ Te.forEach((Be) => {
1603
1603
  b = Math.min(b, Be.x), w = Math.min(w, Be.y), k = Math.max(k, Be.x), S = Math.max(S, Be.y);
1604
1604
  });
1605
1605
  });
1606
- const A = k - b, T = S - w, I = (b + k) / 2, g = (w + S) / 2;
1606
+ const A = k - b, M = S - w, I = (b + k) / 2, g = (w + S) / 2;
1607
1607
  let P = a;
1608
1608
  if ((!P || P.width === 0 || P.height === 0) && (P = {
1609
1609
  centerX: I,
1610
1610
  centerY: g,
1611
1611
  width: A,
1612
- height: T,
1612
+ height: M,
1613
1613
  rotation: 0
1614
1614
  }), i.getMode() === "drag" && i._multiSelectionDragContext) {
1615
1615
  const ve = i._multiSelectionDragContext;
1616
1616
  if (ve != null && ve.startOBB && (ve != null && ve.currentDelta)) {
1617
- const { dx: Ee, dy: Me } = ve.currentDelta;
1617
+ const { dx: Ee, dy: Te } = ve.currentDelta;
1618
1618
  P = {
1619
1619
  ...P,
1620
1620
  centerX: ve.startOBB.centerX + Ee,
1621
- centerY: ve.startOBB.centerY + Me
1621
+ centerY: ve.startOBB.centerY + Te
1622
1622
  };
1623
1623
  } else
1624
1624
  P = { ...P, centerX: I, centerY: g };
@@ -1626,8 +1626,8 @@ function di(e) {
1626
1626
  const v = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, se = P.width, K = P.height, N = P.centerX, u = P.centerY, Q = N - se / 2, G = u - K / 2, te = N + se / 2, ce = u + K / 2;
1627
1627
  let W = N, pe = ce + eo;
1628
1628
  if (v !== 0) {
1629
- const ve = -v * Math.PI / 180, Ee = Math.cos(ve), Me = Math.sin(ve), Be = W - N, De = pe - u;
1630
- W = N + (Be * Ee - De * Me), pe = u + (Be * Me + De * Ee);
1629
+ const ve = -v * Math.PI / 180, Ee = Math.cos(ve), Te = Math.sin(ve), Be = W - N, De = pe - u;
1630
+ W = N + (Be * Ee - De * Te), pe = u + (Be * Te + De * Ee);
1631
1631
  }
1632
1632
  const ae = {
1633
1633
  minX: Q,
@@ -1678,15 +1678,15 @@ function ui(e, t) {
1678
1678
  { x: n, y: i, anchor: "bottom-left" },
1679
1679
  { x: o, y: i, anchor: "bottom-right" }
1680
1680
  ], k = C.getMode() === "resize", S = k ? (A = C._multiSelectionResizeContext) == null ? void 0 : A.anchor : null;
1681
- w.forEach((T) => {
1682
- if (k && S && T.anchor !== S)
1681
+ w.forEach((M) => {
1682
+ if (k && S && M.anchor !== S)
1683
1683
  return;
1684
- let I = T.x, g = T.y;
1684
+ let I = M.x, g = M.y;
1685
1685
  if (d !== 0) {
1686
- const P = -d * Math.PI / 180, z = Math.cos(P), D = Math.sin(P), v = T.x - a, se = T.y - l;
1687
- I = a + (v * z - se * D), g = l + (v * D + se * z);
1686
+ const P = -d * Math.PI / 180, O = Math.cos(P), D = Math.sin(P), v = M.x - a, se = M.y - l;
1687
+ I = a + (v * O - se * D), g = l + (v * D + se * O);
1688
1688
  }
1689
- e.save(), e.beginPath(), e.arc(I, g, b, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill(), e.strokeStyle = En(), e.lineWidth = k && S && T.anchor === S ? Fn(x) * 1.25 : Fn(x), e.stroke(), e.restore();
1689
+ e.save(), e.beginPath(), e.arc(I, g, b, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill(), e.strokeStyle = En(), e.lineWidth = k && S && M.anchor === S ? Fn(x) * 1.25 : Fn(x), e.stroke(), e.restore();
1690
1690
  }), k || lo(e, m, p, x, En()), C.getMode() === "resize" && hi(e, a, i, c, f);
1691
1691
  }
1692
1692
  function hi(e, t, n, s, o) {
@@ -1786,10 +1786,10 @@ function xi(e) {
1786
1786
  const t = Se(e);
1787
1787
  t.current = e;
1788
1788
  const n = Se(!0), s = Se(null), o = Se("#0a0a0a");
1789
- Te(() => {
1789
+ Me(() => {
1790
1790
  const i = t.current.canvasRef.current ?? document.documentElement, a = getComputedStyle(i).getPropertyValue("--color-canvas-bg").trim();
1791
1791
  o.current = a || "#0a0a0a";
1792
- }, [e.resolvedTheme]), Te(() => {
1792
+ }, [e.resolvedTheme]), Me(() => {
1793
1793
  n.current = !0;
1794
1794
  }, [
1795
1795
  e.elementsByArtboard,
@@ -1802,7 +1802,7 @@ function xi(e) {
1802
1802
  e.renderVersion,
1803
1803
  e.resolvedTheme,
1804
1804
  e.pieceGuides
1805
- ]), Te(() => {
1805
+ ]), Me(() => {
1806
1806
  n.current = !0;
1807
1807
  }, [
1808
1808
  e.transformHandles,
@@ -1827,7 +1827,7 @@ function xi(e) {
1827
1827
  e.isAltKeyPressed,
1828
1828
  e.penTool,
1829
1829
  e.cursorAnimationFrame
1830
- ]), Te(() => {
1830
+ ]), Me(() => {
1831
1831
  let i;
1832
1832
  const l = () => {
1833
1833
  const { hoverState: c } = t.current;
@@ -1861,11 +1861,11 @@ function yi(e, t, n) {
1861
1861
  paddingOffsetX: k,
1862
1862
  paddingOffsetY: S,
1863
1863
  zoom: A,
1864
- zoomInvariantBorderRadius: T,
1864
+ zoomInvariantBorderRadius: M,
1865
1865
  effectiveViewPadding: I,
1866
1866
  showRotationHandle: g,
1867
1867
  isRotating: P,
1868
- currentRotation: z,
1868
+ currentRotation: O,
1869
1869
  hoverState: D,
1870
1870
  isEditing: v,
1871
1871
  editText: se,
@@ -1881,7 +1881,7 @@ function yi(e, t, n) {
1881
1881
  lastMultiClickTimeRef: ae,
1882
1882
  MULTI_CLICK_DEBOUNCE: ve,
1883
1883
  snapGuides: Ee,
1884
- spacingIndicators: Me,
1884
+ spacingIndicators: Te,
1885
1885
  isAltKeyPressed: Be,
1886
1886
  multiSelection: De,
1887
1887
  multiSelectionOBBRef: We,
@@ -1904,22 +1904,22 @@ function yi(e, t, n) {
1904
1904
  G.current = 1;
1905
1905
  const h = window.devicePixelRatio || 1, U = b * A, oe = w * A;
1906
1906
  if (U <= 0 || oe <= 0) return;
1907
- const ue = 4096, $ = U * h, we = oe * h, Ie = Math.max($, we), Ke = Ie > ue ? ue / Ie : 1, Ye = h * Ke;
1908
- lt.width = U * Ye, lt.height = oe * Ye, re.setTransform(1, 0, 0, 1, 0, 0), re.clearRect(0, 0, lt.width, lt.height);
1909
- const L = t.current;
1910
- re.scale(Ye, Ye), A !== 1 && re.scale(A, A), (k !== 0 || S !== 0) && re.translate(k, S);
1907
+ const ue = 4096, $ = U * h, we = oe * h, Ie = Math.max($, we), Ke = Ie > ue ? ue / Ie : 1, Le = h * Ke;
1908
+ lt.width = U * Le, lt.height = oe * Le, re.setTransform(1, 0, 0, 1, 0, 0), re.clearRect(0, 0, lt.width, lt.height);
1909
+ const Y = t.current;
1910
+ re.scale(Le, Le), A !== 1 && re.scale(A, A), (k !== 0 || S !== 0) && re.translate(k, S);
1911
1911
  const X = a.find((Ue) => Ue.id === l.getActiveArtboardId()), ot = (X == null ? void 0 : X.id) ?? null, st = ke && X ? gi(
1912
1912
  ke.pieces,
1913
1913
  ke.guides,
1914
1914
  e.focusedPieceId ?? null
1915
1915
  ) : void 0;
1916
- let Je = ke ? 0 : T;
1916
+ let Je = ke ? 0 : M;
1917
1917
  if (ke && ke.pieces.length === 1 && X) {
1918
1918
  const Ue = ke.pieces[0].id, Pe = (on = ke.guides) == null ? void 0 : on[Ue], qe = Pe == null ? void 0 : Pe.outerRadius, Xe = Pe == null ? void 0 : Pe.boundary, H = Xe && typeof Xe == "object" && Xe.kind === "roundedRect" ? Xe.rx ?? Xe.ry : void 0, be = typeof qe == "number" && qe > 0 ? qe : typeof H == "number" && H > 0 ? H : 0;
1919
1919
  be > 0 && (Je = be);
1920
1920
  }
1921
1921
  if (X && !ke)
1922
- if (re.fillStyle = L, st && typeof st == "object" && st.type === "path")
1922
+ if (re.fillStyle = Y, st && typeof st == "object" && st.type === "path")
1923
1923
  try {
1924
1924
  const Ue = new Path2D(st.d);
1925
1925
  re.save(), re.translate(X.x, X.y), re.fill(Ue), re.restore();
@@ -1963,8 +1963,8 @@ function yi(e, t, n) {
1963
1963
  const H = Xe.clone();
1964
1964
  H.children = H.children.map((be) => {
1965
1965
  if (be.id === Ue && K && be instanceof Qe) {
1966
- const ze = be.clone();
1967
- return ze.setRichText(K), ze;
1966
+ const Oe = be.clone();
1967
+ return Oe.setRichText(K), Oe;
1968
1968
  }
1969
1969
  return be;
1970
1970
  }), qe = H;
@@ -1990,13 +1990,13 @@ function yi(e, t, n) {
1990
1990
  selectedId: f,
1991
1991
  selectedElement: xt || null,
1992
1992
  transformHandles: C,
1993
- currentRotation: z,
1993
+ currentRotation: O,
1994
1994
  isRotating: P,
1995
1995
  hoverState: D,
1996
1996
  isEditing: v,
1997
1997
  stateMachine: x,
1998
1998
  snapGuides: Ee,
1999
- spacingIndicators: Me,
1999
+ spacingIndicators: Te,
2000
2000
  hideHandles: Bt,
2001
2001
  isAltKeyPressed: Be,
2002
2002
  artboardBackgroundColor: X == null ? void 0 : X.backgroundColor,
@@ -2043,15 +2043,15 @@ function yi(e, t, n) {
2043
2043
  const Xe = Ge.getVisualBoundingBox();
2044
2044
  e: for (const H of ke.pieces) {
2045
2045
  const be = ((Ut = (an = ke.guides) == null ? void 0 : an[H.id]) == null ? void 0 : Ut.zones) ?? [];
2046
- for (const ze of be) {
2047
- if (ze.kind !== "dieCut") continue;
2048
- const _e = ze.path;
2046
+ for (const Oe of be) {
2047
+ if (Oe.kind !== "dieCut") continue;
2048
+ const _e = Oe.path;
2049
2049
  if (_e.kind !== "rect" && _e.kind !== "roundedRect") {
2050
2050
  Ue = !0;
2051
2051
  break e;
2052
2052
  }
2053
- const Le = H.x + (_e.x ?? 0), mt = H.y + (_e.y ?? 0), yt = _e.width ?? 0, rt = _e.height ?? 0;
2054
- if (Xe.x < Le + yt && Xe.x + Xe.width > Le && Xe.y < mt + rt && Xe.y + Xe.height > mt) {
2053
+ const Ye = H.x + (_e.x ?? 0), mt = H.y + (_e.y ?? 0), yt = _e.width ?? 0, rt = _e.height ?? 0;
2054
+ if (Xe.x < Ye + yt && Xe.x + Xe.width > Ye && Xe.y < mt + rt && Xe.y + Xe.height > mt) {
2055
2055
  Ue = !0;
2056
2056
  break e;
2057
2057
  }
@@ -2098,7 +2098,7 @@ function yi(e, t, n) {
2098
2098
  selectedElement: xt || null,
2099
2099
  transformHandles: C,
2100
2100
  stateMachine: x,
2101
- currentRotation: z,
2101
+ currentRotation: O,
2102
2102
  isRotating: P,
2103
2103
  hoverState: D,
2104
2104
  selectedId: f,
@@ -2123,7 +2123,7 @@ function yi(e, t, n) {
2123
2123
  zoom: A,
2124
2124
  paddingOffset: { x: k, y: S }
2125
2125
  });
2126
- const tn = pt ? Xt : De, Ht = new Set(Nt.map((Ue) => Ue.id)), { updatedOBB: wt, groupBounds: Lt } = di({
2126
+ const tn = pt ? Xt : De, Ht = new Set(Nt.map((Ue) => Ue.id)), { updatedOBB: wt, groupBounds: Yt } = di({
2127
2127
  ctx: re,
2128
2128
  displaySelection: tn,
2129
2129
  elements: o,
@@ -2131,11 +2131,11 @@ function yi(e, t, n) {
2131
2131
  stateMachine: x,
2132
2132
  multiSelectionOBB: We.current,
2133
2133
  isRotating: P,
2134
- currentRotation: z,
2134
+ currentRotation: O,
2135
2135
  isMarqueeSelecting: pt,
2136
2136
  zoom: A
2137
2137
  });
2138
- wt && We.current !== wt && (We.current = wt), at.current = Lt, pt && fi({ ctx: re, marqueeStart: ct, marqueeEnd: At, zoom: A }), D.type === "group-sibling" && D.data && pi({ ctx: re, hoveredChild: D.data, zoom: A }), Dt.isActive() && d instanceof kn && Dt.renderPreview(re, d);
2138
+ wt && We.current !== wt && (We.current = wt), at.current = Yt, pt && fi({ ctx: re, marqueeStart: ct, marqueeEnd: At, zoom: A }), D.type === "group-sibling" && D.data && pi({ ctx: re, hoveredChild: D.data, zoom: A }), Dt.isActive() && d instanceof kn && Dt.renderPreview(re, d);
2139
2139
  }
2140
2140
  function bi(e) {
2141
2141
  return e instanceof Qe && !(e.text ?? "").trim();
@@ -2286,17 +2286,17 @@ function Ei(e) {
2286
2286
  function ki(e) {
2287
2287
  const { selectedElement: t, activeChildElement: n } = e;
2288
2288
  let s = null, o = -1;
2289
- if (n instanceof Yt && n.isCropping)
2289
+ if (n instanceof Lt && n.isCropping)
2290
2290
  s = n, t instanceof Re && (o = t.children.findIndex((a) => a.id === n.id));
2291
2291
  else if (t instanceof Re)
2292
2292
  for (let a = 0; a < t.children.length; a++) {
2293
2293
  const l = t.children[a];
2294
- if (l.visible !== !1 && l instanceof Yt && l.isCropping) {
2294
+ if (l.visible !== !1 && l instanceof Lt && l.isCropping) {
2295
2295
  s = l, o = a;
2296
2296
  break;
2297
2297
  }
2298
2298
  }
2299
- const i = s || (t instanceof Yt && t.isCropping ? t : null);
2299
+ const i = s || (t instanceof Lt && t.isCropping ? t : null);
2300
2300
  return i ? {
2301
2301
  croppingImage: i,
2302
2302
  croppingChild: s,
@@ -2311,7 +2311,7 @@ function Ri(e) {
2311
2311
  const c = o.hitTestResize(t, n, i);
2312
2312
  return c ? { type: "image-handle", handle: c } : a.hitTest(t, n) ? { type: "image-drag" } : { type: "exit-crop" };
2313
2313
  }
2314
- function Mi(e) {
2314
+ function Ti(e) {
2315
2315
  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();
2316
2316
  m && (l.startResize(
2317
2317
  c,
@@ -2337,7 +2337,7 @@ function Mi(e) {
2337
2337
  childIndex: d
2338
2338
  }));
2339
2339
  }
2340
- function Ti(e) {
2340
+ function Mi(e) {
2341
2341
  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();
2342
2342
  l.startResize(c, n, s, o, m, p), f && (a && a.id === f.id ? l._activeChildContext = {
2343
2343
  group: i,
@@ -2481,11 +2481,11 @@ function Bi(e) {
2481
2481
  editModeEnteredAtRef: k,
2482
2482
  multiSelectionGroupBoundsRef: S,
2483
2483
  MULTI_CLICK_THRESHOLD: A,
2484
- MULTI_CLICK_DEBOUNCE: T,
2484
+ MULTI_CLICK_DEBOUNCE: M,
2485
2485
  CLICK_DEDUP_THRESHOLD: I,
2486
2486
  isEditing: g,
2487
2487
  editText: P,
2488
- isTouchDevice: z,
2488
+ isTouchDevice: O,
2489
2489
  selectionStart: D,
2490
2490
  selectionEnd: v,
2491
2491
  isRotating: se,
@@ -2501,7 +2501,7 @@ function Bi(e) {
2501
2501
  paddingOffsetY: ae,
2502
2502
  spacingIndicators: ve,
2503
2503
  focusedPieceRect: Ee,
2504
- setCursorPosition: Me,
2504
+ setCursorPosition: Te,
2505
2505
  setSelectionStart: Be,
2506
2506
  setSelectionEnd: De,
2507
2507
  setIsRotating: We,
@@ -2523,8 +2523,8 @@ function Bi(e) {
2523
2523
  cropController: we,
2524
2524
  onElementUpdate: Ie,
2525
2525
  executeElementUpdate: Ke,
2526
- onSelectionChange: Ye,
2527
- onMultiSelectionChange: L,
2526
+ onSelectionChange: Le,
2527
+ onMultiSelectionChange: Y,
2528
2528
  onRotationStateChange: X,
2529
2529
  onCropModeEnter: ot,
2530
2530
  onContextMenuRequest: st,
@@ -2535,56 +2535,56 @@ function Bi(e) {
2535
2535
  finishMarqueeSelection: tn,
2536
2536
  enterTextEditMode: Ht,
2537
2537
  setEditPosition: wt,
2538
- setEditText: Lt,
2538
+ setEditText: Yt,
2539
2539
  setEditRichText: on,
2540
2540
  setIsEditing: an,
2541
2541
  setCurrentFormattingStyle: Ut,
2542
2542
  getWrappedTextForEditing: Ue
2543
- } = e, Ge = Se(null), Pe = Se(/* @__PURE__ */ new Map()), qe = Se(null), Xe = Se(null), H = Se(null), be = Se(null), ze = Se(null), _e = Se(null), Le = Se(null), { userZoom: mt, setUserZoom: yt, panOffset: rt, setPanOffset: it } = Ds(), St = Se(mt);
2543
+ } = e, Ge = Se(null), Pe = Se(/* @__PURE__ */ new Map()), qe = Se(null), Xe = Se(null), H = Se(null), be = Se(null), Oe = Se(null), _e = Se(null), Ye = Se(null), { userZoom: mt, setUserZoom: yt, panOffset: rt, setPanOffset: it } = Ds(), St = Se(mt);
2544
2544
  St.current = mt;
2545
2545
  const fe = Se(rt);
2546
- fe.current = rt, Te(() => {
2547
- const O = t.current;
2548
- if (!O) return;
2546
+ fe.current = rt, Me(() => {
2547
+ const z = t.current;
2548
+ if (!z) return;
2549
2549
  const he = () => {
2550
- Ge.current = O.getBoundingClientRect();
2550
+ Ge.current = z.getBoundingClientRect();
2551
2551
  };
2552
2552
  return he(), window.addEventListener("scroll", he, { passive: !0, capture: !0 }), window.addEventListener("resize", he, { passive: !0 }), () => {
2553
2553
  window.removeEventListener("scroll", he, { capture: !0 }), window.removeEventListener("resize", he);
2554
2554
  };
2555
- }, [t]), Te(() => {
2556
- const O = t.current;
2557
- O && (Ge.current = O.getBoundingClientRect());
2555
+ }, [t]), Me(() => {
2556
+ const z = t.current;
2557
+ z && (Ge.current = z.getBoundingClientRect());
2558
2558
  }, [W, t]);
2559
2559
  const nn = ft(
2560
- (O) => {
2560
+ (z) => {
2561
2561
  var j, ge, xe, J, Z;
2562
- if (O.button === 2) return;
2562
+ if (z.button === 2) return;
2563
2563
  const he = t.current;
2564
2564
  if (!he) return;
2565
2565
  const dt = he.getBoundingClientRect();
2566
2566
  Ge.current = dt;
2567
- const V = (O.clientX - dt.left) / W - pe, ee = (O.clientY - dt.top) / W - ae;
2568
- Pe.current.size === 0 && (H.current = (u == null ? void 0 : u.id) ?? null), Pe.current.set(O.pointerId, {
2567
+ const V = (z.clientX - dt.left) / W - pe, ee = (z.clientY - dt.top) / W - ae;
2568
+ Pe.current.size === 0 && (H.current = (u == null ? void 0 : u.id) ?? null), Pe.current.set(z.pointerId, {
2569
2569
  x: V,
2570
2570
  y: ee,
2571
- clientX: O.clientX,
2572
- clientY: O.clientY
2571
+ clientX: z.clientX,
2572
+ clientY: z.clientY
2573
2573
  });
2574
- const et = g || u instanceof Yt && u.isCropping || $.isActive();
2574
+ const et = g || u instanceof Lt && u.isCropping || $.isActive();
2575
2575
  if (Pe.current.size === 2 && !et) {
2576
2576
  const E = Array.from(Pe.current.keys()), _ = Pe.current.get(E[0]), R = Pe.current.get(E[1]), F = H.current !== null;
2577
2577
  if (!(F && u && !u.locked && (u.hitTest(_.x, _.y) || u.hitTest(R.x, R.y)))) {
2578
2578
  if (C.current && C.current.size > 0) {
2579
- const zt = C.current;
2579
+ const Ot = C.current;
2580
2580
  lt(
2581
2581
  (Et) => Et.map((kt) => {
2582
- const Gt = zt.get(kt.id);
2582
+ const Gt = Ot.get(kt.id);
2583
2583
  return Gt ? Gt.clone() : kt;
2584
2584
  })
2585
2585
  ), C.current = null;
2586
2586
  }
2587
- !F && u && Ye(null), h.isInteracting() && h.end(), Le.current = null, be.current = null, ze.current = null, delete h._pendingTextEditMode, delete h._pendingChildSelection;
2587
+ !F && u && Le(null), h.isInteracting() && h.end(), Ye.current = null, be.current = null, Oe.current = null, delete h._pendingTextEditMode, delete h._pendingChildSelection;
2588
2588
  const ne = R.clientX - _.clientX, Ce = R.clientY - _.clientY, Ne = Math.hypot(ne, Ce), bt = (((j = he.parentElement) == null ? void 0 : j.parentElement) ?? he).getBoundingClientRect();
2589
2589
  _e.current = {
2590
2590
  pointerA: E[0],
@@ -2599,10 +2599,10 @@ function Bi(e) {
2599
2599
  containerRect: { left: bt.left, top: bt.top }
2600
2600
  };
2601
2601
  try {
2602
- he.setPointerCapture(O.pointerId);
2602
+ he.setPointerCapture(z.pointerId);
2603
2603
  } catch {
2604
2604
  }
2605
- O.preventDefault();
2605
+ z.preventDefault();
2606
2606
  return;
2607
2607
  }
2608
2608
  }
@@ -2620,57 +2620,57 @@ function Bi(e) {
2620
2620
  const E = Array.from(Pe.current.keys());
2621
2621
  qe.current = { a: E[0], b: E[1] };
2622
2622
  const _ = Pe.current.get(E[0]), R = Pe.current.get(E[1]);
2623
- be.current = null, ze.current = null, Le.current = null, Xe.current = u.clone(), h.startPinch(u, _, R);
2623
+ be.current = null, Oe.current = null, Ye.current = null, Xe.current = u.clone(), h.startPinch(u, _, R);
2624
2624
  try {
2625
- he.setPointerCapture(O.pointerId);
2625
+ he.setPointerCapture(z.pointerId);
2626
2626
  } catch {
2627
2627
  }
2628
- O.preventDefault();
2628
+ z.preventDefault();
2629
2629
  return;
2630
2630
  }
2631
2631
  if (g && u instanceof Qe) {
2632
- if (z && D !== v) {
2632
+ if (O && D !== v) {
2633
2633
  const E = m.current;
2634
2634
  if (E.start || E.end) {
2635
- const _ = en.toRadiansInverse(u.rotation), R = u.getRotationAnchor(), F = V - R.x, ie = ee - R.y, ne = Math.cos(_), Ce = Math.sin(_), Ne = F * ne - ie * Ce, tt = F * Ce + ie * ne, bt = Ne, zt = tt, Et = 44 / W;
2635
+ const _ = en.toRadiansInverse(u.rotation), R = u.getRotationAnchor(), F = V - R.x, ie = ee - R.y, ne = Math.cos(_), Ce = Math.sin(_), Ne = F * ne - ie * Ce, tt = F * Ce + ie * ne, bt = Ne, Ot = tt, Et = 44 / W;
2636
2636
  if (E.start && Math.sqrt(
2637
- Math.pow(bt - E.start.center.x, 2) + Math.pow(zt - E.start.center.y, 2)
2637
+ Math.pow(bt - E.start.center.x, 2) + Math.pow(Ot - E.start.center.y, 2)
2638
2638
  ) <= Et) {
2639
- O.preventDefault(), d.current = "start", (ge = n.current) == null || ge.focus();
2639
+ z.preventDefault(), d.current = "start", (ge = n.current) == null || ge.focus();
2640
2640
  return;
2641
2641
  }
2642
2642
  if (E.end && Math.sqrt(
2643
- Math.pow(bt - E.end.center.x, 2) + Math.pow(zt - E.end.center.y, 2)
2643
+ Math.pow(bt - E.end.center.x, 2) + Math.pow(Ot - E.end.center.y, 2)
2644
2644
  ) <= Et) {
2645
- O.preventDefault(), d.current = "end", (xe = n.current) == null || xe.focus();
2645
+ z.preventDefault(), d.current = "end", (xe = n.current) == null || xe.focus();
2646
2646
  return;
2647
2647
  }
2648
2648
  }
2649
2649
  }
2650
2650
  if (u.hitTest(V, ee)) {
2651
- O.preventDefault(), s.current = !0;
2652
- const E = u.getVisualBoundingBox(), _ = en.toRadiansInverse(u.rotation), R = u.getRotationAnchor(), F = V - R.x, ie = ee - R.y, ne = Math.cos(_), Ce = Math.sin(_), Ne = F * ne - ie * Ce, tt = F * Ce + ie * ne, bt = Ne + E.width / 2, zt = tt + E.height / 2, Et = Rn(u, { x: bt, y: zt }), kt = Date.now();
2651
+ z.preventDefault(), s.current = !0;
2652
+ const E = u.getVisualBoundingBox(), _ = en.toRadiansInverse(u.rotation), R = u.getRotationAnchor(), F = V - R.x, ie = ee - R.y, ne = Math.cos(_), Ce = Math.sin(_), Ne = F * ne - ie * Ce, tt = F * Ce + ie * ne, bt = Ne + E.width / 2, Ot = tt + E.height / 2, Et = Rn(u, { x: bt, y: Ot }), kt = Date.now();
2653
2653
  if (kt - a.current < I) {
2654
2654
  (J = n.current) == null || J.focus();
2655
2655
  return;
2656
2656
  }
2657
- a.current = kt, kt - l.current >= T && (c.current = null), kt - o.current < A ? i.current += 1 : i.current = 1, o.current = kt;
2657
+ a.current = kt, kt - l.current >= M && (c.current = null), kt - o.current < A ? i.current += 1 : i.current = 1, o.current = kt;
2658
2658
  const ut = P;
2659
2659
  if (i.current >= 3)
2660
- O.preventDefault(), l.current = kt, c.current = { start: 0, end: ut.length, cursor: ut.length }, f.current = !0, i.current = 0, Me(ut.length), Be(0), De(ut.length), n.current && (n.current.focus(), n.current.setSelectionRange(0, ut.length));
2660
+ z.preventDefault(), l.current = kt, c.current = { start: 0, end: ut.length, cursor: ut.length }, f.current = !0, i.current = 0, Te(ut.length), Be(0), De(ut.length), n.current && (n.current.focus(), n.current.setSelectionRange(0, ut.length));
2661
2661
  else if (i.current === 2) {
2662
- O.preventDefault(), l.current = kt, f.current = !0;
2662
+ z.preventDefault(), l.current = kt, f.current = !0;
2663
2663
  const Rt = br(ut, Et);
2664
- c.current = { start: Rt.start, end: Rt.end, cursor: Rt.end }, Me(Rt.end), Be(Rt.start), De(Rt.end), n.current && (n.current.focus(), n.current.setSelectionRange(Rt.start, Rt.end));
2664
+ c.current = { start: Rt.start, end: Rt.end, cursor: Rt.end }, Te(Rt.end), Be(Rt.start), De(Rt.end), n.current && (n.current.focus(), n.current.setSelectionRange(Rt.start, Rt.end));
2665
2665
  } else
2666
- c.current = null, Me(Et), Be(Et), De(Et), n.current && (n.current.focus(), n.current.setSelectionRange(Et, Et)), f.current = !1;
2666
+ c.current = null, Te(Et), Be(Et), De(Et), n.current && (n.current.focus(), n.current.setSelectionRange(Et, Et)), f.current = !1;
2667
2667
  return;
2668
2668
  }
2669
2669
  c.current = null, (Z = n.current) == null || Z.blur();
2670
2670
  return;
2671
2671
  }
2672
2672
  if (g) return;
2673
- if (O.target.setPointerCapture(O.pointerId), $.isActive() && u instanceof kn) {
2673
+ if (z.target.setPointerCapture(z.pointerId), $.isActive() && u instanceof kn) {
2674
2674
  const E = V - u.x, _ = ee - u.y;
2675
2675
  if ($.canClosePath(E, _, 15)) {
2676
2676
  $.startClosing(E, _), $.startDraggingHandle(), Ve((R) => R + 1);
@@ -2729,7 +2729,7 @@ function Bi(e) {
2729
2729
  if (E) {
2730
2730
  const R = Ri({ x: V, y: ee, cropContext: E, transformHandles: U, zoom: W });
2731
2731
  if (R.type === "crop-handle") {
2732
- Mi({
2732
+ Ti({
2733
2733
  cropContext: E,
2734
2734
  cropHandle: R.handle,
2735
2735
  x: V,
@@ -2740,7 +2740,7 @@ function Bi(e) {
2740
2740
  }), re({});
2741
2741
  return;
2742
2742
  } else if (R.type === "image-handle") {
2743
- Ti({
2743
+ Mi({
2744
2744
  cropContext: E,
2745
2745
  imageHandle: R.handle,
2746
2746
  x: V,
@@ -2780,14 +2780,14 @@ function Bi(e) {
2780
2780
  We(!0), at(ie), pt(B.rotation), h.startRotate(B, V, ee, ie, B.rotation), Q && u instanceof Re && (h._activeChildContext = {
2781
2781
  group: u,
2782
2782
  childId: Q.id
2783
- }), be.current = B.id, ze.current = { x: V, y: ee }, re({});
2783
+ }), be.current = B.id, Oe.current = { x: V, y: ee }, re({});
2784
2784
  return;
2785
2785
  }
2786
2786
  const _ = U.hitTestResize(V, ee, W);
2787
2787
  if (_) {
2788
2788
  if (B.locked) return;
2789
2789
  const R = B.getBoundingBox(), F = B.getVisualBoundingBox();
2790
- h.startResize(B, _, V, ee, R, F), be.current = B.id, ze.current = { x: V, y: ee }, Q && u instanceof Re && (h._activeChildContext = {
2790
+ h.startResize(B, _, V, ee, R, F), be.current = B.id, Oe.current = { x: V, y: ee }, Q && u instanceof Re && (h._activeChildContext = {
2791
2791
  group: u,
2792
2792
  childId: Q.id
2793
2793
  }), re({});
@@ -2799,7 +2799,7 @@ function Bi(e) {
2799
2799
  const R = u.hitTestChild(V, ee);
2800
2800
  R && (h._pendingChildSelection = R);
2801
2801
  }
2802
- u && B.id === u.id && !(B instanceof Qe) && (be.current = B.id, ze.current = { x: V, y: ee }), B instanceof Qe && !(B instanceof Re) && u && B.id === u.id && !g && (h._pendingTextEditMode = {
2802
+ u && B.id === u.id && !(B instanceof Qe) && (be.current = B.id, Oe.current = { x: V, y: ee }), B instanceof Qe && !(B instanceof Re) && u && B.id === u.id && !g && (h._pendingTextEditMode = {
2803
2803
  elementId: B.id,
2804
2804
  originalX: B.x,
2805
2805
  originalY: B.y,
@@ -2834,7 +2834,7 @@ function Bi(e) {
2834
2834
  Js({ updateActiveChild: Je, selectedElement: u || null, transformHandles: U, setHandlesVersion: Ve, zoom: W });
2835
2835
  return;
2836
2836
  }
2837
- if (!O.shiftKey) {
2837
+ if (!z.shiftKey) {
2838
2838
  const E = xt(), _ = [];
2839
2839
  for (let F = E.length - 1; F >= 0; F--) {
2840
2840
  const ie = E[F];
@@ -2851,70 +2851,70 @@ function Bi(e) {
2851
2851
  elementId: _[0].id,
2852
2852
  x: V,
2853
2853
  y: ee,
2854
- shiftKey: O.shiftKey
2854
+ shiftKey: z.shiftKey
2855
2855
  } : F + 1 < _.length ? R = {
2856
2856
  kind: "select-element",
2857
2857
  elementId: _[F + 1].id,
2858
2858
  x: V,
2859
2859
  y: ee,
2860
- shiftKey: O.shiftKey
2860
+ shiftKey: z.shiftKey
2861
2861
  } : R = { kind: "deselect" };
2862
2862
  }
2863
- Le.current = {
2864
- pointerId: O.pointerId,
2865
- startClientX: O.clientX,
2866
- startClientY: O.clientY,
2863
+ Ye.current = {
2864
+ pointerId: z.pointerId,
2865
+ startClientX: z.clientX,
2866
+ startClientY: z.clientY,
2867
2867
  startPanOffset: { ...fe.current },
2868
2868
  movedPastThreshold: !1,
2869
2869
  pendingTap: R
2870
2870
  };
2871
2871
  try {
2872
- he.setPointerCapture(O.pointerId);
2872
+ he.setPointerCapture(z.pointerId);
2873
2873
  } catch {
2874
2874
  }
2875
- O.preventDefault();
2875
+ z.preventDefault();
2876
2876
  return;
2877
2877
  }
2878
2878
  const me = xt();
2879
2879
  if (Di({
2880
2880
  x: V,
2881
2881
  y: ee,
2882
- shiftKey: O.shiftKey,
2882
+ shiftKey: z.shiftKey,
2883
2883
  activeArtboardElements: me,
2884
2884
  selectedElement: u || null,
2885
2885
  multiSelection: te,
2886
- onSelectionChange: Ye,
2887
- onMultiSelectionChange: L,
2886
+ onSelectionChange: Le,
2887
+ onMultiSelectionChange: Y,
2888
2888
  stateMachine: h,
2889
2889
  dragOriginalElementsRef: C,
2890
2890
  setHoverState: ke,
2891
2891
  forceUpdate: re
2892
2892
  })) return;
2893
- const q = Hr.shouldProtectClick(), M = Xr(O.target);
2894
- if (!q && !M)
2893
+ const q = Hr.shouldProtectClick(), T = Xr(z.target);
2894
+ if (!q && !T)
2895
2895
  if (St.current > 1.001) {
2896
- Le.current = {
2897
- pointerId: O.pointerId,
2898
- startClientX: O.clientX,
2899
- startClientY: O.clientY,
2896
+ Ye.current = {
2897
+ pointerId: z.pointerId,
2898
+ startClientX: z.clientX,
2899
+ startClientY: z.clientY,
2900
2900
  startPanOffset: { ...fe.current },
2901
2901
  movedPastThreshold: !1,
2902
2902
  pendingTap: null
2903
2903
  };
2904
2904
  try {
2905
- he.setPointerCapture(O.pointerId);
2905
+ he.setPointerCapture(z.pointerId);
2906
2906
  } catch {
2907
2907
  }
2908
- O.preventDefault();
2908
+ z.preventDefault();
2909
2909
  } else
2910
- Ye(null), L([]), Nt(V, ee);
2910
+ Le(null), Y([]), Nt(V, ee);
2911
2911
  },
2912
2912
  [
2913
2913
  g,
2914
2914
  u,
2915
2915
  xt,
2916
- Ye,
2917
- L,
2916
+ Le,
2917
+ Y,
2918
2918
  U,
2919
2919
  Q,
2920
2920
  te,
@@ -2923,7 +2923,7 @@ function Bi(e) {
2923
2923
  Ke,
2924
2924
  Ve,
2925
2925
  W,
2926
- Me,
2926
+ Te,
2927
2927
  Be,
2928
2928
  De,
2929
2929
  // Canvas-zoom pinch entry uses these setters / refs.
@@ -2932,31 +2932,31 @@ function Bi(e) {
2932
2932
  Ee
2933
2933
  ]
2934
2934
  ), yn = ft(
2935
- (O) => {
2935
+ (z) => {
2936
2936
  var et;
2937
- if (O.buttons === 2) return;
2937
+ if (z.buttons === 2) return;
2938
2938
  const he = t.current;
2939
2939
  if (!he) return;
2940
- const dt = Ge.current ?? he.getBoundingClientRect(), V = (O.clientX - dt.left) / W - pe, ee = (O.clientY - dt.top) / W - ae;
2941
- if (p.current = { x: V, y: ee }, Pe.current.has(O.pointerId) && Pe.current.set(O.pointerId, {
2940
+ const dt = Ge.current ?? he.getBoundingClientRect(), V = (z.clientX - dt.left) / W - pe, ee = (z.clientY - dt.top) / W - ae;
2941
+ if (p.current = { x: V, y: ee }, Pe.current.has(z.pointerId) && Pe.current.set(z.pointerId, {
2942
2942
  x: V,
2943
2943
  y: ee,
2944
- clientX: O.clientX,
2945
- clientY: O.clientY
2944
+ clientX: z.clientX,
2945
+ clientY: z.clientY
2946
2946
  }), _e.current) {
2947
- const B = _e.current, me = Pe.current.get(B.pointerA), Y = Pe.current.get(B.pointerB);
2948
- if (me && Y) {
2949
- const q = Y.clientX - me.clientX, M = Y.clientY - me.clientY, ge = Math.hypot(q, M) / B.startDistance, xe = Math.min(
2947
+ const B = _e.current, me = Pe.current.get(B.pointerA), L = Pe.current.get(B.pointerB);
2948
+ if (me && L) {
2949
+ const q = L.clientX - me.clientX, T = L.clientY - me.clientY, ge = Math.hypot(q, T) / B.startDistance, xe = Math.min(
2950
2950
  Math.max(B.startUserZoom * ge, 0.25),
2951
2951
  8
2952
- ), J = B.startCentroidClient.x - B.containerRect.left, Z = B.startCentroidClient.y - B.containerRect.top, E = (me.clientX + Y.clientX) / 2 - B.containerRect.left, _ = (me.clientY + Y.clientY) / 2 - B.containerRect.top, R = xe / B.startUserZoom, F = E - (J - B.startPanOffset.x) * R, ie = _ - (Z - B.startPanOffset.y) * R, ne = t.current;
2952
+ ), J = B.startCentroidClient.x - B.containerRect.left, Z = B.startCentroidClient.y - B.containerRect.top, E = (me.clientX + L.clientX) / 2 - B.containerRect.left, _ = (me.clientY + L.clientY) / 2 - B.containerRect.top, R = xe / B.startUserZoom, F = E - (J - B.startPanOffset.x) * R, ie = _ - (Z - B.startPanOffset.y) * R, ne = t.current;
2953
2953
  if (ne) {
2954
- const Ce = ne.getBoundingClientRect(), Ne = (et = ne.parentElement) == null ? void 0 : et.parentElement, tt = (Ne == null ? void 0 : Ne.clientWidth) ?? Ce.width, bt = (Ne == null ? void 0 : Ne.clientHeight) ?? Ce.height, zt = 80, Et = xe / Math.max(St.current, 1e-4), kt = Ce.width * Et, Gt = Ce.height * Et, ut = fe.current.x, Rt = fe.current.y, Mn = Ce.left - B.containerRect.left, Ft = Ce.top - B.containerRect.top, qt = Mn + (F - ut), jt = Ft + (ie - Rt), _t = Math.min(
2955
- Math.max(qt, -kt + zt),
2956
- tt - zt
2954
+ const Ce = ne.getBoundingClientRect(), Ne = (et = ne.parentElement) == null ? void 0 : et.parentElement, tt = (Ne == null ? void 0 : Ne.clientWidth) ?? Ce.width, bt = (Ne == null ? void 0 : Ne.clientHeight) ?? Ce.height, Ot = 80, Et = xe / Math.max(St.current, 1e-4), kt = Ce.width * Et, Gt = Ce.height * Et, ut = fe.current.x, Rt = fe.current.y, Tn = Ce.left - B.containerRect.left, Ft = Ce.top - B.containerRect.top, qt = Tn + (F - ut), jt = Ft + (ie - Rt), _t = Math.min(
2955
+ Math.max(qt, -kt + Ot),
2956
+ tt - Ot
2957
2957
  ), $t = Math.min(
2958
- Math.max(jt, -Gt + zt),
2959
- bt - zt
2958
+ Math.max(jt, -Gt + Ot),
2959
+ bt - Ot
2960
2960
  );
2961
2961
  yt(xe), it({
2962
2962
  x: F + (_t - qt),
@@ -2967,31 +2967,31 @@ function Bi(e) {
2967
2967
  }
2968
2968
  return;
2969
2969
  }
2970
- if (Le.current && Le.current.pointerId === O.pointerId) {
2971
- const B = Le.current, me = O.clientX - B.startClientX, Y = O.clientY - B.startClientY;
2970
+ if (Ye.current && Ye.current.pointerId === z.pointerId) {
2971
+ const B = Ye.current, me = z.clientX - B.startClientX, L = z.clientY - B.startClientY;
2972
2972
  if (!B.movedPastThreshold)
2973
- if (Math.hypot(me, Y) > 5)
2973
+ if (Math.hypot(me, L) > 5)
2974
2974
  B.movedPastThreshold = !0, B.pendingTap = null;
2975
2975
  else
2976
2976
  return;
2977
2977
  if (St.current <= 1.001) return;
2978
2978
  it({
2979
2979
  x: B.startPanOffset.x + me,
2980
- y: B.startPanOffset.y + Y
2980
+ y: B.startPanOffset.y + L
2981
2981
  });
2982
2982
  return;
2983
2983
  }
2984
2984
  if (h.getMode() === "pinch" && qe.current) {
2985
- const { a: B, b: me } = qe.current, Y = Pe.current.get(B), q = Pe.current.get(me);
2986
- if (Y && q) {
2987
- const M = h.updatePinch(Y, q), { element: j, startData: ge } = h.getPinchContext();
2985
+ const { a: B, b: me } = qe.current, L = Pe.current.get(B), q = Pe.current.get(me);
2986
+ if (L && q) {
2987
+ const T = h.updatePinch(L, q), { element: j, startData: ge } = h.getPinchContext();
2988
2988
  vi.calculatePinch({
2989
2989
  element: j,
2990
2990
  startData: ge,
2991
- scale: M.scale,
2992
- rotationDelta: M.rotationDelta,
2993
- startCentroid: M.startCentroid,
2994
- currentCentroid: M.currentCentroid,
2991
+ scale: T.scale,
2992
+ rotationDelta: T.rotationDelta,
2993
+ startCentroid: T.startCentroid,
2994
+ currentCentroid: T.currentCentroid,
2995
2995
  snapRotation: oe ? (xe, J) => oe.snapRotation(xe, J) : void 0
2996
2996
  }), lt(
2997
2997
  (xe) => xe.map(
@@ -2999,15 +2999,15 @@ function Bi(e) {
2999
2999
  )
3000
3000
  );
3001
3001
  }
3002
- O.preventDefault();
3002
+ z.preventDefault();
3003
3003
  return;
3004
3004
  }
3005
3005
  if (d.current && u instanceof Qe) {
3006
- const B = u.getVisualBoundingBox(), me = u.getRotationAnchor(), Y = en.toRadiansInverse(u.rotation), q = V - me.x, M = ee - me.y, j = Math.cos(Y), ge = Math.sin(Y), xe = q * j - M * ge, J = q * ge + M * j, Z = m.current;
3006
+ const B = u.getVisualBoundingBox(), me = u.getRotationAnchor(), L = en.toRadiansInverse(u.rotation), q = V - me.x, T = ee - me.y, j = Math.cos(L), ge = Math.sin(L), xe = q * j - T * ge, J = q * ge + T * j, Z = m.current;
3007
3007
  let E = 0;
3008
3008
  d.current === "start" && (Z != null && Z.start) ? E = Z.start.textEdge.y - Z.start.center.y : d.current === "end" && (Z != null && Z.end) && (E = Z.end.textEdge.y - Z.end.center.y);
3009
3009
  const _ = xe + B.width / 2, R = J + E + B.height / 2, F = Rn(u, { x: _, y: R });
3010
- if (d.current === "start" ? F <= v ? (Be(F), Me(F)) : (Be(v), De(F), Me(F), d.current = "end") : F >= D ? (De(F), Me(F)) : (De(D), Be(F), Me(F), d.current = "start"), n.current) {
3010
+ if (d.current === "start" ? F <= v ? (Be(F), Te(F)) : (Be(v), De(F), Te(F), d.current = "end") : F >= D ? (De(F), Te(F)) : (De(D), Be(F), Te(F), d.current = "start"), n.current) {
3011
3011
  const ie = Math.min(D, v), ne = Math.max(D, v);
3012
3012
  n.current.setSelectionRange(ie, ne);
3013
3013
  }
@@ -3017,31 +3017,31 @@ function Bi(e) {
3017
3017
  $.isDraggingHandle() ? ($.updateHandle(V - u.x, ee - u.y), Ve((B) => B + 1)) : ($.setPreviewPoint(V - u.x, ee - u.y), Ve((B) => B + 1));
3018
3018
  return;
3019
3019
  }
3020
- if (O.altKey !== N && At(O.altKey), K) {
3020
+ if (z.altKey !== N && At(z.altKey), K) {
3021
3021
  Bt(V, ee, G);
3022
3022
  return;
3023
3023
  }
3024
3024
  if (h.getMode() === "drag") {
3025
3025
  const B = h._multiSelectionDragContext;
3026
3026
  if (B && te.length > 0) {
3027
- const { dx: me, dy: Y } = Ks(
3027
+ const { dx: me, dy: L } = Ks(
3028
3028
  V - B.startX,
3029
3029
  ee - B.startY,
3030
- { shift: O.shiftKey }
3030
+ { shift: z.shiftKey }
3031
3031
  );
3032
3032
  B.currentElements || (B.currentElements = /* @__PURE__ */ new Map());
3033
3033
  const q = [];
3034
- B.elementsStartData.forEach((M) => {
3035
- const j = M.element, ge = M.startData, xe = j.clone();
3036
- xe.x = ge.x + me, xe.y = ge.y + Y, B.currentElements.set(xe.id, xe), q.push(xe);
3037
- }), lt((M) => M.map((j) => q.find((ge) => ge.id === j.id) || j)), B.currentDelta = { dx: me, dy: Y }, !B.startOBB && ce.current && (B.startOBB = { ...ce.current }), Ve((M) => M + 1), re({});
3034
+ B.elementsStartData.forEach((T) => {
3035
+ const j = T.element, ge = T.startData, xe = j.clone();
3036
+ xe.x = ge.x + me, xe.y = ge.y + L, B.currentElements.set(xe.id, xe), q.push(xe);
3037
+ }), lt((T) => T.map((j) => q.find((ge) => ge.id === j.id) || j)), B.currentDelta = { dx: me, dy: L }, !B.startOBB && ce.current && (B.startOBB = { ...ce.current }), Ve((T) => T + 1), re({});
3038
3038
  return;
3039
3039
  }
3040
3040
  }
3041
3041
  if (h.getMode() === "drag" && u) {
3042
3042
  if (h.getDragMode() === "crop-image-drag") {
3043
3043
  const J = h.getContext(), Z = J.element;
3044
- if (Z instanceof Yt && Z.isCropping) {
3044
+ if (Z instanceof Lt && Z.isCropping) {
3045
3045
  const E = we.handleCropImageDrag(Z, J, V, ee), _ = h._cropGroupContext, R = h._activeChildContext, F = _ || R;
3046
3046
  if (F && u instanceof Re) {
3047
3047
  const ie = Z.clone();
@@ -3061,15 +3061,15 @@ function Bi(e) {
3061
3061
  return;
3062
3062
  }
3063
3063
  }
3064
- const me = h._activeChildContext, Y = xt(), q = [];
3065
- Y.forEach((J) => {
3064
+ const me = h._activeChildContext, L = xt(), q = [];
3065
+ L.forEach((J) => {
3066
3066
  J instanceof Re ? q.push(...J.children) : q.push(J);
3067
3067
  });
3068
- const M = { shift: O.shiftKey };
3069
- let j = h.updateDrag(V, ee, q, M);
3068
+ const T = { shift: z.shiftKey };
3069
+ let j = h.updateDrag(V, ee, q, T);
3070
3070
  const ge = me && u instanceof Re ? u.children.find((J) => J.id === me.childId) : u;
3071
- if (ge && (j = ue.snapToSpacing(j, ge, q), M.shift)) {
3072
- const J = h.getContext(), Z = J.startData, { lockedAxis: E } = Ks(V - J.startX, ee - J.startY, M);
3071
+ if (ge && (j = ue.snapToSpacing(j, ge, q), T.shift)) {
3072
+ const J = h.getContext(), Z = J.startData, { lockedAxis: E } = Ks(V - J.startX, ee - J.startY, T);
3073
3073
  E === "x" ? j.x = Z.x : E === "y" && (j.y = Z.y);
3074
3074
  }
3075
3075
  if (me && u instanceof Re) {
@@ -3109,7 +3109,7 @@ function Bi(e) {
3109
3109
  Dt(J);
3110
3110
  }
3111
3111
  } else if (h.getMode() === "resize") {
3112
- const { dx: B, dy: me } = h.updateResize(V, ee), Y = h.getResizeContext(), q = h._multiSelectionResizeContext;
3112
+ const { dx: B, dy: me } = h.updateResize(V, ee), L = h.getResizeContext(), q = h._multiSelectionResizeContext;
3113
3113
  if (q && te.length > 0) {
3114
3114
  const E = q.startBounds, _ = q.anchor;
3115
3115
  let R, F, ie, ne;
@@ -3129,7 +3129,7 @@ function Bi(e) {
3129
3129
  default:
3130
3130
  R = E.minX, F = E.minY, ie = E.maxX, ne = E.maxY;
3131
3131
  }
3132
- const Ce = ie + B, Ne = ne + me, tt = Math.abs(ie - R), bt = Math.abs(ne - F), zt = Math.abs(Ce - R), Et = Math.abs(Ne - F), kt = tt > 0 ? zt / tt : 1, Gt = bt > 0 ? Et / bt : 1, ut = (kt + Gt) / 2, Rt = E.maxX - E.minX, Mn = E.maxY - E.minY, Ft = Rt * ut, qt = Mn * ut;
3132
+ const Ce = ie + B, Ne = ne + me, tt = Math.abs(ie - R), bt = Math.abs(ne - F), Ot = Math.abs(Ce - R), Et = Math.abs(Ne - F), kt = tt > 0 ? Ot / tt : 1, Gt = bt > 0 ? Et / bt : 1, ut = (kt + Gt) / 2, Rt = E.maxX - E.minX, Tn = E.maxY - E.minY, Ft = Rt * ut, qt = Tn * ut;
3133
3133
  let jt = R, _t = F, $t = R, cn = F;
3134
3134
  switch (_) {
3135
3135
  case "top-left":
@@ -3147,17 +3147,17 @@ function Bi(e) {
3147
3147
  }
3148
3148
  if (q.elementsStartData.forEach((Hn) => {
3149
3149
  const Un = Hn.element, sn = Hn.startData, ls = sn.x - R, ds = sn.y - F, Gn = R + ls * ut, qn = F + ds * ut, Wt = Un.clone();
3150
- if (Wt instanceof Yt) {
3150
+ if (Wt instanceof Lt) {
3151
3151
  Wt.x = Gn, Wt.y = qn;
3152
- const Tn = Wt.transformData, Cn = sn.transformData;
3153
- Tn.width = Cn.width * ut, Tn.height = Cn.height * ut;
3152
+ const Mn = Wt.transformData, Cn = sn.transformData;
3153
+ Mn.width = Cn.width * ut, Mn.height = Cn.height * ut;
3154
3154
  } else if (Wt instanceof Re) {
3155
3155
  Wt.x = Gn, Wt.y = qn;
3156
- const Tn = sn.width * ut, Cn = sn.height * ut;
3157
- Wt.resize(_, Tn, Cn, sn);
3156
+ const Mn = sn.width * ut, Cn = sn.height * ut;
3157
+ Wt.resize(_, Mn, Cn, sn);
3158
3158
  } else {
3159
- const Tn = sn.width * ut, Cn = sn.height * ut;
3160
- Wt.resize(_, Tn, Cn, sn), Wt.x = Gn, Wt.y = qn;
3159
+ const Mn = sn.width * ut, Cn = sn.height * ut;
3160
+ Wt.resize(_, Mn, Cn, sn), Wt.x = Gn, Wt.y = qn;
3161
3161
  }
3162
3162
  Ie(Wt);
3163
3163
  }), ce.current) {
@@ -3172,18 +3172,18 @@ function Bi(e) {
3172
3172
  }
3173
3173
  return;
3174
3174
  }
3175
- const M = Y.element;
3176
- if (M instanceof Yt && M.isCropping && Y.handle.anchor && Y.handle.anchor.startsWith("crop-")) {
3177
- const E = Y.handle.anchor.replace("crop-", ""), _ = h.getContext(), R = we.handleCropBoxResize(M, E, Y, _, V, ee);
3175
+ const T = L.element;
3176
+ if (T instanceof Lt && T.isCropping && L.handle.anchor && L.handle.anchor.startsWith("crop-")) {
3177
+ const E = L.handle.anchor.replace("crop-", ""), _ = h.getContext(), R = we.handleCropBoxResize(T, E, L, _, V, ee);
3178
3178
  he.style.cursor = R.cursor;
3179
3179
  const F = h._cropGroupContext, ie = h._activeChildContext, ne = F || ie;
3180
3180
  if (ne && u instanceof Re) {
3181
- const Ce = M.clone();
3181
+ const Ce = T.clone();
3182
3182
  Ce.x = R.x, Ce.y = R.y, Ce.rotation = R.rotation, Ce.transformData.width = R.width, Ce.transformData.height = R.height, Ce.updateCrop(R.cropX, R.cropY, R.cropWidth, R.cropHeight, !1);
3183
3183
  const Ne = u.clone(), tt = F ? F.childIndex : Ne.children.findIndex((bt) => bt.id === ne.childId);
3184
3184
  tt >= 0 && (Ne.children[tt] = Ce, Ne.updateBoundsFromChildren(!0)), Ie(Ne), ie && tt >= 0 && Je(Ne.children[tt]);
3185
3185
  } else {
3186
- const Ce = M.clone();
3186
+ const Ce = T.clone();
3187
3187
  Ce.x = R.x, Ce.y = R.y, Ce.rotation = R.rotation, Ce.transformData.width = R.width, Ce.transformData.height = R.height, Ce.updateCrop(R.cropX, R.cropY, R.cropWidth, R.cropHeight, !1), Ie(Ce);
3188
3188
  }
3189
3189
  return;
@@ -3194,15 +3194,15 @@ function Bi(e) {
3194
3194
  E instanceof Re ? xe.push(...E.children) : xe.push(E);
3195
3195
  });
3196
3196
  let Z = gs.executeResize({
3197
- element: Y.element,
3198
- handle: Y.handle,
3197
+ element: L.element,
3198
+ handle: L.handle,
3199
3199
  dx: B,
3200
3200
  dy: me,
3201
- startData: Y.startData,
3201
+ startData: L.startData,
3202
3202
  allElements: xe,
3203
3203
  snapSystem: oe,
3204
3204
  // Read per move event: Shift = aspect-lock to gesture-start ratio
3205
- modifiers: { shift: O.shiftKey }
3205
+ modifiers: { shift: z.shiftKey }
3206
3206
  }).element;
3207
3207
  if (h.updateResizeElement(Z), ge) {
3208
3208
  const E = u.clone(), _ = E.children.findIndex((R) => R.id === j.childId);
@@ -3214,7 +3214,7 @@ function Bi(e) {
3214
3214
  he.style.cursor = "grabbing", se || (We(!0), X == null || X(!0));
3215
3215
  const B = h._multiSelectionRotationContext;
3216
3216
  if (B && te.length > 0) {
3217
- const Z = B.startBounds, E = h.updateRotate(V, ee, Z.centerX, Z.centerY, { shift: O.shiftKey });
3217
+ const Z = B.startBounds, E = h.updateRotate(V, ee, Z.centerX, Z.centerY, { shift: z.shiftKey });
3218
3218
  pt(E), B.elementsStartData.forEach((_) => {
3219
3219
  const R = _.element, F = _.startData, ie = ms.rotatePointAroundAnchor(
3220
3220
  F.x,
@@ -3227,9 +3227,9 @@ function Bi(e) {
3227
3227
  });
3228
3228
  return;
3229
3229
  }
3230
- const me = h._activeChildContext, Y = me ? Q : u;
3231
- if (!Y) return;
3232
- const q = Y.getBoundingBox(), M = ks(q), j = M.x, ge = M.y, xe = h.updateRotate(V, ee, M.x, M.y, { shift: O.shiftKey }), J = Y.clone();
3230
+ const me = h._activeChildContext, L = me ? Q : u;
3231
+ if (!L) return;
3232
+ const q = L.getBoundingBox(), T = ks(q), j = T.x, ge = T.y, xe = h.updateRotate(V, ee, T.x, T.y, { shift: z.shiftKey }), J = L.clone();
3233
3233
  if (J.setRotation(xe), !(J instanceof Re)) {
3234
3234
  const Z = J.getBoundingBox(), E = ks(Z), _ = j - E.x, R = ge - E.y;
3235
3235
  J.x += _, J.y += R;
@@ -3242,17 +3242,17 @@ function Bi(e) {
3242
3242
  Ve((Z) => Z + 1);
3243
3243
  } else {
3244
3244
  if (te.length > 0 && S.current) {
3245
- const M = S.current, j = 16 / W, ge = [
3246
- { x: M.minX, y: M.minY, anchor: "top-left", cursor: "nwse-resize" },
3247
- { x: M.maxX, y: M.minY, anchor: "top-right", cursor: "nesw-resize" },
3248
- { x: M.minX, y: M.maxY, anchor: "bottom-left", cursor: "nesw-resize" },
3249
- { x: M.maxX, y: M.maxY, anchor: "bottom-right", cursor: "nwse-resize" }
3250
- ], xe = M.rotation || 0, J = ge.map((F) => {
3245
+ const T = S.current, j = 16 / W, ge = [
3246
+ { x: T.minX, y: T.minY, anchor: "top-left", cursor: "nwse-resize" },
3247
+ { x: T.maxX, y: T.minY, anchor: "top-right", cursor: "nesw-resize" },
3248
+ { x: T.minX, y: T.maxY, anchor: "bottom-left", cursor: "nesw-resize" },
3249
+ { x: T.maxX, y: T.maxY, anchor: "bottom-right", cursor: "nwse-resize" }
3250
+ ], xe = T.rotation || 0, J = ge.map((F) => {
3251
3251
  if (xe !== 0) {
3252
- const ie = -xe * Math.PI / 180, ne = Math.cos(ie), Ce = Math.sin(ie), Ne = F.x - M.centerX, tt = F.y - M.centerY;
3252
+ const ie = -xe * Math.PI / 180, ne = Math.cos(ie), Ce = Math.sin(ie), Ne = F.x - T.centerX, tt = F.y - T.centerY;
3253
3253
  return {
3254
- x: M.centerX + (Ne * ne - tt * Ce),
3255
- y: M.centerY + (Ne * Ce + tt * ne),
3254
+ x: T.centerX + (Ne * ne - tt * Ce),
3255
+ y: T.centerY + (Ne * Ce + tt * ne),
3256
3256
  anchor: F.anchor,
3257
3257
  cursor: F.cursor
3258
3258
  };
@@ -3268,23 +3268,23 @@ function Bi(e) {
3268
3268
  }
3269
3269
  const Z = 18 / W;
3270
3270
  if (Math.sqrt(
3271
- Math.pow(V - M.rotationHandleX, 2) + Math.pow(ee - M.rotationHandleY, 2)
3271
+ Math.pow(V - T.rotationHandleX, 2) + Math.pow(ee - T.rotationHandleY, 2)
3272
3272
  ) <= Z) {
3273
3273
  he.style.cursor = "grab", ke({ type: "multi-selection-rotation-handle", data: null });
3274
3274
  return;
3275
3275
  }
3276
3276
  let _ = V, R = ee;
3277
3277
  if (xe !== 0) {
3278
- const F = xe * Math.PI / 180, ie = Math.cos(F), ne = Math.sin(F), Ce = V - M.centerX, Ne = ee - M.centerY;
3279
- _ = M.centerX + (Ce * ie - Ne * ne), R = M.centerY + (Ce * ne + Ne * ie);
3278
+ const F = xe * Math.PI / 180, ie = Math.cos(F), ne = Math.sin(F), Ce = V - T.centerX, Ne = ee - T.centerY;
3279
+ _ = T.centerX + (Ce * ie - Ne * ne), R = T.centerY + (Ce * ne + Ne * ie);
3280
3280
  }
3281
- if (_ >= M.minX && _ <= M.maxX && R >= M.minY && R <= M.maxY) {
3282
- he.style.cursor = "move", ke({ type: "multi-selection-bounds", data: M });
3281
+ if (_ >= T.minX && _ <= T.maxX && R >= T.minY && R <= T.maxY) {
3282
+ he.style.cursor = "move", ke({ type: "multi-selection-bounds", data: T });
3283
3283
  return;
3284
3284
  }
3285
3285
  }
3286
- if (O.altKey) {
3287
- let M = null;
3286
+ if (z.altKey) {
3287
+ let T = null;
3288
3288
  const j = xt();
3289
3289
  for (let ge = j.length - 1; ge >= 0; ge--) {
3290
3290
  const xe = j[ge];
@@ -3295,26 +3295,26 @@ function Bi(e) {
3295
3295
  if (Z.visible === !1) continue;
3296
3296
  const E = Z.getVisualBoundingBox();
3297
3297
  if (V >= E.x && V <= E.x + E.width && ee >= E.y && ee <= E.y + E.height) {
3298
- M = Z;
3298
+ T = Z;
3299
3299
  break;
3300
3300
  }
3301
3301
  }
3302
3302
  else {
3303
3303
  const J = xe.getVisualBoundingBox();
3304
3304
  if (V >= J.x && V <= J.x + J.width && ee >= J.y && ee <= J.y + J.height) {
3305
- M = xe;
3305
+ T = xe;
3306
3306
  break;
3307
3307
  }
3308
3308
  }
3309
- if (M) break;
3309
+ if (T) break;
3310
3310
  }
3311
3311
  }
3312
- if (M) {
3312
+ if (T) {
3313
3313
  const ge = [];
3314
3314
  j.forEach((J) => {
3315
3315
  J instanceof Re ? ge.push(...J.children) : ge.push(J);
3316
3316
  });
3317
- const xe = ue.detectSpacing(M, ge, !0);
3317
+ const xe = ue.detectSpacing(T, ge, !0);
3318
3318
  Dt(xe);
3319
3319
  } else
3320
3320
  Dt([]);
@@ -3322,19 +3322,19 @@ function Bi(e) {
3322
3322
  ve.length > 0 && Dt([]);
3323
3323
  const B = Q || u;
3324
3324
  if (B && B.visible !== !1)
3325
- if (B instanceof Yt && B.isCropping) {
3326
- const M = B.hitTestCropHandle(V, ee, W);
3327
- if (M) {
3325
+ if (B instanceof Lt && B.isCropping) {
3326
+ const T = B.hitTestCropHandle(V, ee, W);
3327
+ if (T) {
3328
3328
  const ge = ro(
3329
- M.worldX,
3330
- M.worldY,
3329
+ T.worldX,
3330
+ T.worldY,
3331
3331
  B.x,
3332
3332
  B.y,
3333
- M.type,
3333
+ T.type,
3334
3334
  B.rotation,
3335
- M.anchor
3335
+ T.anchor
3336
3336
  );
3337
- he.style.cursor = ge, ke({ type: "crop-handle", data: M });
3337
+ he.style.cursor = ge, ke({ type: "crop-handle", data: T });
3338
3338
  return;
3339
3339
  }
3340
3340
  const j = U.hitTestResize(V, ee, W);
@@ -3351,9 +3351,9 @@ function Bi(e) {
3351
3351
  he.style.cursor = "grab", ke({ type: "rotation-handle", data: null });
3352
3352
  return;
3353
3353
  }
3354
- const M = U.hitTestResize(V, ee, W);
3355
- if (M) {
3356
- he.style.cursor = M.cursor, ke({ type: "resize-handle", data: M });
3354
+ const T = U.hitTestResize(V, ee, W);
3355
+ if (T) {
3356
+ he.style.cursor = T.cursor, ke({ type: "resize-handle", data: T });
3357
3357
  return;
3358
3358
  }
3359
3359
  if (B.hitTest(V, ee)) {
@@ -3362,17 +3362,17 @@ function Bi(e) {
3362
3362
  }
3363
3363
  }
3364
3364
  if (Q && u instanceof Re)
3365
- for (let M = u.children.length - 1; M >= 0; M--) {
3366
- const j = u.children[M];
3365
+ for (let T = u.children.length - 1; T >= 0; T--) {
3366
+ const j = u.children[T];
3367
3367
  if (!(j.visible === !1 || j.id === Q.id) && j.hitTest(V, ee)) {
3368
3368
  he.style.cursor = "pointer", ke({ type: "group-sibling", data: j });
3369
3369
  return;
3370
3370
  }
3371
3371
  }
3372
- const me = xt(), Y = [];
3373
- for (let M = me.length - 1; M >= 0; M--)
3374
- me[M].visible !== !1 && (me[M].locked || me[M].hitTest(V, ee) && hs(me[M], V, ee, Ee) && Y.push(me[M]));
3375
- const q = xs(Y)[0];
3372
+ const me = xt(), L = [];
3373
+ for (let T = me.length - 1; T >= 0; T--)
3374
+ me[T].visible !== !1 && (me[T].locked || me[T].hitTest(V, ee) && hs(me[T], V, ee, Ee) && L.push(me[T]));
3375
+ const q = xs(L)[0];
3376
3376
  if (q) {
3377
3377
  he.style.cursor = "pointer", ke({ type: "element", data: q });
3378
3378
  return;
@@ -3405,21 +3405,21 @@ function Bi(e) {
3405
3405
  yt,
3406
3406
  it
3407
3407
  ]
3408
- ), bn = ft((O) => {
3408
+ ), bn = ft((z) => {
3409
3409
  var V, ee, et, B, me;
3410
- if (O.button === 2) return;
3411
- if (O.target.releasePointerCapture(O.pointerId), Pe.current.delete(O.pointerId), _e.current && (O.pointerId === _e.current.pointerA || O.pointerId === _e.current.pointerB)) {
3410
+ if (z.button === 2) return;
3411
+ if (z.target.releasePointerCapture(z.pointerId), Pe.current.delete(z.pointerId), _e.current && (z.pointerId === _e.current.pointerA || z.pointerId === _e.current.pointerB)) {
3412
3412
  _e.current = null, Pe.current.clear();
3413
3413
  return;
3414
3414
  }
3415
- if (Le.current && Le.current.pointerId === O.pointerId) {
3416
- const Y = Le.current;
3417
- Le.current = null, Y.movedPastThreshold || (((V = Y.pendingTap) == null ? void 0 : V.kind) === "select-element" ? (Ye(Y.pendingTap.elementId), L([])) : ((ee = Y.pendingTap) == null ? void 0 : ee.kind) === "deselect" && (Ye(null), L([])));
3415
+ if (Ye.current && Ye.current.pointerId === z.pointerId) {
3416
+ const L = Ye.current;
3417
+ Ye.current = null, L.movedPastThreshold || (((V = L.pendingTap) == null ? void 0 : V.kind) === "select-element" ? (Le(L.pendingTap.elementId), Y([])) : ((ee = L.pendingTap) == null ? void 0 : ee.kind) === "deselect" && (Le(null), Y([])));
3418
3418
  return;
3419
3419
  }
3420
3420
  if (h.getMode() === "pinch" && qe.current) {
3421
- const { a: Y, b: q } = qe.current;
3422
- if (O.pointerId === Y || O.pointerId === q) {
3421
+ const { a: L, b: q } = qe.current;
3422
+ if (z.pointerId === L || z.pointerId === q) {
3423
3423
  const j = h.getContext().element, ge = Xe.current ?? void 0;
3424
3424
  j && Ke(
3425
3425
  ge,
@@ -3429,8 +3429,8 @@ function Bi(e) {
3429
3429
  }
3430
3430
  }
3431
3431
  if (d.current && (d.current = null), $.isActive() && $.isDraggingHandle()) {
3432
- const Y = $.isClosingPath();
3433
- if ($.finishDraggingHandle(), Y && u instanceof kn) {
3432
+ const L = $.isClosingPath();
3433
+ if ($.finishDraggingHandle(), L && u instanceof kn) {
3434
3434
  const q = u.clone();
3435
3435
  Ke(u, q);
3436
3436
  }
@@ -3438,85 +3438,85 @@ function Bi(e) {
3438
3438
  return;
3439
3439
  }
3440
3440
  if (K) {
3441
- tn(L);
3441
+ tn(Y);
3442
3442
  return;
3443
3443
  }
3444
- C.current && h.getMode() === "drag" && (C.current.forEach((q, M) => {
3445
- const j = G.find((ge) => ge.id === M);
3444
+ C.current && h.getMode() === "drag" && (C.current.forEach((q, T) => {
3445
+ const j = G.find((ge) => ge.id === T);
3446
3446
  j && (q.x !== j.x || q.y !== j.y || q instanceof Re && j instanceof Re && JSON.stringify(q.children.map((xe) => ({ x: xe.x, y: xe.y }))) !== JSON.stringify(j.children.map((xe) => ({ x: xe.x, y: xe.y })))) && Ke(q, j);
3447
3447
  }), C.current = null);
3448
3448
  const he = t.current;
3449
3449
  if (he && (he.style.cursor = "default"), oe.clearGuides(), oe.clearSnapState(), Xt([]), ue.clearIndicators(), Dt([]), h._cropGroupContext && delete h._cropGroupContext, h._activeChildContext) {
3450
3450
  if (Q && u instanceof Re) {
3451
- const Y = h.getContext(), j = (Y._cachedElement && Y._cachedElement[u.id] || u).children.find((ge) => ge.id === Q.id);
3451
+ const L = h.getContext(), j = (L._cachedElement && L._cachedElement[u.id] || u).children.find((ge) => ge.id === Q.id);
3452
3452
  j && (Je(j), U.update(j, W));
3453
3453
  }
3454
3454
  delete h._activeChildContext;
3455
3455
  }
3456
- if (h._multiSelectionResizeContext && delete h._multiSelectionResizeContext, G.forEach((Y) => {
3457
- if (Y instanceof oo && Y._lockedLineCount !== void 0) {
3458
- const q = Y.clone();
3456
+ if (h._multiSelectionResizeContext && delete h._multiSelectionResizeContext, G.forEach((L) => {
3457
+ if (L instanceof oo && L._lockedLineCount !== void 0) {
3458
+ const q = L.clone();
3459
3459
  q._lockedLineCount = void 0, Ie(q);
3460
3460
  }
3461
3461
  }), h._multiSelectionDragContext) {
3462
- const Y = h._multiSelectionDragContext;
3463
- if (Y.startOBB && Y.currentDelta) {
3464
- const { dx: q, dy: M } = Y.currentDelta, j = Y.startOBB;
3462
+ const L = h._multiSelectionDragContext;
3463
+ if (L.startOBB && L.currentDelta) {
3464
+ const { dx: q, dy: T } = L.currentDelta, j = L.startOBB;
3465
3465
  ce.current = {
3466
3466
  ...j,
3467
3467
  centerX: j.centerX + q,
3468
- centerY: j.centerY + M
3468
+ centerY: j.centerY + T
3469
3469
  };
3470
3470
  }
3471
3471
  delete h._multiSelectionDragContext;
3472
3472
  }
3473
3473
  if (h._multiSelectionRotationContext) {
3474
3474
  if (h.getMode() === "rotate" && te.length > 0 && ce.current) {
3475
- const Y = ce.current;
3475
+ const L = ce.current;
3476
3476
  ce.current = {
3477
- ...Y,
3478
- rotation: Y.rotation + h._multiSelectionRotationContext.currentRotation || Y.rotation
3477
+ ...L,
3478
+ rotation: L.rotation + h._multiSelectionRotationContext.currentRotation || L.rotation
3479
3479
  };
3480
3480
  }
3481
3481
  delete h._multiSelectionRotationContext;
3482
3482
  }
3483
3483
  const dt = h.getContext();
3484
3484
  if (dt._cachedElement && delete dt._cachedElement, h._pendingChildSelection) {
3485
- const Y = h._pendingChildSelection;
3485
+ const L = h._pendingChildSelection;
3486
3486
  let q = !0;
3487
3487
  if (u instanceof Re) {
3488
- const M = h._groupDragOriginalElement;
3489
- M && (q = !(Math.abs(u.x - M.x) > 0.1 || Math.abs(u.y - M.y) > 0.1));
3488
+ const T = h._groupDragOriginalElement;
3489
+ T && (q = !(Math.abs(u.x - T.x) > 0.1 || Math.abs(u.y - T.y) > 0.1));
3490
3490
  }
3491
- q && (Je(Y), U.update(Y, W), Ve((M) => M + 1)), delete h._pendingChildSelection;
3491
+ q && (Je(L), U.update(L, W), Ve((T) => T + 1)), delete h._pendingChildSelection;
3492
3492
  }
3493
3493
  if (h._pendingTextEditMode) {
3494
- const Y = h._pendingTextEditMode, q = G.find((j) => j.id === Y.elementId);
3495
- !(q && (Math.abs(q.x - Y.originalX) > 0.1 || Math.abs(q.y - Y.originalY) > 0.1)) && q instanceof Qe && !(q instanceof Yt) && !(q instanceof ts) && Ht(q, Y.clickX, Y.clickY), delete h._pendingTextEditMode;
3494
+ const L = h._pendingTextEditMode, q = G.find((j) => j.id === L.elementId);
3495
+ !(q && (Math.abs(q.x - L.originalX) > 0.1 || Math.abs(q.y - L.originalY) > 0.1)) && q instanceof Qe && !(q instanceof Lt) && !(q instanceof ts) && Ht(q, L.clickX, L.clickY), delete h._pendingTextEditMode;
3496
3496
  }
3497
3497
  if (be.current) {
3498
- const Y = be.current, q = ze.current, M = G.find((J) => J.id === Y), j = (et = C.current) == null ? void 0 : et.get(Y), ge = !!(M && j && (Math.abs(M.x - j.x) > 0.1 || Math.abs(M.y - j.y) > 0.1)), xe = q ? Math.hypot(
3499
- (O.clientX - (((B = Ge.current) == null ? void 0 : B.left) ?? 0)) / W - pe - q.x,
3500
- (O.clientY - (((me = Ge.current) == null ? void 0 : me.top) ?? 0)) / W - ae - q.y
3498
+ const L = be.current, q = Oe.current, T = G.find((J) => J.id === L), j = (et = C.current) == null ? void 0 : et.get(L), ge = !!(T && j && (Math.abs(T.x - j.x) > 0.1 || Math.abs(T.y - j.y) > 0.1)), xe = q ? Math.hypot(
3499
+ (z.clientX - (((B = Ge.current) == null ? void 0 : B.left) ?? 0)) / W - pe - q.x,
3500
+ (z.clientY - (((me = Ge.current) == null ? void 0 : me.top) ?? 0)) / W - ae - q.y
3501
3501
  ) > 4 / Math.max(W, 1e-4) : !1;
3502
- if (!ge && !xe && Y === (u == null ? void 0 : u.id) && q) {
3502
+ if (!ge && !xe && L === (u == null ? void 0 : u.id) && q) {
3503
3503
  const J = xt(), Z = [];
3504
3504
  for (let _ = J.length - 1; _ >= 0; _--) {
3505
3505
  const R = J[_];
3506
3506
  R.visible !== !1 && R.hitTest(q.x, q.y) && hs(R, q.x, q.y, Ee) && Z.push(R);
3507
3507
  }
3508
3508
  Z.splice(0, Z.length, ...xs(Z));
3509
- const E = Z.findIndex((_) => _.id === Y);
3510
- E !== -1 && E + 1 < Z.length ? Ye(Z[E + 1].id) : Ye(null);
3509
+ const E = Z.findIndex((_) => _.id === L);
3510
+ E !== -1 && E + 1 < Z.length ? Le(Z[E + 1].id) : Le(null);
3511
3511
  }
3512
- be.current = null, ze.current = null;
3512
+ be.current = null, Oe.current = null;
3513
3513
  }
3514
3514
  h._groupDragOriginalElement && delete h._groupDragOriginalElement, h.end(), We(!1), X == null || X(!1), x.current = null, ct(0), re({});
3515
3515
  }, [
3516
3516
  h,
3517
3517
  oe,
3518
3518
  K,
3519
- L,
3519
+ Y,
3520
3520
  te,
3521
3521
  ce,
3522
3522
  Q,
@@ -3532,32 +3532,32 @@ function Bi(e) {
3532
3532
  X,
3533
3533
  Ht,
3534
3534
  G,
3535
- Ye,
3535
+ Le,
3536
3536
  Ke,
3537
3537
  Ee
3538
- ]), Ln = ft(
3539
- (O) => {
3538
+ ]), Yn = ft(
3539
+ (z) => {
3540
3540
  if (!u) return;
3541
3541
  const he = t.current;
3542
3542
  if (!he) return;
3543
- const dt = Ge.current ?? he.getBoundingClientRect(), V = (O.clientX - dt.left) / W - pe, ee = (O.clientY - dt.top) / W - ae;
3543
+ const dt = Ge.current ?? he.getBoundingClientRect(), V = (z.clientX - dt.left) / W - pe, ee = (z.clientY - dt.top) / W - ae;
3544
3544
  if (u.hitTest(V, ee)) {
3545
3545
  if (u instanceof Re) {
3546
3546
  const ne = u.hitTestChild(V, ee);
3547
3547
  if (ne) {
3548
3548
  if (!(Q && Q.id === ne.id)) return;
3549
3549
  if (ne instanceof Qe && !(ne instanceof Re) && !(ne instanceof ts)) {
3550
- const Ne = ne.getVisualBoundingBox(), tt = en.toRadiansInverse(ne.rotation), bt = ne.getRotationAnchor(), zt = V - bt.x, Et = ee - bt.y, kt = Math.cos(tt), Gt = Math.sin(tt), ut = zt * kt - Et * Gt, Rt = zt * Gt + Et * kt, Mn = ut + Ne.width / 2, Ft = Rt + Ne.height / 2, qt = Rn(ne, { x: Mn, y: Ft }), jt = Ne.height + 16, _t = 6;
3550
+ const Ne = ne.getVisualBoundingBox(), tt = en.toRadiansInverse(ne.rotation), bt = ne.getRotationAnchor(), Ot = V - bt.x, Et = ee - bt.y, kt = Math.cos(tt), Gt = Math.sin(tt), ut = Ot * kt - Et * Gt, Rt = Ot * Gt + Et * kt, Tn = ut + Ne.width / 2, Ft = Rt + Ne.height / 2, qt = Rn(ne, { x: Tn, y: Ft }), jt = Ne.height + 16, _t = 6;
3551
3551
  wt({
3552
3552
  x: dt.left + (Ne.x + pe) * W - _t,
3553
3553
  y: dt.top + (Ne.y + ae) * W - _t,
3554
3554
  width: Math.max(20, Ne.width * W),
3555
3555
  height: Math.max(jt * W, 50)
3556
- }), Lt(Ue(ne));
3556
+ }), Yt(Ue(ne));
3557
3557
  const $t = ne.getRichText().clone();
3558
3558
  w.current = $t, on($t);
3559
3559
  const cn = ne.getRichText().getStyleAt(Math.max(0, ne.text.length - 1));
3560
- Ut({ ...ne.getDefaultStyle(), ...cn }), Me(qt), Be(qt), De(qt), an(!0), k.current = Date.now(), b.current = ne.id;
3560
+ Ut({ ...ne.getDefaultStyle(), ...cn }), Te(qt), Be(qt), De(qt), an(!0), k.current = Date.now(), b.current = ne.id;
3561
3561
  return;
3562
3562
  }
3563
3563
  }
@@ -3569,17 +3569,17 @@ function Bi(e) {
3569
3569
  }
3570
3570
  if (u instanceof ts || !(u instanceof Qe))
3571
3571
  return;
3572
- const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), me = u.getRotationAnchor(), Y = V - me.x, q = ee - me.y, M = Math.cos(B), j = Math.sin(B), ge = Y * M - q * j, xe = Y * j + q * M, J = ge + et.width / 2, Z = xe + et.height / 2, E = Rn(u, { x: J, y: Z }), _ = et.height + 16, R = 6;
3572
+ const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), me = u.getRotationAnchor(), L = V - me.x, q = ee - me.y, T = Math.cos(B), j = Math.sin(B), ge = L * T - q * j, xe = L * j + q * T, J = ge + et.width / 2, Z = xe + et.height / 2, E = Rn(u, { x: J, y: Z }), _ = et.height + 16, R = 6;
3573
3573
  wt({
3574
3574
  x: dt.left + (et.x + pe) * W - R,
3575
3575
  y: dt.top + (et.y + ae) * W - R,
3576
3576
  width: Math.max(20, et.width * W),
3577
3577
  height: Math.max(_ * W, 50)
3578
- }), Lt(Ue(u));
3578
+ }), Yt(Ue(u));
3579
3579
  const F = u.getRichText().clone();
3580
3580
  w.current = F, on(F);
3581
3581
  const ie = u.getRichText().getStyleAt(Math.max(0, u.text.length - 1));
3582
- Ut({ ...u.getDefaultStyle(), ...ie }), Me(E), Be(E), De(E), an(!0), k.current = Date.now();
3582
+ Ut({ ...u.getDefaultStyle(), ...ie }), Te(E), Be(E), De(E), an(!0), k.current = Date.now();
3583
3583
  }
3584
3584
  },
3585
3585
  [
@@ -3593,10 +3593,10 @@ function Bi(e) {
3593
3593
  pe,
3594
3594
  ae,
3595
3595
  wt,
3596
- Lt,
3596
+ Yt,
3597
3597
  on,
3598
3598
  Ut,
3599
- Me,
3599
+ Te,
3600
3600
  Be,
3601
3601
  De,
3602
3602
  an,
@@ -3604,81 +3604,81 @@ function Bi(e) {
3604
3604
  ot,
3605
3605
  Ue
3606
3606
  ]
3607
- ), Yn = ft(
3608
- (O) => {
3607
+ ), Ln = ft(
3608
+ (z) => {
3609
3609
  const he = t.current;
3610
3610
  if (!he || h.getMode() === "idle") return;
3611
3611
  const V = Ge.current ?? he.getBoundingClientRect();
3612
- if (O.clientX >= V.left && O.clientX <= V.right && O.clientY >= V.top && O.clientY <= V.bottom) return;
3612
+ if (z.clientX >= V.left && z.clientX <= V.right && z.clientY >= V.top && z.clientY <= V.bottom) return;
3613
3613
  const et = {
3614
- clientX: O.clientX,
3615
- clientY: O.clientY,
3616
- altKey: O.altKey,
3617
- shiftKey: O.shiftKey,
3618
- ctrlKey: O.ctrlKey,
3619
- metaKey: O.metaKey,
3614
+ clientX: z.clientX,
3615
+ clientY: z.clientY,
3616
+ altKey: z.altKey,
3617
+ shiftKey: z.shiftKey,
3618
+ ctrlKey: z.ctrlKey,
3619
+ metaKey: z.metaKey,
3620
3620
  bubbles: !0,
3621
3621
  cancelable: !0,
3622
3622
  currentTarget: he,
3623
3623
  target: he,
3624
- nativeEvent: O,
3624
+ nativeEvent: z,
3625
3625
  type: "pointermove",
3626
- pointerId: O.pointerId || 0,
3627
- pointerType: O.pointerType || "mouse",
3628
- preventDefault: () => O.preventDefault(),
3629
- stopPropagation: () => O.stopPropagation(),
3626
+ pointerId: z.pointerId || 0,
3627
+ pointerType: z.pointerType || "mouse",
3628
+ preventDefault: () => z.preventDefault(),
3629
+ stopPropagation: () => z.stopPropagation(),
3630
3630
  isPropagationStopped: () => !1,
3631
- isDefaultPrevented: () => O.defaultPrevented
3631
+ isDefaultPrevented: () => z.defaultPrevented
3632
3632
  };
3633
3633
  yn(et);
3634
3634
  },
3635
3635
  [yn, t, h]
3636
3636
  ), Kn = ft(
3637
- (O) => {
3637
+ (z) => {
3638
3638
  const he = t.current;
3639
3639
  if (!he) return;
3640
- const dt = O.target, V = dt ? he.contains(dt) : !1, ee = Pe.current.has(O.pointerId) || _e.current !== null || Le.current !== null || qe.current !== null || h.isInteracting();
3640
+ const dt = z.target, V = dt ? he.contains(dt) : !1, ee = Pe.current.has(z.pointerId) || _e.current !== null || Ye.current !== null || qe.current !== null || h.isInteracting();
3641
3641
  if (!V && !ee) return;
3642
3642
  const et = {
3643
- clientX: O.clientX,
3644
- clientY: O.clientY,
3643
+ clientX: z.clientX,
3644
+ clientY: z.clientY,
3645
3645
  // Forward the button so handlePointerUp's right-button guard
3646
3646
  // applies to document-forwarded releases too.
3647
- button: O.button,
3647
+ button: z.button,
3648
3648
  currentTarget: he,
3649
3649
  target: he,
3650
- pointerId: O.pointerId || 0,
3651
- pointerType: O.pointerType || "mouse"
3650
+ pointerId: z.pointerId || 0,
3651
+ pointerType: z.pointerType || "mouse"
3652
3652
  };
3653
3653
  bn(et);
3654
3654
  },
3655
3655
  [bn, t, h]
3656
3656
  );
3657
- Te(() => (document.addEventListener("pointermove", Yn), document.addEventListener("pointerup", Kn), () => {
3658
- document.removeEventListener("pointermove", Yn), document.removeEventListener("pointerup", Kn);
3659
- }), [Yn, Kn]);
3657
+ Me(() => (document.addEventListener("pointermove", Ln), document.addEventListener("pointerup", Kn), () => {
3658
+ document.removeEventListener("pointermove", Ln), document.removeEventListener("pointerup", Kn);
3659
+ }), [Ln, Kn]);
3660
3660
  const vn = ft(
3661
- (O) => {
3661
+ (z) => {
3662
3662
  if (!st) return;
3663
- O.preventDefault();
3663
+ z.preventDefault();
3664
3664
  const he = t.current;
3665
- if (!he || g || u instanceof Yt && u.isCropping || $.isActive()) return;
3666
- const V = he.getBoundingClientRect(), ee = (O.clientX - V.left) / W - pe, et = (O.clientY - V.top) / W - ae, B = xt();
3665
+ if (!he || g || u instanceof Lt && u.isCropping || $.isActive()) return;
3666
+ const V = he.getBoundingClientRect(), ee = (z.clientX - V.left) / W - pe, et = (z.clientY - V.top) / W - ae, B = xt();
3667
3667
  let me = null;
3668
- for (let Y = B.length - 1; Y >= 0; Y--) {
3669
- const q = B[Y];
3668
+ for (let L = B.length - 1; L >= 0; L--) {
3669
+ const q = B[L];
3670
3670
  if (q.visible !== !1 && q.hitTest(ee, et) && hs(q, ee, et, Ee)) {
3671
3671
  me = q;
3672
3672
  break;
3673
3673
  }
3674
3674
  }
3675
3675
  if (me) {
3676
- const Y = te.includes(me.id), q = (u == null ? void 0 : u.id) === me.id;
3677
- !Y && !q && (Ye(me.id), L([]));
3676
+ const L = te.includes(me.id), q = (u == null ? void 0 : u.id) === me.id;
3677
+ !L && !q && (Le(me.id), Y([]));
3678
3678
  }
3679
3679
  st({
3680
- clientX: O.clientX,
3681
- clientY: O.clientY,
3680
+ clientX: z.clientX,
3681
+ clientY: z.clientY,
3682
3682
  worldX: ee,
3683
3683
  worldY: et,
3684
3684
  elementId: me ? me.id : null
@@ -3696,15 +3696,15 @@ function Bi(e) {
3696
3696
  xt,
3697
3697
  Ee,
3698
3698
  te,
3699
- Ye,
3700
- L
3699
+ Le,
3700
+ Y
3701
3701
  ]
3702
3702
  );
3703
3703
  return {
3704
3704
  handlePointerDown: nn,
3705
3705
  handlePointerMove: yn,
3706
3706
  handlePointerUp: bn,
3707
- handleDoubleClick: Ln,
3707
+ handleDoubleClick: Yn,
3708
3708
  handleContextMenu: vn
3709
3709
  };
3710
3710
  }
@@ -3725,7 +3725,7 @@ function fs(e) {
3725
3725
  ).join(`
3726
3726
  `);
3727
3727
  }
3728
- function zi(e) {
3728
+ function Oi(e) {
3729
3729
  const {
3730
3730
  canvasRef: t,
3731
3731
  inputRef: n,
@@ -3746,11 +3746,11 @@ function zi(e) {
3746
3746
  editText: k,
3747
3747
  editRichText: S,
3748
3748
  cursorPosition: A,
3749
- selectionStart: T,
3749
+ selectionStart: M,
3750
3750
  selectionEnd: I,
3751
3751
  selectedId: g,
3752
3752
  selectedElement: P,
3753
- activeChildElement: z,
3753
+ activeChildElement: O,
3754
3754
  elements: D,
3755
3755
  zoom: v,
3756
3756
  paddingOffsetX: se,
@@ -3766,7 +3766,7 @@ function zi(e) {
3766
3766
  setCursorAnimationFrame: ae,
3767
3767
  setHandlesVersion: ve,
3768
3768
  setElements: Ee,
3769
- onElementUpdate: Me,
3769
+ onElementUpdate: Te,
3770
3770
  onTextSelectionChange: Be,
3771
3771
  transformHandles: De,
3772
3772
  updateActiveChild: We
@@ -3774,7 +3774,7 @@ function zi(e) {
3774
3774
  (h, U, oe) => {
3775
3775
  const ue = t.current;
3776
3776
  if (!ue) return;
3777
- const $ = ue.getBoundingClientRect(), we = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation), Ke = h.getRotationAnchor(), Ye = U - Ke.x, L = oe - Ke.y, X = Math.cos(Ie), ot = Math.sin(Ie), st = Ye * X - L * ot, Je = Ye * ot + L * X, xt = st + we.width / 2, Nt = Je + we.height / 2, Bt = Rn(h, { x: xt, y: Nt }), tn = we.height + 16, Ht = 6;
3777
+ const $ = ue.getBoundingClientRect(), we = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation), Ke = h.getRotationAnchor(), Le = U - Ke.x, Y = oe - Ke.y, X = Math.cos(Ie), ot = Math.sin(Ie), st = Le * X - Y * ot, Je = Le * ot + Y * X, xt = st + we.width / 2, Nt = Je + we.height / 2, Bt = Rn(h, { x: xt, y: Nt }), tn = we.height + 16, Ht = 6;
3778
3778
  W({
3779
3779
  x: $.left + (we.x + se) * v - Ht,
3780
3780
  y: $.top + (we.y + K) * v - Ht,
@@ -3783,15 +3783,15 @@ function zi(e) {
3783
3783
  }), u(fs(h));
3784
3784
  const wt = h.getRichText().clone();
3785
3785
  o.current = wt, Q(wt);
3786
- const Lt = h.getRichText().getStyleAt(Math.max(0, h.text.length - 1));
3787
- pe({ ...h.getDefaultStyle(), ...Lt }), G(Bt), te(Bt), ce(Bt), N(!0), p.current = Date.now();
3786
+ const Yt = h.getRichText().getStyleAt(Math.max(0, h.text.length - 1));
3787
+ pe({ ...h.getDefaultStyle(), ...Yt }), G(Bt), te(Bt), ce(Bt), N(!0), p.current = Date.now();
3788
3788
  },
3789
3789
  [v, W, u, Q, pe, G, te, ce, N]
3790
3790
  ), pt = ft(
3791
3791
  (h) => {
3792
3792
  if (!w || !S)
3793
3793
  return;
3794
- const U = Math.min(T, I), oe = Math.max(T, I);
3794
+ const U = Math.min(M, I), oe = Math.max(M, I);
3795
3795
  if (U === oe) {
3796
3796
  const ue = S.clone(), $ = ue.getText().length;
3797
3797
  ue.applyStyle(0, $, h), o.current = ue, Q(ue), u(ue.getText()), pe((we) => ({ ...we, ...h }));
@@ -3800,12 +3800,12 @@ function zi(e) {
3800
3800
  ue.applyStyle(U, oe, h), o.current = ue, Q(ue), u(ue.getText()), pe(($) => ({ ...$, ...h }));
3801
3801
  }
3802
3802
  },
3803
- [w, S, T, I]
3803
+ [w, S, M, I]
3804
3804
  ), ct = ft(() => {
3805
3805
  if (!w || !S || !P) return null;
3806
- const h = Math.min(T, I), U = Math.max(T, I);
3806
+ const h = Math.min(M, I), U = Math.max(M, I);
3807
3807
  return h === U ? h === 0 ? P instanceof Qe ? P.getDefaultStyle() : {} : S.getStyleAt(Math.max(0, h - 1)) : S.getStyleAt(h);
3808
- }, [w, S, T, I, P]), At = ft(
3808
+ }, [w, S, M, I, P]), At = ft(
3809
3809
  (h) => {
3810
3810
  if (!w || !S || !P) return;
3811
3811
  const U = ct(), $ = !{ ...P instanceof Qe ? P.getDefaultStyle() : {}, ...U }[h];
@@ -3823,16 +3823,16 @@ function zi(e) {
3823
3823
  const we = oe.children[ue];
3824
3824
  we instanceof Qe && we.setRichText(h), oe.updateBoundsFromChildren(!0);
3825
3825
  }
3826
- Me(oe);
3826
+ Te(oe);
3827
3827
  const $ = oe.children[ue];
3828
3828
  $ && (We($), De.update($, v), ve((we) => we + 1));
3829
3829
  } else if (P instanceof Qe) {
3830
3830
  const oe = P.clone();
3831
- oe.setRichText(h), Me(oe), De.update(oe, v), ve((ue) => ue + 1);
3831
+ oe.setRichText(h), Te(oe), De.update(oe, v), ve((ue) => ue + 1);
3832
3832
  }
3833
3833
  }
3834
3834
  c.current = null, N(!1), u(""), Q(null), o.current = null, pe(null), s.current = null;
3835
- }, [w, k, S, o, P, Me, De, We, v]), Dt = ft(() => {
3835
+ }, [w, k, S, o, P, Te, De, We, v]), Dt = ft(() => {
3836
3836
  if (Date.now() - l.current < x) {
3837
3837
  if (n.current) {
3838
3838
  n.current.focus();
@@ -3842,18 +3842,18 @@ function zi(e) {
3842
3842
  return;
3843
3843
  }
3844
3844
  setTimeout(() => {
3845
- var Ie, Ke, Ye;
3845
+ var Ie, Ke, Le;
3846
3846
  if (Date.now() - p.current < b) {
3847
3847
  (Ie = n.current) == null || Ie.focus();
3848
3848
  return;
3849
3849
  }
3850
3850
  if (m.current) {
3851
- m.current = !1, (Ke = n.current) == null || Ke.focus(), n.current && n.current.setSelectionRange(T, I);
3851
+ m.current = !1, (Ke = n.current) == null || Ke.focus(), n.current && n.current.setSelectionRange(M, I);
3852
3852
  return;
3853
3853
  }
3854
3854
  let $ = document.activeElement, we = !1;
3855
3855
  for (; $; ) {
3856
- const L = $.classList, X = $.getAttribute("data-slot");
3856
+ const Y = $.classList, X = $.getAttribute("data-slot");
3857
3857
  if (X && (X.includes("popover") || X.includes("dialog"))) {
3858
3858
  we = !0;
3859
3859
  break;
@@ -3862,7 +3862,7 @@ function zi(e) {
3862
3862
  we = !0;
3863
3863
  break;
3864
3864
  }
3865
- if (L && (L.contains("sc-toolbar") || L.contains("sc-toolbar-items") || L.contains("sc-toolbar-btn") || L.contains("sc-toolbar-btn-sm") || L.contains("sc-toolbar-btn-icon") || L.contains("sc-toolbar-color") || L.contains("sc-toolbar-label") || L.contains("sc-toolbar-select") || L.contains("sc-toolbar-select-sm") || L.contains("sc-toolbar-group") || L.contains("sc-toolbar-scroll") || L.contains("sc-toolbar-color-label") || L.contains("sc-toolbar-color-square") || L.contains("sc-color-picker-dropdown") || L.contains("sc-text-color-panel") || L.contains("sc-tooltip-wrapper") || L.contains("sc-font-dropdown-with-label") || L.contains("sc-font-family-select-button") || L.contains("sc-more-menu-btn") || L.contains("sc-more-menu-toolbar") || L.contains("sc-font-drawer-overlay") || L.contains("sc-font-drawer-content") || L.contains("sc-font-drawer-handle") || L.contains("sc-font-drawer-handle-bar") || L.contains("sc-font-dropdown-list-container") || L.contains("sc-font-dropdown-search") || L.contains("sc-font-search-input") || L.contains("sc-font-category-filters") || L.contains("sc-font-category-btn") || L.contains("sc-font-grid-option") || L.contains("sc-font-section") || L.contains("sc-font-section-header") || L.contains("sc-font-section-used") || L.contains("sc-font-section-header-used") || L.contains("sc-font-dropdown-list-grid") || L.contains("sc-font-dropdown-list-grid-used") || L.contains("sc-font-preview") || L.contains("sc-font-name-label") || L.contains("sc-font-size-slider-container") || L.contains("sc-font-size-slider") || L.contains("sc-font-size-icon-small") || L.contains("sc-font-size-icon-large") || L.contains("sc-font-icon-toggle") || L.contains("sc-font-dropdown-empty") || L.contains("vaul-drawer-wrapper") || L.contains("vaul-overlay"))) {
3865
+ 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"))) {
3866
3866
  we = !0;
3867
3867
  break;
3868
3868
  }
@@ -3870,7 +3870,7 @@ function zi(e) {
3870
3870
  }
3871
3871
  if (!we && C.current)
3872
3872
  for ($ = C.current; $; ) {
3873
- const L = $.classList, X = $.getAttribute("data-slot");
3873
+ const Y = $.classList, X = $.getAttribute("data-slot");
3874
3874
  if (X && (X.includes("popover") || X.includes("dialog"))) {
3875
3875
  we = !0;
3876
3876
  break;
@@ -3879,7 +3879,7 @@ function zi(e) {
3879
3879
  we = !0;
3880
3880
  break;
3881
3881
  }
3882
- if (L && (L.contains("sc-toolbar") || L.contains("sc-toolbar-items") || L.contains("sc-toolbar-btn") || L.contains("sc-toolbar-btn-sm") || L.contains("sc-toolbar-btn-icon") || L.contains("sc-toolbar-color") || L.contains("sc-toolbar-label") || L.contains("sc-toolbar-select") || L.contains("sc-toolbar-select-sm") || L.contains("sc-toolbar-group") || L.contains("sc-toolbar-scroll") || L.contains("sc-toolbar-color-label") || L.contains("sc-toolbar-color-square") || L.contains("sc-color-picker-dropdown") || L.contains("sc-text-color-panel") || L.contains("sc-tooltip-wrapper") || L.contains("sc-font-dropdown-with-label") || L.contains("sc-font-family-select-button") || L.contains("sc-more-menu-btn") || L.contains("sc-more-menu-toolbar") || L.contains("vaul-drawer-wrapper") || L.contains("vaul-overlay"))) {
3882
+ 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"))) {
3883
3883
  we = !0;
3884
3884
  break;
3885
3885
  }
@@ -3888,11 +3888,11 @@ function zi(e) {
3888
3888
  if (!we)
3889
3889
  Xt();
3890
3890
  else {
3891
- const L = T, X = I;
3892
- (Ye = n.current) == null || Ye.focus(), n.current && n.current.setSelectionRange(L, X);
3891
+ const Y = M, X = I;
3892
+ (Le = n.current) == null || Le.focus(), n.current && n.current.setSelectionRange(Y, X);
3893
3893
  }
3894
3894
  }, 0);
3895
- }, [Xt, T, I]), Ve = ft(
3895
+ }, [Xt, M, I]), Ve = ft(
3896
3896
  (h) => {
3897
3897
  const U = h.currentTarget;
3898
3898
  if (h.key === "Enter" && (h.metaKey || h.ctrlKey))
@@ -3913,7 +3913,7 @@ function zi(e) {
3913
3913
  else if (h.key === "ArrowUp" || h.key === "ArrowDown") {
3914
3914
  if (P && P instanceof Qe) {
3915
3915
  h.preventDefault();
3916
- const oe = h.key === "ArrowUp" ? "up" : "down", ue = zo(P, A, oe);
3916
+ const oe = h.key === "ArrowUp" ? "up" : "down", ue = Oo(P, A, oe);
3917
3917
  G(ue), te(ue), ce(ue), i.current = ue, U.setSelectionRange(ue, ue);
3918
3918
  }
3919
3919
  } else (h.key === "Home" || h.key === "End") && setTimeout(() => {
@@ -3923,9 +3923,9 @@ function zi(e) {
3923
3923
  },
3924
3924
  [Xt, At, G, te, ce, i, A, P]
3925
3925
  );
3926
- Te(() => {
3926
+ Me(() => {
3927
3927
  w && (a.current = performance.now());
3928
- }, [w, A, a]), Te(() => {
3928
+ }, [w, A, a]), Me(() => {
3929
3929
  if (!w) return;
3930
3930
  let h, U = 0;
3931
3931
  const oe = 33, ue = ($) => {
@@ -3934,7 +3934,7 @@ function zi(e) {
3934
3934
  return h = requestAnimationFrame(ue), () => cancelAnimationFrame(h);
3935
3935
  }, [w]);
3936
3936
  const ke = Se(!1);
3937
- Te(() => {
3937
+ Me(() => {
3938
3938
  if (w && !ke.current && n.current) {
3939
3939
  n.current.focus();
3940
3940
  const h = k.length;
@@ -3943,9 +3943,9 @@ function zi(e) {
3943
3943
  ke.current = w;
3944
3944
  }, [w, k]);
3945
3945
  const lt = Se(null), re = (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;
3946
- return Te(() => {
3946
+ return Me(() => {
3947
3947
  if (!w || !S) return;
3948
- const h = Math.min(T, I), U = Math.max(T, I);
3948
+ const h = Math.min(M, I), U = Math.max(M, I);
3949
3949
  if (h === U) {
3950
3950
  let oe = null;
3951
3951
  if (h > 0)
@@ -3956,17 +3956,17 @@ function zi(e) {
3956
3956
  }
3957
3957
  oe && !re(oe, lt.current) && (lt.current = oe, pe(oe));
3958
3958
  }
3959
- }, [w, S, T, I, g]), Te(() => {
3959
+ }, [w, S, M, I, g]), Me(() => {
3960
3960
  if (!w || !n.current) return;
3961
3961
  const h = n.current;
3962
- (h.selectionStart !== T || h.selectionEnd !== I) && (T !== I ? h.setSelectionRange(T, I) : h.setSelectionRange(A, A));
3963
- }, [k, w, A, T, I]), Te(() => {
3962
+ (h.selectionStart !== M || h.selectionEnd !== I) && (M !== I ? h.setSelectionRange(M, I) : h.setSelectionRange(A, A));
3963
+ }, [k, w, A, M, I]), Me(() => {
3964
3964
  const h = D.find((U) => U.id === g);
3965
3965
  if (!(!w || !h || !t.current || !n.current))
3966
3966
  return f.current && clearTimeout(f.current), f.current = setTimeout(() => {
3967
3967
  let U = h;
3968
3968
  if (s.current && h instanceof Re) {
3969
- const Ke = h.children.find((Ye) => Ye.id === s.current);
3969
+ const Ke = h.children.find((Le) => Le.id === s.current);
3970
3970
  Ke && (U = Ke);
3971
3971
  }
3972
3972
  if (!(U instanceof Qe)) return;
@@ -3979,15 +3979,15 @@ function zi(e) {
3979
3979
  width: Math.max(20, ue.width * v),
3980
3980
  height: Math.max(we * v, 50)
3981
3981
  }), s.current && h instanceof Re) {
3982
- const Ke = h.clone(), Ye = Ke.children.findIndex((L) => L.id === s.current);
3983
- Ye >= 0 && (Ke.children[Ye] = oe, Ke.updateBoundsFromChildren(!0)), Ee((L) => L.map((X) => X.id === Ke.id ? Ke : X)), De.update(oe, v);
3982
+ const Ke = h.clone(), Le = Ke.children.findIndex((Y) => Y.id === s.current);
3983
+ Le >= 0 && (Ke.children[Le] = oe, Ke.updateBoundsFromChildren(!0)), Ee((Y) => Y.map((X) => X.id === Ke.id ? Ke : X)), De.update(oe, v);
3984
3984
  } else
3985
- Ee((Ke) => Ke.map((Ye) => Ye.id === oe.id ? oe : Ye)), De.update(oe, v);
3985
+ Ee((Ke) => Ke.map((Le) => Le.id === oe.id ? oe : Le)), De.update(oe, v);
3986
3986
  ve((Ke) => Ke + 1);
3987
3987
  }, 50), () => {
3988
3988
  f.current && clearTimeout(f.current);
3989
3989
  };
3990
- }, [k, S, w, g, v]), Te(() => {
3990
+ }, [k, S, w, g, v]), Me(() => {
3991
3991
  if (!w || !n.current) return;
3992
3992
  const h = n.current, U = () => {
3993
3993
  if (d.current || Date.now() - l.current < x)
@@ -4002,23 +4002,23 @@ function zi(e) {
4002
4002
  return document.addEventListener("selectionchange", oe), U(), () => {
4003
4003
  h.removeEventListener("click", U), h.removeEventListener("keyup", U), h.removeEventListener("select", U), h.removeEventListener("mouseup", U), document.removeEventListener("selectionchange", oe);
4004
4004
  };
4005
- }, [w]), Te(() => {
4005
+ }, [w]), Me(() => {
4006
4006
  const h = (U) => {
4007
4007
  const oe = U.target;
4008
4008
  if (oe.tagName === "INPUT" || oe.tagName === "TEXTAREA" || U.key !== "Enter" || w || !t.current) return;
4009
4009
  const ue = t.current.getBoundingClientRect();
4010
- if (z && z instanceof Qe && !(z instanceof Re) && !(z instanceof Yt) && !(z instanceof ts)) {
4010
+ if (O && O instanceof Qe && !(O instanceof Re) && !(O instanceof Lt) && !(O instanceof ts)) {
4011
4011
  U.preventDefault();
4012
- const $ = z.getVisualBoundingBox(), we = $.height + 16, Ie = 6;
4012
+ const $ = O.getVisualBoundingBox(), we = $.height + 16, Ie = 6;
4013
4013
  W({
4014
4014
  x: ue.left + ($.x + se) * v - Ie,
4015
4015
  y: ue.top + ($.y + K) * v - Ie,
4016
4016
  width: Math.max(200, $.width * v),
4017
4017
  height: Math.max(we * v, 50)
4018
- }), u(fs(z)), N(!0), p.current = Date.now(), s.current = z.id;
4018
+ }), u(fs(O)), N(!0), p.current = Date.now(), s.current = O.id;
4019
4019
  return;
4020
4020
  }
4021
- if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Yt) && !(P instanceof ts)) {
4021
+ if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Lt) && !(P instanceof ts)) {
4022
4022
  U.preventDefault();
4023
4023
  const $ = P.getVisualBoundingBox(), we = $.height + 16, Ie = 6;
4024
4024
  W({
@@ -4030,7 +4030,7 @@ function zi(e) {
4030
4030
  }
4031
4031
  };
4032
4032
  return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
4033
- }, [P, z, w]), {
4033
+ }, [P, O, w]), {
4034
4034
  handleTextEditComplete: Xt,
4035
4035
  handleTextEditBlur: Dt,
4036
4036
  handleTextKeyDown: Ve,
@@ -4063,11 +4063,11 @@ const vr = Br(
4063
4063
  canvasRef: k,
4064
4064
  width: S,
4065
4065
  height: A,
4066
- zoom: T = 1,
4066
+ zoom: M = 1,
4067
4067
  offsetX: I = 0,
4068
4068
  offsetY: g = 0,
4069
4069
  viewPadding: P = 1,
4070
- artboardBorderRadius: z = 0,
4070
+ artboardBorderRadius: O = 0,
4071
4071
  fixedMargin: D,
4072
4072
  fixedMarginX: v,
4073
4073
  fixedMarginY: se,
@@ -4077,7 +4077,7 @@ const vr = Br(
4077
4077
  pieceFocus: Q,
4078
4078
  focusedPieceRect: G
4079
4079
  }, te) => {
4080
- const { resolvedTheme: ce } = yo(), W = Se(null), pe = k || W, ae = Se(null), ve = Se(!1), Ee = Se(0), Me = Se(0), Be = Se(0), De = Se(!1), We = Se(0), at = Se(null), pt = Se(0), ct = Se(null), At = Se({ start: null, end: null }), Xt = Se(null), Dt = Se(null), Ve = Se(null), ke = Se(null), lt = 400, re = 300, h = 50, U = 200, oe = Ze.useMemo(() => {
4080
+ const { resolvedTheme: ce } = yo(), W = Se(null), pe = k || W, ae = Se(null), ve = Se(!1), Ee = Se(0), Te = Se(0), Be = Se(0), De = Se(!1), We = Se(0), at = Se(null), pt = Se(0), ct = Se(null), At = Se({ start: null, end: null }), Xt = Se(null), Dt = Se(null), Ve = Se(null), ke = Se(null), lt = 400, re = 300, h = 50, U = 200, oe = Ze.useMemo(() => {
4081
4081
  if (!Q || Q === "spread") return null;
4082
4082
  const ye = (u == null ? void 0 : u.pieces) ?? [];
4083
4083
  if (ye.length <= 1) return null;
@@ -4095,8 +4095,8 @@ const vr = Br(
4095
4095
  isTouchDevice: we,
4096
4096
  canvasSize: Ie,
4097
4097
  lastTouchTargetRef: Ke,
4098
- effectiveViewPadding: Ye,
4099
- paddedCanvasWidth: L,
4098
+ effectiveViewPadding: Le,
4099
+ paddedCanvasWidth: Y,
4100
4100
  paddedCanvasHeight: X,
4101
4101
  paddingOffsetX: ot,
4102
4102
  paddingOffsetY: st,
@@ -4104,9 +4104,9 @@ const vr = Br(
4104
4104
  } = Ko({
4105
4105
  width: S,
4106
4106
  height: A,
4107
- zoom: T,
4107
+ zoom: M,
4108
4108
  viewPadding: P,
4109
- artboardBorderRadius: z,
4109
+ artboardBorderRadius: O,
4110
4110
  fixedMargin: D,
4111
4111
  fixedMarginX: v,
4112
4112
  fixedMarginY: se,
@@ -4120,7 +4120,7 @@ const vr = Br(
4120
4120
  setSpacingIndicators: tn,
4121
4121
  isAltKeyPressed: Ht,
4122
4122
  setIsAltKeyPressed: wt,
4123
- isRotating: Lt,
4123
+ isRotating: Yt,
4124
4124
  setIsRotating: on,
4125
4125
  setRotationStartAngle: an,
4126
4126
  currentRotation: Ut,
@@ -4132,15 +4132,15 @@ const vr = Br(
4132
4132
  handlesVersion: Xe,
4133
4133
  setHandlesVersion: H,
4134
4134
  forceUpdate: be,
4135
- cursorAnimationFrame: ze,
4135
+ cursorAnimationFrame: Oe,
4136
4136
  setCursorAnimationFrame: _e
4137
- } = Go({ elements: e }), [Le] = le(() => new fo()), [mt] = le(() => new po({ showBorder: !1, showLabel: !1 })), [yt] = le(() => new mo({ enabled: !0, showGuides: !0 })), [rt] = le(() => new go({ enabled: !0, showLabels: !0 })), [it] = le(() => {
4137
+ } = Go({ elements: e }), [Ye] = le(() => new fo()), [mt] = le(() => new po({ showBorder: !1, showLabel: !1 })), [yt] = le(() => new mo({ enabled: !0, showGuides: !0 })), [rt] = le(() => new go({ enabled: !0, showLabels: !0 })), [it] = le(() => {
4138
4138
  const ye = new xo();
4139
4139
  return ye.setResizePipeline(gs), ye.setSnapHandler(yt), ye;
4140
4140
  });
4141
- Te(() => {
4141
+ Me(() => {
4142
4142
  mt.setOptions({ borderRadius: Je });
4143
- }, [Je, mt]), Te(() => {
4143
+ }, [Je, mt]), Me(() => {
4144
4144
  const ye = G !== void 0 ? G : oe;
4145
4145
  yt.setExtraSnapRects(
4146
4146
  ye ? [{ id: "focused-piece", ...ye }] : []
@@ -4151,7 +4151,7 @@ const vr = Br(
4151
4151
  const fe = e.find((ye) => ye.id === s), nn = Se(fe);
4152
4152
  nn.current = fe;
4153
4153
  const [yn, bn] = le("");
4154
- Te(() => {
4154
+ Me(() => {
4155
4155
  var de;
4156
4156
  if (!s) return;
4157
4157
  const ye = e.find((He) => He.id === s);
@@ -4159,23 +4159,23 @@ const vr = Br(
4159
4159
  if (ye instanceof Qe) {
4160
4160
  const He = ((de = ye.text) == null ? void 0 : de.slice(0, 40)) || "empty";
4161
4161
  bn(`Selected text element: ${He}`);
4162
- } else ye instanceof Yt ? bn("Selected image element") : ye instanceof Re ? bn("Selected group") : bn("Selected element");
4162
+ } else ye instanceof Lt ? bn("Selected image element") : ye instanceof Re ? bn("Selected group") : bn("Selected element");
4163
4163
  }, [s, e]);
4164
- const Ln = Se(n);
4165
- Ln.current = n;
4166
- const Yn = Se(/* @__PURE__ */ new Map());
4167
- Te(() => {
4164
+ const Yn = Se(n);
4165
+ Yn.current = n;
4166
+ const Ln = Se(/* @__PURE__ */ new Map());
4167
+ Me(() => {
4168
4168
  const ye = (de) => {
4169
- const He = de, $e = Ln.current.getActiveArtboardId(), nt = Yn.current.get($e) || [], vt = [];
4170
- return nt.forEach((Mt) => {
4171
- Mt instanceof Re ? vt.push(...Mt.children) : vt.push(Mt);
4169
+ const He = de, $e = Yn.current.getActiveArtboardId(), nt = Ln.current.get($e) || [], vt = [];
4170
+ return nt.forEach((Tt) => {
4171
+ Tt instanceof Re ? vt.push(...Tt.children) : vt.push(Tt);
4172
4172
  }), yt.snapDimensions(He, vt, He.startData);
4173
4173
  };
4174
4174
  return gs.addHook("afterResize", ye), () => {
4175
4175
  gs.removeHook("afterResize", ye);
4176
4176
  };
4177
4177
  }, [yt]);
4178
- const { cropController: Kn } = Fo(), { penTool: vn, penCursor: O } = Yo({ selectedElement: fe }), {
4178
+ const { cropController: Kn } = Fo(), { penTool: vn, penCursor: z } = Lo({ selectedElement: fe }), {
4179
4179
  isEditing: he,
4180
4180
  setIsEditing: dt,
4181
4181
  editText: V,
@@ -4183,9 +4183,9 @@ const vr = Br(
4183
4183
  editPosition: et,
4184
4184
  setEditPosition: B,
4185
4185
  cursorPosition: me,
4186
- setCursorPosition: Y,
4186
+ setCursorPosition: L,
4187
4187
  selectionStart: q,
4188
- setSelectionStart: M,
4188
+ setSelectionStart: T,
4189
4189
  selectionEnd: j,
4190
4190
  setSelectionEnd: ge,
4191
4191
  cursorOpacityRef: xe,
@@ -4198,10 +4198,10 @@ const vr = Br(
4198
4198
  currentFormattingStyle: ie,
4199
4199
  setCurrentFormattingStyle: ne
4200
4200
  } = Vo({ selectedElement: fe, ref: te });
4201
- Te(() => {
4201
+ Me(() => {
4202
4202
  const ye = Date.now() - We.current, de = at.current;
4203
- de && ye < re ? (q !== de.start || j !== de.end) && (Y(de.cursor), M(de.start), ge(de.end), ae.current && ae.current.setSelectionRange(de.start, de.end)) : de && ye >= re && (at.current = null);
4204
- }, [q, j, me]), Te(() => {
4203
+ de && ye < re ? (q !== de.start || j !== de.end) && (L(de.cursor), T(de.start), ge(de.end), ae.current && ae.current.setSelectionRange(de.start, de.end)) : de && ye >= re && (at.current = null);
4204
+ }, [q, j, me]), Me(() => {
4205
4205
  if (!he) return;
4206
4206
  const ye = pe.current;
4207
4207
  if (!ye) return;
@@ -4209,8 +4209,8 @@ const vr = Br(
4209
4209
  const He = () => {
4210
4210
  const $e = ae.current, nt = pe.current;
4211
4211
  if (!$e || !nt) return;
4212
- const vt = nt.getBoundingClientRect(), Mt = vt.left - de.left, ht = vt.top - de.top;
4213
- Mt === 0 && ht === 0 || (de = vt, $e.style.left = `${parseFloat($e.style.left || "0") + Mt}px`, $e.style.top = `${parseFloat($e.style.top || "0") + ht}px`);
4212
+ const vt = nt.getBoundingClientRect(), Tt = vt.left - de.left, ht = vt.top - de.top;
4213
+ Tt === 0 && ht === 0 || (de = vt, $e.style.left = `${parseFloat($e.style.left || "0") + Tt}px`, $e.style.top = `${parseFloat($e.style.top || "0") + ht}px`);
4214
4214
  };
4215
4215
  return window.addEventListener("scroll", He, { passive: !0, capture: !0 }), window.addEventListener("resize", He), () => {
4216
4216
  window.removeEventListener("scroll", He, { capture: !0 }), window.removeEventListener("resize", He);
@@ -4221,29 +4221,29 @@ const vr = Br(
4221
4221
  marqueeStart: Ne,
4222
4222
  marqueeEnd: tt,
4223
4223
  marqueePreviewSelection: bt,
4224
- startMarqueeSelection: zt,
4224
+ startMarqueeSelection: Ot,
4225
4225
  updateMarqueeSelection: Et,
4226
4226
  finishMarqueeSelection: kt
4227
- } = Oo(), {
4227
+ } = zo(), {
4228
4228
  multiSelectionGroupBoundsRef: Gt,
4229
4229
  multiSelectionOBBRef: ut
4230
4230
  } = Wo(o), {
4231
4231
  activeChildElement: Rt,
4232
- updateActiveChild: Mn,
4232
+ updateActiveChild: Tn,
4233
4233
  editingChildIdRef: Ft
4234
- } = Ho({ elements: e, selectedElement: fe, transformHandles: Le, onActiveChildChange: d }), { hoverState: qt, setHoverState: jt } = _o({ onHoverChange: p }), _t = ys(() => {
4234
+ } = Ho({ elements: e, selectedElement: fe, transformHandles: Ye, onActiveChildChange: d }), { hoverState: qt, setHoverState: jt } = _o({ onHoverChange: p }), _t = ys(() => {
4235
4235
  const ye = /* @__PURE__ */ new Map();
4236
4236
  return e.forEach((de) => {
4237
4237
  const He = n.getArtboardIdForElement(de.id);
4238
4238
  ye.has(He) || ye.set(He, []), ye.get(He).push(de);
4239
4239
  }), ye;
4240
4240
  }, [e, n]);
4241
- Yn.current = _t;
4241
+ Ln.current = _t;
4242
4242
  const $t = ft(() => {
4243
4243
  const ye = n.getActiveArtboardId();
4244
4244
  return _t.get(ye) || [];
4245
4245
  }, [_t, n]);
4246
- Te(() => {
4246
+ Me(() => {
4247
4247
  const ye = ($e) => {
4248
4248
  if (!he) {
4249
4249
  if (vn.isActive() && fe instanceof kn) {
@@ -4267,7 +4267,7 @@ const vr = Br(
4267
4267
  return window.addEventListener("keydown", ye), window.addEventListener("keyup", de), window.addEventListener("blur", He), () => {
4268
4268
  window.removeEventListener("keydown", ye), window.removeEventListener("keyup", de), window.removeEventListener("blur", He);
4269
4269
  };
4270
- }, [vn, fe, l, H, he]), Te(() => {
4270
+ }, [vn, fe, l, H, he]), Me(() => {
4271
4271
  if (!pe.current || !Xt.current || it.getMode() === "drag" || it.getMode() === "resize")
4272
4272
  return;
4273
4273
  const { x: de, y: He } = Xt.current;
@@ -4275,11 +4275,11 @@ const vr = Br(
4275
4275
  let $e = null;
4276
4276
  const nt = $t();
4277
4277
  for (let vt = nt.length - 1; vt >= 0; vt--) {
4278
- const Mt = nt[vt];
4279
- if (Mt.visible !== !1) {
4280
- if (Mt instanceof Re)
4281
- for (let ht = Mt.children.length - 1; ht >= 0; ht--) {
4282
- const je = Mt.children[ht];
4278
+ const Tt = nt[vt];
4279
+ if (Tt.visible !== !1) {
4280
+ if (Tt instanceof Re)
4281
+ for (let ht = Tt.children.length - 1; ht >= 0; ht--) {
4282
+ const je = Tt.children[ht];
4283
4283
  if (je.visible === !1) continue;
4284
4284
  const Ae = je.getVisualBoundingBox();
4285
4285
  if (de >= Ae.x && de <= Ae.x + Ae.width && He >= Ae.y && He <= Ae.y + Ae.height) {
@@ -4288,9 +4288,9 @@ const vr = Br(
4288
4288
  }
4289
4289
  }
4290
4290
  else {
4291
- const ht = Mt.getVisualBoundingBox();
4291
+ const ht = Tt.getVisualBoundingBox();
4292
4292
  if (de >= ht.x && de <= ht.x + ht.width && He >= ht.y && He <= ht.y + ht.height) {
4293
- $e = Mt;
4293
+ $e = Tt;
4294
4294
  break;
4295
4295
  }
4296
4296
  }
@@ -4302,20 +4302,20 @@ const vr = Br(
4302
4302
  nt.forEach((ht) => {
4303
4303
  ht instanceof Re ? vt.push(...ht.children) : vt.push(ht);
4304
4304
  });
4305
- const Mt = rt.detectSpacing($e, vt, !0);
4306
- tn(Mt);
4305
+ const Tt = rt.detectSpacing($e, vt, !0);
4306
+ tn(Tt);
4307
4307
  }
4308
4308
  } else
4309
4309
  tn([]);
4310
4310
  }, [Ht, $t, rt, it]);
4311
4311
  const cn = Se(null);
4312
- Te(() => {
4312
+ Me(() => {
4313
4313
  const ye = e.find((He) => He.id === s), de = Rt || ye;
4314
4314
  if (de) {
4315
4315
  const He = de.getBoundingBox(), $e = `${de.id}-${He.x}-${He.y}-${He.width}-${He.height}-${de.rotation}`;
4316
- cn.current !== $e && (cn.current = $e, Le.update(de, T), H((nt) => nt + 1));
4316
+ cn.current !== $e && (cn.current = $e, Ye.update(de, M), H((nt) => nt + 1));
4317
4317
  }
4318
- }, [s, Rt, Le, T, e]);
4318
+ }, [s, Rt, Ye, M, e]);
4319
4319
  const {
4320
4320
  handleTextEditBlur: Hn,
4321
4321
  handleTextKeyDown: Un,
@@ -4324,7 +4324,7 @@ const vr = Br(
4324
4324
  toggleFormattingProperty: ds,
4325
4325
  enterTextEditMode: Gn,
4326
4326
  getWrappedTextForEditing: qn
4327
- } = zi({
4327
+ } = Oi({
4328
4328
  canvasRef: pe,
4329
4329
  inputRef: ae,
4330
4330
  editingChildIdRef: Ft,
@@ -4350,14 +4350,14 @@ const vr = Br(
4350
4350
  selectedElement: fe,
4351
4351
  activeChildElement: Rt,
4352
4352
  elements: e,
4353
- zoom: T,
4353
+ zoom: M,
4354
4354
  paddingOffsetX: ot,
4355
4355
  paddingOffsetY: st,
4356
4356
  setIsEditing: dt,
4357
4357
  setEditText: ee,
4358
4358
  setEditRichText: R,
4359
- setCursorPosition: Y,
4360
- setSelectionStart: M,
4359
+ setCursorPosition: L,
4360
+ setSelectionStart: T,
4361
4361
  setSelectionEnd: ge,
4362
4362
  setEditPosition: B,
4363
4363
  setCurrentFormattingStyle: ne,
@@ -4366,11 +4366,11 @@ const vr = Br(
4366
4366
  setElements: a,
4367
4367
  onElementUpdate: i,
4368
4368
  onTextSelectionChange: m,
4369
- transformHandles: Le,
4370
- updateActiveChild: Mn
4369
+ transformHandles: Ye,
4370
+ updateActiveChild: Tn
4371
4371
  }), {
4372
4372
  handlePointerDown: Wt,
4373
- handlePointerMove: Tn,
4373
+ handlePointerMove: Mn,
4374
4374
  handlePointerUp: Cn,
4375
4375
  handleDoubleClick: Sr,
4376
4376
  handleContextMenu: Er
@@ -4379,7 +4379,7 @@ const vr = Br(
4379
4379
  inputRef: ae,
4380
4380
  repositioningCursorRef: ve,
4381
4381
  lastClickTimeRef: Ee,
4382
- clickCountRef: Me,
4382
+ clickCountRef: Te,
4383
4383
  lastProcessedClickTimeRef: pt,
4384
4384
  lastMultiClickTimeRef: We,
4385
4385
  multiClickSelectionRef: at,
@@ -4401,7 +4401,7 @@ const vr = Br(
4401
4401
  isTouchDevice: we,
4402
4402
  selectionStart: q,
4403
4403
  selectionEnd: j,
4404
- isRotating: Lt,
4404
+ isRotating: Yt,
4405
4405
  isMarqueeSelecting: Ce,
4406
4406
  isAltKeyPressed: Ht,
4407
4407
  selectedElement: fe,
@@ -4409,13 +4409,13 @@ const vr = Br(
4409
4409
  elements: e,
4410
4410
  multiSelection: o,
4411
4411
  multiSelectionOBBRef: ut,
4412
- zoom: T,
4412
+ zoom: M,
4413
4413
  paddingOffsetX: ot,
4414
4414
  paddingOffsetY: st,
4415
4415
  spacingIndicators: Bt,
4416
4416
  focusedPieceRect: $,
4417
- setCursorPosition: Y,
4418
- setSelectionStart: M,
4417
+ setCursorPosition: L,
4418
+ setSelectionStart: T,
4419
4419
  setSelectionEnd: ge,
4420
4420
  setIsRotating: on,
4421
4421
  setRotationStartAngle: an,
@@ -4429,7 +4429,7 @@ const vr = Br(
4429
4429
  setElements: a,
4430
4430
  forceUpdate: be,
4431
4431
  stateMachine: it,
4432
- transformHandles: Le,
4432
+ transformHandles: Ye,
4433
4433
  snapSystem: yt,
4434
4434
  spacingSystem: rt,
4435
4435
  penTool: vn,
@@ -4441,9 +4441,9 @@ const vr = Br(
4441
4441
  onRotationStateChange: C,
4442
4442
  onCropModeEnter: x,
4443
4443
  onContextMenuRequest: b,
4444
- updateActiveChild: Mn,
4444
+ updateActiveChild: Tn,
4445
4445
  getActiveArtboardElements: $t,
4446
- startMarqueeSelection: zt,
4446
+ startMarqueeSelection: Ot,
4447
4447
  updateMarqueeSelection: Et,
4448
4448
  finishMarqueeSelection: kt,
4449
4449
  enterTextEditMode: Gn,
@@ -4465,18 +4465,18 @@ const vr = Br(
4465
4465
  selectedElement: fe,
4466
4466
  activeChildElement: Rt,
4467
4467
  editingChildIdRef: Ft,
4468
- transformHandles: Le,
4468
+ transformHandles: Ye,
4469
4469
  stateMachine: it,
4470
4470
  canvasSize: Ie,
4471
- paddedCanvasWidth: L,
4471
+ paddedCanvasWidth: Y,
4472
4472
  paddedCanvasHeight: X,
4473
4473
  paddingOffsetX: ot,
4474
4474
  paddingOffsetY: st,
4475
- zoom: T,
4475
+ zoom: M,
4476
4476
  zoomInvariantBorderRadius: Je,
4477
- effectiveViewPadding: Ye,
4477
+ effectiveViewPadding: Le,
4478
4478
  showRotationHandle: K,
4479
- isRotating: Lt,
4479
+ isRotating: Yt,
4480
4480
  currentRotation: Ut,
4481
4481
  hoverState: qt,
4482
4482
  isEditing: he,
@@ -4506,7 +4506,7 @@ const vr = Br(
4506
4506
  handlesVersion: Xe,
4507
4507
  hideHandles: w,
4508
4508
  resolvedTheme: ce,
4509
- cursorAnimationFrame: ze,
4509
+ cursorAnimationFrame: Oe,
4510
4510
  renderVersion: Pe,
4511
4511
  pieceGuides: u,
4512
4512
  focusedPieceId: Q && Q !== "spread" ? Q.pieceId : null,
@@ -4521,9 +4521,9 @@ const vr = Br(
4521
4521
  ds(ye);
4522
4522
  },
4523
4523
  isEditingText: () => he,
4524
- isRotating: () => Lt,
4524
+ isRotating: () => Yt,
4525
4525
  getSelectionStyle: () => ls(),
4526
- getZoom: () => T,
4526
+ getZoom: () => M,
4527
4527
  forceRender: qe,
4528
4528
  getEditingState: () => ({
4529
4529
  isEditing: he,
@@ -4533,23 +4533,23 @@ const vr = Br(
4533
4533
  selectionEnd: j
4534
4534
  }),
4535
4535
  getCropState: () => ({
4536
- isCropping: fe instanceof Yt && fe.isCropping,
4536
+ isCropping: fe instanceof Lt && fe.isCropping,
4537
4537
  elementId: (fe == null ? void 0 : fe.id) || null
4538
4538
  }),
4539
4539
  getPaddingOffset: () => ({ x: ot, y: st })
4540
4540
  }),
4541
- [sn, ds, he, Lt, ls, T, qe, V, me, q, j, fe, ot, st]
4541
+ [sn, ds, he, Yt, ls, M, qe, V, me, q, j, fe, ot, st]
4542
4542
  );
4543
4543
  const kr = ys(() => {
4544
4544
  if (!N || N.length === 0) return;
4545
- const ye = L * T, de = X * T, He = `M 0 0 h ${ye} v ${de} h ${-ye} Z`, $e = N.map((nt) => {
4545
+ const ye = Y * M, de = X * M, He = `M 0 0 h ${ye} v ${de} h ${-ye} Z`, $e = N.map((nt) => {
4546
4546
  if (nt.kind === "rect" || nt.kind === "roundedRect") {
4547
- const vt = (ot + nt.x) * T, Mt = (st + nt.y) * T, ht = nt.width * T, je = nt.height * T;
4547
+ const vt = (ot + nt.x) * M, Tt = (st + nt.y) * M, ht = nt.width * M, je = nt.height * M;
4548
4548
  if (nt.kind === "roundedRect") {
4549
- const Ae = (nt.rx ?? nt.ry ?? 0) * T, gt = (nt.ry ?? nt.rx ?? 0) * T;
4549
+ const Ae = (nt.rx ?? nt.ry ?? 0) * M, gt = (nt.ry ?? nt.rx ?? 0) * M;
4550
4550
  if (Ae > 0 || gt > 0)
4551
4551
  return [
4552
- `M ${vt + Ae} ${Mt}`,
4552
+ `M ${vt + Ae} ${Tt}`,
4553
4553
  `h ${ht - 2 * Ae}`,
4554
4554
  `a ${Ae} ${gt} 0 0 1 ${Ae} ${gt}`,
4555
4555
  `v ${je - 2 * gt}`,
@@ -4561,14 +4561,14 @@ const vr = Br(
4561
4561
  "Z"
4562
4562
  ].join(" ");
4563
4563
  }
4564
- return `M ${vt} ${Mt} h ${ht} v ${je} h ${-ht} Z`;
4564
+ return `M ${vt} ${Tt} h ${ht} v ${je} h ${-ht} Z`;
4565
4565
  }
4566
4566
  return "";
4567
4567
  }).filter(Boolean);
4568
4568
  if ($e.length !== 0)
4569
4569
  return `path(evenodd, "${He} ${$e.join(" ")}")`;
4570
- }, [N, L, X, ot, st, T]);
4571
- return Te(() => {
4570
+ }, [N, Y, X, ot, st, M]);
4571
+ return Me(() => {
4572
4572
  const ye = pe.current;
4573
4573
  if (ye)
4574
4574
  return No(ye);
@@ -4590,7 +4590,7 @@ const vr = Br(
4590
4590
  "aria-label": "Design editor canvas. Use mouse or touch to select, move, and resize elements.",
4591
4591
  ref: pe,
4592
4592
  onPointerDown: Wt,
4593
- onPointerMove: Tn,
4593
+ onPointerMove: Mn,
4594
4594
  onPointerUp: Cn,
4595
4595
  onPointerCancel: Cn,
4596
4596
  onDoubleClick: Sr,
@@ -4609,9 +4609,9 @@ const vr = Br(
4609
4609
  // products keep the legacy editor-surface fill so the
4610
4610
  // design canvas still reads as a distinct surface.
4611
4611
  background: u ? "transparent" : "var(--color-canvas-bg)",
4612
- width: `${L * T}px`,
4613
- height: `${X * T}px`,
4614
- cursor: vn.isActive() && fe instanceof kn ? O : void 0,
4612
+ width: `${Y * M}px`,
4613
+ height: `${X * M}px`,
4614
+ cursor: vn.isActive() && fe instanceof kn ? z : void 0,
4615
4615
  position: "absolute",
4616
4616
  left: `${I}px`,
4617
4617
  top: `${g}px`,
@@ -4626,7 +4626,7 @@ const vr = Br(
4626
4626
  const je = fe.children.find((Ae) => Ae.id === Ft.current);
4627
4627
  je && (ye = je);
4628
4628
  }
4629
- const de = ye instanceof Qe ? ye : null, He = (de == null ? void 0 : de.fontSize) || 24, $e = (de == null ? void 0 : de.fontFamily) || "Arial", nt = (de == null ? void 0 : de.bold) || !1, vt = (de == null ? void 0 : de.italic) || !1, Mt = (de == null ? void 0 : de.textAlign) || "center", ht = /* @__PURE__ */ r(
4629
+ const de = ye instanceof Qe ? ye : null, He = (de == null ? void 0 : de.fontSize) || 24, $e = (de == null ? void 0 : de.fontFamily) || "Arial", nt = (de == null ? void 0 : de.bold) || !1, vt = (de == null ? void 0 : de.italic) || !1, Tt = (de == null ? void 0 : de.textAlign) || "center", ht = /* @__PURE__ */ r(
4630
4630
  "textarea",
4631
4631
  {
4632
4632
  ref: ae,
@@ -4638,7 +4638,7 @@ const vr = Br(
4638
4638
  const Jt = io.fromPlainText(Ae, {});
4639
4639
  F.current = Jt, R(Jt), ee(Ae);
4640
4640
  const jn = je.target.selectionEnd;
4641
- Y(jn), M(je.target.selectionStart), ge(je.target.selectionEnd);
4641
+ L(jn), T(je.target.selectionStart), ge(je.target.selectionEnd);
4642
4642
  return;
4643
4643
  }
4644
4644
  const gt = V, wn = _.clone();
@@ -4655,7 +4655,7 @@ const vr = Br(
4655
4655
  }
4656
4656
  F.current = wn, R(wn), ee(Ae);
4657
4657
  const pn = je.target.selectionEnd;
4658
- Y(pn), M(je.target.selectionStart), ge(je.target.selectionEnd), Z.current = pn;
4658
+ L(pn), T(je.target.selectionStart), ge(je.target.selectionEnd), Z.current = pn;
4659
4659
  const Sn = je.target;
4660
4660
  setTimeout(() => {
4661
4661
  Sn && document.activeElement === Sn && Sn.setSelectionRange(pn, pn);
@@ -4668,34 +4668,34 @@ const vr = Br(
4668
4668
  const Ae = Date.now();
4669
4669
  if (Ae - pt.current < h) return;
4670
4670
  pt.current = Ae, Ae - We.current >= re && (at.current = null);
4671
- const gt = pe.current.getBoundingClientRect(), wn = (je.clientX - gt.left) / T - ot, Vt = (je.clientY - gt.top) / T - st, Zt = fe.getVisualBoundingBox(), ln = fe.getRotationAnchor(), In = en.toRadiansInverse(fe.rotation), Pn = wn - ln.x, pn = Vt - ln.y, Sn = Math.cos(In), Jt = Math.sin(In), jn = Pn * Sn - pn * Jt, ws = Pn * Jt + pn * Sn, Ss = jn + Zt.width / 2, Nn = ws + Zt.height / 2, rn = Rn(fe, { x: Ss, y: Nn });
4672
- Ae - Ee.current < lt ? Me.current += 1 : Me.current = 1, Ee.current = Ae;
4671
+ const gt = pe.current.getBoundingClientRect(), wn = (je.clientX - gt.left) / M - ot, Vt = (je.clientY - gt.top) / M - st, Zt = fe.getVisualBoundingBox(), ln = fe.getRotationAnchor(), In = en.toRadiansInverse(fe.rotation), Pn = wn - ln.x, pn = Vt - ln.y, Sn = Math.cos(In), Jt = Math.sin(In), jn = Pn * Sn - pn * Jt, ws = Pn * Jt + pn * Sn, Ss = jn + Zt.width / 2, Nn = ws + Zt.height / 2, rn = Rn(fe, { x: Ss, y: Nn });
4672
+ Ae - Ee.current < lt ? Te.current += 1 : Te.current = 1, Ee.current = Ae;
4673
4673
  const mn = V;
4674
- if (E.current = !1, Me.current >= 3)
4675
- je.preventDefault(), We.current = Ae, at.current = { start: 0, end: mn.length, cursor: mn.length }, De.current = !0, Me.current = 0, Z.current = 0, Y(mn.length), M(0), ge(mn.length), ae.current && (ae.current.focus(), ae.current.setSelectionRange(0, mn.length));
4676
- else if (Me.current === 2) {
4674
+ if (E.current = !1, Te.current >= 3)
4675
+ je.preventDefault(), We.current = Ae, at.current = { start: 0, end: mn.length, cursor: mn.length }, De.current = !0, Te.current = 0, Z.current = 0, L(mn.length), T(0), ge(mn.length), ae.current && (ae.current.focus(), ae.current.setSelectionRange(0, mn.length));
4676
+ else if (Te.current === 2) {
4677
4677
  je.preventDefault();
4678
4678
  const dn = br(mn, rn);
4679
- We.current = Ae, at.current = { start: dn.start, end: dn.end, cursor: dn.end }, De.current = !0, Z.current = dn.start, Y(dn.end), M(dn.start), ge(dn.end), ae.current && (ae.current.focus(), ae.current.setSelectionRange(dn.start, dn.end));
4679
+ We.current = Ae, at.current = { start: dn.start, end: dn.end, cursor: dn.end }, De.current = !0, Z.current = dn.start, L(dn.end), T(dn.start), ge(dn.end), ae.current && (ae.current.focus(), ae.current.setSelectionRange(dn.start, dn.end));
4680
4680
  } else
4681
- at.current = null, Z.current = rn, M(rn), Y(rn), ge(rn), ae.current && (ae.current.focus(), ae.current.setSelectionRange(rn, rn)), De.current = !1;
4681
+ at.current = null, Z.current = rn, T(rn), L(rn), ge(rn), ae.current && (ae.current.focus(), ae.current.setSelectionRange(rn, rn)), De.current = !1;
4682
4682
  },
4683
4683
  onPointerMove: (je) => {
4684
4684
  if (je.buttons !== 1) return;
4685
4685
  if (ct.current && fe instanceof Qe && pe.current) {
4686
- const Zn = pe.current.getBoundingClientRect(), mn = (je.clientX - Zn.left) / T - ot, dn = (je.clientY - Zn.top) / T - st, zs = fe.getVisualBoundingBox(), Os = fe.getRotationAnchor(), Xs = en.toRadiansInverse(fe.rotation), Ls = mn - Os.x, Ys = dn - Os.y, Hs = Math.cos(Xs), _s = Math.sin(Xs), Rr = Ls * Hs - Ys * _s, Mr = Ls * _s + Ys * Hs, gn = At.current;
4686
+ const Zn = pe.current.getBoundingClientRect(), mn = (je.clientX - Zn.left) / M - ot, dn = (je.clientY - Zn.top) / M - st, Os = fe.getVisualBoundingBox(), zs = fe.getRotationAnchor(), Xs = en.toRadiansInverse(fe.rotation), Ys = mn - zs.x, Ls = dn - zs.y, Hs = Math.cos(Xs), _s = Math.sin(Xs), Rr = Ys * Hs - Ls * _s, Tr = Ys * _s + Ls * Hs, gn = At.current;
4687
4687
  let Es = 0;
4688
4688
  ct.current === "start" && (gn != null && gn.start) ? Es = gn.start.textEdge.y - gn.start.center.y : ct.current === "end" && (gn != null && gn.end) && (Es = gn.end.textEdge.y - gn.end.center.y);
4689
- const Tr = Rr + zs.width / 2, Ir = Mr + Es + zs.height / 2, xn = Rn(fe, { x: Tr, y: Ir });
4690
- if (ct.current === "start" ? xn <= j ? (M(xn), Y(xn)) : (M(j), ge(xn), Y(xn), ct.current = "end") : xn >= q ? (ge(xn), Y(xn)) : (ge(q), M(xn), Y(xn), ct.current = "start"), ae.current) {
4689
+ const Mr = Rr + Os.width / 2, Ir = Tr + Es + Os.height / 2, xn = Rn(fe, { x: Mr, y: Ir });
4690
+ if (ct.current === "start" ? xn <= j ? (T(xn), L(xn)) : (T(j), ge(xn), L(xn), ct.current = "end") : xn >= q ? (ge(xn), L(xn)) : (ge(q), T(xn), L(xn), ct.current = "start"), ae.current) {
4691
4691
  const Pr = Math.min(q, j), Ar = Math.max(q, j);
4692
4692
  ae.current.setSelectionRange(Pr, Ar);
4693
4693
  }
4694
4694
  return;
4695
4695
  }
4696
4696
  if (De.current || !fe || !(fe instanceof Qe) || !pe.current) return;
4697
- const Ae = pe.current.getBoundingClientRect(), gt = (je.clientX - Ae.left) / T - ot, wn = (je.clientY - Ae.top) / T - st, Vt = fe.getVisualBoundingBox(), Zt = fe.getRotationAnchor(), ln = en.toRadiansInverse(fe.rotation), In = gt - Zt.x, Pn = wn - Zt.y, pn = Math.cos(ln), Sn = Math.sin(ln), Jt = In * pn - Pn * Sn, jn = In * Sn + Pn * pn, ws = Jt + Vt.width / 2, Ss = jn + Vt.height / 2, Nn = Rn(fe, { x: ws, y: Ss }), rn = Z.current;
4698
- if (rn !== Nn && (E.current = !0), ge(Nn), Y(Nn), M(rn), ae.current) {
4697
+ const Ae = pe.current.getBoundingClientRect(), gt = (je.clientX - Ae.left) / M - ot, wn = (je.clientY - Ae.top) / M - st, Vt = fe.getVisualBoundingBox(), Zt = fe.getRotationAnchor(), ln = en.toRadiansInverse(fe.rotation), In = gt - Zt.x, Pn = wn - Zt.y, pn = Math.cos(ln), Sn = Math.sin(ln), Jt = In * pn - Pn * Sn, jn = In * Sn + Pn * pn, ws = Jt + Vt.width / 2, Ss = jn + Vt.height / 2, Nn = Rn(fe, { x: ws, y: Ss }), rn = Z.current;
4698
+ if (rn !== Nn && (E.current = !0), ge(Nn), L(Nn), T(rn), ae.current) {
4699
4699
  const Zn = Math.min(rn, Nn), mn = Math.max(rn, Nn);
4700
4700
  ae.current.setSelectionRange(Zn, mn);
4701
4701
  }
@@ -4716,11 +4716,11 @@ const vr = Br(
4716
4716
  top: `${et.y}px`,
4717
4717
  width: `${et.width}px`,
4718
4718
  height: `${et.height || 50}px`,
4719
- fontSize: `${He * T}px`,
4719
+ fontSize: `${He * M}px`,
4720
4720
  fontFamily: `"${$e}", Arial, sans-serif`,
4721
4721
  fontWeight: nt ? 700 : 400,
4722
4722
  fontStyle: vt ? "italic" : "normal",
4723
- textAlign: Mt,
4723
+ textAlign: Tt,
4724
4724
  lineHeight: 1.2,
4725
4725
  opacity: 0,
4726
4726
  zIndex: 1001,
@@ -4745,7 +4745,7 @@ const vr = Br(
4745
4745
  }
4746
4746
  );
4747
4747
  vr.displayName = "CanvasEditor";
4748
- const Oi = mr(
4748
+ const zi = mr(
4749
4749
  "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",
4750
4750
  {
4751
4751
  variants: {
@@ -4797,7 +4797,7 @@ function _n({
4797
4797
  "div",
4798
4798
  {
4799
4799
  className: Vn(
4800
- Oi({ variant: C, size: n }),
4800
+ zi({ variant: C, size: n }),
4801
4801
  x.secondary,
4802
4802
  x.outline,
4803
4803
  e
@@ -4838,7 +4838,7 @@ function _n({
4838
4838
  }
4839
4839
  );
4840
4840
  }
4841
- const On = Wn.forwardRef(
4841
+ const zn = Wn.forwardRef(
4842
4842
  ({ className: e, disabled: t, children: n, ...s }, o) => /* @__PURE__ */ r(
4843
4843
  "fieldset",
4844
4844
  {
@@ -4855,7 +4855,7 @@ const On = Wn.forwardRef(
4855
4855
  }
4856
4856
  )
4857
4857
  );
4858
- On.displayName = "Fieldset";
4858
+ zn.displayName = "Fieldset";
4859
4859
  const Xi = Wn.forwardRef(
4860
4860
  ({ className: e, children: t, ...n }, s) => /* @__PURE__ */ r(
4861
4861
  "legend",
@@ -4870,7 +4870,7 @@ const Xi = Wn.forwardRef(
4870
4870
  Xi.displayName = "Legend";
4871
4871
  const os = Wn.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ r(ss.Root, { className: Vn("sc:grid sc:gap-2", e), ...t, ref: n }));
4872
4872
  os.displayName = ss.Root.displayName;
4873
- const Ts = Wn.forwardRef(({ className: e, variant: t, ...n }, s) => {
4873
+ const Ms = Wn.forwardRef(({ className: e, variant: t, ...n }, s) => {
4874
4874
  const o = ar(), i = t ?? (o.variant === "default" ? "filled" : "default");
4875
4875
  return /* @__PURE__ */ r(
4876
4876
  ss.Item,
@@ -4891,10 +4891,10 @@ const Ts = Wn.forwardRef(({ className: e, variant: t, ...n }, s) => {
4891
4891
  }
4892
4892
  );
4893
4893
  });
4894
- Ts.displayName = ss.Item.displayName;
4894
+ Ms.displayName = ss.Item.displayName;
4895
4895
  const Kt = Wn.forwardRef(
4896
4896
  ({ children: e, className: t, variant: n, ...s }, o) => e ? /* @__PURE__ */ y("div", { className: "sc:flex sc:items-center sc:space-x-2", children: [
4897
- /* @__PURE__ */ r(Ts, { ref: o, variant: n, ...s }),
4897
+ /* @__PURE__ */ r(Ms, { ref: o, variant: n, ...s }),
4898
4898
  /* @__PURE__ */ r(
4899
4899
  "label",
4900
4900
  {
@@ -4903,10 +4903,10 @@ const Kt = Wn.forwardRef(
4903
4903
  children: e
4904
4904
  }
4905
4905
  )
4906
- ] }) : /* @__PURE__ */ r(Ts, { ref: o, className: t, variant: n, ...s })
4906
+ ] }) : /* @__PURE__ */ r(Ms, { ref: o, className: t, variant: n, ...s })
4907
4907
  );
4908
4908
  Kt.displayName = "Radio";
4909
- const Li = mr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-spin sc:size-6 sc:text-primary", {
4909
+ const Yi = mr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-spin sc:size-6 sc:text-primary", {
4910
4910
  variants: {
4911
4911
  size: {
4912
4912
  sm: "sc:size-4",
@@ -4924,14 +4924,14 @@ const Li = mr("sc:pointer-events-none sc:relative sc:origin-center sc:animate-sp
4924
4924
  }
4925
4925
  }
4926
4926
  });
4927
- function Yi({ className: e, size: t, color: n, label: s = "Loading", ...o }) {
4927
+ function Li({ className: e, size: t, color: n, label: s = "Loading", ...o }) {
4928
4928
  const i = Wn.useId();
4929
4929
  return /* @__PURE__ */ r(
4930
4930
  "span",
4931
4931
  {
4932
4932
  role: "status",
4933
4933
  "aria-label": s,
4934
- className: Vn(Li({ size: t, color: n }), e),
4934
+ className: Vn(Yi({ size: t, color: n }), e),
4935
4935
  ...o,
4936
4936
  children: /* @__PURE__ */ y("svg", { viewBox: "0 0 24 24", className: "sc:size-full", "aria-hidden": !0, children: [
4937
4937
  /* @__PURE__ */ y("defs", { children: [
@@ -4988,17 +4988,17 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
4988
4988
  groupLayers: k,
4989
4989
  ungroupLayer: S,
4990
4990
  findElementById: A
4991
- } = ir(), T = or(), I = Se(null);
4992
- Te(() => {
4991
+ } = ir(), M = or(), I = Se(null);
4992
+ Me(() => {
4993
4993
  var u;
4994
4994
  (u = I.current) == null || u.focus();
4995
- }, []), Te(() => {
4995
+ }, []), Me(() => {
4996
4996
  const u = (Q) => {
4997
4997
  I.current && Q.target instanceof Node && I.current.contains(Q.target) || t();
4998
4998
  };
4999
4999
  return document.addEventListener("pointerdown", u), () => document.removeEventListener("pointerdown", u);
5000
5000
  }, [t]);
5001
- const g = e.targetId ? A(e.targetId) : null, P = ys(() => e.targetId ? n.length > 1 && n.includes(e.targetId) ? n : [e.targetId] : [], [e.targetId, n]), z = !!(g != null && g.locked), D = P.some((u) => {
5001
+ const g = e.targetId ? A(e.targetId) : null, P = ys(() => e.targetId ? n.length > 1 && n.includes(e.targetId) ? n : [e.targetId] : [], [e.targetId, n]), O = !!(g != null && g.locked), D = P.some((u) => {
5002
5002
  var Q;
5003
5003
  return !!((Q = A(u)) != null && Q.locked);
5004
5004
  }), v = g instanceof Re, se = P.length > 1, K = (u) => () => {
@@ -5026,7 +5026,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5026
5026
  Qt,
5027
5027
  {
5028
5028
  "data-testid": "context-menu-copy",
5029
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.copy, className: "sc:size-3.5" }),
5029
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.copy, className: "sc:size-3.5" }),
5030
5030
  label: "Copy",
5031
5031
  shortcut: `${Qn}C`,
5032
5032
  onClick: K(() => s())
@@ -5036,7 +5036,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5036
5036
  Qt,
5037
5037
  {
5038
5038
  "data-testid": "context-menu-paste",
5039
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.paste, className: "sc:size-3.5" }),
5039
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.paste, className: "sc:size-3.5" }),
5040
5040
  label: "Paste",
5041
5041
  shortcut: `${Qn}V`,
5042
5042
  disabled: !i,
@@ -5047,7 +5047,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5047
5047
  Qt,
5048
5048
  {
5049
5049
  "data-testid": "context-menu-duplicate",
5050
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.copy, className: "sc:size-3.5" }),
5050
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.copy, className: "sc:size-3.5" }),
5051
5051
  label: "Duplicate",
5052
5052
  shortcut: `${Qn}D`,
5053
5053
  onClick: K(() => P.forEach((u) => d(u)))
@@ -5058,8 +5058,8 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5058
5058
  Qt,
5059
5059
  {
5060
5060
  "data-testid": "context-menu-lock",
5061
- icon: /* @__PURE__ */ r(Oe, { icon: z ? Fe.lockOpen : Fe.lock, className: "sc:size-3.5" }),
5062
- label: z ? "Unlock" : "Lock",
5061
+ icon: /* @__PURE__ */ r(ze, { icon: O ? Fe.lockOpen : Fe.lock, className: "sc:size-3.5" }),
5062
+ label: O ? "Unlock" : "Lock",
5063
5063
  onClick: K(() => P.forEach((u) => p(u)))
5064
5064
  }
5065
5065
  ),
@@ -5068,9 +5068,9 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5068
5068
  Qt,
5069
5069
  {
5070
5070
  "data-testid": "context-menu-bring-to-front",
5071
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.layerForward, className: "sc:size-3.5" }),
5071
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.layerForward, className: "sc:size-3.5" }),
5072
5072
  label: "Bring to Front",
5073
- disabled: z,
5073
+ disabled: O,
5074
5074
  onClick: K(() => b(e.targetId))
5075
5075
  }
5076
5076
  ),
@@ -5078,9 +5078,9 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5078
5078
  Qt,
5079
5079
  {
5080
5080
  "data-testid": "context-menu-bring-forward",
5081
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.arrowUp, className: "sc:size-3.5" }),
5081
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.arrowUp, className: "sc:size-3.5" }),
5082
5082
  label: "Bring Forward",
5083
- disabled: z,
5083
+ disabled: O,
5084
5084
  onClick: K(() => C(e.targetId))
5085
5085
  }
5086
5086
  ),
@@ -5088,9 +5088,9 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5088
5088
  Qt,
5089
5089
  {
5090
5090
  "data-testid": "context-menu-send-backward",
5091
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.arrowDown, className: "sc:size-3.5" }),
5091
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.arrowDown, className: "sc:size-3.5" }),
5092
5092
  label: "Send Backward",
5093
- disabled: z,
5093
+ disabled: O,
5094
5094
  onClick: K(() => x(e.targetId))
5095
5095
  }
5096
5096
  ),
@@ -5098,9 +5098,9 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5098
5098
  Qt,
5099
5099
  {
5100
5100
  "data-testid": "context-menu-send-to-back",
5101
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.layerBackward, className: "sc:size-3.5" }),
5101
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.layerBackward, className: "sc:size-3.5" }),
5102
5102
  label: "Send to Back",
5103
- disabled: z,
5103
+ disabled: O,
5104
5104
  onClick: K(() => w(e.targetId))
5105
5105
  }
5106
5106
  ),
@@ -5109,7 +5109,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5109
5109
  Qt,
5110
5110
  {
5111
5111
  "data-testid": "context-menu-group",
5112
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.group, className: "sc:size-3.5" }),
5112
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.group, className: "sc:size-3.5" }),
5113
5113
  label: "Group",
5114
5114
  disabled: D,
5115
5115
  onClick: K(() => k(P))
@@ -5119,9 +5119,9 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5119
5119
  Qt,
5120
5120
  {
5121
5121
  "data-testid": "context-menu-ungroup",
5122
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.ungroup, className: "sc:size-3.5" }),
5122
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.ungroup, className: "sc:size-3.5" }),
5123
5123
  label: "Ungroup",
5124
- disabled: z,
5124
+ disabled: O,
5125
5125
  onClick: K(() => S(e.targetId))
5126
5126
  }
5127
5127
  ),
@@ -5130,14 +5130,14 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5130
5130
  Qt,
5131
5131
  {
5132
5132
  "data-testid": "context-menu-delete",
5133
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.trash, className: "sc:size-3.5" }),
5133
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.trash, className: "sc:size-3.5" }),
5134
5134
  label: "Delete",
5135
5135
  shortcut: "Del",
5136
5136
  className: "sc:text-[#d32f2f] sc:hover:bg-[rgba(211,47,47,0.1)] sc:hover:text-[#c62828]",
5137
5137
  onClick: K(() => {
5138
5138
  P.filter((u) => {
5139
5139
  var Q;
5140
- return !T((Q = A(u)) == null ? void 0 : Q.name);
5140
+ return !M((Q = A(u)) == null ? void 0 : Q.name);
5141
5141
  }).forEach((u) => m(u));
5142
5142
  })
5143
5143
  }
@@ -5147,7 +5147,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5147
5147
  Qt,
5148
5148
  {
5149
5149
  "data-testid": "context-menu-paste",
5150
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.paste, className: "sc:size-3.5" }),
5150
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.paste, className: "sc:size-3.5" }),
5151
5151
  label: "Paste",
5152
5152
  shortcut: `${Qn}V`,
5153
5153
  disabled: !i,
@@ -5158,7 +5158,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5158
5158
  Qt,
5159
5159
  {
5160
5160
  "data-testid": "context-menu-select-all",
5161
- icon: /* @__PURE__ */ r(Oe, { icon: Fe.selectAll, className: "sc:size-3.5" }),
5161
+ icon: /* @__PURE__ */ r(ze, { icon: Fe.selectAll, className: "sc:size-3.5" }),
5162
5162
  label: "Select All",
5163
5163
  shortcut: `${Qn}A`,
5164
5164
  onClick: K(
@@ -5178,7 +5178,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5178
5178
  /* @__PURE__ */ r("div", { className: "sc-root", style: { display: "contents" }, children: N }),
5179
5179
  document.body
5180
5180
  );
5181
- }, $i = 0.25, Fi = 8, Wi = 0.1, Vi = 4, Ki = 1e-3, Za = ({
5181
+ }, $i = 0.25, Fi = 8, Wi = 0.1, Vi = 4, Ki = 1e-3, Qa = ({
5182
5182
  className: e,
5183
5183
  style: t,
5184
5184
  width: n,
@@ -5202,12 +5202,12 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5202
5202
  elements: k,
5203
5203
  artboards: S,
5204
5204
  artboardManager: A,
5205
- handleElementUpdate: T,
5205
+ handleElementUpdate: M,
5206
5206
  setElements: I,
5207
5207
  executeElementUpdate: g
5208
5208
  } = is(), {
5209
5209
  zoom: P,
5210
- setZoom: z,
5210
+ setZoom: O,
5211
5211
  panOffset: D,
5212
5212
  setPanOffset: v,
5213
5213
  isPanning: se,
@@ -5223,12 +5223,12 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5223
5223
  handleActiveChildChange: pe,
5224
5224
  setHoveredElementId: ae,
5225
5225
  hideHandles: ve
5226
- } = Lr(), {
5226
+ } = Yr(), {
5227
5227
  setTextSelectionVersion: Ee,
5228
- setExpandedPanelType: Me
5229
- } = Yr(), Be = Ze.useCallback(() => {
5230
- Me("crop");
5231
- }, [Me]), De = Ze.useRef(null), [We, at] = Ze.useState(0), [pt, ct] = Ze.useState(0), [At, Xt] = Ze.useState(!1), Dt = Ze.useRef(P), Ve = Ze.useRef(!1), [ke, lt] = Ze.useState(!1), re = Ze.useRef(null);
5228
+ setExpandedPanelType: Te
5229
+ } = Lr(), Be = Ze.useCallback(() => {
5230
+ Te("crop");
5231
+ }, [Te]), De = Ze.useRef(null), [We, at] = Ze.useState(0), [pt, ct] = Ze.useState(0), [At, Xt] = Ze.useState(!1), Dt = Ze.useRef(P), Ve = Ze.useRef(!1), [ke, lt] = Ze.useState(!1), re = Ze.useRef(null);
5232
5232
  Io({ enabled: m });
5233
5233
  const [h, U] = Ze.useState(null), oe = Ze.useCallback(
5234
5234
  (H) => {
@@ -5243,13 +5243,13 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5243
5243
  (H) => {
5244
5244
  if (!(a || H.ctrlKey || H.metaKey)) return;
5245
5245
  H.preventDefault();
5246
- const ze = De.current;
5247
- if (!ze) return;
5248
- const _e = ze.getBoundingClientRect(), Le = H.clientX - _e.left, mt = H.clientY - _e.top, yt = -H.deltaY * Ki;
5246
+ const Oe = De.current;
5247
+ if (!Oe) return;
5248
+ const _e = Oe.getBoundingClientRect(), Ye = H.clientX - _e.left, mt = H.clientY - _e.top, yt = -H.deltaY * Ki;
5249
5249
  if (a) {
5250
5250
  const rt = We, it = Math.min(Math.max(rt * (1 + yt), Wi), Vi);
5251
5251
  if (it === rt) return;
5252
- const St = it / rt, fe = Le - (Le - D.x) * St, nn = mt - (mt - D.y) * St;
5252
+ const St = it / rt, fe = Ye - (Ye - D.x) * St, nn = mt - (mt - D.y) * St;
5253
5253
  at(it), v({ x: fe, y: nn });
5254
5254
  } else {
5255
5255
  const rt = N, it = Math.min(
@@ -5257,7 +5257,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5257
5257
  Fi
5258
5258
  );
5259
5259
  if (it === rt) return;
5260
- const St = it / rt, fe = Le - (Le - D.x) * St, nn = mt - (mt - D.y) * St;
5260
+ const St = it / rt, fe = Ye - (Ye - D.x) * St, nn = mt - (mt - D.y) * St;
5261
5261
  u(it), v({ x: fe, y: nn });
5262
5262
  }
5263
5263
  },
@@ -5269,10 +5269,10 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5269
5269
  return H.addEventListener("wheel", we, { passive: !1 }), () => H.removeEventListener("wheel", we);
5270
5270
  }, [we]), Ze.useEffect(() => {
5271
5271
  if (!a) return;
5272
- const H = (ze) => {
5273
- ze.code === "Space" && !ze.repeat && lt(!0);
5274
- }, be = (ze) => {
5275
- ze.code === "Space" && (lt(!1), re.current = null);
5272
+ const H = (Oe) => {
5273
+ Oe.code === "Space" && !Oe.repeat && lt(!0);
5274
+ }, be = (Oe) => {
5275
+ Oe.code === "Space" && (lt(!1), re.current = null);
5276
5276
  };
5277
5277
  return window.addEventListener("keydown", H), window.addEventListener("keyup", be), () => {
5278
5278
  window.removeEventListener("keydown", H), window.removeEventListener("keyup", be);
@@ -5281,8 +5281,8 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5281
5281
  const Ie = Ze.useCallback(
5282
5282
  (H) => {
5283
5283
  if (!a) return;
5284
- const be = H.button === 1, ze = ke && H.button === 0;
5285
- (be || ze) && (H.preventDefault(), H.target.setPointerCapture(H.pointerId), K(!0), re.current = {
5284
+ const be = H.button === 1, Oe = ke && H.button === 0;
5285
+ (be || Oe) && (H.preventDefault(), H.target.setPointerCapture(H.pointerId), K(!0), re.current = {
5286
5286
  x: H.clientX,
5287
5287
  y: H.clientY,
5288
5288
  panX: D.x,
@@ -5293,14 +5293,14 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5293
5293
  ), Ke = Ze.useCallback(
5294
5294
  (H) => {
5295
5295
  if (!se || !re.current) return;
5296
- const be = H.clientX - re.current.x, ze = H.clientY - re.current.y;
5296
+ const be = H.clientX - re.current.x, Oe = H.clientY - re.current.y;
5297
5297
  v({
5298
5298
  x: re.current.panX + be,
5299
- y: re.current.panY + ze
5299
+ y: re.current.panY + Oe
5300
5300
  });
5301
5301
  },
5302
5302
  [se, v]
5303
- ), Ye = Ze.useCallback((H) => {
5303
+ ), Le = Ze.useCallback((H) => {
5304
5304
  se && (H && H.target.releasePointerCapture(H.pointerId), K(!1), re.current = null);
5305
5305
  }, [se, K]);
5306
5306
  Ze.useEffect(() => {
@@ -5310,7 +5310,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5310
5310
  };
5311
5311
  return window.addEventListener("pointerup", H), () => window.removeEventListener("pointerup", H);
5312
5312
  }, [a, se, K]);
5313
- const L = Ze.useMemo(() => {
5313
+ const Y = Ze.useMemo(() => {
5314
5314
  if (!x || !C) return null;
5315
5315
  const H = C.pieces ?? [];
5316
5316
  if (H.length <= 1) return null;
@@ -5321,9 +5321,9 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5321
5321
  width: $.width,
5322
5322
  height: $.height
5323
5323
  } : null;
5324
- const be = H.find((ze) => ze.id === x.pieceId);
5324
+ const be = H.find((Oe) => Oe.id === x.pieceId);
5325
5325
  return be ? { x: be.x, y: be.y, width: be.width, height: be.height } : null;
5326
- }, [x, C, $]), X = Do(L);
5326
+ }, [x, C, $]), X = Do(Y);
5327
5327
  Ze.useEffect(() => {
5328
5328
  if (o !== void 0) {
5329
5329
  at(o);
@@ -5334,8 +5334,8 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5334
5334
  let H = 0;
5335
5335
  const be = () => {
5336
5336
  if (!De.current || !$) return;
5337
- const Le = De.current.clientWidth;
5338
- if (Le === 0)
5337
+ const Ye = De.current.clientWidth;
5338
+ if (Ye === 0)
5339
5339
  return;
5340
5340
  let mt = $.width, yt = $.height;
5341
5341
  if (x && x !== "spread" && C) {
@@ -5347,29 +5347,29 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5347
5347
  }
5348
5348
  let rt, it = !1;
5349
5349
  if (c !== void 0) {
5350
- const St = Le - c * 2, fe = Math.min(St / mt, 1);
5350
+ const St = Ye - c * 2, fe = Math.min(St / mt, 1);
5351
5351
  if (X && f !== void 0) {
5352
5352
  const nn = f - c * 2, yn = Math.min(nn / yt, 1);
5353
5353
  rt = Math.min(fe, yn), it = yn <= fe;
5354
5354
  } else if (rt = fe, f !== void 0 && yt * rt + c * 2 > f) {
5355
- const Ln = (f - c * 2) / yt;
5356
- rt = Math.min(rt, Ln, 1), it = !0;
5355
+ const Yn = (f - c * 2) / yt;
5356
+ rt = Math.min(rt, Yn, 1), it = !0;
5357
5357
  }
5358
5358
  } else
5359
- rt = Math.min(Le * i / mt, 1);
5360
- at(rt), ct(Le), Xt(it);
5359
+ rt = Math.min(Ye * i / mt, 1);
5360
+ at(rt), ct(Ye), Xt(it);
5361
5361
  };
5362
- let ze = !1;
5362
+ let Oe = !1;
5363
5363
  Ve.current ? be() : H = requestAnimationFrame(() => {
5364
5364
  H = requestAnimationFrame(() => {
5365
- ze || (be(), Ve.current = !0);
5365
+ Oe || (be(), Ve.current = !0);
5366
5366
  });
5367
5367
  });
5368
5368
  const _e = new ResizeObserver(() => {
5369
5369
  be();
5370
5370
  });
5371
5371
  return _e.observe(De.current), () => {
5372
- ze = !0, cancelAnimationFrame(H), _e.disconnect();
5372
+ Oe = !0, cancelAnimationFrame(H), _e.disconnect();
5373
5373
  };
5374
5374
  }, [o, $, i, c, f, x, C, X]);
5375
5375
  const ot = We > 0 && N > 0 ? We * N : We;
@@ -5384,8 +5384,8 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5384
5384
  Dt.current = P;
5385
5385
  }
5386
5386
  }, [a, P, We, u]), Ze.useEffect(() => {
5387
- ot <= 0 || (Dt.current = ot, z(ot));
5388
- }, [ot, z]);
5387
+ ot <= 0 || (Dt.current = ot, O(ot));
5388
+ }, [ot, O]);
5389
5389
  const st = Ze.useRef(null);
5390
5390
  Ze.useEffect(() => {
5391
5391
  const H = X && "id" in X ? X.id ?? null : null;
@@ -5394,7 +5394,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5394
5394
  const Je = X ? X.width : ($ == null ? void 0 : $.width) ?? 0, xt = X ? X.height : ($ == null ? void 0 : $.height) ?? 0, Nt = Je * ot, Bt = xt * ot, tn = Je * We;
5395
5395
  let Ht = $ ? c !== void 0 ? Bt + c * 2 : Bt / i : 0;
5396
5396
  f !== void 0 && Ht > f && (Ht = f);
5397
- let wt = c, Lt = c;
5397
+ let wt = c, Yt = c;
5398
5398
  const on = ((qe = De.current) == null ? void 0 : qe.clientWidth) || pt;
5399
5399
  c !== void 0 && At && on > 0 && tn > 0 && (wt = (on - tn) / 2);
5400
5400
  const an = Ht, Ut = Ze.useRef({ w: 0, h: 0 });
@@ -5405,8 +5405,8 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5405
5405
  w: H.clientWidth,
5406
5406
  h: H.clientHeight
5407
5407
  };
5408
- const be = new ResizeObserver((ze) => {
5409
- const _e = ze[0];
5408
+ const be = new ResizeObserver((Oe) => {
5409
+ const _e = Oe[0];
5410
5410
  _e && (Ut.current = {
5411
5411
  w: _e.contentRect.width,
5412
5412
  h: _e.contentRect.height
@@ -5421,7 +5421,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5421
5421
  }
5422
5422
  const H = Ut.current.w, be = Ut.current.h;
5423
5423
  if (H === 0 || be === 0 || Nt === 0 || Bt === 0) return;
5424
- const ze = 0.25 * Math.min(Nt, H), _e = 0.25 * Math.min(Bt, be), Le = ze - (wt ?? 0) - Nt, mt = H - ze - (wt ?? 0), yt = _e - (Lt ?? 0) - Bt, rt = be - _e - (Lt ?? 0), it = Math.max(Le, Math.min(mt, D.x)), St = Math.max(yt, Math.min(rt, D.y));
5424
+ const Oe = 0.25 * Math.min(Nt, H), _e = 0.25 * Math.min(Bt, be), Ye = Oe - (wt ?? 0) - Nt, mt = H - Oe - (wt ?? 0), yt = _e - (Yt ?? 0) - Bt, rt = be - _e - (Yt ?? 0), it = Math.max(Ye, Math.min(mt, D.x)), St = Math.max(yt, Math.min(rt, D.y));
5425
5425
  (it !== D.x || St !== D.y) && v({ x: it, y: St });
5426
5426
  }, [
5427
5427
  a,
@@ -5430,7 +5430,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5430
5430
  Nt,
5431
5431
  Bt,
5432
5432
  wt,
5433
- Lt,
5433
+ Yt,
5434
5434
  v
5435
5435
  ]);
5436
5436
  const Ue = a ? {
@@ -5483,12 +5483,12 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5483
5483
  style: Ue,
5484
5484
  onPointerDown: a ? Ie : void 0,
5485
5485
  onPointerMove: a ? Ke : void 0,
5486
- onPointerUp: a ? Ye : void 0,
5487
- onPointerLeave: a ? Ye : void 0,
5488
- onPointerCancel: a ? Ye : void 0,
5486
+ onPointerUp: a ? Le : void 0,
5487
+ onPointerLeave: a ? Le : void 0,
5488
+ onPointerCancel: a ? Le : void 0,
5489
5489
  children: [
5490
5490
  /* @__PURE__ */ y("div", { style: Ge, children: [
5491
- /* @__PURE__ */ r(zr, {}),
5491
+ /* @__PURE__ */ r(Or, {}),
5492
5492
  /* @__PURE__ */ r(
5493
5493
  vr,
5494
5494
  {
@@ -5498,7 +5498,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5498
5498
  artboardManager: A,
5499
5499
  selectedId: G,
5500
5500
  multiSelection: te,
5501
- onElementUpdate: T,
5501
+ onElementUpdate: M,
5502
5502
  setElements: I,
5503
5503
  executeElementUpdate: g,
5504
5504
  onSelectionChange: ce,
@@ -5517,7 +5517,7 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5517
5517
  artboardBorderRadius: l,
5518
5518
  fixedMargin: c,
5519
5519
  fixedMarginX: wt,
5520
- fixedMarginY: Lt,
5520
+ fixedMarginY: Yt,
5521
5521
  showRotationHandle: d,
5522
5522
  canvasCutouts: p,
5523
5523
  pieceGuides: C,
@@ -5541,10 +5541,10 @@ const Hi = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
5541
5541
  u(H);
5542
5542
  return;
5543
5543
  }
5544
- const ze = be.getBoundingClientRect(), _e = ze.width / 2, Le = ze.height / 2, mt = H / Math.max(N, 1e-4);
5544
+ const Oe = be.getBoundingClientRect(), _e = Oe.width / 2, Ye = Oe.height / 2, mt = H / Math.max(N, 1e-4);
5545
5545
  u(H), v({
5546
5546
  x: _e - (_e - D.x) * mt,
5547
- y: Le - (Le - D.y) * mt
5547
+ y: Ye - (Ye - D.y) * mt
5548
5548
  });
5549
5549
  }
5550
5550
  }
@@ -5648,20 +5648,20 @@ const cs = /* @__PURE__ */ new Map();
5648
5648
  function Pt(e, t) {
5649
5649
  cs.set(e, t);
5650
5650
  }
5651
- function Ja(e) {
5651
+ function ec(e) {
5652
5652
  return cs.get(e);
5653
5653
  }
5654
- function Qa() {
5654
+ function tc() {
5655
5655
  return Array.from(cs.keys());
5656
5656
  }
5657
- function ec() {
5657
+ function nc() {
5658
5658
  return Array.from(cs.entries());
5659
5659
  }
5660
- function tc(e) {
5660
+ function sc(e) {
5661
5661
  cs.delete(e);
5662
5662
  }
5663
5663
  let Cs = !1;
5664
- async function nc() {
5664
+ async function rc() {
5665
5665
  if (Cs) return;
5666
5666
  Cs = !0, Cr();
5667
5667
  const [
@@ -5747,7 +5747,7 @@ function Cr() {
5747
5747
  position: "topbar"
5748
5748
  });
5749
5749
  }
5750
- function sc(e) {
5750
+ function oc(e) {
5751
5751
  Cs || (Cs = !0, Cr(), Pt("effects-panel", {
5752
5752
  component: e.EffectsPanel,
5753
5753
  label: "Effects",
@@ -5831,14 +5831,14 @@ const qi = ({ stroke: e, onChange: t }) => {
5831
5831
  /* @__PURE__ */ r(rr, { checked: o, onCheckedChange: d })
5832
5832
  ] }) }),
5833
5833
  /* @__PURE__ */ y(As, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
5834
- /* @__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: [
5834
+ /* @__PURE__ */ r(zn, { className: "sc:flex sc:flex-col sc:gap-sm", children: /* @__PURE__ */ y("div", { className: "sc:flex sc:items-center sc:justify-between", children: [
5835
5835
  /* @__PURE__ */ r(It, { children: "Color" }),
5836
- /* @__PURE__ */ r(Or, { value: i, onChange: m })
5836
+ /* @__PURE__ */ r(zr, { value: i, onChange: m })
5837
5837
  ] }) }),
5838
5838
  /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
5839
5839
  /* @__PURE__ */ r(It, { children: "Width" }),
5840
5840
  /* @__PURE__ */ r(
5841
- Tt,
5841
+ Mt,
5842
5842
  {
5843
5843
  value: [a],
5844
5844
  onValueChange: p,
@@ -5855,7 +5855,7 @@ const qi = ({ stroke: e, onChange: t }) => {
5855
5855
  /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
5856
5856
  /* @__PURE__ */ r(It, { children: "Opacity" }),
5857
5857
  /* @__PURE__ */ r(
5858
- Tt,
5858
+ Mt,
5859
5859
  {
5860
5860
  value: [f],
5861
5861
  onValueChange: C,
@@ -5870,7 +5870,7 @@ const qi = ({ stroke: e, onChange: t }) => {
5870
5870
  ] })
5871
5871
  ] }),
5872
5872
  /* @__PURE__ */ y(Vr, { delayDuration: 300, children: [
5873
- /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
5873
+ /* @__PURE__ */ y(zn, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
5874
5874
  /* @__PURE__ */ r(It, { children: "Line Cap" }),
5875
5875
  /* @__PURE__ */ y(os, { value: l, onValueChange: x, orientation: "horizontal", children: [
5876
5876
  /* @__PURE__ */ y(un, { children: [
@@ -5887,7 +5887,7 @@ const qi = ({ stroke: e, onChange: t }) => {
5887
5887
  ] })
5888
5888
  ] })
5889
5889
  ] }),
5890
- /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
5890
+ /* @__PURE__ */ y(zn, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
5891
5891
  /* @__PURE__ */ r(It, { children: "Line Join" }),
5892
5892
  /* @__PURE__ */ y(os, { value: c, onValueChange: b, orientation: "horizontal", children: [
5893
5893
  /* @__PURE__ */ y(un, { children: [
@@ -5908,7 +5908,7 @@ const qi = ({ stroke: e, onChange: t }) => {
5908
5908
  ] })
5909
5909
  ] });
5910
5910
  }, ji = ({ mask: e, index: t, isFirst: n, isLast: s, onUpdate: o, onRemove: i, onReorder: a }) => {
5911
- var T;
5911
+ var M;
5912
5912
  const [l, c] = le(!1), f = (I) => {
5913
5913
  switch (I) {
5914
5914
  case "clip":
@@ -6129,7 +6129,7 @@ const qi = ({ stroke: e, onChange: t }) => {
6129
6129
  ] }),
6130
6130
  l && /* @__PURE__ */ y("div", { className: "sc:mt-xl sc:flex sc:flex-col sc:gap-xl sc:border-t sc:border-border-secondary sc:pt-xl", children: [
6131
6131
  /* @__PURE__ */ y(
6132
- Tt,
6132
+ Mt,
6133
6133
  {
6134
6134
  className: "slider-no-fill",
6135
6135
  value: [e.opacity || 1],
@@ -6139,14 +6139,14 @@ const qi = ({ stroke: e, onChange: t }) => {
6139
6139
  step: 0.01,
6140
6140
  children: [
6141
6141
  /* @__PURE__ */ r(It, { children: "Opacity" }),
6142
- /* @__PURE__ */ r(Tt.Output, { children: ({ state: I }) => `${Math.round(I.values[0] * 100)}%` }),
6143
- /* @__PURE__ */ r(Tt.Track, {}),
6144
- /* @__PURE__ */ r(Tt.Thumb, {})
6142
+ /* @__PURE__ */ r(Mt.Output, { children: ({ state: I }) => `${Math.round(I.values[0] * 100)}%` }),
6143
+ /* @__PURE__ */ r(Mt.Track, {}),
6144
+ /* @__PURE__ */ r(Mt.Thumb, {})
6145
6145
  ]
6146
6146
  }
6147
6147
  ),
6148
6148
  /* @__PURE__ */ y(
6149
- Tt,
6149
+ Mt,
6150
6150
  {
6151
6151
  className: "slider-no-fill",
6152
6152
  value: [e.feather || 0],
@@ -6156,9 +6156,9 @@ const qi = ({ stroke: e, onChange: t }) => {
6156
6156
  step: 1,
6157
6157
  children: [
6158
6158
  /* @__PURE__ */ r(It, { children: "Feather" }),
6159
- /* @__PURE__ */ r(Tt.Output, { children: ({ state: I }) => `${I.values[0]}px` }),
6160
- /* @__PURE__ */ r(Tt.Track, {}),
6161
- /* @__PURE__ */ r(Tt.Thumb, {})
6159
+ /* @__PURE__ */ r(Mt.Output, { children: ({ state: I }) => `${I.values[0]}px` }),
6160
+ /* @__PURE__ */ r(Mt.Track, {}),
6161
+ /* @__PURE__ */ r(Mt.Thumb, {})
6162
6162
  ]
6163
6163
  }
6164
6164
  ),
@@ -6199,7 +6199,7 @@ const qi = ({ stroke: e, onChange: t }) => {
6199
6199
  "select",
6200
6200
  {
6201
6201
  id: `mask-shape-${e.id}`,
6202
- value: ((T = e.maskElement.transformData) == null ? void 0 : T.shapeType) || "star",
6202
+ value: ((M = e.maskElement.transformData) == null ? void 0 : M.shapeType) || "star",
6203
6203
  onChange: b,
6204
6204
  className: "sc:w-full sc:cursor-pointer sc:rounded-md sc:border sc:border-border-dark sc:bg-bg-tertiary sc:px-md sc:py-sm sc:text-base sc:text-text-primary sc:transition-all sc:duration-base sc:hover:border-accent-primary sc:focus:border-accent-primary sc:focus:outline-none",
6205
6205
  children: [
@@ -6240,7 +6240,7 @@ const qi = ({ stroke: e, onChange: t }) => {
6240
6240
  )
6241
6241
  ] }),
6242
6242
  /* @__PURE__ */ y(
6243
- Tt,
6243
+ Mt,
6244
6244
  {
6245
6245
  className: "slider-no-fill",
6246
6246
  value: [A()],
@@ -6250,9 +6250,9 @@ const qi = ({ stroke: e, onChange: t }) => {
6250
6250
  step: 10,
6251
6251
  children: [
6252
6252
  /* @__PURE__ */ r(It, { children: "Size" }),
6253
- /* @__PURE__ */ r(Tt.Output, {}),
6254
- /* @__PURE__ */ r(Tt.Track, {}),
6255
- /* @__PURE__ */ r(Tt.Thumb, {})
6253
+ /* @__PURE__ */ r(Mt.Output, {}),
6254
+ /* @__PURE__ */ r(Mt.Track, {}),
6255
+ /* @__PURE__ */ r(Mt.Thumb, {})
6256
6256
  ]
6257
6257
  }
6258
6258
  )
@@ -6605,8 +6605,8 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6605
6605
  seed: Date.now()
6606
6606
  } : void 0);
6607
6607
  }, p = (g, P) => {
6608
- const z = ha(g, P);
6609
- t(z), s(!1);
6608
+ const O = ha(g, P);
6609
+ t(O), s(!1);
6610
6610
  }, C = (g) => {
6611
6611
  if (e)
6612
6612
  if (g === "custom") {
@@ -6655,7 +6655,7 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6655
6655
  ...e,
6656
6656
  scratchAmount: g[0]
6657
6657
  });
6658
- }, T = (g) => {
6658
+ }, M = (g) => {
6659
6659
  e && t({
6660
6660
  ...e,
6661
6661
  edgeWear: g[0]
@@ -6819,7 +6819,7 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6819
6819
  ] })
6820
6820
  ] })
6821
6821
  ] }),
6822
- /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6822
+ /* @__PURE__ */ y(zn, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6823
6823
  /* @__PURE__ */ r(It, { children: "Style" }),
6824
6824
  /* @__PURE__ */ y(os, { value: i, onValueChange: C, orientation: "horizontal", children: [
6825
6825
  /* @__PURE__ */ r(Kt, { value: "worn", id: "style-worn", children: "Worn" }),
@@ -6851,7 +6851,7 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6851
6851
  /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6852
6852
  /* @__PURE__ */ r(It, { children: "Texture Opacity" }),
6853
6853
  /* @__PURE__ */ r(
6854
- Tt,
6854
+ Mt,
6855
6855
  {
6856
6856
  value: [Math.round(((e == null ? void 0 : e.textureOpacity) ?? 0.5) * 100)],
6857
6857
  onValueChange: b,
@@ -6869,7 +6869,7 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6869
6869
  i !== "custom" && /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6870
6870
  /* @__PURE__ */ r(It, { children: "Intensity" }),
6871
6871
  /* @__PURE__ */ r(
6872
- Tt,
6872
+ Mt,
6873
6873
  {
6874
6874
  value: [a],
6875
6875
  onValueChange: w,
@@ -6886,7 +6886,7 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6886
6886
  (i === "worn" || i === "grunge" || i === "retro") && /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6887
6887
  /* @__PURE__ */ r(It, { children: "Fade" }),
6888
6888
  /* @__PURE__ */ r(
6889
- Tt,
6889
+ Mt,
6890
6890
  {
6891
6891
  value: [l],
6892
6892
  onValueChange: k,
@@ -6903,7 +6903,7 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6903
6903
  (i === "worn" || i === "grunge" || i === "retro") && /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6904
6904
  /* @__PURE__ */ r(It, { children: "Grain" }),
6905
6905
  /* @__PURE__ */ r(
6906
- Tt,
6906
+ Mt,
6907
6907
  {
6908
6908
  value: [c],
6909
6909
  onValueChange: S,
@@ -6920,7 +6920,7 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6920
6920
  i === "cracked" && /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6921
6921
  /* @__PURE__ */ r(It, { children: "Scratches" }),
6922
6922
  /* @__PURE__ */ r(
6923
- Tt,
6923
+ Mt,
6924
6924
  {
6925
6925
  value: [f],
6926
6926
  onValueChange: A,
@@ -6937,10 +6937,10 @@ const fa = ({ distressEffect: e, onChange: t }) => {
6937
6937
  (i === "worn" || i === "cracked") && /* @__PURE__ */ y("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: [
6938
6938
  /* @__PURE__ */ r(It, { children: "Edge Wear" }),
6939
6939
  /* @__PURE__ */ r(
6940
- Tt,
6940
+ Mt,
6941
6941
  {
6942
6942
  value: [d],
6943
- onValueChange: T,
6943
+ onValueChange: M,
6944
6944
  min: 0,
6945
6945
  max: 100,
6946
6946
  step: 1
@@ -7004,7 +7004,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7004
7004
  children: [
7005
7005
  /* @__PURE__ */ r(Ps, { className: "sc:w-full", children: /* @__PURE__ */ r("div", { className: "sc:flex sc:items-center sc:justify-between sc:w-full", children: /* @__PURE__ */ r(It, { children: "Compositing" }) }) }),
7006
7006
  /* @__PURE__ */ y(As, { className: "sc:flex sc:flex-col sc:gap-lg sc:pt-lg", children: [
7007
- /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
7007
+ /* @__PURE__ */ y(zn, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
7008
7008
  /* @__PURE__ */ r(It, { children: "Blend Mode" }),
7009
7009
  /* @__PURE__ */ y(os, { value: e, onValueChange: d, orientation: "horizontal", children: [
7010
7010
  /* @__PURE__ */ r(Kt, { value: "normal", id: "blend-normal", children: "Normal" }),
@@ -7045,7 +7045,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7045
7045
  )
7046
7046
  ] })
7047
7047
  ] }),
7048
- /* @__PURE__ */ y(On, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
7048
+ /* @__PURE__ */ y(zn, { className: "sc:flex sc:flex-col sc:gap-sm", children: [
7049
7049
  /* @__PURE__ */ r(It, { children: "Knockout Scope" }),
7050
7050
  /* @__PURE__ */ y("div", { className: "sc:flex sc:gap-sm", children: [
7051
7051
  /* @__PURE__ */ y(
@@ -7106,9 +7106,9 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7106
7106
  browseAll: c = !1
7107
7107
  }) => {
7108
7108
  const [f, d] = le([]), [m, p] = le(!1), [C, x] = le(null);
7109
- Te(() => {
7109
+ Me(() => {
7110
7110
  if (!e) return;
7111
- p(!0), x(null), (c ? zn.getAllGlyphs(o, i) : zn.getGlyphAlternates(o, n, i)).then((S) => {
7111
+ p(!0), x(null), (c ? On.getAllGlyphs(o, i) : On.getGlyphAlternates(o, n, i)).then((S) => {
7112
7112
  S.length === 0 && x(
7113
7113
  c ? `No glyphs found in ${o}` : `No alternates found for "${n}" in ${o}`
7114
7114
  ), d(S), p(!1);
@@ -7138,7 +7138,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7138
7138
  /* @__PURE__ */ r(pr, { size: 24, className: "sc:text-text-muted" }),
7139
7139
  /* @__PURE__ */ r("h3", { className: "sc:m-0 sc:text-3xl sc:font-semibold sc:text-text-primary", children: w })
7140
7140
  ] }),
7141
- /* @__PURE__ */ r(Ct, { size: "icon", variant: "ghost", onClick: t, children: /* @__PURE__ */ r(Oe, { icon: Fe.close, className: "sc:size-6" }) })
7141
+ /* @__PURE__ */ r(Ct, { size: "icon", variant: "ghost", onClick: t, children: /* @__PURE__ */ r(ze, { icon: Fe.close, className: "sc:size-6" }) })
7142
7142
  ] }),
7143
7143
  /* @__PURE__ */ y("div", { className: "sc:flex-1 sc:overflow-y-auto sc:p-3xl", children: [
7144
7144
  m && /* @__PURE__ */ r("div", { className: "sc:text-center sc:py-6xl sc:text-text-muted", children: "Loading alternates..." }),
@@ -7147,7 +7147,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7147
7147
  /* @__PURE__ */ r("div", { className: "sc:mt-md sc:text-base", children: "This font may not have alternate glyphs for this character." })
7148
7148
  ] }),
7149
7149
  !m && !C && f.length > 0 && /* @__PURE__ */ r("div", { className: "sc:grid sc:grid-cols-[repeat(auto-fill,minmax(100px,1fr))] sc:gap-xl", children: f.map((k, S) => {
7150
- const A = (a == null ? void 0 : a.glyphIndex) === k.glyphIndex, T = k.category === "default";
7150
+ const A = (a == null ? void 0 : a.glyphIndex) === k.glyphIndex, M = k.category === "default";
7151
7151
  return /* @__PURE__ */ y(
7152
7152
  "button",
7153
7153
  {
@@ -7182,10 +7182,10 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7182
7182
  sc:text-ellipsis sc:w-full
7183
7183
  ${A ? "sc:text-text-on-dark" : "sc:text-text-muted"}
7184
7184
  `.trim(),
7185
- children: T ? "Default" : k.name
7185
+ children: M ? "Default" : k.name
7186
7186
  }
7187
7187
  ),
7188
- T && /* @__PURE__ */ r("div", { className: "sc:absolute sc:top-xs sc:right-xs sc:bg-accent-primary sc:text-text-on-dark sc:text-xs sc:px-sm sc:py-[2px] sc:rounded-md sc:font-semibold", children: "DEFAULT" })
7188
+ M && /* @__PURE__ */ r("div", { className: "sc:absolute sc:top-xs sc:right-xs sc:bg-accent-primary sc:text-text-on-dark sc:text-xs sc:px-sm sc:py-[2px] sc:rounded-md sc:font-semibold", children: "DEFAULT" })
7189
7189
  ]
7190
7190
  },
7191
7191
  `${k.glyphIndex}-${S}`
@@ -7201,7 +7201,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7201
7201
  ]
7202
7202
  }
7203
7203
  ) });
7204
- }, Ms = Xn("OpenTypeFeaturesPanel"), va = [
7204
+ }, Ts = Xn("OpenTypeFeaturesPanel"), va = [
7205
7205
  // Ligatures
7206
7206
  { tag: "liga", label: "Standard Ligatures", description: "Common ligatures like fi, fl", category: "ligatures" },
7207
7207
  {
@@ -7251,18 +7251,18 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7251
7251
  onChange: i,
7252
7252
  onGlyphOverridesChange: a
7253
7253
  }) => {
7254
- const [l, c] = le(!1), [f, d] = le([]), [m, p] = le(!1), [C, x] = le(!1), [b, w] = le(0), [k, S] = le(""), [A, T] = le(!1), [I, g] = le(/* @__PURE__ */ new Map()), [P, z] = le(!1);
7255
- Te(() => {
7254
+ const [l, c] = le(!1), [f, d] = le([]), [m, p] = le(!1), [C, x] = le(!1), [b, w] = le(0), [k, S] = le(""), [A, M] = le(!1), [I, g] = le(/* @__PURE__ */ new Map()), [P, O] = le(!1);
7255
+ Me(() => {
7256
7256
  if (!e) {
7257
7257
  d([]);
7258
7258
  return;
7259
7259
  }
7260
- p(!0), zn.getAvailableFeatures(e, t).then((G) => {
7260
+ p(!0), On.getAvailableFeatures(e, t).then((G) => {
7261
7261
  d(G), p(!1);
7262
7262
  }).catch((G) => {
7263
- Ms.error("Error loading OpenType features:", G), d([]), p(!1);
7263
+ Ts.error("Error loading OpenType features:", G), d([]), p(!1);
7264
7264
  });
7265
- }, [e, t]), Te(() => {
7265
+ }, [e, t]), Me(() => {
7266
7266
  if (!n || !e) {
7267
7267
  g(/* @__PURE__ */ new Map());
7268
7268
  return;
@@ -7272,16 +7272,16 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7272
7272
  g(/* @__PURE__ */ new Map());
7273
7273
  return;
7274
7274
  }
7275
- z(!0), (async () => {
7275
+ O(!0), (async () => {
7276
7276
  const ce = /* @__PURE__ */ new Map();
7277
7277
  for (const W of G)
7278
7278
  try {
7279
- const pe = await zn.getGlyphAlternates(e, W, t), ae = pe.length > 0 ? pe.length - 1 : 0;
7279
+ const pe = await On.getGlyphAlternates(e, W, t), ae = pe.length > 0 ? pe.length - 1 : 0;
7280
7280
  ce.set(W, ae);
7281
7281
  } catch (pe) {
7282
- Ms.error(`Error loading alternates for '${W}':`, pe), ce.set(W, 0);
7282
+ Ts.error(`Error loading alternates for '${W}':`, pe), ce.set(W, 0);
7283
7283
  }
7284
- g(ce), z(!1);
7284
+ g(ce), O(!1);
7285
7285
  })();
7286
7286
  }, [n, e, t]);
7287
7287
  const D = (G) => {
@@ -7291,13 +7291,13 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7291
7291
  };
7292
7292
  Object.keys(ce).forEach((W) => {
7293
7293
  ce[W] || delete ce[W];
7294
- }), e && Object.keys(ce).length > 0 && zn.loadFont(e, t).catch((W) => {
7295
- Ms.error("Error pre-loading font for OpenType features:", W);
7294
+ }), e && Object.keys(ce).length > 0 && On.loadFont(e, t).catch((W) => {
7295
+ Ts.error("Error pre-loading font for OpenType features:", W);
7296
7296
  }), i(Object.keys(ce).length > 0 ? ce : void 0);
7297
7297
  }, v = (G, te) => {
7298
- w(G), S(te), T(!1), x(!0);
7298
+ w(G), S(te), M(!1), x(!0);
7299
7299
  }, se = () => {
7300
- T(!0), x(!0);
7300
+ M(!0), x(!0);
7301
7301
  }, K = (G) => {
7302
7302
  if (!a) return;
7303
7303
  let te = [...o];
@@ -7319,7 +7319,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7319
7319
  onClick: () => c(!l),
7320
7320
  children: [
7321
7321
  /* @__PURE__ */ y("div", { className: "sc:flex sc:items-center sc:gap-sm", children: [
7322
- /* @__PURE__ */ r(Oe, { icon: Fe.text, className: "sc:size-4" }),
7322
+ /* @__PURE__ */ r(ze, { icon: Fe.text, className: "sc:size-4" }),
7323
7323
  /* @__PURE__ */ r("span", { className: "sc:text-xl sc:font-medium", children: "OpenType Features" }),
7324
7324
  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 })
7325
7325
  ] }),
@@ -7438,45 +7438,45 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7438
7438
  placement: "right",
7439
7439
  maxWidth: "600px",
7440
7440
  children: /* @__PURE__ */ y(
7441
- Ot,
7441
+ zt,
7442
7442
  {
7443
7443
  value: o,
7444
7444
  onValueChange: (x) => i(x),
7445
7445
  className: "sc:flex sc:flex-col sc:h-full",
7446
7446
  children: [
7447
- /* @__PURE__ */ r(Ot.ListContainer, { className: "sc:px-6", children: /* @__PURE__ */ y(Ot.List, { "aria-label": "Effect types", children: [
7448
- /* @__PURE__ */ y(Ot.Tab, { id: "stroke", children: [
7449
- /* @__PURE__ */ r(Oe, { icon: Fe.minus, className: "sc:size-4" }),
7447
+ /* @__PURE__ */ r(zt.ListContainer, { className: "sc:px-6", children: /* @__PURE__ */ y(zt.List, { "aria-label": "Effect types", children: [
7448
+ /* @__PURE__ */ y(zt.Tab, { id: "stroke", children: [
7449
+ /* @__PURE__ */ r(ze, { icon: Fe.minus, className: "sc:size-4" }),
7450
7450
  "Stroke",
7451
7451
  a && /* @__PURE__ */ r(_n, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7452
- /* @__PURE__ */ r(Ot.Indicator, {})
7452
+ /* @__PURE__ */ r(zt.Indicator, {})
7453
7453
  ] }),
7454
- /* @__PURE__ */ y(Ot.Tab, { id: "masks", children: [
7455
- /* @__PURE__ */ r(Oe, { icon: Fe.group, className: "sc:size-4" }),
7454
+ /* @__PURE__ */ y(zt.Tab, { id: "masks", children: [
7455
+ /* @__PURE__ */ r(ze, { icon: Fe.group, className: "sc:size-4" }),
7456
7456
  "Masks",
7457
7457
  l && /* @__PURE__ */ r(_n, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7458
- /* @__PURE__ */ r(Ot.Indicator, {})
7458
+ /* @__PURE__ */ r(zt.Indicator, {})
7459
7459
  ] }),
7460
- /* @__PURE__ */ y(Ot.Tab, { id: "distress", children: [
7461
- /* @__PURE__ */ r(Oe, { icon: "lucide:cloud", className: "sc:size-4" }),
7460
+ /* @__PURE__ */ y(zt.Tab, { id: "distress", children: [
7461
+ /* @__PURE__ */ r(ze, { icon: "lucide:cloud", className: "sc:size-4" }),
7462
7462
  "Distress",
7463
7463
  c && /* @__PURE__ */ r(_n, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7464
- /* @__PURE__ */ r(Ot.Indicator, {})
7464
+ /* @__PURE__ */ r(zt.Indicator, {})
7465
7465
  ] }),
7466
- /* @__PURE__ */ y(Ot.Tab, { id: "compositing", children: [
7467
- /* @__PURE__ */ r(Oe, { icon: Fe.scissors, className: "sc:size-4" }),
7466
+ /* @__PURE__ */ y(zt.Tab, { id: "compositing", children: [
7467
+ /* @__PURE__ */ r(ze, { icon: Fe.scissors, className: "sc:size-4" }),
7468
7468
  "Knockout",
7469
7469
  f && /* @__PURE__ */ r(_n, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7470
- /* @__PURE__ */ r(Ot.Indicator, {})
7470
+ /* @__PURE__ */ r(zt.Indicator, {})
7471
7471
  ] }),
7472
- d && /* @__PURE__ */ y(Ot.Tab, { id: "typography", children: [
7473
- /* @__PURE__ */ r(Oe, { icon: Fe.text, className: "sc:size-4" }),
7472
+ d && /* @__PURE__ */ y(zt.Tab, { id: "typography", children: [
7473
+ /* @__PURE__ */ r(ze, { icon: Fe.text, className: "sc:size-4" }),
7474
7474
  "Typography",
7475
7475
  m && /* @__PURE__ */ r(_n, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
7476
- /* @__PURE__ */ r(Ot.Indicator, {})
7476
+ /* @__PURE__ */ r(zt.Indicator, {})
7477
7477
  ] })
7478
7478
  ] }) }),
7479
- /* @__PURE__ */ y(Ot.Panel, { id: "stroke", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7479
+ /* @__PURE__ */ y(zt.Panel, { id: "stroke", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7480
7480
  /* @__PURE__ */ r(
7481
7481
  qi,
7482
7482
  {
@@ -7488,11 +7488,11 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7488
7488
  }
7489
7489
  ),
7490
7490
  /* @__PURE__ */ r("div", { className: "sc:mt-6 sc:pt-4 sc:border-t sc:border-black/10 sc:dark:border-white/10", children: /* @__PURE__ */ y("div", { className: "sc:flex sc:items-start sc:gap-2 sc:text-xs sc:text-muted", children: [
7491
- /* @__PURE__ */ r(Oe, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7491
+ /* @__PURE__ */ r(ze, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7492
7492
  /* @__PURE__ */ r("span", { children: "Add outlines to text and shapes" })
7493
7493
  ] }) })
7494
7494
  ] }),
7495
- /* @__PURE__ */ y(Ot.Panel, { id: "masks", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7495
+ /* @__PURE__ */ y(zt.Panel, { id: "masks", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7496
7496
  /* @__PURE__ */ r(
7497
7497
  Zi,
7498
7498
  {
@@ -7504,11 +7504,11 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7504
7504
  }
7505
7505
  ),
7506
7506
  /* @__PURE__ */ r("div", { className: "sc:mt-6 sc:pt-4 sc:border-t sc:border-black/10 sc:dark:border-white/10", children: /* @__PURE__ */ y("div", { className: "sc:flex sc:items-start sc:gap-2 sc:text-xs sc:text-muted", children: [
7507
- /* @__PURE__ */ r(Oe, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7507
+ /* @__PURE__ */ r(ze, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7508
7508
  /* @__PURE__ */ r("span", { children: "Use masks to control visibility" })
7509
7509
  ] }) })
7510
7510
  ] }),
7511
- /* @__PURE__ */ y(Ot.Panel, { id: "distress", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7511
+ /* @__PURE__ */ y(zt.Panel, { id: "distress", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7512
7512
  /* @__PURE__ */ r(
7513
7513
  fa,
7514
7514
  {
@@ -7520,11 +7520,11 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7520
7520
  }
7521
7521
  ),
7522
7522
  /* @__PURE__ */ r("div", { className: "sc:mt-6 sc:pt-4 sc:border-t sc:border-black/10 sc:dark:border-white/10", children: /* @__PURE__ */ y("div", { className: "sc:flex sc:items-start sc:gap-2 sc:text-xs sc:text-muted", children: [
7523
- /* @__PURE__ */ r(Oe, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7523
+ /* @__PURE__ */ r(ze, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7524
7524
  /* @__PURE__ */ r("span", { children: "Add vintage/grunge effects for t-shirt designs" })
7525
7525
  ] }) })
7526
7526
  ] }),
7527
- /* @__PURE__ */ y(Ot.Panel, { id: "compositing", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7527
+ /* @__PURE__ */ y(zt.Panel, { id: "compositing", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7528
7528
  /* @__PURE__ */ r(
7529
7529
  xa,
7530
7530
  {
@@ -7537,11 +7537,11 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7537
7537
  }
7538
7538
  ),
7539
7539
  /* @__PURE__ */ r("div", { className: "sc:mt-6 sc:pt-4 sc:border-t sc:border-black/10 sc:dark:border-white/10", children: /* @__PURE__ */ y("div", { className: "sc:flex sc:items-start sc:gap-2 sc:text-xs sc:text-muted", children: [
7540
- /* @__PURE__ */ r(Oe, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7540
+ /* @__PURE__ */ r(ze, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7541
7541
  /* @__PURE__ */ r("span", { children: "Use Artboard scope for t-shirts, Group scope for patterns" })
7542
7542
  ] }) })
7543
7543
  ] }),
7544
- d && /* @__PURE__ */ y(Ot.Panel, { id: "typography", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7544
+ d && /* @__PURE__ */ y(zt.Panel, { id: "typography", className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7545
7545
  /* @__PURE__ */ r(
7546
7546
  Ca,
7547
7547
  {
@@ -7561,7 +7561,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7561
7561
  }
7562
7562
  ),
7563
7563
  /* @__PURE__ */ r("div", { className: "sc:mt-6 sc:pt-4 sc:border-t sc:border-black/10 sc:dark:border-white/10", children: /* @__PURE__ */ y("div", { className: "sc:flex sc:items-start sc:gap-2 sc:text-xs sc:text-muted", children: [
7564
- /* @__PURE__ */ r(Oe, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7564
+ /* @__PURE__ */ r(ze, { icon: "lucide:lightbulb", className: "sc:size-4 sc:shrink-0 sc:mt-0.5" }),
7565
7565
  /* @__PURE__ */ r("span", { children: "Enable advanced OpenType features like ligatures and stylistic sets" })
7566
7566
  ] }) })
7567
7567
  ] })
@@ -7614,7 +7614,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7614
7614
  progress: p,
7615
7615
  supportsWorkerExport: C,
7616
7616
  workerStats: x
7617
- } = qr(), { artboardsInfo: b, activeArtboardId: w } = lr(), [k, S] = le(t), [A, T] = le(n), [I, g] = le(500), P = async () => {
7617
+ } = qr(), { artboardsInfo: b, activeArtboardId: w } = lr(), [k, S] = le(t), [A, M] = le(n), [I, g] = le(500), P = async () => {
7618
7618
  if (w)
7619
7619
  try {
7620
7620
  const v = await a(w, { scale: k, format: A }), se = document.createElement("a"), K = b.find((Q) => Q.id === w), N = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), u = (K == null ? void 0 : K.name) || "artboard";
@@ -7622,7 +7622,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7622
7622
  } catch (v) {
7623
7623
  Qs.error("Export failed:", v), alert("Export failed. Please try again.");
7624
7624
  }
7625
- }, z = async () => {
7625
+ }, O = async () => {
7626
7626
  try {
7627
7627
  const v = await l({ scale: k, format: A }), se = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
7628
7628
  Object.entries(v).forEach(([K, N]) => {
@@ -7720,7 +7720,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7720
7720
  {
7721
7721
  id: "export-format",
7722
7722
  value: A,
7723
- onChange: (v) => T(v.target.value),
7723
+ onChange: (v) => M(v.target.value),
7724
7724
  style: {
7725
7725
  width: "100%",
7726
7726
  padding: 8,
@@ -7795,7 +7795,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7795
7795
  opacity: d || !w ? 0.5 : 1
7796
7796
  },
7797
7797
  children: [
7798
- /* @__PURE__ */ r(Oe, { icon: Fe.download, className: "sc:size-4" }),
7798
+ /* @__PURE__ */ r(ze, { icon: Fe.download, className: "sc:size-4" }),
7799
7799
  d ? "Exporting..." : "Export Active Artboard"
7800
7800
  ]
7801
7801
  }
@@ -7803,7 +7803,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7803
7803
  /* @__PURE__ */ y(
7804
7804
  "button",
7805
7805
  {
7806
- onClick: z,
7806
+ onClick: O,
7807
7807
  disabled: d || b.length === 0,
7808
7808
  style: {
7809
7809
  display: "flex",
@@ -7821,7 +7821,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7821
7821
  opacity: d || b.length === 0 ? 0.5 : 1
7822
7822
  },
7823
7823
  children: [
7824
- /* @__PURE__ */ r(Oe, { icon: Fe.image, className: "sc:size-4" }),
7824
+ /* @__PURE__ */ r(ze, { icon: Fe.image, className: "sc:size-4" }),
7825
7825
  d ? "Exporting..." : "Export All Artboards"
7826
7826
  ]
7827
7827
  }
@@ -7845,7 +7845,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7845
7845
  fontWeight: 500
7846
7846
  },
7847
7847
  children: [
7848
- m ? /* @__PURE__ */ r(Oe, { icon: Fe.pause, className: "sc:size-4" }) : /* @__PURE__ */ r(Oe, { icon: Fe.play, className: "sc:size-4" }),
7848
+ m ? /* @__PURE__ */ r(ze, { icon: Fe.pause, className: "sc:size-4" }) : /* @__PURE__ */ r(ze, { icon: Fe.play, className: "sc:size-4" }),
7849
7849
  m ? "Stop Continuous Export" : "Start Continuous Export"
7850
7850
  ]
7851
7851
  }
@@ -7909,7 +7909,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7909
7909
  }, Ra = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7910
7910
  __proto__: null,
7911
7911
  ExportPanel: ka
7912
- }, Symbol.toStringTag, { value: "Module" })), Ma = Xn("GlyphBrowserDrawer"), Ta = ({
7912
+ }, Symbol.toStringTag, { value: "Module" })), Ta = Xn("GlyphBrowserDrawer"), Ma = ({
7913
7913
  isOpen: e,
7914
7914
  onClose: t,
7915
7915
  fontFamily: n,
@@ -7917,11 +7917,11 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7917
7917
  onInsertGlyph: o
7918
7918
  }) => {
7919
7919
  const [i, a] = le([]), [l, c] = le(!1), [f, d] = le(null), [m, p] = le("");
7920
- Te(() => {
7921
- e && (c(!0), d(null), p(""), zn.getAllGlyphs(n, s).then((b) => {
7920
+ Me(() => {
7921
+ e && (c(!0), d(null), p(""), On.getAllGlyphs(n, s).then((b) => {
7922
7922
  b.length === 0 && d(`No alternate glyphs found in ${n}`), a(b), c(!1);
7923
7923
  }).catch((b) => {
7924
- Ma.error("Error loading glyphs:", b), d("Failed to load glyphs"), c(!1);
7924
+ Ta.error("Error loading glyphs:", b), d("Failed to load glyphs"), c(!1);
7925
7925
  }));
7926
7926
  }, [e, n, s]);
7927
7927
  const C = (b) => {
@@ -7948,7 +7948,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7948
7948
  children: [
7949
7949
  /* @__PURE__ */ r("div", { className: "sc:px-6 sc:py-4 sc:border-b sc:border-black/10 sc:dark:border-white/10", children: /* @__PURE__ */ y("div", { className: "sc:relative", children: [
7950
7950
  /* @__PURE__ */ r(
7951
- Oe,
7951
+ ze,
7952
7952
  {
7953
7953
  icon: Fe.search,
7954
7954
  className: "sc:absolute sc:left-3 sc:top-1/2 sc:-translate-y-1/2 sc:text-muted sc:pointer-events-none sc:size-4 sc:z-10"
@@ -7967,16 +7967,16 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
7967
7967
  ] }) }),
7968
7968
  /* @__PURE__ */ y("div", { className: "sc:flex-1 sc:overflow-y-auto sc:p-6", children: [
7969
7969
  l && /* @__PURE__ */ y("div", { className: "sc:py-12 sc:text-center sc:text-muted", children: [
7970
- /* @__PURE__ */ r(Yi, { size: "lg", className: "sc:mx-auto sc:mb-4" }),
7970
+ /* @__PURE__ */ r(Li, { size: "lg", className: "sc:mx-auto sc:mb-4" }),
7971
7971
  /* @__PURE__ */ r("div", { className: "sc:text-sm", children: "Loading glyphs..." })
7972
7972
  ] }),
7973
7973
  f && /* @__PURE__ */ y("div", { className: "sc:py-12 sc:text-center", children: [
7974
- /* @__PURE__ */ r(Oe, { icon: Fe.alertCircle, className: "sc:size-12 sc:mx-auto sc:mb-4 sc:text-danger" }),
7974
+ /* @__PURE__ */ r(ze, { icon: Fe.alertCircle, className: "sc:size-12 sc:mx-auto sc:mb-4 sc:text-danger" }),
7975
7975
  /* @__PURE__ */ r("div", { className: "sc:text-base sc:font-medium sc:mb-2", children: f }),
7976
7976
  /* @__PURE__ */ r("div", { className: "sc:text-sm sc:text-muted", children: "This font may not have alternate glyphs." })
7977
7977
  ] }),
7978
7978
  !l && !f && x.length === 0 && m && /* @__PURE__ */ y("div", { className: "sc:py-12 sc:text-center", children: [
7979
- /* @__PURE__ */ r(Oe, { icon: Fe.search, className: "sc:size-12 sc:mx-auto sc:mb-4 sc:text-muted" }),
7979
+ /* @__PURE__ */ r(ze, { icon: Fe.search, className: "sc:size-12 sc:mx-auto sc:mb-4 sc:text-muted" }),
7980
7980
  /* @__PURE__ */ y("div", { className: "sc:text-base sc:font-medium", children: [
7981
7981
  'No glyphs found matching "',
7982
7982
  m,
@@ -8034,7 +8034,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8034
8034
  return;
8035
8035
  }
8036
8036
  try {
8037
- await zn.loadFont(f, d);
8037
+ await On.loadFont(f, d);
8038
8038
  } catch (x) {
8039
8039
  er.error("Error pre-loading font for glyph rendering:", x);
8040
8040
  }
@@ -8044,7 +8044,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8044
8044
  [o, c, f, d, l]
8045
8045
  );
8046
8046
  return /* @__PURE__ */ r(
8047
- Ta,
8047
+ Ma,
8048
8048
  {
8049
8049
  isOpen: e,
8050
8050
  onClose: t,
@@ -8072,25 +8072,25 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8072
8072
  createArtboard: d,
8073
8073
  deleteArtboard: m,
8074
8074
  renameArtboard: p
8075
- } = lr(), [C, x] = le(null), [b, w] = le(""), k = (z, D) => {
8076
- x(z), w(D);
8075
+ } = lr(), [C, x] = le(null), [b, w] = le(""), k = (O, D) => {
8076
+ x(O), w(D);
8077
8077
  }, S = () => {
8078
8078
  C && b.trim() && p(C, b.trim()), x(null), w("");
8079
8079
  }, A = () => {
8080
8080
  x(null), w("");
8081
- }, T = () => {
8081
+ }, M = () => {
8082
8082
  d(1200, 1200, {
8083
8083
  name: `Artboard ${c.length + 1}`
8084
8084
  }), a && setTimeout(() => {
8085
- const z = c[c.length];
8086
- z && a(z.id);
8085
+ const O = c[c.length];
8086
+ O && a(O.id);
8087
8087
  }, 10);
8088
- }, I = (z, D) => {
8088
+ }, I = (O, D) => {
8089
8089
  if (D.stopPropagation(), c.length <= 1) {
8090
8090
  alert("Cannot delete the last artboard");
8091
8091
  return;
8092
8092
  }
8093
- confirm("Delete this artboard?") && (m(z), l && l(z));
8093
+ confirm("Delete this artboard?") && (m(O), l && l(O));
8094
8094
  }, g = e === "horizontal" ? {
8095
8095
  display: "flex",
8096
8096
  flexDirection: "row",
@@ -8112,32 +8112,32 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8112
8112
  overflowX: "hidden",
8113
8113
  minWidth: 200,
8114
8114
  ...o
8115
- }, P = (z) => ({
8115
+ }, P = (O) => ({
8116
8116
  display: "flex",
8117
8117
  alignItems: "center",
8118
8118
  gap: 8,
8119
8119
  padding: "8px 12px",
8120
- backgroundColor: z ? "var(--accent-primary)" : "var(--bg-primary)",
8121
- color: z ? "var(--primary-foreground)" : "var(--text-primary)",
8122
- border: z ? "none" : "1px solid var(--border-primary)",
8120
+ backgroundColor: O ? "var(--accent-primary)" : "var(--bg-primary)",
8121
+ color: O ? "var(--primary-foreground)" : "var(--text-primary)",
8122
+ border: O ? "none" : "1px solid var(--border-primary)",
8123
8123
  borderRadius: 6,
8124
8124
  cursor: "pointer",
8125
8125
  fontSize: 13,
8126
- fontWeight: z ? 600 : 400,
8126
+ fontWeight: O ? 600 : 400,
8127
8127
  whiteSpace: "nowrap",
8128
8128
  maxWidth: e === "horizontal" ? s : void 0,
8129
8129
  minWidth: e === "horizontal" ? 120 : void 0,
8130
8130
  transition: "all 0.2s"
8131
8131
  });
8132
8132
  return /* @__PURE__ */ y("div", { className: `artboard-tabs ${i}`, style: g, children: [
8133
- c.map((z) => {
8134
- const D = C === z.id;
8133
+ c.map((O) => {
8134
+ const D = C === O.id;
8135
8135
  return /* @__PURE__ */ y(
8136
8136
  "div",
8137
8137
  {
8138
- style: P(z.isActive),
8139
- onClick: () => !D && f(z.id),
8140
- onDoubleClick: () => k(z.id, z.name),
8138
+ style: P(O.isActive),
8139
+ onClick: () => !D && f(O.id),
8140
+ onDoubleClick: () => k(O.id, O.name),
8141
8141
  children: [
8142
8142
  D ? /* @__PURE__ */ r(
8143
8143
  "input",
@@ -8160,7 +8160,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8160
8160
  minWidth: 80
8161
8161
  }
8162
8162
  }
8163
- ) : /* @__PURE__ */ r("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: z.name }),
8163
+ ) : /* @__PURE__ */ r("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: O.name }),
8164
8164
  /* @__PURE__ */ r(
8165
8165
  "span",
8166
8166
  {
@@ -8169,15 +8169,15 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8169
8169
  opacity: 0.7,
8170
8170
  padding: "2px 6px",
8171
8171
  borderRadius: 10,
8172
- backgroundColor: z.isActive ? "color-mix(in srgb, var(--primary-foreground) 20%, transparent)" : "var(--bg-secondary)"
8172
+ backgroundColor: O.isActive ? "color-mix(in srgb, var(--primary-foreground) 20%, transparent)" : "var(--bg-secondary)"
8173
8173
  },
8174
- children: z.elementCount
8174
+ children: O.elementCount
8175
8175
  }
8176
8176
  ),
8177
8177
  n && /* @__PURE__ */ r(
8178
8178
  "button",
8179
8179
  {
8180
- onClick: (v) => I(z.id, v),
8180
+ onClick: (v) => I(O.id, v),
8181
8181
  style: {
8182
8182
  background: "none",
8183
8183
  border: "none",
@@ -8191,18 +8191,18 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8191
8191
  onMouseEnter: (v) => v.currentTarget.style.opacity = "1",
8192
8192
  onMouseLeave: (v) => v.currentTarget.style.opacity = "0.7",
8193
8193
  title: "Delete artboard",
8194
- children: /* @__PURE__ */ r(Oe, { icon: Fe.close, className: "sc:size-3.5" })
8194
+ children: /* @__PURE__ */ r(ze, { icon: Fe.close, className: "sc:size-3.5" })
8195
8195
  }
8196
8196
  )
8197
8197
  ]
8198
8198
  },
8199
- z.id
8199
+ O.id
8200
8200
  );
8201
8201
  }),
8202
8202
  t && /* @__PURE__ */ y(
8203
8203
  "button",
8204
8204
  {
8205
- onClick: T,
8205
+ onClick: M,
8206
8206
  style: {
8207
8207
  display: "flex",
8208
8208
  alignItems: "center",
@@ -8218,15 +8218,15 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8218
8218
  minWidth: e === "horizontal" ? 120 : void 0,
8219
8219
  transition: "all 0.2s"
8220
8220
  },
8221
- onMouseEnter: (z) => {
8222
- z.currentTarget.style.backgroundColor = "var(--bg-tertiary)", z.currentTarget.style.borderColor = "var(--accent-primary)";
8221
+ onMouseEnter: (O) => {
8222
+ O.currentTarget.style.backgroundColor = "var(--bg-tertiary)", O.currentTarget.style.borderColor = "var(--accent-primary)";
8223
8223
  },
8224
- onMouseLeave: (z) => {
8225
- z.currentTarget.style.backgroundColor = "var(--bg-primary)", z.currentTarget.style.borderColor = "var(--border-primary)";
8224
+ onMouseLeave: (O) => {
8225
+ O.currentTarget.style.backgroundColor = "var(--bg-primary)", O.currentTarget.style.borderColor = "var(--border-primary)";
8226
8226
  },
8227
8227
  title: "Add new artboard",
8228
8228
  children: [
8229
- /* @__PURE__ */ r(Oe, { icon: Fe.plus, className: "sc:size-3.5" }),
8229
+ /* @__PURE__ */ r(ze, { icon: Fe.plus, className: "sc:size-3.5" }),
8230
8230
  /* @__PURE__ */ r("span", { children: "New Artboard" })
8231
8231
  ]
8232
8232
  }
@@ -8273,7 +8273,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8273
8273
  onClick: a,
8274
8274
  disabled: o <= 0.1,
8275
8275
  "aria-label": "Zoom out",
8276
- children: /* @__PURE__ */ r(Oe, { icon: Fe.minus, className: "sc:size-4" })
8276
+ children: /* @__PURE__ */ r(ze, { icon: Fe.minus, className: "sc:size-4" })
8277
8277
  }
8278
8278
  ) }),
8279
8279
  /* @__PURE__ */ r(fn, { children: "Zoom out" })
@@ -8304,7 +8304,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8304
8304
  onClick: i,
8305
8305
  disabled: o >= 4,
8306
8306
  "aria-label": "Zoom in",
8307
- children: /* @__PURE__ */ r(Oe, { icon: Fe.plus, className: "sc:size-4" })
8307
+ children: /* @__PURE__ */ r(ze, { icon: Fe.plus, className: "sc:size-4" })
8308
8308
  }
8309
8309
  ) }),
8310
8310
  /* @__PURE__ */ r(fn, { children: "Zoom in" })
@@ -8328,7 +8328,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8328
8328
  size: "icon",
8329
8329
  onClick: l,
8330
8330
  "aria-label": "Fit to screen",
8331
- children: /* @__PURE__ */ r(Oe, { icon: Fe.fitScreen, className: "sc:size-4" })
8331
+ children: /* @__PURE__ */ r(ze, { icon: Fe.fitScreen, className: "sc:size-4" })
8332
8332
  }
8333
8333
  ) }),
8334
8334
  /* @__PURE__ */ r(fn, { children: "Fit to screen" })
@@ -8341,7 +8341,7 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8341
8341
  size: "icon",
8342
8342
  onClick: c,
8343
8343
  "aria-label": "Reset to 100%",
8344
- children: /* @__PURE__ */ r(Oe, { icon: Fe.maximize, className: "sc:size-4" })
8344
+ children: /* @__PURE__ */ r(ze, { icon: Fe.maximize, className: "sc:size-4" })
8345
8345
  }
8346
8346
  ) }),
8347
8347
  /* @__PURE__ */ r(fn, { children: "Reset to 100%" })
@@ -8357,15 +8357,17 @@ const xa = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
8357
8357
  enabled: !0,
8358
8358
  debounceMs: 100,
8359
8359
  maxWaitMs: 1e3
8360
- };
8361
- class rc {
8360
+ }, Oa = 3, za = 500;
8361
+ class ic {
8362
8362
  constructor(t = {}) {
8363
8363
  this.onExportCallback = null, this.onExportScheduledCallback = null, this.revision = 0, this.lastExportedRevision = -1, this.stats = {
8364
8364
  totalExports: 0,
8365
8365
  skippedExports: 0,
8366
8366
  lastExportTime: null,
8367
- avgExportInterval: 0
8368
- }, this.exportTimestamps = [], this.config = { ...Ba, ...t }, this.debouncedExport = qs(
8367
+ avgExportInterval: 0,
8368
+ failedExports: 0,
8369
+ lastExportError: null
8370
+ }, this.exportTimestamps = [], this.consecutiveFailures = 0, this.retryTimer = null, this.windowTimer = null, this.config = { ...Ba, ...t }, this.debouncedExport = qs(
8369
8371
  () => this.performExport(),
8370
8372
  this.config.debounceMs,
8371
8373
  {
@@ -8380,8 +8382,19 @@ class rc {
8380
8382
  * Call this whenever any change happens in the editor
8381
8383
  */
8382
8384
  scheduleExport() {
8385
+ this.consecutiveFailures = 0;
8383
8386
  const t = Date.now();
8384
- !this.config.enabled || (this.revision++, (this.stats.lastExportTime ? t - this.stats.lastExportTime : 1 / 0) < 200) || (this.onExportScheduledCallback && this.onExportScheduledCallback(), this.debouncedExport());
8387
+ if (!this.config.enabled)
8388
+ return;
8389
+ this.revision++;
8390
+ const n = this.stats.lastExportTime ? t - this.stats.lastExportTime : 1 / 0;
8391
+ if (n < 200) {
8392
+ this.windowTimer || (this.windowTimer = setTimeout(() => {
8393
+ this.windowTimer = null, this.config.enabled && this.debouncedExport();
8394
+ }, 200 - n));
8395
+ return;
8396
+ }
8397
+ this.onExportScheduledCallback && this.onExportScheduledCallback(), this.debouncedExport();
8385
8398
  }
8386
8399
  /**
8387
8400
  * Force an immediate export (bypassing debounce)
@@ -8420,9 +8433,12 @@ class rc {
8420
8433
  try {
8421
8434
  await s();
8422
8435
  } catch (o) {
8423
- nr.error("Export failed:", o);
8436
+ nr.error("Export failed:", o), this.stats.failedExports++, this.stats.lastExportError = o instanceof Error ? o.message : String(o), this.consecutiveFailures++, this.config.enabled && this.consecutiveFailures <= Oa && !this.retryTimer && (this.retryTimer = setTimeout(() => {
8437
+ this.retryTimer = null, this.debouncedExport();
8438
+ }, za * this.consecutiveFailures));
8439
+ return;
8424
8440
  }
8425
- this.lastExportedRevision = t, this.revision > t && this.config.enabled && this.debouncedExport();
8441
+ this.consecutiveFailures = 0, this.stats.lastExportError = null, this.lastExportedRevision = t, this.revision > t && this.config.enabled && this.debouncedExport();
8426
8442
  }
8427
8443
  }, 0) : nr.warn("No export callback registered");
8428
8444
  }
@@ -8472,7 +8488,9 @@ class rc {
8472
8488
  totalExports: 0,
8473
8489
  skippedExports: 0,
8474
8490
  lastExportTime: null,
8475
- avgExportInterval: 0
8491
+ avgExportInterval: 0,
8492
+ failedExports: 0,
8493
+ lastExportError: null
8476
8494
  }, this.exportTimestamps = [];
8477
8495
  }
8478
8496
  /**
@@ -8485,10 +8503,10 @@ class rc {
8485
8503
  * Cleanup resources
8486
8504
  */
8487
8505
  destroy() {
8488
- this.debouncedExport.cancel(), this.onExportCallback = null, this.onExportScheduledCallback = null, this.lastExportedRevision = -1;
8506
+ this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = null, this.windowTimer && clearTimeout(this.windowTimer), this.windowTimer = null, this.debouncedExport.cancel(), this.onExportCallback = null, this.onExportScheduledCallback = null, this.lastExportedRevision = -1;
8489
8507
  }
8490
8508
  }
8491
- function oc({ width: e = 800, height: t = 600, style: n }) {
8509
+ function ac({ width: e = 800, height: t = 600, style: n }) {
8492
8510
  return /* @__PURE__ */ y(
8493
8511
  "div",
8494
8512
  {
@@ -8531,7 +8549,7 @@ function oc({ width: e = 800, height: t = 600, style: n }) {
8531
8549
  }
8532
8550
  );
8533
8551
  }
8534
- function ic({ itemCount: e = 5, style: t }) {
8552
+ function cc({ itemCount: e = 5, style: t }) {
8535
8553
  return /* @__PURE__ */ y(
8536
8554
  "div",
8537
8555
  {
@@ -8584,7 +8602,7 @@ function ic({ itemCount: e = 5, style: t }) {
8584
8602
  }
8585
8603
  );
8586
8604
  }
8587
- function ac({ style: e }) {
8605
+ function lc({ style: e }) {
8588
8606
  return /* @__PURE__ */ y(
8589
8607
  "div",
8590
8608
  {
@@ -8639,7 +8657,7 @@ function ac({ style: e }) {
8639
8657
  }
8640
8658
  );
8641
8659
  }
8642
- function cc({ size: e = 32, color: t = "var(--primary)" }) {
8660
+ function dc({ size: e = 32, color: t = "var(--primary)" }) {
8643
8661
  return /* @__PURE__ */ r(
8644
8662
  "div",
8645
8663
  {
@@ -8660,7 +8678,7 @@ function cc({ size: e = 32, color: t = "var(--primary)" }) {
8660
8678
  }
8661
8679
  );
8662
8680
  }
8663
- function lc(e) {
8681
+ function uc(e) {
8664
8682
  var i;
8665
8683
  const t = [], n = [];
8666
8684
  (!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");
@@ -8684,31 +8702,31 @@ export {
8684
8702
  Ba as D,
8685
8703
  ko as E,
8686
8704
  Ia as G,
8687
- qa as K,
8688
- ic as L,
8705
+ Za as K,
8706
+ cc as L,
8689
8707
  gr as M,
8690
8708
  Eo as P,
8691
- cc as S,
8692
- ac as T,
8709
+ dc as S,
8710
+ lc as T,
8693
8711
  tr as Z,
8694
- sc as a,
8712
+ oc as a,
8695
8713
  Sa as b,
8696
8714
  ka as c,
8697
8715
  Aa as d,
8698
- rc as e,
8699
- Za as f,
8700
- Ja as g,
8701
- oc as h,
8716
+ ic as e,
8717
+ Qa as f,
8718
+ ec as g,
8719
+ ac as h,
8702
8720
  js as i,
8703
- ec as j,
8704
- Qa as k,
8705
- nc as l,
8721
+ nc as j,
8722
+ tc as k,
8723
+ rc as l,
8706
8724
  Pt as m,
8707
8725
  ei as n,
8708
- ja as o,
8709
- Mo as p,
8726
+ Ja as o,
8727
+ To as p,
8710
8728
  Ro as r,
8711
- tc as u,
8712
- lc as v
8729
+ sc as u,
8730
+ uc as v
8713
8731
  };
8714
- //# sourceMappingURL=validation-DETfj7tg.js.map
8732
+ //# sourceMappingURL=validation-jgr2OtXC.js.map