@thehammer/template-verification 0.2.4 → 0.2.6

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