@thehammer/template-verification 0.2.13 → 0.2.14

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,8 +1,8 @@
1
- import { ref as P, watch as K, defineComponent as U, computed as l, openBlock as u, createElementBlock as g, normalizeClass as y, createElementVNode as p, toDisplayString as w, createCommentVNode as _, createBlock as j, unref as f, Fragment as M, renderSlot as ne, createTextVNode as re, withModifiers as G, createVNode as N, withDirectives as ae, isRef as le, vModelCheckbox as oe } from "vue";
2
- import { DanxSkeleton as ie, useToast as se, DanxIcon as ue, gearIcon as ce, DanxBadge as de, DanxProgressBar as fe, DanxToastContainer as ve } from "@thehammer/danx-ui";
3
- const $ = "tv-chrome", q = "template-verification:enabled";
1
+ import { ref as P, watch as q, defineComponent as U, computed as l, openBlock as c, createElementBlock as v, normalizeClass as w, createElementVNode as g, toDisplayString as y, createCommentVNode as _, createBlock as j, unref as f, Fragment as M, renderSlot as re, createTextVNode as ae, withModifiers as H, createVNode as N, withDirectives as le, isRef as ie, vModelCheckbox as oe } from "vue";
2
+ import { DanxSkeleton as se, useToast as ue, DanxIcon as ce, gearIcon as de, DanxBadge as fe, DanxProgressBar as ve, DanxToastContainer as pe } from "@thehammer/danx-ui";
3
+ const T = "tv-chrome", J = "template-verification:enabled";
4
4
  let O = null;
5
- function pe(e) {
5
+ function ge(e) {
6
6
  var t;
7
7
  try {
8
8
  return ((t = globalThis.localStorage) == null ? void 0 : t.getItem(e)) ?? null;
@@ -10,7 +10,7 @@ function pe(e) {
10
10
  return null;
11
11
  }
12
12
  }
13
- function ge(e, t) {
13
+ function me(e, t) {
14
14
  var n;
15
15
  try {
16
16
  (n = globalThis.localStorage) == null || n.setItem(e, t);
@@ -18,14 +18,14 @@ function ge(e, t) {
18
18
  }
19
19
  }
20
20
  function be(e) {
21
- const t = pe(q);
21
+ const t = ge(J);
22
22
  return t === null ? e : t === "true";
23
23
  }
24
- function J(e) {
24
+ function Q(e) {
25
25
  const t = P(be((e == null ? void 0 : e.defaultEnabled) ?? !1));
26
- return K(
26
+ return q(
27
27
  t,
28
- (n) => ge(q, n ? "true" : "false")
28
+ (n) => me(J, n ? "true" : "false")
29
29
  ), {
30
30
  enabled: t,
31
31
  data: (e == null ? void 0 : e.data) ?? {},
@@ -34,12 +34,12 @@ function J(e) {
34
34
  };
35
35
  }
36
36
  function he() {
37
- return O || (O = J()), O;
37
+ return O || (O = Q()), O;
38
38
  }
39
- function qe(e) {
40
- O = J(e);
39
+ function Qe(e) {
40
+ O = Q(e);
41
41
  }
42
- function Q() {
42
+ function W() {
43
43
  const e = he();
44
44
  return {
45
45
  enabled: e.enabled,
@@ -48,10 +48,10 @@ function Q() {
48
48
  loading: e.loading
49
49
  };
50
50
  }
51
- function W(e) {
51
+ function X(e) {
52
52
  return typeof e != "number" || Number.isNaN(e) ? "unverifiable" : e <= 2 ? "low" : e === 3 ? "medium" : "high";
53
53
  }
54
- const me = {
54
+ const ye = {
55
55
  high: "bg-green-50 text-green-700 ring-1 ring-inset ring-green-600/20",
56
56
  medium: "bg-yellow-50 text-yellow-700 ring-1 ring-inset ring-yellow-600/20",
57
57
  low: "bg-red-50 text-red-700 ring-1 ring-inset ring-red-600/20",
@@ -65,60 +65,60 @@ const me = {
65
65
  low: "Low",
66
66
  unverifiable: "Unverifiable",
67
67
  failed: "Failed"
68
- }, X = ["override", "extracted", "claim"];
68
+ }, Z = ["override", "extracted", "claim"];
69
69
  function we(e) {
70
- return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : ye(e.candidates) : { value: null, source: "none" };
70
+ return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : xe(e.candidates) : { value: null, source: "none" };
71
71
  }
72
- function ye(e) {
72
+ function xe(e) {
73
73
  if (e)
74
- for (const t of X) {
74
+ for (const t of Z) {
75
75
  const n = e[t];
76
76
  if (n != null)
77
77
  return { value: n.value, source: t };
78
78
  }
79
79
  return { value: null, source: "none" };
80
80
  }
81
- function xe(e) {
82
- return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : _e(e.candidates) : !1;
83
- }
84
81
  function _e(e) {
82
+ return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : ke(e.candidates) : !1;
83
+ }
84
+ function ke(e) {
85
85
  if (!e) return !1;
86
- const t = X.map((n) => e[n]).filter((n) => n != null).map((n) => ke(n.value));
86
+ const t = Z.map((n) => e[n]).filter((n) => n != null).map((n) => Se(n.value));
87
87
  return t.length < 2 ? !1 : new Set(t).size > 1;
88
88
  }
89
- function ke(e) {
89
+ function Se(e) {
90
90
  return JSON.stringify(e ?? null);
91
91
  }
92
- function Se(e) {
92
+ function Ie(e) {
93
93
  return !!(e != null && e.source_discrepancy);
94
94
  }
95
- function Ie(e) {
95
+ function $e(e) {
96
96
  return !!(e != null && e.correction);
97
97
  }
98
- const Ce = "danxbot-template", Te = 1, $e = "data-point-activated";
99
- function Ae() {
98
+ const Ce = "danxbot-template", Te = 1, Ae = "data-point-activated";
99
+ function Ee() {
100
100
  if (typeof window > "u") return null;
101
101
  const e = window.location.ancestorOrigins, t = e && e.length > 0 ? e[0] : null;
102
102
  if (t && t !== "null") return t;
103
103
  const n = typeof document > "u" ? "" : document.referrer;
104
104
  if (!n) return null;
105
105
  try {
106
- const c = new URL(n).origin;
107
- return c === "null" ? null : c;
106
+ const d = new URL(n).origin;
107
+ return d === "null" ? null : d;
108
108
  } catch {
109
109
  return null;
110
110
  }
111
111
  }
112
- function Ee(e) {
112
+ function Re(e) {
113
113
  if (typeof window > "u") return !1;
114
114
  const t = window.parent;
115
115
  if (!t || t === window) return !1;
116
- const n = Ae();
116
+ const n = Ee();
117
117
  if (!n) return !1;
118
- const c = {
118
+ const d = {
119
119
  source: Ce,
120
120
  version: Te,
121
- type: $e,
121
+ type: Ae,
122
122
  anchor: {
123
123
  object_ids: [...e.anchor.object_ids],
124
124
  field: e.anchor.field,
@@ -128,72 +128,72 @@ function Ee(e) {
128
128
  label: e.label ?? null,
129
129
  value: e.value ?? null
130
130
  };
131
- return t.postMessage(c, n), !0;
131
+ return t.postMessage(d, n), !0;
132
132
  }
133
- const Re = /* @__PURE__ */ new Set(["name", "type"]);
134
- function Z(e, t = "") {
133
+ const Oe = /* @__PURE__ */ new Set(["name", "type"]);
134
+ function ee(e, t = "") {
135
135
  const n = [];
136
136
  return B(e, t, n), n;
137
137
  }
138
138
  function B(e, t, n) {
139
139
  if (Array.isArray(e)) {
140
- e.forEach((r, i) => B(r, `${t}[${i}]`, n));
140
+ e.forEach((r, s) => B(r, `${t}[${s}]`, n));
141
141
  return;
142
142
  }
143
- if (!H(e)) return;
144
- const b = e.__meta ?? {};
145
- for (const [r, i] of Object.entries(e)) {
143
+ if (!K(e)) return;
144
+ const m = e.__meta ?? {};
145
+ for (const [r, s] of Object.entries(e)) {
146
146
  if (r === "__meta") continue;
147
- const m = t ? `${t}.${r}` : r;
148
- if (Array.isArray(i) || H(i)) {
149
- B(i, m, n);
147
+ const h = t ? `${t}.${r}` : r;
148
+ if (Array.isArray(s) || K(s)) {
149
+ B(s, h, n);
150
150
  continue;
151
151
  }
152
- const v = b[r];
153
- !v && Re.has(r) || n.push({
154
- path: m,
152
+ const p = m[r];
153
+ !p && Oe.has(r) || n.push({
154
+ path: h,
155
155
  label: r,
156
- meta: v ?? null,
157
- value: i,
158
- unanchored: !v
156
+ meta: p ?? null,
157
+ value: s,
158
+ unanchored: !p
159
159
  });
160
160
  }
161
161
  }
162
- function H(e) {
162
+ function K(e) {
163
163
  return typeof e == "object" && e !== null && !Array.isArray(e);
164
164
  }
165
- function ee(e) {
165
+ function te(e) {
166
166
  var n;
167
167
  if (e.candidates.override) return !1;
168
168
  const t = (n = e.candidates.extracted) == null ? void 0 : n.confidence;
169
169
  return e.discrepancy || t == null || t <= 2;
170
170
  }
171
- function Oe(e) {
172
- const t = Z(e).filter(
171
+ function Ve(e) {
172
+ const t = ee(e).filter(
173
173
  (r) => r.meta !== null
174
174
  ), n = t.length;
175
- let c = 0, b = 0;
175
+ let d = 0, m = 0;
176
176
  for (const r of t) {
177
177
  if (r.meta.candidates.override) {
178
- c++;
178
+ d++;
179
179
  continue;
180
180
  }
181
- ee(r.meta) && b++;
181
+ te(r.meta) && m++;
182
182
  }
183
183
  return {
184
184
  total: n,
185
- verified: c,
186
- needsReview: b,
187
- percent: n === 0 ? 100 : Math.round(c / n * 100)
185
+ verified: d,
186
+ needsReview: m,
187
+ percent: n === 0 ? 100 : Math.round(d / n * 100)
188
188
  };
189
189
  }
190
- const Ve = ["data-status", "title"], De = {
190
+ const De = ["data-status", "title"], Le = {
191
191
  class: "tv-confidence-glyph",
192
192
  "aria-hidden": "true"
193
- }, Le = {
193
+ }, Ne = {
194
194
  key: 0,
195
195
  class: "tv-confidence-label"
196
- }, Ne = /* @__PURE__ */ U({
196
+ }, Pe = /* @__PURE__ */ U({
197
197
  __name: "ConfidenceIcon",
198
198
  props: {
199
199
  confidence: {},
@@ -202,8 +202,8 @@ const Ve = ["data-status", "title"], De = {
202
202
  },
203
203
  setup(e) {
204
204
  const t = e, n = l(
205
- () => t.status ?? W(t.confidence)
206
- ), c = {
205
+ () => t.status ?? X(t.confidence)
206
+ ), d = {
207
207
  high: "✔",
208
208
  // check
209
209
  medium: "⚠",
@@ -213,25 +213,29 @@ const Ve = ["data-status", "title"], De = {
213
213
  unverifiable: "?",
214
214
  failed: "⊗"
215
215
  // circled x — distinct from low's plain x
216
- }, b = l(() => c[n.value]), r = l(() => me[n.value]), i = l(() => V[n.value]);
217
- return (m, v) => (u(), g("span", {
218
- class: y(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", r.value]),
216
+ }, m = l(() => d[n.value]), r = l(() => ye[n.value]), s = l(() => V[n.value]);
217
+ return (h, p) => (c(), v("span", {
218
+ class: w(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", r.value]),
219
219
  "data-status": n.value,
220
- title: i.value
220
+ title: s.value
221
221
  }, [
222
- p("span", De, w(b.value), 1),
223
- e.showLabel ? (u(), g("span", Le, w(i.value), 1)) : _("", !0)
224
- ], 10, Ve));
222
+ g("span", Le, y(m.value), 1),
223
+ e.showLabel ? (c(), v("span", Ne, y(s.value), 1)) : _("", !0)
224
+ ], 10, De));
225
225
  }
226
- }), Pe = { class: "tv-mark-slot" }, je = ["aria-label", "title"], Me = {
226
+ }), je = { class: "tv-mark-slot" }, Me = ["aria-label", "title"], Be = {
227
227
  key: 1,
228
228
  class: "tv-verified-chip inline-flex items-center gap-1 rounded-full bg-green-600 px-2 py-0.5 text-[11px] font-semibold leading-none text-white",
229
229
  "data-status": "verified"
230
- }, Be = {
231
- key: 3,
230
+ }, Ue = {
231
+ key: 2,
232
+ class: "tv-verified-chip tv-verified-chip-empty inline-flex items-center gap-1 rounded-full border-2 border-dashed border-green-600 bg-transparent px-2 py-0.5 text-[11px] font-semibold leading-none text-green-600",
233
+ "data-status": "verified-empty"
234
+ }, ze = {
235
+ key: 4,
232
236
  class: "tv-correction-indicator ml-0.5 text-blue-500",
233
237
  "aria-hidden": !0
234
- }, Je = /* @__PURE__ */ U({
238
+ }, We = /* @__PURE__ */ U({
235
239
  __name: "VerifiedField",
236
240
  props: {
237
241
  source: {},
@@ -240,126 +244,131 @@ const Ve = ["data-status", "title"], De = {
240
244
  format: { type: Function }
241
245
  },
242
246
  setup(e) {
243
- const t = e, n = Q(), c = l(() => n.enabled.value), b = l(() => n.loading), r = l(() => {
247
+ const t = e, n = W(), d = l(() => n.enabled.value), m = l(() => n.loading), r = l(() => {
244
248
  var a;
245
249
  return t.source && t.field ? ((a = t.source.__meta) == null ? void 0 : a[t.field]) ?? null : null;
246
- }), i = l(() => we(r.value)), m = l(() => {
250
+ }), s = l(() => we(r.value)), h = l(() => {
247
251
  if (t.original !== void 0 && t.original !== null)
248
252
  return t.original;
249
- if (r.value && i.value.value !== null && i.value.value !== void 0)
250
- return i.value.value;
253
+ if (r.value && s.value.value !== null && s.value.value !== void 0)
254
+ return s.value.value;
251
255
  if (t.source && t.field) return t.source[t.field];
252
- }), v = l(() => {
253
- const a = m.value;
256
+ }), p = l(() => {
257
+ const a = h.value;
254
258
  return a == null ? "" : typeof t.format == "function" ? t.format(a) : String(a);
255
259
  }), A = l(() => {
256
- var s, d;
257
- const a = (d = (s = r.value) == null ? void 0 : s.candidates) == null ? void 0 : d.extracted;
258
- return (a == null ? void 0 : a.state) === "failed" ? "failed" : W(a == null ? void 0 : a.confidence);
259
- }), h = l(() => xe(r.value)), o = l(() => Se(r.value)), x = l(() => !h.value && Ie(r.value)), k = l(() => {
260
- var a, s;
261
- return !!((s = (a = r.value) == null ? void 0 : a.candidates) != null && s.override);
260
+ var i, u;
261
+ const a = (u = (i = r.value) == null ? void 0 : i.candidates) == null ? void 0 : u.extracted;
262
+ return (a == null ? void 0 : a.state) === "failed" ? "failed" : X(a == null ? void 0 : a.confidence);
263
+ }), b = l(() => _e(r.value)), o = l(() => Ie(r.value)), x = l(() => !b.value && $e(r.value)), k = l(() => {
264
+ var a, i;
265
+ return !!((i = (a = r.value) == null ? void 0 : a.candidates) != null && i.override);
266
+ }), I = l(() => {
267
+ var a, i, u;
268
+ return k.value ? ((u = (i = (a = r.value) == null ? void 0 : a.candidates) == null ? void 0 : i.override) == null ? void 0 : u.value) === null ? "confirmed-empty" : "confirmed" : "unverified";
262
269
  }), E = l(() => {
263
- var s;
264
- const a = (s = r.value) == null ? void 0 : s.candidates;
270
+ var i;
271
+ const a = (i = r.value) == null ? void 0 : i.candidates;
265
272
  return !!(a != null && a.override || a != null && a.extracted || a != null && a.claim);
266
- }), I = l(() => c.value), R = l(() => {
273
+ }), $ = l(() => d.value), R = l(() => {
267
274
  const a = r.value;
268
- return I.value && !!a && ee(a);
275
+ return $.value && !!a && te(a);
269
276
  }), C = l(() => {
270
277
  var a;
271
278
  return !!((a = r.value) != null && a.anchor);
272
- }), T = l(() => {
273
- var z, F, Y;
274
- const a = t.field ?? "This value", s = C.value ? " — open in the review panel" : "";
275
- if (k.value) return `${a}: verified by a person${s}`;
276
- const d = (F = (z = r.value) == null ? void 0 : z.candidates) == null ? void 0 : F.extracted, D = A.value, S = [];
277
- D === "failed" ? S.push(V.failed) : (d == null ? void 0 : d.confidence) != null ? S.push(`${V[D]} (${d.confidence}/5)`) : S.push(V[D]);
278
- const L = (d == null ? void 0 : d.sources_count) ?? ((Y = d == null ? void 0 : d.sources) == null ? void 0 : Y.length) ?? 0;
279
- return L > 0 && S.push(`${L} cited ${L === 1 ? "page" : "pages"}`), h.value ? S.push(o.value ? "source document conflict" : "sources disagree") : x.value && S.push("value corrected"), `${a}: ${S.join(", ")}${s}`;
279
+ }), z = l(() => {
280
+ var F, Y, G;
281
+ const a = t.field ?? "This value", i = C.value ? " — open in the review panel" : "";
282
+ if (I.value === "confirmed-empty")
283
+ return `${a}: a person confirmed this field is genuinely blank${i}`;
284
+ if (k.value) return `${a}: verified by a person${i}`;
285
+ const u = (Y = (F = r.value) == null ? void 0 : F.candidates) == null ? void 0 : Y.extracted, D = A.value, S = [];
286
+ D === "failed" ? S.push(V.failed) : (u == null ? void 0 : u.confidence) != null ? S.push(`${V[D]} (${u.confidence}/5)`) : S.push(V[D]);
287
+ const L = (u == null ? void 0 : u.sources_count) ?? ((G = u == null ? void 0 : u.sources) == null ? void 0 : G.length) ?? 0;
288
+ return L > 0 && S.push(`${L} cited ${L === 1 ? "page" : "pages"}`), b.value ? S.push(o.value ? "source document conflict" : "sources disagree") : x.value && S.push("value corrected"), `${a}: ${S.join(", ")}${i}`;
280
289
  });
281
- function te() {
282
- var s;
283
- const a = (s = r.value) == null ? void 0 : s.anchor;
284
- a && Ee({
290
+ function ne() {
291
+ var i;
292
+ const a = (i = r.value) == null ? void 0 : i.anchor;
293
+ a && Re({
285
294
  anchor: a,
286
295
  workflowInputId: n.workflowInputId,
287
296
  label: t.field ?? null,
288
- value: v.value
297
+ value: p.value
289
298
  });
290
299
  }
291
- return (a, s) => (u(), g("span", {
292
- class: y(["tv-field", R.value ? "tv-needs-review" : ""])
300
+ return (a, i) => (c(), v("span", {
301
+ class: w(["tv-field", R.value ? "tv-needs-review" : ""])
293
302
  }, [
294
- b.value ? (u(), j(f(ie), {
303
+ m.value ? (c(), j(f(se), {
295
304
  key: 0,
296
305
  shape: "rounded",
297
306
  class: "tv-field-skeleton inline-block h-[1em] w-16 align-middle"
298
- })) : (u(), g(M, { key: 1 }, [
299
- p("span", {
300
- class: y([
307
+ })) : (c(), v(M, { key: 1 }, [
308
+ g("span", {
309
+ class: w([
301
310
  "tv-field-value",
302
- I.value && !E.value ? "tv-field-unverified border-b border-dotted border-gray-300" : ""
311
+ $.value && !E.value ? "tv-field-unverified border-b border-dotted border-gray-300" : ""
303
312
  ])
304
313
  }, [
305
- ne(a.$slots, "default", {
306
- value: m.value,
307
- formatted: v.value
314
+ re(a.$slots, "default", {
315
+ value: h.value,
316
+ formatted: p.value
308
317
  }, () => [
309
- re(w(v.value), 1)
318
+ ae(y(p.value), 1)
310
319
  ])
311
320
  ], 2),
312
- p("span", Pe, [
313
- I.value ? (u(), g("button", {
321
+ g("span", je, [
322
+ $.value ? (c(), v("button", {
314
323
  key: 0,
315
324
  type: "button",
316
- class: y(["tv-overlay", [f($), C.value ? "cursor-pointer" : "cursor-default"]]),
317
- "aria-label": T.value,
318
- title: T.value,
319
- onClick: s[0] || (s[0] = (d) => C.value ? te() : void 0)
325
+ class: w(["tv-overlay", [f(T), C.value ? "cursor-pointer" : "cursor-default"]]),
326
+ "aria-label": z.value,
327
+ title: z.value,
328
+ onClick: i[0] || (i[0] = (u) => C.value ? ne() : void 0)
320
329
  }, [
321
- k.value ? (u(), g("span", Me, "✔")) : (u(), j(Ne, {
330
+ I.value === "unverified" ? (c(), j(Pe, {
322
331
  key: 0,
323
332
  status: A.value
324
- }, null, 8, ["status"])),
325
- h.value && !k.value ? (u(), g("span", {
326
- key: 2,
327
- class: y(["tv-discrepancy-indicator ml-0.5 text-amber-500", o.value ? "tv-source-discrepancy-indicator" : ""]),
333
+ }, null, 8, ["status"])) : I.value === "confirmed" ? (c(), v("span", Be, "✔")) : (c(), v("span", Ue, "✔")),
334
+ b.value && !k.value ? (c(), v("span", {
335
+ key: 3,
336
+ class: w(["tv-discrepancy-indicator ml-0.5 text-amber-500", o.value ? "tv-source-discrepancy-indicator" : ""]),
328
337
  "aria-hidden": !0
329
- }, "⚠", 2)) : x.value && !k.value ? (u(), g("span", Be, "✎")) : _("", !0)
330
- ], 10, je)) : _("", !0)
338
+ }, "⚠", 2)) : x.value && !k.value ? (c(), v("span", ze, "✎")) : _("", !0)
339
+ ], 10, Me)) : _("", !0)
331
340
  ])
332
341
  ], 64))
333
342
  ], 2));
334
343
  }
335
- }), Ue = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, ze = { class: "tv-progress-block" }, Fe = { class: "mb-1 flex items-baseline justify-between" }, Ye = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, Ge = {
344
+ }), Fe = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, Ye = { class: "tv-progress-block" }, Ge = { class: "mb-1 flex items-baseline justify-between" }, He = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, Ke = {
336
345
  key: 0,
337
346
  class: "tv-attempts-recorded mt-1 text-[11px] text-gray-400"
338
- }, Qe = /* @__PURE__ */ U({
347
+ }, Xe = /* @__PURE__ */ U({
339
348
  __name: "VerificationChrome",
340
349
  setup(e) {
341
- const t = Q(), { enabled: n } = t, c = se(), b = P(!1), r = l(() => Oe(t.data)), i = l(
342
- () => Z(t.data).reduce(
343
- (h, o) => {
344
- var x, k, E, I, R, C, T;
345
- return h + (((E = (k = (x = o.meta) == null ? void 0 : x.candidates) == null ? void 0 : k.extracted) == null ? void 0 : E.history_count) ?? ((T = (C = (R = (I = o.meta) == null ? void 0 : I.candidates) == null ? void 0 : R.extracted) == null ? void 0 : C.history) == null ? void 0 : T.length) ?? 0);
350
+ const t = W(), { enabled: n } = t, d = ue(), m = P(!1), r = l(() => Ve(t.data)), s = l(
351
+ () => ee(t.data).reduce(
352
+ (b, o) => {
353
+ var x, k, I, E, $, R, C;
354
+ return b + (((I = (k = (x = o.meta) == null ? void 0 : x.candidates) == null ? void 0 : k.extracted) == null ? void 0 : I.history_count) ?? ((C = (R = ($ = (E = o.meta) == null ? void 0 : E.candidates) == null ? void 0 : $.extracted) == null ? void 0 : R.history) == null ? void 0 : C.length) ?? 0);
346
355
  },
347
356
  0
348
357
  )
349
- ), m = P(!1);
350
- K(
358
+ ), h = P(!1);
359
+ q(
351
360
  () => r.value.percent,
352
- (h) => {
353
- h === 100 && r.value.total > 0 && !m.value && (m.value = !0, c.success("All data points verified 🎯"));
361
+ (b) => {
362
+ b === 100 && r.value.total > 0 && !h.value && (h.value = !0, d.success("All data points verified 🎯"));
354
363
  }
355
364
  );
356
- let v = 0;
365
+ let p = 0;
357
366
  function A() {
358
- const h = document.querySelectorAll(".tv-needs-review");
359
- if (!h.length) return;
360
- v = v % h.length;
361
- const o = h[v];
362
- v++, o.scrollIntoView({ behavior: "smooth", block: "center" }), o.animate(
367
+ const b = document.querySelectorAll(".tv-needs-review");
368
+ if (!b.length) return;
369
+ p = p % b.length;
370
+ const o = b[p];
371
+ p++, o.scrollIntoView({ behavior: "smooth", block: "center" }), o.animate(
363
372
  [
364
373
  { boxShadow: "0 0 0 0 rgba(245, 158, 11, 0.8)" },
365
374
  { boxShadow: "0 0 0 12px rgba(245, 158, 11, 0)" }
@@ -367,45 +376,45 @@ const Ve = ["data-status", "title"], De = {
367
376
  { duration: 900, iterations: 2 }
368
377
  );
369
378
  }
370
- return (h, o) => (u(), g(M, null, [
371
- p("button", {
379
+ return (b, o) => (c(), v(M, null, [
380
+ g("button", {
372
381
  type: "button",
373
- class: y(["tv-settings-button fixed bottom-4 right-4 z-50 flex h-11 w-11 items-center justify-center rounded-full bg-gray-900 text-white shadow-lg transition-transform hover:scale-105", f($)]),
382
+ class: w(["tv-settings-button fixed bottom-4 right-4 z-50 flex h-11 w-11 items-center justify-center rounded-full bg-gray-900 text-white shadow-lg transition-transform hover:scale-105", f(T)]),
374
383
  title: "Verification",
375
- onClick: o[0] || (o[0] = G((x) => b.value = !b.value, ["stop"]))
384
+ onClick: o[0] || (o[0] = H((x) => m.value = !m.value, ["stop"]))
376
385
  }, [
377
- N(f(ue), {
378
- icon: f(ce),
386
+ N(f(ce), {
387
+ icon: f(de),
379
388
  class: "h-5 w-5"
380
389
  }, null, 8, ["icon"]),
381
- f(n) && r.value.needsReview > 0 ? (u(), j(f(de), {
390
+ f(n) && r.value.needsReview > 0 ? (c(), j(f(fe), {
382
391
  key: 0,
383
392
  value: r.value.needsReview,
384
393
  variant: "warning",
385
394
  class: "tv-needs-review-badge absolute -right-1 -top-1"
386
395
  }, null, 8, ["value"])) : _("", !0)
387
396
  ], 2),
388
- b.value ? (u(), g("div", {
397
+ m.value ? (c(), v("div", {
389
398
  key: 0,
390
- class: y(["tv-settings-panel fixed bottom-20 right-4 z-50 flex w-72 flex-col gap-4 rounded-xl bg-white p-4 shadow-2xl ring-1 ring-gray-200", f($)])
399
+ class: w(["tv-settings-panel fixed bottom-20 right-4 z-50 flex w-72 flex-col gap-4 rounded-xl bg-white p-4 shadow-2xl ring-1 ring-gray-200", f(T)])
391
400
  }, [
392
- p("label", Ue, [
393
- o[2] || (o[2] = p("span", null, "Verification overlay", -1)),
394
- ae(p("input", {
395
- "onUpdate:modelValue": o[1] || (o[1] = (x) => le(n) ? n.value = x : null),
401
+ g("label", Fe, [
402
+ o[2] || (o[2] = g("span", null, "Verification overlay", -1)),
403
+ le(g("input", {
404
+ "onUpdate:modelValue": o[1] || (o[1] = (x) => ie(n) ? n.value = x : null),
396
405
  type: "checkbox",
397
406
  class: "tv-enable-checkbox h-4 w-4 accent-gray-900"
398
407
  }, null, 512), [
399
408
  [oe, f(n)]
400
409
  ])
401
410
  ]),
402
- f(n) && r.value.total > 0 ? (u(), g(M, { key: 0 }, [
403
- p("div", ze, [
404
- p("div", Fe, [
405
- o[3] || (o[3] = p("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
406
- p("span", Ye, w(r.value.verified) + " / " + w(r.value.total), 1)
411
+ f(n) && r.value.total > 0 ? (c(), v(M, { key: 0 }, [
412
+ g("div", Ye, [
413
+ g("div", Ge, [
414
+ o[3] || (o[3] = g("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
415
+ g("span", He, y(r.value.verified) + " / " + y(r.value.total), 1)
407
416
  ]),
408
- N(f(fe), {
417
+ N(f(ve), {
409
418
  value: r.value.verified,
410
419
  max: r.value.total,
411
420
  size: "md",
@@ -415,46 +424,46 @@ const Ve = ["data-status", "title"], De = {
415
424
  glow: r.value.percent === 100,
416
425
  gradient: ""
417
426
  }, null, 8, ["value", "max", "variant", "striped", "animate-stripes", "glow"]),
418
- i.value > 0 ? (u(), g("div", Ge, w(i.value) + " extraction attempt" + w(i.value === 1 ? "" : "s") + " recorded ", 1)) : _("", !0)
427
+ s.value > 0 ? (c(), v("div", Ke, y(s.value) + " extraction attempt" + y(s.value === 1 ? "" : "s") + " recorded ", 1)) : _("", !0)
419
428
  ]),
420
- r.value.needsReview > 0 ? (u(), g("button", {
429
+ r.value.needsReview > 0 ? (c(), v("button", {
421
430
  key: 0,
422
431
  type: "button",
423
- class: y(["tv-next-flagged flex items-center justify-between rounded-lg bg-amber-50 px-3 py-2 text-left text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-600/20 transition hover:bg-amber-100", f($)]),
424
- onClick: G(A, ["stop"])
432
+ class: w(["tv-next-flagged flex items-center justify-between rounded-lg bg-amber-50 px-3 py-2 text-left text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-600/20 transition hover:bg-amber-100", f(T)]),
433
+ onClick: H(A, ["stop"])
425
434
  }, [
426
- p("span", null, w(r.value.needsReview) + " need" + w(r.value.needsReview === 1 ? "s" : "") + " review", 1),
427
- o[4] || (o[4] = p("span", { "aria-hidden": "true" }, "→", -1))
435
+ g("span", null, y(r.value.needsReview) + " need" + y(r.value.needsReview === 1 ? "s" : "") + " review", 1),
436
+ o[4] || (o[4] = g("span", { "aria-hidden": "true" }, "→", -1))
428
437
  ], 2)) : _("", !0)
429
438
  ], 64)) : _("", !0)
430
439
  ], 2)) : _("", !0),
431
- N(f(ve), {
432
- class: y(f($))
440
+ N(f(pe), {
441
+ class: w(f(T))
433
442
  }, null, 8, ["class"])
434
443
  ], 64));
435
444
  }
436
445
  });
437
446
  export {
438
- $ as CHROME_CLASS,
439
- Ne as ConfidenceIcon,
440
- $e as DATA_POINT_ACTIVATED,
441
- q as ENABLED_STORAGE_KEY,
442
- X as RESOLUTION_PRIORITY,
443
- me as STATUS_COLORS,
447
+ T as CHROME_CLASS,
448
+ Pe as ConfidenceIcon,
449
+ Ae as DATA_POINT_ACTIVATED,
450
+ J as ENABLED_STORAGE_KEY,
451
+ Z as RESOLUTION_PRIORITY,
452
+ ye as STATUS_COLORS,
444
453
  V as STATUS_LABELS,
445
454
  Ce as TEMPLATE_MESSAGE_SOURCE,
446
455
  Te as TEMPLATE_PROTOCOL_VERSION,
447
- Qe as VerificationChrome,
448
- Je as VerifiedField,
449
- W as bucketConfidence,
450
- _e as candidatesDisagree,
451
- Oe as computeProgress,
452
- Ae as embedderOrigin,
453
- xe as hasDiscrepancy,
454
- qe as initVerification,
455
- Ee as notifyDataPointActivated,
456
- ye as resolveCandidates,
456
+ Xe as VerificationChrome,
457
+ We as VerifiedField,
458
+ X as bucketConfidence,
459
+ ke as candidatesDisagree,
460
+ Ve as computeProgress,
461
+ Ee as embedderOrigin,
462
+ _e as hasDiscrepancy,
463
+ Qe as initVerification,
464
+ Re as notifyDataPointActivated,
465
+ xe as resolveCandidates,
457
466
  we as resolveDataPoint,
458
- Q as useVerification,
459
- Z as walkDataPoints
467
+ W as useVerification,
468
+ ee as walkDataPoints
460
469
  };