@thehammer/template-verification 0.2.15 → 0.2.16

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