@agile-team/mach-report 2.23.1 → 2.25.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 +10 -4
- package/dist/{ExcelBindingWizard-BrTmdo7f.cjs → ExcelBindingWizard-BgJG-T6k.cjs} +1 -1
- package/dist/{ExcelBindingWizard-CcDMLO8Q.js → ExcelBindingWizard-NQ_v396s.js} +3 -3
- package/dist/ParamEditor-DEP38mBp.cjs +1 -0
- package/dist/ParamEditor-Z-3yodp5.js +750 -0
- package/dist/{ReportBatchPanel-CHxBtG9R.cjs → ReportBatchPanel-D33LjMrA.cjs} +1 -1
- package/dist/{ReportBatchPanel-CJB67WNd.js → ReportBatchPanel-DG8FV-5X.js} +2 -2
- package/dist/{ReportLabelStudio-Tplc1TLJ.js → ReportLabelStudio-BZp23_hA.js} +68 -68
- package/dist/ReportLabelStudio-Bz-xAayk.cjs +1 -0
- package/dist/ReportParamPanel-B27IGJjk.cjs +1 -0
- package/dist/{ReportParamPanel-GI43aGa0.js → ReportParamPanel-DGXzBzl2.js} +328 -298
- package/dist/ReportPreview-CilFAS9U.js +7170 -0
- package/dist/ReportPreview-dOOzPts2.cjs +6 -0
- package/dist/{ReportTemplateLibrary-KqX4E2sN.js → ReportTemplateLibrary-DpSGgvFa.js} +28 -28
- package/dist/{ReportTemplateLibrary-BFQIX0sg.cjs → ReportTemplateLibrary-uG1gENaW.cjs} +1 -1
- package/dist/{RuleEditor-OPX1awrH.js → RuleEditor-BONALh1Q.js} +846 -835
- package/dist/RuleEditor-bLXiRcxL.cjs +1 -0
- package/dist/{TemplateOutlinePanel-CVYKVLv_.cjs → TemplateOutlinePanel-C3nfHuaR.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DQS-eOs6.js → TemplateOutlinePanel-JGBKeF3e.js} +10 -10
- package/dist/{TemplateReusePanel-CY6O93Zk.cjs → TemplateReusePanel-BKhgp6kg.cjs} +1 -1
- package/dist/{TemplateReusePanel-DKXiFTyB.js → TemplateReusePanel-DXQUO6nQ.js} +2 -2
- package/dist/TemplateReviewPanel-5RWFUUEf.cjs +1 -0
- package/dist/TemplateReviewPanel-DhL7Hapy.js +602 -0
- package/dist/analytics.d.cts +1 -1
- package/dist/analytics.d.ts +1 -1
- package/dist/artifact-integrity.json +98 -98
- package/dist/assets-BYdpkTIt.cjs +1 -0
- package/dist/assets-C4MIvzQ4.js +137 -0
- package/dist/auto-D-eDZa_V.cjs +1 -0
- package/dist/{auto-BB99S802.js → auto-umW_ozwr.js} +10 -10
- package/dist/capabilities-CN_kSVjO.js +121 -0
- package/dist/capabilities-D4nfhcvB.cjs +1 -0
- package/dist/cell-style-B6Qffrx8.js +37 -0
- package/dist/cell-style-y_uh1pZp.cjs +1 -0
- package/dist/{data-bar-IkI6VvMQ.js → data-bar-Bfh54sT4.js} +1 -1
- package/dist/data-bar-DzceAVeR.cjs +1 -0
- package/dist/designer-CCyj5WYS.js +7595 -0
- package/dist/designer-Cj7fn4Hh.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +143 -10
- package/dist/designer.d.ts +143 -10
- package/dist/designer.js +5 -5
- package/dist/diagnostic-collector-gB07PHy2.js +392 -0
- package/dist/diagnostic-collector-wASg6Fzs.cjs +1 -0
- package/dist/dom-CXWMmwh-.cjs +1 -0
- package/dist/{dom-JWrchIre.js → dom-DxdCMLzs.js} +185 -185
- package/dist/{encoding-CEd-dq9A.js → encoding-CEkBtlUP.js} +2 -2
- package/dist/{encoding-7lquyj0w.cjs → encoding-Cipno7dq.cjs} +1 -1
- package/dist/{font-loader-CNWXomuV.js → font-loader-D4NLIKJL.js} +1 -1
- package/dist/{font-loader-D8pI87fL.cjs → font-loader-p_SyTvqt.cjs} +1 -1
- package/dist/{grid-strokes-EoY66L2f.js → grid-strokes-DkZEZvcI.js} +1 -1
- package/dist/grid-strokes-RFMR91jn.cjs +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +48 -9
- package/dist/index.d.ts +48 -9
- package/dist/index.js +137 -136
- package/dist/json-snapshot-DQdkA_At.cjs +2 -0
- package/dist/{json-snapshot-BRnzKudk.js → json-snapshot-x0JpllWL.js} +919 -791
- package/dist/{pdf-DpMkW72B.cjs → pdf-C060D5UY.cjs} +31 -31
- package/dist/{pdf-CJToa81Z.js → pdf-DU8HelKd.js} +2499 -2492
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +18 -0
- package/dist/pdf.d.ts +18 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BWTp-X7b.cjs → plugin-B_k23hut.cjs} +1 -1
- package/dist/{plugin-_BkUVc2z.js → plugin-CttO46hc.js} +1 -1
- package/dist/{prefill-CWGdnqQd.js → prefill-BkF9Fw_p.js} +13 -13
- package/dist/prefill-BvkuwooY.cjs +1 -0
- package/dist/prepared-CSywIEAZ.cjs +1 -0
- package/dist/prepared-Cyuh61fJ.js +128 -0
- package/dist/protocol-BwbJNVZl.cjs +1 -0
- package/dist/protocol-DwtxjXzO.js +96 -0
- package/dist/record-bindings-B7djSjNs.cjs +1 -0
- package/dist/{record-bindings-DatJZv_e.js → record-bindings-Cv7lFiof.js} +47 -47
- package/dist/{region-binding-workflow-l7NGfagJ.cjs → region-binding-workflow-COD8nISZ.cjs} +1 -1
- package/dist/{region-binding-workflow-DjrXuR1q.js → region-binding-workflow-D8I4QWRh.js} +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 → rich-text-layout-Ch_N0Ubu.js} +1 -1
- package/dist/rich-text-layout-yJGuThtC.cjs +3 -0
- package/dist/runtime-BE30icyB.js +227 -0
- package/dist/runtime-DRSuy_SQ.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +55 -7
- package/dist/server/node.d.ts +55 -7
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +2742 -2417
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +51 -16
- package/dist/server.d.ts +51 -16
- package/dist/server.js +8 -8
- package/dist/style.css +1 -1
- package/dist/{template-catalog-DtrtT1FY.cjs → template-catalog-C0riwrx7.cjs} +1 -1
- package/dist/{template-catalog-CRuZL3pi.js → template-catalog-D_gl93va.js} +3 -3
- package/dist/template-fragments-CgzPdFKB.cjs +1 -0
- package/dist/{template-fragments-CPpGpQoz.js → template-fragments-D94ZZmPc.js} +2 -2
- package/dist/template-registry-BMScUmM4.cjs +1 -0
- package/dist/{template-registry-O0hNIOfB.js → template-registry-DZOtRY7t.js} +19 -19
- package/dist/{textwrap-D4ZksyMK.js → textwrap-BywMBMXM.js} +1 -1
- package/dist/textwrap-LhJkHWb1.cjs +4 -0
- package/dist/vue/async.d.cts +101 -22
- package/dist/vue/async.d.ts +101 -22
- package/dist/vue/index.d.cts +133 -34
- package/dist/vue/index.d.ts +133 -34
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +192 -162
- package/dist/{workbook-session-C6-SrnCT.cjs → workbook-session-DR2j6Hxm.cjs} +3 -3
- package/dist/{workbook-session-C9ZmCBwY.js → workbook-session-SzfILBJJ.js} +106 -107
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +55 -7
- package/dist/worker.d.ts +55 -7
- package/dist/worker.js +4 -4
- package/dist/xlsx/node.d.cts +30 -1
- package/dist/xlsx/node.d.ts +30 -1
- package/dist/xlsx-node.cjs +42 -42
- package/dist/xlsx-node.js +3908 -3889
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +20 -3
- package/dist/xlsx.d.ts +20 -3
- package/dist/xlsx.js +302 -295
- package/package.json +1 -1
- package/dist/ParamEditor-BGjovFUe.js +0 -737
- package/dist/ParamEditor-CeNp4_zQ.cjs +0 -1
- package/dist/ReportLabelStudio-g8PkqJWn.cjs +0 -1
- package/dist/ReportParamPanel-C7fZTllk.cjs +0 -1
- package/dist/ReportPreview-BoGBGyRr.cjs +0 -6
- package/dist/ReportPreview-QLONCyci.js +0 -6257
- package/dist/RuleEditor-BZUP9yvL.cjs +0 -1
- package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +0 -1
- package/dist/TemplateReviewPanel-Dijwm9YE.js +0 -593
- package/dist/assets-D2gHc4Mz.cjs +0 -1
- package/dist/assets-T_gDeFaz.js +0 -132
- package/dist/auto-BrPWo7Xm.cjs +0 -1
- package/dist/capabilities-DiBj4Qgl.cjs +0 -1
- package/dist/capabilities-pg7j7VLT.js +0 -106
- package/dist/data-bar-CeZuFmYl.cjs +0 -1
- package/dist/designer-BZoVWTgl.js +0 -7172
- package/dist/designer-zS2uKJmY.cjs +0 -2
- package/dist/dom-ChE5D-L-.cjs +0 -1
- package/dist/grid-strokes-Be24LGuV.cjs +0 -1
- package/dist/json-snapshot-DNiIbpOr.cjs +0 -2
- package/dist/prefill-PaAy6wLk.cjs +0 -1
- package/dist/prepared-CJy_qk7d.js +0 -94
- package/dist/prepared-D0yCSxSO.cjs +0 -1
- package/dist/progress-BXzlVbIp.js +0 -29
- package/dist/progress-ByiOxUD3.js +0 -250
- package/dist/progress-DJBd9Rb9.cjs +0 -1
- package/dist/progress-WomPRP3B.cjs +0 -1
- package/dist/protocol-BG16rz6D.js +0 -90
- package/dist/protocol-wzhl1Fim.cjs +0 -1
- package/dist/record-bindings-MBxbeBsi.cjs +0 -1
- package/dist/rich-text-layout-DK7A_a5r.cjs +0 -3
- package/dist/runtime-DYMOS_gz.cjs +0 -1
- package/dist/runtime-PiCax9zQ.js +0 -171
- package/dist/template-fragments-GVjpew_q.cjs +0 -1
- package/dist/template-registry-DI59PXVK.cjs +0 -1
- package/dist/textwrap-DEHqAjKZ.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-p_SyTvqt.cjs"),t=require("./pdf-C060D5UY.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.d.cts
CHANGED
|
@@ -122,6 +122,19 @@ export declare function configureFontCache(options: FontCacheOptions): void;
|
|
|
122
122
|
/** Exact font-byte width adapter. Import from /pdf to keep fontkit outside the core bundle. */
|
|
123
123
|
export declare function createFontBytesMeasurer(options: FontBytesMeasureOptions): TextMeasurer_2;
|
|
124
124
|
|
|
125
|
+
/** Bounded detail window with exact occurrence totals. Unknown business codes beyond 128 buckets share `other`. */
|
|
126
|
+
declare interface DiagnosticSummary<T> {
|
|
127
|
+
readonly total: number;
|
|
128
|
+
readonly counts: Readonly<Record<string, number>>;
|
|
129
|
+
readonly entries: readonly T[];
|
|
130
|
+
readonly omitted: number;
|
|
131
|
+
/** Business value explanations form a separate presentation channel, including omitted locations. */
|
|
132
|
+
readonly explanations?: {
|
|
133
|
+
readonly total: number;
|
|
134
|
+
readonly counts: Readonly<Record<string, number>>;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
125
138
|
export declare interface FontBytesMeasureOptions {
|
|
126
139
|
regular: Uint8Array | ArrayBuffer;
|
|
127
140
|
bold?: Uint8Array | ArrayBuffer;
|
|
@@ -235,6 +248,8 @@ declare interface OutputDiagnosticOptions extends OutputTaskOptions {
|
|
|
235
248
|
onDiagnostic?: (diagnostic: OutputDiagnostic) => void;
|
|
236
249
|
/** Reject known unsupported content before creating an incomplete file. Default warn. */
|
|
237
250
|
fidelity?: "warn" | "strict";
|
|
251
|
+
/** Explicit bounded detail window (0–1000); omitted retains the complete diagnostic array. */
|
|
252
|
+
diagnosticLimit?: number;
|
|
238
253
|
}
|
|
239
254
|
|
|
240
255
|
declare type OutputFormat = "dom" | "canvas" | "pdf" | "xlsx";
|
|
@@ -272,10 +287,13 @@ export declare interface PdfRenderResult {
|
|
|
272
287
|
pdfDoc: PdfDocumentHandle;
|
|
273
288
|
bytes: Uint8Array;
|
|
274
289
|
pageErrors: string[];
|
|
290
|
+
pageErrorCount?: number;
|
|
275
291
|
unsupportedTextCount: number;
|
|
276
292
|
/** 保真度降级清单(富文本转纯文本、图片格式不支持等),供上层提示 */
|
|
277
293
|
fidelityWarnings: string[];
|
|
294
|
+
fidelityWarningCount?: number;
|
|
278
295
|
diagnostics: OutputDiagnostic[];
|
|
296
|
+
diagnosticSummary?: DiagnosticSummary<OutputDiagnostic>;
|
|
279
297
|
}
|
|
280
298
|
|
|
281
299
|
declare interface PlanComponent {
|
package/dist/pdf.d.ts
CHANGED
|
@@ -122,6 +122,19 @@ export declare function configureFontCache(options: FontCacheOptions): void;
|
|
|
122
122
|
/** Exact font-byte width adapter. Import from /pdf to keep fontkit outside the core bundle. */
|
|
123
123
|
export declare function createFontBytesMeasurer(options: FontBytesMeasureOptions): TextMeasurer_2;
|
|
124
124
|
|
|
125
|
+
/** Bounded detail window with exact occurrence totals. Unknown business codes beyond 128 buckets share `other`. */
|
|
126
|
+
declare interface DiagnosticSummary<T> {
|
|
127
|
+
readonly total: number;
|
|
128
|
+
readonly counts: Readonly<Record<string, number>>;
|
|
129
|
+
readonly entries: readonly T[];
|
|
130
|
+
readonly omitted: number;
|
|
131
|
+
/** Business value explanations form a separate presentation channel, including omitted locations. */
|
|
132
|
+
readonly explanations?: {
|
|
133
|
+
readonly total: number;
|
|
134
|
+
readonly counts: Readonly<Record<string, number>>;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
125
138
|
export declare interface FontBytesMeasureOptions {
|
|
126
139
|
regular: Uint8Array | ArrayBuffer;
|
|
127
140
|
bold?: Uint8Array | ArrayBuffer;
|
|
@@ -235,6 +248,8 @@ declare interface OutputDiagnosticOptions extends OutputTaskOptions {
|
|
|
235
248
|
onDiagnostic?: (diagnostic: OutputDiagnostic) => void;
|
|
236
249
|
/** Reject known unsupported content before creating an incomplete file. Default warn. */
|
|
237
250
|
fidelity?: "warn" | "strict";
|
|
251
|
+
/** Explicit bounded detail window (0–1000); omitted retains the complete diagnostic array. */
|
|
252
|
+
diagnosticLimit?: number;
|
|
238
253
|
}
|
|
239
254
|
|
|
240
255
|
declare type OutputFormat = "dom" | "canvas" | "pdf" | "xlsx";
|
|
@@ -272,10 +287,13 @@ export declare interface PdfRenderResult {
|
|
|
272
287
|
pdfDoc: PdfDocumentHandle;
|
|
273
288
|
bytes: Uint8Array;
|
|
274
289
|
pageErrors: string[];
|
|
290
|
+
pageErrorCount?: number;
|
|
275
291
|
unsupportedTextCount: number;
|
|
276
292
|
/** 保真度降级清单(富文本转纯文本、图片格式不支持等),供上层提示 */
|
|
277
293
|
fidelityWarnings: string[];
|
|
294
|
+
fidelityWarningCount?: number;
|
|
278
295
|
diagnostics: OutputDiagnostic[];
|
|
296
|
+
diagnosticSummary?: DiagnosticSummary<OutputDiagnostic>;
|
|
279
297
|
}
|
|
280
298
|
|
|
281
299
|
declare interface PlanComponent {
|
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-D4NLIKJL.js";
|
|
2
|
+
import { c as F, r as s } from "./pdf-DU8HelKd.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-dOOzPts2.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-CilFAS9U.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 { t as
|
|
2
|
-
import { r as B } from "./
|
|
3
|
-
import { d as
|
|
1
|
+
import { t as P, E as O, l as V, O as Z, P as T } from "./json-snapshot-x0JpllWL.js";
|
|
2
|
+
import { r as B } from "./diagnostic-collector-gB07PHy2.js";
|
|
3
|
+
import { d as $, p as S, a as H, k as q, 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 L(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");
|
|
@@ -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
|
+
L(r.value);
|
|
80
80
|
} catch {
|
|
81
81
|
throw new h("config");
|
|
82
82
|
}
|
|
@@ -90,7 +90,7 @@ function G(e, t, r) {
|
|
|
90
90
|
}
|
|
91
91
|
function le(e, t, r) {
|
|
92
92
|
U(r);
|
|
93
|
-
const o =
|
|
93
|
+
const o = P(e, t);
|
|
94
94
|
return o ? r.filter((n) => G(e, o, n)) : [];
|
|
95
95
|
}
|
|
96
96
|
function Y(e, t, r, o) {
|
|
@@ -104,15 +104,15 @@ function Y(e, t, r, o) {
|
|
|
104
104
|
return Q(o, e.field);
|
|
105
105
|
case "field": {
|
|
106
106
|
const n = r.component.table?.columnKeys.indexOf(e.field) ?? -1;
|
|
107
|
-
return n < 0 ? void 0 :
|
|
107
|
+
return n < 0 ? void 0 : P(t, { ...r.address, columnIndex: n })?.value;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
function de(e, t, r, o = {}) {
|
|
112
112
|
U([r]);
|
|
113
|
-
const n =
|
|
113
|
+
const n = P(e, t);
|
|
114
114
|
if (!n || !G(e, n, r)) throw new h("target");
|
|
115
|
-
const a = Object.fromEntries(Object.entries(r.params ?? {}).map(([i, c]) => [i,
|
|
115
|
+
const a = Object.fromEntries(Object.entries(r.params ?? {}).map(([i, c]) => [i, L(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({
|
|
@@ -123,7 +123,7 @@ function de(e, t, r, o = {}) {
|
|
|
123
123
|
}) });
|
|
124
124
|
}
|
|
125
125
|
function ue(e, t) {
|
|
126
|
-
if (!t.source) return e.pages[t.address.pageIndex]?.meta?.reportScope === t.reportScope &&
|
|
126
|
+
if (!t.source) return e.pages[t.address.pageIndex]?.meta?.reportScope === t.reportScope && P(e, t.address) ? { ...t.address } : null;
|
|
127
127
|
const r = V(e), o = O({ address: t.address, source: t.source });
|
|
128
128
|
for (const [n, a] of e.pages.entries())
|
|
129
129
|
if (!(t.reportScope !== void 0 && a.meta?.reportScope !== t.reportScope)) {
|
|
@@ -208,8 +208,8 @@ 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 =
|
|
212
|
-
return i && !o ? { equal: i } : n.coefficient === 0n ? { equal: i, delta:
|
|
211
|
+
const s = H(a, te(n)), l = { ...s, coefficient: s.coefficient < 0n ? -s.coefficient : s.coefficient }, i = $(l, r.toleranceValue) <= 0;
|
|
212
|
+
return i && !o ? { equal: i } : n.coefficient === 0n ? { equal: i, delta: q(s), ...s.coefficient === 0n && r.zeroDenominator === "zero-if-equal" ? { changeRatio: "0" } : { ratioUnavailable: "zero-denominator" } } : { equal: i, delta: q(s), changeRatio: q(J(s, n, r.ratioDigits ?? 12)) };
|
|
213
213
|
}
|
|
214
214
|
function W(e, t, r) {
|
|
215
215
|
return r.missing === "empty-equivalent" && A(e) && A(t) || Object.is(e, t);
|
|
@@ -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" || $(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") }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g=require("./json-snapshot-DQdkA_At.cjs"),N=require("./diagnostic-collector-wASg6Fzs.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 @@
|
|
|
1
|
+
"use strict";const a=require("./json-snapshot-DQdkA_At.cjs"),c=require("./diagnostic-collector-wASg6Fzs.cjs"),s=require("./sha256-DgZAKXqI.cjs"),p=require("./workbook-sheets-CaPAulQ6.cjs");function f(e,r,t,o){if(o===void 0&&!e.diagnosticSummary&&!t){r.forEach(i=>e.diagnostics.push(i));return}const n=c.createDiagnosticCollector(o??c.DEFAULT_DIAGNOSTIC_LIMIT);e.diagnosticSummary?n.merge(e.diagnosticSummary):e.diagnostics.forEach(i=>n.push(i)),t?n.merge(t):r.forEach(i=>n.push(i)),e.diagnostics=n.entries,e.diagnosticSummary=n.snapshot()}function S(e,r){return!a.hasValidDataExplanation(e)||!l(e)||["code","message","severity","path","format","pageIndex","componentIndex","kind","nid","valueState"].some(o=>e[o]!==r[o])||e.componentPath?.length!==r.componentPath?.length||e.componentPath?.some((o,n)=>o!==r.componentPath?.[n])||["datasetId","field","rowKey","tableId","reportScope"].some(o=>e.target?.[o]!==r.target?.[o])?!1:e.extension?.id===r.extension?.id&&e.extension?.version===r.extension?.version}function m(e,r){return!c.validDiagnosticSummary(e)||e.entries.length!==r.length?!1:e.entries.every((t,o)=>!!t&&typeof t=="object"&&S(t,r[o]))}function b(e,r,t,o,n=t.length){n&&e.merge({total:n,counts:{[r]:n},entries:t.map(i=>({code:r,message:i,severity:o})),omitted:n-t.length})}function g(e,r){return e===void 0||typeof e=="number"&&Number.isSafeInteger(e)&&e>=r}function l(e){return!(e.format!==void 0&&!["dom","canvas","pdf","xlsx"].includes(e.format)||!g(e.pageIndex,0)||!g(e.componentIndex,-1)||e.componentPath!==void 0&&!x(e.componentPath)||e.extension!==void 0&&(!e.extension||typeof e.extension.id!="string"||typeof e.extension.version!="string"))}function x(e){if(!Array.isArray(e)||e.length>192)return!1;for(const r of e)if(typeof r!="number"||!Number.isSafeInteger(r)||r<0)return!1;return!0}function F(e){return e&&{...e,sheetNames:p.snapshotSheetNames(e.sheetNames),additionalSheets:p.snapshotAdditionalSheets(e.additionalSheets)}}function P(e,r){if(e.format!=="xlsx")return;const t=e.xlsx?.additionalSheets?.reduce((o,n)=>o+n.rows.reduce((i,d)=>i+d.length,0),0)??0;s.assertBudget(r,"maxCells",e.prepared.stats.cells+t)}function I(e){if(!e)return;const r=t=>{if(!(t instanceof Uint8Array)&&!(t instanceof ArrayBuffer))throw new a.ReportSourceError("validate","字体应为 Uint8Array 或 ArrayBuffer");if(t.byteLength>32e6)throw new s.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return new Uint8Array(t instanceof Uint8Array?t:new Uint8Array(t))};if(e.customFontFaces){const t=e.customFontFaces;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)}:{}}}}return{customFontName:e.customFontName,...e.customFontBytes?{customFontBytes:r(e.customFontBytes)}:{}}}function y(e){const r=e?.customFontFaces??(e?.customFontBytes?{regular:e.customFontBytes}:void 0);if(!r)return;const t=["regular","bold","italic","boldItalic"].map(o=>{const n=r[o];if(!n)return[o,null];const i=n instanceof Uint8Array?n:new Uint8Array(n);if(i.byteLength>32e6)throw new s.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return[o,s.portableSha256Hex(i)]});return s.portableSha256Hex(new TextEncoder().encode(JSON.stringify(t)))}const u=new WeakMap;function A(e,r,t){const o=h(e,r,t);let n=!0;return{prepared:o,forward(){if(!n)throw new Error("报表快照只能交接一次");return n=!1,u.set(o,r),o}}}function h(e,r,t){if(s.throwIfAborted(t),!Number.isSafeInteger(r)||r<=0)throw new s.ReportRuntimeError("budget","快照预算应为正安全整数","$.budget.maxPreparedBytes");const o=u.get(e);if(u.delete(e),o!==void 0&&o<=r)return e;const n=a.snapshotReportJson(e,{maxBytes:r,maxNodes:r,check:()=>s.throwIfAborted(t),error:(i,d)=>i==="budget"?new s.ReportRuntimeError("budget",d,"$.budget.maxPreparedBytes"):new a.ReportSourceError("validate",d)});return w(n),n}function v(e){if(e===void 0)return!0;if(!Array.isArray(e))return!1;const r=new Set;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))}function w(e){if(!v(e.sources))throw new a.ReportSourceError("validate","准备结果来源清单无效");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 a.ReportSourceError("validate","准备结果统计无效");if(!Array.isArray(e.diagnostics)||e.diagnostics.some(r=>!r||typeof r.code!="string"||typeof r.message!="string"||!["info","warning","error"].includes(r.severity)||!a.hasValidDataExplanation(r)||!l(r)))throw new a.ReportSourceError("validate","准备结果诊断无效");if(e.diagnosticSummary!==void 0&&!m(e.diagnosticSummary,e.diagnostics))throw new a.ReportSourceError("validate","准备结果诊断摘要无效");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 a.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 a.ReportSourceError("validate","准备结果字体度量标识无效")}function E(e){if(e.layoutPolicy!==void 0&&!["verify","preserve"].includes(e.layoutPolicy))throw new a.ReportSourceError("validate","无效的 layoutPolicy");if(e.format!=="pdf")return;if(e.layoutPolicy==="preserve"&&!e.prepared.layout?.fontFingerprint){f(e.prepared,[{code:"prepared-layout-preserved",severity:"info",message:"显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。"}]);return}const r=e.prepared.layout?.fontFingerprint,t=y(e.pdf);if(r===t&&(r!==void 0||e.prepared.layout?.textMetrics==="heuristic"&&!t))return;const o="已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";if(e.fidelity==="strict")throw new a.ReportSourceError("validate",o);f(e.prepared,[{code:"prepared-font-metrics",severity:"warning",message:o}])}exports.appendPreparedDiagnostics=f;exports.assertPreparedOutputBudget=P;exports.capturePreparedHandoff=A;exports.checkPreparedFont=E;exports.matchingDiagnosticSummary=m;exports.mergeDiagnosticMessages=b;exports.reportFontFingerprint=y;exports.snapshotPdfFonts=I;exports.snapshotPreparedReport=h;exports.snapshotXlsxOptions=F;exports.validPreparedSources=v;exports.validReportDiagnosticLocation=l;exports.validatePreparedMetadata=w;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { v as g, R as a, s as y } from "./json-snapshot-x0JpllWL.js";
|
|
2
|
+
import { H as v, x as h, G as w } from "./diagnostic-collector-gB07PHy2.js";
|
|
3
|
+
import { R as d, b, t as c, p as u } from "./sha256-BDQ1Qk7A.js";
|
|
4
|
+
import { s as x, a as F } from "./workbook-sheets-D4M7XXBh.js";
|
|
5
|
+
function l(e, t, r, o) {
|
|
6
|
+
if (o === void 0 && !e.diagnosticSummary && !r) {
|
|
7
|
+
t.forEach((i) => e.diagnostics.push(i));
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const n = h(o ?? w);
|
|
11
|
+
e.diagnosticSummary ? n.merge(e.diagnosticSummary) : e.diagnostics.forEach((i) => n.push(i)), r ? n.merge(r) : t.forEach((i) => n.push(i)), e.diagnostics = n.entries, e.diagnosticSummary = n.snapshot();
|
|
12
|
+
}
|
|
13
|
+
function S(e, t) {
|
|
14
|
+
return !g(e) || !p(e) || ["code", "message", "severity", "path", "format", "pageIndex", "componentIndex", "kind", "nid", "valueState"].some((o) => e[o] !== t[o]) || e.componentPath?.length !== t.componentPath?.length || e.componentPath?.some((o, n) => o !== t.componentPath?.[n]) || ["datasetId", "field", "rowKey", "tableId", "reportScope"].some((o) => e.target?.[o] !== t.target?.[o]) ? !1 : e.extension?.id === t.extension?.id && e.extension?.version === t.extension?.version;
|
|
15
|
+
}
|
|
16
|
+
function I(e, t) {
|
|
17
|
+
return !v(e) || e.entries.length !== t.length ? !1 : e.entries.every((r, o) => !!r && typeof r == "object" && S(r, t[o]));
|
|
18
|
+
}
|
|
19
|
+
function U(e, t, r, o, n = r.length) {
|
|
20
|
+
n && e.merge({ total: n, counts: { [t]: n }, entries: r.map((i) => ({ code: t, message: i, severity: o })), omitted: n - r.length });
|
|
21
|
+
}
|
|
22
|
+
function m(e, t) {
|
|
23
|
+
return e === void 0 || typeof e == "number" && Number.isSafeInteger(e) && e >= t;
|
|
24
|
+
}
|
|
25
|
+
function p(e) {
|
|
26
|
+
return !(e.format !== void 0 && !["dom", "canvas", "pdf", "xlsx"].includes(e.format) || !m(e.pageIndex, 0) || !m(e.componentIndex, -1) || e.componentPath !== void 0 && !P(e.componentPath) || e.extension !== void 0 && (!e.extension || typeof e.extension.id != "string" || typeof e.extension.version != "string"));
|
|
27
|
+
}
|
|
28
|
+
function P(e) {
|
|
29
|
+
if (!Array.isArray(e) || e.length > 192) return !1;
|
|
30
|
+
for (const t of e) if (typeof t != "number" || !Number.isSafeInteger(t) || t < 0) return !1;
|
|
31
|
+
return !0;
|
|
32
|
+
}
|
|
33
|
+
function k(e) {
|
|
34
|
+
return e && { ...e, sheetNames: F(e.sheetNames), additionalSheets: x(e.additionalSheets) };
|
|
35
|
+
}
|
|
36
|
+
function j(e, t) {
|
|
37
|
+
if (e.format !== "xlsx") return;
|
|
38
|
+
const r = e.xlsx?.additionalSheets?.reduce((o, n) => o + n.rows.reduce((i, s) => i + s.length, 0), 0) ?? 0;
|
|
39
|
+
b(t, "maxCells", e.prepared.stats.cells + r);
|
|
40
|
+
}
|
|
41
|
+
function C(e) {
|
|
42
|
+
if (!e) return;
|
|
43
|
+
const t = (r) => {
|
|
44
|
+
if (!(r instanceof Uint8Array) && !(r instanceof ArrayBuffer)) throw new a("validate", "字体应为 Uint8Array 或 ArrayBuffer");
|
|
45
|
+
if (r.byteLength > 32e6) throw new d("budget", "单份字体超过 32 MB", "$.pdf");
|
|
46
|
+
return new Uint8Array(r instanceof Uint8Array ? r : new Uint8Array(r));
|
|
47
|
+
};
|
|
48
|
+
if (e.customFontFaces) {
|
|
49
|
+
const r = e.customFontFaces;
|
|
50
|
+
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) } : {} } };
|
|
51
|
+
}
|
|
52
|
+
return { customFontName: e.customFontName, ...e.customFontBytes ? { customFontBytes: t(e.customFontBytes) } : {} };
|
|
53
|
+
}
|
|
54
|
+
function A(e) {
|
|
55
|
+
const t = e?.customFontFaces ?? (e?.customFontBytes ? { regular: e.customFontBytes } : void 0);
|
|
56
|
+
if (!t) return;
|
|
57
|
+
const r = ["regular", "bold", "italic", "boldItalic"].map((o) => {
|
|
58
|
+
const n = t[o];
|
|
59
|
+
if (!n) return [o, null];
|
|
60
|
+
const i = n instanceof Uint8Array ? n : new Uint8Array(n);
|
|
61
|
+
if (i.byteLength > 32e6) throw new d("budget", "单份字体超过 32 MB", "$.pdf");
|
|
62
|
+
return [o, u(i)];
|
|
63
|
+
});
|
|
64
|
+
return u(new TextEncoder().encode(JSON.stringify(r)));
|
|
65
|
+
}
|
|
66
|
+
const f = /* @__PURE__ */ new WeakMap();
|
|
67
|
+
function L(e, t, r) {
|
|
68
|
+
const o = N(e, t, r);
|
|
69
|
+
let n = !0;
|
|
70
|
+
return { prepared: o, forward() {
|
|
71
|
+
if (!n) throw new Error("报表快照只能交接一次");
|
|
72
|
+
return n = !1, f.set(o, t), o;
|
|
73
|
+
} };
|
|
74
|
+
}
|
|
75
|
+
function N(e, t, r) {
|
|
76
|
+
if (c(r), !Number.isSafeInteger(t) || t <= 0) throw new d("budget", "快照预算应为正安全整数", "$.budget.maxPreparedBytes");
|
|
77
|
+
const o = f.get(e);
|
|
78
|
+
if (f.delete(e), o !== void 0 && o <= t) return e;
|
|
79
|
+
const n = y(e, {
|
|
80
|
+
maxBytes: t,
|
|
81
|
+
maxNodes: t,
|
|
82
|
+
check: () => c(r),
|
|
83
|
+
error: (i, s) => i === "budget" ? new d("budget", s, "$.budget.maxPreparedBytes") : new a("validate", s)
|
|
84
|
+
});
|
|
85
|
+
return E(n), n;
|
|
86
|
+
}
|
|
87
|
+
function D(e) {
|
|
88
|
+
if (e === void 0) return !0;
|
|
89
|
+
if (!Array.isArray(e)) return !1;
|
|
90
|
+
const t = /* @__PURE__ */ new Set();
|
|
91
|
+
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));
|
|
92
|
+
}
|
|
93
|
+
function E(e) {
|
|
94
|
+
if (!D(e.sources)) throw new a("validate", "准备结果来源清单无效");
|
|
95
|
+
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 a("validate", "准备结果统计无效");
|
|
96
|
+
if (!Array.isArray(e.diagnostics) || e.diagnostics.some((t) => !t || typeof t.code != "string" || typeof t.message != "string" || !["info", "warning", "error"].includes(t.severity) || !g(t) || !p(t))) throw new a("validate", "准备结果诊断无效");
|
|
97
|
+
if (e.diagnosticSummary !== void 0 && !I(e.diagnosticSummary, e.diagnostics)) throw new a("validate", "准备结果诊断摘要无效");
|
|
98
|
+
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 a("validate", "准备结果修订无效");
|
|
99
|
+
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 a("validate", "准备结果字体度量标识无效");
|
|
100
|
+
}
|
|
101
|
+
function O(e) {
|
|
102
|
+
if (e.layoutPolicy !== void 0 && !["verify", "preserve"].includes(e.layoutPolicy)) throw new a("validate", "无效的 layoutPolicy");
|
|
103
|
+
if (e.format !== "pdf") return;
|
|
104
|
+
if (e.layoutPolicy === "preserve" && !e.prepared.layout?.fontFingerprint) {
|
|
105
|
+
l(e.prepared, [{ code: "prepared-layout-preserved", severity: "info", message: "显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。" }]);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const t = e.prepared.layout?.fontFingerprint, r = A(e.pdf);
|
|
109
|
+
if (t === r && (t !== void 0 || e.prepared.layout?.textMetrics === "heuristic" && !r)) return;
|
|
110
|
+
const o = "已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";
|
|
111
|
+
if (e.fidelity === "strict") throw new a("validate", o);
|
|
112
|
+
l(e.prepared, [{ code: "prepared-font-metrics", severity: "warning", message: o }]);
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
k as a,
|
|
116
|
+
p as b,
|
|
117
|
+
L as c,
|
|
118
|
+
j as d,
|
|
119
|
+
D as e,
|
|
120
|
+
I as f,
|
|
121
|
+
N as g,
|
|
122
|
+
O as h,
|
|
123
|
+
l as i,
|
|
124
|
+
U as m,
|
|
125
|
+
A as r,
|
|
126
|
+
C as s,
|
|
127
|
+
E as v
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const f=require("./json-snapshot-DQdkA_At.cjs"),s=require("./diagnostic-collector-wASg6Fzs.cjs"),g=require("./runtime-DRSuy_SQ.cjs"),n="mach-report-worker/1";class u extends Error{constructor(e){super(e.message),this.name=e.name,this.code=e.code,this.path=e.path,this.issues=e.issues,this.diagnostics=e.diagnostics,this.diagnosticSummary=e.diagnosticSummary,this.issueSummary=e.issueSummary}}function i(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function l(t,e){return g.validReportExecutionResult(t,e)}function m(t){if(!t||typeof t!="object")return{message:String(t).slice(0,4096)};const e={};for(const r of["code","path","field","message"]){const o=t[r];typeof o=="string"&&(e[r]=o.slice(0,r==="code"?128:4096))}return e}function R(t){const e=m(t);if(!i(t))return e;for(const r of["format","severity","kind","nid"])typeof t[r]=="string"&&(e[r]=t[r].slice(0,4096));for(const r of["pageIndex","componentIndex"])Number.isSafeInteger(t[r])&&t[r]>=0&&(e[r]=t[r]);if(f.hasValidDataExplanation(t)&&t.valueState!==void 0&&i(t.target)){e.valueState=t.valueState;const r={};for(const o of["datasetId","field","rowKey","tableId","reportScope"])t.target[o]!==void 0&&(r[o]=t.target[o]);e.target=r}return i(t.extension)&&typeof t.extension.id=="string"&&typeof t.extension.version=="string"&&(e.extension={id:t.extension.id.slice(0,128),version:t.extension.version.slice(0,64)}),Array.isArray(t.componentPath)&&t.componentPath.length<=192&&t.componentPath.every(r=>Number.isSafeInteger(r)&&r>=0)&&(e.componentPath=t.componentPath),e}function d(t){return{code:i(t)&&typeof t.code=="string"?t.code:"unknown",value:t,...i(t)&&t.valueState!==void 0&&f.hasValidDataExplanation(t)?{valueState:t.valueState}:{}}}function p(t,e,r){const o=s.createDiagnosticCollector(s.DEFAULT_DIAGNOSTIC_LIMIT);if(s.validDiagnosticSummary(r))o.merge({...r,entries:r.entries.slice(0,s.DEFAULT_DIAGNOSTIC_LIMIT).map(d)});else for(const a of t)o.push(d(a));const c=o.snapshot();return{...c,entries:c.entries.map(a=>e(a.value))}}function y(t){if(!(t instanceof Error))return{name:"Error",message:String(t).slice(0,8192)};const e=t,r=Array.isArray(e.diagnostics)?p(e.diagnostics,R,e.diagnosticSummary):void 0,o=Array.isArray(e.issues)?p(e.issues,m):void 0;return{name:t.name.slice(0,128),message:t.message.slice(0,8192),...typeof e.code=="string"?{code:e.code.slice(0,128)}:{},...typeof e.path=="string"?{path:e.path.slice(0,4096)}:{},...o?{issues:o.entries,...o.omitted?{issueSummary:o}:{}}:{},...r?{diagnostics:r.entries,...r.omitted||e.diagnosticSummary!==void 0?{diagnosticSummary:r}:{}}:{}}}function I(t){if(!t||typeof t!="object")return!1;const e=t;return e.protocol===n&&typeof e.id=="string"&&(e.operation==="prepare"||e.operation==="export"||e.operation==="exportPrepared")&&!!e.input&&typeof e.input=="object"}async function h(t,e,r){try{const o=e.operation==="prepare"?await t.prepare({...e.input,onEvent:r}):e.operation==="exportPrepared"?await t.exportPrepared({...e.input,onEvent:r}):await t.export({...e.input,onEvent:r});return{protocol:n,id:e.id,result:o}}catch(o){return{protocol:n,id:e.id,error:y(o)}}}function k(t){const e=t.result;return!e||!("bytes"in e)||!(e.bytes.buffer instanceof ArrayBuffer)?[]:[e.bytes.buffer]}function S(t,e){if(!i(t)||typeof t.taskId!="string"||!t.taskId||e.taskId!==void 0&&t.taskId!==e.taskId||t.correlationId!==e.correlationId||t.reportId!==void 0&&(typeof t.reportId!="string"||!("reportIds"in e&&e.reportIds.includes(t.reportId)))||!["query","validate","layout","assets","encode"].includes(t.stage)||!["started","completed","failed"].includes(t.status))return!1;for(const r of["completed","total"])if(t[r]!==void 0&&(typeof t[r]!="number"||!Number.isFinite(t[r])||t[r]<0))return!1;return t.completed===void 0||t.total===void 0||t.completed<=t.total}exports.REPORT_WORKER_PROTOCOL=n;exports.ReportWorkerError=u;exports.isReportWorkerRequest=I;exports.reportWorkerTransferList=k;exports.runReportWorkerRequest=h;exports.serializeError=y;exports.validReportWorkerEvent=S;exports.validReportWorkerResult=l;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { v as p } from "./json-snapshot-x0JpllWL.js";
|
|
2
|
+
import { x as y, H as g, G as c } from "./diagnostic-collector-gB07PHy2.js";
|
|
3
|
+
import { v as u } from "./runtime-BE30icyB.js";
|
|
4
|
+
const n = "mach-report-worker/1";
|
|
5
|
+
class x extends Error {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
super(e.message), this.name = e.name, this.code = e.code, this.path = e.path, this.issues = e.issues, this.diagnostics = e.diagnostics, this.diagnosticSummary = e.diagnosticSummary, this.issueSummary = e.issueSummary;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function s(t) {
|
|
11
|
+
return !!t && typeof t == "object" && !Array.isArray(t);
|
|
12
|
+
}
|
|
13
|
+
function b(t, e) {
|
|
14
|
+
return u(t, e);
|
|
15
|
+
}
|
|
16
|
+
function m(t) {
|
|
17
|
+
if (!t || typeof t != "object") return { message: String(t).slice(0, 4096) };
|
|
18
|
+
const e = {};
|
|
19
|
+
for (const o of ["code", "path", "field", "message"]) {
|
|
20
|
+
const r = t[o];
|
|
21
|
+
typeof r == "string" && (e[o] = r.slice(0, o === "code" ? 128 : 4096));
|
|
22
|
+
}
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
function l(t) {
|
|
26
|
+
const e = m(t);
|
|
27
|
+
if (!s(t)) return e;
|
|
28
|
+
for (const o of ["format", "severity", "kind", "nid"]) typeof t[o] == "string" && (e[o] = t[o].slice(0, 4096));
|
|
29
|
+
for (const o of ["pageIndex", "componentIndex"]) Number.isSafeInteger(t[o]) && t[o] >= 0 && (e[o] = t[o]);
|
|
30
|
+
if (p(t) && t.valueState !== void 0 && s(t.target)) {
|
|
31
|
+
e.valueState = t.valueState;
|
|
32
|
+
const o = {};
|
|
33
|
+
for (const r of ["datasetId", "field", "rowKey", "tableId", "reportScope"]) t.target[r] !== void 0 && (o[r] = t.target[r]);
|
|
34
|
+
e.target = o;
|
|
35
|
+
}
|
|
36
|
+
return s(t.extension) && typeof t.extension.id == "string" && typeof t.extension.version == "string" && (e.extension = { id: t.extension.id.slice(0, 128), version: t.extension.version.slice(0, 64) }), Array.isArray(t.componentPath) && t.componentPath.length <= 192 && t.componentPath.every((o) => Number.isSafeInteger(o) && o >= 0) && (e.componentPath = t.componentPath), e;
|
|
37
|
+
}
|
|
38
|
+
function d(t) {
|
|
39
|
+
return {
|
|
40
|
+
code: s(t) && typeof t.code == "string" ? t.code : "unknown",
|
|
41
|
+
value: t,
|
|
42
|
+
...s(t) && t.valueState !== void 0 && p(t) ? { valueState: t.valueState } : {}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function f(t, e, o) {
|
|
46
|
+
const r = y(c);
|
|
47
|
+
if (g(o))
|
|
48
|
+
r.merge({ ...o, entries: o.entries.slice(0, c).map(d) });
|
|
49
|
+
else for (const i of t) r.push(d(i));
|
|
50
|
+
const a = r.snapshot();
|
|
51
|
+
return { ...a, entries: a.entries.map((i) => e(i.value)) };
|
|
52
|
+
}
|
|
53
|
+
function h(t) {
|
|
54
|
+
if (!(t instanceof Error)) return { name: "Error", message: String(t).slice(0, 8192) };
|
|
55
|
+
const e = t, o = Array.isArray(e.diagnostics) ? f(e.diagnostics, l, e.diagnosticSummary) : void 0, r = Array.isArray(e.issues) ? f(e.issues, m) : void 0;
|
|
56
|
+
return {
|
|
57
|
+
name: t.name.slice(0, 128),
|
|
58
|
+
message: t.message.slice(0, 8192),
|
|
59
|
+
...typeof e.code == "string" ? { code: e.code.slice(0, 128) } : {},
|
|
60
|
+
...typeof e.path == "string" ? { path: e.path.slice(0, 4096) } : {},
|
|
61
|
+
...r ? { issues: r.entries, ...r.omitted ? { issueSummary: r } : {} } : {},
|
|
62
|
+
...o ? { diagnostics: o.entries, ...o.omitted || e.diagnosticSummary !== void 0 ? { diagnosticSummary: o } : {} } : {}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function R(t) {
|
|
66
|
+
if (!t || typeof t != "object") return !1;
|
|
67
|
+
const e = t;
|
|
68
|
+
return e.protocol === n && typeof e.id == "string" && (e.operation === "prepare" || e.operation === "export" || e.operation === "exportPrepared") && !!e.input && typeof e.input == "object";
|
|
69
|
+
}
|
|
70
|
+
async function A(t, e, o) {
|
|
71
|
+
try {
|
|
72
|
+
const r = e.operation === "prepare" ? await t.prepare({ ...e.input, onEvent: o }) : e.operation === "exportPrepared" ? await t.exportPrepared({ ...e.input, onEvent: o }) : await t.export({ ...e.input, onEvent: o });
|
|
73
|
+
return { protocol: n, id: e.id, result: r };
|
|
74
|
+
} catch (r) {
|
|
75
|
+
return { protocol: n, id: e.id, error: h(r) };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function E(t) {
|
|
79
|
+
const e = t.result;
|
|
80
|
+
return !e || !("bytes" in e) || !(e.bytes.buffer instanceof ArrayBuffer) ? [] : [e.bytes.buffer];
|
|
81
|
+
}
|
|
82
|
+
function P(t, e) {
|
|
83
|
+
if (!s(t) || typeof t.taskId != "string" || !t.taskId || e.taskId !== void 0 && t.taskId !== e.taskId || t.correlationId !== e.correlationId || t.reportId !== void 0 && (typeof t.reportId != "string" || !("reportIds" in e && e.reportIds.includes(t.reportId))) || !["query", "validate", "layout", "assets", "encode"].includes(t.stage) || !["started", "completed", "failed"].includes(t.status)) return !1;
|
|
84
|
+
for (const o of ["completed", "total"]) if (t[o] !== void 0 && (typeof t[o] != "number" || !Number.isFinite(t[o]) || t[o] < 0)) return !1;
|
|
85
|
+
return t.completed === void 0 || t.total === void 0 || t.completed <= t.total;
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
n as R,
|
|
89
|
+
E as a,
|
|
90
|
+
x as b,
|
|
91
|
+
b as c,
|
|
92
|
+
R as i,
|
|
93
|
+
A as r,
|
|
94
|
+
h as s,
|
|
95
|
+
P as v
|
|
96
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./diagnostic-collector-wASg6Fzs.cjs"),y=require("./charts-Cjw5AYkg.cjs"),g=require("./computed-DK6BruFz.cjs");function C(e){if(!e||e.kind==="date")return;const t=e.digits;if(!(t!==void 0&&(!Number.isInteger(t)||t<0||t>100))){if(e.kind==="percent"){const r=t??2;return`0${r?`.${"0".repeat(r)}`:""}%`}return t===void 0?e.thousands?"#,##0.###############":void 0:`${e.thousands?"#,##0":"0"}${t?`.${"0".repeat(t)}`:""}`}}function S(e){const t=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());if(t){const i=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(i.getTime())?null:i}const r=new Date(e);return Number.isNaN(r.getTime())?null:r}function f(e,t){return e.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t})}function x(e,t){const r=i=>String(i).padStart(2,"0");return t.replace(/YYYY/g,String(e.getFullYear())).replace(/MM/g,r(e.getMonth()+1)).replace(/DD/g,r(e.getDate())).replace(/hh/g,r(e.getHours())).replace(/mm/g,r(e.getMinutes())).replace(/ss/g,r(e.getSeconds()))}function A(e,t,r){return r!=null?t?f(e,r):e.toFixed(r):t?f(e):String(e)}function c(e){const t=typeof e=="number"?e:Number(String(e).replace(/,/g,""));return Number.isFinite(t)?t:null}function p(e,t){if(e==null||e===""||!t)return String(e??"");switch(t.kind){case"number":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits,t.thousands===!0)}catch{return e}const r=c(e);return r==null?String(e):A(r,t.thousands===!0,t.digits)}case"percent":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits??2,!0,!0)}catch{return e}const r=c(e);return r==null?String(e):`${f(r*100,t.digits??2)}%`}case"date":{const r=t.pattern??"YYYY-MM-DD",i=e instanceof Date?e:S(String(e));return i?x(i,r):String(e)}default:return String(e)}}function h(e,t){return g.compileReportPredicate(t)(e)}function M(e,t,r,i=e.paddingMm??1){return t.field!==e.tree.labelField?0:Math.min(r.depth*(e.tree.indentMm??3),Math.max(0,t.widthMm-i*2-4))}function L(e,t,r,i){const n=i.tree;(n.input==="nested"||[n.idField,n.parentField].includes(t.field))&&(e.editable=!1),r.hasChildren&&n.parentValues==="leaf-aggregate"&&n.aggregates?.some(a=>a.field===t.field)&&(e.derived=!0,e.editable=!1)}function T(e,t,r,i){return r==="identifier"||r==="dimension"||r==="date"||r==="measure"?"center":r==="text"?"left":l.automaticCellAlignment(e,t?.kind==="number"||t?.kind==="percent"||t?.kind==="date"||i==="number"||i==="boolean")}function w(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="boolean")return e?"是":"否";if(e instanceof Date)return e.toISOString().slice(0,10);try{return JSON.stringify(e)}catch{return String(e)}}function P(e,t){let r=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,bold:e.headerBold??!0,align:"center",verticalAlign:"middle",backgroundColor:e.headerBackgroundColor},t.style);return e.headerAlign!==void 0&&(r.align=e.headerAlign),r=l.mergeComponentStyles(r,e.headerStyle),t.headerAlign!==void 0&&(r.align=t.headerAlign),l.mergeComponentStyles(r,t.headerStyle)}function F(e,t,r){(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r))&&(e.value=r);const i=t.format?.kind==="number"||t.format?.kind==="percent";t.valueType!==void 0?e.valueType=t.valueType:i&&(e.valueType="number"),t.editable!==void 0&&(e.editable=t.editable);const n=C(t.format);(typeof e.value=="number"||e.value==null)&&n!==void 0&&(e.numberFormat=n)}function E(e,t,r){const i=!!t.visibleWhen&&!h(r,t.visibleWhen),n=i?null:r[t.field],a=t.align??t.style?.align??e.align??"auto";let s=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,verticalAlign:"middle"},t.style);s.align=a==="auto"?T(n,t.format,t.semanticRole,t.valueType):a;const o=t.rules?.find(u=>h(r,u.when));o&&(s=l.mergeComponentStyles(s,o.style));const d={text:t.format?p(n,t.format):w(n),style:s};return F(d,t,n),e.computed?.some(u=>u.field===t.field)&&(d.derived=!0,d.editable=!1),i&&(d.editable=!1),d}function R(e,t,r){const i=E(e,t,r.row),n=M(e,t,r);return t.field===e.tree.labelField&&(i.style={...i.style,align:"left"}),n&&(i.indentMm=n),L(i,t,r,e),i}class I extends Error{constructor(t,r){super(`报表页数超出上限 ${t}(至少 ${r} 页)`),this.limit=t,this.actual=r,this.code="page-limit",this.name="PaginatePageLimitError"}}class O extends Error{constructor(t,r){super(`报表单元格数量超出上限 ${t}(至少 ${r} 格)`),this.limit=t,this.actual=r,this.code="cell-limit",this.name="PaginateCellLimitError"}}class N extends Error{constructor(t,r){super(`报表图表图元数量预计超出上限 ${t}(本次估算 ${r})`),this.limit=t,this.estimated=r,this.code="chart-component-limit",this.name="PaginateChartComponentLimitError"}}const b=5e4;function D(e=b){if(!Number.isSafeInteger(e)||e<1||e>1e6)throw new RangeError("maxChartComponents 应为 1..1000000 的安全整数")}function v(e,t,r){const i=e.chartBinding;if(e.kind!=="chart"||e.grid||e.imageData||e.binding||e.pageAnchor)throw new TypeError("绑定图表不能同时设置图片、网格、记录绑定或页眉页脚");const n=Object.prototype.hasOwnProperty.call(t,i.dataset)?t[i.dataset]:void 0;if(!Array.isArray(n))throw new TypeError(`图表数据集 ${i.dataset} 未提供`);return{...g.createReportChartData(n,i,r),type:i.type,leftMm:e.leftMm,topMm:e.topMm,widthMm:e.widthMm,heightMm:e.heightMm,title:i.title,showValues:i.showValues}}function k(e,t,r=b){D(r);let i=0;return Object.assign(a=>{if(!a.chartBinding)return[a];const s=v(a,e,t),o=i+(s.categories.length?y.chartComponentUpperBound(s):1);if(!Number.isSafeInteger(o))throw new RangeError("图表图元估算应为有限安全整数");if(o>r)throw new N(r,o);const d=s.categories.length?y.createChartComponents(s):[{kind:"text",leftMm:a.leftMm,topMm:a.topMm,widthMm:a.widthMm,heightMm:a.heightMm,text:"—",style:{align:"center",verticalAlign:"middle",color:"#94a3b8",fontSize:10}}];return i+=d.length,d},{used:()=>i})}function B(e){return typeof e=="string"&&/^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e)}class m extends Error{constructor(t,r,i,n){super(`${t}: ${r}`),this.path=t,this.rowIndex=i,this.field=n,this.code="report-binding",this.name="ReportBindingError"}}function $(e,t,r={}){const i=r.rowIndex??0,a=`$.datasets.${r.dataset??"label"}[${i}].${t}`,s=Object.getOwnPropertyDescriptor(e,t);if(!s||s.get||s.set)throw new m(a,"字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承",i,t);const o=s.value;if(o==null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;throw new m(a,"绑定值应为字符串、有限数字、布尔值或空值",i,t)}function _(e,t,r={}){const i=$(t,e.field,r);return i==null||i===""?e.emptyText??"":`${e.prefix??""}${p(i,e.format)}${e.suffix??""}`}exports.DEFAULT_CHART_COMPONENT_LIMIT=b;exports.PaginateCellLimitError=O;exports.PaginateChartComponentLimitError=N;exports.PaginatePageLimitError=I;exports.ReportBindingError=m;exports.applyListTreeMetadata=L;exports.createChartResolver=k;exports.evalStyleRule=h;exports.formatValue=p;exports.isLabelImageData=B;exports.listCellText=w;exports.listTreeIndent=M;exports.parseDateLocal=S;exports.readRecordScalar=$;exports.resolveComponentBinding=_;exports.resolveListAutoAlignment=T;exports.resolveListHeaderStyle=P;exports.resolveListSampleCell=E;exports.resolveTreeListSampleCell=R;exports.toExcelNumberFormat=C;exports.toNumber=c;exports.validateChartComponentLimit=D;
|