@agile-team/mach-report 2.22.0 → 2.23.1
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 +8 -6
- package/dist/ExcelBindingWizard-BrTmdo7f.cjs +1 -0
- package/dist/ExcelBindingWizard-CcDMLO8Q.js +1486 -0
- package/dist/ParamEditor-BGjovFUe.js +737 -0
- package/dist/ParamEditor-CeNp4_zQ.cjs +1 -0
- package/dist/ReportBatchPanel-CHxBtG9R.cjs +1 -0
- package/dist/ReportBatchPanel-CJB67WNd.js +351 -0
- package/dist/ReportLabelStudio-Tplc1TLJ.js +784 -0
- package/dist/ReportLabelStudio-g8PkqJWn.cjs +1 -0
- package/dist/ReportParamPanel-C7fZTllk.cjs +1 -0
- package/dist/{ReportParamPanel-BHSKVL8k.js → ReportParamPanel-GI43aGa0.js} +146 -127
- package/dist/ReportPreview-BoGBGyRr.cjs +6 -0
- package/dist/ReportPreview-QLONCyci.js +6257 -0
- package/dist/ReportTemplateLibrary-BFQIX0sg.cjs +1 -0
- package/dist/ReportTemplateLibrary-KqX4E2sN.js +312 -0
- package/dist/RuleEditor-BZUP9yvL.cjs +1 -0
- package/dist/RuleEditor-OPX1awrH.js +2342 -0
- package/dist/TemplateOutlinePanel-CVYKVLv_.cjs +1 -0
- package/dist/TemplateOutlinePanel-DQS-eOs6.js +97 -0
- package/dist/TemplateReusePanel-CY6O93Zk.cjs +1 -0
- package/dist/TemplateReusePanel-DKXiFTyB.js +389 -0
- package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +1 -0
- package/dist/TemplateReviewPanel-Dijwm9YE.js +593 -0
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +26 -26
- package/dist/artifact-integrity.json +106 -104
- package/dist/assets-D2gHc4Mz.cjs +1 -0
- package/dist/assets-T_gDeFaz.js +132 -0
- package/dist/auto-BB99S802.js +257 -0
- package/dist/auto-BrPWo7Xm.cjs +1 -0
- package/dist/capabilities-DiBj4Qgl.cjs +1 -0
- package/dist/capabilities-pg7j7VLT.js +106 -0
- package/dist/charts-Cjw5AYkg.cjs +1 -0
- package/dist/{charts-Dlv8j2AG.js → charts-CxJZ0XaY.js} +1 -1
- package/dist/computed-DK6BruFz.cjs +1 -0
- package/dist/{computed-C8NRZQss.js → computed-f3pOqWLX.js} +381 -301
- package/dist/data-bar-CeZuFmYl.cjs +1 -0
- package/dist/{data-bar-8baGYEZ9.js → data-bar-IkI6VvMQ.js} +1 -1
- package/dist/designer-BZoVWTgl.js +7172 -0
- package/dist/designer-zS2uKJmY.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +105 -45
- package/dist/designer.d.ts +105 -45
- package/dist/designer.js +4 -4
- package/dist/dom-ChE5D-L-.cjs +1 -0
- package/dist/dom-JWrchIre.js +452 -0
- package/dist/dom-cell-address-DLD1mkTB.cjs +1 -0
- package/dist/dom-cell-address-Fn-8nk7D.js +11 -0
- package/dist/{encoding-ncQAvyOv.cjs → encoding-7lquyj0w.cjs} +1 -1
- package/dist/{encoding-DbnhbwI8.js → encoding-CEd-dq9A.js} +2 -2
- package/dist/{font-loader-Di0lQKFf.js → font-loader-CNWXomuV.js} +1 -1
- package/dist/{font-loader-BB372_XN.cjs → font-loader-D8pI87fL.cjs} +1 -1
- package/dist/grid-strokes-Be24LGuV.cjs +1 -0
- package/dist/grid-strokes-EoY66L2f.js +53 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +944 -1259
- package/dist/{json-snapshot-DvQbZlD7.js → json-snapshot-BRnzKudk.js} +763 -776
- package/dist/json-snapshot-DNiIbpOr.cjs +2 -0
- package/dist/matrix-B8QWbsGM.cjs +1 -0
- package/dist/matrix-C6e_r_vp.js +302 -0
- package/dist/{pdf-DmlnL5eB.js → pdf-CJToa81Z.js} +20 -20
- package/dist/{pdf-CARdBcuw.cjs → pdf-DpMkW72B.cjs} +42 -42
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-AcAQ2m9X.cjs → plugin-BWTp-X7b.cjs} +1 -1
- package/dist/{plugin-w5Nyt08U.js → plugin-_BkUVc2z.js} +1 -1
- package/dist/{prefill-BXBxx5We.js → prefill-CWGdnqQd.js} +21 -21
- package/dist/prefill-PaAy6wLk.cjs +1 -0
- package/dist/prepared-CJy_qk7d.js +94 -0
- package/dist/prepared-D0yCSxSO.cjs +1 -0
- package/dist/progress-ByiOxUD3.js +250 -0
- package/dist/progress-WomPRP3B.cjs +1 -0
- package/dist/{protocol-fjaeKkjf.js → protocol-BG16rz6D.js} +3 -3
- package/dist/{protocol-C9ZaylID.cjs → protocol-wzhl1Fim.cjs} +1 -1
- package/dist/record-bindings-DatJZv_e.js +200 -0
- package/dist/record-bindings-MBxbeBsi.cjs +1 -0
- package/dist/{region-binding-workflow-aA8nxmkZ.js → region-binding-workflow-DjrXuR1q.js} +2 -2
- package/dist/{region-binding-workflow-BiJQ7NU6.cjs → region-binding-workflow-l7NGfagJ.cjs} +2 -2
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-Ciwa6D2o.js +52 -0
- package/dist/rich-text-layout-DK7A_a5r.cjs +3 -0
- package/dist/runtime-DYMOS_gz.cjs +1 -0
- package/dist/{runtime-BTtpjF3D.js → runtime-PiCax9zQ.js} +52 -51
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +1676 -1619
- package/dist/server.cjs +1 -1
- package/dist/server.js +24 -24
- package/dist/style.css +1 -1
- package/dist/{template-catalog-JSxSqk5y.js → template-catalog-CRuZL3pi.js} +17 -17
- package/dist/template-catalog-DtrtT1FY.cjs +1 -0
- package/dist/{template-fragments-D2JFj7Du.js → template-fragments-CPpGpQoz.js} +12 -12
- package/dist/template-fragments-GVjpew_q.cjs +1 -0
- package/dist/template-registry-DI59PXVK.cjs +1 -0
- package/dist/{template-registry-Do1Uav2Z.js → template-registry-O0hNIOfB.js} +17 -17
- package/dist/{template-serialization-CU4n_Miu.js → template-serialization-CWmHq7lX.js} +1 -1
- package/dist/{template-serialization-CgqBo6s-.cjs → template-serialization-CqQY4zDg.cjs} +1 -1
- package/dist/textwrap-D4ZksyMK.js +111 -0
- package/dist/textwrap-DEHqAjKZ.cjs +4 -0
- package/dist/vue/async.d.cts +31 -0
- package/dist/vue/async.d.ts +31 -0
- package/dist/vue/index.d.cts +32 -1
- package/dist/vue/index.d.ts +32 -1
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +52 -47
- package/dist/{workbook-session-BvEBRRMz.cjs → workbook-session-C6-SrnCT.cjs} +4 -4
- package/dist/{workbook-session-f0wVlzst.js → workbook-session-C9ZmCBwY.js} +15 -16
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.js +184 -179
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-CW79I6Gl.cjs +0 -1
- package/dist/ExcelBindingWizard-CZyppD7I.js +0 -1485
- package/dist/ParamEditor-CiYCJI0b.cjs +0 -1
- package/dist/ParamEditor-DQit-Gdf.js +0 -732
- package/dist/ReportBatchPanel-DKTpV7MU.js +0 -350
- package/dist/ReportBatchPanel-Db6TAfG5.cjs +0 -1
- package/dist/ReportLabelStudio-B0i9ohQj.cjs +0 -1
- package/dist/ReportLabelStudio-BYnRqmje.js +0 -780
- package/dist/ReportParamPanel-lngONOEz.cjs +0 -1
- package/dist/ReportPreview-BDgKssYR.js +0 -5887
- package/dist/ReportPreview-Dw-4icG6.cjs +0 -6
- package/dist/ReportTemplateLibrary-BZuKn0YK.js +0 -311
- package/dist/ReportTemplateLibrary-DEXH07ND.cjs +0 -1
- package/dist/RuleEditor-CIQn547x.js +0 -2341
- package/dist/RuleEditor-zSUmPjKa.cjs +0 -1
- package/dist/TemplateOutlinePanel-B5SfGYVN.cjs +0 -1
- package/dist/TemplateOutlinePanel-D0PgOSQE.js +0 -96
- package/dist/TemplateReusePanel-BKlAEF8-.js +0 -388
- package/dist/TemplateReusePanel-DAy_Hwqz.cjs +0 -1
- package/dist/TemplateReviewPanel-CowmHaQQ.cjs +0 -1
- package/dist/TemplateReviewPanel-div-EH_m.js +0 -592
- package/dist/assets-CxHunY_9.js +0 -232
- package/dist/assets-vbjAGgk8.cjs +0 -1
- package/dist/auto-DcUHlKob.cjs +0 -1
- package/dist/auto-moShblh1.js +0 -240
- package/dist/charts-aCtoswXq.cjs +0 -1
- package/dist/component-tree-1_QCiQJX.js +0 -67
- package/dist/component-tree-BjZIp6w9.cjs +0 -1
- package/dist/computed-4TnxzgIh.cjs +0 -1
- package/dist/data-bar-YltqGTaC.cjs +0 -1
- package/dist/designer-B7jJeAeG.js +0 -6914
- package/dist/designer-BWQVpJeN.cjs +0 -2
- package/dist/grid-geometry-D3SJgWFv.js +0 -136
- package/dist/grid-geometry-D8ReblRV.cjs +0 -1
- package/dist/json-snapshot-nyV63AbB.cjs +0 -2
- package/dist/matrix-0hywp0-F.cjs +0 -1
- package/dist/matrix-Dy-tyY7E.js +0 -381
- package/dist/prefill-DUvejVt1.cjs +0 -1
- package/dist/prepared-YXy-fVLw.cjs +0 -1
- package/dist/prepared-rXCKqdHY.js +0 -88
- package/dist/progress-B0ctFpKf.cjs +0 -1
- package/dist/progress-Hc2vxoCs.js +0 -52
- package/dist/record-bindings-Ct1HkPrc.cjs +0 -1
- package/dist/record-bindings-VZGS-Qd8.js +0 -155
- package/dist/rich-text-layout-K48VHUoW.cjs +0 -3
- package/dist/rich-text-layout-wxBhnAS7.js +0 -102
- package/dist/runtime-Dq0LUsyS.cjs +0 -1
- package/dist/template-catalog-CLAM4w7H.cjs +0 -1
- package/dist/template-fragments-Ca25Jt7e.cjs +0 -1
- package/dist/template-outline-CDWXptuj.js +0 -88
- package/dist/template-outline-K4jGhATu.cjs +0 -1
- package/dist/template-registry-CWnuGqyP.cjs +0 -1
- package/dist/textwrap-CkGjRFT3.js +0 -110
- package/dist/textwrap-OTOUMr4f.cjs +0 -4
package/dist/pdf.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./font-loader-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./font-loader-D8pI87fL.cjs"),t=require("./pdf-DpMkW72B.cjs");exports.clearFontCache=e.clearFontCache;exports.configureFontCache=e.configureFontCache;exports.getFontCacheStats=e.getFontCacheStats;exports.invalidateFontCache=e.invalidateFontCache;exports.loadFontWithCache=e.loadFontWithCache;exports.createFontBytesMeasurer=t.createFontBytesMeasurer;exports.renderPlanToPdf=t.renderPlanToPdf;
|
package/dist/pdf.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { clearFontCache as t, configureFontCache as o, getFontCacheStats as r, invalidateFontCache as n, loadFontWithCache as c } from "./font-loader-
|
|
2
|
-
import { c as F, r as s } from "./pdf-
|
|
1
|
+
import { clearFontCache as t, configureFontCache as o, getFontCacheStats as r, invalidateFontCache as n, loadFontWithCache as c } from "./font-loader-CNWXomuV.js";
|
|
2
|
+
import { c as F, r as s } from "./pdf-CJToa81Z.js";
|
|
3
3
|
export {
|
|
4
4
|
t as clearFontCache,
|
|
5
5
|
o as configureFontCache,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var R=Object.create;var f=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var m=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of P(e))!p.call(r,o)&&o!==t&&f(r,o,{get:()=>e[o],enumerable:!(n=u(e,o))||n.enumerable});return r};var E=(r,e,t)=>(t=r!=null?R(d(r)):{},m(e||!r||!r.__esModule?f(t,"default",{value:r,enumerable:!0}):t,r));const l=require("vue"),i=require("./injection-keys-Db_DyLkm.cjs"),h=require("./report-params-VTg8MoCp.cjs"),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-
|
|
1
|
+
"use strict";var R=Object.create;var f=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var m=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of P(e))!p.call(r,o)&&o!==t&&f(r,o,{get:()=>e[o],enumerable:!(n=u(e,o))||n.enumerable});return r};var E=(r,e,t)=>(t=r!=null?R(d(r)):{},m(e||!r||!r.__esModule?f(t,"default",{value:r,enumerable:!0}):t,r));const l=require("vue"),i=require("./injection-keys-Db_DyLkm.cjs"),h=require("./report-params-VTg8MoCp.cjs"),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-BoGBGyRr.cjs")).then(r=>r.ReportPreview$1)),v={install(r,e={}){let t=e.fetcher;if(!t&&e.reports){const n=e.reports;let o;t=async c=>(o??=import("@agile-team/mach-report").then(({createReportSource:a})=>a(n)),(await o)(c)),t.getParamDefs=c=>h.getReportParamDefs(n,c)}t&&r.provide(i.MACH_REPORT_FETCHER_KEY,t),e.pdfExporter&&r.provide(i.MACH_REPORT_PDF_EXPORTER_KEY,e.pdfExporter),r.provide(i.MACH_REPORT_CONFIG_KEY,l.computed(()=>{if(e.pdfFontUrl===void 0)return e.config??null;const n=e.config??{defaults:{},presets:{}};return{...n,defaults:{...n.defaults,pdfFontUrl:e.pdfFontUrl}}})),e.globalComponent!==!1&&!r.component("MachReportPreview")&&r.component("MachReportPreview",s)}};exports.MachReportPreview=s;exports.machReportPlugin=v;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineAsyncComponent as c, computed as m } from "vue";
|
|
2
2
|
import { b as i, c as l, a as d } from "./injection-keys-e85udZCp.js";
|
|
3
3
|
import { g as s } from "./report-params-D9tBuM9B.js";
|
|
4
|
-
const p = c(() => import("./ReportPreview-
|
|
4
|
+
const p = c(() => import("./ReportPreview-QLONCyci.js").then((r) => r.x)), _ = {
|
|
5
5
|
install(r, e = {}) {
|
|
6
6
|
let t = e.fetcher;
|
|
7
7
|
if (!t && e.reports) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as B } from "./
|
|
3
|
-
import { d as
|
|
1
|
+
import { t as q, E as O, l as V, L as Z, M as T } from "./json-snapshot-BRnzKudk.js";
|
|
2
|
+
import { r as B } from "./progress-ByiOxUD3.js";
|
|
3
|
+
import { d as L, p as S, a as H, k as P, h as J } from "./computed-f3pOqWLX.js";
|
|
4
4
|
function I(e) {
|
|
5
5
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
6
6
|
}
|
|
@@ -49,7 +49,7 @@ class h extends Error {
|
|
|
49
49
|
function v(e) {
|
|
50
50
|
return typeof e == "string" && e.trim().length > 0 && e.length <= 256;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function $(e) {
|
|
53
53
|
if (typeof e == "number" && Number.isFinite(e) || typeof e == "boolean") return String(e);
|
|
54
54
|
if (typeof e == "string" && e.length > 0 && e.length <= 4096) return e;
|
|
55
55
|
throw new h("missing-value");
|
|
@@ -57,7 +57,7 @@ function G(e) {
|
|
|
57
57
|
function Q(e, t) {
|
|
58
58
|
return Object.getOwnPropertyDescriptor(e, t)?.value;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function U(e) {
|
|
61
61
|
if (!Array.isArray(e) || e.length > 64) throw new h("config");
|
|
62
62
|
const t = /* @__PURE__ */ new Set();
|
|
63
63
|
for (const r of e) {
|
|
@@ -76,7 +76,7 @@ function X(e) {
|
|
|
76
76
|
if (!v(t) || ["__proto__", "constructor", "prototype"].includes(t) || !r || typeof r != "object") throw new h("config");
|
|
77
77
|
if ("value" in r)
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
$(r.value);
|
|
80
80
|
} catch {
|
|
81
81
|
throw new h("config");
|
|
82
82
|
}
|
|
@@ -84,14 +84,14 @@ function X(e) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function G(e, t, r) {
|
|
88
88
|
const { target: o } = r, n = t.source?.datasetId ?? t.component.table?.source?.datasetId;
|
|
89
89
|
return (t.source?.field ?? t.table?.columnKey) === o.field && (o.datasetId === void 0 || n === o.datasetId) && (o.reportScope === void 0 || e.pages[t.address.pageIndex]?.meta?.reportScope === o.reportScope) && (o.roles ? o.roles.includes(t.table?.role ?? "") : t.table?.role !== "header");
|
|
90
90
|
}
|
|
91
91
|
function le(e, t, r) {
|
|
92
|
-
|
|
92
|
+
U(r);
|
|
93
93
|
const o = q(e, t);
|
|
94
|
-
return o ? r.filter((n) =>
|
|
94
|
+
return o ? r.filter((n) => G(e, o, n)) : [];
|
|
95
95
|
}
|
|
96
96
|
function Y(e, t, r, o) {
|
|
97
97
|
if ("value" in e) return e.value;
|
|
@@ -109,10 +109,10 @@ function Y(e, t, r, o) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function de(e, t, r, o = {}) {
|
|
112
|
-
|
|
112
|
+
U([r]);
|
|
113
113
|
const n = q(e, t);
|
|
114
|
-
if (!n || !
|
|
115
|
-
const a = Object.fromEntries(Object.entries(r.params ?? {}).map(([i, c]) => [i,
|
|
114
|
+
if (!n || !G(e, n, r)) throw new h("target");
|
|
115
|
+
const a = Object.fromEntries(Object.entries(r.params ?? {}).map(([i, c]) => [i, $(Y(c, e, n, o))])), s = Object.entries(o);
|
|
116
116
|
if (s.length > 128 || s.some(([i, c]) => !v(i) || typeof c != "string" || c.length > 4096)) throw new h("config");
|
|
117
117
|
const l = e.pages[t.pageIndex]?.meta?.reportScope;
|
|
118
118
|
return Object.freeze({ actionId: r.id, params: Object.freeze(a), returnState: Object.freeze({
|
|
@@ -178,7 +178,7 @@ function ee(e) {
|
|
|
178
178
|
if (!t || !("value" in t) || !r || !("value" in r) || !r.value || typeof r.value != "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(r.value))) throw new d("value", "Report records require own scalar keys and plain values");
|
|
179
179
|
return { rowKey: t.value, values: r.value };
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function k(e, t, r = {}) {
|
|
182
182
|
const o = y(r.maxRows, 5e4, 1e5), n = y(r.maxCells, 1e6, 2e6);
|
|
183
183
|
if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length > o || e.length * t.length > n) throw new d("limit", "Report data exceeds its budget");
|
|
184
184
|
const a = /* @__PURE__ */ new Map();
|
|
@@ -196,11 +196,11 @@ function A(e, t, r = {}) {
|
|
|
196
196
|
}
|
|
197
197
|
return a;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function A(e) {
|
|
200
200
|
return e == null || e === "";
|
|
201
201
|
}
|
|
202
202
|
function E(e, t) {
|
|
203
|
-
return
|
|
203
|
+
return A(e) ? t.missing === "zero" ? S(0) : void 0 : S(e);
|
|
204
204
|
}
|
|
205
205
|
function te(e) {
|
|
206
206
|
return { coefficient: -e.coefficient, scale: e.scale };
|
|
@@ -208,11 +208,11 @@ function te(e) {
|
|
|
208
208
|
function re(e, t, r, o) {
|
|
209
209
|
const n = E(e, r), a = Object.is(e, t) ? n : E(t, r);
|
|
210
210
|
if (!n || !a) return { equal: W(e, t, r), ratioUnavailable: "missing" };
|
|
211
|
-
const s = H(a, te(n)), l = { ...s, coefficient: s.coefficient < 0n ? -s.coefficient : s.coefficient }, i =
|
|
211
|
+
const s = H(a, te(n)), l = { ...s, coefficient: s.coefficient < 0n ? -s.coefficient : s.coefficient }, i = L(l, r.toleranceValue) <= 0;
|
|
212
212
|
return i && !o ? { equal: i } : n.coefficient === 0n ? { equal: i, delta: P(s), ...s.coefficient === 0n && r.zeroDenominator === "zero-if-equal" ? { changeRatio: "0" } : { ratioUnavailable: "zero-denominator" } } : { equal: i, delta: P(s), changeRatio: P(J(s, n, r.ratioDigits ?? 12)) };
|
|
213
213
|
}
|
|
214
214
|
function W(e, t, r) {
|
|
215
|
-
return r.missing === "empty-equivalent" &&
|
|
215
|
+
return r.missing === "empty-equivalent" && A(e) && A(t) || Object.is(e, t);
|
|
216
216
|
}
|
|
217
217
|
function oe(e) {
|
|
218
218
|
j(e.fields.map((t) => t.field), y(e.maxFields, 256, 1024));
|
|
@@ -221,7 +221,7 @@ function oe(e) {
|
|
|
221
221
|
if (t.missing && !["distinct", "empty-equivalent", "zero"].includes(t.missing)) throw new d("value", "Invalid missing-value policy");
|
|
222
222
|
if (t.zeroDenominator && !["omit", "zero-if-equal"].includes(t.zeroDenominator)) throw new d("value", "Invalid zero-denominator policy");
|
|
223
223
|
if (t.missing === "zero" && t.type !== "decimal") throw new d("value", "Zero missing-value policy requires a decimal field");
|
|
224
|
-
if (t.tolerance !== void 0 && (t.type !== "decimal" ||
|
|
224
|
+
if (t.tolerance !== void 0 && (t.type !== "decimal" || L(S(t.tolerance), S(0)) < 0)) throw new d("value", "Tolerance requires a non-negative decimal");
|
|
225
225
|
if (t.ratioDigits !== void 0 && (!Number.isInteger(t.ratioDigits) || t.ratioDigits < 0 || t.ratioDigits > 100)) throw new d("value", "Invalid ratio precision");
|
|
226
226
|
}
|
|
227
227
|
return e.fields.map((t) => ({ ...t, toleranceValue: S(t.tolerance ?? "0") }));
|
|
@@ -241,7 +241,7 @@ function fe(e, t, r) {
|
|
|
241
241
|
D(e), D(t);
|
|
242
242
|
const o = oe(r);
|
|
243
243
|
if (e.datasetId !== t.datasetId || e.sourceScope !== t.sourceScope) throw new d("identity", "Comparison requires the same business dataset and source scope");
|
|
244
|
-
const n = r.fields.map((u) => u.field), a =
|
|
244
|
+
const n = r.fields.map((u) => u.field), a = k(e.rows, n, r), s = k(t.rows, n, r), l = y(r.maxDifferences, 2e4, 1e5), i = [], c = { added: 0, removed: 0, changed: 0, unchanged: 0, cells: 0 };
|
|
245
245
|
for (const [u, p] of a) {
|
|
246
246
|
const f = s.get(u), g = _(p, f, o, i, l);
|
|
247
247
|
f ? g ? c.changed++ : c.unchanged++ : c.removed++;
|
|
@@ -327,7 +327,7 @@ function ge(e, t) {
|
|
|
327
327
|
if (D(t), t.mode !== void 0 && t.mode !== "empty" && t.mode !== "replace") throw new d("value", "Invalid prefill policy");
|
|
328
328
|
const r = y(t.maxFields, 256, 1024), o = t.fields.map((f) => f.field), n = [...new Set(t.fields.map((f) => f.sourceField ?? f.field))];
|
|
329
329
|
j(o, r), j(n, r);
|
|
330
|
-
const a =
|
|
330
|
+
const a = k(t.rows, n, t), s = M(e, { ...t, fields: o }), l = y(t.maxChanges, 1e4, 1e4), i = y(t.maxCells, 1e6, 2e6);
|
|
331
331
|
if (a.size * o.length > i) throw new d("limit", "Prefill review exceeds its budget");
|
|
332
332
|
const c = [], u = [], p = { matched: 0, changed: 0, skipped: 0, conflict: 0 };
|
|
333
333
|
for (const f of a.values()) for (const g of t.fields) {
|
|
@@ -367,5 +367,5 @@ export {
|
|
|
367
367
|
M as i,
|
|
368
368
|
le as m,
|
|
369
369
|
pe as r,
|
|
370
|
-
|
|
370
|
+
U as v
|
|
371
371
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g=require("./json-snapshot-DNiIbpOr.cjs"),N=require("./progress-WomPRP3B.cjs"),y=require("./computed-DK6BruFz.cjs");function R(e){return Number.isFinite(e)?Math.max(0,e):0}function B(e,t=0){const r=e.length,o=R(t),n=new Array(r+1);n[0]=0;for(let i=0;i<r;i++)n[i+1]=n[i]+R(e[i]??0)+o;const c=n[r];function s(i){let a=0,u=r-1,p=0;for(;a<=u;){const f=a+u>>>1;n[f]<=i?(p=f,a=f+1):u=f-1}return p}function d(i,a,u=1){if(r===0)return{start:0,end:-1,padTopPx:0,padBottomPx:0};const p=Math.floor(R(u)),f=R(a),m=s(f),w=Math.max(0,m-p),I=f+R(i);let h=m,D=r-1,z=r-1;for(;h<=D;){const S=h+D>>>1;n[S+1]<I?h=S+1:(z=S,D=S-1)}const E=Math.min(r-1,z+p);return{start:w,end:E,padTopPx:n[w],padBottomPx:Math.max(0,c-n[E+1])}}return{totalHeightPx:c,pageAt:s,offsetAt:i=>n[Math.max(0,Math.min(r,Math.floor(i)))]??0,window:d}}class v extends Error{constructor(t){super(`Report drill: ${t}`),this.code=t,this.name="ReportDrillError"}}function x(e){return typeof e=="string"&&e.trim().length>0&&e.length<=256}function V(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="boolean")return String(e);if(typeof e=="string"&&e.length>0&&e.length<=4096)return e;throw new v("missing-value")}function $(e,t){return Object.getOwnPropertyDescriptor(e,t)?.value}function A(e){if(!Array.isArray(e)||e.length>64)throw new v("config");const t=new Set;for(const r of e){if(!r||!x(r.id)||!x(r.label)||!r.target||!x(r.target.field)||t.has(r.id))throw new v("config");t.add(r.id);const o=r.target;if(o.datasetId!==void 0&&!x(o.datasetId)||o.reportScope!==void 0&&!x(o.reportScope))throw new v("config");if(o.roles!==void 0&&(!Array.isArray(o.roles)||o.roles.length>16||o.roles.some(n=>!x(n))))throw new v("config");G(r.params)}}function G(e){if(e!==void 0){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).length>32)throw new v("config");for(const[t,r]of Object.entries(e)){if(!x(t)||["__proto__","constructor","prototype"].includes(t)||!r||typeof r!="object")throw new v("config");if("value"in r)try{V(r.value)}catch{throw new v("config")}else if(!["value","rowKey","query","field"].includes(r.from)||(r.from==="query"||r.from==="field")&&!x(r.field))throw new v("config")}}}function T(e,t,r){const{target:o}=r,n=t.source?.datasetId??t.component.table?.source?.datasetId;return(t.source?.field??t.table?.columnKey)===o.field&&(o.datasetId===void 0||n===o.datasetId)&&(o.reportScope===void 0||e.pages[t.address.pageIndex]?.meta?.reportScope===o.reportScope)&&(o.roles?o.roles.includes(t.table?.role??""):t.table?.role!=="header")}function U(e,t,r){A(r);const o=g.getReportCellContext(e,t);return o?r.filter(n=>T(e,o,n)):[]}function W(e,t,r,o){if("value"in e)return e.value;switch(e.from){case"value":return r.value;case"rowKey":return r.source?.rowKey;case"query":return $(o,e.field);case"field":{const n=r.component.table?.columnKeys.indexOf(e.field)??-1;return n<0?void 0:g.getReportCellContext(t,{...r.address,columnIndex:n})?.value}}}function Z(e,t,r,o={}){A([r]);const n=g.getReportCellContext(e,t);if(!n||!T(e,n,r))throw new v("target");const c=Object.fromEntries(Object.entries(r.params??{}).map(([i,a])=>[i,V(W(a,e,n,o))])),s=Object.entries(o);if(s.length>128||s.some(([i,a])=>!x(i)||typeof a!="string"||a.length>4096))throw new v("config");const d=e.pages[t.pageIndex]?.meta?.reportScope;return Object.freeze({actionId:r.id,params:Object.freeze(c),returnState:Object.freeze({params:Object.freeze(Object.fromEntries(s)),address:Object.freeze({...t}),...typeof d=="string"?{reportScope:d}:{},...n.source?{source:Object.freeze({sourceScope:n.source.sourceScope,datasetId:n.source.datasetId,rowKey:n.source.rowKey,field:n.source.field})}:{}})})}function H(e,t){if(!t.source)return e.pages[t.address.pageIndex]?.meta?.reportScope===t.reportScope&&g.getReportCellContext(e,t.address)?{...t.address}:null;const r=g.createReportCellResolver(e),o=g.reportCellEditKey({address:t.address,source:t.source});for(const[n,c]of e.pages.entries())if(!(t.reportScope!==void 0&&c.meta?.reportScope!==t.reportScope)){for(const[s,d]of c.components.entries())if(d.grid)for(const i of N.resolveGridLayout(d.grid,d.widthMm,d.heightMm).cells){const a={pageIndex:n,componentIndex:s,rowIndex:i.ri,columnIndex:i.ci},u=r(a);if(u?.source&&g.reportCellEditKey(u)===o)return a}}return null}class l extends Error{constructor(t,r){super(r),this.code=t,this.name="ReportDataError"}}function b(e,t,r){const o=e??t;if(!Number.isSafeInteger(o)||o<1||o>r)throw new l("limit","Invalid report data budget");return o}function k(e){if(typeof e=="string"&&e.length>0&&e.length<=2048)return`s:${e}`;if(typeof e=="number"&&Number.isSafeInteger(e))return`n:${Object.is(e,-0)?0:e}`;throw new l("identity","A stable string or safe integer business key is required")}function O(e){if(typeof e.datasetId!="string"||!e.datasetId.trim()||e.datasetId.length>2048)throw new l("identity","A dataset identity is required");if(e.sourceScope!==void 0&&(typeof e.sourceScope!="string"||!e.sourceScope.trim()||e.sourceScope.length>2048))throw new l("identity","Invalid source scope")}function j(e,t=256){if(!Array.isArray(e)||!e.length||e.length>t)throw new l("limit","A bounded explicit field allowlist is required");const r=new Set;for(const o of e){if(typeof o!="string"||!o.trim()||o.length>2048||["__proto__","constructor","prototype"].includes(o))throw new l("identity","Invalid report field");if(r.has(o))throw new l("duplicate","Duplicate report field");r.add(o)}}function C(e,t){const r=Object.getOwnPropertyDescriptor(e.values,t);if(!r)return;if(!("value"in r))throw new l("value","Report values must be plain scalar data");const o=r.value;if(o===null||typeof o=="boolean"||typeof o=="string"||typeof o=="number"&&Number.isFinite(o))return o;throw new l("value","Report values must be finite scalar data")}function J(e){if(!e||typeof e!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(e)))throw new l("value","Report records must be plain data");const t=Object.getOwnPropertyDescriptor(e,"rowKey"),r=Object.getOwnPropertyDescriptor(e,"values");if(!t||!("value"in t)||!r||!("value"in r)||!r.value||typeof r.value!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(r.value)))throw new l("value","Report records require own scalar keys and plain values");return{rowKey:t.value,values:r.value}}function q(e,t,r={}){const o=b(r.maxRows,5e4,1e5),n=b(r.maxCells,1e6,2e6);if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype||e.length>o||e.length*t.length>n)throw new l("limit","Report data exceeds its budget");const c=new Map;for(let s=0;s<e.length;s++){const d=Object.getOwnPropertyDescriptor(e,s);if(!d||!("value"in d))throw new l("value","Sparse or accessor report records are unsupported");const i=J(d.value),a=k(i.rowKey);if(c.has(a))throw new l("duplicate","Duplicate business row key");const u=Object.create(null);for(const p of t){const f=C(i,p);f!==void 0&&(u[p]=f)}c.set(a,{rowKey:i.rowKey,values:u})}return c}function P(e){return e==null||e===""}function F(e,t){return P(e)?t.missing==="zero"?y.parseDecimal(0):void 0:y.parseDecimal(e)}function Q(e){return{coefficient:-e.coefficient,scale:e.scale}}function X(e,t,r,o){const n=F(e,r),c=Object.is(e,t)?n:F(t,r);if(!n||!c)return{equal:L(e,t,r),ratioUnavailable:"missing"};const s=y.addDecimal(c,Q(n)),d={...s,coefficient:s.coefficient<0n?-s.coefficient:s.coefficient},i=y.compareDecimal(d,r.toleranceValue)<=0;return i&&!o?{equal:i}:n.coefficient===0n?{equal:i,delta:y.printDecimal(s),...s.coefficient===0n&&r.zeroDenominator==="zero-if-equal"?{changeRatio:"0"}:{ratioUnavailable:"zero-denominator"}}:{equal:i,delta:y.printDecimal(s),changeRatio:y.printDecimal(y.divideDecimal(s,n,r.ratioDigits??12))}}function L(e,t,r){return r.missing==="empty-equivalent"&&P(e)&&P(t)||Object.is(e,t)}function Y(e){j(e.fields.map(t=>t.field),b(e.maxFields,256,1024));for(const t of e.fields){if(t.type!==void 0&&!["decimal","value"].includes(t.type))throw new l("value","Invalid comparison field type");if(t.missing&&!["distinct","empty-equivalent","zero"].includes(t.missing))throw new l("value","Invalid missing-value policy");if(t.zeroDenominator&&!["omit","zero-if-equal"].includes(t.zeroDenominator))throw new l("value","Invalid zero-denominator policy");if(t.missing==="zero"&&t.type!=="decimal")throw new l("value","Zero missing-value policy requires a decimal field");if(t.tolerance!==void 0&&(t.type!=="decimal"||y.compareDecimal(y.parseDecimal(t.tolerance),y.parseDecimal(0))<0))throw new l("value","Tolerance requires a non-negative decimal");if(t.ratioDigits!==void 0&&(!Number.isInteger(t.ratioDigits)||t.ratioDigits<0||t.ratioDigits>100))throw new l("value","Invalid ratio precision")}return e.fields.map(t=>({...t,toleranceValue:y.parseDecimal(t.tolerance??"0")}))}function M(e,t,r,o,n){let c=!1;for(const s of r){const d=e?C(e,s.field):void 0,i=t?C(t,s.field):void 0,a=s.type==="decimal"?X(d,i,s,!e||!t):{equal:L(d,i,s)};if(e&&t&&a.equal)continue;if(c=!0,o.length>=n)throw new l("limit","Report differences exceed their budget");const{equal:u,...p}=a;o.push({rowKey:(t??e).rowKey,kind:e?t?"changed":"removed":"added",field:s.field,label:s.label??s.field,before:d,after:i,...p})}return c}function ee(e,t,r){O(e),O(t);const o=Y(r);if(e.datasetId!==t.datasetId||e.sourceScope!==t.sourceScope)throw new l("identity","Comparison requires the same business dataset and source scope");const n=r.fields.map(u=>u.field),c=q(e.rows,n,r),s=q(t.rows,n,r),d=b(r.maxDifferences,2e4,1e5),i=[],a={added:0,removed:0,changed:0,unchanged:0,cells:0};for(const[u,p]of c){const f=s.get(u),m=M(p,f,o,i,d);f?m?a.changed++:a.unchanged++:a.removed++}for(const[u,p]of s)c.has(u)||(M(void 0,p,o,i,d),a.added++);return a.cells=i.length,{sourceScope:t.sourceScope,datasetId:t.datasetId,differences:i,counts:a}}function K(e,t){O(t),j(t.fields,b(t.maxFields,256,1024));const r=b(t.maxCells,1e6,2e6),o=new Set(t.fields),n=new Map,c=g.createReportCellResolver(e);let s=0;for(const[d,i]of e.pages.entries())for(const[a,u]of i.components.entries()){if(!u.grid)continue;for(const f of u.grid.cells)if(s+=f.length,s>r)throw new l("limit","Report cell scan exceeds its budget");const p=N.resolveGridLayout(u.grid,u.widthMm,u.heightMm).cells;for(const f of p){const m=c({pageIndex:d,componentIndex:a,rowIndex:f.ri,columnIndex:f.ci}),w=m?.source;if(!m||!w||w.datasetId!==t.datasetId||w.sourceScope!==t.sourceScope||!o.has(w.field))continue;k(w.rowKey);const I=g.reportCellEditKey(m),h=n.get(I);h?(!Object.is(h.context.value,m.value)||h.context.source?.revision!==w.revision||h.context.source?.sourceToken!==w.sourceToken||h.context.editable!==m.editable)&&(h.ambiguous=!0):n.set(I,{context:m,ambiguous:!1})}}return n}function te(e,t){const r=K(e,t),o=new Map,n=b(t.maxRows,5e4,1e5);for(const{context:c,ambiguous:s}of r.values()){if(s)throw new l("conflict","Repeated report cells disagree for the same business field");const d=c.source,i=k(d.rowKey);let a=o.get(i);if(!a){if(o.size>=n)throw new l("limit","Report row extraction exceeds its budget");a={rowKey:d.rowKey,values:Object.create(null)},o.set(i,a)}a.values[d.field]=c.value}return{sourceScope:t.sourceScope,datasetId:t.datasetId,rows:[...o.values()]}}function _(e){return e==null||e===""}function re(e,t,r){if(!t){e.reason="missing-target";return}const{context:o,ambiguous:n}=t;if(e.before=o.value,n){e.status="conflict",e.reason="ambiguous";return}if(!o.editable||r.canEdit?.(o)===!1){e.reason="readonly";return}if(_(e.after)){e.reason="missing-source";return}if(Object.is(o.value,e.after)){e.status="matched",e.reason="unchanged";return}if(r.mode!=="replace"&&!_(o.value)){e.reason="occupied";return}try{const c=g.editFromContext(o,e.after);if(Object.is(c.value,c.previousValue)){e.status="matched",e.reason="unchanged";return}return e.after=c.value,e.status="changed",c}catch{e.status="conflict",e.reason="invalid";return}}function oe(e,t){if(O(t),t.mode!==void 0&&t.mode!=="empty"&&t.mode!=="replace")throw new l("value","Invalid prefill policy");const r=b(t.maxFields,256,1024),o=t.fields.map(f=>f.field),n=[...new Set(t.fields.map(f=>f.sourceField??f.field))];j(o,r),j(n,r);const c=q(t.rows,n,t),s=K(e,{...t,fields:o}),d=b(t.maxChanges,1e4,1e4),i=b(t.maxCells,1e6,2e6);if(c.size*o.length>i)throw new l("limit","Prefill review exceeds its budget");const a=[],u=[],p={matched:0,changed:0,skipped:0,conflict:0};for(const f of c.values())for(const m of t.fields){const w={sourceScope:t.sourceScope,datasetId:t.datasetId,rowKey:f.rowKey,field:m.field},I={source:w,label:m.label??m.field,status:"skipped",after:C(f,m.sourceField??m.field)},h=g.reportCellEditKey({address:{pageIndex:0,componentIndex:0,rowIndex:0,columnIndex:0},source:w}),D=re(I,s.get(h),t);if(D){if(u.length>=d)throw new l("limit","Prefill changes exceed the atomic edit budget");u.push(D)}p[I.status]++,a.push(I)}return{sourceScope:t.sourceScope,datasetId:t.datasetId,items:a,counts:p,edits:u}}function ne(e,t,r){if(t.counts.conflict>0)throw new l("conflict","Resolve prefill conflicts before applying");if(t.edits.length>1e4)throw new l("limit","Prefill changes exceed the atomic edit budget");if(!t.edits.length)return[];const o=[...new Set(t.edits.map(s=>s.source.field))],n=K(e,{sourceScope:t.sourceScope,datasetId:t.datasetId,fields:o}),c=new Set;return t.edits.map(s=>{if(!s.source||s.source.datasetId!==t.datasetId||s.source.sourceScope!==t.sourceScope)throw new l("identity","Prefill identity changed");const d=g.reportCellEditKey(s),i=n.get(d);if(c.has(d))throw new l("duplicate","Duplicate prefill target");if(c.add(d),!i||i.ambiguous||g.sourceChanged(i.context,s)||!Object.is(i.context.value,s.previousValue))throw new l("conflict","Prefill target changed; reload the preview");if(!i.context.editable||r?.(i.context)===!1)throw new l("conflict","Prefill target is read-only");return{address:{...i.context.address},value:g.editFromContext(i.context,s.value).value}})}exports.ReportDataError=l;exports.ReportDrillError=v;exports.compareReportData=ee;exports.createPageWindowIndex=B;exports.createReportDrillRequest=Z;exports.createReportPrefill=oe;exports.dataLimit=b;exports.indexReportDataCells=K;exports.matchReportDrillActions=U;exports.reportDataSnapshotFromPlan=te;exports.reportPrefillInputs=ne;exports.resolveReportDrillReturn=H;exports.validateReportDrillActions=A;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { R as i, v as u, s as p } from "./json-snapshot-BRnzKudk.js";
|
|
2
|
+
import { R as d, b as y, t as c, p as l } from "./sha256-BDQ1Qk7A.js";
|
|
3
|
+
import { s as g, a as m } from "./workbook-sheets-D4M7XXBh.js";
|
|
4
|
+
function P(e) {
|
|
5
|
+
return e && { ...e, sheetNames: m(e.sheetNames), additionalSheets: g(e.additionalSheets) };
|
|
6
|
+
}
|
|
7
|
+
function S(e, r) {
|
|
8
|
+
if (e.format !== "xlsx") return;
|
|
9
|
+
const t = e.xlsx?.additionalSheets?.reduce((o, a) => o + a.rows.reduce((n, s) => n + s.length, 0), 0) ?? 0;
|
|
10
|
+
y(r, "maxCells", e.prepared.stats.cells + t);
|
|
11
|
+
}
|
|
12
|
+
function I(e) {
|
|
13
|
+
if (!e) return;
|
|
14
|
+
const r = (t) => {
|
|
15
|
+
if (!(t instanceof Uint8Array) && !(t instanceof ArrayBuffer)) throw new i("validate", "字体应为 Uint8Array 或 ArrayBuffer");
|
|
16
|
+
if (t.byteLength > 32e6) throw new d("budget", "单份字体超过 32 MB", "$.pdf");
|
|
17
|
+
return new Uint8Array(t instanceof Uint8Array ? t : new Uint8Array(t));
|
|
18
|
+
};
|
|
19
|
+
if (e.customFontFaces) {
|
|
20
|
+
const t = e.customFontFaces;
|
|
21
|
+
return { customFontName: e.customFontName, customFontFaces: { regular: r(t.regular), ...t.bold ? { bold: r(t.bold) } : {}, ...t.italic ? { italic: r(t.italic) } : {}, ...t.boldItalic ? { boldItalic: r(t.boldItalic) } : {} } };
|
|
22
|
+
}
|
|
23
|
+
return { customFontName: e.customFontName, ...e.customFontBytes ? { customFontBytes: r(e.customFontBytes) } : {} };
|
|
24
|
+
}
|
|
25
|
+
function w(e) {
|
|
26
|
+
const r = e?.customFontFaces ?? (e?.customFontBytes ? { regular: e.customFontBytes } : void 0);
|
|
27
|
+
if (!r) return;
|
|
28
|
+
const t = ["regular", "bold", "italic", "boldItalic"].map((o) => {
|
|
29
|
+
const a = r[o];
|
|
30
|
+
if (!a) return [o, null];
|
|
31
|
+
const n = a instanceof Uint8Array ? a : new Uint8Array(a);
|
|
32
|
+
if (n.byteLength > 32e6) throw new d("budget", "单份字体超过 32 MB", "$.pdf");
|
|
33
|
+
return [o, l(n)];
|
|
34
|
+
});
|
|
35
|
+
return l(new TextEncoder().encode(JSON.stringify(t)));
|
|
36
|
+
}
|
|
37
|
+
const f = /* @__PURE__ */ new WeakMap();
|
|
38
|
+
function N(e, r, t) {
|
|
39
|
+
const o = v(e, r, t);
|
|
40
|
+
let a = !0;
|
|
41
|
+
return { prepared: o, forward() {
|
|
42
|
+
if (!a) throw new Error("报表快照只能交接一次");
|
|
43
|
+
return a = !1, f.set(o, r), o;
|
|
44
|
+
} };
|
|
45
|
+
}
|
|
46
|
+
function v(e, r, t) {
|
|
47
|
+
if (c(t), !Number.isSafeInteger(r) || r <= 0) throw new d("budget", "快照预算应为正安全整数", "$.budget.maxPreparedBytes");
|
|
48
|
+
const o = f.get(e);
|
|
49
|
+
if (f.delete(e), o !== void 0 && o <= r) return e;
|
|
50
|
+
const a = p(e, {
|
|
51
|
+
maxBytes: r,
|
|
52
|
+
maxNodes: r,
|
|
53
|
+
check: () => c(t),
|
|
54
|
+
error: (n, s) => n === "budget" ? new d("budget", s, "$.budget.maxPreparedBytes") : new i("validate", s)
|
|
55
|
+
});
|
|
56
|
+
return F(a), a;
|
|
57
|
+
}
|
|
58
|
+
function b(e) {
|
|
59
|
+
if (e === void 0) return !0;
|
|
60
|
+
if (!Array.isArray(e)) return !1;
|
|
61
|
+
const r = /* @__PURE__ */ new Set();
|
|
62
|
+
return e.every((t) => !t || typeof t != "object" || Array.isArray(t) || typeof t.reportId != "string" || !t.reportId.trim() || !Number.isSafeInteger(t.reportIndex) || t.reportIndex < 0 || r.has(t.reportIndex) || typeof t.reportScope != "string" || !t.reportScope.trim() || t.reportScope.length > 4096 || t.revision !== void 0 && typeof t.revision != "string" || t.sourceToken !== void 0 && typeof t.sourceToken != "string" ? !1 : (r.add(t.reportIndex), !0));
|
|
63
|
+
}
|
|
64
|
+
function F(e) {
|
|
65
|
+
if (!b(e.sources)) throw new i("validate", "准备结果来源清单无效");
|
|
66
|
+
if (!e?.stats || ["rows", "pages", "cells"].some((r) => !Number.isSafeInteger(e.stats[r]) || e.stats[r] < 0) || !Number.isFinite(e.stats.durationMs) || e.stats.durationMs < 0) throw new i("validate", "准备结果统计无效");
|
|
67
|
+
if (!Array.isArray(e.diagnostics) || e.diagnostics.some((r) => !r || typeof r.code != "string" || typeof r.message != "string" || !["info", "warning", "error"].includes(r.severity) || !u(r))) throw new i("validate", "准备结果诊断无效");
|
|
68
|
+
if (!e.revisions || typeof e.revisions != "object" || Array.isArray(e.revisions) || Object.values(e.revisions).some((r) => !r || typeof r != "object" || r.revision !== void 0 && typeof r.revision != "string" || r.sourceToken !== void 0 && typeof r.sourceToken != "string")) throw new i("validate", "准备结果修订无效");
|
|
69
|
+
if (e.layout && (!["heuristic", "provided", "font-bytes"].includes(e.layout.textMetrics) || e.layout.fontFingerprint !== void 0 && !/^[a-f0-9]{64}$/.test(e.layout.fontFingerprint))) throw new i("validate", "准备结果字体度量标识无效");
|
|
70
|
+
}
|
|
71
|
+
function B(e) {
|
|
72
|
+
if (e.layoutPolicy !== void 0 && !["verify", "preserve"].includes(e.layoutPolicy)) throw new i("validate", "无效的 layoutPolicy");
|
|
73
|
+
if (e.format !== "pdf") return;
|
|
74
|
+
if (e.layoutPolicy === "preserve" && !e.prepared.layout?.fontFingerprint) {
|
|
75
|
+
e.prepared.diagnostics.push({ code: "prepared-layout-preserved", severity: "info", message: "显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。" });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const r = e.prepared.layout?.fontFingerprint, t = w(e.pdf);
|
|
79
|
+
if (r === t && (r !== void 0 || e.prepared.layout?.textMetrics === "heuristic" && !t)) return;
|
|
80
|
+
const o = "已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";
|
|
81
|
+
if (e.fidelity === "strict") throw new i("validate", o);
|
|
82
|
+
e.prepared.diagnostics.push({ code: "prepared-font-metrics", severity: "warning", message: o });
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
P as a,
|
|
86
|
+
S as b,
|
|
87
|
+
N as c,
|
|
88
|
+
b as d,
|
|
89
|
+
v as e,
|
|
90
|
+
B as f,
|
|
91
|
+
w as r,
|
|
92
|
+
I as s,
|
|
93
|
+
F as v
|
|
94
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("./json-snapshot-DNiIbpOr.cjs"),a=require("./sha256-DgZAKXqI.cjs"),f=require("./workbook-sheets-CaPAulQ6.cjs");function g(e){return e&&{...e,sheetNames:f.snapshotSheetNames(e.sheetNames),additionalSheets:f.snapshotAdditionalSheets(e.additionalSheets)}}function w(e,t){if(e.format!=="xlsx")return;const r=e.xlsx?.additionalSheets?.reduce((o,i)=>o+i.rows.reduce((s,d)=>s+d.length,0),0)??0;a.assertBudget(t,"maxCells",e.prepared.stats.cells+r)}function m(e){if(!e)return;const t=r=>{if(!(r instanceof Uint8Array)&&!(r instanceof ArrayBuffer))throw new n.ReportSourceError("validate","字体应为 Uint8Array 或 ArrayBuffer");if(r.byteLength>32e6)throw new a.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return new Uint8Array(r instanceof Uint8Array?r:new Uint8Array(r))};if(e.customFontFaces){const r=e.customFontFaces;return{customFontName:e.customFontName,customFontFaces:{regular:t(r.regular),...r.bold?{bold:t(r.bold)}:{},...r.italic?{italic:t(r.italic)}:{},...r.boldItalic?{boldItalic:t(r.boldItalic)}:{}}}}return{customFontName:e.customFontName,...e.customFontBytes?{customFontBytes:t(e.customFontBytes)}:{}}}function u(e){const t=e?.customFontFaces??(e?.customFontBytes?{regular:e.customFontBytes}:void 0);if(!t)return;const r=["regular","bold","italic","boldItalic"].map(o=>{const i=t[o];if(!i)return[o,null];const s=i instanceof Uint8Array?i:new Uint8Array(i);if(s.byteLength>32e6)throw new a.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return[o,a.portableSha256Hex(s)]});return a.portableSha256Hex(new TextEncoder().encode(JSON.stringify(r)))}const c=new WeakMap;function h(e,t,r){const o=l(e,t,r);let i=!0;return{prepared:o,forward(){if(!i)throw new Error("报表快照只能交接一次");return i=!1,c.set(o,t),o}}}function l(e,t,r){if(a.throwIfAborted(r),!Number.isSafeInteger(t)||t<=0)throw new a.ReportRuntimeError("budget","快照预算应为正安全整数","$.budget.maxPreparedBytes");const o=c.get(e);if(c.delete(e),o!==void 0&&o<=t)return e;const i=n.snapshotReportJson(e,{maxBytes:t,maxNodes:t,check:()=>a.throwIfAborted(r),error:(s,d)=>s==="budget"?new a.ReportRuntimeError("budget",d,"$.budget.maxPreparedBytes"):new n.ReportSourceError("validate",d)});return y(i),i}function p(e){if(e===void 0)return!0;if(!Array.isArray(e))return!1;const t=new Set;return e.every(r=>!r||typeof r!="object"||Array.isArray(r)||typeof r.reportId!="string"||!r.reportId.trim()||!Number.isSafeInteger(r.reportIndex)||r.reportIndex<0||t.has(r.reportIndex)||typeof r.reportScope!="string"||!r.reportScope.trim()||r.reportScope.length>4096||r.revision!==void 0&&typeof r.revision!="string"||r.sourceToken!==void 0&&typeof r.sourceToken!="string"?!1:(t.add(r.reportIndex),!0))}function y(e){if(!p(e.sources))throw new n.ReportSourceError("validate","准备结果来源清单无效");if(!e?.stats||["rows","pages","cells"].some(t=>!Number.isSafeInteger(e.stats[t])||e.stats[t]<0)||!Number.isFinite(e.stats.durationMs)||e.stats.durationMs<0)throw new n.ReportSourceError("validate","准备结果统计无效");if(!Array.isArray(e.diagnostics)||e.diagnostics.some(t=>!t||typeof t.code!="string"||typeof t.message!="string"||!["info","warning","error"].includes(t.severity)||!n.hasValidDataExplanation(t)))throw new n.ReportSourceError("validate","准备结果诊断无效");if(!e.revisions||typeof e.revisions!="object"||Array.isArray(e.revisions)||Object.values(e.revisions).some(t=>!t||typeof t!="object"||t.revision!==void 0&&typeof t.revision!="string"||t.sourceToken!==void 0&&typeof t.sourceToken!="string"))throw new n.ReportSourceError("validate","准备结果修订无效");if(e.layout&&(!["heuristic","provided","font-bytes"].includes(e.layout.textMetrics)||e.layout.fontFingerprint!==void 0&&!/^[a-f0-9]{64}$/.test(e.layout.fontFingerprint)))throw new n.ReportSourceError("validate","准备结果字体度量标识无效")}function v(e){if(e.layoutPolicy!==void 0&&!["verify","preserve"].includes(e.layoutPolicy))throw new n.ReportSourceError("validate","无效的 layoutPolicy");if(e.format!=="pdf")return;if(e.layoutPolicy==="preserve"&&!e.prepared.layout?.fontFingerprint){e.prepared.diagnostics.push({code:"prepared-layout-preserved",severity:"info",message:"显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。"});return}const t=e.prepared.layout?.fontFingerprint,r=u(e.pdf);if(t===r&&(t!==void 0||e.prepared.layout?.textMetrics==="heuristic"&&!r))return;const o="已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";if(e.fidelity==="strict")throw new n.ReportSourceError("validate",o);e.prepared.diagnostics.push({code:"prepared-font-metrics",severity:"warning",message:o})}exports.assertPreparedOutputBudget=w;exports.capturePreparedHandoff=h;exports.checkPreparedFont=v;exports.reportFontFingerprint=u;exports.snapshotPdfFonts=m;exports.snapshotPreparedReport=l;exports.snapshotXlsxOptions=g;exports.validPreparedSources=p;exports.validatePreparedMetadata=y;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
const G = 1.35, K = 10.5, W = '"Microsoft YaHei", sans-serif', q = 0.75, z = "#333333", F = "#000000", k = "1.0.0-mach", V = 25.4, Y = 96;
|
|
2
|
+
function O(t = 96) {
|
|
3
|
+
return t / 25.4;
|
|
4
|
+
}
|
|
5
|
+
function X(t, e = 96) {
|
|
6
|
+
return (t || 0) * O(e);
|
|
7
|
+
}
|
|
8
|
+
function Z(t, e = 96) {
|
|
9
|
+
return t / O(e);
|
|
10
|
+
}
|
|
11
|
+
function v(t, e = 96) {
|
|
12
|
+
return t * e / 72;
|
|
13
|
+
}
|
|
14
|
+
function J(t, e) {
|
|
15
|
+
const n = 10 ** e;
|
|
16
|
+
return Math.round(t * n) / n;
|
|
17
|
+
}
|
|
18
|
+
const Q = {
|
|
19
|
+
a3: { widthMm: 297, heightMm: 420 },
|
|
20
|
+
a4: { widthMm: 210, heightMm: 297 },
|
|
21
|
+
a5: { widthMm: 148, heightMm: 210 },
|
|
22
|
+
b4: { widthMm: 250, heightMm: 353 },
|
|
23
|
+
b5: { widthMm: 176, heightMm: 250 }
|
|
24
|
+
};
|
|
25
|
+
function tt(t, e = 96, n = 10.5) {
|
|
26
|
+
if (t?.fontSizePx != null)
|
|
27
|
+
return { fontSizePt: t.fontSizePx * 72 / e, fontSizePx: t.fontSizePx };
|
|
28
|
+
const o = t?.fontSize ?? n;
|
|
29
|
+
return { fontSizePt: o, fontSizePx: v(o, e) };
|
|
30
|
+
}
|
|
31
|
+
function et(t, e = z) {
|
|
32
|
+
return {
|
|
33
|
+
color: t?.borderColor ?? t?.lineColor ?? e,
|
|
34
|
+
widthPt: t?.lineWidthPt ?? 0.75
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function nt(t, e = F) {
|
|
38
|
+
return t?.color ?? e;
|
|
39
|
+
}
|
|
40
|
+
function ot(t) {
|
|
41
|
+
return t?.lineHeight ?? 1.35;
|
|
42
|
+
}
|
|
43
|
+
function rt(t) {
|
|
44
|
+
const e = t?.borderTop !== !1, n = t?.borderRight !== !1, o = t?.borderBottom !== !1, i = t?.borderLeft !== !1;
|
|
45
|
+
return { top: e, right: n, bottom: o, left: i, inner: e || n || o || i };
|
|
46
|
+
}
|
|
47
|
+
function st(t, e) {
|
|
48
|
+
const n = { ...t, ...e };
|
|
49
|
+
return e?.fontSize != null && e.fontSizePx == null && delete n.fontSizePx, e?.fontSizePx != null && e.fontSize == null && delete n.fontSize, n;
|
|
50
|
+
}
|
|
51
|
+
function H(t, e) {
|
|
52
|
+
const n = t.length;
|
|
53
|
+
if (n === 0) return [];
|
|
54
|
+
const o = t.reduce((f, h) => f + h, 0), i = o > 0 && e > 0 ? e / o : 1, a = [];
|
|
55
|
+
let u = 0;
|
|
56
|
+
for (let f = 0; f < n; f++) {
|
|
57
|
+
const h = Math.max(0, t[f] * i);
|
|
58
|
+
a.push({ pos: u, size: h }), u += h;
|
|
59
|
+
}
|
|
60
|
+
return a;
|
|
61
|
+
}
|
|
62
|
+
function L(t, e, n) {
|
|
63
|
+
return t?.length ? H(t, e) : Array.from({ length: n }, (o, i) => ({
|
|
64
|
+
pos: e * i / n,
|
|
65
|
+
size: e / n
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
function it(t, e, n) {
|
|
69
|
+
const o = t.cells ?? [], i = Math.max(o.length, 1), a = t.colWidthsMm?.length ?? o.reduce((r, s) => Math.max(r, Array.isArray(s) ? s.length : 0), 1), u = L(t.colWidthsMm, e, a), f = (r) => r <= 0 ? 0 : r >= a ? u[u.length - 1].pos + u[u.length - 1].size : u[r].pos, h = L(t.rowHeightsMm, n, i), S = (r) => r <= 0 ? 0 : r >= i ? h[h.length - 1].pos + h[h.length - 1].size : h[r].pos, w = /* @__PURE__ */ new Set(), g = (r, s) => `${r}:${s}`, T = [], M = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set(), x = (r, s) => `v${r}:${s}`, y = (r, s) => `h${r}:${s}`;
|
|
70
|
+
o.forEach((r, s) => {
|
|
71
|
+
if (!Array.isArray(r)) return;
|
|
72
|
+
let c = 0;
|
|
73
|
+
for (const m of r) {
|
|
74
|
+
for (; c < a && w.has(g(s, c)); ) c++;
|
|
75
|
+
if (c >= a) break;
|
|
76
|
+
const I = Math.max(1, Math.min(m?.colSpan ?? 1, a - c)), $ = Math.max(1, m?.rowSpan ?? 1), E = Math.min(i, s + $), p = Math.min(a, c + I);
|
|
77
|
+
for (let d = s; d < E; d++)
|
|
78
|
+
for (let l = c; l < p; l++)
|
|
79
|
+
w.add(g(d, l));
|
|
80
|
+
for (let d = c + 1; d < p; d++)
|
|
81
|
+
for (let l = s; l < E; l++) M.add(x(d, l));
|
|
82
|
+
for (let d = s + 1; d < E; d++)
|
|
83
|
+
for (let l = c; l < p; l++) _.add(y(d, l));
|
|
84
|
+
const D = f(c), C = S(s);
|
|
85
|
+
T.push({
|
|
86
|
+
ri: s,
|
|
87
|
+
ci: c,
|
|
88
|
+
cell: m ?? {},
|
|
89
|
+
xMm: D,
|
|
90
|
+
yMm: C,
|
|
91
|
+
widthMm: f(p) - D,
|
|
92
|
+
heightMm: S(E) - C
|
|
93
|
+
}), c = p;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const b = [];
|
|
97
|
+
for (let r = 1; r < a; r++) {
|
|
98
|
+
let s = -1;
|
|
99
|
+
for (let c = 0; c <= i; c++) {
|
|
100
|
+
const m = c < i && !M.has(x(r, c));
|
|
101
|
+
m && s < 0 && (s = c), !m && s >= 0 && (b.push({ kind: "v", pos: f(r), from: S(s), to: S(c) }), s = -1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
for (let r = 1; r < i; r++) {
|
|
105
|
+
let s = -1;
|
|
106
|
+
for (let c = 0; c <= a; c++) {
|
|
107
|
+
const m = c < a && !_.has(y(r, c));
|
|
108
|
+
m && s < 0 && (s = c), !m && s >= 0 && (b.push({ kind: "h", pos: S(r), from: f(s), to: f(c) }), s = -1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return { columns: u, rows: h, cells: T, edges: b };
|
|
112
|
+
}
|
|
113
|
+
function ct(t) {
|
|
114
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return !1;
|
|
115
|
+
const { start: e, end: n, color: o } = t;
|
|
116
|
+
return typeof e == "number" && typeof n == "number" && Number.isFinite(e) && Number.isFinite(n) && e >= 0 && n <= 1 && e <= n && typeof o == "string" && /^#[0-9a-f]{6}$/i.test(o);
|
|
117
|
+
}
|
|
118
|
+
const at = k;
|
|
119
|
+
function ft(t) {
|
|
120
|
+
return (t.kind === "image" || t.kind === "barcode" || t.kind === "qrcode" || t.kind === "chart") && !!t.imageData;
|
|
121
|
+
}
|
|
122
|
+
function ut(t) {
|
|
123
|
+
return t.kind === "text" && Array.isArray(t.richParagraphs) && t.richParagraphs.length > 0;
|
|
124
|
+
}
|
|
125
|
+
function A(t) {
|
|
126
|
+
return !!t && typeof t == "object";
|
|
127
|
+
}
|
|
128
|
+
function R(t, e, n, o, i) {
|
|
129
|
+
if (++i.nodes > 1e6) return { path: e, message: "组件树超过100万个结构节点预算" };
|
|
130
|
+
if (A(t)) {
|
|
131
|
+
if (n > 64) return { path: e, message: "组件嵌套超过64层预算" };
|
|
132
|
+
if (o.has(t)) return { path: e, message: "组件树包含循环引用" };
|
|
133
|
+
if (!(!A(t.grid) || !Array.isArray(t.grid.cells))) {
|
|
134
|
+
o.add(t);
|
|
135
|
+
try {
|
|
136
|
+
for (const [a, u] of t.grid.cells.entries())
|
|
137
|
+
if (Array.isArray(u))
|
|
138
|
+
for (const [f, h] of u.entries()) {
|
|
139
|
+
if (++i.nodes > 1e6) return { path: e, message: "组件树超过100万个结构节点预算" };
|
|
140
|
+
if (!(!A(h) || !Array.isArray(h.children)))
|
|
141
|
+
for (const [S, w] of h.children.entries()) {
|
|
142
|
+
const g = R(w, `${e}.grid.cells.${a}.${f}.children.${S}`, n + 1, o, i);
|
|
143
|
+
if (g) return g;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
} finally {
|
|
147
|
+
o.delete(t);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function N(t, e = "$.components", n = { nodes: 0 }) {
|
|
153
|
+
for (const [o, i] of t.entries()) {
|
|
154
|
+
const a = R(i, `${e}.${o}`, 0, /* @__PURE__ */ new Set(), n);
|
|
155
|
+
if (a) return a;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function B(t) {
|
|
159
|
+
const e = { nodes: 0 };
|
|
160
|
+
for (const [n, o] of t.entries()) {
|
|
161
|
+
if (!A(o) || !Array.isArray(o.components)) continue;
|
|
162
|
+
const i = N(o.components, `$.pages.${n}.components`, e);
|
|
163
|
+
if (i) return i;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function ht(t) {
|
|
167
|
+
const e = B(t.pages);
|
|
168
|
+
if (e) throw new TypeError(`${e.path}: ${e.message}`);
|
|
169
|
+
}
|
|
170
|
+
function P(t) {
|
|
171
|
+
if (t?.aborted) throw t.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
172
|
+
}
|
|
173
|
+
function U(t) {
|
|
174
|
+
try {
|
|
175
|
+
Promise.resolve(t()).catch(() => {
|
|
176
|
+
});
|
|
177
|
+
} catch {
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function j(t, e, n) {
|
|
181
|
+
P(t.signal), U(() => t.onProgress?.(e, n)), P(t.signal);
|
|
182
|
+
}
|
|
183
|
+
function dt(t, e) {
|
|
184
|
+
const n = Promise.resolve(t);
|
|
185
|
+
return e?.aborted ? (n.catch(() => {
|
|
186
|
+
}), Promise.reject(e.reason ?? new DOMException("The operation was aborted.", "AbortError"))) : e ? new Promise((o, i) => {
|
|
187
|
+
const a = () => e.removeEventListener("abort", u), u = () => {
|
|
188
|
+
a(), i(e.reason ?? new DOMException("The operation was aborted.", "AbortError"));
|
|
189
|
+
};
|
|
190
|
+
e.addEventListener("abort", u, { once: !0 }), n.then((f) => {
|
|
191
|
+
a(), o(f);
|
|
192
|
+
}, (f) => {
|
|
193
|
+
a(), i(f);
|
|
194
|
+
}), e.aborted && u();
|
|
195
|
+
}) : n;
|
|
196
|
+
}
|
|
197
|
+
function lt(t, e) {
|
|
198
|
+
const n = () => e.abort(t?.reason);
|
|
199
|
+
return t?.addEventListener("abort", n, { once: !0 }), t?.aborted && n(), () => t?.removeEventListener("abort", n);
|
|
200
|
+
}
|
|
201
|
+
async function mt(t, e, n) {
|
|
202
|
+
j(t, e, n), (t.signal || t.onProgress) && await new Promise((o) => setTimeout(o, 0)), P(t.signal);
|
|
203
|
+
}
|
|
204
|
+
function St(t) {
|
|
205
|
+
let e = 0, n = Date.now();
|
|
206
|
+
return (o = 1) => {
|
|
207
|
+
if (P(t.signal), e += o, !(e < 4096 && Date.now() - n < 8))
|
|
208
|
+
return e = 0, new Promise((i) => setTimeout(i, 0)).then(() => {
|
|
209
|
+
n = Date.now(), P(t.signal);
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
export {
|
|
214
|
+
N as A,
|
|
215
|
+
B,
|
|
216
|
+
Y as C,
|
|
217
|
+
W as D,
|
|
218
|
+
ht as E,
|
|
219
|
+
G as L,
|
|
220
|
+
V as M,
|
|
221
|
+
Q as P,
|
|
222
|
+
at as R,
|
|
223
|
+
k as S,
|
|
224
|
+
tt as a,
|
|
225
|
+
ot as b,
|
|
226
|
+
nt as c,
|
|
227
|
+
et as d,
|
|
228
|
+
rt as e,
|
|
229
|
+
ut as f,
|
|
230
|
+
F as g,
|
|
231
|
+
q as h,
|
|
232
|
+
ft as i,
|
|
233
|
+
K as j,
|
|
234
|
+
z as k,
|
|
235
|
+
X as l,
|
|
236
|
+
st as m,
|
|
237
|
+
O as n,
|
|
238
|
+
mt as o,
|
|
239
|
+
v as p,
|
|
240
|
+
Z as q,
|
|
241
|
+
it as r,
|
|
242
|
+
J as s,
|
|
243
|
+
St as t,
|
|
244
|
+
U as u,
|
|
245
|
+
P as v,
|
|
246
|
+
dt as w,
|
|
247
|
+
j as x,
|
|
248
|
+
ct as y,
|
|
249
|
+
lt as z
|
|
250
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const G='"Microsoft YaHei", sans-serif';const I="#333333",F="#000000",y="1.0.0-mach";function M(e=96){return e/25.4}function K(e,t=96){return(e||0)*M(t)}function V(e,t=96){return e/M(t)}function N(e,t=96){return e*t/72}function j(e,t){const o=10**t;return Math.round(e*o)/o}const W={a3:{widthMm:297,heightMm:420},a4:{widthMm:210,heightMm:297},a5:{widthMm:148,heightMm:210},b4:{widthMm:250,heightMm:353},b5:{widthMm:176,heightMm:250}};function Y(e,t=96,o=10.5){if(e?.fontSizePx!=null)return{fontSizePt:e.fontSizePx*72/t,fontSizePx:e.fontSizePx};const n=e?.fontSize??o;return{fontSizePt:n,fontSizePx:N(n,t)}}function X(e,t=I){return{color:e?.borderColor??e?.lineColor??t,widthPt:e?.lineWidthPt??.75}}function Z(e,t=F){return e?.color??t}function q(e){return e?.lineHeight??1.35}function J(e){const t=e?.borderTop!==!1,o=e?.borderRight!==!1,n=e?.borderBottom!==!1,i=e?.borderLeft!==!1;return{top:t,right:o,bottom:n,left:i,inner:t||o||n||i}}function Q(e,t){const o={...e,...t};return t?.fontSize!=null&&t.fontSizePx==null&&delete o.fontSizePx,t?.fontSizePx!=null&&t.fontSize==null&&delete o.fontSize,o}function ee(e,t){const o=e.length;if(o===0)return[];const n=e.reduce((a,d)=>a+d,0),i=n>0&&t>0?t/n:1,u=[];let f=0;for(let a=0;a<o;a++){const d=Math.max(0,e[a]*i);u.push({pos:f,size:d}),f+=d}return u}function C(e,t,o){return e?.length?ee(e,t):Array.from({length:o},(n,i)=>({pos:t*i/o,size:t/o}))}function te(e,t,o){const n=e.cells??[],i=Math.max(n.length,1),u=e.colWidthsMm?.length??n.reduce((r,s)=>Math.max(r,Array.isArray(s)?s.length:0),1),f=C(e.colWidthsMm,t,u),a=r=>r<=0?0:r>=u?f[f.length-1].pos+f[f.length-1].size:f[r].pos,d=C(e.rowHeightsMm,o,i),E=r=>r<=0?0:r>=i?d[d.length-1].pos+d[d.length-1].size:d[r].pos,P=new Set,S=(r,s)=>`${r}:${s}`,w=[],O=new Set,b=new Set,D=(r,s)=>`v${r}:${s}`,x=(r,s)=>`h${r}:${s}`;n.forEach((r,s)=>{if(!Array.isArray(r))return;let c=0;for(const m of r){for(;c<u&&P.has(S(s,c));)c++;if(c>=u)break;const k=Math.max(1,Math.min(m?.colSpan??1,u-c)),U=Math.max(1,m?.rowSpan??1),p=Math.min(i,s+U),_=Math.min(u,c+k);for(let l=s;l<p;l++)for(let h=c;h<_;h++)P.add(S(l,h));for(let l=c+1;l<_;l++)for(let h=s;h<p;h++)O.add(D(l,h));for(let l=s+1;l<p;l++)for(let h=c;h<_;h++)b.add(x(l,h));const L=a(c),R=E(s);w.push({ri:s,ci:c,cell:m??{},xMm:L,yMm:R,widthMm:a(_)-L,heightMm:E(p)-R}),c=_}});const g=[];for(let r=1;r<u;r++){let s=-1;for(let c=0;c<=i;c++){const m=c<i&&!O.has(D(r,c));m&&s<0&&(s=c),!m&&s>=0&&(g.push({kind:"v",pos:a(r),from:E(s),to:E(c)}),s=-1)}}for(let r=1;r<i;r++){let s=-1;for(let c=0;c<=u;c++){const m=c<u&&!b.has(x(r,c));m&&s<0&&(s=c),!m&&s>=0&&(g.push({kind:"h",pos:E(r),from:a(s),to:a(c)}),s=-1)}}return{columns:f,rows:d,cells:w,edges:g}}function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const{start:t,end:o,color:n}=e;return typeof t=="number"&&typeof o=="number"&&Number.isFinite(t)&&Number.isFinite(o)&&t>=0&&o<=1&&t<=o&&typeof n=="string"&&/^#[0-9a-f]{6}$/i.test(n)}const ne=y;function re(e){return(e.kind==="image"||e.kind==="barcode"||e.kind==="qrcode"||e.kind==="chart")&&!!e.imageData}function se(e){return e.kind==="text"&&Array.isArray(e.richParagraphs)&&e.richParagraphs.length>0}function A(e){return!!e&&typeof e=="object"}function H(e,t,o,n,i){if(++i.nodes>1e6)return{path:t,message:"组件树超过100万个结构节点预算"};if(A(e)){if(o>64)return{path:t,message:"组件嵌套超过64层预算"};if(n.has(e))return{path:t,message:"组件树包含循环引用"};if(!(!A(e.grid)||!Array.isArray(e.grid.cells))){n.add(e);try{for(const[u,f]of e.grid.cells.entries())if(Array.isArray(f))for(const[a,d]of f.entries()){if(++i.nodes>1e6)return{path:t,message:"组件树超过100万个结构节点预算"};if(!(!A(d)||!Array.isArray(d.children)))for(const[E,P]of d.children.entries()){const S=H(P,`${t}.grid.cells.${u}.${a}.children.${E}`,o+1,n,i);if(S)return S}}}finally{n.delete(e)}}}}function v(e,t="$.components",o={nodes:0}){for(const[n,i]of e.entries()){const u=H(i,`${t}.${n}`,0,new Set,o);if(u)return u}}function $(e){const t={nodes:0};for(const[o,n]of e.entries()){if(!A(n)||!Array.isArray(n.components))continue;const i=v(n.components,`$.pages.${o}.components`,t);if(i)return i}}function ie(e){const t=$(e.pages);if(t)throw new TypeError(`${t.path}: ${t.message}`)}function T(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}function z(e){try{Promise.resolve(e()).catch(()=>{})}catch{}}function B(e,t,o){T(e.signal),z(()=>e.onProgress?.(t,o)),T(e.signal)}function ce(e,t){const o=Promise.resolve(e);return t?.aborted?(o.catch(()=>{}),Promise.reject(t.reason??new DOMException("The operation was aborted.","AbortError"))):t?new Promise((n,i)=>{const u=()=>t.removeEventListener("abort",f),f=()=>{u(),i(t.reason??new DOMException("The operation was aborted.","AbortError"))};t.addEventListener("abort",f,{once:!0}),o.then(a=>{u(),n(a)},a=>{u(),i(a)}),t.aborted&&f()}):o}function ue(e,t){const o=()=>t.abort(e?.reason);return e?.addEventListener("abort",o,{once:!0}),e?.aborted&&o(),()=>e?.removeEventListener("abort",o)}async function ae(e,t,o){B(e,t,o),(e.signal||e.onProgress)&&await new Promise(n=>setTimeout(n,0)),T(e.signal)}function fe(e){let t=0,o=Date.now();return(n=1)=>{if(T(e.signal),t+=n,!(t<4096&&Date.now()-o<8))return t=0,new Promise(i=>setTimeout(i,0)).then(()=>{o=Date.now(),T(e.signal)})}}exports.CSS_DPI=96;exports.DEFAULT_BORDER_PT=.75;exports.DEFAULT_FONT_FAMILY=G;exports.DEFAULT_FONT_PT=10.5;exports.DEFAULT_STROKE_COLOR=I;exports.DEFAULT_TEXT_COLOR=F;exports.LINE_HEIGHT=1.35;exports.MM_PER_INCH=25.4;exports.PAPER_SIZES=W;exports.RENDER_PLAN_SCHEMA_VERSION=ne;exports.SCHEMA_VERSION_MACH=y;exports.assertBoundedRenderTree=ie;exports.assertOutputActive=T;exports.componentTreeIssue=v;exports.createOutputScheduler=fe;exports.forwardOutputAbort=ue;exports.isImageBackedComponent=re;exports.isRichText=se;exports.mergeComponentStyles=Q;exports.mmToPx=K;exports.mmToPxFactor=M;exports.notifyOutputProgress=B;exports.observeOutput=z;exports.outputCheckpoint=ae;exports.ptToPx=N;exports.pxToMm=V;exports.renderTreeIssue=$;exports.resolveBoxBorders=J;exports.resolveFontSize=Y;exports.resolveGridLayout=te;exports.resolveLineHeight=q;exports.resolveStroke=X;exports.resolveTextColor=Z;exports.round=j;exports.validDataBar=oe;exports.waitForOutput=ce;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { b as p } from "./template-registry-
|
|
1
|
+
import { d as f } from "./prepared-CJy_qk7d.js";
|
|
2
|
+
import { v as a } from "./json-snapshot-BRnzKudk.js";
|
|
3
|
+
import { b as p } from "./template-registry-O0hNIOfB.js";
|
|
4
4
|
const i = "mach-report-worker/1";
|
|
5
5
|
class I extends Error {
|
|
6
6
|
constructor(r) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const f=require("./prepared-
|
|
1
|
+
"use strict";const f=require("./prepared-D0yCSxSO.cjs"),c=require("./json-snapshot-DNiIbpOr.cjs"),a=require("./template-registry-DI59PXVK.cjs"),i="mach-report-worker/1";class d extends Error{constructor(t){super(t.message),this.name=t.name,this.code=t.code,this.path=t.path,this.issues=t.issues,this.diagnostics=t.diagnostics}}function o(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function y(r){return o(r)?["rows","pages","cells"].every(t=>typeof r[t]=="number"&&Number.isSafeInteger(r[t])&&r[t]>=0)&&typeof r.durationMs=="number"&&Number.isFinite(r.durationMs)&&r.durationMs>=0:!1}function g(r){return Array.isArray(r)&&r.every(t=>o(t)&&typeof t.code=="string"&&typeof t.message=="string"&&["info","warning","error"].includes(t.severity)&&c.hasValidDataExplanation(t))}function m(r){return o(r)&&Object.values(r).every(t=>o(t)&&(t.revision===void 0||typeof t.revision=="string")&&(t.sourceToken===void 0||typeof t.sourceToken=="string"))}function u(r){return r===void 0?!0:o(r)&&["heuristic","provided","font-bytes"].includes(r.textMetrics)&&(r.fontFingerprint===void 0||typeof r.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(r.fontFingerprint))}function R(r,t){if(!o(r)||!y(r.stats)||!g(r.diagnostics)||!m(r.revisions)||!u(r.layout)||!f.validPreparedSources(r.sources))return!1;if(t==="prepare")return a.validateRenderPlan(r.plan).ok;const e=r.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return r.bytes instanceof Uint8Array&&(r.format==="pdf"||r.format==="xlsx")&&r.contentType===e}function n(r){if(!r||typeof r!="object")return{message:String(r)};const t={};for(const e of["code","path","field","message"]){const s=r[e];typeof s=="string"&&(t[e]=s)}return t}function k(r){const t=n(r);if(!o(r))return t;for(const e of["format","severity","kind","nid"])typeof r[e]=="string"&&(t[e]=r[e]);for(const e of["pageIndex","componentIndex"])Number.isSafeInteger(r[e])&&r[e]>=0&&(t[e]=r[e]);return Array.isArray(r.componentPath)&&r.componentPath.every(e=>Number.isSafeInteger(e)&&e>=0)&&(t.componentPath=r.componentPath),t}function p(r){if(!(r instanceof Error))return{name:"Error",message:String(r)};const t=r;return{name:r.name,message:r.message,...typeof t.code=="string"?{code:t.code}:{},...typeof t.path=="string"?{path:t.path}:{},...Array.isArray(t.issues)?{issues:t.issues.map(n)}:{},...Array.isArray(t.diagnostics)?{diagnostics:t.diagnostics.map(k)}:{}}}function h(r){if(!r||typeof r!="object")return!1;const t=r;return t.protocol===i&&typeof t.id=="string"&&(t.operation==="prepare"||t.operation==="export"||t.operation==="exportPrepared")&&!!t.input&&typeof t.input=="object"}async function b(r,t,e){try{const s=t.operation==="prepare"?await r.prepare({...t.input,onEvent:e}):t.operation==="exportPrepared"?await r.exportPrepared({...t.input,onEvent:e}):await r.export({...t.input,onEvent:e});return{protocol:i,id:t.id,result:s}}catch(s){return{protocol:i,id:t.id,error:p(s)}}}function I(r){const t=r.result;return!t||!("bytes"in t)||!(t.bytes.buffer instanceof ArrayBuffer)?[]:[t.bytes.buffer]}function W(r,t){if(!o(r)||typeof r.taskId!="string"||!r.taskId||t.taskId!==void 0&&r.taskId!==t.taskId||r.correlationId!==t.correlationId||r.reportId!==void 0&&(typeof r.reportId!="string"||!("reportIds"in t&&t.reportIds.includes(r.reportId)))||!["query","validate","layout","assets","encode"].includes(r.stage)||!["started","completed","failed"].includes(r.status))return!1;for(const e of["completed","total"])if(r[e]!==void 0&&(typeof r[e]!="number"||!Number.isFinite(r[e])||r[e]<0))return!1;return r.completed===void 0||r.total===void 0||r.completed<=r.total}exports.REPORT_WORKER_PROTOCOL=i;exports.ReportWorkerError=d;exports.isReportWorkerRequest=h;exports.reportWorkerTransferList=I;exports.runReportWorkerRequest=b;exports.serializeError=p;exports.validReportWorkerEvent=W;exports.validReportWorkerResult=R;
|