@agile-team/mach-report 2.23.0 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +9 -2
  2. package/dist/ExcelBindingWizard-BV12hGiK.cjs +1 -0
  3. package/dist/ExcelBindingWizard-Cy_lPjWV.js +1486 -0
  4. package/dist/ParamEditor-DenKjvKu.cjs +1 -0
  5. package/dist/ParamEditor-PyOqHzzw.js +750 -0
  6. package/dist/ReportBatchPanel-8EFtMrKk.js +351 -0
  7. package/dist/ReportBatchPanel-pQ6d0yqJ.cjs +1 -0
  8. package/dist/ReportLabelStudio-B_KF3Zc_.cjs +1 -0
  9. package/dist/ReportLabelStudio-HUeo2TsU.js +784 -0
  10. package/dist/ReportParamPanel-8xR85nz-.cjs +1 -0
  11. package/dist/{ReportParamPanel-Dgmqro1Y.js → ReportParamPanel-DA-YpkvC.js} +342 -307
  12. package/dist/ReportPreview-CyUXJSVX.cjs +6 -0
  13. package/dist/ReportPreview-_wTJnsG1.js +7120 -0
  14. package/dist/ReportTemplateLibrary-CjArKxRG.cjs +1 -0
  15. package/dist/ReportTemplateLibrary-DH8jl9IF.js +312 -0
  16. package/dist/RuleEditor-Bmj98oC4.cjs +1 -0
  17. package/dist/RuleEditor-GDydlEHz.js +2354 -0
  18. package/dist/TemplateOutlinePanel-B554_qk1.cjs +1 -0
  19. package/dist/TemplateOutlinePanel-DjPqzU9h.js +97 -0
  20. package/dist/TemplateReusePanel-D0628OYc.cjs +1 -0
  21. package/dist/TemplateReusePanel-DtYbCN7U.js +389 -0
  22. package/dist/TemplateReviewPanel-CSwvCz3f.cjs +1 -0
  23. package/dist/TemplateReviewPanel-D_FR4ISq.js +602 -0
  24. package/dist/artifact-integrity.json +94 -94
  25. package/dist/assets-B4AJIOTB.cjs +1 -0
  26. package/dist/assets-D0FbszhB.js +137 -0
  27. package/dist/{auto-CTIJ6PnR.js → auto-BksreoKc.js} +5 -5
  28. package/dist/auto-C3mGqzJ8.cjs +1 -0
  29. package/dist/capabilities-CTwlcl8q.cjs +1 -0
  30. package/dist/capabilities-lqDEZSq5.js +121 -0
  31. package/dist/data-bar-2NLRzOCQ.cjs +1 -0
  32. package/dist/{data-bar-IkI6VvMQ.js → data-bar-BnGtnJ82.js} +1 -1
  33. package/dist/designer-BNf7NWd6.js +7589 -0
  34. package/dist/designer-DWnZZ_ej.cjs +2 -0
  35. package/dist/designer.cjs +1 -1
  36. package/dist/designer.d.cts +144 -4
  37. package/dist/designer.d.ts +144 -4
  38. package/dist/designer.js +6 -6
  39. package/dist/diagnostic-collector-1sqd7DQP.js +355 -0
  40. package/dist/diagnostic-collector-D3rlvxm3.cjs +1 -0
  41. package/dist/{dom-JWrchIre.js → dom-C90cTM6Y.js} +4 -4
  42. package/dist/dom-CxOkm_Sy.cjs +1 -0
  43. package/dist/{encoding-BefcaHdp.cjs → encoding-CkziAnZI.cjs} +1 -1
  44. package/dist/{encoding-CL6rXEkR.js → encoding-DSc9zv2F.js} +2 -2
  45. package/dist/{font-loader-Ga51c2VC.cjs → font-loader-D-znWNWS.cjs} +1 -1
  46. package/dist/{font-loader-BT5baV-o.js → font-loader-i7lZbqH_.js} +1 -1
  47. package/dist/{grid-strokes-EoY66L2f.js → grid-strokes-BPiV1WHe.js} +1 -1
  48. package/dist/grid-strokes-DYf-6DMl.cjs +1 -0
  49. package/dist/index.cjs +5 -5
  50. package/dist/index.d.cts +46 -7
  51. package/dist/index.d.ts +46 -7
  52. package/dist/index.js +69 -68
  53. package/dist/{json-snapshot-OqkPyUk5.js → json-snapshot-BJWZNryO.js} +919 -791
  54. package/dist/json-snapshot-C7QZrRBf.cjs +2 -0
  55. package/dist/{pdf-aobetCsy.js → pdf-0_5XiTCx.js} +2499 -2492
  56. package/dist/{pdf-HiEeXe9H.cjs → pdf-DWuq6uxx.cjs} +31 -31
  57. package/dist/pdf.cjs +1 -1
  58. package/dist/pdf.d.cts +18 -0
  59. package/dist/pdf.d.ts +18 -0
  60. package/dist/pdf.js +2 -2
  61. package/dist/{plugin-DeYYAL6F.js → plugin-B1ydqEmS.js} +1 -1
  62. package/dist/{plugin-BFANt-i8.cjs → plugin-BQBz2vLG.cjs} +1 -1
  63. package/dist/prefill-2p9wrpn9.cjs +1 -0
  64. package/dist/{prefill-Dk4C6S5R.js → prefill-Cuzh1wxf.js} +13 -13
  65. package/dist/prepared-CVbgO9KR.js +128 -0
  66. package/dist/prepared-DAwe8Il2.cjs +1 -0
  67. package/dist/protocol-BOri9qJL.js +105 -0
  68. package/dist/protocol-DD5dHSz-.cjs +1 -0
  69. package/dist/record-bindings-CAyM5tGg.cjs +1 -0
  70. package/dist/{record-bindings-DatJZv_e.js → record-bindings-fhav-NLG.js} +1 -1
  71. package/dist/{region-binding-workflow-DjrXuR1q.js → region-binding-workflow-Cm4mqhih.js} +2 -2
  72. package/dist/{region-binding-workflow-l7NGfagJ.cjs → region-binding-workflow-DWCUgjZl.cjs} +1 -1
  73. package/dist/report-encoding-worker.cjs +1 -1
  74. package/dist/report-encoding-worker.js +1 -1
  75. package/dist/rich-text-layout-X9YOz1JD.cjs +3 -0
  76. package/dist/{rich-text-layout-Ciwa6D2o.js → rich-text-layout-YJHtCWQI.js} +1 -1
  77. package/dist/runtime-BpSAgOw1.js +201 -0
  78. package/dist/runtime-Cd2UTnwe.cjs +1 -0
  79. package/dist/sbom.cdx.json +1 -1
  80. package/dist/server/node.d.cts +55 -7
  81. package/dist/server/node.d.ts +55 -7
  82. package/dist/server-node.cjs +5 -5
  83. package/dist/server-node.js +2710 -2418
  84. package/dist/server.cjs +1 -1
  85. package/dist/server.d.cts +47 -12
  86. package/dist/server.d.ts +47 -12
  87. package/dist/server.js +8 -8
  88. package/dist/style.css +1 -1
  89. package/dist/{template-catalog-CoT7jm_6.cjs → template-catalog--yBX169M.cjs} +1 -1
  90. package/dist/{template-catalog--cjxzgH7.js → template-catalog-Bu7s7ReF.js} +3 -3
  91. package/dist/template-fragments-5EzVn7bm.cjs +1 -0
  92. package/dist/{template-fragments-CPpGpQoz.js → template-fragments-Di2vDFnx.js} +2 -2
  93. package/dist/{template-registry-O0hNIOfB.js → template-registry-BCBF2b8j.js} +10 -10
  94. package/dist/template-registry-Bnh5aEYf.cjs +1 -0
  95. package/dist/textwrap-BPFxhpOw.cjs +4 -0
  96. package/dist/textwrap-CmVkhMhx.js +111 -0
  97. package/dist/vue/async.d.cts +104 -18
  98. package/dist/vue/async.d.ts +104 -18
  99. package/dist/vue/index.d.cts +134 -28
  100. package/dist/vue/index.d.ts +134 -28
  101. package/dist/vue-async.cjs +1 -1
  102. package/dist/vue-async.js +3 -3
  103. package/dist/vue.cjs +1 -1
  104. package/dist/vue.js +192 -162
  105. package/dist/{workbook-session-C9ZmCBwY.js → workbook-session-B6P_-5a4.js} +2 -2
  106. package/dist/{workbook-session-C6-SrnCT.cjs → workbook-session-BnPK3T58.cjs} +1 -1
  107. package/dist/worker.cjs +1 -1
  108. package/dist/worker.d.cts +55 -7
  109. package/dist/worker.d.ts +55 -7
  110. package/dist/worker.js +4 -4
  111. package/dist/xlsx.cjs +4 -4
  112. package/dist/xlsx.d.cts +18 -1
  113. package/dist/xlsx.d.ts +18 -1
  114. package/dist/xlsx.js +279 -272
  115. package/package.json +1 -1
  116. package/dist/ExcelBindingWizard-D4FLind-.js +0 -1485
  117. package/dist/ExcelBindingWizard-D4RS5Bpg.cjs +0 -1
  118. package/dist/ParamEditor-C-6C9rd2.cjs +0 -1
  119. package/dist/ParamEditor-CASZt-Ma.js +0 -732
  120. package/dist/ReportBatchPanel-Bq7t8a5r.js +0 -350
  121. package/dist/ReportBatchPanel-YVj5IO5y.cjs +0 -1
  122. package/dist/ReportLabelStudio-Cqhita1b.cjs +0 -1
  123. package/dist/ReportLabelStudio-Dj7GXhuv.js +0 -783
  124. package/dist/ReportParamPanel-DZbFVmDL.cjs +0 -1
  125. package/dist/ReportPreview-DeWzG8jQ.js +0 -6257
  126. package/dist/ReportPreview-FFIryrIr.cjs +0 -6
  127. package/dist/ReportTemplateLibrary-BaWodmpm.cjs +0 -1
  128. package/dist/ReportTemplateLibrary-DdAAAD2I.js +0 -311
  129. package/dist/RuleEditor-D2UwQGF6.js +0 -2341
  130. package/dist/RuleEditor-DcT9xI1v.cjs +0 -1
  131. package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +0 -1
  132. package/dist/TemplateOutlinePanel-DrT7XN0m.js +0 -96
  133. package/dist/TemplateReusePanel-4eejkNqi.js +0 -388
  134. package/dist/TemplateReusePanel-DZMyiX5I.cjs +0 -1
  135. package/dist/TemplateReviewPanel-BIhNLeNw.js +0 -592
  136. package/dist/TemplateReviewPanel-DnYImiXu.cjs +0 -1
  137. package/dist/assets-D2gHc4Mz.cjs +0 -1
  138. package/dist/assets-T_gDeFaz.js +0 -132
  139. package/dist/auto-4pK9HePf.cjs +0 -1
  140. package/dist/capabilities-DiBj4Qgl.cjs +0 -1
  141. package/dist/capabilities-pg7j7VLT.js +0 -106
  142. package/dist/data-bar-CeZuFmYl.cjs +0 -1
  143. package/dist/designer-DhrE7jzw.js +0 -7169
  144. package/dist/designer-IAZu6kBX.cjs +0 -2
  145. package/dist/dom-ChE5D-L-.cjs +0 -1
  146. package/dist/grid-strokes-Be24LGuV.cjs +0 -1
  147. package/dist/json-snapshot-1tvQNzQE.cjs +0 -2
  148. package/dist/prefill-DsUD5OoK.cjs +0 -1
  149. package/dist/prepared-DCIxhKFo.js +0 -94
  150. package/dist/prepared-Dv-XM3i1.cjs +0 -1
  151. package/dist/progress-ByiOxUD3.js +0 -250
  152. package/dist/progress-WomPRP3B.cjs +0 -1
  153. package/dist/protocol-B9YgfQ_d.cjs +0 -1
  154. package/dist/protocol-DxeUKGYG.js +0 -90
  155. package/dist/record-bindings-MBxbeBsi.cjs +0 -1
  156. package/dist/rich-text-layout-DK7A_a5r.cjs +0 -3
  157. package/dist/runtime-75Y5Oq5B.js +0 -171
  158. package/dist/runtime-DKlGd_D4.cjs +0 -1
  159. package/dist/template-fragments-GVjpew_q.cjs +0 -1
  160. package/dist/template-registry-DI59PXVK.cjs +0 -1
  161. package/dist/textwrap-BIjtEWmq.js +0 -110
  162. package/dist/textwrap-Cy7o1hIR.cjs +0 -4
@@ -0,0 +1,1486 @@
1
+ import { defineComponent as Ne, ref as S, computed as I, watch as ue, nextTick as Ae, openBlock as d, createElementBlock as c, createElementVNode as n, createTextVNode as P, toDisplayString as l, createVNode as H, Fragment as j, renderList as G, normalizeClass as Ie, createCommentVNode as T, unref as e, withDirectives as Le, vModelText as nt, shallowRef as at, onBeforeUnmount as lt, normalizeStyle as ze, createBlock as ot, vShow as it } from "vue";
2
+ import { E as st, a as rt, u as ut } from "./designer-BNf7NWd6.js";
3
+ import { o as pe, q as Fe, f as dt, n as ct, m as vt, h as gt, k as ft, v as bt, i as mt, p as ht, d as yt, c as pt, e as wt, a as kt, g as $t } from "./region-binding-workflow-Cm4mqhih.js";
4
+ import { a as q } from "./_plugin-vue_export-helper-8SL1F89S.js";
5
+ import { u as xt } from "./useLocalDraft-BnhcxXk_.js";
6
+ function Pe(t, C) {
7
+ const v = /^\$\.datasets\[(\d+)\]/.exec(t.path)?.[1];
8
+ return v !== void 0 ? C[Number(v)]?.id : C.find((h) => t.path.startsWith(`$.datasets.${h.id}.samples`))?.id;
9
+ }
10
+ function _e(t, C) {
11
+ const v = /\.fields\[(\d+)\]/.exec(t)?.[1];
12
+ return v !== void 0 ? { control: "field", fieldIndex: Number(v) } : { control: t.split(".").at(-1) || C };
13
+ }
14
+ function We(t, C, v) {
15
+ const h = /^\$\.recipe\.regions\[(\d+)\]/.exec(t.path)?.[1], w = Pe(t, v), f = h === void 0 ? C.regions.find((R) => R.dataset === w) : C.regions[Number(h)];
16
+ if (!f) return { control: t.path.endsWith("footerRange") ? "footer" : "regions", ...C.footerRange ? { range: C.footerRange } : {} };
17
+ if (t.path.startsWith("$.datasets")) return { regionId: f.id, range: f.range, control: t.code === "row-key" ? "rowKey" : "contract" };
18
+ const u = _e(t.path, "range"), K = t.code === "row-key" ? "rowKey" : u.control.startsWith("regions[") ? "range" : u.control;
19
+ return { ...u, control: K, regionId: f.id, range: f.range };
20
+ }
21
+ function Ct(t, C, v) {
22
+ if (t.path.startsWith("$.datasets")) {
23
+ const w = Pe(t, v);
24
+ return w === void 0 ? [] : C.regions.filter((f) => f.dataset === w).map((f) => f.id);
25
+ }
26
+ const h = We(t, C, v).regionId;
27
+ return h ? [h] : [];
28
+ }
29
+ function Rt(t, C) {
30
+ const v = /^\$\.recipe\.regions\.(title|header|detail|footer)$/.exec(t.path)?.[1];
31
+ return v ? { control: v, range: C.regions[v] } : t.path.startsWith("$.datasets") ? { control: t.code === "row-key" ? "rowKey" : "contract", range: C.regions.detail } : { ..._e(t.path, "detail"), range: C.regions.detail };
32
+ }
33
+ function ye(t) {
34
+ if (t.range)
35
+ try {
36
+ const C = pe(t.range);
37
+ return t.fieldIndex !== void 0 && (C.left = C.right = C.left + t.fieldIndex), C;
38
+ } catch {
39
+ return;
40
+ }
41
+ }
42
+ function It(t, C, v) {
43
+ return C.control === "dataset" ? !v.dataset : C.control === "rowKey" ? !v.rowKey : C.control === "field" && C.fieldIndex !== void 0 ? !v.fields[C.fieldIndex] : !1;
44
+ }
45
+ const Mt = ["aria-label"], St = { class: "mr-binding-group" }, Kt = { class: "mr-binding-note" }, Et = ["title", "disabled"], Ft = {
46
+ class: "mr-binding-region-list",
47
+ role: "list",
48
+ tabindex: "-1",
49
+ "data-binding-control": "regions"
50
+ }, Dt = ["data-state"], Tt = ["aria-pressed", "onClick"], zt = ["title"], Bt = { class: "mr-binding-region-state" }, Nt = { key: 0 }, At = ["aria-label", "disabled", "onClick"], Lt = ["disabled"], Pt = {
51
+ key: 0,
52
+ class: "mr-binding-group"
53
+ }, _t = {
54
+ class: "mr-binding-label",
55
+ tabindex: "-1"
56
+ }, Wt = ["value", "aria-label"], Ht = { class: "mr-binding-label" }, qt = ["value", "aria-label"], Ot = { value: "record" }, Vt = { value: "repeat" }, Jt = { class: "mr-binding-note" }, Ut = {
57
+ class: "mr-binding-label",
58
+ tabindex: "-1"
59
+ }, jt = ["value", "aria-label"], Gt = { value: "" }, Xt = ["value"], Qt = {
60
+ key: 0,
61
+ class: "mr-binding-label",
62
+ tabindex: "-1"
63
+ }, Yt = ["value", "aria-label"], Zt = { value: "" }, en = ["value"], tn = { class: "mr-binding-region-tools" }, nn = ["disabled"], an = ["aria-label"], ln = {
64
+ key: 1,
65
+ class: "mr-binding-mappings"
66
+ }, on = { class: "mr-binding-field-search" }, sn = ["placeholder", "aria-label"], rn = {
67
+ key: 0,
68
+ class: "mr-binding-note"
69
+ }, un = ["data-binding-control", "value", "onChange", "aria-label"], dn = { value: "" }, cn = ["value"], vn = { key: 0 }, gn = {
70
+ key: 2,
71
+ class: "mr-binding-map-pages"
72
+ }, fn = ["disabled", "aria-label"], bn = ["disabled", "aria-label"], mn = {
73
+ key: 3,
74
+ class: "mr-binding-concurrency"
75
+ }, hn = ["data-binding-control", "value", "onChange"], yn = { value: "" }, pn = ["value"], wn = {
76
+ class: "mr-binding-group",
77
+ tabindex: "-1",
78
+ "data-binding-control": "footer"
79
+ }, kn = { class: "mr-binding-note" }, $n = { class: "mr-binding-region-tools" }, xn = ["disabled"], Cn = ["aria-label"], Rn = /* @__PURE__ */ Ne({
80
+ __name: "ExcelRegionBindingPanel",
81
+ props: {
82
+ controller: {},
83
+ datasets: {},
84
+ disabled: { type: Boolean },
85
+ messages: {}
86
+ },
87
+ setup(t) {
88
+ const C = t, v = S(0), h = S(), w = S(""), f = C.controller.active, u = I(() => C.datasets.find((y) => y.id === f.value?.dataset)), K = I(() => {
89
+ if (!f.value) return [];
90
+ let y = 1;
91
+ try {
92
+ y = pe(f.value.range).left;
93
+ } catch {
94
+ }
95
+ return f.value.fields.slice(v.value * 12, v.value * 12 + 12).map((x, i) => ({ field: x, index: v.value * 12 + i, physical: Fe(y + v.value * 12 + i) }));
96
+ }), R = I(() => Math.max(1, Math.ceil((f.value?.fields.length ?? 0) / 12))), z = I(() => {
97
+ const y = w.value.trim().toLocaleLowerCase(), x = u.value?.fields ?? [], i = x.filter((B) => [B.field, B.label, B.unit].some((ie) => ie?.toLocaleLowerCase().includes(y))).slice(0, 64), M = new Set(K.value.map((B) => B.field));
98
+ return [...i, ...x.filter((B) => M.has(B.field) && !i.includes(B))];
99
+ });
100
+ function J(y) {
101
+ return y.target.value;
102
+ }
103
+ function Y(y) {
104
+ C.controller.setActive(y), v.value = 0, w.value = "";
105
+ }
106
+ ue(() => C.controller.focusTarget.value, async (y) => {
107
+ if (!y) return;
108
+ v.value = Math.floor((y.target.fieldIndex ?? 0) / 12), w.value = "", await Ae();
109
+ const x = y.target.control === "field" ? `field-${y.target.fieldIndex}` : y.target.control === "contract" ? "dataset" : y.target.control, i = h.value?.querySelector(`[data-binding-control="${x}"]`), M = i?.closest("details");
110
+ M && (M.open = !0);
111
+ const B = C.disabled && i?.matches("input,select,textarea,button") ? i.closest("label") : i;
112
+ B?.focus(), B?.scrollIntoView?.({ block: "nearest" });
113
+ });
114
+ function oe(y) {
115
+ if (!(!f.value || C.disabled)) {
116
+ f.value.range = J(y);
117
+ try {
118
+ const x = pe(f.value.range), i = x.right - x.left + 1;
119
+ i <= 2048 && (f.value.fields = Array.from({ length: i }, (M, B) => f.value.fields[B] ?? ""));
120
+ } catch {
121
+ }
122
+ }
123
+ }
124
+ return (y, x) => (d(), c("section", {
125
+ ref_key: "panel",
126
+ ref: h,
127
+ class: "mr-binding-multi",
128
+ "aria-label": t.messages.multiRegions
129
+ }, [
130
+ n("div", St, [
131
+ n("h3", null, [
132
+ P(l(t.messages.multiRegions), 1),
133
+ n("span", null, l(t.controller.recipe.value.regions.length) + "/128", 1)
134
+ ]),
135
+ n("p", Kt, l(t.messages.multiHint), 1),
136
+ n("button", {
137
+ type: "button",
138
+ class: "mr-binding-add-region",
139
+ title: t.controller.recipe.value.regions.length >= 128 ? t.messages.limitRegions : t.controller.selection.value ? t.messages.addRegion : t.messages.noCellSelection,
140
+ disabled: t.disabled || !t.controller.selection.value || t.controller.recipe.value.regions.length >= 128,
141
+ onClick: x[0] || (x[0] = //@ts-ignore
142
+ (...i) => t.controller.add && t.controller.add(...i))
143
+ }, [
144
+ H(q, {
145
+ name: "grid",
146
+ size: 13
147
+ }),
148
+ P(l(t.messages.addRegion), 1),
149
+ n("code", null, l(t.controller.selection.value || "—"), 1)
150
+ ], 8, Et),
151
+ n("div", Ft, [
152
+ (d(!0), c(j, null, G(t.controller.directory.value, (i) => (d(), c("div", {
153
+ key: i.region.id,
154
+ class: Ie(["mr-binding-region-entry", { "is-active": i.region.id === t.controller.activeId.value }]),
155
+ "data-state": i.state
156
+ }, [
157
+ n("button", {
158
+ type: "button",
159
+ "aria-pressed": i.region.id === t.controller.activeId.value,
160
+ onClick: (M) => Y(i.region.id)
161
+ }, [
162
+ n("strong", {
163
+ title: i.region.id
164
+ }, l(i.region.id), 9, zt),
165
+ n("code", null, l(i.region.range), 1),
166
+ n("small", null, l(i.region.mode === "record" ? t.messages.recordMode : t.messages.repeatMode) + " · " + l(i.region.dataset || t.messages.chooseDataset), 1),
167
+ n("span", Bt, [
168
+ P(l(i.state === "ready" ? t.messages.regionReady : i.state === "pending" ? t.messages.regionPending : t.messages.regionError), 1),
169
+ i.issues.length ? (d(), c("span", Nt, " · " + l(i.issues.length), 1)) : T("", !0)
170
+ ])
171
+ ], 8, Tt),
172
+ n("button", {
173
+ type: "button",
174
+ "aria-label": `${t.messages.removeRegion} ${i.region.id}`,
175
+ disabled: t.disabled,
176
+ onClick: (M) => t.controller.remove(i.region.id)
177
+ }, [
178
+ H(q, {
179
+ name: "close",
180
+ size: 12
181
+ })
182
+ ], 8, At)
183
+ ], 10, Dt))), 128))
184
+ ])
185
+ ]),
186
+ n("fieldset", {
187
+ disabled: t.disabled,
188
+ class: "mr-binding-region-editor"
189
+ }, [
190
+ e(f) ? (d(), c("section", Pt, [
191
+ n("h3", null, [
192
+ P(l(t.messages.regionProperties), 1),
193
+ n("code", null, l(e(f).id), 1)
194
+ ]),
195
+ n("label", _t, [
196
+ P(l(t.messages.regionCoordinates), 1),
197
+ n("input", {
198
+ "data-binding-control": "range",
199
+ value: e(f).range,
200
+ "aria-label": t.messages.regionCoordinates,
201
+ onChange: oe
202
+ }, null, 40, Wt)
203
+ ]),
204
+ n("label", Ht, [
205
+ P(l(t.messages.regionMode), 1),
206
+ n("select", {
207
+ value: e(f).mode,
208
+ "aria-label": t.messages.regionMode,
209
+ onChange: x[1] || (x[1] = (i) => t.controller.property("mode", J(i)))
210
+ }, [
211
+ n("option", Ot, l(t.messages.recordMode), 1),
212
+ n("option", Vt, l(t.messages.repeatMode), 1)
213
+ ], 40, qt)
214
+ ]),
215
+ n("p", Jt, l(e(f).mode === "record" ? t.messages.recordHint : t.messages.repeatHint), 1),
216
+ n("label", Ut, [
217
+ P(l(t.messages.dataset), 1),
218
+ n("select", {
219
+ "data-binding-control": "dataset",
220
+ value: e(f).dataset,
221
+ "aria-label": t.messages.dataset,
222
+ onChange: x[2] || (x[2] = (i) => t.controller.dataset(J(i)))
223
+ }, [
224
+ n("option", Gt, l(t.messages.chooseDataset), 1),
225
+ (d(!0), c(j, null, G(t.datasets, (i) => (d(), c("option", {
226
+ key: i.id,
227
+ value: i.id
228
+ }, l(i.label || i.id), 9, Xt))), 128))
229
+ ], 40, jt)
230
+ ]),
231
+ u.value ? (d(), c("label", Qt, [
232
+ P(l(t.messages.rowKey), 1),
233
+ n("select", {
234
+ "data-binding-control": "rowKey",
235
+ value: e(f).rowKey,
236
+ "aria-label": t.messages.rowKey,
237
+ onChange: x[3] || (x[3] = (i) => t.controller.property("rowKey", J(i)))
238
+ }, [
239
+ n("option", Zt, l(t.messages.chooseRowKey), 1),
240
+ (d(!0), c(j, null, G(u.value.fields.filter((i) => i.type !== "boolean"), (i) => (d(), c("option", {
241
+ key: i.field,
242
+ value: i.field
243
+ }, l(i.label || i.field), 9, en))), 128))
244
+ ], 40, Yt)
245
+ ])) : T("", !0),
246
+ n("div", tn, [
247
+ n("button", {
248
+ type: "button",
249
+ disabled: !t.controller.selection.value,
250
+ onClick: x[4] || (x[4] = //@ts-ignore
251
+ (...i) => t.controller.header && t.controller.header(...i))
252
+ }, l(t.messages.bindRegionHeader), 9, nn),
253
+ n("code", null, l(e(f).headerRange || t.messages.noRegionHeader), 1),
254
+ e(f).headerRange ? (d(), c("button", {
255
+ key: 0,
256
+ type: "button",
257
+ "aria-label": t.messages.clearHeader,
258
+ onClick: x[5] || (x[5] = //@ts-ignore
259
+ (...i) => t.controller.clearHeader && t.controller.clearHeader(...i))
260
+ }, [
261
+ H(q, {
262
+ name: "close",
263
+ size: 11
264
+ })
265
+ ], 8, an)) : T("", !0)
266
+ ]),
267
+ u.value ? (d(), c("div", ln, [
268
+ n("label", on, [
269
+ H(q, {
270
+ name: "search",
271
+ size: 13
272
+ }),
273
+ Le(n("input", {
274
+ "onUpdate:modelValue": x[6] || (x[6] = (i) => w.value = i),
275
+ type: "search",
276
+ placeholder: t.messages.searchFields,
277
+ "aria-label": t.messages.searchFields
278
+ }, null, 8, sn), [
279
+ [nt, w.value]
280
+ ])
281
+ ]),
282
+ u.value.fields.length > 64 ? (d(), c("small", rn, l(t.messages.fieldLimit), 1)) : T("", !0),
283
+ (d(!0), c(j, null, G(K.value, (i) => (d(), c("label", {
284
+ key: i.index,
285
+ class: "mr-binding-map",
286
+ tabindex: "-1"
287
+ }, [
288
+ n("span", null, l(i.physical), 1),
289
+ n("div", null, [
290
+ n("select", {
291
+ "data-binding-control": `field-${i.index}`,
292
+ value: e(f).fields[i.index],
293
+ onChange: (M) => t.controller.mapping(i.index, J(M)),
294
+ "aria-label": `${t.messages.physical} ${i.physical} · ${t.messages.business}`
295
+ }, [
296
+ n("option", dn, l(t.messages.chooseField), 1),
297
+ (d(!0), c(j, null, G(z.value, (M) => (d(), c("option", {
298
+ key: M.field,
299
+ value: M.field
300
+ }, l(M.label || M.field) + " · " + l(M.field), 9, cn))), 128))
301
+ ], 40, un),
302
+ i.field ? (d(), c("small", vn, l(u.value.fields.find((M) => M.field === i.field)?.type) + " · " + l(u.value.fields.find((M) => M.field === i.field)?.unit || "—"), 1)) : T("", !0)
303
+ ])
304
+ ]))), 128))
305
+ ])) : T("", !0),
306
+ R.value > 1 ? (d(), c("div", gn, [
307
+ n("button", {
308
+ type: "button",
309
+ disabled: v.value <= 0,
310
+ "aria-label": t.messages.previousColumns,
311
+ onClick: x[7] || (x[7] = (i) => v.value--)
312
+ }, [
313
+ H(q, {
314
+ name: "chevron-left",
315
+ size: 13
316
+ })
317
+ ], 8, fn),
318
+ n("span", null, l(v.value + 1) + "/" + l(R.value), 1),
319
+ n("button", {
320
+ type: "button",
321
+ disabled: v.value + 1 >= R.value,
322
+ "aria-label": t.messages.nextColumns,
323
+ onClick: x[8] || (x[8] = (i) => v.value++)
324
+ }, [
325
+ H(q, {
326
+ name: "chevron-right",
327
+ size: 13
328
+ })
329
+ ], 8, bn)
330
+ ])) : T("", !0),
331
+ u.value ? (d(), c("details", mn, [
332
+ n("summary", null, l(t.messages.concurrency), 1),
333
+ (d(), c(j, null, G(["revisionField", "sourceTokenField"], (i) => n("label", {
334
+ key: i,
335
+ class: "mr-binding-label",
336
+ tabindex: "-1"
337
+ }, [
338
+ P(l(i === "revisionField" ? t.messages.revisionField : t.messages.sourceTokenField), 1),
339
+ n("select", {
340
+ "data-binding-control": i,
341
+ value: e(f)[i] || "",
342
+ onChange: (M) => t.controller.property(i, J(M))
343
+ }, [
344
+ n("option", yn, l(t.messages.optional), 1),
345
+ (d(!0), c(j, null, G(u.value.fields, (M) => (d(), c("option", {
346
+ key: M.field,
347
+ value: M.field
348
+ }, l(M.label || M.field), 9, pn))), 128))
349
+ ], 40, hn)
350
+ ])), 64))
351
+ ])) : T("", !0)
352
+ ])) : T("", !0),
353
+ n("section", wn, [
354
+ n("h3", null, l(t.messages.flowFooter), 1),
355
+ n("p", kn, l(t.messages.flowFooterHint), 1),
356
+ n("div", $n, [
357
+ n("button", {
358
+ type: "button",
359
+ disabled: !t.controller.selection.value,
360
+ onClick: x[9] || (x[9] = //@ts-ignore
361
+ (...i) => t.controller.footer && t.controller.footer(...i))
362
+ }, l(t.messages.bindFooter), 9, xn),
363
+ n("code", null, l(t.controller.recipe.value.footerRange || "—"), 1),
364
+ t.controller.recipe.value.footerRange ? (d(), c("button", {
365
+ key: 0,
366
+ type: "button",
367
+ "aria-label": t.messages.clearFooter,
368
+ onClick: x[10] || (x[10] = //@ts-ignore
369
+ (...i) => t.controller.clearFooter && t.controller.clearFooter(...i))
370
+ }, [
371
+ H(q, {
372
+ name: "close",
373
+ size: 11
374
+ })
375
+ ], 8, Cn)) : T("", !0)
376
+ ])
377
+ ])
378
+ ], 8, Lt)
379
+ ], 8, Mt));
380
+ }
381
+ });
382
+ function Be(t = "") {
383
+ return { version: "2.0", sheet: t, regions: [] };
384
+ }
385
+ function In(t, C, v, h) {
386
+ const w = S(Be()), f = S(""), u = S(), K = S(), R = S(), z = I(() => !t.value || !K.value || !R.value ? "" : dt(t.value, C.value, K.value, R.value)), J = I(() => ({ ...w.value, regions: w.value.regions.map((b) => ({ ...b, fields: [] })) })), Y = I(() => t.value ? ct(t.value, J.value) : []), oe = I(() => {
387
+ const b = vt(w.value, h()), m = [...Y.value, ...b.issues];
388
+ return { ...b, ok: !m.length, issues: m };
389
+ }), y = I(() => w.value.regions.find((b) => b.id === f.value));
390
+ function x(b) {
391
+ return We(b, w.value, h());
392
+ }
393
+ const i = I(() => {
394
+ const b = /* @__PURE__ */ new Map();
395
+ for (const m of oe.value.issues) {
396
+ const A = x(m);
397
+ for (const k of Ct(m, w.value, h())) {
398
+ const N = b.get(k) ?? [];
399
+ N.push({ issue: m, target: { ...A, regionId: k } }), b.set(k, N);
400
+ }
401
+ }
402
+ return w.value.regions.map((m) => {
403
+ const A = b.get(m.id) ?? [], k = A.length ? A.every((N) => It(N.issue, N.target, m)) ? "pending" : "error" : "ready";
404
+ return { region: m, state: k, issues: A };
405
+ });
406
+ });
407
+ function M(b = Be(C.value)) {
408
+ w.value = JSON.parse(JSON.stringify(b)), f.value = w.value.regions[0]?.id ?? "", K.value = void 0, R.value = void 0, u.value = void 0;
409
+ }
410
+ function B(b) {
411
+ b.regionId && (f.value = b.regionId);
412
+ const m = ye(b);
413
+ m && (K.value = { row: m.top, column: m.left }, R.value = { row: m.bottom, column: m.right }), u.value = { target: b, sequence: (u.value?.sequence ?? 0) + 1 };
414
+ }
415
+ function ie(b) {
416
+ B(x(b));
417
+ }
418
+ function Z(b, m, A) {
419
+ v.value || ((!A || !K.value) && (K.value = { row: b, column: m }), R.value = { row: b, column: m });
420
+ }
421
+ function r() {
422
+ if (v.value || !z.value || w.value.regions.length >= 128) return;
423
+ let b = 1;
424
+ for (; w.value.regions.some((k) => k.id === `region-${b}`); ) b++;
425
+ const m = `region-${b}`, A = Math.abs(R.value.column - K.value.column) + 1;
426
+ w.value.regions.push({ id: m, range: z.value, mode: "repeat", dataset: "", fields: Array.from({ length: A }, () => ""), rowKey: "" }), f.value = m;
427
+ }
428
+ function O(b) {
429
+ v.value || (w.value.regions = w.value.regions.filter((m) => m.id !== b), f.value === b && (f.value = w.value.regions[0]?.id ?? ""));
430
+ }
431
+ function ee(b) {
432
+ !v.value && y.value && (y.value.dataset = b, y.value.rowKey = "", y.value.fields.fill(""), delete y.value.revisionField, delete y.value.sourceTokenField);
433
+ }
434
+ function _(b, m) {
435
+ if (!(v.value || !y.value)) {
436
+ if (b === "mode") {
437
+ (m === "record" || m === "repeat") && (y.value.mode = m);
438
+ return;
439
+ }
440
+ m || b === "rowKey" ? y.value[b] = m : delete y.value[b];
441
+ }
442
+ }
443
+ function L(b, m) {
444
+ !v.value && y.value && b >= 0 && b < y.value.fields.length && (y.value.fields[b] = m);
445
+ }
446
+ function F() {
447
+ !v.value && y.value && delete y.value.headerRange;
448
+ }
449
+ function U() {
450
+ !v.value && y.value && z.value && (y.value.headerRange = z.value);
451
+ }
452
+ function X() {
453
+ !v.value && z.value && (w.value.footerRange = z.value);
454
+ }
455
+ function se() {
456
+ v.value || delete w.value.footerRange;
457
+ }
458
+ function V(b) {
459
+ const m = w.value.regions.find((A) => A.id === b);
460
+ m && B({ regionId: b, control: "range", range: m.range });
461
+ }
462
+ function te(b, m) {
463
+ return !!K.value && !!R.value && b >= Math.min(K.value.row, R.value.row) && b <= Math.max(K.value.row, R.value.row) && m >= Math.min(K.value.column, R.value.column) && m <= Math.max(K.value.column, R.value.column);
464
+ }
465
+ return { recipe: w, activeId: f, active: y, selection: z, validation: oe, directory: i, focusTarget: u, target: x, locate: ie, reset: M, select: Z, add: r, remove: O, dataset: ee, property: _, mapping: L, header: U, clearHeader: F, footer: X, clearFooter: se, setActive: V, selected: te };
466
+ }
467
+ function he(t = "", C = 0) {
468
+ return {
469
+ version: "1.0",
470
+ sheet: t,
471
+ dataset: "",
472
+ regions: { header: "", detail: "" },
473
+ fields: Array.from({ length: C }, () => ""),
474
+ rowKey: ""
475
+ };
476
+ }
477
+ function Re(t) {
478
+ return t instanceof Error ? t.message : String(t);
479
+ }
480
+ function Mn(t, C) {
481
+ const v = at(), h = S(he()), w = S("table"), f = In(v, I(() => h.value.sheet), I(() => N.value), () => t.datasets), u = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), R = S({ table: [], regions: [] });
482
+ function z() {
483
+ u.clear(), K.clear(), R.value = { table: [], regions: [] };
484
+ }
485
+ function J() {
486
+ h.value.sheet && (u.set(h.value.sheet, Y(h.value)), K.set(h.value.sheet, JSON.parse(JSON.stringify(f.recipe.value))), R.value = { table: [...u.values()], regions: [...K.values()] });
487
+ }
488
+ const Y = (o) => JSON.parse(JSON.stringify(o));
489
+ function oe(o, g) {
490
+ return Y(u.get(o) ?? he(o, g));
491
+ }
492
+ const y = S({
493
+ id: t.identity?.id ?? "excel-template",
494
+ name: t.identity?.name ?? "Excel 业务模板"
495
+ }), x = S(""), i = S(!1), M = () => ({ recipe: h.value, regions: f.recipe.value, mode: w.value, cached: R.value, identity: y.value });
496
+ let B;
497
+ function ie(o) {
498
+ h.value = Y(o.recipe), f.reset(o.regions), w.value = o.mode, y.value = { ...o.identity, ...t.lockId && t.identity ? { id: t.identity.id } : {} }, z();
499
+ for (const g of o.cached.table) u.set(g.sheet, g);
500
+ for (const g of o.cached.regions) K.set(g.sheet, g);
501
+ R.value = o.cached;
502
+ }
503
+ const Z = S(0), r = xt(() => ({ source: Z.value, recipe: h.value, mode: w.value, regions: f.recipe.value, cached: R.value, identity: y.value })), O = S([]);
504
+ let ee;
505
+ function _() {
506
+ ee?.dispose(), ee = void 0;
507
+ }
508
+ const L = S(""), F = S(!1), U = S(!1), X = S(!1), se = S(!1), V = S(1), te = S(1), b = S(), m = S(), A = S(0), k = I(() => ({ ...st, ...t.messages })), N = I(() => !!t.readonly || F.value || se.value), we = I(() => !F.value && !se.value), ae = I(
509
+ () => v.value?.sheets.find((o) => o.name === h.value.sheet)
510
+ ), W = I(
511
+ () => ae.value ? pe(ae.value.range) : void 0
512
+ ), le = I(
513
+ () => t.datasets.find((o) => o.id === h.value.dataset)
514
+ ), Me = I(
515
+ () => v.value && ae.value ? gt(v.value, ae.value.name, {
516
+ row: V.value,
517
+ column: te.value
518
+ }) : void 0
519
+ ), Se = I(
520
+ () => v.value ? ft(v.value, h.value) : []
521
+ ), Ke = I(() => {
522
+ if (!v.value) return { ok: !1, issues: [], mapped: 0, total: 0 };
523
+ const o = bt(
524
+ v.value,
525
+ h.value,
526
+ t.datasets
527
+ ), g = [...Se.value, ...o.issues];
528
+ return { ...o, ok: g.length === 0, issues: g };
529
+ }), de = I(() => w.value === "regions" ? f.validation.value : Ke.value), be = S(), ke = I(() => w.value === "regions" ? f.focusTarget.value : be.value);
530
+ function ge(o) {
531
+ return w.value === "regions" ? f.target(o) : Rt(o, h.value);
532
+ }
533
+ function p(o) {
534
+ const g = { dataset: k.value.dataset, contract: k.value.dataContract, rowKey: k.value.rowKey, range: k.value.regionCoordinates, field: k.value.mapping, fields: k.value.mapping, footer: k.value.flowFooter, header: k.value.headerRegion, detail: k.value.detailRegion, title: k.value.titleRegion, sheet: k.value.sheet, regions: w.value === "regions" ? k.value.multiRegions : k.value.regionLegend, revisionField: k.value.revisionField, sourceTokenField: k.value.sourceTokenField }, E = ye(o), D = o.fieldIndex === void 0 ? "" : ` ${Fe(E?.left ?? o.fieldIndex + 1)}`;
535
+ return `${o.regionId ? `${o.regionId} · ` : ""}${g[o.control] ?? k.value.regionCoordinates}${D}`;
536
+ }
537
+ const s = I(() => de.value.issues.map((o) => ({
538
+ issue: o,
539
+ label: p(ge(o)),
540
+ message: o.message.replace(/\$\.recipe\.regions\[(\d+)\]/g, (g, E) => f.recipe.value.regions[Number(E)]?.id ?? k.value.regionProperties)
541
+ })));
542
+ function a(o) {
543
+ return o ? { dataset: k.value.nextDataset, rowKey: k.value.nextRowKey, field: k.value.nextField, fields: k.value.nextField, range: k.value.nextRange, regions: k.value.nextRegion, footer: k.value.nextFooter, header: k.value.nextHeader, detail: k.value.nextHeader, title: k.value.nextHeader }[o.control] ?? k.value.nextContract : w.value === "regions" ? k.value.nextRegion : k.value.nextHeader;
544
+ }
545
+ const $ = I(() => t.readonly ? k.value.readonly : F.value ? k.value.loading : se.value ? k.value.applying : X.value ? k.value.applied : de.value.ok ? k.value.ready : a(de.value.issues[0] ? ge(de.value.issues[0]) : void 0));
546
+ ue(ke, (o) => {
547
+ const g = o && ye(o.target);
548
+ !g || !W.value || (V.value = Math.max(W.value.top, Math.min(W.value.bottom, g.top)), te.value = Math.max(W.value.left, Math.min(W.value.right, g.left)));
549
+ });
550
+ function Q(o) {
551
+ if (w.value === "regions") {
552
+ f.locate(o);
553
+ return;
554
+ }
555
+ const g = ge(o), E = ye(g);
556
+ E && (b.value = E.top, m.value = E.bottom), g.fieldIndex !== void 0 && (A.value = Math.floor(g.fieldIndex / 12)), be.value = { target: g, sequence: (be.value?.sequence ?? 0) + 1 };
557
+ }
558
+ const $e = I(
559
+ () => h.value.fields.slice(A.value * 12, (A.value + 1) * 12).map((o, g) => ({
560
+ index: A.value * 12 + g,
561
+ field: o,
562
+ physical: Fe(
563
+ (W.value?.left ?? 1) + A.value * 12 + g
564
+ )
565
+ }))
566
+ ), xe = I(
567
+ () => le.value?.fields.filter((o) => o.type !== "boolean") ?? []
568
+ ), Ce = I(
569
+ () => b.value !== void 0 && m.value !== void 0 ? {
570
+ top: Math.min(b.value, m.value),
571
+ bottom: Math.max(b.value, m.value)
572
+ } : void 0
573
+ );
574
+ let re, ne = 0;
575
+ function ce() {
576
+ ne++, re?.abort(), re = void 0, F.value = !1;
577
+ }
578
+ function me() {
579
+ V.value = W.value?.top ?? 1, te.value = W.value?.left ?? 1, b.value = void 0, m.value = void 0, A.value = 0, U.value = !1, X.value = !1;
580
+ }
581
+ function De(o) {
582
+ ce();
583
+ try {
584
+ const g = o.version === "2.0" ? mt(o) : ht(o);
585
+ ce(), _(), O.value = g.source.sheets.map((E) => ({
586
+ name: E.name,
587
+ index: E.index
588
+ })), v.value = g.source, z(), g.version === "2.0" ? (h.value = he(g.recipe.sheet, g.source.sheets.find((E) => E.name === g.recipe.sheet).columnCount), f.reset(g.recipe), w.value = "regions") : (h.value = g.recipe, f.reset(), w.value = "table"), y.value = { ...g.identity, ...t.lockId && t.identity ? { id: t.identity.id } : {} }, x.value = g.recipe.sheet, L.value = "", me(), Z.value++, r.accept();
589
+ } catch (g) {
590
+ L.value = Re(g);
591
+ }
592
+ }
593
+ ue(
594
+ () => t.session,
595
+ (o) => {
596
+ o && De(o);
597
+ },
598
+ { immediate: !0 }
599
+ ), ue(
600
+ () => t.readonly,
601
+ (o) => {
602
+ o && (ce(), _());
603
+ }
604
+ ), ue(
605
+ [h, y, w, f.recipe],
606
+ () => {
607
+ U.value = !1, X.value = !1;
608
+ },
609
+ { deep: !0, flush: "sync" }
610
+ ), ue(
611
+ () => t.datasets,
612
+ () => {
613
+ U.value = !1, X.value = !1;
614
+ }
615
+ ), lt(() => {
616
+ ce(), _();
617
+ });
618
+ async function He(o) {
619
+ if (t.readonly) return;
620
+ if (ce(), !/\.xlsx$/i.test(o.name)) {
621
+ L.value = k.value.invalidFile;
622
+ return;
623
+ }
624
+ const g = ++ne;
625
+ re = new AbortController(), F.value = !0, L.value = "";
626
+ let E;
627
+ try {
628
+ const { openExcelWorkbook: D } = await import("./workbook-session-B6P_-5a4.js").then((ve) => ve.w);
629
+ if (g !== ne || t.readonly || (E = await D(o, { ...t.importOptions, signal: re.signal }), g !== ne || t.readonly)) return;
630
+ const fe = E.inspect().sheets.filter((ve) => ve.visible);
631
+ if (!fe.length) throw new Error("Excel 中没有可导入的可见工作表");
632
+ const Te = B?.recipe.sheet || fe[0].name;
633
+ if (!fe.some((ve) => ve.name === Te)) throw new Error(k.value.recoveredSheetMissing);
634
+ const Ee = await E.importTemplate({ sheets: [Te], signal: re.signal });
635
+ if (g !== ne || t.readonly) return;
636
+ _(), ee = E, E = void 0, v.value = Ee, Z.value++, x.value = o.name, O.value = fe.map((ve) => ({
637
+ name: ve.name,
638
+ index: ve.index
639
+ })), z(), h.value = he(
640
+ Ee.sheets[0].name,
641
+ Ee.sheets[0].columnCount
642
+ ), f.reset(), B && (ie(B), B = void 0, i.value = !1), me();
643
+ } catch (D) {
644
+ g === ne && (L.value = Re(D));
645
+ } finally {
646
+ E?.dispose(), g === ne && (F.value = !1, re = void 0);
647
+ }
648
+ }
649
+ async function qe(o) {
650
+ if (N.value || !O.value.some((D) => D.name === o) || h.value.sheet === o)
651
+ return;
652
+ J();
653
+ const g = v.value?.sheets.find((D) => D.name === o);
654
+ if (g) {
655
+ h.value = oe(o, g.columnCount), f.reset(K.get(o)), L.value = "", me();
656
+ return;
657
+ }
658
+ if (!ee || ee.disposed) return;
659
+ ce();
660
+ const E = ++ne;
661
+ re = new AbortController(), F.value = !0, L.value = "";
662
+ try {
663
+ const D = await ee.importTemplate({ sheets: [o], signal: re.signal });
664
+ if (E !== ne || t.readonly) return;
665
+ v.value = D, h.value = oe(o, D.sheets[0].columnCount), f.reset(K.get(o)), me();
666
+ } catch (D) {
667
+ E === ne && (L.value = Re(D));
668
+ } finally {
669
+ E === ne && (F.value = !1, re = void 0);
670
+ }
671
+ }
672
+ function Oe(o) {
673
+ N.value || (h.value.dataset = o, h.value.rowKey = "", h.value.fields.fill(""), U.value = !1, X.value = !1);
674
+ }
675
+ function Ve(o, g) {
676
+ N.value || !W.value || o < W.value.top || o > W.value.bottom || ((!g || b.value === void 0) && (b.value = o), m.value = o);
677
+ }
678
+ function Je(o) {
679
+ if (N.value || !v.value || !Ce.value) {
680
+ N.value || (L.value = k.value.emptySelection);
681
+ return;
682
+ }
683
+ h.value.regions[o] = $t(
684
+ v.value,
685
+ h.value.sheet,
686
+ Ce.value.top,
687
+ Ce.value.bottom
688
+ ), U.value = !1, X.value = !1, L.value = "";
689
+ }
690
+ function Ue(o) {
691
+ N.value || (delete h.value.regions[o], U.value = !1, X.value = !1);
692
+ }
693
+ function je(o, g) {
694
+ !N.value && o >= 0 && o < h.value.fields.length && (h.value.fields[o] = g, U.value = !1, X.value = !1);
695
+ }
696
+ function Ge(o) {
697
+ N.value || (h.value.rowKey = o);
698
+ }
699
+ function Xe(o, g) {
700
+ !N.value && !(o === "id" && t.lockId) && (y.value[o] = g);
701
+ }
702
+ function Qe(o) {
703
+ for (const g of ["title", "header", "detail", "footer"]) {
704
+ const E = h.value.regions[g];
705
+ if (!E) continue;
706
+ const D = pe(E);
707
+ if (o >= D.top && o <= D.bottom) return g;
708
+ }
709
+ }
710
+ function Ye(o, g) {
711
+ W.value && (o === "row" ? V.value = Math.max(
712
+ W.value.top,
713
+ Math.min(W.value.bottom, V.value + g)
714
+ ) : te.value = Math.max(
715
+ W.value.left,
716
+ Math.min(W.value.right, te.value + g)
717
+ ));
718
+ }
719
+ function Ze() {
720
+ if (!t.readonly) {
721
+ if (t.session) {
722
+ De(t.session);
723
+ return;
724
+ }
725
+ B = void 0, i.value = !1, ce(), _(), v.value = void 0, O.value = [], x.value = "", z(), h.value = he(), y.value = { id: t.identity?.id ?? "excel-template", name: t.identity?.name ?? "Excel 业务模板" }, f.reset(), w.value = "table", me(), Z.value++, r.accept(), L.value = "";
726
+ }
727
+ }
728
+ function et() {
729
+ we.value && (U.value = !0, L.value = "");
730
+ }
731
+ async function tt() {
732
+ if (!(N.value || !v.value || i.value) && (U.value = !0, L.value = "", !!de.value.ok)) {
733
+ se.value = !0;
734
+ try {
735
+ const o = { ...y.value, ...t.lockId && t.identity ? { id: t.identity.id } : {} }, g = w.value === "regions" ? yt(v.value, f.recipe.value, t.datasets, o) : pt(v.value, h.value, t.datasets, o), E = w.value === "regions" ? wt(v.value, f.recipe.value, o) : kt(v.value, h.value, o), D = { ...g, session: E }, fe = r.snapshot();
736
+ if (t.accept && !await t.accept(D) || t.readonly || fe !== r.snapshot() && r.pending.value) return;
737
+ t.accept || C(D), z(), r.accept(), X.value = !0;
738
+ } catch (o) {
739
+ L.value = Re(o);
740
+ } finally {
741
+ se.value = !1;
742
+ }
743
+ }
744
+ }
745
+ return rt({ key: () => "excel", baseline: () => "declarations-only", pending: () => r.pending.value || i.value, snapshot: () => JSON.stringify(M()), restore(o, g, E) {
746
+ const D = JSON.parse(o);
747
+ if (!D.recipe || !D.regions || !Array.isArray(D.cached?.table) || !Array.isArray(D.cached?.regions)) throw new Error("Invalid Excel mapping draft");
748
+ ie(D), i.value = E?.pending !== !1, B = i.value ? D : void 0, i.value || r.accept();
749
+ } }), {
750
+ recoveredMapping: i,
751
+ imported: v,
752
+ mode: w,
753
+ regionBindings: f,
754
+ pendingLocalChanges: I(() => r.pending.value || i.value),
755
+ recipe: h,
756
+ identity: y,
757
+ sourceName: x,
758
+ sheetChoices: O,
759
+ error: L,
760
+ loading: F,
761
+ checked: U,
762
+ applied: X,
763
+ row: V,
764
+ column: te,
765
+ mappingPage: A,
766
+ m: k,
767
+ disabled: N,
768
+ canCheck: we,
769
+ sheet: ae,
770
+ sourceRange: W,
771
+ dataset: le,
772
+ window: Me,
773
+ validation: de,
774
+ focusTarget: ke,
775
+ issueEntries: s,
776
+ guidance: $,
777
+ locateIssue: Q,
778
+ mappings: $e,
779
+ rowKeys: xe,
780
+ selection: Ce,
781
+ cancel: ce,
782
+ importFile: He,
783
+ chooseSheet: qe,
784
+ chooseDataset: Oe,
785
+ chooseRow: Ve,
786
+ markRegion: Je,
787
+ clearRegion: Ue,
788
+ setMapping: je,
789
+ setRowKey: Ge,
790
+ setIdentity: Xe,
791
+ regionAt: Qe,
792
+ moveWindow: Ye,
793
+ check: et,
794
+ restoreDraft: Ze,
795
+ apply: tt
796
+ };
797
+ }
798
+ const Sn = ["aria-label", "aria-busy"], Kn = {
799
+ key: 0,
800
+ role: "status",
801
+ class: "mr-binding-recovery"
802
+ }, En = { class: "mr-binding-bar" }, Fn = { class: "mr-binding-heading" }, Dn = ["aria-label", "disabled"], Tn = ["disabled"], zn = {
803
+ key: 1,
804
+ class: "mr-binding-error",
805
+ role: "alert"
806
+ }, Bn = {
807
+ key: 2,
808
+ class: "mr-binding-placeholder",
809
+ role: "status"
810
+ }, Nn = {
811
+ key: 3,
812
+ class: "mr-binding-placeholder"
813
+ }, An = ["disabled"], Ln = { class: "mr-binding-sourcebar" }, Pn = ["value", "aria-label", "disabled"], _n = ["value"], Wn = ["aria-label"], Hn = ["aria-pressed", "disabled"], qn = ["aria-pressed", "disabled"], On = { class: "mr-binding-range" }, Vn = { class: "mr-binding-sample-note" }, Jn = { class: "mr-binding-layout" }, Un = { class: "mr-binding-source" }, jn = { class: "mr-binding-grid-heading" }, Gn = ["aria-label"], Xn = { class: "mr-binding-grid" }, Qn = ["data-region"], Yn = { scope: "row" }, Zn = ["data-source-row", "aria-label", "aria-pressed", "disabled", "onPointerdown", "onPointerenter", "onKeydown"], ea = ["rowspan", "colspan", "title", "data-source-cell", "tabindex", "aria-label", "aria-selected", "onPointerdown", "onPointerenter", "onKeydown"], ta = {
814
+ key: 1,
815
+ class: "mr-binding-grid-footer"
816
+ }, na = { class: "mr-binding-window" }, aa = ["aria-label", "disabled"], la = ["min", "max", "value", "aria-label"], oa = ["aria-label", "disabled"], ia = { class: "mr-binding-window" }, sa = ["aria-label", "disabled"], ra = ["min", "max", "value", "aria-label"], ua = ["aria-label", "disabled"], da = { class: "mr-binding-inspector" }, ca = ["disabled"], va = { class: "mr-binding-group" }, ga = ["data-role"], fa = { key: 0 }, ba = ["aria-label", "data-binding-control", "title", "disabled", "onClick"], ma = ["aria-label", "onClick"], ha = {
817
+ key: 0,
818
+ class: "mr-binding-note"
819
+ }, ya = { class: "mr-binding-group" }, pa = {
820
+ class: "mr-binding-label",
821
+ tabindex: "-1"
822
+ }, wa = ["value", "aria-label"], ka = { value: "" }, $a = ["value"], xa = {
823
+ key: 0,
824
+ class: "mr-binding-note"
825
+ }, Ca = {
826
+ key: 1,
827
+ class: "mr-binding-label",
828
+ tabindex: "-1"
829
+ }, Ra = ["value", "aria-label"], Ia = { value: "" }, Ma = ["value"], Sa = {
830
+ key: 2,
831
+ class: "mr-binding-mappings"
832
+ }, Ka = ["data-binding-control", "aria-label", "value", "onChange"], Ea = { value: "" }, Fa = ["value"], Da = { key: 0 }, Ta = {
833
+ key: 3,
834
+ class: "mr-binding-map-pages"
835
+ }, za = ["disabled", "aria-label"], Ba = ["disabled", "aria-label"], Na = ["disabled"], Aa = { class: "mr-binding-group" }, La = { class: "mr-binding-label" }, Pa = ["value", "readonly"], _a = { class: "mr-binding-label" }, Wa = ["value"], Ha = {
836
+ key: 0,
837
+ class: "mr-binding-issues",
838
+ open: ""
839
+ }, qa = ["aria-label", "onClick"], Oa = {
840
+ key: 0,
841
+ class: "mr-binding-issue-pages"
842
+ }, Va = ["disabled", "aria-label"], Ja = ["disabled", "aria-label"], Ua = {
843
+ key: 1,
844
+ class: "mr-binding-warnings"
845
+ }, ja = { class: "mr-binding-actions" }, Ga = ["title"], Xa = ["disabled"], Qa = ["disabled"], Ya = ["disabled", "title"], ll = /* @__PURE__ */ Ne({
846
+ __name: "ExcelBindingWizard",
847
+ props: {
848
+ datasets: {},
849
+ accept: { type: Function },
850
+ session: {},
851
+ identity: {},
852
+ lockId: { type: Boolean },
853
+ readonly: { type: Boolean },
854
+ importOptions: {},
855
+ messages: {}
856
+ },
857
+ emits: ["apply", "dirty"],
858
+ setup(t, { expose: C, emit: v }) {
859
+ const h = ut(), w = t, f = v, u = Mn(w, (p) => f("apply", p)), {
860
+ imported: K,
861
+ mode: R,
862
+ regionBindings: z,
863
+ recipe: J,
864
+ identity: Y,
865
+ sourceName: oe,
866
+ sheetChoices: y,
867
+ error: x,
868
+ loading: i,
869
+ checked: M,
870
+ row: B,
871
+ column: ie,
872
+ mappingPage: Z,
873
+ m: r,
874
+ disabled: O,
875
+ sheet: ee,
876
+ sourceRange: _,
877
+ dataset: L,
878
+ window: F,
879
+ validation: U,
880
+ mappings: X,
881
+ rowKeys: se,
882
+ selection: V
883
+ } = u;
884
+ ue([u.pendingLocalChanges, J, Y], () => f("dirty", u.pendingLocalChanges.value), { immediate: !0, deep: !0, flush: "sync" });
885
+ const te = S(), b = S(), m = S(0), A = I(() => Math.max(1, Math.ceil(u.issueEntries.value.length / 12))), k = I(() => u.issueEntries.value.slice(m.value * 12, (m.value + 1) * 12));
886
+ ue(A, (p) => {
887
+ m.value = Math.min(m.value, p - 1);
888
+ }), ue(u.focusTarget, async (p) => {
889
+ if (!p) return;
890
+ await Ae();
891
+ const s = ye(p.target);
892
+ if (s && b.value?.querySelector(`td[data-source-cell="${s.top}:${s.left}"]`)?.scrollIntoView?.({ block: "nearest", inline: "nearest" }), R.value === "regions") return;
893
+ const a = p.target.control === "field" ? `field-${p.target.fieldIndex}` : p.target.control === "contract" ? "dataset" : p.target.control, $ = b.value?.querySelector(`.mr-binding-table-editor [data-binding-control="${a}"]`), Q = O.value ? $?.closest("label") : $;
894
+ Q?.focus(), Q?.scrollIntoView?.({ block: "nearest" });
895
+ });
896
+ const N = S(!1), we = ["title", "header", "detail", "footer"], ae = I(() => ({
897
+ title: r.value.titleRegion,
898
+ header: r.value.headerRegion,
899
+ detail: r.value.detailRegion,
900
+ footer: r.value.footerRegion
901
+ })), W = I(
902
+ () => Math.max(1, Math.ceil(J.value.fields.length / 12))
903
+ );
904
+ function le(p) {
905
+ return p.target.value;
906
+ }
907
+ function Me(p) {
908
+ const s = p.target, a = s.files?.[0];
909
+ a && u.importFile(a), s.value = "";
910
+ }
911
+ function Se(p, s) {
912
+ p.button !== 0 || O.value || (p.preventDefault(), N.value = !0, u.chooseRow(s, p.shiftKey), R.value === "regions" && _.value && (z.select(s, _.value.left, !1), z.select(s, _.value.right, !0)), p.currentTarget.focus());
913
+ }
914
+ function Ke(p, s, a) {
915
+ R.value !== "regions" || p.button !== 0 || O.value || (p.preventDefault(), N.value = !0, z.select(s, a, p.shiftKey), p.currentTarget.focus());
916
+ }
917
+ function de(p, s, a) {
918
+ if (R.value !== "regions") return;
919
+ (p.key === " " || p.key === "Enter") && (p.preventDefault(), z.select(s, a, p.shiftKey));
920
+ const Q = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] }[p.key];
921
+ if (!Q || !_.value) return;
922
+ p.preventDefault();
923
+ const $e = Math.max(_.value.top, Math.min(_.value.bottom, s + Q[0])), xe = Math.max(_.value.left, Math.min(_.value.right, a + Q[1]));
924
+ p.shiftKey && z.select($e, xe, !0), p.currentTarget.closest("table")?.querySelector(`td[data-source-cell="${$e}:${xe}"]`)?.focus();
925
+ }
926
+ function be(p, s) {
927
+ if ((p.key === " " || p.key === "Enter") && (p.preventDefault(), u.chooseRow(s, p.shiftKey)), p.key === "ArrowDown" || p.key === "ArrowUp") {
928
+ p.preventDefault();
929
+ const a = s + (p.key === "ArrowDown" ? 1 : -1);
930
+ p.shiftKey && u.chooseRow(a, !0), p.currentTarget.closest("table")?.querySelector(`button[data-source-row="${a}"]`)?.focus();
931
+ }
932
+ }
933
+ function ke(p) {
934
+ const s = L.value?.fields.find((a) => a.field === p);
935
+ return s ? [
936
+ s.type,
937
+ s.unit,
938
+ s.digits === void 0 ? void 0 : `${s.digits}${r.value.precision}`,
939
+ s.sample === void 0 ? void 0 : `${r.value.sample}: ${String(s.sample)}`
940
+ ].filter((a) => a !== void 0 && a !== "").join(" · ") : "";
941
+ }
942
+ function ge(p, s) {
943
+ const a = Number(le(p));
944
+ !Number.isInteger(a) || !_.value || (s === "row" ? B.value = Math.max(
945
+ _.value.top,
946
+ Math.min(_.value.bottom, a)
947
+ ) : ie.value = Math.max(
948
+ _.value.left,
949
+ Math.min(_.value.right, a)
950
+ ));
951
+ }
952
+ return C({
953
+ get pendingLocalChanges() {
954
+ return u.pendingLocalChanges.value;
955
+ },
956
+ importFile: u.importFile,
957
+ apply: u.apply,
958
+ cancel: u.cancel
959
+ }), (p, s) => (d(), c("section", {
960
+ ref_key: "element",
961
+ ref: b,
962
+ class: "mr-binding",
963
+ style: ze(e(h)),
964
+ "aria-label": e(r).title,
965
+ "aria-busy": e(i),
966
+ onPointerup: s[23] || (s[23] = (a) => N.value = !1),
967
+ onPointercancel: s[24] || (s[24] = (a) => N.value = !1),
968
+ onPointerleave: s[25] || (s[25] = (a) => N.value = !1)
969
+ }, [
970
+ e(u).recoveredMapping.value ? (d(), c("p", Kn, l(e(r).recoveredMapping), 1)) : T("", !0),
971
+ n("header", En, [
972
+ n("div", Fn, [
973
+ H(q, {
974
+ name: "file",
975
+ size: 17
976
+ }),
977
+ n("strong", null, l(e(r).title), 1),
978
+ n("span", null, l(e(oe) || e(r).intro), 1)
979
+ ]),
980
+ n("input", {
981
+ ref_key: "input",
982
+ ref: te,
983
+ type: "file",
984
+ accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
985
+ "aria-label": e(r).upload,
986
+ class: "mr-binding-file",
987
+ disabled: t.readonly,
988
+ onChange: Me
989
+ }, null, 40, Dn),
990
+ e(i) ? (d(), c("button", {
991
+ key: 0,
992
+ type: "button",
993
+ onClick: s[0] || (s[0] = //@ts-ignore
994
+ (...a) => e(u).cancel && e(u).cancel(...a))
995
+ }, l(e(r).cancel), 1)) : (d(), c("button", {
996
+ key: 1,
997
+ type: "button",
998
+ disabled: t.readonly,
999
+ onClick: s[1] || (s[1] = (a) => te.value?.click())
1000
+ }, [
1001
+ H(q, {
1002
+ name: "upload",
1003
+ size: 14
1004
+ }),
1005
+ P(l(e(K) ? e(r).replace : e(r).upload), 1)
1006
+ ], 8, Tn))
1007
+ ]),
1008
+ e(x) ? (d(), c("div", zn, l(e(x)), 1)) : T("", !0),
1009
+ e(i) ? (d(), c("div", Bn, [
1010
+ s[26] || (s[26] = n("span", { class: "mr-binding-loader" }, null, -1)),
1011
+ P(l(e(r).loading), 1)
1012
+ ])) : e(K) ? (d(), c(j, { key: 4 }, [
1013
+ n("div", Ln, [
1014
+ n("label", null, [
1015
+ P(l(e(r).sheet), 1),
1016
+ n("select", {
1017
+ value: e(J).sheet,
1018
+ "aria-label": e(r).sheet,
1019
+ disabled: e(O),
1020
+ onChange: s[3] || (s[3] = (a) => e(u).chooseSheet(le(a)))
1021
+ }, [
1022
+ (d(!0), c(j, null, G(e(y), (a) => (d(), c("option", {
1023
+ key: a.name,
1024
+ value: a.name
1025
+ }, l(a.name), 9, _n))), 128))
1026
+ ], 40, Pn)
1027
+ ]),
1028
+ n("div", {
1029
+ class: "mr-binding-mode",
1030
+ role: "group",
1031
+ "aria-label": e(r).regionMode
1032
+ }, [
1033
+ n("button", {
1034
+ type: "button",
1035
+ "aria-pressed": e(R) === "table",
1036
+ disabled: e(O),
1037
+ onClick: s[4] || (s[4] = (a) => R.value = "table")
1038
+ }, l(e(r).tableMode), 9, Hn),
1039
+ n("button", {
1040
+ type: "button",
1041
+ "aria-pressed": e(R) === "regions",
1042
+ disabled: e(O),
1043
+ onClick: s[5] || (s[5] = (a) => R.value = "regions")
1044
+ }, [
1045
+ H(q, {
1046
+ name: "grid",
1047
+ size: 12
1048
+ }),
1049
+ P(l(e(r).multiRegions), 1)
1050
+ ], 8, qn)
1051
+ ], 8, Wn),
1052
+ n("span", On, l(e(ee)?.range) + " · " + l(e(ee)?.rowCount) + " × " + l(e(ee)?.columnCount), 1),
1053
+ n("span", Vn, l(e(r).sourceOnly), 1)
1054
+ ]),
1055
+ n("div", Jn, [
1056
+ n("div", Un, [
1057
+ n("div", jn, [
1058
+ n("strong", null, l(e(r).source), 1),
1059
+ n("span", null, l(e(R) === "regions" ? e(r).multiHint : e(r).sourceHint), 1)
1060
+ ]),
1061
+ e(F) ? (d(), c("div", {
1062
+ key: 0,
1063
+ class: "mr-binding-grid-scroll",
1064
+ "aria-label": e(r).source
1065
+ }, [
1066
+ n("table", Xn, [
1067
+ n("thead", null, [
1068
+ n("tr", null, [
1069
+ s[28] || (s[28] = n("th", {
1070
+ class: "mr-binding-corner",
1071
+ "aria-label": "#"
1072
+ }, "#", -1)),
1073
+ (d(!0), c(j, null, G(e(F).columns, (a) => (d(), c("th", {
1074
+ key: a.column,
1075
+ scope: "col"
1076
+ }, l(a.name), 1))), 128))
1077
+ ])
1078
+ ]),
1079
+ n("tbody", null, [
1080
+ (d(!0), c(j, null, G(e(F).rows, (a) => (d(), c("tr", {
1081
+ key: a.row,
1082
+ "data-region": e(u).regionAt(a.row),
1083
+ class: Ie({
1084
+ "is-selected": e(V) && a.row >= e(V).top && a.row <= e(V).bottom
1085
+ })
1086
+ }, [
1087
+ n("th", Yn, [
1088
+ n("button", {
1089
+ type: "button",
1090
+ "data-source-row": a.row,
1091
+ "aria-label": `${e(r).selectionLabel} ${a.row}`,
1092
+ "aria-pressed": !!e(V) && a.row >= e(V).top && a.row <= e(V).bottom,
1093
+ disabled: e(O),
1094
+ onPointerdown: ($) => Se($, a.row),
1095
+ onPointerenter: ($) => N.value && e(u).chooseRow(a.row, !0),
1096
+ onKeydown: ($) => be($, a.row)
1097
+ }, l(a.row), 41, Zn)
1098
+ ]),
1099
+ (d(!0), c(j, null, G(a.cells, ($) => (d(), c("td", {
1100
+ key: $.column,
1101
+ rowspan: $.rowSpan,
1102
+ colspan: $.colSpan,
1103
+ title: `${$.address} · ${$.text}`,
1104
+ "data-source-cell": `${$.row}:${$.column}`,
1105
+ tabindex: e(R) === "regions" ? 0 : void 0,
1106
+ "aria-label": e(R) === "regions" ? `${e(r).selectionCellLabel} ${$.address}` : void 0,
1107
+ "aria-selected": e(R) === "regions" ? e(z).selected($.row, $.column) : void 0,
1108
+ class: Ie({ "is-continued": $.continued, "is-cell-selected": e(R) === "regions" && e(z).selected($.row, $.column) }),
1109
+ onPointerdown: (Q) => Ke(Q, $.row, $.column),
1110
+ onPointerenter: (Q) => e(R) === "regions" && N.value && e(z).select($.row, $.column, !0),
1111
+ onKeydown: (Q) => de(Q, $.row, $.column),
1112
+ style: ze({
1113
+ textAlign: $.style?.align,
1114
+ fontWeight: $.style?.bold ? "600" : void 0
1115
+ })
1116
+ }, [
1117
+ n("span", null, l($.text), 1)
1118
+ ], 46, ea))), 128))
1119
+ ], 10, Qn))), 128))
1120
+ ])
1121
+ ])
1122
+ ], 8, Gn)) : T("", !0),
1123
+ e(F) ? (d(), c("footer", ta, [
1124
+ n("span", null, [
1125
+ P(l(e(r).selected) + " ", 1),
1126
+ n("strong", null, l(e(R) === "regions" ? e(z).selection.value || "—" : e(V) ? `${e(V).top}–${e(V).bottom}` : "—"), 1)
1127
+ ]),
1128
+ n("div", na, [
1129
+ n("button", {
1130
+ type: "button",
1131
+ "aria-label": e(r).previousRows,
1132
+ disabled: e(F).top <= e(F).source.top,
1133
+ onClick: s[6] || (s[6] = (a) => e(u).moveWindow("row", -24))
1134
+ }, [
1135
+ H(q, {
1136
+ name: "chevron-left",
1137
+ size: 13
1138
+ })
1139
+ ], 8, aa),
1140
+ n("label", null, [
1141
+ P(l(e(r).rowStart), 1),
1142
+ n("input", {
1143
+ type: "number",
1144
+ min: e(F).source.top,
1145
+ max: e(F).source.bottom,
1146
+ value: e(B),
1147
+ "aria-label": e(r).rowStart,
1148
+ onChange: s[7] || (s[7] = (a) => ge(a, "row"))
1149
+ }, null, 40, la)
1150
+ ]),
1151
+ n("button", {
1152
+ type: "button",
1153
+ "aria-label": e(r).nextRows,
1154
+ disabled: e(F).bottom >= e(F).source.bottom,
1155
+ onClick: s[8] || (s[8] = (a) => e(u).moveWindow("row", 24))
1156
+ }, [
1157
+ H(q, {
1158
+ name: "chevron-right",
1159
+ size: 13
1160
+ })
1161
+ ], 8, oa)
1162
+ ]),
1163
+ n("div", ia, [
1164
+ n("button", {
1165
+ type: "button",
1166
+ "aria-label": e(r).previousColumns,
1167
+ disabled: e(F).left <= e(F).source.left,
1168
+ onClick: s[9] || (s[9] = (a) => e(u).moveWindow("column", -12))
1169
+ }, [
1170
+ H(q, {
1171
+ name: "chevron-left",
1172
+ size: 13
1173
+ })
1174
+ ], 8, sa),
1175
+ n("label", null, [
1176
+ P(l(e(r).columnStart), 1),
1177
+ n("input", {
1178
+ type: "number",
1179
+ min: e(F).source.left,
1180
+ max: e(F).source.right,
1181
+ value: e(ie),
1182
+ "aria-label": e(r).columnStart,
1183
+ onChange: s[10] || (s[10] = (a) => ge(a, "column"))
1184
+ }, null, 40, ra)
1185
+ ]),
1186
+ n("button", {
1187
+ type: "button",
1188
+ "aria-label": e(r).nextColumns,
1189
+ disabled: e(F).right >= e(F).source.right,
1190
+ onClick: s[11] || (s[11] = (a) => e(u).moveWindow("column", 12))
1191
+ }, [
1192
+ H(q, {
1193
+ name: "chevron-right",
1194
+ size: 13
1195
+ })
1196
+ ], 8, ua)
1197
+ ])
1198
+ ])) : T("", !0)
1199
+ ]),
1200
+ n("div", da, [
1201
+ e(R) === "regions" ? (d(), ot(Rn, {
1202
+ key: 0,
1203
+ controller: e(z),
1204
+ datasets: t.datasets,
1205
+ disabled: e(O),
1206
+ messages: e(r)
1207
+ }, null, 8, ["controller", "datasets", "disabled", "messages"])) : T("", !0),
1208
+ Le(n("fieldset", {
1209
+ disabled: e(O),
1210
+ class: "mr-binding-table-editor"
1211
+ }, [
1212
+ n("section", va, [
1213
+ n("h3", null, [
1214
+ s[29] || (s[29] = n("b", null, "1", -1)),
1215
+ P(l(e(r).regionLegend), 1)
1216
+ ]),
1217
+ (d(), c(j, null, G(we, (a) => n("div", {
1218
+ key: a,
1219
+ class: "mr-binding-region",
1220
+ "data-role": a
1221
+ }, [
1222
+ n("div", null, [
1223
+ n("strong", null, [
1224
+ P(l(ae.value[a]), 1),
1225
+ a === "title" || a === "footer" ? (d(), c("small", fa, l(e(r).optional), 1)) : T("", !0)
1226
+ ]),
1227
+ n("code", null, l(e(J).regions[a] || e(r).unnamed), 1)
1228
+ ]),
1229
+ n("button", {
1230
+ type: "button",
1231
+ "aria-label": `${e(r).selectRegion} · ${ae.value[a]}`,
1232
+ "data-binding-control": a,
1233
+ title: e(V) ? `${e(r).selectRegion} · ${ae.value[a]}` : e(r).emptySelection,
1234
+ disabled: !e(V),
1235
+ onClick: ($) => e(u).markRegion(a)
1236
+ }, [
1237
+ H(q, {
1238
+ name: "arrow-right",
1239
+ size: 13
1240
+ })
1241
+ ], 8, ba),
1242
+ (a === "title" || a === "footer") && e(J).regions[a] ? (d(), c("button", {
1243
+ key: 0,
1244
+ type: "button",
1245
+ "aria-label": `${e(r).clear} · ${ae.value[a]}`,
1246
+ onClick: ($) => e(u).clearRegion(a)
1247
+ }, [
1248
+ H(q, {
1249
+ name: "close",
1250
+ size: 13
1251
+ })
1252
+ ], 8, ma)) : T("", !0)
1253
+ ], 8, ga)), 64)),
1254
+ e(J).regions.footer ? (d(), c("p", ha, l(e(r).footerHint), 1)) : T("", !0)
1255
+ ]),
1256
+ n("section", ya, [
1257
+ n("h3", null, [
1258
+ s[30] || (s[30] = n("b", null, "2", -1)),
1259
+ P(l(e(r).mapping), 1),
1260
+ n("span", null, l(e(U).mapped) + "/" + l(e(U).total), 1)
1261
+ ]),
1262
+ n("label", pa, [
1263
+ P(l(e(r).dataset), 1),
1264
+ n("select", {
1265
+ "data-binding-control": "dataset",
1266
+ value: e(J).dataset,
1267
+ "aria-label": e(r).dataset,
1268
+ onChange: s[12] || (s[12] = (a) => e(u).chooseDataset(le(a)))
1269
+ }, [
1270
+ n("option", ka, l(e(r).chooseDataset), 1),
1271
+ (d(!0), c(j, null, G(t.datasets, (a) => (d(), c("option", {
1272
+ key: a.id,
1273
+ value: a.id
1274
+ }, l(a.label || a.id), 9, $a))), 128))
1275
+ ], 40, wa)
1276
+ ]),
1277
+ t.datasets.length ? T("", !0) : (d(), c("p", xa, l(e(r).noContract), 1)),
1278
+ e(L) ? (d(), c("label", Ca, [
1279
+ P(l(e(r).rowKey), 1),
1280
+ n("select", {
1281
+ "data-binding-control": "rowKey",
1282
+ value: e(J).rowKey,
1283
+ "aria-label": e(r).rowKey,
1284
+ onChange: s[13] || (s[13] = (a) => e(u).setRowKey(le(a)))
1285
+ }, [
1286
+ n("option", Ia, l(e(r).chooseRowKey), 1),
1287
+ (d(!0), c(j, null, G(e(se), (a) => (d(), c("option", {
1288
+ key: a.field,
1289
+ value: a.field
1290
+ }, l(a.label || a.field) + " · " + l(a.field), 9, Ma))), 128))
1291
+ ], 40, Ra)
1292
+ ])) : T("", !0),
1293
+ e(L) ? (d(), c("div", Sa, [
1294
+ (d(!0), c(j, null, G(e(X), (a) => (d(), c("label", {
1295
+ key: a.index,
1296
+ class: "mr-binding-map",
1297
+ tabindex: "-1"
1298
+ }, [
1299
+ n("span", null, l(a.physical), 1),
1300
+ n("div", null, [
1301
+ n("select", {
1302
+ "data-binding-control": `field-${a.index}`,
1303
+ "aria-label": `${e(r).physical} ${a.physical} · ${e(r).business}`,
1304
+ value: a.field,
1305
+ onChange: ($) => e(u).setMapping(a.index, le($))
1306
+ }, [
1307
+ n("option", Ea, l(e(r).chooseField), 1),
1308
+ (d(!0), c(j, null, G(e(L).fields, ($) => (d(), c("option", {
1309
+ key: $.field,
1310
+ value: $.field
1311
+ }, l($.label || $.field) + " · " + l($.field), 9, Fa))), 128))
1312
+ ], 40, Ka),
1313
+ a.field ? (d(), c("small", Da, l(ke(a.field)), 1)) : T("", !0)
1314
+ ])
1315
+ ]))), 128))
1316
+ ])) : T("", !0),
1317
+ e(L) && W.value > 1 ? (d(), c("div", Ta, [
1318
+ n("button", {
1319
+ type: "button",
1320
+ disabled: e(Z) <= 0,
1321
+ "aria-label": e(r).previousColumns,
1322
+ onClick: s[14] || (s[14] = (a) => Z.value--)
1323
+ }, [
1324
+ H(q, {
1325
+ name: "chevron-left",
1326
+ size: 13
1327
+ })
1328
+ ], 8, za),
1329
+ n("span", null, l(e(Z) + 1) + " / " + l(W.value), 1),
1330
+ n("button", {
1331
+ type: "button",
1332
+ disabled: e(Z) + 1 >= W.value,
1333
+ "aria-label": e(r).nextColumns,
1334
+ onClick: s[15] || (s[15] = (a) => Z.value++)
1335
+ }, [
1336
+ H(q, {
1337
+ name: "chevron-right",
1338
+ size: 13
1339
+ })
1340
+ ], 8, Ba)
1341
+ ])) : T("", !0)
1342
+ ])
1343
+ ], 8, ca), [
1344
+ [it, e(R) === "table"]
1345
+ ]),
1346
+ n("fieldset", { disabled: e(O) }, [
1347
+ n("section", Aa, [
1348
+ n("h3", null, l(e(r).identity), 1),
1349
+ n("label", La, [
1350
+ P(l(e(r).templateId), 1),
1351
+ n("input", {
1352
+ value: t.lockId ? w.identity?.id ?? e(Y).id : e(Y).id,
1353
+ autocomplete: "off",
1354
+ readonly: t.lockId,
1355
+ onInput: s[16] || (s[16] = (a) => e(u).setIdentity("id", le(a)))
1356
+ }, null, 40, Pa)
1357
+ ]),
1358
+ n("label", _a, [
1359
+ P(l(e(r).templateName), 1),
1360
+ n("input", {
1361
+ value: e(Y).name,
1362
+ autocomplete: "off",
1363
+ onInput: s[17] || (s[17] = (a) => e(u).setIdentity("name", le(a)))
1364
+ }, null, 40, Wa)
1365
+ ])
1366
+ ])
1367
+ ], 8, Na)
1368
+ ])
1369
+ ]),
1370
+ e(M) && e(U).issues.length ? (d(), c("details", Ha, [
1371
+ n("summary", null, l(e(r).issues) + " · " + l(e(U).issues.length) + " " + l(e(r).errors), 1),
1372
+ n("ul", null, [
1373
+ (d(!0), c(j, null, G(k.value, (a) => (d(), c("li", {
1374
+ key: `${a.issue.path}:${a.issue.message}`
1375
+ }, [
1376
+ n("button", {
1377
+ type: "button",
1378
+ class: "mr-binding-issue-link",
1379
+ "aria-label": `${e(r).locateIssue} · ${a.label}`,
1380
+ onClick: ($) => e(u).locateIssue(a.issue)
1381
+ }, [
1382
+ n("strong", null, l(a.label), 1),
1383
+ n("span", null, l(a.message), 1),
1384
+ H(q, {
1385
+ name: "arrow-right",
1386
+ size: 12
1387
+ })
1388
+ ], 8, qa)
1389
+ ]))), 128))
1390
+ ]),
1391
+ A.value > 1 ? (d(), c("div", Oa, [
1392
+ n("button", {
1393
+ type: "button",
1394
+ disabled: m.value === 0,
1395
+ "aria-label": e(r).previousIssues,
1396
+ onClick: s[18] || (s[18] = (a) => m.value--)
1397
+ }, [
1398
+ H(q, {
1399
+ name: "chevron-left",
1400
+ size: 12
1401
+ })
1402
+ ], 8, Va),
1403
+ n("span", null, l(m.value + 1) + "/" + l(A.value), 1),
1404
+ n("button", {
1405
+ type: "button",
1406
+ disabled: m.value + 1 >= A.value,
1407
+ "aria-label": e(r).nextIssues,
1408
+ onClick: s[19] || (s[19] = (a) => m.value++)
1409
+ }, [
1410
+ H(q, {
1411
+ name: "chevron-right",
1412
+ size: 12
1413
+ })
1414
+ ], 8, Ja)
1415
+ ])) : T("", !0)
1416
+ ])) : T("", !0),
1417
+ e(K).warnings.length ? (d(), c("details", Ua, [
1418
+ n("summary", null, l(e(r).inspectWarning) + " · " + l(e(K).warnings.length), 1),
1419
+ n("ul", null, [
1420
+ (d(!0), c(j, null, G(e(K).warnings, (a, $) => (d(), c("li", { key: $ }, l(a), 1))), 128))
1421
+ ])
1422
+ ])) : T("", !0),
1423
+ n("footer", ja, [
1424
+ n("span", {
1425
+ class: Ie({ "is-ready": e(U).ok }),
1426
+ role: "status",
1427
+ title: e(u).guidance.value
1428
+ }, l(e(u).guidance.value), 11, Ga),
1429
+ e(u).pendingLocalChanges.value ? (d(), c("button", {
1430
+ key: 0,
1431
+ type: "button",
1432
+ disabled: e(O),
1433
+ onClick: s[20] || (s[20] = //@ts-ignore
1434
+ (...a) => e(u).restoreDraft && e(u).restoreDraft(...a))
1435
+ }, l(e(r).restoreDraft), 9, Xa)) : T("", !0),
1436
+ n("button", {
1437
+ type: "button",
1438
+ disabled: !e(u).canCheck.value,
1439
+ onClick: s[21] || (s[21] = //@ts-ignore
1440
+ (...a) => e(u).check && e(u).check(...a))
1441
+ }, l(e(r).check), 9, Qa),
1442
+ n("button", {
1443
+ type: "button",
1444
+ class: "mr-binding-primary",
1445
+ disabled: e(O) || !e(U).ok,
1446
+ title: e(u).guidance.value,
1447
+ onClick: s[22] || (s[22] = //@ts-ignore
1448
+ (...a) => e(u).apply && e(u).apply(...a))
1449
+ }, l(e(r).apply), 9, Ya)
1450
+ ])
1451
+ ], 64)) : (d(), c("div", Nn, [
1452
+ s[27] || (s[27] = n("svg", {
1453
+ viewBox: "0 0 80 80",
1454
+ fill: "none",
1455
+ "aria-hidden": "true"
1456
+ }, [
1457
+ n("rect", {
1458
+ x: "15",
1459
+ y: "10",
1460
+ width: "50",
1461
+ height: "60",
1462
+ rx: "8",
1463
+ fill: "#eff6ff",
1464
+ stroke: "#bfdbfe"
1465
+ }),
1466
+ n("path", {
1467
+ d: "M25 25h30M25 35h30M25 45h30M35 25v30M45 25v30M25 55h30",
1468
+ stroke: "#93c5fd",
1469
+ "stroke-width": "1.5"
1470
+ })
1471
+ ], -1)),
1472
+ n("strong", null, l(e(r).noSource), 1),
1473
+ n("span", null, l(e(r).sourceOnly), 1),
1474
+ n("button", {
1475
+ type: "button",
1476
+ class: "mr-binding-primary",
1477
+ disabled: t.readonly,
1478
+ onClick: s[2] || (s[2] = (a) => te.value?.click())
1479
+ }, l(e(r).upload), 9, An)
1480
+ ]))
1481
+ ], 44, Sn));
1482
+ }
1483
+ });
1484
+ export {
1485
+ ll as default
1486
+ };