@glodon-aiot/dataset-annotation 3.19.1 → 3.19.2-alpha.1

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,14 +2,14 @@ var Ke = Object.defineProperty, Ze = Object.defineProperties;
2
2
  var _e = Object.getOwnPropertyDescriptors;
3
3
  var me = Object.getOwnPropertySymbols;
4
4
  var Oe = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
5
- var fe = (f, l, t) => l in f ? Ke(f, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[l] = t, p = (f, l) => {
6
- for (var t in l || (l = {}))
7
- Oe.call(l, t) && fe(f, t, l[t]);
5
+ var fe = (f, s, t) => s in f ? Ke(f, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[s] = t, p = (f, s) => {
6
+ for (var t in s || (s = {}))
7
+ Oe.call(s, t) && fe(f, t, s[t]);
8
8
  if (me)
9
- for (var t of me(l))
10
- $e.call(l, t) && fe(f, t, l[t]);
9
+ for (var t of me(s))
10
+ $e.call(s, t) && fe(f, t, s[t]);
11
11
  return f;
12
- }, b = (f, l) => Ze(f, _e(l));
12
+ }, b = (f, s) => Ze(f, _e(s));
13
13
  import { jsx as i, jsxs as I, Fragment as je } from "react/jsx-runtime";
14
14
  import { useState as c, useRef as he, useLayoutEffect as qe, useEffect as g } from "react";
15
15
  import { message as J, ConfigProvider as We, Space as K, Select as Ge, Button as Q, Tabs as Je, Col as Qe, Empty as Xe } from "antd";
@@ -29,7 +29,7 @@ import { Prompt as at } from "../hooks/Prompt.mjs";
29
29
  import dt from "../DetectionAnnotation/icon_item_empty.svg.mjs";
30
30
  const Tt = (f) => {
31
31
  const {
32
- services: l,
32
+ services: s,
33
33
  datasetId: t,
34
34
  versionId: N,
35
35
  backTo: pe,
@@ -42,11 +42,11 @@ const Tt = (f) => {
42
42
  exampleSrcRoot: Se,
43
43
  apiUrl: be,
44
44
  token: Ie,
45
- getToken: ye
46
- } = f, [s, Z] = c(), [r, L] = c(), [F, X] = c([]), [Y, H] = c(!1), [Ce, ee] = c(!1), [U, B] = c(!1), [ke, P] = c("preview"), [_, te] = c(0), [m, Ve] = c([]), [O, D] = c(), [Le, re] = c(), [$, w] = c(-1), [o, M] = c({
45
+ getToken: ke
46
+ } = f, [o, Z] = c(), [r, L] = c(), [F, X] = c([]), [Y, H] = c(!1), [ye, ee] = c(!1), [U, B] = c(!1), [Ce, P] = c("preview"), [_, te] = c(0), [m, Ve] = c([]), [O, D] = c(), [Le, re] = c(), [$, w] = c(-1), [l, M] = c({
47
47
  current: 0,
48
48
  pageSize: 100
49
- }), [ne, ie] = c(0), [z, j] = c(""), [y, De] = c(""), [we, Me] = c(), [oe, q] = c(!1), [le, Te] = c(!1), [se, xe] = c(!0), [Ne, ze] = c(!1), W = he(null), [Ee, Re] = c(0), ce = he(-1), G = p({}, lt);
49
+ }), [ne, ie] = c(0), [z, j] = c(""), [k, De] = c(""), [we, Me] = c(), [oe, q] = c(!1), [le, Te] = c(!1), [se, xe] = c(!0), [Ne, ze] = c(!1), W = he(null), [Ee, Re] = c(0), ce = he(-1), G = p({}, lt);
50
50
  tt(G, f.filterSwitch), qe(() => {
51
51
  const e = W.current;
52
52
  if (!e)
@@ -54,8 +54,8 @@ const Tt = (f) => {
54
54
  let n = 0;
55
55
  const a = () => {
56
56
  cancelAnimationFrame(n), n = requestAnimationFrame(() => {
57
- const C = e.clientHeight, k = Math.max(1, Math.round(C));
58
- k !== ce.current && (ce.current = k, Re(k));
57
+ const y = e.clientHeight, C = Math.max(1, Math.round(y));
58
+ C !== ce.current && (ce.current = C, Re(C));
59
59
  });
60
60
  };
61
61
  a();
@@ -65,7 +65,7 @@ const Tt = (f) => {
65
65
  return h == null || h.addEventListener("resize", a), window.addEventListener("resize", a), () => {
66
66
  cancelAnimationFrame(n), d == null || d.disconnect(), h == null || h.removeEventListener("resize", a), window.removeEventListener("resize", a);
67
67
  };
68
- }, [s]);
68
+ }, [o]);
69
69
  const Ae = () => {
70
70
  j("nocode"), P("annotation"), B(!0);
71
71
  }, Fe = (e) => {
@@ -76,58 +76,58 @@ const Tt = (f) => {
76
76
  D(n), P("preview"), B(!0);
77
77
  };
78
78
  g(() => {
79
- t && l.cvforceDatahub.getS3Iam(t).then((e) => {
79
+ t && s.cvforceDatahub.getS3Iam(t).then((e) => {
80
80
  Me(e);
81
81
  });
82
82
  }, [t]), g(() => {
83
83
  !t || r || (H(!0), Promise.all([
84
84
  // 数据集
85
- l.cvforceDatahub.getDatasetsId(t).then((e) => {
85
+ s.cvforceDatahub.getDatasetsId(t).then((e) => {
86
86
  Z(e);
87
87
  }),
88
88
  // 版本列表
89
- l.cvforceDatahub.getDatasetsIdVersions(t, 1, 1e3).then((e) => {
89
+ s.cvforceDatahub.getDatasetsIdVersions(t, 1, 1e3).then((e) => {
90
90
  X(e.recordList), L(N ? e.recordList.find((n) => n.id === N) : e.recordList[0]);
91
91
  })
92
92
  ]).finally(() => H(!1)));
93
93
  }, [t, r == null ? void 0 : r.id]), g(() => {
94
94
  t && (H(!0), Promise.all([
95
95
  // 数据集
96
- l.cvforceDatahub.getDatasetsId(t).then((e) => {
96
+ s.cvforceDatahub.getDatasetsId(t).then((e) => {
97
97
  Z(e);
98
98
  }),
99
99
  // 版本列表
100
- l.cvforceDatahub.getDatasetsIdVersions(t, 1, 1e3).then((e) => {
100
+ s.cvforceDatahub.getDatasetsIdVersions(t, 1, 1e3).then((e) => {
101
101
  X(e.recordList), L(N ? e.recordList.find((n) => n.id === N) : e.recordList[0]);
102
102
  })
103
103
  ]).finally(() => H(!1)));
104
104
  }, [t, N]), g(() => {
105
- t && l.cvforceDatahub.getDatasetsId(t).then((e) => {
105
+ t && s.cvforceDatahub.getDatasetsId(t).then((e) => {
106
106
  Z(e);
107
107
  });
108
108
  }, []);
109
109
  const ae = () => {
110
- !t || !r || l.cvforceDatahub.getDatasetsIdVersionsVid(t, r.id).then((e) => {
110
+ !t || !r || s.cvforceDatahub.getDatasetsIdVersionsVid(t, r.id).then((e) => {
111
111
  L(e), De(e.versionAsyncTask.state);
112
112
  });
113
113
  };
114
114
  g(() => {
115
115
  ae();
116
116
  }, [t, r == null ? void 0 : r.id]), g(() => {
117
- y !== x.Pending && y !== x.Started || J.warning("文件导入中,请刷新页面再试");
118
- }, [y]), g(() => {
117
+ k !== x.Pending && k !== x.Started || J.warning("文件导入中,请刷新页面再试");
118
+ }, [k]), g(() => {
119
119
  ze(!se && le);
120
120
  }, [se, le]);
121
121
  const E = () => {
122
- !t || !r || l.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(t, r.id).then((e) => {
122
+ !t || !r || s.cvforceDatahub.getDatasetsIdVersionsVidLabelcount(t, r.id).then((e) => {
123
123
  const n = e.find((d) => d.id === "allcodeid"), a = e.find((d) => d.id === "nocodeid");
124
124
  te(n ? n.count : 0), ie(a ? a.count : 0);
125
125
  });
126
126
  }, T = (e, n) => {
127
- const a = (e == null ? void 0 : e.current) || o.current, d = (e == null ? void 0 : e.pageSize) || o.pageSize, h = (e == null ? void 0 : e.type) || o.type, C = n || m || [];
127
+ const a = (e == null ? void 0 : e.current) || l.current, d = (e == null ? void 0 : e.pageSize) || l.pageSize, h = (e == null ? void 0 : e.type) || l.type, y = n || m || [];
128
128
  if (!t || !r || !a)
129
129
  return Promise.resolve(!1);
130
- const k = () => {
130
+ const C = () => {
131
131
  switch (z) {
132
132
  case "nocode":
133
133
  return "nocode";
@@ -137,22 +137,22 @@ const Tt = (f) => {
137
137
  return;
138
138
  }
139
139
  };
140
- return a === 1 && de(), M(b(p({}, o), {
140
+ return a === 1 && de(), M(b(p({}, l), {
141
141
  current: a,
142
142
  pageSize: d
143
- })), ee(!0), l.cvforceDatahub.getDatasetsIdVersionsVidSamples(t, r.id, {
143
+ })), ee(!0), s.cvforceDatahub.getDatasetsIdVersionsVidSamples(t, r.id, {
144
144
  pageNo: a,
145
145
  pageSize: d,
146
- labels: k()
146
+ labels: C()
147
147
  }).then((R) => {
148
- const v = R.recordList || [], A = a === 1 ? v : h === "prev" ? [...v, ...C] : [...C, ...v];
149
- if (Ve(A), M(b(p({}, o), {
148
+ const v = R.recordList || [], A = a === 1 ? v : h === "prev" ? [...v, ...y] : [...y, ...v];
149
+ if (Ve(A), M(b(p({}, l), {
150
150
  current: a,
151
151
  pageSize: d,
152
152
  type: void 0,
153
153
  total: R.totalResults
154
154
  })), h === "next" && v.length) {
155
- const V = C.length;
155
+ const V = y.length;
156
156
  w(V), D(v[0]);
157
157
  }
158
158
  if (h === "prev" && v.length) {
@@ -163,15 +163,15 @@ const Tt = (f) => {
163
163
  }).catch(() => !1).finally(() => ee(!1));
164
164
  };
165
165
  g(() => {
166
- !r || !s || (T(b(p({}, o), {
166
+ !r || !o || (T(b(p({}, l), {
167
167
  current: 1
168
168
  })).then((e) => {
169
169
  }), E());
170
- }, [s == null ? void 0 : s.id, r == null ? void 0 : r.id]), g(() => {
170
+ }, [o == null ? void 0 : o.id, r == null ? void 0 : r.id]), g(() => {
171
171
  T().then((e) => {
172
172
  }), E();
173
- }, [o.current]), g(() => {
174
- T(b(p({}, o), {
173
+ }, [l.current]), g(() => {
174
+ T(b(p({}, l), {
175
175
  current: 1,
176
176
  total: void 0
177
177
  })).then((e) => {
@@ -182,9 +182,9 @@ const Tt = (f) => {
182
182
  return;
183
183
  const e = $ + 1;
184
184
  if (e >= m.length)
185
- o.total && e >= o.total ? J.error("已经是最后一个了") : M({
186
- current: o.current + 1,
187
- pageSize: o.pageSize,
185
+ l.total && e >= l.total ? J.error("已经是最后一个了") : M({
186
+ current: l.current + 1,
187
+ pageSize: l.pageSize,
188
188
  type: "next"
189
189
  });
190
190
  else {
@@ -198,8 +198,8 @@ const Tt = (f) => {
198
198
  const e = $ - 1;
199
199
  if (e < 0)
200
200
  e < 0 ? J.error("已经是第一个了") : M({
201
- current: o.current - 1,
202
- pageSize: o.pageSize,
201
+ current: l.current - 1,
202
+ pageSize: l.pageSize,
203
203
  type: "prev"
204
204
  });
205
205
  else {
@@ -223,9 +223,9 @@ const Tt = (f) => {
223
223
  g(() => {
224
224
  U || (D(void 0), w(-1), re(void 0), P("preview"));
225
225
  }, [U]), g(() => {
226
- s && s.markType !== "vlm" && console.error(`当前数据集不是vlm类型,请检查数据集类型。
226
+ o && o.markType !== "vlm" && console.error(`当前数据集不是vlm类型,请检查数据集类型。
227
227
  请检查markType是否为vlm。`);
228
- }, [s]);
228
+ }, [o]);
229
229
  const de = () => {
230
230
  var e, n;
231
231
  (n = (e = W.current) == null ? void 0 : e.getElementsByClassName("rc-virtual-list-holder")[0]) == null || n.scrollTo({
@@ -237,8 +237,8 @@ const Tt = (f) => {
237
237
  scrollTop: n,
238
238
  scrollHeight: a,
239
239
  clientHeight: d
240
- } = e.currentTarget, h = a - n - d, C = 3, k = (v = o.pageSize) != null ? v : 100, R = (A = o.current) != null ? A : 0;
241
- R >= 1 && m.length > 0 && m.length < R * k || (!o.total || o.total > m.length) && h <= C && M((V) => {
240
+ } = e.currentTarget, h = a - n - d, y = 3, C = (v = l.pageSize) != null ? v : 100, R = (A = l.current) != null ? A : 0;
241
+ R >= 1 && m.length > 0 && m.length < R * C || (!l.total || l.total > m.length) && h <= y && M((V) => {
242
242
  var ue;
243
243
  return b(p({}, V), {
244
244
  current: ((ue = V.current) != null ? ue : 0) + 1
@@ -256,10 +256,10 @@ const Tt = (f) => {
256
256
  version: r,
257
257
  versions: F,
258
258
  samples: m,
259
- pagination: o,
260
- services: l,
259
+ pagination: l,
260
+ services: s,
261
261
  token: Ie,
262
- getToken: ye,
262
+ getToken: ke,
263
263
  apiUrl: be,
264
264
  featuresConfig: {
265
265
  labelManager: ge,
@@ -270,7 +270,7 @@ const Tt = (f) => {
270
270
  exampleSrcRoot: Se
271
271
  }
272
272
  },
273
- children: s ? s.markType === "vlm" ? /* @__PURE__ */ I("div", {
273
+ children: o ? o.markType === "vlm" ? /* @__PURE__ */ I("div", {
274
274
  className: "vlm-version-detail",
275
275
  children: [/* @__PURE__ */ I(nt, {
276
276
  className: "product-details-page",
@@ -284,7 +284,7 @@ const Tt = (f) => {
284
284
  style: {
285
285
  fontWeight: "bold"
286
286
  },
287
- children: s == null ? void 0 : s.name
287
+ children: o == null ? void 0 : o.name
288
288
  }), /* @__PURE__ */ i(Ge, {
289
289
  disabled: (u == null ? void 0 : u.versionSelect) === !1,
290
290
  value: r == null ? void 0 : r.id,
@@ -297,7 +297,7 @@ const Tt = (f) => {
297
297
  })),
298
298
  onChange: (e) => {
299
299
  const n = F.find((d) => d.id === e);
300
- if (!s || !n)
300
+ if (!o || !n)
301
301
  return;
302
302
  const a = F.find((d) => d.id === n.id);
303
303
  L(a), u != null && u.onVersionChange && u.onVersionChange(a);
@@ -312,7 +312,7 @@ const Tt = (f) => {
312
312
  /* @__PURE__ */ i(Q, {
313
313
  type: "default",
314
314
  onClick: () => q(!0),
315
- disabled: y === x.Pending || y === x.Started,
315
+ disabled: k === x.Pending || k === x.Started,
316
316
  children: "导入数据"
317
317
  }, "del"), /* @__PURE__ */ i(at, {
318
318
  when: Ne,
@@ -322,9 +322,9 @@ const Tt = (f) => {
322
322
  datasetIam: we,
323
323
  datasetId: t,
324
324
  currentVersion: r,
325
- tenCode: s == null ? void 0 : s.tenantCode,
326
- markType: s.markType,
327
- vlmMarkTmpl: s == null ? void 0 : s.vlmMarkTmpl,
325
+ tenCode: o == null ? void 0 : o.tenantCode,
326
+ markType: o.markType,
327
+ vlmMarkTmpl: o == null ? void 0 : o.vlmMarkTmpl,
328
328
  isVisible: oe,
329
329
  setIsVisible: q,
330
330
  getVersionListRequest: E,
@@ -333,7 +333,7 @@ const Tt = (f) => {
333
333
  Te(e);
334
334
  },
335
335
  tableReload: () => {
336
- r != null && r.id && (de(), T(b(p({}, o), {
336
+ r != null && r.id && (de(), T(b(p({}, l), {
337
337
  current: 1
338
338
  })));
339
339
  },
@@ -349,7 +349,7 @@ const Tt = (f) => {
349
349
  className: "header-tab",
350
350
  activeKey: z,
351
351
  onChange: (e) => {
352
- M(b(p({}, o), {
352
+ M(b(p({}, l), {
353
353
  current: 1
354
354
  // total: 0,
355
355
  })), j(e);
@@ -372,7 +372,7 @@ const Tt = (f) => {
372
372
  children: /* @__PURE__ */ i("div", {
373
373
  className: "d-right",
374
374
  ref: W,
375
- children: O ? /* @__PURE__ */ i("div", {}) : o.total !== void 0 && o.total > 0 ? /* @__PURE__ */ i(je, {
375
+ children: O ? /* @__PURE__ */ i("div", {}) : l.total !== void 0 && l.total > 0 ? /* @__PURE__ */ i(je, {
376
376
  children: /* @__PURE__ */ i(rt, {
377
377
  innerProps: {
378
378
  className: "d-right-row"
@@ -404,7 +404,7 @@ const Tt = (f) => {
404
404
  })
405
405
  }) : /* @__PURE__ */ i("div", {
406
406
  className: "empty",
407
- children: o.total === 0 ? /* @__PURE__ */ i(Xe, {
407
+ children: l.total === 0 ? /* @__PURE__ */ i(Xe, {
408
408
  image: dt,
409
409
  description: /* @__PURE__ */ I("span", {
410
410
  children: ["暂无数据", z !== "hascode" && /* @__PURE__ */ i("span", {
@@ -415,7 +415,7 @@ const Tt = (f) => {
415
415
  padding: 0
416
416
  },
417
417
  onClick: () => q(!0),
418
- disabled: y === x.Pending || y === x.Started,
418
+ disabled: k === x.Pending || k === x.Started,
419
419
  children: [/* @__PURE__ */ i("span", {
420
420
  style: {
421
421
  color: "black"
@@ -430,41 +430,42 @@ const Tt = (f) => {
430
430
  })
431
431
  })]
432
432
  }), U && /* @__PURE__ */ i(et, {
433
+ vlmMarkTmpl: o == null ? void 0 : o.vlmMarkTmpl,
433
434
  isVlmModalVisible: U,
434
435
  setIsVlmModalVisible: B,
435
436
  record: O,
436
437
  onNextClick: () => He(),
437
438
  onPrevClick: () => Ue(),
438
- listLoading: Ce,
439
- ocrMarkTmpl: s == null ? void 0 : s.ocrMarkTmpl,
439
+ listLoading: ye,
440
+ ocrMarkTmpl: o == null ? void 0 : o.ocrMarkTmpl,
440
441
  datasetId: t,
441
442
  versionId: r == null ? void 0 : r.id,
442
- initialMode: ke,
443
+ initialMode: Ce,
443
444
  filterMode: z,
444
445
  onFilterModeChange: (e) => {
445
446
  j(e);
446
447
  },
447
448
  samples: m,
448
- pagination: o,
449
+ pagination: l,
449
450
  currentIndex: $,
450
451
  handleMarkClick: (e) => {
451
452
  re(e), P("annotation");
452
453
  },
453
454
  updateSampleList: () => {
454
- T(b(p({}, o), {
455
+ T(b(p({}, l), {
455
456
  current: 1
456
457
  })), E();
457
458
  },
458
459
  selectSampleId: Le,
459
460
  onClose: () => {
460
- T(b(p({}, o), {
461
+ T(b(p({}, l), {
461
462
  current: 1
462
463
  })), E(), B(!1);
463
464
  },
464
465
  onSave: (e) => {
465
466
  if (!t || !r)
466
467
  throw "datasetId or version is not exist.";
467
- return l.cvforceDatahub.updateSamples(t, r.id, [p({}, e)]).then(() => !0);
468
+ return s.cvforceDatahub.updateSamples(t, r.id, [p({}, e)]).then(() => !0);
468
469
  }
469
470
  })]
470
471
  }) : /* @__PURE__ */ i("div", {
@@ -0,0 +1,69 @@
1
+ import { jsxs as i, jsx as e, Fragment as n } from "react/jsx-runtime";
2
+ import { forwardRef as o, useState as f, useImperativeHandle as u } from "react";
3
+ import { Input as v } from "antd";
4
+ const p = o(({
5
+ question: r,
6
+ answer: t,
7
+ readOnly: s,
8
+ onChange: a
9
+ }, m) => {
10
+ const [d, c] = f(!1);
11
+ return u(m, () => ({
12
+ validate: () => {
13
+ const l = r === "" || r.includes("<image>");
14
+ return c(!l), l;
15
+ }
16
+ })), /* @__PURE__ */ i("div", {
17
+ className: "vqa-annotation-panel",
18
+ children: [/* @__PURE__ */ e("div", {
19
+ className: "vqa-panel-title",
20
+ children: "标注信息"
21
+ }), /* @__PURE__ */ i("div", {
22
+ className: "vqa-panel-content",
23
+ children: [/* @__PURE__ */ i("div", {
24
+ className: "vqa-field",
25
+ children: [/* @__PURE__ */ e("div", {
26
+ className: "vqa-field-label",
27
+ children: "问题"
28
+ }), s ? /* @__PURE__ */ e("div", {
29
+ className: "vqa-field-readonly",
30
+ children: r || "-"
31
+ }) : /* @__PURE__ */ i(n, {
32
+ children: [/* @__PURE__ */ e(v.TextArea, {
33
+ placeholder: "问题内容必须包含<image>",
34
+ value: r,
35
+ maxLength: 2e3,
36
+ showCount: !0,
37
+ rows: 8,
38
+ status: d ? "error" : "",
39
+ onChange: (l) => {
40
+ d && c(!1), a == null || a(l.target.value, t);
41
+ }
42
+ }), d && /* @__PURE__ */ e("div", {
43
+ className: "vqa-field-error",
44
+ children: "问题内容必须包含<image>"
45
+ })]
46
+ })]
47
+ }), /* @__PURE__ */ i("div", {
48
+ className: "vqa-field",
49
+ children: [/* @__PURE__ */ e("div", {
50
+ className: "vqa-field-label",
51
+ children: "回答"
52
+ }), s ? /* @__PURE__ */ e("div", {
53
+ className: "vqa-field-readonly",
54
+ children: t || "-"
55
+ }) : /* @__PURE__ */ e(v.TextArea, {
56
+ value: t,
57
+ maxLength: 2e3,
58
+ showCount: !0,
59
+ rows: 8,
60
+ onChange: (l) => a == null ? void 0 : a(r, l.target.value)
61
+ })]
62
+ })]
63
+ })]
64
+ });
65
+ });
66
+ p.displayName = "VQAAnnotationPanel";
67
+ export {
68
+ p as default
69
+ };
@@ -0,0 +1,80 @@
1
+ var q = Object.defineProperty, C = Object.defineProperties;
2
+ var j = Object.getOwnPropertyDescriptors;
3
+ var N = Object.getOwnPropertySymbols;
4
+ var y = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
5
+ var Q = (n, t, e) => t in n ? q(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, s = (n, t) => {
6
+ for (var e in t || (t = {}))
7
+ y.call(t, e) && Q(n, e, t[e]);
8
+ if (N)
9
+ for (var e of N(t))
10
+ D.call(t, e) && Q(n, e, t[e]);
11
+ return n;
12
+ }, i = (n, t) => C(n, j(t));
13
+ import { jsxs as I, jsx as d } from "react/jsx-runtime";
14
+ import { forwardRef as L, useRef as M, useState as R, useEffect as k, useImperativeHandle as B } from "react";
15
+ import E from "../VLMAnnotation/VLMLabelMaker/index.mjs";
16
+ import H from "./VQAAnnotationPanel.mjs";
17
+ import "./style.less.mjs";
18
+ const P = L(({
19
+ sample: n,
20
+ onChange: t,
21
+ readOnly: e
22
+ }, V) => {
23
+ const f = M(null), c = (o, a) => {
24
+ var r, v, l, u;
25
+ return (u = (l = (v = (r = o.content) == null ? void 0 : r.conversations) == null ? void 0 : v[a]) == null ? void 0 : l.value) != null ? u : "";
26
+ }, [b, m] = R(() => c(n, 0)), [g, h] = R(() => c(n, 1));
27
+ return k(() => {
28
+ m(c(n, 0)), h(c(n, 1));
29
+ }, [n]), B(V, () => ({
30
+ validate: () => {
31
+ var o, a;
32
+ return (a = (o = f.current) == null ? void 0 : o.validate()) != null ? a : !0;
33
+ }
34
+ })), /* @__PURE__ */ I("div", {
35
+ className: "vqa-annotation-wrap",
36
+ children: [/* @__PURE__ */ d("div", {
37
+ className: "vqa-annotation-left",
38
+ children: /* @__PURE__ */ d(E, {
39
+ sample: n,
40
+ labelDefinitions: [],
41
+ labels: [],
42
+ hideDrawRect: !0,
43
+ onChange: () => {
44
+ }
45
+ })
46
+ }), /* @__PURE__ */ d("div", {
47
+ className: "vqa-annotation-right",
48
+ children: /* @__PURE__ */ d(H, {
49
+ ref: f,
50
+ question: b,
51
+ answer: g,
52
+ readOnly: e,
53
+ onChange: (o, a) => {
54
+ var A, w, x, p;
55
+ m(o), h(a);
56
+ const r = (w = (A = n.content) == null ? void 0 : A.conversations) != null ? w : [], v = (x = r[0]) != null ? x : {
57
+ from: "human",
58
+ value: ""
59
+ }, l = (p = r[1]) != null ? p : {
60
+ from: "gpt",
61
+ value: ""
62
+ }, u = [i(s({}, v), {
63
+ value: o
64
+ }), i(s({}, l), {
65
+ value: a
66
+ })];
67
+ t == null || t(i(s({}, n), {
68
+ content: i(s({}, n.content), {
69
+ conversations: u
70
+ })
71
+ }));
72
+ }
73
+ })
74
+ })]
75
+ });
76
+ });
77
+ P.displayName = "VQAAnnotation";
78
+ export {
79
+ P as default
80
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };