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

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.
@@ -5,7 +5,7 @@ import { a as p, n as m, r as h, t as g } from "./Switch-rIEhz2pk.js";
5
5
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
6
6
  import { memo as b, useCallback as x, useEffect as S, useId as C, useImperativeHandle as w, useLayoutEffect as T, useMemo as E, useReducer as D, useRef as O, useState as k } from "react";
7
7
  import A from "konva";
8
- import { Application as j, ColorMatrixFilter as M, Container as N, Graphics as P, Polygon as ee, Rectangle as te, Sprite as ne, Texture as re } from "pixi.js";
8
+ import { Application as j, ColorMatrixFilter as ee, Container as M, Graphics as N, Polygon as te, Rectangle as ne, Sprite as re, Texture as P } from "pixi.js";
9
9
  //#region src/components/ShapeEditor/_model/geometry.ts
10
10
  var F = {
11
11
  POINT: "POINT",
@@ -160,19 +160,19 @@ function me(e) {
160
160
  }
161
161
  return r;
162
162
  }
163
- var H = (e, t) => ({
163
+ var he = (e, t) => ({
164
164
  x: e.x - t.x,
165
165
  y: e.y - t.y
166
- }), he = (e, t) => e.x * t.x + e.y * t.y, ge = (e) => Math.hypot(e.x, e.y), _e = (e) => {
167
- let t = ge(e) || 1;
166
+ }), ge = (e, t) => e.x * t.x + e.y * t.y, _e = (e) => Math.hypot(e.x, e.y), ve = (e) => {
167
+ let t = _e(e) || 1;
168
168
  return {
169
169
  x: e.x / t,
170
170
  y: e.y / t
171
171
  };
172
- }, ve = (e, t) => ({
172
+ }, ye = (e, t) => ({
173
173
  x: (e.x + t.x) / 2,
174
174
  y: (e.y + t.y) / 2
175
- }), ye = (e) => {
175
+ }), be = (e) => {
176
176
  let t = e.reduce((e, t) => ({
177
177
  x: e.x + t.x,
178
178
  y: e.y + t.y
@@ -185,26 +185,26 @@ var H = (e, t) => ({
185
185
  y: t.y / e.length
186
186
  };
187
187
  };
188
- function be(e) {
188
+ function xe(e) {
189
189
  return [
190
190
  e[0],
191
- ve(e[0], e[1]),
191
+ ye(e[0], e[1]),
192
192
  e[1],
193
- ve(e[1], e[2]),
193
+ ye(e[1], e[2]),
194
194
  e[2],
195
- ve(e[2], e[3]),
195
+ ye(e[2], e[3]),
196
196
  e[3],
197
- ve(e[3], e[0])
197
+ ye(e[3], e[0])
198
198
  ];
199
199
  }
200
- function xe(e, t) {
201
- let n = ve(e[0], e[1]), r = _e(H(e[0], e[3]));
200
+ function Se(e, t) {
201
+ let n = ye(e[0], e[1]), r = ve(he(e[0], e[3]));
202
202
  return {
203
203
  x: n.x + r.x * t,
204
204
  y: n.y + r.y * t
205
205
  };
206
206
  }
207
- function Se(e, t, n, r) {
207
+ function Ce(e, t, n, r) {
208
208
  let i = (e, i) => ({
209
209
  x: t.x + e * n.x + i * r.x,
210
210
  y: t.y + e * n.y + i * r.y
@@ -216,37 +216,37 @@ function Se(e, t, n, r) {
216
216
  i(e.minX, e.maxY)
217
217
  ];
218
218
  }
219
- function Ce(e, t, n) {
219
+ function we(e, t, n) {
220
220
  if (e.length < 4) return e;
221
- let r = e[0], i = _e(H(e[1], e[0])), a = _e(H(e[3], e[0])), o = he(H(e[1], r), i), s = he(H(e[3], r), a), c = H(n, r);
222
- return Se(V(t, {
221
+ let r = e[0], i = ve(he(e[1], e[0])), a = ve(he(e[3], e[0])), o = ge(he(e[1], r), i), s = ge(he(e[3], r), a), c = he(n, r);
222
+ return Ce(V(t, {
223
223
  minX: 0,
224
224
  minY: 0,
225
225
  maxX: o,
226
226
  maxY: s
227
- }, he(c, i), he(c, a)), r, i, a);
227
+ }, ge(c, i), ge(c, a)), r, i, a);
228
228
  }
229
- function we(e, t, n) {
229
+ function Te(e, t, n) {
230
230
  let r = t.maxX - t.minX || 1, i = t.maxY - t.minY || 1, a = n.maxX - n.minX, o = n.maxY - n.minY;
231
231
  return e.map((e) => ({
232
232
  x: n.minX + (e.x - t.minX) / r * a,
233
233
  y: n.minY + (e.y - t.minY) / i * o
234
234
  }));
235
235
  }
236
- function U(e, t, n, r) {
236
+ function Ee(e, t, n, r) {
237
237
  let i = (e, t, n) => Math.sign((t.x - e.x) * (n.y - e.y) - (t.y - e.y) * (n.x - e.x)), a = i(e, t, n), o = i(e, t, r), s = i(n, r, e), c = i(n, r, t);
238
238
  return a !== o && s !== c && !(a === 0 && o === 0);
239
239
  }
240
- function Te(e, t = 256) {
240
+ function H(e, t = 256) {
241
241
  let n = e.length;
242
242
  if (n < 4 || n > t) return !1;
243
243
  for (let t = 0; t < n; t++) {
244
244
  let r = e[t], i = e[(t + 1) % n];
245
- for (let a = t + 2; a < n; a++) if (!(t === 0 && a === n - 1) && U(r, i, e[a], e[(a + 1) % n])) return !0;
245
+ for (let a = t + 2; a < n; a++) if (!(t === 0 && a === n - 1) && Ee(r, i, e[a], e[(a + 1) % n])) return !0;
246
246
  }
247
247
  return !1;
248
248
  }
249
- function Ee(e, t, n, r) {
249
+ function De(e, t, n, r) {
250
250
  let i = t.x - e.x, a = t.y - e.y, o = r.x - n.x, s = r.y - n.y, c = i * s - a * o;
251
251
  if (!c) return null;
252
252
  let l = ((n.x - e.x) * s - (n.y - e.y) * o) / c, u = ((n.x - e.x) * a - (n.y - e.y) * i) / c, d = 1e-9;
@@ -255,15 +255,15 @@ function Ee(e, t, n, r) {
255
255
  tj: u
256
256
  };
257
257
  }
258
- function De(e, t = 256) {
258
+ function Oe(e, t = 256) {
259
259
  let n = e.length;
260
- if (n < 4 || n > t || !Te(e, t)) return [e];
260
+ if (n < 4 || n > t || !H(e, t)) return [e];
261
261
  let r = Array.from({ length: n }, () => []), i = 0;
262
262
  for (let t = 0; t < n; t++) {
263
263
  let a = e[t], o = e[(t + 1) % n];
264
264
  for (let s = t + 2; s < n; s++) {
265
265
  if (t === 0 && s === n - 1) continue;
266
- let c = Ee(a, o, e[s], e[(s + 1) % n]);
266
+ let c = De(a, o, e[s], e[(s + 1) % n]);
267
267
  c && (r[t].push({
268
268
  t: c.ti,
269
269
  id: i
@@ -318,7 +318,7 @@ function De(e, t = 256) {
318
318
  }
319
319
  //#endregion
320
320
  //#region src/components/ShapeEditor/_model/strings.ts
321
- var Oe = {
321
+ var U = {
322
322
  contextMenu: {
323
323
  copy: "복사",
324
324
  paste: "붙여넣기",
@@ -364,20 +364,20 @@ var Oe = {
364
364
  function ke(e) {
365
365
  return e ? {
366
366
  contextMenu: {
367
- ...Oe.contextMenu,
367
+ ...U.contextMenu,
368
368
  ...e.contextMenu
369
369
  },
370
370
  viewSettings: {
371
- ...Oe.viewSettings,
371
+ ...U.viewSettings,
372
372
  ...e.viewSettings
373
373
  },
374
374
  minimap: {
375
- ...Oe.minimap,
375
+ ...U.minimap,
376
376
  ...e.minimap
377
377
  },
378
- imageLoading: e.imageLoading ?? Oe.imageLoading,
379
- imageLoadError: e.imageLoadError ?? Oe.imageLoadError
380
- } : Oe;
378
+ imageLoading: e.imageLoading ?? U.imageLoading,
379
+ imageLoadError: e.imageLoadError ?? U.imageLoadError
380
+ } : U;
381
381
  }
382
382
  //#endregion
383
383
  //#region src/components/ShapeEditor/_model/tools.ts
@@ -405,9 +405,9 @@ var W = {
405
405
  keepZoomOnImageChange: !1,
406
406
  wheelZoom: !0,
407
407
  zoomSensitivity: 1
408
- }, G = "var(--editor-overlay-inverse-scale, 1)", je = "#377be2", Me = "#e23c3c";
408
+ }, je = "var(--editor-overlay-inverse-scale, 1)", G = "#377be2", Me = "#e23c3c";
409
409
  function Ne({ point: e }) {
410
- let t = e.positive ? je : Me;
410
+ let t = e.positive ? G : Me;
411
411
  return /* @__PURE__ */ v("div", {
412
412
  style: {
413
413
  position: "absolute",
@@ -428,7 +428,7 @@ function Ne({ point: e }) {
428
428
  display: "flex",
429
429
  alignItems: "center",
430
430
  justifyContent: "center",
431
- transform: `scale(${G})`,
431
+ transform: `scale(${je})`,
432
432
  transformOrigin: "center"
433
433
  },
434
434
  children: e.positive ? "+" : "−"
@@ -464,7 +464,7 @@ function Pe({ image: e, points: t, boxes: n, status: r }) {
464
464
  }
465
465
  //#endregion
466
466
  //#region src/components/ShapeEditor/_components/ContextMenu.tsx
467
- function K(e) {
467
+ function Fe(e) {
468
468
  let t = [];
469
469
  for (let n of e) if ("separator" in n) {
470
470
  if (!t.length || "separator" in t[t.length - 1]) continue;
@@ -473,8 +473,8 @@ function K(e) {
473
473
  for (; t.length && "separator" in t[t.length - 1];) t.pop();
474
474
  return t;
475
475
  }
476
- function Fe({ x: e, y: t, items: n, onClose: r }) {
477
- let i = K(n);
476
+ function Ie({ x: e, y: t, items: n, onClose: r }) {
477
+ let i = Fe(n);
478
478
  return /* @__PURE__ */ y(p, {
479
479
  open: !0,
480
480
  modal: !1,
@@ -525,7 +525,7 @@ function Fe({ x: e, y: t, items: n, onClose: r }) {
525
525
  }
526
526
  //#endregion
527
527
  //#region src/components/ShapeEditor/_components/CursorGuide.tsx
528
- function Ie({ color: e = "#1e88e5" }) {
528
+ function Le({ color: e = "#1e88e5" }) {
529
529
  let t = O(null), n = O(null), r = O(null);
530
530
  return S(() => {
531
531
  let e = t.current, i = n.current, a = r.current;
@@ -575,7 +575,7 @@ function Ie({ color: e = "#1e88e5" }) {
575
575
  }
576
576
  //#endregion
577
577
  //#region src/components/ShapeEditor/_components/ImageStateOverlay.tsx
578
- function Le({ status: e, render: t, loadingLabel: n = Oe.imageLoading, errorLabel: r = Oe.imageLoadError }) {
578
+ function Re({ status: e, render: t, loadingLabel: n = U.imageLoading, errorLabel: r = U.imageLoadError }) {
579
579
  return /* @__PURE__ */ v("div", {
580
580
  "data-track-id": e === "loading" ? "editor-image-loading-wrap" : "editor-image-error-wrap",
581
581
  style: {
@@ -628,7 +628,7 @@ function Le({ status: e, render: t, loadingLabel: n = Oe.imageLoading, errorLabe
628
628
  });
629
629
  }
630
630
  Math.PI / 12;
631
- var Re = "#00ff00", ze = "rgba(0, 255, 0, 0.1)", Be = "#669DEF", Ve = .1, He = [3, 3];
631
+ var K = "#00ff00", ze = "rgba(0, 255, 0, 0.1)", Be = "#669DEF", Ve = .1, He = [3, 3];
632
632
  //#endregion
633
633
  //#region src/components/ShapeEditor/_model/shapeRenderStyle.ts
634
634
  function Ue(e, t = {}) {
@@ -753,7 +753,7 @@ function Ke({ image: e, region: t, maskId: n, width: r, height: i, strokeWidth:
753
753
  }
754
754
  //#endregion
755
755
  //#region src/components/ShapeEditor/_components/SettingsPanel.tsx
756
- function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.viewSettings }) {
756
+ function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = U.viewSettings, openDown: f = !1, alignEnd: p = !1 }) {
757
757
  return S(() => {
758
758
  let e = (e) => {
759
759
  e.key === "Escape" && c();
@@ -762,7 +762,7 @@ function qe({ value: i, defaults: o, onChange: s, onClose: c, labels: d = Oe.vie
762
762
  window.removeEventListener("keydown", e), window.removeEventListener("pointerdown", t);
763
763
  };
764
764
  }, [c]), /* @__PURE__ */ y("div", {
765
- className: "aivex:absolute aivex:bottom-full aivex:left-0 aivex:mb-md aivex:flex aivex:w-[277px] aivex:flex-col aivex:gap-lg aivex:rounded-xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-xl aivex:text-text-primary aivex:shadow-[var(--aivex-elevation-md)]",
765
+ className: `aivex:absolute ${f ? "aivex:top-full aivex:mt-md" : "aivex:bottom-full aivex:mb-md"} ${p ? "aivex:right-0" : "aivex:left-0"} aivex:flex aivex:w-[277px] aivex:flex-col aivex:gap-lg aivex:rounded-xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-xl aivex:text-text-primary aivex:shadow-[var(--aivex-elevation-md)]`,
766
766
  onPointerDown: (e) => e.stopPropagation(),
767
767
  children: [
768
768
  /* @__PURE__ */ v("div", {
@@ -923,162 +923,172 @@ function Ye({ label: e, checked: t, onChange: n }) {
923
923
  }
924
924
  //#endregion
925
925
  //#region src/components/ShapeEditor/_components/Minimap.tsx
926
- var Xe = b(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r = !1, maskDataUrl: a, region: o, roiMaskId: l, shapes: p, view: m, viewDefaults: h, onChangeView: g, nav: _, registerShape: b, rectRef: x, zoomLabelRef: S, onZoom100: C, open: w, onToggleOpen: T, showSettings: E = !0, settingsOpen: D, onToggleSettings: O, onCloseSettings: k, labels: A = Oe.minimap, settingsLabels: j }) {
927
- let { offX: M, offY: N, dispW: P, dispH: ee, zoomCentered: te } = _, ne = {
926
+ var Xe = {
927
+ "bottom-left": "aivex:bottom-2 aivex:left-2",
928
+ "bottom-right": "aivex:bottom-2 aivex:right-2",
929
+ "top-left": "aivex:top-2 aivex:left-2",
930
+ "top-right": "aivex:top-2 aivex:right-2"
931
+ }, Ze = b(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r = !1, maskDataUrl: a, region: o, roiMaskId: l, shapes: p, view: m, viewDefaults: h, onChangeView: g, nav: _, registerShape: b, rectRef: x, zoomLabelRef: S, onZoom100: C, open: w, onToggleOpen: T, position: E = "bottom-left", showSettings: D = !0, settingsOpen: O, onToggleSettings: k, onCloseSettings: A, labels: j = U.minimap, settingsLabels: ee }) {
932
+ let { offX: M, offY: N, dispW: te, dispH: ne, zoomCentered: re } = _, P = E.startsWith("top"), F = {
928
933
  position: "absolute",
929
934
  left: M,
930
935
  top: N,
931
- width: P,
932
- height: ee
933
- };
934
- return /* @__PURE__ */ y("div", {
935
- className: "aivex:absolute aivex:bottom-2 aivex:left-2 aivex:w-[220px] aivex:rounded-[12px] aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-md aivex:shadow-[0_4px_12px_rgba(13,13,18,0.24)]",
936
- children: [/* @__PURE__ */ v("div", {
937
- className: `aivex:overflow-hidden aivex:rounded-sm aivex:transition-all aivex:duration-200 aivex:ease-in-out ${w ? "aivex:mb-md aivex:opacity-100" : "aivex:opacity-0"}`,
938
- style: { maxHeight: w ? 204 : 0 },
939
- children: /* @__PURE__ */ v("div", {
936
+ width: te,
937
+ height: ne
938
+ }, ae = /* @__PURE__ */ v("div", {
939
+ className: `aivex:overflow-hidden aivex:rounded-sm aivex:transition-all aivex:duration-200 aivex:ease-in-out ${w ? `${P ? "aivex:mt-md" : "aivex:mb-md"} aivex:opacity-100` : "aivex:opacity-0"}`,
940
+ style: { maxHeight: w ? 204 : 0 },
941
+ children: /* @__PURE__ */ v("div", {
942
+ style: {
943
+ width: 204,
944
+ height: 204
945
+ },
946
+ className: `aivex:relative aivex:touch-none aivex:overflow-hidden aivex:rounded-sm aivex:bg-static-gray ${r ? "aivex:cursor-default" : "aivex:cursor-grab aivex:active:cursor-grabbing"}`,
947
+ onPointerDown: r ? void 0 : _.handleMinimapPointerDown,
948
+ onPointerMove: r ? void 0 : _.handleMinimapPointerMove,
949
+ onPointerUp: r ? void 0 : _.endMinimapDrag,
950
+ onPointerCancel: r ? void 0 : _.endMinimapDrag,
951
+ onWheel: r ? void 0 : _.handleMinimapWheel,
952
+ "aria-busy": r,
953
+ children: /* @__PURE__ */ y("div", {
940
954
  style: {
941
- width: 204,
942
- height: 204
955
+ position: "absolute",
956
+ inset: 0,
957
+ opacity: +!!n,
958
+ transition: n ? "opacity 0.3s ease" : "none"
943
959
  },
944
- className: `aivex:relative aivex:touch-none aivex:overflow-hidden aivex:rounded-sm aivex:bg-static-gray ${r ? "aivex:cursor-default" : "aivex:cursor-grab aivex:active:cursor-grabbing"}`,
945
- onPointerDown: r ? void 0 : _.handleMinimapPointerDown,
946
- onPointerMove: r ? void 0 : _.handleMinimapPointerMove,
947
- onPointerUp: r ? void 0 : _.endMinimapDrag,
948
- onPointerCancel: r ? void 0 : _.endMinimapDrag,
949
- onWheel: r ? void 0 : _.handleMinimapWheel,
950
- "aria-busy": r,
951
- children: /* @__PURE__ */ y("div", {
952
- style: {
953
- position: "absolute",
954
- inset: 0,
955
- opacity: +!!n,
956
- transition: n ? "opacity 0.3s ease" : "none"
957
- },
958
- children: [
959
- t && /* @__PURE__ */ v("img", {
960
- src: t,
961
- alt: "",
962
- draggable: !1,
963
- style: ne
964
- }),
965
- a && m.showGuide && /* @__PURE__ */ v("img", {
966
- src: a,
967
- alt: "",
968
- draggable: !1,
969
- style: {
970
- ...ne,
971
- opacity: .55,
972
- imageRendering: "pixelated",
973
- pointerEvents: "none"
974
- }
975
- }),
976
- m.showRegionMask && o && o.rects.length > 0 && /* @__PURE__ */ v(Ke, {
977
- image: e,
978
- region: o,
979
- maskId: l,
980
- width: P,
981
- height: ee,
982
- strokeWidth: 1,
983
- strokeDasharray: "4 4",
984
- style: {
985
- position: "absolute",
986
- left: M,
987
- top: N,
988
- pointerEvents: "none"
989
- }
990
- }),
991
- /* @__PURE__ */ v("svg", {
992
- viewBox: `0 0 ${e.w} ${e.h}`,
993
- width: P,
994
- height: ee,
995
- style: {
996
- position: "absolute",
997
- left: M,
998
- top: N,
999
- pointerEvents: "none"
1000
- },
1001
- "aria-hidden": !0,
1002
- children: R(p).filter(ie).map((e) => /* @__PURE__ */ v(Ge, {
1003
- shape: e,
1004
- strokeSize: m.strokeSize,
1005
- register: b
1006
- }, e.id))
1007
- }),
1008
- /* @__PURE__ */ v("div", {
1009
- ref: x,
1010
- style: {
1011
- position: "absolute",
1012
- border: `1px solid ${Re}`,
1013
- background: ze,
1014
- boxSizing: "border-box",
1015
- pointerEvents: "none"
1016
- }
1017
- })
1018
- ]
1019
- })
1020
- })
1021
- }), /* @__PURE__ */ y("div", {
1022
- className: "aivex:relative aivex:flex aivex:items-center aivex:gap-xs",
1023
- children: [
1024
- /* @__PURE__ */ v(u, {
1025
- variant: "ghost",
1026
- size: "icon-md",
1027
- "aria-label": A.zoomOut,
1028
- onClick: () => te(1 / 1.2),
1029
- disabled: r,
1030
- children: /* @__PURE__ */ v(f, { size: 20 })
1031
- }),
1032
- /* @__PURE__ */ v(u, {
1033
- variant: "ghost",
1034
- size: "md",
1035
- "aria-label": A.zoom100,
1036
- onClick: C,
1037
- disabled: r,
1038
- className: "aivex:w-[60px] aivex:tabular-nums",
1039
- children: /* @__PURE__ */ v("span", {
1040
- ref: S,
1041
- children: "100%"
960
+ children: [
961
+ t && /* @__PURE__ */ v("img", {
962
+ src: t,
963
+ alt: "",
964
+ draggable: !1,
965
+ style: F
966
+ }),
967
+ a && m.showGuide && /* @__PURE__ */ v("img", {
968
+ src: a,
969
+ alt: "",
970
+ draggable: !1,
971
+ style: {
972
+ ...F,
973
+ opacity: .55,
974
+ imageRendering: "pixelated",
975
+ pointerEvents: "none"
976
+ }
977
+ }),
978
+ m.showRegionMask && o && o.rects.length > 0 && /* @__PURE__ */ v(Ke, {
979
+ image: e,
980
+ region: o,
981
+ maskId: l,
982
+ width: te,
983
+ height: ne,
984
+ strokeWidth: 1,
985
+ strokeDasharray: "4 4",
986
+ style: {
987
+ position: "absolute",
988
+ left: M,
989
+ top: N,
990
+ pointerEvents: "none"
991
+ }
992
+ }),
993
+ /* @__PURE__ */ v("svg", {
994
+ viewBox: `0 0 ${e.w} ${e.h}`,
995
+ width: te,
996
+ height: ne,
997
+ style: {
998
+ position: "absolute",
999
+ left: M,
1000
+ top: N,
1001
+ pointerEvents: "none"
1002
+ },
1003
+ "aria-hidden": !0,
1004
+ children: R(p).filter(ie).map((e) => /* @__PURE__ */ v(Ge, {
1005
+ shape: e,
1006
+ strokeSize: m.strokeSize,
1007
+ register: b
1008
+ }, e.id))
1009
+ }),
1010
+ /* @__PURE__ */ v("div", {
1011
+ ref: x,
1012
+ style: {
1013
+ position: "absolute",
1014
+ border: `1px solid ${K}`,
1015
+ background: ze,
1016
+ boxSizing: "border-box",
1017
+ pointerEvents: "none"
1018
+ }
1042
1019
  })
1043
- }),
1044
- /* @__PURE__ */ v(u, {
1045
- variant: "ghost",
1046
- size: "icon-md",
1047
- "aria-label": A.zoomIn,
1048
- onClick: () => te(1.2),
1049
- disabled: r,
1050
- children: /* @__PURE__ */ v(i, { size: 20 })
1051
- }),
1052
- E && /* @__PURE__ */ y("div", {
1053
- className: "aivex:relative",
1054
- children: [/* @__PURE__ */ v(u, {
1055
- variant: "ghost",
1056
- size: "icon-md",
1057
- "aria-label": A.viewSettings,
1058
- onClick: O,
1059
- onPointerDown: (e) => e.stopPropagation(),
1060
- className: D ? "aivex:text-text-brand" : void 0,
1061
- children: /* @__PURE__ */ v(d, { size: 20 })
1062
- }), D && /* @__PURE__ */ v(qe, {
1063
- value: m,
1064
- defaults: h,
1065
- onChange: g,
1066
- onClose: k,
1067
- labels: j
1068
- })]
1069
- }),
1070
- /* @__PURE__ */ v(u, {
1020
+ ]
1021
+ })
1022
+ })
1023
+ }), I = /* @__PURE__ */ y("div", {
1024
+ className: "aivex:relative aivex:flex aivex:items-center aivex:gap-xs",
1025
+ children: [
1026
+ /* @__PURE__ */ v(u, {
1027
+ variant: "ghost",
1028
+ size: "icon-md",
1029
+ "aria-label": j.zoomOut,
1030
+ onClick: () => re(1 / 1.2),
1031
+ disabled: r,
1032
+ children: /* @__PURE__ */ v(f, { size: 20 })
1033
+ }),
1034
+ /* @__PURE__ */ v(u, {
1035
+ variant: "ghost",
1036
+ size: "md",
1037
+ "aria-label": j.zoom100,
1038
+ onClick: C,
1039
+ disabled: r,
1040
+ className: "aivex:w-[60px] aivex:tabular-nums",
1041
+ children: /* @__PURE__ */ v("span", {
1042
+ ref: S,
1043
+ children: "100%"
1044
+ })
1045
+ }),
1046
+ /* @__PURE__ */ v(u, {
1047
+ variant: "ghost",
1048
+ size: "icon-md",
1049
+ "aria-label": j.zoomIn,
1050
+ onClick: () => re(1.2),
1051
+ disabled: r,
1052
+ children: /* @__PURE__ */ v(i, { size: 20 })
1053
+ }),
1054
+ D && /* @__PURE__ */ y("div", {
1055
+ className: "aivex:relative",
1056
+ children: [/* @__PURE__ */ v(u, {
1071
1057
  variant: "ghost",
1072
1058
  size: "icon-md",
1073
- "aria-label": A.toggleMinimap,
1074
- title: "(M)",
1075
- onClick: T,
1076
- children: v(w ? c : s, { size: 20 })
1077
- })
1078
- ]
1079
- })]
1059
+ "aria-label": j.viewSettings,
1060
+ onClick: k,
1061
+ onPointerDown: (e) => e.stopPropagation(),
1062
+ className: O ? "aivex:text-text-brand" : void 0,
1063
+ children: /* @__PURE__ */ v(d, { size: 20 })
1064
+ }), O && /* @__PURE__ */ v(qe, {
1065
+ value: m,
1066
+ defaults: h,
1067
+ onChange: g,
1068
+ onClose: A,
1069
+ labels: ee,
1070
+ openDown: P,
1071
+ alignEnd: E.endsWith("right")
1072
+ })]
1073
+ }),
1074
+ /* @__PURE__ */ v(u, {
1075
+ variant: "ghost",
1076
+ size: "icon-md",
1077
+ "aria-label": j.toggleMinimap,
1078
+ title: "(M)",
1079
+ onClick: T,
1080
+ children: w ? /* @__PURE__ */ v(c, {
1081
+ size: 20,
1082
+ className: P ? "aivex:rotate-180" : void 0
1083
+ }) : /* @__PURE__ */ v(s, { size: 20 })
1084
+ })
1085
+ ]
1086
+ });
1087
+ return /* @__PURE__ */ y("div", {
1088
+ className: `aivex:absolute ${Xe[E]} aivex:w-[220px] aivex:rounded-[12px] aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:p-md aivex:shadow-[0_4px_12px_rgba(13,13,18,0.24)]`,
1089
+ children: [P ? I : ae, P ? ae : I]
1080
1090
  });
1081
- }), Ze = "var(--editor-overlay-inverse-scale, 1)", Qe = 6, $e = {
1091
+ }), Qe = "var(--editor-overlay-inverse-scale, 1)", $e = 6, et = {
1082
1092
  fontFamily: "Pretendard, sans-serif",
1083
1093
  fontSize: 12,
1084
1094
  fontWeight: 500,
@@ -1087,7 +1097,7 @@ var Xe = b(function({ image: e, imageUrl: t, imageVisible: n = !0, loading: r =
1087
1097
  textShadow: "0 0 4px #000, 0 0 4px #000",
1088
1098
  whiteSpace: "nowrap"
1089
1099
  };
1090
- function et(e) {
1100
+ function tt(e) {
1091
1101
  let t = B(e);
1092
1102
  return {
1093
1103
  x: t.minX,
@@ -1096,25 +1106,25 @@ function et(e) {
1096
1106
  height: t.maxY - t.minY
1097
1107
  };
1098
1108
  }
1099
- function tt(e) {
1100
- return `translate3d(${e.width}px, ${e.height}px, 0) scale(${Ze}) translate(-100%, ${Qe}px)`;
1109
+ function nt(e) {
1110
+ return `translate3d(${e.width}px, ${e.height}px, 0) scale(${Qe}) translate(-100%, ${$e}px)`;
1101
1111
  }
1102
- function nt(e, t) {
1103
- let n = et(t);
1112
+ function rt(e, t) {
1113
+ let n = tt(t);
1104
1114
  e.style.transform = `translate3d(${n.x}px, ${n.y}px, 0)`;
1105
1115
  let r = e.querySelector("[data-selinfo-dim]");
1106
- return r && (r.style.transform = tt(n)), r;
1116
+ return r && (r.style.transform = nt(n)), r;
1107
1117
  }
1108
- function rt(e, t) {
1118
+ function it(e, t) {
1109
1119
  return {
1110
1120
  shape: e,
1111
- ...et(t)
1121
+ ...tt(t)
1112
1122
  };
1113
1123
  }
1114
- function it(e) {
1124
+ function at(e) {
1115
1125
  return `${Math.round(e.width)} x ${Math.round(e.height)} px`;
1116
1126
  }
1117
- function at({ color: e, striped: t }) {
1127
+ function ot({ color: e, striped: t }) {
1118
1128
  return /* @__PURE__ */ v("span", { style: {
1119
1129
  display: "inline-block",
1120
1130
  width: 12,
@@ -1126,9 +1136,9 @@ function at({ color: e, striped: t }) {
1126
1136
  } : { background: e }
1127
1137
  } });
1128
1138
  }
1129
- function ot({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i }) {
1139
+ function st({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i }) {
1130
1140
  return /* @__PURE__ */ v(_, { children: e.map((e) => {
1131
- let a = et(e.points), o = e.type === F.POINT, s = o ? void 0 : t?.(e), c = e.style?.color ?? "#00e5ff", l = !!e.style?.dashed || !!e.style?.dash, u = rt(e, e.points), d = r ? r(u) : it(u);
1141
+ let a = tt(e.points), o = e.type === F.POINT, s = o ? void 0 : t?.(e), c = e.style?.color ?? "#00e5ff", l = !!e.style?.dashed || !!e.style?.dash, u = it(e, e.points), d = r ? r(u) : at(u);
1132
1142
  return /* @__PURE__ */ y("div", {
1133
1143
  ref: (t) => i(e.id, t),
1134
1144
  style: {
@@ -1147,11 +1157,11 @@ function ot({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i })
1147
1157
  display: "flex",
1148
1158
  alignItems: "center",
1149
1159
  gap: 4,
1150
- transform: `scale(${Ze}) translateY(calc(-100% - ${Qe}px))`,
1160
+ transform: `scale(${Qe}) translateY(calc(-100% - ${$e}px))`,
1151
1161
  transformOrigin: "left top",
1152
- ...$e
1162
+ ...et
1153
1163
  },
1154
- children: [!n && /* @__PURE__ */ v(at, {
1164
+ children: [!n && /* @__PURE__ */ v(ot, {
1155
1165
  color: c,
1156
1166
  striped: l
1157
1167
  }), /* @__PURE__ */ v("span", { children: s })]
@@ -1161,10 +1171,10 @@ function ot({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i })
1161
1171
  position: "absolute",
1162
1172
  left: 0,
1163
1173
  top: 0,
1164
- transform: tt(a),
1174
+ transform: nt(a),
1165
1175
  transformOrigin: "left top",
1166
1176
  willChange: "transform",
1167
- ...$e
1177
+ ...et
1168
1178
  },
1169
1179
  children: d
1170
1180
  })]
@@ -1173,79 +1183,79 @@ function ot({ shapes: e, getLabel: t, hideDot: n, formatInfo: r, register: i })
1173
1183
  }
1174
1184
  //#endregion
1175
1185
  //#region src/components/ShapeEditor/_model/clipboard.ts
1176
- var q = "AIVEX_SHAPE_EDITOR:", st = 1, ct = new Set(Object.values(F)), J = null, lt = "unavailable", ut = 0;
1177
- function dt(e) {
1186
+ var q = "AIVEX_SHAPE_EDITOR:", ct = 1, lt = new Set(Object.values(F)), J = null, ut = "unavailable", dt = 0;
1187
+ function ft(e) {
1178
1188
  if (!e || typeof e != "object") return !1;
1179
1189
  let t = e;
1180
1190
  return Number.isFinite(t.x) && Number.isFinite(t.y);
1181
1191
  }
1182
- function ft(e) {
1192
+ function pt(e) {
1183
1193
  if (!e || typeof e != "object") return !1;
1184
1194
  let t = e;
1185
- return typeof t.type == "string" && ct.has(t.type) && Array.isArray(t.points) && t.points.length > 0 && t.points.every(dt);
1195
+ return typeof t.type == "string" && lt.has(t.type) && Array.isArray(t.points) && t.points.length > 0 && t.points.every(ft);
1186
1196
  }
1187
- function pt(e, t, n) {
1197
+ function mt(e, t, n) {
1188
1198
  return {
1189
1199
  kind: "aivex-shape-editor",
1190
- version: st,
1200
+ version: ct,
1191
1201
  scope: n,
1192
1202
  documentId: t,
1193
1203
  shapes: e
1194
1204
  };
1195
1205
  }
1196
- function mt(e) {
1206
+ function ht(e) {
1197
1207
  let t = 2166136261;
1198
1208
  for (let n = 0; n < e.length; n += 1) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
1199
1209
  return `fnv1a:${(t >>> 0).toString(36)}`;
1200
1210
  }
1201
- function ht(e) {
1211
+ function gt(e) {
1202
1212
  return `${q}${JSON.stringify(e)}`;
1203
1213
  }
1204
1214
  function Y(e) {
1205
1215
  if (!e.startsWith(q)) return null;
1206
1216
  try {
1207
1217
  let t = JSON.parse(e.slice(19));
1208
- return t.kind !== "aivex-shape-editor" || t.version !== st || !Array.isArray(t.shapes) || t.shapes.length === 0 || !t.shapes.every(ft) || t.scope !== void 0 && typeof t.scope != "string" || t.documentId !== void 0 && typeof t.documentId != "string" ? null : t;
1218
+ return t.kind !== "aivex-shape-editor" || t.version !== ct || !Array.isArray(t.shapes) || t.shapes.length === 0 || !t.shapes.every(pt) || t.scope !== void 0 && typeof t.scope != "string" || t.documentId !== void 0 && typeof t.documentId != "string" ? null : t;
1209
1219
  } catch {
1210
1220
  return null;
1211
1221
  }
1212
1222
  }
1213
- function gt(e) {
1223
+ function _t(e) {
1214
1224
  J = e;
1215
- let t = ++ut;
1225
+ let t = ++dt;
1216
1226
  if (typeof navigator > "u" || !navigator.clipboard?.writeText) {
1217
- lt = "unavailable";
1227
+ ut = "unavailable";
1218
1228
  return;
1219
1229
  }
1220
1230
  let n;
1221
1231
  try {
1222
- n = ht(e);
1232
+ n = gt(e);
1223
1233
  } catch {
1224
- lt = "unavailable";
1234
+ ut = "unavailable";
1225
1235
  return;
1226
1236
  }
1227
- lt = "pending", navigator.clipboard.writeText(n).then(() => {
1228
- t === ut && (lt = "written");
1237
+ ut = "pending", navigator.clipboard.writeText(n).then(() => {
1238
+ t === dt && (ut = "written");
1229
1239
  }, () => {
1230
- t === ut && (lt = "unavailable");
1240
+ t === dt && (ut = "unavailable");
1231
1241
  });
1232
1242
  }
1233
- function _t(e, t) {
1243
+ function vt(e, t) {
1234
1244
  return !!e && e.scope === t;
1235
1245
  }
1236
1246
  function X(e) {
1237
- return _t(J, e) || typeof navigator < "u" && typeof navigator.clipboard?.readText == "function";
1247
+ return vt(J, e) || typeof navigator < "u" && typeof navigator.clipboard?.readText == "function";
1238
1248
  }
1239
- async function vt(e) {
1240
- let t = _t(J, e) ? J : null;
1241
- if (t && lt !== "written") return t;
1249
+ async function yt(e) {
1250
+ let t = vt(J, e) ? J : null;
1251
+ if (t && ut !== "written") return t;
1242
1252
  if (typeof navigator < "u" && navigator.clipboard?.readText) try {
1243
1253
  let t = Y(await navigator.clipboard.readText());
1244
1254
  return t?.scope === e ? (J = t, t) : null;
1245
1255
  } catch {}
1246
1256
  return t;
1247
1257
  }
1248
- function yt(e, t, n) {
1258
+ function bt(e, t, n) {
1249
1259
  return {
1250
1260
  offset: n * (t ? e : e + 1),
1251
1261
  nextPasteCount: e + 1
@@ -1253,7 +1263,7 @@ function yt(e, t, n) {
1253
1263
  }
1254
1264
  //#endregion
1255
1265
  //#region src/components/ShapeEditor/_model/cursors.ts
1256
- var bt = new Set([
1266
+ var xt = new Set([
1257
1267
  W.RECTANGLE,
1258
1268
  W.ROTATED_RECTANGLE,
1259
1269
  W.CIRCLE,
@@ -1264,7 +1274,7 @@ var bt = new Set([
1264
1274
  W.ASSISTANT_POLYGON,
1265
1275
  W.ASSISTANT_RECT,
1266
1276
  W.ASSISTANT_POINT
1267
- ]), xt = {
1277
+ ]), St = {
1268
1278
  tl: -135,
1269
1279
  t: -90,
1270
1280
  tr: -45,
@@ -1273,21 +1283,21 @@ var bt = new Set([
1273
1283
  b: 90,
1274
1284
  bl: 135,
1275
1285
  l: 180
1276
- }, St = [
1286
+ }, Ct = [
1277
1287
  "ew-resize",
1278
1288
  "nwse-resize",
1279
1289
  "ns-resize",
1280
1290
  "nesw-resize"
1281
1291
  ];
1282
- function Ct(e, t = 0) {
1283
- let n = ((xt[e] + t * 180 / Math.PI) % 180 + 180) % 180;
1284
- return St[Math.round(n / 45) % 4];
1292
+ function wt(e, t = 0) {
1293
+ let n = ((St[e] + t * 180 / Math.PI) % 180 + 180) % 180;
1294
+ return Ct[Math.round(n / 45) % 4];
1285
1295
  }
1286
- function wt({ tool: e, externalToolCursor: t, isSpacePressed: n, isPolygonDrawing: r }) {
1287
- return n ? "grab" : t || (e === W.SELECT ? "default" : bt.has(e) ? r ? "default" : "crosshair" : "default");
1296
+ function Tt({ tool: e, externalToolCursor: t, isSpacePressed: n, isPolygonDrawing: r }) {
1297
+ return n ? "grab" : t || (e === W.SELECT ? "default" : xt.has(e) ? r ? "default" : "crosshair" : "default");
1288
1298
  }
1289
- function Tt({ tool: e, externalToolCursor: t, isSpacePressed: n, interactionMode: r, rendererCursorHint: i, isPolygonDrawing: a }) {
1290
- return r === "marquee" ? "default" : r === "moving" || r === "panning" || r === "vertexDragging" ? "grabbing" : r === "resizing" || r === "rotating" ? i ?? "grabbing" : r === "drawing" ? "crosshair" : n ? "grab" : t || (e === W.SELECT && i ? i : wt({
1299
+ function Et({ tool: e, externalToolCursor: t, isSpacePressed: n, interactionMode: r, rendererCursorHint: i, isPolygonDrawing: a }) {
1300
+ return r === "marquee" ? "default" : r === "moving" || r === "panning" || r === "vertexDragging" ? "grabbing" : r === "resizing" || r === "rotating" ? i ?? "grabbing" : r === "drawing" ? "crosshair" : n ? "grab" : t || (e === W.SELECT && i ? i : Tt({
1291
1301
  tool: e,
1292
1302
  externalToolCursor: t,
1293
1303
  isSpacePressed: n,
@@ -1296,7 +1306,7 @@ function Tt({ tool: e, externalToolCursor: t, isSpacePressed: n, interactionMode
1296
1306
  }
1297
1307
  //#endregion
1298
1308
  //#region src/components/ShapeEditor/_model/overlays.ts
1299
- var Et = (e) => Math.min(255, Math.max(0, e)), Dt = (e) => {
1309
+ var Dt = (e) => Math.min(255, Math.max(0, e)), Ot = (e) => {
1300
1310
  let t = e.replace("#", "").trim();
1301
1311
  if (![
1302
1312
  3,
@@ -1310,13 +1320,13 @@ var Et = (e) => Math.min(255, Math.max(0, e)), Dt = (e) => {
1310
1320
  c(o),
1311
1321
  c(s)
1312
1322
  ];
1313
- return l.some((e) => Number.isNaN(e)) ? null : l.map(Et);
1314
- }, Ot = (e, t) => {
1323
+ return l.some((e) => Number.isNaN(e)) ? null : l.map(Dt);
1324
+ }, kt = (e, t) => {
1315
1325
  let { width: n, height: r, indices: i, transparent: a } = e;
1316
1326
  if (!n || !r || i.length < n * r) return null;
1317
1327
  let o = {};
1318
1328
  for (let [e, n] of Object.entries(t)) {
1319
- let t = Dt(n);
1329
+ let t = Ot(n);
1320
1330
  t && (o[Number(e)] = t);
1321
1331
  }
1322
1332
  if (!Object.keys(o).length) return null;
@@ -1335,12 +1345,12 @@ var Et = (e) => Math.min(255, Math.max(0, e)), Dt = (e) => {
1335
1345
  }
1336
1346
  return c.putImageData(new ImageData(l, n, r), 0, 0), s;
1337
1347
  };
1338
- function kt(e, t) {
1348
+ function At(e, t) {
1339
1349
  e.beginPath(), e.moveTo(t[0].x, t[0].y);
1340
1350
  for (let n = 1; n < t.length; n += 1) e.lineTo(t[n].x, t[n].y);
1341
1351
  e.closePath();
1342
1352
  }
1343
- var At = (e) => [
1353
+ var jt = (e) => [
1344
1354
  {
1345
1355
  x: e.x,
1346
1356
  y: e.y
@@ -1358,7 +1368,7 @@ var At = (e) => [
1358
1368
  y: e.y + e.h
1359
1369
  }
1360
1370
  ];
1361
- function jt(e, t) {
1371
+ function Mt(e, t) {
1362
1372
  let n = !1;
1363
1373
  for (let r = 0, i = t.length - 1; r < t.length; i = r, r += 1) {
1364
1374
  let a = t[r], o = t[i];
@@ -1369,7 +1379,7 @@ function jt(e, t) {
1369
1379
  }
1370
1380
  return n;
1371
1381
  }
1372
- function Mt(e, t, n) {
1382
+ function Nt(e, t, n) {
1373
1383
  let r = [], i = t.x - e.x, a = t.y - e.y;
1374
1384
  for (let t = 0; t < n.length; t += 1) {
1375
1385
  let o = n[t], s = n[(t + 1) % n.length], c = s.x - o.x, l = s.y - o.y, u = i * l - a * c;
@@ -1379,15 +1389,15 @@ function Mt(e, t, n) {
1379
1389
  }
1380
1390
  return r;
1381
1391
  }
1382
- function Nt(e, t, n) {
1392
+ function Pt(e, t, n) {
1383
1393
  let r = .001, i = [], a = (e, t, n) => ({
1384
1394
  x: e.x + (t.x - e.x) * n,
1385
1395
  y: e.y + (t.y - e.y) * n
1386
1396
  });
1387
1397
  for (let o of e) if (!(o.length < 2)) for (let e = 0; e < o.length; e += 1) {
1388
1398
  let s = o[e], c = o[(e + 1) % o.length], l = [0, 1];
1389
- for (let e of t) e !== o && l.push(...Mt(s, c, e));
1390
- if (n) for (let e of n) l.push(...Mt(s, c, e));
1399
+ for (let e of t) e !== o && l.push(...Nt(s, c, e));
1400
+ if (n) for (let e of n) l.push(...Nt(s, c, e));
1391
1401
  let u = Math.hypot(c.x - s.x, c.y - s.y);
1392
1402
  if (!u) continue;
1393
1403
  let d = -(c.y - s.y) / u * r, f = (c.x - s.x) / u * r;
@@ -1401,13 +1411,13 @@ function Nt(e, t, n) {
1401
1411
  }, h = {
1402
1412
  x: p.x - d,
1403
1413
  y: p.y - f
1404
- }, g = jt(m, o) ? m : h, _ = g === m ? h : m;
1405
- t.some((e) => e !== o && jt(_, e)) || n && !n.some((e) => jt(g, e)) || i.push([a(s, c, r), a(s, c, u)]);
1414
+ }, g = Mt(m, o) ? m : h, _ = g === m ? h : m;
1415
+ t.some((e) => e !== o && Mt(_, e)) || n && !n.some((e) => Mt(g, e)) || i.push([a(s, c, r), a(s, c, u)]);
1406
1416
  }
1407
1417
  }
1408
1418
  return i;
1409
1419
  }
1410
- function Pt(e) {
1420
+ function Ft(e) {
1411
1421
  let t = [...new Set(e.flatMap((e) => [e.x, e.x + e.w]))].sort((e, t) => e - t), n = [];
1412
1422
  for (let r = 0; r + 1 < t.length; r += 1) {
1413
1423
  let i = t[r], a = t[r + 1];
@@ -1428,18 +1438,18 @@ function Pt(e) {
1428
1438
  }
1429
1439
  return n;
1430
1440
  }
1431
- function Ft(e, t, n, r) {
1441
+ function It(e, t, n, r) {
1432
1442
  e.save(), e.globalAlpha *= t.dim.opacity, e.fillStyle = t.dim.color, e.beginPath(), e.rect(0, 0, n, r);
1433
1443
  for (let n of t.dimHoles) e.moveTo(n.x, n.y), e.lineTo(n.x, n.y + n.h), e.lineTo(n.x + n.w, n.y + n.h), e.lineTo(n.x + n.w, n.y), e.closePath();
1434
1444
  if (e.fill(), t.zones.length) {
1435
1445
  e.beginPath();
1436
1446
  for (let n of t.rects) e.rect(n.x, n.y, n.w, n.h);
1437
1447
  e.clip();
1438
- for (let n of t.zones) kt(e, n.points), e.fill();
1448
+ for (let n of t.zones) At(e, n.points), e.fill();
1439
1449
  }
1440
1450
  e.restore();
1441
1451
  }
1442
- function It(e) {
1452
+ function Lt(e) {
1443
1453
  let t = [];
1444
1454
  for (let n of e) if (!(n.length < 2)) for (let e = 0; e < n.length; e += 1) t.push([n[e], n[(e + 1) % n.length]]);
1445
1455
  return t;
@@ -1447,19 +1457,19 @@ function It(e) {
1447
1457
  var Z = {
1448
1458
  color: "#000000",
1449
1459
  opacity: .5
1450
- }, Lt = {
1460
+ }, Rt = {
1451
1461
  color: "#ffffff",
1452
1462
  opacity: 1,
1453
1463
  width: 2,
1454
1464
  dash: [6, 6],
1455
1465
  underlayColor: "#000000"
1456
- }, Rt = {
1466
+ }, zt = {
1457
1467
  color: "#dc2626",
1458
1468
  opacity: .8,
1459
1469
  width: 2,
1460
1470
  dash: [6, 6],
1461
1471
  underlayColor: "#000000"
1462
- }, zt = (e, t, n) => {
1472
+ }, Bt = (e, t, n) => {
1463
1473
  let r = e.occludedAreas?.filter((e) => e.points.length >= 3) ?? [];
1464
1474
  if (!t || !n || !e.visibleAreas.length && !r.length) return null;
1465
1475
  let i = e.visibleAreas, a = i.length ? i : [{
@@ -1467,7 +1477,7 @@ var Z = {
1467
1477
  y: 0,
1468
1478
  w: t,
1469
1479
  h: n
1470
- }], o = Pt(a), s = {
1480
+ }], o = Ft(a), s = {
1471
1481
  ...Z,
1472
1482
  ...e.dim
1473
1483
  }, c = e.outline;
@@ -1482,36 +1492,36 @@ var Z = {
1482
1492
  };
1483
1493
  let l = {
1484
1494
  visible: {
1485
- ...Lt,
1495
+ ...Rt,
1486
1496
  ...c?.visibleStyle
1487
1497
  },
1488
1498
  occluded: {
1489
- ...Rt,
1499
+ ...zt,
1490
1500
  ...c?.occludedStyle
1491
1501
  }
1492
- }, u = i.map(At), d = a.map(At), f = r.map((e) => e.points);
1502
+ }, u = i.map(jt), d = a.map(jt), f = r.map((e) => e.points);
1493
1503
  return c?.mode === "separate" ? {
1494
1504
  rects: a,
1495
1505
  zones: r,
1496
1506
  dimHoles: o,
1497
1507
  dim: s,
1498
- visibleOutline: It(u),
1499
- occludedOutline: It(f),
1508
+ visibleOutline: Lt(u),
1509
+ occludedOutline: Lt(f),
1500
1510
  outlineStyles: l
1501
1511
  } : {
1502
1512
  rects: a,
1503
1513
  zones: r,
1504
1514
  dimHoles: o,
1505
1515
  dim: s,
1506
- visibleOutline: [...Nt(u, [...u, ...f], null), ...Nt(f, f, d)],
1516
+ visibleOutline: [...Pt(u, [...u, ...f], null), ...Pt(f, f, d)],
1507
1517
  occludedOutline: [],
1508
1518
  outlineStyles: l
1509
1519
  };
1510
- }, Bt = .3, Vt = .05;
1511
- function Ht(e) {
1520
+ }, Vt = .3, Ht = .05;
1521
+ function Ut(e) {
1512
1522
  return 1 - (1 - e) ** 3;
1513
1523
  }
1514
- function Ut(e) {
1524
+ function Wt(e) {
1515
1525
  return {
1516
1526
  x: e.minX,
1517
1527
  y: e.minY,
@@ -1519,7 +1529,7 @@ function Ut(e) {
1519
1529
  height: Math.max(0, e.maxY - e.minY)
1520
1530
  };
1521
1531
  }
1522
- function Wt(e, t) {
1532
+ function Gt(e, t) {
1523
1533
  if (!t.length) return null;
1524
1534
  if (e === F.POINT) {
1525
1535
  let e = t[0];
@@ -1538,10 +1548,10 @@ function Wt(e, t) {
1538
1548
  height: i
1539
1549
  };
1540
1550
  }
1541
- function Gt(e) {
1551
+ function Kt(e) {
1542
1552
  if (!e.length) return null;
1543
- let t = e.map((e) => Wt(e.type, e.points)).filter((e) => e !== null);
1544
- return t.length ? Ut(B(t.flatMap((e) => [{
1553
+ let t = e.map((e) => Gt(e.type, e.points)).filter((e) => e !== null);
1554
+ return t.length ? Wt(B(t.flatMap((e) => [{
1545
1555
  x: e.x,
1546
1556
  y: e.y
1547
1557
  }, {
@@ -1549,8 +1559,8 @@ function Gt(e) {
1549
1559
  y: e.y + e.height
1550
1560
  }]))) : null;
1551
1561
  }
1552
- function Kt(e, t, n, r = {}) {
1553
- let { containerRatio: i = Bt, minScale: a = Vt, maxScale: o = 20 } = r;
1562
+ function qt(e, t, n, r = {}) {
1563
+ let { containerRatio: i = Vt, minScale: a = Ht, maxScale: o = 20 } = r;
1554
1564
  if (!t || !n || e.width <= 0 || e.height <= 0) return null;
1555
1565
  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;
1556
1566
  return {
@@ -1559,18 +1569,18 @@ function Kt(e, t, n, r = {}) {
1559
1569
  y: n / 2 - u * c
1560
1570
  };
1561
1571
  }
1562
- function qt(e, t, n, r = 80) {
1572
+ function Jt(e, t, n, r = 80) {
1563
1573
  if (!t || !n) return null;
1564
- let i = Math.max(1, e.maxX - e.minX), a = Math.max(1, e.maxY - e.minY), o = Math.max(Vt, Math.min(20, Math.min((t - r) / i, (n - r) / a))), s = (e.minX + e.maxX) / 2, c = (e.minY + e.maxY) / 2;
1574
+ let i = Math.max(1, e.maxX - e.minX), a = Math.max(1, e.maxY - e.minY), o = Math.max(Ht, Math.min(20, Math.min((t - r) / i, (n - r) / a))), s = (e.minX + e.maxX) / 2, c = (e.minY + e.maxY) / 2;
1565
1575
  return {
1566
1576
  scale: o,
1567
1577
  x: t / 2 - s * o,
1568
1578
  y: n / 2 - c * o
1569
1579
  };
1570
1580
  }
1571
- function Jt(e, t, n, r = 300) {
1581
+ function Yt(e, t, n, r = 300) {
1572
1582
  let i = Date.now(), a = 0, o = () => {
1573
- let s = Date.now() - i, c = Math.min(s / r, 1), l = Ht(c);
1583
+ let s = Date.now() - i, c = Math.min(s / r, 1), l = Ut(c);
1574
1584
  n({
1575
1585
  scale: e.scale + (t.scale - e.scale) * l,
1576
1586
  x: e.x + (t.x - e.x) * l,
@@ -1581,10 +1591,10 @@ function Jt(e, t, n, r = 300) {
1581
1591
  }
1582
1592
  //#endregion
1583
1593
  //#region src/components/ShapeEditor/_state/createInteractionController.ts
1584
- function Yt(e) {
1585
- 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, editingIdRef: g, drawSessionRef: _, assistantRef: v, setCursorHint: y, setInteractionMode: b, syncMinimap: x, onTransformPreview: S, onDrawPreview: C } = e, w = () => _.current, T = () => v.current, E = null, D = null, O = null, k = null, A = null, j = null, M = "", N = null, P = null, ee = (e) => e === W.RECTANGLE || e === W.ROTATED_RECTANGLE || e === W.CIRCLE, te = (e) => e === W.ASSISTANT_POLYGON || e === W.ASSISTANT_RECT, ne = (e) => e === W.POLYGON, re = (e, t) => {
1594
+ function Xt(e) {
1595
+ 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, editingIdRef: g, drawSessionRef: _, assistantRef: v, setCursorHint: y, setInteractionMode: b, syncMinimap: x, onTransformPreview: S, onDrawPreview: C } = e, w = () => _.current, T = () => v.current, E = null, D = null, O = null, k = null, A = null, j = null, ee = "", M = null, N = null, te = (e) => e === W.RECTANGLE || e === W.ROTATED_RECTANGLE || e === W.CIRCLE, ne = (e) => e === W.ASSISTANT_POLYGON || e === W.ASSISTANT_RECT, re = (e) => e === W.POLYGON, P = (e, t) => {
1586
1596
  let n = !1;
1587
- D && !ee(t) && !te(t) && (D = null, e.clearPreview(), C(null), n = !0), (O === "path" && t !== W.PATH || O === "scalar" && t !== W.BRUSH) && (O = null, n = !0), k && !ne(t) && (k = null, n = !0), A && t !== W.SELECT && (A = null, j = null, e.clearMarquee(), n = !0), N && t !== W.POINT && (N = null, n = !0), n && b("idle");
1597
+ D && !te(t) && !ne(t) && (D = null, e.clearPreview(), C(null), n = !0), (O === "path" && t !== W.PATH || O === "scalar" && t !== W.BRUSH) && (O = null, n = !0), k && !re(t) && (k = null, n = !0), A && t !== W.SELECT && (A = null, j = null, e.clearMarquee(), n = !0), M && t !== W.POINT && (M = null, n = !0), n && b("idle");
1588
1598
  }, ie = () => r.current.get(n.current), ae = (e, t, n, r) => ({
1589
1599
  point: t,
1590
1600
  targetId: r,
@@ -1599,7 +1609,7 @@ function Yt(e) {
1599
1609
  let p = t.current;
1600
1610
  if (!p) return;
1601
1611
  let _ = n.current;
1602
- if (N = null, re(p, _), u.button === 1 || i.current) {
1612
+ if (M = null, P(p, _), u.button === 1 || i.current) {
1603
1613
  b("panning"), y(null), E = {
1604
1614
  px: u.global.x,
1605
1615
  py: u.global.y
@@ -1626,7 +1636,7 @@ function Yt(e) {
1626
1636
  u.altKey ? T().addPoint(e, u.button !== 2) : T().newPolygon(e);
1627
1637
  return;
1628
1638
  }
1629
- if (te(_) && c.current) {
1639
+ if (ne(_) && c.current) {
1630
1640
  D = e, b("drawing");
1631
1641
  return;
1632
1642
  }
@@ -1645,8 +1655,8 @@ function Yt(e) {
1645
1655
  if (r && _ === W.SELECT) {
1646
1656
  let t = o.current.getShapes().find((e) => e.id === r);
1647
1657
  if (!t || !I(t)) return;
1648
- let n = typeof performance < "u" ? performance.now() : 0, i = !!P && P.id === r && n - P.t < 300;
1649
- P = {
1658
+ let n = typeof performance < "u" ? performance.now() : 0, i = !!N && N.id === r && n - N.t < 300;
1659
+ N = {
1650
1660
  id: r,
1651
1661
  t: n
1652
1662
  };
@@ -1663,11 +1673,11 @@ function Yt(e) {
1663
1673
  m.current(u), !l.current && L(t) && p.beginMove(e, u);
1664
1674
  return;
1665
1675
  }
1666
- if (ee(_) && c.current) {
1676
+ if (te(_) && c.current) {
1667
1677
  D = e, b("drawing");
1668
1678
  return;
1669
1679
  }
1670
- if (ne(_) && c.current) {
1680
+ if (re(_) && c.current) {
1671
1681
  if (!w().getDraftPointsSnapshot().length && s.current.length && m.current([]), w().tryClosePolygon(e, 12 / p.viewport.scale)) return;
1672
1682
  let t = w().hitDraftPoint(e);
1673
1683
  if (t >= 0) {
@@ -1697,7 +1707,7 @@ function Yt(e) {
1697
1707
  return;
1698
1708
  }
1699
1709
  if (_ === W.POINT && c.current && u.button === 0) {
1700
- N = {
1710
+ M = {
1701
1711
  pointerId: u.pointerId,
1702
1712
  global: u.global,
1703
1713
  cancelled: !1
@@ -1715,13 +1725,13 @@ function Yt(e) {
1715
1725
  }
1716
1726
  }
1717
1727
  }
1718
- A = e, M = "", b("marquee"), y(null);
1728
+ A = e, ee = "", b("marquee"), y(null);
1719
1729
  }
1720
1730
  },
1721
1731
  onPointerMove: (e, r) => {
1722
1732
  let i = t.current;
1723
1733
  if (!i) return;
1724
- if (N && N.pointerId === r.pointerId && Math.hypot(r.global.x - N.global.x, r.global.y - N.global.y) > 4 && (N.cancelled = !0), E) {
1734
+ if (M && M.pointerId === r.pointerId && Math.hypot(r.global.x - M.global.x, r.global.y - M.global.y) > 4 && (M.cancelled = !0), E) {
1725
1735
  i.applyViewport({
1726
1736
  scale: i.viewport.scale,
1727
1737
  x: i.viewport.x + (r.global.x - E.px),
@@ -1730,7 +1740,7 @@ function Yt(e) {
1730
1740
  return;
1731
1741
  }
1732
1742
  let s = n.current;
1733
- re(i, s);
1743
+ P(i, s);
1734
1744
  let l = ie();
1735
1745
  if (l) {
1736
1746
  l.onPointerMove?.(ae(i, e, r));
@@ -1741,12 +1751,12 @@ function Yt(e) {
1741
1751
  k.moved = k.moved || Math.hypot(t, n) > .5, w().moveDraftPoints(k.base, k.indices, t, n);
1742
1752
  return;
1743
1753
  }
1744
- if (D && (ee(s) || te(s))) {
1754
+ if (D && (te(s) || ne(s))) {
1745
1755
  let t = a.current ? le(D, e) : e;
1746
1756
  i.previewBox(s === W.CIRCLE ? "ellipse" : "rect", D, t, {
1747
1757
  ...c.current,
1748
1758
  color: c.current?.color ?? "#00e5ff"
1749
- }), ee(s) && C({
1759
+ }), te(s) && C({
1750
1760
  type: s === W.CIRCLE ? F.ELLIPSE : F.RECTANGLE,
1751
1761
  points: [D, t]
1752
1762
  });
@@ -1756,7 +1766,7 @@ function Yt(e) {
1756
1766
  w().appendStrokePoint(e, 2 / i.viewport.scale);
1757
1767
  return;
1758
1768
  }
1759
- if (ne(s) && w().hasDraftPoints()) {
1769
+ if (re(s) && w().hasDraftPoints()) {
1760
1770
  w().setDraftCursor(e);
1761
1771
  return;
1762
1772
  }
@@ -1770,23 +1780,23 @@ function Yt(e) {
1770
1780
  };
1771
1781
  if (i.previewMarquee(A, e), j) {
1772
1782
  let e = (o.current.getShapes().find((e) => e.id === g.current)?.points ?? []).flatMap((e, n) => e.x >= t.minX && e.x <= t.maxX && e.y >= t.minY && e.y <= t.maxY ? [n] : []), n = [...new Set([...j, ...e])].sort((e, t) => e - t), r = n.join(",");
1773
- r !== M && (M = r, i.setVertexSelection(n));
1783
+ r !== ee && (ee = r, i.setVertexSelection(n));
1774
1784
  return;
1775
1785
  }
1776
1786
  let n = i.shapesIntersecting(t), r = n.join(",");
1777
- r !== M && (M = r, m.current(n));
1787
+ r !== ee && (ee = r, m.current(n));
1778
1788
  }
1779
1789
  },
1780
1790
  onPointerUp: (e, r) => {
1781
1791
  let i = t.current;
1782
1792
  if (!i) return;
1783
- let o = N;
1784
- if (N = null, E) {
1793
+ let o = M;
1794
+ if (M = null, E) {
1785
1795
  E = null, b("idle");
1786
1796
  return;
1787
1797
  }
1788
1798
  let l = n.current;
1789
- if (re(i, l), k) {
1799
+ if (P(i, l), k) {
1790
1800
  w().commitDraftPointDrag(k.moved), k = null, b("idle");
1791
1801
  return;
1792
1802
  }
@@ -1805,7 +1815,7 @@ function Yt(e) {
1805
1815
  O = null, b("idle"), e === "path" ? w().completeFreehandStroke() : w().finishScalarStroke();
1806
1816
  return;
1807
1817
  }
1808
- if (D && te(l)) {
1818
+ if (D && ne(l)) {
1809
1819
  let t = D;
1810
1820
  D = null, b("idle"), i.clearPreview();
1811
1821
  let n = {
@@ -1817,7 +1827,7 @@ function Yt(e) {
1817
1827
  n.width > 2 && n.height > 2 && T().beginBox(n, l === W.ASSISTANT_RECT ? "rect" : "polygon");
1818
1828
  return;
1819
1829
  }
1820
- if (D && ee(l)) {
1830
+ if (D && te(l)) {
1821
1831
  let t = a.current ? le(D, e) : e, n = D;
1822
1832
  D = null, b("idle"), i.clearPreview(), C(null), Math.abs(t.x - n.x) > 2 && Math.abs(t.y - n.y) > 2 && (l === W.ROTATED_RECTANGLE ? p.current(F.ROTATED_RECTANGLE, de([n, t])) : l === W.CIRCLE ? p.current(F.POLYGON, fe(n, t)) : p.current(F.RECTANGLE, [n, t]));
1823
1833
  return;
@@ -1844,7 +1854,7 @@ function Yt(e) {
1844
1854
  }
1845
1855
  //#endregion
1846
1856
  //#region src/components/ShapeEditor/_state/useAssistant.ts
1847
- function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistantRef: i }) {
1857
+ function Zt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistantRef: i }) {
1848
1858
  let [a, o] = k("idle"), [s, c] = k([]), [l, u] = k([]), d = O([]), f = O([]), p = O([]), m = O("idle"), h = O(0), g = O(null), _ = O(null), v = O(0), y = x((e) => {
1849
1859
  d.current = e(d.current), u(d.current);
1850
1860
  }, []), b = x((e) => {
@@ -2009,17 +2019,17 @@ function Xt({ docRef: e, draftRef: t, draftMeta: n, changeSelection: r, assistan
2009
2019
  }
2010
2020
  //#endregion
2011
2021
  //#region src/components/ShapeEditor/_model/brush.ts
2012
- function Zt(e, t, n) {
2022
+ function Qt(e, t, n) {
2013
2023
  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);
2014
2024
  return i === 0 ? 0 : r * 2 / i;
2015
2025
  }
2016
- function Qt(e, t = 1.5) {
2026
+ function $t(e, t = 1.5) {
2017
2027
  if (e.length <= 2) return e;
2018
2028
  let n = (e, t) => {
2019
2029
  if (e.length < 3) return e;
2020
2030
  let r = 0, i = 0, a = e.length - 1;
2021
2031
  for (let t = 1; t < a; t++) {
2022
- let n = Zt(e[t], e[0], e[a]);
2032
+ let n = Qt(e[t], e[0], e[a]);
2023
2033
  n > r && (i = t, r = n);
2024
2034
  }
2025
2035
  if (r > t) {
@@ -2032,8 +2042,8 @@ function Qt(e, t = 1.5) {
2032
2042
  }
2033
2043
  //#endregion
2034
2044
  //#region src/components/ShapeEditor/_model/scalarMask.ts
2035
- var $t = 4096, en = 4;
2036
- function tn(e) {
2045
+ var en = 4096, tn = 4;
2046
+ function nn(e) {
2037
2047
  let t = 0;
2038
2048
  for (let n = 0; n < e.length; n++) {
2039
2049
  let r = e[n], i = e[(n + 1) % e.length];
@@ -2041,17 +2051,17 @@ function tn(e) {
2041
2051
  }
2042
2052
  return Math.abs(t / 2);
2043
2053
  }
2044
- function nn(e, t, n) {
2054
+ function rn(e, t, n) {
2045
2055
  let r = new Uint8Array(t * n);
2046
2056
  for (let i = 0; i < t * n; i++) r[i] = e[i * 4 + 3] > 128 ? 255 : 0;
2047
2057
  return r;
2048
2058
  }
2049
- function rn(e) {
2059
+ function an(e) {
2050
2060
  let t = new Uint8ClampedArray(e.length * 4);
2051
2061
  for (let n = 0; n < e.length; n++) e[n] > 128 && (t[n * 4 + 3] = 255);
2052
2062
  return t;
2053
2063
  }
2054
- function an(e, t, n, r, i) {
2064
+ function on(e, t, n, r, i) {
2055
2065
  let a = new Uint8Array(t * n), o = [[r, i]];
2056
2066
  for (; o.length;) {
2057
2067
  let [r, i] = o.pop(), s = i * t + r;
@@ -2059,8 +2069,8 @@ function an(e, t, n, r, i) {
2059
2069
  }
2060
2070
  return a;
2061
2071
  }
2062
- function on(e, t, n) {
2063
- let r = nn(e, t, n), i = [];
2072
+ function sn(e, t, n) {
2073
+ let r = rn(e, t, n), i = [];
2064
2074
  for (;;) {
2065
2075
  let e = -1, a = -1;
2066
2076
  outer: for (let i = 0; i < n; i++) for (let n = 0; n < t; n++) if (r[i * t + n] > 128) {
@@ -2068,17 +2078,17 @@ function on(e, t, n) {
2068
2078
  break outer;
2069
2079
  }
2070
2080
  if (e < 0) break;
2071
- let o = cn(rn(an(r, t, n, e, a)), t, n);
2081
+ let o = ln(an(on(r, t, n, e, a)), t, n);
2072
2082
  o.length >= 3 && i.push(o);
2073
2083
  }
2074
2084
  return i;
2075
2085
  }
2076
- function sn(e, t, n, r, i) {
2086
+ function cn(e, t, n, r, i) {
2077
2087
  return r < 0 || i < 0 || r >= t || i >= n ? !1 : e[(i * t + r) * 4 + 3] > 128;
2078
2088
  }
2079
- function cn(e, t, n) {
2089
+ function ln(e, t, n) {
2080
2090
  let r = -1, i = -1;
2081
- outer: for (let a = 0; a < n; a++) for (let o = 0; o < t; o++) if (sn(e, t, n, o, a)) {
2091
+ outer: for (let a = 0; a < n; a++) for (let o = 0; o < t; o++) if (cn(e, t, n, o, a)) {
2082
2092
  r = o, i = a;
2083
2093
  break outer;
2084
2094
  }
@@ -2113,7 +2123,7 @@ function cn(e, t, n) {
2113
2123
  let r = !1;
2114
2124
  for (let i = 0; i < 8; i++) {
2115
2125
  let s = (u + i) % 8, d = c + a[s], f = l + o[s];
2116
- if (sn(e, t, n, d, f)) {
2126
+ if (cn(e, t, n, d, f)) {
2117
2127
  c = d, l = f, u = (s + 6) % 8, r = !0;
2118
2128
  break;
2119
2129
  }
@@ -2122,13 +2132,13 @@ function cn(e, t, n) {
2122
2132
  } while (c !== d.x || l !== d.y || s.length === 1);
2123
2133
  return s;
2124
2134
  }
2125
- function ln(e, t) {
2135
+ function un(e, t) {
2126
2136
  let n = [];
2127
2137
  for (let t of e) for (let e of t.points) n.push(e);
2128
2138
  for (let e of t) for (let t of e) n.push(t);
2129
2139
  return n;
2130
2140
  }
2131
- function un(e) {
2141
+ function dn(e) {
2132
2142
  switch (e.type) {
2133
2143
  case F.RECTANGLE: return e.points.length < 2 ? null : de(e.points);
2134
2144
  case F.POLYGON:
@@ -2147,14 +2157,14 @@ function un(e) {
2147
2157
  default: return null;
2148
2158
  }
2149
2159
  }
2150
- function dn(e) {
2151
- return e.map(un).filter((e) => !!e && e.length >= 3);
2160
+ function fn(e) {
2161
+ return e.map(dn).filter((e) => !!e && e.length >= 3);
2152
2162
  }
2153
- function fn(e, t, n = []) {
2163
+ function pn(e, t, n = []) {
2154
2164
  if (t <= 0 || !e.length && !n.length) return null;
2155
- let r = ln(e, n);
2165
+ let r = un(e, n);
2156
2166
  if (!r.length) return null;
2157
- let i = t + 4, a = B(r), o = Math.ceil(a.maxX - a.minX + i * 2), s = Math.ceil(a.maxY - a.minY + i * 2), c = Math.min(1, $t / Math.max(o, s, 1));
2167
+ let i = t + 4, a = B(r), o = Math.ceil(a.maxX - a.minX + i * 2), s = Math.ceil(a.maxY - a.minY + i * 2), c = Math.min(1, en / Math.max(o, s, 1));
2158
2168
  o = Math.max(1, Math.ceil(o * c)), s = Math.max(1, Math.ceil(s * c));
2159
2169
  let l = a.minX - i, u = a.minY - i, d = (e) => ({
2160
2170
  x: (e.x - l) * c,
@@ -2193,20 +2203,20 @@ function fn(e, t, n = []) {
2193
2203
  scale: c
2194
2204
  };
2195
2205
  }
2196
- function pn(e, t = 1.5) {
2197
- let { canvas: n, ox: r, oy: i, scale: a } = e, o = on(n.getContext("2d").getImageData(0, 0, n.width, n.height).data, n.width, n.height);
2206
+ function mn(e, t = 1.5) {
2207
+ let { canvas: n, ox: r, oy: i, scale: a } = e, o = sn(n.getContext("2d").getImageData(0, 0, n.width, n.height).data, n.width, n.height);
2198
2208
  if (!o.length) return [];
2199
2209
  let s = (e) => ({
2200
2210
  x: e.x / a + r,
2201
2211
  y: e.y / a + i
2202
2212
  }), c = [];
2203
2213
  for (let e of o) {
2204
- let n = e.map(s), r = Qt(n, t), i = r.length >= 3 ? r : n;
2205
- i.length >= 3 && tn(i) >= en && c.push(i);
2214
+ let n = e.map(s), r = $t(n, t), i = r.length >= 3 ? r : n;
2215
+ i.length >= 3 && nn(i) >= tn && c.push(i);
2206
2216
  }
2207
2217
  return c;
2208
2218
  }
2209
- function mn(e, t) {
2219
+ function hn(e, t) {
2210
2220
  let { canvas: n } = e, r = document.createElement("canvas");
2211
2221
  r.width = n.width, r.height = n.height;
2212
2222
  let i = r.getContext("2d");
@@ -2214,30 +2224,30 @@ function mn(e, t) {
2214
2224
  }
2215
2225
  //#endregion
2216
2226
  //#region src/components/ShapeEditor/_state/drawSessionState.ts
2217
- function hn(e) {
2227
+ function gn(e) {
2218
2228
  return e.map((e) => ({
2219
2229
  mode: e.mode,
2220
2230
  points: e.points.map((e) => ({ ...e }))
2221
2231
  }));
2222
2232
  }
2223
- function gn(e, t) {
2233
+ function _n(e, t) {
2224
2234
  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));
2225
2235
  }
2226
- function _n(e) {
2236
+ function vn(e) {
2227
2237
  return e.map((e) => ({ ...e }));
2228
2238
  }
2229
- function vn(e, t) {
2239
+ function yn(e, t) {
2230
2240
  return e.length === t.length && e.every((e, n) => e.x === t[n].x && e.y === t[n].y);
2231
2241
  }
2232
2242
  //#endregion
2233
2243
  //#region src/components/ShapeEditor/_state/useDrawSession.ts
2234
- var yn = 10;
2235
- function bn(e, t) {
2244
+ var bn = 10;
2245
+ function xn(e, t) {
2236
2246
  if (e.active !== t.active || e.kind !== t.kind || e.canUndo !== t.canUndo || e.canRedo !== t.canRedo) return !1;
2237
2247
  let n = e.brush, r = t.brush;
2238
2248
  return !n || !r ? n === r : n.mode === r.mode && n.editing === r.editing && n.editTargetIds.length === r.editTargetIds.length && n.editTargetIds.every((e, t) => e === r.editTargetIds[t]);
2239
2249
  }
2240
- function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, brushSizeRef: a, simplifyEpsilonRef: o, draftMeta: s, engineRef: c, onDrawSessionChange: l, onDraftShapeChange: u, changeSelection: d, createShape: f }) {
2250
+ function Sn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, brushSizeRef: a, simplifyEpsilonRef: o, draftMeta: s, engineRef: c, onDrawSessionChange: l, onDraftShapeChange: u, changeSelection: d, createShape: f }) {
2241
2251
  let p = O(l);
2242
2252
  p.current = l;
2243
2253
  let m = O(u);
@@ -2246,17 +2256,17 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2246
2256
  h.current = s;
2247
2257
  let g = O(f);
2248
2258
  g.current = f;
2249
- let _ = O(null), v = O([]), y = O(null), b = O(/* @__PURE__ */ new Set()), S = O([[]]), C = O(0), w = O(null), T = O([]), E = O([]), D = O([]), k = O([[]]), A = O(0), j = O("draw"), M = () => j.current === "erase" ? "erase" : "add", N = () => D.current.length > 0 || T.current.length > 0 || e.current === W.BRUSH && v.current.length > 0, P = () => {
2259
+ let _ = O(null), v = O([]), y = O(null), b = O(/* @__PURE__ */ new Set()), S = O([[]]), C = O(0), w = O(null), T = O([]), E = O([]), D = O([]), k = O([[]]), A = O(0), j = O("draw"), ee = () => j.current === "erase" ? "erase" : "add", M = () => D.current.length > 0 || T.current.length > 0 || e.current === W.BRUSH && v.current.length > 0, N = () => {
2250
2260
  let t = e.current;
2251
- return t === W.BRUSH && N() ? "brush" : t === W.POLYGON && v.current.length > 0 ? "polygon" : t === W.PATH && v.current.length > 0 ? "path" : "none";
2252
- }, ee = () => v.current.length > 0 || A.current > 0, te = () => v.current.length === 0 && A.current < k.current.length - 1, ne = () => C.current > 0, re = () => C.current < S.current.length - 1, ie = () => {
2261
+ return t === W.BRUSH && M() ? "brush" : t === W.POLYGON && v.current.length > 0 ? "polygon" : t === W.PATH && v.current.length > 0 ? "path" : "none";
2262
+ }, te = () => v.current.length > 0 || A.current > 0, ne = () => v.current.length === 0 && A.current < k.current.length - 1, re = () => C.current > 0, P = () => C.current < S.current.length - 1, ie = () => {
2253
2263
  let t = e.current;
2254
- return t === W.BRUSH ? ee() : t === W.POLYGON || t === W.PATH ? ne() : !1;
2264
+ return t === W.BRUSH ? te() : t === W.POLYGON || t === W.PATH ? re() : !1;
2255
2265
  }, ae = () => {
2256
2266
  let t = e.current;
2257
- return t === W.BRUSH ? te() : t === W.POLYGON || t === W.PATH ? re() : !1;
2258
- }, I = () => P() !== "none", L = x(() => {
2259
- let e = P(), t = {
2267
+ return t === W.BRUSH ? ne() : t === W.POLYGON || t === W.PATH ? P() : !1;
2268
+ }, I = () => N() !== "none", L = x(() => {
2269
+ let e = N(), t = {
2260
2270
  active: e !== "none",
2261
2271
  kind: e,
2262
2272
  canUndo: ie(),
@@ -2267,7 +2277,7 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2267
2277
  editTargetIds: [...D.current]
2268
2278
  } : void 0
2269
2279
  }, n = _.current;
2270
- n && bn(n, t) || (_.current = t, p.current?.(t));
2280
+ n && xn(n, t) || (_.current = t, p.current?.(t));
2271
2281
  }, []), R = x(() => {
2272
2282
  k.current = [[]], A.current = 0;
2273
2283
  }, []), z = x(() => {
@@ -2278,12 +2288,12 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2278
2288
  let e = [...T.current];
2279
2289
  if (v.current.length && e.push({
2280
2290
  points: v.current,
2281
- mode: M()
2291
+ mode: ee()
2282
2292
  }), !e.length && !E.current.length) {
2283
2293
  t.clearPreview();
2284
2294
  return;
2285
2295
  }
2286
- let n = fn(e, a.current, E.current);
2296
+ let n = pn(e, a.current, E.current);
2287
2297
  if (!n) {
2288
2298
  t.clearPreview();
2289
2299
  return;
@@ -2305,7 +2315,7 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2305
2315
  let e = m.current;
2306
2316
  e && r !== w.current && (w.current = r, e({
2307
2317
  type: F.POLYGON,
2308
- points: _n(r),
2318
+ points: vn(r),
2309
2319
  meta: h.current
2310
2320
  }));
2311
2321
  }
@@ -2315,11 +2325,11 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2315
2325
  c,
2316
2326
  e
2317
2327
  ]), B = x((e) => {
2318
- let t = hn(e), n = k.current, r = A.current, i = n[r];
2319
- i && gn(i, t) || (k.current = [...n.slice(0, r + 1), t], A.current += 1, L());
2328
+ let t = gn(e), n = k.current, r = A.current, i = n[r];
2329
+ i && _n(i, t) || (k.current = [...n.slice(0, r + 1), t], A.current += 1, L());
2320
2330
  }, [L]), ce = x((e) => {
2321
2331
  let t = S.current, n = C.current, r = t[n];
2322
- r && vn(r, e) || (S.current = [...t.slice(0, n + 1), _n(e)], C.current += 1);
2332
+ r && yn(r, e) || (S.current = [...t.slice(0, n + 1), vn(e)], C.current += 1);
2323
2333
  }, []), V = x(() => {
2324
2334
  v.current = [], T.current = [], E.current = [], D.current = [], y.current = null, b.current = /* @__PURE__ */ new Set(), S.current = [[]], C.current = 0, w.current = null, R(), c.current?.clearPreview(), m.current?.(null), L();
2325
2335
  }, [
@@ -2332,7 +2342,7 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2332
2342
  L,
2333
2343
  ce,
2334
2344
  z
2335
- ]), ue = x(() => _n(v.current), []), de = x(() => v.current.length > 0, []), fe = x((t, n) => {
2345
+ ]), ue = x(() => vn(v.current), []), de = x(() => v.current.length > 0, []), fe = x((t, n) => {
2336
2346
  if (e.current !== W.POLYGON) return !1;
2337
2347
  let r = v.current;
2338
2348
  if (r.length < 3) return !1;
@@ -2346,65 +2356,65 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2346
2356
  if (e < 0 || e >= n.length) return null;
2347
2357
  let r = new Set(b.current);
2348
2358
  return t ? r.has(e) ? r.delete(e) : r.add(e) : r.has(e) || (r.clear(), r.add(e)), b.current = r, y.current = null, z(), L(), {
2349
- base: _n(n),
2359
+ base: vn(n),
2350
2360
  indices: Array.from(r)
2351
2361
  };
2352
- }, [L, z]), H = x((e) => {
2362
+ }, [L, z]), he = x((e) => {
2353
2363
  b.current = /* @__PURE__ */ new Set(), y.current = e, le([...v.current, e], !0);
2354
- }, [le]), he = x((e) => {
2364
+ }, [le]), ge = x((e) => {
2355
2365
  y.current = null, b.current = /* @__PURE__ */ new Set(), v.current = [{ ...e }], z(), L();
2356
- }, [L, z]), ge = x((e, t) => {
2366
+ }, [L, z]), _e = x((e, t) => {
2357
2367
  let n = v.current[v.current.length - 1];
2358
2368
  return n && Math.hypot(e.x - n.x, e.y - n.y) < t ? !1 : (v.current = [...v.current, { ...e }], y.current = null, z(), L(), !0);
2359
- }, [L, z]), _e = x((e, t, n, r) => {
2369
+ }, [L, z]), ve = x((e, t, n, r) => {
2360
2370
  let i = new Set(t);
2361
2371
  v.current = e.map((e, t) => i.has(t) ? {
2362
2372
  x: e.x + n,
2363
2373
  y: e.y + r
2364
2374
  } : { ...e }), y.current = null, z(), L();
2365
- }, [L, z]), ve = x((e) => {
2375
+ }, [L, z]), ye = x((e) => {
2366
2376
  e && (ce(v.current), z(), L());
2367
2377
  }, [
2368
2378
  L,
2369
2379
  ce,
2370
2380
  z
2371
- ]), ye = x((e) => {
2381
+ ]), be = x((e) => {
2372
2382
  y.current = e ? { ...e } : null, z();
2373
- }, [z]), be = x(() => v.current.length > 0 ? (v.current = [], z(), L(), !0) : A.current <= 0 ? !1 : (--A.current, T.current = hn(k.current[A.current]), z(), L(), !0), [L, z]), xe = x(() => v.current.length > 0 || A.current >= k.current.length - 1 ? !1 : (A.current += 1, T.current = hn(k.current[A.current]), z(), L(), !0), [L, z]), Se = x(() => C.current <= 0 ? !1 : (--C.current, v.current = _n(S.current[C.current]), b.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), Ce = x(() => C.current >= S.current.length - 1 ? !1 : (C.current += 1, v.current = _n(S.current[C.current]), b.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), we = x(() => {
2383
+ }, [z]), xe = x(() => v.current.length > 0 ? (v.current = [], z(), L(), !0) : A.current <= 0 ? !1 : (--A.current, T.current = gn(k.current[A.current]), z(), L(), !0), [L, z]), Se = x(() => v.current.length > 0 || A.current >= k.current.length - 1 ? !1 : (A.current += 1, T.current = gn(k.current[A.current]), z(), L(), !0), [L, z]), Ce = x(() => C.current <= 0 ? !1 : (--C.current, v.current = vn(S.current[C.current]), b.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), we = x(() => C.current >= S.current.length - 1 ? !1 : (C.current += 1, v.current = vn(S.current[C.current]), b.current = /* @__PURE__ */ new Set(), z(), L(), !0), [L, z]), Te = x(() => {
2374
2384
  let t = e.current;
2375
- return t === W.BRUSH ? be() : t === W.POLYGON || t === W.PATH ? Se() : !1;
2385
+ return t === W.BRUSH ? xe() : t === W.POLYGON || t === W.PATH ? Ce() : !1;
2376
2386
  }, [
2377
2387
  e,
2378
- be,
2379
- Se
2380
- ]), U = x(() => {
2388
+ xe,
2389
+ Ce
2390
+ ]), Ee = x(() => {
2381
2391
  let t = e.current;
2382
- return t === W.BRUSH ? xe() : t === W.POLYGON || t === W.PATH ? Ce() : !1;
2392
+ return t === W.BRUSH ? Se() : t === W.POLYGON || t === W.PATH ? we() : !1;
2383
2393
  }, [
2384
- xe,
2385
- Ce,
2394
+ Se,
2395
+ we,
2386
2396
  e
2387
- ]), Te = x(() => {
2397
+ ]), H = x(() => {
2388
2398
  let e = t.current;
2389
2399
  if (!e.length) return D.current.length > 0;
2390
- let r = n.current.getShapes().filter((t) => e.includes(t.id) && oe(t)), i = dn(r);
2400
+ let r = n.current.getShapes().filter((t) => e.includes(t.id) && oe(t)), i = fn(r);
2391
2401
  return i.length ? (D.current = r.map((e) => e.id), E.current = i, !0) : (D.current = [], E.current = [], !1);
2392
- }, [n, t]), Ee = x(() => {
2402
+ }, [n, t]), De = x(() => {
2393
2403
  if (r.current) return !1;
2394
2404
  let e = [...T.current];
2395
2405
  v.current.length && e.push({
2396
- points: _n(v.current),
2397
- mode: M()
2406
+ points: vn(v.current),
2407
+ mode: ee()
2398
2408
  });
2399
2409
  let t = E.current, c = [...D.current];
2400
2410
  if (!e.length && !t.length) return !1;
2401
- let l = fn(e, a.current, t);
2411
+ let l = pn(e, a.current, t);
2402
2412
  if (!l) return V(), !1;
2403
- let u = pn(l, o.current);
2413
+ let u = mn(l, o.current);
2404
2414
  if (c.length) {
2405
2415
  let e = n.current.getShapes().filter((e) => c.includes(e.id));
2406
2416
  if (!u.length) return n.current.remove(c), V(), d([]), !0;
2407
- u.sort((e, t) => tn(t) - tn(e));
2417
+ u.sort((e, t) => nn(t) - nn(e));
2408
2418
  let t = [], r = [], i = [];
2409
2419
  for (let n = 0; n < u.length; n++) {
2410
2420
  let a = u[n];
@@ -2447,19 +2457,19 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2447
2457
  i,
2448
2458
  r,
2449
2459
  V
2450
- ]), De = x(() => {
2460
+ ]), Oe = x(() => {
2451
2461
  let t = e.current;
2452
- if (t === W.BRUSH) return Ee();
2462
+ if (t === W.BRUSH) return De();
2453
2463
  let n = v.current;
2454
2464
  return t === W.POLYGON && n.length >= 3 ? (g.current(F.POLYGON, n), V(), !0) : !1;
2455
2465
  }, [
2456
- Ee,
2466
+ De,
2457
2467
  V,
2458
2468
  e
2459
- ]), Oe = x(() => {
2469
+ ]), U = x(() => {
2460
2470
  let t = v.current;
2461
2471
  if (e.current === W.PATH && t.length >= 3) {
2462
- let e = Qt(t, o.current);
2472
+ let e = $t(t, o.current);
2463
2473
  e.length >= 3 && g.current(F.POLYGON, e);
2464
2474
  }
2465
2475
  V();
@@ -2468,24 +2478,24 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2468
2478
  }, [L, z]), Ae = x(() => {
2469
2479
  if (r.current || e.current !== W.BRUSH) return !1;
2470
2480
  T.current = [], v.current = [], R();
2471
- let t = Te();
2481
+ let t = H();
2472
2482
  return L(), z(), t;
2473
2483
  }, [
2474
2484
  L,
2475
2485
  r,
2476
2486
  z,
2477
2487
  R,
2478
- Te,
2488
+ H,
2479
2489
  e
2480
- ]), G = x(() => {
2490
+ ]), je = x(() => {
2481
2491
  let e = b.current;
2482
2492
  if (!e.size) return !1;
2483
2493
  let t = v.current.filter((t, n) => !e.has(n));
2484
2494
  return b.current = /* @__PURE__ */ new Set(), le(t, !0), !0;
2485
- }, [le]), je = x((e) => {
2495
+ }, [le]), G = x((e) => {
2486
2496
  let t = c.current, n = v.current;
2487
2497
  if (!t || !n.length) return -1;
2488
- let r = yn / (t.viewport.scale || 1);
2498
+ let r = bn / (t.viewport.scale || 1);
2489
2499
  for (let t = n.length - 1; t >= 0; t--) {
2490
2500
  let i = n[t];
2491
2501
  if (Math.hypot(e.x - i.x, e.y - i.y) <= r) return t;
@@ -2493,8 +2503,8 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2493
2503
  return -1;
2494
2504
  }, [c]), Me = x(() => {
2495
2505
  v.current.length >= 1 && (T.current.push({
2496
- points: _n(v.current),
2497
- mode: M()
2506
+ points: vn(v.current),
2507
+ mode: ee()
2498
2508
  }), v.current = [], B(T.current)), z(), L();
2499
2509
  }, [
2500
2510
  L,
@@ -2503,34 +2513,34 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2503
2513
  ]);
2504
2514
  return {
2505
2515
  reset: V,
2506
- undoSession: we,
2507
- redoSession: U,
2516
+ undoSession: Te,
2517
+ redoSession: Ee,
2508
2518
  canUndoSession: ie,
2509
2519
  canRedoSession: ae,
2510
2520
  hasDraftSession: I,
2511
2521
  hasDraftPoints: de,
2512
- commitDraftSession: De,
2513
- completeFreehandStroke: Oe,
2522
+ commitDraftSession: Oe,
2523
+ completeFreehandStroke: U,
2514
2524
  setBrushScalarMode: ke,
2515
2525
  getBrushScalarMode: () => j.current,
2516
- hasBrushSession: N,
2517
- commitBrush: Ee,
2526
+ hasBrushSession: M,
2527
+ commitBrush: De,
2518
2528
  cancelBrush: x(() => {
2519
2529
  e.current === W.BRUSH && V();
2520
2530
  }, [V, e]),
2521
2531
  beginBrushEditFromSelection: Ae,
2522
- deleteDraftSelectedPoints: G,
2523
- hitDraftPoint: je,
2532
+ deleteDraftSelectedPoints: je,
2533
+ hitDraftPoint: G,
2524
2534
  getDraftPointsSnapshot: ue,
2525
2535
  tryClosePolygon: fe,
2526
2536
  removeDraftPoint: pe,
2527
2537
  selectDraftPointForDrag: me,
2528
- appendPolygonPoint: H,
2529
- beginStroke: he,
2530
- appendStrokePoint: ge,
2531
- moveDraftPoints: _e,
2532
- commitDraftPointDrag: ve,
2533
- setDraftCursor: ye,
2538
+ appendPolygonPoint: he,
2539
+ beginStroke: ge,
2540
+ appendStrokePoint: _e,
2541
+ moveDraftPoints: ve,
2542
+ commitDraftPointDrag: ye,
2543
+ setDraftCursor: be,
2534
2544
  finishScalarStroke: Me,
2535
2545
  handleToolChange: x((e, t) => {
2536
2546
  if (t) {
@@ -2541,13 +2551,13 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2541
2551
  V(), j.current = "draw";
2542
2552
  return;
2543
2553
  }
2544
- j.current = "draw", T.current = [], v.current = [], R(), Te(), L(), z();
2554
+ j.current = "draw", T.current = [], v.current = [], R(), H(), L(), z();
2545
2555
  }, [
2546
2556
  L,
2547
2557
  z,
2548
2558
  V,
2549
2559
  R,
2550
- Te
2560
+ H
2551
2561
  ]),
2552
2562
  handleBrushSelectionChange: x((t, n) => {
2553
2563
  if (!(e.current !== W.BRUSH || n)) {
@@ -2555,44 +2565,44 @@ function xn({ toolRef: e, selRef: t, docRef: n, readOnlyRef: r, draftRef: i, bru
2555
2565
  L();
2556
2566
  return;
2557
2567
  }
2558
- [...t].sort().join(",") !== [...D.current].sort().join(",") && (T.current.length || v.current.length || (T.current = [], v.current = [], R(), Te(), L(), z()));
2568
+ [...t].sort().join(",") !== [...D.current].sort().join(",") && (T.current.length || v.current.length || (T.current = [], v.current = [], R(), H(), L(), z()));
2559
2569
  }
2560
2570
  }, [
2561
2571
  L,
2562
2572
  z,
2563
2573
  R,
2564
- Te,
2574
+ H,
2565
2575
  e
2566
2576
  ])
2567
2577
  };
2568
2578
  }
2569
2579
  //#endregion
2570
2580
  //#region src/components/ShapeEditor/_state/useEditorDocument.ts
2571
- function Sn(e, t) {
2581
+ function Cn(e, t) {
2572
2582
  return {
2573
2583
  shapes: t,
2574
2584
  past: [...e.past, e.shapes],
2575
2585
  future: []
2576
2586
  };
2577
2587
  }
2578
- function Cn(e, t) {
2588
+ function wn(e, t) {
2579
2589
  switch (t.type) {
2580
- case "CREATE": return Sn(e, [...e.shapes, ...t.shapes]);
2590
+ case "CREATE": return Cn(e, [...e.shapes, ...t.shapes]);
2581
2591
  case "UPDATE": {
2582
2592
  let n = new Map(t.shapes.map((e) => [e.id, e]));
2583
- return Sn(e, e.shapes.map((e) => n.get(e.id) ?? e));
2593
+ return Cn(e, e.shapes.map((e) => n.get(e.id) ?? e));
2584
2594
  }
2585
2595
  case "DELETE": {
2586
2596
  let n = new Set(t.ids);
2587
- return Sn(e, e.shapes.filter((e) => !n.has(e.id)));
2597
+ return Cn(e, e.shapes.filter((e) => !n.has(e.id)));
2588
2598
  }
2589
2599
  case "REPLACE": {
2590
2600
  let n = new Set(t.removeIds);
2591
- return Sn(e, [...e.shapes.filter((e) => !n.has(e.id)), ...t.shapes]);
2601
+ return Cn(e, [...e.shapes.filter((e) => !n.has(e.id)), ...t.shapes]);
2592
2602
  }
2593
2603
  case "REORDER": {
2594
2604
  let n = new Set(t.ids), r = e.shapes.filter((e) => n.has(e.id)), i = e.shapes.filter((e) => !n.has(e.id));
2595
- return r.length === 0 ? e : Sn(e, t.edge === "front" ? [...i, ...r] : [...r, ...i]);
2605
+ return r.length === 0 ? e : Cn(e, t.edge === "front" ? [...i, ...r] : [...r, ...i]);
2596
2606
  }
2597
2607
  case "RESET": return {
2598
2608
  shapes: t.shapes,
@@ -2612,15 +2622,15 @@ function Cn(e, t) {
2612
2622
  default: return e;
2613
2623
  }
2614
2624
  }
2615
- function wn(e) {
2616
- let { onShapesCreated: t, onShapesUpdated: n, onShapesDeleted: r } = e, [i, a] = D(Cn, {
2625
+ function Tn(e) {
2626
+ let { onShapesCreated: t, onShapesUpdated: n, onShapesDeleted: r } = e, [i, a] = D(wn, {
2617
2627
  shapes: [],
2618
2628
  past: [],
2619
2629
  future: []
2620
2630
  }), o = O(i);
2621
2631
  o.current = i;
2622
2632
  let s = x((e) => {
2623
- o.current = Cn(o.current, e), a(e);
2633
+ o.current = wn(o.current, e), a(e);
2624
2634
  }, []), c = x((e, i) => {
2625
2635
  let a = new Map(e.map((e) => [e.id, e])), o = new Map(i.map((e) => [e.id, e])), s = i.filter((e) => !a.has(e.id));
2626
2636
  s.length && t?.(s);
@@ -2689,7 +2699,7 @@ function wn(e) {
2689
2699
  }
2690
2700
  //#endregion
2691
2701
  //#region src/components/ShapeEditor/_model/keymap.ts
2692
- var Tn = {
2702
+ var En = {
2693
2703
  undo: ["mod+z"],
2694
2704
  redo: ["mod+shift+z"],
2695
2705
  selectAll: ["mod+a"],
@@ -2717,7 +2727,7 @@ var Tn = {
2717
2727
  pathTool: ["g"],
2718
2728
  brushTool: ["b"],
2719
2729
  pointTool: ["i"]
2720
- }, En = {
2730
+ }, Dn = {
2721
2731
  Equal: "=",
2722
2732
  Minus: "-",
2723
2733
  BracketLeft: "[",
@@ -2727,7 +2737,7 @@ var Tn = {
2727
2737
  Comma: ",",
2728
2738
  Slash: "/",
2729
2739
  Backquote: "`"
2730
- }, Dn = {
2740
+ }, On = {
2731
2741
  Escape: "escape",
2732
2742
  Enter: "enter",
2733
2743
  Backspace: "backspace",
@@ -2738,58 +2748,58 @@ var Tn = {
2738
2748
  ArrowLeft: "arrowleft",
2739
2749
  ArrowRight: "arrowright"
2740
2750
  };
2741
- function On(e) {
2751
+ function kn(e) {
2742
2752
  let t = e.code, n = /^Key([A-Z])$/.exec(t);
2743
2753
  if (n) return n[1].toLowerCase();
2744
2754
  let r = /^Digit([0-9])$/.exec(t);
2745
- return r ? r[1] : En[t] ? En[t] : Dn[e.key] ? Dn[e.key] : null;
2755
+ return r ? r[1] : Dn[t] ? Dn[t] : On[e.key] ? On[e.key] : null;
2746
2756
  }
2747
- function kn(e) {
2748
- let t = On(e);
2757
+ function An(e) {
2758
+ let t = kn(e);
2749
2759
  if (!t) return null;
2750
2760
  let n = [];
2751
2761
  return (e.metaKey || e.ctrlKey) && n.push("mod"), e.shiftKey && n.push("shift"), e.altKey && n.push("alt"), n.push(t), n.join("+");
2752
2762
  }
2753
- function An(e) {
2763
+ function jn(e) {
2754
2764
  let t = /* @__PURE__ */ new Map();
2755
- for (let n of Object.keys(Tn)) {
2756
- let r = e?.[n], i = r === void 0 ? Tn[n] : r === null ? [] : Array.isArray(r) ? r : [r];
2765
+ for (let n of Object.keys(En)) {
2766
+ let r = e?.[n], i = r === void 0 ? En[n] : r === null ? [] : Array.isArray(r) ? r : [r];
2757
2767
  for (let e of i) t.set(e.toLowerCase(), n);
2758
2768
  }
2759
2769
  return t;
2760
2770
  }
2761
2771
  //#endregion
2762
2772
  //#region src/components/ShapeEditor/_state/useEditorHotkeys.ts
2763
- var jn = {
2773
+ var Mn = {
2764
2774
  ArrowUp: [0, -1],
2765
2775
  ArrowDown: [0, 1],
2766
2776
  ArrowLeft: [-1, 0],
2767
2777
  ArrowRight: [1, 0]
2768
2778
  };
2769
- function Mn() {
2779
+ function Nn() {
2770
2780
  let e = document.activeElement;
2771
2781
  return !!e && (e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.isContentEditable);
2772
2782
  }
2773
- function Nn(e, t) {
2783
+ function Pn(e, t) {
2774
2784
  if (!t || !(e instanceof Element)) return !1;
2775
2785
  let n = e.closest("[role=\"dialog\"],[aria-modal=\"true\"]");
2776
2786
  return !!n && !n.contains(t);
2777
2787
  }
2778
- function Pn(e) {
2779
- let { spaceRef: t, shiftRef: n } = e, r = E(() => An(e.keymap), [e.keymap]), i = O(e);
2788
+ function Fn(e) {
2789
+ let { spaceRef: t, shiftRef: n } = e, r = E(() => jn(e.keymap), [e.keymap]), i = O(e);
2780
2790
  i.current = e;
2781
2791
  let a = O(r);
2782
2792
  a.current = r, S(() => {
2783
2793
  let e = (e) => {
2784
- if (e.code === "Space" && (t.current = !0, i.current.onSpaceDown()), e.key === "Shift" && (n.current = !0), Mn() || Nn(e.target, i.current.hostRef.current)) return;
2785
- let r = jn[e.key];
2794
+ if (e.code === "Space" && (t.current = !0, i.current.onSpaceDown()), e.key === "Shift" && (n.current = !0), Nn() || Pn(e.target, i.current.hostRef.current)) return;
2795
+ let r = Mn[e.key];
2786
2796
  if (r) {
2787
2797
  e.preventDefault();
2788
2798
  let t = e.shiftKey ? 10 : 1;
2789
2799
  i.current.nudge(r[0] * t, r[1] * t);
2790
2800
  return;
2791
2801
  }
2792
- let o = kn(e);
2802
+ let o = An(e);
2793
2803
  if (!o) return;
2794
2804
  let s = a.current.get(o);
2795
2805
  s && i.current.actions[s]?.() !== !1 && e.preventDefault();
@@ -2803,7 +2813,7 @@ function Pn(e) {
2803
2813
  }
2804
2814
  //#endregion
2805
2815
  //#region src/components/ShapeEditor/_model/imageFetch.ts
2806
- async function Fn(e) {
2816
+ async function In(e) {
2807
2817
  for (let t of ["default", "reload"]) try {
2808
2818
  let n = await fetch(e, {
2809
2819
  mode: "cors",
@@ -2816,8 +2826,8 @@ async function Fn(e) {
2816
2826
  }
2817
2827
  //#endregion
2818
2828
  //#region src/components/ShapeEditor/_model/imageTiles.ts
2819
- var In = 4e3;
2820
- function Ln(e, t, n = In) {
2829
+ var Ln = 4e3;
2830
+ function Rn(e, t, n = Ln) {
2821
2831
  if (e <= 0 || t <= 0) return [];
2822
2832
  let r = Math.ceil(e / n), i = Math.ceil(t / n);
2823
2833
  return Array.from({ length: i }, (a, o) => Array.from({ length: r }, (a, s) => {
@@ -2832,7 +2842,7 @@ function Ln(e, t, n = In) {
2832
2842
  };
2833
2843
  })).flat();
2834
2844
  }
2835
- function Rn(e, t) {
2845
+ function zn(e, t) {
2836
2846
  let n = document.createElement("canvas");
2837
2847
  n.width = t.width, n.height = t.height;
2838
2848
  let r = n.getContext("2d");
@@ -2840,7 +2850,7 @@ function Rn(e, t) {
2840
2850
  }
2841
2851
  //#endregion
2842
2852
  //#region src/components/ShapeEditor/_model/konva.ts
2843
- function zn(e, t, n) {
2853
+ function Bn(e, t, n) {
2844
2854
  if (t === F.POINT) {
2845
2855
  e.setAttrs({
2846
2856
  x: n[0].x,
@@ -2876,14 +2886,14 @@ function zn(e, t, n) {
2876
2886
  }
2877
2887
  //#endregion
2878
2888
  //#region src/components/ShapeEditor/_model/pinIcon.ts
2879
- var Bn = "M8 0C12.4183 0 16 3.58172 16 8C16 11.5323 13.71 14.5277 10.5342 15.5879L10.166 20.0068C10.0721 21.1334 9.13046 22 8 22C6.86954 22 5.92786 21.1334 5.83398 20.0068L5.46484 15.5879C2.28949 14.5275 0 11.532 0 8C0 3.58172 3.58172 0 8 0Z", Vn = "#ffffff", Hn = 1.5;
2880
- function Un(e) {
2881
- return `<svg width="16" height="22" viewBox="0 0 16 22" xmlns="http://www.w3.org/2000/svg"><path d="${Bn}" fill="${e}" stroke="${Vn}" stroke-width="${Hn}"/></svg>`;
2889
+ var Vn = "M8 0C12.4183 0 16 3.58172 16 8C16 11.5323 13.71 14.5277 10.5342 15.5879L10.166 20.0068C10.0721 21.1334 9.13046 22 8 22C6.86954 22 5.92786 21.1334 5.83398 20.0068L5.46484 15.5879C2.28949 14.5275 0 11.532 0 8C0 3.58172 3.58172 0 8 0Z", Hn = "#ffffff", Un = 1.5;
2890
+ function Wn(e) {
2891
+ return `<svg width="16" height="22" viewBox="0 0 16 22" xmlns="http://www.w3.org/2000/svg"><path d="${Vn}" fill="${e}" stroke="${Hn}" stroke-width="${Un}"/></svg>`;
2882
2892
  }
2883
2893
  //#endregion
2884
2894
  //#region src/components/ShapeEditor/_renderers/transformSession.ts
2885
- var Wn = Math.PI / 12;
2886
- function Gn(e, t) {
2895
+ var Gn = Math.PI / 12;
2896
+ function Kn(e, t) {
2887
2897
  return t.kind !== "resize" && t.kind !== "move" || t.shapes.length !== 1 ? !1 : e.find((e) => e.id === t.shapes[0].id)?.type === F.ROTATED_RECTANGLE;
2888
2898
  }
2889
2899
  function Q(e, t, n) {
@@ -2892,7 +2902,7 @@ function Q(e, t, n) {
2892
2902
  return {
2893
2903
  updates: e.shapes.map((i) => ({
2894
2904
  id: i.id,
2895
- points: n ? Ce(i.points, e.anchor, t) : we(i.points, e.box, r)
2905
+ points: n ? we(i.points, e.anchor, t) : Te(i.points, e.box, r)
2896
2906
  })),
2897
2907
  box: r
2898
2908
  };
@@ -2917,7 +2927,7 @@ function Q(e, t, n) {
2917
2927
  }
2918
2928
  if (e.kind === "rotate") {
2919
2929
  let n = Math.atan2(t.y - e.center.y, t.x - e.center.x) - e.startAngle;
2920
- return e.shiftKey && (n = Math.round(n / Wn) * Wn), {
2930
+ return e.shiftKey && (n = Math.round(n / Gn) * Gn), {
2921
2931
  updates: [{
2922
2932
  id: e.id,
2923
2933
  points: e.points.map((t) => ue(t, e.center, n))
@@ -2937,13 +2947,13 @@ function Q(e, t, n) {
2937
2947
  box: B(a)
2938
2948
  };
2939
2949
  }
2940
- function Kn(e, t) {
2950
+ function qn(e, t) {
2941
2951
  return t.kind === "move" || t.kind === "vertex" ? t.start : t.kind === "rotate" ? {
2942
2952
  x: t.center.x + Math.cos(t.startAngle),
2943
2953
  y: t.center.y + Math.sin(t.startAngle)
2944
- } : Gn(e, t) ? be(t.shapes[0].points)[z.indexOf(t.anchor)] : ce(t.anchor, t.box);
2954
+ } : Kn(e, t) ? xe(t.shapes[0].points)[z.indexOf(t.anchor)] : ce(t.anchor, t.box);
2945
2955
  }
2946
- function qn(e, t, n) {
2956
+ function Jn(e, t, n) {
2947
2957
  let r = e.filter((e) => t.includes(e.id) && L(e)).map((e) => ({
2948
2958
  id: e.id,
2949
2959
  points: e.points
@@ -2955,27 +2965,27 @@ function qn(e, t, n) {
2955
2965
  shapes: r
2956
2966
  } : null;
2957
2967
  }
2958
- function Jn(e) {
2968
+ function Yn(e) {
2959
2969
  return e.map((e) => ({
2960
2970
  ...e,
2961
2971
  points: e.points.map((e) => ({ ...e }))
2962
2972
  }));
2963
2973
  }
2964
- function Yn(e, t) {
2974
+ function Xn(e, t) {
2965
2975
  let n = new Set(t);
2966
2976
  return e.filter((e) => n.has(e.id) && oe(e));
2967
2977
  }
2968
- function Xn(e, t) {
2978
+ function Zn(e, t) {
2969
2979
  return e.filter((e) => {
2970
2980
  if (!I(e)) return !1;
2971
2981
  let n = B(e.points);
2972
2982
  return n.minX <= t.maxX && n.maxX >= t.minX && n.minY <= t.maxY && n.maxY >= t.minY;
2973
2983
  }).map((e) => e.id);
2974
2984
  }
2975
- function Zn(e, t, n) {
2985
+ function Qn(e, t, n) {
2976
2986
  return (e ? Ue(e, { strokeWidth: t }).pointRadius : 5) / (n || 1);
2977
2987
  }
2978
- function Qn(e, t) {
2988
+ function $n(e, t) {
2979
2989
  return {
2980
2990
  minX: e.x - t,
2981
2991
  minY: e.y - t,
@@ -2983,9 +2993,9 @@ function Qn(e, t) {
2983
2993
  maxY: e.y + t
2984
2994
  };
2985
2995
  }
2986
- function $n(e, t, n) {
2996
+ function er(e, t, n) {
2987
2997
  if (e.type === F.ROTATED_RECTANGLE) return t;
2988
- let r = e.type === F.POINT ? Qn(t[0], n) : B(t);
2998
+ let r = e.type === F.POINT ? $n(t[0], n) : B(t);
2989
2999
  return de([{
2990
3000
  x: r.minX,
2991
3001
  y: r.minY
@@ -2994,17 +3004,17 @@ function $n(e, t, n) {
2994
3004
  y: r.maxY
2995
3005
  }]);
2996
3006
  }
2997
- function er(e) {
3007
+ function tr(e) {
2998
3008
  return 24 / (e || 1);
2999
3009
  }
3000
- function tr(e, t) {
3010
+ function nr(e, t) {
3001
3011
  return Math.atan2(t.y - e.y, t.x - e.x);
3002
3012
  }
3003
3013
  //#endregion
3004
3014
  //#region src/components/ShapeEditor/_renderers/KonvaRenderer.ts
3005
- var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3015
+ var rr = 2, ir = "#1e88e5", ar = "#669def", or = class {
3006
3016
  constructor(e, t) {
3007
- this.layer = new A.Layer(), this.world = new A.Group(), this.bgGroup = new A.Group(), this.overlayGroup = new A.Group({ listening: !1 }), this.guideOverlayGroup = new A.Group({ listening: !1 }), this.regionOverlayGroup = new A.Group({ listening: !1 }), this.dimOverlayGroup = new A.Group({ listening: !1 }), this.shapeGroup = new A.Group(), this.selGroup = new A.Group(), this.previewGroup = new A.Group(), this.handleGroup = new A.Group(), this.baseCursor = "default", this.strokeSize = nr, this.imageSmoothing = !0, this.imageWidth = 0, this.imageHeight = 0, this.shapes = [], this.selected = [], this.nodes = /* @__PURE__ */ new Map(), this.altNodes = /* @__PURE__ */ new Map(), this.lastAppliedScale = -1, this.imageLoadToken = 0, this.transformEnabled = !1, this.handleNodes = [], this.vertexNodes = [], this.lastImg = {
3017
+ this.layer = new A.Layer(), this.world = new A.Group(), this.bgGroup = new A.Group(), this.overlayGroup = new A.Group({ listening: !1 }), this.guideOverlayGroup = new A.Group({ listening: !1 }), this.regionOverlayGroup = new A.Group({ listening: !1 }), this.dimOverlayGroup = new A.Group({ listening: !1 }), this.shapeGroup = new A.Group(), this.selGroup = new A.Group(), this.previewGroup = new A.Group(), this.handleGroup = new A.Group(), this.baseCursor = "default", this.strokeSize = rr, this.imageSmoothing = !0, this.imageWidth = 0, this.imageHeight = 0, this.shapes = [], this.selected = [], this.nodes = /* @__PURE__ */ new Map(), this.altNodes = /* @__PURE__ */ new Map(), this.lastAppliedScale = -1, this.imageLoadToken = 0, this.transformEnabled = !1, this.handleNodes = [], this.vertexNodes = [], this.lastImg = {
3008
3018
  x: 0,
3009
3019
  y: 0
3010
3020
  }, this.lastDragImg = null, this.ro = null, this.activeDrag = null, this.midNodes = [], this.ghostNode = null, 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 A.Stage({
@@ -3114,7 +3124,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3114
3124
  return this.world.getAbsoluteTransform().point(e);
3115
3125
  }
3116
3126
  async setImage(e, t, n) {
3117
- let r = ++this.imageLoadToken, i = await Fn(e);
3127
+ let r = ++this.imageLoadToken, i = await In(e);
3118
3128
  await new Promise((a) => {
3119
3129
  let o = new Image();
3120
3130
  i || (o.crossOrigin = "anonymous"), o.onload = () => {
@@ -3125,7 +3135,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3125
3135
  x: e / o.naturalWidth,
3126
3136
  y: s / o.naturalHeight
3127
3137
  }), this.bgGroup.destroyChildren();
3128
- for (let e of Ln(o.naturalWidth, o.naturalHeight)) this.bgGroup.add(new A.Image({
3138
+ for (let e of Rn(o.naturalWidth, o.naturalHeight)) this.bgGroup.add(new A.Image({
3129
3139
  image: o,
3130
3140
  x: e.x,
3131
3141
  y: e.y,
@@ -3184,7 +3194,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3184
3194
  if (this.regionOverlayGroup.add(new A.Shape({
3185
3195
  listening: !1,
3186
3196
  sceneFunc: (r) => {
3187
- Ft(r._context, e, t, n);
3197
+ It(r._context, e, t, n);
3188
3198
  }
3189
3199
  })), e.outlineStyles) {
3190
3200
  let t = (e, t) => {
@@ -3240,7 +3250,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3240
3250
  let e = this.lastPreviewPoly;
3241
3251
  e && this.previewPoly(e.points, e.cursor, e.style, e.closed, e.selectedPointIndices, e.showVertices);
3242
3252
  }
3243
- this.activeDrag ? this.dragTransform(this.lastDragImg ?? Kn(this.shapes, this.activeDrag)) : this.drawTransformer(), this.layer.batchDraw(), this.cb.onViewportChange?.();
3253
+ this.activeDrag ? this.dragTransform(this.lastDragImg ?? qn(this.shapes, this.activeDrag)) : this.drawTransformer(), this.layer.batchDraw(), this.cb.onViewportChange?.();
3244
3254
  }
3245
3255
  fit() {
3246
3256
  if (!this.imageWidth || !this.imageHeight) return;
@@ -3269,7 +3279,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3269
3279
  });
3270
3280
  }
3271
3281
  setShapes(e, t) {
3272
- if (this.shapes = Jn(e), this.selected = t, !this.activeDrag) {
3282
+ if (this.shapes = Yn(e), this.selected = t, !this.activeDrag) {
3273
3283
  this.shapeGroup.destroyChildren(), this.nodes.clear(), this.altNodes.clear();
3274
3284
  for (let t of R(e).filter(ie)) {
3275
3285
  let e = this.makeNode(t), n = Ue(t, { strokeWidth: this.strokeSize });
@@ -3315,7 +3325,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3315
3325
  if (t === F.POINT) {
3316
3326
  let t = 1 / (this.world.scaleX() || 1), a = new A.Path({
3317
3327
  id: e.id,
3318
- data: Bn,
3328
+ data: Vn,
3319
3329
  x: n[0].x,
3320
3330
  y: n[0].y,
3321
3331
  offsetX: 16 / 2,
@@ -3323,8 +3333,8 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3323
3333
  scaleX: t,
3324
3334
  scaleY: t,
3325
3335
  fill: r.color,
3326
- stroke: Vn,
3327
- strokeWidth: Hn,
3336
+ stroke: Hn,
3337
+ strokeWidth: Un,
3328
3338
  strokeScaleEnabled: !1,
3329
3339
  shadowColor: "#000",
3330
3340
  shadowBlur: 2,
@@ -3369,13 +3379,13 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3369
3379
  liveUpdateShape(e, t) {
3370
3380
  let n = this.nodes.get(e), r = this.shapes.find((t) => t.id === e);
3371
3381
  if (n && r) {
3372
- zn(n, r.type, t);
3382
+ Bn(n, r.type, t);
3373
3383
  let i = this.altNodes.get(e);
3374
- i && zn(i, r.type, t), r.type === F.POINT && n instanceof A.Circle && n.radius(this.pointRadius(r)), this.layer.batchDraw();
3384
+ i && Bn(i, r.type, t), r.type === F.POINT && n instanceof A.Circle && n.radius(this.pointRadius(r)), this.layer.batchDraw();
3375
3385
  }
3376
3386
  }
3377
3387
  pointRadius(e) {
3378
- return Zn(e, this.strokeSize, this.world.scaleX() || 1);
3388
+ return Qn(e, this.strokeSize, this.world.scaleX() || 1);
3379
3389
  }
3380
3390
  scaledDash(e) {
3381
3391
  return e;
@@ -3395,7 +3405,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3395
3405
  }
3396
3406
  }
3397
3407
  shapesIntersecting(e) {
3398
- return Xn(this.shapes, e);
3408
+ return Zn(this.shapes, e);
3399
3409
  }
3400
3410
  drawSelectionBorders() {
3401
3411
  let e = new Set(this.selected), t = this.selected.length ? this.shapes.filter((t) => e.has(t.id) && I(t)) : [];
@@ -3404,7 +3414,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3404
3414
  this.selectionBorders = t.map(() => {
3405
3415
  let e = new A.Line({
3406
3416
  closed: !0,
3407
- stroke: ir,
3417
+ stroke: ar,
3408
3418
  strokeWidth: 1.5,
3409
3419
  strokeScaleEnabled: !1,
3410
3420
  listening: !1
@@ -3425,7 +3435,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3425
3435
  }
3426
3436
  }
3427
3437
  selectionOutlinePoints(e, t) {
3428
- return $n(e, t, this.pointRadius(e));
3438
+ return er(e, t, this.pointRadius(e));
3429
3439
  }
3430
3440
  clearPreview() {
3431
3441
  this.lastPreviewPoly = null, this.previewGroup.destroyChildren(), this.layer.batchDraw();
@@ -3488,8 +3498,8 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3488
3498
  x: n.x,
3489
3499
  y: n.y,
3490
3500
  radius: (r ? 6 : 5) / l,
3491
- fill: r ? rr : "#ffffff",
3492
- stroke: r ? "#ffffff" : rr,
3501
+ fill: r ? ir : "#ffffff",
3502
+ stroke: r ? "#ffffff" : ir,
3493
3503
  strokeWidth: 1.5,
3494
3504
  strokeScaleEnabled: !1,
3495
3505
  listening: !1
@@ -3499,7 +3509,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3499
3509
  }
3500
3510
  previewScalarMask(e, t) {
3501
3511
  this.previewGroup.destroyChildren();
3502
- let n = mn(e, t.length === 7 ? `${t}99` : t);
3512
+ let n = hn(e, t.length === 7 ? `${t}99` : t);
3503
3513
  this.previewGroup.add(new A.Image({
3504
3514
  image: n,
3505
3515
  x: e.ox,
@@ -3543,20 +3553,20 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3543
3553
  setTransformerOutlinePoints(e) {
3544
3554
  e.length < 2 || (this.transformerOutline || (this.transformerOutline = new A.Line({
3545
3555
  closed: !0,
3546
- stroke: rr,
3556
+ stroke: ir,
3547
3557
  strokeWidth: 1,
3548
3558
  strokeScaleEnabled: !1,
3549
3559
  listening: !1
3550
3560
  }), this.selGroup.add(this.transformerOutline)), this.transformerOutline.points(e.flatMap((e) => [e.x, e.y])));
3551
3561
  }
3552
3562
  rotationHandleGap() {
3553
- return er(this.viewport.scale);
3563
+ return tr(this.viewport.scale);
3554
3564
  }
3555
3565
  rotationHandleScreenPoint(e) {
3556
- return this.imgToScreen(xe(e, this.rotationHandleGap()));
3566
+ return this.imgToScreen(Se(e, this.rotationHandleGap()));
3557
3567
  }
3558
3568
  setRotationConnector(e) {
3559
- let t = this.imgToScreen(ve(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
3569
+ let t = this.imgToScreen(ye(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
3560
3570
  this.rotLineNode ? this.rotLineNode.points([
3561
3571
  t.x,
3562
3572
  t.y,
@@ -3569,7 +3579,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3569
3579
  n.x,
3570
3580
  n.y
3571
3581
  ],
3572
- stroke: rr,
3582
+ stroke: ir,
3573
3583
  strokeWidth: 1,
3574
3584
  listening: !1
3575
3585
  }), this.handleGroup.add(this.rotLineNode));
@@ -3584,11 +3594,11 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3584
3594
  }), e.rotation(n * 180 / Math.PI);
3585
3595
  }
3586
3596
  orientedHandleAngle(e) {
3587
- return tr(this.imgToScreen(e[0]), this.imgToScreen(e[1]));
3597
+ return nr(this.imgToScreen(e[0]), this.imgToScreen(e[1]));
3588
3598
  }
3589
3599
  repositionOrientedHandles(e) {
3590
3600
  let t = this.orientedHandleAngle(e);
3591
- if (be(e).forEach((e, n) => {
3601
+ if (xe(e).forEach((e, n) => {
3592
3602
  let r = this.imgToScreen(e), i = this.handleNodes[n];
3593
3603
  i && this.layoutResizeHandle(i, r, t);
3594
3604
  }), this.setTransformerOutlinePoints(e), this.rotNode) {
@@ -3606,9 +3616,9 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3606
3616
  for (let e of this.vertexNodes) e.destroy();
3607
3617
  for (let e of this.midNodes) e.destroy();
3608
3618
  if (this.ghostNode?.destroy(), this.ghostNode = null, 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;
3609
- let e = Yn(this.shapes, this.selected);
3619
+ let e = Xn(this.shapes, this.selected);
3610
3620
  if (!e.length || e.length === 1 && e[0].type === F.POINT) return;
3611
- let t = e.length === 1 && (e[0].type === F.POLYGON || e[0].type === F.LINE) && this.editingId === e[0].id ? e[0] : null, n = B(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === F.ROTATED_RECTANGLE ? e[0] : null, i = r ? be(r.points) : z.map((e) => ce(e, n));
3621
+ let t = e.length === 1 && (e[0].type === F.POLYGON || e[0].type === F.LINE) && this.editingId === e[0].id ? e[0] : null, n = B(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === F.ROTATED_RECTANGLE ? e[0] : null, i = r ? xe(r.points) : z.map((e) => ce(e, n));
3612
3622
  r ? this.setTransformerOutlinePoints(r.points) : this.setTransformerOutline(n), r && this.setRotationConnector(r.points);
3613
3623
  let a = r ? this.orientedHandleAngle(r.points) : 0;
3614
3624
  for (let e of t ? [] : z) {
@@ -3621,12 +3631,12 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3621
3631
  offsetY: 4,
3622
3632
  rotation: a * 180 / Math.PI,
3623
3633
  fill: "#ffffff",
3624
- stroke: rr,
3634
+ stroke: ir,
3625
3635
  strokeWidth: 1
3626
- }), r = Ct(e, a);
3636
+ }), r = wt(e, a);
3627
3637
  this.bindCursor(n, r), n.on("mousedown", (t) => {
3628
3638
  t.cancelBubble = !0, this.emitCursorHint(r), this.emitInteractionMode("resizing");
3629
- let n = Yn(this.shapes, this.selected);
3639
+ let n = Xn(this.shapes, this.selected);
3630
3640
  this.activeDrag = {
3631
3641
  kind: "resize",
3632
3642
  anchor: e,
@@ -3643,7 +3653,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3643
3653
  radius: i * .8,
3644
3654
  fill: "#ffffff",
3645
3655
  opacity: .6,
3646
- stroke: rr,
3656
+ stroke: ir,
3647
3657
  strokeWidth: 1,
3648
3658
  visible: !1,
3649
3659
  listening: !1
@@ -3703,8 +3713,8 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3703
3713
  x: a.x,
3704
3714
  y: a.y,
3705
3715
  radius: i,
3706
- fill: o ? rr : "#ffffff",
3707
- stroke: o ? "#ffffff" : rr,
3716
+ fill: o ? ir : "#ffffff",
3717
+ stroke: o ? "#ffffff" : ir,
3708
3718
  strokeWidth: Math.max(1.5, i * .3)
3709
3719
  });
3710
3720
  this.bindCursor(s, "pointer"), s.on("mousedown", (t) => {
@@ -3724,12 +3734,12 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3724
3734
  });
3725
3735
  }
3726
3736
  if (e.length === 1 && e[0].type === F.ROTATED_RECTANGLE) {
3727
- let t = e[0], n = ye(t.points), r = this.rotationHandleScreenPoint(t.points), i = new A.Circle({
3737
+ let t = e[0], n = be(t.points), r = this.rotationHandleScreenPoint(t.points), i = new A.Circle({
3728
3738
  x: r.x,
3729
3739
  y: r.y,
3730
3740
  radius: 6,
3731
3741
  fill: "#ffffff",
3732
- stroke: rr,
3742
+ stroke: ir,
3733
3743
  strokeWidth: 1.5
3734
3744
  });
3735
3745
  this.bindCursor(i, "grab"), i.on("mousedown", (e) => {
@@ -3748,7 +3758,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3748
3758
  this.layer.batchDraw();
3749
3759
  }
3750
3760
  beginMove(e, t) {
3751
- let n = qn(this.shapes, t, e);
3761
+ let n = Jn(this.shapes, t, e);
3752
3762
  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 === F.ROTATED_RECTANGLE ? this.setTransformerOutlinePoints(n.shapes[0].points) : this.setTransformerOutline(n.box), this.updateSelectionBordersLive((e) => e.points));
3753
3763
  }
3754
3764
  repositionHandles(e) {
@@ -3790,7 +3800,7 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3790
3800
  let t = this.activeDrag;
3791
3801
  if (!t) return;
3792
3802
  this.applyCursor();
3793
- let n = Gn(this.shapes, t), { updates: r, box: i } = Q(t, e, n);
3803
+ let n = Kn(this.shapes, t), { updates: r, box: i } = Q(t, e, n);
3794
3804
  for (let e of r) this.liveUpdateShape(e.id, e.points);
3795
3805
  if (this.cb.onTransformPreview?.(r), this.updateSelectionBordersLive((e) => r.find((t) => t.id === e.id)?.points ?? e.points), t.kind === "resize" || t.kind === "move") {
3796
3806
  n ? this.repositionOrientedHandles(r[0].points) : i && this.repositionHandles(i);
@@ -3817,18 +3827,18 @@ var nr = 2, rr = "#1e88e5", ir = "#669def", ar = class {
3817
3827
  this.cb.onTransformPreview?.([]), this.drawTransformer();
3818
3828
  return;
3819
3829
  }
3820
- let { updates: n } = Q(e, t, Gn(this.shapes, e));
3830
+ let { updates: n } = Q(e, t, Kn(this.shapes, e));
3821
3831
  this.commitTransformUpdates(n);
3822
3832
  }
3823
- }, or = 2, sr = 58879, cr = 6725103;
3833
+ }, sr = 2, cr = 58879, lr = 6725103;
3824
3834
  function $(e) {
3825
- if (!e) return sr;
3835
+ if (!e) return cr;
3826
3836
  let t = e.replace("#", "");
3827
3837
  return Number.parseInt(t.length === 3 ? t.replace(/./g, "$&$&") : t, 16);
3828
3838
  }
3829
- var lr = class {
3839
+ var ur = class {
3830
3840
  constructor(e, t) {
3831
- this.app = new j(), this.world = new N(), this.bgLayer = new N(), this.overlayLayer = new N(), this.guideOverlayLayer = new N(), this.regionOverlayLayer = new N(), this.dimOverlayLayer = new N(), this.shapeLayer = new N(), this.selLayer = new N(), this.previewLayer = new N(), this.handleLayer = new N(), this.filter = new M(), this.imageWidth = 0, this.imageHeight = 0, this.imageTileTextures = [], this.imageLoadToken = 0, this.overlayTextures = [], this.region = null, this.regionDimMaskG = new P(), this.regionDimG = new P(), this.regionZoneMaskG = new P(), this.regionZoneG = new P(), this.regionOutlineG = new P(), this.baseCursor = "default", this.strokeSize = or, 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.ghostNode = null, 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 P(), this.marqueeG = new P(), this.previewMaskSprite = null, this.previewMaskTexture = null, this.previewReady = !1, this.lastPreview = null, this.host = e, this.cb = t;
3841
+ this.app = new j(), this.world = new M(), this.bgLayer = new M(), this.overlayLayer = new M(), this.guideOverlayLayer = new M(), this.regionOverlayLayer = new M(), this.dimOverlayLayer = new M(), this.shapeLayer = new M(), this.selLayer = new M(), this.previewLayer = new M(), this.handleLayer = new M(), this.filter = new ee(), this.imageWidth = 0, this.imageHeight = 0, this.imageTileTextures = [], this.imageLoadToken = 0, this.overlayTextures = [], this.region = null, this.regionDimMaskG = new N(), this.regionDimG = new N(), this.regionZoneMaskG = new N(), this.regionZoneG = new N(), this.regionOutlineG = new N(), this.baseCursor = "default", this.strokeSize = sr, 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.ghostNode = null, 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 N(), this.marqueeG = new N(), this.previewMaskSprite = null, this.previewMaskTexture = null, this.previewReady = !1, this.lastPreview = null, this.host = e, this.cb = t;
3832
3842
  }
3833
3843
  ev(e) {
3834
3844
  return {
@@ -3886,7 +3896,7 @@ var lr = class {
3886
3896
  }
3887
3897
  syncHitArea() {
3888
3898
  let { w: e, h: t } = this.screenSize;
3889
- this.app.stage.hitArea = new te(0, 0, e, t);
3899
+ this.app.stage.hitArea = new ne(0, 0, e, t);
3890
3900
  }
3891
3901
  destroy() {
3892
3902
  this.destroyed = !0, this.clearImageTiles();
@@ -3934,7 +3944,7 @@ var lr = class {
3934
3944
  };
3935
3945
  }
3936
3946
  async setImage(e, t, n) {
3937
- let r = ++this.imageLoadToken, i = await Fn(e);
3947
+ let r = ++this.imageLoadToken, i = await In(e);
3938
3948
  if (this.destroyed) {
3939
3949
  i && URL.revokeObjectURL(i);
3940
3950
  return;
@@ -3946,10 +3956,10 @@ var lr = class {
3946
3956
  this.imageWidth = t?.width ?? o.naturalWidth, this.imageHeight = t?.height ?? o.naturalHeight;
3947
3957
  let e = n?.width ?? this.imageWidth, s = n?.height ?? this.imageHeight;
3948
3958
  this.bgLayer.scale.set(e / o.naturalWidth, s / o.naturalHeight), this.clearImageTiles();
3949
- for (let e of Ln(o.naturalWidth, o.naturalHeight)) {
3950
- let t = re.from(Rn(o, e));
3959
+ for (let e of Rn(o.naturalWidth, o.naturalHeight)) {
3960
+ let t = P.from(zn(o, e));
3951
3961
  t.source.scaleMode = this.imageSmoothing ? "linear" : "nearest", this.imageTileTextures.push(t);
3952
- let n = new ne(t);
3962
+ let n = new re(t);
3953
3963
  n.x = e.x, n.y = e.y, n.width = e.width, n.height = e.height, this.bgLayer.addChild(n);
3954
3964
  }
3955
3965
  this.applySpriteFilter(), a();
@@ -3996,14 +4006,14 @@ var lr = class {
3996
4006
  for (let e of this.guideOverlayLayer.removeChildren()) e.destroy();
3997
4007
  for (let e of this.overlayTextures) e.destroy(!0);
3998
4008
  if (this.overlayTextures = [], e) {
3999
- let t = re.from(e);
4009
+ let t = P.from(e);
4000
4010
  t.source.scaleMode = "nearest", this.overlayTextures.push(t);
4001
- let n = new ne(t);
4011
+ let n = new re(t);
4002
4012
  n.alpha = .55, this.guideOverlayLayer.addChild(n);
4003
4013
  }
4004
4014
  this.setRegionOverlay(t);
4005
4015
  for (let e of this.dimOverlayLayer.removeChildren()) e.destroy();
4006
- n && this.imageWidth && this.dimOverlayLayer.addChild(new P().rect(0, 0, this.imageWidth, this.imageHeight).fill({
4016
+ n && this.imageWidth && this.dimOverlayLayer.addChild(new N().rect(0, 0, this.imageWidth, this.imageHeight).fill({
4007
4017
  color: 855314,
4008
4018
  alpha: .3
4009
4019
  })), !this.destroyed && this.app.renderer && this.app.render();
@@ -4031,7 +4041,7 @@ var lr = class {
4031
4041
  }
4032
4042
  applyViewport(e) {
4033
4043
  let t = e.scale !== this.lastAppliedScale;
4034
- this.lastAppliedScale = e.scale, this.world.scale.set(e.scale), this.world.position.set(e.x, e.y), this.world.visible = !0, t && this.restrokeShapes(), this.activeDrag ? this.dragTransform(this.lastDragImg ?? Kn(this.shapes, this.activeDrag)) : this.drawTransformer(), this.cb.onViewportChange?.();
4044
+ this.lastAppliedScale = e.scale, this.world.scale.set(e.scale), this.world.position.set(e.x, e.y), this.world.visible = !0, t && this.restrokeShapes(), this.activeDrag ? this.dragTransform(this.lastDragImg ?? qn(this.shapes, this.activeDrag)) : this.drawTransformer(), this.cb.onViewportChange?.();
4035
4045
  }
4036
4046
  fit() {
4037
4047
  if (!this.imageWidth || !this.imageHeight) return;
@@ -4067,7 +4077,7 @@ var lr = class {
4067
4077
  });
4068
4078
  }
4069
4079
  setShapes(e, t) {
4070
- this.shapes = Jn(e), this.selected = t, !this.activeDrag && (this.drawShapes(), this.drawSelectionBorders(), this.drawTransformer());
4080
+ this.shapes = Yn(e), this.selected = t, !this.activeDrag && (this.drawShapes(), this.drawSelectionBorders(), this.drawTransformer());
4071
4081
  }
4072
4082
  setSelection(e) {
4073
4083
  this.selected = e, (e.length !== 1 || e[0] !== this.vertexPolygonId) && (this.vertexPolygonId = null, this.selectedVertices.clear()), this.editingId && (e.length !== 1 || e[0] !== this.editingId) && (this.editingId = null), !this.activeDrag && (this.drawSelectionBorders(), this.drawTransformer());
@@ -4090,10 +4100,10 @@ var lr = class {
4090
4100
  this.handleLayer.interactiveChildren = !e;
4091
4101
  }
4092
4102
  strokeW(e) {
4093
- return (e ? Ue(e, { strokeWidth: this.strokeSize }).strokeWidth : or) / this.world.scale.x;
4103
+ return (e ? Ue(e, { strokeWidth: this.strokeSize }).strokeWidth : sr) / this.world.scale.x;
4094
4104
  }
4095
4105
  pointRadius(e) {
4096
- return Zn(e, this.strokeSize, this.world.scale.x);
4106
+ return Qn(e, this.strokeSize, this.world.scale.x);
4097
4107
  }
4098
4108
  dashForShape(e) {
4099
4109
  let t = Ue(e, { strokeWidth: this.strokeSize }).dash;
@@ -4106,7 +4116,7 @@ var lr = class {
4106
4116
  for (let e of this.nodes.values()) e.destroy();
4107
4117
  this.nodes.clear();
4108
4118
  for (let e of R(this.shapes).filter(ie)) {
4109
- let t = new P();
4119
+ let t = new N();
4110
4120
  this.paintShape(t, e), t.eventMode = I(e) ? "static" : "none", t.cursor = void 0, I(e) && L(e) && (t.on("pointerover", () => {
4111
4121
  !this.activeDrag && this.transformEnabled && this.emitCursorHint("grab");
4112
4122
  }), t.on("pointerout", () => {
@@ -4120,13 +4130,13 @@ var lr = class {
4120
4130
  e.clear();
4121
4131
  let n = Ue(t, { strokeWidth: this.strokeSize }), r = $(n.color), i = this.strokeW(t), a = n.opacity, o = this.dashForShape(t);
4122
4132
  if (t.type === F.POINT) {
4123
- e.svg(Un(n.color)), e.position.set(t.points[0].x, t.points[0].y), e.pivot.set(16 / 2, 22);
4133
+ e.svg(Wn(n.color)), e.position.set(t.points[0].x, t.points[0].y), e.pivot.set(16 / 2, 22);
4124
4134
  let r = 1 / (this.world.scale.x || 1);
4125
4135
  e.scale.set(r, r), e.alpha = a;
4126
4136
  return;
4127
4137
  }
4128
4138
  if (n.fillVisible && t.type !== F.LINE) {
4129
- let i = t.type === F.POLYGON ? De(t.points) : null;
4139
+ let i = t.type === F.POLYGON ? Oe(t.points) : null;
4130
4140
  if (i && i.length > 1) for (let t of i) e.poly(t.flatMap((e) => [e.x, e.y]), !0), e.fill({
4131
4141
  color: r,
4132
4142
  alpha: n.fillAlpha * a
@@ -4161,7 +4171,7 @@ var lr = class {
4161
4171
  });
4162
4172
  }
4163
4173
  shapesIntersecting(e) {
4164
- return Xn(this.shapes, e);
4174
+ return Zn(this.shapes, e);
4165
4175
  }
4166
4176
  shapesAt(e) {
4167
4177
  return this.shapes.filter((t) => {
@@ -4248,8 +4258,8 @@ var lr = class {
4248
4258
  }
4249
4259
  previewScalarMask(e, t) {
4250
4260
  this.lastPreview = null, this.ensurePreview(), this.previewG.clear();
4251
- let n = mn(e, t.length === 7 ? `${t}99` : t);
4252
- this.previewMaskTexture && this.previewMaskTexture.destroy(!0), this.previewMaskTexture = re.from(n), this.previewMaskSprite ? (this.previewMaskSprite.texture = this.previewMaskTexture, this.previewMaskSprite.visible = !0) : (this.previewMaskSprite = new ne(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;
4261
+ let n = hn(e, t.length === 7 ? `${t}99` : t);
4262
+ this.previewMaskTexture && this.previewMaskTexture.destroy(!0), this.previewMaskTexture = P.from(n), this.previewMaskSprite ? (this.previewMaskSprite.texture = this.previewMaskTexture, this.previewMaskSprite.visible = !0) : (this.previewMaskSprite = new re(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;
4253
4263
  }
4254
4264
  previewMarquee(e, t) {
4255
4265
  this.ensurePreview(), this.marqueeG.clear();
@@ -4391,7 +4401,7 @@ var lr = class {
4391
4401
  if (this.selectionBorderGfx.length !== t.length) {
4392
4402
  for (let e of this.selectionBorderGfx) e.destroy();
4393
4403
  this.selectionBorderGfx = t.map(() => {
4394
- let e = new P();
4404
+ let e = new N();
4395
4405
  return this.selLayer.addChild(e), e;
4396
4406
  });
4397
4407
  }
@@ -4400,7 +4410,7 @@ var lr = class {
4400
4410
  let r = this.selectionBorderGfx[t];
4401
4411
  r.clear(), r.poly(this.selectionOutlinePoints(e, e.points).flatMap((e) => [e.x, e.y]), !0).stroke({
4402
4412
  width: n,
4403
- color: cr
4413
+ color: lr
4404
4414
  });
4405
4415
  });
4406
4416
  }
@@ -4411,12 +4421,12 @@ var lr = class {
4411
4421
  let a = this.selectionBorderGfx[r++];
4412
4422
  a && (a.clear(), a.poly(this.selectionOutlinePoints(i, e(i)).flatMap((e) => [e.x, e.y]), !0).stroke({
4413
4423
  width: n,
4414
- color: cr
4424
+ color: lr
4415
4425
  }));
4416
4426
  }
4417
4427
  }
4418
4428
  selectionOutlinePoints(e, t) {
4419
- return $n(e, t, this.pointRadius(e));
4429
+ return er(e, t, this.pointRadius(e));
4420
4430
  }
4421
4431
  imgToScreen(e) {
4422
4432
  let t = this.world.toGlobal({
@@ -4439,20 +4449,20 @@ var lr = class {
4439
4449
  }]));
4440
4450
  }
4441
4451
  setTransformerOutlinePoints(e) {
4442
- e.length < 2 || (this.transformerOutline || (this.transformerOutline = new P(), this.selLayer.addChild(this.transformerOutline)), this.transformerOutline.clear(), this.transformerOutline.poly(e.flatMap((e) => [e.x, e.y]), !0).stroke({
4452
+ e.length < 2 || (this.transformerOutline || (this.transformerOutline = new N(), this.selLayer.addChild(this.transformerOutline)), this.transformerOutline.clear(), this.transformerOutline.poly(e.flatMap((e) => [e.x, e.y]), !0).stroke({
4443
4453
  width: 1 / this.world.scale.x,
4444
4454
  color: 2001125
4445
4455
  }));
4446
4456
  }
4447
4457
  rotationHandleGap() {
4448
- return er(this.viewport.scale);
4458
+ return tr(this.viewport.scale);
4449
4459
  }
4450
4460
  rotationHandleScreenPoint(e) {
4451
- return this.imgToScreen(xe(e, this.rotationHandleGap()));
4461
+ return this.imgToScreen(Se(e, this.rotationHandleGap()));
4452
4462
  }
4453
4463
  setRotationConnector(e) {
4454
- let t = this.imgToScreen(ve(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
4455
- this.rotLineNode || (this.rotLineNode = new P(), 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({
4464
+ let t = this.imgToScreen(ye(e[0], e[1])), n = this.rotationHandleScreenPoint(e);
4465
+ this.rotLineNode || (this.rotLineNode = new N(), 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({
4456
4466
  width: 1,
4457
4467
  color: 2001125
4458
4468
  });
@@ -4461,7 +4471,7 @@ var lr = class {
4461
4471
  e.position.set(t.x, t.y), e.rotation = n;
4462
4472
  }
4463
4473
  orientedHandleAngle(e) {
4464
- return tr(this.imgToScreen(e[0]), this.imgToScreen(e[1]));
4474
+ return nr(this.imgToScreen(e[0]), this.imgToScreen(e[1]));
4465
4475
  }
4466
4476
  drawTransformer() {
4467
4477
  if (this.activeDrag) return;
@@ -4469,21 +4479,21 @@ var lr = class {
4469
4479
  for (let e of this.vertexNodes) e.destroy();
4470
4480
  for (let e of this.midNodes) e.destroy();
4471
4481
  if (this.ghostNode?.destroy(), this.ghostNode = null, 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;
4472
- let e = Yn(this.shapes, this.selected);
4482
+ let e = Xn(this.shapes, this.selected);
4473
4483
  if (e.length === 0 || e.length === 1 && e[0].type === F.POINT) return;
4474
- let t = e.length === 1 && (e[0].type === F.POLYGON || e[0].type === F.LINE) && this.editingId === e[0].id ? e[0] : null, n = B(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === F.ROTATED_RECTANGLE ? e[0] : null, i = r ? be(r.points) : z.map((e) => ce(e, n));
4484
+ let t = e.length === 1 && (e[0].type === F.POLYGON || e[0].type === F.LINE) && this.editingId === e[0].id ? e[0] : null, n = B(e.flatMap((e) => e.points)), r = e.length === 1 && e[0].type === F.ROTATED_RECTANGLE ? e[0] : null, i = r ? xe(r.points) : z.map((e) => ce(e, n));
4475
4485
  r ? this.setTransformerOutlinePoints(r.points) : this.setTransformerOutline(n), r && this.setRotationConnector(r.points);
4476
4486
  let a = r ? this.orientedHandleAngle(r.points) : 0;
4477
4487
  for (let e of t ? [] : z) {
4478
- let t = this.imgToScreen(i[z.indexOf(e)]), n = new P();
4488
+ let t = this.imgToScreen(i[z.indexOf(e)]), n = new N();
4479
4489
  n.rect(-4, -4, 8, 8).fill({ color: 16777215 }).stroke({
4480
4490
  width: 1,
4481
4491
  color: 2001125
4482
4492
  }), this.layoutResizeHandle(n, t, a), n.eventMode = "static";
4483
- let r = Ct(e, a);
4493
+ let r = wt(e, a);
4484
4494
  this.bindCursor(n, r), n.on("pointerdown", (t) => {
4485
4495
  t.stopPropagation(), this.emitCursorHint(r), this.emitInteractionMode("resizing");
4486
- let n = Yn(this.shapes, this.selected);
4496
+ let n = Xn(this.shapes, this.selected);
4487
4497
  this.activeDrag = {
4488
4498
  kind: "resize",
4489
4499
  anchor: e,
@@ -4496,7 +4506,7 @@ var lr = class {
4496
4506
  }), this.handleLayer.addChild(n), this.handleNodes.push(n);
4497
4507
  }
4498
4508
  if (t) {
4499
- let e = t, n = e.points, r = e.type === F.POLYGON ? n.length : n.length - 1, i = this.vertexHandleRadius(), a = new P();
4509
+ let e = t, n = e.points, r = e.type === F.POLYGON ? n.length : n.length - 1, i = this.vertexHandleRadius(), a = new N();
4500
4510
  a.circle(0, 0, i * .8).fill({
4501
4511
  color: 16777215,
4502
4512
  alpha: .6
@@ -4505,7 +4515,7 @@ var lr = class {
4505
4515
  color: 2001125
4506
4516
  }), a.visible = !1, a.eventMode = "none", this.handleLayer.addChild(a), this.ghostNode = a;
4507
4517
  for (let t = 0; t < r; t++) {
4508
- let r = n[t], i = n[(t + 1) % n.length], o = new P();
4518
+ let r = n[t], i = n[(t + 1) % n.length], o = new N();
4509
4519
  o.hitArea = this.edgeHitQuad(r, i), o.eventMode = "static", this.bindCursor(o, "copy");
4510
4520
  let s = (e) => {
4511
4521
  let t = this.toImage(e), n = i.x - r.x, a = i.y - r.y, o = n * n + a * a, s = o ? Math.max(0, Math.min(1, ((t.x - r.x) * n + (t.y - r.y) * a) / o)) : 0;
@@ -4540,7 +4550,7 @@ var lr = class {
4540
4550
  }), this.handleLayer.addChild(o), this.midNodes.push(o);
4541
4551
  }
4542
4552
  this.vertexPolygonId !== e.id && (this.vertexPolygonId = e.id, this.selectedVertices.clear()), n.forEach((t, r) => {
4543
- let a = this.imgToScreen(t), o = this.selectedVertices.has(r), s = new P();
4553
+ let a = this.imgToScreen(t), o = this.selectedVertices.has(r), s = new N();
4544
4554
  s.circle(0, 0, i).fill({ color: o ? 2001125 : 16777215 }).stroke({
4545
4555
  width: Math.max(1.5, i * .3),
4546
4556
  color: o ? 16777215 : 2001125
@@ -4561,7 +4571,7 @@ var lr = class {
4561
4571
  });
4562
4572
  }
4563
4573
  if (e.length === 1 && e[0].type === F.ROTATED_RECTANGLE) {
4564
- let t = e[0], n = ye(t.points), r = this.rotationHandleScreenPoint(t.points), i = new P();
4574
+ let t = e[0], n = be(t.points), r = this.rotationHandleScreenPoint(t.points), i = new N();
4565
4575
  i.circle(0, 0, 6).fill({ color: 16777215 }).stroke({
4566
4576
  width: 1.5,
4567
4577
  color: 2001125
@@ -4580,7 +4590,7 @@ var lr = class {
4580
4590
  }
4581
4591
  }
4582
4592
  beginMove(e, t) {
4583
- let n = qn(this.shapes, t, e);
4593
+ let n = Jn(this.shapes, t, e);
4584
4594
  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 === F.ROTATED_RECTANGLE ? this.setTransformerOutlinePoints(n.shapes[0].points) : this.setTransformerOutline(n.box), this.updateSelectionBordersLive((e) => e.points));
4585
4595
  }
4586
4596
  repositionHandlesForBox(e) {
@@ -4591,7 +4601,7 @@ var lr = class {
4591
4601
  }
4592
4602
  repositionOrientedHandles(e) {
4593
4603
  let t = this.orientedHandleAngle(e);
4594
- if (be(e).forEach((e, n) => {
4604
+ if (xe(e).forEach((e, n) => {
4595
4605
  let r = this.imgToScreen(e), i = this.handleNodes[n];
4596
4606
  i && this.layoutResizeHandle(i, r, t);
4597
4607
  }), this.setTransformerOutlinePoints(e), this.rotNode) {
@@ -4614,7 +4624,7 @@ var lr = class {
4614
4624
  }
4615
4625
  edgeHitQuad(e, t) {
4616
4626
  let n = Math.max(7, this.vertexHandleRadius() + 2), r = this.imgToScreen(e), i = this.imgToScreen(t), a = i.x - r.x, o = i.y - r.y, s = Math.hypot(a, o) || 1, c = -o / s * n, l = a / s * n;
4617
- return new ee([
4627
+ return new te([
4618
4628
  r.x + c,
4619
4629
  r.y + l,
4620
4630
  i.x + c,
@@ -4648,7 +4658,7 @@ var lr = class {
4648
4658
  let t = this.activeDrag;
4649
4659
  if (!t) return;
4650
4660
  this.applyCursor();
4651
- let n = Gn(this.shapes, t), { updates: r, box: i } = Q(t, e, n);
4661
+ let n = Kn(this.shapes, t), { updates: r, box: i } = Q(t, e, n);
4652
4662
  if (t.kind === "move") {
4653
4663
  let n = e.x - t.start.x, r = e.y - t.start.y;
4654
4664
  for (let e of t.shapes) {
@@ -4680,13 +4690,13 @@ var lr = class {
4680
4690
  this.cb.onTransformPreview?.([]), this.drawTransformer();
4681
4691
  return;
4682
4692
  }
4683
- let { updates: n } = Q(e, t, Gn(this.shapes, e));
4693
+ let { updates: n } = Q(e, t, Kn(this.shapes, e));
4684
4694
  e.kind === "move" && this.resetMoveOffsets(), this.commitTransformUpdates(n);
4685
4695
  }
4686
4696
  };
4687
4697
  //#endregion
4688
4698
  //#region src/components/ShapeEditor/_state/useEngineLifecycle.ts
4689
- function ur({ currentDocId: e, documentId: t, loadedUrl: n, renderedImageUrl: r }) {
4699
+ function dr({ currentDocId: e, documentId: t, loadedUrl: n, renderedImageUrl: r }) {
4690
4700
  if (!r) return e !== null || n !== null ? { kind: "clear" } : { kind: "none" };
4691
4701
  let i = e !== t;
4692
4702
  return !i && n === r ? { kind: "none" } : {
@@ -4694,7 +4704,7 @@ function ur({ currentDocId: e, documentId: t, loadedUrl: n, renderedImageUrl: r
4694
4704
  docChange: i
4695
4705
  };
4696
4706
  }
4697
- function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImageUrl: i, makeCallbacks: a, viewRef: o, readOnlyRef: s, toolRef: c, renderShapesRef: l, coordinateSizeRef: u, imageSizeRef: d, selRef: f, maskCanvasRef: p, regionOverlayRef: m, dimmedRef: h, syncMinimap: g, setImage: _, setImageVisible: v, setReady: y, setImageStatus: b, onContextMenuRequest: x }) {
4707
+ function fr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImageUrl: i, makeCallbacks: a, viewRef: o, readOnlyRef: s, toolRef: c, renderShapesRef: l, coordinateSizeRef: u, imageSizeRef: d, selRef: f, maskCanvasRef: p, regionOverlayRef: m, dimmedRef: h, syncMinimap: g, setImage: _, setImageVisible: v, setReady: y, setImageStatus: b, onContextMenuRequest: x }) {
4698
4708
  let C = O(i);
4699
4709
  C.current = i;
4700
4710
  let w = O(r);
@@ -4705,7 +4715,7 @@ function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImage
4705
4715
  j.current = x, S(() => {
4706
4716
  let r = t.current;
4707
4717
  if (!r) return;
4708
- let i = !1, a = null, b = null, x = A.current(), S = e === "konva" ? new ar(r, x) : new lr(r, x);
4718
+ let i = !1, a = null, b = null, x = A.current(), S = e === "konva" ? new or(r, x) : new ur(r, x);
4709
4719
  return n.current = S, (async () => {
4710
4720
  if (await S.init(), i) return;
4711
4721
  if (S.setFilter(o.current.brightness, o.current.contrast), S.setRenderDefaults({ strokeWidth: o.current.strokeSize }), S.setImageSmoothing(o.current.imageSmoothing), S.setTransformEnabled(!s.current), D.current = !0, C.current) {
@@ -4756,7 +4766,7 @@ function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImage
4756
4766
  }, [e]), S(() => {
4757
4767
  let e = n.current;
4758
4768
  if (!e || !D.current) return;
4759
- let t = ur({
4769
+ let t = dr({
4760
4770
  currentDocId: E.current,
4761
4771
  documentId: r,
4762
4772
  loadedUrl: T.current,
@@ -4800,19 +4810,19 @@ function dr({ backend: e, hostRef: t, engineRef: n, documentId: r, renderedImage
4800
4810
  }
4801
4811
  //#endregion
4802
4812
  //#region src/components/ShapeEditor/_state/useMinimapNavigation.ts
4803
- var fr = .05, pr = 20;
4804
- function mr(e) {
4813
+ var pr = .05, mr = 20;
4814
+ function hr(e) {
4805
4815
  let { deltaY: t, deltaX: n, deltaMode: r } = e;
4806
4816
  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);
4807
4817
  }
4808
- function hr(e) {
4818
+ function gr(e) {
4809
4819
  let t = e.currentTarget.getBoundingClientRect();
4810
4820
  return {
4811
4821
  x: e.clientX - t.left,
4812
4822
  y: e.clientY - t.top
4813
4823
  };
4814
4824
  }
4815
- function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4825
+ function _r({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4816
4826
  let i = O(null), a = !!t && t.w > 0 && t.h > 0, o = a ? Math.min(r / t.w, r / t.h) : 1, s = a ? t.w * o : 0, c = a ? t.h * o : 0, l = a ? (r - s) / 2 : 0, u = a ? (r - c) / 2 : 0, d = x(() => {
4817
4827
  let t = e.current;
4818
4828
  if (!t) return null;
@@ -4850,7 +4860,7 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4850
4860
  let n = e.current, r = d();
4851
4861
  if (!n || !r) return;
4852
4862
  t.preventDefault(), t.stopPropagation();
4853
- let a = hr(t), o = a.x >= r.x && a.x <= r.x + r.width && a.y >= r.y && a.y <= r.y + r.height ? {
4863
+ let a = gr(t), o = a.x >= r.x && a.x <= r.x + r.width && a.y >= r.y && a.y <= r.y + r.height ? {
4854
4864
  offsetX: a.x - r.x,
4855
4865
  offsetY: a.y - r.y
4856
4866
  } : {
@@ -4867,7 +4877,7 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4867
4877
  d
4868
4878
  ]), m = x((t) => {
4869
4879
  let n = i.current, r = e.current;
4870
- !n || !r || n.pointerId !== t.pointerId || (t.preventDefault(), t.stopPropagation(), f(hr(t), r.viewport.scale, n));
4880
+ !n || !r || n.pointerId !== t.pointerId || (t.preventDefault(), t.stopPropagation(), f(gr(t), r.viewport.scale, n));
4871
4881
  }, [f, e]), h = x((e) => {
4872
4882
  let t = i.current;
4873
4883
  !t || t.pointerId !== e.pointerId || (i.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId));
@@ -4875,8 +4885,8 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4875
4885
  let r = e.current;
4876
4886
  if (!r || !n) return;
4877
4887
  t.preventDefault(), t.stopPropagation();
4878
- let i = mr(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(fr, Math.min(pr, s));
4879
- f(hr(t), c);
4888
+ let i = hr(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(pr, Math.min(mr, s));
4889
+ f(gr(t), c);
4880
4890
  }, [
4881
4891
  f,
4882
4892
  e,
@@ -4913,7 +4923,7 @@ function gr({ engineRef: e, image: t, wheelZoom: n, minimapSize: r }) {
4913
4923
  }
4914
4924
  //#endregion
4915
4925
  //#region src/components/ShapeEditor/_state/useMinimapSync.ts
4916
- function _r(e, t, n) {
4926
+ function vr(e, t, n) {
4917
4927
  if (!(!e || !n.length)) {
4918
4928
  if (t.type === F.POINT) {
4919
4929
  e.setAttribute("cx", String(n[0].x)), e.setAttribute("cy", String(n[0].y));
@@ -4931,7 +4941,7 @@ function _r(e, t, n) {
4931
4941
  e.setAttribute("points", n.map((e) => `${e.x},${e.y}`).join(" "));
4932
4942
  }
4933
4943
  }
4934
- function vr({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRectRef: i, minimapSize: a, onViewportChangeRef: o }) {
4944
+ function yr({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRectRef: i, minimapSize: a, onViewportChangeRef: o }) {
4935
4945
  let s = O(/* @__PURE__ */ new Map());
4936
4946
  return {
4937
4947
  registerMinimapShape: x((e, t) => {
@@ -4940,13 +4950,13 @@ function vr({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRe
4940
4950
  applyMinimapPreview: x((e) => {
4941
4951
  let n = t.current.getShapes();
4942
4952
  if (!e.length) {
4943
- for (let e of n) _r(s.current.get(e.id), e, e.points);
4953
+ for (let e of n) vr(s.current.get(e.id), e, e.points);
4944
4954
  return;
4945
4955
  }
4946
4956
  let r = new Map(n.map((e) => [e.id, e]));
4947
4957
  for (let t of e) {
4948
4958
  let e = r.get(t.id);
4949
- e && _r(s.current.get(e.id), e, t.points);
4959
+ e && vr(s.current.get(e.id), e, t.points);
4950
4960
  }
4951
4961
  }, [t]),
4952
4962
  syncMinimap: x(() => {
@@ -4975,8 +4985,8 @@ function vr({ engineRef: e, docRef: t, overlayRef: n, zoomLabelRef: r, minimapRe
4975
4985
  }
4976
4986
  //#endregion
4977
4987
  //#region src/components/ShapeEditor/_state/useSelectionActions.ts
4978
- var yr = 12;
4979
- function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMergeSelection: i, clipboardDocumentId: a, clipboardScope: o }) {
4988
+ var br = 12;
4989
+ function xr({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMergeSelection: i, clipboardDocumentId: a, clipboardScope: o }) {
4980
4990
  let s = O(0), c = O(!0), l = O(n), u = O(a), d = O(o);
4981
4991
  l.current = n, u.current = a, d.current = o, S(() => (c.current = !0, () => {
4982
4992
  c.current = !1;
@@ -4995,7 +5005,7 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
4995
5005
  t
4996
5006
  ]), g = x(() => {
4997
5007
  let e = m();
4998
- e.length && (s.current = 0, gt(pt(e, a, o)));
5008
+ e.length && (s.current = 0, _t(mt(e, a, o)));
4999
5009
  }, [
5000
5010
  a,
5001
5011
  o,
@@ -5003,14 +5013,14 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5003
5013
  ]), _ = x(() => X(o), [o]), v = x((t) => {
5004
5014
  if (n) return;
5005
5015
  let i = a;
5006
- vt(o).then((n) => {
5016
+ yt(o).then((n) => {
5007
5017
  if (!c.current || l.current || u.current !== i || d.current !== o || !n?.shapes.length) return;
5008
5018
  let f, p, m = n.shapes.flatMap((e) => e.points);
5009
5019
  if (t && m.length) {
5010
5020
  let e = B(m);
5011
5021
  f = t.x - (e.minX + e.maxX) / 2, p = t.y - (e.minY + e.maxY) / 2;
5012
5022
  } else {
5013
- let e = !!n.documentId && n.documentId !== a, t = yt(s.current, e, yr);
5023
+ let e = !!n.documentId && n.documentId !== a, t = bt(s.current, e, br);
5014
5024
  f = t.offset, s.current = t.nextPasteCount, p = f;
5015
5025
  }
5016
5026
  let h = n.shapes.map((e) => ({
@@ -5035,8 +5045,8 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5035
5045
  ...e,
5036
5046
  id: se(),
5037
5047
  points: e.points.map((e) => ({
5038
- x: e.x + yr,
5039
- y: e.y + yr
5048
+ x: e.x + br,
5049
+ y: e.y + br
5040
5050
  }))
5041
5051
  }));
5042
5052
  i.length && (e.create(i), r(i.map((e) => e.id)));
@@ -5094,9 +5104,9 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5094
5104
  if (n) return;
5095
5105
  let t = T();
5096
5106
  if (t.length < 2 || i && !i(t)) return;
5097
- let a = fn([], 1, dn(t));
5107
+ let a = pn([], 1, fn(t));
5098
5108
  if (!a) return;
5099
- let o = pn(a, 1);
5109
+ let o = mn(a, 1);
5100
5110
  if (!o.length) return;
5101
5111
  let s = t[0], c = o.map((e) => ({
5102
5112
  id: se(),
@@ -5117,12 +5127,12 @@ function br({ doc: e, selRef: t, effectiveReadOnly: n, changeSelection: r, canMe
5117
5127
  }
5118
5128
  //#endregion
5119
5129
  //#region src/components/ShapeEditor/_state/useViewportControls.ts
5120
- function xr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBound: i, ready: a }) {
5130
+ function Sr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBound: i, ready: a }) {
5121
5131
  let o = O(null), s = O(null), c = x(() => {
5122
5132
  o.current?.(), o.current = null;
5123
5133
  }, []), l = x((t, n = r) => {
5124
5134
  let i = e.current;
5125
- i && (c(), o.current = Jt(i.viewport, t, (e) => i.applyViewport(e), n));
5135
+ i && (c(), o.current = Yt(i.viewport, t, (e) => i.applyViewport(e), n));
5126
5136
  }, [
5127
5137
  c,
5128
5138
  r,
@@ -5130,14 +5140,14 @@ function xr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
5130
5140
  ]), u = x((t, n = r) => {
5131
5141
  let i = e.current;
5132
5142
  if (!i) return;
5133
- let a = Kt(t, i.screenSize.w, i.screenSize.h);
5143
+ let a = qt(t, i.screenSize.w, i.screenSize.h);
5134
5144
  a && l(a, n);
5135
5145
  }, [
5136
5146
  l,
5137
5147
  r,
5138
5148
  e
5139
5149
  ]), d = x((e, n = r) => {
5140
- let i = Gt(t.getShapes().filter((t) => e.includes(t.id)));
5150
+ let i = Kt(t.getShapes().filter((t) => e.includes(t.id)));
5141
5151
  i && u(i, n);
5142
5152
  }, [
5143
5153
  t,
@@ -5148,7 +5158,7 @@ function xr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
5148
5158
  if (!r.length) return;
5149
5159
  let i = e.current;
5150
5160
  if (!i) return;
5151
- let a = qt(B(r.flatMap((e) => e.points)), i.screenSize.w, i.screenSize.h, 80);
5161
+ let a = Jt(B(r.flatMap((e) => e.points)), i.screenSize.w, i.screenSize.h, 80);
5152
5162
  a && l(a);
5153
5163
  }, [
5154
5164
  t,
@@ -5189,45 +5199,45 @@ function xr({ engineRef: e, doc: t, selRef: n, zoomAnimationDuration: r, zoomBou
5189
5199
  }
5190
5200
  //#endregion
5191
5201
  //#region src/components/ShapeEditor/ShapeEditor.tsx
5192
- var Sr = "__draft_preview__", Cr = new Set([
5202
+ var Cr = "__draft_preview__", wr = new Set([
5193
5203
  "copy",
5194
5204
  "selectAll",
5195
5205
  "clearSelection",
5196
5206
  "zoomToSelection"
5197
5207
  ]);
5198
- function wr(e, t) {
5208
+ function Tr(e, t) {
5199
5209
  return e.length === t.length && e.every((e, n) => e === t[n]);
5200
5210
  }
5201
- function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !1, selectedIds: i, activeTool: a, draftStyle: s, draftMeta: c, readOnly: l, disableMarquee: u, locked: d, onLockedInteraction: f, onIdleEscape: p, overrideShapeInteraction: m, defaultViewSettings: h, viewSettings: g, onViewSettingsChange: _, showMinimap: b = !0, showViewSettings: D = !0, getContextMenuItems: A, strings: j, canMergeSelection: M, brushSize: N = 20, zoomBound: P, zoomAnimationDuration: ee = 300, decorationShapes: te, regionMask: ne, guideMask: re, maskPalette: ae, overlayMarkers: L, renderOverlayMarker: R, onOverlayMarkerClick: z, renderImageOverlay: B, getSelectionLabel: ce, hideSelectionLabelDot: V, formatSelectionInfo: le, externalTools: ue, assistant: de, keymap: fe, handleRef: pe, backend: me = "pixi", onActiveToolChange: H, onSelectionChange: he, onEditingChange: ge, onShapesCreated: _e, onShapesUpdated: ve, onShapesDeleted: ye, onDrawSessionChange: be, onDraftShapeChange: xe, onViewportChange: Se, onShapesTransformPreview: Ce }) {
5202
- let we = O(null), U = O(null), Te = O(null), Ee = O(null), De = O(null), Oe = `${C()}-minimap`, [G, je] = k(null), [Me, Ne] = k(!1), [K, Re] = k(!1), [ze, Be] = k(null), [Ve, He] = k({
5211
+ function Er({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !1, selectedIds: i, activeTool: a, draftStyle: s, draftMeta: c, readOnly: l, disableMarquee: u, locked: d, onLockedInteraction: f, onIdleEscape: p, overrideShapeInteraction: m, defaultViewSettings: h, viewSettings: g, onViewSettingsChange: _, showMinimap: b = !0, minimapPosition: D = "bottom-left", showViewSettings: A = !0, getContextMenuItems: j, strings: ee, canMergeSelection: M, brushSize: N = 20, zoomBound: te, zoomAnimationDuration: ne = 300, decorationShapes: re, regionMask: P, guideMask: ae, maskPalette: L, overlayMarkers: R, renderOverlayMarker: z, onOverlayMarkerClick: B, renderImageOverlay: ce, getSelectionLabel: V, hideSelectionLabelDot: le, formatSelectionInfo: ue, externalTools: de, assistant: fe, keymap: pe, handleRef: me, backend: he = "pixi", onActiveToolChange: ge, onSelectionChange: _e, onEditingChange: ve, onShapesCreated: ye, onShapesUpdated: be, onShapesDeleted: xe, onDrawSessionChange: Se, onDraftShapeChange: Ce, onViewportChange: we, onShapesTransformPreview: Te }) {
5212
+ let Ee = O(null), H = O(null), De = O(null), Oe = O(null), U = O(null), je = `${C()}-minimap`, [G, Me] = k(null), [Ne, Fe] = k(!1), [K, ze] = k(!1), [Be, Ve] = k(null), [He, Ue] = k({
5203
5213
  active: !1,
5204
5214
  kind: "none",
5205
5215
  canUndo: !1,
5206
5216
  canRedo: !1
5207
- }), [Ue, We] = k(!0), [Ge, Ke] = k(!1), qe = e?.id ?? "", Je = e?.imageUrl ?? "", Ye = e?.displayImageUrl, Ze = e?.coordinateSize, Qe = e?.initialShapes, $e = e?.initialSelectedIds, et = Ye ?? Je, [tt, at] = k("loading"), q = wn({
5208
- onShapesCreated: _e,
5209
- onShapesUpdated: ve,
5210
- onShapesDeleted: ye
5211
- }), [st, ct] = k([]), J = i ?? st, lt = i !== void 0, ut = E(() => new Map((ue ?? []).map((e) => [e.id, e])), [ue]), dt = O(ut);
5217
+ }), [We, Ge] = k(!0), [Ke, qe] = k(!1), Je = e?.id ?? "", Ye = e?.imageUrl ?? "", Xe = e?.displayImageUrl, Qe = e?.coordinateSize, $e = e?.initialShapes, et = e?.initialSelectedIds, tt = Xe ?? Ye, [nt, ot] = k("loading"), q = Tn({
5218
+ onShapesCreated: ye,
5219
+ onShapesUpdated: be,
5220
+ onShapesDeleted: xe
5221
+ }), [ct, lt] = k([]), J = i ?? ct, ut = i !== void 0, dt = E(() => new Map((de ?? []).map((e) => [e.id, e])), [de]), ft = O(dt);
5212
5222
  T(() => {
5213
- dt.current = ut;
5214
- }, [ut]);
5215
- let ft = O(Ve);
5216
- ft.current = Ve;
5217
- let pt = E(() => {
5223
+ ft.current = dt;
5224
+ }, [dt]);
5225
+ let pt = O(He);
5226
+ pt.current = He;
5227
+ let mt = E(() => {
5218
5228
  let e = Object.fromEntries(Object.entries(h ?? {}).filter(([, e]) => e !== void 0));
5219
5229
  return {
5220
5230
  ...Ae,
5221
5231
  ...e
5222
5232
  };
5223
- }, [h]), ht = O(pt);
5224
- ht.current = pt;
5225
- let [Y, gt] = k(() => ht.current), _t = x((e) => gt((t) => ({
5233
+ }, [h]), gt = O(mt);
5234
+ gt.current = mt;
5235
+ let [Y, _t] = k(() => gt.current), vt = x((e) => _t((t) => ({
5226
5236
  ...t,
5227
5237
  ...e
5228
- })), []), X = E(() => ke(j), [j]);
5238
+ })), []), X = E(() => ke(ee), [ee]);
5229
5239
  S(() => {
5230
- g && gt((e) => {
5240
+ g && _t((e) => {
5231
5241
  let t = Object.entries(g).filter(([t, n]) => n !== void 0 && e[t] !== n);
5232
5242
  return t.length ? {
5233
5243
  ...e,
@@ -5235,78 +5245,78 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5235
5245
  } : e;
5236
5246
  });
5237
5247
  }, [g]);
5238
- let vt = O(_);
5239
- vt.current = _;
5240
- let yt = O(!1);
5248
+ let yt = O(_);
5249
+ yt.current = _;
5250
+ let bt = O(!1);
5241
5251
  S(() => {
5242
- if (!yt.current) {
5243
- yt.current = !0;
5252
+ if (!bt.current) {
5253
+ bt.current = !0;
5244
5254
  return;
5245
5255
  }
5246
- vt.current?.(Y);
5256
+ yt.current?.(Y);
5247
5257
  }, [Y]);
5248
- let bt = E(() => !re || !ae ? null : Ot(re, ae), [re, ae]), xt = E(() => bt?.toDataURL() ?? null, [bt]), St = E(() => !G || !ne ? null : zt(ne, G.w, G.h), [G, ne]), Ct = O(bt);
5249
- Ct.current = bt;
5250
- let wt = O(St);
5251
- wt.current = St;
5252
- let Et = O(r);
5253
- Et.current = r;
5254
- let Dt = O(G);
5255
- Dt.current = G;
5256
- let kt = O(Ze);
5257
- kt.current = Ze;
5258
- let At = O(Ze?.imageSize);
5259
- At.current = Ze?.imageSize;
5260
- let jt = O(J);
5258
+ let xt = E(() => !ae || !L ? null : kt(ae, L), [ae, L]), St = E(() => xt?.toDataURL() ?? null, [xt]), Ct = E(() => !G || !P ? null : Bt(P, G.w, G.h), [G, P]), wt = O(xt);
5259
+ wt.current = xt;
5260
+ let Tt = O(Ct);
5261
+ Tt.current = Ct;
5262
+ let Dt = O(r);
5263
+ Dt.current = r;
5264
+ let Ot = O(G);
5265
+ Ot.current = G;
5266
+ let At = O(Qe);
5267
+ At.current = Qe;
5268
+ let jt = O(Qe?.imageSize);
5269
+ jt.current = Qe?.imageSize;
5270
+ let Mt = O(J);
5261
5271
  T(() => {
5262
- jt.current = J;
5272
+ Mt.current = J;
5263
5273
  }, [J]);
5264
- let Mt = O(a);
5265
- Mt.current = a;
5266
- let Nt = O(s);
5267
- Nt.current = s;
5268
- let Pt = O(c);
5269
- Pt.current = c;
5270
- let Ft = O(N);
5271
- Ft.current = N;
5272
- let It = O(Y.simplifyStrength);
5273
- It.current = Y.simplifyStrength;
5274
- let Z = !!l || !!d, Lt = O(Z);
5275
- Lt.current = Z;
5276
- let Rt = O(u);
5277
- Rt.current = u;
5278
- let Bt = O(d);
5279
- Bt.current = d;
5280
- let Vt = O(f);
5281
- Vt.current = f;
5282
- let Ht = O(m);
5283
- Ht.current = m;
5284
- let Ut = O(q);
5285
- Ut.current = q;
5286
- let Wt = O(!1), Gt = O(!1), Kt = O("idle"), qt = O(null), Jt = x(() => {
5287
- let e = U.current;
5274
+ let Nt = O(a);
5275
+ Nt.current = a;
5276
+ let Pt = O(s);
5277
+ Pt.current = s;
5278
+ let Ft = O(c);
5279
+ Ft.current = c;
5280
+ let It = O(N);
5281
+ It.current = N;
5282
+ let Lt = O(Y.simplifyStrength);
5283
+ Lt.current = Y.simplifyStrength;
5284
+ let Z = !!l || !!d, Rt = O(Z);
5285
+ Rt.current = Z;
5286
+ let zt = O(u);
5287
+ zt.current = u;
5288
+ let Vt = O(d);
5289
+ Vt.current = d;
5290
+ let Ht = O(f);
5291
+ Ht.current = f;
5292
+ let Ut = O(m);
5293
+ Ut.current = m;
5294
+ let Wt = O(q);
5295
+ Wt.current = q;
5296
+ let Gt = O(!1), Kt = O(!1), qt = O("idle"), Jt = O(null), Yt = x(() => {
5297
+ let e = H.current;
5288
5298
  if (!e) return;
5289
- let t = Mt.current, n = dt.current.get(t), r = ft.current;
5290
- e.setCursor(Tt({
5299
+ let t = Nt.current, n = ft.current.get(t), r = pt.current;
5300
+ e.setCursor(Et({
5291
5301
  tool: t,
5292
5302
  externalToolCursor: n?.cursor,
5293
- isSpacePressed: Wt.current,
5294
- interactionMode: Kt.current,
5295
- rendererCursorHint: qt.current,
5303
+ isSpacePressed: Gt.current,
5304
+ interactionMode: qt.current,
5305
+ rendererCursorHint: Jt.current,
5296
5306
  isPolygonDrawing: r.kind === "polygon" && r.active
5297
5307
  }));
5298
- }, []), Zt = x((e) => {
5299
- Kt.current !== e && (Kt.current = e, Jt());
5300
- }, [Jt]), Qt = x((e) => {
5301
- qt.current !== e && (qt.current = e, Jt());
5302
- }, [Jt]), $t = x((e) => {
5303
- let t = /* @__PURE__ */ new Set(), n = new Map(Ut.current.getShapes().map((e) => [e.id, e]));
5308
+ }, []), Qt = x((e) => {
5309
+ qt.current !== e && (qt.current = e, Yt());
5310
+ }, [Yt]), $t = x((e) => {
5311
+ Jt.current !== e && (Jt.current = e, Yt());
5312
+ }, [Yt]), en = x((e) => {
5313
+ let t = /* @__PURE__ */ new Set(), n = new Map(Wt.current.getShapes().map((e) => [e.id, e]));
5304
5314
  return e.filter((e) => {
5305
5315
  if (t.has(e)) return !1;
5306
5316
  t.add(e);
5307
5317
  let r = n.get(e);
5308
5318
  if (!r) return !1;
5309
- let i = Ht.current?.(r);
5319
+ let i = Ut.current?.(r);
5310
5320
  return I(i ? {
5311
5321
  ...r,
5312
5322
  interaction: {
@@ -5315,283 +5325,283 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5315
5325
  }
5316
5326
  } : r);
5317
5327
  });
5318
- }, []), en = x((e) => {
5319
- let t = $t(e);
5320
- wr(jt.current, t) || (lt || ct(t), U.current?.setSelection(t), he?.(t));
5328
+ }, []), tn = x((e) => {
5329
+ let t = en(e);
5330
+ Tr(Mt.current, t) || (ut || lt(t), H.current?.setSelection(t), _e?.(t));
5321
5331
  }, [
5322
- $t,
5323
- he,
5324
- lt
5325
- ]), tn = O(en);
5326
- tn.current = en;
5327
- let [nn, rn] = k(null), an = x((e) => rn(e), []), on = O(an);
5328
- on.current = an;
5329
- let sn = O(null);
5330
- sn.current = nn, S(() => {
5331
- if (!lt) return;
5332
- let e = $t(i);
5333
- wr(i, e) || he?.(e);
5332
+ en,
5333
+ _e,
5334
+ ut
5335
+ ]), nn = O(tn);
5336
+ nn.current = tn;
5337
+ let [rn, an] = k(null), on = x((e) => an(e), []), sn = O(on);
5338
+ sn.current = on;
5339
+ let cn = O(null);
5340
+ cn.current = rn, S(() => {
5341
+ if (!ut) return;
5342
+ let e = en(i);
5343
+ Tr(i, e) || _e?.(e);
5334
5344
  }, [
5335
5345
  i,
5336
5346
  q.shapes,
5337
- $t,
5338
- he,
5339
- lt
5347
+ en,
5348
+ _e,
5349
+ ut
5340
5350
  ]);
5341
- let cn = O(Se);
5342
- cn.current = Se;
5343
- let { registerMinimapShape: ln, applyMinimapPreview: un, syncMinimap: dn } = vr({
5344
- engineRef: U,
5345
- docRef: Ut,
5346
- overlayRef: Ee,
5347
- zoomLabelRef: De,
5348
- minimapRectRef: Te,
5351
+ let ln = O(we);
5352
+ ln.current = we;
5353
+ let { registerMinimapShape: un, applyMinimapPreview: dn, syncMinimap: fn } = yr({
5354
+ engineRef: H,
5355
+ docRef: Wt,
5356
+ overlayRef: Oe,
5357
+ zoomLabelRef: U,
5358
+ minimapRectRef: De,
5349
5359
  minimapSize: 204,
5350
- onViewportChangeRef: cn
5351
- }), fn = O(/* @__PURE__ */ new Map()), pn = O(le);
5352
- pn.current = le;
5353
- let mn = x((e, t) => {
5354
- t ? fn.current.set(e, t) : fn.current.delete(e);
5355
- }, []), hn = O(null), [gn, _n] = k(null), vn = x((e) => {
5360
+ onViewportChangeRef: ln
5361
+ }), pn = O(/* @__PURE__ */ new Map()), mn = O(ue);
5362
+ mn.current = ue;
5363
+ let hn = x((e, t) => {
5364
+ t ? pn.current.set(e, t) : pn.current.delete(e);
5365
+ }, []), gn = O(null), [_n, vn] = k(null), yn = x((e) => {
5356
5366
  if (!e.length) return;
5357
- let t = new Map(Ut.current.getShapes().map((e) => [e.id, e]));
5358
- hn.current && t.set(hn.current.id, hn.current);
5367
+ let t = new Map(Wt.current.getShapes().map((e) => [e.id, e]));
5368
+ gn.current && t.set(gn.current.id, gn.current);
5359
5369
  for (let { id: n, points: r } of e) {
5360
- let e = fn.current.get(n), i = t.get(n);
5370
+ let e = pn.current.get(n), i = t.get(n);
5361
5371
  if (!e || !i) continue;
5362
- let a = nt(e, r);
5372
+ let a = rt(e, r);
5363
5373
  if (a) {
5364
- let e = rt(i, r);
5365
- a.textContent = pn.current?.(e) ?? it(e);
5374
+ let e = it(i, r);
5375
+ a.textContent = mn.current?.(e) ?? at(e);
5366
5376
  }
5367
5377
  }
5368
- }, []), yn = x((e) => {
5369
- un(e), vn(e), Ce?.(e);
5378
+ }, []), bn = x((e) => {
5379
+ dn(e), yn(e), Te?.(e);
5370
5380
  }, [
5371
- un,
5372
- vn,
5373
- Ce
5374
- ]), bn = x((e) => {
5375
- if (xe?.(e ? {
5381
+ dn,
5382
+ yn,
5383
+ Te
5384
+ ]), xn = x((e) => {
5385
+ if (Ce?.(e ? {
5376
5386
  ...e,
5377
- meta: Pt.current
5378
- } : null), !e || !Nt.current) {
5379
- hn.current && (hn.current = null, _n(null));
5387
+ meta: Ft.current
5388
+ } : null), !e || !Pt.current) {
5389
+ gn.current && (gn.current = null, vn(null));
5380
5390
  return;
5381
5391
  }
5382
5392
  let t = {
5383
- id: Sr,
5393
+ id: Cr,
5384
5394
  type: e.type,
5385
5395
  points: e.points,
5386
- style: Nt.current,
5387
- meta: Pt.current
5388
- }, n = hn.current !== null;
5389
- hn.current = t, n ? vn([{
5390
- id: Sr,
5396
+ style: Pt.current,
5397
+ meta: Ft.current
5398
+ }, n = gn.current !== null;
5399
+ gn.current = t, n ? yn([{
5400
+ id: Cr,
5391
5401
  points: e.points
5392
- }]) : _n(t);
5393
- }, [vn, xe]), Sn = x((e, t) => {
5394
- let n = Nt.current;
5395
- if (!n || Lt.current) return;
5402
+ }]) : vn(t);
5403
+ }, [yn, Ce]), Cn = x((e, t) => {
5404
+ let n = Pt.current;
5405
+ if (!n || Rt.current) return;
5396
5406
  let r = se();
5397
- Ut.current.create({
5407
+ Wt.current.create({
5398
5408
  id: r,
5399
5409
  type: e,
5400
5410
  points: t,
5401
5411
  style: n,
5402
5412
  meta: c
5403
- }), tn.current([r]);
5404
- }, [c]), Cn = O(Sn);
5405
- Cn.current = Sn;
5406
- let Tn = xn({
5407
- toolRef: Mt,
5408
- selRef: jt,
5409
- docRef: Ut,
5410
- readOnlyRef: Lt,
5411
- draftRef: Nt,
5412
- brushSizeRef: Ft,
5413
- simplifyEpsilonRef: It,
5413
+ }), nn.current([r]);
5414
+ }, [c]), wn = O(Cn);
5415
+ wn.current = Cn;
5416
+ let En = Sn({
5417
+ toolRef: Nt,
5418
+ selRef: Mt,
5419
+ docRef: Wt,
5420
+ readOnlyRef: Rt,
5421
+ draftRef: Pt,
5422
+ brushSizeRef: It,
5423
+ simplifyEpsilonRef: Lt,
5414
5424
  draftMeta: c,
5415
- engineRef: U,
5425
+ engineRef: H,
5416
5426
  onDrawSessionChange: x((e) => {
5417
- He(e), be?.(e);
5418
- }, [be]),
5419
- onDraftShapeChange: xe,
5420
- changeSelection: en,
5421
- createShape: Sn
5422
- }), En = O(Tn);
5423
- En.current = Tn;
5424
- let { reset: Dn, undoSession: On, redoSession: kn, canUndoSession: An, canRedoSession: jn, hasDraftSession: Mn, hasDraftPoints: Nn, commitDraftSession: Fn, setBrushScalarMode: In, getBrushScalarMode: Ln, hasBrushSession: Rn, commitBrush: zn, cancelBrush: Bn, beginBrushEditFromSelection: Vn, deleteDraftSelectedPoints: Hn, handleToolChange: Un, handleBrushSelectionChange: Wn } = Tn, Gn = O(de);
5425
- Gn.current = de;
5426
- let Q = Xt({
5427
- docRef: Ut,
5428
- draftRef: Nt,
5427
+ Ue(e), Se?.(e);
5428
+ }, [Se]),
5429
+ onDraftShapeChange: Ce,
5430
+ changeSelection: tn,
5431
+ createShape: Cn
5432
+ }), Dn = O(En);
5433
+ Dn.current = En;
5434
+ let { reset: On, undoSession: kn, redoSession: An, canUndoSession: jn, canRedoSession: Mn, hasDraftSession: Nn, hasDraftPoints: Pn, commitDraftSession: In, setBrushScalarMode: Ln, getBrushScalarMode: Rn, hasBrushSession: zn, commitBrush: Bn, cancelBrush: Vn, beginBrushEditFromSelection: Hn, deleteDraftSelectedPoints: Un, handleToolChange: Wn, handleBrushSelectionChange: Gn } = En, Kn = O(fe);
5435
+ Kn.current = fe;
5436
+ let Q = Zt({
5437
+ docRef: Wt,
5438
+ draftRef: Pt,
5429
5439
  draftMeta: c,
5430
- changeSelection: en,
5431
- assistantRef: Gn
5432
- }), Kn = O(Q);
5433
- Kn.current = Q;
5434
- let qn = E(() => mt(qe), [qe]), { selectAll: Jn, clearSelection: Yn, deleteSelection: Xn, copySelection: Zn, canPaste: Qn, paste: $n, duplicate: er, bringToFront: tr, sendToBack: nr, nudgeSelection: rr, getMergeTargets: ir, mergeSelection: ar } = br({
5440
+ changeSelection: tn,
5441
+ assistantRef: Kn
5442
+ }), qn = O(Q);
5443
+ qn.current = Q;
5444
+ let Jn = E(() => ht(Je), [Je]), { selectAll: Yn, clearSelection: Xn, deleteSelection: Zn, copySelection: Qn, canPaste: $n, paste: er, duplicate: tr, bringToFront: nr, sendToBack: rr, nudgeSelection: ir, getMergeTargets: ar, mergeSelection: or } = xr({
5435
5445
  doc: q,
5436
- selRef: jt,
5446
+ selRef: Mt,
5437
5447
  effectiveReadOnly: Z,
5438
- changeSelection: en,
5448
+ changeSelection: tn,
5439
5449
  canMergeSelection: M,
5440
- clipboardDocumentId: qn,
5441
- clipboardScope: t ?? qn
5442
- }), { zoomToBounds: or, zoomToShapes: sr, zoomToSelection: cr, zoomAtCenter: $ } = xr({
5443
- engineRef: U,
5450
+ clipboardDocumentId: Jn,
5451
+ clipboardScope: t ?? Jn
5452
+ }), { zoomToBounds: sr, zoomToShapes: cr, zoomToSelection: lr, zoomAtCenter: $ } = Sr({
5453
+ engineRef: H,
5444
5454
  doc: q,
5445
- selRef: jt,
5446
- zoomAnimationDuration: ee,
5447
- zoomBound: P,
5455
+ selRef: Mt,
5456
+ zoomAnimationDuration: ne,
5457
+ zoomBound: te,
5448
5458
  ready: K
5449
5459
  });
5450
- w(pe, () => ({
5460
+ w(me, () => ({
5451
5461
  previewRegionMask: (e) => {
5452
- let t = Dt.current;
5462
+ let t = Ot.current;
5453
5463
  if (!t) return;
5454
- let n = e ? zt(e, t.w, t.h) : wt.current;
5455
- U.current?.setRegionOverlay(lr.current.showRegionMask ? n : null);
5464
+ let n = e ? Bt(e, t.w, t.h) : Tt.current;
5465
+ H.current?.setRegionOverlay(ur.current.showRegionMask ? n : null);
5456
5466
  },
5457
5467
  undo: () => {
5458
- On() || q.undo();
5468
+ kn() || q.undo();
5459
5469
  },
5460
5470
  redo: () => {
5461
- kn() || q.redo();
5471
+ An() || q.redo();
5462
5472
  },
5463
- canUndo: () => An() || q.canUndo(),
5464
- canRedo: () => jn() || q.canRedo(),
5465
- undoSession: On,
5466
- redoSession: kn,
5467
- canUndoSession: An,
5468
- canRedoSession: jn,
5469
- hasDraftSession: Mn,
5470
- cancelDraftSession: Dn,
5471
- commitDraftSession: Fn,
5472
- setSelection: en,
5473
+ canUndo: () => jn() || q.canUndo(),
5474
+ canRedo: () => Mn() || q.canRedo(),
5475
+ undoSession: kn,
5476
+ redoSession: An,
5477
+ canUndoSession: jn,
5478
+ canRedoSession: Mn,
5479
+ hasDraftSession: Nn,
5480
+ cancelDraftSession: On,
5481
+ commitDraftSession: In,
5482
+ setSelection: tn,
5473
5483
  createShapes: (e) => {
5474
- e.length && (q.create(e), en(e.map((e) => e.id)));
5484
+ e.length && (q.create(e), tn(e.map((e) => e.id)));
5475
5485
  },
5476
5486
  updateShapes: q.update,
5477
5487
  deleteShapes: q.remove,
5478
5488
  getShapes: q.getShapes,
5479
- selectAll: Jn,
5480
- clearSelection: Yn,
5481
- deleteSelection: Xn,
5482
- copySelection: Zn,
5483
- paste: $n,
5484
- duplicate: er,
5485
- bringToFront: tr,
5486
- sendToBack: nr,
5487
- zoomFit: () => U.current?.fit(),
5488
- zoom100: () => U.current?.zoom100(),
5489
+ selectAll: Yn,
5490
+ clearSelection: Xn,
5491
+ deleteSelection: Zn,
5492
+ copySelection: Qn,
5493
+ paste: er,
5494
+ duplicate: tr,
5495
+ bringToFront: nr,
5496
+ sendToBack: rr,
5497
+ zoomFit: () => H.current?.fit(),
5498
+ zoom100: () => H.current?.zoom100(),
5489
5499
  zoomIn: () => {
5490
- let e = U.current;
5500
+ let e = H.current;
5491
5501
  if (!e) return;
5492
5502
  let { w: t, h: n } = e.screenSize;
5493
5503
  e.zoomAt(t / 2, n / 2, 1.2);
5494
5504
  },
5495
5505
  zoomOut: () => {
5496
- let e = U.current;
5506
+ let e = H.current;
5497
5507
  if (!e) return;
5498
5508
  let { w: t, h: n } = e.screenSize;
5499
5509
  e.zoomAt(t / 2, n / 2, 1 / 1.2);
5500
5510
  },
5501
- zoomToSelection: cr,
5502
- zoomToShapes: sr,
5503
- zoomToBounds: or,
5511
+ zoomToSelection: lr,
5512
+ zoomToShapes: cr,
5513
+ zoomToBounds: sr,
5504
5514
  brush: {
5505
- setScalarMode: In,
5506
- getScalarMode: Ln,
5507
- hasSession: Rn,
5508
- commit: zn,
5509
- cancel: Bn,
5510
- beginEditFromSelection: Vn
5515
+ setScalarMode: Ln,
5516
+ getScalarMode: Rn,
5517
+ hasSession: zn,
5518
+ commit: Bn,
5519
+ cancel: Vn,
5520
+ beginEditFromSelection: Hn
5511
5521
  }
5512
5522
  }), [
5513
5523
  q,
5514
- en,
5515
- On,
5524
+ tn,
5516
5525
  kn,
5517
- Fn,
5518
- Dn,
5519
- zn,
5526
+ An,
5527
+ In,
5528
+ On,
5520
5529
  Bn,
5521
- Jn,
5530
+ Vn,
5522
5531
  Yn,
5523
5532
  Xn,
5524
5533
  Zn,
5525
- $n,
5534
+ Qn,
5526
5535
  er,
5527
5536
  tr,
5528
5537
  nr,
5538
+ rr,
5539
+ lr,
5529
5540
  cr,
5530
5541
  sr,
5531
- or,
5532
- In,
5533
5542
  Ln,
5534
5543
  Rn,
5535
- Vn
5544
+ zn,
5545
+ Hn
5536
5546
  ]);
5537
- let lr = O(Y);
5538
- lr.current = Y;
5539
- let ur = x(() => Yt({
5540
- engineRef: U,
5541
- toolRef: Mt,
5542
- externalToolMapRef: dt,
5543
- spaceRef: Wt,
5544
- shiftRef: Gt,
5545
- docRef: Ut,
5546
- selRef: jt,
5547
- draftRef: Nt,
5548
- readOnlyRef: Lt,
5549
- disableMarqueeRef: Rt,
5550
- lockedRef: Bt,
5551
- onLockedInteraction: () => Vt.current?.(),
5552
- createRef: Cn,
5553
- selectRef: tn,
5554
- enterEditRef: on,
5555
- editingIdRef: sn,
5556
- drawSessionRef: En,
5557
- assistantRef: Kn,
5558
- setCursorHint: Qt,
5559
- setInteractionMode: Zt,
5560
- syncMinimap: dn,
5561
- onTransformPreview: yn,
5562
- onDrawPreview: bn
5547
+ let ur = O(Y);
5548
+ ur.current = Y;
5549
+ let dr = x(() => Xt({
5550
+ engineRef: H,
5551
+ toolRef: Nt,
5552
+ externalToolMapRef: ft,
5553
+ spaceRef: Gt,
5554
+ shiftRef: Kt,
5555
+ docRef: Wt,
5556
+ selRef: Mt,
5557
+ draftRef: Pt,
5558
+ readOnlyRef: Rt,
5559
+ disableMarqueeRef: zt,
5560
+ lockedRef: Vt,
5561
+ onLockedInteraction: () => Ht.current?.(),
5562
+ createRef: wn,
5563
+ selectRef: nn,
5564
+ enterEditRef: sn,
5565
+ editingIdRef: cn,
5566
+ drawSessionRef: Dn,
5567
+ assistantRef: qn,
5568
+ setCursorHint: $t,
5569
+ setInteractionMode: Qt,
5570
+ syncMinimap: fn,
5571
+ onTransformPreview: bn,
5572
+ onDrawPreview: xn
5563
5573
  }), [
5574
+ $t,
5564
5575
  Qt,
5565
- Zt,
5566
- dn,
5567
- yn,
5568
- bn
5569
- ]), fr = O([]);
5570
- dr({
5571
- backend: me,
5572
- hostRef: we,
5573
- engineRef: U,
5574
- documentId: qe,
5575
- renderedImageUrl: et,
5576
- makeCallbacks: ur,
5577
- viewRef: lr,
5578
- readOnlyRef: Lt,
5579
- toolRef: Mt,
5580
- renderShapesRef: fr,
5581
- coordinateSizeRef: kt,
5582
- imageSizeRef: At,
5583
- selRef: jt,
5584
- maskCanvasRef: Ct,
5585
- regionOverlayRef: wt,
5586
- dimmedRef: Et,
5587
- syncMinimap: dn,
5588
- setImage: je,
5589
- setImageVisible: Ne,
5590
- setReady: Re,
5591
- setImageStatus: at,
5592
- onContextMenuRequest: Be
5576
+ fn,
5577
+ bn,
5578
+ xn
5579
+ ]), pr = O([]);
5580
+ fr({
5581
+ backend: he,
5582
+ hostRef: Ee,
5583
+ engineRef: H,
5584
+ documentId: Je,
5585
+ renderedImageUrl: tt,
5586
+ makeCallbacks: dr,
5587
+ viewRef: ur,
5588
+ readOnlyRef: Rt,
5589
+ toolRef: Nt,
5590
+ renderShapesRef: pr,
5591
+ coordinateSizeRef: At,
5592
+ imageSizeRef: jt,
5593
+ selRef: Mt,
5594
+ maskCanvasRef: wt,
5595
+ regionOverlayRef: Tt,
5596
+ dimmedRef: Dt,
5597
+ syncMinimap: fn,
5598
+ setImage: Me,
5599
+ setImageVisible: Fe,
5600
+ setReady: ze,
5601
+ setImageStatus: ot,
5602
+ onContextMenuRequest: Ve
5593
5603
  });
5594
- let pr = E(() => {
5604
+ let mr = E(() => {
5595
5605
  let e = m ? q.shapes.map((e) => {
5596
5606
  let t = m(e);
5597
5607
  return t ? {
@@ -5602,7 +5612,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5602
5612
  }
5603
5613
  } : e;
5604
5614
  }) : q.shapes;
5605
- return te?.length ? [...te.map((e) => ({
5615
+ return re?.length ? [...re.map((e) => ({
5606
5616
  ...e,
5607
5617
  interaction: {
5608
5618
  ...e.interaction,
@@ -5615,150 +5625,150 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5615
5625
  }, [
5616
5626
  q.shapes,
5617
5627
  m,
5618
- te
5628
+ re
5619
5629
  ]);
5620
- fr.current = pr, S(() => {
5621
- U.current?.setShapes(pr, jt.current), dn();
5622
- }, [pr, dn]), S(() => {
5623
- U.current?.setSelection(J);
5630
+ pr.current = mr, S(() => {
5631
+ H.current?.setShapes(mr, Mt.current), fn();
5632
+ }, [mr, fn]), S(() => {
5633
+ H.current?.setSelection(J);
5624
5634
  }, [J]), S(() => {
5625
- U.current?.setEditing(nn);
5626
- }, [nn, K]);
5627
- let mr = O(ge);
5628
- mr.current = ge, S(() => {
5629
- mr.current?.(nn);
5630
- }, [nn]), S(() => {
5631
- rn(null);
5635
+ H.current?.setEditing(rn);
5636
+ }, [rn, K]);
5637
+ let hr = O(ve);
5638
+ hr.current = ve, S(() => {
5639
+ hr.current?.(rn);
5640
+ }, [rn]), S(() => {
5641
+ an(null);
5632
5642
  }, [a]), S(() => {
5633
- nn && (J.length !== 1 || J[0] !== nn) && rn(null);
5634
- }, [J, nn]), S(() => {
5635
- let e = U.current;
5636
- e && (e.setFilter(Y.brightness, Y.contrast), e.setRenderDefaults({ strokeWidth: Y.strokeSize }), e.setImageSmoothing(Y.imageSmoothing), dn());
5643
+ rn && (J.length !== 1 || J[0] !== rn) && an(null);
5644
+ }, [J, rn]), S(() => {
5645
+ let e = H.current;
5646
+ e && (e.setFilter(Y.brightness, Y.contrast), e.setRenderDefaults({ strokeWidth: Y.strokeSize }), e.setImageSmoothing(Y.imageSmoothing), fn());
5637
5647
  }, [
5638
5648
  Y.brightness,
5639
5649
  Y.contrast,
5640
5650
  Y.strokeSize,
5641
5651
  Y.imageSmoothing,
5642
- dn
5652
+ fn
5643
5653
  ]), T(() => {
5644
- K && U.current?.setOverlays(Y.showGuide ? bt : null, Y.showRegionMask ? St : null, r);
5654
+ K && H.current?.setOverlays(Y.showGuide ? xt : null, Y.showRegionMask ? Ct : null, r);
5645
5655
  }, [
5646
5656
  K,
5647
- bt,
5648
- St,
5657
+ xt,
5658
+ Ct,
5649
5659
  Y.showGuide,
5650
5660
  Y.showRegionMask,
5651
5661
  r
5652
5662
  ]), S(() => {
5653
- !K || !G || dn();
5663
+ !K || !G || fn();
5654
5664
  }, [
5655
5665
  K,
5656
5666
  G,
5657
- xt,
5667
+ St,
5658
5668
  Y.showGuide,
5659
5669
  Y.showRegionMask,
5660
- ne,
5661
- dn
5670
+ P,
5671
+ fn
5662
5672
  ]), S(() => {
5663
- K && U.current?.setTransformEnabled(!Z && a !== W.BRUSH);
5673
+ K && H.current?.setTransformEnabled(!Z && a !== W.BRUSH);
5664
5674
  }, [
5665
5675
  Z,
5666
5676
  K,
5667
5677
  a
5668
5678
  ]), S(() => {
5669
- Un(a, dt.current.has(a));
5670
- }, [a, Un]);
5671
- let hr = Q.finalize;
5679
+ Wn(a, ft.current.has(a));
5680
+ }, [a, Wn]);
5681
+ let gr = Q.finalize;
5672
5682
  S(() => {
5673
- hr();
5674
- }, [a, hr]), S(() => {
5675
- Kt.current = "idle", qt.current = null, Jt();
5683
+ gr();
5684
+ }, [a, gr]), S(() => {
5685
+ qt.current = "idle", Jt.current = null, Yt();
5676
5686
  }, [
5677
5687
  a,
5678
- me,
5679
- Jt
5688
+ he,
5689
+ Yt
5680
5690
  ]), S(() => {
5681
- Wn(J, Z);
5691
+ Gn(J, Z);
5682
5692
  }, [
5683
5693
  J,
5684
5694
  a,
5685
5695
  Z,
5686
- Wn
5696
+ Gn
5687
5697
  ]), S(() => {
5688
- K && Jt();
5698
+ K && Yt();
5689
5699
  }, [
5690
5700
  a,
5691
- Ve,
5692
- ut,
5701
+ He,
5702
+ dt,
5693
5703
  K,
5694
- Jt
5704
+ Yt
5695
5705
  ]);
5696
- let _r = O($e);
5697
- _r.current = $e;
5698
- let yr = e !== null, Tr = O(null);
5706
+ let vr = O(et);
5707
+ vr.current = et;
5708
+ let br = e !== null, Er = O(null);
5699
5709
  S(() => {
5700
- let e = yr ? qe : null;
5701
- Tr.current !== e && (Tr.current = e, Be(null), rn(null), Kt.current = "idle", qt.current = null, q.reset(yr ? Qe ?? [] : []), en(yr ? _r.current ?? [] : []), Dn(), hr(), Jt());
5710
+ let e = br ? Je : null;
5711
+ Er.current !== e && (Er.current = e, Ve(null), an(null), qt.current = "idle", Jt.current = null, q.reset(br ? $e ?? [] : []), tn(br ? vr.current ?? [] : []), On(), gr(), Yt());
5702
5712
  }, [
5703
- yr,
5704
- qe,
5705
- Qe,
5713
+ br,
5714
+ Je,
5715
+ $e,
5706
5716
  q.reset,
5707
- en,
5708
- Dn,
5709
- hr,
5710
- Jt
5717
+ tn,
5718
+ On,
5719
+ gr,
5720
+ Yt
5711
5721
  ]);
5712
- let Er = x(() => {
5713
- let e = sn.current;
5722
+ let Dr = x(() => {
5723
+ let e = cn.current;
5714
5724
  if (!e || Z) return !1;
5715
- let t = U.current, n = new Set(t?.getVertexSelection() ?? []);
5725
+ let t = H.current, n = new Set(t?.getVertexSelection() ?? []);
5716
5726
  if (!n.size) return !1;
5717
- let r = Ut.current.getShapes().find((t) => t.id === e);
5727
+ let r = Wt.current.getShapes().find((t) => t.id === e);
5718
5728
  if (!r) return !1;
5719
5729
  let i = r.points.filter((e, t) => !n.has(t)), a = r.type === F.LINE ? 2 : 3;
5720
- return i.length < a ? !1 : (Ut.current.update([{
5730
+ return i.length < a ? !1 : (Wt.current.update([{
5721
5731
  ...r,
5722
5732
  points: i
5723
5733
  }]), t?.setVertexSelection([]), !0);
5724
5734
  }, [Z]);
5725
- Pn({
5726
- keymap: fe,
5727
- hostRef: we,
5735
+ Fn({
5736
+ keymap: pe,
5737
+ hostRef: Ee,
5728
5738
  actions: {
5729
5739
  undo: () => {
5730
- Z || On() || q.undo();
5740
+ Z || kn() || q.undo();
5731
5741
  },
5732
5742
  redo: () => {
5733
- Z || kn() || q.redo();
5743
+ Z || An() || q.redo();
5734
5744
  },
5735
- selectAll: Jn,
5736
- copy: Zn,
5745
+ selectAll: Yn,
5746
+ copy: Qn,
5737
5747
  cut: () => {
5738
- Zn(), Xn();
5748
+ Qn(), Zn();
5739
5749
  },
5740
- paste: $n,
5741
- duplicate: er,
5750
+ paste: er,
5751
+ duplicate: tr,
5742
5752
  delete: () => {
5743
- Nn() && Hn() || Er() || Xn();
5753
+ Pn() && Un() || Dr() || Zn();
5744
5754
  },
5745
5755
  cancel: () => {
5746
- let e = dt.current.get(Mt.current);
5756
+ let e = ft.current.get(Nt.current);
5747
5757
  if (!(e?.onCancel && e.onCancel() !== !1)) {
5748
5758
  if (Q.isActive()) {
5749
5759
  Q.cancel();
5750
5760
  return;
5751
5761
  }
5752
- if (Mn()) {
5753
- Dn();
5762
+ if (Nn()) {
5763
+ On();
5754
5764
  return;
5755
5765
  }
5756
- if (nn) {
5757
- rn(null);
5766
+ if (rn) {
5767
+ an(null);
5758
5768
  return;
5759
5769
  }
5760
- if (jt.current.length) {
5761
- Yn();
5770
+ if (Mt.current.length) {
5771
+ Xn();
5762
5772
  return;
5763
5773
  }
5764
5774
  p?.();
@@ -5769,150 +5779,150 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5769
5779
  Q.finalize();
5770
5780
  return;
5771
5781
  }
5772
- if (Mn()) {
5773
- Fn();
5782
+ if (Nn()) {
5783
+ In();
5774
5784
  return;
5775
5785
  }
5776
5786
  if (Z) return;
5777
- if (nn) {
5778
- rn(null);
5787
+ if (rn) {
5788
+ an(null);
5779
5789
  return;
5780
5790
  }
5781
- let e = jt.current;
5791
+ let e = Mt.current;
5782
5792
  if (e.length !== 1) return;
5783
- let t = Ut.current.getShapes().find((t) => t.id === e[0]);
5784
- t && (t.type === F.POLYGON || t.type === F.LINE) && t.interaction?.editable !== !1 && !t.readOnly && rn(e[0]);
5793
+ let t = Wt.current.getShapes().find((t) => t.id === e[0]);
5794
+ t && (t.type === F.POLYGON || t.type === F.LINE) && t.interaction?.editable !== !1 && !t.readOnly && an(e[0]);
5785
5795
  },
5786
- bringToFront: tr,
5787
- sendToBack: nr,
5796
+ bringToFront: nr,
5797
+ sendToBack: rr,
5788
5798
  zoomIn: () => $(1.2),
5789
5799
  zoomOut: () => $(1 / 1.2),
5790
- zoom100: () => U.current?.zoom100(),
5791
- zoomFit: () => U.current?.fit(),
5792
- toggleMinimap: () => We((e) => !e),
5793
- toggleCursorGuide: () => gt((e) => ({
5800
+ zoom100: () => H.current?.zoom100(),
5801
+ zoomFit: () => H.current?.fit(),
5802
+ toggleMinimap: () => Ge((e) => !e),
5803
+ toggleCursorGuide: () => _t((e) => ({
5794
5804
  ...e,
5795
5805
  showCursorGuide: !e.showCursorGuide
5796
5806
  })),
5797
- togglePixelation: () => gt((e) => ({
5807
+ togglePixelation: () => _t((e) => ({
5798
5808
  ...e,
5799
5809
  imageSmoothing: !e.imageSmoothing
5800
5810
  })),
5801
- selectTool: () => H?.(W.SELECT),
5802
- rectangleTool: () => H?.(W.RECTANGLE),
5803
- rotatedRectangleTool: () => H?.(W.ROTATED_RECTANGLE),
5804
- circleTool: () => H?.(W.CIRCLE),
5805
- polygonTool: () => H?.(W.POLYGON),
5806
- pathTool: () => H?.(W.PATH),
5807
- brushTool: () => H?.(W.BRUSH),
5808
- pointTool: () => H?.(W.POINT)
5811
+ selectTool: () => ge?.(W.SELECT),
5812
+ rectangleTool: () => ge?.(W.RECTANGLE),
5813
+ rotatedRectangleTool: () => ge?.(W.ROTATED_RECTANGLE),
5814
+ circleTool: () => ge?.(W.CIRCLE),
5815
+ polygonTool: () => ge?.(W.POLYGON),
5816
+ pathTool: () => ge?.(W.PATH),
5817
+ brushTool: () => ge?.(W.BRUSH),
5818
+ pointTool: () => ge?.(W.POINT)
5809
5819
  },
5810
- spaceRef: Wt,
5811
- shiftRef: Gt,
5820
+ spaceRef: Gt,
5821
+ shiftRef: Kt,
5812
5822
  onSpaceDown: () => {
5813
- U.current?.setPanMode(!0), Jt();
5823
+ H.current?.setPanMode(!0), Yt();
5814
5824
  },
5815
5825
  onSpaceUp: () => {
5816
- U.current?.setPanMode(!1), Kt.current === "panning" ? Zt("idle") : Jt();
5826
+ H.current?.setPanMode(!1), qt.current === "panning" ? Qt("idle") : Yt();
5817
5827
  },
5818
- nudge: rr
5828
+ nudge: ir
5819
5829
  });
5820
- let Dr = E(() => pr.filter((e) => J.includes(e.id) && ie(e)), [pr, J]), Or = E(() => gn ? [...Dr, gn] : Dr, [Dr, gn]), kr = J.length > 0, Ar = q.shapes.some((e) => J.includes(e.id) && oe(e)), jr = !Z && J.length === 1 && (() => {
5830
+ let Or = E(() => mr.filter((e) => J.includes(e.id) && ie(e)), [mr, J]), kr = E(() => _n ? [...Or, _n] : Or, [Or, _n]), Ar = J.length > 0, jr = q.shapes.some((e) => J.includes(e.id) && oe(e)), Mr = !Z && J.length === 1 && (() => {
5821
5831
  let e = q.shapes.find((e) => e.id === J[0]);
5822
5832
  return !!e && (e.type === F.POLYGON || e.type === F.LINE) && e.interaction?.editable !== !1 && !e.readOnly;
5823
- })(), Mr = ir(), Nr = Z || Mr.length < 2 || (M ? !M(Mr) : !1), Pr = !!de && !Z, Fr = Pr && J.length === 1 ? (() => {
5833
+ })(), Nr = ar(), Pr = Z || Nr.length < 2 || (M ? !M(Nr) : !1), Fr = !!fe && !Z, Ir = Fr && J.length === 1 ? (() => {
5824
5834
  let e = q.shapes.find((e) => e.id === J[0]);
5825
5835
  return e && e.type === F.POLYGON && e.interaction?.editable !== !1 && !e.readOnly ? e : null;
5826
- })() : null, Ir = [
5836
+ })() : null, Lr = [
5827
5837
  {
5828
5838
  id: "copy",
5829
5839
  label: X.contextMenu.copy,
5830
5840
  shortcut: "⌘C",
5831
- disabled: !Ar,
5832
- onClick: Zn
5841
+ disabled: !jr,
5842
+ onClick: Qn
5833
5843
  },
5834
5844
  {
5835
5845
  id: "paste",
5836
5846
  label: X.contextMenu.paste,
5837
5847
  shortcut: "⌘V",
5838
- disabled: Z || !Qn(),
5839
- onClick: () => $n(ze?.img)
5848
+ disabled: Z || !$n(),
5849
+ onClick: () => er(Be?.img)
5840
5850
  },
5841
5851
  {
5842
5852
  id: "duplicate",
5843
5853
  label: X.contextMenu.duplicate,
5844
5854
  shortcut: "⌘D",
5845
- disabled: !Ar || Z,
5846
- onClick: er
5855
+ disabled: !jr || Z,
5856
+ onClick: tr
5847
5857
  },
5848
5858
  {
5849
5859
  id: "delete",
5850
5860
  label: X.contextMenu.delete,
5851
5861
  shortcut: "Del",
5852
5862
  danger: !0,
5853
- disabled: !Ar || Z,
5854
- onClick: Xn
5863
+ disabled: !jr || Z,
5864
+ onClick: Zn
5855
5865
  },
5856
5866
  { separator: !0 },
5857
5867
  {
5858
5868
  id: "editVertices",
5859
5869
  label: X.contextMenu.editVertices,
5860
5870
  shortcut: "Enter",
5861
- disabled: !jr,
5862
- onClick: () => rn(J[0])
5871
+ disabled: !Mr,
5872
+ onClick: () => an(J[0])
5863
5873
  },
5864
5874
  {
5865
5875
  id: "merge",
5866
5876
  label: X.contextMenu.merge,
5867
- disabled: Nr,
5868
- onClick: ar
5877
+ disabled: Pr,
5878
+ onClick: or
5869
5879
  },
5870
- ...Pr ? [{
5880
+ ...Fr ? [{
5871
5881
  id: "assistExpand",
5872
5882
  label: X.contextMenu.assistExpand,
5873
5883
  icon: /* @__PURE__ */ v(o, { size: 14 }),
5874
- disabled: !Fr,
5884
+ disabled: !Ir,
5875
5885
  onClick: () => {
5876
- ze && Fr && Q.refineShape(Fr, ze.img, !0);
5886
+ Be && Ir && Q.refineShape(Ir, Be.img, !0);
5877
5887
  }
5878
5888
  }, {
5879
5889
  id: "assistExclude",
5880
5890
  label: X.contextMenu.assistExclude,
5881
5891
  icon: /* @__PURE__ */ v(o, { size: 14 }),
5882
- disabled: !Fr,
5892
+ disabled: !Ir,
5883
5893
  onClick: () => {
5884
- ze && Fr && Q.refineShape(Fr, ze.img, !1);
5894
+ Be && Ir && Q.refineShape(Ir, Be.img, !1);
5885
5895
  }
5886
5896
  }] : [],
5887
5897
  {
5888
5898
  id: "bringToFront",
5889
5899
  label: X.contextMenu.bringToFront,
5890
- disabled: !Ar || Z,
5891
- onClick: tr
5900
+ disabled: !jr || Z,
5901
+ onClick: nr
5892
5902
  },
5893
5903
  {
5894
5904
  id: "sendToBack",
5895
5905
  label: X.contextMenu.sendToBack,
5896
- disabled: !Ar || Z,
5897
- onClick: nr
5906
+ disabled: !jr || Z,
5907
+ onClick: rr
5898
5908
  },
5899
5909
  { separator: !0 },
5900
5910
  {
5901
5911
  id: "undo",
5902
5912
  label: X.contextMenu.undo,
5903
5913
  shortcut: "⌘Z",
5904
- disabled: Z || !An() && !q.canUndo(),
5914
+ disabled: Z || !jn() && !q.canUndo(),
5905
5915
  onClick: () => {
5906
- On() || q.undo();
5916
+ kn() || q.undo();
5907
5917
  }
5908
5918
  },
5909
5919
  {
5910
5920
  id: "redo",
5911
5921
  label: X.contextMenu.redo,
5912
5922
  shortcut: "⇧⌘Z",
5913
- disabled: Z || !jn() && !q.canRedo(),
5923
+ disabled: Z || !Mn() && !q.canRedo(),
5914
5924
  onClick: () => {
5915
- kn() || q.redo();
5925
+ An() || q.redo();
5916
5926
  }
5917
5927
  },
5918
5928
  { separator: !0 },
@@ -5920,50 +5930,50 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5920
5930
  id: "selectAll",
5921
5931
  label: X.contextMenu.selectAll,
5922
5932
  shortcut: "⌘A",
5923
- onClick: Jn
5933
+ onClick: Yn
5924
5934
  },
5925
5935
  {
5926
5936
  id: "clearSelection",
5927
5937
  label: X.contextMenu.clearSelection,
5928
- disabled: !kr,
5929
- onClick: Yn
5938
+ disabled: !Ar,
5939
+ onClick: Xn
5930
5940
  },
5931
5941
  {
5932
5942
  id: "zoomToSelection",
5933
5943
  label: X.contextMenu.zoomToSelection,
5934
- disabled: !kr,
5935
- onClick: cr
5944
+ disabled: !Ar,
5945
+ onClick: lr
5936
5946
  }
5937
- ], Lr = l ? Ir.filter((e) => "separator" in e || !!e.id && Cr.has(e.id)) : Ir, Rr = A ? A(Lr, {
5947
+ ], Rr = l ? Lr.filter((e) => "separator" in e || !!e.id && wr.has(e.id)) : Lr, zr = j ? j(Rr, {
5938
5948
  selectedIds: J,
5939
5949
  readOnly: Z
5940
- }) : Lr, zr = gr({
5941
- engineRef: U,
5950
+ }) : Rr, Br = _r({
5951
+ engineRef: H,
5942
5952
  image: G,
5943
5953
  wheelZoom: Y.wheelZoom,
5944
5954
  minimapSize: 204
5945
- }), Br = x(() => {
5946
- U.current?.zoom100();
5947
- }, []), Vr = x(() => {
5948
- We((e) => !e);
5955
+ }), Vr = x(() => {
5956
+ H.current?.zoom100();
5949
5957
  }, []), Hr = x(() => {
5950
- Ke((e) => !e);
5958
+ Ge((e) => !e);
5951
5959
  }, []), Ur = x(() => {
5952
- Ke(!1);
5960
+ qe((e) => !e);
5961
+ }, []), Wr = x(() => {
5962
+ qe(!1);
5953
5963
  }, []);
5954
5964
  return /* @__PURE__ */ y("div", {
5955
5965
  className: "aivex:relative aivex:h-full aivex:w-full aivex:overflow-hidden aivex:bg-black",
5956
5966
  children: [
5957
5967
  /* @__PURE__ */ v("div", {
5958
- ref: we,
5968
+ ref: Ee,
5959
5969
  className: "aivex:h-full aivex:w-full",
5960
5970
  style: {
5961
- opacity: +!!Me,
5962
- transition: Me ? "opacity 0.3s ease" : "none"
5971
+ opacity: +!!Ne,
5972
+ transition: Ne ? "opacity 0.3s ease" : "none"
5963
5973
  }
5964
5974
  }),
5965
- tt !== "ready" && /* @__PURE__ */ v(Le, {
5966
- status: tt,
5975
+ nt !== "ready" && /* @__PURE__ */ v(Re, {
5976
+ status: nt,
5967
5977
  render: n,
5968
5978
  loadingLabel: X.imageLoading,
5969
5979
  errorLabel: X.imageLoadError
@@ -5971,7 +5981,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5971
5981
  K && G && /* @__PURE__ */ v("div", {
5972
5982
  className: "aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:overflow-hidden",
5973
5983
  children: /* @__PURE__ */ y("div", {
5974
- ref: Ee,
5984
+ ref: Oe,
5975
5985
  style: {
5976
5986
  position: "absolute",
5977
5987
  top: 0,
@@ -5981,7 +5991,7 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5981
5991
  transformOrigin: "0 0"
5982
5992
  },
5983
5993
  children: [
5984
- !!L?.length && R && /* @__PURE__ */ v("div", {
5994
+ !!R?.length && z && /* @__PURE__ */ v("div", {
5985
5995
  style: {
5986
5996
  position: "absolute",
5987
5997
  left: 0,
@@ -5990,16 +6000,16 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
5990
6000
  height: G.h,
5991
6001
  pointerEvents: "none"
5992
6002
  },
5993
- children: L.map((e) => /* @__PURE__ */ v("div", {
6003
+ children: R.map((e) => /* @__PURE__ */ v("div", {
5994
6004
  role: e.disabled ? void 0 : "button",
5995
6005
  tabIndex: e.disabled ? void 0 : 0,
5996
6006
  "aria-pressed": e.selected || void 0,
5997
6007
  onPointerDown: (e) => e.stopPropagation(),
5998
6008
  onClick: (t) => {
5999
- t.stopPropagation(), e.disabled || z?.(e);
6009
+ t.stopPropagation(), e.disabled || B?.(e);
6000
6010
  },
6001
6011
  onKeyDown: (t) => {
6002
- e.disabled || t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), z?.(e));
6012
+ e.disabled || t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), B?.(e));
6003
6013
  },
6004
6014
  style: {
6005
6015
  position: "absolute",
@@ -6011,25 +6021,25 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
6011
6021
  pointerEvents: e.disabled ? "none" : "auto",
6012
6022
  cursor: e.disabled ? "default" : "pointer"
6013
6023
  },
6014
- children: R(e)
6024
+ children: z(e)
6015
6025
  }, e.id))
6016
6026
  }),
6017
- B?.({
6027
+ ce?.({
6018
6028
  image: G,
6019
- viewport: U.current?.viewport ?? {
6029
+ viewport: H.current?.viewport ?? {
6020
6030
  scale: 1,
6021
6031
  x: 0,
6022
6032
  y: 0
6023
6033
  }
6024
6034
  }),
6025
- Or.length > 0 && /* @__PURE__ */ v(ot, {
6026
- shapes: Or,
6027
- getLabel: ce,
6028
- hideDot: V,
6029
- formatInfo: le,
6030
- register: mn
6035
+ kr.length > 0 && /* @__PURE__ */ v(st, {
6036
+ shapes: kr,
6037
+ getLabel: V,
6038
+ hideDot: le,
6039
+ formatInfo: ue,
6040
+ register: hn
6031
6041
  }),
6032
- de && (Q.status === "loading" || Q.boxes.length > 0) && /* @__PURE__ */ v(Pe, {
6042
+ fe && (Q.status === "loading" || Q.boxes.length > 0) && /* @__PURE__ */ v(Pe, {
6033
6043
  image: G,
6034
6044
  points: Q.points,
6035
6045
  boxes: Q.boxes,
@@ -6038,46 +6048,47 @@ function Tr({ document: e, clipboardScope: t, renderImageState: n, dimmed: r = !
6038
6048
  ]
6039
6049
  })
6040
6050
  }),
6041
- K && Y.showCursorGuide && /* @__PURE__ */ v(Ie, { color: "#1e88e5" }),
6042
- G && b && /* @__PURE__ */ v(Xe, {
6051
+ K && Y.showCursorGuide && /* @__PURE__ */ v(Le, { color: "#1e88e5" }),
6052
+ G && b && /* @__PURE__ */ v(Ze, {
6043
6053
  image: G,
6044
- imageUrl: et,
6045
- imageVisible: Me,
6054
+ imageUrl: tt,
6055
+ imageVisible: Ne,
6046
6056
  loading: !K,
6047
- maskDataUrl: xt,
6048
- region: St,
6049
- roiMaskId: Oe,
6050
- shapes: pr,
6057
+ maskDataUrl: St,
6058
+ region: Ct,
6059
+ roiMaskId: je,
6060
+ shapes: mr,
6051
6061
  view: Y,
6052
- viewDefaults: pt,
6053
- onChangeView: _t,
6054
- nav: zr,
6055
- registerShape: ln,
6056
- rectRef: Te,
6057
- zoomLabelRef: De,
6058
- onZoom100: Br,
6059
- open: Ue,
6060
- onToggleOpen: Vr,
6062
+ viewDefaults: mt,
6063
+ onChangeView: vt,
6064
+ nav: Br,
6065
+ registerShape: un,
6066
+ rectRef: De,
6067
+ zoomLabelRef: U,
6068
+ onZoom100: Vr,
6069
+ open: We,
6070
+ onToggleOpen: Hr,
6071
+ position: D,
6061
6072
  labels: X.minimap,
6062
6073
  settingsLabels: X.viewSettings,
6063
- showSettings: D,
6064
- settingsOpen: Ge,
6065
- onToggleSettings: Hr,
6066
- onCloseSettings: Ur
6074
+ showSettings: A,
6075
+ settingsOpen: Ke,
6076
+ onToggleSettings: Ur,
6077
+ onCloseSettings: Wr
6067
6078
  }),
6068
- ze && /* @__PURE__ */ v(Fe, {
6069
- x: ze.x,
6070
- y: ze.y,
6071
- items: Rr,
6072
- onClose: () => Be(null)
6079
+ Be && /* @__PURE__ */ v(Ie, {
6080
+ x: Be.x,
6081
+ y: Be.y,
6082
+ items: zr,
6083
+ onClose: () => Ve(null)
6073
6084
  })
6074
6085
  ]
6075
6086
  });
6076
6087
  }
6077
6088
  //#endregion
6078
6089
  //#region src/components/ShapeEditor/ShapeViewer.tsx
6079
- async function Er(e) {
6080
- let t = await Fn(e);
6090
+ async function Dr(e) {
6091
+ let t = await In(e);
6081
6092
  return await new Promise((n, r) => {
6082
6093
  let i = new Image();
6083
6094
  t || (i.crossOrigin = "anonymous"), i.onload = () => n({
@@ -6088,14 +6099,14 @@ async function Er(e) {
6088
6099
  }, i.src = t ?? e;
6089
6100
  });
6090
6101
  }
6091
- function Dr(e, t, n) {
6102
+ function Or(e, t, n) {
6092
6103
  if (t.length !== 0) {
6093
6104
  e.beginPath(), e.moveTo(t[0].x, t[0].y);
6094
6105
  for (let n = 1; n < t.length; n += 1) e.lineTo(t[n].x, t[n].y);
6095
6106
  n && e.closePath();
6096
6107
  }
6097
6108
  }
6098
- function Or(e, t, n, r) {
6109
+ function kr(e, t, n, r) {
6099
6110
  if (t.interaction?.visible === !1) return;
6100
6111
  let i = Ue(t, {
6101
6112
  strokeWidth: r,
@@ -6112,11 +6123,11 @@ function Or(e, t, n, r) {
6112
6123
  let i = Math.min(n.x, r.x), a = Math.min(n.y, r.y), o = Math.abs(r.x - n.x), s = Math.abs(r.y - n.y);
6113
6124
  e.beginPath(), t.type === F.ELLIPSE ? e.ellipse(i + o / 2, a + s / 2, o / 2, s / 2, 0, 0, Math.PI * 2) : e.rect(i, a, o, s);
6114
6125
  }
6115
- } else Dr(e, t.points, t.type !== F.LINE);
6126
+ } else Or(e, t.points, t.type !== F.LINE);
6116
6127
  i.fillVisible && (e.save(), e.fillStyle = i.color, e.globalAlpha *= i.fillAlpha, e.fill(), e.restore()), t.style?.alternateColor && i.dash?.length && (e.setLineDash([]), e.strokeStyle = t.style.alternateColor, e.stroke()), e.setLineDash((i.dash ?? []).map((e) => e / n)), e.strokeStyle = i.color, e.stroke(), e.restore();
6117
6128
  }
6118
- function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes: r = [], regionMask: i, guideMask: a, maskPalette: o, focusedShapeId: s, focusFit: c = "contain", zoomPadding: l = .3, strokeSize: u = 1, brightness: d = 1, contrast: f = 1, imageSmoothing: p = !0, lazy: m = !0, className: h, style: g, renderImageState: _ }) {
6119
- let b = O(null), x = O(null), C = O(null), [w, T] = k(!m), [D, A] = k("loading"), [j, M] = k(0);
6129
+ function Ar({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes: r = [], regionMask: i, guideMask: a, maskPalette: o, focusedShapeId: s, focusFit: c = "contain", zoomPadding: l = .3, strokeSize: u = 1, brightness: d = 1, contrast: f = 1, imageSmoothing: p = !0, lazy: m = !0, className: h, style: g, renderImageState: _ }) {
6130
+ let b = O(null), x = O(null), C = O(null), [w, T] = k(!m), [D, A] = k("loading"), [j, ee] = k(0);
6120
6131
  S(() => {
6121
6132
  if (!m || w) return;
6122
6133
  let e = b.current;
@@ -6128,7 +6139,7 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6128
6139
  }, [m, w]), S(() => {
6129
6140
  let e = b.current;
6130
6141
  if (!e) return;
6131
- let t = new ResizeObserver(() => M((e) => e + 1));
6142
+ let t = new ResizeObserver(() => ee((e) => e + 1));
6132
6143
  return t.observe(e), () => t.disconnect();
6133
6144
  }, []), S(() => {
6134
6145
  if (!w || !e) {
@@ -6136,7 +6147,7 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6136
6147
  return;
6137
6148
  }
6138
6149
  let t = !0;
6139
- return A("loading"), Er(e).then((e) => {
6150
+ return A("loading"), Dr(e).then((e) => {
6140
6151
  if (!t) {
6141
6152
  e.revoke?.();
6142
6153
  return;
@@ -6150,7 +6161,7 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6150
6161
  }, [e, w]), S(() => () => {
6151
6162
  C.current?.revoke?.(), C.current = null;
6152
6163
  }, []);
6153
- let N = E(() => r.find((e) => e.id === s), [s, r]), P = E(() => a && o ? Ot(a, o) : null, [a, o]);
6164
+ let M = E(() => r.find((e) => e.id === s), [s, r]), N = E(() => a && o ? kt(a, o) : null, [a, o]);
6154
6165
  return S(() => {
6155
6166
  if (D === "error") {
6156
6167
  let e = x.current;
@@ -6168,34 +6179,34 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6168
6179
  let g = n?.width ?? a.image.naturalWidth, _ = n?.height ?? a.image.naturalHeight;
6169
6180
  if (!g || !_) return;
6170
6181
  let v = Math.min(o / g, s / _), y = (o - g * v) / 2, S = (s - _ * v) / 2;
6171
- if (N && N.points.length > 0) {
6172
- let e = B(N.points), t = Math.max(e.maxX - e.minX, 50), n = Math.max(e.maxY - e.minY, 50), r = Math.min(t, n) * l;
6182
+ if (M && M.points.length > 0) {
6183
+ let e = B(M.points), t = Math.max(e.maxX - e.minX, 50), n = Math.max(e.maxY - e.minY, 50), r = Math.min(t, n) * l;
6173
6184
  v = Math.min(o / (t + r * 2), s / (n + r * 2)), c === "cover" && (v = Math.max(v, Math.max(o / g, s / _))), y = o / 2 - (e.minX + e.maxX) / 2 * v, S = s / 2 - (e.minY + e.maxY) / 2 * v, c === "cover" && (y = Math.min(0, Math.max(y, o - g * v)), S = Math.min(0, Math.max(S, s - _ * v)));
6174
6185
  }
6175
- h.setTransform(m, 0, 0, m, 0, 0), h.clearRect(0, 0, o, s), h.save(), h.translate(y, S), h.scale(v, v), h.imageSmoothingEnabled = p, h.filter = `brightness(${d}) contrast(${f})`, h.drawImage(a.image, 0, 0, g, _), h.filter = "none", P && (h.save(), h.globalAlpha = .55, h.drawImage(P, 0, 0, g, _), h.restore());
6176
- let w = i ? zt(i, g, _) : null;
6177
- if (w && (Ft(h, w, g, _), w.outlineStyles)) {
6186
+ h.setTransform(m, 0, 0, m, 0, 0), h.clearRect(0, 0, o, s), h.save(), h.translate(y, S), h.scale(v, v), h.imageSmoothingEnabled = p, h.filter = `brightness(${d}) contrast(${f})`, h.drawImage(a.image, 0, 0, g, _), h.filter = "none", N && (h.save(), h.globalAlpha = .55, h.drawImage(N, 0, 0, g, _), h.restore());
6187
+ let w = i ? Bt(i, g, _) : null;
6188
+ if (w && (It(h, w, g, _), w.outlineStyles)) {
6178
6189
  let e = (e, t) => {
6179
6190
  if (h.lineWidth = t.width / v, t.underlayColor) {
6180
6191
  h.setLineDash([]), h.strokeStyle = t.underlayColor;
6181
- for (let [t, n] of e) Dr(h, [t, n], !1), h.stroke();
6192
+ for (let [t, n] of e) Or(h, [t, n], !1), h.stroke();
6182
6193
  }
6183
6194
  h.save(), h.globalAlpha *= t.opacity, h.setLineDash(t.dash.map((e) => e / v)), h.strokeStyle = t.color;
6184
- for (let [t, n] of e) Dr(h, [t, n], !1), h.stroke();
6195
+ for (let [t, n] of e) Or(h, [t, n], !1), h.stroke();
6185
6196
  h.restore();
6186
6197
  };
6187
6198
  e(w.visibleOutline, w.outlineStyles.visible), e(w.occludedOutline, w.outlineStyles.occluded);
6188
6199
  }
6189
- for (let e of R(r)) Or(h, e, v, u);
6200
+ for (let e of R(r)) kr(h, e, v, u);
6190
6201
  h.restore();
6191
6202
  }, [
6192
6203
  d,
6193
6204
  f,
6194
6205
  n,
6195
- N,
6206
+ M,
6196
6207
  c,
6197
6208
  p,
6198
- P,
6209
+ N,
6199
6210
  i,
6200
6211
  r,
6201
6212
  j,
@@ -6226,6 +6237,6 @@ function kr({ imageUrl: e, alt: t = "Shape preview", coordinateSize: n, shapes:
6226
6237
  });
6227
6238
  }
6228
6239
  //#endregion
6229
- export { Oe as DEFAULT_EDITOR_STRINGS, Ae as DEFAULT_VIEW_SETTINGS, F as SHAPE_TYPE, Tr as ShapeEditor, Tr as default, kr as ShapeViewer, W as TOOL, se as generateId };
6240
+ export { U as DEFAULT_EDITOR_STRINGS, Ae as DEFAULT_VIEW_SETTINGS, F as SHAPE_TYPE, Er as ShapeEditor, Er as default, Ar as ShapeViewer, W as TOOL, se as generateId };
6230
6241
 
6231
6242
  //# sourceMappingURL=shape-editor.js.map