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