@agile-team/mach-report 1.0.1 → 1.1.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.
@@ -0,0 +1,1138 @@
1
+ import { ref as T, computed as E, shallowRef as We, defineComponent as xe, watch as V, nextTick as et, openBlock as h, createElementBlock as y, createElementVNode as P, toDisplayString as w, Fragment as te, createCommentVNode as W, normalizeClass as U, renderList as ie, createTextVNode as Le, withKeys as Se, inject as ue, provide as ze, useCssVars as tt, watchEffect as Ie, onMounted as nt, onUnmounted as ot, normalizeStyle as Y, createBlock as rt, createVNode as at, unref as b, renderSlot as st } from "vue";
2
+ import { computePageWindow as lt, renderPlanToImages as it, renderPage as He, validateRenderPlan as ut, renderPlanToCanvas as ct } from "@agile-team/mach-report";
3
+ import { a as Pe, b as dt, c as mt, n as ft, M as pt, e as vt } from "./plugin-CVYs7wAj.js";
4
+ function gt(e, o, a = {}) {
5
+ const n = a.pxPerMm ?? 3.7795275590551185, r = a.gapPx ?? 18, t = T(0), s = T(800), i = E(
6
+ () => (e.value?.pages ?? []).map((x) => x.pageHeightMm * n)
7
+ ), u = E(() => {
8
+ const x = e.value?.pages ?? [];
9
+ let $ = 0, d = 0;
10
+ for (const m of x)
11
+ $ += m.pageHeightMm * n + r, d = Math.max(d, m.pageWidthMm * n);
12
+ return { w: d, h: $ };
13
+ }), f = E(
14
+ () => lt({
15
+ pageHeightsPx: i.value,
16
+ viewportHeightPx: s.value / o.value,
17
+ scrollTopPx: t.value / o.value,
18
+ overscan: 1,
19
+ gapPx: r
20
+ })
21
+ ), c = E(() => {
22
+ const x = e.value;
23
+ if (!x) return [];
24
+ const { start: $, end: d } = f.value;
25
+ return d < $ ? [] : x.pages.slice($, d + 1).map((m, M) => ({ page: m, index: $ + M }));
26
+ });
27
+ function p(x, $) {
28
+ let d = 0;
29
+ return (m) => {
30
+ d || (d = requestAnimationFrame(() => {
31
+ if (d = 0, t.value = m.scrollTop, s.value = m.clientHeight || 800, $.value <= 0) return;
32
+ const M = m.querySelectorAll(".mrp-page-holder");
33
+ if (!M.length) return;
34
+ const R = m.getBoundingClientRect().top + 56;
35
+ let S = 1;
36
+ M.forEach((v) => {
37
+ v.getBoundingClientRect().top <= R && (S = Number(v.dataset.page ?? 1));
38
+ }), x.value = Math.max(1, Math.min($.value, S));
39
+ }));
40
+ };
41
+ }
42
+ return {
43
+ contentSize: u,
44
+ windowRange: f,
45
+ visiblePages: c,
46
+ makeScrollHandler: p,
47
+ refreshViewport(x) {
48
+ x && (s.value = x.clientHeight || 800);
49
+ }
50
+ };
51
+ }
52
+ function ht(e) {
53
+ const o = T(1), a = T("fit");
54
+ function n() {
55
+ requestAnimationFrame(() => {
56
+ const t = e();
57
+ !t || !t.viewport || (o.value = Math.min(
58
+ 1,
59
+ Math.max(0.3, (t.viewport.clientWidth - 48) / Math.max(1, t.pageWidthPx))
60
+ ));
61
+ });
62
+ }
63
+ function r(t) {
64
+ t === "fit" ? (a.value = "fit", n()) : (a.value = "raw", o.value = t / 100);
65
+ }
66
+ return { zoom: o, zoomMode: a, applyFitZoom: n, setZoom: r };
67
+ }
68
+ const ce = 8;
69
+ function de() {
70
+ return new Promise((e) => setTimeout(e, 0));
71
+ }
72
+ function ae(e) {
73
+ return `p${Math.round(e.pageWidthMm)}x${Math.round(e.pageHeightMm)}`;
74
+ }
75
+ function ee(e) {
76
+ const o = /* @__PURE__ */ new Map();
77
+ e.pages.forEach((s) => {
78
+ o.has(ae(s)) || o.set(ae(s), s);
79
+ });
80
+ const r = `<!doctype html><html><head><meta charset="utf-8"><style>${`.mr-page{margin:0 auto;page-break-after:always;}
81
+ .mr-page tr{break-inside:avoid;page-break-inside:avoid;}
82
+ .mr-comp{break-inside:avoid;page-break-inside:avoid;}
83
+ ${[...o.values()].map(
84
+ (s) => `@page ${ae(s)}{size:${Math.round(s.pageWidthMm)}mm ${Math.round(s.pageHeightMm)}mm;margin:0;}`
85
+ ).join(`
86
+ `)}
87
+ body{margin:0;background:#fff;}`}</style></head><body>`, t = e.pages.map((s) => {
88
+ const i = He(s, 96, {}, document);
89
+ return i.style.page = ae(s), i.outerHTML;
90
+ });
91
+ return { head: r, pageChunks: t };
92
+ }
93
+ async function wn(e, o = {}) {
94
+ const a = {
95
+ pages: e.flatMap((i) => i.pages)
96
+ };
97
+ if (a.pages.length === 0) return;
98
+ const { head: n, pageChunks: r } = ee(a), t = document.createElement("iframe");
99
+ t.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(t);
100
+ let s = !1;
101
+ try {
102
+ const i = t.contentDocument;
103
+ i.open(), i.write(n);
104
+ for (let u = 0; u < r.length; u++)
105
+ i.write(r[u]), u % ce === ce - 1 && (o.onProgress?.(u + 1, r.length), await de());
106
+ i.write("</body></html>"), i.close(), await de(), o.onProgress?.(r.length, r.length), s = !0, t.contentWindow?.focus(), t.contentWindow?.print();
107
+ } catch (i) {
108
+ o.onError?.(i instanceof Error ? `批量打印失败: ${i.message}` : "批量打印失败");
109
+ } finally {
110
+ s ? setTimeout(() => t.remove(), 6e4) : t.remove();
111
+ }
112
+ }
113
+ function bt(e) {
114
+ const { head: o, pageChunks: a } = ee(e);
115
+ return {
116
+ 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]-->${o.replace(/^<!doctype html><html><head>/, "")}`}${a.join("")}</body></html>`,
117
+ filename: "mach-report.doc"
118
+ };
119
+ }
120
+ function wt(e, o) {
121
+ let a = null, n = !1, r = null, t = null;
122
+ function s() {
123
+ a?.remove(), a = null;
124
+ }
125
+ function i(d, m) {
126
+ const M = URL.createObjectURL(d), R = document.createElement("a");
127
+ R.href = M, R.download = m, R.click(), setTimeout(() => URL.revokeObjectURL(M), 1e4);
128
+ }
129
+ async function u() {
130
+ if (n) return;
131
+ const d = e.value;
132
+ if (!d || d.pages.length === 0) return;
133
+ n = !0, s();
134
+ const { head: m, pageChunks: M } = ee(d);
135
+ 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);
136
+ const R = a;
137
+ try {
138
+ const S = R.contentDocument;
139
+ S.open(), S.write(m);
140
+ for (let v = 0; v < M.length; v++)
141
+ if (S.write(M[v]), v % ce === ce - 1 && await de(), R !== a) return;
142
+ S.write("</body></html>"), S.close(), await de(), R.contentWindow?.focus(), R.contentWindow?.print();
143
+ } catch {
144
+ o.onError("调用打印失败,请改用导出 PDF");
145
+ } finally {
146
+ n = !1;
147
+ }
148
+ }
149
+ async function f() {
150
+ if (r) return r;
151
+ const d = e.value;
152
+ if (!(!d || d.pages.length === 0))
153
+ return r = (async () => {
154
+ try {
155
+ const m = await o.getPdfExporter()(d);
156
+ i(
157
+ new Blob([m], { type: "application/pdf" }),
158
+ "mach-report.pdf"
159
+ );
160
+ } catch (m) {
161
+ o.onError(m instanceof Error ? `PDF 导出失败: ${m.message}` : "PDF 导出失败");
162
+ } finally {
163
+ r = null;
164
+ }
165
+ })(), r;
166
+ }
167
+ async function c() {
168
+ if (t) return t;
169
+ const d = e.value;
170
+ if (!(!d || d.pages.length === 0))
171
+ return t = (async () => {
172
+ try {
173
+ const { blobs: m } = await it(d, {
174
+ dpr: Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1)
175
+ });
176
+ m.forEach((M, R) => {
177
+ i(M, m.length > 1 ? `mach-report-page-${R + 1}.png` : "mach-report.png");
178
+ });
179
+ } catch (m) {
180
+ o.onError(
181
+ m instanceof Error ? `图片导出失败: ${m.message}` : "图片导出失败",
182
+ "export"
183
+ );
184
+ } finally {
185
+ t = null;
186
+ }
187
+ })(), t;
188
+ }
189
+ function p() {
190
+ const d = e.value;
191
+ if (!(!d || d.pages.length === 0))
192
+ try {
193
+ const { html: m, filename: M } = bt(d);
194
+ i(new Blob([m], { type: "application/msword;charset=utf-8" }), M);
195
+ } catch (m) {
196
+ o.onError(
197
+ m instanceof Error ? `Word 导出失败: ${m.message}` : "Word 导出失败",
198
+ "export"
199
+ );
200
+ }
201
+ }
202
+ function x(d) {
203
+ const m = e.value;
204
+ if (!m || m.pages.length === 0) return;
205
+ if (d === "pdf") {
206
+ f();
207
+ return;
208
+ }
209
+ if (d === "png" || d === "image") {
210
+ c();
211
+ return;
212
+ }
213
+ if (d === "word" || d === "doc") {
214
+ p();
215
+ return;
216
+ }
217
+ const { head: M, pageChunks: R } = ee(m), S = `${M}${R.join("")}</body></html>`;
218
+ i(new Blob([S], { type: "text/html;charset=utf-8" }), `mach-report.${d === "html" ? "html" : d}`);
219
+ }
220
+ function $() {
221
+ const d = e.value;
222
+ if (!d || d.pages.length === 0) return;
223
+ const { head: m, pageChunks: M } = ee(d), R = `${m}${M.join("")}</body></html>`, S = new Blob([R], { type: "text/html;charset=utf-8" }), v = URL.createObjectURL(S), I = window.open(v, "_blank");
224
+ if (!I) {
225
+ o.onError("浏览器拦截了弹窗,请允许弹窗后重试"), URL.revokeObjectURL(v);
226
+ return;
227
+ }
228
+ setTimeout(() => I.print(), 400), setTimeout(() => URL.revokeObjectURL(v), 1e4);
229
+ }
230
+ return {
231
+ print: u,
232
+ exportAs: x,
233
+ exportImages: c,
234
+ exportWord: p,
235
+ openPdfWindow: $,
236
+ releasePrintFrame: s
237
+ };
238
+ }
239
+ const Oe = "mrp-hit";
240
+ function yt(e) {
241
+ e.querySelectorAll(`mark.${Oe}`).forEach((a) => {
242
+ const n = a.parentNode;
243
+ if (n) {
244
+ for (; a.firstChild; ) n.insertBefore(a.firstChild, a);
245
+ a.remove(), n.normalize();
246
+ }
247
+ });
248
+ }
249
+ function Pt(e, o) {
250
+ const a = o.trim();
251
+ if (!a) return 0;
252
+ const n = a.toLowerCase(), r = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
253
+ acceptNode(i) {
254
+ const u = i.parentElement;
255
+ return !u || u.closest("mark") || /^(SCRIPT|STYLE)$/.test(u.tagName) ? NodeFilter.FILTER_REJECT : (i.nodeValue ?? "").toLowerCase().includes(n) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
256
+ }
257
+ }), t = [];
258
+ for (let i = r.nextNode(); i; i = r.nextNode()) t.push(i);
259
+ let s = 0;
260
+ for (const i of t) {
261
+ const u = i.nodeValue ?? "", f = u.toLowerCase(), c = i.parentElement;
262
+ if (!c) continue;
263
+ const p = document.createDocumentFragment();
264
+ let x = 0, $ = f.indexOf(n);
265
+ for (; $ >= 0; ) {
266
+ $ > x && p.appendChild(document.createTextNode(u.slice(x, $)));
267
+ const d = document.createElement("mark");
268
+ d.className = Oe, d.textContent = u.slice($, $ + a.length), p.appendChild(d), s++, x = $ + a.length, $ = f.indexOf(n, x);
269
+ }
270
+ x < u.length && p.appendChild(document.createTextNode(u.slice(x))), c.replaceChild(p, i);
271
+ }
272
+ return s;
273
+ }
274
+ function Fe(e, o) {
275
+ let a = 0, n = e.toLowerCase().indexOf(o);
276
+ for (; n >= 0; )
277
+ a++, n = e.toLowerCase().indexOf(o, n + o.length);
278
+ return a;
279
+ }
280
+ function xt(e) {
281
+ const { plan: o, gotoPage: a, highlight: n, clearHighlights: r } = e, t = e.debounceMs ?? 200, s = T(!1), i = T(""), u = T(""), f = T(0);
282
+ let c = null;
283
+ const p = E(() => {
284
+ const v = i.value.trim().toLowerCase(), I = o.value;
285
+ if (!v || !I) return [];
286
+ const z = [];
287
+ return I.pages.forEach((O, ne) => {
288
+ for (const N of O.components)
289
+ if (N.grid) {
290
+ for (const j of N.grid.cells ?? [])
291
+ for (const J of j ?? [])
292
+ if (typeof J?.text == "string")
293
+ for (let oe = 0; oe < Fe(J.text, v); oe++) z.push(ne);
294
+ } else if (N.kind === "text" && typeof N.text == "string")
295
+ for (let j = 0; j < Fe(N.text, v); j++) z.push(ne);
296
+ }), z;
297
+ }), x = E(() => p.value.length);
298
+ function $(v) {
299
+ if (u.value = v, c && clearTimeout(c), v.trim() === "") {
300
+ c = null, i.value = "", f.value = 0;
301
+ return;
302
+ }
303
+ c = setTimeout(() => {
304
+ c = null, i.value = u.value, f.value = 0;
305
+ const I = p.value[0];
306
+ I != null && a(I + 1);
307
+ }, t);
308
+ }
309
+ function d(v) {
310
+ const I = p.value.length;
311
+ I !== 0 && (f.value = (f.value + v + I) % I, a(p.value[f.value] + 1));
312
+ }
313
+ function m() {
314
+ s.value = !s.value;
315
+ }
316
+ function M(v) {
317
+ const I = i.value.trim();
318
+ I && n(v, I);
319
+ }
320
+ function R(v) {
321
+ r(v);
322
+ }
323
+ function S() {
324
+ u.value = "", i.value = "", f.value = 0, c && clearTimeout(c), c = null;
325
+ }
326
+ return {
327
+ visible: s,
328
+ query: i,
329
+ matchIndex: f,
330
+ matchCount: x,
331
+ toggle: m,
332
+ onInput: $,
333
+ onNav: d,
334
+ apply: M,
335
+ clear: R,
336
+ reset: S
337
+ };
338
+ }
339
+ function Et(e, o) {
340
+ const a = E(() => {
341
+ if (e.value) return !0;
342
+ if (typeof location > "u") return !1;
343
+ try {
344
+ return new URLSearchParams(location.search).get("mrp-debug") === "1";
345
+ } catch {
346
+ return !1;
347
+ }
348
+ }), n = E(() => !a.value || !o.plan.value ? 0 : Math.round(JSON.stringify(o.plan.value).length / 1024)), r = E(() => !a.value || !o.plan.value ? null : {
349
+ pages: o.pageCount.value,
350
+ window: `${o.windowRange.value.start}-${o.windowRange.value.end}`,
351
+ zoom: `${Math.round(o.zoom.value * 100)}%`,
352
+ loadMs: `${o.loadMs.value}ms`,
353
+ planKB: n.value
354
+ });
355
+ return { enabled: a, debugStats: r };
356
+ }
357
+ function $t(e, o) {
358
+ const { thumbsRoot: a, visible: n, renderThumbCanvas: r } = o;
359
+ let t = null;
360
+ function s(f, c) {
361
+ if (!e.value || f.childElementCount > 0) return;
362
+ const p = r(c);
363
+ p && (p.style.width = "100%", p.style.height = "100%", p.style.display = "block", f.appendChild(p));
364
+ }
365
+ return { schedule: () => {
366
+ !n.value || !e.value || !a.value || typeof IntersectionObserver > "u" || (t?.disconnect(), t = new IntersectionObserver(
367
+ (f) => {
368
+ for (const c of f) {
369
+ if (!c.isIntersecting) continue;
370
+ const p = c.target;
371
+ s(p, Number(p.dataset.thumb ?? 1) - 1), t?.unobserve(p);
372
+ }
373
+ },
374
+ { root: a.value, rootMargin: "200px" }
375
+ ), a.value.querySelectorAll("[data-thumb]").forEach((f) => {
376
+ t.observe(f);
377
+ }));
378
+ }, destroy: () => {
379
+ t?.disconnect(), t = null;
380
+ } };
381
+ }
382
+ function Ct() {
383
+ const e = We(0);
384
+ return {
385
+ loadMs: e,
386
+ start() {
387
+ return typeof performance < "u" ? performance.now() : 0;
388
+ },
389
+ end(o) {
390
+ e.value = o ? Math.round(performance.now() - o) : 0;
391
+ }
392
+ };
393
+ }
394
+ const kt = { class: "mrp-toolbar" }, Mt = { class: "mrp-title" }, Rt = ["disabled"], Tt = { class: "mrp-pageinfo" }, St = ["disabled"], It = {
395
+ key: 1,
396
+ class: "mrp-search"
397
+ }, Ft = ["placeholder", "value"], Bt = {
398
+ key: 0,
399
+ class: "mrp-search-count"
400
+ }, Wt = ["disabled"], Lt = ["disabled"], zt = /* @__PURE__ */ xe({
401
+ __name: "ReportToolbar",
402
+ props: {
403
+ pageCount: {},
404
+ currentPage: {},
405
+ zoomMode: {},
406
+ zoom: {},
407
+ showExport: { type: Boolean },
408
+ showPrint: { type: Boolean },
409
+ showPdfWindow: { type: Boolean },
410
+ messages: {},
411
+ search: {},
412
+ thumbsVisible: { type: Boolean }
413
+ },
414
+ emits: ["goto", "zoom", "export", "print", "pdf-window", "search-input", "search-nav", "search-toggle", "thumbs-toggle"],
415
+ setup(e) {
416
+ const o = e, a = T(null);
417
+ V(
418
+ () => o.search.visible,
419
+ (r) => {
420
+ r && et(() => a.value?.focus());
421
+ }
422
+ );
423
+ function n(r, t, s) {
424
+ return r.replace("{cur}", String(t)).replace("{total}", String(s));
425
+ }
426
+ return (r, t) => (h(), y("div", kt, [
427
+ P("span", Mt, w(e.messages.title), 1),
428
+ e.pageCount > 0 ? (h(), y(te, { key: 0 }, [
429
+ P("button", {
430
+ class: "mrp-nav",
431
+ type: "button",
432
+ disabled: e.currentPage <= 1,
433
+ onClick: t[0] || (t[0] = (s) => r.$emit("goto", e.currentPage - 1))
434
+ }, w(e.messages.prevPage), 9, Rt),
435
+ P("span", Tt, w(n(e.messages.pageInfo, e.currentPage, e.pageCount)), 1),
436
+ P("button", {
437
+ class: "mrp-nav",
438
+ type: "button",
439
+ disabled: e.currentPage >= e.pageCount,
440
+ onClick: t[1] || (t[1] = (s) => r.$emit("goto", e.currentPage + 1))
441
+ }, w(e.messages.nextPage), 9, St)
442
+ ], 64)) : W("", !0),
443
+ t[16] || (t[16] = P("span", { class: "mrp-spacer" }, null, -1)),
444
+ e.search.visible ? (h(), y("div", It, [
445
+ P("input", {
446
+ ref_key: "searchInputRef",
447
+ ref: a,
448
+ class: "mrp-search-input",
449
+ type: "text",
450
+ placeholder: e.messages.searchPlaceholder,
451
+ value: e.search.query,
452
+ onInput: t[2] || (t[2] = (s) => r.$emit("search-input", s.target.value))
453
+ }, null, 40, Ft),
454
+ e.search.query ? (h(), y("span", Bt, w(n(e.messages.matchInfo, e.search.matchIndex + 1, e.search.matchCount)), 1)) : W("", !0),
455
+ P("button", {
456
+ class: "mrp-nav",
457
+ type: "button",
458
+ disabled: e.search.matchCount === 0,
459
+ onClick: t[3] || (t[3] = (s) => r.$emit("search-nav", -1))
460
+ }, w(e.messages.prevMatch), 9, Wt),
461
+ P("button", {
462
+ class: "mrp-nav",
463
+ type: "button",
464
+ disabled: e.search.matchCount === 0,
465
+ onClick: t[4] || (t[4] = (s) => r.$emit("search-nav", 1))
466
+ }, w(e.messages.nextMatch), 9, Lt)
467
+ ])) : W("", !0),
468
+ P("button", {
469
+ class: U(["mrp-nav", { "mrp-active": e.search.visible }]),
470
+ type: "button",
471
+ title: "Ctrl+F",
472
+ onClick: t[5] || (t[5] = (s) => r.$emit("search-toggle"))
473
+ }, " 🔍 ", 2),
474
+ P("button", {
475
+ class: U(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
476
+ type: "button",
477
+ onClick: t[6] || (t[6] = (s) => r.$emit("thumbs-toggle"))
478
+ }, " ▦ " + w(e.messages.thumbnails), 3),
479
+ P("button", {
480
+ class: U(["mrp-nav", { "mrp-active": e.zoomMode === "fit" }]),
481
+ type: "button",
482
+ onClick: t[7] || (t[7] = (s) => r.$emit("zoom", "fit"))
483
+ }, w(e.messages.fitWidth), 3),
484
+ P("button", {
485
+ class: U(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 100 }]),
486
+ type: "button",
487
+ onClick: t[8] || (t[8] = (s) => r.$emit("zoom", 100))
488
+ }, " 100% ", 2),
489
+ P("button", {
490
+ class: U(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === 150 }]),
491
+ type: "button",
492
+ onClick: t[9] || (t[9] = (s) => r.$emit("zoom", 150))
493
+ }, " 150% ", 2),
494
+ e.showExport ? (h(), y("button", {
495
+ key: 2,
496
+ class: "mrp-nav",
497
+ type: "button",
498
+ onClick: t[10] || (t[10] = (s) => r.$emit("export", "html"))
499
+ }, w(e.messages.exportHtml), 1)) : W("", !0),
500
+ e.showExport ? (h(), y("button", {
501
+ key: 3,
502
+ class: "mrp-nav",
503
+ type: "button",
504
+ onClick: t[11] || (t[11] = (s) => r.$emit("export", "pdf"))
505
+ }, w(e.messages.exportPdf), 1)) : W("", !0),
506
+ e.showExport ? (h(), y("button", {
507
+ key: 4,
508
+ class: "mrp-nav",
509
+ type: "button",
510
+ onClick: t[12] || (t[12] = (s) => r.$emit("export", "png"))
511
+ }, w(e.messages.exportImage), 1)) : W("", !0),
512
+ e.showExport ? (h(), y("button", {
513
+ key: 5,
514
+ class: "mrp-nav",
515
+ type: "button",
516
+ onClick: t[13] || (t[13] = (s) => r.$emit("export", "word"))
517
+ }, w(e.messages.exportWord), 1)) : W("", !0),
518
+ e.showPrint ? (h(), y("button", {
519
+ key: 6,
520
+ class: "mrp-nav",
521
+ type: "button",
522
+ onClick: t[14] || (t[14] = (s) => r.$emit("print"))
523
+ }, w(e.messages.print), 1)) : W("", !0),
524
+ e.showPdfWindow ? (h(), y("button", {
525
+ key: 7,
526
+ class: "mrp-nav",
527
+ type: "button",
528
+ onClick: t[15] || (t[15] = (s) => r.$emit("pdf-window"))
529
+ }, w(e.messages.pdfWindow), 1)) : W("", !0)
530
+ ]));
531
+ }
532
+ }), Ee = (e, o) => {
533
+ const a = e.__vccOpts || e;
534
+ for (const [n, r] of o)
535
+ a[n] = r;
536
+ return a;
537
+ }, Ht = /* @__PURE__ */ Ee(zt, [["__scopeId", "data-v-f3aa8dfd"]]), Ot = { class: "mrp-params" }, Dt = { class: "mrp-params-title" }, Nt = { class: "mrp-params-grid" }, qt = { class: "mrp-param-label" }, At = {
538
+ key: 0,
539
+ class: "mrp-param-star"
540
+ }, Vt = ["value", "onChange"], Ut = {
541
+ value: "",
542
+ disabled: "",
543
+ hidden: ""
544
+ }, jt = ["value"], Kt = ["type", "placeholder", "value", "onInput"], Zt = { class: "mrp-params-actions" }, Gt = /* @__PURE__ */ xe({
545
+ __name: "ReportParamPanel",
546
+ props: {
547
+ defs: {},
548
+ modelValue: {},
549
+ messages: {},
550
+ attempted: { type: Boolean }
551
+ },
552
+ emits: ["update:modelValue", "query", "reset"],
553
+ setup(e, { emit: o }) {
554
+ const a = e, n = o, r = T({ ...a.modelValue });
555
+ V(
556
+ () => a.modelValue,
557
+ (u) => {
558
+ r.value = { ...u };
559
+ }
560
+ );
561
+ const t = E(
562
+ () => a.defs.map((u) => ({
563
+ def: u,
564
+ label: u.label ?? u.field,
565
+ value: r.value[u.field] ?? ""
566
+ }))
567
+ );
568
+ function s(u, f) {
569
+ r.value = { ...r.value, [u]: f }, n("update:modelValue", { ...r.value });
570
+ }
571
+ function i(u) {
572
+ const f = a.defs.find((c) => c.field === u);
573
+ return a.attempted && f?.required === !0 && !(r.value[u] ?? "").trim();
574
+ }
575
+ return (u, f) => (h(), y("div", Ot, [
576
+ P("span", Dt, w(e.messages.paramsTitle), 1),
577
+ P("div", Nt, [
578
+ (h(!0), y(te, null, ie(t.value, (c) => (h(), y("label", {
579
+ key: c.def.field,
580
+ class: U(["mrp-param", { "mrp-param-missing": i(c.def.field) }])
581
+ }, [
582
+ P("span", qt, [
583
+ Le(w(c.label), 1),
584
+ c.def.required ? (h(), y("i", At, "*")) : W("", !0)
585
+ ]),
586
+ (c.def.type ?? "text") === "select" ? (h(), y("select", {
587
+ key: 0,
588
+ class: "mrp-param-input",
589
+ value: c.value,
590
+ onChange: (p) => s(c.def.field, p.target.value),
591
+ onKeydown: f[0] || (f[0] = Se((p) => u.$emit("query"), ["enter"]))
592
+ }, [
593
+ P("option", Ut, w(c.def.placeholder ?? `请选择${c.label}`), 1),
594
+ (h(!0), y(te, null, ie(c.def.options ?? [], (p) => (h(), y("option", {
595
+ key: p.value,
596
+ value: p.value
597
+ }, w(p.label), 9, jt))), 128))
598
+ ], 40, Vt)) : (h(), y("input", {
599
+ key: 1,
600
+ class: "mrp-param-input",
601
+ type: c.def.type === "number" ? "number" : c.def.type === "date" ? "date" : "text",
602
+ placeholder: c.def.placeholder ?? `请输入${c.label}`,
603
+ value: c.value,
604
+ onInput: (p) => s(c.def.field, p.target.value),
605
+ onKeydown: f[1] || (f[1] = Se((p) => u.$emit("query"), ["enter"]))
606
+ }, null, 40, Kt))
607
+ ], 2))), 128))
608
+ ]),
609
+ P("div", Zt, [
610
+ P("button", {
611
+ class: "mrp-nav mrp-param-query",
612
+ type: "button",
613
+ onClick: f[2] || (f[2] = (c) => u.$emit("query"))
614
+ }, w(e.messages.query), 1),
615
+ P("button", {
616
+ class: "mrp-nav",
617
+ type: "button",
618
+ onClick: f[3] || (f[3] = (c) => u.$emit("reset"))
619
+ }, w(e.messages.reset), 1)
620
+ ])
621
+ ]));
622
+ }
623
+ }), Yt = /* @__PURE__ */ Ee(Gt, [["__scopeId", "data-v-aafce92d"]]), Jt = {
624
+ title: "报表预览",
625
+ prevPage: "‹ 上一页",
626
+ nextPage: "下一页 ›",
627
+ pageInfo: "{cur} / {total}",
628
+ fitWidth: "适宽",
629
+ exportHtml: "导出 HTML",
630
+ exportPdf: "导出 PDF",
631
+ exportImage: "导出图片",
632
+ exportWord: "导出 Word",
633
+ print: "打印",
634
+ pdfWindow: "PDF 窗口",
635
+ loading: "报表渲染中…",
636
+ empty: "暂无预览数据",
637
+ errorPrefix: "",
638
+ retry: "重试",
639
+ searchPlaceholder: "搜索报表内容",
640
+ matchInfo: "{cur}/{total}",
641
+ prevMatch: "‹",
642
+ nextMatch: "›",
643
+ thumbnails: "缩略图",
644
+ paramsTitle: "查询条件",
645
+ query: "查 询",
646
+ reset: "重 置",
647
+ paramRequired: "请填写{label}"
648
+ }, Xt = {
649
+ shellBg: "#525659",
650
+ shellFg: "#e8e8e8",
651
+ toolbarBg: "#323639",
652
+ toolbarBorder: "#22252a",
653
+ toolbarFg: "#e8e8e8",
654
+ btnFg: "#cfcfcf",
655
+ btnBorder: "#4a4d52",
656
+ btnHoverBg: "#414549",
657
+ btnHoverFg: "#ffffff",
658
+ btnActiveBg: "#2d5fb8"
659
+ };
660
+ function yn(e) {
661
+ return e;
662
+ }
663
+ function Pn(e) {
664
+ return e;
665
+ }
666
+ const A = {
667
+ showExport: !0,
668
+ showPrint: !0,
669
+ showPdfWindow: !0,
670
+ showParams: !0,
671
+ gapPx: 18,
672
+ pdfFontUrl: "/simhei.ttf",
673
+ logger: console
674
+ }, xn = { warn: () => {
675
+ }, info: () => {
676
+ } };
677
+ function Qt(e, o) {
678
+ const a = o ? e?.presets?.[o] : e?.defaultPreset ? e?.presets?.[e.defaultPreset] : void 0, n = { ...e?.defaults, ...a };
679
+ return {
680
+ showExport: n.showExport ?? A.showExport,
681
+ showPrint: n.showPrint ?? A.showPrint,
682
+ showPdfWindow: n.showPdfWindow ?? A.showPdfWindow,
683
+ showParams: n.showParams ?? A.showParams,
684
+ gapPx: n.gapPx ?? A.gapPx,
685
+ pdfFontUrl: n.pdfFontUrl ?? A.pdfFontUrl,
686
+ theme: { ...Xt, ...n.theme },
687
+ messages: { ...Jt, ...n.messages },
688
+ logger: n.logger ?? A.logger
689
+ };
690
+ }
691
+ function _t(e) {
692
+ const o = {};
693
+ return e.shellBg != null && (o["--mrp-shell-bg"] = e.shellBg), e.shellFg != null && (o["--mrp-shell-fg"] = e.shellFg), e.toolbarBg != null && (o["--mrp-toolbar-bg"] = e.toolbarBg), e.toolbarBorder != null && (o["--mrp-toolbar-border"] = e.toolbarBorder), e.toolbarFg != null && (o["--mrp-toolbar-fg"] = e.toolbarFg), e.btnFg != null && (o["--mrp-btn-fg"] = e.btnFg), e.btnBorder != null && (o["--mrp-btn-border"] = e.btnBorder), e.btnHoverBg != null && (o["--mrp-btn-hover-bg"] = e.btnHoverBg), e.btnHoverFg != null && (o["--mrp-btn-hover-fg"] = e.btnHoverFg), e.btnActiveBg != null && (o["--mrp-btn-active-bg"] = e.btnActiveBg), o;
694
+ }
695
+ function En(e) {
696
+ const o = ue(Pe, null), a = E(() => {
697
+ const n = o?.value ?? null, r = "defaults" in e && "presets" in e ? e : { defaults: e, presets: {} };
698
+ return n ? {
699
+ defaults: { ...n.defaults, ...r.defaults },
700
+ presets: { ...n.presets, ...r.presets },
701
+ defaultPreset: r.defaultPreset ?? n.defaultPreset
702
+ } : r;
703
+ });
704
+ ze(Pe, a);
705
+ }
706
+ function en() {
707
+ return ue(Pe, E(() => null));
708
+ }
709
+ class le extends Error {
710
+ constructor(o, a, n) {
711
+ super(a), this.name = "MachReportError", this.code = o, this.cause = n;
712
+ }
713
+ }
714
+ function tn(e) {
715
+ return e instanceof le ? { code: e.code, cause: e.cause } : { code: "render", cause: e };
716
+ }
717
+ const nn = { class: "mrp-main" }, on = {
718
+ key: 0,
719
+ class: "mrp-state"
720
+ }, rn = {
721
+ key: 1,
722
+ class: "mrp-state mrp-error"
723
+ }, an = {
724
+ key: 2,
725
+ class: "mrp-state"
726
+ }, sn = ["data-page"], ln = ["onClick"], un = ["data-thumb"], cn = { class: "mrp-thumb-no" }, dn = { class: "mrp-overlay" }, mn = {
727
+ key: 1,
728
+ class: "mrp-debug",
729
+ "aria-hidden": "true"
730
+ }, se = 96 / 25.4, Be = "mach-report:ui", fn = /* @__PURE__ */ xe({
731
+ __name: "ReportPreview",
732
+ props: {
733
+ tempId: {
734
+ type: [String, Array],
735
+ default: null
736
+ },
737
+ furnitureTempId: { type: String, default: "" },
738
+ params: {
739
+ type: Object,
740
+ default: () => ({})
741
+ },
742
+ height: { type: String, default: "100vh" },
743
+ autoLoad: { type: Boolean, default: !0 },
744
+ /** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
745
+ showExport: { type: Boolean, default: void 0 },
746
+ showPrint: { type: Boolean, default: void 0 },
747
+ showPdfWindow: { type: Boolean, default: void 0 },
748
+ /** 页间距(px);不传走配置中心 */
749
+ gapPx: { type: Number, default: void 0 },
750
+ /** 工具栏/状态文案覆写(不传走配置中心 messages) */
751
+ messages: { type: Object, default: void 0 },
752
+ /** 启用的 preset 名(不传用配置中心 defaultPreset) */
753
+ preset: { type: String, default: void 0 },
754
+ /** 调试面板(也可用 URL ?mrp-debug=1 开启) */
755
+ debug: { type: Boolean, default: !1 },
756
+ /** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
757
+ paramDefs: {
758
+ type: Array,
759
+ default: void 0
760
+ },
761
+ /** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
762
+ showParams: { type: Boolean, default: void 0 },
763
+ fetcher: {
764
+ type: Function,
765
+ default: null
766
+ }
767
+ },
768
+ emits: ["loaded", "error"],
769
+ setup(e, { expose: o, emit: a }) {
770
+ tt((l) => ({
771
+ db73374c: d.value + "px"
772
+ }));
773
+ const n = e, r = a, t = We(null), s = T(!1), i = T(""), u = T(1), f = T(null), c = T(null), p = T(null), x = T(!1), $ = Ct(), d = E(() => Math.max(0, J.value)), m = ue(dt, null), R = ue(mt, null) ?? vt({ fontUrl: "/simhei.ttf" }), S = E(() => ft(n.tempId)), v = E(() => t.value?.pages.length ?? 0), I = en(), z = E(() => Qt(I.value, n.preset)), O = E(() => ({
774
+ ...z.value.messages,
775
+ ...n.messages
776
+ })), ne = E(() => n.showExport ?? z.value.showExport), N = E(() => n.showPrint ?? z.value.showPrint), j = E(() => n.showPdfWindow ?? z.value.showPdfWindow), J = E(() => n.gapPx ?? z.value.gapPx), oe = E(() => n.showParams ?? z.value.showParams), K = E(() => n.paramDefs ?? []), q = T({}), me = T(!1);
777
+ function fe(l) {
778
+ const g = {};
779
+ for (const C of l)
780
+ g[C.field] = n.params[C.field] ?? C.defaultValue ?? "";
781
+ q.value = g, me.value = !1;
782
+ }
783
+ fe(K.value), V(K, (l) => fe(l));
784
+ const De = E(() => ({
785
+ ...n.params,
786
+ ...Object.fromEntries(
787
+ Object.entries(q.value).filter(([, l]) => l !== "")
788
+ )
789
+ }));
790
+ function Ne() {
791
+ return K.value.filter(
792
+ (l) => l.required === !0 && !(q.value[l.field] ?? "").trim()
793
+ );
794
+ }
795
+ function qe() {
796
+ me.value = !0;
797
+ const l = Ne();
798
+ if (l.length > 0) {
799
+ const g = l[0].label ?? l[0].field, C = O.value.paramRequired.replace("{label}", g);
800
+ i.value = C, r("error", C, { code: "param" });
801
+ return;
802
+ }
803
+ D();
804
+ }
805
+ function Ae() {
806
+ fe(K.value);
807
+ }
808
+ const Ve = E(() => ({
809
+ height: n.height,
810
+ ..._t(z.value.theme)
811
+ })), { zoom: L, zoomMode: Z, applyFitZoom: $e, setZoom: pe } = ht(() => ({
812
+ viewport: c.value,
813
+ pageWidthPx: (t.value?.pages[0]?.pageWidthMm ?? 210) * se
814
+ })), Ue = gt(t, L, {
815
+ pxPerMm: se,
816
+ gapPx: J.value
817
+ }), { contentSize: ve, windowRange: X, visiblePages: je, makeScrollHandler: Ke, refreshViewport: Ce } = Ue, Ze = Ke(u, v);
818
+ function ge(l) {
819
+ Z.value = "raw", L.value = Math.min(3, Math.max(0.3, l));
820
+ }
821
+ function he() {
822
+ t.value = null, u.value = 1, F.reset();
823
+ }
824
+ let re = 0;
825
+ async function D() {
826
+ const l = ++re, g = n.fetcher ?? m;
827
+ if (S.value.length === 0) {
828
+ i.value = "缺少报表模板 ID", he(), r("error", i.value, { code: "param" });
829
+ return;
830
+ }
831
+ if (!g) {
832
+ i.value = "未提供渲染数据源 fetcher", he(), r("error", i.value, { code: "config" });
833
+ return;
834
+ }
835
+ s.value = !0, i.value = "", he();
836
+ const C = $.start();
837
+ try {
838
+ const k = await g({
839
+ tempIds: S.value,
840
+ furnitureTempId: n.furnitureTempId || void 0,
841
+ params: { ...De.value }
842
+ });
843
+ if (l !== re) return;
844
+ const B = ut(k);
845
+ if (!B.ok) {
846
+ const Q = B.errors.slice(0, 3).map((_) => `${_.path}: ${_.message}`).join("; ");
847
+ throw new le(
848
+ "validate",
849
+ `渲染计划校验失败(${B.errors.length} 处): ${Q}`
850
+ );
851
+ }
852
+ B.warnings.length > 0 && z.value.logger.warn("[mach-report] 渲染计划告警:", B.warnings), t.value = k, u.value = 1, $.end(C), c.value && (c.value.scrollTop = 0), Z.value === "fit" && $e(), r("loaded", k.pages.length);
853
+ } catch (k) {
854
+ if (l !== re) return;
855
+ const B = k instanceof le ? k : new le(
856
+ "fetch",
857
+ k instanceof Error ? k.message : "预览加载失败",
858
+ k
859
+ );
860
+ i.value = B.message, r("error", B.message, tn(B));
861
+ } finally {
862
+ l === re && (s.value = !1);
863
+ }
864
+ }
865
+ function H(l) {
866
+ if (v.value <= 0) return;
867
+ const g = Math.max(1, Math.min(v.value, l));
868
+ u.value = g;
869
+ const C = c.value;
870
+ if (!C) return;
871
+ let k = 0;
872
+ for (let B = 0; B < g - 1; B++)
873
+ k += (t.value?.pages[B]?.pageHeightMm ?? 0) * se + d.value;
874
+ C.scrollTop = k * L.value;
875
+ }
876
+ const { print: be, exportAs: we, openPdfWindow: ye, releasePrintFrame: Ge } = wt(t, {
877
+ getPdfExporter: () => R,
878
+ onError: (l, g) => r("error", l, { code: g ?? "print" })
879
+ });
880
+ function ke(l, g = {}) {
881
+ q.value = { ...q.value, ...l }, g.reload !== !1 && D();
882
+ }
883
+ ze(pt, { reload: D, print: be, exportAs: we, openPdfWindow: ye, gotoPage: H, setParams: ke });
884
+ const F = xt({
885
+ plan: t,
886
+ gotoPage: H,
887
+ highlight: Pt,
888
+ clearHighlights: yt
889
+ });
890
+ function Ye(l) {
891
+ l.ctrlKey && (l.preventDefault(), ge(L.value * (l.deltaY < 0 ? 1.1 : 1 / 1.1)));
892
+ }
893
+ function Je(l) {
894
+ if ((l.ctrlKey || l.metaKey) && l.key.toLowerCase() === "f") {
895
+ l.preventDefault(), F.visible.value || F.toggle();
896
+ return;
897
+ }
898
+ switch (l.key) {
899
+ case "PageDown":
900
+ l.preventDefault(), H(u.value + 1);
901
+ break;
902
+ case "PageUp":
903
+ l.preventDefault(), H(u.value - 1);
904
+ break;
905
+ case "Home":
906
+ l.preventDefault(), H(1);
907
+ break;
908
+ case "End":
909
+ l.preventDefault(), H(v.value);
910
+ break;
911
+ case "+":
912
+ case "=":
913
+ l.preventDefault(), ge(L.value * 1.1);
914
+ break;
915
+ case "-":
916
+ l.preventDefault(), ge(L.value / 1.1);
917
+ break;
918
+ }
919
+ }
920
+ function Xe() {
921
+ try {
922
+ localStorage.setItem(
923
+ Be,
924
+ JSON.stringify({ zoomMode: Z.value === "fit" ? "fit" : Math.round(L.value * 100) })
925
+ );
926
+ } catch {
927
+ }
928
+ }
929
+ V([Z, L], Xe), Ie(() => {
930
+ const l = t.value;
931
+ if (!l) return;
932
+ const g = f.value;
933
+ if (!g) return;
934
+ g.querySelectorAll(".mrp-page-holder").forEach((k) => {
935
+ const B = Number(k.dataset.page ?? 0) - 1, Q = l.pages[B];
936
+ if (!Q || k.childElementCount > 0) {
937
+ if (k.firstElementChild) {
938
+ const Te = k.firstElementChild;
939
+ F.clear(Te), F.apply(Te);
940
+ }
941
+ return;
942
+ }
943
+ k.style.width = `${Q.pageWidthMm * se}px`;
944
+ const _ = He(Q, 96, {}, document);
945
+ F.apply(_), k.appendChild(_);
946
+ });
947
+ }, { flush: "post" }), V(() => F.query.value, (l) => {
948
+ l || f.value?.querySelectorAll(".mrp-page-holder").forEach((g) => {
949
+ F.clear(g);
950
+ });
951
+ });
952
+ const Me = $t(t, {
953
+ thumbsRoot: p,
954
+ visible: x,
955
+ renderThumbCanvas: (l) => {
956
+ try {
957
+ const { canvases: g } = ct(t.value, { start: l, end: l, dpr: 0.2 });
958
+ return g[0] ?? null;
959
+ } catch {
960
+ return null;
961
+ }
962
+ }
963
+ });
964
+ Ie(() => {
965
+ Me.schedule();
966
+ }, { flush: "post" });
967
+ const Qe = E(() => n.debug), { debugStats: G } = Et(Qe, {
968
+ plan: t,
969
+ pageCount: v,
970
+ windowRange: X,
971
+ zoom: L,
972
+ loadMs: $.loadMs
973
+ });
974
+ function Re() {
975
+ Ce(c.value), Z.value === "fit" && $e();
976
+ }
977
+ function _e() {
978
+ try {
979
+ const l = JSON.parse(localStorage.getItem(Be) ?? "{}");
980
+ l.zoomMode === "fit" ? pe("fit") : typeof l.zoomMode == "number" && pe(l.zoomMode);
981
+ } catch {
982
+ }
983
+ }
984
+ return nt(() => {
985
+ window.addEventListener("resize", Re), Ce(c.value), _e(), n.autoLoad && D();
986
+ }), ot(() => {
987
+ window.removeEventListener("resize", Re), Me.destroy(), F.reset(), Ge();
988
+ }), V(
989
+ () => [n.tempId, n.furnitureTempId, JSON.stringify(n.params)],
990
+ () => {
991
+ n.autoLoad && D();
992
+ }
993
+ ), V(
994
+ () => n.fetcher ?? m,
995
+ () => {
996
+ n.autoLoad && D();
997
+ }
998
+ ), o({ reload: D, print: be, exportAs: we, openPdfWindow: ye, gotoPage: H, setParams: ke }), (l, g) => (h(), y("div", {
999
+ class: "mach-report-preview",
1000
+ style: Y(Ve.value)
1001
+ }, [
1002
+ oe.value && K.value.length > 0 ? (h(), rt(Yt, {
1003
+ key: 0,
1004
+ defs: K.value,
1005
+ modelValue: q.value,
1006
+ "onUpdate:modelValue": g[0] || (g[0] = (C) => q.value = C),
1007
+ messages: O.value,
1008
+ attempted: me.value,
1009
+ onQuery: qe,
1010
+ onReset: Ae
1011
+ }, null, 8, ["defs", "modelValue", "messages", "attempted"])) : W("", !0),
1012
+ at(Ht, {
1013
+ "page-count": v.value,
1014
+ "current-page": u.value,
1015
+ "zoom-mode": b(Z),
1016
+ zoom: b(L),
1017
+ "show-export": ne.value,
1018
+ "show-print": N.value,
1019
+ "show-pdf-window": j.value,
1020
+ messages: O.value,
1021
+ search: { visible: b(F).visible.value, query: b(F).query.value, matchIndex: b(F).matchIndex.value, matchCount: b(F).matchCount.value },
1022
+ "thumbs-visible": x.value,
1023
+ onGoto: H,
1024
+ onZoom: b(pe),
1025
+ onExport: g[1] || (g[1] = (C) => b(we)(C)),
1026
+ onPrint: b(be),
1027
+ onPdfWindow: b(ye),
1028
+ onSearchInput: b(F).onInput,
1029
+ onSearchNav: b(F).onNav,
1030
+ onSearchToggle: b(F).toggle,
1031
+ onThumbsToggle: g[2] || (g[2] = (C) => x.value = !x.value)
1032
+ }, null, 8, ["page-count", "current-page", "zoom-mode", "zoom", "show-export", "show-print", "show-pdf-window", "messages", "search", "thumbs-visible", "onZoom", "onPrint", "onPdfWindow", "onSearchInput", "onSearchNav", "onSearchToggle"]),
1033
+ P("div", nn, [
1034
+ P("div", {
1035
+ ref_key: "viewportRef",
1036
+ ref: c,
1037
+ class: "mrp-body",
1038
+ tabindex: "0",
1039
+ onWheel: Ye,
1040
+ onKeydown: Je,
1041
+ onScrollPassive: g[3] || (g[3] = (C) => b(Ze)(C.target))
1042
+ }, [
1043
+ s.value ? (h(), y("div", on, w(O.value.loading), 1)) : i.value ? (h(), y("div", rn, [
1044
+ Le(w(i.value) + " ", 1),
1045
+ P("button", {
1046
+ class: "mrp-retry",
1047
+ type: "button",
1048
+ onClick: D
1049
+ }, w(O.value.retry), 1)
1050
+ ])) : !t.value || v.value === 0 ? (h(), y("div", an, w(O.value.empty), 1)) : (h(), y("div", {
1051
+ key: 3,
1052
+ class: "mrp-scale",
1053
+ style: Y({ width: `${b(ve).w * b(L)}px`, height: `${b(ve).h * b(L)}px` })
1054
+ }, [
1055
+ P("div", {
1056
+ ref_key: "containerRef",
1057
+ ref: f,
1058
+ class: "mrp-scale-inner",
1059
+ style: Y({ transform: `scale(${b(L)})`, transformOrigin: "top left", width: `${b(ve).w}px` })
1060
+ }, [
1061
+ b(X).padTopPx > 0 ? (h(), y("div", {
1062
+ key: 0,
1063
+ class: "mrp-spacer-top",
1064
+ style: Y({ height: `${b(X).padTopPx}px` }),
1065
+ "aria-hidden": "true"
1066
+ }, null, 4)) : W("", !0),
1067
+ (h(!0), y(te, null, ie(b(je), (C) => (h(), y("div", {
1068
+ key: C.index,
1069
+ class: "mrp-page-holder",
1070
+ "data-page": C.index + 1
1071
+ }, null, 8, sn))), 128)),
1072
+ b(X).padBottomPx > 0 ? (h(), y("div", {
1073
+ key: 1,
1074
+ class: "mrp-spacer-bottom",
1075
+ style: Y({ height: `${b(X).padBottomPx}px` }),
1076
+ "aria-hidden": "true"
1077
+ }, null, 4)) : W("", !0)
1078
+ ], 4)
1079
+ ], 4))
1080
+ ], 544),
1081
+ x.value && v.value > 0 ? (h(), y("aside", {
1082
+ key: 0,
1083
+ ref_key: "thumbsRef",
1084
+ ref: p,
1085
+ class: "mrp-thumbs"
1086
+ }, [
1087
+ (h(!0), y(te, null, ie(t.value?.pages ?? [], (C, k) => (h(), y("div", {
1088
+ key: k,
1089
+ class: U(["mrp-thumb", { "mrp-thumb-active": k + 1 === u.value }]),
1090
+ onClick: (B) => H(k + 1)
1091
+ }, [
1092
+ P("div", {
1093
+ class: "mrp-thumb-box",
1094
+ "data-thumb": k + 1,
1095
+ style: Y({ height: `${Math.round(C.pageHeightMm / C.pageWidthMm * 116)}px` })
1096
+ }, null, 12, un),
1097
+ P("span", cn, w(k + 1), 1)
1098
+ ], 10, ln))), 128))
1099
+ ], 512)) : W("", !0)
1100
+ ]),
1101
+ P("div", dn, [
1102
+ st(l.$slots, "default", {}, void 0, !0)
1103
+ ]),
1104
+ b(G) ? (h(), y("div", mn, [
1105
+ g[4] || (g[4] = P("div", null, "mach-report debug", -1)),
1106
+ P("div", null, "pages: " + w(b(G).pages) + " | window: [" + w(b(G).window) + "]", 1),
1107
+ P("div", null, "zoom: " + w(b(G).zoom) + " | load: " + w(b(G).loadMs), 1),
1108
+ P("div", null, "plan: " + w(b(G).planKB) + "KB", 1)
1109
+ ])) : W("", !0)
1110
+ ], 4));
1111
+ }
1112
+ }), pn = /* @__PURE__ */ Ee(fn, [["__scopeId", "data-v-4648d204"]]), $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1113
+ __proto__: null,
1114
+ default: pn
1115
+ }, Symbol.toStringTag, { value: "Module" }));
1116
+ export {
1117
+ Jt as D,
1118
+ le as M,
1119
+ Yt as R,
1120
+ xn as S,
1121
+ Xt as a,
1122
+ pn as b,
1123
+ Ht as c,
1124
+ ee as d,
1125
+ bt as e,
1126
+ yn as f,
1127
+ Pn as g,
1128
+ En as h,
1129
+ tn as i,
1130
+ gt as j,
1131
+ wt as k,
1132
+ ht as l,
1133
+ $n as m,
1134
+ wn as p,
1135
+ Qt as r,
1136
+ _t as t,
1137
+ en as u
1138
+ };