@glodon-aiot/dataset-annotation 3.3.7-beta.2 → 3.3.8

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.
@@ -2,29 +2,29 @@ var ft = Object.defineProperty, ht = Object.defineProperties;
2
2
  var ut = Object.getOwnPropertyDescriptors;
3
3
  var we = Object.getOwnPropertySymbols;
4
4
  var mt = Object.prototype.hasOwnProperty, pt = Object.prototype.propertyIsEnumerable;
5
- var ze = (x, f, r) => f in x ? ft(x, f, { enumerable: !0, configurable: !0, writable: !0, value: r }) : x[f] = r, b = (x, f) => {
6
- for (var r in f || (f = {}))
7
- mt.call(f, r) && ze(x, r, f[r]);
5
+ var Ee = (T, f, l) => f in T ? ft(T, f, { enumerable: !0, configurable: !0, writable: !0, value: l }) : T[f] = l, g = (T, f) => {
6
+ for (var l in f || (f = {}))
7
+ mt.call(f, l) && Ee(T, l, f[l]);
8
8
  if (we)
9
- for (var r of we(f))
10
- pt.call(f, r) && ze(x, r, f[r]);
11
- return x;
12
- }, y = (x, f) => ht(x, ut(f));
9
+ for (var l of we(f))
10
+ pt.call(f, l) && Ee(T, l, f[l]);
11
+ return T;
12
+ }, y = (T, f) => ht(T, ut(f));
13
13
  import { jsx as o, jsxs as v, Fragment as he } from "react/jsx-runtime";
14
- import { useRef as gt, useState as d, useEffect as h } from "react";
15
- import { message as K, ConfigProvider as bt, Space as ee, Select as vt, Button as M, Tabs as St, Col as Ct, Tooltip as It, Empty as yt, Spin as Lt, Modal as kt } from "antd";
14
+ import { useRef as bt, useState as d, useEffect as h } from "react";
15
+ import { message as K, ConfigProvider as gt, Space as ee, Select as vt, Button as M, Tabs as Ct, Col as St, Tooltip as yt, Empty as It, Spin as Lt, Modal as kt } from "antd";
16
16
  import Dt from "rc-virtual-list";
17
- import { UploadZipsStatus as U, PreLabelTaskStatus as xt } from "@glodon-aiot/apis";
18
- import Tt from "antd/es/locale/zh_CN";
19
- import Vt from "../../DatasetContext/index.mjs";
17
+ import { UploadZipsStatus as U, PreLabelTaskStatus as Tt } from "@glodon-aiot/apis";
18
+ import Vt from "antd/es/locale/zh_CN";
19
+ import xt from "../../DatasetContext/index.mjs";
20
20
  import Nt from "./icon_item_empty.svg.mjs";
21
21
  import "./style.less.mjs";
22
- import { tagColors as Ee } from "../../utils/index.mjs";
22
+ import { tagColors as ze } from "../../utils/index.mjs";
23
23
  import Pt from "./components/ImageDetail/index.mjs";
24
24
  import wt from "./components/Labels/index.mjs";
25
- import { useKeyPress as zt } from "ahooks";
25
+ import { useKeyPress as Et } from "ahooks";
26
26
  import Ae from "./components/DisabledTooltip/index.mjs";
27
- import Et from "./PreSamplesPage/index.mjs";
27
+ import zt from "./PreSamplesPage/index.mjs";
28
28
  import { SearchOutlined as At } from "@ant-design/icons";
29
29
  import Mt from "../../Common/Page/index.mjs";
30
30
  import Rt from "../PicZipImportModal/index.mjs";
@@ -35,277 +35,273 @@ import { Prompt as Ft } from "../hooks/Prompt.mjs";
35
35
  import Kt from "../PreLabelOCR/index.mjs";
36
36
  import Ut from "lodash/merge";
37
37
  import { DEFAULT_FILTER_SWITCH as jt } from "../../constant.mjs";
38
- const gi = (x) => {
38
+ const bi = (T) => {
39
39
  var Ne;
40
40
  const {
41
41
  services: f,
42
- datasetId: r,
42
+ datasetId: l,
43
43
  versionId: G,
44
44
  backTo: Me,
45
45
  labelManager: ue = !1,
46
46
  datasetManager: m = !1,
47
47
  annotation: Re,
48
- header: L = {
48
+ header: I = {
49
49
  versionSelect: !1
50
50
  },
51
51
  exampleSrcRoot: Be
52
- } = x, j = b({}, jt);
53
- Ut(j, x.filterSwitch);
54
- const Z = gt(null), [S, me] = d(), [i, $] = d(), [J, Oe] = d([]), [pe, ge] = d(!1), [B, be] = d(0), [I, te] = d(""), [O, ve] = d(0), [He, Fe] = d(), [Se, ie] = d(!1), [Ce, Ke] = d(!1), [Ie, Ue] = d(!0), [je, Ze] = d(!1), [P, ye] = d([]), [g, H] = d([]), [w, Q] = d(!1), [ne, le] = d(!1), [W, T] = d(-1), [p, k] = d(), [c, z] = d(), [n, N] = d({
52
+ } = T, j = g({}, jt);
53
+ Ut(j, T.filterSwitch);
54
+ const Z = bt(null), [C, me] = d(), [i, $] = d(), [J, Oe] = d([]), [pe, be] = d(!1), [B, ge] = d(0), [S, te] = d(""), [O, ve] = d(0), [He, Fe] = d(), [Ce, ie] = d(!1), [Se, Ke] = d(!1), [ye, Ue] = d(!0), [je, Ze] = d(!1), [P, Ie] = d([]), [b, H] = d([]), [w, Q] = d(!1), [ne, le] = d(!1), [W, V] = d(-1), [p, L] = d(), [a, E] = d(), [r, N] = d({
55
55
  current: 0,
56
56
  pageSize: 100
57
- }), [F, re] = d([]), [R, $e] = d(""), [We, qe] = d(!1), [Le, ke] = d(), [X, oe] = d(null), [V, De] = d(!1), [_e, xe] = d(!1), [Ge, Je] = d(0), [Qe, se] = d(""), [q, Xe] = d(""), [Ye, et] = d(), E = () => {
58
- k(void 0), z(void 0), T(-1), Q(!1), Y(), setTimeout(() => {
59
- N((e) => y(b({}, e), {
57
+ }), [F, re] = d([]), [R, $e] = d(""), [We, qe] = d(!1), [Le, ke] = d(), [X, oe] = d(null), [x, De] = d(!1), [_e, Te] = d(!1), [Ge, Je] = d(0), [Qe, se] = d(""), [q, Xe] = d(""), [Ye, et] = d(), z = () => {
58
+ L(void 0), E(void 0), V(-1), Q(!1), Y(), setTimeout(() => {
59
+ N((e) => y(g({}, e), {
60
60
  current: 1,
61
61
  type: void 0
62
62
  }));
63
63
  }, 10);
64
64
  };
65
- zt("Esc", E), h(() => {
66
- r && f.cvforceDatahub.getS3Iam(r).then((e) => {
65
+ Et("Esc", z), h(() => {
66
+ l && f.cvforceDatahub.getS3Iam(l).then((e) => {
67
67
  Fe(e);
68
68
  });
69
- }, [r]), h(() => {
69
+ }, [l]), h(() => {
70
70
  f.cvforceDatahub && f.cvforceDatahub.getOptionsImgproxy().then((e) => et(e));
71
71
  }, [f.cvforceDatahub]), h(() => {
72
72
  D();
73
73
  }, [i == null ? void 0 : i.id]), h(() => {
74
- r && (ge(!0), Promise.all([
74
+ l && (be(!0), Promise.all([
75
75
  // 数据集
76
- f.cvforceDatahub.getDatasetsId(r).then((e) => {
76
+ f.cvforceDatahub.getDatasetsId(l).then((e) => {
77
77
  me(e);
78
78
  }),
79
79
  // 版本列表
80
- f.cvforceDatahub.getDatasetsIdVersions(r, 1, 1e3).then((e) => {
80
+ f.cvforceDatahub.getDatasetsIdVersions(l, 1, 1e3).then((e) => {
81
81
  Oe(e.recordList), $(G ? e.recordList.find((t) => t.id === G) : e.recordList[0]);
82
82
  })
83
- ]).finally(() => ge(!1)));
84
- }, [r, G]);
85
- const Te = () => {
86
- !r || !i || f.cvforceDatahub.getDatasetsIdVersionsVid(r, i.id).then((e) => {
83
+ ]).finally(() => be(!1)));
84
+ }, [l, G]);
85
+ const Ve = () => {
86
+ !l || !i || f.cvforceDatahub.getDatasetsIdVersionsVid(l, i.id).then((e) => {
87
87
  $(e), $e(e.versionAsyncTask.state);
88
88
  });
89
89
  };
90
90
  h(() => {
91
91
  R !== U.Pending && R !== U.Started || K.warning("文件导入中,请刷新页面再试");
92
92
  }, [R]), h(() => {
93
- $(void 0), N(y(b({}, n), {
93
+ $(void 0), N(y(g({}, r), {
94
94
  current: 1
95
- })), H([]), Te();
96
- }, [r, G]), h(() => {
97
- r && f.cvforceDatahub.getDatasetsId(r).then((e) => {
95
+ })), H([]), Ve();
96
+ }, [l, G]), h(() => {
97
+ l && f.cvforceDatahub.getDatasetsId(l).then((e) => {
98
98
  me(e);
99
99
  });
100
- }, [r]), h(() => {
100
+ }, [l]), h(() => {
101
101
  Y();
102
102
  }, [F, i]), h(() => {
103
- !i || !S || A(y(b({}, n), {
103
+ !i || !C || A(y(g({}, r), {
104
104
  current: 1
105
105
  })).then((e) => {
106
106
  });
107
- }, [S == null ? void 0 : S.id, i == null ? void 0 : i.id, F]), h(() => {
107
+ }, [C == null ? void 0 : C.id, i == null ? void 0 : i.id, F]), h(() => {
108
108
  A().then((e) => {
109
109
  }), D();
110
- }, [n.current]), h(() => {
111
- V && D();
110
+ }, [r.current]), h(() => {
111
+ x && D();
112
112
  }, [Le]), h(() => {
113
- A(y(b({}, n), {
113
+ A(y(g({}, r), {
114
114
  current: 1,
115
115
  total: void 0
116
116
  })).then((e) => {
117
- e && p && (Array.isArray(e) && e.length ? (T(0), k(e[0]), z(void 0)) : E());
117
+ e && p && (Array.isArray(e) && e.length ? (V(0), L(e[0]), E(void 0)) : z());
118
118
  });
119
- }, [I]), h(() => {
120
- ne || k(void 0);
119
+ }, [S]), h(() => {
120
+ ne || L(void 0);
121
121
  }, [ne]), h(() => {
122
122
  !w && p && Q(!0);
123
123
  }, [p]), h(() => {
124
- !g.length && w && E();
125
- }, [g.length, w]), h(() => {
126
- Ze(!Ie && Ce);
127
- }, [Ie, Ce]), h(() => {
128
- if (!r) {
124
+ !b.length && w && z();
125
+ }, [b.length, w]), h(() => {
126
+ Ze(!ye && Se);
127
+ }, [ye, Se]), h(() => {
128
+ if (!l) {
129
129
  X && (clearTimeout(X), oe(null)), ke(void 0);
130
130
  return;
131
131
  }
132
- ae();
133
- }, [r, i == null ? void 0 : i.id]), h(() => {
134
- ae();
135
- }, [We]), h(() => {
136
132
  ce();
137
- }, [V, r, i]), h(() => {
138
- A(y(b({}, n), {
133
+ }, [l, i == null ? void 0 : i.id]), h(() => {
134
+ ce();
135
+ }, [We]), h(() => {
136
+ ae();
137
+ }, [x, l, i]), h(() => {
138
+ A(y(g({}, r), {
139
139
  current: 1
140
140
  })), D();
141
141
  }, [q]), h(() => {
142
142
  se("");
143
143
  }, [p]);
144
- const ce = () => {
145
- i && f.cvforceDatahub.getDatasetsIdVersionsVidSamples(r, i.id, {
144
+ const ae = () => {
145
+ i && f.cvforceDatahub.getDatasetsIdVersionsVidSamples(l, i.id, {
146
146
  pageNo: 1,
147
147
  pageSize: 1e3,
148
148
  confirmStatus: 1
149
149
  }).then((e) => {
150
150
  Je(e.recordList.length);
151
151
  });
152
- }, ae = () => {
153
- !r || !i || f.cvforceDatahub.getPreLabelTask(r, i.id).then((e) => {
152
+ }, ce = () => {
153
+ !l || !i || f.cvforceDatahub.getPreLabelTask(l, i.id).then((e) => {
154
154
  const t = e[0];
155
- if (ke(t), X && (clearTimeout(X), oe(null)), !(t != null && t.state) || t.state !== xt.Started) {
155
+ if (ke(t), X && (clearTimeout(X), oe(null)), !(t != null && t.state) || t.state !== Tt.Started) {
156
156
  De(!1), D();
157
157
  return;
158
158
  } else
159
159
  De(!0);
160
160
  oe(setTimeout(() => {
161
- ae();
161
+ ce();
162
162
  }, 1e4));
163
163
  });
164
164
  };
165
165
  h(() => {
166
- S && S.markType !== "detection" && console.error("当前数据集不是detection(物体检测)类型,请检查数据集类型。");
167
- }, [S]);
166
+ C && C.markType !== "detection" && console.error("当前数据集不是detection(物体检测)类型,请检查数据集类型。");
167
+ }, [C]);
168
168
  const A = (e, t) => {
169
- const s = (e == null ? void 0 : e.current) || n.current, l = (e == null ? void 0 : e.pageSize) || n.pageSize;
170
- if (!r || !i || !s)
169
+ const s = (e == null ? void 0 : e.current) || r.current, n = (e == null ? void 0 : e.pageSize) || r.pageSize;
170
+ if (!l || !i || !s)
171
171
  return Promise.resolve(!1);
172
- const a = F.map((C) => C.label), u = () => {
173
- switch (I) {
172
+ const c = F.map((k) => k.label), u = () => {
173
+ switch (S) {
174
174
  case "nocode":
175
175
  return "nocode";
176
176
  case "hascode":
177
- return a.length ? a : "hascode";
177
+ return c.length ? c : "hascode";
178
178
  default:
179
- return a.length ? a : void 0;
179
+ return c.length ? c : void 0;
180
180
  }
181
181
  };
182
- return s === 1 && ct(), N(y(b({}, n), {
182
+ return s === 1 && at(), N(y(g({}, r), {
183
183
  current: s,
184
- pageSize: l
185
- })), f.cvforceDatahub.getDatasetsIdVersionsVidSamples(r, i.id, {
184
+ pageSize: n
185
+ })), f.cvforceDatahub.getDatasetsIdVersionsVidSamples(l, i.id, {
186
186
  pageNo: s,
187
- pageSize: l,
187
+ pageSize: n,
188
188
  labels: u(),
189
189
  searchName: q
190
- }).then((C) => {
191
- const _ = C.recordList || [], Pe = s === 1 ? _ : [...t || g, ..._];
192
- if (H(Pe), N(y(b({}, n), {
190
+ }).then((k) => {
191
+ const _ = k.recordList || [], Pe = s === 1 ? _ : [...t || b, ..._];
192
+ if (H(Pe), N(y(g({}, r), {
193
193
  current: s,
194
- pageSize: l,
195
- total: C.totalResults
196
- })), n.type === "next" && _.length) {
197
- T(0);
198
- const fe = C.recordList[0];
199
- k(fe);
194
+ pageSize: n,
195
+ total: k.totalResults
196
+ })), r.type === "next" && _.length) {
197
+ V(0);
198
+ const fe = k.recordList[0];
199
+ L(fe);
200
200
  }
201
- if (n.type === "prev" && _.length) {
202
- T(n.pageSize - 1);
203
- const fe = C.recordList[n.pageSize - 1];
204
- k(fe);
201
+ if (r.type === "prev" && _.length) {
202
+ V(r.pageSize - 1);
203
+ const fe = k.recordList[r.pageSize - 1];
204
+ L(fe);
205
205
  }
206
- return w && W < 0 && (T(0), k(_[0]), le(!0)), Pe;
206
+ return w && W < 0 && (V(0), L(_[0]), le(!0)), Pe;
207
207
  }).catch(() => !1);
208
208
  };
209
209
  h(() => {
210
- N(I === "nocode" ? y(b({}, n), {
210
+ N(S === "nocode" ? y(g({}, r), {
211
211
  total: B
212
- }) : I === "" ? y(b({}, n), {
212
+ }) : S === "" ? y(g({}, r), {
213
213
  total: O
214
- }) : y(b({}, n), {
214
+ }) : y(g({}, r), {
215
215
  total: O - B
216
216
  }));
217
217
  }, [B, O]);
218
218
  const D = () => {
219
- !r || !i || f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, i.id, {
219
+ !l || !i || f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(l, i.id, {
220
220
  label: "allcode",
221
221
  searchName: q
222
222
  }).then((e) => {
223
- const t = e.find((l) => l.id === "allcodeid"), s = e.find((l) => l.id === "nocodeid");
224
- ve(t ? t.count : 0), be(s ? s.count : 0);
223
+ const t = e.find((n) => n.id === "allcodeid"), s = e.find((n) => n.id === "nocodeid");
224
+ ve(t ? t.count : 0), ge(s ? s.count : 0);
225
225
  });
226
226
  }, Y = () => {
227
- if (!(!r || !(i != null && i.id)))
228
- return f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, i.id).then((e) => {
229
- const s = (e || []).filter((l) => l.label !== "nocode").map((l, a) => ({
230
- label: l.label,
231
- count: l.count,
232
- id: l.id,
233
- color: Ee[a % 40]
227
+ if (!(!l || !(i != null && i.id)))
228
+ return f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(l, i.id).then((e) => {
229
+ const s = (e || []).filter((n) => n.label !== "nocode").map((n, c) => ({
230
+ label: n.label,
231
+ count: n.count,
232
+ id: n.id,
233
+ color: ze[c % 40]
234
234
  }));
235
- return ye(s), e;
235
+ return Ie(s), e;
236
236
  });
237
237
  }, tt = (e) => {
238
- if (!g)
238
+ if (!b)
239
239
  return;
240
- T(e);
241
- const t = g[e];
242
- k(t), le(!0);
240
+ V(e);
241
+ const t = b[e];
242
+ L(t), le(!0);
243
243
  };
244
244
  h(() => {
245
- n.type || A();
246
- }, [n.type]), h(() => {
247
- if (!c)
245
+ r.type || A();
246
+ }, [r.type]), h(() => {
247
+ if (!a)
248
248
  return;
249
249
  const e = [];
250
- c == null || c.labels.forEach((t) => {
250
+ a == null || a.labels.forEach((t) => {
251
251
  P != null && P.find((s) => s.id === t.id) && e.push(t);
252
- }), c.labels = e, z(c);
252
+ }), a.labels = e, E(a);
253
253
  }, [P]);
254
- const Ve = () => {
255
- if (g)
254
+ const xe = () => {
255
+ if (b)
256
256
  return de().then((e) => (e && (D(), H((t) => {
257
257
  let s;
258
258
  if (Array.isArray(t)) {
259
259
  if (!t.length)
260
- return E(), t;
261
- const l = !c || c.labels.length && I === "hascode" || !c.labels.length && I === "nocode" || I === "" ? W + 1 : W;
262
- if (c && (c.labels.length && I === "nocode" || !c.labels.length && I === "hascode")) {
263
- const a = t.findIndex((u) => u.id === c.id);
264
- a > -1 && (t.splice(a, 1), s = [...t], n.total && (n.total = n.total - 1));
260
+ return z(), t;
261
+ const n = !a || a.labels.length && S === "hascode" || !a.labels.length && S === "nocode" || S === "" ? W + 1 : W;
262
+ if (a && (a.labels.length && S === "nocode" || !a.labels.length && S === "hascode")) {
263
+ const c = t.findIndex((u) => u.id === a.id);
264
+ c > -1 && (t.splice(c, 1), s = [...t], r.total && (r.total = r.total - 1));
265
265
  }
266
- if (l >= t.length) {
267
- const a = (n.current - 1) * n.pageSize + l;
268
- n.total && a >= n.total ? K.error("已经是最后一个了") : A({
269
- current: n.current + 1,
270
- pageSize: n.pageSize,
271
- type: "next"
272
- }, t).then((u) => {
273
- T(l);
274
- const C = u[l];
275
- k(C), z(void 0);
276
- });
277
- } else
278
- setTimeout(() => {
279
- T(l);
280
- const a = t[l];
281
- k(a), z(void 0);
282
- }, 200);
266
+ n >= t.length ? r.total && n >= r.total ? K.error("已经是最后一个了") : A({
267
+ current: r.current + 1,
268
+ pageSize: r.pageSize,
269
+ type: "next"
270
+ }, t).then((c) => {
271
+ V(n);
272
+ const u = c[n];
273
+ L(u), E(void 0);
274
+ }) : setTimeout(() => {
275
+ V(n);
276
+ const c = t[n];
277
+ L(c), E(void 0);
278
+ }, 200);
283
279
  }
284
280
  return s || t;
285
281
  })), e));
286
282
  }, it = () => {
287
- g && de().then((e) => {
283
+ b && de().then((e) => {
288
284
  e && (D(), H((t) => {
289
285
  let s;
290
286
  if (Array.isArray(t)) {
291
287
  if (!t.length)
292
- return E(), t;
293
- const l = W - 1;
294
- if (l < 0)
295
- (n.current - 1) * n.pageSize + l < 0 ? K.error("已经是第一个了") : N({
296
- current: n.current - 1,
297
- pageSize: n.pageSize,
288
+ return z(), t;
289
+ const n = W - 1;
290
+ if (n < 0)
291
+ n < 0 ? K.error("已经是第一个了") : N({
292
+ current: r.current - 1,
293
+ pageSize: r.pageSize,
298
294
  type: "prev"
299
295
  });
300
296
  else {
301
- if (c && (c.labels.length && I === "nocode" || !c.labels.length && I === "hascode")) {
302
- const a = t.findIndex((u) => u.id === c.id);
303
- a > -1 && (t.splice(a, 1), s = [...t], n.total && (n.total = n.total - 1));
297
+ if (a && (a.labels.length && S === "nocode" || !a.labels.length && S === "hascode")) {
298
+ const c = t.findIndex((u) => u.id === a.id);
299
+ c > -1 && (t.splice(c, 1), s = [...t], r.total && (r.total = r.total - 1));
304
300
  }
305
301
  setTimeout(() => {
306
- T(l);
307
- const a = t[l];
308
- k(a), z(void 0);
302
+ V(n);
303
+ const c = t[n];
304
+ L(c), E(void 0);
309
305
  }, 200);
310
306
  }
311
307
  }
@@ -313,32 +309,32 @@ const gi = (x) => {
313
309
  }));
314
310
  });
315
311
  }, nt = (e) => {
316
- const t = Object.keys(e.labels.reduce((s, l) => (s[l.label] ? ++s[l.label] : s[l.label] = 1, s), {})).length;
312
+ const t = Object.keys(e.labels.reduce((s, n) => (s[n.label] ? ++s[n.label] : s[n.label] = 1, s), {})).length;
317
313
  return t >= 2 ? `+${t - 1}` : null;
318
314
  }, lt = (e) => {
319
315
  var t;
320
- (!n.total || n.total > g.length) && e.currentTarget.scrollHeight - e.currentTarget.scrollTop === ((t = Z.current) == null ? void 0 : t.clientHeight) && N(y(b({}, n), {
321
- current: n.current + 1
316
+ (!r.total || r.total > b.length) && e.currentTarget.scrollHeight - e.currentTarget.scrollTop === ((t = Z.current) == null ? void 0 : t.clientHeight) && N(y(g({}, r), {
317
+ current: r.current + 1
322
318
  }));
323
- }, de = () => i ? c && !V ? (c.labels && (c.labels = c.labels.filter((e) => !!e.id)), f.cvforceDatahub.updateSamples(r, i.id, [c], 0).then(() => (K.success({
319
+ }, de = () => i ? a && !x ? (a.labels && (a.labels = a.labels.filter((e) => !!e.id)), f.cvforceDatahub.updateSamples(l, i.id, [a], 0).then(() => (K.success({
324
320
  content: "保存成功"
325
321
  }), H((e) => {
326
- const t = e.findIndex((s) => s.id === (c == null ? void 0 : c.id));
327
- return t > -1 && (e[t] = c), [...e];
322
+ const t = e.findIndex((s) => s.id === (a == null ? void 0 : a.id));
323
+ return t > -1 && (e[t] = a), [...e];
328
324
  }), !0)).catch(() => !1)) : Promise.resolve(!0) : Promise.resolve(!1), rt = () => {
329
- if (c && c.labels.some((e) => !e.id))
325
+ if (a && a.labels.some((e) => !e.id))
330
326
  return K.error("所有标注需设置标签"), Promise.resolve(!1);
331
- Ve();
327
+ xe();
332
328
  }, ot = () => {
333
329
  kt.confirm({
334
330
  title: "确认要删除当前数据吗?",
335
331
  content: "数据包含当前标注的内容和图片,删除后无法恢复,请确认是否删除!",
336
332
  onOk: () => {
337
- !p || !i || f.cvforceDatahub.delDatasetsIdVersionsVidSamplesId(r, i.id, p.id).then(() => {
338
- const e = g.findIndex((t) => t.id === p.id);
339
- g.splice(e, 1), H([...g]), N(y(b({}, n), {
340
- total: n.total ? n.total - 1 : 0
341
- })), e <= g.length - 1 ? k(g[e]) : (k(g[e - 1]), T(e - 1)), D(), z(void 0), n.total && n.total - 1 === 0 && E();
333
+ !p || !i || f.cvforceDatahub.delDatasetsIdVersionsVidSamplesId(l, i.id, p.id).then(() => {
334
+ const e = b.findIndex((t) => t.id === p.id);
335
+ b.splice(e, 1), H([...b]), N(y(g({}, r), {
336
+ total: r.total ? r.total - 1 : 0
337
+ })), e <= b.length - 1 ? L(b[e]) : (L(b[e - 1]), V(e - 1)), D(), E(void 0), r.total && r.total - 1 === 0 && z();
342
338
  });
343
339
  }
344
340
  });
@@ -354,64 +350,64 @@ const gi = (x) => {
354
350
  key: "hascode",
355
351
  label: `已标注(${O - B})`,
356
352
  children: null
357
- }], ct = () => {
353
+ }], at = () => {
358
354
  var e, t;
359
355
  (t = (e = Z.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || t.scrollTo({
360
356
  top: 0
361
357
  });
362
- }, at = () => {
363
- xe(!0);
358
+ }, ct = () => {
359
+ Te(!0);
364
360
  }, dt = (e) => {
365
361
  Xe(e);
366
362
  };
367
- return /* @__PURE__ */ o(bt, {
368
- locale: Tt,
369
- children: /* @__PURE__ */ o(Vt.Provider, {
363
+ return /* @__PURE__ */ o(gt, {
364
+ locale: Vt,
365
+ children: /* @__PURE__ */ o(xt.Provider, {
370
366
  value: {
371
- datasetId: r,
367
+ datasetId: l,
372
368
  versionId: (i == null ? void 0 : i.id) || "",
373
369
  no: (i == null ? void 0 : i.no) || "",
374
370
  loading: pe,
375
371
  version: i,
376
372
  versions: J,
377
- samples: g,
378
- pagination: n,
373
+ samples: b,
374
+ pagination: r,
379
375
  services: f,
380
376
  featuresConfig: {
381
377
  labelManager: ue,
382
378
  datasetManager: m,
383
379
  annotation: Re,
384
380
  filterSwitch: j,
385
- header: L,
381
+ header: I,
386
382
  exampleSrcRoot: Be
387
383
  }
388
384
  },
389
- children: S ? S.markType === "detection" ? /* @__PURE__ */ o("div", {
385
+ children: C ? C.markType === "detection" ? /* @__PURE__ */ o("div", {
390
386
  className: "detection-version-detail",
391
- children: _e ? i != null && i.id && m && m.preLabel ? /* @__PURE__ */ o(Et, {
392
- datasetId: r,
387
+ children: _e ? i != null && i.id && m && m.preLabel ? /* @__PURE__ */ o(zt, {
388
+ datasetId: l,
393
389
  versionId: i.id,
394
390
  onClose: () => {
395
- xe(!1), ce(), Y(), D(), A();
391
+ Te(!1), ae(), Y(), D(), A();
396
392
  },
397
- samples: g,
393
+ samples: b,
398
394
  labels: P,
399
- fetchLength: ce
395
+ fetchLength: ae
400
396
  }) : null : /* @__PURE__ */ v(Mt, {
401
397
  className: "product-details-page",
402
- header: L === !1 ? void 0 : /* @__PURE__ */ o(Bt, {
398
+ header: I === !1 ? void 0 : /* @__PURE__ */ o(Bt, {
403
399
  backTo: Me,
404
- onBackClick: L != null && L.onBackClick ? () => {
405
- p && E(), L.onBackClick && L.onBackClick();
400
+ onBackClick: I != null && I.onBackClick ? () => {
401
+ p && z(), I.onBackClick && I.onBackClick();
406
402
  } : void 0,
407
403
  left: !pe && /* @__PURE__ */ v(ee, {
408
404
  children: [/* @__PURE__ */ o("span", {
409
405
  style: {
410
406
  fontWeight: "bold"
411
407
  },
412
- children: S == null ? void 0 : S.name
408
+ children: C == null ? void 0 : C.name
413
409
  }), /* @__PURE__ */ o(vt, {
414
- disabled: w || (L == null ? void 0 : L.versionSelect) === !1,
410
+ disabled: w || (I == null ? void 0 : I.versionSelect) === !1,
415
411
  value: i == null ? void 0 : i.id,
416
412
  style: {
417
413
  width: 70
@@ -421,47 +417,47 @@ const gi = (x) => {
421
417
  value: e.id
422
418
  })),
423
419
  onChange: (e) => {
424
- const t = J.find((l) => l.id === e);
425
- if (!S || !t)
420
+ const t = J.find((n) => n.id === e);
421
+ if (!C || !t)
426
422
  return;
427
- const s = J.find((l) => l.id === t.id);
428
- $(s), L != null && L.onVersionChange && L.onVersionChange(s);
423
+ const s = J.find((n) => n.id === t.id);
424
+ $(s), I != null && I.onVersionChange && I.onVersionChange(s);
429
425
  }
430
426
  })]
431
427
  }),
432
428
  right: /* @__PURE__ */ v(ee, {
433
429
  children: [!p && m && m.add && /* @__PURE__ */ o(Ae, {
434
- isPreLabel: V,
430
+ isPreLabel: x,
435
431
  placement: "bottom",
436
432
  children: /* @__PURE__ */ o(M, {
437
433
  type: "default",
438
434
  onClick: () => ie(!0),
439
- disabled: R === U.Pending || R === U.Started || V,
435
+ disabled: R === U.Pending || R === U.Started || x,
440
436
  children: "导入数据"
441
437
  }, "del")
442
438
  }), !p && m && m.preLabel && (i != null && i.id) ? /* @__PURE__ */ v(he, {
443
439
  children: [/* @__PURE__ */ o(Kt, {
444
- datasetId: r,
440
+ datasetId: l,
445
441
  versionId: i.id,
446
- disabled: !g.length,
442
+ disabled: !b.length,
447
443
  setIsTaskChange: qe,
448
444
  datasetType: "detection",
449
445
  preLabelTask: Le
450
446
  }), /* @__PURE__ */ o(M, {
451
- disabled: V || !Ge,
452
- onClick: at,
447
+ disabled: x || !Ge,
448
+ onClick: ct,
453
449
  children: "待确认标注"
454
450
  })]
455
451
  }) : null, /* @__PURE__ */ o(Ft, {
456
452
  when: je,
457
453
  content: "确认要离开此页面吗?",
458
454
  subContent: "离开此页面后,将结束导入,放弃未上传的文件,请谨慎操作!"
459
- }), Se && /* @__PURE__ */ o(Rt, {
455
+ }), Ce && /* @__PURE__ */ o(Rt, {
460
456
  datasetIam: He,
461
- datasetId: r,
457
+ datasetId: l,
462
458
  currentVersion: i,
463
- tenCode: S == null ? void 0 : S.tenantCode,
464
- isVisible: Se,
459
+ tenCode: C == null ? void 0 : C.tenantCode,
460
+ isVisible: Ce,
465
461
  setIsVisible: ie,
466
462
  getVersionListRequest: D,
467
463
  setIsConfirm: Ue,
@@ -472,25 +468,25 @@ const gi = (x) => {
472
468
  var e, t;
473
469
  i != null && i.id && ((t = (e = Z.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || t.scrollTo({
474
470
  top: 0
475
- }), A(y(b({}, n), {
471
+ }), A(y(g({}, r), {
476
472
  current: 1
477
473
  })));
478
474
  },
479
- loadVersionData: Te
475
+ loadVersionData: Ve
480
476
  })]
481
477
  })
482
478
  }),
483
479
  children: [/* @__PURE__ */ v("div", {
484
480
  className: "detection-header",
485
481
  children: [/* @__PURE__ */ v(ee, {
486
- children: [j.tabs && /* @__PURE__ */ o(St, {
482
+ children: [j.tabs && /* @__PURE__ */ o(Ct, {
487
483
  className: "header-tab",
488
- activeKey: I,
484
+ activeKey: S,
489
485
  items: st,
490
486
  onChange: (e) => {
491
- c ? (de().then((t) => {
487
+ a ? (de().then((t) => {
492
488
  t ? (te(e), D()) : K.error("保存失败");
493
- }), Q(!1)) : (N(y(b({}, n), {
489
+ }), Q(!1)) : (N(y(g({}, r), {
494
490
  current: 1,
495
491
  total: void 0
496
492
  })), te(e)), e === "nocode" && re([]);
@@ -503,28 +499,28 @@ const gi = (x) => {
503
499
  allowClear: !0
504
500
  })]
505
501
  }), /* @__PURE__ */ o(Ae, {
506
- isPreLabel: V,
502
+ isPreLabel: x,
507
503
  children: /* @__PURE__ */ v(ee, {
508
504
  children: [w ? /* @__PURE__ */ v(he, {
509
505
  children: [m && m.label ? /* @__PURE__ */ o(M, {
510
506
  type: "primary",
511
507
  onClick: () => rt(),
512
- disabled: V,
508
+ disabled: x,
513
509
  children: "保存"
514
510
  }) : null, /* @__PURE__ */ o(M, {
515
- onClick: E,
511
+ onClick: z,
516
512
  children: "退出"
517
513
  })]
518
514
  }) : m && m.label && /* @__PURE__ */ o(M, {
519
515
  type: "primary",
520
- disabled: !B || V,
516
+ disabled: !B || x,
521
517
  onClick: () => {
522
- p || te("nocode"), Q(!0), T(-1), I === "nocode" && (T(0), k(g[0]));
518
+ p || te("nocode"), Q(!0), V(-1), S === "nocode" && (V(0), L(b[0]));
523
519
  },
524
520
  children: "单张标注"
525
521
  }), w && m && m.delete && /* @__PURE__ */ o(M, {
526
522
  onClick: ot,
527
- disabled: V,
523
+ disabled: x,
528
524
  children: "删除数据"
529
525
  })]
530
526
  })
@@ -535,52 +531,52 @@ const gi = (x) => {
535
531
  className: "d-right",
536
532
  ref: Z,
537
533
  children: [p && /* @__PURE__ */ o(Pt, {
538
- datasetId: r,
534
+ datasetId: l,
539
535
  isImageDetailVisible: ne,
540
536
  setIsImageDetailVisible: le,
541
- currentSample: c != null ? c : p,
537
+ currentSample: a != null ? a : p,
542
538
  labels: P,
543
539
  editing: w,
544
- onChange: z,
545
- onNextClick: () => Ve(),
540
+ onChange: E,
541
+ onNextClick: () => xe(),
546
542
  onPrevClick: () => it(),
547
543
  onRefresh: () => {
548
544
  var e;
549
545
  (e = Y()) == null || e.then((t) => {
550
- var s, l;
551
- if (c) {
552
- const a = [];
553
- (s = c.labels) == null || s.forEach((u) => {
554
- t != null && t.find((C) => C.id === u.id) && a.push(u);
555
- }), c.labels = a, z(b({}, c));
546
+ var s, n;
547
+ if (a) {
548
+ const c = [];
549
+ (s = a.labels) == null || s.forEach((u) => {
550
+ t != null && t.find((k) => k.id === u.id) && c.push(u);
551
+ }), a.labels = c, E(g({}, a));
556
552
  }
557
553
  if (p) {
558
- const a = [];
559
- (l = p.labels) == null || l.forEach((u) => {
560
- t != null && t.find((C) => C.id === u.id) && a.push(u);
561
- }), p.labels = a, k(b({}, p));
554
+ const c = [];
555
+ (n = p.labels) == null || n.forEach((u) => {
556
+ t != null && t.find((k) => k.id === u.id) && c.push(u);
557
+ }), p.labels = c, L(g({}, p));
562
558
  }
563
559
  }), D();
564
560
  },
565
- isPreLabel: V,
561
+ isPreLabel: x,
566
562
  imgCount: {
567
563
  total: O,
568
564
  index: W + 1
569
565
  },
570
566
  settingHide: !ue,
571
567
  readonly: m === !1 || m && m.label === !1
572
- }), p ? /* @__PURE__ */ o("div", {}) : n.total !== void 0 && n.total > 0 ? /* @__PURE__ */ o(he, {
568
+ }), p ? /* @__PURE__ */ o("div", {}) : r.total !== void 0 && r.total > 0 ? /* @__PURE__ */ o(he, {
573
569
  children: /* @__PURE__ */ o(Dt, {
574
570
  innerProps: {
575
571
  className: "d-right-row"
576
572
  },
577
- data: g,
573
+ data: b,
578
574
  itemKey: "id",
579
575
  height: (Ne = Z.current) == null ? void 0 : Ne.clientHeight,
580
576
  onScroll: lt,
581
577
  children: (e, t) => {
582
578
  var s;
583
- return /* @__PURE__ */ o(Ct, {
579
+ return /* @__PURE__ */ o(St, {
584
580
  className: "d-right-col",
585
581
  children: /* @__PURE__ */ v("div", {
586
582
  className: "right-col-wrapper",
@@ -605,12 +601,12 @@ const gi = (x) => {
605
601
  })]
606
602
  }), /* @__PURE__ */ v("div", {
607
603
  className: "right-col-text",
608
- children: [(s = e.labels) != null && s.length ? /* @__PURE__ */ o(It, {
604
+ children: [(s = e.labels) != null && s.length ? /* @__PURE__ */ o(yt, {
609
605
  placement: "top",
610
606
  title: /* @__PURE__ */ o("div", {
611
- children: Object.keys(e.labels.reduce((l, a) => (l[a.label] ? ++l[a.label] : l[a.label] = 1, l), {})).map((l) => /* @__PURE__ */ o("div", {
612
- children: l
613
- }, l))
607
+ children: Object.keys(e.labels.reduce((n, c) => (n[c.label] ? ++n[c.label] : n[c.label] = 1, n), {})).map((n) => /* @__PURE__ */ o("div", {
608
+ children: n
609
+ }, n))
614
610
  }),
615
611
  children: /* @__PURE__ */ v("div", {
616
612
  style: {
@@ -650,10 +646,10 @@ const gi = (x) => {
650
646
  })
651
647
  }) : /* @__PURE__ */ o("div", {
652
648
  className: "empty",
653
- children: n.total === 0 ? /* @__PURE__ */ o(yt, {
649
+ children: r.total === 0 ? /* @__PURE__ */ o(It, {
654
650
  image: Nt,
655
651
  description: /* @__PURE__ */ v("span", {
656
- children: ["暂无数据", I !== "hascode" && !q && /* @__PURE__ */ o("span", {
652
+ children: ["暂无数据", S !== "hascode" && !q && /* @__PURE__ */ o("span", {
657
653
  children: m && m.add && /* @__PURE__ */ v(M, {
658
654
  type: "link",
659
655
  size: "small",
@@ -673,27 +669,27 @@ const gi = (x) => {
673
669
  })
674
670
  }) : /* @__PURE__ */ o(Lt, {})
675
671
  })]
676
- }), I !== "nocode" && !p && j.labels && /* @__PURE__ */ o("div", {
672
+ }), S !== "nocode" && !p && j.labels && /* @__PURE__ */ o("div", {
677
673
  className: "d-sider",
678
674
  children: /* @__PURE__ */ o(wt, {
679
- datasetId: r,
675
+ datasetId: l,
680
676
  data: P || [],
681
677
  selected: F,
682
678
  onSelectedChange: (e) => {
683
679
  re((P == null ? void 0 : P.filter((t) => e.find((s) => s.label === t.label))) || []);
684
680
  },
685
681
  onListChange: (e) => {
686
- i && (f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(r, i.id).then((t) => {
687
- const l = (t || []).filter((u) => u.label !== "nocode").map((u, C) => ({
682
+ i && (f.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(l, i.id).then((t) => {
683
+ const n = (t || []).filter((u) => u.label !== "nocode").map((u, k) => ({
688
684
  label: u.label,
689
685
  count: u.count,
690
686
  id: u.id,
691
- color: Ee[C % 40]
692
- })), a = F.filter((u) => l.some((C) => C.id === u.id));
693
- ye(l), F.length !== a.length && re(a);
687
+ color: ze[k % 40]
688
+ })), c = F.filter((u) => n.some((k) => k.id === u.id));
689
+ Ie(n), F.length !== c.length && re(c);
694
690
  }), D());
695
691
  },
696
- isPreLabel: V
692
+ isPreLabel: x
697
693
  })
698
694
  })]
699
695
  })]
@@ -709,5 +705,5 @@ const gi = (x) => {
709
705
  });
710
706
  };
711
707
  export {
712
- gi as default
708
+ bi as default
713
709
  };