@agile-team/mach-report 2.24.0 → 2.25.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 (136) hide show
  1. package/README.md +6 -4
  2. package/dist/{ExcelBindingWizard-Cy_lPjWV.js → ExcelBindingWizard-bs3F4dD8.js} +3 -3
  3. package/dist/{ExcelBindingWizard-BV12hGiK.cjs → ExcelBindingWizard-jSdjBtWw.cjs} +1 -1
  4. package/dist/{ParamEditor-PyOqHzzw.js → ParamEditor-B7YVD28E.js} +2 -2
  5. package/dist/{ParamEditor-DenKjvKu.cjs → ParamEditor-CGfaweYX.cjs} +1 -1
  6. package/dist/{ReportBatchPanel-pQ6d0yqJ.cjs → ReportBatchPanel-BRJt0TXp.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-8EFtMrKk.js → ReportBatchPanel-BTKHtLTW.js} +2 -2
  8. package/dist/{ReportLabelStudio-B_KF3Zc_.cjs → ReportLabelStudio-BvK_WBke.cjs} +1 -1
  9. package/dist/{ReportLabelStudio-HUeo2TsU.js → ReportLabelStudio-CZwqyO3t.js} +3 -3
  10. package/dist/{ReportParamPanel-8xR85nz-.cjs → ReportParamPanel-B27IGJjk.cjs} +1 -1
  11. package/dist/{ReportParamPanel-DA-YpkvC.js → ReportParamPanel-DGXzBzl2.js} +1 -1
  12. package/dist/{ReportPreview-_wTJnsG1.js → ReportPreview-CnxaDTCO.js} +2392 -2342
  13. package/dist/ReportPreview-DqFBcsJQ.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-DH8jl9IF.js → ReportTemplateLibrary-C7sB0Jay.js} +1 -1
  15. package/dist/{ReportTemplateLibrary-CjArKxRG.cjs → ReportTemplateLibrary-ClwxhnC0.cjs} +1 -1
  16. package/dist/{RuleEditor-GDydlEHz.js → RuleEditor-CsDGFaWz.js} +3 -4
  17. package/dist/{RuleEditor-Bmj98oC4.cjs → RuleEditor-D-OdaGdR.cjs} +1 -1
  18. package/dist/{TemplateOutlinePanel-DjPqzU9h.js → TemplateOutlinePanel-CXOT7d1r.js} +2 -2
  19. package/dist/{TemplateOutlinePanel-B554_qk1.cjs → TemplateOutlinePanel-DAqR9zQi.cjs} +1 -1
  20. package/dist/{TemplateReusePanel-DtYbCN7U.js → TemplateReusePanel-Dcfx3Hba.js} +2 -2
  21. package/dist/{TemplateReusePanel-D0628OYc.cjs → TemplateReusePanel-ygIi-Ajz.cjs} +1 -1
  22. package/dist/{TemplateReviewPanel-D_FR4ISq.js → TemplateReviewPanel-COU8FqPq.js} +1 -1
  23. package/dist/{TemplateReviewPanel-CSwvCz3f.cjs → TemplateReviewPanel-DyGULVxr.cjs} +1 -1
  24. package/dist/analytics.cjs +1 -1
  25. package/dist/analytics.d.cts +1 -1
  26. package/dist/analytics.d.ts +1 -1
  27. package/dist/analytics.js +2 -2
  28. package/dist/artifact-integrity.json +102 -102
  29. package/dist/{assets-B4AJIOTB.cjs → assets-BYdpkTIt.cjs} +1 -1
  30. package/dist/{assets-D0FbszhB.js → assets-C4MIvzQ4.js} +2 -2
  31. package/dist/{auto-BksreoKc.js → auto-D7x7QsWD.js} +10 -10
  32. package/dist/{auto-C3mGqzJ8.cjs → auto-mPK9W0y5.cjs} +1 -1
  33. package/dist/{capabilities-lqDEZSq5.js → capabilities-CN_kSVjO.js} +7 -7
  34. package/dist/{capabilities-CTwlcl8q.cjs → capabilities-D4nfhcvB.cjs} +1 -1
  35. package/dist/cell-style-B6Qffrx8.js +37 -0
  36. package/dist/cell-style-y_uh1pZp.cjs +1 -0
  37. package/dist/{data-bar-BnGtnJ82.js → data-bar-Bfh54sT4.js} +1 -1
  38. package/dist/{data-bar-2NLRzOCQ.cjs → data-bar-DzceAVeR.cjs} +1 -1
  39. package/dist/{designer-BNf7NWd6.js → designer-B597ZdC0.js} +2254 -2248
  40. package/dist/designer-DFIdv_n7.cjs +2 -0
  41. package/dist/designer.cjs +1 -1
  42. package/dist/designer.d.cts +6 -6
  43. package/dist/designer.d.ts +6 -6
  44. package/dist/designer.js +1 -1
  45. package/dist/diagnostic-collector-gB07PHy2.js +392 -0
  46. package/dist/diagnostic-collector-wASg6Fzs.cjs +1 -0
  47. package/dist/dom-CXWMmwh-.cjs +1 -0
  48. package/dist/{dom-C90cTM6Y.js → dom-DxdCMLzs.js} +185 -185
  49. package/dist/{encoding-DSc9zv2F.js → encoding-Amq3XrtU.js} +2 -2
  50. package/dist/{encoding-CkziAnZI.cjs → encoding-DRVXs5xm.cjs} +1 -1
  51. package/dist/{font-loader-i7lZbqH_.js → font-loader-D4NLIKJL.js} +1 -1
  52. package/dist/{font-loader-D-znWNWS.cjs → font-loader-p_SyTvqt.cjs} +1 -1
  53. package/dist/{grid-strokes-BPiV1WHe.js → grid-strokes-DkZEZvcI.js} +1 -1
  54. package/dist/{grid-strokes-DYf-6DMl.cjs → grid-strokes-RFMR91jn.cjs} +1 -1
  55. package/dist/index.cjs +2 -2
  56. package/dist/index.d.cts +2 -2
  57. package/dist/index.d.ts +2 -2
  58. package/dist/index.js +137 -137
  59. package/dist/{json-snapshot-BJWZNryO.js → json-snapshot-CBVWZvyC.js} +662 -615
  60. package/dist/json-snapshot-DCFEtfFw.cjs +2 -0
  61. package/dist/matrix-DUYPRL7t.cjs +1 -0
  62. package/dist/{matrix-C6e_r_vp.js → matrix-b6T291xo.js} +120 -104
  63. package/dist/{pdf-DWuq6uxx.cjs → pdf-C060D5UY.cjs} +2 -2
  64. package/dist/{pdf-0_5XiTCx.js → pdf-DU8HelKd.js} +17 -17
  65. package/dist/pdf.cjs +1 -1
  66. package/dist/pdf.js +2 -2
  67. package/dist/{plugin-B1ydqEmS.js → plugin-BdCplNe1.js} +1 -1
  68. package/dist/{plugin-BQBz2vLG.cjs → plugin-DHe8y5pD.cjs} +1 -1
  69. package/dist/{prefill-Cuzh1wxf.js → prefill-Buy4NJ15.js} +2 -2
  70. package/dist/{prefill-2p9wrpn9.cjs → prefill-Cw4ZYGXZ.cjs} +1 -1
  71. package/dist/{prepared-DAwe8Il2.cjs → prepared-BlNeOjoO.cjs} +1 -1
  72. package/dist/{prepared-CVbgO9KR.js → prepared-CBJ7BkK0.js} +2 -2
  73. package/dist/protocol-BU_4sXP0.cjs +1 -0
  74. package/dist/protocol-CB19KXGr.js +96 -0
  75. package/dist/record-bindings-B7djSjNs.cjs +1 -0
  76. package/dist/{record-bindings-fhav-NLG.js → record-bindings-Cv7lFiof.js} +47 -47
  77. package/dist/{region-binding-workflow-Cm4mqhih.js → region-binding-workflow-EYxvUYJ-.js} +2 -2
  78. package/dist/{region-binding-workflow-DWCUgjZl.cjs → region-binding-workflow-NdkMSFCh.cjs} +1 -1
  79. package/dist/report-encoding-worker.cjs +1 -1
  80. package/dist/report-encoding-worker.js +1 -1
  81. package/dist/{rich-text-layout-YJHtCWQI.js → rich-text-layout-Ch_N0Ubu.js} +1 -1
  82. package/dist/{rich-text-layout-X9YOz1JD.cjs → rich-text-layout-yJGuThtC.cjs} +1 -1
  83. package/dist/runtime-B5d_lQNQ.js +227 -0
  84. package/dist/runtime-BRx8Agqr.cjs +1 -0
  85. package/dist/sbom.cdx.json +1 -1
  86. package/dist/server-node.cjs +5 -5
  87. package/dist/server-node.js +1891 -1793
  88. package/dist/server.cjs +1 -1
  89. package/dist/server.d.cts +4 -4
  90. package/dist/server.d.ts +4 -4
  91. package/dist/server.js +8 -8
  92. package/dist/style.css +1 -1
  93. package/dist/{template-catalog-Bu7s7ReF.js → template-catalog-CM6U_RlD.js} +3 -3
  94. package/dist/{template-catalog--yBX169M.cjs → template-catalog-Cj66M84u.cjs} +1 -1
  95. package/dist/{template-fragments-Di2vDFnx.js → template-fragments-BDxdCuMD.js} +2 -2
  96. package/dist/{template-fragments-5EzVn7bm.cjs → template-fragments-DbKdxI1z.cjs} +1 -1
  97. package/dist/template-registry-B-AK1oam.cjs +1 -0
  98. package/dist/{template-registry-BCBF2b8j.js → template-registry-DeVgwEZj.js} +145 -144
  99. package/dist/{textwrap-CmVkhMhx.js → textwrap-BywMBMXM.js} +1 -1
  100. package/dist/{textwrap-BPFxhpOw.cjs → textwrap-LhJkHWb1.cjs} +1 -1
  101. package/dist/vue/async.d.cts +4 -4
  102. package/dist/vue/async.d.ts +4 -4
  103. package/dist/vue/index.d.cts +6 -6
  104. package/dist/vue/index.d.ts +6 -6
  105. package/dist/vue-async.cjs +1 -1
  106. package/dist/vue-async.js +3 -3
  107. package/dist/vue.cjs +1 -1
  108. package/dist/vue.js +7 -7
  109. package/dist/{workbook-session-B6P_-5a4.js → workbook-session-B6hRjTyX.js} +106 -107
  110. package/dist/{workbook-session-BnPK3T58.cjs → workbook-session-BclW7KKH.cjs} +3 -3
  111. package/dist/worker.cjs +1 -1
  112. package/dist/worker.js +4 -4
  113. package/dist/xlsx/node.d.cts +30 -1
  114. package/dist/xlsx/node.d.ts +30 -1
  115. package/dist/xlsx-node.cjs +42 -42
  116. package/dist/xlsx-node.js +3908 -3889
  117. package/dist/xlsx.cjs +2 -2
  118. package/dist/xlsx.d.cts +2 -2
  119. package/dist/xlsx.d.ts +2 -2
  120. package/dist/xlsx.js +151 -151
  121. package/package.json +1 -1
  122. package/dist/ReportPreview-CyUXJSVX.cjs +0 -6
  123. package/dist/designer-DWnZZ_ej.cjs +0 -2
  124. package/dist/diagnostic-collector-1sqd7DQP.js +0 -355
  125. package/dist/diagnostic-collector-D3rlvxm3.cjs +0 -1
  126. package/dist/dom-CxOkm_Sy.cjs +0 -1
  127. package/dist/json-snapshot-C7QZrRBf.cjs +0 -2
  128. package/dist/matrix-B8QWbsGM.cjs +0 -1
  129. package/dist/progress-BXzlVbIp.js +0 -29
  130. package/dist/progress-DJBd9Rb9.cjs +0 -1
  131. package/dist/protocol-BOri9qJL.js +0 -105
  132. package/dist/protocol-DD5dHSz-.cjs +0 -1
  133. package/dist/record-bindings-CAyM5tGg.cjs +0 -1
  134. package/dist/runtime-BpSAgOw1.js +0 -201
  135. package/dist/runtime-Cd2UTnwe.cjs +0 -1
  136. package/dist/template-registry-Bnh5aEYf.cjs +0 -1
@@ -1,13 +1,13 @@
1
- import "./font-loader-i7lZbqH_.js";
1
+ import "./font-loader-D4NLIKJL.js";
2
2
  import { g as Y1 } from "./_commonjsHelpers-DaMA6jEr.js";
3
- import { h as Rd, w as J1 } from "./textwrap-CmVkhMhx.js";
4
- import { d as Q1 } from "./data-bar-BnGtnJ82.js";
5
- import { t as Md, u as _1, o as $1, v as eg, i as tg, r as rg, f as ng, a as pi, b as ss, d as Ld, m as ig, e as ag } from "./diagnostic-collector-1sqd7DQP.js";
6
- import { c as og, n as sg, O as ug } from "./capabilities-lqDEZSq5.js";
3
+ import { h as Rd, w as J1 } from "./textwrap-BywMBMXM.js";
4
+ import { v as Md, x as Q1, o as _1, y as $1, i as eg, r as tg, g as rg, a as pi, c as ss, e as Ld, b as ng, f as ig } from "./diagnostic-collector-gB07PHy2.js";
5
+ import { d as ag } from "./data-bar-Bfh54sT4.js";
6
+ import { c as og, n as sg, O as ug } from "./capabilities-CN_kSVjO.js";
7
7
  import { I as wl, c as fg } from "./media-Y90dHK9z.js";
8
- import { r as cg } from "./assets-D0FbszhB.js";
9
- import { r as lg } from "./grid-strokes-BPiV1WHe.js";
10
- import { d as hg } from "./rich-text-layout-YJHtCWQI.js";
8
+ import { r as cg } from "./assets-C4MIvzQ4.js";
9
+ import { r as lg } from "./grid-strokes-DkZEZvcI.js";
10
+ import { d as hg } from "./rich-text-layout-Ch_N0Ubu.js";
11
11
  var Af = function(t, e) {
12
12
  return Af = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
13
13
  r.__proto__ = n;
@@ -36084,7 +36084,7 @@ function nT(t, e) {
36084
36084
  }
36085
36085
  function nc(t, e, r, n, i) {
36086
36086
  const a = r.style ?? {};
36087
- if (rc(t, a, i), ng(r)) {
36087
+ if (rc(t, a, i), rg(r)) {
36088
36088
  hg(r, n, {
36089
36089
  measure(f, l) {
36090
36090
  const h = q1(t, l), d = pi(l).fontSizePt;
@@ -36126,7 +36126,7 @@ function vi(t, e, r, n) {
36126
36126
  t.drawLine({ start: r, end: n, thickness: Math.max(0.1, i.widthPt), color: ca(i.color, [0.2, 0.2, 0.2]) });
36127
36127
  }
36128
36128
  function aT(t, e, r) {
36129
- const n = ag(e), i = r.x + r.width, a = r.yTop - r.height;
36129
+ const n = ig(e), i = r.x + r.width, a = r.yTop - r.height;
36130
36130
  n.top && vi(t, e, { x: r.x, y: r.yTop }, { x: i, y: r.yTop }), n.right && vi(t, e, { x: i, y: r.yTop }, { x: i, y: a }), n.bottom && vi(t, e, { x: i, y: a }, { x: r.x, y: a }), n.left && vi(t, e, { x: r.x, y: a }, { x: r.x, y: r.yTop });
36131
36131
  }
36132
36132
  function oT(t, e, r, n) {
@@ -36146,14 +36146,14 @@ function oT(t, e, r, n) {
36146
36146
  }
36147
36147
  }
36148
36148
  async function sT(t, e, r, n, i, a) {
36149
- const o = ig(r.style, n.cell.style), s = {
36149
+ const o = ng(r.style, n.cell), s = {
36150
36150
  x: i.x + At(n.xMm),
36151
36151
  yTop: i.yTop - At(n.yMm),
36152
36152
  width: At(n.widthMm),
36153
36153
  height: At(n.heightMm)
36154
36154
  };
36155
36155
  mu(e, s, o.backgroundColor), rc(t, o, a);
36156
- const u = r.grid?.paddingMm ?? 0.5, f = Q1(n.cell.dataBar, n.widthMm, n.heightMm, u), l = At(u), h = n.cell.indentMm ?? 0, d = At(h), v = {
36156
+ const u = r.grid?.paddingMm ?? 0.5, f = ag(n.cell.dataBar, n.widthMm, n.heightMm, u), l = At(u), h = n.cell.indentMm ?? 0, d = At(h), v = {
36157
36157
  x: s.x + l + d,
36158
36158
  yTop: s.yTop - l,
36159
36159
  width: Math.max(0, s.width - 2 * l - d),
@@ -36181,7 +36181,7 @@ function uT(t, e, r, n, i, a) {
36181
36181
  o.length > u && t.fidelityWarnings.push(`${a}: 单元格文本超出可用高度,PDF 文本裁切;请增加行高或减少字号(${o.length} 行,可容纳 ${u} 行)`), H1(t, e, o.slice(0, Math.max(1, u)), { verticalAlign: "middle", ...n }, i);
36182
36182
  }
36183
36183
  async function fT(t, e, r, n, i) {
36184
- const a = rg(r.grid, r.widthMm, r.heightMm);
36184
+ const a = tg(r.grid, r.widthMm, r.heightMm);
36185
36185
  mu(e, n, r.style?.backgroundColor);
36186
36186
  for (const o of a.cells) {
36187
36187
  await sT(t, e, r, o, n, `${i} cell ${o.ri + 1}:${o.ci + 1}`);
@@ -36219,7 +36219,7 @@ function cT(t, e, r) {
36219
36219
  async function X1(t, e, r, n, i) {
36220
36220
  Ua(t.signal);
36221
36221
  const a = rT(r, n);
36222
- if (tg(r)) {
36222
+ if (eg(r)) {
36223
36223
  const o = await iT(t, r.imageData);
36224
36224
  if (o) {
36225
36225
  const s = Math.min(a.width / o.width, a.height / o.height), u = o.width * s, f = o.height * s;
@@ -36241,7 +36241,7 @@ async function lT(t, e, r) {
36241
36241
  } : { regular: s, bold: u, italic: f, boldItalic: l };
36242
36242
  return {
36243
36243
  signal: e.signal,
36244
- schedule: eg(e),
36244
+ schedule: $1(e),
36245
36245
  document: t,
36246
36246
  fonts: h,
36247
36247
  customFont: o,
@@ -36287,7 +36287,7 @@ async function CT(t, e = {}) {
36287
36287
  for (const [x, O] of v.components.entries()) {
36288
36288
  Ua(e.signal);
36289
36289
  const A = `page ${d + 1} ${O.nid ?? O.kind}`, M = u.unsupportedTextCount, B = { severity: "warning", format: "pdf", pageIndex: d, componentIndex: x, kind: O.kind, nid: O.nid };
36290
- s = { collector: _1(e.diagnosticLimit), location: B };
36290
+ s = { collector: Q1(e.diagnosticLimit), location: B };
36291
36291
  try {
36292
36292
  await X1(u, w, O, m, A);
36293
36293
  } catch (k) {
@@ -36296,7 +36296,7 @@ async function CT(t, e = {}) {
36296
36296
  }
36297
36297
  u.unsupportedTextCount > M && n.push({ ...B, code: "unsupported-text", message: "Text contains characters missing from the output font." }), e.diagnosticLimit === void 0 ? s.collector.entries.forEach((k) => n.push(k)) : n.merge(s.collector.snapshot()), s = void 0;
36298
36298
  }
36299
- await $1(e, d + 1, t.pages.length);
36299
+ await _1(e, d + 1, t.pages.length);
36300
36300
  }
36301
36301
  if (Ua(e.signal), (a ? n.entries.filter((d) => !a.has(d)) : n.entries.slice(i)).forEach((d) => sg(d, e)), e.fidelity === "strict" && n.total) throw new ug(n.entries, e.diagnosticLimit === void 0 ? void 0 : n.snapshot());
36302
36302
  await u.embedding.finalize();
package/dist/pdf.cjs CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./font-loader-p_SyTvqt.cjs"),t=require("./pdf-C060D5UY.cjs");exports.clearFontCache=e.clearFontCache;exports.configureFontCache=e.configureFontCache;exports.getFontCacheStats=e.getFontCacheStats;exports.invalidateFontCache=e.invalidateFontCache;exports.loadFontWithCache=e.loadFontWithCache;exports.createFontBytesMeasurer=t.createFontBytesMeasurer;exports.renderPlanToPdf=t.renderPlanToPdf;
package/dist/pdf.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-i7lZbqH_.js";
2
- import { c as F, r as s } from "./pdf-0_5XiTCx.js";
1
+ import { clearFontCache as t, configureFontCache as o, getFontCacheStats as r, invalidateFontCache as n, loadFontWithCache as c } from "./font-loader-D4NLIKJL.js";
2
+ import { c as F, r as s } from "./pdf-DU8HelKd.js";
3
3
  export {
4
4
  t as clearFontCache,
5
5
  o as configureFontCache,
@@ -1,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-_wTJnsG1.js").then((r) => r.x)), _ = {
4
+ const p = c(() => import("./ReportPreview-CnxaDTCO.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-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;
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-DqFBcsJQ.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,5 +1,5 @@
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";
1
+ import { t as P, E as O, l as V, O as Z, P as T } from "./json-snapshot-CBVWZvyC.js";
2
+ import { r as B } from "./diagnostic-collector-gB07PHy2.js";
3
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;
@@ -1 +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
+ "use strict";const g=require("./json-snapshot-DCFEtfFw.cjs"),N=require("./diagnostic-collector-wASg6Fzs.cjs"),y=require("./computed-DK6BruFz.cjs");function R(e){return Number.isFinite(e)?Math.max(0,e):0}function B(e,t=0){const r=e.length,o=R(t),n=new Array(r+1);n[0]=0;for(let i=0;i<r;i++)n[i+1]=n[i]+R(e[i]??0)+o;const c=n[r];function s(i){let a=0,u=r-1,p=0;for(;a<=u;){const f=a+u>>>1;n[f]<=i?(p=f,a=f+1):u=f-1}return p}function d(i,a,u=1){if(r===0)return{start:0,end:-1,padTopPx:0,padBottomPx:0};const p=Math.floor(R(u)),f=R(a),m=s(f),w=Math.max(0,m-p),I=f+R(i);let h=m,D=r-1,z=r-1;for(;h<=D;){const S=h+D>>>1;n[S+1]<I?h=S+1:(z=S,D=S-1)}const E=Math.min(r-1,z+p);return{start:w,end:E,padTopPx:n[w],padBottomPx:Math.max(0,c-n[E+1])}}return{totalHeightPx:c,pageAt:s,offsetAt:i=>n[Math.max(0,Math.min(r,Math.floor(i)))]??0,window:d}}class v extends Error{constructor(t){super(`Report drill: ${t}`),this.code=t,this.name="ReportDrillError"}}function x(e){return typeof e=="string"&&e.trim().length>0&&e.length<=256}function V(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="boolean")return String(e);if(typeof e=="string"&&e.length>0&&e.length<=4096)return e;throw new v("missing-value")}function $(e,t){return Object.getOwnPropertyDescriptor(e,t)?.value}function A(e){if(!Array.isArray(e)||e.length>64)throw new v("config");const t=new Set;for(const r of e){if(!r||!x(r.id)||!x(r.label)||!r.target||!x(r.target.field)||t.has(r.id))throw new v("config");t.add(r.id);const o=r.target;if(o.datasetId!==void 0&&!x(o.datasetId)||o.reportScope!==void 0&&!x(o.reportScope))throw new v("config");if(o.roles!==void 0&&(!Array.isArray(o.roles)||o.roles.length>16||o.roles.some(n=>!x(n))))throw new v("config");G(r.params)}}function G(e){if(e!==void 0){if(!e||typeof e!="object"||Array.isArray(e)||Object.keys(e).length>32)throw new v("config");for(const[t,r]of Object.entries(e)){if(!x(t)||["__proto__","constructor","prototype"].includes(t)||!r||typeof r!="object")throw new v("config");if("value"in r)try{V(r.value)}catch{throw new v("config")}else if(!["value","rowKey","query","field"].includes(r.from)||(r.from==="query"||r.from==="field")&&!x(r.field))throw new v("config")}}}function T(e,t,r){const{target:o}=r,n=t.source?.datasetId??t.component.table?.source?.datasetId;return(t.source?.field??t.table?.columnKey)===o.field&&(o.datasetId===void 0||n===o.datasetId)&&(o.reportScope===void 0||e.pages[t.address.pageIndex]?.meta?.reportScope===o.reportScope)&&(o.roles?o.roles.includes(t.table?.role??""):t.table?.role!=="header")}function U(e,t,r){A(r);const o=g.getReportCellContext(e,t);return o?r.filter(n=>T(e,o,n)):[]}function W(e,t,r,o){if("value"in e)return e.value;switch(e.from){case"value":return r.value;case"rowKey":return r.source?.rowKey;case"query":return $(o,e.field);case"field":{const n=r.component.table?.columnKeys.indexOf(e.field)??-1;return n<0?void 0:g.getReportCellContext(t,{...r.address,columnIndex:n})?.value}}}function Z(e,t,r,o={}){A([r]);const n=g.getReportCellContext(e,t);if(!n||!T(e,n,r))throw new v("target");const c=Object.fromEntries(Object.entries(r.params??{}).map(([i,a])=>[i,V(W(a,e,n,o))])),s=Object.entries(o);if(s.length>128||s.some(([i,a])=>!x(i)||typeof a!="string"||a.length>4096))throw new v("config");const d=e.pages[t.pageIndex]?.meta?.reportScope;return Object.freeze({actionId:r.id,params:Object.freeze(c),returnState:Object.freeze({params:Object.freeze(Object.fromEntries(s)),address:Object.freeze({...t}),...typeof d=="string"?{reportScope:d}:{},...n.source?{source:Object.freeze({sourceScope:n.source.sourceScope,datasetId:n.source.datasetId,rowKey:n.source.rowKey,field:n.source.field})}:{}})})}function H(e,t){if(!t.source)return e.pages[t.address.pageIndex]?.meta?.reportScope===t.reportScope&&g.getReportCellContext(e,t.address)?{...t.address}:null;const r=g.createReportCellResolver(e),o=g.reportCellEditKey({address:t.address,source:t.source});for(const[n,c]of e.pages.entries())if(!(t.reportScope!==void 0&&c.meta?.reportScope!==t.reportScope)){for(const[s,d]of c.components.entries())if(d.grid)for(const i of N.resolveGridLayout(d.grid,d.widthMm,d.heightMm).cells){const a={pageIndex:n,componentIndex:s,rowIndex:i.ri,columnIndex:i.ci},u=r(a);if(u?.source&&g.reportCellEditKey(u)===o)return a}}return null}class l extends Error{constructor(t,r){super(r),this.code=t,this.name="ReportDataError"}}function b(e,t,r){const o=e??t;if(!Number.isSafeInteger(o)||o<1||o>r)throw new l("limit","Invalid report data budget");return o}function k(e){if(typeof e=="string"&&e.length>0&&e.length<=2048)return`s:${e}`;if(typeof e=="number"&&Number.isSafeInteger(e))return`n:${Object.is(e,-0)?0:e}`;throw new l("identity","A stable string or safe integer business key is required")}function O(e){if(typeof e.datasetId!="string"||!e.datasetId.trim()||e.datasetId.length>2048)throw new l("identity","A dataset identity is required");if(e.sourceScope!==void 0&&(typeof e.sourceScope!="string"||!e.sourceScope.trim()||e.sourceScope.length>2048))throw new l("identity","Invalid source scope")}function j(e,t=256){if(!Array.isArray(e)||!e.length||e.length>t)throw new l("limit","A bounded explicit field allowlist is required");const r=new Set;for(const o of e){if(typeof o!="string"||!o.trim()||o.length>2048||["__proto__","constructor","prototype"].includes(o))throw new l("identity","Invalid report field");if(r.has(o))throw new l("duplicate","Duplicate report field");r.add(o)}}function C(e,t){const r=Object.getOwnPropertyDescriptor(e.values,t);if(!r)return;if(!("value"in r))throw new l("value","Report values must be plain scalar data");const o=r.value;if(o===null||typeof o=="boolean"||typeof o=="string"||typeof o=="number"&&Number.isFinite(o))return o;throw new l("value","Report values must be finite scalar data")}function J(e){if(!e||typeof e!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(e)))throw new l("value","Report records must be plain data");const t=Object.getOwnPropertyDescriptor(e,"rowKey"),r=Object.getOwnPropertyDescriptor(e,"values");if(!t||!("value"in t)||!r||!("value"in r)||!r.value||typeof r.value!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(r.value)))throw new l("value","Report records require own scalar keys and plain values");return{rowKey:t.value,values:r.value}}function q(e,t,r={}){const o=b(r.maxRows,5e4,1e5),n=b(r.maxCells,1e6,2e6);if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype||e.length>o||e.length*t.length>n)throw new l("limit","Report data exceeds its budget");const c=new Map;for(let s=0;s<e.length;s++){const d=Object.getOwnPropertyDescriptor(e,s);if(!d||!("value"in d))throw new l("value","Sparse or accessor report records are unsupported");const i=J(d.value),a=k(i.rowKey);if(c.has(a))throw new l("duplicate","Duplicate business row key");const u=Object.create(null);for(const p of t){const f=C(i,p);f!==void 0&&(u[p]=f)}c.set(a,{rowKey:i.rowKey,values:u})}return c}function P(e){return e==null||e===""}function F(e,t){return P(e)?t.missing==="zero"?y.parseDecimal(0):void 0:y.parseDecimal(e)}function Q(e){return{coefficient:-e.coefficient,scale:e.scale}}function X(e,t,r,o){const n=F(e,r),c=Object.is(e,t)?n:F(t,r);if(!n||!c)return{equal:L(e,t,r),ratioUnavailable:"missing"};const s=y.addDecimal(c,Q(n)),d={...s,coefficient:s.coefficient<0n?-s.coefficient:s.coefficient},i=y.compareDecimal(d,r.toleranceValue)<=0;return i&&!o?{equal:i}:n.coefficient===0n?{equal:i,delta:y.printDecimal(s),...s.coefficient===0n&&r.zeroDenominator==="zero-if-equal"?{changeRatio:"0"}:{ratioUnavailable:"zero-denominator"}}:{equal:i,delta:y.printDecimal(s),changeRatio:y.printDecimal(y.divideDecimal(s,n,r.ratioDigits??12))}}function L(e,t,r){return r.missing==="empty-equivalent"&&P(e)&&P(t)||Object.is(e,t)}function Y(e){j(e.fields.map(t=>t.field),b(e.maxFields,256,1024));for(const t of e.fields){if(t.type!==void 0&&!["decimal","value"].includes(t.type))throw new l("value","Invalid comparison field type");if(t.missing&&!["distinct","empty-equivalent","zero"].includes(t.missing))throw new l("value","Invalid missing-value policy");if(t.zeroDenominator&&!["omit","zero-if-equal"].includes(t.zeroDenominator))throw new l("value","Invalid zero-denominator policy");if(t.missing==="zero"&&t.type!=="decimal")throw new l("value","Zero missing-value policy requires a decimal field");if(t.tolerance!==void 0&&(t.type!=="decimal"||y.compareDecimal(y.parseDecimal(t.tolerance),y.parseDecimal(0))<0))throw new l("value","Tolerance requires a non-negative decimal");if(t.ratioDigits!==void 0&&(!Number.isInteger(t.ratioDigits)||t.ratioDigits<0||t.ratioDigits>100))throw new l("value","Invalid ratio precision")}return e.fields.map(t=>({...t,toleranceValue:y.parseDecimal(t.tolerance??"0")}))}function M(e,t,r,o,n){let c=!1;for(const s of r){const d=e?C(e,s.field):void 0,i=t?C(t,s.field):void 0,a=s.type==="decimal"?X(d,i,s,!e||!t):{equal:L(d,i,s)};if(e&&t&&a.equal)continue;if(c=!0,o.length>=n)throw new l("limit","Report differences exceed their budget");const{equal:u,...p}=a;o.push({rowKey:(t??e).rowKey,kind:e?t?"changed":"removed":"added",field:s.field,label:s.label??s.field,before:d,after:i,...p})}return c}function ee(e,t,r){O(e),O(t);const o=Y(r);if(e.datasetId!==t.datasetId||e.sourceScope!==t.sourceScope)throw new l("identity","Comparison requires the same business dataset and source scope");const n=r.fields.map(u=>u.field),c=q(e.rows,n,r),s=q(t.rows,n,r),d=b(r.maxDifferences,2e4,1e5),i=[],a={added:0,removed:0,changed:0,unchanged:0,cells:0};for(const[u,p]of c){const f=s.get(u),m=M(p,f,o,i,d);f?m?a.changed++:a.unchanged++:a.removed++}for(const[u,p]of s)c.has(u)||(M(void 0,p,o,i,d),a.added++);return a.cells=i.length,{sourceScope:t.sourceScope,datasetId:t.datasetId,differences:i,counts:a}}function K(e,t){O(t),j(t.fields,b(t.maxFields,256,1024));const r=b(t.maxCells,1e6,2e6),o=new Set(t.fields),n=new Map,c=g.createReportCellResolver(e);let s=0;for(const[d,i]of e.pages.entries())for(const[a,u]of i.components.entries()){if(!u.grid)continue;for(const f of u.grid.cells)if(s+=f.length,s>r)throw new l("limit","Report cell scan exceeds its budget");const p=N.resolveGridLayout(u.grid,u.widthMm,u.heightMm).cells;for(const f of p){const m=c({pageIndex:d,componentIndex:a,rowIndex:f.ri,columnIndex:f.ci}),w=m?.source;if(!m||!w||w.datasetId!==t.datasetId||w.sourceScope!==t.sourceScope||!o.has(w.field))continue;k(w.rowKey);const I=g.reportCellEditKey(m),h=n.get(I);h?(!Object.is(h.context.value,m.value)||h.context.source?.revision!==w.revision||h.context.source?.sourceToken!==w.sourceToken||h.context.editable!==m.editable)&&(h.ambiguous=!0):n.set(I,{context:m,ambiguous:!1})}}return n}function te(e,t){const r=K(e,t),o=new Map,n=b(t.maxRows,5e4,1e5);for(const{context:c,ambiguous:s}of r.values()){if(s)throw new l("conflict","Repeated report cells disagree for the same business field");const d=c.source,i=k(d.rowKey);let a=o.get(i);if(!a){if(o.size>=n)throw new l("limit","Report row extraction exceeds its budget");a={rowKey:d.rowKey,values:Object.create(null)},o.set(i,a)}a.values[d.field]=c.value}return{sourceScope:t.sourceScope,datasetId:t.datasetId,rows:[...o.values()]}}function _(e){return e==null||e===""}function re(e,t,r){if(!t){e.reason="missing-target";return}const{context:o,ambiguous:n}=t;if(e.before=o.value,n){e.status="conflict",e.reason="ambiguous";return}if(!o.editable||r.canEdit?.(o)===!1){e.reason="readonly";return}if(_(e.after)){e.reason="missing-source";return}if(Object.is(o.value,e.after)){e.status="matched",e.reason="unchanged";return}if(r.mode!=="replace"&&!_(o.value)){e.reason="occupied";return}try{const c=g.editFromContext(o,e.after);if(Object.is(c.value,c.previousValue)){e.status="matched",e.reason="unchanged";return}return e.after=c.value,e.status="changed",c}catch{e.status="conflict",e.reason="invalid";return}}function oe(e,t){if(O(t),t.mode!==void 0&&t.mode!=="empty"&&t.mode!=="replace")throw new l("value","Invalid prefill policy");const r=b(t.maxFields,256,1024),o=t.fields.map(f=>f.field),n=[...new Set(t.fields.map(f=>f.sourceField??f.field))];j(o,r),j(n,r);const c=q(t.rows,n,t),s=K(e,{...t,fields:o}),d=b(t.maxChanges,1e4,1e4),i=b(t.maxCells,1e6,2e6);if(c.size*o.length>i)throw new l("limit","Prefill review exceeds its budget");const a=[],u=[],p={matched:0,changed:0,skipped:0,conflict:0};for(const f of c.values())for(const m of t.fields){const w={sourceScope:t.sourceScope,datasetId:t.datasetId,rowKey:f.rowKey,field:m.field},I={source:w,label:m.label??m.field,status:"skipped",after:C(f,m.sourceField??m.field)},h=g.reportCellEditKey({address:{pageIndex:0,componentIndex:0,rowIndex:0,columnIndex:0},source:w}),D=re(I,s.get(h),t);if(D){if(u.length>=d)throw new l("limit","Prefill changes exceed the atomic edit budget");u.push(D)}p[I.status]++,a.push(I)}return{sourceScope:t.sourceScope,datasetId:t.datasetId,items:a,counts:p,edits:u}}function ne(e,t,r){if(t.counts.conflict>0)throw new l("conflict","Resolve prefill conflicts before applying");if(t.edits.length>1e4)throw new l("limit","Prefill changes exceed the atomic edit budget");if(!t.edits.length)return[];const o=[...new Set(t.edits.map(s=>s.source.field))],n=K(e,{sourceScope:t.sourceScope,datasetId:t.datasetId,fields:o}),c=new Set;return t.edits.map(s=>{if(!s.source||s.source.datasetId!==t.datasetId||s.source.sourceScope!==t.sourceScope)throw new l("identity","Prefill identity changed");const d=g.reportCellEditKey(s),i=n.get(d);if(c.has(d))throw new l("duplicate","Duplicate prefill target");if(c.add(d),!i||i.ambiguous||g.sourceChanged(i.context,s)||!Object.is(i.context.value,s.previousValue))throw new l("conflict","Prefill target changed; reload the preview");if(!i.context.editable||r?.(i.context)===!1)throw new l("conflict","Prefill target is read-only");return{address:{...i.context.address},value:g.editFromContext(i.context,s.value).value}})}exports.ReportDataError=l;exports.ReportDrillError=v;exports.compareReportData=ee;exports.createPageWindowIndex=B;exports.createReportDrillRequest=Z;exports.createReportPrefill=oe;exports.dataLimit=b;exports.indexReportDataCells=K;exports.matchReportDrillActions=U;exports.reportDataSnapshotFromPlan=te;exports.reportPrefillInputs=ne;exports.resolveReportDrillReturn=H;exports.validateReportDrillActions=A;
@@ -1 +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;
1
+ "use strict";const a=require("./json-snapshot-DCFEtfFw.cjs"),c=require("./diagnostic-collector-wASg6Fzs.cjs"),s=require("./sha256-DgZAKXqI.cjs"),p=require("./workbook-sheets-CaPAulQ6.cjs");function f(e,r,t,o){if(o===void 0&&!e.diagnosticSummary&&!t){r.forEach(i=>e.diagnostics.push(i));return}const n=c.createDiagnosticCollector(o??c.DEFAULT_DIAGNOSTIC_LIMIT);e.diagnosticSummary?n.merge(e.diagnosticSummary):e.diagnostics.forEach(i=>n.push(i)),t?n.merge(t):r.forEach(i=>n.push(i)),e.diagnostics=n.entries,e.diagnosticSummary=n.snapshot()}function S(e,r){return!a.hasValidDataExplanation(e)||!l(e)||["code","message","severity","path","format","pageIndex","componentIndex","kind","nid","valueState"].some(o=>e[o]!==r[o])||e.componentPath?.length!==r.componentPath?.length||e.componentPath?.some((o,n)=>o!==r.componentPath?.[n])||["datasetId","field","rowKey","tableId","reportScope"].some(o=>e.target?.[o]!==r.target?.[o])?!1:e.extension?.id===r.extension?.id&&e.extension?.version===r.extension?.version}function m(e,r){return!c.validDiagnosticSummary(e)||e.entries.length!==r.length?!1:e.entries.every((t,o)=>!!t&&typeof t=="object"&&S(t,r[o]))}function b(e,r,t,o,n=t.length){n&&e.merge({total:n,counts:{[r]:n},entries:t.map(i=>({code:r,message:i,severity:o})),omitted:n-t.length})}function g(e,r){return e===void 0||typeof e=="number"&&Number.isSafeInteger(e)&&e>=r}function l(e){return!(e.format!==void 0&&!["dom","canvas","pdf","xlsx"].includes(e.format)||!g(e.pageIndex,0)||!g(e.componentIndex,-1)||e.componentPath!==void 0&&!x(e.componentPath)||e.extension!==void 0&&(!e.extension||typeof e.extension.id!="string"||typeof e.extension.version!="string"))}function x(e){if(!Array.isArray(e)||e.length>192)return!1;for(const r of e)if(typeof r!="number"||!Number.isSafeInteger(r)||r<0)return!1;return!0}function F(e){return e&&{...e,sheetNames:p.snapshotSheetNames(e.sheetNames),additionalSheets:p.snapshotAdditionalSheets(e.additionalSheets)}}function P(e,r){if(e.format!=="xlsx")return;const t=e.xlsx?.additionalSheets?.reduce((o,n)=>o+n.rows.reduce((i,d)=>i+d.length,0),0)??0;s.assertBudget(r,"maxCells",e.prepared.stats.cells+t)}function I(e){if(!e)return;const r=t=>{if(!(t instanceof Uint8Array)&&!(t instanceof ArrayBuffer))throw new a.ReportSourceError("validate","字体应为 Uint8Array 或 ArrayBuffer");if(t.byteLength>32e6)throw new s.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return new Uint8Array(t instanceof Uint8Array?t:new Uint8Array(t))};if(e.customFontFaces){const t=e.customFontFaces;return{customFontName:e.customFontName,customFontFaces:{regular:r(t.regular),...t.bold?{bold:r(t.bold)}:{},...t.italic?{italic:r(t.italic)}:{},...t.boldItalic?{boldItalic:r(t.boldItalic)}:{}}}}return{customFontName:e.customFontName,...e.customFontBytes?{customFontBytes:r(e.customFontBytes)}:{}}}function y(e){const r=e?.customFontFaces??(e?.customFontBytes?{regular:e.customFontBytes}:void 0);if(!r)return;const t=["regular","bold","italic","boldItalic"].map(o=>{const n=r[o];if(!n)return[o,null];const i=n instanceof Uint8Array?n:new Uint8Array(n);if(i.byteLength>32e6)throw new s.ReportRuntimeError("budget","单份字体超过 32 MB","$.pdf");return[o,s.portableSha256Hex(i)]});return s.portableSha256Hex(new TextEncoder().encode(JSON.stringify(t)))}const u=new WeakMap;function A(e,r,t){const o=h(e,r,t);let n=!0;return{prepared:o,forward(){if(!n)throw new Error("报表快照只能交接一次");return n=!1,u.set(o,r),o}}}function h(e,r,t){if(s.throwIfAborted(t),!Number.isSafeInteger(r)||r<=0)throw new s.ReportRuntimeError("budget","快照预算应为正安全整数","$.budget.maxPreparedBytes");const o=u.get(e);if(u.delete(e),o!==void 0&&o<=r)return e;const n=a.snapshotReportJson(e,{maxBytes:r,maxNodes:r,check:()=>s.throwIfAborted(t),error:(i,d)=>i==="budget"?new s.ReportRuntimeError("budget",d,"$.budget.maxPreparedBytes"):new a.ReportSourceError("validate",d)});return w(n),n}function v(e){if(e===void 0)return!0;if(!Array.isArray(e))return!1;const r=new Set;return e.every(t=>!t||typeof t!="object"||Array.isArray(t)||typeof t.reportId!="string"||!t.reportId.trim()||!Number.isSafeInteger(t.reportIndex)||t.reportIndex<0||r.has(t.reportIndex)||typeof t.reportScope!="string"||!t.reportScope.trim()||t.reportScope.length>4096||t.revision!==void 0&&typeof t.revision!="string"||t.sourceToken!==void 0&&typeof t.sourceToken!="string"?!1:(r.add(t.reportIndex),!0))}function w(e){if(!v(e.sources))throw new a.ReportSourceError("validate","准备结果来源清单无效");if(!e?.stats||["rows","pages","cells"].some(r=>!Number.isSafeInteger(e.stats[r])||e.stats[r]<0)||!Number.isFinite(e.stats.durationMs)||e.stats.durationMs<0)throw new a.ReportSourceError("validate","准备结果统计无效");if(!Array.isArray(e.diagnostics)||e.diagnostics.some(r=>!r||typeof r.code!="string"||typeof r.message!="string"||!["info","warning","error"].includes(r.severity)||!a.hasValidDataExplanation(r)||!l(r)))throw new a.ReportSourceError("validate","准备结果诊断无效");if(e.diagnosticSummary!==void 0&&!m(e.diagnosticSummary,e.diagnostics))throw new a.ReportSourceError("validate","准备结果诊断摘要无效");if(!e.revisions||typeof e.revisions!="object"||Array.isArray(e.revisions)||Object.values(e.revisions).some(r=>!r||typeof r!="object"||r.revision!==void 0&&typeof r.revision!="string"||r.sourceToken!==void 0&&typeof r.sourceToken!="string"))throw new a.ReportSourceError("validate","准备结果修订无效");if(e.layout&&(!["heuristic","provided","font-bytes"].includes(e.layout.textMetrics)||e.layout.fontFingerprint!==void 0&&!/^[a-f0-9]{64}$/.test(e.layout.fontFingerprint)))throw new a.ReportSourceError("validate","准备结果字体度量标识无效")}function E(e){if(e.layoutPolicy!==void 0&&!["verify","preserve"].includes(e.layoutPolicy))throw new a.ReportSourceError("validate","无效的 layoutPolicy");if(e.format!=="pdf")return;if(e.layoutPolicy==="preserve"&&!e.prepared.layout?.fontFingerprint){f(e.prepared,[{code:"prepared-layout-preserved",severity:"info",message:"显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。"}]);return}const r=e.prepared.layout?.fontFingerprint,t=y(e.pdf);if(r===t&&(r!==void 0||e.prepared.layout?.textMetrics==="heuristic"&&!t))return;const o="已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";if(e.fidelity==="strict")throw new a.ReportSourceError("validate",o);f(e.prepared,[{code:"prepared-font-metrics",severity:"warning",message:o}])}exports.appendPreparedDiagnostics=f;exports.assertPreparedOutputBudget=P;exports.capturePreparedHandoff=A;exports.checkPreparedFont=E;exports.matchingDiagnosticSummary=m;exports.mergeDiagnosticMessages=b;exports.reportFontFingerprint=y;exports.snapshotPdfFonts=I;exports.snapshotPreparedReport=h;exports.snapshotXlsxOptions=F;exports.validPreparedSources=v;exports.validReportDiagnosticLocation=l;exports.validatePreparedMetadata=w;
@@ -1,5 +1,5 @@
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";
1
+ import { v as g, R as a, s as y } from "./json-snapshot-CBVWZvyC.js";
2
+ import { H as v, x as h, G as w } from "./diagnostic-collector-gB07PHy2.js";
3
3
  import { R as d, b, t as c, p as u } from "./sha256-BDQ1Qk7A.js";
4
4
  import { s as x, a as F } from "./workbook-sheets-D4M7XXBh.js";
5
5
  function l(e, t, r, o) {
@@ -0,0 +1 @@
1
+ "use strict";const f=require("./json-snapshot-DCFEtfFw.cjs"),s=require("./diagnostic-collector-wASg6Fzs.cjs"),g=require("./runtime-BRx8Agqr.cjs"),n="mach-report-worker/1";class u extends Error{constructor(e){super(e.message),this.name=e.name,this.code=e.code,this.path=e.path,this.issues=e.issues,this.diagnostics=e.diagnostics,this.diagnosticSummary=e.diagnosticSummary,this.issueSummary=e.issueSummary}}function i(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function l(t,e){return g.validReportExecutionResult(t,e)}function m(t){if(!t||typeof t!="object")return{message:String(t).slice(0,4096)};const e={};for(const r of["code","path","field","message"]){const o=t[r];typeof o=="string"&&(e[r]=o.slice(0,r==="code"?128:4096))}return e}function R(t){const e=m(t);if(!i(t))return e;for(const r of["format","severity","kind","nid"])typeof t[r]=="string"&&(e[r]=t[r].slice(0,4096));for(const r of["pageIndex","componentIndex"])Number.isSafeInteger(t[r])&&t[r]>=0&&(e[r]=t[r]);if(f.hasValidDataExplanation(t)&&t.valueState!==void 0&&i(t.target)){e.valueState=t.valueState;const r={};for(const o of["datasetId","field","rowKey","tableId","reportScope"])t.target[o]!==void 0&&(r[o]=t.target[o]);e.target=r}return i(t.extension)&&typeof t.extension.id=="string"&&typeof t.extension.version=="string"&&(e.extension={id:t.extension.id.slice(0,128),version:t.extension.version.slice(0,64)}),Array.isArray(t.componentPath)&&t.componentPath.length<=192&&t.componentPath.every(r=>Number.isSafeInteger(r)&&r>=0)&&(e.componentPath=t.componentPath),e}function d(t){return{code:i(t)&&typeof t.code=="string"?t.code:"unknown",value:t,...i(t)&&t.valueState!==void 0&&f.hasValidDataExplanation(t)?{valueState:t.valueState}:{}}}function p(t,e,r){const o=s.createDiagnosticCollector(s.DEFAULT_DIAGNOSTIC_LIMIT);if(s.validDiagnosticSummary(r))o.merge({...r,entries:r.entries.slice(0,s.DEFAULT_DIAGNOSTIC_LIMIT).map(d)});else for(const a of t)o.push(d(a));const c=o.snapshot();return{...c,entries:c.entries.map(a=>e(a.value))}}function y(t){if(!(t instanceof Error))return{name:"Error",message:String(t).slice(0,8192)};const e=t,r=Array.isArray(e.diagnostics)?p(e.diagnostics,R,e.diagnosticSummary):void 0,o=Array.isArray(e.issues)?p(e.issues,m):void 0;return{name:t.name.slice(0,128),message:t.message.slice(0,8192),...typeof e.code=="string"?{code:e.code.slice(0,128)}:{},...typeof e.path=="string"?{path:e.path.slice(0,4096)}:{},...o?{issues:o.entries,...o.omitted?{issueSummary:o}:{}}:{},...r?{diagnostics:r.entries,...r.omitted||e.diagnosticSummary!==void 0?{diagnosticSummary:r}:{}}:{}}}function I(t){if(!t||typeof t!="object")return!1;const e=t;return e.protocol===n&&typeof e.id=="string"&&(e.operation==="prepare"||e.operation==="export"||e.operation==="exportPrepared")&&!!e.input&&typeof e.input=="object"}async function h(t,e,r){try{const o=e.operation==="prepare"?await t.prepare({...e.input,onEvent:r}):e.operation==="exportPrepared"?await t.exportPrepared({...e.input,onEvent:r}):await t.export({...e.input,onEvent:r});return{protocol:n,id:e.id,result:o}}catch(o){return{protocol:n,id:e.id,error:y(o)}}}function k(t){const e=t.result;return!e||!("bytes"in e)||!(e.bytes.buffer instanceof ArrayBuffer)?[]:[e.bytes.buffer]}function S(t,e){if(!i(t)||typeof t.taskId!="string"||!t.taskId||e.taskId!==void 0&&t.taskId!==e.taskId||t.correlationId!==e.correlationId||t.reportId!==void 0&&(typeof t.reportId!="string"||!("reportIds"in e&&e.reportIds.includes(t.reportId)))||!["query","validate","layout","assets","encode"].includes(t.stage)||!["started","completed","failed"].includes(t.status))return!1;for(const r of["completed","total"])if(t[r]!==void 0&&(typeof t[r]!="number"||!Number.isFinite(t[r])||t[r]<0))return!1;return t.completed===void 0||t.total===void 0||t.completed<=t.total}exports.REPORT_WORKER_PROTOCOL=n;exports.ReportWorkerError=u;exports.isReportWorkerRequest=I;exports.reportWorkerTransferList=k;exports.runReportWorkerRequest=h;exports.serializeError=y;exports.validReportWorkerEvent=S;exports.validReportWorkerResult=l;
@@ -0,0 +1,96 @@
1
+ import { v as p } from "./json-snapshot-CBVWZvyC.js";
2
+ import { x as y, H as g, G as c } from "./diagnostic-collector-gB07PHy2.js";
3
+ import { v as u } from "./runtime-B5d_lQNQ.js";
4
+ const n = "mach-report-worker/1";
5
+ class x extends Error {
6
+ constructor(e) {
7
+ super(e.message), this.name = e.name, this.code = e.code, this.path = e.path, this.issues = e.issues, this.diagnostics = e.diagnostics, this.diagnosticSummary = e.diagnosticSummary, this.issueSummary = e.issueSummary;
8
+ }
9
+ }
10
+ function s(t) {
11
+ return !!t && typeof t == "object" && !Array.isArray(t);
12
+ }
13
+ function b(t, e) {
14
+ return u(t, e);
15
+ }
16
+ function m(t) {
17
+ if (!t || typeof t != "object") return { message: String(t).slice(0, 4096) };
18
+ const e = {};
19
+ for (const o of ["code", "path", "field", "message"]) {
20
+ const r = t[o];
21
+ typeof r == "string" && (e[o] = r.slice(0, o === "code" ? 128 : 4096));
22
+ }
23
+ return e;
24
+ }
25
+ function l(t) {
26
+ const e = m(t);
27
+ if (!s(t)) return e;
28
+ for (const o of ["format", "severity", "kind", "nid"]) typeof t[o] == "string" && (e[o] = t[o].slice(0, 4096));
29
+ for (const o of ["pageIndex", "componentIndex"]) Number.isSafeInteger(t[o]) && t[o] >= 0 && (e[o] = t[o]);
30
+ if (p(t) && t.valueState !== void 0 && s(t.target)) {
31
+ e.valueState = t.valueState;
32
+ const o = {};
33
+ for (const r of ["datasetId", "field", "rowKey", "tableId", "reportScope"]) t.target[r] !== void 0 && (o[r] = t.target[r]);
34
+ e.target = o;
35
+ }
36
+ return s(t.extension) && typeof t.extension.id == "string" && typeof t.extension.version == "string" && (e.extension = { id: t.extension.id.slice(0, 128), version: t.extension.version.slice(0, 64) }), Array.isArray(t.componentPath) && t.componentPath.length <= 192 && t.componentPath.every((o) => Number.isSafeInteger(o) && o >= 0) && (e.componentPath = t.componentPath), e;
37
+ }
38
+ function d(t) {
39
+ return {
40
+ code: s(t) && typeof t.code == "string" ? t.code : "unknown",
41
+ value: t,
42
+ ...s(t) && t.valueState !== void 0 && p(t) ? { valueState: t.valueState } : {}
43
+ };
44
+ }
45
+ function f(t, e, o) {
46
+ const r = y(c);
47
+ if (g(o))
48
+ r.merge({ ...o, entries: o.entries.slice(0, c).map(d) });
49
+ else for (const i of t) r.push(d(i));
50
+ const a = r.snapshot();
51
+ return { ...a, entries: a.entries.map((i) => e(i.value)) };
52
+ }
53
+ function h(t) {
54
+ if (!(t instanceof Error)) return { name: "Error", message: String(t).slice(0, 8192) };
55
+ const e = t, o = Array.isArray(e.diagnostics) ? f(e.diagnostics, l, e.diagnosticSummary) : void 0, r = Array.isArray(e.issues) ? f(e.issues, m) : void 0;
56
+ return {
57
+ name: t.name.slice(0, 128),
58
+ message: t.message.slice(0, 8192),
59
+ ...typeof e.code == "string" ? { code: e.code.slice(0, 128) } : {},
60
+ ...typeof e.path == "string" ? { path: e.path.slice(0, 4096) } : {},
61
+ ...r ? { issues: r.entries, ...r.omitted ? { issueSummary: r } : {} } : {},
62
+ ...o ? { diagnostics: o.entries, ...o.omitted || e.diagnosticSummary !== void 0 ? { diagnosticSummary: o } : {} } : {}
63
+ };
64
+ }
65
+ function R(t) {
66
+ if (!t || typeof t != "object") return !1;
67
+ const e = t;
68
+ return e.protocol === n && typeof e.id == "string" && (e.operation === "prepare" || e.operation === "export" || e.operation === "exportPrepared") && !!e.input && typeof e.input == "object";
69
+ }
70
+ async function A(t, e, o) {
71
+ try {
72
+ const r = e.operation === "prepare" ? await t.prepare({ ...e.input, onEvent: o }) : e.operation === "exportPrepared" ? await t.exportPrepared({ ...e.input, onEvent: o }) : await t.export({ ...e.input, onEvent: o });
73
+ return { protocol: n, id: e.id, result: r };
74
+ } catch (r) {
75
+ return { protocol: n, id: e.id, error: h(r) };
76
+ }
77
+ }
78
+ function E(t) {
79
+ const e = t.result;
80
+ return !e || !("bytes" in e) || !(e.bytes.buffer instanceof ArrayBuffer) ? [] : [e.bytes.buffer];
81
+ }
82
+ function P(t, e) {
83
+ if (!s(t) || typeof t.taskId != "string" || !t.taskId || e.taskId !== void 0 && t.taskId !== e.taskId || t.correlationId !== e.correlationId || t.reportId !== void 0 && (typeof t.reportId != "string" || !("reportIds" in e && e.reportIds.includes(t.reportId))) || !["query", "validate", "layout", "assets", "encode"].includes(t.stage) || !["started", "completed", "failed"].includes(t.status)) return !1;
84
+ for (const o of ["completed", "total"]) if (t[o] !== void 0 && (typeof t[o] != "number" || !Number.isFinite(t[o]) || t[o] < 0)) return !1;
85
+ return t.completed === void 0 || t.total === void 0 || t.completed <= t.total;
86
+ }
87
+ export {
88
+ n as R,
89
+ E as a,
90
+ x as b,
91
+ b as c,
92
+ R as i,
93
+ A as r,
94
+ h as s,
95
+ P as v
96
+ };
@@ -0,0 +1 @@
1
+ "use strict";const l=require("./diagnostic-collector-wASg6Fzs.cjs"),y=require("./charts-Cjw5AYkg.cjs"),g=require("./computed-DK6BruFz.cjs");function C(e){if(!e||e.kind==="date")return;const t=e.digits;if(!(t!==void 0&&(!Number.isInteger(t)||t<0||t>100))){if(e.kind==="percent"){const r=t??2;return`0${r?`.${"0".repeat(r)}`:""}%`}return t===void 0?e.thousands?"#,##0.###############":void 0:`${e.thousands?"#,##0":"0"}${t?`.${"0".repeat(t)}`:""}`}}function S(e){const t=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());if(t){const i=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(i.getTime())?null:i}const r=new Date(e);return Number.isNaN(r.getTime())?null:r}function f(e,t){return e.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t})}function x(e,t){const r=i=>String(i).padStart(2,"0");return t.replace(/YYYY/g,String(e.getFullYear())).replace(/MM/g,r(e.getMonth()+1)).replace(/DD/g,r(e.getDate())).replace(/hh/g,r(e.getHours())).replace(/mm/g,r(e.getMinutes())).replace(/ss/g,r(e.getSeconds()))}function A(e,t,r){return r!=null?t?f(e,r):e.toFixed(r):t?f(e):String(e)}function c(e){const t=typeof e=="number"?e:Number(String(e).replace(/,/g,""));return Number.isFinite(t)?t:null}function p(e,t){if(e==null||e===""||!t)return String(e??"");switch(t.kind){case"number":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits,t.thousands===!0)}catch{return e}const r=c(e);return r==null?String(e):A(r,t.thousands===!0,t.digits)}case"percent":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits??2,!0,!0)}catch{return e}const r=c(e);return r==null?String(e):`${f(r*100,t.digits??2)}%`}case"date":{const r=t.pattern??"YYYY-MM-DD",i=e instanceof Date?e:S(String(e));return i?x(i,r):String(e)}default:return String(e)}}function h(e,t){return g.compileReportPredicate(t)(e)}function M(e,t,r,i=e.paddingMm??1){return t.field!==e.tree.labelField?0:Math.min(r.depth*(e.tree.indentMm??3),Math.max(0,t.widthMm-i*2-4))}function L(e,t,r,i){const n=i.tree;(n.input==="nested"||[n.idField,n.parentField].includes(t.field))&&(e.editable=!1),r.hasChildren&&n.parentValues==="leaf-aggregate"&&n.aggregates?.some(a=>a.field===t.field)&&(e.derived=!0,e.editable=!1)}function T(e,t,r,i){return r==="identifier"||r==="dimension"||r==="date"||r==="measure"?"center":r==="text"?"left":l.automaticCellAlignment(e,t?.kind==="number"||t?.kind==="percent"||t?.kind==="date"||i==="number"||i==="boolean")}function w(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="boolean")return e?"是":"否";if(e instanceof Date)return e.toISOString().slice(0,10);try{return JSON.stringify(e)}catch{return String(e)}}function P(e,t){let r=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,bold:e.headerBold??!0,align:"center",verticalAlign:"middle",backgroundColor:e.headerBackgroundColor},t.style);return e.headerAlign!==void 0&&(r.align=e.headerAlign),r=l.mergeComponentStyles(r,e.headerStyle),t.headerAlign!==void 0&&(r.align=t.headerAlign),l.mergeComponentStyles(r,t.headerStyle)}function F(e,t,r){(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r))&&(e.value=r);const i=t.format?.kind==="number"||t.format?.kind==="percent";t.valueType!==void 0?e.valueType=t.valueType:i&&(e.valueType="number"),t.editable!==void 0&&(e.editable=t.editable);const n=C(t.format);(typeof e.value=="number"||e.value==null)&&n!==void 0&&(e.numberFormat=n)}function E(e,t,r){const i=!!t.visibleWhen&&!h(r,t.visibleWhen),n=i?null:r[t.field],a=t.align??t.style?.align??e.align??"auto";let s=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,verticalAlign:"middle"},t.style);s.align=a==="auto"?T(n,t.format,t.semanticRole,t.valueType):a;const o=t.rules?.find(u=>h(r,u.when));o&&(s=l.mergeComponentStyles(s,o.style));const d={text:t.format?p(n,t.format):w(n),style:s};return F(d,t,n),e.computed?.some(u=>u.field===t.field)&&(d.derived=!0,d.editable=!1),i&&(d.editable=!1),d}function R(e,t,r){const i=E(e,t,r.row),n=M(e,t,r);return t.field===e.tree.labelField&&(i.style={...i.style,align:"left"}),n&&(i.indentMm=n),L(i,t,r,e),i}class I extends Error{constructor(t,r){super(`报表页数超出上限 ${t}(至少 ${r} 页)`),this.limit=t,this.actual=r,this.code="page-limit",this.name="PaginatePageLimitError"}}class O extends Error{constructor(t,r){super(`报表单元格数量超出上限 ${t}(至少 ${r} 格)`),this.limit=t,this.actual=r,this.code="cell-limit",this.name="PaginateCellLimitError"}}class N extends Error{constructor(t,r){super(`报表图表图元数量预计超出上限 ${t}(本次估算 ${r})`),this.limit=t,this.estimated=r,this.code="chart-component-limit",this.name="PaginateChartComponentLimitError"}}const b=5e4;function D(e=b){if(!Number.isSafeInteger(e)||e<1||e>1e6)throw new RangeError("maxChartComponents 应为 1..1000000 的安全整数")}function v(e,t,r){const i=e.chartBinding;if(e.kind!=="chart"||e.grid||e.imageData||e.binding||e.pageAnchor)throw new TypeError("绑定图表不能同时设置图片、网格、记录绑定或页眉页脚");const n=Object.prototype.hasOwnProperty.call(t,i.dataset)?t[i.dataset]:void 0;if(!Array.isArray(n))throw new TypeError(`图表数据集 ${i.dataset} 未提供`);return{...g.createReportChartData(n,i,r),type:i.type,leftMm:e.leftMm,topMm:e.topMm,widthMm:e.widthMm,heightMm:e.heightMm,title:i.title,showValues:i.showValues}}function k(e,t,r=b){D(r);let i=0;return Object.assign(a=>{if(!a.chartBinding)return[a];const s=v(a,e,t),o=i+(s.categories.length?y.chartComponentUpperBound(s):1);if(!Number.isSafeInteger(o))throw new RangeError("图表图元估算应为有限安全整数");if(o>r)throw new N(r,o);const d=s.categories.length?y.createChartComponents(s):[{kind:"text",leftMm:a.leftMm,topMm:a.topMm,widthMm:a.widthMm,heightMm:a.heightMm,text:"—",style:{align:"center",verticalAlign:"middle",color:"#94a3b8",fontSize:10}}];return i+=d.length,d},{used:()=>i})}function B(e){return typeof e=="string"&&/^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e)}class m extends Error{constructor(t,r,i,n){super(`${t}: ${r}`),this.path=t,this.rowIndex=i,this.field=n,this.code="report-binding",this.name="ReportBindingError"}}function $(e,t,r={}){const i=r.rowIndex??0,a=`$.datasets.${r.dataset??"label"}[${i}].${t}`,s=Object.getOwnPropertyDescriptor(e,t);if(!s||s.get||s.set)throw new m(a,"字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承",i,t);const o=s.value;if(o==null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;throw new m(a,"绑定值应为字符串、有限数字、布尔值或空值",i,t)}function _(e,t,r={}){const i=$(t,e.field,r);return i==null||i===""?e.emptyText??"":`${e.prefix??""}${p(i,e.format)}${e.suffix??""}`}exports.DEFAULT_CHART_COMPONENT_LIMIT=b;exports.PaginateCellLimitError=O;exports.PaginateChartComponentLimitError=N;exports.PaginatePageLimitError=I;exports.ReportBindingError=m;exports.applyListTreeMetadata=L;exports.createChartResolver=k;exports.evalStyleRule=h;exports.formatValue=p;exports.isLabelImageData=B;exports.listCellText=w;exports.listTreeIndent=M;exports.parseDateLocal=S;exports.readRecordScalar=$;exports.resolveComponentBinding=_;exports.resolveListAutoAlignment=T;exports.resolveListHeaderStyle=P;exports.resolveListSampleCell=E;exports.resolveTreeListSampleCell=R;exports.toExcelNumberFormat=C;exports.toNumber=c;exports.validateChartComponentLimit=D;
@@ -1,6 +1,6 @@
1
- import { m as f, j as m } from "./diagnostic-collector-1sqd7DQP.js";
2
- import { a as S, c as M } from "./charts-CxJZ0XaY.js";
3
- import { n as w, i as l, f as C } from "./computed-f3pOqWLX.js";
1
+ import { m as f, k as m, I as S } from "./diagnostic-collector-gB07PHy2.js";
2
+ import { a as M, c as w } from "./charts-CxJZ0XaY.js";
3
+ import { n as C, i as g, f as $ } from "./computed-f3pOqWLX.js";
4
4
  function N(e) {
5
5
  if (!e || e.kind === "date") return;
6
6
  const t = e.digits;
@@ -12,7 +12,7 @@ function N(e) {
12
12
  return t === void 0 ? e.thousands ? "#,##0.###############" : void 0 : `${e.thousands ? "#,##0" : "0"}${t ? `.${"0".repeat(t)}` : ""}`;
13
13
  }
14
14
  }
15
- function $(e) {
15
+ function x(e) {
16
16
  const t = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());
17
17
  if (t) {
18
18
  const i = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
@@ -31,7 +31,7 @@ function D(e, t) {
31
31
  const r = (i) => String(i).padStart(2, "0");
32
32
  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()));
33
33
  }
34
- function x(e, t, r) {
34
+ function T(e, t, r) {
35
35
  return r != null ? t ? u(e, r) : e.toFixed(r) : t ? u(e) : String(e);
36
36
  }
37
37
  function c(e) {
@@ -44,17 +44,17 @@ function b(e, t) {
44
44
  case "number": {
45
45
  if (typeof e == "string")
46
46
  try {
47
- return l(e, t.digits, t.thousands === !0);
47
+ return g(e, t.digits, t.thousands === !0);
48
48
  } catch {
49
49
  return e;
50
50
  }
51
51
  const r = c(e);
52
- return r == null ? String(e) : x(r, t.thousands === !0, t.digits);
52
+ return r == null ? String(e) : T(r, t.thousands === !0, t.digits);
53
53
  }
54
54
  case "percent": {
55
55
  if (typeof e == "string")
56
56
  try {
57
- return l(e, t.digits ?? 2, !0, !0);
57
+ return g(e, t.digits ?? 2, !0, !0);
58
58
  } catch {
59
59
  return e;
60
60
  }
@@ -62,7 +62,7 @@ function b(e, t) {
62
62
  return r == null ? String(e) : `${u(r * 100, t.digits ?? 2)}%`;
63
63
  }
64
64
  case "date": {
65
- const r = t.pattern ?? "YYYY-MM-DD", i = e instanceof Date ? e : $(String(e));
65
+ const r = t.pattern ?? "YYYY-MM-DD", i = e instanceof Date ? e : x(String(e));
66
66
  return i ? D(i, r) : String(e);
67
67
  }
68
68
  default:
@@ -70,19 +70,19 @@ function b(e, t) {
70
70
  }
71
71
  }
72
72
  function h(e, t) {
73
- return w(t)(e);
73
+ return C(t)(e);
74
74
  }
75
- function T(e, t, r, i = e.paddingMm ?? 1) {
75
+ function E(e, t, r, i = e.paddingMm ?? 1) {
76
76
  return t.field !== e.tree.labelField ? 0 : Math.min(r.depth * (e.tree.indentMm ?? 3), Math.max(0, t.widthMm - i * 2 - 4));
77
77
  }
78
- function E(e, t, r, i) {
78
+ function L(e, t, r, i) {
79
79
  const n = i.tree;
80
80
  (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);
81
81
  }
82
- function F(e, t, r) {
83
- 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";
82
+ function A(e, t, r, i) {
83
+ return r === "identifier" || r === "dimension" || r === "date" || r === "measure" ? "center" : r === "text" ? "left" : S(e, t?.kind === "number" || t?.kind === "percent" || t?.kind === "date" || i === "number" || i === "boolean");
84
84
  }
85
- function L(e) {
85
+ function F(e) {
86
86
  if (e == null) return "";
87
87
  if (typeof e == "string" || typeof e == "number") return String(e);
88
88
  if (typeof e == "boolean") return e ? "是" : "否";
@@ -93,7 +93,7 @@ function L(e) {
93
93
  return String(e);
94
94
  }
95
95
  }
96
- function z(e, t) {
96
+ function j(e, t) {
97
97
  let r = f({ fontSize: e.fontSizePt ?? m, bold: e.headerBold ?? !0, align: "center", verticalAlign: "middle", backgroundColor: e.headerBackgroundColor }, t.style);
98
98
  return e.headerAlign !== void 0 && (r.align = e.headerAlign), r = f(r, e.headerStyle), t.headerAlign !== void 0 && (r.align = t.headerAlign), f(r, t.headerStyle);
99
99
  }
@@ -104,18 +104,18 @@ function P(e, t, r) {
104
104
  const n = N(t.format);
105
105
  (typeof e.value == "number" || e.value == null) && n !== void 0 && (e.numberFormat = n);
106
106
  }
107
- function A(e, t, r) {
108
- const i = !!t.visibleWhen && !h(r, t.visibleWhen), n = i ? null : r[t.field], a = t.align ?? t.style?.align ?? e.align ?? "left";
107
+ function k(e, t, r) {
108
+ const i = !!t.visibleWhen && !h(r, t.visibleWhen), n = i ? null : r[t.field], a = t.align ?? t.style?.align ?? e.align ?? "auto";
109
109
  let s = f({ fontSize: e.fontSizePt ?? m, verticalAlign: "middle" }, t.style);
110
- s.align = a === "auto" ? F(n, t.format, t.semanticRole) : a;
111
- const o = t.rules?.find((g) => h(r, g.when));
110
+ s.align = a === "auto" ? A(n, t.format, t.semanticRole, t.valueType) : a;
111
+ const o = t.rules?.find((l) => h(r, l.when));
112
112
  o && (s = f(s, o.style));
113
- const d = { text: t.format ? b(n, t.format) : L(n), style: s };
114
- return P(d, t, n), e.computed?.some((g) => g.field === t.field) && (d.derived = !0, d.editable = !1), i && (d.editable = !1), d;
113
+ const d = { text: t.format ? b(n, t.format) : F(n), style: s };
114
+ return P(d, t, n), e.computed?.some((l) => l.field === t.field) && (d.derived = !0, d.editable = !1), i && (d.editable = !1), d;
115
115
  }
116
116
  function V(e, t, r) {
117
- const i = A(e, t, r.row), n = T(e, t, r);
118
- return t.field === e.tree.labelField && (i.style = { ...i.style, align: "left" }), n && (i.indentMm = n), E(i, t, r, e), i;
117
+ const i = k(e, t, r.row), n = E(e, t, r);
118
+ return t.field === e.tree.labelField && (i.style = { ...i.style, align: "left" }), n && (i.indentMm = n), L(i, t, r, e), i;
119
119
  }
120
120
  class _ extends Error {
121
121
  constructor(t, r) {
@@ -127,7 +127,7 @@ class U extends Error {
127
127
  super(`报表单元格数量超出上限 ${t}(至少 ${r} 格)`), this.limit = t, this.actual = r, this.code = "cell-limit", this.name = "PaginateCellLimitError";
128
128
  }
129
129
  }
130
- class k extends Error {
130
+ class I extends Error {
131
131
  constructor(t, r) {
132
132
  super(`报表图表图元数量预计超出上限 ${t}(本次估算 ${r})`), this.limit = t, this.estimated = r, this.code = "chart-component-limit", this.name = "PaginateChartComponentLimitError";
133
133
  }
@@ -136,26 +136,26 @@ const y = 5e4;
136
136
  function R(e = y) {
137
137
  if (!Number.isSafeInteger(e) || e < 1 || e > 1e6) throw new RangeError("maxChartComponents 应为 1..1000000 的安全整数");
138
138
  }
139
- function I(e, t, r) {
139
+ function O(e, t, r) {
140
140
  const i = e.chartBinding;
141
141
  if (e.kind !== "chart" || e.grid || e.imageData || e.binding || e.pageAnchor) throw new TypeError("绑定图表不能同时设置图片、网格、记录绑定或页眉页脚");
142
142
  const n = Object.prototype.hasOwnProperty.call(t, i.dataset) ? t[i.dataset] : void 0;
143
143
  if (!Array.isArray(n)) throw new TypeError(`图表数据集 ${i.dataset} 未提供`);
144
- return { ...C(n, i, r), type: i.type, leftMm: e.leftMm, topMm: e.topMm, widthMm: e.widthMm, heightMm: e.heightMm, title: i.title, showValues: i.showValues };
144
+ return { ...$(n, i, r), type: i.type, leftMm: e.leftMm, topMm: e.topMm, widthMm: e.widthMm, heightMm: e.heightMm, title: i.title, showValues: i.showValues };
145
145
  }
146
- function v(e, t, r = y) {
146
+ function H(e, t, r = y) {
147
147
  R(r);
148
148
  let i = 0;
149
149
  return Object.assign((a) => {
150
150
  if (!a.chartBinding) return [a];
151
- const s = I(a, e, t), o = i + (s.categories.length ? S(s) : 1);
151
+ const s = O(a, e, t), o = i + (s.categories.length ? M(s) : 1);
152
152
  if (!Number.isSafeInteger(o)) throw new RangeError("图表图元估算应为有限安全整数");
153
- if (o > r) throw new k(r, o);
154
- const d = s.categories.length ? M(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 } }];
153
+ if (o > r) throw new I(r, o);
154
+ const d = s.categories.length ? w(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 } }];
155
155
  return i += d.length, d;
156
156
  }, { used: () => i });
157
157
  }
158
- function H(e) {
158
+ function W(e) {
159
159
  return typeof e == "string" && /^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e);
160
160
  }
161
161
  class p extends Error {
@@ -163,15 +163,15 @@ class p extends Error {
163
163
  super(`${t}: ${r}`), this.path = t, this.rowIndex = i, this.field = n, this.code = "report-binding", this.name = "ReportBindingError";
164
164
  }
165
165
  }
166
- function O(e, t, r = {}) {
166
+ function Y(e, t, r = {}) {
167
167
  const i = r.rowIndex ?? 0, a = `$.datasets.${r.dataset ?? "label"}[${i}].${t}`, s = Object.getOwnPropertyDescriptor(e, t);
168
168
  if (!s || s.get || s.set) throw new p(a, "字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承", i, t);
169
169
  const o = s.value;
170
170
  if (o == null || typeof o == "string" || typeof o == "boolean" || typeof o == "number" && Number.isFinite(o)) return o;
171
171
  throw new p(a, "绑定值应为字符串、有限数字、布尔值或空值", i, t);
172
172
  }
173
- function W(e, t, r = {}) {
174
- const i = O(t, e.field, r);
173
+ function J(e, t, r = {}) {
174
+ const i = Y(t, e.field, r);
175
175
  return i == null || i === "" ? e.emptyText ?? "" : `${e.prefix ?? ""}${b(i, e.format)}${e.suffix ?? ""}`;
176
176
  }
177
177
  export {
@@ -179,22 +179,22 @@ export {
179
179
  U as P,
180
180
  p as R,
181
181
  V as a,
182
- W as b,
183
- v as c,
184
- z as d,
185
- k as e,
182
+ J as b,
183
+ H as c,
184
+ j as d,
185
+ I as e,
186
186
  _ as f,
187
187
  h as g,
188
188
  b as h,
189
- H as i,
189
+ W as i,
190
190
  c as j,
191
- O as k,
192
- L as l,
193
- F as m,
194
- T as n,
195
- E as o,
196
- $ as p,
197
- A as r,
191
+ Y as k,
192
+ F as l,
193
+ A as m,
194
+ E as n,
195
+ L as o,
196
+ x as p,
197
+ k as r,
198
198
  N as t,
199
199
  R as v
200
200
  };