@thehammer/template-verification 0.2.20 → 0.2.22

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