@adoptai/genui-components 0.1.57 → 0.1.58
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/composites/document-field-extraction/FieldAuditLog.d.ts +27 -0
- package/dist/composites/document-field-extraction/FieldAuditLog.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/FieldDetail.d.ts +22 -0
- package/dist/composites/document-field-extraction/FieldDetail.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/FieldDetails.d.ts +18 -0
- package/dist/composites/document-field-extraction/FieldDetails.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/bboxTransform.d.ts +25 -0
- package/dist/composites/document-field-extraction/bboxTransform.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/fieldLabels.d.ts +2 -0
- package/dist/composites/document-field-extraction/fieldLabels.d.ts.map +1 -0
- package/dist/composites/document-field-extraction/resolver.d.ts +16 -0
- package/dist/composites/document-field-extraction/resolver.d.ts.map +1 -0
- package/dist/index.cjs +2097 -246
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1892 -45
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +1917 -181
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +1774 -38
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +1916 -180
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.d.ts.map +1 -1
- package/dist/resolver.js +1774 -38
- package/dist/resolver.js.map +1 -1
- package/dist/schemas/document-field-extraction.d.ts +258 -0
- package/dist/schemas/document-field-extraction.d.ts.map +1 -0
- package/dist/schemas/index.cjs +178 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.ts +258 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +178 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/tool-definitions.json +227 -3
- package/package.json +1 -1
package/dist/resolver.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React45 = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var dagre = require('@dagrejs/dagre');
|
|
7
7
|
var reactDom = require('react-dom');
|
|
@@ -37,7 +37,7 @@ function _interopNamespace(e) {
|
|
|
37
37
|
return Object.freeze(n);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var React45__default = /*#__PURE__*/_interopDefault(React45);
|
|
41
41
|
var dagre__default = /*#__PURE__*/_interopDefault(dagre);
|
|
42
42
|
var XLSX__namespace = /*#__PURE__*/_interopNamespace(XLSX);
|
|
43
43
|
var Papa__default = /*#__PURE__*/_interopDefault(Papa);
|
|
@@ -111,7 +111,7 @@ var init_theme = __esm({
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
function useTheme() {
|
|
114
|
-
return
|
|
114
|
+
return React45.useContext(GenUIThemeContext);
|
|
115
115
|
}
|
|
116
116
|
var DEFAULT_TOKENS, GenUIThemeContext;
|
|
117
117
|
var init_ThemeContext = __esm({
|
|
@@ -127,7 +127,7 @@ var init_ThemeContext = __esm({
|
|
|
127
127
|
SECONDARY,
|
|
128
128
|
CHART_PALETTE: [...CHART_PALETTE]
|
|
129
129
|
};
|
|
130
|
-
GenUIThemeContext =
|
|
130
|
+
GenUIThemeContext = React45.createContext(DEFAULT_TOKENS);
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
function renderInline(text) {
|
|
@@ -857,11 +857,11 @@ async function getMermaid(t) {
|
|
|
857
857
|
}
|
|
858
858
|
function MermaidFallback({ diagram, title }) {
|
|
859
859
|
const tokens = useTheme();
|
|
860
|
-
const [svg, setSvg] =
|
|
861
|
-
const [err, setErr] =
|
|
862
|
-
const [full, setFull] =
|
|
863
|
-
const idRef =
|
|
864
|
-
|
|
860
|
+
const [svg, setSvg] = React45.useState("");
|
|
861
|
+
const [err, setErr] = React45.useState(false);
|
|
862
|
+
const [full, setFull] = React45.useState(false);
|
|
863
|
+
const idRef = React45.useRef(0);
|
|
864
|
+
React45.useEffect(() => {
|
|
865
865
|
const id = ++renderSeq;
|
|
866
866
|
idRef.current = id;
|
|
867
867
|
setErr(false);
|
|
@@ -930,7 +930,7 @@ function FullscreenModalInner({ nodes, edges, title, onClose }) {
|
|
|
930
930
|
] }) });
|
|
931
931
|
}
|
|
932
932
|
function FullscreenModal({ nodes, edges, title, onClose }) {
|
|
933
|
-
|
|
933
|
+
React45.useEffect(() => {
|
|
934
934
|
const h = (e) => {
|
|
935
935
|
if (e.key === "Escape") onClose();
|
|
936
936
|
};
|
|
@@ -943,8 +943,8 @@ function FullscreenModal({ nodes, edges, title, onClose }) {
|
|
|
943
943
|
);
|
|
944
944
|
}
|
|
945
945
|
function usePrefersReducedMotion() {
|
|
946
|
-
const [reduced, setReduced] =
|
|
947
|
-
|
|
946
|
+
const [reduced, setReduced] = React45.useState(false);
|
|
947
|
+
React45.useEffect(() => {
|
|
948
948
|
var _a;
|
|
949
949
|
if (typeof matchMedia === "undefined") return;
|
|
950
950
|
const mq = matchMedia("(prefers-reduced-motion: reduce)");
|
|
@@ -988,9 +988,9 @@ function topoOrder(nodeIds, edges) {
|
|
|
988
988
|
}
|
|
989
989
|
function useAutoplay(order, enabled) {
|
|
990
990
|
const reduced = usePrefersReducedMotion();
|
|
991
|
-
const [step, setStep] =
|
|
991
|
+
const [step, setStep] = React45.useState(0);
|
|
992
992
|
const key = order.join("|");
|
|
993
|
-
|
|
993
|
+
React45.useEffect(() => {
|
|
994
994
|
if (!enabled || reduced || order.length === 0) {
|
|
995
995
|
setStep(0);
|
|
996
996
|
return;
|
|
@@ -1012,7 +1012,7 @@ function useAutoplay(order, enabled) {
|
|
|
1012
1012
|
timer = setTimeout(tick, 850);
|
|
1013
1013
|
return () => clearTimeout(timer);
|
|
1014
1014
|
}, [enabled, reduced, key]);
|
|
1015
|
-
return
|
|
1015
|
+
return React45.useMemo(() => {
|
|
1016
1016
|
const m = {};
|
|
1017
1017
|
order.forEach((id, i) => {
|
|
1018
1018
|
m[id] = i < step ? "done" : i === step ? "active" : "pending";
|
|
@@ -1034,13 +1034,13 @@ function resolveStates(nodes, nodeStates) {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
function Inner({ diagram, title, autoplay, nodeStates }) {
|
|
1036
1036
|
const tokens = useTheme();
|
|
1037
|
-
const [full, setFull] =
|
|
1038
|
-
const [focused, setFocused] =
|
|
1039
|
-
const [boxW, setBoxW] =
|
|
1040
|
-
const containerRef =
|
|
1041
|
-
const parsed =
|
|
1042
|
-
const layout =
|
|
1043
|
-
const themedEdges =
|
|
1037
|
+
const [full, setFull] = React45.useState(false);
|
|
1038
|
+
const [focused, setFocused] = React45.useState(false);
|
|
1039
|
+
const [boxW, setBoxW] = React45.useState(640);
|
|
1040
|
+
const containerRef = React45.useRef(null);
|
|
1041
|
+
const parsed = React45.useMemo(() => parseMermaidFlow(diagram), [diagram]);
|
|
1042
|
+
const layout = React45.useMemo(() => parsed ? computeLayout(parsed) : null, [parsed]);
|
|
1043
|
+
const themedEdges = React45.useMemo(
|
|
1044
1044
|
() => {
|
|
1045
1045
|
var _a;
|
|
1046
1046
|
return ((_a = layout == null ? void 0 : layout.edges) != null ? _a : []).map((e) => __spreadProps(__spreadValues({}, e), {
|
|
@@ -1052,7 +1052,7 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
|
|
|
1052
1052
|
},
|
|
1053
1053
|
[layout, tokens.ACCENT, tokens.MUTED]
|
|
1054
1054
|
);
|
|
1055
|
-
const order =
|
|
1055
|
+
const order = React45.useMemo(
|
|
1056
1056
|
() => {
|
|
1057
1057
|
var _a, _b;
|
|
1058
1058
|
return topoOrder(((_a = layout == null ? void 0 : layout.nodes) != null ? _a : []).map((n) => n.id), (_b = layout == null ? void 0 : layout.edges) != null ? _b : []);
|
|
@@ -1060,19 +1060,19 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
|
|
|
1060
1060
|
[layout]
|
|
1061
1061
|
);
|
|
1062
1062
|
const autoStatus = useAutoplay(order, !!autoplay);
|
|
1063
|
-
const staticStatus =
|
|
1063
|
+
const staticStatus = React45.useMemo(() => {
|
|
1064
1064
|
var _a;
|
|
1065
1065
|
return resolveStates((_a = layout == null ? void 0 : layout.nodes) != null ? _a : [], nodeStates);
|
|
1066
1066
|
}, [layout, nodeStates]);
|
|
1067
1067
|
const statusMap = autoplay ? autoStatus : staticStatus;
|
|
1068
|
-
const displayNodes =
|
|
1068
|
+
const displayNodes = React45.useMemo(
|
|
1069
1069
|
() => {
|
|
1070
1070
|
var _a;
|
|
1071
1071
|
return ((_a = layout == null ? void 0 : layout.nodes) != null ? _a : []).map((n) => __spreadProps(__spreadValues({}, n), { data: __spreadProps(__spreadValues({}, n.data), { status: statusMap[n.id] }) }));
|
|
1072
1072
|
},
|
|
1073
1073
|
[layout, statusMap]
|
|
1074
1074
|
);
|
|
1075
|
-
const displayEdges =
|
|
1075
|
+
const displayEdges = React45.useMemo(
|
|
1076
1076
|
() => themedEdges.map((e) => {
|
|
1077
1077
|
const ss = statusMap[e.source];
|
|
1078
1078
|
const ts = statusMap[e.target];
|
|
@@ -1092,13 +1092,13 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
|
|
|
1092
1092
|
const [nodes, setNodes, onNC] = react.useNodesState(displayNodes);
|
|
1093
1093
|
const [edges, setEdges, onEC] = react.useEdgesState(displayEdges);
|
|
1094
1094
|
const rf = react.useReactFlow();
|
|
1095
|
-
|
|
1095
|
+
React45.useEffect(() => {
|
|
1096
1096
|
setNodes(displayNodes);
|
|
1097
1097
|
}, [displayNodes, setNodes]);
|
|
1098
|
-
|
|
1098
|
+
React45.useEffect(() => {
|
|
1099
1099
|
setEdges(displayEdges);
|
|
1100
1100
|
}, [displayEdges, setEdges]);
|
|
1101
|
-
|
|
1101
|
+
React45.useEffect(() => {
|
|
1102
1102
|
const id = requestAnimationFrame(() => {
|
|
1103
1103
|
try {
|
|
1104
1104
|
rf.fitView({ padding: 0.1 });
|
|
@@ -1107,14 +1107,14 @@ function Inner({ diagram, title, autoplay, nodeStates }) {
|
|
|
1107
1107
|
});
|
|
1108
1108
|
return () => cancelAnimationFrame(id);
|
|
1109
1109
|
}, [layout, rf]);
|
|
1110
|
-
const handleClickOutside =
|
|
1110
|
+
const handleClickOutside = React45.useCallback((e) => {
|
|
1111
1111
|
if (containerRef.current && !containerRef.current.contains(e.target)) setFocused(false);
|
|
1112
1112
|
}, []);
|
|
1113
|
-
|
|
1113
|
+
React45.useEffect(() => {
|
|
1114
1114
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1115
1115
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1116
1116
|
}, [handleClickOutside]);
|
|
1117
|
-
|
|
1117
|
+
React45.useEffect(() => {
|
|
1118
1118
|
const el = containerRef.current;
|
|
1119
1119
|
if (!el) return;
|
|
1120
1120
|
let raf = 0;
|
|
@@ -1273,15 +1273,15 @@ __export(PdfViewer_exports, {
|
|
|
1273
1273
|
PdfViewer: () => PdfViewer
|
|
1274
1274
|
});
|
|
1275
1275
|
function PdfViewer({ url, base64, onLoadSuccess }) {
|
|
1276
|
-
const [numPages, setNumPages] =
|
|
1277
|
-
const [currentPage, setCurrentPage] =
|
|
1278
|
-
const [loading, setLoading] =
|
|
1279
|
-
const handleLoad =
|
|
1276
|
+
const [numPages, setNumPages] = React45.useState(0);
|
|
1277
|
+
const [currentPage, setCurrentPage] = React45.useState(1);
|
|
1278
|
+
const [loading, setLoading] = React45.useState(true);
|
|
1279
|
+
const handleLoad = React45.useCallback(({ numPages: n }) => {
|
|
1280
1280
|
setNumPages(n);
|
|
1281
1281
|
setLoading(false);
|
|
1282
1282
|
onLoadSuccess == null ? void 0 : onLoadSuccess(n);
|
|
1283
1283
|
}, [onLoadSuccess]);
|
|
1284
|
-
|
|
1284
|
+
React45.useEffect(() => {
|
|
1285
1285
|
if (numPages <= 1) return;
|
|
1286
1286
|
const handler = (e) => {
|
|
1287
1287
|
var _a;
|
|
@@ -1377,13 +1377,13 @@ __export(ExcelViewer_exports, {
|
|
|
1377
1377
|
ExcelViewer: () => ExcelViewer
|
|
1378
1378
|
});
|
|
1379
1379
|
function ExcelViewer({ url, base64, onLoadSuccess }) {
|
|
1380
|
-
const [sheetNames, setSheetNames] =
|
|
1381
|
-
const [activeSheet, setActiveSheet] =
|
|
1382
|
-
const [data, setData] =
|
|
1383
|
-
const [loading, setLoading] =
|
|
1384
|
-
const [error, setError] =
|
|
1385
|
-
const wbRef =
|
|
1386
|
-
|
|
1380
|
+
const [sheetNames, setSheetNames] = React45.useState([]);
|
|
1381
|
+
const [activeSheet, setActiveSheet] = React45.useState(0);
|
|
1382
|
+
const [data, setData] = React45.useState([]);
|
|
1383
|
+
const [loading, setLoading] = React45.useState(true);
|
|
1384
|
+
const [error, setError] = React45.useState(null);
|
|
1385
|
+
const wbRef = React45.useRef(null);
|
|
1386
|
+
React45.useEffect(() => {
|
|
1387
1387
|
let cancelled = false;
|
|
1388
1388
|
setLoading(true);
|
|
1389
1389
|
setError(null);
|
|
@@ -1441,7 +1441,7 @@ function ExcelViewer({ url, base64, onLoadSuccess }) {
|
|
|
1441
1441
|
const rows = XLSX__namespace.utils.sheet_to_json(wbRef.current.Sheets[wbRef.current.SheetNames[idx]], { header: 1 });
|
|
1442
1442
|
setData(rows);
|
|
1443
1443
|
};
|
|
1444
|
-
|
|
1444
|
+
React45.useEffect(() => {
|
|
1445
1445
|
if (sheetNames.length <= 1) return;
|
|
1446
1446
|
const handler = (e) => {
|
|
1447
1447
|
var _a;
|
|
@@ -1566,10 +1566,10 @@ __export(CsvViewer_exports, {
|
|
|
1566
1566
|
});
|
|
1567
1567
|
function CsvViewer({ url, base64, delimiter, maxRows }) {
|
|
1568
1568
|
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
|
|
1569
|
-
const [rows, setRows] =
|
|
1570
|
-
const [loading, setLoading] =
|
|
1571
|
-
const [error, setError] =
|
|
1572
|
-
|
|
1569
|
+
const [rows, setRows] = React45.useState([]);
|
|
1570
|
+
const [loading, setLoading] = React45.useState(true);
|
|
1571
|
+
const [error, setError] = React45.useState(null);
|
|
1572
|
+
React45.useEffect(() => {
|
|
1573
1573
|
let cancelled = false;
|
|
1574
1574
|
setLoading(true);
|
|
1575
1575
|
setError(null);
|
|
@@ -1688,10 +1688,10 @@ __export(TextViewer_exports, {
|
|
|
1688
1688
|
});
|
|
1689
1689
|
function TextViewer({ url, base64, markdown = false, maxLines }) {
|
|
1690
1690
|
const { MUTED: MUTED2 } = useTheme();
|
|
1691
|
-
const [text, setText] =
|
|
1692
|
-
const [loading, setLoading] =
|
|
1693
|
-
const [error, setError] =
|
|
1694
|
-
|
|
1691
|
+
const [text, setText] = React45.useState("");
|
|
1692
|
+
const [loading, setLoading] = React45.useState(true);
|
|
1693
|
+
const [error, setError] = React45.useState(null);
|
|
1694
|
+
React45.useEffect(() => {
|
|
1695
1695
|
let cancelled = false;
|
|
1696
1696
|
setLoading(true);
|
|
1697
1697
|
setError(null);
|
|
@@ -1789,10 +1789,10 @@ function sanitize(html) {
|
|
|
1789
1789
|
}
|
|
1790
1790
|
function DocxViewer({ url, base64 }) {
|
|
1791
1791
|
const { MUTED: MUTED2, BORDER: BORDER4 } = useTheme();
|
|
1792
|
-
const [html, setHtml] =
|
|
1793
|
-
const [loading, setLoading] =
|
|
1794
|
-
const [error, setError] =
|
|
1795
|
-
|
|
1792
|
+
const [html, setHtml] = React45.useState("");
|
|
1793
|
+
const [loading, setLoading] = React45.useState(true);
|
|
1794
|
+
const [error, setError] = React45.useState(null);
|
|
1795
|
+
React45.useEffect(() => {
|
|
1796
1796
|
let cancelled = false;
|
|
1797
1797
|
setLoading(true);
|
|
1798
1798
|
setError(null);
|
|
@@ -5305,6 +5305,183 @@ var workflowStepperTool = {
|
|
|
5305
5305
|
required: ["type", "title", "steps"]
|
|
5306
5306
|
}
|
|
5307
5307
|
};
|
|
5308
|
+
var bbox = zod.z.tuple([zod.z.number(), zod.z.number(), zod.z.number(), zod.z.number()]);
|
|
5309
|
+
var fieldSchema = zod.z.object({
|
|
5310
|
+
field_key: zod.z.string(),
|
|
5311
|
+
label: zod.z.string(),
|
|
5312
|
+
value: zod.z.string(),
|
|
5313
|
+
page: zod.z.number(),
|
|
5314
|
+
// 0-indexed, matches PageDimension.page
|
|
5315
|
+
bbox: bbox.nullable().optional(),
|
|
5316
|
+
confidence: zod.z.number().optional(),
|
|
5317
|
+
confidence_tier: zod.z.enum(["green", "amber", "red"]).optional(),
|
|
5318
|
+
badge: zod.z.enum(["SC", "CN", "AB", "SW"]).optional(),
|
|
5319
|
+
state: zod.z.enum(["ok", "corrected", "missing", "warn"]).optional(),
|
|
5320
|
+
entity_type: zod.z.string().optional(),
|
|
5321
|
+
is_primary: zod.z.boolean().optional(),
|
|
5322
|
+
// Set after a human correction (extractor output, or an optimistic in-card
|
|
5323
|
+
// edit) so the editable field card can show old → new and who changed it.
|
|
5324
|
+
previous_value: zod.z.string().nullable().optional(),
|
|
5325
|
+
corrected_by: zod.z.string().nullable().optional()
|
|
5326
|
+
});
|
|
5327
|
+
var pageSchema = zod.z.object({
|
|
5328
|
+
page: zod.z.number(),
|
|
5329
|
+
// 0-indexed
|
|
5330
|
+
imageUrl: zod.z.string().optional(),
|
|
5331
|
+
// host-resolved from the durable image_ref
|
|
5332
|
+
width_pt: zod.z.number(),
|
|
5333
|
+
height_pt: zod.z.number()
|
|
5334
|
+
});
|
|
5335
|
+
var summaryStatSchema = zod.z.object({
|
|
5336
|
+
field_key: zod.z.string(),
|
|
5337
|
+
label: zod.z.string(),
|
|
5338
|
+
value: zod.z.string(),
|
|
5339
|
+
caption: zod.z.string().nullable().optional()
|
|
5340
|
+
});
|
|
5341
|
+
var summaryFactSchema = zod.z.object({
|
|
5342
|
+
field_key: zod.z.string(),
|
|
5343
|
+
label: zod.z.string(),
|
|
5344
|
+
value: zod.z.string(),
|
|
5345
|
+
badge: zod.z.string().nullable().optional()
|
|
5346
|
+
});
|
|
5347
|
+
var summarySchema = zod.z.object({
|
|
5348
|
+
display_name: zod.z.string().nullable().optional(),
|
|
5349
|
+
short_name: zod.z.string().nullable().optional(),
|
|
5350
|
+
organization: zod.z.string().nullable().optional(),
|
|
5351
|
+
domain: zod.z.string().nullable().optional(),
|
|
5352
|
+
domain_group: zod.z.string().nullable().optional(),
|
|
5353
|
+
tax_year: zod.z.union([zod.z.string(), zod.z.number()]).nullable().optional(),
|
|
5354
|
+
crumbs: zod.z.array(zod.z.string()).optional(),
|
|
5355
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
5356
|
+
stats: zod.z.array(summaryStatSchema).optional(),
|
|
5357
|
+
facts: zod.z.array(summaryFactSchema).optional()
|
|
5358
|
+
});
|
|
5359
|
+
var documentFieldExtractionSchema = zod.z.object({
|
|
5360
|
+
type: zod.z.literal("document-field-extraction"),
|
|
5361
|
+
doc_type: zod.z.string().optional(),
|
|
5362
|
+
// Original uploaded filename (e.g. "2024_gl.pdf"); preferred over doc_type for
|
|
5363
|
+
// the card title since doc_type is often the "generic_fallback" schema name.
|
|
5364
|
+
file_name: zod.z.string().optional(),
|
|
5365
|
+
// Server-side token; resolved by the host into pages/fields before render.
|
|
5366
|
+
payload_ref: zod.z.string().optional(),
|
|
5367
|
+
// Present for persisted workstream docs; absent for pre-existing cards.
|
|
5368
|
+
store_id: zod.z.string().optional(),
|
|
5369
|
+
doc_id: zod.z.string().optional(),
|
|
5370
|
+
pages: zod.z.array(pageSchema).max(100).optional(),
|
|
5371
|
+
fields: zod.z.array(fieldSchema).max(1e3).optional(),
|
|
5372
|
+
// Page-count metadata for the Details tab ("N of M pages extracted").
|
|
5373
|
+
page_count: zod.z.number().optional(),
|
|
5374
|
+
pages_processed: zod.z.number().optional(),
|
|
5375
|
+
// Deterministic document summary for the Details tab.
|
|
5376
|
+
summary: summarySchema.nullable().optional()
|
|
5377
|
+
});
|
|
5378
|
+
var documentFieldExtractionTool = {
|
|
5379
|
+
name: "render_document_field_extraction",
|
|
5380
|
+
description: "Render extracted document fields as an interactive overlay on the page image(s) \u2014 colored bounding boxes per field plus a synced field-card list. Use after the extract_document tool returns; pass the returned payload_ref (the host expands it). For invoices, statements, tax forms, receipts, KYC/loan docs, POs where the user wants to SEE where each value sits on the page.",
|
|
5381
|
+
input_schema: {
|
|
5382
|
+
type: "object",
|
|
5383
|
+
properties: {
|
|
5384
|
+
type: { type: "string", enum: ["document-field-extraction"] },
|
|
5385
|
+
doc_type: { type: "string" },
|
|
5386
|
+
file_name: {
|
|
5387
|
+
type: "string",
|
|
5388
|
+
description: "Original uploaded filename; shown as the card title."
|
|
5389
|
+
},
|
|
5390
|
+
payload_ref: {
|
|
5391
|
+
type: "string",
|
|
5392
|
+
description: "Durable store key returned by extract_document; the GenUI host expands it into pages/fields at render time. Pass this verbatim \u2014 do NOT hand-build pages/fields."
|
|
5393
|
+
},
|
|
5394
|
+
store_id: {
|
|
5395
|
+
type: "string",
|
|
5396
|
+
description: "Docstore store id; present for persisted workstream docs. The host uses this to open the editable viewer."
|
|
5397
|
+
},
|
|
5398
|
+
doc_id: {
|
|
5399
|
+
type: "string",
|
|
5400
|
+
description: "Docstore document id; present for persisted workstream docs. Required for the editable viewer."
|
|
5401
|
+
},
|
|
5402
|
+
pages: {
|
|
5403
|
+
type: "array",
|
|
5404
|
+
items: {
|
|
5405
|
+
type: "object",
|
|
5406
|
+
properties: {
|
|
5407
|
+
page: { type: "number", description: "0-indexed page number" },
|
|
5408
|
+
imageUrl: { type: "string" },
|
|
5409
|
+
width_pt: { type: "number" },
|
|
5410
|
+
height_pt: { type: "number" }
|
|
5411
|
+
},
|
|
5412
|
+
required: ["page", "width_pt", "height_pt"]
|
|
5413
|
+
}
|
|
5414
|
+
},
|
|
5415
|
+
fields: {
|
|
5416
|
+
type: "array",
|
|
5417
|
+
items: {
|
|
5418
|
+
type: "object",
|
|
5419
|
+
properties: {
|
|
5420
|
+
field_key: { type: "string" },
|
|
5421
|
+
label: { type: "string" },
|
|
5422
|
+
value: { type: "string" },
|
|
5423
|
+
page: { type: "number", description: "0-indexed page number" },
|
|
5424
|
+
bbox: {
|
|
5425
|
+
type: "array",
|
|
5426
|
+
items: { type: "number" },
|
|
5427
|
+
description: "[x0,y0,x1,y1] PDF points, origin bottom-left; null if unlocated"
|
|
5428
|
+
},
|
|
5429
|
+
confidence: { type: "number" },
|
|
5430
|
+
confidence_tier: { type: "string", enum: ["green", "amber", "red"] },
|
|
5431
|
+
badge: { type: "string", enum: ["SC", "CN", "AB", "SW"] },
|
|
5432
|
+
state: { type: "string", enum: ["ok", "corrected", "missing", "warn"] },
|
|
5433
|
+
entity_type: { type: "string" },
|
|
5434
|
+
is_primary: { type: "boolean" }
|
|
5435
|
+
},
|
|
5436
|
+
required: ["field_key", "label", "value", "page"]
|
|
5437
|
+
}
|
|
5438
|
+
},
|
|
5439
|
+
page_count: { type: "number" },
|
|
5440
|
+
pages_processed: { type: "number" },
|
|
5441
|
+
summary: {
|
|
5442
|
+
type: "object",
|
|
5443
|
+
description: "Deterministic document summary for the Details tab (display_name, organization, domain, stats, facts, tags). Produced by the extractor \u2014 pass through verbatim.",
|
|
5444
|
+
properties: {
|
|
5445
|
+
display_name: { type: "string" },
|
|
5446
|
+
short_name: { type: "string" },
|
|
5447
|
+
organization: { type: "string" },
|
|
5448
|
+
domain: { type: "string" },
|
|
5449
|
+
domain_group: { type: "string" },
|
|
5450
|
+
tax_year: { type: "string" },
|
|
5451
|
+
crumbs: { type: "array", items: { type: "string" } },
|
|
5452
|
+
tags: { type: "array", items: { type: "string" } },
|
|
5453
|
+
stats: {
|
|
5454
|
+
type: "array",
|
|
5455
|
+
items: {
|
|
5456
|
+
type: "object",
|
|
5457
|
+
properties: {
|
|
5458
|
+
field_key: { type: "string" },
|
|
5459
|
+
label: { type: "string" },
|
|
5460
|
+
value: { type: "string" },
|
|
5461
|
+
caption: { type: "string" }
|
|
5462
|
+
},
|
|
5463
|
+
required: ["field_key", "label", "value"]
|
|
5464
|
+
}
|
|
5465
|
+
},
|
|
5466
|
+
facts: {
|
|
5467
|
+
type: "array",
|
|
5468
|
+
items: {
|
|
5469
|
+
type: "object",
|
|
5470
|
+
properties: {
|
|
5471
|
+
field_key: { type: "string" },
|
|
5472
|
+
label: { type: "string" },
|
|
5473
|
+
value: { type: "string" },
|
|
5474
|
+
badge: { type: "string" }
|
|
5475
|
+
},
|
|
5476
|
+
required: ["field_key", "label", "value"]
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5480
|
+
}
|
|
5481
|
+
},
|
|
5482
|
+
required: ["type"]
|
|
5483
|
+
}
|
|
5484
|
+
};
|
|
5308
5485
|
var decisionCardSchema = zod.z.object({
|
|
5309
5486
|
type: zod.z.literal("decision-card"),
|
|
5310
5487
|
id: zod.z.string().optional(),
|
|
@@ -5468,6 +5645,7 @@ var schemaRegistry = {
|
|
|
5468
5645
|
"integrations-list": { schema: integrationsListSchema, tool: integrationsListTool },
|
|
5469
5646
|
"pipeline-preview": { schema: pipelinePreviewSchema, tool: pipelinePreviewTool },
|
|
5470
5647
|
"workflow-stepper": { schema: workflowStepperSchema, tool: workflowStepperTool },
|
|
5648
|
+
"document-field-extraction": { schema: documentFieldExtractionSchema, tool: documentFieldExtractionTool },
|
|
5471
5649
|
"decision-card": { schema: decisionCardSchema, tool: decisionCardTool }
|
|
5472
5650
|
};
|
|
5473
5651
|
|
|
@@ -5550,16 +5728,16 @@ init_theme();
|
|
|
5550
5728
|
var DOT_COLOR = "#aaaaaa";
|
|
5551
5729
|
var DOT_HOVER = "#555555";
|
|
5552
5730
|
function ComponentActions({ children, onDownloadCSV, columnConfig, filename = "component" }) {
|
|
5553
|
-
const [open, setOpen] =
|
|
5554
|
-
const [view, setView] =
|
|
5555
|
-
const contentRef =
|
|
5556
|
-
const menuRef =
|
|
5557
|
-
const btnRef =
|
|
5558
|
-
const close =
|
|
5731
|
+
const [open, setOpen] = React45.useState(false);
|
|
5732
|
+
const [view, setView] = React45.useState("main");
|
|
5733
|
+
const contentRef = React45.useRef(null);
|
|
5734
|
+
const menuRef = React45.useRef(null);
|
|
5735
|
+
const btnRef = React45.useRef(null);
|
|
5736
|
+
const close = React45.useCallback(() => {
|
|
5559
5737
|
setOpen(false);
|
|
5560
5738
|
setView("main");
|
|
5561
5739
|
}, []);
|
|
5562
|
-
|
|
5740
|
+
React45.useEffect(() => {
|
|
5563
5741
|
if (!open) return;
|
|
5564
5742
|
const handler = (e) => {
|
|
5565
5743
|
var _a, _b;
|
|
@@ -5570,7 +5748,7 @@ function ComponentActions({ children, onDownloadCSV, columnConfig, filename = "c
|
|
|
5570
5748
|
document.addEventListener("mousedown", handler);
|
|
5571
5749
|
return () => document.removeEventListener("mousedown", handler);
|
|
5572
5750
|
}, [open, close]);
|
|
5573
|
-
const handleDownloadPNG =
|
|
5751
|
+
const handleDownloadPNG = React45.useCallback(async () => {
|
|
5574
5752
|
if (!contentRef.current) return;
|
|
5575
5753
|
try {
|
|
5576
5754
|
const url = await htmlToImage.toPng(contentRef.current, { backgroundColor: "white", pixelRatio: 2 });
|
|
@@ -5582,7 +5760,7 @@ function ComponentActions({ children, onDownloadCSV, columnConfig, filename = "c
|
|
|
5582
5760
|
}
|
|
5583
5761
|
close();
|
|
5584
5762
|
}, [filename, close]);
|
|
5585
|
-
const handleCSV =
|
|
5763
|
+
const handleCSV = React45.useCallback(() => {
|
|
5586
5764
|
onDownloadCSV == null ? void 0 : onDownloadCSV();
|
|
5587
5765
|
close();
|
|
5588
5766
|
}, [onDownloadCSV, close]);
|
|
@@ -5694,12 +5872,12 @@ function MenuButton({ label, onClick }) {
|
|
|
5694
5872
|
);
|
|
5695
5873
|
}
|
|
5696
5874
|
function useColumnVisibility(columns) {
|
|
5697
|
-
const [hidden, setHidden] =
|
|
5698
|
-
const visibleColumns =
|
|
5875
|
+
const [hidden, setHidden] = React45.useState(/* @__PURE__ */ new Set());
|
|
5876
|
+
const visibleColumns = React45.useMemo(
|
|
5699
5877
|
() => columns.filter((c) => !hidden.has(c.key)),
|
|
5700
5878
|
[columns, hidden]
|
|
5701
5879
|
);
|
|
5702
|
-
const toggle =
|
|
5880
|
+
const toggle = React45.useCallback((key) => {
|
|
5703
5881
|
setHidden((prev) => {
|
|
5704
5882
|
const next = new Set(prev);
|
|
5705
5883
|
if (next.has(key)) next.delete(key);
|
|
@@ -5707,8 +5885,8 @@ function useColumnVisibility(columns) {
|
|
|
5707
5885
|
return next;
|
|
5708
5886
|
});
|
|
5709
5887
|
}, []);
|
|
5710
|
-
const showAll =
|
|
5711
|
-
const hideAll =
|
|
5888
|
+
const showAll = React45.useCallback(() => setHidden(/* @__PURE__ */ new Set()), []);
|
|
5889
|
+
const hideAll = React45.useCallback(
|
|
5712
5890
|
() => setHidden(new Set(columns.map((c) => c.key))),
|
|
5713
5891
|
[columns]
|
|
5714
5892
|
);
|
|
@@ -5959,9 +6137,9 @@ function AlertResolver(p) {
|
|
|
5959
6137
|
// src/composites/stat-grid/resolver.tsx
|
|
5960
6138
|
init_Markdown();
|
|
5961
6139
|
function FitText({ children, max = 22, min = 13, title, className, style }) {
|
|
5962
|
-
const ref =
|
|
5963
|
-
const [size, setSize] =
|
|
5964
|
-
|
|
6140
|
+
const ref = React45.useRef(null);
|
|
6141
|
+
const [size, setSize] = React45.useState(max);
|
|
6142
|
+
React45.useLayoutEffect(() => {
|
|
5965
6143
|
const el = ref.current;
|
|
5966
6144
|
if (!el) return void 0;
|
|
5967
6145
|
const fit = () => {
|
|
@@ -6048,7 +6226,7 @@ init_ThemeContext();
|
|
|
6048
6226
|
function TabsPanelResolver(p) {
|
|
6049
6227
|
var _a;
|
|
6050
6228
|
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
|
|
6051
|
-
const [activeIdx, setActiveIdx] =
|
|
6229
|
+
const [activeIdx, setActiveIdx] = React45.useState(0);
|
|
6052
6230
|
const activeTab = p.tabs[activeIdx];
|
|
6053
6231
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: "tabs-panel", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "0" }, children: [
|
|
6054
6232
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6206,17 +6384,17 @@ function SparklineTableResolver(p) {
|
|
|
6206
6384
|
// src/composites/heatmap-table/resolver.tsx
|
|
6207
6385
|
init_theme();
|
|
6208
6386
|
init_ThemeContext();
|
|
6209
|
-
function heatColor(
|
|
6210
|
-
const clamped = Math.max(-3, Math.min(3,
|
|
6387
|
+
function heatColor(z60) {
|
|
6388
|
+
const clamped = Math.max(-3, Math.min(3, z60));
|
|
6211
6389
|
const abs = Math.abs(clamped);
|
|
6212
6390
|
const lightness = 95 - abs * 8;
|
|
6213
6391
|
const hue = clamped >= 0 ? 142 : 0;
|
|
6214
6392
|
return `hsl(${hue} 60% ${lightness}%)`;
|
|
6215
6393
|
}
|
|
6216
|
-
function heatTextColor(
|
|
6217
|
-
const abs = Math.abs(
|
|
6218
|
-
if (abs > 2) return
|
|
6219
|
-
if (abs > 1) return
|
|
6394
|
+
function heatTextColor(z60) {
|
|
6395
|
+
const abs = Math.abs(z60);
|
|
6396
|
+
if (abs > 2) return z60 >= 0 ? "#14532d" : "#7f1d1d";
|
|
6397
|
+
if (abs > 1) return z60 >= 0 ? "#166534" : "#991b1b";
|
|
6220
6398
|
return "var(--foreground)";
|
|
6221
6399
|
}
|
|
6222
6400
|
var th2 = {
|
|
@@ -6314,7 +6492,7 @@ var thStyle2 = {
|
|
|
6314
6492
|
function ScreenerTableResolver(p) {
|
|
6315
6493
|
var _a, _b, _c, _d, _e, _f;
|
|
6316
6494
|
const { ACCENT: ACCENT2, BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
|
|
6317
|
-
const [activeFilters, setActiveFilters] =
|
|
6495
|
+
const [activeFilters, setActiveFilters] = React45.useState(new Set((_a = p.activeFilters) != null ? _a : []));
|
|
6318
6496
|
const { visibleColumns, hidden, toggle, showAll, hideAll, allColumns } = useColumnVisibility((_b = p.columns) != null ? _b : []);
|
|
6319
6497
|
const toggleFilter = (f) => setActiveFilters((prev) => {
|
|
6320
6498
|
const next = new Set(prev);
|
|
@@ -6384,7 +6562,7 @@ var th3 = {
|
|
|
6384
6562
|
};
|
|
6385
6563
|
function GroupRows({ group, columns, depth }) {
|
|
6386
6564
|
var _a, _b;
|
|
6387
|
-
const [open, setOpen] =
|
|
6565
|
+
const [open, setOpen] = React45.useState(true);
|
|
6388
6566
|
const indent = depth * 14;
|
|
6389
6567
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6390
6568
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6489,7 +6667,7 @@ var dotColor = {
|
|
|
6489
6667
|
function NewsFeedResolver(p) {
|
|
6490
6668
|
var _a, _b;
|
|
6491
6669
|
const { ACCENT: ACCENT2, MUTED: MUTED2 } = useTheme();
|
|
6492
|
-
const [filter, setFilter] =
|
|
6670
|
+
const [filter, setFilter] = React45.useState(null);
|
|
6493
6671
|
const sentiments = ["positive", "neutral", "negative"].filter(
|
|
6494
6672
|
(s) => {
|
|
6495
6673
|
var _a2;
|
|
@@ -6531,9 +6709,9 @@ function NewsFeedResolver(p) {
|
|
|
6531
6709
|
] }) });
|
|
6532
6710
|
}
|
|
6533
6711
|
function useSeriesToggle(seriesKeys) {
|
|
6534
|
-
const [hidden, setHidden] =
|
|
6535
|
-
const isVisible =
|
|
6536
|
-
const toggle =
|
|
6712
|
+
const [hidden, setHidden] = React45.useState(/* @__PURE__ */ new Set());
|
|
6713
|
+
const isVisible = React45.useCallback((key) => !hidden.has(key), [hidden]);
|
|
6714
|
+
const toggle = React45.useCallback((key) => {
|
|
6537
6715
|
setHidden((prev) => {
|
|
6538
6716
|
const next = new Set(prev);
|
|
6539
6717
|
if (next.has(key)) next.delete(key);
|
|
@@ -6541,7 +6719,7 @@ function useSeriesToggle(seriesKeys) {
|
|
|
6541
6719
|
return next;
|
|
6542
6720
|
});
|
|
6543
6721
|
}, []);
|
|
6544
|
-
const showAll =
|
|
6722
|
+
const showAll = React45.useCallback(() => setHidden(/* @__PURE__ */ new Set()), []);
|
|
6545
6723
|
return { hidden, isVisible, toggle, showAll, allKeys: seriesKeys };
|
|
6546
6724
|
}
|
|
6547
6725
|
|
|
@@ -6850,7 +7028,7 @@ function WaterfallChartResolver(p) {
|
|
|
6850
7028
|
] }) });
|
|
6851
7029
|
}
|
|
6852
7030
|
init_ThemeContext();
|
|
6853
|
-
var FlowGraph2 =
|
|
7031
|
+
var FlowGraph2 = React45__default.default.lazy(
|
|
6854
7032
|
() => Promise.resolve().then(() => (init_FlowGraph(), FlowGraph_exports)).then((m) => ({ default: m.FlowGraph }))
|
|
6855
7033
|
);
|
|
6856
7034
|
function FlowCanvasRenderer({
|
|
@@ -6891,7 +7069,7 @@ function FlowCanvasRenderer({
|
|
|
6891
7069
|
overflow: "hidden",
|
|
6892
7070
|
background: "#ffffff",
|
|
6893
7071
|
position: "relative"
|
|
6894
|
-
}, diagram ? {} : { height: "320px" }), children: diagram ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
7072
|
+
}, diagram ? {} : { height: "320px" }), children: diagram ? /* @__PURE__ */ jsxRuntime.jsx(React45.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(FlowGraph2, { diagram, title, autoplay, nodeStates }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
|
|
6895
7073
|
position: "absolute",
|
|
6896
7074
|
inset: 0,
|
|
6897
7075
|
display: "flex",
|
|
@@ -7124,7 +7302,7 @@ function TrialBalanceResolver(p) {
|
|
|
7124
7302
|
gDebit += a.debit;
|
|
7125
7303
|
gCredit += a.credit;
|
|
7126
7304
|
});
|
|
7127
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7305
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
7128
7306
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 4, style: {
|
|
7129
7307
|
padding: "8px 12px",
|
|
7130
7308
|
fontSize: "12px",
|
|
@@ -7661,7 +7839,7 @@ function ItemRow({ item }) {
|
|
|
7661
7839
|
] });
|
|
7662
7840
|
}
|
|
7663
7841
|
function Section({ section }) {
|
|
7664
|
-
const [open, setOpen] =
|
|
7842
|
+
const [open, setOpen] = React45.useState(true);
|
|
7665
7843
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
7666
7844
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7667
7845
|
"button",
|
|
@@ -7783,7 +7961,7 @@ function ReconciliationViewResolver(p) {
|
|
|
7783
7961
|
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
|
|
7784
7962
|
const sourceA = (_a = p.sourceA) != null ? _a : { label: "Source A" };
|
|
7785
7963
|
const sourceB = (_b = p.sourceB) != null ? _b : { label: "Source B" };
|
|
7786
|
-
const [activeTab, setActiveTab] =
|
|
7964
|
+
const [activeTab, setActiveTab] = React45.useState("matched");
|
|
7787
7965
|
const balanceA = (_d = (_c = p.summary) == null ? void 0 : _c.balanceA) != null ? _d : 0;
|
|
7788
7966
|
const balanceB = (_f = (_e = p.summary) == null ? void 0 : _e.balanceB) != null ? _f : 0;
|
|
7789
7967
|
const difference = (_h = (_g = p.summary) == null ? void 0 : _g.difference) != null ? _h : balanceA - balanceB;
|
|
@@ -8426,7 +8604,7 @@ function ChangesView({ changes }) {
|
|
|
8426
8604
|
}
|
|
8427
8605
|
function EventCard({ event }) {
|
|
8428
8606
|
var _a;
|
|
8429
|
-
const [showChanges, setShowChanges] =
|
|
8607
|
+
const [showChanges, setShowChanges] = React45.useState(false);
|
|
8430
8608
|
const ac = (_a = actionConfig[event.action]) != null ? _a : actionConfig.commented;
|
|
8431
8609
|
const hasChanges = event.changes && event.changes.length > 0;
|
|
8432
8610
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "12px", position: "relative" }, children: [
|
|
@@ -8484,23 +8662,23 @@ function AuditTrailResolver(p) {
|
|
|
8484
8662
|
}
|
|
8485
8663
|
init_Markdown();
|
|
8486
8664
|
function useFullscreen(ref) {
|
|
8487
|
-
const [isFullscreen, setIsFullscreen] =
|
|
8488
|
-
|
|
8665
|
+
const [isFullscreen, setIsFullscreen] = React45.useState(false);
|
|
8666
|
+
React45.useEffect(() => {
|
|
8489
8667
|
const handler = () => {
|
|
8490
8668
|
setIsFullscreen(!!document.fullscreenElement);
|
|
8491
8669
|
};
|
|
8492
8670
|
document.addEventListener("fullscreenchange", handler);
|
|
8493
8671
|
return () => document.removeEventListener("fullscreenchange", handler);
|
|
8494
8672
|
}, []);
|
|
8495
|
-
const enter =
|
|
8673
|
+
const enter = React45.useCallback(() => {
|
|
8496
8674
|
var _a, _b;
|
|
8497
8675
|
(_b = (_a = ref.current) == null ? void 0 : _a.requestFullscreen) == null ? void 0 : _b.call(_a);
|
|
8498
8676
|
}, [ref]);
|
|
8499
|
-
const exit =
|
|
8677
|
+
const exit = React45.useCallback(() => {
|
|
8500
8678
|
var _a;
|
|
8501
8679
|
if (document.fullscreenElement) (_a = document.exitFullscreen) == null ? void 0 : _a.call(document);
|
|
8502
8680
|
}, []);
|
|
8503
|
-
const toggle =
|
|
8681
|
+
const toggle = React45.useCallback(() => {
|
|
8504
8682
|
if (isFullscreen) exit();
|
|
8505
8683
|
else enter();
|
|
8506
8684
|
}, [isFullscreen, enter, exit]);
|
|
@@ -8510,10 +8688,10 @@ function useFullscreen(ref) {
|
|
|
8510
8688
|
// src/composites/document-preview/resolver.tsx
|
|
8511
8689
|
init_theme();
|
|
8512
8690
|
init_ThemeContext();
|
|
8513
|
-
var PdfViewer2 =
|
|
8691
|
+
var PdfViewer2 = React45__default.default.lazy(
|
|
8514
8692
|
() => Promise.resolve().then(() => (init_PdfViewer(), PdfViewer_exports)).then((m) => ({ default: m.PdfViewer }))
|
|
8515
8693
|
);
|
|
8516
|
-
var ExcelViewer2 =
|
|
8694
|
+
var ExcelViewer2 = React45__default.default.lazy(
|
|
8517
8695
|
() => Promise.resolve().then(() => (init_ExcelViewer(), ExcelViewer_exports)).then((m) => ({ default: m.ExcelViewer }))
|
|
8518
8696
|
);
|
|
8519
8697
|
var highlightColors = {
|
|
@@ -8563,8 +8741,8 @@ function DownloadIcon() {
|
|
|
8563
8741
|
function DocumentPreviewResolver(p) {
|
|
8564
8742
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
8565
8743
|
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2 } = useTheme();
|
|
8566
|
-
const [currentPage, setCurrentPage] =
|
|
8567
|
-
const containerRef =
|
|
8744
|
+
const [currentPage, setCurrentPage] = React45.useState(0);
|
|
8745
|
+
const containerRef = React45.useRef(null);
|
|
8568
8746
|
const { isFullscreen, toggle } = useFullscreen(containerRef);
|
|
8569
8747
|
const hasRealFile = !!(((_a = p.source) == null ? void 0 : _a.url) || ((_b = p.source) == null ? void 0 : _b.base64));
|
|
8570
8748
|
const isPdf = p.documentType === "pdf";
|
|
@@ -8572,9 +8750,9 @@ function DocumentPreviewResolver(p) {
|
|
|
8572
8750
|
const totalPages = ((_c = p.pages) != null ? _c : []).length;
|
|
8573
8751
|
const page = p.pages[currentPage];
|
|
8574
8752
|
const pageHighlights = ((_d = p.highlights) != null ? _d : []).filter((h) => h.pageIndex === currentPage);
|
|
8575
|
-
const handlePdfLoad =
|
|
8753
|
+
const handlePdfLoad = React45.useCallback(() => {
|
|
8576
8754
|
}, []);
|
|
8577
|
-
const handleExcelLoad =
|
|
8755
|
+
const handleExcelLoad = React45.useCallback(() => {
|
|
8578
8756
|
}, []);
|
|
8579
8757
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_e = p.title) != null ? _e : "document-preview", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8580
8758
|
"div",
|
|
@@ -8687,7 +8865,7 @@ function DocumentPreviewResolver(p) {
|
|
|
8687
8865
|
display: "flex",
|
|
8688
8866
|
flexDirection: "column"
|
|
8689
8867
|
}, children: [
|
|
8690
|
-
hasRealFile && isPdf ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8868
|
+
hasRealFile && isPdf ? /* @__PURE__ */ jsxRuntime.jsx(React45.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(PdfViewer2, { url: (_q = p.source) == null ? void 0 : _q.url, base64: (_r = p.source) == null ? void 0 : _r.base64, onLoadSuccess: handlePdfLoad }) }) : hasRealFile && isExcel ? /* @__PURE__ */ jsxRuntime.jsx(React45.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(ExcelViewer2, { url: (_s = p.source) == null ? void 0 : _s.url, base64: (_t = p.source) == null ? void 0 : _t.base64, onLoadSuccess: handleExcelLoad }) }) : (page == null ? void 0 : page.imageUrl) ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: page.imageUrl, alt: page.label, style: { maxWidth: "100%", borderRadius: "4px" } }) }) : (page == null ? void 0 : page.content) ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontFamily: "var(--font-sans, system-ui)", fontSize: "13px", color: "var(--foreground)", lineHeight: 1.6, margin: 0, padding: "20px" }, children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { content: page.content }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "120px", color: MUTED2, fontSize: "13px" }, children: [
|
|
8691
8869
|
"No content available for ",
|
|
8692
8870
|
(_u = page == null ? void 0 : page.label) != null ? _u : "this page"
|
|
8693
8871
|
] }),
|
|
@@ -8750,7 +8928,7 @@ function ConfidenceBar({ confidence, height = 6 }) {
|
|
|
8750
8928
|
}
|
|
8751
8929
|
function StepCard({ step, isLast }) {
|
|
8752
8930
|
var _a;
|
|
8753
|
-
const [expanded, setExpanded] =
|
|
8931
|
+
const [expanded, setExpanded] = React45.useState(false);
|
|
8754
8932
|
const cfg = stepTypeConfig[step.stepType];
|
|
8755
8933
|
const detail = (_a = step.detail) != null ? _a : "";
|
|
8756
8934
|
const isLong = detail.length > 100;
|
|
@@ -9255,7 +9433,7 @@ function ExampleRow({ example }) {
|
|
|
9255
9433
|
);
|
|
9256
9434
|
}
|
|
9257
9435
|
function PartSection({ part, defaultOpen }) {
|
|
9258
|
-
const [open, setOpen] =
|
|
9436
|
+
const [open, setOpen] = React45.useState(defaultOpen);
|
|
9259
9437
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
9260
9438
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9261
9439
|
"button",
|
|
@@ -9385,7 +9563,7 @@ function EngagementPipelineResolver(p) {
|
|
|
9385
9563
|
const defaultActive = phases.findIndex(
|
|
9386
9564
|
(ph) => ph.status === "in-progress" || ph.status === "blocked"
|
|
9387
9565
|
);
|
|
9388
|
-
const [activeIdx, setActiveIdx] =
|
|
9566
|
+
const [activeIdx, setActiveIdx] = React45.useState(defaultActive >= 0 ? defaultActive : 0);
|
|
9389
9567
|
const activePhase = phases[activeIdx];
|
|
9390
9568
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_b = p.title) != null ? _b : "engagement-pipeline", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "12px" }, children: [
|
|
9391
9569
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
|
|
@@ -9469,7 +9647,7 @@ function EngagementPipelineResolver(p) {
|
|
|
9469
9647
|
const color = (_a2 = statusColor2[phase.status]) != null ? _a2 : "#d6d3d1";
|
|
9470
9648
|
const isCurrent = i === activeIdx;
|
|
9471
9649
|
const size = isCurrent ? 28 : 20;
|
|
9472
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9650
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
9473
9651
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9474
9652
|
"div",
|
|
9475
9653
|
{
|
|
@@ -9776,7 +9954,7 @@ function Avatar({ name, avatar, hovered }) {
|
|
|
9776
9954
|
function EntityCardGridResolver(p) {
|
|
9777
9955
|
var _a, _b;
|
|
9778
9956
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
9779
|
-
const [hoveredId, setHoveredId] =
|
|
9957
|
+
const [hoveredId, setHoveredId] = React45.useState(null);
|
|
9780
9958
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "entity-card-grid", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
9781
9959
|
p.title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9782
9960
|
"p",
|
|
@@ -10032,7 +10210,7 @@ function StepRow({ step }) {
|
|
|
10032
10210
|
function JobTrackerResolver(p) {
|
|
10033
10211
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
10034
10212
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, PAPER: PAPER2 } = useTheme();
|
|
10035
|
-
const [stepsOpen, setStepsOpen] =
|
|
10213
|
+
const [stepsOpen, setStepsOpen] = React45.useState(true);
|
|
10036
10214
|
const barColor = (_a = statusColors2[p.status]) != null ? _a : MUTED2;
|
|
10037
10215
|
const badge = (_b = statusBadgeConfig[p.status]) != null ? _b : statusBadgeConfig.queued;
|
|
10038
10216
|
const progress = (_c = p.progress) != null ? _c : p.status === "completed" ? 100 : 0;
|
|
@@ -10472,7 +10650,7 @@ function CitationCard({
|
|
|
10472
10650
|
);
|
|
10473
10651
|
}
|
|
10474
10652
|
function FollowUpItem({ text }) {
|
|
10475
|
-
const [hovered, setHovered] =
|
|
10653
|
+
const [hovered, setHovered] = React45.useState(false);
|
|
10476
10654
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10477
10655
|
"span",
|
|
10478
10656
|
{
|
|
@@ -10497,7 +10675,7 @@ function CitationMarker({
|
|
|
10497
10675
|
index,
|
|
10498
10676
|
onClick
|
|
10499
10677
|
}) {
|
|
10500
|
-
const [hovered, setHovered] =
|
|
10678
|
+
const [hovered, setHovered] = React45.useState(false);
|
|
10501
10679
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10502
10680
|
"sup",
|
|
10503
10681
|
{
|
|
@@ -10526,7 +10704,7 @@ function CitationMarker({
|
|
|
10526
10704
|
function CitedAnswerResolver(p) {
|
|
10527
10705
|
var _a, _b, _c, _d, _e;
|
|
10528
10706
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, SECONDARY: SECONDARY2 } = useTheme();
|
|
10529
|
-
const [expandedIds, setExpandedIds] =
|
|
10707
|
+
const [expandedIds, setExpandedIds] = React45.useState(/* @__PURE__ */ new Set());
|
|
10530
10708
|
const toggleCitation = (id) => {
|
|
10531
10709
|
setExpandedIds((prev) => {
|
|
10532
10710
|
const next = new Set(prev);
|
|
@@ -10830,7 +11008,7 @@ function TransactionFeedResolver(p) {
|
|
|
10830
11008
|
var _a, _b, _c, _d, _e;
|
|
10831
11009
|
const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
|
|
10832
11010
|
const currency = (_a = p.currency) != null ? _a : "USD";
|
|
10833
|
-
const [hoveredIndex, setHoveredIndex] =
|
|
11011
|
+
const [hoveredIndex, setHoveredIndex] = React45.useState(null);
|
|
10834
11012
|
const hasBalance = ((_b = p.transactions) != null ? _b : []).some((tx) => tx.balance != null);
|
|
10835
11013
|
const totalInflows = p.transactions.filter((tx) => tx.amount > 0 && tx.status !== "reversed").reduce((sum, tx) => sum + tx.amount, 0);
|
|
10836
11014
|
const totalOutflows = p.transactions.filter((tx) => tx.amount < 0 && tx.status !== "reversed").reduce((sum, tx) => sum + tx.amount, 0);
|
|
@@ -10987,7 +11165,7 @@ function formatDate2(dateStr) {
|
|
|
10987
11165
|
}
|
|
10988
11166
|
function FileRow({ item }) {
|
|
10989
11167
|
var _a;
|
|
10990
|
-
const [hovered, setHovered] =
|
|
11168
|
+
const [hovered, setHovered] = React45.useState(false);
|
|
10991
11169
|
const cfg = getDocConfig(item.docType);
|
|
10992
11170
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10993
11171
|
"div",
|
|
@@ -11063,8 +11241,8 @@ function FileRow({ item }) {
|
|
|
11063
11241
|
);
|
|
11064
11242
|
}
|
|
11065
11243
|
function GroupSection({ groupName, items }) {
|
|
11066
|
-
const [open, setOpen] =
|
|
11067
|
-
const [headerHovered, setHeaderHovered] =
|
|
11244
|
+
const [open, setOpen] = React45.useState(true);
|
|
11245
|
+
const [headerHovered, setHeaderHovered] = React45.useState(false);
|
|
11068
11246
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11069
11247
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11070
11248
|
"button",
|
|
@@ -11250,15 +11428,15 @@ function isExpirySoon(expiresAt) {
|
|
|
11250
11428
|
|
|
11251
11429
|
// src/shared/viewers/PreviewHost.tsx
|
|
11252
11430
|
init_ThemeContext();
|
|
11253
|
-
var PdfViewer3 =
|
|
11431
|
+
var PdfViewer3 = React45.lazy(
|
|
11254
11432
|
() => Promise.resolve().then(() => (init_PdfViewer(), PdfViewer_exports)).then((m) => ({ default: m.PdfViewer }))
|
|
11255
11433
|
);
|
|
11256
|
-
var ExcelViewer3 =
|
|
11434
|
+
var ExcelViewer3 = React45.lazy(
|
|
11257
11435
|
() => Promise.resolve().then(() => (init_ExcelViewer(), ExcelViewer_exports)).then((m) => ({ default: m.ExcelViewer }))
|
|
11258
11436
|
);
|
|
11259
|
-
var CsvViewer2 =
|
|
11260
|
-
var TextViewer2 =
|
|
11261
|
-
var DocxViewer2 =
|
|
11437
|
+
var CsvViewer2 = React45.lazy(() => Promise.resolve().then(() => (init_CsvViewer(), CsvViewer_exports)).then((m) => ({ default: m.CsvViewer })));
|
|
11438
|
+
var TextViewer2 = React45.lazy(() => Promise.resolve().then(() => (init_TextViewer(), TextViewer_exports)).then((m) => ({ default: m.TextViewer })));
|
|
11439
|
+
var DocxViewer2 = React45.lazy(() => Promise.resolve().then(() => (init_DocxViewer(), DocxViewer_exports)).then((m) => ({ default: m.DocxViewer })));
|
|
11262
11440
|
var PEEK_ROWS = 20;
|
|
11263
11441
|
var PEEK_LINES = 40;
|
|
11264
11442
|
function PreviewHost({ kind, source, mode = "full" }) {
|
|
@@ -11288,7 +11466,7 @@ function PreviewHost({ kind, source, mode = "full" }) {
|
|
|
11288
11466
|
default:
|
|
11289
11467
|
return null;
|
|
11290
11468
|
}
|
|
11291
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11469
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React45.Suspense, { fallback, children: viewer });
|
|
11292
11470
|
}
|
|
11293
11471
|
|
|
11294
11472
|
// src/shared/PreviewModal.tsx
|
|
@@ -11304,7 +11482,7 @@ function PreviewModal({
|
|
|
11304
11482
|
onDownload
|
|
11305
11483
|
}) {
|
|
11306
11484
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
11307
|
-
|
|
11485
|
+
React45.useEffect(() => {
|
|
11308
11486
|
if (!open) return;
|
|
11309
11487
|
const onKey = (e) => {
|
|
11310
11488
|
if (e.key === "Escape") onClose();
|
|
@@ -11477,17 +11655,17 @@ function FileCard({
|
|
|
11477
11655
|
previewDisabled = false
|
|
11478
11656
|
}) {
|
|
11479
11657
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2 } = useTheme();
|
|
11480
|
-
const [cardHover, setCardHover] =
|
|
11481
|
-
const [btnHover, setBtnHover] =
|
|
11482
|
-
const [pvHover, setPvHover] =
|
|
11658
|
+
const [cardHover, setCardHover] = React45.useState(false);
|
|
11659
|
+
const [btnHover, setBtnHover] = React45.useState(false);
|
|
11660
|
+
const [pvHover, setPvHover] = React45.useState(false);
|
|
11483
11661
|
const previewKind = previewKindFor(fileType, filename);
|
|
11484
11662
|
const canPreview = !previewDisabled && previewKind !== null && (!!previewUrl || !!fetchPreviewBlob);
|
|
11485
|
-
const [peekOpen, setPeekOpen] =
|
|
11486
|
-
const [modalOpen, setModalOpen] =
|
|
11487
|
-
const [source, setSource] =
|
|
11488
|
-
const [pvLoading, setPvLoading] =
|
|
11489
|
-
const [pvError, setPvError] =
|
|
11490
|
-
const ensureSource =
|
|
11663
|
+
const [peekOpen, setPeekOpen] = React45.useState(false);
|
|
11664
|
+
const [modalOpen, setModalOpen] = React45.useState(false);
|
|
11665
|
+
const [source, setSource] = React45.useState(previewUrl ? { url: previewUrl } : null);
|
|
11666
|
+
const [pvLoading, setPvLoading] = React45.useState(false);
|
|
11667
|
+
const [pvError, setPvError] = React45.useState(null);
|
|
11668
|
+
const ensureSource = React45.useCallback(async () => {
|
|
11491
11669
|
if (source) return source;
|
|
11492
11670
|
if (previewUrl) {
|
|
11493
11671
|
const s = { url: previewUrl };
|
|
@@ -11509,7 +11687,7 @@ function FileCard({
|
|
|
11509
11687
|
setPvLoading(false);
|
|
11510
11688
|
}
|
|
11511
11689
|
}, [source, previewUrl, fetchPreviewBlob]);
|
|
11512
|
-
const togglePeek =
|
|
11690
|
+
const togglePeek = React45.useCallback(async () => {
|
|
11513
11691
|
if (peekOpen) {
|
|
11514
11692
|
setPeekOpen(false);
|
|
11515
11693
|
return;
|
|
@@ -11517,7 +11695,7 @@ function FileCard({
|
|
|
11517
11695
|
setPeekOpen(true);
|
|
11518
11696
|
await ensureSource();
|
|
11519
11697
|
}, [peekOpen, ensureSource]);
|
|
11520
|
-
const openModal =
|
|
11698
|
+
const openModal = React45.useCallback(async () => {
|
|
11521
11699
|
const s = await ensureSource();
|
|
11522
11700
|
if (s) setModalOpen(true);
|
|
11523
11701
|
}, [ensureSource]);
|
|
@@ -11632,7 +11810,7 @@ function FileCard({
|
|
|
11632
11810
|
whiteSpace: "nowrap"
|
|
11633
11811
|
},
|
|
11634
11812
|
children: [
|
|
11635
|
-
metaTokens.map((t, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11813
|
+
metaTokens.map((t, i) => /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
11636
11814
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#c4c4c4" }, children: "\xB7" }),
|
|
11637
11815
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t })
|
|
11638
11816
|
] }, i)),
|
|
@@ -11976,7 +12154,7 @@ function ServiceCard({ item, isHovered, onHover, onLeave: onLeave2 }) {
|
|
|
11976
12154
|
function OpsDashboardResolver(p) {
|
|
11977
12155
|
var _a, _b, _c;
|
|
11978
12156
|
const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
|
|
11979
|
-
const [hoveredId, setHoveredId] =
|
|
12157
|
+
const [hoveredId, setHoveredId] = React45.useState(null);
|
|
11980
12158
|
const hasRunning = ((_a = p.items) != null ? _a : []).some((item) => item.state === "running");
|
|
11981
12159
|
return /* @__PURE__ */ jsxRuntime.jsxs(ComponentActions, { filename: (_b = p.title) != null ? _b : "ops-dashboard", children: [
|
|
11982
12160
|
hasRunning && /* @__PURE__ */ jsxRuntime.jsx("style", { children: PULSE_KEYFRAMES }),
|
|
@@ -12029,8 +12207,8 @@ function formatDate3(value) {
|
|
|
12029
12207
|
}
|
|
12030
12208
|
}
|
|
12031
12209
|
function CopyButton({ value, rowHovered }) {
|
|
12032
|
-
const [copied, setCopied] =
|
|
12033
|
-
const [btnHovered, setBtnHovered] =
|
|
12210
|
+
const [copied, setCopied] = React45.useState(false);
|
|
12211
|
+
const [btnHovered, setBtnHovered] = React45.useState(false);
|
|
12034
12212
|
const handleCopy = () => {
|
|
12035
12213
|
navigator.clipboard.writeText(value).then(() => {
|
|
12036
12214
|
setCopied(true);
|
|
@@ -12122,7 +12300,7 @@ function ValueCell({ item }) {
|
|
|
12122
12300
|
}
|
|
12123
12301
|
}
|
|
12124
12302
|
function KVRow({ item, isLast, index }) {
|
|
12125
|
-
const [hovered, setHovered] =
|
|
12303
|
+
const [hovered, setHovered] = React45.useState(false);
|
|
12126
12304
|
const altBg = index % 2 === 1 ? "#fcfcfc" : "white";
|
|
12127
12305
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12128
12306
|
"div",
|
|
@@ -12207,7 +12385,7 @@ function KeyValueListResolver(p) {
|
|
|
12207
12385
|
var _a3;
|
|
12208
12386
|
return sum + ((_a3 = g.items) != null ? _a3 : []).length;
|
|
12209
12387
|
}, 0);
|
|
12210
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12388
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12211
12389
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12212
12390
|
"div",
|
|
12213
12391
|
{
|
|
@@ -12385,7 +12563,7 @@ function BalanceSheetResolver(p) {
|
|
|
12385
12563
|
/* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
|
|
12386
12564
|
((_p = p.sections) != null ? _p : []).map((section) => {
|
|
12387
12565
|
var _a2;
|
|
12388
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12566
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12389
12567
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, style: {
|
|
12390
12568
|
padding: "8px 12px",
|
|
12391
12569
|
fontSize: "12px",
|
|
@@ -12398,7 +12576,7 @@ function BalanceSheetResolver(p) {
|
|
|
12398
12576
|
}, children: (_a2 = categoryLabels2[section.category]) != null ? _a2 : section.category }) }),
|
|
12399
12577
|
section.subsections.map((sub, si) => {
|
|
12400
12578
|
var _a3;
|
|
12401
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12579
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12402
12580
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, style: {
|
|
12403
12581
|
padding: "6px 10px 6px 24px",
|
|
12404
12582
|
fontSize: "12px",
|
|
@@ -12574,7 +12752,7 @@ function IncomeStatementResolver(p) {
|
|
|
12574
12752
|
textAlign: "left",
|
|
12575
12753
|
whiteSpace: "nowrap"
|
|
12576
12754
|
}, children: "\xA0" }),
|
|
12577
|
-
periods.map((period) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12755
|
+
periods.map((period) => /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12578
12756
|
/* @__PURE__ */ jsxRuntime.jsx("th", { style: {
|
|
12579
12757
|
fontSize: "11px",
|
|
12580
12758
|
fontWeight: 500,
|
|
@@ -12605,7 +12783,7 @@ function IncomeStatementResolver(p) {
|
|
|
12605
12783
|
sections.map((section, si) => {
|
|
12606
12784
|
var _a2;
|
|
12607
12785
|
const isSubtotal = section.sectionType === "subtotal";
|
|
12608
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12786
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12609
12787
|
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: colCount, style: {
|
|
12610
12788
|
padding: "8px 12px",
|
|
12611
12789
|
fontSize: "12px",
|
|
@@ -12636,7 +12814,7 @@ function IncomeStatementResolver(p) {
|
|
|
12636
12814
|
var _a4;
|
|
12637
12815
|
const val = (_a4 = amounts[pi]) != null ? _a4 : 0;
|
|
12638
12816
|
const isNeg = val < 0;
|
|
12639
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12817
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12640
12818
|
/* @__PURE__ */ jsxRuntime.jsx("td", { style: {
|
|
12641
12819
|
padding: "6px 10px",
|
|
12642
12820
|
fontSize: "13px",
|
|
@@ -12671,7 +12849,7 @@ function IncomeStatementResolver(p) {
|
|
|
12671
12849
|
var _a2;
|
|
12672
12850
|
const val = (_a2 = grossProfit[pi]) != null ? _a2 : 0;
|
|
12673
12851
|
const isNeg = val < 0;
|
|
12674
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12852
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12675
12853
|
/* @__PURE__ */ jsxRuntime.jsx("td", { style: {
|
|
12676
12854
|
padding: "8px 10px",
|
|
12677
12855
|
fontSize: "12px",
|
|
@@ -12706,7 +12884,7 @@ function IncomeStatementResolver(p) {
|
|
|
12706
12884
|
var _a2;
|
|
12707
12885
|
const val = (_a2 = operatingIncome[pi]) != null ? _a2 : 0;
|
|
12708
12886
|
const isNeg = val < 0;
|
|
12709
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12887
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12710
12888
|
/* @__PURE__ */ jsxRuntime.jsx("td", { style: {
|
|
12711
12889
|
padding: "8px 10px",
|
|
12712
12890
|
fontSize: "12px",
|
|
@@ -12740,7 +12918,7 @@ function IncomeStatementResolver(p) {
|
|
|
12740
12918
|
var _a2;
|
|
12741
12919
|
const val = (_a2 = netIncome[pi]) != null ? _a2 : 0;
|
|
12742
12920
|
const isNeg = val < 0;
|
|
12743
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12921
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12744
12922
|
/* @__PURE__ */ jsxRuntime.jsx("td", { style: {
|
|
12745
12923
|
padding: "10px 10px",
|
|
12746
12924
|
fontSize: "13px",
|
|
@@ -12960,7 +13138,7 @@ function CashFlowStatementResolver(p) {
|
|
|
12960
13138
|
/* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
|
|
12961
13139
|
activities.map((activity, ai) => {
|
|
12962
13140
|
var _a2, _b2, _c2;
|
|
12963
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13141
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
12964
13142
|
ai > 0 && /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12965
13143
|
"td",
|
|
12966
13144
|
{
|
|
@@ -15373,8 +15551,8 @@ var PRIORITY_STYLES = {
|
|
|
15373
15551
|
function EscalationCardResolver(p) {
|
|
15374
15552
|
var _a, _b, _c, _d;
|
|
15375
15553
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
15376
|
-
const [cardHovered, setCardHovered] =
|
|
15377
|
-
const [btnHovered, setBtnHovered] =
|
|
15554
|
+
const [cardHovered, setCardHovered] = React45.useState(false);
|
|
15555
|
+
const [btnHovered, setBtnHovered] = React45.useState(false);
|
|
15378
15556
|
const priorityStyle = p.priority ? PRIORITY_STYLES[p.priority] : null;
|
|
15379
15557
|
const railColor = (_a = priorityStyle == null ? void 0 : priorityStyle.color) != null ? _a : ACCENT2;
|
|
15380
15558
|
const iconBg = (_b = priorityStyle == null ? void 0 : priorityStyle.bg) != null ? _b : "#fff2ec";
|
|
@@ -16221,9 +16399,9 @@ var CONNECTED_GREEN = "#15803d";
|
|
|
16221
16399
|
function ConnectIntegrationResolver(p) {
|
|
16222
16400
|
var _a;
|
|
16223
16401
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
16224
|
-
const [cardHovered, setCardHovered] =
|
|
16225
|
-
const [btnHovered, setBtnHovered] =
|
|
16226
|
-
const [imgFailed, setImgFailed] =
|
|
16402
|
+
const [cardHovered, setCardHovered] = React45.useState(false);
|
|
16403
|
+
const [btnHovered, setBtnHovered] = React45.useState(false);
|
|
16404
|
+
const [imgFailed, setImgFailed] = React45.useState(false);
|
|
16227
16405
|
const name = (p.integrationName || "Integration").trim();
|
|
16228
16406
|
const initial = name.charAt(0).toUpperCase();
|
|
16229
16407
|
const iconSrc = p.iconUrl || brandIconUrl(name);
|
|
@@ -16385,9 +16563,9 @@ function IntegrationsListResolver(p) {
|
|
|
16385
16563
|
var _a, _b;
|
|
16386
16564
|
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
16387
16565
|
const integrations = Array.isArray(p.integrations) ? p.integrations : [];
|
|
16388
|
-
const [rowHover, setRowHover] =
|
|
16389
|
-
const [btnHover, setBtnHover] =
|
|
16390
|
-
const [failed, setFailed] =
|
|
16566
|
+
const [rowHover, setRowHover] = React45.useState(null);
|
|
16567
|
+
const [btnHover, setBtnHover] = React45.useState(null);
|
|
16568
|
+
const [failed, setFailed] = React45.useState({});
|
|
16391
16569
|
const connectedCount = integrations.filter((i) => i.status === "connected").length;
|
|
16392
16570
|
return /* @__PURE__ */ jsxRuntime.jsx(ComponentActions, { filename: (_a = p.title) != null ? _a : "integrations", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { width: "100%", display: "flex", flexDirection: "column", gap: "11px" }, children: [
|
|
16393
16571
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [
|
|
@@ -16870,13 +17048,13 @@ var ellipsis = {
|
|
|
16870
17048
|
function PipelinePreviewResolver(p) {
|
|
16871
17049
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
16872
17050
|
const { MUTED: MUTED2, PAPER: PAPER2, BORDER: BORDER4, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
16873
|
-
const [btnHovered, setBtnHovered] =
|
|
17051
|
+
const [btnHovered, setBtnHovered] = React45.useState(false);
|
|
16874
17052
|
const stateCfg = STATE_CONFIG[(_a = p.state) != null ? _a : "draft"];
|
|
16875
17053
|
const destinations = (_b = p.destinations) != null ? _b : [];
|
|
16876
17054
|
const steps = (_c = p.steps) != null ? _c : [];
|
|
16877
17055
|
const workstreams = (_d = p.workstreams) != null ? _d : [];
|
|
16878
17056
|
const scheduleLabel = p.schedule ? p.schedule.type === "manual" ? "Manual" : (_f = (_e = p.schedule.label) != null ? _e : p.schedule.cron) != null ? _f : "Scheduled" : null;
|
|
16879
|
-
const { nodes, edges, viewBox, vbW, vbH } =
|
|
17057
|
+
const { nodes, edges, viewBox, vbW, vbH } = React45.useMemo(() => {
|
|
16880
17058
|
const res = layoutGraph(steps);
|
|
16881
17059
|
const b = layoutBounds(res.nodes);
|
|
16882
17060
|
const pad = 24;
|
|
@@ -16890,7 +17068,7 @@ function PipelinePreviewResolver(p) {
|
|
|
16890
17068
|
vbH: h
|
|
16891
17069
|
};
|
|
16892
17070
|
}, [steps]);
|
|
16893
|
-
const nodeMap =
|
|
17071
|
+
const nodeMap = React45.useMemo(() => {
|
|
16894
17072
|
const m = {};
|
|
16895
17073
|
nodes.forEach((n) => m[n.id] = n);
|
|
16896
17074
|
return m;
|
|
@@ -17266,9 +17444,9 @@ var DEFAULT_INTERACTION = {
|
|
|
17266
17444
|
onDecisionResolve: void 0,
|
|
17267
17445
|
onDecisionSource: void 0
|
|
17268
17446
|
};
|
|
17269
|
-
var GenUIInteractionContext =
|
|
17447
|
+
var GenUIInteractionContext = React45.createContext(DEFAULT_INTERACTION);
|
|
17270
17448
|
function useGenUIInteraction() {
|
|
17271
|
-
return
|
|
17449
|
+
return React45.useContext(GenUIInteractionContext);
|
|
17272
17450
|
}
|
|
17273
17451
|
var STATUS_COLORS3 = {
|
|
17274
17452
|
done: "#15803d",
|
|
@@ -17397,8 +17575,8 @@ var CARD_MIN = 132;
|
|
|
17397
17575
|
var CARD_GAP = 16;
|
|
17398
17576
|
var AUTO_COMPACT_BELOW = 360;
|
|
17399
17577
|
function useContainerWidth(ref) {
|
|
17400
|
-
const [w, setW] =
|
|
17401
|
-
|
|
17578
|
+
const [w, setW] = React45__default.default.useState(0);
|
|
17579
|
+
React45__default.default.useLayoutEffect(() => {
|
|
17402
17580
|
const el = ref.current;
|
|
17403
17581
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
17404
17582
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -17499,15 +17677,15 @@ function WorkflowStepperRenderer({
|
|
|
17499
17677
|
const interactive = typeof onSelectStep === "function";
|
|
17500
17678
|
const statusColor3 = (s) => s === "active" ? ACCENT2 : STATUS_COLORS3[s];
|
|
17501
17679
|
const doneCount = steps.filter((s) => s.status === "done").length;
|
|
17502
|
-
const rootRef =
|
|
17680
|
+
const rootRef = React45__default.default.useRef(null);
|
|
17503
17681
|
const containerW = useContainerWidth(rootRef);
|
|
17504
17682
|
let resolved = density === "auto" ? "full" : density;
|
|
17505
17683
|
if (density === "auto" && containerW > 0) {
|
|
17506
17684
|
const needed = steps.length * CARD_MIN + Math.max(0, steps.length - 1) * CARD_GAP;
|
|
17507
17685
|
resolved = containerW < AUTO_COMPACT_BELOW || needed > containerW * 1.6 ? "compact" : "full";
|
|
17508
17686
|
}
|
|
17509
|
-
const scrollerRef =
|
|
17510
|
-
|
|
17687
|
+
const scrollerRef = React45__default.default.useRef(null);
|
|
17688
|
+
React45__default.default.useEffect(() => {
|
|
17511
17689
|
if (resolved !== "full" || loading) return;
|
|
17512
17690
|
const sc = scrollerRef.current;
|
|
17513
17691
|
if (!sc) return;
|
|
@@ -17518,11 +17696,11 @@ function WorkflowStepperRenderer({
|
|
|
17518
17696
|
el.scrollIntoView({ inline: "center", block: "nearest", behavior: "smooth" });
|
|
17519
17697
|
}
|
|
17520
17698
|
}, [resolved, loading, selectedStep, activeStepId]);
|
|
17521
|
-
const [edges, setEdges] =
|
|
17699
|
+
const [edges, setEdges] = React45__default.default.useState({
|
|
17522
17700
|
left: false,
|
|
17523
17701
|
right: false
|
|
17524
17702
|
});
|
|
17525
|
-
const updateEdges =
|
|
17703
|
+
const updateEdges = React45__default.default.useCallback(() => {
|
|
17526
17704
|
const sc = scrollerRef.current;
|
|
17527
17705
|
if (!sc) return;
|
|
17528
17706
|
const max = sc.scrollWidth - sc.clientWidth;
|
|
@@ -17531,7 +17709,7 @@ function WorkflowStepperRenderer({
|
|
|
17531
17709
|
const right = sl < max - 1;
|
|
17532
17710
|
setEdges((prev) => prev.left === left && prev.right === right ? prev : { left, right });
|
|
17533
17711
|
}, []);
|
|
17534
|
-
|
|
17712
|
+
React45__default.default.useLayoutEffect(() => {
|
|
17535
17713
|
if (resolved !== "full" || loading) return;
|
|
17536
17714
|
updateEdges();
|
|
17537
17715
|
const sc = scrollerRef.current;
|
|
@@ -17587,7 +17765,7 @@ function WorkflowStepperRenderer({
|
|
|
17587
17765
|
const reached = s.status !== "pending";
|
|
17588
17766
|
const clickable = interactive && reached;
|
|
17589
17767
|
const size = act ? 11 : done ? 9 : 8;
|
|
17590
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17768
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
17591
17769
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17592
17770
|
"span",
|
|
17593
17771
|
{
|
|
@@ -17730,7 +17908,7 @@ function WorkflowStepperRenderer({
|
|
|
17730
17908
|
const color = statusColor3(step.status);
|
|
17731
17909
|
const humans = ((_a2 = step.assignees) != null ? _a2 : []).filter((a) => a.kind === "human");
|
|
17732
17910
|
const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
|
|
17733
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17911
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
17734
17912
|
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17735
17913
|
"div",
|
|
17736
17914
|
{
|
|
@@ -17984,6 +18162,1562 @@ function WorkflowStepperResolver(p) {
|
|
|
17984
18162
|
] }) });
|
|
17985
18163
|
}
|
|
17986
18164
|
init_ThemeContext();
|
|
18165
|
+
|
|
18166
|
+
// src/composites/document-field-extraction/bboxTransform.ts
|
|
18167
|
+
function bboxToRect(bbox2, page, px) {
|
|
18168
|
+
if (!bbox2 || bbox2.length !== 4) return null;
|
|
18169
|
+
const { wPts, hPts } = page;
|
|
18170
|
+
const { wPx, hPx } = px;
|
|
18171
|
+
if (!wPts || !hPts || !wPx || !hPx) return null;
|
|
18172
|
+
const [x0, y0, x1, y1] = bbox2;
|
|
18173
|
+
const sx = wPx / wPts;
|
|
18174
|
+
const sy = hPx / hPts;
|
|
18175
|
+
return {
|
|
18176
|
+
left: x0 * sx,
|
|
18177
|
+
width: (x1 - x0) * sx,
|
|
18178
|
+
// Flip Y: the box's TOP in screen space is the page height minus its upper
|
|
18179
|
+
// PDF-point edge (y1), because PDF y grows upward from the bottom.
|
|
18180
|
+
top: (hPts - y1) * sy,
|
|
18181
|
+
height: (y1 - y0) * sy
|
|
18182
|
+
};
|
|
18183
|
+
}
|
|
18184
|
+
|
|
18185
|
+
// src/composites/document-field-extraction/FieldDetail.tsx
|
|
18186
|
+
init_ThemeContext();
|
|
18187
|
+
|
|
18188
|
+
// src/composites/document-field-extraction/fieldLabels.ts
|
|
18189
|
+
var LABEL_DISPLAY = {
|
|
18190
|
+
"employer identification number": "Employer ID (EIN)",
|
|
18191
|
+
"company or business name": "Company Name",
|
|
18192
|
+
"total revenue": "Total Revenue",
|
|
18193
|
+
"net income": "Net Income",
|
|
18194
|
+
"tax year": "Tax Year",
|
|
18195
|
+
"invoice number": "Invoice Number",
|
|
18196
|
+
"invoice date": "Invoice Date",
|
|
18197
|
+
"total amount due": "Total Amount Due",
|
|
18198
|
+
"vendor name": "Vendor Name",
|
|
18199
|
+
"receipt total": "Receipt Total",
|
|
18200
|
+
"transaction date": "Transaction Date",
|
|
18201
|
+
"merchant name": "Merchant Name"
|
|
18202
|
+
};
|
|
18203
|
+
function prettyLabel(label) {
|
|
18204
|
+
var _a;
|
|
18205
|
+
return (_a = LABEL_DISPLAY[label]) != null ? _a : label.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
18206
|
+
}
|
|
18207
|
+
var TIER_COLORS = {
|
|
18208
|
+
green: "#15803d",
|
|
18209
|
+
amber: "#f59e0b",
|
|
18210
|
+
red: "#dc2626"
|
|
18211
|
+
};
|
|
18212
|
+
var BADGE_TITLE = {
|
|
18213
|
+
SC: "High confidence",
|
|
18214
|
+
CN: "Medium confidence",
|
|
18215
|
+
AB: "Low confidence",
|
|
18216
|
+
SW: "Very low confidence"
|
|
18217
|
+
};
|
|
18218
|
+
var BADGE_STYLE = {
|
|
18219
|
+
SC: { bg: "#dcfce7", fg: "#15803d" },
|
|
18220
|
+
CN: { bg: "#eff6ff", fg: "#0364ff" },
|
|
18221
|
+
AB: { bg: "#fff7ed", fg: "#92400e" },
|
|
18222
|
+
SW: { bg: "#fef2f2", fg: "#dc2626" }
|
|
18223
|
+
};
|
|
18224
|
+
var STATE_DOT = {
|
|
18225
|
+
ok: "#15803d",
|
|
18226
|
+
corrected: "#0364ff",
|
|
18227
|
+
missing: "#dc2626",
|
|
18228
|
+
warn: "#f59e0b"
|
|
18229
|
+
};
|
|
18230
|
+
function hexToRgba(hex, alpha) {
|
|
18231
|
+
const h = hex.replace("#", "");
|
|
18232
|
+
const r = parseInt(h.slice(0, 2), 16);
|
|
18233
|
+
const g = parseInt(h.slice(2, 4), 16);
|
|
18234
|
+
const b = parseInt(h.slice(4, 6), 16);
|
|
18235
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
18236
|
+
}
|
|
18237
|
+
function badgeStyle(f) {
|
|
18238
|
+
var _a, _b;
|
|
18239
|
+
return (_b = BADGE_STYLE[(_a = f.badge) != null ? _a : ""]) != null ? _b : { bg: "#f6f6f6", fg: "#777777" };
|
|
18240
|
+
}
|
|
18241
|
+
function dotColor2(f) {
|
|
18242
|
+
var _a, _b;
|
|
18243
|
+
return (_b = STATE_DOT[(_a = f.state) != null ? _a : "ok"]) != null ? _b : "#15803d";
|
|
18244
|
+
}
|
|
18245
|
+
function fieldColor(f, secondary) {
|
|
18246
|
+
var _a, _b;
|
|
18247
|
+
if (f.state === "corrected") return secondary;
|
|
18248
|
+
return (_b = TIER_COLORS[(_a = f.confidence_tier) != null ? _a : "amber"]) != null ? _b : TIER_COLORS.amber;
|
|
18249
|
+
}
|
|
18250
|
+
function confidenceLabel(f) {
|
|
18251
|
+
var _a;
|
|
18252
|
+
if (typeof f.confidence === "number" && !Number.isNaN(f.confidence)) {
|
|
18253
|
+
return `${Math.round(f.confidence * 100)}%`;
|
|
18254
|
+
}
|
|
18255
|
+
return (_a = f.badge) != null ? _a : "\u2014";
|
|
18256
|
+
}
|
|
18257
|
+
function FieldDetail({
|
|
18258
|
+
field,
|
|
18259
|
+
selected,
|
|
18260
|
+
onSelect,
|
|
18261
|
+
onSave,
|
|
18262
|
+
correctionCount = 0,
|
|
18263
|
+
cardRef
|
|
18264
|
+
}) {
|
|
18265
|
+
var _a, _b, _c, _d;
|
|
18266
|
+
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
18267
|
+
const [editing, setEditing] = React45__default.default.useState(false);
|
|
18268
|
+
const [draft, setDraft] = React45__default.default.useState("");
|
|
18269
|
+
const [saving, setSaving] = React45__default.default.useState(false);
|
|
18270
|
+
const [saveError, setSaveError] = React45__default.default.useState(null);
|
|
18271
|
+
const textareaRef = React45__default.default.useRef(null);
|
|
18272
|
+
const color = fieldColor(field, SECONDARY2);
|
|
18273
|
+
const corrected = field.state === "corrected";
|
|
18274
|
+
const startEdit = (e) => {
|
|
18275
|
+
e.stopPropagation();
|
|
18276
|
+
setDraft(field.value || "");
|
|
18277
|
+
setSaveError(null);
|
|
18278
|
+
setEditing(true);
|
|
18279
|
+
setTimeout(() => {
|
|
18280
|
+
var _a2, _b2;
|
|
18281
|
+
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
18282
|
+
(_b2 = textareaRef.current) == null ? void 0 : _b2.select();
|
|
18283
|
+
}, 0);
|
|
18284
|
+
};
|
|
18285
|
+
const cancelEdit = (e) => {
|
|
18286
|
+
e.stopPropagation();
|
|
18287
|
+
setEditing(false);
|
|
18288
|
+
setSaveError(null);
|
|
18289
|
+
};
|
|
18290
|
+
const save = async (e) => {
|
|
18291
|
+
var _a2, _b2;
|
|
18292
|
+
e.stopPropagation();
|
|
18293
|
+
if (!onSave || draft === field.value) {
|
|
18294
|
+
setEditing(false);
|
|
18295
|
+
return;
|
|
18296
|
+
}
|
|
18297
|
+
setSaving(true);
|
|
18298
|
+
setSaveError(null);
|
|
18299
|
+
try {
|
|
18300
|
+
await onSave(field.field_key, draft);
|
|
18301
|
+
setEditing(false);
|
|
18302
|
+
} catch (err) {
|
|
18303
|
+
const msg = ((_b2 = (_a2 = err == null ? void 0 : err.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.detail) || "Save failed. Try again.";
|
|
18304
|
+
setSaveError(msg);
|
|
18305
|
+
} finally {
|
|
18306
|
+
setSaving(false);
|
|
18307
|
+
}
|
|
18308
|
+
};
|
|
18309
|
+
const handleKeyDown = (e) => {
|
|
18310
|
+
if (e.key === "Escape") cancelEdit(e);
|
|
18311
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void save(e);
|
|
18312
|
+
};
|
|
18313
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18314
|
+
"div",
|
|
18315
|
+
{
|
|
18316
|
+
ref: cardRef,
|
|
18317
|
+
"data-testid": "field-card",
|
|
18318
|
+
"data-field-key": field.field_key,
|
|
18319
|
+
"data-selected": selected ? "true" : "false",
|
|
18320
|
+
role: "button",
|
|
18321
|
+
tabIndex: 0,
|
|
18322
|
+
onClick: () => !editing && onSelect(selected ? null : field.field_key),
|
|
18323
|
+
onKeyDown: (e) => {
|
|
18324
|
+
if (!editing && e.key === "Enter") onSelect(selected ? null : field.field_key);
|
|
18325
|
+
},
|
|
18326
|
+
style: {
|
|
18327
|
+
display: "flex",
|
|
18328
|
+
flexDirection: "column",
|
|
18329
|
+
gap: "4px",
|
|
18330
|
+
padding: "8px 10px",
|
|
18331
|
+
borderRadius: "0.5rem",
|
|
18332
|
+
border: `1px solid ${selected ? color : BORDER4}`,
|
|
18333
|
+
background: selected ? hexToRgba(color, 0.06) : "white",
|
|
18334
|
+
cursor: editing ? "default" : "pointer",
|
|
18335
|
+
transition: "background 0.15s, border-color 0.15s"
|
|
18336
|
+
},
|
|
18337
|
+
children: [
|
|
18338
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", minWidth: 0 }, children: [
|
|
18339
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18340
|
+
"span",
|
|
18341
|
+
{
|
|
18342
|
+
title: (_c = (_b = BADGE_TITLE[(_a = field.badge) != null ? _a : ""]) != null ? _b : field.badge) != null ? _c : "",
|
|
18343
|
+
style: {
|
|
18344
|
+
fontSize: "10px",
|
|
18345
|
+
fontWeight: 700,
|
|
18346
|
+
padding: "2px 6px",
|
|
18347
|
+
borderRadius: "4px",
|
|
18348
|
+
flexShrink: 0,
|
|
18349
|
+
letterSpacing: "0.02em",
|
|
18350
|
+
minWidth: "34px",
|
|
18351
|
+
textAlign: "center",
|
|
18352
|
+
fontVariantNumeric: "tabular-nums",
|
|
18353
|
+
background: badgeStyle(field).bg,
|
|
18354
|
+
color: badgeStyle(field).fg
|
|
18355
|
+
},
|
|
18356
|
+
children: confidenceLabel(field)
|
|
18357
|
+
}
|
|
18358
|
+
),
|
|
18359
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18360
|
+
"span",
|
|
18361
|
+
{
|
|
18362
|
+
title: prettyLabel(field.label),
|
|
18363
|
+
style: {
|
|
18364
|
+
fontSize: "12.5px",
|
|
18365
|
+
fontWeight: 600,
|
|
18366
|
+
color: "var(--foreground)",
|
|
18367
|
+
flex: 1,
|
|
18368
|
+
minWidth: 0,
|
|
18369
|
+
whiteSpace: "nowrap",
|
|
18370
|
+
overflow: "hidden",
|
|
18371
|
+
textOverflow: "ellipsis"
|
|
18372
|
+
},
|
|
18373
|
+
children: prettyLabel(field.label)
|
|
18374
|
+
}
|
|
18375
|
+
),
|
|
18376
|
+
field.is_primary && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18377
|
+
"span",
|
|
18378
|
+
{
|
|
18379
|
+
style: {
|
|
18380
|
+
fontSize: "9px",
|
|
18381
|
+
fontWeight: 600,
|
|
18382
|
+
textTransform: "uppercase",
|
|
18383
|
+
letterSpacing: "0.04em",
|
|
18384
|
+
color: MUTED2,
|
|
18385
|
+
flexShrink: 0
|
|
18386
|
+
},
|
|
18387
|
+
children: "Primary"
|
|
18388
|
+
}
|
|
18389
|
+
),
|
|
18390
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "11px", color: MUTED2, flexShrink: 0 }, children: [
|
|
18391
|
+
"p.",
|
|
18392
|
+
field.page + 1
|
|
18393
|
+
] }),
|
|
18394
|
+
!editing && onSave && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18395
|
+
"button",
|
|
18396
|
+
{
|
|
18397
|
+
type: "button",
|
|
18398
|
+
onClick: startEdit,
|
|
18399
|
+
title: "Edit value",
|
|
18400
|
+
"aria-label": "Edit value",
|
|
18401
|
+
style: {
|
|
18402
|
+
border: `1px solid ${BORDER4}`,
|
|
18403
|
+
borderRadius: "6px",
|
|
18404
|
+
background: "white",
|
|
18405
|
+
cursor: "pointer",
|
|
18406
|
+
padding: "3px 5px",
|
|
18407
|
+
lineHeight: 1,
|
|
18408
|
+
flexShrink: 0,
|
|
18409
|
+
display: "inline-flex",
|
|
18410
|
+
alignItems: "center",
|
|
18411
|
+
justifyContent: "center"
|
|
18412
|
+
},
|
|
18413
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: MUTED2, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
18414
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
|
|
18415
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
|
|
18416
|
+
] })
|
|
18417
|
+
}
|
|
18418
|
+
)
|
|
18419
|
+
] }),
|
|
18420
|
+
editing ? /* @__PURE__ */ jsxRuntime.jsxs("div", { onClick: (e) => e.stopPropagation(), style: { display: "flex", flexDirection: "column", gap: "5px" }, children: [
|
|
18421
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18422
|
+
"textarea",
|
|
18423
|
+
{
|
|
18424
|
+
ref: textareaRef,
|
|
18425
|
+
value: draft,
|
|
18426
|
+
onChange: (e) => setDraft(e.target.value),
|
|
18427
|
+
onKeyDown: handleKeyDown,
|
|
18428
|
+
rows: 3,
|
|
18429
|
+
placeholder: "Enter value\u2026",
|
|
18430
|
+
style: {
|
|
18431
|
+
width: "100%",
|
|
18432
|
+
boxSizing: "border-box",
|
|
18433
|
+
resize: "vertical",
|
|
18434
|
+
fontSize: "13px",
|
|
18435
|
+
fontFamily: "var(--font-sans)",
|
|
18436
|
+
color: "var(--foreground)",
|
|
18437
|
+
padding: "6px 8px",
|
|
18438
|
+
borderRadius: "0.4rem",
|
|
18439
|
+
border: `1px solid ${BORDER4}`
|
|
18440
|
+
}
|
|
18441
|
+
}
|
|
18442
|
+
),
|
|
18443
|
+
saveError && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: TIER_COLORS.red }, children: saveError }),
|
|
18444
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "6px" }, children: [
|
|
18445
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18446
|
+
"button",
|
|
18447
|
+
{
|
|
18448
|
+
type: "button",
|
|
18449
|
+
onClick: save,
|
|
18450
|
+
disabled: saving,
|
|
18451
|
+
title: "Save (\u2318\u21B5)",
|
|
18452
|
+
style: {
|
|
18453
|
+
display: "inline-flex",
|
|
18454
|
+
alignItems: "center",
|
|
18455
|
+
gap: "4px",
|
|
18456
|
+
fontSize: "11px",
|
|
18457
|
+
fontWeight: 600,
|
|
18458
|
+
padding: "4px 10px",
|
|
18459
|
+
borderRadius: "0.4rem",
|
|
18460
|
+
border: "none",
|
|
18461
|
+
background: "var(--foreground)",
|
|
18462
|
+
color: "white",
|
|
18463
|
+
cursor: saving ? "default" : "pointer",
|
|
18464
|
+
opacity: saving ? 0.7 : 1
|
|
18465
|
+
},
|
|
18466
|
+
children: saving ? "Saving\u2026" : "Save"
|
|
18467
|
+
}
|
|
18468
|
+
),
|
|
18469
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18470
|
+
"button",
|
|
18471
|
+
{
|
|
18472
|
+
type: "button",
|
|
18473
|
+
onClick: cancelEdit,
|
|
18474
|
+
disabled: saving,
|
|
18475
|
+
title: "Cancel (Esc)",
|
|
18476
|
+
style: {
|
|
18477
|
+
fontSize: "11px",
|
|
18478
|
+
fontWeight: 600,
|
|
18479
|
+
padding: "4px 10px",
|
|
18480
|
+
borderRadius: "0.4rem",
|
|
18481
|
+
border: `1px solid ${BORDER4}`,
|
|
18482
|
+
background: "white",
|
|
18483
|
+
color: MUTED2,
|
|
18484
|
+
cursor: saving ? "default" : "pointer"
|
|
18485
|
+
},
|
|
18486
|
+
children: "Cancel"
|
|
18487
|
+
}
|
|
18488
|
+
)
|
|
18489
|
+
] })
|
|
18490
|
+
] }) : corrected ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px", paddingLeft: "2px" }, children: [
|
|
18491
|
+
field.previous_value != null && field.previous_value !== "" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18492
|
+
"span",
|
|
18493
|
+
{
|
|
18494
|
+
style: {
|
|
18495
|
+
fontSize: "11.5px",
|
|
18496
|
+
color: MUTED2,
|
|
18497
|
+
textDecoration: "line-through",
|
|
18498
|
+
fontFamily: "ui-monospace, 'Cascadia Code', monospace",
|
|
18499
|
+
wordBreak: "break-word"
|
|
18500
|
+
},
|
|
18501
|
+
children: field.previous_value
|
|
18502
|
+
}
|
|
18503
|
+
),
|
|
18504
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18505
|
+
"span",
|
|
18506
|
+
{
|
|
18507
|
+
style: {
|
|
18508
|
+
fontSize: "12.5px",
|
|
18509
|
+
fontWeight: 600,
|
|
18510
|
+
color: "var(--foreground)",
|
|
18511
|
+
fontFamily: "ui-monospace, 'Cascadia Code', monospace",
|
|
18512
|
+
wordBreak: "break-word"
|
|
18513
|
+
},
|
|
18514
|
+
children: field.value || "\u2014"
|
|
18515
|
+
}
|
|
18516
|
+
),
|
|
18517
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
|
|
18518
|
+
field.corrected_by && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: SECONDARY2 }, title: `Corrected by ${field.corrected_by}`, children: field.corrected_by }),
|
|
18519
|
+
correctionCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18520
|
+
"span",
|
|
18521
|
+
{
|
|
18522
|
+
style: {
|
|
18523
|
+
fontSize: "10.5px",
|
|
18524
|
+
fontWeight: 600,
|
|
18525
|
+
color: MUTED2,
|
|
18526
|
+
background: PAPER2,
|
|
18527
|
+
borderRadius: "9999px",
|
|
18528
|
+
padding: "1px 7px"
|
|
18529
|
+
},
|
|
18530
|
+
children: [
|
|
18531
|
+
correctionCount,
|
|
18532
|
+
" ",
|
|
18533
|
+
correctionCount === 1 ? "event" : "events"
|
|
18534
|
+
]
|
|
18535
|
+
}
|
|
18536
|
+
)
|
|
18537
|
+
] })
|
|
18538
|
+
] }) : (
|
|
18539
|
+
// Bottom row: monospace value + right-edge validation dot (file explorer).
|
|
18540
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", paddingLeft: "2px" }, children: [
|
|
18541
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18542
|
+
"span",
|
|
18543
|
+
{
|
|
18544
|
+
style: {
|
|
18545
|
+
fontSize: "12.5px",
|
|
18546
|
+
color: MUTED2,
|
|
18547
|
+
fontFamily: "ui-monospace, 'Cascadia Code', monospace",
|
|
18548
|
+
flex: 1,
|
|
18549
|
+
minWidth: 0,
|
|
18550
|
+
whiteSpace: "nowrap",
|
|
18551
|
+
overflow: "hidden",
|
|
18552
|
+
textOverflow: "ellipsis"
|
|
18553
|
+
},
|
|
18554
|
+
title: field.value || "\u2014",
|
|
18555
|
+
children: field.value || "\u2014"
|
|
18556
|
+
}
|
|
18557
|
+
),
|
|
18558
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18559
|
+
"span",
|
|
18560
|
+
{
|
|
18561
|
+
title: (_d = field.state) != null ? _d : "ok",
|
|
18562
|
+
style: {
|
|
18563
|
+
width: "8px",
|
|
18564
|
+
height: "8px",
|
|
18565
|
+
borderRadius: "9999px",
|
|
18566
|
+
flexShrink: 0,
|
|
18567
|
+
background: dotColor2(field)
|
|
18568
|
+
}
|
|
18569
|
+
}
|
|
18570
|
+
)
|
|
18571
|
+
] })
|
|
18572
|
+
)
|
|
18573
|
+
]
|
|
18574
|
+
}
|
|
18575
|
+
);
|
|
18576
|
+
}
|
|
18577
|
+
|
|
18578
|
+
// src/composites/document-field-extraction/FieldDetails.tsx
|
|
18579
|
+
init_ThemeContext();
|
|
18580
|
+
var BADGE_DOT = {
|
|
18581
|
+
// gen-ui semantic dot colors
|
|
18582
|
+
ok: "#15803d",
|
|
18583
|
+
green: "#15803d",
|
|
18584
|
+
warn: "#f59e0b",
|
|
18585
|
+
amber: "#f59e0b",
|
|
18586
|
+
missing: "#dc2626",
|
|
18587
|
+
red: "#dc2626",
|
|
18588
|
+
corrected: "#0364ff"
|
|
18589
|
+
};
|
|
18590
|
+
function FieldDetails({
|
|
18591
|
+
summary,
|
|
18592
|
+
fileName,
|
|
18593
|
+
pageCount,
|
|
18594
|
+
pagesProcessed
|
|
18595
|
+
}) {
|
|
18596
|
+
var _a, _b, _c, _d, _e, _f;
|
|
18597
|
+
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
18598
|
+
if (!summary) {
|
|
18599
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18600
|
+
"div",
|
|
18601
|
+
{
|
|
18602
|
+
style: {
|
|
18603
|
+
height: "100%",
|
|
18604
|
+
display: "flex",
|
|
18605
|
+
flexDirection: "column",
|
|
18606
|
+
alignItems: "center",
|
|
18607
|
+
justifyContent: "center",
|
|
18608
|
+
gap: "6px",
|
|
18609
|
+
color: MUTED2,
|
|
18610
|
+
textAlign: "center",
|
|
18611
|
+
padding: "24px"
|
|
18612
|
+
},
|
|
18613
|
+
children: [
|
|
18614
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "26px", lineHeight: 1 }, children: "\u{1F4C4}" }),
|
|
18615
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "14px", fontWeight: 600, color: "var(--foreground)" }, children: "No summary yet" }),
|
|
18616
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "12px", maxWidth: "280px" }, children: "This document has no extracted summary." })
|
|
18617
|
+
]
|
|
18618
|
+
}
|
|
18619
|
+
);
|
|
18620
|
+
}
|
|
18621
|
+
const header = buildHeader(summary);
|
|
18622
|
+
const crumb = buildCrumbLine(summary);
|
|
18623
|
+
const facts = buildFacts(summary, fileName, pageCount, pagesProcessed);
|
|
18624
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100%", overflowY: "auto", paddingRight: "4px" }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "14px" }, children: [
|
|
18625
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { style: { display: "flex", flexDirection: "column", gap: "3px" }, children: [
|
|
18626
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18627
|
+
"h2",
|
|
18628
|
+
{
|
|
18629
|
+
title: header.title,
|
|
18630
|
+
style: {
|
|
18631
|
+
margin: 0,
|
|
18632
|
+
fontFamily: "var(--font-serif)",
|
|
18633
|
+
fontSize: "20px",
|
|
18634
|
+
fontWeight: 400,
|
|
18635
|
+
letterSpacing: "-0.01em",
|
|
18636
|
+
color: "var(--foreground)",
|
|
18637
|
+
overflow: "hidden",
|
|
18638
|
+
textOverflow: "ellipsis",
|
|
18639
|
+
whiteSpace: "nowrap"
|
|
18640
|
+
},
|
|
18641
|
+
children: header.title
|
|
18642
|
+
}
|
|
18643
|
+
),
|
|
18644
|
+
header.subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "12px", color: MUTED2 }, children: header.subtitle })
|
|
18645
|
+
] }),
|
|
18646
|
+
(summary.domain || summary.display_name || summary.domain_group || ((_b = (_a = summary.tags) == null ? void 0 : _a.length) != null ? _b : 0) > 0) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18647
|
+
"section",
|
|
18648
|
+
{
|
|
18649
|
+
style: {
|
|
18650
|
+
display: "flex",
|
|
18651
|
+
flexDirection: "column",
|
|
18652
|
+
gap: "6px",
|
|
18653
|
+
padding: "12px 14px",
|
|
18654
|
+
borderRadius: "0.75rem",
|
|
18655
|
+
border: `1px solid ${BORDER4}`,
|
|
18656
|
+
background: PAPER2
|
|
18657
|
+
},
|
|
18658
|
+
children: [
|
|
18659
|
+
summary.domain_group && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18660
|
+
"span",
|
|
18661
|
+
{
|
|
18662
|
+
style: {
|
|
18663
|
+
fontSize: "10px",
|
|
18664
|
+
fontWeight: 600,
|
|
18665
|
+
textTransform: "uppercase",
|
|
18666
|
+
letterSpacing: "0.06em",
|
|
18667
|
+
color: MUTED2
|
|
18668
|
+
},
|
|
18669
|
+
children: summary.domain_group
|
|
18670
|
+
}
|
|
18671
|
+
),
|
|
18672
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18673
|
+
"h3",
|
|
18674
|
+
{
|
|
18675
|
+
style: {
|
|
18676
|
+
margin: 0,
|
|
18677
|
+
fontSize: "14px",
|
|
18678
|
+
fontWeight: 600,
|
|
18679
|
+
color: "var(--foreground)"
|
|
18680
|
+
},
|
|
18681
|
+
children: summary.domain || summary.display_name
|
|
18682
|
+
}
|
|
18683
|
+
),
|
|
18684
|
+
crumb && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "12px", color: MUTED2 }, children: crumb }),
|
|
18685
|
+
((_d = (_c = summary.tags) == null ? void 0 : _c.length) != null ? _d : 0) > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "5px", marginTop: "2px" }, children: summary.tags.map((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
18686
|
+
"span",
|
|
18687
|
+
{
|
|
18688
|
+
style: {
|
|
18689
|
+
fontSize: "10px",
|
|
18690
|
+
fontWeight: 600,
|
|
18691
|
+
padding: "2px 8px",
|
|
18692
|
+
borderRadius: "9999px",
|
|
18693
|
+
background: "white",
|
|
18694
|
+
border: `1px solid ${BORDER4}`,
|
|
18695
|
+
color: MUTED2
|
|
18696
|
+
},
|
|
18697
|
+
children: t
|
|
18698
|
+
},
|
|
18699
|
+
t
|
|
18700
|
+
)) })
|
|
18701
|
+
]
|
|
18702
|
+
}
|
|
18703
|
+
),
|
|
18704
|
+
((_f = (_e = summary.stats) == null ? void 0 : _e.length) != null ? _f : 0) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18705
|
+
"div",
|
|
18706
|
+
{
|
|
18707
|
+
style: {
|
|
18708
|
+
display: "grid",
|
|
18709
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(130px, 1fr))",
|
|
18710
|
+
gap: "8px"
|
|
18711
|
+
},
|
|
18712
|
+
children: summary.stats.map((s) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18713
|
+
"div",
|
|
18714
|
+
{
|
|
18715
|
+
style: {
|
|
18716
|
+
display: "flex",
|
|
18717
|
+
flexDirection: "column",
|
|
18718
|
+
gap: "2px",
|
|
18719
|
+
padding: "10px 12px",
|
|
18720
|
+
borderRadius: "0.6rem",
|
|
18721
|
+
border: `1px solid ${BORDER4}`,
|
|
18722
|
+
background: "white"
|
|
18723
|
+
},
|
|
18724
|
+
children: [
|
|
18725
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: MUTED2 }, children: s.label }),
|
|
18726
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18727
|
+
"span",
|
|
18728
|
+
{
|
|
18729
|
+
title: s.value,
|
|
18730
|
+
style: {
|
|
18731
|
+
fontSize: "15px",
|
|
18732
|
+
fontWeight: 600,
|
|
18733
|
+
color: "var(--foreground)",
|
|
18734
|
+
overflow: "hidden",
|
|
18735
|
+
textOverflow: "ellipsis",
|
|
18736
|
+
whiteSpace: "nowrap"
|
|
18737
|
+
},
|
|
18738
|
+
children: s.value
|
|
18739
|
+
}
|
|
18740
|
+
),
|
|
18741
|
+
s.caption && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "10px", color: MUTED2 }, children: s.caption })
|
|
18742
|
+
]
|
|
18743
|
+
},
|
|
18744
|
+
s.field_key
|
|
18745
|
+
))
|
|
18746
|
+
}
|
|
18747
|
+
),
|
|
18748
|
+
facts.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("section", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
|
|
18749
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
18750
|
+
"div",
|
|
18751
|
+
{
|
|
18752
|
+
style: {
|
|
18753
|
+
display: "flex",
|
|
18754
|
+
alignItems: "center",
|
|
18755
|
+
gap: "6px",
|
|
18756
|
+
fontSize: "11px",
|
|
18757
|
+
fontWeight: 600,
|
|
18758
|
+
textTransform: "uppercase",
|
|
18759
|
+
letterSpacing: "0.04em",
|
|
18760
|
+
color: MUTED2
|
|
18761
|
+
},
|
|
18762
|
+
children: [
|
|
18763
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u25A4" }),
|
|
18764
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Document details" })
|
|
18765
|
+
]
|
|
18766
|
+
}
|
|
18767
|
+
),
|
|
18768
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18769
|
+
"dl",
|
|
18770
|
+
{
|
|
18771
|
+
style: {
|
|
18772
|
+
margin: 0,
|
|
18773
|
+
display: "grid",
|
|
18774
|
+
gridTemplateColumns: "minmax(110px, auto) 1fr",
|
|
18775
|
+
rowGap: "6px",
|
|
18776
|
+
columnGap: "14px"
|
|
18777
|
+
},
|
|
18778
|
+
children: facts.map((f) => {
|
|
18779
|
+
var _a2;
|
|
18780
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React45__default.default.Fragment, { children: [
|
|
18781
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { style: { fontSize: "12px", color: MUTED2 }, children: f.label }),
|
|
18782
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
18783
|
+
"dd",
|
|
18784
|
+
{
|
|
18785
|
+
title: typeof f.value === "string" ? f.value : void 0,
|
|
18786
|
+
style: {
|
|
18787
|
+
margin: 0,
|
|
18788
|
+
fontSize: "12px",
|
|
18789
|
+
color: "var(--foreground)",
|
|
18790
|
+
display: "flex",
|
|
18791
|
+
alignItems: "center",
|
|
18792
|
+
gap: "6px",
|
|
18793
|
+
wordBreak: "break-word"
|
|
18794
|
+
},
|
|
18795
|
+
children: [
|
|
18796
|
+
f.badge && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18797
|
+
"span",
|
|
18798
|
+
{
|
|
18799
|
+
style: {
|
|
18800
|
+
width: "7px",
|
|
18801
|
+
height: "7px",
|
|
18802
|
+
borderRadius: "9999px",
|
|
18803
|
+
flexShrink: 0,
|
|
18804
|
+
background: (_a2 = BADGE_DOT[f.badge]) != null ? _a2 : SECONDARY2
|
|
18805
|
+
}
|
|
18806
|
+
}
|
|
18807
|
+
),
|
|
18808
|
+
f.value
|
|
18809
|
+
]
|
|
18810
|
+
}
|
|
18811
|
+
)
|
|
18812
|
+
] }, f.key);
|
|
18813
|
+
})
|
|
18814
|
+
}
|
|
18815
|
+
)
|
|
18816
|
+
] })
|
|
18817
|
+
] }) });
|
|
18818
|
+
}
|
|
18819
|
+
function buildHeader(summary) {
|
|
18820
|
+
const form = [summary.short_name, summary.display_name].filter(Boolean);
|
|
18821
|
+
const title = summary.organization || form.shift() || summary.domain || "Document";
|
|
18822
|
+
const parts = summary.organization ? [...form] : form;
|
|
18823
|
+
if (summary.tax_year) parts.push(`TY ${summary.tax_year}`);
|
|
18824
|
+
return { title, subtitle: parts.join(" \xB7 ") };
|
|
18825
|
+
}
|
|
18826
|
+
function buildCrumbLine(summary) {
|
|
18827
|
+
const parts = [...summary.crumbs || [], summary.short_name].filter(Boolean);
|
|
18828
|
+
if (parts.length > 0) return parts.join(" \xB7 ");
|
|
18829
|
+
return summary.domain && summary.display_name ? summary.display_name : "";
|
|
18830
|
+
}
|
|
18831
|
+
function buildFacts(summary, fileName, pageCount, pagesProcessed) {
|
|
18832
|
+
const rows = [];
|
|
18833
|
+
if (fileName) rows.push({ key: "file", label: "File", value: fileName });
|
|
18834
|
+
if (summary.display_name) {
|
|
18835
|
+
rows.push({ key: "doctype", label: "Document type", value: summary.display_name });
|
|
18836
|
+
}
|
|
18837
|
+
if (summary.tax_year != null && summary.tax_year !== "") {
|
|
18838
|
+
rows.push({ key: "year", label: "Tax year", value: String(summary.tax_year) });
|
|
18839
|
+
}
|
|
18840
|
+
for (const f of summary.facts || []) {
|
|
18841
|
+
rows.push({ key: f.field_key, label: f.label, value: f.value, badge: f.badge });
|
|
18842
|
+
}
|
|
18843
|
+
if (pageCount) {
|
|
18844
|
+
rows.push({
|
|
18845
|
+
key: "pages",
|
|
18846
|
+
label: "Pages processed",
|
|
18847
|
+
value: `${pagesProcessed != null ? pagesProcessed : pageCount} / ${pageCount}`
|
|
18848
|
+
});
|
|
18849
|
+
}
|
|
18850
|
+
return rows;
|
|
18851
|
+
}
|
|
18852
|
+
|
|
18853
|
+
// src/composites/document-field-extraction/FieldAuditLog.tsx
|
|
18854
|
+
init_ThemeContext();
|
|
18855
|
+
function initials(name) {
|
|
18856
|
+
return name.trim().split(/\s+/).slice(0, 2).map((w) => {
|
|
18857
|
+
var _a;
|
|
18858
|
+
return ((_a = w[0]) != null ? _a : "").toUpperCase();
|
|
18859
|
+
}).join("");
|
|
18860
|
+
}
|
|
18861
|
+
function formatTs(ts) {
|
|
18862
|
+
if (!ts) return "\u2014";
|
|
18863
|
+
const d = new Date(ts);
|
|
18864
|
+
if (Number.isNaN(d.getTime())) return ts;
|
|
18865
|
+
return d.toLocaleString(void 0, {
|
|
18866
|
+
month: "short",
|
|
18867
|
+
day: "numeric",
|
|
18868
|
+
hour: "2-digit",
|
|
18869
|
+
minute: "2-digit"
|
|
18870
|
+
});
|
|
18871
|
+
}
|
|
18872
|
+
function FieldAuditLog({
|
|
18873
|
+
events = [],
|
|
18874
|
+
loading = false,
|
|
18875
|
+
fields = []
|
|
18876
|
+
}) {
|
|
18877
|
+
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
18878
|
+
const fieldLabelMap = React45__default.default.useMemo(() => {
|
|
18879
|
+
var _a;
|
|
18880
|
+
const map = {};
|
|
18881
|
+
for (const f of fields) map[f.field_key] = (_a = f.label) != null ? _a : f.field_key;
|
|
18882
|
+
return map;
|
|
18883
|
+
}, [fields]);
|
|
18884
|
+
if (loading) {
|
|
18885
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18886
|
+
"div",
|
|
18887
|
+
{
|
|
18888
|
+
style: {
|
|
18889
|
+
flex: 1,
|
|
18890
|
+
display: "flex",
|
|
18891
|
+
alignItems: "center",
|
|
18892
|
+
justifyContent: "center",
|
|
18893
|
+
padding: "32px 20px",
|
|
18894
|
+
fontSize: "13px",
|
|
18895
|
+
color: MUTED2
|
|
18896
|
+
},
|
|
18897
|
+
children: "Loading audit trail\u2026"
|
|
18898
|
+
}
|
|
18899
|
+
);
|
|
18900
|
+
}
|
|
18901
|
+
if (events.length === 0) {
|
|
18902
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18903
|
+
"div",
|
|
18904
|
+
{
|
|
18905
|
+
style: {
|
|
18906
|
+
flex: 1,
|
|
18907
|
+
display: "flex",
|
|
18908
|
+
flexDirection: "column",
|
|
18909
|
+
alignItems: "center",
|
|
18910
|
+
justifyContent: "center",
|
|
18911
|
+
gap: "6px",
|
|
18912
|
+
padding: "32px 20px",
|
|
18913
|
+
textAlign: "center"
|
|
18914
|
+
},
|
|
18915
|
+
children: [
|
|
18916
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "13.5px", fontWeight: 600, color: "var(--foreground)" }, children: "No changes yet" }),
|
|
18917
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: 0, fontSize: "12px", color: MUTED2, maxWidth: "240px", lineHeight: 1.5 }, children: "Field corrections will appear here." })
|
|
18918
|
+
]
|
|
18919
|
+
}
|
|
18920
|
+
);
|
|
18921
|
+
}
|
|
18922
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", flex: 1, minHeight: 0, overflow: "hidden" }, children: [
|
|
18923
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "8px 14px 6px", flexShrink: 0 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18924
|
+
"span",
|
|
18925
|
+
{
|
|
18926
|
+
style: {
|
|
18927
|
+
fontSize: "11.5px",
|
|
18928
|
+
fontWeight: 600,
|
|
18929
|
+
color: MUTED2,
|
|
18930
|
+
textTransform: "uppercase",
|
|
18931
|
+
letterSpacing: "0.04em"
|
|
18932
|
+
},
|
|
18933
|
+
children: [
|
|
18934
|
+
events.length,
|
|
18935
|
+
" ",
|
|
18936
|
+
events.length === 1 ? "change" : "changes"
|
|
18937
|
+
]
|
|
18938
|
+
}
|
|
18939
|
+
) }),
|
|
18940
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { style: { listStyle: "none", margin: 0, padding: "0 0 16px", overflowY: "auto", flex: 1, minHeight: 0 }, children: events.map((ev) => {
|
|
18941
|
+
var _a, _b;
|
|
18942
|
+
const rawLabel = (_a = fieldLabelMap[ev.field_key]) != null ? _a : ev.field_key;
|
|
18943
|
+
const label = prettyLabel(rawLabel);
|
|
18944
|
+
const isAI = ev.actor_type === "system" || ev.event_type === "ai_corrected" || ev.event_type === "ai_extracted";
|
|
18945
|
+
const actor = isAI ? "AI" : ev.actor_name || "Unknown";
|
|
18946
|
+
const eventLabel = isAI ? "Re-extracted" : "Corrected";
|
|
18947
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18948
|
+
"li",
|
|
18949
|
+
{
|
|
18950
|
+
"data-testid": "audit-row",
|
|
18951
|
+
style: { display: "flex", gap: "10px", padding: "10px 14px", borderBottom: `1px solid ${BORDER4}` },
|
|
18952
|
+
children: [
|
|
18953
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18954
|
+
"div",
|
|
18955
|
+
{
|
|
18956
|
+
title: isAI ? "AI extraction" : actor,
|
|
18957
|
+
style: {
|
|
18958
|
+
flexShrink: 0,
|
|
18959
|
+
width: "28px",
|
|
18960
|
+
height: "28px",
|
|
18961
|
+
borderRadius: "50%",
|
|
18962
|
+
background: isAI ? "#dcfce7" : "#eff6ff",
|
|
18963
|
+
color: isAI ? "#15803d" : SECONDARY2,
|
|
18964
|
+
fontSize: "10.5px",
|
|
18965
|
+
fontWeight: 700,
|
|
18966
|
+
display: "flex",
|
|
18967
|
+
alignItems: "center",
|
|
18968
|
+
justifyContent: "center",
|
|
18969
|
+
marginTop: "1px"
|
|
18970
|
+
},
|
|
18971
|
+
children: isAI ? "\u2728" : initials(actor)
|
|
18972
|
+
}
|
|
18973
|
+
),
|
|
18974
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "3px", flex: 1, minWidth: 0 }, children: [
|
|
18975
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "baseline", gap: "6px", flexWrap: "wrap" }, children: [
|
|
18976
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "12.5px", fontWeight: 600, color: isAI ? "#15803d" : "var(--foreground)" }, children: actor }),
|
|
18977
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18978
|
+
"span",
|
|
18979
|
+
{
|
|
18980
|
+
style: {
|
|
18981
|
+
fontSize: "10.5px",
|
|
18982
|
+
fontWeight: 600,
|
|
18983
|
+
color: MUTED2,
|
|
18984
|
+
background: PAPER2,
|
|
18985
|
+
borderRadius: "4px",
|
|
18986
|
+
padding: "1px 6px",
|
|
18987
|
+
whiteSpace: "nowrap",
|
|
18988
|
+
flexShrink: 0
|
|
18989
|
+
},
|
|
18990
|
+
children: eventLabel
|
|
18991
|
+
}
|
|
18992
|
+
),
|
|
18993
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18994
|
+
"span",
|
|
18995
|
+
{
|
|
18996
|
+
style: {
|
|
18997
|
+
fontSize: "12px",
|
|
18998
|
+
color: MUTED2,
|
|
18999
|
+
flex: 1,
|
|
19000
|
+
minWidth: 0,
|
|
19001
|
+
whiteSpace: "nowrap",
|
|
19002
|
+
overflow: "hidden",
|
|
19003
|
+
textOverflow: "ellipsis"
|
|
19004
|
+
},
|
|
19005
|
+
children: label
|
|
19006
|
+
}
|
|
19007
|
+
),
|
|
19008
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: MUTED2, flexShrink: 0 }, children: formatTs(ev.created_at) })
|
|
19009
|
+
] }),
|
|
19010
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px", flexWrap: "wrap" }, children: [
|
|
19011
|
+
ev.previous_value != null && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19012
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19013
|
+
"span",
|
|
19014
|
+
{
|
|
19015
|
+
style: {
|
|
19016
|
+
fontSize: "12px",
|
|
19017
|
+
fontFamily: "ui-monospace, monospace",
|
|
19018
|
+
color: MUTED2,
|
|
19019
|
+
textDecoration: "line-through"
|
|
19020
|
+
},
|
|
19021
|
+
children: ev.previous_value
|
|
19022
|
+
}
|
|
19023
|
+
),
|
|
19024
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "11px", color: BORDER4 }, children: "\u2192" })
|
|
19025
|
+
] }),
|
|
19026
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19027
|
+
"span",
|
|
19028
|
+
{
|
|
19029
|
+
style: {
|
|
19030
|
+
fontSize: "12px",
|
|
19031
|
+
fontFamily: "ui-monospace, monospace",
|
|
19032
|
+
fontWeight: 600,
|
|
19033
|
+
color: "var(--foreground)"
|
|
19034
|
+
},
|
|
19035
|
+
children: (_b = ev.new_value) != null ? _b : "\u2014"
|
|
19036
|
+
}
|
|
19037
|
+
)
|
|
19038
|
+
] }),
|
|
19039
|
+
ev.reason && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: "2px 0 0", fontSize: "11.5px", color: MUTED2, fontStyle: "italic" }, children: [
|
|
19040
|
+
"\u201C",
|
|
19041
|
+
ev.reason,
|
|
19042
|
+
"\u201D"
|
|
19043
|
+
] })
|
|
19044
|
+
] })
|
|
19045
|
+
]
|
|
19046
|
+
},
|
|
19047
|
+
ev.id
|
|
19048
|
+
);
|
|
19049
|
+
}) })
|
|
19050
|
+
] });
|
|
19051
|
+
}
|
|
19052
|
+
var TIER_COLORS2 = {
|
|
19053
|
+
green: "#15803d",
|
|
19054
|
+
amber: "#f59e0b",
|
|
19055
|
+
red: "#dc2626"
|
|
19056
|
+
};
|
|
19057
|
+
function fieldColor2(f, secondary) {
|
|
19058
|
+
var _a, _b;
|
|
19059
|
+
if (f.state === "corrected") return secondary;
|
|
19060
|
+
return (_b = TIER_COLORS2[(_a = f.confidence_tier) != null ? _a : "amber"]) != null ? _b : TIER_COLORS2.amber;
|
|
19061
|
+
}
|
|
19062
|
+
function hexToRgba2(hex, alpha) {
|
|
19063
|
+
const h = hex.replace("#", "");
|
|
19064
|
+
const r = parseInt(h.slice(0, 2), 16);
|
|
19065
|
+
const g = parseInt(h.slice(2, 4), 16);
|
|
19066
|
+
const b = parseInt(h.slice(4, 6), 16);
|
|
19067
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
19068
|
+
}
|
|
19069
|
+
function PageOverlay({
|
|
19070
|
+
page,
|
|
19071
|
+
fields,
|
|
19072
|
+
selectedKey,
|
|
19073
|
+
onSelect,
|
|
19074
|
+
secondary
|
|
19075
|
+
}) {
|
|
19076
|
+
const { PAPER: PAPER2, MUTED: MUTED2 } = useTheme();
|
|
19077
|
+
const imgRef = React45__default.default.useRef(null);
|
|
19078
|
+
const selectedBoxRef = React45__default.default.useRef(null);
|
|
19079
|
+
const [px, setPx] = React45__default.default.useState(null);
|
|
19080
|
+
React45__default.default.useEffect(() => {
|
|
19081
|
+
const el = imgRef.current;
|
|
19082
|
+
if (!el) return;
|
|
19083
|
+
const measure = () => {
|
|
19084
|
+
if (el.clientWidth && el.clientHeight) {
|
|
19085
|
+
setPx({ wPx: el.clientWidth, hPx: el.clientHeight });
|
|
19086
|
+
}
|
|
19087
|
+
};
|
|
19088
|
+
measure();
|
|
19089
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
19090
|
+
const ro = new ResizeObserver(measure);
|
|
19091
|
+
ro.observe(el);
|
|
19092
|
+
return () => ro.disconnect();
|
|
19093
|
+
}, [page.imageUrl]);
|
|
19094
|
+
React45__default.default.useEffect(() => {
|
|
19095
|
+
if (!selectedKey) return;
|
|
19096
|
+
if (!fields.some((f) => f.field_key === selectedKey && f.bbox)) return;
|
|
19097
|
+
const el = selectedBoxRef.current;
|
|
19098
|
+
if (el && typeof el.scrollIntoView === "function") {
|
|
19099
|
+
el.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" });
|
|
19100
|
+
}
|
|
19101
|
+
}, [selectedKey, fields, px]);
|
|
19102
|
+
const pagePts = { wPts: page.width_pt, hPts: page.height_pt };
|
|
19103
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", width: "100%", lineHeight: 0 }, children: [
|
|
19104
|
+
page.imageUrl ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19105
|
+
"img",
|
|
19106
|
+
{
|
|
19107
|
+
ref: imgRef,
|
|
19108
|
+
src: page.imageUrl,
|
|
19109
|
+
alt: `Page ${page.page + 1}`,
|
|
19110
|
+
onLoad: () => {
|
|
19111
|
+
const el = imgRef.current;
|
|
19112
|
+
if (el && el.clientWidth && el.clientHeight) {
|
|
19113
|
+
setPx({ wPx: el.clientWidth, hPx: el.clientHeight });
|
|
19114
|
+
}
|
|
19115
|
+
},
|
|
19116
|
+
style: { display: "block", width: "100%", height: "auto" }
|
|
19117
|
+
}
|
|
19118
|
+
) : (
|
|
19119
|
+
// No resolved image (host couldn't resolve the raster) — keep the
|
|
19120
|
+
// aspect box so cards still make sense, but show nothing to overlay on.
|
|
19121
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19122
|
+
"div",
|
|
19123
|
+
{
|
|
19124
|
+
style: {
|
|
19125
|
+
width: "100%",
|
|
19126
|
+
aspectRatio: `${page.width_pt} / ${page.height_pt}`,
|
|
19127
|
+
background: PAPER2,
|
|
19128
|
+
display: "flex",
|
|
19129
|
+
alignItems: "center",
|
|
19130
|
+
justifyContent: "center",
|
|
19131
|
+
fontSize: "12px",
|
|
19132
|
+
color: MUTED2,
|
|
19133
|
+
lineHeight: 1.4
|
|
19134
|
+
},
|
|
19135
|
+
children: [
|
|
19136
|
+
"Page ",
|
|
19137
|
+
page.page + 1,
|
|
19138
|
+
" image unavailable"
|
|
19139
|
+
]
|
|
19140
|
+
}
|
|
19141
|
+
)
|
|
19142
|
+
),
|
|
19143
|
+
px && page.imageUrl && fields.map((f) => {
|
|
19144
|
+
var _a;
|
|
19145
|
+
const rect = bboxToRect((_a = f.bbox) != null ? _a : null, pagePts, px);
|
|
19146
|
+
if (!rect) return null;
|
|
19147
|
+
const color = fieldColor2(f, secondary);
|
|
19148
|
+
const selected = selectedKey === f.field_key;
|
|
19149
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19150
|
+
"div",
|
|
19151
|
+
{
|
|
19152
|
+
ref: selected ? selectedBoxRef : null,
|
|
19153
|
+
"data-testid": "bbox-rect",
|
|
19154
|
+
"data-field-key": f.field_key,
|
|
19155
|
+
"data-selected": selected ? "true" : "false",
|
|
19156
|
+
onClick: () => onSelect(selected ? null : f.field_key),
|
|
19157
|
+
title: `${f.label}: ${f.value}`,
|
|
19158
|
+
style: {
|
|
19159
|
+
position: "absolute",
|
|
19160
|
+
left: `${rect.left}px`,
|
|
19161
|
+
top: `${rect.top}px`,
|
|
19162
|
+
width: `${rect.width}px`,
|
|
19163
|
+
height: `${rect.height}px`,
|
|
19164
|
+
border: `1px solid ${color}`,
|
|
19165
|
+
background: hexToRgba2(color, selected ? 0.28 : 0.12),
|
|
19166
|
+
boxShadow: selected ? `0 0 0 2px ${hexToRgba2(color, 0.5)}` : "none",
|
|
19167
|
+
borderRadius: "2px",
|
|
19168
|
+
cursor: "pointer",
|
|
19169
|
+
transition: "background 0.15s, box-shadow 0.15s"
|
|
19170
|
+
}
|
|
19171
|
+
},
|
|
19172
|
+
f.field_key
|
|
19173
|
+
);
|
|
19174
|
+
})
|
|
19175
|
+
] });
|
|
19176
|
+
}
|
|
19177
|
+
function ExtractionDetail({
|
|
19178
|
+
pages,
|
|
19179
|
+
orderedFields,
|
|
19180
|
+
fieldsByPage,
|
|
19181
|
+
selectedKey,
|
|
19182
|
+
setSelectedKey,
|
|
19183
|
+
onFieldSave,
|
|
19184
|
+
correctionCounts,
|
|
19185
|
+
tab,
|
|
19186
|
+
setTab,
|
|
19187
|
+
editable,
|
|
19188
|
+
summary,
|
|
19189
|
+
fileName,
|
|
19190
|
+
pageCount,
|
|
19191
|
+
pagesProcessed,
|
|
19192
|
+
auditEvents,
|
|
19193
|
+
auditLoading
|
|
19194
|
+
}) {
|
|
19195
|
+
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
19196
|
+
const selectedCardRef = React45__default.default.useRef(null);
|
|
19197
|
+
React45__default.default.useEffect(() => {
|
|
19198
|
+
if (!selectedKey || tab !== "fields") return;
|
|
19199
|
+
const el = selectedCardRef.current;
|
|
19200
|
+
if (el && typeof el.scrollIntoView === "function") {
|
|
19201
|
+
el.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
19202
|
+
}
|
|
19203
|
+
}, [selectedKey, tab]);
|
|
19204
|
+
const tabs = [
|
|
19205
|
+
{ key: "details", label: "Details" },
|
|
19206
|
+
{ key: "fields", label: "Fields", count: orderedFields.length }
|
|
19207
|
+
];
|
|
19208
|
+
if (editable) tabs.push({ key: "audit", label: "Audit Trails", count: (auditEvents == null ? void 0 : auditEvents.length) || void 0 });
|
|
19209
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19210
|
+
"div",
|
|
19211
|
+
{
|
|
19212
|
+
style: {
|
|
19213
|
+
display: "grid",
|
|
19214
|
+
gridTemplateColumns: "minmax(0, 3fr) minmax(260px, 1fr)",
|
|
19215
|
+
gap: "12px",
|
|
19216
|
+
height: "100%",
|
|
19217
|
+
minHeight: 0
|
|
19218
|
+
},
|
|
19219
|
+
children: [
|
|
19220
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19221
|
+
"div",
|
|
19222
|
+
{
|
|
19223
|
+
style: {
|
|
19224
|
+
display: "flex",
|
|
19225
|
+
flexDirection: "column",
|
|
19226
|
+
gap: "10px",
|
|
19227
|
+
borderRadius: "0.75rem",
|
|
19228
|
+
border: `1px solid ${BORDER4}`,
|
|
19229
|
+
overflowY: "auto",
|
|
19230
|
+
minHeight: 0
|
|
19231
|
+
},
|
|
19232
|
+
children: pages.map((pg) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
19233
|
+
PageOverlay,
|
|
19234
|
+
{
|
|
19235
|
+
page: pg,
|
|
19236
|
+
fields: fieldsByPage(pg.page),
|
|
19237
|
+
selectedKey,
|
|
19238
|
+
onSelect: (key) => {
|
|
19239
|
+
setSelectedKey(key);
|
|
19240
|
+
if (key) setTab("fields");
|
|
19241
|
+
},
|
|
19242
|
+
secondary: SECONDARY2
|
|
19243
|
+
},
|
|
19244
|
+
pg.page
|
|
19245
|
+
))
|
|
19246
|
+
}
|
|
19247
|
+
),
|
|
19248
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", minWidth: 0, minHeight: 0 }, children: [
|
|
19249
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19250
|
+
"div",
|
|
19251
|
+
{
|
|
19252
|
+
style: {
|
|
19253
|
+
display: "flex",
|
|
19254
|
+
gap: "16px",
|
|
19255
|
+
borderBottom: `1px solid ${BORDER4}`,
|
|
19256
|
+
flexShrink: 0,
|
|
19257
|
+
marginBottom: "10px"
|
|
19258
|
+
},
|
|
19259
|
+
children: tabs.map((t) => {
|
|
19260
|
+
const active = tab === t.key;
|
|
19261
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19262
|
+
"button",
|
|
19263
|
+
{
|
|
19264
|
+
type: "button",
|
|
19265
|
+
onClick: () => setTab(t.key),
|
|
19266
|
+
"data-testid": `tab-${t.key}`,
|
|
19267
|
+
style: {
|
|
19268
|
+
appearance: "none",
|
|
19269
|
+
background: "transparent",
|
|
19270
|
+
borderTop: "none",
|
|
19271
|
+
borderLeft: "none",
|
|
19272
|
+
borderRight: "none",
|
|
19273
|
+
borderBottom: `2px solid ${active ? SECONDARY2 : "transparent"}`,
|
|
19274
|
+
padding: "6px 2px",
|
|
19275
|
+
marginBottom: "-1px",
|
|
19276
|
+
cursor: "pointer",
|
|
19277
|
+
fontSize: "13px",
|
|
19278
|
+
fontWeight: 600,
|
|
19279
|
+
color: active ? SECONDARY2 : MUTED2,
|
|
19280
|
+
display: "inline-flex",
|
|
19281
|
+
alignItems: "center",
|
|
19282
|
+
gap: "6px"
|
|
19283
|
+
},
|
|
19284
|
+
children: [
|
|
19285
|
+
t.label,
|
|
19286
|
+
typeof t.count === "number" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19287
|
+
"span",
|
|
19288
|
+
{
|
|
19289
|
+
style: {
|
|
19290
|
+
fontSize: "11px",
|
|
19291
|
+
fontWeight: 600,
|
|
19292
|
+
padding: "1px 7px",
|
|
19293
|
+
borderRadius: "9999px",
|
|
19294
|
+
background: active ? "#eff6ff" : PAPER2,
|
|
19295
|
+
color: active ? SECONDARY2 : MUTED2
|
|
19296
|
+
},
|
|
19297
|
+
children: t.count
|
|
19298
|
+
}
|
|
19299
|
+
)
|
|
19300
|
+
]
|
|
19301
|
+
},
|
|
19302
|
+
t.key
|
|
19303
|
+
);
|
|
19304
|
+
})
|
|
19305
|
+
}
|
|
19306
|
+
),
|
|
19307
|
+
tab === "details" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19308
|
+
FieldDetails,
|
|
19309
|
+
{
|
|
19310
|
+
summary,
|
|
19311
|
+
fileName,
|
|
19312
|
+
pageCount,
|
|
19313
|
+
pagesProcessed
|
|
19314
|
+
}
|
|
19315
|
+
) : tab === "audit" ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: 0, overflowY: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19316
|
+
FieldAuditLog,
|
|
19317
|
+
{
|
|
19318
|
+
events: auditEvents != null ? auditEvents : [],
|
|
19319
|
+
loading: auditLoading != null ? auditLoading : false,
|
|
19320
|
+
fields: orderedFields.map((f) => ({ field_key: f.field_key, label: f.label }))
|
|
19321
|
+
}
|
|
19322
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19323
|
+
"div",
|
|
19324
|
+
{
|
|
19325
|
+
style: {
|
|
19326
|
+
display: "flex",
|
|
19327
|
+
flexDirection: "column",
|
|
19328
|
+
minHeight: 0,
|
|
19329
|
+
overflowY: "auto",
|
|
19330
|
+
paddingRight: "4px"
|
|
19331
|
+
},
|
|
19332
|
+
children: [
|
|
19333
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "12px", color: MUTED2, padding: "0 0 8px 2px", flexShrink: 0 }, children: [
|
|
19334
|
+
orderedFields.length,
|
|
19335
|
+
" extracted"
|
|
19336
|
+
] }),
|
|
19337
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: orderedFields.map((f) => {
|
|
19338
|
+
var _a;
|
|
19339
|
+
const selected = selectedKey === f.field_key;
|
|
19340
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19341
|
+
FieldDetail,
|
|
19342
|
+
{
|
|
19343
|
+
field: f,
|
|
19344
|
+
selected,
|
|
19345
|
+
onSelect: setSelectedKey,
|
|
19346
|
+
onSave: onFieldSave,
|
|
19347
|
+
correctionCount: (_a = correctionCounts == null ? void 0 : correctionCounts[f.field_key]) != null ? _a : 0,
|
|
19348
|
+
cardRef: selected ? selectedCardRef : void 0
|
|
19349
|
+
},
|
|
19350
|
+
f.field_key
|
|
19351
|
+
);
|
|
19352
|
+
}) })
|
|
19353
|
+
]
|
|
19354
|
+
}
|
|
19355
|
+
)
|
|
19356
|
+
] })
|
|
19357
|
+
]
|
|
19358
|
+
}
|
|
19359
|
+
);
|
|
19360
|
+
}
|
|
19361
|
+
function ExtractionModal({
|
|
19362
|
+
open,
|
|
19363
|
+
onClose,
|
|
19364
|
+
title,
|
|
19365
|
+
children
|
|
19366
|
+
}) {
|
|
19367
|
+
const { BORDER: BORDER4, MUTED: MUTED2 } = useTheme();
|
|
19368
|
+
React45__default.default.useEffect(() => {
|
|
19369
|
+
if (!open) return;
|
|
19370
|
+
const onKey = (e) => {
|
|
19371
|
+
if (e.key === "Escape") onClose();
|
|
19372
|
+
};
|
|
19373
|
+
window.addEventListener("keydown", onKey);
|
|
19374
|
+
const prev = document.body.style.overflow;
|
|
19375
|
+
document.body.style.overflow = "hidden";
|
|
19376
|
+
return () => {
|
|
19377
|
+
window.removeEventListener("keydown", onKey);
|
|
19378
|
+
document.body.style.overflow = prev;
|
|
19379
|
+
};
|
|
19380
|
+
}, [open, onClose]);
|
|
19381
|
+
if (!open || typeof document === "undefined") return null;
|
|
19382
|
+
return reactDom.createPortal(
|
|
19383
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19384
|
+
"div",
|
|
19385
|
+
{
|
|
19386
|
+
role: "dialog",
|
|
19387
|
+
"aria-modal": "true",
|
|
19388
|
+
"aria-label": title,
|
|
19389
|
+
onClick: onClose,
|
|
19390
|
+
style: {
|
|
19391
|
+
position: "fixed",
|
|
19392
|
+
inset: 0,
|
|
19393
|
+
zIndex: 2147483e3,
|
|
19394
|
+
background: "rgba(0,0,0,0.5)",
|
|
19395
|
+
display: "flex",
|
|
19396
|
+
alignItems: "center",
|
|
19397
|
+
justifyContent: "center",
|
|
19398
|
+
padding: "4vh 4vw",
|
|
19399
|
+
backdropFilter: "blur(2px)"
|
|
19400
|
+
},
|
|
19401
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19402
|
+
"div",
|
|
19403
|
+
{
|
|
19404
|
+
onClick: (e) => e.stopPropagation(),
|
|
19405
|
+
style: {
|
|
19406
|
+
width: "90vw",
|
|
19407
|
+
height: "90vh",
|
|
19408
|
+
background: "white",
|
|
19409
|
+
borderRadius: "0.875rem",
|
|
19410
|
+
border: `1px solid ${BORDER4}`,
|
|
19411
|
+
boxShadow: "0 20px 60px rgba(0,0,0,0.30)",
|
|
19412
|
+
display: "flex",
|
|
19413
|
+
flexDirection: "column",
|
|
19414
|
+
overflow: "hidden"
|
|
19415
|
+
},
|
|
19416
|
+
children: [
|
|
19417
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19418
|
+
"div",
|
|
19419
|
+
{
|
|
19420
|
+
style: {
|
|
19421
|
+
display: "flex",
|
|
19422
|
+
alignItems: "center",
|
|
19423
|
+
gap: "10px",
|
|
19424
|
+
padding: "11px 16px",
|
|
19425
|
+
borderBottom: `1px solid ${BORDER4}`,
|
|
19426
|
+
flexShrink: 0
|
|
19427
|
+
},
|
|
19428
|
+
children: [
|
|
19429
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19430
|
+
"span",
|
|
19431
|
+
{
|
|
19432
|
+
style: {
|
|
19433
|
+
flex: 1,
|
|
19434
|
+
minWidth: 0,
|
|
19435
|
+
fontFamily: "var(--font-serif)",
|
|
19436
|
+
fontSize: "16px",
|
|
19437
|
+
fontWeight: 400,
|
|
19438
|
+
letterSpacing: "-0.01em",
|
|
19439
|
+
color: "var(--foreground)",
|
|
19440
|
+
overflow: "hidden",
|
|
19441
|
+
textOverflow: "ellipsis",
|
|
19442
|
+
whiteSpace: "nowrap"
|
|
19443
|
+
},
|
|
19444
|
+
children: title
|
|
19445
|
+
}
|
|
19446
|
+
),
|
|
19447
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19448
|
+
"button",
|
|
19449
|
+
{
|
|
19450
|
+
type: "button",
|
|
19451
|
+
"aria-label": "Close",
|
|
19452
|
+
onClick: onClose,
|
|
19453
|
+
style: {
|
|
19454
|
+
border: `1px solid ${BORDER4}`,
|
|
19455
|
+
borderRadius: "8px",
|
|
19456
|
+
background: "white",
|
|
19457
|
+
cursor: "pointer",
|
|
19458
|
+
padding: "5px 9px",
|
|
19459
|
+
fontSize: "13px",
|
|
19460
|
+
color: MUTED2,
|
|
19461
|
+
lineHeight: 1
|
|
19462
|
+
},
|
|
19463
|
+
children: "\u2715"
|
|
19464
|
+
}
|
|
19465
|
+
)
|
|
19466
|
+
]
|
|
19467
|
+
}
|
|
19468
|
+
),
|
|
19469
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19470
|
+
"div",
|
|
19471
|
+
{
|
|
19472
|
+
style: {
|
|
19473
|
+
flex: 1,
|
|
19474
|
+
minHeight: 0,
|
|
19475
|
+
overflow: "hidden",
|
|
19476
|
+
display: "flex",
|
|
19477
|
+
flexDirection: "column",
|
|
19478
|
+
padding: "14px 16px"
|
|
19479
|
+
},
|
|
19480
|
+
children
|
|
19481
|
+
}
|
|
19482
|
+
)
|
|
19483
|
+
]
|
|
19484
|
+
}
|
|
19485
|
+
)
|
|
19486
|
+
}
|
|
19487
|
+
),
|
|
19488
|
+
document.body
|
|
19489
|
+
);
|
|
19490
|
+
}
|
|
19491
|
+
function DocumentFieldExtractionResolver(p) {
|
|
19492
|
+
var _a, _b;
|
|
19493
|
+
const { BORDER: BORDER4, MUTED: MUTED2, PAPER: PAPER2 } = useTheme();
|
|
19494
|
+
const [selectedKey, setSelectedKey] = React45__default.default.useState(null);
|
|
19495
|
+
const [open, setOpen] = React45__default.default.useState(false);
|
|
19496
|
+
const [tab, setTab] = React45__default.default.useState("fields");
|
|
19497
|
+
const pages = (_a = p.pages) != null ? _a : [];
|
|
19498
|
+
const fields = (_b = p.fields) != null ? _b : [];
|
|
19499
|
+
const editable = typeof p.onFieldSave === "function";
|
|
19500
|
+
const onLoadAudit = p.onLoadAudit;
|
|
19501
|
+
React45__default.default.useEffect(() => {
|
|
19502
|
+
if (tab === "audit" && onLoadAudit) {
|
|
19503
|
+
onLoadAudit();
|
|
19504
|
+
}
|
|
19505
|
+
}, [tab, onLoadAudit]);
|
|
19506
|
+
const correctionCounts = React45__default.default.useMemo(() => {
|
|
19507
|
+
var _a2, _b2;
|
|
19508
|
+
const counts = {};
|
|
19509
|
+
for (const ev of (_a2 = p.auditEvents) != null ? _a2 : []) {
|
|
19510
|
+
const human = ev.actor_type !== "system" && ev.event_type !== "ai_extracted";
|
|
19511
|
+
if (human) counts[ev.field_key] = ((_b2 = counts[ev.field_key]) != null ? _b2 : 0) + 1;
|
|
19512
|
+
}
|
|
19513
|
+
return counts;
|
|
19514
|
+
}, [p.auditEvents]);
|
|
19515
|
+
const orderedFields = [...fields].sort((a, b) => {
|
|
19516
|
+
var _a2, _b2;
|
|
19517
|
+
if (!!a.is_primary !== !!b.is_primary) return a.is_primary ? -1 : 1;
|
|
19518
|
+
return ((_a2 = b.confidence) != null ? _a2 : 0) - ((_b2 = a.confidence) != null ? _b2 : 0);
|
|
19519
|
+
});
|
|
19520
|
+
const fieldsByPage = (pageNo) => fields.filter((f) => f.page === pageNo);
|
|
19521
|
+
const csvCols = [
|
|
19522
|
+
{ key: "label", label: "Field" },
|
|
19523
|
+
{ key: "value", label: "Value" },
|
|
19524
|
+
{ key: "page", label: "Page" },
|
|
19525
|
+
{ key: "confidence", label: "Confidence" },
|
|
19526
|
+
{ key: "badge", label: "Badge" },
|
|
19527
|
+
{ key: "state", label: "State" }
|
|
19528
|
+
];
|
|
19529
|
+
const csvRows = orderedFields.map((f) => {
|
|
19530
|
+
var _a2, _b2, _c;
|
|
19531
|
+
return {
|
|
19532
|
+
label: f.label,
|
|
19533
|
+
value: f.value,
|
|
19534
|
+
page: f.page + 1,
|
|
19535
|
+
confidence: (_a2 = f.confidence) != null ? _a2 : "",
|
|
19536
|
+
badge: (_b2 = f.badge) != null ? _b2 : "",
|
|
19537
|
+
state: (_c = f.state) != null ? _c : ""
|
|
19538
|
+
};
|
|
19539
|
+
});
|
|
19540
|
+
const title = p.file_name || (p.doc_type ? `${p.doc_type} \u2014 extracted fields` : "Extracted fields");
|
|
19541
|
+
const tierCounts = fields.reduce(
|
|
19542
|
+
(acc, f) => {
|
|
19543
|
+
var _a2;
|
|
19544
|
+
const t = (_a2 = f.confidence_tier) != null ? _a2 : "amber";
|
|
19545
|
+
if (t === "green") acc.high += 1;
|
|
19546
|
+
else if (t === "red") acc.low += 1;
|
|
19547
|
+
else acc.med += 1;
|
|
19548
|
+
return acc;
|
|
19549
|
+
},
|
|
19550
|
+
{ high: 0, med: 0, low: 0 }
|
|
19551
|
+
);
|
|
19552
|
+
const chips = [
|
|
19553
|
+
{ n: tierCounts.high, label: "high", color: TIER_COLORS2.green },
|
|
19554
|
+
{ n: tierCounts.med, label: "medium", color: TIER_COLORS2.amber },
|
|
19555
|
+
{ n: tierCounts.low, label: "low", color: TIER_COLORS2.red }
|
|
19556
|
+
].filter((c) => c.n > 0);
|
|
19557
|
+
const thumb = pages.find((pg) => pg.imageUrl);
|
|
19558
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19559
|
+
ComponentActions,
|
|
19560
|
+
{
|
|
19561
|
+
filename: "document-fields",
|
|
19562
|
+
onDownloadCSV: () => downloadCSV(csvCols, csvRows, "document-fields"),
|
|
19563
|
+
children: [
|
|
19564
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19565
|
+
"div",
|
|
19566
|
+
{
|
|
19567
|
+
role: "button",
|
|
19568
|
+
tabIndex: 0,
|
|
19569
|
+
onClick: () => setOpen(true),
|
|
19570
|
+
onKeyDown: (e) => {
|
|
19571
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
19572
|
+
e.preventDefault();
|
|
19573
|
+
setOpen(true);
|
|
19574
|
+
}
|
|
19575
|
+
},
|
|
19576
|
+
style: {
|
|
19577
|
+
display: "flex",
|
|
19578
|
+
alignItems: "stretch",
|
|
19579
|
+
gap: "12px",
|
|
19580
|
+
padding: "12px",
|
|
19581
|
+
width: "100%",
|
|
19582
|
+
maxWidth: "440px",
|
|
19583
|
+
borderRadius: "0.75rem",
|
|
19584
|
+
border: `1px solid ${BORDER4}`,
|
|
19585
|
+
background: "white",
|
|
19586
|
+
cursor: "pointer",
|
|
19587
|
+
textAlign: "left",
|
|
19588
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.05)"
|
|
19589
|
+
},
|
|
19590
|
+
children: [
|
|
19591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19592
|
+
"div",
|
|
19593
|
+
{
|
|
19594
|
+
style: {
|
|
19595
|
+
width: "64px",
|
|
19596
|
+
flexShrink: 0,
|
|
19597
|
+
borderRadius: "0.5rem",
|
|
19598
|
+
border: `1px solid ${BORDER4}`,
|
|
19599
|
+
background: PAPER2,
|
|
19600
|
+
overflow: "hidden",
|
|
19601
|
+
display: "flex",
|
|
19602
|
+
alignItems: "center",
|
|
19603
|
+
justifyContent: "center"
|
|
19604
|
+
},
|
|
19605
|
+
children: (thumb == null ? void 0 : thumb.imageUrl) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19606
|
+
"img",
|
|
19607
|
+
{
|
|
19608
|
+
src: thumb.imageUrl,
|
|
19609
|
+
alt: "Document preview",
|
|
19610
|
+
style: { width: "100%", height: "auto", display: "block" }
|
|
19611
|
+
}
|
|
19612
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "22px", lineHeight: 1, padding: "16px 0" }, children: "\u{1F4C4}" })
|
|
19613
|
+
}
|
|
19614
|
+
),
|
|
19615
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "6px" }, children: [
|
|
19616
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19617
|
+
"p",
|
|
19618
|
+
{
|
|
19619
|
+
style: {
|
|
19620
|
+
fontFamily: "var(--font-serif)",
|
|
19621
|
+
fontSize: "15px",
|
|
19622
|
+
fontWeight: 400,
|
|
19623
|
+
color: "var(--foreground)",
|
|
19624
|
+
letterSpacing: "-0.01em",
|
|
19625
|
+
margin: 0,
|
|
19626
|
+
overflow: "hidden",
|
|
19627
|
+
textOverflow: "ellipsis",
|
|
19628
|
+
whiteSpace: "nowrap"
|
|
19629
|
+
},
|
|
19630
|
+
children: p.file_name || p.doc_type || "Document"
|
|
19631
|
+
}
|
|
19632
|
+
),
|
|
19633
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "12px", color: MUTED2 }, children: [
|
|
19634
|
+
fields.length,
|
|
19635
|
+
" field",
|
|
19636
|
+
fields.length === 1 ? "" : "s",
|
|
19637
|
+
" extracted \xB7 ",
|
|
19638
|
+
pages.length,
|
|
19639
|
+
" page",
|
|
19640
|
+
pages.length === 1 ? "" : "s"
|
|
19641
|
+
] }),
|
|
19642
|
+
chips.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "5px" }, children: chips.map((c) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19643
|
+
"span",
|
|
19644
|
+
{
|
|
19645
|
+
style: {
|
|
19646
|
+
display: "inline-flex",
|
|
19647
|
+
alignItems: "center",
|
|
19648
|
+
gap: "4px",
|
|
19649
|
+
fontSize: "10px",
|
|
19650
|
+
fontWeight: 600,
|
|
19651
|
+
padding: "2px 7px",
|
|
19652
|
+
borderRadius: "9999px",
|
|
19653
|
+
background: hexToRgba2(c.color, 0.12),
|
|
19654
|
+
color: c.color
|
|
19655
|
+
},
|
|
19656
|
+
children: [
|
|
19657
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19658
|
+
"span",
|
|
19659
|
+
{
|
|
19660
|
+
style: {
|
|
19661
|
+
width: "6px",
|
|
19662
|
+
height: "6px",
|
|
19663
|
+
borderRadius: "9999px",
|
|
19664
|
+
background: c.color
|
|
19665
|
+
}
|
|
19666
|
+
}
|
|
19667
|
+
),
|
|
19668
|
+
c.n,
|
|
19669
|
+
" ",
|
|
19670
|
+
c.label
|
|
19671
|
+
]
|
|
19672
|
+
},
|
|
19673
|
+
c.label
|
|
19674
|
+
)) }),
|
|
19675
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19676
|
+
"span",
|
|
19677
|
+
{
|
|
19678
|
+
style: {
|
|
19679
|
+
marginTop: "2px",
|
|
19680
|
+
alignSelf: "flex-start",
|
|
19681
|
+
fontSize: "12px",
|
|
19682
|
+
fontWeight: 600,
|
|
19683
|
+
padding: "6px 12px",
|
|
19684
|
+
borderRadius: "0.5rem",
|
|
19685
|
+
background: "var(--foreground)",
|
|
19686
|
+
color: "white"
|
|
19687
|
+
},
|
|
19688
|
+
children: "View & edit fields"
|
|
19689
|
+
}
|
|
19690
|
+
)
|
|
19691
|
+
] })
|
|
19692
|
+
]
|
|
19693
|
+
}
|
|
19694
|
+
),
|
|
19695
|
+
/* @__PURE__ */ jsxRuntime.jsx(ExtractionModal, { open, onClose: () => setOpen(false), title, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19696
|
+
ExtractionDetail,
|
|
19697
|
+
{
|
|
19698
|
+
pages,
|
|
19699
|
+
orderedFields,
|
|
19700
|
+
fieldsByPage,
|
|
19701
|
+
selectedKey,
|
|
19702
|
+
setSelectedKey,
|
|
19703
|
+
onFieldSave: p.onFieldSave,
|
|
19704
|
+
correctionCounts,
|
|
19705
|
+
tab,
|
|
19706
|
+
setTab,
|
|
19707
|
+
editable,
|
|
19708
|
+
summary: p.summary,
|
|
19709
|
+
fileName: p.file_name,
|
|
19710
|
+
pageCount: p.page_count,
|
|
19711
|
+
pagesProcessed: p.pages_processed,
|
|
19712
|
+
auditEvents: p.auditEvents,
|
|
19713
|
+
auditLoading: p.auditLoading
|
|
19714
|
+
}
|
|
19715
|
+
) })
|
|
19716
|
+
]
|
|
19717
|
+
}
|
|
19718
|
+
);
|
|
19719
|
+
}
|
|
19720
|
+
init_ThemeContext();
|
|
17987
19721
|
var SEVERITY_COLORS = {
|
|
17988
19722
|
high: { color: "#dc2626", bg: "#fef2f2" },
|
|
17989
19723
|
medium: { color: "#f59e0b", bg: "#fff7ed" },
|
|
@@ -18014,8 +19748,8 @@ function formatAmount2(amount, currency = "USD") {
|
|
|
18014
19748
|
return `${sign}${symbol}${body}`;
|
|
18015
19749
|
}
|
|
18016
19750
|
function useContainerWidth2(ref) {
|
|
18017
|
-
const [w, setW] =
|
|
18018
|
-
|
|
19751
|
+
const [w, setW] = React45__default.default.useState(0);
|
|
19752
|
+
React45__default.default.useLayoutEffect(() => {
|
|
18019
19753
|
const el = ref.current;
|
|
18020
19754
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
18021
19755
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -18087,7 +19821,7 @@ function DecisionCardRenderer({
|
|
|
18087
19821
|
}) {
|
|
18088
19822
|
var _a, _b;
|
|
18089
19823
|
const { BORDER: BORDER4, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2 } = useTheme();
|
|
18090
|
-
const rootRef =
|
|
19824
|
+
const rootRef = React45__default.default.useRef(null);
|
|
18091
19825
|
const width = useContainerWidth2(rootRef);
|
|
18092
19826
|
const stacked = width > 0 && width < STACK_BELOW;
|
|
18093
19827
|
const options = (_a = data.options) != null ? _a : [];
|
|
@@ -18344,8 +20078,8 @@ function DecisionCardResolver(p) {
|
|
|
18344
20078
|
const decisionId = (_a = p.id) != null ? _a : p.title;
|
|
18345
20079
|
const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
|
|
18346
20080
|
const initial = (_c = hostResolved != null ? hostResolved : (_b = p.resolved) == null ? void 0 : _b.option) != null ? _c : null;
|
|
18347
|
-
const [localResolved, setLocalResolved] =
|
|
18348
|
-
|
|
20081
|
+
const [localResolved, setLocalResolved] = React45__default.default.useState(initial);
|
|
20082
|
+
React45__default.default.useEffect(() => {
|
|
18349
20083
|
if (hostResolved !== void 0) setLocalResolved(hostResolved);
|
|
18350
20084
|
}, [hostResolved]);
|
|
18351
20085
|
const resolved = hostResolved != null ? hostResolved : localResolved;
|
|
@@ -18487,6 +20221,8 @@ function resolveUI(rawPayload) {
|
|
|
18487
20221
|
return /* @__PURE__ */ jsxRuntime.jsx(PipelinePreviewResolver, __spreadValues({}, payload));
|
|
18488
20222
|
case "workflow-stepper":
|
|
18489
20223
|
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowStepperResolver, __spreadValues({}, payload));
|
|
20224
|
+
case "document-field-extraction":
|
|
20225
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DocumentFieldExtractionResolver, __spreadValues({}, payload));
|
|
18490
20226
|
case "decision-card":
|
|
18491
20227
|
return /* @__PURE__ */ jsxRuntime.jsx(DecisionCardResolver, __spreadValues({}, payload));
|
|
18492
20228
|
default: {
|