@adoptai/genui-components 0.1.68 → 0.1.69
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/download-card/resolver.cjs +152 -62
- package/dist/composites/download-card/resolver.cjs.map +1 -1
- package/dist/composites/download-card/resolver.js +94 -4
- package/dist/composites/download-card/resolver.js.map +1 -1
- package/dist/index.cjs +373 -283
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +160 -70
- package/dist/index.js.map +1 -1
- package/dist/renderer.cjs +305 -215
- package/dist/renderer.cjs.map +1 -1
- package/dist/renderer.js +154 -64
- package/dist/renderer.js.map +1 -1
- package/dist/resolver.cjs +304 -214
- package/dist/resolver.cjs.map +1 -1
- package/dist/resolver.js +154 -64
- package/dist/resolver.js.map +1 -1
- package/dist/shared/fileType.d.ts +1 -1
- package/dist/shared/fileType.d.ts.map +1 -1
- package/dist/shared/viewers/HtmlViewer.d.ts +12 -0
- package/dist/shared/viewers/HtmlViewer.d.ts.map +1 -0
- package/dist/shared/viewers/PreviewHost.d.ts.map +1 -1
- package/dist/tool-definitions.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import React46, { lazy, createContext, useMemo, useContext, useState, useCallback, useEffect, useRef, useLayoutEffect, Suspense } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import dagre from '@dagrejs/dagre';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
@@ -1952,6 +1952,89 @@ var init_DocxViewer = __esm({
|
|
|
1952
1952
|
}
|
|
1953
1953
|
});
|
|
1954
1954
|
|
|
1955
|
+
// src/shared/viewers/HtmlViewer.tsx
|
|
1956
|
+
var HtmlViewer_exports = {};
|
|
1957
|
+
__export(HtmlViewer_exports, {
|
|
1958
|
+
HtmlViewer: () => HtmlViewer
|
|
1959
|
+
});
|
|
1960
|
+
function HtmlViewer({ url, base64, height = 480 }) {
|
|
1961
|
+
const { MUTED: MUTED2 } = useTheme();
|
|
1962
|
+
const [html, setHtml] = useState("");
|
|
1963
|
+
const [loading, setLoading] = useState(true);
|
|
1964
|
+
const [error, setError] = useState(null);
|
|
1965
|
+
useEffect(() => {
|
|
1966
|
+
let cancelled = false;
|
|
1967
|
+
setLoading(true);
|
|
1968
|
+
setError(null);
|
|
1969
|
+
if (base64) {
|
|
1970
|
+
try {
|
|
1971
|
+
if (!cancelled) {
|
|
1972
|
+
setHtml(base64ToText(base64));
|
|
1973
|
+
setLoading(false);
|
|
1974
|
+
}
|
|
1975
|
+
} catch (e) {
|
|
1976
|
+
if (!cancelled) {
|
|
1977
|
+
setError(e instanceof Error ? e.message : "Failed to decode HTML");
|
|
1978
|
+
setLoading(false);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
return () => {
|
|
1982
|
+
cancelled = true;
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
if (!url) {
|
|
1986
|
+
setError("No file source provided");
|
|
1987
|
+
setLoading(false);
|
|
1988
|
+
return () => {
|
|
1989
|
+
cancelled = true;
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
fetch(url).then((r) => {
|
|
1993
|
+
if (!r.ok) throw new Error(`Failed to fetch: ${r.status}`);
|
|
1994
|
+
return r.text();
|
|
1995
|
+
}).then((t) => {
|
|
1996
|
+
if (cancelled) return;
|
|
1997
|
+
setHtml(t);
|
|
1998
|
+
setLoading(false);
|
|
1999
|
+
}).catch((e) => {
|
|
2000
|
+
if (cancelled) return;
|
|
2001
|
+
setError(e.message);
|
|
2002
|
+
setLoading(false);
|
|
2003
|
+
});
|
|
2004
|
+
return () => {
|
|
2005
|
+
cancelled = true;
|
|
2006
|
+
};
|
|
2007
|
+
}, [url, base64]);
|
|
2008
|
+
if (loading) {
|
|
2009
|
+
return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: MUTED2, fontSize: "13px", textAlign: "center" }, children: "Loading\u2026" });
|
|
2010
|
+
}
|
|
2011
|
+
if (error) {
|
|
2012
|
+
return /* @__PURE__ */ jsx("div", { style: { padding: "24px", color: "#dc2626", fontSize: "13px", textAlign: "center" }, children: error });
|
|
2013
|
+
}
|
|
2014
|
+
return /* @__PURE__ */ jsx(
|
|
2015
|
+
"iframe",
|
|
2016
|
+
{
|
|
2017
|
+
title: "HTML preview",
|
|
2018
|
+
sandbox: "",
|
|
2019
|
+
srcDoc: html,
|
|
2020
|
+
style: {
|
|
2021
|
+
width: "100%",
|
|
2022
|
+
height: `${height}px`,
|
|
2023
|
+
border: "none",
|
|
2024
|
+
background: "white",
|
|
2025
|
+
display: "block"
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
);
|
|
2029
|
+
}
|
|
2030
|
+
var init_HtmlViewer = __esm({
|
|
2031
|
+
"src/shared/viewers/HtmlViewer.tsx"() {
|
|
2032
|
+
"use client";
|
|
2033
|
+
init_ThemeContext();
|
|
2034
|
+
init_decode();
|
|
2035
|
+
}
|
|
2036
|
+
});
|
|
2037
|
+
|
|
1955
2038
|
// src/index.ts
|
|
1956
2039
|
init_ThemeContext();
|
|
1957
2040
|
var dataTableSchema = z.object({
|
|
@@ -7441,7 +7524,7 @@ function WaterfallChartResolver(p) {
|
|
|
7441
7524
|
}
|
|
7442
7525
|
init_ThemeContext();
|
|
7443
7526
|
init_theme();
|
|
7444
|
-
var FlowGraph2 =
|
|
7527
|
+
var FlowGraph2 = React46.lazy(
|
|
7445
7528
|
() => Promise.resolve().then(() => (init_FlowGraph(), FlowGraph_exports)).then((m) => ({ default: m.FlowGraph }))
|
|
7446
7529
|
);
|
|
7447
7530
|
function FlowCanvasRenderer({
|
|
@@ -7717,7 +7800,7 @@ function TrialBalanceResolver(p) {
|
|
|
7717
7800
|
gDebit += a.debit;
|
|
7718
7801
|
gCredit += a.credit;
|
|
7719
7802
|
});
|
|
7720
|
-
return /* @__PURE__ */ jsxs(
|
|
7803
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
7721
7804
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 4, style: {
|
|
7722
7805
|
padding: "8px 12px",
|
|
7723
7806
|
fontSize: "12px",
|
|
@@ -9109,10 +9192,10 @@ function useFullscreen(ref) {
|
|
|
9109
9192
|
init_theme();
|
|
9110
9193
|
init_ThemeContext();
|
|
9111
9194
|
init_pdfWorkerProbe();
|
|
9112
|
-
var PdfViewer2 =
|
|
9195
|
+
var PdfViewer2 = React46.lazy(
|
|
9113
9196
|
() => Promise.resolve().then(() => (init_PdfViewer(), PdfViewer_exports)).then((m) => ({ default: m.PdfViewer }))
|
|
9114
9197
|
);
|
|
9115
|
-
var ExcelViewer2 =
|
|
9198
|
+
var ExcelViewer2 = React46.lazy(
|
|
9116
9199
|
() => Promise.resolve().then(() => (init_ExcelViewer(), ExcelViewer_exports)).then((m) => ({ default: m.ExcelViewer }))
|
|
9117
9200
|
);
|
|
9118
9201
|
var highlightColors = {
|
|
@@ -10081,7 +10164,7 @@ function EngagementPipelineResolver(p) {
|
|
|
10081
10164
|
const color = (_a3 = statusColor2[phase.status]) != null ? _a3 : "#d6d3d1";
|
|
10082
10165
|
const isCurrent = i === activeIdx;
|
|
10083
10166
|
const size = isCurrent ? 28 : 20;
|
|
10084
|
-
return /* @__PURE__ */ jsxs(
|
|
10167
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
10085
10168
|
i > 0 && /* @__PURE__ */ jsx(
|
|
10086
10169
|
"div",
|
|
10087
10170
|
{
|
|
@@ -11801,7 +11884,7 @@ init_theme();
|
|
|
11801
11884
|
var FAMILIES = [
|
|
11802
11885
|
{ exts: ["csv", "tsv", "xls", "xlsx", "numbers"], fg: SEMANTIC.success.color, bg: SEMANTIC.success.bg },
|
|
11803
11886
|
{ exts: ["pdf"], fg: SEMANTIC.error.color, bg: SEMANTIC.error.bg },
|
|
11804
|
-
{ exts: ["doc", "docx", "txt", "md", "rtf", "pages"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg },
|
|
11887
|
+
{ exts: ["doc", "docx", "txt", "md", "rtf", "pages", "html", "htm"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg },
|
|
11805
11888
|
{ exts: ["json", "yaml", "yml", "xml", "toml"], fg: SEMANTIC.purple.color, bg: SEMANTIC.purple.bg },
|
|
11806
11889
|
{ exts: ["zip", "tar", "gz", "rar", "7z"], fg: SEMANTIC.warning.color, bg: SEMANTIC.warning.bg },
|
|
11807
11890
|
{ exts: ["png", "jpg", "jpeg", "gif", "svg", "webp", "bmp"], fg: SEMANTIC.info.color, bg: SEMANTIC.info.bg }
|
|
@@ -11828,7 +11911,9 @@ var PREVIEW_EXTS = {
|
|
|
11828
11911
|
txt: "text",
|
|
11829
11912
|
log: "text",
|
|
11830
11913
|
text: "text",
|
|
11831
|
-
docx: "docx"
|
|
11914
|
+
docx: "docx",
|
|
11915
|
+
html: "html",
|
|
11916
|
+
htm: "html"
|
|
11832
11917
|
};
|
|
11833
11918
|
function extOf(fileType, filename) {
|
|
11834
11919
|
var _a2;
|
|
@@ -11839,6 +11924,7 @@ function extOf(fileType, filename) {
|
|
|
11839
11924
|
if (mime.includes("csv")) return "csv";
|
|
11840
11925
|
if (mime.includes("markdown")) return "md";
|
|
11841
11926
|
if (mime.includes("wordprocessing") || mime.includes("msword")) return "docx";
|
|
11927
|
+
if (mime.includes("html")) return "html";
|
|
11842
11928
|
if (mime.startsWith("text/")) return "txt";
|
|
11843
11929
|
} else if (fileType) {
|
|
11844
11930
|
const t = fileType.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -11885,6 +11971,7 @@ var ExcelViewer3 = lazy(
|
|
|
11885
11971
|
var CsvViewer2 = lazy(() => Promise.resolve().then(() => (init_CsvViewer(), CsvViewer_exports)).then((m) => ({ default: m.CsvViewer })));
|
|
11886
11972
|
var TextViewer2 = lazy(() => Promise.resolve().then(() => (init_TextViewer(), TextViewer_exports)).then((m) => ({ default: m.TextViewer })));
|
|
11887
11973
|
var DocxViewer2 = lazy(() => Promise.resolve().then(() => (init_DocxViewer(), DocxViewer_exports)).then((m) => ({ default: m.DocxViewer })));
|
|
11974
|
+
var HtmlViewer2 = lazy(() => Promise.resolve().then(() => (init_HtmlViewer(), HtmlViewer_exports)).then((m) => ({ default: m.HtmlViewer })));
|
|
11888
11975
|
var PEEK_ROWS = 20;
|
|
11889
11976
|
var PEEK_LINES = 40;
|
|
11890
11977
|
function GatedPdfViewer({ source }) {
|
|
@@ -11924,6 +12011,9 @@ function PreviewHost({ kind, source, mode = "full" }) {
|
|
|
11924
12011
|
case "docx":
|
|
11925
12012
|
viewer = /* @__PURE__ */ jsx(DocxViewer2, { url: source.url, base64: source.base64 });
|
|
11926
12013
|
break;
|
|
12014
|
+
case "html":
|
|
12015
|
+
viewer = /* @__PURE__ */ jsx(HtmlViewer2, { url: source.url, base64: source.base64, height: peek ? 240 : 480 });
|
|
12016
|
+
break;
|
|
11927
12017
|
default:
|
|
11928
12018
|
return null;
|
|
11929
12019
|
}
|
|
@@ -12275,7 +12365,7 @@ function FileCard({
|
|
|
12275
12365
|
whiteSpace: "nowrap"
|
|
12276
12366
|
},
|
|
12277
12367
|
children: [
|
|
12278
|
-
metaTokens.map((t, i) => /* @__PURE__ */ jsxs(
|
|
12368
|
+
metaTokens.map((t, i) => /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
12279
12369
|
i > 0 && /* @__PURE__ */ jsx("span", { style: { color: MUTED2 }, children: "\xB7" }),
|
|
12280
12370
|
/* @__PURE__ */ jsx("span", { children: t })
|
|
12281
12371
|
] }, i)),
|
|
@@ -12854,7 +12944,7 @@ function KeyValueListResolver(p) {
|
|
|
12854
12944
|
var _a4;
|
|
12855
12945
|
return sum + ((_a4 = g.items) != null ? _a4 : []).length;
|
|
12856
12946
|
}, 0);
|
|
12857
|
-
return /* @__PURE__ */ jsxs(
|
|
12947
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
12858
12948
|
/* @__PURE__ */ jsxs(
|
|
12859
12949
|
"div",
|
|
12860
12950
|
{
|
|
@@ -13032,7 +13122,7 @@ function BalanceSheetResolver(p) {
|
|
|
13032
13122
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
13033
13123
|
((_p = p.sections) != null ? _p : []).map((section) => {
|
|
13034
13124
|
var _a3;
|
|
13035
|
-
return /* @__PURE__ */ jsxs(
|
|
13125
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13036
13126
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
|
|
13037
13127
|
padding: "8px 12px",
|
|
13038
13128
|
fontSize: "12px",
|
|
@@ -13045,7 +13135,7 @@ function BalanceSheetResolver(p) {
|
|
|
13045
13135
|
}, children: (_a3 = categoryLabels2[section.category]) != null ? _a3 : section.category }) }),
|
|
13046
13136
|
section.subsections.map((sub, si) => {
|
|
13047
13137
|
var _a4;
|
|
13048
|
-
return /* @__PURE__ */ jsxs(
|
|
13138
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13049
13139
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, style: {
|
|
13050
13140
|
padding: "6px 10px 6px 24px",
|
|
13051
13141
|
fontSize: "12px",
|
|
@@ -13221,7 +13311,7 @@ function IncomeStatementResolver(p) {
|
|
|
13221
13311
|
textAlign: "left",
|
|
13222
13312
|
whiteSpace: "nowrap"
|
|
13223
13313
|
}, children: "\xA0" }),
|
|
13224
|
-
periods.map((period) => /* @__PURE__ */ jsxs(
|
|
13314
|
+
periods.map((period) => /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13225
13315
|
/* @__PURE__ */ jsx("th", { style: {
|
|
13226
13316
|
fontSize: "11px",
|
|
13227
13317
|
fontWeight: 500,
|
|
@@ -13252,7 +13342,7 @@ function IncomeStatementResolver(p) {
|
|
|
13252
13342
|
sections.map((section, si) => {
|
|
13253
13343
|
var _a3;
|
|
13254
13344
|
const isSubtotal = section.sectionType === "subtotal";
|
|
13255
|
-
return /* @__PURE__ */ jsxs(
|
|
13345
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13256
13346
|
/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: colCount, style: {
|
|
13257
13347
|
padding: "8px 12px",
|
|
13258
13348
|
fontSize: "12px",
|
|
@@ -13283,7 +13373,7 @@ function IncomeStatementResolver(p) {
|
|
|
13283
13373
|
var _a5;
|
|
13284
13374
|
const val = (_a5 = amounts[pi]) != null ? _a5 : 0;
|
|
13285
13375
|
const isNeg = val < 0;
|
|
13286
|
-
return /* @__PURE__ */ jsxs(
|
|
13376
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13287
13377
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13288
13378
|
padding: "6px 10px",
|
|
13289
13379
|
fontSize: "13px",
|
|
@@ -13318,7 +13408,7 @@ function IncomeStatementResolver(p) {
|
|
|
13318
13408
|
var _a3;
|
|
13319
13409
|
const val = (_a3 = grossProfit[pi]) != null ? _a3 : 0;
|
|
13320
13410
|
const isNeg = val < 0;
|
|
13321
|
-
return /* @__PURE__ */ jsxs(
|
|
13411
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13322
13412
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13323
13413
|
padding: "8px 10px",
|
|
13324
13414
|
fontSize: "12px",
|
|
@@ -13353,7 +13443,7 @@ function IncomeStatementResolver(p) {
|
|
|
13353
13443
|
var _a3;
|
|
13354
13444
|
const val = (_a3 = operatingIncome[pi]) != null ? _a3 : 0;
|
|
13355
13445
|
const isNeg = val < 0;
|
|
13356
|
-
return /* @__PURE__ */ jsxs(
|
|
13446
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13357
13447
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13358
13448
|
padding: "8px 10px",
|
|
13359
13449
|
fontSize: "12px",
|
|
@@ -13387,7 +13477,7 @@ function IncomeStatementResolver(p) {
|
|
|
13387
13477
|
var _a3;
|
|
13388
13478
|
const val = (_a3 = netIncome[pi]) != null ? _a3 : 0;
|
|
13389
13479
|
const isNeg = val < 0;
|
|
13390
|
-
return /* @__PURE__ */ jsxs(
|
|
13480
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13391
13481
|
/* @__PURE__ */ jsx("td", { style: {
|
|
13392
13482
|
padding: "10px 10px",
|
|
13393
13483
|
fontSize: "13px",
|
|
@@ -13607,7 +13697,7 @@ function CashFlowStatementResolver(p) {
|
|
|
13607
13697
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
13608
13698
|
activities.map((activity, ai) => {
|
|
13609
13699
|
var _a3, _b2, _c2;
|
|
13610
|
-
return /* @__PURE__ */ jsxs(
|
|
13700
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
13611
13701
|
ai > 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
13612
13702
|
"td",
|
|
13613
13703
|
{
|
|
@@ -18147,8 +18237,8 @@ var CARD_MIN = 132;
|
|
|
18147
18237
|
var CARD_GAP = 16;
|
|
18148
18238
|
var AUTO_COMPACT_BELOW = 360;
|
|
18149
18239
|
function useContainerWidth(ref) {
|
|
18150
|
-
const [w, setW] =
|
|
18151
|
-
|
|
18240
|
+
const [w, setW] = React46.useState(0);
|
|
18241
|
+
React46.useLayoutEffect(() => {
|
|
18152
18242
|
const el = ref.current;
|
|
18153
18243
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
18154
18244
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -18251,15 +18341,15 @@ function WorkflowStepperRenderer({
|
|
|
18251
18341
|
const interactive = typeof onSelectStep === "function";
|
|
18252
18342
|
const statusColor3 = (s) => s === "active" || s === "running" ? ACCENT2 : STATUS_COLORS3[s];
|
|
18253
18343
|
const doneCount = steps.filter((s) => s.status === "done").length;
|
|
18254
|
-
const rootRef =
|
|
18344
|
+
const rootRef = React46.useRef(null);
|
|
18255
18345
|
const containerW = useContainerWidth(rootRef);
|
|
18256
18346
|
let resolved = density === "auto" ? "full" : density;
|
|
18257
18347
|
if (density === "auto" && containerW > 0) {
|
|
18258
18348
|
const needed = steps.length * CARD_MIN + Math.max(0, steps.length - 1) * CARD_GAP;
|
|
18259
18349
|
resolved = containerW < AUTO_COMPACT_BELOW || needed > containerW * 1.6 ? "compact" : "full";
|
|
18260
18350
|
}
|
|
18261
|
-
const scrollerRef =
|
|
18262
|
-
|
|
18351
|
+
const scrollerRef = React46.useRef(null);
|
|
18352
|
+
React46.useEffect(() => {
|
|
18263
18353
|
if (resolved !== "full" || loading) return;
|
|
18264
18354
|
const sc = scrollerRef.current;
|
|
18265
18355
|
if (!sc) return;
|
|
@@ -18270,11 +18360,11 @@ function WorkflowStepperRenderer({
|
|
|
18270
18360
|
el.scrollIntoView({ inline: "center", block: "nearest", behavior: "smooth" });
|
|
18271
18361
|
}
|
|
18272
18362
|
}, [resolved, loading, selectedStep, activeStepId]);
|
|
18273
|
-
const [edges, setEdges] =
|
|
18363
|
+
const [edges, setEdges] = React46.useState({
|
|
18274
18364
|
left: false,
|
|
18275
18365
|
right: false
|
|
18276
18366
|
});
|
|
18277
|
-
const updateEdges =
|
|
18367
|
+
const updateEdges = React46.useCallback(() => {
|
|
18278
18368
|
const sc = scrollerRef.current;
|
|
18279
18369
|
if (!sc) return;
|
|
18280
18370
|
const max = sc.scrollWidth - sc.clientWidth;
|
|
@@ -18283,7 +18373,7 @@ function WorkflowStepperRenderer({
|
|
|
18283
18373
|
const right = sl < max - 1;
|
|
18284
18374
|
setEdges((prev) => prev.left === left && prev.right === right ? prev : { left, right });
|
|
18285
18375
|
}, []);
|
|
18286
|
-
|
|
18376
|
+
React46.useLayoutEffect(() => {
|
|
18287
18377
|
if (resolved !== "full" || loading) return;
|
|
18288
18378
|
updateEdges();
|
|
18289
18379
|
const sc = scrollerRef.current;
|
|
@@ -18339,7 +18429,7 @@ function WorkflowStepperRenderer({
|
|
|
18339
18429
|
const reached = s.status !== "pending";
|
|
18340
18430
|
const clickable = interactive && reached;
|
|
18341
18431
|
const size = act ? 11 : done ? 9 : 8;
|
|
18342
|
-
return /* @__PURE__ */ jsxs(
|
|
18432
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
18343
18433
|
i > 0 && /* @__PURE__ */ jsx(
|
|
18344
18434
|
"span",
|
|
18345
18435
|
{
|
|
@@ -18483,7 +18573,7 @@ function WorkflowStepperRenderer({
|
|
|
18483
18573
|
const color = statusColor3(step.status);
|
|
18484
18574
|
const humans = ((_a3 = step.assignees) != null ? _a3 : []).filter((a) => a.kind === "human");
|
|
18485
18575
|
const roleCaption = humans.map((h) => h.role).filter(Boolean).slice(0, 2).join(" \xB7 ");
|
|
18486
|
-
return /* @__PURE__ */ jsxs(
|
|
18576
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
18487
18577
|
i > 0 && /* @__PURE__ */ jsx(
|
|
18488
18578
|
"div",
|
|
18489
18579
|
{
|
|
@@ -18849,11 +18939,11 @@ function FieldDetail({
|
|
|
18849
18939
|
}) {
|
|
18850
18940
|
var _a2, _b, _c, _d;
|
|
18851
18941
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2, SURFACE: SURFACE2, ACCENT: ACCENT2 } = useTheme();
|
|
18852
|
-
const [editing, setEditing] =
|
|
18853
|
-
const [draft, setDraft] =
|
|
18854
|
-
const [saving, setSaving] =
|
|
18855
|
-
const [saveError, setSaveError] =
|
|
18856
|
-
const textareaRef =
|
|
18942
|
+
const [editing, setEditing] = React46.useState(false);
|
|
18943
|
+
const [draft, setDraft] = React46.useState("");
|
|
18944
|
+
const [saving, setSaving] = React46.useState(false);
|
|
18945
|
+
const [saveError, setSaveError] = React46.useState(null);
|
|
18946
|
+
const textareaRef = React46.useRef(null);
|
|
18857
18947
|
const color = fieldColor(field, SECONDARY2);
|
|
18858
18948
|
const corrected = field.state === "corrected";
|
|
18859
18949
|
const startEdit = (e) => {
|
|
@@ -19363,7 +19453,7 @@ function FieldDetails({
|
|
|
19363
19453
|
},
|
|
19364
19454
|
children: facts.map((f) => {
|
|
19365
19455
|
var _a3;
|
|
19366
|
-
return /* @__PURE__ */ jsxs(
|
|
19456
|
+
return /* @__PURE__ */ jsxs(React46.Fragment, { children: [
|
|
19367
19457
|
/* @__PURE__ */ jsx("dt", { style: { fontSize: "12px", color: MUTED2 }, children: f.label }),
|
|
19368
19458
|
/* @__PURE__ */ jsxs(
|
|
19369
19459
|
"dd",
|
|
@@ -19462,7 +19552,7 @@ function FieldAuditLog({
|
|
|
19462
19552
|
fields = []
|
|
19463
19553
|
}) {
|
|
19464
19554
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
19465
|
-
const fieldLabelMap =
|
|
19555
|
+
const fieldLabelMap = React46.useMemo(() => {
|
|
19466
19556
|
var _a2;
|
|
19467
19557
|
const map = {};
|
|
19468
19558
|
for (const f of fields) map[f.field_key] = (_a2 = f.label) != null ? _a2 : f.field_key;
|
|
@@ -19661,10 +19751,10 @@ function PageOverlay({
|
|
|
19661
19751
|
secondary
|
|
19662
19752
|
}) {
|
|
19663
19753
|
const { PAPER: PAPER2, MUTED: MUTED2 } = useTheme();
|
|
19664
|
-
const imgRef =
|
|
19665
|
-
const selectedBoxRef =
|
|
19666
|
-
const [px, setPx] =
|
|
19667
|
-
|
|
19754
|
+
const imgRef = React46.useRef(null);
|
|
19755
|
+
const selectedBoxRef = React46.useRef(null);
|
|
19756
|
+
const [px, setPx] = React46.useState(null);
|
|
19757
|
+
React46.useEffect(() => {
|
|
19668
19758
|
const el = imgRef.current;
|
|
19669
19759
|
if (!el) return;
|
|
19670
19760
|
const measure = () => {
|
|
@@ -19678,7 +19768,7 @@ function PageOverlay({
|
|
|
19678
19768
|
ro.observe(el);
|
|
19679
19769
|
return () => ro.disconnect();
|
|
19680
19770
|
}, [page.imageUrl]);
|
|
19681
|
-
|
|
19771
|
+
React46.useEffect(() => {
|
|
19682
19772
|
if (!selectedKey) return;
|
|
19683
19773
|
if (!fields.some((f) => f.field_key === selectedKey && f.bbox)) return;
|
|
19684
19774
|
const el = selectedBoxRef.current;
|
|
@@ -19780,8 +19870,8 @@ function ExtractionDetail({
|
|
|
19780
19870
|
auditLoading
|
|
19781
19871
|
}) {
|
|
19782
19872
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SECONDARY: SECONDARY2 } = useTheme();
|
|
19783
|
-
const selectedCardRef =
|
|
19784
|
-
|
|
19873
|
+
const selectedCardRef = React46.useRef(null);
|
|
19874
|
+
React46.useEffect(() => {
|
|
19785
19875
|
if (!selectedKey || tab !== "fields") return;
|
|
19786
19876
|
const el = selectedCardRef.current;
|
|
19787
19877
|
if (el && typeof el.scrollIntoView === "function") {
|
|
@@ -19952,7 +20042,7 @@ function ExtractionModal({
|
|
|
19952
20042
|
children
|
|
19953
20043
|
}) {
|
|
19954
20044
|
const { BORDER: BORDER3, MUTED: MUTED2, SURFACE: SURFACE2, FOREGROUND: FOREGROUND2, SCRIM: SCRIM2 } = useTheme();
|
|
19955
|
-
|
|
20045
|
+
React46.useEffect(() => {
|
|
19956
20046
|
if (!open) return;
|
|
19957
20047
|
const onKey = (e) => {
|
|
19958
20048
|
if (e.key === "Escape") onClose();
|
|
@@ -20081,19 +20171,19 @@ function ExtractionModal({
|
|
|
20081
20171
|
function DocumentFieldExtractionResolver(p) {
|
|
20082
20172
|
var _a2, _b;
|
|
20083
20173
|
const { BORDER: BORDER3, MUTED: MUTED2, PAPER: PAPER2, SURFACE: SURFACE2, SHADOW: SHADOW2, ACCENT: ACCENT2 } = useTheme();
|
|
20084
|
-
const [selectedKey, setSelectedKey] =
|
|
20085
|
-
const [open, setOpen] =
|
|
20086
|
-
const [tab, setTab] =
|
|
20174
|
+
const [selectedKey, setSelectedKey] = React46.useState(null);
|
|
20175
|
+
const [open, setOpen] = React46.useState(false);
|
|
20176
|
+
const [tab, setTab] = React46.useState("fields");
|
|
20087
20177
|
const pages = (_a2 = p.pages) != null ? _a2 : [];
|
|
20088
20178
|
const fields = (_b = p.fields) != null ? _b : [];
|
|
20089
20179
|
const editable = typeof p.onFieldSave === "function";
|
|
20090
20180
|
const onLoadAudit = p.onLoadAudit;
|
|
20091
|
-
|
|
20181
|
+
React46.useEffect(() => {
|
|
20092
20182
|
if (tab === "audit" && onLoadAudit) {
|
|
20093
20183
|
onLoadAudit();
|
|
20094
20184
|
}
|
|
20095
20185
|
}, [tab, onLoadAudit]);
|
|
20096
|
-
const correctionCounts =
|
|
20186
|
+
const correctionCounts = React46.useMemo(() => {
|
|
20097
20187
|
var _a3, _b2;
|
|
20098
20188
|
const counts = {};
|
|
20099
20189
|
for (const ev of (_a3 = p.auditEvents) != null ? _a3 : []) {
|
|
@@ -20450,8 +20540,8 @@ function formatAmount2(amount, currency = "USD") {
|
|
|
20450
20540
|
return `${sign}${symbol}${body}`;
|
|
20451
20541
|
}
|
|
20452
20542
|
function useContainerWidth2(ref) {
|
|
20453
|
-
const [w, setW] =
|
|
20454
|
-
|
|
20543
|
+
const [w, setW] = React46.useState(0);
|
|
20544
|
+
React46.useLayoutEffect(() => {
|
|
20455
20545
|
const el = ref.current;
|
|
20456
20546
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
20457
20547
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -20546,8 +20636,8 @@ function ValueAdjuster({
|
|
|
20546
20636
|
const { SURFACE_MUTED: SURFACE_MUTED2 } = useTheme();
|
|
20547
20637
|
const adjust = option.adjust;
|
|
20548
20638
|
const suggested = clampToRange((_a2 = option.value) != null ? _a2 : adjust.min, adjust);
|
|
20549
|
-
const [value, setValue] =
|
|
20550
|
-
const [text, setText] =
|
|
20639
|
+
const [value, setValue] = React46.useState(suggested);
|
|
20640
|
+
const [text, setText] = React46.useState(String(suggested));
|
|
20551
20641
|
const step = (_b = adjust.step) != null ? _b : Number.isInteger(adjust.min) && Number.isInteger(adjust.max) ? 1 : (adjust.max - adjust.min) / 100;
|
|
20552
20642
|
const pct = adjust.max > adjust.min ? (value - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
20553
20643
|
const suggestedPct = adjust.max > adjust.min ? (suggested - adjust.min) / (adjust.max - adjust.min) * 100 : 0;
|
|
@@ -20753,10 +20843,10 @@ function DecisionCardRenderer({
|
|
|
20753
20843
|
}) {
|
|
20754
20844
|
var _a2, _b, _c;
|
|
20755
20845
|
const { BORDER: BORDER3, MUTED: MUTED2, ACCENT: ACCENT2, ACCENT_SOFT: ACCENT_SOFT2, SURFACE: SURFACE2, SURFACE_MUTED: SURFACE_MUTED2, SHADOW: SHADOW2 } = useTheme();
|
|
20756
|
-
const rootRef =
|
|
20846
|
+
const rootRef = React46.useRef(null);
|
|
20757
20847
|
const width = useContainerWidth2(rootRef);
|
|
20758
20848
|
const stacked = width > 0 && width < STACK_BELOW;
|
|
20759
|
-
const [adjustingIdx, setAdjustingIdx] =
|
|
20849
|
+
const [adjustingIdx, setAdjustingIdx] = React46.useState(null);
|
|
20760
20850
|
const options = (_a2 = data.options) != null ? _a2 : [];
|
|
20761
20851
|
const recommendedIdx = Math.max(
|
|
20762
20852
|
0,
|
|
@@ -21057,8 +21147,8 @@ function DecisionCardResolver(p) {
|
|
|
21057
21147
|
const decisionId = (_a2 = p.id) != null ? _a2 : p.title;
|
|
21058
21148
|
const hostResolved = resolvedDecisions == null ? void 0 : resolvedDecisions[decisionId];
|
|
21059
21149
|
const initial = hostResolved != null ? hostResolved : p.resolved ? composeResolution(p, p.resolved.option, p.resolved.value) : null;
|
|
21060
|
-
const [localResolved, setLocalResolved] =
|
|
21061
|
-
|
|
21150
|
+
const [localResolved, setLocalResolved] = React46.useState(initial);
|
|
21151
|
+
React46.useEffect(() => {
|
|
21062
21152
|
if (hostResolved !== void 0) setLocalResolved(hostResolved);
|
|
21063
21153
|
}, [hostResolved]);
|
|
21064
21154
|
const resolved = hostResolved != null ? hostResolved : localResolved;
|
|
@@ -21132,11 +21222,11 @@ function DecisionQueueRenderer({
|
|
|
21132
21222
|
var _a2;
|
|
21133
21223
|
const { BORDER: BORDER3, MUTED: MUTED2, ACCENT: ACCENT2, SURFACE: SURFACE2, SURFACE_MUTED: SURFACE_MUTED2, BORDER_SOFT: BORDER_SOFT2, PAPER: PAPER2, SHADOW: SHADOW2 } = useTheme();
|
|
21134
21224
|
const items = (_a2 = data.items) != null ? _a2 : [];
|
|
21135
|
-
const [decisions, setDecisions] =
|
|
21225
|
+
const [decisions, setDecisions] = React46.useState(
|
|
21136
21226
|
() => items.map(() => void 0)
|
|
21137
21227
|
);
|
|
21138
21228
|
const firstUndecided = decisions.findIndex((d) => !d);
|
|
21139
|
-
const [focusIdx, setFocusIdx] =
|
|
21229
|
+
const [focusIdx, setFocusIdx] = React46.useState(firstUndecided >= 0 ? firstUndecided : null);
|
|
21140
21230
|
const isSubmitted = submitted != null;
|
|
21141
21231
|
const shown = isSubmitted ? items.map(
|
|
21142
21232
|
(item, i) => {
|
|
@@ -21161,16 +21251,16 @@ function DecisionQueueRenderer({
|
|
|
21161
21251
|
const final = decisions;
|
|
21162
21252
|
onSubmit == null ? void 0 : onSubmit(final, composeQueueMessage(items, final));
|
|
21163
21253
|
};
|
|
21164
|
-
const onReadyRef =
|
|
21165
|
-
|
|
21254
|
+
const onReadyRef = React46.useRef(onReady);
|
|
21255
|
+
React46.useEffect(() => {
|
|
21166
21256
|
onReadyRef.current = onReady;
|
|
21167
21257
|
});
|
|
21168
|
-
|
|
21258
|
+
React46.useEffect(() => {
|
|
21169
21259
|
if (!onReadyRef.current) return;
|
|
21170
21260
|
const msg = allDecided ? composeQueueMessage(items, decisions) : null;
|
|
21171
21261
|
onReadyRef.current(allDecided && !isSubmitted, msg, decisions.filter(Boolean));
|
|
21172
21262
|
}, [decisions, allDecided, isSubmitted]);
|
|
21173
|
-
|
|
21263
|
+
React46.useEffect(() => {
|
|
21174
21264
|
if (!submitRef) return;
|
|
21175
21265
|
submitRef.current = handleSubmit;
|
|
21176
21266
|
return () => {
|
|
@@ -21395,7 +21485,7 @@ function DecisionQueueResolver(p) {
|
|
|
21395
21485
|
const { resolvedDecisions, onDecisionQueueSubmit } = useGenUIInteraction();
|
|
21396
21486
|
const queueId = (_b = (_a2 = p.id) != null ? _a2 : p.title) != null ? _b : "decision-queue";
|
|
21397
21487
|
const replayed = (_d = (_c = p.resolved) == null ? void 0 : _c.decisions) != null ? _d : null;
|
|
21398
|
-
const [localSubmitted, setLocalSubmitted] =
|
|
21488
|
+
const [localSubmitted, setLocalSubmitted] = React46.useState(null);
|
|
21399
21489
|
const hostLocked = (resolvedDecisions == null ? void 0 : resolvedDecisions[queueId]) != null;
|
|
21400
21490
|
const submitted = (_e = replayed != null ? replayed : localSubmitted) != null ? _e : hostLocked ? [] : null;
|
|
21401
21491
|
const handleSubmit = (decisions, message) => {
|
|
@@ -22231,7 +22321,7 @@ function DocGlyph({ color }) {
|
|
|
22231
22321
|
}
|
|
22232
22322
|
function FileUploadField({ field, value, onChange, disabled, onFileUpload, error, dense }) {
|
|
22233
22323
|
const { MUTED: MUTED2, ACCENT: ACCENT2, BORDER: BORDER3, PAPER: PAPER2, SURFACE: SURFACE2 } = useTheme();
|
|
22234
|
-
const keyRef =
|
|
22324
|
+
const keyRef = React46.useRef(0);
|
|
22235
22325
|
const [entries, setEntries] = useState(() => {
|
|
22236
22326
|
const arr = Array.isArray(value) ? value : value && typeof value === "object" ? [value] : [];
|
|
22237
22327
|
return arr.map((item) => {
|
|
@@ -22240,11 +22330,11 @@ function FileUploadField({ field, value, onChange, disabled, onFileUpload, error
|
|
|
22240
22330
|
return { key: keyRef.current += 1, name: (_b = (_a2 = r.filename) != null ? _a2 : r.name) != null ? _b : "file", size: r.size, status: "done", result: r };
|
|
22241
22331
|
});
|
|
22242
22332
|
});
|
|
22243
|
-
const entriesRef =
|
|
22333
|
+
const entriesRef = React46.useRef(entries);
|
|
22244
22334
|
entriesRef.current = entries;
|
|
22245
22335
|
const [dragOver, setDragOver] = useState(false);
|
|
22246
|
-
const inputRef =
|
|
22247
|
-
|
|
22336
|
+
const inputRef = React46.useRef(null);
|
|
22337
|
+
React46.useEffect(() => {
|
|
22248
22338
|
ensureFileUploadKeyframes();
|
|
22249
22339
|
}, []);
|
|
22250
22340
|
const interactive = !disabled;
|
|
@@ -22851,7 +22941,7 @@ function FieldRenderer({ field, value, onChange, disabled, error, onFileUpload,
|
|
|
22851
22941
|
] });
|
|
22852
22942
|
}
|
|
22853
22943
|
init_ThemeContext();
|
|
22854
|
-
var SlotErrorBoundary = class extends
|
|
22944
|
+
var SlotErrorBoundary = class extends React46.Component {
|
|
22855
22945
|
constructor(props) {
|
|
22856
22946
|
super(props);
|
|
22857
22947
|
this.state = { hasError: false };
|
|
@@ -23718,7 +23808,7 @@ function BuilderFormResolver({
|
|
|
23718
23808
|
}
|
|
23719
23809
|
}
|
|
23720
23810
|
function resolveBuilder(payload, callbacks) {
|
|
23721
|
-
return
|
|
23811
|
+
return React46.createElement(BuilderFormResolver, __spreadValues({
|
|
23722
23812
|
builder: payload
|
|
23723
23813
|
}, callbacks));
|
|
23724
23814
|
}
|