@agile-team/mach-report 2.14.0 → 2.15.0
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/README.md +16 -11
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-BKH1nGNS.js} +3 -3
- package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-Bs43BGNp.cjs} +1 -1
- package/dist/ParamEditor-Da4akw6V.cjs +1 -0
- package/dist/ParamEditor-DoAhzJsm.js +594 -0
- package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-BMf6boMA.js} +39 -39
- package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-wP9m9Pj1.cjs} +1 -1
- package/dist/ReportPreview-ChV19HBp.js +4619 -0
- package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
- package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
- package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-Sxr3eD0J.cjs} +1 -1
- package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-C_Clasvd.js} +5 -5
- package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-XhGHK8DE.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-D6Bkny59.js} +2 -2
- package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-JTSR53vJ.cjs} +1 -1
- package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-Kx35S0Ql.cjs} +1 -1
- package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-rVuK1kTz.js} +2 -2
- package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-B0ar9_zf.js} +2 -2
- package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dn6X9UmY.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +3 -1
- package/dist/analytics.d.ts +3 -1
- package/dist/analytics.js +154 -60
- package/dist/artifact-integrity.json +135 -0
- package/dist/assets-B9ImAi6_.cjs +1 -0
- package/dist/assets-DEaz4qsp.js +124 -0
- package/dist/batch-BaP6pWDE.cjs +1 -0
- package/dist/batch-BfZHN1do.js +220 -0
- package/dist/batch-CGyt-b2W.js +273 -0
- package/dist/batch-CLpELXBl.cjs +1 -0
- package/dist/capabilities-CAh2Nrue.cjs +1 -0
- package/dist/capabilities-DskCHs3V.js +69 -0
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
- package/dist/config-BVsJXSqS.js +842 -0
- package/dist/config-D10us76d.cjs +1 -0
- package/dist/data-explanation-B8MZRYVS.js +16 -0
- package/dist/data-explanation-DE55G30w.cjs +1 -0
- package/dist/designer-2bDlcNXQ.js +5136 -0
- package/dist/designer-BT7XCdbW.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +144 -16
- package/dist/designer.d.ts +144 -16
- package/dist/designer.js +1 -1
- package/dist/drill-ByJviLXS.js +145 -0
- package/dist/drill-DYTxuL3A.cjs +1 -0
- package/dist/{font-loader-vhCT8znW.cjs → font-loader-B_UkxpzC.cjs} +1 -1
- package/dist/{font-loader-DHto6Lra.js → font-loader-Q3bQjmrI.js} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +82 -4
- package/dist/index.d.ts +82 -4
- package/dist/index.js +785 -820
- package/dist/json-snapshot-DFb2eWkf.js +1416 -0
- package/dist/json-snapshot-WWSGlaHG.cjs +2 -0
- package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
- package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
- package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
- package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
- package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
- package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
- package/dist/licenses/_types_node-14.18.63.txt +22 -0
- package/dist/licenses/_types_pako-2.0.3.txt +22 -0
- package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
- package/dist/licenses/archiver-5.3.2.txt +23 -0
- package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
- package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
- package/dist/licenses/async-3.2.6.txt +20 -0
- package/dist/licenses/balanced-match-1.0.2.txt +22 -0
- package/dist/licenses/base64-js-1.5.1.txt +22 -0
- package/dist/licenses/big-integer-1.6.52.txt +25 -0
- package/dist/licenses/binary-0.3.0.txt +178 -0
- package/dist/licenses/bl-4.1.0.txt +14 -0
- package/dist/licenses/bluebird-3.4.7.txt +22 -0
- package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
- package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
- package/dist/licenses/buffer-5.7.1.txt +22 -0
- package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
- package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
- package/dist/licenses/buffers-0.1.1.txt +140 -0
- package/dist/licenses/chainsaw-0.1.0.txt +184 -0
- package/dist/licenses/compress-commons-4.1.2.txt +23 -0
- package/dist/licenses/concat-map-0.0.1.txt +19 -0
- package/dist/licenses/core-util-is-1.0.3.txt +20 -0
- package/dist/licenses/crc-32-1.2.2.txt +202 -0
- package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
- package/dist/licenses/dayjs-1.11.23.txt +22 -0
- package/dist/licenses/duplexer2-0.1.4.txt +27 -0
- package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
- package/dist/licenses/exceljs-4.4.0.txt +23 -0
- package/dist/licenses/fast-csv-4.3.6.txt +22 -0
- package/dist/licenses/fast-png-6.4.0.txt +22 -0
- package/dist/licenses/fs-constants-1.0.0.txt +22 -0
- package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
- package/dist/licenses/fstream-1.0.12.txt +16 -0
- package/dist/licenses/glob-7.2.3.txt +22 -0
- package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
- package/dist/licenses/ieee754-1.2.1.txt +12 -0
- package/dist/licenses/immediate-3.0.6.txt +21 -0
- package/dist/licenses/inflight-1.0.6.txt +16 -0
- package/dist/licenses/inherits-2.0.4.txt +17 -0
- package/dist/licenses/iobuffer-5.4.0.txt +23 -0
- package/dist/licenses/isarray-1.0.0.txt +61 -0
- package/dist/licenses/jszip-3.10.2.txt +652 -0
- package/dist/licenses/lazystream-1.0.1.txt +24 -0
- package/dist/licenses/lie-3.3.0.txt +8 -0
- package/dist/licenses/listenercount-1.0.1.txt +6 -0
- package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
- package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
- package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
- package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
- package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
- package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
- package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
- package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
- package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
- package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
- package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
- package/dist/licenses/lodash.union-4.6.0.txt +48 -0
- package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
- package/dist/licenses/minimatch-3.1.5.txt +16 -0
- package/dist/licenses/minimatch-5.1.9.txt +16 -0
- package/dist/licenses/minimist-1.2.8.txt +19 -0
- package/dist/licenses/mkdirp-0.5.6.txt +22 -0
- package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
- package/dist/licenses/normalize-path-3.0.0.txt +22 -0
- package/dist/licenses/once-1.4.0.txt +16 -0
- package/dist/licenses/pako-1.0.11.txt +22 -0
- package/dist/licenses/pako-2.2.0.txt +22 -0
- package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
- package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
- package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
- package/dist/licenses/readable-stream-2.3.8.txt +48 -0
- package/dist/licenses/readable-stream-3.6.2.txt +48 -0
- package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
- package/dist/licenses/rimraf-2.7.1.txt +16 -0
- package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
- package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
- package/dist/licenses/saxes-5.0.1.txt +397 -0
- package/dist/licenses/setimmediate-1.0.5.txt +21 -0
- package/dist/licenses/string_decoder-1.1.1.txt +49 -0
- package/dist/licenses/string_decoder-1.3.0.txt +49 -0
- package/dist/licenses/tar-stream-2.2.0.txt +22 -0
- package/dist/licenses/tmp-0.2.7.txt +22 -0
- package/dist/licenses/traverse-0.3.9.txt +25 -0
- package/dist/licenses/tslib-1.14.1.txt +13 -0
- package/dist/licenses/unzipper-0.10.14.txt +26 -0
- package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
- package/dist/licenses/uuid-11.1.1.txt +10 -0
- package/dist/licenses/wrappy-1.0.2.txt +16 -0
- package/dist/licenses/xmlchars-2.2.0.txt +19 -0
- package/dist/licenses/zip-stream-4.1.1.txt +23 -0
- package/dist/matrix-CGRGkn5s.js +112 -0
- package/dist/matrix-gEO7ZM_u.cjs +1 -0
- package/dist/media-B7vnpD8k.cjs +1 -0
- package/dist/media-Y90dHK9z.js +70 -0
- package/dist/param-validation-C3HlcLLO.cjs +1 -0
- package/dist/param-validation-Do7Eg8Zv.js +181 -0
- package/dist/{pdf-8UPQebOE.js → pdf-BwNyeGpt.js} +4385 -4321
- package/dist/{pdf-AyJGb22z.cjs → pdf-CvvrjPQg.cjs} +51 -49
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +18 -3
- package/dist/pdf.d.ts +18 -3
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BGKf-Tqg.js → plugin-Ca_XZG3l.js} +2 -2
- package/dist/{plugin-CktLH_Iy.cjs → plugin-DHO7X8z2.cjs} +1 -1
- package/dist/prepared-CFy9B75C.cjs +1 -0
- package/dist/prepared-ajM-H-9B.js +69 -0
- package/dist/progress-B0ctFpKf.cjs +1 -0
- package/dist/progress-D-OTpEav.js +52 -0
- package/dist/record-bindings-By_UKZ2g.cjs +1 -0
- package/dist/record-bindings-Do_b3h4V.js +196 -0
- package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-BMhK_TjP.js} +1 -1
- package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
- package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
- package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
- package/dist/sbom.cdx.json +3982 -0
- package/dist/server/node.d.cts +20 -1
- package/dist/server/node.d.ts +20 -1
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +247 -237
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +772 -4
- package/dist/server.d.ts +772 -4
- package/dist/server.js +885 -645
- package/dist/sha256-ArEYjaTI.cjs +1 -0
- package/dist/sha256-DPEuJ3nh.js +155 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-C2SpvsMU.js +58 -0
- package/dist/template-bindings-CEtWyiLX.cjs +1 -0
- package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
- package/dist/template-catalog-j2B1MJlL.js +414 -0
- package/dist/{template-fragments-CLkGo6To.js → template-fragments-BGbQLGlV.js} +21 -21
- package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-DcKeiylI.cjs} +1 -1
- package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
- package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
- package/dist/{template-registry-COXDEJEM.js → template-registry-BtaKPELV.js} +364 -201
- package/dist/template-registry-Co1zPq5e.cjs +1 -0
- package/dist/textwrap-CWHyzkBH.cjs +4 -0
- package/dist/textwrap-DE1kgcJB.js +110 -0
- package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
- package/dist/vue/async.d.cts +123 -14
- package/dist/vue/async.d.ts +123 -14
- package/dist/vue/index.d.cts +158 -22
- package/dist/vue/index.d.ts +158 -22
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +80 -78
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
- package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BvToI-Fd.js} +5440 -5288
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +20 -1
- package/dist/worker.d.ts +20 -1
- package/dist/worker.js +33 -32
- package/dist/xlsx-node.cjs +34 -34
- package/dist/xlsx-node.js +878 -870
- package/dist/xlsx.cjs +3 -4
- package/dist/xlsx.d.cts +22 -10
- package/dist/xlsx.d.ts +22 -10
- package/dist/xlsx.js +261 -253
- package/package.json +2 -2
- package/dist/ParamEditor-CflQV3eQ.js +0 -526
- package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
- package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
- package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
- package/dist/assets-C2U-e-Sz.cjs +0 -4
- package/dist/assets-Q0wUwNrV.js +0 -217
- package/dist/batch-DzaTNLWI.js +0 -371
- package/dist/batch-xMkqYiTr.cjs +0 -1
- package/dist/capabilities-CK_7hizc.js +0 -63
- package/dist/capabilities-CsZ-pNHR.cjs +0 -1
- package/dist/config-0UIohTS7.cjs +0 -1
- package/dist/config-Dt9NtCPl.js +0 -566
- package/dist/data-explanation-BktvER5B.cjs +0 -1
- package/dist/data-explanation-C_J6jYNi.js +0 -16
- package/dist/designer-Ci1LizA9.js +0 -5020
- package/dist/designer-rtmVIIdN.cjs +0 -2
- package/dist/json-snapshot-BeFT3Tso.js +0 -1952
- package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
- package/dist/matrix-DVyWiYsd.cjs +0 -1
- package/dist/matrix-yZsGnldA.js +0 -227
- package/dist/page-window-index-CIuT4BAv.js +0 -43
- package/dist/page-window-index-DEjnM6IB.cjs +0 -1
- package/dist/param-validation-BlHHXs6u.js +0 -153
- package/dist/param-validation-DCK039V1.cjs +0 -1
- package/dist/progress-7OSZbFok.js +0 -39
- package/dist/progress-BnLiS5eH.cjs +0 -1
- package/dist/task-events-DQ276fn2.cjs +0 -1
- package/dist/task-events-Dpsvf_t2.js +0 -47
- package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
- package/dist/template-bindings-Daui7hLF.js +0 -252
- package/dist/template-registry-D3SjENi6.cjs +0 -1
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-CkQBWCeg.js +0 -163
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { n as b } from "./capabilities-DskCHs3V.js";
|
|
2
|
+
import { a as y, w as I } from "./progress-D-OTpEav.js";
|
|
3
|
+
import { c as v, I as w } from "./media-Y90dHK9z.js";
|
|
4
|
+
class p extends Error {
|
|
5
|
+
constructor(e, r) {
|
|
6
|
+
super(e.message), this.name = "OutputAssetError", this.diagnostic = e, this.cause = r;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function h(n) {
|
|
10
|
+
if (n.aborted) throw n.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
11
|
+
}
|
|
12
|
+
function E(n) {
|
|
13
|
+
const e = { maxAssets: 1e3, maxImageBytes: 33554432, maxTotalImageBytes: 134217728, maxDurationMs: 3e4, ...n.assetBudget };
|
|
14
|
+
for (const [r, i] of Object.entries(e))
|
|
15
|
+
if (!Number.isSafeInteger(i) || i <= 0 || i > 2147483647) throw new RangeError(`${r} must be a positive safe integer at most 2147483647.`);
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
function A(n) {
|
|
19
|
+
const e = /^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(n);
|
|
20
|
+
if (!e) throw new TypeError("Asset renderers must return an image data URL.");
|
|
21
|
+
return e[1] ? Math.ceil(e[2].length * 3 / 4) : new TextEncoder().encode(decodeURIComponent(e[2])).byteLength;
|
|
22
|
+
}
|
|
23
|
+
function l(n, e, r, i, s) {
|
|
24
|
+
const t = { code: r, message: i, severity: "warning", format: n.options.format ?? "dom", pageIndex: e.pageIndex, componentIndex: e.componentIndex, componentPath: e.componentPath, kind: e.component.kind, nid: e.component.nid };
|
|
25
|
+
if (n.diagnostics.push(t), b(t, { ...n.options, signal: n.signal }), n.options.assetFailure !== "placeholder") throw new p(t, s);
|
|
26
|
+
}
|
|
27
|
+
async function D(n, e, r) {
|
|
28
|
+
const i = n.options.assetRenderers?.[e.kind];
|
|
29
|
+
if (e.imageData || !i) return e.imageData;
|
|
30
|
+
if (++n.rendered > n.budget.maxAssets) return l(n, r, "asset-budget-exceeded", "Output exceeded the asset count budget.");
|
|
31
|
+
let s;
|
|
32
|
+
try {
|
|
33
|
+
if (n.active = r, s = await I(i({ ...r, signal: n.signal }), n.signal), h(n.signal), s.length > n.budget.maxImageBytes * 4 + 1024) return l(n, r, "asset-budget-exceeded", "Output exceeded the image payload byte budget.");
|
|
34
|
+
const t = A(s);
|
|
35
|
+
if (t > n.budget.maxImageBytes || n.bytes + t > n.budget.maxTotalImageBytes) return l(n, r, "asset-budget-exceeded", "Output exceeded the encoded image byte budget.");
|
|
36
|
+
/^data:image\/(png|jpe?g);base64,/i.test(s) && n.inspectImage(s), n.bytes += t;
|
|
37
|
+
} catch (t) {
|
|
38
|
+
if (n.signal.aborted || t instanceof p || t instanceof w && t.code === "image-budget-exceeded") throw t;
|
|
39
|
+
return l(n, r, "asset-render-failed", `Asset renderer failed for ${e.kind}; output was not silently omitted.`, t);
|
|
40
|
+
}
|
|
41
|
+
return s;
|
|
42
|
+
}
|
|
43
|
+
function O(n, e) {
|
|
44
|
+
const r = n.active;
|
|
45
|
+
if (!r) {
|
|
46
|
+
e.abort(new Error("Asset rendering exceeded maxDurationMs."));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const i = { code: "asset-budget-exceeded", message: "Asset rendering exceeded maxDurationMs.", severity: "warning", format: n.options.format ?? "dom", pageIndex: r.pageIndex, componentIndex: r.componentIndex, componentPath: r.componentPath, kind: r.component.kind, nid: r.component.nid };
|
|
50
|
+
n.diagnostics.push(i);
|
|
51
|
+
try {
|
|
52
|
+
b(i, { ...n.options, signal: n.signal });
|
|
53
|
+
} catch (s) {
|
|
54
|
+
e.abort(s);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
e.abort(new p(i));
|
|
58
|
+
}
|
|
59
|
+
async function M(n, e, r, i, s) {
|
|
60
|
+
if (!e?.children?.length) return e;
|
|
61
|
+
const t = [];
|
|
62
|
+
for (const [a, d] of e.children.entries())
|
|
63
|
+
t.push(await x(n, d, { ...r, component: d, componentPath: [...i, a] }, s));
|
|
64
|
+
return t.some((a, d) => a !== e.children[d]) ? { ...e, children: t } : e;
|
|
65
|
+
}
|
|
66
|
+
async function x(n, e, r, i) {
|
|
67
|
+
if (h(n.signal), i.has(e)) throw new TypeError("Cyclic grid children cannot be rendered.");
|
|
68
|
+
let s = n.cache.get(e);
|
|
69
|
+
s || (s = D(n, e, r), n.cache.set(e, s));
|
|
70
|
+
const t = await s;
|
|
71
|
+
h(n.signal);
|
|
72
|
+
let a = e.grid;
|
|
73
|
+
if (a) {
|
|
74
|
+
const d = new Set(i).add(e), c = [];
|
|
75
|
+
for (const [g, o] of a.cells.entries()) {
|
|
76
|
+
const u = [];
|
|
77
|
+
for (const [m, f] of o.entries()) u.push(await M(n, f, r, [...r.componentPath, g, m], d));
|
|
78
|
+
c.push(u);
|
|
79
|
+
}
|
|
80
|
+
c.some((g, o) => g.some((u, m) => u !== a.cells[o][m])) && (a = { ...a, cells: c });
|
|
81
|
+
}
|
|
82
|
+
return t !== e.imageData || a !== e.grid ? { ...e, imageData: t, grid: a } : e;
|
|
83
|
+
}
|
|
84
|
+
function k(n, e, r) {
|
|
85
|
+
const i = /* @__PURE__ */ new Set(), s = (t) => {
|
|
86
|
+
if (y(r), !i.has(t)) {
|
|
87
|
+
if (i.add(t), t.imageData && /^data:image\/(png|jpe?g);base64,/i.test(t.imageData))
|
|
88
|
+
try {
|
|
89
|
+
e(t.imageData);
|
|
90
|
+
} catch (a) {
|
|
91
|
+
if (!(a instanceof w) || a.code === "image-budget-exceeded") throw a;
|
|
92
|
+
}
|
|
93
|
+
for (const a of t.grid?.cells ?? []) for (const d of a) for (const c of d?.children ?? []) s(c);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
for (const t of n.pages) for (const a of t.components) s(a);
|
|
97
|
+
}
|
|
98
|
+
async function C(n, e = {}) {
|
|
99
|
+
const r = E(e), i = v(e);
|
|
100
|
+
if (k(n, i, e.signal), e.signal?.aborted) throw e.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
101
|
+
const s = new AbortController(), t = () => s.abort(e.signal?.reason);
|
|
102
|
+
if (e.signal?.addEventListener("abort", t, { once: !0 }), !e.assetRenderers || !Object.keys(e.assetRenderers).length)
|
|
103
|
+
return e.signal?.removeEventListener("abort", t), { plan: n, diagnostics: [] };
|
|
104
|
+
const a = { options: e, signal: s.signal, diagnostics: [], rendered: 0, bytes: 0, budget: r, cache: /* @__PURE__ */ new WeakMap(), inspectImage: i }, d = setTimeout(() => O(a, s), r.maxDurationMs);
|
|
105
|
+
try {
|
|
106
|
+
const c = [];
|
|
107
|
+
for (const [g, o] of n.pages.entries()) {
|
|
108
|
+
if (g < (e.start ?? 0) || g > (e.end ?? n.pages.length - 1)) {
|
|
109
|
+
c.push(o);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const u = [];
|
|
113
|
+
for (const [m, f] of o.components.entries()) u.push(await x(a, f, { component: f, pageIndex: g, componentIndex: m, componentPath: [] }, /* @__PURE__ */ new Set()));
|
|
114
|
+
c.push(u.some((m, f) => m !== o.components[f]) ? { ...o, components: u } : o);
|
|
115
|
+
}
|
|
116
|
+
return h(a.signal), { plan: c.some((g, o) => g !== n.pages[o]) ? { ...n, pages: c } : n, diagnostics: a.diagnostics };
|
|
117
|
+
} finally {
|
|
118
|
+
clearTimeout(d), e.signal?.removeEventListener("abort", t);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
p as O,
|
|
123
|
+
C as r
|
|
124
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=require("./grid-geometry-CZ_cYB6O.cjs"),O=require("./number-format-CZ2T_5kF.cjs");function F(e){return!e||typeof e!="object"?!1:[e.pageIndex,e.componentIndex,e.rowIndex,e.columnIndex].every(t=>Number.isInteger(t)&&t>=0)}function N(e,t,r){const n=e.grid;if(!n)return null;const o=n.cells[t];if(!o)return null;const u=E.resolveGridLayout(n,e.widthMm,e.heightMm).cells.filter(l=>l.ri===t).findIndex(l=>l.ci===r),s=o[u];return s?{cell:s,sourceColumnIndex:u}:null}function j(e){return e.value!==void 0?e.value:e.rawText??e.text??null}function k(e,t){return e.valueType?e.valueType:typeof t=="number"?"number":typeof t=="boolean"?"boolean":t===null&&e.numberFormat&&/[0#?]/.test(e.numberFormat)?"number":"text"}function z(e,t){if(e.derived)return"derived";if(e.editable===!1)return"cell";if(e.formula!==void 0)return"formula";if(e.children?.length)return"complex";if(t.table&&t.table.role!=="body"&&e.editable!==!0)return"structure"}function B(e,t){const r=e.table;if(r)return{id:r.id,rowIndex:r.rowIndex+t.rowIndex,role:r.role,columnKey:r.columnKeys[t.columnIndex]}}function G(e,t,r){if(e.derived)return;if(e.source)return{...e.source};const n=t.table?.source,o=t.table?.columnKeys[r.columnIndex];if(!(!n||n.rowKey===void 0||o===void 0))return{...n,rowKey:n.rowKey,field:o}}function $(e,t,r){const n=j(r),o=z(r,e);return{address:{...t},cell:r,component:e,value:n,valueType:k(r,n),table:B(e,t),source:G(r,e,t),editable:o===void 0,readOnlyReason:o}}function g(e,t){if(!F(t))return null;const r=e.pages[t.pageIndex]?.components[t.componentIndex];if(!r)return null;const n=N(r,t.rowIndex,t.columnIndex);return n?$(r,t,n.cell):null}function v(e){const t=new Map;return r=>{if(!F(r))return null;const n=e.pages[r.pageIndex]?.components[r.componentIndex];if(!n?.grid)return null;let o=t.get(n);if(!o){const u=new Map;o=new Map;for(const s of E.resolveGridLayout(n.grid,n.widthMm,n.heightMm).cells){const l=u.get(s.ri)??0;u.set(s.ri,l+1);const c=n.grid.cells[s.ri]?.[l];c&&o.set(`${s.ri}:${s.ci}`,c)}t.set(n,o)}const i=o.get(`${r.rowIndex}:${r.columnIndex}`);return i?$(n,r,i):null}}class a extends Error{constructor(t){super(`Invalid report cell edit: ${t}`),this.code=t,this.name="ReportCellEditError"}}function J(e,t){let r=e.trim();const n=t&&r.endsWith("%");if(n&&(r=r.slice(0,-1).trim()),/^[+-]?\d{1,3}(?:,\d{3})+(?:\.\d*)?(?:[eE][+-]?\d+)?$/.test(r)&&(r=r.replace(/,/g,"")),!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(r))throw new a("number");return Number(r)/(n?100:1)}function L(e,t){if(e===null||typeof e=="string"&&e.trim()==="")return null;if(typeof e!="string"&&typeof e!="number")throw new a("number");const r=typeof e=="number"?e:J(e,O.isExcelPercentageFormat(t.cell.numberFormat));if(!Number.isFinite(r)||Number.isInteger(r)&&!Number.isSafeInteger(r))throw new a("number");return r}function A(e){if(e===null||typeof e=="string"&&e.trim()==="")return null;if(typeof e=="boolean")return e;const t=String(e).trim().toLowerCase();if(["true","yes","是","1"].includes(t))return!0;if(["false","no","否","0"].includes(t))return!1;throw new a("boolean")}function R(e,t){return e.valueType==="number"?L(t,e):e.valueType==="boolean"?A(t):t===null?null:String(t)}function P(e,t){const r=t.cell.text,o=[["是","否"],["TRUE","FALSE"],["True","False"],["true","false"],["1","0"]].find(i=>i.includes(r??""));return o?o[e?0:1]:String(e)}function b(e,t){return t===null?"":typeof t=="boolean"?P(t,e):typeof t=="number"?O.formatExcelNumber(t,e.cell.numberFormat):String(t)}function U(e,t,r){const n=g(e,t);if(!n)throw new a("missing");return I(n,r)}function I(e,t){if(!e.editable)throw new a("readonly");const r=R(e,t);return{address:{...e.address},table:e.table,source:e.source,previousValue:e.value,previousText:e.cell.text??"",value:r,text:b(e,r)}}function W(e,t){const r=e.table,n=t.table;return!r||!n||r.columnKey===void 0?!1:r.id===n.id&&r.rowIndex===n.rowIndex&&r.role===n.role&&r.columnKey===n.columnKey}function V(e,t,r){const n=e.grid,{rowIndex:o,columnIndex:i}=t.address,u=N(e,o,i),s=[...n.cells],l=[...s[o]],c=b(t,r.value),f={...u.cell,value:r.value,text:c,rawText:c};return l[u.sourceColumnIndex]=f,s[o]=l,{...e,grid:{...n,cells:s}}}function q(e,t){const r=e.table?.columnKeys,n=t.table?.columnKey;return r&&n!==void 0?r.flatMap((o,i)=>o===n?[i]:[]):[]}function D(e,t,r,n,o,i){const u=t.table,s=o.table;if(!u||!s||u.id!==s.id||u.role!==s.role||!t.grid)return t;const l=s.rowIndex-u.rowIndex;if(l<0||l>=t.grid.cells.length)return t;let c=t;for(const f of q(t,o)){const d=g(e,{pageIndex:r,componentIndex:n,rowIndex:l,columnIndex:f});d?.editable&&W(o,d)&&(c=V(c,d,i))}return c}function H(e,t,r,n,o,i){const u=o.address;return o.table?.columnKey!==void 0?D(e,t,r,n,o,i):u.pageIndex===r&&u.componentIndex===n?V(t,o,i):t}function K(e,t){const r=t.source;if(!r)return!1;const n=e.source;return!n||["sourceScope","datasetId","rowKey","field","revision","sourceToken"].some(o=>!Object.is(n[o],r[o]))}function Q(e,t){const r=g(e,t.address);if(!r)throw new a("missing");if(!r.editable)throw new a("readonly");if(K(r,t))throw new a("conflict");if(!Object.is(r.value,t.previousValue)||(r.cell.text??"")!==t.previousText)throw new a("conflict");const n=R(r,t.value),o={...t,value:n,text:b(r,n)};if(Object.is(n,r.value)&&o.text===r.cell.text)return e;const i=e.pages.map((u,s)=>{const l=u.components.map((c,f)=>H(e,c,s,f,r,o));return l.every((c,f)=>c===u.components[f])?u:{...u,components:l}});return{...e,pages:i}}function X(e){return JSON.stringify([e.pageIndex,e.componentIndex,e.rowIndex,e.columnIndex])}function M(e){const t=e.table;return t?.columnKey!==void 0?JSON.stringify([t.id,t.role,t.rowIndex,t.columnKey]):X(e.address)}function Y(e,t){if(!t.length)return e;const r=new Map(t.map(l=>[M(l),l])),n=new Set(t.flatMap(l=>l.table?[l.table.id]:[])),o=new Set(t.map(l=>`${l.address.pageIndex}:${l.address.componentIndex}`)),i=v(e);function u(l,c,f){const d=l.grid;if(!d||!o.has(`${c}:${f}`)&&!n.has(l.table?.id??""))return l;const p=new Map,S=new Map;for(const m of E.resolveGridLayout(d,l.widthMm,l.heightMm).cells){const y=S.get(m.ri)??0;S.set(m.ri,y+1);const w=i({pageIndex:c,componentIndex:f,rowIndex:m.ri,columnIndex:m.ci}),x=w&&r.get(M(w));if(!x||!w.editable)continue;const T=p.get(m.ri)??[...d.cells[m.ri]],C=b(w,x.value);Object.is(w.value,x.value)&&C===w.cell.text||(T[y]={...m.cell,value:x.value,text:C,rawText:C},p.set(m.ri,T))}return p.size?{...l,grid:{...d,cells:d.cells.map((m,y)=>p.get(y)??m)}}:l}const s=e.pages.map((l,c)=>{const f=l.components.map((d,p)=>u(d,c,p));return f.every((d,p)=>d===l.components[p])?l:{...l,components:f}});return s.every((l,c)=>l===e.pages[c])?e:{...e,pages:s}}function h(e){const t=e.source;if(t)return JSON.stringify([t.sourceScope,t.datasetId,t.rowKey,t.field]);const r=e.table;if(r?.columnKey!==void 0)return JSON.stringify([r.id,r.role,r.rowIndex,r.columnKey]);const n=e.address;return JSON.stringify([n.pageIndex,n.componentIndex,n.rowIndex,n.columnIndex])}function Z(e,t,r){if(typeof r!="string"||!r.trim()||!Array.isArray(t))throw new a("missing");if(t.length>1e4)throw new a("limit");const n=new Set,o=v(e),i=t.map(({address:u,value:s})=>{const l=o(u);if(!l)throw new a("missing");const c=I(l,s),f=h(c);if(n.has(f))throw new a("duplicate");return n.add(f),c});return{requestId:r,edits:i}}function _(e,t){if(t.edits.length>1e4)throw new a("limit");const r=v(e),n=new Set,o=t.edits.map(i=>{const u=r(i.address);if(!u)throw new a("missing");const s=h(i);if(n.has(s))throw new a("duplicate");if(n.add(s),K(u,i)||!Object.is(u.value,i.previousValue)||(u.cell.text??"")!==i.previousText)throw new a("conflict");return I(u,i.value)});return Y(e,o)}function ee(e){const t=new Map;for(const r of e){const n=h(r),o=t.get(n),i=o?{...r,previousValue:o.previousValue,previousText:o.previousText}:{...r};Object.is(i.previousValue,i.value)?t.delete(n):t.set(n,i)}return[...t.values()]}exports.ReportCellEditError=a;exports.applyReportCellEdit=Q;exports.applyReportCellEditBatch=_;exports.createReportCellEdit=U;exports.createReportCellEditBatch=Z;exports.createReportCellResolver=v;exports.editFromContext=I;exports.formatReportCellEdit=b;exports.getReportCellContext=g;exports.parseReportCellInput=R;exports.reportCellEditKey=h;exports.sourceChanged=K;exports.summarizeReportCellEdits=ee;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { b as x, t as N } from "./sha256-DPEuJ3nh.js";
|
|
2
|
+
function R(e = {}) {
|
|
3
|
+
const t = {
|
|
4
|
+
maxRecords: e.maxRecords ?? 1e4,
|
|
5
|
+
maxBytes: e.maxBytes ?? 67108864,
|
|
6
|
+
maxResultBytes: e.maxResultBytes ?? 262144,
|
|
7
|
+
controlReserveBytes: e.controlReserveBytes ?? 4096,
|
|
8
|
+
maxTombstones: e.maxTombstones ?? 1e4,
|
|
9
|
+
maxTombstoneBytes: e.maxTombstoneBytes ?? 16777216
|
|
10
|
+
};
|
|
11
|
+
if (!Object.values(t).every((n) => Number.isSafeInteger(n) && n > 0) || t.controlReserveBytes < 4096) throw new c("input", "任务容量应为正整数,控制状态预留至少4096字节");
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function b(e) {
|
|
15
|
+
return new TextEncoder().encode(d(e)).byteLength;
|
|
16
|
+
}
|
|
17
|
+
function A(e, t) {
|
|
18
|
+
const n = { scope: e.scope, id: e.id, revision: 1, request: e.request, status: "queued", createdAt: e.createdAt, updatedAt: e.createdAt, attempt: 0 }, r = { ...e };
|
|
19
|
+
delete r.result;
|
|
20
|
+
const a = e.result === void 0 ? 0 : b(e.result);
|
|
21
|
+
if (a > t.maxResultBytes) throw new c("capacity", "任务结果超过独立预算,请保存文件引用");
|
|
22
|
+
return Math.max(b(n) + t.controlReserveBytes, b(r)) + a;
|
|
23
|
+
}
|
|
24
|
+
function v(e) {
|
|
25
|
+
return e.status !== "queued" && e.status !== "running";
|
|
26
|
+
}
|
|
27
|
+
function B(e) {
|
|
28
|
+
const t = { ...e, tombstoneRetentionMs: e.tombstoneRetentionMs ?? 6048e5, limit: e.limit ?? 100 };
|
|
29
|
+
if (![t.now, t.terminalBefore].every((n) => Number.isSafeInteger(n) && n >= 0) || t.terminalBefore > t.now) throw new c("input", "终态清理时间应为不超过当前时间的非负整数");
|
|
30
|
+
if (![t.tombstoneRetentionMs, t.limit].every((n) => Number.isSafeInteger(n) && n > 0) || !Number.isSafeInteger(t.now + t.tombstoneRetentionMs)) throw new c("input", "幂等保留期与清理批量应为正整数");
|
|
31
|
+
return t;
|
|
32
|
+
}
|
|
33
|
+
async function O(e) {
|
|
34
|
+
const t = new TextEncoder().encode(d(e)), n = globalThis.crypto?.subtle;
|
|
35
|
+
if (!n) return x(t);
|
|
36
|
+
const r = await n.digest("SHA-256", t);
|
|
37
|
+
return Array.from(new Uint8Array(r), (a) => a.toString(16).padStart(2, "0")).join("");
|
|
38
|
+
}
|
|
39
|
+
async function J(e, t) {
|
|
40
|
+
if (!v(e)) throw new c("input", "只能归档终态任务");
|
|
41
|
+
return { scope: e.scope, id: e.id, revision: e.revision, status: e.status, createdAt: e.createdAt, updatedAt: e.updatedAt, attempt: e.attempt, requestHash: await O(e.request), expiresAt: t };
|
|
42
|
+
}
|
|
43
|
+
class c extends Error {
|
|
44
|
+
constructor(t, n) {
|
|
45
|
+
super(n), this.code = t, this.name = "ReportJobError";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function j(e, t) {
|
|
49
|
+
if (typeof e != "string" || !e.trim() || e.length > 256 || typeof t != "string" || t !== t.trim() || !/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t)) throw new c("input", "任务范围应非空,ID应为1–128位安全标识");
|
|
50
|
+
}
|
|
51
|
+
function q(e) {
|
|
52
|
+
const t = Array.isArray(e), n = Object.getPrototypeOf(e), r = Object.keys(e);
|
|
53
|
+
if (n !== (t ? Array.prototype : Object.prototype) && !(n === null && !t)) throw new c("input", "任务对象应为普通 JSON 对象");
|
|
54
|
+
if (Object.getOwnPropertySymbols(e).length) throw new c("input", "任务不能包含Symbol");
|
|
55
|
+
if (Object.getOwnPropertyNames(e).filter((i) => !(t && i === "length")).length !== r.length) throw new c("input", "任务不能包含不可枚举属性");
|
|
56
|
+
if (t && (r.length !== e.length || r.some((i) => i !== String(Number(i)) || !Number.isSafeInteger(Number(i)) || Number(i) < 0 || Number(i) >= e.length))) throw new c("input", "任务数组不能稀疏或包含额外属性");
|
|
57
|
+
return r.sort();
|
|
58
|
+
}
|
|
59
|
+
function I(e, t) {
|
|
60
|
+
const n = Object.getOwnPropertyDescriptor(e, t);
|
|
61
|
+
if (["__proto__", "prototype", "constructor"].includes(t) || n.get || n.set) throw new c("input", "任务不能包含危险键或访问器");
|
|
62
|
+
return n.value;
|
|
63
|
+
}
|
|
64
|
+
function d(e, t = {}) {
|
|
65
|
+
const n = t.maxNodes ?? 2e4, r = t.maxCharacters ?? 1e6;
|
|
66
|
+
if (!Number.isSafeInteger(n) || n < 1 || n > 2e4 || !Number.isSafeInteger(r) || r < 1 || r > 1e6) throw new c("input", "任务JSON预算无效");
|
|
67
|
+
let a = 0, i = 0;
|
|
68
|
+
const y = /* @__PURE__ */ new Set();
|
|
69
|
+
function w(s, u) {
|
|
70
|
+
if (++a > n || u > 32) throw new c("input", "任务数据超过节点或深度预算");
|
|
71
|
+
if (typeof s == "string") {
|
|
72
|
+
if (i += s.length, i > r) throw new c("input", "任务文本超过预算");
|
|
73
|
+
return s;
|
|
74
|
+
}
|
|
75
|
+
if (s === null || typeof s == "boolean" || typeof s == "number" && Number.isFinite(s)) return s;
|
|
76
|
+
if (!s || typeof s != "object" || y.has(s)) throw new c("input", "任务只允许无循环的有限 JSON 值");
|
|
77
|
+
const o = Array.isArray(s), p = q(s);
|
|
78
|
+
y.add(s);
|
|
79
|
+
const l = /* @__PURE__ */ Object.create(null);
|
|
80
|
+
for (const f of p) {
|
|
81
|
+
if (i += f.length, i > r) throw new c("input", "任务文本超过预算");
|
|
82
|
+
l[f] = w(I(s, f), u + 1);
|
|
83
|
+
}
|
|
84
|
+
return y.delete(s), o ? Array.from({ length: s.length }, (f, g) => l[String(g)]) : l;
|
|
85
|
+
}
|
|
86
|
+
const h = JSON.stringify(w(e, 0));
|
|
87
|
+
if (h.length > r) throw new c("input", "任务序列化数据超过字符预算");
|
|
88
|
+
return h;
|
|
89
|
+
}
|
|
90
|
+
function m(e) {
|
|
91
|
+
return JSON.parse(JSON.stringify(e));
|
|
92
|
+
}
|
|
93
|
+
function E(e, t, n, r) {
|
|
94
|
+
if (j(t, n), e.scope !== t || e.id !== n || e.revision !== (r ?? 0) + 1 || !Number.isSafeInteger(e.revision)) throw new c("input", "任务身份或修订不匹配");
|
|
95
|
+
if (![e.createdAt, e.updatedAt, e.attempt].every((a) => Number.isSafeInteger(a) && a >= 0) || !["queued", "running", "completed", "failed", "cancelled"].includes(e.status)) throw new c("input", "任务状态无效");
|
|
96
|
+
if (e.lease && (!e.lease.owner || !Number.isSafeInteger(e.lease.expiresAt))) throw new c("input", "任务租约无效");
|
|
97
|
+
if (!e.request || typeof e.request.kind != "string" || !e.request.kind.trim() || e.request.kind.length > 128) throw new c("input", "任务类型无效");
|
|
98
|
+
d(e.request.payload, { maxNodes: 19e3, maxCharacters: 75e4 }), d(e);
|
|
99
|
+
}
|
|
100
|
+
function T(e, t) {
|
|
101
|
+
if (e && (e.createdAt !== t.createdAt || d(e.request) !== d(t.request))) throw new c("input", "任务创建时间与请求不可变更,请使用新任务ID");
|
|
102
|
+
}
|
|
103
|
+
function M(e, t) {
|
|
104
|
+
return e.status === "queued" || e.status === "running" && (e.lease?.expiresAt ?? 0) <= t;
|
|
105
|
+
}
|
|
106
|
+
function k(e = {}) {
|
|
107
|
+
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = R(e);
|
|
108
|
+
let a = 0, i = 0, y = Promise.resolve();
|
|
109
|
+
const w = (s, u) => JSON.stringify([s, u]), h = (s) => {
|
|
110
|
+
const u = y.then(s);
|
|
111
|
+
return y = u.then(() => {
|
|
112
|
+
}, () => {
|
|
113
|
+
}), u;
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
read: async (s, u) => {
|
|
117
|
+
await y;
|
|
118
|
+
const o = t.get(w(s, u));
|
|
119
|
+
return o ? m(o) : void 0;
|
|
120
|
+
},
|
|
121
|
+
readTombstone: async (s, u) => {
|
|
122
|
+
await y;
|
|
123
|
+
const o = n.get(w(s, u));
|
|
124
|
+
return o ? m(o) : void 0;
|
|
125
|
+
},
|
|
126
|
+
candidates: async (s, u) => (await y, Array.from(t.values()).filter((o) => M(o, s)).sort((o, p) => o.createdAt - p.createdAt).slice(0, u).map(m)),
|
|
127
|
+
compareAndSwap: async (s, u, o, p) => {
|
|
128
|
+
E(p, s, u, o);
|
|
129
|
+
const l = m(p);
|
|
130
|
+
return h(async () => {
|
|
131
|
+
const f = w(s, u), g = t.get(f);
|
|
132
|
+
if ((g?.revision ?? null) !== o || n.has(f)) return !1;
|
|
133
|
+
T(g, l);
|
|
134
|
+
const S = a - (g ? A(g, r) : 0) + A(l, r);
|
|
135
|
+
if (S > r.maxBytes || !g && t.size >= r.maxRecords) throw new c("capacity", "任务容量已满,请清理终态任务或扩大显式预算");
|
|
136
|
+
return t.set(f, l), a = S, !0;
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
prune: async (s) => {
|
|
140
|
+
const u = B(s);
|
|
141
|
+
return h(async () => {
|
|
142
|
+
const o = { archived: 0, expired: 0 };
|
|
143
|
+
for (const [p, l] of n)
|
|
144
|
+
l.expiresAt > u.now || o.expired >= u.limit || (n.delete(p), i -= b(l), o.expired++);
|
|
145
|
+
for (const [p, l] of t) {
|
|
146
|
+
if (!v(l) || l.updatedAt > u.terminalBefore || o.archived + o.expired >= u.limit) continue;
|
|
147
|
+
const f = await J(l, u.now + u.tombstoneRetentionMs), g = b(f);
|
|
148
|
+
if (n.size >= r.maxTombstones || i + g > r.maxTombstoneBytes) break;
|
|
149
|
+
n.set(p, f), i += g, t.delete(p), a -= A(l, r), o.archived++;
|
|
150
|
+
}
|
|
151
|
+
return o;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function C(e, t = 100) {
|
|
157
|
+
if (!Number.isSafeInteger(t) || t < 1 || t > 1e3 || !Array.isArray(e) || e.length > t) throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");
|
|
158
|
+
const n = JSON.parse(d(e)), r = /* @__PURE__ */ new Set();
|
|
159
|
+
for (const a of n) {
|
|
160
|
+
if (!a || typeof a.id != "string" || a.id !== a.id.trim() || !/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(a.id) || r.has(a.id)) throw new TypeError("批量行 ID 应唯一且为安全标识");
|
|
161
|
+
if (!a.params || Array.isArray(a.params) || typeof a.params != "object" || Object.values(a.params).some((i) => typeof i != "string")) throw new TypeError("批量参数应为字符串字典");
|
|
162
|
+
r.add(a.id);
|
|
163
|
+
}
|
|
164
|
+
return n;
|
|
165
|
+
}
|
|
166
|
+
function z(e, t) {
|
|
167
|
+
if (!t) return;
|
|
168
|
+
const n = { completed: 0, total: e.length, failed: 0, cancelled: 0 };
|
|
169
|
+
for (const r of e)
|
|
170
|
+
r && (n.completed++, r.status === "failed" && n.failed++, r.status === "cancelled" && n.cancelled++);
|
|
171
|
+
try {
|
|
172
|
+
t(n);
|
|
173
|
+
} catch {
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async function _(e, t, n = {}) {
|
|
177
|
+
const r = n.concurrency ?? 2;
|
|
178
|
+
if (!Number.isSafeInteger(r) || r < 1 || r > 16) throw new RangeError("批量并发应为 1–16");
|
|
179
|
+
if (n.failure !== void 0 && n.failure !== "continue" && n.failure !== "stop") throw new TypeError("批量失败策略无效");
|
|
180
|
+
const a = C(e, n.maxCases ?? 100);
|
|
181
|
+
if (!a.length) throw new RangeError("批量生成至少需要一组参数");
|
|
182
|
+
const i = Array.from({ length: a.length }), y = new AbortController(), w = () => y.abort(n.signal?.reason);
|
|
183
|
+
n.signal?.addEventListener("abort", w, { once: !0 }), n.signal?.aborted && w();
|
|
184
|
+
let h = 0, s = !1;
|
|
185
|
+
async function u() {
|
|
186
|
+
for (; h < a.length; ) {
|
|
187
|
+
const o = h++, p = a[o], l = { id: p.id, index: o };
|
|
188
|
+
if (s || y.signal.aborted) i[o] = { ...l, status: "cancelled" };
|
|
189
|
+
else
|
|
190
|
+
try {
|
|
191
|
+
N(y.signal);
|
|
192
|
+
const f = await t(p, { index: o, signal: y.signal });
|
|
193
|
+
i[o] = { ...l, status: "completed", value: f };
|
|
194
|
+
} catch (f) {
|
|
195
|
+
y.signal.aborted ? i[o] = { ...l, status: "cancelled" } : (i[o] = { ...l, status: "failed", error: { name: f instanceof Error ? f.name : "Error", message: f instanceof Error ? f.message : String(f) } }, n.failure === "stop" && (s = !0));
|
|
196
|
+
}
|
|
197
|
+
z(i, n.onProgress);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
await Promise.all(Array.from({ length: Math.min(r, a.length) }, u));
|
|
202
|
+
} finally {
|
|
203
|
+
n.signal?.removeEventListener("abort", w);
|
|
204
|
+
}
|
|
205
|
+
return i;
|
|
206
|
+
}
|
|
207
|
+
export {
|
|
208
|
+
c as R,
|
|
209
|
+
m as a,
|
|
210
|
+
O as b,
|
|
211
|
+
j as c,
|
|
212
|
+
k as d,
|
|
213
|
+
M as e,
|
|
214
|
+
C as f,
|
|
215
|
+
T as g,
|
|
216
|
+
b as j,
|
|
217
|
+
_ as r,
|
|
218
|
+
d as s,
|
|
219
|
+
E as v
|
|
220
|
+
};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { r as v } from "./grid-geometry-BNptEcMm.js";
|
|
2
|
+
import { f as V, i as j } from "./number-format-BA_KwrZe.js";
|
|
3
|
+
function R(e) {
|
|
4
|
+
return !e || typeof e != "object" ? !1 : [e.pageIndex, e.componentIndex, e.rowIndex, e.columnIndex].every((t) => Number.isInteger(t) && t >= 0);
|
|
5
|
+
}
|
|
6
|
+
function M(e, t, r) {
|
|
7
|
+
const n = e.grid;
|
|
8
|
+
if (!n) return null;
|
|
9
|
+
const o = n.cells[t];
|
|
10
|
+
if (!o) return null;
|
|
11
|
+
const u = v(n, e.widthMm, e.heightMm).cells.filter((i) => i.ri === t).findIndex((i) => i.ci === r), s = o[u];
|
|
12
|
+
return s ? { cell: s, sourceColumnIndex: u } : null;
|
|
13
|
+
}
|
|
14
|
+
function k(e) {
|
|
15
|
+
return e.value !== void 0 ? e.value : e.rawText ?? e.text ?? null;
|
|
16
|
+
}
|
|
17
|
+
function J(e, t) {
|
|
18
|
+
return e.valueType ? e.valueType : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t === null && e.numberFormat && /[0#?]/.test(e.numberFormat) ? "number" : "text";
|
|
19
|
+
}
|
|
20
|
+
function z(e, t) {
|
|
21
|
+
if (e.derived) return "derived";
|
|
22
|
+
if (e.editable === !1) return "cell";
|
|
23
|
+
if (e.formula !== void 0) return "formula";
|
|
24
|
+
if (e.children?.length) return "complex";
|
|
25
|
+
if (t.table && t.table.role !== "body" && e.editable !== !0) return "structure";
|
|
26
|
+
}
|
|
27
|
+
function A(e, t) {
|
|
28
|
+
const r = e.table;
|
|
29
|
+
if (r)
|
|
30
|
+
return {
|
|
31
|
+
id: r.id,
|
|
32
|
+
rowIndex: r.rowIndex + t.rowIndex,
|
|
33
|
+
role: r.role,
|
|
34
|
+
columnKey: r.columnKeys[t.columnIndex]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function B(e, t, r) {
|
|
38
|
+
if (e.derived) return;
|
|
39
|
+
if (e.source) return { ...e.source };
|
|
40
|
+
const n = t.table?.source, o = t.table?.columnKeys[r.columnIndex];
|
|
41
|
+
if (!(!n || n.rowKey === void 0 || o === void 0))
|
|
42
|
+
return { ...n, rowKey: n.rowKey, field: o };
|
|
43
|
+
}
|
|
44
|
+
function O(e, t, r) {
|
|
45
|
+
const n = k(r), o = z(r, e);
|
|
46
|
+
return {
|
|
47
|
+
address: { ...t },
|
|
48
|
+
cell: r,
|
|
49
|
+
component: e,
|
|
50
|
+
value: n,
|
|
51
|
+
valueType: J(r, n),
|
|
52
|
+
table: A(e, t),
|
|
53
|
+
source: B(r, e, t),
|
|
54
|
+
editable: o === void 0,
|
|
55
|
+
readOnlyReason: o
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function I(e, t) {
|
|
59
|
+
if (!R(t)) return null;
|
|
60
|
+
const r = e.pages[t.pageIndex]?.components[t.componentIndex];
|
|
61
|
+
if (!r) return null;
|
|
62
|
+
const n = M(r, t.rowIndex, t.columnIndex);
|
|
63
|
+
return n ? O(r, t, n.cell) : null;
|
|
64
|
+
}
|
|
65
|
+
function h(e) {
|
|
66
|
+
const t = /* @__PURE__ */ new Map();
|
|
67
|
+
return (r) => {
|
|
68
|
+
if (!R(r)) return null;
|
|
69
|
+
const n = e.pages[r.pageIndex]?.components[r.componentIndex];
|
|
70
|
+
if (!n?.grid) return null;
|
|
71
|
+
let o = t.get(n);
|
|
72
|
+
if (!o) {
|
|
73
|
+
const u = /* @__PURE__ */ new Map();
|
|
74
|
+
o = /* @__PURE__ */ new Map();
|
|
75
|
+
for (const s of v(n.grid, n.widthMm, n.heightMm).cells) {
|
|
76
|
+
const i = u.get(s.ri) ?? 0;
|
|
77
|
+
u.set(s.ri, i + 1);
|
|
78
|
+
const c = n.grid.cells[s.ri]?.[i];
|
|
79
|
+
c && o.set(`${s.ri}:${s.ci}`, c);
|
|
80
|
+
}
|
|
81
|
+
t.set(n, o);
|
|
82
|
+
}
|
|
83
|
+
const l = o.get(`${r.rowIndex}:${r.columnIndex}`);
|
|
84
|
+
return l ? O(n, r, l) : null;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
class a extends Error {
|
|
88
|
+
constructor(t) {
|
|
89
|
+
super(`Invalid report cell edit: ${t}`), this.code = t, this.name = "ReportCellEditError";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function L(e, t) {
|
|
93
|
+
let r = e.trim();
|
|
94
|
+
const n = t && r.endsWith("%");
|
|
95
|
+
if (n && (r = r.slice(0, -1).trim()), /^[+-]?\d{1,3}(?:,\d{3})+(?:\.\d*)?(?:[eE][+-]?\d+)?$/.test(r) && (r = r.replace(/,/g, "")), !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(r)) throw new a("number");
|
|
96
|
+
return Number(r) / (n ? 100 : 1);
|
|
97
|
+
}
|
|
98
|
+
function G(e, t) {
|
|
99
|
+
if (e === null || typeof e == "string" && e.trim() === "") return null;
|
|
100
|
+
if (typeof e != "string" && typeof e != "number") throw new a("number");
|
|
101
|
+
const r = typeof e == "number" ? e : L(e, j(t.cell.numberFormat));
|
|
102
|
+
if (!Number.isFinite(r) || Number.isInteger(r) && !Number.isSafeInteger(r)) throw new a("number");
|
|
103
|
+
return r;
|
|
104
|
+
}
|
|
105
|
+
function P(e) {
|
|
106
|
+
if (e === null || typeof e == "string" && e.trim() === "") return null;
|
|
107
|
+
if (typeof e == "boolean") return e;
|
|
108
|
+
const t = String(e).trim().toLowerCase();
|
|
109
|
+
if (["true", "yes", "是", "1"].includes(t)) return !0;
|
|
110
|
+
if (["false", "no", "否", "0"].includes(t)) return !1;
|
|
111
|
+
throw new a("boolean");
|
|
112
|
+
}
|
|
113
|
+
function N(e, t) {
|
|
114
|
+
return e.valueType === "number" ? G(t, e) : e.valueType === "boolean" ? P(t) : t === null ? null : String(t);
|
|
115
|
+
}
|
|
116
|
+
function U(e, t) {
|
|
117
|
+
const r = t.cell.text, o = [["是", "否"], ["TRUE", "FALSE"], ["True", "False"], ["true", "false"], ["1", "0"]].find((l) => l.includes(r ?? ""));
|
|
118
|
+
return o ? o[e ? 0 : 1] : String(e);
|
|
119
|
+
}
|
|
120
|
+
function x(e, t) {
|
|
121
|
+
return t === null ? "" : typeof t == "boolean" ? U(t, e) : typeof t == "number" ? V(t, e.cell.numberFormat) : String(t);
|
|
122
|
+
}
|
|
123
|
+
function q(e, t, r) {
|
|
124
|
+
const n = I(e, t);
|
|
125
|
+
if (!n) throw new a("missing");
|
|
126
|
+
return C(n, r);
|
|
127
|
+
}
|
|
128
|
+
function C(e, t) {
|
|
129
|
+
if (!e.editable) throw new a("readonly");
|
|
130
|
+
const r = N(e, t);
|
|
131
|
+
return {
|
|
132
|
+
address: { ...e.address },
|
|
133
|
+
table: e.table,
|
|
134
|
+
source: e.source,
|
|
135
|
+
previousValue: e.value,
|
|
136
|
+
previousText: e.cell.text ?? "",
|
|
137
|
+
value: r,
|
|
138
|
+
text: x(e, r)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function W(e, t) {
|
|
142
|
+
const r = e.table, n = t.table;
|
|
143
|
+
return !r || !n || r.columnKey === void 0 ? !1 : r.id === n.id && r.rowIndex === n.rowIndex && r.role === n.role && r.columnKey === n.columnKey;
|
|
144
|
+
}
|
|
145
|
+
function $(e, t, r) {
|
|
146
|
+
const n = e.grid, { rowIndex: o, columnIndex: l } = t.address, u = M(e, o, l), s = [...n.cells], i = [...s[o]], c = x(t, r.value), f = { ...u.cell, value: r.value, text: c, rawText: c };
|
|
147
|
+
return i[u.sourceColumnIndex] = f, s[o] = i, { ...e, grid: { ...n, cells: s } };
|
|
148
|
+
}
|
|
149
|
+
function D(e, t) {
|
|
150
|
+
const r = e.table?.columnKeys, n = t.table?.columnKey;
|
|
151
|
+
return r && n !== void 0 ? r.flatMap((o, l) => o === n ? [l] : []) : [];
|
|
152
|
+
}
|
|
153
|
+
function H(e, t, r, n, o, l) {
|
|
154
|
+
const u = t.table, s = o.table;
|
|
155
|
+
if (!u || !s || u.id !== s.id || u.role !== s.role || !t.grid) return t;
|
|
156
|
+
const i = s.rowIndex - u.rowIndex;
|
|
157
|
+
if (i < 0 || i >= t.grid.cells.length) return t;
|
|
158
|
+
let c = t;
|
|
159
|
+
for (const f of D(t, o)) {
|
|
160
|
+
const d = I(e, { pageIndex: r, componentIndex: n, rowIndex: i, columnIndex: f });
|
|
161
|
+
d?.editable && W(o, d) && (c = $(c, d, l));
|
|
162
|
+
}
|
|
163
|
+
return c;
|
|
164
|
+
}
|
|
165
|
+
function Q(e, t, r, n, o, l) {
|
|
166
|
+
const u = o.address;
|
|
167
|
+
return o.table?.columnKey !== void 0 ? H(e, t, r, n, o, l) : u.pageIndex === r && u.componentIndex === n ? $(t, o, l) : t;
|
|
168
|
+
}
|
|
169
|
+
function F(e, t) {
|
|
170
|
+
const r = t.source;
|
|
171
|
+
if (!r) return !1;
|
|
172
|
+
const n = e.source;
|
|
173
|
+
return !n || ["sourceScope", "datasetId", "rowKey", "field", "revision", "sourceToken"].some((o) => !Object.is(n[o], r[o]));
|
|
174
|
+
}
|
|
175
|
+
function ee(e, t) {
|
|
176
|
+
const r = I(e, t.address);
|
|
177
|
+
if (!r) throw new a("missing");
|
|
178
|
+
if (!r.editable) throw new a("readonly");
|
|
179
|
+
if (F(r, t)) throw new a("conflict");
|
|
180
|
+
if (!Object.is(r.value, t.previousValue) || (r.cell.text ?? "") !== t.previousText) throw new a("conflict");
|
|
181
|
+
const n = N(r, t.value), o = { ...t, value: n, text: x(r, n) };
|
|
182
|
+
if (Object.is(n, r.value) && o.text === r.cell.text) return e;
|
|
183
|
+
const l = e.pages.map((u, s) => {
|
|
184
|
+
const i = u.components.map((c, f) => Q(e, c, s, f, r, o));
|
|
185
|
+
return i.every((c, f) => c === u.components[f]) ? u : { ...u, components: i };
|
|
186
|
+
});
|
|
187
|
+
return { ...e, pages: l };
|
|
188
|
+
}
|
|
189
|
+
function X(e) {
|
|
190
|
+
return JSON.stringify([e.pageIndex, e.componentIndex, e.rowIndex, e.columnIndex]);
|
|
191
|
+
}
|
|
192
|
+
function T(e) {
|
|
193
|
+
const t = e.table;
|
|
194
|
+
return t?.columnKey !== void 0 ? JSON.stringify([t.id, t.role, t.rowIndex, t.columnKey]) : X(e.address);
|
|
195
|
+
}
|
|
196
|
+
function Y(e, t) {
|
|
197
|
+
if (!t.length) return e;
|
|
198
|
+
const r = new Map(t.map((i) => [T(i), i])), n = new Set(t.flatMap((i) => i.table ? [i.table.id] : [])), o = new Set(t.map((i) => `${i.address.pageIndex}:${i.address.componentIndex}`)), l = h(e);
|
|
199
|
+
function u(i, c, f) {
|
|
200
|
+
const d = i.grid;
|
|
201
|
+
if (!d || !o.has(`${c}:${f}`) && !n.has(i.table?.id ?? "")) return i;
|
|
202
|
+
const w = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
|
|
203
|
+
for (const m of v(d, i.widthMm, i.heightMm).cells) {
|
|
204
|
+
const y = E.get(m.ri) ?? 0;
|
|
205
|
+
E.set(m.ri, y + 1);
|
|
206
|
+
const b = l({ pageIndex: c, componentIndex: f, rowIndex: m.ri, columnIndex: m.ci }), p = b && r.get(T(b));
|
|
207
|
+
if (!p || !b.editable) continue;
|
|
208
|
+
const S = w.get(m.ri) ?? [...d.cells[m.ri]], g = x(b, p.value);
|
|
209
|
+
Object.is(b.value, p.value) && g === b.cell.text || (S[y] = { ...m.cell, value: p.value, text: g, rawText: g }, w.set(m.ri, S));
|
|
210
|
+
}
|
|
211
|
+
return w.size ? { ...i, grid: { ...d, cells: d.cells.map((m, y) => w.get(y) ?? m) } } : i;
|
|
212
|
+
}
|
|
213
|
+
const s = e.pages.map((i, c) => {
|
|
214
|
+
const f = i.components.map((d, w) => u(d, c, w));
|
|
215
|
+
return f.every((d, w) => d === i.components[w]) ? i : { ...i, components: f };
|
|
216
|
+
});
|
|
217
|
+
return s.every((i, c) => i === e.pages[c]) ? e : { ...e, pages: s };
|
|
218
|
+
}
|
|
219
|
+
function K(e) {
|
|
220
|
+
const t = e.source;
|
|
221
|
+
if (t) return JSON.stringify([t.sourceScope, t.datasetId, t.rowKey, t.field]);
|
|
222
|
+
const r = e.table;
|
|
223
|
+
if (r?.columnKey !== void 0) return JSON.stringify([r.id, r.role, r.rowIndex, r.columnKey]);
|
|
224
|
+
const n = e.address;
|
|
225
|
+
return JSON.stringify([n.pageIndex, n.componentIndex, n.rowIndex, n.columnIndex]);
|
|
226
|
+
}
|
|
227
|
+
function te(e, t, r) {
|
|
228
|
+
if (typeof r != "string" || !r.trim() || !Array.isArray(t)) throw new a("missing");
|
|
229
|
+
if (t.length > 1e4) throw new a("limit");
|
|
230
|
+
const n = /* @__PURE__ */ new Set(), o = h(e), l = t.map(({ address: u, value: s }) => {
|
|
231
|
+
const i = o(u);
|
|
232
|
+
if (!i) throw new a("missing");
|
|
233
|
+
const c = C(i, s), f = K(c);
|
|
234
|
+
if (n.has(f)) throw new a("duplicate");
|
|
235
|
+
return n.add(f), c;
|
|
236
|
+
});
|
|
237
|
+
return { requestId: r, edits: l };
|
|
238
|
+
}
|
|
239
|
+
function re(e, t) {
|
|
240
|
+
if (t.edits.length > 1e4) throw new a("limit");
|
|
241
|
+
const r = h(e), n = /* @__PURE__ */ new Set(), o = t.edits.map((l) => {
|
|
242
|
+
const u = r(l.address);
|
|
243
|
+
if (!u) throw new a("missing");
|
|
244
|
+
const s = K(l);
|
|
245
|
+
if (n.has(s)) throw new a("duplicate");
|
|
246
|
+
if (n.add(s), F(u, l) || !Object.is(u.value, l.previousValue) || (u.cell.text ?? "") !== l.previousText) throw new a("conflict");
|
|
247
|
+
return C(u, l.value);
|
|
248
|
+
});
|
|
249
|
+
return Y(e, o);
|
|
250
|
+
}
|
|
251
|
+
function ne(e) {
|
|
252
|
+
const t = /* @__PURE__ */ new Map();
|
|
253
|
+
for (const r of e) {
|
|
254
|
+
const n = K(r), o = t.get(n), l = o ? { ...r, previousValue: o.previousValue, previousText: o.previousText } : { ...r };
|
|
255
|
+
Object.is(l.previousValue, l.value) ? t.delete(n) : t.set(n, l);
|
|
256
|
+
}
|
|
257
|
+
return [...t.values()];
|
|
258
|
+
}
|
|
259
|
+
export {
|
|
260
|
+
a as R,
|
|
261
|
+
ee as a,
|
|
262
|
+
re as b,
|
|
263
|
+
q as c,
|
|
264
|
+
te as d,
|
|
265
|
+
h as e,
|
|
266
|
+
x as f,
|
|
267
|
+
I as g,
|
|
268
|
+
C as h,
|
|
269
|
+
F as i,
|
|
270
|
+
N as p,
|
|
271
|
+
K as r,
|
|
272
|
+
ne as s
|
|
273
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const v=require("./sha256-ArEYjaTI.cjs");function j(e={}){const t={maxRecords:e.maxRecords??1e4,maxBytes:e.maxBytes??67108864,maxResultBytes:e.maxResultBytes??262144,controlReserveBytes:e.controlReserveBytes??4096,maxTombstones:e.maxTombstones??1e4,maxTombstoneBytes:e.maxTombstoneBytes??16777216};if(!Object.values(t).every(n=>Number.isSafeInteger(n)&&n>0)||t.controlReserveBytes<4096)throw new c("input","任务容量应为正整数,控制状态预留至少4096字节");return t}function g(e){return new TextEncoder().encode(d(e)).byteLength}function A(e,t){const n={scope:e.scope,id:e.id,revision:1,request:e.request,status:"queued",createdAt:e.createdAt,updatedAt:e.createdAt,attempt:0},r={...e};delete r.result;const a=e.result===void 0?0:g(e.result);if(a>t.maxResultBytes)throw new c("capacity","任务结果超过独立预算,请保存文件引用");return Math.max(g(n)+t.controlReserveBytes,g(r))+a}function x(e){return e.status!=="queued"&&e.status!=="running"}function I(e){const t={...e,tombstoneRetentionMs:e.tombstoneRetentionMs??6048e5,limit:e.limit??100};if(![t.now,t.terminalBefore].every(n=>Number.isSafeInteger(n)&&n>=0)||t.terminalBefore>t.now)throw new c("input","终态清理时间应为不超过当前时间的非负整数");if(![t.tombstoneRetentionMs,t.limit].every(n=>Number.isSafeInteger(n)&&n>0)||!Number.isSafeInteger(t.now+t.tombstoneRetentionMs))throw new c("input","幂等保留期与清理批量应为正整数");return t}async function R(e){const t=new TextEncoder().encode(d(e)),n=globalThis.crypto?.subtle;if(!n)return v.portableSha256HexAsync(t);const r=await n.digest("SHA-256",t);return Array.from(new Uint8Array(r),a=>a.toString(16).padStart(2,"0")).join("")}async function E(e,t){if(!x(e))throw new c("input","只能归档终态任务");return{scope:e.scope,id:e.id,revision:e.revision,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,attempt:e.attempt,requestHash:await R(e.request),expiresAt:t}}class c extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportJobError"}}function J(e,t){if(typeof e!="string"||!e.trim()||e.length>256||typeof t!="string"||t!==t.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t))throw new c("input","任务范围应非空,ID应为1–128位安全标识")}function T(e){const t=Array.isArray(e),n=Object.getPrototypeOf(e),r=Object.keys(e);if(n!==(t?Array.prototype:Object.prototype)&&!(n===null&&!t))throw new c("input","任务对象应为普通 JSON 对象");if(Object.getOwnPropertySymbols(e).length)throw new c("input","任务不能包含Symbol");if(Object.getOwnPropertyNames(e).filter(i=>!(t&&i==="length")).length!==r.length)throw new c("input","任务不能包含不可枚举属性");if(t&&(r.length!==e.length||r.some(i=>i!==String(Number(i))||!Number.isSafeInteger(Number(i))||Number(i)<0||Number(i)>=e.length)))throw new c("input","任务数组不能稀疏或包含额外属性");return r.sort()}function M(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(["__proto__","prototype","constructor"].includes(t)||n.get||n.set)throw new c("input","任务不能包含危险键或访问器");return n.value}function d(e,t={}){const n=t.maxNodes??2e4,r=t.maxCharacters??1e6;if(!Number.isSafeInteger(n)||n<1||n>2e4||!Number.isSafeInteger(r)||r<1||r>1e6)throw new c("input","任务JSON预算无效");let a=0,i=0;const y=new Set;function b(s,u){if(++a>n||u>32)throw new c("input","任务数据超过节点或深度预算");if(typeof s=="string"){if(i+=s.length,i>r)throw new c("input","任务文本超过预算");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))return s;if(!s||typeof s!="object"||y.has(s))throw new c("input","任务只允许无循环的有限 JSON 值");const o=Array.isArray(s),h=T(s);y.add(s);const l=Object.create(null);for(const f of h){if(i+=f.length,i>r)throw new c("input","任务文本超过预算");l[f]=b(M(s,f),u+1)}return y.delete(s),o?Array.from({length:s.length},(f,p)=>l[String(p)]):l}const w=JSON.stringify(b(e,0));if(w.length>r)throw new c("input","任务序列化数据超过字符预算");return w}function m(e){return JSON.parse(JSON.stringify(e))}function N(e,t,n,r){if(J(t,n),e.scope!==t||e.id!==n||e.revision!==(r??0)+1||!Number.isSafeInteger(e.revision))throw new c("input","任务身份或修订不匹配");if(![e.createdAt,e.updatedAt,e.attempt].every(a=>Number.isSafeInteger(a)&&a>=0)||!["queued","running","completed","failed","cancelled"].includes(e.status))throw new c("input","任务状态无效");if(e.lease&&(!e.lease.owner||!Number.isSafeInteger(e.lease.expiresAt)))throw new c("input","任务租约无效");if(!e.request||typeof e.request.kind!="string"||!e.request.kind.trim()||e.request.kind.length>128)throw new c("input","任务类型无效");d(e.request.payload,{maxNodes:19e3,maxCharacters:75e4}),d(e)}function B(e,t){if(e&&(e.createdAt!==t.createdAt||d(e.request)!==d(t.request)))throw new c("input","任务创建时间与请求不可变更,请使用新任务ID")}function O(e,t){return e.status==="queued"||e.status==="running"&&(e.lease?.expiresAt??0)<=t}function C(e={}){const t=new Map,n=new Map,r=j(e);let a=0,i=0,y=Promise.resolve();const b=(s,u)=>JSON.stringify([s,u]),w=s=>{const u=y.then(s);return y=u.then(()=>{},()=>{}),u};return{read:async(s,u)=>{await y;const o=t.get(b(s,u));return o?m(o):void 0},readTombstone:async(s,u)=>{await y;const o=n.get(b(s,u));return o?m(o):void 0},candidates:async(s,u)=>(await y,Array.from(t.values()).filter(o=>O(o,s)).sort((o,h)=>o.createdAt-h.createdAt).slice(0,u).map(m)),compareAndSwap:async(s,u,o,h)=>{N(h,s,u,o);const l=m(h);return w(async()=>{const f=b(s,u),p=t.get(f);if((p?.revision??null)!==o||n.has(f))return!1;B(p,l);const S=a-(p?A(p,r):0)+A(l,r);if(S>r.maxBytes||!p&&t.size>=r.maxRecords)throw new c("capacity","任务容量已满,请清理终态任务或扩大显式预算");return t.set(f,l),a=S,!0})},prune:async s=>{const u=I(s);return w(async()=>{const o={archived:0,expired:0};for(const[h,l]of n)l.expiresAt>u.now||o.expired>=u.limit||(n.delete(h),i-=g(l),o.expired++);for(const[h,l]of t){if(!x(l)||l.updatedAt>u.terminalBefore||o.archived+o.expired>=u.limit)continue;const f=await E(l,u.now+u.tombstoneRetentionMs),p=g(f);if(n.size>=r.maxTombstones||i+p>r.maxTombstoneBytes)break;n.set(h,f),i+=p,t.delete(h),a-=A(l,r),o.archived++}return o})}}}function q(e,t=100){if(!Number.isSafeInteger(t)||t<1||t>1e3||!Array.isArray(e)||e.length>t)throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");const n=JSON.parse(d(e)),r=new Set;for(const a of n){if(!a||typeof a.id!="string"||a.id!==a.id.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(a.id)||r.has(a.id))throw new TypeError("批量行 ID 应唯一且为安全标识");if(!a.params||Array.isArray(a.params)||typeof a.params!="object"||Object.values(a.params).some(i=>typeof i!="string"))throw new TypeError("批量参数应为字符串字典");r.add(a.id)}return n}function z(e,t){if(!t)return;const n={completed:0,total:e.length,failed:0,cancelled:0};for(const r of e)r&&(n.completed++,r.status==="failed"&&n.failed++,r.status==="cancelled"&&n.cancelled++);try{t(n)}catch{}}async function k(e,t,n={}){const r=n.concurrency??2;if(!Number.isSafeInteger(r)||r<1||r>16)throw new RangeError("批量并发应为 1–16");if(n.failure!==void 0&&n.failure!=="continue"&&n.failure!=="stop")throw new TypeError("批量失败策略无效");const a=q(e,n.maxCases??100);if(!a.length)throw new RangeError("批量生成至少需要一组参数");const i=Array.from({length:a.length}),y=new AbortController,b=()=>y.abort(n.signal?.reason);n.signal?.addEventListener("abort",b,{once:!0}),n.signal?.aborted&&b();let w=0,s=!1;async function u(){for(;w<a.length;){const o=w++,h=a[o],l={id:h.id,index:o};if(s||y.signal.aborted)i[o]={...l,status:"cancelled"};else try{v.throwIfAborted(y.signal);const f=await t(h,{index:o,signal:y.signal});i[o]={...l,status:"completed",value:f}}catch(f){y.signal.aborted?i[o]={...l,status:"cancelled"}:(i[o]={...l,status:"failed",error:{name:f instanceof Error?f.name:"Error",message:f instanceof Error?f.message:String(f)}},n.failure==="stop"&&(s=!0))}z(i,n.onProgress)}}try{await Promise.all(Array.from({length:Math.min(r,a.length)},u))}finally{n.signal?.removeEventListener("abort",b)}return i}exports.ReportJobError=c;exports.checkJobIdentity=J;exports.cloneJob=m;exports.createMemoryReportJobStore=C;exports.jobByteLength=g;exports.jobRequestHash=R;exports.runReportBatch=k;exports.runnableJob=O;exports.serializeJobJson=d;exports.snapshotReportBatchCases=q;exports.validateJobRecord=N;exports.validateJobTransition=B;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./progress-B0ctFpKf.cjs"),v=require("./render-plan-7xpGrCEl.cjs");function O(t,e){l.assertOutputActive(e.signal),l.observeOutput(()=>e.onDiagnostic?.(t)),l.assertOutputActive(e.signal)}class k extends Error{constructor(e){super(`Output contains ${e.length} known fidelity issue(s): ${e[0]?.code}`),this.diagnostics=e,this.code="output-fidelity",this.name="OutputFidelityError"}}const x=new Set(["text","rect","line","ellipse"]),$=new Set(["image","chart","barcode","qrcode"]);function C(t,e){if(!t.grid){if(v.isImageBackedComponent(t))return(e==="pdf"||e==="xlsx")&&!/^data:image\/(png|jpe?g);base64,/i.test(t.imageData)?{code:"unsupported-image-format",message:`${e.toUpperCase()} accepts PNG or JPEG data URLs; convert this image before exporting.`}:void 0;if($.has(t.kind))return{code:"missing-image",message:`${t.kind} requires imageData or a renderer adapter before output.`};if(!x.has(t.kind))return{code:"unsupported-component",message:`Unsupported component kind: ${t.kind}.`};if(e==="xlsx"&&t.kind!=="text")return{code:"unsupported-component",message:`XLSX data export omits ${t.kind} geometry.`}}}function u(t,e,s,i,r){return{...r,severity:"warning",format:e,pageIndex:s,componentIndex:i,kind:t.kind,nid:t.nid}}function c(t,e){if(!t||e==="dom")return;const s=[];return t.rotateDeg&&s.push("rotateDeg"),t.opacity!==void 0&&t.opacity!==1&&s.push("opacity"),e!=="xlsx"&&t.align==="justify"&&s.push("justify"),e==="canvas"&&t.underline&&s.push("underline"),e==="xlsx"&&t.letterSpacing&&s.push("letterSpacing"),s.length?`${e} does not preserve these styles: ${s.join(", ")}.`:void 0}function M(t,e,s,i,r){for(const n of t.richParagraphs??[]){e==="xlsx"&&(n.spaceBeforeMm||n.spaceAfterMm||n.indentMm||n.align||n.lineHeight)&&r.push(u(t,e,s,i,{code:"unsupported-style",message:"XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained."}));const a=c({align:n.align},e);a&&r.push(u(t,e,s,i,{code:"unsupported-style",message:a}));for(const d of n.segments){const o=c(d.style,e)??(e!=="dom"&&d.style?.backgroundColor?"Inline background colors are not preserved in this output.":void 0);o&&r.push(u(t,e,s,i,{code:"unsupported-style",message:o}))}}}function D(t,e,s,i,r,n,a){if(a.has(t))return;const d=new Set(a).add(t),o=C(t,e);o&&n.push({...u(t,e,s,i,o),componentPath:r});const f=c(t.style,e);f&&n.push({...u(t,e,s,i,{code:"unsupported-style",message:f}),componentPath:r}),v.isRichText(t)&&e==="canvas"&&n.push(u(t,e,s,i,{code:"rich-text-flattened",message:"Rich text is exported as plain text; inline styles are not preserved."})),M(t,e,s,i,n);for(const[p,w]of(t.grid?.cells??[]).entries())for(const[g,h]of w.entries()){const y=c(h?.style,e);if(y&&n.push({...u(t,e,s,i,{code:"unsupported-style",message:y}),componentPath:[...r,p,g]}),h?.children?.length&&e!=="dom")n.push({...u(t,e,s,i,{code:"nested-components-omitted",message:"Nested grid components are omitted; cell text is preserved."}),componentPath:[...r,p,g]});else if(e==="dom")for(const[E,b]of(h?.children??[]).entries())D(b,e,s,i,[...r,p,g,E],n,d)}}function S(t,e){const s=[];return t.pages.forEach((i,r)=>i.components.forEach((n,a)=>D(n,e,r,a,[],s,new Set))),s}function A(t,e,s){l.assertOutputActive(s.signal);const i=S(t,e);if(i.forEach(r=>O(r,s)),s.fidelity==="strict"&&i.length)throw new k(i);return i}exports.OutputFidelityError=k;exports.inspectOutputCapabilities=S;exports.notifyOutputDiagnostic=O;exports.reportOutputDiagnostics=A;
|