@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.
- package/dist/components/ConfidenceBar.vue.d.ts +23 -0
- package/dist/components/ConfidenceIcon.vue.d.ts +13 -8
- package/dist/index.d.ts +2 -2
- package/dist/lib/confidence.d.ts +23 -20
- package/dist/style.css +1 -1
- package/dist/template-verification.js +263 -244
- package/dist/types.d.ts +23 -10
- package/package.json +2 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { DanxSkeleton as
|
|
3
|
-
import { CodeViewer as
|
|
4
|
-
const R = "tv-chrome",
|
|
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
|
|
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
|
|
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
|
|
22
|
-
const t =
|
|
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 =
|
|
27
|
-
return
|
|
26
|
+
const t = F(xe((e == null ? void 0 : e.defaultEnabled) ?? !1));
|
|
27
|
+
return Y(
|
|
28
28
|
t,
|
|
29
|
-
(n) =>
|
|
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
|
|
37
|
+
function _e() {
|
|
38
38
|
return N || (N = ee()), N;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function ut(e) {
|
|
41
41
|
N = ee(e);
|
|
42
42
|
}
|
|
43
43
|
function te() {
|
|
44
|
-
const e =
|
|
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
|
|
53
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
78
|
+
function Te(e) {
|
|
74
79
|
if (e)
|
|
75
|
-
for (const t of
|
|
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
|
|
83
|
-
return e ? typeof e.discrepancy == "boolean" ? e.discrepancy :
|
|
87
|
+
function De(e) {
|
|
88
|
+
return e ? typeof e.discrepancy == "boolean" ? e.discrepancy : Le(e.candidates) : !1;
|
|
84
89
|
}
|
|
85
|
-
function
|
|
90
|
+
function Le(e) {
|
|
86
91
|
if (!e) return !1;
|
|
87
|
-
const t =
|
|
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
|
|
95
|
+
function Oe(e) {
|
|
91
96
|
return JSON.stringify(e ?? null);
|
|
92
97
|
}
|
|
93
|
-
function
|
|
98
|
+
function Ve(e) {
|
|
94
99
|
return !!(e != null && e.source_discrepancy);
|
|
95
100
|
}
|
|
96
|
-
function
|
|
101
|
+
function Ne(e) {
|
|
97
102
|
return !!(e != null && e.correction);
|
|
98
103
|
}
|
|
99
|
-
const
|
|
100
|
-
function
|
|
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
|
|
108
|
-
return
|
|
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
|
|
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 =
|
|
122
|
+
const n = Be();
|
|
118
123
|
if (!n) return !1;
|
|
119
|
-
const
|
|
120
|
-
source:
|
|
121
|
-
version:
|
|
122
|
-
type:
|
|
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(
|
|
137
|
+
return t.postMessage(d, n), !0;
|
|
133
138
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
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,
|
|
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,
|
|
151
|
+
for (const [r, v] of Object.entries(e)) {
|
|
147
152
|
if (r === "__meta") continue;
|
|
148
|
-
const
|
|
149
|
-
if (Array.isArray(
|
|
150
|
-
U(
|
|
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
|
|
154
|
-
!
|
|
155
|
-
path:
|
|
158
|
+
const b = m[r];
|
|
159
|
+
!b && ze.has(r) || n.push({
|
|
160
|
+
path: w,
|
|
156
161
|
label: r,
|
|
157
|
-
meta:
|
|
158
|
-
value:
|
|
159
|
-
unanchored: !
|
|
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
|
|
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
|
|
173
|
-
const t =
|
|
177
|
+
function Ue(e) {
|
|
178
|
+
const t = re(e).filter(
|
|
174
179
|
(r) => r.meta !== null
|
|
175
180
|
), n = t.length;
|
|
176
|
-
let
|
|
181
|
+
let d = 0, m = 0;
|
|
177
182
|
for (const r of t) {
|
|
178
183
|
if (r.meta.candidates.override) {
|
|
179
|
-
|
|
184
|
+
d++;
|
|
180
185
|
continue;
|
|
181
186
|
}
|
|
182
|
-
|
|
187
|
+
ae(r.meta) && m++;
|
|
183
188
|
}
|
|
184
189
|
return {
|
|
185
190
|
total: n,
|
|
186
|
-
verified:
|
|
191
|
+
verified: d,
|
|
187
192
|
needsReview: m,
|
|
188
|
-
percent: n === 0 ? 100 : Math.round(
|
|
193
|
+
percent: n === 0 ? 100 : Math.round(d / n * 100)
|
|
189
194
|
};
|
|
190
195
|
}
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
|
|
201
|
-
status: {},
|
|
202
|
-
showLabel: { type: Boolean }
|
|
224
|
+
state: {}
|
|
203
225
|
},
|
|
204
226
|
setup(e) {
|
|
205
|
-
const t = e, n = i(
|
|
206
|
-
() => t.
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
], 10, je));
|
|
243
|
+
T(qe, { level: d.value }, null, 8, ["level"])
|
|
244
|
+
], 8, He));
|
|
226
245
|
}
|
|
227
|
-
}),
|
|
246
|
+
}), Ke = {
|
|
228
247
|
key: 0,
|
|
229
248
|
class: "tv-mark-anchor"
|
|
230
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
261
|
+
}, et = {
|
|
243
262
|
key: 5,
|
|
244
263
|
class: "tv-correction-indicator ml-0.5 text-blue-500",
|
|
245
264
|
"aria-hidden": !0
|
|
246
|
-
},
|
|
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(),
|
|
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
|
-
}),
|
|
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 &&
|
|
262
|
-
return
|
|
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
|
-
}),
|
|
265
|
-
const a =
|
|
283
|
+
}), b = i(() => {
|
|
284
|
+
const a = w.value;
|
|
266
285
|
return a == null ? "" : typeof t.format == "function" ? t.format(a) : String(a);
|
|
267
|
-
}),
|
|
268
|
-
var l,
|
|
269
|
-
const a = (
|
|
270
|
-
return (a == null ? void 0 : a.
|
|
271
|
-
}),
|
|
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
|
-
}),
|
|
275
|
-
var a, l,
|
|
276
|
-
return ((
|
|
277
|
-
}),
|
|
278
|
-
var a, l,
|
|
279
|
-
return x.value ? ((
|
|
280
|
-
}),
|
|
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
|
|
283
|
-
}),
|
|
301
|
+
return C.value && !!a && ae(a);
|
|
302
|
+
}), A = i(() => {
|
|
284
303
|
var a;
|
|
285
|
-
return
|
|
286
|
-
}),
|
|
287
|
-
var
|
|
288
|
-
const a = t.field ?? "This value", l =
|
|
289
|
-
if (
|
|
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
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
|
316
|
+
function G() {
|
|
299
317
|
var l;
|
|
300
318
|
const a = (l = r.value) == null ? void 0 : l.anchor;
|
|
301
|
-
a &&
|
|
319
|
+
a && je({
|
|
302
320
|
anchor: a,
|
|
303
321
|
workflowInputId: n.workflowInputId,
|
|
304
322
|
label: t.field ?? null,
|
|
305
|
-
value:
|
|
323
|
+
value: b.value
|
|
306
324
|
});
|
|
307
325
|
}
|
|
308
|
-
function
|
|
326
|
+
function le() {
|
|
309
327
|
var l;
|
|
310
|
-
if (!
|
|
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 ||
|
|
330
|
+
a && !a.isCollapsed || G();
|
|
313
331
|
}
|
|
314
|
-
const
|
|
315
|
-
return
|
|
316
|
-
|
|
317
|
-
(a, l,
|
|
332
|
+
const H = F(null);
|
|
333
|
+
return Y(
|
|
334
|
+
H,
|
|
335
|
+
(a, l, u) => {
|
|
318
336
|
if (!a || typeof MutationObserver > "u") return;
|
|
319
|
-
const
|
|
320
|
-
a.querySelectorAll(".dx-language-badge-container").forEach((
|
|
337
|
+
const I = () => {
|
|
338
|
+
a.querySelectorAll(".dx-language-badge-container").forEach((V) => V.remove());
|
|
321
339
|
};
|
|
322
|
-
|
|
323
|
-
const _ = new MutationObserver(
|
|
324
|
-
_.observe(a, { childList: !0, subtree: !0 }),
|
|
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) => (
|
|
335
|
-
class:
|
|
352
|
+
), (a, l) => (o(), c("span", {
|
|
353
|
+
class: h(["tv-field", O.value ? "tv-needs-review" : ""])
|
|
336
354
|
}, [
|
|
337
|
-
m.value ? (
|
|
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
|
-
})) : (
|
|
359
|
+
})) : (o(), c(j, { key: 1 }, [
|
|
342
360
|
p("span", {
|
|
343
|
-
class:
|
|
344
|
-
onClick:
|
|
361
|
+
class: h(["tv-field-value", A.value ? f(he) : ""]),
|
|
362
|
+
onClick: le
|
|
345
363
|
}, [
|
|
346
|
-
|
|
347
|
-
value:
|
|
348
|
-
formatted:
|
|
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:
|
|
370
|
+
ref: H,
|
|
353
371
|
class: "tv-markdown-fallback-wrap"
|
|
354
372
|
}, [
|
|
355
|
-
|
|
356
|
-
"model-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
|
-
|
|
385
|
+
C.value ? (o(), c("span", Ke, [
|
|
368
386
|
p("button", {
|
|
369
387
|
type: "button",
|
|
370
|
-
class:
|
|
371
|
-
"aria-label":
|
|
372
|
-
title:
|
|
373
|
-
onClick: l[0] || (l[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
|
-
|
|
393
|
+
S.value === "unverified" && !E.value ? (o(), B(Je, {
|
|
376
394
|
key: 0,
|
|
377
|
-
|
|
378
|
-
}, null, 8, ["
|
|
379
|
-
|
|
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:
|
|
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 ? (
|
|
384
|
-
], 10,
|
|
385
|
-
])) :
|
|
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
|
-
}),
|
|
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
|
-
},
|
|
410
|
+
}, dt = /* @__PURE__ */ M({
|
|
393
411
|
__name: "VerificationChrome",
|
|
394
412
|
setup(e) {
|
|
395
|
-
const t = te(), { enabled: n } = t,
|
|
396
|
-
() =>
|
|
397
|
-
(
|
|
398
|
-
var y, x,
|
|
399
|
-
return
|
|
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
|
-
),
|
|
404
|
-
|
|
421
|
+
), w = F(!1);
|
|
422
|
+
Y(
|
|
405
423
|
() => r.value.percent,
|
|
406
|
-
(
|
|
407
|
-
|
|
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
|
|
411
|
-
function
|
|
412
|
-
const
|
|
413
|
-
if (!
|
|
414
|
-
|
|
415
|
-
const s = b
|
|
416
|
-
|
|
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 (
|
|
442
|
+
return (g, s) => (o(), c(j, null, [
|
|
425
443
|
p("button", {
|
|
426
444
|
type: "button",
|
|
427
|
-
class:
|
|
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
|
-
|
|
432
|
-
icon:
|
|
449
|
+
T(f(fe), {
|
|
450
|
+
icon: f(ve),
|
|
433
451
|
class: "h-5 w-5"
|
|
434
452
|
}, null, 8, ["icon"]),
|
|
435
|
-
|
|
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"])) :
|
|
458
|
+
}, null, 8, ["value"])) : k("", !0)
|
|
441
459
|
], 2),
|
|
442
|
-
m.value ? (
|
|
460
|
+
m.value ? (o(), c("div", {
|
|
443
461
|
key: 0,
|
|
444
|
-
class:
|
|
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",
|
|
464
|
+
p("label", tt, [
|
|
447
465
|
s[2] || (s[2] = p("span", null, "Verification overlay", -1)),
|
|
448
|
-
|
|
449
|
-
"onUpdate:modelValue": s[1] || (s[1] = (y) =>
|
|
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
|
-
[
|
|
471
|
+
[ue, f(n)]
|
|
454
472
|
])
|
|
455
473
|
]),
|
|
456
|
-
|
|
457
|
-
p("div",
|
|
458
|
-
p("div",
|
|
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",
|
|
478
|
+
p("span", at, $(r.value.verified) + " / " + $(r.value.total), 1)
|
|
461
479
|
]),
|
|
462
|
-
|
|
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
|
-
|
|
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 ? (
|
|
492
|
+
r.value.needsReview > 0 ? (o(), c("button", {
|
|
475
493
|
key: 0,
|
|
476
494
|
type: "button",
|
|
477
|
-
class:
|
|
478
|
-
onClick: W(
|
|
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,
|
|
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)) :
|
|
483
|
-
], 64)) :
|
|
484
|
-
], 2)) :
|
|
485
|
-
|
|
486
|
-
class:
|
|
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
|
-
|
|
494
|
-
|
|
495
|
-
|
|
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
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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
|
-
|
|
533
|
+
re as walkDataPoints
|
|
515
534
|
};
|