@agile-team/mach-report 2.15.0 → 2.16.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 (155) hide show
  1. package/README.md +14 -9
  2. package/dist/{ExcelBindingWizard-Bs43BGNp.cjs → ExcelBindingWizard-CP6h2x1f.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-BKH1nGNS.js → ExcelBindingWizard-HhB3hAJE.js} +3 -3
  4. package/dist/{ParamEditor-Da4akw6V.cjs → ParamEditor-CUQLgoxa.cjs} +1 -1
  5. package/dist/{ParamEditor-DoAhzJsm.js → ParamEditor-OKesP_nO.js} +1 -1
  6. package/dist/{ReportBatchPanel-wP9m9Pj1.cjs → ReportBatchPanel-cZCAMAwH.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-BMf6boMA.js → ReportBatchPanel-ruxcbfY6.js} +3 -3
  8. package/dist/ReportPreview-BcDKCLiK.js +4834 -0
  9. package/dist/ReportPreview-Bk9nLfO9.cjs +6 -0
  10. package/dist/{ReportTemplateLibrary-Sxr3eD0J.cjs → ReportTemplateLibrary-BDlNT8JN.cjs} +1 -1
  11. package/dist/{ReportTemplateLibrary-C9wutIiT.js → ReportTemplateLibrary-DcwrH-63.js} +1 -1
  12. package/dist/{RuleEditor-XhGHK8DE.cjs → RuleEditor-BX5S8RSF.cjs} +1 -1
  13. package/dist/{RuleEditor-C_Clasvd.js → RuleEditor-CGl9XY2s.js} +2 -2
  14. package/dist/{TemplateOutlinePanel-JTSR53vJ.cjs → TemplateOutlinePanel-CGrT5DFN.cjs} +1 -1
  15. package/dist/{TemplateOutlinePanel-D6Bkny59.js → TemplateOutlinePanel-SXCjaPKR.js} +1 -1
  16. package/dist/{TemplateReusePanel-Kx35S0Ql.cjs → TemplateReusePanel-6Z3wRFz8.cjs} +1 -1
  17. package/dist/{TemplateReusePanel-rVuK1kTz.js → TemplateReusePanel-lHLOS9Wn.js} +2 -2
  18. package/dist/{TemplateReviewPanel-B0ar9_zf.js → TemplateReviewPanel-CJ9PLc48.js} +1 -1
  19. package/dist/{TemplateReviewPanel-Dn6X9UmY.cjs → TemplateReviewPanel-Dpk7sLcF.cjs} +1 -1
  20. package/dist/analytics.d.cts +2 -0
  21. package/dist/analytics.d.ts +2 -0
  22. package/dist/artifact-integrity.json +99 -91
  23. package/dist/{assets-DEaz4qsp.js → assets-CqIbfbTr.js} +24 -22
  24. package/dist/assets-e4YSke8n.cjs +1 -0
  25. package/dist/auto-YR7a4BtF.js +240 -0
  26. package/dist/auto-uVBjX1j5.cjs +1 -0
  27. package/dist/{batch-BfZHN1do.js → batch-WzDIXJAt.js} +1 -1
  28. package/dist/{batch-CLpELXBl.cjs → batch-z6Aw5GEY.cjs} +1 -1
  29. package/dist/capabilities-DDwXr_cA.js +103 -0
  30. package/dist/capabilities-DNLyZdNw.cjs +1 -0
  31. package/dist/codes.d.cts +2 -0
  32. package/dist/codes.d.ts +2 -0
  33. package/dist/component-tree-Ca6YYfHq.js +61 -0
  34. package/dist/component-tree-DkGLEfZC.cjs +1 -0
  35. package/dist/config-Dg_o8e7m.cjs +1 -0
  36. package/dist/{config-BVsJXSqS.js → config-XQ4qrQ7Q.js} +66 -64
  37. package/dist/designer-BfQSahxq.js +5163 -0
  38. package/dist/designer-CPPdeM5_.cjs +2 -0
  39. package/dist/designer.cjs +1 -1
  40. package/dist/designer.d.cts +53 -0
  41. package/dist/designer.d.ts +53 -0
  42. package/dist/designer.js +1 -1
  43. package/dist/diagnostic-notification-B9K9We3h.cjs +1 -0
  44. package/dist/diagnostic-notification-qGAYZdkB.js +7 -0
  45. package/dist/drill-CsdjgkRM.cjs +1 -0
  46. package/dist/{drill-ByJviLXS.js → drill-DIGsZfyB.js} +11 -11
  47. package/dist/encoding-BOGq4qYL.js +21 -0
  48. package/dist/encoding-BYF9ZTl9.cjs +1 -0
  49. package/dist/{font-loader-Q3bQjmrI.js → font-loader-CzI1GuBc.js} +1 -1
  50. package/dist/{font-loader-B_UkxpzC.cjs → font-loader-EKLzOJxf.cjs} +1 -1
  51. package/dist/index.cjs +7 -8
  52. package/dist/index.d.cts +2 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.js +865 -834
  55. package/dist/json-snapshot-D6ioHth9.js +1702 -0
  56. package/dist/json-snapshot-DknkjvxP.cjs +2 -0
  57. package/dist/{pdf-CvvrjPQg.cjs → pdf-ByVCb1i6.cjs} +48 -50
  58. package/dist/{pdf-BwNyeGpt.js → pdf-DJ5S6ukC.js} +2737 -2749
  59. package/dist/pdf.cjs +1 -1
  60. package/dist/pdf.d.cts +2 -0
  61. package/dist/pdf.d.ts +2 -0
  62. package/dist/pdf.js +2 -2
  63. package/dist/{plugin-Ca_XZG3l.js → plugin-C2j5_mhx.js} +1 -1
  64. package/dist/{plugin-DHO7X8z2.cjs → plugin-Dr39GBRG.cjs} +1 -1
  65. package/dist/prepared-DdrjLC7L.cjs +1 -0
  66. package/dist/prepared-DqtpvRTn.js +87 -0
  67. package/dist/progress-BXzlVbIp.js +29 -0
  68. package/dist/progress-DJBd9Rb9.cjs +1 -0
  69. package/dist/{progress-D-OTpEav.js → progress-Hc2vxoCs.js} +2 -2
  70. package/dist/protocol-BzwMP4Vw.cjs +1 -0
  71. package/dist/protocol-kt4Iy6-3.js +90 -0
  72. package/dist/{record-bindings-Do_b3h4V.js → record-bindings-CZWBJ1fU.js} +9 -10
  73. package/dist/record-bindings-DUX1VMlR.cjs +1 -0
  74. package/dist/{region-binding-workflow-BMhK_TjP.js → region-binding-workflow-CWNvIjkV.js} +1 -1
  75. package/dist/{region-binding-workflow-DIYJdCUr.cjs → region-binding-workflow-CqSMxQ4p.cjs} +1 -1
  76. package/dist/report-encoding-worker.cjs +1 -0
  77. package/dist/report-encoding-worker.d.ts +1 -0
  78. package/dist/report-encoding-worker.js +2 -0
  79. package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
  80. package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
  81. package/dist/runtime-BjKBI530.js +168 -0
  82. package/dist/runtime-CBFEPKEs.cjs +1 -0
  83. package/dist/sbom.cdx.json +2 -2
  84. package/dist/server/node.d.cts +86 -1
  85. package/dist/server/node.d.ts +86 -1
  86. package/dist/server-node.cjs +5 -1
  87. package/dist/server-node.js +4558 -473
  88. package/dist/server.cjs +1 -1
  89. package/dist/server.d.cts +8 -1
  90. package/dist/server.d.ts +8 -1
  91. package/dist/server.js +634 -792
  92. package/dist/sha256-BshdOkCC.cjs +1 -0
  93. package/dist/sha256-DTG-Gq8i.js +157 -0
  94. package/dist/style-67OqfNed.js +73 -0
  95. package/dist/style-C22Pbv3T.cjs +1 -0
  96. package/dist/style.css +1 -1
  97. package/dist/{template-catalog-j2B1MJlL.js → template-catalog-BtR2JmCL.js} +9 -9
  98. package/dist/{template-catalog-FJE_c9Qe.cjs → template-catalog-C2NLdrwB.cjs} +1 -1
  99. package/dist/{template-fragments-DcKeiylI.cjs → template-fragments-BVsbxs4a.cjs} +1 -1
  100. package/dist/{template-fragments-BGbQLGlV.js → template-fragments-By0aZC1D.js} +2 -2
  101. package/dist/template-registry-C62vpv4a.cjs +1 -0
  102. package/dist/{template-registry-BtaKPELV.js → template-registry-Cw3vRTX2.js} +389 -321
  103. package/dist/{textwrap-DE1kgcJB.js → textwrap-BEIg2w8y.js} +1 -1
  104. package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
  105. package/dist/vue/async.d.cts +66 -0
  106. package/dist/vue/async.d.ts +66 -0
  107. package/dist/vue/index.d.cts +89 -1
  108. package/dist/vue/index.d.ts +89 -1
  109. package/dist/vue-async.cjs +1 -1
  110. package/dist/vue-async.js +3 -3
  111. package/dist/vue.cjs +1 -1
  112. package/dist/vue.js +7 -7
  113. package/dist/{workbook-session-BvToI-Fd.js → workbook-session-BeSO8PFB.js} +153 -140
  114. package/dist/{workbook-session-Bjv1YCRK.cjs → workbook-session-Cbts-22R.cjs} +12 -12
  115. package/dist/worker.cjs +1 -1
  116. package/dist/worker.d.cts +84 -1
  117. package/dist/worker.d.ts +84 -1
  118. package/dist/worker.js +12 -157
  119. package/dist/xlsx-node.cjs +33 -33
  120. package/dist/xlsx-node.js +1282 -1289
  121. package/dist/xlsx.cjs +4 -3
  122. package/dist/xlsx.d.cts +2 -0
  123. package/dist/xlsx.d.ts +2 -0
  124. package/dist/xlsx.js +297 -279
  125. package/package.json +6 -3
  126. package/dist/ReportPreview-ChV19HBp.js +0 -4619
  127. package/dist/ReportPreview-DbLvvOUT.cjs +0 -6
  128. package/dist/assets-B9ImAi6_.cjs +0 -1
  129. package/dist/batch-BaP6pWDE.cjs +0 -1
  130. package/dist/batch-CGyt-b2W.js +0 -273
  131. package/dist/capabilities-CAh2Nrue.cjs +0 -1
  132. package/dist/capabilities-DskCHs3V.js +0 -69
  133. package/dist/config-D10us76d.cjs +0 -1
  134. package/dist/data-explanation-B8MZRYVS.js +0 -16
  135. package/dist/data-explanation-DE55G30w.cjs +0 -1
  136. package/dist/defaults-DXhiM1ZD.js +0 -10
  137. package/dist/defaults-xhmcLLrf.cjs +0 -1
  138. package/dist/designer-2bDlcNXQ.js +0 -5136
  139. package/dist/designer-BT7XCdbW.cjs +0 -2
  140. package/dist/drill-DYTxuL3A.cjs +0 -1
  141. package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
  142. package/dist/grid-strokes-DyyG1q_o.js +0 -53
  143. package/dist/json-snapshot-DFb2eWkf.js +0 -1416
  144. package/dist/json-snapshot-WWSGlaHG.cjs +0 -2
  145. package/dist/prepared-CFy9B75C.cjs +0 -1
  146. package/dist/prepared-ajM-H-9B.js +0 -69
  147. package/dist/record-bindings-By_UKZ2g.cjs +0 -1
  148. package/dist/render-plan-7xpGrCEl.cjs +0 -1
  149. package/dist/render-plan-Ck6koX9L.js +0 -13
  150. package/dist/sha256-ArEYjaTI.cjs +0 -1
  151. package/dist/sha256-DPEuJ3nh.js +0 -155
  152. package/dist/style-CQ1PK8ZB.js +0 -67
  153. package/dist/style-UgIJSA1F.cjs +0 -1
  154. package/dist/template-registry-Co1zPq5e.cjs +0 -1
  155. package/dist/textwrap-CWHyzkBH.cjs +0 -4
@@ -0,0 +1,240 @@
1
+ import { s as A, c as C, a as q } from "./prepared-DqtpvRTn.js";
2
+ import { E as U } from "./json-snapshot-D6ioHth9.js";
3
+ import { b as T, R as S, v as I, c as $ } from "./protocol-kt4Iy6-3.js";
4
+ import { a as H } from "./progress-Hc2vxoCs.js";
5
+ import { c as N, e as G } from "./runtime-BjKBI530.js";
6
+ import { D as j, R as M, t as R, v as K, b as L, c as W } from "./sha256-DTG-Gq8i.js";
7
+ class O extends Error {
8
+ constructor(r) {
9
+ super("报表 Worker 无法启动"), this.cause = r, this.name = "ReportWorkerStartError";
10
+ }
11
+ }
12
+ let X = 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 J(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()}-${++X}`;
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 = J(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
+ K({ ...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
+ };
@@ -0,0 +1 @@
1
+ "use strict";const T=require("./prepared-DdrjLC7L.cjs"),S=require("./json-snapshot-DknkjvxP.cjs"),R=require("./protocol-BzwMP4Vw.cjs"),I=require("./progress-B0ctFpKf.cjs"),_=require("./runtime-CBFEPKEs.cjs"),d=require("./sha256-BshdOkCC.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,4 +1,4 @@
1
- import { b as x, t as N } from "./sha256-DPEuJ3nh.js";
1
+ import { a as x, t as N } from "./sha256-DTG-Gq8i.js";
2
2
  function R(e = {}) {
3
3
  const t = {
4
4
  maxRecords: e.maxRecords ?? 1e4,
@@ -1 +1 @@
1
- "use strict";const v=require("./sha256-ArEYjaTI.cjs");function j(e={}){const t={maxRecords:e.maxRecords??1e4,maxBytes:e.maxBytes??67108864,maxResultBytes:e.maxResultBytes??262144,controlReserveBytes:e.controlReserveBytes??4096,maxTombstones:e.maxTombstones??1e4,maxTombstoneBytes:e.maxTombstoneBytes??16777216};if(!Object.values(t).every(n=>Number.isSafeInteger(n)&&n>0)||t.controlReserveBytes<4096)throw new c("input","任务容量应为正整数,控制状态预留至少4096字节");return t}function g(e){return new TextEncoder().encode(d(e)).byteLength}function A(e,t){const n={scope:e.scope,id:e.id,revision:1,request:e.request,status:"queued",createdAt:e.createdAt,updatedAt:e.createdAt,attempt:0},r={...e};delete r.result;const a=e.result===void 0?0:g(e.result);if(a>t.maxResultBytes)throw new c("capacity","任务结果超过独立预算,请保存文件引用");return Math.max(g(n)+t.controlReserveBytes,g(r))+a}function x(e){return e.status!=="queued"&&e.status!=="running"}function I(e){const t={...e,tombstoneRetentionMs:e.tombstoneRetentionMs??6048e5,limit:e.limit??100};if(![t.now,t.terminalBefore].every(n=>Number.isSafeInteger(n)&&n>=0)||t.terminalBefore>t.now)throw new c("input","终态清理时间应为不超过当前时间的非负整数");if(![t.tombstoneRetentionMs,t.limit].every(n=>Number.isSafeInteger(n)&&n>0)||!Number.isSafeInteger(t.now+t.tombstoneRetentionMs))throw new c("input","幂等保留期与清理批量应为正整数");return t}async function R(e){const t=new TextEncoder().encode(d(e)),n=globalThis.crypto?.subtle;if(!n)return v.portableSha256HexAsync(t);const r=await n.digest("SHA-256",t);return Array.from(new Uint8Array(r),a=>a.toString(16).padStart(2,"0")).join("")}async function E(e,t){if(!x(e))throw new c("input","只能归档终态任务");return{scope:e.scope,id:e.id,revision:e.revision,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,attempt:e.attempt,requestHash:await R(e.request),expiresAt:t}}class c extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportJobError"}}function J(e,t){if(typeof e!="string"||!e.trim()||e.length>256||typeof t!="string"||t!==t.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t))throw new c("input","任务范围应非空,ID应为1–128位安全标识")}function T(e){const t=Array.isArray(e),n=Object.getPrototypeOf(e),r=Object.keys(e);if(n!==(t?Array.prototype:Object.prototype)&&!(n===null&&!t))throw new c("input","任务对象应为普通 JSON 对象");if(Object.getOwnPropertySymbols(e).length)throw new c("input","任务不能包含Symbol");if(Object.getOwnPropertyNames(e).filter(i=>!(t&&i==="length")).length!==r.length)throw new c("input","任务不能包含不可枚举属性");if(t&&(r.length!==e.length||r.some(i=>i!==String(Number(i))||!Number.isSafeInteger(Number(i))||Number(i)<0||Number(i)>=e.length)))throw new c("input","任务数组不能稀疏或包含额外属性");return r.sort()}function M(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(["__proto__","prototype","constructor"].includes(t)||n.get||n.set)throw new c("input","任务不能包含危险键或访问器");return n.value}function d(e,t={}){const n=t.maxNodes??2e4,r=t.maxCharacters??1e6;if(!Number.isSafeInteger(n)||n<1||n>2e4||!Number.isSafeInteger(r)||r<1||r>1e6)throw new c("input","任务JSON预算无效");let a=0,i=0;const y=new Set;function b(s,u){if(++a>n||u>32)throw new c("input","任务数据超过节点或深度预算");if(typeof s=="string"){if(i+=s.length,i>r)throw new c("input","任务文本超过预算");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))return s;if(!s||typeof s!="object"||y.has(s))throw new c("input","任务只允许无循环的有限 JSON 值");const o=Array.isArray(s),h=T(s);y.add(s);const l=Object.create(null);for(const f of h){if(i+=f.length,i>r)throw new c("input","任务文本超过预算");l[f]=b(M(s,f),u+1)}return y.delete(s),o?Array.from({length:s.length},(f,p)=>l[String(p)]):l}const w=JSON.stringify(b(e,0));if(w.length>r)throw new c("input","任务序列化数据超过字符预算");return w}function m(e){return JSON.parse(JSON.stringify(e))}function N(e,t,n,r){if(J(t,n),e.scope!==t||e.id!==n||e.revision!==(r??0)+1||!Number.isSafeInteger(e.revision))throw new c("input","任务身份或修订不匹配");if(![e.createdAt,e.updatedAt,e.attempt].every(a=>Number.isSafeInteger(a)&&a>=0)||!["queued","running","completed","failed","cancelled"].includes(e.status))throw new c("input","任务状态无效");if(e.lease&&(!e.lease.owner||!Number.isSafeInteger(e.lease.expiresAt)))throw new c("input","任务租约无效");if(!e.request||typeof e.request.kind!="string"||!e.request.kind.trim()||e.request.kind.length>128)throw new c("input","任务类型无效");d(e.request.payload,{maxNodes:19e3,maxCharacters:75e4}),d(e)}function B(e,t){if(e&&(e.createdAt!==t.createdAt||d(e.request)!==d(t.request)))throw new c("input","任务创建时间与请求不可变更,请使用新任务ID")}function O(e,t){return e.status==="queued"||e.status==="running"&&(e.lease?.expiresAt??0)<=t}function C(e={}){const t=new Map,n=new Map,r=j(e);let a=0,i=0,y=Promise.resolve();const b=(s,u)=>JSON.stringify([s,u]),w=s=>{const u=y.then(s);return y=u.then(()=>{},()=>{}),u};return{read:async(s,u)=>{await y;const o=t.get(b(s,u));return o?m(o):void 0},readTombstone:async(s,u)=>{await y;const o=n.get(b(s,u));return o?m(o):void 0},candidates:async(s,u)=>(await y,Array.from(t.values()).filter(o=>O(o,s)).sort((o,h)=>o.createdAt-h.createdAt).slice(0,u).map(m)),compareAndSwap:async(s,u,o,h)=>{N(h,s,u,o);const l=m(h);return w(async()=>{const f=b(s,u),p=t.get(f);if((p?.revision??null)!==o||n.has(f))return!1;B(p,l);const S=a-(p?A(p,r):0)+A(l,r);if(S>r.maxBytes||!p&&t.size>=r.maxRecords)throw new c("capacity","任务容量已满,请清理终态任务或扩大显式预算");return t.set(f,l),a=S,!0})},prune:async s=>{const u=I(s);return w(async()=>{const o={archived:0,expired:0};for(const[h,l]of n)l.expiresAt>u.now||o.expired>=u.limit||(n.delete(h),i-=g(l),o.expired++);for(const[h,l]of t){if(!x(l)||l.updatedAt>u.terminalBefore||o.archived+o.expired>=u.limit)continue;const f=await E(l,u.now+u.tombstoneRetentionMs),p=g(f);if(n.size>=r.maxTombstones||i+p>r.maxTombstoneBytes)break;n.set(h,f),i+=p,t.delete(h),a-=A(l,r),o.archived++}return o})}}}function q(e,t=100){if(!Number.isSafeInteger(t)||t<1||t>1e3||!Array.isArray(e)||e.length>t)throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");const n=JSON.parse(d(e)),r=new Set;for(const a of n){if(!a||typeof a.id!="string"||a.id!==a.id.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(a.id)||r.has(a.id))throw new TypeError("批量行 ID 应唯一且为安全标识");if(!a.params||Array.isArray(a.params)||typeof a.params!="object"||Object.values(a.params).some(i=>typeof i!="string"))throw new TypeError("批量参数应为字符串字典");r.add(a.id)}return n}function z(e,t){if(!t)return;const n={completed:0,total:e.length,failed:0,cancelled:0};for(const r of e)r&&(n.completed++,r.status==="failed"&&n.failed++,r.status==="cancelled"&&n.cancelled++);try{t(n)}catch{}}async function k(e,t,n={}){const r=n.concurrency??2;if(!Number.isSafeInteger(r)||r<1||r>16)throw new RangeError("批量并发应为 1–16");if(n.failure!==void 0&&n.failure!=="continue"&&n.failure!=="stop")throw new TypeError("批量失败策略无效");const a=q(e,n.maxCases??100);if(!a.length)throw new RangeError("批量生成至少需要一组参数");const i=Array.from({length:a.length}),y=new AbortController,b=()=>y.abort(n.signal?.reason);n.signal?.addEventListener("abort",b,{once:!0}),n.signal?.aborted&&b();let w=0,s=!1;async function u(){for(;w<a.length;){const o=w++,h=a[o],l={id:h.id,index:o};if(s||y.signal.aborted)i[o]={...l,status:"cancelled"};else try{v.throwIfAborted(y.signal);const f=await t(h,{index:o,signal:y.signal});i[o]={...l,status:"completed",value:f}}catch(f){y.signal.aborted?i[o]={...l,status:"cancelled"}:(i[o]={...l,status:"failed",error:{name:f instanceof Error?f.name:"Error",message:f instanceof Error?f.message:String(f)}},n.failure==="stop"&&(s=!0))}z(i,n.onProgress)}}try{await Promise.all(Array.from({length:Math.min(r,a.length)},u))}finally{n.signal?.removeEventListener("abort",b)}return i}exports.ReportJobError=c;exports.checkJobIdentity=J;exports.cloneJob=m;exports.createMemoryReportJobStore=C;exports.jobByteLength=g;exports.jobRequestHash=R;exports.runReportBatch=k;exports.runnableJob=O;exports.serializeJobJson=d;exports.snapshotReportBatchCases=q;exports.validateJobRecord=N;exports.validateJobTransition=B;
1
+ "use strict";const v=require("./sha256-BshdOkCC.cjs");function j(e={}){const t={maxRecords:e.maxRecords??1e4,maxBytes:e.maxBytes??67108864,maxResultBytes:e.maxResultBytes??262144,controlReserveBytes:e.controlReserveBytes??4096,maxTombstones:e.maxTombstones??1e4,maxTombstoneBytes:e.maxTombstoneBytes??16777216};if(!Object.values(t).every(n=>Number.isSafeInteger(n)&&n>0)||t.controlReserveBytes<4096)throw new c("input","任务容量应为正整数,控制状态预留至少4096字节");return t}function g(e){return new TextEncoder().encode(d(e)).byteLength}function A(e,t){const n={scope:e.scope,id:e.id,revision:1,request:e.request,status:"queued",createdAt:e.createdAt,updatedAt:e.createdAt,attempt:0},r={...e};delete r.result;const a=e.result===void 0?0:g(e.result);if(a>t.maxResultBytes)throw new c("capacity","任务结果超过独立预算,请保存文件引用");return Math.max(g(n)+t.controlReserveBytes,g(r))+a}function x(e){return e.status!=="queued"&&e.status!=="running"}function I(e){const t={...e,tombstoneRetentionMs:e.tombstoneRetentionMs??6048e5,limit:e.limit??100};if(![t.now,t.terminalBefore].every(n=>Number.isSafeInteger(n)&&n>=0)||t.terminalBefore>t.now)throw new c("input","终态清理时间应为不超过当前时间的非负整数");if(![t.tombstoneRetentionMs,t.limit].every(n=>Number.isSafeInteger(n)&&n>0)||!Number.isSafeInteger(t.now+t.tombstoneRetentionMs))throw new c("input","幂等保留期与清理批量应为正整数");return t}async function R(e){const t=new TextEncoder().encode(d(e)),n=globalThis.crypto?.subtle;if(!n)return v.portableSha256HexAsync(t);const r=await n.digest("SHA-256",t);return Array.from(new Uint8Array(r),a=>a.toString(16).padStart(2,"0")).join("")}async function E(e,t){if(!x(e))throw new c("input","只能归档终态任务");return{scope:e.scope,id:e.id,revision:e.revision,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,attempt:e.attempt,requestHash:await R(e.request),expiresAt:t}}class c extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportJobError"}}function J(e,t){if(typeof e!="string"||!e.trim()||e.length>256||typeof t!="string"||t!==t.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t))throw new c("input","任务范围应非空,ID应为1–128位安全标识")}function T(e){const t=Array.isArray(e),n=Object.getPrototypeOf(e),r=Object.keys(e);if(n!==(t?Array.prototype:Object.prototype)&&!(n===null&&!t))throw new c("input","任务对象应为普通 JSON 对象");if(Object.getOwnPropertySymbols(e).length)throw new c("input","任务不能包含Symbol");if(Object.getOwnPropertyNames(e).filter(i=>!(t&&i==="length")).length!==r.length)throw new c("input","任务不能包含不可枚举属性");if(t&&(r.length!==e.length||r.some(i=>i!==String(Number(i))||!Number.isSafeInteger(Number(i))||Number(i)<0||Number(i)>=e.length)))throw new c("input","任务数组不能稀疏或包含额外属性");return r.sort()}function M(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(["__proto__","prototype","constructor"].includes(t)||n.get||n.set)throw new c("input","任务不能包含危险键或访问器");return n.value}function d(e,t={}){const n=t.maxNodes??2e4,r=t.maxCharacters??1e6;if(!Number.isSafeInteger(n)||n<1||n>2e4||!Number.isSafeInteger(r)||r<1||r>1e6)throw new c("input","任务JSON预算无效");let a=0,i=0;const y=new Set;function b(s,u){if(++a>n||u>32)throw new c("input","任务数据超过节点或深度预算");if(typeof s=="string"){if(i+=s.length,i>r)throw new c("input","任务文本超过预算");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))return s;if(!s||typeof s!="object"||y.has(s))throw new c("input","任务只允许无循环的有限 JSON 值");const o=Array.isArray(s),h=T(s);y.add(s);const l=Object.create(null);for(const f of h){if(i+=f.length,i>r)throw new c("input","任务文本超过预算");l[f]=b(M(s,f),u+1)}return y.delete(s),o?Array.from({length:s.length},(f,p)=>l[String(p)]):l}const w=JSON.stringify(b(e,0));if(w.length>r)throw new c("input","任务序列化数据超过字符预算");return w}function m(e){return JSON.parse(JSON.stringify(e))}function N(e,t,n,r){if(J(t,n),e.scope!==t||e.id!==n||e.revision!==(r??0)+1||!Number.isSafeInteger(e.revision))throw new c("input","任务身份或修订不匹配");if(![e.createdAt,e.updatedAt,e.attempt].every(a=>Number.isSafeInteger(a)&&a>=0)||!["queued","running","completed","failed","cancelled"].includes(e.status))throw new c("input","任务状态无效");if(e.lease&&(!e.lease.owner||!Number.isSafeInteger(e.lease.expiresAt)))throw new c("input","任务租约无效");if(!e.request||typeof e.request.kind!="string"||!e.request.kind.trim()||e.request.kind.length>128)throw new c("input","任务类型无效");d(e.request.payload,{maxNodes:19e3,maxCharacters:75e4}),d(e)}function B(e,t){if(e&&(e.createdAt!==t.createdAt||d(e.request)!==d(t.request)))throw new c("input","任务创建时间与请求不可变更,请使用新任务ID")}function O(e,t){return e.status==="queued"||e.status==="running"&&(e.lease?.expiresAt??0)<=t}function C(e={}){const t=new Map,n=new Map,r=j(e);let a=0,i=0,y=Promise.resolve();const b=(s,u)=>JSON.stringify([s,u]),w=s=>{const u=y.then(s);return y=u.then(()=>{},()=>{}),u};return{read:async(s,u)=>{await y;const o=t.get(b(s,u));return o?m(o):void 0},readTombstone:async(s,u)=>{await y;const o=n.get(b(s,u));return o?m(o):void 0},candidates:async(s,u)=>(await y,Array.from(t.values()).filter(o=>O(o,s)).sort((o,h)=>o.createdAt-h.createdAt).slice(0,u).map(m)),compareAndSwap:async(s,u,o,h)=>{N(h,s,u,o);const l=m(h);return w(async()=>{const f=b(s,u),p=t.get(f);if((p?.revision??null)!==o||n.has(f))return!1;B(p,l);const S=a-(p?A(p,r):0)+A(l,r);if(S>r.maxBytes||!p&&t.size>=r.maxRecords)throw new c("capacity","任务容量已满,请清理终态任务或扩大显式预算");return t.set(f,l),a=S,!0})},prune:async s=>{const u=I(s);return w(async()=>{const o={archived:0,expired:0};for(const[h,l]of n)l.expiresAt>u.now||o.expired>=u.limit||(n.delete(h),i-=g(l),o.expired++);for(const[h,l]of t){if(!x(l)||l.updatedAt>u.terminalBefore||o.archived+o.expired>=u.limit)continue;const f=await E(l,u.now+u.tombstoneRetentionMs),p=g(f);if(n.size>=r.maxTombstones||i+p>r.maxTombstoneBytes)break;n.set(h,f),i+=p,t.delete(h),a-=A(l,r),o.archived++}return o})}}}function q(e,t=100){if(!Number.isSafeInteger(t)||t<1||t>1e3||!Array.isArray(e)||e.length>t)throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");const n=JSON.parse(d(e)),r=new Set;for(const a of n){if(!a||typeof a.id!="string"||a.id!==a.id.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(a.id)||r.has(a.id))throw new TypeError("批量行 ID 应唯一且为安全标识");if(!a.params||Array.isArray(a.params)||typeof a.params!="object"||Object.values(a.params).some(i=>typeof i!="string"))throw new TypeError("批量参数应为字符串字典");r.add(a.id)}return n}function z(e,t){if(!t)return;const n={completed:0,total:e.length,failed:0,cancelled:0};for(const r of e)r&&(n.completed++,r.status==="failed"&&n.failed++,r.status==="cancelled"&&n.cancelled++);try{t(n)}catch{}}async function k(e,t,n={}){const r=n.concurrency??2;if(!Number.isSafeInteger(r)||r<1||r>16)throw new RangeError("批量并发应为 1–16");if(n.failure!==void 0&&n.failure!=="continue"&&n.failure!=="stop")throw new TypeError("批量失败策略无效");const a=q(e,n.maxCases??100);if(!a.length)throw new RangeError("批量生成至少需要一组参数");const i=Array.from({length:a.length}),y=new AbortController,b=()=>y.abort(n.signal?.reason);n.signal?.addEventListener("abort",b,{once:!0}),n.signal?.aborted&&b();let w=0,s=!1;async function u(){for(;w<a.length;){const o=w++,h=a[o],l={id:h.id,index:o};if(s||y.signal.aborted)i[o]={...l,status:"cancelled"};else try{v.throwIfAborted(y.signal);const f=await t(h,{index:o,signal:y.signal});i[o]={...l,status:"completed",value:f}}catch(f){y.signal.aborted?i[o]={...l,status:"cancelled"}:(i[o]={...l,status:"failed",error:{name:f instanceof Error?f.name:"Error",message:f instanceof Error?f.message:String(f)}},n.failure==="stop"&&(s=!0))}z(i,n.onProgress)}}try{await Promise.all(Array.from({length:Math.min(r,a.length)},u))}finally{n.signal?.removeEventListener("abort",b)}return i}exports.ReportJobError=c;exports.checkJobIdentity=J;exports.cloneJob=m;exports.createMemoryReportJobStore=C;exports.jobByteLength=g;exports.jobRequestHash=R;exports.runReportBatch=k;exports.runnableJob=O;exports.serializeJobJson=d;exports.snapshotReportBatchCases=q;exports.validateJobRecord=N;exports.validateJobTransition=B;
@@ -0,0 +1,103 @@
1
+ import { r as $ } from "./grid-geometry-BNptEcMm.js";
2
+ import { b, i as M } from "./component-tree-Ca6YYfHq.js";
3
+ import { b as E } from "./progress-Hc2vxoCs.js";
4
+ import { n as k } from "./diagnostic-notification-qGAYZdkB.js";
5
+ class X extends Error {
6
+ constructor(t) {
7
+ super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`), this.diagnostics = t, this.code = "output-fidelity", this.name = "OutputFidelityError";
8
+ }
9
+ }
10
+ const D = /* @__PURE__ */ new Set(["text", "rect", "line", "ellipse"]), L = /* @__PURE__ */ new Set(["image", "chart", "barcode", "qrcode"]);
11
+ function O(e, t) {
12
+ if (!e.grid) {
13
+ if (M(e))
14
+ 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;
15
+ if (L.has(e.kind)) return { code: "missing-image", message: `${e.kind} requires imageData or a renderer adapter before output.` };
16
+ if (!D.has(e.kind)) return { code: "unsupported-component", message: `Unsupported component kind: ${e.kind}.` };
17
+ if (t === "xlsx" && e.kind !== "text") return { code: "unsupported-component", message: `XLSX data export omits ${e.kind} geometry.` };
18
+ }
19
+ }
20
+ function g(e, t, i, s, n) {
21
+ return { ...n, severity: "warning", format: t, pageIndex: i, componentIndex: s, kind: e.kind, nid: e.nid };
22
+ }
23
+ function f(e, t) {
24
+ if (!e || t === "dom") return;
25
+ const i = [];
26
+ return e.rotateDeg && i.push("rotateDeg"), e.opacity !== void 0 && e.opacity !== 1 && i.push("opacity"), t !== "xlsx" && e.align === "justify" && i.push("justify"), t === "xlsx" && e.letterSpacing && i.push("letterSpacing"), i.length ? `${t} does not preserve these styles: ${i.join(", ")}.` : void 0;
27
+ }
28
+ function S(e) {
29
+ if (!e) return;
30
+ const t = ["backgroundColor", "align", "verticalAlign", "lineHeight", "borderTop", "borderRight", "borderBottom", "borderLeft", "borderColor", "lineColor", "lineWidthPt"].filter((i) => e[i] !== void 0);
31
+ return t.length ? `XLSX rich text does not retain independent run styles: ${t.join(", ")}.` : void 0;
32
+ }
33
+ function C(e) {
34
+ if (e.kind !== "text") return;
35
+ const t = S(e.style);
36
+ 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}` : ""}` };
37
+ }
38
+ function m(e, t, i, s, n, o) {
39
+ const u = (r) => {
40
+ n.push({ ...g(e, t, i, s, { code: "unsupported-style", message: r }), componentPath: o });
41
+ };
42
+ for (const r of e.richParagraphs ?? []) {
43
+ t === "xlsx" && (r.spaceBeforeMm || r.spaceAfterMm || r.indentMm || r.align || r.lineHeight) && u("XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained.");
44
+ const a = f({ align: r.align }, t);
45
+ a && u(a);
46
+ for (const d of r.segments) {
47
+ const l = f(d.style, t) ?? (t === "xlsx" ? S(d.style) : void 0);
48
+ l && u(l);
49
+ }
50
+ }
51
+ }
52
+ function v(e, t, i, s, n, o, u) {
53
+ if (u.has(e)) return;
54
+ const r = new Set(u).add(e), a = O(e, t);
55
+ a && o.push({ ...g(e, t, i, s, a), componentPath: n });
56
+ const d = f(e.style, t);
57
+ d && o.push({ ...g(e, t, i, s, { code: "unsupported-style", message: d }), componentPath: n }), m(e, t, i, s, o, n), N(e, t, i, s, n, o, r);
58
+ }
59
+ function j(e, t, i) {
60
+ if (e.grid) return { code: "nested-components-omitted", message: "XLSX cannot place a nested grid inside a single cell; the nested grid is omitted." };
61
+ const s = C(e);
62
+ if (s) return s;
63
+ if (M(e) && (e.leftMm < 0 || e.topMm < 0 || e.leftMm + e.widthMm > t + 1e-3 || e.topMm + e.heightMm > i + 1e-3)) return { code: "unsupported-style", message: "XLSX cannot clip a child image to a cell; it retains the original image dimensions." };
64
+ }
65
+ function G(e) {
66
+ let t;
67
+ return (i, s, n, o) => {
68
+ t ??= new Map($(e.grid, e.widthMm, e.heightMm).cells.map((a) => [`${a.ri}:${a.ci}`, a]));
69
+ const u = t.get(`${s}:${n}`), r = 2 * (e.grid?.paddingMm ?? 0.5);
70
+ return j(i, (u?.widthMm ?? 0) - r - (o?.indentMm ?? 0), (u?.heightMm ?? 0) - r);
71
+ };
72
+ }
73
+ function N(e, t, i, s, n, o, u) {
74
+ const r = G(e);
75
+ for (const [a, d] of (e.grid?.cells ?? []).entries()) for (const [l, c] of d.entries()) {
76
+ const h = f(c?.style, t);
77
+ h && o.push({ ...g(e, t, i, s, { code: "unsupported-style", message: h }), componentPath: [...n, a, l] }), c?.richParagraphs?.length && m({ ...e, richParagraphs: c.richParagraphs }, t, i, s, o, [...n, a, l]);
78
+ for (const [w, p] of (c?.children ?? []).entries()) {
79
+ const y = [...n, a, l, w];
80
+ if (t === "xlsx") {
81
+ const x = r(p, a, l, c);
82
+ if (x && o.push({ ...g(p, t, i, s, x), componentPath: y }), p.grid) continue;
83
+ }
84
+ v(p, t, i, s, y, o, u);
85
+ }
86
+ }
87
+ }
88
+ function R(e, t) {
89
+ b(e);
90
+ const i = [];
91
+ return e.pages.forEach((s, n) => s.components.forEach((o, u) => v(o, t, n, u, [], i, /* @__PURE__ */ new Set()))), i;
92
+ }
93
+ function U(e, t, i) {
94
+ E(i.signal);
95
+ const s = R(e, t);
96
+ if (s.forEach((n) => k(n, i)), i.fidelity === "strict" && s.length) throw new X(s);
97
+ return s;
98
+ }
99
+ export {
100
+ X as O,
101
+ R as i,
102
+ U as r
103
+ };
@@ -0,0 +1 @@
1
+ "use strict";const b=require("./grid-geometry-CZ_cYB6O.cjs"),h=require("./component-tree-DkGLEfZC.cjs"),m=require("./progress-B0ctFpKf.cjs"),D=require("./diagnostic-notification-B9K9We3h.cjs");class S 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 X=new Set(["text","rect","line","ellipse"]),O=new Set(["image","chart","barcode","qrcode"]);function C(e,t){if(!e.grid){if(h.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(O.has(e.kind))return{code:"missing-image",message:`${e.kind} requires imageData or a renderer adapter before output.`};if(!X.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 g(e,t,i,s,n){return{...n,severity:"warning",format:t,pageIndex:i,componentIndex:s,kind:e.kind,nid:e.nid}}function f(e,t){if(!e||t==="dom")return;const i=[];return e.rotateDeg&&i.push("rotateDeg"),e.opacity!==void 0&&e.opacity!==1&&i.push("opacity"),t!=="xlsx"&&e.align==="justify"&&i.push("justify"),t==="xlsx"&&e.letterSpacing&&i.push("letterSpacing"),i.length?`${t} does not preserve these styles: ${i.join(", ")}.`:void 0}function v(e){if(!e)return;const t=["backgroundColor","align","verticalAlign","lineHeight","borderTop","borderRight","borderBottom","borderLeft","borderColor","lineColor","lineWidthPt"].filter(i=>e[i]!==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=v(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 w(e,t,i,s,n,o){const a=r=>{n.push({...g(e,t,i,s,{code:"unsupported-style",message:r}),componentPath:o})};for(const r of e.richParagraphs??[]){t==="xlsx"&&(r.spaceBeforeMm||r.spaceAfterMm||r.indentMm||r.align||r.lineHeight)&&a("XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained.");const u=f({align:r.align},t);u&&a(u);for(const d of r.segments){const c=f(d.style,t)??(t==="xlsx"?v(d.style):void 0);c&&a(c)}}}function E(e,t,i,s,n,o,a){if(a.has(e))return;const r=new Set(a).add(e),u=C(e,t);u&&o.push({...g(e,t,i,s,u),componentPath:n});const d=f(e.style,t);d&&o.push({...g(e,t,i,s,{code:"unsupported-style",message:d}),componentPath:n}),w(e,t,i,s,o,n),N(e,t,i,s,n,o,r)}function q(e,t,i){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(h.isImageBackedComponent(e)&&(e.leftMm<0||e.topMm<0||e.leftMm+e.widthMm>t+.001||e.topMm+e.heightMm>i+.001))return{code:"unsupported-style",message:"XLSX cannot clip a child image to a cell; it retains the original image dimensions."}}function G(e){let t;return(i,s,n,o)=>{t??=new Map(b.resolveGridLayout(e.grid,e.widthMm,e.heightMm).cells.map(u=>[`${u.ri}:${u.ci}`,u]));const a=t.get(`${s}:${n}`),r=2*(e.grid?.paddingMm??.5);return q(i,(a?.widthMm??0)-r-(o?.indentMm??0),(a?.heightMm??0)-r)}}function N(e,t,i,s,n,o,a){const r=G(e);for(const[u,d]of(e.grid?.cells??[]).entries())for(const[c,l]of d.entries()){const y=f(l?.style,t);y&&o.push({...g(e,t,i,s,{code:"unsupported-style",message:y}),componentPath:[...n,u,c]}),l?.richParagraphs?.length&&w({...e,richParagraphs:l.richParagraphs},t,i,s,o,[...n,u,c]);for(const[k,p]of(l?.children??[]).entries()){const M=[...n,u,c,k];if(t==="xlsx"){const x=r(p,u,c,l);if(x&&o.push({...g(p,t,i,s,x),componentPath:M}),p.grid)continue}E(p,t,i,s,M,o,a)}}}function $(e,t){h.assertBoundedRenderTree(e);const i=[];return e.pages.forEach((s,n)=>s.components.forEach((o,a)=>E(o,t,n,a,[],i,new Set))),i}function j(e,t,i){m.assertOutputActive(i.signal);const s=$(e,t);if(s.forEach(n=>D.notifyOutputDiagnostic(n,i)),i.fidelity==="strict"&&s.length)throw new S(s);return s}exports.OutputFidelityError=S;exports.inspectOutputCapabilities=$;exports.reportOutputDiagnostics=j;
package/dist/codes.d.cts CHANGED
@@ -110,6 +110,8 @@ export declare function createCodeAssetRenderers(options?: CodeImageOptions): {
110
110
  };
111
111
 
112
112
  declare interface GridCell {
113
+ /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
114
+ richParagraphs?: RichParagraph[];
113
115
  text?: string;
114
116
  rawText?: string;
115
117
  /** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
package/dist/codes.d.ts CHANGED
@@ -110,6 +110,8 @@ export declare function createCodeAssetRenderers(options?: CodeImageOptions): {
110
110
  };
111
111
 
112
112
  declare interface GridCell {
113
+ /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
114
+ richParagraphs?: RichParagraph[];
113
115
  text?: string;
114
116
  rawText?: string;
115
117
  /** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
@@ -0,0 +1,61 @@
1
+ import { S as A } from "./style-67OqfNed.js";
2
+ const l = A;
3
+ function k(e) {
4
+ return (e.kind === "image" || e.kind === "barcode" || e.kind === "qrcode" || e.kind === "chart") && !!e.imageData;
5
+ }
6
+ function E(e) {
7
+ return e.kind === "text" && Array.isArray(e.richParagraphs) && e.richParagraphs.length > 0;
8
+ }
9
+ function o(e) {
10
+ return !!e && typeof e == "object";
11
+ }
12
+ function d(e, r, s, n, i) {
13
+ if (++i.nodes > 1e6) return { path: r, message: "组件树超过100万个结构节点预算" };
14
+ if (o(e)) {
15
+ if (s > 64) return { path: r, message: "组件嵌套超过64层预算" };
16
+ if (n.has(e)) return { path: r, message: "组件树包含循环引用" };
17
+ if (!(!o(e.grid) || !Array.isArray(e.grid.cells))) {
18
+ n.add(e);
19
+ try {
20
+ for (const [t, f] of e.grid.cells.entries())
21
+ if (Array.isArray(f))
22
+ for (const [u, c] of f.entries()) {
23
+ if (++i.nodes > 1e6) return { path: r, message: "组件树超过100万个结构节点预算" };
24
+ if (!(!o(c) || !Array.isArray(c.children)))
25
+ for (const [g, y] of c.children.entries()) {
26
+ const a = d(y, `${r}.grid.cells.${t}.${u}.children.${g}`, s + 1, n, i);
27
+ if (a) return a;
28
+ }
29
+ }
30
+ } finally {
31
+ n.delete(e);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ function m(e, r = "$.components", s = { nodes: 0 }) {
37
+ for (const [n, i] of e.entries()) {
38
+ const t = d(i, `${r}.${n}`, 0, /* @__PURE__ */ new Set(), s);
39
+ if (t) return t;
40
+ }
41
+ }
42
+ function $(e) {
43
+ const r = { nodes: 0 };
44
+ for (const [s, n] of e.entries()) {
45
+ if (!o(n) || !Array.isArray(n.components)) continue;
46
+ const i = m(n.components, `$.pages.${s}.components`, r);
47
+ if (i) return i;
48
+ }
49
+ }
50
+ function R(e) {
51
+ const r = $(e.pages);
52
+ if (r) throw new TypeError(`${r.path}: ${r.message}`);
53
+ }
54
+ export {
55
+ l as R,
56
+ E as a,
57
+ R as b,
58
+ m as c,
59
+ k as i,
60
+ $ as r
61
+ };
@@ -0,0 +1 @@
1
+ "use strict";const E=require("./style-C22Pbv3T.cjs"),R=E.SCHEMA_VERSION_MACH;function $(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 o(e){return!!e&&typeof e=="object"}function a(e,r,s,n,i){if(++i.nodes>1e6)return{path:r,message:"组件树超过100万个结构节点预算"};if(o(e)){if(s>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[t,d]of e.grid.cells.entries())if(Array.isArray(d))for(const[A,c]of d.entries()){if(++i.nodes>1e6)return{path:r,message:"组件树超过100万个结构节点预算"};if(!(!o(c)||!Array.isArray(c.children)))for(const[y,m]of c.children.entries()){const f=a(m,`${r}.grid.cells.${t}.${A}.children.${y}`,s+1,n,i);if(f)return f}}}finally{n.delete(e)}}}}function u(e,r="$.components",s={nodes:0}){for(const[n,i]of e.entries()){const t=a(i,`${r}.${n}`,0,new Set,s);if(t)return t}}function g(e){const r={nodes:0};for(const[s,n]of e.entries()){if(!o(n)||!Array.isArray(n.components))continue;const i=u(n.components,`$.pages.${s}.components`,r);if(i)return i}}function l(e){const r=g(e.pages);if(r)throw new TypeError(`${r.path}: ${r.message}`)}exports.RENDER_PLAN_SCHEMA_VERSION=R;exports.assertBoundedRenderTree=l;exports.componentTreeIssue=u;exports.isImageBackedComponent=$;exports.isRichText=h;exports.renderTreeIssue=g;
@@ -0,0 +1 @@
1
+ "use strict";const a=require("vue"),D=require("@agile-team/mach-report"),_=require("./progress-B0ctFpKf.cjs"),M=require("./_plugin-vue_export-helper-BLmdZLlg.cjs"),T=require("./injection-keys-Db_DyLkm.cjs"),L={printPrepareTimeout:"打印资源准备超时,请检查字体与图片后重试。",printImageFailed:"第 {index} 张图片未能加载,已停止打印,避免输出缺失内容。",printFontFailed:"打印字体 {family} 未能加载,请检查字体资源后重试。",printPrepareFailed:"打印准备失败,请检查打印配置或改用 PDF。",printCalibration:"打印校准",printOffsetX:"水平偏移(mm)",printOffsetY:"垂直偏移(mm)",printCalibrationTest:"打印校准页",printCalibrationHint:"正值向右/向下移动,负值向左/向上。使用同规格纸张及 100% 比例,先试打一张。系统对话框关闭不代表设备已完成。"};function J(e){const n=e?.calibration?.offsetXmm??0,l=e?.calibration?.offsetYmm??0;if(![n,l].every(r=>Number.isFinite(r)&&Math.abs(r)<=20))throw new RangeError("Print calibration must be within ±20 mm");return{x:n,y:l}}function Y(e={}){if(e.fonts&&(!Array.isArray(e.fonts)||e.fonts.length>8))throw new RangeError("At most eight print font faces are allowed");return{...e,...e.fonts?{fonts:e.fonts.map(n=>({...n}))}:{},...e.calibration?{calibration:{...e.calibration}}:{}}}function V(e={}){const n=a.ref(!1),l=a.ref(null),r=a.ref(null),s=a.ref(null);function u(i=!1){n.value=!1,i&&a.nextTick(()=>r.value?.focus())}function m(i){i.target instanceof Node&&!l.value?.contains(i.target)&&u()}function f(i){i.key!=="Escape"||!n.value||i.isComposing||(i.preventDefault(),i.stopPropagation(),u(!0))}return a.watch(n,i=>{!i||e.focusOnOpen===!1||a.nextTick(()=>(s.value?.querySelector("input")??s.value?.querySelector("button:not(:disabled)"))?.focus())}),a.onMounted(()=>{document.addEventListener("pointerdown",m),document.addEventListener("focusin",m)}),a.onBeforeUnmount(()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("focusin",m)}),{opened:n,root:l,trigger:r,panel:s,close:u,onKeydown:f}}class O extends Error{constructor(n,l,r){super(l),this.name="MachReportError",this.code=n,this.cause=r}}function X(e){return e instanceof O?{code:e.code,cause:e.cause}:{code:"render",cause:e}}function Q(e){if(e instanceof O)return e;if(e instanceof D.ReportParamValidationError)return new O("param",e.message,e);if(e instanceof D.ReportSourceError)return new O(e.code,e.message,e.cause);if(e instanceof Error){const n={params:"param",config:"config",validate:"validate",fetch:"fetch"},l=e.code;if(typeof l=="string"&&Object.prototype.hasOwnProperty.call(n,l))return new O(n[l],e.message,e)}return new O("fetch",e instanceof Error?e.message:"预览加载失败",e)}let Z=0;function ee(){return`mrp-params-${++Z}`}function $(e,n,l){const r=(Array.isArray(n)?n.find(s=>s?.field===e.field)?.label:void 0)??e.field;return e.code==="required"?l.paramRequired.replace("{label}",r):(l.paramInvalid??"{label}:{message}").replace("{label}",r).replace("{message}",e.message)}function ae(e){const n=a.ref({}),l=a.ref(!1);function r(){const f={};for(const i of Array.isArray(e.defs.value)?e.defs.value:[])typeof i?.field=="string"&&Object.defineProperty(f,i.field,{value:e.params()[i.field]??i.defaultValue??"",writable:!0,enumerable:!0,configurable:!0});n.value=f,l.value=!1}r(),a.watch(e.defs,r),a.watch(e.reportIds,r),a.watch(()=>JSON.stringify(e.params()),r);const s=a.computed(()=>D.validateReportParams(e.defs.value,{...e.params(),...n.value})),u=a.computed(()=>!l.value&&s.value.issues.length>0&&s.value.issues.every(f=>f.code==="required"));function m(){const f=s.value;if(!f.ok){const p=f.issues[0];return{quiet:u.value,error:new O(p.code==="definition"?"config":"param",$(p,e.defs.value,e.messages()),{issues:f.issues})}}const i={...f.values},w=new Set(e.defs.value.filter(p=>p.defaultValue!==void 0).map(p=>p.field));for(const[p,b]of Object.entries(i))b===""&&!w.has(p)&&delete i[p];return{params:i,quiet:!1}}return{values:n,attempted:l,validation:s,pendingRequired:u,reset:r,query:m}}const I={paramOptionsLoading:"正在搜索选项…",paramOptionsEmpty:"没有匹配选项",paramOptionsFailed:"选项加载失败,请重试",paramOptionsMissingLoader:"尚未配置选项加载服务",paramOptionsDependencies:"请先选择上级条件",paramOptionsClear:"清除选择"},U=100,te=32,ne=6e4,re=15e3;function le(e){if(!Array.isArray(e)||e.length>U)throw new Error("Invalid option response");const n=new Set;return Object.freeze(e.map(l=>{if(!l||typeof l.value!="string"||!l.value||l.value.length>1024||typeof l.label!="string"||l.label.length>1024||n.has(l.value))throw new Error("Invalid option response");return n.add(l.value),Object.freeze({label:l.label,value:l.value})}))}function oe(e){const n=a.ref(""),l=a.shallowRef([]),r=a.ref(!1),s=a.ref(!1),u=a.computed(()=>Object.fromEntries((Array.isArray(e.def().dependsOn)?e.def().dependsOn:[]).map(y=>[y,e.values()[y]??""]))),m=a.computed(()=>Object.values(u.value).some(y=>!y.trim())),f=a.computed(()=>!e.loader()),i=new Map;let w,p,b=0;function P(){b++,w?.abort(),w=void 0,clearTimeout(p),r.value=!1}async function v(){P(),s.value=!1;const y=e.loader(),h=e.def();if(!y||!h.optionsSource||m.value||e.disabled()||!e.opened())return;const x={source:h.optionsSource,field:h.field,query:n.value.trim().slice(0,256),params:Object.freeze({...u.value}),limit:U},o=JSON.stringify(x),d=i.get(o);if(d&&Date.now()-d.at<ne){i.delete(o),i.set(o,d),l.value=d.options;return}const t=b,c=new AbortController;w=c,r.value=!0;const E=setTimeout(()=>c.abort(),re);try{const k=le(await _.waitForOutput(y(Object.freeze({...x,signal:c.signal})),c.signal));if(t!==b)return;for(l.value=k,i.delete(o),i.set(o,{at:Date.now(),options:k});i.size>te;)i.delete(i.keys().next().value)}catch{t===b&&(s.value=!0)}finally{clearTimeout(E),t===b&&(r.value=!1,w=void 0)}}function S(){P(),l.value=[],s.value=!1,p=setTimeout(()=>{v()},180)}return a.watch(n,S,{flush:"sync"}),a.watch([()=>e.def().field,()=>e.def().optionsSource,()=>JSON.stringify(u.value),e.loader],()=>{i.clear(),n.value="",P(),l.value=[],s.value=!1,e.opened()&&v()},{flush:"sync"}),a.watch([e.opened,e.disabled],()=>{!e.opened()||e.disabled()?P():v()}),a.onBeforeUnmount(()=>{P(),i.clear()}),{query:n,options:l,loading:r,failed:s,waiting:m,missingLoader:f,request:v,cancel:P}}const ie=["id","value","aria-labelledby","aria-invalid","aria-required","aria-describedby","aria-expanded","aria-controls","aria-activedescendant","disabled","placeholder"],se=["aria-label","disabled"],ce=["aria-label","disabled"],de=["id"],ue=["id","aria-label","aria-busy"],fe=["id","aria-selected","disabled","onPointermove","onClick"],pe={key:0},me={key:0,role:"status"},ve=a.defineComponent({__name:"ReportRemoteParamSelect",props:{def:{},value:{},values:{},loadOptions:{type:Function},messages:{},disabled:{type:Boolean},id:{},invalid:{type:Boolean}},emits:["change"],setup(e,{emit:n}){const l=e,r=n,s=V({focusOnOpen:!1}),{root:u,panel:m,opened:f}=s,i=oe({def:()=>l.def,values:()=>l.values,loader:()=>l.loadOptions,opened:()=>f.value,disabled:()=>l.disabled===!0}),{query:w,options:p,loading:b,failed:P,waiting:v,missingLoader:S}=i,y=a.computed(()=>({...I,...l.messages})),h=a.ref(0),x=a.ref(""),o=a.ref(),d=a.computed(()=>`${l.id}-options`),t=a.computed(()=>v.value?y.value.paramOptionsDependencies:S.value?y.value.paramOptionsMissingLoader:P.value?y.value.paramOptionsFailed:b.value?y.value.paramOptionsLoading:p.value.length?"":y.value.paramOptionsEmpty);a.watch(()=>l.value,()=>{x.value=""}),a.watch(p,()=>{h.value=0}),a.watch(f,g=>{g&&a.nextTick(()=>o.value?.focus())});function c(g){l.disabled||v.value||b.value||P.value||(r("change",g.value),s.close(),a.nextTick(()=>{x.value=g.label,o.value?.focus()}))}function E(g){g.isComposing||(f.value=!0,w.value=g.target.value)}function k(){!l.disabled&&!v.value&&!S.value&&(w.value="",f.value=!0)}function z(g){if(!(g.isComposing||g.keyCode===229)){if(g.key==="Escape"){f.value&&(g.preventDefault(),g.stopPropagation(),s.close());return}if(["ArrowUp","ArrowDown","Enter"].includes(g.key)){if(g.preventDefault(),g.stopPropagation(),!f.value){k();return}if(g.key==="Enter"){const B=p.value[h.value];B&&c(B);return}p.value.length&&(h.value=(h.value+(g.key==="ArrowDown"?1:-1)+p.value.length)%p.value.length,a.nextTick(()=>m.value?.querySelector(`[id="${d.value}-${h.value}"]`)?.scrollIntoView?.({block:"nearest"})))}}}function K(){l.disabled||(r("change",""),x.value="",s.close())}return(g,B)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"root",ref:u,class:"mrp-remote-param"},[a.createElementVNode("div",{class:a.normalizeClass(["mrp-remote-control",{"is-invalid":e.invalid}])},[a.createVNode(M._sfc_main,{name:"search",size:14}),a.createElementVNode("input",{id:e.id,ref_key:"input",ref:o,type:"text",role:"combobox",autocomplete:"off",value:a.unref(f)?a.unref(w):x.value||e.value,maxlength:256,"aria-labelledby":`${e.id}-label`,"aria-invalid":e.invalid||void 0,"aria-required":e.def.required||void 0,"aria-describedby":e.invalid?`${e.id}-error`:a.unref(v)||a.unref(S)?`${e.id}-remote-status`:void 0,"aria-autocomplete":"list","aria-expanded":a.unref(f),"aria-controls":a.unref(f)?d.value:void 0,"aria-activedescendant":a.unref(f)&&a.unref(p).length?`${d.value}-${h.value}`:void 0,disabled:e.disabled||a.unref(v)||a.unref(S),placeholder:e.def.placeholder??(e.messages.paramSelectPlaceholder??"请选择{label}").replace("{label}",e.def.label??e.def.field),onClick:k,onInput:E,onCompositionend:E,onKeydown:z},null,40,ie),e.value?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button","aria-label":y.value.paramOptionsClear,disabled:e.disabled,onClick:K},[a.createVNode(M._sfc_main,{name:"close",size:12})],8,se)):(a.openBlock(),a.createElementBlock("button",{key:1,type:"button","aria-label":e.def.label??e.def.field,disabled:e.disabled||a.unref(v)||a.unref(S),onClick:B[0]||(B[0]=C=>a.unref(f)?a.unref(s).close():k())},[a.createVNode(M._sfc_main,{name:"chevron-down",size:12})],8,ce))],2),a.unref(v)||a.unref(S)?(a.openBlock(),a.createElementBlock("small",{key:0,id:`${e.id}-remote-status`,role:"status"},a.toDisplayString(t.value),9,de)):a.createCommentVNode("",!0),a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:1,ref_key:"panel",ref:m,class:"mrp-remote-options"},[a.createElementVNode("div",{id:d.value,role:"listbox","aria-label":e.def.label??e.def.field,"aria-busy":a.unref(b)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),(C,F)=>(a.openBlock(),a.createElementBlock("button",{id:`${d.value}-${F}`,key:C.value,type:"button",role:"option",tabindex:"-1","aria-selected":e.value===C.value,class:a.normalizeClass({active:F===h.value}),disabled:a.unref(b),onPointermove:W=>h.value=F,onMousedown:B[1]||(B[1]=a.withModifiers(()=>{},["prevent"])),onClick:W=>c(C)},[a.createElementVNode("span",null,a.toDisplayString(C.label),1),C.label!==C.value?(a.openBlock(),a.createElementBlock("small",pe,a.toDisplayString(C.value),1)):a.createCommentVNode("",!0)],42,fe))),128))],8,ue),t.value?(a.openBlock(),a.createElementBlock("p",me,[a.createTextVNode(a.toDisplayString(t.value),1),a.unref(P)?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",onClick:B[2]||(B[2]=(...C)=>a.unref(i).request&&a.unref(i).request(...C))},a.toDisplayString(e.messages.retry),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],512)):a.createCommentVNode("",!0)],512))}}),ge=M._export_sfc(ve,[["__scopeId","data-v-5dbac6ad"]]),be={key:0,class:"mrp-params-title"},ye={class:"mrp-params-grid"},he=["id"],Ee={key:0,class:"mrp-param-star","aria-hidden":"true"},ke=["value","disabled","aria-labelledby","aria-invalid","aria-describedby","aria-required","onChange"],we=["disabled","hidden"],Pe=["value"],Se=["aria-labelledby"],Ce=["value","disabled","min","max","aria-label","aria-invalid","aria-describedby","aria-required","onInput"],xe=["type","inputmode","maxlength","placeholder","value","disabled","min","max","step","aria-labelledby","aria-invalid","aria-describedby","aria-required","onInput"],Be=["id"],Ae={key:1,class:"mrp-params-actions"},Oe=["disabled"],Me=["disabled"],Re=a.defineComponent({__name:"ReportParamPanel",props:{defs:{},modelValue:{},messages:{},attempted:{type:Boolean},issues:{default:void 0},showActions:{type:Boolean,default:!0},showTitle:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},loadOptions:{type:Function,default:void 0}},emits:["update:modelValue","query","reset"],setup(e,{expose:n,emit:l}){const r=e,s=l,u=a.ref({...r.modelValue}),m=a.ref(null),f=ee();a.watch(()=>r.modelValue,o=>{u.value={...o}});const i=a.computed(()=>r.issues??D.validateReportParams(r.defs,u.value).issues),w=a.computed(()=>(Array.isArray(r.defs)?r.defs:[]).filter(o=>o&&typeof o.field=="string").map((o,d)=>({def:o,id:`${f}-${d}`,label:o.label??o.field,value:u.value[o.field]??"",error:r.attempted?i.value.find(t=>t.field===o.field):void 0}))),p=a.computed(()=>{const o=new Map;for(const d of r.defs)for(const t of Array.isArray(d.dependsOn)?d.dependsOn:[]){const c=o.get(t)??[];c.push(d.field),o.set(t,c)}return o});function b(o,d){if(r.disabled||u.value[o]===d)return;u.value={...u.value,[o]:d};const t=new Set([o]),c=[o];for(let E=0;E<c.length;E++)for(const k of p.value.get(c[E])??[])t.has(k)||(u.value[k]="",t.add(k),c.push(k));s("update:modelValue",{...u.value})}function P(o){return o.type==="number"?"number":o.type==="date"||o.type==="month"?o.type:"text"}function v(o,d){return o.split("/")[d]??""}function S(o,d,t){return t?!!v(o,0)!=!!v(o,1)?!v(o,d)||void 0:!0:void 0}function y(o,d,t){const c=[v(u.value[o]??"",0),v(u.value[o]??"",1)];c[d]=t,b(o,c.every(E=>!E)?"":c.join("/"))}function h(o){o.isComposing||s("query")}function x(){m.value?.querySelector('[aria-invalid="true"]')?.focus()}return n({focusInvalid:x}),(o,d)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"root",ref:m,class:"mrp-params"},[e.showTitle!==!1?(a.openBlock(),a.createElementBlock("span",be,a.toDisplayString(e.messages.paramsTitle),1)):a.createCommentVNode("",!0),a.createElementVNode("div",ye,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(w.value,t=>(a.openBlock(),a.createElementBlock("label",{key:t.id,class:a.normalizeClass(["mrp-param",{"mrp-param-missing":!!t.error}])},[a.createElementVNode("span",{id:`${t.id}-label`,class:"mrp-param-label"},[a.createTextVNode(a.toDisplayString(t.label),1),t.def.required?(a.openBlock(),a.createElementBlock("i",Ee,"*")):a.createCommentVNode("",!0)],8,he),t.def.optionsSource?(a.openBlock(),a.createBlock(ge,{key:0,id:t.id,def:t.def,value:t.value,values:u.value,"load-options":e.loadOptions,messages:e.messages,disabled:e.disabled,invalid:!!t.error,onChange:c=>b(t.def.field,c)},null,8,["id","def","value","values","load-options","messages","disabled","invalid","onChange"])):(t.def.type??"text")==="select"?(a.openBlock(),a.createElementBlock("select",{key:1,class:"mrp-param-input",value:t.value,disabled:e.disabled,"aria-labelledby":`${t.id}-label`,"aria-invalid":t.error?!0:void 0,"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onChange:c=>b(t.def.field,c.target.value),onKeydown:a.withKeys(h,["enter"])},[a.createElementVNode("option",{value:"",disabled:t.def.required,hidden:t.def.required},a.toDisplayString(t.def.placeholder??(e.messages.paramSelectPlaceholder??"请选择{label}").replace("{label}",t.label)),9,we),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.def.options??[],c=>(a.openBlock(),a.createElementBlock("option",{key:c.value,value:c.value},a.toDisplayString(c.label),9,Pe))),128))],40,ke)):t.def.type==="dateRange"?(a.openBlock(),a.createElementBlock("div",{key:2,class:"mrp-param-range",role:"group","aria-labelledby":`${t.id}-label`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList([e.messages.paramRangeStart??"开始日期",e.messages.paramRangeEnd??"结束日期"],(c,E)=>(a.openBlock(),a.createElementBlock("input",{key:E,class:"mrp-param-input",type:"date",value:v(t.value,E),disabled:e.disabled,min:t.def.min,max:t.def.max,"aria-label":`${t.label} · ${c}`,"aria-invalid":S(t.value,E,t.error),"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onInput:k=>y(t.def.field,E,k.target.value),onKeydown:a.withKeys(h,["enter"])},null,40,Ce))),128))],8,Se)):(a.openBlock(),a.createElementBlock("input",{key:3,class:"mrp-param-input",type:P(t.def),inputmode:t.def.type==="year"?"numeric":void 0,maxlength:t.def.type==="year"?4:void 0,placeholder:t.def.placeholder??(e.messages.paramTextPlaceholder??"请输入{label}").replace("{label}",t.label),value:t.value,disabled:e.disabled,min:t.def.min,max:t.def.max,step:t.def.type==="number"?"any":void 0,"aria-labelledby":`${t.id}-label`,"aria-invalid":t.error?!0:void 0,"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onInput:c=>b(t.def.field,c.target.value),onKeydown:a.withKeys(h,["enter"])},null,40,xe)),t.error?(a.openBlock(),a.createElementBlock("small",{key:4,id:`${t.id}-error`,class:"mrp-param-error",role:"status"},a.toDisplayString(a.unref($)(t.error,e.defs,e.messages)),9,Be)):a.createCommentVNode("",!0)],2))),128))]),e.showActions!==!1?(a.openBlock(),a.createElementBlock("div",Ae,[a.createElementVNode("button",{class:"mrp-nav mrp-param-query",type:"button",disabled:e.disabled,onClick:d[0]||(d[0]=t=>o.$emit("query"))},a.toDisplayString(e.messages.query),9,Oe),a.createElementVNode("button",{class:"mrp-nav",type:"button",disabled:e.disabled,onClick:d[1]||(d[1]=t=>o.$emit("reset"))},a.toDisplayString(e.messages.reset),9,Me)])):a.createCommentVNode("",!0)],512))}}),De=M._export_sfc(Re,[["__scopeId","data-v-5fa48e40"]]),N={calculationTitle:"选区计算",calculationLocal:"仅本地分析,不写回实绩、不重算原公式。请选取同一单位与量纲的数值。",calculationHint:"点击起点,Shift + 点击终点或方向键扩选。",calculationFormula:"计算方式",calculationExpression:"组合公式",calculationExpressionHint:"支持 SUM、AVERAGE/AVG、MIN、MAX、COUNT、MEDIAN 及 + - * / 和括号,不执行 Excel 公式;采用浮点数,精度仅用于展示。",calculationPrecision:"展示小数位",calculationRun:"计算选区",calculationCancel:"取消计算",calculationResult:"计算结果",calculationIncluded:"参与数值",calculationExcluded:"排除单元格",calculationEmpty:"选区没有可计算数值,计数为 0,其余结果为空。",calculationNoSelection:"先关闭设置并选择数据,再从底部工具栏打开选区计算。",calculationSum:"求和 SUM",calculationAverage:"平均值 AVERAGE",calculationMin:"最小值 MIN",calculationMax:"最大值 MAX",calculationCount:"数值计数 COUNT",calculationMedian:"中位数 MEDIAN",calculationCustom:"组合公式",calculationErrorSelection:"请选择同一明细区域中的数据。",calculationErrorLimit:"选区超过计算预算,请缩小范围后重试。",calculationErrorExpression:"公式无效,请使用支持的摘要名称、运算符与括号。",calculationErrorDivision:"除数不能为 0。",calculationErrorOverflow:"结果超出有效数值范围。",calculationErrorPrecision:"数值超出安全精度,或展示小数位不是 0 至 12 的整数。"};function Fe(e){const n={...N};for(const l of Object.keys(n)){const r=e[l];typeof r=="string"&&(n[l]=r)}return n}const H={...I,drillActions:"查看关联",drillOpening:"正在打开…",drillMissingValue:"当前单元格缺少关联参数",drillFailed:"关联内容打开失败,请重试",...L,...N,exportMenu:"导出",exportMenuDescription:"选择文件格式",clearSearch:"清除搜索",searchHint:"Enter 下一个 · Shift+Enter 上一个",searchNoMatches:"没有匹配内容",pageJump:"跳至页",pageJumpInvalid:"请输入有效页码",pageJumpHint:"Enter 跳转",pagination:"报表分页",recordNavigation:"标签记录",recordInfo:"记录 {cur} / {total}",prevRecord:"上一条记录",nextRecord:"下一条记录",dataExplanation:"来源数据说明",dataExplanationHint:"按字段查看来源与计算说明",dataExplanationSearch:"搜索说明、字段或记录",dataExplanationEmpty:"没有匹配的数据说明",dataMissingSource:"暂无来源",dataNotApplicable:"业务不适用",dataNotCalculable:"无法计算",columnSearchHint:"输入列名或字段标识",columnSearchShortcut:"↑ ↓ 选择 · Enter 定位",closeColumnDirectory:"关闭字段目录",columnResultsMore:"{count} 个匹配字段,显示前 {limit} 个;继续输入可缩小范围",columnCount:"{count} 个字段",settingsGeneral:"常规",settingsTools:"工具",settingsAdvanced:"高级",settingsAdvancedDescription:"按需开启分析能力,保持日常阅读简洁。",settingsCalculations:"启用选区计算",settingsCalculationsDescription:"选取数值后计算求和、平均值或组合公式,仅用于本地分析。",title:"报表预览",prevPage:"‹ 上一页",nextPage:"下一页 ›",pageInfo:"{cur} / {total}",fitWidth:"适宽",exportHtml:"导出 HTML",exportPdf:"导出 PDF",exportExcel:"导出 Excel",exportImage:"导出图片",exportWord:"导出 Word",exporting:"正在生成 {format}…",print:"打印",pdfWindow:"PDF 窗口",loading:"报表渲染中…",empty:"暂无预览数据",errorPrefix:"",retry:"重试",pdfFontUnavailable:"PDF 字体尚未就绪,请联系管理员检查字体配置;预览及其它导出仍可使用。",searchPlaceholder:"搜索报表内容",matchInfo:"{cur}/{total}",prevMatch:"‹",nextMatch:"›",thumbnails:"缩略图",paramsTitle:"查询条件",query:"查 询",reset:"重 置",paramRequired:"请填写{label}",paramInvalid:"{label}:{message}",paramPrompt:"请先完善查询条件",paramPromptDescription:"填写必填条件后点击查询,即可生成报表。",paramSelectPlaceholder:"请选择{label}",paramTextPlaceholder:"请输入{label}",paramRangeStart:"开始日期",paramRangeEnd:"结束日期",searching:"搜索中…",importExcel:"导入 Excel 模板",importing:"正在导入 Excel…",editCell:"编辑单元格",editingHint:"双击单元格编辑 · Enter 确认 · Esc 取消",saving:"正在保存修改…",editInvalidNumber:"请输入有效数字;清空表示无值",editInvalidBoolean:"请输入 true / false、是 / 否或 1 / 0",editConflict:"该单元格已变化,请重新打开编辑",settings:"设置",settingsDisplay:"阅读工具",settingsExport:"导出与打印",settingsData:"数据操作",settingsUnavailable:"需由接入方配置启用",settingsReset:"恢复默认",settingsClose:"关闭设置",search:"内容搜索",closeSearch:"关闭搜索",prevSearchMatch:"上一个匹配",nextSearchMatch:"下一个匹配",zoom:"缩放工具",settingsLocal:"按需启用工具,仅作用于当前预览。",editingLocal:"修改为本地草稿;不会自动写入业务数据库。",editingSaved:"修改将通过接入方配置的保存回调提交。",importLocal:"导入仅生成本地预览,不自动替换业务数据。",emptyDescription:"当前查询没有明细,请调整查询条件后重试。",undo:"撤销",redo:"重做",restoreChanges:"恢复来源值",changes:"修改明细",changesCount:"{count} 处修改",changesEmpty:"尚无修改",changesBefore:"来源值",changesAfter:"当前值",editAtomicRequired:"批量保存需要接入方提供原子 saveBatch 回调;本次未写入任何单元格。",clipboardLimit:"单次最多粘贴 10000 个单元格,请分批处理。",preferencesError:"偏好存储不可用,设置仍在当前预览中生效。",freezeHeaders:"冻结表头",frozenColumns:"冻结前列",sections:"工作表与章节",locateField:"定位字段",locateFieldPlaceholder:"输入字段标识,Enter 定位",locateFieldMissing:"未找到该字段,请核对字段标识。",importSummary:"Excel 导入摘要",importPreserved:"已导入 {sheets} 个工作表,保留内容、合并和样式。",importWarnings:"兼容性提示",importReadOnly:"公式、日期及受保护单元格保持只读;公式不重算。",conflicts:"保存冲突",editReadOnly:"选区包含只读或无权限单元格,本次修改未应用。",editMissing:"选区超出报表范围或缺少业务来源,请重新选择。",editRecalculationUnavailable:"此报表缺少重算会话或稳定数据来源,暂不支持编辑;请使用 reports/本地数据源重新加载。",editDuplicate:"选区包含同一业务字段的重复单元格,请缩小选区。",clipboardInvalid:"剪贴板内容无法识别,请使用矩形表格文本重新粘贴。",editSaved:"修改已通过保存回调确认",settingsPanes:"冻结窗格",columnDirectory:"字段目录",columnSearch:"搜索列名或字段",columnNoMatches:"未找到匹配字段",columnResults:"匹配字段",columnGroup:"明细区域",discardTitle:"保留当前修改?",discardDescription:"当前报表有尚未保存的输入或本地草稿,继续操作将替换这些内容。",discardKeep:"继续编辑",discardProceed:"放弃修改并继续",taskQuery:"正在获取数据…",taskValidate:"正在校验数据…",taskLayout:"正在生成版式…",taskAssets:"正在准备图片和字体…",taskEncode:"正在生成文件…",taskDownload:"正在准备下载…",taskPrint:"正在准备打印…",taskCancel:"取消任务",taskCancelled:"任务已取消,可重新操作。",diagnosticsSearch:"搜索提示、错误码或位置",diagnosticsMore:"共 {count} 条匹配,当前展示前 100 条;请搜索缩小范围。",diagnosticsTitle:"输出兼容性提示",diagnosticsLocate:"定位",diagnosticsLocation:"第 {page} 页 · 组件 {component}",diagnosticsStrict:"当前格式存在已知内容降级,请查看兼容性提示或选择其他输出格式。",diagnosticsDetails:"查看技术详情",diagnosticMissingImage:"图片或图表资源尚未准备完成,请重试或联系管理员。",diagnosticUnsupported:"当前输出格式会省略此内容,建议选择 PDF 或图片格式。",diagnosticUnsupportedStyle:"当前格式无法保留部分样式,请查看位置并选择适合的输出格式。",diagnosticImageFormat:"当前图片格式无法直接导出,请转换资源后重试。",diagnosticRichText:"文字内容会保留,部分字体与段落样式将简化。",diagnosticNested:"单元格中的嵌套内容会省略,单元格文字会保留。",diagnosticImageAsync:"图片需要完成加载后才能输出。",diagnosticImageDecode:"图片加载失败,请检查资源后重试。",diagnosticAssetFailed:"图表或图片生成失败,请重试或联系管理员。",diagnosticAssetBudget:"图片资源超出处理范围,请减少资源或缩小报表范围。"},G={emptyAccent:"#79a7e8",shellBg:"#f4f7fc",shellFg:"#334155",toolbarBg:"#ffffff",toolbarBorder:"#e4eaf3",toolbarFg:"#334155",btnFg:"#526078",btnBorder:"#dbe3ef",btnHoverBg:"#edf3ff",btnHoverFg:"#315fba",btnActiveBg:"#3569d4"};function j(e={}){return{...e,defaults:e.defaults??{},presets:e.presets??{}}}function Te(e){return e}const A={showExport:!0,showPrint:!0,showPdfWindow:!0,showSettings:!0,showParams:!0,gapPx:18,pdfFontUrl:"/simhei.ttf",logger:console},Ie={warn:()=>{},info:()=>{}};function Ne(e,n){if(!(!e&&!n))return{...e,...n,calibration:{...e?.calibration,...n?.calibration}}}function R(e,n){return{...e,...n,theme:{...e?.theme,...n?.theme},messages:{...e?.messages,...n?.messages},preview:{...e?.preview,...n?.preview},xlsx:{...e?.xlsx,...n?.xlsx},toolbar:{...e?.toolbar,...n?.toolbar},interaction:{...e?.interaction,...n?.interaction},output:{...e?.output,...n?.output},printOptions:Ne(e?.printOptions,n?.printOptions)}}function qe(e){return{showExport:e.showExport??A.showExport,showPrint:e.showPrint??A.showPrint,showPdfWindow:e.showPdfWindow??A.showPdfWindow,showSettings:e.showSettings??A.showSettings,showParams:e.showParams??A.showParams,gapPx:e.gapPx??A.gapPx}}function Le(e,n){const l=n?e?.presets?.[n]:e?.defaultPreset?e?.presets?.[e.defaultPreset]:void 0,r=R(e?.defaults,l);return{drill:r.drill,exportExecution:r.exportExecution,loadParamOptions:r.loadParamOptions,...qe(r),pdfFontUrl:r.pdfFontUrl??A.pdfFontUrl,theme:{...G,...r.theme},messages:{...H,...r.messages},logger:r.logger??A.logger,preview:{overscanPages:q(r.preview?.overscanPages,1,10,!0),searchDebounceMs:q(r.preview?.searchDebounceMs,200,2e3)},xlsx:{...r.xlsx},editable:r.editable??!1,excelImport:r.excelImport??!1,toolbar:{...r.toolbar},interaction:{...r.interaction},preferences:r.preferences,assets:r.assets,guardChanges:r.guardChanges??!0,beforeDiscard:r.beforeDiscard,output:{...r.output},printOptions:r.printOptions}}function q(e,n,l,r=!1){if(e==null||!Number.isFinite(e))return n;const s=Math.max(0,Math.min(l,e));return r?Math.floor(s):s}function Ve(e){const n={};return e.emptyAccent!=null&&(n["--mrp-empty-accent"]=e.emptyAccent),e.shellBg!=null&&(n["--mrp-shell-bg"]=e.shellBg),e.shellFg!=null&&(n["--mrp-shell-fg"]=e.shellFg),e.toolbarBg!=null&&(n["--mrp-toolbar-bg"]=e.toolbarBg),e.toolbarBorder!=null&&(n["--mrp-toolbar-border"]=e.toolbarBorder),e.toolbarFg!=null&&(n["--mrp-toolbar-fg"]=e.toolbarFg),e.btnFg!=null&&(n["--mrp-btn-fg"]=e.btnFg),e.btnBorder!=null&&(n["--mrp-btn-border"]=e.btnBorder),e.btnHoverBg!=null&&(n["--mrp-btn-hover-bg"]=e.btnHoverBg),e.btnHoverFg!=null&&(n["--mrp-btn-hover-fg"]=e.btnHoverFg),e.btnActiveBg!=null&&(n["--mrp-btn-active-bg"]=e.btnActiveBg),n}function $e(e){const n=a.inject(T.MACH_REPORT_CONFIG_KEY,null),l=a.computed(()=>{const r=n?.value??null,s="defaults"in e||"presets"in e||"defaultPreset"in e?j(e):{defaults:e,presets:{}};if(!r)return s;const u={...r.presets,...s.presets};for(const m of Object.keys(u))u[m]=R(R(r.presets[m],s.defaults),s.presets[m]);return{defaults:R(r.defaults,s.defaults),presets:u,defaultPreset:s.defaultPreset??r.defaultPreset}});a.provide(T.MACH_REPORT_CONFIG_KEY,l)}function Ue(){return a.inject(T.MACH_REPORT_CONFIG_KEY,a.computed(()=>null))}exports.DEFAULT_CALCULATION_MESSAGES=N;exports.DEFAULT_MESSAGES=H;exports.DEFAULT_PRINT_MESSAGES=L;exports.DEFAULT_THEME=G;exports.MachReportError=O;exports.PARAM_OPTIONS_MESSAGES=I;exports.ReportParamPanel=De;exports.SILENT_LOGGER=Ie;exports.defineMachReportConfig=j;exports.defineMachReportPreset=Te;exports.normalizeReportLoadError=Q;exports.printCalibration=J;exports.provideMachReportConfig=$e;exports.resolveCalculationMessages=Fe;exports.resolveConfig=Le;exports.snapshotPrintOptions=Y;exports.themeToCssVars=Ve;exports.toErrorDetail=X;exports.useMachReportConfig=Ue;exports.usePopover=V;exports.useReportParams=ae;