@agile-team/mach-report 2.23.1 → 2.24.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.
Files changed (149) hide show
  1. package/README.md +8 -2
  2. package/dist/{ExcelBindingWizard-BrTmdo7f.cjs → ExcelBindingWizard-BV12hGiK.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-CcDMLO8Q.js → ExcelBindingWizard-Cy_lPjWV.js} +3 -3
  4. package/dist/ParamEditor-DenKjvKu.cjs +1 -0
  5. package/dist/ParamEditor-PyOqHzzw.js +750 -0
  6. package/dist/{ReportBatchPanel-CJB67WNd.js → ReportBatchPanel-8EFtMrKk.js} +2 -2
  7. package/dist/{ReportBatchPanel-CHxBtG9R.cjs → ReportBatchPanel-pQ6d0yqJ.cjs} +1 -1
  8. package/dist/ReportLabelStudio-B_KF3Zc_.cjs +1 -0
  9. package/dist/{ReportLabelStudio-Tplc1TLJ.js → ReportLabelStudio-HUeo2TsU.js} +68 -68
  10. package/dist/ReportParamPanel-8xR85nz-.cjs +1 -0
  11. package/dist/{ReportParamPanel-GI43aGa0.js → ReportParamPanel-DA-YpkvC.js} +328 -298
  12. package/dist/ReportPreview-CyUXJSVX.cjs +6 -0
  13. package/dist/ReportPreview-_wTJnsG1.js +7120 -0
  14. package/dist/{ReportTemplateLibrary-BFQIX0sg.cjs → ReportTemplateLibrary-CjArKxRG.cjs} +1 -1
  15. package/dist/{ReportTemplateLibrary-KqX4E2sN.js → ReportTemplateLibrary-DH8jl9IF.js} +28 -28
  16. package/dist/RuleEditor-Bmj98oC4.cjs +1 -0
  17. package/dist/{RuleEditor-OPX1awrH.js → RuleEditor-GDydlEHz.js} +846 -834
  18. package/dist/{TemplateOutlinePanel-CVYKVLv_.cjs → TemplateOutlinePanel-B554_qk1.cjs} +1 -1
  19. package/dist/{TemplateOutlinePanel-DQS-eOs6.js → TemplateOutlinePanel-DjPqzU9h.js} +10 -10
  20. package/dist/{TemplateReusePanel-CY6O93Zk.cjs → TemplateReusePanel-D0628OYc.cjs} +1 -1
  21. package/dist/{TemplateReusePanel-DKXiFTyB.js → TemplateReusePanel-DtYbCN7U.js} +2 -2
  22. package/dist/TemplateReviewPanel-CSwvCz3f.cjs +1 -0
  23. package/dist/TemplateReviewPanel-D_FR4ISq.js +602 -0
  24. package/dist/artifact-integrity.json +94 -94
  25. package/dist/assets-B4AJIOTB.cjs +1 -0
  26. package/dist/assets-D0FbszhB.js +137 -0
  27. package/dist/{auto-BB99S802.js → auto-BksreoKc.js} +5 -5
  28. package/dist/auto-C3mGqzJ8.cjs +1 -0
  29. package/dist/capabilities-CTwlcl8q.cjs +1 -0
  30. package/dist/capabilities-lqDEZSq5.js +121 -0
  31. package/dist/data-bar-2NLRzOCQ.cjs +1 -0
  32. package/dist/{data-bar-IkI6VvMQ.js → data-bar-BnGtnJ82.js} +1 -1
  33. package/dist/designer-BNf7NWd6.js +7589 -0
  34. package/dist/designer-DWnZZ_ej.cjs +2 -0
  35. package/dist/designer.cjs +1 -1
  36. package/dist/designer.d.cts +137 -4
  37. package/dist/designer.d.ts +137 -4
  38. package/dist/designer.js +5 -5
  39. package/dist/diagnostic-collector-1sqd7DQP.js +355 -0
  40. package/dist/diagnostic-collector-D3rlvxm3.cjs +1 -0
  41. package/dist/{dom-JWrchIre.js → dom-C90cTM6Y.js} +4 -4
  42. package/dist/dom-CxOkm_Sy.cjs +1 -0
  43. package/dist/{encoding-7lquyj0w.cjs → encoding-CkziAnZI.cjs} +1 -1
  44. package/dist/{encoding-CEd-dq9A.js → encoding-DSc9zv2F.js} +2 -2
  45. package/dist/{font-loader-D8pI87fL.cjs → font-loader-D-znWNWS.cjs} +1 -1
  46. package/dist/{font-loader-CNWXomuV.js → font-loader-i7lZbqH_.js} +1 -1
  47. package/dist/{grid-strokes-EoY66L2f.js → grid-strokes-BPiV1WHe.js} +1 -1
  48. package/dist/grid-strokes-DYf-6DMl.cjs +1 -0
  49. package/dist/index.cjs +5 -5
  50. package/dist/index.d.cts +46 -7
  51. package/dist/index.d.ts +46 -7
  52. package/dist/index.js +69 -68
  53. package/dist/{json-snapshot-BRnzKudk.js → json-snapshot-BJWZNryO.js} +919 -791
  54. package/dist/json-snapshot-C7QZrRBf.cjs +2 -0
  55. package/dist/{pdf-CJToa81Z.js → pdf-0_5XiTCx.js} +2499 -2492
  56. package/dist/{pdf-DpMkW72B.cjs → pdf-DWuq6uxx.cjs} +31 -31
  57. package/dist/pdf.cjs +1 -1
  58. package/dist/pdf.d.cts +18 -0
  59. package/dist/pdf.d.ts +18 -0
  60. package/dist/pdf.js +2 -2
  61. package/dist/{plugin-_BkUVc2z.js → plugin-B1ydqEmS.js} +1 -1
  62. package/dist/{plugin-BWTp-X7b.cjs → plugin-BQBz2vLG.cjs} +1 -1
  63. package/dist/prefill-2p9wrpn9.cjs +1 -0
  64. package/dist/{prefill-CWGdnqQd.js → prefill-Cuzh1wxf.js} +13 -13
  65. package/dist/prepared-CVbgO9KR.js +128 -0
  66. package/dist/prepared-DAwe8Il2.cjs +1 -0
  67. package/dist/protocol-BOri9qJL.js +105 -0
  68. package/dist/protocol-DD5dHSz-.cjs +1 -0
  69. package/dist/record-bindings-CAyM5tGg.cjs +1 -0
  70. package/dist/{record-bindings-DatJZv_e.js → record-bindings-fhav-NLG.js} +1 -1
  71. package/dist/{region-binding-workflow-DjrXuR1q.js → region-binding-workflow-Cm4mqhih.js} +2 -2
  72. package/dist/{region-binding-workflow-l7NGfagJ.cjs → region-binding-workflow-DWCUgjZl.cjs} +1 -1
  73. package/dist/report-encoding-worker.cjs +1 -1
  74. package/dist/report-encoding-worker.js +1 -1
  75. package/dist/rich-text-layout-X9YOz1JD.cjs +3 -0
  76. package/dist/{rich-text-layout-Ciwa6D2o.js → rich-text-layout-YJHtCWQI.js} +1 -1
  77. package/dist/runtime-BpSAgOw1.js +201 -0
  78. package/dist/runtime-Cd2UTnwe.cjs +1 -0
  79. package/dist/sbom.cdx.json +1 -1
  80. package/dist/server/node.d.cts +55 -7
  81. package/dist/server/node.d.ts +55 -7
  82. package/dist/server-node.cjs +5 -5
  83. package/dist/server-node.js +2721 -2430
  84. package/dist/server.cjs +1 -1
  85. package/dist/server.d.cts +47 -12
  86. package/dist/server.d.ts +47 -12
  87. package/dist/server.js +8 -8
  88. package/dist/style.css +1 -1
  89. package/dist/{template-catalog-DtrtT1FY.cjs → template-catalog--yBX169M.cjs} +1 -1
  90. package/dist/{template-catalog-CRuZL3pi.js → template-catalog-Bu7s7ReF.js} +3 -3
  91. package/dist/template-fragments-5EzVn7bm.cjs +1 -0
  92. package/dist/{template-fragments-CPpGpQoz.js → template-fragments-Di2vDFnx.js} +2 -2
  93. package/dist/{template-registry-O0hNIOfB.js → template-registry-BCBF2b8j.js} +10 -10
  94. package/dist/template-registry-Bnh5aEYf.cjs +1 -0
  95. package/dist/textwrap-BPFxhpOw.cjs +4 -0
  96. package/dist/{textwrap-D4ZksyMK.js → textwrap-CmVkhMhx.js} +1 -1
  97. package/dist/vue/async.d.cts +97 -18
  98. package/dist/vue/async.d.ts +97 -18
  99. package/dist/vue/index.d.cts +127 -28
  100. package/dist/vue/index.d.ts +127 -28
  101. package/dist/vue-async.cjs +1 -1
  102. package/dist/vue-async.js +3 -3
  103. package/dist/vue.cjs +1 -1
  104. package/dist/vue.js +192 -162
  105. package/dist/{workbook-session-C9ZmCBwY.js → workbook-session-B6P_-5a4.js} +2 -2
  106. package/dist/{workbook-session-C6-SrnCT.cjs → workbook-session-BnPK3T58.cjs} +1 -1
  107. package/dist/worker.cjs +1 -1
  108. package/dist/worker.d.cts +55 -7
  109. package/dist/worker.d.ts +55 -7
  110. package/dist/worker.js +4 -4
  111. package/dist/xlsx.cjs +4 -4
  112. package/dist/xlsx.d.cts +18 -1
  113. package/dist/xlsx.d.ts +18 -1
  114. package/dist/xlsx.js +279 -272
  115. package/package.json +1 -1
  116. package/dist/ParamEditor-BGjovFUe.js +0 -737
  117. package/dist/ParamEditor-CeNp4_zQ.cjs +0 -1
  118. package/dist/ReportLabelStudio-g8PkqJWn.cjs +0 -1
  119. package/dist/ReportParamPanel-C7fZTllk.cjs +0 -1
  120. package/dist/ReportPreview-BoGBGyRr.cjs +0 -6
  121. package/dist/ReportPreview-QLONCyci.js +0 -6257
  122. package/dist/RuleEditor-BZUP9yvL.cjs +0 -1
  123. package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +0 -1
  124. package/dist/TemplateReviewPanel-Dijwm9YE.js +0 -593
  125. package/dist/assets-D2gHc4Mz.cjs +0 -1
  126. package/dist/assets-T_gDeFaz.js +0 -132
  127. package/dist/auto-BrPWo7Xm.cjs +0 -1
  128. package/dist/capabilities-DiBj4Qgl.cjs +0 -1
  129. package/dist/capabilities-pg7j7VLT.js +0 -106
  130. package/dist/data-bar-CeZuFmYl.cjs +0 -1
  131. package/dist/designer-BZoVWTgl.js +0 -7172
  132. package/dist/designer-zS2uKJmY.cjs +0 -2
  133. package/dist/dom-ChE5D-L-.cjs +0 -1
  134. package/dist/grid-strokes-Be24LGuV.cjs +0 -1
  135. package/dist/json-snapshot-DNiIbpOr.cjs +0 -2
  136. package/dist/prefill-PaAy6wLk.cjs +0 -1
  137. package/dist/prepared-CJy_qk7d.js +0 -94
  138. package/dist/prepared-D0yCSxSO.cjs +0 -1
  139. package/dist/progress-ByiOxUD3.js +0 -250
  140. package/dist/progress-WomPRP3B.cjs +0 -1
  141. package/dist/protocol-BG16rz6D.js +0 -90
  142. package/dist/protocol-wzhl1Fim.cjs +0 -1
  143. package/dist/record-bindings-MBxbeBsi.cjs +0 -1
  144. package/dist/rich-text-layout-DK7A_a5r.cjs +0 -3
  145. package/dist/runtime-DYMOS_gz.cjs +0 -1
  146. package/dist/runtime-PiCax9zQ.js +0 -171
  147. package/dist/template-fragments-GVjpew_q.cjs +0 -1
  148. package/dist/template-registry-DI59PXVK.cjs +0 -1
  149. 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-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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./font-loader-D-znWNWS.cjs"),t=require("./pdf-DWuq6uxx.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-CNWXomuV.js";
2
- import { c as F, r as s } from "./pdf-CJToa81Z.js";
1
+ import { clearFontCache as t, configureFontCache as o, getFontCacheStats as r, invalidateFontCache as n, loadFontWithCache as c } from "./font-loader-i7lZbqH_.js";
2
+ import { c as F, r as s } from "./pdf-0_5XiTCx.js";
3
3
  export {
4
4
  t as clearFontCache,
5
5
  o as configureFontCache,
@@ -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-QLONCyci.js").then((r) => r.x)), _ = {
4
+ const p = c(() => import("./ReportPreview-_wTJnsG1.js").then((r) => r.x)), _ = {
5
5
  install(r, e = {}) {
6
6
  let t = e.fetcher;
7
7
  if (!t && e.reports) {
@@ -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-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
+ "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-CyUXJSVX.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;
@@ -0,0 +1 @@
1
+ "use strict";const g=require("./json-snapshot-C7QZrRBf.cjs"),N=require("./diagnostic-collector-D3rlvxm3.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;
@@ -1,6 +1,6 @@
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";
1
+ import { t as P, E as O, l as V, O as Z, P as T } from "./json-snapshot-BJWZNryO.js";
2
+ import { r as B } from "./diagnostic-collector-1sqd7DQP.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 $(e) {
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
- $(r.value);
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 = q(e, t);
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 : q(t, { ...r.address, columnIndex: n })?.value;
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 = q(e, t);
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, $(Y(c, e, n, o))])), s = Object.entries(o);
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 && q(e, t.address) ? { ...t.address } : null;
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 = L(l, r.toleranceValue) <= 0;
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)) };
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" || L(S(t.tolerance), S(0)) < 0)) throw new d("value", "Tolerance requires a non-negative 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,128 @@
1
+ import { v as g, R as a, s as y } from "./json-snapshot-BJWZNryO.js";
2
+ import { F as v, u as h, E as w } from "./diagnostic-collector-1sqd7DQP.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 a=require("./json-snapshot-C7QZrRBf.cjs"),c=require("./diagnostic-collector-D3rlvxm3.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,105 @@
1
+ import { e as m, f as g, b as y } from "./prepared-CVbgO9KR.js";
2
+ import { v as d } from "./json-snapshot-BJWZNryO.js";
3
+ import { u, F as h, E as a } from "./diagnostic-collector-1sqd7DQP.js";
4
+ import { b } from "./template-registry-BCBF2b8j.js";
5
+ const n = "mach-report-worker/1";
6
+ class D extends Error {
7
+ constructor(r) {
8
+ super(r.message), this.name = r.name, this.code = r.code, this.path = r.path, this.issues = r.issues, this.diagnostics = r.diagnostics, this.diagnosticSummary = r.diagnosticSummary, this.issueSummary = r.issueSummary;
9
+ }
10
+ }
11
+ function i(t) {
12
+ return !!t && typeof t == "object" && !Array.isArray(t);
13
+ }
14
+ function I(t) {
15
+ return i(t) ? ["rows", "pages", "cells"].every((r) => typeof t[r] == "number" && Number.isSafeInteger(t[r]) && t[r] >= 0) && typeof t.durationMs == "number" && Number.isFinite(t.durationMs) && t.durationMs >= 0 : !1;
16
+ }
17
+ function S(t) {
18
+ return Array.isArray(t) && t.every((r) => i(r) && typeof r.code == "string" && typeof r.message == "string" && ["info", "warning", "error"].includes(r.severity) && d(r) && y(r));
19
+ }
20
+ function k(t) {
21
+ return i(t) && Object.values(t).every((r) => i(r) && (r.revision === void 0 || typeof r.revision == "string") && (r.sourceToken === void 0 || typeof r.sourceToken == "string"));
22
+ }
23
+ function x(t) {
24
+ return t === void 0 ? !0 : i(t) && ["heuristic", "provided", "font-bytes"].includes(t.textMetrics) && (t.fontFingerprint === void 0 || typeof t.fontFingerprint == "string" && /^[a-f0-9]{64}$/.test(t.fontFingerprint));
25
+ }
26
+ function E(t, r) {
27
+ if (!i(t) || !I(t.stats) || !S(t.diagnostics) || !k(t.revisions) || !x(t.layout) || !m(t.sources) || t.diagnosticSummary !== void 0 && !g(t.diagnosticSummary, t.diagnostics)) return !1;
28
+ if (r === "prepare") return b(t.plan).ok;
29
+ const e = t.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
30
+ return t.bytes instanceof Uint8Array && (t.format === "pdf" || t.format === "xlsx") && t.contentType === e;
31
+ }
32
+ function p(t) {
33
+ if (!t || typeof t != "object") return { message: String(t).slice(0, 4096) };
34
+ const r = {};
35
+ for (const e of ["code", "path", "field", "message"]) {
36
+ const o = t[e];
37
+ typeof o == "string" && (r[e] = o.slice(0, e === "code" ? 128 : 4096));
38
+ }
39
+ return r;
40
+ }
41
+ function l(t) {
42
+ const r = p(t);
43
+ if (!i(t)) return r;
44
+ for (const e of ["format", "severity", "kind", "nid"]) typeof t[e] == "string" && (r[e] = t[e].slice(0, 4096));
45
+ for (const e of ["pageIndex", "componentIndex"]) Number.isSafeInteger(t[e]) && t[e] >= 0 && (r[e] = t[e]);
46
+ if (d(t) && t.valueState !== void 0 && i(t.target)) {
47
+ r.valueState = t.valueState;
48
+ const e = {};
49
+ for (const o of ["datasetId", "field", "rowKey", "tableId", "reportScope"]) t.target[o] !== void 0 && (e[o] = t.target[o]);
50
+ r.target = e;
51
+ }
52
+ return i(t.extension) && typeof t.extension.id == "string" && typeof t.extension.version == "string" && (r.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((e) => Number.isSafeInteger(e) && e >= 0) && (r.componentPath = t.componentPath), r;
53
+ }
54
+ function f(t, r, e) {
55
+ const o = u(a);
56
+ if (h(e))
57
+ o.merge({ ...e, entries: e.entries.slice(0, a).map((s) => ({ code: i(s) && typeof s.code == "string" ? s.code : "unknown", value: s })) });
58
+ else for (const s of t) o.push({ code: i(s) && typeof s.code == "string" ? s.code : "unknown", value: s });
59
+ const c = o.snapshot();
60
+ return { ...c, entries: c.entries.map((s) => r(s.value)) };
61
+ }
62
+ function R(t) {
63
+ if (!(t instanceof Error)) return { name: "Error", message: String(t).slice(0, 8192) };
64
+ const r = t, e = Array.isArray(r.diagnostics) ? f(r.diagnostics, l, r.diagnosticSummary) : void 0, o = Array.isArray(r.issues) ? f(r.issues, p) : void 0;
65
+ return {
66
+ name: t.name.slice(0, 128),
67
+ message: t.message.slice(0, 8192),
68
+ ...typeof r.code == "string" ? { code: r.code.slice(0, 128) } : {},
69
+ ...typeof r.path == "string" ? { path: r.path.slice(0, 4096) } : {},
70
+ ...o ? { issues: o.entries, ...o.omitted ? { issueSummary: o } : {} } : {},
71
+ ...e ? { diagnostics: e.entries, ...e.omitted || r.diagnosticSummary !== void 0 ? { diagnosticSummary: e } : {} } : {}
72
+ };
73
+ }
74
+ function F(t) {
75
+ if (!t || typeof t != "object") return !1;
76
+ const r = t;
77
+ return r.protocol === n && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export" || r.operation === "exportPrepared") && !!r.input && typeof r.input == "object";
78
+ }
79
+ async function O(t, r, e) {
80
+ try {
81
+ const o = r.operation === "prepare" ? await t.prepare({ ...r.input, onEvent: e }) : r.operation === "exportPrepared" ? await t.exportPrepared({ ...r.input, onEvent: e }) : await t.export({ ...r.input, onEvent: e });
82
+ return { protocol: n, id: r.id, result: o };
83
+ } catch (o) {
84
+ return { protocol: n, id: r.id, error: R(o) };
85
+ }
86
+ }
87
+ function W(t) {
88
+ const r = t.result;
89
+ return !r || !("bytes" in r) || !(r.bytes.buffer instanceof ArrayBuffer) ? [] : [r.bytes.buffer];
90
+ }
91
+ function j(t, r) {
92
+ if (!i(t) || typeof t.taskId != "string" || !t.taskId || r.taskId !== void 0 && t.taskId !== r.taskId || t.correlationId !== r.correlationId || t.reportId !== void 0 && (typeof t.reportId != "string" || !("reportIds" in r && r.reportIds.includes(t.reportId))) || !["query", "validate", "layout", "assets", "encode"].includes(t.stage) || !["started", "completed", "failed"].includes(t.status)) return !1;
93
+ for (const e of ["completed", "total"]) if (t[e] !== void 0 && (typeof t[e] != "number" || !Number.isFinite(t[e]) || t[e] < 0)) return !1;
94
+ return t.completed === void 0 || t.total === void 0 || t.completed <= t.total;
95
+ }
96
+ export {
97
+ n as R,
98
+ W as a,
99
+ D as b,
100
+ E as c,
101
+ F as i,
102
+ O as r,
103
+ R as s,
104
+ j as v
105
+ };
@@ -0,0 +1 @@
1
+ "use strict";const a=require("./prepared-DAwe8Il2.cjs"),p=require("./json-snapshot-C7QZrRBf.cjs"),n=require("./diagnostic-collector-D3rlvxm3.cjs"),y=require("./template-registry-Bnh5aEYf.cjs"),c="mach-report-worker/1";class u extends Error{constructor(r){super(r.message),this.name=r.name,this.code=r.code,this.path=r.path,this.issues=r.issues,this.diagnostics=r.diagnostics,this.diagnosticSummary=r.diagnosticSummary,this.issueSummary=r.issueSummary}}function i(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function h(t){return i(t)?["rows","pages","cells"].every(r=>typeof t[r]=="number"&&Number.isSafeInteger(t[r])&&t[r]>=0)&&typeof t.durationMs=="number"&&Number.isFinite(t.durationMs)&&t.durationMs>=0:!1}function R(t){return Array.isArray(t)&&t.every(r=>i(r)&&typeof r.code=="string"&&typeof r.message=="string"&&["info","warning","error"].includes(r.severity)&&p.hasValidDataExplanation(r)&&a.validReportDiagnosticLocation(r))}function I(t){return i(t)&&Object.values(t).every(r=>i(r)&&(r.revision===void 0||typeof r.revision=="string")&&(r.sourceToken===void 0||typeof r.sourceToken=="string"))}function k(t){return t===void 0?!0:i(t)&&["heuristic","provided","font-bytes"].includes(t.textMetrics)&&(t.fontFingerprint===void 0||typeof t.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(t.fontFingerprint))}function l(t,r){if(!i(t)||!h(t.stats)||!R(t.diagnostics)||!I(t.revisions)||!k(t.layout)||!a.validPreparedSources(t.sources)||t.diagnosticSummary!==void 0&&!a.matchingDiagnosticSummary(t.diagnosticSummary,t.diagnostics))return!1;if(r==="prepare")return y.validateRenderPlan(t.plan).ok;const e=t.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return t.bytes instanceof Uint8Array&&(t.format==="pdf"||t.format==="xlsx")&&t.contentType===e}function m(t){if(!t||typeof t!="object")return{message:String(t).slice(0,4096)};const r={};for(const e of["code","path","field","message"]){const o=t[e];typeof o=="string"&&(r[e]=o.slice(0,e==="code"?128:4096))}return r}function S(t){const r=m(t);if(!i(t))return r;for(const e of["format","severity","kind","nid"])typeof t[e]=="string"&&(r[e]=t[e].slice(0,4096));for(const e of["pageIndex","componentIndex"])Number.isSafeInteger(t[e])&&t[e]>=0&&(r[e]=t[e]);if(p.hasValidDataExplanation(t)&&t.valueState!==void 0&&i(t.target)){r.valueState=t.valueState;const e={};for(const o of["datasetId","field","rowKey","tableId","reportScope"])t.target[o]!==void 0&&(e[o]=t.target[o]);r.target=e}return i(t.extension)&&typeof t.extension.id=="string"&&typeof t.extension.version=="string"&&(r.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(e=>Number.isSafeInteger(e)&&e>=0)&&(r.componentPath=t.componentPath),r}function f(t,r,e){const o=n.createDiagnosticCollector(n.DEFAULT_DIAGNOSTIC_LIMIT);if(n.validDiagnosticSummary(e))o.merge({...e,entries:e.entries.slice(0,n.DEFAULT_DIAGNOSTIC_LIMIT).map(s=>({code:i(s)&&typeof s.code=="string"?s.code:"unknown",value:s}))});else for(const s of t)o.push({code:i(s)&&typeof s.code=="string"?s.code:"unknown",value:s});const d=o.snapshot();return{...d,entries:d.entries.map(s=>r(s.value))}}function g(t){if(!(t instanceof Error))return{name:"Error",message:String(t).slice(0,8192)};const r=t,e=Array.isArray(r.diagnostics)?f(r.diagnostics,S,r.diagnosticSummary):void 0,o=Array.isArray(r.issues)?f(r.issues,m):void 0;return{name:t.name.slice(0,128),message:t.message.slice(0,8192),...typeof r.code=="string"?{code:r.code.slice(0,128)}:{},...typeof r.path=="string"?{path:r.path.slice(0,4096)}:{},...o?{issues:o.entries,...o.omitted?{issueSummary:o}:{}}:{},...e?{diagnostics:e.entries,...e.omitted||r.diagnosticSummary!==void 0?{diagnosticSummary:e}:{}}:{}}}function b(t){if(!t||typeof t!="object")return!1;const r=t;return r.protocol===c&&typeof r.id=="string"&&(r.operation==="prepare"||r.operation==="export"||r.operation==="exportPrepared")&&!!r.input&&typeof r.input=="object"}async function x(t,r,e){try{const o=r.operation==="prepare"?await t.prepare({...r.input,onEvent:e}):r.operation==="exportPrepared"?await t.exportPrepared({...r.input,onEvent:e}):await t.export({...r.input,onEvent:e});return{protocol:c,id:r.id,result:o}}catch(o){return{protocol:c,id:r.id,error:g(o)}}}function A(t){const r=t.result;return!r||!("bytes"in r)||!(r.bytes.buffer instanceof ArrayBuffer)?[]:[r.bytes.buffer]}function T(t,r){if(!i(t)||typeof t.taskId!="string"||!t.taskId||r.taskId!==void 0&&t.taskId!==r.taskId||t.correlationId!==r.correlationId||t.reportId!==void 0&&(typeof t.reportId!="string"||!("reportIds"in r&&r.reportIds.includes(t.reportId)))||!["query","validate","layout","assets","encode"].includes(t.stage)||!["started","completed","failed"].includes(t.status))return!1;for(const e of["completed","total"])if(t[e]!==void 0&&(typeof t[e]!="number"||!Number.isFinite(t[e])||t[e]<0))return!1;return t.completed===void 0||t.total===void 0||t.completed<=t.total}exports.REPORT_WORKER_PROTOCOL=c;exports.ReportWorkerError=u;exports.isReportWorkerRequest=b;exports.reportWorkerTransferList=A;exports.runReportWorkerRequest=x;exports.serializeError=g;exports.validReportWorkerEvent=T;exports.validReportWorkerResult=l;
@@ -0,0 +1 @@
1
+ "use strict";const l=require("./diagnostic-collector-D3rlvxm3.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 u(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 F(e,t,r){return r!=null?t?u(e,r):e.toFixed(r):t?u(e):String(e)}function c(e){const t=typeof e=="number"?e:Number(String(e).replace(/,/g,""));return Number.isFinite(t)?t:null}function m(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):F(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):`${u(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){return r==="identifier"||r==="dimension"||r==="date"?"center":r==="measure"?"right":r==="text"?"left":t?.kind==="number"||t?.kind==="percent"?"right":t?.kind==="date"||e instanceof Date||typeof e=="boolean"?"center":typeof e=="number"&&Number.isFinite(e)?"right":"left"}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 A(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 N(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??"left";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):a;const o=t.rules?.find(f=>h(r,f.when));o&&(s=l.mergeComponentStyles(s,o.style));const d={text:t.format?m(n,t.format):w(n),style:s};return A(d,t,n),e.computed?.some(f=>f.field===t.field)&&(d.derived=!0,d.editable=!1),i&&(d.editable=!1),d}function R(e,t,r){const i=N(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 E 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 k(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 v(e,t,r=b){D(r);let i=0;return Object.assign(a=>{if(!a.chartBinding)return[a];const s=k(a,e,t),o=i+(s.categories.length?y.chartComponentUpperBound(s):1);if(!Number.isSafeInteger(o))throw new RangeError("图表图元估算应为有限安全整数");if(o>r)throw new E(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 p 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 p(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 p(a,"绑定值应为字符串、有限数字、布尔值或空值",i,t)}function _(e,t,r={}){const i=$(t,e.field,r);return i==null||i===""?e.emptyText??"":`${e.prefix??""}${m(i,e.format)}${e.suffix??""}`}exports.DEFAULT_CHART_COMPONENT_LIMIT=b;exports.PaginateCellLimitError=O;exports.PaginateChartComponentLimitError=E;exports.PaginatePageLimitError=I;exports.ReportBindingError=p;exports.applyListTreeMetadata=L;exports.createChartResolver=v;exports.evalStyleRule=h;exports.formatValue=m;exports.isLabelImageData=B;exports.listCellText=w;exports.listTreeIndent=M;exports.parseDateLocal=S;exports.readRecordScalar=$;exports.resolveComponentBinding=_;exports.resolveListAutoAlignment=T;exports.resolveListHeaderStyle=P;exports.resolveListSampleCell=N;exports.resolveTreeListSampleCell=R;exports.toExcelNumberFormat=C;exports.toNumber=c;exports.validateChartComponentLimit=D;
@@ -1,4 +1,4 @@
1
- import { m as f, j as m } from "./progress-ByiOxUD3.js";
1
+ import { m as f, j as m } from "./diagnostic-collector-1sqd7DQP.js";
2
2
  import { a as S, c as M } from "./charts-CxJZ0XaY.js";
3
3
  import { n as w, i as l, f as C } from "./computed-f3pOqWLX.js";
4
4
  function N(e) {
@@ -1,6 +1,6 @@
1
1
  import { v as F } from "./dataset-DL83majE.js";
2
- import { v as D, e as z, p as Z } from "./template-registry-O0hNIOfB.js";
3
- import { r as N } from "./progress-ByiOxUD3.js";
2
+ import { v as D, e as z, p as Z } from "./template-registry-BCBF2b8j.js";
3
+ import { r as N } from "./diagnostic-collector-1sqd7DQP.js";
4
4
  function v(t) {
5
5
  let e = "";
6
6
  for (let o = t; o > 0; o = Math.floor((o - 1) / 26)) e = String.fromCharCode(65 + (o - 1) % 26) + e;