@agile-team/mach-report 0.7.0 → 0.8.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 (39) hide show
  1. package/dist/ReportPreview-BQE0C_37.cjs +6 -0
  2. package/dist/ReportPreview-D8X75aLV.js +825 -0
  3. package/dist/format.d.ts +35 -0
  4. package/dist/grid-geometry-BXpOxznT.cjs +1 -0
  5. package/dist/grid-geometry-Bs8QXz1X.js +65 -0
  6. package/dist/index.cjs +6 -6
  7. package/dist/index.d.cts +1 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +839 -655
  10. package/dist/layout/paginate.d.ts +29 -0
  11. package/dist/pdf.cjs +46 -46
  12. package/dist/pdf.js +8 -7
  13. package/dist/{plugin-Cl-IqCqx.cjs → plugin-7W2Zy3Xc.cjs} +1 -1
  14. package/dist/{plugin-Dp3kKWiQ.js → plugin-Bc6Px9Lq.js} +3 -3
  15. package/dist/style-6ihHKVCM.js +192 -0
  16. package/dist/style-Xq08-IsV.cjs +3 -0
  17. package/dist/style.css +1 -1
  18. package/dist/vue/ReportPreview.d.ts +13 -0
  19. package/dist/vue/ReportToolbar.d.ts +15 -0
  20. package/dist/vue/async.d.cts +16 -0
  21. package/dist/vue/async.d.ts +16 -0
  22. package/dist/vue/composables/useHighlight.d.ts +8 -0
  23. package/dist/vue/composables/usePrintExport.d.ts +7 -0
  24. package/dist/vue/config.d.ts +9 -0
  25. package/dist/vue/plugin.d.ts +16 -0
  26. package/dist/vue-async.cjs +1 -1
  27. package/dist/vue-async.js +3 -3
  28. package/dist/vue.cjs +1 -1
  29. package/dist/vue.js +24 -23
  30. package/dist/xlsx/render-xlsx.d.ts +20 -0
  31. package/dist/xlsx.cjs +30 -0
  32. package/dist/xlsx.d.cts +5 -0
  33. package/dist/xlsx.d.ts +5 -0
  34. package/dist/xlsx.js +22647 -0
  35. package/package.json +13 -2
  36. package/dist/ReportPreview-CrVeTKu1.cjs +0 -6
  37. package/dist/ReportPreview-DgsOdO4y.js +0 -559
  38. package/dist/style-B3vxGDZd.cjs +0 -3
  39. package/dist/style-B7Xfo5I-.js +0 -255
package/dist/index.js CHANGED
@@ -1,6 +1,75 @@
1
- import { h as J, R as se, D as j, w as G, L as q, i as le, r as _, m as de, a as W, b as Z, c as F, d as V, p as O, e as he, f as Q, g as ce, j as me, P as K } from "./style-B7Xfo5I-.js";
2
- import { C as Ue, k as Ke, l as Ye, M as Xe, S as Ze, n as Qe, o as et, q as tt, s as nt, t as it, u as rt, v as ot, x as at, y as st } from "./style-B7Xfo5I-.js";
3
- const ge = /* @__PURE__ */ new Set([
1
+ import { h as rt, R as Pt, D as X, w as Z, L as Q, i as At, r as G, m as Et, a as V, b as ut, c as O, d as tt, p as K, e as $t, f as pt, g as Ht, P as ct } from "./style-6ihHKVCM.js";
2
+ import { C as ue, j as pe, k as Me, M as be, S as ye, l as we, n as Se, o as Te, q as xe, s as ke, t as ve, u as Ce, v as Pe, x as Ae } from "./style-6ihHKVCM.js";
3
+ import { r as Rt } from "./grid-geometry-Bs8QXz1X.js";
4
+ function ht(t, e) {
5
+ return e != null ? t.toLocaleString("en-US", {
6
+ minimumFractionDigits: e,
7
+ maximumFractionDigits: e
8
+ }) : t.toLocaleString("en-US");
9
+ }
10
+ function Nt(t, e) {
11
+ const r = (n, i = 2) => String(n).padStart(i, "0");
12
+ return e.replace(/YYYY/g, String(t.getFullYear())).replace(/MM/g, r(t.getMonth() + 1)).replace(/DD/g, r(t.getDate())).replace(/hh/g, r(t.getHours())).replace(/mm/g, r(t.getMinutes())).replace(/ss/g, r(t.getSeconds()));
13
+ }
14
+ function Mt(t, e) {
15
+ if (t == null || t === "" || !e) return String(t ?? "");
16
+ switch (e.kind) {
17
+ case "number": {
18
+ const r = typeof t == "number" ? t : Number(String(t).replace(/,/g, ""));
19
+ return Number.isFinite(r) ? e.thousands === !1 ? r.toFixed(e.digits ?? 0).replace(/\.?0+$/, "") || String(r) : ht(r, e.digits) : String(t);
20
+ }
21
+ case "percent": {
22
+ const r = typeof t == "number" ? t : Number(String(t).replace(/,/g, ""));
23
+ if (!Number.isFinite(r)) return String(t);
24
+ const n = e.digits ?? 2;
25
+ return `${ht(r * 100, n)}%`;
26
+ }
27
+ case "date": {
28
+ const r = e.pattern ?? "YYYY-MM-DD", n = t instanceof Date ? t : new Date(t);
29
+ return Number.isNaN(n.getTime()) ? String(t) : Nt(n, r);
30
+ }
31
+ default:
32
+ return String(t);
33
+ }
34
+ }
35
+ function Bt(t, e) {
36
+ const r = t[e.field];
37
+ if (typeof e.value == "number") {
38
+ const s = typeof r == "number" ? r : Number(r);
39
+ if (!Number.isFinite(s)) return !1;
40
+ switch (e.op) {
41
+ case ">":
42
+ return s > e.value;
43
+ case ">=":
44
+ return s >= e.value;
45
+ case "<":
46
+ return s < e.value;
47
+ case "<=":
48
+ return s <= e.value;
49
+ case "==":
50
+ return s === e.value;
51
+ case "!=":
52
+ return s !== e.value;
53
+ }
54
+ }
55
+ const n = String(r ?? ""), i = String(e.value);
56
+ switch (e.op) {
57
+ case "==":
58
+ return n === i;
59
+ case "!=":
60
+ return n !== i;
61
+ case ">":
62
+ return n > i;
63
+ case ">=":
64
+ return n >= i;
65
+ case "<":
66
+ return n < i;
67
+ case "<=":
68
+ return n <= i;
69
+ }
70
+ return !1;
71
+ }
72
+ const Ft = /* @__PURE__ */ new Set([
4
73
  "text",
5
74
  "image",
6
75
  "barcode",
@@ -10,239 +79,352 @@ const ge = /* @__PURE__ */ new Set([
10
79
  "rect",
11
80
  "ellipse"
12
81
  ]);
13
- function L(e) {
14
- return typeof e == "object" && e !== null && !Array.isArray(e);
82
+ function I(t) {
83
+ return typeof t == "object" && t !== null && !Array.isArray(t);
15
84
  }
16
- function fe(e, n, i, t) {
17
- const r = e[n];
18
- r != null && (typeof r != "number" || !Number.isFinite(r)) && t.push({ path: `${i}.${n}`, message: `应为有限数字,实际 ${JSON.stringify(r)}` });
85
+ function Lt(t, e, r, n) {
86
+ const i = t[e];
87
+ i != null && (typeof i != "number" || !Number.isFinite(i)) && n.push({ path: `${r}.${e}`, message: `应为有限数字,实际 ${JSON.stringify(i)}` });
19
88
  }
20
- function ee(e, n, i, t = []) {
21
- if (!L(e)) {
22
- i.push({ path: n, message: "组件应为对象" });
89
+ function bt(t, e, r, n = []) {
90
+ if (!I(t)) {
91
+ r.push({ path: e, message: "组件应为对象" });
23
92
  return;
24
93
  }
25
- const r = e.kind;
26
- typeof r != "string" ? i.push({ path: `${n}.kind`, message: "组件缺少 kind 字符串" }) : ge.has(r) || t.push({
27
- path: `${n}.kind`,
28
- message: `未知组件类型 ${JSON.stringify(r)},将以兜底方式渲染`
94
+ const i = t.kind;
95
+ typeof i != "string" ? r.push({ path: `${e}.kind`, message: "组件缺少 kind 字符串" }) : Ft.has(i) || n.push({
96
+ path: `${e}.kind`,
97
+ message: `未知组件类型 ${JSON.stringify(i)},将以兜底方式渲染`
29
98
  });
30
99
  for (const o of ["leftMm", "topMm", "widthMm", "heightMm"])
31
- fe(e, o, n, i);
32
- e.leftMm != null && e.widthMm != null && (e.leftMm < -100 || e.widthMm < 0) && i.push({ path: n, message: "几何数值异常(leftMm<-100 或 widthMm<0)" });
33
- const s = e.grid;
34
- s !== void 0 && (!L(s) || !Array.isArray(s.cells) ? i.push({ path: `${n}.grid.cells`, message: "grid.cells 应为二维数组" }) : s.cells.forEach((o, l) => {
100
+ Lt(t, o, e, r);
101
+ t.leftMm != null && t.widthMm != null && (t.leftMm < -100 || t.widthMm < 0) && r.push({ path: e, message: "几何数值异常(leftMm<-100 或 widthMm<0)" });
102
+ const s = t.grid;
103
+ s !== void 0 && (!I(s) || !Array.isArray(s.cells) ? r.push({ path: `${e}.grid.cells`, message: "grid.cells 应为二维数组" }) : s.cells.forEach((o, d) => {
35
104
  if (!Array.isArray(o)) {
36
- i.push({ path: `${n}.grid.cells.${l}`, message: "行应为数组" });
105
+ r.push({ path: `${e}.grid.cells.${d}`, message: "行应为数组" });
37
106
  return;
38
107
  }
39
- o.forEach((d, h) => {
40
- d != null && L(d) && Array.isArray(d.children) && d.children.forEach((c, m) => {
41
- ee(c, `${n}.grid.cells.${l}.${h}.children.${m}`, i, t);
108
+ o.forEach((c, h) => {
109
+ c != null && I(c) && Array.isArray(c.children) && c.children.forEach((g, l) => {
110
+ bt(g, `${e}.grid.cells.${d}.${h}.children.${l}`, r, n);
42
111
  });
43
112
  });
44
113
  }));
45
- const a = e.richParagraphs;
46
- a !== void 0 && (Array.isArray(a) ? a.forEach((o, l) => {
47
- (!L(o) || !Array.isArray(o.segments)) && i.push({ path: `${n}.richParagraphs.${l}`, message: "段落缺少 segments 数组" });
48
- }) : i.push({ path: `${n}.richParagraphs`, message: "richParagraphs 应为数组" }));
49
- }
50
- function ue(e, n, i, t = []) {
51
- if (!L(e)) {
52
- i.push({ path: n, message: "页应为对象" });
114
+ const a = t.richParagraphs;
115
+ a !== void 0 && (Array.isArray(a) ? a.forEach((o, d) => {
116
+ (!I(o) || !Array.isArray(o.segments)) && r.push({ path: `${e}.richParagraphs.${d}`, message: "段落缺少 segments 数组" });
117
+ }) : r.push({ path: `${e}.richParagraphs`, message: "richParagraphs 应为数组" }));
118
+ }
119
+ function zt(t, e, r, n = []) {
120
+ if (!I(t)) {
121
+ r.push({ path: e, message: "页应为对象" });
53
122
  return;
54
123
  }
55
- const r = e.pageWidthMm, s = e.pageHeightMm;
56
- (typeof r != "number" || !(r > 0 && r < 3e3)) && i.push({ path: `${n}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(r)}` }), (typeof s != "number" || !(s > 0 && s < 5e3)) && i.push({ path: `${n}.pageHeightMm`, message: `页高非法: ${JSON.stringify(s)}` });
57
- const a = e.components;
58
- a !== void 0 && !Array.isArray(a) ? i.push({ path: `${n}.components`, message: "components 应为数组" }) : Array.isArray(a) && a.forEach(
59
- (o, l) => ee(o, `${n}.components.${l}`, i, t)
124
+ const i = t.pageWidthMm, s = t.pageHeightMm;
125
+ (typeof i != "number" || !(i > 0 && i < 3e3)) && r.push({ path: `${e}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(i)}` }), (typeof s != "number" || !(s > 0 && s < 5e3)) && r.push({ path: `${e}.pageHeightMm`, message: `页高非法: ${JSON.stringify(s)}` });
126
+ const a = t.components;
127
+ a !== void 0 && !Array.isArray(a) ? r.push({ path: `${e}.components`, message: "components 应为数组" }) : Array.isArray(a) && a.forEach(
128
+ (o, d) => bt(o, `${e}.components.${d}`, r, n)
60
129
  );
61
130
  }
62
- function pe(e) {
63
- const n = [], i = [], t = L(e) ? e.pages : void 0;
64
- if (!Array.isArray(t))
65
- n.push({
131
+ function _t(t) {
132
+ const e = [], r = [], n = I(t) ? t.pages : void 0;
133
+ if (!Array.isArray(n))
134
+ e.push({
66
135
  path: "$.pages",
67
- message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
136
+ message: t == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
68
137
  });
69
138
  else {
70
- t.forEach((s, a) => ue(s, `$.pages.${a}`, n, i)), t.length > 2e3 && i.push({
139
+ n.forEach((s, a) => zt(s, `$.pages.${a}`, e, r)), n.length > 2e3 && r.push({
71
140
  path: "$.pages",
72
- message: `页数异常大(${t.length} 页),渲染与打印耗时可能显著增加`
141
+ message: `页数异常大(${n.length} 页),渲染与打印耗时可能显著增加`
73
142
  });
74
- const r = t.reduce(
75
- (s, a) => s + (L(a) && Array.isArray(a.components) ? a.components.length : 0),
143
+ const i = n.reduce(
144
+ (s, a) => s + (I(a) && Array.isArray(a.components) ? a.components.length : 0),
76
145
  0
77
146
  );
78
- r > 5e4 && i.push({
147
+ i > 5e4 && r.push({
79
148
  path: "$.pages",
80
- message: `组件总数异常大(${r} 个),可能触发浏览器性能限制`
149
+ message: `组件总数异常大(${i} 个),可能触发浏览器性能限制`
81
150
  });
82
151
  }
83
- return { ok: n.length === 0, errors: n, warnings: i };
152
+ return { ok: e.length === 0, errors: e, warnings: r };
84
153
  }
85
- function _e(e) {
86
- const n = pe(e);
87
- if (!n.ok) {
88
- const i = n.errors.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ");
89
- throw new Error(`渲染计划校验失败(${n.errors.length} 处): ${i}`);
154
+ function oe(t) {
155
+ const e = _t(t);
156
+ if (!e.ok) {
157
+ const r = e.errors.slice(0, 3).map((n) => `${n.path}: ${n.message}`).join("; ");
158
+ throw new Error(`渲染计划校验失败(${e.errors.length} 处): ${r}`);
90
159
  }
91
- return e.pages;
160
+ return t.pages;
92
161
  }
93
- function Y(e) {
162
+ function gt(t) {
94
163
  return {
95
- widthMm: e.widthMm,
96
- heightMm: e.heightMm,
97
- marginTopMm: e.marginTopMm ?? 0,
98
- marginBottomMm: e.marginBottomMm ?? 0,
99
- marginLeftMm: e.marginLeftMm ?? 0,
100
- marginRightMm: e.marginRightMm ?? 0,
164
+ widthMm: t.widthMm,
165
+ heightMm: t.heightMm,
166
+ marginTopMm: t.marginTopMm ?? 0,
167
+ marginBottomMm: t.marginBottomMm ?? 0,
168
+ marginLeftMm: t.marginLeftMm ?? 0,
169
+ marginRightMm: t.marginRightMm ?? 0,
101
170
  components: []
102
171
  };
103
172
  }
104
- function Me(e, n) {
105
- return n.heightMm - (e.marginBottomMm ?? n.marginBottomMm);
173
+ function Dt(t, e) {
174
+ return e.heightMm - (t.marginBottomMm ?? e.marginBottomMm);
106
175
  }
107
- function be(e, n) {
108
- const t = (e.fontSizePt ?? j) * q * 25.4 / 72, r = (e.paddingMm ?? 1) * 2;
109
- return Math.max(e.rowHeightMm ?? 0, n * t + r);
176
+ function Wt(t, e) {
177
+ const n = (t.fontSizePt ?? X) * Q * 25.4 / 72, i = (t.paddingMm ?? 1) * 2;
178
+ return Math.max(t.rowHeightMm ?? 0, e * n + i);
110
179
  }
111
- function ye(e) {
112
- if (e == null) return "";
113
- if (typeof e == "string") return e;
114
- if (typeof e == "number") return String(e);
115
- if (typeof e == "boolean") return e ? "是" : "否";
116
- if (e instanceof Date) return e.toISOString().slice(0, 10);
180
+ function nt(t) {
181
+ if (t == null) return "";
182
+ if (typeof t == "string") return t;
183
+ if (typeof t == "number") return String(t);
184
+ if (typeof t == "boolean") return t ? "是" : "否";
185
+ if (t instanceof Date) return t.toISOString().slice(0, 10);
117
186
  try {
118
- return JSON.stringify(e);
187
+ return JSON.stringify(t);
119
188
  } catch {
120
- return String(e);
189
+ return String(t);
121
190
  }
122
191
  }
123
- function we(e, n) {
124
- const i = e.fontSizePt ?? j, t = e.paddingMm ?? 1, r = e.columns.map(
125
- (m) => m.style ? { align: "left", verticalAlign: "middle", ...m.style } : { align: "left", verticalAlign: "middle" }
126
- ), s = e.columns.map(
127
- (m) => ({
128
- bold: e.headerBold ?? !0,
192
+ function It(t, e) {
193
+ const r = t.fontSizePt ?? X, n = t.paddingMm ?? 1, i = t.columns.map(
194
+ (l) => l.style ? { align: "left", verticalAlign: "middle", ...l.style } : { align: "left", verticalAlign: "middle" }
195
+ ), s = t.columns.map(
196
+ (l) => ({
197
+ bold: t.headerBold ?? !0,
129
198
  align: "center",
130
199
  verticalAlign: "middle",
131
- backgroundColor: e.headerBackgroundColor,
132
- ...m.style || {}
200
+ backgroundColor: t.headerBackgroundColor,
201
+ ...l.style || {}
133
202
  })
134
- ), a = e.columns.map((m) => m.header), o = a.map(
135
- (m, u) => G(
136
- m,
137
- e.columns[u].widthMm - t * 2,
138
- { fontSizePt: i, bold: e.headerBold ?? !0 },
139
- n
203
+ ), a = t.columns.map((l) => l.header), o = a.map(
204
+ (l, f) => Z(
205
+ l,
206
+ t.columns[f].widthMm - n * 2,
207
+ { fontSizePt: r, bold: t.headerBold ?? !0 },
208
+ e
140
209
  )
141
- ), l = Math.max(...o.map((m) => m.length), 1), d = be(e, l), h = a.map((m, u) => ({
142
- text: m,
143
- style: s[u]
144
- })), c = e.border === !1 ? { borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } : { borderBottom: !0, borderLeft: !0, borderRight: !0, borderTop: !0 };
210
+ ), d = Math.max(...o.map((l) => l.length), 1), c = Wt(t, d), h = a.map((l, f) => ({
211
+ text: l,
212
+ style: s[f]
213
+ })), g = t.border === !1 ? { borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } : { borderBottom: !0, borderLeft: !0, borderRight: !0, borderTop: !0 };
145
214
  return {
146
- fontSizePt: i,
147
- paddingMm: t,
148
- cellStyles: r,
149
- borderStyle: c,
150
- headerHeightMm: d,
151
- headerGrid: { cells: [h], rowHeightsMm: [d] },
152
- columns: e.columns
215
+ fontSizePt: r,
216
+ paddingMm: n,
217
+ cellStyles: i,
218
+ borderStyle: g,
219
+ headerHeightMm: c,
220
+ headerGrid: { cells: [h], rowHeightsMm: [c] },
221
+ columns: t.columns
153
222
  };
154
223
  }
155
- function Se(e, n, i) {
156
- const t = e.columns, r = new Array(t.length);
224
+ function mt(t, e, r) {
225
+ const n = t.columns, i = new Array(n.length);
157
226
  let s = 1;
158
- for (let h = 0; h < t.length; h++)
159
- r[h] = ye(n[t[h].field]);
160
- const a = new Array(t.length);
161
- for (let h = 0; h < t.length; h++) {
162
- const c = G(
163
- r[h],
164
- t[h].widthMm - e.paddingMm * 2,
165
- { fontSizePt: e.fontSizePt },
166
- i
227
+ for (let h = 0; h < n.length; h++) {
228
+ const g = n[h];
229
+ i[h] = g.format ? Mt(e[g.field], g.format) : nt(e[g.field]);
230
+ }
231
+ const a = new Array(n.length);
232
+ for (let h = 0; h < n.length; h++) {
233
+ const g = Z(
234
+ i[h],
235
+ n[h].widthMm - t.paddingMm * 2,
236
+ { fontSizePt: t.fontSizePt },
237
+ r
167
238
  );
168
- a[h] = c, c.length > s && (s = c.length);
169
- }
170
- const o = e.fontSizePt * q * 25.4 / 72, l = Math.max(
171
- e.rowHeightFloorMm,
172
- s * o + e.paddingMm * 2
173
- ), d = new Array(t.length);
174
- for (let h = 0; h < t.length; h++)
175
- d[h] = { text: r[h], style: e.cellStyles[h] };
176
- return { grid: { cells: [d], rowHeightsMm: [l] }, heightMm: l };
177
- }
178
- function We(e, n, i = {}) {
179
- const t = typeof i == "number" ? { mmPerRow: i } : i, r = t.mmPerRow ?? 0, s = t.measurer ?? J, a = [], o = [];
180
- let l = 0;
181
- const d = (h) => `${h}_${(++l).toString(36)}`;
182
- for (const h of e.pages) {
183
- const c = Y(h), m = () => Me(h, c), u = c.marginTopMm, g = () => {
184
- o.push({
185
- pageWidthMm: c.widthMm,
186
- pageHeightMm: c.heightMm,
187
- marginTopMm: c.marginTopMm,
188
- marginBottomMm: c.marginBottomMm,
189
- marginLeftMm: c.marginLeftMm,
190
- marginRightMm: c.marginRightMm,
191
- components: c.components
192
- });
239
+ a[h] = g, g.length > s && (s = g.length);
240
+ }
241
+ const o = t.fontSizePt * Q * 25.4 / 72, d = Math.max(
242
+ t.rowHeightFloorMm,
243
+ s * o + t.paddingMm * 2
244
+ ), c = new Array(n.length);
245
+ for (let h = 0; h < n.length; h++) {
246
+ const g = n[h];
247
+ let l = t.cellStyles[h];
248
+ if (g.rules) {
249
+ for (const f of g.rules)
250
+ if (Bt(e, f.when)) {
251
+ l = { ...l ?? {}, ...f.style };
252
+ break;
253
+ }
254
+ }
255
+ c[h] = { text: i[h], style: l };
256
+ }
257
+ return { grid: { cells: [c], rowHeightsMm: [d] }, heightMm: d };
258
+ }
259
+ function se(t, e, r = {}) {
260
+ const n = typeof r == "number" ? { mmPerRow: r } : r, i = n.mmPerRow ?? 0, s = n.measurer ?? rt, a = [], o = [];
261
+ let d = 0;
262
+ const c = (g) => `${g}_${(++d).toString(36)}`, h = [];
263
+ for (const g of t.pages) {
264
+ const l = gt(g), f = () => Dt(g, l), m = l.marginTopMm, w = [], E = () => {
265
+ if (o.push({
266
+ pageWidthMm: l.widthMm,
267
+ pageHeightMm: l.heightMm,
268
+ marginTopMm: l.marginTopMm,
269
+ marginBottomMm: l.marginBottomMm,
270
+ marginLeftMm: l.marginLeftMm,
271
+ marginRightMm: l.marginRightMm,
272
+ components: l.components
273
+ }), w.length > 0) {
274
+ const T = o.length;
275
+ for (const b of w) {
276
+ const C = {
277
+ ...b,
278
+ text: String(b.text ?? "").replace(/\{page\}/g, String(T))
279
+ };
280
+ o[o.length - 1].components.push(C), C.text.includes("{totalPages}") && h.push(C);
281
+ }
282
+ }
193
283
  };
194
- for (const M of h.components) {
195
- if (M.kind !== "list") {
196
- c.components.push(M);
284
+ for (const T of g.components) {
285
+ if (T.kind !== "list") {
286
+ if (T.kind === "text" && typeof T.text == "string") {
287
+ const p = T.text;
288
+ if (p.includes("{page}") || p.includes("{totalPages}")) {
289
+ w.push(T);
290
+ continue;
291
+ }
292
+ }
293
+ l.components.push(T);
197
294
  continue;
198
295
  }
199
- const p = M, k = n[p.dataset];
200
- Array.isArray(k) || a.push(`数据集 ${p.dataset} 未提供数据,列表 ${p.id ?? ""} 输出为空`);
201
- const T = Array.isArray(k) ? k : [], E = p.columns.reduce((f, b) => f + b.widthMm, 0), w = E > p.widthMm ? p.widthMm / E : 1, I = w === 1 ? p : { ...p, columns: p.columns.map((f) => ({ ...f, widthMm: f.widthMm * w })) }, R = {
202
- ...we(I, s),
203
- rowHeightFloorMm: I.rowHeightMm ?? 0
204
- }, D = {
296
+ const b = T, C = e[b.dataset];
297
+ Array.isArray(C) || a.push(`数据集 ${b.dataset} 未提供数据,列表 ${b.id ?? ""} 输出为空`);
298
+ const S = Array.isArray(C) ? C : [], J = b.columns.reduce((p, M) => p + M.widthMm, 0), q = J > b.widthMm ? b.widthMm / J : 1, x = q === 1 ? b : { ...b, columns: b.columns.map((p) => ({ ...p, widthMm: p.widthMm * q })) }, $ = {
299
+ ...It(x, s),
300
+ rowHeightFloorMm: x.rowHeightMm ?? 0
301
+ }, j = {
205
302
  kind: "rect",
206
- leftMm: p.leftMm,
303
+ leftMm: b.leftMm,
207
304
  topMm: 0,
208
- widthMm: p.widthMm,
209
- heightMm: R.headerHeightMm,
210
- grid: R.headerGrid,
211
- nid: d("listh"),
212
- style: R.borderStyle
305
+ widthMm: b.widthMm,
306
+ heightMm: $.headerHeightMm,
307
+ grid: $.headerGrid,
308
+ nid: c("listh"),
309
+ style: $.borderStyle
213
310
  };
214
- let $ = p.topMm;
215
- const B = (f, b) => {
216
- f.components.push({ ...D, topMm: b });
311
+ let u = b.topMm;
312
+ const H = (p, M) => {
313
+ p.components.push({ ...j, topMm: M });
217
314
  };
218
- B(c, $), $ += R.headerHeightMm + r;
219
- for (let f = 0; f < T.length; f++) {
220
- const b = Se(R, T[f], s);
221
- if ($ + b.heightMm > m()) {
222
- g();
223
- const P = Y(h);
224
- c.components = P.components, c.heightMm = P.heightMm, I.headerEveryPage !== !1 ? (B(c, p.topMm), $ = p.topMm + R.headerHeightMm) : $ = u;
315
+ H(l, u), u += $.headerHeightMm + i;
316
+ const L = (p) => {
317
+ if (u + p > f()) {
318
+ E();
319
+ const M = gt(g);
320
+ l.components = M.components, l.heightMm = M.heightMm, x.headerEveryPage !== !1 ? (H(l, b.topMm), u = b.topMm + $.headerHeightMm) : u = m;
225
321
  }
226
- c.components.push({
322
+ }, y = (p, M, k) => {
323
+ L(M), l.components.push({
227
324
  kind: "rect",
228
- leftMm: p.leftMm,
229
- topMm: $,
230
- widthMm: p.widthMm,
231
- heightMm: b.heightMm,
232
- grid: b.grid,
233
- nid: d("listr"),
234
- style: R.borderStyle
235
- }), $ += b.heightMm;
325
+ leftMm: b.leftMm,
326
+ topMm: u,
327
+ widthMm: b.widthMm,
328
+ heightMm: M,
329
+ grid: p,
330
+ nid: c(k),
331
+ style: $.borderStyle
332
+ }), u += M;
333
+ }, R = () => mt($, {}, s).heightMm, P = (p, M, k, v) => {
334
+ const B = [], lt = Math.max(1, Math.min(v, x.columns.length));
335
+ B.push({ text: p, colSpan: lt, style: { bold: !0, ...k } });
336
+ for (let et = lt; et < x.columns.length; et++) {
337
+ const Ct = x.columns[et];
338
+ B.push({ text: M.get(Ct.field) ?? "", style: k });
339
+ }
340
+ const vt = $.fontSizePt * Q * 25.4 / 72, dt = Math.max($.rowHeightFloorMm, vt + $.paddingMm * 2);
341
+ return { grid: { cells: [B], rowHeightsMm: [dt] }, heightMm: dt };
342
+ }, D = (p, M) => {
343
+ let k = 0;
344
+ for (const v of p) {
345
+ const B = typeof v[M] == "number" ? v[M] : Number(v[M]);
346
+ Number.isFinite(B) && (k += B);
347
+ }
348
+ return k;
349
+ }, U = (p, M) => {
350
+ const k = x.columns.find((v) => v.field === M);
351
+ return Mt(D(p, M), k?.format ?? { kind: "number", thousands: !0 });
352
+ }, z = x.groupBy, kt = typeof x.grandTotal == "object" && x.grandTotal.fields || z?.subtotal || [], ot = x.columns.findIndex((p) => kt.includes(p.field)), st = ot > 0 ? ot : 1, Y = [];
353
+ if (z) {
354
+ let p = null, M = [];
355
+ const k = () => {
356
+ if (M.length === 0) return;
357
+ const v = nt(M[0][z.field]);
358
+ Y.push({
359
+ kind: "groupHeader",
360
+ label: (z.headerTemplate ?? "{value}").replace(/\{value\}/g, v)
361
+ });
362
+ for (const B of M) Y.push({ kind: "row", row: B });
363
+ z.subtotal && z.subtotal.length > 0 && Y.push({
364
+ kind: "subtotal",
365
+ label: z.subtotalLabel ?? "小计",
366
+ rows: M
367
+ });
368
+ };
369
+ for (const v of S) {
370
+ const B = nt(v[z.field]);
371
+ p === null && (p = B), B !== p && (k(), M = [], p = B), M.push(v);
372
+ }
373
+ k();
374
+ } else
375
+ for (const p of S) Y.push({ kind: "row", row: p });
376
+ const at = R();
377
+ for (const p of Y)
378
+ if (p.kind === "row") {
379
+ const M = mt($, p.row, s);
380
+ y(M.grid, M.heightMm, "listr");
381
+ } else if (p.kind === "groupHeader") {
382
+ const M = P(
383
+ p.label,
384
+ /* @__PURE__ */ new Map(),
385
+ z?.headerStyle ?? {},
386
+ x.columns.length
387
+ );
388
+ z?.keepWithNext !== !1 && u + M.heightMm + at > f() && L(M.heightMm + at), y(M.grid, M.heightMm, "listg");
389
+ } else if (p.kind === "subtotal") {
390
+ const M = /* @__PURE__ */ new Map();
391
+ for (const v of z.subtotal ?? []) M.set(v, U(p.rows, v));
392
+ const k = P(
393
+ p.label,
394
+ M,
395
+ z?.subtotalStyle ?? {},
396
+ st
397
+ );
398
+ y(k.grid, k.heightMm, "listst");
399
+ }
400
+ if (x.grandTotal) {
401
+ const p = typeof x.grandTotal == "object" ? x.grandTotal : void 0, M = p?.fields ?? z?.subtotal ?? [];
402
+ if (M.length > 0) {
403
+ const k = /* @__PURE__ */ new Map();
404
+ for (const B of M) k.set(B, U(S, B));
405
+ const v = P(
406
+ p?.label ?? "合计",
407
+ k,
408
+ p?.style ?? {},
409
+ st
410
+ );
411
+ y(v.grid, v.heightMm, "listgt");
412
+ } else
413
+ a.push(`列表 ${b.id ?? ""} 配置了 grandTotal 但未提供合计字段(groupBy.subtotal 或 grandTotal.fields)`);
236
414
  }
237
415
  }
238
- g();
416
+ E();
417
+ }
418
+ for (const g of h) {
419
+ const l = g.text;
420
+ typeof l == "string" && l.includes("{totalPages}") && (g.text = l.replace(/\{totalPages\}/g, String(o.length)));
239
421
  }
240
422
  return {
241
- plan: { schemaVersion: se, pages: o },
423
+ plan: { schemaVersion: Pt, pages: o },
242
424
  warnings: a
243
425
  };
244
426
  }
245
- const Te = {
427
+ const jt = {
246
428
  root: "mr-root",
247
429
  page: "mr-page",
248
430
  comp: "mr-comp",
@@ -259,526 +441,526 @@ const Te = {
259
441
  cell: "mr-cell",
260
442
  unknown: "mr-unknown"
261
443
  };
262
- function C(e, n) {
263
- return n?.classNames?.[e] ?? Te[e];
444
+ function F(t, e) {
445
+ return e?.classNames?.[t] ?? jt[t];
264
446
  }
265
- class H {
447
+ class _ {
266
448
  constructor() {
267
449
  this.props = [];
268
450
  }
269
- add(n, i) {
270
- return i == null || i === !1 || i === "" ? this : (this.props.push([n, String(i)]), this);
451
+ add(e, r) {
452
+ return r == null || r === !1 || r === "" ? this : (this.props.push([e, String(r)]), this);
271
453
  }
272
- mm(n, i, t, r = 2) {
273
- return this.add(n, `${_(de(i, t), r)}px`);
454
+ mm(e, r, n, i = 2) {
455
+ return this.add(e, `${G(Et(r, n), i)}px`);
274
456
  }
275
457
  toString() {
276
- let n = "";
277
- for (const [i, t] of this.props)
278
- n += `${i}:${t};`;
279
- return n;
280
- }
281
- applyTo(n) {
282
- const i = this.toString();
283
- i && (n.style.cssText = i);
284
- }
285
- }
286
- function te(e, n, i) {
287
- const t = n.style || {};
288
- e.add("color", t.color).add("background-color", t.backgroundColor).add("font-family", t.fontFamily).add("font-weight", t.bold ? "700" : void 0).add("font-style", t.italic ? "italic" : void 0).add("text-decoration", t.underline ? "underline" : void 0).add("letter-spacing", t.letterSpacing != null ? `${t.letterSpacing}pt` : void 0).add("opacity", t.opacity != null ? String(t.opacity) : void 0).add("transform", t.rotateDeg ? `rotate(${t.rotateDeg}deg)` : void 0);
289
- const r = W(t, i);
290
- e.add("font-size", `${_(r.fontSizePx, 2)}px`);
291
- }
292
- function ve(e, n, i, t, r) {
293
- const s = r.createElement("table");
294
- if (s.className = C("grid", t), new H().add("width", "100%").add("height", "100%").add("border-collapse", "collapse").add("table-layout", e.colWidthsMm ? "fixed" : "auto").applyTo(s), e.colWidthsMm) {
295
- const d = r.createElement("colgroup");
296
- for (const h of e.colWidthsMm) {
297
- const c = r.createElement("col");
298
- new H().mm("width", h, i).applyTo(c), d.appendChild(c);
458
+ let e = "";
459
+ for (const [r, n] of this.props)
460
+ e += `${r}:${n};`;
461
+ return e;
462
+ }
463
+ applyTo(e) {
464
+ const r = this.toString();
465
+ r && (e.style.cssText = r);
466
+ }
467
+ }
468
+ function yt(t, e, r) {
469
+ const n = e.style || {};
470
+ t.add("color", n.color).add("background-color", n.backgroundColor).add("font-family", n.fontFamily).add("font-weight", n.bold ? "700" : void 0).add("font-style", n.italic ? "italic" : void 0).add("text-decoration", n.underline ? "underline" : void 0).add("letter-spacing", n.letterSpacing != null ? `${n.letterSpacing}pt` : void 0).add("opacity", n.opacity != null ? String(n.opacity) : void 0).add("transform", n.rotateDeg ? `rotate(${n.rotateDeg}deg)` : void 0);
471
+ const i = V(n, r);
472
+ t.add("font-size", `${G(i.fontSizePx, 2)}px`);
473
+ }
474
+ function Ot(t, e, r, n, i) {
475
+ const s = i.createElement("table");
476
+ if (s.className = F("grid", n), new _().add("width", "100%").add("height", "100%").add("border-collapse", "collapse").add("table-layout", t.colWidthsMm ? "fixed" : "auto").applyTo(s), t.colWidthsMm) {
477
+ const c = i.createElement("colgroup");
478
+ for (const h of t.colWidthsMm) {
479
+ const g = i.createElement("col");
480
+ new _().mm("width", h, r).applyTo(g), c.appendChild(g);
299
481
  }
300
- s.appendChild(d);
301
- }
302
- const a = V(n.style), o = F(n.style), l = a.inner ? `${_(o.widthPt * i / 72, 2)}px solid ${o.color}` : "";
303
- return e.cells.forEach((d, h) => {
304
- const c = r.createElement("tr");
305
- c.className = C("row", t), e.rowHeightsMm?.[h] != null && new H().mm("height", e.rowHeightsMm[h], i).applyTo(c), (d || []).forEach((m) => {
306
- const u = r.createElement("td");
307
- u.className = C("cell", t), m?.colSpan && (u.colSpan = m.colSpan), m?.rowSpan && (u.rowSpan = m.rowSpan);
308
- const g = new H();
309
- if (l && g.add("border", l), m?.style) {
310
- const M = m.style;
311
- g.add("text-align", M.align).add("vertical-align", M.verticalAlign).add("background-color", M.backgroundColor).add("color", M.color).add("font-weight", M.bold ? "700" : void 0), g.add("font-size", `${_(W(M, i).fontSizePx, 2)}px`);
482
+ s.appendChild(c);
483
+ }
484
+ const a = tt(e.style), o = O(e.style), d = a.inner ? `${G(o.widthPt * r / 72, 2)}px solid ${o.color}` : "";
485
+ return t.cells.forEach((c, h) => {
486
+ const g = i.createElement("tr");
487
+ g.className = F("row", n), t.rowHeightsMm?.[h] != null && new _().mm("height", t.rowHeightsMm[h], r).applyTo(g), (c || []).forEach((l) => {
488
+ const f = i.createElement("td");
489
+ f.className = F("cell", n), l?.colSpan && (f.colSpan = l.colSpan), l?.rowSpan && (f.rowSpan = l.rowSpan);
490
+ const m = new _();
491
+ if (d && m.add("border", d), l?.style) {
492
+ const w = l.style;
493
+ m.add("text-align", w.align).add("vertical-align", w.verticalAlign).add("background-color", w.backgroundColor).add("color", w.color).add("font-weight", w.bold ? "700" : void 0), m.add("font-size", `${G(V(w, r).fontSizePx, 2)}px`);
312
494
  }
313
- if (g.applyTo(u), m?.text != null && (u.textContent = m.text), m?.children?.length)
314
- for (const M of m.children)
315
- u.appendChild(ne(M, i, t, r));
316
- c.appendChild(u);
317
- }), s.appendChild(c);
495
+ if (m.applyTo(f), l?.text != null && (f.textContent = l.text), l?.children?.length)
496
+ for (const w of l.children)
497
+ f.appendChild(wt(w, r, n, i));
498
+ g.appendChild(f);
499
+ }), s.appendChild(g);
318
500
  }), s;
319
501
  }
320
- function Ce(e, n, i, t) {
321
- const r = t.createElement("div");
322
- r.className = C("text", i);
323
- const s = e.style || {}, a = new H().add("text-align", s.align).add("display", "flex").add("flex-direction", "column").add(
502
+ function Gt(t, e, r, n) {
503
+ const i = n.createElement("div");
504
+ i.className = F("text", r);
505
+ const s = t.style || {}, a = new _().add("text-align", s.align).add("display", "flex").add("flex-direction", "column").add(
324
506
  "justify-content",
325
507
  s.verticalAlign === "middle" ? "center" : s.verticalAlign === "bottom" ? "flex-end" : "flex-start"
326
508
  ).add("overflow", "hidden");
327
- if (te(a, e, n), a.applyTo(r), Z(e)) {
328
- const o = t.createElement("div");
329
- o.className = C("rich", i);
330
- for (const l of e.richParagraphs) {
331
- const d = t.createElement("div");
332
- d.className = C("paragraph", i), new H().add("text-align", l.align).add("line-height", l.lineHeight != null ? String(l.lineHeight) : void 0).mm("margin-top", l.spaceBeforeMm ?? 0, n).mm("margin-bottom", l.spaceAfterMm ?? 0, n).mm("text-indent", l.indentMm ?? 0, n).applyTo(d);
333
- for (const c of l.segments || []) {
334
- const m = t.createElement("span");
335
- if (m.className = C("segment", i), m.textContent = c.kind === "field" ? c.field ?? "" : c.text ?? "", c.style) {
336
- const u = new H().add("color", c.style.color).add("font-weight", c.style.bold ? "700" : void 0);
337
- u.add("font-size", `${_(W(c.style, n).fontSizePx, 2)}px`), u.applyTo(m);
509
+ if (yt(a, t, e), a.applyTo(i), ut(t)) {
510
+ const o = n.createElement("div");
511
+ o.className = F("rich", r);
512
+ for (const d of t.richParagraphs) {
513
+ const c = n.createElement("div");
514
+ c.className = F("paragraph", r), new _().add("text-align", d.align).add("line-height", d.lineHeight != null ? String(d.lineHeight) : void 0).mm("margin-top", d.spaceBeforeMm ?? 0, e).mm("margin-bottom", d.spaceAfterMm ?? 0, e).mm("text-indent", d.indentMm ?? 0, e).applyTo(c);
515
+ for (const g of d.segments || []) {
516
+ const l = n.createElement("span");
517
+ if (l.className = F("segment", r), l.textContent = g.kind === "field" ? g.field ?? "" : g.text ?? "", g.style) {
518
+ const f = new _().add("color", g.style.color).add("font-weight", g.style.bold ? "700" : void 0);
519
+ f.add("font-size", `${G(V(g.style, e).fontSizePx, 2)}px`), f.applyTo(l);
338
520
  }
339
- d.appendChild(m);
521
+ c.appendChild(l);
340
522
  }
341
- o.appendChild(d);
523
+ o.appendChild(c);
342
524
  }
343
- return r.appendChild(o), r;
344
- }
345
- if (Array.isArray(e.lines) && e.lines.length > 0) {
346
- const o = t.createElement("div");
347
- o.className = C("lines", i), s.lineHeight != null && new H().add("line-height", String(s.lineHeight)).applyTo(o);
348
- for (const l of e.lines) {
349
- const d = t.createElement("div");
350
- d.className = C("line", i), d.textContent = l, o.appendChild(d);
525
+ return i.appendChild(o), i;
526
+ }
527
+ if (Array.isArray(t.lines) && t.lines.length > 0) {
528
+ const o = n.createElement("div");
529
+ o.className = F("lines", r), s.lineHeight != null && new _().add("line-height", String(s.lineHeight)).applyTo(o);
530
+ for (const d of t.lines) {
531
+ const c = n.createElement("div");
532
+ c.className = F("line", r), c.textContent = d, o.appendChild(c);
351
533
  }
352
- return r.appendChild(o), r;
353
- }
354
- return r.textContent = e.text ?? "", r;
355
- }
356
- function ke(e, n, i) {
357
- const t = i.createElement("img");
358
- return t.className = C("image", n), t.src = e.imageData, new H().add("width", "100%").add("height", "100%").add("object-fit", "contain").add("display", "block").applyTo(t), t.alt = e.kind, t;
359
- }
360
- function X(e, n, i, t) {
361
- const r = t.createElement("div");
362
- r.className = C("shape", i);
363
- const s = e.style || {}, a = F(s), o = V(s), l = `${_(a.widthPt * n / 72, 2)}px solid ${a.color}`, d = new H();
364
- return e.grid || e.kind === "rect" ? (o.top && d.add("border-top", l), o.right && d.add("border-right", l), o.bottom && d.add("border-bottom", l), o.left && d.add("border-left", l)) : e.kind === "ellipse" ? (o.inner && d.add("border", l).add("border-radius", "50%"), s.backgroundColor && d.add("background-color", s.backgroundColor)) : e.kind === "line" && d.add("height", "0").add("border-top", l), d.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), d.applyTo(r), r;
365
- }
366
- function ne(e, n, i, t) {
367
- const r = t.createElement("div");
368
- r.className = `${C("comp", i)} mr-kind-${e.kind}`;
369
- const s = new H().add("position", "absolute").mm("left", e.leftMm, n).mm("top", e.topMm, n).mm("width", e.widthMm, n).mm("height", e.heightMm, n).add("box-sizing", "border-box");
370
- if (te(s, e, n), s.applyTo(r), le(e))
371
- return r.appendChild(ke(e, i, t)), r;
372
- if (e.kind === "text")
373
- return r.appendChild(Ce(e, n, i, t)), r;
374
- if (e.grid) {
375
- const o = X(e, n, i, t);
376
- return o.appendChild(ve(e.grid, e, n, i, t)), r.appendChild(o), r;
377
- }
378
- if (e.kind === "line" || e.kind === "rect" || e.kind === "ellipse" || e.kind === "chart")
379
- return r.appendChild(X(e, n, i, t)), r;
380
- const a = t.createElement("div");
381
- return a.className = C("unknown", i), a.textContent = e.fallbackText ?? "", r.appendChild(a), r;
382
- }
383
- function xe(e, n, i, t) {
384
- const r = t.createElement("div");
385
- r.className = C("page", i), new H().add("position", "relative").mm("width", e.pageWidthMm, n).mm("height", e.pageHeightMm, n).add("background-color", "#fff").add("overflow", "hidden").add("box-sizing", "border-box").applyTo(r);
386
- for (const s of e.components)
387
- r.appendChild(ne(s, n, i, t));
388
- return r;
389
- }
390
- function Ie(e, n, i = {}) {
391
- const t = i.dpi ?? 96, r = n.createElement("div");
392
- return r.className = C("root", i), r.dataset.schemaVersion = e.schemaVersion, e.pages.forEach((s) => {
393
- r.appendChild(xe(s, t, i, n));
394
- }), r;
395
- }
396
- function Pe(e) {
397
- const { pageHeightsPx: n, viewportHeightPx: i, scrollTopPx: t, overscan: r = 1, gapPx: s = 0 } = e, a = n.length;
534
+ return i.appendChild(o), i;
535
+ }
536
+ return i.textContent = t.text ?? "", i;
537
+ }
538
+ function Vt(t, e, r) {
539
+ const n = r.createElement("img");
540
+ return n.className = F("image", e), n.src = t.imageData, new _().add("width", "100%").add("height", "100%").add("object-fit", "contain").add("display", "block").applyTo(n), n.alt = t.kind, n;
541
+ }
542
+ function ft(t, e, r, n) {
543
+ const i = n.createElement("div");
544
+ i.className = F("shape", r);
545
+ const s = t.style || {}, a = O(s), o = tt(s), d = `${G(a.widthPt * e / 72, 2)}px solid ${a.color}`, c = new _();
546
+ return t.grid || t.kind === "rect" ? (o.top && c.add("border-top", d), o.right && c.add("border-right", d), o.bottom && c.add("border-bottom", d), o.left && c.add("border-left", d)) : t.kind === "ellipse" ? (o.inner && c.add("border", d).add("border-radius", "50%"), s.backgroundColor && c.add("background-color", s.backgroundColor)) : t.kind === "line" && c.add("height", "0").add("border-top", d), c.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), c.applyTo(i), i;
547
+ }
548
+ function wt(t, e, r, n) {
549
+ const i = n.createElement("div");
550
+ i.className = `${F("comp", r)} mr-kind-${t.kind}`;
551
+ const s = new _().add("position", "absolute").mm("left", t.leftMm, e).mm("top", t.topMm, e).mm("width", t.widthMm, e).mm("height", t.heightMm, e).add("box-sizing", "border-box");
552
+ if (yt(s, t, e), s.applyTo(i), At(t))
553
+ return i.appendChild(Vt(t, r, n)), i;
554
+ if (t.kind === "text")
555
+ return i.appendChild(Gt(t, e, r, n)), i;
556
+ if (t.grid) {
557
+ const o = ft(t, e, r, n);
558
+ return o.appendChild(Ot(t.grid, t, e, r, n)), i.appendChild(o), i;
559
+ }
560
+ if (t.kind === "line" || t.kind === "rect" || t.kind === "ellipse" || t.kind === "chart")
561
+ return i.appendChild(ft(t, e, r, n)), i;
562
+ const a = n.createElement("div");
563
+ return a.className = F("unknown", r), a.textContent = t.fallbackText ?? "", i.appendChild(a), i;
564
+ }
565
+ function Yt(t, e, r, n) {
566
+ const i = n.createElement("div");
567
+ i.className = F("page", r), new _().add("position", "relative").mm("width", t.pageWidthMm, e).mm("height", t.pageHeightMm, e).add("background-color", "#fff").add("overflow", "hidden").add("box-sizing", "border-box").applyTo(i);
568
+ for (const s of t.components)
569
+ i.appendChild(wt(s, e, r, n));
570
+ return i;
571
+ }
572
+ function ae(t, e, r = {}) {
573
+ const n = r.dpi ?? 96, i = e.createElement("div");
574
+ return i.className = F("root", r), i.dataset.schemaVersion = t.schemaVersion, t.pages.forEach((s) => {
575
+ i.appendChild(Yt(s, n, r, e));
576
+ }), i;
577
+ }
578
+ function Jt(t) {
579
+ const { pageHeightsPx: e, viewportHeightPx: r, scrollTopPx: n, overscan: i = 1, gapPx: s = 0 } = t, a = e.length;
398
580
  if (a === 0)
399
581
  return { start: 0, end: -1, padTopPx: 0, padBottomPx: 0 };
400
- const o = Math.max(0, s), l = new Array(a + 1);
401
- l[0] = 0;
402
- for (let w = 0; w < a; w++)
403
- l[w + 1] = l[w] + Math.max(0, n[w] ?? 0) + o;
404
- const d = l[a], h = Math.max(0, t);
405
- let c = 0, m = 0, u = a - 1;
406
- for (; m <= u; ) {
407
- const w = m + u >> 1;
408
- l[w] <= h ? (c = w, m = w + 1) : u = w - 1;
409
- }
410
- const g = Math.max(0, Math.min(a - 1, c - r)), M = l[c] + Math.max(0, i);
411
- let p = a - 1;
412
- for (m = 0, u = a - 1; m <= u; ) {
413
- const w = m + u >> 1;
414
- l[w + 1] < M ? m = w + 1 : (p = w, u = w - 1);
415
- }
416
- const k = Math.min(a - 1, p + r), T = l[g], E = Math.max(0, d - l[k + 1]);
417
- return { start: g, end: k, padTopPx: T, padBottomPx: E };
418
- }
419
- const U = 96 / 25.4;
420
- function ie(e, n = 96) {
421
- const i = n / 96 * U;
582
+ const o = Math.max(0, s), d = new Array(a + 1);
583
+ d[0] = 0;
584
+ for (let S = 0; S < a; S++)
585
+ d[S + 1] = d[S] + Math.max(0, e[S] ?? 0) + o;
586
+ const c = d[a], h = Math.max(0, n);
587
+ let g = 0, l = 0, f = a - 1;
588
+ for (; l <= f; ) {
589
+ const S = l + f >> 1;
590
+ d[S] <= h ? (g = S, l = S + 1) : f = S - 1;
591
+ }
592
+ const m = Math.max(0, Math.min(a - 1, g - i)), w = d[g] + Math.max(0, r);
593
+ let E = a - 1;
594
+ for (l = 0, f = a - 1; l <= f; ) {
595
+ const S = l + f >> 1;
596
+ d[S + 1] < w ? l = S + 1 : (E = S, f = S - 1);
597
+ }
598
+ const T = Math.min(a - 1, E + i), b = d[m], C = Math.max(0, c - d[T + 1]);
599
+ return { start: m, end: T, padTopPx: b, padBottomPx: C };
600
+ }
601
+ const it = 96 / 25.4;
602
+ function St(t, e = 96) {
603
+ const r = e / 96 * it;
422
604
  return {
423
- widthPx: Math.max(1, Math.round(e.pageWidthMm * i)),
424
- heightPx: Math.max(1, Math.round(e.pageHeightMm * i))
605
+ widthPx: Math.max(1, Math.round(t.pageWidthMm * r)),
606
+ heightPx: Math.max(1, Math.round(t.pageHeightMm * r))
425
607
  };
426
608
  }
427
- function Ae(e, n, i) {
428
- const t = document.createElement("canvas"), { widthPx: r, heightPx: s } = ie(e, i);
429
- t.width = Math.round(r * n), t.height = Math.round(s * n), t.style.width = `${r}px`, t.style.height = `${s}px`;
430
- const a = t.getContext("2d");
609
+ function qt(t, e, r) {
610
+ const n = document.createElement("canvas"), { widthPx: i, heightPx: s } = St(t, r);
611
+ n.width = Math.round(i * e), n.height = Math.round(s * e), n.style.width = `${i}px`, n.style.height = `${s}px`;
612
+ const a = n.getContext("2d");
431
613
  if (!a)
432
614
  throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");
433
- return a.scale(n, n), a.fillStyle = "#ffffff", a.fillRect(0, 0, r, s), { canvas: t, ctx: a };
434
- }
435
- function De(e, n = 96) {
436
- return W(e, n).fontSizePx;
437
- }
438
- function re(e, n, i, t, r, s, a, o = "top") {
439
- e.font = `${n.bold ? "bold " : ""}${n.fontSizePx}px ${a}`, e.fillStyle = n.color, e.textBaseline = "alphabetic";
440
- const l = n.fontSizePx * n.lineHeight, d = n.text === "" ? [""] : n.text.split(`
441
- `), h = d.length * l;
442
- let c = t;
443
- o === "middle" ? c = t + (s - h) / 2 : o === "bottom" && (c = t + s - h), d.forEach((m, u) => {
444
- e.textAlign = n.align === "center" ? "center" : n.align === "right" ? "right" : "left";
445
- const g = n.align === "center" ? i + r / 2 : n.align === "right" ? i + r : i;
446
- e.fillText(m, g, c + u * l + n.fontSizePx * 0.8, r);
447
- }), e.textAlign = "left";
448
- }
449
- function Ee(e, n, i, t, r, s, a, o, l, d, h) {
450
- const c = ce(n, s / o, a / o), m = V(i.style), u = F(i.style);
451
- for (const g of c.cells) {
452
- const M = g.cell.style?.backgroundColor;
453
- M && (e.fillStyle = M, e.fillRect(
454
- t + g.xMm * o,
455
- r + g.yMm * o,
456
- g.widthMm * o,
457
- g.heightMm * o
615
+ return a.scale(e, e), a.fillStyle = "#ffffff", a.fillRect(0, 0, i, s), { canvas: n, ctx: a };
616
+ }
617
+ function le(t, e = 96) {
618
+ return V(t, e).fontSizePx;
619
+ }
620
+ function Tt(t, e, r, n, i, s, a, o = "top") {
621
+ t.font = `${e.bold ? "bold " : ""}${e.fontSizePx}px ${a}`, t.fillStyle = e.color, t.textBaseline = "alphabetic";
622
+ const d = e.fontSizePx * e.lineHeight, c = e.text === "" ? [""] : e.text.split(`
623
+ `), h = c.length * d;
624
+ let g = n;
625
+ o === "middle" ? g = n + (s - h) / 2 : o === "bottom" && (g = n + s - h), c.forEach((l, f) => {
626
+ t.textAlign = e.align === "center" ? "center" : e.align === "right" ? "right" : "left";
627
+ const m = e.align === "center" ? r + i / 2 : e.align === "right" ? r + i : r;
628
+ t.fillText(l, m, g + f * d + e.fontSizePx * 0.8, i);
629
+ }), t.textAlign = "left";
630
+ }
631
+ function Ut(t, e, r, n, i, s, a, o, d, c, h) {
632
+ const g = Rt(e, s / o, a / o), l = tt(r.style), f = O(r.style);
633
+ for (const m of g.cells) {
634
+ const w = m.cell.style?.backgroundColor;
635
+ w && (t.fillStyle = w, t.fillRect(
636
+ n + m.xMm * o,
637
+ i + m.yMm * o,
638
+ m.widthMm * o,
639
+ m.heightMm * o
458
640
  ));
459
641
  }
460
- if (m.inner) {
461
- e.strokeStyle = u.color, e.lineWidth = O(u.widthPt, l);
462
- for (const g of c.edges)
463
- e.beginPath(), g.kind === "v" ? (e.moveTo(t + g.pos * o, r + g.from * o), e.lineTo(t + g.pos * o, r + g.to * o)) : (e.moveTo(t + g.from * o, r + g.pos * o), e.lineTo(t + g.to * o, r + g.pos * o)), e.stroke();
464
- e.beginPath(), m.top && (e.moveTo(t, r), e.lineTo(t + s, r)), m.right && (e.moveTo(t + s, r), e.lineTo(t + s, r + a)), m.bottom && (e.moveTo(t + s, r + a), e.lineTo(t, r + a)), m.left && (e.moveTo(t, r + a), e.lineTo(t, r)), e.stroke();
465
- }
466
- for (const g of c.cells) {
467
- const M = typeof g.cell.text == "string" ? g.cell.text : "";
468
- if (!M) continue;
469
- const p = g.cell.style, k = p?.fontSize ?? j, T = G(
470
- M,
471
- g.widthMm - 1,
472
- { fontSizePt: k },
642
+ if (l.inner) {
643
+ t.strokeStyle = f.color, t.lineWidth = K(f.widthPt, d);
644
+ for (const m of g.edges)
645
+ t.beginPath(), m.kind === "v" ? (t.moveTo(n + m.pos * o, i + m.from * o), t.lineTo(n + m.pos * o, i + m.to * o)) : (t.moveTo(n + m.from * o, i + m.pos * o), t.lineTo(n + m.to * o, i + m.pos * o)), t.stroke();
646
+ t.beginPath(), l.top && (t.moveTo(n, i), t.lineTo(n + s, i)), l.right && (t.moveTo(n + s, i), t.lineTo(n + s, i + a)), l.bottom && (t.moveTo(n + s, i + a), t.lineTo(n, i + a)), l.left && (t.moveTo(n, i + a), t.lineTo(n, i)), t.stroke();
647
+ }
648
+ for (const m of g.cells) {
649
+ const w = typeof m.cell.text == "string" ? m.cell.text : "";
650
+ if (!w) continue;
651
+ const E = m.cell.style, T = E?.fontSize ?? X, b = Z(
652
+ w,
653
+ m.widthMm - 1,
654
+ { fontSizePt: T },
473
655
  h
474
656
  ).join(`
475
657
  `);
476
- re(
477
- e,
658
+ Tt(
659
+ t,
478
660
  {
479
- text: T,
480
- fontSizePx: W(p, l).fontSizePx,
481
- bold: p?.bold ?? !1,
482
- color: p?.color ?? Q(i.style, me),
483
- align: p?.align ?? "left",
484
- lineHeight: q
661
+ text: b,
662
+ fontSizePx: V(E, d).fontSizePx,
663
+ bold: E?.bold ?? !1,
664
+ color: E?.color ?? pt(r.style, Ht),
665
+ align: E?.align ?? "left",
666
+ lineHeight: Q
485
667
  },
486
- t + (g.xMm + 0.5) * o,
487
- r + g.yMm * o,
488
- Math.max(0, (g.widthMm - 1) * o),
489
- g.heightMm * o,
490
- d,
491
- p?.verticalAlign ?? "middle"
668
+ n + (m.xMm + 0.5) * o,
669
+ i + m.yMm * o,
670
+ Math.max(0, (m.widthMm - 1) * o),
671
+ m.heightMm * o,
672
+ c,
673
+ E?.verticalAlign ?? "middle"
492
674
  );
493
675
  }
494
676
  }
495
- function oe(e, n, i, t, r, s) {
496
- const a = n.leftMm * i, o = n.topMm * i, l = n.widthMm * i, d = n.heightMm * i, h = n.style ?? {};
497
- if (n.grid) {
498
- Ee(e, n.grid, n, a, o, l, d, i, t, r, s);
677
+ function xt(t, e, r, n, i, s) {
678
+ const a = e.leftMm * r, o = e.topMm * r, d = e.widthMm * r, c = e.heightMm * r, h = e.style ?? {};
679
+ if (e.grid) {
680
+ Ut(t, e.grid, e, a, o, d, c, r, n, i, s);
499
681
  return;
500
682
  }
501
- switch (n.kind) {
683
+ switch (e.kind) {
502
684
  case "text": {
503
- const c = h.fontSize ?? j, m = Z(n) ? n.richParagraphs.map((u) => (u.segments ?? []).map((g) => g.text ?? g.field ?? "").join("")).join(`
504
- `) : Array.isArray(n.lines) && n.lines.length > 0 ? n.lines.join(`
505
- `) : G(n.text ?? "", n.widthMm, { fontSizePt: c }, s).join(`
685
+ const g = h.fontSize ?? X, l = ut(e) ? e.richParagraphs.map((f) => (f.segments ?? []).map((m) => m.text ?? m.field ?? "").join("")).join(`
686
+ `) : Array.isArray(e.lines) && e.lines.length > 0 ? e.lines.join(`
687
+ `) : Z(e.text ?? "", e.widthMm, { fontSizePt: g }, s).join(`
506
688
  `);
507
- re(
508
- e,
689
+ Tt(
690
+ t,
509
691
  {
510
- text: m,
511
- fontSizePx: W(h, t).fontSizePx,
692
+ text: l,
693
+ fontSizePx: V(h, n).fontSizePx,
512
694
  bold: h.bold ?? !1,
513
- color: Q(h),
695
+ color: pt(h),
514
696
  align: h.align ?? "left",
515
- lineHeight: he(h)
697
+ lineHeight: $t(h)
516
698
  },
517
699
  a,
518
700
  o,
519
- l,
520
701
  d,
521
- r,
702
+ c,
703
+ i,
522
704
  h.verticalAlign
523
705
  );
524
706
  break;
525
707
  }
526
708
  case "rect": {
527
- const c = F(h), m = V(h);
528
- h.backgroundColor && (e.fillStyle = h.backgroundColor, e.fillRect(a, o, l, d)), m.inner && (e.strokeStyle = c.color, e.lineWidth = O(c.widthPt, t), e.beginPath(), m.top && (e.moveTo(a, o), e.lineTo(a + l, o)), m.right && (e.moveTo(a + l, o), e.lineTo(a + l, o + d)), m.bottom && (e.moveTo(a + l, o + d), e.lineTo(a, o + d)), m.left && (e.moveTo(a, o + d), e.lineTo(a, o)), e.stroke());
709
+ const g = O(h), l = tt(h);
710
+ h.backgroundColor && (t.fillStyle = h.backgroundColor, t.fillRect(a, o, d, c)), l.inner && (t.strokeStyle = g.color, t.lineWidth = K(g.widthPt, n), t.beginPath(), l.top && (t.moveTo(a, o), t.lineTo(a + d, o)), l.right && (t.moveTo(a + d, o), t.lineTo(a + d, o + c)), l.bottom && (t.moveTo(a + d, o + c), t.lineTo(a, o + c)), l.left && (t.moveTo(a, o + c), t.lineTo(a, o)), t.stroke());
529
711
  break;
530
712
  }
531
713
  case "line": {
532
- const c = F({ ...h, borderColor: h.lineColor ?? h.borderColor });
533
- e.strokeStyle = c.color, e.lineWidth = O(c.widthPt, t), e.beginPath(), e.moveTo(a, o + d / 2), e.lineTo(a + l, o + d / 2), e.stroke();
714
+ const g = O({ ...h, borderColor: h.lineColor ?? h.borderColor });
715
+ t.strokeStyle = g.color, t.lineWidth = K(g.widthPt, n), t.beginPath(), t.moveTo(a, o + c / 2), t.lineTo(a + d, o + c / 2), t.stroke();
534
716
  break;
535
717
  }
536
718
  case "ellipse": {
537
- const c = F(h);
538
- e.strokeStyle = c.color, e.lineWidth = O(c.widthPt, t), h.backgroundColor && (e.fillStyle = h.backgroundColor, e.beginPath(), e.ellipse(a + l / 2, o + d / 2, l / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(a + l / 2, o + d / 2, l / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
719
+ const g = O(h);
720
+ t.strokeStyle = g.color, t.lineWidth = K(g.widthPt, n), h.backgroundColor && (t.fillStyle = h.backgroundColor, t.beginPath(), t.ellipse(a + d / 2, o + c / 2, d / 2, c / 2, 0, 0, Math.PI * 2), t.fill()), t.beginPath(), t.ellipse(a + d / 2, o + c / 2, d / 2, c / 2, 0, 0, Math.PI * 2), t.stroke();
539
721
  break;
540
722
  }
541
723
  }
542
724
  }
543
- function Oe(e, n = {}) {
725
+ function de(t, e = {}) {
544
726
  if (typeof document > "u")
545
727
  throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");
546
- const i = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), t = n.dpi ?? 96, r = t / 96 * U, s = n.fontFamily ?? '"Microsoft YaHei", sans-serif', a = n.measurer ?? J, o = Math.max(0, n.start ?? 0), l = Math.min(e.pages.length - 1, n.end ?? e.pages.length - 1), d = [];
547
- for (let h = o; h <= l; h++) {
548
- const c = e.pages[h], { canvas: m, ctx: u } = Ae(c, i, t);
549
- for (const g of c.components)
550
- oe(u, g, r, t, s, a);
551
- d.push(m);
552
- }
553
- return { canvases: d };
554
- }
555
- function je(e, n = {}) {
556
- const i = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), t = n.dpi ?? 96, r = t / 96 * U, s = n.fontFamily ?? '"Microsoft YaHei", sans-serif', a = n.measurer ?? J, o = n.overscan ?? 1, l = n.gapPx ?? 18, d = n.pagesPerFrame ?? 1, h = e.pages.map((f) => f.pageHeightMm * r), c = Math.max(1, ...e.pages.map((f) => f.pageWidthMm * r)), m = { start: 0, end: -1 };
557
- let u = null, g = null, M = null, p = null, k = [], T = 0, E = [];
558
- function w() {
559
- const f = u;
560
- f.innerHTML = "", g = document.createElement("div"), g.style.cssText = `width:${c}px;margin:0 auto;`, M = document.createElement("div"), p = document.createElement("div"), g.appendChild(M), k = [];
561
- const b = Math.min(e.pages.length, 3 + o * 2);
562
- for (let P = 0; P < b; P++) {
728
+ const r = e.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), n = e.dpi ?? 96, i = n / 96 * it, s = e.fontFamily ?? '"Microsoft YaHei", sans-serif', a = e.measurer ?? rt, o = Math.max(0, e.start ?? 0), d = Math.min(t.pages.length - 1, e.end ?? t.pages.length - 1), c = [];
729
+ for (let h = o; h <= d; h++) {
730
+ const g = t.pages[h], { canvas: l, ctx: f } = qt(g, r, n);
731
+ for (const m of g.components)
732
+ xt(f, m, i, n, s, a);
733
+ c.push(l);
734
+ }
735
+ return { canvases: c };
736
+ }
737
+ function ce(t, e = {}) {
738
+ const r = e.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), n = e.dpi ?? 96, i = n / 96 * it, s = e.fontFamily ?? '"Microsoft YaHei", sans-serif', a = e.measurer ?? rt, o = e.overscan ?? 1, d = e.gapPx ?? 18, c = e.pagesPerFrame ?? 1, h = t.pages.map((u) => u.pageHeightMm * i), g = Math.max(1, ...t.pages.map((u) => u.pageWidthMm * i)), l = { start: 0, end: -1 };
739
+ let f = null, m = null, w = null, E = null, T = [], b = 0, C = [];
740
+ function S() {
741
+ const u = f;
742
+ u.innerHTML = "", m = document.createElement("div"), m.style.cssText = `width:${g}px;margin:0 auto;`, w = document.createElement("div"), E = document.createElement("div"), m.appendChild(w), T = [];
743
+ const H = Math.min(t.pages.length, 3 + o * 2);
744
+ for (let L = 0; L < H; L++) {
563
745
  const y = document.createElement("div");
564
- y.style.cssText = `margin:0 auto ${l}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, g.appendChild(y), k.push(y);
746
+ y.style.cssText = `margin:0 auto ${d}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, m.appendChild(y), T.push(y);
565
747
  }
566
- g.appendChild(p), f.appendChild(g);
567
- }
568
- function I(f, b) {
569
- const P = e.pages[b], { widthPx: y, heightPx: x } = ie(P, t);
570
- let A = f.firstElementChild;
571
- (!A || A.tagName !== "CANVAS") && (A = document.createElement("canvas"), f.innerHTML = "", f.appendChild(A)), A.width = Math.round(y * i), A.height = Math.round(x * i), A.style.width = `${y}px`, A.style.height = `${x}px`;
572
- const z = A.getContext("2d");
573
- if (z) {
574
- z.setTransform(1, 0, 0, 1, 0, 0), z.scale(i, i), z.fillStyle = "#ffffff", z.fillRect(0, 0, y, x);
575
- for (const ae of P.components)
576
- oe(z, ae, r, t, s, a);
577
- A.dataset.canvasPage = String(b), f.style.height = `${x}px`, f.style.width = `${y}px`;
748
+ m.appendChild(E), u.appendChild(m);
749
+ }
750
+ function J(u, H) {
751
+ const L = t.pages[H], { widthPx: y, heightPx: R } = St(L, n);
752
+ let P = u.firstElementChild;
753
+ (!P || P.tagName !== "CANVAS") && (P = document.createElement("canvas"), u.innerHTML = "", u.appendChild(P)), P.width = Math.round(y * r), P.height = Math.round(R * r), P.style.width = `${y}px`, P.style.height = `${R}px`;
754
+ const D = P.getContext("2d");
755
+ if (D) {
756
+ D.setTransform(1, 0, 0, 1, 0, 0), D.scale(r, r), D.fillStyle = "#ffffff", D.fillRect(0, 0, y, R);
757
+ for (const U of L.components)
758
+ xt(D, U, i, n, s, a);
759
+ P.dataset.canvasPage = String(H), u.style.height = `${R}px`, u.style.width = `${y}px`;
578
760
  }
579
761
  }
580
- function R(f) {
581
- m.start = f.start, m.end = f.end, M.style.height = `${f.start * l + h.slice(0, f.start).reduce((y, x) => y + x, 0)}px`;
582
- const b = e.pages.length - 1 - f.end;
583
- p.style.height = `${b * l + h.slice(f.end + 1).reduce((y, x) => y + x, 0)}px`;
584
- const P = f.end - f.start + 1;
585
- k.forEach((y, x) => {
586
- if (x < P) {
762
+ function q(u) {
763
+ l.start = u.start, l.end = u.end, w.style.height = `${u.start * d + h.slice(0, u.start).reduce((y, R) => y + R, 0)}px`;
764
+ const H = t.pages.length - 1 - u.end;
765
+ E.style.height = `${H * d + h.slice(u.end + 1).reduce((y, R) => y + R, 0)}px`;
766
+ const L = u.end - u.start + 1;
767
+ T.forEach((y, R) => {
768
+ if (R < L) {
587
769
  y.style.display = "";
588
- const A = f.start + x;
589
- y.style.height = `${h[A] ?? 0}px`;
770
+ const P = u.start + R;
771
+ y.style.height = `${h[P] ?? 0}px`;
590
772
  } else
591
773
  y.style.display = "none";
592
- }), E = [];
593
- for (let y = f.start; y <= f.end; y++) {
594
- const x = k[y - f.start];
595
- if (!x) continue;
596
- x.firstElementChild?.dataset?.canvasPage !== String(y) && E.push(y);
774
+ }), C = [];
775
+ for (let y = u.start; y <= u.end; y++) {
776
+ const R = T[y - u.start];
777
+ if (!R) continue;
778
+ R.firstElementChild?.dataset?.canvasPage !== String(y) && C.push(y);
597
779
  }
598
- D();
599
- }
600
- function D() {
601
- T || E.length === 0 || (T = requestAnimationFrame(() => {
602
- T = 0;
603
- let f = Math.max(1, d);
604
- for (; E.length > 0 && f-- > 0; ) {
605
- const b = E.shift(), P = k[b - m.start];
606
- P && I(P, b);
780
+ x();
781
+ }
782
+ function x() {
783
+ b || C.length === 0 || (b = requestAnimationFrame(() => {
784
+ b = 0;
785
+ let u = Math.max(1, c);
786
+ for (; C.length > 0 && u-- > 0; ) {
787
+ const H = C.shift(), L = T[H - l.start];
788
+ L && J(L, H);
607
789
  }
608
- E.length > 0 && D();
790
+ C.length > 0 && x();
609
791
  }));
610
792
  }
611
793
  function $() {
612
- T || (T = requestAnimationFrame(() => {
613
- T = 0;
614
- const f = u, b = Pe({
794
+ b || (b = requestAnimationFrame(() => {
795
+ b = 0;
796
+ const u = f, H = Jt({
615
797
  pageHeightsPx: h,
616
- viewportHeightPx: f.clientHeight,
617
- scrollTopPx: f.scrollTop,
798
+ viewportHeightPx: u.clientHeight,
799
+ scrollTopPx: u.scrollTop,
618
800
  overscan: o,
619
- gapPx: l
801
+ gapPx: d
620
802
  });
621
- b.start !== m.start || b.end !== m.end ? R(b) : D();
803
+ H.start !== l.start || H.end !== l.end ? q(H) : x();
622
804
  }));
623
805
  }
624
- let B = null;
806
+ let j = null;
625
807
  return {
626
- attach(f) {
808
+ attach(u) {
627
809
  if (typeof document > "u")
628
810
  throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");
629
- u = f, w(), f.addEventListener("scroll", $, { passive: !0 }), typeof ResizeObserver < "u" && (B = new ResizeObserver(() => $()), B.observe(f)), $();
811
+ f = u, S(), u.addEventListener("scroll", $, { passive: !0 }), typeof ResizeObserver < "u" && (j = new ResizeObserver(() => $()), j.observe(u)), $();
630
812
  },
631
813
  destroy() {
632
- T && cancelAnimationFrame(T), T = 0, B?.disconnect(), B = null, u?.removeEventListener("scroll", $), E = [], g?.remove(), u = null;
814
+ b && cancelAnimationFrame(b), b = 0, j?.disconnect(), j = null, f?.removeEventListener("scroll", $), C = [], m?.remove(), f = null;
633
815
  },
634
816
  window() {
635
- return { ...m };
817
+ return { ...l };
636
818
  }
637
819
  };
638
820
  }
639
- function S(e, n) {
640
- return typeof e == "number" && Number.isFinite(e) ? e : n;
821
+ function A(t, e) {
822
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
641
823
  }
642
- function v(e, n = "") {
643
- return typeof e == "string" ? e : n;
824
+ function N(t, e = "") {
825
+ return typeof t == "string" ? t : e;
644
826
  }
645
- function N(e) {
646
- return typeof e == "object" && e !== null && !Array.isArray(e);
827
+ function W(t) {
828
+ return typeof t == "object" && t !== null && !Array.isArray(t);
647
829
  }
648
- function $e(e) {
649
- return e === "Center" ? "center" : e === "Right" ? "right" : "left";
830
+ function Kt(t) {
831
+ return t === "Center" ? "center" : t === "Right" ? "right" : "left";
650
832
  }
651
- function He(e) {
652
- return e === "Center" ? "middle" : e === "Bottom" ? "bottom" : "top";
833
+ function Xt(t) {
834
+ return t === "Center" ? "middle" : t === "Bottom" ? "bottom" : "top";
653
835
  }
654
- function Re(e) {
655
- const n = parseFloat(v(e.FontSize, "10.5"));
836
+ function Zt(t) {
837
+ const e = parseFloat(N(t.FontSize, "10.5"));
656
838
  return {
657
- fontSize: Number.isFinite(n) ? n : 10.5,
658
- fontFamily: v(e.FontFamily, "黑体") || void 0,
659
- bold: v(e.FontWeight) === "bold" || void 0,
660
- italic: v(e.FontStyle) === "italic" || void 0,
661
- underline: e.Underline === !0 || void 0,
662
- color: v(e.FontColor) || void 0,
663
- backgroundColor: v(e.BackgroundColor) || void 0,
664
- align: $e(v(e.HorAlignment, "Left")),
665
- verticalAlign: He(v(e.VertAlignment, "Top")),
839
+ fontSize: Number.isFinite(e) ? e : 10.5,
840
+ fontFamily: N(t.FontFamily, "黑体") || void 0,
841
+ bold: N(t.FontWeight) === "bold" || void 0,
842
+ italic: N(t.FontStyle) === "italic" || void 0,
843
+ underline: t.Underline === !0 || void 0,
844
+ color: N(t.FontColor) || void 0,
845
+ backgroundColor: N(t.BackgroundColor) || void 0,
846
+ align: Kt(N(t.HorAlignment, "Left")),
847
+ verticalAlign: Xt(N(t.VertAlignment, "Top")),
666
848
  lineHeight: (() => {
667
- const i = parseFloat(v(e.RowSpace, "1"));
668
- return Number.isFinite(i) && i !== 1 ? i : void 0;
849
+ const r = parseFloat(N(t.RowSpace, "1"));
850
+ return Number.isFinite(r) && r !== 1 ? r : void 0;
669
851
  })(),
670
- borderColor: v(e.BorderColor) || void 0,
671
- borderTop: e.BorderTop !== !1,
672
- borderRight: e.BorderRight !== !1,
673
- borderBottom: e.BorderBottom !== !1,
674
- borderLeft: e.BorderLeft !== !1
852
+ borderColor: N(t.BorderColor) || void 0,
853
+ borderTop: t.BorderTop !== !1,
854
+ borderRight: t.BorderRight !== !1,
855
+ borderBottom: t.BorderBottom !== !1,
856
+ borderLeft: t.BorderLeft !== !1
675
857
  };
676
858
  }
677
- function Be(e, n) {
678
- const i = v(e.uitype), t = {
859
+ function Qt(t, e) {
860
+ const r = N(t.uitype), n = {
679
861
  kind: "text",
680
- leftMm: S(e.left, 0),
681
- topMm: S(e.top, 0),
682
- widthMm: S(e.width, 40),
683
- heightMm: S(e.height, 8),
684
- nid: v(e.nid) || void 0,
685
- style: Re(e)
862
+ leftMm: A(t.left, 0),
863
+ topMm: A(t.top, 0),
864
+ widthMm: A(t.width, 40),
865
+ heightMm: A(t.height, 8),
866
+ nid: N(t.nid) || void 0,
867
+ style: Zt(t)
686
868
  };
687
- switch (i) {
869
+ switch (r) {
688
870
  case "text": {
689
- t.kind = "text";
690
- const r = e.Text ?? e.text ?? e.Value;
691
- t.text = r == null ? "" : String(r);
692
- const s = e.Lines ?? e.lines;
693
- return Array.isArray(s) && (t.lines = s.map((a) => String(a))), t;
871
+ n.kind = "text";
872
+ const i = t.Text ?? t.text ?? t.Value;
873
+ n.text = i == null ? "" : String(i);
874
+ const s = t.Lines ?? t.lines;
875
+ return Array.isArray(s) && (n.lines = s.map((a) => String(a))), n;
694
876
  }
695
877
  case "richtext":
696
- return t.kind = "text", t.text = v(e.Text), n.push(`富文本 ${t.nid ?? ""} 导入为纯文本(版式细节可能损失)`), t;
878
+ return n.kind = "text", n.text = N(t.Text), e.push(`富文本 ${n.nid ?? ""} 导入为纯文本(版式细节可能损失)`), n;
697
879
  case "image":
698
880
  case "barcode":
699
881
  case "qrcode":
700
882
  case "chart":
701
- return t.kind = i === "image" ? "image" : i, t.fallbackText = `[${i}]`, n.push(`图片类组件 ${t.nid ?? ""} 需运行时数据(imageData),已导入为占位`), t;
883
+ return n.kind = r === "image" ? "image" : r, n.fallbackText = `[${r}]`, e.push(`图片类组件 ${n.nid ?? ""} 需运行时数据(imageData),已导入为占位`), n;
702
884
  case "table": {
703
- t.kind = "rect";
704
- const r = e.Cells ?? e.cells;
705
- if (Array.isArray(r)) {
885
+ n.kind = "rect";
886
+ const i = t.Cells ?? t.cells;
887
+ if (Array.isArray(i)) {
706
888
  const s = {
707
- cells: r.map(
889
+ cells: i.map(
708
890
  (a) => Array.isArray(a) ? a.map((o) => ({
709
- text: N(o) ? v(o.Text ?? o.text) : "",
710
- colSpan: N(o) ? S(o.ColSpan, 1) : 1
891
+ text: W(o) ? N(o.Text ?? o.text) : "",
892
+ colSpan: W(o) ? A(o.ColSpan, 1) : 1
711
893
  })) : []
712
894
  )
713
895
  };
714
- t.grid = s;
896
+ n.grid = s;
715
897
  } else
716
- t.fallbackText = "[table]", n.push(`表格 ${t.nid ?? ""} 缺少 Cells,导入为空框`);
717
- return t;
898
+ n.fallbackText = "[table]", e.push(`表格 ${n.nid ?? ""} 缺少 Cells,导入为空框`);
899
+ return n;
718
900
  }
719
901
  case "subreport":
720
- return n.push(`子报表 ${t.nid ?? ""} 暂不支持导入,已跳过`), null;
902
+ return e.push(`子报表 ${n.nid ?? ""} 暂不支持导入,已跳过`), null;
721
903
  default:
722
- return v(e.ShapeType) === "hline" || i === "hline" || i === "vline" ? (t.kind = "line", t) : i === "rect" || i === "oval" || i === "shape" ? (t.kind = i === "oval" ? "ellipse" : "rect", t) : (n.push(`未知组件类型 ${i},已跳过`), null);
904
+ return N(t.ShapeType) === "hline" || r === "hline" || r === "vline" ? (n.kind = "line", n) : r === "rect" || r === "oval" || r === "shape" ? (n.kind = r === "oval" ? "ellipse" : "rect", n) : (e.push(`未知组件类型 ${r},已跳过`), null);
723
905
  }
724
906
  }
725
- function Ge(e) {
726
- const n = [];
727
- let i = null;
728
- if (typeof e == "string")
907
+ function he(t) {
908
+ const e = [];
909
+ let r = null;
910
+ if (typeof t == "string")
729
911
  try {
730
- const d = JSON.parse(e);
731
- N(d) && (i = d);
912
+ const c = JSON.parse(t);
913
+ W(c) && (r = c);
732
914
  } catch {
733
915
  return {
734
916
  template: { pages: [] },
735
917
  warnings: ["content 不是合法 JSON"]
736
918
  };
737
919
  }
738
- else N(e) && (i = e);
739
- if (!i)
920
+ else W(t) && (r = t);
921
+ if (!r)
740
922
  return { template: { pages: [] }, warnings: ["content 为空"] };
741
- const t = N(i.GlobalConfig) ? i.GlobalConfig : {}, r = S(t.paperWidthMm, 210), s = S(t.paperHeightMm, 297), a = {
742
- top: S(t.marginTop, 10),
743
- bottom: S(t.marginBottom, 10),
744
- left: S(t.marginLeft, 10),
745
- right: S(t.marginRight, 10)
746
- }, o = Array.isArray(i.children) ? i.children.filter((d) => N(d) && v(d.uitype) === "page") : [];
747
- o.length === 0 && n.push("content 中没有 uitype=page 的页节点");
748
- const l = o.map((d) => {
749
- const h = d, c = Array.isArray(h.children) ? h.children : [], m = [];
750
- for (const u of c) {
751
- if (!N(u)) continue;
752
- const g = Be(u, n);
753
- g && m.push(g);
923
+ const n = W(r.GlobalConfig) ? r.GlobalConfig : {}, i = A(n.paperWidthMm, 210), s = A(n.paperHeightMm, 297), a = {
924
+ top: A(n.marginTop, 10),
925
+ bottom: A(n.marginBottom, 10),
926
+ left: A(n.marginLeft, 10),
927
+ right: A(n.marginRight, 10)
928
+ }, o = Array.isArray(r.children) ? r.children.filter((c) => W(c) && N(c.uitype) === "page") : [];
929
+ o.length === 0 && e.push("content 中没有 uitype=page 的页节点");
930
+ const d = o.map((c) => {
931
+ const h = c, g = Array.isArray(h.children) ? h.children : [], l = [];
932
+ for (const f of g) {
933
+ if (!W(f)) continue;
934
+ const m = Qt(f, e);
935
+ m && l.push(m);
754
936
  }
755
937
  return {
756
- widthMm: S(h.width, r),
757
- heightMm: S(h.DesignHeight, s),
758
- marginTopMm: S(h.MarginTop, a.top),
759
- marginBottomMm: S(h.MarginBottom, a.bottom),
760
- marginLeftMm: S(h.MarginLeft, a.left),
761
- marginRightMm: S(h.MarginRight, a.right),
762
- components: m
938
+ widthMm: A(h.width, i),
939
+ heightMm: A(h.DesignHeight, s),
940
+ marginTopMm: A(h.MarginTop, a.top),
941
+ marginBottomMm: A(h.MarginBottom, a.bottom),
942
+ marginLeftMm: A(h.MarginLeft, a.left),
943
+ marginRightMm: A(h.MarginRight, a.right),
944
+ components: l
763
945
  };
764
946
  });
765
- return l.length === 0 && (n.push("转换结果为空页,已回退一张空白页"), l.push({
766
- widthMm: r,
947
+ return d.length === 0 && (e.push("转换结果为空页,已回退一张空白页"), d.push({
948
+ widthMm: i,
767
949
  heightMm: s,
768
950
  ...a,
769
951
  components: []
770
- })), { template: { pages: l }, warnings: n };
771
- }
772
- function Ne(e, n, i) {
773
- let t, r;
774
- if (typeof e == "string") {
775
- const s = K[e];
776
- if (!s) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(K).join("/")})`);
777
- t = s.widthMm, r = s.heightMm;
778
- } else typeof e == "number" ? (t = e, r = n ?? 297) : (t = e.widthMm, r = e.heightMm);
779
- return i ? { widthMm: r, heightMm: t } : { widthMm: t, heightMm: r };
780
- }
781
- class Le {
952
+ })), { template: { pages: d }, warnings: e };
953
+ }
954
+ function te(t, e, r) {
955
+ let n, i;
956
+ if (typeof t == "string") {
957
+ const s = ct[t];
958
+ if (!s) throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(ct).join("/")})`);
959
+ n = s.widthMm, i = s.heightMm;
960
+ } else typeof t == "number" ? (n = t, i = e ?? 297) : (n = t.widthMm, i = t.heightMm);
961
+ return r ? { widthMm: i, heightMm: n } : { widthMm: n, heightMm: i };
962
+ }
963
+ class ee {
782
964
  constructor() {
783
965
  this.pages = [], this.pending = null;
784
966
  }
@@ -788,20 +970,20 @@ class Le {
788
970
  * - 数字:.page(210, 297)(第三参数兼容旧 margins 对象或新 options)
789
971
  * - 对象:.page({ widthMm: 210, heightMm: 297 })
790
972
  */
791
- page(n = "a4", i = {}, t) {
973
+ page(e = "a4", r = {}, n) {
792
974
  this.collect();
793
- const s = t != null && !("margins" in t) && !("landscape" in t) && ("marginTopMm" in t || "marginBottomMm" in t || "marginLeftMm" in t || "marginRightMm" in t) ? { margins: t } : t ?? {}, { widthMm: a, heightMm: o } = Ne(
794
- n,
795
- typeof i == "number" ? i : void 0,
975
+ const s = n != null && !("margins" in n) && !("landscape" in n) && ("marginTopMm" in n || "marginBottomMm" in n || "marginLeftMm" in n || "marginRightMm" in n) ? { margins: n } : n ?? {}, { widthMm: a, heightMm: o } = te(
976
+ e,
977
+ typeof r == "number" ? r : void 0,
796
978
  s.landscape
797
- ), l = s.margins ?? {};
798
- return this.pending = new ze(this, {
979
+ ), d = s.margins ?? {};
980
+ return this.pending = new ne(this, {
799
981
  widthMm: a,
800
982
  heightMm: o,
801
- marginTopMm: l.marginTopMm ?? 10,
802
- marginBottomMm: l.marginBottomMm ?? 10,
803
- marginLeftMm: l.marginLeftMm ?? 10,
804
- marginRightMm: l.marginRightMm ?? 10
983
+ marginTopMm: d.marginTopMm ?? 10,
984
+ marginBottomMm: d.marginBottomMm ?? 10,
985
+ marginLeftMm: d.marginLeftMm ?? 10,
986
+ marginRightMm: d.marginRightMm ?? 10
805
987
  }), this.pending;
806
988
  }
807
989
  collect() {
@@ -813,63 +995,63 @@ class Le {
813
995
  return { pages: this.pages };
814
996
  }
815
997
  }
816
- class ze {
817
- constructor(n, i) {
818
- this.parent = n, this.page = i, this.components = [];
998
+ class ne {
999
+ constructor(e, r) {
1000
+ this.parent = e, this.page = r, this.components = [];
819
1001
  }
820
- text(n, i = {}, t = {}) {
1002
+ text(e, r = {}, n = {}) {
821
1003
  return this.components.push({
822
1004
  kind: "text",
823
- leftMm: i.leftMm ?? 0,
824
- topMm: i.topMm ?? 0,
825
- widthMm: i.widthMm ?? 60,
826
- heightMm: i.heightMm ?? 8,
827
- text: n,
828
- style: t
1005
+ leftMm: r.leftMm ?? 0,
1006
+ topMm: r.topMm ?? 0,
1007
+ widthMm: r.widthMm ?? 60,
1008
+ heightMm: r.heightMm ?? 8,
1009
+ text: e,
1010
+ style: n
829
1011
  }), this;
830
1012
  }
831
- list(n, i, t, r = {}) {
1013
+ list(e, r, n, i = {}) {
832
1014
  return this.components.push({
833
1015
  kind: "list",
834
- leftMm: i.leftMm ?? 10,
835
- topMm: i.topMm ?? 30,
836
- widthMm: i.widthMm ?? 180,
837
- dataset: n,
838
- columns: t,
839
- ...r
1016
+ leftMm: r.leftMm ?? 10,
1017
+ topMm: r.topMm ?? 30,
1018
+ widthMm: r.widthMm ?? 180,
1019
+ dataset: e,
1020
+ columns: n,
1021
+ ...i
840
1022
  }), this;
841
1023
  }
842
- rect(n, i = {}) {
843
- return this.components.push({ kind: "rect", ...n, style: i }), this;
1024
+ rect(e, r = {}) {
1025
+ return this.components.push({ kind: "rect", ...e, style: r }), this;
844
1026
  }
845
- line(n, i, t, r = {}) {
1027
+ line(e, r, n, i = {}) {
846
1028
  return this.components.push({
847
1029
  kind: "line",
848
- leftMm: n,
849
- topMm: i,
850
- widthMm: t,
1030
+ leftMm: e,
1031
+ topMm: r,
1032
+ widthMm: n,
851
1033
  heightMm: 0.5,
852
- style: r
1034
+ style: i
853
1035
  }), this;
854
1036
  }
855
- barcode(n, i) {
1037
+ barcode(e, r) {
856
1038
  return this.components.push({
857
1039
  kind: "barcode",
858
- leftMm: i.leftMm ?? 0,
859
- topMm: i.topMm ?? 0,
860
- widthMm: i.widthMm ?? 40,
861
- heightMm: i.heightMm ?? 12,
862
- fallbackText: n
1040
+ leftMm: r.leftMm ?? 0,
1041
+ topMm: r.topMm ?? 0,
1042
+ widthMm: r.widthMm ?? 40,
1043
+ heightMm: r.heightMm ?? 12,
1044
+ fallbackText: e
863
1045
  }), this;
864
1046
  }
865
- qrcode(n, i, t, r) {
1047
+ qrcode(e, r, n, i) {
866
1048
  return this.components.push({
867
1049
  kind: "qrcode",
868
- leftMm: t,
869
- topMm: r,
870
- widthMm: i,
871
- heightMm: i,
872
- fallbackText: n
1050
+ leftMm: n,
1051
+ topMm: i,
1052
+ widthMm: r,
1053
+ heightMm: r,
1054
+ fallbackText: e
873
1055
  }), this;
874
1056
  }
875
1057
  buildPage() {
@@ -882,59 +1064,61 @@ class ze {
882
1064
  return this.done().build();
883
1065
  }
884
1066
  }
885
- function Ve() {
886
- return new Le();
1067
+ function ge() {
1068
+ return new ee();
887
1069
  }
888
1070
  export {
889
- Ue as CSS_DPI,
890
- Ke as DEFAULT_BORDER_PT,
891
- j as DEFAULT_FONT_PT,
892
- Ye as DEFAULT_STROKE_COLOR,
893
- me as DEFAULT_TEXT_COLOR,
894
- q as LINE_HEIGHT,
895
- Xe as MM_PER_INCH,
896
- K as PAPER_SIZES,
897
- ze as PageBuilder,
898
- se as RENDER_PLAN_SCHEMA_VERSION,
899
- Ze as SCHEMA_VERSION_JH4J,
900
- Qe as SCHEMA_VERSION_LOCAL,
901
- et as SCHEMA_VERSION_MACH,
902
- Le as TemplateBuilder,
903
- _e as assertRenderPlan,
904
- tt as charWidthEm,
905
- C as classOf,
906
- Pe as computePageWindow,
907
- nt as createCanvasMeasurer,
908
- je as createCanvasPager,
909
- it as createHeuristicMeasurer,
910
- Ve as createTemplate,
911
- J as heuristicMeasurer,
912
- Ge as importJh4jTemplateContent,
913
- le as isImageBackedComponent,
914
- Z as isRichText,
915
- ie as measurePageSizePx,
916
- rt as measureTextMm,
917
- de as mmToPx,
918
- ot as mmToPxFactor,
919
- We as paginateTemplate,
920
- De as planFontSizePx,
921
- O as ptToPx,
922
- at as pxToMm,
923
- ne as renderComponent,
924
- xe as renderPage,
925
- Ie as renderPlan,
926
- Oe as renderPlanToCanvas,
927
- V as resolveBoxBorders,
928
- W as resolveFontSize,
929
- ce as resolveGridLayout,
930
- he as resolveLineHeight,
931
- Ne as resolvePaper,
932
- F as resolveStroke,
933
- Q as resolveTextColor,
934
- _ as round,
935
- st as toRenderPlan,
936
- ee as validateComponent,
937
- ue as validatePage,
938
- pe as validateRenderPlan,
939
- G as wrapText
1071
+ ue as CSS_DPI,
1072
+ pe as DEFAULT_BORDER_PT,
1073
+ X as DEFAULT_FONT_PT,
1074
+ Me as DEFAULT_STROKE_COLOR,
1075
+ Ht as DEFAULT_TEXT_COLOR,
1076
+ Q as LINE_HEIGHT,
1077
+ be as MM_PER_INCH,
1078
+ ct as PAPER_SIZES,
1079
+ ne as PageBuilder,
1080
+ Pt as RENDER_PLAN_SCHEMA_VERSION,
1081
+ ye as SCHEMA_VERSION_JH4J,
1082
+ we as SCHEMA_VERSION_LOCAL,
1083
+ Se as SCHEMA_VERSION_MACH,
1084
+ ee as TemplateBuilder,
1085
+ oe as assertRenderPlan,
1086
+ Te as charWidthEm,
1087
+ F as classOf,
1088
+ Jt as computePageWindow,
1089
+ xe as createCanvasMeasurer,
1090
+ ce as createCanvasPager,
1091
+ ke as createHeuristicMeasurer,
1092
+ ge as createTemplate,
1093
+ Bt as evalStyleRule,
1094
+ Mt as formatValue,
1095
+ rt as heuristicMeasurer,
1096
+ he as importJh4jTemplateContent,
1097
+ At as isImageBackedComponent,
1098
+ ut as isRichText,
1099
+ St as measurePageSizePx,
1100
+ ve as measureTextMm,
1101
+ Et as mmToPx,
1102
+ Ce as mmToPxFactor,
1103
+ se as paginateTemplate,
1104
+ le as planFontSizePx,
1105
+ K as ptToPx,
1106
+ Pe as pxToMm,
1107
+ wt as renderComponent,
1108
+ Yt as renderPage,
1109
+ ae as renderPlan,
1110
+ de as renderPlanToCanvas,
1111
+ tt as resolveBoxBorders,
1112
+ V as resolveFontSize,
1113
+ Rt as resolveGridLayout,
1114
+ $t as resolveLineHeight,
1115
+ te as resolvePaper,
1116
+ O as resolveStroke,
1117
+ pt as resolveTextColor,
1118
+ G as round,
1119
+ Ae as toRenderPlan,
1120
+ bt as validateComponent,
1121
+ zt as validatePage,
1122
+ _t as validateRenderPlan,
1123
+ Z as wrapText
940
1124
  };