@agile-team/mach-report 2.16.0 → 2.18.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 (177) hide show
  1. package/README.md +25 -12
  2. package/dist/{ExcelBindingWizard-CP6h2x1f.cjs → ExcelBindingWizard-Czn3C2yE.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-HhB3hAJE.js → ExcelBindingWizard-DMGZj6I6.js} +3 -3
  4. package/dist/ParamEditor-KzDQvbHY.js +732 -0
  5. package/dist/ParamEditor-oDfD8LgE.cjs +1 -0
  6. package/dist/{ReportBatchPanel-ruxcbfY6.js → ReportBatchPanel-BJK7PvZ4.js} +39 -39
  7. package/dist/ReportBatchPanel-DnmNRssu.cjs +1 -0
  8. package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
  9. package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
  10. package/dist/ReportPreview-BxWWTUL5.js +5583 -0
  11. package/dist/ReportPreview-Yf99omi3.cjs +6 -0
  12. package/dist/{ReportTemplateLibrary-DcwrH-63.js → ReportTemplateLibrary-BFjB08Wu.js} +1 -1
  13. package/dist/{ReportTemplateLibrary-BDlNT8JN.cjs → ReportTemplateLibrary-BO42QnWd.cjs} +1 -1
  14. package/dist/RuleEditor-CqxT1a-W.js +2337 -0
  15. package/dist/RuleEditor-D7YWigD9.cjs +1 -0
  16. package/dist/{TemplateOutlinePanel-CGrT5DFN.cjs → TemplateOutlinePanel-B0XX350V.cjs} +1 -1
  17. package/dist/{TemplateOutlinePanel-SXCjaPKR.js → TemplateOutlinePanel-zG0DrsIB.js} +2 -2
  18. package/dist/{TemplateReusePanel-6Z3wRFz8.cjs → TemplateReusePanel-BD0HSKp_.cjs} +1 -1
  19. package/dist/{TemplateReusePanel-lHLOS9Wn.js → TemplateReusePanel-Czwe5GbC.js} +2 -2
  20. package/dist/{TemplateReviewPanel-Dpk7sLcF.cjs → TemplateReviewPanel-CA5sdffM.cjs} +1 -1
  21. package/dist/{TemplateReviewPanel-CJ9PLc48.js → TemplateReviewPanel-NhmQI65C.js} +2 -2
  22. package/dist/analytics.cjs +1 -1
  23. package/dist/analytics.d.cts +163 -42
  24. package/dist/analytics.d.ts +163 -42
  25. package/dist/analytics.js +76 -141
  26. package/dist/artifact-integrity.json +110 -108
  27. package/dist/assets-2eC3mOcV.js +232 -0
  28. package/dist/assets-B0Hxn4l6.cjs +1 -0
  29. package/dist/{auto-uVBjX1j5.cjs → auto-B0EZFIK1.cjs} +1 -1
  30. package/dist/{auto-YR7a4BtF.js → auto-BlchZ1b8.js} +10 -10
  31. package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
  32. package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
  33. package/dist/charts-Dlv8j2AG.js +141 -0
  34. package/dist/charts-aCtoswXq.cjs +1 -0
  35. package/dist/codes.cjs +9 -9
  36. package/dist/codes.d.cts +54 -0
  37. package/dist/codes.d.ts +54 -0
  38. package/dist/codes.js +12097 -13668
  39. package/dist/column-visual-BpgQVWwT.js +238 -0
  40. package/dist/column-visual-CtYxnBCP.cjs +1 -0
  41. package/dist/component-tree-6TV7W6Yj.cjs +1 -0
  42. package/dist/component-tree-CvW4lzpv.js +67 -0
  43. package/dist/computed-4TnxzgIh.cjs +1 -0
  44. package/dist/computed-C8NRZQss.js +739 -0
  45. package/dist/data-bar-Ce38juRZ.cjs +1 -0
  46. package/dist/data-bar-PtjXhMgN.js +9 -0
  47. package/dist/dataset-DL83majE.js +161 -0
  48. package/dist/dataset-IrlXbUvh.cjs +1 -0
  49. package/dist/designer--TKECSEc.cjs +2 -0
  50. package/dist/designer-d6hJS41w.js +5683 -0
  51. package/dist/designer.cjs +1 -1
  52. package/dist/designer.d.cts +835 -45
  53. package/dist/designer.d.ts +835 -45
  54. package/dist/designer.js +23 -20
  55. package/dist/{encoding-BYF9ZTl9.cjs → encoding-B--eZpp1.cjs} +1 -1
  56. package/dist/{encoding-BOGq4qYL.js → encoding-mctOLocI.js} +2 -2
  57. package/dist/{font-loader-EKLzOJxf.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
  58. package/dist/{font-loader-CzI1GuBc.js → font-loader-DW8tIaNp.js} +1 -1
  59. package/dist/index-CPh6tqge.js +1575 -0
  60. package/dist/index-CUNw7dL9.cjs +1 -0
  61. package/dist/index.cjs +8 -8
  62. package/dist/index.d.cts +534 -16
  63. package/dist/index.d.ts +534 -16
  64. package/dist/index.js +1393 -955
  65. package/dist/json-snapshot-By4ZVVUt.js +1967 -0
  66. package/dist/json-snapshot-jiXff4lc.cjs +2 -0
  67. package/dist/matrix-0hywp0-F.cjs +1 -0
  68. package/dist/matrix-Dy-tyY7E.js +381 -0
  69. package/dist/param-validation-C-8sRJLq.cjs +1 -0
  70. package/dist/param-validation-CnDEd2l-.js +333 -0
  71. package/dist/{pdf-DJ5S6ukC.js → pdf-CKROKygt.js} +1845 -1845
  72. package/dist/{pdf-ByVCb1i6.cjs → pdf-DqyxJ96U.cjs} +47 -47
  73. package/dist/pdf.cjs +1 -1
  74. package/dist/pdf.d.cts +66 -0
  75. package/dist/pdf.d.ts +66 -0
  76. package/dist/pdf.js +2 -2
  77. package/dist/{plugin-C2j5_mhx.js → plugin-ByjF2kiV.js} +5 -5
  78. package/dist/{plugin-Dr39GBRG.cjs → plugin-DM1M2wlI.cjs} +1 -1
  79. package/dist/prefill-B8H9qwE4.js +371 -0
  80. package/dist/prefill-D7EswyTI.cjs +1 -0
  81. package/dist/{prepared-DqtpvRTn.js → prepared-BE-4jfX5.js} +2 -2
  82. package/dist/{prepared-DdrjLC7L.cjs → prepared-CGVphji3.cjs} +1 -1
  83. package/dist/{protocol-BzwMP4Vw.cjs → protocol-ByRVzzQG.cjs} +1 -1
  84. package/dist/{protocol-kt4Iy6-3.js → protocol-Cr81vFSQ.js} +3 -3
  85. package/dist/{record-bindings-CZWBJ1fU.js → record-bindings-DEJtmo3p.js} +67 -107
  86. package/dist/record-bindings-ehjnCDHt.cjs +1 -0
  87. package/dist/{region-binding-workflow-CWNvIjkV.js → region-binding-workflow-CBg0l_tj.js} +2 -2
  88. package/dist/{region-binding-workflow-CqSMxQ4p.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
  89. package/dist/report-encoding-worker.cjs +1 -1
  90. package/dist/report-encoding-worker.js +1 -1
  91. package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
  92. package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
  93. package/dist/runtime-CDA6d263.cjs +1 -0
  94. package/dist/runtime-CEMvybO7.js +170 -0
  95. package/dist/sbom.cdx.json +1 -1
  96. package/dist/server/node.d.cts +121 -7
  97. package/dist/server/node.d.ts +121 -7
  98. package/dist/server-node.cjs +4 -4
  99. package/dist/server-node.js +3446 -2115
  100. package/dist/server.cjs +1 -1
  101. package/dist/server.d.cts +417 -29
  102. package/dist/server.d.ts +417 -29
  103. package/dist/server.js +787 -544
  104. package/dist/sha256-BDQ1Qk7A.js +158 -0
  105. package/dist/sha256-DgZAKXqI.cjs +1 -0
  106. package/dist/style.css +1 -1
  107. package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
  108. package/dist/template-bindings-TKnXM7ll.js +62 -0
  109. package/dist/{template-catalog-BtR2JmCL.js → template-catalog-CmbWOJqy.js} +16 -16
  110. package/dist/template-catalog-Utu4GP09.cjs +1 -0
  111. package/dist/{template-fragments-BVsbxs4a.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
  112. package/dist/{template-fragments-By0aZC1D.js → template-fragments-DWgo9tlZ.js} +2 -2
  113. package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
  114. package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
  115. package/dist/{template-registry-Cw3vRTX2.js → template-registry-BIhIHOab.js} +319 -314
  116. package/dist/template-registry-DzWswQI5.cjs +1 -0
  117. package/dist/vue/async.d.cts +636 -35
  118. package/dist/vue/async.d.ts +636 -35
  119. package/dist/vue/index.d.cts +746 -67
  120. package/dist/vue/index.d.ts +746 -67
  121. package/dist/vue-async.cjs +1 -1
  122. package/dist/vue-async.js +3 -3
  123. package/dist/vue.cjs +1 -1
  124. package/dist/vue.js +94 -89
  125. package/dist/{workbook-session-Cbts-22R.cjs → workbook-session-B94EwVa_.cjs} +1 -1
  126. package/dist/{workbook-session-BeSO8PFB.js → workbook-session-BoScoOg-.js} +2 -2
  127. package/dist/worker.cjs +1 -1
  128. package/dist/worker.d.cts +75 -7
  129. package/dist/worker.d.ts +75 -7
  130. package/dist/worker.js +4 -4
  131. package/dist/xlsx.cjs +4 -4
  132. package/dist/xlsx.d.cts +208 -15
  133. package/dist/xlsx.d.ts +208 -15
  134. package/dist/xlsx.js +288 -252
  135. package/package.json +1 -1
  136. package/dist/ParamEditor-CUQLgoxa.cjs +0 -1
  137. package/dist/ParamEditor-OKesP_nO.js +0 -594
  138. package/dist/ReportBatchPanel-cZCAMAwH.cjs +0 -1
  139. package/dist/ReportPreview-BcDKCLiK.js +0 -4834
  140. package/dist/ReportPreview-Bk9nLfO9.cjs +0 -6
  141. package/dist/RuleEditor-BX5S8RSF.cjs +0 -1
  142. package/dist/RuleEditor-CGl9XY2s.js +0 -2037
  143. package/dist/assets-CqIbfbTr.js +0 -126
  144. package/dist/assets-e4YSke8n.cjs +0 -1
  145. package/dist/capabilities-DDwXr_cA.js +0 -103
  146. package/dist/capabilities-DNLyZdNw.cjs +0 -1
  147. package/dist/component-tree-Ca6YYfHq.js +0 -61
  148. package/dist/component-tree-DkGLEfZC.cjs +0 -1
  149. package/dist/computed-C-4C2S5h.js +0 -521
  150. package/dist/computed-CGV2a809.cjs +0 -1
  151. package/dist/config-Dg_o8e7m.cjs +0 -1
  152. package/dist/config-XQ4qrQ7Q.js +0 -844
  153. package/dist/dataset-BkRmwgeJ.cjs +0 -1
  154. package/dist/dataset-H5pFuQGU.js +0 -121
  155. package/dist/designer-BfQSahxq.js +0 -5163
  156. package/dist/designer-CPPdeM5_.cjs +0 -2
  157. package/dist/diagnostic-notification-B9K9We3h.cjs +0 -1
  158. package/dist/diagnostic-notification-qGAYZdkB.js +0 -7
  159. package/dist/drill-CsdjgkRM.cjs +0 -1
  160. package/dist/drill-DIGsZfyB.js +0 -145
  161. package/dist/json-snapshot-D6ioHth9.js +0 -1702
  162. package/dist/json-snapshot-DknkjvxP.cjs +0 -2
  163. package/dist/matrix-CGRGkn5s.js +0 -112
  164. package/dist/matrix-gEO7ZM_u.cjs +0 -1
  165. package/dist/param-validation-C3HlcLLO.cjs +0 -1
  166. package/dist/param-validation-Do7Eg8Zv.js +0 -181
  167. package/dist/record-bindings-DUX1VMlR.cjs +0 -1
  168. package/dist/runtime-BjKBI530.js +0 -168
  169. package/dist/runtime-CBFEPKEs.cjs +0 -1
  170. package/dist/sha256-BshdOkCC.cjs +0 -1
  171. package/dist/sha256-DTG-Gq8i.js +0 -157
  172. package/dist/template-bindings-C2SpvsMU.js +0 -58
  173. package/dist/template-bindings-CEtWyiLX.cjs +0 -1
  174. package/dist/template-catalog-C2NLdrwB.cjs +0 -1
  175. package/dist/template-registry-C62vpv4a.cjs +0 -1
  176. package/dist/tree-BX380Rr7.cjs +0 -1
  177. package/dist/tree-CjVZLRw7.js +0 -172
package/dist/pdf.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./font-loader-EKLzOJxf.cjs"),t=require("./pdf-ByVCb1i6.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-DBBJ5KE9.cjs"),t=require("./pdf-DqyxJ96U.cjs");exports.clearFontCache=e.clearFontCache;exports.configureFontCache=e.configureFontCache;exports.getFontCacheStats=e.getFontCacheStats;exports.invalidateFontCache=e.invalidateFontCache;exports.loadFontWithCache=e.loadFontWithCache;exports.createFontBytesMeasurer=t.createFontBytesMeasurer;exports.renderPlanToPdf=t.renderPlanToPdf;
package/dist/pdf.d.cts CHANGED
@@ -1,3 +1,13 @@
1
+ declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
2
+
3
+ declare interface AggregateRequest {
4
+ op: AggregateOperation;
5
+ field?: string;
6
+ weightField?: string;
7
+ numeric?: "number" | "decimal";
8
+ digits?: number;
9
+ }
10
+
1
11
  declare interface AssetRenderBudget {
2
12
  /** Maximum newly rendered assets, default 1000. Existing imageData is kept unchanged. */
3
13
  maxAssets?: number;
@@ -11,6 +21,8 @@ declare interface AssetRenderBudget {
11
21
 
12
22
  declare interface AssetRenderOptions extends OutputDiagnosticOptions, ImageMediaOptions {
13
23
  assetRenderers?: Partial<Record<ImageComponentKind, ComponentImageRenderer>>;
24
+ /** Explicit id/version registry; unbound components continue using assetRenderers by kind. */
25
+ assetRegistry?: ComponentAssetRegistry;
14
26
  assetBudget?: AssetRenderBudget;
15
27
  /** Default throw prevents an incomplete export; placeholder retains the component and emits diagnostics. */
16
28
  assetFailure?: "throw" | "placeholder";
@@ -54,6 +66,11 @@ declare type ColumnFormat = {
54
66
  pattern?: string;
55
67
  };
56
68
 
69
+ declare interface ComponentAssetRegistry {
70
+ rendererFor(component: Readonly<PlanComponent>): ComponentImageRenderer | undefined;
71
+ hasExtension(id: string, version: string, kind: string): boolean;
72
+ }
73
+
57
74
  /** A literal own field of the current label record; expressions and paths are not evaluated. */
58
75
  declare interface ComponentBinding {
59
76
  field: string;
@@ -139,6 +156,12 @@ export declare interface FontLoadOptions {
139
156
  export declare function getFontCacheStats(): FontCacheStats;
140
157
 
141
158
  declare interface GridCell {
159
+ /** Resolved visual only. Original value, text, editability and source are unchanged. */
160
+ dataBar?: {
161
+ start: number;
162
+ end: number;
163
+ color: string;
164
+ };
142
165
  /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
143
166
  richParagraphs?: RichParagraph[];
144
167
  text?: string;
@@ -199,6 +222,11 @@ declare interface OutputDiagnostic {
199
222
  componentPath?: readonly number[];
200
223
  kind: string;
201
224
  nid?: string;
225
+ /** Declarative extension identity only; no property values or business binding data enter diagnostics. */
226
+ extension?: {
227
+ id: string;
228
+ version: string;
229
+ };
202
230
  message: string;
203
231
  }
204
232
 
@@ -251,6 +279,8 @@ export declare interface PdfRenderResult {
251
279
  }
252
280
 
253
281
  declare interface PlanComponent {
282
+ /** Template-only aggregate binding, expanded into shared primitives during layout. */
283
+ chartBinding?: ReportChartBinding;
254
284
  /** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
255
285
  code?: CodeOptions;
256
286
  /** Template-only binding; resolved and removed before constructing the output plan. */
@@ -339,6 +369,42 @@ declare interface ReportCellSource {
339
369
  sourceToken?: string;
340
370
  }
341
371
 
372
+ /** Serializable binding; data and authorization continue to come from the existing report source. */
373
+ declare interface ReportChartBinding {
374
+ dataset: string;
375
+ categoryField: string;
376
+ measures: readonly ReportChartMeasure[];
377
+ type: ReportChartOptions["type"];
378
+ sort?: "asc" | "desc";
379
+ title?: string;
380
+ showValues?: boolean;
381
+ maxRows?: number;
382
+ maxCategories?: number;
383
+ }
384
+
385
+ declare interface ReportChartMeasure extends AggregateRequest {
386
+ label?: string;
387
+ color?: string;
388
+ }
389
+
390
+ declare interface ReportChartOptions {
391
+ type: "bar" | "line" | "stackedBar" | "percentBar";
392
+ categories: readonly string[];
393
+ series: readonly ReportChartSeries[];
394
+ leftMm: number;
395
+ topMm: number;
396
+ widthMm: number;
397
+ heightMm: number;
398
+ title?: string;
399
+ showValues?: boolean;
400
+ }
401
+
402
+ declare interface ReportChartSeries {
403
+ name: string;
404
+ values: readonly (number | null)[];
405
+ color?: string;
406
+ }
407
+
342
408
  declare interface RichParagraph {
343
409
  segments: RichSegment[];
344
410
  align?: ComponentStyle["align"];
package/dist/pdf.d.ts CHANGED
@@ -1,3 +1,13 @@
1
+ declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
2
+
3
+ declare interface AggregateRequest {
4
+ op: AggregateOperation;
5
+ field?: string;
6
+ weightField?: string;
7
+ numeric?: "number" | "decimal";
8
+ digits?: number;
9
+ }
10
+
1
11
  declare interface AssetRenderBudget {
2
12
  /** Maximum newly rendered assets, default 1000. Existing imageData is kept unchanged. */
3
13
  maxAssets?: number;
@@ -11,6 +21,8 @@ declare interface AssetRenderBudget {
11
21
 
12
22
  declare interface AssetRenderOptions extends OutputDiagnosticOptions, ImageMediaOptions {
13
23
  assetRenderers?: Partial<Record<ImageComponentKind, ComponentImageRenderer>>;
24
+ /** Explicit id/version registry; unbound components continue using assetRenderers by kind. */
25
+ assetRegistry?: ComponentAssetRegistry;
14
26
  assetBudget?: AssetRenderBudget;
15
27
  /** Default throw prevents an incomplete export; placeholder retains the component and emits diagnostics. */
16
28
  assetFailure?: "throw" | "placeholder";
@@ -54,6 +66,11 @@ declare type ColumnFormat = {
54
66
  pattern?: string;
55
67
  };
56
68
 
69
+ declare interface ComponentAssetRegistry {
70
+ rendererFor(component: Readonly<PlanComponent>): ComponentImageRenderer | undefined;
71
+ hasExtension(id: string, version: string, kind: string): boolean;
72
+ }
73
+
57
74
  /** A literal own field of the current label record; expressions and paths are not evaluated. */
58
75
  declare interface ComponentBinding {
59
76
  field: string;
@@ -139,6 +156,12 @@ export declare interface FontLoadOptions {
139
156
  export declare function getFontCacheStats(): FontCacheStats;
140
157
 
141
158
  declare interface GridCell {
159
+ /** Resolved visual only. Original value, text, editability and source are unchanged. */
160
+ dataBar?: {
161
+ start: number;
162
+ end: number;
163
+ color: string;
164
+ };
142
165
  /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
143
166
  richParagraphs?: RichParagraph[];
144
167
  text?: string;
@@ -199,6 +222,11 @@ declare interface OutputDiagnostic {
199
222
  componentPath?: readonly number[];
200
223
  kind: string;
201
224
  nid?: string;
225
+ /** Declarative extension identity only; no property values or business binding data enter diagnostics. */
226
+ extension?: {
227
+ id: string;
228
+ version: string;
229
+ };
202
230
  message: string;
203
231
  }
204
232
 
@@ -251,6 +279,8 @@ export declare interface PdfRenderResult {
251
279
  }
252
280
 
253
281
  declare interface PlanComponent {
282
+ /** Template-only aggregate binding, expanded into shared primitives during layout. */
283
+ chartBinding?: ReportChartBinding;
254
284
  /** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
255
285
  code?: CodeOptions;
256
286
  /** Template-only binding; resolved and removed before constructing the output plan. */
@@ -339,6 +369,42 @@ declare interface ReportCellSource {
339
369
  sourceToken?: string;
340
370
  }
341
371
 
372
+ /** Serializable binding; data and authorization continue to come from the existing report source. */
373
+ declare interface ReportChartBinding {
374
+ dataset: string;
375
+ categoryField: string;
376
+ measures: readonly ReportChartMeasure[];
377
+ type: ReportChartOptions["type"];
378
+ sort?: "asc" | "desc";
379
+ title?: string;
380
+ showValues?: boolean;
381
+ maxRows?: number;
382
+ maxCategories?: number;
383
+ }
384
+
385
+ declare interface ReportChartMeasure extends AggregateRequest {
386
+ label?: string;
387
+ color?: string;
388
+ }
389
+
390
+ declare interface ReportChartOptions {
391
+ type: "bar" | "line" | "stackedBar" | "percentBar";
392
+ categories: readonly string[];
393
+ series: readonly ReportChartSeries[];
394
+ leftMm: number;
395
+ topMm: number;
396
+ widthMm: number;
397
+ heightMm: number;
398
+ title?: string;
399
+ showValues?: boolean;
400
+ }
401
+
402
+ declare interface ReportChartSeries {
403
+ name: string;
404
+ values: readonly (number | null)[];
405
+ color?: string;
406
+ }
407
+
342
408
  declare interface RichParagraph {
343
409
  segments: RichSegment[];
344
410
  align?: ComponentStyle["align"];
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-CzI1GuBc.js";
2
- import { c as F, r as s } from "./pdf-DJ5S6ukC.js";
1
+ import { clearFontCache as t, configureFontCache as o, getFontCacheStats as r, invalidateFontCache as n, loadFontWithCache as c } from "./font-loader-DW8tIaNp.js";
2
+ import { c as F, r as s } from "./pdf-CKROKygt.js";
3
3
  export {
4
4
  t as clearFontCache,
5
5
  o as configureFontCache,
@@ -1,15 +1,15 @@
1
1
  import { defineAsyncComponent as c, computed as m } from "vue";
2
- import { b as i, c as l, a as s } from "./injection-keys-e85udZCp.js";
3
- import { g as d } from "./report-params-B1RzkhJj.js";
4
- const p = c(() => import("./ReportPreview-BcDKCLiK.js").then((r) => r.s)), _ = {
2
+ import { b as i, c as l, a as d } from "./injection-keys-e85udZCp.js";
3
+ import { g as s } from "./report-params-D9tBuM9B.js";
4
+ const p = c(() => import("./ReportPreview-BxWWTUL5.js").then((r) => r.v)), _ = {
5
5
  install(r, e = {}) {
6
6
  let t = e.fetcher;
7
7
  if (!t && e.reports) {
8
8
  const f = e.reports;
9
9
  let n;
10
- t = async (o) => (n ??= import("@agile-team/mach-report").then(({ createReportSource: a }) => a(f)), (await n)(o)), t.getParamDefs = (o) => d(f, o);
10
+ t = async (o) => (n ??= import("@agile-team/mach-report").then(({ createReportSource: a }) => a(f)), (await n)(o)), t.getParamDefs = (o) => s(f, o);
11
11
  }
12
- t && r.provide(i, t), e.pdfExporter && r.provide(l, e.pdfExporter), r.provide(s, m(() => {
12
+ t && r.provide(i, t), e.pdfExporter && r.provide(l, e.pdfExporter), r.provide(d, m(() => {
13
13
  if (e.pdfFontUrl === void 0) return e.config ?? null;
14
14
  const f = e.config ?? { defaults: {}, presets: {} };
15
15
  return { ...f, defaults: { ...f.defaults, pdfFontUrl: e.pdfFontUrl } };
@@ -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-WDGrA4oP.cjs"),s=l.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-Bk9nLfO9.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-Yf99omi3.cjs")).then(r=>r.ReportPreview$1)),v={install(r,e={}){let t=e.fetcher;if(!t&&e.reports){const n=e.reports;let o;t=async c=>(o??=import("@agile-team/mach-report").then(({createReportSource:a})=>a(n)),(await o)(c)),t.getParamDefs=c=>h.getReportParamDefs(n,c)}t&&r.provide(i.MACH_REPORT_FETCHER_KEY,t),e.pdfExporter&&r.provide(i.MACH_REPORT_PDF_EXPORTER_KEY,e.pdfExporter),r.provide(i.MACH_REPORT_CONFIG_KEY,l.computed(()=>{if(e.pdfFontUrl===void 0)return e.config??null;const n=e.config??{defaults:{},presets:{}};return{...n,defaults:{...n.defaults,pdfFontUrl:e.pdfFontUrl}}})),e.globalComponent!==!1&&!r.component("MachReportPreview")&&r.component("MachReportPreview",s)}};exports.MachReportPreview=s;exports.machReportPlugin=v;
@@ -0,0 +1,371 @@
1
+ import { v as q, G as O, n as V, N as Z, O as T } from "./json-snapshot-By4ZVVUt.js";
2
+ import { r as B } from "./grid-geometry-BNptEcMm.js";
3
+ import { d as $, p as S, a as H, j as P, g as J } from "./computed-C8NRZQss.js";
4
+ function I(e) {
5
+ return Number.isFinite(e) ? Math.max(0, e) : 0;
6
+ }
7
+ function ce(e, t = 0) {
8
+ const r = e.length, o = I(t), n = new Array(r + 1);
9
+ n[0] = 0;
10
+ for (let i = 0; i < r; i++)
11
+ n[i + 1] = n[i] + I(e[i] ?? 0) + o;
12
+ const a = n[r];
13
+ function s(i) {
14
+ let c = 0, u = r - 1, p = 0;
15
+ for (; c <= u; ) {
16
+ const f = c + u >>> 1;
17
+ n[f] <= i ? (p = f, c = f + 1) : u = f - 1;
18
+ }
19
+ return p;
20
+ }
21
+ function l(i, c, u = 1) {
22
+ if (r === 0) return { start: 0, end: -1, padTopPx: 0, padBottomPx: 0 };
23
+ const p = Math.floor(I(u)), f = I(c), g = s(f), m = Math.max(0, g - p), b = f + I(i);
24
+ let w = g, x = r - 1, F = r - 1;
25
+ for (; w <= x; ) {
26
+ const R = w + x >>> 1;
27
+ n[R + 1] < b ? w = R + 1 : (F = R, x = R - 1);
28
+ }
29
+ const C = Math.min(r - 1, F + p);
30
+ return {
31
+ start: m,
32
+ end: C,
33
+ padTopPx: n[m],
34
+ padBottomPx: Math.max(0, a - n[C + 1])
35
+ };
36
+ }
37
+ return {
38
+ totalHeightPx: a,
39
+ pageAt: s,
40
+ offsetAt: (i) => n[Math.max(0, Math.min(r, Math.floor(i)))] ?? 0,
41
+ window: l
42
+ };
43
+ }
44
+ class h extends Error {
45
+ constructor(t) {
46
+ super(`Report drill: ${t}`), this.code = t, this.name = "ReportDrillError";
47
+ }
48
+ }
49
+ function v(e) {
50
+ return typeof e == "string" && e.trim().length > 0 && e.length <= 256;
51
+ }
52
+ function G(e) {
53
+ if (typeof e == "number" && Number.isFinite(e) || typeof e == "boolean") return String(e);
54
+ if (typeof e == "string" && e.length > 0 && e.length <= 4096) return e;
55
+ throw new h("missing-value");
56
+ }
57
+ function Q(e, t) {
58
+ return Object.getOwnPropertyDescriptor(e, t)?.value;
59
+ }
60
+ function L(e) {
61
+ if (!Array.isArray(e) || e.length > 64) throw new h("config");
62
+ const t = /* @__PURE__ */ new Set();
63
+ for (const r of e) {
64
+ if (!r || !v(r.id) || !v(r.label) || !r.target || !v(r.target.field) || t.has(r.id)) throw new h("config");
65
+ t.add(r.id);
66
+ const o = r.target;
67
+ if (o.datasetId !== void 0 && !v(o.datasetId) || o.reportScope !== void 0 && !v(o.reportScope)) throw new h("config");
68
+ if (o.roles !== void 0 && (!Array.isArray(o.roles) || o.roles.length > 16 || o.roles.some((n) => !v(n)))) throw new h("config");
69
+ X(r.params);
70
+ }
71
+ }
72
+ function X(e) {
73
+ if (e !== void 0) {
74
+ if (!e || typeof e != "object" || Array.isArray(e) || Object.keys(e).length > 32) throw new h("config");
75
+ for (const [t, r] of Object.entries(e)) {
76
+ if (!v(t) || ["__proto__", "constructor", "prototype"].includes(t) || !r || typeof r != "object") throw new h("config");
77
+ if ("value" in r)
78
+ try {
79
+ G(r.value);
80
+ } catch {
81
+ throw new h("config");
82
+ }
83
+ else if (!["value", "rowKey", "query", "field"].includes(r.from) || (r.from === "query" || r.from === "field") && !v(r.field)) throw new h("config");
84
+ }
85
+ }
86
+ }
87
+ function U(e, t, r) {
88
+ const { target: o } = r, n = t.source?.datasetId ?? t.component.table?.source?.datasetId;
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
+ }
91
+ function le(e, t, r) {
92
+ L(r);
93
+ const o = q(e, t);
94
+ return o ? r.filter((n) => U(e, o, n)) : [];
95
+ }
96
+ function Y(e, t, r, o) {
97
+ if ("value" in e) return e.value;
98
+ switch (e.from) {
99
+ case "value":
100
+ return r.value;
101
+ case "rowKey":
102
+ return r.source?.rowKey;
103
+ case "query":
104
+ return Q(o, e.field);
105
+ case "field": {
106
+ const n = r.component.table?.columnKeys.indexOf(e.field) ?? -1;
107
+ return n < 0 ? void 0 : q(t, { ...r.address, columnIndex: n })?.value;
108
+ }
109
+ }
110
+ }
111
+ function de(e, t, r, o = {}) {
112
+ L([r]);
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);
116
+ if (s.length > 128 || s.some(([i, c]) => !v(i) || typeof c != "string" || c.length > 4096)) throw new h("config");
117
+ const l = e.pages[t.pageIndex]?.meta?.reportScope;
118
+ return Object.freeze({ actionId: r.id, params: Object.freeze(a), returnState: Object.freeze({
119
+ params: Object.freeze(Object.fromEntries(s)),
120
+ address: Object.freeze({ ...t }),
121
+ ...typeof l == "string" ? { reportScope: l } : {},
122
+ ...n.source ? { source: Object.freeze({ sourceScope: n.source.sourceScope, datasetId: n.source.datasetId, rowKey: n.source.rowKey, field: n.source.field }) } : {}
123
+ }) });
124
+ }
125
+ function ue(e, t) {
126
+ if (!t.source) return e.pages[t.address.pageIndex]?.meta?.reportScope === t.reportScope && q(e, t.address) ? { ...t.address } : null;
127
+ const r = V(e), o = O({ address: t.address, source: t.source });
128
+ for (const [n, a] of e.pages.entries())
129
+ if (!(t.reportScope !== void 0 && a.meta?.reportScope !== t.reportScope)) {
130
+ for (const [s, l] of a.components.entries())
131
+ if (l.grid)
132
+ for (const i of B(l.grid, l.widthMm, l.heightMm).cells) {
133
+ const c = { pageIndex: n, componentIndex: s, rowIndex: i.ri, columnIndex: i.ci }, u = r(c);
134
+ if (u?.source && O(u) === o) return c;
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ class d extends Error {
140
+ constructor(t, r) {
141
+ super(r), this.code = t, this.name = "ReportDataError";
142
+ }
143
+ }
144
+ function y(e, t, r) {
145
+ const o = e ?? t;
146
+ if (!Number.isSafeInteger(o) || o < 1 || o > r) throw new d("limit", "Invalid report data budget");
147
+ return o;
148
+ }
149
+ function z(e) {
150
+ if (typeof e == "string" && e.length > 0 && e.length <= 2048) return `s:${e}`;
151
+ if (typeof e == "number" && Number.isSafeInteger(e)) return `n:${Object.is(e, -0) ? 0 : e}`;
152
+ throw new d("identity", "A stable string or safe integer business key is required");
153
+ }
154
+ function D(e) {
155
+ if (typeof e.datasetId != "string" || !e.datasetId.trim() || e.datasetId.length > 2048) throw new d("identity", "A dataset identity is required");
156
+ if (e.sourceScope !== void 0 && (typeof e.sourceScope != "string" || !e.sourceScope.trim() || e.sourceScope.length > 2048)) throw new d("identity", "Invalid source scope");
157
+ }
158
+ function j(e, t = 256) {
159
+ if (!Array.isArray(e) || !e.length || e.length > t) throw new d("limit", "A bounded explicit field allowlist is required");
160
+ const r = /* @__PURE__ */ new Set();
161
+ for (const o of e) {
162
+ if (typeof o != "string" || !o.trim() || o.length > 2048 || ["__proto__", "constructor", "prototype"].includes(o)) throw new d("identity", "Invalid report field");
163
+ if (r.has(o)) throw new d("duplicate", "Duplicate report field");
164
+ r.add(o);
165
+ }
166
+ }
167
+ function K(e, t) {
168
+ const r = Object.getOwnPropertyDescriptor(e.values, t);
169
+ if (!r) return;
170
+ if (!("value" in r)) throw new d("value", "Report values must be plain scalar data");
171
+ const o = r.value;
172
+ if (o === null || typeof o == "boolean" || typeof o == "string" || typeof o == "number" && Number.isFinite(o)) return o;
173
+ throw new d("value", "Report values must be finite scalar data");
174
+ }
175
+ function ee(e) {
176
+ if (!e || typeof e != "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(e))) throw new d("value", "Report records must be plain data");
177
+ const t = Object.getOwnPropertyDescriptor(e, "rowKey"), r = Object.getOwnPropertyDescriptor(e, "values");
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
+ return { rowKey: t.value, values: r.value };
180
+ }
181
+ function A(e, t, r = {}) {
182
+ const o = y(r.maxRows, 5e4, 1e5), n = y(r.maxCells, 1e6, 2e6);
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
+ const a = /* @__PURE__ */ new Map();
185
+ for (let s = 0; s < e.length; s++) {
186
+ const l = Object.getOwnPropertyDescriptor(e, s);
187
+ if (!l || !("value" in l)) throw new d("value", "Sparse or accessor report records are unsupported");
188
+ const i = ee(l.value), c = z(i.rowKey);
189
+ if (a.has(c)) throw new d("duplicate", "Duplicate business row key");
190
+ const u = /* @__PURE__ */ Object.create(null);
191
+ for (const p of t) {
192
+ const f = K(i, p);
193
+ f !== void 0 && (u[p] = f);
194
+ }
195
+ a.set(c, { rowKey: i.rowKey, values: u });
196
+ }
197
+ return a;
198
+ }
199
+ function k(e) {
200
+ return e == null || e === "";
201
+ }
202
+ function E(e, t) {
203
+ return k(e) ? t.missing === "zero" ? S(0) : void 0 : S(e);
204
+ }
205
+ function te(e) {
206
+ return { coefficient: -e.coefficient, scale: e.scale };
207
+ }
208
+ function re(e, t, r, o) {
209
+ const n = E(e, r), a = Object.is(e, t) ? n : E(t, r);
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;
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
+ }
214
+ function W(e, t, r) {
215
+ return r.missing === "empty-equivalent" && k(e) && k(t) || Object.is(e, t);
216
+ }
217
+ function oe(e) {
218
+ j(e.fields.map((t) => t.field), y(e.maxFields, 256, 1024));
219
+ for (const t of e.fields) {
220
+ if (t.type !== void 0 && !["decimal", "value"].includes(t.type)) throw new d("value", "Invalid comparison field type");
221
+ if (t.missing && !["distinct", "empty-equivalent", "zero"].includes(t.missing)) throw new d("value", "Invalid missing-value policy");
222
+ if (t.zeroDenominator && !["omit", "zero-if-equal"].includes(t.zeroDenominator)) throw new d("value", "Invalid zero-denominator policy");
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");
225
+ if (t.ratioDigits !== void 0 && (!Number.isInteger(t.ratioDigits) || t.ratioDigits < 0 || t.ratioDigits > 100)) throw new d("value", "Invalid ratio precision");
226
+ }
227
+ return e.fields.map((t) => ({ ...t, toleranceValue: S(t.tolerance ?? "0") }));
228
+ }
229
+ function _(e, t, r, o, n) {
230
+ let a = !1;
231
+ for (const s of r) {
232
+ const l = e ? K(e, s.field) : void 0, i = t ? K(t, s.field) : void 0, c = s.type === "decimal" ? re(l, i, s, !e || !t) : { equal: W(l, i, s) };
233
+ if (e && t && c.equal) continue;
234
+ if (a = !0, o.length >= n) throw new d("limit", "Report differences exceed their budget");
235
+ const { equal: u, ...p } = c;
236
+ o.push({ rowKey: (t ?? e).rowKey, kind: e ? t ? "changed" : "removed" : "added", field: s.field, label: s.label ?? s.field, before: l, after: i, ...p });
237
+ }
238
+ return a;
239
+ }
240
+ function fe(e, t, r) {
241
+ D(e), D(t);
242
+ const o = oe(r);
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 };
245
+ for (const [u, p] of a) {
246
+ const f = s.get(u), g = _(p, f, o, i, l);
247
+ f ? g ? c.changed++ : c.unchanged++ : c.removed++;
248
+ }
249
+ for (const [u, p] of s) a.has(u) || (_(void 0, p, o, i, l), c.added++);
250
+ return c.cells = i.length, { sourceScope: t.sourceScope, datasetId: t.datasetId, differences: i, counts: c };
251
+ }
252
+ function M(e, t) {
253
+ D(t), j(t.fields, y(t.maxFields, 256, 1024));
254
+ const r = y(t.maxCells, 1e6, 2e6), o = new Set(t.fields), n = /* @__PURE__ */ new Map(), a = V(e);
255
+ let s = 0;
256
+ for (const [l, i] of e.pages.entries()) for (const [c, u] of i.components.entries()) {
257
+ if (!u.grid) continue;
258
+ for (const f of u.grid.cells)
259
+ if (s += f.length, s > r) throw new d("limit", "Report cell scan exceeds its budget");
260
+ const p = B(u.grid, u.widthMm, u.heightMm).cells;
261
+ for (const f of p) {
262
+ const g = a({ pageIndex: l, componentIndex: c, rowIndex: f.ri, columnIndex: f.ci }), m = g?.source;
263
+ if (!g || !m || m.datasetId !== t.datasetId || m.sourceScope !== t.sourceScope || !o.has(m.field)) continue;
264
+ z(m.rowKey);
265
+ const b = O(g), w = n.get(b);
266
+ w ? (!Object.is(w.context.value, g.value) || w.context.source?.revision !== m.revision || w.context.source?.sourceToken !== m.sourceToken || w.context.editable !== g.editable) && (w.ambiguous = !0) : n.set(b, { context: g, ambiguous: !1 });
267
+ }
268
+ }
269
+ return n;
270
+ }
271
+ function pe(e, t) {
272
+ const r = M(e, t), o = /* @__PURE__ */ new Map(), n = y(t.maxRows, 5e4, 1e5);
273
+ for (const { context: a, ambiguous: s } of r.values()) {
274
+ if (s) throw new d("conflict", "Repeated report cells disagree for the same business field");
275
+ const l = a.source, i = z(l.rowKey);
276
+ let c = o.get(i);
277
+ if (!c) {
278
+ if (o.size >= n) throw new d("limit", "Report row extraction exceeds its budget");
279
+ c = { rowKey: l.rowKey, values: /* @__PURE__ */ Object.create(null) }, o.set(i, c);
280
+ }
281
+ c.values[l.field] = a.value;
282
+ }
283
+ return { sourceScope: t.sourceScope, datasetId: t.datasetId, rows: [...o.values()] };
284
+ }
285
+ function N(e) {
286
+ return e == null || e === "";
287
+ }
288
+ function ne(e, t, r) {
289
+ if (!t) {
290
+ e.reason = "missing-target";
291
+ return;
292
+ }
293
+ const { context: o, ambiguous: n } = t;
294
+ if (e.before = o.value, n) {
295
+ e.status = "conflict", e.reason = "ambiguous";
296
+ return;
297
+ }
298
+ if (!o.editable || r.canEdit?.(o) === !1) {
299
+ e.reason = "readonly";
300
+ return;
301
+ }
302
+ if (N(e.after)) {
303
+ e.reason = "missing-source";
304
+ return;
305
+ }
306
+ if (Object.is(o.value, e.after)) {
307
+ e.status = "matched", e.reason = "unchanged";
308
+ return;
309
+ }
310
+ if (r.mode !== "replace" && !N(o.value)) {
311
+ e.reason = "occupied";
312
+ return;
313
+ }
314
+ try {
315
+ const a = T(o, e.after);
316
+ if (Object.is(a.value, a.previousValue)) {
317
+ e.status = "matched", e.reason = "unchanged";
318
+ return;
319
+ }
320
+ return e.after = a.value, e.status = "changed", a;
321
+ } catch {
322
+ e.status = "conflict", e.reason = "invalid";
323
+ return;
324
+ }
325
+ }
326
+ function ge(e, t) {
327
+ if (D(t), t.mode !== void 0 && t.mode !== "empty" && t.mode !== "replace") throw new d("value", "Invalid prefill policy");
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
+ 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);
331
+ if (a.size * o.length > i) throw new d("limit", "Prefill review exceeds its budget");
332
+ const c = [], u = [], p = { matched: 0, changed: 0, skipped: 0, conflict: 0 };
333
+ for (const f of a.values()) for (const g of t.fields) {
334
+ const m = { sourceScope: t.sourceScope, datasetId: t.datasetId, rowKey: f.rowKey, field: g.field }, b = { source: m, label: g.label ?? g.field, status: "skipped", after: K(f, g.sourceField ?? g.field) }, w = O({ address: { pageIndex: 0, componentIndex: 0, rowIndex: 0, columnIndex: 0 }, source: m }), x = ne(b, s.get(w), t);
335
+ if (x) {
336
+ if (u.length >= l) throw new d("limit", "Prefill changes exceed the atomic edit budget");
337
+ u.push(x);
338
+ }
339
+ p[b.status]++, c.push(b);
340
+ }
341
+ return { sourceScope: t.sourceScope, datasetId: t.datasetId, items: c, counts: p, edits: u };
342
+ }
343
+ function me(e, t, r) {
344
+ if (t.counts.conflict > 0) throw new d("conflict", "Resolve prefill conflicts before applying");
345
+ if (t.edits.length > 1e4) throw new d("limit", "Prefill changes exceed the atomic edit budget");
346
+ if (!t.edits.length) return [];
347
+ const o = [...new Set(t.edits.map((s) => s.source.field))], n = M(e, { sourceScope: t.sourceScope, datasetId: t.datasetId, fields: o }), a = /* @__PURE__ */ new Set();
348
+ return t.edits.map((s) => {
349
+ if (!s.source || s.source.datasetId !== t.datasetId || s.source.sourceScope !== t.sourceScope) throw new d("identity", "Prefill identity changed");
350
+ const l = O(s), i = n.get(l);
351
+ if (a.has(l)) throw new d("duplicate", "Duplicate prefill target");
352
+ if (a.add(l), !i || i.ambiguous || Z(i.context, s) || !Object.is(i.context.value, s.previousValue)) throw new d("conflict", "Prefill target changed; reload the preview");
353
+ if (!i.context.editable || r?.(i.context) === !1) throw new d("conflict", "Prefill target is read-only");
354
+ return { address: { ...i.context.address }, value: T(i.context, s.value).value };
355
+ });
356
+ }
357
+ export {
358
+ d as R,
359
+ h as a,
360
+ fe as b,
361
+ ce as c,
362
+ de as d,
363
+ ge as e,
364
+ me as f,
365
+ ue as g,
366
+ y as h,
367
+ M as i,
368
+ le as m,
369
+ pe as r,
370
+ L as v
371
+ };