@thehammer/template-verification 0.2.13 → 0.2.15

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,32 @@ 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 = {
227
+ key: 0,
228
+ class: "tv-mark-anchor"
229
+ }, Me = ["aria-label", "title"], Be = {
227
230
  key: 1,
228
231
  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
232
  "data-status": "verified"
230
- }, Be = {
231
- key: 3,
233
+ }, Ue = {
234
+ key: 2,
235
+ 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",
236
+ "data-status": "verified-empty"
237
+ }, ze = {
238
+ key: 4,
232
239
  class: "tv-correction-indicator ml-0.5 text-blue-500",
233
240
  "aria-hidden": !0
234
- }, Je = /* @__PURE__ */ U({
241
+ }, We = /* @__PURE__ */ U({
235
242
  __name: "VerifiedField",
236
243
  props: {
237
244
  source: {},
@@ -240,126 +247,130 @@ const Ve = ["data-status", "title"], De = {
240
247
  format: { type: Function }
241
248
  },
242
249
  setup(e) {
243
- const t = e, n = Q(), c = l(() => n.enabled.value), b = l(() => n.loading), r = l(() => {
250
+ const t = e, n = W(), d = l(() => n.enabled.value), m = l(() => n.loading), r = l(() => {
244
251
  var a;
245
252
  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(() => {
253
+ }), s = l(() => we(r.value)), h = l(() => {
247
254
  if (t.original !== void 0 && t.original !== null)
248
255
  return t.original;
249
- if (r.value && i.value.value !== null && i.value.value !== void 0)
250
- return i.value.value;
256
+ if (r.value && s.value.value !== null && s.value.value !== void 0)
257
+ return s.value.value;
251
258
  if (t.source && t.field) return t.source[t.field];
252
- }), v = l(() => {
253
- const a = m.value;
259
+ }), p = l(() => {
260
+ const a = h.value;
254
261
  return a == null ? "" : typeof t.format == "function" ? t.format(a) : String(a);
255
262
  }), 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);
263
+ var i, u;
264
+ const a = (u = (i = r.value) == null ? void 0 : i.candidates) == null ? void 0 : u.extracted;
265
+ return (a == null ? void 0 : a.state) === "failed" ? "failed" : X(a == null ? void 0 : a.confidence);
266
+ }), b = l(() => _e(r.value)), o = l(() => Ie(r.value)), x = l(() => !b.value && $e(r.value)), k = l(() => {
267
+ var a, i;
268
+ return !!((i = (a = r.value) == null ? void 0 : a.candidates) != null && i.override);
269
+ }), I = l(() => {
270
+ var a, i, u;
271
+ 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
272
  }), E = l(() => {
263
- var s;
264
- const a = (s = r.value) == null ? void 0 : s.candidates;
273
+ var i;
274
+ const a = (i = r.value) == null ? void 0 : i.candidates;
265
275
  return !!(a != null && a.override || a != null && a.extracted || a != null && a.claim);
266
- }), I = l(() => c.value), R = l(() => {
276
+ }), $ = l(() => d.value), R = l(() => {
267
277
  const a = r.value;
268
- return I.value && !!a && ee(a);
278
+ return $.value && !!a && te(a);
269
279
  }), C = l(() => {
270
280
  var a;
271
281
  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}`;
282
+ }), z = l(() => {
283
+ var F, Y, G;
284
+ const a = t.field ?? "This value", i = C.value ? " — open in the review panel" : "";
285
+ if (I.value === "confirmed-empty")
286
+ return `${a}: a person confirmed this field is genuinely blank${i}`;
287
+ if (k.value) return `${a}: verified by a person${i}`;
288
+ const u = (Y = (F = r.value) == null ? void 0 : F.candidates) == null ? void 0 : Y.extracted, D = A.value, S = [];
289
+ D === "failed" ? S.push(V.failed) : (u == null ? void 0 : u.confidence) != null ? S.push(`${V[D]} (${u.confidence}/5)`) : S.push(V[D]);
290
+ const L = (u == null ? void 0 : u.sources_count) ?? ((G = u == null ? void 0 : u.sources) == null ? void 0 : G.length) ?? 0;
291
+ 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
292
  });
281
- function te() {
282
- var s;
283
- const a = (s = r.value) == null ? void 0 : s.anchor;
284
- a && Ee({
293
+ function ne() {
294
+ var i;
295
+ const a = (i = r.value) == null ? void 0 : i.anchor;
296
+ a && Re({
285
297
  anchor: a,
286
298
  workflowInputId: n.workflowInputId,
287
299
  label: t.field ?? null,
288
- value: v.value
300
+ value: p.value
289
301
  });
290
302
  }
291
- return (a, s) => (u(), g("span", {
292
- class: y(["tv-field", R.value ? "tv-needs-review" : ""])
303
+ return (a, i) => (c(), v("span", {
304
+ class: w(["tv-field", R.value ? "tv-needs-review" : ""])
293
305
  }, [
294
- b.value ? (u(), j(f(ie), {
306
+ m.value ? (c(), j(f(se), {
295
307
  key: 0,
296
308
  shape: "rounded",
297
309
  class: "tv-field-skeleton inline-block h-[1em] w-16 align-middle"
298
- })) : (u(), g(M, { key: 1 }, [
299
- p("span", {
300
- class: y([
310
+ })) : (c(), v(M, { key: 1 }, [
311
+ g("span", {
312
+ class: w([
301
313
  "tv-field-value",
302
- I.value && !E.value ? "tv-field-unverified border-b border-dotted border-gray-300" : ""
314
+ $.value && !E.value ? "tv-field-unverified border-b border-dotted border-gray-300" : ""
303
315
  ])
304
316
  }, [
305
- ne(a.$slots, "default", {
306
- value: m.value,
307
- formatted: v.value
317
+ re(a.$slots, "default", {
318
+ value: h.value,
319
+ formatted: p.value
308
320
  }, () => [
309
- re(w(v.value), 1)
321
+ ae(y(p.value), 1)
310
322
  ])
311
323
  ], 2),
312
- p("span", Pe, [
313
- I.value ? (u(), g("button", {
314
- key: 0,
324
+ $.value ? (c(), v("span", je, [
325
+ g("button", {
315
326
  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)
327
+ class: w(["tv-overlay", [f(T), C.value ? "cursor-pointer" : "cursor-default"]]),
328
+ "aria-label": z.value,
329
+ title: z.value,
330
+ onClick: i[0] || (i[0] = (u) => C.value ? ne() : void 0)
320
331
  }, [
321
- k.value ? (u(), g("span", Me, "✔")) : (u(), j(Ne, {
332
+ I.value === "unverified" ? (c(), j(Pe, {
322
333
  key: 0,
323
334
  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" : ""]),
335
+ }, null, 8, ["status"])) : I.value === "confirmed" ? (c(), v("span", Be, "✔")) : (c(), v("span", Ue, "✔")),
336
+ b.value && !k.value ? (c(), v("span", {
337
+ key: 3,
338
+ class: w(["tv-discrepancy-indicator ml-0.5 text-amber-500", o.value ? "tv-source-discrepancy-indicator" : ""]),
328
339
  "aria-hidden": !0
329
- }, "⚠", 2)) : x.value && !k.value ? (u(), g("span", Be, "✎")) : _("", !0)
330
- ], 10, je)) : _("", !0)
331
- ])
340
+ }, "⚠", 2)) : x.value && !k.value ? (c(), v("span", ze, "✎")) : _("", !0)
341
+ ], 10, Me)
342
+ ])) : _("", !0)
332
343
  ], 64))
333
344
  ], 2));
334
345
  }
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 = {
346
+ }), 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
347
  key: 0,
337
348
  class: "tv-attempts-recorded mt-1 text-[11px] text-gray-400"
338
- }, Qe = /* @__PURE__ */ U({
349
+ }, Xe = /* @__PURE__ */ U({
339
350
  __name: "VerificationChrome",
340
351
  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);
352
+ const t = W(), { enabled: n } = t, d = ue(), m = P(!1), r = l(() => Ve(t.data)), s = l(
353
+ () => ee(t.data).reduce(
354
+ (b, o) => {
355
+ var x, k, I, E, $, R, C;
356
+ 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
357
  },
347
358
  0
348
359
  )
349
- ), m = P(!1);
350
- K(
360
+ ), h = P(!1);
361
+ q(
351
362
  () => r.value.percent,
352
- (h) => {
353
- h === 100 && r.value.total > 0 && !m.value && (m.value = !0, c.success("All data points verified 🎯"));
363
+ (b) => {
364
+ b === 100 && r.value.total > 0 && !h.value && (h.value = !0, d.success("All data points verified 🎯"));
354
365
  }
355
366
  );
356
- let v = 0;
367
+ let p = 0;
357
368
  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(
369
+ const b = document.querySelectorAll(".tv-needs-review");
370
+ if (!b.length) return;
371
+ p = p % b.length;
372
+ const o = b[p];
373
+ p++, o.scrollIntoView({ behavior: "smooth", block: "center" }), o.animate(
363
374
  [
364
375
  { boxShadow: "0 0 0 0 rgba(245, 158, 11, 0.8)" },
365
376
  { boxShadow: "0 0 0 12px rgba(245, 158, 11, 0)" }
@@ -367,45 +378,45 @@ const Ve = ["data-status", "title"], De = {
367
378
  { duration: 900, iterations: 2 }
368
379
  );
369
380
  }
370
- return (h, o) => (u(), g(M, null, [
371
- p("button", {
381
+ return (b, o) => (c(), v(M, null, [
382
+ g("button", {
372
383
  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($)]),
384
+ 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
385
  title: "Verification",
375
- onClick: o[0] || (o[0] = G((x) => b.value = !b.value, ["stop"]))
386
+ onClick: o[0] || (o[0] = H((x) => m.value = !m.value, ["stop"]))
376
387
  }, [
377
- N(f(ue), {
378
- icon: f(ce),
388
+ N(f(ce), {
389
+ icon: f(de),
379
390
  class: "h-5 w-5"
380
391
  }, null, 8, ["icon"]),
381
- f(n) && r.value.needsReview > 0 ? (u(), j(f(de), {
392
+ f(n) && r.value.needsReview > 0 ? (c(), j(f(fe), {
382
393
  key: 0,
383
394
  value: r.value.needsReview,
384
395
  variant: "warning",
385
396
  class: "tv-needs-review-badge absolute -right-1 -top-1"
386
397
  }, null, 8, ["value"])) : _("", !0)
387
398
  ], 2),
388
- b.value ? (u(), g("div", {
399
+ m.value ? (c(), v("div", {
389
400
  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($)])
401
+ 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
402
  }, [
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),
403
+ g("label", Fe, [
404
+ o[2] || (o[2] = g("span", null, "Verification overlay", -1)),
405
+ le(g("input", {
406
+ "onUpdate:modelValue": o[1] || (o[1] = (x) => ie(n) ? n.value = x : null),
396
407
  type: "checkbox",
397
408
  class: "tv-enable-checkbox h-4 w-4 accent-gray-900"
398
409
  }, null, 512), [
399
410
  [oe, f(n)]
400
411
  ])
401
412
  ]),
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)
413
+ f(n) && r.value.total > 0 ? (c(), v(M, { key: 0 }, [
414
+ g("div", Ye, [
415
+ g("div", Ge, [
416
+ o[3] || (o[3] = g("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
417
+ g("span", He, y(r.value.verified) + " / " + y(r.value.total), 1)
407
418
  ]),
408
- N(f(fe), {
419
+ N(f(ve), {
409
420
  value: r.value.verified,
410
421
  max: r.value.total,
411
422
  size: "md",
@@ -415,46 +426,46 @@ const Ve = ["data-status", "title"], De = {
415
426
  glow: r.value.percent === 100,
416
427
  gradient: ""
417
428
  }, 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)
429
+ s.value > 0 ? (c(), v("div", Ke, y(s.value) + " extraction attempt" + y(s.value === 1 ? "" : "s") + " recorded ", 1)) : _("", !0)
419
430
  ]),
420
- r.value.needsReview > 0 ? (u(), g("button", {
431
+ r.value.needsReview > 0 ? (c(), v("button", {
421
432
  key: 0,
422
433
  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"])
434
+ 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)]),
435
+ onClick: H(A, ["stop"])
425
436
  }, [
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))
437
+ g("span", null, y(r.value.needsReview) + " need" + y(r.value.needsReview === 1 ? "s" : "") + " review", 1),
438
+ o[4] || (o[4] = g("span", { "aria-hidden": "true" }, "→", -1))
428
439
  ], 2)) : _("", !0)
429
440
  ], 64)) : _("", !0)
430
441
  ], 2)) : _("", !0),
431
- N(f(ve), {
432
- class: y(f($))
442
+ N(f(pe), {
443
+ class: w(f(T))
433
444
  }, null, 8, ["class"])
434
445
  ], 64));
435
446
  }
436
447
  });
437
448
  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,
449
+ T as CHROME_CLASS,
450
+ Pe as ConfidenceIcon,
451
+ Ae as DATA_POINT_ACTIVATED,
452
+ J as ENABLED_STORAGE_KEY,
453
+ Z as RESOLUTION_PRIORITY,
454
+ ye as STATUS_COLORS,
444
455
  V as STATUS_LABELS,
445
456
  Ce as TEMPLATE_MESSAGE_SOURCE,
446
457
  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,
458
+ Xe as VerificationChrome,
459
+ We as VerifiedField,
460
+ X as bucketConfidence,
461
+ ke as candidatesDisagree,
462
+ Ve as computeProgress,
463
+ Ee as embedderOrigin,
464
+ _e as hasDiscrepancy,
465
+ Qe as initVerification,
466
+ Re as notifyDataPointActivated,
467
+ xe as resolveCandidates,
457
468
  we as resolveDataPoint,
458
- Q as useVerification,
459
- Z as walkDataPoints
469
+ W as useVerification,
470
+ ee as walkDataPoints
460
471
  };