@servantcdh/ez-planet-labeling 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +28 -7
- package/dist/index.js +952 -939
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as
|
|
3
|
-
const za = ["Record", "Image", "Text", "Number", "File"], Fa = "Brush", Fe = "Bounded Box",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
],
|
|
1
|
+
import et, { createContext as xn, useState as re, useEffect as ce, useMemo as ve, useContext as Ln, useCallback as $, useRef as Ce, createElement as Ke } from "react";
|
|
2
|
+
import { jsx as u, jsxs as S, Fragment as It } from "react/jsx-runtime";
|
|
3
|
+
const za = ["Record", "Image", "Text", "Number", "File"], Fa = "Brush", Fe = "Bounded Box", Nt = "Filled Box", wn = "Filled Polygon", vt = "Magic Brush", _e = "Superpixel", at = "BrushCursor", Ct = "SuperpixelBoundary", Xa = "Combined Label", pt = "Segment Anything Box", $a = "Eraser", Sn = 1, Mn = 0, In = [
|
|
4
|
+
at,
|
|
5
|
+
Ct,
|
|
6
|
+
pt
|
|
7
|
+
], kt = [
|
|
8
8
|
"id",
|
|
9
9
|
"unique",
|
|
10
10
|
"hex",
|
|
@@ -32,11 +32,11 @@ const On = async () => (ze || (ze = await import("fabric")), ze), oe = () => {
|
|
|
32
32
|
"Fabric has not been loaded. Call loadFabric() first (async)."
|
|
33
33
|
);
|
|
34
34
|
return ze;
|
|
35
|
-
},
|
|
36
|
-
let Xe = null,
|
|
37
|
-
const Q = () => Xe,
|
|
35
|
+
}, Oe = () => oe().Point, Pn = () => oe().Line, qt = () => oe().Rect, Kt = () => oe().Polygon, Tn = () => oe().PencilBrush, Bn = () => oe().Circle, Jt = () => oe().FabricImage, En = () => oe().Control, Rn = () => oe().StaticCanvas;
|
|
36
|
+
let Xe = null, An = { x: 0, y: 0 }, Dn = { x: 0, y: 0 };
|
|
37
|
+
const Q = () => Xe, At = (e) => {
|
|
38
38
|
Xe = e;
|
|
39
|
-
}, Hn = () =>
|
|
39
|
+
}, Hn = () => An, _n = () => Dn, pe = () => {
|
|
40
40
|
if (!Xe)
|
|
41
41
|
throw new Error("Canvas has not been initialized.");
|
|
42
42
|
return Xe;
|
|
@@ -68,8 +68,8 @@ const Q = () => Xe, Rt = (e) => {
|
|
|
68
68
|
return () => {
|
|
69
69
|
};
|
|
70
70
|
const n = Vn.map((s) => {
|
|
71
|
-
const o = `label:${s}`, a = (
|
|
72
|
-
e(s,
|
|
71
|
+
const o = `label:${s}`, a = (r) => {
|
|
72
|
+
e(s, r.data);
|
|
73
73
|
};
|
|
74
74
|
return t.on(o, a), { eventName: o, handler: a };
|
|
75
75
|
});
|
|
@@ -81,27 +81,27 @@ const Q = () => Xe, Rt = (e) => {
|
|
|
81
81
|
}, Un = (e, t) => {
|
|
82
82
|
const n = Q();
|
|
83
83
|
n && n.fire(`label:${e}`, { data: t });
|
|
84
|
-
},
|
|
84
|
+
}, jt = (e) => e, Se = (e = pe()) => jt(e.getObjects()), Ga = (e = pe()) => e.getActiveObjects(), Wn = (e) => ({
|
|
85
85
|
...e,
|
|
86
|
-
objects:
|
|
87
|
-
}), Ue = (e = pe()) => Wn(e.toJSON(
|
|
86
|
+
objects: jt(e.objects)
|
|
87
|
+
}), Ue = (e = pe()) => Wn(e.toJSON(kt)), De = (e) => (t) => e(t), I = (e) => e, Dt = (e, t) => t === 0 ? 0 : e / t, ot = ({ x: e, y: t }) => {
|
|
88
88
|
const s = pe().getZoom();
|
|
89
89
|
return { x: Dt(e, s), y: Dt(t, s) };
|
|
90
|
-
},
|
|
90
|
+
}, Qt = (e) => ot({
|
|
91
91
|
x: e.offsetX,
|
|
92
92
|
y: e.offsetY
|
|
93
|
-
}),
|
|
93
|
+
}), ke = (e) => {
|
|
94
94
|
const t = e ?? Xe;
|
|
95
95
|
t && t.contextContainer && t.renderAll();
|
|
96
|
-
},
|
|
97
|
-
const n = pe(), s = Bn(), o =
|
|
96
|
+
}, Ot = (e, t) => {
|
|
97
|
+
const n = pe(), s = Bn(), o = qt(), a = Hn();
|
|
98
98
|
n.remove(
|
|
99
|
-
...
|
|
100
|
-
({ info:
|
|
99
|
+
...Se(n).filter(
|
|
100
|
+
({ info: c }) => c === at
|
|
101
101
|
)
|
|
102
102
|
);
|
|
103
|
-
const
|
|
104
|
-
info:
|
|
103
|
+
const r = {
|
|
104
|
+
info: at,
|
|
105
105
|
left: -100,
|
|
106
106
|
top: -100,
|
|
107
107
|
width: e.lineWidth,
|
|
@@ -116,38 +116,38 @@ const Q = () => Xe, Rt = (e) => {
|
|
|
116
116
|
originX: "center",
|
|
117
117
|
originY: "center",
|
|
118
118
|
selectable: !1
|
|
119
|
-
}, i = e.lineCap === "round" ? new s(
|
|
120
|
-
if (!
|
|
119
|
+
}, i = e.lineCap === "round" ? new s(r) : new o(r), l = (c) => {
|
|
120
|
+
if (!c && !a.x)
|
|
121
121
|
return;
|
|
122
|
-
const m =
|
|
123
|
-
a.x = v, a.y =
|
|
124
|
-
},
|
|
125
|
-
l(
|
|
126
|
-
},
|
|
122
|
+
const m = c == null ? void 0 : c.e, { x: v, y: f } = m ? n.getScenePoint(m) : a;
|
|
123
|
+
a.x = v, a.y = f, i.set({ top: f, left: v }), i.setCoords(), n.renderAll();
|
|
124
|
+
}, g = (c) => {
|
|
125
|
+
l(c);
|
|
126
|
+
}, d = () => {
|
|
127
127
|
Un("init");
|
|
128
128
|
};
|
|
129
|
-
return l(), { brushCursor: i, handleOnMouseMove:
|
|
130
|
-
},
|
|
131
|
-
const o = pe(), a =
|
|
132
|
-
s && (n = s, o.getObjects().forEach((
|
|
133
|
-
let
|
|
134
|
-
const l = function(
|
|
135
|
-
const m =
|
|
129
|
+
return l(), { brushCursor: i, handleOnMouseMove: g, handleOnMouseUp: d };
|
|
130
|
+
}, Pt = ({ colorCode: e, callback: t }, n, s = !1) => {
|
|
131
|
+
const o = pe(), a = qt();
|
|
132
|
+
s && (n = s, o.getObjects().forEach((c) => c.set({ visible: !1 })), o.renderAll());
|
|
133
|
+
let r = 0, i = 0;
|
|
134
|
+
const l = function(c) {
|
|
135
|
+
const m = c.scenePoint ?? c.pointer;
|
|
136
136
|
if (!m)
|
|
137
137
|
return;
|
|
138
|
-
const { x: v, y:
|
|
139
|
-
|
|
140
|
-
},
|
|
141
|
-
const m =
|
|
138
|
+
const { x: v, y: f } = ot(m);
|
|
139
|
+
r = v, i = f;
|
|
140
|
+
}, g = function(c) {
|
|
141
|
+
const m = c.scenePoint ?? c.pointer;
|
|
142
142
|
if (!m)
|
|
143
143
|
return;
|
|
144
|
-
const { x: v, y:
|
|
145
|
-
let p = Math.abs(b), N = Math.abs(
|
|
146
|
-
const
|
|
147
|
-
p =
|
|
144
|
+
const { x: v, y: f } = ot(m), b = v - r, h = f - i;
|
|
145
|
+
let p = Math.abs(b), N = Math.abs(h), Z = b > 0 ? r : v, V = h > 0 ? i : f;
|
|
146
|
+
const A = Z < 0, k = V < 0;
|
|
147
|
+
p = A ? p + Z : p, N = k ? N + V : N, Z = A ? 0 : Z, V = k ? 0 : V;
|
|
148
148
|
const H = o.getZoom(), w = Number(o.width ?? 0) / H, C = Number(o.height ?? 0) / H, E = Z + p > w, _ = V + N > C;
|
|
149
149
|
p = E ? p - (Z + p - w) : p, N = _ ? N - (V + N - C) : N;
|
|
150
|
-
const
|
|
150
|
+
const D = p && N ? new a({
|
|
151
151
|
left: Z,
|
|
152
152
|
top: V,
|
|
153
153
|
width: p,
|
|
@@ -157,7 +157,7 @@ const Q = () => Xe, Rt = (e) => {
|
|
|
157
157
|
stroke: e,
|
|
158
158
|
strokeWidth: s ? kn : Nn,
|
|
159
159
|
erasable: !1,
|
|
160
|
-
info: s ?
|
|
160
|
+
info: s ? pt : Fe,
|
|
161
161
|
...s ? {
|
|
162
162
|
strokeDashArray: [7, 5],
|
|
163
163
|
lockMovementX: !0,
|
|
@@ -165,106 +165,106 @@ const Q = () => Xe, Rt = (e) => {
|
|
|
165
165
|
} : {}
|
|
166
166
|
} : {
|
|
167
167
|
fill: e,
|
|
168
|
-
info:
|
|
168
|
+
info: Nt
|
|
169
169
|
},
|
|
170
170
|
objectCaching: !1,
|
|
171
171
|
selectable: !1
|
|
172
172
|
}) : null;
|
|
173
|
-
if (s && !
|
|
174
|
-
point: { x: v, y:
|
|
175
|
-
}), s &&
|
|
173
|
+
if (s && !D && t && t({
|
|
174
|
+
point: { x: v, y: f, maskInput: Sn }
|
|
175
|
+
}), s && D && t) {
|
|
176
176
|
const O = Number(Z ?? 0), y = Number(V ?? 0), B = O + p, R = y + N;
|
|
177
177
|
t({ box: { x1: O, y1: y, x2: B, y2: R } });
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
const { x: m, y: v } =
|
|
183
|
-
|
|
179
|
+
D && o.add(D);
|
|
180
|
+
}, d = function(c) {
|
|
181
|
+
c.preventDefault();
|
|
182
|
+
const { x: m, y: v } = ot({ x: c.offsetX, y: c.offsetY });
|
|
183
|
+
c.target && c.target.localName === "canvas" && t && t({
|
|
184
184
|
point: { x: m, y: v, maskInput: Mn }
|
|
185
185
|
});
|
|
186
186
|
};
|
|
187
|
-
return o.defaultCursor = "crosshair", o.hoverCursor = s ? "crosshair" : "default", o.selection = !0, o.on("mouse:down", I(l)), o.on("mouse:up", I(
|
|
188
|
-
o.defaultCursor = "default", o.selection = !1, o.off("mouse:down", I(l)), o.off("mouse:up", I(
|
|
189
|
-
...
|
|
190
|
-
({ info:
|
|
187
|
+
return o.defaultCursor = "crosshair", o.hoverCursor = s ? "crosshair" : "default", o.selection = !0, o.on("mouse:down", I(l)), o.on("mouse:up", I(g)), s && document.addEventListener("contextmenu", d), () => {
|
|
188
|
+
o.defaultCursor = "default", o.selection = !1, o.off("mouse:down", I(l)), o.off("mouse:up", I(g)), s && (document.removeEventListener("contextmenu", d), o.remove(
|
|
189
|
+
...Se(o).filter(
|
|
190
|
+
({ info: c }) => c === pt
|
|
191
191
|
)
|
|
192
|
-
),
|
|
193
|
-
(
|
|
194
|
-
)),
|
|
192
|
+
), Se(o).forEach(
|
|
193
|
+
(c) => c.set({ visible: !0 })
|
|
194
|
+
)), ke(o);
|
|
195
195
|
};
|
|
196
|
-
},
|
|
196
|
+
}, en = () => ({ id: "brush", init: ({ brush: t, colorCode: n }) => {
|
|
197
197
|
const s = pe(), o = Tn();
|
|
198
198
|
s.isDrawingMode = !0, s.freeDrawingBrush = new o(s), s.freeDrawingBrush.color = n, s.freeDrawingBrush.strokeLineCap = t.lineCap, s.freeDrawingBrush.width = t.lineWidth;
|
|
199
|
-
const { brushCursor: a, handleOnMouseMove:
|
|
199
|
+
const { brushCursor: a, handleOnMouseMove: r, handleOnMouseUp: i } = Ot(t, n), l = function() {
|
|
200
200
|
s.add(a);
|
|
201
|
-
},
|
|
201
|
+
}, g = function() {
|
|
202
202
|
s.remove(a);
|
|
203
203
|
};
|
|
204
|
-
return s.add(a), s.on("mouse:over", I(l)), s.on("mouse:out", I(
|
|
205
|
-
s.remove(a), s.off("mouse:over", I(l)), s.off("mouse:out", I(
|
|
204
|
+
return s.add(a), s.on("mouse:over", I(l)), s.on("mouse:out", I(g)), s.on("mouse:move", I(r)), s.on("mouse:up", I(i)), () => {
|
|
205
|
+
s.remove(a), s.off("mouse:over", I(l)), s.off("mouse:out", I(g)), s.off("mouse:move", I(r)), s.off("mouse:up", I(i)), s.isDrawingMode = !1;
|
|
206
206
|
};
|
|
207
|
-
} }),
|
|
207
|
+
} }), tn = () => ({ id: "eraser", init: async ({ brush: t }) => {
|
|
208
208
|
const n = pe(), { EraserBrush: s } = await import("./index-DDn_Fjhx.js");
|
|
209
209
|
n.freeDrawingBrush = new s(n), n.isDrawingMode = !0, n.freeDrawingBrush.strokeLineCap = t.lineCap, n.freeDrawingBrush.width = t.lineWidth;
|
|
210
|
-
const { brushCursor: o, handleOnMouseMove: a, handleOnMouseUp:
|
|
210
|
+
const { brushCursor: o, handleOnMouseMove: a, handleOnMouseUp: r } = Ot(t), i = function() {
|
|
211
211
|
n.add(o);
|
|
212
212
|
}, l = function() {
|
|
213
213
|
n.remove(o);
|
|
214
214
|
};
|
|
215
|
-
return n.add(o), n.on("mouse:over", I(i)), n.on("mouse:out", I(l)), n.on("mouse:move", I(a)), n.on("mouse:up", I(
|
|
216
|
-
n.remove(o), n.off("mouse:over", I(i)), n.off("mouse:out", I(l)), n.off("mouse:move", I(a)), n.off("mouse:up", I(
|
|
215
|
+
return n.add(o), n.on("mouse:over", I(i)), n.on("mouse:out", I(l)), n.on("mouse:move", I(a)), n.on("mouse:up", I(r)), () => {
|
|
216
|
+
n.remove(o), n.off("mouse:over", I(i)), n.off("mouse:out", I(l)), n.off("mouse:move", I(a)), n.off("mouse:up", I(r)), n.isDrawingMode = !1;
|
|
217
217
|
};
|
|
218
|
-
} }),
|
|
218
|
+
} }), Ht = (e, t, n = 0) => {
|
|
219
219
|
const s = 10 ** n;
|
|
220
220
|
return Math.round(e * t * s) / s;
|
|
221
|
-
},
|
|
221
|
+
}, nn = (e, t) => {
|
|
222
222
|
e = e.includes("#") ? e.substring(1) : e;
|
|
223
223
|
const n = parseInt(e, 16), s = n >> 16 & 255, o = n >> 8 & 255, a = n & 255;
|
|
224
224
|
return `rgba(${s},${o},${a},${t})`;
|
|
225
|
-
},
|
|
225
|
+
}, Tt = (e) => {
|
|
226
226
|
const t = e.substring(5);
|
|
227
227
|
return t.substring(0, t.length - 1).split(",").map((s) => +s);
|
|
228
|
-
},
|
|
228
|
+
}, Ee = (e) => Math.round(e).toString(16).padStart(2, "0"), Yn = (e) => {
|
|
229
229
|
let t = e.startsWith("#") ? e.substring(1) : e;
|
|
230
230
|
(t.length === 3 || t.length === 4) && (t = t.split("").map((l) => l + l).join(""));
|
|
231
231
|
const n = t.length === 8;
|
|
232
232
|
if (t.length !== 6 && !n)
|
|
233
233
|
return null;
|
|
234
|
-
const s = parseInt(t.substring(0, 6), 16), o = s >> 16 & 255, a = s >> 8 & 255,
|
|
235
|
-
return { r: o, g: a, b:
|
|
236
|
-
},
|
|
234
|
+
const s = parseInt(t.substring(0, 6), 16), o = s >> 16 & 255, a = s >> 8 & 255, r = s & 255, i = n ? parseInt(t.substring(6), 16) / 255 : 1;
|
|
235
|
+
return { r: o, g: a, b: r, a: i };
|
|
236
|
+
}, it = (e) => {
|
|
237
237
|
const t = { hex: "000000", alpha: "100%" };
|
|
238
238
|
if (!e)
|
|
239
239
|
return t;
|
|
240
240
|
const n = e.trim();
|
|
241
241
|
if (n.startsWith("rgba(")) {
|
|
242
|
-
const [o, a,
|
|
242
|
+
const [o, a, r, i] = Tt(n);
|
|
243
243
|
return {
|
|
244
|
-
hex: `${
|
|
245
|
-
alpha: `${
|
|
244
|
+
hex: `${Ee(o)}${Ee(a)}${Ee(r)}`,
|
|
245
|
+
alpha: `${Ht(i, 100, 0)}%`
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
if (n.startsWith("rgb(")) {
|
|
249
|
-
const o = n.substring(4, n.length - 1).split(",").map((l) => +l), [a = 0,
|
|
249
|
+
const o = n.substring(4, n.length - 1).split(",").map((l) => +l), [a = 0, r = 0, i = 0] = o;
|
|
250
250
|
return {
|
|
251
|
-
hex: `${
|
|
251
|
+
hex: `${Ee(a)}${Ee(r)}${Ee(i)}`,
|
|
252
252
|
alpha: "100%"
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
const s = Yn(n);
|
|
256
256
|
if (s) {
|
|
257
|
-
const { r: o, g: a, b:
|
|
257
|
+
const { r: o, g: a, b: r, a: i } = s;
|
|
258
258
|
return {
|
|
259
|
-
hex: `${
|
|
260
|
-
alpha: `${
|
|
259
|
+
hex: `${Ee(o)}${Ee(a)}${Ee(r)}`,
|
|
260
|
+
alpha: `${Ht(i, 100, 0)}%`
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
263
|
return t;
|
|
264
264
|
}, qa = (e) => {
|
|
265
|
-
const [t, n, s, o] =
|
|
266
|
-
return `#${a}${
|
|
267
|
-
},
|
|
265
|
+
const [t, n, s, o] = Tt(e), a = Math.round(t).toString(16).padStart(2, "0"), r = Math.round(n).toString(16).padStart(2, "0"), i = Math.round(s).toString(16).padStart(2, "0"), l = Math.round(o * 255).toString(16).padStart(2, "0");
|
|
266
|
+
return `#${a}${r}${i}${l}`;
|
|
267
|
+
}, on = (e) => new Promise((t) => {
|
|
268
268
|
const n = new Image();
|
|
269
269
|
n.src = e, n.setAttribute("crossOrigin", ""), n.onload = () => t(n);
|
|
270
270
|
}), Ka = (e, t) => {
|
|
@@ -273,31 +273,31 @@ const Q = () => Xe, Rt = (e) => {
|
|
|
273
273
|
s === 0 && o === 0 && a === 0 ? e.data[n + 3] = 0 : t && (e.data[n + 3] = Math.round(255 * t * 100) / 100);
|
|
274
274
|
}
|
|
275
275
|
return e;
|
|
276
|
-
},
|
|
277
|
-
const t = (
|
|
278
|
-
const m =
|
|
279
|
-
let v =
|
|
280
|
-
for (let p = 0; p <
|
|
281
|
-
for (let N = 0; N <
|
|
282
|
-
const Z = (p *
|
|
283
|
-
m[Z + 3] > 0 && (v = Math.min(v, N),
|
|
276
|
+
}, sn = (e) => {
|
|
277
|
+
const t = (c) => {
|
|
278
|
+
const m = c.data;
|
|
279
|
+
let v = c.width, f = c.height, b = 0, h = 0;
|
|
280
|
+
for (let p = 0; p < c.height; p += 1)
|
|
281
|
+
for (let N = 0; N < c.width; N += 1) {
|
|
282
|
+
const Z = (p * c.width + N) * 4;
|
|
283
|
+
m[Z + 3] > 0 && (v = Math.min(v, N), f = Math.min(f, p), b = Math.max(b, N), h = Math.max(h, p));
|
|
284
284
|
}
|
|
285
|
-
return { minX: v, minY:
|
|
285
|
+
return { minX: v, minY: f, maxX: b, maxY: h };
|
|
286
286
|
}, n = document.createElement("canvas"), s = n.getContext("2d");
|
|
287
287
|
if (!s)
|
|
288
288
|
return { canvas: n, minX: 0, minY: 0 };
|
|
289
|
-
const { minX: o, minY: a, maxX:
|
|
290
|
-
for (let
|
|
289
|
+
const { minX: o, minY: a, maxX: r, maxY: i } = t(e), l = r - o + 1, g = i - a + 1, d = s.createImageData(l, g);
|
|
290
|
+
for (let c = 0; c < g; c += 1)
|
|
291
291
|
for (let m = 0; m < l; m += 1) {
|
|
292
|
-
const v = ((a +
|
|
293
|
-
|
|
292
|
+
const v = ((a + c) * e.width + o + m) * 4, f = (c * l + m) * 4;
|
|
293
|
+
d.data[f] = e.data[v], d.data[f + 1] = e.data[v + 1], d.data[f + 2] = e.data[v + 2], d.data[f + 3] = e.data[v + 3];
|
|
294
294
|
}
|
|
295
|
-
return n.width = l, n.height =
|
|
295
|
+
return n.width = l, n.height = g, s.putImageData(d, 0, 0), { canvas: n, minX: o, minY: a };
|
|
296
296
|
};
|
|
297
297
|
let Ve = null;
|
|
298
298
|
const Ja = (e) => {
|
|
299
299
|
Ve = e;
|
|
300
|
-
},
|
|
300
|
+
}, bt = () => ({ id: "magic-wand", init: async ({
|
|
301
301
|
src: t,
|
|
302
302
|
colorCode: n,
|
|
303
303
|
brush: s,
|
|
@@ -309,19 +309,19 @@ const Ja = (e) => {
|
|
|
309
309
|
);
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
const a = pe(),
|
|
312
|
+
const a = pe(), r = Jt(), i = Oe(), l = oe(), g = () => {
|
|
313
313
|
a.contextContainer && a.renderAll();
|
|
314
314
|
};
|
|
315
315
|
a.defaultCursor = "crosshair", a.hoverCursor = "crosshair";
|
|
316
|
-
const { threshold:
|
|
316
|
+
const { threshold: d, radius: c } = o;
|
|
317
317
|
let m = null, v = null;
|
|
318
|
-
const
|
|
318
|
+
const f = await on(t), { width: b, height: h } = f, p = document.createElement("canvas").getContext("2d");
|
|
319
319
|
if (!p)
|
|
320
320
|
return;
|
|
321
|
-
p.canvas.width = b, p.canvas.height =
|
|
321
|
+
p.canvas.width = b, p.canvas.height = h, p.drawImage(f, 0, 0), m = p.getImageData(0, 0, b, h);
|
|
322
322
|
const N = ({ x: y, y: B }) => ({
|
|
323
323
|
x: Math.min(Math.max(Math.round(y), 0), b - 1),
|
|
324
|
-
y: Math.min(Math.max(Math.round(B), 0),
|
|
324
|
+
y: Math.min(Math.max(Math.round(B), 0), h - 1)
|
|
325
325
|
}), Z = async (y) => {
|
|
326
326
|
const B = y.getElement(), R = document.createElement("canvas").getContext("2d");
|
|
327
327
|
if (!B || !R)
|
|
@@ -343,32 +343,32 @@ const Ja = (e) => {
|
|
|
343
343
|
({ points: F }) => F.length
|
|
344
344
|
);
|
|
345
345
|
if (!se.length) return null;
|
|
346
|
-
const de = y.scaleX ?? 1,
|
|
346
|
+
const de = y.scaleX ?? 1, Ie = y.scaleY ?? 1, Pe = y.left ?? 0, ue = y.top ?? 0;
|
|
347
347
|
let te = 1 / 0, W = 1 / 0;
|
|
348
348
|
const be = se.map((F) => {
|
|
349
349
|
const ne = F.points.map(({ x: ye, y: X }) => {
|
|
350
|
-
const K = ye * de,
|
|
351
|
-
return te = Math.min(te, K), W = Math.min(W,
|
|
350
|
+
const K = ye * de, Be = X * Ie;
|
|
351
|
+
return te = Math.min(te, K), W = Math.min(W, Be), new i(K, Be);
|
|
352
352
|
});
|
|
353
353
|
return { inner: F.inner, points: ne };
|
|
354
354
|
});
|
|
355
355
|
if (!Number.isFinite(te) || !Number.isFinite(W)) return null;
|
|
356
|
-
const me = { x: te, y: W },
|
|
356
|
+
const me = { x: te, y: W }, Ne = be.map((F) => ({
|
|
357
357
|
inner: F.inner,
|
|
358
358
|
points: F.points.map(
|
|
359
359
|
({ x: ne, y: ye }) => new i(ne - me.x, ye - me.y)
|
|
360
360
|
)
|
|
361
|
-
})).sort((F, ne) => Number(F.inner) - Number(ne.inner)),
|
|
361
|
+
})).sort((F, ne) => Number(F.inner) - Number(ne.inner)), Je = Ne.findIndex(
|
|
362
362
|
({ inner: F }) => !F
|
|
363
|
-
), Re =
|
|
364
|
-
return
|
|
363
|
+
), Re = Je >= 0 ? Je : 0, Te = Ne[Re] ?? Ne[0], je = (Te == null ? void 0 : Te.points.map(({ x: F, y: ne }) => new i(F, ne))) ?? [], Ae = [];
|
|
364
|
+
return Ne.forEach(({ points: F }) => {
|
|
365
365
|
if (!F.length) return;
|
|
366
366
|
const [ne, ...ye] = F;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}),
|
|
370
|
-
}), new l.Path(
|
|
371
|
-
left:
|
|
367
|
+
Ae.push(`M ${ne.x} ${ne.y}`), ye.forEach(({ x: X, y: K }) => {
|
|
368
|
+
Ae.push(`L ${X} ${K}`);
|
|
369
|
+
}), Ae.push("Z");
|
|
370
|
+
}), new l.Path(Ae.join(" "), {
|
|
371
|
+
left: Pe + me.x,
|
|
372
372
|
top: ue + me.y,
|
|
373
373
|
originX: "left",
|
|
374
374
|
originY: "top",
|
|
@@ -377,11 +377,11 @@ const Ja = (e) => {
|
|
|
377
377
|
evented: !0,
|
|
378
378
|
fillRule: "evenodd",
|
|
379
379
|
pathOffset: new i(0, 0),
|
|
380
|
-
points:
|
|
381
|
-
pathContours:
|
|
380
|
+
points: je,
|
|
381
|
+
pathContours: Ne,
|
|
382
382
|
pathBaseOffset: me,
|
|
383
383
|
pathEditableContourIndex: Re,
|
|
384
|
-
info: y.info ??
|
|
384
|
+
info: y.info ?? vt,
|
|
385
385
|
fill: y.fill,
|
|
386
386
|
hex: y.hex,
|
|
387
387
|
alpha: y.alpha,
|
|
@@ -403,9 +403,9 @@ const Ja = (e) => {
|
|
|
403
403
|
height: m.height,
|
|
404
404
|
bytes: 4
|
|
405
405
|
}, { x: B, y: R } = v;
|
|
406
|
-
let x = Ve.floodFill(y, B, R,
|
|
407
|
-
x = Ve.gaussBlurOnlyBorder(x,
|
|
408
|
-
},
|
|
406
|
+
let x = Ve.floodFill(y, B, R, d);
|
|
407
|
+
x = Ve.gaussBlurOnlyBorder(x, c), A(x, n);
|
|
408
|
+
}, A = (y, B) => {
|
|
409
409
|
if (!m) return;
|
|
410
410
|
const x = ((ue) => {
|
|
411
411
|
const te = ue.substring(5), be = te.substring(0, te.length - 1).split(",").map((me) => +me);
|
|
@@ -421,22 +421,22 @@ const Ja = (e) => {
|
|
|
421
421
|
se[W] = x[0], se[W + 1] = x[1], se[W + 2] = x[2], se[W + 3] = x[3];
|
|
422
422
|
}
|
|
423
423
|
P.remove();
|
|
424
|
-
const { canvas: de, minX:
|
|
425
|
-
k(de,
|
|
424
|
+
const { canvas: de, minX: Ie, minY: Pe } = sn(q);
|
|
425
|
+
k(de, Ie, Pe);
|
|
426
426
|
}, k = async (y, B, R) => {
|
|
427
427
|
if (!v) return;
|
|
428
428
|
const x = B, P = R, T = y.toDataURL();
|
|
429
429
|
y.remove();
|
|
430
|
-
const L = await
|
|
430
|
+
const L = await r.fromURL(T, {}, {
|
|
431
431
|
left: x,
|
|
432
432
|
top: P,
|
|
433
433
|
objectCaching: !1,
|
|
434
434
|
selectable: !1,
|
|
435
|
-
info:
|
|
435
|
+
info: vt,
|
|
436
436
|
fill: n,
|
|
437
437
|
lockMovementX: !0,
|
|
438
438
|
lockMovementY: !0
|
|
439
|
-
}), { hex: M, alpha: Y } =
|
|
439
|
+
}), { hex: M, alpha: Y } = it(n);
|
|
440
440
|
L.set({
|
|
441
441
|
hex: M,
|
|
442
442
|
alpha: Y,
|
|
@@ -454,44 +454,44 @@ const Ja = (e) => {
|
|
|
454
454
|
}
|
|
455
455
|
}, H = function(y) {
|
|
456
456
|
const B = y.e;
|
|
457
|
-
(B == null ? void 0 : B.button) === 0 && (v = N(
|
|
457
|
+
(B == null ? void 0 : B.button) === 0 && (v = N(Qt(B)), V());
|
|
458
458
|
}, {
|
|
459
459
|
brushCursor: w,
|
|
460
460
|
handleOnMouseMove: C,
|
|
461
461
|
handleOnMouseUp: E
|
|
462
|
-
} =
|
|
462
|
+
} = Ot({ ...s, lineCap: "square" }), _ = () => {
|
|
463
463
|
E();
|
|
464
|
-
},
|
|
464
|
+
}, D = function() {
|
|
465
465
|
a.add(w);
|
|
466
466
|
}, O = function() {
|
|
467
467
|
a.remove(w);
|
|
468
468
|
};
|
|
469
|
-
return a.add(w), a.on("mouse:over", I(
|
|
470
|
-
a.remove(w),
|
|
469
|
+
return a.add(w), a.on("mouse:over", I(D)), a.on("mouse:out", I(O)), a.on("mouse:down", I(H)), a.on("mouse:move", I(C)), a.on("mouse:up", I(_)), () => {
|
|
470
|
+
a.remove(w), g(), a.off("mouse:over", I(D)), a.off("mouse:out", I(O)), a.off("mouse:down", I(H)), a.off("mouse:move", I(C)), a.off("mouse:up", I(_));
|
|
471
471
|
};
|
|
472
|
-
} }),
|
|
473
|
-
const n = pe(), s =
|
|
474
|
-
let
|
|
475
|
-
const
|
|
472
|
+
} }), an = () => ({ id: "pen", init: ({ colorCode: t }) => {
|
|
473
|
+
const n = pe(), s = Oe(), o = Kt(), a = Pn();
|
|
474
|
+
let r = [], i = [], l = !1;
|
|
475
|
+
const g = function(f, b) {
|
|
476
476
|
if (!i.length)
|
|
477
477
|
return !1;
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
478
|
+
const h = i[0];
|
|
479
|
+
if (h.x1 === void 0 || h.y1 === void 0)
|
|
480
480
|
return !1;
|
|
481
|
-
const p = n.getScenePoint(
|
|
482
|
-
return Math.abs(N - V) <= b && Math.abs(Z -
|
|
483
|
-
},
|
|
484
|
-
|
|
485
|
-
},
|
|
486
|
-
const b =
|
|
487
|
-
if (b &&
|
|
481
|
+
const p = n.getScenePoint(f), N = h.x1 ?? 0, Z = h.y1 ?? 0, { x: V, y: A } = p;
|
|
482
|
+
return Math.abs(N - V) <= b && Math.abs(Z - A) <= b;
|
|
483
|
+
}, d = function(f) {
|
|
484
|
+
f.preventDefault(), n.remove(...i), i = [];
|
|
485
|
+
}, c = function(f) {
|
|
486
|
+
const b = f.e;
|
|
487
|
+
if (b && g(b, 10)) {
|
|
488
488
|
l = !0;
|
|
489
489
|
return;
|
|
490
490
|
}
|
|
491
|
-
const
|
|
491
|
+
const h = n.getScenePoint(b), p = i.length ? i[i.length - 1] : null;
|
|
492
492
|
if (!p || p.x2) {
|
|
493
493
|
const N = new a(
|
|
494
|
-
[
|
|
494
|
+
[h.x, h.y, h.x, h.y],
|
|
495
495
|
{
|
|
496
496
|
stroke: "red",
|
|
497
497
|
strokeWidth: 2,
|
|
@@ -502,40 +502,40 @@ const Ja = (e) => {
|
|
|
502
502
|
);
|
|
503
503
|
N.replaced = !0, n.add(N), i.push(N);
|
|
504
504
|
} else
|
|
505
|
-
p.set({ x2:
|
|
506
|
-
|
|
507
|
-
}, m = function(
|
|
505
|
+
p.set({ x2: h.x, y2: h.y });
|
|
506
|
+
r.push(new s(h.x, h.y));
|
|
507
|
+
}, m = function(f) {
|
|
508
508
|
if (l)
|
|
509
509
|
return;
|
|
510
510
|
const b = i.length ? i[i.length - 1] : null;
|
|
511
511
|
if (b) {
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
512
|
+
const h = f.e;
|
|
513
|
+
if (!h)
|
|
514
514
|
return;
|
|
515
|
-
const p = n.getScenePoint(
|
|
515
|
+
const p = n.getScenePoint(h);
|
|
516
516
|
b.set({ x2: p.x, y2: p.y }), n.renderAll();
|
|
517
517
|
}
|
|
518
518
|
}, v = function() {
|
|
519
519
|
if (l) {
|
|
520
520
|
n.remove(...i);
|
|
521
|
-
const
|
|
521
|
+
const f = new o(r, {
|
|
522
522
|
fill: t,
|
|
523
523
|
objectCaching: !1,
|
|
524
524
|
selectable: !1,
|
|
525
525
|
evented: !0,
|
|
526
526
|
info: wn
|
|
527
527
|
});
|
|
528
|
-
n.add(
|
|
528
|
+
n.add(f), n.renderAll(), r = [], i = [], l = !1;
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
|
-
return n.defaultCursor = "crosshair", document.addEventListener("contextmenu",
|
|
532
|
-
document.removeEventListener("contextmenu",
|
|
531
|
+
return n.defaultCursor = "crosshair", document.addEventListener("contextmenu", d), n.on("mouse:down", I(c)), n.on("mouse:move", I(m)), n.on("mouse:up", I(v)), () => {
|
|
532
|
+
document.removeEventListener("contextmenu", d), n.defaultCursor = "default", n.off("mouse:down", I(c)), n.off("mouse:move", I(m)), n.off("mouse:up", I(v)), n.remove(...i), i = [];
|
|
533
533
|
};
|
|
534
534
|
} }), zn = (e) => {
|
|
535
535
|
if (!e)
|
|
536
536
|
return !1;
|
|
537
|
-
const t =
|
|
538
|
-
return !!(e instanceof t || e instanceof n.Path && [_e,
|
|
537
|
+
const t = Kt(), n = oe();
|
|
538
|
+
return !!(e instanceof t || e instanceof n.Path && [_e, vt].includes(
|
|
539
539
|
e.info ?? ""
|
|
540
540
|
) && Array.isArray(e.points) && Array.isArray(e.pathContours));
|
|
541
541
|
}, Fn = (e) => {
|
|
@@ -545,23 +545,23 @@ const Ja = (e) => {
|
|
|
545
545
|
const n = e, s = n.pathContours, o = n.pathEditableContourIndex ?? 0;
|
|
546
546
|
if (!s[o])
|
|
547
547
|
return;
|
|
548
|
-
const a =
|
|
548
|
+
const a = Oe();
|
|
549
549
|
s[o].points = n.points.map(
|
|
550
|
-
({ x: l, y:
|
|
550
|
+
({ x: l, y: g }) => new a(l, g)
|
|
551
551
|
);
|
|
552
|
-
const
|
|
552
|
+
const r = [];
|
|
553
553
|
s.forEach(({ points: l }) => {
|
|
554
554
|
if (!l.length)
|
|
555
555
|
return;
|
|
556
|
-
const [
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}),
|
|
556
|
+
const [g, ...d] = l;
|
|
557
|
+
r.push(`M ${g.x} ${g.y}`), d.forEach(({ x: c, y: m }) => {
|
|
558
|
+
r.push(`L ${c} ${m}`);
|
|
559
|
+
}), r.push("Z");
|
|
560
560
|
});
|
|
561
|
-
const i = new t.Path(
|
|
561
|
+
const i = new t.Path(r.join(" "));
|
|
562
562
|
n.set({ path: i.path }), n.pathContours = s, n.dirty = !0, n.setCoords();
|
|
563
|
-
},
|
|
564
|
-
const t =
|
|
563
|
+
}, cn = (e) => {
|
|
564
|
+
const t = Oe(), n = e.strokeWidth ?? 0, s = (e.strokeUniform ? 1 / (e.scaleX ?? 1) : 1) * n, o = (e.strokeUniform ? 1 / (e.scaleY ?? 1) : 1) * n;
|
|
565
565
|
return new t(
|
|
566
566
|
Math.max((e.width ?? 0) + s, 1),
|
|
567
567
|
Math.max((e.height ?? 0) + o, 1)
|
|
@@ -572,8 +572,8 @@ const Ja = (e) => {
|
|
|
572
572
|
}, $n = (e, t) => {
|
|
573
573
|
let n = !1;
|
|
574
574
|
for (let s = 0, o = t.length - 1; s < t.length; o = s++) {
|
|
575
|
-
const a = t[s].x,
|
|
576
|
-
|
|
575
|
+
const a = t[s].x, r = t[s].y, i = t[o].x, l = t[o].y;
|
|
576
|
+
r > e.y != l > e.y && e.x < (i - a) * (e.y - r) / (l - r + Number.EPSILON) + a && (n = !n);
|
|
577
577
|
}
|
|
578
578
|
return n;
|
|
579
579
|
}, Gn = (e) => {
|
|
@@ -581,71 +581,71 @@ const Ja = (e) => {
|
|
|
581
581
|
return 0;
|
|
582
582
|
let t = 0;
|
|
583
583
|
for (let n = 0; n < e.length; n += 1) {
|
|
584
|
-
const { x: s, y: o } = e[n], { x: a, y:
|
|
585
|
-
t += s *
|
|
584
|
+
const { x: s, y: o } = e[n], { x: a, y: r } = e[(n + 1) % e.length];
|
|
585
|
+
t += s * r - a * o;
|
|
586
586
|
}
|
|
587
587
|
return Math.abs(t / 2);
|
|
588
588
|
}, qn = function(e, t, n) {
|
|
589
589
|
var l;
|
|
590
|
-
const s =
|
|
590
|
+
const s = Oe(), o = oe().util, a = n.points[this.pointIndex ?? 0], r = a.x - n.pathOffset.x, i = a.y - n.pathOffset.y;
|
|
591
591
|
return o.transformPoint(
|
|
592
|
-
new s(
|
|
592
|
+
new s(r, i),
|
|
593
593
|
o.multiplyTransformMatrices(
|
|
594
594
|
((l = n.canvas) == null ? void 0 : l.viewportTransform) ?? [1, 0, 0, 1, 0, 0],
|
|
595
595
|
n.calcTransformMatrix()
|
|
596
596
|
)
|
|
597
597
|
);
|
|
598
|
-
},
|
|
598
|
+
}, rn = (e) => {
|
|
599
599
|
var a;
|
|
600
|
-
const t =
|
|
600
|
+
const t = Oe(), n = oe().util;
|
|
601
601
|
if (!e.points || !e.pathOffset)
|
|
602
602
|
return [];
|
|
603
603
|
const s = e.calcTransformMatrix(), o = (a = e.canvas) != null && a.viewportTransform ? n.multiplyTransformMatrices(e.canvas.viewportTransform, s) : s;
|
|
604
604
|
return e.points.map(
|
|
605
|
-
(
|
|
606
|
-
new t(
|
|
605
|
+
(r) => n.transformPoint(
|
|
606
|
+
new t(r.x - e.pathOffset.x, r.y - e.pathOffset.y),
|
|
607
607
|
o
|
|
608
608
|
)
|
|
609
609
|
);
|
|
610
610
|
}, Kn = function(e, t, n, s) {
|
|
611
611
|
var v;
|
|
612
|
-
const o =
|
|
613
|
-
if (!
|
|
612
|
+
const o = Oe(), a = oe(), r = t.target;
|
|
613
|
+
if (!r || !r.points || !r.pathOffset)
|
|
614
614
|
return !1;
|
|
615
|
-
const i = (v =
|
|
615
|
+
const i = (v = r.controls) == null ? void 0 : v[r.__corner ?? ""];
|
|
616
616
|
if (!i)
|
|
617
617
|
return !1;
|
|
618
|
-
const l = i.pointIndex ?? 0,
|
|
618
|
+
const l = i.pointIndex ?? 0, g = r.toLocalPoint(
|
|
619
619
|
new o(n, s),
|
|
620
620
|
"center",
|
|
621
621
|
"center"
|
|
622
|
-
),
|
|
623
|
-
x:
|
|
624
|
-
y:
|
|
622
|
+
), d = cn(r), c = r._getTransformedDimensions(0, 0), m = {
|
|
623
|
+
x: g.x * d.x / c.x + r.pathOffset.x,
|
|
624
|
+
y: g.y * d.y / c.y + r.pathOffset.y
|
|
625
625
|
};
|
|
626
|
-
return
|
|
626
|
+
return r.points[l] = m, r instanceof a.Path && Fn(r), !0;
|
|
627
627
|
}, Jn = function(e, t) {
|
|
628
628
|
return function(n, s, o, a) {
|
|
629
629
|
var Z;
|
|
630
|
-
const
|
|
630
|
+
const r = Oe(), i = s.target;
|
|
631
631
|
if (!i.points || !i.pathOffset)
|
|
632
632
|
return !1;
|
|
633
|
-
const l = i.controls,
|
|
634
|
-
new
|
|
633
|
+
const l = i.controls, g = typeof i.__corner == "string" ? i.__corner : "", d = l == null ? void 0 : l[g], c = (d == null ? void 0 : d.pointIndex) ?? e, v = oe().util.transformPoint(
|
|
634
|
+
new r(
|
|
635
635
|
i.points[e].x - i.pathOffset.x,
|
|
636
636
|
i.points[e].y - i.pathOffset.y
|
|
637
637
|
),
|
|
638
638
|
i.calcTransformMatrix()
|
|
639
|
-
),
|
|
639
|
+
), f = t(n, s, o, a), b = cn(i), h = (i.points[e].x - i.pathOffset.x) / b.x, p = (i.points[e].y - i.pathOffset.y) / b.y;
|
|
640
640
|
Xn(i), i.setPositionByOrigin(
|
|
641
641
|
v,
|
|
642
|
-
|
|
642
|
+
h + 0.5,
|
|
643
643
|
p + 0.5
|
|
644
644
|
);
|
|
645
645
|
const N = i.editSnapshot;
|
|
646
646
|
if ((Z = N == null ? void 0 : N.absolutePoints) != null && Z.length) {
|
|
647
|
-
const
|
|
648
|
-
if (H ===
|
|
647
|
+
const A = rn(i).map((k, H) => {
|
|
648
|
+
if (H === c)
|
|
649
649
|
return null;
|
|
650
650
|
const w = N.absolutePoints[H];
|
|
651
651
|
return w ? {
|
|
@@ -655,19 +655,19 @@ const Ja = (e) => {
|
|
|
655
655
|
}).filter(
|
|
656
656
|
(k) => k !== null
|
|
657
657
|
);
|
|
658
|
-
if (
|
|
659
|
-
const k =
|
|
658
|
+
if (A.length) {
|
|
659
|
+
const k = A.reduce((w, { dx: C }) => w + C, 0) / A.length, H = A.reduce((w, { dy: C }) => w + C, 0) / A.length;
|
|
660
660
|
(k !== 0 || H !== 0) && (i.set({
|
|
661
661
|
left: (i.left ?? 0) + k,
|
|
662
662
|
top: (i.top ?? 0) + H
|
|
663
663
|
}), i.setCoords());
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
|
-
return
|
|
666
|
+
return f;
|
|
667
667
|
};
|
|
668
668
|
}, jn = (e, t) => {
|
|
669
|
-
var
|
|
670
|
-
const n = oe(), s =
|
|
669
|
+
var g, d;
|
|
670
|
+
const n = oe(), s = Oe();
|
|
671
671
|
if (!(e instanceof n.Path) || !Array.isArray(e.pathContours) || !t)
|
|
672
672
|
return;
|
|
673
673
|
const o = e.toLocalPoint(
|
|
@@ -675,85 +675,85 @@ const Ja = (e) => {
|
|
|
675
675
|
"left",
|
|
676
676
|
"top"
|
|
677
677
|
), a = e.pathContours.map(
|
|
678
|
-
({ points:
|
|
678
|
+
({ points: c }, m) => ({
|
|
679
679
|
index: m,
|
|
680
|
-
inside: $n(o,
|
|
680
|
+
inside: $n(o, c),
|
|
681
681
|
distance: Math.min(
|
|
682
|
-
...
|
|
682
|
+
...c.map(
|
|
683
683
|
(v) => Math.hypot(v.x - o.x, v.y - o.y)
|
|
684
684
|
)
|
|
685
685
|
),
|
|
686
|
-
area: Gn(
|
|
686
|
+
area: Gn(c)
|
|
687
687
|
})
|
|
688
|
-
), i = ((
|
|
688
|
+
), i = ((g = a.filter(({ inside: c }) => c).sort((c, m) => c.area - m.area)[0]) == null ? void 0 : g.index) ?? ((d = a.sort((c, m) => c.distance - m.distance)[0]) == null ? void 0 : d.index) ?? 0;
|
|
689
689
|
e.pathEditableContourIndex = i;
|
|
690
690
|
const l = e.pathContours[i];
|
|
691
691
|
l && (e.points = l.points.map(
|
|
692
|
-
({ x:
|
|
692
|
+
({ x: c, y: m }) => new s(c, m)
|
|
693
693
|
));
|
|
694
694
|
}, Qn = (e) => {
|
|
695
695
|
var s;
|
|
696
696
|
const t = En(), n = (((s = e.points) == null ? void 0 : s.length) ?? 1) - 1;
|
|
697
697
|
e.controls = (e.points ?? []).reduce(
|
|
698
|
-
function(o, a,
|
|
698
|
+
function(o, a, r) {
|
|
699
699
|
const i = () => (e.editSnapshot = {
|
|
700
|
-
dragIndex:
|
|
701
|
-
absolutePoints:
|
|
700
|
+
dragIndex: r,
|
|
701
|
+
absolutePoints: rn(e)
|
|
702
702
|
}, !1), l = () => (delete e.editSnapshot, !1);
|
|
703
|
-
return o["p" +
|
|
703
|
+
return o["p" + r] = new t({
|
|
704
704
|
positionHandler: qn,
|
|
705
705
|
actionHandler: Jn(
|
|
706
|
-
|
|
706
|
+
r > 0 ? r - 1 : n,
|
|
707
707
|
Kn
|
|
708
708
|
),
|
|
709
709
|
actionName: "editPolygon",
|
|
710
|
-
pointIndex:
|
|
710
|
+
pointIndex: r,
|
|
711
711
|
mouseDownHandler: i,
|
|
712
712
|
mouseUpHandler: l
|
|
713
713
|
}), o;
|
|
714
714
|
},
|
|
715
715
|
{}
|
|
716
716
|
);
|
|
717
|
-
},
|
|
717
|
+
}, ln = (e, t) => {
|
|
718
718
|
const n = t.passStack;
|
|
719
719
|
t.passStack = !0, e.fire("object:modified", { target: t }), t.passStack = n;
|
|
720
720
|
}, eo = (e, t, n) => {
|
|
721
721
|
if (!t || !zn(t))
|
|
722
|
-
return
|
|
722
|
+
return yt(e), null;
|
|
723
723
|
const s = t;
|
|
724
|
-
return s.edit || (jn(s, n), s.edit = !0, s.cornerStyle = "circle", Qn(s), s.transparentCorners = !1, s.hasBorders = !1),
|
|
725
|
-
},
|
|
724
|
+
return s.edit || (jn(s, n), s.edit = !0, s.cornerStyle = "circle", Qn(s), s.transparentCorners = !1, s.hasBorders = !1), yt(e, s), e.requestRenderAll(), ln(e, s), s;
|
|
725
|
+
}, yt = (e, t) => {
|
|
726
726
|
const n = oe().FabricObject;
|
|
727
|
-
|
|
727
|
+
Se(e).forEach((s) => {
|
|
728
728
|
if (!t || s !== t && t.edit) {
|
|
729
729
|
const o = s, a = o.edit;
|
|
730
|
-
o.edit = !1, o.cornerStyle = "rect", o.controls = n.prototype.controls, o.hasBorders = !0, o.transparentCorners = !0, delete o.editSnapshot, a &&
|
|
730
|
+
o.edit = !1, o.cornerStyle = "rect", o.controls = n.prototype.controls, o.hasBorders = !0, o.transparentCorners = !0, delete o.editSnapshot, a && ln(e, o);
|
|
731
731
|
}
|
|
732
732
|
}), e.requestRenderAll();
|
|
733
|
-
},
|
|
733
|
+
}, dn = () => ({ id: "bounded-box", init: (t) => Pt(t, !0) }), to = () => ({ id: "filled-box", init: (t) => Pt(t, !1) }), no = () => ({ id: "seg-anything", init: ({ callback: t }) => Pt({ colorCode: "#13C0A4", callback: t }, !0, !0) }), Bt = () => ({ id: "selection", init: () => {
|
|
734
734
|
let t = !1, n = !1;
|
|
735
735
|
const s = _n(), o = pe();
|
|
736
736
|
o.defaultCursor = "default", o.hoverCursor = "default", o.moveCursor = "default", o.selection = !0;
|
|
737
|
-
const a =
|
|
737
|
+
const a = Se();
|
|
738
738
|
a.forEach((w) => {
|
|
739
739
|
w.selectable = !0, w.evented = !0;
|
|
740
740
|
});
|
|
741
|
-
let
|
|
741
|
+
let r = null;
|
|
742
742
|
const i = (w = !1) => {
|
|
743
|
-
|
|
743
|
+
r && (yt(o), r = null, w && o.discardActiveObject(), ke(o));
|
|
744
744
|
}, l = function(w) {
|
|
745
745
|
const C = w.scenePoint ?? w.absolutePointer, E = w.target;
|
|
746
|
-
|
|
747
|
-
},
|
|
746
|
+
r && E !== r && i(!E), C && (t = !0, s.x = C.x, s.y = C.y);
|
|
747
|
+
}, g = function(w) {
|
|
748
748
|
t && a.forEach((C) => {
|
|
749
749
|
C.info === Fe && (C.selectable = !1);
|
|
750
750
|
});
|
|
751
|
-
},
|
|
751
|
+
}, d = function(w) {
|
|
752
752
|
const C = w.scenePoint ?? w.absolutePointer;
|
|
753
753
|
C && (s.x = C.x - s.x, s.y = C.y - s.y), t = !1, a.forEach((E) => {
|
|
754
754
|
E.info === Fe && (E.selectable = !n);
|
|
755
755
|
});
|
|
756
|
-
},
|
|
756
|
+
}, c = function({ target: w }) {
|
|
757
757
|
}, m = function() {
|
|
758
758
|
}, v = function(w) {
|
|
759
759
|
if (w.key === "Escape" || w.code === "Escape") {
|
|
@@ -761,7 +761,7 @@ const Ja = (e) => {
|
|
|
761
761
|
return;
|
|
762
762
|
}
|
|
763
763
|
n = w.shiftKey;
|
|
764
|
-
},
|
|
764
|
+
}, f = function() {
|
|
765
765
|
n = !1;
|
|
766
766
|
}, b = function(w) {
|
|
767
767
|
const C = w.scenePoint ?? w.absolutePointer, E = eo(
|
|
@@ -769,65 +769,65 @@ const Ja = (e) => {
|
|
|
769
769
|
w.target ?? null,
|
|
770
770
|
C
|
|
771
771
|
);
|
|
772
|
-
E && (
|
|
773
|
-
},
|
|
772
|
+
E && (r = E, o.setActiveObject(E));
|
|
773
|
+
}, h = De(l), p = De(g), N = De(d), Z = De(c), V = De(m), A = De(b), k = () => {
|
|
774
774
|
i();
|
|
775
775
|
};
|
|
776
|
-
o.on("mouse:down", I(
|
|
777
|
-
const H =
|
|
778
|
-
({ info: w }) => w ===
|
|
776
|
+
o.on("mouse:down", I(h)), o.on("mouse:move", I(p)), o.on("mouse:up", I(N)), o.on("mouse:over", I(Z)), o.on("mouse:out", I(V)), o.on("mouse:dblclick", I(A)), o.on("selection:cleared", k), document.addEventListener("keydown", v), document.addEventListener("keyup", f);
|
|
777
|
+
const H = Se(o).find(
|
|
778
|
+
({ info: w }) => w === at
|
|
779
779
|
);
|
|
780
|
-
return H && (o.remove(H),
|
|
781
|
-
i(), o.defaultCursor = "default", o.hoverCursor = "default", o.moveCursor = "default", o.selection = !1, o.discardActiveObject(),
|
|
780
|
+
return H && (o.remove(H), ke(o)), () => {
|
|
781
|
+
i(), o.defaultCursor = "default", o.hoverCursor = "default", o.moveCursor = "default", o.selection = !1, o.discardActiveObject(), ke(o), o.off("mouse:down", I(h)), o.off("mouse:move", I(p)), o.off("mouse:up", I(N)), o.off("mouse:over", I(Z)), o.off("mouse:out", I(V)), o.off("mouse:dblclick", I(A)), o.off("selection:cleared", k), document.removeEventListener("keydown", v), document.removeEventListener("keyup", f), a.forEach((w) => {
|
|
782
782
|
w.selectable = !1, w.evented = !1;
|
|
783
783
|
});
|
|
784
784
|
};
|
|
785
785
|
} });
|
|
786
|
-
let
|
|
786
|
+
let xt = null, st = null;
|
|
787
787
|
const ja = (e) => {
|
|
788
|
-
|
|
789
|
-
},
|
|
788
|
+
xt = e.SLIC, st = e.MagicBrush;
|
|
789
|
+
}, un = () => ({ id: "superpixel", init: async ({
|
|
790
790
|
src: t,
|
|
791
791
|
colorCode: n,
|
|
792
792
|
superpixelConfig: s,
|
|
793
793
|
previousTool: o
|
|
794
794
|
}) => {
|
|
795
|
-
if (!
|
|
795
|
+
if (!xt || !st) {
|
|
796
796
|
console.warn(
|
|
797
797
|
"[@ez-planet/labeling-canvas] SLIC/MagicBrush modules not provided. Call setSuperpixelModules() first."
|
|
798
798
|
);
|
|
799
799
|
return;
|
|
800
800
|
}
|
|
801
|
-
const a = pe(),
|
|
801
|
+
const a = pe(), r = Jt(), i = Oe(), l = oe();
|
|
802
802
|
a.defaultCursor = "crosshair", a.hoverCursor = "crosshair";
|
|
803
|
-
const
|
|
804
|
-
if (!
|
|
805
|
-
|
|
803
|
+
const g = !o || o.id !== "superpixel", d = await on(t), { width: c, height: m } = d, v = Se(a).filter(({ info: x }) => x === _e).pop(), f = (v == null ? void 0 : v.index) ?? 0, b = g ? f + 1 : f, h = document.createElement("canvas").getContext("2d");
|
|
804
|
+
if (!h) return;
|
|
805
|
+
h.canvas.width = c, h.canvas.height = m;
|
|
806
806
|
const p = document.createElement("canvas").getContext("2d");
|
|
807
807
|
if (!p) return;
|
|
808
|
-
p.canvas.width =
|
|
808
|
+
p.canvas.width = c, p.canvas.height = m;
|
|
809
809
|
const N = document.createElement("canvas").getContext("2d");
|
|
810
810
|
if (!N) return;
|
|
811
|
-
N.canvas.width =
|
|
812
|
-
const Z =
|
|
813
|
-
V.createPixelIndex(
|
|
814
|
-
const k = p.getImageData(0, 0,
|
|
815
|
-
V.computeEdgemap(k),
|
|
816
|
-
const H =
|
|
817
|
-
|
|
811
|
+
N.canvas.width = c, N.canvas.height = m, h.drawImage(d, 0, 0);
|
|
812
|
+
const Z = h.getImageData(0, 0, c, m), V = new xt(Z, s), A = V.result;
|
|
813
|
+
V.createPixelIndex(A), p.putImageData(A, 0, 0);
|
|
814
|
+
const k = p.getImageData(0, 0, c, m);
|
|
815
|
+
V.computeEdgemap(k), h.clearRect(0, 0, c, m), h.putImageData(k, 0, 0);
|
|
816
|
+
const H = h.canvas.toDataURL();
|
|
817
|
+
h.canvas.remove();
|
|
818
818
|
let w = setTimeout(async () => {
|
|
819
819
|
w && clearTimeout(w), w = null;
|
|
820
|
-
const x = await
|
|
820
|
+
const x = await r.fromURL(H, {}, {
|
|
821
821
|
left: 0,
|
|
822
822
|
top: 0,
|
|
823
823
|
objectCaching: !1,
|
|
824
824
|
selectable: !1,
|
|
825
|
-
info:
|
|
825
|
+
info: Ct
|
|
826
826
|
});
|
|
827
827
|
a.add(x);
|
|
828
828
|
}, 1), C = !1, E = null, _ = null;
|
|
829
|
-
const
|
|
830
|
-
x: Math.min(Math.max(Math.round(x), 0),
|
|
829
|
+
const D = ({ x, y: P }) => ({
|
|
830
|
+
x: Math.min(Math.max(Math.round(x), 0), c - 1),
|
|
831
831
|
y: Math.min(Math.max(Math.round(P), 0), m - 1)
|
|
832
832
|
}), O = (x) => {
|
|
833
833
|
const P = x.getElement(), T = document.createElement("canvas").getContext("2d");
|
|
@@ -840,34 +840,34 @@ const ja = (e) => {
|
|
|
840
840
|
for (let K = 0; K < L; K += 1)
|
|
841
841
|
Y[(X * L + K) * 4 + 3] && (G[X * L + K] = 1, z = Math.min(z, K), q = Math.min(q, X), se = Math.max(se, K), de = Math.max(de, X));
|
|
842
842
|
if (T.canvas.remove(), se < z || de < q) return null;
|
|
843
|
-
const
|
|
843
|
+
const Ie = st.traceContours({
|
|
844
844
|
data: G,
|
|
845
845
|
width: L,
|
|
846
846
|
height: M,
|
|
847
847
|
bounds: { minX: z, minY: q, maxX: se, maxY: de }
|
|
848
|
-
}),
|
|
848
|
+
}), Pe = x.scaleX ?? 1, ue = x.scaleY ?? 1, te = x.left ?? 0, W = x.top ?? 0, be = st.simplifyContours(Ie, 1, 6).filter(
|
|
849
849
|
({ points: X }) => X.length
|
|
850
850
|
);
|
|
851
851
|
if (!be.length) return null;
|
|
852
|
-
let me = 1 / 0,
|
|
853
|
-
const
|
|
854
|
-
const K = X.points.map(({ x:
|
|
855
|
-
const
|
|
856
|
-
return me = Math.min(me,
|
|
852
|
+
let me = 1 / 0, Ne = 1 / 0;
|
|
853
|
+
const Je = be.map((X) => {
|
|
854
|
+
const K = X.points.map(({ x: Be, y: dt }) => {
|
|
855
|
+
const Qe = Be * Pe, Rt = dt * ue;
|
|
856
|
+
return me = Math.min(me, Qe), Ne = Math.min(Ne, Rt), { x: Qe, y: Rt };
|
|
857
857
|
});
|
|
858
858
|
return { inner: X.inner, points: K };
|
|
859
859
|
});
|
|
860
|
-
if (!Number.isFinite(me) || !Number.isFinite(
|
|
861
|
-
const Re = { x: me, y:
|
|
860
|
+
if (!Number.isFinite(me) || !Number.isFinite(Ne)) return null;
|
|
861
|
+
const Re = { x: me, y: Ne }, Te = Je.map((X) => ({
|
|
862
862
|
inner: X.inner,
|
|
863
863
|
points: X.points.map(
|
|
864
|
-
({ x: K, y:
|
|
864
|
+
({ x: K, y: Be }) => new i(K - Re.x, Be - Re.y)
|
|
865
865
|
)
|
|
866
|
-
})).sort((X, K) => Number(X.inner) - Number(K.inner)),
|
|
867
|
-
return
|
|
866
|
+
})).sort((X, K) => Number(X.inner) - Number(K.inner)), je = Te.findIndex(({ inner: X }) => !X), Ae = je >= 0 ? je : 0, F = Te[Ae] ?? Te[0], ne = (F == null ? void 0 : F.points.map(({ x: X, y: K }) => new i(X, K))) ?? [], ye = [];
|
|
867
|
+
return Te.forEach(({ points: X }) => {
|
|
868
868
|
if (!X.length) return;
|
|
869
|
-
const [K, ...
|
|
870
|
-
ye.push(`M ${K.x} ${K.y}`),
|
|
869
|
+
const [K, ...Be] = X;
|
|
870
|
+
ye.push(`M ${K.x} ${K.y}`), Be.forEach(({ x: dt, y: Qe }) => ye.push(`L ${dt} ${Qe}`)), ye.push("Z");
|
|
871
871
|
}), new l.Path(ye.join(" "), {
|
|
872
872
|
left: te + Re.x,
|
|
873
873
|
top: W + Re.y,
|
|
@@ -879,9 +879,9 @@ const ja = (e) => {
|
|
|
879
879
|
fillRule: "evenodd",
|
|
880
880
|
pathOffset: new i(0, 0),
|
|
881
881
|
points: ne,
|
|
882
|
-
pathContours:
|
|
882
|
+
pathContours: Te,
|
|
883
883
|
pathBaseOffset: Re,
|
|
884
|
-
pathEditableContourIndex:
|
|
884
|
+
pathEditableContourIndex: Ae,
|
|
885
885
|
info: x.info ?? _e,
|
|
886
886
|
fill: x.fill,
|
|
887
887
|
hex: x.hex,
|
|
@@ -898,20 +898,20 @@ const ja = (e) => {
|
|
|
898
898
|
}, y = (x) => {
|
|
899
899
|
const P = x.e;
|
|
900
900
|
if (C && (P == null ? void 0 : P.button) === 0) {
|
|
901
|
-
const T =
|
|
901
|
+
const T = D(Qt(P));
|
|
902
902
|
if (!T.x && !T.y) return;
|
|
903
|
-
const L = V.getClickOffset(T,
|
|
903
|
+
const L = V.getClickOffset(T, c), M = A.data, Y = N.getImageData(0, 0, c, m), G = V.getEncodedLabel(M, L);
|
|
904
904
|
if (E === G) return;
|
|
905
905
|
E = G;
|
|
906
|
-
const z = V.getPixelIndex()[G], q =
|
|
906
|
+
const z = V.getPixelIndex()[G], q = Tt(n), se = Math.max(0, Math.min(1, q[3] ?? 1)), de = [
|
|
907
907
|
q[0],
|
|
908
908
|
q[1],
|
|
909
909
|
q[2],
|
|
910
910
|
Math.round(se * 255)
|
|
911
911
|
];
|
|
912
|
-
V.highlightPixels(z, de, Y, k), V.fillPixels(z, de, Y), N.clearRect(0, 0,
|
|
913
|
-
const { canvas:
|
|
914
|
-
left:
|
|
912
|
+
V.highlightPixels(z, de, Y, k), V.fillPixels(z, de, Y), N.clearRect(0, 0, c, m), N.putImageData(Y, 0, 0);
|
|
913
|
+
const { canvas: Ie, minX: Pe, minY: ue } = sn(Y), { hex: te, alpha: W } = it(n), be = new l.FabricImage(Ie, {
|
|
914
|
+
left: Pe,
|
|
915
915
|
top: ue,
|
|
916
916
|
objectCaching: !1,
|
|
917
917
|
selectable: !1,
|
|
@@ -932,7 +932,7 @@ const ja = (e) => {
|
|
|
932
932
|
C = !0, y(x);
|
|
933
933
|
}, R = () => {
|
|
934
934
|
C = !1, E = null;
|
|
935
|
-
const x =
|
|
935
|
+
const x = Se(a).filter(
|
|
936
936
|
(T) => T.info === _e && T.index === b && T.type === "image"
|
|
937
937
|
), P = x[x.length - 1];
|
|
938
938
|
P && (P.combinded = !0, P.evented = !0, a.remove(...x), a.add(P), _ = P);
|
|
@@ -940,8 +940,8 @@ const ja = (e) => {
|
|
|
940
940
|
return a.on("mouse:down", I(B)), a.on("mouse:move", I(y)), a.on("mouse:up", I(R)), () => {
|
|
941
941
|
w && (clearTimeout(w), w = null);
|
|
942
942
|
try {
|
|
943
|
-
const x =
|
|
944
|
-
({ info: L }) => L ===
|
|
943
|
+
const x = Se(a), P = x.find(
|
|
944
|
+
({ info: L }) => L === Ct
|
|
945
945
|
);
|
|
946
946
|
P && a.remove(P);
|
|
947
947
|
const T = _ || (x.filter(
|
|
@@ -955,71 +955,71 @@ const ja = (e) => {
|
|
|
955
955
|
a.off("mouse:down", I(B)), a.off("mouse:move", I(y)), a.off("mouse:up", I(R)), _ = null;
|
|
956
956
|
}
|
|
957
957
|
};
|
|
958
|
-
} }), oo = /* @__PURE__ */ new Set([Fe,
|
|
958
|
+
} }), oo = /* @__PURE__ */ new Set([Fe, Nt]), $e = (e) => typeof e == "number" && Number.isFinite(e), ct = (e) => $e(e) && e !== 0 ? Math.abs(e) : 1, tt = (e, t = 0) => $e(e) ? e : t, ut = (e) => {
|
|
959
959
|
if (!e) return;
|
|
960
960
|
const t = e.trim();
|
|
961
961
|
if (!t) return;
|
|
962
962
|
if (t.startsWith("#")) {
|
|
963
963
|
if (t.length === 7 || t.length === 9)
|
|
964
964
|
return t;
|
|
965
|
-
const { hex: s } =
|
|
965
|
+
const { hex: s } = it(t);
|
|
966
966
|
return `#${s}`;
|
|
967
967
|
}
|
|
968
|
-
const { hex: n } =
|
|
968
|
+
const { hex: n } = it(t);
|
|
969
969
|
return `#${n}`;
|
|
970
|
-
},
|
|
970
|
+
}, ht = (e, t) => {
|
|
971
971
|
if (t === "fill" && typeof e.fill == "string")
|
|
972
|
-
return
|
|
972
|
+
return ut(e.fill);
|
|
973
973
|
if (t === "stroke" && typeof e.stroke == "string")
|
|
974
|
-
return
|
|
974
|
+
return ut(e.stroke);
|
|
975
975
|
if (t === "hex" && typeof e.hex == "string" && e.hex.length)
|
|
976
|
-
return
|
|
976
|
+
return ut(`#${e.hex}`);
|
|
977
977
|
}, so = (e) => {
|
|
978
978
|
const t = e.info ?? "";
|
|
979
979
|
return oo.has(t) ? "box" : "segmentation";
|
|
980
980
|
}, ao = (e, t, n) => {
|
|
981
|
-
const s =
|
|
981
|
+
const s = tt(e.left), o = tt(e.top), a = tt(e.width), r = tt(e.height), i = ct(e.scaleX), l = ct(e.scaleY), g = a * i, d = r * l;
|
|
982
982
|
return {
|
|
983
983
|
type: "box",
|
|
984
984
|
x: t > 0 ? s / t : s,
|
|
985
985
|
y: n > 0 ? o / n : o,
|
|
986
|
-
width: t > 0 ? Math.max(
|
|
987
|
-
height: n > 0 ? Math.max(
|
|
986
|
+
width: t > 0 ? Math.max(g, 0) / t : g,
|
|
987
|
+
height: n > 0 ? Math.max(d, 0) / n : d
|
|
988
988
|
};
|
|
989
|
-
}, io = (e) => e.clone(
|
|
989
|
+
}, io = (e) => e.clone(kt).then((t) => t ?? e), co = async (e) => {
|
|
990
990
|
if (typeof document > "u") return null;
|
|
991
991
|
const t = e.getBoundingRect(), n = Math.max(
|
|
992
992
|
1,
|
|
993
|
-
Math.round((t == null ? void 0 : t.width) ?? (e.width ?? 0) *
|
|
993
|
+
Math.round((t == null ? void 0 : t.width) ?? (e.width ?? 0) * ct(e.scaleX))
|
|
994
994
|
), s = Math.max(
|
|
995
995
|
1,
|
|
996
|
-
Math.round((t == null ? void 0 : t.height) ?? (e.height ?? 0) *
|
|
996
|
+
Math.round((t == null ? void 0 : t.height) ?? (e.height ?? 0) * ct(e.scaleY))
|
|
997
997
|
), o = Rn(), a = document.createElement("canvas");
|
|
998
998
|
a.width = n, a.height = s;
|
|
999
|
-
const
|
|
999
|
+
const r = new o(a, {
|
|
1000
1000
|
width: n,
|
|
1001
1001
|
height: s,
|
|
1002
1002
|
renderOnAddRemove: !1
|
|
1003
|
-
}), i = await io(e), l = (t == null ? void 0 : t.left) ?? 0,
|
|
1003
|
+
}), i = await io(e), l = (t == null ? void 0 : t.left) ?? 0, g = (t == null ? void 0 : t.top) ?? 0;
|
|
1004
1004
|
i.set({
|
|
1005
1005
|
left: (i.left ?? 0) - l,
|
|
1006
|
-
top: (i.top ?? 0) -
|
|
1007
|
-
}),
|
|
1008
|
-
const
|
|
1009
|
-
return
|
|
1006
|
+
top: (i.top ?? 0) - g
|
|
1007
|
+
}), r.add(i), r.renderAll();
|
|
1008
|
+
const d = r.toDataURL({ format: "png", multiplier: 1 });
|
|
1009
|
+
return r.dispose(), a.remove(), d;
|
|
1010
1010
|
}, ro = async (e) => {
|
|
1011
1011
|
const t = await co(e);
|
|
1012
1012
|
if (!t) return null;
|
|
1013
1013
|
const [, n] = t.split(",");
|
|
1014
1014
|
if (!n) return null;
|
|
1015
|
-
const s = JSON.stringify(e.toObject(
|
|
1015
|
+
const s = JSON.stringify(e.toObject(kt));
|
|
1016
1016
|
return {
|
|
1017
1017
|
type: "segmentation",
|
|
1018
1018
|
mask: n,
|
|
1019
1019
|
vector: s
|
|
1020
1020
|
};
|
|
1021
1021
|
}, lo = (e) => {
|
|
1022
|
-
const t =
|
|
1022
|
+
const t = ht(e, "fill") ?? ht(e, "hex") ?? "#000000", n = $e(e.opacity) ? e.opacity : 1, s = ht(e, "stroke"), o = $e(e.seq) ? e.seq : void 0;
|
|
1023
1023
|
return { color: t, opacity: n, lineColor: s, zIndex: o };
|
|
1024
1024
|
}, uo = async (e, t, n) => {
|
|
1025
1025
|
const s = e.unique ?? "";
|
|
@@ -1027,51 +1027,51 @@ const ja = (e) => {
|
|
|
1027
1027
|
const o = so(e);
|
|
1028
1028
|
let a = null;
|
|
1029
1029
|
o === "box" ? a = ao(e, t, n) : a = await ro(e);
|
|
1030
|
-
const
|
|
1030
|
+
const r = lo(e), i = {
|
|
1031
1031
|
name: e.class ?? "",
|
|
1032
1032
|
index: $e(e.seq) ? e.seq : 0
|
|
1033
1033
|
};
|
|
1034
|
-
return { id: s, type: o, label: i, style:
|
|
1035
|
-
},
|
|
1034
|
+
return { id: s, type: o, label: i, style: r, geometry: a };
|
|
1035
|
+
}, hn = async (e, t, n) => {
|
|
1036
1036
|
const s = [];
|
|
1037
1037
|
for (const o of e) {
|
|
1038
1038
|
const a = await uo(o, t, n);
|
|
1039
1039
|
a && s.push(a);
|
|
1040
1040
|
}
|
|
1041
1041
|
return s;
|
|
1042
|
-
},
|
|
1043
|
-
const { id: s, type: o, label: a, style:
|
|
1042
|
+
}, fn = (e, t, n) => {
|
|
1043
|
+
const { id: s, type: o, label: a, style: r, geometry: i } = e, l = {
|
|
1044
1044
|
unique: s,
|
|
1045
1045
|
class: a.name,
|
|
1046
1046
|
seq: a.index,
|
|
1047
|
-
hex:
|
|
1048
|
-
alpha: `${Math.round(
|
|
1049
|
-
opacity:
|
|
1047
|
+
hex: r.color.replace("#", ""),
|
|
1048
|
+
alpha: `${Math.round(r.opacity * 100)}%`,
|
|
1049
|
+
opacity: r.opacity,
|
|
1050
1050
|
objectCaching: !1,
|
|
1051
1051
|
selectable: !1,
|
|
1052
1052
|
evented: !0
|
|
1053
1053
|
};
|
|
1054
|
-
if (
|
|
1055
|
-
const
|
|
1054
|
+
if (r.lineColor && (l.stroke = r.lineColor), o === "box" && (i == null ? void 0 : i.type) === "box") {
|
|
1055
|
+
const g = i;
|
|
1056
1056
|
return {
|
|
1057
1057
|
...l,
|
|
1058
1058
|
type: "rect",
|
|
1059
|
-
left:
|
|
1060
|
-
top:
|
|
1061
|
-
width:
|
|
1062
|
-
height:
|
|
1063
|
-
fill:
|
|
1064
|
-
stroke:
|
|
1065
|
-
info:
|
|
1059
|
+
left: g.x * t,
|
|
1060
|
+
top: g.y * n,
|
|
1061
|
+
width: g.width * t,
|
|
1062
|
+
height: g.height * n,
|
|
1063
|
+
fill: r.lineColor ? "" : nn(r.color.replace("#", ""), r.opacity),
|
|
1064
|
+
stroke: r.lineColor ?? void 0,
|
|
1065
|
+
info: r.lineColor ? Fe : Nt
|
|
1066
1066
|
};
|
|
1067
1067
|
}
|
|
1068
1068
|
if (o === "segmentation" && (i == null ? void 0 : i.type) === "segmentation") {
|
|
1069
|
-
const
|
|
1070
|
-
if (
|
|
1069
|
+
const g = i;
|
|
1070
|
+
if (g.vector)
|
|
1071
1071
|
try {
|
|
1072
1072
|
return {
|
|
1073
1073
|
...l,
|
|
1074
|
-
...JSON.parse(
|
|
1074
|
+
...JSON.parse(g.vector),
|
|
1075
1075
|
unique: s
|
|
1076
1076
|
};
|
|
1077
1077
|
} catch {
|
|
@@ -1079,33 +1079,33 @@ const ja = (e) => {
|
|
|
1079
1079
|
return {
|
|
1080
1080
|
...l,
|
|
1081
1081
|
type: "image",
|
|
1082
|
-
src: `data:image/png;base64,${
|
|
1082
|
+
src: `data:image/png;base64,${g.mask}`
|
|
1083
1083
|
};
|
|
1084
1084
|
}
|
|
1085
1085
|
return l;
|
|
1086
|
-
},
|
|
1086
|
+
}, _t = (e) => {
|
|
1087
1087
|
let t;
|
|
1088
|
-
const n = /* @__PURE__ */ new Set(), s = (
|
|
1089
|
-
const
|
|
1090
|
-
if (!Object.is(
|
|
1088
|
+
const n = /* @__PURE__ */ new Set(), s = (g, d) => {
|
|
1089
|
+
const c = typeof g == "function" ? g(t) : g;
|
|
1090
|
+
if (!Object.is(c, t)) {
|
|
1091
1091
|
const m = t;
|
|
1092
|
-
t =
|
|
1092
|
+
t = d ?? (typeof c != "object" || c === null) ? c : Object.assign({}, t, c), n.forEach((v) => v(t, m));
|
|
1093
1093
|
}
|
|
1094
|
-
}, o = () => t, i = { setState: s, getState: o, getInitialState: () => l, subscribe: (
|
|
1094
|
+
}, o = () => t, i = { setState: s, getState: o, getInitialState: () => l, subscribe: (g) => (n.add(g), () => n.delete(g)) }, l = t = e(s, o, i);
|
|
1095
1095
|
return i;
|
|
1096
|
-
},
|
|
1096
|
+
}, mn = (e) => e ? _t(e) : _t, ho = (e) => e;
|
|
1097
1097
|
function fo(e, t = ho) {
|
|
1098
|
-
const n =
|
|
1098
|
+
const n = et.useSyncExternalStore(
|
|
1099
1099
|
e.subscribe,
|
|
1100
|
-
|
|
1101
|
-
|
|
1100
|
+
et.useCallback(() => t(e.getState()), [e, t]),
|
|
1101
|
+
et.useCallback(() => t(e.getInitialState()), [e, t])
|
|
1102
1102
|
);
|
|
1103
|
-
return
|
|
1103
|
+
return et.useDebugValue(n), n;
|
|
1104
1104
|
}
|
|
1105
|
-
const
|
|
1106
|
-
const t =
|
|
1105
|
+
const Vt = (e) => {
|
|
1106
|
+
const t = mn(e), n = (s) => fo(t, s);
|
|
1107
1107
|
return Object.assign(n, t), n;
|
|
1108
|
-
}, j = (e) => e ?
|
|
1108
|
+
}, j = (e) => e ? Vt(e) : Vt, we = j((e) => ({
|
|
1109
1109
|
tool: null,
|
|
1110
1110
|
setTool(t) {
|
|
1111
1111
|
e({ tool: t });
|
|
@@ -1126,7 +1126,7 @@ const _t = (e) => {
|
|
|
1126
1126
|
return e({ redoStack: [] });
|
|
1127
1127
|
e({ redoStack: t });
|
|
1128
1128
|
}
|
|
1129
|
-
})), Qa = () =>
|
|
1129
|
+
})), Qa = () => we.getState(), Zt = [
|
|
1130
1130
|
"#C21460",
|
|
1131
1131
|
"#8601AF",
|
|
1132
1132
|
"#4424D6",
|
|
@@ -1140,11 +1140,11 @@ const _t = (e) => {
|
|
|
1140
1140
|
"#FC600A",
|
|
1141
1141
|
"#FE2712"
|
|
1142
1142
|
], We = j((e) => ({
|
|
1143
|
-
colorCode:
|
|
1143
|
+
colorCode: nn(Zt[Zt.length - 1], 1),
|
|
1144
1144
|
setColorCode(t) {
|
|
1145
1145
|
e({ colorCode: t });
|
|
1146
1146
|
}
|
|
1147
|
-
})),
|
|
1147
|
+
})), rt = j((e) => ({
|
|
1148
1148
|
opacity: 1,
|
|
1149
1149
|
setOpacity(t) {
|
|
1150
1150
|
e({ opacity: t });
|
|
@@ -1156,36 +1156,36 @@ const _t = (e) => {
|
|
|
1156
1156
|
{ id: 2, lineCap: "round", lineWidth: 5 },
|
|
1157
1157
|
{ id: 4, lineCap: "round", lineWidth: 10 },
|
|
1158
1158
|
{ id: 6, lineCap: "round", lineWidth: 20 }
|
|
1159
|
-
],
|
|
1159
|
+
], Lt = j((e) => ({
|
|
1160
1160
|
brush: mo[0],
|
|
1161
1161
|
setBrush(t) {
|
|
1162
1162
|
e({ brush: t });
|
|
1163
1163
|
}
|
|
1164
1164
|
}));
|
|
1165
|
-
var
|
|
1165
|
+
var Ut = (e, t, n) => (o, a) => ({
|
|
1166
1166
|
pastStates: (n == null ? void 0 : n.pastStates) || [],
|
|
1167
1167
|
futureStates: (n == null ? void 0 : n.futureStates) || [],
|
|
1168
|
-
undo: (
|
|
1168
|
+
undo: (r = 1) => {
|
|
1169
1169
|
var i, l;
|
|
1170
1170
|
if (a().pastStates.length) {
|
|
1171
|
-
const
|
|
1172
|
-
e(
|
|
1171
|
+
const g = ((i = n == null ? void 0 : n.partialize) == null ? void 0 : i.call(n, t())) || t(), d = a().pastStates.splice(-r, r), c = d.shift();
|
|
1172
|
+
e(c), o({
|
|
1173
1173
|
pastStates: a().pastStates,
|
|
1174
1174
|
futureStates: a().futureStates.concat(
|
|
1175
|
-
((l = n == null ? void 0 : n.diff) == null ? void 0 : l.call(n,
|
|
1176
|
-
|
|
1175
|
+
((l = n == null ? void 0 : n.diff) == null ? void 0 : l.call(n, g, c)) || g,
|
|
1176
|
+
d.reverse()
|
|
1177
1177
|
)
|
|
1178
1178
|
});
|
|
1179
1179
|
}
|
|
1180
1180
|
},
|
|
1181
|
-
redo: (
|
|
1181
|
+
redo: (r = 1) => {
|
|
1182
1182
|
var i, l;
|
|
1183
1183
|
if (a().futureStates.length) {
|
|
1184
|
-
const
|
|
1185
|
-
e(
|
|
1184
|
+
const g = ((i = n == null ? void 0 : n.partialize) == null ? void 0 : i.call(n, t())) || t(), d = a().futureStates.splice(-r, r), c = d.shift();
|
|
1185
|
+
e(c), o({
|
|
1186
1186
|
pastStates: a().pastStates.concat(
|
|
1187
|
-
((l = n == null ? void 0 : n.diff) == null ? void 0 : l.call(n,
|
|
1188
|
-
|
|
1187
|
+
((l = n == null ? void 0 : n.diff) == null ? void 0 : l.call(n, g, c)) || g,
|
|
1188
|
+
d.reverse()
|
|
1189
1189
|
),
|
|
1190
1190
|
futureStates: a().futureStates
|
|
1191
1191
|
});
|
|
@@ -1195,47 +1195,47 @@ var Zt = (e, t, n) => (o, a) => ({
|
|
|
1195
1195
|
isTracking: !0,
|
|
1196
1196
|
pause: () => o({ isTracking: !1 }),
|
|
1197
1197
|
resume: () => o({ isTracking: !0 }),
|
|
1198
|
-
setOnSave: (
|
|
1198
|
+
setOnSave: (r) => o({ _onSave: r }),
|
|
1199
1199
|
// Internal properties
|
|
1200
1200
|
_onSave: n == null ? void 0 : n.onSave,
|
|
1201
|
-
_handleSet: (
|
|
1202
|
-
var
|
|
1203
|
-
n != null && n.limit && a().pastStates.length >= (n == null ? void 0 : n.limit) && a().pastStates.shift(), (
|
|
1204
|
-
pastStates: a().pastStates.concat(
|
|
1201
|
+
_handleSet: (r, i, l, g) => {
|
|
1202
|
+
var d, c;
|
|
1203
|
+
n != null && n.limit && a().pastStates.length >= (n == null ? void 0 : n.limit) && a().pastStates.shift(), (c = (d = a())._onSave) == null || c.call(d, r, l), o({
|
|
1204
|
+
pastStates: a().pastStates.concat(g || r),
|
|
1205
1205
|
futureStates: []
|
|
1206
1206
|
});
|
|
1207
1207
|
}
|
|
1208
1208
|
}), go = (e, t) => (s, o, a) => {
|
|
1209
|
-
var
|
|
1210
|
-
a.temporal =
|
|
1211
|
-
((
|
|
1209
|
+
var g, d;
|
|
1210
|
+
a.temporal = mn(
|
|
1211
|
+
((g = t == null ? void 0 : t.wrapTemporal) == null ? void 0 : g.call(t, Ut(s, o, t))) || Ut(s, o, t)
|
|
1212
1212
|
);
|
|
1213
|
-
const
|
|
1213
|
+
const r = ((d = t == null ? void 0 : t.handleSet) == null ? void 0 : d.call(
|
|
1214
1214
|
t,
|
|
1215
1215
|
a.temporal.getState()._handleSet
|
|
1216
|
-
)) || a.temporal.getState()._handleSet, i = (
|
|
1217
|
-
var
|
|
1216
|
+
)) || a.temporal.getState()._handleSet, i = (c) => {
|
|
1217
|
+
var f, b, h;
|
|
1218
1218
|
if (!a.temporal.getState().isTracking) return;
|
|
1219
|
-
const m = ((
|
|
1219
|
+
const m = ((f = t == null ? void 0 : t.partialize) == null ? void 0 : f.call(t, o())) || o(), v = (b = t == null ? void 0 : t.diff) == null ? void 0 : b.call(t, c, m);
|
|
1220
1220
|
// If the user has provided a diff function but nothing has been changed, deltaState will be null
|
|
1221
1221
|
v === null || // If the user has provided an equality function, use it
|
|
1222
|
-
(
|
|
1223
|
-
|
|
1222
|
+
(h = t == null ? void 0 : t.equality) != null && h.call(t, c, m) || r(
|
|
1223
|
+
c,
|
|
1224
1224
|
void 0,
|
|
1225
1225
|
m,
|
|
1226
1226
|
v
|
|
1227
1227
|
);
|
|
1228
1228
|
}, l = a.setState;
|
|
1229
|
-
return a.setState = (...
|
|
1229
|
+
return a.setState = (...c) => {
|
|
1230
1230
|
var v;
|
|
1231
1231
|
const m = ((v = t == null ? void 0 : t.partialize) == null ? void 0 : v.call(t, o())) || o();
|
|
1232
|
-
l(...
|
|
1232
|
+
l(...c), i(m);
|
|
1233
1233
|
}, e(
|
|
1234
1234
|
// Modify the set function to call the userlandSet function
|
|
1235
|
-
(...
|
|
1235
|
+
(...c) => {
|
|
1236
1236
|
var v;
|
|
1237
1237
|
const m = ((v = t == null ? void 0 : t.partialize) == null ? void 0 : v.call(t, o())) || o();
|
|
1238
|
-
s(...
|
|
1238
|
+
s(...c), i(m);
|
|
1239
1239
|
},
|
|
1240
1240
|
o,
|
|
1241
1241
|
a
|
|
@@ -1253,24 +1253,24 @@ const ei = () => j()(
|
|
|
1253
1253
|
partialize: (e) => ({ snapshot: e.snapshot })
|
|
1254
1254
|
}
|
|
1255
1255
|
)
|
|
1256
|
-
),
|
|
1257
|
-
NORMAL: [
|
|
1258
|
-
ONLY_ORIGIN: [
|
|
1259
|
-
ONLY_OVERLAY: [
|
|
1260
|
-
},
|
|
1256
|
+
), Wt = 0, Yt = 1, le = {
|
|
1257
|
+
NORMAL: [Wt, Yt],
|
|
1258
|
+
ONLY_ORIGIN: [Wt],
|
|
1259
|
+
ONLY_OVERLAY: [Yt]
|
|
1260
|
+
}, ft = [
|
|
1261
1261
|
le.NORMAL,
|
|
1262
1262
|
le.ONLY_ORIGIN,
|
|
1263
1263
|
le.ONLY_OVERLAY
|
|
1264
|
-
],
|
|
1264
|
+
], Me = j((e, t) => ({
|
|
1265
1265
|
mode: le.NORMAL,
|
|
1266
1266
|
setMode: (n) => e({ mode: n }),
|
|
1267
1267
|
cycleMode: () => {
|
|
1268
|
-
const n = t().mode, s =
|
|
1269
|
-
(a) => a.length === n.length && a.every((
|
|
1270
|
-
), o = s >= 0 ?
|
|
1268
|
+
const n = t().mode, s = ft.findIndex(
|
|
1269
|
+
(a) => a.length === n.length && a.every((r, i) => r === n[i])
|
|
1270
|
+
), o = s >= 0 ? ft[(s + 1) % ft.length] : le.NORMAL;
|
|
1271
1271
|
e({ mode: o });
|
|
1272
1272
|
}
|
|
1273
|
-
})),
|
|
1273
|
+
})), lt = j((e) => ({
|
|
1274
1274
|
objects: [],
|
|
1275
1275
|
setObjects: (t) => e({ objects: t })
|
|
1276
1276
|
})), Ge = j((e) => ({
|
|
@@ -1284,7 +1284,7 @@ const ei = () => j()(
|
|
|
1284
1284
|
setMode(t) {
|
|
1285
1285
|
e({ mode: t });
|
|
1286
1286
|
}
|
|
1287
|
-
})), ti = () => qe.getState(),
|
|
1287
|
+
})), ti = () => qe.getState(), wt = j((e, t) => ({
|
|
1288
1288
|
tool: null,
|
|
1289
1289
|
setTool(n) {
|
|
1290
1290
|
const s = t().tool, o = s ? [s.id, ...t().toolHistory.slice(0, 4)] : t().toolHistory;
|
|
@@ -1307,12 +1307,12 @@ const ei = () => j()(
|
|
|
1307
1307
|
e({ redoStack: n });
|
|
1308
1308
|
},
|
|
1309
1309
|
toolHistory: []
|
|
1310
|
-
})), ni = () =>
|
|
1310
|
+
})), ni = () => wt.getState(), zt = j((e) => ({
|
|
1311
1311
|
tool: null,
|
|
1312
1312
|
setTool(t) {
|
|
1313
1313
|
e({ tool: t });
|
|
1314
1314
|
}
|
|
1315
|
-
})),
|
|
1315
|
+
})), Ft = j((e) => ({
|
|
1316
1316
|
tool: null,
|
|
1317
1317
|
setTool(t) {
|
|
1318
1318
|
e({ tool: t });
|
|
@@ -1333,7 +1333,7 @@ const ei = () => j()(
|
|
|
1333
1333
|
reset() {
|
|
1334
1334
|
e({ english: !1, number: !1, special: !1 });
|
|
1335
1335
|
}
|
|
1336
|
-
})),
|
|
1336
|
+
})), Et = j((e, t) => ({
|
|
1337
1337
|
isValidationMode: !1,
|
|
1338
1338
|
setValidationMode(n) {
|
|
1339
1339
|
e({ isValidationMode: n });
|
|
@@ -1408,17 +1408,17 @@ const ei = () => j()(
|
|
|
1408
1408
|
reset() {
|
|
1409
1409
|
e({ hiddenClassificationIds: {} });
|
|
1410
1410
|
}
|
|
1411
|
-
})),
|
|
1411
|
+
})), gn = j((e) => ({
|
|
1412
1412
|
objects: [],
|
|
1413
1413
|
setObjects(t) {
|
|
1414
1414
|
e({ objects: t });
|
|
1415
1415
|
}
|
|
1416
|
-
})),
|
|
1416
|
+
})), vn = j((e) => ({
|
|
1417
1417
|
selectedSegment: null,
|
|
1418
1418
|
setSelectedSegment(t) {
|
|
1419
1419
|
e({ selectedSegment: t });
|
|
1420
1420
|
}
|
|
1421
|
-
})),
|
|
1421
|
+
})), Cn = j((e) => ({
|
|
1422
1422
|
selectedSegment: null,
|
|
1423
1423
|
setSelectedSegment(t) {
|
|
1424
1424
|
e({ selectedSegment: t });
|
|
@@ -1446,9 +1446,9 @@ const ei = () => j()(
|
|
|
1446
1446
|
toggleActive() {
|
|
1447
1447
|
e({ active: !t().active });
|
|
1448
1448
|
}
|
|
1449
|
-
})),
|
|
1449
|
+
})), pn = xn(null);
|
|
1450
1450
|
function po() {
|
|
1451
|
-
const e = Ln(
|
|
1451
|
+
const e = Ln(pn);
|
|
1452
1452
|
if (!e)
|
|
1453
1453
|
throw new Error("useLabelingContext must be used within a LabelingProvider");
|
|
1454
1454
|
return e;
|
|
@@ -1460,29 +1460,29 @@ function bo({
|
|
|
1460
1460
|
viewMode: s,
|
|
1461
1461
|
onViewModeChange: o,
|
|
1462
1462
|
availableViewModes: a = ["Image"],
|
|
1463
|
-
textContent:
|
|
1463
|
+
textContent: r,
|
|
1464
1464
|
numberContent: i,
|
|
1465
1465
|
fileContent: l,
|
|
1466
|
-
records:
|
|
1467
|
-
activeRecordId:
|
|
1468
|
-
onRecordSelect:
|
|
1466
|
+
records: g,
|
|
1467
|
+
activeRecordId: d,
|
|
1468
|
+
onRecordSelect: c,
|
|
1469
1469
|
classes: m,
|
|
1470
1470
|
policies: v = [],
|
|
1471
|
-
onClassSelect:
|
|
1471
|
+
onClassSelect: f,
|
|
1472
1472
|
onSave: b,
|
|
1473
|
-
onSaveToRecord:
|
|
1473
|
+
onSaveToRecord: h,
|
|
1474
1474
|
onFileUpload: p,
|
|
1475
1475
|
isSaving: N = !1,
|
|
1476
1476
|
onNavigateLeft: Z,
|
|
1477
1477
|
onNavigateRight: V,
|
|
1478
|
-
canNavigateLeft:
|
|
1478
|
+
canNavigateLeft: A = !1,
|
|
1479
1479
|
canNavigateRight: k = !1,
|
|
1480
1480
|
mode: H = "labeling",
|
|
1481
1481
|
onModeChange: w,
|
|
1482
1482
|
validationResults: C = [],
|
|
1483
1483
|
indicator: E,
|
|
1484
1484
|
extensions: _ = [],
|
|
1485
|
-
tools:
|
|
1485
|
+
tools: D = ["selection", "blankRect", "polygon", "brush", "eraser"],
|
|
1486
1486
|
theme: O,
|
|
1487
1487
|
layout: y = {},
|
|
1488
1488
|
children: B
|
|
@@ -1494,11 +1494,11 @@ function bo({
|
|
|
1494
1494
|
ce(() => {
|
|
1495
1495
|
s && z(s);
|
|
1496
1496
|
}, [s, z]);
|
|
1497
|
-
const
|
|
1497
|
+
const Ie = Et((W) => W.setValidationMode);
|
|
1498
1498
|
ce(() => {
|
|
1499
|
-
|
|
1500
|
-
}, [H,
|
|
1501
|
-
const
|
|
1499
|
+
Ie(H === "validation");
|
|
1500
|
+
}, [H, Ie]);
|
|
1501
|
+
const Pe = ve(
|
|
1502
1502
|
() => ({
|
|
1503
1503
|
image: e,
|
|
1504
1504
|
annotations: t,
|
|
@@ -1506,33 +1506,33 @@ function bo({
|
|
|
1506
1506
|
viewMode: se,
|
|
1507
1507
|
onViewModeChange: de,
|
|
1508
1508
|
availableViewModes: a,
|
|
1509
|
-
textContent:
|
|
1509
|
+
textContent: r,
|
|
1510
1510
|
numberContent: i,
|
|
1511
1511
|
fileContent: l,
|
|
1512
|
-
records:
|
|
1513
|
-
activeRecordId:
|
|
1514
|
-
onRecordSelect:
|
|
1512
|
+
records: g,
|
|
1513
|
+
activeRecordId: d,
|
|
1514
|
+
onRecordSelect: c,
|
|
1515
1515
|
classes: m,
|
|
1516
1516
|
policies: v,
|
|
1517
|
-
onClassSelect:
|
|
1517
|
+
onClassSelect: f,
|
|
1518
1518
|
selectedClassId: R,
|
|
1519
1519
|
setSelectedClassId: x,
|
|
1520
1520
|
selectedAnnotationId: P,
|
|
1521
1521
|
setSelectedAnnotationId: T,
|
|
1522
1522
|
onSave: b,
|
|
1523
|
-
onSaveToRecord:
|
|
1523
|
+
onSaveToRecord: h,
|
|
1524
1524
|
onFileUpload: p,
|
|
1525
1525
|
isSaving: N,
|
|
1526
1526
|
onNavigateLeft: Z,
|
|
1527
1527
|
onNavigateRight: V,
|
|
1528
|
-
canNavigateLeft:
|
|
1528
|
+
canNavigateLeft: A,
|
|
1529
1529
|
canNavigateRight: k,
|
|
1530
1530
|
mode: H,
|
|
1531
1531
|
onModeChange: w,
|
|
1532
1532
|
validationResults: C,
|
|
1533
1533
|
indicator: E,
|
|
1534
1534
|
extensions: _,
|
|
1535
|
-
tools:
|
|
1535
|
+
tools: D,
|
|
1536
1536
|
theme: O,
|
|
1537
1537
|
layout: y,
|
|
1538
1538
|
navDirection: L,
|
|
@@ -1547,31 +1547,31 @@ function bo({
|
|
|
1547
1547
|
se,
|
|
1548
1548
|
de,
|
|
1549
1549
|
a,
|
|
1550
|
-
|
|
1550
|
+
r,
|
|
1551
1551
|
i,
|
|
1552
1552
|
l,
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1553
|
+
g,
|
|
1554
|
+
d,
|
|
1555
|
+
c,
|
|
1556
1556
|
m,
|
|
1557
1557
|
v,
|
|
1558
|
-
|
|
1558
|
+
f,
|
|
1559
1559
|
R,
|
|
1560
1560
|
P,
|
|
1561
1561
|
b,
|
|
1562
|
-
|
|
1562
|
+
h,
|
|
1563
1563
|
p,
|
|
1564
1564
|
N,
|
|
1565
1565
|
Z,
|
|
1566
1566
|
V,
|
|
1567
|
-
|
|
1567
|
+
A,
|
|
1568
1568
|
k,
|
|
1569
1569
|
H,
|
|
1570
1570
|
w,
|
|
1571
1571
|
C,
|
|
1572
1572
|
E,
|
|
1573
1573
|
_,
|
|
1574
|
-
|
|
1574
|
+
D,
|
|
1575
1575
|
O,
|
|
1576
1576
|
y,
|
|
1577
1577
|
L,
|
|
@@ -1582,7 +1582,7 @@ function bo({
|
|
|
1582
1582
|
const W = {};
|
|
1583
1583
|
return O.primary && (W["--lc-primary"] = O.primary), O.background && (W["--lc-background"] = O.background), O.surface && (W["--lc-surface"] = O.surface), O.border && (W["--lc-border"] = O.border), O.text && (W["--lc-text"] = O.text), O.textSecondary && (W["--lc-text-secondary"] = O.textSecondary), O.hover && (W["--lc-hover"] = O.hover), O.fontFamily && (W["--lc-font-family"] = O.fontFamily), Object.keys(W).length > 0 ? W : void 0;
|
|
1584
1584
|
}, [O]);
|
|
1585
|
-
return /* @__PURE__ */
|
|
1585
|
+
return /* @__PURE__ */ u(pn.Provider, { value: Pe, children: /* @__PURE__ */ u("div", { style: { width: "100%", height: "100%", overflow: "hidden", ...ue }, children: B }) });
|
|
1586
1586
|
}
|
|
1587
1587
|
const yo = [
|
|
1588
1588
|
// ─── Labeling Tools ───
|
|
@@ -1786,7 +1786,7 @@ function fe({
|
|
|
1786
1786
|
const o = xo(e);
|
|
1787
1787
|
if (!o) return null;
|
|
1788
1788
|
const a = Lo[t];
|
|
1789
|
-
return /* @__PURE__ */
|
|
1789
|
+
return /* @__PURE__ */ u(
|
|
1790
1790
|
"svg",
|
|
1791
1791
|
{
|
|
1792
1792
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1798,11 +1798,11 @@ function fe({
|
|
|
1798
1798
|
clipRule: "evenodd",
|
|
1799
1799
|
className: n,
|
|
1800
1800
|
style: s,
|
|
1801
|
-
children: o.d.map((
|
|
1801
|
+
children: o.d.map((r, i) => /* @__PURE__ */ u("path", { d: r }, i))
|
|
1802
1802
|
}
|
|
1803
1803
|
);
|
|
1804
1804
|
}
|
|
1805
|
-
const wo = "lc-controlBar-UEkkK", So = "lc-controlLeft-DLKH7", Mo = "lc-controlRight-1O3y-", Io = "lc-viewModeTabs-NTBV-", No = "lc-viewModeTab-SeV73", ko = "lc-metaInfo-a6MkE", Oo = "lc-metaItem-7MLAS", Po = "lc-metaDivider-3k0-r", To = "lc-colorPreview-UXizA", Bo = "lc-zoomControls-nRIFJ", Eo = "lc-zoomBtn-RQj5N", Ro = "lc-zoomInput-CGM7z",
|
|
1805
|
+
const wo = "lc-controlBar-UEkkK", So = "lc-controlLeft-DLKH7", Mo = "lc-controlRight-1O3y-", Io = "lc-viewModeTabs-NTBV-", No = "lc-viewModeTab-SeV73", ko = "lc-metaInfo-a6MkE", Oo = "lc-metaItem-7MLAS", Po = "lc-metaDivider-3k0-r", To = "lc-colorPreview-UXizA", Bo = "lc-zoomControls-nRIFJ", Eo = "lc-zoomBtn-RQj5N", Ro = "lc-zoomInput-CGM7z", Ao = "lc-controlBtn-5D7WV", Do = "lc-controlBtnPrimary-BhTmF lc-controlBtn-5D7WV", Ho = "lc-controlBtnGroup-Q3Yxp", _o = "lc-saveDropdownWrapper-zrTMb", Vo = "lc-saveDropdown-d9tVH", Zo = "lc-saveDropdownItem-Uo97r", Uo = "lc-toggleBtn-OwP-- lc-controlBtn-5D7WV", U = {
|
|
1806
1806
|
controlBar: wo,
|
|
1807
1807
|
controlLeft: So,
|
|
1808
1808
|
controlRight: Mo,
|
|
@@ -1815,8 +1815,8 @@ const wo = "lc-controlBar-UEkkK", So = "lc-controlLeft-DLKH7", Mo = "lc-controlR
|
|
|
1815
1815
|
zoomControls: Bo,
|
|
1816
1816
|
zoomBtn: Eo,
|
|
1817
1817
|
zoomInput: Ro,
|
|
1818
|
-
controlBtn:
|
|
1819
|
-
controlBtnPrimary:
|
|
1818
|
+
controlBtn: Ao,
|
|
1819
|
+
controlBtnPrimary: Do,
|
|
1820
1820
|
controlBtnGroup: Ho,
|
|
1821
1821
|
saveDropdownWrapper: _o,
|
|
1822
1822
|
saveDropdown: Vo,
|
|
@@ -1841,16 +1841,16 @@ function Yo({
|
|
|
1841
1841
|
mode: s = "labeling",
|
|
1842
1842
|
onModeChange: o,
|
|
1843
1843
|
onSave: a,
|
|
1844
|
-
onSaveToRecord:
|
|
1844
|
+
onSaveToRecord: r,
|
|
1845
1845
|
isSaving: i = !1,
|
|
1846
1846
|
onNavigateLeft: l,
|
|
1847
|
-
onNavigateRight:
|
|
1848
|
-
canNavigateLeft:
|
|
1849
|
-
canNavigateRight:
|
|
1847
|
+
onNavigateRight: g,
|
|
1848
|
+
canNavigateLeft: d = !1,
|
|
1849
|
+
canNavigateRight: c = !1
|
|
1850
1850
|
}) {
|
|
1851
1851
|
return /* @__PURE__ */ S("div", { className: U.controlBar, children: [
|
|
1852
1852
|
/* @__PURE__ */ S("div", { className: U.controlLeft, children: [
|
|
1853
|
-
n.length > 1 && /* @__PURE__ */
|
|
1853
|
+
n.length > 1 && /* @__PURE__ */ u(
|
|
1854
1854
|
zo,
|
|
1855
1855
|
{
|
|
1856
1856
|
viewMode: e,
|
|
@@ -1858,41 +1858,41 @@ function Yo({
|
|
|
1858
1858
|
onViewModeChange: t
|
|
1859
1859
|
}
|
|
1860
1860
|
),
|
|
1861
|
-
/* @__PURE__ */
|
|
1861
|
+
/* @__PURE__ */ u(Fo, { viewMode: e })
|
|
1862
1862
|
] }),
|
|
1863
1863
|
/* @__PURE__ */ S("div", { className: U.controlRight, children: [
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
(l ||
|
|
1866
|
-
/* @__PURE__ */
|
|
1864
|
+
/* @__PURE__ */ u($o, {}),
|
|
1865
|
+
(l || g) && /* @__PURE__ */ S("div", { className: U.controlBtnGroup, children: [
|
|
1866
|
+
/* @__PURE__ */ u(
|
|
1867
1867
|
"button",
|
|
1868
1868
|
{
|
|
1869
1869
|
className: U.controlBtn,
|
|
1870
|
-
disabled: !
|
|
1870
|
+
disabled: !d,
|
|
1871
1871
|
onClick: l,
|
|
1872
1872
|
title: "Previous",
|
|
1873
|
-
children: /* @__PURE__ */
|
|
1873
|
+
children: /* @__PURE__ */ u(fe, { iconType: "icon-left", size: "xs" })
|
|
1874
1874
|
}
|
|
1875
1875
|
),
|
|
1876
|
-
/* @__PURE__ */
|
|
1876
|
+
/* @__PURE__ */ u(
|
|
1877
1877
|
"button",
|
|
1878
1878
|
{
|
|
1879
1879
|
className: U.controlBtn,
|
|
1880
|
-
disabled: !
|
|
1881
|
-
onClick:
|
|
1880
|
+
disabled: !c,
|
|
1881
|
+
onClick: g,
|
|
1882
1882
|
title: "Next",
|
|
1883
|
-
children: /* @__PURE__ */
|
|
1883
|
+
children: /* @__PURE__ */ u(fe, { iconType: "icon-right", size: "xs" })
|
|
1884
1884
|
}
|
|
1885
1885
|
)
|
|
1886
1886
|
] }),
|
|
1887
|
-
a && /* @__PURE__ */
|
|
1887
|
+
a && /* @__PURE__ */ u(
|
|
1888
1888
|
Go,
|
|
1889
1889
|
{
|
|
1890
1890
|
onSave: a,
|
|
1891
|
-
onSaveToRecord:
|
|
1891
|
+
onSaveToRecord: r,
|
|
1892
1892
|
isSaving: i
|
|
1893
1893
|
}
|
|
1894
1894
|
),
|
|
1895
|
-
o && /* @__PURE__ */
|
|
1895
|
+
o && /* @__PURE__ */ u(
|
|
1896
1896
|
"button",
|
|
1897
1897
|
{
|
|
1898
1898
|
className: U.toggleBtn,
|
|
@@ -1901,7 +1901,7 @@ function Yo({
|
|
|
1901
1901
|
children: "Valid"
|
|
1902
1902
|
}
|
|
1903
1903
|
),
|
|
1904
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ u(qo, {})
|
|
1905
1905
|
] })
|
|
1906
1906
|
] });
|
|
1907
1907
|
}
|
|
@@ -1910,7 +1910,7 @@ function zo({
|
|
|
1910
1910
|
availableViewModes: t,
|
|
1911
1911
|
onViewModeChange: n
|
|
1912
1912
|
}) {
|
|
1913
|
-
return /* @__PURE__ */
|
|
1913
|
+
return /* @__PURE__ */ u("div", { className: U.viewModeTabs, children: t.map((s) => /* @__PURE__ */ u(
|
|
1914
1914
|
"button",
|
|
1915
1915
|
{
|
|
1916
1916
|
className: U.viewModeTab,
|
|
@@ -1922,18 +1922,18 @@ function zo({
|
|
|
1922
1922
|
)) });
|
|
1923
1923
|
}
|
|
1924
1924
|
function Fo({ viewMode: e }) {
|
|
1925
|
-
const t =
|
|
1925
|
+
const t = we((l) => l.tool), n = gn((l) => l.objects), s = vn((l) => l.selectedSegment), o = Cn((l) => l.selectedSegment), a = We((l) => l.colorCode), r = rt((l) => l.opacity), i = t ? Wo[t.id] ?? t.id : "—";
|
|
1926
1926
|
return e === "Record" || e === "File" ? null : /* @__PURE__ */ S("div", { className: U.metaInfo, children: [
|
|
1927
|
-
/* @__PURE__ */
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
e === "Image" && /* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ u("div", { className: U.metaItem, children: /* @__PURE__ */ u("em", { children: i }) }),
|
|
1928
|
+
/* @__PURE__ */ u("div", { className: U.metaDivider }),
|
|
1929
|
+
e === "Image" && /* @__PURE__ */ u(Xo, { objects: n }),
|
|
1930
1930
|
e === "Text" && s && /* @__PURE__ */ S("div", { className: U.metaItem, children: [
|
|
1931
1931
|
"Characters: ",
|
|
1932
|
-
/* @__PURE__ */
|
|
1932
|
+
/* @__PURE__ */ u("em", { children: s.end - s.start })
|
|
1933
1933
|
] }),
|
|
1934
1934
|
e === "Number" && o && /* @__PURE__ */ S("div", { className: U.metaItem, children: [
|
|
1935
1935
|
"Points: ",
|
|
1936
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ u("em", { children: o.end - o.start + 1 }),
|
|
1937
1937
|
" ",
|
|
1938
1938
|
"Index: ",
|
|
1939
1939
|
/* @__PURE__ */ S("em", { children: [
|
|
@@ -1942,18 +1942,18 @@ function Fo({ viewMode: e }) {
|
|
|
1942
1942
|
o.end + 1
|
|
1943
1943
|
] })
|
|
1944
1944
|
] }),
|
|
1945
|
-
/* @__PURE__ */
|
|
1945
|
+
/* @__PURE__ */ u("div", { className: U.metaDivider }),
|
|
1946
1946
|
/* @__PURE__ */ S("div", { className: U.metaItem, children: [
|
|
1947
|
-
/* @__PURE__ */
|
|
1947
|
+
/* @__PURE__ */ u(
|
|
1948
1948
|
"span",
|
|
1949
1949
|
{
|
|
1950
1950
|
className: U.colorPreview,
|
|
1951
1951
|
style: { background: a }
|
|
1952
1952
|
}
|
|
1953
1953
|
),
|
|
1954
|
-
/* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ u("em", { children: a }),
|
|
1955
1955
|
/* @__PURE__ */ S("span", { children: [
|
|
1956
|
-
Math.round(
|
|
1956
|
+
Math.round(r * 100),
|
|
1957
1957
|
"%"
|
|
1958
1958
|
] })
|
|
1959
1959
|
] })
|
|
@@ -1963,24 +1963,24 @@ function Xo({ objects: e }) {
|
|
|
1963
1963
|
if (!e.length)
|
|
1964
1964
|
return /* @__PURE__ */ S("div", { className: U.metaItem, children: [
|
|
1965
1965
|
"X: ",
|
|
1966
|
-
/* @__PURE__ */
|
|
1966
|
+
/* @__PURE__ */ u("em", { children: "—" }),
|
|
1967
1967
|
" Y: ",
|
|
1968
|
-
/* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ u("em", { children: "—" }),
|
|
1969
1969
|
" W: ",
|
|
1970
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ u("em", { children: "—" }),
|
|
1971
1971
|
" H: ",
|
|
1972
|
-
/* @__PURE__ */
|
|
1972
|
+
/* @__PURE__ */ u("em", { children: "—" })
|
|
1973
1973
|
] });
|
|
1974
1974
|
const t = e[0], n = Math.round(t.left ?? 0), s = Math.round(t.top ?? 0), o = Math.round((t.width ?? 0) * (t.scaleX ?? 1)), a = Math.round((t.height ?? 0) * (t.scaleY ?? 1));
|
|
1975
1975
|
return /* @__PURE__ */ S("div", { className: U.metaItem, children: [
|
|
1976
1976
|
"X: ",
|
|
1977
|
-
/* @__PURE__ */
|
|
1977
|
+
/* @__PURE__ */ u("em", { children: n }),
|
|
1978
1978
|
" Y: ",
|
|
1979
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ u("em", { children: s }),
|
|
1980
1980
|
" W: ",
|
|
1981
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ u("em", { children: o }),
|
|
1982
1982
|
" H: ",
|
|
1983
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ u("em", { children: a })
|
|
1984
1984
|
] });
|
|
1985
1985
|
}
|
|
1986
1986
|
function $o() {
|
|
@@ -1989,8 +1989,8 @@ function $o() {
|
|
|
1989
1989
|
n(`${s}%`);
|
|
1990
1990
|
}, [s]);
|
|
1991
1991
|
const o = $(
|
|
1992
|
-
(
|
|
1993
|
-
const i = Math.max(0.1, Math.min(5,
|
|
1992
|
+
(r) => {
|
|
1993
|
+
const i = Math.max(0.1, Math.min(5, r));
|
|
1994
1994
|
e.setZoom({
|
|
1995
1995
|
level: i,
|
|
1996
1996
|
width: e.width,
|
|
@@ -1998,39 +1998,39 @@ function $o() {
|
|
|
1998
1998
|
});
|
|
1999
1999
|
},
|
|
2000
2000
|
[e]
|
|
2001
|
-
), a = (
|
|
2002
|
-
if (
|
|
2001
|
+
), a = (r) => {
|
|
2002
|
+
if (r.key === "Enter") {
|
|
2003
2003
|
const i = parseInt(t, 10);
|
|
2004
|
-
isNaN(i) || o(i / 100),
|
|
2004
|
+
isNaN(i) || o(i / 100), r.target.blur();
|
|
2005
2005
|
}
|
|
2006
2006
|
};
|
|
2007
2007
|
return /* @__PURE__ */ S("div", { className: U.zoomControls, children: [
|
|
2008
|
-
/* @__PURE__ */
|
|
2008
|
+
/* @__PURE__ */ u(
|
|
2009
2009
|
"button",
|
|
2010
2010
|
{
|
|
2011
2011
|
className: U.zoomBtn,
|
|
2012
2012
|
onClick: () => o(e.level / 1.1),
|
|
2013
2013
|
title: "Zoom Out",
|
|
2014
|
-
children: /* @__PURE__ */
|
|
2014
|
+
children: /* @__PURE__ */ u(fe, { iconType: "icon-minus", size: "xs" })
|
|
2015
2015
|
}
|
|
2016
2016
|
),
|
|
2017
|
-
/* @__PURE__ */
|
|
2017
|
+
/* @__PURE__ */ u(
|
|
2018
2018
|
"input",
|
|
2019
2019
|
{
|
|
2020
2020
|
className: U.zoomInput,
|
|
2021
2021
|
value: t,
|
|
2022
|
-
onChange: (
|
|
2022
|
+
onChange: (r) => n(r.target.value),
|
|
2023
2023
|
onKeyDown: a,
|
|
2024
2024
|
onBlur: () => n(`${s}%`)
|
|
2025
2025
|
}
|
|
2026
2026
|
),
|
|
2027
|
-
/* @__PURE__ */
|
|
2027
|
+
/* @__PURE__ */ u(
|
|
2028
2028
|
"button",
|
|
2029
2029
|
{
|
|
2030
2030
|
className: U.zoomBtn,
|
|
2031
2031
|
onClick: () => o(e.level * 1.1),
|
|
2032
2032
|
title: "Zoom In",
|
|
2033
|
-
children: /* @__PURE__ */
|
|
2033
|
+
children: /* @__PURE__ */ u(fe, { iconType: "icon-plus", size: "xs" })
|
|
2034
2034
|
}
|
|
2035
2035
|
)
|
|
2036
2036
|
] });
|
|
@@ -2043,10 +2043,10 @@ function Go({
|
|
|
2043
2043
|
const [s, o] = re(!1), a = Ce(null);
|
|
2044
2044
|
return ce(() => {
|
|
2045
2045
|
if (!s) return;
|
|
2046
|
-
const
|
|
2046
|
+
const r = (i) => {
|
|
2047
2047
|
a.current && !a.current.contains(i.target) && o(!1);
|
|
2048
2048
|
};
|
|
2049
|
-
return window.addEventListener("mousedown",
|
|
2049
|
+
return window.addEventListener("mousedown", r), () => window.removeEventListener("mousedown", r);
|
|
2050
2050
|
}, [s]), t ? /* @__PURE__ */ S("div", { className: U.saveDropdownWrapper, ref: a, children: [
|
|
2051
2051
|
/* @__PURE__ */ S("div", { className: U.controlBtnGroup, children: [
|
|
2052
2052
|
/* @__PURE__ */ S(
|
|
@@ -2056,23 +2056,23 @@ function Go({
|
|
|
2056
2056
|
disabled: n,
|
|
2057
2057
|
onClick: e,
|
|
2058
2058
|
children: [
|
|
2059
|
-
/* @__PURE__ */
|
|
2059
|
+
/* @__PURE__ */ u(fe, { iconType: "icon-save", size: "xs" }),
|
|
2060
2060
|
n ? "Saving…" : "Save"
|
|
2061
2061
|
]
|
|
2062
2062
|
}
|
|
2063
2063
|
),
|
|
2064
|
-
/* @__PURE__ */
|
|
2064
|
+
/* @__PURE__ */ u(
|
|
2065
2065
|
"button",
|
|
2066
2066
|
{
|
|
2067
2067
|
className: U.controlBtnPrimary,
|
|
2068
|
-
onClick: () => o((
|
|
2068
|
+
onClick: () => o((r) => !r),
|
|
2069
2069
|
disabled: n,
|
|
2070
|
-
children: /* @__PURE__ */
|
|
2070
|
+
children: /* @__PURE__ */ u(fe, { iconType: "icon-down", size: "xxs" })
|
|
2071
2071
|
}
|
|
2072
2072
|
)
|
|
2073
2073
|
] }),
|
|
2074
2074
|
s && /* @__PURE__ */ S("div", { className: U.saveDropdown, children: [
|
|
2075
|
-
/* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ u(
|
|
2076
2076
|
"button",
|
|
2077
2077
|
{
|
|
2078
2078
|
className: U.saveDropdownItem,
|
|
@@ -2082,7 +2082,7 @@ function Go({
|
|
|
2082
2082
|
children: "Save"
|
|
2083
2083
|
}
|
|
2084
2084
|
),
|
|
2085
|
-
/* @__PURE__ */
|
|
2085
|
+
/* @__PURE__ */ u(
|
|
2086
2086
|
"button",
|
|
2087
2087
|
{
|
|
2088
2088
|
className: U.saveDropdownItem,
|
|
@@ -2100,7 +2100,7 @@ function Go({
|
|
|
2100
2100
|
disabled: n,
|
|
2101
2101
|
onClick: e,
|
|
2102
2102
|
children: [
|
|
2103
|
-
/* @__PURE__ */
|
|
2103
|
+
/* @__PURE__ */ u(fe, { iconType: "icon-save", size: "xs" }),
|
|
2104
2104
|
n ? "Saving…" : "Save"
|
|
2105
2105
|
]
|
|
2106
2106
|
}
|
|
@@ -2108,14 +2108,14 @@ function Go({
|
|
|
2108
2108
|
}
|
|
2109
2109
|
function qo() {
|
|
2110
2110
|
const e = St((n) => n.isOpen), t = St((n) => n.toggle);
|
|
2111
|
-
return /* @__PURE__ */
|
|
2111
|
+
return /* @__PURE__ */ u(
|
|
2112
2112
|
"button",
|
|
2113
2113
|
{
|
|
2114
2114
|
className: U.toggleBtn,
|
|
2115
2115
|
"data-active": e || void 0,
|
|
2116
2116
|
onClick: t,
|
|
2117
2117
|
title: "Issues",
|
|
2118
|
-
children: /* @__PURE__ */
|
|
2118
|
+
children: /* @__PURE__ */ u(fe, { iconType: "icon-issue", size: "sm" })
|
|
2119
2119
|
}
|
|
2120
2120
|
);
|
|
2121
2121
|
}
|
|
@@ -2129,36 +2129,36 @@ function Ko(e, t, n = !1) {
|
|
|
2129
2129
|
}
|
|
2130
2130
|
const i = a.current;
|
|
2131
2131
|
let l = !1;
|
|
2132
|
-
const
|
|
2133
|
-
let
|
|
2132
|
+
const g = async () => {
|
|
2133
|
+
let d;
|
|
2134
2134
|
switch (e.id) {
|
|
2135
2135
|
case "selection":
|
|
2136
|
-
|
|
2136
|
+
d = await e.init();
|
|
2137
2137
|
break;
|
|
2138
2138
|
case "brush":
|
|
2139
|
-
|
|
2139
|
+
d = await e.init({
|
|
2140
2140
|
brush: i.brush,
|
|
2141
2141
|
colorCode: i.colorCode
|
|
2142
2142
|
});
|
|
2143
2143
|
break;
|
|
2144
2144
|
case "bounded-box":
|
|
2145
2145
|
case "filled-box":
|
|
2146
|
-
|
|
2146
|
+
d = await e.init({
|
|
2147
2147
|
colorCode: i.colorCode
|
|
2148
2148
|
});
|
|
2149
2149
|
break;
|
|
2150
2150
|
case "pen":
|
|
2151
|
-
|
|
2151
|
+
d = await e.init({
|
|
2152
2152
|
colorCode: i.colorCode
|
|
2153
2153
|
});
|
|
2154
2154
|
break;
|
|
2155
2155
|
case "eraser":
|
|
2156
|
-
|
|
2156
|
+
d = await e.init({
|
|
2157
2157
|
brush: i.brush
|
|
2158
2158
|
});
|
|
2159
2159
|
break;
|
|
2160
2160
|
case "magic-brush":
|
|
2161
|
-
|
|
2161
|
+
d = await e.init({
|
|
2162
2162
|
src: i.imageUrl ?? "",
|
|
2163
2163
|
colorCode: i.colorCode,
|
|
2164
2164
|
brush: i.brush,
|
|
@@ -2169,7 +2169,7 @@ function Ko(e, t, n = !1) {
|
|
|
2169
2169
|
});
|
|
2170
2170
|
break;
|
|
2171
2171
|
case "superpixel":
|
|
2172
|
-
|
|
2172
|
+
d = await e.init({
|
|
2173
2173
|
src: i.imageUrl ?? "",
|
|
2174
2174
|
colorCode: i.colorCode,
|
|
2175
2175
|
superpixelConfig: i.superpixelConfig ?? {},
|
|
@@ -2177,17 +2177,17 @@ function Ko(e, t, n = !1) {
|
|
|
2177
2177
|
});
|
|
2178
2178
|
break;
|
|
2179
2179
|
case "seg-anything":
|
|
2180
|
-
|
|
2180
|
+
d = await e.init({
|
|
2181
2181
|
callback: i.segAnythingCallback
|
|
2182
2182
|
});
|
|
2183
2183
|
break;
|
|
2184
2184
|
default:
|
|
2185
|
-
|
|
2185
|
+
d = await e.init(i);
|
|
2186
2186
|
break;
|
|
2187
2187
|
}
|
|
2188
|
-
!l && typeof
|
|
2188
|
+
!l && typeof d == "function" && (s.current = d);
|
|
2189
2189
|
};
|
|
2190
|
-
return o.current = e.id,
|
|
2190
|
+
return o.current = e.id, g(), () => {
|
|
2191
2191
|
l = !0, s.current && (s.current(), s.current = null);
|
|
2192
2192
|
};
|
|
2193
2193
|
}, [e, n]), { activeToolId: o.current };
|
|
@@ -2240,39 +2240,39 @@ function Qo({
|
|
|
2240
2240
|
onRedo: o,
|
|
2241
2241
|
disabled: a = !1
|
|
2242
2242
|
}) {
|
|
2243
|
-
const
|
|
2243
|
+
const r = Me((g) => g.cycleMode), i = Co((g) => g.toggleActive), l = Ge();
|
|
2244
2244
|
ce(() => {
|
|
2245
2245
|
if (a) return;
|
|
2246
|
-
const
|
|
2247
|
-
if (jo(
|
|
2248
|
-
const
|
|
2249
|
-
if (
|
|
2250
|
-
if (
|
|
2251
|
-
|
|
2246
|
+
const g = (d) => {
|
|
2247
|
+
if (jo(d)) return;
|
|
2248
|
+
const c = Jo(d);
|
|
2249
|
+
if (d.ctrlKey || d.metaKey) {
|
|
2250
|
+
if (c === "z" && !d.shiftKey) {
|
|
2251
|
+
d.preventDefault(), s == null || s();
|
|
2252
2252
|
return;
|
|
2253
2253
|
}
|
|
2254
|
-
if (
|
|
2255
|
-
|
|
2254
|
+
if (c === "z" && d.shiftKey || c === "y") {
|
|
2255
|
+
d.preventDefault(), o == null || o();
|
|
2256
2256
|
return;
|
|
2257
2257
|
}
|
|
2258
|
-
if (
|
|
2259
|
-
|
|
2258
|
+
if (c === "=" || c === "+") {
|
|
2259
|
+
d.preventDefault(), l.setZoom({
|
|
2260
2260
|
level: Math.min(l.level * 1.1, 5),
|
|
2261
2261
|
width: l.width,
|
|
2262
2262
|
height: l.height
|
|
2263
2263
|
});
|
|
2264
2264
|
return;
|
|
2265
2265
|
}
|
|
2266
|
-
if (
|
|
2267
|
-
|
|
2266
|
+
if (c === "-") {
|
|
2267
|
+
d.preventDefault(), l.setZoom({
|
|
2268
2268
|
level: Math.max(l.level / 1.1, 0.1),
|
|
2269
2269
|
width: l.width,
|
|
2270
2270
|
height: l.height
|
|
2271
2271
|
});
|
|
2272
2272
|
return;
|
|
2273
2273
|
}
|
|
2274
|
-
if (
|
|
2275
|
-
|
|
2274
|
+
if (c === "0") {
|
|
2275
|
+
d.preventDefault(), l.setZoom({
|
|
2276
2276
|
level: 1,
|
|
2277
2277
|
width: l.width,
|
|
2278
2278
|
height: l.height
|
|
@@ -2282,21 +2282,21 @@ function Qo({
|
|
|
2282
2282
|
return;
|
|
2283
2283
|
}
|
|
2284
2284
|
const { common: m } = J;
|
|
2285
|
-
if (
|
|
2285
|
+
if (c === m.selection) {
|
|
2286
2286
|
n("selection");
|
|
2287
2287
|
return;
|
|
2288
2288
|
}
|
|
2289
|
-
if (
|
|
2290
|
-
|
|
2289
|
+
if (c === m.layerToggle) {
|
|
2290
|
+
r();
|
|
2291
2291
|
return;
|
|
2292
2292
|
}
|
|
2293
|
-
if (
|
|
2293
|
+
if (c === m.navigationToggle) {
|
|
2294
2294
|
i();
|
|
2295
2295
|
return;
|
|
2296
2296
|
}
|
|
2297
2297
|
if (!t && e === "Image") {
|
|
2298
2298
|
const { image: v } = J;
|
|
2299
|
-
switch (
|
|
2299
|
+
switch (c) {
|
|
2300
2300
|
case v.boundingBox:
|
|
2301
2301
|
n("blankRect");
|
|
2302
2302
|
return;
|
|
@@ -2318,8 +2318,8 @@ function Qo({
|
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
2320
|
};
|
|
2321
|
-
return document.addEventListener("keydown",
|
|
2322
|
-
document.removeEventListener("keydown",
|
|
2321
|
+
return document.addEventListener("keydown", g), () => {
|
|
2322
|
+
document.removeEventListener("keydown", g);
|
|
2323
2323
|
};
|
|
2324
2324
|
}, [
|
|
2325
2325
|
e,
|
|
@@ -2328,46 +2328,46 @@ function Qo({
|
|
|
2328
2328
|
s,
|
|
2329
2329
|
o,
|
|
2330
2330
|
a,
|
|
2331
|
-
|
|
2331
|
+
r,
|
|
2332
2332
|
i,
|
|
2333
2333
|
l
|
|
2334
2334
|
]);
|
|
2335
2335
|
}
|
|
2336
2336
|
const es = {
|
|
2337
|
-
selection:
|
|
2338
|
-
brush:
|
|
2339
|
-
blankRect:
|
|
2337
|
+
selection: Bt,
|
|
2338
|
+
brush: en,
|
|
2339
|
+
blankRect: dn,
|
|
2340
2340
|
filledRect: to,
|
|
2341
|
-
polygon:
|
|
2342
|
-
eraser:
|
|
2343
|
-
magicbrush:
|
|
2344
|
-
superpixel:
|
|
2341
|
+
polygon: an,
|
|
2342
|
+
eraser: tn,
|
|
2343
|
+
magicbrush: bt,
|
|
2344
|
+
superpixel: un,
|
|
2345
2345
|
segAnything: no
|
|
2346
2346
|
};
|
|
2347
2347
|
function ts() {
|
|
2348
|
-
const e =
|
|
2349
|
-
(
|
|
2350
|
-
const m = es[
|
|
2348
|
+
const e = we((c) => c.tool), t = we((c) => c.setTool), n = We((c) => c.colorCode), s = We((c) => c.setColorCode), o = rt((c) => c.opacity), a = rt((c) => c.setOpacity), r = Lt((c) => c.brush), i = Lt((c) => c.setBrush), l = $(
|
|
2349
|
+
(c) => {
|
|
2350
|
+
const m = es[c];
|
|
2351
2351
|
m && t(m());
|
|
2352
2352
|
},
|
|
2353
2353
|
[t]
|
|
2354
|
-
),
|
|
2354
|
+
), g = $(() => {
|
|
2355
2355
|
t(null);
|
|
2356
|
-
}, [t]),
|
|
2356
|
+
}, [t]), d = (e == null ? void 0 : e.id) ?? null;
|
|
2357
2357
|
return ve(
|
|
2358
2358
|
() => ({
|
|
2359
|
-
activeToolId:
|
|
2359
|
+
activeToolId: d,
|
|
2360
2360
|
currentTool: e,
|
|
2361
2361
|
setTool: l,
|
|
2362
|
-
clearTool:
|
|
2362
|
+
clearTool: g,
|
|
2363
2363
|
colorCode: n,
|
|
2364
2364
|
setColorCode: s,
|
|
2365
2365
|
opacity: o,
|
|
2366
2366
|
setOpacity: a,
|
|
2367
|
-
brush:
|
|
2367
|
+
brush: r,
|
|
2368
2368
|
setBrush: i
|
|
2369
2369
|
}),
|
|
2370
|
-
[
|
|
2370
|
+
[d, e, l, g, n, s, o, a, r, i]
|
|
2371
2371
|
);
|
|
2372
2372
|
}
|
|
2373
2373
|
const ns = "lc-workspace-8csim", os = "lc-mainSection-uZv5Q", ss = "lc-canvasArea-zoUW1", as = "lc-canvasSection-aUKNP", is = "lc-imagePanel-ghGQ6", cs = "lc-sidePanel-3s3Nv", Ze = {
|
|
@@ -2378,7 +2378,7 @@ const ns = "lc-workspace-8csim", os = "lc-mainSection-uZv5Q", ss = "lc-canvasAre
|
|
|
2378
2378
|
imagePanel: is,
|
|
2379
2379
|
sidePanel: cs
|
|
2380
2380
|
};
|
|
2381
|
-
function
|
|
2381
|
+
function Xt({
|
|
2382
2382
|
image: e,
|
|
2383
2383
|
annotations: t,
|
|
2384
2384
|
onChange: n,
|
|
@@ -2386,23 +2386,23 @@ function Ft({
|
|
|
2386
2386
|
width: o,
|
|
2387
2387
|
height: a
|
|
2388
2388
|
}) {
|
|
2389
|
-
const
|
|
2389
|
+
const r = Ce(null), i = Ce(null), [l, g] = re(!1), [d, c] = re({ width: 0, height: 0 }), m = Ce(t);
|
|
2390
2390
|
m.current = t;
|
|
2391
2391
|
const v = Ce(n);
|
|
2392
2392
|
v.current = n;
|
|
2393
|
-
const
|
|
2393
|
+
const f = Ge(), b = f.setZoom, h = lt((C) => C.setObjects), p = we((C) => C.tool), N = We((C) => C.colorCode), Z = Lt((C) => C.brush), V = qe((C) => C.mode), A = Et((C) => C.isValidationMode), k = gn((C) => C.setObjects), { setTool: H } = ts(), w = typeof e == "string" ? e : e.url;
|
|
2394
2394
|
return Ko(p, {
|
|
2395
2395
|
colorCode: N,
|
|
2396
2396
|
brush: Z,
|
|
2397
2397
|
imageUrl: w
|
|
2398
2398
|
}, l), Qo({
|
|
2399
2399
|
viewMode: V,
|
|
2400
|
-
isValidationMode:
|
|
2400
|
+
isValidationMode: A,
|
|
2401
2401
|
setTool: H,
|
|
2402
2402
|
disabled: s
|
|
2403
2403
|
}), ce(() => {
|
|
2404
2404
|
if (s) return;
|
|
2405
|
-
let C = !1, E = !1, _ = 0,
|
|
2405
|
+
let C = !1, E = !1, _ = 0, D = 0;
|
|
2406
2406
|
const O = (L) => {
|
|
2407
2407
|
if (L.code === "Space" && !L.repeat) {
|
|
2408
2408
|
const M = L.target;
|
|
@@ -2419,7 +2419,7 @@ function Ft({
|
|
|
2419
2419
|
}
|
|
2420
2420
|
}, B = (L) => {
|
|
2421
2421
|
if (!E) return;
|
|
2422
|
-
C = !0, _ = L.clientX,
|
|
2422
|
+
C = !0, _ = L.clientX, D = L.clientY;
|
|
2423
2423
|
const M = Q();
|
|
2424
2424
|
M && (M.defaultCursor = "grabbing", M.hoverCursor = "grabbing");
|
|
2425
2425
|
}, R = (L) => {
|
|
@@ -2428,8 +2428,8 @@ function Ft({
|
|
|
2428
2428
|
if (!M) return;
|
|
2429
2429
|
const Y = M.viewportTransform;
|
|
2430
2430
|
if (!Y) return;
|
|
2431
|
-
const G = L.clientX - _, z = L.clientY -
|
|
2432
|
-
Y[4] += G, Y[5] += z, M.setViewportTransform(Y), M.requestRenderAll(), _ = L.clientX,
|
|
2431
|
+
const G = L.clientX - _, z = L.clientY - D;
|
|
2432
|
+
Y[4] += G, Y[5] += z, M.setViewportTransform(Y), M.requestRenderAll(), _ = L.clientX, D = L.clientY;
|
|
2433
2433
|
}, x = () => {
|
|
2434
2434
|
if (!C) return;
|
|
2435
2435
|
C = !1;
|
|
@@ -2443,8 +2443,8 @@ function Ft({
|
|
|
2443
2443
|
const Y = L.deltaY, G = M.getZoom(), z = Y > 0 ? Math.max(G / 1.05, 0.1) : Math.min(G * 1.05, 5), q = M.getScenePoint(L);
|
|
2444
2444
|
M.zoomToPoint(q, z), M.requestRenderAll(), b({
|
|
2445
2445
|
level: z,
|
|
2446
|
-
width:
|
|
2447
|
-
height:
|
|
2446
|
+
width: f.width,
|
|
2447
|
+
height: f.height
|
|
2448
2448
|
});
|
|
2449
2449
|
};
|
|
2450
2450
|
document.addEventListener("keydown", O), document.addEventListener("keyup", y), document.addEventListener("mousedown", B), document.addEventListener("mousemove", R), document.addEventListener("mouseup", x);
|
|
@@ -2452,26 +2452,26 @@ function Ft({
|
|
|
2452
2452
|
return T == null || T.addEventListener("wheel", P, { passive: !1 }), () => {
|
|
2453
2453
|
document.removeEventListener("keydown", O), document.removeEventListener("keyup", y), document.removeEventListener("mousedown", B), document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", x), T == null || T.removeEventListener("wheel", P);
|
|
2454
2454
|
};
|
|
2455
|
-
}, [s, b,
|
|
2455
|
+
}, [s, b, f.width, f.height]), ce(() => {
|
|
2456
2456
|
if (typeof document > "u") return;
|
|
2457
2457
|
let C = !1;
|
|
2458
2458
|
return (async () => {
|
|
2459
|
-
if (await On(), C || !
|
|
2460
|
-
const _ = await import("fabric"),
|
|
2459
|
+
if (await On(), C || !r.current) return;
|
|
2460
|
+
const _ = await import("fabric"), D = new _.Canvas(r.current, {
|
|
2461
2461
|
selection: !s,
|
|
2462
2462
|
preserveObjectStacking: !0
|
|
2463
2463
|
});
|
|
2464
|
-
|
|
2464
|
+
At(D), g(!0);
|
|
2465
2465
|
const O = await _.FabricImage.fromURL(w, { crossOrigin: "anonymous" });
|
|
2466
2466
|
if (C) return;
|
|
2467
2467
|
const y = typeof e == "object" ? e.width : O.width ?? 0, B = typeof e == "object" ? e.height : O.height ?? 0;
|
|
2468
|
-
|
|
2468
|
+
c({ width: y, height: B });
|
|
2469
2469
|
const R = i.current, x = o ?? (R == null ? void 0 : R.clientWidth) ?? y, P = a ?? (R == null ? void 0 : R.clientHeight) ?? B, T = Math.min(x / (y || 1), P / (B || 1), 1), L = Math.round(y * T), M = Math.round(B * T);
|
|
2470
|
-
|
|
2470
|
+
D.setDimensions({ width: L, height: M }), D.setZoom(T), O.set({ selectable: !1, evented: !1 }), D.backgroundImage = O, D.renderAll(), b({ level: T, width: L, height: M });
|
|
2471
2471
|
})(), () => {
|
|
2472
2472
|
C = !0;
|
|
2473
2473
|
const _ = Q();
|
|
2474
|
-
_ && (_.dispose(),
|
|
2474
|
+
_ && (_.dispose(), At(null));
|
|
2475
2475
|
};
|
|
2476
2476
|
}, [w]), ce(() => {
|
|
2477
2477
|
if (!l) return;
|
|
@@ -2481,26 +2481,26 @@ function Ft({
|
|
|
2481
2481
|
const _ = C.getObjects();
|
|
2482
2482
|
for (const O of _)
|
|
2483
2483
|
C.remove(O);
|
|
2484
|
-
const
|
|
2484
|
+
const D = await import("fabric");
|
|
2485
2485
|
for (const O of t) {
|
|
2486
|
-
const y =
|
|
2486
|
+
const y = fn(O, d.width, d.height), B = y.type;
|
|
2487
2487
|
let R = null;
|
|
2488
|
-
B === "rect" ? R = new
|
|
2488
|
+
B === "rect" ? R = new D.Rect(y) : B === "image" && typeof y.src == "string" ? (R = await D.FabricImage.fromURL(y.src, { crossOrigin: "anonymous" }), R.set(y)) : B === "path" && y.path ? R = new D.Path(y.path, y) : B === "polygon" && y.points && (R = new D.Polygon(y.points, y)), R && (s && R.set({ selectable: !1, evented: !1 }), C.add(R));
|
|
2489
2489
|
}
|
|
2490
|
-
C.renderAll(),
|
|
2490
|
+
C.renderAll(), h(C.getObjects());
|
|
2491
2491
|
})();
|
|
2492
|
-
}, [t, l,
|
|
2492
|
+
}, [t, l, d.width, d.height, s, h]), ce(() => {
|
|
2493
2493
|
if (!l) return;
|
|
2494
2494
|
const C = Q();
|
|
2495
2495
|
if (!C) return;
|
|
2496
2496
|
const E = async () => {
|
|
2497
2497
|
var y;
|
|
2498
|
-
const
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2498
|
+
const D = Se(), O = await hn(
|
|
2499
|
+
D,
|
|
2500
|
+
d.width,
|
|
2501
|
+
d.height
|
|
2502
2502
|
);
|
|
2503
|
-
|
|
2503
|
+
h(D), (y = v.current) == null || y.call(v, {
|
|
2504
2504
|
annotations: O,
|
|
2505
2505
|
action: {
|
|
2506
2506
|
type: "batch",
|
|
@@ -2510,19 +2510,19 @@ function Ft({
|
|
|
2510
2510
|
}
|
|
2511
2511
|
});
|
|
2512
2512
|
}, _ = ["object:added", "object:removed", "object:modified"];
|
|
2513
|
-
for (const
|
|
2514
|
-
C.on(
|
|
2513
|
+
for (const D of _)
|
|
2514
|
+
C.on(D, E);
|
|
2515
2515
|
return () => {
|
|
2516
|
-
for (const
|
|
2517
|
-
C.off(
|
|
2516
|
+
for (const D of _)
|
|
2517
|
+
C.off(D, E);
|
|
2518
2518
|
};
|
|
2519
|
-
}, [l,
|
|
2519
|
+
}, [l, d.width, d.height, h]), ce(() => {
|
|
2520
2520
|
if (!l) return;
|
|
2521
2521
|
const C = Q();
|
|
2522
2522
|
if (!C) return;
|
|
2523
2523
|
const E = () => {
|
|
2524
|
-
const
|
|
2525
|
-
k(
|
|
2524
|
+
const D = C.getActiveObjects();
|
|
2525
|
+
k(D);
|
|
2526
2526
|
}, _ = () => {
|
|
2527
2527
|
k([]);
|
|
2528
2528
|
};
|
|
@@ -2533,7 +2533,7 @@ function Ft({
|
|
|
2533
2533
|
if (l)
|
|
2534
2534
|
return Zn(() => {
|
|
2535
2535
|
});
|
|
2536
|
-
}, [l]), /* @__PURE__ */
|
|
2536
|
+
}, [l]), /* @__PURE__ */ u("div", { ref: i, className: Ze.canvasSection, children: /* @__PURE__ */ u("div", { className: Ze.imagePanel, children: /* @__PURE__ */ u("canvas", { ref: r }) }) });
|
|
2537
2537
|
}
|
|
2538
2538
|
const rs = "lc-textSection-pEESB", ls = "lc-textContent-JGJR8", ds = "lc-segment-RaLhM", us = "lc-emptyState-G-skG", Ye = {
|
|
2539
2539
|
textSection: rs,
|
|
@@ -2546,46 +2546,46 @@ function hs({
|
|
|
2546
2546
|
readOnly: t = !1,
|
|
2547
2547
|
segments: n = []
|
|
2548
2548
|
}) {
|
|
2549
|
-
const s = Ce(null), o =
|
|
2549
|
+
const s = Ce(null), o = vn((c) => c.setSelectedSegment), a = We((c) => c.colorCode), r = rt((c) => c.opacity), i = $(() => {
|
|
2550
2550
|
if (t) return;
|
|
2551
|
-
const
|
|
2552
|
-
if (!
|
|
2553
|
-
const
|
|
2554
|
-
if (!
|
|
2555
|
-
const
|
|
2556
|
-
|
|
2557
|
-
const
|
|
2558
|
-
|
|
2551
|
+
const c = window.getSelection();
|
|
2552
|
+
if (!c || c.isCollapsed || !s.current) return;
|
|
2553
|
+
const m = c.getRangeAt(0), v = s.current;
|
|
2554
|
+
if (!v.contains(m.startContainer) || !v.contains(m.endContainer)) return;
|
|
2555
|
+
const f = document.createRange();
|
|
2556
|
+
f.selectNodeContents(v), f.setEnd(m.startContainer, m.startOffset);
|
|
2557
|
+
const b = f.toString().length, h = m.toString(), p = b + h.length;
|
|
2558
|
+
p > b && o({
|
|
2559
2559
|
key: `${Date.now()}`,
|
|
2560
2560
|
labelId: null,
|
|
2561
2561
|
tempId: `temp-${Date.now()}`,
|
|
2562
|
-
start:
|
|
2563
|
-
end:
|
|
2564
|
-
text:
|
|
2562
|
+
start: b,
|
|
2563
|
+
end: p,
|
|
2564
|
+
text: h,
|
|
2565
2565
|
color: a,
|
|
2566
|
-
opacity:
|
|
2567
|
-
}),
|
|
2568
|
-
}, [t, o, a,
|
|
2566
|
+
opacity: r
|
|
2567
|
+
}), c.removeAllRanges();
|
|
2568
|
+
}, [t, o, a, r]);
|
|
2569
2569
|
if (!e)
|
|
2570
|
-
return /* @__PURE__ */
|
|
2571
|
-
const l =
|
|
2572
|
-
return /* @__PURE__ */
|
|
2570
|
+
return /* @__PURE__ */ u("div", { className: Ye.textSection, children: /* @__PURE__ */ u("div", { className: Ye.emptyState, children: "No text content" }) });
|
|
2571
|
+
const l = e.text ?? e.value ?? "", g = n.length > 0 ? n : e.segments ?? [], d = fs(l, g);
|
|
2572
|
+
return /* @__PURE__ */ u("div", { className: Ye.textSection, children: /* @__PURE__ */ u(
|
|
2573
2573
|
"div",
|
|
2574
2574
|
{
|
|
2575
2575
|
ref: s,
|
|
2576
2576
|
className: Ye.textContent,
|
|
2577
2577
|
onMouseUp: i,
|
|
2578
|
-
children:
|
|
2578
|
+
children: d
|
|
2579
2579
|
}
|
|
2580
2580
|
) });
|
|
2581
2581
|
}
|
|
2582
2582
|
function fs(e, t) {
|
|
2583
2583
|
if (!t.length) return e;
|
|
2584
|
-
const n = [...t].sort((a,
|
|
2584
|
+
const n = [...t].sort((a, r) => a.start - r.start), s = [];
|
|
2585
2585
|
let o = 0;
|
|
2586
2586
|
for (const a of n)
|
|
2587
2587
|
a.start > o && s.push(e.slice(o, a.start)), s.push(
|
|
2588
|
-
/* @__PURE__ */
|
|
2588
|
+
/* @__PURE__ */ u(
|
|
2589
2589
|
"span",
|
|
2590
2590
|
{
|
|
2591
2591
|
className: Ye.segment,
|
|
@@ -2598,9 +2598,9 @@ function fs(e, t) {
|
|
|
2598
2598
|
a.id
|
|
2599
2599
|
)
|
|
2600
2600
|
), o = a.end;
|
|
2601
|
-
return o < e.length && s.push(e.slice(o)), /* @__PURE__ */
|
|
2601
|
+
return o < e.length && s.push(e.slice(o)), /* @__PURE__ */ u(It, { children: s });
|
|
2602
2602
|
}
|
|
2603
|
-
const ms = "lc-numberSection-7xT86", gs = "lc-chartArea-hZF-l", vs = "lc-chartPlaceholder-t8mNs", Cs = "lc-dataTable-RjNsV", ps = "lc-emptyState-lK5lO",
|
|
2603
|
+
const ms = "lc-numberSection-7xT86", gs = "lc-chartArea-hZF-l", vs = "lc-chartPlaceholder-t8mNs", Cs = "lc-dataTable-RjNsV", ps = "lc-emptyState-lK5lO", He = {
|
|
2604
2604
|
numberSection: ms,
|
|
2605
2605
|
chartArea: gs,
|
|
2606
2606
|
chartPlaceholder: vs,
|
|
@@ -2612,49 +2612,53 @@ function bs({
|
|
|
2612
2612
|
readOnly: t = !1,
|
|
2613
2613
|
segments: n = []
|
|
2614
2614
|
}) {
|
|
2615
|
-
const s =
|
|
2616
|
-
(
|
|
2615
|
+
const s = Cn((d) => d.setSelectedSegment), o = We((d) => d.colorCode), a = $(
|
|
2616
|
+
(d) => {
|
|
2617
2617
|
t || s({
|
|
2618
2618
|
key: `${Date.now()}`,
|
|
2619
2619
|
labelId: null,
|
|
2620
2620
|
tempId: `temp-${Date.now()}`,
|
|
2621
|
-
start:
|
|
2622
|
-
end:
|
|
2621
|
+
start: d,
|
|
2622
|
+
end: d,
|
|
2623
2623
|
color: o
|
|
2624
2624
|
});
|
|
2625
2625
|
},
|
|
2626
2626
|
[t, s, o]
|
|
2627
2627
|
);
|
|
2628
2628
|
if (!e)
|
|
2629
|
-
return /* @__PURE__ */
|
|
2630
|
-
const { source:
|
|
2631
|
-
|
|
2632
|
-
|
|
2629
|
+
return /* @__PURE__ */ u("div", { className: He.numberSection, children: /* @__PURE__ */ u("div", { className: He.emptyState, children: "No number content" }) });
|
|
2630
|
+
const { source: r } = e, i = n.length > 0 ? n : e.segments ?? [], l = r.columns.map(
|
|
2631
|
+
(d, c) => typeof d == "string" ? { key: String(c), label: d } : d
|
|
2632
|
+
), g = Array.isArray(r.rows[0]);
|
|
2633
|
+
return /* @__PURE__ */ S("div", { className: He.numberSection, children: [
|
|
2634
|
+
e.canRender && /* @__PURE__ */ u("div", { className: He.chartArea, children: /* @__PURE__ */ S("div", { className: He.chartPlaceholder, children: [
|
|
2633
2635
|
"Chart (",
|
|
2634
|
-
e.mode,
|
|
2636
|
+
e.mode ?? "line",
|
|
2635
2637
|
") — rendered by host app"
|
|
2636
|
-
] })
|
|
2637
|
-
|
|
2638
|
-
/* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
|
|
2638
|
+
] }) }),
|
|
2639
|
+
r.rows.length > 0 && /* @__PURE__ */ u("div", { className: He.dataTable, children: /* @__PURE__ */ S("table", { children: [
|
|
2640
|
+
/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ S("tr", { children: [
|
|
2641
|
+
/* @__PURE__ */ u("th", { children: "#" }),
|
|
2642
|
+
l.map((d) => /* @__PURE__ */ u("th", { children: d.label }, d.key))
|
|
2641
2643
|
] }) }),
|
|
2642
|
-
/* @__PURE__ */
|
|
2643
|
-
const
|
|
2644
|
-
(
|
|
2644
|
+
/* @__PURE__ */ u("tbody", { children: r.rows.map((d, c) => {
|
|
2645
|
+
const m = i.some(
|
|
2646
|
+
(v) => c >= v.start && c <= v.end
|
|
2645
2647
|
);
|
|
2646
2648
|
return /* @__PURE__ */ S(
|
|
2647
2649
|
"tr",
|
|
2648
2650
|
{
|
|
2649
|
-
"data-selected":
|
|
2650
|
-
onClick: () => a(
|
|
2651
|
+
"data-selected": m || void 0,
|
|
2652
|
+
onClick: () => a(c),
|
|
2651
2653
|
style: { cursor: t ? "default" : "pointer" },
|
|
2652
2654
|
children: [
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
|
|
2655
|
+
/* @__PURE__ */ u("td", { children: c + 1 }),
|
|
2656
|
+
l.map((v, f) => /* @__PURE__ */ u("td", { children: String(
|
|
2657
|
+
g ? d[f] ?? "" : d[v.key] ?? ""
|
|
2658
|
+
) }, v.key))
|
|
2655
2659
|
]
|
|
2656
2660
|
},
|
|
2657
|
-
|
|
2661
|
+
c
|
|
2658
2662
|
);
|
|
2659
2663
|
}) })
|
|
2660
2664
|
] }) })
|
|
@@ -2676,30 +2680,30 @@ function ks({
|
|
|
2676
2680
|
onFileUpload: n
|
|
2677
2681
|
}) {
|
|
2678
2682
|
const s = Ce(null), o = $(() => {
|
|
2679
|
-
var
|
|
2680
|
-
(
|
|
2683
|
+
var r;
|
|
2684
|
+
(r = s.current) == null || r.click();
|
|
2681
2685
|
}, []), a = $(
|
|
2682
|
-
(
|
|
2686
|
+
(r) => {
|
|
2683
2687
|
var l;
|
|
2684
|
-
const i = (l =
|
|
2685
|
-
i && (n == null || n(i)),
|
|
2688
|
+
const i = (l = r.target.files) == null ? void 0 : l[0];
|
|
2689
|
+
i && (n == null || n(i)), r.target.value = "";
|
|
2686
2690
|
},
|
|
2687
2691
|
[n]
|
|
2688
2692
|
);
|
|
2689
2693
|
return e != null && e.fileName ? /* @__PURE__ */ S("div", { className: xe.fileSection, children: [
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ u("div", { className: xe.fileIcon, children: /* @__PURE__ */ S("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2695
|
+
/* @__PURE__ */ u("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z" }),
|
|
2696
|
+
/* @__PURE__ */ u("polyline", { points: "14 2 14 8 20 8", fill: "none", stroke: "currentColor", strokeWidth: "1.5" })
|
|
2693
2697
|
] }) }),
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
e.fileType && /* @__PURE__ */
|
|
2696
|
-
] }) : t ? /* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ u("div", { className: xe.fileName, children: e.fileName }),
|
|
2699
|
+
e.fileType && /* @__PURE__ */ u("div", { className: xe.fileType, children: e.fileType })
|
|
2700
|
+
] }) : t ? /* @__PURE__ */ u("div", { className: xe.fileSection, children: /* @__PURE__ */ u("div", { className: xe.emptyState, children: "No file content" }) }) : /* @__PURE__ */ S("div", { className: xe.fileSection, children: [
|
|
2697
2701
|
/* @__PURE__ */ S("div", { className: xe.uploadArea, onClick: o, children: [
|
|
2698
|
-
/* @__PURE__ */
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2702
|
+
/* @__PURE__ */ u("div", { className: xe.fileIcon, children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ u("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
2703
|
+
/* @__PURE__ */ u("div", { className: xe.uploadText, children: "Click to upload file" }),
|
|
2704
|
+
/* @__PURE__ */ u("div", { className: xe.uploadHint, children: "or drag and drop" })
|
|
2701
2705
|
] }),
|
|
2702
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ u(
|
|
2703
2707
|
"input",
|
|
2704
2708
|
{
|
|
2705
2709
|
ref: s,
|
|
@@ -2717,15 +2721,15 @@ function Os({
|
|
|
2717
2721
|
onChange: s,
|
|
2718
2722
|
readOnly: o = !1,
|
|
2719
2723
|
textContent: a,
|
|
2720
|
-
numberContent:
|
|
2724
|
+
numberContent: r,
|
|
2721
2725
|
fileContent: i,
|
|
2722
2726
|
onFileUpload: l,
|
|
2723
|
-
children:
|
|
2727
|
+
children: g
|
|
2724
2728
|
}) {
|
|
2725
2729
|
switch (e) {
|
|
2726
2730
|
case "Image":
|
|
2727
|
-
return /* @__PURE__ */
|
|
2728
|
-
|
|
2731
|
+
return /* @__PURE__ */ u(
|
|
2732
|
+
Xt,
|
|
2729
2733
|
{
|
|
2730
2734
|
image: t,
|
|
2731
2735
|
annotations: n,
|
|
@@ -2734,7 +2738,7 @@ function Os({
|
|
|
2734
2738
|
}
|
|
2735
2739
|
);
|
|
2736
2740
|
case "Text":
|
|
2737
|
-
return /* @__PURE__ */
|
|
2741
|
+
return /* @__PURE__ */ u(
|
|
2738
2742
|
hs,
|
|
2739
2743
|
{
|
|
2740
2744
|
content: a,
|
|
@@ -2742,15 +2746,15 @@ function Os({
|
|
|
2742
2746
|
}
|
|
2743
2747
|
);
|
|
2744
2748
|
case "Number":
|
|
2745
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ u(
|
|
2746
2750
|
bs,
|
|
2747
2751
|
{
|
|
2748
|
-
content:
|
|
2752
|
+
content: r,
|
|
2749
2753
|
readOnly: o
|
|
2750
2754
|
}
|
|
2751
2755
|
);
|
|
2752
2756
|
case "File":
|
|
2753
|
-
return /* @__PURE__ */
|
|
2757
|
+
return /* @__PURE__ */ u(
|
|
2754
2758
|
ks,
|
|
2755
2759
|
{
|
|
2756
2760
|
content: i,
|
|
@@ -2759,10 +2763,10 @@ function Os({
|
|
|
2759
2763
|
}
|
|
2760
2764
|
);
|
|
2761
2765
|
case "Record":
|
|
2762
|
-
return /* @__PURE__ */
|
|
2766
|
+
return /* @__PURE__ */ u(It, { children: g });
|
|
2763
2767
|
default:
|
|
2764
|
-
return /* @__PURE__ */
|
|
2765
|
-
|
|
2768
|
+
return /* @__PURE__ */ u(
|
|
2769
|
+
Xt,
|
|
2766
2770
|
{
|
|
2767
2771
|
image: t,
|
|
2768
2772
|
annotations: n,
|
|
@@ -2772,14 +2776,14 @@ function Os({
|
|
|
2772
2776
|
);
|
|
2773
2777
|
}
|
|
2774
2778
|
}
|
|
2775
|
-
const Ps = "lc-navigationWrapper-3oNp8", Ts = "lc-title-ozM0E", Bs = "lc-titleUtil-V4RV4", Es = "lc-directionButton-GOUn-", Rs = "lc-content-fBa8N",
|
|
2779
|
+
const Ps = "lc-navigationWrapper-3oNp8", Ts = "lc-title-ozM0E", Bs = "lc-titleUtil-V4RV4", Es = "lc-directionButton-GOUn-", Rs = "lc-content-fBa8N", As = "lc-recordList-kWbe2", Ds = "lc-recordItem-qutOX", Hs = "lc-recordThumbnail-s2bPH", _s = "lc-recordTitle-BtPW7", Vs = "lc-recordStatus--HJxg", Zs = "lc-childrenList-i9Ow3", Us = "lc-searchInput-RI4GW", Ws = "lc-empty-olthD", he = {
|
|
2776
2780
|
navigationWrapper: Ps,
|
|
2777
2781
|
title: Ts,
|
|
2778
2782
|
titleUtil: Bs,
|
|
2779
2783
|
directionButton: Es,
|
|
2780
2784
|
content: Rs,
|
|
2781
|
-
recordList:
|
|
2782
|
-
recordItem:
|
|
2785
|
+
recordList: As,
|
|
2786
|
+
recordItem: Ds,
|
|
2783
2787
|
recordThumbnail: Hs,
|
|
2784
2788
|
recordTitle: _s,
|
|
2785
2789
|
recordStatus: Vs,
|
|
@@ -2787,7 +2791,7 @@ const Ps = "lc-navigationWrapper-3oNp8", Ts = "lc-title-ozM0E", Bs = "lc-titleUt
|
|
|
2787
2791
|
searchInput: Us,
|
|
2788
2792
|
empty: Ws
|
|
2789
2793
|
};
|
|
2790
|
-
function
|
|
2794
|
+
function $t({
|
|
2791
2795
|
records: e,
|
|
2792
2796
|
activeRecordId: t,
|
|
2793
2797
|
onRecordSelect: n,
|
|
@@ -2795,84 +2799,84 @@ function Xt({
|
|
|
2795
2799
|
onDirectionChange: o,
|
|
2796
2800
|
hidden: a = !1
|
|
2797
2801
|
}) {
|
|
2798
|
-
const [
|
|
2799
|
-
if (!
|
|
2800
|
-
const
|
|
2802
|
+
const [r, i] = re(""), l = ve(() => {
|
|
2803
|
+
if (!r.trim()) return e;
|
|
2804
|
+
const c = r.trim().toLowerCase();
|
|
2801
2805
|
return e.filter(
|
|
2802
2806
|
(m) => {
|
|
2803
2807
|
var v;
|
|
2804
|
-
return m.title.toLowerCase().includes(
|
|
2808
|
+
return m.title.toLowerCase().includes(c) || ((v = m.children) == null ? void 0 : v.some((f) => f.title.toLowerCase().includes(c)));
|
|
2805
2809
|
}
|
|
2806
2810
|
);
|
|
2807
|
-
}, [e,
|
|
2808
|
-
i(
|
|
2809
|
-
}, []),
|
|
2811
|
+
}, [e, r]), g = $((c) => {
|
|
2812
|
+
i(c.target.value);
|
|
2813
|
+
}, []), d = s === "vertical" ? "bottom" : "left";
|
|
2810
2814
|
return /* @__PURE__ */ S(
|
|
2811
2815
|
"div",
|
|
2812
2816
|
{
|
|
2813
2817
|
className: he.navigationWrapper,
|
|
2814
|
-
"data-position":
|
|
2818
|
+
"data-position": d,
|
|
2815
2819
|
"data-hidden": a || void 0,
|
|
2816
2820
|
children: [
|
|
2817
2821
|
/* @__PURE__ */ S("div", { className: he.title, children: [
|
|
2818
|
-
/* @__PURE__ */
|
|
2822
|
+
/* @__PURE__ */ u("p", { children: "Navigation" }),
|
|
2819
2823
|
o && /* @__PURE__ */ S("div", { className: he.titleUtil, children: [
|
|
2820
|
-
/* @__PURE__ */
|
|
2824
|
+
/* @__PURE__ */ u(
|
|
2821
2825
|
"button",
|
|
2822
2826
|
{
|
|
2823
2827
|
className: he.directionButton,
|
|
2824
2828
|
"data-active": s === "horizontal" || void 0,
|
|
2825
2829
|
onClick: () => o("horizontal"),
|
|
2826
2830
|
title: "Side panel",
|
|
2827
|
-
children: /* @__PURE__ */
|
|
2831
|
+
children: /* @__PURE__ */ u(Ys, {})
|
|
2828
2832
|
}
|
|
2829
2833
|
),
|
|
2830
|
-
/* @__PURE__ */
|
|
2834
|
+
/* @__PURE__ */ u(
|
|
2831
2835
|
"button",
|
|
2832
2836
|
{
|
|
2833
2837
|
className: he.directionButton,
|
|
2834
2838
|
"data-active": s === "vertical" || void 0,
|
|
2835
2839
|
onClick: () => o("vertical"),
|
|
2836
2840
|
title: "Bottom panel",
|
|
2837
|
-
children: /* @__PURE__ */
|
|
2841
|
+
children: /* @__PURE__ */ u(zs, {})
|
|
2838
2842
|
}
|
|
2839
2843
|
)
|
|
2840
2844
|
] })
|
|
2841
2845
|
] }),
|
|
2842
2846
|
/* @__PURE__ */ S("div", { className: he.content, children: [
|
|
2843
|
-
/* @__PURE__ */
|
|
2847
|
+
/* @__PURE__ */ u(
|
|
2844
2848
|
"input",
|
|
2845
2849
|
{
|
|
2846
2850
|
className: he.searchInput,
|
|
2847
2851
|
type: "text",
|
|
2848
2852
|
placeholder: "Search records...",
|
|
2849
|
-
value:
|
|
2850
|
-
onChange:
|
|
2853
|
+
value: r,
|
|
2854
|
+
onChange: g
|
|
2851
2855
|
}
|
|
2852
2856
|
),
|
|
2853
|
-
l.length === 0 ? /* @__PURE__ */
|
|
2854
|
-
|
|
2857
|
+
l.length === 0 ? /* @__PURE__ */ u("div", { className: he.empty, children: "No records found" }) : /* @__PURE__ */ u("div", { className: he.recordList, children: l.map((c) => /* @__PURE__ */ u(
|
|
2858
|
+
bn,
|
|
2855
2859
|
{
|
|
2856
|
-
record:
|
|
2860
|
+
record: c,
|
|
2857
2861
|
activeRecordId: t,
|
|
2858
2862
|
onRecordSelect: n
|
|
2859
2863
|
},
|
|
2860
|
-
|
|
2864
|
+
c.id
|
|
2861
2865
|
)) })
|
|
2862
2866
|
] })
|
|
2863
2867
|
]
|
|
2864
2868
|
}
|
|
2865
2869
|
);
|
|
2866
2870
|
}
|
|
2867
|
-
function
|
|
2871
|
+
function bn({
|
|
2868
2872
|
record: e,
|
|
2869
2873
|
activeRecordId: t,
|
|
2870
2874
|
onRecordSelect: n
|
|
2871
2875
|
}) {
|
|
2872
|
-
const s = e.id === t, o = e.children && e.children.length > 0, [a,
|
|
2873
|
-
o &&
|
|
2876
|
+
const s = e.id === t, o = e.children && e.children.length > 0, [a, r] = re(s || !1), i = $(() => {
|
|
2877
|
+
o && r((l) => !l), n(e);
|
|
2874
2878
|
}, [o, n, e]);
|
|
2875
|
-
return /* @__PURE__ */ S(
|
|
2879
|
+
return /* @__PURE__ */ S(It, { children: [
|
|
2876
2880
|
/* @__PURE__ */ S(
|
|
2877
2881
|
"div",
|
|
2878
2882
|
{
|
|
@@ -2880,7 +2884,7 @@ function pn({
|
|
|
2880
2884
|
"data-active": s || void 0,
|
|
2881
2885
|
onClick: i,
|
|
2882
2886
|
children: [
|
|
2883
|
-
e.thumbnail && /* @__PURE__ */
|
|
2887
|
+
e.thumbnail && /* @__PURE__ */ u(
|
|
2884
2888
|
"img",
|
|
2885
2889
|
{
|
|
2886
2890
|
className: he.recordThumbnail,
|
|
@@ -2888,13 +2892,13 @@ function pn({
|
|
|
2888
2892
|
alt: e.title
|
|
2889
2893
|
}
|
|
2890
2894
|
),
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
e.status && /* @__PURE__ */
|
|
2895
|
+
/* @__PURE__ */ u("span", { className: he.recordTitle, children: e.title }),
|
|
2896
|
+
e.status && /* @__PURE__ */ u("span", { className: he.recordStatus, "data-status": e.status })
|
|
2893
2897
|
]
|
|
2894
2898
|
}
|
|
2895
2899
|
),
|
|
2896
|
-
o && a && /* @__PURE__ */
|
|
2897
|
-
|
|
2900
|
+
o && a && /* @__PURE__ */ u("div", { className: he.childrenList, children: e.children.map((l) => /* @__PURE__ */ u(
|
|
2901
|
+
bn,
|
|
2898
2902
|
{
|
|
2899
2903
|
record: l,
|
|
2900
2904
|
activeRecordId: t,
|
|
@@ -2906,14 +2910,14 @@ function pn({
|
|
|
2906
2910
|
}
|
|
2907
2911
|
function Ys() {
|
|
2908
2912
|
return /* @__PURE__ */ S("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: [
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ u("rect", { x: "1", y: "1", width: "12", height: "12", rx: "1.5", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
2914
|
+
/* @__PURE__ */ u("line", { x1: "5", y1: "1", x2: "5", y2: "13", stroke: "currentColor", strokeWidth: "1.2" })
|
|
2911
2915
|
] });
|
|
2912
2916
|
}
|
|
2913
2917
|
function zs() {
|
|
2914
2918
|
return /* @__PURE__ */ S("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: [
|
|
2915
|
-
/* @__PURE__ */
|
|
2916
|
-
/* @__PURE__ */
|
|
2919
|
+
/* @__PURE__ */ u("rect", { x: "1", y: "1", width: "12", height: "12", rx: "1.5", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
2920
|
+
/* @__PURE__ */ u("line", { x1: "1", y1: "9", x2: "13", y2: "9", stroke: "currentColor", strokeWidth: "1.2" })
|
|
2917
2921
|
] });
|
|
2918
2922
|
}
|
|
2919
2923
|
const Fs = "lc-infoPanel-mqfKy", Xs = "lc-section-sMcXk", $s = "lc-sectionTitle-XfGbz", Gs = "lc-sectionContent-xsoVh", qs = "lc-tabs-huI9o", Ks = "lc-tab-jbpRb", Js = "lc-classList-mtPXc", js = "lc-classButton-Cdd6v", Qs = "lc-classColorDot-Ravod", ea = "lc-className-yQWn-", ta = "lc-classHotkey-deQqu", na = "lc-labelList-iJvDs", oa = "lc-labelItem-ws-sn", sa = "lc-indicator-6JWmk", aa = "lc-indicatorProgress-5iZVD", ae = {
|
|
@@ -2940,39 +2944,39 @@ function ia({
|
|
|
2940
2944
|
onClassSelect: s,
|
|
2941
2945
|
onAnnotationSelect: o,
|
|
2942
2946
|
onAnnotationDelete: a,
|
|
2943
|
-
disabled:
|
|
2947
|
+
disabled: r = !1
|
|
2944
2948
|
}) {
|
|
2945
2949
|
var v;
|
|
2946
|
-
const [i, l] = re("class"), [
|
|
2950
|
+
const [i, l] = re("class"), [g, d] = re(((v = e[0]) == null ? void 0 : v.id) ?? "");
|
|
2947
2951
|
ce(() => {
|
|
2948
|
-
e.length > 0 && !e.find((
|
|
2949
|
-
}, [e,
|
|
2950
|
-
const
|
|
2951
|
-
const
|
|
2952
|
+
e.length > 0 && !e.find((f) => f.id === g) && d(e[0].id);
|
|
2953
|
+
}, [e, g]);
|
|
2954
|
+
const c = ve(() => {
|
|
2955
|
+
const f = /* @__PURE__ */ new Map();
|
|
2952
2956
|
for (const b of e) {
|
|
2953
|
-
const
|
|
2954
|
-
p.push(b),
|
|
2957
|
+
const h = b.group ?? "", p = f.get(h) ?? [];
|
|
2958
|
+
p.push(b), f.set(h, p);
|
|
2955
2959
|
}
|
|
2956
|
-
return
|
|
2960
|
+
return f;
|
|
2957
2961
|
}, [e]), m = $(
|
|
2958
|
-
(
|
|
2959
|
-
|
|
2962
|
+
(f) => {
|
|
2963
|
+
r || (d(f.id), s == null || s(f));
|
|
2960
2964
|
},
|
|
2961
|
-
[
|
|
2965
|
+
[r, s]
|
|
2962
2966
|
);
|
|
2963
2967
|
return ce(() => {
|
|
2964
|
-
const
|
|
2965
|
-
if (
|
|
2966
|
-
const
|
|
2967
|
-
if (
|
|
2968
|
+
const f = (b) => {
|
|
2969
|
+
if (r) return;
|
|
2970
|
+
const h = b.target;
|
|
2971
|
+
if (h instanceof HTMLElement && (h.tagName === "INPUT" || h.tagName === "TEXTAREA" || h.tagName === "SELECT" || h.isContentEditable))
|
|
2968
2972
|
return;
|
|
2969
2973
|
const p = b.key, N = e.find((Z) => Z.hotkey === p);
|
|
2970
2974
|
N && (b.preventDefault(), m(N));
|
|
2971
2975
|
};
|
|
2972
|
-
return window.addEventListener("keydown",
|
|
2973
|
-
}, [e,
|
|
2974
|
-
/* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
+
return window.addEventListener("keydown", f), () => window.removeEventListener("keydown", f);
|
|
2977
|
+
}, [e, r, m]), /* @__PURE__ */ u("div", { className: ae.infoPanel, children: /* @__PURE__ */ S("div", { className: ae.section, children: [
|
|
2978
|
+
/* @__PURE__ */ u("div", { className: ae.sectionTitle, children: /* @__PURE__ */ S("div", { className: ae.tabs, children: [
|
|
2979
|
+
/* @__PURE__ */ u(
|
|
2976
2980
|
"button",
|
|
2977
2981
|
{
|
|
2978
2982
|
className: ae.tab,
|
|
@@ -2981,7 +2985,7 @@ function ia({
|
|
|
2981
2985
|
children: "Class"
|
|
2982
2986
|
}
|
|
2983
2987
|
),
|
|
2984
|
-
/* @__PURE__ */
|
|
2988
|
+
/* @__PURE__ */ u(
|
|
2985
2989
|
"button",
|
|
2986
2990
|
{
|
|
2987
2991
|
className: ae.tab,
|
|
@@ -2991,46 +2995,46 @@ function ia({
|
|
|
2991
2995
|
}
|
|
2992
2996
|
)
|
|
2993
2997
|
] }) }),
|
|
2994
|
-
i === "class" && /* @__PURE__ */
|
|
2995
|
-
|
|
2996
|
-
b.map((
|
|
2998
|
+
i === "class" && /* @__PURE__ */ u("div", { className: ae.sectionContent, children: /* @__PURE__ */ u("div", { className: ae.classList, children: Array.from(c.entries()).map(([f, b]) => /* @__PURE__ */ S("div", { children: [
|
|
2999
|
+
f && /* @__PURE__ */ u("div", { style: { fontSize: "0.75rem", fontWeight: 600, color: "#64748b", padding: "0.25rem 0", marginTop: "0.25rem" }, children: f }),
|
|
3000
|
+
b.map((h) => /* @__PURE__ */ S(
|
|
2997
3001
|
"button",
|
|
2998
3002
|
{
|
|
2999
3003
|
className: ae.classButton,
|
|
3000
|
-
"data-active":
|
|
3001
|
-
disabled:
|
|
3002
|
-
onClick: () => m(
|
|
3004
|
+
"data-active": g === h.id || void 0,
|
|
3005
|
+
disabled: r,
|
|
3006
|
+
onClick: () => m(h),
|
|
3003
3007
|
children: [
|
|
3004
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ u(
|
|
3005
3009
|
"div",
|
|
3006
3010
|
{
|
|
3007
3011
|
className: ae.classColorDot,
|
|
3008
|
-
style: { backgroundColor:
|
|
3012
|
+
style: { backgroundColor: h.color }
|
|
3009
3013
|
}
|
|
3010
3014
|
),
|
|
3011
|
-
/* @__PURE__ */
|
|
3012
|
-
|
|
3015
|
+
/* @__PURE__ */ u("span", { className: ae.className, children: h.name }),
|
|
3016
|
+
h.hotkey && /* @__PURE__ */ u("span", { className: ae.classHotkey, children: h.hotkey })
|
|
3013
3017
|
]
|
|
3014
3018
|
},
|
|
3015
|
-
|
|
3019
|
+
h.id
|
|
3016
3020
|
))
|
|
3017
|
-
] },
|
|
3018
|
-
i === "label" && /* @__PURE__ */
|
|
3021
|
+
] }, f || "__default")) }) }),
|
|
3022
|
+
i === "label" && /* @__PURE__ */ u("div", { className: ae.sectionContent, children: t.length === 0 ? /* @__PURE__ */ u("div", { style: { fontSize: "0.8125rem", color: "#64748b", padding: "1rem 0", textAlign: "center" }, children: "No labels yet" }) : /* @__PURE__ */ u("div", { className: ae.labelList, children: t.map((f) => /* @__PURE__ */ S(
|
|
3019
3023
|
"div",
|
|
3020
3024
|
{
|
|
3021
3025
|
className: ae.labelItem,
|
|
3022
|
-
"data-selected": n ===
|
|
3023
|
-
onClick: () => o == null ? void 0 : o(
|
|
3026
|
+
"data-selected": n === f.id || void 0,
|
|
3027
|
+
onClick: () => o == null ? void 0 : o(f),
|
|
3024
3028
|
children: [
|
|
3025
|
-
/* @__PURE__ */
|
|
3029
|
+
/* @__PURE__ */ u(
|
|
3026
3030
|
"div",
|
|
3027
3031
|
{
|
|
3028
3032
|
className: ae.classColorDot,
|
|
3029
|
-
style: { backgroundColor:
|
|
3033
|
+
style: { backgroundColor: f.style.color, opacity: f.style.opacity }
|
|
3030
3034
|
}
|
|
3031
3035
|
),
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
a && /* @__PURE__ */
|
|
3036
|
+
/* @__PURE__ */ u("p", { children: f.label.name || f.type }),
|
|
3037
|
+
a && /* @__PURE__ */ u(
|
|
3034
3038
|
"button",
|
|
3035
3039
|
{
|
|
3036
3040
|
style: {
|
|
@@ -3043,23 +3047,23 @@ function ia({
|
|
|
3043
3047
|
color: "#94a3b8"
|
|
3044
3048
|
},
|
|
3045
3049
|
onClick: (b) => {
|
|
3046
|
-
b.stopPropagation(), a(
|
|
3050
|
+
b.stopPropagation(), a(f.id);
|
|
3047
3051
|
},
|
|
3048
3052
|
children: "×"
|
|
3049
3053
|
}
|
|
3050
3054
|
)
|
|
3051
3055
|
]
|
|
3052
3056
|
},
|
|
3053
|
-
|
|
3057
|
+
f.id
|
|
3054
3058
|
)) }) })
|
|
3055
3059
|
] }) });
|
|
3056
3060
|
}
|
|
3057
3061
|
const ca = "sub-tool-panel";
|
|
3058
3062
|
function Le(e, t = "sm") {
|
|
3059
|
-
return
|
|
3063
|
+
return Ke(fe, { iconType: e, size: t });
|
|
3060
3064
|
}
|
|
3061
3065
|
function ra() {
|
|
3062
|
-
const e =
|
|
3066
|
+
const e = we((d) => d.tool), t = we((d) => d.setTool), n = Me((d) => d.mode), s = Me((d) => d.cycleMode), o = (e == null ? void 0 : e.id) ?? "selection", r = ["magic-brush", "superpixel", "seg-anything"].includes(o), i = o === "superpixel" ? "icon-superpixel" : o === "seg-anything" ? "icon-seg-anything" : "icon-magic-wand", l = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
|
|
3063
3067
|
return { toolbar: [
|
|
3064
3068
|
// Selection
|
|
3065
3069
|
{
|
|
@@ -3069,7 +3073,7 @@ function ra() {
|
|
|
3069
3073
|
icon: Le("icon-selection"),
|
|
3070
3074
|
title: ee("Selection", J.common.selection),
|
|
3071
3075
|
checked: o === "selection",
|
|
3072
|
-
onClick: () => t(
|
|
3076
|
+
onClick: () => t(Bt())
|
|
3073
3077
|
},
|
|
3074
3078
|
{ variant: "divider" },
|
|
3075
3079
|
// Bounding Box
|
|
@@ -3080,7 +3084,7 @@ function ra() {
|
|
|
3080
3084
|
icon: Le("icon-borderd-rect"),
|
|
3081
3085
|
title: ee("Bounding Box", J.image.boundingBox),
|
|
3082
3086
|
checked: o === "bounded-box",
|
|
3083
|
-
onClick: () => t(
|
|
3087
|
+
onClick: () => t(dn())
|
|
3084
3088
|
},
|
|
3085
3089
|
// Pen
|
|
3086
3090
|
{
|
|
@@ -3090,7 +3094,7 @@ function ra() {
|
|
|
3090
3094
|
icon: Le("icon-pen"),
|
|
3091
3095
|
title: ee("Pen", J.image.pen),
|
|
3092
3096
|
checked: o === "polygon",
|
|
3093
|
-
onClick: () => t(
|
|
3097
|
+
onClick: () => t(an())
|
|
3094
3098
|
},
|
|
3095
3099
|
// Brush
|
|
3096
3100
|
{
|
|
@@ -3100,7 +3104,7 @@ function ra() {
|
|
|
3100
3104
|
icon: Le("icon-brush"),
|
|
3101
3105
|
title: ee("Brush", J.image.brush),
|
|
3102
3106
|
checked: o === "brush",
|
|
3103
|
-
onClick: () => t(
|
|
3107
|
+
onClick: () => t(en())
|
|
3104
3108
|
},
|
|
3105
3109
|
// Intelligent Tools (sub-panel)
|
|
3106
3110
|
{
|
|
@@ -3109,7 +3113,7 @@ function ra() {
|
|
|
3109
3113
|
name: "tool",
|
|
3110
3114
|
icon: Le(i),
|
|
3111
3115
|
title: "Intelligent Tools",
|
|
3112
|
-
checked:
|
|
3116
|
+
checked: r,
|
|
3113
3117
|
subButtonItems: [
|
|
3114
3118
|
{
|
|
3115
3119
|
variant: "radio",
|
|
@@ -3118,7 +3122,7 @@ function ra() {
|
|
|
3118
3122
|
icon: Le("icon-magic-wand"),
|
|
3119
3123
|
title: ee("Magic Brush", J.image.magicBrush),
|
|
3120
3124
|
checked: o === "magic-brush",
|
|
3121
|
-
onClick: () => t(
|
|
3125
|
+
onClick: () => t(bt())
|
|
3122
3126
|
},
|
|
3123
3127
|
{
|
|
3124
3128
|
variant: "radio",
|
|
@@ -3127,7 +3131,7 @@ function ra() {
|
|
|
3127
3131
|
icon: Le("icon-superpixel"),
|
|
3128
3132
|
title: ee("Superpixel", J.image.superpixel),
|
|
3129
3133
|
checked: o === "superpixel",
|
|
3130
|
-
onClick: () => t(
|
|
3134
|
+
onClick: () => t(un())
|
|
3131
3135
|
},
|
|
3132
3136
|
{
|
|
3133
3137
|
variant: "radio",
|
|
@@ -3142,7 +3146,7 @@ function ra() {
|
|
|
3142
3146
|
}
|
|
3143
3147
|
],
|
|
3144
3148
|
onClick: () => {
|
|
3145
|
-
|
|
3149
|
+
r || t(bt());
|
|
3146
3150
|
}
|
|
3147
3151
|
},
|
|
3148
3152
|
// Dropdown toggle (slim)
|
|
@@ -3163,7 +3167,7 @@ function ra() {
|
|
|
3163
3167
|
icon: Le("icon-eraser"),
|
|
3164
3168
|
title: ee("Eraser", J.image.eraser),
|
|
3165
3169
|
checked: o === "eraser",
|
|
3166
|
-
onClick: () => t(
|
|
3170
|
+
onClick: () => t(tn())
|
|
3167
3171
|
},
|
|
3168
3172
|
{ variant: "divider" },
|
|
3169
3173
|
// Layer Mode
|
|
@@ -3176,17 +3180,17 @@ function ra() {
|
|
|
3176
3180
|
}
|
|
3177
3181
|
] };
|
|
3178
3182
|
}
|
|
3179
|
-
function
|
|
3180
|
-
return
|
|
3183
|
+
function nt(e) {
|
|
3184
|
+
return Ke(fe, { iconType: e, size: "sm" });
|
|
3181
3185
|
}
|
|
3182
3186
|
function la() {
|
|
3183
|
-
const e =
|
|
3187
|
+
const e = zt((l) => l.tool), t = zt((l) => l.setTool), n = Me((l) => l.mode), s = Me((l) => l.cycleMode), o = vo(), a = (e == null ? void 0 : e.id) ?? "selection", r = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
|
|
3184
3188
|
return { toolbar: [
|
|
3185
3189
|
{
|
|
3186
3190
|
variant: "radio",
|
|
3187
3191
|
id: "selection",
|
|
3188
3192
|
name: "tool",
|
|
3189
|
-
icon:
|
|
3193
|
+
icon: nt("icon-selection"),
|
|
3190
3194
|
title: ee("Selection", J.common.selection),
|
|
3191
3195
|
checked: a === "selection",
|
|
3192
3196
|
onClick: () => t({ id: "selection", label: "Selection" })
|
|
@@ -3196,7 +3200,7 @@ function la() {
|
|
|
3196
3200
|
variant: "radio",
|
|
3197
3201
|
id: "drag-segment",
|
|
3198
3202
|
name: "tool",
|
|
3199
|
-
icon:
|
|
3203
|
+
icon: nt("icon-highlight"),
|
|
3200
3204
|
title: ee("Highlighting", J.text.highlighting),
|
|
3201
3205
|
checked: a === "drag-segment",
|
|
3202
3206
|
onClick: () => t({ id: "drag-segment", label: "Highlighting" })
|
|
@@ -3206,7 +3210,7 @@ function la() {
|
|
|
3206
3210
|
{
|
|
3207
3211
|
variant: "button",
|
|
3208
3212
|
id: "auto-highlight",
|
|
3209
|
-
icon:
|
|
3213
|
+
icon: nt("icon-highlight"),
|
|
3210
3214
|
title: ee("Auto Highlight", J.text.autoHighlight),
|
|
3211
3215
|
subItems: [
|
|
3212
3216
|
{
|
|
@@ -3238,23 +3242,23 @@ function la() {
|
|
|
3238
3242
|
{
|
|
3239
3243
|
variant: "button",
|
|
3240
3244
|
id: "layer-mode",
|
|
3241
|
-
icon:
|
|
3245
|
+
icon: nt(r),
|
|
3242
3246
|
title: ee("Layer", J.common.layerToggle),
|
|
3243
3247
|
onClick: s
|
|
3244
3248
|
}
|
|
3245
3249
|
] };
|
|
3246
3250
|
}
|
|
3247
|
-
function
|
|
3248
|
-
return
|
|
3251
|
+
function mt(e) {
|
|
3252
|
+
return Ke(fe, { iconType: e, size: "sm" });
|
|
3249
3253
|
}
|
|
3250
3254
|
function da() {
|
|
3251
|
-
const e =
|
|
3255
|
+
const e = Ft((i) => i.tool), t = Ft((i) => i.setTool), n = Me((i) => i.mode), s = Me((i) => i.cycleMode), o = (e == null ? void 0 : e.id) ?? "selection", a = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
|
|
3252
3256
|
return { toolbar: [
|
|
3253
3257
|
{
|
|
3254
3258
|
variant: "radio",
|
|
3255
3259
|
id: "selection",
|
|
3256
3260
|
name: "tool",
|
|
3257
|
-
icon:
|
|
3261
|
+
icon: mt("icon-selection"),
|
|
3258
3262
|
title: ee("Selection", J.common.selection),
|
|
3259
3263
|
checked: o === "selection",
|
|
3260
3264
|
onClick: () => t({ id: "selection", label: "Selection" })
|
|
@@ -3264,7 +3268,7 @@ function da() {
|
|
|
3264
3268
|
variant: "radio",
|
|
3265
3269
|
id: "drag-segment",
|
|
3266
3270
|
name: "tool",
|
|
3267
|
-
icon:
|
|
3271
|
+
icon: mt("icon-highlight"),
|
|
3268
3272
|
title: ee("Highlighting", J.number.highlighting),
|
|
3269
3273
|
checked: o === "drag-segment",
|
|
3270
3274
|
onClick: () => t({ id: "drag-segment", label: "Highlighting" })
|
|
@@ -3273,23 +3277,23 @@ function da() {
|
|
|
3273
3277
|
{
|
|
3274
3278
|
variant: "button",
|
|
3275
3279
|
id: "layer-mode",
|
|
3276
|
-
icon:
|
|
3280
|
+
icon: mt(a),
|
|
3277
3281
|
title: ee("Layer", J.common.layerToggle),
|
|
3278
3282
|
onClick: s
|
|
3279
3283
|
}
|
|
3280
3284
|
] };
|
|
3281
3285
|
}
|
|
3282
|
-
function
|
|
3283
|
-
return
|
|
3286
|
+
function Gt(e) {
|
|
3287
|
+
return Ke(fe, { iconType: e, size: "sm" });
|
|
3284
3288
|
}
|
|
3285
3289
|
function ua() {
|
|
3286
|
-
const e =
|
|
3290
|
+
const e = Me((o) => o.mode), t = Me((o) => o.cycleMode), n = e === le.ONLY_ORIGIN ? "icon-bottom-layer" : e === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
|
|
3287
3291
|
return { toolbar: [
|
|
3288
3292
|
{
|
|
3289
3293
|
variant: "radio",
|
|
3290
3294
|
id: "selection",
|
|
3291
3295
|
name: "tool",
|
|
3292
|
-
icon:
|
|
3296
|
+
icon: Gt("icon-selection"),
|
|
3293
3297
|
title: ee("Selection", J.common.selection),
|
|
3294
3298
|
checked: !0,
|
|
3295
3299
|
onClick: () => {
|
|
@@ -3299,7 +3303,7 @@ function ua() {
|
|
|
3299
3303
|
{
|
|
3300
3304
|
variant: "button",
|
|
3301
3305
|
id: "layer-mode",
|
|
3302
|
-
icon:
|
|
3306
|
+
icon: Gt(n),
|
|
3303
3307
|
title: ee("Layer", J.common.layerToggle),
|
|
3304
3308
|
onClick: t
|
|
3305
3309
|
}
|
|
@@ -3308,26 +3312,26 @@ function ua() {
|
|
|
3308
3312
|
function ha() {
|
|
3309
3313
|
return { toolbar: [] };
|
|
3310
3314
|
}
|
|
3311
|
-
function
|
|
3312
|
-
return
|
|
3315
|
+
function gt(e) {
|
|
3316
|
+
return Ke(fe, { iconType: e, size: "sm" });
|
|
3313
3317
|
}
|
|
3314
3318
|
function fa() {
|
|
3315
|
-
const e =
|
|
3319
|
+
const e = wt((l) => l.tool), t = wt((l) => l.setTool), n = Me((l) => l.mode), s = Me((l) => l.cycleMode), o = St((l) => l.toggle), a = (e == null ? void 0 : e.id) ?? "selection", r = n === le.ONLY_ORIGIN ? "icon-bottom-layer" : n === le.ONLY_OVERLAY ? "icon-top-layer" : "icon-all-layer";
|
|
3316
3320
|
return { toolbar: [
|
|
3317
3321
|
{
|
|
3318
3322
|
variant: "radio",
|
|
3319
3323
|
id: "selection",
|
|
3320
3324
|
name: "tool",
|
|
3321
|
-
icon:
|
|
3325
|
+
icon: gt("icon-selection"),
|
|
3322
3326
|
title: ee("Selection", J.common.selection),
|
|
3323
3327
|
checked: a === "selection",
|
|
3324
|
-
onClick: () => t(
|
|
3328
|
+
onClick: () => t(Bt())
|
|
3325
3329
|
},
|
|
3326
3330
|
{ variant: "divider" },
|
|
3327
3331
|
{
|
|
3328
3332
|
variant: "button",
|
|
3329
3333
|
id: "issue",
|
|
3330
|
-
icon:
|
|
3334
|
+
icon: gt("icon-issue"),
|
|
3331
3335
|
title: ee("Issue", J.validation.issue),
|
|
3332
3336
|
onClick: o
|
|
3333
3337
|
},
|
|
@@ -3335,14 +3339,14 @@ function fa() {
|
|
|
3335
3339
|
{
|
|
3336
3340
|
variant: "button",
|
|
3337
3341
|
id: "layer-mode",
|
|
3338
|
-
icon:
|
|
3342
|
+
icon: gt(r),
|
|
3339
3343
|
title: ee("Layer", J.common.layerToggle),
|
|
3340
3344
|
onClick: s
|
|
3341
3345
|
}
|
|
3342
3346
|
] };
|
|
3343
3347
|
}
|
|
3344
3348
|
function ma(e, t) {
|
|
3345
|
-
const n = ra(), s = la(), o = da(), a = ua(),
|
|
3349
|
+
const n = ra(), s = la(), o = da(), a = ua(), r = ha(), i = fa();
|
|
3346
3350
|
if (t)
|
|
3347
3351
|
return i;
|
|
3348
3352
|
switch (e) {
|
|
@@ -3355,7 +3359,7 @@ function ma(e, t) {
|
|
|
3355
3359
|
case "Record":
|
|
3356
3360
|
return a;
|
|
3357
3361
|
case "File":
|
|
3358
|
-
return
|
|
3362
|
+
return r;
|
|
3359
3363
|
default:
|
|
3360
3364
|
return n;
|
|
3361
3365
|
}
|
|
@@ -3377,21 +3381,21 @@ function Sa({
|
|
|
3377
3381
|
verticalNav: n = !1,
|
|
3378
3382
|
children: s
|
|
3379
3383
|
}) {
|
|
3380
|
-
return t ? /* @__PURE__ */
|
|
3384
|
+
return t ? /* @__PURE__ */ u(
|
|
3381
3385
|
"div",
|
|
3382
3386
|
{
|
|
3383
3387
|
className: ge.stickyWrapper,
|
|
3384
3388
|
"data-vertical-nav": n || void 0,
|
|
3385
3389
|
children: /* @__PURE__ */ S("div", { className: ge.toolbarWrapper, children: [
|
|
3386
|
-
e.map((o, a) => /* @__PURE__ */
|
|
3390
|
+
e.map((o, a) => /* @__PURE__ */ u(yn, { item: o }, a)),
|
|
3387
3391
|
s
|
|
3388
3392
|
] })
|
|
3389
3393
|
}
|
|
3390
3394
|
) : null;
|
|
3391
3395
|
}
|
|
3392
|
-
function
|
|
3396
|
+
function yn({ item: e }) {
|
|
3393
3397
|
var t;
|
|
3394
|
-
return e.variant === "divider" ? /* @__PURE__ */
|
|
3398
|
+
return e.variant === "divider" ? /* @__PURE__ */ u("div", { className: ge.divider }) : e.variant === "radio" ? /* @__PURE__ */ u(
|
|
3395
3399
|
"button",
|
|
3396
3400
|
{
|
|
3397
3401
|
className: ge.toolButton,
|
|
@@ -3402,7 +3406,7 @@ function bn({ item: e }) {
|
|
|
3402
3406
|
children: e.icon
|
|
3403
3407
|
}
|
|
3404
3408
|
) : e.variant === "checkbox" ? /* @__PURE__ */ S("label", { className: ge.checkboxItem, title: e.title, children: [
|
|
3405
|
-
/* @__PURE__ */
|
|
3409
|
+
/* @__PURE__ */ u(
|
|
3406
3410
|
"input",
|
|
3407
3411
|
{
|
|
3408
3412
|
type: "checkbox",
|
|
@@ -3414,8 +3418,8 @@ function bn({ item: e }) {
|
|
|
3414
3418
|
}
|
|
3415
3419
|
}
|
|
3416
3420
|
),
|
|
3417
|
-
/* @__PURE__ */
|
|
3418
|
-
] }) : (t = e.subItems) != null && t.length ? /* @__PURE__ */
|
|
3421
|
+
/* @__PURE__ */ u("span", { className: ge.checkboxLabel, children: e.title })
|
|
3422
|
+
] }) : (t = e.subItems) != null && t.length ? /* @__PURE__ */ u(Ma, { item: e }) : /* @__PURE__ */ u(
|
|
3419
3423
|
"button",
|
|
3420
3424
|
{
|
|
3421
3425
|
className: `${ge.toolButton} ${e.slim ? ge.toolButtonSlim : ""}`,
|
|
@@ -3435,7 +3439,7 @@ function Ma({ item: e }) {
|
|
|
3435
3439
|
if (t)
|
|
3436
3440
|
return window.addEventListener("mousedown", o), () => window.removeEventListener("mousedown", o);
|
|
3437
3441
|
}, [t, o]), /* @__PURE__ */ S("div", { className: ge.buttonWithSub, ref: s, children: [
|
|
3438
|
-
/* @__PURE__ */
|
|
3442
|
+
/* @__PURE__ */ u(
|
|
3439
3443
|
"button",
|
|
3440
3444
|
{
|
|
3441
3445
|
className: `${ge.toolButton} ${e.slim ? ge.toolButtonSlim : ""}`,
|
|
@@ -3444,21 +3448,30 @@ function Ma({ item: e }) {
|
|
|
3444
3448
|
disabled: e.disabled,
|
|
3445
3449
|
onClick: () => {
|
|
3446
3450
|
var a;
|
|
3447
|
-
(a = e.onClick) == null || a.call(e), n((
|
|
3451
|
+
(a = e.onClick) == null || a.call(e), n((r) => !r);
|
|
3448
3452
|
},
|
|
3449
3453
|
children: e.icon
|
|
3450
3454
|
}
|
|
3451
3455
|
),
|
|
3452
|
-
t && e.subItems && /* @__PURE__ */
|
|
3456
|
+
t && e.subItems && /* @__PURE__ */ u("div", { className: ge.subToolbar, children: e.subItems.map((a, r) => /* @__PURE__ */ u(yn, { item: a }, r)) })
|
|
3453
3457
|
] });
|
|
3454
3458
|
}
|
|
3455
3459
|
function Ia({ children: e }) {
|
|
3456
|
-
const t = qe((a) => a.mode), n =
|
|
3457
|
-
return /* @__PURE__ */
|
|
3460
|
+
const t = qe((a) => a.mode), n = Et((a) => a.isValidationMode), { toolbar: s } = ma(t, n), o = s.map(Mt);
|
|
3461
|
+
return /* @__PURE__ */ u(Sa, { items: o, children: e });
|
|
3458
3462
|
}
|
|
3459
|
-
function
|
|
3460
|
-
var t;
|
|
3461
|
-
return e.variant === "divider" ? { variant: "divider" } : e.variant === "radio" ? {
|
|
3463
|
+
function Mt(e) {
|
|
3464
|
+
var t, n;
|
|
3465
|
+
return e.variant === "divider" ? { variant: "divider" } : e.variant === "radio" ? (t = e.subButtonItems) != null && t.length ? {
|
|
3466
|
+
variant: "button",
|
|
3467
|
+
id: e.id,
|
|
3468
|
+
icon: e.icon,
|
|
3469
|
+
title: e.title,
|
|
3470
|
+
active: e.checked,
|
|
3471
|
+
disabled: e.disabled,
|
|
3472
|
+
onClick: e.onClick,
|
|
3473
|
+
subItems: e.subButtonItems.map(Mt)
|
|
3474
|
+
} : {
|
|
3462
3475
|
variant: "radio",
|
|
3463
3476
|
id: e.id,
|
|
3464
3477
|
name: e.name,
|
|
@@ -3485,12 +3498,12 @@ function yn(e) {
|
|
|
3485
3498
|
active: e.active,
|
|
3486
3499
|
slim: e.slim,
|
|
3487
3500
|
onClick: e.onClick,
|
|
3488
|
-
subItems: (
|
|
3501
|
+
subItems: (n = e.subItems) == null ? void 0 : n.map(Mt)
|
|
3489
3502
|
};
|
|
3490
3503
|
}
|
|
3491
3504
|
function Na({ indicator: e }) {
|
|
3492
3505
|
return e ? /* @__PURE__ */ S("div", { className: ae.indicator, children: [
|
|
3493
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ u("span", { children: e.title }),
|
|
3494
3507
|
e.subtitle && /* @__PURE__ */ S("span", { children: [
|
|
3495
3508
|
": ",
|
|
3496
3509
|
e.subtitle
|
|
@@ -3509,7 +3522,7 @@ function Na({ indicator: e }) {
|
|
|
3509
3522
|
] }) : null;
|
|
3510
3523
|
}
|
|
3511
3524
|
function ii(e) {
|
|
3512
|
-
return /* @__PURE__ */
|
|
3525
|
+
return /* @__PURE__ */ u(
|
|
3513
3526
|
bo,
|
|
3514
3527
|
{
|
|
3515
3528
|
image: e.image,
|
|
@@ -3549,15 +3562,15 @@ function ii(e) {
|
|
|
3549
3562
|
tools: e.tools,
|
|
3550
3563
|
theme: e.theme,
|
|
3551
3564
|
layout: e.layout,
|
|
3552
|
-
children: /* @__PURE__ */
|
|
3565
|
+
children: /* @__PURE__ */ u(ka, {})
|
|
3553
3566
|
}
|
|
3554
3567
|
);
|
|
3555
3568
|
}
|
|
3556
3569
|
function ka() {
|
|
3557
3570
|
const e = po(), t = e.mode === "readonly", n = e.navVisible && e.layout.navigation !== "hidden", s = e.navDirection, o = n && s === "horizontal" ? "with-nav-left" : n && s === "vertical" ? "with-nav-bottom" : void 0;
|
|
3558
3571
|
return /* @__PURE__ */ S("div", { className: Ze.workspace, "data-layout": o, children: [
|
|
3559
|
-
n && s === "horizontal" && /* @__PURE__ */
|
|
3560
|
-
|
|
3572
|
+
n && s === "horizontal" && /* @__PURE__ */ u(
|
|
3573
|
+
$t,
|
|
3561
3574
|
{
|
|
3562
3575
|
records: e.records,
|
|
3563
3576
|
activeRecordId: e.activeRecordId,
|
|
@@ -3567,7 +3580,7 @@ function ka() {
|
|
|
3567
3580
|
}
|
|
3568
3581
|
),
|
|
3569
3582
|
/* @__PURE__ */ S("div", { className: Ze.mainSection, children: [
|
|
3570
|
-
/* @__PURE__ */
|
|
3583
|
+
/* @__PURE__ */ u(
|
|
3571
3584
|
Yo,
|
|
3572
3585
|
{
|
|
3573
3586
|
viewMode: e.viewMode,
|
|
@@ -3590,7 +3603,7 @@ function ka() {
|
|
|
3590
3603
|
}
|
|
3591
3604
|
),
|
|
3592
3605
|
/* @__PURE__ */ S("div", { className: Ze.canvasArea, children: [
|
|
3593
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ u(
|
|
3594
3607
|
Os,
|
|
3595
3608
|
{
|
|
3596
3609
|
viewMode: e.viewMode,
|
|
@@ -3604,10 +3617,10 @@ function ka() {
|
|
|
3604
3617
|
onFileUpload: e.onFileUpload
|
|
3605
3618
|
}
|
|
3606
3619
|
),
|
|
3607
|
-
!t && e.viewMode !== "Record" && e.viewMode !== "File" && /* @__PURE__ */
|
|
3608
|
-
e.indicator && /* @__PURE__ */
|
|
3620
|
+
!t && e.viewMode !== "Record" && e.viewMode !== "File" && /* @__PURE__ */ u(Ia, {}),
|
|
3621
|
+
e.indicator && /* @__PURE__ */ u(Na, { indicator: e.indicator })
|
|
3609
3622
|
] }),
|
|
3610
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ u("div", { className: Ze.sidePanel, children: /* @__PURE__ */ u(
|
|
3611
3624
|
ia,
|
|
3612
3625
|
{
|
|
3613
3626
|
classes: e.classes,
|
|
@@ -3619,8 +3632,8 @@ function ka() {
|
|
|
3619
3632
|
}
|
|
3620
3633
|
) })
|
|
3621
3634
|
] }),
|
|
3622
|
-
n && s === "vertical" && /* @__PURE__ */
|
|
3623
|
-
|
|
3635
|
+
n && s === "vertical" && /* @__PURE__ */ u(
|
|
3636
|
+
$t,
|
|
3624
3637
|
{
|
|
3625
3638
|
records: e.records,
|
|
3626
3639
|
activeRecordId: e.activeRecordId,
|
|
@@ -3631,15 +3644,15 @@ function ka() {
|
|
|
3631
3644
|
)
|
|
3632
3645
|
] });
|
|
3633
3646
|
}
|
|
3634
|
-
const Oa = "lc-issuePanel-Ji1Oq", Pa = "lc-issuePanelTitle-MnKUa", Ta = "lc-issueCount-xtlWy", Ba = "lc-issueItem-CL2Qq", Ea = "lc-issueHeader-YSNcb", Ra = "lc-issueLabel-K-Klr",
|
|
3647
|
+
const Oa = "lc-issuePanel-Ji1Oq", Pa = "lc-issuePanelTitle-MnKUa", Ta = "lc-issueCount-xtlWy", Ba = "lc-issueItem-CL2Qq", Ea = "lc-issueHeader-YSNcb", Ra = "lc-issueLabel-K-Klr", Aa = "lc-issueBadge-oMlCN", Da = "lc-issueReason-Pof-O", Ha = "lc-issueDate-PZH2G", _a = "lc-validationActions-qtvXO", Va = "lc-validateButton-mhzNq", Za = "lc-reasonInput-WGZ6m", Ua = "lc-emptyState-4wJWu", ie = {
|
|
3635
3648
|
issuePanel: Oa,
|
|
3636
3649
|
issuePanelTitle: Pa,
|
|
3637
3650
|
issueCount: Ta,
|
|
3638
3651
|
issueItem: Ba,
|
|
3639
3652
|
issueHeader: Ea,
|
|
3640
3653
|
issueLabel: Ra,
|
|
3641
|
-
issueBadge:
|
|
3642
|
-
issueReason:
|
|
3654
|
+
issueBadge: Aa,
|
|
3655
|
+
issueReason: Da,
|
|
3643
3656
|
issueDate: Ha,
|
|
3644
3657
|
validationActions: _a,
|
|
3645
3658
|
validateButton: Va,
|
|
@@ -3653,9 +3666,9 @@ function ci({
|
|
|
3653
3666
|
onAnnotationSelect: s,
|
|
3654
3667
|
onValidate: o,
|
|
3655
3668
|
onValidationUpdate: a,
|
|
3656
|
-
onValidationDelete:
|
|
3669
|
+
onValidationDelete: r
|
|
3657
3670
|
}) {
|
|
3658
|
-
const [i, l] = re(""), [
|
|
3671
|
+
const [i, l] = re(""), [g, d] = re(null), c = t.filter((h) => !h.result).length, m = $(async () => {
|
|
3659
3672
|
n && await (o == null ? void 0 : o({
|
|
3660
3673
|
annotationIds: [n],
|
|
3661
3674
|
result: !0
|
|
@@ -3666,76 +3679,76 @@ function ci({
|
|
|
3666
3679
|
result: !1,
|
|
3667
3680
|
reason: i || void 0
|
|
3668
3681
|
})), l(""));
|
|
3669
|
-
}, [n, i, o]),
|
|
3670
|
-
async (
|
|
3671
|
-
await (
|
|
3682
|
+
}, [n, i, o]), f = $(
|
|
3683
|
+
async (h) => {
|
|
3684
|
+
await (r == null ? void 0 : r({ ids: [h] }));
|
|
3672
3685
|
},
|
|
3673
|
-
[
|
|
3686
|
+
[r]
|
|
3674
3687
|
), b = $(
|
|
3675
|
-
(
|
|
3688
|
+
(h) => h.annotationId ? e.find((p) => p.id === h.annotationId) ?? null : null,
|
|
3676
3689
|
[e]
|
|
3677
3690
|
);
|
|
3678
3691
|
return /* @__PURE__ */ S("div", { className: ie.issuePanel, children: [
|
|
3679
3692
|
/* @__PURE__ */ S("div", { className: ie.issuePanelTitle, children: [
|
|
3680
|
-
/* @__PURE__ */
|
|
3681
|
-
|
|
3682
|
-
|
|
3693
|
+
/* @__PURE__ */ u("span", { children: "Validation" }),
|
|
3694
|
+
c > 0 && /* @__PURE__ */ S("span", { className: ie.issueCount, children: [
|
|
3695
|
+
c,
|
|
3683
3696
|
" issues"
|
|
3684
3697
|
] })
|
|
3685
3698
|
] }),
|
|
3686
|
-
t.length === 0 ? /* @__PURE__ */
|
|
3687
|
-
const p = b(
|
|
3699
|
+
t.length === 0 ? /* @__PURE__ */ u("div", { className: ie.emptyState, children: /* @__PURE__ */ u("p", { children: "No validation results yet" }) }) : t.map((h) => {
|
|
3700
|
+
const p = b(h);
|
|
3688
3701
|
return /* @__PURE__ */ S(
|
|
3689
3702
|
"div",
|
|
3690
3703
|
{
|
|
3691
3704
|
className: ie.issueItem,
|
|
3692
|
-
"data-selected":
|
|
3693
|
-
"data-result":
|
|
3705
|
+
"data-selected": g === h.id || void 0,
|
|
3706
|
+
"data-result": h.result ? "pass" : "fail",
|
|
3694
3707
|
onClick: () => {
|
|
3695
|
-
|
|
3708
|
+
d(h.id), p && (s == null || s(p));
|
|
3696
3709
|
},
|
|
3697
3710
|
children: [
|
|
3698
3711
|
/* @__PURE__ */ S("div", { className: ie.issueHeader, children: [
|
|
3699
|
-
/* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
3712
|
+
/* @__PURE__ */ u("span", { className: ie.issueLabel, children: (p == null ? void 0 : p.label.name) ?? `Annotation ${h.annotationId ?? h.id}` }),
|
|
3713
|
+
/* @__PURE__ */ u(
|
|
3701
3714
|
"span",
|
|
3702
3715
|
{
|
|
3703
3716
|
className: ie.issueBadge,
|
|
3704
|
-
"data-result":
|
|
3705
|
-
children:
|
|
3717
|
+
"data-result": h.result ? "pass" : "fail",
|
|
3718
|
+
children: h.result ? "Pass" : "Fail"
|
|
3706
3719
|
}
|
|
3707
3720
|
)
|
|
3708
3721
|
] }),
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3722
|
+
h.reason && /* @__PURE__ */ u("p", { className: ie.issueReason, children: h.reason }),
|
|
3723
|
+
h.validatedAt && /* @__PURE__ */ u("span", { className: ie.issueDate, children: h.validatedAt }),
|
|
3724
|
+
r && /* @__PURE__ */ u(
|
|
3712
3725
|
"button",
|
|
3713
3726
|
{
|
|
3714
3727
|
className: ie.validateButton,
|
|
3715
3728
|
"data-variant": "secondary",
|
|
3716
3729
|
style: { marginTop: "0.25rem", padding: "0.25rem 0.5rem", fontSize: "0.75rem" },
|
|
3717
3730
|
onClick: (N) => {
|
|
3718
|
-
N.stopPropagation(),
|
|
3731
|
+
N.stopPropagation(), f(h.id);
|
|
3719
3732
|
},
|
|
3720
3733
|
children: "Delete"
|
|
3721
3734
|
}
|
|
3722
3735
|
)
|
|
3723
3736
|
]
|
|
3724
3737
|
},
|
|
3725
|
-
|
|
3738
|
+
h.id
|
|
3726
3739
|
);
|
|
3727
3740
|
}),
|
|
3728
|
-
o && /* @__PURE__ */
|
|
3741
|
+
o && /* @__PURE__ */ u("div", { className: ie.validationActions, children: /* @__PURE__ */ u(
|
|
3729
3742
|
"textarea",
|
|
3730
3743
|
{
|
|
3731
3744
|
className: ie.reasonInput,
|
|
3732
3745
|
placeholder: "Reason (optional)...",
|
|
3733
3746
|
value: i,
|
|
3734
|
-
onChange: (
|
|
3747
|
+
onChange: (h) => l(h.target.value)
|
|
3735
3748
|
}
|
|
3736
3749
|
) }),
|
|
3737
3750
|
o && /* @__PURE__ */ S("div", { className: ie.validationActions, children: [
|
|
3738
|
-
/* @__PURE__ */
|
|
3751
|
+
/* @__PURE__ */ u(
|
|
3739
3752
|
"button",
|
|
3740
3753
|
{
|
|
3741
3754
|
className: ie.validateButton,
|
|
@@ -3745,7 +3758,7 @@ function ci({
|
|
|
3745
3758
|
children: "Approve"
|
|
3746
3759
|
}
|
|
3747
3760
|
),
|
|
3748
|
-
/* @__PURE__ */
|
|
3761
|
+
/* @__PURE__ */ u(
|
|
3749
3762
|
"button",
|
|
3750
3763
|
{
|
|
3751
3764
|
className: ie.validateButton,
|
|
@@ -3759,51 +3772,51 @@ function ci({
|
|
|
3759
3772
|
] });
|
|
3760
3773
|
}
|
|
3761
3774
|
function ri() {
|
|
3762
|
-
const e =
|
|
3763
|
-
async (
|
|
3764
|
-
const m =
|
|
3765
|
-
return
|
|
3775
|
+
const e = lt((d) => d.objects), t = lt((d) => d.setObjects), n = Ge((d) => d.level), s = Ge((d) => d.setZoom), o = $(
|
|
3776
|
+
async (d, c) => {
|
|
3777
|
+
const m = Se();
|
|
3778
|
+
return hn(m, d, c);
|
|
3766
3779
|
},
|
|
3767
3780
|
[]
|
|
3768
3781
|
), a = $(
|
|
3769
|
-
async (
|
|
3782
|
+
async (d, c, m) => {
|
|
3770
3783
|
const v = Q();
|
|
3771
3784
|
if (!v) return;
|
|
3772
|
-
const
|
|
3773
|
-
let
|
|
3774
|
-
const p =
|
|
3775
|
-
p === "rect" ?
|
|
3785
|
+
const f = fn(d, c, m), b = await import("fabric");
|
|
3786
|
+
let h = null;
|
|
3787
|
+
const p = f.type;
|
|
3788
|
+
p === "rect" ? h = new b.Rect(f) : p === "polygon" && f.points ? h = new b.Polygon(f.points, f) : p === "path" && f.path ? h = new b.Path(f.path, f) : p === "image" && typeof f.src == "string" && (h = await b.FabricImage.fromURL(f.src, { crossOrigin: "anonymous" }), h.set(f)), h && (v.add(h), ke(v), t(v.getObjects()));
|
|
3776
3789
|
},
|
|
3777
3790
|
[t]
|
|
3778
|
-
),
|
|
3779
|
-
(
|
|
3780
|
-
const
|
|
3781
|
-
if (!
|
|
3782
|
-
const v =
|
|
3783
|
-
v && (
|
|
3791
|
+
), r = $(
|
|
3792
|
+
(d) => {
|
|
3793
|
+
const c = Q();
|
|
3794
|
+
if (!c) return;
|
|
3795
|
+
const v = c.getObjects().find((f) => f.unique === d);
|
|
3796
|
+
v && (c.remove(v), ke(c), t(c.getObjects()));
|
|
3784
3797
|
},
|
|
3785
3798
|
[t]
|
|
3786
3799
|
), i = $(() => {
|
|
3787
|
-
const
|
|
3788
|
-
if (!
|
|
3789
|
-
const
|
|
3790
|
-
for (const m of
|
|
3791
|
-
|
|
3792
|
-
|
|
3800
|
+
const d = Q();
|
|
3801
|
+
if (!d) return;
|
|
3802
|
+
const c = d.getObjects();
|
|
3803
|
+
for (const m of c)
|
|
3804
|
+
d.remove(m);
|
|
3805
|
+
ke(d), t([]);
|
|
3793
3806
|
}, [t]), l = $(
|
|
3794
|
-
async (
|
|
3795
|
-
const m = await o(
|
|
3807
|
+
async (d, c) => {
|
|
3808
|
+
const m = await o(d, c), v = Ue();
|
|
3796
3809
|
return {
|
|
3797
3810
|
annotations: m,
|
|
3798
3811
|
canvasJSON: v,
|
|
3799
|
-
image: { width:
|
|
3812
|
+
image: { width: d, height: c }
|
|
3800
3813
|
};
|
|
3801
3814
|
},
|
|
3802
3815
|
[o]
|
|
3803
|
-
),
|
|
3804
|
-
(
|
|
3805
|
-
const
|
|
3806
|
-
|
|
3816
|
+
), g = $(
|
|
3817
|
+
(d) => {
|
|
3818
|
+
const c = Q();
|
|
3819
|
+
c && (c.setZoom(d), ke(c), s({ level: d, width: c.getWidth(), height: c.getHeight() }));
|
|
3807
3820
|
},
|
|
3808
3821
|
[s]
|
|
3809
3822
|
);
|
|
@@ -3813,47 +3826,47 @@ function ri() {
|
|
|
3813
3826
|
zoom: n,
|
|
3814
3827
|
getAnnotations: o,
|
|
3815
3828
|
addAnnotation: a,
|
|
3816
|
-
removeAnnotation:
|
|
3829
|
+
removeAnnotation: r,
|
|
3817
3830
|
clearCanvas: i,
|
|
3818
3831
|
exportState: l,
|
|
3819
|
-
setZoomLevel:
|
|
3832
|
+
setZoomLevel: g
|
|
3820
3833
|
}),
|
|
3821
|
-
[e, n, o, a,
|
|
3834
|
+
[e, n, o, a, r, i, l, g]
|
|
3822
3835
|
);
|
|
3823
3836
|
}
|
|
3824
3837
|
function li() {
|
|
3825
|
-
const e =
|
|
3826
|
-
const
|
|
3838
|
+
const e = we((c) => c.undoStack), t = we((c) => c.redoStack), n = we((c) => c.setUndoStack), s = we((c) => c.setRedoStack), o = lt((c) => c.setObjects), a = e.length > 0, r = t.length > 0, i = $(() => {
|
|
3839
|
+
const c = Ue(), m = JSON.stringify(c);
|
|
3827
3840
|
n([...e, m]), s([]);
|
|
3828
3841
|
}, [e, n, s]), l = $(async () => {
|
|
3829
3842
|
if (!a) return;
|
|
3830
|
-
const
|
|
3831
|
-
if (!
|
|
3843
|
+
const c = Q();
|
|
3844
|
+
if (!c) return;
|
|
3832
3845
|
const m = JSON.stringify(Ue());
|
|
3833
3846
|
s([...t, m]);
|
|
3834
|
-
const v = [...e],
|
|
3835
|
-
n(v), await
|
|
3836
|
-
}, [a, e, t, n, s, o]),
|
|
3837
|
-
if (!c) return;
|
|
3838
|
-
const r = Q();
|
|
3847
|
+
const v = [...e], f = v.pop();
|
|
3848
|
+
n(v), await c.loadFromJSON(f), ke(c), o(c.getObjects());
|
|
3849
|
+
}, [a, e, t, n, s, o]), g = $(async () => {
|
|
3839
3850
|
if (!r) return;
|
|
3851
|
+
const c = Q();
|
|
3852
|
+
if (!c) return;
|
|
3840
3853
|
const m = JSON.stringify(Ue());
|
|
3841
3854
|
n([...e, m]);
|
|
3842
|
-
const v = [...t],
|
|
3843
|
-
s(v), await
|
|
3844
|
-
}, [
|
|
3855
|
+
const v = [...t], f = v.pop();
|
|
3856
|
+
s(v), await c.loadFromJSON(f), ke(c), o(c.getObjects());
|
|
3857
|
+
}, [r, e, t, n, s, o]), d = $(() => {
|
|
3845
3858
|
n([]), s([]);
|
|
3846
3859
|
}, [n, s]);
|
|
3847
3860
|
return ve(
|
|
3848
3861
|
() => ({
|
|
3849
3862
|
canUndo: a,
|
|
3850
|
-
canRedo:
|
|
3863
|
+
canRedo: r,
|
|
3851
3864
|
undo: l,
|
|
3852
|
-
redo:
|
|
3865
|
+
redo: g,
|
|
3853
3866
|
pushSnapshot: i,
|
|
3854
|
-
clear:
|
|
3867
|
+
clear: d
|
|
3855
3868
|
}),
|
|
3856
|
-
[a,
|
|
3869
|
+
[a, r, l, g, i, d]
|
|
3857
3870
|
);
|
|
3858
3871
|
}
|
|
3859
3872
|
function di(e) {
|
|
@@ -3863,18 +3876,18 @@ function di(e) {
|
|
|
3863
3876
|
annotations: s,
|
|
3864
3877
|
selectedIds: o,
|
|
3865
3878
|
activeTool: a,
|
|
3866
|
-
addAnnotations:
|
|
3879
|
+
addAnnotations: r,
|
|
3867
3880
|
updateAnnotation: i,
|
|
3868
3881
|
removeAnnotations: l,
|
|
3869
|
-
setTool:
|
|
3870
|
-
} = e,
|
|
3871
|
-
() => t.filter((
|
|
3882
|
+
setTool: g
|
|
3883
|
+
} = e, d = ve(
|
|
3884
|
+
() => t.filter((h) => h.slot === "tool"),
|
|
3872
3885
|
[t]
|
|
3873
|
-
),
|
|
3874
|
-
() => t.filter((
|
|
3886
|
+
), c = ve(
|
|
3887
|
+
() => t.filter((h) => h.slot === "sidePanel"),
|
|
3875
3888
|
[t]
|
|
3876
3889
|
), m = ve(
|
|
3877
|
-
() => t.filter((
|
|
3890
|
+
() => t.filter((h) => h.slot === "toolbar"),
|
|
3878
3891
|
[t]
|
|
3879
3892
|
), v = ve(
|
|
3880
3893
|
() => ({
|
|
@@ -3882,70 +3895,70 @@ function di(e) {
|
|
|
3882
3895
|
annotations: s,
|
|
3883
3896
|
selectedIds: o,
|
|
3884
3897
|
activeTool: a,
|
|
3885
|
-
addAnnotations:
|
|
3898
|
+
addAnnotations: r,
|
|
3886
3899
|
updateAnnotation: i,
|
|
3887
3900
|
removeAnnotations: l,
|
|
3888
|
-
setTool:
|
|
3901
|
+
setTool: g,
|
|
3889
3902
|
canvas: {
|
|
3890
3903
|
toJSON: () => Ue(),
|
|
3891
3904
|
getImageDataURL: () => {
|
|
3892
|
-
const
|
|
3893
|
-
return
|
|
3905
|
+
const h = Q();
|
|
3906
|
+
return h ? h.toDataURL({ format: "png", multiplier: 1 }) : "";
|
|
3894
3907
|
}
|
|
3895
3908
|
}
|
|
3896
3909
|
}),
|
|
3897
|
-
[n, s, o, a,
|
|
3898
|
-
),
|
|
3899
|
-
() =>
|
|
3900
|
-
[
|
|
3901
|
-
), b = Ce(
|
|
3902
|
-
return b.current =
|
|
3903
|
-
const
|
|
3904
|
-
if (!
|
|
3905
|
-
const p = (
|
|
3910
|
+
[n, s, o, a, r, i, l, g]
|
|
3911
|
+
), f = ve(
|
|
3912
|
+
() => d.find((h) => h.id === a),
|
|
3913
|
+
[d, a]
|
|
3914
|
+
), b = Ce(f == null ? void 0 : f.canvasHandlers);
|
|
3915
|
+
return b.current = f == null ? void 0 : f.canvasHandlers, ce(() => {
|
|
3916
|
+
const h = Q();
|
|
3917
|
+
if (!h || !b.current) return;
|
|
3918
|
+
const p = (A) => {
|
|
3906
3919
|
var H, w, C, E, _;
|
|
3907
|
-
const k = ((H =
|
|
3920
|
+
const k = ((H = h.getScenePoint) == null ? void 0 : H.call(h, A)) ?? ((w = h.getPointer) == null ? void 0 : w.call(h, A)) ?? { x: 0, y: 0 };
|
|
3908
3921
|
return {
|
|
3909
3922
|
x: k.x,
|
|
3910
3923
|
y: k.y,
|
|
3911
|
-
shiftKey: ((C =
|
|
3912
|
-
ctrlKey: ((E =
|
|
3913
|
-
altKey: ((_ =
|
|
3924
|
+
shiftKey: ((C = A.e) == null ? void 0 : C.shiftKey) ?? !1,
|
|
3925
|
+
ctrlKey: ((E = A.e) == null ? void 0 : E.ctrlKey) ?? !1,
|
|
3926
|
+
altKey: ((_ = A.e) == null ? void 0 : _.altKey) ?? !1
|
|
3914
3927
|
};
|
|
3915
|
-
}, N = (
|
|
3928
|
+
}, N = (A) => {
|
|
3916
3929
|
var k, H;
|
|
3917
|
-
return (H = (k = b.current) == null ? void 0 : k.onMouseDown) == null ? void 0 : H.call(k, p(
|
|
3918
|
-
}, Z = (
|
|
3930
|
+
return (H = (k = b.current) == null ? void 0 : k.onMouseDown) == null ? void 0 : H.call(k, p(A));
|
|
3931
|
+
}, Z = (A) => {
|
|
3919
3932
|
var k, H;
|
|
3920
|
-
return (H = (k = b.current) == null ? void 0 : k.onMouseMove) == null ? void 0 : H.call(k, p(
|
|
3921
|
-
}, V = (
|
|
3933
|
+
return (H = (k = b.current) == null ? void 0 : k.onMouseMove) == null ? void 0 : H.call(k, p(A));
|
|
3934
|
+
}, V = (A) => {
|
|
3922
3935
|
var k, H;
|
|
3923
|
-
return (H = (k = b.current) == null ? void 0 : k.onMouseUp) == null ? void 0 : H.call(k, p(
|
|
3936
|
+
return (H = (k = b.current) == null ? void 0 : k.onMouseUp) == null ? void 0 : H.call(k, p(A));
|
|
3924
3937
|
};
|
|
3925
|
-
return
|
|
3926
|
-
|
|
3938
|
+
return h.on("mouse:down", N), h.on("mouse:move", Z), h.on("mouse:up", V), () => {
|
|
3939
|
+
h.off("mouse:down", N), h.off("mouse:move", Z), h.off("mouse:up", V);
|
|
3927
3940
|
};
|
|
3928
|
-
}, [
|
|
3941
|
+
}, [f == null ? void 0 : f.id]), {
|
|
3929
3942
|
context: v,
|
|
3930
|
-
toolExtensions:
|
|
3931
|
-
sidePanelExtensions:
|
|
3943
|
+
toolExtensions: d,
|
|
3944
|
+
sidePanelExtensions: c,
|
|
3932
3945
|
toolbarExtensions: m,
|
|
3933
|
-
activeToolExtension:
|
|
3946
|
+
activeToolExtension: f
|
|
3934
3947
|
};
|
|
3935
3948
|
}
|
|
3936
3949
|
export {
|
|
3937
3950
|
In as EXCEPTION_TOOLS,
|
|
3938
|
-
|
|
3951
|
+
kt as EXPORT_PROPS,
|
|
3939
3952
|
J as LABELING_SHORTCUTS,
|
|
3940
3953
|
le as LAYER_MODE,
|
|
3941
|
-
|
|
3954
|
+
Xt as LabelingCanvas,
|
|
3942
3955
|
ks as LabelingFileSection,
|
|
3943
3956
|
Sa as LabelingFloatingToolbar,
|
|
3944
3957
|
fe as LabelingIcon,
|
|
3945
3958
|
Na as LabelingIndicator,
|
|
3946
3959
|
ia as LabelingInfoPanel,
|
|
3947
3960
|
ci as LabelingIssuePanel,
|
|
3948
|
-
|
|
3961
|
+
$t as LabelingNavigation,
|
|
3949
3962
|
bs as LabelingNumberSection,
|
|
3950
3963
|
bo as LabelingProvider,
|
|
3951
3964
|
hs as LabelingTextSection,
|
|
@@ -3957,23 +3970,23 @@ export {
|
|
|
3957
3970
|
Fa as TOOL_INFO_BRUSH,
|
|
3958
3971
|
Xa as TOOL_INFO_COMBINED_LABELS,
|
|
3959
3972
|
$a as TOOL_INFO_ERASER,
|
|
3960
|
-
|
|
3973
|
+
Nt as TOOL_INFO_FILLED_BOX,
|
|
3961
3974
|
wn as TOOL_INFO_FILLED_POLYGON,
|
|
3962
|
-
|
|
3975
|
+
vt as TOOL_INFO_MAGIC_BRUSH,
|
|
3963
3976
|
_e as TOOL_INFO_SUPERPIXEL,
|
|
3964
3977
|
za as WORKSPACE_VIEW_MODES,
|
|
3965
|
-
|
|
3978
|
+
fn as annotationToFabricProps,
|
|
3966
3979
|
mo as basicBrushes,
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3980
|
+
Zt as basicColors,
|
|
3981
|
+
dn as blankRectTool,
|
|
3982
|
+
en as brushTool,
|
|
3983
|
+
hn as canvasToAnnotations,
|
|
3984
|
+
on as createImage,
|
|
3972
3985
|
ei as createTemporalHistoryStore,
|
|
3973
|
-
|
|
3986
|
+
sn as cropAlphaArea,
|
|
3974
3987
|
Un as emitLabelEvent,
|
|
3975
3988
|
pe as ensureCanvas,
|
|
3976
|
-
|
|
3989
|
+
tn as eraserTool,
|
|
3977
3990
|
uo as fabricObjectToAnnotation,
|
|
3978
3991
|
to as filledRectTool,
|
|
3979
3992
|
ee as formatShortcutTitle,
|
|
@@ -3981,30 +3994,30 @@ export {
|
|
|
3981
3994
|
Q as getCanvasInstance,
|
|
3982
3995
|
Ue as getCanvasJSON,
|
|
3983
3996
|
ni as getImageToolStore,
|
|
3984
|
-
|
|
3997
|
+
Se as getLabeledObjects,
|
|
3985
3998
|
Jo as getLabelingShortcutKey,
|
|
3986
3999
|
Qa as getToolSelectionStore,
|
|
3987
4000
|
ti as getViewModeStore,
|
|
3988
4001
|
On as loadFabric,
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
4002
|
+
bt as magicbrushTool,
|
|
4003
|
+
an as polygonTool,
|
|
4004
|
+
ke as renderAllSafe,
|
|
3992
4005
|
no as segmentAnythingTool,
|
|
3993
|
-
|
|
3994
|
-
|
|
4006
|
+
Bt as selectionTool,
|
|
4007
|
+
At as setCanvasInstance,
|
|
3995
4008
|
Ja as setMagicBrushModule,
|
|
3996
4009
|
ja as setSuperpixelModules,
|
|
3997
4010
|
Zn as subscribeLabelEvents,
|
|
3998
|
-
|
|
3999
|
-
|
|
4011
|
+
un as superpixelTool,
|
|
4012
|
+
it as toHex,
|
|
4000
4013
|
qa as toRGBAHex,
|
|
4001
|
-
|
|
4002
|
-
|
|
4014
|
+
nn as toRgba,
|
|
4015
|
+
Tt as toRgbaArray,
|
|
4003
4016
|
Ka as transparentBlackPixel,
|
|
4004
|
-
|
|
4005
|
-
|
|
4017
|
+
Lt as useBrushStore,
|
|
4018
|
+
lt as useCanvasObjectsStore,
|
|
4006
4019
|
di as useExtensions,
|
|
4007
|
-
|
|
4020
|
+
wt as useImageToolStore,
|
|
4008
4021
|
St as useIssuePanelStore,
|
|
4009
4022
|
Qo as useKeyboardShortcuts,
|
|
4010
4023
|
oi as useLabelBatchStore,
|
|
@@ -4015,18 +4028,18 @@ export {
|
|
|
4015
4028
|
li as useLabelingHistory,
|
|
4016
4029
|
ts as useLabelingTools,
|
|
4017
4030
|
ma as useLabelingUIMeta,
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4031
|
+
Me as useLayerModeStore,
|
|
4032
|
+
Cn as useNumberSegmentSelectionStore,
|
|
4033
|
+
Ft as useNumberToolStore,
|
|
4034
|
+
rt as useOpacityStore,
|
|
4022
4035
|
We as usePaletteStore,
|
|
4023
|
-
|
|
4036
|
+
gn as useSelectedObjectsStore,
|
|
4024
4037
|
vo as useTextAutoHighlightStore,
|
|
4025
|
-
|
|
4026
|
-
|
|
4038
|
+
vn as useTextSegmentSelectionStore,
|
|
4039
|
+
zt as useTextToolStore,
|
|
4027
4040
|
Ko as useToolInit,
|
|
4028
|
-
|
|
4029
|
-
|
|
4041
|
+
we as useToolSelectionStore,
|
|
4042
|
+
Et as useValidationModeStore,
|
|
4030
4043
|
qe as useViewModeStore,
|
|
4031
4044
|
Co as useWorkspaceLayoutStore,
|
|
4032
4045
|
Ge as useZoomStore
|