@agile-team/mach-report 2.3.0 → 2.3.1

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 (42) hide show
  1. package/README.md +18 -3
  2. package/dist/ReportPreview-B-mwUSk9.cjs +6 -0
  3. package/dist/{ReportPreview-CwTGfyTq.js → ReportPreview-DKjr4cwO.js} +628 -619
  4. package/dist/defaults-D4o0NCLo.js +9 -0
  5. package/dist/defaults-DOO1yHwx.cjs +1 -0
  6. package/dist/grid-geometry-Dw7BlENr.js +130 -0
  7. package/dist/grid-geometry-bkciiZ4Q.cjs +1 -0
  8. package/dist/index.cjs +6 -6
  9. package/dist/index.d.cts +8 -2
  10. package/dist/index.d.ts +8 -2
  11. package/dist/index.js +1067 -995
  12. package/dist/pdf.cjs +48 -48
  13. package/dist/pdf.d.cts +2 -0
  14. package/dist/pdf.d.ts +2 -0
  15. package/dist/pdf.js +5605 -5575
  16. package/dist/{plugin-MSh_OhoW.cjs → plugin-2lqgTX26.cjs} +1 -1
  17. package/dist/{plugin-uoO9VA6O.js → plugin-5R00MJQs.js} +1 -1
  18. package/dist/render-plan-CfJ3wf1l.cjs +1 -0
  19. package/dist/render-plan-I9AHvQv7.js +13 -0
  20. package/dist/sql.cjs +42 -42
  21. package/dist/sql.js +1366 -1363
  22. package/dist/style.css +1 -1
  23. package/dist/textwrap-nH0UYU6D.js +108 -0
  24. package/dist/textwrap-oD-t4b4B.cjs +4 -0
  25. package/dist/vue/async.d.cts +5 -3
  26. package/dist/vue/async.d.ts +5 -3
  27. package/dist/vue/index.d.cts +6 -4
  28. package/dist/vue/index.d.ts +6 -4
  29. package/dist/vue-async.cjs +1 -1
  30. package/dist/vue-async.js +3 -3
  31. package/dist/vue.cjs +1 -1
  32. package/dist/vue.js +4 -4
  33. package/dist/xlsx.cjs +23 -23
  34. package/dist/xlsx.d.cts +2 -0
  35. package/dist/xlsx.d.ts +2 -0
  36. package/dist/xlsx.js +6118 -6085
  37. package/package.json +1 -1
  38. package/dist/ReportPreview-CLENbOCL.cjs +0 -6
  39. package/dist/grid-geometry-CWmJ9c9y.js +0 -130
  40. package/dist/grid-geometry-DBH9ExuY.cjs +0 -1
  41. package/dist/textwrap-BQyrpYSR.js +0 -117
  42. package/dist/textwrap-DqiFwAV3.cjs +0 -3
@@ -1,11 +1,12 @@
1
- import { computed as k, unref as x, ref as B, onScopeDispose as He, getCurrentScope as Ht, watch as Q, shallowRef as Ie, defineComponent as rt, nextTick as qt, openBlock as P, createElementBlock as $, createElementVNode as F, toDisplayString as M, Fragment as Ee, createCommentVNode as N, normalizeClass as oe, renderList as We, createTextVNode as et, withKeys as mt, inject as Be, provide as yt, useCssVars as Nt, watchEffect as vt, onMounted as jt, onUnmounted as Ut, normalizeStyle as re, createBlock as Vt, createVNode as Kt, renderSlot as Yt } from "vue";
1
+ import { computed as k, unref as x, ref as B, onScopeDispose as He, getCurrentScope as Ht, watch as Q, shallowRef as Ie, defineComponent as rt, nextTick as qt, openBlock as P, createElementBlock as $, createElementVNode as F, toDisplayString as C, Fragment as Ee, createCommentVNode as H, normalizeClass as oe, renderList as We, createTextVNode as et, withKeys as mt, inject as Be, provide as yt, useCssVars as Nt, watchEffect as vt, onMounted as jt, onUnmounted as Ut, normalizeStyle as re, createBlock as Vt, createVNode as Kt, renderSlot as Yt } from "vue";
2
2
  import { renderPlanToImages as Zt, renderPage as xt, validateRenderPlan as Jt, ReportSourceError as Gt, renderPlanToCanvas as Xt } from "@agile-team/mach-report";
3
3
  import { c as Pt } from "./page-window-index-CIuT4BAv.js";
4
- import { b as tt, c as Qt, d as _t, a as en } from "./plugin-uoO9VA6O.js";
4
+ import { i as Qt, a as _t } from "./render-plan-I9AHvQv7.js";
5
+ import { b as tt, c as en, d as tn, a as nn } from "./plugin-5R00MJQs.js";
5
6
  function Et(e) {
6
7
  return e == null ? [] : Array.isArray(e) ? e.map(String).filter((t) => t !== "") : String(e).split(",").map((t) => t.trim()).filter((t) => t !== "");
7
8
  }
8
- function mr(e) {
9
+ function yr(e) {
9
10
  return Et(e).join(",");
10
11
  }
11
12
  class _e extends Error {
@@ -13,14 +14,14 @@ class _e extends Error {
13
14
  super(t), this.name = "PlanLoadError";
14
15
  }
15
16
  }
16
- function vr(e = {}) {
17
- const { baseUrl: t = "", headers: s, credentials: o, timeoutMs: n = 3e4 } = e, r = t.replace(/\/+$/, "");
17
+ function xr(e = {}) {
18
+ const { baseUrl: t = "", headers: a, credentials: r, timeoutMs: n = 3e4 } = e, o = t.replace(/\/+$/, "");
18
19
  return async ({ url: l, method: u, params: p, signal: m }) => {
19
- let c = `${r}${l}`;
20
+ let d = `${o}${l}`;
20
21
  if (p && Object.keys(p).length > 0) {
21
- const b = c.indexOf("#"), I = b >= 0 ? c.slice(b) : "", E = b >= 0 ? c.slice(0, b) : c, D = E.indexOf("?"), S = D >= 0 ? E.slice(0, D) : E, C = new URLSearchParams(D >= 0 ? E.slice(D + 1) : "");
22
- for (const [H, j] of Object.entries(p)) C.set(H, j);
23
- c = `${S}?${C}${I}`;
22
+ const b = d.indexOf("#"), I = b >= 0 ? d.slice(b) : "", E = b >= 0 ? d.slice(0, b) : d, D = E.indexOf("?"), S = D >= 0 ? E.slice(0, D) : E, M = new URLSearchParams(D >= 0 ? E.slice(D + 1) : "");
23
+ for (const [q, K] of Object.entries(p)) M.set(q, K);
24
+ d = `${S}?${M}${I}`;
24
25
  }
25
26
  const f = (b, I) => {
26
27
  const E = new _e(b);
@@ -38,10 +39,10 @@ function vr(e = {}) {
38
39
  h.signal.aborted || (v = "timeout", h.abort());
39
40
  }, n);
40
41
  try {
41
- const b = await fetch(c, {
42
+ const b = await fetch(d, {
42
43
  method: u.toUpperCase(),
43
- headers: { Accept: "application/json", ...s },
44
- credentials: o,
44
+ headers: { Accept: "application/json", ...a },
45
+ credentials: r,
45
46
  signal: h.signal
46
47
  });
47
48
  if (!b.ok)
@@ -54,19 +55,19 @@ function vr(e = {}) {
54
55
  }
55
56
  };
56
57
  }
57
- function tn(e, t, s = {}) {
58
- const o = s.pxPerMm ?? 3.7795275590551185, n = k(() => Math.max(0, x(s.gapPx) ?? 18)), r = B(0), l = B(800), u = k(() => {
58
+ function rn(e, t, a = {}) {
59
+ const r = a.pxPerMm ?? 3.7795275590551185, n = k(() => Math.max(0, x(a.gapPx) ?? 18)), o = B(0), l = B(800), u = k(() => {
59
60
  const b = e.value?.pages ?? [];
60
- return Pt(b.map((I) => I.pageHeightMm * o), n.value);
61
+ return Pt(b.map((I) => I.pageHeightMm * r), n.value);
61
62
  }), p = k(() => {
62
63
  let b = 0;
63
- for (const I of e.value?.pages ?? []) b = Math.max(b, I.pageWidthMm * o);
64
+ for (const I of e.value?.pages ?? []) b = Math.max(b, I.pageWidthMm * r);
64
65
  return { w: b, h: u.value.totalHeightPx };
65
66
  }), m = k(() => u.value.window(
66
67
  l.value / t.value,
67
- r.value / t.value,
68
- x(s.overscan) ?? 1
69
- )), c = k(() => {
68
+ o.value / t.value,
69
+ x(a.overscan) ?? 1
70
+ )), d = k(() => {
70
71
  const b = e.value;
71
72
  if (!b) return [];
72
73
  const { start: I, end: E } = m.value;
@@ -74,7 +75,7 @@ function tn(e, t, s = {}) {
74
75
  });
75
76
  let f = 0, h = !1;
76
77
  function v(b) {
77
- b && (r.value = b.scrollTop, l.value = b.clientHeight || 800);
78
+ b && (o.value = b.scrollTop, l.value = b.clientHeight || 800);
78
79
  }
79
80
  function A(b, I) {
80
81
  return (E) => {
@@ -91,219 +92,219 @@ function tn(e, t, s = {}) {
91
92
  return He(W), {
92
93
  contentSize: p,
93
94
  windowRange: m,
94
- visiblePages: c,
95
+ visiblePages: d,
95
96
  makeScrollHandler: A,
96
97
  refreshViewport: v,
97
98
  pageOffsetPx: (b) => u.value.offsetAt(b),
98
99
  destroy: W
99
100
  };
100
101
  }
101
- function nn(e) {
102
- const t = B(1), s = B("fit");
103
- let o = 0;
102
+ function on(e) {
103
+ const t = B(1), a = B("fit");
104
+ let r = 0;
104
105
  function n() {
105
- o && cancelAnimationFrame(o), o = 0;
106
+ r && cancelAnimationFrame(r), r = 0;
106
107
  }
107
- function r() {
108
- n(), o = requestAnimationFrame(() => {
109
- if (o = 0, s.value !== "fit") return;
108
+ function o() {
109
+ n(), r = requestAnimationFrame(() => {
110
+ if (r = 0, a.value !== "fit") return;
110
111
  const u = e();
111
112
  !u?.viewport || u.viewport.clientWidth <= 48 || !Number.isFinite(u.pageWidthPx) || (t.value = Math.min(1, (u.viewport.clientWidth - 48) / Math.max(1, u.pageWidthPx)));
112
113
  });
113
114
  }
114
115
  function l(u) {
115
116
  if (u === "fit")
116
- s.value = "fit", r();
117
+ a.value = "fit", o();
117
118
  else {
118
119
  if (!Number.isFinite(u)) return;
119
- n(), s.value = "raw", t.value = Math.min(3, Math.max(0.3, u / 100));
120
+ n(), a.value = "raw", t.value = Math.min(3, Math.max(0.3, u / 100));
120
121
  }
121
122
  }
122
- return Ht() && He(n), { zoom: t, zoomMode: s, applyFitZoom: r, setZoom: l };
123
+ return Ht() && He(n), { zoom: t, zoomMode: a, applyFitZoom: o, setZoom: l };
123
124
  }
124
125
  const Ae = 8;
125
126
  function Le() {
126
127
  return new Promise((e) => setTimeout(e, 0));
127
128
  }
128
- function Oe(e) {
129
- return `p${Math.round(e.pageWidthMm)}x${Math.round(e.pageHeightMm)}`;
129
+ function De(e) {
130
+ return `p${e.pageWidthMm}x${e.pageHeightMm}`.replace(/[.+]/g, "_");
130
131
  }
131
132
  function ot(e) {
132
133
  const t = /* @__PURE__ */ new Map();
133
134
  return e.pages.forEach((n) => {
134
- t.has(Oe(n)) || t.set(Oe(n), n);
135
+ t.has(De(n)) || t.set(De(n), n);
135
136
  }), `<!doctype html><html><head><meta charset="utf-8"><style>${`.mr-page{margin:0 auto;page-break-after:always;}
136
137
  .mr-page tr{break-inside:avoid;page-break-inside:avoid;}
137
138
  .mr-comp{break-inside:avoid;page-break-inside:avoid;}
138
139
  ${[...t.values()].map(
139
- (n) => `@page ${Oe(n)}{size:${Math.round(n.pageWidthMm)}mm ${Math.round(n.pageHeightMm)}mm;margin:0;}`
140
+ (n) => `@page ${De(n)}{size:${n.pageWidthMm}mm ${n.pageHeightMm}mm;margin:0;}`
140
141
  ).join(`
141
142
  `)}
142
143
  body{margin:0;background:#fff;}`}</style></head><body>`;
143
144
  }
144
145
  function at(e) {
145
146
  const t = xt(e, 96, {}, document);
146
- return t.style.page = Oe(e), t.outerHTML;
147
+ return t.style.page = De(e), t.outerHTML;
147
148
  }
148
149
  function $t(e) {
149
150
  return { head: ot(e), pageChunks: e.pages.map(at) };
150
151
  }
151
- async function hr(e, t = {}) {
152
- const s = {
152
+ async function Pr(e, t = {}) {
153
+ const a = {
153
154
  schemaVersion: "mach-report-batch-print",
154
155
  pages: e.flatMap((l) => l.pages)
155
156
  };
156
- if (s.pages.length === 0) return;
157
- const o = ot(s), n = document.createElement("iframe");
157
+ if (a.pages.length === 0) return;
158
+ const r = ot(a), n = document.createElement("iframe");
158
159
  n.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(n);
159
- let r = !1;
160
+ let o = !1;
160
161
  try {
161
162
  const l = n.contentDocument;
162
- l.open(), l.write(o);
163
- for (let u = 0; u < s.pages.length; u++)
164
- l.write(at(s.pages[u])), u % Ae === Ae - 1 && (t.onProgress?.(u + 1, s.pages.length), await Le());
165
- l.write("</body></html>"), l.close(), await Le(), t.onProgress?.(s.pages.length, s.pages.length), r = !0, n.contentWindow?.focus(), n.contentWindow?.print();
163
+ l.open(), l.write(r);
164
+ for (let u = 0; u < a.pages.length; u++)
165
+ l.write(at(a.pages[u])), u % Ae === Ae - 1 && (t.onProgress?.(u + 1, a.pages.length), await Le());
166
+ l.write("</body></html>"), l.close(), await Le(), t.onProgress?.(a.pages.length, a.pages.length), o = !0, n.contentWindow?.focus(), n.contentWindow?.print();
166
167
  } catch (l) {
167
168
  t.onError?.(l instanceof Error ? `批量打印失败: ${l.message}` : "批量打印失败");
168
169
  } finally {
169
- r ? setTimeout(() => n.remove(), 6e4) : n.remove();
170
+ o ? setTimeout(() => n.remove(), 6e4) : n.remove();
170
171
  }
171
172
  }
172
- function rn(e) {
173
- const { head: t, pageChunks: s } = $t(e);
173
+ function an(e) {
174
+ const { head: t, pageChunks: a } = $t(e);
174
175
  return {
175
- html: `${`<!doctype html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="utf-8"><!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:Zoom>100</w:Zoom></w:WordDocument></xml><![endif]-->${t.replace(/^<!doctype html><html><head>/, "")}`}${s.join("")}</body></html>`,
176
+ html: `${`<!doctype html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="utf-8"><!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:Zoom>100</w:Zoom></w:WordDocument></xml><![endif]-->${t.replace(/^<!doctype html><html><head>/, "")}`}${a.join("")}</body></html>`,
176
177
  filename: "mach-report.doc"
177
178
  };
178
179
  }
179
- function on(e, t) {
180
- let s = null, o = !1, n = !1, r = 0;
180
+ function sn(e, t) {
181
+ let a = null, r = !1, n = !1, o = 0;
181
182
  const l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
182
- let p = null, m = null, c = null, f = null, h = null;
183
- function v(a, d) {
184
- return !n && e.value === a && r === d;
183
+ let p = null, m = null, d = null, f = null, h = null;
184
+ function v(s, c) {
185
+ return !n && e.value === s && o === c;
185
186
  }
186
187
  function A() {
187
188
  if (n) return;
188
- const a = [...l.values()].reverse().find((d) => v(d.plan, d.epoch))?.format ?? null;
189
- a !== p && (p = a, t.onBusy?.(a));
189
+ const s = [...l.values()].reverse().find((c) => v(c.plan, c.epoch))?.format ?? null;
190
+ s !== p && (p = s, t.onBusy?.(s));
190
191
  }
191
- function W(a, d, y) {
192
+ function W(s, c, y) {
192
193
  const R = {};
193
- return l.set(R, { plan: a, epoch: d, format: y }), A(), R;
194
+ return l.set(R, { plan: s, epoch: c, format: y }), A(), R;
194
195
  }
195
- function b(a) {
196
- l.delete(a), A();
196
+ function b(s) {
197
+ l.delete(s), A();
197
198
  }
198
199
  function I() {
199
- for (const [a, d] of u)
200
- v(d.plan, d.epoch) || (a.close(), u.delete(a));
200
+ for (const [s, c] of u)
201
+ v(c.plan, c.epoch) || (s.close(), u.delete(s));
201
202
  }
202
203
  const E = Q(e, () => {
203
- r++, A(), I();
204
+ o++, D(), A(), I();
204
205
  }, { flush: "sync" });
205
206
  function D() {
206
- s?.remove(), s = null;
207
+ a?.remove(), a = null;
207
208
  }
208
209
  function S() {
209
- n = !0, r++, E(), D(), I(), l.clear(), t.onPrinting?.(!1);
210
+ n = !0, o++, E(), D(), I(), l.clear(), t.onPrinting?.(!1);
210
211
  }
211
- function C(a, d) {
212
- const y = URL.createObjectURL(a);
212
+ function M(s, c) {
213
+ const y = URL.createObjectURL(s);
213
214
  setTimeout(() => URL.revokeObjectURL(y), 1e4);
214
215
  const R = document.createElement("a");
215
- R.href = y, R.download = d, R.click();
216
+ R.href = y, R.download = c, R.click();
216
217
  }
217
- async function H() {
218
- if (o) return;
219
- const a = e.value;
220
- if (n || !a || a.pages.length === 0) return;
221
- const d = r;
222
- o = !0, t.onPrinting?.(!0), D();
223
- const y = ot(a);
224
- s = document.createElement("iframe"), s.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(s);
225
- const R = s;
218
+ async function q() {
219
+ if (r) return;
220
+ const s = e.value;
221
+ if (n || !s || s.pages.length === 0) return;
222
+ const c = o;
223
+ r = !0, t.onPrinting?.(!0), D();
224
+ const y = ot(s);
225
+ a = document.createElement("iframe"), a.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(a);
226
+ const R = a;
226
227
  try {
227
228
  const T = R.contentDocument;
228
229
  T.open(), T.write(y);
229
- for (let K = 0; K < a.pages.length; K++)
230
- if (T.write(at(a.pages[K])), K % Ae === Ae - 1 && await Le(), R !== s) return;
231
- if (T.write("</body></html>"), T.close(), await Le(), !v(a, d) || R !== s) return;
230
+ for (let U = 0; U < s.pages.length; U++)
231
+ if (T.write(at(s.pages[U])), U % Ae === Ae - 1 && await Le(), R !== a) return;
232
+ if (T.write("</body></html>"), T.close(), await Le(), !v(s, c) || R !== a) return;
232
233
  R.contentWindow?.focus(), R.contentWindow?.print();
233
234
  } catch {
234
- R === s && D(), v(a, d) && t.onError("调用打印失败,请改用导出 PDF", "print");
235
+ R === a && D(), v(s, c) && t.onError("调用打印失败,请改用导出 PDF", "print");
235
236
  } finally {
236
- o = !1, n || t.onPrinting?.(!1);
237
+ r = !1, n || t.onPrinting?.(!1);
237
238
  }
238
239
  }
239
- function j(a, d) {
240
- if (m?.plan === a && m.epoch === d) return m.promise;
240
+ function K(s, c) {
241
+ if (m?.plan === s && m.epoch === c) return m.promise;
241
242
  const y = Promise.resolve().then(() => {
242
- if (!v(a, d)) throw new Error("报表已切换或卸载");
243
- return t.getPdfExporter()(a, (R) => {
244
- v(a, d) && t.onWarning?.(R);
243
+ if (!v(s, c)) throw new Error("报表已切换或卸载");
244
+ return t.getPdfExporter()(s, (R) => {
245
+ v(s, c) && t.onWarning?.(R);
245
246
  });
246
247
  }).finally(() => {
247
248
  m?.promise === y && (m = null);
248
249
  });
249
- return m = { plan: a, epoch: d, promise: y }, y;
250
+ return m = { plan: s, epoch: c, promise: y }, y;
250
251
  }
251
- async function q() {
252
- const a = e.value;
253
- if (n || !a || a.pages.length === 0) return;
254
- const d = r;
255
- if (c?.plan === a && c.epoch === d) return c.promise;
256
- const y = W(a, d, "PDF"), R = (async () => {
252
+ async function V() {
253
+ const s = e.value;
254
+ if (n || !s || s.pages.length === 0) return;
255
+ const c = o;
256
+ if (d?.plan === s && d.epoch === c) return d.promise;
257
+ const y = W(s, c, "PDF"), R = (async () => {
257
258
  try {
258
- const T = await j(a, d);
259
- if (!v(a, d)) return;
260
- C(new Blob([T], { type: "application/pdf" }), "mach-report.pdf");
259
+ const T = await K(s, c);
260
+ if (!v(s, c)) return;
261
+ M(new Blob([T], { type: "application/pdf" }), "mach-report.pdf");
261
262
  } catch (T) {
262
- v(a, d) && t.onError(T instanceof Error ? `PDF 导出失败: ${T.message}` : "PDF 导出失败", "pdf");
263
+ v(s, c) && t.onError(T instanceof Error ? `PDF 导出失败: ${T.message}` : "PDF 导出失败", "pdf");
263
264
  } finally {
264
- b(y), c?.token === y && (c = null);
265
+ b(y), d?.token === y && (d = null);
265
266
  }
266
267
  })();
267
- return c = { plan: a, epoch: d, promise: R, token: y }, R;
268
+ return d = { plan: s, epoch: c, promise: R, token: y }, R;
268
269
  }
269
270
  async function Y() {
270
- const a = e.value;
271
- if (n || !a || a.pages.length === 0) return;
272
- const d = r;
273
- if (f?.plan === a && f.epoch === d) return f.promise;
274
- const y = { ...t.getXlsxOptions?.() }, R = W(a, d, "Excel"), T = (async () => {
271
+ const s = e.value;
272
+ if (n || !s || s.pages.length === 0) return;
273
+ const c = o;
274
+ if (f?.plan === s && f.epoch === c) return f.promise;
275
+ const y = { ...t.getXlsxOptions?.() }, R = W(s, c, "Excel"), T = (async () => {
275
276
  try {
276
- const { renderPlanToXlsx: K } = await import("@agile-team/mach-report/xlsx");
277
- if (!v(a, d)) return;
278
- const { buffer: J, warnings: G } = await K(a, y);
279
- if (!v(a, d) || (G.length > 0 && t.onWarning?.(`Excel 导出有 ${G.length} 条提示:${G.slice(0, 2).join(";")}`), !v(a, d))) return;
280
- C(new Blob([J], {
277
+ const { renderPlanToXlsx: U } = await import("@agile-team/mach-report/xlsx");
278
+ if (!v(s, c)) return;
279
+ const { buffer: J, warnings: G } = await U(s, y);
280
+ if (!v(s, c) || (G.length > 0 && t.onWarning?.(`Excel 导出有 ${G.length} 条提示:${G.slice(0, 2).join(";")}`), !v(s, c))) return;
281
+ M(new Blob([J], {
281
282
  type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
282
283
  }), "mach-report.xlsx");
283
- } catch (K) {
284
- v(a, d) && t.onError(K instanceof Error ? `Excel 导出失败: ${K.message}` : "Excel 导出失败", "export");
284
+ } catch (U) {
285
+ v(s, c) && t.onError(U instanceof Error ? `Excel 导出失败: ${U.message}` : "Excel 导出失败", "export");
285
286
  } finally {
286
287
  b(R), f?.token === R && (f = null);
287
288
  }
288
289
  })();
289
- return f = { plan: a, epoch: d, promise: T, token: R }, T;
290
+ return f = { plan: s, epoch: c, promise: T, token: R }, T;
290
291
  }
291
292
  async function O() {
292
- const a = e.value;
293
- if (n || !a || a.pages.length === 0) return;
294
- const d = r;
295
- if (h?.plan === a && h.epoch === d) return h.promise;
296
- const y = W(a, d, "图片"), R = (async () => {
293
+ const s = e.value;
294
+ if (n || !s || s.pages.length === 0) return;
295
+ const c = o;
296
+ if (h?.plan === s && h.epoch === c) return h.promise;
297
+ const y = W(s, c, "图片"), R = (async () => {
297
298
  try {
298
- const { blobs: T } = await Zt(a, {
299
+ const { blobs: T } = await Zt(s, {
299
300
  dpr: Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1)
300
301
  });
301
- if (!v(a, d)) return;
302
- T.forEach((K, J) => {
303
- C(K, T.length > 1 ? `mach-report-page-${J + 1}.png` : "mach-report.png");
302
+ if (!v(s, c)) return;
303
+ T.forEach((U, J) => {
304
+ M(U, T.length > 1 ? `mach-report-page-${J + 1}.png` : "mach-report.png");
304
305
  });
305
306
  } catch (T) {
306
- v(a, d) && t.onError(
307
+ v(s, c) && t.onError(
307
308
  T instanceof Error ? `图片导出失败: ${T.message}` : "图片导出失败",
308
309
  "export"
309
310
  );
@@ -311,201 +312,212 @@ function on(e, t) {
311
312
  b(y), h?.token === y && (h = null);
312
313
  }
313
314
  })();
314
- return h = { plan: a, epoch: d, promise: R, token: y }, R;
315
+ return h = { plan: s, epoch: c, promise: R, token: y }, R;
315
316
  }
316
317
  function ae() {
317
- const a = e.value;
318
- if (!(n || !a || a.pages.length === 0))
318
+ const s = e.value;
319
+ if (!(n || !s || s.pages.length === 0))
319
320
  try {
320
- const { html: d, filename: y } = rn(a);
321
- C(new Blob([d], { type: "application/msword;charset=utf-8" }), y);
322
- } catch (d) {
321
+ const { html: c, filename: y } = an(s);
322
+ M(new Blob([c], { type: "application/msword;charset=utf-8" }), y);
323
+ } catch (c) {
323
324
  t.onError(
324
- d instanceof Error ? `Word 导出失败: ${d.message}` : "Word 导出失败",
325
+ c instanceof Error ? `Word 导出失败: ${c.message}` : "Word 导出失败",
325
326
  "export"
326
327
  );
327
328
  }
328
329
  }
329
- async function ee(a) {
330
- const d = e.value;
331
- if (!(n || !d || d.pages.length === 0)) {
332
- if (a === "pdf") {
333
- await q();
330
+ async function ee(s) {
331
+ const c = e.value;
332
+ if (!(n || !c || c.pages.length === 0)) {
333
+ if (s === "pdf") {
334
+ await V();
334
335
  return;
335
336
  }
336
- if (a === "xlsx" || a === "excel") {
337
+ if (s === "xlsx" || s === "excel") {
337
338
  await Y();
338
339
  return;
339
340
  }
340
- if (a === "png" || a === "image") {
341
+ if (s === "png" || s === "image") {
341
342
  await O();
342
343
  return;
343
344
  }
344
- if (a === "word" || a === "doc") {
345
+ if (s === "word" || s === "doc") {
345
346
  ae();
346
347
  return;
347
348
  }
348
- if (a !== "html") {
349
- t.onError(`不支持的导出格式:${a}`, "export");
349
+ if (s !== "html") {
350
+ t.onError(`不支持的导出格式:${s}`, "export");
350
351
  return;
351
352
  }
352
353
  try {
353
- const { head: y, pageChunks: R } = $t(d), T = `${y}${R.join("")}</body></html>`;
354
- C(new Blob([T], { type: "text/html;charset=utf-8" }), "mach-report.html");
354
+ const { head: y, pageChunks: R } = $t(c), T = `${y}${R.join("")}</body></html>`;
355
+ M(new Blob([T], { type: "text/html;charset=utf-8" }), "mach-report.html");
355
356
  } catch (y) {
356
357
  t.onError(y instanceof Error ? `HTML 导出失败: ${y.message}` : "HTML 导出失败", "export");
357
358
  }
358
359
  }
359
360
  }
360
- function fe() {
361
- const a = e.value;
362
- if (n || !a || a.pages.length === 0) return;
363
- const d = r, y = window.open("", "_blank");
361
+ function pe() {
362
+ const s = e.value;
363
+ if (n || !s || s.pages.length === 0) return;
364
+ const c = o, y = window.open("", "_blank");
364
365
  if (!y) {
365
366
  t.onError("浏览器拦截了弹窗,请允许弹窗后重试", "pdf");
366
367
  return;
367
368
  }
368
- u.set(y, { plan: a, epoch: d });
369
- const R = W(a, d, "PDF");
370
- j(a, d).then((T) => {
371
- if (!v(a, d) || y.closed) {
369
+ u.set(y, { plan: s, epoch: c });
370
+ const R = W(s, c, "PDF");
371
+ K(s, c).then((T) => {
372
+ if (!v(s, c) || y.closed) {
372
373
  u.delete(y) && y.close();
373
374
  return;
374
375
  }
375
- const K = URL.createObjectURL(new Blob([T], { type: "application/pdf" }));
376
- setTimeout(() => URL.revokeObjectURL(K), 6e4);
376
+ const U = URL.createObjectURL(new Blob([T], { type: "application/pdf" }));
377
+ setTimeout(() => URL.revokeObjectURL(U), 6e4);
377
378
  const J = y.document;
378
379
  J.title = "PDF 预览", J.documentElement.style.height = "100%", J.body.style.cssText = "margin:0;height:100%;";
379
380
  const G = J.createElement("iframe");
380
- G.title = "PDF 预览", G.style.cssText = "display:block;width:100%;height:100%;border:0;", G.src = K, J.body.replaceChildren(G), u.delete(y);
381
+ G.title = "PDF 预览", G.style.cssText = "display:block;width:100%;height:100%;border:0;", G.src = U, J.body.replaceChildren(G), u.delete(y);
381
382
  }).catch((T) => {
382
- y.close(), u.delete(y), v(a, d) && t.onError(T instanceof Error ? `PDF 预览失败: ${T.message}` : "PDF 预览失败", "pdf");
383
+ y.close(), u.delete(y), v(s, c) && t.onError(T instanceof Error ? `PDF 预览失败: ${T.message}` : "PDF 预览失败", "pdf");
383
384
  }).finally(() => b(R));
384
385
  }
385
386
  return {
386
- print: H,
387
+ print: q,
387
388
  exportAs: ee,
388
389
  exportImages: O,
389
390
  exportWord: ae,
390
- openPdfWindow: fe,
391
+ openPdfWindow: pe,
391
392
  releasePrintFrame: D,
392
393
  dispose: S
393
394
  };
394
395
  }
395
396
  const kt = "mrp-hit";
396
- function an(e) {
397
- e.querySelectorAll(`mark.${kt}`).forEach((s) => {
398
- const o = s.parentNode;
399
- if (o) {
400
- for (; s.firstChild; ) o.insertBefore(s.firstChild, s);
401
- s.remove(), o.normalize();
397
+ function ln(e) {
398
+ e.querySelectorAll(`mark.${kt}`).forEach((a) => {
399
+ const r = a.parentNode;
400
+ if (r) {
401
+ for (; a.firstChild; ) r.insertBefore(a.firstChild, a);
402
+ a.remove(), r.normalize();
402
403
  }
403
404
  });
404
405
  }
405
- function sn(e, t) {
406
- const s = t.trim();
407
- if (!s) return 0;
408
- const o = s.toLowerCase(), n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
406
+ function un(e, t) {
407
+ const a = t.trim();
408
+ if (!a) return 0;
409
+ const r = a.toLowerCase(), n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
409
410
  acceptNode(u) {
410
411
  const p = u.parentElement;
411
- return !p || p.closest("mark") || /^(SCRIPT|STYLE)$/.test(p.tagName) ? NodeFilter.FILTER_REJECT : (u.nodeValue ?? "").toLowerCase().includes(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
412
+ return !p || p.closest("mark") || /^(SCRIPT|STYLE)$/.test(p.tagName) ? NodeFilter.FILTER_REJECT : (u.nodeValue ?? "").toLowerCase().includes(r) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
412
413
  }
413
- }), r = [];
414
- for (let u = n.nextNode(); u; u = n.nextNode()) r.push(u);
414
+ }), o = [];
415
+ for (let u = n.nextNode(); u; u = n.nextNode()) o.push(u);
415
416
  let l = 0;
416
- for (const u of r) {
417
- const p = u.nodeValue ?? "", m = p.toLowerCase(), c = u.parentElement;
418
- if (!c) continue;
417
+ for (const u of o) {
418
+ const p = u.nodeValue ?? "", m = p.toLowerCase(), d = u.parentElement;
419
+ if (!d) continue;
419
420
  const f = document.createDocumentFragment();
420
- let h = 0, v = m.indexOf(o);
421
+ let h = 0, v = m.indexOf(r);
421
422
  for (; v >= 0; ) {
422
423
  v > h && f.appendChild(document.createTextNode(p.slice(h, v)));
423
424
  const A = document.createElement("mark");
424
- A.className = kt, A.textContent = p.slice(v, v + s.length), f.appendChild(A), l++, h = v + s.length, v = m.indexOf(o, h);
425
+ A.className = kt, A.textContent = p.slice(v, v + a.length), f.appendChild(A), l++, h = v + a.length, v = m.indexOf(r, h);
425
426
  }
426
- h < p.length && f.appendChild(document.createTextNode(p.slice(h))), c.replaceChild(f, u);
427
+ h < p.length && f.appendChild(document.createTextNode(p.slice(h))), d.replaceChild(f, u);
427
428
  }
428
429
  return l;
429
430
  }
430
- function ln(e, t) {
431
- const s = e.toLowerCase();
432
- let o = 0;
433
- for (let n = s.indexOf(t); n >= 0; n = s.indexOf(t, n + t.length)) o++;
434
- return o;
431
+ const cn = /* @__PURE__ */ new Set(["line", "rect", "ellipse", "chart"]);
432
+ function* dn(e) {
433
+ for (const t of e.cells ?? [])
434
+ for (const a of t ?? [])
435
+ yield a?.text ?? "", yield* a?.children ?? [];
436
+ }
437
+ function* fn(e) {
438
+ if (_t(e))
439
+ for (const t of e.richParagraphs)
440
+ for (const a of t.segments ?? [])
441
+ yield (a.kind === "field" ? a.field : a.text) ?? "";
442
+ else e.lines?.length ? yield* e.lines : yield e.text ?? "";
435
443
  }
436
- function* un(e) {
437
- const t = [...e].reverse();
444
+ function* pn(e) {
445
+ const t = [e.values()];
438
446
  for (; t.length > 0; ) {
439
- const s = t.pop();
440
- if (s.grid) {
441
- for (const o of s.grid.cells ?? [])
442
- for (const n of o ?? [])
443
- if (yield n?.text ?? "", n?.children)
444
- for (let r = n.children.length - 1; r >= 0; r--) t.push(n.children[r]);
445
- } else if (s.kind === "text")
446
- if (s.richParagraphs?.length)
447
- for (const o of s.richParagraphs)
448
- for (const n of o.segments ?? [])
449
- yield (n.kind === "field" ? n.field : n.text) ?? "";
450
- else s.lines?.length ? yield* s.lines : yield s.text ?? "";
451
- yield "";
447
+ const a = t[t.length - 1].next();
448
+ if (a.done) {
449
+ t.pop();
450
+ continue;
451
+ }
452
+ const r = a.value;
453
+ if (typeof r == "string") {
454
+ yield r;
455
+ continue;
456
+ }
457
+ yield "", !Qt(r) && (r.kind === "text" ? t.push(fn(r)) : r.grid ? t.push(dn(r.grid)) : cn.has(r.kind) || (yield r.fallbackText ?? ""));
452
458
  }
453
459
  }
454
- function* cn(e) {
460
+ function* mn(e) {
455
461
  for (let t = 0; t < e.pages.length; t++) {
456
- for (const s of un(e.pages[t].components)) yield { text: s, pageIndex: t };
462
+ for (const a of pn(e.pages[t].components)) yield { text: a, pageIndex: t };
457
463
  yield { text: "", pageIndex: t };
458
464
  }
459
465
  }
460
- function dn(e) {
461
- const { plan: t, gotoPage: s, highlight: o, clearHighlights: n } = e, r = B(!1), l = B(""), u = B(0), p = B(0), m = B(!1);
462
- let c = [];
466
+ function vn(e, t) {
467
+ const a = e.toLowerCase();
468
+ let r = 0;
469
+ for (let n = a.indexOf(t); n >= 0; n = a.indexOf(t, n + t.length)) r++;
470
+ return r;
471
+ }
472
+ function hn(e) {
473
+ const { plan: t, gotoPage: a, highlight: r, clearHighlights: n } = e, o = B(!1), l = B(""), u = B(0), p = B(0), m = B(!1);
474
+ let d = [];
463
475
  const f = k(() => {
464
476
  if (p.value === 0) return null;
465
477
  const S = u.value;
466
- let C = 0, H = c.length - 1;
467
- for (; C < H; ) {
468
- const q = C + H >>> 1;
469
- c[q].cumulative <= S ? C = q + 1 : H = q;
478
+ let M = 0, q = d.length - 1;
479
+ for (; M < q; ) {
480
+ const V = M + q >>> 1;
481
+ d[V].cumulative <= S ? M = V + 1 : q = V;
470
482
  }
471
- const j = c[C];
472
- return j ? { pageIndex: j.pageIndex, occurrence: S - (c[C - 1]?.cumulative ?? 0) } : null;
483
+ const K = d[M];
484
+ return K ? { pageIndex: K.pageIndex, occurrence: S - (d[M - 1]?.cumulative ?? 0) } : null;
473
485
  });
474
486
  let h = null, v = null, A = 0;
475
487
  function W() {
476
488
  A++, h && clearTimeout(h), v && clearTimeout(v), h = v = null, m.value = !1;
477
489
  }
478
490
  function b(S) {
479
- l.value = S, u.value = 0, p.value = 0, c = [], m.value = !1;
480
- const C = S.trim().toLowerCase(), H = t.value;
481
- if (!C || !H) return;
491
+ l.value = S, u.value = 0, p.value = 0, d = [], m.value = !1;
492
+ const M = S.trim().toLowerCase(), q = t.value;
493
+ if (!M || !q) return;
482
494
  m.value = !0;
483
- const j = A, q = cn(H), Y = [];
495
+ const K = A, V = mn(q), Y = [];
484
496
  let O = 0;
485
497
  function ae() {
486
- if (v = null, j !== A || H !== t.value) return;
498
+ if (v = null, K !== A || q !== t.value) return;
487
499
  const ee = performance.now();
488
- let fe = 0;
489
- for (; fe < 5e3 && performance.now() - ee < 4; ) {
490
- const a = q.next();
491
- if (a.done) {
492
- c = Y, p.value = O, m.value = !1, c[0] && s(c[0].pageIndex + 1);
500
+ let pe = 0;
501
+ for (; pe < 5e3 && performance.now() - ee < 4; ) {
502
+ const s = V.next();
503
+ if (s.done) {
504
+ d = Y, p.value = O, m.value = !1, d[0] && a(d[0].pageIndex + 1);
493
505
  return;
494
506
  }
495
- const d = ln(a.value.text, C);
496
- if (d > 0) {
497
- O += d;
507
+ const c = vn(s.value.text, M);
508
+ if (c > 0) {
509
+ O += c;
498
510
  const y = Y[Y.length - 1];
499
- y?.pageIndex === a.value.pageIndex ? y.cumulative = O : Y.push({ pageIndex: a.value.pageIndex, cumulative: O });
511
+ y?.pageIndex === s.value.pageIndex ? y.cumulative = O : Y.push({ pageIndex: s.value.pageIndex, cumulative: O });
500
512
  }
501
- fe++;
513
+ pe++;
502
514
  }
503
515
  v = setTimeout(ae, 0);
504
516
  }
505
517
  ae();
506
518
  }
507
519
  function I(S) {
508
- if (W(), l.value = S, u.value = p.value = 0, c = [], !S.trim()) {
520
+ if (W(), l.value = S, u.value = p.value = 0, d = [], !S.trim()) {
509
521
  b("");
510
522
  return;
511
523
  }
@@ -514,33 +526,29 @@ function dn(e) {
514
526
  }, Math.max(0, x(e.debounceMs) ?? 200));
515
527
  }
516
528
  function E(S) {
517
- const C = p.value;
518
- if (C === 0 || m.value) return;
519
- u.value = (u.value + S + C) % C;
520
- let H = 0, j = c.length - 1;
521
- for (; H < j; ) {
522
- const q = H + j >>> 1;
523
- c[q].cumulative <= u.value ? H = q + 1 : j = q;
524
- }
525
- s(c[H].pageIndex + 1);
529
+ const M = p.value;
530
+ if (M === 0 || m.value) return;
531
+ u.value = (u.value + S + M) % M;
532
+ const q = f.value;
533
+ q && a(q.pageIndex + 1);
526
534
  }
527
535
  function D() {
528
- W(), l.value = "", u.value = p.value = 0, c = [];
536
+ W(), l.value = "", u.value = p.value = 0, d = [];
529
537
  }
530
538
  return Q(t, D, { flush: "sync" }), He(D), {
531
- visible: r,
539
+ visible: o,
532
540
  query: l,
533
541
  matchIndex: u,
534
542
  matchCount: p,
535
543
  activeMatch: f,
536
544
  searching: m,
537
545
  toggle: () => {
538
- r.value = !r.value;
546
+ o.value = !o.value;
539
547
  },
540
548
  onInput: I,
541
549
  onNav: E,
542
550
  apply: (S) => {
543
- l.value.trim() && o(S, l.value.trim());
551
+ l.value.trim() && r(S, l.value.trim());
544
552
  },
545
553
  clear: (S) => {
546
554
  n(S);
@@ -548,8 +556,8 @@ function dn(e) {
548
556
  reset: D
549
557
  };
550
558
  }
551
- function fn(e, t) {
552
- const s = k(() => {
559
+ function gn(e, t) {
560
+ const a = k(() => {
553
561
  if (e.value) return !0;
554
562
  if (typeof location > "u") return !1;
555
563
  try {
@@ -557,27 +565,27 @@ function fn(e, t) {
557
565
  } catch {
558
566
  return !1;
559
567
  }
560
- }), o = k(() => !s.value || !t.plan.value ? 0 : Math.round(JSON.stringify(t.plan.value).length / 1024)), n = k(() => !s.value || !t.plan.value ? null : {
568
+ }), r = k(() => !a.value || !t.plan.value ? 0 : Math.round(JSON.stringify(t.plan.value).length / 1024)), n = k(() => !a.value || !t.plan.value ? null : {
561
569
  pages: t.pageCount.value,
562
570
  window: `${t.windowRange.value.start}-${t.windowRange.value.end}`,
563
571
  zoom: `${Math.round(t.zoom.value * 100)}%`,
564
572
  loadMs: `${t.loadMs.value}ms`,
565
- planKB: o.value
573
+ planKB: r.value
566
574
  });
567
- return { enabled: s, debugStats: n };
575
+ return { enabled: a, debugStats: n };
568
576
  }
569
- function pn(e, t) {
570
- const { thumbsRoot: s, visible: o, renderThumbCanvas: n } = t, r = B(0), l = B(800), u = k(() => (e.value?.pages ?? []).map(
577
+ function bn(e, t) {
578
+ const { thumbsRoot: a, visible: r, renderThumbCanvas: n } = t, o = B(0), l = B(800), u = k(() => (e.value?.pages ?? []).map(
571
579
  (E) => Math.round(E.pageHeightMm / E.pageWidthMm * 116)
572
- )), p = k(() => Pt(u.value.map((E) => E + 20), 8)), m = k(() => p.value.window(l.value, r.value, 1)), c = k(() => {
573
- if (!o.value) return [];
580
+ )), p = k(() => Pt(u.value.map((E) => E + 20), 8)), m = k(() => p.value.window(l.value, o.value, 1)), d = k(() => {
581
+ if (!r.value) return [];
574
582
  const { start: E, end: D } = m.value;
575
- return u.value.slice(E, D + 1).map((S, C) => ({ index: E + C, height: S }));
583
+ return u.value.slice(E, D + 1).map((S, M) => ({ index: E + M, height: S }));
576
584
  });
577
585
  let f = 0, h = 0, v = !1;
578
586
  function A() {
579
- const E = s.value;
580
- E && (r.value = E.scrollTop, l.value = E.clientHeight || 800);
587
+ const E = a.value;
588
+ E && (o.value = E.scrollTop, l.value = E.clientHeight || 800);
581
589
  }
582
590
  function W() {
583
591
  v || h || (h = requestAnimationFrame(() => {
@@ -585,29 +593,29 @@ function pn(e, t) {
585
593
  }));
586
594
  }
587
595
  function b() {
588
- if (c.value, f && cancelAnimationFrame(f), f = 0, v || !o.value || !e.value || !s.value) return;
596
+ if (d.value, f && cancelAnimationFrame(f), f = 0, v || !r.value || !e.value || !a.value) return;
589
597
  A();
590
- const E = c.value, D = e.value, S = s.value;
591
- let C = 0;
592
- function H() {
593
- if (f = 0, !(v || !o.value || e.value !== D || s.value !== S)) {
594
- for (let j = 0; C < E.length && j < 2; j++, C++) {
595
- const q = E[C].index, Y = S.querySelector(`[data-thumb="${q + 1}"]`);
598
+ const E = d.value, D = e.value, S = a.value;
599
+ let M = 0;
600
+ function q() {
601
+ if (f = 0, !(v || !r.value || e.value !== D || a.value !== S)) {
602
+ for (let K = 0; M < E.length && K < 2; K++, M++) {
603
+ const V = E[M].index, Y = S.querySelector(`[data-thumb="${V + 1}"]`);
596
604
  if (!Y || Y.childElementCount > 0) continue;
597
- const O = n(q);
605
+ const O = n(V);
598
606
  O && (O.style.width = "100%", O.style.height = "100%", O.style.display = "block", Y.appendChild(O));
599
607
  }
600
- C < E.length && (f = requestAnimationFrame(H));
608
+ M < E.length && (f = requestAnimationFrame(q));
601
609
  }
602
610
  }
603
- f = requestAnimationFrame(H);
611
+ f = requestAnimationFrame(q);
604
612
  }
605
613
  function I() {
606
614
  v = !0, f && cancelAnimationFrame(f), h && cancelAnimationFrame(h), f = h = 0;
607
615
  }
608
- return He(I), { schedule: b, destroy: I, onScroll: W, windowRange: m, visibleThumbs: c };
616
+ return He(I), { schedule: b, destroy: I, onScroll: W, windowRange: m, visibleThumbs: d };
609
617
  }
610
- function mn() {
618
+ function wn() {
611
619
  const e = Ie(0);
612
620
  return {
613
621
  loadMs: e,
@@ -619,14 +627,14 @@ function mn() {
619
627
  }
620
628
  };
621
629
  }
622
- const vn = { class: "mrp-toolbar" }, hn = { class: "mrp-title" }, gn = ["disabled"], bn = { class: "mrp-pageinfo" }, wn = ["disabled"], yn = {
630
+ const yn = { class: "mrp-toolbar" }, xn = { class: "mrp-title" }, Pn = ["disabled"], En = { class: "mrp-pageinfo" }, $n = ["disabled"], kn = {
623
631
  key: 1,
624
632
  class: "mrp-search"
625
- }, xn = ["placeholder", "value"], Pn = {
633
+ }, Cn = ["placeholder", "value"], Mn = {
626
634
  key: 0,
627
635
  class: "mrp-search-count",
628
636
  role: "status"
629
- }, En = ["disabled"], $n = ["disabled"], kn = /* @__PURE__ */ rt({
637
+ }, Fn = ["disabled"], Rn = ["disabled"], Tn = /* @__PURE__ */ rt({
630
638
  __name: "ReportToolbar",
631
639
  props: {
632
640
  pageCount: {},
@@ -642,141 +650,141 @@ const vn = { class: "mrp-toolbar" }, hn = { class: "mrp-title" }, gn = ["disable
642
650
  },
643
651
  emits: ["goto", "zoom", "export", "print", "pdf-window", "search-input", "search-nav", "search-toggle", "thumbs-toggle"],
644
652
  setup(e) {
645
- const t = e, s = B(null);
653
+ const t = e, a = B(null);
646
654
  Q(
647
655
  () => t.search.visible,
648
656
  (n) => {
649
- n && qt(() => s.value?.focus());
657
+ n && qt(() => a.value?.focus());
650
658
  }
651
659
  );
652
- function o(n, r, l) {
653
- return n.replace("{cur}", String(r)).replace("{total}", String(l));
660
+ function r(n, o, l) {
661
+ return n.replace("{cur}", String(o)).replace("{total}", String(l));
654
662
  }
655
- return (n, r) => (P(), $("div", vn, [
656
- F("span", hn, M(e.messages.title), 1),
663
+ return (n, o) => (P(), $("div", yn, [
664
+ F("span", xn, C(e.messages.title), 1),
657
665
  e.pageCount > 0 ? (P(), $(Ee, { key: 0 }, [
658
666
  F("button", {
659
667
  class: "mrp-nav",
660
668
  type: "button",
661
669
  disabled: e.currentPage <= 1,
662
- onClick: r[0] || (r[0] = (l) => n.$emit("goto", e.currentPage - 1))
663
- }, M(e.messages.prevPage), 9, gn),
664
- F("span", bn, M(o(e.messages.pageInfo, e.currentPage, e.pageCount)), 1),
670
+ onClick: o[0] || (o[0] = (l) => n.$emit("goto", e.currentPage - 1))
671
+ }, C(e.messages.prevPage), 9, Pn),
672
+ F("span", En, C(r(e.messages.pageInfo, e.currentPage, e.pageCount)), 1),
665
673
  F("button", {
666
674
  class: "mrp-nav",
667
675
  type: "button",
668
676
  disabled: e.currentPage >= e.pageCount,
669
- onClick: r[1] || (r[1] = (l) => n.$emit("goto", e.currentPage + 1))
670
- }, M(e.messages.nextPage), 9, wn)
671
- ], 64)) : N("", !0),
672
- r[17] || (r[17] = F("span", { class: "mrp-spacer" }, null, -1)),
673
- e.search.visible ? (P(), $("div", yn, [
677
+ onClick: o[1] || (o[1] = (l) => n.$emit("goto", e.currentPage + 1))
678
+ }, C(e.messages.nextPage), 9, $n)
679
+ ], 64)) : H("", !0),
680
+ o[17] || (o[17] = F("span", { class: "mrp-spacer" }, null, -1)),
681
+ e.search.visible ? (P(), $("div", kn, [
674
682
  F("input", {
675
683
  ref_key: "searchInputRef",
676
- ref: s,
684
+ ref: a,
677
685
  class: "mrp-search-input",
678
686
  type: "text",
679
687
  placeholder: e.messages.searchPlaceholder,
680
688
  value: e.search.query,
681
- onInput: r[2] || (r[2] = (l) => n.$emit("search-input", l.target.value))
682
- }, null, 40, xn),
683
- e.search.query ? (P(), $("span", Pn, M(e.search.searching ? e.messages.searching ?? "搜索中…" : o(e.messages.matchInfo, e.search.matchCount > 0 ? e.search.matchIndex + 1 : 0, e.search.matchCount)), 1)) : N("", !0),
689
+ onInput: o[2] || (o[2] = (l) => n.$emit("search-input", l.target.value))
690
+ }, null, 40, Cn),
691
+ e.search.query ? (P(), $("span", Mn, C(e.search.searching ? e.messages.searching ?? "搜索中…" : r(e.messages.matchInfo, e.search.matchCount > 0 ? e.search.matchIndex + 1 : 0, e.search.matchCount)), 1)) : H("", !0),
684
692
  F("button", {
685
693
  class: "mrp-nav",
686
694
  type: "button",
687
695
  disabled: e.search.matchCount === 0,
688
- onClick: r[3] || (r[3] = (l) => n.$emit("search-nav", -1))
689
- }, M(e.messages.prevMatch), 9, En),
696
+ onClick: o[3] || (o[3] = (l) => n.$emit("search-nav", -1))
697
+ }, C(e.messages.prevMatch), 9, Fn),
690
698
  F("button", {
691
699
  class: "mrp-nav",
692
700
  type: "button",
693
701
  disabled: e.search.matchCount === 0,
694
- onClick: r[4] || (r[4] = (l) => n.$emit("search-nav", 1))
695
- }, M(e.messages.nextMatch), 9, $n)
696
- ])) : N("", !0),
702
+ onClick: o[4] || (o[4] = (l) => n.$emit("search-nav", 1))
703
+ }, C(e.messages.nextMatch), 9, Rn)
704
+ ])) : H("", !0),
697
705
  F("button", {
698
706
  class: oe(["mrp-nav", { "mrp-active": e.search.visible }]),
699
707
  type: "button",
700
708
  title: "Ctrl+F",
701
- onClick: r[5] || (r[5] = (l) => n.$emit("search-toggle"))
709
+ onClick: o[5] || (o[5] = (l) => n.$emit("search-toggle"))
702
710
  }, " 🔍 ", 2),
703
711
  F("button", {
704
712
  class: oe(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
705
713
  type: "button",
706
- onClick: r[6] || (r[6] = (l) => n.$emit("thumbs-toggle"))
707
- }, " ▦ " + M(e.messages.thumbnails), 3),
714
+ onClick: o[6] || (o[6] = (l) => n.$emit("thumbs-toggle"))
715
+ }, " ▦ " + C(e.messages.thumbnails), 3),
708
716
  F("button", {
709
717
  class: oe(["mrp-nav", { "mrp-active": e.zoomMode === "fit" }]),
710
718
  type: "button",
711
- onClick: r[7] || (r[7] = (l) => n.$emit("zoom", "fit"))
712
- }, M(e.messages.fitWidth), 3),
719
+ onClick: o[7] || (o[7] = (l) => n.$emit("zoom", "fit"))
720
+ }, C(e.messages.fitWidth), 3),
713
721
  F("button", {
714
722
  class: oe(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 100 }]),
715
723
  type: "button",
716
- onClick: r[8] || (r[8] = (l) => n.$emit("zoom", 100))
724
+ onClick: o[8] || (o[8] = (l) => n.$emit("zoom", 100))
717
725
  }, " 100% ", 2),
718
726
  F("button", {
719
727
  class: oe(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 150 }]),
720
728
  type: "button",
721
- onClick: r[9] || (r[9] = (l) => n.$emit("zoom", 150))
729
+ onClick: o[9] || (o[9] = (l) => n.$emit("zoom", 150))
722
730
  }, " 150% ", 2),
723
731
  e.showExport ? (P(), $("button", {
724
732
  key: 2,
725
733
  class: "mrp-nav",
726
734
  type: "button",
727
- onClick: r[10] || (r[10] = (l) => n.$emit("export", "html"))
728
- }, M(e.messages.exportHtml), 1)) : N("", !0),
735
+ onClick: o[10] || (o[10] = (l) => n.$emit("export", "html"))
736
+ }, C(e.messages.exportHtml), 1)) : H("", !0),
729
737
  e.showExport ? (P(), $("button", {
730
738
  key: 3,
731
739
  class: "mrp-nav",
732
740
  type: "button",
733
- onClick: r[11] || (r[11] = (l) => n.$emit("export", "pdf"))
734
- }, M(e.messages.exportPdf), 1)) : N("", !0),
741
+ onClick: o[11] || (o[11] = (l) => n.$emit("export", "pdf"))
742
+ }, C(e.messages.exportPdf), 1)) : H("", !0),
735
743
  e.showExport ? (P(), $("button", {
736
744
  key: 4,
737
745
  class: "mrp-nav",
738
746
  type: "button",
739
- onClick: r[12] || (r[12] = (l) => n.$emit("export", "xlsx"))
740
- }, M(e.messages.exportExcel), 1)) : N("", !0),
747
+ onClick: o[12] || (o[12] = (l) => n.$emit("export", "xlsx"))
748
+ }, C(e.messages.exportExcel), 1)) : H("", !0),
741
749
  e.showExport ? (P(), $("button", {
742
750
  key: 5,
743
751
  class: "mrp-nav",
744
752
  type: "button",
745
- onClick: r[13] || (r[13] = (l) => n.$emit("export", "png"))
746
- }, M(e.messages.exportImage), 1)) : N("", !0),
753
+ onClick: o[13] || (o[13] = (l) => n.$emit("export", "png"))
754
+ }, C(e.messages.exportImage), 1)) : H("", !0),
747
755
  e.showExport ? (P(), $("button", {
748
756
  key: 6,
749
757
  class: "mrp-nav",
750
758
  type: "button",
751
- onClick: r[14] || (r[14] = (l) => n.$emit("export", "word"))
752
- }, M(e.messages.exportWord), 1)) : N("", !0),
759
+ onClick: o[14] || (o[14] = (l) => n.$emit("export", "word"))
760
+ }, C(e.messages.exportWord), 1)) : H("", !0),
753
761
  e.showPrint ? (P(), $("button", {
754
762
  key: 7,
755
763
  class: "mrp-nav",
756
764
  type: "button",
757
- onClick: r[15] || (r[15] = (l) => n.$emit("print"))
758
- }, M(e.messages.print), 1)) : N("", !0),
765
+ onClick: o[15] || (o[15] = (l) => n.$emit("print"))
766
+ }, C(e.messages.print), 1)) : H("", !0),
759
767
  e.showPdfWindow ? (P(), $("button", {
760
768
  key: 8,
761
769
  class: "mrp-nav",
762
770
  type: "button",
763
- onClick: r[16] || (r[16] = (l) => n.$emit("pdf-window"))
764
- }, M(e.messages.pdfWindow), 1)) : N("", !0)
771
+ onClick: o[16] || (o[16] = (l) => n.$emit("pdf-window"))
772
+ }, C(e.messages.pdfWindow), 1)) : H("", !0)
765
773
  ]));
766
774
  }
767
775
  }), st = (e, t) => {
768
- const s = e.__vccOpts || e;
769
- for (const [o, n] of t)
770
- s[o] = n;
771
- return s;
772
- }, Mn = /* @__PURE__ */ st(kn, [["__scopeId", "data-v-601f8fa8"]]), Cn = { class: "mrp-params" }, Fn = { class: "mrp-params-title" }, Rn = { class: "mrp-params-grid" }, Tn = { class: "mrp-param-label" }, Sn = {
776
+ const a = e.__vccOpts || e;
777
+ for (const [r, n] of t)
778
+ a[r] = n;
779
+ return a;
780
+ }, Sn = /* @__PURE__ */ st(Tn, [["__scopeId", "data-v-601f8fa8"]]), In = { class: "mrp-params" }, Dn = { class: "mrp-params-title" }, On = { class: "mrp-params-grid" }, Wn = { class: "mrp-param-label" }, Bn = {
773
781
  key: 0,
774
782
  class: "mrp-param-star"
775
- }, In = ["value", "onChange"], On = {
783
+ }, An = ["value", "onChange"], Ln = {
776
784
  value: "",
777
785
  disabled: "",
778
786
  hidden: ""
779
- }, Dn = ["value"], Wn = ["type", "placeholder", "value", "onInput"], Bn = { class: "mrp-params-actions" }, An = /* @__PURE__ */ rt({
787
+ }, zn = ["value"], Hn = ["type", "placeholder", "value", "onInput"], qn = { class: "mrp-params-actions" }, Nn = /* @__PURE__ */ rt({
780
788
  __name: "ReportParamPanel",
781
789
  props: {
782
790
  defs: {},
@@ -786,76 +794,76 @@ const vn = { class: "mrp-toolbar" }, hn = { class: "mrp-title" }, gn = ["disable
786
794
  },
787
795
  emits: ["update:modelValue", "query", "reset"],
788
796
  setup(e, { emit: t }) {
789
- const s = e, o = t, n = B({ ...s.modelValue });
797
+ const a = e, r = t, n = B({ ...a.modelValue });
790
798
  Q(
791
- () => s.modelValue,
799
+ () => a.modelValue,
792
800
  (p) => {
793
801
  n.value = { ...p };
794
802
  }
795
803
  );
796
- const r = k(
797
- () => s.defs.map((p) => ({
804
+ const o = k(
805
+ () => a.defs.map((p) => ({
798
806
  def: p,
799
807
  label: p.label ?? p.field,
800
808
  value: n.value[p.field] ?? ""
801
809
  }))
802
810
  );
803
811
  function l(p, m) {
804
- n.value = { ...n.value, [p]: m }, o("update:modelValue", { ...n.value });
812
+ n.value = { ...n.value, [p]: m }, r("update:modelValue", { ...n.value });
805
813
  }
806
814
  function u(p) {
807
- const m = s.defs.find((c) => c.field === p);
808
- return s.attempted && m?.required === !0 && !(n.value[p] ?? "").trim();
815
+ const m = a.defs.find((d) => d.field === p);
816
+ return a.attempted && m?.required === !0 && !(n.value[p] ?? "").trim();
809
817
  }
810
- return (p, m) => (P(), $("div", Cn, [
811
- F("span", Fn, M(e.messages.paramsTitle), 1),
812
- F("div", Rn, [
813
- (P(!0), $(Ee, null, We(r.value, (c) => (P(), $("label", {
814
- key: c.def.field,
815
- class: oe(["mrp-param", { "mrp-param-missing": u(c.def.field) }])
818
+ return (p, m) => (P(), $("div", In, [
819
+ F("span", Dn, C(e.messages.paramsTitle), 1),
820
+ F("div", On, [
821
+ (P(!0), $(Ee, null, We(o.value, (d) => (P(), $("label", {
822
+ key: d.def.field,
823
+ class: oe(["mrp-param", { "mrp-param-missing": u(d.def.field) }])
816
824
  }, [
817
- F("span", Tn, [
818
- et(M(c.label), 1),
819
- c.def.required ? (P(), $("i", Sn, "*")) : N("", !0)
825
+ F("span", Wn, [
826
+ et(C(d.label), 1),
827
+ d.def.required ? (P(), $("i", Bn, "*")) : H("", !0)
820
828
  ]),
821
- (c.def.type ?? "text") === "select" ? (P(), $("select", {
829
+ (d.def.type ?? "text") === "select" ? (P(), $("select", {
822
830
  key: 0,
823
831
  class: "mrp-param-input",
824
- value: c.value,
825
- onChange: (f) => l(c.def.field, f.target.value),
832
+ value: d.value,
833
+ onChange: (f) => l(d.def.field, f.target.value),
826
834
  onKeydown: m[0] || (m[0] = mt((f) => p.$emit("query"), ["enter"]))
827
835
  }, [
828
- F("option", On, M(c.def.placeholder ?? `请选择${c.label}`), 1),
829
- (P(!0), $(Ee, null, We(c.def.options ?? [], (f) => (P(), $("option", {
836
+ F("option", Ln, C(d.def.placeholder ?? `请选择${d.label}`), 1),
837
+ (P(!0), $(Ee, null, We(d.def.options ?? [], (f) => (P(), $("option", {
830
838
  key: f.value,
831
839
  value: f.value
832
- }, M(f.label), 9, Dn))), 128))
833
- ], 40, In)) : (P(), $("input", {
840
+ }, C(f.label), 9, zn))), 128))
841
+ ], 40, An)) : (P(), $("input", {
834
842
  key: 1,
835
843
  class: "mrp-param-input",
836
- type: c.def.type === "number" ? "number" : c.def.type === "date" ? "date" : "text",
837
- placeholder: c.def.placeholder ?? `请输入${c.label}`,
838
- value: c.value,
839
- onInput: (f) => l(c.def.field, f.target.value),
844
+ type: d.def.type === "number" ? "number" : d.def.type === "date" ? "date" : "text",
845
+ placeholder: d.def.placeholder ?? `请输入${d.label}`,
846
+ value: d.value,
847
+ onInput: (f) => l(d.def.field, f.target.value),
840
848
  onKeydown: m[1] || (m[1] = mt((f) => p.$emit("query"), ["enter"]))
841
- }, null, 40, Wn))
849
+ }, null, 40, Hn))
842
850
  ], 2))), 128))
843
851
  ]),
844
- F("div", Bn, [
852
+ F("div", qn, [
845
853
  F("button", {
846
854
  class: "mrp-nav mrp-param-query",
847
855
  type: "button",
848
- onClick: m[2] || (m[2] = (c) => p.$emit("query"))
849
- }, M(e.messages.query), 1),
856
+ onClick: m[2] || (m[2] = (d) => p.$emit("query"))
857
+ }, C(e.messages.query), 1),
850
858
  F("button", {
851
859
  class: "mrp-nav",
852
860
  type: "button",
853
- onClick: m[3] || (m[3] = (c) => p.$emit("reset"))
854
- }, M(e.messages.reset), 1)
861
+ onClick: m[3] || (m[3] = (d) => p.$emit("reset"))
862
+ }, C(e.messages.reset), 1)
855
863
  ])
856
864
  ]));
857
865
  }
858
- }), Ln = /* @__PURE__ */ st(An, [["__scopeId", "data-v-aafce92d"]]), zn = {
866
+ }), jn = /* @__PURE__ */ st(Nn, [["__scopeId", "data-v-aafce92d"]]), Un = {
859
867
  title: "报表预览",
860
868
  prevPage: "‹ 上一页",
861
869
  nextPage: "下一页 ›",
@@ -884,7 +892,7 @@ const vn = { class: "mrp-toolbar" }, hn = { class: "mrp-title" }, gn = ["disable
884
892
  reset: "重 置",
885
893
  paramRequired: "请填写{label}",
886
894
  searching: "搜索中…"
887
- }, Hn = {
895
+ }, Vn = {
888
896
  shellBg: "#525659",
889
897
  shellFg: "#e8e8e8",
890
898
  toolbarBg: "#323639",
@@ -896,13 +904,13 @@ const vn = { class: "mrp-toolbar" }, hn = { class: "mrp-title" }, gn = ["disable
896
904
  btnHoverFg: "#ffffff",
897
905
  btnActiveBg: "#2d5fb8"
898
906
  };
899
- function qn(e = {}) {
907
+ function Kn(e = {}) {
900
908
  return { ...e, defaults: e.defaults ?? {}, presets: e.presets ?? {} };
901
909
  }
902
- function gr(e) {
910
+ function Er(e) {
903
911
  return e;
904
912
  }
905
- const de = {
913
+ const fe = {
906
914
  showExport: !0,
907
915
  showPrint: !0,
908
916
  showPdfWindow: !0,
@@ -910,10 +918,10 @@ const de = {
910
918
  gapPx: 18,
911
919
  pdfFontUrl: "/simhei.ttf",
912
920
  logger: console
913
- }, br = { warn: () => {
921
+ }, $r = { warn: () => {
914
922
  }, info: () => {
915
923
  } };
916
- function De(e, t) {
924
+ function Oe(e, t) {
917
925
  return {
918
926
  ...e,
919
927
  ...t,
@@ -923,56 +931,56 @@ function De(e, t) {
923
931
  xlsx: { ...e?.xlsx, ...t?.xlsx }
924
932
  };
925
933
  }
926
- function Nn(e, t) {
927
- const s = t ? e?.presets?.[t] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, o = De(e?.defaults, s);
934
+ function Yn(e, t) {
935
+ const a = t ? e?.presets?.[t] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, r = Oe(e?.defaults, a);
928
936
  return {
929
- showExport: o.showExport ?? de.showExport,
930
- showPrint: o.showPrint ?? de.showPrint,
931
- showPdfWindow: o.showPdfWindow ?? de.showPdfWindow,
932
- showParams: o.showParams ?? de.showParams,
933
- gapPx: o.gapPx ?? de.gapPx,
934
- pdfFontUrl: o.pdfFontUrl ?? de.pdfFontUrl,
935
- theme: { ...Hn, ...o.theme },
936
- messages: { ...zn, ...o.messages },
937
- logger: o.logger ?? de.logger,
937
+ showExport: r.showExport ?? fe.showExport,
938
+ showPrint: r.showPrint ?? fe.showPrint,
939
+ showPdfWindow: r.showPdfWindow ?? fe.showPdfWindow,
940
+ showParams: r.showParams ?? fe.showParams,
941
+ gapPx: r.gapPx ?? fe.gapPx,
942
+ pdfFontUrl: r.pdfFontUrl ?? fe.pdfFontUrl,
943
+ theme: { ...Vn, ...r.theme },
944
+ messages: { ...Un, ...r.messages },
945
+ logger: r.logger ?? fe.logger,
938
946
  preview: {
939
- overscanPages: ht(o.preview?.overscanPages, 1, 10, !0),
940
- searchDebounceMs: ht(o.preview?.searchDebounceMs, 200, 2e3)
947
+ overscanPages: ht(r.preview?.overscanPages, 1, 10, !0),
948
+ searchDebounceMs: ht(r.preview?.searchDebounceMs, 200, 2e3)
941
949
  },
942
- xlsx: { ...o.xlsx }
950
+ xlsx: { ...r.xlsx }
943
951
  };
944
952
  }
945
- function ht(e, t, s, o = !1) {
953
+ function ht(e, t, a, r = !1) {
946
954
  if (e == null || !Number.isFinite(e)) return t;
947
- const n = Math.max(0, Math.min(s, e));
948
- return o ? Math.floor(n) : n;
955
+ const n = Math.max(0, Math.min(a, e));
956
+ return r ? Math.floor(n) : n;
949
957
  }
950
- function jn(e) {
958
+ function Zn(e) {
951
959
  const t = {};
952
960
  return e.shellBg != null && (t["--mrp-shell-bg"] = e.shellBg), e.shellFg != null && (t["--mrp-shell-fg"] = e.shellFg), e.toolbarBg != null && (t["--mrp-toolbar-bg"] = e.toolbarBg), e.toolbarBorder != null && (t["--mrp-toolbar-border"] = e.toolbarBorder), e.toolbarFg != null && (t["--mrp-toolbar-fg"] = e.toolbarFg), e.btnFg != null && (t["--mrp-btn-fg"] = e.btnFg), e.btnBorder != null && (t["--mrp-btn-border"] = e.btnBorder), e.btnHoverBg != null && (t["--mrp-btn-hover-bg"] = e.btnHoverBg), e.btnHoverFg != null && (t["--mrp-btn-hover-fg"] = e.btnHoverFg), e.btnActiveBg != null && (t["--mrp-btn-active-bg"] = e.btnActiveBg), t;
953
961
  }
954
- function wr(e) {
955
- const t = Be(tt, null), s = k(() => {
956
- const o = t?.value ?? null, n = "defaults" in e || "presets" in e || "defaultPreset" in e ? qn(e) : { defaults: e, presets: {} };
957
- if (!o) return n;
958
- const r = { ...o.presets, ...n.presets };
959
- for (const l of Object.keys(r))
960
- r[l] = De(
961
- De(o.presets[l], n.defaults),
962
+ function kr(e) {
963
+ const t = Be(tt, null), a = k(() => {
964
+ const r = t?.value ?? null, n = "defaults" in e || "presets" in e || "defaultPreset" in e ? Kn(e) : { defaults: e, presets: {} };
965
+ if (!r) return n;
966
+ const o = { ...r.presets, ...n.presets };
967
+ for (const l of Object.keys(o))
968
+ o[l] = Oe(
969
+ Oe(r.presets[l], n.defaults),
962
970
  n.presets[l]
963
971
  );
964
972
  return {
965
- defaults: De(o.defaults, n.defaults),
966
- presets: r,
967
- defaultPreset: n.defaultPreset ?? o.defaultPreset
973
+ defaults: Oe(r.defaults, n.defaults),
974
+ presets: o,
975
+ defaultPreset: n.defaultPreset ?? r.defaultPreset
968
976
  };
969
977
  });
970
- yt(tt, s);
978
+ yt(tt, a);
971
979
  }
972
- function Un() {
980
+ function Jn() {
973
981
  return Be(tt, k(() => null));
974
982
  }
975
- const gt = /* @__PURE__ */ new Map(), me = /* @__PURE__ */ new Map(), Vn = 15e3;
983
+ const gt = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ new Map(), Gn = 15e3;
976
984
  function nt(e, t) {
977
985
  return Object.assign(new Error(e), { cause: t });
978
986
  }
@@ -984,11 +992,11 @@ function ze(e) {
984
992
  const t = nt("PDF 字体检查已取消", e?.reason);
985
993
  return t.name = "AbortError", t;
986
994
  }
987
- async function Kn(e, t) {
988
- let s = !1;
989
- const o = setTimeout(() => {
990
- s = !0, t.abort();
991
- }, Vn);
995
+ async function Xn(e, t) {
996
+ let a = !1;
997
+ const r = setTimeout(() => {
998
+ a = !0, t.abort();
999
+ }, Gn);
992
1000
  try {
993
1001
  const n = await fetch(e, { method: "HEAD", signal: t.signal });
994
1002
  if (t.signal.aborted) throw ze(t.signal);
@@ -1002,13 +1010,13 @@ async function Kn(e, t) {
1002
1010
  const l = new Error(`字体请求返回 HTTP ${n.status}`);
1003
1011
  return { status: "error", fontUrl: e, message: Pe(e, l.message), cause: l };
1004
1012
  }
1005
- const r = n.headers.get("content-type") ?? "";
1006
- if (/text\/html|application\/xhtml\+xml/i.test(r)) {
1013
+ const o = n.headers.get("content-type") ?? "";
1014
+ if (/text\/html|application\/xhtml\+xml/i.test(o)) {
1007
1015
  const l = new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件");
1008
1016
  return { status: "error", fontUrl: e, message: Pe(e, l.message), cause: l };
1009
1017
  }
1010
- if (/^text\//i.test(r) || /(?:\/|\+)json(?:\s*;|$)/i.test(r)) {
1011
- const l = new Error(`字体 URL 返回 ${r} 文本响应,不是字体文件`);
1018
+ if (/^text\//i.test(o) || /(?:\/|\+)json(?:\s*;|$)/i.test(o)) {
1019
+ const l = new Error(`字体 URL 返回 ${o} 文本响应,不是字体文件`);
1012
1020
  return { status: "error", fontUrl: e, message: Pe(e, l.message), cause: l };
1013
1021
  }
1014
1022
  return {
@@ -1017,103 +1025,103 @@ async function Kn(e, t) {
1017
1025
  message: "PDF 字体资源可达;文字覆盖范围将在实际导出时校验"
1018
1026
  };
1019
1027
  } catch (n) {
1020
- if (t.signal.aborted && !s) throw ze(t.signal);
1028
+ if (t.signal.aborted && !a) throw ze(t.signal);
1021
1029
  return {
1022
1030
  status: "error",
1023
1031
  fontUrl: e,
1024
- message: Pe(e, s ? "字体检查超时,请检查网络或字体服务" : "字体检查失败,请检查网络、字体服务或跨域访问配置"),
1032
+ message: Pe(e, a ? "字体检查超时,请检查网络或字体服务" : "字体检查失败,请检查网络、字体服务或跨域访问配置"),
1025
1033
  cause: n
1026
1034
  };
1027
1035
  } finally {
1028
- clearTimeout(o);
1036
+ clearTimeout(r);
1029
1037
  }
1030
1038
  }
1031
- function Yn(e, t) {
1039
+ function Qn(e, t) {
1032
1040
  if (t?.aborted) return Promise.reject(ze(t));
1033
1041
  if (!e)
1034
1042
  return Promise.resolve({ status: "disabled", fontUrl: e, message: "已停用自定义 PDF 字体;内置字体用于西文,其他文字会在导出时校验" });
1035
- const s = gt.get(e);
1036
- if (s) return Promise.resolve(s);
1037
- let o = me.get(e);
1038
- if (!o) {
1039
- const r = new AbortController();
1040
- o = { controller: r, promise: Kn(e, r), subscribers: 0 };
1041
- const l = o;
1042
- me.set(e, l), l.promise = l.promise.then((u) => (!r.signal.aborted && u.status === "available" && gt.set(e, u), u)).finally(() => {
1043
- me.get(e) === l && me.delete(e);
1043
+ const a = gt.get(e);
1044
+ if (a) return Promise.resolve(a);
1045
+ let r = ve.get(e);
1046
+ if (!r) {
1047
+ const o = new AbortController();
1048
+ r = { controller: o, promise: Xn(e, o), subscribers: 0 };
1049
+ const l = r;
1050
+ ve.set(e, l), l.promise = l.promise.then((u) => (!o.signal.aborted && u.status === "available" && gt.set(e, u), u)).finally(() => {
1051
+ ve.get(e) === l && ve.delete(e);
1044
1052
  });
1045
1053
  }
1046
- const n = o;
1047
- return n.subscribers++, new Promise((r, l) => {
1054
+ const n = r;
1055
+ return n.subscribers++, new Promise((o, l) => {
1048
1056
  let u = !1;
1049
1057
  const p = () => u ? !1 : (u = !0, n.subscribers--, t?.removeEventListener("abort", m), !0), m = () => {
1050
- p() && (n.subscribers === 0 && (me.get(e) === n && me.delete(e), n.controller.abort()), l(ze(t)));
1058
+ p() && (n.subscribers === 0 && (ve.get(e) === n && ve.delete(e), n.controller.abort()), l(ze(t)));
1051
1059
  };
1052
1060
  t?.addEventListener("abort", m, { once: !0 }), n.promise.then(
1053
- (c) => {
1054
- p() && r(c);
1061
+ (d) => {
1062
+ p() && o(d);
1055
1063
  },
1056
- (c) => {
1057
- p() && l(c);
1064
+ (d) => {
1065
+ p() && l(d);
1058
1066
  }
1059
1067
  ), t?.aborted && m();
1060
1068
  });
1061
1069
  }
1062
- function Zn(e = { fontUrl: "/simhei.ttf" }) {
1070
+ function _n(e = { fontUrl: "/simhei.ttf" }) {
1063
1071
  let t = null;
1064
- const s = async (o, n) => {
1072
+ const a = async (r, n) => {
1065
1073
  t || (t = await import("@agile-team/mach-report/pdf"));
1066
- let r = null;
1074
+ let o = null;
1067
1075
  if (e.fontUrl)
1068
1076
  try {
1069
- if (r = await t.loadFontWithCache(e.fontUrl, { strict: !0 }), !r?.byteLength) throw new Error("字体文件为空或加载失败");
1077
+ if (o = await t.loadFontWithCache(e.fontUrl, { strict: !0 }), !o?.byteLength) throw new Error("字体文件为空或加载失败");
1070
1078
  } catch (f) {
1071
1079
  const h = f instanceof Error ? f.message : String(f);
1072
1080
  throw nt(Pe(e.fontUrl, h), f);
1073
1081
  }
1074
1082
  let l;
1075
1083
  try {
1076
- l = await t.renderPlanToPdf(o, r ? { customFontBytes: r } : {});
1084
+ l = await t.renderPlanToPdf(r, o ? { customFontBytes: o } : {});
1077
1085
  } catch (f) {
1078
- if (!r) throw f;
1086
+ if (!o) throw f;
1079
1087
  const h = f instanceof Error ? f.message : String(f);
1080
1088
  throw nt(`PDF 生成失败:${h}。当前字体 URL 为 ${JSON.stringify(e.fontUrl)};请确认该文件是有效字体,或重新配置 pdfFontUrl`, f);
1081
1089
  }
1082
- const { bytes: u, unsupportedTextCount: p, pageErrors: m, fidelityWarnings: c } = l;
1090
+ const { bytes: u, unsupportedTextCount: p, pageErrors: m, fidelityWarnings: d } = l;
1083
1091
  if (p > 0)
1084
1092
  throw new Error(`PDF 中有 ${p} 行文字无法编码;请部署支持所用文字的字体并配置 pdfFontUrl`);
1085
1093
  if (m.length > 0)
1086
1094
  throw new Error(`PDF 有 ${m.length} 页渲染失败:${m[0]}`);
1087
- return c.length > 0 && n?.(`PDF 有 ${c.length} 处版式降级:${c.slice(0, 2).join(";")}`), u;
1095
+ return d.length > 0 && n?.(`PDF 有 ${d.length} 处版式降级:${d.slice(0, 2).join(";")}`), u;
1088
1096
  };
1089
- return s.checkFont = (o) => Yn(e.fontUrl, o), s;
1097
+ return a.checkFont = (r) => Qn(e.fontUrl, r), a;
1090
1098
  }
1091
- class ve extends Error {
1092
- constructor(t, s, o) {
1093
- super(s), this.name = "MachReportError", this.code = t, this.cause = o;
1099
+ class he extends Error {
1100
+ constructor(t, a, r) {
1101
+ super(a), this.name = "MachReportError", this.code = t, this.cause = r;
1094
1102
  }
1095
1103
  }
1096
- function Jn(e) {
1097
- return e instanceof ve ? { code: e.code, cause: e.cause } : { code: "render", cause: e };
1104
+ function er(e) {
1105
+ return e instanceof he ? { code: e.code, cause: e.cause } : { code: "render", cause: e };
1098
1106
  }
1099
- const Gn = {
1107
+ const tr = {
1100
1108
  key: 2,
1101
1109
  class: "mrp-export-notice mrp-export-warning",
1102
1110
  role: "status"
1103
- }, Xn = { class: "mrp-main" }, Qn = {
1111
+ }, nr = { class: "mrp-main" }, rr = {
1104
1112
  key: 0,
1105
1113
  class: "mrp-state"
1106
- }, _n = {
1114
+ }, or = {
1107
1115
  key: 1,
1108
1116
  class: "mrp-state mrp-error"
1109
- }, er = {
1117
+ }, ar = {
1110
1118
  key: 2,
1111
1119
  class: "mrp-state"
1112
- }, tr = ["data-page"], nr = ["onClick"], rr = ["data-thumb"], or = { class: "mrp-thumb-no" }, ar = { class: "mrp-overlay" }, sr = {
1120
+ }, sr = ["data-page"], lr = ["onClick"], ir = ["data-thumb"], ur = { class: "mrp-thumb-no" }, cr = { class: "mrp-overlay" }, dr = {
1113
1121
  key: 3,
1114
1122
  class: "mrp-debug",
1115
1123
  "aria-hidden": "true"
1116
- }, Se = 96 / 25.4, bt = "mach-report:ui", wt = "mach-report:ui:wide", lr = /* @__PURE__ */ rt({
1124
+ }, Se = 96 / 25.4, bt = "mach-report:ui", wt = "mach-report:ui:wide", fr = /* @__PURE__ */ rt({
1117
1125
  __name: "ReportPreview",
1118
1126
  props: {
1119
1127
  reportId: {
@@ -1151,192 +1159,193 @@ const Gn = {
1151
1159
  }
1152
1160
  },
1153
1161
  emits: ["loaded", "error", "warning"],
1154
- setup(e, { expose: t, emit: s }) {
1162
+ setup(e, { expose: t, emit: a }) {
1155
1163
  Nt((i) => ({
1156
- v5d32312f: S.value + "px"
1164
+ v8eb72344: S.value + "px"
1157
1165
  }));
1158
- const o = e, n = s, r = Ie(null), l = B(!1), u = B(""), p = Ie(null), m = B(null), c = B(!1), f = Ie(Object.freeze({ status: "unchecked", fontUrl: "" })), h = B(null), v = B(1), A = B(null), W = B(null), b = B(null), I = B(!1), E = mn(), D = k(() => !!r.value?.pages.length && r.value.pages.every((i) => i.layout === "wide")), S = k(() => Math.max(0, K.value));
1159
- let C = bt;
1160
- const H = Be(Qt, null), j = Be(_t, null), q = k(() => Et(o.reportId)), Y = k(() => o.fetcher ?? H), O = k(() => r.value?.pages.length ?? 0), ae = k(() => Object.freeze({
1166
+ const r = e, n = a, o = Ie(null), l = B(!1), u = B(""), p = Ie(null), m = B(null), d = B(!1), f = Ie(Object.freeze({ status: "unchecked", fontUrl: "" })), h = B(null), v = B(1), A = B(null), W = B(null), b = B(null), I = B(!1), E = wn(), D = k(() => !!o.value?.pages.length && o.value.pages.every((i) => i.layout === "wide")), S = k(() => Math.max(0, U.value));
1167
+ let M = bt;
1168
+ const q = Be(en, null), K = Be(tn, null), V = k(() => Et(r.reportId)), Y = k(() => r.fetcher ?? q), O = k(() => o.value?.pages.length ?? 0), ae = k(() => Object.freeze({
1161
1169
  loading: l.value,
1162
1170
  hasPlan: O.value > 0,
1163
1171
  pageCount: O.value,
1164
1172
  currentPage: v.value,
1165
1173
  exporting: m.value,
1166
- printing: c.value,
1174
+ printing: d.value,
1167
1175
  canExport: !l.value && O.value > 0 && m.value === null,
1168
- canPrint: !l.value && O.value > 0 && !c.value,
1176
+ canPrint: !l.value && O.value > 0 && !d.value,
1169
1177
  error: p.value,
1170
1178
  pdfFont: f.value
1171
1179
  }));
1172
1180
  function ee(i, g, w) {
1173
1181
  p.value = Object.freeze({ message: i, code: g, cause: w }), n("error", i, { code: g, cause: w });
1174
1182
  }
1175
- const fe = Un(), a = k(() => Nn(fe.value, o.preset)), d = k(() => ({
1176
- ...a.value.messages,
1177
- ...o.messages
1178
- })), y = k(() => o.showExport ?? a.value.showExport), R = k(() => o.showPrint ?? a.value.showPrint), T = k(() => o.showPdfWindow ?? a.value.showPdfWindow), K = k(() => o.gapPx ?? (D.value ? 0 : a.value.gapPx)), J = k(() => o.showParams ?? a.value.showParams);
1183
+ const pe = Jn(), s = k(() => Yn(pe.value, r.preset)), c = k(() => ({
1184
+ ...s.value.messages,
1185
+ ...r.messages
1186
+ })), y = k(() => r.showExport ?? s.value.showExport), R = k(() => r.showPrint ?? s.value.showPrint), T = k(() => r.showPdfWindow ?? s.value.showPdfWindow), U = k(() => r.gapPx ?? (D.value ? 0 : s.value.gapPx)), J = k(() => r.showParams ?? s.value.showParams);
1179
1187
  let G = null, qe = null;
1180
1188
  function lt() {
1181
- if (j) return j;
1182
- const i = a.value.pdfFontUrl;
1183
- return (!qe || G !== i) && (G = i, qe = Zn({ fontUrl: i })), qe;
1189
+ if (K) return K;
1190
+ const i = s.value.pdfFontUrl;
1191
+ return (!qe || G !== i) && (G = i, qe = _n({ fontUrl: i })), qe;
1184
1192
  }
1185
- let $e = 0, he = null, ke = null, ge = !1;
1193
+ let $e = 0, ge = null, ke = null, se = !1;
1186
1194
  function Ne() {
1187
- $e++, he?.abort(), he = null;
1195
+ $e++, ge?.abort(), ge = null;
1188
1196
  }
1189
- async function Me() {
1190
- if (ge) throw new ve("config", "报表预览已卸载");
1197
+ async function Ce() {
1198
+ if (se) throw new he("config", "报表预览已卸载");
1191
1199
  Ne();
1192
1200
  const i = $e, g = new AbortController();
1193
- he = g;
1194
- const w = a.value.pdfFontUrl;
1201
+ ge = g;
1202
+ const w = s.value.pdfFontUrl;
1195
1203
  f.value = Object.freeze({ status: "checking", fontUrl: w });
1196
1204
  try {
1197
- const U = lt(), V = U.checkFont ? await U.checkFont(g.signal) : { status: "unverified", fontUrl: "", message: "自定义 PDF 导出器未提供字体预检查;字体由宿主确认" };
1198
- return !ge && i === $e && !g.signal.aborted && (f.value = Object.freeze({ ...V })), V;
1199
- } catch (U) {
1200
- if (g.signal.aborted) throw U;
1201
- const V = {
1205
+ const N = lt(), j = N.checkFont ? await N.checkFont(g.signal) : { status: "unverified", fontUrl: "", message: "自定义 PDF 导出器未提供字体预检查;字体由宿主确认" };
1206
+ return !se && i === $e && !g.signal.aborted && (f.value = Object.freeze({ ...j })), j;
1207
+ } catch (N) {
1208
+ if (g.signal.aborted) throw N;
1209
+ const j = {
1202
1210
  status: "error",
1203
1211
  fontUrl: w,
1204
- message: U instanceof Error ? U.message : "PDF 字体检查失败",
1205
- cause: U
1212
+ message: N instanceof Error ? N.message : "PDF 字体检查失败",
1213
+ cause: N
1206
1214
  };
1207
- return !ge && i === $e && (f.value = Object.freeze(V)), V;
1215
+ return !se && i === $e && (f.value = Object.freeze(j)), j;
1208
1216
  } finally {
1209
- he === g && (he = null);
1217
+ ge === g && (ge = null);
1210
1218
  }
1211
1219
  }
1212
- function Mt() {
1213
- Me().catch(() => {
1220
+ function Ct() {
1221
+ Ce().catch(() => {
1214
1222
  });
1215
1223
  }
1216
1224
  Q(
1217
- [r, () => a.value.pdfFontUrl, y, T],
1225
+ [o, () => s.value.pdfFontUrl, y, T],
1218
1226
  () => {
1219
- const i = f.value.fontUrl === a.value.pdfFontUrl;
1220
- Ne(), (!i || f.value.status === "checking") && (f.value = Object.freeze({ status: "unchecked", fontUrl: a.value.pdfFontUrl })), !ge && O.value > 0 && (y.value || T.value) && Me().catch(() => {
1227
+ const i = f.value.fontUrl === s.value.pdfFontUrl;
1228
+ Ne(), (!i || f.value.status === "checking") && (f.value = Object.freeze({ status: "unchecked", fontUrl: s.value.pdfFontUrl })), !se && O.value > 0 && (y.value || T.value) && Ce().catch(() => {
1221
1229
  });
1222
1230
  },
1223
1231
  { immediate: !0 }
1224
1232
  );
1225
- const se = k(
1226
- () => o.paramDefs ?? Y.value?.getParamDefs?.(q.value) ?? []
1227
- ), ue = B({}), je = B(!1);
1233
+ const le = k(
1234
+ () => r.paramDefs ?? Y.value?.getParamDefs?.(V.value) ?? []
1235
+ ), ce = B({}), je = B(!1);
1228
1236
  function be(i) {
1229
1237
  const g = {};
1230
1238
  for (const w of i)
1231
- g[w.field] = o.params[w.field] ?? w.defaultValue ?? "";
1232
- ue.value = g, je.value = !1;
1239
+ g[w.field] = r.params[w.field] ?? w.defaultValue ?? "";
1240
+ ce.value = g, je.value = !1;
1233
1241
  }
1234
- be(se.value), Q(se, (i) => be(i)), Q(q, () => be(se.value)), Q(() => JSON.stringify(o.params), () => be(se.value));
1235
- const Ct = k(() => {
1236
- const i = { ...o.params };
1237
- for (const [g, w] of Object.entries(ue.value))
1242
+ be(le.value), Q(le, (i) => be(i)), Q(V, () => be(le.value)), Q(() => JSON.stringify(r.params), () => be(le.value));
1243
+ const Mt = k(() => {
1244
+ const i = { ...r.params };
1245
+ for (const [g, w] of Object.entries(ce.value))
1238
1246
  w === "" ? delete i[g] : i[g] = w;
1239
1247
  return i;
1240
1248
  });
1241
1249
  function Ft() {
1242
- return se.value.filter(
1243
- (i) => i.required === !0 && !(ue.value[i.field] ?? "").trim()
1250
+ return le.value.filter(
1251
+ (i) => i.required === !0 && !(ce.value[i.field] ?? "").trim()
1244
1252
  );
1245
1253
  }
1246
1254
  function Rt() {
1247
1255
  je.value = !0;
1248
1256
  const i = Ft();
1249
1257
  if (i.length > 0) {
1250
- const g = i[0].label ?? i[0].field, w = d.value.paramRequired.replace("{label}", g);
1258
+ const g = i[0].label ?? i[0].field, w = c.value.paramRequired.replace("{label}", g);
1251
1259
  u.value = w, ee(w, "param");
1252
1260
  return;
1253
1261
  }
1254
- ce();
1262
+ de();
1255
1263
  }
1256
1264
  function Tt() {
1257
- be(se.value);
1265
+ be(le.value);
1258
1266
  }
1259
1267
  const St = k(() => ({
1260
- height: o.height,
1261
- ...jn(a.value.theme)
1262
- })), { zoom: Z, zoomMode: we, applyFitZoom: it, setZoom: ye } = nn(() => ({
1268
+ height: r.height,
1269
+ ...Zn(s.value.theme)
1270
+ })), { zoom: Z, zoomMode: we, applyFitZoom: it, setZoom: ye } = on(() => ({
1263
1271
  viewport: W.value,
1264
1272
  pageWidthPx: Ue.contentSize.value.w || 210 * Se
1265
- })), Ue = tn(r, Z, {
1273
+ })), Ue = rn(o, Z, {
1266
1274
  pxPerMm: Se,
1267
- gapPx: K,
1268
- overscan: k(() => a.value.preview.overscanPages)
1269
- }), { contentSize: Ve, windowRange: xe, visiblePages: ut, makeScrollHandler: It, refreshViewport: Ke } = Ue, Ot = It(v, O);
1275
+ gapPx: U,
1276
+ overscan: k(() => s.value.preview.overscanPages)
1277
+ }), { contentSize: Ve, windowRange: xe, visiblePages: ut, makeScrollHandler: It, refreshViewport: Ke } = Ue, Dt = It(v, O);
1270
1278
  function Ye(i) {
1271
1279
  ye(i * 100);
1272
1280
  }
1273
- function Ce() {
1274
- Dt(), r.value = null, v.value = 1, L.reset();
1281
+ function Me() {
1282
+ Ot(), o.value = null, v.value = 1, L.reset();
1275
1283
  }
1276
- let le = 0, te = null;
1277
- async function ce() {
1278
- const i = ++le;
1284
+ let ie = 0, te = null;
1285
+ async function de() {
1286
+ if (se) return;
1287
+ const i = ++ie;
1279
1288
  te?.abort(), te = null;
1280
1289
  const g = Y.value;
1281
- if (l.value = !1, p.value = null, q.value.length === 0) {
1282
- u.value = "缺少报表 ID", Ce(), ee(u.value, "param");
1290
+ if (l.value = !1, p.value = null, V.value.length === 0) {
1291
+ u.value = "缺少报表 ID", Me(), ee(u.value, "param");
1283
1292
  return;
1284
1293
  }
1285
1294
  if (!g) {
1286
- u.value = "未提供渲染数据源 fetcher", Ce(), ee(u.value, "config");
1295
+ u.value = "未提供渲染数据源 fetcher", Me(), ee(u.value, "config");
1287
1296
  return;
1288
1297
  }
1289
- l.value = !0, u.value = "", h.value = null, Ce();
1290
- const w = E.start(), U = new AbortController();
1291
- te = U;
1292
- const V = /* @__PURE__ */ new Set();
1298
+ l.value = !0, u.value = "", h.value = null, Me();
1299
+ const w = E.start(), N = new AbortController();
1300
+ te = N;
1301
+ const j = /* @__PURE__ */ new Set();
1293
1302
  function Re(z) {
1294
- i !== le || U.signal.aborted || V.has(z) || (V.add(z), a.value.logger.warn("[mach-report] 报表告警:", z), n("warning", z));
1303
+ i !== ie || N.signal.aborted || j.has(z) || (j.add(z), s.value.logger.warn("[mach-report] 报表告警:", z), n("warning", z));
1295
1304
  }
1296
1305
  try {
1297
1306
  const z = await g({
1298
- reportIds: q.value,
1299
- params: { ...Ct.value },
1300
- signal: U.signal,
1307
+ reportIds: V.value,
1308
+ params: { ...Mt.value },
1309
+ signal: N.signal,
1301
1310
  onWarning: Re
1302
1311
  });
1303
- if (i !== le) return;
1312
+ if (i !== ie) return;
1304
1313
  const X = Jt(z);
1305
1314
  if (!X.ok) {
1306
1315
  const Te = X.errors.slice(0, 3).map((pt) => `${pt.path}: ${pt.message}`).join("; ");
1307
- throw new ve(
1316
+ throw new he(
1308
1317
  "validate",
1309
1318
  `渲染计划校验失败(${X.errors.length} 处): ${Te}`
1310
1319
  );
1311
1320
  }
1312
- if (X.warnings.forEach((Te) => Re(`${Te.path}: ${Te.message}`)), i !== le || U.signal.aborted) return;
1313
- r.value = z, v.value = 1, E.end(w), W.value && (W.value.scrollTop = 0, W.value.scrollLeft = 0);
1314
- const ie = D.value ? wt : bt;
1315
- ie !== C && (C = ie, ft()), we.value === "fit" && it(), n("loaded", z.pages.length);
1321
+ if (X.warnings.forEach((Te) => Re(`${Te.path}: ${Te.message}`)), i !== ie || N.signal.aborted) return;
1322
+ o.value = z, v.value = 1, E.end(w), W.value && (W.value.scrollTop = 0, W.value.scrollLeft = 0);
1323
+ const ue = D.value ? wt : bt;
1324
+ ue !== M && (M = ue, ft()), we.value === "fit" && it(), n("loaded", z.pages.length);
1316
1325
  } catch (z) {
1317
- if (i !== le) return;
1318
- const X = z instanceof ve ? z : z instanceof Gt ? new ve(z.code, z.message, z.cause) : new ve(
1326
+ if (i !== ie) return;
1327
+ const X = z instanceof he ? z : z instanceof Gt ? new he(z.code, z.message, z.cause) : new he(
1319
1328
  "fetch",
1320
1329
  z instanceof Error ? z.message : "预览加载失败",
1321
1330
  z
1322
1331
  );
1323
1332
  u.value = X.message;
1324
- const ie = Jn(X);
1325
- ee(X.message, ie.code, ie.cause);
1333
+ const ue = er(X);
1334
+ ee(X.message, ue.code, ue.cause);
1326
1335
  } finally {
1327
- i === le && (l.value = !1), te === U && (te = null);
1336
+ i === ie && (l.value = !1), te === N && (te = null);
1328
1337
  }
1329
1338
  }
1330
1339
  function ne(i) {
1331
- if (O.value <= 0) return;
1340
+ if (se || O.value <= 0) return;
1332
1341
  const g = Math.max(1, Math.min(O.value, i));
1333
1342
  v.value = g;
1334
1343
  const w = W.value;
1335
1344
  w && (w.scrollTop = Ue.pageOffsetPx(g - 1) * Z.value, Ke(w));
1336
1345
  }
1337
- const Fe = on(r, {
1346
+ const Fe = sn(o, {
1338
1347
  getPdfExporter: lt,
1339
- getXlsxOptions: () => a.value.xlsx,
1348
+ getXlsxOptions: () => s.value.xlsx,
1340
1349
  onError: (i, g) => {
1341
1350
  h.value = { kind: "error", message: i }, ee(i, g ?? "print");
1342
1351
  },
@@ -1346,13 +1355,13 @@ const Gn = {
1346
1355
  onBusy: (i) => {
1347
1356
  m.value = i, i ? h.value = {
1348
1357
  kind: "progress",
1349
- message: d.value.exporting.replace("{format}", i)
1358
+ message: c.value.exporting.replace("{format}", i)
1350
1359
  } : h.value?.kind === "progress" && (h.value = null);
1351
1360
  },
1352
1361
  onPrinting: (i) => {
1353
- c.value = i;
1362
+ d.value = i;
1354
1363
  }
1355
- }), { releasePrintFrame: Dt, dispose: Wt } = Fe;
1364
+ }), { releasePrintFrame: Ot, dispose: Wt } = Fe;
1356
1365
  async function Ze() {
1357
1366
  p.value = null, await Fe.print();
1358
1367
  }
@@ -1363,26 +1372,26 @@ const Gn = {
1363
1372
  p.value = null, Fe.openPdfWindow();
1364
1373
  }
1365
1374
  async function ct(i, g = {}) {
1366
- ue.value = { ...ue.value, ...i }, g.reload !== !1 && await ce();
1375
+ se || (ce.value = { ...ce.value, ...i }, g.reload !== !1 && await de());
1367
1376
  }
1368
- yt(en, {
1369
- reload: ce,
1377
+ yt(nn, {
1378
+ reload: de,
1370
1379
  print: Ze,
1371
1380
  exportAs: Je,
1372
1381
  openPdfWindow: Ge,
1373
1382
  gotoPage: ne,
1374
1383
  setParams: ct,
1375
- checkPdfFont: Me,
1384
+ checkPdfFont: Ce,
1376
1385
  get state() {
1377
1386
  return ae.value;
1378
1387
  }
1379
1388
  });
1380
- const L = dn({
1381
- plan: r,
1389
+ const L = hn({
1390
+ plan: o,
1382
1391
  gotoPage: ne,
1383
- debounceMs: k(() => a.value.preview.searchDebounceMs),
1384
- highlight: sn,
1385
- clearHighlights: an
1392
+ debounceMs: k(() => s.value.preview.searchDebounceMs),
1393
+ highlight: un,
1394
+ clearHighlights: ln
1386
1395
  });
1387
1396
  function Bt(i) {
1388
1397
  i.ctrlKey && (i.preventDefault(), Ye(Z.value * (i.deltaY < 0 ? 1.1 : 1 / 1.1)));
@@ -1417,7 +1426,7 @@ const Gn = {
1417
1426
  function Lt() {
1418
1427
  try {
1419
1428
  localStorage.setItem(
1420
- C,
1429
+ M,
1421
1430
  JSON.stringify({ zoomMode: we.value === "fit" ? "fit" : Math.round(Z.value * 100) })
1422
1431
  );
1423
1432
  } catch {
@@ -1430,41 +1439,41 @@ const Gn = {
1430
1439
  if (!D.value || !g) return;
1431
1440
  const w = `${L.query.value}:${L.matchIndex.value}:${g.pageIndex}`;
1432
1441
  if (!i && w === Xe) return;
1433
- const V = A.value?.querySelector(`[data-page="${g.pageIndex + 1}"]`)?.querySelectorAll("mark.mrp-hit")[g.occurrence];
1434
- V && (V.scrollIntoView?.({ block: "nearest", inline: "nearest" }), Xe = w);
1442
+ const j = A.value?.querySelector(`[data-page="${g.pageIndex + 1}"]`)?.querySelectorAll("mark.mrp-hit")[g.occurrence];
1443
+ j && (j.scrollIntoView?.({ block: "nearest", inline: "nearest" }), Xe = w);
1435
1444
  }
1436
1445
  vt(() => {
1437
- const i = r.value;
1446
+ const i = o.value;
1438
1447
  if (!i) return;
1439
1448
  const g = L.activeMatch.value;
1440
1449
  L.matchIndex.value, g || (Xe = ""), ut.value;
1441
1450
  const w = A.value;
1442
1451
  if (!w) return;
1443
- w.querySelectorAll(".mrp-page-holder").forEach((V) => {
1444
- const Re = Number(V.dataset.page ?? 0) - 1, z = i.pages[Re];
1445
- if (!z || V.childElementCount > 0) {
1446
- if (V.firstElementChild) {
1447
- const ie = V.firstElementChild;
1448
- L.clear(ie), L.apply(ie);
1452
+ w.querySelectorAll(".mrp-page-holder").forEach((j) => {
1453
+ const Re = Number(j.dataset.page ?? 0) - 1, z = i.pages[Re];
1454
+ if (!z || j.childElementCount > 0) {
1455
+ if (j.firstElementChild) {
1456
+ const ue = j.firstElementChild;
1457
+ L.clear(ue), L.apply(ue);
1449
1458
  }
1450
1459
  return;
1451
1460
  }
1452
- V.style.width = `${z.pageWidthMm * Se}px`;
1461
+ j.style.width = `${z.pageWidthMm * Se}px`;
1453
1462
  const X = xt(z, 96, {}, document);
1454
- L.apply(X), V.appendChild(X);
1463
+ L.apply(X), j.appendChild(X);
1455
1464
  }), dt();
1456
1465
  }, { flush: "post" }), Q(() => L.query.value, (i) => {
1457
1466
  i || A.value?.querySelectorAll(".mrp-page-holder").forEach((g) => {
1458
1467
  L.clear(g);
1459
1468
  });
1460
1469
  });
1461
- const _ = pn(r, {
1470
+ const _ = bn(o, {
1462
1471
  thumbsRoot: b,
1463
1472
  visible: I,
1464
1473
  renderThumbCanvas: (i) => {
1465
1474
  try {
1466
- const g = r.value.pages[i], w = Math.min(0.2, 116 / Math.max(1, g.pageWidthMm * Se)), { canvases: U } = Xt(r.value, { start: i, end: i, dpr: w });
1467
- return U[0] ?? null;
1475
+ const g = o.value.pages[i], w = Math.min(0.2, 116 / Math.max(1, g.pageWidthMm * Se)), { canvases: N } = Xt(o.value, { start: i, end: i, dpr: w });
1476
+ return N[0] ?? null;
1468
1477
  } catch {
1469
1478
  return null;
1470
1479
  }
@@ -1473,8 +1482,8 @@ const Gn = {
1473
1482
  vt(() => {
1474
1483
  _.schedule();
1475
1484
  }, { flush: "post" });
1476
- const zt = k(() => o.debug), { debugStats: pe } = fn(zt, {
1477
- plan: r,
1485
+ const zt = k(() => r.debug), { debugStats: me } = gn(zt, {
1486
+ plan: o,
1478
1487
  pageCount: O,
1479
1488
  windowRange: xe,
1480
1489
  zoom: Z,
@@ -1484,41 +1493,41 @@ const Gn = {
1484
1493
  Ke(W.value), _.schedule(), we.value === "fit" && it(), dt(!0);
1485
1494
  }
1486
1495
  function ft() {
1487
- ye(C === wt ? 100 : "fit");
1496
+ ye(M === wt ? 100 : "fit");
1488
1497
  try {
1489
- const i = JSON.parse(localStorage.getItem(C) ?? "{}");
1498
+ const i = JSON.parse(localStorage.getItem(M) ?? "{}");
1490
1499
  i.zoomMode === "fit" ? ye("fit") : typeof i.zoomMode == "number" && ye(i.zoomMode);
1491
1500
  } catch {
1492
1501
  }
1493
1502
  }
1494
1503
  return jt(() => {
1495
- window.addEventListener("resize", Qe), typeof ResizeObserver < "u" && W.value && (ke = new ResizeObserver(Qe), ke.observe(W.value)), Ke(W.value), ft(), o.autoLoad && ce();
1504
+ window.addEventListener("resize", Qe), typeof ResizeObserver < "u" && W.value && (ke = new ResizeObserver(Qe), ke.observe(W.value)), Ke(W.value), ft(), r.autoLoad && de();
1496
1505
  }), Ut(() => {
1497
- ge = !0, Ne(), le++, te?.abort(), te = null, window.removeEventListener("resize", Qe), ke?.disconnect(), ke = null, _.destroy(), L.reset(), Wt();
1506
+ se = !0, Ne(), ie++, te?.abort(), te = null, window.removeEventListener("resize", Qe), ke?.disconnect(), ke = null, _.destroy(), L.reset(), Wt();
1498
1507
  }), Q(
1499
- () => [JSON.stringify(q.value), JSON.stringify(o.params), Y.value],
1508
+ () => [JSON.stringify(V.value), JSON.stringify(r.params), Y.value],
1500
1509
  () => {
1501
- if (o.autoLoad) {
1502
- ce();
1510
+ if (r.autoLoad) {
1511
+ de();
1503
1512
  return;
1504
1513
  }
1505
- le++, te?.abort(), te = null, l.value = !1, u.value = "", p.value = null, h.value = null, Ce();
1514
+ ie++, te?.abort(), te = null, l.value = !1, u.value = "", p.value = null, h.value = null, Me();
1506
1515
  }
1507
- ), t({ reload: ce, print: Ze, exportAs: Je, openPdfWindow: Ge, gotoPage: ne, setParams: ct, checkPdfFont: Me, state: ae }), (i, g) => (P(), $("div", {
1516
+ ), t({ reload: de, print: Ze, exportAs: Je, openPdfWindow: Ge, gotoPage: ne, setParams: ct, checkPdfFont: Ce, state: ae }), (i, g) => (P(), $("div", {
1508
1517
  class: oe(["mach-report-preview", { "mrp-wide-report": D.value }]),
1509
1518
  style: re(St.value)
1510
1519
  }, [
1511
- J.value && se.value.length > 0 ? (P(), Vt(Ln, {
1520
+ J.value && le.value.length > 0 ? (P(), Vt(jn, {
1512
1521
  key: 0,
1513
- defs: se.value,
1514
- modelValue: ue.value,
1515
- "onUpdate:modelValue": g[0] || (g[0] = (w) => ue.value = w),
1516
- messages: d.value,
1522
+ defs: le.value,
1523
+ modelValue: ce.value,
1524
+ "onUpdate:modelValue": g[0] || (g[0] = (w) => ce.value = w),
1525
+ messages: c.value,
1517
1526
  attempted: je.value,
1518
1527
  onQuery: Rt,
1519
1528
  onReset: Tt
1520
- }, null, 8, ["defs", "modelValue", "messages", "attempted"])) : N("", !0),
1521
- Kt(Mn, {
1529
+ }, null, 8, ["defs", "modelValue", "messages", "attempted"])) : H("", !0),
1530
+ Kt(Sn, {
1522
1531
  "page-count": O.value,
1523
1532
  "current-page": v.value,
1524
1533
  "zoom-mode": x(we),
@@ -1526,7 +1535,7 @@ const Gn = {
1526
1535
  "show-export": y.value,
1527
1536
  "show-print": R.value,
1528
1537
  "show-pdf-window": T.value,
1529
- messages: d.value,
1538
+ messages: c.value,
1530
1539
  search: { visible: x(L).visible.value, query: x(L).query.value, matchIndex: x(L).matchIndex.value, matchCount: x(L).matchCount.value, searching: x(L).searching.value },
1531
1540
  "thumbs-visible": I.value,
1532
1541
  onGoto: ne,
@@ -1543,15 +1552,15 @@ const Gn = {
1543
1552
  key: 1,
1544
1553
  class: oe(["mrp-export-notice", `mrp-export-${h.value.kind}`]),
1545
1554
  role: "alert"
1546
- }, M(h.value.message), 3)) : N("", !0),
1547
- f.value.status === "error" && (y.value || T.value) ? (P(), $("div", Gn, [
1548
- et(M(d.value.pdfFontUnavailable) + " ", 1),
1555
+ }, C(h.value.message), 3)) : H("", !0),
1556
+ f.value.status === "error" && (y.value || T.value) ? (P(), $("div", tr, [
1557
+ et(C(c.value.pdfFontUnavailable) + " ", 1),
1549
1558
  F("button", {
1550
1559
  type: "button",
1551
- onClick: Mt
1552
- }, M(d.value.retry), 1)
1553
- ])) : N("", !0),
1554
- F("div", Xn, [
1560
+ onClick: Ct
1561
+ }, C(c.value.retry), 1)
1562
+ ])) : H("", !0),
1563
+ F("div", nr, [
1555
1564
  F("div", {
1556
1565
  ref_key: "viewportRef",
1557
1566
  ref: W,
@@ -1559,16 +1568,16 @@ const Gn = {
1559
1568
  tabindex: "0",
1560
1569
  onWheel: Bt,
1561
1570
  onKeydown: At,
1562
- onScrollPassive: g[3] || (g[3] = (w) => x(Ot)(w.target))
1571
+ onScrollPassive: g[3] || (g[3] = (w) => x(Dt)(w.target))
1563
1572
  }, [
1564
- l.value ? (P(), $("div", Qn, M(d.value.loading), 1)) : u.value ? (P(), $("div", _n, [
1565
- et(M(u.value) + " ", 1),
1573
+ l.value ? (P(), $("div", rr, C(c.value.loading), 1)) : u.value ? (P(), $("div", or, [
1574
+ et(C(u.value) + " ", 1),
1566
1575
  F("button", {
1567
1576
  class: "mrp-retry",
1568
1577
  type: "button",
1569
- onClick: ce
1570
- }, M(d.value.retry), 1)
1571
- ])) : !r.value || O.value === 0 ? (P(), $("div", er, M(d.value.empty), 1)) : (P(), $("div", {
1578
+ onClick: de
1579
+ }, C(c.value.retry), 1)
1580
+ ])) : !o.value || O.value === 0 ? (P(), $("div", ar, C(c.value.empty), 1)) : (P(), $("div", {
1572
1581
  key: 3,
1573
1582
  class: "mrp-scale",
1574
1583
  style: re({ width: `${x(Ve).w * x(Z)}px`, height: `${x(Ve).h * x(Z)}px` })
@@ -1584,18 +1593,18 @@ const Gn = {
1584
1593
  class: "mrp-spacer-top",
1585
1594
  style: re({ height: `${x(xe).padTopPx}px` }),
1586
1595
  "aria-hidden": "true"
1587
- }, null, 4)) : N("", !0),
1596
+ }, null, 4)) : H("", !0),
1588
1597
  (P(!0), $(Ee, null, We(x(ut), (w) => (P(), $("div", {
1589
1598
  key: w.index,
1590
1599
  class: "mrp-page-holder",
1591
1600
  "data-page": w.index + 1
1592
- }, null, 8, tr))), 128)),
1601
+ }, null, 8, sr))), 128)),
1593
1602
  x(xe).padBottomPx > 0 ? (P(), $("div", {
1594
1603
  key: 1,
1595
1604
  class: "mrp-spacer-bottom",
1596
1605
  style: re({ height: `${x(xe).padBottomPx}px` }),
1597
1606
  "aria-hidden": "true"
1598
- }, null, 4)) : N("", !0)
1607
+ }, null, 4)) : H("", !0)
1599
1608
  ], 4)
1600
1609
  ], 4))
1601
1610
  ], 544),
@@ -1612,68 +1621,68 @@ const Gn = {
1612
1621
  class: "mrp-thumb-spacer",
1613
1622
  style: re({ height: `${x(_).windowRange.value.padTopPx}px` }),
1614
1623
  "aria-hidden": "true"
1615
- }, null, 4)) : N("", !0),
1624
+ }, null, 4)) : H("", !0),
1616
1625
  (P(!0), $(Ee, null, We(x(_).visibleThumbs.value, (w) => (P(), $("div", {
1617
1626
  key: w.index,
1618
1627
  class: oe(["mrp-thumb", { "mrp-thumb-active": w.index + 1 === v.value }]),
1619
1628
  style: re({ height: `${w.height + 20}px` }),
1620
- onClick: (U) => ne(w.index + 1)
1629
+ onClick: (N) => ne(w.index + 1)
1621
1630
  }, [
1622
1631
  F("div", {
1623
1632
  class: "mrp-thumb-box",
1624
1633
  "data-thumb": w.index + 1,
1625
1634
  style: re({ height: `${w.height}px` })
1626
- }, null, 12, rr),
1627
- F("span", or, M(w.index + 1), 1)
1628
- ], 14, nr))), 128)),
1635
+ }, null, 12, ir),
1636
+ F("span", ur, C(w.index + 1), 1)
1637
+ ], 14, lr))), 128)),
1629
1638
  x(_).windowRange.value.padBottomPx > 0 ? (P(), $("div", {
1630
1639
  key: 1,
1631
1640
  class: "mrp-thumb-spacer",
1632
1641
  style: re({ height: `${x(_).windowRange.value.padBottomPx}px` }),
1633
1642
  "aria-hidden": "true"
1634
- }, null, 4)) : N("", !0)
1635
- ], 544)) : N("", !0)
1643
+ }, null, 4)) : H("", !0)
1644
+ ], 544)) : H("", !0)
1636
1645
  ]),
1637
- F("div", ar, [
1646
+ F("div", cr, [
1638
1647
  Yt(i.$slots, "default", {}, void 0, !0)
1639
1648
  ]),
1640
- x(pe) ? (P(), $("div", sr, [
1649
+ x(me) ? (P(), $("div", dr, [
1641
1650
  g[5] || (g[5] = F("div", null, "mach-report debug", -1)),
1642
- F("div", null, "pages: " + M(x(pe).pages) + " | window: [" + M(x(pe).window) + "]", 1),
1643
- F("div", null, "zoom: " + M(x(pe).zoom) + " | load: " + M(x(pe).loadMs), 1),
1644
- F("div", null, "plan: " + M(x(pe).planKB) + "KB", 1)
1645
- ])) : N("", !0)
1651
+ F("div", null, "pages: " + C(x(me).pages) + " | window: [" + C(x(me).window) + "]", 1),
1652
+ F("div", null, "zoom: " + C(x(me).zoom) + " | load: " + C(x(me).loadMs), 1),
1653
+ F("div", null, "plan: " + C(x(me).planKB) + "KB", 1)
1654
+ ])) : H("", !0)
1646
1655
  ], 6));
1647
1656
  }
1648
- }), ir = /* @__PURE__ */ st(lr, [["__scopeId", "data-v-449298a6"]]), yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1657
+ }), pr = /* @__PURE__ */ st(fr, [["__scopeId", "data-v-48919dc8"]]), Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1649
1658
  __proto__: null,
1650
- default: ir
1659
+ default: pr
1651
1660
  }, Symbol.toStringTag, { value: "Module" }));
1652
1661
  export {
1653
- zn as D,
1654
- ve as M,
1662
+ Un as D,
1663
+ he as M,
1655
1664
  _e as P,
1656
- Ln as R,
1657
- br as S,
1658
- Hn as a,
1659
- ir as b,
1660
- Mn as c,
1665
+ jn as R,
1666
+ $r as S,
1667
+ Vn as a,
1668
+ pr as b,
1669
+ Sn as c,
1661
1670
  $t as d,
1662
- rn as e,
1663
- Zn as f,
1664
- vr as g,
1665
- qn as h,
1666
- gr as i,
1667
- mr as j,
1668
- wr as k,
1669
- Jn as l,
1670
- tn as m,
1671
+ an as e,
1672
+ _n as f,
1673
+ xr as g,
1674
+ Kn as h,
1675
+ Er as i,
1676
+ yr as j,
1677
+ kr as k,
1678
+ er as l,
1679
+ rn as m,
1671
1680
  Et as n,
1672
- on as o,
1673
- hr as p,
1674
- nn as q,
1675
- Nn as r,
1676
- yr as s,
1677
- jn as t,
1678
- Un as u
1681
+ sn as o,
1682
+ Pr as p,
1683
+ on as q,
1684
+ Yn as r,
1685
+ Cr as s,
1686
+ Zn as t,
1687
+ Jn as u
1679
1688
  };