@thehammer/template-verification 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import { ref as U, watch as me, defineComponent as P, computed as d, openBlock as l, createElementBlock as i, normalizeClass as I, createElementVNode as a, toDisplayString as p, createCommentVNode as h, Fragment as O, createVNode as D, unref as x, withCtx as j, createTextVNode as E, renderList as T, createBlock as F, withDirectives as le, vModelText as xe, withKeys as ge, withModifiers as ye, renderSlot as _e, isRef as te, vModelCheckbox as be } from "vue";
2
- import { DanxDialog as G, DanxFile as he, DanxButton as Y, DanxFileViewer as we, DanxIcon as ke, gearIcon as Se } from "@thehammer/danx-ui";
3
- const A = "tv-chrome", ae = "template-verification:enabled";
4
- let R = null;
5
- function $e(e) {
1
+ import { ref as U, watch as ce, defineComponent as K, computed as u, openBlock as l, createElementBlock as i, normalizeClass as A, createElementVNode as n, toDisplayString as y, createCommentVNode as _, createBlock as N, unref as r, withCtx as I, createTextVNode as T, createVNode as V, Fragment as L, renderList as M, withKeys as Te, withModifiers as Ue, renderSlot as Ne, withDirectives as Ae, isRef as ge, vModelCheckbox as Re } from "vue";
2
+ import { DanxChip as J, CodeViewer as xe, useToast as _e, DanxDialog as re, DanxProgressBar as we, DanxAlert as ye, DanxTabs as Le, MarkdownEditor as je, DanxFileViewer as be, DanxButton as se, DanxInput as Ee, DanxSkeleton as ze, DanxTooltip as Pe, DanxIcon as Me, gearIcon as Be, DanxBadge as Fe, DanxToastContainer as qe } from "@thehammer/danx-ui";
3
+ const P = "tv-chrome", ke = "template-verification:enabled";
4
+ let te = null;
5
+ function Ye(e) {
6
6
  var t;
7
7
  try {
8
8
  return ((t = globalThis.localStorage) == null ? void 0 : t.getItem(e)) ?? null;
@@ -10,123 +10,128 @@ function $e(e) {
10
10
  return null;
11
11
  }
12
12
  }
13
- function Ve(e, t) {
14
- var n;
13
+ function Je(e, t) {
14
+ var a;
15
15
  try {
16
- (n = globalThis.localStorage) == null || n.setItem(e, t);
16
+ (a = globalThis.localStorage) == null || a.setItem(e, t);
17
17
  } catch {
18
18
  }
19
19
  }
20
- function Ce(e) {
21
- const t = $e(ae);
20
+ function Ke(e) {
21
+ const t = Ye(ke);
22
22
  return t === null ? e : t === "true";
23
23
  }
24
- function se(e) {
25
- const t = U(Ce((e == null ? void 0 : e.defaultEnabled) ?? !1));
26
- return me(t, (n) => Ve(ae, n ? "true" : "false")), {
24
+ function $e(e) {
25
+ const t = U(Ke((e == null ? void 0 : e.defaultEnabled) ?? !1));
26
+ return ce(
27
+ t,
28
+ (a) => Je(ke, a ? "true" : "false")
29
+ ), {
27
30
  enabled: t,
28
31
  data: (e == null ? void 0 : e.data) ?? {},
29
32
  saveOverride: e == null ? void 0 : e.saveOverride,
30
33
  workflowInputId: e == null ? void 0 : e.workflowInputId,
34
+ auditUrl: e == null ? void 0 : e.auditUrl,
31
35
  comparisonOpen: U(!1)
32
36
  };
33
37
  }
34
- function ie() {
35
- return R || (R = se()), R;
38
+ function Se() {
39
+ return te || (te = $e()), te;
36
40
  }
37
- function Bt(e) {
38
- R = se(e);
41
+ function ha(e) {
42
+ te = $e(e);
39
43
  }
40
- function Q() {
41
- const e = ie();
44
+ function le() {
45
+ const e = Se();
42
46
  return {
43
47
  enabled: e.enabled,
44
48
  data: e.data,
45
49
  saveOverride: e.saveOverride,
46
50
  workflowInputId: e.workflowInputId,
51
+ auditUrl: e.auditUrl,
47
52
  openComparison: () => {
48
53
  e.comparisonOpen.value = !0;
49
54
  }
50
55
  };
51
56
  }
52
- function Oe() {
53
- return ie().comparisonOpen;
57
+ function He() {
58
+ return Se().comparisonOpen;
54
59
  }
55
- function W(e) {
60
+ function ve(e) {
56
61
  return typeof e != "number" || Number.isNaN(e) ? "unverifiable" : e <= 2 ? "low" : e === 3 ? "medium" : "high";
57
62
  }
58
- const Le = {
63
+ const Ge = {
59
64
  high: "bg-green-50 text-green-700 ring-1 ring-inset ring-green-600/20",
60
65
  medium: "bg-yellow-50 text-yellow-700 ring-1 ring-inset ring-yellow-600/20",
61
66
  low: "bg-red-50 text-red-700 ring-1 ring-inset ring-red-600/20",
62
67
  unverifiable: "bg-gray-50 text-gray-500 ring-1 ring-inset ring-gray-400/20"
63
- }, Ie = {
68
+ }, ae = {
64
69
  high: "High",
65
70
  medium: "Medium",
66
71
  low: "Low",
67
72
  unverifiable: "Unverifiable"
68
- }, re = ["override", "extracted", "claim"];
69
- function X(e) {
70
- return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : Ue(e.candidates) : { value: null, source: "none" };
73
+ }, Ce = ["override", "extracted", "claim"];
74
+ function fe(e) {
75
+ return e ? e.resolved && e.resolved.source && e.resolved.source !== "none" ? e.resolved : Qe(e.candidates) : { value: null, source: "none" };
71
76
  }
72
- function Ue(e) {
77
+ function Qe(e) {
73
78
  if (e)
74
- for (const t of re) {
75
- const n = e[t];
76
- if (n != null)
77
- return { value: n.value, source: t };
79
+ for (const t of Ce) {
80
+ const a = e[t];
81
+ if (a != null)
82
+ return { value: a.value, source: t };
78
83
  }
79
84
  return { value: null, source: "none" };
80
85
  }
81
- function H(e) {
82
- var f, r;
83
- const t = (r = (f = e == null ? void 0 : e.candidates) == null ? void 0 : f.extracted) == null ? void 0 : r.reasoning;
86
+ function ie(e) {
87
+ var g, d;
88
+ const t = (d = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : d.reasoning;
84
89
  if (t == null) return null;
85
- const n = String(t).trim();
86
- return n === "" ? null : n;
90
+ const a = String(t).trim();
91
+ return a === "" ? null : a;
87
92
  }
88
- function q(e) {
89
- var f, r;
90
- const t = (r = (f = e == null ? void 0 : e.candidates) == null ? void 0 : f.extracted) == null ? void 0 : r.cited_text;
93
+ function oe(e) {
94
+ var g, d;
95
+ const t = (d = (g = e == null ? void 0 : e.candidates) == null ? void 0 : g.extracted) == null ? void 0 : d.cited_text;
91
96
  if (t == null) return null;
92
- const n = String(t).trim();
93
- return n === "" ? null : n;
97
+ const a = String(t).trim();
98
+ return a === "" ? null : a;
94
99
  }
95
- function oe(e) {
96
- return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : De(e.candidates) : !1;
100
+ function Ve(e) {
101
+ return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : We(e.candidates) : !1;
97
102
  }
98
- function De(e) {
103
+ function We(e) {
99
104
  if (!e) return !1;
100
- const t = re.map((n) => e[n]).filter((n) => n != null).map((n) => Ee(n.value));
105
+ const t = Ce.map((a) => e[a]).filter((a) => a != null).map((a) => Xe(a.value));
101
106
  return t.length < 2 ? !1 : new Set(t).size > 1;
102
107
  }
103
- function Ee(e) {
108
+ function Xe(e) {
104
109
  return JSON.stringify(e ?? null);
105
110
  }
106
- function Te(e, t, n) {
107
- var o;
108
- const f = (o = t.value) == null ? void 0 : o.anchor;
109
- if (!e.saveOverride || !f) return null;
110
- const r = e.saveOverride;
111
- return async (c, g) => {
112
- const b = await r({
111
+ function Ze(e, t, a) {
112
+ var c;
113
+ const g = (c = t.value) == null ? void 0 : c.anchor;
114
+ if (!e.saveOverride || !g) return null;
115
+ const d = e.saveOverride;
116
+ return async (m, s) => {
117
+ const b = await d({
113
118
  workflow_input_id: e.workflowInputId,
114
- object_ids: f.object_ids,
115
- field: f.field,
116
- field_path: f.field_path,
117
- value: c,
118
- source_choice: g
119
+ object_ids: g.object_ids,
120
+ field: g.field,
121
+ field_path: g.field_path,
122
+ value: m,
123
+ source_choice: s
119
124
  });
120
- return n(b), b;
125
+ return a(b), b;
121
126
  };
122
127
  }
123
- const Ae = ["data-status", "title"], Ne = {
128
+ const et = ["data-status", "title"], tt = {
124
129
  class: "tv-confidence-glyph",
125
130
  "aria-hidden": "true"
126
- }, je = {
131
+ }, at = {
127
132
  key: 0,
128
133
  class: "tv-confidence-label"
129
- }, z = /* @__PURE__ */ P({
134
+ }, ue = /* @__PURE__ */ K({
130
135
  __name: "ConfidenceIcon",
131
136
  props: {
132
137
  confidence: {},
@@ -134,9 +139,9 @@ const Ae = ["data-status", "title"], Ne = {
134
139
  showLabel: { type: Boolean }
135
140
  },
136
141
  setup(e) {
137
- const t = e, n = d(
138
- () => t.status ?? W(t.confidence)
139
- ), f = {
142
+ const t = e, a = u(
143
+ () => t.status ?? ve(t.confidence)
144
+ ), g = {
140
145
  high: "✔",
141
146
  // check
142
147
  medium: "⚠",
@@ -144,68 +149,186 @@ const Ae = ["data-status", "title"], Ne = {
144
149
  low: "✕",
145
150
  // x
146
151
  unverifiable: "?"
147
- }, r = d(() => f[n.value]), o = d(() => Le[n.value]), c = d(() => Ie[n.value]);
148
- return (g, b) => (l(), i("span", {
149
- class: I(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", o.value]),
150
- "data-status": n.value,
151
- title: c.value
152
+ }, d = u(() => g[a.value]), c = u(() => Ge[a.value]), m = u(() => ae[a.value]);
153
+ return (s, b) => (l(), i("span", {
154
+ class: A(["tv-confidence-icon inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold leading-none", c.value]),
155
+ "data-status": a.value,
156
+ title: m.value
152
157
  }, [
153
- a("span", Ne, p(r.value), 1),
154
- e.showLabel ? (l(), i("span", je, p(c.value), 1)) : h("", !0)
155
- ], 10, Ae));
158
+ n("span", tt, y(d.value), 1),
159
+ e.showLabel ? (l(), i("span", at, y(m.value), 1)) : _("", !0)
160
+ ], 10, et));
156
161
  }
157
162
  });
158
- function ue(e) {
163
+ async function lt(e, t) {
164
+ const a = t.object_ids.at(-1), g = new URLSearchParams({
165
+ object_id: String(a),
166
+ field: t.field
167
+ }), d = e.includes("?") ? "&" : "?", c = await fetch(`${e}${d}${g}`);
168
+ if (!c.ok)
169
+ throw new Error(
170
+ `data-point-audit ${c.status}: ${await c.text()}`
171
+ );
172
+ return (await c.json()).data ?? [];
173
+ }
174
+ function De(e) {
159
175
  if (!e || e.length === 0) return [];
160
176
  const t = /* @__PURE__ */ new Map();
161
- for (const n of e) {
162
- const f = Fe(n);
163
- let r = t.get(f);
164
- r || (r = {
165
- fileLabel: Me(n),
166
- fileUrl: n.file_url,
167
- file: n.file,
177
+ for (const a of e) {
178
+ const g = nt(a);
179
+ let d = t.get(g);
180
+ d || (d = {
181
+ fileLabel: st(a),
182
+ fileUrl: a.file_url,
183
+ file: a.file,
168
184
  sources: []
169
- }, t.set(f, r)), !r.fileUrl && n.file_url && (r.fileUrl = n.file_url), !r.file && n.file && (r.file = n.file), r.sources.push(n);
185
+ }, t.set(g, d)), !d.fileUrl && a.file_url && (d.fileUrl = a.file_url), !d.file && a.file && (d.file = a.file), d.sources.push(a);
170
186
  }
171
187
  return [...t.values()];
172
188
  }
173
- function Fe(e) {
189
+ function nt(e) {
174
190
  const t = e.file_name ?? e.file_id ?? e.stored_file_id ?? e.source_id ?? e.id;
175
191
  return t != null ? String(t) : "__unknown__";
176
192
  }
177
- function Me(e) {
193
+ function st(e) {
178
194
  var t;
179
195
  return (t = e.file) != null && t.name ? e.file.name : e.file_name ? e.file_name : e.file_id !== void 0 && e.file_id !== null ? `File ${e.file_id}` : e.stored_file_id !== void 0 && e.stored_file_id !== null ? `File ${e.stored_file_id}` : e.source_type ? e.source_type : "Source";
180
196
  }
181
- function ce(e) {
197
+ function rt(e) {
182
198
  return e.page !== void 0 && e.page !== null ? `Page ${e.page}` : e.explanation ? String(e.explanation) : e.source_type ? String(e.source_type) : "Citation";
183
199
  }
184
- const Pe = { class: "tv-modal flex flex-col gap-5 p-4 text-sm text-gray-700" }, Re = { class: "tv-modal-resolved rounded-lg border border-gray-200 bg-gray-50 p-3" }, ze = { class: "mt-1.5 flex flex-wrap items-center gap-2" }, Be = { class: "tv-resolved-value text-lg font-semibold leading-tight text-gray-900" }, Ke = { class: "mt-1 font-mono text-[11px] text-gray-400" }, Ye = { class: "tv-resolved-source" }, Ge = {
185
- key: 0,
186
- class: "tv-discrepancy mt-2 inline-flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 ring-1 ring-inset ring-amber-600/20"
187
- }, He = { class: "tv-modal-candidates" }, qe = { class: "mt-1.5 divide-y divide-gray-100 rounded-lg border border-gray-200" }, Je = { class: "w-20 shrink-0 text-xs font-medium text-gray-500" }, Qe = { class: "flex-1 truncate font-mono text-sm text-gray-800" }, We = { class: "shrink-0 text-[11px] text-gray-400" }, Xe = {
200
+ const it = { class: "tv-audit-call rounded-lg border border-gray-200 shadow-sm" }, ot = { class: "tv-audit-call-header flex flex-wrap items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2" }, ut = {
201
+ key: 2,
202
+ class: "font-mono text-[11px] text-gray-400"
203
+ }, dt = {
204
+ key: 3,
205
+ class: "text-[11px] font-medium text-gray-500"
206
+ }, ct = {
207
+ key: 4,
208
+ class: "text-[11px] text-gray-400"
209
+ }, vt = { class: "tv-audit-call-body flex flex-col gap-2 p-3" }, ft = /* @__PURE__ */ K({
210
+ __name: "AuditCallCard",
211
+ props: {
212
+ call: {}
213
+ },
214
+ setup(e) {
215
+ const t = e, a = u(() => {
216
+ const s = t.call.status_code;
217
+ return s == null ? "muted" : s >= 200 && s < 300 ? "success" : s >= 400 ? "danger" : "warning";
218
+ }), g = u(() => {
219
+ const s = t.call.run_time_ms;
220
+ return s == null ? null : s >= 1e3 ? `${(s / 1e3).toFixed(1)}s` : `${s}ms`;
221
+ }), d = u(() => {
222
+ if (!t.call.started_at) return null;
223
+ const s = new Date(t.call.started_at);
224
+ return Number.isNaN(s.getTime()) ? t.call.started_at : s.toLocaleString();
225
+ }), c = u(
226
+ () => JSON.stringify(t.call.request ?? null, null, 2)
227
+ ), m = u(
228
+ () => JSON.stringify(t.call.response ?? null, null, 2)
229
+ );
230
+ return (s, b) => (l(), i("div", it, [
231
+ n("div", ot, [
232
+ e.call.model ? (l(), N(r(J), {
233
+ key: 0,
234
+ variant: "info",
235
+ size: "xs",
236
+ class: "tv-audit-model"
237
+ }, {
238
+ default: I(() => [
239
+ T(y(e.call.model), 1)
240
+ ]),
241
+ _: 1
242
+ })) : _("", !0),
243
+ e.call.service ? (l(), N(r(J), {
244
+ key: 1,
245
+ variant: "muted",
246
+ size: "xxs"
247
+ }, {
248
+ default: I(() => [
249
+ T(y(e.call.service), 1)
250
+ ]),
251
+ _: 1
252
+ })) : _("", !0),
253
+ e.call.endpoint ? (l(), i("span", ut, y(e.call.endpoint), 1)) : _("", !0),
254
+ b[0] || (b[0] = n("span", { class: "flex-1" }, null, -1)),
255
+ V(r(J), {
256
+ variant: a.value,
257
+ size: "xxs",
258
+ class: "tv-audit-status"
259
+ }, {
260
+ default: I(() => [
261
+ T(y(e.call.status_code ?? "…"), 1)
262
+ ]),
263
+ _: 1
264
+ }, 8, ["variant"]),
265
+ g.value ? (l(), i("span", dt, y(g.value), 1)) : _("", !0),
266
+ d.value ? (l(), i("span", ct, y(d.value), 1)) : _("", !0)
267
+ ]),
268
+ n("div", vt, [
269
+ n("div", null, [
270
+ b[1] || (b[1] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Request ", -1)),
271
+ V(r(xe), {
272
+ "model-value": c.value,
273
+ format: "json",
274
+ collapsible: "",
275
+ "default-collapsed": "",
276
+ class: "tv-audit-request"
277
+ }, null, 8, ["model-value"])
278
+ ]),
279
+ n("div", null, [
280
+ b[2] || (b[2] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Response ", -1)),
281
+ V(r(xe), {
282
+ "model-value": m.value,
283
+ format: "json",
284
+ collapsible: "",
285
+ "default-collapsed": "",
286
+ class: "tv-audit-response"
287
+ }, null, 8, ["model-value"])
288
+ ])
289
+ ])
290
+ ]));
291
+ }
292
+ }), pt = { class: "tv-modal flex h-full flex-col gap-4 overflow-y-auto p-1" }, mt = { class: "tv-modal-resolved flex flex-col gap-3 rounded-xl border border-gray-200 bg-gradient-to-br from-gray-50 to-white p-4 shadow-sm" }, gt = { class: "flex flex-wrap items-start justify-between gap-4" }, xt = { class: "min-w-0 flex-1" }, yt = { class: "tv-resolved-value mt-1 break-words font-mono text-xl font-semibold leading-snug text-gray-900" }, bt = { class: "mt-1 text-[11px] text-gray-400" }, ht = { class: "tv-resolved-source font-medium text-gray-500" }, _t = { class: "tv-confidence-meter w-56 shrink-0" }, wt = { class: "mt-2" }, kt = {
293
+ key: 1,
294
+ class: "tv-confidence-value text-sm text-gray-400"
295
+ }, $t = {
188
296
  key: 0,
189
- class: "tv-modal-provenance flex flex-col gap-2 rounded-lg border border-gray-200 p-3"
190
- }, Ze = { class: "flex items-center justify-between" }, et = { class: "tv-confidence-value font-mono text-sm font-semibold text-gray-800" }, tt = { class: "tv-reasoning whitespace-pre-line text-sm leading-relaxed text-gray-600" }, nt = { class: "tv-cited-text rounded-md border-l-2 border-gray-300 bg-gray-50 py-1.5 pl-3 pr-2 text-sm italic leading-relaxed text-gray-600" }, lt = { class: "tv-modal-sources" }, at = {
297
+ class: "tv-tab-evidence flex min-h-0 flex-1 flex-col gap-4"
298
+ }, St = {
191
299
  key: 0,
192
- class: "tv-no-source mt-1.5 text-sm text-gray-400"
193
- }, st = {
300
+ class: "tv-reasoning-card rounded-lg border border-gray-200 p-3"
301
+ }, Ct = {
194
302
  key: 1,
195
- class: "tv-source-grid mt-2 grid grid-cols-[repeat(auto-fill,minmax(4.5rem,1fr))] items-start gap-3"
196
- }, it = { class: "relative" }, rt = ["href"], ot = {
303
+ class: "tv-cited-text rounded-lg border-l-4 border-blue-200 bg-blue-50/50 px-4 py-3 text-sm italic leading-relaxed text-gray-700"
304
+ }, Vt = {
197
305
  key: 2,
198
- class: "tv-source-name flex h-16 w-16 items-center justify-center rounded-md bg-gray-50 p-1 text-center text-[11px] leading-tight text-gray-500 ring-1 ring-gray-200"
199
- }, ut = {
306
+ class: "tv-evidence-viewer flex min-h-[24rem] flex-1 flex-col overflow-hidden rounded-lg border border-gray-200"
307
+ }, Dt = {
308
+ key: 0,
309
+ class: "tv-page-context border-t border-gray-100 bg-gray-50 px-3 py-2 text-xs text-gray-500"
310
+ }, Ot = {
200
311
  key: 3,
201
- class: "tv-source-count pointer-events-none absolute -right-1.5 -top-1.5 flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-gray-700 px-1 text-[9px] font-semibold text-white"
202
- }, ct = ["title"], dt = {
312
+ class: "tv-no-source rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
313
+ }, It = {
314
+ key: 4,
315
+ class: "tv-full-documents flex flex-wrap items-center gap-2"
316
+ }, Tt = {
317
+ key: 1,
318
+ class: "tv-tab-candidates flex flex-col gap-3"
319
+ }, Ut = { class: "flex flex-wrap items-center justify-between gap-3" }, Nt = { class: "min-w-0 flex-1" }, At = { class: "flex items-center gap-2" }, Rt = { class: "mt-2 break-words font-mono text-base text-gray-900" }, Lt = { class: "mt-1 text-xs text-gray-400" }, jt = {
203
320
  key: 0,
204
- class: "tv-source-citations flex flex-wrap justify-center gap-1"
205
- }, ft = {
321
+ class: "tv-custom-entry flex items-center gap-2 rounded-lg border border-dashed border-gray-300 p-4"
322
+ }, Et = {
206
323
  key: 1,
207
- class: "tv-modal-resolution flex flex-col gap-2 border-t border-gray-200 pt-4"
208
- }, vt = { class: "flex flex-wrap gap-2" }, pt = { class: "flex items-center gap-2" }, mt = /* @__PURE__ */ P({
324
+ class: "tv-read-only text-center text-xs text-gray-400"
325
+ }, zt = {
326
+ key: 2,
327
+ class: "tv-tab-audit flex flex-col gap-3"
328
+ }, Pt = {
329
+ key: 2,
330
+ class: "tv-audit-empty rounded-lg border border-dashed border-gray-200 p-6 text-center text-sm text-gray-400"
331
+ }, Mt = /* @__PURE__ */ K({
209
332
  __name: "VerificationModal",
210
333
  props: {
211
334
  modelValue: { type: Boolean },
@@ -215,255 +338,391 @@ const Pe = { class: "tv-modal flex flex-col gap-5 p-4 text-sm text-gray-700" },
215
338
  },
216
339
  emits: ["update:modelValue", "saved"],
217
340
  setup(e, { emit: t }) {
218
- const n = e, f = t, r = d({
219
- get: () => n.modelValue,
220
- set: (s) => f("update:modelValue", s)
221
- }), o = d(() => X(n.meta)), c = d(() => n.meta.candidates.extracted), g = d(() => n.meta.candidates.claim), b = d(() => n.meta.candidates.override), w = d(
222
- () => {
223
- var s;
224
- return W((s = c.value) == null ? void 0 : s.confidence);
225
- }
226
- ), y = d(() => H(n.meta)), v = d(() => q(n.meta)), $ = d(() => {
227
- var s;
228
- return ue((s = c.value) == null ? void 0 : s.sources);
229
- }), L = d(
230
- () => $.value.map((s) => s.file).filter((s) => !!s)
231
- ), C = U(null), k = d({
232
- get: () => C.value !== null,
233
- set: (s) => {
234
- s || (C.value = null);
341
+ const a = e, g = t, d = le(), c = _e(), m = u({
342
+ get: () => a.modelValue,
343
+ set: (f) => g("update:modelValue", f)
344
+ }), s = u(() => fe(a.meta)), b = u(() => a.meta.candidates.extracted), $ = u(() => a.meta.candidates.claim), h = u(() => a.meta.candidates.override), x = u(() => {
345
+ var f;
346
+ return ((f = b.value) == null ? void 0 : f.confidence) ?? null;
347
+ }), k = u(() => ve(x.value)), S = u(() => ie(a.meta)), R = u(() => oe(a.meta)), O = u(() => {
348
+ var f;
349
+ return De((f = b.value) == null ? void 0 : f.sources);
350
+ }), j = u(() => (a.meta.anchor.field_path || a.label || "Data point").split(".").map(
351
+ (o) => o.replace(/\[\d+\]/g, "").replace(/_/g, " ").replace(/^\w/, (C) => C.toUpperCase())
352
+ ).join(" › ")), H = {
353
+ high: "success",
354
+ medium: "warning",
355
+ low: "danger",
356
+ unverifiable: "muted"
357
+ }, E = U("evidence"), W = u(() => !!d.auditUrl), X = u(() => {
358
+ var o;
359
+ const f = [
360
+ {
361
+ value: "evidence",
362
+ label: "Evidence",
363
+ count: O.value.reduce((C, v) => C + v.sources.length, 0)
364
+ },
365
+ {
366
+ value: "candidates",
367
+ label: "Candidates",
368
+ count: Q.value.length
369
+ }
370
+ ];
371
+ return W.value && f.push({
372
+ value: "audit",
373
+ label: "Audit trail",
374
+ count: ((o = F.value) == null ? void 0 : o.length) ?? void 0
375
+ }), f;
376
+ }), q = u(
377
+ () => O.value.map((f) => f.file).filter((f) => !!f)
378
+ ), p = U(null), w = u(() => {
379
+ const f = p.value ?? q.value[0];
380
+ if (!f) return null;
381
+ const o = O.value.find(
382
+ (v) => v.file && String(v.file.id) === String(f.id)
383
+ );
384
+ if (!o) return null;
385
+ const C = o.sources.find((v) => v.explanation);
386
+ return (C == null ? void 0 : C.explanation) ?? null;
387
+ }), D = u(() => {
388
+ const f = /* @__PURE__ */ new Map();
389
+ for (const o of O.value)
390
+ for (const C of o.sources) {
391
+ const v = C.original_file;
392
+ v && !f.has(String(v.id)) && f.set(String(v.id), v);
393
+ }
394
+ return [...f.values()];
395
+ }), z = U(null), G = u({
396
+ get: () => z.value !== null,
397
+ set: (f) => {
398
+ f || (z.value = null);
235
399
  }
236
- });
237
- function N(s) {
238
- s.file && (C.value = s);
239
- }
240
- const B = d(() => {
241
- const s = [];
242
- return b.value && s.push({
243
- source: "Override",
400
+ }), Q = u(() => {
401
+ const f = [];
402
+ return h.value && f.push({
403
+ key: "override",
404
+ title: "Human override",
405
+ variant: "success",
406
+ value: h.value.value,
407
+ detail: [
408
+ h.value.source_choice ? `basis: ${h.value.source_choice}` : null,
409
+ h.value.set_at ? new Date(h.value.set_at).toLocaleString() : null
410
+ ].filter(Boolean).join(" · "),
411
+ winner: s.value.source === "override"
412
+ }), b.value && f.push({
413
+ key: "extracted",
414
+ title: "Extracted",
415
+ variant: H[k.value],
244
416
  value: b.value.value,
245
- detail: b.value.source_choice ? `via ${b.value.source_choice}` : void 0
246
- }), c.value && s.push({
247
- source: "Extracted",
248
- value: c.value.value,
249
- detail: S(c.value.confidence)
250
- }), g.value && s.push({
251
- source: "Claim",
252
- value: g.value.value,
253
- detail: g.value.claim_set_label ?? void 0
254
- }), s;
255
- }), M = U(""), _ = U(!1);
256
- function S(s) {
257
- return s == null ? "Unverifiable" : `${s}/5`;
258
- }
259
- function V(s) {
260
- return s == null ? "" : String(s);
261
- }
262
- async function K(s, u) {
263
- if (!(!n.save || _.value)) {
264
- _.value = !0;
417
+ detail: x.value != null ? `Confidence ${x.value}/5 · ${ae[k.value]}` : "No confidence recorded",
418
+ accept: a.save ? () => {
419
+ var o;
420
+ return ne(pe((o = b.value) == null ? void 0 : o.value), "extracted");
421
+ } : void 0,
422
+ winner: s.value.source === "extracted"
423
+ }), $.value && f.push({
424
+ key: "claim",
425
+ title: "Claim",
426
+ variant: "info",
427
+ value: $.value.value,
428
+ detail: $.value.claim_set_label ?? "Reference output",
429
+ accept: a.save ? () => {
430
+ var o;
431
+ return ne(pe((o = $.value) == null ? void 0 : o.value), "claim");
432
+ } : void 0,
433
+ winner: s.value.source === "claim"
434
+ }), f;
435
+ }), B = U(""), Y = U(!1);
436
+ async function ne(f, o) {
437
+ if (!(!a.save || Y.value)) {
438
+ Y.value = !0;
265
439
  try {
266
- const m = await n.save(s, u);
267
- f("saved", m);
440
+ const C = await a.save(f, o);
441
+ g("saved", C), c.success(`Verified — ${j.value} locked in`);
442
+ } catch {
443
+ c.danger(`Could not save ${j.value} — try again`);
268
444
  } finally {
269
- _.value = !1;
445
+ Y.value = !1;
270
446
  }
271
447
  }
272
448
  }
273
- const de = () => {
274
- var s;
275
- return K(Z((s = c.value) == null ? void 0 : s.value), "extracted");
276
- }, fe = () => {
277
- var s;
278
- return K(Z((s = g.value) == null ? void 0 : s.value), "claim");
279
- }, ve = () => K(M.value, "custom");
280
- function Z(s) {
281
- return s == null ? null : String(s);
449
+ const Ie = () => ne(B.value, "custom");
450
+ function pe(f) {
451
+ return f == null ? null : String(f);
282
452
  }
283
- return (s, u) => (l(), i(O, null, [
284
- D(x(G), {
285
- modelValue: r.value,
286
- "onUpdate:modelValue": u[1] || (u[1] = (m) => r.value = m),
287
- title: e.label || "Verification detail",
453
+ function me(f) {
454
+ return f == null ? "—" : String(f);
455
+ }
456
+ const F = U(null), Z = U(!1), ee = U(null);
457
+ return ce(
458
+ [E, m],
459
+ async ([f, o]) => {
460
+ if (!(f !== "audit" || !o || F.value !== null || Z.value) && d.auditUrl) {
461
+ Z.value = !0, ee.value = null;
462
+ try {
463
+ F.value = await lt(
464
+ d.auditUrl,
465
+ a.meta.anchor
466
+ );
467
+ } catch (C) {
468
+ ee.value = C instanceof Error ? C.message : String(C);
469
+ } finally {
470
+ Z.value = !1;
471
+ }
472
+ }
473
+ },
474
+ { immediate: !0 }
475
+ ), (f, o) => (l(), i(L, null, [
476
+ V(r(re), {
477
+ modelValue: m.value,
478
+ "onUpdate:modelValue": o[3] || (o[3] = (C) => m.value = C),
479
+ title: j.value,
480
+ width: 90,
481
+ height: 90,
288
482
  "close-x": "",
289
- class: I(x(A))
483
+ class: A(r(P))
290
484
  }, {
291
- default: j(() => [
292
- a("div", Pe, [
293
- a("section", Re, [
294
- u[4] || (u[4] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolved value ", -1)),
295
- a("div", ze, [
296
- a("span", Be, p(V(o.value.value) || "—"), 1),
297
- D(z, {
298
- status: w.value,
299
- "show-label": ""
300
- }, null, 8, ["status"])
301
- ]),
302
- a("div", Ke, [
303
- u[3] || (u[3] = E(" source: ", -1)),
304
- a("span", Ye, p(o.value.source), 1)
305
- ]),
306
- e.meta.discrepancy ? (l(), i("div", Ge, " ⚠ Sources disagree ")) : h("", !0)
307
- ]),
308
- a("section", He, [
309
- u[5] || (u[5] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Candidates ", -1)),
310
- a("div", qe, [
311
- (l(!0), i(O, null, T(B.value, (m) => (l(), i("div", {
312
- key: m.source,
313
- class: "tv-candidate-row flex items-center gap-3 px-3 py-2"
314
- }, [
315
- a("span", Je, p(m.source), 1),
316
- a("span", Qe, p(V(m.value)), 1),
317
- a("span", We, p(m.detail), 1)
318
- ]))), 128))
319
- ])
320
- ]),
321
- c.value ? (l(), i("section", Xe, [
322
- a("div", Ze, [
323
- u[6] || (u[6] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Confidence ", -1)),
324
- a("div", et, p(S(c.value.confidence)), 1)
325
- ]),
326
- y.value ? (l(), i(O, { key: 0 }, [
327
- u[7] || (u[7] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Reasoning ", -1)),
328
- a("p", tt, p(y.value), 1)
329
- ], 64)) : h("", !0),
330
- v.value ? (l(), i(O, { key: 1 }, [
331
- u[8] || (u[8] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Cited text ", -1)),
332
- a("blockquote", nt, [
333
- E(p(v.value) + " ", 1),
334
- a("span", {
335
- class: I([
336
- "tv-cited-verified ml-1 not-italic text-[11px] font-medium",
337
- c.value.cited_text_verified ? "text-green-600" : "text-gray-400"
485
+ default: I(() => {
486
+ var C;
487
+ return [
488
+ n("div", pt, [
489
+ n("section", mt, [
490
+ n("div", gt, [
491
+ n("div", xt, [
492
+ o[6] || (o[6] = n("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolved value ", -1)),
493
+ n("div", yt, y(me(s.value.value)), 1),
494
+ n("div", bt, [
495
+ o[5] || (o[5] = T(" source of truth: ", -1)),
496
+ n("span", ht, y(s.value.source), 1)
338
497
  ])
339
- }, p(c.value.cited_text_verified ? "✔ verified" : "unverified"), 3)
340
- ])
341
- ], 64)) : h("", !0)
342
- ])) : h("", !0),
343
- a("section", lt, [
344
- u[9] || (u[9] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Sources ", -1)),
345
- $.value.length === 0 ? (l(), i("div", at, " No source recorded ")) : (l(), i("div", st, [
346
- (l(!0), i(O, null, T($.value, (m) => (l(), i("div", {
347
- key: m.fileLabel,
348
- class: "tv-source-group flex flex-col items-center gap-1"
349
- }, [
350
- a("div", it, [
351
- m.file ? (l(), F(x(he), {
352
- key: 0,
353
- file: m.file,
354
- size: "sm",
355
- class: "tv-source-thumb cursor-pointer rounded-md ring-1 ring-gray-200 transition duration-150 hover:-translate-y-0.5 hover:shadow-md hover:ring-gray-300",
356
- onClick: (ee) => N(m)
357
- }, null, 8, ["file", "onClick"])) : m.fileUrl ? (l(), i("a", {
358
- key: 1,
359
- href: m.fileUrl,
360
- class: "tv-source-link flex h-16 w-16 items-center justify-center rounded-md bg-gray-50 p-1 text-center text-[11px] font-medium leading-tight text-blue-600 underline ring-1 ring-gray-200",
361
- target: "_blank",
362
- rel: "noopener"
363
- }, p(m.fileLabel), 9, rt)) : (l(), i("span", ot, p(m.fileLabel), 1)),
364
- m.sources.length > 1 ? (l(), i("span", ut, "×" + p(m.sources.length), 1)) : h("", !0)
365
498
  ]),
366
- a("span", {
367
- class: "tv-source-file-label w-full truncate text-center text-[11px] text-gray-500",
368
- title: m.fileLabel
369
- }, p(m.fileLabel), 9, ct),
370
- m.sources.length > 1 ? (l(), i("ul", dt, [
371
- (l(!0), i(O, null, T(m.sources, (ee, pe) => (l(), i("li", {
372
- key: pe,
373
- class: "tv-source-row rounded bg-gray-100 px-1 py-0.5 font-mono text-[10px] text-gray-500"
374
- }, p(x(ce)(ee)), 1))), 128))
375
- ])) : h("", !0)
376
- ]))), 128))
377
- ]))
378
- ]),
379
- e.save ? (l(), i("section", ft, [
380
- u[13] || (u[13] = a("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Resolve ", -1)),
381
- a("div", vt, [
382
- c.value ? (l(), F(x(Y), {
499
+ n("div", _t, [
500
+ o[7] || (o[7] = n("div", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Extraction confidence ", -1)),
501
+ n("div", wt, [
502
+ x.value != null ? (l(), N(r(we), {
503
+ key: 0,
504
+ value: x.value,
505
+ max: 5,
506
+ size: "md",
507
+ variant: H[k.value],
508
+ gradient: "",
509
+ shimmer: "",
510
+ "show-text": "",
511
+ "text-position": "beside",
512
+ label: `${x.value}/5`
513
+ }, null, 8, ["value", "variant", "label"])) : (l(), i("div", kt, " No confidence recorded "))
514
+ ]),
515
+ n("div", {
516
+ class: A(["tv-confidence-label mt-1 text-right text-xs font-medium", {
517
+ "text-green-600": k.value === "high",
518
+ "text-yellow-600": k.value === "medium",
519
+ "text-red-600": k.value === "low",
520
+ "text-gray-400": k.value === "unverifiable"
521
+ }])
522
+ }, y(r(ae)[k.value]), 3)
523
+ ])
524
+ ]),
525
+ e.meta.discrepancy ? (l(), N(r(ye), {
383
526
  key: 0,
384
- variant: "info",
385
- size: "sm",
386
- class: "tv-accept-extracted",
387
- disabled: _.value,
388
- onClick: de
527
+ variant: "warning",
528
+ class: "tv-discrepancy"
389
529
  }, {
390
- default: j(() => [...u[10] || (u[10] = [
391
- E("Accept extracted", -1)
530
+ default: I(() => [...o[8] || (o[8] = [
531
+ T(" Sources disagree on this value — review the candidates and pick a winner. ", -1)
392
532
  ])]),
393
533
  _: 1
394
- }, 8, ["disabled"])) : h("", !0),
395
- g.value ? (l(), F(x(Y), {
396
- key: 1,
397
- variant: "muted",
398
- size: "sm",
399
- class: "tv-accept-claim",
400
- disabled: _.value,
401
- onClick: fe
402
- }, {
403
- default: j(() => [...u[11] || (u[11] = [
404
- E("Accept claim", -1)
405
- ])]),
406
- _: 1
407
- }, 8, ["disabled"])) : h("", !0)
534
+ })) : _("", !0)
408
535
  ]),
409
- a("div", pt, [
410
- le(a("input", {
411
- "onUpdate:modelValue": u[0] || (u[0] = (m) => M.value = m),
412
- type: "text",
413
- class: "tv-custom-input flex-1 rounded-md border border-gray-300 px-2 py-1.5 text-sm text-gray-800 outline-none transition focus:border-gray-400 focus:ring-2 focus:ring-gray-200",
414
- placeholder: "Type a custom value"
415
- }, null, 512), [
416
- [xe, M.value]
417
- ]),
418
- D(x(Y), {
419
- variant: "success",
420
- size: "sm",
421
- class: "tv-accept-custom",
422
- disabled: _.value,
423
- onClick: ve
536
+ V(r(Le), {
537
+ modelValue: E.value,
538
+ "onUpdate:modelValue": o[0] || (o[0] = (v) => E.value = v),
539
+ tabs: X.value,
540
+ class: "tv-modal-tabs"
541
+ }, null, 8, ["modelValue", "tabs"]),
542
+ E.value === "evidence" ? (l(), i("section", $t, [
543
+ S.value ? (l(), i("div", St, [
544
+ o[9] || (o[9] = n("div", { class: "mb-1 text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, " Reasoning ", -1)),
545
+ V(r(je), {
546
+ "model-value": S.value,
547
+ readonly: "",
548
+ class: "tv-reasoning"
549
+ }, null, 8, ["model-value"])
550
+ ])) : _("", !0),
551
+ R.value ? (l(), i("blockquote", Ct, [
552
+ T(" “" + y(R.value) + "” ", 1),
553
+ V(r(J), {
554
+ variant: (C = b.value) != null && C.cited_text_verified ? "success" : "muted",
555
+ size: "xxs",
556
+ class: "tv-cited-verified ml-2 not-italic"
557
+ }, {
558
+ default: I(() => {
559
+ var v;
560
+ return [
561
+ T(y((v = b.value) != null && v.cited_text_verified ? "✔ verified in source" : "unverified"), 1)
562
+ ];
563
+ }),
564
+ _: 1
565
+ }, 8, ["variant"])
566
+ ])) : _("", !0),
567
+ q.value.length ? (l(), i("div", Vt, [
568
+ V(r(be), {
569
+ file: q.value[0],
570
+ "file-in-preview": p.value,
571
+ "onUpdate:fileInPreview": o[1] || (o[1] = (v) => p.value = v),
572
+ "related-files": q.value,
573
+ "layout-toggles": ["sidebar", "continuous"],
574
+ "default-sidebar": "",
575
+ zoomable: "",
576
+ "storage-key": "tv-evidence-viewer",
577
+ class: "h-full min-h-0 flex-1"
578
+ }, null, 8, ["file", "file-in-preview", "related-files"]),
579
+ w.value ? (l(), i("div", Dt, y(w.value), 1)) : _("", !0)
580
+ ])) : (l(), i("div", Ot, " No source pages recorded for this data point ")),
581
+ D.value.length ? (l(), i("div", It, [
582
+ o[10] || (o[10] = n("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Full documents:", -1)),
583
+ (l(!0), i(L, null, M(D.value, (v) => (l(), N(r(se), {
584
+ key: String(v.id),
585
+ size: "sm",
586
+ variant: "info",
587
+ class: "tv-open-document",
588
+ onClick: (xa) => z.value = v
589
+ }, {
590
+ default: I(() => [
591
+ T(y(v.name), 1)
592
+ ]),
593
+ _: 2
594
+ }, 1032, ["onClick"]))), 128))
595
+ ])) : _("", !0)
596
+ ])) : _("", !0),
597
+ E.value === "candidates" ? (l(), i("section", Tt, [
598
+ (l(!0), i(L, null, M(Q.value, (v) => (l(), i("div", {
599
+ key: v.key,
600
+ class: A(["tv-candidate-row rounded-lg border p-4 transition-shadow", [
601
+ v.winner ? "border-gray-300 bg-gray-50 shadow-sm" : "border-gray-200",
602
+ e.meta.discrepancy && !v.winner ? "tv-candidate-disagrees border-amber-200" : ""
603
+ ]])
604
+ }, [
605
+ n("div", Ut, [
606
+ n("div", Nt, [
607
+ n("div", At, [
608
+ V(r(J), {
609
+ variant: v.variant,
610
+ size: "xs"
611
+ }, {
612
+ default: I(() => [
613
+ T(y(v.title), 1)
614
+ ]),
615
+ _: 2
616
+ }, 1032, ["variant"]),
617
+ v.winner ? (l(), N(r(J), {
618
+ key: 0,
619
+ variant: "success",
620
+ size: "xxs",
621
+ class: "tv-winner-chip"
622
+ }, {
623
+ default: I(() => [...o[11] || (o[11] = [
624
+ T("current value", -1)
625
+ ])]),
626
+ _: 1
627
+ })) : _("", !0)
628
+ ]),
629
+ n("div", Rt, y(me(v.value)), 1),
630
+ n("div", Lt, y(v.detail), 1)
631
+ ]),
632
+ v.accept && !v.winner ? (l(), N(r(se), {
633
+ key: 0,
634
+ size: "sm",
635
+ variant: v.variant,
636
+ loading: Y.value,
637
+ class: A(`tv-accept-${v.key}`),
638
+ onClick: v.accept
639
+ }, {
640
+ default: I(() => [...o[12] || (o[12] = [
641
+ T("Accept this value", -1)
642
+ ])]),
643
+ _: 1
644
+ }, 8, ["variant", "loading", "class", "onClick"])) : _("", !0)
645
+ ])
646
+ ], 2))), 128)),
647
+ e.save ? (l(), i("div", jt, [
648
+ V(r(Ee), {
649
+ modelValue: B.value,
650
+ "onUpdate:modelValue": o[2] || (o[2] = (v) => B.value = v),
651
+ size: "sm",
652
+ class: "tv-custom-input flex-1",
653
+ placeholder: "Type the correct value…",
654
+ disabled: Y.value
655
+ }, null, 8, ["modelValue", "disabled"]),
656
+ V(r(se), {
657
+ variant: "success",
658
+ size: "sm",
659
+ class: "tv-accept-custom",
660
+ loading: Y.value,
661
+ disabled: !B.value,
662
+ onClick: Ie
663
+ }, {
664
+ default: I(() => [...o[13] || (o[13] = [
665
+ T("Save custom value", -1)
666
+ ])]),
667
+ _: 1
668
+ }, 8, ["loading", "disabled"])
669
+ ])) : (l(), i("div", Et, " Read-only render — corrections are disabled here "))
670
+ ])) : _("", !0),
671
+ E.value === "audit" ? (l(), i("section", zt, [
672
+ Z.value ? (l(), i(L, { key: 0 }, M(2, (v) => V(r(ze), {
673
+ key: v,
674
+ shape: "rounded",
675
+ class: "tv-audit-skeleton h-24 w-full"
676
+ })), 64)) : ee.value ? (l(), N(r(ye), {
677
+ key: 1,
678
+ variant: "danger",
679
+ class: "tv-audit-error"
424
680
  }, {
425
- default: j(() => [...u[12] || (u[12] = [
426
- E("Type custom", -1)
427
- ])]),
681
+ default: I(() => [
682
+ T(" Could not load the audit trail: " + y(ee.value), 1)
683
+ ]),
428
684
  _: 1
429
- }, 8, ["disabled"])
430
- ])
431
- ])) : h("", !0)
432
- ])
433
- ]),
685
+ })) : F.value && F.value.length === 0 ? (l(), i("div", Pt, " No LLM calls recorded for this data point ")) : F.value ? (l(!0), i(L, { key: 3 }, M(F.value, (v) => (l(), N(ft, {
686
+ key: String(v.id),
687
+ call: v
688
+ }, null, 8, ["call"]))), 128)) : _("", !0)
689
+ ])) : _("", !0)
690
+ ])
691
+ ];
692
+ }),
434
693
  _: 1
435
694
  }, 8, ["modelValue", "title", "class"]),
436
- C.value ? (l(), F(x(G), {
695
+ z.value ? (l(), N(r(re), {
437
696
  key: 0,
438
- modelValue: k.value,
439
- "onUpdate:modelValue": u[2] || (u[2] = (m) => k.value = m),
697
+ modelValue: G.value,
698
+ "onUpdate:modelValue": o[4] || (o[4] = (C) => G.value = C),
699
+ title: z.value.name,
440
700
  width: 90,
441
701
  height: 90,
442
702
  "close-x": "",
443
- class: I(x(A))
703
+ class: A(r(P))
444
704
  }, {
445
- default: j(() => [
446
- C.value.file ? (l(), F(x(we), {
447
- key: 0,
448
- file: C.value.file,
449
- "related-files": L.value,
450
- "children-label": "Pages",
451
- continuous: "",
452
- sidebar: "",
705
+ default: I(() => [
706
+ V(r(be), {
707
+ file: z.value,
708
+ downloadable: "",
453
709
  zoomable: "",
454
- class: "h-full"
455
- }, null, 8, ["file", "related-files"])) : h("", !0)
710
+ class: "tv-document-viewer h-full"
711
+ }, null, 8, ["file"])
456
712
  ]),
457
713
  _: 1
458
- }, 8, ["modelValue", "class"])) : h("", !0)
714
+ }, 8, ["modelValue", "title", "class"])) : _("", !0)
459
715
  ], 64));
460
716
  }
461
- }), xt = { class: "tv-field inline-flex items-center gap-1" }, gt = ["contenteditable", "data-editable"], yt = {
462
- key: 0,
463
- class: "tv-discrepancy-indicator ml-0.5 text-amber-600",
464
- title: "Sources disagree",
717
+ }), Bt = { class: "tv-field inline-flex items-baseline gap-1" }, Ft = ["contenteditable", "data-editable"], qt = {
718
+ key: 1,
719
+ 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",
720
+ "data-status": "verified"
721
+ }, Yt = {
722
+ key: 2,
723
+ class: "tv-discrepancy-indicator ml-0.5 text-amber-500",
465
724
  "aria-label": "discrepancy"
466
- }, Kt = /* @__PURE__ */ P({
725
+ }, _a = /* @__PURE__ */ K({
467
726
  __name: "VerifiedField",
468
727
  props: {
469
728
  source: {},
@@ -472,278 +731,394 @@ const Pe = { class: "tv-modal flex flex-col gap-5 p-4 text-sm text-gray-700" },
472
731
  format: { type: Function }
473
732
  },
474
733
  setup(e) {
475
- const t = e, n = Q(), f = d(() => n.enabled.value), r = U(null), o = d(() => {
476
- var _;
477
- return r.value ? r.value : t.source && t.field ? ((_ = t.source.__meta) == null ? void 0 : _[t.field]) ?? null : null;
478
- }), c = d(() => X(o.value)), g = d(() => {
479
- if (t.original !== void 0 && t.original !== null) return t.original;
480
- if (o.value) return c.value.value;
734
+ const t = e, a = le(), g = u(() => a.enabled.value), d = U(null), c = u(() => {
735
+ var p;
736
+ return d.value ? d.value : t.source && t.field ? ((p = t.source.__meta) == null ? void 0 : p[t.field]) ?? null : null;
737
+ }), m = u(() => fe(c.value)), s = u(() => {
738
+ if (t.original !== void 0 && t.original !== null)
739
+ return t.original;
740
+ if (c.value && m.value.value !== null && m.value.value !== void 0)
741
+ return m.value.value;
481
742
  if (t.source && t.field) return t.source[t.field];
482
- }), b = d(() => {
483
- const _ = g.value;
484
- return _ == null ? "" : t.format ? t.format(_) : String(_);
485
- }), w = d(() => {
486
- var _, S, V;
487
- return W((V = (S = (_ = o.value) == null ? void 0 : _.candidates) == null ? void 0 : S.extracted) == null ? void 0 : V.confidence);
488
- }), y = d(() => oe(o.value)), v = d(() => f.value && !!o.value);
489
- function $(_) {
490
- var S;
491
- r.value = _, (S = t.source) != null && S.__meta && t.field && (t.source.__meta[t.field] = _);
743
+ }), b = u(() => {
744
+ const p = s.value;
745
+ return p == null ? "" : t.format ? t.format(p) : String(p);
746
+ }), $ = u(
747
+ () => {
748
+ var p, w, D;
749
+ return ve((D = (w = (p = c.value) == null ? void 0 : p.candidates) == null ? void 0 : w.extracted) == null ? void 0 : D.confidence);
750
+ }
751
+ ), h = u(() => Ve(c.value)), x = u(() => {
752
+ var p, w;
753
+ return !!((w = (p = c.value) == null ? void 0 : p.candidates) != null && w.override);
754
+ }), k = u(() => {
755
+ var w;
756
+ const p = (w = c.value) == null ? void 0 : w.candidates;
757
+ return !!(p != null && p.override || p != null && p.extracted || p != null && p.claim);
758
+ }), S = u(() => g.value && !!c.value), R = u(() => {
759
+ var G, Q, B;
760
+ const p = (Q = (G = c.value) == null ? void 0 : G.candidates) == null ? void 0 : Q.extracted;
761
+ if (!p) return "No verification data";
762
+ const w = [], D = ae[$.value];
763
+ w.push(
764
+ p.confidence != null ? `${D} (${p.confidence}/5)` : D
765
+ );
766
+ const z = ((B = p.sources) == null ? void 0 : B.length) ?? 0;
767
+ return z > 0 && w.push(`${z} source ${z === 1 ? "page" : "pages"}`), h.value && w.push("sources disagree"), w.join(" · ");
768
+ });
769
+ function O(p) {
770
+ var w;
771
+ d.value = p, (w = t.source) != null && w.__meta && t.field && (t.source.__meta[t.field] = p);
492
772
  }
493
- const L = d(() => Te(n, o, $)), C = d(() => !!L.value), k = U(!1), N = U(!1);
494
- function B() {
495
- o.value && (k.value = !0);
773
+ const j = u(() => Ze(a, c, O)), H = u(() => !!j.value), E = U(!1), W = U(!1);
774
+ function X() {
775
+ c.value && (E.value = !0);
496
776
  }
497
- async function M(_) {
498
- N.value = !1;
499
- const V = (_.target.textContent ?? "").trim();
500
- !L.value || V === b.value || await L.value(V, "custom");
777
+ async function q(p) {
778
+ W.value = !1;
779
+ const D = (p.target.textContent ?? "").trim();
780
+ !j.value || D === b.value || await j.value(D, "custom");
501
781
  }
502
- return (_, S) => (l(), i("span", xt, [
503
- a("span", {
504
- class: "tv-field-value",
505
- contenteditable: C.value,
506
- "data-editable": C.value ? "true" : "false",
507
- onFocus: S[0] || (S[0] = (V) => N.value = !0),
508
- onBlur: M,
509
- onKeydown: S[1] || (S[1] = ge(ye((V) => V.target.blur(), ["prevent"]), ["enter"]))
782
+ return (p, w) => (l(), i("span", Bt, [
783
+ n("span", {
784
+ class: A([
785
+ "tv-field-value",
786
+ S.value && !k.value ? "tv-field-unverified cursor-pointer border-b border-dotted border-gray-300" : ""
787
+ ]),
788
+ contenteditable: H.value,
789
+ "data-editable": H.value ? "true" : "false",
790
+ onFocus: w[0] || (w[0] = (D) => W.value = !0),
791
+ onBlur: q,
792
+ onKeydown: w[1] || (w[1] = Te(Ue((D) => D.target.blur(), ["prevent"]), ["enter"])),
793
+ onClick: w[2] || (w[2] = (D) => S.value && !k.value ? X() : void 0)
510
794
  }, [
511
- _e(_.$slots, "default", {
512
- value: g.value,
795
+ Ne(p.$slots, "default", {
796
+ value: s.value,
513
797
  formatted: b.value
514
798
  }, () => [
515
- E(p(b.value), 1)
799
+ T(y(b.value), 1)
516
800
  ])
517
- ], 40, gt),
518
- v.value ? (l(), i("button", {
801
+ ], 42, Ft),
802
+ S.value && k.value ? (l(), N(r(Pe), {
519
803
  key: 0,
520
- type: "button",
521
- class: I(["tv-overlay ml-1 inline-flex items-center", x(A)]),
522
- title: "View verification detail",
523
- onClick: B
524
- }, [
525
- D(z, { status: w.value }, null, 8, ["status"]),
526
- y.value ? (l(), i("span", yt, "⚠")) : h("", !0)
527
- ], 2)) : h("", !0),
528
- o.value ? (l(), F(mt, {
804
+ tooltip: R.value,
805
+ placement: "top"
806
+ }, {
807
+ trigger: I(() => [
808
+ n("button", {
809
+ type: "button",
810
+ class: A(["tv-overlay inline-flex cursor-pointer items-center align-middle transition-transform duration-150 hover:scale-110", r(P)]),
811
+ onClick: X
812
+ }, [
813
+ x.value ? (l(), i("span", qt, "✔")) : (l(), N(ue, {
814
+ key: 0,
815
+ status: $.value
816
+ }, null, 8, ["status"])),
817
+ h.value && !x.value ? (l(), i("span", Yt, "⚠")) : _("", !0)
818
+ ], 2)
819
+ ]),
820
+ _: 1
821
+ }, 8, ["tooltip"])) : _("", !0),
822
+ c.value ? (l(), N(Mt, {
529
823
  key: 1,
530
- modelValue: k.value,
531
- "onUpdate:modelValue": S[2] || (S[2] = (V) => k.value = V),
532
- meta: o.value,
824
+ modelValue: E.value,
825
+ "onUpdate:modelValue": w[3] || (w[3] = (D) => E.value = D),
826
+ meta: c.value,
533
827
  label: e.field,
534
- save: L.value
535
- }, null, 8, ["modelValue", "meta", "label", "save"])) : h("", !0)
828
+ save: j.value
829
+ }, null, 8, ["modelValue", "meta", "label", "save"])) : _("", !0)
536
830
  ]));
537
831
  }
538
- }), _t = /* @__PURE__ */ new Set(["name", "type"]);
539
- function bt(e, t = "") {
540
- const n = [];
541
- return J(e, t, n), n;
832
+ }), Jt = /* @__PURE__ */ new Set(["name", "type"]);
833
+ function Oe(e, t = "") {
834
+ const a = [];
835
+ return de(e, t, a), a;
542
836
  }
543
- function J(e, t, n) {
837
+ function de(e, t, a) {
544
838
  if (Array.isArray(e)) {
545
- e.forEach((o, c) => J(o, `${t}[${c}]`, n));
839
+ e.forEach((c, m) => de(c, `${t}[${m}]`, a));
546
840
  return;
547
841
  }
548
- if (!ne(e)) return;
549
- const r = e.__meta ?? {};
550
- for (const [o, c] of Object.entries(e)) {
551
- if (o === "__meta") continue;
552
- const g = t ? `${t}.${o}` : o;
553
- if (Array.isArray(c) || ne(c)) {
554
- J(c, g, n);
842
+ if (!he(e)) return;
843
+ const d = e.__meta ?? {};
844
+ for (const [c, m] of Object.entries(e)) {
845
+ if (c === "__meta") continue;
846
+ const s = t ? `${t}.${c}` : c;
847
+ if (Array.isArray(m) || he(m)) {
848
+ de(m, s, a);
555
849
  continue;
556
850
  }
557
- const b = r[o];
558
- !b && _t.has(o) || n.push({
559
- path: g,
560
- label: o,
851
+ const b = d[c];
852
+ !b && Jt.has(c) || a.push({
853
+ path: s,
854
+ label: c,
561
855
  meta: b ?? null,
562
- value: c,
856
+ value: m,
563
857
  unanchored: !b
564
858
  });
565
859
  }
566
860
  }
567
- function ne(e) {
861
+ function he(e) {
568
862
  return typeof e == "object" && e !== null && !Array.isArray(e);
569
863
  }
570
- const ht = { class: "tv-comparison-page flex flex-col gap-4" }, wt = {
864
+ function Kt(e) {
865
+ var c;
866
+ const t = Oe(e).filter(
867
+ (m) => m.meta !== null
868
+ ), a = t.length;
869
+ let g = 0, d = 0;
870
+ for (const m of t) {
871
+ if (m.meta.candidates.override) {
872
+ g++;
873
+ continue;
874
+ }
875
+ const s = (c = m.meta.candidates.extracted) == null ? void 0 : c.confidence;
876
+ (m.meta.discrepancy || s == null || s <= 2) && d++;
877
+ }
878
+ return {
879
+ total: a,
880
+ verified: g,
881
+ needsReview: d,
882
+ percent: a === 0 ? 100 : Math.round(g / a * 100)
883
+ };
884
+ }
885
+ const Ht = { class: "tv-comparison-page flex flex-col gap-4" }, Gt = {
571
886
  key: 0,
572
887
  class: "tv-comparison-empty text-gray-400"
573
- }, kt = {
888
+ }, Qt = {
574
889
  key: 1,
575
890
  class: "tv-anchored-group flex flex-col gap-3"
576
- }, St = { class: "flex items-center gap-2" }, $t = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, Vt = { class: "tv-datapoint-resolved font-medium" }, Ct = {
891
+ }, Wt = { class: "flex items-center gap-2" }, Xt = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, Zt = { class: "tv-datapoint-resolved font-medium" }, ea = {
577
892
  key: 0,
578
893
  class: "tv-datapoint-discrepancy text-xs font-medium text-amber-600"
579
- }, Ot = { class: "tv-datapoint-candidates ml-4 text-xs text-gray-600" }, Lt = { class: "font-medium" }, It = {
894
+ }, ta = { class: "tv-datapoint-candidates ml-4 text-xs text-gray-600" }, aa = { class: "font-medium" }, la = {
580
895
  key: 0,
581
896
  class: "tv-datapoint-reasoning ml-4 text-xs italic text-gray-500"
582
- }, Ut = {
897
+ }, na = {
583
898
  key: 1,
584
899
  class: "tv-datapoint-cited ml-4 text-xs text-gray-500"
585
- }, Dt = { class: "tv-datapoint-sources ml-4 text-xs text-gray-500" }, Et = ["href"], Tt = { key: 1 }, At = { class: "ml-1" }, Nt = {
900
+ }, sa = { class: "tv-datapoint-sources ml-4 text-xs text-gray-500" }, ra = ["href"], ia = { key: 1 }, oa = { class: "ml-1" }, ua = {
586
901
  key: 2,
587
902
  class: "tv-unanchored-group flex flex-col gap-1"
588
- }, jt = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, Ft = { class: "tv-datapoint-value" }, Mt = /* @__PURE__ */ P({
903
+ }, da = { class: "tv-datapoint-path font-mono text-xs text-gray-500" }, ca = { class: "tv-datapoint-value" }, va = /* @__PURE__ */ K({
589
904
  __name: "ComparisonPage",
590
905
  setup(e) {
591
- const t = Q(), n = d(() => bt(t.data)), f = d(() => n.value.filter((w) => !w.unanchored)), r = d(() => n.value.filter((w) => w.unanchored));
592
- function o(w) {
593
- const y = X(w).value;
594
- return y == null ? "" : String(y);
906
+ const t = le(), a = u(() => Oe(t.data)), g = u(() => a.value.filter(($) => !$.unanchored)), d = u(() => a.value.filter(($) => $.unanchored));
907
+ function c($) {
908
+ const h = fe($).value;
909
+ return h == null ? "" : String(h);
595
910
  }
596
- function c(w) {
597
- return w == null ? "" : String(w);
911
+ function m($) {
912
+ return $ == null ? "" : String($);
598
913
  }
599
- function g(w) {
600
- var y, v, $;
601
- return ($ = (v = (y = w.meta) == null ? void 0 : y.candidates) == null ? void 0 : v.extracted) == null ? void 0 : $.confidence;
914
+ function s($) {
915
+ var h, x, k;
916
+ return (k = (x = (h = $.meta) == null ? void 0 : h.candidates) == null ? void 0 : x.extracted) == null ? void 0 : k.confidence;
602
917
  }
603
- function b(w) {
604
- var $;
605
- const y = ($ = w.meta) == null ? void 0 : $.candidates;
606
- if (!y) return [];
607
- const v = [];
608
- return y.override && v.push({ source: "override", value: y.override.value }), y.extracted && v.push({ source: "extracted", value: y.extracted.value }), y.claim && v.push({ source: "claim", value: y.claim.value }), v;
918
+ function b($) {
919
+ var k;
920
+ const h = (k = $.meta) == null ? void 0 : k.candidates;
921
+ if (!h) return [];
922
+ const x = [];
923
+ return h.override && x.push({ source: "override", value: h.override.value }), h.extracted && x.push({ source: "extracted", value: h.extracted.value }), h.claim && x.push({ source: "claim", value: h.claim.value }), x;
609
924
  }
610
- return (w, y) => (l(), i("div", ht, [
611
- y[1] || (y[1] = a("h2", { class: "tv-comparison-title text-lg font-semibold" }, "Verification comparison", -1)),
612
- n.value.length === 0 ? (l(), i("p", wt, " No data points to compare. ")) : h("", !0),
613
- f.value.length ? (l(), i("section", kt, [
614
- (l(!0), i(O, null, T(f.value, (v) => {
615
- var $, L, C;
925
+ return ($, h) => (l(), i("div", Ht, [
926
+ h[1] || (h[1] = n("h2", { class: "tv-comparison-title text-lg font-semibold" }, "Verification comparison", -1)),
927
+ a.value.length === 0 ? (l(), i("p", Gt, " No data points to compare. ")) : _("", !0),
928
+ g.value.length ? (l(), i("section", Qt, [
929
+ (l(!0), i(L, null, M(g.value, (x) => {
930
+ var k, S, R;
616
931
  return l(), i("div", {
617
- key: v.path,
932
+ key: x.path,
618
933
  class: "tv-datapoint border-t border-gray-100 pt-2"
619
934
  }, [
620
- a("div", St, [
621
- a("span", $t, p(v.path), 1),
622
- a("span", Vt, p(o(v.meta)), 1),
623
- D(z, {
624
- confidence: g(v),
935
+ n("div", Wt, [
936
+ n("span", Xt, y(x.path), 1),
937
+ n("span", Zt, y(c(x.meta)), 1),
938
+ V(ue, {
939
+ confidence: s(x),
625
940
  "show-label": ""
626
941
  }, null, 8, ["confidence"]),
627
- x(oe)(v.meta) ? (l(), i("span", Ct, "⚠ discrepancy")) : h("", !0)
942
+ r(Ve)(x.meta) ? (l(), i("span", ea, "⚠ discrepancy")) : _("", !0)
628
943
  ]),
629
- a("ul", Ot, [
630
- (l(!0), i(O, null, T(b(v), (k) => (l(), i("li", {
631
- key: k.source,
944
+ n("ul", ta, [
945
+ (l(!0), i(L, null, M(b(x), (O) => (l(), i("li", {
946
+ key: O.source,
632
947
  class: "tv-candidate"
633
948
  }, [
634
- a("span", Lt, p(k.source) + ":", 1),
635
- E(" " + p(c(k.value)), 1)
949
+ n("span", aa, y(O.source) + ":", 1),
950
+ T(" " + y(m(O.value)), 1)
636
951
  ]))), 128))
637
952
  ]),
638
- x(H)(v.meta) ? (l(), i("p", It, p(x(H)(v.meta)), 1)) : h("", !0),
639
- x(q)(v.meta) ? (l(), i("p", Ut, " “" + p(x(q)(v.meta)) + "” ", 1)) : h("", !0),
640
- a("ul", Dt, [
641
- (l(!0), i(O, null, T(x(ue)((C = (L = ($ = v.meta) == null ? void 0 : $.candidates) == null ? void 0 : L.extracted) == null ? void 0 : C.sources), (k, N) => (l(), i("li", {
642
- key: N,
953
+ r(ie)(x.meta) ? (l(), i("p", la, y(r(ie)(x.meta)), 1)) : _("", !0),
954
+ r(oe)(x.meta) ? (l(), i("p", na, " “" + y(r(oe)(x.meta)) + "” ", 1)) : _("", !0),
955
+ n("ul", sa, [
956
+ (l(!0), i(L, null, M(r(De)((R = (S = (k = x.meta) == null ? void 0 : k.candidates) == null ? void 0 : S.extracted) == null ? void 0 : R.sources), (O, j) => (l(), i("li", {
957
+ key: j,
643
958
  class: "tv-source-group"
644
959
  }, [
645
- k.fileUrl ? (l(), i("a", {
960
+ O.fileUrl ? (l(), i("a", {
646
961
  key: 0,
647
- href: k.fileUrl,
962
+ href: O.fileUrl,
648
963
  class: "tv-source-link text-blue-600 underline",
649
964
  target: "_blank",
650
965
  rel: "noopener"
651
- }, p(k.fileLabel), 9, Et)) : (l(), i("span", Tt, p(k.fileLabel), 1)),
652
- a("span", At, "(" + p(k.sources.map(x(ce)).join(", ")) + ")", 1)
966
+ }, y(O.fileLabel), 9, ra)) : (l(), i("span", ia, y(O.fileLabel), 1)),
967
+ n("span", oa, "(" + y(O.sources.map(r(rt)).join(", ")) + ")", 1)
653
968
  ]))), 128))
654
969
  ])
655
970
  ]);
656
971
  }), 128))
657
- ])) : h("", !0),
658
- r.value.length ? (l(), i("section", Nt, [
659
- y[0] || (y[0] = a("h3", { class: "tv-unanchored-title text-sm font-semibold text-gray-500" }, " Unanchored / not from source ", -1)),
660
- (l(!0), i(O, null, T(r.value, (v) => (l(), i("div", {
661
- key: v.path,
972
+ ])) : _("", !0),
973
+ d.value.length ? (l(), i("section", ua, [
974
+ h[0] || (h[0] = n("h3", { class: "tv-unanchored-title text-sm font-semibold text-gray-500" }, " Unanchored / not from source ", -1)),
975
+ (l(!0), i(L, null, M(d.value, (x) => (l(), i("div", {
976
+ key: x.path,
662
977
  class: "tv-unanchored-datapoint flex items-center gap-2 text-sm"
663
978
  }, [
664
- a("span", jt, p(v.path), 1),
665
- a("span", Ft, p(c(v.value)), 1),
666
- D(z, { status: "unverifiable" })
979
+ n("span", da, y(x.path), 1),
980
+ n("span", ca, y(m(x.value)), 1),
981
+ V(ue, { status: "unverifiable" })
667
982
  ]))), 128))
668
- ])) : h("", !0)
983
+ ])) : _("", !0)
669
984
  ]));
670
985
  }
671
- }), Pt = { class: "tv-enable-toggle flex items-center justify-between text-sm" }, Yt = /* @__PURE__ */ P({
986
+ }), fa = { class: "tv-enable-toggle flex items-center justify-between text-sm font-medium text-gray-700" }, pa = { class: "tv-progress-block" }, ma = { class: "mb-1 flex items-baseline justify-between" }, ga = { class: "tv-progress-count text-xs font-semibold text-gray-600" }, wa = /* @__PURE__ */ K({
672
987
  __name: "VerificationChrome",
673
988
  setup(e) {
674
- const { enabled: t, openComparison: n } = Q(), f = Oe(), r = U(!1);
675
- function o() {
676
- n(), r.value = !1;
989
+ const t = le(), { enabled: a, openComparison: g } = t, d = He(), c = _e(), m = U(!1), s = u(() => Kt(t.data)), b = U(!1);
990
+ ce(
991
+ () => s.value.percent,
992
+ (k) => {
993
+ k === 100 && s.value.total > 0 && !b.value && (b.value = !0, c.success("All data points verified 🎯"));
994
+ }
995
+ );
996
+ let $ = 0;
997
+ function h() {
998
+ const k = document.querySelectorAll(
999
+ ".tv-discrepancy-indicator, .tv-confidence-icon[data-status='low'], .tv-confidence-icon[data-status='unverifiable']"
1000
+ );
1001
+ if (!k.length) return;
1002
+ $ = $ % k.length;
1003
+ const S = k[$];
1004
+ $++, S.scrollIntoView({ behavior: "smooth", block: "center" }), S.animate(
1005
+ [
1006
+ { boxShadow: "0 0 0 0 rgba(245, 158, 11, 0.8)" },
1007
+ { boxShadow: "0 0 0 12px rgba(245, 158, 11, 0)" }
1008
+ ],
1009
+ { duration: 900, iterations: 2 }
1010
+ );
1011
+ }
1012
+ function x() {
1013
+ g(), m.value = !1;
677
1014
  }
678
- return (c, g) => (l(), i(O, null, [
679
- a("button", {
1015
+ return (k, S) => (l(), i(L, null, [
1016
+ n("button", {
680
1017
  type: "button",
681
- class: I(["tv-settings-button fixed bottom-4 right-4 z-50 flex h-10 w-10 items-center justify-center rounded-full bg-gray-800 text-white shadow-lg", x(A)]),
682
- title: "Verification settings",
683
- onClick: g[0] || (g[0] = (b) => r.value = !r.value)
1018
+ class: A(["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", r(P)]),
1019
+ title: "Verification",
1020
+ onClick: S[0] || (S[0] = (R) => m.value = !m.value)
684
1021
  }, [
685
- D(x(ke), {
686
- icon: x(Se),
1022
+ V(r(Me), {
1023
+ icon: r(Be),
687
1024
  class: "h-5 w-5"
688
- }, null, 8, ["icon"])
1025
+ }, null, 8, ["icon"]),
1026
+ r(a) && s.value.needsReview > 0 ? (l(), N(r(Fe), {
1027
+ key: 0,
1028
+ value: s.value.needsReview,
1029
+ variant: "warning",
1030
+ class: "tv-needs-review-badge absolute -right-1 -top-1"
1031
+ }, null, 8, ["value"])) : _("", !0)
689
1032
  ], 2),
690
- r.value ? (l(), i("div", {
1033
+ m.value ? (l(), i("div", {
691
1034
  key: 0,
692
- class: I(["tv-settings-panel fixed bottom-16 right-4 z-50 flex w-56 flex-col gap-3 rounded-lg bg-white p-4 shadow-xl ring-1 ring-gray-200", x(A)])
1035
+ class: A(["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", r(P)])
693
1036
  }, [
694
- a("label", Pt, [
695
- g[3] || (g[3] = a("span", null, "Verification overlay", -1)),
696
- le(a("input", {
697
- "onUpdate:modelValue": g[1] || (g[1] = (b) => te(t) ? t.value = b : null),
1037
+ n("label", fa, [
1038
+ S[3] || (S[3] = n("span", null, "Verification overlay", -1)),
1039
+ Ae(n("input", {
1040
+ "onUpdate:modelValue": S[1] || (S[1] = (R) => ge(a) ? a.value = R : null),
698
1041
  type: "checkbox",
699
- class: "tv-enable-checkbox"
1042
+ class: "tv-enable-checkbox h-4 w-4 accent-gray-900"
700
1043
  }, null, 512), [
701
- [be, x(t)]
1044
+ [Re, r(a)]
702
1045
  ])
703
1046
  ]),
704
- a("button", {
1047
+ r(a) && s.value.total > 0 ? (l(), i(L, { key: 0 }, [
1048
+ n("div", pa, [
1049
+ n("div", ma, [
1050
+ S[4] || (S[4] = n("span", { class: "text-[11px] font-semibold uppercase tracking-wider text-gray-400" }, "Review progress", -1)),
1051
+ n("span", ga, y(s.value.verified) + " / " + y(s.value.total), 1)
1052
+ ]),
1053
+ V(r(we), {
1054
+ value: s.value.verified,
1055
+ max: s.value.total,
1056
+ size: "md",
1057
+ variant: s.value.percent === 100 ? "success" : "info",
1058
+ striped: s.value.percent < 100,
1059
+ "animate-stripes": s.value.percent < 100,
1060
+ glow: s.value.percent === 100,
1061
+ gradient: ""
1062
+ }, null, 8, ["value", "max", "variant", "striped", "animate-stripes", "glow"])
1063
+ ]),
1064
+ s.value.needsReview > 0 ? (l(), i("button", {
1065
+ key: 0,
1066
+ type: "button",
1067
+ class: A(["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", r(P)]),
1068
+ onClick: h
1069
+ }, [
1070
+ n("span", null, y(s.value.needsReview) + " need" + y(s.value.needsReview === 1 ? "s" : "") + " review", 1),
1071
+ S[5] || (S[5] = n("span", { "aria-hidden": "true" }, "→", -1))
1072
+ ], 2)) : _("", !0)
1073
+ ], 64)) : _("", !0),
1074
+ n("button", {
705
1075
  type: "button",
706
- class: I(["tv-open-comparison rounded border px-2 py-1 text-sm", x(A)]),
707
- onClick: o
708
- }, "Open comparison page", 2)
709
- ], 2)) : h("", !0),
710
- D(x(G), {
711
- modelValue: x(f),
712
- "onUpdate:modelValue": g[2] || (g[2] = (b) => te(f) ? f.value = b : null),
1076
+ class: A(["tv-open-comparison rounded-lg border border-gray-200 px-3 py-2 text-sm font-medium text-gray-600 transition hover:bg-gray-50", r(P)]),
1077
+ onClick: x
1078
+ }, " Open comparison page ", 2)
1079
+ ], 2)) : _("", !0),
1080
+ V(r(re), {
1081
+ modelValue: r(d),
1082
+ "onUpdate:modelValue": S[2] || (S[2] = (R) => ge(d) ? d.value = R : null),
713
1083
  title: "Verification comparison",
714
1084
  width: 80,
715
1085
  "close-x": "",
716
- class: I(x(A))
1086
+ class: A(r(P))
717
1087
  }, {
718
- default: j(() => [
719
- D(Mt)
1088
+ default: I(() => [
1089
+ V(va)
720
1090
  ]),
721
1091
  _: 1
722
- }, 8, ["modelValue", "class"])
1092
+ }, 8, ["modelValue", "class"]),
1093
+ V(r(qe), {
1094
+ class: A(r(P))
1095
+ }, null, 8, ["class"])
723
1096
  ], 64));
724
1097
  }
725
1098
  });
726
1099
  export {
727
- A as CHROME_CLASS,
728
- Mt as ComparisonPage,
729
- z as ConfidenceIcon,
730
- ae as ENABLED_STORAGE_KEY,
731
- re as RESOLUTION_PRIORITY,
732
- Le as STATUS_COLORS,
733
- Ie as STATUS_LABELS,
734
- Yt as VerificationChrome,
735
- mt as VerificationModal,
736
- Kt as VerifiedField,
737
- W as bucketConfidence,
738
- De as candidatesDisagree,
739
- q as citedTextOf,
740
- ue as groupSources,
741
- oe as hasDiscrepancy,
742
- Bt as initVerification,
743
- H as reasoningOf,
744
- Ue as resolveCandidates,
745
- X as resolveDataPoint,
746
- ce as sourceRowLabel,
747
- Q as useVerification,
748
- bt as walkDataPoints
1100
+ P as CHROME_CLASS,
1101
+ va as ComparisonPage,
1102
+ ue as ConfidenceIcon,
1103
+ ke as ENABLED_STORAGE_KEY,
1104
+ Ce as RESOLUTION_PRIORITY,
1105
+ Ge as STATUS_COLORS,
1106
+ ae as STATUS_LABELS,
1107
+ wa as VerificationChrome,
1108
+ Mt as VerificationModal,
1109
+ _a as VerifiedField,
1110
+ ve as bucketConfidence,
1111
+ We as candidatesDisagree,
1112
+ oe as citedTextOf,
1113
+ Kt as computeProgress,
1114
+ lt as fetchDataPointAudit,
1115
+ De as groupSources,
1116
+ Ve as hasDiscrepancy,
1117
+ ha as initVerification,
1118
+ ie as reasoningOf,
1119
+ Qe as resolveCandidates,
1120
+ fe as resolveDataPoint,
1121
+ rt as sourceRowLabel,
1122
+ le as useVerification,
1123
+ Oe as walkDataPoints
749
1124
  };