@agile-team/mach-report 2.22.0 → 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 (154) hide show
  1. package/README.md +7 -6
  2. package/dist/{ExcelBindingWizard-CZyppD7I.js → ExcelBindingWizard-D4FLind-.js} +3 -3
  3. package/dist/{ExcelBindingWizard-CW79I6Gl.cjs → ExcelBindingWizard-D4RS5Bpg.cjs} +1 -1
  4. package/dist/{ParamEditor-CiYCJI0b.cjs → ParamEditor-C-6C9rd2.cjs} +1 -1
  5. package/dist/{ParamEditor-DQit-Gdf.js → ParamEditor-CASZt-Ma.js} +2 -2
  6. package/dist/{ReportBatchPanel-DKTpV7MU.js → ReportBatchPanel-Bq7t8a5r.js} +2 -2
  7. package/dist/{ReportBatchPanel-Db6TAfG5.cjs → ReportBatchPanel-YVj5IO5y.cjs} +1 -1
  8. package/dist/ReportLabelStudio-Cqhita1b.cjs +1 -0
  9. package/dist/{ReportLabelStudio-BYnRqmje.js → ReportLabelStudio-Dj7GXhuv.js} +295 -292
  10. package/dist/ReportParamPanel-DZbFVmDL.cjs +1 -0
  11. package/dist/{ReportParamPanel-BHSKVL8k.js → ReportParamPanel-Dgmqro1Y.js} +93 -79
  12. package/dist/ReportPreview-DeWzG8jQ.js +6257 -0
  13. package/dist/ReportPreview-FFIryrIr.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-DEXH07ND.cjs → ReportTemplateLibrary-BaWodmpm.cjs} +1 -1
  15. package/dist/{ReportTemplateLibrary-BZuKn0YK.js → ReportTemplateLibrary-DdAAAD2I.js} +1 -1
  16. package/dist/{RuleEditor-CIQn547x.js → RuleEditor-D2UwQGF6.js} +59 -59
  17. package/dist/{RuleEditor-zSUmPjKa.cjs → RuleEditor-DcT9xI1v.cjs} +1 -1
  18. package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +1 -0
  19. package/dist/{TemplateOutlinePanel-D0PgOSQE.js → TemplateOutlinePanel-DrT7XN0m.js} +2 -2
  20. package/dist/{TemplateReusePanel-BKlAEF8-.js → TemplateReusePanel-4eejkNqi.js} +2 -2
  21. package/dist/{TemplateReusePanel-DAy_Hwqz.cjs → TemplateReusePanel-DZMyiX5I.cjs} +1 -1
  22. package/dist/{TemplateReviewPanel-div-EH_m.js → TemplateReviewPanel-BIhNLeNw.js} +2 -2
  23. package/dist/{TemplateReviewPanel-CowmHaQQ.cjs → TemplateReviewPanel-DnYImiXu.cjs} +1 -1
  24. package/dist/analytics.cjs +1 -1
  25. package/dist/analytics.js +26 -26
  26. package/dist/artifact-integrity.json +106 -104
  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 +98 -45
  43. package/dist/designer.d.ts +98 -45
  44. package/dist/designer.js +3 -3
  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-ncQAvyOv.cjs → encoding-BefcaHdp.cjs} +1 -1
  50. package/dist/{encoding-DbnhbwI8.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 +6 -1
  57. package/dist/index.d.ts +6 -1
  58. package/dist/index.js +944 -1259
  59. package/dist/json-snapshot-1tvQNzQE.cjs +2 -0
  60. package/dist/{json-snapshot-DvQbZlD7.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-AcAQ2m9X.cjs → plugin-BFANt-i8.cjs} +1 -1
  68. package/dist/{plugin-w5Nyt08U.js → plugin-DeYYAL6F.js} +1 -1
  69. package/dist/{prefill-BXBxx5We.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-C9ZaylID.cjs → protocol-B9YgfQ_d.cjs} +1 -1
  76. package/dist/{protocol-fjaeKkjf.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-aA8nxmkZ.js → region-binding-workflow-DjrXuR1q.js} +2 -2
  80. package/dist/{region-binding-workflow-BiJQ7NU6.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-BTtpjF3D.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.cjs +5 -5
  89. package/dist/server-node.js +1642 -1586
  90. package/dist/server.cjs +1 -1
  91. package/dist/server.js +24 -24
  92. package/dist/style.css +1 -1
  93. package/dist/{template-catalog-JSxSqk5y.js → template-catalog--cjxzgH7.js} +17 -17
  94. package/dist/template-catalog-CoT7jm_6.cjs +1 -0
  95. package/dist/{template-fragments-D2JFj7Du.js → template-fragments-CPpGpQoz.js} +12 -12
  96. package/dist/template-fragments-GVjpew_q.cjs +1 -0
  97. package/dist/template-registry-DI59PXVK.cjs +1 -0
  98. package/dist/{template-registry-Do1Uav2Z.js → template-registry-O0hNIOfB.js} +17 -17
  99. package/dist/{template-serialization-CU4n_Miu.js → template-serialization-CWmHq7lX.js} +1 -1
  100. package/dist/{template-serialization-CgqBo6s-.cjs → template-serialization-CqQY4zDg.cjs} +1 -1
  101. package/dist/{textwrap-CkGjRFT3.js → textwrap-BIjtEWmq.js} +1 -1
  102. package/dist/textwrap-Cy7o1hIR.cjs +4 -0
  103. package/dist/vue/async.d.cts +24 -0
  104. package/dist/vue/async.d.ts +24 -0
  105. package/dist/vue/index.d.cts +25 -1
  106. package/dist/vue/index.d.ts +25 -1
  107. package/dist/vue-async.cjs +1 -1
  108. package/dist/vue-async.js +3 -3
  109. package/dist/vue.cjs +1 -1
  110. package/dist/vue.js +52 -47
  111. package/dist/{workbook-session-BvEBRRMz.cjs → workbook-session-C6-SrnCT.cjs} +4 -4
  112. package/dist/{workbook-session-f0wVlzst.js → workbook-session-C9ZmCBwY.js} +15 -16
  113. package/dist/worker.cjs +1 -1
  114. package/dist/worker.js +4 -4
  115. package/dist/xlsx.cjs +4 -4
  116. package/dist/xlsx.js +184 -179
  117. package/package.json +1 -1
  118. package/dist/ReportLabelStudio-B0i9ohQj.cjs +0 -1
  119. package/dist/ReportParamPanel-lngONOEz.cjs +0 -1
  120. package/dist/ReportPreview-BDgKssYR.js +0 -5887
  121. package/dist/ReportPreview-Dw-4icG6.cjs +0 -6
  122. package/dist/TemplateOutlinePanel-B5SfGYVN.cjs +0 -1
  123. package/dist/assets-CxHunY_9.js +0 -232
  124. package/dist/assets-vbjAGgk8.cjs +0 -1
  125. package/dist/auto-DcUHlKob.cjs +0 -1
  126. package/dist/auto-moShblh1.js +0 -240
  127. package/dist/charts-aCtoswXq.cjs +0 -1
  128. package/dist/component-tree-1_QCiQJX.js +0 -67
  129. package/dist/component-tree-BjZIp6w9.cjs +0 -1
  130. package/dist/computed-4TnxzgIh.cjs +0 -1
  131. package/dist/data-bar-YltqGTaC.cjs +0 -1
  132. package/dist/designer-B7jJeAeG.js +0 -6914
  133. package/dist/designer-BWQVpJeN.cjs +0 -2
  134. package/dist/grid-geometry-D3SJgWFv.js +0 -136
  135. package/dist/grid-geometry-D8ReblRV.cjs +0 -1
  136. package/dist/json-snapshot-nyV63AbB.cjs +0 -2
  137. package/dist/matrix-0hywp0-F.cjs +0 -1
  138. package/dist/matrix-Dy-tyY7E.js +0 -381
  139. package/dist/prefill-DUvejVt1.cjs +0 -1
  140. package/dist/prepared-YXy-fVLw.cjs +0 -1
  141. package/dist/prepared-rXCKqdHY.js +0 -88
  142. package/dist/progress-B0ctFpKf.cjs +0 -1
  143. package/dist/progress-Hc2vxoCs.js +0 -52
  144. package/dist/record-bindings-Ct1HkPrc.cjs +0 -1
  145. package/dist/record-bindings-VZGS-Qd8.js +0 -155
  146. package/dist/rich-text-layout-K48VHUoW.cjs +0 -3
  147. package/dist/rich-text-layout-wxBhnAS7.js +0 -102
  148. package/dist/runtime-Dq0LUsyS.cjs +0 -1
  149. package/dist/template-catalog-CLAM4w7H.cjs +0 -1
  150. package/dist/template-fragments-Ca25Jt7e.cjs +0 -1
  151. package/dist/template-outline-CDWXptuj.js +0 -88
  152. package/dist/template-outline-K4jGhATu.cjs +0 -1
  153. package/dist/template-registry-CWnuGqyP.cjs +0 -1
  154. package/dist/textwrap-OTOUMr4f.cjs +0 -4
package/dist/index.js CHANGED
@@ -1,762 +1,447 @@
1
- import { r as ye, D as le, b as J, a as _, c as q, d as Ge, e as Y, f as Je, m as ue, g as Ke, h as Me, p as V, P as ie } from "./grid-geometry-D3SJgWFv.js";
2
- import { C as _r, i as Wr, j as Ur, k as Vr, L as qr, M as Gr, S as Jr, l as Kr, n as Yr } from "./grid-geometry-D3SJgWFv.js";
3
- import { R as Zr, e as Qr, f as eo, p as to, b as no, t as ro, d as oo } from "./record-bindings-VZGS-Qd8.js";
4
- import { i as ce, a as Ye } from "./component-tree-1_QCiQJX.js";
5
- import { R as ao } from "./component-tree-1_QCiQJX.js";
6
- import { v as Xe, R as Ze, a as pe, p as re, b as Et } from "./template-registry-Do1Uav2Z.js";
7
- import { c as lo, d as co, e as mo, i as fo, s as ho, f as go, g as uo, h as po } from "./template-registry-Do1Uav2Z.js";
8
- import { v as Ct } from "./dataset-DL83majE.js";
9
- import { d as bo } from "./dataset-DL83majE.js";
10
- import { h as ve, w as Qe } from "./textwrap-CkGjRFT3.js";
11
- import { c as Mo, a as vo, b as xo, m as So } from "./textwrap-CkGjRFT3.js";
12
- import { R as xe, d as Tt, s as et, a as Rt, p as Pt } from "./json-snapshot-DvQbZlD7.js";
13
- import { D as Co, P as To, b as Ro, c as Po, e as $o, f as ko, g as Ao, h as Oo, i as Io, j as No, k as Do, l as Lo, m as Fo, n as jo, o as zo, q as Ho, r as Bo, t as _o, u as Wo, v as Uo, w as Vo, x as qo, y as Go, z as Jo, A as Ko, B as Yo, C as Xo, E as Zo, F as Qo, G as ei, H as ti, I as ni } from "./json-snapshot-DvQbZlD7.js";
14
- import { d as tt } from "./data-bar-8baGYEZ9.js";
15
- import { r as Se, d as $t } from "./rich-text-layout-wxBhnAS7.js";
16
- import { r as Z, n as nt, O as kt, a as Ee } from "./assets-CxHunY_9.js";
17
- import { b as oi, i as ii } from "./assets-CxHunY_9.js";
18
- import { o as At, w as De } from "./progress-Hc2vxoCs.js";
19
- import { c as Ot } from "./prefill-BXBxx5We.js";
20
- import { R as si, a as li, b as ci, d as di, e as mi, m as fi, r as hi, f as gi, g as ui, v as pi } from "./prefill-BXBxx5We.js";
21
- import { R as bi, a as yi, f as Mi, b as vi, c as xi, d as Si, i as Ei, e as Ci, g as Ti, p as Ri, h as Pi, j as $i, k as ki, r as Ai, v as Oi, l as Ii } from "./param-validation-CnDEd2l-.js";
22
- import { b as Di, d as Li } from "./matrix-Dy-tyY7E.js";
23
- import { k as ji, l as zi, r as Hi } from "./computed-C8NRZQss.js";
24
- import { c as _i, a as Wi, d as Ui, r as Vi, b as qi } from "./template-catalog-JSxSqk5y.js";
25
- import { c as Ji, i as Ki, t as Yi } from "./template-outline-CDWXptuj.js";
26
- import { a as Zi, c as Qi, i as ea, b as ta } from "./template-fragments-D2JFj7Du.js";
27
- import { T as ra, c as oa, a as ia } from "./template-serialization-CU4n_Miu.js";
28
- function we(e, t, n) {
29
- let r = 0, o = e.length;
30
- for (; r < o; ) {
31
- const i = r + o >>> 1;
32
- n(e[i]) < t ? r = i + 1 : o = i;
33
- }
34
- return r;
35
- }
36
- function rt(e) {
37
- if (![e.leftMm, e.topMm, e.widthMm, e.heightMm].every(Number.isFinite) || e.widthMm < 0 || e.heightMm < 0) throw new RangeError("Preview viewport must have finite coordinates and nonnegative dimensions.");
38
- return e;
39
- }
40
- function It(e) {
41
- const t = e.rows.map(() => []);
42
- for (const n of e.cells) {
43
- const r = Math.min(t.length, n.ri + (n.cell.rowSpan ?? 1));
44
- for (let o = n.ri; o < r; o++) t[o].push(n);
45
- }
46
- for (const n of t) n.sort((r, o) => r.xMm - o.xMm);
47
- return {
48
- cells(n) {
49
- rt(n);
50
- const r = /* @__PURE__ */ new Set(), o = n.topMm + n.heightMm, i = n.leftMm + n.widthMm;
51
- let l = we(e.rows, n.topMm, (s) => s.pos + s.size);
52
- for (; l < t.length && e.rows[l].pos <= o; ) {
53
- const s = t[l++];
54
- let a = we(s, n.leftMm, (c) => c.xMm + c.widthMm);
55
- for (; a < s.length && s[a].xMm <= i; ) r.add(s[a++]);
56
- }
57
- return [...r].sort((s, a) => s.ri - a.ri || s.ci - a.ci);
58
- }
59
- };
60
- }
61
- function Nt(e) {
62
- const t = ["h", "v"].map((n) => e.filter((r) => r.kind === n).sort((r, o) => r.pos - o.pos));
63
- return (n) => {
64
- const r = [];
65
- return t.forEach((o, i) => {
66
- const l = i === 0 ? n.topMm : n.leftMm, s = l + (i === 0 ? n.heightMm : n.widthMm), a = i === 0 ? n.leftMm : n.topMm, c = a + (i === 0 ? n.widthMm : n.heightMm);
67
- let d = we(o, l, (m) => m.pos);
68
- for (; d < o.length && o[d].pos <= s; ) {
69
- const m = o[d++];
70
- m.to >= a && m.from <= c && r.push(m);
71
- }
72
- }), r;
73
- };
74
- }
75
- function Dt() {
76
- const e = [];
77
- return {
78
- mount(t) {
79
- e.push(zt(t));
80
- },
81
- update(t, n, r) {
82
- rt(t);
83
- let o = !1;
84
- for (const i of e) o = i.update(t, i.component === n ? r : void 0) || o;
85
- return o;
86
- }
87
- };
88
- }
89
- function Lt(e, t) {
90
- const n = Math.max(8, e.widthMm / 4), r = Math.max(8, e.heightMm / 4);
91
- return {
92
- leftMm: e.leftMm - t.leftMm - n,
93
- topMm: e.topMm - t.topMm - r,
94
- widthMm: e.widthMm + 2 * n,
95
- heightMm: e.heightMm + 2 * r
96
- };
97
- }
98
- function Ft(e, t, n) {
99
- let r = t.get(n);
100
- return r || (r = e.table.ownerDocument.createElement("tr"), r.className = e.rowClass, r.setAttribute("role", "row"), r.setAttribute("aria-rowindex", String(n + 1)), r.style.cssText = "all:unset;display:contents;box-sizing:border-box", t.set(n, r)), r;
101
- }
102
- function jt(e, t, n, r) {
103
- const o = new Set(t), i = new Set(t.map((s) => s.ri));
104
- for (const [s, a] of n) o.has(s) || (a.remove(), n.delete(s));
105
- for (const [s, a] of r) i.has(s) || (a.remove(), r.delete(s));
106
- for (const s of t) {
107
- let a = n.get(s);
108
- a || (a = e.drawCell(s), a.setAttribute("aria-colindex", String(s.ci + 1)), n.set(s, a));
109
- const c = Ft(e, r, s.ri);
110
- a.parentElement !== c && c.appendChild(a);
111
- }
112
- const l = /* @__PURE__ */ new Map();
113
- for (const s of t) {
114
- const a = l.get(s.ri) ?? [];
115
- a.push(n.get(s)), l.set(s.ri, a);
116
- }
117
- for (const [s, a] of l) Le(r.get(s), a);
118
- Le(e.body, [...i].sort((s, a) => s - a).map((s) => r.get(s)));
119
- }
120
- function Le(e, t) {
121
- let n = e.firstElementChild;
122
- for (const r of t)
123
- r === n ? n = n.nextElementSibling : e.insertBefore(r, n);
124
- }
125
- function zt(e) {
126
- const t = ye(e.grid, e.component.widthMm, e.component.heightMm), n = new Map(t.cells.map((c) => [`${c.ri}:${c.ci}`, c])), r = It(t), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), l = Nt(Se(t, e.component));
127
- e.table.setAttribute("aria-rowcount", String(t.rows.length)), e.table.setAttribute("aria-colcount", String(t.columns.length));
128
- let s = "", a = "";
129
- return { component: e.component, update(c, d) {
130
- const m = Lt(c, e.component), f = r.cells(m), h = d && n.get(`${d.rowIndex}:${d.columnIndex}`);
131
- h && !f.includes(h) && f.push(h), f.sort((w, N) => w.ri - N.ri || w.ci - N.ci);
132
- const g = f.map((w) => `${w.ri}:${w.ci}`).join(";"), C = l(m), S = C.map((w) => `${w.kind}:${w.pos}:${w.from}:${w.to}`).join(";"), b = g !== s, M = S !== a;
133
- return b && (s = g, jt(e, f, o, i)), M && (a = S, e.edgeHost.replaceChildren(...e.drawEdges(C))), b || M;
134
- } };
135
- }
136
- const ot = /* @__PURE__ */ new WeakMap(), Ht = {
137
- root: "mr-root",
138
- page: "mr-page",
139
- comp: "mr-comp",
140
- text: "mr-text",
141
- lines: "mr-lines",
142
- line: "mr-line",
143
- rich: "mr-rich",
144
- paragraph: "mr-paragraph",
145
- segment: "mr-segment",
146
- image: "mr-image",
147
- shape: "mr-shape",
148
- grid: "mr-grid",
149
- row: "mr-row",
150
- cell: "mr-cell",
151
- unknown: "mr-unknown"
152
- };
153
- function P(e, t) {
154
- return t?.classNames?.[e] ?? Ht[e];
155
- }
156
- class Bt {
157
- constructor() {
158
- this.props = [];
159
- }
160
- add(t, n) {
161
- return n == null || n === !1 || n === "" ? this : (this.props.push([t, String(n)]), this);
162
- }
163
- mm(t, n, r, o = 2) {
164
- return this.add(t, `${J(ue(n, r), o)}px`);
165
- }
166
- toString() {
167
- let t = "";
168
- for (const [n, r] of this.props)
169
- t += `${n}:${r};`;
170
- return t;
171
- }
172
- applyTo(t) {
173
- const n = this.toString();
174
- n && (t.style.cssText = n);
175
- }
176
- }
177
- function x(e, t = "unset") {
178
- return new Bt().add("all", t).add("display", e).add("box-sizing", "border-box");
179
- }
180
- function it(e, t, n) {
181
- e.add("color", t.color).add("font-family", t.fontFamily).add("font-weight", t.bold != null ? t.bold ? "700" : "400" : void 0).add("font-style", t.italic != null ? t.italic ? "italic" : "normal" : void 0).add("text-decoration", t.underline != null ? t.underline ? "underline" : "none" : void 0).add("letter-spacing", t.letterSpacing != null ? `${t.letterSpacing}pt` : void 0).add("line-height", String(q(t))).add("text-align", t.align);
182
- const r = _(t, n);
183
- e.add("font-size", `${J(r.fontSizePx, 2)}px`);
184
- }
185
- function _t(e, t, n) {
186
- const r = t.style ?? {};
187
- it(e, r, n), e.add("background-color", r.backgroundColor).add("opacity", r.opacity != null ? String(r.opacity) : void 0).add("transform", r.rotateDeg ? `rotate(${r.rotateDeg}deg)` : void 0);
188
- }
189
- function Fe(e, t, n, r, o, i) {
190
- const l = e.cell, s = i.createElement("td");
191
- s.className = P("cell", o), s.dataset.mrRowIndex = String(e.ri), s.dataset.mrColumnIndex = String(e.ci), s.setAttribute("role", t.table?.role === "header" ? "columnheader" : "cell"), l.colSpan && (s.colSpan = l.colSpan), l.rowSpan && (s.rowSpan = l.rowSpan);
192
- const a = Ke(t.style, l.style), c = x("block").add("position", "absolute").mm("left", e.xMm, r).mm("top", e.yMm, r).mm("width", e.widthMm, r).mm("height", e.heightMm, r).add("background-color", a.backgroundColor).add("vertical-align", a.verticalAlign ?? "middle");
193
- it(c, a, r), c.applyTo(s);
194
- const d = tt(l.dataBar, e.widthMm, e.heightMm, n);
195
- if (d) {
196
- const f = i.createElement("div");
197
- f.className = "mr-cell-data-bar", f.setAttribute("aria-hidden", "true"), x("block").add("position", "absolute").mm("left", d.x, r).mm("top", d.y, r).mm("width", d.width, r).mm("height", d.height, r).add("background-color", d.color).add("opacity", "0.35").add("pointer-events", "none").applyTo(f), s.appendChild(f);
198
- }
199
- const m = i.createElement("div");
200
- m.className = "mr-cell-content", x("flex").add("position", "absolute").mm("left", n + (l.indentMm ?? 0), r).mm("right", n, r).mm("top", n, r).mm("bottom", n, r).add("flex-direction", "column").add("justify-content", a.verticalAlign === "top" ? "flex-start" : a.verticalAlign === "bottom" ? "flex-end" : "center").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(m), l.richParagraphs?.length ? m.appendChild(st({ ...t, kind: "text", richParagraphs: l.richParagraphs }, r, o, i)) : l.text != null && m.append(l.text);
201
- for (const f of l.children ?? []) m.appendChild(lt(f, r, o, i));
202
- return s.insertBefore(m, s.firstChild), s;
203
- }
204
- function Wt(e, t, n, r) {
205
- return at(Se(e, t), n, r);
206
- }
207
- function at(e, t, n) {
208
- return e.map((r) => {
209
- const o = `${J(r.widthPt * t / 72, 2)}px solid ${r.color}`, i = n.createElement("div");
210
- i.className = "mr-grid-edge", i.setAttribute("aria-hidden", "true");
211
- const l = r.kind === "h";
212
- return x("block").add("position", "absolute").add("pointer-events", "none").mm("left", l ? r.from : r.pos, t).mm("top", l ? r.pos : r.from, t).mm("width", l ? r.to - r.from : 0, t).mm("height", l ? 0 : r.to - r.from, t).add(l ? "border-top" : "border-left", o).applyTo(i), i;
213
- });
214
- }
215
- function Ut(e, t, n, r, o) {
216
- const i = o.createElement("table");
217
- i.className = P("grid", r), i.setAttribute("role", "table"), x("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(i);
218
- const l = o.createElement("tbody");
219
- x("contents").applyTo(l), i.appendChild(l);
220
- const s = t.style?.rotateDeg ? void 0 : ot.get(r);
221
- if (s) {
222
- const m = o.createElement("div");
223
- x("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(m);
224
- const f = o.createElement("div");
225
- return x("contents").applyTo(f), f.setAttribute("aria-hidden", "true"), s.mount({
226
- grid: e,
227
- component: t,
228
- table: i,
229
- rowClass: P("row", r),
230
- body: l,
231
- edgeHost: f,
232
- drawCell: (h) => Fe(h, t, e.paddingMm ?? 0.5, n, { ...r }, o),
233
- drawEdges: (h) => at(h, n, o)
234
- }), m.append(i, f), m;
235
- }
236
- const a = ye(e, t.widthMm, t.heightMm), c = e.cells.map(() => {
237
- const m = o.createElement("tr");
238
- return m.className = P("row", r), m.setAttribute("role", "row"), x("contents").applyTo(m), l.appendChild(m), m;
239
- });
240
- for (const m of a.cells)
241
- c[m.ri].appendChild(Fe(m, t, e.paddingMm ?? 0.5, n, r, o));
242
- const d = o.createElement("div");
243
- return x("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(d), d.append(i, ...Wt(a, t, n, o)), d;
244
- }
245
- function Vt(e, t, n, r) {
246
- const o = r.createElement("div");
247
- o.className = P("paragraph", n), x("block").add("text-align", e.align).add("line-height", e.lineHeight != null ? String(e.lineHeight) : void 0).mm("margin-top", e.spaceBeforeMm ?? 0, t).mm("margin-bottom", e.spaceAfterMm ?? 0, t).mm("text-indent", e.indentMm ?? 0, t).applyTo(o);
248
- for (const i of e.segments || []) {
249
- const l = r.createElement("span");
250
- l.className = P("segment", n), l.textContent = i.kind === "field" ? i.field ?? "" : i.text ?? "";
251
- const s = x("inline");
252
- if (i.style) {
253
- const a = i.style;
254
- s.add("color", a.color).add("background-color", a.backgroundColor).add("font-family", a.fontFamily).add("line-height", a.lineHeight).add("letter-spacing", a.letterSpacing == null ? void 0 : `${a.letterSpacing * t / 72}px`).add("font-weight", a.bold != null ? a.bold ? "700" : "400" : void 0).add("font-style", a.italic != null ? a.italic ? "italic" : "normal" : void 0).add("text-decoration", a.underline != null ? a.underline ? "underline" : "none" : void 0), (a.fontSize != null || a.fontSizePx != null) && s.add("font-size", `${J(_(a, t).fontSizePx, 2)}px`);
255
- }
256
- s.applyTo(l), o.appendChild(l);
257
- }
258
- return o;
259
- }
260
- function st(e, t, n, r) {
261
- if (Ye(e)) {
262
- const o = r.createElement("div");
263
- o.className = P("rich", n), x("block").applyTo(o);
264
- for (const i of e.richParagraphs) o.appendChild(Vt(i, t, n, r));
265
- return o;
266
- }
267
- if (Array.isArray(e.lines) && e.lines.length > 0) {
268
- const o = r.createElement("div");
269
- o.className = P("lines", n), x("block").applyTo(o);
270
- for (const i of e.lines) {
271
- const l = r.createElement("div");
272
- l.className = P("line", n), l.textContent = i, x("block").add("white-space", "pre").add("min-height", "1lh").applyTo(l), o.appendChild(l);
273
- }
274
- return o;
275
- }
276
- return e.text ?? "";
277
- }
278
- function qt(e, t, n, r) {
279
- const o = r.createElement("div");
280
- o.className = P("text", n);
281
- const i = e.style || {};
282
- return x("flex").add("width", "100%").add("height", "100%").add("flex-direction", "column").add("justify-content", i.verticalAlign === "middle" ? "center" : i.verticalAlign === "bottom" ? "flex-end" : "flex-start").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(o), o.append(st(e, t, n, r)), o;
283
- }
284
- function Gt(e, t, n) {
285
- const r = n.createElement("img");
286
- return r.className = P("image", t), r.src = e.imageData, x("block").add("width", "100%").add("height", "100%").add("object-fit", "contain").applyTo(r), r.alt = e.kind, r;
287
- }
288
- function je(e, t, n, r) {
289
- const o = r.createElement("div");
290
- o.className = P("shape", n);
291
- const i = e.style || {}, l = Y(i), s = Je(i), a = `${J(l.widthPt * t / 72, 2)}px solid ${l.color}`, c = x("block");
292
- return e.grid ? c.add("position", "relative") : e.kind === "rect" ? (s.top && c.add("border-top", a), s.right && c.add("border-right", a), s.bottom && c.add("border-bottom", a), s.left && c.add("border-left", a)) : e.kind === "ellipse" ? (s.inner && c.add("border", a).add("border-radius", "50%"), i.backgroundColor && c.add("background-color", i.backgroundColor)) : e.kind === "line" && c.add("height", "0").add("border-top", a), c.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), c.applyTo(o), o;
293
- }
294
- function Jt(e, t, n) {
295
- const r = n.createElementNS("http://www.w3.org/2000/svg", "svg"), o = ue(e.widthMm, t), i = ue(e.heightMm, t);
296
- r.setAttribute("width", String(Math.max(1, o))), r.setAttribute("height", String(Math.max(1, i))), r.setAttribute("aria-hidden", "true"), r.style.overflow = "visible", r.style.display = "block";
297
- const l = n.createElementNS("http://www.w3.org/2000/svg", "line");
298
- l.setAttribute("x1", "0"), l.setAttribute("x2", String(o)), l.setAttribute("y1", e.lineDirection === "up" ? String(i) : "0"), l.setAttribute("y2", e.lineDirection === "up" ? "0" : String(i));
299
- const s = Y({ ...e.style, borderColor: e.style?.lineColor ?? e.style?.borderColor });
300
- return l.setAttribute("stroke", s.color), l.setAttribute("stroke-width", String(s.widthPt * t / 72)), r.appendChild(l), r;
301
- }
302
- function lt(e, t, n, r) {
303
- const o = r.createElement("div");
304
- o.className = `${P("comp", n)} mr-kind-${e.kind}`;
305
- const i = x("block").add("position", "absolute").mm("left", e.leftMm, t).mm("top", e.topMm, t).mm("width", e.widthMm, t).mm("height", e.heightMm, t).add("box-sizing", "border-box");
306
- if (_t(i, e, t), i.applyTo(o), ce(e))
307
- return o.appendChild(Gt(e, n, r)), o;
308
- if (e.kind === "text")
309
- return o.appendChild(qt(e, t, n, r)), o;
310
- if (e.grid) {
311
- const s = je(e, t, n, r);
312
- return s.appendChild(Ut(e.grid, e, t, n, r)), o.appendChild(s), o;
313
- }
314
- if (e.kind === "line" && e.lineDirection)
315
- return o.appendChild(Jt(e, t, r)), o;
316
- if (e.kind === "line" || e.kind === "rect" || e.kind === "ellipse")
317
- return o.appendChild(je(e, t, n, r)), o;
318
- const l = r.createElement("div");
319
- return l.className = P("unknown", n), x("block").applyTo(l), l.textContent = e.fallbackText ?? `[${e.kind}]`, l.dataset.mrUnsupported = e.kind, l.setAttribute("role", "note"), o.appendChild(l), o;
320
- }
321
- function ct(e, t, n, r) {
322
- const o = r.createElement("div");
323
- return o.className = P("page", n), x("block", "initial").add("position", "relative").add("font-family", le).add("font-size", `${J(_(void 0, t).fontSizePx, 2)}px`).add("line-height", String(q(void 0))).add("white-space", "pre-wrap").add("direction", "ltr").mm("width", e.pageWidthMm, t).mm("height", e.pageHeightMm, t).add("background-color", "#fff").add("color", Ge).add("overflow", "hidden").add("box-sizing", "border-box").applyTo(o), e.components.forEach((i, l) => {
324
- const s = lt(i, t, n, r);
325
- s.dataset.mrComponentIndex = String(l), o.appendChild(s);
326
- }), o;
327
- }
328
- function wr(e, t, n = {}) {
329
- const r = n.dpi ?? 96;
330
- Z(e, "dom", n);
331
- const o = t.createElement("div");
332
- return o.className = P("root", n), x("block").applyTo(o), o.dataset.schemaVersion = e.schemaVersion, e.pages.forEach((i) => {
333
- o.appendChild(ct(i, r, n, t));
334
- }), o;
335
- }
336
- function br(e, t, n, r) {
337
- const o = { ...n }, i = Dt();
338
- return ot.set(o, i), { element: ct(e, t, o, r), update(s, a) {
339
- return i.update(s, a && e.components[a.componentIndex], a);
340
- } };
341
- }
342
- function Ce(e, t, n, r, o, i, l, s = "top") {
1
+ import { a as V, b as Q, c as fe, i as he, D as ge, o as nt, d as le, p as _, e as rt, r as it, f as ot, m as at, g as st, P as ee, w as Pe } from "./progress-ByiOxUD3.js";
2
+ import { C as lr, h as mr, j as dr, k as fr, L as hr, M as gr, R as ur, S as pr, l as wr, n as br, q as yr, s as Mr } from "./progress-ByiOxUD3.js";
3
+ import { P as xr, e as Er, f as Sr, R as Rr, g as Cr, h as Tr, p as Pr, b as $r, t as Or, j as Ar } from "./record-bindings-DatJZv_e.js";
4
+ import { v as Fe, R as je, a as me, p as X, b as ct } from "./template-registry-O0hNIOfB.js";
5
+ import { c as Dr, d as Lr, e as Nr, i as kr, s as Fr, f as jr, g as zr, h as Hr } from "./template-registry-O0hNIOfB.js";
6
+ import { v as lt } from "./dataset-DL83majE.js";
7
+ import { d as _r } from "./dataset-DL83majE.js";
8
+ import { h as ue, w as ze } from "./textwrap-BIjtEWmq.js";
9
+ import { c as Ur, a as qr, b as Vr, m as Jr } from "./textwrap-BIjtEWmq.js";
10
+ import { R as pe, d as mt, s as He, a as dt, p as ft } from "./json-snapshot-OqkPyUk5.js";
11
+ import { D as Kr, b as Yr, c as Xr, e as Zr, f as Qr, g as ei, h as ti, i as ni, j as ri, k as ii, l as oi, m as ai, n as si, o as ci, q as li, r as mi, t as di, u as fi, v as hi, w as gi, x as ui, y as pi, z as wi, A as bi, B as yi, C as Mi, E as vi, F as xi, G as Ei } from "./json-snapshot-OqkPyUk5.js";
12
+ import { c as Ri, a as Ci, b as Ti, i as Pi, r as $i, d as Oi, e as Ai, t as Ii } from "./dom-JWrchIre.js";
13
+ import { d as ht } from "./data-bar-IkI6VvMQ.js";
14
+ import { d as gt } from "./rich-text-layout-Ciwa6D2o.js";
15
+ import { r as re, n as Be, O as ut } from "./capabilities-pg7j7VLT.js";
16
+ import { i as Li } from "./capabilities-pg7j7VLT.js";
17
+ import { r as we } from "./assets-T_gDeFaz.js";
18
+ import { O as ki } from "./assets-T_gDeFaz.js";
19
+ import { r as pt } from "./grid-strokes-EoY66L2f.js";
20
+ import { c as wt } from "./prefill-Dk4C6S5R.js";
21
+ import { R as ji, a as zi, b as Hi, d as Bi, e as _i, m as Wi, r as Ui, f as qi, g as Vi, v as Ji } from "./prefill-Dk4C6S5R.js";
22
+ import { R as Ki, a as Yi, f as Xi, b as Zi, c as Qi, d as eo, i as to, e as no, g as ro, p as io, h as oo, j as ao, k as so, r as co, v as lo, l as mo } from "./param-validation-CnDEd2l-.js";
23
+ import { n as ho, f as go, o as uo, r as po, l as wo } from "./computed-f3pOqWLX.js";
24
+ import { c as yo, a as Mo, d as vo, r as xo, b as Eo } from "./template-catalog--cjxzgH7.js";
25
+ import { a as Ro, c as Co, i as To, b as Po } from "./template-fragments-CPpGpQoz.js";
26
+ import { T as Oo, c as Ao, a as Io } from "./template-serialization-CWmHq7lX.js";
27
+ function be(e, t, n, r, i, o, l, s = "top") {
343
28
  e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSizePx}px ${l}`, "letterSpacing" in e && (e.letterSpacing = "0px"), e.fillStyle = t.color, e.textBaseline = "alphabetic";
344
29
  const a = t.fontSizePx * t.lineHeight, c = t.text === "" ? [""] : t.text.split(`
345
- `), d = c.length * a;
346
- let m = r;
347
- s === "middle" ? m = r + (i - d) / 2 : s === "bottom" && (m = r + i - d), c.forEach((f, h) => {
348
- const g = m + h * a + t.fontSizePx * 0.8;
349
- Kt(e, f, t, n, g, o), t.underline && f && Yt(e, f, t, n, g, o);
30
+ `), m = c.length * a;
31
+ let f = r;
32
+ s === "middle" ? f = r + (o - m) / 2 : s === "bottom" && (f = r + o - m), c.forEach((d, h) => {
33
+ const g = f + h * a + t.fontSizePx * 0.8;
34
+ bt(e, d, t, n, g, i), t.underline && d && yt(e, d, t, n, g, i);
350
35
  }), e.textAlign = "left";
351
36
  }
352
- function Kt(e, t, n, r, o, i) {
37
+ function bt(e, t, n, r, i, o) {
353
38
  const l = Array.from(t), s = n.letterSpacingPx ?? 0;
354
39
  if (!s) {
355
40
  e.textAlign = n.align === "center" ? "center" : n.align === "right" ? "right" : "left";
356
- const m = n.align === "center" ? r + i / 2 : n.align === "right" ? r + i : r;
357
- e.fillText(t, m, o);
41
+ const f = n.align === "center" ? r + o / 2 : n.align === "right" ? r + o : r;
42
+ e.fillText(t, f, i);
358
43
  return;
359
44
  }
360
- const a = e.measureText(t).width + Math.max(0, l.length - 1) * s, c = n.align === "center" ? r + (i - a) / 2 : n.align === "right" ? r + i - a : r;
45
+ const a = e.measureText(t).width + Math.max(0, l.length - 1) * s, c = n.align === "center" ? r + (o - a) / 2 : n.align === "right" ? r + o - a : r;
361
46
  e.textAlign = "left";
362
- let d = "";
363
- l.forEach((m, f) => {
364
- e.fillText(m, c + e.measureText(d).width + f * s, o), d += m;
47
+ let m = "";
48
+ l.forEach((f, d) => {
49
+ e.fillText(f, c + e.measureText(m).width + d * s, i), m += f;
365
50
  });
366
51
  }
367
- function Yt(e, t, n, r, o, i) {
368
- const l = e.measureText(t).width + Math.max(0, Array.from(t).length - 1) * (n.letterSpacingPx ?? 0), s = n.align === "center" ? r + (i - l) / 2 : n.align === "right" ? r + i - l : r;
369
- e.strokeStyle = n.color, e.lineWidth = Math.max(0.5, n.fontSizePx / 20), e.beginPath(), e.moveTo(s, o + 1), e.lineTo(s + l, o + 1), e.stroke();
52
+ function yt(e, t, n, r, i, o) {
53
+ const l = e.measureText(t).width + Math.max(0, Array.from(t).length - 1) * (n.letterSpacingPx ?? 0), s = n.align === "center" ? r + (o - l) / 2 : n.align === "right" ? r + o - l : r;
54
+ e.strokeStyle = n.color, e.lineWidth = Math.max(0.5, n.fontSizePx / 20), e.beginPath(), e.moveTo(s, i + 1), e.lineTo(s + l, i + 1), e.stroke();
370
55
  }
371
- function dt(e, t, n, r, o) {
372
- const i = r / 72, l = (s) => {
373
- e.font = `${s.italic ? "italic " : ""}${s.bold ? "bold " : ""}${_(s, r).fontSizePx}px ${s.fontFamily ?? o}`, "letterSpacing" in e && (e.letterSpacing = "0px");
56
+ function _e(e, t, n, r, i) {
57
+ const o = r / 72, l = (s) => {
58
+ e.font = `${s.italic ? "italic " : ""}${s.bold ? "bold " : ""}${V(s, r).fontSizePx}px ${s.fontFamily ?? i}`, "letterSpacing" in e && (e.letterSpacing = "0px");
374
59
  };
375
- $t(t, { x: n.x / i, yTop: -n.y / i, width: n.width / i, height: n.height / i }, {
60
+ gt(t, { x: n.x / o, yTop: -n.y / o, width: n.width / o, height: n.height / o }, {
376
61
  measure(s, a) {
377
- return l(a), e.measureText(s).width / i + (a.letterSpacing ?? 0);
62
+ return l(a), e.measureText(s).width / o + (a.letterSpacing ?? 0);
378
63
  },
379
- draw(s, a, c, d, m) {
380
- const f = _(a, r).fontSizePx, h = -d * i - f * 0.8;
381
- a.backgroundColor && (e.fillStyle = a.backgroundColor, e.fillRect(c * i, h, m * i, f * q(a))), Ce(e, { text: s, fontSizePx: f, bold: !!a.bold, italic: a.italic, underline: a.underline, color: Me(a), align: "left", lineHeight: q(a), letterSpacingPx: (a.letterSpacing ?? 0) * i }, c * i, h, m * i, f, a.fontFamily ?? o);
64
+ draw(s, a, c, m, f) {
65
+ const d = V(a, r).fontSizePx, h = -m * o - d * 0.8;
66
+ a.backgroundColor && (e.fillStyle = a.backgroundColor, e.fillRect(c * o, h, f * o, d * Q(a))), be(e, { text: s, fontSizePx: d, bold: !!a.bold, italic: a.italic, underline: a.underline, color: fe(a), align: "left", lineHeight: Q(a), letterSpacingPx: (a.letterSpacing ?? 0) * o }, c * o, h, f * o, d, a.fontFamily ?? i);
382
67
  }
383
68
  });
384
69
  }
385
- function A(e) {
70
+ function $(e) {
386
71
  if (e?.aborted) throw e.reason ?? new DOMException("The operation was aborted.", "AbortError");
387
72
  }
388
- const Xt = (e, t) => (A(t), /^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e) ? new Promise((n, r) => {
389
- const o = new Image(), i = () => {
390
- o.onload = null, o.onerror = null, t?.removeEventListener("abort", l);
73
+ const Mt = (e, t) => ($(t), /^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e) ? new Promise((n, r) => {
74
+ const i = new Image(), o = () => {
75
+ i.onload = null, i.onerror = null, t?.removeEventListener("abort", l);
391
76
  }, l = () => {
392
- i(), o.src = "", r(t?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
77
+ o(), i.src = "", r(t?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
393
78
  };
394
- o.onload = () => {
395
- i(), n(o);
396
- }, o.onerror = () => {
397
- i(), r(new Error("Image could not be decoded for Canvas output."));
398
- }, t?.addEventListener("abort", l, { once: !0 }), o.src = e;
79
+ i.onload = () => {
80
+ o(), n(i);
81
+ }, i.onerror = () => {
82
+ o(), r(new Error("Image could not be decoded for Canvas output."));
83
+ }, t?.addEventListener("abort", l, { once: !0 }), i.src = e;
399
84
  }) : Promise.reject(new TypeError("Canvas imageData must be an image data URL; provide imageLoader for other sources.")));
400
- function Zt(e, t, n) {
401
- return A(n), n ? new Promise((r, o) => {
402
- const i = () => o(n.reason ?? new DOMException("The operation was aborted.", "AbortError"));
403
- n.addEventListener("abort", i, { once: !0 }), Promise.resolve().then(() => e(t, n)).then(r, o).finally(() => n.removeEventListener("abort", i));
85
+ function vt(e, t, n) {
86
+ return $(n), n ? new Promise((r, i) => {
87
+ const o = () => i(n.reason ?? new DOMException("The operation was aborted.", "AbortError"));
88
+ n.addEventListener("abort", o, { once: !0 }), Promise.resolve().then(() => e(t, n)).then(r, i).finally(() => n.removeEventListener("abort", o));
404
89
  }) : e(t);
405
90
  }
406
- function* Te(e) {
407
- function* t(n, r, o, i) {
408
- if (i.has(n)) throw new TypeError("Cyclic grid children cannot be rendered.");
409
- ce(n) && (yield { component: n, componentIndex: r, componentPath: o });
410
- const l = new Set(i).add(n);
411
- for (const [s, a] of (n.grid?.cells ?? []).entries()) for (const [c, d] of a.entries()) for (const [m, f] of (d?.children ?? []).entries()) yield* t(f, r, [...o, s, c, m], l);
91
+ function* ye(e) {
92
+ function* t(n, r, i, o) {
93
+ if (o.has(n)) throw new TypeError("Cyclic grid children cannot be rendered.");
94
+ he(n) && (yield { component: n, componentIndex: r, componentPath: i });
95
+ const l = new Set(o).add(n);
96
+ for (const [s, a] of (n.grid?.cells ?? []).entries()) for (const [c, m] of a.entries()) for (const [f, d] of (m?.children ?? []).entries()) yield* t(d, r, [...i, s, c, f], l);
412
97
  }
413
98
  for (const [n, r] of e.components.entries()) yield* t(r, n, [], /* @__PURE__ */ new Set());
414
99
  }
415
- async function Qt(e, t, n) {
100
+ async function xt(e, t, n) {
416
101
  const r = /* @__PURE__ */ new Map();
417
- for (const { component: o } of Te(e))
418
- !ce(o) || r.has(o.imageData) || r.set(o.imageData, await Zt(t, o.imageData, n));
419
- return A(n), r;
102
+ for (const { component: i } of ye(e))
103
+ !he(i) || r.has(i.imageData) || r.set(i.imageData, await vt(t, i.imageData, n));
104
+ return $(n), r;
420
105
  }
421
- function en(e, t, n, r, o, i) {
422
- const l = t, s = l.naturalWidth ?? l.width ?? o, a = l.naturalHeight ?? l.height ?? i;
106
+ function Et(e, t, n, r, i, o) {
107
+ const l = t, s = l.naturalWidth ?? l.width ?? i, a = l.naturalHeight ?? l.height ?? o;
423
108
  if (s <= 0 || a <= 0) throw new RangeError("Decoded Canvas image dimensions must be positive.");
424
- const c = Math.min(o / s, i / a), d = s * c, m = a * c;
425
- e.drawImage(t, n + (o - d) / 2, r + (i - m) / 2, d, m);
109
+ const c = Math.min(i / s, o / a), m = s * c, f = a * c;
110
+ e.drawImage(t, n + (i - m) / 2, r + (o - f) / 2, m, f);
426
111
  }
427
- function tn(e) {
428
- return Ot(e.pageHeightsPx, e.gapPx).window(e.viewportHeightPx, e.scrollTopPx, e.overscan);
112
+ function St(e) {
113
+ return wt(e.pageHeightsPx, e.gapPx).window(e.viewportHeightPx, e.scrollTopPx, e.overscan);
429
114
  }
430
- const Re = 96 / 25.4;
431
- function Pe(e, t = 96) {
432
- const n = t / 96 * Re;
115
+ const Me = 96 / 25.4;
116
+ function ve(e, t = 96) {
117
+ const n = t / 96 * Me;
433
118
  return {
434
119
  widthPx: Math.max(1, Math.round(e.pageWidthMm * n)),
435
120
  heightPx: Math.max(1, Math.round(e.pageHeightMm * n))
436
121
  };
437
122
  }
438
- function mt(e, t, n, r = 64e6) {
123
+ function We(e, t, n, r = 64e6) {
439
124
  if (!Number.isFinite(t) || t <= 0 || !Number.isFinite(n) || n <= 0) throw new RangeError("Canvas dpr and dpi must be positive finite numbers.");
440
125
  if (!Number.isFinite(r) || r <= 0) throw new RangeError("maxCanvasPixels must be positive and finite.");
441
- const o = Pe(e, n), i = Math.round(o.widthPx * t), l = Math.round(o.heightPx * t);
442
- if (!Number.isSafeInteger(i) || !Number.isSafeInteger(l) || i * l > r) throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");
443
- return { width: i, height: l };
444
- }
445
- function ft(e, t, n, r) {
446
- const o = document.createElement("canvas"), { widthPx: i, heightPx: l } = Pe(e, n), s = mt(e, t, n, r);
447
- o.width = s.width, o.height = s.height, o.style.width = `${i}px`, o.style.height = `${l}px`;
448
- const a = o.getContext("2d");
126
+ const i = ve(e, n), o = Math.round(i.widthPx * t), l = Math.round(i.heightPx * t);
127
+ if (!Number.isSafeInteger(o) || !Number.isSafeInteger(l) || o * l > r) throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");
128
+ return { width: o, height: l };
129
+ }
130
+ function Ue(e, t, n, r) {
131
+ const i = document.createElement("canvas"), { widthPx: o, heightPx: l } = ve(e, n), s = We(e, t, n, r);
132
+ i.width = s.width, i.height = s.height, i.style.width = `${o}px`, i.style.height = `${l}px`;
133
+ const a = i.getContext("2d");
449
134
  if (!a)
450
135
  throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");
451
- return a.scale(t, t), a.fillStyle = "#ffffff", a.fillRect(0, 0, i, l), { canvas: o, ctx: a };
136
+ return a.scale(t, t), a.fillStyle = "#ffffff", a.fillRect(0, 0, o, l), { canvas: i, ctx: a };
452
137
  }
453
- function yr(e, t = 96) {
454
- return _(e, t).fontSizePx;
138
+ function Hn(e, t = 96) {
139
+ return V(e, t).fontSizePx;
455
140
  }
456
- function nn(e, t, n, r, o, i, l) {
457
- for (const s of Se(t, n))
458
- e.strokeStyle = s.color, e.lineWidth = V(s.widthPt, l), e.beginPath(), s.kind === "v" ? (e.moveTo(r + s.pos * i, o + s.from * i), e.lineTo(r + s.pos * i, o + s.to * i)) : (e.moveTo(r + s.from * i, o + s.pos * i), e.lineTo(r + s.to * i, o + s.pos * i)), e.stroke();
141
+ function Rt(e, t, n, r, i, o, l) {
142
+ for (const s of pt(t, n))
143
+ e.strokeStyle = s.color, e.lineWidth = _(s.widthPt, l), e.beginPath(), s.kind === "v" ? (e.moveTo(r + s.pos * o, i + s.from * o), e.lineTo(r + s.pos * o, i + s.to * o)) : (e.moveTo(r + s.from * o, i + s.pos * o), e.lineTo(r + s.to * o, i + s.pos * o)), e.stroke();
459
144
  }
460
- function rn(e, t, n, r, o, i) {
461
- e.beginPath(), t.top && (e.moveTo(n, r), e.lineTo(n + o, r)), t.right && (e.moveTo(n + o, r), e.lineTo(n + o, r + i)), t.bottom && (e.moveTo(n + o, r + i), e.lineTo(n, r + i)), t.left && (e.moveTo(n, r + i), e.lineTo(n, r)), e.stroke();
145
+ function Ct(e, t, n, r, i, o) {
146
+ e.beginPath(), t.top && (e.moveTo(n, r), e.lineTo(n + i, r)), t.right && (e.moveTo(n + i, r), e.lineTo(n + i, r + o)), t.bottom && (e.moveTo(n + i, r + o), e.lineTo(n, r + o)), t.left && (e.moveTo(n, r + o), e.lineTo(n, r)), e.stroke();
462
147
  }
463
- function on(e, t, n, r, o, i, l, s, a, c, d, m) {
464
- const f = ye(t, i / s, l / s);
465
- for (const h of f.cells) {
148
+ function Tt(e, t, n, r, i, o, l, s, a, c, m, f) {
149
+ const d = it(t, o / s, l / s);
150
+ for (const h of d.cells) {
466
151
  const g = h.cell.style?.backgroundColor ?? n.style?.backgroundColor;
467
- g && (e.fillStyle = g, e.fillRect(r + h.xMm * s, o + h.yMm * s, h.widthMm * s, h.heightMm * s));
152
+ g && (e.fillStyle = g, e.fillRect(r + h.xMm * s, i + h.yMm * s, h.widthMm * s, h.heightMm * s));
468
153
  }
469
- nn(e, f, n, r, o, s, a);
470
- for (const h of f.cells) an(e, h, n, r, o, s, a, c, d, m);
154
+ Rt(e, d, n, r, i, s, a);
155
+ for (const h of d.cells) Pt(e, h, n, r, i, s, a, c, m, f);
471
156
  }
472
- function an(e, t, n, r, o, i, l, s, a, c) {
473
- const d = n.grid?.paddingMm ?? 0.5, m = t.cell.text ?? "", f = Ke(n.style, t.cell.style), h = _(f, l), g = t.cell.indentMm ?? 0, C = Math.max(0, t.widthMm - 2 * d - g), S = Qe(m, C, { fontSizePt: h.fontSizePt, bold: f.bold, italic: f.italic, fontFamily: f.fontFamily ?? s, letterSpacingPt: f.letterSpacing }, a).join(`
474
- `), b = { x: r + (t.xMm + d + g) * i, y: o + (t.yMm + d) * i, width: C * i, height: Math.max(0, t.heightMm - 2 * d) * i };
475
- e.save(), e.beginPath(), e.rect(b.x, b.y, b.width, b.height), e.clip(), t.cell.richParagraphs?.length ? dt(e, { ...n, richParagraphs: t.cell.richParagraphs, style: { verticalAlign: "middle", ...f } }, b, l, s) : Ce(
157
+ function Pt(e, t, n, r, i, o, l, s, a, c) {
158
+ const m = n.grid?.paddingMm ?? 0.5, f = t.cell.text ?? "", d = at(n.style, t.cell.style), h = V(d, l), g = t.cell.indentMm ?? 0, S = Math.max(0, t.widthMm - 2 * m - g), E = ze(f, S, { fontSizePt: h.fontSizePt, bold: d.bold, italic: d.italic, fontFamily: d.fontFamily ?? s, letterSpacingPt: d.letterSpacing }, a).join(`
159
+ `), b = { x: r + (t.xMm + m + g) * o, y: i + (t.yMm + m) * o, width: S * o, height: Math.max(0, t.heightMm - 2 * m) * o };
160
+ e.save(), e.beginPath(), e.rect(b.x, b.y, b.width, b.height), e.clip(), t.cell.richParagraphs?.length ? _e(e, { ...n, richParagraphs: t.cell.richParagraphs, style: { verticalAlign: "middle", ...d } }, b, l, s) : be(
476
161
  e,
477
162
  {
478
- text: S,
163
+ text: E,
479
164
  fontSizePx: h.fontSizePx,
480
- bold: f.bold ?? !1,
481
- italic: f.italic,
482
- underline: f.underline,
483
- color: Me(f, Ge),
484
- align: f.align ?? "left",
485
- lineHeight: q(f),
486
- letterSpacingPx: V(f.letterSpacing ?? 0, l)
165
+ bold: d.bold ?? !1,
166
+ italic: d.italic,
167
+ underline: d.underline,
168
+ color: fe(d, st),
169
+ align: d.align ?? "left",
170
+ lineHeight: Q(d),
171
+ letterSpacingPx: _(d.letterSpacing ?? 0, l)
487
172
  },
488
- r + (t.xMm + d + g) * i,
489
- o + (t.yMm + d) * i,
490
- C * i,
491
- Math.max(0, t.heightMm - 2 * d) * i,
492
- f.fontFamily ?? s,
493
- f.verticalAlign ?? "middle"
173
+ r + (t.xMm + m + g) * o,
174
+ i + (t.yMm + m) * o,
175
+ S * o,
176
+ Math.max(0, t.heightMm - 2 * m) * o,
177
+ d.fontFamily ?? s,
178
+ d.verticalAlign ?? "middle"
494
179
  );
495
- for (const w of t.cell.children ?? []) de(e, { ...w, leftMm: w.leftMm + b.x / i, topMm: w.topMm + b.y / i }, i, l, s, a, c);
180
+ for (const R of t.cell.children ?? []) ie(e, { ...R, leftMm: R.leftMm + b.x / o, topMm: R.topMm + b.y / o }, o, l, s, a, c);
496
181
  e.restore();
497
- const M = tt(t.cell.dataBar, t.widthMm, t.heightMm, d);
498
- M && (e.save(), e.globalAlpha *= 0.35, e.fillStyle = M.color, e.fillRect(r + (t.xMm + M.x) * i, o + (t.yMm + M.y) * i, M.width * i, M.height * i), e.restore());
182
+ const M = ht(t.cell.dataBar, t.widthMm, t.heightMm, m);
183
+ M && (e.save(), e.globalAlpha *= 0.35, e.fillStyle = M.color, e.fillRect(r + (t.xMm + M.x) * o, i + (t.yMm + M.y) * o, M.width * o, M.height * o), e.restore());
499
184
  }
500
- function sn(e, t, n, r, o, i, l, s, a) {
501
- const c = t.style ?? {}, d = _(c, l);
502
- if (Ye(t)) {
503
- dt(e, t, { x: n, y: r, width: o, height: i }, l, s);
185
+ function $t(e, t, n, r, i, o, l, s, a) {
186
+ const c = t.style ?? {}, m = V(c, l);
187
+ if (ot(t)) {
188
+ _e(e, t, { x: n, y: r, width: i, height: o }, l, s);
504
189
  return;
505
190
  }
506
- const m = t.lines?.length ? t.lines.join(`
507
- `) : Qe(t.text ?? "", t.widthMm, { fontSizePt: d.fontSizePt, bold: c.bold, italic: c.italic, fontFamily: c.fontFamily ?? s, letterSpacingPt: c.letterSpacing }, a).join(`
191
+ const f = t.lines?.length ? t.lines.join(`
192
+ `) : ze(t.text ?? "", t.widthMm, { fontSizePt: m.fontSizePt, bold: c.bold, italic: c.italic, fontFamily: c.fontFamily ?? s, letterSpacingPt: c.letterSpacing }, a).join(`
508
193
  `);
509
- Ce(e, {
510
- text: m,
511
- fontSizePx: d.fontSizePx,
194
+ be(e, {
195
+ text: f,
196
+ fontSizePx: m.fontSizePx,
512
197
  bold: c.bold ?? !1,
513
198
  italic: c.italic,
514
199
  underline: c.underline,
515
- color: Me(c),
200
+ color: fe(c),
516
201
  align: c.align ?? "left",
517
- lineHeight: q(c),
518
- letterSpacingPx: V(c.letterSpacing ?? 0, l)
519
- }, n, r, o, i, c.fontFamily ?? s, c.verticalAlign);
520
- }
521
- function de(e, t, n, r, o, i, l) {
522
- const s = t.leftMm * n, a = t.topMm * n, c = t.widthMm * n, d = t.heightMm * n, m = t.style ?? {};
523
- if (ce(t)) {
524
- const f = l?.get(t.imageData);
525
- f ? en(e, f, s, a, c, d) : ze(e, t, s, a, c, d);
202
+ lineHeight: Q(c),
203
+ letterSpacingPx: _(c.letterSpacing ?? 0, l)
204
+ }, n, r, i, o, c.fontFamily ?? s, c.verticalAlign);
205
+ }
206
+ function ie(e, t, n, r, i, o, l) {
207
+ const s = t.leftMm * n, a = t.topMm * n, c = t.widthMm * n, m = t.heightMm * n, f = t.style ?? {};
208
+ if (he(t)) {
209
+ const d = l?.get(t.imageData);
210
+ d ? Et(e, d, s, a, c, m) : $e(e, t, s, a, c, m);
526
211
  return;
527
212
  }
528
213
  if (t.grid) {
529
- on(e, t.grid, t, s, a, c, d, n, r, o, i, l);
214
+ Tt(e, t.grid, t, s, a, c, m, n, r, i, o, l);
530
215
  return;
531
216
  }
532
217
  switch (t.kind) {
533
218
  case "text": {
534
- sn(e, t, s, a, c, d, r, o, i);
219
+ $t(e, t, s, a, c, m, r, i, o);
535
220
  break;
536
221
  }
537
222
  case "rect": {
538
- const f = Y(m), h = Je(m);
539
- m.backgroundColor && (e.fillStyle = m.backgroundColor, e.fillRect(s, a, c, d)), h.inner && (e.strokeStyle = f.color, e.lineWidth = V(f.widthPt, r), rn(e, h, s, a, c, d));
223
+ const d = le(f), h = rt(f);
224
+ f.backgroundColor && (e.fillStyle = f.backgroundColor, e.fillRect(s, a, c, m)), h.inner && (e.strokeStyle = d.color, e.lineWidth = _(d.widthPt, r), Ct(e, h, s, a, c, m));
540
225
  break;
541
226
  }
542
227
  case "line": {
543
- const f = Y({ ...m, borderColor: m.lineColor ?? m.borderColor });
544
- e.strokeStyle = f.color, e.lineWidth = V(f.widthPt, r), e.beginPath();
545
- const h = t.lineDirection === "up" ? a + d : t.lineDirection === "down" ? a : a + d / 2, g = t.lineDirection === "up" ? a : t.lineDirection === "down" ? a + d : a + d / 2;
228
+ const d = le({ ...f, borderColor: f.lineColor ?? f.borderColor });
229
+ e.strokeStyle = d.color, e.lineWidth = _(d.widthPt, r), e.beginPath();
230
+ const h = t.lineDirection === "up" ? a + m : t.lineDirection === "down" ? a : a + m / 2, g = t.lineDirection === "up" ? a : t.lineDirection === "down" ? a + m : a + m / 2;
546
231
  e.moveTo(s, h), e.lineTo(s + c, g), e.stroke();
547
232
  break;
548
233
  }
549
234
  case "ellipse": {
550
- const f = Y(m);
551
- e.strokeStyle = f.color, e.lineWidth = V(f.widthPt, r), m.backgroundColor && (e.fillStyle = m.backgroundColor, e.beginPath(), e.ellipse(s + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(s + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
235
+ const d = le(f);
236
+ e.strokeStyle = d.color, e.lineWidth = _(d.widthPt, r), f.backgroundColor && (e.fillStyle = f.backgroundColor, e.beginPath(), e.ellipse(s + c / 2, a + m / 2, c / 2, m / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(s + c / 2, a + m / 2, c / 2, m / 2, 0, 0, Math.PI * 2), e.stroke();
552
237
  break;
553
238
  }
554
239
  default:
555
- ze(e, t, s, a, c, d);
240
+ $e(e, t, s, a, c, m);
556
241
  break;
557
242
  }
558
243
  }
559
- function ze(e, t, n, r, o, i) {
560
- e.save(), e.strokeStyle = "#94a3b8", e.strokeRect(n, r, o, i), e.fillStyle = "#64748b", e.font = "12px sans-serif", e.fillText(t.fallbackText ?? `[${t.kind}]`, n + 3, r + 14), e.restore();
244
+ function $e(e, t, n, r, i, o) {
245
+ e.save(), e.strokeStyle = "#94a3b8", e.strokeRect(n, r, i, o), e.fillStyle = "#64748b", e.font = "12px sans-serif", e.fillText(t.fallbackText ?? `[${t.kind}]`, n + 3, r + 14), e.restore();
561
246
  }
562
- async function Mr(e, t = {}) {
247
+ async function Bn(e, t = {}) {
563
248
  if (typeof document > "u")
564
249
  throw new Error("renderPlanToImages 需要浏览器环境(SSR/Node 请在客户端钩子中调用)");
565
- const { format: n = "png", quality: r = 0.92, ...o } = t;
250
+ const { format: n = "png", quality: r = 0.92, ...i } = t;
566
251
  if (n !== "png" && n !== "jpeg") throw new TypeError("Image format must be png or jpeg.");
567
252
  if (!Number.isFinite(r) || r < 0 || r > 1) throw new RangeError("Image quality must be between 0 and 1.");
568
- A(t.signal);
569
- const i = await Ee(e, { ...t, format: "canvas" });
570
- e = i.plan;
571
- const l = [...i.diagnostics, ...Z(e, "canvas", t)], s = n === "jpeg" ? "image/jpeg" : "image/png", a = [], c = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
572
- for (let d = Math.max(0, t.start ?? 0); d <= c; d++) {
573
- A(t.signal);
574
- const m = await ht(e.pages[d], d, o, l);
253
+ $(t.signal);
254
+ const o = await we(e, { ...t, format: "canvas" });
255
+ e = o.plan;
256
+ const l = [...o.diagnostics, ...re(e, "canvas", t)], s = n === "jpeg" ? "image/jpeg" : "image/png", a = [], c = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
257
+ for (let m = Math.max(0, t.start ?? 0); m <= c; m++) {
258
+ $(t.signal);
259
+ const f = await qe(e.pages[m], m, i, l);
575
260
  try {
576
- a.push(await ln(m, s, r, t.signal));
261
+ a.push(await Ot(f, s, r, t.signal));
577
262
  } finally {
578
- m.width = 0, m.height = 0;
263
+ f.width = 0, f.height = 0;
579
264
  }
580
- await At(t, a.length, c - Math.max(0, t.start ?? 0) + 1);
265
+ await nt(t, a.length, c - Math.max(0, t.start ?? 0) + 1);
581
266
  }
582
- return A(t.signal), { blobs: a, diagnostics: l };
267
+ return $(t.signal), { blobs: a, diagnostics: l };
583
268
  }
584
- function ln(e, t, n, r) {
585
- return A(r), new Promise((o, i) => {
586
- const l = () => i(r?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
269
+ function Ot(e, t, n, r) {
270
+ return $(r), new Promise((i, o) => {
271
+ const l = () => o(r?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
587
272
  r?.addEventListener("abort", l, { once: !0 });
588
273
  try {
589
274
  e.toBlob((s) => {
590
- r?.removeEventListener("abort", l), s ? o(s) : i(new Error("Canvas encoding failed; no empty image was emitted."));
275
+ r?.removeEventListener("abort", l), s ? i(s) : o(new Error("Canvas encoding failed; no empty image was emitted."));
591
276
  }, t, n);
592
277
  } catch (s) {
593
- r?.removeEventListener("abort", l), i(s);
278
+ r?.removeEventListener("abort", l), o(s);
594
279
  }
595
280
  });
596
281
  }
597
- function vr(e, t = {}) {
598
- if (A(t.signal), typeof document > "u")
282
+ function _n(e, t = {}) {
283
+ if ($(t.signal), typeof document > "u")
599
284
  throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");
600
- const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, o = r / 96 * Re, i = t.fontFamily ?? le, l = t.measurer ?? ve, s = Math.max(0, t.start ?? 0), a = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1), c = [], d = Z(e, "canvas", t), m = cn(e, s, a);
601
- for (const f of m)
602
- nt(f, t), d.push(f);
603
- if (t.fidelity === "strict" && m.length) throw new kt(d);
604
- for (let f = s; f <= a; f++) {
605
- A(t.signal);
606
- const h = e.pages[f], { canvas: g, ctx: C } = ft(h, n, r, t.maxCanvasPixels);
607
- for (const S of h.components)
608
- de(C, S, o, r, i, l);
285
+ const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, i = r / 96 * Me, o = t.fontFamily ?? ge, l = t.measurer ?? ue, s = Math.max(0, t.start ?? 0), a = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1), c = [], m = re(e, "canvas", t), f = At(e, s, a);
286
+ for (const d of f)
287
+ Be(d, t), m.push(d);
288
+ if (t.fidelity === "strict" && f.length) throw new ut(m);
289
+ for (let d = s; d <= a; d++) {
290
+ $(t.signal);
291
+ const h = e.pages[d], { canvas: g, ctx: S } = Ue(h, n, r, t.maxCanvasPixels);
292
+ for (const E of h.components)
293
+ ie(S, E, i, r, o, l);
609
294
  c.push(g);
610
295
  }
611
- return { canvases: c, diagnostics: d };
296
+ return { canvases: c, diagnostics: m };
612
297
  }
613
- function cn(e, t, n) {
614
- return n < t ? [] : e.pages.slice(t, n + 1).flatMap((r, o) => [...Te(r)].map(({ component: i, componentIndex: l, componentPath: s }) => ({
298
+ function At(e, t, n) {
299
+ return n < t ? [] : e.pages.slice(t, n + 1).flatMap((r, i) => [...ye(r)].map(({ component: o, componentIndex: l, componentPath: s }) => ({
615
300
  code: "async-image-required",
616
301
  severity: "warning",
617
302
  format: "canvas",
618
- pageIndex: t + o,
303
+ pageIndex: t + i,
619
304
  componentIndex: l,
620
305
  componentPath: s,
621
- kind: i.kind,
622
- nid: i.nid,
306
+ kind: o.kind,
307
+ nid: o.nid,
623
308
  message: "Use renderPlanToCanvasAsync or renderPlanToImages to decode and include images."
624
309
  })));
625
310
  }
626
- async function xr(e, t = {}) {
311
+ async function Wn(e, t = {}) {
627
312
  if (typeof document > "u") throw new Error("renderPlanToCanvasAsync 需要浏览器环境(Node 请使用 PDF 或 XLSX 输出)");
628
- A(t.signal);
629
- const n = await Ee(e, { ...t, format: "canvas" });
313
+ $(t.signal);
314
+ const n = await we(e, { ...t, format: "canvas" });
630
315
  e = n.plan;
631
- const r = [...n.diagnostics, ...Z(e, "canvas", t)], o = [], i = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
632
- for (let l = Math.max(0, t.start ?? 0); l <= i; l++)
633
- o.push(await ht(e.pages[l], l, t, r));
634
- return { canvases: o, diagnostics: r };
635
- }
636
- async function ht(e, t, n, r) {
637
- const o = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), i = n.dpi ?? 96, l = n.fontFamily ?? le, s = await gt(e, t, n, r);
638
- A(n.signal);
639
- const { canvas: a, ctx: c } = ft(e, o, i, n.maxCanvasPixels);
640
- for (const d of e.components) de(c, d, i / 25.4, i, l, n.measurer ?? ve, s);
316
+ const r = [...n.diagnostics, ...re(e, "canvas", t)], i = [], o = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
317
+ for (let l = Math.max(0, t.start ?? 0); l <= o; l++)
318
+ i.push(await qe(e.pages[l], l, t, r));
319
+ return { canvases: i, diagnostics: r };
320
+ }
321
+ async function qe(e, t, n, r) {
322
+ const i = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), o = n.dpi ?? 96, l = n.fontFamily ?? ge, s = await Ve(e, t, n, r);
323
+ $(n.signal);
324
+ const { canvas: a, ctx: c } = Ue(e, i, o, n.maxCanvasPixels);
325
+ for (const m of e.components) ie(c, m, o / 25.4, o, l, n.measurer ?? ue, s);
641
326
  return a;
642
327
  }
643
- async function gt(e, t, n, r) {
644
- const o = n.imageLoader ?? Xt;
645
- return Qt(e, async (i, l) => {
328
+ async function Ve(e, t, n, r) {
329
+ const i = n.imageLoader ?? Mt;
330
+ return xt(e, async (o, l) => {
646
331
  try {
647
- return await o(i, l);
332
+ return await i(o, l);
648
333
  } catch (s) {
649
334
  if (l?.aborted) throw s;
650
- const a = [...Te(e)].find(({ component: h }) => h.imageData === i), { component: c, componentIndex: d, componentPath: m } = a, f = { code: "image-decode-failed", severity: "warning", format: "canvas", pageIndex: t, componentIndex: d, componentPath: m, kind: c.kind, nid: c.nid, message: "Image decoding failed; raster output was cancelled instead of omitting the image." };
651
- throw r.push(f), nt(f, n), s;
335
+ const a = [...ye(e)].find(({ component: h }) => h.imageData === o), { component: c, componentIndex: m, componentPath: f } = a, d = { code: "image-decode-failed", severity: "warning", format: "canvas", pageIndex: t, componentIndex: m, componentPath: f, kind: c.kind, nid: c.nid, message: "Image decoding failed; raster output was cancelled instead of omitting the image." };
336
+ throw r.push(d), Be(d, n), s;
652
337
  }
653
338
  }, n.signal);
654
339
  }
655
- function Sr(e, t = {}) {
656
- const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, o = r / 96 * Re, i = t.fontFamily ?? le, l = t.measurer ?? ve, s = t.overscan ?? 1, a = t.gapPx ?? 18, c = t.pagesPerFrame ?? 1, d = e.pages.map((p) => p.pageHeightMm * o), m = Math.max(1, ...e.pages.map((p) => p.pageWidthMm * o)), f = { start: 0, end: -1 };
657
- let h = null, g = null, C = null, S = null, b = [], M = 0, w = [], N = 0, D = new AbortController();
658
- const Oe = [];
659
- function Mt() {
340
+ function Un(e, t = {}) {
341
+ const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, i = r / 96 * Me, o = t.fontFamily ?? ge, l = t.measurer ?? ue, s = t.overscan ?? 1, a = t.gapPx ?? 18, c = t.pagesPerFrame ?? 1, m = e.pages.map((p) => p.pageHeightMm * i), f = Math.max(1, ...e.pages.map((p) => p.pageWidthMm * i)), d = { start: 0, end: -1 };
342
+ let h = null, g = null, S = null, E = null, b = [], M = 0, R = [], z = 0, I = new AbortController();
343
+ const Re = [];
344
+ function Ze() {
660
345
  const p = h;
661
- p.innerHTML = "", g = document.createElement("div"), g.style.cssText = `width:${m}px;margin:0 auto;`, C = document.createElement("div"), S = document.createElement("div"), g.appendChild(C), b = [];
662
- const R = Math.min(e.pages.length, 3 + s * 2);
663
- for (let z = 0; z < R; z++) {
664
- const E = document.createElement("div");
665
- E.style.cssText = `margin:0 auto ${a}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, g.appendChild(E), b.push(E);
346
+ p.innerHTML = "", g = document.createElement("div"), g.style.cssText = `width:${f}px;margin:0 auto;`, S = document.createElement("div"), E = document.createElement("div"), g.appendChild(S), b = [];
347
+ const C = Math.min(e.pages.length, 3 + s * 2);
348
+ for (let k = 0; k < C; k++) {
349
+ const v = document.createElement("div");
350
+ v.style.cssText = `margin:0 auto ${a}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, g.appendChild(v), b.push(v);
666
351
  }
667
- g.appendChild(S), p.appendChild(g);
668
- }
669
- async function vt(p, R) {
670
- const z = N, E = await Ee(e, { ...t, signal: D.signal, format: "canvas", start: R, end: R });
671
- Oe.push(...E.diagnostics);
672
- const $ = E.plan.pages[R], ne = await gt($, R, { ...t, signal: D.signal }, Oe);
673
- if (z !== N || !h) return;
674
- const { widthPx: he, heightPx: ge } = Pe($, r);
675
- let L = p.firstElementChild;
676
- (!L || L.tagName !== "CANVAS") && (L = document.createElement("canvas"), p.innerHTML = "", p.appendChild(L));
677
- const Ne = mt($, n, r, t.maxCanvasPixels);
678
- L.width = Ne.width, L.height = Ne.height, L.style.width = `${he}px`, L.style.height = `${ge}px`;
679
- const W = L.getContext("2d");
680
- if (W) {
681
- W.setTransform(1, 0, 0, 1, 0, 0), W.scale(n, n), W.fillStyle = "#ffffff", W.fillRect(0, 0, he, ge);
682
- for (const St of $.components)
683
- de(W, St, o, r, i, l, ne);
684
- L.dataset.canvasPage = String(R), p.style.height = `${ge}px`, p.style.width = `${he}px`;
352
+ g.appendChild(E), p.appendChild(g);
353
+ }
354
+ async function Qe(p, C) {
355
+ const k = z, v = await we(e, { ...t, signal: I.signal, format: "canvas", start: C, end: C });
356
+ Re.push(...v.diagnostics);
357
+ const T = v.plan.pages[C], Y = await Ve(T, C, { ...t, signal: I.signal }, Re);
358
+ if (k !== z || !h) return;
359
+ const { widthPx: se, heightPx: ce } = ve(T, r);
360
+ let D = p.firstElementChild;
361
+ (!D || D.tagName !== "CANVAS") && (D = document.createElement("canvas"), p.innerHTML = "", p.appendChild(D));
362
+ const Te = We(T, n, r, t.maxCanvasPixels);
363
+ D.width = Te.width, D.height = Te.height, D.style.width = `${se}px`, D.style.height = `${ce}px`;
364
+ const H = D.getContext("2d");
365
+ if (H) {
366
+ H.setTransform(1, 0, 0, 1, 0, 0), H.scale(n, n), H.fillStyle = "#ffffff", H.fillRect(0, 0, se, ce);
367
+ for (const tt of T.components)
368
+ ie(H, tt, i, r, o, l, Y);
369
+ D.dataset.canvasPage = String(C), p.style.height = `${ce}px`, p.style.width = `${se}px`;
685
370
  }
686
371
  }
687
- function xt(p) {
688
- N++, f.start = p.start, f.end = p.end, C.style.height = `${p.start * a + d.slice(0, p.start).reduce((E, $) => E + $, 0)}px`;
689
- const R = e.pages.length - 1 - p.end;
690
- S.style.height = `${R * a + d.slice(p.end + 1).reduce((E, $) => E + $, 0)}px`;
691
- const z = p.end - p.start + 1;
692
- b.forEach((E, $) => {
693
- if ($ < z) {
694
- E.style.display = "";
695
- const ne = p.start + $;
696
- E.style.height = `${d[ne] ?? 0}px`;
372
+ function et(p) {
373
+ z++, d.start = p.start, d.end = p.end, S.style.height = `${p.start * a + m.slice(0, p.start).reduce((v, T) => v + T, 0)}px`;
374
+ const C = e.pages.length - 1 - p.end;
375
+ E.style.height = `${C * a + m.slice(p.end + 1).reduce((v, T) => v + T, 0)}px`;
376
+ const k = p.end - p.start + 1;
377
+ b.forEach((v, T) => {
378
+ if (T < k) {
379
+ v.style.display = "";
380
+ const Y = p.start + T;
381
+ v.style.height = `${m[Y] ?? 0}px`;
697
382
  } else
698
- E.style.display = "none";
699
- }), w = [];
700
- for (let E = p.start; E <= p.end; E++) {
701
- const $ = b[E - p.start];
702
- if (!$) continue;
703
- $.firstElementChild?.dataset?.canvasPage !== String(E) && w.push(E);
383
+ v.style.display = "none";
384
+ }), R = [];
385
+ for (let v = p.start; v <= p.end; v++) {
386
+ const T = b[v - p.start];
387
+ if (!T) continue;
388
+ T.firstElementChild?.dataset?.canvasPage !== String(v) && R.push(v);
704
389
  }
705
- fe();
390
+ ae();
706
391
  }
707
- function fe() {
708
- M || w.length === 0 || (M = requestAnimationFrame(() => {
392
+ function ae() {
393
+ M || R.length === 0 || (M = requestAnimationFrame(() => {
709
394
  M = 0;
710
395
  let p = Math.max(1, c);
711
- for (; w.length > 0 && p-- > 0; ) {
712
- const R = w.shift(), z = b[R - f.start];
713
- z && vt(z, R).catch(() => {
396
+ for (; R.length > 0 && p-- > 0; ) {
397
+ const C = R.shift(), k = b[C - d.start];
398
+ k && Qe(k, C).catch(() => {
714
399
  });
715
400
  }
716
- w.length > 0 && fe();
401
+ R.length > 0 && ae();
717
402
  }));
718
403
  }
719
- function ee() {
404
+ function G() {
720
405
  M || (M = requestAnimationFrame(() => {
721
406
  M = 0;
722
- const p = h, R = tn({
723
- pageHeightsPx: d,
407
+ const p = h, C = St({
408
+ pageHeightsPx: m,
724
409
  viewportHeightPx: p.clientHeight,
725
410
  scrollTopPx: p.scrollTop,
726
411
  overscan: s,
727
412
  gapPx: a
728
413
  });
729
- R.start !== f.start || R.end !== f.end ? xt(R) : fe();
414
+ C.start !== d.start || C.end !== d.end ? et(C) : ae();
730
415
  }));
731
416
  }
732
- let te = null;
417
+ let K = null;
733
418
  return {
734
419
  attach(p) {
735
420
  if (typeof document > "u")
736
421
  throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");
737
- A(t.signal), D = new AbortController(), t.signal?.addEventListener("abort", Ie, { once: !0 }), Z(e, "canvas", t), h = p, Mt(), p.addEventListener("scroll", ee, { passive: !0 }), typeof ResizeObserver < "u" && (te = new ResizeObserver(() => ee()), te.observe(p)), ee();
422
+ $(t.signal), I = new AbortController(), t.signal?.addEventListener("abort", Ce, { once: !0 }), re(e, "canvas", t), h = p, Ze(), p.addEventListener("scroll", G, { passive: !0 }), typeof ResizeObserver < "u" && (K = new ResizeObserver(() => G()), K.observe(p)), G();
738
423
  },
739
424
  destroy() {
740
- N++, D.abort(), t.signal?.removeEventListener("abort", Ie), M && cancelAnimationFrame(M), M = 0, te?.disconnect(), te = null, h?.removeEventListener("scroll", ee), w = [], g?.remove(), h = null;
425
+ z++, I.abort(), t.signal?.removeEventListener("abort", Ce), M && cancelAnimationFrame(M), M = 0, K?.disconnect(), K = null, h?.removeEventListener("scroll", G), R = [], g?.remove(), h = null;
741
426
  },
742
427
  window() {
743
- return { ...f };
428
+ return { ...d };
744
429
  }
745
430
  };
746
- function Ie() {
747
- D.abort(t.signal?.reason);
431
+ function Ce() {
432
+ I.abort(t.signal?.reason);
748
433
  }
749
434
  }
750
- function ut(e, t, n) {
751
- let r, o;
435
+ function Je(e, t, n) {
436
+ let r, i;
752
437
  if (typeof e == "string") {
753
- const i = ie[e];
754
- if (!i) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(ie).join("/")})`);
755
- r = i.widthMm, o = i.heightMm;
756
- } else typeof e == "number" ? (r = e, o = t ?? 297) : (r = e.widthMm, o = e.heightMm);
757
- return n ? { widthMm: o, heightMm: r } : { widthMm: r, heightMm: o };
438
+ const o = ee[e];
439
+ if (!o) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(ee).join("/")})`);
440
+ r = o.widthMm, i = o.heightMm;
441
+ } else typeof e == "number" ? (r = e, i = t ?? 297) : (r = e.widthMm, i = e.heightMm);
442
+ return n ? { widthMm: i, heightMm: r } : { widthMm: r, heightMm: i };
758
443
  }
759
- class dn {
444
+ class It {
760
445
  constructor() {
761
446
  this.pages = [], this.pending = null, this.templateParams = void 0;
762
447
  }
@@ -789,12 +474,12 @@ class dn {
789
474
  */
790
475
  page(t = "a4", n = {}, r) {
791
476
  this.collect();
792
- const i = r != null && !("margins" in r) && !("landscape" in r) && ("marginTopMm" in r || "marginBottomMm" in r || "marginLeftMm" in r || "marginRightMm" in r) ? { margins: r } : typeof n == "number" ? r ?? {} : n, { widthMm: l, heightMm: s } = ut(
477
+ const o = r != null && !("margins" in r) && !("landscape" in r) && ("marginTopMm" in r || "marginBottomMm" in r || "marginLeftMm" in r || "marginRightMm" in r) ? { margins: r } : typeof n == "number" ? r ?? {} : n, { widthMm: l, heightMm: s } = Je(
793
478
  t,
794
479
  typeof n == "number" ? n : void 0,
795
- i.landscape
796
- ), a = i.margins ?? {};
797
- return this.pending = new mn(this, {
480
+ o.landscape
481
+ ), a = o.margins ?? {};
482
+ return this.pending = new Dt(this, {
798
483
  widthMm: l,
799
484
  heightMm: s,
800
485
  marginTopMm: a.marginTopMm ?? 10,
@@ -816,7 +501,7 @@ class dn {
816
501
  };
817
502
  }
818
503
  }
819
- class mn {
504
+ class Dt {
820
505
  constructor(t, n) {
821
506
  this.parent = t, this.page = n, this.components = [];
822
507
  }
@@ -831,7 +516,7 @@ class mn {
831
516
  style: r
832
517
  }), this;
833
518
  }
834
- list(t, n, r, o = {}) {
519
+ list(t, n, r, i = {}) {
835
520
  return this.components.push({
836
521
  kind: "list",
837
522
  leftMm: n.leftMm ?? 10,
@@ -839,20 +524,20 @@ class mn {
839
524
  widthMm: n.widthMm ?? 180,
840
525
  dataset: t,
841
526
  columns: r,
842
- ...o
527
+ ...i
843
528
  }), this;
844
529
  }
845
530
  rect(t, n = {}) {
846
531
  return this.components.push({ kind: "rect", ...t, style: n }), this;
847
532
  }
848
- line(t, n, r, o = {}) {
533
+ line(t, n, r, i = {}) {
849
534
  return this.components.push({
850
535
  kind: "line",
851
536
  leftMm: t,
852
537
  topMm: n,
853
538
  widthMm: r,
854
539
  heightMm: 0.5,
855
- style: o
540
+ style: i
856
541
  }), this;
857
542
  }
858
543
  barcode(t, n) {
@@ -865,11 +550,11 @@ class mn {
865
550
  fallbackText: t
866
551
  }), this;
867
552
  }
868
- qrcode(t, n, r, o) {
553
+ qrcode(t, n, r, i) {
869
554
  return this.components.push({
870
555
  kind: "qrcode",
871
556
  leftMm: r,
872
- topMm: o,
557
+ topMm: i,
873
558
  widthMm: n,
874
559
  heightMm: n,
875
560
  fallbackText: t
@@ -885,11 +570,11 @@ class mn {
885
570
  return this.done().build();
886
571
  }
887
572
  }
888
- function Er() {
889
- return new dn();
573
+ function qn() {
574
+ return new It();
890
575
  }
891
- function Cr(e, t = {}) {
892
- return Ct([], e), e.fields.map((n) => ({
576
+ function Vn(e, t = {}) {
577
+ return lt([], e), e.fields.map((n) => ({
893
578
  field: n.field,
894
579
  header: `${n.label ?? n.field}${n.unit ? ` (${n.unit})` : ""}`,
895
580
  semanticRole: n.semanticRole ?? (n.type === "number" || n.type === "decimal" ? "measure" : n.type === "date" ? "date" : n.enum ? "dimension" : "text"),
@@ -901,11 +586,11 @@ function O(e, t, n = !1) {
901
586
  if (!Number.isFinite(e) || (n ? e < 0 : e <= 0))
902
587
  throw new Error(`${t} 必须是有限${n ? "非负" : "正"}数`);
903
588
  }
904
- function ae(e, t, n) {
589
+ function te(e, t, n) {
905
590
  if (e !== void 0 && !["left", "center", "right", "justify", ...n ? ["auto"] : []].includes(e))
906
591
  throw new Error(`${t} 必须是 left/center/right/justify${n ? "/auto" : ""}`);
907
592
  }
908
- function fn(e) {
593
+ function Lt(e) {
909
594
  const t = e.layout ?? "page";
910
595
  if (t !== "page" && t !== "wide")
911
596
  throw new Error("layout 必须是 page 或 wide");
@@ -916,16 +601,16 @@ function fn(e) {
916
601
  const n = e.columnWidthMm ?? 30;
917
602
  return O(n, "columnWidthMm"), { layout: t, columnWidthMm: n };
918
603
  }
919
- function hn(e) {
604
+ function Nt(e) {
920
605
  const t = e.paper === void 0 ? "a4" : e.paper;
921
606
  if (typeof t != "string" && (typeof t != "object" || t === null) || e.landscape !== void 0 && typeof e.landscape != "boolean")
922
607
  throw new Error("paper 必须是纸张预设名或 { widthMm, heightMm } 对象,landscape 必须是布尔值");
923
- if (typeof t == "string" && !Object.prototype.hasOwnProperty.call(ie, t))
924
- throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(ie).join("/")})`);
925
- const n = ut(t, void 0, e.landscape), r = n.widthMm, o = n.heightMm;
926
- return O(r, "纸张 widthMm"), O(o, "纸张 heightMm"), { widthMm: r, heightMm: o };
608
+ if (typeof t == "string" && !Object.prototype.hasOwnProperty.call(ee, t))
609
+ throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(ee).join("/")})`);
610
+ const n = Je(t, void 0, e.landscape), r = n.widthMm, i = n.heightMm;
611
+ return O(r, "纸张 widthMm"), O(i, "纸张 heightMm"), { widthMm: r, heightMm: i };
927
612
  }
928
- function gn(e) {
613
+ function kt(e) {
929
614
  if (e.margins !== void 0 && (!e.margins || typeof e.margins != "object" || Array.isArray(e.margins)))
930
615
  throw new Error("margins 必须是页边距对象");
931
616
  const t = e.margins ?? {}, n = {
@@ -934,77 +619,77 @@ function gn(e) {
934
619
  marginLeftMm: t.marginLeftMm === void 0 ? 10 : t.marginLeftMm,
935
620
  marginRightMm: t.marginRightMm === void 0 ? 10 : t.marginRightMm
936
621
  };
937
- for (const [r, o] of Object.entries(n)) O(o, r, !0);
622
+ for (const [r, i] of Object.entries(n)) O(i, r, !0);
938
623
  return n;
939
624
  }
940
- function un(e, t) {
625
+ function Ft(e, t) {
941
626
  const n = e.dataset === void 0 ? "detail" : e.dataset;
942
627
  if (typeof n != "string" || !n.trim())
943
628
  throw new Error("dataset 必须是非空字符串");
944
629
  if (e.title !== void 0 && typeof e.title != "string")
945
630
  throw new Error("title 必须是字符串");
946
- const r = e.titleHeightMm === void 0 ? 10 : e.titleHeightMm, o = e.titleGapMm === void 0 ? 4 : e.titleGapMm;
947
- O(r, "titleHeightMm"), O(o, "titleGapMm", !0);
948
- const i = e.title !== void 0 && e.title.length > 0, l = i ? r + o : 0;
631
+ const r = e.titleHeightMm === void 0 ? 10 : e.titleHeightMm, i = e.titleGapMm === void 0 ? 4 : e.titleGapMm;
632
+ O(r, "titleHeightMm"), O(i, "titleGapMm", !0);
633
+ const o = e.title !== void 0 && e.title.length > 0, l = o ? r + i : 0;
949
634
  if (l >= t)
950
635
  throw new Error("标题高度与间距占满页面,必须为表格保留可用高度");
951
- return { dataset: n, titleHeightMm: r, hasTitle: i, titleSpaceMm: l };
636
+ return { dataset: n, titleHeightMm: r, hasTitle: o, titleSpaceMm: l };
952
637
  }
953
- function pn(e) {
638
+ function jt(e) {
954
639
  if (e.listOptions !== void 0 && (!e.listOptions || typeof e.listOptions != "object" || Array.isArray(e.listOptions)))
955
640
  throw new Error("listOptions 必须是列表配置对象");
956
641
  const t = e.listOptions ?? {};
957
- ae(t.align, "listOptions.align", !0), ae(t.headerAlign, "listOptions.headerAlign", !1);
642
+ te(t.align, "listOptions.align", !0), te(t.headerAlign, "listOptions.headerAlign", !1);
958
643
  for (const n of ["fontSizePt", "rowHeightMm", "paddingMm"]) {
959
644
  const r = t[n];
960
645
  r !== void 0 && O(r, `listOptions.${n}`, n === "paddingMm");
961
646
  }
962
647
  return t;
963
648
  }
964
- function wn(e) {
649
+ function zt(e) {
965
650
  let t = 0, n = 0;
966
- for (const [r, o] of e.entries()) {
967
- if (!o || typeof o.header != "string" || typeof o.field != "string" || !o.field.trim())
651
+ for (const [r, i] of e.entries()) {
652
+ if (!i || typeof i.header != "string" || typeof i.field != "string" || !i.field.trim())
968
653
  throw new Error(`columns[${r}] 需要字符串 header 与非空 field`);
969
- ae(o.align, `columns[${r}].align`, !0), ae(o.headerAlign, `columns[${r}].headerAlign`, !1), o.flex !== void 0 && O(o.flex, `columns[${r}].flex`), o.widthMm !== void 0 ? (O(o.widthMm, `columns[${r}].widthMm`), t += o.widthMm) : n = Math.max(n, o.flex ?? 1);
654
+ te(i.align, `columns[${r}].align`, !0), te(i.headerAlign, `columns[${r}].headerAlign`, !1), i.flex !== void 0 && O(i.flex, `columns[${r}].flex`), i.widthMm !== void 0 ? (O(i.widthMm, `columns[${r}].widthMm`), t += i.widthMm) : n = Math.max(n, i.flex ?? 1);
970
655
  }
971
656
  return { fixedWidthMm: t, maxFlex: n };
972
657
  }
973
- function bn(e, t, n, r) {
974
- const { fixedWidthMm: o, maxFlex: i } = wn(e.columns);
975
- if (t === "page" && o > r)
976
- throw new Error(`固定列宽 ${o}mm 超出页面可用宽度 ${r}mm`);
977
- const l = r - o;
978
- if (t === "page" && i > 0 && l <= 0)
658
+ function Ht(e, t, n, r) {
659
+ const { fixedWidthMm: i, maxFlex: o } = zt(e.columns);
660
+ if (t === "page" && i > r)
661
+ throw new Error(`固定列宽 ${i}mm 超出页面可用宽度 ${r}mm`);
662
+ const l = r - i;
663
+ if (t === "page" && o > 0 && l <= 0)
979
664
  throw new Error("固定列占满页面可用宽度,自动列需要正的剩余宽度");
980
- const s = i > 0 ? e.columns.reduce((c, d) => c + (d.widthMm === void 0 ? (d.flex ?? 1) / i : 0), 0) : 0;
981
- return { columns: e.columns.map(({ widthMm: c, flex: d, ...m }, f) => {
982
- const h = c ?? (t === "wide" ? n * (d ?? 1) : l * ((d ?? 1) / i) / s);
983
- return O(h, `columns[${f}] 分配后的 widthMm`), { ...m, widthMm: h };
984
- }), fixedWidthMm: o, maxFlex: i };
665
+ const s = o > 0 ? e.columns.reduce((c, m) => c + (m.widthMm === void 0 ? (m.flex ?? 1) / o : 0), 0) : 0;
666
+ return { columns: e.columns.map(({ widthMm: c, flex: m, ...f }, d) => {
667
+ const h = c ?? (t === "wide" ? n * (m ?? 1) : l * ((m ?? 1) / o) / s);
668
+ return O(h, `columns[${d}] 分配后的 widthMm`), { ...f, widthMm: h };
669
+ }), fixedWidthMm: i, maxFlex: o };
985
670
  }
986
- function Tr(e) {
671
+ function Jn(e) {
987
672
  if (!e || typeof e != "object")
988
673
  throw new Error("标准明细模板需要 options 对象");
989
674
  if (!Array.isArray(e.columns) || e.columns.length === 0)
990
675
  throw new Error("columns 至少需要一列");
991
- const { layout: t, columnWidthMm: n } = fn(e), r = hn(e);
992
- let o = r.widthMm;
993
- const i = r.heightMm, l = gn(e);
994
- let s = o - l.marginLeftMm - l.marginRightMm;
995
- const a = i - l.marginTopMm - l.marginBottomMm;
676
+ const { layout: t, columnWidthMm: n } = Lt(e), r = Nt(e);
677
+ let i = r.widthMm;
678
+ const o = r.heightMm, l = kt(e);
679
+ let s = i - l.marginLeftMm - l.marginRightMm;
680
+ const a = o - l.marginTopMm - l.marginBottomMm;
996
681
  if (t === "page" && s <= 0 || a <= 0)
997
682
  throw new Error("页边距占满纸张,必须保留正的可用宽度和高度");
998
- const { dataset: c, titleHeightMm: d, hasTitle: m, titleSpaceMm: f } = un(e, a), h = pn(e), { columns: g, fixedWidthMm: C, maxFlex: S } = bn(e, t, n, s);
999
- t === "wide" && (s = g.reduce((M, w) => M + w.widthMm, 0), O(s, "宽表总列宽"), o = s + l.marginLeftMm + l.marginRightMm, O(o, "宽表总宽度"));
1000
- const b = { widthMm: o, heightMm: i, ...l, components: [], ...t === "wide" ? { layout: t } : {} };
1001
- return m && b.components.push({
683
+ const { dataset: c, titleHeightMm: m, hasTitle: f, titleSpaceMm: d } = Ft(e, a), h = jt(e), { columns: g, fixedWidthMm: S, maxFlex: E } = Ht(e, t, n, s);
684
+ t === "wide" && (s = g.reduce((M, R) => M + R.widthMm, 0), O(s, "宽表总列宽"), i = s + l.marginLeftMm + l.marginRightMm, O(i, "宽表总宽度"));
685
+ const b = { widthMm: i, heightMm: o, ...l, components: [], ...t === "wide" ? { layout: t } : {} };
686
+ return f && b.components.push({
1002
687
  kind: "text",
1003
688
  text: e.title,
1004
689
  leftMm: l.marginLeftMm,
1005
690
  topMm: l.marginTopMm,
1006
691
  widthMm: s,
1007
- heightMm: d,
692
+ heightMm: m,
1008
693
  style: { fontSize: 16, bold: !0, align: "center", verticalAlign: "middle", ...e.titleStyle }
1009
694
  }), b.components.push({
1010
695
  align: "auto",
@@ -1012,20 +697,20 @@ function Tr(e) {
1012
697
  ...h,
1013
698
  kind: "list",
1014
699
  ...t === "wide" ? { layout: t } : {},
1015
- ...m ? { title: e.title } : {},
700
+ ...f ? { title: e.title } : {},
1016
701
  dataset: c,
1017
702
  columns: g,
1018
703
  leftMm: l.marginLeftMm,
1019
- topMm: l.marginTopMm + f,
1020
- widthMm: t === "wide" || S > 0 ? s : C
704
+ topMm: l.marginTopMm + d,
705
+ widthMm: t === "wide" || E > 0 ? s : S
1021
706
  }), e.params === void 0 ? { pages: [b] } : { params: e.params, pages: [b] };
1022
707
  }
1023
- function Rr(e) {
708
+ function Gn(e) {
1024
709
  if (e.components !== void 0 && e.pages !== void 0) throw new TypeError("标签 components 与 pages 只能选择一种");
1025
- const { dataset: t, rowKey: n, copies: r, params: o } = e, i = e.pages ?? [{ components: e.components ?? [] }], l = {
710
+ const { dataset: t, rowKey: n, copies: r, params: i } = e, o = e.pages ?? [{ components: e.components ?? [] }], l = {
1026
711
  repeat: { dataset: t, ...n === void 0 ? {} : { rowKey: n }, ...r === void 0 ? {} : { copies: r } },
1027
- ...o === void 0 ? {} : { params: o },
1028
- pages: i.map((a) => ({
712
+ ...i === void 0 ? {} : { params: i },
713
+ pages: o.map((a) => ({
1029
714
  widthMm: a.widthMm ?? e.widthMm ?? 80,
1030
715
  heightMm: a.heightMm ?? e.heightMm ?? 55,
1031
716
  marginTopMm: 0,
@@ -1035,203 +720,203 @@ function Rr(e) {
1035
720
  components: a.components,
1036
721
  ...a.meta === void 0 ? {} : { meta: a.meta }
1037
722
  }))
1038
- }, s = Xe(l);
1039
- if (!s.ok) throw new Ze(s.errors);
723
+ }, s = Fe(l);
724
+ if (!s.ok) throw new je(s.errors);
1040
725
  return JSON.parse(JSON.stringify(l));
1041
726
  }
1042
- function yn(e) {
727
+ function Bt(e) {
1043
728
  if (!e || typeof e != "object" || !e.repeat)
1044
- throw new xe("config", "defineLabelReport 需要带 repeat 的固定标签模板");
1045
- const t = Xe(e);
1046
- if (!t.ok) throw new Ze(t.errors);
729
+ throw new pe("config", "defineLabelReport 需要带 repeat 的固定标签模板");
730
+ const t = Fe(e);
731
+ if (!t.ok) throw new je(t.errors);
1047
732
  return e.repeat.dataset;
1048
733
  }
1049
- function He(e, t) {
1050
- if (!Array.isArray(e)) throw new xe("validate", "标签数据应为对象数组;请从业务响应中提取行数组");
734
+ function Oe(e, t) {
735
+ if (!Array.isArray(e)) throw new pe("validate", "标签数据应为对象数组;请从业务响应中提取行数组");
1051
736
  return { [t]: e };
1052
737
  }
1053
- function Pr(e) {
1054
- const { template: t, rows: n, load: r, dataSchema: o, params: i, pagination: l, dataValidation: s } = e, a = yn(t);
738
+ function Kn(e) {
739
+ const { template: t, rows: n, load: r, dataSchema: i, params: o, pagination: l, dataValidation: s } = e, a = Bt(t);
1055
740
  if (n !== void 0 == (r !== void 0) || r !== void 0 && typeof r != "function")
1056
- throw new xe("config", "标签报表应且只能配置 rows 或 load 其中一种数据来源");
1057
- const c = { template: t, params: i, pagination: l, dataValidation: s, ...o === void 0 ? {} : { dataSchema: { [a]: o } } };
1058
- return r ? Tt({ ...c, load: r, mapData: (d) => He(d, a) }) : { ...c, datasets: He(n, a) };
741
+ throw new pe("config", "标签报表应且只能配置 rows 或 load 其中一种数据来源");
742
+ const c = { template: t, params: o, pagination: l, dataValidation: s, ...i === void 0 ? {} : { dataSchema: { [a]: i } } };
743
+ return r ? mt({ ...c, load: r, mapData: (m) => Oe(m, a) }) : { ...c, datasets: Oe(n, a) };
1059
744
  }
1060
- function $r(e) {
745
+ function Yn(e) {
1061
746
  return e;
1062
747
  }
1063
- class j extends Error {
748
+ class N extends Error {
1064
749
  constructor(t, n) {
1065
750
  super(n), this.code = t, this.name = "ReportTemplateMigrationError";
1066
751
  }
1067
752
  }
1068
- function Be(e) {
753
+ function Ae(e) {
1069
754
  let t = e;
1070
755
  if (typeof t == "string") {
1071
- if (t.length > 1e7) throw new j("result", "模板迁移输入超过预算");
756
+ if (t.length > 1e7) throw new N("result", "模板迁移输入超过预算");
1072
757
  try {
1073
758
  t = JSON.parse(t);
1074
759
  } catch {
1075
- throw new j("result", "模板 JSON 语法无效");
760
+ throw new N("result", "模板 JSON 语法无效");
1076
761
  }
1077
762
  }
1078
- const n = et(t, { maxBytes: 1e7, error: (r, o) => new j("result", o) });
1079
- if (!n || typeof n != "object" || Array.isArray(n)) throw new j("result", "模板迁移应返回文档对象");
763
+ const n = He(t, { maxBytes: 1e7, error: (r, i) => new N("result", i) });
764
+ if (!n || typeof n != "object" || Array.isArray(n)) throw new N("result", "模板迁移应返回文档对象");
1080
765
  return n;
1081
766
  }
1082
- function Mn(e) {
1083
- if (!Array.isArray(e) || e.length > 32) throw new j("definition", "模板迁移最多声明 32 步");
767
+ function _t(e) {
768
+ if (!Array.isArray(e) || e.length > 32) throw new N("definition", "模板迁移最多声明 32 步");
1084
769
  const t = /* @__PURE__ */ new Map();
1085
770
  for (const n of e) {
1086
- if (!n || ![n.from, n.to].every((r) => typeof r == "string" && r.trim() && r.length <= 64) || n.from === n.to || t.has(n.from) || typeof n.migrate != "function" || n.from === pe) throw new j("definition", "迁移起点应唯一,不得从当前版本降级");
771
+ if (!n || ![n.from, n.to].every((r) => typeof r == "string" && r.trim() && r.length <= 64) || n.from === n.to || t.has(n.from) || typeof n.migrate != "function" || n.from === me) throw new N("definition", "迁移起点应唯一,不得从当前版本降级");
1087
772
  t.set(n.from, { ...n });
1088
773
  }
1089
774
  for (const n of t.keys()) {
1090
775
  const r = /* @__PURE__ */ new Set();
1091
- let o = n;
1092
- for (; t.has(o); ) {
1093
- if (r.has(o)) throw new j("definition", "模板迁移链存在循环");
1094
- r.add(o), o = t.get(o).to;
776
+ let i = n;
777
+ for (; t.has(i); ) {
778
+ if (r.has(i)) throw new N("definition", "模板迁移链存在循环");
779
+ r.add(i), i = t.get(i).to;
1095
780
  }
1096
- if (o !== pe) throw new j("definition", "每条迁移链应到达当前模板版本");
781
+ if (i !== me) throw new N("definition", "每条迁移链应到达当前模板版本");
1097
782
  }
1098
783
  return t;
1099
784
  }
1100
- function vn(e = []) {
1101
- const t = Mn(e);
785
+ function Wt(e = []) {
786
+ const t = _t(e);
1102
787
  return async (n) => {
1103
- let r = Be(n);
1104
- const o = [];
1105
- for (; r.schemaVersion !== pe; ) {
1106
- const i = typeof r.schemaVersion == "string" ? t.get(r.schemaVersion) : void 0;
1107
- if (!i) throw new j("unsupported", "未声明此模板版本的迁移路径");
1108
- const l = r.id, s = Be(await i.migrate(r));
1109
- if (s.schemaVersion !== i.to || typeof l == "string" && s.id !== l) throw new j("result", "迁移结果版本不匹配或改变了模板身份");
1110
- o.push({ from: i.from, to: i.to }), r = s;
788
+ let r = Ae(n);
789
+ const i = [];
790
+ for (; r.schemaVersion !== me; ) {
791
+ const o = typeof r.schemaVersion == "string" ? t.get(r.schemaVersion) : void 0;
792
+ if (!o) throw new N("unsupported", "未声明此模板版本的迁移路径");
793
+ const l = r.id, s = Ae(await o.migrate(r));
794
+ if (s.schemaVersion !== o.to || typeof l == "string" && s.id !== l) throw new N("result", "迁移结果版本不匹配或改变了模板身份");
795
+ i.push({ from: o.from, to: o.to }), r = s;
1111
796
  }
1112
- return { document: re(r), steps: o };
797
+ return { document: X(r), steps: i };
1113
798
  };
1114
799
  }
1115
- class F extends Error {
800
+ class L extends Error {
1116
801
  constructor(t, n) {
1117
802
  super(n), this.code = t, this.name = "ReportTemplateStoreError";
1118
803
  }
1119
804
  }
1120
- function I(e) {
805
+ function A(e) {
1121
806
  return JSON.parse(JSON.stringify(e));
1122
807
  }
1123
- function T(e) {
808
+ function x(e) {
1124
809
  if (!e?.aborted) return;
1125
810
  const t = new Error("模板操作已取消");
1126
811
  throw t.name = "AbortError", t;
1127
812
  }
1128
- function _e(e) {
813
+ function Ie(e) {
1129
814
  const t = e ? Number(e.revision) : 0;
1130
- if (!Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER) throw new F("history", "修订号无效或已达上限");
815
+ if (!Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER) throw new L("history", "修订号无效或已达上限");
1131
816
  return String(t + 1);
1132
817
  }
1133
- function kr(e, t = {}) {
1134
- const n = t.migrations ? vn(t.migrations) : void 0, r = async (a) => n ? (await n(a)).document : re(a), o = async (a, c) => {
1135
- T(c);
1136
- const d = await e.read(a, c);
1137
- return T(c), d ? I(d) : void 0;
1138
- }, i = async (a, c) => {
1139
- const d = await o(a, c.signal);
1140
- if ((d?.revision ?? null) !== c.expectedRevision) throw new F("conflict", "模板已变化,请重新读取后提交");
1141
- return d;
1142
- }, l = async (a, c, d) => {
1143
- if (T(c.signal), !await e.compareAndSwap(a.id, c.expectedRevision, I(a), { signal: c.signal, ...d ? { publication: I(d) } : {} })) throw new F("conflict", "模板已被其他请求更新");
1144
- return I(a);
1145
- }, s = async (a, c, d, m) => {
818
+ function Xn(e, t = {}) {
819
+ const n = t.migrations ? Wt(t.migrations) : void 0, r = async (a) => n ? (await n(a)).document : X(a), i = async (a, c) => {
820
+ x(c);
821
+ const m = await e.read(a, c);
822
+ return x(c), m ? A(m) : void 0;
823
+ }, o = async (a, c) => {
824
+ const m = await i(a, c.signal);
825
+ if ((m?.revision ?? null) !== c.expectedRevision) throw new L("conflict", "模板已变化,请重新读取后提交");
826
+ return m;
827
+ }, l = async (a, c, m) => {
828
+ if (x(c.signal), !await e.compareAndSwap(a.id, c.expectedRevision, A(a), { signal: c.signal, ...m ? { publication: A(m) } : {} })) throw new L("conflict", "模板已被其他请求更新");
829
+ return A(a);
830
+ }, s = async (a, c, m, f) => {
1146
831
  if (t.beforePublish) {
1147
- T(d.signal);
1148
- const C = a.published ? await r(a.published) : void 0;
1149
- T(d.signal);
1150
- const S = await t.beforePublish({ document: re(c), previous: C, signal: d.signal });
1151
- if (!S || S.ok !== !0) throw new F("review", S?.issues?.find((b) => b.severity === "error")?.message ?? "模板发布检查未通过");
1152
- T(d.signal);
832
+ x(m.signal);
833
+ const S = a.published ? await r(a.published) : void 0;
834
+ x(m.signal);
835
+ const E = await t.beforePublish({ document: X(c), previous: S, signal: m.signal });
836
+ if (!E || E.ok !== !0) throw new L("review", E?.issues?.find((b) => b.severity === "error")?.message ?? "模板发布检查未通过");
837
+ x(m.signal);
1153
838
  }
1154
- const f = _e(a), h = re({ ...c, revision: f }), g = { revision: f, document: h, publishedAt: (t.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
1155
- return m !== void 0 && (g.restoredFrom = m), l({ id: a.id, revision: f, publishedRevision: f, published: h }, d, g);
839
+ const d = Ie(a), h = X({ ...c, revision: d }), g = { revision: d, document: h, publishedAt: (t.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
840
+ return f !== void 0 && (g.restoredFrom = f), l({ id: a.id, revision: d, publishedRevision: d, published: h }, m, g);
1156
841
  };
1157
842
  return {
1158
843
  list: async (a) => {
1159
- T(a);
844
+ x(a);
1160
845
  const c = await e.list(a);
1161
- return T(a), I(c);
846
+ return x(a), A(c);
1162
847
  },
1163
848
  get: async (a, c = {}) => {
1164
- const d = await o(a, c.signal), m = c.draft ? d?.draft : d?.published, f = m ? await r(m) : void 0;
1165
- return T(c.signal), f;
849
+ const m = await i(a, c.signal), f = c.draft ? m?.draft : m?.published, d = f ? await r(f) : void 0;
850
+ return x(c.signal), d;
1166
851
  },
1167
852
  history: async (a, c) => {
1168
- T(c);
1169
- const d = await e.history(a, c);
1170
- return T(c), I(d);
853
+ x(c);
854
+ const m = await e.history(a, c);
855
+ return x(c), A(m);
1171
856
  },
1172
857
  saveDraft: async (a, c) => {
1173
- c = { ...c }, T(c.signal);
1174
- const d = await r(t.migrate ? await t.migrate(a) : a), m = await i(d.id, c), f = _e(m);
858
+ c = { ...c }, x(c.signal);
859
+ const m = await r(t.migrate ? await t.migrate(a) : a), f = await o(m.id, c), d = Ie(f);
1175
860
  return l({
1176
- id: d.id,
1177
- revision: f,
1178
- draft: { ...d, revision: f },
1179
- ...m?.publishedRevision ? { publishedRevision: m.publishedRevision, published: m.published } : {}
861
+ id: m.id,
862
+ revision: d,
863
+ draft: { ...m, revision: d },
864
+ ...f?.publishedRevision ? { publishedRevision: f.publishedRevision, published: f.published } : {}
1180
865
  }, c);
1181
866
  },
1182
867
  publish: async (a, c) => {
1183
868
  c = { ...c };
1184
- const d = await i(a, c);
1185
- if (!d) throw new F("missing", "模板不存在");
1186
- if (!d.draft) throw new F("draft", "没有可发布的草稿");
1187
- return s(d, await r(d.draft), c);
869
+ const m = await o(a, c);
870
+ if (!m) throw new L("missing", "模板不存在");
871
+ if (!m.draft) throw new L("draft", "没有可发布的草稿");
872
+ return s(m, await r(m.draft), c);
1188
873
  },
1189
- rollback: async (a, c, d) => {
1190
- d = { ...d };
1191
- const m = await i(a, d);
1192
- if (!m) throw new F("missing", "模板不存在");
1193
- T(d.signal);
1194
- const f = await e.getVersion(a, c, d.signal);
1195
- if (!f) throw new F("history", "历史修订不存在");
1196
- return s(m, await r(f.document), d, c);
874
+ rollback: async (a, c, m) => {
875
+ m = { ...m };
876
+ const f = await o(a, m);
877
+ if (!f) throw new L("missing", "模板不存在");
878
+ x(m.signal);
879
+ const d = await e.getVersion(a, c, m.signal);
880
+ if (!d) throw new L("history", "历史修订不存在");
881
+ return s(f, await r(d.document), m, c);
1197
882
  }
1198
883
  };
1199
884
  }
1200
- function Ar() {
885
+ function Zn() {
1201
886
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
1202
887
  return {
1203
888
  read: async (n, r) => {
1204
- T(r);
1205
- const o = e.get(n);
1206
- return o ? I(o) : void 0;
889
+ x(r);
890
+ const i = e.get(n);
891
+ return i ? A(i) : void 0;
1207
892
  },
1208
- list: async (n) => (T(n), Array.from(e.values(), ({ id: r, revision: o, publishedRevision: i }) => ({ id: r, revision: o, ...i ? { publishedRevision: i } : {} }))),
1209
- history: async (n, r) => (T(r), Array.from(t.get(n)?.values() ?? [], (o) => I(o))),
1210
- getVersion: async (n, r, o) => {
1211
- T(o);
1212
- const i = t.get(n)?.get(r);
1213
- return i ? I(i) : void 0;
893
+ list: async (n) => (x(n), Array.from(e.values(), ({ id: r, revision: i, publishedRevision: o }) => ({ id: r, revision: i, ...o ? { publishedRevision: o } : {} }))),
894
+ history: async (n, r) => (x(r), Array.from(t.get(n)?.values() ?? [], (i) => A(i))),
895
+ getVersion: async (n, r, i) => {
896
+ x(i);
897
+ const o = t.get(n)?.get(r);
898
+ return o ? A(o) : void 0;
1214
899
  },
1215
- compareAndSwap: async (n, r, o, i) => {
1216
- if (T(i.signal), (e.get(n)?.revision ?? null) !== r) return !1;
1217
- if (o.id !== n) throw new F("history", "状态 ID 与存储 ID 不一致");
1218
- const l = I(o), s = i.publication;
900
+ compareAndSwap: async (n, r, i, o) => {
901
+ if (x(o.signal), (e.get(n)?.revision ?? null) !== r) return !1;
902
+ if (i.id !== n) throw new L("history", "状态 ID 与存储 ID 不一致");
903
+ const l = A(i), s = o.publication;
1219
904
  if (s) {
1220
905
  const a = t.get(n) ?? /* @__PURE__ */ new Map();
1221
- if (a.has(s.revision) || s.revision !== o.revision || s.document.id !== n) throw new F("history", "发布修订不可覆盖,且必须与状态修订和模板 ID 一致");
1222
- a.set(s.revision, I(s)), t.set(n, a);
906
+ if (a.has(s.revision) || s.revision !== i.revision || s.document.id !== n) throw new L("history", "发布修订不可覆盖,且必须与状态修订和模板 ID 一致");
907
+ a.set(s.revision, A(s)), t.set(n, a);
1223
908
  }
1224
909
  return e.set(n, l), !0;
1225
910
  }
1226
911
  };
1227
912
  }
1228
913
  class u extends Error {
1229
- constructor(t, n, r = "$", o) {
1230
- super(n), this.code = t, this.path = r, this.extensionId = o, this.name = "ReportComponentExtensionError";
914
+ constructor(t, n, r = "$", i) {
915
+ super(n), this.code = t, this.path = r, this.extensionId = i, this.name = "ReportComponentExtensionError";
1231
916
  }
1232
917
  }
1233
- const xn = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
1234
- function K(e, t = "$", n = { nodes: 0, units: 0 }, r = 0) {
918
+ const Ut = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
919
+ function U(e, t = "$", n = { nodes: 0, units: 0 }, r = 0) {
1235
920
  if (++n.nodes > 2048 || r > 16) throw new u("binding", "Component extension JSON exceeds its depth/node budget.", t);
1236
921
  if (n.units > 64 * 1024) throw new u("binding", "Component extension JSON exceeds 64 Ki UTF-16 units.", t);
1237
922
  if (e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return e;
@@ -1240,45 +925,45 @@ function K(e, t = "$", n = { nodes: 0, units: 0 }, r = 0) {
1240
925
  return e;
1241
926
  }
1242
927
  if (!e || typeof e != "object") throw new u("binding", "Component extension values must be finite JSON data.", t);
1243
- const o = Object.getPrototypeOf(e);
1244
- if (Array.isArray(e)) return Sn(e, t, n, r);
1245
- if (o !== Object.prototype && o !== null) throw new u("binding", "Component extension values must be plain JSON objects.", t);
1246
- return En(e, t, n, r);
928
+ const i = Object.getPrototypeOf(e);
929
+ if (Array.isArray(e)) return qt(e, t, n, r);
930
+ if (i !== Object.prototype && i !== null) throw new u("binding", "Component extension values must be plain JSON objects.", t);
931
+ return Vt(e, t, n, r);
1247
932
  }
1248
- function $e(e, t, n) {
933
+ function xe(e, t, n) {
1249
934
  const r = Object.getOwnPropertyDescriptor(e, t);
1250
- if (typeof t != "string" || xn.has(t) || !r?.enumerable || r.get || r.set)
935
+ if (typeof t != "string" || Ut.has(t) || !r?.enumerable || r.get || r.set)
1251
936
  throw new u("binding", "Component extension JSON contains an unsafe key or accessor.", n);
1252
937
  return r.value;
1253
938
  }
1254
- function Sn(e, t, n, r) {
939
+ function qt(e, t, n, r) {
1255
940
  if (Object.getPrototypeOf(e) !== Array.prototype || e.length > 2048 || Reflect.ownKeys(e).length !== e.length + 1) throw new u("binding", "Component extension arrays must be plain dense JSON arrays.", t);
1256
- return Object.freeze(Array.from({ length: e.length }, (o, i) => K($e(e, String(i), `${t}[${i}]`), `${t}[${i}]`, n, r + 1)));
1257
- }
1258
- function En(e, t, n, r) {
1259
- const o = Reflect.ownKeys(e);
1260
- if (o.length > 2048) throw new u("binding", "Component extension JSON exceeds its node budget.", t);
1261
- const i = o.map((l) => {
1262
- const s = `${t}.${String(l)}`, a = $e(e, l, s);
1263
- return n.units += String(l).length, [l, K(a, s, n, r + 1)];
941
+ return Object.freeze(Array.from({ length: e.length }, (i, o) => U(xe(e, String(o), `${t}[${o}]`), `${t}[${o}]`, n, r + 1)));
942
+ }
943
+ function Vt(e, t, n, r) {
944
+ const i = Reflect.ownKeys(e);
945
+ if (i.length > 2048) throw new u("binding", "Component extension JSON exceeds its node budget.", t);
946
+ const o = i.map((l) => {
947
+ const s = `${t}.${String(l)}`, a = xe(e, l, s);
948
+ return n.units += String(l).length, [l, U(a, s, n, r + 1)];
1264
949
  });
1265
- return Object.freeze(Object.fromEntries(i));
950
+ return Object.freeze(Object.fromEntries(o));
1266
951
  }
1267
- function Q(e, t) {
952
+ function J(e, t) {
1268
953
  if (!e || typeof e != "object" || Array.isArray(e)) throw new u("binding", "Expected a component extension object.", t);
1269
954
  return e;
1270
955
  }
1271
- function me(e, t, n) {
956
+ function oe(e, t, n) {
1272
957
  for (const r of Object.keys(e)) if (!t.includes(r)) throw new u("binding", "Unknown component extension property.", `${n}.${r}`);
1273
958
  }
1274
- function be(e, t, n = 160) {
959
+ function de(e, t, n = 160) {
1275
960
  if (typeof e != "string" || !e.trim() || e.length > n) throw new u("definition", "Component extension labels must be bounded nonempty strings.", t);
1276
961
  }
1277
- function pt(e, t) {
962
+ function Ge(e, t) {
1278
963
  if (typeof e != "string" || !/^[a-z][a-z\d_.-]{0,127}$/i.test(e)) throw new u("definition", "Invalid component extension id.", "$.id");
1279
964
  if (typeof t != "string" || t.length > 64 || !/^\d+\.\d+\.\d+(?:-[\da-z.-]+)?(?:\+[\da-z.-]+)?$/i.test(t)) throw new u("definition", "Component extension version must be explicit semantic version text.", "$.version", e);
1280
965
  }
1281
- function ke(e, t, n) {
966
+ function Ee(e, t, n) {
1282
967
  if (!(e === null && !t.required)) {
1283
968
  if (typeof e !== t.type || typeof e == "number" && !Number.isFinite(e)) throw new u("binding", `Expected ${t.type} component property.`, n);
1284
969
  if (t.options && !t.options.some((r) => Object.is(r, e))) throw new u("binding", "Component property is outside its declared options.", n);
@@ -1286,79 +971,79 @@ function ke(e, t, n) {
1286
971
  if (typeof e == "string" && e.length > (t.maxLength ?? 64 * 1024)) throw new u("binding", "Component property exceeds maxLength.", n);
1287
972
  }
1288
973
  }
1289
- function Cn(e, t) {
1290
- const n = Q(e, t);
1291
- me(n, ["label", "type", "required", "default", "options", "min", "max", "maxLength"], t);
974
+ function Jt(e, t) {
975
+ const n = J(e, t);
976
+ oe(n, ["label", "type", "required", "default", "options", "min", "max", "maxLength"], t);
1292
977
  const r = n;
1293
- if (be(r.label, `${t}.label`), !["string", "number", "boolean"].includes(r.type)) throw new u("definition", "Unknown component property type.", t);
978
+ if (de(r.label, `${t}.label`), !["string", "number", "boolean"].includes(r.type)) throw new u("definition", "Unknown component property type.", t);
1294
979
  if (r.required !== void 0 && typeof r.required != "boolean") throw new u("definition", "Component property required must be boolean.", t);
1295
- Tn(r, t), r.default !== void 0 && ke(r.default, r, `${t}.default`);
980
+ Gt(r, t), r.default !== void 0 && Ee(r.default, r, `${t}.default`);
1296
981
  }
1297
- function Tn(e, t) {
982
+ function Gt(e, t) {
1298
983
  for (const n of ["min", "max"]) if (e[n] !== void 0 && (e.type !== "number" || !Number.isFinite(e[n]))) throw new u("definition", "Numeric property bounds must be finite numbers.", t);
1299
984
  if ((e.min ?? -1 / 0) > (e.max ?? 1 / 0)) throw new u("definition", "Component property min exceeds max.", t);
1300
985
  if (e.maxLength !== void 0 && (e.type !== "string" || !Number.isSafeInteger(e.maxLength) || e.maxLength < 0 || e.maxLength > 64 * 1024)) throw new u("definition", "Invalid component property maxLength.", t);
1301
986
  if (e.options !== void 0) {
1302
987
  if (!Array.isArray(e.options) || !e.options.length || e.options.length > 64) throw new u("definition", "Component property options must contain 1 to 64 values.", t);
1303
- for (const n of e.options) ke(n, { ...e, options: void 0 }, `${t}.options`);
988
+ for (const n of e.options) Ee(n, { ...e, options: void 0 }, `${t}.options`);
1304
989
  }
1305
990
  }
1306
- function Rn(e) {
991
+ function Kt(e) {
1307
992
  const t = Object.getPrototypeOf(e);
1308
993
  if (t !== Object.prototype && t !== null) throw new u("definition", "Component extension metadata must be a plain object.");
1309
- const n = Reflect.ownKeys(e).filter((o) => o !== "load").map((o) => [o, $e(e, o, `$.${String(o)}`)]), r = K(Object.fromEntries(n));
1310
- if (me(r, ["id", "version", "kind", "label", "description", "properties"], "$"), pt(r.id, r.version), be(r.label, "$.label"), !["image", "chart", "barcode", "qrcode"].includes(r.kind)) throw new u("definition", "Extension kind must use the existing image-backed output pipeline.", "$.kind");
1311
- if (r.description !== void 0 && be(r.description, "$.description", 2048), r.properties !== void 0) {
1312
- const o = Q(r.properties, "$.properties");
1313
- if (Object.keys(o).length > 64) throw new u("definition", "Component extension supports at most 64 properties.", "$.properties");
1314
- for (const [i, l] of Object.entries(o)) Cn(l, `$.properties.${i}`);
994
+ const n = Reflect.ownKeys(e).filter((i) => i !== "load").map((i) => [i, xe(e, i, `$.${String(i)}`)]), r = U(Object.fromEntries(n));
995
+ if (oe(r, ["id", "version", "kind", "label", "description", "properties"], "$"), Ge(r.id, r.version), de(r.label, "$.label"), !["image", "chart", "barcode", "qrcode"].includes(r.kind)) throw new u("definition", "Extension kind must use the existing image-backed output pipeline.", "$.kind");
996
+ if (r.description !== void 0 && de(r.description, "$.description", 2048), r.properties !== void 0) {
997
+ const i = J(r.properties, "$.properties");
998
+ if (Object.keys(i).length > 64) throw new u("definition", "Component extension supports at most 64 properties.", "$.properties");
999
+ for (const [o, l] of Object.entries(i)) Jt(l, `$.properties.${o}`);
1315
1000
  }
1316
1001
  return r;
1317
1002
  }
1318
- function wt(e, t) {
1319
- const n = Q(K(t ?? {}), "$.props"), r = {};
1320
- for (const o of Object.keys(n)) if (!Object.prototype.hasOwnProperty.call(e.properties ?? {}, o)) throw new u("binding", "Unknown component property.", `$.props.${o}`, e.id);
1321
- for (const [o, i] of Object.entries(e.properties ?? {})) {
1322
- const l = Object.prototype.hasOwnProperty.call(n, o) ? n[o] : i.default;
1003
+ function Ke(e, t) {
1004
+ const n = J(U(t ?? {}), "$.props"), r = {};
1005
+ for (const i of Object.keys(n)) if (!Object.prototype.hasOwnProperty.call(e.properties ?? {}, i)) throw new u("binding", "Unknown component property.", `$.props.${i}`, e.id);
1006
+ for (const [i, o] of Object.entries(e.properties ?? {})) {
1007
+ const l = Object.prototype.hasOwnProperty.call(n, i) ? n[i] : o.default;
1323
1008
  if (l === void 0) {
1324
- if (i.required) throw new u("binding", "Required component property is missing.", `$.props.${o}`, e.id);
1009
+ if (o.required) throw new u("binding", "Required component property is missing.", `$.props.${i}`, e.id);
1325
1010
  continue;
1326
1011
  }
1327
- ke(l, i, `$.props.${o}`), r[o] = l;
1012
+ Ee(l, o, `$.props.${i}`), r[i] = l;
1328
1013
  }
1329
1014
  return Object.freeze(r);
1330
1015
  }
1331
- const H = "componentExtension";
1332
- function Pn(e) {
1333
- const t = Object.getOwnPropertyDescriptor(e, "meta")?.value, n = t && Object.getOwnPropertyDescriptor(t, H);
1016
+ const F = "componentExtension";
1017
+ function Yt(e) {
1018
+ const t = Object.getOwnPropertyDescriptor(e, "meta")?.value, n = t && Object.getOwnPropertyDescriptor(t, F);
1334
1019
  if (n) {
1335
- if (n.get || n.set) throw new u("binding", "Component extension binding cannot be an accessor.", `$.meta.${H}`);
1020
+ if (n.get || n.set) throw new u("binding", "Component extension binding cannot be an accessor.", `$.meta.${F}`);
1336
1021
  return n.value;
1337
1022
  }
1338
1023
  }
1339
- function $n(e, t) {
1340
- const n = Q(K(Pn(t)), `$.meta.${H}`);
1341
- me(n, ["id", "version", "props", "binding"], `$.meta.${H}`), pt(n.id, n.version);
1024
+ function Xt(e, t) {
1025
+ const n = J(U(Yt(t)), `$.meta.${F}`);
1026
+ oe(n, ["id", "version", "props", "binding"], `$.meta.${F}`), Ge(n.id, n.version);
1342
1027
  const r = e.get(n.id);
1343
- if (!r) throw new u("binding", "Component extension is not registered in this runtime.", `$.meta.${H}.id`, n.id);
1344
- if (r.metadata.version !== n.version || r.metadata.kind !== t.kind) throw new u("binding", "Component extension version or image kind does not match its registration.", `$.meta.${H}`, r.metadata.id);
1345
- const o = Object.freeze({ id: r.metadata.id, version: r.metadata.version, props: wt(r.metadata, n.props), ...n.binding === void 0 ? {} : { binding: n.binding } });
1346
- return { entry: r, extension: o };
1028
+ if (!r) throw new u("binding", "Component extension is not registered in this runtime.", `$.meta.${F}.id`, n.id);
1029
+ if (r.metadata.version !== n.version || r.metadata.kind !== t.kind) throw new u("binding", "Component extension version or image kind does not match its registration.", `$.meta.${F}`, r.metadata.id);
1030
+ const i = Object.freeze({ id: r.metadata.id, version: r.metadata.version, props: Ke(r.metadata, n.props), ...n.binding === void 0 ? {} : { binding: n.binding } });
1031
+ return { entry: r, extension: i };
1347
1032
  }
1348
- function We(e) {
1033
+ function De(e) {
1349
1034
  return e.released ??= Promise.resolve().then(() => e.renderer?.dispose?.());
1350
1035
  }
1351
- function U(e) {
1036
+ function B(e) {
1352
1037
  if (e) throw new u("disposed", "Component registry has been disposed.");
1353
1038
  }
1354
- function kn(e) {
1039
+ function Zt(e) {
1355
1040
  if (!e || typeof e != "object") throw new u("definition", "Component extension definition must be an object.");
1356
1041
  if (Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null) throw new u("definition", "Component extension definition must be a plain object.");
1357
1042
  const t = Object.getOwnPropertyDescriptor(e, "load");
1358
1043
  if (!t || t.get || t.set || typeof t.value != "function") throw new u("definition", "Component extension needs a trusted runtime loader.", "$.load");
1359
- return { metadata: Rn(e), load: t.value };
1044
+ return { metadata: Kt(e), load: t.value };
1360
1045
  }
1361
- function An(e, t) {
1046
+ function Qt(e, t) {
1362
1047
  if (!(e && typeof e.render == "function" && (e.dispose === void 0 || typeof e.dispose == "function"))) {
1363
1048
  if (e && typeof e.dispose == "function")
1364
1049
  try {
@@ -1369,87 +1054,87 @@ function An(e, t) {
1369
1054
  throw new u("load", "Component loader must return render and optional dispose methods.", "$.load", t);
1370
1055
  }
1371
1056
  }
1372
- function On(e, t) {
1373
- const n = new AbortController(), r = () => n.abort(e.reason), o = () => n.abort(t.reason);
1374
- return e.aborted ? r() : e.addEventListener("abort", r, { once: !0 }), t.aborted ? o() : t.addEventListener("abort", o, { once: !0 }), { signal: n.signal, dispose() {
1375
- e.removeEventListener("abort", r), t.removeEventListener("abort", o);
1057
+ function en(e, t) {
1058
+ const n = new AbortController(), r = () => n.abort(e.reason), i = () => n.abort(t.reason);
1059
+ return e.aborted ? r() : e.addEventListener("abort", r, { once: !0 }), t.aborted ? i() : t.addEventListener("abort", i, { once: !0 }), { signal: n.signal, dispose() {
1060
+ e.removeEventListener("abort", r), t.removeEventListener("abort", i);
1376
1061
  } };
1377
1062
  }
1378
- function Or(e) {
1063
+ function Qn(e) {
1379
1064
  if (!Array.isArray(e) || e.length > 128) throw new u("definition", "Register at most 128 component extensions.");
1380
1065
  const t = /* @__PURE__ */ new Map(), n = new AbortController();
1381
- let r = !1, o;
1066
+ let r = !1, i;
1382
1067
  for (const a of e) {
1383
- const c = kn(a), d = c.metadata.id;
1384
- if (t.has(d)) throw new u("definition", "Component extension id is already registered.", "$.id", d);
1385
- t.set(d, c);
1068
+ const c = Zt(a), m = c.metadata.id;
1069
+ if (t.has(m)) throw new u("definition", "Component extension id is already registered.", "$.id", m);
1070
+ t.set(m, c);
1386
1071
  }
1387
- function i(a) {
1388
- return U(r), a.pending || (a.pending = Promise.resolve().then(() => (U(r), a.load(n.signal))).then(async (c) => (An(c, a.metadata.id), a.renderer = c, r && (await We(a), U(r)), c)).catch((c) => {
1072
+ function o(a) {
1073
+ return B(r), a.pending || (a.pending = Promise.resolve().then(() => (B(r), a.load(n.signal))).then(async (c) => (Qt(c, a.metadata.id), a.renderer = c, r && (await De(a), B(r)), c)).catch((c) => {
1389
1074
  throw a.pending = void 0, c instanceof u ? c : Object.assign(new u("load", "Component extension loader failed.", "$.load", a.metadata.id), { cause: c });
1390
1075
  })), a.pending;
1391
1076
  }
1392
1077
  const l = async (a) => {
1393
- U(r);
1394
- const { entry: c, extension: d } = $n(t, a.component), m = On(a.signal, n.signal);
1078
+ B(r);
1079
+ const { entry: c, extension: m } = Xt(t, a.component), f = en(a.signal, n.signal);
1395
1080
  try {
1396
- const f = await De(i(c), m.signal);
1397
- return await De(f.render({ ...a, signal: m.signal, extension: d }), m.signal);
1081
+ const d = await Pe(o(c), f.signal);
1082
+ return await Pe(d.render({ ...a, signal: f.signal, extension: m }), f.signal);
1398
1083
  } finally {
1399
- m.dispose();
1084
+ f.dispose();
1400
1085
  }
1401
1086
  }, s = {
1402
1087
  assets: Object.freeze({ get assetRegistry() {
1403
1088
  return s;
1404
1089
  } }),
1405
1090
  describe(a) {
1406
- return U(r), Object.freeze([...t.values()].map((c) => c.metadata).filter((c) => !a || c.kind === a));
1091
+ return B(r), Object.freeze([...t.values()].map((c) => c.metadata).filter((c) => !a || c.kind === a));
1407
1092
  },
1408
- hasExtension(a, c, d) {
1409
- const m = t.get(a)?.metadata;
1410
- return !r && m?.version === c && m.kind === d;
1093
+ hasExtension(a, c, m) {
1094
+ const f = t.get(a)?.metadata;
1095
+ return !r && f?.version === c && f.kind === m;
1411
1096
  },
1412
1097
  rendererFor(a) {
1413
1098
  const c = Object.getOwnPropertyDescriptor(a, "meta")?.value;
1414
- return c && Object.prototype.hasOwnProperty.call(c, H) ? l : void 0;
1099
+ return c && Object.prototype.hasOwnProperty.call(c, F) ? l : void 0;
1415
1100
  },
1416
1101
  createComponent(a, c = {}) {
1417
- U(r);
1418
- const d = t.get(a);
1419
- if (!d) throw new u("binding", "Component extension is not registered in this runtime.", "$.id", a);
1420
- const m = Q(K(c), "$");
1421
- me(m, ["props", "binding"], "$");
1422
- const f = { id: a, version: d.metadata.version, props: wt(d.metadata, m.props), ...m.binding === void 0 ? {} : { binding: m.binding } };
1423
- return { kind: d.metadata.kind, meta: { [H]: Object.freeze(f) } };
1102
+ B(r);
1103
+ const m = t.get(a);
1104
+ if (!m) throw new u("binding", "Component extension is not registered in this runtime.", "$.id", a);
1105
+ const f = J(U(c), "$");
1106
+ oe(f, ["props", "binding"], "$");
1107
+ const d = { id: a, version: m.metadata.version, props: Ke(m.metadata, f.props), ...f.binding === void 0 ? {} : { binding: f.binding } };
1108
+ return { kind: m.metadata.kind, meta: { [F]: Object.freeze(d) } };
1424
1109
  },
1425
1110
  dispose() {
1426
- return o || (r = !0, n.abort(new u("disposed", "Component registry has been disposed.")), o = Promise.allSettled([...t.values()].filter((a) => a.renderer).map(We)).then((a) => {
1427
- const c = a.find((d) => d.status === "rejected");
1111
+ return i || (r = !0, n.abort(new u("disposed", "Component registry has been disposed.")), i = Promise.allSettled([...t.values()].filter((a) => a.renderer).map(De)).then((a) => {
1112
+ const c = a.find((m) => m.status === "rejected");
1428
1113
  if (c?.status === "rejected") throw c.reason;
1429
- }), o);
1114
+ }), i);
1430
1115
  }
1431
1116
  };
1432
1117
  return s;
1433
1118
  }
1434
- function Ir(e) {
1119
+ function er(e) {
1435
1120
  return e.map((t) => t.map((n) => /[\t\r\n"]/.test(n) ? `"${n.replace(/"/g, '""')}"` : n).join(" ")).join(`\r
1436
1121
  `);
1437
1122
  }
1438
- function In(e, t) {
1123
+ function tn(e, t) {
1439
1124
  const n = e[e.length - 1];
1440
1125
  e.length > 1 && n?.length === 1 && n[0] === "" && /[\r\n]$/.test(t) && e.pop();
1441
1126
  }
1442
- function Nr(e, t = 1e4) {
1127
+ function tr(e, t = 1e4) {
1443
1128
  if (e.length > 4 * 1024 * 1024) throw new Error("Clipboard text limit exceeded");
1444
1129
  const n = [[]];
1445
- let r = "", o = !1, i = !1, l = 0;
1130
+ let r = "", i = !1, o = !1, l = 0;
1446
1131
  function s() {
1447
1132
  if (++l > t) throw new Error("Clipboard cell limit exceeded");
1448
- n[n.length - 1].push(r), r = "", i = !1;
1133
+ n[n.length - 1].push(r), r = "", o = !1;
1449
1134
  }
1450
1135
  for (let a = 0; a < e.length; a++) {
1451
1136
  const c = e[a];
1452
- if (o) {
1137
+ if (i) {
1453
1138
  if (c !== '"') {
1454
1139
  r += c;
1455
1140
  continue;
@@ -1458,11 +1143,11 @@ function Nr(e, t = 1e4) {
1458
1143
  r += '"', a++;
1459
1144
  continue;
1460
1145
  }
1461
- o = !1, i = !0;
1146
+ i = !1, o = !0;
1462
1147
  continue;
1463
1148
  }
1464
- if (c === '"' && !r && !i) {
1465
- o = !0;
1149
+ if (c === '"' && !r && !o) {
1150
+ i = !0;
1466
1151
  continue;
1467
1152
  }
1468
1153
  if (c === " ") {
@@ -1475,536 +1160,536 @@ function Nr(e, t = 1e4) {
1475
1160
  ` && a++;
1476
1161
  continue;
1477
1162
  }
1478
- if (i) throw new Error("Invalid quoted clipboard value");
1163
+ if (o) throw new Error("Invalid quoted clipboard value");
1479
1164
  r += c;
1480
1165
  }
1481
- if (o) throw new Error("Unclosed clipboard quote");
1482
- return s(), In(n, e), n;
1166
+ if (i) throw new Error("Unclosed clipboard quote");
1167
+ return s(), tn(n, e), n;
1483
1168
  }
1484
- class Nn extends Error {
1169
+ class nn extends Error {
1485
1170
  constructor(t, n, r) {
1486
- const o = typeof n.label == "string" ? n.label : "单元格", i = {
1487
- definition: `${o}的编辑器配置无效`,
1488
- type: `${o}的编辑器与数据类型不一致`,
1489
- required: `${o}不能为空`,
1490
- min: `${o}不能小于 ${r}`,
1491
- max: `${o}不能大于 ${r}`,
1492
- precision: `${o}最多保留 ${r} 位小数`,
1493
- length: `${o}最多允许 ${r} 个字符`,
1494
- choice: `${o}请选择有效选项`,
1495
- date: `${o}请输入有效日期(YYYY-MM-DD)`
1171
+ const i = typeof n.label == "string" ? n.label : "单元格", o = {
1172
+ definition: `${i}的编辑器配置无效`,
1173
+ type: `${i}的编辑器与数据类型不一致`,
1174
+ required: `${i}不能为空`,
1175
+ min: `${i}不能小于 ${r}`,
1176
+ max: `${i}不能大于 ${r}`,
1177
+ precision: `${i}最多保留 ${r} 位小数`,
1178
+ length: `${i}最多允许 ${r} 个字符`,
1179
+ choice: `${i}请选择有效选项`,
1180
+ date: `${i}请输入有效日期(YYYY-MM-DD)`
1496
1181
  };
1497
- super(i[t]), this.code = t, this.field = n, this.expected = r, this.name = "ReportCellFieldError";
1182
+ super(o[t]), this.code = t, this.field = n, this.expected = r, this.name = "ReportCellFieldError";
1498
1183
  }
1499
1184
  }
1500
- function y(e, t, n) {
1501
- throw new Nn(t, e, n);
1185
+ function w(e, t, n) {
1186
+ throw new nn(t, e, n);
1502
1187
  }
1503
- function bt(e) {
1188
+ function Ye(e) {
1504
1189
  if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}$/.test(e) || e.startsWith("0000-")) return !1;
1505
1190
  const t = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
1506
1191
  return Number.isFinite(t.getTime()) && t.toISOString().slice(0, 10) === e;
1507
1192
  }
1508
- function Dn(e) {
1193
+ function rn(e) {
1509
1194
  const [t = "", n = "0"] = String(e).toLowerCase().split("e");
1510
1195
  return Math.max(0, (t.split(".")[1]?.length ?? 0) - Number(n));
1511
1196
  }
1512
- function Ln(e, t) {
1513
- e.min !== void 0 && t < e.min && y(e, "min", e.min), e.max !== void 0 && t > e.max && y(e, "max", e.max), e.precision !== void 0 && Dn(t) > e.precision && y(e, "precision", e.precision);
1197
+ function on(e, t) {
1198
+ e.min !== void 0 && t < e.min && w(e, "min", e.min), e.max !== void 0 && t > e.max && w(e, "max", e.max), e.precision !== void 0 && rn(t) > e.precision && w(e, "precision", e.precision);
1514
1199
  }
1515
- function Fn(e, t) {
1516
- bt(t) || y(e, "date"), e.min !== void 0 && t < e.min && y(e, "min", e.min), e.max !== void 0 && t > e.max && y(e, "max", e.max);
1200
+ function an(e, t) {
1201
+ Ye(t) || w(e, "date"), e.min !== void 0 && t < e.min && w(e, "min", e.min), e.max !== void 0 && t > e.max && w(e, "max", e.max);
1517
1202
  }
1518
- function jn(e) {
1519
- [e.min, e.max].some((t) => t !== void 0 && !Number.isFinite(t)) && y(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && y(e, "definition"), e.precision !== void 0 && (!Number.isInteger(e.precision) || e.precision < 0 || e.precision > 15) && y(e, "definition");
1203
+ function sn(e) {
1204
+ [e.min, e.max].some((t) => t !== void 0 && !Number.isFinite(t)) && w(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && w(e, "definition"), e.precision !== void 0 && (!Number.isInteger(e.precision) || e.precision < 0 || e.precision > 15) && w(e, "definition");
1520
1205
  }
1521
- function zn(e) {
1522
- [e.min, e.max].some((t) => t !== void 0 && !bt(t)) && y(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && y(e, "definition");
1206
+ function cn(e) {
1207
+ [e.min, e.max].some((t) => t !== void 0 && !Ye(t)) && w(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && w(e, "definition");
1523
1208
  }
1524
- function Hn(e, t) {
1525
- (!Array.isArray(t.options) || !t.options.length) && y(t, "definition");
1209
+ function ln(e, t) {
1210
+ (!Array.isArray(t.options) || !t.options.length) && w(t, "definition");
1526
1211
  const n = e.valueType === "text" ? "string" : e.valueType, r = /* @__PURE__ */ new Set();
1527
- for (const o of t.options)
1528
- (!o || typeof o.value !== n || typeof o.value == "number" && !Number.isFinite(o.value)) && y(t, "definition"), o.label !== void 0 && typeof o.label != "string" && y(t, "definition"), r.has(o.value) && y(t, "definition"), r.add(o.value);
1212
+ for (const i of t.options)
1213
+ (!i || typeof i.value !== n || typeof i.value == "number" && !Number.isFinite(i.value)) && w(t, "definition"), i.label !== void 0 && typeof i.label != "string" && w(t, "definition"), r.has(i.value) && w(t, "definition"), r.add(i.value);
1529
1214
  }
1530
- function Bn(e) {
1531
- e.required !== void 0 && typeof e.required != "boolean" && y(e, "definition"), [e.label, e.hint, e.unit].some((t) => t !== void 0 && typeof t != "string") && y(e, "definition"), e.type === "boolean" && [e.trueLabel, e.falseLabel].some((t) => t !== void 0 && typeof t != "string") && y(e, "definition");
1215
+ function mn(e) {
1216
+ e.required !== void 0 && typeof e.required != "boolean" && w(e, "definition"), [e.label, e.hint, e.unit].some((t) => t !== void 0 && typeof t != "string") && w(e, "definition"), e.type === "boolean" && [e.trueLabel, e.falseLabel].some((t) => t !== void 0 && typeof t != "string") && w(e, "definition");
1532
1217
  }
1533
- function _n(e, t) {
1534
- (!t || typeof t != "object" || Array.isArray(t) || !["text", "number", "boolean", "enum", "date"].includes(t.type)) && y(t ?? { type: "text" }, "definition"), Bn(t), (t.type === "number" || t.type === "boolean") && e.valueType !== t.type && y(t, "type"), (t.type === "text" || t.type === "date") && e.valueType !== "text" && y(t, "type"), t.type === "number" && jn(t), t.type === "text" && t.maxLength !== void 0 && (!Number.isInteger(t.maxLength) || t.maxLength < 0) && y(t, "definition"), t.type === "date" && zn(t), t.type === "enum" && Hn(e, t);
1218
+ function dn(e, t) {
1219
+ (!t || typeof t != "object" || Array.isArray(t) || !["text", "number", "boolean", "enum", "date"].includes(t.type)) && w(t ?? { type: "text" }, "definition"), mn(t), (t.type === "number" || t.type === "boolean") && e.valueType !== t.type && w(t, "type"), (t.type === "text" || t.type === "date") && e.valueType !== "text" && w(t, "type"), t.type === "number" && sn(t), t.type === "text" && t.maxLength !== void 0 && (!Number.isInteger(t.maxLength) || t.maxLength < 0) && w(t, "definition"), t.type === "date" && cn(t), t.type === "enum" && ln(e, t);
1535
1220
  }
1536
- function Dr(e, t, n) {
1537
- if (!e.editable) throw new Rt("readonly");
1538
- n && _n(e, n);
1539
- const r = Pt(e, t);
1540
- return n ? (n.required && typeof r == "string" && !r.trim() && y(n, "required"), r === null || r === "" ? (n.required && y(n, "required"), r) : (n.type === "number" && Ln(n, r), n.type === "date" && Fn(n, r), n.type === "text" && n.maxLength !== void 0 && [...String(r)].length > n.maxLength && y(n, "length", n.maxLength), n.type === "enum" && !n.options.some((o) => Object.is(o.value, r)) && y(n, "choice"), r)) : r;
1221
+ function nr(e, t, n) {
1222
+ if (!e.editable) throw new dt("readonly");
1223
+ n && dn(e, n);
1224
+ const r = ft(e, t);
1225
+ return n ? (n.required && typeof r == "string" && !r.trim() && w(n, "required"), r === null || r === "" ? (n.required && w(n, "required"), r) : (n.type === "number" && on(n, r), n.type === "date" && an(n, r), n.type === "text" && n.maxLength !== void 0 && [...String(r)].length > n.maxLength && w(n, "length", n.maxLength), n.type === "enum" && !n.options.some((i) => Object.is(i.value, r)) && w(n, "choice"), r)) : r;
1541
1226
  }
1542
- class v extends Error {
1227
+ class y extends Error {
1543
1228
  constructor(t) {
1544
1229
  super(`Report calculation: ${t}`), this.code = t, this.name = "ReportCalculationError";
1545
1230
  }
1546
1231
  }
1547
- function G(e) {
1232
+ function W(e) {
1548
1233
  if (!e?.aborted) return;
1549
1234
  const t = new Error("Calculation cancelled");
1550
1235
  throw t.name = "AbortError", t;
1551
1236
  }
1552
- async function se(e, t = 1) {
1237
+ async function ne(e, t = 1) {
1553
1238
  const n = Math.floor(e.scanned / 2048);
1554
- if (e.scanned += t, e.scanned > e.maxScanned) throw new v("limit");
1555
- G(e.signal), Math.floor(e.scanned / 2048) > n && (await e.yieldToHost(), G(e.signal));
1239
+ if (e.scanned += t, e.scanned > e.maxScanned) throw new y("limit");
1240
+ W(e.signal), Math.floor(e.scanned / 2048) > n && (await e.yieldToHost(), W(e.signal));
1556
1241
  }
1557
- function Ae(e) {
1242
+ function Se(e) {
1558
1243
  return e.table?.role === "header" ? -Math.max(1, e.grid?.cells.length ?? 1) : e.table?.rowIndex ?? 0;
1559
1244
  }
1560
- function Ue(e, t, n) {
1561
- if (![t.pageIndex, t.componentIndex, t.rowIndex, t.columnIndex].every((s) => Number.isSafeInteger(s) && s >= 0)) throw new v("selection");
1245
+ function Le(e, t, n) {
1246
+ if (![t.pageIndex, t.componentIndex, t.rowIndex, t.columnIndex].every((s) => Number.isSafeInteger(s) && s >= 0)) throw new y("selection");
1562
1247
  const r = e.pages[t.pageIndex]?.components[t.componentIndex];
1563
- if (!r?.grid || t.rowIndex >= r.grid.cells.length) throw new v("selection");
1564
- const o = r.grid.colWidthsMm?.length ?? r.grid.cells.reduce((s, a) => Math.max(s, a.length), 1);
1565
- if (t.columnIndex >= o) throw new v("selection");
1566
- const i = r.table, l = e.pages[n.pageIndex]?.components[n.componentIndex]?.table;
1567
- if (i && l && i.id === l.id) {
1568
- const s = l.columnKeys.indexOf(i.columnKeys[t.columnIndex] ?? "");
1569
- if (s < 0) throw new v("selection");
1570
- return { grid: i.id, row: Ae(r) + t.rowIndex, column: s };
1248
+ if (!r?.grid || t.rowIndex >= r.grid.cells.length) throw new y("selection");
1249
+ const i = r.grid.colWidthsMm?.length ?? r.grid.cells.reduce((s, a) => Math.max(s, a.length), 1);
1250
+ if (t.columnIndex >= i) throw new y("selection");
1251
+ const o = r.table, l = e.pages[n.pageIndex]?.components[n.componentIndex]?.table;
1252
+ if (o && l && o.id === l.id) {
1253
+ const s = l.columnKeys.indexOf(o.columnKeys[t.columnIndex] ?? "");
1254
+ if (s < 0) throw new y("selection");
1255
+ return { grid: o.id, row: Se(r) + t.rowIndex, column: s };
1571
1256
  }
1572
1257
  return { grid: `${t.pageIndex}:${t.componentIndex}`, row: t.rowIndex, column: t.columnIndex };
1573
1258
  }
1574
- function Wn(e, t, n) {
1575
- const r = Ue(e, t.anchor, t.anchor), o = Ue(e, t.focus, t.anchor);
1576
- if (r.grid !== o.grid) throw new v("selection");
1577
- const i = (Math.abs(r.row - o.row) + 1) * (Math.abs(r.column - o.column) + 1);
1578
- if (!Number.isSafeInteger(i) || i > n) throw new v("limit");
1579
- return { grid: r.grid, rowStart: Math.min(r.row, o.row), rowEnd: Math.max(r.row, o.row), columnStart: Math.min(r.column, o.column), columnEnd: Math.max(r.column, o.column), origin: e.pages[t.anchor.pageIndex].components[t.anchor.componentIndex].table };
1259
+ function fn(e, t, n) {
1260
+ const r = Le(e, t.anchor, t.anchor), i = Le(e, t.focus, t.anchor);
1261
+ if (r.grid !== i.grid) throw new y("selection");
1262
+ const o = (Math.abs(r.row - i.row) + 1) * (Math.abs(r.column - i.column) + 1);
1263
+ if (!Number.isSafeInteger(o) || o > n) throw new y("limit");
1264
+ return { grid: r.grid, rowStart: Math.min(r.row, i.row), rowEnd: Math.max(r.row, i.row), columnStart: Math.min(r.column, i.column), columnEnd: Math.max(r.column, i.column), origin: e.pages[t.anchor.pageIndex].components[t.anchor.componentIndex].table };
1580
1265
  }
1581
- function Un(e) {
1266
+ function hn(e) {
1582
1267
  if (!e) return !1;
1583
1268
  const t = e.replace(/"[^"]*"|\\.|\[(?![hms]+\])[^\]]*\]/gi, "");
1584
1269
  return /[ymdhs]/i.test(t);
1585
1270
  }
1586
- function Vn(e) {
1587
- if (e.valueType === "text" || e.valueType === "boolean" || Un(e.numberFormat)) return null;
1271
+ function gn(e) {
1272
+ if (e.valueType === "text" || e.valueType === "boolean" || hn(e.numberFormat)) return null;
1588
1273
  const t = e.value;
1589
1274
  if (typeof t != "number" || !Number.isFinite(t)) return null;
1590
- if (Number.isInteger(t) && !Number.isSafeInteger(t)) throw new v("precision");
1275
+ if (Number.isInteger(t) && !Number.isSafeInteger(t)) throw new y("precision");
1591
1276
  return t;
1592
1277
  }
1593
- function qn(e, t, n) {
1278
+ function un(e, t, n) {
1594
1279
  if (e.seen.has(n)) return;
1595
1280
  e.seen.add(n), e.selected++;
1596
- const r = t ? Vn(t) : null;
1281
+ const r = t ? gn(t) : null;
1597
1282
  r === null ? e.excluded++ : e.values.push(r);
1598
1283
  }
1599
- function Gn(e, t, n, r) {
1284
+ function pn(e, t, n, r) {
1600
1285
  return r.origin ? e.table?.id === r.origin.id : `${t}:${n}` === r.grid;
1601
1286
  }
1602
- function Jn(e, t, n) {
1287
+ function wn(e, t, n) {
1603
1288
  return n.origin ? n.origin.columnKeys.indexOf(e.table.columnKeys[t] ?? "") : t;
1604
1289
  }
1605
- function Kn(e, t, n, r) {
1606
- const o = r.origin ? Ae(e) + t : t, i = Jn(e, n, r);
1607
- return o < r.rowStart || o > r.rowEnd || i < r.columnStart || i > r.columnEnd ? null : `${r.grid}:${o}:${i}`;
1608
- }
1609
- function Yn(e, t) {
1610
- const n = t.origin ? Ae(e) : 0, r = Math.max(0, t.rowStart - n), o = Math.min(e.grid.cells.length, t.rowEnd - n + 1);
1611
- return o > r ? o : 0;
1612
- }
1613
- async function Xn(e, t, n, r, o) {
1614
- const i = e.grid;
1615
- if (t > r.maxScanned) throw new v("limit");
1616
- const l = i.colWidthsMm?.length ?? i.cells.reduce((a, c) => Math.max(a, c.length), 1);
1617
- if (l > r.maxScanned) throw new v("limit");
1290
+ function bn(e, t, n, r) {
1291
+ const i = r.origin ? Se(e) + t : t, o = wn(e, n, r);
1292
+ return i < r.rowStart || i > r.rowEnd || o < r.columnStart || o > r.columnEnd ? null : `${r.grid}:${i}:${o}`;
1293
+ }
1294
+ function yn(e, t) {
1295
+ const n = t.origin ? Se(e) : 0, r = Math.max(0, t.rowStart - n), i = Math.min(e.grid.cells.length, t.rowEnd - n + 1);
1296
+ return i > r ? i : 0;
1297
+ }
1298
+ async function Mn(e, t, n, r, i) {
1299
+ const o = e.grid;
1300
+ if (t > r.maxScanned) throw new y("limit");
1301
+ const l = o.colWidthsMm?.length ?? o.cells.reduce((a, c) => Math.max(a, c.length), 1);
1302
+ if (l > r.maxScanned) throw new y("limit");
1618
1303
  const s = /* @__PURE__ */ new Map();
1619
1304
  for (let a = 0; a < t; a++) {
1620
- a > 0 && a % 2048 === 0 && (await r.yieldToHost(), G(r.signal));
1305
+ a > 0 && a % 2048 === 0 && (await r.yieldToHost(), W(r.signal));
1621
1306
  let c = 0;
1622
- for (const d of i.cells[a]) {
1623
- for (await se(r); c < l && (s.get(c) ?? 0) > a; ) c++;
1307
+ for (const m of o.cells[a]) {
1308
+ for (await ne(r); c < l && (s.get(c) ?? 0) > a; ) c++;
1624
1309
  if (c >= l) break;
1625
- const m = Math.max(1, Math.min(d?.colSpan ?? 1, l - c)), f = Math.min(i.cells.length, a + Math.max(1, d?.rowSpan ?? 1));
1626
- m > 1 && await se(r, m - 1);
1627
- for (let g = c; g < c + m; g++) s.set(g, f);
1628
- const h = Kn(e, a, c, n);
1629
- h && qn(o, d, h), c += m;
1310
+ const f = Math.max(1, Math.min(m?.colSpan ?? 1, l - c)), d = Math.min(o.cells.length, a + Math.max(1, m?.rowSpan ?? 1));
1311
+ f > 1 && await ne(r, f - 1);
1312
+ for (let g = c; g < c + f; g++) s.set(g, d);
1313
+ const h = bn(e, a, c, n);
1314
+ h && un(i, m, h), c += f;
1630
1315
  }
1631
1316
  }
1632
1317
  }
1633
- async function Zn(e, t, n) {
1318
+ async function vn(e, t, n) {
1634
1319
  const r = { values: [], seen: /* @__PURE__ */ new Set(), excluded: 0, selected: 0 };
1635
- for (let o = 0; o < e.pages.length; o++) {
1636
- await se(n);
1637
- const i = e.pages[o];
1638
- for (let l = 0; l < i.components.length; l++) {
1639
- await se(n);
1640
- const s = i.components[l];
1641
- if (!s.grid || !Gn(s, o, l, t) || s.table && s.table.role !== "body") continue;
1642
- const a = Yn(s, t);
1643
- a && await Xn(s, a, t, n, r);
1320
+ for (let i = 0; i < e.pages.length; i++) {
1321
+ await ne(n);
1322
+ const o = e.pages[i];
1323
+ for (let l = 0; l < o.components.length; l++) {
1324
+ await ne(n);
1325
+ const s = o.components[l];
1326
+ if (!s.grid || !pn(s, i, l, t) || s.table && s.table.role !== "body") continue;
1327
+ const a = yn(s, t);
1328
+ a && await Mn(s, a, t, n, r);
1644
1329
  }
1645
1330
  }
1646
1331
  return r;
1647
1332
  }
1648
- function X(e) {
1649
- if (!Number.isFinite(e)) throw new v("overflow");
1333
+ function q(e) {
1334
+ if (!Number.isFinite(e)) throw new y("overflow");
1650
1335
  return e;
1651
1336
  }
1652
- function Qn(e) {
1337
+ function xn(e) {
1653
1338
  let t = 0, n = 0;
1654
1339
  for (const r of e) {
1655
- const o = r - n, i = X(t + o);
1656
- n = i - t - o, t = i;
1340
+ const i = r - n, o = q(t + i);
1341
+ n = o - t - i, t = o;
1657
1342
  }
1658
1343
  return t;
1659
1344
  }
1660
- async function Ve(e, t) {
1345
+ async function Ne(e, t) {
1661
1346
  let n = [...e], r = new Array(e.length);
1662
- for (let i = 1; i < e.length; i *= 2) {
1663
- for (let l = 0; l < e.length; l += i * 2) {
1664
- const s = Math.min(l + i, e.length), a = Math.min(l + i * 2, e.length);
1665
- let c = l, d = s;
1666
- for (let m = l; m < a; m++)
1667
- r[m] = d >= a || c < s && n[c] <= n[d] ? n[c++] : n[d++], m % 2048 === 0 && (await t.yieldToHost(), G(t.signal));
1347
+ for (let o = 1; o < e.length; o *= 2) {
1348
+ for (let l = 0; l < e.length; l += o * 2) {
1349
+ const s = Math.min(l + o, e.length), a = Math.min(l + o * 2, e.length);
1350
+ let c = l, m = s;
1351
+ for (let f = l; f < a; f++)
1352
+ r[f] = m >= a || c < s && n[c] <= n[m] ? n[c++] : n[m++], f % 2048 === 0 && (await t.yieldToHost(), W(t.signal));
1668
1353
  }
1669
1354
  [n, r] = [r, n];
1670
1355
  }
1671
- const o = Math.floor(n.length / 2);
1672
- return n.length % 2 ? n[o] : X(n[o - 1] / 2 + n[o] / 2);
1356
+ const i = Math.floor(n.length / 2);
1357
+ return n.length % 2 ? n[i] : q(n[i - 1] / 2 + n[i] / 2);
1673
1358
  }
1674
- function er(e) {
1675
- const t = Qn(e);
1359
+ function En(e) {
1360
+ const t = xn(e);
1676
1361
  let n = 1 / 0, r = -1 / 0;
1677
- for (const o of e)
1678
- n = Math.min(n, o), r = Math.max(r, o);
1362
+ for (const i of e)
1363
+ n = Math.min(n, i), r = Math.max(r, i);
1679
1364
  return { SUM: t, AVERAGE: t / e.length, AVG: t / e.length, MIN: n, MAX: r, COUNT: e.length };
1680
1365
  }
1681
- function tr(e, t) {
1682
- if (typeof e != "string" || e.length > 256) throw new v("expression");
1366
+ function Sn(e, t) {
1367
+ if (typeof e != "string" || e.length > 256) throw new y("expression");
1683
1368
  const n = e.toUpperCase().match(/(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?|[A-Z_]+|[()+\-*/]|\S/g) ?? [];
1684
- if (!n.length || n.length > 64) throw new v("expression");
1369
+ if (!n.length || n.length > 64) throw new y("expression");
1685
1370
  let r = 0;
1686
- function o(s) {
1687
- if (s > 16) throw new v("expression");
1371
+ function i(s) {
1372
+ if (s > 16) throw new y("expression");
1688
1373
  const a = n[r++];
1689
- if (a === "+" || a === "-") return (a === "-" ? -1 : 1) * o(s + 1);
1374
+ if (a === "+" || a === "-") return (a === "-" ? -1 : 1) * i(s + 1);
1690
1375
  if (a === "(") {
1691
- const c = i(0, s + 1);
1692
- if (n[r++] !== ")") throw new v("expression");
1376
+ const c = o(0, s + 1);
1377
+ if (n[r++] !== ")") throw new y("expression");
1693
1378
  return c;
1694
1379
  }
1695
- if (a && /^(?:SUM|AVERAGE|AVG|MIN|MAX|COUNT|MEDIAN)$/.test(a) && Object.prototype.hasOwnProperty.call(t, a)) return X(t[a]);
1696
- if (a && /^(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?$/.test(a)) return X(Number(a));
1697
- throw new v("expression");
1380
+ if (a && /^(?:SUM|AVERAGE|AVG|MIN|MAX|COUNT|MEDIAN)$/.test(a) && Object.prototype.hasOwnProperty.call(t, a)) return q(t[a]);
1381
+ if (a && /^(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?$/.test(a)) return q(Number(a));
1382
+ throw new y("expression");
1698
1383
  }
1699
- function i(s, a) {
1700
- let c = o(a);
1384
+ function o(s, a) {
1385
+ let c = i(a);
1701
1386
  for (; r < n.length; ) {
1702
- const d = n[r], m = d === "+" || d === "-" ? 1 : d === "*" || d === "/" ? 2 : 0;
1703
- if (!m || m < s) break;
1387
+ const m = n[r], f = m === "+" || m === "-" ? 1 : m === "*" || m === "/" ? 2 : 0;
1388
+ if (!f || f < s) break;
1704
1389
  r++;
1705
- const f = i(m + 1, a + 1);
1706
- if (d === "/" && f === 0) throw new v("division");
1707
- c = X(d === "+" ? c + f : d === "-" ? c - f : d === "*" ? c * f : c / f);
1390
+ const d = o(f + 1, a + 1);
1391
+ if (m === "/" && d === 0) throw new y("division");
1392
+ c = q(m === "+" ? c + d : m === "-" ? c - d : m === "*" ? c * d : c / d);
1708
1393
  }
1709
1394
  return c;
1710
1395
  }
1711
- const l = i(1, 0);
1712
- if (r !== n.length) throw new v("expression");
1396
+ const l = o(1, 0);
1397
+ if (r !== n.length) throw new y("expression");
1713
1398
  return l;
1714
1399
  }
1715
- function nr(e) {
1400
+ function Rn(e) {
1716
1401
  const t = e.maxCells ?? 1e5, n = e.maxScannedCells ?? 2e5, r = e.precision ?? 2;
1717
- if (![t, n].every((o) => Number.isSafeInteger(o) && o >= 1 && o <= 2e6)) throw new v("limit");
1718
- if (!Number.isInteger(r) || r < 0 || r > 12) throw new v("precision");
1402
+ if (![t, n].every((i) => Number.isSafeInteger(i) && i >= 1 && i <= 2e6)) throw new y("limit");
1403
+ if (!Number.isInteger(r) || r < 0 || r > 12) throw new y("precision");
1719
1404
  return { maxCells: t, maxScanned: n, precision: r };
1720
1405
  }
1721
- async function Lr(e, t, n = {}) {
1722
- const r = nr(n), o = { scanned: 0, maxScanned: r.maxScanned, signal: n.signal, yieldToHost: n.yieldToHost ?? (() => new Promise((a) => setTimeout(a, 0))) };
1723
- G(o.signal);
1724
- const i = await Zn(e, Wn(e, t, r.maxCells), o), l = n.operation ?? "sum";
1725
- if (!["sum", "average", "min", "max", "count", "median", "expression"].includes(l)) throw new v("expression");
1406
+ async function rr(e, t, n = {}) {
1407
+ const r = Rn(n), i = { scanned: 0, maxScanned: r.maxScanned, signal: n.signal, yieldToHost: n.yieldToHost ?? (() => new Promise((a) => setTimeout(a, 0))) };
1408
+ W(i.signal);
1409
+ const o = await vn(e, fn(e, t, r.maxCells), i), l = n.operation ?? "sum";
1410
+ if (!["sum", "average", "min", "max", "count", "median", "expression"].includes(l)) throw new y("expression");
1726
1411
  let s = null;
1727
- if (l === "count") s = i.values.length;
1728
- else if (i.values.length)
1729
- if (l === "median") s = await Ve(i.values, o);
1412
+ if (l === "count") s = o.values.length;
1413
+ else if (o.values.length)
1414
+ if (l === "median") s = await Ne(o.values, i);
1730
1415
  else {
1731
- const a = er(i.values);
1732
- l === "expression" ? (/\bMEDIAN\b/i.test(n.expression ?? "") && (a.MEDIAN = await Ve(i.values, o)), s = tr(n.expression ?? "", a)) : s = a[l.toUpperCase()];
1416
+ const a = En(o.values);
1417
+ l === "expression" ? (/\bMEDIAN\b/i.test(n.expression ?? "") && (a.MEDIAN = await Ne(o.values, i)), s = Sn(n.expression ?? "", a)) : s = a[l.toUpperCase()];
1733
1418
  }
1734
- if (G(o.signal), s !== null && Number.isInteger(s) && !Number.isSafeInteger(s)) throw new v("precision");
1735
- return { value: s, formatted: s === null ? "—" : s.toFixed(r.precision), numericCells: i.values.length, excludedCells: i.excluded, selectedCells: i.selected, precision: r.precision };
1419
+ if (W(i.signal), s !== null && Number.isInteger(s) && !Number.isSafeInteger(s)) throw new y("precision");
1420
+ return { value: s, formatted: s === null ? "—" : s.toFixed(r.precision), numericCells: o.values.length, excludedCells: o.excluded, selectedCells: o.selected, precision: r.precision };
1736
1421
  }
1737
- class k extends Error {
1422
+ class P extends Error {
1738
1423
  constructor(t, n) {
1739
1424
  super(t), this.path = n, this.code = "label-sheet", this.name = "LabelSheetError";
1740
1425
  }
1741
1426
  }
1742
- function oe(e) {
1427
+ function Z(e) {
1743
1428
  if (e?.aborted) {
1744
1429
  const t = new Error("标签拼版已取消");
1745
1430
  throw t.name = "AbortError", t;
1746
1431
  }
1747
1432
  }
1748
- function B(e, t, n = !1) {
1749
- if (!Number.isFinite(e) || e <= 0 || n && !Number.isSafeInteger(e)) throw new k("应为正有限数字,数量应为安全整数", t);
1433
+ function j(e, t, n = !1) {
1434
+ if (!Number.isFinite(e) || e <= 0 || n && !Number.isSafeInteger(e)) throw new P("应为正有限数字,数量应为安全整数", t);
1750
1435
  return e;
1751
1436
  }
1752
- function qe(e, t) {
1753
- if (!Number.isFinite(e) || e < 0) throw new k("应为非负有限数字", t);
1437
+ function ke(e, t) {
1438
+ if (!Number.isFinite(e) || e < 0) throw new P("应为非负有限数字", t);
1754
1439
  return e;
1755
1440
  }
1756
- function rr(e) {
1441
+ function Cn(e) {
1757
1442
  const t = typeof e.marginMm == "object" ? e.marginMm : { top: e.marginMm ?? 0, left: e.marginMm ?? 0, bottom: e.marginMm ?? 0, right: e.marginMm ?? 0 }, n = typeof e.gapMm == "object" ? e.gapMm : { horizontal: e.gapMm ?? 0, vertical: e.gapMm ?? 0 };
1758
- for (const r of ["top", "left", "bottom", "right"]) qe(t?.[r], `$.marginMm.${r}`);
1759
- for (const r of ["horizontal", "vertical"]) qe(n?.[r], `$.gapMm.${r}`);
1443
+ for (const r of ["top", "left", "bottom", "right"]) ke(t?.[r], `$.marginMm.${r}`);
1444
+ for (const r of ["horizontal", "vertical"]) ke(n?.[r], `$.gapMm.${r}`);
1760
1445
  return { margin: t, gap: n };
1761
1446
  }
1762
- function or(e) {
1447
+ function Tn(e) {
1763
1448
  const t = e.paper === void 0 || e.paper === "a4" ? { widthMm: 210, heightMm: 297 } : e.paper;
1764
- B(t.widthMm, "$.paper.widthMm"), B(t.heightMm, "$.paper.heightMm");
1765
- const n = B(e.columns, "$.columns", !0), r = B(e.rows, "$.rows", !0), o = n * r;
1766
- if (o > 1e3) throw new k("每张纸不能超过 1000 个位置", "$.columns");
1767
- const { margin: i, gap: l } = rr(e), s = e.startSlot ?? 0, a = e.offsetMm ?? { x: 0, y: 0 };
1768
- if (!Number.isSafeInteger(s) || s < 0 || s >= o) throw new k("起始位置应在首张纸的有效位置内", "$.startSlot");
1769
- if (!Number.isFinite(a.x) || !Number.isFinite(a.y)) throw new k("校准偏移应为有限毫米值", "$.offsetMm");
1770
- return { paper: t, columns: n, rows: r, capacity: o, margin: i, gap: l, startSlot: s, offset: a };
1771
- }
1772
- function yt(e) {
1773
- return 1 + (e.grid?.cells.reduce((t, n) => t + n.length + 1 + n.reduce((r, o) => r + (o?.children?.reduce((i, l) => i + yt(l), 0) ?? 0), 0), 0) ?? 0);
1774
- }
1775
- function ir(e, t, n) {
1776
- if (!Et(e).ok) throw new k("标签计划无效", "$.plan");
1449
+ j(t.widthMm, "$.paper.widthMm"), j(t.heightMm, "$.paper.heightMm");
1450
+ const n = j(e.columns, "$.columns", !0), r = j(e.rows, "$.rows", !0), i = n * r;
1451
+ if (i > 1e3) throw new P("每张纸不能超过 1000 个位置", "$.columns");
1452
+ const { margin: o, gap: l } = Cn(e), s = e.startSlot ?? 0, a = e.offsetMm ?? { x: 0, y: 0 };
1453
+ if (!Number.isSafeInteger(s) || s < 0 || s >= i) throw new P("起始位置应在首张纸的有效位置内", "$.startSlot");
1454
+ if (!Number.isFinite(a.x) || !Number.isFinite(a.y)) throw new P("校准偏移应为有限毫米值", "$.offsetMm");
1455
+ return { paper: t, columns: n, rows: r, capacity: i, margin: o, gap: l, startSlot: s, offset: a };
1456
+ }
1457
+ function Xe(e) {
1458
+ return 1 + (e.grid?.cells.reduce((t, n) => t + n.length + 1 + n.reduce((r, i) => r + (i?.children?.reduce((o, l) => o + Xe(l), 0) ?? 0), 0), 0) ?? 0);
1459
+ }
1460
+ function Pn(e, t, n) {
1461
+ if (!ct(e).ok) throw new P("标签计划无效", "$.plan");
1777
1462
  const r = e.pages[0];
1778
1463
  if (!r) return;
1779
- const { paper: o, columns: i, rows: l, margin: s, gap: a, offset: c } = n;
1780
- if (s.left + c.x < 0 || s.top + c.y < 0 || s.left + c.x + i * r.pageWidthMm + (i - 1) * a.horizontal + s.right > o.widthMm + 1e-6 || s.top + c.y + l * r.pageHeightMm + (l - 1) * a.vertical + s.bottom > o.heightMm + 1e-6) throw new k("标签、间距、边距及校准偏移超过纸张尺寸;不会自动缩小标签", "$.paper");
1781
- let d = 0;
1782
- for (const [m, f] of e.pages.entries()) {
1783
- if (oe(t.signal), f.layout === "wide" || f.pageWidthMm !== r.pageWidthMm || f.pageHeightMm !== r.pageHeightMm) throw new k("拼版需要尺寸相同的固定标签页面", `$.pages.${m}`);
1784
- if (d += f.components.reduce((h, g) => h + yt(g), 0), d > B(t.maxComponents ?? 25e4, "$.maxComponents", !0)) throw new k("拼版组件总量超过预算", "$.maxComponents");
1785
- for (const h of f.components) if (h.leftMm < 0 || h.topMm < 0 || h.leftMm + h.widthMm > f.pageWidthMm + 1e-6 || h.topMm + h.heightMm > f.pageHeightMm + 1e-6) throw new k("标签内容超出标签边界", `$.pages.${m}.components`);
1786
- }
1787
- }
1788
- function Fr(e, t) {
1789
- oe(t.signal);
1790
- const n = or(t), { paper: r, columns: o, capacity: i, margin: l, gap: s, startSlot: a, offset: c } = n, d = e.pages.length ? Math.ceil((a + e.pages.length) / i) : 0;
1791
- if (d > B(t.maxSheets ?? 1e4, "$.maxSheets", !0)) throw new k("拼版纸张数量超过预算", "$.maxSheets");
1792
- B(t.maxComponents ?? 25e4, "$.maxComponents", !0), ir(e, t, n);
1793
- const m = et(e, { maxBytes: B(t.maxSnapshotBytes ?? 64e6, "$.maxSnapshotBytes", !0), check: () => oe(t.signal), error: (h, g) => new k(g, "$.maxSnapshotBytes") }), f = Array.from({ length: d }, () => ({ pageWidthMm: r.widthMm, pageHeightMm: r.heightMm, components: [], meta: { labelSheet: { columns: o, rows: n.rows, slots: [] } } }));
1794
- for (const [h, g] of m.pages.entries()) {
1795
- oe(t.signal);
1796
- const C = a + h, S = C % i, b = f[Math.floor(C / i)], M = l.left + c.x + S % o * (g.pageWidthMm + s.horizontal), w = l.top + c.y + Math.floor(S / o) * (g.pageHeightMm + s.vertical), N = { sourcePageIndex: h, slotIndex: S, xMm: M, yMm: w, widthMm: g.pageWidthMm, heightMm: g.pageHeightMm, ...g.meta ? { sourceMeta: g.meta } : {} };
1797
- b.meta.labelSheet.slots.push(N), b.components.push(...g.components.map((D) => ({ ...D, leftMm: D.leftMm + M, topMm: D.topMm + w, meta: { ...D.meta, labelSheet: N } })));
1798
- }
1799
- return { ...m, pages: f };
1800
- }
1801
- function jr(e) {
1464
+ const { paper: i, columns: o, rows: l, margin: s, gap: a, offset: c } = n;
1465
+ if (s.left + c.x < 0 || s.top + c.y < 0 || s.left + c.x + o * r.pageWidthMm + (o - 1) * a.horizontal + s.right > i.widthMm + 1e-6 || s.top + c.y + l * r.pageHeightMm + (l - 1) * a.vertical + s.bottom > i.heightMm + 1e-6) throw new P("标签、间距、边距及校准偏移超过纸张尺寸;不会自动缩小标签", "$.paper");
1466
+ let m = 0;
1467
+ for (const [f, d] of e.pages.entries()) {
1468
+ if (Z(t.signal), d.layout === "wide" || d.pageWidthMm !== r.pageWidthMm || d.pageHeightMm !== r.pageHeightMm) throw new P("拼版需要尺寸相同的固定标签页面", `$.pages.${f}`);
1469
+ if (m += d.components.reduce((h, g) => h + Xe(g), 0), m > j(t.maxComponents ?? 25e4, "$.maxComponents", !0)) throw new P("拼版组件总量超过预算", "$.maxComponents");
1470
+ for (const h of d.components) if (h.leftMm < 0 || h.topMm < 0 || h.leftMm + h.widthMm > d.pageWidthMm + 1e-6 || h.topMm + h.heightMm > d.pageHeightMm + 1e-6) throw new P("标签内容超出标签边界", `$.pages.${f}.components`);
1471
+ }
1472
+ }
1473
+ function ir(e, t) {
1474
+ Z(t.signal);
1475
+ const n = Tn(t), { paper: r, columns: i, capacity: o, margin: l, gap: s, startSlot: a, offset: c } = n, m = e.pages.length ? Math.ceil((a + e.pages.length) / o) : 0;
1476
+ if (m > j(t.maxSheets ?? 1e4, "$.maxSheets", !0)) throw new P("拼版纸张数量超过预算", "$.maxSheets");
1477
+ j(t.maxComponents ?? 25e4, "$.maxComponents", !0), Pn(e, t, n);
1478
+ const f = He(e, { maxBytes: j(t.maxSnapshotBytes ?? 64e6, "$.maxSnapshotBytes", !0), check: () => Z(t.signal), error: (h, g) => new P(g, "$.maxSnapshotBytes") }), d = Array.from({ length: m }, () => ({ pageWidthMm: r.widthMm, pageHeightMm: r.heightMm, components: [], meta: { labelSheet: { columns: i, rows: n.rows, slots: [] } } }));
1479
+ for (const [h, g] of f.pages.entries()) {
1480
+ Z(t.signal);
1481
+ const S = a + h, E = S % o, b = d[Math.floor(S / o)], M = l.left + c.x + E % i * (g.pageWidthMm + s.horizontal), R = l.top + c.y + Math.floor(E / i) * (g.pageHeightMm + s.vertical), z = { sourcePageIndex: h, slotIndex: E, xMm: M, yMm: R, widthMm: g.pageWidthMm, heightMm: g.pageHeightMm, ...g.meta ? { sourceMeta: g.meta } : {} };
1482
+ b.meta.labelSheet.slots.push(z), b.components.push(...g.components.map((I) => ({ ...I, leftMm: I.leftMm + M, topMm: I.topMm + R, meta: { ...I.meta, labelSheet: z } })));
1483
+ }
1484
+ return { ...f, pages: d };
1485
+ }
1486
+ function or(e) {
1802
1487
  if (!e || !["today", "yesterday", "month-start", "month-end"].includes(e.preset)) throw new TypeError("未知日期默认值");
1803
1488
  const t = e.now instanceof Date ? e.now.getTime() : e.now;
1804
1489
  if (typeof t != "number" || !Number.isFinite(t) || !Number.isFinite(new Date(t).getTime())) throw new TypeError("日期默认值需要有效的业务时钟");
1805
1490
  if (typeof e.timeZone != "string" || !e.timeZone.trim()) throw new TypeError("日期默认值需要显式业务时区");
1806
1491
  if (e.offsetDays !== void 0 && (!Number.isSafeInteger(e.offsetDays) || Math.abs(e.offsetDays) > 3660)) throw new RangeError("日期偏移应为 -3660 到 3660 的整数");
1807
- const n = new Intl.DateTimeFormat("en-CA", { timeZone: e.timeZone, year: "numeric", month: "2-digit", day: "2-digit", calendar: "iso8601", numberingSystem: "latn" }).formatToParts(t), r = (i) => Number(n.find((l) => l.type === i)?.value), o = /* @__PURE__ */ new Date(0);
1808
- if (o.setUTCFullYear(r("year"), r("month") - 1, r("day")), o.setUTCHours(0, 0, 0, 0), e.preset === "yesterday" && o.setUTCDate(o.getUTCDate() - 1), e.preset === "month-start" && o.setUTCDate(1), e.preset === "month-end" && o.setUTCMonth(o.getUTCMonth() + 1, 0), o.setUTCDate(o.getUTCDate() + (e.offsetDays ?? 0)), o.getUTCFullYear() < 1 || o.getUTCFullYear() > 9999) throw new RangeError("业务日期超出 0001–9999 范围");
1809
- return o.toISOString().slice(0, 10);
1492
+ const n = new Intl.DateTimeFormat("en-CA", { timeZone: e.timeZone, year: "numeric", month: "2-digit", day: "2-digit", calendar: "iso8601", numberingSystem: "latn" }).formatToParts(t), r = (o) => Number(n.find((l) => l.type === o)?.value), i = /* @__PURE__ */ new Date(0);
1493
+ if (i.setUTCFullYear(r("year"), r("month") - 1, r("day")), i.setUTCHours(0, 0, 0, 0), e.preset === "yesterday" && i.setUTCDate(i.getUTCDate() - 1), e.preset === "month-start" && i.setUTCDate(1), e.preset === "month-end" && i.setUTCMonth(i.getUTCMonth() + 1, 0), i.setUTCDate(i.getUTCDate() + (e.offsetDays ?? 0)), i.getUTCFullYear() < 1 || i.getUTCFullYear() > 9999) throw new RangeError("业务日期超出 0001–9999 范围");
1494
+ return i.toISOString().slice(0, 10);
1810
1495
  }
1811
- function zr(e, t) {
1496
+ function ar(e, t) {
1812
1497
  const n = JSON.parse(JSON.stringify(e));
1813
- function r(o) {
1814
- if (!o || typeof o != "object") return;
1815
- if (Array.isArray(o)) {
1816
- o.forEach(r);
1498
+ function r(i) {
1499
+ if (!i || typeof i != "object") return;
1500
+ if (Array.isArray(i)) {
1501
+ i.forEach(r);
1817
1502
  return;
1818
1503
  }
1819
- const i = o, l = i.meta?.contextKey;
1820
- if (i.kind === "text" && typeof l == "string" && Object.prototype.hasOwnProperty.call(t, l)) {
1504
+ const o = i, l = o.meta?.contextKey;
1505
+ if (o.kind === "text" && typeof l == "string" && Object.prototype.hasOwnProperty.call(t, l)) {
1821
1506
  const s = t[l];
1822
1507
  if (typeof s != "string") throw new TypeError("Report template context values must be strings");
1823
- i.text = s, delete i.lines, delete i.rawText, delete i.richParagraphs;
1508
+ o.text = s, delete o.lines, delete o.rawText, delete o.richParagraphs;
1824
1509
  }
1825
- Object.values(i).forEach(r);
1510
+ Object.values(o).forEach(r);
1826
1511
  }
1827
1512
  return r(n.pages), n;
1828
1513
  }
1829
1514
  export {
1830
- _r as CSS_DPI,
1831
- Wr as DEFAULT_BORDER_PT,
1832
- le as DEFAULT_FONT_FAMILY,
1833
- Ur as DEFAULT_FONT_PT,
1834
- Co as DEFAULT_LABEL_PAGE_LIMIT,
1835
- Vr as DEFAULT_STROKE_COLOR,
1836
- Ge as DEFAULT_TEXT_COLOR,
1837
- qr as LINE_HEIGHT,
1838
- k as LabelSheetError,
1839
- Gr as MM_PER_INCH,
1840
- oi as OutputAssetError,
1841
- kt as OutputFidelityError,
1842
- ie as PAPER_SIZES,
1843
- mn as PageBuilder,
1844
- To as PaginateCellLimitError,
1845
- Ro as PaginateChartComponentLimitError,
1846
- Po as PaginatePageLimitError,
1847
- ao as RENDER_PLAN_SCHEMA_VERSION,
1848
- pe as REPORT_TEMPLATE_DOCUMENT_VERSION,
1849
- Zr as ReportBindingError,
1850
- v as ReportCalculationError,
1851
- Rt as ReportCellEditError,
1852
- Nn as ReportCellFieldError,
1515
+ lr as CSS_DPI,
1516
+ mr as DEFAULT_BORDER_PT,
1517
+ ge as DEFAULT_FONT_FAMILY,
1518
+ dr as DEFAULT_FONT_PT,
1519
+ Kr as DEFAULT_LABEL_PAGE_LIMIT,
1520
+ fr as DEFAULT_STROKE_COLOR,
1521
+ st as DEFAULT_TEXT_COLOR,
1522
+ hr as LINE_HEIGHT,
1523
+ P as LabelSheetError,
1524
+ gr as MM_PER_INCH,
1525
+ ki as OutputAssetError,
1526
+ ut as OutputFidelityError,
1527
+ ee as PAPER_SIZES,
1528
+ Dt as PageBuilder,
1529
+ xr as PaginateCellLimitError,
1530
+ Er as PaginateChartComponentLimitError,
1531
+ Sr as PaginatePageLimitError,
1532
+ ur as RENDER_PLAN_SCHEMA_VERSION,
1533
+ me as REPORT_TEMPLATE_DOCUMENT_VERSION,
1534
+ Rr as ReportBindingError,
1535
+ y as ReportCalculationError,
1536
+ dt as ReportCellEditError,
1537
+ nn as ReportCellFieldError,
1853
1538
  u as ReportComponentExtensionError,
1854
- si as ReportDataError,
1855
- li as ReportDrillError,
1856
- bi as ReportParamValidationError,
1857
- xe as ReportSourceError,
1858
- Ze as ReportTemplateError,
1859
- j as ReportTemplateMigrationError,
1860
- F as ReportTemplateStoreError,
1861
- $o as ReportValidationError,
1862
- Jr as SCHEMA_VERSION_MACH,
1863
- dn as TemplateBuilder,
1864
- ra as TreeRowLimitError,
1865
- ko as applyReportCellEdit,
1866
- Ao as applyReportCellEditBatch,
1867
- Zi as applyReportDocumentStyle,
1868
- Oo as applyReportEditResult,
1869
- Io as applyReportSourceMetadata,
1870
- lo as assertRenderPlan,
1871
- yi as assertReportParams,
1872
- No as assertReportValidation,
1873
- zr as bindReportTemplateContext,
1874
- Lr as calculateReportSelection,
1875
- Qi as captureTemplateFragment,
1876
- Mo as charWidthEm,
1877
- P as classOf,
1878
- _i as cloneReportTemplate,
1879
- Ji as collectTemplateOutline,
1880
- Cr as columnsFromContract,
1881
- ci as compareReportData,
1882
- ji as compileReportPredicate,
1883
- tn as computePageWindow,
1884
- Do as countTemplatePages,
1885
- vo as createCanvasMeasurer,
1886
- Sr as createCanvasPager,
1887
- xo as createHeuristicMeasurer,
1888
- Rr as createLabelTemplate,
1889
- Wi as createLocalTemplateCatalog,
1890
- Ar as createMemoryTemplateStore,
1891
- br as createPageViewportRenderer,
1892
- $r as createProviderReport,
1893
- Lo as createReportCellEdit,
1894
- Fo as createReportCellEditBatch,
1895
- jo as createReportCellResolver,
1896
- Di as createReportChartData,
1897
- Or as createReportComponentRegistry,
1898
- di as createReportDrillRequest,
1899
- zo as createReportEditSession,
1900
- mi as createReportPrefill,
1901
- Ho as createReportSource,
1902
- Tr as createTableTemplate,
1903
- Er as createTemplate,
1904
- kr as createTemplateManager,
1905
- vn as createTemplateMigrator,
1906
- co as createTemplateRegistry,
1907
- oa as createTreeTable,
1908
- bo as datasetJsonSchema,
1909
- Pr as defineLabelReport,
1910
- Tt as defineReport,
1911
- mo as defineReportTemplate,
1912
- Ui as diffReportTemplates,
1913
- Bo as estimateListLayoutCells,
1914
- Qr as evalStyleRule,
1915
- tr as evaluateReportAggregateExpression,
1916
- zi as evaluateReportPredicate,
1917
- _o as explainDatasetField,
1918
- Mi as formatReportCascaderPath,
1919
- Wo as formatReportCellEdit,
1920
- Ir as formatReportClipboard,
1921
- vi as formatReportDateRange,
1922
- xi as formatReportNumberRange,
1923
- Si as formatReportParamSelection,
1924
- eo as formatValue,
1925
- Uo as getReportCellContext,
1926
- Vo as getReportEditSession,
1927
- qo as hasValidDataExplanation,
1928
- ve as heuristicMeasurer,
1929
- Fr as imposeLabelSheets,
1930
- ea as insertTemplateFragment,
1931
- ii as inspectOutputCapabilities,
1932
- fo as inspectReportTemplateCompatibility,
1933
- Ki as inspectTemplateFieldUsage,
1934
- ta as inspectTemplateFragmentBindings,
1935
- ce as isImageBackedComponent,
1936
- Go as isReportDataTarget,
1937
- Ei as isReportDate,
1938
- Ci as isReportMonth,
1939
- Jo as isReportValueState,
1940
- Ti as isReportYear,
1941
- Ye as isRichText,
1942
- fi as matchReportDrillActions,
1943
- Pe as measurePageSizePx,
1944
- So as measureTextMm,
1945
- Ke as mergeComponentStyles,
1946
- ue as mmToPx,
1947
- Kr as mmToPxFactor,
1948
- Ko as paginateTemplate,
1949
- Yo as paginateTemplatePages,
1950
- to as parseDateLocal,
1951
- Ri as parseReportCascaderPath,
1952
- Dr as parseReportCellFieldInput,
1953
- Pt as parseReportCellInput,
1954
- Nr as parseReportClipboard,
1955
- Pi as parseReportDateRange,
1956
- $i as parseReportNumberRange,
1957
- ki as parseReportParamSelection,
1958
- re as parseReportTemplate,
1959
- yr as planFontSizePx,
1960
- Xo as projectListColumns,
1961
- V as ptToPx,
1962
- Yr as pxToMm,
1963
- Zo as registerReportEditSession,
1964
- Qo as relocateReportCellEdits,
1965
- lt as renderComponent,
1966
- ct as renderPage,
1967
- wr as renderPlan,
1968
- vr as renderPlanToCanvas,
1969
- xr as renderPlanToCanvasAsync,
1970
- Mr as renderPlanToImages,
1971
- ei as reportCellEditKey,
1972
- hi as reportDataSnapshotFromPlan,
1973
- jr as reportDateDefault,
1974
- Z as reportOutputDiagnostics,
1975
- Ai as reportParamsJsonSchema,
1976
- Hi as reportPredicateFields,
1977
- gi as reportPrefillInputs,
1978
- Je as resolveBoxBorders,
1979
- no as resolveComponentBinding,
1980
- _ as resolveFontSize,
1981
- ye as resolveGridLayout,
1982
- q as resolveLineHeight,
1983
- ut as resolvePaper,
1984
- Ee as resolvePlanAssets,
1985
- ui as resolveReportDrillReturn,
1986
- Y as resolveStroke,
1987
- Me as resolveTextColor,
1988
- Vi as reviewReportTemplate,
1989
- qi as reviewReportTemplateAsync,
1990
- J as round,
1991
- ho as serializeReportTemplate,
1992
- ti as summarizeReportCellEdits,
1993
- Yi as templatePathLocation,
1994
- ro as toExcelNumberFormat,
1995
- oo as toNumber,
1996
- go as validateComponent,
1997
- Ct as validateDatasetRows,
1998
- uo as validatePage,
1999
- Et as validateRenderPlan,
2000
- _n as validateReportCellFieldDefinition,
2001
- Li as validateReportChartBinding,
2002
- ni as validateReportDataset,
2003
- pi as validateReportDrillActions,
2004
- Oi as validateReportParamDefinitions,
2005
- Ii as validateReportParams,
2006
- Xe as validateReportTemplate,
2007
- po as validateReportTemplateDocument,
2008
- ia as validateTreeOptions,
2009
- Qe as wrapText
1539
+ ji as ReportDataError,
1540
+ zi as ReportDrillError,
1541
+ Ki as ReportParamValidationError,
1542
+ pe as ReportSourceError,
1543
+ je as ReportTemplateError,
1544
+ N as ReportTemplateMigrationError,
1545
+ L as ReportTemplateStoreError,
1546
+ Yr as ReportValidationError,
1547
+ pr as SCHEMA_VERSION_MACH,
1548
+ It as TemplateBuilder,
1549
+ Oo as TreeRowLimitError,
1550
+ Xr as applyReportCellEdit,
1551
+ Zr as applyReportCellEditBatch,
1552
+ Ro as applyReportDocumentStyle,
1553
+ Qr as applyReportEditResult,
1554
+ ei as applyReportSourceMetadata,
1555
+ Dr as assertRenderPlan,
1556
+ Yi as assertReportParams,
1557
+ ti as assertReportValidation,
1558
+ ar as bindReportTemplateContext,
1559
+ rr as calculateReportSelection,
1560
+ Co as captureTemplateFragment,
1561
+ Ur as charWidthEm,
1562
+ Ri as classOf,
1563
+ yo as cloneReportTemplate,
1564
+ Ci as collectTemplateOutline,
1565
+ Vn as columnsFromContract,
1566
+ Hi as compareReportData,
1567
+ ho as compileReportPredicate,
1568
+ St as computePageWindow,
1569
+ ni as countTemplatePages,
1570
+ qr as createCanvasMeasurer,
1571
+ Un as createCanvasPager,
1572
+ Vr as createHeuristicMeasurer,
1573
+ Gn as createLabelTemplate,
1574
+ Mo as createLocalTemplateCatalog,
1575
+ Zn as createMemoryTemplateStore,
1576
+ Ti as createPageViewportRenderer,
1577
+ Yn as createProviderReport,
1578
+ ri as createReportCellEdit,
1579
+ ii as createReportCellEditBatch,
1580
+ oi as createReportCellResolver,
1581
+ go as createReportChartData,
1582
+ Qn as createReportComponentRegistry,
1583
+ Bi as createReportDrillRequest,
1584
+ ai as createReportEditSession,
1585
+ _i as createReportPrefill,
1586
+ si as createReportSource,
1587
+ Jn as createTableTemplate,
1588
+ qn as createTemplate,
1589
+ Xn as createTemplateManager,
1590
+ Wt as createTemplateMigrator,
1591
+ Lr as createTemplateRegistry,
1592
+ Ao as createTreeTable,
1593
+ _r as datasetJsonSchema,
1594
+ Kn as defineLabelReport,
1595
+ mt as defineReport,
1596
+ Nr as defineReportTemplate,
1597
+ vo as diffReportTemplates,
1598
+ ci as estimateListLayoutCells,
1599
+ Cr as evalStyleRule,
1600
+ Sn as evaluateReportAggregateExpression,
1601
+ uo as evaluateReportPredicate,
1602
+ li as explainDatasetField,
1603
+ Xi as formatReportCascaderPath,
1604
+ mi as formatReportCellEdit,
1605
+ er as formatReportClipboard,
1606
+ Zi as formatReportDateRange,
1607
+ Qi as formatReportNumberRange,
1608
+ eo as formatReportParamSelection,
1609
+ Tr as formatValue,
1610
+ di as getReportCellContext,
1611
+ fi as getReportEditSession,
1612
+ hi as hasValidDataExplanation,
1613
+ ue as heuristicMeasurer,
1614
+ ir as imposeLabelSheets,
1615
+ To as insertTemplateFragment,
1616
+ Li as inspectOutputCapabilities,
1617
+ kr as inspectReportTemplateCompatibility,
1618
+ Pi as inspectTemplateFieldUsage,
1619
+ Po as inspectTemplateFragmentBindings,
1620
+ he as isImageBackedComponent,
1621
+ gi as isReportDataTarget,
1622
+ to as isReportDate,
1623
+ no as isReportMonth,
1624
+ ui as isReportValueState,
1625
+ ro as isReportYear,
1626
+ ot as isRichText,
1627
+ Wi as matchReportDrillActions,
1628
+ ve as measurePageSizePx,
1629
+ Jr as measureTextMm,
1630
+ at as mergeComponentStyles,
1631
+ wr as mmToPx,
1632
+ br as mmToPxFactor,
1633
+ pi as paginateTemplate,
1634
+ wi as paginateTemplatePages,
1635
+ Pr as parseDateLocal,
1636
+ io as parseReportCascaderPath,
1637
+ nr as parseReportCellFieldInput,
1638
+ ft as parseReportCellInput,
1639
+ tr as parseReportClipboard,
1640
+ oo as parseReportDateRange,
1641
+ ao as parseReportNumberRange,
1642
+ so as parseReportParamSelection,
1643
+ X as parseReportTemplate,
1644
+ Hn as planFontSizePx,
1645
+ bi as projectListColumns,
1646
+ _ as ptToPx,
1647
+ yr as pxToMm,
1648
+ yi as registerReportEditSession,
1649
+ Mi as relocateReportCellEdits,
1650
+ $i as renderComponent,
1651
+ Oi as renderPage,
1652
+ Ai as renderPlan,
1653
+ _n as renderPlanToCanvas,
1654
+ Wn as renderPlanToCanvasAsync,
1655
+ Bn as renderPlanToImages,
1656
+ vi as reportCellEditKey,
1657
+ Ui as reportDataSnapshotFromPlan,
1658
+ or as reportDateDefault,
1659
+ re as reportOutputDiagnostics,
1660
+ co as reportParamsJsonSchema,
1661
+ po as reportPredicateFields,
1662
+ qi as reportPrefillInputs,
1663
+ rt as resolveBoxBorders,
1664
+ $r as resolveComponentBinding,
1665
+ V as resolveFontSize,
1666
+ it as resolveGridLayout,
1667
+ Q as resolveLineHeight,
1668
+ Je as resolvePaper,
1669
+ we as resolvePlanAssets,
1670
+ Vi as resolveReportDrillReturn,
1671
+ le as resolveStroke,
1672
+ fe as resolveTextColor,
1673
+ xo as reviewReportTemplate,
1674
+ Eo as reviewReportTemplateAsync,
1675
+ Mr as round,
1676
+ Fr as serializeReportTemplate,
1677
+ xi as summarizeReportCellEdits,
1678
+ Ii as templatePathLocation,
1679
+ Or as toExcelNumberFormat,
1680
+ Ar as toNumber,
1681
+ jr as validateComponent,
1682
+ lt as validateDatasetRows,
1683
+ zr as validatePage,
1684
+ ct as validateRenderPlan,
1685
+ dn as validateReportCellFieldDefinition,
1686
+ wo as validateReportChartBinding,
1687
+ Ei as validateReportDataset,
1688
+ Ji as validateReportDrillActions,
1689
+ lo as validateReportParamDefinitions,
1690
+ mo as validateReportParams,
1691
+ Fe as validateReportTemplate,
1692
+ Hr as validateReportTemplateDocument,
1693
+ Io as validateTreeOptions,
1694
+ ze as wrapText
2010
1695
  };