@agile-team/mach-report 2.23.0 → 2.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +3 -2
  2. package/dist/ExcelBindingWizard-BrTmdo7f.cjs +1 -0
  3. package/dist/ExcelBindingWizard-CcDMLO8Q.js +1486 -0
  4. package/dist/ParamEditor-BGjovFUe.js +737 -0
  5. package/dist/ParamEditor-CeNp4_zQ.cjs +1 -0
  6. package/dist/ReportBatchPanel-CHxBtG9R.cjs +1 -0
  7. package/dist/ReportBatchPanel-CJB67WNd.js +351 -0
  8. package/dist/ReportLabelStudio-Tplc1TLJ.js +784 -0
  9. package/dist/ReportLabelStudio-g8PkqJWn.cjs +1 -0
  10. package/dist/ReportParamPanel-C7fZTllk.cjs +1 -0
  11. package/dist/{ReportParamPanel-Dgmqro1Y.js → ReportParamPanel-GI43aGa0.js} +61 -56
  12. package/dist/{ReportPreview-FFIryrIr.cjs → ReportPreview-BoGBGyRr.cjs} +2 -2
  13. package/dist/{ReportPreview-DeWzG8jQ.js → ReportPreview-QLONCyci.js} +8 -8
  14. package/dist/ReportTemplateLibrary-BFQIX0sg.cjs +1 -0
  15. package/dist/ReportTemplateLibrary-KqX4E2sN.js +312 -0
  16. package/dist/RuleEditor-BZUP9yvL.cjs +1 -0
  17. package/dist/RuleEditor-OPX1awrH.js +2342 -0
  18. package/dist/TemplateOutlinePanel-CVYKVLv_.cjs +1 -0
  19. package/dist/TemplateOutlinePanel-DQS-eOs6.js +97 -0
  20. package/dist/TemplateReusePanel-CY6O93Zk.cjs +1 -0
  21. package/dist/TemplateReusePanel-DKXiFTyB.js +389 -0
  22. package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +1 -0
  23. package/dist/TemplateReviewPanel-Dijwm9YE.js +593 -0
  24. package/dist/artifact-integrity.json +68 -68
  25. package/dist/{auto-CTIJ6PnR.js → auto-BB99S802.js} +4 -4
  26. package/dist/{auto-4pK9HePf.cjs → auto-BrPWo7Xm.cjs} +1 -1
  27. package/dist/designer-BZoVWTgl.js +7172 -0
  28. package/dist/designer-zS2uKJmY.cjs +2 -0
  29. package/dist/designer.cjs +1 -1
  30. package/dist/designer.d.cts +7 -0
  31. package/dist/designer.d.ts +7 -0
  32. package/dist/designer.js +2 -2
  33. package/dist/{encoding-BefcaHdp.cjs → encoding-7lquyj0w.cjs} +1 -1
  34. package/dist/{encoding-CL6rXEkR.js → encoding-CEd-dq9A.js} +2 -2
  35. package/dist/{font-loader-BT5baV-o.js → font-loader-CNWXomuV.js} +1 -1
  36. package/dist/{font-loader-Ga51c2VC.cjs → font-loader-D8pI87fL.cjs} +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.js +7 -7
  39. package/dist/{json-snapshot-OqkPyUk5.js → json-snapshot-BRnzKudk.js} +1 -1
  40. package/dist/{json-snapshot-1tvQNzQE.cjs → json-snapshot-DNiIbpOr.cjs} +1 -1
  41. package/dist/{pdf-aobetCsy.js → pdf-CJToa81Z.js} +2 -2
  42. package/dist/{pdf-HiEeXe9H.cjs → pdf-DpMkW72B.cjs} +1 -1
  43. package/dist/pdf.cjs +1 -1
  44. package/dist/pdf.js +2 -2
  45. package/dist/{plugin-BFANt-i8.cjs → plugin-BWTp-X7b.cjs} +1 -1
  46. package/dist/{plugin-DeYYAL6F.js → plugin-_BkUVc2z.js} +1 -1
  47. package/dist/{prefill-Dk4C6S5R.js → prefill-CWGdnqQd.js} +1 -1
  48. package/dist/{prefill-DsUD5OoK.cjs → prefill-PaAy6wLk.cjs} +1 -1
  49. package/dist/{prepared-DCIxhKFo.js → prepared-CJy_qk7d.js} +1 -1
  50. package/dist/{prepared-Dv-XM3i1.cjs → prepared-D0yCSxSO.cjs} +1 -1
  51. package/dist/{protocol-DxeUKGYG.js → protocol-BG16rz6D.js} +2 -2
  52. package/dist/{protocol-B9YgfQ_d.cjs → protocol-wzhl1Fim.cjs} +1 -1
  53. package/dist/report-encoding-worker.cjs +1 -1
  54. package/dist/report-encoding-worker.js +1 -1
  55. package/dist/{runtime-DKlGd_D4.cjs → runtime-DYMOS_gz.cjs} +1 -1
  56. package/dist/{runtime-75Y5Oq5B.js → runtime-PiCax9zQ.js} +2 -2
  57. package/dist/sbom.cdx.json +1 -1
  58. package/dist/server-node.cjs +4 -4
  59. package/dist/server-node.js +737 -736
  60. package/dist/server.cjs +1 -1
  61. package/dist/server.js +5 -5
  62. package/dist/style.css +1 -1
  63. package/dist/{template-catalog--cjxzgH7.js → template-catalog-CRuZL3pi.js} +1 -1
  64. package/dist/{template-catalog-CoT7jm_6.cjs → template-catalog-DtrtT1FY.cjs} +1 -1
  65. package/dist/textwrap-D4ZksyMK.js +111 -0
  66. package/dist/textwrap-DEHqAjKZ.cjs +4 -0
  67. package/dist/vue/async.d.cts +7 -0
  68. package/dist/vue/async.d.ts +7 -0
  69. package/dist/vue/index.d.cts +7 -0
  70. package/dist/vue/index.d.ts +7 -0
  71. package/dist/vue-async.cjs +1 -1
  72. package/dist/vue-async.js +3 -3
  73. package/dist/vue.cjs +1 -1
  74. package/dist/vue.js +6 -6
  75. package/dist/worker.cjs +1 -1
  76. package/dist/worker.js +4 -4
  77. package/package.json +1 -1
  78. package/dist/ExcelBindingWizard-D4FLind-.js +0 -1485
  79. package/dist/ExcelBindingWizard-D4RS5Bpg.cjs +0 -1
  80. package/dist/ParamEditor-C-6C9rd2.cjs +0 -1
  81. package/dist/ParamEditor-CASZt-Ma.js +0 -732
  82. package/dist/ReportBatchPanel-Bq7t8a5r.js +0 -350
  83. package/dist/ReportBatchPanel-YVj5IO5y.cjs +0 -1
  84. package/dist/ReportLabelStudio-Cqhita1b.cjs +0 -1
  85. package/dist/ReportLabelStudio-Dj7GXhuv.js +0 -783
  86. package/dist/ReportParamPanel-DZbFVmDL.cjs +0 -1
  87. package/dist/ReportTemplateLibrary-BaWodmpm.cjs +0 -1
  88. package/dist/ReportTemplateLibrary-DdAAAD2I.js +0 -311
  89. package/dist/RuleEditor-D2UwQGF6.js +0 -2341
  90. package/dist/RuleEditor-DcT9xI1v.cjs +0 -1
  91. package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +0 -1
  92. package/dist/TemplateOutlinePanel-DrT7XN0m.js +0 -96
  93. package/dist/TemplateReusePanel-4eejkNqi.js +0 -388
  94. package/dist/TemplateReusePanel-DZMyiX5I.cjs +0 -1
  95. package/dist/TemplateReviewPanel-BIhNLeNw.js +0 -592
  96. package/dist/TemplateReviewPanel-DnYImiXu.cjs +0 -1
  97. package/dist/designer-DhrE7jzw.js +0 -7169
  98. package/dist/designer-IAZu6kBX.cjs +0 -2
  99. package/dist/textwrap-BIjtEWmq.js +0 -110
  100. package/dist/textwrap-Cy7o1hIR.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-Ga51c2VC.cjs"),t=require("./pdf-HiEeXe9H.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-D8pI87fL.cjs"),t=require("./pdf-DpMkW72B.cjs");exports.clearFontCache=e.clearFontCache;exports.configureFontCache=e.configureFontCache;exports.getFontCacheStats=e.getFontCacheStats;exports.invalidateFontCache=e.invalidateFontCache;exports.loadFontWithCache=e.loadFontWithCache;exports.createFontBytesMeasurer=t.createFontBytesMeasurer;exports.renderPlanToPdf=t.renderPlanToPdf;
package/dist/pdf.js CHANGED
@@ -1,5 +1,5 @@
1
- import { clearFontCache as t, configureFontCache as o, getFontCacheStats as r, invalidateFontCache as n, loadFontWithCache as c } from "./font-loader-BT5baV-o.js";
2
- import { c as F, r as s } from "./pdf-aobetCsy.js";
1
+ import { clearFontCache as t, configureFontCache as o, getFontCacheStats as r, invalidateFontCache as n, loadFontWithCache as c } from "./font-loader-CNWXomuV.js";
2
+ import { c as F, r as s } from "./pdf-CJToa81Z.js";
3
3
  export {
4
4
  t as clearFontCache,
5
5
  o as configureFontCache,
@@ -1 +1 @@
1
- "use strict";var R=Object.create;var f=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var m=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of P(e))!p.call(r,o)&&o!==t&&f(r,o,{get:()=>e[o],enumerable:!(n=u(e,o))||n.enumerable});return r};var E=(r,e,t)=>(t=r!=null?R(d(r)):{},m(e||!r||!r.__esModule?f(t,"default",{value:r,enumerable:!0}):t,r));const l=require("vue"),i=require("./injection-keys-Db_DyLkm.cjs"),h=require("./report-params-VTg8MoCp.cjs"),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-FFIryrIr.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-BoGBGyRr.cjs")).then(r=>r.ReportPreview$1)),v={install(r,e={}){let t=e.fetcher;if(!t&&e.reports){const n=e.reports;let o;t=async c=>(o??=import("@agile-team/mach-report").then(({createReportSource:a})=>a(n)),(await o)(c)),t.getParamDefs=c=>h.getReportParamDefs(n,c)}t&&r.provide(i.MACH_REPORT_FETCHER_KEY,t),e.pdfExporter&&r.provide(i.MACH_REPORT_PDF_EXPORTER_KEY,e.pdfExporter),r.provide(i.MACH_REPORT_CONFIG_KEY,l.computed(()=>{if(e.pdfFontUrl===void 0)return e.config??null;const n=e.config??{defaults:{},presets:{}};return{...n,defaults:{...n.defaults,pdfFontUrl:e.pdfFontUrl}}})),e.globalComponent!==!1&&!r.component("MachReportPreview")&&r.component("MachReportPreview",s)}};exports.MachReportPreview=s;exports.machReportPlugin=v;
@@ -1,7 +1,7 @@
1
1
  import { defineAsyncComponent as c, computed as m } from "vue";
2
2
  import { b as i, c as l, a as d } from "./injection-keys-e85udZCp.js";
3
3
  import { g as s } from "./report-params-D9tBuM9B.js";
4
- const p = c(() => import("./ReportPreview-DeWzG8jQ.js").then((r) => r.x)), _ = {
4
+ const p = c(() => import("./ReportPreview-QLONCyci.js").then((r) => r.x)), _ = {
5
5
  install(r, e = {}) {
6
6
  let t = e.fetcher;
7
7
  if (!t && e.reports) {
@@ -1,4 +1,4 @@
1
- import { t as q, E as O, l as V, L as Z, M as T } from "./json-snapshot-OqkPyUk5.js";
1
+ import { t as q, E as O, l as V, L as Z, M as T } from "./json-snapshot-BRnzKudk.js";
2
2
  import { r as B } from "./progress-ByiOxUD3.js";
3
3
  import { d as L, p as S, a as H, k as P, h as J } from "./computed-f3pOqWLX.js";
4
4
  function I(e) {
@@ -1 +1 @@
1
- "use strict";const g=require("./json-snapshot-1tvQNzQE.cjs"),N=require("./progress-WomPRP3B.cjs"),y=require("./computed-DK6BruFz.cjs");function R(e){return Number.isFinite(e)?Math.max(0,e):0}function B(e,t=0){const r=e.length,o=R(t),n=new Array(r+1);n[0]=0;for(let i=0;i<r;i++)n[i+1]=n[i]+R(e[i]??0)+o;const c=n[r];function s(i){let a=0,u=r-1,p=0;for(;a<=u;){const f=a+u>>>1;n[f]<=i?(p=f,a=f+1):u=f-1}return p}function d(i,a,u=1){if(r===0)return{start:0,end:-1,padTopPx:0,padBottomPx:0};const p=Math.floor(R(u)),f=R(a),m=s(f),w=Math.max(0,m-p),I=f+R(i);let h=m,D=r-1,z=r-1;for(;h<=D;){const S=h+D>>>1;n[S+1]<I?h=S+1:(z=S,D=S-1)}const E=Math.min(r-1,z+p);return{start:w,end:E,padTopPx:n[w],padBottomPx:Math.max(0,c-n[E+1])}}return{totalHeightPx:c,pageAt:s,offsetAt:i=>n[Math.max(0,Math.min(r,Math.floor(i)))]??0,window:d}}class v extends Error{constructor(t){super(`Report drill: ${t}`),this.code=t,this.name="ReportDrillError"}}function x(e){return typeof e=="string"&&e.trim().length>0&&e.length<=256}function V(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="boolean")return String(e);if(typeof e=="string"&&e.length>0&&e.length<=4096)return e;throw new v("missing-value")}function $(e,t){return Object.getOwnPropertyDescriptor(e,t)?.value}function A(e){if(!Array.isArray(e)||e.length>64)throw new v("config");const t=new Set;for(const r of e){if(!r||!x(r.id)||!x(r.label)||!r.target||!x(r.target.field)||t.has(r.id))throw new v("config");t.add(r.id);const o=r.target;if(o.datasetId!==void 0&&!x(o.datasetId)||o.reportScope!==void 0&&!x(o.reportScope))throw new v("config");if(o.roles!==void 0&&(!Array.isArray(o.roles)||o.roles.length>16||o.roles.some(n=>!x(n))))throw new v("config");G(r.params)}}function G(e){if(e!==void 0){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).length>32)throw new v("config");for(const[t,r]of Object.entries(e)){if(!x(t)||["__proto__","constructor","prototype"].includes(t)||!r||typeof r!="object")throw new v("config");if("value"in r)try{V(r.value)}catch{throw new v("config")}else if(!["value","rowKey","query","field"].includes(r.from)||(r.from==="query"||r.from==="field")&&!x(r.field))throw new v("config")}}}function T(e,t,r){const{target:o}=r,n=t.source?.datasetId??t.component.table?.source?.datasetId;return(t.source?.field??t.table?.columnKey)===o.field&&(o.datasetId===void 0||n===o.datasetId)&&(o.reportScope===void 0||e.pages[t.address.pageIndex]?.meta?.reportScope===o.reportScope)&&(o.roles?o.roles.includes(t.table?.role??""):t.table?.role!=="header")}function U(e,t,r){A(r);const o=g.getReportCellContext(e,t);return o?r.filter(n=>T(e,o,n)):[]}function W(e,t,r,o){if("value"in e)return e.value;switch(e.from){case"value":return r.value;case"rowKey":return r.source?.rowKey;case"query":return $(o,e.field);case"field":{const n=r.component.table?.columnKeys.indexOf(e.field)??-1;return n<0?void 0:g.getReportCellContext(t,{...r.address,columnIndex:n})?.value}}}function Z(e,t,r,o={}){A([r]);const n=g.getReportCellContext(e,t);if(!n||!T(e,n,r))throw new v("target");const c=Object.fromEntries(Object.entries(r.params??{}).map(([i,a])=>[i,V(W(a,e,n,o))])),s=Object.entries(o);if(s.length>128||s.some(([i,a])=>!x(i)||typeof a!="string"||a.length>4096))throw new v("config");const d=e.pages[t.pageIndex]?.meta?.reportScope;return Object.freeze({actionId:r.id,params:Object.freeze(c),returnState:Object.freeze({params:Object.freeze(Object.fromEntries(s)),address:Object.freeze({...t}),...typeof d=="string"?{reportScope:d}:{},...n.source?{source:Object.freeze({sourceScope:n.source.sourceScope,datasetId:n.source.datasetId,rowKey:n.source.rowKey,field:n.source.field})}:{}})})}function H(e,t){if(!t.source)return e.pages[t.address.pageIndex]?.meta?.reportScope===t.reportScope&&g.getReportCellContext(e,t.address)?{...t.address}:null;const r=g.createReportCellResolver(e),o=g.reportCellEditKey({address:t.address,source:t.source});for(const[n,c]of e.pages.entries())if(!(t.reportScope!==void 0&&c.meta?.reportScope!==t.reportScope)){for(const[s,d]of c.components.entries())if(d.grid)for(const i of N.resolveGridLayout(d.grid,d.widthMm,d.heightMm).cells){const a={pageIndex:n,componentIndex:s,rowIndex:i.ri,columnIndex:i.ci},u=r(a);if(u?.source&&g.reportCellEditKey(u)===o)return a}}return null}class l extends Error{constructor(t,r){super(r),this.code=t,this.name="ReportDataError"}}function b(e,t,r){const o=e??t;if(!Number.isSafeInteger(o)||o<1||o>r)throw new l("limit","Invalid report data budget");return o}function k(e){if(typeof e=="string"&&e.length>0&&e.length<=2048)return`s:${e}`;if(typeof e=="number"&&Number.isSafeInteger(e))return`n:${Object.is(e,-0)?0:e}`;throw new l("identity","A stable string or safe integer business key is required")}function O(e){if(typeof e.datasetId!="string"||!e.datasetId.trim()||e.datasetId.length>2048)throw new l("identity","A dataset identity is required");if(e.sourceScope!==void 0&&(typeof e.sourceScope!="string"||!e.sourceScope.trim()||e.sourceScope.length>2048))throw new l("identity","Invalid source scope")}function j(e,t=256){if(!Array.isArray(e)||!e.length||e.length>t)throw new l("limit","A bounded explicit field allowlist is required");const r=new Set;for(const o of e){if(typeof o!="string"||!o.trim()||o.length>2048||["__proto__","constructor","prototype"].includes(o))throw new l("identity","Invalid report field");if(r.has(o))throw new l("duplicate","Duplicate report field");r.add(o)}}function C(e,t){const r=Object.getOwnPropertyDescriptor(e.values,t);if(!r)return;if(!("value"in r))throw new l("value","Report values must be plain scalar data");const o=r.value;if(o===null||typeof o=="boolean"||typeof o=="string"||typeof o=="number"&&Number.isFinite(o))return o;throw new l("value","Report values must be finite scalar data")}function J(e){if(!e||typeof e!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(e)))throw new l("value","Report records must be plain data");const t=Object.getOwnPropertyDescriptor(e,"rowKey"),r=Object.getOwnPropertyDescriptor(e,"values");if(!t||!("value"in t)||!r||!("value"in r)||!r.value||typeof r.value!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(r.value)))throw new l("value","Report records require own scalar keys and plain values");return{rowKey:t.value,values:r.value}}function q(e,t,r={}){const o=b(r.maxRows,5e4,1e5),n=b(r.maxCells,1e6,2e6);if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype||e.length>o||e.length*t.length>n)throw new l("limit","Report data exceeds its budget");const c=new Map;for(let s=0;s<e.length;s++){const d=Object.getOwnPropertyDescriptor(e,s);if(!d||!("value"in d))throw new l("value","Sparse or accessor report records are unsupported");const i=J(d.value),a=k(i.rowKey);if(c.has(a))throw new l("duplicate","Duplicate business row key");const u=Object.create(null);for(const p of t){const f=C(i,p);f!==void 0&&(u[p]=f)}c.set(a,{rowKey:i.rowKey,values:u})}return c}function P(e){return e==null||e===""}function F(e,t){return P(e)?t.missing==="zero"?y.parseDecimal(0):void 0:y.parseDecimal(e)}function Q(e){return{coefficient:-e.coefficient,scale:e.scale}}function X(e,t,r,o){const n=F(e,r),c=Object.is(e,t)?n:F(t,r);if(!n||!c)return{equal:L(e,t,r),ratioUnavailable:"missing"};const s=y.addDecimal(c,Q(n)),d={...s,coefficient:s.coefficient<0n?-s.coefficient:s.coefficient},i=y.compareDecimal(d,r.toleranceValue)<=0;return i&&!o?{equal:i}:n.coefficient===0n?{equal:i,delta:y.printDecimal(s),...s.coefficient===0n&&r.zeroDenominator==="zero-if-equal"?{changeRatio:"0"}:{ratioUnavailable:"zero-denominator"}}:{equal:i,delta:y.printDecimal(s),changeRatio:y.printDecimal(y.divideDecimal(s,n,r.ratioDigits??12))}}function L(e,t,r){return r.missing==="empty-equivalent"&&P(e)&&P(t)||Object.is(e,t)}function Y(e){j(e.fields.map(t=>t.field),b(e.maxFields,256,1024));for(const t of e.fields){if(t.type!==void 0&&!["decimal","value"].includes(t.type))throw new l("value","Invalid comparison field type");if(t.missing&&!["distinct","empty-equivalent","zero"].includes(t.missing))throw new l("value","Invalid missing-value policy");if(t.zeroDenominator&&!["omit","zero-if-equal"].includes(t.zeroDenominator))throw new l("value","Invalid zero-denominator policy");if(t.missing==="zero"&&t.type!=="decimal")throw new l("value","Zero missing-value policy requires a decimal field");if(t.tolerance!==void 0&&(t.type!=="decimal"||y.compareDecimal(y.parseDecimal(t.tolerance),y.parseDecimal(0))<0))throw new l("value","Tolerance requires a non-negative decimal");if(t.ratioDigits!==void 0&&(!Number.isInteger(t.ratioDigits)||t.ratioDigits<0||t.ratioDigits>100))throw new l("value","Invalid ratio precision")}return e.fields.map(t=>({...t,toleranceValue:y.parseDecimal(t.tolerance??"0")}))}function M(e,t,r,o,n){let c=!1;for(const s of r){const d=e?C(e,s.field):void 0,i=t?C(t,s.field):void 0,a=s.type==="decimal"?X(d,i,s,!e||!t):{equal:L(d,i,s)};if(e&&t&&a.equal)continue;if(c=!0,o.length>=n)throw new l("limit","Report differences exceed their budget");const{equal:u,...p}=a;o.push({rowKey:(t??e).rowKey,kind:e?t?"changed":"removed":"added",field:s.field,label:s.label??s.field,before:d,after:i,...p})}return c}function ee(e,t,r){O(e),O(t);const o=Y(r);if(e.datasetId!==t.datasetId||e.sourceScope!==t.sourceScope)throw new l("identity","Comparison requires the same business dataset and source scope");const n=r.fields.map(u=>u.field),c=q(e.rows,n,r),s=q(t.rows,n,r),d=b(r.maxDifferences,2e4,1e5),i=[],a={added:0,removed:0,changed:0,unchanged:0,cells:0};for(const[u,p]of c){const f=s.get(u),m=M(p,f,o,i,d);f?m?a.changed++:a.unchanged++:a.removed++}for(const[u,p]of s)c.has(u)||(M(void 0,p,o,i,d),a.added++);return a.cells=i.length,{sourceScope:t.sourceScope,datasetId:t.datasetId,differences:i,counts:a}}function K(e,t){O(t),j(t.fields,b(t.maxFields,256,1024));const r=b(t.maxCells,1e6,2e6),o=new Set(t.fields),n=new Map,c=g.createReportCellResolver(e);let s=0;for(const[d,i]of e.pages.entries())for(const[a,u]of i.components.entries()){if(!u.grid)continue;for(const f of u.grid.cells)if(s+=f.length,s>r)throw new l("limit","Report cell scan exceeds its budget");const p=N.resolveGridLayout(u.grid,u.widthMm,u.heightMm).cells;for(const f of p){const m=c({pageIndex:d,componentIndex:a,rowIndex:f.ri,columnIndex:f.ci}),w=m?.source;if(!m||!w||w.datasetId!==t.datasetId||w.sourceScope!==t.sourceScope||!o.has(w.field))continue;k(w.rowKey);const I=g.reportCellEditKey(m),h=n.get(I);h?(!Object.is(h.context.value,m.value)||h.context.source?.revision!==w.revision||h.context.source?.sourceToken!==w.sourceToken||h.context.editable!==m.editable)&&(h.ambiguous=!0):n.set(I,{context:m,ambiguous:!1})}}return n}function te(e,t){const r=K(e,t),o=new Map,n=b(t.maxRows,5e4,1e5);for(const{context:c,ambiguous:s}of r.values()){if(s)throw new l("conflict","Repeated report cells disagree for the same business field");const d=c.source,i=k(d.rowKey);let a=o.get(i);if(!a){if(o.size>=n)throw new l("limit","Report row extraction exceeds its budget");a={rowKey:d.rowKey,values:Object.create(null)},o.set(i,a)}a.values[d.field]=c.value}return{sourceScope:t.sourceScope,datasetId:t.datasetId,rows:[...o.values()]}}function _(e){return e==null||e===""}function re(e,t,r){if(!t){e.reason="missing-target";return}const{context:o,ambiguous:n}=t;if(e.before=o.value,n){e.status="conflict",e.reason="ambiguous";return}if(!o.editable||r.canEdit?.(o)===!1){e.reason="readonly";return}if(_(e.after)){e.reason="missing-source";return}if(Object.is(o.value,e.after)){e.status="matched",e.reason="unchanged";return}if(r.mode!=="replace"&&!_(o.value)){e.reason="occupied";return}try{const c=g.editFromContext(o,e.after);if(Object.is(c.value,c.previousValue)){e.status="matched",e.reason="unchanged";return}return e.after=c.value,e.status="changed",c}catch{e.status="conflict",e.reason="invalid";return}}function oe(e,t){if(O(t),t.mode!==void 0&&t.mode!=="empty"&&t.mode!=="replace")throw new l("value","Invalid prefill policy");const r=b(t.maxFields,256,1024),o=t.fields.map(f=>f.field),n=[...new Set(t.fields.map(f=>f.sourceField??f.field))];j(o,r),j(n,r);const c=q(t.rows,n,t),s=K(e,{...t,fields:o}),d=b(t.maxChanges,1e4,1e4),i=b(t.maxCells,1e6,2e6);if(c.size*o.length>i)throw new l("limit","Prefill review exceeds its budget");const a=[],u=[],p={matched:0,changed:0,skipped:0,conflict:0};for(const f of c.values())for(const m of t.fields){const w={sourceScope:t.sourceScope,datasetId:t.datasetId,rowKey:f.rowKey,field:m.field},I={source:w,label:m.label??m.field,status:"skipped",after:C(f,m.sourceField??m.field)},h=g.reportCellEditKey({address:{pageIndex:0,componentIndex:0,rowIndex:0,columnIndex:0},source:w}),D=re(I,s.get(h),t);if(D){if(u.length>=d)throw new l("limit","Prefill changes exceed the atomic edit budget");u.push(D)}p[I.status]++,a.push(I)}return{sourceScope:t.sourceScope,datasetId:t.datasetId,items:a,counts:p,edits:u}}function ne(e,t,r){if(t.counts.conflict>0)throw new l("conflict","Resolve prefill conflicts before applying");if(t.edits.length>1e4)throw new l("limit","Prefill changes exceed the atomic edit budget");if(!t.edits.length)return[];const o=[...new Set(t.edits.map(s=>s.source.field))],n=K(e,{sourceScope:t.sourceScope,datasetId:t.datasetId,fields:o}),c=new Set;return t.edits.map(s=>{if(!s.source||s.source.datasetId!==t.datasetId||s.source.sourceScope!==t.sourceScope)throw new l("identity","Prefill identity changed");const d=g.reportCellEditKey(s),i=n.get(d);if(c.has(d))throw new l("duplicate","Duplicate prefill target");if(c.add(d),!i||i.ambiguous||g.sourceChanged(i.context,s)||!Object.is(i.context.value,s.previousValue))throw new l("conflict","Prefill target changed; reload the preview");if(!i.context.editable||r?.(i.context)===!1)throw new l("conflict","Prefill target is read-only");return{address:{...i.context.address},value:g.editFromContext(i.context,s.value).value}})}exports.ReportDataError=l;exports.ReportDrillError=v;exports.compareReportData=ee;exports.createPageWindowIndex=B;exports.createReportDrillRequest=Z;exports.createReportPrefill=oe;exports.dataLimit=b;exports.indexReportDataCells=K;exports.matchReportDrillActions=U;exports.reportDataSnapshotFromPlan=te;exports.reportPrefillInputs=ne;exports.resolveReportDrillReturn=H;exports.validateReportDrillActions=A;
1
+ "use strict";const g=require("./json-snapshot-DNiIbpOr.cjs"),N=require("./progress-WomPRP3B.cjs"),y=require("./computed-DK6BruFz.cjs");function R(e){return Number.isFinite(e)?Math.max(0,e):0}function B(e,t=0){const r=e.length,o=R(t),n=new Array(r+1);n[0]=0;for(let i=0;i<r;i++)n[i+1]=n[i]+R(e[i]??0)+o;const c=n[r];function s(i){let a=0,u=r-1,p=0;for(;a<=u;){const f=a+u>>>1;n[f]<=i?(p=f,a=f+1):u=f-1}return p}function d(i,a,u=1){if(r===0)return{start:0,end:-1,padTopPx:0,padBottomPx:0};const p=Math.floor(R(u)),f=R(a),m=s(f),w=Math.max(0,m-p),I=f+R(i);let h=m,D=r-1,z=r-1;for(;h<=D;){const S=h+D>>>1;n[S+1]<I?h=S+1:(z=S,D=S-1)}const E=Math.min(r-1,z+p);return{start:w,end:E,padTopPx:n[w],padBottomPx:Math.max(0,c-n[E+1])}}return{totalHeightPx:c,pageAt:s,offsetAt:i=>n[Math.max(0,Math.min(r,Math.floor(i)))]??0,window:d}}class v extends Error{constructor(t){super(`Report drill: ${t}`),this.code=t,this.name="ReportDrillError"}}function x(e){return typeof e=="string"&&e.trim().length>0&&e.length<=256}function V(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="boolean")return String(e);if(typeof e=="string"&&e.length>0&&e.length<=4096)return e;throw new v("missing-value")}function $(e,t){return Object.getOwnPropertyDescriptor(e,t)?.value}function A(e){if(!Array.isArray(e)||e.length>64)throw new v("config");const t=new Set;for(const r of e){if(!r||!x(r.id)||!x(r.label)||!r.target||!x(r.target.field)||t.has(r.id))throw new v("config");t.add(r.id);const o=r.target;if(o.datasetId!==void 0&&!x(o.datasetId)||o.reportScope!==void 0&&!x(o.reportScope))throw new v("config");if(o.roles!==void 0&&(!Array.isArray(o.roles)||o.roles.length>16||o.roles.some(n=>!x(n))))throw new v("config");G(r.params)}}function G(e){if(e!==void 0){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).length>32)throw new v("config");for(const[t,r]of Object.entries(e)){if(!x(t)||["__proto__","constructor","prototype"].includes(t)||!r||typeof r!="object")throw new v("config");if("value"in r)try{V(r.value)}catch{throw new v("config")}else if(!["value","rowKey","query","field"].includes(r.from)||(r.from==="query"||r.from==="field")&&!x(r.field))throw new v("config")}}}function T(e,t,r){const{target:o}=r,n=t.source?.datasetId??t.component.table?.source?.datasetId;return(t.source?.field??t.table?.columnKey)===o.field&&(o.datasetId===void 0||n===o.datasetId)&&(o.reportScope===void 0||e.pages[t.address.pageIndex]?.meta?.reportScope===o.reportScope)&&(o.roles?o.roles.includes(t.table?.role??""):t.table?.role!=="header")}function U(e,t,r){A(r);const o=g.getReportCellContext(e,t);return o?r.filter(n=>T(e,o,n)):[]}function W(e,t,r,o){if("value"in e)return e.value;switch(e.from){case"value":return r.value;case"rowKey":return r.source?.rowKey;case"query":return $(o,e.field);case"field":{const n=r.component.table?.columnKeys.indexOf(e.field)??-1;return n<0?void 0:g.getReportCellContext(t,{...r.address,columnIndex:n})?.value}}}function Z(e,t,r,o={}){A([r]);const n=g.getReportCellContext(e,t);if(!n||!T(e,n,r))throw new v("target");const c=Object.fromEntries(Object.entries(r.params??{}).map(([i,a])=>[i,V(W(a,e,n,o))])),s=Object.entries(o);if(s.length>128||s.some(([i,a])=>!x(i)||typeof a!="string"||a.length>4096))throw new v("config");const d=e.pages[t.pageIndex]?.meta?.reportScope;return Object.freeze({actionId:r.id,params:Object.freeze(c),returnState:Object.freeze({params:Object.freeze(Object.fromEntries(s)),address:Object.freeze({...t}),...typeof d=="string"?{reportScope:d}:{},...n.source?{source:Object.freeze({sourceScope:n.source.sourceScope,datasetId:n.source.datasetId,rowKey:n.source.rowKey,field:n.source.field})}:{}})})}function H(e,t){if(!t.source)return e.pages[t.address.pageIndex]?.meta?.reportScope===t.reportScope&&g.getReportCellContext(e,t.address)?{...t.address}:null;const r=g.createReportCellResolver(e),o=g.reportCellEditKey({address:t.address,source:t.source});for(const[n,c]of e.pages.entries())if(!(t.reportScope!==void 0&&c.meta?.reportScope!==t.reportScope)){for(const[s,d]of c.components.entries())if(d.grid)for(const i of N.resolveGridLayout(d.grid,d.widthMm,d.heightMm).cells){const a={pageIndex:n,componentIndex:s,rowIndex:i.ri,columnIndex:i.ci},u=r(a);if(u?.source&&g.reportCellEditKey(u)===o)return a}}return null}class l extends Error{constructor(t,r){super(r),this.code=t,this.name="ReportDataError"}}function b(e,t,r){const o=e??t;if(!Number.isSafeInteger(o)||o<1||o>r)throw new l("limit","Invalid report data budget");return o}function k(e){if(typeof e=="string"&&e.length>0&&e.length<=2048)return`s:${e}`;if(typeof e=="number"&&Number.isSafeInteger(e))return`n:${Object.is(e,-0)?0:e}`;throw new l("identity","A stable string or safe integer business key is required")}function O(e){if(typeof e.datasetId!="string"||!e.datasetId.trim()||e.datasetId.length>2048)throw new l("identity","A dataset identity is required");if(e.sourceScope!==void 0&&(typeof e.sourceScope!="string"||!e.sourceScope.trim()||e.sourceScope.length>2048))throw new l("identity","Invalid source scope")}function j(e,t=256){if(!Array.isArray(e)||!e.length||e.length>t)throw new l("limit","A bounded explicit field allowlist is required");const r=new Set;for(const o of e){if(typeof o!="string"||!o.trim()||o.length>2048||["__proto__","constructor","prototype"].includes(o))throw new l("identity","Invalid report field");if(r.has(o))throw new l("duplicate","Duplicate report field");r.add(o)}}function C(e,t){const r=Object.getOwnPropertyDescriptor(e.values,t);if(!r)return;if(!("value"in r))throw new l("value","Report values must be plain scalar data");const o=r.value;if(o===null||typeof o=="boolean"||typeof o=="string"||typeof o=="number"&&Number.isFinite(o))return o;throw new l("value","Report values must be finite scalar data")}function J(e){if(!e||typeof e!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(e)))throw new l("value","Report records must be plain data");const t=Object.getOwnPropertyDescriptor(e,"rowKey"),r=Object.getOwnPropertyDescriptor(e,"values");if(!t||!("value"in t)||!r||!("value"in r)||!r.value||typeof r.value!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(r.value)))throw new l("value","Report records require own scalar keys and plain values");return{rowKey:t.value,values:r.value}}function q(e,t,r={}){const o=b(r.maxRows,5e4,1e5),n=b(r.maxCells,1e6,2e6);if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype||e.length>o||e.length*t.length>n)throw new l("limit","Report data exceeds its budget");const c=new Map;for(let s=0;s<e.length;s++){const d=Object.getOwnPropertyDescriptor(e,s);if(!d||!("value"in d))throw new l("value","Sparse or accessor report records are unsupported");const i=J(d.value),a=k(i.rowKey);if(c.has(a))throw new l("duplicate","Duplicate business row key");const u=Object.create(null);for(const p of t){const f=C(i,p);f!==void 0&&(u[p]=f)}c.set(a,{rowKey:i.rowKey,values:u})}return c}function P(e){return e==null||e===""}function F(e,t){return P(e)?t.missing==="zero"?y.parseDecimal(0):void 0:y.parseDecimal(e)}function Q(e){return{coefficient:-e.coefficient,scale:e.scale}}function X(e,t,r,o){const n=F(e,r),c=Object.is(e,t)?n:F(t,r);if(!n||!c)return{equal:L(e,t,r),ratioUnavailable:"missing"};const s=y.addDecimal(c,Q(n)),d={...s,coefficient:s.coefficient<0n?-s.coefficient:s.coefficient},i=y.compareDecimal(d,r.toleranceValue)<=0;return i&&!o?{equal:i}:n.coefficient===0n?{equal:i,delta:y.printDecimal(s),...s.coefficient===0n&&r.zeroDenominator==="zero-if-equal"?{changeRatio:"0"}:{ratioUnavailable:"zero-denominator"}}:{equal:i,delta:y.printDecimal(s),changeRatio:y.printDecimal(y.divideDecimal(s,n,r.ratioDigits??12))}}function L(e,t,r){return r.missing==="empty-equivalent"&&P(e)&&P(t)||Object.is(e,t)}function Y(e){j(e.fields.map(t=>t.field),b(e.maxFields,256,1024));for(const t of e.fields){if(t.type!==void 0&&!["decimal","value"].includes(t.type))throw new l("value","Invalid comparison field type");if(t.missing&&!["distinct","empty-equivalent","zero"].includes(t.missing))throw new l("value","Invalid missing-value policy");if(t.zeroDenominator&&!["omit","zero-if-equal"].includes(t.zeroDenominator))throw new l("value","Invalid zero-denominator policy");if(t.missing==="zero"&&t.type!=="decimal")throw new l("value","Zero missing-value policy requires a decimal field");if(t.tolerance!==void 0&&(t.type!=="decimal"||y.compareDecimal(y.parseDecimal(t.tolerance),y.parseDecimal(0))<0))throw new l("value","Tolerance requires a non-negative decimal");if(t.ratioDigits!==void 0&&(!Number.isInteger(t.ratioDigits)||t.ratioDigits<0||t.ratioDigits>100))throw new l("value","Invalid ratio precision")}return e.fields.map(t=>({...t,toleranceValue:y.parseDecimal(t.tolerance??"0")}))}function M(e,t,r,o,n){let c=!1;for(const s of r){const d=e?C(e,s.field):void 0,i=t?C(t,s.field):void 0,a=s.type==="decimal"?X(d,i,s,!e||!t):{equal:L(d,i,s)};if(e&&t&&a.equal)continue;if(c=!0,o.length>=n)throw new l("limit","Report differences exceed their budget");const{equal:u,...p}=a;o.push({rowKey:(t??e).rowKey,kind:e?t?"changed":"removed":"added",field:s.field,label:s.label??s.field,before:d,after:i,...p})}return c}function ee(e,t,r){O(e),O(t);const o=Y(r);if(e.datasetId!==t.datasetId||e.sourceScope!==t.sourceScope)throw new l("identity","Comparison requires the same business dataset and source scope");const n=r.fields.map(u=>u.field),c=q(e.rows,n,r),s=q(t.rows,n,r),d=b(r.maxDifferences,2e4,1e5),i=[],a={added:0,removed:0,changed:0,unchanged:0,cells:0};for(const[u,p]of c){const f=s.get(u),m=M(p,f,o,i,d);f?m?a.changed++:a.unchanged++:a.removed++}for(const[u,p]of s)c.has(u)||(M(void 0,p,o,i,d),a.added++);return a.cells=i.length,{sourceScope:t.sourceScope,datasetId:t.datasetId,differences:i,counts:a}}function K(e,t){O(t),j(t.fields,b(t.maxFields,256,1024));const r=b(t.maxCells,1e6,2e6),o=new Set(t.fields),n=new Map,c=g.createReportCellResolver(e);let s=0;for(const[d,i]of e.pages.entries())for(const[a,u]of i.components.entries()){if(!u.grid)continue;for(const f of u.grid.cells)if(s+=f.length,s>r)throw new l("limit","Report cell scan exceeds its budget");const p=N.resolveGridLayout(u.grid,u.widthMm,u.heightMm).cells;for(const f of p){const m=c({pageIndex:d,componentIndex:a,rowIndex:f.ri,columnIndex:f.ci}),w=m?.source;if(!m||!w||w.datasetId!==t.datasetId||w.sourceScope!==t.sourceScope||!o.has(w.field))continue;k(w.rowKey);const I=g.reportCellEditKey(m),h=n.get(I);h?(!Object.is(h.context.value,m.value)||h.context.source?.revision!==w.revision||h.context.source?.sourceToken!==w.sourceToken||h.context.editable!==m.editable)&&(h.ambiguous=!0):n.set(I,{context:m,ambiguous:!1})}}return n}function te(e,t){const r=K(e,t),o=new Map,n=b(t.maxRows,5e4,1e5);for(const{context:c,ambiguous:s}of r.values()){if(s)throw new l("conflict","Repeated report cells disagree for the same business field");const d=c.source,i=k(d.rowKey);let a=o.get(i);if(!a){if(o.size>=n)throw new l("limit","Report row extraction exceeds its budget");a={rowKey:d.rowKey,values:Object.create(null)},o.set(i,a)}a.values[d.field]=c.value}return{sourceScope:t.sourceScope,datasetId:t.datasetId,rows:[...o.values()]}}function _(e){return e==null||e===""}function re(e,t,r){if(!t){e.reason="missing-target";return}const{context:o,ambiguous:n}=t;if(e.before=o.value,n){e.status="conflict",e.reason="ambiguous";return}if(!o.editable||r.canEdit?.(o)===!1){e.reason="readonly";return}if(_(e.after)){e.reason="missing-source";return}if(Object.is(o.value,e.after)){e.status="matched",e.reason="unchanged";return}if(r.mode!=="replace"&&!_(o.value)){e.reason="occupied";return}try{const c=g.editFromContext(o,e.after);if(Object.is(c.value,c.previousValue)){e.status="matched",e.reason="unchanged";return}return e.after=c.value,e.status="changed",c}catch{e.status="conflict",e.reason="invalid";return}}function oe(e,t){if(O(t),t.mode!==void 0&&t.mode!=="empty"&&t.mode!=="replace")throw new l("value","Invalid prefill policy");const r=b(t.maxFields,256,1024),o=t.fields.map(f=>f.field),n=[...new Set(t.fields.map(f=>f.sourceField??f.field))];j(o,r),j(n,r);const c=q(t.rows,n,t),s=K(e,{...t,fields:o}),d=b(t.maxChanges,1e4,1e4),i=b(t.maxCells,1e6,2e6);if(c.size*o.length>i)throw new l("limit","Prefill review exceeds its budget");const a=[],u=[],p={matched:0,changed:0,skipped:0,conflict:0};for(const f of c.values())for(const m of t.fields){const w={sourceScope:t.sourceScope,datasetId:t.datasetId,rowKey:f.rowKey,field:m.field},I={source:w,label:m.label??m.field,status:"skipped",after:C(f,m.sourceField??m.field)},h=g.reportCellEditKey({address:{pageIndex:0,componentIndex:0,rowIndex:0,columnIndex:0},source:w}),D=re(I,s.get(h),t);if(D){if(u.length>=d)throw new l("limit","Prefill changes exceed the atomic edit budget");u.push(D)}p[I.status]++,a.push(I)}return{sourceScope:t.sourceScope,datasetId:t.datasetId,items:a,counts:p,edits:u}}function ne(e,t,r){if(t.counts.conflict>0)throw new l("conflict","Resolve prefill conflicts before applying");if(t.edits.length>1e4)throw new l("limit","Prefill changes exceed the atomic edit budget");if(!t.edits.length)return[];const o=[...new Set(t.edits.map(s=>s.source.field))],n=K(e,{sourceScope:t.sourceScope,datasetId:t.datasetId,fields:o}),c=new Set;return t.edits.map(s=>{if(!s.source||s.source.datasetId!==t.datasetId||s.source.sourceScope!==t.sourceScope)throw new l("identity","Prefill identity changed");const d=g.reportCellEditKey(s),i=n.get(d);if(c.has(d))throw new l("duplicate","Duplicate prefill target");if(c.add(d),!i||i.ambiguous||g.sourceChanged(i.context,s)||!Object.is(i.context.value,s.previousValue))throw new l("conflict","Prefill target changed; reload the preview");if(!i.context.editable||r?.(i.context)===!1)throw new l("conflict","Prefill target is read-only");return{address:{...i.context.address},value:g.editFromContext(i.context,s.value).value}})}exports.ReportDataError=l;exports.ReportDrillError=v;exports.compareReportData=ee;exports.createPageWindowIndex=B;exports.createReportDrillRequest=Z;exports.createReportPrefill=oe;exports.dataLimit=b;exports.indexReportDataCells=K;exports.matchReportDrillActions=U;exports.reportDataSnapshotFromPlan=te;exports.reportPrefillInputs=ne;exports.resolveReportDrillReturn=H;exports.validateReportDrillActions=A;
@@ -1,4 +1,4 @@
1
- import { R as i, v as u, s as p } from "./json-snapshot-OqkPyUk5.js";
1
+ import { R as i, v as u, s as p } from "./json-snapshot-BRnzKudk.js";
2
2
  import { R as d, b as y, t as c, p as l } from "./sha256-BDQ1Qk7A.js";
3
3
  import { s as g, a as m } from "./workbook-sheets-D4M7XXBh.js";
4
4
  function P(e) {
@@ -1 +1 @@
1
- "use strict";const n=require("./json-snapshot-1tvQNzQE.cjs"),a=require("./sha256-DgZAKXqI.cjs"),f=require("./workbook-sheets-CaPAulQ6.cjs");function g(e){return e&&{...e,sheetNames:f.snapshotSheetNames(e.sheetNames),additionalSheets:f.snapshotAdditionalSheets(e.additionalSheets)}}function w(e,t){if(e.format!=="xlsx")return;const r=e.xlsx?.additionalSheets?.reduce((o,i)=>o+i.rows.reduce((s,d)=>s+d.length,0),0)??0;a.assertBudget(t,"maxCells",e.prepared.stats.cells+r)}function m(e){if(!e)return;const t=r=>{if(!(r instanceof Uint8Array)&&!(r instanceof ArrayBuffer))throw new n.ReportSourceError("validate","字体应为 Uint8Array 或 ArrayBuffer");if(r.byteLength>32e6)throw new a.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return new Uint8Array(r instanceof Uint8Array?r:new Uint8Array(r))};if(e.customFontFaces){const r=e.customFontFaces;return{customFontName:e.customFontName,customFontFaces:{regular:t(r.regular),...r.bold?{bold:t(r.bold)}:{},...r.italic?{italic:t(r.italic)}:{},...r.boldItalic?{boldItalic:t(r.boldItalic)}:{}}}}return{customFontName:e.customFontName,...e.customFontBytes?{customFontBytes:t(e.customFontBytes)}:{}}}function u(e){const t=e?.customFontFaces??(e?.customFontBytes?{regular:e.customFontBytes}:void 0);if(!t)return;const r=["regular","bold","italic","boldItalic"].map(o=>{const i=t[o];if(!i)return[o,null];const s=i instanceof Uint8Array?i:new Uint8Array(i);if(s.byteLength>32e6)throw new a.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return[o,a.portableSha256Hex(s)]});return a.portableSha256Hex(new TextEncoder().encode(JSON.stringify(r)))}const c=new WeakMap;function h(e,t,r){const o=l(e,t,r);let i=!0;return{prepared:o,forward(){if(!i)throw new Error("报表快照只能交接一次");return i=!1,c.set(o,t),o}}}function l(e,t,r){if(a.throwIfAborted(r),!Number.isSafeInteger(t)||t<=0)throw new a.ReportRuntimeError("budget","快照预算应为正安全整数","$.budget.maxPreparedBytes");const o=c.get(e);if(c.delete(e),o!==void 0&&o<=t)return e;const i=n.snapshotReportJson(e,{maxBytes:t,maxNodes:t,check:()=>a.throwIfAborted(r),error:(s,d)=>s==="budget"?new a.ReportRuntimeError("budget",d,"$.budget.maxPreparedBytes"):new n.ReportSourceError("validate",d)});return y(i),i}function p(e){if(e===void 0)return!0;if(!Array.isArray(e))return!1;const t=new Set;return e.every(r=>!r||typeof r!="object"||Array.isArray(r)||typeof r.reportId!="string"||!r.reportId.trim()||!Number.isSafeInteger(r.reportIndex)||r.reportIndex<0||t.has(r.reportIndex)||typeof r.reportScope!="string"||!r.reportScope.trim()||r.reportScope.length>4096||r.revision!==void 0&&typeof r.revision!="string"||r.sourceToken!==void 0&&typeof r.sourceToken!="string"?!1:(t.add(r.reportIndex),!0))}function y(e){if(!p(e.sources))throw new n.ReportSourceError("validate","准备结果来源清单无效");if(!e?.stats||["rows","pages","cells"].some(t=>!Number.isSafeInteger(e.stats[t])||e.stats[t]<0)||!Number.isFinite(e.stats.durationMs)||e.stats.durationMs<0)throw new n.ReportSourceError("validate","准备结果统计无效");if(!Array.isArray(e.diagnostics)||e.diagnostics.some(t=>!t||typeof t.code!="string"||typeof t.message!="string"||!["info","warning","error"].includes(t.severity)||!n.hasValidDataExplanation(t)))throw new n.ReportSourceError("validate","准备结果诊断无效");if(!e.revisions||typeof e.revisions!="object"||Array.isArray(e.revisions)||Object.values(e.revisions).some(t=>!t||typeof t!="object"||t.revision!==void 0&&typeof t.revision!="string"||t.sourceToken!==void 0&&typeof t.sourceToken!="string"))throw new n.ReportSourceError("validate","准备结果修订无效");if(e.layout&&(!["heuristic","provided","font-bytes"].includes(e.layout.textMetrics)||e.layout.fontFingerprint!==void 0&&!/^[a-f0-9]{64}$/.test(e.layout.fontFingerprint)))throw new n.ReportSourceError("validate","准备结果字体度量标识无效")}function v(e){if(e.layoutPolicy!==void 0&&!["verify","preserve"].includes(e.layoutPolicy))throw new n.ReportSourceError("validate","无效的 layoutPolicy");if(e.format!=="pdf")return;if(e.layoutPolicy==="preserve"&&!e.prepared.layout?.fontFingerprint){e.prepared.diagnostics.push({code:"prepared-layout-preserved",severity:"info",message:"显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。"});return}const t=e.prepared.layout?.fontFingerprint,r=u(e.pdf);if(t===r&&(t!==void 0||e.prepared.layout?.textMetrics==="heuristic"&&!r))return;const o="已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";if(e.fidelity==="strict")throw new n.ReportSourceError("validate",o);e.prepared.diagnostics.push({code:"prepared-font-metrics",severity:"warning",message:o})}exports.assertPreparedOutputBudget=w;exports.capturePreparedHandoff=h;exports.checkPreparedFont=v;exports.reportFontFingerprint=u;exports.snapshotPdfFonts=m;exports.snapshotPreparedReport=l;exports.snapshotXlsxOptions=g;exports.validPreparedSources=p;exports.validatePreparedMetadata=y;
1
+ "use strict";const n=require("./json-snapshot-DNiIbpOr.cjs"),a=require("./sha256-DgZAKXqI.cjs"),f=require("./workbook-sheets-CaPAulQ6.cjs");function g(e){return e&&{...e,sheetNames:f.snapshotSheetNames(e.sheetNames),additionalSheets:f.snapshotAdditionalSheets(e.additionalSheets)}}function w(e,t){if(e.format!=="xlsx")return;const r=e.xlsx?.additionalSheets?.reduce((o,i)=>o+i.rows.reduce((s,d)=>s+d.length,0),0)??0;a.assertBudget(t,"maxCells",e.prepared.stats.cells+r)}function m(e){if(!e)return;const t=r=>{if(!(r instanceof Uint8Array)&&!(r instanceof ArrayBuffer))throw new n.ReportSourceError("validate","字体应为 Uint8Array 或 ArrayBuffer");if(r.byteLength>32e6)throw new a.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return new Uint8Array(r instanceof Uint8Array?r:new Uint8Array(r))};if(e.customFontFaces){const r=e.customFontFaces;return{customFontName:e.customFontName,customFontFaces:{regular:t(r.regular),...r.bold?{bold:t(r.bold)}:{},...r.italic?{italic:t(r.italic)}:{},...r.boldItalic?{boldItalic:t(r.boldItalic)}:{}}}}return{customFontName:e.customFontName,...e.customFontBytes?{customFontBytes:t(e.customFontBytes)}:{}}}function u(e){const t=e?.customFontFaces??(e?.customFontBytes?{regular:e.customFontBytes}:void 0);if(!t)return;const r=["regular","bold","italic","boldItalic"].map(o=>{const i=t[o];if(!i)return[o,null];const s=i instanceof Uint8Array?i:new Uint8Array(i);if(s.byteLength>32e6)throw new a.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return[o,a.portableSha256Hex(s)]});return a.portableSha256Hex(new TextEncoder().encode(JSON.stringify(r)))}const c=new WeakMap;function h(e,t,r){const o=l(e,t,r);let i=!0;return{prepared:o,forward(){if(!i)throw new Error("报表快照只能交接一次");return i=!1,c.set(o,t),o}}}function l(e,t,r){if(a.throwIfAborted(r),!Number.isSafeInteger(t)||t<=0)throw new a.ReportRuntimeError("budget","快照预算应为正安全整数","$.budget.maxPreparedBytes");const o=c.get(e);if(c.delete(e),o!==void 0&&o<=t)return e;const i=n.snapshotReportJson(e,{maxBytes:t,maxNodes:t,check:()=>a.throwIfAborted(r),error:(s,d)=>s==="budget"?new a.ReportRuntimeError("budget",d,"$.budget.maxPreparedBytes"):new n.ReportSourceError("validate",d)});return y(i),i}function p(e){if(e===void 0)return!0;if(!Array.isArray(e))return!1;const t=new Set;return e.every(r=>!r||typeof r!="object"||Array.isArray(r)||typeof r.reportId!="string"||!r.reportId.trim()||!Number.isSafeInteger(r.reportIndex)||r.reportIndex<0||t.has(r.reportIndex)||typeof r.reportScope!="string"||!r.reportScope.trim()||r.reportScope.length>4096||r.revision!==void 0&&typeof r.revision!="string"||r.sourceToken!==void 0&&typeof r.sourceToken!="string"?!1:(t.add(r.reportIndex),!0))}function y(e){if(!p(e.sources))throw new n.ReportSourceError("validate","准备结果来源清单无效");if(!e?.stats||["rows","pages","cells"].some(t=>!Number.isSafeInteger(e.stats[t])||e.stats[t]<0)||!Number.isFinite(e.stats.durationMs)||e.stats.durationMs<0)throw new n.ReportSourceError("validate","准备结果统计无效");if(!Array.isArray(e.diagnostics)||e.diagnostics.some(t=>!t||typeof t.code!="string"||typeof t.message!="string"||!["info","warning","error"].includes(t.severity)||!n.hasValidDataExplanation(t)))throw new n.ReportSourceError("validate","准备结果诊断无效");if(!e.revisions||typeof e.revisions!="object"||Array.isArray(e.revisions)||Object.values(e.revisions).some(t=>!t||typeof t!="object"||t.revision!==void 0&&typeof t.revision!="string"||t.sourceToken!==void 0&&typeof t.sourceToken!="string"))throw new n.ReportSourceError("validate","准备结果修订无效");if(e.layout&&(!["heuristic","provided","font-bytes"].includes(e.layout.textMetrics)||e.layout.fontFingerprint!==void 0&&!/^[a-f0-9]{64}$/.test(e.layout.fontFingerprint)))throw new n.ReportSourceError("validate","准备结果字体度量标识无效")}function v(e){if(e.layoutPolicy!==void 0&&!["verify","preserve"].includes(e.layoutPolicy))throw new n.ReportSourceError("validate","无效的 layoutPolicy");if(e.format!=="pdf")return;if(e.layoutPolicy==="preserve"&&!e.prepared.layout?.fontFingerprint){e.prepared.diagnostics.push({code:"prepared-layout-preserved",severity:"info",message:"显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。"});return}const t=e.prepared.layout?.fontFingerprint,r=u(e.pdf);if(t===r&&(t!==void 0||e.prepared.layout?.textMetrics==="heuristic"&&!r))return;const o="已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";if(e.fidelity==="strict")throw new n.ReportSourceError("validate",o);e.prepared.diagnostics.push({code:"prepared-font-metrics",severity:"warning",message:o})}exports.assertPreparedOutputBudget=w;exports.capturePreparedHandoff=h;exports.checkPreparedFont=v;exports.reportFontFingerprint=u;exports.snapshotPdfFonts=m;exports.snapshotPreparedReport=l;exports.snapshotXlsxOptions=g;exports.validPreparedSources=p;exports.validatePreparedMetadata=y;
@@ -1,5 +1,5 @@
1
- import { d as f } from "./prepared-DCIxhKFo.js";
2
- import { v as a } from "./json-snapshot-OqkPyUk5.js";
1
+ import { d as f } from "./prepared-CJy_qk7d.js";
2
+ import { v as a } from "./json-snapshot-BRnzKudk.js";
3
3
  import { b as p } from "./template-registry-O0hNIOfB.js";
4
4
  const i = "mach-report-worker/1";
5
5
  class I extends Error {
@@ -1 +1 @@
1
- "use strict";const f=require("./prepared-Dv-XM3i1.cjs"),c=require("./json-snapshot-1tvQNzQE.cjs"),a=require("./template-registry-DI59PXVK.cjs"),i="mach-report-worker/1";class d extends Error{constructor(t){super(t.message),this.name=t.name,this.code=t.code,this.path=t.path,this.issues=t.issues,this.diagnostics=t.diagnostics}}function o(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function y(r){return o(r)?["rows","pages","cells"].every(t=>typeof r[t]=="number"&&Number.isSafeInteger(r[t])&&r[t]>=0)&&typeof r.durationMs=="number"&&Number.isFinite(r.durationMs)&&r.durationMs>=0:!1}function g(r){return Array.isArray(r)&&r.every(t=>o(t)&&typeof t.code=="string"&&typeof t.message=="string"&&["info","warning","error"].includes(t.severity)&&c.hasValidDataExplanation(t))}function m(r){return o(r)&&Object.values(r).every(t=>o(t)&&(t.revision===void 0||typeof t.revision=="string")&&(t.sourceToken===void 0||typeof t.sourceToken=="string"))}function u(r){return r===void 0?!0:o(r)&&["heuristic","provided","font-bytes"].includes(r.textMetrics)&&(r.fontFingerprint===void 0||typeof r.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(r.fontFingerprint))}function R(r,t){if(!o(r)||!y(r.stats)||!g(r.diagnostics)||!m(r.revisions)||!u(r.layout)||!f.validPreparedSources(r.sources))return!1;if(t==="prepare")return a.validateRenderPlan(r.plan).ok;const e=r.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return r.bytes instanceof Uint8Array&&(r.format==="pdf"||r.format==="xlsx")&&r.contentType===e}function n(r){if(!r||typeof r!="object")return{message:String(r)};const t={};for(const e of["code","path","field","message"]){const s=r[e];typeof s=="string"&&(t[e]=s)}return t}function k(r){const t=n(r);if(!o(r))return t;for(const e of["format","severity","kind","nid"])typeof r[e]=="string"&&(t[e]=r[e]);for(const e of["pageIndex","componentIndex"])Number.isSafeInteger(r[e])&&r[e]>=0&&(t[e]=r[e]);return Array.isArray(r.componentPath)&&r.componentPath.every(e=>Number.isSafeInteger(e)&&e>=0)&&(t.componentPath=r.componentPath),t}function p(r){if(!(r instanceof Error))return{name:"Error",message:String(r)};const t=r;return{name:r.name,message:r.message,...typeof t.code=="string"?{code:t.code}:{},...typeof t.path=="string"?{path:t.path}:{},...Array.isArray(t.issues)?{issues:t.issues.map(n)}:{},...Array.isArray(t.diagnostics)?{diagnostics:t.diagnostics.map(k)}:{}}}function h(r){if(!r||typeof r!="object")return!1;const t=r;return t.protocol===i&&typeof t.id=="string"&&(t.operation==="prepare"||t.operation==="export"||t.operation==="exportPrepared")&&!!t.input&&typeof t.input=="object"}async function b(r,t,e){try{const s=t.operation==="prepare"?await r.prepare({...t.input,onEvent:e}):t.operation==="exportPrepared"?await r.exportPrepared({...t.input,onEvent:e}):await r.export({...t.input,onEvent:e});return{protocol:i,id:t.id,result:s}}catch(s){return{protocol:i,id:t.id,error:p(s)}}}function I(r){const t=r.result;return!t||!("bytes"in t)||!(t.bytes.buffer instanceof ArrayBuffer)?[]:[t.bytes.buffer]}function W(r,t){if(!o(r)||typeof r.taskId!="string"||!r.taskId||t.taskId!==void 0&&r.taskId!==t.taskId||r.correlationId!==t.correlationId||r.reportId!==void 0&&(typeof r.reportId!="string"||!("reportIds"in t&&t.reportIds.includes(r.reportId)))||!["query","validate","layout","assets","encode"].includes(r.stage)||!["started","completed","failed"].includes(r.status))return!1;for(const e of["completed","total"])if(r[e]!==void 0&&(typeof r[e]!="number"||!Number.isFinite(r[e])||r[e]<0))return!1;return r.completed===void 0||r.total===void 0||r.completed<=r.total}exports.REPORT_WORKER_PROTOCOL=i;exports.ReportWorkerError=d;exports.isReportWorkerRequest=h;exports.reportWorkerTransferList=I;exports.runReportWorkerRequest=b;exports.serializeError=p;exports.validReportWorkerEvent=W;exports.validReportWorkerResult=R;
1
+ "use strict";const f=require("./prepared-D0yCSxSO.cjs"),c=require("./json-snapshot-DNiIbpOr.cjs"),a=require("./template-registry-DI59PXVK.cjs"),i="mach-report-worker/1";class d extends Error{constructor(t){super(t.message),this.name=t.name,this.code=t.code,this.path=t.path,this.issues=t.issues,this.diagnostics=t.diagnostics}}function o(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function y(r){return o(r)?["rows","pages","cells"].every(t=>typeof r[t]=="number"&&Number.isSafeInteger(r[t])&&r[t]>=0)&&typeof r.durationMs=="number"&&Number.isFinite(r.durationMs)&&r.durationMs>=0:!1}function g(r){return Array.isArray(r)&&r.every(t=>o(t)&&typeof t.code=="string"&&typeof t.message=="string"&&["info","warning","error"].includes(t.severity)&&c.hasValidDataExplanation(t))}function m(r){return o(r)&&Object.values(r).every(t=>o(t)&&(t.revision===void 0||typeof t.revision=="string")&&(t.sourceToken===void 0||typeof t.sourceToken=="string"))}function u(r){return r===void 0?!0:o(r)&&["heuristic","provided","font-bytes"].includes(r.textMetrics)&&(r.fontFingerprint===void 0||typeof r.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(r.fontFingerprint))}function R(r,t){if(!o(r)||!y(r.stats)||!g(r.diagnostics)||!m(r.revisions)||!u(r.layout)||!f.validPreparedSources(r.sources))return!1;if(t==="prepare")return a.validateRenderPlan(r.plan).ok;const e=r.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return r.bytes instanceof Uint8Array&&(r.format==="pdf"||r.format==="xlsx")&&r.contentType===e}function n(r){if(!r||typeof r!="object")return{message:String(r)};const t={};for(const e of["code","path","field","message"]){const s=r[e];typeof s=="string"&&(t[e]=s)}return t}function k(r){const t=n(r);if(!o(r))return t;for(const e of["format","severity","kind","nid"])typeof r[e]=="string"&&(t[e]=r[e]);for(const e of["pageIndex","componentIndex"])Number.isSafeInteger(r[e])&&r[e]>=0&&(t[e]=r[e]);return Array.isArray(r.componentPath)&&r.componentPath.every(e=>Number.isSafeInteger(e)&&e>=0)&&(t.componentPath=r.componentPath),t}function p(r){if(!(r instanceof Error))return{name:"Error",message:String(r)};const t=r;return{name:r.name,message:r.message,...typeof t.code=="string"?{code:t.code}:{},...typeof t.path=="string"?{path:t.path}:{},...Array.isArray(t.issues)?{issues:t.issues.map(n)}:{},...Array.isArray(t.diagnostics)?{diagnostics:t.diagnostics.map(k)}:{}}}function h(r){if(!r||typeof r!="object")return!1;const t=r;return t.protocol===i&&typeof t.id=="string"&&(t.operation==="prepare"||t.operation==="export"||t.operation==="exportPrepared")&&!!t.input&&typeof t.input=="object"}async function b(r,t,e){try{const s=t.operation==="prepare"?await r.prepare({...t.input,onEvent:e}):t.operation==="exportPrepared"?await r.exportPrepared({...t.input,onEvent:e}):await r.export({...t.input,onEvent:e});return{protocol:i,id:t.id,result:s}}catch(s){return{protocol:i,id:t.id,error:p(s)}}}function I(r){const t=r.result;return!t||!("bytes"in t)||!(t.bytes.buffer instanceof ArrayBuffer)?[]:[t.bytes.buffer]}function W(r,t){if(!o(r)||typeof r.taskId!="string"||!r.taskId||t.taskId!==void 0&&r.taskId!==t.taskId||r.correlationId!==t.correlationId||r.reportId!==void 0&&(typeof r.reportId!="string"||!("reportIds"in t&&t.reportIds.includes(r.reportId)))||!["query","validate","layout","assets","encode"].includes(r.stage)||!["started","completed","failed"].includes(r.status))return!1;for(const e of["completed","total"])if(r[e]!==void 0&&(typeof r[e]!="number"||!Number.isFinite(r[e])||r[e]<0))return!1;return r.completed===void 0||r.total===void 0||r.completed<=r.total}exports.REPORT_WORKER_PROTOCOL=i;exports.ReportWorkerError=d;exports.isReportWorkerRequest=h;exports.reportWorkerTransferList=I;exports.runReportWorkerRequest=b;exports.serializeError=p;exports.validReportWorkerEvent=W;exports.validReportWorkerResult=R;
@@ -1 +1 @@
1
- "use strict";const e=require("./encoding-BefcaHdp.cjs");e.serveReportEncodingWorker();
1
+ "use strict";const e=require("./encoding-7lquyj0w.cjs");e.serveReportEncodingWorker();
@@ -1,2 +1,2 @@
1
- import { s as r } from "./encoding-CL6rXEkR.js";
1
+ import { s as r } from "./encoding-CEd-dq9A.js";
2
2
  r();
@@ -1 +1 @@
1
- "use strict";var V=Object.create;var M=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var W=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!z.call(e,s)&&s!==a&&M(e,s,{get:()=>t[s],enumerable:!(n=N(t,s))||n.enumerable});return e};var B=(e,t,a)=>(a=e!=null?V(X(e)):{},W(t||!e||!e.__esModule?M(a,"default",{value:e,enumerable:!0}):a,e));const c=require("./json-snapshot-1tvQNzQE.cjs"),F=require("./report-params-VTg8MoCp.cjs"),k=require("./param-validation-C-8sRJLq.cjs"),o=require("./sha256-DgZAKXqI.cjs"),G=require("./template-registry-DI59PXVK.cjs"),Q=require("./template-serialization-CqQY4zDg.cjs"),$=require("./assets-D2gHc4Mz.cjs"),y=require("./prepared-Dv-XM3i1.cjs"),T=require("./record-bindings-MBxbeBsi.cjs");function I(e=[]){return e.map(({code:t,message:a,severity:n,pageIndex:s,componentIndex:r})=>({code:t,message:a,severity:n,path:r<0?`$.pages.${s}`:`$.pages.${s}.components.${r}`}))}async function q(e,t,a=Date.now()){const n=e.prepared;if(y.assertPreparedOutputBudget(e,t),e.fidelity==="strict"&&n.diagnostics.some(w=>w.code==="asset-render-failed"||w.code==="asset-budget-exceeded"))throw new c.ReportSourceError("validate","严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");const s=e.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;o.throwIfAborted(e.signal);const r=e.pdf?.customFontFaces??(e.pdf?.customFontBytes?{regular:e.pdf.customFontBytes}:void 0),m=s&&r?s.createFontBytesMeasurer(r):void 0,g=c.createReportTaskReporter(e),u=await g.run("encode",async()=>{let w;if(e.format==="pdf"){o.throwIfAborted(e.signal);const d=await s.renderPlanToPdf(n.plan,{...e.pdf,...m?{measurer:m}:{},fidelity:e.fidelity,signal:e.signal,onProgress:(f,p)=>g.progress("encode",f,p)});w=d.bytes,n.diagnostics.push(...I(d.diagnostics)),n.diagnostics.push(...d.fidelityWarnings.map(f=>({code:"pdf-fidelity",message:f,severity:"warning"})),...d.pageErrors.map(f=>({code:"pdf-page",message:f,severity:"error"}))),d.unsupportedTextCount&&n.diagnostics.push({code:"pdf-font",message:`${d.unsupportedTextCount} 段文本包含当前字体不支持的字符`,severity:"warning"})}else{const{renderPlanToXlsx:d}=await import("@agile-team/mach-report/xlsx");o.throwIfAborted(e.signal);const f=await d(n.plan,{...e.xlsx,fidelity:e.fidelity,signal:e.signal,onProgress:(p,v)=>g.progress("encode",p,v)});w=new Uint8Array(f.buffer),n.diagnostics.push(...I(f.diagnostics)),n.diagnostics.push(...f.warnings.map(p=>({code:"xlsx-fidelity",message:p,severity:"warning"}))),n.diagnostics.push(...(f.notes??[]).map(p=>({code:"xlsx-snapshot",message:p,severity:"info"})))}return o.throwIfAborted(e.signal),w});o.assertBudget(t,"maxOutputBytes",u.byteLength);const{plan:i,...h}=n;return{...h,bytes:u,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...h.stats,durationMs:Date.now()-a,outputBytes:u.byteLength}}}function L(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function j(e,t){if(t.length===0)throw new c.ReportSourceError("config","缺少报表 ID");return t.map(a=>{if(!Object.prototype.hasOwnProperty.call(e,a))throw new c.ReportSourceError("config",`未注册报表 ${a}`);return e[a]})}function S(e){return e.grid?.cells.reduce((t,a)=>t+a.reduce((n,s)=>n+(s?1+(s.children?.reduce((r,m)=>r+S(m),0)??0):0),0),0)??0}function H(e,t,a){return e.pages.reduce((n,s)=>n+s.components.reduce((r,m)=>m.kind!=="list"?r+S(m):r+c.estimateListLayoutCells(m,t,a),0),0)}function K(e,t=Object.keys(e)){return j(e,t).map((a,n)=>{const s=t[n],r=F.getReportParamDefs(e,[s]);return{id:s,params:JSON.parse(JSON.stringify(r)),paramsSchema:k.reportParamsJsonSchema(r),datasetsSchema:Object.fromEntries(Object.entries(a.dataSchema??{}).map(([m,g])=>[m,c.templateDatasetJsonSchema(typeof a.template=="function"?void 0:a.template,m,g)])),capabilities:{save:!!a.provider?.save,export:!!a.provider?.export,templates:!!a.provider?.templates}}})}function _(e,t){j(e,t.reportIds);const a=k.validateReportParams(F.getReportParamDefs(e,t.reportIds),t.params),n=t.reportIds.flatMap(r=>k.validateReportParams(F.getReportParamDefs(e,[r]),t.params).issues),s=new Map(n.map(r=>[JSON.stringify(r),r]));return{...a,ok:s.size===0,issues:[...s.values()]}}function O(e,t){const a=G.validateRenderPlan(e.plan);if(!a.ok)throw new c.ReportSourceError("validate",`执行器返回无效计划:${a.errors[0]?.path}`);const n=e.plan.pages.length,s=e.plan.pages.reduce((r,m)=>r+m.components.reduce((g,u)=>g+S(u),0),0);return o.assertBudget(t,"maxRows",e.stats.rows),o.assertBudget(t,"maxPages",n),o.assertBudget(t,"maxCells",s),{...e,stats:{...e.stats,pages:n,cells:s}}}function A(e,t){const a=_(e.reports,t);if(!a.ok)throw new k.ReportParamValidationError(a.issues)}function Y(e){const t={...o.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};o.validateBudget(t);const a=async(s,r)=>{const m=Date.now();let g=0,u=0;const i=[],h={},w=[],d=Object.fromEntries(Object.entries(e.reports).map(([l,x])=>[l,{...x,pagination:{...e.pagination,...x.pagination,...r?{measurer:r}:{}},dataValidation:{...x.dataValidation,maxRows:Math.min(t.maxRows??1e5,x.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,x.dataValidation?.maxCells??1/0)}}])),p=await c.createReportSource(d,{maxPages:t.maxPages,maxCells:t.maxCells,maxChartComponents:t.maxChartComponents,onDatasets:(l,x,R)=>{try{g+=c.templateDatasetRowCount(R,x,{maxRows:t.maxRows,signal:s.signal})}catch(b){throw b instanceof Q.TreeRowLimitError?new o.ReportRuntimeError("budget",b.message,"$.budget.maxRows"):b}o.assertBudget(t,"maxRows",g),u+=H(R,x,d[l]?.pagination),o.assertBudget(t,"maxCells",u)}})({...s,params:s.params??{},onWarning:l=>i.push({code:"layout",message:l,severity:"warning"}),onQueryResult:(l,x,R=0)=>{const b=c.reportOccurrenceScope(R,l);Object.defineProperty(h,l,{value:{revision:x.revision,sourceToken:x.sourceToken},enumerable:!0,writable:!0}),w.push({reportId:l,reportIndex:R,reportScope:b,...x.revision===void 0?{}:{revision:x.revision},...x.sourceToken===void 0?{}:{sourceToken:x.sourceToken}}),i.push(...(x.diagnostics??[]).map(P=>({...P,...P.target?{target:{...P.target,reportScope:b,...P.target.tableId?{tableId:JSON.stringify([R,l,P.target.tableId])}:{}}}:{}})))}}).catch(l=>{throw l instanceof c.ReportSourceError&&l.cause instanceof T.PaginatePageLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxPages"):l instanceof c.ReportSourceError&&l.cause instanceof T.PaginateCellLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxCells"):l instanceof c.ReportSourceError&&l.cause instanceof T.PaginateChartComponentLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxChartComponents"):l});o.throwIfAborted(s.signal);const v=e.assets?await c.createReportTaskReporter(s).run("assets",()=>$.resolvePlanAssets(p,{...e.assets,signal:s.signal})):{plan:p,diagnostics:[]},E=v.plan;i.push(...I(v.diagnostics));const D=E.pages.reduce((l,x)=>l+x.components.reduce((R,b)=>R+S(b),0),0);o.assertBudget(t,"maxPages",E.pages.length),o.assertBudget(t,"maxCells",D);const C=y.reportFontFingerprint(s.pdf),J=e.pagination?.measurer||Object.values(e.reports).some(l=>l.pagination?.measurer);return{plan:E,diagnostics:i,revisions:h,sources:w,layout:{textMetrics:C?"font-bytes":J?"provided":"heuristic",...C?{fontFingerprint:C}:{}},stats:{rows:g,pages:E.pages.length,cells:D,durationMs:Date.now()-m}}},n=async s=>{const r=Date.now();if(s.format!=="pdf"&&s.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const m=s.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;o.throwIfAborted(s.signal);const g=s.pdf?.customFontFaces??(s.pdf?.customFontBytes?{regular:s.pdf.customFontBytes}:void 0),u=m&&g?m.createFontBytesMeasurer(g):void 0,i=await a(s,u);return o.throwIfAborted(s.signal),q({...s,prepared:i},t,r)};return{describe:s=>K(e.reports,s),validate:s=>_(e.reports,s),prepare:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:m,onEvent:g,...u}=L(s),i={...u,...u.pdf?{pdf:y.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??c.reportTaskId()},h=g?v=>c.notifyReportTaskEvent(g,v,r):void 0,w={...i,signal:r,onEvent:h};c.createReportTaskReporter(w).runSync("validate",()=>A(e,i));let d;const f=i.pdf?.customFontFaces??(i.pdf?.customFontBytes?{regular:i.pdf.customFontBytes}:void 0);if(!e.executor&&f){const v=await import("@agile-team/mach-report/pdf");o.throwIfAborted(r),d=v.createFontBytesMeasurer(f)}const p=e.executor?await e.executor.prepare(i,r,h):await a(w,d);return O(p,t)}),exportPrepared:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const m=Date.now(),{signal:g,onEvent:u,...i}=s,h=O(y.snapshotPreparedReport(s.prepared,t.maxPreparedBytes??64e6,r),t),w={...i,xlsx:y.snapshotXlsxOptions(i.xlsx),prepared:h,...i.pdf?{pdf:y.snapshotPdfFonts(i.pdf)}:{},taskId:i.taskId??c.reportTaskId()};if(w.format!=="pdf"&&w.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const d=u?p=>c.notifyReportTaskEvent(u,p,r):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new c.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const p=await e.executor.exportPrepared(w,r,d);return o.assertBudget(t,"maxRows",p.stats.rows),o.assertBudget(t,"maxPages",p.stats.pages),o.assertBudget(t,"maxCells",p.stats.cells),o.assertBudget(t,"maxOutputBytes",p.bytes.byteLength),{...p,stats:{...p.stats,outputBytes:p.bytes.byteLength}}}const f={...w,signal:r,onEvent:d};if(c.createReportTaskReporter(f).runSync("validate",()=>y.checkPreparedFont(f)),e.assets){const p=await c.createReportTaskReporter(f).run("assets",()=>$.resolvePlanAssets(h.plan,{...e.assets,signal:r}));h.plan=p.plan,h.diagnostics.push(...I(p.diagnostics))}return q(f,t,m)}),export:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:m,onEvent:g,...u}=L(s),i={...u,xlsx:y.snapshotXlsxOptions(u.xlsx),...u.pdf?{pdf:y.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??c.reportTaskId()},h=g?f=>c.notifyReportTaskEvent(g,f,r):void 0,w={...i,signal:r,onEvent:h};if(c.createReportTaskReporter(w).runSync("validate",()=>A(e,i)),i.format!=="pdf"&&i.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const d=e.executor?await e.executor.export(i,r,h):await n(w);return o.assertBudget(t,"maxRows",d.stats.rows),o.assertBudget(t,"maxPages",d.stats.pages),o.assertBudget(t,"maxCells",d.stats.cells),o.assertBudget(t,"maxOutputBytes",d.bytes.byteLength),{...d,stats:{...d.stats,outputBytes:d.bytes.byteLength}}})}}exports.createReportRuntime=Y;exports.enforcePrepared=O;
1
+ "use strict";var V=Object.create;var M=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var W=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!z.call(e,s)&&s!==a&&M(e,s,{get:()=>t[s],enumerable:!(n=N(t,s))||n.enumerable});return e};var B=(e,t,a)=>(a=e!=null?V(X(e)):{},W(t||!e||!e.__esModule?M(a,"default",{value:e,enumerable:!0}):a,e));const c=require("./json-snapshot-DNiIbpOr.cjs"),F=require("./report-params-VTg8MoCp.cjs"),k=require("./param-validation-C-8sRJLq.cjs"),o=require("./sha256-DgZAKXqI.cjs"),G=require("./template-registry-DI59PXVK.cjs"),Q=require("./template-serialization-CqQY4zDg.cjs"),$=require("./assets-D2gHc4Mz.cjs"),y=require("./prepared-D0yCSxSO.cjs"),T=require("./record-bindings-MBxbeBsi.cjs");function I(e=[]){return e.map(({code:t,message:a,severity:n,pageIndex:s,componentIndex:r})=>({code:t,message:a,severity:n,path:r<0?`$.pages.${s}`:`$.pages.${s}.components.${r}`}))}async function q(e,t,a=Date.now()){const n=e.prepared;if(y.assertPreparedOutputBudget(e,t),e.fidelity==="strict"&&n.diagnostics.some(w=>w.code==="asset-render-failed"||w.code==="asset-budget-exceeded"))throw new c.ReportSourceError("validate","严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");const s=e.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;o.throwIfAborted(e.signal);const r=e.pdf?.customFontFaces??(e.pdf?.customFontBytes?{regular:e.pdf.customFontBytes}:void 0),m=s&&r?s.createFontBytesMeasurer(r):void 0,g=c.createReportTaskReporter(e),u=await g.run("encode",async()=>{let w;if(e.format==="pdf"){o.throwIfAborted(e.signal);const d=await s.renderPlanToPdf(n.plan,{...e.pdf,...m?{measurer:m}:{},fidelity:e.fidelity,signal:e.signal,onProgress:(f,p)=>g.progress("encode",f,p)});w=d.bytes,n.diagnostics.push(...I(d.diagnostics)),n.diagnostics.push(...d.fidelityWarnings.map(f=>({code:"pdf-fidelity",message:f,severity:"warning"})),...d.pageErrors.map(f=>({code:"pdf-page",message:f,severity:"error"}))),d.unsupportedTextCount&&n.diagnostics.push({code:"pdf-font",message:`${d.unsupportedTextCount} 段文本包含当前字体不支持的字符`,severity:"warning"})}else{const{renderPlanToXlsx:d}=await import("@agile-team/mach-report/xlsx");o.throwIfAborted(e.signal);const f=await d(n.plan,{...e.xlsx,fidelity:e.fidelity,signal:e.signal,onProgress:(p,v)=>g.progress("encode",p,v)});w=new Uint8Array(f.buffer),n.diagnostics.push(...I(f.diagnostics)),n.diagnostics.push(...f.warnings.map(p=>({code:"xlsx-fidelity",message:p,severity:"warning"}))),n.diagnostics.push(...(f.notes??[]).map(p=>({code:"xlsx-snapshot",message:p,severity:"info"})))}return o.throwIfAborted(e.signal),w});o.assertBudget(t,"maxOutputBytes",u.byteLength);const{plan:i,...h}=n;return{...h,bytes:u,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...h.stats,durationMs:Date.now()-a,outputBytes:u.byteLength}}}function L(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function j(e,t){if(t.length===0)throw new c.ReportSourceError("config","缺少报表 ID");return t.map(a=>{if(!Object.prototype.hasOwnProperty.call(e,a))throw new c.ReportSourceError("config",`未注册报表 ${a}`);return e[a]})}function S(e){return e.grid?.cells.reduce((t,a)=>t+a.reduce((n,s)=>n+(s?1+(s.children?.reduce((r,m)=>r+S(m),0)??0):0),0),0)??0}function H(e,t,a){return e.pages.reduce((n,s)=>n+s.components.reduce((r,m)=>m.kind!=="list"?r+S(m):r+c.estimateListLayoutCells(m,t,a),0),0)}function K(e,t=Object.keys(e)){return j(e,t).map((a,n)=>{const s=t[n],r=F.getReportParamDefs(e,[s]);return{id:s,params:JSON.parse(JSON.stringify(r)),paramsSchema:k.reportParamsJsonSchema(r),datasetsSchema:Object.fromEntries(Object.entries(a.dataSchema??{}).map(([m,g])=>[m,c.templateDatasetJsonSchema(typeof a.template=="function"?void 0:a.template,m,g)])),capabilities:{save:!!a.provider?.save,export:!!a.provider?.export,templates:!!a.provider?.templates}}})}function _(e,t){j(e,t.reportIds);const a=k.validateReportParams(F.getReportParamDefs(e,t.reportIds),t.params),n=t.reportIds.flatMap(r=>k.validateReportParams(F.getReportParamDefs(e,[r]),t.params).issues),s=new Map(n.map(r=>[JSON.stringify(r),r]));return{...a,ok:s.size===0,issues:[...s.values()]}}function O(e,t){const a=G.validateRenderPlan(e.plan);if(!a.ok)throw new c.ReportSourceError("validate",`执行器返回无效计划:${a.errors[0]?.path}`);const n=e.plan.pages.length,s=e.plan.pages.reduce((r,m)=>r+m.components.reduce((g,u)=>g+S(u),0),0);return o.assertBudget(t,"maxRows",e.stats.rows),o.assertBudget(t,"maxPages",n),o.assertBudget(t,"maxCells",s),{...e,stats:{...e.stats,pages:n,cells:s}}}function A(e,t){const a=_(e.reports,t);if(!a.ok)throw new k.ReportParamValidationError(a.issues)}function Y(e){const t={...o.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};o.validateBudget(t);const a=async(s,r)=>{const m=Date.now();let g=0,u=0;const i=[],h={},w=[],d=Object.fromEntries(Object.entries(e.reports).map(([l,x])=>[l,{...x,pagination:{...e.pagination,...x.pagination,...r?{measurer:r}:{}},dataValidation:{...x.dataValidation,maxRows:Math.min(t.maxRows??1e5,x.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,x.dataValidation?.maxCells??1/0)}}])),p=await c.createReportSource(d,{maxPages:t.maxPages,maxCells:t.maxCells,maxChartComponents:t.maxChartComponents,onDatasets:(l,x,R)=>{try{g+=c.templateDatasetRowCount(R,x,{maxRows:t.maxRows,signal:s.signal})}catch(b){throw b instanceof Q.TreeRowLimitError?new o.ReportRuntimeError("budget",b.message,"$.budget.maxRows"):b}o.assertBudget(t,"maxRows",g),u+=H(R,x,d[l]?.pagination),o.assertBudget(t,"maxCells",u)}})({...s,params:s.params??{},onWarning:l=>i.push({code:"layout",message:l,severity:"warning"}),onQueryResult:(l,x,R=0)=>{const b=c.reportOccurrenceScope(R,l);Object.defineProperty(h,l,{value:{revision:x.revision,sourceToken:x.sourceToken},enumerable:!0,writable:!0}),w.push({reportId:l,reportIndex:R,reportScope:b,...x.revision===void 0?{}:{revision:x.revision},...x.sourceToken===void 0?{}:{sourceToken:x.sourceToken}}),i.push(...(x.diagnostics??[]).map(P=>({...P,...P.target?{target:{...P.target,reportScope:b,...P.target.tableId?{tableId:JSON.stringify([R,l,P.target.tableId])}:{}}}:{}})))}}).catch(l=>{throw l instanceof c.ReportSourceError&&l.cause instanceof T.PaginatePageLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxPages"):l instanceof c.ReportSourceError&&l.cause instanceof T.PaginateCellLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxCells"):l instanceof c.ReportSourceError&&l.cause instanceof T.PaginateChartComponentLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxChartComponents"):l});o.throwIfAborted(s.signal);const v=e.assets?await c.createReportTaskReporter(s).run("assets",()=>$.resolvePlanAssets(p,{...e.assets,signal:s.signal})):{plan:p,diagnostics:[]},E=v.plan;i.push(...I(v.diagnostics));const D=E.pages.reduce((l,x)=>l+x.components.reduce((R,b)=>R+S(b),0),0);o.assertBudget(t,"maxPages",E.pages.length),o.assertBudget(t,"maxCells",D);const C=y.reportFontFingerprint(s.pdf),J=e.pagination?.measurer||Object.values(e.reports).some(l=>l.pagination?.measurer);return{plan:E,diagnostics:i,revisions:h,sources:w,layout:{textMetrics:C?"font-bytes":J?"provided":"heuristic",...C?{fontFingerprint:C}:{}},stats:{rows:g,pages:E.pages.length,cells:D,durationMs:Date.now()-m}}},n=async s=>{const r=Date.now();if(s.format!=="pdf"&&s.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const m=s.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;o.throwIfAborted(s.signal);const g=s.pdf?.customFontFaces??(s.pdf?.customFontBytes?{regular:s.pdf.customFontBytes}:void 0),u=m&&g?m.createFontBytesMeasurer(g):void 0,i=await a(s,u);return o.throwIfAborted(s.signal),q({...s,prepared:i},t,r)};return{describe:s=>K(e.reports,s),validate:s=>_(e.reports,s),prepare:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:m,onEvent:g,...u}=L(s),i={...u,...u.pdf?{pdf:y.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??c.reportTaskId()},h=g?v=>c.notifyReportTaskEvent(g,v,r):void 0,w={...i,signal:r,onEvent:h};c.createReportTaskReporter(w).runSync("validate",()=>A(e,i));let d;const f=i.pdf?.customFontFaces??(i.pdf?.customFontBytes?{regular:i.pdf.customFontBytes}:void 0);if(!e.executor&&f){const v=await import("@agile-team/mach-report/pdf");o.throwIfAborted(r),d=v.createFontBytesMeasurer(f)}const p=e.executor?await e.executor.prepare(i,r,h):await a(w,d);return O(p,t)}),exportPrepared:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const m=Date.now(),{signal:g,onEvent:u,...i}=s,h=O(y.snapshotPreparedReport(s.prepared,t.maxPreparedBytes??64e6,r),t),w={...i,xlsx:y.snapshotXlsxOptions(i.xlsx),prepared:h,...i.pdf?{pdf:y.snapshotPdfFonts(i.pdf)}:{},taskId:i.taskId??c.reportTaskId()};if(w.format!=="pdf"&&w.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const d=u?p=>c.notifyReportTaskEvent(u,p,r):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new c.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const p=await e.executor.exportPrepared(w,r,d);return o.assertBudget(t,"maxRows",p.stats.rows),o.assertBudget(t,"maxPages",p.stats.pages),o.assertBudget(t,"maxCells",p.stats.cells),o.assertBudget(t,"maxOutputBytes",p.bytes.byteLength),{...p,stats:{...p.stats,outputBytes:p.bytes.byteLength}}}const f={...w,signal:r,onEvent:d};if(c.createReportTaskReporter(f).runSync("validate",()=>y.checkPreparedFont(f)),e.assets){const p=await c.createReportTaskReporter(f).run("assets",()=>$.resolvePlanAssets(h.plan,{...e.assets,signal:r}));h.plan=p.plan,h.diagnostics.push(...I(p.diagnostics))}return q(f,t,m)}),export:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:m,onEvent:g,...u}=L(s),i={...u,xlsx:y.snapshotXlsxOptions(u.xlsx),...u.pdf?{pdf:y.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??c.reportTaskId()},h=g?f=>c.notifyReportTaskEvent(g,f,r):void 0,w={...i,signal:r,onEvent:h};if(c.createReportTaskReporter(w).runSync("validate",()=>A(e,i)),i.format!=="pdf"&&i.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const d=e.executor?await e.executor.export(i,r,h):await n(w);return o.assertBudget(t,"maxRows",d.stats.rows),o.assertBudget(t,"maxPages",d.stats.pages),o.assertBudget(t,"maxCells",d.stats.cells),o.assertBudget(t,"maxOutputBytes",d.bytes.byteLength),{...d,stats:{...d.stats,outputBytes:d.bytes.byteLength}}})}}exports.createReportRuntime=Y;exports.enforcePrepared=O;
@@ -1,11 +1,11 @@
1
- import { R as y, N as R, O as W, P as I, H as T, n as X, J as z, Q as G, o as H } from "./json-snapshot-OqkPyUk5.js";
1
+ import { R as y, N as R, O as W, P as I, H as T, n as X, J as z, Q as G, o as H } from "./json-snapshot-BRnzKudk.js";
2
2
  import { g as M } from "./report-params-D9tBuM9B.js";
3
3
  import { l as $, r as K, R as Y } from "./param-validation-CnDEd2l-.js";
4
4
  import { t as P, b as w, D as Z, v as ee, c as D, R as F } from "./sha256-BDQ1Qk7A.js";
5
5
  import { b as te } from "./template-registry-O0hNIOfB.js";
6
6
  import { T as se } from "./template-serialization-CWmHq7lX.js";
7
7
  import { r as j } from "./assets-T_gDeFaz.js";
8
- import { b as ae, s as S, a as J, e as re, f as oe, r as ne } from "./prepared-DCIxhKFo.js";
8
+ import { b as ae, s as S, a as J, e as re, f as oe, r as ne } from "./prepared-CJy_qk7d.js";
9
9
  import { f as ce, P as ie, e as de } from "./record-bindings-DatJZv_e.js";
10
10
  function O(e = []) {
11
11
  return e.map(({ code: t, message: r, severity: n, pageIndex: s, componentIndex: a }) => ({ code: t, message: r, severity: n, path: a < 0 ? `$.pages.${s}` : `$.pages.${s}.components.${a}` }));
@@ -6,7 +6,7 @@
6
6
  "component": {
7
7
  "type": "library",
8
8
  "name": "@agile-team/mach-report",
9
- "version": "2.23.0"
9
+ "version": "2.23.1"
10
10
  },
11
11
  "properties": [
12
12
  {