@agile-team/mach-report 2.21.1 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +20 -5
  2. package/dist/{ExcelBindingWizard-mnAO2qOX.js → ExcelBindingWizard-D4FLind-.js} +3 -3
  3. package/dist/{ExcelBindingWizard-Bu0LUlzl.cjs → ExcelBindingWizard-D4RS5Bpg.cjs} +1 -1
  4. package/dist/{ParamEditor-38ZfNrPU.cjs → ParamEditor-C-6C9rd2.cjs} +1 -1
  5. package/dist/{ParamEditor-C8l0EC8m.js → ParamEditor-CASZt-Ma.js} +2 -2
  6. package/dist/{ReportBatchPanel-CfUVhvkO.js → ReportBatchPanel-Bq7t8a5r.js} +2 -2
  7. package/dist/{ReportBatchPanel-nCC06Nfp.cjs → ReportBatchPanel-YVj5IO5y.cjs} +1 -1
  8. package/dist/ReportLabelStudio-Cqhita1b.cjs +1 -0
  9. package/dist/ReportLabelStudio-Dj7GXhuv.js +783 -0
  10. package/dist/ReportParamPanel-DZbFVmDL.cjs +1 -0
  11. package/dist/{ReportParamPanel-peB-KEmm.js → ReportParamPanel-Dgmqro1Y.js} +265 -244
  12. package/dist/ReportPreview-DeWzG8jQ.js +6257 -0
  13. package/dist/ReportPreview-FFIryrIr.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-DVlsf72p.cjs → ReportTemplateLibrary-BaWodmpm.cjs} +1 -1
  15. package/dist/{ReportTemplateLibrary-B5t_EcIs.js → ReportTemplateLibrary-DdAAAD2I.js} +1 -1
  16. package/dist/{RuleEditor-kT1JsZ9f.js → RuleEditor-D2UwQGF6.js} +59 -59
  17. package/dist/{RuleEditor-xFkCVlii.cjs → RuleEditor-DcT9xI1v.cjs} +1 -1
  18. package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +1 -0
  19. package/dist/{TemplateOutlinePanel-BesgGR1P.js → TemplateOutlinePanel-DrT7XN0m.js} +2 -2
  20. package/dist/{TemplateReusePanel-BNFU6V-W.js → TemplateReusePanel-4eejkNqi.js} +2 -2
  21. package/dist/{TemplateReusePanel-BG9Or5-P.cjs → TemplateReusePanel-DZMyiX5I.cjs} +1 -1
  22. package/dist/{TemplateReviewPanel-CwvwyCSs.js → TemplateReviewPanel-BIhNLeNw.js} +2 -2
  23. package/dist/TemplateReviewPanel-DnYImiXu.cjs +1 -0
  24. package/dist/analytics.cjs +1 -1
  25. package/dist/analytics.js +26 -26
  26. package/dist/artifact-integrity.json +108 -106
  27. package/dist/assets-D2gHc4Mz.cjs +1 -0
  28. package/dist/assets-T_gDeFaz.js +132 -0
  29. package/dist/auto-4pK9HePf.cjs +1 -0
  30. package/dist/auto-CTIJ6PnR.js +257 -0
  31. package/dist/capabilities-DiBj4Qgl.cjs +1 -0
  32. package/dist/capabilities-pg7j7VLT.js +106 -0
  33. package/dist/charts-Cjw5AYkg.cjs +1 -0
  34. package/dist/{charts-Dlv8j2AG.js → charts-CxJZ0XaY.js} +1 -1
  35. package/dist/computed-DK6BruFz.cjs +1 -0
  36. package/dist/{computed-C8NRZQss.js → computed-f3pOqWLX.js} +381 -301
  37. package/dist/data-bar-CeZuFmYl.cjs +1 -0
  38. package/dist/{data-bar-8baGYEZ9.js → data-bar-IkI6VvMQ.js} +1 -1
  39. package/dist/designer-DhrE7jzw.js +7169 -0
  40. package/dist/designer-IAZu6kBX.cjs +2 -0
  41. package/dist/designer.cjs +1 -1
  42. package/dist/designer.d.cts +246 -46
  43. package/dist/designer.d.ts +246 -46
  44. package/dist/designer.js +15 -14
  45. package/dist/dom-ChE5D-L-.cjs +1 -0
  46. package/dist/dom-JWrchIre.js +452 -0
  47. package/dist/dom-cell-address-DLD1mkTB.cjs +1 -0
  48. package/dist/dom-cell-address-Fn-8nk7D.js +11 -0
  49. package/dist/{encoding-B79hW4zq.cjs → encoding-BefcaHdp.cjs} +1 -1
  50. package/dist/{encoding-BSeUwrN7.js → encoding-CL6rXEkR.js} +2 -2
  51. package/dist/{font-loader-Di0lQKFf.js → font-loader-BT5baV-o.js} +1 -1
  52. package/dist/{font-loader-BB372_XN.cjs → font-loader-Ga51c2VC.cjs} +1 -1
  53. package/dist/grid-strokes-Be24LGuV.cjs +1 -0
  54. package/dist/grid-strokes-EoY66L2f.js +53 -0
  55. package/dist/index.cjs +8 -8
  56. package/dist/index.d.cts +44 -1
  57. package/dist/index.d.ts +44 -1
  58. package/dist/index.js +961 -1256
  59. package/dist/json-snapshot-1tvQNzQE.cjs +2 -0
  60. package/dist/{json-snapshot-Kgn459Oj.js → json-snapshot-OqkPyUk5.js} +763 -776
  61. package/dist/matrix-B8QWbsGM.cjs +1 -0
  62. package/dist/matrix-C6e_r_vp.js +302 -0
  63. package/dist/{pdf-CARdBcuw.cjs → pdf-HiEeXe9H.cjs} +42 -42
  64. package/dist/{pdf-DmlnL5eB.js → pdf-aobetCsy.js} +20 -20
  65. package/dist/pdf.cjs +1 -1
  66. package/dist/pdf.js +2 -2
  67. package/dist/{plugin-BaRUGORD.cjs → plugin-BFANt-i8.cjs} +1 -1
  68. package/dist/{plugin-D4kAxfLG.js → plugin-DeYYAL6F.js} +1 -1
  69. package/dist/{prefill-CJSazcVY.js → prefill-Dk4C6S5R.js} +21 -21
  70. package/dist/prefill-DsUD5OoK.cjs +1 -0
  71. package/dist/prepared-DCIxhKFo.js +94 -0
  72. package/dist/prepared-Dv-XM3i1.cjs +1 -0
  73. package/dist/progress-ByiOxUD3.js +250 -0
  74. package/dist/progress-WomPRP3B.cjs +1 -0
  75. package/dist/{protocol-C8VWF9An.cjs → protocol-B9YgfQ_d.cjs} +1 -1
  76. package/dist/{protocol-Bs9-ohHN.js → protocol-DxeUKGYG.js} +3 -3
  77. package/dist/record-bindings-DatJZv_e.js +200 -0
  78. package/dist/record-bindings-MBxbeBsi.cjs +1 -0
  79. package/dist/{region-binding-workflow-Cy4GIOUo.js → region-binding-workflow-DjrXuR1q.js} +2 -2
  80. package/dist/{region-binding-workflow-JNowHd0A.cjs → region-binding-workflow-l7NGfagJ.cjs} +2 -2
  81. package/dist/report-encoding-worker.cjs +1 -1
  82. package/dist/report-encoding-worker.js +1 -1
  83. package/dist/rich-text-layout-Ciwa6D2o.js +52 -0
  84. package/dist/rich-text-layout-DK7A_a5r.cjs +3 -0
  85. package/dist/{runtime-BDf5x1i1.js → runtime-75Y5Oq5B.js} +52 -51
  86. package/dist/runtime-DKlGd_D4.cjs +1 -0
  87. package/dist/sbom.cdx.json +1 -1
  88. package/dist/server/node.d.cts +9 -0
  89. package/dist/server/node.d.ts +9 -0
  90. package/dist/server-node.cjs +5 -4
  91. package/dist/server-node.js +2178 -2044
  92. package/dist/server.cjs +1 -1
  93. package/dist/server.d.cts +81 -0
  94. package/dist/server.d.ts +81 -0
  95. package/dist/server.js +24 -24
  96. package/dist/style.css +1 -1
  97. package/dist/{template-catalog-DFwIS9aN.js → template-catalog--cjxzgH7.js} +17 -17
  98. package/dist/template-catalog-CoT7jm_6.cjs +1 -0
  99. package/dist/{template-fragments-Dng-AlHk.js → template-fragments-CPpGpQoz.js} +24 -24
  100. package/dist/{template-fragments-DZVUBhuB.cjs → template-fragments-GVjpew_q.cjs} +1 -1
  101. package/dist/template-registry-DI59PXVK.cjs +1 -0
  102. package/dist/{template-registry-DhBqoD7W.js → template-registry-O0hNIOfB.js} +333 -261
  103. package/dist/template-serialization-CWmHq7lX.js +307 -0
  104. package/dist/template-serialization-CqQY4zDg.cjs +1 -0
  105. package/dist/{textwrap-CkGjRFT3.js → textwrap-BIjtEWmq.js} +1 -1
  106. package/dist/textwrap-Cy7o1hIR.cjs +4 -0
  107. package/dist/vue/async.d.cts +121 -2
  108. package/dist/vue/async.d.ts +121 -2
  109. package/dist/vue/index.d.cts +222 -5
  110. package/dist/vue/index.d.ts +222 -5
  111. package/dist/vue-async.cjs +1 -1
  112. package/dist/vue-async.js +3 -3
  113. package/dist/vue.cjs +1 -1
  114. package/dist/vue.js +101 -91
  115. package/dist/{workbook-session-NYv01LHe.cjs → workbook-session-C6-SrnCT.cjs} +4 -4
  116. package/dist/{workbook-session-oinxX3qo.js → workbook-session-C9ZmCBwY.js} +15 -16
  117. package/dist/workbook-sheets-CaPAulQ6.cjs +2 -0
  118. package/dist/workbook-sheets-D4M7XXBh.js +44 -0
  119. package/dist/worker.cjs +1 -1
  120. package/dist/worker.d.cts +9 -0
  121. package/dist/worker.d.ts +9 -0
  122. package/dist/worker.js +4 -4
  123. package/dist/xlsx.cjs +4 -4
  124. package/dist/xlsx.d.cts +39 -2
  125. package/dist/xlsx.d.ts +39 -2
  126. package/dist/xlsx.js +300 -275
  127. package/package.json +1 -1
  128. package/dist/ReportLabelStudio-CaEvYuSK.cjs +0 -1
  129. package/dist/ReportLabelStudio-DQPBmh4v.js +0 -765
  130. package/dist/ReportParamPanel-CVpK8mFc.cjs +0 -1
  131. package/dist/ReportPreview-BBJNlu2U.js +0 -5740
  132. package/dist/ReportPreview-nf4Dk1Jc.cjs +0 -6
  133. package/dist/TemplateOutlinePanel-CDI6mfWx.cjs +0 -1
  134. package/dist/TemplateReviewPanel-BmBrjt6P.cjs +0 -1
  135. package/dist/assets-CxHunY_9.js +0 -232
  136. package/dist/assets-vbjAGgk8.cjs +0 -1
  137. package/dist/auto-BkdGiNtr.js +0 -240
  138. package/dist/auto-Tq7ReIC1.cjs +0 -1
  139. package/dist/charts-aCtoswXq.cjs +0 -1
  140. package/dist/component-tree-1_QCiQJX.js +0 -67
  141. package/dist/component-tree-BjZIp6w9.cjs +0 -1
  142. package/dist/computed-4TnxzgIh.cjs +0 -1
  143. package/dist/data-bar-YltqGTaC.cjs +0 -1
  144. package/dist/designer-DU3yDWgs.cjs +0 -2
  145. package/dist/designer-HQi-03R6.js +0 -6869
  146. package/dist/grid-geometry-D3SJgWFv.js +0 -136
  147. package/dist/grid-geometry-D8ReblRV.cjs +0 -1
  148. package/dist/json-snapshot-I5VI84Vp.cjs +0 -2
  149. package/dist/matrix-0hywp0-F.cjs +0 -1
  150. package/dist/matrix-Dy-tyY7E.js +0 -381
  151. package/dist/prefill-Bpyn58AZ.cjs +0 -1
  152. package/dist/prepared-BiSz_9vN.cjs +0 -1
  153. package/dist/prepared-BwjwEzFz.js +0 -87
  154. package/dist/progress-B0ctFpKf.cjs +0 -1
  155. package/dist/progress-Hc2vxoCs.js +0 -52
  156. package/dist/record-bindings-Ct1HkPrc.cjs +0 -1
  157. package/dist/record-bindings-VZGS-Qd8.js +0 -155
  158. package/dist/rich-text-layout-K48VHUoW.cjs +0 -3
  159. package/dist/rich-text-layout-wxBhnAS7.js +0 -102
  160. package/dist/runtime-DsJt1PIf.cjs +0 -1
  161. package/dist/template-bindings-Cg5oBLFT.cjs +0 -1
  162. package/dist/template-bindings-TKnXM7ll.js +0 -62
  163. package/dist/template-catalog-D_2jdnkL.cjs +0 -1
  164. package/dist/template-outline-DWkzZXVC.cjs +0 -1
  165. package/dist/template-outline-DiADphlq.js +0 -88
  166. package/dist/template-registry-DpLUSLwF.cjs +0 -1
  167. package/dist/template-serialization-Cc3h-miv.js +0 -247
  168. package/dist/template-serialization-D1R5oAqh.cjs +0 -1
  169. package/dist/textwrap-OTOUMr4f.cjs +0 -4
@@ -1,13 +1,13 @@
1
- import "./font-loader-Di0lQKFf.js";
1
+ import "./font-loader-BT5baV-o.js";
2
2
  import { g as Z1 } from "./_commonjsHelpers-DaMA6jEr.js";
3
- import { h as Rd, w as Y1 } from "./textwrap-CkGjRFT3.js";
4
- import { d as J1 } from "./data-bar-8baGYEZ9.js";
5
- import { o as Q1, c as _1 } from "./progress-Hc2vxoCs.js";
6
- import { a as $1, r as eg, n as tg, O as rg } from "./assets-CxHunY_9.js";
7
- import { I as wl, c as ng } from "./media-Y90dHK9z.js";
8
- import { d as ig, r as ag } from "./rich-text-layout-wxBhnAS7.js";
9
- import { i as og, a as sg } from "./component-tree-1_QCiQJX.js";
10
- import { r as ug, a as pi, c as ss, e as Md, g as fg, f as cg } from "./grid-geometry-D3SJgWFv.js";
3
+ import { h as Rd, w as Y1 } from "./textwrap-BIjtEWmq.js";
4
+ import { d as J1 } from "./data-bar-IkI6VvMQ.js";
5
+ import { o as Q1, t as _1, i as $1, r as eg, f as tg, a as pi, b as ss, d as Md, m as rg, e as ng } from "./progress-ByiOxUD3.js";
6
+ import { r as ig, n as ag, O as og } from "./capabilities-pg7j7VLT.js";
7
+ import { I as wl, c as sg } from "./media-Y90dHK9z.js";
8
+ import { r as ug } from "./assets-T_gDeFaz.js";
9
+ import { r as fg } from "./grid-strokes-EoY66L2f.js";
10
+ import { d as cg } from "./rich-text-layout-Ciwa6D2o.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,8 +36084,8 @@ function tT(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), sg(r)) {
36088
- ig(r, n, {
36087
+ if (rc(t, a, i), tg(r)) {
36088
+ cg(r, n, {
36089
36089
  measure(f, l) {
36090
36090
  const h = W1(t, l), d = pi(l).fontSizePt;
36091
36091
  try {
@@ -36126,11 +36126,11 @@ 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 nT(t, e, r) {
36129
- const n = cg(e), i = r.x + r.width, a = r.yTop - r.height;
36129
+ const n = ng(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 iT(t, e, r, n) {
36133
- for (const i of ag(n, e)) {
36133
+ for (const i of fg(n, e)) {
36134
36134
  const a = { borderColor: i.color, lineWidthPt: i.widthPt };
36135
36135
  i.kind === "v" ? vi(
36136
36136
  t,
@@ -36146,7 +36146,7 @@ function iT(t, e, r, n) {
36146
36146
  }
36147
36147
  }
36148
36148
  async function aT(t, e, r, n, i, a) {
36149
- const o = fg(r.style, n.cell.style), s = {
36149
+ const o = rg(r.style, n.cell.style), s = {
36150
36150
  x: i.x + At(n.xMm),
36151
36151
  yTop: i.yTop - At(n.yMm),
36152
36152
  width: At(n.widthMm),
@@ -36181,7 +36181,7 @@ function oT(t, e, r, n, i, a) {
36181
36181
  o.length > u && t.fidelityWarnings.push(`${a}: 单元格文本超出可用高度,PDF 文本裁切;请增加行高或减少字号(${o.length} 行,可容纳 ${u} 行)`), G1(t, e, o.slice(0, Math.max(1, u)), { verticalAlign: "middle", ...n }, i);
36182
36182
  }
36183
36183
  async function sT(t, e, r, n, i) {
36184
- const a = ug(r.grid, r.widthMm, r.heightMm);
36184
+ const a = eg(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 aT(t, e, r, o, n, `${i} cell ${o.ri + 1}:${o.ci + 1}`);
@@ -36219,7 +36219,7 @@ function uT(t, e, r) {
36219
36219
  async function K1(t, e, r, n, i) {
36220
36220
  Ua(t.signal);
36221
36221
  const a = eT(r, n);
36222
- if (og(r)) {
36222
+ if ($1(r)) {
36223
36223
  const o = await rT(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;
@@ -36249,7 +36249,7 @@ async function fT(t, e) {
36249
36249
  embedding: r,
36250
36250
  measurer: e.measurer ?? Rd,
36251
36251
  imageCache: /* @__PURE__ */ new Map(),
36252
- inspectImage: ng(e),
36252
+ inspectImage: sg(e),
36253
36253
  fidelityWarnings: [],
36254
36254
  styleWarnings: /* @__PURE__ */ new Set(),
36255
36255
  unsupportedTextCount: 0
@@ -36263,9 +36263,9 @@ function X1(t, e, r) {
36263
36263
  return n || (n = t.embed(e), r.set(e, n)), n;
36264
36264
  }
36265
36265
  async function FT(t, e = {}) {
36266
- const r = await $1(t, { ...e, format: "pdf" });
36266
+ const r = await ug(t, { ...e, format: "pdf" });
36267
36267
  t = r.plan;
36268
- const n = [...r.diagnostics, ...eg(t, "pdf", e)], i = n.length, a = await Gn.create(), o = await fT(a, e), s = [];
36268
+ const n = [...r.diagnostics, ...ig(t, "pdf", e)], i = n.length, a = await Gn.create(), o = await fT(a, e), s = [];
36269
36269
  for (const [f, l] of t.pages.entries()) {
36270
36270
  Ua(e.signal);
36271
36271
  const h = At(l.pageWidthMm), d = At(l.pageHeightMm);
@@ -36289,7 +36289,7 @@ async function FT(t, e = {}) {
36289
36289
  }
36290
36290
  await Q1(e, f + 1, t.pages.length);
36291
36291
  }
36292
- if (Ua(e.signal), n.slice(i).forEach((f) => tg(f, e)), e.fidelity === "strict" && n.length) throw new rg(n);
36292
+ if (Ua(e.signal), n.slice(i).forEach((f) => ag(f, e)), e.fidelity === "strict" && n.length) throw new og(n);
36293
36293
  await o.embedding.finalize();
36294
36294
  const u = await a.save();
36295
36295
  return Ua(e.signal), {
package/dist/pdf.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./font-loader-BB372_XN.cjs"),t=require("./pdf-CARdBcuw.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-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;
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-Di0lQKFf.js";
2
- import { c as F, r as s } from "./pdf-DmlnL5eB.js";
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";
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-nf4Dk1Jc.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-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,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-BBJNlu2U.js").then((r) => r.v)), _ = {
4
+ const p = c(() => import("./ReportPreview-DeWzG8jQ.js").then((r) => r.x)), _ = {
5
5
  install(r, e = {}) {
6
6
  let t = e.fetcher;
7
7
  if (!t && e.reports) {
@@ -1,6 +1,6 @@
1
- import { v as q, G as O, n as V, N as Z, O as T } from "./json-snapshot-Kgn459Oj.js";
2
- import { r as B } from "./grid-geometry-D3SJgWFv.js";
3
- import { d as $, p as S, a as H, j as P, g as J } from "./computed-C8NRZQss.js";
1
+ import { t as q, E as O, l as V, L as Z, M as T } from "./json-snapshot-OqkPyUk5.js";
2
+ import { r as B } from "./progress-ByiOxUD3.js";
3
+ import { d as L, p as S, a as H, k as P, h as J } from "./computed-f3pOqWLX.js";
4
4
  function I(e) {
5
5
  return Number.isFinite(e) ? Math.max(0, e) : 0;
6
6
  }
@@ -49,7 +49,7 @@ class h extends Error {
49
49
  function v(e) {
50
50
  return typeof e == "string" && e.trim().length > 0 && e.length <= 256;
51
51
  }
52
- function G(e) {
52
+ function $(e) {
53
53
  if (typeof e == "number" && Number.isFinite(e) || typeof e == "boolean") return String(e);
54
54
  if (typeof e == "string" && e.length > 0 && e.length <= 4096) return e;
55
55
  throw new h("missing-value");
@@ -57,7 +57,7 @@ function G(e) {
57
57
  function Q(e, t) {
58
58
  return Object.getOwnPropertyDescriptor(e, t)?.value;
59
59
  }
60
- function L(e) {
60
+ function U(e) {
61
61
  if (!Array.isArray(e) || e.length > 64) throw new h("config");
62
62
  const t = /* @__PURE__ */ new Set();
63
63
  for (const r of e) {
@@ -76,7 +76,7 @@ function X(e) {
76
76
  if (!v(t) || ["__proto__", "constructor", "prototype"].includes(t) || !r || typeof r != "object") throw new h("config");
77
77
  if ("value" in r)
78
78
  try {
79
- G(r.value);
79
+ $(r.value);
80
80
  } catch {
81
81
  throw new h("config");
82
82
  }
@@ -84,14 +84,14 @@ function X(e) {
84
84
  }
85
85
  }
86
86
  }
87
- function U(e, t, r) {
87
+ function G(e, t, r) {
88
88
  const { target: o } = r, n = t.source?.datasetId ?? t.component.table?.source?.datasetId;
89
89
  return (t.source?.field ?? t.table?.columnKey) === o.field && (o.datasetId === void 0 || n === o.datasetId) && (o.reportScope === void 0 || e.pages[t.address.pageIndex]?.meta?.reportScope === o.reportScope) && (o.roles ? o.roles.includes(t.table?.role ?? "") : t.table?.role !== "header");
90
90
  }
91
91
  function le(e, t, r) {
92
- L(r);
92
+ U(r);
93
93
  const o = q(e, t);
94
- return o ? r.filter((n) => U(e, o, n)) : [];
94
+ return o ? r.filter((n) => G(e, o, n)) : [];
95
95
  }
96
96
  function Y(e, t, r, o) {
97
97
  if ("value" in e) return e.value;
@@ -109,10 +109,10 @@ function Y(e, t, r, o) {
109
109
  }
110
110
  }
111
111
  function de(e, t, r, o = {}) {
112
- L([r]);
112
+ U([r]);
113
113
  const n = q(e, t);
114
- if (!n || !U(e, n, r)) throw new h("target");
115
- const a = Object.fromEntries(Object.entries(r.params ?? {}).map(([i, c]) => [i, G(Y(c, e, n, o))])), s = Object.entries(o);
114
+ if (!n || !G(e, n, r)) throw new h("target");
115
+ const a = Object.fromEntries(Object.entries(r.params ?? {}).map(([i, c]) => [i, $(Y(c, e, n, o))])), s = Object.entries(o);
116
116
  if (s.length > 128 || s.some(([i, c]) => !v(i) || typeof c != "string" || c.length > 4096)) throw new h("config");
117
117
  const l = e.pages[t.pageIndex]?.meta?.reportScope;
118
118
  return Object.freeze({ actionId: r.id, params: Object.freeze(a), returnState: Object.freeze({
@@ -178,7 +178,7 @@ function ee(e) {
178
178
  if (!t || !("value" in t) || !r || !("value" in r) || !r.value || typeof r.value != "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(r.value))) throw new d("value", "Report records require own scalar keys and plain values");
179
179
  return { rowKey: t.value, values: r.value };
180
180
  }
181
- function A(e, t, r = {}) {
181
+ function k(e, t, r = {}) {
182
182
  const o = y(r.maxRows, 5e4, 1e5), n = y(r.maxCells, 1e6, 2e6);
183
183
  if (!Array.isArray(e) || Object.getPrototypeOf(e) !== Array.prototype || e.length > o || e.length * t.length > n) throw new d("limit", "Report data exceeds its budget");
184
184
  const a = /* @__PURE__ */ new Map();
@@ -196,11 +196,11 @@ function A(e, t, r = {}) {
196
196
  }
197
197
  return a;
198
198
  }
199
- function k(e) {
199
+ function A(e) {
200
200
  return e == null || e === "";
201
201
  }
202
202
  function E(e, t) {
203
- return k(e) ? t.missing === "zero" ? S(0) : void 0 : S(e);
203
+ return A(e) ? t.missing === "zero" ? S(0) : void 0 : S(e);
204
204
  }
205
205
  function te(e) {
206
206
  return { coefficient: -e.coefficient, scale: e.scale };
@@ -208,11 +208,11 @@ function te(e) {
208
208
  function re(e, t, r, o) {
209
209
  const n = E(e, r), a = Object.is(e, t) ? n : E(t, r);
210
210
  if (!n || !a) return { equal: W(e, t, r), ratioUnavailable: "missing" };
211
- const s = H(a, te(n)), l = { ...s, coefficient: s.coefficient < 0n ? -s.coefficient : s.coefficient }, i = $(l, r.toleranceValue) <= 0;
211
+ const s = H(a, te(n)), l = { ...s, coefficient: s.coefficient < 0n ? -s.coefficient : s.coefficient }, i = L(l, r.toleranceValue) <= 0;
212
212
  return i && !o ? { equal: i } : n.coefficient === 0n ? { equal: i, delta: P(s), ...s.coefficient === 0n && r.zeroDenominator === "zero-if-equal" ? { changeRatio: "0" } : { ratioUnavailable: "zero-denominator" } } : { equal: i, delta: P(s), changeRatio: P(J(s, n, r.ratioDigits ?? 12)) };
213
213
  }
214
214
  function W(e, t, r) {
215
- return r.missing === "empty-equivalent" && k(e) && k(t) || Object.is(e, t);
215
+ return r.missing === "empty-equivalent" && A(e) && A(t) || Object.is(e, t);
216
216
  }
217
217
  function oe(e) {
218
218
  j(e.fields.map((t) => t.field), y(e.maxFields, 256, 1024));
@@ -221,7 +221,7 @@ function oe(e) {
221
221
  if (t.missing && !["distinct", "empty-equivalent", "zero"].includes(t.missing)) throw new d("value", "Invalid missing-value policy");
222
222
  if (t.zeroDenominator && !["omit", "zero-if-equal"].includes(t.zeroDenominator)) throw new d("value", "Invalid zero-denominator policy");
223
223
  if (t.missing === "zero" && t.type !== "decimal") throw new d("value", "Zero missing-value policy requires a decimal field");
224
- if (t.tolerance !== void 0 && (t.type !== "decimal" || $(S(t.tolerance), S(0)) < 0)) throw new d("value", "Tolerance requires a non-negative decimal");
224
+ if (t.tolerance !== void 0 && (t.type !== "decimal" || L(S(t.tolerance), S(0)) < 0)) throw new d("value", "Tolerance requires a non-negative decimal");
225
225
  if (t.ratioDigits !== void 0 && (!Number.isInteger(t.ratioDigits) || t.ratioDigits < 0 || t.ratioDigits > 100)) throw new d("value", "Invalid ratio precision");
226
226
  }
227
227
  return e.fields.map((t) => ({ ...t, toleranceValue: S(t.tolerance ?? "0") }));
@@ -241,7 +241,7 @@ function fe(e, t, r) {
241
241
  D(e), D(t);
242
242
  const o = oe(r);
243
243
  if (e.datasetId !== t.datasetId || e.sourceScope !== t.sourceScope) throw new d("identity", "Comparison requires the same business dataset and source scope");
244
- const n = r.fields.map((u) => u.field), a = A(e.rows, n, r), s = A(t.rows, n, r), l = y(r.maxDifferences, 2e4, 1e5), i = [], c = { added: 0, removed: 0, changed: 0, unchanged: 0, cells: 0 };
244
+ const n = r.fields.map((u) => u.field), a = k(e.rows, n, r), s = k(t.rows, n, r), l = y(r.maxDifferences, 2e4, 1e5), i = [], c = { added: 0, removed: 0, changed: 0, unchanged: 0, cells: 0 };
245
245
  for (const [u, p] of a) {
246
246
  const f = s.get(u), g = _(p, f, o, i, l);
247
247
  f ? g ? c.changed++ : c.unchanged++ : c.removed++;
@@ -327,7 +327,7 @@ function ge(e, t) {
327
327
  if (D(t), t.mode !== void 0 && t.mode !== "empty" && t.mode !== "replace") throw new d("value", "Invalid prefill policy");
328
328
  const r = y(t.maxFields, 256, 1024), o = t.fields.map((f) => f.field), n = [...new Set(t.fields.map((f) => f.sourceField ?? f.field))];
329
329
  j(o, r), j(n, r);
330
- const a = A(t.rows, n, t), s = M(e, { ...t, fields: o }), l = y(t.maxChanges, 1e4, 1e4), i = y(t.maxCells, 1e6, 2e6);
330
+ const a = k(t.rows, n, t), s = M(e, { ...t, fields: o }), l = y(t.maxChanges, 1e4, 1e4), i = y(t.maxCells, 1e6, 2e6);
331
331
  if (a.size * o.length > i) throw new d("limit", "Prefill review exceeds its budget");
332
332
  const c = [], u = [], p = { matched: 0, changed: 0, skipped: 0, conflict: 0 };
333
333
  for (const f of a.values()) for (const g of t.fields) {
@@ -367,5 +367,5 @@ export {
367
367
  M as i,
368
368
  le as m,
369
369
  pe as r,
370
- L as v
370
+ U as v
371
371
  };
@@ -0,0 +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;
@@ -0,0 +1,94 @@
1
+ import { R as i, v as u, s as p } from "./json-snapshot-OqkPyUk5.js";
2
+ import { R as d, b as y, t as c, p as l } from "./sha256-BDQ1Qk7A.js";
3
+ import { s as g, a as m } from "./workbook-sheets-D4M7XXBh.js";
4
+ function P(e) {
5
+ return e && { ...e, sheetNames: m(e.sheetNames), additionalSheets: g(e.additionalSheets) };
6
+ }
7
+ function S(e, r) {
8
+ if (e.format !== "xlsx") return;
9
+ const t = e.xlsx?.additionalSheets?.reduce((o, a) => o + a.rows.reduce((n, s) => n + s.length, 0), 0) ?? 0;
10
+ y(r, "maxCells", e.prepared.stats.cells + t);
11
+ }
12
+ function I(e) {
13
+ if (!e) return;
14
+ const r = (t) => {
15
+ if (!(t instanceof Uint8Array) && !(t instanceof ArrayBuffer)) throw new i("validate", "字体应为 Uint8Array 或 ArrayBuffer");
16
+ if (t.byteLength > 32e6) throw new d("budget", "单份字体超过 32 MB", "$.pdf");
17
+ return new Uint8Array(t instanceof Uint8Array ? t : new Uint8Array(t));
18
+ };
19
+ if (e.customFontFaces) {
20
+ const t = e.customFontFaces;
21
+ return { customFontName: e.customFontName, customFontFaces: { regular: r(t.regular), ...t.bold ? { bold: r(t.bold) } : {}, ...t.italic ? { italic: r(t.italic) } : {}, ...t.boldItalic ? { boldItalic: r(t.boldItalic) } : {} } };
22
+ }
23
+ return { customFontName: e.customFontName, ...e.customFontBytes ? { customFontBytes: r(e.customFontBytes) } : {} };
24
+ }
25
+ function w(e) {
26
+ const r = e?.customFontFaces ?? (e?.customFontBytes ? { regular: e.customFontBytes } : void 0);
27
+ if (!r) return;
28
+ const t = ["regular", "bold", "italic", "boldItalic"].map((o) => {
29
+ const a = r[o];
30
+ if (!a) return [o, null];
31
+ const n = a instanceof Uint8Array ? a : new Uint8Array(a);
32
+ if (n.byteLength > 32e6) throw new d("budget", "单份字体超过 32 MB", "$.pdf");
33
+ return [o, l(n)];
34
+ });
35
+ return l(new TextEncoder().encode(JSON.stringify(t)));
36
+ }
37
+ const f = /* @__PURE__ */ new WeakMap();
38
+ function N(e, r, t) {
39
+ const o = v(e, r, t);
40
+ let a = !0;
41
+ return { prepared: o, forward() {
42
+ if (!a) throw new Error("报表快照只能交接一次");
43
+ return a = !1, f.set(o, r), o;
44
+ } };
45
+ }
46
+ function v(e, r, t) {
47
+ if (c(t), !Number.isSafeInteger(r) || r <= 0) throw new d("budget", "快照预算应为正安全整数", "$.budget.maxPreparedBytes");
48
+ const o = f.get(e);
49
+ if (f.delete(e), o !== void 0 && o <= r) return e;
50
+ const a = p(e, {
51
+ maxBytes: r,
52
+ maxNodes: r,
53
+ check: () => c(t),
54
+ error: (n, s) => n === "budget" ? new d("budget", s, "$.budget.maxPreparedBytes") : new i("validate", s)
55
+ });
56
+ return F(a), a;
57
+ }
58
+ function b(e) {
59
+ if (e === void 0) return !0;
60
+ if (!Array.isArray(e)) return !1;
61
+ const r = /* @__PURE__ */ new Set();
62
+ return e.every((t) => !t || typeof t != "object" || Array.isArray(t) || typeof t.reportId != "string" || !t.reportId.trim() || !Number.isSafeInteger(t.reportIndex) || t.reportIndex < 0 || r.has(t.reportIndex) || typeof t.reportScope != "string" || !t.reportScope.trim() || t.reportScope.length > 4096 || t.revision !== void 0 && typeof t.revision != "string" || t.sourceToken !== void 0 && typeof t.sourceToken != "string" ? !1 : (r.add(t.reportIndex), !0));
63
+ }
64
+ function F(e) {
65
+ if (!b(e.sources)) throw new i("validate", "准备结果来源清单无效");
66
+ if (!e?.stats || ["rows", "pages", "cells"].some((r) => !Number.isSafeInteger(e.stats[r]) || e.stats[r] < 0) || !Number.isFinite(e.stats.durationMs) || e.stats.durationMs < 0) throw new i("validate", "准备结果统计无效");
67
+ if (!Array.isArray(e.diagnostics) || e.diagnostics.some((r) => !r || typeof r.code != "string" || typeof r.message != "string" || !["info", "warning", "error"].includes(r.severity) || !u(r))) throw new i("validate", "准备结果诊断无效");
68
+ if (!e.revisions || typeof e.revisions != "object" || Array.isArray(e.revisions) || Object.values(e.revisions).some((r) => !r || typeof r != "object" || r.revision !== void 0 && typeof r.revision != "string" || r.sourceToken !== void 0 && typeof r.sourceToken != "string")) throw new i("validate", "准备结果修订无效");
69
+ if (e.layout && (!["heuristic", "provided", "font-bytes"].includes(e.layout.textMetrics) || e.layout.fontFingerprint !== void 0 && !/^[a-f0-9]{64}$/.test(e.layout.fontFingerprint))) throw new i("validate", "准备结果字体度量标识无效");
70
+ }
71
+ function B(e) {
72
+ if (e.layoutPolicy !== void 0 && !["verify", "preserve"].includes(e.layoutPolicy)) throw new i("validate", "无效的 layoutPolicy");
73
+ if (e.format !== "pdf") return;
74
+ if (e.layoutPolicy === "preserve" && !e.prepared.layout?.fontFingerprint) {
75
+ e.prepared.diagnostics.push({ code: "prepared-layout-preserved", severity: "info", message: "显式保持现有分页与几何;未验证排版字体身份,实际 PDF 输出仍遵循 fidelity 校验。" });
76
+ return;
77
+ }
78
+ const r = e.prepared.layout?.fontFingerprint, t = w(e.pdf);
79
+ if (r === t && (r !== void 0 || e.prepared.layout?.textMetrics === "heuristic" && !t)) return;
80
+ const o = "已准备计划的字体度量无法与本次 PDF 字体确认一致;保持现有分页,未重新查询或排版。请在 prepare 和 exportPrepared 提供相同字体字节。";
81
+ if (e.fidelity === "strict") throw new i("validate", o);
82
+ e.prepared.diagnostics.push({ code: "prepared-font-metrics", severity: "warning", message: o });
83
+ }
84
+ export {
85
+ P as a,
86
+ S as b,
87
+ N as c,
88
+ b as d,
89
+ v as e,
90
+ B as f,
91
+ w as r,
92
+ I as s,
93
+ F as v
94
+ };
@@ -0,0 +1 @@
1
+ "use strict";const n=require("./json-snapshot-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;