@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
@@ -1,232 +0,0 @@
1
- import { b as D, i as O, v as P } from "./component-tree-1_QCiQJX.js";
2
- import { r as R } from "./grid-geometry-D3SJgWFv.js";
3
- import { b as h, a as C, w as L } from "./progress-Hc2vxoCs.js";
4
- import { c as j, I } from "./media-Y90dHK9z.js";
5
- function x(e, t) {
6
- h(t.signal), C(() => t.onDiagnostic?.(e)), h(t.signal);
7
- }
8
- class k extends Error {
9
- constructor(t) {
10
- super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`), this.diagnostics = t, this.code = "output-fidelity", this.name = "OutputFidelityError";
11
- }
12
- }
13
- const T = /* @__PURE__ */ new Set(["text", "rect", "line", "ellipse"]), X = /* @__PURE__ */ new Set(["image", "chart", "barcode", "qrcode"]);
14
- function G(e, t) {
15
- if (!e.grid) {
16
- if (O(e))
17
- return (t === "pdf" || t === "xlsx") && !/^data:image\/(png|jpe?g);base64,/i.test(e.imageData) ? { code: "unsupported-image-format", message: `${t.toUpperCase()} accepts PNG or JPEG data URLs; convert this image before exporting.` } : void 0;
18
- if (X.has(e.kind)) return { code: "missing-image", message: `${e.kind} requires imageData or a renderer adapter before output.` };
19
- if (!T.has(e.kind)) return { code: "unsupported-component", message: `Unsupported component kind: ${e.kind}.` };
20
- if (t === "xlsx" && e.kind !== "text") return { code: "unsupported-component", message: `XLSX data export omits ${e.kind} geometry.` };
21
- }
22
- }
23
- function p(e, t, n, s, i) {
24
- const r = Object.getOwnPropertyDescriptor(e, "meta")?.value, a = r && Object.getOwnPropertyDescriptor(r, "componentExtension")?.value, o = a && Object.getOwnPropertyDescriptor(a, "id")?.value, d = a && Object.getOwnPropertyDescriptor(a, "version")?.value, c = typeof o == "string" && o.length <= 128 && typeof d == "string" && d.length <= 64 ? { id: o, version: d } : void 0;
25
- return { ...i, severity: "warning", format: t, pageIndex: n, componentIndex: s, kind: e.kind, nid: e.nid, ...c ? { extension: c } : {} };
26
- }
27
- function b(e, t) {
28
- if (!e || t === "dom") return;
29
- const n = [];
30
- return e.rotateDeg && n.push("rotateDeg"), e.opacity !== void 0 && e.opacity !== 1 && n.push("opacity"), t !== "xlsx" && e.align === "justify" && n.push("justify"), t === "xlsx" && e.letterSpacing && n.push("letterSpacing"), n.length ? `${t} does not preserve these styles: ${n.join(", ")}.` : void 0;
31
- }
32
- function S(e) {
33
- if (!e) return;
34
- const t = ["backgroundColor", "align", "verticalAlign", "lineHeight", "borderTop", "borderRight", "borderBottom", "borderLeft", "borderColor", "lineColor", "lineWidthPt"].filter((n) => e[n] !== void 0);
35
- return t.length ? `XLSX rich text does not retain independent run styles: ${t.join(", ")}.` : void 0;
36
- }
37
- function F(e) {
38
- if (e.kind !== "text") return;
39
- const t = S(e.style);
40
- if (e.leftMm || e.topMm || t) return { code: "unsupported-style", message: `Nested XLSX text is retained as rich text in component order; absolute child offsets and independent paragraph styles are not retained.${t ? ` ${t}` : ""}` };
41
- }
42
- function A(e, t, n, s, i, r) {
43
- const a = (o) => {
44
- i.push({ ...p(e, t, n, s, { code: "unsupported-style", message: o }), componentPath: r });
45
- };
46
- for (const o of e.richParagraphs ?? []) {
47
- t === "xlsx" && (o.spaceBeforeMm || o.spaceAfterMm || o.indentMm || o.align || o.lineHeight) && a("XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained.");
48
- const d = b({ align: o.align }, t);
49
- d && a(d);
50
- for (const c of o.segments) {
51
- const u = b(c.style, t) ?? (t === "xlsx" ? S(c.style) : void 0);
52
- u && a(u);
53
- }
54
- }
55
- }
56
- function $(e, t, n, s, i, r, a) {
57
- if (a.has(e)) return;
58
- const o = new Set(a).add(e), d = G(e, t);
59
- d && r.push({ ...p(e, t, n, s, d), componentPath: i });
60
- const c = b(e.style, t);
61
- c && r.push({ ...p(e, t, n, s, { code: "unsupported-style", message: c }), componentPath: i }), A(e, t, n, s, r, i), q(e, t, n, s, i, r, o);
62
- }
63
- function N(e, t, n) {
64
- if (e.grid) return { code: "nested-components-omitted", message: "XLSX cannot place a nested grid inside a single cell; the nested grid is omitted." };
65
- const s = F(e);
66
- if (s) return s;
67
- if (O(e) && (e.leftMm < 0 || e.topMm < 0 || e.leftMm + e.widthMm > t + 1e-3 || e.topMm + e.heightMm > n + 1e-3)) return { code: "unsupported-style", message: "XLSX cannot clip a child image to a cell; it retains the original image dimensions." };
68
- }
69
- function U(e) {
70
- let t;
71
- return (n, s, i, r) => {
72
- t ??= new Map(R(e.grid, e.widthMm, e.heightMm).cells.map((d) => [`${d.ri}:${d.ci}`, d]));
73
- const a = t.get(`${s}:${i}`), o = 2 * (e.grid?.paddingMm ?? 0.5);
74
- return N(n, (a?.widthMm ?? 0) - o - (r?.indentMm ?? 0), (a?.heightMm ?? 0) - o);
75
- };
76
- }
77
- function q(e, t, n, s, i, r, a) {
78
- const o = U(e);
79
- for (const [d, c] of (e.grid?.cells ?? []).entries()) for (const [u, g] of c.entries()) {
80
- g?.dataBar !== void 0 && !P(g.dataBar) && r.push({ ...p(e, t, n, s, { code: "unsupported-style", message: "Invalid resolved data-bar geometry or color; visual data bars require ordered 0–1 ratios and #RRGGBB colors." }), componentPath: [...i, d, u] });
81
- const l = b(g?.style, t);
82
- l && r.push({ ...p(e, t, n, s, { code: "unsupported-style", message: l }), componentPath: [...i, d, u] }), g?.richParagraphs?.length && A({ ...e, richParagraphs: g.richParagraphs }, t, n, s, r, [...i, d, u]);
83
- for (const [f, m] of (g?.children ?? []).entries()) {
84
- const M = [...i, d, u, f];
85
- if (t === "xlsx") {
86
- const E = o(m, d, u, g);
87
- if (E && r.push({ ...p(m, t, n, s, E), componentPath: M }), m.grid) continue;
88
- }
89
- $(m, t, n, s, M, r, a);
90
- }
91
- }
92
- }
93
- function H(e, t) {
94
- D(e);
95
- const n = [];
96
- return e.pages.forEach((s, i) => s.components.forEach((r, a) => $(r, t, i, a, [], n, /* @__PURE__ */ new Set()))), n;
97
- }
98
- function ne(e, t, n) {
99
- h(n.signal);
100
- const s = H(e, t);
101
- if (s.forEach((i) => x(i, n)), n.fidelity === "strict" && s.length) throw new k(s);
102
- return s;
103
- }
104
- class v extends Error {
105
- constructor(t, n) {
106
- super(t.message), this.name = "OutputAssetError", this.diagnostic = t, this.cause = n;
107
- }
108
- }
109
- function w(e) {
110
- if (e.aborted) throw e.reason ?? new DOMException("The operation was aborted.", "AbortError");
111
- }
112
- function K(e) {
113
- const t = { maxAssets: 1e3, maxImageBytes: 33554432, maxTotalImageBytes: 134217728, maxDurationMs: 3e4, ...e.assetBudget };
114
- for (const [n, s] of Object.entries(t))
115
- if (!Number.isSafeInteger(s) || s <= 0 || s > 2147483647) throw new RangeError(`${n} must be a positive safe integer at most 2147483647.`);
116
- return t;
117
- }
118
- function W(e) {
119
- const t = /^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(e);
120
- if (!t) throw new TypeError("Asset renderers must return an image data URL.");
121
- return t[1] ? Math.ceil(t[2].length * 3 / 4) : new TextEncoder().encode(decodeURIComponent(t[2])).byteLength;
122
- }
123
- function y(e, t, n, s, i) {
124
- const r = { code: n, message: s, severity: "warning", format: e.options.format ?? "dom", pageIndex: t.pageIndex, componentIndex: t.componentIndex, componentPath: t.componentPath, kind: t.component.kind, nid: t.component.nid };
125
- if (e.diagnostics.push(r), x(r, { ...e.options, signal: e.signal }), e.options.assetFailure !== "placeholder") throw new v(r, i);
126
- }
127
- async function _(e, t, n) {
128
- const s = e.options.assetRegistry?.rendererFor(t) ?? e.options.assetRenderers?.[t.kind];
129
- if (t.imageData || !s) return t.imageData;
130
- if (++e.rendered > e.budget.maxAssets) return y(e, n, "asset-budget-exceeded", "Output exceeded the asset count budget.");
131
- let i;
132
- try {
133
- if (e.active = n, i = await L(s({ ...n, signal: e.signal }), e.signal), w(e.signal), i.length > e.budget.maxImageBytes * 4 + 1024) return y(e, n, "asset-budget-exceeded", "Output exceeded the image payload byte budget.");
134
- const r = W(i);
135
- if (r > e.budget.maxImageBytes || e.bytes + r > e.budget.maxTotalImageBytes) return y(e, n, "asset-budget-exceeded", "Output exceeded the encoded image byte budget.");
136
- /^data:image\/(png|jpe?g);base64,/i.test(i) && e.inspectImage(i), e.bytes += r;
137
- } catch (r) {
138
- if (e.signal.aborted || r instanceof v || r instanceof I && r.code === "image-budget-exceeded") throw r;
139
- return y(e, n, "asset-render-failed", `Asset renderer failed for ${t.kind}; output was not silently omitted.`, r);
140
- }
141
- return i;
142
- }
143
- function z(e, t) {
144
- const n = e.active;
145
- if (!n) {
146
- t.abort(new Error("Asset rendering exceeded maxDurationMs."));
147
- return;
148
- }
149
- const s = { code: "asset-budget-exceeded", message: "Asset rendering exceeded maxDurationMs.", severity: "warning", format: e.options.format ?? "dom", pageIndex: n.pageIndex, componentIndex: n.componentIndex, componentPath: n.componentPath, kind: n.component.kind, nid: n.component.nid };
150
- e.diagnostics.push(s);
151
- try {
152
- x(s, { ...e.options, signal: e.signal });
153
- } catch (i) {
154
- t.abort(i);
155
- return;
156
- }
157
- t.abort(new v(s));
158
- }
159
- async function J(e, t, n, s, i) {
160
- if (!t?.children?.length) return t;
161
- const r = [];
162
- for (const [a, o] of t.children.entries())
163
- r.push(await B(e, o, { ...n, component: o, componentPath: [...s, a] }, i));
164
- return r.some((a, o) => a !== t.children[o]) ? { ...t, children: r } : t;
165
- }
166
- async function B(e, t, n, s) {
167
- if (w(e.signal), s.has(t)) throw new TypeError("Cyclic grid children cannot be rendered.");
168
- let i = e.cache.get(t);
169
- i || (i = _(e, t, n), e.cache.set(t, i));
170
- const r = await i;
171
- w(e.signal);
172
- let a = t.grid;
173
- if (a) {
174
- const o = new Set(s).add(t), d = [];
175
- for (const [c, u] of a.cells.entries()) {
176
- const g = [];
177
- for (const [l, f] of u.entries()) g.push(await J(e, f, n, [...n.componentPath, c, l], o));
178
- d.push(g);
179
- }
180
- d.some((c, u) => c.some((g, l) => g !== a.cells[u][l])) && (a = { ...a, cells: d });
181
- }
182
- return r !== t.imageData || a !== t.grid ? { ...t, imageData: r, grid: a } : t;
183
- }
184
- function V(e, t, n) {
185
- const s = /* @__PURE__ */ new Set(), i = (r) => {
186
- if (h(n), !s.has(r)) {
187
- if (s.add(r), r.imageData && /^data:image\/(png|jpe?g);base64,/i.test(r.imageData))
188
- try {
189
- t(r.imageData);
190
- } catch (a) {
191
- if (!(a instanceof I) || a.code === "image-budget-exceeded") throw a;
192
- }
193
- for (const a of r.grid?.cells ?? []) for (const o of a) for (const d of o?.children ?? []) i(d);
194
- }
195
- };
196
- for (const r of e.pages) for (const a of r.components) i(a);
197
- }
198
- function Q(e) {
199
- if (e.options.fidelity === "strict" && e.diagnostics.length) throw new k(e.diagnostics);
200
- }
201
- async function re(e, t = {}) {
202
- h(t.signal), D(e);
203
- const n = K(t), s = j(t);
204
- if (V(e, s, t.signal), t.signal?.aborted) throw t.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
205
- const i = new AbortController(), r = () => i.abort(t.signal?.reason);
206
- if (t.signal?.addEventListener("abort", r, { once: !0 }), !t.assetRegistry && (!t.assetRenderers || !Object.keys(t.assetRenderers).length))
207
- return t.signal?.removeEventListener("abort", r), { plan: e, diagnostics: [] };
208
- const a = { options: t, signal: i.signal, diagnostics: [], rendered: 0, bytes: 0, budget: n, cache: /* @__PURE__ */ new WeakMap(), inspectImage: s }, o = setTimeout(() => z(a, i), n.maxDurationMs);
209
- try {
210
- const d = [];
211
- for (const [c, u] of e.pages.entries()) {
212
- if (c < (t.start ?? 0) || c > (t.end ?? e.pages.length - 1)) {
213
- d.push(u);
214
- continue;
215
- }
216
- const g = [];
217
- for (const [l, f] of u.components.entries()) g.push(await B(a, f, { component: f, pageIndex: c, componentIndex: l, componentPath: [] }, /* @__PURE__ */ new Set()));
218
- d.push(g.some((l, f) => l !== u.components[f]) ? { ...u, components: g } : u);
219
- }
220
- return w(a.signal), Q(a), { plan: d.some((c, u) => c !== e.pages[u]) ? { ...e, pages: d } : e, diagnostics: a.diagnostics };
221
- } finally {
222
- clearTimeout(o), t.signal?.removeEventListener("abort", r);
223
- }
224
- }
225
- export {
226
- k as O,
227
- re as a,
228
- v as b,
229
- H as i,
230
- x as n,
231
- ne as r
232
- };
@@ -1 +0,0 @@
1
- "use strict";const m=require("./component-tree-BjZIp6w9.cjs"),P=require("./grid-geometry-D8ReblRV.cjs"),f=require("./progress-B0ctFpKf.cjs"),E=require("./media-B7vnpD8k.cjs");function v(e,t){f.assertOutputActive(t.signal),f.observeOutput(()=>t.onDiagnostic?.(e)),f.assertOutputActive(t.signal)}class M extends Error{constructor(t){super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`),this.diagnostics=t,this.code="output-fidelity",this.name="OutputFidelityError"}}const C=new Set(["text","rect","line","ellipse"]),R=new Set(["image","chart","barcode","qrcode"]);function T(e,t){if(!e.grid){if(m.isImageBackedComponent(e))return(t==="pdf"||t==="xlsx")&&!/^data:image\/(png|jpe?g);base64,/i.test(e.imageData)?{code:"unsupported-image-format",message:`${t.toUpperCase()} accepts PNG or JPEG data URLs; convert this image before exporting.`}:void 0;if(R.has(e.kind))return{code:"missing-image",message:`${e.kind} requires imageData or a renderer adapter before output.`};if(!C.has(e.kind))return{code:"unsupported-component",message:`Unsupported component kind: ${e.kind}.`};if(t==="xlsx"&&e.kind!=="text")return{code:"unsupported-component",message:`XLSX data export omits ${e.kind} geometry.`}}}function h(e,t,n,s,i){const r=Object.getOwnPropertyDescriptor(e,"meta")?.value,o=r&&Object.getOwnPropertyDescriptor(r,"componentExtension")?.value,a=o&&Object.getOwnPropertyDescriptor(o,"id")?.value,d=o&&Object.getOwnPropertyDescriptor(o,"version")?.value,c=typeof a=="string"&&a.length<=128&&typeof d=="string"&&d.length<=64?{id:a,version:d}:void 0;return{...i,severity:"warning",format:t,pageIndex:n,componentIndex:s,kind:e.kind,nid:e.nid,...c?{extension:c}:{}}}function w(e,t){if(!e||t==="dom")return;const n=[];return e.rotateDeg&&n.push("rotateDeg"),e.opacity!==void 0&&e.opacity!==1&&n.push("opacity"),t!=="xlsx"&&e.align==="justify"&&n.push("justify"),t==="xlsx"&&e.letterSpacing&&n.push("letterSpacing"),n.length?`${t} does not preserve these styles: ${n.join(", ")}.`:void 0}function A(e){if(!e)return;const t=["backgroundColor","align","verticalAlign","lineHeight","borderTop","borderRight","borderBottom","borderLeft","borderColor","lineColor","lineWidthPt"].filter(n=>e[n]!==void 0);return t.length?`XLSX rich text does not retain independent run styles: ${t.join(", ")}.`:void 0}function L(e){if(e.kind!=="text")return;const t=A(e.style);if(e.leftMm||e.topMm||t)return{code:"unsupported-style",message:`Nested XLSX text is retained as rich text in component order; absolute child offsets and independent paragraph styles are not retained.${t?` ${t}`:""}`}}function k(e,t,n,s,i,r){const o=a=>{i.push({...h(e,t,n,s,{code:"unsupported-style",message:a}),componentPath:r})};for(const a of e.richParagraphs??[]){t==="xlsx"&&(a.spaceBeforeMm||a.spaceAfterMm||a.indentMm||a.align||a.lineHeight)&&o("XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained.");const d=w({align:a.align},t);d&&o(d);for(const c of a.segments){const u=w(c.style,t)??(t==="xlsx"?A(c.style):void 0);u&&o(u)}}}function S(e,t,n,s,i,r,o){if(o.has(e))return;const a=new Set(o).add(e),d=T(e,t);d&&r.push({...h(e,t,n,s,d),componentPath:i});const c=w(e.style,t);c&&r.push({...h(e,t,n,s,{code:"unsupported-style",message:c}),componentPath:i}),k(e,t,n,s,r,i),G(e,t,n,s,i,r,a)}function j(e,t,n){if(e.grid)return{code:"nested-components-omitted",message:"XLSX cannot place a nested grid inside a single cell; the nested grid is omitted."};const s=L(e);if(s)return s;if(m.isImageBackedComponent(e)&&(e.leftMm<0||e.topMm<0||e.leftMm+e.widthMm>t+.001||e.topMm+e.heightMm>n+.001))return{code:"unsupported-style",message:"XLSX cannot clip a child image to a cell; it retains the original image dimensions."}}function X(e){let t;return(n,s,i,r)=>{t??=new Map(P.resolveGridLayout(e.grid,e.widthMm,e.heightMm).cells.map(d=>[`${d.ri}:${d.ci}`,d]));const o=t.get(`${s}:${i}`),a=2*(e.grid?.paddingMm??.5);return j(n,(o?.widthMm??0)-a-(r?.indentMm??0),(o?.heightMm??0)-a)}}function G(e,t,n,s,i,r,o){const a=X(e);for(const[d,c]of(e.grid?.cells??[]).entries())for(const[u,g]of c.entries()){g?.dataBar!==void 0&&!m.validDataBar(g.dataBar)&&r.push({...h(e,t,n,s,{code:"unsupported-style",message:"Invalid resolved data-bar geometry or color; visual data bars require ordered 0–1 ratios and #RRGGBB colors."}),componentPath:[...i,d,u]});const l=w(g?.style,t);l&&r.push({...h(e,t,n,s,{code:"unsupported-style",message:l}),componentPath:[...i,d,u]}),g?.richParagraphs?.length&&k({...e,richParagraphs:g.richParagraphs},t,n,s,r,[...i,d,u]);for(const[p,y]of(g?.children??[]).entries()){const D=[...i,d,u,p];if(t==="xlsx"){const I=a(y,d,u,g);if(I&&r.push({...h(y,t,n,s,I),componentPath:D}),y.grid)continue}S(y,t,n,s,D,r,o)}}}function B(e,t){m.assertBoundedRenderTree(e);const n=[];return e.pages.forEach((s,i)=>s.components.forEach((r,o)=>S(r,t,i,o,[],n,new Set))),n}function q(e,t,n){f.assertOutputActive(n.signal);const s=B(e,t);if(s.forEach(i=>v(i,n)),n.fidelity==="strict"&&s.length)throw new M(s);return s}class O extends Error{constructor(t,n){super(t.message),this.name="OutputAssetError",this.diagnostic=t,this.cause=n}}function x(e){if(e.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}function F(e){const t={maxAssets:1e3,maxImageBytes:33554432,maxTotalImageBytes:134217728,maxDurationMs:3e4,...e.assetBudget};for(const[n,s]of Object.entries(t))if(!Number.isSafeInteger(s)||s<=0||s>2147483647)throw new RangeError(`${n} must be a positive safe integer at most 2147483647.`);return t}function N(e){const t=/^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(e);if(!t)throw new TypeError("Asset renderers must return an image data URL.");return t[1]?Math.ceil(t[2].length*3/4):new TextEncoder().encode(decodeURIComponent(t[2])).byteLength}function b(e,t,n,s,i){const r={code:n,message:s,severity:"warning",format:e.options.format??"dom",pageIndex:t.pageIndex,componentIndex:t.componentIndex,componentPath:t.componentPath,kind:t.component.kind,nid:t.component.nid};if(e.diagnostics.push(r),v(r,{...e.options,signal:e.signal}),e.options.assetFailure!=="placeholder")throw new O(r,i)}async function U(e,t,n){const s=e.options.assetRegistry?.rendererFor(t)??e.options.assetRenderers?.[t.kind];if(t.imageData||!s)return t.imageData;if(++e.rendered>e.budget.maxAssets)return b(e,n,"asset-budget-exceeded","Output exceeded the asset count budget.");let i;try{if(e.active=n,i=await f.waitForOutput(s({...n,signal:e.signal}),e.signal),x(e.signal),i.length>e.budget.maxImageBytes*4+1024)return b(e,n,"asset-budget-exceeded","Output exceeded the image payload byte budget.");const r=N(i);if(r>e.budget.maxImageBytes||e.bytes+r>e.budget.maxTotalImageBytes)return b(e,n,"asset-budget-exceeded","Output exceeded the encoded image byte budget.");/^data:image\/(png|jpe?g);base64,/i.test(i)&&e.inspectImage(i),e.bytes+=r}catch(r){if(e.signal.aborted||r instanceof O||r instanceof E.ImageMediaError&&r.code==="image-budget-exceeded")throw r;return b(e,n,"asset-render-failed",`Asset renderer failed for ${t.kind}; output was not silently omitted.`,r)}return i}function H(e,t){const n=e.active;if(!n){t.abort(new Error("Asset rendering exceeded maxDurationMs."));return}const s={code:"asset-budget-exceeded",message:"Asset rendering exceeded maxDurationMs.",severity:"warning",format:e.options.format??"dom",pageIndex:n.pageIndex,componentIndex:n.componentIndex,componentPath:n.componentPath,kind:n.component.kind,nid:n.component.nid};e.diagnostics.push(s);try{v(s,{...e.options,signal:e.signal})}catch(i){t.abort(i);return}t.abort(new O(s))}async function K(e,t,n,s,i){if(!t?.children?.length)return t;const r=[];for(const[o,a]of t.children.entries())r.push(await $(e,a,{...n,component:a,componentPath:[...s,o]},i));return r.some((o,a)=>o!==t.children[a])?{...t,children:r}:t}async function $(e,t,n,s){if(x(e.signal),s.has(t))throw new TypeError("Cyclic grid children cannot be rendered.");let i=e.cache.get(t);i||(i=U(e,t,n),e.cache.set(t,i));const r=await i;x(e.signal);let o=t.grid;if(o){const a=new Set(s).add(t),d=[];for(const[c,u]of o.cells.entries()){const g=[];for(const[l,p]of u.entries())g.push(await K(e,p,n,[...n.componentPath,c,l],a));d.push(g)}d.some((c,u)=>c.some((g,l)=>g!==o.cells[u][l]))&&(o={...o,cells:d})}return r!==t.imageData||o!==t.grid?{...t,imageData:r,grid:o}:t}function W(e,t,n){const s=new Set,i=r=>{if(f.assertOutputActive(n),!s.has(r)){if(s.add(r),r.imageData&&/^data:image\/(png|jpe?g);base64,/i.test(r.imageData))try{t(r.imageData)}catch(o){if(!(o instanceof E.ImageMediaError)||o.code==="image-budget-exceeded")throw o}for(const o of r.grid?.cells??[])for(const a of o)for(const d of a?.children??[])i(d)}};for(const r of e.pages)for(const o of r.components)i(o)}function _(e){if(e.options.fidelity==="strict"&&e.diagnostics.length)throw new M(e.diagnostics)}async function z(e,t={}){f.assertOutputActive(t.signal),m.assertBoundedRenderTree(e);const n=F(t),s=E.createImageMediaInspector(t);if(W(e,s,t.signal),t.signal?.aborted)throw t.signal.reason??new DOMException("The operation was aborted.","AbortError");const i=new AbortController,r=()=>i.abort(t.signal?.reason);if(t.signal?.addEventListener("abort",r,{once:!0}),!t.assetRegistry&&(!t.assetRenderers||!Object.keys(t.assetRenderers).length))return t.signal?.removeEventListener("abort",r),{plan:e,diagnostics:[]};const o={options:t,signal:i.signal,diagnostics:[],rendered:0,bytes:0,budget:n,cache:new WeakMap,inspectImage:s},a=setTimeout(()=>H(o,i),n.maxDurationMs);try{const d=[];for(const[c,u]of e.pages.entries()){if(c<(t.start??0)||c>(t.end??e.pages.length-1)){d.push(u);continue}const g=[];for(const[l,p]of u.components.entries())g.push(await $(o,p,{component:p,pageIndex:c,componentIndex:l,componentPath:[]},new Set));d.push(g.some((l,p)=>l!==u.components[p])?{...u,components:g}:u)}return x(o.signal),_(o),{plan:d.some((c,u)=>c!==e.pages[u])?{...e,pages:d}:e,diagnostics:o.diagnostics}}finally{clearTimeout(a),t.signal?.removeEventListener("abort",r)}}exports.OutputAssetError=O;exports.OutputFidelityError=M;exports.inspectOutputCapabilities=B;exports.notifyOutputDiagnostic=v;exports.reportOutputDiagnostics=q;exports.resolvePlanAssets=z;
@@ -1 +0,0 @@
1
- "use strict";const T=require("./prepared-YXy-fVLw.cjs"),S=require("./json-snapshot-nyV63AbB.cjs"),R=require("./protocol-C9ZaylID.cjs"),I=require("./progress-B0ctFpKf.cjs"),_=require("./runtime-Dq0LUsyS.cjs"),d=require("./sha256-DgZAKXqI.cjs");class M extends Error{constructor(r){super("报表 Worker 无法启动"),this.cause=r,this.name="ReportWorkerStartError"}}let j=0;function W(e){const r=new Error("报表 Worker 任务已取消");return r.name="AbortError",Object.defineProperty(r,"cause",{value:e}),r}function U(e,r){if(!e||typeof e!="object")return;const t=e;return t.protocol===R.REPORT_WORKER_PROTOCOL&&t.id===r?t:void 0}function C(e,r={}){const t=r.timeoutMs??12e4;if(!Number.isFinite(t)||t<=0||t>2147483647)throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");const n=(o,s,a,u)=>a?.aborted?Promise.reject(W(a.reason)):new Promise((v,c)=>{let w;try{w=e()}catch(l){c(new M(l));return}const E=`mach-report-${Date.now()}-${++j}`;let m=!1,f=()=>{},k;const b=(l,i)=>{if(m)return;m=!0,k&&clearTimeout(k);let g;try{f()}catch(h){g=h}a?.removeEventListener("abort",x),l??=g,Promise.resolve().then(()=>w.terminate()).then(()=>l===void 0?v(i):c(l),h=>c(l??h))},x=()=>b(W(a?.reason)),p=l=>{const i=U(l,E);if(!(!i||m)){if("type"in i&&i.type==="event"){const g="event"in i?i.event:void 0;R.validReportWorkerEvent(g,s)?S.notifyReportTaskEvent(u,g,a):b(new Error("报表 Worker 返回无效阶段事件"));return}i.error&&typeof i.error.name=="string"&&typeof i.error.message=="string"?b(new R.ReportWorkerError(i.error)):R.validReportWorkerResult(i.result,o)&&(o==="prepare"||"format"in i.result&&"format"in s&&i.result.format===s.format)?b(void 0,i.result):b(new Error("报表 Worker 返回无效响应"))}};try{if(f=w.subscribe(p,l=>b(l??new Error("报表 Worker 执行失败"))),m){f();return}if(a?.addEventListener("abort",x,{once:!0}),k=setTimeout(()=>b(new R.ReportWorkerError({name:"ReportRuntimeError",code:"timeout",message:`报表 Worker 执行超过 ${t}ms`})),t),a?.aborted)x();else{const{onEvent:l,signal:i,...g}=s,h=z(g);w.postMessage({protocol:R.REPORT_WORKER_PROTOCOL,id:E,operation:o,input:g,...r.budget?{budget:r.budget}:{}},h)}}catch(l){b(l)}});return{exportPrepared:(o,s,a)=>n("exportPrepared",o,s,a),prepare:(o,s,a)=>n("prepare",o,s,a),export:(o,s,a)=>n("export",o,s,a)}}function z(e){return e.pdf?(e.pdf=T.snapshotPdfFonts(e.pdf),(e.pdf?.customFontFaces?Object.values(e.pdf.customFontFaces):[e.pdf?.customFontBytes]).filter(t=>t instanceof Uint8Array).map(t=>t.buffer)):[]}function A(e,r={}){return C(()=>{const t=e();return{postMessage:(n,o)=>t.postMessage(n,o),terminate:()=>t.terminate(),subscribe:(n,o)=>{const s=u=>n(u.data),a=u=>o(u instanceof ErrorEvent?new Error(u.message):new Error("报表 Worker 消息无法解码"));return t.addEventListener("message",s),t.addEventListener("error",a),t.addEventListener("messageerror",a),()=>{t.removeEventListener("message",s),t.removeEventListener("error",a),t.removeEventListener("messageerror",a)}}}},r)}const N={cells:2e4,pages:20,bytes:2e6};function P(e){return e.cells>=e.limits.cells||e.pages>=e.limits.pages||e.bytes>=e.limits.bytes||e.capped}function O(e){return++e.visits>=1e5&&(e.capped=!0),!P(e)}function y(e){return typeof e=="string"?e.length*2:0}function L(e,r){for(const t of e??[]){if(!O(r))return;for(const n of t.segments){if(!O(r))return;r.bytes+=y(n.text)}}}function B(e,r,t){if(t>32){r.capped=!0;return}if(O(r)){r.bytes+=y(e.text)+y(e.rawText)+y(e.imageData),L(e.richParagraphs,r);for(const n of e.lines??[]){if(!O(r))return;r.bytes+=y(n)}for(const n of e.grid?.cells??[]){if(!O(r))return;for(const o of n){if(!O(r))return;if(o){r.cells++,r.bytes+=y(o.text)+y(o.rawText)+y(o.value),L(o.richParagraphs,r);for(const s of o.children??[]){if(P(r))return;B(s,r,t+1)}}}}}}function $(e){const r={...N,...e.thresholds};for(const t of Object.values(r))if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("导出隔离阈值应为正安全整数");return r}function H(e,r){const t=$(r),n=e.pdf?.customFontFaces?Object.values(e.pdf.customFontFaces):[e.pdf?.customFontBytes],o={pages:e.prepared.plan.pages.length,cells:0,bytes:n.reduce((u,v)=>u+(v?.byteLength??0),0),visits:0,capped:!1,limits:t};for(const u of e.prepared.plan.pages){if(P(o))break;for(const v of u.components){if(P(o))break;B(v,o,0)}}let s=P(o)?"worker":"local",a=o.capped?"scan-limit":s==="worker"?"threshold":"small-task";return r.mode==="local"&&(s="local",a="explicit-local"),r.mode==="worker"&&(s="worker",a="explicit-worker"),Object.values(e.xlsx??{}).some(u=>typeof u=="function")&&(s="local",a="nonserializable-options"),{mode:s,reason:a,estimate:{pages:o.pages,cells:o.cells,bytes:o.bytes},hardCancellation:s==="worker"}}function G(e){if(e.mode!==void 0&&!["auto","local","worker"].includes(e.mode))throw new TypeError("无效的导出执行模式");if(e.fallback!==void 0&&!["local","error"].includes(e.fallback))throw new TypeError("无效的导出回退策略");d.validateBudget({...e.budget,maxDurationMs:e.timeoutMs??e.budget?.maxDurationMs??12e4})}function F(e,r){I.observeOutput(()=>e.onDecision?.({...r,estimate:{...r.estimate}}))}function D(e,r){return{...e,mode:"local",reason:r,hardCancellation:!1}}function K(e,r){const t={...d.DEFAULT_REPORT_RUNTIME_BUDGET,...r.budget},n=T.capturePreparedHandoff(e.prepared,t.maxPreparedBytes,e.signal),o=_.enforcePrepared(n.prepared,t);n.prepared.stats=o.stats;const s={...e,prepared:n.prepared,pdf:T.snapshotPdfFonts(e.pdf),xlsx:T.snapshotXlsxOptions(e.xlsx)};return{request:s,forward:()=>({...s,prepared:n.forward()})}}function X(e,r){G(e);const t={...e,thresholds:{...e.thresholds},budget:{...d.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget}},n=t.timeoutMs??t.budget.maxDurationMs??12e4,o=_.createReportRuntime({reports:{},budget:{...t.budget,maxDurationMs:n}}),s=new Set;let a=!1;const u=t.mode!=="worker"&&t.fallback!=="error";async function v(c,w){const E=Date.now(),m=()=>{const p=n-(Date.now()-E);if(p<=0)throw new d.ReportRuntimeError("timeout",`报表执行超过 ${n}ms`);return p};let f=H(c,t);if(f.reason==="nonserializable-options"&&t.mode==="worker")throw new TypeError("Worker 模式不接受函数选项;请使用本地模式或可序列化配置");if(f.mode==="worker"&&!r){if(!u)throw new M(new Error("未配置 workerFactory"));f=D(f,"worker-unavailable")}const k=K(c,t),b=k.request;if(F(t,f),d.throwIfAborted(c.signal),f.mode==="worker")try{const p=r(m());if(!p.exportPrepared)throw new TypeError("隔离执行器缺少 exportPrepared");const{signal:l,onEvent:i,...g}=b,h=await p.exportPrepared(g,l,i);return d.throwIfAborted(l),d.assertBudget(t.budget,"maxOutputBytes",h.bytes.byteLength),{...h,execution:f}}catch(p){if(!(p instanceof M)||!u)throw p;d.throwIfAborted(c.signal),f=D(f,"worker-start-failed"),F(t,f)}const x=w?await d.controlled(c.signal,m(),p=>w({...b,signal:p})):await d.controlled(c.signal,m(),p=>o.exportPrepared({...k.forward(),signal:p}));return d.throwIfAborted(c.signal),d.assertBudget(t.budget,"maxOutputBytes",x.bytes.byteLength),{...x,execution:f}}return{async exportPrepared(c,w){if(a)throw new d.ReportRuntimeError("closed","导出执行器已释放");if(d.throwIfAborted(c.signal),s.size>=2)throw new d.ReportRuntimeError("queue-full","同时导出的任务已达 2 个,请等待完成后重试");const E=new AbortController;s.add(E);const m=()=>E.abort(c.signal?.reason);c.signal?.addEventListener("abort",m,{once:!0});try{return await v({...c,signal:E.signal},w)}finally{c.signal?.removeEventListener("abort",m),s.delete(E)}},cancel(){for(const c of s)c.abort()},dispose(){a=!0;for(const c of s)c.abort()}}}function q(e={}){const r=e.workerFactory,t={timeoutMs:e.timeoutMs??e.budget?.maxDurationMs,budget:{...e.budget}};return X(e,r?n=>A(r,{...t,timeoutMs:n}):void 0)}const J=Object.freeze(Object.defineProperty({__proto__:null,createAutoReportExporter:q},Symbol.toStringTag,{value:"Module"}));exports.ReportWorkerStartError=M;exports.auto=J;exports.createAutoReportExporter=q;exports.createBrowserReportExecutor=A;
@@ -1,240 +0,0 @@
1
- import { s as A, c as C, a as q } from "./prepared-rXCKqdHY.js";
2
- import { J as U } from "./json-snapshot-DvQbZlD7.js";
3
- import { b as T, R as S, v as I, c as $ } from "./protocol-fjaeKkjf.js";
4
- import { a as H } from "./progress-Hc2vxoCs.js";
5
- import { c as N, e as G } from "./runtime-BTtpjF3D.js";
6
- import { D as j, R as M, t as R, v as J, b as L, c as W } from "./sha256-BDQ1Qk7A.js";
7
- class O extends Error {
8
- constructor(r) {
9
- super("报表 Worker 无法启动"), this.cause = r, this.name = "ReportWorkerStartError";
10
- }
11
- }
12
- let K = 0;
13
- function D(e) {
14
- const r = new Error("报表 Worker 任务已取消");
15
- return r.name = "AbortError", Object.defineProperty(r, "cause", { value: e }), r;
16
- }
17
- function X(e, r) {
18
- if (!e || typeof e != "object") return;
19
- const t = e;
20
- return t.protocol === S && t.id === r ? t : void 0;
21
- }
22
- function Q(e, r = {}) {
23
- const t = r.timeoutMs ?? 12e4;
24
- if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
25
- const n = (o, s, a, f) => a?.aborted ? Promise.reject(D(a.reason)) : new Promise((v, i) => {
26
- let g;
27
- try {
28
- g = e();
29
- } catch (l) {
30
- i(new O(l));
31
- return;
32
- }
33
- const w = `mach-report-${Date.now()}-${++K}`;
34
- let m = !1, u = () => {
35
- }, y;
36
- const p = (l, c) => {
37
- if (m) return;
38
- m = !0, y && clearTimeout(y);
39
- let b;
40
- try {
41
- u();
42
- } catch (E) {
43
- b = E;
44
- }
45
- a?.removeEventListener("abort", x), l ??= b, Promise.resolve().then(() => g.terminate()).then(
46
- () => l === void 0 ? v(c) : i(l),
47
- (E) => i(l ?? E)
48
- );
49
- }, x = () => p(D(a?.reason)), d = (l) => {
50
- const c = X(l, w);
51
- if (!(!c || m)) {
52
- if ("type" in c && c.type === "event") {
53
- const b = "event" in c ? c.event : void 0;
54
- I(b, s) ? U(f, b, a) : p(new Error("报表 Worker 返回无效阶段事件"));
55
- return;
56
- }
57
- c.error && typeof c.error.name == "string" && typeof c.error.message == "string" ? p(new T(c.error)) : $(c.result, o) && (o === "prepare" || "format" in c.result && "format" in s && c.result.format === s.format) ? p(void 0, c.result) : p(new Error("报表 Worker 返回无效响应"));
58
- }
59
- };
60
- try {
61
- if (u = g.subscribe(d, (l) => p(l ?? new Error("报表 Worker 执行失败"))), m) {
62
- u();
63
- return;
64
- }
65
- if (a?.addEventListener("abort", x, { once: !0 }), y = setTimeout(() => p(new T({ name: "ReportRuntimeError", code: "timeout", message: `报表 Worker 执行超过 ${t}ms` })), t), a?.aborted) x();
66
- else {
67
- const { onEvent: l, signal: c, ...b } = s, E = V(b);
68
- g.postMessage({ protocol: S, id: w, operation: o, input: b, ...r.budget ? { budget: r.budget } : {} }, E);
69
- }
70
- } catch (l) {
71
- p(l);
72
- }
73
- });
74
- return { exportPrepared: (o, s, a) => n("exportPrepared", o, s, a), prepare: (o, s, a) => n("prepare", o, s, a), export: (o, s, a) => n("export", o, s, a) };
75
- }
76
- function V(e) {
77
- return e.pdf ? (e.pdf = A(e.pdf), (e.pdf?.customFontFaces ? Object.values(e.pdf.customFontFaces) : [e.pdf?.customFontBytes]).filter((t) => t instanceof Uint8Array).map((t) => t.buffer)) : [];
78
- }
79
- function Y(e, r = {}) {
80
- return Q(() => {
81
- const t = e();
82
- return {
83
- postMessage: (n, o) => t.postMessage(n, o),
84
- terminate: () => t.terminate(),
85
- subscribe: (n, o) => {
86
- const s = (f) => n(f.data), a = (f) => o(f instanceof ErrorEvent ? new Error(f.message) : new Error("报表 Worker 消息无法解码"));
87
- return t.addEventListener("message", s), t.addEventListener("error", a), t.addEventListener("messageerror", a), () => {
88
- t.removeEventListener("message", s), t.removeEventListener("error", a), t.removeEventListener("messageerror", a);
89
- };
90
- }
91
- };
92
- }, r);
93
- }
94
- const Z = { cells: 2e4, pages: 20, bytes: 2e6 };
95
- function P(e) {
96
- return e.cells >= e.limits.cells || e.pages >= e.limits.pages || e.bytes >= e.limits.bytes || e.capped;
97
- }
98
- function k(e) {
99
- return ++e.visits >= 1e5 && (e.capped = !0), !P(e);
100
- }
101
- function h(e) {
102
- return typeof e == "string" ? e.length * 2 : 0;
103
- }
104
- function F(e, r) {
105
- for (const t of e ?? []) {
106
- if (!k(r)) return;
107
- for (const n of t.segments) {
108
- if (!k(r)) return;
109
- r.bytes += h(n.text);
110
- }
111
- }
112
- }
113
- function z(e, r, t) {
114
- if (t > 32) {
115
- r.capped = !0;
116
- return;
117
- }
118
- if (k(r)) {
119
- r.bytes += h(e.text) + h(e.rawText) + h(e.imageData), F(e.richParagraphs, r);
120
- for (const n of e.lines ?? []) {
121
- if (!k(r)) return;
122
- r.bytes += h(n);
123
- }
124
- for (const n of e.grid?.cells ?? []) {
125
- if (!k(r)) return;
126
- for (const o of n) {
127
- if (!k(r)) return;
128
- if (o) {
129
- r.cells++, r.bytes += h(o.text) + h(o.rawText) + h(o.value), F(o.richParagraphs, r);
130
- for (const s of o.children ?? []) {
131
- if (P(r)) return;
132
- z(s, r, t + 1);
133
- }
134
- }
135
- }
136
- }
137
- }
138
- }
139
- function ee(e) {
140
- const r = { ...Z, ...e.thresholds };
141
- for (const t of Object.values(r)) if (!Number.isSafeInteger(t) || t <= 0) throw new RangeError("导出隔离阈值应为正安全整数");
142
- return r;
143
- }
144
- function re(e, r) {
145
- const t = ee(r), n = e.pdf?.customFontFaces ? Object.values(e.pdf.customFontFaces) : [e.pdf?.customFontBytes], o = { pages: e.prepared.plan.pages.length, cells: 0, bytes: n.reduce((f, v) => f + (v?.byteLength ?? 0), 0), visits: 0, capped: !1, limits: t };
146
- for (const f of e.prepared.plan.pages) {
147
- if (P(o)) break;
148
- for (const v of f.components) {
149
- if (P(o)) break;
150
- z(v, o, 0);
151
- }
152
- }
153
- let s = P(o) ? "worker" : "local", a = o.capped ? "scan-limit" : s === "worker" ? "threshold" : "small-task";
154
- return r.mode === "local" && (s = "local", a = "explicit-local"), r.mode === "worker" && (s = "worker", a = "explicit-worker"), Object.values(e.xlsx ?? {}).some((f) => typeof f == "function") && (s = "local", a = "nonserializable-options"), { mode: s, reason: a, estimate: { pages: o.pages, cells: o.cells, bytes: o.bytes }, hardCancellation: s === "worker" };
155
- }
156
- function te(e) {
157
- if (e.mode !== void 0 && !["auto", "local", "worker"].includes(e.mode)) throw new TypeError("无效的导出执行模式");
158
- if (e.fallback !== void 0 && !["local", "error"].includes(e.fallback)) throw new TypeError("无效的导出回退策略");
159
- J({ ...e.budget, maxDurationMs: e.timeoutMs ?? e.budget?.maxDurationMs ?? 12e4 });
160
- }
161
- function _(e, r) {
162
- H(() => e.onDecision?.({ ...r, estimate: { ...r.estimate } }));
163
- }
164
- function B(e, r) {
165
- return { ...e, mode: "local", reason: r, hardCancellation: !1 };
166
- }
167
- function oe(e, r) {
168
- const t = { ...j, ...r.budget }, n = C(e.prepared, t.maxPreparedBytes, e.signal), o = G(n.prepared, t);
169
- n.prepared.stats = o.stats;
170
- const s = { ...e, prepared: n.prepared, pdf: A(e.pdf), xlsx: q(e.xlsx) };
171
- return { request: s, forward: () => ({ ...s, prepared: n.forward() }) };
172
- }
173
- function se(e, r) {
174
- te(e);
175
- const t = { ...e, thresholds: { ...e.thresholds }, budget: { ...j, ...e.budget } }, n = t.timeoutMs ?? t.budget.maxDurationMs ?? 12e4, o = N({ reports: {}, budget: { ...t.budget, maxDurationMs: n } }), s = /* @__PURE__ */ new Set();
176
- let a = !1;
177
- const f = t.mode !== "worker" && t.fallback !== "error";
178
- async function v(i, g) {
179
- const w = Date.now(), m = () => {
180
- const d = n - (Date.now() - w);
181
- if (d <= 0) throw new M("timeout", `报表执行超过 ${n}ms`);
182
- return d;
183
- };
184
- let u = re(i, t);
185
- if (u.reason === "nonserializable-options" && t.mode === "worker") throw new TypeError("Worker 模式不接受函数选项;请使用本地模式或可序列化配置");
186
- if (u.mode === "worker" && !r) {
187
- if (!f) throw new O(new Error("未配置 workerFactory"));
188
- u = B(u, "worker-unavailable");
189
- }
190
- const y = oe(i, t), p = y.request;
191
- if (_(t, u), R(i.signal), u.mode === "worker")
192
- try {
193
- const d = r(m());
194
- if (!d.exportPrepared) throw new TypeError("隔离执行器缺少 exportPrepared");
195
- const { signal: l, onEvent: c, ...b } = p, E = await d.exportPrepared(b, l, c);
196
- return R(l), L(t.budget, "maxOutputBytes", E.bytes.byteLength), { ...E, execution: u };
197
- } catch (d) {
198
- if (!(d instanceof O) || !f) throw d;
199
- R(i.signal), u = B(u, "worker-start-failed"), _(t, u);
200
- }
201
- const x = g ? await W(i.signal, m(), (d) => g({ ...p, signal: d })) : await W(i.signal, m(), (d) => o.exportPrepared({ ...y.forward(), signal: d }));
202
- return R(i.signal), L(t.budget, "maxOutputBytes", x.bytes.byteLength), { ...x, execution: u };
203
- }
204
- return {
205
- async exportPrepared(i, g) {
206
- if (a) throw new M("closed", "导出执行器已释放");
207
- if (R(i.signal), s.size >= 2) throw new M("queue-full", "同时导出的任务已达 2 个,请等待完成后重试");
208
- const w = new AbortController();
209
- s.add(w);
210
- const m = () => w.abort(i.signal?.reason);
211
- i.signal?.addEventListener("abort", m, { once: !0 });
212
- try {
213
- return await v({ ...i, signal: w.signal }, g);
214
- } finally {
215
- i.signal?.removeEventListener("abort", m), s.delete(w);
216
- }
217
- },
218
- cancel() {
219
- for (const i of s) i.abort();
220
- },
221
- dispose() {
222
- a = !0;
223
- for (const i of s) i.abort();
224
- }
225
- };
226
- }
227
- function ne(e = {}) {
228
- const r = e.workerFactory, t = { timeoutMs: e.timeoutMs ?? e.budget?.maxDurationMs, budget: { ...e.budget } };
229
- return se(e, r ? (n) => Y(r, { ...t, timeoutMs: n }) : void 0);
230
- }
231
- const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
232
- __proto__: null,
233
- createAutoReportExporter: ne
234
- }, Symbol.toStringTag, { value: "Module" }));
235
- export {
236
- O as R,
237
- Y as a,
238
- de as b,
239
- ne as c
240
- };
@@ -1 +0,0 @@
1
- "use strict";const w=require("./matrix-0hywp0-F.cjs"),g=["#2563eb","#0d9488","#d97706","#7c3aed","#dc2626","#0284c7"];function E(e){if(!["bar","line","stackedBar","percentBar"].includes(e.type))throw new Error("未知图表类型");if(!Array.isArray(e.categories)||!Array.isArray(e.series)||!e.categories.length||e.categories.length>200||!e.series.length||e.series.length>12)throw new Error("图表支持 1–200 个分类、1–12 个系列;大数据应先聚合");const t=w.chartArray(e.categories,200,"图表分类"),r=w.chartArray(e.series,12,"图表系列").map(a=>({...a,values:w.chartArray(a?.values,200,"图表数值")}));for(const a of t)if(typeof a!="string")throw new Error("图表分类应为字符串");x(e);for(const a of r)A(a,t.length);return{...e,categories:t,series:r}}function x(e){for(const t of["leftMm","topMm","widthMm","heightMm"])if(!Number.isFinite(e[t])||e[t]<0)throw new Error(`${t} 应为有限非负数`);if(e.widthMm<45||e.heightMm<35)throw new Error("图表至少需要 45×35mm");if(!Number.isFinite(e.leftMm+e.widthMm)||!Number.isFinite(e.topMm+e.heightMm))throw new Error("图表几何范围溢出")}function A(e,t){if(!e||typeof e.name!="string"||!Array.isArray(e.values)||e.values.length!==t)throw new Error("图表系列应提供名称及逐分类的有限数字或 null");for(const r of e.values)if(r!==null&&!Number.isFinite(r))throw new Error("图表系列应提供名称及逐分类的有限数字或 null");if(e.color!==void 0&&!/^#[\da-f]{6}$/i.test(e.color))throw new Error("图表颜色应为 #RRGGBB")}function y(e,t,r,a,c,n=.8){return{kind:"line",leftMm:Math.min(e,r),topMm:Math.min(t,a),widthMm:Math.abs(r-e),heightMm:Math.abs(a-t),lineDirection:a<t?"up":"down",style:{lineColor:c,lineWidthPt:n}}}function o(e,t,r,a,c="center"){return{kind:"text",text:e,leftMm:t,topMm:r,widthMm:a,heightMm:5,style:{fontSize:8,color:"#475569",align:c,verticalAlign:"middle"}}}function M(e){return Number(e.toPrecision(5)).toString()}function N(e){let t=0,r=0;const a=B(e)?S(e):void 0;if(a)t=a.min,r=a.max;else for(const u of e.series)for(const f of u.values)f!==null&&(t=Math.min(t,f),r=Math.max(r,f));t===r&&(r=t+1);const c=e.leftMm+13,n=e.topMm+8,h=e.widthMm-17,i=e.heightMm-23,l=Math.max(Math.abs(t),Math.abs(r),1),m=t/l,s=r/l-m;return{left:c,top:n,width:h,height:i,min:t,max:r,y:u=>n+i*(1-(u/l-m)/s)}}function B(e){return e.type==="stackedBar"||e.type==="percentBar"}function S(e){let t=0,r=e.type==="percentBar"?100:0;for(let a=0;a<e.categories.length;a++){let c=0,n=0;for(const h of e.series){const i=h.values[a]??0;i<0?n+=i:c+=i}if(!Number.isFinite(c)||!Number.isFinite(n))throw new Error("图表堆叠合计溢出,请先明确缩放单位");t=Math.min(t,n),r=Math.max(r,c)}return{min:t,max:r}}function z(e){if(e.type!=="percentBar")return e;const t=e.categories.map((r,a)=>{let c=0;for(const n of e.series){const h=n.values[a];if(h!==null&&h<0)throw new Error("占比图需要非负度量,负数口径应由业务明确处理");c=Math.max(c,h??0)}return{scale:c,total:c?e.series.reduce((n,h)=>n+(h.values[a]??0)/c,0):0}});return{...e,series:e.series.map(r=>({...r,values:r.values.map((a,c)=>{if(a===null)return null;const{scale:n,total:h}=t[c];return n&&h?a/n/h*100:0})}))}}function F(e,t){const r=[],a=t.width/e.categories.length;return e.categories.forEach((c,n)=>{let h=0,i=0;e.series.forEach((l,m)=>{const s=l.values[n];if(s==null)return;const u=s<0?i:h,f=u+s;s<0?i=f:h=f;const b=Math.min(t.y(u),t.y(f)),d=Math.abs(t.y(f)-t.y(u)),C=l.color??g[m%g.length],v=t.left+a*(n+.15),k=a*.7;r.push({kind:"rect",leftMm:v,topMm:b,widthMm:k,heightMm:d,style:{backgroundColor:C,borderTop:!1,borderRight:!1,borderBottom:!1,borderLeft:!1}}),e.showValues&&d>=5&&r.push({...o(e.type==="percentBar"?`${M(s)}%`:M(s),v,b+d/2-2.5,k),style:{fontSize:7,color:"#ffffff",align:"center"}})})}),r}function R(e,t){const r=[];e.title&&r.push({...o(e.title,e.leftMm,e.topMm,e.widthMm),style:{fontSize:10,bold:!0,align:"left"}});for(let n=0;n<=4;n++){const h=n/4,i=t.min*(1-h)+t.max*h,l=t.y(i);r.push(y(t.left,l,t.left+t.width,l,"#e2e8f0",.4),o(`${M(i)}${e.type==="percentBar"?"%":""}`,e.leftMm,l-2.5,11,"right"))}r.push(y(t.left,t.top,t.left,t.top+t.height,"#94a3b8"));const a=Math.max(1,Math.ceil(e.categories.length/Math.max(1,Math.floor(t.width/14))));e.categories.forEach((n,h)=>{h%a===0&&r.push(o(n,t.left+(h+.5)*t.width/e.categories.length-7,t.top+t.height+1,14))});const c=t.width/e.series.length;return e.series.forEach((n,h)=>{r.push({...o(n.name,t.left+h*c,e.topMm+e.heightMm-5,c),style:{fontSize:8,color:n.color??g[h%g.length],align:"center"}})}),r}function W(e,t,r,a){const c=[],n=r.color??g[a%g.length],h=t.width/e.categories.length,i=h*.75/e.series.length;let l;return r.values.forEach((m,s)=>{if(m===null){l=void 0;return}const u=t.left+(s+.5)*h,f=t.y(m);e.type==="bar"?c.push({kind:"rect",leftMm:t.left+s*h+h*.125+a*i,topMm:Math.min(f,t.y(0)),widthMm:i,heightMm:Math.abs(t.y(0)-f),style:{backgroundColor:n,borderTop:!1,borderRight:!1,borderBottom:!1,borderLeft:!1}}):(l&&c.push(y(l.x,l.y,u,f,n,1.2)),c.push({kind:"ellipse",leftMm:u-.7,topMm:f-.7,widthMm:1.4,heightMm:1.4,style:{backgroundColor:n,borderColor:n}}),l={x:u,y:f}),e.showValues&&c.push({...o(M(m),u-h/2,Math.max(t.top,f-5),h),style:{fontSize:7,color:n,align:"center"}})}),c}function $(e,t){let r=0,a=!1;for(const c of t.values){if(c===null){a=!1;continue}r+=1+ +!!e.showValues,e.type==="line"&&a&&r++,a=!0}return r}function L(e){const t=e.categories.length,r=Math.max(1,Math.ceil(t/Math.max(1,Math.floor((e.widthMm-17)/14)))),a=11+ +!!e.title+Math.ceil(t/r)+e.series.length;return e.series.reduce((c,n)=>c+$(e,n),a)}function G(e){e=z(E(e));const t=N(e);return[...R(e,t),...B(e)?F(e,t):e.series.flatMap((r,a)=>W(e,t,r,a))]}exports.chartComponentUpperBound=L;exports.createChartComponents=G;
@@ -1,67 +0,0 @@
1
- import { S as A } from "./grid-geometry-D3SJgWFv.js";
2
- const h = A;
3
- function l(r) {
4
- return (r.kind === "image" || r.kind === "barcode" || r.kind === "qrcode" || r.kind === "chart") && !!r.imageData;
5
- }
6
- function b(r) {
7
- return r.kind === "text" && Array.isArray(r.richParagraphs) && r.richParagraphs.length > 0;
8
- }
9
- function k(r) {
10
- if (!r || typeof r != "object" || Array.isArray(r)) return !1;
11
- const { start: e, end: i, color: n } = r;
12
- return typeof e == "number" && typeof i == "number" && Number.isFinite(e) && Number.isFinite(i) && e >= 0 && i <= 1 && e <= i && typeof n == "string" && /^#[0-9a-f]{6}$/i.test(n);
13
- }
14
- function o(r) {
15
- return !!r && typeof r == "object";
16
- }
17
- function d(r, e, i, n, s) {
18
- if (++s.nodes > 1e6) return { path: e, message: "组件树超过100万个结构节点预算" };
19
- if (o(r)) {
20
- if (i > 64) return { path: e, message: "组件嵌套超过64层预算" };
21
- if (n.has(r)) return { path: e, message: "组件树包含循环引用" };
22
- if (!(!o(r.grid) || !Array.isArray(r.grid.cells))) {
23
- n.add(r);
24
- try {
25
- for (const [t, f] of r.grid.cells.entries())
26
- if (Array.isArray(f))
27
- for (const [u, c] of f.entries()) {
28
- if (++s.nodes > 1e6) return { path: e, message: "组件树超过100万个结构节点预算" };
29
- if (!(!o(c) || !Array.isArray(c.children)))
30
- for (const [y, g] of c.children.entries()) {
31
- const a = d(g, `${e}.grid.cells.${t}.${u}.children.${y}`, i + 1, n, s);
32
- if (a) return a;
33
- }
34
- }
35
- } finally {
36
- n.delete(r);
37
- }
38
- }
39
- }
40
- }
41
- function m(r, e = "$.components", i = { nodes: 0 }) {
42
- for (const [n, s] of r.entries()) {
43
- const t = d(s, `${e}.${n}`, 0, /* @__PURE__ */ new Set(), i);
44
- if (t) return t;
45
- }
46
- }
47
- function $(r) {
48
- const e = { nodes: 0 };
49
- for (const [i, n] of r.entries()) {
50
- if (!o(n) || !Array.isArray(n.components)) continue;
51
- const s = m(n.components, `$.pages.${i}.components`, e);
52
- if (s) return s;
53
- }
54
- }
55
- function E(r) {
56
- const e = $(r.pages);
57
- if (e) throw new TypeError(`${e.path}: ${e.message}`);
58
- }
59
- export {
60
- h as R,
61
- b as a,
62
- E as b,
63
- m as c,
64
- l as i,
65
- $ as r,
66
- k as v
67
- };
@@ -1 +0,0 @@
1
- "use strict";const $=require("./grid-geometry-D8ReblRV.cjs"),E=$.SCHEMA_VERSION_MACH;function R(e){return(e.kind==="image"||e.kind==="barcode"||e.kind==="qrcode"||e.kind==="chart")&&!!e.imageData}function h(e){return e.kind==="text"&&Array.isArray(e.richParagraphs)&&e.richParagraphs.length>0}function l(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const{start:r,end:i,color:n}=e;return typeof r=="number"&&typeof i=="number"&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i<=1&&r<=i&&typeof n=="string"&&/^#[0-9a-f]{6}$/i.test(n)}function o(e){return!!e&&typeof e=="object"}function d(e,r,i,n,t){if(++t.nodes>1e6)return{path:r,message:"组件树超过100万个结构节点预算"};if(o(e)){if(i>64)return{path:r,message:"组件嵌套超过64层预算"};if(n.has(e))return{path:r,message:"组件树包含循环引用"};if(!(!o(e.grid)||!Array.isArray(e.grid.cells))){n.add(e);try{for(const[s,f]of e.grid.cells.entries())if(Array.isArray(f))for(const[g,c]of f.entries()){if(++t.nodes>1e6)return{path:r,message:"组件树超过100万个结构节点预算"};if(!(!o(c)||!Array.isArray(c.children)))for(const[A,m]of c.children.entries()){const a=d(m,`${r}.grid.cells.${s}.${g}.children.${A}`,i+1,n,t);if(a)return a}}}finally{n.delete(e)}}}}function u(e,r="$.components",i={nodes:0}){for(const[n,t]of e.entries()){const s=d(t,`${r}.${n}`,0,new Set,i);if(s)return s}}function y(e){const r={nodes:0};for(const[i,n]of e.entries()){if(!o(n)||!Array.isArray(n.components))continue;const t=u(n.components,`$.pages.${i}.components`,r);if(t)return t}}function p(e){const r=y(e.pages);if(r)throw new TypeError(`${r.path}: ${r.message}`)}exports.RENDER_PLAN_SCHEMA_VERSION=E;exports.assertBoundedRenderTree=p;exports.componentTreeIssue=u;exports.isImageBackedComponent=R;exports.isRichText=h;exports.renderTreeIssue=y;exports.validDataBar=l;