@aivex/ui 1.2.0-dev.22 → 1.2.0-dev.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{Button-B6WM7faP.js → Button-BSJwb59G.js} +310 -2177
  2. package/dist/Button-BSJwb59G.js.map +1 -0
  3. package/dist/Button-OQscp8mY.cjs +2 -0
  4. package/dist/Button-OQscp8mY.cjs.map +1 -0
  5. package/dist/IconButton-Cl3T7MUr.cjs +2 -0
  6. package/dist/IconButton-Cl3T7MUr.cjs.map +1 -0
  7. package/dist/IconButton-DyUOtz87.js +208 -0
  8. package/dist/IconButton-DyUOtz87.js.map +1 -0
  9. package/dist/Switch-DP8FRLJK.cjs +2 -0
  10. package/dist/Switch-DP8FRLJK.cjs.map +1 -0
  11. package/dist/Switch-rIEhz2pk.js +325 -0
  12. package/dist/Switch-rIEhz2pk.js.map +1 -0
  13. package/dist/comment.cjs +1 -113
  14. package/dist/comment.cjs.map +1 -1
  15. package/dist/comment.js +105 -13466
  16. package/dist/comment.js.map +1 -1
  17. package/dist/components/DatePicker/DatePicker.d.ts +5 -0
  18. package/dist/components/ScrollArea/ScrollArea.d.ts +3 -1
  19. package/dist/index.cjs +1 -21
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.js +1456 -8464
  22. package/dist/index.js.map +1 -1
  23. package/dist/shape-editor.cjs +1 -1
  24. package/dist/shape-editor.js +442 -442
  25. package/dist/styles.css +1 -1
  26. package/package.json +3 -1
  27. package/dist/Button-B6WM7faP.js.map +0 -1
  28. package/dist/Button-C4WtB38c.cjs +0 -2
  29. package/dist/Button-C4WtB38c.cjs.map +0 -1
  30. package/dist/IconButton-CuO-3IXh.cjs +0 -2
  31. package/dist/IconButton-CuO-3IXh.cjs.map +0 -1
  32. package/dist/IconButton-pgdAaijX.js +0 -560
  33. package/dist/IconButton-pgdAaijX.js.map +0 -1
  34. package/dist/Switch-CtjEelTs.cjs +0 -42
  35. package/dist/Switch-CtjEelTs.cjs.map +0 -1
  36. package/dist/Switch-rKD8bdwo.js +0 -2537
  37. package/dist/Switch-rKD8bdwo.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import "./styles.css";
3
- import { Ar as e, Di as t, Dt as n, Q as r, Vr as i, Xr as a, er as o, nr as s, nt as c, oa as l, t as u, ui as d, ur as f } from "./Button-B6WM7faP.js";
4
- import { a as p, c as m, n as h, t as g } from "./Switch-rKD8bdwo.js";
5
- import { memo as _, useCallback as v, useEffect as y, useId as b, useImperativeHandle as x, useLayoutEffect as S, useMemo as C, useReducer as w, useRef as T, useState as E } from "react";
6
- import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
3
+ import { Ar as e, Di as t, Dt as n, Q as r, Vr as i, Xr as a, er as o, nr as s, nt as c, oa as l, t as u, ui as d, ur as f } from "./Button-BSJwb59G.js";
4
+ import { a as p, n as m, r as h, t as g } from "./Switch-rIEhz2pk.js";
5
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
6
+ import { memo as b, useCallback as x, useEffect as S, useId as C, useImperativeHandle as w, useLayoutEffect as T, useMemo as E, useReducer as D, useRef as O, useState as k } from "react";
7
7
  import A from "konva";
8
8
  import { Application as j, ColorMatrixFilter as M, Container as N, Graphics as P, Polygon as ee, Rectangle as te, Sprite as ne, Texture as re } from "pixi.js";
9
9
  //#region src/components/ShapeEditor/_model/geometry.ts
@@ -408,7 +408,7 @@ var W = {
408
408
  }, G = "var(--editor-overlay-inverse-scale, 1)", je = "#377be2", Me = "#e23c3c";
409
409
  function Ne({ point: e }) {
410
410
  let t = e.positive ? je : Me;
411
- return /* @__PURE__ */ O("div", {
411
+ return /* @__PURE__ */ v("div", {
412
412
  style: {
413
413
  position: "absolute",
414
414
  left: e.x,
@@ -435,7 +435,7 @@ function Ne({ point: e }) {
435
435
  });
436
436
  }
437
437
  function Pe({ image: e, points: t, boxes: n, status: r }) {
438
- return /* @__PURE__ */ k("div", {
438
+ return /* @__PURE__ */ y("div", {
439
439
  style: {
440
440
  position: "absolute",
441
441
  left: 0,
@@ -445,8 +445,8 @@ function Pe({ image: e, points: t, boxes: n, status: r }) {
445
445
  pointerEvents: "none"
446
446
  },
447
447
  children: [
448
- /* @__PURE__ */ O("style", { children: "@keyframes editorv2-assistant-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}" }),
449
- n.map((e, t) => /* @__PURE__ */ O("div", { style: {
448
+ /* @__PURE__ */ v("style", { children: "@keyframes editorv2-assistant-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}" }),
449
+ n.map((e, t) => /* @__PURE__ */ v("div", { style: {
450
450
  position: "absolute",
451
451
  left: e.x,
452
452
  top: e.y,
@@ -458,7 +458,7 @@ function Pe({ image: e, points: t, boxes: n, status: r }) {
458
458
  backgroundSize: "200% 100%",
459
459
  animation: "editorv2-assistant-shimmer 1.4s linear infinite"
460
460
  } }, `box-${t}-${e.x}-${e.y}-${e.width}-${e.height}`)),
461
- r === "loading" && t.map((e, t) => /* @__PURE__ */ O(Ne, { point: e }, `pt-${t}-${e.x}-${e.y}`))
461
+ r === "loading" && t.map((e, t) => /* @__PURE__ */ v(Ne, { point: e }, `pt-${t}-${e.x}-${e.y}`))
462
462
  ]
463
463
  });
464
464
  }
@@ -475,15 +475,15 @@ function K(e) {
475
475
  }
476
476
  function Fe({ x: e, y: t, items: n, onClose: r }) {
477
477
  let i = K(n);
478
- return /* @__PURE__ */ k(m, {
478
+ return /* @__PURE__ */ y(p, {
479
479
  open: !0,
480
480
  modal: !1,
481
481
  onOpenChange: (e) => {
482
482
  e || r();
483
483
  },
484
- children: [/* @__PURE__ */ O(m.Trigger, {
484
+ children: [/* @__PURE__ */ v(p.Trigger, {
485
485
  asChild: !0,
486
- children: /* @__PURE__ */ O("span", {
486
+ children: /* @__PURE__ */ v("span", {
487
487
  "aria-hidden": !0,
488
488
  style: {
489
489
  position: "absolute",
@@ -493,7 +493,7 @@ function Fe({ x: e, y: t, items: n, onClose: r }) {
493
493
  height: 0
494
494
  }
495
495
  })
496
- }), /* @__PURE__ */ O(m.Content, {
496
+ }), /* @__PURE__ */ v(p.Content, {
497
497
  side: "bottom",
498
498
  align: "start",
499
499
  sideOffset: 2,
@@ -504,20 +504,20 @@ function Fe({ x: e, y: t, items: n, onClose: r }) {
504
504
  },
505
505
  onContextMenu: (e) => e.preventDefault(),
506
506
  onCloseAutoFocus: (e) => e.preventDefault(),
507
- children: i.map((e, t) => "separator" in e ? /* @__PURE__ */ O(m.Separator, { className: "aivex:shrink-0" }, `sep-${t}`) : /* @__PURE__ */ O(m.Item, {
507
+ children: i.map((e, t) => "separator" in e ? /* @__PURE__ */ v(p.Separator, { className: "aivex:shrink-0" }, `sep-${t}`) : /* @__PURE__ */ v(p.Item, {
508
508
  danger: e.danger,
509
509
  disabled: e.disabled,
510
510
  className: "aivex:shrink-0",
511
511
  onSelect: () => e.onClick(),
512
- children: /* @__PURE__ */ k("span", {
512
+ children: /* @__PURE__ */ y("span", {
513
513
  className: "aivex:flex aivex:w-full aivex:items-center aivex:justify-between aivex:gap-6",
514
- children: [/* @__PURE__ */ k("span", {
514
+ children: [/* @__PURE__ */ y("span", {
515
515
  className: "aivex:flex aivex:min-w-0 aivex:items-center aivex:gap-1.5",
516
- children: [e.icon, /* @__PURE__ */ O("span", {
516
+ children: [e.icon, /* @__PURE__ */ v("span", {
517
517
  className: "aivex:truncate",
518
518
  children: e.label
519
519
  })]
520
- }), e.shortcut && /* @__PURE__ */ O(m.Shortcut, { children: e.shortcut })]
520
+ }), e.shortcut && /* @__PURE__ */ v(p.Shortcut, { children: e.shortcut })]
521
521
  })
522
522
  }, e.label))
523
523
  })]
@@ -526,8 +526,8 @@ function Fe({ x: e, y: t, items: n, onClose: r }) {
526
526
  //#endregion
527
527
  //#region src/components/ShapeEditor/_components/CursorGuide.tsx
528
528
  function Ie({ color: e = "#1e88e5" }) {
529
- let t = T(null), n = T(null), r = T(null);
530
- return y(() => {
529
+ let t = O(null), n = O(null), r = O(null);
530
+ return S(() => {
531
531
  let e = t.current, i = n.current, a = r.current;
532
532
  if (!e || !i || !a) return;
533
533
  let o = (t) => {
@@ -543,10 +543,10 @@ function Ie({ color: e = "#1e88e5" }) {
543
543
  return window.addEventListener("mousemove", o), e.parentElement?.addEventListener("mouseleave", s), () => {
544
544
  window.removeEventListener("mousemove", o), e.parentElement?.removeEventListener("mouseleave", s);
545
545
  };
546
- }, []), /* @__PURE__ */ k("div", {
546
+ }, []), /* @__PURE__ */ y("div", {
547
547
  ref: t,
548
548
  className: "aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:overflow-hidden",
549
- children: [/* @__PURE__ */ O("div", {
549
+ children: [/* @__PURE__ */ v("div", {
550
550
  ref: n,
551
551
  style: {
552
552
  position: "absolute",
@@ -558,7 +558,7 @@ function Ie({ color: e = "#1e88e5" }) {
558
558
  opacity: .6,
559
559
  display: "none"
560
560
  }
561
- }), /* @__PURE__ */ O("div", {
561
+ }), /* @__PURE__ */ v("div", {
562
562
  ref: r,
563
563
  style: {
564
564
  position: "absolute",
@@ -576,7 +576,7 @@ function Ie({ color: e = "#1e88e5" }) {
576
576
  //#endregion
577
577
  //#region src/components/ShapeEditor/_components/ImageStateOverlay.tsx
578
578
  function Le({ status: e, render: t, loadingLabel: n = Oe.imageLoading, errorLabel: r = Oe.imageLoadError }) {
579
- return /* @__PURE__ */ O("div", {
579
+ return /* @__PURE__ */ v("div", {
580
580
  "data-track-id": e === "loading" ? "editor-image-loading-wrap" : "editor-image-error-wrap",
581
581
  style: {
582
582
  position: "absolute",
@@ -590,7 +590,7 @@ function Le({ status: e, render: t, loadingLabel: n = Oe.imageLoading, errorLabe
590
590
  fontFamily: "Pretendard, sans-serif",
591
591
  pointerEvents: e === "error" ? "auto" : "none"
592
592
  },
593
- children: t ? t(e) : e === "loading" ? /* @__PURE__ */ k("div", {
593
+ children: t ? t(e) : e === "loading" ? /* @__PURE__ */ y("div", {
594
594
  style: {
595
595
  display: "flex",
596
596
  alignItems: "center",
@@ -598,7 +598,7 @@ function Le({ status: e, render: t, loadingLabel: n = Oe.imageLoading, errorLabe
598
598
  fontSize: 13
599
599
  },
600
600
  children: [
601
- /* @__PURE__ */ O("span", { style: {
601
+ /* @__PURE__ */ v("span", { style: {
602
602
  width: 18,
603
603
  height: 18,
604
604
  borderRadius: "50%",
@@ -607,20 +607,20 @@ function Le({ status: e, render: t, loadingLabel: n = Oe.imageLoading, errorLabe
607
607
  animation: "editorv2-image-spin 0.7s linear infinite"
608
608
  } }),
609
609
  n,
610
- /* @__PURE__ */ O("style", { children: "@keyframes editorv2-image-spin{to{transform:rotate(360deg)}}" })
610
+ /* @__PURE__ */ v("style", { children: "@keyframes editorv2-image-spin{to{transform:rotate(360deg)}}" })
611
611
  ]
612
- }) : /* @__PURE__ */ k("div", {
612
+ }) : /* @__PURE__ */ y("div", {
613
613
  style: {
614
614
  textAlign: "center",
615
615
  opacity: .85
616
616
  },
617
- children: [/* @__PURE__ */ O("div", {
617
+ children: [/* @__PURE__ */ v("div", {
618
618
  style: {
619
619
  fontSize: 28,
620
620
  marginBottom: 6
621
621
  },
622
622
  children: "⚠"
623
- }), /* @__PURE__ */ O("div", {
623
+ }), /* @__PURE__ */ v("div", {
624
624
  style: { fontSize: 13 },
625
625
  children: r
626
626
  })]
@@ -653,7 +653,7 @@ function We(e, t) {
653
653
  }
654
654
  //#endregion
655
655
  //#region src/components/ShapeEditor/_components/MinimapShape.tsx
656
- var Ge = _(function({ shape: e, strokeSize: t, register: n }) {
656
+ var Ge = b(function({ shape: e, strokeSize: t, register: n }) {
657
657
  let { type: r, points: i } = e, a = Ue(e, { strokeWidth: t }), o = (t) => n?.(e.id, t), s = {
658
658
  ref: o,
659
659
  stroke: a.color,
@@ -664,7 +664,7 @@ var Ge = _(function({ shape: e, strokeSize: t, register: n }) {
664
664
  fillOpacity: a.fillAlpha,
665
665
  vectorEffect: "non-scaling-stroke"
666
666
  };
667
- if (r === F.POINT) return /* @__PURE__ */ O("circle", {
667
+ if (r === F.POINT) return /* @__PURE__ */ v("circle", {
668
668
  ref: o,
669
669
  cx: i[0].x,
670
670
  cy: i[0].y,
@@ -674,13 +674,13 @@ var Ge = _(function({ shape: e, strokeSize: t, register: n }) {
674
674
  });
675
675
  if (r === F.RECTANGLE || r === F.ELLIPSE) {
676
676
  let e = B(i);
677
- return r === F.ELLIPSE ? /* @__PURE__ */ O("ellipse", {
677
+ return r === F.ELLIPSE ? /* @__PURE__ */ v("ellipse", {
678
678
  cx: (e.minX + e.maxX) / 2,
679
679
  cy: (e.minY + e.maxY) / 2,
680
680
  rx: (e.maxX - e.minX) / 2,
681
681
  ry: (e.maxY - e.minY) / 2,
682
682
  ...s
683
- }) : /* @__PURE__ */ O("rect", {
683
+ }) : /* @__PURE__ */ v("rect", {
684
684
  x: e.minX,
685
685
  y: e.minY,
686
686
  width: e.maxX - e.minX,
@@ -689,10 +689,10 @@ var Ge = _(function({ shape: e, strokeSize: t, register: n }) {
689
689
  });
690
690
  }
691
691
  let c = i.map((e) => `${e.x},${e.y}`).join(" ");
692
- return r === F.LINE ? /* @__PURE__ */ O("polyline", {
692
+ return r === F.LINE ? /* @__PURE__ */ v("polyline", {
693
693
  points: c,
694
694
  ...s
695
- }) : /* @__PURE__ */ O("polygon", {
695
+ }) : /* @__PURE__ */ v("polygon", {
696
696
  points: c,
697
697
  ...s
698
698
  });
@@ -701,37 +701,37 @@ var Ge = _(function({ shape: e, strokeSize: t, register: n }) {
701
701
  //#region src/components/ShapeEditor/_components/RegionOverlay.tsx
702
702
  function Ke({ image: e, region: t, maskId: n, width: r, height: i, strokeWidth: a, strokeDasharray: o, style: s }) {
703
703
  let c = [...t.visibleOutline, ...t.occludedOutline];
704
- return /* @__PURE__ */ k("svg", {
704
+ return /* @__PURE__ */ y("svg", {
705
705
  width: r,
706
706
  height: i,
707
707
  viewBox: `0 0 ${e.w} ${e.h}`,
708
708
  style: s,
709
709
  "aria-hidden": !0,
710
710
  children: [
711
- /* @__PURE__ */ O("defs", { children: /* @__PURE__ */ k("mask", {
711
+ /* @__PURE__ */ v("defs", { children: /* @__PURE__ */ y("mask", {
712
712
  id: n,
713
713
  children: [
714
- /* @__PURE__ */ O("rect", {
714
+ /* @__PURE__ */ v("rect", {
715
715
  x: 0,
716
716
  y: 0,
717
717
  width: e.w,
718
718
  height: e.h,
719
719
  fill: "white"
720
720
  }),
721
- t.rects.map((e, t) => /* @__PURE__ */ O("rect", {
721
+ t.rects.map((e, t) => /* @__PURE__ */ v("rect", {
722
722
  x: e.x,
723
723
  y: e.y,
724
724
  width: e.w,
725
725
  height: e.h,
726
726
  fill: "black"
727
727
  }, e.id ?? `area-${t}`)),
728
- t.zones.map((e, t) => /* @__PURE__ */ O("polygon", {
728
+ t.zones.map((e, t) => /* @__PURE__ */ v("polygon", {
729
729
  points: e.points.map((e) => `${e.x},${e.y}`).join(" "),
730
730
  fill: "white"
731
731
  }, `occ-${t}`))
732
732
  ]
733
733
  }) }),
734
- /* @__PURE__ */ O("rect", {
734
+ /* @__PURE__ */ v("rect", {
735
735
  x: 0,
736
736
  y: 0,
737
737
  width: e.w,
@@ -740,7 +740,7 @@ function Ke({ image: e, region: t, maskId: n, width: r, height: i, strokeWidth:
740
740
  fillOpacity: t.dim.opacity,
741
741
  mask: `url(#${n})`
742
742
  }),
743
- c.length > 0 && /* @__PURE__ */ O("path", {
743
+ c.length > 0 && /* @__PURE__ */ v("path", {
744
744
  d: c.map(([e, t]) => `M${e.x} ${e.y}L${t.x} ${t.y}`).join(""),
745
745
  fill: "none",
746
746
  stroke: "#fff",
@@ -754,29 +754,29 @@ function Ke({ image: e, region: t, maskId: n, width: r, height: i, strokeWidth:
754
754
  //#endregion
755
755
  //#region src/components/ShapeEditor/_components/SettingsPanel.tsx
756
756
  function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.viewSettings }) {
757
- return y(() => {
757
+ return S(() => {
758
758
  let e = (e) => {
759
759
  e.key === "Escape" && c();
760
760
  }, t = () => c();
761
761
  return window.addEventListener("keydown", e), window.addEventListener("pointerdown", t), () => {
762
762
  window.removeEventListener("keydown", e), window.removeEventListener("pointerdown", t);
763
763
  };
764
- }, [c]), /* @__PURE__ */ k("div", {
764
+ }, [c]), /* @__PURE__ */ y("div", {
765
765
  className: "aivex:absolute aivex:bottom-full aivex:left-0 aivex:mb-md aivex:flex aivex:w-[277px] aivex:flex-col aivex:gap-lg aivex:rounded-xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-xl aivex:text-text-primary aivex:shadow-[var(--aivex-elevation-md)]",
766
766
  onPointerDown: (e) => e.stopPropagation(),
767
767
  children: [
768
- /* @__PURE__ */ O("div", {
768
+ /* @__PURE__ */ v("div", {
769
769
  className: "aivex:px-xs aivex:text-body-md",
770
770
  children: d.title
771
771
  }),
772
- /* @__PURE__ */ k("div", {
772
+ /* @__PURE__ */ y("div", {
773
773
  className: "aivex:flex aivex:flex-col aivex:gap-md",
774
774
  children: [
775
- /* @__PURE__ */ O(Je, {
776
- icon: /* @__PURE__ */ O(r, { size: 16 }),
775
+ /* @__PURE__ */ v(Je, {
776
+ icon: /* @__PURE__ */ v(r, { size: 16 }),
777
777
  label: d.brightness,
778
778
  value: i.brightness.toFixed(2),
779
- children: /* @__PURE__ */ O(h, {
779
+ children: /* @__PURE__ */ v(m, {
780
780
  min: 0,
781
781
  max: 3,
782
782
  step: .05,
@@ -784,11 +784,11 @@ function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.vie
784
784
  onValueChange: ([e]) => s({ brightness: e })
785
785
  })
786
786
  }),
787
- /* @__PURE__ */ O(Je, {
788
- icon: /* @__PURE__ */ O(n, { size: 16 }),
787
+ /* @__PURE__ */ v(Je, {
788
+ icon: /* @__PURE__ */ v(n, { size: 16 }),
789
789
  label: d.contrast,
790
790
  value: i.contrast.toFixed(2),
791
- children: /* @__PURE__ */ O(h, {
791
+ children: /* @__PURE__ */ v(m, {
792
792
  min: 0,
793
793
  max: 3,
794
794
  step: .05,
@@ -796,11 +796,11 @@ function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.vie
796
796
  onValueChange: ([e]) => s({ contrast: e })
797
797
  })
798
798
  }),
799
- /* @__PURE__ */ O(Je, {
800
- icon: /* @__PURE__ */ O(t, { size: 16 }),
799
+ /* @__PURE__ */ v(Je, {
800
+ icon: /* @__PURE__ */ v(t, { size: 16 }),
801
801
  label: d.strokeSize,
802
802
  value: String(i.strokeSize),
803
- children: /* @__PURE__ */ O(h, {
803
+ children: /* @__PURE__ */ v(m, {
804
804
  min: 1,
805
805
  max: 10,
806
806
  step: .5,
@@ -808,11 +808,11 @@ function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.vie
808
808
  onValueChange: ([e]) => s({ strokeSize: e })
809
809
  })
810
810
  }),
811
- /* @__PURE__ */ O(Je, {
812
- icon: /* @__PURE__ */ O(e, { size: 16 }),
811
+ /* @__PURE__ */ v(Je, {
812
+ icon: /* @__PURE__ */ v(e, { size: 16 }),
813
813
  label: d.simplifyStrength,
814
814
  value: String(i.simplifyStrength),
815
- children: /* @__PURE__ */ O(h, {
815
+ children: /* @__PURE__ */ v(m, {
816
816
  min: .5,
817
817
  max: 5,
818
818
  step: .5,
@@ -820,11 +820,11 @@ function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.vie
820
820
  onValueChange: ([e]) => s({ simplifyStrength: e })
821
821
  })
822
822
  }),
823
- /* @__PURE__ */ O(Je, {
824
- icon: /* @__PURE__ */ O(l, { size: 16 }),
823
+ /* @__PURE__ */ v(Je, {
824
+ icon: /* @__PURE__ */ v(l, { size: 16 }),
825
825
  label: d.zoomSensitivity,
826
826
  value: i.zoomSensitivity.toFixed(1),
827
- children: /* @__PURE__ */ O(h, {
827
+ children: /* @__PURE__ */ v(m, {
828
828
  min: .2,
829
829
  max: 3,
830
830
  step: .1,
@@ -832,89 +832,89 @@ function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.vie
832
832
  onValueChange: ([e]) => s({ zoomSensitivity: e })
833
833
  })
834
834
  }),
835
- /* @__PURE__ */ k("div", {
835
+ /* @__PURE__ */ y("div", {
836
836
  className: "aivex:flex aivex:flex-col aivex:gap-xs",
837
837
  children: [
838
- /* @__PURE__ */ O(Ye, {
838
+ /* @__PURE__ */ v(Ye, {
839
839
  label: d.pixelation,
840
840
  checked: !i.imageSmoothing,
841
841
  onChange: (e) => s({ imageSmoothing: !e })
842
842
  }),
843
- /* @__PURE__ */ O(Ye, {
843
+ /* @__PURE__ */ v(Ye, {
844
844
  label: d.cursorGuide,
845
845
  checked: i.showCursorGuide,
846
846
  onChange: (e) => s({ showCursorGuide: e })
847
847
  }),
848
- /* @__PURE__ */ O(Ye, {
848
+ /* @__PURE__ */ v(Ye, {
849
849
  label: d.guideMask,
850
850
  checked: i.showGuide,
851
851
  onChange: (e) => s({ showGuide: e })
852
852
  }),
853
- /* @__PURE__ */ O(Ye, {
853
+ /* @__PURE__ */ v(Ye, {
854
854
  label: d.regionMask,
855
855
  checked: i.showRegionMask,
856
856
  onChange: (e) => s({ showRegionMask: e })
857
857
  }),
858
- /* @__PURE__ */ O(Ye, {
858
+ /* @__PURE__ */ v(Ye, {
859
859
  label: d.keepZoomOnImageChange,
860
860
  checked: i.keepZoomOnImageChange,
861
861
  onChange: (e) => s({ keepZoomOnImageChange: e })
862
862
  }),
863
- /* @__PURE__ */ O(Ye, {
863
+ /* @__PURE__ */ v(Ye, {
864
864
  label: d.wheelZoom,
865
865
  checked: i.wheelZoom,
866
866
  onChange: (e) => s({ wheelZoom: e })
867
867
  })
868
868
  ]
869
869
  }),
870
- /* @__PURE__ */ O(p, {})
870
+ /* @__PURE__ */ v(h, {})
871
871
  ]
872
872
  }),
873
- /* @__PURE__ */ O("div", {
873
+ /* @__PURE__ */ v("div", {
874
874
  className: "aivex:flex aivex:justify-end",
875
- children: /* @__PURE__ */ k(u, {
875
+ children: /* @__PURE__ */ y(u, {
876
876
  variant: "solid",
877
877
  color: "secondary",
878
878
  size: "md",
879
879
  onClick: () => s({ ...o }),
880
- children: [/* @__PURE__ */ O(a, { size: 20 }), d.reset]
880
+ children: [/* @__PURE__ */ v(a, { size: 20 }), d.reset]
881
881
  })
882
882
  })
883
883
  ]
884
884
  });
885
885
  }
886
886
  function Je({ icon: e, label: t, value: n, children: r }) {
887
- return /* @__PURE__ */ k("div", {
887
+ return /* @__PURE__ */ y("div", {
888
888
  className: "aivex:flex aivex:flex-col aivex:px-md aivex:py-2xs",
889
- children: [/* @__PURE__ */ k("div", {
889
+ children: [/* @__PURE__ */ y("div", {
890
890
  className: "aivex:flex aivex:items-center aivex:gap-xs",
891
891
  children: [
892
- /* @__PURE__ */ O("span", {
892
+ /* @__PURE__ */ v("span", {
893
893
  className: "aivex:flex aivex:h-4 aivex:items-center aivex:text-text-secondary",
894
894
  children: e
895
895
  }),
896
- /* @__PURE__ */ O("span", {
896
+ /* @__PURE__ */ v("span", {
897
897
  className: "aivex:flex-1 aivex:truncate aivex:text-label-md",
898
898
  children: t
899
899
  }),
900
- /* @__PURE__ */ O("span", {
900
+ /* @__PURE__ */ v("span", {
901
901
  className: "aivex:tabular-nums aivex:text-label-md aivex:text-text-secondary",
902
902
  children: n
903
903
  })
904
904
  ]
905
- }), /* @__PURE__ */ O("div", {
905
+ }), /* @__PURE__ */ v("div", {
906
906
  className: "aivex:flex aivex:h-5 aivex:items-center",
907
907
  children: r
908
908
  })]
909
909
  });
910
910
  }
911
911
  function Ye({ label: e, checked: t, onChange: n }) {
912
- return /* @__PURE__ */ k("div", {
912
+ return /* @__PURE__ */ y("div", {
913
913
  className: "aivex:flex aivex:items-center aivex:gap-md aivex:rounded-md aivex:px-md aivex:py-sm",
914
- children: [/* @__PURE__ */ O("span", {
914
+ children: [/* @__PURE__ */ v("span", {
915
915
  className: "aivex:flex-1 aivex:truncate aivex:text-label-lg",
916
916
  children: e
917
- }), /* @__PURE__ */ O(g, {
917
+ }), /* @__PURE__ */ v(g, {
918
918
  size: "md",
919
919
  checked: t,
920
920
  onCheckedChange: n
@@ -923,7 +923,7 @@ function Ye({ label: e, checked: t, onChange: n }) {
923
923
  }
924
924
  //#endregion
925
925
  //#region src/components/ShapeEditor/_components/Minimap.tsx
926
- var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r = !1, maskDataUrl: a, region: o, roiMaskId: l, shapes: p, view: m, viewDefaults: h, onChangeView: g, nav: _, registerShape: v, rectRef: y, zoomLabelRef: b, onZoom100: x, open: S, onToggleOpen: C, showSettings: w = !0, settingsOpen: T, onToggleSettings: E, onCloseSettings: D, labels: A = Oe.minimap, settingsLabels: j }) {
926
+ var Xe = b(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r = !1, maskDataUrl: a, region: o, roiMaskId: l, shapes: p, view: m, viewDefaults: h, onChangeView: g, nav: _, registerShape: b, rectRef: x, zoomLabelRef: S, onZoom100: C, open: w, onToggleOpen: T, showSettings: E = !0, settingsOpen: D, onToggleSettings: O, onCloseSettings: k, labels: A = Oe.minimap, settingsLabels: j }) {
927
927
  let { offX: M, offY: N, dispW: P, dispH: ee, zoomCentered: te } = _, ne = {
928
928
  position: "absolute",
929
929
  left: M,
@@ -931,12 +931,12 @@ var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
931
931
  width: P,
932
932
  height: ee
933
933
  };
934
- return /* @__PURE__ */ k("div", {
934
+ return /* @__PURE__ */ y("div", {
935
935
  className: "aivex:absolute aivex:bottom-2 aivex:left-2 aivex:w-[220px] aivex:rounded-[12px] aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-md aivex:shadow-[0_4px_12px_rgba(13,13,18,0.24)]",
936
- children: [/* @__PURE__ */ O("div", {
937
- className: `aivex:overflow-hidden aivex:rounded-sm aivex:transition-all aivex:duration-200 aivex:ease-in-out ${S ? "aivex:mb-md aivex:opacity-100" : "aivex:opacity-0"}`,
938
- style: { maxHeight: S ? 204 : 0 },
939
- children: /* @__PURE__ */ O("div", {
936
+ children: [/* @__PURE__ */ v("div", {
937
+ className: `aivex:overflow-hidden aivex:rounded-sm aivex:transition-all aivex:duration-200 aivex:ease-in-out ${w ? "aivex:mb-md aivex:opacity-100" : "aivex:opacity-0"}`,
938
+ style: { maxHeight: w ? 204 : 0 },
939
+ children: /* @__PURE__ */ v("div", {
940
940
  style: {
941
941
  width: 204,
942
942
  height: 204
@@ -948,7 +948,7 @@ var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
948
948
  onPointerCancel: r ? void 0 : _.endMinimapDrag,
949
949
  onWheel: r ? void 0 : _.handleMinimapWheel,
950
950
  "aria-busy": r,
951
- children: /* @__PURE__ */ k("div", {
951
+ children: /* @__PURE__ */ y("div", {
952
952
  style: {
953
953
  position: "absolute",
954
954
  inset: 0,
@@ -956,13 +956,13 @@ var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
956
956
  transition: n ? "opacity 0.3s ease" : "none"
957
957
  },
958
958
  children: [
959
- t && /* @__PURE__ */ O("img", {
959
+ t && /* @__PURE__ */ v("img", {
960
960
  src: t,
961
961
  alt: "",
962
962
  draggable: !1,
963
963
  style: ne
964
964
  }),
965
- a && m.showGuide && /* @__PURE__ */ O("img", {
965
+ a && m.showGuide && /* @__PURE__ */ v("img", {
966
966
  src: a,
967
967
  alt: "",
968
968
  draggable: !1,
@@ -973,7 +973,7 @@ var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
973
973
  pointerEvents: "none"
974
974
  }
975
975
  }),
976
- m.showRegionMask && o && o.rects.length > 0 && /* @__PURE__ */ O(Ke, {
976
+ m.showRegionMask && o && o.rects.length > 0 && /* @__PURE__ */ v(Ke, {
977
977
  image: e,
978
978
  region: o,
979
979
  maskId: l,
@@ -988,7 +988,7 @@ var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
988
988
  pointerEvents: "none"
989
989
  }
990
990
  }),
991
- /* @__PURE__ */ O("svg", {
991
+ /* @__PURE__ */ v("svg", {
992
992
  viewBox: `0 0 ${e.w} ${e.h}`,
993
993
  width: P,
994
994
  height: ee,
@@ -999,14 +999,14 @@ var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
999
999
  pointerEvents: "none"
1000
1000
  },
1001
1001
  "aria-hidden": !0,
1002
- children: R(p).filter(ie).map((e) => /* @__PURE__ */ O(Ge, {
1002
+ children: R(p).filter(ie).map((e) => /* @__PURE__ */ v(Ge, {
1003
1003
  shape: e,
1004
1004
  strokeSize: m.strokeSize,
1005
- register: v
1005
+ register: b
1006
1006
  }, e.id))
1007
1007
  }),
1008
- /* @__PURE__ */ O("div", {
1009
- ref: y,
1008
+ /* @__PURE__ */ v("div", {
1009
+ ref: x,
1010
1010
  style: {
1011
1011
  position: "absolute",
1012
1012
  border: `1px solid ${Re}`,
@@ -1018,62 +1018,62 @@ var Xe = _(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
1018
1018
  ]
1019
1019
  })
1020
1020
  })
1021
- }), /* @__PURE__ */ k("div", {
1021
+ }), /* @__PURE__ */ y("div", {
1022
1022
  className: "aivex:relative aivex:flex aivex:items-center aivex:gap-xs",
1023
1023
  children: [
1024
- /* @__PURE__ */ O(u, {
1024
+ /* @__PURE__ */ v(u, {
1025
1025
  variant: "ghost",
1026
1026
  size: "icon-md",
1027
1027
  "aria-label": A.zoomOut,
1028
1028
  onClick: () => te(1 / 1.2),
1029
1029
  disabled: r,
1030
- children: /* @__PURE__ */ O(f, { size: 20 })
1030
+ children: /* @__PURE__ */ v(f, { size: 20 })
1031
1031
  }),
1032
- /* @__PURE__ */ O(u, {
1032
+ /* @__PURE__ */ v(u, {
1033
1033
  variant: "ghost",
1034
1034
  size: "md",
1035
1035
  "aria-label": A.zoom100,
1036
- onClick: x,
1036
+ onClick: C,
1037
1037
  disabled: r,
1038
1038
  className: "aivex:w-[60px] aivex:tabular-nums",
1039
- children: /* @__PURE__ */ O("span", {
1040
- ref: b,
1039
+ children: /* @__PURE__ */ v("span", {
1040
+ ref: S,
1041
1041
  children: "100%"
1042
1042
  })
1043
1043
  }),
1044
- /* @__PURE__ */ O(u, {
1044
+ /* @__PURE__ */ v(u, {
1045
1045
  variant: "ghost",
1046
1046
  size: "icon-md",
1047
1047
  "aria-label": A.zoomIn,
1048
1048
  onClick: () => te(1.2),
1049
1049
  disabled: r,
1050
- children: /* @__PURE__ */ O(i, { size: 20 })
1050
+ children: /* @__PURE__ */ v(i, { size: 20 })
1051
1051
  }),
1052
- w && /* @__PURE__ */ k("div", {
1052
+ E && /* @__PURE__ */ y("div", {
1053
1053
  className: "aivex:relative",
1054
- children: [/* @__PURE__ */ O(u, {
1054
+ children: [/* @__PURE__ */ v(u, {
1055
1055
  variant: "ghost",
1056
1056
  size: "icon-md",
1057
1057
  "aria-label": A.viewSettings,
1058
- onClick: E,
1058
+ onClick: O,
1059
1059
  onPointerDown: (e) => e.stopPropagation(),
1060
- className: T ? "aivex:text-text-brand" : void 0,
1061
- children: /* @__PURE__ */ O(d, { size: 20 })
1062
- }), T && /* @__PURE__ */ O(qe, {
1060
+ className: D ? "aivex:text-text-brand" : void 0,
1061
+ children: /* @__PURE__ */ v(d, { size: 20 })
1062
+ }), D && /* @__PURE__ */ v(qe, {
1063
1063
  value: m,
1064
1064
  defaults: h,
1065
1065
  onChange: g,
1066
- onClose: D,
1066
+ onClose: k,
1067
1067
  labels: j
1068
1068
  })]
1069
1069
  }),
1070
- /* @__PURE__ */ O(u, {
1070
+ /* @__PURE__ */ v(u, {
1071
1071
  variant: "ghost",
1072
1072
  size: "icon-md",
1073
1073
  "aria-label": A.toggleMinimap,
1074
1074
  title: "(M)",
1075
- onClick: C,
1076
- children: O(S ? c : s, { size: 20 })
1075
+ onClick: T,
1076
+ children: v(w ? c : s, { size: 20 })
1077
1077
  })
1078
1078
  ]
1079
1079
  })]
@@ -1115,7 +1115,7 @@ function it(e) {
1115
1115
  return `${Math.round(e.width)} x ${Math.round(e.height)} px`;
1116
1116
  }
1117
1117
  function at({ color: e, striped: t }) {
1118
- return /* @__PURE__ */ O("span", { style: {
1118
+ return /* @__PURE__ */ v("span", { style: {
1119
1119
  display: "inline-block",
1120
1120
  width: 12,
1121
1121
  height: 12,
@@ -1127,9 +1127,9 @@ function at({ color: e, striped: t }) {
1127
1127
  } });
1128
1128
  }
1129
1129
  function ot({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i }) {
1130
- return /* @__PURE__ */ O(D, { children: e.map((e) => {
1130
+ return /* @__PURE__ */ v(_, { children: e.map((e) => {
1131
1131
  let a = et(e.points), o = e.type === F.POINT, s = o ? void 0 : t?.(e), c = e.style?.color ?? "#00e5ff", l = !!e.style?.dashed || !!e.style?.dash, u = rt(e, e.points), d = r ? r(u) : it(u);
1132
- return /* @__PURE__ */ k("div", {
1132
+ return /* @__PURE__ */ y("div", {
1133
1133
  ref: (t) => i(e.id, t),
1134
1134
  style: {
1135
1135
  position: "absolute",
@@ -1139,7 +1139,7 @@ function ot({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i })
1139
1139
  willChange: "transform",
1140
1140
  pointerEvents: "none"
1141
1141
  },
1142
- children: [!!s && /* @__PURE__ */ k("div", {
1142
+ children: [!!s && /* @__PURE__ */ y("div", {
1143
1143
  style: {
1144
1144
  position: "absolute",
1145
1145
  left: 0,
@@ -1151,11 +1151,11 @@ function ot({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i })
1151
1151
  transformOrigin: "left top",
1152
1152
  ...$e
1153
1153
  },
1154
- children: [!n && /* @__PURE__ */ O(at, {
1154
+ children: [!n && /* @__PURE__ */ v(at, {
1155
1155
  color: c,
1156
1156
  striped: l
1157
- }), /* @__PURE__ */ O("span", { children: s })]
1158
- }), !o && !!d && /* @__PURE__ */ O("div", {
1157
+ }), /* @__PURE__ */ v("span", { children: s })]
1158
+ }), !o && !!d && /* @__PURE__ */ v("div", {
1159
1159
  "data-selinfo-dim": !0,
1160
1160
  style: {
1161
1161
  position: "absolute",
@@ -1845,11 +1845,11 @@ function Yt(e) {
1845
1845
  //#endregion
1846
1846
  //#region src/components/ShapeEditor/_state/useAssistant.ts
1847
1847
  function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistantRef: i }) {
1848
- let [a, o] = E("idle"), [s, c] = E([]), [l, u] = E([]), d = T([]), f = T([]), p = T([]), m = T("idle"), h = T(0), g = T(null), _ = T(null), y = T(0), b = v((e) => {
1848
+ let [a, o] = k("idle"), [s, c] = k([]), [l, u] = k([]), d = O([]), f = O([]), p = O([]), m = O("idle"), h = O(0), g = O(null), _ = O(null), v = O(0), y = x((e) => {
1849
1849
  d.current = e(d.current), u(d.current);
1850
- }, []), x = v((e) => {
1850
+ }, []), b = x((e) => {
1851
1851
  m.current = e, o(e);
1852
- }, []), S = v((e, t, r) => {
1852
+ }, []), S = x((e, t, r) => {
1853
1853
  let a = i.current?.rectResult === "rotatedRect";
1854
1854
  return e.map((e) => {
1855
1855
  if (t === "rect" && a) return {
@@ -1883,17 +1883,17 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1883
1883
  meta: n
1884
1884
  };
1885
1885
  });
1886
- }, [n, i]), C = v(() => {
1887
- h.current++, f.current = [], p.current = [], g.current = null, _.current = null, c([]), x("idle");
1888
- }, [x]), w = v(() => {
1889
- y.current++, b(() => []);
1886
+ }, [n, i]), C = x(() => {
1887
+ h.current++, f.current = [], p.current = [], g.current = null, _.current = null, c([]), b("idle");
1888
+ }, [b]), w = x(() => {
1889
+ v.current++, y(() => []);
1890
1890
  let t = _.current;
1891
1891
  t ? e.current.update([t]) : p.current.length && e.current.remove(p.current), C();
1892
1892
  }, [
1893
1893
  e,
1894
1894
  C,
1895
- b
1896
- ]), D = v((n) => {
1895
+ y
1896
+ ]), T = x((n) => {
1897
1897
  let i = p.current;
1898
1898
  if (!n.length) {
1899
1899
  i.length && (e.current.remove(i), p.current = []);
@@ -1920,7 +1920,7 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1920
1920
  t,
1921
1921
  r,
1922
1922
  S
1923
- ]), O = v(async () => {
1923
+ ]), E = x(async () => {
1924
1924
  let e = i.current?.infer;
1925
1925
  if (!e) return;
1926
1926
  let t = {
@@ -1928,19 +1928,19 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1928
1928
  points: f.current,
1929
1929
  base: g.current ?? void 0
1930
1930
  }, n = ++h.current;
1931
- x("loading");
1931
+ b("loading");
1932
1932
  let r = [];
1933
1933
  try {
1934
1934
  r = (await e(t) ?? []).filter((e) => e.length >= 3);
1935
1935
  } catch {
1936
1936
  r = [];
1937
1937
  }
1938
- n === h.current && (D(r), x("ready"));
1938
+ n === h.current && (T(r), b("ready"));
1939
1939
  }, [
1940
1940
  i,
1941
- D,
1942
- x
1943
- ]), k = v((e, t) => {
1941
+ T,
1942
+ b
1943
+ ]), D = x((e, t) => {
1944
1944
  f.current = [...f.current, {
1945
1945
  x: e.x,
1946
1946
  y: e.y,
@@ -1949,16 +1949,16 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1949
1949
  x: e.x,
1950
1950
  y: e.y,
1951
1951
  positive: t
1952
- }]), O();
1953
- }, [O]), A = v((e) => {
1952
+ }]), E();
1953
+ }, [E]), A = x((e) => {
1954
1954
  C();
1955
1955
  let t = [{
1956
1956
  x: e.x,
1957
1957
  y: e.y,
1958
1958
  positive: !0
1959
1959
  }];
1960
- f.current = t, c(t), O();
1961
- }, [C, O]), j = v((e, t, n) => {
1960
+ f.current = t, c(t), E();
1961
+ }, [C, E]), j = x((e, t, n) => {
1962
1962
  (p.current.length !== 1 || p.current[0] !== e.id) && (C(), p.current = [e.id], g.current = e.points, _.current = e), f.current = [...f.current, {
1963
1963
  x: t.x,
1964
1964
  y: t.y,
@@ -1967,17 +1967,17 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1967
1967
  x: t.x,
1968
1968
  y: t.y,
1969
1969
  positive: n
1970
- }]), O();
1971
- }, [C, O]);
1970
+ }]), E();
1971
+ }, [C, E]);
1972
1972
  return {
1973
1973
  status: a,
1974
1974
  points: s,
1975
1975
  boxes: l,
1976
- beginBox: v((n, a = "polygon") => {
1976
+ beginBox: x((n, a = "polygon") => {
1977
1977
  let o = i.current?.infer, s = t.current;
1978
1978
  if (!o || !s) return;
1979
- let c = y.current;
1980
- b((e) => [...e, n]), (async () => {
1979
+ let c = v.current;
1980
+ y((e) => [...e, n]), (async () => {
1981
1981
  let t = [];
1982
1982
  try {
1983
1983
  t = (await o({
@@ -1987,7 +1987,7 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1987
1987
  } catch {
1988
1988
  t = [];
1989
1989
  }
1990
- if (b((e) => e.filter((e) => e !== n)), c !== y.current) return;
1990
+ if (y((e) => e.filter((e) => e !== n)), c !== v.current) return;
1991
1991
  let i = S(t, a, s);
1992
1992
  i?.length && (e.current.create(i), r(i.map((e) => e.id)));
1993
1993
  })();
@@ -1997,14 +1997,14 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1997
1997
  S,
1998
1998
  r,
1999
1999
  e,
2000
- b
2000
+ y
2001
2001
  ]),
2002
- addPoint: k,
2002
+ addPoint: D,
2003
2003
  newPolygon: A,
2004
2004
  refineShape: j,
2005
2005
  finalize: C,
2006
2006
  cancel: w,
2007
- isActive: v(() => m.current === "loading" || f.current.length > 0 || d.current.length > 0 || p.current.length > 0, [])
2007
+ isActive: x(() => m.current === "loading" || f.current.length > 0 || d.current.length > 0 || p.current.length > 0, [])
2008
2008
  };
2009
2009
  }
2010
2010
  //#endregion
@@ -2238,24 +2238,24 @@ function bn(e, t) {
2238
2238
  return !n || !r ? n === r : n.mode === r.mode && n.editing === r.editing && n.editTargetIds.length === r.editTargetIds.length && n.editTargetIds.every((e, t) => e === r.editTargetIds[t]);
2239
2239
  }
2240
2240
  function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, brushSizeRef: a, simplifyEpsilonRef: o, draftMeta: s, engineRef: c, onDrawSessionChange: l, onDraftShapeChange: u, changeSelection: d, createShape: f }) {
2241
- let p = T(l);
2241
+ let p = O(l);
2242
2242
  p.current = l;
2243
- let m = T(u);
2243
+ let m = O(u);
2244
2244
  m.current = u;
2245
- let h = T(s);
2245
+ let h = O(s);
2246
2246
  h.current = s;
2247
- let g = T(f);
2247
+ let g = O(f);
2248
2248
  g.current = f;
2249
- let _ = T(null), y = T([]), b = T(null), x = T(/* @__PURE__ */ new Set()), S = T([[]]), C = T(0), w = T(null), E = T([]), D = T([]), O = T([]), k = T([[]]), A = T(0), j = T("draw"), M = () => j.current === "erase" ? "erase" : "add", N = () => O.current.length > 0 || E.current.length > 0 || e.current === W.BRUSH && y.current.length > 0, P = () => {
2249
+ let _ = O(null), v = O([]), y = O(null), b = O(/* @__PURE__ */ new Set()), S = O([[]]), C = O(0), w = O(null), T = O([]), E = O([]), D = O([]), k = O([[]]), A = O(0), j = O("draw"), M = () => j.current === "erase" ? "erase" : "add", N = () => D.current.length > 0 || T.current.length > 0 || e.current === W.BRUSH && v.current.length > 0, P = () => {
2250
2250
  let t = e.current;
2251
- return t === W.BRUSH && N() ? "brush" : t === W.POLYGON && y.current.length > 0 ? "polygon" : t === W.PATH && y.current.length > 0 ? "path" : "none";
2252
- }, ee = () => y.current.length > 0 || A.current > 0, te = () => y.current.length === 0 && A.current < k.current.length - 1, ne = () => C.current > 0, re = () => C.current < S.current.length - 1, ie = () => {
2251
+ return t === W.BRUSH && N() ? "brush" : t === W.POLYGON && v.current.length > 0 ? "polygon" : t === W.PATH && v.current.length > 0 ? "path" : "none";
2252
+ }, ee = () => v.current.length > 0 || A.current > 0, te = () => v.current.length === 0 && A.current < k.current.length - 1, ne = () => C.current > 0, re = () => C.current < S.current.length - 1, ie = () => {
2253
2253
  let t = e.current;
2254
2254
  return t === W.BRUSH ? ee() : t === W.POLYGON || t === W.PATH ? ne() : !1;
2255
2255
  }, ae = () => {
2256
2256
  let t = e.current;
2257
2257
  return t === W.BRUSH ? te() : t === W.POLYGON || t === W.PATH ? re() : !1;
2258
- }, I = () => P() !== "none", L = v(() => {
2258
+ }, I = () => P() !== "none", L = x(() => {
2259
2259
  let e = P(), t = {
2260
2260
  active: e !== "none",
2261
2261
  kind: e,
@@ -2263,27 +2263,27 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2263
2263
  canRedo: ae(),
2264
2264
  brush: e === "brush" ? {
2265
2265
  mode: j.current,
2266
- editing: O.current.length > 0,
2267
- editTargetIds: [...O.current]
2266
+ editing: D.current.length > 0,
2267
+ editTargetIds: [...D.current]
2268
2268
  } : void 0
2269
2269
  }, n = _.current;
2270
2270
  n && bn(n, t) || (_.current = t, p.current?.(t));
2271
- }, []), R = v(() => {
2271
+ }, []), R = x(() => {
2272
2272
  k.current = [[]], A.current = 0;
2273
- }, []), z = v(() => {
2273
+ }, []), z = x(() => {
2274
2274
  let t = c.current;
2275
2275
  if (!t) return;
2276
2276
  let n = e.current;
2277
2277
  if (n === W.BRUSH) {
2278
- let e = [...E.current];
2279
- if (y.current.length && e.push({
2280
- points: y.current,
2278
+ let e = [...T.current];
2279
+ if (v.current.length && e.push({
2280
+ points: v.current,
2281
2281
  mode: M()
2282
- }), !e.length && !D.current.length) {
2282
+ }), !e.length && !E.current.length) {
2283
2283
  t.clearPreview();
2284
2284
  return;
2285
2285
  }
2286
- let n = fn(e, a.current, D.current);
2286
+ let n = fn(e, a.current, E.current);
2287
2287
  if (!n) {
2288
2288
  t.clearPreview();
2289
2289
  return;
@@ -2292,7 +2292,7 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2292
2292
  t.previewScalarMask(n, r);
2293
2293
  return;
2294
2294
  }
2295
- let r = y.current;
2295
+ let r = v.current;
2296
2296
  if (!r.length) {
2297
2297
  t.clearPreview(), w.current && (w.current = null, m.current?.(null));
2298
2298
  return;
@@ -2300,8 +2300,8 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2300
2300
  let o = {
2301
2301
  ...i.current,
2302
2302
  color: i.current?.color ?? "#00e5ff"
2303
- }, s = Array.from(x.current), l = n !== W.PATH;
2304
- if (t.previewPoly(r, b.current, o, !1, s, l), n === W.POLYGON || n === W.PATH) {
2303
+ }, s = Array.from(b.current), l = n !== W.PATH;
2304
+ if (t.previewPoly(r, y.current, o, !1, s, l), n === W.POLYGON || n === W.PATH) {
2305
2305
  let e = m.current;
2306
2306
  e && r !== w.current && (w.current = r, e({
2307
2307
  type: F.POLYGON,
@@ -2314,89 +2314,89 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2314
2314
  i,
2315
2315
  c,
2316
2316
  e
2317
- ]), B = v((e) => {
2317
+ ]), B = x((e) => {
2318
2318
  let t = hn(e), n = k.current, r = A.current, i = n[r];
2319
2319
  i && gn(i, t) || (k.current = [...n.slice(0, r + 1), t], A.current += 1, L());
2320
- }, [L]), ce = v((e) => {
2320
+ }, [L]), ce = x((e) => {
2321
2321
  let t = S.current, n = C.current, r = t[n];
2322
2322
  r && vn(r, e) || (S.current = [...t.slice(0, n + 1), _n(e)], C.current += 1);
2323
- }, []), V = v(() => {
2324
- y.current = [], E.current = [], D.current = [], O.current = [], b.current = null, x.current = /* @__PURE__ */ new Set(), S.current = [[]], C.current = 0, w.current = null, R(), c.current?.clearPreview(), m.current?.(null), L();
2323
+ }, []), V = x(() => {
2324
+ v.current = [], T.current = [], E.current = [], D.current = [], y.current = null, b.current = /* @__PURE__ */ new Set(), S.current = [[]], C.current = 0, w.current = null, R(), c.current?.clearPreview(), m.current?.(null), L();
2325
2325
  }, [
2326
2326
  c,
2327
2327
  L,
2328
2328
  R
2329
- ]), le = v((e, t) => {
2330
- y.current = e, x.current = new Set(Array.from(x.current).filter((t) => t >= 0 && t < e.length)), t && ce(e), z(), L();
2329
+ ]), le = x((e, t) => {
2330
+ v.current = e, b.current = new Set(Array.from(b.current).filter((t) => t >= 0 && t < e.length)), t && ce(e), z(), L();
2331
2331
  }, [
2332
2332
  L,
2333
2333
  ce,
2334
2334
  z
2335
- ]), ue = v(() => _n(y.current), []), de = v(() => y.current.length > 0, []), fe = v((t, n) => {
2335
+ ]), ue = x(() => _n(v.current), []), de = x(() => v.current.length > 0, []), fe = x((t, n) => {
2336
2336
  if (e.current !== W.POLYGON) return !1;
2337
- let r = y.current;
2337
+ let r = v.current;
2338
2338
  if (r.length < 3) return !1;
2339
2339
  let i = r[0];
2340
2340
  return Math.hypot(t.x - i.x, t.y - i.y) > n ? !1 : (g.current(F.POLYGON, r), V(), !0);
2341
- }, [V, e]), pe = v((e) => {
2342
- let t = y.current;
2341
+ }, [V, e]), pe = x((e) => {
2342
+ let t = v.current;
2343
2343
  return e < 0 || e >= t.length ? !1 : (le(t.filter((t, n) => n !== e), !0), !0);
2344
- }, [le]), me = v((e, t) => {
2345
- let n = y.current;
2344
+ }, [le]), me = x((e, t) => {
2345
+ let n = v.current;
2346
2346
  if (e < 0 || e >= n.length) return null;
2347
- let r = new Set(x.current);
2348
- return t ? r.has(e) ? r.delete(e) : r.add(e) : r.has(e) || (r.clear(), r.add(e)), x.current = r, b.current = null, z(), L(), {
2347
+ let r = new Set(b.current);
2348
+ return t ? r.has(e) ? r.delete(e) : r.add(e) : r.has(e) || (r.clear(), r.add(e)), b.current = r, y.current = null, z(), L(), {
2349
2349
  base: _n(n),
2350
2350
  indices: Array.from(r)
2351
2351
  };
2352
- }, [L, z]), H = v((e) => {
2353
- x.current = /* @__PURE__ */ new Set(), b.current = e, le([...y.current, e], !0);
2354
- }, [le]), he = v((e) => {
2355
- b.current = null, x.current = /* @__PURE__ */ new Set(), y.current = [{ ...e }], z(), L();
2356
- }, [L, z]), ge = v((e, t) => {
2357
- let n = y.current[y.current.length - 1];
2358
- return n && Math.hypot(e.x - n.x, e.y - n.y) < t ? !1 : (y.current = [...y.current, { ...e }], b.current = null, z(), L(), !0);
2359
- }, [L, z]), _e = v((e, t, n, r) => {
2352
+ }, [L, z]), H = x((e) => {
2353
+ b.current = /* @__PURE__ */ new Set(), y.current = e, le([...v.current, e], !0);
2354
+ }, [le]), he = x((e) => {
2355
+ y.current = null, b.current = /* @__PURE__ */ new Set(), v.current = [{ ...e }], z(), L();
2356
+ }, [L, z]), ge = x((e, t) => {
2357
+ let n = v.current[v.current.length - 1];
2358
+ return n && Math.hypot(e.x - n.x, e.y - n.y) < t ? !1 : (v.current = [...v.current, { ...e }], y.current = null, z(), L(), !0);
2359
+ }, [L, z]), _e = x((e, t, n, r) => {
2360
2360
  let i = new Set(t);
2361
- y.current = e.map((e, t) => i.has(t) ? {
2361
+ v.current = e.map((e, t) => i.has(t) ? {
2362
2362
  x: e.x + n,
2363
2363
  y: e.y + r
2364
- } : { ...e }), b.current = null, z(), L();
2365
- }, [L, z]), ve = v((e) => {
2366
- e && (ce(y.current), z(), L());
2364
+ } : { ...e }), y.current = null, z(), L();
2365
+ }, [L, z]), ve = x((e) => {
2366
+ e && (ce(v.current), z(), L());
2367
2367
  }, [
2368
2368
  L,
2369
2369
  ce,
2370
2370
  z
2371
- ]), ye = v((e) => {
2372
- b.current = e ? { ...e } : null, z();
2373
- }, [z]), be = v(() => y.current.length > 0 ? (y.current = [], z(), L(), !0) : A.current <= 0 ? !1 : (--A.current, E.current = hn(k.current[A.current]), z(), L(), !0), [L, z]), xe = v(() => y.current.length > 0 || A.current >= k.current.length - 1 ? !1 : (A.current += 1, E.current = hn(k.current[A.current]), z(), L(), !0), [L, z]), Se = v(() => C.current <= 0 ? !1 : (--C.current, y.current = _n(S.current[C.current]), x.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), Ce = v(() => C.current >= S.current.length - 1 ? !1 : (C.current += 1, y.current = _n(S.current[C.current]), x.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), we = v(() => {
2371
+ ]), ye = x((e) => {
2372
+ y.current = e ? { ...e } : null, z();
2373
+ }, [z]), be = x(() => v.current.length > 0 ? (v.current = [], z(), L(), !0) : A.current <= 0 ? !1 : (--A.current, T.current = hn(k.current[A.current]), z(), L(), !0), [L, z]), xe = x(() => v.current.length > 0 || A.current >= k.current.length - 1 ? !1 : (A.current += 1, T.current = hn(k.current[A.current]), z(), L(), !0), [L, z]), Se = x(() => C.current <= 0 ? !1 : (--C.current, v.current = _n(S.current[C.current]), b.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), Ce = x(() => C.current >= S.current.length - 1 ? !1 : (C.current += 1, v.current = _n(S.current[C.current]), b.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), we = x(() => {
2374
2374
  let t = e.current;
2375
2375
  return t === W.BRUSH ? be() : t === W.POLYGON || t === W.PATH ? Se() : !1;
2376
2376
  }, [
2377
2377
  e,
2378
2378
  be,
2379
2379
  Se
2380
- ]), U = v(() => {
2380
+ ]), U = x(() => {
2381
2381
  let t = e.current;
2382
2382
  return t === W.BRUSH ? xe() : t === W.POLYGON || t === W.PATH ? Ce() : !1;
2383
2383
  }, [
2384
2384
  xe,
2385
2385
  Ce,
2386
2386
  e
2387
- ]), Te = v(() => {
2387
+ ]), Te = x(() => {
2388
2388
  let e = t.current;
2389
- if (!e.length) return O.current.length > 0;
2389
+ if (!e.length) return D.current.length > 0;
2390
2390
  let r = n.current.getShapes().filter((t) => e.includes(t.id) && oe(t)), i = dn(r);
2391
- return i.length ? (O.current = r.map((e) => e.id), D.current = i, !0) : (O.current = [], D.current = [], !1);
2392
- }, [n, t]), Ee = v(() => {
2391
+ return i.length ? (D.current = r.map((e) => e.id), E.current = i, !0) : (D.current = [], E.current = [], !1);
2392
+ }, [n, t]), Ee = x(() => {
2393
2393
  if (r.current) return !1;
2394
- let e = [...E.current];
2395
- y.current.length && e.push({
2396
- points: _n(y.current),
2394
+ let e = [...T.current];
2395
+ v.current.length && e.push({
2396
+ points: _n(v.current),
2397
2397
  mode: M()
2398
2398
  });
2399
- let t = D.current, c = [...O.current];
2399
+ let t = E.current, c = [...D.current];
2400
2400
  if (!e.length && !t.length) return !1;
2401
2401
  let l = fn(e, a.current, t);
2402
2402
  if (!l) return V(), !1;
@@ -2447,27 +2447,27 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2447
2447
  i,
2448
2448
  r,
2449
2449
  V
2450
- ]), De = v(() => {
2450
+ ]), De = x(() => {
2451
2451
  let t = e.current;
2452
2452
  if (t === W.BRUSH) return Ee();
2453
- let n = y.current;
2453
+ let n = v.current;
2454
2454
  return t === W.POLYGON && n.length >= 3 ? (g.current(F.POLYGON, n), V(), !0) : !1;
2455
2455
  }, [
2456
2456
  Ee,
2457
2457
  V,
2458
2458
  e
2459
- ]), Oe = v(() => {
2460
- let t = y.current;
2459
+ ]), Oe = x(() => {
2460
+ let t = v.current;
2461
2461
  if (e.current === W.PATH && t.length >= 3) {
2462
2462
  let e = Qt(t, o.current);
2463
2463
  e.length >= 3 && g.current(F.POLYGON, e);
2464
2464
  }
2465
2465
  V();
2466
- }, [V, e]), ke = v((e) => {
2466
+ }, [V, e]), ke = x((e) => {
2467
2467
  j.current = e, L(), z();
2468
- }, [L, z]), Ae = v(() => {
2468
+ }, [L, z]), Ae = x(() => {
2469
2469
  if (r.current || e.current !== W.BRUSH) return !1;
2470
- E.current = [], y.current = [], R();
2470
+ T.current = [], v.current = [], R();
2471
2471
  let t = Te();
2472
2472
  return L(), z(), t;
2473
2473
  }, [
@@ -2477,13 +2477,13 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2477
2477
  R,
2478
2478
  Te,
2479
2479
  e
2480
- ]), G = v(() => {
2481
- let e = x.current;
2480
+ ]), G = x(() => {
2481
+ let e = b.current;
2482
2482
  if (!e.size) return !1;
2483
- let t = y.current.filter((t, n) => !e.has(n));
2484
- return x.current = /* @__PURE__ */ new Set(), le(t, !0), !0;
2485
- }, [le]), je = v((e) => {
2486
- let t = c.current, n = y.current;
2483
+ let t = v.current.filter((t, n) => !e.has(n));
2484
+ return b.current = /* @__PURE__ */ new Set(), le(t, !0), !0;
2485
+ }, [le]), je = x((e) => {
2486
+ let t = c.current, n = v.current;
2487
2487
  if (!t || !n.length) return -1;
2488
2488
  let r = yn / (t.viewport.scale || 1);
2489
2489
  for (let t = n.length - 1; t >= 0; t--) {
@@ -2491,11 +2491,11 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2491
2491
  if (Math.hypot(e.x - i.x, e.y - i.y) <= r) return t;
2492
2492
  }
2493
2493
  return -1;
2494
- }, [c]), Me = v(() => {
2495
- y.current.length >= 1 && (E.current.push({
2496
- points: _n(y.current),
2494
+ }, [c]), Me = x(() => {
2495
+ v.current.length >= 1 && (T.current.push({
2496
+ points: _n(v.current),
2497
2497
  mode: M()
2498
- }), y.current = [], B(E.current)), z(), L();
2498
+ }), v.current = [], B(T.current)), z(), L();
2499
2499
  }, [
2500
2500
  L,
2501
2501
  B,
@@ -2515,7 +2515,7 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2515
2515
  getBrushScalarMode: () => j.current,
2516
2516
  hasBrushSession: N,
2517
2517
  commitBrush: Ee,
2518
- cancelBrush: v(() => {
2518
+ cancelBrush: x(() => {
2519
2519
  e.current === W.BRUSH && V();
2520
2520
  }, [V, e]),
2521
2521
  beginBrushEditFromSelection: Ae,
@@ -2532,7 +2532,7 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2532
2532
  commitDraftPointDrag: ve,
2533
2533
  setDraftCursor: ye,
2534
2534
  finishScalarStroke: Me,
2535
- handleToolChange: v((e, t) => {
2535
+ handleToolChange: x((e, t) => {
2536
2536
  if (t) {
2537
2537
  V(), j.current = "draw";
2538
2538
  return;
@@ -2541,7 +2541,7 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2541
2541
  V(), j.current = "draw";
2542
2542
  return;
2543
2543
  }
2544
- j.current = "draw", E.current = [], y.current = [], R(), Te(), L(), z();
2544
+ j.current = "draw", T.current = [], v.current = [], R(), Te(), L(), z();
2545
2545
  }, [
2546
2546
  L,
2547
2547
  z,
@@ -2549,13 +2549,13 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2549
2549
  R,
2550
2550
  Te
2551
2551
  ]),
2552
- handleBrushSelectionChange: v((t, n) => {
2552
+ handleBrushSelectionChange: x((t, n) => {
2553
2553
  if (!(e.current !== W.BRUSH || n)) {
2554
2554
  if (!t.length) {
2555
2555
  L();
2556
2556
  return;
2557
2557
  }
2558
- [...t].sort().join(",") !== [...O.current].sort().join(",") && (E.current.length || y.current.length || (E.current = [], y.current = [], R(), Te(), L(), z()));
2558
+ [...t].sort().join(",") !== [...D.current].sort().join(",") && (T.current.length || v.current.length || (T.current = [], v.current = [], R(), Te(), L(), z()));
2559
2559
  }
2560
2560
  }, [
2561
2561
  L,
@@ -2613,15 +2613,15 @@ function Cn(e, t) {
2613
2613
  }
2614
2614
  }
2615
2615
  function wn(e) {
2616
- let { onShapesCreated: t, onShapesUpdated: n, onShapesDeleted: r } = e, [i, a] = w(Cn, {
2616
+ let { onShapesCreated: t, onShapesUpdated: n, onShapesDeleted: r } = e, [i, a] = D(Cn, {
2617
2617
  shapes: [],
2618
2618
  past: [],
2619
2619
  future: []
2620
- }), o = T(i);
2620
+ }), o = O(i);
2621
2621
  o.current = i;
2622
- let s = v((e) => {
2622
+ let s = x((e) => {
2623
2623
  o.current = Cn(o.current, e), a(e);
2624
- }, []), c = v((e, i) => {
2624
+ }, []), c = x((e, i) => {
2625
2625
  let a = new Map(e.map((e) => [e.id, e])), o = new Map(i.map((e) => [e.id, e])), s = i.filter((e) => !a.has(e.id));
2626
2626
  s.length && t?.(s);
2627
2627
  let c = e.filter((e) => !o.has(e.id)).map((e) => e.id);
@@ -2632,46 +2632,46 @@ function wn(e) {
2632
2632
  t,
2633
2633
  n,
2634
2634
  r
2635
- ]), l = v((e) => {
2635
+ ]), l = x((e) => {
2636
2636
  let n = Array.isArray(e) ? e : [e];
2637
2637
  n.length && (s({
2638
2638
  type: "CREATE",
2639
2639
  shapes: n
2640
2640
  }), t?.(n));
2641
- }, [t]), u = v((e) => {
2641
+ }, [t]), u = x((e) => {
2642
2642
  s({
2643
2643
  type: "UPDATE",
2644
2644
  shapes: e
2645
2645
  }), n?.(e);
2646
- }, [n]), d = v((e) => {
2646
+ }, [n]), d = x((e) => {
2647
2647
  e.length !== 0 && (s({
2648
2648
  type: "DELETE",
2649
2649
  ids: e
2650
2650
  }), r?.(e));
2651
- }, [r]), f = v((e, n) => {
2651
+ }, [r]), f = x((e, n) => {
2652
2652
  !e.length && !n.length || (s({
2653
2653
  type: "REPLACE",
2654
2654
  removeIds: e,
2655
2655
  shapes: n
2656
2656
  }), e.length && r?.(e), n.length && t?.(n));
2657
- }, [t, r]), p = v((e, t) => {
2657
+ }, [t, r]), p = x((e, t) => {
2658
2658
  e.length !== 0 && s({
2659
2659
  type: "REORDER",
2660
2660
  ids: e,
2661
2661
  edge: t
2662
2662
  });
2663
- }, []), m = v((e) => {
2663
+ }, []), m = x((e) => {
2664
2664
  s({
2665
2665
  type: "RESET",
2666
2666
  shapes: e
2667
2667
  });
2668
- }, []), h = v(() => {
2668
+ }, []), h = x(() => {
2669
2669
  let e = o.current;
2670
2670
  e.past.length !== 0 && (c(e.shapes, e.past[e.past.length - 1]), s({ type: "UNDO" }));
2671
- }, [c]), g = v(() => {
2671
+ }, [c]), g = x(() => {
2672
2672
  let e = o.current;
2673
2673
  e.future.length !== 0 && (c(e.shapes, e.future[0]), s({ type: "REDO" }));
2674
- }, [c]), _ = v(() => o.current.past.length > 0, []), y = v(() => o.current.future.length > 0, []), b = v(() => o.current.shapes, []);
2674
+ }, [c]), _ = x(() => o.current.past.length > 0, []), v = x(() => o.current.future.length > 0, []), y = x(() => o.current.shapes, []);
2675
2675
  return {
2676
2676
  shapes: i.shapes,
2677
2677
  create: l,
@@ -2683,8 +2683,8 @@ function wn(e) {
2683
2683
  undo: h,
2684
2684
  redo: g,
2685
2685
  canUndo: _,
2686
- canRedo: y,
2687
- getShapes: b
2686
+ canRedo: v,
2687
+ getShapes: y
2688
2688
  };
2689
2689
  }
2690
2690
  //#endregion
@@ -2776,10 +2776,10 @@ function Nn(e, t) {
2776
2776
  return !!n && !n.contains(t);
2777
2777
  }
2778
2778
  function Pn(e) {
2779
- let { spaceRef: t, shiftRef: n } = e, r = C(() => An(e.keymap), [e.keymap]), i = T(e);
2779
+ let { spaceRef: t, shiftRef: n } = e, r = E(() => An(e.keymap), [e.keymap]), i = O(e);
2780
2780
  i.current = e;
2781
- let a = T(r);
2782
- a.current = r, y(() => {
2781
+ let a = O(r);
2782
+ a.current = r, S(() => {
2783
2783
  let e = (e) => {
2784
2784
  if (e.code === "Space" && (t.current = !0, i.current.onSpaceDown()), e.key === "Shift" && (n.current = !0), Mn() || Nn(e.target, i.current.hostRef.current)) return;
2785
2785
  let r = jn[e.key];
@@ -4694,28 +4694,28 @@ function ur({ currentDocId: e, documentId: t, loadedUrl: n, renderedImageUrl: r
4694
4694
  docChange: i
4695
4695
  };
4696
4696
  }
4697
- function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImageUrl: i, makeCallbacks: a, viewRef: o, readOnlyRef: s, toolRef: c, renderShapesRef: l, coordinateSizeRef: u, imageSizeRef: d, selRef: f, maskCanvasRef: p, regionOverlayRef: m, dimmedRef: h, syncMinimap: g, setImage: _, setImageVisible: v, setReady: b, setImageStatus: x, onContextMenuRequest: S }) {
4698
- let C = T(i);
4697
+ function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImageUrl: i, makeCallbacks: a, viewRef: o, readOnlyRef: s, toolRef: c, renderShapesRef: l, coordinateSizeRef: u, imageSizeRef: d, selRef: f, maskCanvasRef: p, regionOverlayRef: m, dimmedRef: h, syncMinimap: g, setImage: _, setImageVisible: v, setReady: y, setImageStatus: b, onContextMenuRequest: x }) {
4698
+ let C = O(i);
4699
4699
  C.current = i;
4700
- let w = T(r);
4700
+ let w = O(r);
4701
4701
  w.current = r;
4702
- let E = T(null), D = T(null), O = T(!1), k = T(null), A = T(a);
4702
+ let T = O(null), E = O(null), D = O(!1), k = O(null), A = O(a);
4703
4703
  A.current = a;
4704
- let j = T(S);
4705
- j.current = S, y(() => {
4704
+ let j = O(x);
4705
+ j.current = x, S(() => {
4706
4706
  let r = t.current;
4707
4707
  if (!r) return;
4708
- let i = !1, a = null, y = null, x = A.current(), S = e === "konva" ? new ar(r, x) : new lr(r, x);
4708
+ let i = !1, a = null, b = null, x = A.current(), S = e === "konva" ? new ar(r, x) : new lr(r, x);
4709
4709
  return n.current = S, (async () => {
4710
4710
  if (await S.init(), i) return;
4711
- if (S.setFilter(o.current.brightness, o.current.contrast), S.setRenderDefaults({ strokeWidth: o.current.strokeSize }), S.setImageSmoothing(o.current.imageSmoothing), S.setTransformEnabled(!s.current), O.current = !0, C.current) {
4711
+ if (S.setFilter(o.current.brightness, o.current.contrast), S.setRenderDefaults({ strokeWidth: o.current.strokeSize }), S.setImageSmoothing(o.current.imageSmoothing), S.setTransformEnabled(!s.current), D.current = !0, C.current) {
4712
4712
  if (await S.setImage(C.current, u.current, d.current), i) return;
4713
- E.current = C.current, D.current = w.current, _({
4713
+ T.current = C.current, E.current = w.current, _({
4714
4714
  w: S.imageWidth,
4715
4715
  h: S.imageHeight
4716
4716
  }), v(!0), S.setShapes(l.current, f.current), S.setOverlays(o.current.showGuide ? p.current : null, o.current.showRegionMask ? m.current : null, h.current);
4717
4717
  let e = k.current;
4718
- e?.viewport && (e.imageUrl === E.current || o.current.keepZoomOnImageChange) ? S.applyViewport(e.viewport) : S.fit(), g(), b(!0);
4718
+ e?.viewport && (e.imageUrl === T.current || o.current.keepZoomOnImageChange) ? S.applyViewport(e.viewport) : S.fit(), g(), y(!0);
4719
4719
  }
4720
4720
  let e = (e, t) => Math.exp(-Math.sign(e) * Math.min(Math.abs(e) * .01, .1) * t);
4721
4721
  a = (t) => {
@@ -4735,7 +4735,7 @@ function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImage
4735
4735
  return;
4736
4736
  }
4737
4737
  S.zoomAt(t.clientX - n.left, t.clientY - n.top, e(t.deltaY, r));
4738
- }, S.dom.addEventListener("wheel", a, { passive: !1 }), y = (e) => {
4738
+ }, S.dom.addEventListener("wheel", a, { passive: !1 }), b = (e) => {
4739
4739
  if (e.preventDefault(), c.current === W.ASSISTANT_POINT && e.altKey) return;
4740
4740
  let t = r.getBoundingClientRect(), n = e.clientX - t.left, i = e.clientY - t.top, a = S.viewport;
4741
4741
  j.current({
@@ -4746,53 +4746,53 @@ function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImage
4746
4746
  y: (i - a.y) / a.scale
4747
4747
  }
4748
4748
  });
4749
- }, S.dom.addEventListener("contextmenu", y);
4749
+ }, S.dom.addEventListener("contextmenu", b);
4750
4750
  })(), () => {
4751
- i = !0, O.current = !1, k.current = {
4752
- imageUrl: E.current ?? "",
4751
+ i = !0, D.current = !1, k.current = {
4752
+ imageUrl: T.current ?? "",
4753
4753
  viewport: S.viewport
4754
- }, n.current = null, a && S.dom && S.dom.removeEventListener("wheel", a), y && S.dom && S.dom.removeEventListener("contextmenu", y), S.destroy();
4754
+ }, n.current = null, a && S.dom && S.dom.removeEventListener("wheel", a), b && S.dom && S.dom.removeEventListener("contextmenu", b), S.destroy();
4755
4755
  };
4756
- }, [e]), y(() => {
4756
+ }, [e]), S(() => {
4757
4757
  let e = n.current;
4758
- if (!e || !O.current) return;
4758
+ if (!e || !D.current) return;
4759
4759
  let t = ur({
4760
- currentDocId: D.current,
4760
+ currentDocId: E.current,
4761
4761
  documentId: r,
4762
- loadedUrl: E.current,
4762
+ loadedUrl: T.current,
4763
4763
  renderedImageUrl: i
4764
4764
  });
4765
4765
  if (t.kind === "none") return;
4766
4766
  let a = () => {
4767
- b(!1), v(!1), e.clearImage(), e.setShapes([], []), e.setOverlays(null, null, !1);
4767
+ y(!1), v(!1), e.clearImage(), e.setShapes([], []), e.setOverlays(null, null, !1);
4768
4768
  };
4769
4769
  if (t.kind === "clear") {
4770
- E.current = null, D.current = null, a();
4770
+ T.current = null, E.current = null, a();
4771
4771
  return;
4772
4772
  }
4773
4773
  let s = i;
4774
- t.docChange && (D.current = null, a());
4774
+ t.docChange && (E.current = null, a());
4775
4775
  let c = !1;
4776
4776
  return (async () => {
4777
- await e.setImage(s, u.current, d.current), !(c || n.current !== e) && (E.current = s, t.docChange && (D.current = r, _({
4777
+ await e.setImage(s, u.current, d.current), !(c || n.current !== e) && (T.current = s, t.docChange && (E.current = r, _({
4778
4778
  w: e.imageWidth,
4779
4779
  h: e.imageHeight
4780
- }), v(!0), e.setShapes(l.current, f.current), e.setOverlays(o.current.showGuide ? p.current : null, o.current.showRegionMask ? m.current : null, h.current), o.current.keepZoomOnImageChange || e.fit(), g(), b(!0)));
4780
+ }), v(!0), e.setShapes(l.current, f.current), e.setOverlays(o.current.showGuide ? p.current : null, o.current.showRegionMask ? m.current : null, h.current), o.current.keepZoomOnImageChange || e.fit(), g(), y(!0)));
4781
4781
  })(), () => {
4782
4782
  c = !0;
4783
4783
  };
4784
- }, [r, i]), y(() => {
4784
+ }, [r, i]), S(() => {
4785
4785
  let e = !1;
4786
4786
  if (!i) {
4787
- x("loading");
4787
+ b("loading");
4788
4788
  return;
4789
4789
  }
4790
- x("loading");
4790
+ b("loading");
4791
4791
  let t = new Image();
4792
4792
  return t.onload = () => {
4793
- e || x("ready");
4793
+ e || b("ready");
4794
4794
  }, t.onerror = () => {
4795
- e || x("error");
4795
+ e || b("error");
4796
4796
  }, t.src = i, () => {
4797
4797
  e = !0;
4798
4798
  };
@@ -4813,7 +4813,7 @@ function hr(e) {
4813
4813
  };
4814
4814
  }
4815
4815
  function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4816
- let i = T(null), a = !!t && t.w > 0 && t.h > 0, o = a ? Math.min(r / t.w, r / t.h) : 1, s = a ? t.w * o : 0, c = a ? t.h * o : 0, l = a ? (r - s) / 2 : 0, u = a ? (r - c) / 2 : 0, d = v(() => {
4816
+ let i = O(null), a = !!t && t.w > 0 && t.h > 0, o = a ? Math.min(r / t.w, r / t.h) : 1, s = a ? t.w * o : 0, c = a ? t.h * o : 0, l = a ? (r - s) / 2 : 0, u = a ? (r - c) / 2 : 0, d = x(() => {
4817
4817
  let t = e.current;
4818
4818
  if (!t) return null;
4819
4819
  let n = t.viewport;
@@ -4828,7 +4828,7 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4828
4828
  o,
4829
4829
  l,
4830
4830
  u
4831
- ]), f = v((n, r, i) => {
4831
+ ]), f = x((n, r, i) => {
4832
4832
  let a = e.current;
4833
4833
  if (!a || !t) return;
4834
4834
  let s = d();
@@ -4846,7 +4846,7 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4846
4846
  o,
4847
4847
  l,
4848
4848
  u
4849
- ]), p = v((t) => {
4849
+ ]), p = x((t) => {
4850
4850
  let n = e.current, r = d();
4851
4851
  if (!n || !r) return;
4852
4852
  t.preventDefault(), t.stopPropagation();
@@ -4865,13 +4865,13 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4865
4865
  f,
4866
4866
  e,
4867
4867
  d
4868
- ]), m = v((t) => {
4868
+ ]), m = x((t) => {
4869
4869
  let n = i.current, r = e.current;
4870
4870
  !n || !r || n.pointerId !== t.pointerId || (t.preventDefault(), t.stopPropagation(), f(hr(t), r.viewport.scale, n));
4871
- }, [f, e]), h = v((e) => {
4871
+ }, [f, e]), h = x((e) => {
4872
4872
  let t = i.current;
4873
4873
  !t || t.pointerId !== e.pointerId || (i.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId));
4874
- }, []), g = v((t) => {
4874
+ }, []), g = x((t) => {
4875
4875
  let r = e.current;
4876
4876
  if (!r || !n) return;
4877
4877
  t.preventDefault(), t.stopPropagation();
@@ -4881,13 +4881,13 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4881
4881
  f,
4882
4882
  e,
4883
4883
  n
4884
- ]), _ = v((t) => {
4884
+ ]), _ = x((t) => {
4885
4885
  let n = e.current;
4886
4886
  if (!n) return;
4887
4887
  let { w: r, h: i } = n.screenSize;
4888
4888
  n.zoomAt(r / 2, i / 2, t);
4889
4889
  }, [e]);
4890
- return C(() => ({
4890
+ return E(() => ({
4891
4891
  mm: o,
4892
4892
  offX: l,
4893
4893
  offY: u,
@@ -4932,12 +4932,12 @@ function _r(e, t, n) {
4932
4932
  }
4933
4933
  }
4934
4934
  function vr({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRectRef: i, minimapSize: a, onViewportChangeRef: o }) {
4935
- let s = T(/* @__PURE__ */ new Map());
4935
+ let s = O(/* @__PURE__ */ new Map());
4936
4936
  return {
4937
- registerMinimapShape: v((e, t) => {
4937
+ registerMinimapShape: x((e, t) => {
4938
4938
  t ? s.current.set(e, t) : s.current.delete(e);
4939
4939
  }, []),
4940
- applyMinimapPreview: v((e) => {
4940
+ applyMinimapPreview: x((e) => {
4941
4941
  let n = t.current.getShapes();
4942
4942
  if (!e.length) {
4943
4943
  for (let e of n) _r(s.current.get(e.id), e, e.points);
@@ -4949,7 +4949,7 @@ function vr({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRe
4949
4949
  e && _r(s.current.get(e.id), e, t.points);
4950
4950
  }
4951
4951
  }, [t]),
4952
- syncMinimap: v(() => {
4952
+ syncMinimap: x(() => {
4953
4953
  let t = e.current;
4954
4954
  if (!t?.imageWidth) return;
4955
4955
  let s = t.viewport;
@@ -4977,13 +4977,13 @@ function vr({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRe
4977
4977
  //#region src/components/ShapeEditor/_state/useSelectionActions.ts
4978
4978
  var yr = 12;
4979
4979
  function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMergeSelection: i, clipboardDocumentId: a, clipboardScope: o }) {
4980
- let s = T(0), c = T(!0), l = T(n), u = T(a), d = T(o);
4981
- l.current = n, u.current = a, d.current = o, y(() => (c.current = !0, () => {
4980
+ let s = O(0), c = O(!0), l = O(n), u = O(a), d = O(o);
4981
+ l.current = n, u.current = a, d.current = o, S(() => (c.current = !0, () => {
4982
4982
  c.current = !1;
4983
- }), []), y(() => {
4983
+ }), []), S(() => {
4984
4984
  s.current = 0;
4985
4985
  }, [a]);
4986
- let f = v(() => r(e.getShapes().filter((e) => I(e)).map((e) => e.id)), [e, r]), p = v(() => r([]), [r]), m = v(() => e.getShapes().filter((e) => t.current.includes(e.id) && oe(e)), [e, t]), h = v(() => {
4986
+ let f = x(() => r(e.getShapes().filter((e) => I(e)).map((e) => e.id)), [e, r]), p = x(() => r([]), [r]), m = x(() => e.getShapes().filter((e) => t.current.includes(e.id) && oe(e)), [e, t]), h = x(() => {
4987
4987
  if (n || !t.current.length) return;
4988
4988
  let i = m().map((e) => e.id);
4989
4989
  i.length && (e.remove(i), r([]));
@@ -4993,14 +4993,14 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4993
4993
  r,
4994
4994
  m,
4995
4995
  t
4996
- ]), g = v(() => {
4996
+ ]), g = x(() => {
4997
4997
  let e = m();
4998
4998
  e.length && (s.current = 0, gt(pt(e, a, o)));
4999
4999
  }, [
5000
5000
  a,
5001
5001
  o,
5002
5002
  m
5003
- ]), _ = v(() => X(o), [o]), b = v((t) => {
5003
+ ]), _ = x(() => X(o), [o]), v = x((t) => {
5004
5004
  if (n) return;
5005
5005
  let i = a;
5006
5006
  vt(o).then((n) => {
@@ -5029,7 +5029,7 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5029
5029
  e,
5030
5030
  n,
5031
5031
  r
5032
- ]), x = v(() => {
5032
+ ]), y = x(() => {
5033
5033
  if (n || !t.current.length) return;
5034
5034
  let i = m().map((e) => ({
5035
5035
  ...e,
@@ -5046,7 +5046,7 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5046
5046
  r,
5047
5047
  m,
5048
5048
  t
5049
- ]), S = v(() => {
5049
+ ]), b = x(() => {
5050
5050
  if (n) return;
5051
5051
  let t = m().map((e) => e.id);
5052
5052
  t.length && e.reorder(t, "front");
@@ -5054,7 +5054,7 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5054
5054
  e,
5055
5055
  n,
5056
5056
  m
5057
- ]), C = v(() => {
5057
+ ]), C = x(() => {
5058
5058
  if (n) return;
5059
5059
  let t = m().map((e) => e.id);
5060
5060
  t.length && e.reorder(t, "back");
@@ -5062,7 +5062,7 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5062
5062
  e,
5063
5063
  n,
5064
5064
  m
5065
- ]), w = v((r, i) => {
5065
+ ]), w = x((r, i) => {
5066
5066
  if (n || !t.current.length) return;
5067
5067
  let a = e.getShapes().filter((e) => t.current.includes(e.id) && oe(e));
5068
5068
  a.length && e.update(a.map((e) => ({
@@ -5076,7 +5076,7 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5076
5076
  e,
5077
5077
  n,
5078
5078
  t
5079
- ]), E = v(() => m().filter((e) => e.type === F.POLYGON || e.type === F.RECTANGLE || e.type === F.ROTATED_RECTANGLE || e.type === F.ELLIPSE), [m]);
5079
+ ]), T = x(() => m().filter((e) => e.type === F.POLYGON || e.type === F.RECTANGLE || e.type === F.ROTATED_RECTANGLE || e.type === F.ELLIPSE), [m]);
5080
5080
  return {
5081
5081
  selectAll: f,
5082
5082
  clearSelection: p,
@@ -5084,15 +5084,15 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5084
5084
  deleteSelection: h,
5085
5085
  copySelection: g,
5086
5086
  canPaste: _,
5087
- paste: b,
5088
- duplicate: x,
5089
- bringToFront: S,
5087
+ paste: v,
5088
+ duplicate: y,
5089
+ bringToFront: b,
5090
5090
  sendToBack: C,
5091
5091
  nudgeSelection: w,
5092
- getMergeTargets: E,
5093
- mergeSelection: v(() => {
5092
+ getMergeTargets: T,
5093
+ mergeSelection: x(() => {
5094
5094
  if (n) return;
5095
- let t = E();
5095
+ let t = T();
5096
5096
  if (t.length < 2 || i && !i(t)) return;
5097
5097
  let a = fn([], 1, dn(t));
5098
5098
  if (!a) return;
@@ -5109,7 +5109,7 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5109
5109
  }, [
5110
5110
  e,
5111
5111
  n,
5112
- E,
5112
+ T,
5113
5113
  i,
5114
5114
  r
5115
5115
  ])
@@ -5118,16 +5118,16 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5118
5118
  //#endregion
5119
5119
  //#region src/components/ShapeEditor/_state/useViewportControls.ts
5120
5120
  function xr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBound: i, ready: a }) {
5121
- let o = T(null), s = T(null), c = v(() => {
5121
+ let o = O(null), s = O(null), c = x(() => {
5122
5122
  o.current?.(), o.current = null;
5123
- }, []), l = v((t, n = r) => {
5123
+ }, []), l = x((t, n = r) => {
5124
5124
  let i = e.current;
5125
5125
  i && (c(), o.current = Jt(i.viewport, t, (e) => i.applyViewport(e), n));
5126
5126
  }, [
5127
5127
  c,
5128
5128
  r,
5129
5129
  e
5130
- ]), u = v((t, n = r) => {
5130
+ ]), u = x((t, n = r) => {
5131
5131
  let i = e.current;
5132
5132
  if (!i) return;
5133
5133
  let a = Kt(t, i.screenSize.w, i.screenSize.h);
@@ -5136,14 +5136,14 @@ function xr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
5136
5136
  l,
5137
5137
  r,
5138
5138
  e
5139
- ]), d = v((e, n = r) => {
5139
+ ]), d = x((e, n = r) => {
5140
5140
  let i = Gt(t.getShapes().filter((t) => e.includes(t.id)));
5141
5141
  i && u(i, n);
5142
5142
  }, [
5143
5143
  t,
5144
5144
  u,
5145
5145
  r
5146
- ]), f = v(() => {
5146
+ ]), f = x(() => {
5147
5147
  let r = t.getShapes().filter((e) => n.current.includes(e.id));
5148
5148
  if (!r.length) return;
5149
5149
  let i = e.current;
@@ -5155,13 +5155,13 @@ function xr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
5155
5155
  l,
5156
5156
  e,
5157
5157
  n
5158
- ]), p = v((t) => {
5158
+ ]), p = x((t) => {
5159
5159
  let n = e.current;
5160
5160
  if (!n) return;
5161
5161
  let { w: r, h: i } = n.screenSize;
5162
5162
  n.zoomAt(r / 2, i / 2, t);
5163
5163
  }, [e]);
5164
- return y(() => () => c(), [c]), y(() => {
5164
+ return S(() => () => c(), [c]), S(() => {
5165
5165
  if (!i) {
5166
5166
  s.current = null;
5167
5167
  return;
@@ -5198,35 +5198,35 @@ var Sr = "__draft_preview__", Cr = new Set([
5198
5198
  function wr(e, t) {
5199
5199
  return e.length === t.length && e.every((e, n) => e === t[n]);
5200
5200
  }
5201
- function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !1, selectedIds: i, activeTool: a, draftStyle: s, draftMeta: c, readOnly: l, disableMarquee: u, locked: d, onLockedInteraction: f, onIdleEscape: p, overrideShapeInteraction: m, defaultViewSettings: h, viewSettings: g, onViewSettingsChange: _, showMinimap: w = !0, showViewSettings: D = !0, getContextMenuItems: A, strings: j, canMergeSelection: M, brushSize: N = 20, zoomBound: P, zoomAnimationDuration: ee = 300, decorationShapes: te, regionMask: ne, guideMask: re, maskPalette: ae, overlayMarkers: L, renderOverlayMarker: R, onOverlayMarkerClick: z, renderImageOverlay: B, getSelectionLabel: ce, hideSelectionLabelDot: V, formatSelectionInfo: le, externalTools: ue, assistant: de, keymap: fe, handleRef: pe, backend: me = "pixi", onActiveToolChange: H, onSelectionChange: he, onEditingChange: ge, onShapesCreated: _e, onShapesUpdated: ve, onShapesDeleted: ye, onDrawSessionChange: be, onDraftShapeChange: xe, onViewportChange: Se, onShapesTransformPreview: Ce }) {
5202
- let we = T(null), U = T(null), Te = T(null), Ee = T(null), De = T(null), Oe = `${b()}-minimap`, [G, je] = E(null), [Me, Ne] = E(!1), [K, Re] = E(!1), [ze, Be] = E(null), [Ve, He] = E({
5201
+ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !1, selectedIds: i, activeTool: a, draftStyle: s, draftMeta: c, readOnly: l, disableMarquee: u, locked: d, onLockedInteraction: f, onIdleEscape: p, overrideShapeInteraction: m, defaultViewSettings: h, viewSettings: g, onViewSettingsChange: _, showMinimap: b = !0, showViewSettings: D = !0, getContextMenuItems: A, strings: j, canMergeSelection: M, brushSize: N = 20, zoomBound: P, zoomAnimationDuration: ee = 300, decorationShapes: te, regionMask: ne, guideMask: re, maskPalette: ae, overlayMarkers: L, renderOverlayMarker: R, onOverlayMarkerClick: z, renderImageOverlay: B, getSelectionLabel: ce, hideSelectionLabelDot: V, formatSelectionInfo: le, externalTools: ue, assistant: de, keymap: fe, handleRef: pe, backend: me = "pixi", onActiveToolChange: H, onSelectionChange: he, onEditingChange: ge, onShapesCreated: _e, onShapesUpdated: ve, onShapesDeleted: ye, onDrawSessionChange: be, onDraftShapeChange: xe, onViewportChange: Se, onShapesTransformPreview: Ce }) {
5202
+ let we = O(null), U = O(null), Te = O(null), Ee = O(null), De = O(null), Oe = `${C()}-minimap`, [G, je] = k(null), [Me, Ne] = k(!1), [K, Re] = k(!1), [ze, Be] = k(null), [Ve, He] = k({
5203
5203
  active: !1,
5204
5204
  kind: "none",
5205
5205
  canUndo: !1,
5206
5206
  canRedo: !1
5207
- }), [Ue, We] = E(!0), [Ge, Ke] = E(!1), qe = e?.id ?? "", Je = e?.imageUrl ?? "", Ye = e?.displayImageUrl, Ze = e?.coordinateSize, Qe = e?.initialShapes, $e = e?.initialSelectedIds, et = Ye ?? Je, [tt, at] = E("loading"), q = wn({
5207
+ }), [Ue, We] = k(!0), [Ge, Ke] = k(!1), qe = e?.id ?? "", Je = e?.imageUrl ?? "", Ye = e?.displayImageUrl, Ze = e?.coordinateSize, Qe = e?.initialShapes, $e = e?.initialSelectedIds, et = Ye ?? Je, [tt, at] = k("loading"), q = wn({
5208
5208
  onShapesCreated: _e,
5209
5209
  onShapesUpdated: ve,
5210
5210
  onShapesDeleted: ye
5211
- }), [st, ct] = E([]), J = i ?? st, lt = i !== void 0, ut = C(() => new Map((ue ?? []).map((e) => [e.id, e])), [ue]), dt = T(ut);
5212
- S(() => {
5211
+ }), [st, ct] = k([]), J = i ?? st, lt = i !== void 0, ut = E(() => new Map((ue ?? []).map((e) => [e.id, e])), [ue]), dt = O(ut);
5212
+ T(() => {
5213
5213
  dt.current = ut;
5214
5214
  }, [ut]);
5215
- let ft = T(Ve);
5215
+ let ft = O(Ve);
5216
5216
  ft.current = Ve;
5217
- let pt = C(() => {
5217
+ let pt = E(() => {
5218
5218
  let e = Object.fromEntries(Object.entries(h ?? {}).filter(([, e]) => e !== void 0));
5219
5219
  return {
5220
5220
  ...Ae,
5221
5221
  ...e
5222
5222
  };
5223
- }, [h]), ht = T(pt);
5223
+ }, [h]), ht = O(pt);
5224
5224
  ht.current = pt;
5225
- let [Y, gt] = E(() => ht.current), _t = v((e) => gt((t) => ({
5225
+ let [Y, gt] = k(() => ht.current), _t = x((e) => gt((t) => ({
5226
5226
  ...t,
5227
5227
  ...e
5228
- })), []), X = C(() => ke(j), [j]);
5229
- y(() => {
5228
+ })), []), X = E(() => ke(j), [j]);
5229
+ S(() => {
5230
5230
  g && gt((e) => {
5231
5231
  let t = Object.entries(g).filter(([t, n]) => n !== void 0 && e[t] !== n);
5232
5232
  return t.length ? {
@@ -5235,55 +5235,55 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5235
5235
  } : e;
5236
5236
  });
5237
5237
  }, [g]);
5238
- let vt = T(_);
5238
+ let vt = O(_);
5239
5239
  vt.current = _;
5240
- let yt = T(!1);
5241
- y(() => {
5240
+ let yt = O(!1);
5241
+ S(() => {
5242
5242
  if (!yt.current) {
5243
5243
  yt.current = !0;
5244
5244
  return;
5245
5245
  }
5246
5246
  vt.current?.(Y);
5247
5247
  }, [Y]);
5248
- let bt = C(() => !re || !ae ? null : Ot(re, ae), [re, ae]), xt = C(() => bt?.toDataURL() ?? null, [bt]), St = C(() => !G || !ne ? null : zt(ne, G.w, G.h), [G, ne]), Ct = T(bt);
5248
+ let bt = E(() => !re || !ae ? null : Ot(re, ae), [re, ae]), xt = E(() => bt?.toDataURL() ?? null, [bt]), St = E(() => !G || !ne ? null : zt(ne, G.w, G.h), [G, ne]), Ct = O(bt);
5249
5249
  Ct.current = bt;
5250
- let wt = T(St);
5250
+ let wt = O(St);
5251
5251
  wt.current = St;
5252
- let Et = T(r);
5252
+ let Et = O(r);
5253
5253
  Et.current = r;
5254
- let Dt = T(G);
5254
+ let Dt = O(G);
5255
5255
  Dt.current = G;
5256
- let kt = T(Ze);
5256
+ let kt = O(Ze);
5257
5257
  kt.current = Ze;
5258
- let At = T(Ze?.imageSize);
5258
+ let At = O(Ze?.imageSize);
5259
5259
  At.current = Ze?.imageSize;
5260
- let jt = T(J);
5261
- S(() => {
5260
+ let jt = O(J);
5261
+ T(() => {
5262
5262
  jt.current = J;
5263
5263
  }, [J]);
5264
- let Mt = T(a);
5264
+ let Mt = O(a);
5265
5265
  Mt.current = a;
5266
- let Nt = T(s);
5266
+ let Nt = O(s);
5267
5267
  Nt.current = s;
5268
- let Pt = T(c);
5268
+ let Pt = O(c);
5269
5269
  Pt.current = c;
5270
- let Ft = T(N);
5270
+ let Ft = O(N);
5271
5271
  Ft.current = N;
5272
- let It = T(Y.simplifyStrength);
5272
+ let It = O(Y.simplifyStrength);
5273
5273
  It.current = Y.simplifyStrength;
5274
- let Z = !!l || !!d, Lt = T(Z);
5274
+ let Z = !!l || !!d, Lt = O(Z);
5275
5275
  Lt.current = Z;
5276
- let Rt = T(u);
5276
+ let Rt = O(u);
5277
5277
  Rt.current = u;
5278
- let Bt = T(d);
5278
+ let Bt = O(d);
5279
5279
  Bt.current = d;
5280
- let Vt = T(f);
5280
+ let Vt = O(f);
5281
5281
  Vt.current = f;
5282
- let Ht = T(m);
5282
+ let Ht = O(m);
5283
5283
  Ht.current = m;
5284
- let Ut = T(q);
5284
+ let Ut = O(q);
5285
5285
  Ut.current = q;
5286
- let Wt = T(!1), Gt = T(!1), Kt = T("idle"), qt = T(null), Jt = v(() => {
5286
+ let Wt = O(!1), Gt = O(!1), Kt = O("idle"), qt = O(null), Jt = x(() => {
5287
5287
  let e = U.current;
5288
5288
  if (!e) return;
5289
5289
  let t = Mt.current, n = dt.current.get(t), r = ft.current;
@@ -5295,11 +5295,11 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5295
5295
  rendererCursorHint: qt.current,
5296
5296
  isPolygonDrawing: r.kind === "polygon" && r.active
5297
5297
  }));
5298
- }, []), Zt = v((e) => {
5298
+ }, []), Zt = x((e) => {
5299
5299
  Kt.current !== e && (Kt.current = e, Jt());
5300
- }, [Jt]), Qt = v((e) => {
5300
+ }, [Jt]), Qt = x((e) => {
5301
5301
  qt.current !== e && (qt.current = e, Jt());
5302
- }, [Jt]), $t = v((e) => {
5302
+ }, [Jt]), $t = x((e) => {
5303
5303
  let t = /* @__PURE__ */ new Set(), n = new Map(Ut.current.getShapes().map((e) => [e.id, e]));
5304
5304
  return e.filter((e) => {
5305
5305
  if (t.has(e)) return !1;
@@ -5315,19 +5315,19 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5315
5315
  }
5316
5316
  } : r);
5317
5317
  });
5318
- }, []), en = v((e) => {
5318
+ }, []), en = x((e) => {
5319
5319
  let t = $t(e);
5320
5320
  wr(jt.current, t) || (lt || ct(t), U.current?.setSelection(t), he?.(t));
5321
5321
  }, [
5322
5322
  $t,
5323
5323
  he,
5324
5324
  lt
5325
- ]), tn = T(en);
5325
+ ]), tn = O(en);
5326
5326
  tn.current = en;
5327
- let [nn, rn] = E(null), an = v((e) => rn(e), []), on = T(an);
5327
+ let [nn, rn] = k(null), an = x((e) => rn(e), []), on = O(an);
5328
5328
  on.current = an;
5329
- let sn = T(null);
5330
- sn.current = nn, y(() => {
5329
+ let sn = O(null);
5330
+ sn.current = nn, S(() => {
5331
5331
  if (!lt) return;
5332
5332
  let e = $t(i);
5333
5333
  wr(i, e) || he?.(e);
@@ -5338,7 +5338,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5338
5338
  he,
5339
5339
  lt
5340
5340
  ]);
5341
- let cn = T(Se);
5341
+ let cn = O(Se);
5342
5342
  cn.current = Se;
5343
5343
  let { registerMinimapShape: ln, applyMinimapPreview: un, syncMinimap: dn } = vr({
5344
5344
  engineRef: U,
@@ -5348,11 +5348,11 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5348
5348
  minimapRectRef: Te,
5349
5349
  minimapSize: 204,
5350
5350
  onViewportChangeRef: cn
5351
- }), fn = T(/* @__PURE__ */ new Map()), pn = T(le);
5351
+ }), fn = O(/* @__PURE__ */ new Map()), pn = O(le);
5352
5352
  pn.current = le;
5353
- let mn = v((e, t) => {
5353
+ let mn = x((e, t) => {
5354
5354
  t ? fn.current.set(e, t) : fn.current.delete(e);
5355
- }, []), hn = T(null), [gn, _n] = E(null), vn = v((e) => {
5355
+ }, []), hn = O(null), [gn, _n] = k(null), vn = x((e) => {
5356
5356
  if (!e.length) return;
5357
5357
  let t = new Map(Ut.current.getShapes().map((e) => [e.id, e]));
5358
5358
  hn.current && t.set(hn.current.id, hn.current);
@@ -5365,13 +5365,13 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5365
5365
  a.textContent = pn.current?.(e) ?? it(e);
5366
5366
  }
5367
5367
  }
5368
- }, []), yn = v((e) => {
5368
+ }, []), yn = x((e) => {
5369
5369
  un(e), vn(e), Ce?.(e);
5370
5370
  }, [
5371
5371
  un,
5372
5372
  vn,
5373
5373
  Ce
5374
- ]), bn = v((e) => {
5374
+ ]), bn = x((e) => {
5375
5375
  if (xe?.(e ? {
5376
5376
  ...e,
5377
5377
  meta: Pt.current
@@ -5390,7 +5390,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5390
5390
  id: Sr,
5391
5391
  points: e.points
5392
5392
  }]) : _n(t);
5393
- }, [vn, xe]), Sn = v((e, t) => {
5393
+ }, [vn, xe]), Sn = x((e, t) => {
5394
5394
  let n = Nt.current;
5395
5395
  if (!n || Lt.current) return;
5396
5396
  let r = se();
@@ -5401,7 +5401,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5401
5401
  style: n,
5402
5402
  meta: c
5403
5403
  }), tn.current([r]);
5404
- }, [c]), Cn = T(Sn);
5404
+ }, [c]), Cn = O(Sn);
5405
5405
  Cn.current = Sn;
5406
5406
  let Tn = xn({
5407
5407
  toolRef: Mt,
@@ -5413,15 +5413,15 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5413
5413
  simplifyEpsilonRef: It,
5414
5414
  draftMeta: c,
5415
5415
  engineRef: U,
5416
- onDrawSessionChange: v((e) => {
5416
+ onDrawSessionChange: x((e) => {
5417
5417
  He(e), be?.(e);
5418
5418
  }, [be]),
5419
5419
  onDraftShapeChange: xe,
5420
5420
  changeSelection: en,
5421
5421
  createShape: Sn
5422
- }), En = T(Tn);
5422
+ }), En = O(Tn);
5423
5423
  En.current = Tn;
5424
- let { reset: Dn, undoSession: On, redoSession: kn, canUndoSession: An, canRedoSession: jn, hasDraftSession: Mn, hasDraftPoints: Nn, commitDraftSession: Fn, setBrushScalarMode: In, getBrushScalarMode: Ln, hasBrushSession: Rn, commitBrush: zn, cancelBrush: Bn, beginBrushEditFromSelection: Vn, deleteDraftSelectedPoints: Hn, handleToolChange: Un, handleBrushSelectionChange: Wn } = Tn, Gn = T(de);
5424
+ let { reset: Dn, undoSession: On, redoSession: kn, canUndoSession: An, canRedoSession: jn, hasDraftSession: Mn, hasDraftPoints: Nn, commitDraftSession: Fn, setBrushScalarMode: In, getBrushScalarMode: Ln, hasBrushSession: Rn, commitBrush: zn, cancelBrush: Bn, beginBrushEditFromSelection: Vn, deleteDraftSelectedPoints: Hn, handleToolChange: Un, handleBrushSelectionChange: Wn } = Tn, Gn = O(de);
5425
5425
  Gn.current = de;
5426
5426
  let Q = Xt({
5427
5427
  docRef: Ut,
@@ -5429,9 +5429,9 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5429
5429
  draftMeta: c,
5430
5430
  changeSelection: en,
5431
5431
  assistantRef: Gn
5432
- }), Kn = T(Q);
5432
+ }), Kn = O(Q);
5433
5433
  Kn.current = Q;
5434
- let qn = C(() => mt(qe), [qe]), { selectAll: Jn, clearSelection: Yn, deleteSelection: Xn, copySelection: Zn, canPaste: Qn, paste: $n, duplicate: er, bringToFront: tr, sendToBack: nr, nudgeSelection: rr, getMergeTargets: ir, mergeSelection: ar } = br({
5434
+ let qn = E(() => mt(qe), [qe]), { selectAll: Jn, clearSelection: Yn, deleteSelection: Xn, copySelection: Zn, canPaste: Qn, paste: $n, duplicate: er, bringToFront: tr, sendToBack: nr, nudgeSelection: rr, getMergeTargets: ir, mergeSelection: ar } = br({
5435
5435
  doc: q,
5436
5436
  selRef: jt,
5437
5437
  effectiveReadOnly: Z,
@@ -5447,7 +5447,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5447
5447
  zoomBound: P,
5448
5448
  ready: K
5449
5449
  });
5450
- x(pe, () => ({
5450
+ w(pe, () => ({
5451
5451
  previewRegionMask: (e) => {
5452
5452
  let t = Dt.current;
5453
5453
  if (!t) return;
@@ -5534,9 +5534,9 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5534
5534
  Rn,
5535
5535
  Vn
5536
5536
  ]);
5537
- let lr = T(Y);
5537
+ let lr = O(Y);
5538
5538
  lr.current = Y;
5539
- let ur = v(() => Yt({
5539
+ let ur = x(() => Yt({
5540
5540
  engineRef: U,
5541
5541
  toolRef: Mt,
5542
5542
  externalToolMapRef: dt,
@@ -5566,7 +5566,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5566
5566
  dn,
5567
5567
  yn,
5568
5568
  bn
5569
- ]), fr = T([]);
5569
+ ]), fr = O([]);
5570
5570
  dr({
5571
5571
  backend: me,
5572
5572
  hostRef: we,
@@ -5591,7 +5591,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5591
5591
  setImageStatus: at,
5592
5592
  onContextMenuRequest: Be
5593
5593
  });
5594
- let pr = C(() => {
5594
+ let pr = E(() => {
5595
5595
  let e = m ? q.shapes.map((e) => {
5596
5596
  let t = m(e);
5597
5597
  return t ? {
@@ -5617,21 +5617,21 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5617
5617
  m,
5618
5618
  te
5619
5619
  ]);
5620
- fr.current = pr, y(() => {
5620
+ fr.current = pr, S(() => {
5621
5621
  U.current?.setShapes(pr, jt.current), dn();
5622
- }, [pr, dn]), y(() => {
5622
+ }, [pr, dn]), S(() => {
5623
5623
  U.current?.setSelection(J);
5624
- }, [J]), y(() => {
5624
+ }, [J]), S(() => {
5625
5625
  U.current?.setEditing(nn);
5626
5626
  }, [nn, K]);
5627
- let mr = T(ge);
5628
- mr.current = ge, y(() => {
5627
+ let mr = O(ge);
5628
+ mr.current = ge, S(() => {
5629
5629
  mr.current?.(nn);
5630
- }, [nn]), y(() => {
5630
+ }, [nn]), S(() => {
5631
5631
  rn(null);
5632
- }, [a]), y(() => {
5632
+ }, [a]), S(() => {
5633
5633
  nn && (J.length !== 1 || J[0] !== nn) && rn(null);
5634
- }, [J, nn]), y(() => {
5634
+ }, [J, nn]), S(() => {
5635
5635
  let e = U.current;
5636
5636
  e && (e.setFilter(Y.brightness, Y.contrast), e.setRenderDefaults({ strokeWidth: Y.strokeSize }), e.setImageSmoothing(Y.imageSmoothing), dn());
5637
5637
  }, [
@@ -5640,7 +5640,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5640
5640
  Y.strokeSize,
5641
5641
  Y.imageSmoothing,
5642
5642
  dn
5643
- ]), S(() => {
5643
+ ]), T(() => {
5644
5644
  K && U.current?.setOverlays(Y.showGuide ? bt : null, Y.showRegionMask ? St : null, r);
5645
5645
  }, [
5646
5646
  K,
@@ -5649,7 +5649,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5649
5649
  Y.showGuide,
5650
5650
  Y.showRegionMask,
5651
5651
  r
5652
- ]), y(() => {
5652
+ ]), S(() => {
5653
5653
  !K || !G || dn();
5654
5654
  }, [
5655
5655
  K,
@@ -5659,32 +5659,32 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5659
5659
  Y.showRegionMask,
5660
5660
  ne,
5661
5661
  dn
5662
- ]), y(() => {
5662
+ ]), S(() => {
5663
5663
  K && U.current?.setTransformEnabled(!Z && a !== W.BRUSH);
5664
5664
  }, [
5665
5665
  Z,
5666
5666
  K,
5667
5667
  a
5668
- ]), y(() => {
5668
+ ]), S(() => {
5669
5669
  Un(a, dt.current.has(a));
5670
5670
  }, [a, Un]);
5671
5671
  let hr = Q.finalize;
5672
- y(() => {
5672
+ S(() => {
5673
5673
  hr();
5674
- }, [a, hr]), y(() => {
5674
+ }, [a, hr]), S(() => {
5675
5675
  Kt.current = "idle", qt.current = null, Jt();
5676
5676
  }, [
5677
5677
  a,
5678
5678
  me,
5679
5679
  Jt
5680
- ]), y(() => {
5680
+ ]), S(() => {
5681
5681
  Wn(J, Z);
5682
5682
  }, [
5683
5683
  J,
5684
5684
  a,
5685
5685
  Z,
5686
5686
  Wn
5687
- ]), y(() => {
5687
+ ]), S(() => {
5688
5688
  K && Jt();
5689
5689
  }, [
5690
5690
  a,
@@ -5693,10 +5693,10 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5693
5693
  K,
5694
5694
  Jt
5695
5695
  ]);
5696
- let _r = T($e);
5696
+ let _r = O($e);
5697
5697
  _r.current = $e;
5698
- let yr = e !== null, Tr = T(null);
5699
- y(() => {
5698
+ let yr = e !== null, Tr = O(null);
5699
+ S(() => {
5700
5700
  let e = yr ? qe : null;
5701
5701
  Tr.current !== e && (Tr.current = e, Be(null), rn(null), Kt.current = "idle", qt.current = null, q.reset(yr ? Qe ?? [] : []), en(yr ? _r.current ?? [] : []), Dn(), hr(), Jt());
5702
5702
  }, [
@@ -5709,7 +5709,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5709
5709
  hr,
5710
5710
  Jt
5711
5711
  ]);
5712
- let Er = v(() => {
5712
+ let Er = x(() => {
5713
5713
  let e = sn.current;
5714
5714
  if (!e || Z) return !1;
5715
5715
  let t = U.current, n = new Set(t?.getVertexSelection() ?? []);
@@ -5817,7 +5817,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5817
5817
  },
5818
5818
  nudge: rr
5819
5819
  });
5820
- let Dr = C(() => pr.filter((e) => J.includes(e.id) && ie(e)), [pr, J]), Or = C(() => gn ? [...Dr, gn] : Dr, [Dr, gn]), kr = J.length > 0, Ar = q.shapes.some((e) => J.includes(e.id) && oe(e)), jr = !Z && J.length === 1 && (() => {
5820
+ let Dr = E(() => pr.filter((e) => J.includes(e.id) && ie(e)), [pr, J]), Or = E(() => gn ? [...Dr, gn] : Dr, [Dr, gn]), kr = J.length > 0, Ar = q.shapes.some((e) => J.includes(e.id) && oe(e)), jr = !Z && J.length === 1 && (() => {
5821
5821
  let e = q.shapes.find((e) => e.id === J[0]);
5822
5822
  return !!e && (e.type === F.POLYGON || e.type === F.LINE) && e.interaction?.editable !== !1 && !e.readOnly;
5823
5823
  })(), Mr = ir(), Nr = Z || Mr.length < 2 || (M ? !M(Mr) : !1), Pr = !!de && !Z, Fr = Pr && J.length === 1 ? (() => {
@@ -5870,7 +5870,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5870
5870
  ...Pr ? [{
5871
5871
  id: "assistExpand",
5872
5872
  label: X.contextMenu.assistExpand,
5873
- icon: /* @__PURE__ */ O(o, { size: 14 }),
5873
+ icon: /* @__PURE__ */ v(o, { size: 14 }),
5874
5874
  disabled: !Fr,
5875
5875
  onClick: () => {
5876
5876
  ze && Fr && Q.refineShape(Fr, ze.img, !0);
@@ -5878,7 +5878,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5878
5878
  }, {
5879
5879
  id: "assistExclude",
5880
5880
  label: X.contextMenu.assistExclude,
5881
- icon: /* @__PURE__ */ O(o, { size: 14 }),
5881
+ icon: /* @__PURE__ */ v(o, { size: 14 }),
5882
5882
  disabled: !Fr,
5883
5883
  onClick: () => {
5884
5884
  ze && Fr && Q.refineShape(Fr, ze.img, !1);
@@ -5942,19 +5942,19 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5942
5942
  image: G,
5943
5943
  wheelZoom: Y.wheelZoom,
5944
5944
  minimapSize: 204
5945
- }), Br = v(() => {
5945
+ }), Br = x(() => {
5946
5946
  U.current?.zoom100();
5947
- }, []), Vr = v(() => {
5947
+ }, []), Vr = x(() => {
5948
5948
  We((e) => !e);
5949
- }, []), Hr = v(() => {
5949
+ }, []), Hr = x(() => {
5950
5950
  Ke((e) => !e);
5951
- }, []), Ur = v(() => {
5951
+ }, []), Ur = x(() => {
5952
5952
  Ke(!1);
5953
5953
  }, []);
5954
- return /* @__PURE__ */ k("div", {
5954
+ return /* @__PURE__ */ y("div", {
5955
5955
  className: "aivex:relative aivex:h-full aivex:w-full aivex:overflow-hidden aivex:bg-black",
5956
5956
  children: [
5957
- /* @__PURE__ */ O("div", {
5957
+ /* @__PURE__ */ v("div", {
5958
5958
  ref: we,
5959
5959
  className: "aivex:h-full aivex:w-full",
5960
5960
  style: {
@@ -5962,15 +5962,15 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5962
5962
  transition: Me ? "opacity 0.3s ease" : "none"
5963
5963
  }
5964
5964
  }),
5965
- tt !== "ready" && /* @__PURE__ */ O(Le, {
5965
+ tt !== "ready" && /* @__PURE__ */ v(Le, {
5966
5966
  status: tt,
5967
5967
  render: n,
5968
5968
  loadingLabel: X.imageLoading,
5969
5969
  errorLabel: X.imageLoadError
5970
5970
  }),
5971
- K && G && /* @__PURE__ */ O("div", {
5971
+ K && G && /* @__PURE__ */ v("div", {
5972
5972
  className: "aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:overflow-hidden",
5973
- children: /* @__PURE__ */ k("div", {
5973
+ children: /* @__PURE__ */ y("div", {
5974
5974
  ref: Ee,
5975
5975
  style: {
5976
5976
  position: "absolute",
@@ -5981,7 +5981,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5981
5981
  transformOrigin: "0 0"
5982
5982
  },
5983
5983
  children: [
5984
- !!L?.length && R && /* @__PURE__ */ O("div", {
5984
+ !!L?.length && R && /* @__PURE__ */ v("div", {
5985
5985
  style: {
5986
5986
  position: "absolute",
5987
5987
  left: 0,
@@ -5990,7 +5990,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5990
5990
  height: G.h,
5991
5991
  pointerEvents: "none"
5992
5992
  },
5993
- children: L.map((e) => /* @__PURE__ */ O("div", {
5993
+ children: L.map((e) => /* @__PURE__ */ v("div", {
5994
5994
  role: e.disabled ? void 0 : "button",
5995
5995
  tabIndex: e.disabled ? void 0 : 0,
5996
5996
  "aria-pressed": e.selected || void 0,
@@ -6022,14 +6022,14 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
6022
6022
  y: 0
6023
6023
  }
6024
6024
  }),
6025
- Or.length > 0 && /* @__PURE__ */ O(ot, {
6025
+ Or.length > 0 && /* @__PURE__ */ v(ot, {
6026
6026
  shapes: Or,
6027
6027
  getLabel: ce,
6028
6028
  hideDot: V,
6029
6029
  formatInfo: le,
6030
6030
  register: mn
6031
6031
  }),
6032
- de && (Q.status === "loading" || Q.boxes.length > 0) && /* @__PURE__ */ O(Pe, {
6032
+ de && (Q.status === "loading" || Q.boxes.length > 0) && /* @__PURE__ */ v(Pe, {
6033
6033
  image: G,
6034
6034
  points: Q.points,
6035
6035
  boxes: Q.boxes,
@@ -6038,8 +6038,8 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
6038
6038
  ]
6039
6039
  })
6040
6040
  }),
6041
- K && Y.showCursorGuide && /* @__PURE__ */ O(Ie, { color: "#1e88e5" }),
6042
- G && w && /* @__PURE__ */ O(Xe, {
6041
+ K && Y.showCursorGuide && /* @__PURE__ */ v(Ie, { color: "#1e88e5" }),
6042
+ G && b && /* @__PURE__ */ v(Xe, {
6043
6043
  image: G,
6044
6044
  imageUrl: et,
6045
6045
  imageVisible: Me,
@@ -6065,7 +6065,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
6065
6065
  onToggleSettings: Hr,
6066
6066
  onCloseSettings: Ur
6067
6067
  }),
6068
- ze && /* @__PURE__ */ O(Fe, {
6068
+ ze && /* @__PURE__ */ v(Fe, {
6069
6069
  x: ze.x,
6070
6070
  y: ze.y,
6071
6071
  items: Rr,
@@ -6116,22 +6116,22 @@ function Or(e, t, n, r) {
6116
6116
  i.fillVisible && (e.save(), e.fillStyle = i.color, e.globalAlpha *= i.fillAlpha, e.fill(), e.restore()), t.style?.alternateColor && i.dash?.length && (e.setLineDash([]), e.strokeStyle = t.style.alternateColor, e.stroke()), e.setLineDash((i.dash ?? []).map((e) => e / n)), e.strokeStyle = i.color, e.stroke(), e.restore();
6117
6117
  }
6118
6118
  function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes: r = [], regionMask: i, guideMask: a, maskPalette: o, focusedShapeId: s, focusFit: c = "contain", zoomPadding: l = .3, strokeSize: u = 1, brightness: d = 1, contrast: f = 1, imageSmoothing: p = !0, lazy: m = !0, className: h, style: g, renderImageState: _ }) {
6119
- let v = T(null), b = T(null), x = T(null), [S, w] = E(!m), [D, A] = E("loading"), [j, M] = E(0);
6120
- y(() => {
6121
- if (!m || S) return;
6122
- let e = v.current;
6119
+ let b = O(null), x = O(null), C = O(null), [w, T] = k(!m), [D, A] = k("loading"), [j, M] = k(0);
6120
+ S(() => {
6121
+ if (!m || w) return;
6122
+ let e = b.current;
6123
6123
  if (!e) return;
6124
6124
  let t = new IntersectionObserver(([e]) => {
6125
- e.isIntersecting && (w(!0), t.disconnect());
6125
+ e.isIntersecting && (T(!0), t.disconnect());
6126
6126
  });
6127
6127
  return t.observe(e), () => t.disconnect();
6128
- }, [m, S]), y(() => {
6129
- let e = v.current;
6128
+ }, [m, w]), S(() => {
6129
+ let e = b.current;
6130
6130
  if (!e) return;
6131
6131
  let t = new ResizeObserver(() => M((e) => e + 1));
6132
6132
  return t.observe(e), () => t.disconnect();
6133
- }, []), y(() => {
6134
- if (!S || !e) {
6133
+ }, []), S(() => {
6134
+ if (!w || !e) {
6135
6135
  A(e ? "loading" : "error");
6136
6136
  return;
6137
6137
  }
@@ -6141,23 +6141,23 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6141
6141
  e.revoke?.();
6142
6142
  return;
6143
6143
  }
6144
- x.current?.revoke?.(), x.current = e, A("ready");
6144
+ C.current?.revoke?.(), C.current = e, A("ready");
6145
6145
  }).catch(() => {
6146
- t && (x.current?.revoke?.(), x.current = null, A("error"));
6146
+ t && (C.current?.revoke?.(), C.current = null, A("error"));
6147
6147
  }), () => {
6148
6148
  t = !1;
6149
6149
  };
6150
- }, [e, S]), y(() => () => {
6151
- x.current?.revoke?.(), x.current = null;
6150
+ }, [e, w]), S(() => () => {
6151
+ C.current?.revoke?.(), C.current = null;
6152
6152
  }, []);
6153
- let N = C(() => r.find((e) => e.id === s), [s, r]), P = C(() => a && o ? Ot(a, o) : null, [a, o]);
6154
- return y(() => {
6153
+ let N = E(() => r.find((e) => e.id === s), [s, r]), P = E(() => a && o ? Ot(a, o) : null, [a, o]);
6154
+ return S(() => {
6155
6155
  if (D === "error") {
6156
- let e = b.current;
6156
+ let e = x.current;
6157
6157
  e?.getContext("2d")?.clearRect(0, 0, e.width, e.height);
6158
6158
  }
6159
6159
  if (D !== "ready") return;
6160
- let e = v.current, t = b.current, a = x.current;
6160
+ let e = b.current, t = x.current, a = C.current;
6161
6161
  if (!e || !t || !a) return;
6162
6162
  let { width: o, height: s } = e.getBoundingClientRect();
6163
6163
  if (!o || !s) return;
@@ -6167,26 +6167,26 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6167
6167
  if (!h) return;
6168
6168
  let g = n?.width ?? a.image.naturalWidth, _ = n?.height ?? a.image.naturalHeight;
6169
6169
  if (!g || !_) return;
6170
- let y = Math.min(o / g, s / _), S = (o - g * y) / 2, C = (s - _ * y) / 2;
6170
+ let v = Math.min(o / g, s / _), y = (o - g * v) / 2, S = (s - _ * v) / 2;
6171
6171
  if (N && N.points.length > 0) {
6172
6172
  let e = B(N.points), t = Math.max(e.maxX - e.minX, 50), n = Math.max(e.maxY - e.minY, 50), r = Math.min(t, n) * l;
6173
- y = Math.min(o / (t + r * 2), s / (n + r * 2)), c === "cover" && (y = Math.max(y, Math.max(o / g, s / _))), S = o / 2 - (e.minX + e.maxX) / 2 * y, C = s / 2 - (e.minY + e.maxY) / 2 * y, c === "cover" && (S = Math.min(0, Math.max(S, o - g * y)), C = Math.min(0, Math.max(C, s - _ * y)));
6173
+ v = Math.min(o / (t + r * 2), s / (n + r * 2)), c === "cover" && (v = Math.max(v, Math.max(o / g, s / _))), y = o / 2 - (e.minX + e.maxX) / 2 * v, S = s / 2 - (e.minY + e.maxY) / 2 * v, c === "cover" && (y = Math.min(0, Math.max(y, o - g * v)), S = Math.min(0, Math.max(S, s - _ * v)));
6174
6174
  }
6175
- h.setTransform(m, 0, 0, m, 0, 0), h.clearRect(0, 0, o, s), h.save(), h.translate(S, C), h.scale(y, y), h.imageSmoothingEnabled = p, h.filter = `brightness(${d}) contrast(${f})`, h.drawImage(a.image, 0, 0, g, _), h.filter = "none", P && (h.save(), h.globalAlpha = .55, h.drawImage(P, 0, 0, g, _), h.restore());
6175
+ h.setTransform(m, 0, 0, m, 0, 0), h.clearRect(0, 0, o, s), h.save(), h.translate(y, S), h.scale(v, v), h.imageSmoothingEnabled = p, h.filter = `brightness(${d}) contrast(${f})`, h.drawImage(a.image, 0, 0, g, _), h.filter = "none", P && (h.save(), h.globalAlpha = .55, h.drawImage(P, 0, 0, g, _), h.restore());
6176
6176
  let w = i ? zt(i, g, _) : null;
6177
6177
  if (w && (Ft(h, w, g, _), w.outlineStyles)) {
6178
6178
  let e = (e, t) => {
6179
- if (h.lineWidth = t.width / y, t.underlayColor) {
6179
+ if (h.lineWidth = t.width / v, t.underlayColor) {
6180
6180
  h.setLineDash([]), h.strokeStyle = t.underlayColor;
6181
6181
  for (let [t, n] of e) Dr(h, [t, n], !1), h.stroke();
6182
6182
  }
6183
- h.save(), h.globalAlpha *= t.opacity, h.setLineDash(t.dash.map((e) => e / y)), h.strokeStyle = t.color;
6183
+ h.save(), h.globalAlpha *= t.opacity, h.setLineDash(t.dash.map((e) => e / v)), h.strokeStyle = t.color;
6184
6184
  for (let [t, n] of e) Dr(h, [t, n], !1), h.stroke();
6185
6185
  h.restore();
6186
6186
  };
6187
6187
  e(w.visibleOutline, w.outlineStyles.visible), e(w.occludedOutline, w.outlineStyles.occluded);
6188
6188
  }
6189
- for (let e of R(r)) Or(h, e, y, u);
6189
+ for (let e of R(r)) Or(h, e, v, u);
6190
6190
  h.restore();
6191
6191
  }, [
6192
6192
  d,
@@ -6202,8 +6202,8 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6202
6202
  D,
6203
6203
  u,
6204
6204
  l
6205
- ]), /* @__PURE__ */ k("div", {
6206
- ref: v,
6205
+ ]), /* @__PURE__ */ y("div", {
6206
+ ref: b,
6207
6207
  className: h,
6208
6208
  style: {
6209
6209
  position: "relative",
@@ -6211,12 +6211,12 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6211
6211
  height: "100%",
6212
6212
  ...g
6213
6213
  },
6214
- children: [/* @__PURE__ */ O("canvas", {
6215
- ref: b,
6214
+ children: [/* @__PURE__ */ v("canvas", {
6215
+ ref: x,
6216
6216
  role: "img",
6217
6217
  "aria-label": t,
6218
6218
  style: { display: "block" }
6219
- }), D !== "ready" && _ && /* @__PURE__ */ O("div", {
6219
+ }), D !== "ready" && _ && /* @__PURE__ */ v("div", {
6220
6220
  style: {
6221
6221
  position: "absolute",
6222
6222
  inset: 0