@agile-team/mach-report 2.20.0 → 2.21.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 (112) hide show
  1. package/README.md +6 -2
  2. package/dist/{ExcelBindingWizard-B7aeRg46.cjs → ExcelBindingWizard-Bu0LUlzl.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-Chn6ZC2-.js → ExcelBindingWizard-mnAO2qOX.js} +3 -3
  4. package/dist/{ParamEditor-BdFMa1CX.cjs → ParamEditor-38ZfNrPU.cjs} +1 -1
  5. package/dist/{ParamEditor-o-7E7WZZ.js → ParamEditor-C8l0EC8m.js} +1 -1
  6. package/dist/{ReportBatchPanel-CNJ4Useq.js → ReportBatchPanel-CfUVhvkO.js} +1 -1
  7. package/dist/{ReportBatchPanel-DVpmB7tG.cjs → ReportBatchPanel-nCC06Nfp.cjs} +1 -1
  8. package/dist/ReportLabelStudio-CaEvYuSK.cjs +1 -0
  9. package/dist/ReportLabelStudio-DQPBmh4v.js +765 -0
  10. package/dist/{ReportPreview-CGcxwkAn.js → ReportPreview-BBJNlu2U.js} +8 -8
  11. package/dist/{ReportPreview-hlwvZ1wf.cjs → ReportPreview-nf4Dk1Jc.cjs} +2 -2
  12. package/dist/{ReportTemplateLibrary-DyIJhJjX.js → ReportTemplateLibrary-B5t_EcIs.js} +1 -1
  13. package/dist/{ReportTemplateLibrary-DjjyZnZB.cjs → ReportTemplateLibrary-DVlsf72p.cjs} +1 -1
  14. package/dist/{RuleEditor-BeknHHOD.js → RuleEditor-kT1JsZ9f.js} +3 -3
  15. package/dist/RuleEditor-xFkCVlii.cjs +1 -0
  16. package/dist/{TemplateOutlinePanel-Bv8CxbXS.js → TemplateOutlinePanel-BesgGR1P.js} +1 -1
  17. package/dist/{TemplateOutlinePanel-D6TXg1aV.cjs → TemplateOutlinePanel-CDI6mfWx.cjs} +1 -1
  18. package/dist/{TemplateReusePanel-wrSbd_mr.cjs → TemplateReusePanel-BG9Or5-P.cjs} +1 -1
  19. package/dist/{TemplateReusePanel-CfousvPY.js → TemplateReusePanel-BNFU6V-W.js} +2 -2
  20. package/dist/{TemplateReviewPanel-BKFcSbTh.cjs → TemplateReviewPanel-BmBrjt6P.cjs} +1 -1
  21. package/dist/{TemplateReviewPanel-F2tqWNLO.js → TemplateReviewPanel-CwvwyCSs.js} +1 -1
  22. package/dist/artifact-integrity.json +90 -92
  23. package/dist/{assets-2eC3mOcV.js → assets-CxHunY_9.js} +2 -2
  24. package/dist/{assets-B0Hxn4l6.cjs → assets-vbjAGgk8.cjs} +1 -1
  25. package/dist/{auto-BlchZ1b8.js → auto-BkdGiNtr.js} +4 -4
  26. package/dist/{auto-B0EZFIK1.cjs → auto-Tq7ReIC1.cjs} +1 -1
  27. package/dist/{component-tree-CvW4lzpv.js → component-tree-1_QCiQJX.js} +1 -1
  28. package/dist/component-tree-BjZIp6w9.cjs +1 -0
  29. package/dist/{data-bar-PtjXhMgN.js → data-bar-8baGYEZ9.js} +1 -1
  30. package/dist/{data-bar-Ce38juRZ.cjs → data-bar-YltqGTaC.cjs} +1 -1
  31. package/dist/designer-DU3yDWgs.cjs +2 -0
  32. package/dist/designer-HQi-03R6.js +6869 -0
  33. package/dist/designer.cjs +1 -1
  34. package/dist/designer.d.cts +25 -3
  35. package/dist/designer.d.ts +25 -3
  36. package/dist/designer.js +1 -1
  37. package/dist/{encoding-B--eZpp1.cjs → encoding-B79hW4zq.cjs} +1 -1
  38. package/dist/{encoding-mctOLocI.js → encoding-BSeUwrN7.js} +2 -2
  39. package/dist/{font-loader-DBBJ5KE9.cjs → font-loader-BB372_XN.cjs} +1 -1
  40. package/dist/{font-loader-DW8tIaNp.js → font-loader-Di0lQKFf.js} +1 -1
  41. package/dist/grid-geometry-D3SJgWFv.js +136 -0
  42. package/dist/grid-geometry-D8ReblRV.cjs +1 -0
  43. package/dist/index.cjs +6 -6
  44. package/dist/index.js +194 -195
  45. package/dist/json-snapshot-I5VI84Vp.cjs +2 -0
  46. package/dist/{json-snapshot-By4ZVVUt.js → json-snapshot-Kgn459Oj.js} +895 -879
  47. package/dist/{pdf-DqyxJ96U.cjs → pdf-CARdBcuw.cjs} +45 -45
  48. package/dist/{pdf-CKROKygt.js → pdf-DmlnL5eB.js} +13 -14
  49. package/dist/pdf.cjs +1 -1
  50. package/dist/pdf.js +2 -2
  51. package/dist/{plugin-BMsIIJDh.cjs → plugin-BaRUGORD.cjs} +1 -1
  52. package/dist/{plugin-Co1oKD7T.js → plugin-D4kAxfLG.js} +1 -1
  53. package/dist/{prefill-D7EswyTI.cjs → prefill-Bpyn58AZ.cjs} +1 -1
  54. package/dist/{prefill-B8H9qwE4.js → prefill-CJSazcVY.js} +2 -2
  55. package/dist/{prepared-CGVphji3.cjs → prepared-BiSz_9vN.cjs} +1 -1
  56. package/dist/{prepared-BE-4jfX5.js → prepared-BwjwEzFz.js} +1 -1
  57. package/dist/{protocol-Cr81vFSQ.js → protocol-Bs9-ohHN.js} +3 -3
  58. package/dist/{protocol-ByRVzzQG.cjs → protocol-C8VWF9An.cjs} +1 -1
  59. package/dist/record-bindings-Ct1HkPrc.cjs +1 -0
  60. package/dist/{record-bindings-DEJtmo3p.js → record-bindings-VZGS-Qd8.js} +1 -1
  61. package/dist/{region-binding-workflow-CBg0l_tj.js → region-binding-workflow-Cy4GIOUo.js} +2 -2
  62. package/dist/{region-binding-workflow-D05tOYn3.cjs → region-binding-workflow-JNowHd0A.cjs} +1 -1
  63. package/dist/report-encoding-worker.cjs +1 -1
  64. package/dist/report-encoding-worker.js +1 -1
  65. package/dist/rich-text-layout-K48VHUoW.cjs +3 -0
  66. package/dist/{rich-text-layout-Ct5WrY1g.js → rich-text-layout-wxBhnAS7.js} +1 -1
  67. package/dist/{runtime-CEMvybO7.js → runtime-BDf5x1i1.js} +5 -5
  68. package/dist/runtime-DsJt1PIf.cjs +1 -0
  69. package/dist/sbom.cdx.json +1 -1
  70. package/dist/server-node.cjs +4 -4
  71. package/dist/server-node.js +1272 -1274
  72. package/dist/server.cjs +1 -1
  73. package/dist/server.js +8 -8
  74. package/dist/style.css +1 -1
  75. package/dist/{template-catalog-CmbWOJqy.js → template-catalog-DFwIS9aN.js} +3 -3
  76. package/dist/{template-catalog-Utu4GP09.cjs → template-catalog-D_2jdnkL.cjs} +1 -1
  77. package/dist/template-fragments-DZVUBhuB.cjs +1 -0
  78. package/dist/{template-fragments-DWgo9tlZ.js → template-fragments-Dng-AlHk.js} +11 -11
  79. package/dist/{template-registry-BIhIHOab.js → template-registry-DhBqoD7W.js} +120 -118
  80. package/dist/template-registry-DpLUSLwF.cjs +1 -0
  81. package/dist/{column-visual-BpgQVWwT.js → template-serialization-Cc3h-miv.js} +74 -65
  82. package/dist/{column-visual-CtYxnBCP.cjs → template-serialization-D1R5oAqh.cjs} +1 -1
  83. package/dist/{textwrap-BEIg2w8y.js → textwrap-CkGjRFT3.js} +1 -1
  84. package/dist/textwrap-OTOUMr4f.cjs +4 -0
  85. package/dist/vue-async.cjs +1 -1
  86. package/dist/vue-async.js +3 -3
  87. package/dist/vue.cjs +1 -1
  88. package/dist/vue.js +4 -4
  89. package/dist/{workbook-session-B94EwVa_.cjs → workbook-session-NYv01LHe.cjs} +1 -1
  90. package/dist/{workbook-session-BoScoOg-.js → workbook-session-oinxX3qo.js} +2 -2
  91. package/dist/worker.cjs +1 -1
  92. package/dist/worker.js +4 -4
  93. package/dist/xlsx.cjs +4 -4
  94. package/dist/xlsx.js +204 -205
  95. package/package.json +1 -1
  96. package/dist/ReportLabelStudio-Drsm9sAS.cjs +0 -1
  97. package/dist/ReportLabelStudio-r8VFnhGQ.js +0 -589
  98. package/dist/RuleEditor-BVuRn_OQ.cjs +0 -1
  99. package/dist/component-tree-6TV7W6Yj.cjs +0 -1
  100. package/dist/designer-B52ddmHO.js +0 -6676
  101. package/dist/designer-Dtsw_rh7.cjs +0 -2
  102. package/dist/grid-geometry-BNptEcMm.js +0 -65
  103. package/dist/grid-geometry-CZ_cYB6O.cjs +0 -1
  104. package/dist/json-snapshot-jiXff4lc.cjs +0 -2
  105. package/dist/record-bindings-ehjnCDHt.cjs +0 -1
  106. package/dist/rich-text-layout-ALlMoYOG.cjs +0 -3
  107. package/dist/runtime-CDA6d263.cjs +0 -1
  108. package/dist/style-67OqfNed.js +0 -73
  109. package/dist/style-C22Pbv3T.cjs +0 -1
  110. package/dist/template-fragments-C_zSHJAa.cjs +0 -1
  111. package/dist/template-registry-DzWswQI5.cjs +0 -1
  112. package/dist/textwrap-BI-yJ6Wt.cjs +0 -4
@@ -0,0 +1,765 @@
1
+ import { computed as p, shallowRef as Ce, ref as R, onMounted as ot, onScopeDispose as Be, watch as X, defineComponent as rt, markRaw as ut, nextTick as dt, openBlock as S, createElementBlock as M, unref as t, normalizeClass as ze, createElementVNode as r, createVNode as ve, toDisplayString as d, createTextVNode as _, Fragment as be, renderList as Ne, createCommentVNode as N, withDirectives as W, isRef as se, vModelText as Se, vModelSelect as ct, withKeys as ft, withModifiers as mt, createBlock as Je, withCtx as vt, vModelCheckbox as bt, resolveDynamicComponent as pt, vShow as gt } from "vue";
2
+ import { provideMachReportConfig as ht, ReportPreview as yt } from "@agile-team/mach-report/vue";
3
+ import { a as pe } from "./_plugin-vue_export-helper-8SL1F89S.js";
4
+ import { defineReportTemplate as wt, createLabelTemplate as St, parseReportTemplate as x, serializeReportTemplate as Me, createReportSource as Mt, defineLabelReport as Ct, imposeLabelSheets as kt } from "@agile-team/mach-report";
5
+ import { b as Ae } from "./progress-Hc2vxoCs.js";
6
+ import { L as _t, c as Lt } from "./designer-HQi-03R6.js";
7
+ function Rt() {
8
+ let e;
9
+ const s = () => e ??= import("@agile-team/mach-report/codes").then((o) => o.createCodeAssetRenderers()).catch((o) => {
10
+ throw e = void 0, o;
11
+ }), n = (o) => async (u) => {
12
+ Ae(u.signal);
13
+ const l = await s();
14
+ return Ae(u.signal), l[o](u);
15
+ };
16
+ return { assetRenderers: { barcode: n("barcode"), qrcode: n("qrcode") } };
17
+ }
18
+ function Dt(e) {
19
+ const s = e.pages[0];
20
+ if (!s || e.pages.some((u) => u.layout === "wide" || u.widthMm !== s.widthMm || u.heightMm !== s.heightMm)) return;
21
+ const n = Math.floor(190 / (s.widthMm + 4)), o = Math.floor(277 / (s.heightMm + 4));
22
+ if (!(n < 1 || o < 1 || n * o > 1e3))
23
+ return { paper: "a4", columns: n, rows: o, marginMm: 12, gapMm: 4, capacity: n * o };
24
+ }
25
+ const ke = [
26
+ { id: "material", widthMm: 80, heightMm: 55, faces: 1 },
27
+ { id: "paired", widthMm: 80, heightMm: 55, faces: 2 },
28
+ { id: "warehouse", widthMm: 100, heightMm: 60, faces: 1 }
29
+ ];
30
+ function He(e, s) {
31
+ return s ?? e.fields.find((n) => n.semanticRole === "identifier" && n.field !== e.rowKey)?.field ?? e.rowKey ?? e.fields[0]?.field;
32
+ }
33
+ function Le(e, s, n) {
34
+ const o = e.fields.filter((a) => a.field !== s && a.field !== e.rowKey);
35
+ if (n === void 0)
36
+ return o.map((a, f) => ({ field: a, index: f, priority: Ft(a) })).sort((a, f) => a.priority - f.priority || a.index - f.index).slice(0, 5).map((a) => a.field);
37
+ const u = new Map(o.map((a) => [a.field, a])), l = [...new Set(n)];
38
+ if (l.length > 5) throw new Error("成品标签最多显示 5 个字段,请先精简显示字段");
39
+ return l.map((a) => {
40
+ const f = u.get(a);
41
+ if (!f) throw new Error(`标签显示字段未在业务契约中声明:${a}`);
42
+ return f;
43
+ });
44
+ }
45
+ function Ft(e) {
46
+ return /^(?:name|title|label|category)$/i.test(e.field) || /名称|品名|品类|类别/.test(e.label ?? "") ? 0 : e.semanticRole === "dimension" ? 1 : e.semanticRole === "measure" && e.unit ? 2 : e.semanticRole === "identifier" ? 3 : e.semanticRole === "date" ? 4 : 5;
47
+ }
48
+ function Nt(e = "paired") {
49
+ return ke.find((s) => s.id === e) ?? ke[1];
50
+ }
51
+ const xe = "#173450", Re = "#586c82";
52
+ function H(e, s, n, o, u = 4, l = 7) {
53
+ return {
54
+ kind: "text",
55
+ text: e,
56
+ leftMm: s,
57
+ topMm: n,
58
+ widthMm: o,
59
+ heightMm: u,
60
+ style: { fontSize: l, lineHeight: 1.1, color: xe, verticalAlign: "middle" }
61
+ };
62
+ }
63
+ function Te(e, s) {
64
+ return {
65
+ kind: "line",
66
+ leftMm: 4,
67
+ topMm: e,
68
+ widthMm: s - 8,
69
+ heightMm: 0.2,
70
+ style: { lineColor: "#c9d7e5", lineWidthPt: 0.55 }
71
+ };
72
+ }
73
+ function Ke(e, s, n) {
74
+ const o = [];
75
+ let u = 4;
76
+ if (n?.logoData) {
77
+ if (!/^data:image\/(?:png|jpeg);base64,/i.test(n.logoData))
78
+ throw new Error("标签Logo须使用PNG或JPEG图片数据");
79
+ o.push({ kind: "image", leftMm: 4, topMm: 3, widthMm: 12, heightMm: 7, imageData: n.logoData, meta: { labelBrandLogo: !0 } }), u = 19;
80
+ }
81
+ return o.push({ ...H(n?.name?.trim() || e, u, 3, s - u - 4, 5, 9), style: { fontSize: 9, color: "#205582" }, meta: { labelStudioRole: "brand-name" } }), n?.tagline?.trim() && o.push({ ...H(n.tagline.trim(), u, 8, s - u - 4, 3, 5.5), style: { fontSize: 5.5, color: Re }, meta: { labelStudioRole: "brand-tagline" } }), o.push(Te(12, s)), o;
82
+ }
83
+ function Ue(e, s, n, o, u = 4.7) {
84
+ return e.flatMap((l, a) => {
85
+ const f = s + a * u;
86
+ return [
87
+ { ...H(l.label ?? l.field, 4, f, n, 4, 6), style: { fontSize: 6, color: Re }, meta: { labelStudioRole: "field-label", labelStudioField: l.field } },
88
+ { ...H("", 4 + n, f, o, 4, 7), binding: { field: l.field, ...l.format ? { format: l.format } : {} }, meta: { labelStudioRole: "field-value", labelStudioField: l.field } }
89
+ ];
90
+ });
91
+ }
92
+ function Et(e, s) {
93
+ return e ? [{ ...H("", 4, 14, s, 7, 14), binding: { field: e }, style: { fontSize: 14, color: xe } }] : [];
94
+ }
95
+ function xt(e, s, n, o) {
96
+ const u = Le(e, n, o.fields), l = [
97
+ ...Ke(s, 80, o.brand),
98
+ ...Et(n, 71),
99
+ ...Ue(u, 23, 21, 27)
100
+ ];
101
+ n && l.push({ kind: "qrcode", leftMm: 55, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: n }, code: { quietZoneModules: 4, errorCorrection: "M" } }), l.push(Te(48, 80));
102
+ const a = e.fields.find((f) => f.field === n)?.label ?? s;
103
+ return l.push({ ...H(a, 4, 49, 71, 3, 5.8), style: { fontSize: 5.8, color: Re } }), l;
104
+ }
105
+ function Pe(e, s, n, o, u = 80) {
106
+ const l = Ke(s, u, o.brand);
107
+ n && (l.push({ ...H("", 4, 14, u - 8, 8, 16), binding: { field: n }, style: { fontSize: 16, align: "center", color: xe } }), l.push({ kind: "qrcode", leftMm: (u - 20) / 2, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: n }, code: { quietZoneModules: 4, errorCorrection: "M" } })), l.push(Te(44, u));
108
+ const a = Le(e, n, o.fields);
109
+ return u === 100 ? a.forEach((f, y) => {
110
+ const g = y % 2 === 0 ? 4 : 52, v = 46 + Math.floor(y / 2) * 4.3;
111
+ l.push({ ...H(f.label ?? f.field, g, v, 19, 3.7, 5.8), style: { fontSize: 5.8, color: Re }, meta: { labelStudioRole: "field-label", labelStudioField: f.field } }), l.push({ ...H("", g + 19, v, 25, 3.7, 6.5), binding: { field: f.field, ...f.format ? { format: f.format } : {} }, meta: { labelStudioRole: "field-value", labelStudioField: f.field } });
112
+ }) : l.push(...Ue(a.slice(0, 1), 46, 24, u - 32, 5)), l;
113
+ }
114
+ function ge(e, s, n, o = {}) {
115
+ const u = He(e, n), l = Nt(o.preset), a = Object.fromEntries(["name", "tagline"].flatMap((v) => {
116
+ const h = o.brand?.[v];
117
+ return typeof h == "string" ? [[v, h]] : [];
118
+ })), f = { preset: l.id, brand: a, fields: Le(e, u, o.fields).map((v) => v.field) }, y = l.id === "warehouse" ? Pe(e, s, u, o, l.widthMm) : xt(e, s, u, o), g = [{ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${s} · 1`, labelStudio: f }, components: y }];
119
+ return l.faces === 2 && g.push({ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${s} · 2`, labelStudio: f }, components: Pe(e, s, u, o) }), wt({ id: "record-label", name: s, template: St({ dataset: "records", rowKey: e.rowKey, pages: g }) });
120
+ }
121
+ const A = (e) => e.meta?.labelStudioRole, Ee = (e) => typeof A(e) == "string";
122
+ function _e(e) {
123
+ const s = { ...e, ...e.meta ? { meta: { ...e.meta } } : {} };
124
+ return s.meta && (delete s.meta.labelStudioRole, delete s.meta.labelStudioField, Object.keys(s.meta).length || delete s.meta), s;
125
+ }
126
+ function Tt(e, s) {
127
+ for (const n of s.components.filter(Ee)) {
128
+ if (e.components.some((u) => A(u) === A(n) && u.meta?.labelStudioField === n.meta?.labelStudioField)) continue;
129
+ const o = e.components.find((u) => !Ee(u) && JSON.stringify(_e(u)) === JSON.stringify(_e(n)));
130
+ o && (o.meta = { ...o.meta, ...n.meta });
131
+ }
132
+ }
133
+ function Vt(e, s) {
134
+ const n = e.kind === "list" ? Number.POSITIVE_INFINITY : e.heightMm, o = s.kind === "list" ? Number.POSITIVE_INFINITY : s.heightMm;
135
+ return e.leftMm < s.leftMm + s.widthMm && e.leftMm + e.widthMm > s.leftMm && e.topMm < s.topMm + o && e.topMm + n > s.topMm;
136
+ }
137
+ function Ot(e, s) {
138
+ const n = { ...e, meta: { ...e.meta, ...s.meta } };
139
+ return n.kind === "text" && s.kind === "text" && (n.text = s.text, s.binding ? n.binding = s.binding : delete n.binding), n;
140
+ }
141
+ function $t(e, s, n, o) {
142
+ const u = o.has("field-value");
143
+ Tt(e, s);
144
+ const l = new Set(e.components.filter((v) => A(v) === "field-label" || A(v) === "field-value")), a = [...l], f = /* @__PURE__ */ new Map(), y = [];
145
+ for (const v of n.components.filter(Ee)) {
146
+ const h = A(v);
147
+ if (!o.has(String(h))) continue;
148
+ const D = h === "field-label" || h === "field-value" ? a.find((k) => A(k) === h && !f.has(k)) : e.components.find((k) => A(k) === h);
149
+ D ? f.set(D, Ot(D, v)) : y.push(v);
150
+ }
151
+ const g = e.components.filter((v) => (!u || !l.has(v) || f.has(v)) && (!o.has("brand-tagline") || A(v) !== "brand-tagline" || n.components.some((h) => A(h) === "brand-tagline"))).map((v) => f.get(v) ?? v);
152
+ for (const v of y) {
153
+ if (g.some((h) => Vt(h, v))) return !1;
154
+ g.push(v);
155
+ }
156
+ return e.components = g, e.meta = { ...e.meta, labelStudio: n.meta?.labelStudio }, !0;
157
+ }
158
+ function It(e, s, n, o, u, l) {
159
+ const a = ge(s, n, o, u), f = ge(s, n, o, l), y = x(e), g = /* @__PURE__ */ new Set();
160
+ JSON.stringify(u.fields) !== JSON.stringify(l.fields) && (g.add("field-label"), g.add("field-value")), (u.brand?.name ?? "").trim() !== (l.brand?.name ?? "").trim() && g.add("brand-name"), (u.brand?.tagline ?? "").trim() !== (l.brand?.tagline ?? "").trim() && g.add("brand-tagline");
161
+ for (const [v, h] of y.template.pages.entries()) {
162
+ const D = a.template.pages[v], k = f.template.pages[v];
163
+ if (D && k && !$t(h, D, k, g)) return;
164
+ }
165
+ return y;
166
+ }
167
+ function zt(e, s) {
168
+ const n = e.template.pages, o = s.template.pages;
169
+ return n.length !== o.length || n.some((u, l) => u.components.length !== o[l].components.length) ? !0 : n.some((u, l) => {
170
+ const a = o[l], f = { ...u, meta: void 0, components: void 0 }, y = { ...a, meta: void 0, components: void 0 };
171
+ return JSON.stringify(f) !== JSON.stringify(y) || u.components.some((g, v) => JSON.stringify(_e(g)) !== JSON.stringify(_e(a.components[v])));
172
+ });
173
+ }
174
+ function Jt(e, s, n, o, u) {
175
+ const l = { ...e, template: ge(s, n, o, u).template }, a = e.template.repeat;
176
+ return a?.copies !== void 0 && l.template.repeat && (l.template.repeat.copies = a.copies), l;
177
+ }
178
+ function J(e) {
179
+ const s = e.template.pages[0]?.meta?.labelStudio;
180
+ if (!s || typeof s != "object") return;
181
+ const n = s, o = ke.find((f) => f.id === n.preset);
182
+ if (!o) return;
183
+ const u = Array.isArray(n.fields) ? n.fields.filter((f) => typeof f == "string") : void 0;
184
+ if (u && u.length > 5) return;
185
+ const l = n.brand && typeof n.brand == "object" ? n.brand : {}, a = {};
186
+ for (const f of ["name", "tagline", "logoData"])
187
+ typeof l[f] == "string" && (a[f] = l[f]);
188
+ return { preset: o.id, fields: u, brand: a };
189
+ }
190
+ function qe(e, s, n) {
191
+ const o = new Set(e.fields.filter((l) => l.field !== s && l.field !== e.rowKey).map((l) => l.field)), u = n?.filter((l) => o.has(l));
192
+ return Le(e, s, u).map((l) => l.field);
193
+ }
194
+ function At(e, s) {
195
+ const n = p(() => ({ ..._t, ...e.messages })), o = p(() => e.title ?? n.value.title), u = { preset: e.preset, brand: e.brand, fields: e.fields }, l = Ce(e.modelValue ? x(e.modelValue) : ge(e.schema, o.value, e.identityField, u)), a = Ce(x(l.value)), f = R(!1), y = Ce();
196
+ let g, v;
197
+ ot(() => {
198
+ e.modelValue || s(x(l.value));
199
+ });
200
+ const h = R("preview"), D = R("all"), k = R(1), $ = R(!1), oe = R(!1), w = R(), K = Lt(() => e.beforeDiscard), U = p(() => oe.value || K.pending.value || f.value && !w.value || w.value?.saving === !0 || w.value?.blocked === !0), L = R(""), ee = p(() => He(e.schema, e.identityField)), I = R(J(l.value)?.preset ?? (e.modelValue ? void 0 : e.preset ?? "paired")), j = R(J(l.value)?.brand?.name ?? e.brand?.name ?? ""), T = R(J(l.value)?.brand?.tagline ?? e.brand?.tagline ?? ""), F = R(qe(e.schema, ee.value, J(l.value)?.fields ?? e.fields)), te = R(""), le = p(() => e.schema.fields.filter((i) => i.field !== ee.value && i.field !== e.schema.rowKey)), ae = p(() => F.value.map((i) => ({ field: i, label: e.schema.fields.find((b) => b.field === i)?.label ?? i }))), re = p(() => {
201
+ const i = te.value.trim().toLocaleLowerCase();
202
+ return le.value.filter((b) => `${b.label ?? ""} ${b.field}`.toLocaleLowerCase().includes(i)).slice(0, 30);
203
+ }), G = p(() => {
204
+ const i = l.value.template.pages[0]?.components.find((b) => b.kind === "image" && b.meta?.labelBrandLogo);
205
+ return i?.kind === "image" ? i.imageData : e.brand?.logoData;
206
+ }), ue = p(() => ({
207
+ preset: I.value,
208
+ fields: F.value,
209
+ brand: { ...e.brand, ...G.value ? { logoData: G.value } : {}, name: j.value, tagline: T.value }
210
+ }));
211
+ let de = JSON.stringify(J(l.value));
212
+ const ce = p(() => {
213
+ const i = J(l.value);
214
+ if (!i) return !0;
215
+ try {
216
+ const b = ge(e.schema, o.value, e.identityField, { ...i, brand: { ...i.brand, ...G.value ? { logoData: G.value } : {} } });
217
+ return zt(l.value, b);
218
+ } catch {
219
+ return !0;
220
+ }
221
+ }), P = R(!1), Q = p(() => I.value !== J(l.value)?.preset), Y = () => JSON.stringify({ preset: I.value, fields: F.value, name: j.value, tagline: T.value }), fe = R(Y()), q = p(() => Y() !== fe.value), me = p(() => Me(l.value)), De = p(() => Me(a.value)), ne = p(() => me.value !== De.value), he = p(() => q.value || ne.value || w.value?.pendingLocalChanges === !0);
222
+ function B() {
223
+ P.value = !1;
224
+ const i = J(l.value);
225
+ I.value = i?.preset, F.value = qe(e.schema, ee.value, i?.fields ?? e.fields), j.value = i?.brand?.name ?? e.brand?.name ?? "", T.value = i?.brand?.tagline ?? e.brand?.tagline ?? "", de = JSON.stringify(i), fe.value = Y();
226
+ }
227
+ function ie(i) {
228
+ const b = J(i), C = JSON.stringify(b);
229
+ C !== de && (de = C, B());
230
+ }
231
+ let V = !1;
232
+ Be(() => {
233
+ V = !0, v?.abort();
234
+ });
235
+ const Z = Rt();
236
+ ht({ get defaults() {
237
+ return { ...e.preview, assets: { ...Z, ...e.preview?.assets, assetRenderers: { ...Z.assetRenderers, ...e.preview?.assets?.assetRenderers } } };
238
+ } }), X(w, (i) => {
239
+ const b = y.value;
240
+ if (!i || !b) return;
241
+ const C = l.value;
242
+ Me(b) !== me.value && i.applyTemplate?.(C.template), y.value = void 0, g = void 0;
243
+ }, { flush: "post" }), X([I, F, j, T], () => {
244
+ P.value = !1;
245
+ }), X(() => e.modelValue, (i) => {
246
+ i && Me(i) !== me.value && (l.value = x(i), a.value = x(i), g = void 0, ie(i));
247
+ }), X(() => e.rows, () => {
248
+ D.value = "all", k.value = 1;
249
+ });
250
+ function O(i) {
251
+ L.value = "", l.value = i, ie(i), s(i);
252
+ }
253
+ function m(i, b) {
254
+ b && F.value.length < 5 && !F.value.includes(i) ? F.value = [...F.value, i] : b || (F.value = F.value.filter((C) => C !== i));
255
+ }
256
+ function c(i = !1) {
257
+ if (U.value || V) return !1;
258
+ if (!I.value)
259
+ return L.value = n.value.choosePreset, !1;
260
+ if (w.value?.canApply === !1)
261
+ return L.value = w.value.saveReason || n.value.applyFirst, !1;
262
+ if (Q.value && !i)
263
+ return P.value = !0, !1;
264
+ try {
265
+ const b = J(l.value);
266
+ let C;
267
+ if (i ? C = Jt(l.value, e.schema, o.value, e.identityField, ue.value) : b && (C = It(l.value, e.schema, o.value, e.identityField, b, ue.value)), !C)
268
+ return L.value = n.value.contentNeedsDesign, !1;
269
+ if (w.value?.applyTemplate) {
270
+ if (!w.value.applyTemplate(C.template))
271
+ return L.value = n.value.saveFailed, !1;
272
+ } else
273
+ g = x(l.value), O(C);
274
+ return P.value = !1, fe.value = Y(), !0;
275
+ } catch (b) {
276
+ return L.value = b instanceof Error ? b.message : n.value.saveFailed, !1;
277
+ }
278
+ }
279
+ const z = p(() => D.value === "all" ? e.rows : Number.isSafeInteger(k.value) && e.rows[k.value - 1] ? [e.rows[k.value - 1]] : []), ye = p(() => l.value.template.repeat?.dataset ?? "records"), je = p(() => ({ [ye.value]: z.value })), Ge = p(() => ({ [ye.value]: z.value.slice(0, 3) })), Qe = p(() => ({ [ye.value]: e.schema })), Ye = p(() => [{ id: ye.value, label: o.value, rowKey: e.schema.rowKey, fields: e.schema.fields }]), Ze = p(() => l.value.template.pages[0]), Ve = p(() => l.value.template.pages.length), We = p(() => {
280
+ const i = l.value.template.repeat?.copies ?? 1;
281
+ return typeof i == "number" ? i : void 0;
282
+ }), Xe = p(() => {
283
+ const i = l.value.template.repeat?.copies;
284
+ return typeof i == "object" ? i.field : void 0;
285
+ }), Oe = p(() => {
286
+ const i = Xe.value;
287
+ if (!i) return;
288
+ let b = 0;
289
+ for (const C of z.value) {
290
+ const E = Object.getOwnPropertyDescriptor(C, i)?.value;
291
+ if (typeof E != "number" || !Number.isSafeInteger(E) || E < 1 || E > 1e3) return;
292
+ b += E;
293
+ }
294
+ return b;
295
+ }), et = p(() => {
296
+ const i = We.value;
297
+ return i !== void 0 ? Number.isSafeInteger(i) && i >= 1 && i <= 1e3 ? z.value.length * i * Ve.value : void 0 : Oe.value === void 0 ? void 0 : Oe.value * Ve.value;
298
+ }), we = p(() => Dt(l.value.template)), tt = p(() => {
299
+ const i = we.value;
300
+ return i ? n.value.sheetHint.replace("{columns}", String(i.columns)).replace("{rows}", String(i.rows)).replace("{capacity}", String(i.capacity)) : n.value.sheetUnavailable;
301
+ });
302
+ X(we, (i) => {
303
+ i || ($.value = !1);
304
+ });
305
+ const lt = p(() => {
306
+ const i = Mt({ labels: Ct({ template: l.value.template, rows: z.value, dataSchema: e.schema }) }), b = $.value ? we.value : void 0;
307
+ return async (C) => {
308
+ const E = await i(C);
309
+ return b ? kt(E, { ...b, signal: C.signal }) : E;
310
+ };
311
+ }), $e = async (i, b) => {
312
+ if (V || b.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
313
+ const C = x(i), E = x(e.save ? await e.save(C, b) : C);
314
+ if (E.id !== i.id) throw new Error(n.value.invalidSavedTemplate);
315
+ if (V || b.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
316
+ return a.value = x(E), O(E), E;
317
+ };
318
+ async function Ie() {
319
+ if (!(U.value || V)) {
320
+ if (q.value && Q.value) {
321
+ L.value = n.value.applyLayoutFirst;
322
+ return;
323
+ }
324
+ if (!(q.value && !c())) {
325
+ oe.value = !0;
326
+ try {
327
+ if (w.value) {
328
+ if (w.value.canApply === !1) {
329
+ L.value = w.value.saveReason || n.value.applyFirst;
330
+ return;
331
+ }
332
+ if (w.value.pendingLocalChanges && await w.value.save(), w.value.pendingLocalChanges) {
333
+ L.value = n.value.saveFailed;
334
+ return;
335
+ }
336
+ } else ne.value && (v = new AbortController(), await $e(l.value, { expectedRevision: l.value.revision, signal: v.signal }), g = void 0);
337
+ if (!V)
338
+ return L.value = "", x(l.value);
339
+ } catch (i) {
340
+ V || (L.value = i instanceof Error ? i.message : n.value.saveFailed);
341
+ } finally {
342
+ oe.value = !1, v = void 0;
343
+ }
344
+ }
345
+ }
346
+ }
347
+ async function at(i) {
348
+ if (!(U.value || i === h.value))
349
+ if (i === "design" && !f.value) {
350
+ if (q.value && Q.value) {
351
+ L.value = n.value.applyLayoutFirst;
352
+ return;
353
+ }
354
+ if (q.value && !c()) return;
355
+ y.value = g, f.value = !0, h.value = i;
356
+ } else await Ie() && (h.value = i);
357
+ }
358
+ function nt(i) {
359
+ f.value = !1, h.value = "preview", L.value = `${n.value.designLoadFailed} ${i instanceof Error ? i.message : String(i)}`;
360
+ }
361
+ let Fe = !1;
362
+ const it = (i) => Fe || K.request(i);
363
+ async function st() {
364
+ if (U.value) return !1;
365
+ const i = w.value?.pendingLocalChanges === !0;
366
+ if (!i && !ne.value && !q.value) return !0;
367
+ if (!(i && w.value ? await w.value.guardChanges() : await K.request({ reason: "replace", document: x(l.value), pendingLocalChanges: !0 })) || V) return !1;
368
+ if (i && w.value) {
369
+ Fe = !0;
370
+ try {
371
+ await w.value.reset();
372
+ } finally {
373
+ Fe = !1;
374
+ }
375
+ }
376
+ return O(x(a.value)), g = void 0, B(), !0;
377
+ }
378
+ return { m: n, notice: L, title: o, document: l, mode: h, editorVisited: f, editorInitialDocument: y, failDesignLoad: nt, sheetLayout: we, sheetHint: tt, rebuilding: P, layoutChanged: Q, record: D, recordIndex: k, sheet: $, busy: U, editor: w, rows: z, datasets: je, designDatasets: Ge, schemas: Qe, bindings: Ye, paper: Ze, labelCount: et, fetcher: lt, update: O, save: $e, navigate: at, prepare: Ie, guardChanges: st, preset: I, presets: ke, brandName: j, brandTagline: T, fields: F, fieldQuery: te, selectedFields: ae, availableFields: re, fieldCount: p(() => le.value.length), configurationDirty: q, pendingLocalChanges: he, custom: ce, toggleField: m, applyConfiguration: c, requestRebuild: () => {
379
+ P.value = !0;
380
+ }, cancelRebuild: () => {
381
+ P.value = !1;
382
+ }, restoreConfiguration: B, beforeDiscard: it, confirmation: K.confirmation, decideDiscard: K.decide };
383
+ }
384
+ const Pt = ["aria-label"], qt = { class: "mr-label-context" }, Bt = { class: "mr-label-identity" }, Ht = { class: "mr-label-spec" }, Kt = ["disabled"], Ut = ["aria-label"], jt = ["aria-pressed", "onClick"], Gt = { class: "mr-label-fields" }, Qt = {
385
+ key: 0,
386
+ class: "mr-label-selected-fields"
387
+ }, Yt = ["aria-label", "onClick"], Zt = { class: "mr-label-field-search" }, Wt = ["aria-label", "placeholder"], Xt = { class: "mr-label-field-options" }, el = ["checked", "disabled", "onChange"], tl = { key: 0 }, ll = { key: 1 }, al = { class: "mr-label-brand" }, nl = ["placeholder"], il = ["disabled"], sl = {
388
+ key: 1,
389
+ class: "mr-label-rebuild",
390
+ role: "alert"
391
+ }, ol = {
392
+ key: 3,
393
+ class: "mr-label-reflow-hint"
394
+ }, rl = { class: "mr-label-reflow-hint" }, ul = { class: "mr-label-record" }, dl = ["disabled"], cl = { value: "all" }, fl = { value: "single" }, ml = {
395
+ key: 0,
396
+ class: "mr-label-record-index"
397
+ }, vl = ["max", "aria-label", "disabled"], bl = { class: "mr-label-count" }, pl = { class: "mr-label-help" }, gl = { class: "mr-label-main" }, hl = { class: "mr-label-bar" }, yl = ["aria-label"], wl = ["aria-pressed", "disabled"], Sl = ["aria-pressed", "disabled"], Ml = {
398
+ key: 0,
399
+ class: "mr-label-notice",
400
+ role: "status"
401
+ }, Cl = ["aria-label"], kl = { class: "mr-label-imposition" }, _l = ["disabled"], Ll = {
402
+ key: 3,
403
+ class: "mr-label-editor"
404
+ }, Rl = {
405
+ key: 0,
406
+ class: "mr-label-editor-loading",
407
+ role: "status"
408
+ }, Vl = /* @__PURE__ */ rt({
409
+ __name: "ReportLabelStudio",
410
+ props: {
411
+ showSave: { type: Boolean, default: !0 },
412
+ rows: {},
413
+ schema: {},
414
+ title: {},
415
+ identityField: {},
416
+ modelValue: {},
417
+ preview: {},
418
+ save: {},
419
+ beforeDiscard: {},
420
+ messages: {},
421
+ preset: {},
422
+ brand: {},
423
+ fields: {}
424
+ },
425
+ emits: ["update:modelValue"],
426
+ setup(e, { expose: s, emit: n }) {
427
+ const o = e, u = n, l = At(o, (O) => u("update:modelValue", O)), { m: a, notice: f, title: y, document: g, mode: v, record: h, recordIndex: D, sheet: k, busy: $, editor: oe, rows: w, designDatasets: K, schemas: U, bindings: L, paper: ee, labelCount: I, fetcher: j, preset: T, presets: F, brandName: te, brandTagline: le, fields: ae, fieldQuery: re, selectedFields: G, availableFields: ue, fieldCount: de, configurationDirty: ce, pendingLocalChanges: P, custom: Q, confirmation: Y, editorVisited: fe, editorInitialDocument: q, sheetLayout: me, sheetHint: De, rebuilding: ne, layoutChanged: he } = l, B = Ce();
428
+ let ie = !1;
429
+ Be(() => {
430
+ ie = !0;
431
+ }), X(l.editorVisited, async (O) => {
432
+ if (!(!O || B.value))
433
+ try {
434
+ const m = await import("./designer-HQi-03R6.js").then((c) => c.t);
435
+ ie || (B.value = ut(m.default));
436
+ } catch (m) {
437
+ ie || l.failDesignLoad(m);
438
+ }
439
+ });
440
+ const V = R();
441
+ let Z = null;
442
+ return X(Y, async (O) => {
443
+ O ? (Z = window.document.activeElement, await dt(), V.value?.focus()) : Z?.isConnected && (Z.focus(), Z = null);
444
+ }), s({ guardChanges: l.guardChanges, prepare: l.prepare, get busy() {
445
+ return $.value;
446
+ }, get pendingLocalChanges() {
447
+ return P.value;
448
+ } }), (O, m) => (S(), M("section", {
449
+ class: ze(["mr-label-studio", { "is-design": t(v) === "design" }]),
450
+ "aria-label": t(y)
451
+ }, [
452
+ r("aside", qt, [
453
+ r("div", Bt, [
454
+ ve(pe, {
455
+ name: "file",
456
+ size: 18
457
+ }),
458
+ r("strong", null, d(t(y)), 1),
459
+ r("small", null, d(t(Q) ? t(a).customTemplate : t(a).readyTemplate), 1)
460
+ ]),
461
+ r("div", Ht, [
462
+ r("strong", null, [
463
+ _(d(t(ee)?.widthMm) + " ", 1),
464
+ m[16] || (m[16] = r("i", null, "×", -1)),
465
+ _(" " + d(t(ee)?.heightMm), 1)
466
+ ]),
467
+ r("span", null, "mm · " + d(t(g).template.pages.length) + " " + d(t(a).faces), 1)
468
+ ]),
469
+ r("fieldset", {
470
+ class: "mr-label-quick",
471
+ disabled: t($)
472
+ }, [
473
+ r("legend", null, d(t(a).layout), 1),
474
+ r("div", {
475
+ class: "mr-label-presets",
476
+ "aria-label": t(a).layout
477
+ }, [
478
+ (S(!0), M(be, null, Ne(t(F), (c) => (S(), M("button", {
479
+ key: c.id,
480
+ type: "button",
481
+ "aria-pressed": t(T) === c.id,
482
+ onClick: (z) => T.value = c.id
483
+ }, [
484
+ r("span", {
485
+ class: ze(["mr-label-preset-art", `is-${c.id}`]),
486
+ "aria-hidden": "true"
487
+ }, [...m[17] || (m[17] = [
488
+ r("i", null, null, -1),
489
+ r("i", null, null, -1),
490
+ r("i", null, null, -1)
491
+ ])], 2),
492
+ r("span", null, [
493
+ r("strong", null, d(t(a)[`${c.id}Preset`]), 1),
494
+ r("small", null, d(c.widthMm) + " × " + d(c.heightMm) + " · " + d(c.faces) + " " + d(t(a).faces), 1)
495
+ ])
496
+ ], 8, jt))), 128))
497
+ ], 8, Ut),
498
+ r("details", Gt, [
499
+ r("summary", null, [
500
+ _(d(t(a).fields) + " ", 1),
501
+ r("span", null, d(t(ae).length) + " / 5", 1)
502
+ ]),
503
+ t(G).length ? (S(), M("div", Qt, [
504
+ (S(!0), M(be, null, Ne(t(G), (c) => (S(), M("button", {
505
+ key: c.field,
506
+ type: "button",
507
+ "aria-label": `${t(a).removeField} ${c.label}`,
508
+ onClick: (z) => t(l).toggleField(c.field, !1)
509
+ }, [
510
+ _(d(c.label) + " ", 1),
511
+ m[18] || (m[18] = r("span", { "aria-hidden": "true" }, "×", -1))
512
+ ], 8, Yt))), 128))
513
+ ])) : N("", !0),
514
+ r("label", Zt, [
515
+ ve(pe, {
516
+ name: "search",
517
+ size: 13
518
+ }),
519
+ W(r("input", {
520
+ "onUpdate:modelValue": m[0] || (m[0] = (c) => se(re) ? re.value = c : null),
521
+ type: "search",
522
+ "aria-label": t(a).findField,
523
+ placeholder: t(a).findField
524
+ }, null, 8, Wt), [
525
+ [Se, t(re)]
526
+ ])
527
+ ]),
528
+ r("div", Xt, [
529
+ (S(!0), M(be, null, Ne(t(ue), (c) => (S(), M("label", {
530
+ key: c.field
531
+ }, [
532
+ r("input", {
533
+ type: "checkbox",
534
+ checked: t(ae).includes(c.field),
535
+ disabled: !t(ae).includes(c.field) && t(ae).length >= 5,
536
+ onChange: (z) => t(l).toggleField(c.field, z.target.checked)
537
+ }, null, 40, el),
538
+ r("span", null, d(c.label ?? c.field), 1)
539
+ ]))), 128)),
540
+ t(ue).length ? N("", !0) : (S(), M("p", tl, d(t(a).noFields), 1))
541
+ ]),
542
+ r("small", null, d(t(a).fieldLimit), 1),
543
+ t(de) > 30 ? (S(), M("small", ll, d(t(a).fieldSearchHint), 1)) : N("", !0)
544
+ ]),
545
+ r("details", al, [
546
+ r("summary", null, d(t(a).brand), 1),
547
+ r("label", null, [
548
+ _(d(t(a).brandName), 1),
549
+ W(r("input", {
550
+ "onUpdate:modelValue": m[1] || (m[1] = (c) => se(te) ? te.value = c : null),
551
+ maxlength: "80",
552
+ placeholder: t(y)
553
+ }, null, 8, nl), [
554
+ [Se, t(te)]
555
+ ])
556
+ ]),
557
+ r("label", null, [
558
+ _(d(t(a).brandTagline), 1),
559
+ W(r("input", {
560
+ "onUpdate:modelValue": m[2] || (m[2] = (c) => se(le) ? le.value = c : null),
561
+ maxlength: "120"
562
+ }, null, 512), [
563
+ [Se, t(le)]
564
+ ])
565
+ ])
566
+ ]),
567
+ r("button", {
568
+ class: "mr-label-apply",
569
+ type: "button",
570
+ disabled: !t(ce) || !t(T),
571
+ onClick: m[3] || (m[3] = (c) => t(l).applyConfiguration())
572
+ }, [
573
+ ve(pe, {
574
+ name: "arrow-right",
575
+ size: 13
576
+ }),
577
+ _(d(t(he) ? t(a).applyLayout : t(a).applyContent), 1)
578
+ ], 8, il),
579
+ t(Q) && t(T) && !t(ne) ? (S(), M("button", {
580
+ key: 0,
581
+ class: "mr-label-reset-configuration mr-label-rebuild-current",
582
+ type: "button",
583
+ onClick: m[4] || (m[4] = //@ts-ignore
584
+ (...c) => t(l).requestRebuild && t(l).requestRebuild(...c))
585
+ }, d(t(a).rebuildCurrent), 1)) : N("", !0),
586
+ t(ne) ? (S(), M("div", sl, [
587
+ r("strong", null, d(t(a).rebuildTitle), 1),
588
+ r("p", null, d(t(a).rebuildDescription), 1),
589
+ r("div", null, [
590
+ r("button", {
591
+ type: "button",
592
+ onClick: m[5] || (m[5] = //@ts-ignore
593
+ (...c) => t(l).cancelRebuild && t(l).cancelRebuild(...c))
594
+ }, d(t(a).cancelRebuild), 1),
595
+ r("button", {
596
+ type: "button",
597
+ onClick: m[6] || (m[6] = (c) => t(l).applyConfiguration(!0))
598
+ }, d(t(a).confirmRebuild), 1)
599
+ ])
600
+ ])) : N("", !0),
601
+ t(ce) ? (S(), M("button", {
602
+ key: 2,
603
+ class: "mr-label-reset-configuration",
604
+ type: "button",
605
+ onClick: m[7] || (m[7] = //@ts-ignore
606
+ (...c) => t(l).restoreConfiguration && t(l).restoreConfiguration(...c))
607
+ }, d(t(a).restoreConfiguration), 1)) : N("", !0),
608
+ t(ce) && !t(T) ? (S(), M("p", ol, d(t(a).choosePreset), 1)) : N("", !0),
609
+ r("p", rl, d(t(he) ? t(a).reflowHint : t(a).contentHint), 1)
610
+ ], 8, Kt),
611
+ r("label", ul, [
612
+ _(d(t(a).records), 1),
613
+ W(r("select", {
614
+ "onUpdate:modelValue": m[8] || (m[8] = (c) => se(h) ? h.value = c : null),
615
+ disabled: t($) || !o.rows.length
616
+ }, [
617
+ r("option", cl, d(t(a).all) + " · " + d(o.rows.length), 1),
618
+ r("option", fl, d(t(a).single), 1)
619
+ ], 8, dl), [
620
+ [ct, t(h)]
621
+ ])
622
+ ]),
623
+ t(h) === "single" ? (S(), M("label", ml, [
624
+ _(d(t(a).record), 1),
625
+ W(r("input", {
626
+ "onUpdate:modelValue": m[9] || (m[9] = (c) => se(D) ? D.value = c : null),
627
+ type: "number",
628
+ min: "1",
629
+ max: o.rows.length,
630
+ "aria-label": t(a).record,
631
+ disabled: t($)
632
+ }, null, 8, vl), [
633
+ [
634
+ Se,
635
+ t(D),
636
+ void 0,
637
+ { number: !0 }
638
+ ]
639
+ ]),
640
+ _(" / " + d(o.rows.length), 1)
641
+ ])) : N("", !0),
642
+ r("p", bl, [
643
+ r("strong", null, d(t(w).length), 1),
644
+ _(" " + d(t(a).count) + " ", 1),
645
+ m[19] || (m[19] = r("span", null, "→", -1)),
646
+ m[20] || (m[20] = _()),
647
+ t(I) !== void 0 ? (S(), M(be, { key: 0 }, [
648
+ r("strong", null, d(t(I)), 1),
649
+ _(" " + d(t(a).labels), 1)
650
+ ], 64)) : (S(), M(be, { key: 1 }, [
651
+ _(d(t(a).invalidCopies), 1)
652
+ ], 64))
653
+ ]),
654
+ r("details", pl, [
655
+ r("summary", null, d(t(a).guide), 1),
656
+ r("p", null, d(t(a).help), 1),
657
+ r("p", null, d(t(a).printHint), 1)
658
+ ])
659
+ ]),
660
+ r("div", gl, [
661
+ r("header", hl, [
662
+ r("nav", { "aria-label": t(y) }, [
663
+ r("button", {
664
+ type: "button",
665
+ "aria-pressed": t(v) === "preview",
666
+ disabled: t($),
667
+ onClick: m[10] || (m[10] = (c) => t(l).navigate("preview"))
668
+ }, [
669
+ ve(pe, {
670
+ name: "file",
671
+ size: 14
672
+ }),
673
+ _(d(t(a).preview), 1)
674
+ ], 8, wl),
675
+ r("button", {
676
+ type: "button",
677
+ "aria-pressed": t(v) === "design",
678
+ disabled: t($),
679
+ onClick: m[11] || (m[11] = (c) => t(l).navigate("design"))
680
+ }, [
681
+ ve(pe, {
682
+ name: "settings",
683
+ size: 14
684
+ }),
685
+ _(d(t(a).design), 1)
686
+ ], 8, Sl)
687
+ ], 8, yl),
688
+ r("span", null, d(t(v) === "design" ? t(a).designHint : t(a).flow), 1)
689
+ ]),
690
+ t(f) ? (S(), M("p", Ml, d(t(f)), 1)) : N("", !0),
691
+ t(Y) ? (S(), M("div", {
692
+ key: 1,
693
+ class: "mr-label-confirm",
694
+ role: "alertdialog",
695
+ "aria-label": t(a).discardTitle,
696
+ onKeydown: m[14] || (m[14] = ft(mt((c) => t(l).decideDiscard(!1), ["prevent", "stop"]), ["esc"]))
697
+ }, [
698
+ r("div", null, [
699
+ r("strong", null, d(t(a).discardTitle), 1),
700
+ r("p", null, d(t(a).discardDescription), 1)
701
+ ]),
702
+ r("button", {
703
+ ref_key: "keepEditingButton",
704
+ ref: V,
705
+ type: "button",
706
+ onClick: m[12] || (m[12] = (c) => t(l).decideDiscard(!1))
707
+ }, d(t(a).keepEditing), 513),
708
+ r("button", {
709
+ type: "button",
710
+ onClick: m[13] || (m[13] = (c) => t(l).decideDiscard(!0))
711
+ }, d(t(a).discard), 1)
712
+ ], 40, Cl)) : N("", !0),
713
+ t(v) === "preview" ? (S(), Je(t(yt), {
714
+ key: 2,
715
+ "report-id": "labels",
716
+ fetcher: t(j),
717
+ "show-params": !1,
718
+ height: "100%",
719
+ toolbar: { exportFormats: ["pdf", "png", "html"], editing: !1, excelImport: !1 },
720
+ messages: { title: t(y), empty: t(a).empty }
721
+ }, {
722
+ settings: vt(() => [
723
+ r("label", kl, [
724
+ W(r("input", {
725
+ "onUpdate:modelValue": m[15] || (m[15] = (c) => se(k) ? k.value = c : null),
726
+ type: "checkbox",
727
+ disabled: !t(me)
728
+ }, null, 8, _l), [
729
+ [bt, t(k)]
730
+ ]),
731
+ _(d(t(a).sheet), 1),
732
+ r("small", null, d(t(De)), 1)
733
+ ])
734
+ ]),
735
+ _: 1
736
+ }, 8, ["fetcher", "messages"])) : N("", !0),
737
+ t(fe) ? W((S(), M("div", Ll, [
738
+ B.value ? N("", !0) : (S(), M("p", Rl, d(t(a).designLoading), 1)),
739
+ B.value ? (S(), Je(pt(B.value), {
740
+ key: 1,
741
+ ref_key: "editor",
742
+ ref: oe,
743
+ "model-value": t(q) ?? t(g),
744
+ mode: "design",
745
+ "show-mode-switch": !1,
746
+ "show-save": e.showSave,
747
+ capabilities: { params: !1 },
748
+ datasets: t(K),
749
+ "data-schemas": t(U),
750
+ "binding-datasets": t(L),
751
+ save: t(l).save,
752
+ "before-discard": t(l).beforeDiscard,
753
+ preview: e.preview,
754
+ "onUpdate:modelValue": t(l).update
755
+ }, null, 8, ["model-value", "show-save", "datasets", "data-schemas", "binding-datasets", "save", "before-discard", "preview", "onUpdate:modelValue"])) : N("", !0)
756
+ ], 512)), [
757
+ [gt, t(v) === "design"]
758
+ ]) : N("", !0)
759
+ ])
760
+ ], 10, Pt));
761
+ }
762
+ });
763
+ export {
764
+ Vl as default
765
+ };