@aivex/ui 1.2.0-dev.2 → 1.2.0-dev.3

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 (47) hide show
  1. package/dist/Button-C_GP2mJ-.cjs +2 -0
  2. package/dist/Button-C_GP2mJ-.cjs.map +1 -0
  3. package/dist/{Switch-c8rHebeK.js → Button-CzqDPqUT.js} +1956 -4599
  4. package/dist/Button-CzqDPqUT.js.map +1 -0
  5. package/dist/IconButton-B-MspnYP.cjs +2 -0
  6. package/dist/IconButton-B-MspnYP.cjs.map +1 -0
  7. package/dist/IconButton-DTGSfJme.js +560 -0
  8. package/dist/IconButton-DTGSfJme.js.map +1 -0
  9. package/dist/Switch-B2irM7Pp.js +2656 -0
  10. package/dist/Switch-B2irM7Pp.js.map +1 -0
  11. package/dist/Switch-CMKBdqkX.cjs +42 -0
  12. package/dist/Switch-CMKBdqkX.cjs.map +1 -0
  13. package/dist/comment.cjs +114 -0
  14. package/dist/comment.cjs.map +1 -0
  15. package/dist/comment.js +13624 -0
  16. package/dist/comment.js.map +1 -0
  17. package/dist/components/Coachmark/Coachmark.d.ts +54 -0
  18. package/dist/components/Coachmark/index.d.ts +2 -0
  19. package/dist/components/Comment/CommentInput.d.ts +30 -0
  20. package/dist/components/Comment/CommentPin.d.ts +17 -0
  21. package/dist/components/Comment/MentionInput.d.ts +30 -0
  22. package/dist/components/Comment/MentionList.d.ts +14 -0
  23. package/dist/components/Comment/index.d.ts +4 -0
  24. package/dist/components/Comment/types.d.ts +12 -0
  25. package/dist/components/Comment/useMentionSuggestion.d.ts +15 -0
  26. package/dist/components/Logo/index.d.ts +2 -1
  27. package/dist/components/ShapeEditor/ShapeEditor.d.ts +1 -1
  28. package/dist/components/ShapeEditor/_components/SelectionInfo.d.ts +2 -1
  29. package/dist/components/ShapeEditor/_model/props.d.ts +11 -0
  30. package/dist/components/ShapeEditor/_renderers/KonvaRenderer.d.ts +3 -0
  31. package/dist/components/ShapeEditor/_renderers/PixiRenderer.d.ts +4 -0
  32. package/dist/components/ShapeEditor/_state/createInteractionController.d.ts +2 -0
  33. package/dist/components/Slider/Slider.d.ts +3 -1
  34. package/dist/index.cjs +6 -6
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.js +1933 -2284
  38. package/dist/index.js.map +1 -1
  39. package/dist/shape-editor.cjs +1 -1
  40. package/dist/shape-editor.cjs.map +1 -1
  41. package/dist/shape-editor.js +1105 -1061
  42. package/dist/shape-editor.js.map +1 -1
  43. package/dist/styles.css +1 -1
  44. package/package.json +13 -2
  45. package/dist/Switch-DX-FkCbT.cjs +0 -42
  46. package/dist/Switch-DX-FkCbT.cjs.map +0 -1
  47. package/dist/Switch-c8rHebeK.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import "./styles.css";
3
- import { Ci as e, Cr as t, _ as n, _t as r, bt as i, ei as a, f as o, h as s, mr as c, n as l, t as u } from "./Switch-c8rHebeK.js";
3
+ import { $n as e, at as t, ci as n, cr as r, nt as i, t as a, zr as o } from "./Button-CzqDPqUT.js";
4
+ import { f as s, h as c, n as l, t as u } from "./Switch-B2irM7Pp.js";
4
5
  import { useCallback as d, useEffect as f, useId as p, useImperativeHandle as m, useMemo as h, useReducer as g, useRef as _, useState as v } from "react";
5
6
  import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
6
7
  import S from "konva";
@@ -23,13 +24,13 @@ function te(e) {
23
24
  function j(e) {
24
25
  return te(e) && e.interaction?.selectable !== !1;
25
26
  }
26
- function ne(e) {
27
+ function M(e) {
27
28
  return j(e) && !e.readOnly && e.interaction?.editable !== !1;
28
29
  }
29
- function M(e) {
30
- return ne(e) && e.interaction?.draggable !== !1;
30
+ function N(e) {
31
+ return M(e) && e.interaction?.draggable !== !1;
31
32
  }
32
- function re(e) {
33
+ function ne(e) {
33
34
  return e.map((e, t) => ({
34
35
  shape: e,
35
36
  index: t
@@ -38,10 +39,10 @@ function re(e) {
38
39
  return n === r ? e.index - t.index : n - r;
39
40
  }).map((e) => e.shape);
40
41
  }
41
- function N() {
42
+ function P() {
42
43
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `id_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
43
44
  }
44
- var P = [
45
+ var F = [
45
46
  "tl",
46
47
  "t",
47
48
  "tr",
@@ -51,7 +52,7 @@ var P = [
51
52
  "bl",
52
53
  "l"
53
54
  ];
54
- function F(e) {
55
+ function I(e) {
55
56
  let t = e.map((e) => e.x), n = e.map((e) => e.y);
56
57
  return {
57
58
  minX: Math.min(...t),
@@ -60,33 +61,33 @@ function F(e) {
60
61
  maxY: Math.max(...n)
61
62
  };
62
63
  }
63
- function I(e, t) {
64
+ function L(e, t) {
64
65
  let n = (t.minX + t.maxX) / 2, r = (t.minY + t.maxY) / 2;
65
66
  return {
66
67
  x: e.includes("l") ? t.minX : e.includes("r") ? t.maxX : n,
67
68
  y: e.includes("t") ? t.minY : e.includes("b") ? t.maxY : r
68
69
  };
69
70
  }
70
- function L(e, t, n, r) {
71
+ function R(e, t, n, r) {
71
72
  let i = { ...t };
72
73
  return e.includes("l") && (i.minX = n), e.includes("r") && (i.maxX = n), e.includes("t") && (i.minY = r), e.includes("b") && (i.maxY = r), i;
73
74
  }
74
- function R(e, t) {
75
+ function z(e, t) {
75
76
  let n = t.x - e.x, r = t.y - e.y, i = Math.max(Math.abs(n), Math.abs(r));
76
77
  return {
77
78
  x: e.x + (n < 0 ? -i : i),
78
79
  y: e.y + (r < 0 ? -i : i)
79
80
  };
80
81
  }
81
- function ie(e, t, n) {
82
+ function re(e, t, n) {
82
83
  let r = Math.cos(n), i = Math.sin(n), a = e.x - t.x, o = e.y - t.y;
83
84
  return {
84
85
  x: t.x + a * r - o * i,
85
86
  y: t.y + a * i + o * r
86
87
  };
87
88
  }
88
- function z(e) {
89
- let t = F(e);
89
+ function B(e) {
90
+ let t = I(e);
90
91
  return [
91
92
  {
92
93
  x: t.minX,
@@ -106,7 +107,7 @@ function z(e) {
106
107
  }
107
108
  ];
108
109
  }
109
- function B(e, t, n = 32) {
110
+ function V(e, t, n = 32) {
110
111
  let r = (e.x + t.x) / 2, i = (e.y + t.y) / 2, a = Math.abs(t.x - e.x) / 2, o = Math.abs(t.y - e.y) / 2;
111
112
  return Array.from({ length: n }, (e, t) => {
112
113
  let s = t / n * 2 * Math.PI;
@@ -116,7 +117,7 @@ function B(e, t, n = 32) {
116
117
  };
117
118
  });
118
119
  }
119
- function ae(e) {
120
+ function ie(e) {
120
121
  let t = [...e].sort((e, t) => e.x - t.x || e.y - t.y);
121
122
  if (t.length <= 2) return t;
122
123
  let n = (e, t, n) => (t.x - e.x) * (n.y - e.y) - (t.y - e.y) * (n.x - e.x), r = [];
@@ -132,10 +133,10 @@ function ae(e) {
132
133
  }
133
134
  return r.pop(), i.pop(), r.concat(i);
134
135
  }
135
- function oe(e) {
136
- let t = ae(e);
137
- if (t.length < 3) return z(e);
138
- let n = Infinity, r = z(e);
136
+ function ae(e) {
137
+ let t = ie(e);
138
+ if (t.length < 3) return B(e);
139
+ let n = Infinity, r = B(e);
139
140
  for (let e = 0; e < t.length; e++) {
140
141
  let i = t[e], a = t[(e + 1) % t.length], o = Math.hypot(a.x - i.x, a.y - i.y) || 1, s = (a.x - i.x) / o, c = (a.y - i.y) / o, l = Infinity, u = -Infinity, d = Infinity, f = -Infinity;
141
142
  for (let e of t) {
@@ -159,19 +160,19 @@ function oe(e) {
159
160
  }
160
161
  return r;
161
162
  }
162
- var se = (e, t) => ({
163
+ var oe = (e, t) => ({
163
164
  x: e.x - t.x,
164
165
  y: e.y - t.y
165
- }), ce = (e, t) => e.x * t.x + e.y * t.y, le = (e) => Math.hypot(e.x, e.y), ue = (e) => {
166
- let t = le(e) || 1;
166
+ }), se = (e, t) => e.x * t.x + e.y * t.y, ce = (e) => Math.hypot(e.x, e.y), le = (e) => {
167
+ let t = ce(e) || 1;
167
168
  return {
168
169
  x: e.x / t,
169
170
  y: e.y / t
170
171
  };
171
- }, de = (e, t) => ({
172
+ }, ue = (e, t) => ({
172
173
  x: (e.x + t.x) / 2,
173
174
  y: (e.y + t.y) / 2
174
- }), fe = (e) => {
175
+ }), de = (e) => {
175
176
  let t = e.reduce((e, t) => ({
176
177
  x: e.x + t.x,
177
178
  y: e.y + t.y
@@ -184,26 +185,26 @@ var se = (e, t) => ({
184
185
  y: t.y / e.length
185
186
  };
186
187
  };
187
- function pe(e) {
188
+ function fe(e) {
188
189
  return [
189
190
  e[0],
190
- de(e[0], e[1]),
191
+ ue(e[0], e[1]),
191
192
  e[1],
192
- de(e[1], e[2]),
193
+ ue(e[1], e[2]),
193
194
  e[2],
194
- de(e[2], e[3]),
195
+ ue(e[2], e[3]),
195
196
  e[3],
196
- de(e[3], e[0])
197
+ ue(e[3], e[0])
197
198
  ];
198
199
  }
199
- function me(e, t) {
200
- let n = de(e[0], e[1]), r = ue(se(e[0], e[3]));
200
+ function pe(e, t) {
201
+ let n = ue(e[0], e[1]), r = le(oe(e[0], e[3]));
201
202
  return {
202
203
  x: n.x + r.x * t,
203
204
  y: n.y + r.y * t
204
205
  };
205
206
  }
206
- function he(e, t, n, r) {
207
+ function me(e, t, n, r) {
207
208
  let i = (e, i) => ({
208
209
  x: t.x + e * n.x + i * r.x,
209
210
  y: t.y + e * n.y + i * r.y
@@ -215,17 +216,17 @@ function he(e, t, n, r) {
215
216
  i(e.minX, e.maxY)
216
217
  ];
217
218
  }
218
- function ge(e, t, n) {
219
+ function he(e, t, n) {
219
220
  if (e.length < 4) return e;
220
- let r = e[0], i = ue(se(e[1], e[0])), a = ue(se(e[3], e[0])), o = ce(se(e[1], r), i), s = ce(se(e[3], r), a), c = se(n, r);
221
- return he(L(t, {
221
+ let r = e[0], i = le(oe(e[1], e[0])), a = le(oe(e[3], e[0])), o = se(oe(e[1], r), i), s = se(oe(e[3], r), a), c = oe(n, r);
222
+ return me(R(t, {
222
223
  minX: 0,
223
224
  minY: 0,
224
225
  maxX: o,
225
226
  maxY: s
226
- }, ce(c, i), ce(c, a)), r, i, a);
227
+ }, se(c, i), se(c, a)), r, i, a);
227
228
  }
228
- function _e(e, t, n) {
229
+ function ge(e, t, n) {
229
230
  let r = t.maxX - t.minX || 1, i = t.maxY - t.minY || 1, a = n.maxX - n.minX, o = n.maxY - n.minY;
230
231
  return e.map((e) => ({
231
232
  x: n.minX + (e.x - t.minX) / r * a,
@@ -234,7 +235,7 @@ function _e(e, t, n) {
234
235
  }
235
236
  //#endregion
236
237
  //#region src/components/ShapeEditor/_model/strings.ts
237
- var V = {
238
+ var H = {
238
239
  contextMenu: {
239
240
  copy: "복사",
240
241
  paste: "붙여넣기",
@@ -278,27 +279,27 @@ var V = {
278
279
  imageLoading: "이미지를 불러오는 중…",
279
280
  imageLoadError: "이미지를 불러올 수 없습니다"
280
281
  };
281
- function ve(e) {
282
+ function _e(e) {
282
283
  return e ? {
283
284
  contextMenu: {
284
- ...V.contextMenu,
285
+ ...H.contextMenu,
285
286
  ...e.contextMenu
286
287
  },
287
288
  viewSettings: {
288
- ...V.viewSettings,
289
+ ...H.viewSettings,
289
290
  ...e.viewSettings
290
291
  },
291
292
  minimap: {
292
- ...V.minimap,
293
+ ...H.minimap,
293
294
  ...e.minimap
294
295
  },
295
- imageLoading: e.imageLoading ?? V.imageLoading,
296
- imageLoadError: e.imageLoadError ?? V.imageLoadError
297
- } : V;
296
+ imageLoading: e.imageLoading ?? H.imageLoading,
297
+ imageLoadError: e.imageLoadError ?? H.imageLoadError
298
+ } : H;
298
299
  }
299
300
  //#endregion
300
301
  //#region src/components/ShapeEditor/_model/tools.ts
301
- var H = {
302
+ var U = {
302
303
  SELECT: "SELECT",
303
304
  POLYGON: "POLYGON",
304
305
  PATH: "PATH",
@@ -310,7 +311,7 @@ var H = {
310
311
  ASSISTANT_POLYGON: "ASSISTANT_POLYGON",
311
312
  ASSISTANT_RECT: "ASSISTANT_RECT",
312
313
  ASSISTANT_POINT: "ASSISTANT_POINT"
313
- }, ye = {
314
+ }, ve = {
314
315
  brightness: 1,
315
316
  contrast: 1,
316
317
  showCursorGuide: !1,
@@ -321,9 +322,9 @@ var H = {
321
322
  showRoi: !0,
322
323
  keepZoomOnImageChange: !1,
323
324
  wheelZoom: !0
324
- }, be = "var(--editor-overlay-inverse-scale, 1)", xe = "#377be2", Se = "#e23c3c";
325
- function Ce({ point: e }) {
326
- let t = e.positive ? xe : Se;
325
+ }, ye = "var(--editor-overlay-inverse-scale, 1)", be = "#377be2", xe = "#e23c3c";
326
+ function Se({ point: e }) {
327
+ let t = e.positive ? be : xe;
327
328
  return /* @__PURE__ */ b("div", {
328
329
  style: {
329
330
  position: "absolute",
@@ -344,13 +345,13 @@ function Ce({ point: e }) {
344
345
  display: "flex",
345
346
  alignItems: "center",
346
347
  justifyContent: "center",
347
- transform: `scale(${be})`,
348
+ transform: `scale(${ye})`,
348
349
  transformOrigin: "center"
349
350
  },
350
351
  children: e.positive ? "+" : "−"
351
352
  });
352
353
  }
353
- function we({ image: e, points: t, boxes: n, status: r }) {
354
+ function Ce({ image: e, points: t, boxes: n, status: r }) {
354
355
  return /* @__PURE__ */ x("div", {
355
356
  style: {
356
357
  position: "absolute",
@@ -374,20 +375,20 @@ function we({ image: e, points: t, boxes: n, status: r }) {
374
375
  backgroundSize: "200% 100%",
375
376
  animation: "editorv2-assistant-shimmer 1.4s linear infinite"
376
377
  } }, `box-${t}-${e.x}-${e.y}-${e.width}-${e.height}`)),
377
- r === "loading" && t.map((e, t) => /* @__PURE__ */ b(Ce, { point: e }, `pt-${t}-${e.x}-${e.y}`))
378
+ r === "loading" && t.map((e, t) => /* @__PURE__ */ b(Se, { point: e }, `pt-${t}-${e.x}-${e.y}`))
378
379
  ]
379
380
  });
380
381
  }
381
382
  //#endregion
382
383
  //#region src/components/ShapeEditor/_components/ContextMenu.tsx
383
- function Te({ x: e, y: t, items: r, onClose: i }) {
384
- return /* @__PURE__ */ x(n, {
384
+ function we({ x: e, y: t, items: n, onClose: r }) {
385
+ return /* @__PURE__ */ x(c, {
385
386
  open: !0,
386
387
  modal: !1,
387
388
  onOpenChange: (e) => {
388
- e || i();
389
+ e || r();
389
390
  },
390
- children: [/* @__PURE__ */ b(n.Trigger, {
391
+ children: [/* @__PURE__ */ b(c.Trigger, {
391
392
  asChild: !0,
392
393
  children: /* @__PURE__ */ b("span", {
393
394
  "aria-hidden": !0,
@@ -399,7 +400,7 @@ function Te({ x: e, y: t, items: r, onClose: i }) {
399
400
  height: 0
400
401
  }
401
402
  })
402
- }), /* @__PURE__ */ b(n.Content, {
403
+ }), /* @__PURE__ */ b(c.Content, {
403
404
  side: "bottom",
404
405
  align: "start",
405
406
  sideOffset: 2,
@@ -410,7 +411,7 @@ function Te({ x: e, y: t, items: r, onClose: i }) {
410
411
  },
411
412
  onContextMenu: (e) => e.preventDefault(),
412
413
  onCloseAutoFocus: (e) => e.preventDefault(),
413
- children: r.map((e, t) => "separator" in e ? /* @__PURE__ */ b(n.Separator, { className: "aivex:shrink-0" }, `sep-${t}`) : /* @__PURE__ */ b(n.Item, {
414
+ children: n.map((e, t) => "separator" in e ? /* @__PURE__ */ b(c.Separator, { className: "aivex:shrink-0" }, `sep-${t}`) : /* @__PURE__ */ b(c.Item, {
414
415
  danger: e.danger,
415
416
  disabled: e.disabled,
416
417
  className: "aivex:shrink-0",
@@ -423,7 +424,7 @@ function Te({ x: e, y: t, items: r, onClose: i }) {
423
424
  className: "aivex:truncate",
424
425
  children: e.label
425
426
  })]
426
- }), e.shortcut && /* @__PURE__ */ b(n.Shortcut, { children: e.shortcut })]
427
+ }), e.shortcut && /* @__PURE__ */ b(c.Shortcut, { children: e.shortcut })]
427
428
  })
428
429
  }, e.label))
429
430
  })]
@@ -431,7 +432,7 @@ function Te({ x: e, y: t, items: r, onClose: i }) {
431
432
  }
432
433
  //#endregion
433
434
  //#region src/components/ShapeEditor/_components/CursorGuide.tsx
434
- function Ee({ color: e = "#1e88e5" }) {
435
+ function Te({ color: e = "#1e88e5" }) {
435
436
  let t = _(null), n = _(null), r = _(null);
436
437
  return f(() => {
437
438
  let e = t.current, i = n.current, a = r.current;
@@ -481,7 +482,7 @@ function Ee({ color: e = "#1e88e5" }) {
481
482
  }
482
483
  //#endregion
483
484
  //#region src/components/ShapeEditor/_components/ImageStateOverlay.tsx
484
- function De({ status: e, render: t, loadingLabel: n = V.imageLoading, errorLabel: r = V.imageLoadError }) {
485
+ function Ee({ status: e, render: t, loadingLabel: n = H.imageLoading, errorLabel: r = H.imageLoadError }) {
485
486
  return /* @__PURE__ */ b("div", {
486
487
  "data-track-id": e === "loading" ? "editor-image-loading-wrap" : "editor-image-error-wrap",
487
488
  style: {
@@ -534,11 +535,11 @@ function De({ status: e, render: t, loadingLabel: n = V.imageLoading, errorLabel
534
535
  });
535
536
  }
536
537
  Math.PI / 12;
537
- var Oe = "#669DEF", U = .1, ke = "#ffffff", Ae = [6, 6], je = .7, Me = 2.5;
538
+ var De = "#669DEF", Oe = .1, ke = "#ffffff", W = [6, 6], Ae = .7, je = 2.5;
538
539
  //#endregion
539
540
  //#region src/components/ShapeEditor/_model/shapeRenderStyle.ts
540
- function W(e, t = {}) {
541
- let n = e.style?.color ?? "#00e5ff", r = !!e.readOnly, i = e.style?.strokeWidth ?? t.strokeWidth ?? 2, a = r ? i * Me : i, o = r ? je : e.style?.opacity ?? 1, s = e.style?.fillOpacity ?? .12549019607843137, c = e.style?.dash ?? (r ? [a, a * 2] : void 0);
541
+ function Me(e, t = {}) {
542
+ let n = e.style?.color ?? "#00e5ff", r = !!e.readOnly, i = e.style?.strokeWidth ?? t.strokeWidth ?? 2, a = r ? i * je : i, o = r ? Ae : e.style?.opacity ?? 1, s = e.style?.fillOpacity ?? .12549019607843137, c = e.style?.dash ?? (r ? [a, a * 2] : void 0);
542
543
  return {
543
544
  color: n,
544
545
  strokeWidth: a,
@@ -559,8 +560,8 @@ function Ne(e, t) {
559
560
  }
560
561
  //#endregion
561
562
  //#region src/components/ShapeEditor/_components/MinimapShape.tsx
562
- function Pe({ shape: e, strokeSize: t, register: n }) {
563
- let { type: r, points: i } = e, a = W(e, { strokeWidth: t }), o = (t) => n?.(e.id, t), s = {
563
+ function G({ shape: e, strokeSize: t, register: n }) {
564
+ let { type: r, points: i } = e, a = Me(e, { strokeWidth: t }), o = (t) => n?.(e.id, t), s = {
564
565
  ref: o,
565
566
  stroke: a.color,
566
567
  strokeWidth: a.strokeWidth,
@@ -579,7 +580,7 @@ function Pe({ shape: e, strokeSize: t, register: n }) {
579
580
  opacity: a.opacity
580
581
  });
581
582
  if (r === A.RECTANGLE || r === A.ELLIPSE) {
582
- let e = F(i);
583
+ let e = I(i);
583
584
  return r === A.ELLIPSE ? /* @__PURE__ */ b("ellipse", {
584
585
  cx: (e.minX + e.maxX) / 2,
585
586
  cy: (e.minY + e.maxY) / 2,
@@ -605,7 +606,7 @@ function Pe({ shape: e, strokeSize: t, register: n }) {
605
606
  }
606
607
  //#endregion
607
608
  //#region src/components/ShapeEditor/_components/RoiOverlay.tsx
608
- function Fe({ image: e, rois: t, excludedZones: n, maskId: r, width: i, height: a, strokeWidth: o, strokeDasharray: s, style: c }) {
609
+ function Pe({ image: e, rois: t, excludedZones: n, maskId: r, width: i, height: a, strokeWidth: o, strokeDasharray: s, style: c }) {
609
610
  return /* @__PURE__ */ x("svg", {
610
611
  width: i,
611
612
  height: a,
@@ -668,7 +669,11 @@ function Fe({ image: e, rois: t, excludedZones: n, maskId: r, width: i, height:
668
669
  }
669
670
  //#endregion
670
671
  //#region src/components/ShapeEditor/_components/SettingsPanel.tsx
671
- function G({ value: e, onChange: t, onClose: n, labels: r = V.viewSettings }) {
672
+ var Fe = {
673
+ trackRootClassName: "aivex:h-1.5",
674
+ thumbClassName: "aivex:h-4 aivex:w-4 aivex:border"
675
+ };
676
+ function Ie({ value: e, onChange: t, onClose: n, labels: r = H.viewSettings }) {
672
677
  return f(() => {
673
678
  let e = (e) => {
674
679
  e.key === "Escape" && n();
@@ -685,83 +690,87 @@ function G({ value: e, onChange: t, onClose: n, labels: r = V.viewSettings }) {
685
690
  children: [/* @__PURE__ */ b("span", {
686
691
  className: "aivex:font-semibold aivex:text-text-secondary",
687
692
  children: r.title
688
- }), /* @__PURE__ */ b(s, {
693
+ }), /* @__PURE__ */ b(a, {
689
694
  variant: "ghost",
690
695
  size: "sm",
691
- onClick: () => t({ ...ye }),
696
+ onClick: () => t({ ...ve }),
692
697
  children: r.reset
693
698
  })]
694
699
  }),
695
- /* @__PURE__ */ b(Ie, {
700
+ /* @__PURE__ */ b(K, {
696
701
  label: `${r.brightness} ${e.brightness.toFixed(2)}`,
697
702
  children: /* @__PURE__ */ b(l, {
698
703
  min: 0,
699
704
  max: 3,
700
705
  step: .05,
701
706
  value: [e.brightness],
702
- onValueChange: ([e]) => t({ brightness: e })
707
+ onValueChange: ([e]) => t({ brightness: e }),
708
+ ...Fe
703
709
  })
704
710
  }),
705
- /* @__PURE__ */ b(Ie, {
711
+ /* @__PURE__ */ b(K, {
706
712
  label: `${r.contrast} ${e.contrast.toFixed(2)}`,
707
713
  children: /* @__PURE__ */ b(l, {
708
714
  min: 0,
709
715
  max: 3,
710
716
  step: .05,
711
717
  value: [e.contrast],
712
- onValueChange: ([e]) => t({ contrast: e })
718
+ onValueChange: ([e]) => t({ contrast: e }),
719
+ ...Fe
713
720
  })
714
721
  }),
715
- /* @__PURE__ */ b(Ie, {
722
+ /* @__PURE__ */ b(K, {
716
723
  label: `${r.strokeSize} ${e.strokeSize}`,
717
724
  children: /* @__PURE__ */ b(l, {
718
725
  min: 1,
719
726
  max: 10,
720
727
  step: .5,
721
728
  value: [e.strokeSize],
722
- onValueChange: ([e]) => t({ strokeSize: e })
729
+ onValueChange: ([e]) => t({ strokeSize: e }),
730
+ ...Fe
723
731
  })
724
732
  }),
725
- /* @__PURE__ */ b(Ie, {
733
+ /* @__PURE__ */ b(K, {
726
734
  label: `${r.simplifyStrength} ${e.simplifyStrength}`,
727
735
  children: /* @__PURE__ */ b(l, {
728
736
  min: .5,
729
737
  max: 5,
730
738
  step: .5,
731
739
  value: [e.simplifyStrength],
732
- onValueChange: ([e]) => t({ simplifyStrength: e })
740
+ onValueChange: ([e]) => t({ simplifyStrength: e }),
741
+ ...Fe
733
742
  })
734
743
  }),
735
744
  /* @__PURE__ */ b("div", {
736
745
  className: "aivex:my-2",
737
- children: /* @__PURE__ */ b(o, {})
746
+ children: /* @__PURE__ */ b(s, {})
738
747
  }),
739
- /* @__PURE__ */ b(K, {
748
+ /* @__PURE__ */ b(Le, {
740
749
  label: r.pixelation,
741
750
  checked: !e.imageSmoothing,
742
751
  onChange: (e) => t({ imageSmoothing: !e })
743
752
  }),
744
- /* @__PURE__ */ b(K, {
753
+ /* @__PURE__ */ b(Le, {
745
754
  label: r.cursorGuide,
746
755
  checked: e.showCursorGuide,
747
756
  onChange: (e) => t({ showCursorGuide: e })
748
757
  }),
749
- /* @__PURE__ */ b(K, {
758
+ /* @__PURE__ */ b(Le, {
750
759
  label: r.guideMask,
751
760
  checked: e.showGuide,
752
761
  onChange: (e) => t({ showGuide: e })
753
762
  }),
754
- /* @__PURE__ */ b(K, {
763
+ /* @__PURE__ */ b(Le, {
755
764
  label: r.roi,
756
765
  checked: e.showRoi,
757
766
  onChange: (e) => t({ showRoi: e })
758
767
  }),
759
- /* @__PURE__ */ b(K, {
768
+ /* @__PURE__ */ b(Le, {
760
769
  label: r.keepZoomOnImageChange,
761
770
  checked: e.keepZoomOnImageChange,
762
771
  onChange: (e) => t({ keepZoomOnImageChange: e })
763
772
  }),
764
- /* @__PURE__ */ b(K, {
773
+ /* @__PURE__ */ b(Le, {
765
774
  label: r.wheelZoom,
766
775
  checked: e.wheelZoom,
767
776
  onChange: (e) => t({ wheelZoom: e })
@@ -769,7 +778,7 @@ function G({ value: e, onChange: t, onClose: n, labels: r = V.viewSettings }) {
769
778
  ]
770
779
  });
771
780
  }
772
- function Ie({ label: e, children: t }) {
781
+ function K({ label: e, children: t }) {
773
782
  return /* @__PURE__ */ x("div", {
774
783
  className: "aivex:mb-2 aivex:block",
775
784
  children: [/* @__PURE__ */ b("span", {
@@ -778,7 +787,7 @@ function Ie({ label: e, children: t }) {
778
787
  }), t]
779
788
  });
780
789
  }
781
- function K({ label: e, checked: t, onChange: n }) {
790
+ function Le({ label: e, checked: t, onChange: n }) {
782
791
  return /* @__PURE__ */ x("div", {
783
792
  className: "aivex:flex aivex:items-center aivex:justify-between aivex:py-1",
784
793
  children: [/* @__PURE__ */ b("span", { children: e }), /* @__PURE__ */ b(u, {
@@ -790,13 +799,13 @@ function K({ label: e, checked: t, onChange: n }) {
790
799
  }
791
800
  //#endregion
792
801
  //#region src/components/ShapeEditor/_components/Minimap.tsx
793
- function Le({ image: n, imageUrl: o, imageVisible: c = !0, maskDataUrl: l, rois: u, excludedZones: d, roiMaskId: f, shapes: p, view: m, onChangeView: h, nav: g, registerShape: _, rectRef: v, zoomLabelRef: y, onZoom100: S, open: C, onToggleOpen: w, showSettings: T = !0, settingsOpen: E, onToggleSettings: D, onCloseSettings: O, labels: k = V.minimap, settingsLabels: A }) {
794
- let { offX: te, offY: j, dispW: ne, dispH: M, zoomCentered: N } = g, P = {
802
+ function Re({ image: e, imageUrl: s, imageVisible: c = !0, maskDataUrl: l, rois: u, excludedZones: d, roiMaskId: f, shapes: p, view: m, onChangeView: h, nav: g, registerShape: _, rectRef: v, zoomLabelRef: y, onZoom100: S, open: C, onToggleOpen: w, showSettings: T = !0, settingsOpen: E, onToggleSettings: D, onCloseSettings: O, labels: k = H.minimap, settingsLabels: A }) {
803
+ let { offX: te, offY: j, dispW: M, dispH: N, zoomCentered: P } = g, F = {
795
804
  position: "absolute",
796
805
  left: te,
797
806
  top: j,
798
- width: ne,
799
- height: M
807
+ width: M,
808
+ height: N
800
809
  };
801
810
  return /* @__PURE__ */ x("div", {
802
811
  className: "aivex:absolute aivex:bottom-2 aivex:left-2 aivex:w-[188px] aivex:rounded-[8px] aivex:border aivex:border-border-default aivex:bg-bg-primary aivex:p-[4px] aivex:shadow-lg",
@@ -817,30 +826,30 @@ function Le({ image: n, imageUrl: o, imageVisible: c = !0, maskDataUrl: l, rois:
817
826
  transition: c ? "opacity 0.3s ease" : "none"
818
827
  },
819
828
  children: [
820
- o && /* @__PURE__ */ b("img", {
821
- src: o,
829
+ s && /* @__PURE__ */ b("img", {
830
+ src: s,
822
831
  alt: "",
823
832
  draggable: !1,
824
- style: P
833
+ style: F
825
834
  }),
826
835
  l && m.showGuide && /* @__PURE__ */ b("img", {
827
836
  src: l,
828
837
  alt: "",
829
838
  draggable: !1,
830
839
  style: {
831
- ...P,
840
+ ...F,
832
841
  opacity: .55,
833
842
  imageRendering: "pixelated",
834
843
  pointerEvents: "none"
835
844
  }
836
845
  }),
837
- m.showRoi && u && u.length > 0 && /* @__PURE__ */ b(Fe, {
838
- image: n,
846
+ m.showRoi && u && u.length > 0 && /* @__PURE__ */ b(Pe, {
847
+ image: e,
839
848
  rois: u,
840
849
  excludedZones: d,
841
850
  maskId: f,
842
- width: ne,
843
- height: M,
851
+ width: M,
852
+ height: N,
844
853
  strokeWidth: 1,
845
854
  strokeDasharray: "4 4",
846
855
  style: {
@@ -851,9 +860,9 @@ function Le({ image: n, imageUrl: o, imageVisible: c = !0, maskDataUrl: l, rois:
851
860
  }
852
861
  }),
853
862
  /* @__PURE__ */ b("svg", {
854
- viewBox: `0 0 ${n.w} ${n.h}`,
855
- width: ne,
856
- height: M,
863
+ viewBox: `0 0 ${e.w} ${e.h}`,
864
+ width: M,
865
+ height: N,
857
866
  style: {
858
867
  position: "absolute",
859
868
  left: te,
@@ -861,7 +870,7 @@ function Le({ image: n, imageUrl: o, imageVisible: c = !0, maskDataUrl: l, rois:
861
870
  pointerEvents: "none"
862
871
  },
863
872
  "aria-hidden": !0,
864
- children: re(p).filter(ee).map((e) => /* @__PURE__ */ b(Pe, {
873
+ children: ne(p).filter(ee).map((e) => /* @__PURE__ */ b(G, {
865
874
  shape: e,
866
875
  strokeSize: m.strokeSize,
867
876
  register: _
@@ -885,14 +894,14 @@ function Le({ image: n, imageUrl: o, imageVisible: c = !0, maskDataUrl: l, rois:
885
894
  children: [/* @__PURE__ */ x("div", {
886
895
  className: "aivex:flex aivex:items-center aivex:gap-0.5",
887
896
  children: [
888
- /* @__PURE__ */ b(s, {
897
+ /* @__PURE__ */ b(a, {
889
898
  variant: "ghost",
890
899
  size: "icon-sm",
891
900
  "aria-label": k.zoomOut,
892
- onClick: () => N(1 / 1.2),
893
- children: /* @__PURE__ */ b(t, { size: 16 })
901
+ onClick: () => P(1 / 1.2),
902
+ children: /* @__PURE__ */ b(r, { size: 16 })
894
903
  }),
895
- /* @__PURE__ */ b(s, {
904
+ /* @__PURE__ */ b(a, {
896
905
  variant: "ghost",
897
906
  size: "sm",
898
907
  "aria-label": k.zoom100,
@@ -903,35 +912,35 @@ function Le({ image: n, imageUrl: o, imageVisible: c = !0, maskDataUrl: l, rois:
903
912
  children: "100%"
904
913
  })
905
914
  }),
906
- /* @__PURE__ */ b(s, {
915
+ /* @__PURE__ */ b(a, {
907
916
  variant: "ghost",
908
917
  size: "icon-sm",
909
918
  "aria-label": k.zoomIn,
910
- onClick: () => N(1.2),
911
- children: /* @__PURE__ */ b(a, { size: 16 })
919
+ onClick: () => P(1.2),
920
+ children: /* @__PURE__ */ b(o, { size: 16 })
912
921
  })
913
922
  ]
914
923
  }), /* @__PURE__ */ x("div", {
915
924
  className: "aivex:relative aivex:flex aivex:items-center aivex:gap-0.5",
916
925
  children: [
917
- T && /* @__PURE__ */ b(s, {
926
+ T && /* @__PURE__ */ b(a, {
918
927
  variant: "ghost",
919
928
  size: "icon-sm",
920
929
  "aria-label": k.viewSettings,
921
930
  onClick: D,
922
931
  onPointerDown: (e) => e.stopPropagation(),
923
932
  className: E ? "aivex:text-text-brand" : void 0,
924
- children: /* @__PURE__ */ b(e, { size: 16 })
933
+ children: /* @__PURE__ */ b(n, { size: 16 })
925
934
  }),
926
- /* @__PURE__ */ b(s, {
935
+ /* @__PURE__ */ b(a, {
927
936
  variant: "ghost",
928
937
  size: "icon-sm",
929
938
  "aria-label": k.toggleMinimap,
930
939
  title: "(M)",
931
940
  onClick: w,
932
- children: b(C ? r : i, { size: 16 })
941
+ children: b(C ? i : t, { size: 16 })
933
942
  }),
934
- T && E && /* @__PURE__ */ b(G, {
943
+ T && E && /* @__PURE__ */ b(Ie, {
935
944
  value: m,
936
945
  onChange: h,
937
946
  onClose: O,
@@ -944,7 +953,7 @@ function Le({ image: n, imageUrl: o, imageVisible: c = !0, maskDataUrl: l, rois:
944
953
  }
945
954
  //#endregion
946
955
  //#region src/components/ShapeEditor/_components/SelectionInfo.tsx
947
- var Re = "var(--editor-overlay-inverse-scale, 1)", ze = 6, Be = {
956
+ var ze = "var(--editor-overlay-inverse-scale, 1)", Be = 6, Ve = {
948
957
  fontFamily: "Pretendard, sans-serif",
949
958
  fontSize: 12,
950
959
  fontWeight: 500,
@@ -953,8 +962,8 @@ var Re = "var(--editor-overlay-inverse-scale, 1)", ze = 6, Be = {
953
962
  textShadow: "0 0 4px #000, 0 0 4px #000",
954
963
  whiteSpace: "nowrap"
955
964
  };
956
- function Ve(e, t) {
957
- let n = F(t);
965
+ function He(e, t) {
966
+ let n = I(t);
958
967
  return {
959
968
  shape: e,
960
969
  x: n.minX,
@@ -963,10 +972,10 @@ function Ve(e, t) {
963
972
  height: n.maxY - n.minY
964
973
  };
965
974
  }
966
- function He(e) {
975
+ function Ue(e) {
967
976
  return `${Math.round(e.width)} x ${Math.round(e.height)} px`;
968
977
  }
969
- function Ue({ color: e, striped: t }) {
978
+ function We({ color: e, striped: t }) {
970
979
  return /* @__PURE__ */ b("span", { style: {
971
980
  display: "inline-block",
972
981
  width: 12,
@@ -978,20 +987,20 @@ function Ue({ color: e, striped: t }) {
978
987
  } : { background: e }
979
988
  } });
980
989
  }
981
- function We({ shapes: e, getLabel: t, formatInfo: n, register: r }) {
990
+ function Ge({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i }) {
982
991
  return /* @__PURE__ */ b(y, { children: e.map((e) => {
983
- let i = F(e.points), a = e.type === A.POINT, o = t?.(e), s = e.style?.color ?? "#00e5ff", c = !!e.readOnly || !!e.style?.dash, l = Ve(e, e.points), u = n ? n(l) : He(l);
992
+ let a = I(e.points), o = e.type === A.POINT, s = t?.(e), c = e.style?.color ?? "#00e5ff", l = !!e.readOnly || !!e.style?.dash, u = He(e, e.points), d = r ? r(u) : Ue(u);
984
993
  return /* @__PURE__ */ x("div", {
985
- ref: (t) => r(e.id, t),
994
+ ref: (t) => i(e.id, t),
986
995
  style: {
987
996
  position: "absolute",
988
- left: i.minX,
989
- top: i.minY,
990
- width: i.maxX - i.minX,
991
- height: i.maxY - i.minY,
997
+ left: a.minX,
998
+ top: a.minY,
999
+ width: a.maxX - a.minX,
1000
+ height: a.maxY - a.minY,
992
1001
  pointerEvents: "none"
993
1002
  },
994
- children: [!!o && /* @__PURE__ */ x("div", {
1003
+ children: [!!s && /* @__PURE__ */ x("div", {
995
1004
  style: {
996
1005
  position: "absolute",
997
1006
  left: 0,
@@ -999,43 +1008,43 @@ function We({ shapes: e, getLabel: t, formatInfo: n, register: r }) {
999
1008
  display: "flex",
1000
1009
  alignItems: "center",
1001
1010
  gap: 4,
1002
- transform: `scale(${Re}) translateY(calc(-100% - ${ze}px))`,
1011
+ transform: `scale(${ze}) translateY(calc(-100% - ${Be}px))`,
1003
1012
  transformOrigin: "left top",
1004
- ...Be
1013
+ ...Ve
1005
1014
  },
1006
- children: [/* @__PURE__ */ b(Ue, {
1007
- color: s,
1008
- striped: c
1009
- }), /* @__PURE__ */ b("span", { children: o })]
1010
- }), !a && !!u && /* @__PURE__ */ b("div", {
1015
+ children: [!n && /* @__PURE__ */ b(We, {
1016
+ color: c,
1017
+ striped: l
1018
+ }), /* @__PURE__ */ b("span", { children: s })]
1019
+ }), !o && !!d && /* @__PURE__ */ b("div", {
1011
1020
  "data-selinfo-dim": !0,
1012
1021
  style: {
1013
1022
  position: "absolute",
1014
1023
  right: 0,
1015
1024
  top: "100%",
1016
- transform: `scale(${Re}) translateY(${ze}px)`,
1025
+ transform: `scale(${ze}) translateY(${Be}px)`,
1017
1026
  transformOrigin: "right top",
1018
- ...Be
1027
+ ...Ve
1019
1028
  },
1020
- children: u
1029
+ children: d
1021
1030
  })]
1022
1031
  }, e.id);
1023
1032
  }) });
1024
1033
  }
1025
1034
  //#endregion
1026
1035
  //#region src/components/ShapeEditor/_model/cursors.ts
1027
- var Ge = new Set([
1028
- H.RECTANGLE,
1029
- H.ROTATED_RECTANGLE,
1030
- H.CIRCLE,
1031
- H.POLYGON,
1032
- H.PATH,
1033
- H.BRUSH,
1034
- H.POINT,
1035
- H.ASSISTANT_POLYGON,
1036
- H.ASSISTANT_RECT,
1037
- H.ASSISTANT_POINT
1038
- ]), Ke = {
1036
+ var Ke = new Set([
1037
+ U.RECTANGLE,
1038
+ U.ROTATED_RECTANGLE,
1039
+ U.CIRCLE,
1040
+ U.POLYGON,
1041
+ U.PATH,
1042
+ U.BRUSH,
1043
+ U.POINT,
1044
+ U.ASSISTANT_POLYGON,
1045
+ U.ASSISTANT_RECT,
1046
+ U.ASSISTANT_POINT
1047
+ ]), qe = {
1039
1048
  tl: -135,
1040
1049
  t: -90,
1041
1050
  tr: -45,
@@ -1044,21 +1053,21 @@ var Ge = new Set([
1044
1053
  b: 90,
1045
1054
  bl: 135,
1046
1055
  l: 180
1047
- }, qe = [
1056
+ }, Je = [
1048
1057
  "ew-resize",
1049
1058
  "nwse-resize",
1050
1059
  "ns-resize",
1051
1060
  "nesw-resize"
1052
1061
  ];
1053
- function Je(e, t = 0) {
1054
- let n = ((Ke[e] + t * 180 / Math.PI) % 180 + 180) % 180;
1055
- return qe[Math.round(n / 45) % 4];
1062
+ function Ye(e, t = 0) {
1063
+ let n = ((qe[e] + t * 180 / Math.PI) % 180 + 180) % 180;
1064
+ return Je[Math.round(n / 45) % 4];
1056
1065
  }
1057
- function Ye({ tool: e, externalToolCursor: t, isSpacePressed: n, isPolygonDrawing: r }) {
1058
- return n ? "grab" : t || (e === H.SELECT ? "default" : Ge.has(e) ? r ? "default" : "crosshair" : "default");
1066
+ function Xe({ tool: e, externalToolCursor: t, isSpacePressed: n, isPolygonDrawing: r }) {
1067
+ return n ? "grab" : t || (e === U.SELECT ? "default" : Ke.has(e) ? r ? "default" : "crosshair" : "default");
1059
1068
  }
1060
- function Xe({ tool: e, externalToolCursor: t, isSpacePressed: n, interactionMode: r, rendererCursorHint: i, isPolygonDrawing: a }) {
1061
- return r === "marquee" ? "default" : r === "moving" || r === "panning" || r === "vertexDragging" ? "grabbing" : r === "resizing" || r === "rotating" ? i ?? "grabbing" : r === "drawing" ? "crosshair" : n ? "grab" : t || (e === H.SELECT && i ? i : Ye({
1069
+ function Ze({ tool: e, externalToolCursor: t, isSpacePressed: n, interactionMode: r, rendererCursorHint: i, isPolygonDrawing: a }) {
1070
+ return r === "marquee" ? "default" : r === "moving" || r === "panning" || r === "vertexDragging" ? "grabbing" : r === "resizing" || r === "rotating" ? i ?? "grabbing" : r === "drawing" ? "crosshair" : n ? "grab" : t || (e === U.SELECT && i ? i : Xe({
1062
1071
  tool: e,
1063
1072
  externalToolCursor: t,
1064
1073
  isSpacePressed: n,
@@ -1067,7 +1076,7 @@ function Xe({ tool: e, externalToolCursor: t, isSpacePressed: n, interactionMode
1067
1076
  }
1068
1077
  //#endregion
1069
1078
  //#region src/components/ShapeEditor/_model/overlays.ts
1070
- var Ze = (e) => Math.min(255, Math.max(0, e)), q = (e) => {
1079
+ var Qe = (e) => Math.min(255, Math.max(0, e)), $e = (e) => {
1071
1080
  let t = e.replace("#", "").trim();
1072
1081
  if (![
1073
1082
  3,
@@ -1081,13 +1090,13 @@ var Ze = (e) => Math.min(255, Math.max(0, e)), q = (e) => {
1081
1090
  c(o),
1082
1091
  c(s)
1083
1092
  ];
1084
- return l.some((e) => Number.isNaN(e)) ? null : l.map(Ze);
1085
- }, Qe = (e, t) => {
1093
+ return l.some((e) => Number.isNaN(e)) ? null : l.map(Qe);
1094
+ }, et = (e, t) => {
1086
1095
  let { width: n, height: r, indices: i, transparent: a } = e;
1087
1096
  if (!n || !r || i.length < n * r) return null;
1088
1097
  let o = {};
1089
1098
  for (let [e, n] of Object.entries(t)) {
1090
- let t = q(n);
1099
+ let t = $e(n);
1091
1100
  t && (o[Number(e)] = t);
1092
1101
  }
1093
1102
  if (!Object.keys(o).length) return null;
@@ -1106,12 +1115,12 @@ var Ze = (e) => Math.min(255, Math.max(0, e)), q = (e) => {
1106
1115
  }
1107
1116
  return c.putImageData(new ImageData(l, n, r), 0, 0), s;
1108
1117
  };
1109
- function $e(e, t) {
1118
+ function q(e, t) {
1110
1119
  e.beginPath(), e.moveTo(t[0].x, t[0].y);
1111
1120
  for (let n = 1; n < t.length; n += 1) e.lineTo(t[n].x, t[n].y);
1112
1121
  e.closePath();
1113
1122
  }
1114
- var et = (e, t, n, r) => {
1123
+ var tt = (e, t, n, r) => {
1115
1124
  if (!n || !r || !e.length) return null;
1116
1125
  let i = document.createElement("canvas");
1117
1126
  i.width = n, i.height = r;
@@ -1122,17 +1131,17 @@ var et = (e, t, n, r) => {
1122
1131
  for (let t of e) a.clearRect(t.x, t.y, t.w, t.h);
1123
1132
  let s = t?.filter((e) => e.points.length >= 3) ?? [];
1124
1133
  a.fillStyle = o;
1125
- for (let e of s) $e(a, e.points), a.fill();
1134
+ for (let e of s) q(a, e.points), a.fill();
1126
1135
  return {
1127
1136
  dimCanvas: i,
1128
1137
  rects: e,
1129
1138
  zones: s
1130
1139
  };
1131
- }, tt = .3, J = .05;
1132
- function nt(e) {
1140
+ }, nt = .3, rt = .05;
1141
+ function J(e) {
1133
1142
  return 1 - (1 - e) ** 3;
1134
1143
  }
1135
- function rt(e) {
1144
+ function it(e) {
1136
1145
  return {
1137
1146
  x: e.minX,
1138
1147
  y: e.minY,
@@ -1140,7 +1149,7 @@ function rt(e) {
1140
1149
  height: Math.max(0, e.maxY - e.minY)
1141
1150
  };
1142
1151
  }
1143
- function it(e, t) {
1152
+ function at(e, t) {
1144
1153
  if (!t.length) return null;
1145
1154
  if (e === A.POINT) {
1146
1155
  let e = t[0];
@@ -1151,7 +1160,7 @@ function it(e, t) {
1151
1160
  height: 16
1152
1161
  };
1153
1162
  }
1154
- let n = F(t), r = Math.max(1, n.maxX - n.minX), i = Math.max(1, n.maxY - n.minY);
1163
+ let n = I(t), r = Math.max(1, n.maxX - n.minX), i = Math.max(1, n.maxY - n.minY);
1155
1164
  return {
1156
1165
  x: n.minX,
1157
1166
  y: n.minY,
@@ -1159,10 +1168,10 @@ function it(e, t) {
1159
1168
  height: i
1160
1169
  };
1161
1170
  }
1162
- function at(e) {
1171
+ function ot(e) {
1163
1172
  if (!e.length) return null;
1164
- let t = e.map((e) => it(e.type, e.points)).filter((e) => e !== null);
1165
- return t.length ? rt(F(t.flatMap((e) => [{
1173
+ let t = e.map((e) => at(e.type, e.points)).filter((e) => e !== null);
1174
+ return t.length ? it(I(t.flatMap((e) => [{
1166
1175
  x: e.x,
1167
1176
  y: e.y
1168
1177
  }, {
@@ -1170,8 +1179,8 @@ function at(e) {
1170
1179
  y: e.y + e.height
1171
1180
  }]))) : null;
1172
1181
  }
1173
- function Y(e, t, n, r = {}) {
1174
- let { containerRatio: i = tt, minScale: a = J, maxScale: o = 20 } = r;
1182
+ function st(e, t, n, r = {}) {
1183
+ let { containerRatio: i = nt, minScale: a = rt, maxScale: o = 20 } = r;
1175
1184
  if (!t || !n || e.width <= 0 || e.height <= 0) return null;
1176
1185
  let s = Math.min(t * i / e.width, n * i / e.height), c = Math.max(a, Math.min(o, s)), l = e.x + e.width / 2, u = e.y + e.height / 2;
1177
1186
  return {
@@ -1180,18 +1189,18 @@ function Y(e, t, n, r = {}) {
1180
1189
  y: n / 2 - u * c
1181
1190
  };
1182
1191
  }
1183
- function ot(e, t, n, r = 80) {
1192
+ function Y(e, t, n, r = 80) {
1184
1193
  if (!t || !n) return null;
1185
- let i = Math.max(1, e.maxX - e.minX), a = Math.max(1, e.maxY - e.minY), o = Math.max(J, Math.min(20, Math.min((t - r) / i, (n - r) / a))), s = (e.minX + e.maxX) / 2, c = (e.minY + e.maxY) / 2;
1194
+ let i = Math.max(1, e.maxX - e.minX), a = Math.max(1, e.maxY - e.minY), o = Math.max(rt, Math.min(20, Math.min((t - r) / i, (n - r) / a))), s = (e.minX + e.maxX) / 2, c = (e.minY + e.maxY) / 2;
1186
1195
  return {
1187
1196
  scale: o,
1188
1197
  x: t / 2 - s * o,
1189
1198
  y: n / 2 - c * o
1190
1199
  };
1191
1200
  }
1192
- function st(e, t, n, r = 300) {
1201
+ function ct(e, t, n, r = 300) {
1193
1202
  let i = Date.now(), a = 0, o = () => {
1194
- let s = Date.now() - i, c = Math.min(s / r, 1), l = nt(c);
1203
+ let s = Date.now() - i, c = Math.min(s / r, 1), l = J(c);
1195
1204
  n({
1196
1205
  scale: e.scale + (t.scale - e.scale) * l,
1197
1206
  x: e.x + (t.x - e.x) * l,
@@ -1202,8 +1211,8 @@ function st(e, t, n, r = 300) {
1202
1211
  }
1203
1212
  //#endregion
1204
1213
  //#region src/components/ShapeEditor/_state/createInteractionController.ts
1205
- function ct(e) {
1206
- let { engineRef: t, toolRef: n, externalToolMapRef: r, spaceRef: i, shiftRef: a, docRef: o, selRef: s, draftRef: c, readOnlyRef: l, lockedRef: u, onLockedInteraction: d, createRef: f, selectRef: p, enterEditRef: m, drawSessionRef: h, assistantRef: g, setCursorHint: _, setInteractionMode: v, syncMinimap: y, onTransformPreview: b, onDrawPreview: x } = e, S = () => h.current, C = () => g.current, w = null, T = null, E = null, D = null, O = null, k = "", ee = null, te = (e) => e === H.RECTANGLE || e === H.ROTATED_RECTANGLE || e === H.CIRCLE, ne = (e) => e === H.ASSISTANT_POLYGON || e === H.ASSISTANT_RECT, N = (e) => e === H.POLYGON, P = () => r.current.get(n.current), I = (e, t, n, r) => ({
1214
+ function lt(e) {
1215
+ let { engineRef: t, toolRef: n, externalToolMapRef: r, spaceRef: i, shiftRef: a, docRef: o, selRef: s, draftRef: c, readOnlyRef: l, disableMarqueeRef: u, lockedRef: d, onLockedInteraction: f, createRef: p, selectRef: m, enterEditRef: h, drawSessionRef: g, assistantRef: _, setCursorHint: v, setInteractionMode: y, syncMinimap: b, onTransformPreview: x, onDrawPreview: S } = e, C = () => g.current, w = () => _.current, T = null, E = null, D = null, O = null, k = null, ee = "", te = null, M = (e) => e === U.RECTANGLE || e === U.ROTATED_RECTANGLE || e === U.CIRCLE, P = (e) => e === U.ASSISTANT_POLYGON || e === U.ASSISTANT_RECT, F = (e) => e === U.POLYGON, L = () => r.current.get(n.current), R = (e, t, n, r) => ({
1207
1216
  point: t,
1208
1217
  targetId: r,
1209
1218
  event: n,
@@ -1211,62 +1220,62 @@ function ct(e) {
1211
1220
  viewport: e.viewport
1212
1221
  });
1213
1222
  return {
1214
- onCursorHint: _,
1215
- onInteractionModeChange: v,
1216
- onPointerDown: (e, r, f) => {
1217
- let h = t.current;
1218
- if (!h) return;
1223
+ onCursorHint: v,
1224
+ onInteractionModeChange: y,
1225
+ onPointerDown: (e, r, u) => {
1226
+ let p = t.current;
1227
+ if (!p) return;
1219
1228
  let g = n.current;
1220
- if (f.button === 1 || i.current) {
1221
- v("panning"), _(null), w = {
1222
- x: h.viewport.x,
1223
- y: h.viewport.y,
1224
- px: f.global.x,
1225
- py: f.global.y
1229
+ if (u.button === 1 || i.current) {
1230
+ y("panning"), v(null), T = {
1231
+ x: p.viewport.x,
1232
+ y: p.viewport.y,
1233
+ px: u.global.x,
1234
+ py: u.global.y
1226
1235
  };
1227
1236
  return;
1228
1237
  }
1229
- if (f.button === 2 && !(g === H.ASSISTANT_POINT && f.altKey)) return;
1230
- let y = P();
1231
- if (y) {
1232
- S().reset(), p.current([]), y.onPointerDown?.(I(h, e, f, r));
1238
+ if (u.button === 2 && !(g === U.ASSISTANT_POINT && u.altKey)) return;
1239
+ let _ = L();
1240
+ if (_) {
1241
+ C().reset(), m.current([]), _.onPointerDown?.(R(p, e, u, r));
1233
1242
  return;
1234
1243
  }
1235
- if (u.current) {
1236
- d();
1244
+ if (d.current) {
1245
+ f();
1237
1246
  return;
1238
1247
  }
1239
- if (g === H.ASSISTANT_POINT) {
1240
- f.altKey ? C().addPoint(e, f.button !== 2) : C().newPolygon(e);
1248
+ if (g === U.ASSISTANT_POINT) {
1249
+ u.altKey ? w().addPoint(e, u.button !== 2) : w().newPolygon(e);
1241
1250
  return;
1242
1251
  }
1243
- if (ne(g) && c.current) {
1244
- T = e, v("drawing");
1252
+ if (P(g) && c.current) {
1253
+ E = e, y("drawing");
1245
1254
  return;
1246
1255
  }
1247
- if (g === H.SELECT && f.altKey) {
1248
- let t = re(o.current.getShapes()).filter((t) => {
1256
+ if (g === U.SELECT && u.altKey) {
1257
+ let t = ne(o.current.getShapes()).filter((t) => {
1249
1258
  if (!j(t)) return !1;
1250
- let n = F(t.points);
1259
+ let n = I(t.points);
1251
1260
  return e.x >= n.minX && e.x <= n.maxX && e.y >= n.minY && e.y <= n.maxY;
1252
1261
  });
1253
1262
  if (t.length) {
1254
1263
  let e = [...t].reverse(), n = [e[(e.findIndex((e) => s.current.includes(e.id)) + 1) % e.length].id];
1255
- p.current(n);
1264
+ m.current(n);
1256
1265
  return;
1257
1266
  }
1258
1267
  }
1259
- if (r && g === H.SELECT) {
1268
+ if (r && g === U.SELECT) {
1260
1269
  let t = o.current.getShapes().find((e) => e.id === r);
1261
1270
  if (!t || !j(t)) return;
1262
- let n = typeof performance < "u" ? performance.now() : 0, i = !!ee && ee.id === r && n - ee.t < 300;
1263
- ee = {
1271
+ let n = typeof performance < "u" ? performance.now() : 0, i = !!te && te.id === r && n - te.t < 300;
1272
+ te = {
1264
1273
  id: r,
1265
1274
  t: n
1266
1275
  };
1267
1276
  let c = (t.type === A.POLYGON || t.type === A.LINE) && !l.current && t.interaction?.editable !== !1 && !t.readOnly;
1268
1277
  if (i && c) {
1269
- p.current([r]), m.current(r);
1278
+ m.current([r]), h.current(r);
1270
1279
  return;
1271
1280
  }
1272
1281
  let u = s.current;
@@ -1274,154 +1283,155 @@ function ct(e) {
1274
1283
  let e = new Set(u);
1275
1284
  e.has(r) ? e.delete(r) : e.add(r), u = [...e];
1276
1285
  } else u.includes(r) || (u = [r]);
1277
- p.current(u), !l.current && M(t) && h.beginMove(e, u);
1286
+ m.current(u), !l.current && N(t) && p.beginMove(e, u);
1278
1287
  return;
1279
1288
  }
1280
- if (te(g) && c.current) {
1281
- T = e, v("drawing");
1289
+ if (M(g) && c.current) {
1290
+ E = e, y("drawing");
1282
1291
  return;
1283
1292
  }
1284
- if (N(g) && c.current) {
1285
- if (!S().getDraftPointsSnapshot().length && s.current.length && p.current([]), S().tryClosePolygon(e, 12 / h.viewport.scale)) return;
1286
- let t = S().hitDraftPoint(e);
1293
+ if (F(g) && c.current) {
1294
+ if (!C().getDraftPointsSnapshot().length && s.current.length && m.current([]), C().tryClosePolygon(e, 12 / p.viewport.scale)) return;
1295
+ let t = C().hitDraftPoint(e);
1287
1296
  if (t >= 0) {
1288
- if (f.altKey) {
1289
- S().removeDraftPoint(t);
1297
+ if (u.altKey) {
1298
+ C().removeDraftPoint(t);
1290
1299
  return;
1291
1300
  }
1292
- let n = S().selectDraftPointForDrag(t, f.shiftKey || f.ctrlKey || f.metaKey);
1301
+ let n = C().selectDraftPointForDrag(t, u.shiftKey || u.ctrlKey || u.metaKey);
1293
1302
  if (!n) return;
1294
- D = {
1303
+ O = {
1295
1304
  start: e,
1296
1305
  base: n.base,
1297
1306
  indices: n.indices,
1298
1307
  moved: !1
1299
- }, v("vertexDragging");
1308
+ }, y("vertexDragging");
1300
1309
  return;
1301
1310
  }
1302
- S().appendPolygonPoint(e);
1311
+ C().appendPolygonPoint(e);
1303
1312
  return;
1304
1313
  }
1305
- if (g === H.PATH && c.current) {
1306
- s.current.length && p.current([]), E = "path", v("drawing"), S().beginStroke(e);
1314
+ if (g === U.PATH && c.current) {
1315
+ s.current.length && m.current([]), D = "path", y("drawing"), C().beginStroke(e);
1307
1316
  return;
1308
1317
  }
1309
- if (g === H.BRUSH && c.current && !l.current) {
1310
- E = "scalar", v("drawing"), S().beginStroke(e);
1318
+ if (g === U.BRUSH && c.current && !l.current) {
1319
+ D = "scalar", y("drawing"), C().beginStroke(e);
1311
1320
  return;
1312
1321
  }
1313
- if (g === H.SELECT) {
1322
+ if (g === U.SELECT) {
1314
1323
  if (!a.current && !l.current && s.current.length >= 2) {
1315
- let t = o.current.getShapes().filter((e) => s.current.includes(e.id) && M(e));
1324
+ let t = o.current.getShapes().filter((e) => s.current.includes(e.id) && N(e));
1316
1325
  if (t.length) {
1317
- let n = F(t.flatMap((e) => e.points));
1326
+ let n = I(t.flatMap((e) => e.points));
1318
1327
  if (e.x >= n.minX && e.x <= n.maxX && e.y >= n.minY && e.y <= n.maxY) {
1319
- h.beginMove(e, s.current);
1328
+ p.beginMove(e, s.current);
1320
1329
  return;
1321
1330
  }
1322
1331
  }
1323
1332
  }
1324
- O = e, k = "", v("marquee"), _(null);
1333
+ k = e, ee = "", y("marquee"), v(null);
1325
1334
  }
1326
1335
  },
1327
1336
  onPointerMove: (e, r) => {
1328
1337
  let i = t.current;
1329
1338
  if (!i) return;
1330
- if (w) {
1339
+ if (T) {
1331
1340
  i.applyViewport({
1332
1341
  scale: i.viewport.scale,
1333
- x: w.x + (r.global.x - w.px),
1334
- y: w.y + (r.global.y - w.py)
1342
+ x: T.x + (r.global.x - T.px),
1343
+ y: T.y + (r.global.y - T.py)
1335
1344
  });
1336
1345
  return;
1337
1346
  }
1338
- let o = n.current, s = P();
1347
+ let o = n.current, s = L();
1339
1348
  if (s) {
1340
- s.onPointerMove?.(I(i, e, r));
1349
+ s.onPointerMove?.(R(i, e, r));
1341
1350
  return;
1342
1351
  }
1343
- if (D) {
1344
- let t = e.x - D.start.x, n = e.y - D.start.y;
1345
- D.moved = D.moved || Math.hypot(t, n) > .5, S().moveDraftPoints(D.base, D.indices, t, n);
1352
+ if (O) {
1353
+ let t = e.x - O.start.x, n = e.y - O.start.y;
1354
+ O.moved = O.moved || Math.hypot(t, n) > .5, C().moveDraftPoints(O.base, O.indices, t, n);
1346
1355
  return;
1347
1356
  }
1348
- if (T && (te(o) || ne(o))) {
1349
- let t = a.current ? R(T, e) : e, n = c.current?.color ?? "#00e5ff";
1350
- i.previewBox(o === H.CIRCLE ? "ellipse" : "rect", T, t, n), te(o) && x({
1351
- type: o === H.CIRCLE ? A.ELLIPSE : A.RECTANGLE,
1352
- points: [T, t]
1357
+ if (E && (M(o) || P(o))) {
1358
+ let t = a.current ? z(E, e) : e, n = c.current?.color ?? "#00e5ff";
1359
+ i.previewBox(o === U.CIRCLE ? "ellipse" : "rect", E, t, n), M(o) && S({
1360
+ type: o === U.CIRCLE ? A.ELLIPSE : A.RECTANGLE,
1361
+ points: [E, t]
1353
1362
  });
1354
1363
  return;
1355
1364
  }
1356
- if (E) {
1357
- S().appendStrokePoint(e, 2 / i.viewport.scale);
1365
+ if (D) {
1366
+ C().appendStrokePoint(e, 2 / i.viewport.scale);
1358
1367
  return;
1359
1368
  }
1360
- if (N(o) && S().hasDraftPoints()) {
1361
- S().setDraftCursor(e);
1369
+ if (F(o) && C().hasDraftPoints()) {
1370
+ C().setDraftCursor(e);
1362
1371
  return;
1363
1372
  }
1364
- if (O) {
1373
+ if (k) {
1374
+ if (u?.current) return;
1365
1375
  let t = {
1366
- minX: Math.min(O.x, e.x),
1367
- minY: Math.min(O.y, e.y),
1368
- maxX: Math.max(O.x, e.x),
1369
- maxY: Math.max(O.y, e.y)
1376
+ minX: Math.min(k.x, e.x),
1377
+ minY: Math.min(k.y, e.y),
1378
+ maxX: Math.max(k.x, e.x),
1379
+ maxY: Math.max(k.y, e.y)
1370
1380
  };
1371
- i.previewMarquee(O, e);
1381
+ i.previewMarquee(k, e);
1372
1382
  let n = i.shapesIntersecting(t), r = n.join(",");
1373
- r !== k && (k = r, p.current(n));
1383
+ r !== ee && (ee = r, m.current(n));
1374
1384
  }
1375
1385
  },
1376
1386
  onPointerUp: (e) => {
1377
1387
  let r = t.current;
1378
1388
  if (!r) return;
1379
- if (w) {
1380
- w = null, v("idle");
1389
+ if (T) {
1390
+ T = null, y("idle");
1381
1391
  return;
1382
1392
  }
1383
- if (D) {
1384
- S().commitDraftPointDrag(D.moved), D = null, v("idle");
1393
+ if (O) {
1394
+ C().commitDraftPointDrag(O.moved), O = null, y("idle");
1385
1395
  return;
1386
1396
  }
1387
- let i = n.current, o = P();
1397
+ let i = n.current, o = L();
1388
1398
  if (o) {
1389
- o.onPointerUp?.(I(r, e, {}));
1399
+ o.onPointerUp?.(R(r, e, {}));
1390
1400
  return;
1391
1401
  }
1392
- if (i === H.POINT && c.current) {
1393
- f.current(A.POINT, [e]);
1402
+ if (i === U.POINT && c.current) {
1403
+ p.current(A.POINT, [e]);
1394
1404
  return;
1395
1405
  }
1396
- if (E) {
1397
- let e = E;
1398
- E = null, v("idle"), e === "path" ? S().completeFreehandStroke() : S().finishScalarStroke();
1406
+ if (D) {
1407
+ let e = D;
1408
+ D = null, y("idle"), e === "path" ? C().completeFreehandStroke() : C().finishScalarStroke();
1399
1409
  return;
1400
1410
  }
1401
- if (T && ne(i)) {
1402
- let t = T;
1403
- T = null, v("idle"), r.clearPreview();
1411
+ if (E && P(i)) {
1412
+ let t = E;
1413
+ E = null, y("idle"), r.clearPreview();
1404
1414
  let n = {
1405
1415
  x: Math.min(t.x, e.x),
1406
1416
  y: Math.min(t.y, e.y),
1407
1417
  width: Math.abs(e.x - t.x),
1408
1418
  height: Math.abs(e.y - t.y)
1409
1419
  };
1410
- n.width > 2 && n.height > 2 && C().beginBox(n, i === H.ASSISTANT_RECT ? "rect" : "polygon");
1420
+ n.width > 2 && n.height > 2 && w().beginBox(n, i === U.ASSISTANT_RECT ? "rect" : "polygon");
1411
1421
  return;
1412
1422
  }
1413
- if (T && te(i)) {
1414
- let t = a.current ? R(T, e) : e, n = T;
1415
- T = null, v("idle"), r.clearPreview(), x(null), Math.abs(t.x - n.x) > 2 && Math.abs(t.y - n.y) > 2 && (i === H.ROTATED_RECTANGLE ? f.current(A.ROTATED_RECTANGLE, z([n, t])) : i === H.CIRCLE ? f.current(A.POLYGON, B(n, t)) : f.current(A.RECTANGLE, [n, t]));
1423
+ if (E && M(i)) {
1424
+ let t = a.current ? z(E, e) : e, n = E;
1425
+ E = null, y("idle"), r.clearPreview(), S(null), Math.abs(t.x - n.x) > 2 && Math.abs(t.y - n.y) > 2 && (i === U.ROTATED_RECTANGLE ? p.current(A.ROTATED_RECTANGLE, B([n, t])) : i === U.CIRCLE ? p.current(A.POLYGON, V(n, t)) : p.current(A.RECTANGLE, [n, t]));
1416
1426
  return;
1417
1427
  }
1418
- if (O) {
1419
- let t = Math.abs(e.x - O.x) > 3 || Math.abs(e.y - O.y) > 3;
1420
- O = null, r.clearMarquee(), v("idle"), !t && s.current.length && p.current([]);
1428
+ if (k) {
1429
+ let t = Math.abs(e.x - k.x) > 3 || Math.abs(e.y - k.y) > 3;
1430
+ k = null, r.clearMarquee(), y("idle"), !t && s.current.length && m.current([]);
1421
1431
  }
1422
1432
  },
1423
- onViewportChange: y,
1424
- onTransformPreview: b,
1433
+ onViewportChange: b,
1434
+ onTransformPreview: x,
1425
1435
  onTransformCommit: (e) => {
1426
1436
  let t = o.current.getShapes(), n = e.map((e) => {
1427
1437
  let n = t.find((t) => t.id === e.id);
@@ -1436,7 +1446,7 @@ function ct(e) {
1436
1446
  }
1437
1447
  //#endregion
1438
1448
  //#region src/components/ShapeEditor/_state/useAssistant.ts
1439
- function lt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistantRef: i }) {
1449
+ function ut({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistantRef: i }) {
1440
1450
  let [a, o] = v("idle"), [s, c] = v([]), [l, u] = v([]), f = _([]), p = _([]), m = _([]), h = _("idle"), g = _(0), y = _(null), b = _(null), x = _(0), S = d((e) => {
1441
1451
  f.current = e(f.current), u(f.current);
1442
1452
  }, []), C = d((e) => {
@@ -1445,16 +1455,16 @@ function lt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1445
1455
  let a = i.current?.rectResult === "rotatedRect";
1446
1456
  return e.map((e) => {
1447
1457
  if (t === "rect" && a) return {
1448
- id: N(),
1458
+ id: P(),
1449
1459
  type: A.ROTATED_RECTANGLE,
1450
- points: oe(e),
1460
+ points: ae(e),
1451
1461
  style: r,
1452
1462
  meta: n
1453
1463
  };
1454
1464
  if (t === "rect") {
1455
- let t = F(e);
1465
+ let t = I(e);
1456
1466
  return {
1457
- id: N(),
1467
+ id: P(),
1458
1468
  type: A.RECTANGLE,
1459
1469
  points: [{
1460
1470
  x: t.minX,
@@ -1468,7 +1478,7 @@ function lt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1468
1478
  };
1469
1479
  }
1470
1480
  return {
1471
- id: N(),
1481
+ id: P(),
1472
1482
  type: A.POLYGON,
1473
1483
  points: e,
1474
1484
  style: r,
@@ -1601,17 +1611,17 @@ function lt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
1601
1611
  }
1602
1612
  //#endregion
1603
1613
  //#region src/components/ShapeEditor/_model/brush.ts
1604
- function X(e, t, n) {
1614
+ function dt(e, t, n) {
1605
1615
  let r = Math.abs(.5 * (t.x * n.y + n.x * e.y + e.x * t.y - n.x * t.y - e.x * n.y - t.x * e.y)), i = Math.hypot(t.x - n.x, t.y - n.y);
1606
1616
  return i === 0 ? 0 : r * 2 / i;
1607
1617
  }
1608
- function ut(e, t = 1.5) {
1618
+ function X(e, t = 1.5) {
1609
1619
  if (e.length <= 2) return e;
1610
1620
  let n = (e, t) => {
1611
1621
  if (e.length < 3) return e;
1612
1622
  let r = 0, i = 0, a = e.length - 1;
1613
1623
  for (let t = 1; t < a; t++) {
1614
- let n = X(e[t], e[0], e[a]);
1624
+ let n = dt(e[t], e[0], e[a]);
1615
1625
  n > r && (i = t, r = n);
1616
1626
  }
1617
1627
  if (r > t) {
@@ -1624,8 +1634,8 @@ function ut(e, t = 1.5) {
1624
1634
  }
1625
1635
  //#endregion
1626
1636
  //#region src/components/ShapeEditor/_model/scalarMask.ts
1627
- var dt = 4096, ft = 4;
1628
- function pt(e) {
1637
+ var ft = 4096, pt = 4;
1638
+ function mt(e) {
1629
1639
  let t = 0;
1630
1640
  for (let n = 0; n < e.length; n++) {
1631
1641
  let r = e[n], i = e[(n + 1) % e.length];
@@ -1633,17 +1643,17 @@ function pt(e) {
1633
1643
  }
1634
1644
  return Math.abs(t / 2);
1635
1645
  }
1636
- function mt(e, t, n) {
1646
+ function ht(e, t, n) {
1637
1647
  let r = new Uint8Array(t * n);
1638
1648
  for (let i = 0; i < t * n; i++) r[i] = e[i * 4 + 3] > 128 ? 255 : 0;
1639
1649
  return r;
1640
1650
  }
1641
- function ht(e) {
1651
+ function gt(e) {
1642
1652
  let t = new Uint8ClampedArray(e.length * 4);
1643
1653
  for (let n = 0; n < e.length; n++) e[n] > 128 && (t[n * 4 + 3] = 255);
1644
1654
  return t;
1645
1655
  }
1646
- function gt(e, t, n, r, i) {
1656
+ function _t(e, t, n, r, i) {
1647
1657
  let a = new Uint8Array(t * n), o = [[r, i]];
1648
1658
  for (; o.length;) {
1649
1659
  let [r, i] = o.pop(), s = i * t + r;
@@ -1651,8 +1661,8 @@ function gt(e, t, n, r, i) {
1651
1661
  }
1652
1662
  return a;
1653
1663
  }
1654
- function _t(e, t, n) {
1655
- let r = mt(e, t, n), i = [];
1664
+ function vt(e, t, n) {
1665
+ let r = ht(e, t, n), i = [];
1656
1666
  for (;;) {
1657
1667
  let e = -1, a = -1;
1658
1668
  outer: for (let i = 0; i < n; i++) for (let n = 0; n < t; n++) if (r[i * t + n] > 128) {
@@ -1660,17 +1670,17 @@ function _t(e, t, n) {
1660
1670
  break outer;
1661
1671
  }
1662
1672
  if (e < 0) break;
1663
- let o = yt(ht(gt(r, t, n, e, a)), t, n);
1673
+ let o = bt(gt(_t(r, t, n, e, a)), t, n);
1664
1674
  o.length >= 3 && i.push(o);
1665
1675
  }
1666
1676
  return i;
1667
1677
  }
1668
- function vt(e, t, n, r, i) {
1678
+ function yt(e, t, n, r, i) {
1669
1679
  return r < 0 || i < 0 || r >= t || i >= n ? !1 : e[(i * t + r) * 4 + 3] > 128;
1670
1680
  }
1671
- function yt(e, t, n) {
1681
+ function bt(e, t, n) {
1672
1682
  let r = -1, i = -1;
1673
- outer: for (let a = 0; a < n; a++) for (let o = 0; o < t; o++) if (vt(e, t, n, o, a)) {
1683
+ outer: for (let a = 0; a < n; a++) for (let o = 0; o < t; o++) if (yt(e, t, n, o, a)) {
1674
1684
  r = o, i = a;
1675
1685
  break outer;
1676
1686
  }
@@ -1705,7 +1715,7 @@ function yt(e, t, n) {
1705
1715
  let r = !1;
1706
1716
  for (let i = 0; i < 8; i++) {
1707
1717
  let s = (u + i) % 8, d = c + a[s], f = l + o[s];
1708
- if (vt(e, t, n, d, f)) {
1718
+ if (yt(e, t, n, d, f)) {
1709
1719
  c = d, l = f, u = (s + 6) % 8, r = !0;
1710
1720
  break;
1711
1721
  }
@@ -1714,21 +1724,21 @@ function yt(e, t, n) {
1714
1724
  } while (c !== d.x || l !== d.y || s.length === 1);
1715
1725
  return s;
1716
1726
  }
1717
- function bt(e, t) {
1727
+ function xt(e, t) {
1718
1728
  let n = [];
1719
1729
  for (let t of e) for (let e of t.points) n.push(e);
1720
1730
  for (let e of t) for (let t of e) n.push(t);
1721
1731
  return n;
1722
1732
  }
1723
- function xt(e) {
1733
+ function St(e) {
1724
1734
  switch (e.type) {
1725
- case A.RECTANGLE: return e.points.length < 2 ? null : z(e.points);
1735
+ case A.RECTANGLE: return e.points.length < 2 ? null : B(e.points);
1726
1736
  case A.POLYGON:
1727
1737
  case A.ROTATED_RECTANGLE:
1728
1738
  case A.ELLIPSE: return e.points.length >= 3 ? e.points : null;
1729
1739
  case A.POINT: {
1730
1740
  let t = e.points[0];
1731
- return t ? B({
1741
+ return t ? V({
1732
1742
  x: t.x - 6,
1733
1743
  y: t.y - 6
1734
1744
  }, {
@@ -1739,14 +1749,14 @@ function xt(e) {
1739
1749
  default: return null;
1740
1750
  }
1741
1751
  }
1742
- function St(e) {
1743
- return e.map(xt).filter((e) => !!e && e.length >= 3);
1752
+ function Ct(e) {
1753
+ return e.map(St).filter((e) => !!e && e.length >= 3);
1744
1754
  }
1745
- function Ct(e, t, n = []) {
1755
+ function wt(e, t, n = []) {
1746
1756
  if (t <= 0 || !e.length && !n.length) return null;
1747
- let r = bt(e, n);
1757
+ let r = xt(e, n);
1748
1758
  if (!r.length) return null;
1749
- let i = t + 4, a = F(r), o = Math.ceil(a.maxX - a.minX + i * 2), s = Math.ceil(a.maxY - a.minY + i * 2), c = Math.min(1, dt / Math.max(o, s, 1));
1759
+ let i = t + 4, a = I(r), o = Math.ceil(a.maxX - a.minX + i * 2), s = Math.ceil(a.maxY - a.minY + i * 2), c = Math.min(1, ft / Math.max(o, s, 1));
1750
1760
  o = Math.max(1, Math.ceil(o * c)), s = Math.max(1, Math.ceil(s * c));
1751
1761
  let l = a.minX - i, u = a.minY - i, d = (e) => ({
1752
1762
  x: (e.x - l) * c,
@@ -1785,20 +1795,20 @@ function Ct(e, t, n = []) {
1785
1795
  scale: c
1786
1796
  };
1787
1797
  }
1788
- function Z(e, t = 1.5) {
1789
- let { canvas: n, ox: r, oy: i, scale: a } = e, o = _t(n.getContext("2d").getImageData(0, 0, n.width, n.height).data, n.width, n.height);
1798
+ function Tt(e, t = 1.5) {
1799
+ let { canvas: n, ox: r, oy: i, scale: a } = e, o = vt(n.getContext("2d").getImageData(0, 0, n.width, n.height).data, n.width, n.height);
1790
1800
  if (!o.length) return [];
1791
1801
  let s = (e) => ({
1792
1802
  x: e.x / a + r,
1793
1803
  y: e.y / a + i
1794
1804
  }), c = [];
1795
1805
  for (let e of o) {
1796
- let n = e.map(s), r = ut(n, t), i = r.length >= 3 ? r : n;
1797
- i.length >= 3 && pt(i) >= ft && c.push(i);
1806
+ let n = e.map(s), r = X(n, t), i = r.length >= 3 ? r : n;
1807
+ i.length >= 3 && mt(i) >= pt && c.push(i);
1798
1808
  }
1799
1809
  return c;
1800
1810
  }
1801
- function wt(e, t) {
1811
+ function Z(e, t) {
1802
1812
  let { canvas: n } = e, r = document.createElement("canvas");
1803
1813
  r.width = n.width, r.height = n.height;
1804
1814
  let i = r.getContext("2d");
@@ -1806,58 +1816,58 @@ function wt(e, t) {
1806
1816
  }
1807
1817
  //#endregion
1808
1818
  //#region src/components/ShapeEditor/_state/drawSessionState.ts
1809
- function Tt(e) {
1819
+ function Et(e) {
1810
1820
  return e.map((e) => ({
1811
1821
  mode: e.mode,
1812
1822
  points: e.points.map((e) => ({ ...e }))
1813
1823
  }));
1814
1824
  }
1815
- function Et(e, t) {
1825
+ function Dt(e, t) {
1816
1826
  return e.length === t.length && e.every((e, n) => e.mode === t[n].mode && e.points.length === t[n].points.length && e.points.every((e, r) => e.x === t[n].points[r].x && e.y === t[n].points[r].y));
1817
1827
  }
1818
- function Dt(e) {
1828
+ function Ot(e) {
1819
1829
  return e.map((e) => ({ ...e }));
1820
1830
  }
1821
- function Ot(e, t) {
1831
+ function kt(e, t) {
1822
1832
  return e.length === t.length && e.every((e, n) => e.x === t[n].x && e.y === t[n].y);
1823
1833
  }
1824
1834
  //#endregion
1825
1835
  //#region src/components/ShapeEditor/_state/useDrawSession.ts
1826
- var kt = 10;
1827
- function At({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, brushSizeRef: a, simplifyEpsilonRef: o, draftMeta: s, engineRef: c, onDrawSessionChange: l, changeSelection: u, createShape: f }) {
1836
+ var At = 10;
1837
+ function jt({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, brushSizeRef: a, simplifyEpsilonRef: o, draftMeta: s, engineRef: c, onDrawSessionChange: l, changeSelection: u, createShape: f }) {
1828
1838
  let p = _(l);
1829
1839
  p.current = l;
1830
1840
  let m = _(f);
1831
1841
  m.current = f;
1832
- let h = _([]), g = _(null), v = _(/* @__PURE__ */ new Set()), y = _([[]]), b = _(0), x = _([]), S = _([]), C = _([]), w = _([[]]), T = _(0), E = _("draw"), D = () => E.current === "erase" ? "erase" : "add", O = () => C.current.length > 0 || x.current.length > 0 || e.current === H.BRUSH && h.current.length > 0, k = () => {
1842
+ let h = _([]), g = _(null), v = _(/* @__PURE__ */ new Set()), y = _([[]]), b = _(0), x = _([]), S = _([]), C = _([]), w = _([[]]), T = _(0), E = _("draw"), D = () => E.current === "erase" ? "erase" : "add", O = () => C.current.length > 0 || x.current.length > 0 || e.current === U.BRUSH && h.current.length > 0, k = () => {
1833
1843
  let t = e.current;
1834
- return t === H.BRUSH && O() ? "brush" : t === H.POLYGON && h.current.length > 0 ? "polygon" : t === H.PATH && h.current.length > 0 ? "path" : "none";
1835
- }, ee = () => h.current.length > 0 || T.current > 0, te = () => h.current.length === 0 && T.current < w.current.length - 1, j = () => b.current > 0, M = () => b.current < y.current.length - 1, re = () => {
1844
+ return t === U.BRUSH && O() ? "brush" : t === U.POLYGON && h.current.length > 0 ? "polygon" : t === U.PATH && h.current.length > 0 ? "path" : "none";
1845
+ }, ee = () => h.current.length > 0 || T.current > 0, te = () => h.current.length === 0 && T.current < w.current.length - 1, j = () => b.current > 0, N = () => b.current < y.current.length - 1, ne = () => {
1836
1846
  let t = e.current;
1837
- return t === H.BRUSH ? ee() : t === H.POLYGON || t === H.PATH ? j() : !1;
1838
- }, P = () => {
1847
+ return t === U.BRUSH ? ee() : t === U.POLYGON || t === U.PATH ? j() : !1;
1848
+ }, F = () => {
1839
1849
  let t = e.current;
1840
- return t === H.BRUSH ? te() : t === H.POLYGON || t === H.PATH ? M() : !1;
1841
- }, F = () => k() !== "none", I = d(() => {
1850
+ return t === U.BRUSH ? te() : t === U.POLYGON || t === U.PATH ? N() : !1;
1851
+ }, I = () => k() !== "none", L = d(() => {
1842
1852
  let e = k();
1843
1853
  p.current?.({
1844
1854
  active: e !== "none",
1845
1855
  kind: e,
1846
- canUndo: re(),
1847
- canRedo: P(),
1856
+ canUndo: ne(),
1857
+ canRedo: F(),
1848
1858
  brush: e === "brush" ? {
1849
1859
  mode: E.current,
1850
1860
  editing: C.current.length > 0,
1851
1861
  editTargetIds: [...C.current]
1852
1862
  } : void 0
1853
1863
  });
1854
- }, []), L = d(() => {
1855
- w.current = [[]], T.current = 0;
1856
1864
  }, []), R = d(() => {
1865
+ w.current = [[]], T.current = 0;
1866
+ }, []), z = d(() => {
1857
1867
  let t = c.current;
1858
1868
  if (!t) return;
1859
1869
  let n = e.current;
1860
- if (n === H.BRUSH) {
1870
+ if (n === U.BRUSH) {
1861
1871
  let e = [...x.current];
1862
1872
  if (h.current.length && e.push({
1863
1873
  points: h.current,
@@ -1866,7 +1876,7 @@ function At({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
1866
1876
  t.clearPreview();
1867
1877
  return;
1868
1878
  }
1869
- let n = Ct(e, a.current, S.current);
1879
+ let n = wt(e, a.current, S.current);
1870
1880
  if (!n) {
1871
1881
  t.clearPreview();
1872
1882
  return;
@@ -1880,104 +1890,104 @@ function At({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
1880
1890
  t.clearPreview();
1881
1891
  return;
1882
1892
  }
1883
- let o = i.current?.color ?? "#00e5ff", s = Array.from(v.current), l = n !== H.PATH;
1893
+ let o = i.current?.color ?? "#00e5ff", s = Array.from(v.current), l = n !== U.PATH;
1884
1894
  t.previewPoly(r, g.current, o, !1, s, l);
1885
1895
  }, [
1886
1896
  a,
1887
1897
  i,
1888
1898
  c,
1889
1899
  e
1890
- ]), ie = d((e) => {
1891
- let t = Tt(e), n = w.current, r = T.current, i = n[r];
1892
- i && Et(i, t) || (w.current = [...n.slice(0, r + 1), t], T.current += 1, I());
1893
- }, [I]), z = d((e) => {
1900
+ ]), re = d((e) => {
1901
+ let t = Et(e), n = w.current, r = T.current, i = n[r];
1902
+ i && Dt(i, t) || (w.current = [...n.slice(0, r + 1), t], T.current += 1, L());
1903
+ }, [L]), B = d((e) => {
1894
1904
  let t = y.current, n = b.current, r = t[n];
1895
- r && Ot(r, e) || (y.current = [...t.slice(0, n + 1), Dt(e)], b.current += 1);
1896
- }, []), B = d(() => {
1897
- h.current = [], x.current = [], S.current = [], C.current = [], g.current = null, v.current = /* @__PURE__ */ new Set(), y.current = [[]], b.current = 0, L(), c.current?.clearPreview(), I();
1905
+ r && kt(r, e) || (y.current = [...t.slice(0, n + 1), Ot(e)], b.current += 1);
1906
+ }, []), V = d(() => {
1907
+ h.current = [], x.current = [], S.current = [], C.current = [], g.current = null, v.current = /* @__PURE__ */ new Set(), y.current = [[]], b.current = 0, R(), c.current?.clearPreview(), L();
1898
1908
  }, [
1899
1909
  c,
1900
- I,
1901
- L
1902
- ]), ae = d((e, t) => {
1903
- h.current = e, v.current = new Set(Array.from(v.current).filter((t) => t >= 0 && t < e.length)), t && z(e), R(), I();
1904
- }, [
1905
- I,
1906
- z,
1910
+ L,
1907
1911
  R
1908
- ]), oe = d(() => Dt(h.current), []), se = d(() => h.current.length > 0, []), ce = d((t, n) => {
1909
- if (e.current !== H.POLYGON) return !1;
1912
+ ]), ie = d((e, t) => {
1913
+ h.current = e, v.current = new Set(Array.from(v.current).filter((t) => t >= 0 && t < e.length)), t && B(e), z(), L();
1914
+ }, [
1915
+ L,
1916
+ B,
1917
+ z
1918
+ ]), ae = d(() => Ot(h.current), []), oe = d(() => h.current.length > 0, []), se = d((t, n) => {
1919
+ if (e.current !== U.POLYGON) return !1;
1910
1920
  let r = h.current;
1911
1921
  if (r.length < 3) return !1;
1912
1922
  let i = r[0];
1913
- return Math.hypot(t.x - i.x, t.y - i.y) > n ? !1 : (m.current(A.POLYGON, r), B(), !0);
1914
- }, [B, e]), le = d((e) => {
1923
+ return Math.hypot(t.x - i.x, t.y - i.y) > n ? !1 : (m.current(A.POLYGON, r), V(), !0);
1924
+ }, [V, e]), ce = d((e) => {
1915
1925
  let t = h.current;
1916
- return e < 0 || e >= t.length ? !1 : (ae(t.filter((t, n) => n !== e), !0), !0);
1917
- }, [ae]), ue = d((e, t) => {
1926
+ return e < 0 || e >= t.length ? !1 : (ie(t.filter((t, n) => n !== e), !0), !0);
1927
+ }, [ie]), le = d((e, t) => {
1918
1928
  let n = h.current;
1919
1929
  if (e < 0 || e >= n.length) return null;
1920
1930
  let r = new Set(v.current);
1921
- return t ? r.has(e) ? r.delete(e) : r.add(e) : r.has(e) || (r.clear(), r.add(e)), v.current = r, g.current = null, R(), I(), {
1922
- base: Dt(n),
1931
+ return t ? r.has(e) ? r.delete(e) : r.add(e) : r.has(e) || (r.clear(), r.add(e)), v.current = r, g.current = null, z(), L(), {
1932
+ base: Ot(n),
1923
1933
  indices: Array.from(r)
1924
1934
  };
1925
- }, [I, R]), de = d((e) => {
1926
- v.current = /* @__PURE__ */ new Set(), g.current = e, ae([...h.current, e], !0);
1927
- }, [ae]), fe = d((e) => {
1928
- g.current = null, v.current = /* @__PURE__ */ new Set(), h.current = [{ ...e }], R(), I();
1929
- }, [I, R]), pe = d((e, t) => {
1935
+ }, [L, z]), ue = d((e) => {
1936
+ v.current = /* @__PURE__ */ new Set(), g.current = e, ie([...h.current, e], !0);
1937
+ }, [ie]), de = d((e) => {
1938
+ g.current = null, v.current = /* @__PURE__ */ new Set(), h.current = [{ ...e }], z(), L();
1939
+ }, [L, z]), fe = d((e, t) => {
1930
1940
  let n = h.current[h.current.length - 1];
1931
- return n && Math.hypot(e.x - n.x, e.y - n.y) < t ? !1 : (h.current = [...h.current, { ...e }], g.current = null, R(), I(), !0);
1932
- }, [I, R]), me = d((e, t, n, r) => {
1941
+ return n && Math.hypot(e.x - n.x, e.y - n.y) < t ? !1 : (h.current = [...h.current, { ...e }], g.current = null, z(), L(), !0);
1942
+ }, [L, z]), pe = d((e, t, n, r) => {
1933
1943
  let i = new Set(t);
1934
1944
  h.current = e.map((e, t) => i.has(t) ? {
1935
1945
  x: e.x + n,
1936
1946
  y: e.y + r
1937
- } : { ...e }), g.current = null, R(), I();
1938
- }, [I, R]), he = d((e) => {
1939
- e && (z(h.current), R(), I());
1947
+ } : { ...e }), g.current = null, z(), L();
1948
+ }, [L, z]), me = d((e) => {
1949
+ e && (B(h.current), z(), L());
1940
1950
  }, [
1941
- I,
1942
- z,
1943
- R
1944
- ]), ge = d((e) => {
1945
- g.current = e ? { ...e } : null, R(), I();
1946
- }, [I, R]), _e = d(() => h.current.length > 0 ? (h.current = [], R(), I(), !0) : T.current <= 0 ? !1 : (--T.current, x.current = Tt(w.current[T.current]), R(), I(), !0), [I, R]), V = d(() => h.current.length > 0 || T.current >= w.current.length - 1 ? !1 : (T.current += 1, x.current = Tt(w.current[T.current]), R(), I(), !0), [I, R]), ve = d(() => b.current <= 0 ? !1 : (--b.current, h.current = Dt(y.current[b.current]), v.current = /* @__PURE__ */ new Set(), R(), I(), !0), [I, R]), ye = d(() => b.current >= y.current.length - 1 ? !1 : (b.current += 1, h.current = Dt(y.current[b.current]), v.current = /* @__PURE__ */ new Set(), R(), I(), !0), [I, R]), be = d(() => {
1951
+ L,
1952
+ B,
1953
+ z
1954
+ ]), he = d((e) => {
1955
+ g.current = e ? { ...e } : null, z(), L();
1956
+ }, [L, z]), ge = d(() => h.current.length > 0 ? (h.current = [], z(), L(), !0) : T.current <= 0 ? !1 : (--T.current, x.current = Et(w.current[T.current]), z(), L(), !0), [L, z]), H = d(() => h.current.length > 0 || T.current >= w.current.length - 1 ? !1 : (T.current += 1, x.current = Et(w.current[T.current]), z(), L(), !0), [L, z]), _e = d(() => b.current <= 0 ? !1 : (--b.current, h.current = Ot(y.current[b.current]), v.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), ve = d(() => b.current >= y.current.length - 1 ? !1 : (b.current += 1, h.current = Ot(y.current[b.current]), v.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), ye = d(() => {
1947
1957
  let t = e.current;
1948
- return t === H.BRUSH ? _e() : t === H.POLYGON || t === H.PATH ? ve() : !1;
1958
+ return t === U.BRUSH ? ge() : t === U.POLYGON || t === U.PATH ? _e() : !1;
1949
1959
  }, [
1950
1960
  e,
1951
- _e,
1952
- ve
1953
- ]), xe = d(() => {
1961
+ ge,
1962
+ _e
1963
+ ]), be = d(() => {
1954
1964
  let t = e.current;
1955
- return t === H.BRUSH ? V() : t === H.POLYGON || t === H.PATH ? ye() : !1;
1965
+ return t === U.BRUSH ? H() : t === U.POLYGON || t === U.PATH ? ve() : !1;
1956
1966
  }, [
1957
- V,
1958
- ye,
1967
+ H,
1968
+ ve,
1959
1969
  e
1960
- ]), Se = d(() => {
1970
+ ]), xe = d(() => {
1961
1971
  let e = t.current;
1962
1972
  if (!e.length) return C.current.length > 0;
1963
- let r = n.current.getShapes().filter((t) => e.includes(t.id) && ne(t)), i = St(r);
1973
+ let r = n.current.getShapes().filter((t) => e.includes(t.id) && M(t)), i = Ct(r);
1964
1974
  return i.length ? (C.current = r.map((e) => e.id), S.current = i, !0) : (C.current = [], S.current = [], !1);
1965
- }, [n, t]), Ce = d(() => {
1975
+ }, [n, t]), Se = d(() => {
1966
1976
  if (r.current) return !1;
1967
1977
  let e = [...x.current];
1968
1978
  h.current.length && e.push({
1969
- points: Dt(h.current),
1979
+ points: Ot(h.current),
1970
1980
  mode: D()
1971
1981
  });
1972
1982
  let t = S.current, c = [...C.current];
1973
1983
  if (!e.length && !t.length) return !1;
1974
- let l = Ct(e, a.current, t);
1975
- if (!l) return B(), !1;
1976
- let d = Z(l, o.current);
1984
+ let l = wt(e, a.current, t);
1985
+ if (!l) return V(), !1;
1986
+ let d = Tt(l, o.current);
1977
1987
  if (c.length) {
1978
1988
  let e = n.current.getShapes().filter((e) => c.includes(e.id));
1979
- if (!d.length) return n.current.remove(c), B(), u([]), !0;
1980
- d.sort((e, t) => pt(t) - pt(e));
1989
+ if (!d.length) return n.current.remove(c), V(), u([]), !0;
1990
+ d.sort((e, t) => mt(t) - mt(e));
1981
1991
  let t = [], r = [], i = [];
1982
1992
  for (let n = 0; n < d.length; n++) {
1983
1993
  let a = d[n];
@@ -1989,7 +1999,7 @@ function At({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
1989
1999
  points: a
1990
2000
  }), i.push(r.id);
1991
2001
  } else {
1992
- let t = e[0], n = N();
2002
+ let t = e[0], n = P();
1993
2003
  r.push({
1994
2004
  ...t,
1995
2005
  id: n,
@@ -1999,19 +2009,19 @@ function At({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
1999
2009
  }
2000
2010
  }
2001
2011
  let a = e.slice(d.length).map((e) => e.id);
2002
- return t.length && n.current.update(t), r.length && n.current.create(r), a.length && n.current.remove(a), B(), u(i), !0;
2012
+ return t.length && n.current.update(t), r.length && n.current.create(r), a.length && n.current.remove(a), V(), u(i), !0;
2003
2013
  }
2004
- if (!d.length) return B(), !1;
2014
+ if (!d.length) return V(), !1;
2005
2015
  let f = i.current;
2006
2016
  if (!f) return !1;
2007
2017
  let p = d.map((e) => ({
2008
- id: N(),
2018
+ id: P(),
2009
2019
  type: A.POLYGON,
2010
2020
  points: e,
2011
2021
  style: f,
2012
2022
  meta: s
2013
2023
  }));
2014
- return n.current.create(p), u(p.map((e) => e.id)), B(), !0;
2024
+ return n.current.create(p), u(p.map((e) => e.id)), V(), !0;
2015
2025
  }, [
2016
2026
  a,
2017
2027
  u,
@@ -2019,46 +2029,46 @@ function At({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2019
2029
  s,
2020
2030
  i,
2021
2031
  r,
2022
- B
2023
- ]), we = d(() => {
2032
+ V
2033
+ ]), Ce = d(() => {
2024
2034
  let t = e.current;
2025
- if (t === H.BRUSH) return Ce();
2035
+ if (t === U.BRUSH) return Se();
2026
2036
  let n = h.current;
2027
- return t === H.POLYGON && n.length >= 3 ? (m.current(A.POLYGON, n), B(), !0) : !1;
2037
+ return t === U.POLYGON && n.length >= 3 ? (m.current(A.POLYGON, n), V(), !0) : !1;
2028
2038
  }, [
2029
- Ce,
2030
- B,
2039
+ Se,
2040
+ V,
2031
2041
  e
2032
- ]), Te = d(() => {
2042
+ ]), we = d(() => {
2033
2043
  let t = h.current;
2034
- if (e.current === H.PATH && t.length >= 3) {
2035
- let e = ut(t, o.current);
2044
+ if (e.current === U.PATH && t.length >= 3) {
2045
+ let e = X(t, o.current);
2036
2046
  e.length >= 3 && m.current(A.POLYGON, e);
2037
2047
  }
2038
- B();
2039
- }, [B, e]), Ee = d((e) => {
2040
- E.current = e, I(), R();
2041
- }, [I, R]), De = d(() => {
2042
- if (r.current || e.current !== H.BRUSH) return !1;
2043
- x.current = [], h.current = [], L();
2044
- let t = Se();
2045
- return I(), R(), t;
2048
+ V();
2049
+ }, [V, e]), Te = d((e) => {
2050
+ E.current = e, L(), z();
2051
+ }, [L, z]), Ee = d(() => {
2052
+ if (r.current || e.current !== U.BRUSH) return !1;
2053
+ x.current = [], h.current = [], R();
2054
+ let t = xe();
2055
+ return L(), z(), t;
2046
2056
  }, [
2047
- I,
2057
+ L,
2048
2058
  r,
2059
+ z,
2049
2060
  R,
2050
- L,
2051
- Se,
2061
+ xe,
2052
2062
  e
2053
- ]), Oe = d(() => {
2063
+ ]), De = d(() => {
2054
2064
  let e = v.current;
2055
2065
  if (!e.size) return !1;
2056
2066
  let t = h.current.filter((t, n) => !e.has(n));
2057
- return v.current = /* @__PURE__ */ new Set(), ae(t, !0), !0;
2058
- }, [ae]), U = d((e) => {
2067
+ return v.current = /* @__PURE__ */ new Set(), ie(t, !0), !0;
2068
+ }, [ie]), Oe = d((e) => {
2059
2069
  let t = c.current, n = h.current;
2060
2070
  if (!t || !n.length) return -1;
2061
- let r = kt / (t.viewport.scale || 1);
2071
+ let r = At / (t.viewport.scale || 1);
2062
2072
  for (let t = n.length - 1; t >= 0; t--) {
2063
2073
  let i = n[t];
2064
2074
  if (Math.hypot(e.x - i.x, e.y - i.y) <= r) return t;
@@ -2066,82 +2076,82 @@ function At({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2066
2076
  return -1;
2067
2077
  }, [c]), ke = d(() => {
2068
2078
  h.current.length >= 1 && (x.current.push({
2069
- points: Dt(h.current),
2079
+ points: Ot(h.current),
2070
2080
  mode: D()
2071
- }), h.current = [], ie(x.current)), R(), I();
2081
+ }), h.current = [], re(x.current)), z(), L();
2072
2082
  }, [
2073
- I,
2074
- ie,
2075
- R
2083
+ L,
2084
+ re,
2085
+ z
2076
2086
  ]);
2077
2087
  return {
2078
- reset: B,
2079
- undoSession: be,
2080
- redoSession: xe,
2081
- canUndoSession: re,
2082
- canRedoSession: P,
2083
- hasDraftSession: F,
2084
- hasDraftPoints: se,
2085
- commitDraftSession: we,
2086
- completeFreehandStroke: Te,
2087
- setBrushScalarMode: Ee,
2088
+ reset: V,
2089
+ undoSession: ye,
2090
+ redoSession: be,
2091
+ canUndoSession: ne,
2092
+ canRedoSession: F,
2093
+ hasDraftSession: I,
2094
+ hasDraftPoints: oe,
2095
+ commitDraftSession: Ce,
2096
+ completeFreehandStroke: we,
2097
+ setBrushScalarMode: Te,
2088
2098
  getBrushScalarMode: () => E.current,
2089
2099
  hasBrushSession: O,
2090
- commitBrush: Ce,
2100
+ commitBrush: Se,
2091
2101
  cancelBrush: d(() => {
2092
- e.current === H.BRUSH && B();
2093
- }, [B, e]),
2094
- beginBrushEditFromSelection: De,
2095
- deleteDraftSelectedPoints: Oe,
2096
- hitDraftPoint: U,
2097
- getDraftPointsSnapshot: oe,
2098
- tryClosePolygon: ce,
2099
- removeDraftPoint: le,
2100
- selectDraftPointForDrag: ue,
2101
- appendPolygonPoint: de,
2102
- beginStroke: fe,
2103
- appendStrokePoint: pe,
2104
- moveDraftPoints: me,
2105
- commitDraftPointDrag: he,
2106
- setDraftCursor: ge,
2102
+ e.current === U.BRUSH && V();
2103
+ }, [V, e]),
2104
+ beginBrushEditFromSelection: Ee,
2105
+ deleteDraftSelectedPoints: De,
2106
+ hitDraftPoint: Oe,
2107
+ getDraftPointsSnapshot: ae,
2108
+ tryClosePolygon: se,
2109
+ removeDraftPoint: ce,
2110
+ selectDraftPointForDrag: le,
2111
+ appendPolygonPoint: ue,
2112
+ beginStroke: de,
2113
+ appendStrokePoint: fe,
2114
+ moveDraftPoints: pe,
2115
+ commitDraftPointDrag: me,
2116
+ setDraftCursor: he,
2107
2117
  finishScalarStroke: ke,
2108
2118
  handleToolChange: d((e, t) => {
2109
2119
  if (t) {
2110
- B(), E.current = "draw";
2120
+ V(), E.current = "draw";
2111
2121
  return;
2112
2122
  }
2113
- if (e !== H.BRUSH) {
2114
- B(), E.current = "draw";
2123
+ if (e !== U.BRUSH) {
2124
+ V(), E.current = "draw";
2115
2125
  return;
2116
2126
  }
2117
- E.current = "draw", x.current = [], h.current = [], L(), Se(), I(), R();
2127
+ E.current = "draw", x.current = [], h.current = [], R(), xe(), L(), z();
2118
2128
  }, [
2119
- I,
2120
- R,
2121
- B,
2122
2129
  L,
2123
- Se
2130
+ z,
2131
+ V,
2132
+ R,
2133
+ xe
2124
2134
  ]),
2125
2135
  handleBrushSelectionChange: d((t, n) => {
2126
- if (!(e.current !== H.BRUSH || n)) {
2136
+ if (!(e.current !== U.BRUSH || n)) {
2127
2137
  if (!t.length) {
2128
- I();
2138
+ L();
2129
2139
  return;
2130
2140
  }
2131
- [...t].sort().join(",") !== [...C.current].sort().join(",") && (x.current.length || h.current.length || (x.current = [], h.current = [], L(), Se(), I(), R()));
2141
+ [...t].sort().join(",") !== [...C.current].sort().join(",") && (x.current.length || h.current.length || (x.current = [], h.current = [], R(), xe(), L(), z()));
2132
2142
  }
2133
2143
  }, [
2134
- I,
2135
- R,
2136
2144
  L,
2137
- Se,
2145
+ z,
2146
+ R,
2147
+ xe,
2138
2148
  e
2139
2149
  ])
2140
2150
  };
2141
2151
  }
2142
2152
  //#endregion
2143
2153
  //#region src/components/ShapeEditor/_state/useEditorDocument.ts
2144
- function jt(e, t) {
2154
+ function Q(e, t) {
2145
2155
  return {
2146
2156
  shapes: t,
2147
2157
  past: [...e.past, e.shapes],
@@ -2150,22 +2160,22 @@ function jt(e, t) {
2150
2160
  }
2151
2161
  function Mt(e, t) {
2152
2162
  switch (t.type) {
2153
- case "CREATE": return jt(e, [...e.shapes, ...t.shapes]);
2163
+ case "CREATE": return Q(e, [...e.shapes, ...t.shapes]);
2154
2164
  case "UPDATE": {
2155
2165
  let n = new Map(t.shapes.map((e) => [e.id, e]));
2156
- return jt(e, e.shapes.map((e) => n.get(e.id) ?? e));
2166
+ return Q(e, e.shapes.map((e) => n.get(e.id) ?? e));
2157
2167
  }
2158
2168
  case "DELETE": {
2159
2169
  let n = new Set(t.ids);
2160
- return jt(e, e.shapes.filter((e) => !n.has(e.id)));
2170
+ return Q(e, e.shapes.filter((e) => !n.has(e.id)));
2161
2171
  }
2162
2172
  case "REPLACE": {
2163
2173
  let n = new Set(t.removeIds);
2164
- return jt(e, [...e.shapes.filter((e) => !n.has(e.id)), ...t.shapes]);
2174
+ return Q(e, [...e.shapes.filter((e) => !n.has(e.id)), ...t.shapes]);
2165
2175
  }
2166
2176
  case "REORDER": {
2167
2177
  let n = new Set(t.ids), r = e.shapes.filter((e) => n.has(e.id)), i = e.shapes.filter((e) => !n.has(e.id));
2168
- return r.length === 0 ? e : jt(e, t.edge === "front" ? [...i, ...r] : [...r, ...i]);
2178
+ return r.length === 0 ? e : Q(e, t.edge === "front" ? [...i, ...r] : [...r, ...i]);
2169
2179
  }
2170
2180
  case "RESET": return {
2171
2181
  shapes: t.shapes,
@@ -2416,7 +2426,7 @@ function Kt(e, t, n) {
2416
2426
  return;
2417
2427
  }
2418
2428
  if (t === A.ELLIPSE) {
2419
- let t = F(n);
2429
+ let t = I(n);
2420
2430
  e.setAttrs({
2421
2431
  x: (t.minX + t.maxX) / 2,
2422
2432
  y: (t.minY + t.maxY) / 2,
@@ -2445,11 +2455,11 @@ function Qt(e, t) {
2445
2455
  }
2446
2456
  function $t(e, t, n) {
2447
2457
  if (e.kind === "resize") {
2448
- let r = n ? e.box : L(e.anchor, e.box, t.x, t.y);
2458
+ let r = n ? e.box : R(e.anchor, e.box, t.x, t.y);
2449
2459
  return {
2450
2460
  updates: e.shapes.map((i) => ({
2451
2461
  id: i.id,
2452
- points: n ? ge(i.points, e.anchor, t) : _e(i.points, e.box, r)
2462
+ points: n ? he(i.points, e.anchor, t) : ge(i.points, e.box, r)
2453
2463
  })),
2454
2464
  box: r
2455
2465
  };
@@ -2477,7 +2487,7 @@ function $t(e, t, n) {
2477
2487
  return e.shiftKey && (n = Math.round(n / Zt) * Zt), {
2478
2488
  updates: [{
2479
2489
  id: e.id,
2480
- points: e.points.map((t) => ie(t, e.center, n))
2490
+ points: e.points.map((t) => re(t, e.center, n))
2481
2491
  }],
2482
2492
  box: null
2483
2493
  };
@@ -2491,18 +2501,18 @@ function $t(e, t, n) {
2491
2501
  id: e.id,
2492
2502
  points: a
2493
2503
  }],
2494
- box: F(a)
2504
+ box: I(a)
2495
2505
  };
2496
2506
  }
2497
2507
  function en(e, t, n) {
2498
- let r = e.filter((e) => t.includes(e.id) && M(e)).map((e) => ({
2508
+ let r = e.filter((e) => t.includes(e.id) && N(e)).map((e) => ({
2499
2509
  id: e.id,
2500
2510
  points: e.points
2501
2511
  }));
2502
2512
  return r.length ? {
2503
2513
  kind: "move",
2504
2514
  start: n,
2505
- box: F(r.flatMap((e) => e.points)),
2515
+ box: I(r.flatMap((e) => e.points)),
2506
2516
  shapes: r
2507
2517
  } : null;
2508
2518
  }
@@ -2514,17 +2524,17 @@ function tn(e) {
2514
2524
  }
2515
2525
  function nn(e, t) {
2516
2526
  let n = new Set(t);
2517
- return e.filter((e) => n.has(e.id) && ne(e));
2527
+ return e.filter((e) => n.has(e.id) && M(e));
2518
2528
  }
2519
2529
  function rn(e, t) {
2520
2530
  return e.filter((e) => {
2521
2531
  if (!j(e)) return !1;
2522
- let n = F(e.points);
2532
+ let n = I(e.points);
2523
2533
  return n.minX <= t.maxX && n.maxX >= t.minX && n.minY <= t.maxY && n.maxY >= t.minY;
2524
2534
  }).map((e) => e.id);
2525
2535
  }
2526
2536
  function an(e, t, n) {
2527
- return (e ? W(e, { strokeWidth: t }).pointRadius : 5) / (n || 1);
2537
+ return (e ? Me(e, { strokeWidth: t }).pointRadius : 5) / (n || 1);
2528
2538
  }
2529
2539
  function on(e, t) {
2530
2540
  return {
@@ -2536,8 +2546,8 @@ function on(e, t) {
2536
2546
  }
2537
2547
  function sn(e, t, n) {
2538
2548
  if (e.type === A.ROTATED_RECTANGLE) return t;
2539
- let r = e.type === A.POINT ? on(t[0], n) : F(t);
2540
- return z([{
2549
+ let r = e.type === A.POINT ? on(t[0], n) : I(t);
2550
+ return B([{
2541
2551
  x: r.minX,
2542
2552
  y: r.minY
2543
2553
  }, {
@@ -2553,12 +2563,12 @@ function ln(e, t) {
2553
2563
  }
2554
2564
  //#endregion
2555
2565
  //#region src/components/ShapeEditor/_renderers/KonvaRenderer.ts
2556
- var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2566
+ var un = 2, dn = "#1e88e5", fn = "#669def", pn = class {
2557
2567
  constructor(e, t) {
2558
2568
  this.layer = new S.Layer(), this.world = new S.Group(), this.bgGroup = new S.Group(), this.overlayGroup = new S.Group({ listening: !1 }), this.shapeGroup = new S.Group(), this.selGroup = new S.Group(), this.previewGroup = new S.Group(), this.handleGroup = new S.Group(), this.baseCursor = "default", this.strokeSize = un, this.imageSmoothing = !0, this.imageWidth = 0, this.imageHeight = 0, this.shapes = [], this.selected = [], this.nodes = /* @__PURE__ */ new Map(), this.lastAppliedScale = -1, this.imageLoadToken = 0, this.transformEnabled = !1, this.handleNodes = [], this.vertexNodes = [], this.lastImg = {
2559
2569
  x: 0,
2560
2570
  y: 0
2561
- }, this.lastDragImg = null, this.ro = null, this.activeDrag = null, this.midNodes = [], this.selectedVertices = /* @__PURE__ */ new Set(), this.vertexPolygonId = null, this.editingId = null, this.rotNode = null, this.rotLineNode = null, this.transformerOutline = null, this.selectionBorders = [], this.upCleanup = null, this.preview = null, this.marquee = null, this.host = e, this.cb = t, this.stage = new S.Stage({
2571
+ }, this.lastDragImg = null, this.ro = null, this.activeDrag = null, this.midNodes = [], this.selectedVertices = /* @__PURE__ */ new Set(), this.vertexPolygonId = null, this.editingId = null, this.rotNode = null, this.rotLineNode = null, this.transformerOutline = null, this.selectionBorders = [], this.upCleanup = null, this.lastPreviewPoly = null, this.preview = null, this.marquee = null, this.host = e, this.cb = t, this.stage = new S.Stage({
2562
2572
  container: e,
2563
2573
  width: e.clientWidth || 1,
2564
2574
  height: e.clientHeight || 1
@@ -2710,7 +2720,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2710
2720
  let e = {
2711
2721
  stroke: ke,
2712
2722
  strokeWidth: 2,
2713
- dash: Ae,
2723
+ dash: W,
2714
2724
  strokeScaleEnabled: !1,
2715
2725
  listening: !1
2716
2726
  };
@@ -2746,13 +2756,18 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2746
2756
  }
2747
2757
  applyViewport(e) {
2748
2758
  let t = e.scale !== this.lastAppliedScale;
2749
- this.lastAppliedScale = e.scale, this.world.scale({
2759
+ if (this.lastAppliedScale = e.scale, this.world.scale({
2750
2760
  x: e.scale,
2751
2761
  y: e.scale
2752
2762
  }), this.world.position({
2753
2763
  x: e.x,
2754
2764
  y: e.y
2755
- }), this.world.visible(!0), t && (this.syncScreenFixedShapes(), this.updateSelectionBordersLive((e) => e.points)), this.drawTransformer(), this.layer.batchDraw(), this.cb.onViewportChange?.();
2765
+ }), this.world.visible(!0), t) {
2766
+ this.syncScreenFixedShapes(), this.updateSelectionBordersLive((e) => e.points);
2767
+ let e = this.lastPreviewPoly;
2768
+ e && this.previewPoly(e.points, e.cursor, e.color, e.closed, e.selectedPointIndices, e.showVertices);
2769
+ }
2770
+ this.drawTransformer(), this.layer.batchDraw(), this.cb.onViewportChange?.();
2756
2771
  }
2757
2772
  fit() {
2758
2773
  if (!this.imageWidth || !this.imageHeight) return;
@@ -2783,7 +2798,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2783
2798
  setShapes(e, t) {
2784
2799
  if (this.shapes = tn(e), this.selected = t, !this.activeDrag) {
2785
2800
  this.shapeGroup.destroyChildren(), this.nodes.clear();
2786
- for (let t of re(e).filter(ee)) {
2801
+ for (let t of ne(e).filter(ee)) {
2787
2802
  let e = this.makeNode(t);
2788
2803
  this.nodes.set(t.id, e), this.shapeGroup.add(e);
2789
2804
  }
@@ -2797,7 +2812,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2797
2812
  this.editingId !== e && (this.editingId = e, this.selectedVertices.clear(), this.activeDrag || (this.drawTransformer(), this.layer.batchDraw()));
2798
2813
  }
2799
2814
  makeNode(e) {
2800
- let { type: t, points: n } = e, r = W(e, { strokeWidth: this.strokeSize }), i = j(e), a = {
2815
+ let { type: t, points: n } = e, r = Me(e, { strokeWidth: this.strokeSize }), i = j(e), a = {
2801
2816
  id: e.id,
2802
2817
  stroke: r.color,
2803
2818
  strokeWidth: r.strokeWidth,
@@ -2827,10 +2842,10 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2827
2842
  opacity: r.opacity,
2828
2843
  listening: i
2829
2844
  });
2830
- return this.bindCursor(a, M(e) ? "grab" : "default"), a;
2845
+ return this.bindCursor(a, N(e) ? "grab" : "default"), a;
2831
2846
  }
2832
2847
  if (t === A.RECTANGLE) {
2833
- let t = F(n), r = new S.Rect({
2848
+ let t = I(n), r = new S.Rect({
2834
2849
  x: t.minX,
2835
2850
  y: t.minY,
2836
2851
  width: t.maxX - t.minX,
@@ -2838,10 +2853,10 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2838
2853
  fill: o,
2839
2854
  ...a
2840
2855
  });
2841
- return this.bindCursor(r, M(e) ? "grab" : "default"), r;
2856
+ return this.bindCursor(r, N(e) ? "grab" : "default"), r;
2842
2857
  }
2843
2858
  if (t === A.ELLIPSE) {
2844
- let t = F(n), r = new S.Ellipse({
2859
+ let t = I(n), r = new S.Ellipse({
2845
2860
  x: (t.minX + t.maxX) / 2,
2846
2861
  y: (t.minY + t.maxY) / 2,
2847
2862
  radiusX: (t.maxX - t.minX) / 2,
@@ -2849,7 +2864,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2849
2864
  fill: o,
2850
2865
  ...a
2851
2866
  });
2852
- return this.bindCursor(r, M(e) ? "grab" : "default"), r;
2867
+ return this.bindCursor(r, N(e) ? "grab" : "default"), r;
2853
2868
  }
2854
2869
  let s = n.flatMap((e) => [e.x, e.y]), c = t !== A.LINE, l = new S.Line({
2855
2870
  points: s,
@@ -2858,7 +2873,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2858
2873
  lineJoin: "round",
2859
2874
  ...a
2860
2875
  });
2861
- return this.bindCursor(l, M(e) ? "grab" : "default"), l;
2876
+ return this.bindCursor(l, N(e) ? "grab" : "default"), l;
2862
2877
  }
2863
2878
  liveUpdateShape(e, t) {
2864
2879
  let n = this.nodes.get(e), r = this.shapes.find((t) => t.id === e);
@@ -2881,7 +2896,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2881
2896
  });
2882
2897
  continue;
2883
2898
  }
2884
- n?.dash(this.scaledDash(W(t, { strokeWidth: this.strokeSize }).dash));
2899
+ n?.dash(this.scaledDash(Me(t, { strokeWidth: this.strokeSize }).dash));
2885
2900
  }
2886
2901
  }
2887
2902
  shapesIntersecting(e) {
@@ -2894,7 +2909,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2894
2909
  this.selectionBorders = t.map(() => {
2895
2910
  let e = new S.Line({
2896
2911
  closed: !0,
2897
- stroke: dn,
2912
+ stroke: fn,
2898
2913
  strokeWidth: 1.5,
2899
2914
  strokeScaleEnabled: !1,
2900
2915
  listening: !1
@@ -2918,13 +2933,13 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2918
2933
  return sn(e, t, this.pointRadius(e));
2919
2934
  }
2920
2935
  clearPreview() {
2921
- this.previewGroup.destroyChildren(), this.layer.batchDraw();
2936
+ this.lastPreviewPoly = null, this.previewGroup.destroyChildren(), this.layer.batchDraw();
2922
2937
  }
2923
2938
  clearMarquee() {
2924
2939
  this.marquee?.destroy(), this.marquee = null, this.layer.batchDraw();
2925
2940
  }
2926
2941
  previewBox(e, t, n, r) {
2927
- this.previewGroup.destroyChildren();
2942
+ this.lastPreviewPoly = null, this.previewGroup.destroyChildren();
2928
2943
  let i = Math.min(t.x, n.x), a = Math.min(t.y, n.y), o = Math.abs(n.x - t.x), s = Math.abs(n.y - t.y);
2929
2944
  this.preview = e === "ellipse" ? new S.Ellipse({
2930
2945
  x: i + o / 2,
@@ -2945,7 +2960,14 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2945
2960
  }), this.previewGroup.add(this.preview), this.layer.batchDraw();
2946
2961
  }
2947
2962
  previewPoly(e, t, n, r, i = [], a = !0) {
2948
- if (this.previewGroup.destroyChildren(), !e.length) return;
2963
+ if (this.lastPreviewPoly = {
2964
+ points: e,
2965
+ cursor: t,
2966
+ color: n,
2967
+ closed: r,
2968
+ selectedPointIndices: i,
2969
+ showVertices: a
2970
+ }, this.previewGroup.destroyChildren(), !e.length) return;
2949
2971
  let o = e.flatMap((e) => [e.x, e.y]);
2950
2972
  if (t && o.push(t.x, t.y), this.previewGroup.add(new S.Line({
2951
2973
  points: o,
@@ -2966,8 +2988,8 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2966
2988
  x: n.x,
2967
2989
  y: n.y,
2968
2990
  radius: (r ? 6 : 5) / c,
2969
- fill: r ? Q : "#ffffff",
2970
- stroke: r ? "#ffffff" : Q,
2991
+ fill: r ? dn : "#ffffff",
2992
+ stroke: r ? "#ffffff" : dn,
2971
2993
  strokeWidth: 1.5,
2972
2994
  strokeScaleEnabled: !1,
2973
2995
  listening: !1
@@ -2977,7 +2999,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2977
2999
  }
2978
3000
  previewScalarMask(e, t) {
2979
3001
  this.previewGroup.destroyChildren();
2980
- let n = wt(e, t.length === 7 ? `${t}99` : t);
3002
+ let n = Z(e, t.length === 7 ? `${t}99` : t);
2981
3003
  this.previewGroup.add(new S.Image({
2982
3004
  image: n,
2983
3005
  x: e.ox,
@@ -2989,8 +3011,8 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
2989
3011
  }
2990
3012
  previewMarquee(e, t) {
2991
3013
  this.marquee || (this.marquee = new S.Rect({
2992
- fill: Ne(Oe, U),
2993
- stroke: Oe,
3014
+ fill: Ne(De, Oe),
3015
+ stroke: De,
2994
3016
  strokeWidth: 1,
2995
3017
  strokeScaleEnabled: !1,
2996
3018
  listening: !1,
@@ -3010,7 +3032,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3010
3032
  }
3011
3033
  setTransformerOutline(e) {
3012
3034
  let t = Math.max(0, e.maxX - e.minX), n = Math.max(0, e.maxY - e.minY);
3013
- !t && !n || this.setTransformerOutlinePoints(z([{
3035
+ !t && !n || this.setTransformerOutlinePoints(B([{
3014
3036
  x: e.minX,
3015
3037
  y: e.minY
3016
3038
  }, {
@@ -3021,7 +3043,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3021
3043
  setTransformerOutlinePoints(e) {
3022
3044
  e.length < 2 || (this.transformerOutline || (this.transformerOutline = new S.Line({
3023
3045
  closed: !0,
3024
- stroke: Q,
3046
+ stroke: dn,
3025
3047
  strokeWidth: 1,
3026
3048
  strokeScaleEnabled: !1,
3027
3049
  listening: !1
@@ -3031,10 +3053,10 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3031
3053
  return cn(this.viewport.scale);
3032
3054
  }
3033
3055
  rotationHandleScreenPoint(e) {
3034
- return this.imgToScreen(me(e, this.rotationHandleGap()));
3056
+ return this.imgToScreen(pe(e, this.rotationHandleGap()));
3035
3057
  }
3036
3058
  setRotationConnector(e) {
3037
- let t = this.imgToScreen(de(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
3059
+ let t = this.imgToScreen(ue(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
3038
3060
  this.rotLineNode ? this.rotLineNode.points([
3039
3061
  t.x,
3040
3062
  t.y,
@@ -3047,7 +3069,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3047
3069
  n.x,
3048
3070
  n.y
3049
3071
  ],
3050
- stroke: Q,
3072
+ stroke: dn,
3051
3073
  strokeWidth: 1,
3052
3074
  listening: !1
3053
3075
  }), this.handleGroup.add(this.rotLineNode));
@@ -3066,7 +3088,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3066
3088
  }
3067
3089
  repositionOrientedHandles(e) {
3068
3090
  let t = this.orientedHandleAngle(e);
3069
- if (pe(e).forEach((e, n) => {
3091
+ if (fe(e).forEach((e, n) => {
3070
3092
  let r = this.imgToScreen(e), i = this.handleNodes[n];
3071
3093
  i && this.layoutResizeHandle(i, r, t);
3072
3094
  }), this.setTransformerOutlinePoints(e), this.rotNode) {
@@ -3086,11 +3108,11 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3086
3108
  if (this.rotNode?.destroy(), this.rotNode = null, this.rotLineNode?.destroy(), this.rotLineNode = null, this.transformerOutline?.destroy(), this.transformerOutline = null, this.handleNodes = [], this.vertexNodes = [], this.midNodes = [], !this.transformEnabled) return;
3087
3109
  let e = nn(this.shapes, this.selected);
3088
3110
  if (!e.length || e.length === 1 && e[0].type === A.POINT) return;
3089
- let t = e.length === 1 && (e[0].type === A.POLYGON || e[0].type === A.LINE) && this.editingId === e[0].id ? e[0] : null, n = F(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === A.ROTATED_RECTANGLE ? e[0] : null, i = r ? pe(r.points) : P.map((e) => I(e, n));
3111
+ let t = e.length === 1 && (e[0].type === A.POLYGON || e[0].type === A.LINE) && this.editingId === e[0].id ? e[0] : null, n = I(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === A.ROTATED_RECTANGLE ? e[0] : null, i = r ? fe(r.points) : F.map((e) => L(e, n));
3090
3112
  r ? this.setTransformerOutlinePoints(r.points) : this.setTransformerOutline(n), r && this.setRotationConnector(r.points);
3091
3113
  let a = r ? this.orientedHandleAngle(r.points) : 0;
3092
- for (let e of t ? [] : P) {
3093
- let t = this.imgToScreen(i[P.indexOf(e)]), n = new S.Rect({
3114
+ for (let e of t ? [] : F) {
3115
+ let t = this.imgToScreen(i[F.indexOf(e)]), n = new S.Rect({
3094
3116
  x: t.x,
3095
3117
  y: t.y,
3096
3118
  width: 8,
@@ -3099,16 +3121,16 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3099
3121
  offsetY: 4,
3100
3122
  rotation: a * 180 / Math.PI,
3101
3123
  fill: "#ffffff",
3102
- stroke: Q,
3124
+ stroke: dn,
3103
3125
  strokeWidth: 1
3104
- }), r = Je(e, a);
3126
+ }), r = Ye(e, a);
3105
3127
  this.bindCursor(n, r), n.on("mousedown", (t) => {
3106
3128
  t.cancelBubble = !0, this.emitCursorHint(r), this.emitInteractionMode("resizing");
3107
3129
  let n = nn(this.shapes, this.selected);
3108
3130
  this.activeDrag = {
3109
3131
  kind: "resize",
3110
3132
  anchor: e,
3111
- box: F(n.flatMap((e) => e.points)),
3133
+ box: I(n.flatMap((e) => e.points)),
3112
3134
  shapes: n.map((e) => ({
3113
3135
  id: e.id,
3114
3136
  points: e.points
@@ -3128,7 +3150,7 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3128
3150
  radius: 4,
3129
3151
  fill: "#ffffff",
3130
3152
  opacity: .6,
3131
- stroke: Q,
3153
+ stroke: dn,
3132
3154
  strokeWidth: 1
3133
3155
  });
3134
3156
  this.bindCursor(s, "copy"), s.on("mousedown", (r) => {
@@ -3149,8 +3171,8 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3149
3171
  x: i.x,
3150
3172
  y: i.y,
3151
3173
  radius: 5,
3152
- fill: a ? Q : "#ffffff",
3153
- stroke: a ? "#ffffff" : Q,
3174
+ fill: a ? dn : "#ffffff",
3175
+ stroke: a ? "#ffffff" : dn,
3154
3176
  strokeWidth: 1.5
3155
3177
  });
3156
3178
  this.bindCursor(o, "pointer"), o.on("mousedown", (t) => {
@@ -3170,12 +3192,12 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3170
3192
  });
3171
3193
  }
3172
3194
  if (e.length === 1 && e[0].type === A.ROTATED_RECTANGLE) {
3173
- let t = e[0], n = fe(t.points), r = this.rotationHandleScreenPoint(t.points), i = new S.Circle({
3195
+ let t = e[0], n = de(t.points), r = this.rotationHandleScreenPoint(t.points), i = new S.Circle({
3174
3196
  x: r.x,
3175
3197
  y: r.y,
3176
3198
  radius: 6,
3177
3199
  fill: "#ffffff",
3178
- stroke: Q,
3200
+ stroke: dn,
3179
3201
  strokeWidth: 1.5
3180
3202
  });
3181
3203
  this.bindCursor(i, "grab"), i.on("mousedown", (e) => {
@@ -3198,8 +3220,8 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3198
3220
  n && (this.transformEnabled && !this.handleNodes.length && this.drawTransformer(), this.activeDrag = n, this.lastDragImg = null, this.emitCursorHint("grabbing"), this.emitInteractionMode("moving"), (n.shapes.length === 1 ? this.shapes.find((e) => e.id === n.shapes[0].id) : null)?.type === A.ROTATED_RECTANGLE ? this.setTransformerOutlinePoints(n.shapes[0].points) : this.setTransformerOutline(n.box), this.updateSelectionBordersLive((e) => e.points));
3199
3221
  }
3200
3222
  repositionHandles(e) {
3201
- P.forEach((t, n) => {
3202
- let r = this.imgToScreen(I(t, e)), i = this.handleNodes[n];
3223
+ F.forEach((t, n) => {
3224
+ let r = this.imgToScreen(L(t, e)), i = this.handleNodes[n];
3203
3225
  i && this.layoutResizeHandle(i, r, 0);
3204
3226
  }), this.setTransformerOutline(e);
3205
3227
  }
@@ -3267,15 +3289,15 @@ var un = 2, Q = "#1e88e5", dn = "#669def", fn = class {
3267
3289
  let { updates: n } = $t(e, t, Qt(this.shapes, e));
3268
3290
  this.commitTransformUpdates(n);
3269
3291
  }
3270
- }, pn = 2, mn = 58879, hn = 6725103;
3271
- function gn(e) {
3272
- if (!e) return mn;
3292
+ }, mn = 2, hn = 58879, gn = 6725103;
3293
+ function _n(e) {
3294
+ if (!e) return hn;
3273
3295
  let t = e.replace("#", "");
3274
3296
  return Number.parseInt(t.length === 3 ? t.replace(/./g, "$&$&") : t, 16);
3275
3297
  }
3276
- var _n = class {
3298
+ var vn = class {
3277
3299
  constructor(e, t) {
3278
- this.app = new C(), this.world = new T(), this.bgLayer = new T(), this.overlayLayer = new T(), this.shapeLayer = new T(), this.selLayer = new T(), this.previewLayer = new T(), this.handleLayer = new T(), this.filter = new w(), this.imageWidth = 0, this.imageHeight = 0, this.imageTileTextures = [], this.imageLoadToken = 0, this.overlayTextures = [], this.roi = null, this.roiBorderG = null, this.baseCursor = "default", this.strokeSize = pn, this.shapes = [], this.selected = [], this.nodes = /* @__PURE__ */ new Map(), this.lastAppliedScale = -1, this.brightness = 1, this.contrast = 1, this.imageSmoothing = !0, this.destroyed = !1, this.transformEnabled = !1, this.handleNodes = [], this.vertexNodes = [], this.lastDragImg = null, this.activeDrag = null, this.midNodes = [], this.selectedVertices = /* @__PURE__ */ new Set(), this.vertexPolygonId = null, this.editingId = null, this.rotNode = null, this.rotLineNode = null, this.transformerOutline = null, this.selectionBorderGfx = [], this.previewG = new E(), this.marqueeG = new E(), this.previewMaskSprite = null, this.previewMaskTexture = null, this.previewReady = !1, this.host = e, this.cb = t;
3300
+ this.app = new C(), this.world = new T(), this.bgLayer = new T(), this.overlayLayer = new T(), this.shapeLayer = new T(), this.selLayer = new T(), this.previewLayer = new T(), this.handleLayer = new T(), this.filter = new w(), this.imageWidth = 0, this.imageHeight = 0, this.imageTileTextures = [], this.imageLoadToken = 0, this.overlayTextures = [], this.roi = null, this.roiBorderG = null, this.baseCursor = "default", this.strokeSize = mn, this.shapes = [], this.selected = [], this.nodes = /* @__PURE__ */ new Map(), this.lastAppliedScale = -1, this.brightness = 1, this.contrast = 1, this.imageSmoothing = !0, this.destroyed = !1, this.transformEnabled = !1, this.handleNodes = [], this.vertexNodes = [], this.lastDragImg = null, this.activeDrag = null, this.midNodes = [], this.selectedVertices = /* @__PURE__ */ new Set(), this.vertexPolygonId = null, this.editingId = null, this.rotNode = null, this.rotLineNode = null, this.transformerOutline = null, this.selectionBorderGfx = [], this.previewG = new E(), this.marqueeG = new E(), this.previewMaskSprite = null, this.previewMaskTexture = null, this.previewReady = !1, this.lastPreview = null, this.host = e, this.cb = t;
3279
3301
  }
3280
3302
  ev(e) {
3281
3303
  return {
@@ -3511,13 +3533,13 @@ var _n = class {
3511
3533
  this.handleLayer.interactiveChildren = !e;
3512
3534
  }
3513
3535
  strokeW(e) {
3514
- return (e ? W(e, { strokeWidth: this.strokeSize }).strokeWidth : pn) / this.world.scale.x;
3536
+ return (e ? Me(e, { strokeWidth: this.strokeSize }).strokeWidth : mn) / this.world.scale.x;
3515
3537
  }
3516
3538
  pointRadius(e) {
3517
3539
  return an(e, this.strokeSize, this.world.scale.x);
3518
3540
  }
3519
3541
  dashForShape(e) {
3520
- let t = W(e, { strokeWidth: this.strokeSize }).dash;
3542
+ let t = Me(e, { strokeWidth: this.strokeSize }).dash;
3521
3543
  if (!t?.length) return null;
3522
3544
  let n = this.world.scale.x || 1;
3523
3545
  return [t[0] / n, (t[1] ?? t[0]) / n];
@@ -3526,9 +3548,9 @@ var _n = class {
3526
3548
  this.shapeLayer.removeChildren();
3527
3549
  for (let e of this.nodes.values()) e.destroy();
3528
3550
  this.nodes.clear();
3529
- for (let e of re(this.shapes).filter(ee)) {
3551
+ for (let e of ne(this.shapes).filter(ee)) {
3530
3552
  let t = new E();
3531
- this.paintShape(t, e), t.eventMode = j(e) ? "static" : "none", t.cursor = void 0, j(e) && M(e) && (t.on("pointerover", () => {
3553
+ this.paintShape(t, e), t.eventMode = j(e) ? "static" : "none", t.cursor = void 0, j(e) && N(e) && (t.on("pointerover", () => {
3532
3554
  !this.activeDrag && this.transformEnabled && this.emitCursorHint("grab");
3533
3555
  }), t.on("pointerout", () => {
3534
3556
  this.activeDrag || this.emitCursorHint(null);
@@ -3539,7 +3561,7 @@ var _n = class {
3539
3561
  }
3540
3562
  paintShape(e, t) {
3541
3563
  e.clear();
3542
- let n = W(t, { strokeWidth: this.strokeSize }), r = gn(n.color), i = this.strokeW(t), a = n.opacity, o = this.dashForShape(t);
3564
+ let n = Me(t, { strokeWidth: this.strokeSize }), r = _n(n.color), i = this.strokeW(t), a = n.opacity, o = this.dashForShape(t);
3543
3565
  if (t.type === A.POINT) {
3544
3566
  e.svg(Xt(n.color)), e.position.set(t.points[0].x, t.points[0].y), e.pivot.set(16 / 2, 22);
3545
3567
  let r = 1 / (this.world.scale.x || 1);
@@ -3574,33 +3596,51 @@ var _n = class {
3574
3596
  }
3575
3597
  shapesAt(e) {
3576
3598
  return this.shapes.filter((t) => {
3577
- let n = F(t.points);
3599
+ let n = I(t.points);
3578
3600
  return e.x >= n.minX && e.x <= n.maxX && e.y >= n.minY && e.y <= n.maxY;
3579
3601
  }).map((e) => e.id);
3580
3602
  }
3603
+ repaintPreview() {
3604
+ let e = this.lastPreview;
3605
+ e && (e.kind === "poly" ? this.previewPoly(e.points, e.cursor, e.color, e.closed, e.selectedPointIndices, e.showVertices) : this.previewBox(e.boxKind, e.a, e.b, e.color));
3606
+ }
3581
3607
  ensurePreview() {
3582
3608
  this.previewReady ||= (this.previewLayer.addChild(this.previewG, this.marqueeG), !0);
3583
3609
  }
3584
3610
  clearPreview() {
3585
- this.previewG.clear(), this.previewMaskSprite && (this.previewMaskSprite.visible = !1);
3611
+ this.lastPreview = null, this.previewG.clear(), this.previewMaskSprite && (this.previewMaskSprite.visible = !1);
3586
3612
  }
3587
3613
  clearMarquee() {
3588
3614
  this.marqueeG.clear();
3589
3615
  }
3590
3616
  previewBox(e, t, n, r) {
3591
- this.ensurePreview(), this.previewG.clear();
3617
+ this.lastPreview = {
3618
+ kind: "box",
3619
+ boxKind: e,
3620
+ a: t,
3621
+ b: n,
3622
+ color: r
3623
+ }, this.ensurePreview(), this.previewG.clear();
3592
3624
  let i = Math.min(t.x, n.x), a = Math.min(t.y, n.y), o = Math.abs(n.x - t.x), s = Math.abs(n.y - t.y);
3593
3625
  e === "ellipse" ? this.previewG.ellipse(i + o / 2, a + s / 2, o / 2, s / 2) : this.previewG.rect(i, a, o, s), this.previewG.stroke({
3594
3626
  width: this.strokeW(),
3595
- color: gn(r)
3627
+ color: _n(r)
3596
3628
  });
3597
3629
  }
3598
3630
  previewPoly(e, t, n, r, i = [], a = !0) {
3599
- if (this.ensurePreview(), this.previewG.clear(), !e.length) return;
3631
+ if (this.lastPreview = {
3632
+ kind: "poly",
3633
+ points: e,
3634
+ cursor: t,
3635
+ color: n,
3636
+ closed: r,
3637
+ selectedPointIndices: i,
3638
+ showVertices: a
3639
+ }, this.ensurePreview(), this.previewG.clear(), !e.length) return;
3600
3640
  let o = e.flatMap((e) => [e.x, e.y]);
3601
3641
  if (t && o.push(t.x, t.y), this.previewG.poly(o, r), this.previewG.stroke({
3602
3642
  width: this.strokeW(),
3603
- color: gn(n)
3643
+ color: _n(n)
3604
3644
  }), !a) return;
3605
3645
  let s = new Set(i), c = 5 / this.world.scale.x, l = 6 / this.world.scale.x;
3606
3646
  for (let t = 0; t < e.length; t++) {
@@ -3612,16 +3652,16 @@ var _n = class {
3612
3652
  }
3613
3653
  }
3614
3654
  previewScalarMask(e, t) {
3615
- this.ensurePreview(), this.previewG.clear();
3616
- let n = wt(e, t.length === 7 ? `${t}99` : t);
3655
+ this.lastPreview = null, this.ensurePreview(), this.previewG.clear();
3656
+ let n = Z(e, t.length === 7 ? `${t}99` : t);
3617
3657
  this.previewMaskTexture && this.previewMaskTexture.destroy(!0), this.previewMaskTexture = k.from(n), this.previewMaskSprite ? (this.previewMaskSprite.texture = this.previewMaskTexture, this.previewMaskSprite.visible = !0) : (this.previewMaskSprite = new O(this.previewMaskTexture), this.previewLayer.addChildAt(this.previewMaskSprite, 0)), this.previewMaskSprite.x = e.ox, this.previewMaskSprite.y = e.oy, this.previewMaskSprite.width = n.width / e.scale, this.previewMaskSprite.height = n.height / e.scale;
3618
3658
  }
3619
3659
  previewMarquee(e, t) {
3620
3660
  this.ensurePreview(), this.marqueeG.clear();
3621
- let n = Math.min(e.x, t.x), r = Math.min(e.y, t.y), i = Math.abs(t.x - e.x), a = Math.abs(t.y - e.y), o = gn(Oe);
3661
+ let n = Math.min(e.x, t.x), r = Math.min(e.y, t.y), i = Math.abs(t.x - e.x), a = Math.abs(t.y - e.y), o = _n(De);
3622
3662
  this.marqueeG.rect(n, r, i, a).fill({
3623
3663
  color: o,
3624
- alpha: U
3664
+ alpha: Oe
3625
3665
  }).stroke({
3626
3666
  width: 1 / this.world.scale.x,
3627
3667
  color: o
@@ -3636,12 +3676,12 @@ var _n = class {
3636
3676
  r && this.paintShape(n, r);
3637
3677
  }
3638
3678
  }
3639
- this.drawSelectionBorders(), this.redrawRoiBorder();
3679
+ this.drawSelectionBorders(), this.redrawRoiBorder(), this.repaintPreview();
3640
3680
  }
3641
3681
  redrawRoiBorder() {
3642
3682
  let e = this.roiBorderG;
3643
3683
  if (!e || (e.clear(), !this.roi)) return;
3644
- let t = this.world.scale.x || 1, n = 2 / t, r = [Ae[0] / t, Ae[1] / t];
3684
+ let t = this.world.scale.x || 1, n = 2 / t, r = [W[0] / t, W[1] / t];
3645
3685
  for (let t of this.roi.rects) this.strokeDashedPolyline(e, [
3646
3686
  {
3647
3687
  x: t.x,
@@ -3669,12 +3709,12 @@ var _n = class {
3669
3709
  return;
3670
3710
  }
3671
3711
  if (n === A.RECTANGLE) {
3672
- let t = F(r);
3712
+ let t = I(r);
3673
3713
  e.rect(t.minX, t.minY, t.maxX - t.minX, t.maxY - t.minY);
3674
3714
  return;
3675
3715
  }
3676
3716
  if (n === A.ELLIPSE) {
3677
- let t = F(r);
3717
+ let t = I(r);
3678
3718
  e.ellipse((t.minX + t.maxX) / 2, (t.minY + t.maxY) / 2, (t.maxX - t.minX) / 2, (t.maxY - t.minY) / 2);
3679
3719
  return;
3680
3720
  }
@@ -3684,7 +3724,7 @@ var _n = class {
3684
3724
  dashedStrokeShape(e, t, n, r, i, a) {
3685
3725
  let { type: o, points: s } = t;
3686
3726
  if (o === A.RECTANGLE) {
3687
- let t = F(s);
3727
+ let t = I(s);
3688
3728
  this.strokeDashedPolyline(e, [
3689
3729
  {
3690
3730
  x: t.minX,
@@ -3706,7 +3746,7 @@ var _n = class {
3706
3746
  return;
3707
3747
  }
3708
3748
  if (o === A.ELLIPSE) {
3709
- let t = F(s), o = (t.minX + t.maxX) / 2, c = (t.minY + t.maxY) / 2, l = (t.maxX - t.minX) / 2, u = (t.maxY - t.minY) / 2, d = Array.from({ length: 96 }, (e, t) => {
3749
+ let t = I(s), o = (t.minX + t.maxX) / 2, c = (t.minY + t.maxY) / 2, l = (t.maxX - t.minX) / 2, u = (t.maxY - t.minY) / 2, d = Array.from({ length: 96 }, (e, t) => {
3710
3750
  let n = t / 96 * Math.PI * 2;
3711
3751
  return {
3712
3752
  x: o + Math.cos(n) * l,
@@ -3754,7 +3794,7 @@ var _n = class {
3754
3794
  let r = this.selectionBorderGfx[t];
3755
3795
  r.clear(), r.poly(this.selectionOutlinePoints(e, e.points).flatMap((e) => [e.x, e.y]), !0).stroke({
3756
3796
  width: n,
3757
- color: hn
3797
+ color: gn
3758
3798
  });
3759
3799
  });
3760
3800
  }
@@ -3765,7 +3805,7 @@ var _n = class {
3765
3805
  let a = this.selectionBorderGfx[r++];
3766
3806
  a && (a.clear(), a.poly(this.selectionOutlinePoints(i, e(i)).flatMap((e) => [e.x, e.y]), !0).stroke({
3767
3807
  width: n,
3768
- color: hn
3808
+ color: gn
3769
3809
  }));
3770
3810
  }
3771
3811
  }
@@ -3784,7 +3824,7 @@ var _n = class {
3784
3824
  }
3785
3825
  setTransformerOutline(e) {
3786
3826
  let t = e.maxX - e.minX, n = e.maxY - e.minY;
3787
- t <= 0 && n <= 0 || this.setTransformerOutlinePoints(z([{
3827
+ t <= 0 && n <= 0 || this.setTransformerOutlinePoints(B([{
3788
3828
  x: e.minX,
3789
3829
  y: e.minY
3790
3830
  }, {
@@ -3802,10 +3842,10 @@ var _n = class {
3802
3842
  return cn(this.viewport.scale);
3803
3843
  }
3804
3844
  rotationHandleScreenPoint(e) {
3805
- return this.imgToScreen(me(e, this.rotationHandleGap()));
3845
+ return this.imgToScreen(pe(e, this.rotationHandleGap()));
3806
3846
  }
3807
3847
  setRotationConnector(e) {
3808
- let t = this.imgToScreen(de(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
3848
+ let t = this.imgToScreen(ue(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
3809
3849
  this.rotLineNode || (this.rotLineNode = new E(), this.rotLineNode.eventMode = "none", this.handleLayer.addChild(this.rotLineNode)), this.rotLineNode.clear(), this.rotLineNode.moveTo(t.x, t.y).lineTo(n.x, n.y).stroke({
3810
3850
  width: 1,
3811
3851
  color: 2001125
@@ -3825,23 +3865,23 @@ var _n = class {
3825
3865
  if (this.rotNode?.destroy(), this.rotNode = null, this.rotLineNode?.destroy(), this.rotLineNode = null, this.transformerOutline?.destroy(), this.transformerOutline = null, this.handleNodes = [], this.vertexNodes = [], this.midNodes = [], !this.transformEnabled) return;
3826
3866
  let e = nn(this.shapes, this.selected);
3827
3867
  if (e.length === 0 || e.length === 1 && e[0].type === A.POINT) return;
3828
- let t = e.length === 1 && (e[0].type === A.POLYGON || e[0].type === A.LINE) && this.editingId === e[0].id ? e[0] : null, n = F(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === A.ROTATED_RECTANGLE ? e[0] : null, i = r ? pe(r.points) : P.map((e) => I(e, n));
3868
+ let t = e.length === 1 && (e[0].type === A.POLYGON || e[0].type === A.LINE) && this.editingId === e[0].id ? e[0] : null, n = I(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === A.ROTATED_RECTANGLE ? e[0] : null, i = r ? fe(r.points) : F.map((e) => L(e, n));
3829
3869
  r ? this.setTransformerOutlinePoints(r.points) : this.setTransformerOutline(n), r && this.setRotationConnector(r.points);
3830
3870
  let a = r ? this.orientedHandleAngle(r.points) : 0;
3831
- for (let e of t ? [] : P) {
3832
- let t = this.imgToScreen(i[P.indexOf(e)]), n = new E();
3871
+ for (let e of t ? [] : F) {
3872
+ let t = this.imgToScreen(i[F.indexOf(e)]), n = new E();
3833
3873
  n.rect(-4, -4, 8, 8).fill({ color: 16777215 }).stroke({
3834
3874
  width: 1,
3835
3875
  color: 2001125
3836
3876
  }), this.layoutResizeHandle(n, t, a), n.eventMode = "static";
3837
- let r = Je(e, a);
3877
+ let r = Ye(e, a);
3838
3878
  this.bindCursor(n, r), n.on("pointerdown", (t) => {
3839
3879
  t.stopPropagation(), this.emitCursorHint(r), this.emitInteractionMode("resizing");
3840
3880
  let n = nn(this.shapes, this.selected);
3841
3881
  this.activeDrag = {
3842
3882
  kind: "resize",
3843
3883
  anchor: e,
3844
- box: F(n.flatMap((e) => e.points)),
3884
+ box: I(n.flatMap((e) => e.points)),
3845
3885
  shapes: n.map((e) => ({
3846
3886
  id: e.id,
3847
3887
  points: e.points
@@ -3897,7 +3937,7 @@ var _n = class {
3897
3937
  });
3898
3938
  }
3899
3939
  if (e.length === 1 && e[0].type === A.ROTATED_RECTANGLE) {
3900
- let t = e[0], n = fe(t.points), r = this.rotationHandleScreenPoint(t.points), i = new E();
3940
+ let t = e[0], n = de(t.points), r = this.rotationHandleScreenPoint(t.points), i = new E();
3901
3941
  i.circle(0, 0, 6).fill({ color: 16777215 }).stroke({
3902
3942
  width: 1.5,
3903
3943
  color: 2001125
@@ -3920,14 +3960,14 @@ var _n = class {
3920
3960
  n && (this.transformEnabled && !this.handleNodes.length && this.drawTransformer(), this.activeDrag = n, this.lastDragImg = null, this.emitCursorHint("grabbing"), this.emitInteractionMode("moving"), (n.shapes.length === 1 ? this.shapes.find((e) => e.id === n.shapes[0].id) : null)?.type === A.ROTATED_RECTANGLE ? this.setTransformerOutlinePoints(n.shapes[0].points) : this.setTransformerOutline(n.box), this.updateSelectionBordersLive((e) => e.points));
3921
3961
  }
3922
3962
  repositionHandlesForBox(e) {
3923
- P.forEach((t, n) => {
3924
- let r = this.imgToScreen(I(t, e)), i = this.handleNodes[n];
3963
+ F.forEach((t, n) => {
3964
+ let r = this.imgToScreen(L(t, e)), i = this.handleNodes[n];
3925
3965
  i && this.layoutResizeHandle(i, r, 0);
3926
3966
  }), this.setTransformerOutline(e);
3927
3967
  }
3928
3968
  repositionOrientedHandles(e) {
3929
3969
  let t = this.orientedHandleAngle(e);
3930
- if (pe(e).forEach((e, n) => {
3970
+ if (fe(e).forEach((e, n) => {
3931
3971
  let r = this.imgToScreen(e), i = this.handleNodes[n];
3932
3972
  i && this.layoutResizeHandle(i, r, t);
3933
3973
  }), this.setTransformerOutlinePoints(e), this.rotNode) {
@@ -4012,7 +4052,7 @@ var _n = class {
4012
4052
  };
4013
4053
  //#endregion
4014
4054
  //#region src/components/ShapeEditor/_state/useEngineLifecycle.ts
4015
- function vn({ backend: e, hostRef: t, engineRef: n, imageUrl: r, renderedImageUrl: i, makeCallbacks: a, viewRef: o, readOnlyRef: s, toolRef: c, docRef: l, selRef: u, maskCanvasRef: d, roiOverlayRef: p, dimmedRef: m, syncMinimap: h, setImage: g, setImageVisible: v, setReady: y, setImageStatus: b, onContextMenuRequest: x }) {
4055
+ function yn({ backend: e, hostRef: t, engineRef: n, imageUrl: r, renderedImageUrl: i, makeCallbacks: a, viewRef: o, readOnlyRef: s, toolRef: c, docRef: l, selRef: u, maskCanvasRef: d, roiOverlayRef: p, dimmedRef: m, syncMinimap: h, setImage: g, setImageVisible: v, setReady: y, setImageStatus: b, onContextMenuRequest: x }) {
4016
4056
  let S = _(i);
4017
4057
  S.current = i;
4018
4058
  let C = _(r);
@@ -4023,7 +4063,7 @@ function vn({ backend: e, hostRef: t, engineRef: n, imageUrl: r, renderedImageUr
4023
4063
  k.current = x, f(() => {
4024
4064
  let r = t.current;
4025
4065
  if (!r) return;
4026
- let i = !1, a = null, f = null, _ = O.current(), b = e === "konva" ? new fn(r, _) : new _n(r, _);
4066
+ let i = !1, a = null, f = null, _ = O.current(), b = e === "konva" ? new pn(r, _) : new vn(r, _);
4027
4067
  return n.current = b, (async () => {
4028
4068
  if (await b.init(), !i) {
4029
4069
  if (b.setFilter(o.current.brightness, o.current.contrast), b.setStrokeSize(o.current.strokeSize), b.setImageSmoothing(o.current.imageSmoothing), b.setTransformEnabled(!s.current), E.current = !0, S.current) {
@@ -4053,7 +4093,7 @@ function vn({ backend: e, hostRef: t, engineRef: n, imageUrl: r, renderedImageUr
4053
4093
  }
4054
4094
  b.zoomAt(e.clientX - t.left, e.clientY - t.top, e.deltaY < 0 ? 1.1 : 1 / 1.1);
4055
4095
  }, b.dom.addEventListener("wheel", a, { passive: !1 }), f = (e) => {
4056
- if (e.preventDefault(), c.current === H.ASSISTANT_POINT && e.altKey) return;
4096
+ if (e.preventDefault(), c.current === U.ASSISTANT_POINT && e.altKey) return;
4057
4097
  let t = r.getBoundingClientRect(), n = e.clientX - t.left, i = e.clientY - t.top, a = b.viewport;
4058
4098
  k.current({
4059
4099
  x: n,
@@ -4104,12 +4144,12 @@ function vn({ backend: e, hostRef: t, engineRef: n, imageUrl: r, renderedImageUr
4104
4144
  }
4105
4145
  //#endregion
4106
4146
  //#region src/components/ShapeEditor/_state/useMinimapNavigation.ts
4107
- var yn = .05, bn = 20;
4108
- function xn(e) {
4147
+ var bn = .05, xn = 20;
4148
+ function Sn(e) {
4109
4149
  let { deltaY: t, deltaX: n, deltaMode: r } = e;
4110
4150
  return r === 0 ? Math.abs(t) < 10 || Math.abs(n) < 10 || !Number.isInteger(t) || !Number.isInteger(n) : r === 1 ? !1 : !Number.isInteger(t) || !Number.isInteger(n);
4111
4151
  }
4112
- function Sn({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4152
+ function Cn({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4113
4153
  let i = _(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 = (e) => {
4114
4154
  let t = e.currentTarget.getBoundingClientRect();
4115
4155
  return {
@@ -4172,7 +4212,7 @@ function Sn({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4172
4212
  let r = e.current;
4173
4213
  if (!r || !n) return;
4174
4214
  t.preventDefault(), t.stopPropagation();
4175
- let i = xn(t.nativeEvent) ? 2.5 : 1, a = t.deltaY * i, o = 1.05, s = a > 0 ? r.viewport.scale / o : r.viewport.scale * o, c = Math.max(yn, Math.min(bn, s));
4215
+ let i = Sn(t.nativeEvent) ? 2.5 : 1, a = t.deltaY * i, o = 1.05, s = a > 0 ? r.viewport.scale / o : r.viewport.scale * o, c = Math.max(bn, Math.min(xn, s));
4176
4216
  p(d(t), c);
4177
4217
  },
4178
4218
  zoomCentered: (t) => {
@@ -4185,14 +4225,14 @@ function Sn({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4185
4225
  }
4186
4226
  //#endregion
4187
4227
  //#region src/components/ShapeEditor/_state/useMinimapSync.ts
4188
- function Cn(e, t, n) {
4228
+ function wn(e, t, n) {
4189
4229
  if (!(!e || !n.length)) {
4190
4230
  if (t.type === A.POINT) {
4191
4231
  e.setAttribute("cx", String(n[0].x)), e.setAttribute("cy", String(n[0].y));
4192
4232
  return;
4193
4233
  }
4194
4234
  if (t.type === A.RECTANGLE || t.type === A.ELLIPSE) {
4195
- let r = F(n);
4235
+ let r = I(n);
4196
4236
  if (t.type === A.ELLIPSE) {
4197
4237
  e.setAttribute("cx", String((r.minX + r.maxX) / 2)), e.setAttribute("cy", String((r.minY + r.maxY) / 2)), e.setAttribute("rx", String((r.maxX - r.minX) / 2)), e.setAttribute("ry", String((r.maxY - r.minY) / 2));
4198
4238
  return;
@@ -4203,7 +4243,7 @@ function Cn(e, t, n) {
4203
4243
  e.setAttribute("points", n.map((e) => `${e.x},${e.y}`).join(" "));
4204
4244
  }
4205
4245
  }
4206
- function wn({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRectRef: i, minimapSize: a, onViewportChangeRef: o }) {
4246
+ function Tn({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRectRef: i, minimapSize: a, onViewportChangeRef: o }) {
4207
4247
  let s = _(/* @__PURE__ */ new Map());
4208
4248
  return {
4209
4249
  registerMinimapShape: d((e, t) => {
@@ -4212,13 +4252,13 @@ function wn({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRe
4212
4252
  applyMinimapPreview: d((e) => {
4213
4253
  let n = t.current.getShapes();
4214
4254
  if (!e.length) {
4215
- for (let e of n) Cn(s.current.get(e.id), e, e.points);
4255
+ for (let e of n) wn(s.current.get(e.id), e, e.points);
4216
4256
  return;
4217
4257
  }
4218
4258
  let r = new Map(n.map((e) => [e.id, e]));
4219
4259
  for (let t of e) {
4220
4260
  let e = r.get(t.id);
4221
- e && Cn(s.current.get(e.id), e, t.points);
4261
+ e && wn(s.current.get(e.id), e, t.points);
4222
4262
  }
4223
4263
  }, [t]),
4224
4264
  syncMinimap: d(() => {
@@ -4247,9 +4287,9 @@ function wn({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRe
4247
4287
  }
4248
4288
  //#endregion
4249
4289
  //#region src/components/ShapeEditor/_state/useSelectionActions.ts
4250
- var Tn = 12;
4251
- function En({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMergeSelection: i }) {
4252
- let a = _([]), o = _(0), s = d(() => r(e.getShapes().filter((e) => j(e)).map((e) => e.id)), [e, r]), c = d(() => r([]), [r]), l = d(() => e.getShapes().filter((e) => t.current.includes(e.id) && ne(e)), [e, t]), u = d(() => {
4290
+ var En = 12;
4291
+ function Dn({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMergeSelection: i }) {
4292
+ let a = _([]), o = _(0), s = d(() => r(e.getShapes().filter((e) => j(e)).map((e) => e.id)), [e, r]), c = d(() => r([]), [r]), l = d(() => e.getShapes().filter((e) => t.current.includes(e.id) && M(e)), [e, t]), u = d(() => {
4253
4293
  if (n || !t.current.length) return;
4254
4294
  let i = l().map((e) => e.id);
4255
4295
  i.length && (e.remove(i), r([]));
@@ -4264,9 +4304,9 @@ function En({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4264
4304
  }, [l]), p = d(() => a.current.length > 0, []), m = d(() => {
4265
4305
  if (n || !a.current.length) return;
4266
4306
  o.current += 1;
4267
- let t = Tn * o.current, i = a.current.map((e) => ({
4307
+ let t = En * o.current, i = a.current.map((e) => ({
4268
4308
  ...e,
4269
- id: N(),
4309
+ id: P(),
4270
4310
  points: e.points.map((e) => ({
4271
4311
  x: e.x + t,
4272
4312
  y: e.y + t
@@ -4281,10 +4321,10 @@ function En({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4281
4321
  if (n || !t.current.length) return;
4282
4322
  let i = l().map((e) => ({
4283
4323
  ...e,
4284
- id: N(),
4324
+ id: P(),
4285
4325
  points: e.points.map((e) => ({
4286
- x: e.x + Tn,
4287
- y: e.y + Tn
4326
+ x: e.x + En,
4327
+ y: e.y + En
4288
4328
  }))
4289
4329
  }));
4290
4330
  i.length && (e.create(i), r(i.map((e) => e.id)));
@@ -4314,7 +4354,7 @@ function En({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4314
4354
  if (n || !t.current.length) return;
4315
4355
  let i = l();
4316
4356
  if (!i.length) return;
4317
- let a = F(i.flatMap((e) => e.points)), o = (a.minX + a.maxX) / 2, s = (a.minY + a.maxY) / 2;
4357
+ let a = I(i.flatMap((e) => e.points)), o = (a.minX + a.maxX) / 2, s = (a.minY + a.maxY) / 2;
4318
4358
  e.update(i.map((e) => ({
4319
4359
  ...e,
4320
4360
  points: e.points.map((e) => ({
@@ -4329,7 +4369,7 @@ function En({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4329
4369
  t
4330
4370
  ]), b = d((r, i) => {
4331
4371
  if (n || !t.current.length) return;
4332
- let a = e.getShapes().filter((e) => t.current.includes(e.id));
4372
+ let a = e.getShapes().filter((e) => t.current.includes(e.id) && M(e));
4333
4373
  a.length && e.update(a.map((e) => ({
4334
4374
  ...e,
4335
4375
  points: e.points.map((e) => ({
@@ -4360,12 +4400,12 @@ function En({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4360
4400
  if (n) return;
4361
4401
  let t = x();
4362
4402
  if (t.length < 2 || i && !i(t)) return;
4363
- let a = Ct([], 1, St(t));
4403
+ let a = wt([], 1, Ct(t));
4364
4404
  if (!a) return;
4365
- let o = Z(a, 1);
4405
+ let o = Tt(a, 1);
4366
4406
  if (!o.length) return;
4367
4407
  let s = t[0], c = o.map((e) => ({
4368
- id: N(),
4408
+ id: P(),
4369
4409
  type: A.POLYGON,
4370
4410
  points: e,
4371
4411
  style: s.style,
@@ -4383,12 +4423,12 @@ function En({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4383
4423
  }
4384
4424
  //#endregion
4385
4425
  //#region src/components/ShapeEditor/_state/useViewportControls.ts
4386
- function Dn({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBound: i, ready: a }) {
4426
+ function On({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBound: i, ready: a }) {
4387
4427
  let o = _(null), s = _(null), c = d(() => {
4388
4428
  o.current?.(), o.current = null;
4389
4429
  }, []), l = d((t, n = r) => {
4390
4430
  let i = e.current;
4391
- i && (c(), o.current = st(i.viewport, t, (e) => i.applyViewport(e), n));
4431
+ i && (c(), o.current = ct(i.viewport, t, (e) => i.applyViewport(e), n));
4392
4432
  }, [
4393
4433
  c,
4394
4434
  r,
@@ -4396,14 +4436,14 @@ function Dn({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
4396
4436
  ]), u = d((t, n = r) => {
4397
4437
  let i = e.current;
4398
4438
  if (!i) return;
4399
- let a = Y(t, i.screenSize.w, i.screenSize.h);
4439
+ let a = st(t, i.screenSize.w, i.screenSize.h);
4400
4440
  a && l(a, n);
4401
4441
  }, [
4402
4442
  l,
4403
4443
  r,
4404
4444
  e
4405
4445
  ]), p = d((e, n = r) => {
4406
- let i = at(t.getShapes().filter((t) => e.includes(t.id)));
4446
+ let i = ot(t.getShapes().filter((t) => e.includes(t.id)));
4407
4447
  i && u(i, n);
4408
4448
  }, [
4409
4449
  t,
@@ -4414,7 +4454,7 @@ function Dn({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
4414
4454
  if (!r.length) return;
4415
4455
  let i = e.current;
4416
4456
  if (!i) return;
4417
- let a = ot(F(r.flatMap((e) => e.points)), i.screenSize.w, i.screenSize.h, 80);
4457
+ let a = Y(I(r.flatMap((e) => e.points)), i.screenSize.w, i.screenSize.h, 80);
4418
4458
  a && l(a);
4419
4459
  }, [
4420
4460
  t,
@@ -4455,109 +4495,111 @@ function Dn({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
4455
4495
  }
4456
4496
  //#endregion
4457
4497
  //#region src/components/ShapeEditor/ShapeEditor.tsx
4458
- var On = 180, kn = "__draft_preview__";
4459
- function An(e, t) {
4498
+ var kn = 180, An = "__draft_preview__";
4499
+ function jn(e, t) {
4460
4500
  return e.length === t.length && e.every((e, n) => e === t[n]);
4461
4501
  }
4462
- function jn({ imageUrl: e, displayImageUrl: t, renderImageState: n, dimmed: r = !1, initialShapes: i, selectedIds: a, activeTool: o, draftStyle: s, draftMeta: l, readOnly: u, locked: g, onLockedInteraction: y, onIdleEscape: S, overrideShapeInteraction: C, defaultViewSettings: w, viewSettings: T, onViewSettingsChange: E, showMinimap: D = !0, showViewSettings: O = !0, getContextMenuItems: k, strings: te, canMergeSelection: M, brushSize: re = 20, zoomBound: P, zoomAnimationDuration: I = 300, rois: L, excludedZones: R, guideMask: ie, maskPalette: z, overlayMarkers: B, renderOverlayMarker: ae, onOverlayMarkerClick: oe, renderImageOverlay: se, getSelectionLabel: ce, formatSelectionInfo: le, externalTools: ue, assistant: de, keymap: fe, handleRef: pe, backend: me = "pixi", onActiveToolChange: he, onSelectionChange: ge, onEditingChange: _e, onShapesCreated: V, onShapesUpdated: be, onShapesDeleted: xe, onDrawSessionChange: Se, onViewportChange: Ce }) {
4463
- let Oe = _(null), U = _(null), ke = _(null), Ae = _(null), je = _(null), Me = `${p()}-minimap`, [W, Ne] = v(null), [Pe, Fe] = v(!1), [G, Ie] = v(!1), [K, Re] = v(null), [ze, Be] = v({
4502
+ function Mn({ imageUrl: t, displayImageUrl: n, renderImageState: r, dimmed: i = !1, initialShapes: a, selectedIds: o, activeTool: s, draftStyle: c, draftMeta: l, readOnly: u, disableMarquee: g, locked: y, onLockedInteraction: S, onIdleEscape: C, overrideShapeInteraction: w, defaultViewSettings: T, viewSettings: E, onViewSettingsChange: D, showMinimap: O = !0, showViewSettings: k = !0, getContextMenuItems: te, strings: N, canMergeSelection: ne, brushSize: F = 20, zoomBound: L, zoomAnimationDuration: R = 300, rois: z, excludedZones: re, guideMask: B, maskPalette: V, overlayMarkers: ie, renderOverlayMarker: ae, onOverlayMarkerClick: oe, renderImageOverlay: se, getSelectionLabel: ce, hideSelectionLabelDot: le, formatSelectionInfo: ue, externalTools: de, assistant: fe, keymap: pe, handleRef: me, backend: he = "pixi", onActiveToolChange: ge, onSelectionChange: H, onEditingChange: ye, onShapesCreated: be, onShapesUpdated: xe, onShapesDeleted: Se, onDrawSessionChange: De, onViewportChange: Oe }) {
4503
+ let ke = _(null), W = _(null), Ae = _(null), je = _(null), Me = _(null), Ne = `${p()}-minimap`, [G, Pe] = v(null), [Fe, Ie] = v(!1), [K, Le] = v(!1), [ze, Be] = v(null), [Ve, We] = v({
4464
4504
  active: !1,
4465
4505
  kind: "none",
4466
4506
  canUndo: !1,
4467
4507
  canRedo: !1
4468
- }), [Ue, Ge] = v(!0), [Ke, qe] = v(!1), Je = t ?? e, [Ye, Ze] = v("loading"), q = Nt({
4469
- onShapesCreated: V,
4470
- onShapesUpdated: be,
4471
- onShapesDeleted: xe
4472
- }), [$e, tt] = v([]), J = a ?? $e, nt = a !== void 0, rt = h(() => new Map((ue ?? []).map((e) => [e.id, e])), [ue]), it = _(rt);
4473
- it.current = rt;
4474
- let at = _(ze);
4475
- at.current = ze;
4476
- let [Y, ot] = v(() => {
4477
- let e = Object.fromEntries(Object.entries(w ?? {}).filter(([, e]) => e !== void 0));
4508
+ }), [Ke, qe] = v(!0), [Je, Ye] = v(!1), Xe = n ?? t, [Qe, $e] = v("loading"), q = Nt({
4509
+ onShapesCreated: be,
4510
+ onShapesUpdated: xe,
4511
+ onShapesDeleted: Se
4512
+ }), [nt, rt] = v([]), J = o ?? nt, it = o !== void 0, at = h(() => new Map((de ?? []).map((e) => [e.id, e])), [de]), ot = _(at);
4513
+ ot.current = at;
4514
+ let st = _(Ve);
4515
+ st.current = Ve;
4516
+ let [Y, ct] = v(() => {
4517
+ let e = Object.fromEntries(Object.entries(T ?? {}).filter(([, e]) => e !== void 0));
4478
4518
  return {
4479
- ...ye,
4519
+ ...ve,
4480
4520
  ...e
4481
4521
  };
4482
- }), st = d((e) => ot((t) => ({
4522
+ }), dt = d((e) => ct((t) => ({
4483
4523
  ...t,
4484
4524
  ...e
4485
- })), []), X = h(() => ve(te), [te]);
4525
+ })), []), X = h(() => _e(N), [N]);
4486
4526
  f(() => {
4487
- T && ot((e) => {
4488
- let t = Object.entries(T).filter(([t, n]) => n !== void 0 && e[t] !== n);
4527
+ E && ct((e) => {
4528
+ let t = Object.entries(E).filter(([t, n]) => n !== void 0 && e[t] !== n);
4489
4529
  return t.length ? {
4490
4530
  ...e,
4491
4531
  ...Object.fromEntries(t)
4492
4532
  } : e;
4493
4533
  });
4494
- }, [T]);
4495
- let ut = _(E);
4496
- ut.current = E;
4497
- let dt = _(!1);
4534
+ }, [E]);
4535
+ let ft = _(D);
4536
+ ft.current = D;
4537
+ let pt = _(!1);
4498
4538
  f(() => {
4499
- if (!dt.current) {
4500
- dt.current = !0;
4539
+ if (!pt.current) {
4540
+ pt.current = !0;
4501
4541
  return;
4502
4542
  }
4503
- ut.current?.(Y);
4543
+ ft.current?.(Y);
4504
4544
  }, [Y]);
4505
- let ft = h(() => !ie || !z ? null : Qe(ie, z), [ie, z]), pt = h(() => ft?.toDataURL() ?? null, [ft]), mt = h(() => !W || !L?.length ? null : et(L, R, W.w, W.h), [
4506
- W,
4507
- L,
4508
- R
4509
- ]), ht = _(ft);
4510
- ht.current = ft;
4511
- let gt = _(mt);
4512
- gt.current = mt;
4513
- let _t = _(r);
4514
- _t.current = r;
4515
- let vt = _([]);
4516
- vt.current = J;
4517
- let yt = _(o);
4518
- yt.current = o;
4519
- let bt = _(s);
4520
- bt.current = s;
4521
- let xt = _(l);
4522
- xt.current = l;
4523
- let St = _(re);
4524
- St.current = re;
4525
- let Ct = _(Y.simplifyStrength);
4526
- Ct.current = Y.simplifyStrength;
4527
- let Z = !!u || !!g, wt = _(Z);
4528
- wt.current = Z;
4529
- let Tt = _(g);
4530
- Tt.current = g;
4531
- let Et = _(y);
4532
- Et.current = y;
4533
- let Dt = _(C);
4534
- Dt.current = C;
4535
- let Ot = _(q);
4536
- Ot.current = q;
4537
- let kt = _(!1), jt = _(!1), Mt = _("idle"), Pt = _(null), Ft = d(() => {
4538
- let e = U.current;
4545
+ let mt = h(() => !B || !V ? null : et(B, V), [B, V]), ht = h(() => mt?.toDataURL() ?? null, [mt]), gt = h(() => !G || !z?.length ? null : tt(z, re, G.w, G.h), [
4546
+ G,
4547
+ z,
4548
+ re
4549
+ ]), _t = _(mt);
4550
+ _t.current = mt;
4551
+ let vt = _(gt);
4552
+ vt.current = gt;
4553
+ let yt = _(i);
4554
+ yt.current = i;
4555
+ let bt = _([]);
4556
+ bt.current = J;
4557
+ let xt = _(s);
4558
+ xt.current = s;
4559
+ let St = _(c);
4560
+ St.current = c;
4561
+ let Ct = _(l);
4562
+ Ct.current = l;
4563
+ let wt = _(F);
4564
+ wt.current = F;
4565
+ let Tt = _(Y.simplifyStrength);
4566
+ Tt.current = Y.simplifyStrength;
4567
+ let Z = !!u || !!y, Et = _(Z);
4568
+ Et.current = Z;
4569
+ let Dt = _(g);
4570
+ Dt.current = g;
4571
+ let Ot = _(y);
4572
+ Ot.current = y;
4573
+ let kt = _(S);
4574
+ kt.current = S;
4575
+ let At = _(w);
4576
+ At.current = w;
4577
+ let Q = _(q);
4578
+ Q.current = q;
4579
+ let Mt = _(!1), Pt = _(!1), Ft = _("idle"), It = _(null), Lt = d(() => {
4580
+ let e = W.current;
4539
4581
  if (!e) return;
4540
- let t = yt.current, n = it.current.get(t), r = at.current;
4541
- e.setCursor(Xe({
4582
+ let t = xt.current, n = ot.current.get(t), r = st.current;
4583
+ e.setCursor(Ze({
4542
4584
  tool: t,
4543
4585
  externalToolCursor: n?.cursor,
4544
- isSpacePressed: kt.current,
4545
- interactionMode: Mt.current,
4546
- rendererCursorHint: Pt.current,
4586
+ isSpacePressed: Mt.current,
4587
+ interactionMode: Ft.current,
4588
+ rendererCursorHint: It.current,
4547
4589
  isPolygonDrawing: r.kind === "polygon" && r.active
4548
4590
  }));
4549
- }, []), It = d((e) => {
4550
- Mt.current !== e && (Mt.current = e, Ft());
4551
- }, [Ft]), Lt = d((e) => {
4552
- Pt.current !== e && (Pt.current = e, Ft());
4553
- }, [Ft]), Rt = d((e) => {
4554
- let t = /* @__PURE__ */ new Set(), n = new Map(Ot.current.getShapes().map((e) => [e.id, e]));
4591
+ }, []), Rt = d((e) => {
4592
+ Ft.current !== e && (Ft.current = e, Lt());
4593
+ }, [Lt]), zt = d((e) => {
4594
+ It.current !== e && (It.current = e, Lt());
4595
+ }, [Lt]), Bt = d((e) => {
4596
+ let t = /* @__PURE__ */ new Set(), n = new Map(Q.current.getShapes().map((e) => [e.id, e]));
4555
4597
  return e.filter((e) => {
4556
4598
  if (t.has(e)) return !1;
4557
4599
  t.add(e);
4558
4600
  let r = n.get(e);
4559
4601
  if (!r) return !1;
4560
- let i = Dt.current?.(r);
4602
+ let i = At.current?.(r);
4561
4603
  return j(i ? {
4562
4604
  ...r,
4563
4605
  interaction: {
@@ -4566,265 +4608,266 @@ function jn({ imageUrl: e, displayImageUrl: t, renderImageState: n, dimmed: r =
4566
4608
  }
4567
4609
  } : r);
4568
4610
  });
4569
- }, []), zt = d((e) => {
4570
- let t = Rt(e);
4571
- An(vt.current, t) || (nt || tt(t), U.current?.setSelection(t), ge?.(t));
4611
+ }, []), Vt = d((e) => {
4612
+ let t = Bt(e);
4613
+ jn(bt.current, t) || (it || rt(t), W.current?.setSelection(t), H?.(t));
4572
4614
  }, [
4573
- Rt,
4574
- ge,
4575
- nt
4576
- ]), Bt = _(zt);
4577
- Bt.current = zt;
4578
- let [Vt, Ut] = v(null), Wt = d((e) => Ut(e), []), Gt = _(Wt);
4579
- Gt.current = Wt, f(() => {
4580
- if (!nt) return;
4581
- let e = Rt(a);
4582
- An(a, e) || ge?.(e);
4615
+ Bt,
4616
+ H,
4617
+ it
4618
+ ]), Ut = _(Vt);
4619
+ Ut.current = Vt;
4620
+ let [Wt, Gt] = v(null), Kt = d((e) => Gt(e), []), qt = _(Kt);
4621
+ qt.current = Kt, f(() => {
4622
+ if (!it) return;
4623
+ let e = Bt(o);
4624
+ jn(o, e) || H?.(e);
4583
4625
  }, [
4584
- a,
4626
+ o,
4585
4627
  q.shapes,
4586
- Rt,
4587
- ge,
4588
- nt
4628
+ Bt,
4629
+ H,
4630
+ it
4589
4631
  ]);
4590
- let Kt = _(Ce);
4591
- Kt.current = Ce;
4592
- let { registerMinimapShape: qt, applyMinimapPreview: Jt, syncMinimap: Yt } = wn({
4593
- engineRef: U,
4594
- docRef: Ot,
4595
- overlayRef: Ae,
4596
- zoomLabelRef: je,
4597
- minimapRectRef: ke,
4598
- minimapSize: On,
4599
- onViewportChangeRef: Kt
4600
- }), Xt = _(/* @__PURE__ */ new Map()), Zt = _(le);
4601
- Zt.current = le;
4602
- let Qt = d((e, t) => {
4603
- t ? Xt.current.set(e, t) : Xt.current.delete(e);
4604
- }, []), $t = _(null), [en, tn] = v(null), nn = d((e) => {
4632
+ let Jt = _(Oe);
4633
+ Jt.current = Oe;
4634
+ let { registerMinimapShape: Yt, applyMinimapPreview: Xt, syncMinimap: Zt } = Tn({
4635
+ engineRef: W,
4636
+ docRef: Q,
4637
+ overlayRef: je,
4638
+ zoomLabelRef: Me,
4639
+ minimapRectRef: Ae,
4640
+ minimapSize: kn,
4641
+ onViewportChangeRef: Jt
4642
+ }), Qt = _(/* @__PURE__ */ new Map()), $t = _(ue);
4643
+ $t.current = ue;
4644
+ let en = d((e, t) => {
4645
+ t ? Qt.current.set(e, t) : Qt.current.delete(e);
4646
+ }, []), tn = _(null), [nn, rn] = v(null), an = d((e) => {
4605
4647
  if (!e.length) return;
4606
- let t = new Map(Ot.current.getShapes().map((e) => [e.id, e]));
4607
- $t.current && t.set($t.current.id, $t.current);
4648
+ let t = new Map(Q.current.getShapes().map((e) => [e.id, e]));
4649
+ tn.current && t.set(tn.current.id, tn.current);
4608
4650
  for (let { id: n, points: r } of e) {
4609
- let e = Xt.current.get(n), i = t.get(n);
4651
+ let e = Qt.current.get(n), i = t.get(n);
4610
4652
  if (!e || !i) continue;
4611
- let a = F(r);
4653
+ let a = I(r);
4612
4654
  e.style.left = `${a.minX}px`, e.style.top = `${a.minY}px`, e.style.width = `${a.maxX - a.minX}px`, e.style.height = `${a.maxY - a.minY}px`;
4613
4655
  let o = e.querySelector("[data-selinfo-dim]");
4614
4656
  if (o) {
4615
- let e = Ve(i, r);
4616
- o.textContent = Zt.current?.(e) ?? He(e);
4657
+ let e = He(i, r);
4658
+ o.textContent = $t.current?.(e) ?? Ue(e);
4617
4659
  }
4618
4660
  }
4619
- }, []), rn = d((e) => {
4620
- Jt(e), nn(e);
4621
- }, [Jt, nn]), an = d((e) => {
4622
- if (!e || !bt.current) {
4623
- $t.current && ($t.current = null, tn(null));
4661
+ }, []), on = d((e) => {
4662
+ Xt(e), an(e);
4663
+ }, [Xt, an]), sn = d((e) => {
4664
+ if (!e || !St.current) {
4665
+ tn.current && (tn.current = null, rn(null));
4624
4666
  return;
4625
4667
  }
4626
4668
  let t = {
4627
- id: kn,
4669
+ id: An,
4628
4670
  type: e.type,
4629
4671
  points: e.points,
4630
- style: bt.current,
4631
- meta: xt.current
4632
- }, n = $t.current !== null;
4633
- $t.current = t, n ? nn([{
4634
- id: kn,
4672
+ style: St.current,
4673
+ meta: Ct.current
4674
+ }, n = tn.current !== null;
4675
+ tn.current = t, n ? an([{
4676
+ id: An,
4635
4677
  points: e.points
4636
- }]) : tn(t);
4637
- }, [nn]), on = d((e, t) => {
4638
- let n = bt.current;
4639
- if (!n || wt.current) return;
4640
- let r = N();
4641
- Ot.current.create({
4678
+ }]) : rn(t);
4679
+ }, [an]), cn = d((e, t) => {
4680
+ let n = St.current;
4681
+ if (!n || Et.current) return;
4682
+ let r = P();
4683
+ Q.current.create({
4642
4684
  id: r,
4643
4685
  type: e,
4644
4686
  points: t,
4645
4687
  style: n,
4646
4688
  meta: l
4647
- }), Bt.current([r]);
4648
- }, [l]), sn = _(on);
4649
- sn.current = on;
4650
- let cn = At({
4651
- toolRef: yt,
4652
- selRef: vt,
4653
- docRef: Ot,
4654
- readOnlyRef: wt,
4655
- draftRef: bt,
4656
- brushSizeRef: St,
4657
- simplifyEpsilonRef: Ct,
4689
+ }), Ut.current([r]);
4690
+ }, [l]), ln = _(cn);
4691
+ ln.current = cn;
4692
+ let un = jt({
4693
+ toolRef: xt,
4694
+ selRef: bt,
4695
+ docRef: Q,
4696
+ readOnlyRef: Et,
4697
+ draftRef: St,
4698
+ brushSizeRef: wt,
4699
+ simplifyEpsilonRef: Tt,
4658
4700
  draftMeta: l,
4659
- engineRef: U,
4701
+ engineRef: W,
4660
4702
  onDrawSessionChange: d((e) => {
4661
- Be(e), Se?.(e);
4662
- }, [Se]),
4663
- changeSelection: zt,
4664
- createShape: on
4665
- }), ln = _(cn);
4666
- ln.current = cn;
4667
- let { reset: un, undoSession: Q, redoSession: dn, canUndoSession: fn, canRedoSession: pn, hasDraftSession: mn, hasDraftPoints: hn, commitDraftSession: gn, setBrushScalarMode: _n, getBrushScalarMode: yn, hasBrushSession: bn, commitBrush: xn, cancelBrush: Cn, beginBrushEditFromSelection: Tn, deleteDraftSelectedPoints: jn, handleToolChange: Mn, handleBrushSelectionChange: Nn } = cn, Pn = _(de);
4668
- Pn.current = de;
4669
- let $ = lt({
4670
- docRef: Ot,
4671
- draftRef: bt,
4703
+ We(e), De?.(e);
4704
+ }, [De]),
4705
+ changeSelection: Vt,
4706
+ createShape: cn
4707
+ }), dn = _(un);
4708
+ dn.current = un;
4709
+ let { reset: fn, undoSession: pn, redoSession: mn, canUndoSession: hn, canRedoSession: gn, hasDraftSession: _n, hasDraftPoints: vn, commitDraftSession: bn, setBrushScalarMode: xn, getBrushScalarMode: Sn, hasBrushSession: wn, commitBrush: En, cancelBrush: Mn, beginBrushEditFromSelection: Nn, deleteDraftSelectedPoints: Pn, handleToolChange: Fn, handleBrushSelectionChange: In } = un, Ln = _(fe);
4710
+ Ln.current = fe;
4711
+ let $ = ut({
4712
+ docRef: Q,
4713
+ draftRef: St,
4672
4714
  draftMeta: l,
4673
- changeSelection: zt,
4674
- assistantRef: Pn
4675
- }), Fn = _($);
4676
- Fn.current = $;
4677
- let { selectAll: In, clearSelection: Ln, deleteSelection: Rn, copySelection: zn, canPaste: Bn, paste: Vn, duplicate: Hn, bringToFront: Un, sendToBack: Wn, flip: Gn, nudgeSelection: Kn, getMergeTargets: qn, mergeSelection: Jn } = En({
4715
+ changeSelection: Vt,
4716
+ assistantRef: Ln
4717
+ }), Rn = _($);
4718
+ Rn.current = $;
4719
+ let { selectAll: zn, clearSelection: Bn, deleteSelection: Vn, copySelection: Hn, canPaste: Un, paste: Wn, duplicate: Gn, bringToFront: Kn, sendToBack: qn, flip: Jn, nudgeSelection: Yn, getMergeTargets: Xn, mergeSelection: Zn } = Dn({
4678
4720
  doc: q,
4679
- selRef: vt,
4721
+ selRef: bt,
4680
4722
  effectiveReadOnly: Z,
4681
- changeSelection: zt,
4682
- canMergeSelection: M
4683
- }), { zoomToBounds: Yn, zoomToShapes: Xn, zoomToSelection: Zn, zoomAtCenter: Qn } = Dn({
4684
- engineRef: U,
4723
+ changeSelection: Vt,
4724
+ canMergeSelection: ne
4725
+ }), { zoomToBounds: Qn, zoomToShapes: $n, zoomToSelection: er, zoomAtCenter: tr } = On({
4726
+ engineRef: W,
4685
4727
  doc: q,
4686
- selRef: vt,
4687
- zoomAnimationDuration: I,
4688
- zoomBound: P,
4689
- ready: G
4728
+ selRef: bt,
4729
+ zoomAnimationDuration: R,
4730
+ zoomBound: L,
4731
+ ready: K
4690
4732
  });
4691
- m(pe, () => ({
4733
+ m(me, () => ({
4692
4734
  undo: () => {
4693
- Q() || q.undo();
4735
+ pn() || q.undo();
4694
4736
  },
4695
4737
  redo: () => {
4696
- dn() || q.redo();
4738
+ mn() || q.redo();
4697
4739
  },
4698
- canUndo: () => fn() || q.canUndo(),
4699
- canRedo: () => pn() || q.canRedo(),
4700
- undoSession: Q,
4701
- redoSession: dn,
4702
- canUndoSession: fn,
4703
- canRedoSession: pn,
4704
- hasDraftSession: mn,
4705
- cancelDraftSession: un,
4706
- commitDraftSession: gn,
4707
- setSelection: zt,
4740
+ canUndo: () => hn() || q.canUndo(),
4741
+ canRedo: () => gn() || q.canRedo(),
4742
+ undoSession: pn,
4743
+ redoSession: mn,
4744
+ canUndoSession: hn,
4745
+ canRedoSession: gn,
4746
+ hasDraftSession: _n,
4747
+ cancelDraftSession: fn,
4748
+ commitDraftSession: bn,
4749
+ setSelection: Vt,
4708
4750
  createShapes: (e) => {
4709
- e.length && (q.create(e), zt(e.map((e) => e.id)));
4751
+ e.length && (q.create(e), Vt(e.map((e) => e.id)));
4710
4752
  },
4711
4753
  updateShapes: q.update,
4712
4754
  deleteShapes: q.remove,
4713
4755
  getShapes: q.getShapes,
4714
- selectAll: In,
4715
- clearSelection: Ln,
4716
- deleteSelection: Rn,
4717
- copySelection: zn,
4718
- paste: Vn,
4719
- duplicate: Hn,
4720
- bringToFront: Un,
4721
- sendToBack: Wn,
4722
- flipHorizontal: () => Gn(!0),
4723
- flipVertical: () => Gn(!1),
4724
- zoomFit: () => U.current?.fit(),
4725
- zoom100: () => U.current?.zoom100(),
4756
+ selectAll: zn,
4757
+ clearSelection: Bn,
4758
+ deleteSelection: Vn,
4759
+ copySelection: Hn,
4760
+ paste: Wn,
4761
+ duplicate: Gn,
4762
+ bringToFront: Kn,
4763
+ sendToBack: qn,
4764
+ flipHorizontal: () => Jn(!0),
4765
+ flipVertical: () => Jn(!1),
4766
+ zoomFit: () => W.current?.fit(),
4767
+ zoom100: () => W.current?.zoom100(),
4726
4768
  zoomIn: () => {
4727
- let e = U.current;
4769
+ let e = W.current;
4728
4770
  if (!e) return;
4729
4771
  let { w: t, h: n } = e.screenSize;
4730
4772
  e.zoomAt(t / 2, n / 2, 1.2);
4731
4773
  },
4732
4774
  zoomOut: () => {
4733
- let e = U.current;
4775
+ let e = W.current;
4734
4776
  if (!e) return;
4735
4777
  let { w: t, h: n } = e.screenSize;
4736
4778
  e.zoomAt(t / 2, n / 2, 1 / 1.2);
4737
4779
  },
4738
- zoomToSelection: Zn,
4739
- zoomToShapes: Xn,
4740
- zoomToBounds: Yn,
4780
+ zoomToSelection: er,
4781
+ zoomToShapes: $n,
4782
+ zoomToBounds: Qn,
4741
4783
  brush: {
4742
- setScalarMode: _n,
4743
- getScalarMode: yn,
4744
- hasSession: bn,
4745
- commit: xn,
4746
- cancel: Cn,
4747
- beginEditFromSelection: Tn
4784
+ setScalarMode: xn,
4785
+ getScalarMode: Sn,
4786
+ hasSession: wn,
4787
+ commit: En,
4788
+ cancel: Mn,
4789
+ beginEditFromSelection: Nn
4748
4790
  }
4749
4791
  }), [
4750
4792
  q,
4751
- zt,
4752
- Q,
4753
- dn,
4754
- gn,
4755
- un,
4756
- xn,
4757
- Cn,
4758
- In,
4759
- Ln,
4760
- Rn,
4793
+ Vt,
4794
+ pn,
4795
+ mn,
4796
+ bn,
4797
+ fn,
4798
+ En,
4799
+ Mn,
4761
4800
  zn,
4801
+ Bn,
4762
4802
  Vn,
4763
4803
  Hn,
4764
- Un,
4765
4804
  Wn,
4766
4805
  Gn,
4767
- Zn,
4768
- Xn,
4769
- Yn,
4770
- _n,
4771
- yn,
4772
- bn,
4773
- Tn
4806
+ Kn,
4807
+ qn,
4808
+ Jn,
4809
+ er,
4810
+ $n,
4811
+ Qn,
4812
+ xn,
4813
+ Sn,
4814
+ wn,
4815
+ Nn
4774
4816
  ]);
4775
- let $n = _(Y);
4776
- $n.current = Y, vn({
4777
- backend: me,
4778
- hostRef: Oe,
4779
- engineRef: U,
4780
- imageUrl: e,
4781
- renderedImageUrl: Je,
4782
- makeCallbacks: d(() => ct({
4783
- engineRef: U,
4784
- toolRef: yt,
4785
- externalToolMapRef: it,
4786
- spaceRef: kt,
4787
- shiftRef: jt,
4788
- docRef: Ot,
4789
- selRef: vt,
4790
- draftRef: bt,
4791
- readOnlyRef: wt,
4792
- lockedRef: Tt,
4793
- onLockedInteraction: () => Et.current?.(),
4794
- createRef: sn,
4795
- selectRef: Bt,
4796
- enterEditRef: Gt,
4797
- drawSessionRef: ln,
4798
- assistantRef: Fn,
4799
- setCursorHint: Lt,
4800
- setInteractionMode: It,
4801
- syncMinimap: Yt,
4802
- onTransformPreview: rn,
4803
- onDrawPreview: an
4817
+ let nr = _(Y);
4818
+ nr.current = Y, yn({
4819
+ backend: he,
4820
+ hostRef: ke,
4821
+ engineRef: W,
4822
+ imageUrl: t,
4823
+ renderedImageUrl: Xe,
4824
+ makeCallbacks: d(() => lt({
4825
+ engineRef: W,
4826
+ toolRef: xt,
4827
+ externalToolMapRef: ot,
4828
+ spaceRef: Mt,
4829
+ shiftRef: Pt,
4830
+ docRef: Q,
4831
+ selRef: bt,
4832
+ draftRef: St,
4833
+ readOnlyRef: Et,
4834
+ disableMarqueeRef: Dt,
4835
+ lockedRef: Ot,
4836
+ onLockedInteraction: () => kt.current?.(),
4837
+ createRef: ln,
4838
+ selectRef: Ut,
4839
+ enterEditRef: qt,
4840
+ drawSessionRef: dn,
4841
+ assistantRef: Rn,
4842
+ setCursorHint: zt,
4843
+ setInteractionMode: Rt,
4844
+ syncMinimap: Zt,
4845
+ onTransformPreview: on,
4846
+ onDrawPreview: sn
4804
4847
  }), [
4805
- Lt,
4806
- It,
4807
- Yt,
4808
- rn,
4809
- an
4848
+ zt,
4849
+ Rt,
4850
+ Zt,
4851
+ on,
4852
+ sn
4810
4853
  ]),
4811
- viewRef: $n,
4812
- readOnlyRef: wt,
4813
- toolRef: yt,
4814
- docRef: Ot,
4815
- selRef: vt,
4816
- maskCanvasRef: ht,
4817
- roiOverlayRef: gt,
4818
- dimmedRef: _t,
4819
- syncMinimap: Yt,
4820
- setImage: Ne,
4821
- setImageVisible: Fe,
4822
- setReady: Ie,
4823
- setImageStatus: Ze,
4824
- onContextMenuRequest: Re
4854
+ viewRef: nr,
4855
+ readOnlyRef: Et,
4856
+ toolRef: xt,
4857
+ docRef: Q,
4858
+ selRef: bt,
4859
+ maskCanvasRef: _t,
4860
+ roiOverlayRef: vt,
4861
+ dimmedRef: yt,
4862
+ syncMinimap: Zt,
4863
+ setImage: Pe,
4864
+ setImageVisible: Ie,
4865
+ setReady: Le,
4866
+ setImageStatus: $e,
4867
+ onContextMenuRequest: Be
4825
4868
  });
4826
- let er = h(() => C ? q.shapes.map((e) => {
4827
- let t = C(e);
4869
+ let rr = h(() => w ? q.shapes.map((e) => {
4870
+ let t = w(e);
4828
4871
  return t ? {
4829
4872
  ...e,
4830
4873
  interaction: {
@@ -4832,139 +4875,139 @@ function jn({ imageUrl: e, displayImageUrl: t, renderImageState: n, dimmed: r =
4832
4875
  ...t
4833
4876
  }
4834
4877
  } : e;
4835
- }) : q.shapes, [q.shapes, C]);
4878
+ }) : q.shapes, [q.shapes, w]);
4836
4879
  f(() => {
4837
- U.current?.setShapes(er, J), Yt();
4880
+ W.current?.setShapes(rr, J), Zt();
4838
4881
  }, [
4839
- er,
4882
+ rr,
4840
4883
  J,
4841
- Yt
4884
+ Zt
4842
4885
  ]), f(() => {
4843
- U.current?.setEditing(Vt);
4844
- }, [Vt, G]);
4845
- let tr = _(_e);
4846
- tr.current = _e, f(() => {
4847
- tr.current?.(Vt);
4848
- }, [Vt]), f(() => {
4849
- Ut(null);
4850
- }, [o]), f(() => {
4851
- Vt && (J.length !== 1 || J[0] !== Vt) && Ut(null);
4852
- }, [J, Vt]), f(() => {
4853
- let e = U.current;
4854
- e && (e.setFilter(Y.brightness, Y.contrast), e.setStrokeSize(Y.strokeSize), e.setImageSmoothing(Y.imageSmoothing), Yt());
4886
+ W.current?.setEditing(Wt);
4887
+ }, [Wt, K]);
4888
+ let ir = _(ye);
4889
+ ir.current = ye, f(() => {
4890
+ ir.current?.(Wt);
4891
+ }, [Wt]), f(() => {
4892
+ Gt(null);
4893
+ }, [s]), f(() => {
4894
+ Wt && (J.length !== 1 || J[0] !== Wt) && Gt(null);
4895
+ }, [J, Wt]), f(() => {
4896
+ let e = W.current;
4897
+ e && (e.setFilter(Y.brightness, Y.contrast), e.setStrokeSize(Y.strokeSize), e.setImageSmoothing(Y.imageSmoothing), Zt());
4855
4898
  }, [
4856
4899
  Y.brightness,
4857
4900
  Y.contrast,
4858
4901
  Y.strokeSize,
4859
4902
  Y.imageSmoothing,
4860
- Yt
4903
+ Zt
4861
4904
  ]), f(() => {
4862
- G && U.current?.setOverlays(Y.showGuide ? ft : null, Y.showRoi ? mt : null, r);
4905
+ K && W.current?.setOverlays(Y.showGuide ? mt : null, Y.showRoi ? gt : null, i);
4863
4906
  }, [
4864
- G,
4865
- ft,
4907
+ K,
4866
4908
  mt,
4909
+ gt,
4867
4910
  Y.showGuide,
4868
4911
  Y.showRoi,
4869
- r
4912
+ i
4870
4913
  ]), f(() => {
4871
- !G || !W || Yt();
4914
+ !K || !G || Zt();
4872
4915
  }, [
4916
+ K,
4873
4917
  G,
4874
- W,
4875
- pt,
4918
+ ht,
4876
4919
  Y.showGuide,
4877
4920
  Y.showRoi,
4878
- L,
4879
- R,
4880
- Yt
4921
+ z,
4922
+ re,
4923
+ Zt
4881
4924
  ]), f(() => {
4882
- G && U.current?.setTransformEnabled(!Z && o !== H.BRUSH);
4925
+ K && W.current?.setTransformEnabled(!Z && s !== U.BRUSH);
4883
4926
  }, [
4884
4927
  Z,
4885
- G,
4886
- o
4928
+ K,
4929
+ s
4887
4930
  ]), f(() => {
4888
- Mn(o, rt.has(o));
4931
+ Fn(s, at.has(s));
4889
4932
  }, [
4890
- o,
4891
- rt,
4892
- Mn
4933
+ s,
4934
+ at,
4935
+ Fn
4893
4936
  ]);
4894
- let nr = $.finalize;
4937
+ let ar = $.finalize;
4895
4938
  f(() => {
4896
- nr();
4897
- }, [o, nr]), f(() => {
4898
- Mt.current = "idle", Pt.current = null, Ft();
4939
+ ar();
4940
+ }, [s, ar]), f(() => {
4941
+ Ft.current = "idle", It.current = null, Lt();
4899
4942
  }, [
4900
- o,
4901
- me,
4902
- Ft
4943
+ s,
4944
+ he,
4945
+ Lt
4903
4946
  ]), f(() => {
4904
- Nn(J, Z);
4947
+ In(J, Z);
4905
4948
  }, [
4906
4949
  J,
4907
- o,
4950
+ s,
4908
4951
  Z,
4909
- Nn
4952
+ In
4910
4953
  ]), f(() => {
4911
- G && Ft();
4954
+ K && Lt();
4912
4955
  }, [
4913
- o,
4914
- ze,
4915
- rt,
4916
- G,
4917
- Ft
4956
+ s,
4957
+ Ve,
4958
+ at,
4959
+ K,
4960
+ Lt
4918
4961
  ]);
4919
- let rr = _(null);
4962
+ let or = _(null);
4920
4963
  f(() => {
4921
- rr.current !== e && (rr.current = e, q.reset(i ?? []), zt([]), un(), nr());
4964
+ or.current !== t && (or.current = t, q.reset(a ?? []), Vt([]), fn(), ar());
4922
4965
  }, [
4923
- e,
4924
- i,
4966
+ t,
4967
+ a,
4925
4968
  q.reset,
4926
- zt,
4927
- un,
4928
- nr
4969
+ Vt,
4970
+ fn,
4971
+ ar
4929
4972
  ]), Ht({
4930
- keymap: fe,
4973
+ keymap: pe,
4931
4974
  actions: {
4932
4975
  undo: () => {
4933
- Z || Q() || q.undo();
4976
+ Z || pn() || q.undo();
4934
4977
  },
4935
4978
  redo: () => {
4936
- Z || dn() || q.redo();
4979
+ Z || mn() || q.redo();
4937
4980
  },
4938
- selectAll: In,
4939
- copy: zn,
4981
+ selectAll: zn,
4982
+ copy: Hn,
4940
4983
  cut: () => {
4941
- zn(), Rn();
4984
+ Hn(), Vn();
4942
4985
  },
4943
- paste: Vn,
4944
- duplicate: Hn,
4986
+ paste: Wn,
4987
+ duplicate: Gn,
4945
4988
  delete: () => {
4946
- hn() ? jn() : Rn();
4989
+ vn() ? Pn() : Vn();
4947
4990
  },
4948
4991
  cancel: () => {
4949
- let e = it.current.get(yt.current);
4992
+ let e = ot.current.get(xt.current);
4950
4993
  if (!(e?.onCancel && e.onCancel() !== !1)) {
4951
4994
  if ($.isActive()) {
4952
4995
  $.cancel();
4953
4996
  return;
4954
4997
  }
4955
- if (mn()) {
4956
- un();
4998
+ if (_n()) {
4999
+ fn();
4957
5000
  return;
4958
5001
  }
4959
- if (Vt) {
4960
- Ut(null);
5002
+ if (Wt) {
5003
+ Gt(null);
4961
5004
  return;
4962
5005
  }
4963
- if (vt.current.length) {
4964
- Ln();
5006
+ if (bt.current.length) {
5007
+ Bn();
4965
5008
  return;
4966
5009
  }
4967
- S?.();
5010
+ C?.();
4968
5011
  }
4969
5012
  },
4970
5013
  commitDraft: () => {
@@ -4972,218 +5015,218 @@ function jn({ imageUrl: e, displayImageUrl: t, renderImageState: n, dimmed: r =
4972
5015
  $.finalize();
4973
5016
  return;
4974
5017
  }
4975
- if (mn()) {
4976
- gn();
5018
+ if (_n()) {
5019
+ bn();
4977
5020
  return;
4978
5021
  }
4979
5022
  if (Z) return;
4980
- if (Vt) {
4981
- Ut(null);
5023
+ if (Wt) {
5024
+ Gt(null);
4982
5025
  return;
4983
5026
  }
4984
- let e = vt.current;
5027
+ let e = bt.current;
4985
5028
  if (e.length !== 1) return;
4986
- let t = Ot.current.getShapes().find((t) => t.id === e[0]);
4987
- t && (t.type === A.POLYGON || t.type === A.LINE) && t.interaction?.editable !== !1 && !t.readOnly && Ut(e[0]);
5029
+ let t = Q.current.getShapes().find((t) => t.id === e[0]);
5030
+ t && (t.type === A.POLYGON || t.type === A.LINE) && t.interaction?.editable !== !1 && !t.readOnly && Gt(e[0]);
4988
5031
  },
4989
- bringToFront: Un,
4990
- sendToBack: Wn,
4991
- flipHorizontal: () => Gn(!0),
4992
- flipVertical: () => Gn(!1),
4993
- zoomIn: () => Qn(1.2),
4994
- zoomOut: () => Qn(1 / 1.2),
4995
- zoom100: () => U.current?.zoom100(),
4996
- zoomFit: () => U.current?.fit(),
4997
- toggleMinimap: () => Ge((e) => !e),
4998
- toggleCursorGuide: () => ot((e) => ({
5032
+ bringToFront: Kn,
5033
+ sendToBack: qn,
5034
+ flipHorizontal: () => Jn(!0),
5035
+ flipVertical: () => Jn(!1),
5036
+ zoomIn: () => tr(1.2),
5037
+ zoomOut: () => tr(1 / 1.2),
5038
+ zoom100: () => W.current?.zoom100(),
5039
+ zoomFit: () => W.current?.fit(),
5040
+ toggleMinimap: () => qe((e) => !e),
5041
+ toggleCursorGuide: () => ct((e) => ({
4999
5042
  ...e,
5000
5043
  showCursorGuide: !e.showCursorGuide
5001
5044
  })),
5002
- togglePixelation: () => ot((e) => ({
5045
+ togglePixelation: () => ct((e) => ({
5003
5046
  ...e,
5004
5047
  imageSmoothing: !e.imageSmoothing
5005
5048
  })),
5006
- selectTool: () => he?.(H.SELECT),
5007
- rectangleTool: () => he?.(H.RECTANGLE),
5008
- rotatedRectangleTool: () => he?.(H.ROTATED_RECTANGLE),
5009
- circleTool: () => he?.(H.CIRCLE),
5010
- polygonTool: () => he?.(H.POLYGON),
5011
- pathTool: () => he?.(H.PATH),
5012
- brushTool: () => he?.(H.BRUSH),
5013
- pointTool: () => he?.(H.POINT)
5049
+ selectTool: () => ge?.(U.SELECT),
5050
+ rectangleTool: () => ge?.(U.RECTANGLE),
5051
+ rotatedRectangleTool: () => ge?.(U.ROTATED_RECTANGLE),
5052
+ circleTool: () => ge?.(U.CIRCLE),
5053
+ polygonTool: () => ge?.(U.POLYGON),
5054
+ pathTool: () => ge?.(U.PATH),
5055
+ brushTool: () => ge?.(U.BRUSH),
5056
+ pointTool: () => ge?.(U.POINT)
5014
5057
  },
5015
- spaceRef: kt,
5016
- shiftRef: jt,
5058
+ spaceRef: Mt,
5059
+ shiftRef: Pt,
5017
5060
  onSpaceDown: () => {
5018
- U.current?.setPanMode(!0), Ft();
5061
+ W.current?.setPanMode(!0), Lt();
5019
5062
  },
5020
5063
  onSpaceUp: () => {
5021
- U.current?.setPanMode(!1), Mt.current === "panning" ? It("idle") : Ft();
5064
+ W.current?.setPanMode(!1), Ft.current === "panning" ? Rt("idle") : Lt();
5022
5065
  },
5023
- nudge: Kn
5066
+ nudge: Yn
5024
5067
  });
5025
- let ir = h(() => er.filter((e) => J.includes(e.id) && ee(e)), [er, J]), ar = h(() => en ? [...ir, en] : ir, [ir, en]), or = J.length > 0, sr = q.shapes.some((e) => J.includes(e.id) && ne(e)), cr = !Z && J.length === 1 && (() => {
5068
+ let sr = h(() => rr.filter((e) => J.includes(e.id) && ee(e)), [rr, J]), cr = h(() => nn ? [...sr, nn] : sr, [sr, nn]), lr = J.length > 0, ur = q.shapes.some((e) => J.includes(e.id) && M(e)), dr = !Z && J.length === 1 && (() => {
5026
5069
  let e = q.shapes.find((e) => e.id === J[0]);
5027
5070
  return !!e && (e.type === A.POLYGON || e.type === A.LINE) && e.interaction?.editable !== !1 && !e.readOnly;
5028
- })(), lr = qn(), ur = Z || lr.length < 2 || (M ? !M(lr) : !1), dr = de && !Z && J.length === 1 ? (() => {
5071
+ })(), fr = Xn(), pr = Z || fr.length < 2 || (ne ? !ne(fr) : !1), mr = fe && !Z && J.length === 1 ? (() => {
5029
5072
  let e = q.shapes.find((e) => e.id === J[0]);
5030
5073
  return e && e.type === A.POLYGON && e.interaction?.editable !== !1 && !e.readOnly ? e : null;
5031
- })() : null, fr = [
5074
+ })() : null, hr = [
5032
5075
  {
5033
5076
  label: X.contextMenu.copy,
5034
5077
  shortcut: "⌘C",
5035
- disabled: !or,
5036
- onClick: zn
5078
+ disabled: !lr,
5079
+ onClick: Hn
5037
5080
  },
5038
5081
  {
5039
5082
  label: X.contextMenu.paste,
5040
5083
  shortcut: "⌘V",
5041
- disabled: Z || !Bn(),
5042
- onClick: Vn
5084
+ disabled: Z || !Un(),
5085
+ onClick: Wn
5043
5086
  },
5044
5087
  {
5045
5088
  label: X.contextMenu.duplicate,
5046
5089
  shortcut: "⌘D",
5047
- disabled: !sr || Z,
5048
- onClick: Hn
5090
+ disabled: !ur || Z,
5091
+ onClick: Gn
5049
5092
  },
5050
5093
  {
5051
5094
  label: X.contextMenu.delete,
5052
5095
  shortcut: "Del",
5053
5096
  danger: !0,
5054
- disabled: !sr || Z,
5055
- onClick: Rn
5097
+ disabled: !ur || Z,
5098
+ onClick: Vn
5056
5099
  },
5057
5100
  { separator: !0 },
5058
5101
  {
5059
5102
  label: X.contextMenu.editVertices,
5060
5103
  shortcut: "Enter",
5061
- disabled: !cr,
5062
- onClick: () => Ut(J[0])
5104
+ disabled: !dr,
5105
+ onClick: () => Gt(J[0])
5063
5106
  },
5064
5107
  {
5065
5108
  label: X.contextMenu.merge,
5066
- disabled: ur,
5067
- onClick: Jn
5109
+ disabled: pr,
5110
+ onClick: Zn
5068
5111
  },
5069
5112
  {
5070
5113
  label: X.contextMenu.assistExpand,
5071
- icon: /* @__PURE__ */ b(c, { size: 14 }),
5072
- disabled: !dr,
5114
+ icon: /* @__PURE__ */ b(e, { size: 14 }),
5115
+ disabled: !mr,
5073
5116
  onClick: () => {
5074
- K && dr && $.refineShape(dr, K.img, !0);
5117
+ ze && mr && $.refineShape(mr, ze.img, !0);
5075
5118
  }
5076
5119
  },
5077
5120
  {
5078
5121
  label: X.contextMenu.assistExclude,
5079
- icon: /* @__PURE__ */ b(c, { size: 14 }),
5080
- disabled: !dr,
5122
+ icon: /* @__PURE__ */ b(e, { size: 14 }),
5123
+ disabled: !mr,
5081
5124
  onClick: () => {
5082
- K && dr && $.refineShape(dr, K.img, !1);
5125
+ ze && mr && $.refineShape(mr, ze.img, !1);
5083
5126
  }
5084
5127
  },
5085
5128
  {
5086
5129
  label: X.contextMenu.bringToFront,
5087
- disabled: !sr || Z,
5088
- onClick: Un
5130
+ disabled: !ur || Z,
5131
+ onClick: Kn
5089
5132
  },
5090
5133
  {
5091
5134
  label: X.contextMenu.sendToBack,
5092
- disabled: !sr || Z,
5093
- onClick: Wn
5135
+ disabled: !ur || Z,
5136
+ onClick: qn
5094
5137
  },
5095
5138
  {
5096
5139
  label: X.contextMenu.flipHorizontal,
5097
- disabled: !sr || Z,
5098
- onClick: () => Gn(!0)
5140
+ disabled: !ur || Z,
5141
+ onClick: () => Jn(!0)
5099
5142
  },
5100
5143
  {
5101
5144
  label: X.contextMenu.flipVertical,
5102
- disabled: !sr || Z,
5103
- onClick: () => Gn(!1)
5145
+ disabled: !ur || Z,
5146
+ onClick: () => Jn(!1)
5104
5147
  },
5105
5148
  { separator: !0 },
5106
5149
  {
5107
5150
  label: X.contextMenu.undo,
5108
5151
  shortcut: "⌘Z",
5109
- disabled: Z || !fn() && !q.canUndo(),
5152
+ disabled: Z || !hn() && !q.canUndo(),
5110
5153
  onClick: () => {
5111
- Q() || q.undo();
5154
+ pn() || q.undo();
5112
5155
  }
5113
5156
  },
5114
5157
  {
5115
5158
  label: X.contextMenu.redo,
5116
5159
  shortcut: "⇧⌘Z",
5117
- disabled: Z || !pn() && !q.canRedo(),
5160
+ disabled: Z || !gn() && !q.canRedo(),
5118
5161
  onClick: () => {
5119
- dn() || q.redo();
5162
+ mn() || q.redo();
5120
5163
  }
5121
5164
  },
5122
5165
  { separator: !0 },
5123
5166
  {
5124
5167
  label: X.contextMenu.selectAll,
5125
5168
  shortcut: "⌘A",
5126
- onClick: In
5169
+ onClick: zn
5127
5170
  },
5128
5171
  {
5129
5172
  label: X.contextMenu.clearSelection,
5130
- disabled: !or,
5131
- onClick: Ln
5173
+ disabled: !lr,
5174
+ onClick: Bn
5132
5175
  },
5133
5176
  {
5134
5177
  label: X.contextMenu.zoomToSelection,
5135
- disabled: !or,
5136
- onClick: Zn
5178
+ disabled: !lr,
5179
+ onClick: er
5137
5180
  }
5138
- ], pr = k ? k(fr, {
5181
+ ], gr = te ? te(hr, {
5139
5182
  selectedIds: J,
5140
5183
  readOnly: Z
5141
- }) : fr, mr = Sn({
5142
- engineRef: U,
5143
- image: W,
5184
+ }) : hr, _r = Cn({
5185
+ engineRef: W,
5186
+ image: G,
5144
5187
  wheelZoom: Y.wheelZoom,
5145
- minimapSize: On
5188
+ minimapSize: kn
5146
5189
  });
5147
5190
  return /* @__PURE__ */ x("div", {
5148
5191
  className: "aivex:relative aivex:h-full aivex:w-full aivex:overflow-hidden aivex:bg-black",
5149
5192
  children: [
5150
5193
  /* @__PURE__ */ b("div", {
5151
- ref: Oe,
5194
+ ref: ke,
5152
5195
  className: "aivex:h-full aivex:w-full",
5153
5196
  style: {
5154
- opacity: +!!Pe,
5155
- transition: Pe ? "opacity 0.3s ease" : "none"
5197
+ opacity: +!!Fe,
5198
+ transition: Fe ? "opacity 0.3s ease" : "none"
5156
5199
  }
5157
5200
  }),
5158
- Ye !== "ready" && /* @__PURE__ */ b(De, {
5159
- status: Ye,
5160
- render: n,
5201
+ Qe !== "ready" && /* @__PURE__ */ b(Ee, {
5202
+ status: Qe,
5203
+ render: r,
5161
5204
  loadingLabel: X.imageLoading,
5162
5205
  errorLabel: X.imageLoadError
5163
5206
  }),
5164
- G && W && /* @__PURE__ */ b("div", {
5207
+ K && G && /* @__PURE__ */ b("div", {
5165
5208
  className: "aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:overflow-hidden",
5166
5209
  children: /* @__PURE__ */ x("div", {
5167
- ref: Ae,
5210
+ ref: je,
5168
5211
  style: {
5169
5212
  position: "absolute",
5170
5213
  top: 0,
5171
5214
  left: 0,
5172
- width: W.w,
5173
- height: W.h,
5215
+ width: G.w,
5216
+ height: G.h,
5174
5217
  transformOrigin: "0 0"
5175
5218
  },
5176
5219
  children: [
5177
- !!B?.length && ae && /* @__PURE__ */ b("div", {
5220
+ !!ie?.length && ae && /* @__PURE__ */ b("div", {
5178
5221
  style: {
5179
5222
  position: "absolute",
5180
5223
  left: 0,
5181
5224
  top: 0,
5182
- width: W.w,
5183
- height: W.h,
5225
+ width: G.w,
5226
+ height: G.h,
5184
5227
  pointerEvents: "none"
5185
5228
  },
5186
- children: B.map((e) => /* @__PURE__ */ b("div", {
5229
+ children: ie.map((e) => /* @__PURE__ */ b("div", {
5187
5230
  role: e.disabled ? void 0 : "button",
5188
5231
  tabIndex: e.disabled ? void 0 : 0,
5189
5232
  "aria-pressed": e.selected || void 0,
@@ -5208,21 +5251,22 @@ function jn({ imageUrl: e, displayImageUrl: t, renderImageState: n, dimmed: r =
5208
5251
  }, e.id))
5209
5252
  }),
5210
5253
  se?.({
5211
- image: W,
5212
- viewport: U.current?.viewport ?? {
5254
+ image: G,
5255
+ viewport: W.current?.viewport ?? {
5213
5256
  scale: 1,
5214
5257
  x: 0,
5215
5258
  y: 0
5216
5259
  }
5217
5260
  }),
5218
- ar.length > 0 && /* @__PURE__ */ b(We, {
5219
- shapes: ar,
5261
+ cr.length > 0 && /* @__PURE__ */ b(Ge, {
5262
+ shapes: cr,
5220
5263
  getLabel: ce,
5221
- formatInfo: le,
5222
- register: Qt
5264
+ hideDot: le,
5265
+ formatInfo: ue,
5266
+ register: en
5223
5267
  }),
5224
- de && ($.status === "loading" || $.boxes.length > 0) && /* @__PURE__ */ b(we, {
5225
- image: W,
5268
+ fe && ($.status === "loading" || $.boxes.length > 0) && /* @__PURE__ */ b(Ce, {
5269
+ image: G,
5226
5270
  points: $.points,
5227
5271
  boxes: $.boxes,
5228
5272
  status: $.status
@@ -5230,42 +5274,42 @@ function jn({ imageUrl: e, displayImageUrl: t, renderImageState: n, dimmed: r =
5230
5274
  ]
5231
5275
  })
5232
5276
  }),
5233
- G && Y.showCursorGuide && /* @__PURE__ */ b(Ee, { color: "#1e88e5" }),
5234
- G && W && D && /* @__PURE__ */ b(Le, {
5235
- image: W,
5236
- imageUrl: Je,
5237
- imageVisible: Pe,
5238
- maskDataUrl: pt,
5239
- rois: L,
5240
- excludedZones: R,
5241
- roiMaskId: Me,
5242
- shapes: er,
5277
+ K && Y.showCursorGuide && /* @__PURE__ */ b(Te, { color: "#1e88e5" }),
5278
+ K && G && O && /* @__PURE__ */ b(Re, {
5279
+ image: G,
5280
+ imageUrl: Xe,
5281
+ imageVisible: Fe,
5282
+ maskDataUrl: ht,
5283
+ rois: z,
5284
+ excludedZones: re,
5285
+ roiMaskId: Ne,
5286
+ shapes: rr,
5243
5287
  view: Y,
5244
- onChangeView: st,
5245
- nav: mr,
5246
- registerShape: qt,
5247
- rectRef: ke,
5248
- zoomLabelRef: je,
5249
- onZoom100: () => U.current?.zoom100(),
5250
- open: Ue,
5251
- onToggleOpen: () => Ge((e) => !e),
5288
+ onChangeView: dt,
5289
+ nav: _r,
5290
+ registerShape: Yt,
5291
+ rectRef: Ae,
5292
+ zoomLabelRef: Me,
5293
+ onZoom100: () => W.current?.zoom100(),
5294
+ open: Ke,
5295
+ onToggleOpen: () => qe((e) => !e),
5252
5296
  labels: X.minimap,
5253
5297
  settingsLabels: X.viewSettings,
5254
- showSettings: O,
5255
- settingsOpen: Ke,
5256
- onToggleSettings: () => qe((e) => !e),
5257
- onCloseSettings: () => qe(!1)
5298
+ showSettings: k,
5299
+ settingsOpen: Je,
5300
+ onToggleSettings: () => Ye((e) => !e),
5301
+ onCloseSettings: () => Ye(!1)
5258
5302
  }),
5259
- K && /* @__PURE__ */ b(Te, {
5260
- x: K.x,
5261
- y: K.y,
5262
- items: pr,
5263
- onClose: () => Re(null)
5303
+ ze && /* @__PURE__ */ b(we, {
5304
+ x: ze.x,
5305
+ y: ze.y,
5306
+ items: gr,
5307
+ onClose: () => Be(null)
5264
5308
  })
5265
5309
  ]
5266
5310
  });
5267
5311
  }
5268
5312
  //#endregion
5269
- export { V as DEFAULT_EDITOR_STRINGS, ye as DEFAULT_VIEW_SETTINGS, A as SHAPE_TYPE, jn as ShapeEditor, jn as default, H as TOOL, N as generateId };
5313
+ export { H as DEFAULT_EDITOR_STRINGS, ve as DEFAULT_VIEW_SETTINGS, A as SHAPE_TYPE, Mn as ShapeEditor, Mn as default, U as TOOL, P as generateId };
5270
5314
 
5271
5315
  //# sourceMappingURL=shape-editor.js.map