luo-image-annotator 0.0.10 → 0.0.11

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.
@@ -1,16 +1,16 @@
1
1
  var Jt = Object.defineProperty;
2
- var jt = (m, t, i) => t in m ? Jt(m, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : m[t] = i;
3
- var I = (m, t, i) => jt(m, typeof t != "symbol" ? t + "" : t, i);
4
- import { defineComponent as K, ref as k, watchEffect as Xt, openBlock as p, createElementBlock as x, normalizeClass as O, computed as E, onMounted as Yt, watch as X, createElementVNode as g, toDisplayString as $, Fragment as L, renderList as D, normalizeStyle as V, createCommentVNode as z, createVNode as H, withModifiers as qt, createTextVNode as Y, withDirectives as lt, vModelText as rt, createBlock as ft, nextTick as Gt } from "vue";
5
- const ct = (m, t) => Math.sqrt(Math.pow(m.x - t.x, 2) + Math.pow(m.y - t.y, 2)), Kt = (m, t) => {
2
+ var jt = (v, t, i) => t in v ? Jt(v, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : v[t] = i;
3
+ var k = (v, t, i) => jt(v, typeof t != "symbol" ? t + "" : t, i);
4
+ import { defineComponent as K, ref as S, watchEffect as Yt, openBlock as f, createElementBlock as p, normalizeClass as V, computed as U, onMounted as Xt, watch as Y, createElementVNode as g, toDisplayString as T, Fragment as R, renderList as F, normalizeStyle as O, createCommentVNode as $, createVNode as H, withModifiers as qt, createTextVNode as X, withDirectives as lt, vModelText as rt, createBlock as ft, nextTick as Gt } from "vue";
5
+ const ct = (v, t) => Math.sqrt(Math.pow(v.x - t.x, 2) + Math.pow(v.y - t.y, 2)), Kt = (v, t) => {
6
6
  let i = !1;
7
7
  for (let e = 0, a = t.length - 1; e < t.length; a = e++) {
8
8
  const r = t[e].x, c = t[e].y, o = t[a].x, h = t[a].y;
9
- c > m.y != h > m.y && m.x < (o - r) * (m.y - c) / (h - c) + r && (i = !i);
9
+ c > v.y != h > v.y && v.x < (o - r) * (v.y - c) / (h - c) + r && (i = !i);
10
10
  }
11
11
  return i;
12
- }, yt = (m, t, i) => {
13
- const e = i * (Math.PI / 180), a = Math.cos(e), r = Math.sin(e), c = m.x - t.x, o = m.y - t.y;
12
+ }, yt = (v, t, i) => {
13
+ const e = i * (Math.PI / 180), a = Math.cos(e), r = Math.sin(e), c = v.x - t.x, o = v.y - t.y;
14
14
  return {
15
15
  x: t.x + (c * a - o * r),
16
16
  y: t.y + (c * r + o * a)
@@ -18,42 +18,42 @@ const ct = (m, t) => Math.sqrt(Math.pow(m.x - t.x, 2) + Math.pow(m.y - t.y, 2)),
18
18
  };
19
19
  class Zt {
20
20
  constructor(t) {
21
- I(this, "canvas");
22
- I(this, "ctx");
23
- I(this, "img");
24
- I(this, "annotations", []);
21
+ k(this, "canvas");
22
+ k(this, "ctx");
23
+ k(this, "img");
24
+ k(this, "annotations", []);
25
25
  // 状态
26
- I(this, "currentTool", null);
27
- I(this, "interactionMode", "none");
28
- I(this, "activeAnnotation", null);
29
- I(this, "hoverAnnotation", null);
30
- I(this, "isDrawing", !1);
31
- I(this, "isDragging", !1);
32
- I(this, "isPanning", !1);
26
+ k(this, "currentTool", null);
27
+ k(this, "interactionMode", "none");
28
+ k(this, "activeAnnotation", null);
29
+ k(this, "hoverAnnotation", null);
30
+ k(this, "isDrawing", !1);
31
+ k(this, "isDragging", !1);
32
+ k(this, "isPanning", !1);
33
33
  // 平移模式
34
- I(this, "panStartPoint", null);
34
+ k(this, "panStartPoint", null);
35
35
  // 平移起点
36
- I(this, "dragStartPoint", null);
37
- I(this, "dragStartAnnotation", null);
36
+ k(this, "dragStartPoint", null);
37
+ k(this, "dragStartAnnotation", null);
38
38
  // 快照用于撤销/diff
39
- I(this, "lastMouseMovePoint", null);
39
+ k(this, "lastMouseMovePoint", null);
40
40
  // 用于绘制辅助线
41
- I(this, "isHoveringStartPoint", !1);
41
+ k(this, "isHoveringStartPoint", !1);
42
42
  // 多边形闭合吸附状态
43
43
  // 设置
44
- I(this, "currentLabelColor", "#FF4081");
44
+ k(this, "currentLabelColor", "#FF4081");
45
45
  // 当前选中标签颜色
46
- I(this, "visibleLabels", /* @__PURE__ */ new Set());
46
+ k(this, "visibleLabels", /* @__PURE__ */ new Set());
47
47
  // 可见标签集合 (如果为空则全部可见,或者由外部控制渲染列表)
48
48
  // 交互
49
- I(this, "selectedHandleIndex", -1);
49
+ k(this, "selectedHandleIndex", -1);
50
50
  // -1: 主体, >=0: 顶点索引, -2: 旋转手柄
51
- I(this, "hoverHandleIndex", -1);
51
+ k(this, "hoverHandleIndex", -1);
52
52
  // 视口
53
- I(this, "scale", 1);
54
- I(this, "offset", { x: 0, y: 0 });
55
- I(this, "listeners", {});
56
- I(this, "imageUrl", "");
53
+ k(this, "scale", 1);
54
+ k(this, "offset", { x: 0, y: 0 });
55
+ k(this, "listeners", {});
56
+ k(this, "imageUrl", "");
57
57
  this.canvas = t;
58
58
  const i = t.getContext("2d");
59
59
  if (!i) throw new Error("Could not get 2d context");
@@ -364,12 +364,12 @@ class Zt {
364
364
  } else if (t.type === "rotatedRect") {
365
365
  const r = t.coordinates;
366
366
  if (e === -2) {
367
- const c = r.x, o = r.y, h = a.x - c, y = a.y - o;
368
- let C = Math.atan2(y, h) * 180 / Math.PI;
369
- C += 90, r.angle = C;
367
+ const c = r.x, o = r.y, h = a.x - c, u = a.y - o;
368
+ let A = Math.atan2(u, h) * 180 / Math.PI;
369
+ A += 90, r.angle = A;
370
370
  } else {
371
- const c = r.angle * Math.PI / 180, o = Math.cos(-c), h = Math.sin(-c), y = a.x - r.x, C = a.y - r.y, u = y * o - C * h, f = y * h + C * o;
372
- (e === 0 || e === 3) && (r.width / 2, r.width = Math.abs(u) * 2), (e === 1 || e === 2) && (r.width = Math.abs(u) * 2), (e === 0 || e === 1) && (r.height = Math.abs(f) * 2), (e === 2 || e === 3) && (r.height = Math.abs(f) * 2);
371
+ const c = r.angle * Math.PI / 180, o = Math.cos(-c), h = Math.sin(-c), u = a.x - r.x, A = a.y - r.y, y = u * o - A * h, w = u * h + A * o;
372
+ (e === 0 || e === 3) && (r.width / 2, r.width = Math.abs(y) * 2), (e === 1 || e === 2) && (r.width = Math.abs(y) * 2), (e === 0 || e === 1) && (r.height = Math.abs(w) * 2), (e === 2 || e === 3) && (r.height = Math.abs(w) * 2);
373
373
  }
374
374
  }
375
375
  }
@@ -424,8 +424,8 @@ class Zt {
424
424
  if (t.type === "point")
425
425
  return t.coordinates.points;
426
426
  if (t.type === "rotatedRect") {
427
- const i = t.coordinates, e = { x: i.x, y: i.y }, a = i.width / 2, r = i.height / 2, c = { x: i.x - a, y: i.y - r }, o = { x: i.x + a, y: i.y - r }, h = { x: i.x + a, y: i.y + r }, y = { x: i.x - a, y: i.y + r }, C = { x: i.x, y: i.y - r - 20 / this.scale };
428
- return [c, o, h, y, C].map((u) => yt(u, e, i.angle));
427
+ const i = t.coordinates, e = { x: i.x, y: i.y }, a = i.width / 2, r = i.height / 2, c = { x: i.x - a, y: i.y - r }, o = { x: i.x + a, y: i.y - r }, h = { x: i.x + a, y: i.y + r }, u = { x: i.x - a, y: i.y + r }, A = { x: i.x, y: i.y - r - 20 / this.scale };
428
+ return [c, o, h, u, A].map((y) => yt(y, e, i.angle));
429
429
  }
430
430
  }
431
431
  return [];
@@ -455,26 +455,26 @@ class Zt {
455
455
  let i = 10;
456
456
  const e = 10, a = 8, r = 4, c = 24, o = 8;
457
457
  t.forEach((h) => {
458
- const y = h.label || "Unlabeled", C = this.ctx.measureText(y).width + a * 2, u = this.activeAnnotation === h, f = this.hoverAnnotation === h;
459
- this.ctx.fillStyle = u ? "#E3F2FD" : f ? "#F5F5F5" : "rgba(255, 255, 255, 0.9)", this.ctx.strokeStyle = u ? "#2196F3" : "#666", this.ctx.lineWidth = u ? 2 : 1, this.ctx.beginPath(), this.ctx.rect(i, e, C, c), this.ctx.fill(), this.ctx.stroke(), this.ctx.fillStyle = u ? "#1976D2" : "#333", this.ctx.fillText(y, i + a, e + r), i += C + o;
458
+ const u = h.label || "Unlabeled", A = this.ctx.measureText(u).width + a * 2, y = this.activeAnnotation === h, w = this.hoverAnnotation === h;
459
+ this.ctx.fillStyle = y ? "#E3F2FD" : w ? "#F5F5F5" : "rgba(255, 255, 255, 0.9)", this.ctx.strokeStyle = y ? "#2196F3" : "#666", this.ctx.lineWidth = y ? 2 : 1, this.ctx.beginPath(), this.ctx.rect(i, e, A, c), this.ctx.fill(), this.ctx.stroke(), this.ctx.fillStyle = y ? "#1976D2" : "#333", this.ctx.fillText(u, i + a, e + r), i += A + o;
460
460
  }), this.ctx.restore();
461
461
  }
462
462
  getHitCategory(t, i) {
463
- const e = this.annotations.filter((C) => C.type === "category");
463
+ const e = this.annotations.filter((A) => A.type === "category");
464
464
  if (e.length === 0) return null;
465
465
  this.ctx.save(), this.ctx.font = "14px sans-serif";
466
466
  let a = 10;
467
467
  const r = 10, c = 8, o = 24, h = 8;
468
- let y = null;
469
- for (const C of e) {
470
- const u = C.label || "Unlabeled", f = this.ctx.measureText(u).width + c * 2;
471
- if (t >= a && t <= a + f && i >= r && i <= r + o) {
472
- y = C;
468
+ let u = null;
469
+ for (const A of e) {
470
+ const y = A.label || "Unlabeled", w = this.ctx.measureText(y).width + c * 2;
471
+ if (t >= a && t <= a + w && i >= r && i <= r + o) {
472
+ u = A;
473
473
  break;
474
474
  }
475
- a += f + h;
475
+ a += w + h;
476
476
  }
477
- return this.ctx.restore(), y;
477
+ return this.ctx.restore(), u;
478
478
  }
479
479
  drawItem(t, i) {
480
480
  var r;
@@ -483,8 +483,8 @@ class Zt {
483
483
  this.ctx.save();
484
484
  const e = ((r = t.style) == null ? void 0 : r.strokeColor) || "#FF4081", a = i ? "#00E5FF" : e;
485
485
  if (this.ctx.strokeStyle = a, this.ctx.lineWidth = 2, i ? this.ctx.fillStyle = "rgba(0, 229, 255, 0.2)" : this.ctx.fillStyle = this.hexToRgba(e, 0.2), t.type === "rectangle") {
486
- const c = t.coordinates, o = this.toScreenCoords(c.x1, c.y1), h = this.toScreenCoords(c.x2, c.y2), y = Math.min(o.x, h.x), C = Math.min(o.y, h.y), u = Math.abs(o.x - h.x), f = Math.abs(o.y - h.y);
487
- this.ctx.strokeRect(y, C, u, f), this.ctx.fillStyle = i ? "rgba(0, 229, 255, 0.2)" : "rgba(255, 64, 129, 0.2)", this.ctx.fillRect(y, C, u, f), i && this.drawHandles(this.getAnnotationHandles(t));
486
+ const c = t.coordinates, o = this.toScreenCoords(c.x1, c.y1), h = this.toScreenCoords(c.x2, c.y2), u = Math.min(o.x, h.x), A = Math.min(o.y, h.y), y = Math.abs(o.x - h.x), w = Math.abs(o.y - h.y);
487
+ this.ctx.strokeRect(u, A, y, w), this.ctx.fillStyle = i ? "rgba(0, 229, 255, 0.2)" : "rgba(255, 64, 129, 0.2)", this.ctx.fillRect(u, A, y, w), i && this.drawHandles(this.getAnnotationHandles(t));
488
488
  } else if (t.type === "polygon") {
489
489
  const c = t.coordinates;
490
490
  if (c.points.length === 0) {
@@ -495,8 +495,8 @@ class Zt {
495
495
  const o = this.toScreenCoords(c.points[0].x, c.points[0].y);
496
496
  this.ctx.moveTo(o.x, o.y);
497
497
  for (let h = 1; h < c.points.length; h++) {
498
- const y = this.toScreenCoords(c.points[h].x, c.points[h].y);
499
- this.ctx.lineTo(y.x, y.y);
498
+ const u = this.toScreenCoords(c.points[h].x, c.points[h].y);
499
+ this.ctx.lineTo(u.x, u.y);
500
500
  }
501
501
  if (!this.isDrawing || t !== this.activeAnnotation)
502
502
  this.ctx.closePath();
@@ -504,11 +504,11 @@ class Zt {
504
504
  let h = this.lastMouseMovePoint;
505
505
  if (this.isHoveringStartPoint && c.points.length > 0) {
506
506
  h = c.points[0];
507
- const C = this.toScreenCoords(c.points[0].x, c.points[0].y);
508
- this.ctx.save(), this.ctx.beginPath(), this.ctx.arc(C.x, C.y, 10, 0, Math.PI * 2), this.ctx.fillStyle = "rgba(255, 215, 0, 0.6)", this.ctx.strokeStyle = "#FFFFFF", this.ctx.lineWidth = 2, this.ctx.fill(), this.ctx.stroke(), this.ctx.restore();
507
+ const A = this.toScreenCoords(c.points[0].x, c.points[0].y);
508
+ this.ctx.save(), this.ctx.beginPath(), this.ctx.arc(A.x, A.y, 10, 0, Math.PI * 2), this.ctx.fillStyle = "rgba(255, 215, 0, 0.6)", this.ctx.strokeStyle = "#FFFFFF", this.ctx.lineWidth = 2, this.ctx.fill(), this.ctx.stroke(), this.ctx.restore();
509
509
  }
510
- const y = this.toScreenCoords(h.x, h.y);
511
- this.ctx.lineTo(y.x, y.y);
510
+ const u = this.toScreenCoords(h.x, h.y);
511
+ this.ctx.lineTo(u.x, u.y);
512
512
  }
513
513
  this.ctx.stroke(), this.ctx.fillStyle = i ? "rgba(0, 229, 255, 0.2)" : "rgba(255, 64, 129, 0.2)", this.ctx.fill(), i && this.drawHandles(this.getAnnotationHandles(t));
514
514
  } else if (t.type === "rotatedRect") {
@@ -567,18 +567,18 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
567
567
  name: {},
568
568
  size: {}
569
569
  },
570
- setup(m) {
571
- const t = m, i = k(""), e = /* @__PURE__ */ Object.assign({ "../assets/svg/aim.svg": Qt, "../assets/svg/back.svg": te, "../assets/svg/connection.svg": ee, "../assets/svg/crop.svg": ne, "../assets/svg/delete.svg": se, "../assets/svg/download.svg": ie, "../assets/svg/edit.svg": oe, "../assets/svg/hide.svg": ae, "../assets/svg/pointer.svg": le, "../assets/svg/price-tag.svg": re, "../assets/svg/rank.svg": ce, "../assets/svg/refresh-right.svg": he, "../assets/svg/right.svg": de, "../assets/svg/view.svg": ge, "../assets/svg/zoom-in.svg": ue, "../assets/svg/zoom-out.svg": ve });
572
- return Xt(() => {
570
+ setup(v) {
571
+ const t = v, i = S(""), e = /* @__PURE__ */ Object.assign({ "../assets/svg/aim.svg": Qt, "../assets/svg/back.svg": te, "../assets/svg/connection.svg": ee, "../assets/svg/crop.svg": ne, "../assets/svg/delete.svg": se, "../assets/svg/download.svg": ie, "../assets/svg/edit.svg": oe, "../assets/svg/hide.svg": ae, "../assets/svg/pointer.svg": le, "../assets/svg/price-tag.svg": re, "../assets/svg/rank.svg": ce, "../assets/svg/refresh-right.svg": he, "../assets/svg/right.svg": de, "../assets/svg/view.svg": ge, "../assets/svg/zoom-in.svg": ue, "../assets/svg/zoom-out.svg": ve });
572
+ return Yt(() => {
573
573
  const a = `../assets/svg/${t.name}.svg`, r = e[a];
574
574
  r ? i.value = r : (console.warn(`Icon ${t.name} not found at path ${a}`), i.value = "");
575
- }), (a, r) => (p(), x("i", {
576
- class: O(["svg-icon", [m.size ? `size-${m.size}` : ""]]),
575
+ }), (a, r) => (f(), p("i", {
576
+ class: V(["svg-icon", [v.size ? `size-${v.size}` : ""]]),
577
577
  innerHTML: i.value
578
578
  }, null, 10, me));
579
579
  }
580
- }), Z = (m, t) => {
581
- const i = m.__vccOpts || m;
580
+ }), Z = (v, t) => {
581
+ const i = v.__vccOpts || v;
582
582
  for (const [e, a] of t)
583
583
  i[e] = a;
584
584
  return i;
@@ -611,7 +611,7 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
611
611
  }, Fe = { class: "label-list" }, Ee = { class: "label-row" }, Oe = ["onUpdate:modelValue", "onChange"], Ve = ["title"], Ne = ["onClick"], We = { class: "action-icon more-actions" }, Je = ["onClick"], je = {
612
612
  key: 3,
613
613
  class: "modal-overlay"
614
- }, Xe = { class: "modal-content" }, Ye = { class: "form-group" }, qe = { class: "form-group" }, Ge = { class: "color-input-wrapper" }, Ke = /* @__PURE__ */ K({
614
+ }, Ye = { class: "modal-content" }, Xe = { class: "form-group" }, qe = { class: "form-group" }, Ge = { class: "color-input-wrapper" }, Ke = /* @__PURE__ */ K({
615
615
  __name: "ImageAnnotator",
616
616
  props: {
617
617
  annotationTypes: { default: () => ["rectangle", "polygon", "point", "rotatedRect"] },
@@ -628,14 +628,14 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
628
628
  maxZoom: {}
629
629
  },
630
630
  emits: ["annotationChange", "batchChange", "labelChange", "ready", "error", "tool:change", "viewport:change", "annotation:add", "annotation:update", "annotation:delete", "annotation:select", "prediction:loaded", "prediction:apply", "prediction:reject"],
631
- setup(m, { expose: t, emit: i }) {
632
- const e = m, a = i, r = k(null), c = k(null), o = k(null), h = k(null), y = k(0), C = k(""), u = k([]), f = k(""), _ = k(!1), T = k({ name: "", color: "#FF0000" }), U = k("none"), R = k([]), B = k({}), Q = E(() => h.value === "select" && !!C.value), J = (n) => {
633
- if (!n || B.value[n]) return;
631
+ setup(v, { expose: t, emit: i }) {
632
+ const e = v, a = i, r = S(null), c = S(null), o = S(null), h = S(null), u = S(0), A = S(""), y = S([]), w = S(""), I = S(!1), C = S({ name: "", color: "#FF0000" }), B = S("none"), D = S([]), L = S({}), Q = U(() => h.value === "select" && !!A.value), J = (n) => {
633
+ if (!n || L.value[n]) return;
634
634
  const s = new Image();
635
635
  s.onload = () => {
636
636
  const l = s.naturalWidth || 1, d = s.naturalHeight || 1;
637
- B.value = {
638
- ...B.value,
637
+ L.value = {
638
+ ...L.value,
639
639
  [n]: { width: l, height: d }
640
640
  };
641
641
  }, s.src = n;
@@ -643,29 +643,29 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
643
643
  e.batchImages.forEach((n) => {
644
644
  J(n.imageUrl);
645
645
  });
646
- }, F = () => {
647
- var l, d, v, A;
648
- const n = e.batchImages[y.value], s = (n == null ? void 0 : n.imageUrl) || ((l = e.image) == null ? void 0 : l.url);
646
+ }, E = () => {
647
+ var l, d, m, _;
648
+ const n = e.batchImages[u.value], s = (n == null ? void 0 : n.imageUrl) || ((l = e.image) == null ? void 0 : l.url);
649
649
  return {
650
650
  eventId: `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
651
651
  timestamp: Date.now(),
652
652
  requestId: e.requestId,
653
653
  taskId: (d = e.session) == null ? void 0 : d.taskId,
654
- imageId: ((v = e.image) == null ? void 0 : v.id) || s,
655
- operator: (A = e.session) == null ? void 0 : A.userId
654
+ imageId: ((m = e.image) == null ? void 0 : m.id) || s,
655
+ operator: (_ = e.session) == null ? void 0 : _.userId
656
656
  };
657
657
  }, et = (n) => {
658
658
  var d;
659
659
  const s = n == null ? void 0 : n.action;
660
660
  if (!s) return;
661
661
  const l = {
662
- meta: F(),
662
+ meta: E(),
663
663
  action: s,
664
664
  current: n == null ? void 0 : n.changedItem,
665
665
  source: (d = n == null ? void 0 : n.changedItem) != null && d.predictionId ? "prediction" : "manual"
666
666
  };
667
667
  s === "add" && a("annotation:add", l), s === "update" && a("annotation:update", l), s === "delete" && a("annotation:delete", l), s === "select" && a("annotation:select", l);
668
- }, nt = E(() => e.annotationTypes.filter((n) => n !== "category")), st = (n) => ({
668
+ }, nt = U(() => e.annotationTypes.filter((n) => n !== "category")), st = (n) => ({
669
669
  rectangle: "crop",
670
670
  polygon: "connection",
671
671
  point: "aim",
@@ -678,52 +678,52 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
678
678
  rotatedRect: "旋转矩形",
679
679
  category: "分类标签"
680
680
  })[n] || n;
681
- Yt(() => {
681
+ Xt(() => {
682
682
  if (tt(), r.value) {
683
683
  o.value = new Zt(r.value), o.value.on("annotationChange", (s) => {
684
684
  var l, d;
685
685
  if (s.action === "add" && s.changedItem) {
686
- const v = u.value.find((A) => A.id === f.value);
687
- v && (s.changedItem.label = v.name, s.changedItem.labelId = v.id);
686
+ const m = y.value.find((_) => _.id === w.value);
687
+ m && (s.changedItem.label = m.name, s.changedItem.labelId = m.id);
688
688
  }
689
- s.action === "select" ? C.value = ((l = s.changedItem) == null ? void 0 : l.id) || "" : s.action === "delete" && ((d = s.changedItem) == null ? void 0 : d.id) === C.value && (C.value = ""), a("annotationChange", s), et(s);
690
- }), b(), N();
689
+ s.action === "select" ? A.value = ((l = s.changedItem) == null ? void 0 : l.id) || "" : s.action === "delete" && ((d = s.changedItem) == null ? void 0 : d.id) === A.value && (A.value = ""), a("annotationChange", s), et(s);
690
+ }), x(), N();
691
691
  const n = new ResizeObserver(() => {
692
692
  var s;
693
693
  (s = o.value) == null || s.resize();
694
694
  });
695
- c.value && n.observe(c.value), e.defaultActiveType && w(e.defaultActiveType), a("ready", { meta: F() });
695
+ c.value && n.observe(c.value), e.defaultActiveType && b(e.defaultActiveType), a("ready", { meta: E() });
696
696
  }
697
697
  });
698
698
  const N = () => {
699
699
  if (!o.value) return;
700
- const n = u.value.find((l) => l.id === f.value);
700
+ const n = y.value.find((l) => l.id === w.value);
701
701
  n && o.value.setLabelStyle(n.color);
702
- const s = u.value.filter((l) => l.visible).map((l) => l.name);
702
+ const s = y.value.filter((l) => l.visible).map((l) => l.name);
703
703
  o.value.setVisibleLabels(s);
704
- }, b = () => {
704
+ }, x = () => {
705
705
  var n;
706
706
  if (o.value)
707
- if (C.value = "", requestAnimationFrame(() => {
707
+ if (A.value = "", requestAnimationFrame(() => {
708
708
  var s;
709
709
  (s = o.value) == null || s.resize();
710
710
  }), e.batchImages.length > 0) {
711
- const s = e.batchImages[y.value];
711
+ const s = e.batchImages[u.value];
712
712
  o.value.loadImage(s.imageUrl), s.annotations ? o.value.setAnnotations(s.annotations) : o.value.setAnnotations([]);
713
713
  } else (n = e.image) != null && n.url && o.value.loadImage(e.image.url);
714
- }, w = (n) => {
714
+ }, b = (n) => {
715
715
  var s, l;
716
- if (h.value = n, C.value = "", n !== "pan" && n !== "select" && u.value.length === 0) {
716
+ if (h.value = n, A.value = "", n !== "pan" && n !== "select" && y.value.length === 0) {
717
717
  alert("请先创建标签!");
718
718
  return;
719
719
  }
720
- n === "pan" || n === "select" ? (s = o.value) == null || s.setTool(n) : (l = o.value) == null || l.setTool(n), a("tool:change", { meta: F(), tool: n });
721
- }, S = () => {
720
+ n === "pan" || n === "select" ? (s = o.value) == null || s.setTool(n) : (l = o.value) == null || l.setTool(n), a("tool:change", { meta: E(), tool: n });
721
+ }, M = () => {
722
722
  var n;
723
723
  (n = o.value) != null && n.activeAnnotation && o.value.deleteAnnotation(o.value.activeAnnotation.id);
724
724
  }, W = () => {
725
725
  o.value && a("viewport:change", {
726
- meta: F(),
726
+ meta: E(),
727
727
  scale: o.value.scale,
728
728
  offset: { ...o.value.offset }
729
729
  });
@@ -734,112 +734,112 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
734
734
  var n;
735
735
  (n = o.value) == null || n.zoom(-1), W();
736
736
  }, xt = () => {
737
- T.value = { name: "", color: "#2196F3" }, _.value = !0;
737
+ C.value = { name: "", color: "#2196F3" }, I.value = !0;
738
738
  }, dt = () => {
739
- _.value = !1;
739
+ I.value = !1;
740
740
  }, bt = () => {
741
- if (!T.value.name.trim()) {
741
+ if (!C.value.name.trim()) {
742
742
  alert("请输入标签名称");
743
743
  return;
744
744
  }
745
745
  const s = {
746
746
  id: Date.now().toString(),
747
- name: T.value.name,
748
- color: T.value.color,
747
+ name: C.value.name,
748
+ color: C.value.color,
749
749
  visible: !0
750
750
  };
751
- u.value.push(s), a("labelChange", u.value), u.value.length === 1 && j(s), dt();
751
+ y.value.push(s), a("labelChange", y.value), y.value.length === 1 && j(s), dt();
752
752
  }, j = (n) => {
753
753
  var s;
754
- f.value = n.id, (s = o.value) == null || s.setLabelStyle(n.color);
754
+ w.value = n.id, (s = o.value) == null || s.setLabelStyle(n.color);
755
755
  }, wt = (n, s) => {
756
756
  if (!n.startsWith("#")) return n;
757
- let l = 0, d = 0, v = 0;
758
- return n.length === 4 ? (l = parseInt(n[1] + n[1], 16), d = parseInt(n[2] + n[2], 16), v = parseInt(n[3] + n[3], 16)) : n.length === 7 && (l = parseInt(n.slice(1, 3), 16), d = parseInt(n.slice(3, 5), 16), v = parseInt(n.slice(5, 7), 16)), `rgba(${l}, ${d}, ${v}, ${s})`;
757
+ let l = 0, d = 0, m = 0;
758
+ return n.length === 4 ? (l = parseInt(n[1] + n[1], 16), d = parseInt(n[2] + n[2], 16), m = parseInt(n[3] + n[3], 16)) : n.length === 7 && (l = parseInt(n.slice(1, 3), 16), d = parseInt(n.slice(3, 5), 16), m = parseInt(n.slice(5, 7), 16)), `rgba(${l}, ${d}, ${m}, ${s})`;
759
759
  }, Ct = (n) => {
760
760
  var s;
761
- if (n.id === f.value && ((s = o.value) == null || s.setLabelStyle(n.color)), o.value) {
761
+ if (n.id === w.value && ((s = o.value) == null || s.setLabelStyle(n.color)), o.value) {
762
762
  const l = o.value.getAnnotations();
763
763
  let d = !1;
764
- l.forEach((v) => {
765
- v.label === n.name && (v.style || (v.style = {}), v.style.strokeColor = n.color, v.style.fillColor = wt(n.color, 0.2), d = !0);
764
+ l.forEach((m) => {
765
+ m.label === n.name && (m.style || (m.style = {}), m.style.strokeColor = n.color, m.style.fillColor = wt(n.color, 0.2), d = !0);
766
766
  }), d && o.value.render();
767
767
  }
768
- a("labelChange", u.value);
768
+ a("labelChange", y.value);
769
769
  }, At = (n) => {
770
770
  n.visible = !n.visible, N();
771
771
  }, _t = (n) => {
772
- const s = u.value.findIndex((l) => l.id === n);
773
- s > -1 && (u.value.splice(s, 1), a("labelChange", u.value), f.value === n && (f.value = u.value.length > 0 ? u.value[0].id : "", f.value && j(u.value[0])), N());
772
+ const s = y.value.findIndex((l) => l.id === n);
773
+ s > -1 && (y.value.splice(s, 1), a("labelChange", y.value), w.value === n && (w.value = y.value.length > 0 ? y.value[0].id : "", w.value && j(y.value[0])), N());
774
774
  };
775
- X(() => e.labels, (n) => {
775
+ Y(() => e.labels, (n) => {
776
776
  const s = JSON.parse(JSON.stringify(n || []));
777
- if (u.value = s, u.value.length > 0)
778
- if (!f.value || !u.value.find((l) => l.id === f.value))
779
- j(u.value[0]);
777
+ if (y.value = s, y.value.length > 0)
778
+ if (!w.value || !y.value.find((l) => l.id === w.value))
779
+ j(y.value[0]);
780
780
  else {
781
- const l = u.value.find((d) => d.id === f.value);
781
+ const l = y.value.find((d) => d.id === w.value);
782
782
  l && j(l);
783
783
  }
784
784
  else
785
- f.value = "";
785
+ w.value = "";
786
786
  N();
787
787
  }, { immediate: !0, deep: !0 });
788
788
  const It = () => {
789
- y.value > 0 && (ot(), y.value--, b(), at());
789
+ u.value > 0 && (ot(), u.value--, x(), at());
790
790
  }, kt = () => {
791
- y.value < e.batchImages.length - 1 && (ot(), y.value++, b(), at());
791
+ u.value < e.batchImages.length - 1 && (ot(), u.value++, x(), at());
792
792
  }, ot = () => {
793
793
  if (o.value) {
794
794
  const n = o.value.getAnnotations();
795
- e.batchImages[y.value].annotations = n;
795
+ e.batchImages[u.value].annotations = n;
796
796
  }
797
797
  }, at = () => {
798
- const n = e.batchImages[y.value];
798
+ const n = e.batchImages[u.value];
799
799
  a("batchChange", {
800
- currentIndex: y.value,
800
+ currentIndex: u.value,
801
801
  total: e.batchImages.length,
802
802
  currentImageUrl: n.imageUrl,
803
803
  currentAnnotations: n.annotations || []
804
804
  });
805
805
  }, gt = (n = []) => {
806
- var v;
806
+ var m;
807
807
  if (!o.value) return;
808
- if (R.value = JSON.parse(JSON.stringify(n)), R.value.length === 0) {
809
- U.value = "none";
808
+ if (D.value = JSON.parse(JSON.stringify(n)), D.value.length === 0) {
809
+ B.value = "none";
810
810
  return;
811
811
  }
812
- U.value = "loaded";
813
- const l = (o.value.getAnnotations() || []).filter((A) => !A.predictionId), d = R.value.map((A) => {
814
- const M = JSON.parse(JSON.stringify(A.annotation));
815
- return M.id = M.id || `pred-${A.id}`, M.predictionId = A.id, M.modelRunId = A.modelRunId || M.modelRunId, M.confidence = A.confidence ?? M.confidence, M.reviewStatus = M.reviewStatus || "draft", M;
812
+ B.value = "loaded";
813
+ const l = (o.value.getAnnotations() || []).filter((_) => !_.predictionId), d = D.value.map((_) => {
814
+ const z = JSON.parse(JSON.stringify(_.annotation));
815
+ return z.id = z.id || `pred-${_.id}`, z.predictionId = _.id, z.modelRunId = _.modelRunId || z.modelRunId, z.confidence = _.confidence ?? z.confidence, z.reviewStatus = z.reviewStatus || "draft", z;
816
816
  });
817
817
  o.value.setAnnotations([...l, ...d]), a("prediction:loaded", {
818
- meta: F(),
819
- modelRunId: (v = R.value[0]) == null ? void 0 : v.modelRunId,
820
- candidates: R.value
818
+ meta: E(),
819
+ modelRunId: (m = D.value[0]) == null ? void 0 : m.modelRunId,
820
+ candidates: D.value
821
821
  });
822
822
  }, St = (n, s) => {
823
- var v;
823
+ var m;
824
824
  if (!o.value) return [];
825
- U.value = "applying";
826
- const d = (o.value.getAnnotations() || []).filter((A) => A.predictionId && n.includes(A.predictionId));
827
- return d.forEach((A) => {
828
- A.reviewStatus = "accepted";
829
- }), U.value = "applied", a("prediction:apply", {
830
- meta: F(),
831
- modelRunId: (v = d[0]) == null ? void 0 : v.modelRunId,
825
+ B.value = "applying";
826
+ const d = (o.value.getAnnotations() || []).filter((_) => _.predictionId && n.includes(_.predictionId));
827
+ return d.forEach((_) => {
828
+ _.reviewStatus = "accepted";
829
+ }), B.value = "applied", a("prediction:apply", {
830
+ meta: E(),
831
+ modelRunId: (m = d[0]) == null ? void 0 : m.modelRunId,
832
832
  candidateIds: n,
833
833
  threshold: s,
834
834
  acceptedAnnotations: d
835
835
  }), o.value.render(), d;
836
836
  }, Mt = (n, s) => {
837
- var v;
837
+ var m;
838
838
  if (!o.value) return;
839
- const l = o.value.getAnnotations() || [], d = l.filter((A) => !(A.predictionId && n.includes(A.predictionId)));
839
+ const l = o.value.getAnnotations() || [], d = l.filter((_) => !(_.predictionId && n.includes(_.predictionId)));
840
840
  o.value.setAnnotations(d), a("prediction:reject", {
841
- meta: F(),
842
- modelRunId: (v = l.find((A) => A.predictionId && n.includes(A.predictionId))) == null ? void 0 : v.modelRunId,
841
+ meta: E(),
842
+ modelRunId: (m = l.find((_) => _.predictionId && n.includes(_.predictionId))) == null ? void 0 : m.modelRunId,
843
843
  candidateIds: n,
844
844
  reason: s
845
845
  });
@@ -856,17 +856,17 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
856
856
  const s = ut();
857
857
  return {
858
858
  format: n,
859
- image: ((l = e.batchImages[y.value]) == null ? void 0 : l.imageUrl) || ((d = e.image) == null ? void 0 : d.url) || "",
859
+ image: ((l = e.batchImages[u.value]) == null ? void 0 : l.imageUrl) || ((d = e.image) == null ? void 0 : d.url) || "",
860
860
  annotations: s
861
861
  };
862
862
  }, vt = (n) => {
863
- n >= 0 && n < e.batchImages.length && (ot(), y.value = n, b(), at());
863
+ n >= 0 && n < e.batchImages.length && (ot(), u.value = n, x(), at());
864
864
  }, Pt = (n) => {
865
865
  var s;
866
- return n === y.value && o.value ? o.value.getAnnotations() || [] : ((s = e.batchImages[n]) == null ? void 0 : s.annotations) || [];
866
+ return n === u.value && o.value ? o.value.getAnnotations() || [] : ((s = e.batchImages[n]) == null ? void 0 : s.annotations) || [];
867
867
  }, Ht = (n) => n.type === "rectangle", Lt = (n) => n.type === "polygon", Rt = (n) => n.type === "point", Bt = (n) => n.type === "rotatedRect", q = (n) => {
868
868
  var l, d;
869
- const s = (l = u.value.find((v) => v.name === n.label)) == null ? void 0 : l.color;
869
+ const s = (l = y.value.find((m) => m.name === n.label)) == null ? void 0 : l.color;
870
870
  return ((d = n.style) == null ? void 0 : d.strokeColor) || s || "#409eff";
871
871
  }, mt = (n) => {
872
872
  const s = n.coordinates;
@@ -875,20 +875,20 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
875
875
  const s = e.batchImages[n];
876
876
  if (s != null && s.width && (s != null && s.height))
877
877
  return { width: s.width, height: s.height };
878
- const l = s != null && s.imageUrl ? B.value[s.imageUrl] : void 0;
878
+ const l = s != null && s.imageUrl ? L.value[s.imageUrl] : void 0;
879
879
  return l || (s != null && s.imageUrl && J(s.imageUrl), { width: 1, height: 1 });
880
880
  }, Dt = (n) => {
881
881
  const s = e.batchImages[n];
882
- return s != null && s.width && (s != null && s.height) ? !0 : s != null && s.imageUrl ? !!B.value[s.imageUrl] : !1;
882
+ return s != null && s.width && (s != null && s.height) ? !0 : s != null && s.imageUrl ? !!L.value[s.imageUrl] : !1;
883
883
  }, Ut = (n, s) => {
884
- const l = s.coordinates, d = G(n), v = q(s), A = Math.min(l.x1, l.x2), M = Math.min(l.y1, l.y2), Nt = Math.max(l.x1, l.x2), Wt = Math.max(l.y1, l.y2);
884
+ const l = s.coordinates, d = G(n), m = q(s), _ = Math.min(l.x1, l.x2), z = Math.min(l.y1, l.y2), Nt = Math.max(l.x1, l.x2), Wt = Math.max(l.y1, l.y2);
885
885
  return {
886
- left: `${A / d.width * 100}%`,
887
- top: `${M / d.height * 100}%`,
888
- width: `${(Nt - A) / d.width * 100}%`,
889
- height: `${(Wt - M) / d.height * 100}%`,
890
- borderColor: v,
891
- backgroundColor: `${v}22`
886
+ left: `${_ / d.width * 100}%`,
887
+ top: `${z / d.height * 100}%`,
888
+ width: `${(Nt - _) / d.width * 100}%`,
889
+ height: `${(Wt - z) / d.height * 100}%`,
890
+ borderColor: m,
891
+ backgroundColor: `${m}22`
892
892
  };
893
893
  }, Ft = (n, s) => {
894
894
  const l = G(n);
@@ -901,22 +901,22 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
901
901
  strokeWidth: "1.4"
902
902
  };
903
903
  }, Ot = (n, s, l) => {
904
- const d = G(n), v = q(l);
904
+ const d = G(n), m = q(l);
905
905
  return {
906
906
  left: `${s.x / d.width * 100}%`,
907
907
  top: `${s.y / d.height * 100}%`,
908
- backgroundColor: v
908
+ backgroundColor: m
909
909
  };
910
910
  }, Vt = (n, s) => {
911
- const l = s.coordinates, d = G(n), v = q(s), A = Math.abs(l.width), M = Math.abs(l.height);
911
+ const l = s.coordinates, d = G(n), m = q(s), _ = Math.abs(l.width), z = Math.abs(l.height);
912
912
  return {
913
- left: `${(l.x - A / 2) / d.width * 100}%`,
914
- top: `${(l.y - M / 2) / d.height * 100}%`,
915
- width: `${A / d.width * 100}%`,
916
- height: `${M / d.height * 100}%`,
913
+ left: `${(l.x - _ / 2) / d.width * 100}%`,
914
+ top: `${(l.y - z / 2) / d.height * 100}%`,
915
+ width: `${_ / d.width * 100}%`,
916
+ height: `${z / d.height * 100}%`,
917
917
  transform: `rotate(${l.angle || 0}deg)`,
918
- borderColor: v,
919
- backgroundColor: `${v}22`
918
+ borderColor: m,
919
+ backgroundColor: `${m}22`
920
920
  };
921
921
  };
922
922
  return t({
@@ -924,7 +924,7 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
924
924
  setImage: zt,
925
925
  setAnnotations: $t,
926
926
  getAnnotations: ut,
927
- selectTool: w,
927
+ selectTool: b,
928
928
  loadPredictionCandidates: gt,
929
929
  applyPredictions: St,
930
930
  rejectPredictions: Mt,
@@ -939,34 +939,34 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
939
939
  getCurrentAnnotation: () => {
940
940
  var n, s, l;
941
941
  return {
942
- imageUrl: ((n = e.batchImages[y.value]) == null ? void 0 : n.imageUrl) || ((s = e.image) == null ? void 0 : s.url) || "",
942
+ imageUrl: ((n = e.batchImages[u.value]) == null ? void 0 : n.imageUrl) || ((s = e.image) == null ? void 0 : s.url) || "",
943
943
  annotations: ((l = o.value) == null ? void 0 : l.getAnnotations()) || []
944
944
  };
945
945
  }
946
- }), X(() => {
946
+ }), Y(() => {
947
947
  var n;
948
948
  return (n = e.image) == null ? void 0 : n.url;
949
949
  }, () => {
950
950
  var n;
951
- e.batchImages.length === 0 && ((n = e.image) != null && n.url) && b();
952
- }), X(() => e.predictionCandidates, (n) => {
951
+ e.batchImages.length === 0 && ((n = e.image) != null && n.url) && x();
952
+ }), Y(() => e.predictionCandidates, (n) => {
953
953
  n && gt(n);
954
- }, { immediate: !0, deep: !0 }), X(
954
+ }, { immediate: !0, deep: !0 }), Y(
955
955
  () => e.batchImages.map((n) => `${n.imageUrl}:${n.width || ""}x${n.height || ""}`),
956
956
  () => {
957
957
  tt();
958
958
  },
959
959
  { immediate: !0 }
960
- ), (n, s) => (p(), x("div", {
961
- class: O(["annotation-container", m.theme])
960
+ ), (n, s) => (f(), p("div", {
961
+ class: V(["annotation-container", v.theme])
962
962
  }, [
963
- m.batchImages && m.batchImages.length > 0 ? (p(), x("div", ye, [
964
- g("div", pe, "批量图片(" + $(m.batchImages.length) + ")", 1),
963
+ v.batchImages && v.batchImages.length > 0 ? (f(), p("div", ye, [
964
+ g("div", pe, "批量图片(" + T(v.batchImages.length) + ")", 1),
965
965
  g("div", xe, [
966
- (p(!0), x(L, null, D(m.batchImages, (l, d) => (p(), x("button", {
966
+ (f(!0), p(R, null, F(v.batchImages, (l, d) => (f(), p("button", {
967
967
  key: `${l.imageUrl}-${d}`,
968
- class: O(["image-list-item", { active: d === y.value }]),
969
- onClick: (v) => vt(d)
968
+ class: V(["image-list-item", { active: d === u.value }]),
969
+ onClick: (m) => vt(d)
970
970
  }, [
971
971
  g("div", we, [
972
972
  g("img", {
@@ -974,55 +974,55 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
974
974
  alt: `第${d + 1}张`,
975
975
  class: "image-list-thumb"
976
976
  }, null, 8, Ce),
977
- Dt(d) ? (p(), x("div", Ae, [
978
- (p(!0), x(L, null, D(Pt(d), (v) => (p(), x(L, {
979
- key: v.id
977
+ Dt(d) ? (f(), p("div", Ae, [
978
+ (f(!0), p(R, null, F(Pt(d), (m) => (f(), p(R, {
979
+ key: m.id
980
980
  }, [
981
- Ht(v) ? (p(), x("div", {
981
+ Ht(m) ? (f(), p("div", {
982
982
  key: 0,
983
983
  class: "thumb-overlay-rect",
984
- style: V(Ut(d, v))
985
- }, null, 4)) : Lt(v) ? (p(), x("svg", _e, [
984
+ style: O(Ut(d, m))
985
+ }, null, 4)) : Lt(m) ? (f(), p("svg", _e, [
986
986
  g("polygon", {
987
- points: Ft(d, v),
988
- style: V(Et(v))
987
+ points: Ft(d, m),
988
+ style: O(Et(m))
989
989
  }, null, 12, Ie)
990
- ])) : Rt(v) ? (p(!0), x(L, { key: 2 }, D(mt(v), (A, M) => (p(), x("div", {
991
- key: `${v.id}-${M}`,
990
+ ])) : Rt(m) ? (f(!0), p(R, { key: 2 }, F(mt(m), (_, z) => (f(), p("div", {
991
+ key: `${m.id}-${z}`,
992
992
  class: "thumb-overlay-point",
993
- style: V(Ot(d, A, v))
994
- }, null, 4))), 128)) : Bt(v) ? (p(), x("div", {
993
+ style: O(Ot(d, _, m))
994
+ }, null, 4))), 128)) : Bt(m) ? (f(), p("div", {
995
995
  key: 3,
996
996
  class: "thumb-overlay-rotated",
997
- style: V(Vt(d, v))
998
- }, null, 4)) : z("", !0)
997
+ style: O(Vt(d, m))
998
+ }, null, 4)) : $("", !0)
999
999
  ], 64))), 128))
1000
- ])) : z("", !0)
1000
+ ])) : $("", !0)
1001
1001
  ]),
1002
- g("span", ke, "第 " + $(d + 1) + " 张", 1)
1002
+ g("span", ke, "第 " + T(d + 1) + " 张", 1)
1003
1003
  ], 10, be))), 128))
1004
1004
  ])
1005
- ])) : z("", !0),
1006
- m.readOnly ? z("", !0) : (p(), x("div", Se, [
1005
+ ])) : $("", !0),
1006
+ v.readOnly ? $("", !0) : (f(), p("div", Se, [
1007
1007
  g("div", {
1008
- class: O(["tool-btn", { active: h.value === "pan" }]),
1009
- onClick: s[0] || (s[0] = (l) => w("pan")),
1008
+ class: V(["tool-btn", { active: h.value === "pan" }]),
1009
+ onClick: s[0] || (s[0] = (l) => b("pan")),
1010
1010
  title: "拖动"
1011
1011
  }, [
1012
1012
  H(P, { name: "rank" })
1013
1013
  ], 2),
1014
1014
  g("div", {
1015
- class: O(["tool-btn", { active: h.value === "select" }]),
1016
- onClick: s[1] || (s[1] = (l) => w("select")),
1015
+ class: V(["tool-btn", { active: h.value === "select" }]),
1016
+ onClick: s[1] || (s[1] = (l) => b("select")),
1017
1017
  title: "选择"
1018
1018
  }, [
1019
1019
  H(P, { name: "pointer" })
1020
1020
  ], 2),
1021
1021
  s[5] || (s[5] = g("div", { class: "divider" }, null, -1)),
1022
- (p(!0), x(L, null, D(nt.value, (l) => (p(), x("div", {
1022
+ (f(!0), p(R, null, F(nt.value, (l) => (f(), p("div", {
1023
1023
  key: l,
1024
- class: O(["tool-btn", { active: h.value === l }]),
1025
- onClick: (d) => w(l),
1024
+ class: V(["tool-btn", { active: h.value === l }]),
1025
+ onClick: (d) => b(l),
1026
1026
  title: it(l)
1027
1027
  }, [
1028
1028
  H(P, {
@@ -1045,27 +1045,27 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1045
1045
  H(P, { name: "zoom-out" })
1046
1046
  ]),
1047
1047
  s[7] || (s[7] = g("div", { class: "divider" }, null, -1)),
1048
- Q.value ? (p(), x("div", {
1048
+ Q.value ? (f(), p("div", {
1049
1049
  key: 0,
1050
1050
  class: "tool-btn",
1051
- onClick: S,
1051
+ onClick: M,
1052
1052
  title: "删除选中"
1053
1053
  }, [
1054
1054
  H(P, { name: "delete" })
1055
- ])) : z("", !0)
1055
+ ])) : $("", !0)
1056
1056
  ])),
1057
1057
  g("div", ze, [
1058
- m.readOnly ? z("", !0) : (p(), x("div", $e, [
1058
+ v.readOnly ? $("", !0) : (f(), p("div", $e, [
1059
1059
  g("div", Te, [
1060
1060
  s[8] || (s[8] = g("span", { class: "label-text" }, "当前标签:", -1)),
1061
1061
  g("div", Pe, [
1062
- (p(!0), x(L, null, D(u.value, (l) => (p(), x("div", {
1062
+ (f(!0), p(R, null, F(y.value, (l) => (f(), p("div", {
1063
1063
  key: l.id,
1064
- class: O(["tag-chip", { active: f.value === l.id }]),
1065
- style: V({ backgroundColor: l.color, borderColor: l.color }),
1064
+ class: V(["tag-chip", { active: w.value === l.id }]),
1065
+ style: O({ backgroundColor: l.color, borderColor: l.color }),
1066
1066
  onClick: (d) => j(l)
1067
- }, $(l.name), 15, He))), 128)),
1068
- u.value.length === 0 ? (p(), x("div", Le, "请在右侧创建标签")) : z("", !0)
1067
+ }, T(l.name), 15, He))), 128)),
1068
+ y.value.length === 0 ? (f(), p("div", Le, "请在右侧创建标签")) : $("", !0)
1069
1069
  ])
1070
1070
  ])
1071
1071
  ])),
@@ -1081,25 +1081,25 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1081
1081
  ref: r
1082
1082
  }, null, 512)
1083
1083
  ], 544),
1084
- m.batchImages && m.batchImages.length > 0 ? (p(), x("div", Re, [
1084
+ v.batchImages && v.batchImages.length > 0 ? (f(), p("div", Re, [
1085
1085
  g("button", {
1086
1086
  onClick: It,
1087
- disabled: y.value <= 0
1087
+ disabled: u.value <= 0
1088
1088
  }, [
1089
1089
  H(P, { name: "back" }),
1090
- s[9] || (s[9] = Y(" 上一张 ", -1))
1090
+ s[9] || (s[9] = X(" 上一张 ", -1))
1091
1091
  ], 8, Be),
1092
- g("span", null, $(y.value + 1) + " / " + $(m.batchImages.length), 1),
1092
+ g("span", null, T(u.value + 1) + " / " + T(v.batchImages.length), 1),
1093
1093
  g("button", {
1094
1094
  onClick: kt,
1095
- disabled: y.value >= m.batchImages.length - 1
1095
+ disabled: u.value >= v.batchImages.length - 1
1096
1096
  }, [
1097
- s[10] || (s[10] = Y(" 下一张 ", -1)),
1097
+ s[10] || (s[10] = X(" 下一张 ", -1)),
1098
1098
  H(P, { name: "right" })
1099
1099
  ], 8, De)
1100
- ])) : z("", !0)
1100
+ ])) : $("", !0)
1101
1101
  ]),
1102
- m.readOnly ? z("", !0) : (p(), x("div", Ue, [
1102
+ v.readOnly ? $("", !0) : (f(), p("div", Ue, [
1103
1103
  g("div", { class: "sidebar-header" }, [
1104
1104
  s[11] || (s[11] = g("h3", null, "标签管理", -1)),
1105
1105
  g("button", {
@@ -1108,14 +1108,14 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1108
1108
  }, "添加标签")
1109
1109
  ]),
1110
1110
  g("div", Fe, [
1111
- (p(!0), x(L, null, D(u.value, (l) => (p(), x("div", {
1111
+ (f(!0), p(R, null, F(y.value, (l) => (f(), p("div", {
1112
1112
  key: l.id,
1113
1113
  class: "label-item"
1114
1114
  }, [
1115
1115
  g("div", Ee, [
1116
1116
  g("label", {
1117
1117
  class: "color-wrapper",
1118
- style: V({ backgroundColor: l.color })
1118
+ style: O({ backgroundColor: l.color })
1119
1119
  }, [
1120
1120
  lt(g("input", {
1121
1121
  type: "color",
@@ -1129,15 +1129,15 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1129
1129
  g("span", {
1130
1130
  class: "label-name",
1131
1131
  title: l.name
1132
- }, $(l.name), 9, Ve),
1132
+ }, T(l.name), 9, Ve),
1133
1133
  g("span", {
1134
1134
  class: "action-icon eye",
1135
1135
  onClick: (d) => At(l)
1136
1136
  }, [
1137
- l.visible ? (p(), ft(P, {
1137
+ l.visible ? (f(), ft(P, {
1138
1138
  key: 0,
1139
1139
  name: "view"
1140
- })) : (p(), ft(P, {
1140
+ })) : (f(), ft(P, {
1141
1141
  key: 1,
1142
1142
  name: "hide"
1143
1143
  }))
@@ -1156,17 +1156,17 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1156
1156
  ]))), 128))
1157
1157
  ])
1158
1158
  ])),
1159
- _.value ? (p(), x("div", je, [
1160
- g("div", Xe, [
1159
+ I.value ? (f(), p("div", je, [
1160
+ g("div", Ye, [
1161
1161
  s[15] || (s[15] = g("h3", null, "新增标签", -1)),
1162
- g("div", Ye, [
1162
+ g("div", Xe, [
1163
1163
  s[13] || (s[13] = g("label", null, "名称", -1)),
1164
1164
  lt(g("input", {
1165
- "onUpdate:modelValue": s[3] || (s[3] = (l) => T.value.name = l),
1165
+ "onUpdate:modelValue": s[3] || (s[3] = (l) => C.value.name = l),
1166
1166
  placeholder: "请输入标签名称",
1167
1167
  class: "modal-input"
1168
1168
  }, null, 512), [
1169
- [rt, T.value.name]
1169
+ [rt, C.value.name]
1170
1170
  ])
1171
1171
  ]),
1172
1172
  g("div", qe, [
@@ -1174,12 +1174,12 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1174
1174
  g("div", Ge, [
1175
1175
  lt(g("input", {
1176
1176
  type: "color",
1177
- "onUpdate:modelValue": s[4] || (s[4] = (l) => T.value.color = l),
1177
+ "onUpdate:modelValue": s[4] || (s[4] = (l) => C.value.color = l),
1178
1178
  class: "modal-color-picker"
1179
1179
  }, null, 512), [
1180
- [rt, T.value.color]
1180
+ [rt, C.value.color]
1181
1181
  ]),
1182
- g("span", null, $(T.value.color), 1)
1182
+ g("span", null, T(C.value.color), 1)
1183
1183
  ])
1184
1184
  ]),
1185
1185
  g("div", { class: "modal-actions" }, [
@@ -1193,13 +1193,13 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1193
1193
  }, "确认")
1194
1194
  ])
1195
1195
  ])
1196
- ])) : z("", !0)
1196
+ ])) : $("", !0)
1197
1197
  ], 2));
1198
1198
  }
1199
1199
  }), Ze = /* @__PURE__ */ Z(Ke, [["__scopeId", "data-v-79777e6e"]]), Qe = {
1200
1200
  class: "thumbnail-wrapper",
1201
1201
  ref: "wrapper"
1202
- }, tn = ["src", "alt"], en = ["viewBox"], nn = ["x", "y", "width", "height", "stroke"], sn = ["points", "stroke"], on = ["x", "y", "fill"], an = {
1202
+ }, tn = ["src", "alt"], en = ["viewBox", "preserveAspectRatio"], nn = ["x", "y", "width", "height", "stroke"], sn = ["points", "stroke"], on = ["x", "y", "fill"], an = {
1203
1203
  key: 1,
1204
1204
  class: "loading-placeholder"
1205
1205
  }, ln = /* @__PURE__ */ K({
@@ -1208,81 +1208,83 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1208
1208
  src: {},
1209
1209
  annotations: {},
1210
1210
  alt: {},
1211
- labels: {}
1211
+ labels: {},
1212
+ fit: {}
1212
1213
  },
1213
- setup(m) {
1214
- const t = m, i = k(null), e = k(!1), a = k(0), r = k(0), c = () => {
1214
+ setup(v) {
1215
+ const t = v, i = S(null), e = S(!1), a = S(0), r = S(0), c = () => {
1215
1216
  i.value && (a.value = i.value.naturalWidth, r.value = i.value.naturalHeight, e.value = !0);
1216
- }, o = (u) => {
1217
- var f;
1218
- if ((f = u.style) != null && f.strokeColor) return u.style.strokeColor;
1217
+ }, o = U(() => t.fit === "contain" ? "xMidYMid meet" : "xMidYMid slice"), h = (w) => {
1218
+ var I;
1219
+ if ((I = w.style) != null && I.strokeColor) return w.style.strokeColor;
1219
1220
  if (t.labels) {
1220
- const _ = t.labels.find((T) => T.name === u.label);
1221
- if (_) return _.color;
1221
+ const C = t.labels.find((B) => B.name === w.label);
1222
+ if (C) return C.color;
1222
1223
  }
1223
1224
  return "#FF0000";
1224
- }, h = (u) => {
1225
- const f = u.coordinates, _ = Math.min(f.x1, f.x2), T = Math.min(f.y1, f.y2), U = Math.abs(f.x1 - f.x2), R = Math.abs(f.y1 - f.y2);
1226
- return { x: _, y: T, width: U, height: R };
1227
- }, y = (u) => u.coordinates.points.map((_) => `${_.x},${_.y}`).join(" "), C = (u) => {
1228
- if (u.type === "rectangle") {
1229
- const f = h(u);
1230
- return { x: f.x, y: f.y - 5 };
1231
- } else if (u.type === "polygon") {
1232
- const f = u.coordinates.points;
1233
- if (f.length > 0) return { x: f[0].x, y: f[0].y - 5 };
1225
+ }, u = (w) => {
1226
+ const I = w.coordinates, C = Math.min(I.x1, I.x2), B = Math.min(I.y1, I.y2), D = Math.abs(I.x1 - I.x2), L = Math.abs(I.y1 - I.y2);
1227
+ return { x: C, y: B, width: D, height: L };
1228
+ }, A = (w) => w.coordinates.points.map((C) => `${C.x},${C.y}`).join(" "), y = (w) => {
1229
+ if (w.type === "rectangle") {
1230
+ const I = u(w);
1231
+ return { x: I.x, y: I.y - 5 };
1232
+ } else if (w.type === "polygon") {
1233
+ const I = w.coordinates.points;
1234
+ if (I.length > 0) return { x: I[0].x, y: I[0].y - 5 };
1234
1235
  }
1235
1236
  return { x: 0, y: 0 };
1236
1237
  };
1237
- return (u, f) => (p(), x("div", Qe, [
1238
+ return (w, I) => (f(), p("div", Qe, [
1238
1239
  g("img", {
1239
1240
  ref_key: "img",
1240
1241
  ref: i,
1241
- src: m.src,
1242
+ src: v.src,
1242
1243
  class: "thumbnail-image",
1244
+ style: O({ objectFit: v.fit }),
1243
1245
  onLoad: c,
1244
- alt: m.alt
1245
- }, null, 40, tn),
1246
- e.value ? (p(), x("svg", {
1246
+ alt: v.alt
1247
+ }, null, 44, tn),
1248
+ e.value ? (f(), p("svg", {
1247
1249
  key: 0,
1248
1250
  class: "annotation-overlay",
1249
1251
  viewBox: `0 0 ${a.value} ${r.value}`,
1250
- preserveAspectRatio: "none"
1252
+ preserveAspectRatio: o.value
1251
1253
  }, [
1252
- (p(!0), x(L, null, D(m.annotations, (_) => (p(), x(L, {
1253
- key: _.id
1254
+ (f(!0), p(R, null, F(v.annotations, (C) => (f(), p(R, {
1255
+ key: C.id
1254
1256
  }, [
1255
- _.type === "rectangle" ? (p(), x("rect", {
1257
+ C.type === "rectangle" ? (f(), p("rect", {
1256
1258
  key: 0,
1257
- x: h(_).x,
1258
- y: h(_).y,
1259
- width: h(_).width,
1260
- height: h(_).height,
1261
- stroke: o(_),
1259
+ x: u(C).x,
1260
+ y: u(C).y,
1261
+ width: u(C).width,
1262
+ height: u(C).height,
1263
+ stroke: h(C),
1262
1264
  "stroke-width": "2",
1263
1265
  fill: "transparent"
1264
- }, null, 8, nn)) : z("", !0),
1265
- _.type === "polygon" ? (p(), x("polygon", {
1266
+ }, null, 8, nn)) : $("", !0),
1267
+ C.type === "polygon" ? (f(), p("polygon", {
1266
1268
  key: 1,
1267
- points: y(_),
1268
- stroke: o(_),
1269
+ points: A(C),
1270
+ stroke: h(C),
1269
1271
  "stroke-width": "2",
1270
1272
  fill: "transparent"
1271
- }, null, 8, sn)) : z("", !0),
1272
- _.label ? (p(), x("text", {
1273
+ }, null, 8, sn)) : $("", !0),
1274
+ C.label ? (f(), p("text", {
1273
1275
  key: 2,
1274
- x: C(_).x,
1275
- y: C(_).y,
1276
- fill: o(_),
1276
+ x: y(C).x,
1277
+ y: y(C).y,
1278
+ fill: h(C),
1277
1279
  "font-size": "14",
1278
1280
  "font-weight": "bold",
1279
1281
  class: "anno-label"
1280
- }, $(_.label), 9, on)) : z("", !0)
1282
+ }, T(C.label), 9, on)) : $("", !0)
1281
1283
  ], 64))), 128))
1282
- ], 8, en)) : (p(), x("div", an, "Loading..."))
1284
+ ], 8, en)) : (f(), p("div", an, "Loading..."))
1283
1285
  ], 512));
1284
1286
  }
1285
- }), rn = /* @__PURE__ */ Z(ln, [["__scopeId", "data-v-78bcbe0c"]]), cn = {
1287
+ }), rn = /* @__PURE__ */ Z(ln, [["__scopeId", "data-v-c77b0958"]]), cn = {
1286
1288
  key: 0,
1287
1289
  class: "gallery-view"
1288
1290
  }, hn = { class: "gallery-header" }, dn = { class: "label-summary" }, gn = ["onClick"], un = { class: "thumbnail-wrapper" }, vn = { class: "img-meta" }, mn = { class: "img-index" }, fn = { class: "anno-count" }, yn = {
@@ -1300,125 +1302,126 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1300
1302
  clickToEnterEditor: { type: Boolean }
1301
1303
  },
1302
1304
  emits: ["export", "update:images", "imageClick"],
1303
- setup(m, { expose: t, emit: i }) {
1304
- const e = m, a = i, r = k("gallery"), c = k([]), o = k(0), h = k(null), y = k(null), C = k(null), u = E(() => {
1305
- var b, w;
1306
- return ((w = (b = e.actionBar) == null ? void 0 : b.annotateButton) == null ? void 0 : w.show) === !0;
1307
- }), f = E(() => {
1308
- var b, w;
1309
- return ((w = (b = e.actionBar) == null ? void 0 : b.exportButton) == null ? void 0 : w.show) === !0;
1310
- }), _ = E(() => u.value || f.value), T = E(() => {
1311
- var b, w;
1312
- return ((w = (b = e.actionBar) == null ? void 0 : b.annotateButton) == null ? void 0 : w.text) || "手动标注";
1313
- }), U = E(() => {
1314
- var b, w;
1315
- return ((w = (b = e.actionBar) == null ? void 0 : b.exportButton) == null ? void 0 : w.text) || "导出";
1316
- }), R = E(() => e.clickToEnterEditor !== !1);
1317
- X(() => e.images, (b) => {
1318
- c.value = JSON.parse(JSON.stringify(b));
1305
+ setup(v, { expose: t, emit: i }) {
1306
+ const e = v, a = i, r = S("gallery"), c = S([]), o = S(0), h = S(null), u = S(null), A = S(null), y = U(() => {
1307
+ var x, b;
1308
+ return ((b = (x = e.actionBar) == null ? void 0 : x.annotateButton) == null ? void 0 : b.show) === !0;
1309
+ }), w = U(() => {
1310
+ var x, b;
1311
+ return ((b = (x = e.actionBar) == null ? void 0 : x.exportButton) == null ? void 0 : b.show) === !0;
1312
+ }), I = U(() => y.value || w.value), C = U(() => {
1313
+ var x, b;
1314
+ return ((b = (x = e.actionBar) == null ? void 0 : x.annotateButton) == null ? void 0 : b.text) || "手动标注";
1315
+ }), B = U(() => {
1316
+ var x, b;
1317
+ return ((b = (x = e.actionBar) == null ? void 0 : x.exportButton) == null ? void 0 : b.text) || "导出";
1318
+ }), D = U(() => e.clickToEnterEditor !== !1);
1319
+ Y(() => e.images, (x) => {
1320
+ c.value = JSON.parse(JSON.stringify(x));
1319
1321
  }, { immediate: !0, deep: !0 });
1320
- const B = (b) => {
1321
- o.value = b, r.value = "editor", C.value && (C.value.scrollTop = 0), Gt(() => {
1322
- y.value && (y.value.scrollTop = 0), window.scrollTo(0, 0), requestAnimationFrame(() => {
1323
- var w, S;
1324
- (S = (w = h.value) == null ? void 0 : w.jumpTo) == null || S.call(w, b);
1322
+ const L = (x) => {
1323
+ o.value = x, r.value = "editor", A.value && (A.value.scrollTop = 0), Gt(() => {
1324
+ u.value && (u.value.scrollTop = 0), window.scrollTo(0, 0), requestAnimationFrame(() => {
1325
+ var b, M;
1326
+ (M = (b = h.value) == null ? void 0 : b.jumpTo) == null || M.call(b, x);
1325
1327
  });
1326
1328
  });
1327
- }, Q = (b, w) => {
1328
- if (R.value) {
1329
- B(b);
1329
+ }, Q = (x, b) => {
1330
+ if (D.value) {
1331
+ L(x);
1330
1332
  return;
1331
1333
  }
1332
- a("imageClick", { index: b, imageId: w.id, image: w });
1333
- }, J = (b) => c.value.findIndex((w) => w.id === b);
1334
+ a("imageClick", { index: x, imageId: b.id, image: b });
1335
+ }, J = (x) => c.value.findIndex((b) => b.id === x);
1334
1336
  t({
1335
- openImageById: (b) => {
1336
- const w = J(b);
1337
- return w < 0 ? !1 : (B(w), !0);
1337
+ openImageById: (x) => {
1338
+ const b = J(x);
1339
+ return b < 0 ? !1 : (L(b), !0);
1338
1340
  },
1339
- triggerImageClickById: (b) => {
1340
- const w = J(b);
1341
- if (w < 0)
1341
+ triggerImageClickById: (x) => {
1342
+ const b = J(x);
1343
+ if (b < 0)
1342
1344
  return !1;
1343
- const S = c.value[w];
1344
- return S ? (a("imageClick", { index: w, imageId: S.id, image: S }), !0) : !1;
1345
+ const M = c.value[b];
1346
+ return M ? (a("imageClick", { index: b, imageId: M.id, image: M }), !0) : !1;
1345
1347
  }
1346
1348
  });
1347
1349
  const et = () => {
1348
1350
  if (h.value && h.value.getCurrentAnnotation) {
1349
- const b = h.value.getCurrentAnnotation();
1350
- c.value[o.value] && (c.value[o.value].annotations = b.annotations);
1351
+ const x = h.value.getCurrentAnnotation();
1352
+ c.value[o.value] && (c.value[o.value].annotations = x.annotations);
1351
1353
  }
1352
1354
  r.value = "gallery";
1353
1355
  }, nt = () => {
1354
1356
  a("export", c.value);
1355
- }, st = (b) => {
1356
- o.value = b.currentIndex, c.value[b.currentIndex] && (c.value[b.currentIndex].annotations = b.currentAnnotations);
1357
- }, it = (b) => {
1357
+ }, st = (x) => {
1358
+ o.value = x.currentIndex, c.value[x.currentIndex] && (c.value[x.currentIndex].annotations = x.currentAnnotations);
1359
+ }, it = (x) => {
1358
1360
  if (h.value && h.value.getCurrentAnnotation) {
1359
- const w = h.value.getCurrentAnnotation();
1360
- c.value[o.value] && (c.value[o.value].annotations = w.annotations, a("update:images", c.value));
1361
+ const b = h.value.getCurrentAnnotation();
1362
+ c.value[o.value] && (c.value[o.value].annotations = b.annotations, a("update:images", c.value));
1361
1363
  }
1362
- }, N = (b) => {
1364
+ }, N = (x) => {
1363
1365
  };
1364
- return (b, w) => (p(), x("div", {
1366
+ return (x, b) => (f(), p("div", {
1365
1367
  ref_key: "batchRootRef",
1366
- ref: y,
1368
+ ref: u,
1367
1369
  class: "batch-annotator"
1368
1370
  }, [
1369
- r.value === "gallery" ? (p(), x("div", cn, [
1371
+ r.value === "gallery" ? (f(), p("div", cn, [
1370
1372
  g("div", hn, [
1371
- g("h3", null, "批量查看与标注 (" + $(c.value.length) + " 张)", 1),
1373
+ g("h3", null, "批量查看与标注 (" + T(c.value.length) + " 张)", 1),
1372
1374
  g("div", dn, [
1373
- (p(!0), x(L, null, D(m.labels, (S) => (p(), x("span", {
1374
- key: S.id,
1375
+ (f(!0), p(R, null, F(v.labels, (M) => (f(), p("span", {
1376
+ key: M.id,
1375
1377
  class: "label-badge",
1376
- style: V({ backgroundColor: S.color })
1377
- }, $(S.name), 5))), 128))
1378
+ style: O({ backgroundColor: M.color })
1379
+ }, T(M.name), 5))), 128))
1378
1380
  ])
1379
1381
  ]),
1380
1382
  g("div", {
1381
1383
  ref_key: "galleryGridRef",
1382
- ref: C,
1384
+ ref: A,
1383
1385
  class: "gallery-grid"
1384
1386
  }, [
1385
- (p(!0), x(L, null, D(c.value, (S, W) => (p(), x("div", {
1387
+ (f(!0), p(R, null, F(c.value, (M, W) => (f(), p("div", {
1386
1388
  key: W,
1387
1389
  class: "gallery-item",
1388
- onClick: (ht) => Q(W, S)
1390
+ onClick: (ht) => Q(W, M)
1389
1391
  }, [
1390
1392
  g("div", un, [
1391
1393
  H(rn, {
1392
- src: S.imageUrl,
1393
- annotations: S.annotations || [],
1394
- labels: m.labels
1394
+ src: M.imageUrl,
1395
+ annotations: M.annotations || [],
1396
+ labels: v.labels,
1397
+ fit: "cover"
1395
1398
  }, null, 8, ["src", "annotations", "labels"])
1396
1399
  ]),
1397
1400
  g("div", vn, [
1398
- g("span", mn, "#" + $(W + 1), 1),
1399
- g("span", fn, $((S.annotations || []).length) + " 标注", 1)
1401
+ g("span", mn, "#" + T(W + 1), 1),
1402
+ g("span", fn, T((M.annotations || []).length) + " 标注", 1)
1400
1403
  ])
1401
1404
  ], 8, gn))), 128))
1402
1405
  ], 512),
1403
- _.value ? (p(), x("div", yn, [
1404
- u.value ? (p(), x("button", {
1406
+ I.value ? (f(), p("div", yn, [
1407
+ y.value ? (f(), p("button", {
1405
1408
  key: 0,
1406
1409
  class: "action-btn primary",
1407
- onClick: w[0] || (w[0] = (S) => B(0))
1410
+ onClick: b[0] || (b[0] = (M) => L(0))
1408
1411
  }, [
1409
1412
  H(P, { name: "edit" }),
1410
- Y(" " + $(T.value), 1)
1411
- ])) : z("", !0),
1412
- f.value ? (p(), x("button", {
1413
+ X(" " + T(C.value), 1)
1414
+ ])) : $("", !0),
1415
+ w.value ? (f(), p("button", {
1413
1416
  key: 1,
1414
1417
  class: "action-btn success",
1415
1418
  onClick: nt
1416
1419
  }, [
1417
1420
  H(P, { name: "download" }),
1418
- Y(" " + $(U.value), 1)
1419
- ])) : z("", !0)
1420
- ])) : z("", !0)
1421
- ])) : (p(), x("div", pn, [
1421
+ X(" " + T(B.value), 1)
1422
+ ])) : $("", !0)
1423
+ ])) : $("", !0)
1424
+ ])) : (f(), p("div", pn, [
1422
1425
  g("div", xn, [
1423
1426
  g("div", bn, [
1424
1427
  g("button", {
@@ -1426,9 +1429,9 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1426
1429
  onClick: et
1427
1430
  }, [
1428
1431
  H(P, { name: "back" }),
1429
- w[1] || (w[1] = Y(" 返回列表 ", -1))
1432
+ b[1] || (b[1] = X(" 返回列表 ", -1))
1430
1433
  ]),
1431
- g("span", wn, "正在标注: " + $(o.value + 1) + " / " + $(c.value.length), 1)
1434
+ g("span", wn, "正在标注: " + T(o.value + 1) + " / " + T(c.value.length), 1)
1432
1435
  ])
1433
1436
  ]),
1434
1437
  g("div", Cn, [
@@ -1436,7 +1439,7 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1436
1439
  ref_key: "annotatorRef",
1437
1440
  ref: h,
1438
1441
  batchImages: c.value,
1439
- labels: m.labels,
1442
+ labels: v.labels,
1440
1443
  annotationTypes: ["rectangle", "polygon", "point", "rotatedRect"],
1441
1444
  onBatchChange: st,
1442
1445
  onAnnotationChange: it,
@@ -1446,7 +1449,7 @@ const Qt = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" widt
1446
1449
  ]))
1447
1450
  ], 512));
1448
1451
  }
1449
- }), kn = /* @__PURE__ */ Z(An, [["__scopeId", "data-v-b540069b"]]);
1452
+ }), kn = /* @__PURE__ */ Z(An, [["__scopeId", "data-v-16638a5c"]]);
1450
1453
  export {
1451
1454
  kn as BatchAnnotator,
1452
1455
  Ze as ImageAnnotator,