@opennsw/jsonforms-renderers 0.13.0 → 0.14.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.
@@ -1,50 +1,128 @@
1
- var yr = Object.defineProperty;
2
- var br = (e, r, t) => r in e ? yr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var vt = (e, r, t) => br(e, typeof r != "symbol" ? r + "" : r, t);
4
- import { jsx as l, jsxs as g, Fragment as xe } from "react/jsx-runtime";
5
- import { useContext as Pt, createContext as _t, useMemo as Ve, useEffect as we, useState as B, useRef as ge, useCallback as We } from "react";
6
- import { rankWith as ie, isStringControl as vr, or as ot, isNumberControl as wr, isIntegerControl as Er, isBooleanControl as Tr, isEnumControl as jt, isOneOfControl as Vt, schemaMatches as ze, Resolve as He, isDateControl as xr, isDateTimeControl as Ar, isTimeControl as Rr, uiTypeIs as Ye, and as Wt, not as Cr, optionIs as Sr, update as Or, createDefaultValue as Nr, isObjectArrayControl as Dr, isPrimitiveArrayControl as Ir } from "@jsonforms/core";
7
- import { useJsonForms as $e, withJsonFormsControlProps as be, JsonFormsDispatch as Ge, withJsonFormsArrayControlProps as kr, withJsonFormsLayoutProps as Ze } from "@jsonforms/react";
8
- import { Box as M, Flex as $, Text as p, TextField as Ie, Checkbox as Lr, RadioGroup as wt, ScrollArea as Ht, Select as Qe, Spinner as Be, Button as Ue, Tabs as et, Heading as Bt, Card as Xt, Tooltip as Ke, IconButton as Xe, Table as De } from "@radix-ui/themes";
9
- import { ChevronDownIcon as qt, FileTextIcon as Mr, DownloadIcon as dt, CheckCircledIcon as zr, Cross2Icon as ft, ExclamationTriangleIcon as pt, UploadIcon as je, TrashIcon as Fr, PlusIcon as $r } from "@radix-ui/react-icons";
10
- import Kt from "dayjs";
11
- const Yt = _t(null);
12
- function Pi({
1
+ var Qr = Object.defineProperty;
2
+ var en = (e, r, t) => r in e ? Qr(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var Vt = (e, r, t) => en(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { jsx as s, jsxs as p, Fragment as Ae } from "react/jsx-runtime";
5
+ import { useContext as At, createContext as St, useMemo as Se, useEffect as ye, useState as Y, useRef as he, useCallback as Be, useEffectEvent as ur } from "react";
6
+ import { defaultTranslator as nt, getControlPath as tn, isVisible as dr, composePaths as rn, toDataPath as fr, Resolve as Xe, createLabelDescriptionFrom as nn, getI18nKey as on, rankWith as ue, isStringControl as sn, or as pt, isNumberControl as ln, isIntegerControl as an, isBooleanControl as cn, isEnumControl as pr, isOneOfControl as hr, schemaMatches as _e, isDateControl as un, isDateTimeControl as dn, isTimeControl as fn, deriveLabelForUISchemaElement as pn, getI18nKeyPrefixBySchema as hn, uiTypeIs as ot, and as mr, not as mn, optionIs as gn, update as yn, createDefaultValue as bn, isObjectArrayControl as vn, isPrimitiveArrayControl as wn } from "@jsonforms/core";
7
+ import { useJsonForms as Ne, withJsonFormsControlProps as Ee, JsonFormsDispatch as Qe, withJsonFormsArrayControlProps as En, withJsonFormsLayoutProps as st } from "@jsonforms/react";
8
+ import { Box as N, Flex as L, Text as h, TextField as Fe, Checkbox as xn, RadioGroup as Wt, ScrollArea as gr, Select as lt, Spinner as Je, Button as Re, Heading as tt, Progress as Tn, Callout as gt, Tabs as at, Card as yr, Tooltip as rt, IconButton as Ze, Table as Me } from "@radix-ui/themes";
9
+ import { ChevronDownIcon as br, ChevronLeftIcon as An, ChevronRightIcon as Sn, CheckIcon as Rn, ExclamationTriangleIcon as ht, FileTextIcon as Cn, DownloadIcon as Rt, CheckCircledIcon as On, Cross2Icon as Ct, UploadIcon as Ge, TrashIcon as kn, PlusIcon as In } from "@radix-ui/react-icons";
10
+ import vr from "dayjs";
11
+ const wr = St(null);
12
+ function qs({
13
13
  children: e,
14
14
  onUpload: r,
15
15
  getDownloadUrl: t
16
16
  }) {
17
17
  const n = { onUpload: r, getDownloadUrl: t };
18
- return /* @__PURE__ */ l(Yt.Provider, { value: n, children: e });
18
+ return /* @__PURE__ */ s(wr.Provider, { value: n, children: e });
19
19
  }
20
- function Ur() {
21
- return Pt(Yt);
20
+ function Dn() {
21
+ return At(wr);
22
22
  }
23
- const Gt = _t(null);
24
- function _i({
23
+ const Er = St(null);
24
+ function Ks({
25
25
  children: e,
26
26
  services: r
27
27
  }) {
28
- const t = Ve(() => r, [r]);
29
- return /* @__PURE__ */ l(Gt.Provider, { value: t, children: e });
28
+ const t = Se(() => r, [r]);
29
+ return /* @__PURE__ */ s(Er.Provider, { value: t, children: e });
30
30
  }
31
- function Pr(e) {
32
- const r = Pt(Gt);
31
+ function Nn(e) {
32
+ const r = At(Er);
33
33
  return !r || !e ? null : r[e] ?? null;
34
34
  }
35
- const Oe = (e, r, t, n = void 0) => {
36
- we(() => {
35
+ const xr = St(null);
36
+ function Tr() {
37
+ return At(xr);
38
+ }
39
+ function Ys({ children: e, ...r }) {
40
+ return /* @__PURE__ */ s(xr.Provider, { value: r, children: e });
41
+ }
42
+ function Ln(e) {
43
+ var t;
44
+ if (!e || typeof e != "object") return !1;
45
+ const r = e;
46
+ return r.type === "Categorization" && ((t = r.options) == null ? void 0 : t.variant) === "stepper";
47
+ }
48
+ function zn(e) {
49
+ return e.elements.filter((r) => r.type === "Category");
50
+ }
51
+ function ut(e, r, t, n, i = "") {
52
+ if (t && e.rule && !dr(e, r, i, t, n)) return [];
53
+ if (e.type === "Control") return [e];
54
+ const o = e.elements;
55
+ return Array.isArray(o) ? o.flatMap((l) => ut(l, r, t, n, i)) : [];
56
+ }
57
+ function Ot(e, r = "") {
58
+ return rn(r, fr(e.scope));
59
+ }
60
+ function Mn(e, r) {
61
+ return e === r || e.startsWith(`${r}.`);
62
+ }
63
+ function Fn(e, r, t = fr(e.scope), n = nt) {
64
+ const i = Xe.schema(r, e.scope, r), o = nn(e, i).text;
65
+ return n(on(i, e, t, "label"), o);
66
+ }
67
+ function $n(e, r, t, n = "", i = nt) {
68
+ const o = r.map((l) => tn(l));
69
+ return e.map((l) => ({ control: l, path: Ot(l, n) })).filter(({ path: l }) => o.some((a) => Mn(a, l))).map(({ control: l, path: a }) => ({ path: a, label: Fn(l, t, a, i) }));
70
+ }
71
+ function Pn(e, r, t = "") {
72
+ const n = e.map((i) => Ar(r, Ot(i, t))).find((i) => Array.isArray(i) && i.length > 0);
73
+ return n ? { kind: "items", count: n.length } : { kind: "fields", count: e.length };
74
+ }
75
+ function Un(e, r, t = "") {
76
+ return e.some((n) => {
77
+ const i = Ar(r, Ot(n, t));
78
+ return i != null && i !== "" && !(Array.isArray(i) && i.length === 0);
79
+ });
80
+ }
81
+ function Ar(e, r) {
82
+ return r.split(".").reduce((t, n) => {
83
+ if (!(t == null || typeof t != "object"))
84
+ return t[n];
85
+ }, e);
86
+ }
87
+ const jn = {
88
+ back: "Back",
89
+ continue: "Continue",
90
+ stepOf: "Step {step} of {total}",
91
+ review: "Review and Submit",
92
+ navLabel: "Form steps",
93
+ progressLabel: "Progress through the form",
94
+ noteDone: "Done",
95
+ noteToFix: "{count} to fix",
96
+ noteItem: "{count} item added",
97
+ noteItems: "{count} items added",
98
+ noteField: "{count} field",
99
+ noteFields: "{count} fields",
100
+ noteReview: "Check and submit",
101
+ missingFields: "Complete these fields to continue:",
102
+ incompleteSteps: "Some steps are not complete yet:",
103
+ reviewHint: "Check your answers below, then submit.",
104
+ edit: "Edit",
105
+ editStep: "Edit {step}"
106
+ };
107
+ function _n(e, r, t) {
108
+ return (e ?? nt)(`stepper.${r}`, jn[r], t).replace(
109
+ /\{(\w+)\}/g,
110
+ (i, o) => t && o in t ? String(t[o]) : i
111
+ );
112
+ }
113
+ const Le = (e, r, t, n = void 0) => {
114
+ ye(() => {
37
115
  e === !1 && t(r, n);
38
116
  }, [e, r, t, n]);
39
- }, Et = /* @__PURE__ */ new WeakMap();
40
- function _r(e) {
117
+ }, Ht = /* @__PURE__ */ new WeakMap();
118
+ function Vn(e) {
41
119
  if (!e || typeof e != "object") return !1;
42
- const r = Et.get(e);
120
+ const r = Ht.get(e);
43
121
  if (r !== void 0) return r;
44
- const t = _e(e, e, /* @__PURE__ */ new Set());
45
- return Et.set(e, t), t;
122
+ const t = Ye(e, e, /* @__PURE__ */ new Set());
123
+ return Ht.set(e, t), t;
46
124
  }
47
- function jr(e, r) {
125
+ function Wn(e, r) {
48
126
  if (!r.startsWith("#/")) return;
49
127
  const t = r.slice(2).split("/");
50
128
  let n = e;
@@ -54,7 +132,7 @@ function jr(e, r) {
54
132
  }
55
133
  return n && typeof n == "object" ? n : void 0;
56
134
  }
57
- function _e(e, r, t) {
135
+ function Ye(e, r, t) {
58
136
  if (!e || typeof e != "object" || t.has(e)) return !1;
59
137
  t.add(e);
60
138
  const n = e;
@@ -62,41 +140,41 @@ function _e(e, r, t) {
62
140
  for (const i of ["allOf", "anyOf", "oneOf"]) {
63
141
  const o = n[i];
64
142
  if (Array.isArray(o))
65
- for (const s of o) {
66
- if (!s || typeof s != "object") continue;
67
- const a = s;
68
- if (Array.isArray(a.required) && a.required.length > 0 || _e(a, r, t)) return !0;
143
+ for (const l of o) {
144
+ if (!l || typeof l != "object") continue;
145
+ const a = l;
146
+ if (Array.isArray(a.required) && a.required.length > 0 || Ye(a, r, t)) return !0;
69
147
  }
70
148
  }
71
149
  if (typeof n.$ref == "string") {
72
- const i = jr(r, n.$ref);
73
- if (i && _e(i, r, t)) return !0;
150
+ const i = Wn(r, n.$ref);
151
+ if (i && Ye(i, r, t)) return !0;
74
152
  }
75
153
  for (const i of ["then", "else", "not", "contains", "additionalProperties", "items"]) {
76
154
  const o = n[i];
77
- if (o && typeof o == "object" && !Array.isArray(o) && _e(o, r, t))
155
+ if (o && typeof o == "object" && !Array.isArray(o) && Ye(o, r, t))
78
156
  return !0;
79
157
  }
80
158
  if (Array.isArray(n.items)) {
81
159
  for (const i of n.items)
82
- if (_e(i, r, t)) return !0;
160
+ if (Ye(i, r, t)) return !0;
83
161
  }
84
162
  for (const i of ["properties", "patternProperties", "$defs", "definitions"]) {
85
163
  const o = n[i];
86
164
  if (!(!o || typeof o != "object")) {
87
- for (const s of Object.values(o))
88
- if (_e(s, r, t)) return !0;
165
+ for (const l of Object.values(o))
166
+ if (Ye(l, r, t)) return !0;
89
167
  }
90
168
  }
91
169
  return !1;
92
170
  }
93
- function Vr(e, r) {
171
+ function Hn(e, r) {
94
172
  const t = structuredClone(e ?? {});
95
173
  if (!r) return t;
96
174
  const n = r.split(".");
97
175
  let i = t;
98
- for (let s = 0; s < n.length - 1; s++) {
99
- const a = n[s];
176
+ for (let l = 0; l < n.length - 1; l++) {
177
+ const a = n[l];
100
178
  if (i == null || typeof i != "object") return t;
101
179
  const c = i[a];
102
180
  if (c == null || typeof c != "object") return t;
@@ -105,32 +183,32 @@ function Vr(e, r) {
105
183
  const o = n[n.length - 1];
106
184
  return i != null && typeof i == "object" && delete i[o], t;
107
185
  }
108
- function Wr(e) {
186
+ function Bn(e) {
109
187
  const r = e.lastIndexOf(".");
110
188
  return r === -1 ? "" : "/" + e.slice(0, r).split(".").join("/");
111
189
  }
112
- function Hr(e) {
190
+ function Xn(e) {
113
191
  if (!e) return "";
114
192
  const r = e.lastIndexOf(".");
115
193
  return r === -1 ? e : e.slice(r + 1);
116
194
  }
117
- function Br(e, r) {
195
+ function qn(e, r) {
118
196
  var t;
119
- return e.keyword !== "required" && e.keyword !== "dependencies" || ((t = e.params) == null ? void 0 : t.missingProperty) !== Hr(r) ? !1 : (e.instancePath ?? "") === Wr(r);
197
+ return e.keyword !== "required" && e.keyword !== "dependencies" || ((t = e.params) == null ? void 0 : t.missingProperty) !== Xn(r) ? !1 : (e.instancePath ?? "") === Bn(r);
120
198
  }
121
- function Xr(e, r, t) {
199
+ function Kn(e, r, t) {
122
200
  if (!e || !t) return !1;
123
- const n = Vr(r, e);
201
+ const n = Hn(r, e);
124
202
  t(n);
125
203
  const i = t.errors;
126
- return i != null && i.length ? i.some((o) => Br(o, e)) : !1;
204
+ return i != null && i.length ? i.some((o) => qn(o, e)) : !1;
127
205
  }
128
- function Ae(e, r = !1, t = !0) {
206
+ function Ce(e, r = !1, t = !0) {
129
207
  var a, c, u;
130
- const n = $e(), i = (a = n.core) == null ? void 0 : a.data, o = (c = n.core) == null ? void 0 : c.validator, s = (u = n.core) == null ? void 0 : u.schema;
131
- return Ve(() => t ? r ? !0 : _r(s) ? Xr(e, i, o) : !1 : !1, [t, r, e, i, o, s]);
208
+ const n = Ne(), i = (a = n.core) == null ? void 0 : a.data, o = (c = n.core) == null ? void 0 : c.validator, l = (u = n.core) == null ? void 0 : u.schema;
209
+ return Se(() => t ? r ? !0 : Vn(l) ? Kn(e, i, o) : !1 : !1, [t, r, e, i, o, l]);
132
210
  }
133
- const Re = (e, r) => {
211
+ const Oe = (e, r) => {
134
212
  if (!e) return "";
135
213
  const t = r || "This field";
136
214
  return e.split(`
@@ -139,175 +217,175 @@ const Re = (e, r) => {
139
217
  return i === "is a required property" ? `${t} is required` : i.startsWith("must be > ") ? `${t} must be greater than ${i.slice(10)}` : i.startsWith("must be >= ") ? `${t} must be at least ${i.slice(11)}` : i.startsWith("must be multiple of ") ? `${t} must be a multiple of ${i.slice(20)}` : n;
140
218
  }).join(`
141
219
  `);
142
- }, qr = ({
220
+ }, Yn = ({
143
221
  data: e,
144
222
  handleChange: r,
145
223
  path: t,
146
224
  label: n,
147
225
  required: i,
148
226
  errors: o,
149
- uischema: s,
227
+ uischema: l,
150
228
  schema: a,
151
229
  enabled: c,
152
230
  visible: u = !0
153
231
  }) => {
154
- var m;
155
- Oe(u, t, r);
156
- const d = Ae(t, i, u);
232
+ var f;
233
+ Le(u, t, r);
234
+ const d = Ce(t, i, u);
157
235
  if (u === !1)
158
236
  return null;
159
- const y = o.length === 0;
160
- return /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
161
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
237
+ const m = o.length === 0;
238
+ return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
239
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
162
240
  n,
163
241
  " ",
164
- d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
242
+ d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
165
243
  ] }),
166
- /* @__PURE__ */ l(
167
- Ie.Root,
244
+ /* @__PURE__ */ s(
245
+ Fe.Root,
168
246
  {
169
247
  value: e || "",
170
- onChange: (f) => r(t, f.target.value),
248
+ onChange: (g) => r(t, g.target.value === "" ? void 0 : g.target.value),
171
249
  disabled: !c,
172
- placeholder: (m = s.options) == null ? void 0 : m.placeholder,
173
- color: y ? void 0 : "red",
250
+ placeholder: (f = l.options) == null ? void 0 : f.placeholder,
251
+ color: m ? void 0 : "red",
174
252
  id: t
175
253
  }
176
254
  ),
177
- !y && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Re(o, n) }),
178
- a.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: a.description })
255
+ !m && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
256
+ a.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: a.description })
179
257
  ] }) });
180
- }, Kr = ie(1, vr), Yr = be(qr), Gr = /* @__PURE__ */ new Set(["-", "+", "e", "E"]), Jr = ({
258
+ }, Gn = ue(1, sn), Jn = Ee(Yn), Zn = /* @__PURE__ */ new Set(["-", "+", "e", "E"]), Qn = ({
181
259
  data: e,
182
260
  handleChange: r,
183
261
  path: t,
184
262
  label: n,
185
263
  required: i,
186
264
  errors: o,
187
- uischema: s,
265
+ uischema: l,
188
266
  schema: a,
189
267
  enabled: c,
190
268
  visible: u = !0
191
269
  }) => {
192
- var R;
193
- Oe(u, t, r);
194
- const d = Ae(t, i, u);
270
+ var C;
271
+ Le(u, t, r);
272
+ const d = Ce(t, i, u);
195
273
  if (u === !1)
196
274
  return null;
197
- const y = o.length === 0, m = typeof a.exclusiveMinimum == "number" ? a.exclusiveMinimum : void 0, f = typeof a.minimum == "number" ? a.minimum : void 0, T = m ?? f, w = T !== void 0 && T >= 0, L = typeof a.multipleOf == "number" ? a.multipleOf : a.type === "integer" ? 1 : void 0, D = (v) => {
198
- if (v === "") {
275
+ const m = o.length === 0, f = typeof a.exclusiveMinimum == "number" ? a.exclusiveMinimum : void 0, g = typeof a.minimum == "number" ? a.minimum : void 0, E = f ?? g, v = E !== void 0 && E >= 0, z = typeof a.multipleOf == "number" ? a.multipleOf : a.type === "integer" ? 1 : void 0, R = (A) => {
276
+ if (A === "") {
199
277
  r(t, void 0);
200
278
  return;
201
279
  }
202
- const b = Number(v);
203
- isNaN(b) || r(t, b);
204
- }, N = (v) => {
205
- w && Gr.has(v.key) && v.preventDefault();
206
- }, A = (v) => {
207
- if (!w) return;
208
- const b = v.clipboardData.getData("text");
209
- /[-+eE]/.test(b) && v.preventDefault();
280
+ const T = Number(A);
281
+ isNaN(T) || r(t, T);
282
+ }, j = (A) => {
283
+ v && Zn.has(A.key) && A.preventDefault();
284
+ }, S = (A) => {
285
+ if (!v) return;
286
+ const T = A.clipboardData.getData("text");
287
+ /[-+eE]/.test(T) && A.preventDefault();
210
288
  };
211
- return /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
212
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
289
+ return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
290
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
213
291
  n,
214
292
  " ",
215
- d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
293
+ d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
216
294
  ] }),
217
- /* @__PURE__ */ l(
218
- Ie.Root,
295
+ /* @__PURE__ */ s(
296
+ Fe.Root,
219
297
  {
220
298
  type: "number",
221
299
  value: e ?? "",
222
- onChange: (v) => D(v.target.value),
223
- onKeyDown: N,
224
- onPaste: A,
225
- min: T,
226
- step: L,
300
+ onChange: (A) => R(A.target.value),
301
+ onKeyDown: j,
302
+ onPaste: S,
303
+ min: E,
304
+ step: z,
227
305
  disabled: !c,
228
- placeholder: (R = s.options) == null ? void 0 : R.placeholder,
229
- color: y ? void 0 : "red",
306
+ placeholder: (C = l.options) == null ? void 0 : C.placeholder,
307
+ color: m ? void 0 : "red",
230
308
  id: t
231
309
  }
232
310
  ),
233
- !y && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Re(o, n) }),
234
- a.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: a.description })
311
+ !m && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
312
+ a.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: a.description })
235
313
  ] }) });
236
- }, Zr = ie(2, ot(wr, Er)), Qr = be(Jr), en = ({
314
+ }, eo = ue(2, pt(ln, an)), to = Ee(Qn), ro = ({
237
315
  data: e,
238
316
  handleChange: r,
239
317
  path: t,
240
318
  label: n,
241
319
  required: i,
242
320
  errors: o,
243
- schema: s,
321
+ schema: l,
244
322
  enabled: a,
245
323
  visible: c = !0
246
324
  }) => {
247
- Oe(c, t, r);
248
- const u = Ae(t, i, c);
325
+ Le(c, t, r);
326
+ const u = Ce(t, i, c);
249
327
  if (c === !1)
250
328
  return null;
251
329
  const d = o.length === 0;
252
- return /* @__PURE__ */ g(M, { mb: "4", children: [
253
- /* @__PURE__ */ g($, { gap: "2", align: "center", children: [
254
- /* @__PURE__ */ l(
255
- Lr,
330
+ return /* @__PURE__ */ p(N, { mb: "4", children: [
331
+ /* @__PURE__ */ p(L, { gap: "2", align: "center", children: [
332
+ /* @__PURE__ */ s(
333
+ xn,
256
334
  {
257
335
  checked: !!e,
258
- onCheckedChange: (y) => r(t, y === !0),
336
+ onCheckedChange: (m) => r(t, m === !0),
259
337
  disabled: !a,
260
338
  id: t
261
339
  }
262
340
  ),
263
- /* @__PURE__ */ g(p, { as: "label", size: "2", htmlFor: t, children: [
341
+ /* @__PURE__ */ p(h, { as: "label", size: "2", htmlFor: t, children: [
264
342
  n,
265
343
  " ",
266
344
  u && "*"
267
345
  ] })
268
346
  ] }),
269
- !d && /* @__PURE__ */ l(p, { color: "red", size: "1", className: "block mt-1", children: Re(o, n) }),
270
- s.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", className: "block mt-1", children: s.description })
347
+ !d && /* @__PURE__ */ s(h, { color: "red", size: "1", className: "block mt-1", children: Oe(o, n) }),
348
+ l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", className: "block mt-1", children: l.description })
271
349
  ] });
272
- }, tn = ie(2, Tr), rn = be(en), nn = ({
350
+ }, no = ue(2, cn), oo = Ee(ro), io = ({
273
351
  data: e,
274
352
  handleChange: r,
275
353
  path: t,
276
354
  label: n,
277
355
  required: i,
278
356
  errors: o,
279
- schema: s,
357
+ schema: l,
280
358
  enabled: a,
281
359
  visible: c = !0
282
360
  }) => {
283
- Oe(c, t, r);
284
- const u = Ae(t, i, c);
361
+ Le(c, t, r);
362
+ const u = Ce(t, i, c);
285
363
  if (c === !1)
286
364
  return null;
287
365
  const d = o.length === 0;
288
- let y = [];
289
- s.enum ? y = s.enum.map((f) => ({ value: f, label: String(f) })) : s.oneOf && (y = s.oneOf.map((f) => ({
290
- value: f.const,
291
- label: f.title || String(f.const)
366
+ let m = [];
367
+ l.enum ? m = l.enum.map((g) => ({ value: g, label: String(g) })) : l.oneOf && (m = l.oneOf.map((g) => ({
368
+ value: g.const,
369
+ label: g.title || String(g.const)
292
370
  })));
293
- const m = e;
294
- return /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
295
- /* @__PURE__ */ g(p, { as: "div", size: "2", weight: "bold", children: [
371
+ const f = e;
372
+ return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
373
+ /* @__PURE__ */ p(h, { as: "div", size: "2", weight: "bold", children: [
296
374
  n,
297
375
  " ",
298
- u && /* @__PURE__ */ l(p, { color: "red", children: "*" })
376
+ u && /* @__PURE__ */ s(h, { color: "red", children: "*" })
299
377
  ] }),
300
- /* @__PURE__ */ l(
301
- wt.Root,
378
+ /* @__PURE__ */ s(
379
+ Wt.Root,
302
380
  {
303
- value: m !== void 0 ? String(m) : "",
304
- onValueChange: (f) => {
305
- const T = y.find((w) => String(w.value) === f);
306
- T && r(t, T.value);
381
+ value: f !== void 0 ? String(f) : "",
382
+ onValueChange: (g) => {
383
+ const E = m.find((v) => String(v.value) === g);
384
+ E && r(t, E.value);
307
385
  },
308
386
  disabled: !a,
309
- children: /* @__PURE__ */ l(
310
- $,
387
+ children: /* @__PURE__ */ s(
388
+ L,
311
389
  {
312
390
  direction: "row",
313
391
  style: {
@@ -315,109 +393,109 @@ const Re = (e, r) => {
315
393
  columnGap: "clamp(14px, 3vw, 36px)",
316
394
  rowGap: "clamp(8px, 1.6vw, 14px)"
317
395
  },
318
- children: y.map((f) => /* @__PURE__ */ g($, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
319
- /* @__PURE__ */ l(wt.Item, { value: String(f.value) }),
320
- /* @__PURE__ */ l(p, { size: "2", color: a ? void 0 : "gray", children: f.label })
321
- ] }, String(f.value)))
396
+ children: m.map((g) => /* @__PURE__ */ p(L, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
397
+ /* @__PURE__ */ s(Wt.Item, { value: String(g.value) }),
398
+ /* @__PURE__ */ s(h, { size: "2", color: a ? void 0 : "gray", children: g.label })
399
+ ] }, String(g.value)))
322
400
  }
323
401
  )
324
402
  }
325
403
  ),
326
- !d && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Re(o, n) }),
327
- s.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: s.description })
404
+ !d && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
405
+ l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: l.description })
328
406
  ] }) });
329
- }, on = (e, r, t) => {
407
+ }, so = (e, r, t) => {
330
408
  var i;
331
- return ot(jt, Vt)(e, r, t) && ((i = e == null ? void 0 : e.options) == null ? void 0 : i.format) === "radio" ? 3 : -1;
332
- }, sn = be(nn), ln = ({
409
+ return pt(pr, hr)(e, r, t) && ((i = e == null ? void 0 : e.options) == null ? void 0 : i.format) === "radio" ? 3 : -1;
410
+ }, lo = Ee(io), ao = ({
333
411
  data: e,
334
412
  handleChange: r,
335
413
  path: t,
336
414
  label: n,
337
415
  required: i,
338
416
  errors: o,
339
- schema: s,
417
+ schema: l,
340
418
  uischema: a,
341
419
  enabled: c,
342
420
  visible: u = !0
343
421
  }) => {
344
- var ee, fe, oe, te;
345
- Oe(u, t, r);
346
- const d = Ae(t, i, u), y = ((ee = a.options) == null ? void 0 : ee.autocomplete) === !0, [m, f] = B(!1), [T, w] = B(""), [L, D] = B(0), N = ge(null);
347
- if (we(() => {
348
- if (!y || !m) return;
349
- const k = (G) => {
350
- N.current && !N.current.contains(G.target) && f(!1);
422
+ var le, ve, ne, ae;
423
+ Le(u, t, r);
424
+ const d = Ce(t, i, u), m = ((le = a.options) == null ? void 0 : le.autocomplete) === !0, [f, g] = Y(!1), [E, v] = Y(""), [z, R] = Y(0), j = he(null);
425
+ if (ye(() => {
426
+ if (!m || !f) return;
427
+ const $ = (Z) => {
428
+ j.current && !j.current.contains(Z.target) && g(!1);
351
429
  };
352
- return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
353
- }, [y, m]), u === !1)
430
+ return document.addEventListener("mousedown", $), () => document.removeEventListener("mousedown", $);
431
+ }, [m, f]), u === !1)
354
432
  return null;
355
- const A = s.type === "object", R = A ? ((fe = s.properties) == null ? void 0 : fe.value) ?? {} : s;
356
- let v = [];
357
- R.enum ? v = R.enum.map((k) => ({ value: String(k), label: String(k), raw: k })) : R.oneOf && (v = R.oneOf.map((k) => {
358
- const G = k.const;
359
- return { value: String(G), label: k.title || String(G), raw: G };
433
+ const S = l.type === "object", C = S ? ((ve = l.properties) == null ? void 0 : ve.value) ?? {} : l;
434
+ let A = [];
435
+ C.enum ? A = C.enum.map(($) => ({ value: String($), label: String($), raw: $ })) : C.oneOf && (A = C.oneOf.map(($) => {
436
+ const Z = $.const;
437
+ return { value: String(Z), label: $.title || String(Z), raw: Z };
360
438
  }));
361
- const b = A ? typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? { value: e } : e ?? void 0 : void 0, U = A ? b == null ? void 0 : b.value : e, P = b == null ? void 0 : b.label, O = U != null ? String(U) : "", j = P ?? ((oe = v.find((k) => k.value === O)) == null ? void 0 : oe.label) ?? "", I = ((te = a.options) == null ? void 0 : te.placeholder) || "Select an option", ne = A && O !== "" && !v.some((k) => k.value === O), Y = o ? Re(o, n) : ne ? `"${j || O}" is no longer an available option` : "", z = Y === "", _ = (k) => {
362
- r(t, A ? { value: k.raw, label: k.label } : k.value);
439
+ const T = S ? typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? { value: e } : e ?? void 0 : void 0, W = S ? T == null ? void 0 : T.value : e, U = T == null ? void 0 : T.label, F = W != null ? String(W) : "", M = U ?? ((ne = A.find(($) => $.value === F)) == null ? void 0 : ne.label) ?? "", x = ((ae = a.options) == null ? void 0 : ae.placeholder) || "Select an option", te = S && F !== "" && !A.some(($) => $.value === F), H = o ? Oe(o, n) : te ? `"${M || F}" is no longer an available option` : "", J = H === "", B = ($) => {
440
+ r(t, S ? { value: $.raw, label: $.label } : $.value);
363
441
  };
364
- if (y) {
365
- const k = m ? v.filter((F) => F.label.toLowerCase().includes(T.toLowerCase())) : v, G = Math.min(L, k.length - 1), C = (F) => {
366
- _(F), f(!1);
367
- }, J = (F) => {
368
- F.stopPropagation(), r(t, void 0), w("");
369
- }, pe = (F) => {
370
- (F.key === "Enter" || F.key === " ") && J(F);
442
+ if (m) {
443
+ const $ = f ? A.filter((_) => _.label.toLowerCase().includes(E.toLowerCase())) : A, Z = Math.min(z, $.length - 1), I = (_) => {
444
+ B(_), g(!1);
445
+ }, re = (_) => {
446
+ _.stopPropagation(), r(t, void 0), v("");
447
+ }, Q = (_) => {
448
+ (_.key === "Enter" || _.key === " ") && re(_);
371
449
  };
372
- return /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
373
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
450
+ return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
451
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
374
452
  n,
375
453
  " ",
376
- d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
454
+ d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
377
455
  ] }),
378
- /* @__PURE__ */ g("div", { ref: N, style: { position: "relative" }, children: [
379
- /* @__PURE__ */ l(
380
- Ie.Root,
456
+ /* @__PURE__ */ p("div", { ref: j, style: { position: "relative" }, children: [
457
+ /* @__PURE__ */ s(
458
+ Fe.Root,
381
459
  {
382
460
  id: t,
383
- value: m ? T : j,
384
- placeholder: I,
461
+ value: f ? E : M,
462
+ placeholder: x,
385
463
  disabled: !c,
386
- style: z ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
387
- onChange: (F) => {
388
- w(F.target.value), D(0), m || f(!0);
464
+ style: J ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
465
+ onChange: (_) => {
466
+ v(_.target.value), R(0), f || g(!0);
389
467
  },
390
468
  onFocus: () => {
391
- c && !m && (w(""), D(0), f(!0));
469
+ c && !f && (v(""), R(0), g(!0));
392
470
  },
393
- onKeyDown: (F) => {
394
- F.key === "Escape" ? f(!1) : F.key === "ArrowDown" ? (F.preventDefault(), m ? D((Z) => Math.min(Z + 1, k.length - 1)) : (w(""), f(!0))) : F.key === "ArrowUp" ? (F.preventDefault(), m && D((Z) => Math.max(Z - 1, 0))) : F.key === "Enter" && m && k[G] && (F.preventDefault(), C(k[G]));
471
+ onKeyDown: (_) => {
472
+ _.key === "Escape" ? g(!1) : _.key === "ArrowDown" ? (_.preventDefault(), f ? R((b) => Math.min(b + 1, $.length - 1)) : (v(""), g(!0))) : _.key === "ArrowUp" ? (_.preventDefault(), f && R((b) => Math.max(b - 1, 0))) : _.key === "Enter" && f && $[Z] && (_.preventDefault(), I($[Z]));
395
473
  },
396
- children: /* @__PURE__ */ l(Ie.Slot, { side: "right", children: /* @__PURE__ */ g($, { align: "center", gap: "1", children: [
397
- O && c && /* @__PURE__ */ l(
474
+ children: /* @__PURE__ */ s(Fe.Slot, { side: "right", children: /* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
475
+ F && c && /* @__PURE__ */ s(
398
476
  "span",
399
477
  {
400
478
  role: "button",
401
479
  tabIndex: 0,
402
- onMouseDown: (F) => F.preventDefault(),
403
- onClick: J,
404
- onKeyDown: pe,
480
+ onMouseDown: (_) => _.preventDefault(),
481
+ onClick: re,
482
+ onKeyDown: Q,
405
483
  style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
406
484
  "aria-label": "Clear selection",
407
485
  children: "×"
408
486
  }
409
487
  ),
410
- /* @__PURE__ */ l(
411
- qt,
488
+ /* @__PURE__ */ s(
489
+ br,
412
490
  {
413
- style: { transform: m ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
491
+ style: { transform: f ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
414
492
  }
415
493
  )
416
494
  ] }) })
417
495
  }
418
496
  ),
419
- m && /* @__PURE__ */ l(
420
- M,
497
+ f && /* @__PURE__ */ s(
498
+ N,
421
499
  {
422
500
  style: {
423
501
  position: "absolute",
@@ -431,101 +509,122 @@ const Re = (e, r) => {
431
509
  border: "1px solid var(--gray-a6)",
432
510
  overflow: "hidden"
433
511
  },
434
- children: /* @__PURE__ */ l(Ht, { style: { maxHeight: 240 }, children: /* @__PURE__ */ g(M, { p: "1", children: [
435
- k.length === 0 && /* @__PURE__ */ l(M, { px: "3", py: "2", children: /* @__PURE__ */ l(p, { size: "2", color: "gray", children: "No results found." }) }),
436
- k.map((F, Z) => /* @__PURE__ */ l(
437
- M,
512
+ children: /* @__PURE__ */ s(gr, { style: { maxHeight: 240 }, children: /* @__PURE__ */ p(N, { p: "1", children: [
513
+ $.length === 0 && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "No results found." }) }),
514
+ $.map((_, b) => /* @__PURE__ */ s(
515
+ N,
438
516
  {
439
517
  px: "3",
440
518
  py: "2",
441
- onMouseDown: (le) => le.preventDefault(),
442
- onClick: () => C(F),
443
- onMouseEnter: () => D(Z),
519
+ onMouseDown: (O) => O.preventDefault(),
520
+ onClick: () => I(_),
521
+ onMouseEnter: () => R(b),
444
522
  style: {
445
523
  cursor: "pointer",
446
524
  borderRadius: "var(--radius-2)",
447
- backgroundColor: Z === G ? "var(--accent-4)" : F.value === O ? "var(--accent-3)" : void 0
525
+ backgroundColor: b === Z ? "var(--accent-4)" : _.value === F ? "var(--accent-3)" : void 0
448
526
  },
449
- children: /* @__PURE__ */ l(p, { size: "2", children: F.label })
527
+ children: /* @__PURE__ */ s(h, { size: "2", children: _.label })
450
528
  },
451
- F.value
529
+ _.value
452
530
  ))
453
531
  ] }) })
454
532
  }
455
533
  )
456
534
  ] }),
457
- !z && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Y }),
458
- s.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: s.description })
535
+ !J && /* @__PURE__ */ s(h, { color: "red", size: "1", children: H }),
536
+ l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: l.description })
459
537
  ] }) });
460
538
  }
461
- return /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
462
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
539
+ return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
540
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
463
541
  n,
464
542
  " ",
465
- d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
543
+ d && /* @__PURE__ */ s(h, { color: "red", children: "*" })
466
544
  ] }),
467
- /* @__PURE__ */ g(
468
- Qe.Root,
545
+ /* @__PURE__ */ p(
546
+ lt.Root,
469
547
  {
470
- value: O,
471
- onValueChange: (k) => {
472
- const G = v.find((C) => C.value === k);
473
- G && _(G);
548
+ value: F,
549
+ onValueChange: ($) => {
550
+ const Z = A.find((I) => I.value === $);
551
+ Z && B(Z);
474
552
  },
475
553
  disabled: !c,
476
554
  children: [
477
- /* @__PURE__ */ l(Qe.Trigger, { placeholder: I, color: z ? void 0 : "red", id: t, children: A && P ? P : void 0 }),
478
- /* @__PURE__ */ l(Qe.Content, { children: v.map((k) => /* @__PURE__ */ l(Qe.Item, { value: k.value, children: k.label }, k.value)) })
555
+ /* @__PURE__ */ s(lt.Trigger, { placeholder: x, color: J ? void 0 : "red", id: t, children: S && U ? U : void 0 }),
556
+ /* @__PURE__ */ s(lt.Content, { children: A.map(($) => /* @__PURE__ */ s(lt.Item, { value: $.value, children: $.label }, $.value)) })
479
557
  ]
480
558
  }
481
559
  ),
482
- !z && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Y }),
483
- s.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: s.description })
560
+ !J && /* @__PURE__ */ s(h, { color: "red", size: "1", children: H }),
561
+ l.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: l.description })
484
562
  ] }) });
485
- }, cn = ie(2, ot(jt, Vt)), an = ie(
563
+ }, co = ue(2, pt(pr, hr)), uo = ue(
486
564
  3,
487
- ze((e) => {
565
+ _e((e) => {
488
566
  var t;
489
567
  if (e.type !== "object" || e["x-search"] !== void 0) return !1;
490
568
  const r = (t = e.properties) == null ? void 0 : t.value;
491
569
  return Array.isArray(r == null ? void 0 : r.enum) || Array.isArray(r == null ? void 0 : r.oneOf);
492
570
  })
493
- ), Tt = be(ln), Jt = /\{([A-Za-z0-9_]+)(?:\(([^(){}]*)\))?\}/g, un = {
494
- today: (e) => Kt().format(e || "YYYY-MM-DD")
495
- }, dn = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint", xt = (e, r) => Object.prototype.hasOwnProperty.call(e, r);
496
- function it(e, r, t = {}) {
497
- const n = { ...un, ...t };
498
- return e.replace(Jt, (i, o, s) => {
571
+ ), Bt = Ee(ao), Sr = /\{([A-Za-z0-9_]+)(?:\(([^(){}]*)\))?\}/g, fo = {
572
+ today: (e) => vr().format(e || "YYYY-MM-DD")
573
+ }, po = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint", Xt = (e, r) => Object.prototype.hasOwnProperty.call(e, r);
574
+ function mt(e, r, t = {}) {
575
+ const n = { ...fo, ...t };
576
+ return e.replace(Sr, (i, o, l) => {
499
577
  let a;
500
- if (s === void 0) {
501
- if (!xt(r, o)) return i;
578
+ if (l === void 0) {
579
+ if (!Xt(r, o)) return i;
502
580
  a = r[o];
503
581
  } else {
504
- if (!xt(n, o)) return i;
582
+ if (!Xt(n, o)) return i;
505
583
  try {
506
- a = n[o](s);
584
+ a = n[o](l);
507
585
  } catch {
508
586
  return i;
509
587
  }
510
588
  }
511
- return a == null ? "" : dn(a) ? String(a) : i;
589
+ return a == null ? "" : po(a) ? String(a) : i;
512
590
  });
513
591
  }
514
- function ht(e) {
592
+ function kt(e) {
515
593
  const r = [];
516
594
  let t = 0;
517
- for (const n of e.matchAll(Jt))
595
+ for (const n of e.matchAll(Sr))
518
596
  n.index > t && r.push(e.slice(t, n.index)), r.push(n[2] === void 0 ? { name: n[1] } : { name: n[1], arg: n[2] }), t = n.index + n[0].length;
519
597
  return t < e.length && r.push(e.slice(t)), r;
520
598
  }
521
- function fn(e) {
599
+ function qt(e) {
600
+ if (!e || typeof e != "object") return;
601
+ const r = e["x-search"];
602
+ return typeof (r == null ? void 0 : r.service) == "string" && r.service !== "" ? r.service : void 0;
603
+ }
604
+ function Rr(e) {
605
+ if (qt(e)) return e;
606
+ if (e.type === "array") {
607
+ const r = e.items;
608
+ if (r && !Array.isArray(r) && qt(r)) return r;
609
+ }
610
+ }
611
+ const ho = ue(
612
+ 4,
613
+ _e((e) => {
614
+ const r = Rr(e);
615
+ if (!r) return !1;
616
+ const t = r.type;
617
+ return t === "string" || t === "object";
618
+ })
619
+ );
620
+ function mo(e) {
522
621
  if (typeof e == "string" && e.length > 0) return e;
523
622
  if (e && typeof e == "object" && typeof e.value == "string") {
524
623
  const r = e.value;
525
624
  return r.length > 0 ? r : void 0;
526
625
  }
527
626
  }
528
- function pn(e) {
627
+ function go(e) {
529
628
  if (typeof e == "string") return e.length > 0 ? { parent: e } : void 0;
530
629
  if (!e || typeof e != "object") return;
531
630
  const r = Object.entries(e);
@@ -535,195 +634,298 @@ function pn(e) {
535
634
  typeof o == "string" && o.length > 0 ? t[i] = o : n.push(i);
536
635
  return n.length > 0 && console.warn(`x-search.dependsOn: ignoring invalid entries [${n.join(", ")}]`), Object.keys(t).length === 0 ? (console.warn("x-search.dependsOn: map has no valid entries; search will not fetch until fixed"), {}) : t;
537
636
  }
538
- function hn(e, r, t) {
637
+ function yo(e, r, t) {
539
638
  const n = {};
540
639
  for (const [i, o] of Object.entries(e))
541
- n[i] = fn(He.data(r, t ? `${t}.${o}` : o));
640
+ n[i] = mo(Xe.data(r, t ? `${t}.${o}` : o));
542
641
  return n;
543
642
  }
544
- function At(e, r) {
545
- return r ? { ...e, name: it(r, e) } : e;
643
+ function Kt(e) {
644
+ if (typeof e == "string" && e.length > 0) return { value: e };
645
+ if (e && typeof e == "object" && typeof e.value == "string") {
646
+ const r = e;
647
+ return { value: r.value, label: r.label };
648
+ }
649
+ }
650
+ function yt(e, r) {
651
+ return r ? { ...e, name: mt(r, e) } : e;
546
652
  }
547
- const mn = {
653
+ const bo = {
548
654
  "small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
549
655
  "large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
550
656
  "large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
551
- }, gn = ({
657
+ }, vo = ({
552
658
  data: e,
553
659
  handleChange: r,
554
660
  path: t,
555
661
  label: n,
556
662
  required: i,
557
663
  errors: o,
558
- enabled: s,
664
+ enabled: l,
559
665
  visible: a = !0,
560
666
  schema: c,
561
667
  uischema: u
562
668
  }) => {
563
- var Je, Ee;
564
- const d = (c == null ? void 0 : c["x-search"]) ?? {
669
+ var $t, Pt, Ut, jt;
670
+ const d = c.type === "array", m = Rr(c) ?? c, f = m["x-search"] ?? {
565
671
  service: "",
566
672
  displayTemplate: ""
567
- }, y = d.service ?? "", m = d.mode ?? "large-paginated-list", f = mn[m], T = (f == null ? void 0 : f.fetchOnOpen) ?? !1, w = typeof d.displayTemplate == "string" ? d.displayTemplate : "", L = $e(), D = t.split(".").slice(0, -1).join("."), { parentValues: N, parentValuesKey: A, missingParent: R } = Ve(() => {
568
- var Te;
569
- const E = pn(d.dependsOn);
570
- if (!E) return { parentValues: void 0, parentValuesKey: "", missingParent: !1 };
571
- const re = hn(E, (Te = L.core) == null ? void 0 : Te.data, D), ae = Object.keys(re).length === 0 || Object.values(re).some((Ne) => !Ne);
572
- return { parentValues: re, parentValuesKey: JSON.stringify(re), missingParent: ae };
573
- }, [d.dependsOn, (Je = L.core) == null ? void 0 : Je.data, D]), v = Ve(() => N ? { ...d.params, ...N } : d.params, [N, A, d.params]), b = Pr(y), U = c.type === "object", P = U ? typeof e == "string" ? { value: e } : e ?? void 0 : void 0, O = U ? P == null ? void 0 : P.value : e, j = P == null ? void 0 : P.label, I = y ? b ? f ? w ? null : "x-search.displayTemplate is required." : `Invalid x-search.mode "${m}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${y}" is not registered.` : "Search not configured.", ne = s !== !1, Y = !o || o.length === 0, [z, _] = B(!1), [ee, fe] = B(""), [oe, te] = B([]), [k, G] = B(!1), [C, J] = B(!1), [pe, F] = B(!1), [Z, le] = B(null), [ye, he] = B(void 0), h = ge(void 0), x = ge(null), V = ge(null), Q = ge(null), X = ge(void 0), me = ge(void 0);
574
- we(() => {
575
- if (!N) return;
576
- const E = me.current;
577
- if (me.current = N, !E || !O) return;
578
- Object.keys(N).some((ae) => E[ae] !== void 0 && E[ae] !== N[ae]) && r(t, U ? void 0 : null);
579
- }, [A, O, r, t, U]), we(() => {
580
- var Te, Ne;
581
- if (I) {
582
- he(void 0), X.current = void 0;
673
+ }, g = f.service ?? "", E = f.mode ?? "large-paginated-list", v = bo[E], z = (v == null ? void 0 : v.fetchOnOpen) ?? !1, R = typeof f.displayTemplate == "string" ? f.displayTemplate : "", j = Ne(), S = t.split(".").slice(0, -1).join("."), { parentValues: C, parentValuesKey: A, missingParent: T } = Se(() => {
674
+ var we;
675
+ const w = go(f.dependsOn);
676
+ if (!w) return { parentValues: void 0, parentValuesKey: "", missingParent: !1 };
677
+ const P = yo(w, (we = j.core) == null ? void 0 : we.data, S), oe = Object.keys(P).length === 0 || Object.values(P).some((ze) => !ze);
678
+ return { parentValues: P, parentValuesKey: JSON.stringify(P), missingParent: oe };
679
+ }, [f.dependsOn, ($t = j.core) == null ? void 0 : $t.data, S]), W = Se(() => C ? { ...f.params, ...C } : f.params, [C, A, f.params]), U = Nn(g), F = m.type === "object", M = typeof c.maxItems == "number" ? c.maxItems : void 0, x = Se(() => {
680
+ if (d)
681
+ return Array.isArray(e) ? e.map(Kt).filter((P) => !!P) : [];
682
+ const w = Kt(F || typeof e == "string" ? e : void 0);
683
+ return w ? [w] : [];
684
+ }, [e, d, F]), te = d || (Pt = x[0]) == null ? void 0 : Pt.value, H = d || (Ut = x[0]) == null ? void 0 : Ut.label, J = Se(() => new Set(x.map((w) => w.value)), [x]), B = x.length > 0, le = he({}), [ve, ne] = Y(0), ae = Se(() => {
685
+ const w = {};
686
+ for (const P of x)
687
+ w[P.value] = P.label || le.current[P.value] || P.value;
688
+ return w;
689
+ }, [x, ve]), $ = d && M !== void 0 && x.length >= M, Z = g ? U ? v ? R ? null : "x-search.displayTemplate is required." : `Invalid x-search.mode "${E}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${g}" is not registered.` : "Search not configured.", I = l !== !1, re = !o || o.length === 0, [Q, _] = Y(!1), [b, O] = Y(""), [V, G] = Y([]), [y, k] = Y(!1), [ee, se] = Y(!1), [ce, me] = Y(!1), [D, X] = Y(null), [de, K] = Y(void 0), q = he(void 0), xe = he(null), $e = he(null), et = he(null), fe = he(void 0), ke = he(void 0), qe = Be(
690
+ (w) => {
691
+ if (d) {
692
+ r(t, w.length > 0 ? w.map((oe) => F ? oe : oe.value) : void 0);
693
+ return;
694
+ }
695
+ const P = w[0];
696
+ if (!P) {
697
+ r(t, void 0);
698
+ return;
699
+ }
700
+ r(t, F ? { value: P.value, label: P.label } : P.value);
701
+ },
702
+ [r, t, d, F]
703
+ );
704
+ ye(() => {
705
+ if (!C) return;
706
+ const w = ke.current;
707
+ if (ke.current = C, !w || !B) return;
708
+ Object.keys(C).some((oe) => w[oe] !== void 0 && w[oe] !== C[oe]) && r(t, void 0);
709
+ }, [A, B, r, t]), ye(() => {
710
+ var we, ze;
711
+ if (d) {
712
+ if (Z || F) return;
713
+ const Pe = x.filter((We) => !We.label && !le.current[We.value]);
714
+ if (Pe.length === 0 || !(U != null && U.resolve)) return;
715
+ let Ve = !1;
716
+ return Promise.all(
717
+ Pe.map(async (We) => {
718
+ try {
719
+ const _t = await U.resolve(We.value, W);
720
+ if (Ve || !_t) return;
721
+ le.current[We.value] = yt(_t, R).name;
722
+ } catch {
723
+ }
724
+ })
725
+ ).then(() => {
726
+ Ve || ne((We) => We + 1);
727
+ }), () => {
728
+ Ve = !0;
729
+ };
730
+ }
731
+ if (Z) {
732
+ K(void 0), fe.current = void 0;
583
733
  return;
584
734
  }
585
- if (!O) {
586
- he(void 0), X.current = void 0;
735
+ if (!te) {
736
+ K(void 0), fe.current = void 0;
587
737
  return;
588
738
  }
589
- if (((Te = X.current) == null ? void 0 : Te.value) === O && ((Ne = X.current) == null ? void 0 : Ne.label) === j) return;
590
- if (U && j) {
591
- he({ id: O, name: j }), X.current = { value: O, label: j };
739
+ if (((we = fe.current) == null ? void 0 : we.value) === te && ((ze = fe.current) == null ? void 0 : ze.label) === H) return;
740
+ if (F && H) {
741
+ K({ id: te, name: H }), fe.current = { value: te, label: H };
592
742
  return;
593
743
  }
594
- if (he({ id: O, name: j ?? O }), !(b != null && b.resolve)) {
595
- X.current = { value: O, label: j };
744
+ if (K({ id: te, name: H ?? te }), !(U != null && U.resolve)) {
745
+ fe.current = { value: te, label: H };
596
746
  return;
597
747
  }
598
- let E = !1;
599
- const re = O, ae = j;
600
- return b.resolve(re, v).then((qe) => {
601
- E || (qe && he(At(qe, w)), X.current = { value: re, label: ae });
748
+ let w = !1;
749
+ const P = te, oe = H;
750
+ return U.resolve(P, W).then((Pe) => {
751
+ w || (Pe && K(yt(Pe, R)), fe.current = { value: P, label: oe });
602
752
  }).catch(() => {
603
- E || (X.current = { value: re, label: ae });
753
+ w || (fe.current = { value: P, label: oe });
604
754
  }), () => {
605
- E = !0;
755
+ w = !0;
606
756
  };
607
- }, [I, O, j, U, b, v, w]);
608
- const S = We(
609
- async (E, re = !1) => {
610
- var Te;
611
- if (I) return;
612
- if (!b) {
613
- le("Search service not configured.");
757
+ }, [
758
+ Z,
759
+ te,
760
+ H,
761
+ F,
762
+ d,
763
+ x,
764
+ U,
765
+ W,
766
+ R
767
+ ]);
768
+ const Ke = Be(
769
+ async (w, P = !1) => {
770
+ var we;
771
+ if (Z) return;
772
+ if (!U) {
773
+ X("Search service not configured.");
614
774
  return;
615
775
  }
616
- (Te = V.current) == null || Te.abort();
617
- const ae = new AbortController();
618
- V.current = ae, re ? F(!0) : (J(!0), F(!1), le(null));
776
+ (we = $e.current) == null || we.abort();
777
+ const oe = new AbortController();
778
+ $e.current = oe, P ? me(!0) : (se(!0), me(!1), X(null));
619
779
  try {
620
- const Ne = await b.search({
621
- query: E,
622
- cursor: re ? h.current : void 0,
623
- signal: ae.signal,
624
- params: v
780
+ const ze = await U.search({
781
+ query: w,
782
+ cursor: P ? q.current : void 0,
783
+ signal: oe.signal,
784
+ params: W
625
785
  });
626
- if (ae.signal.aborted) return;
627
- const qe = (Ne.options ?? []).map((st) => At(st, w));
628
- te(re ? (st) => [...st, ...qe] : qe), h.current = Ne.nextCursor, G(((f == null ? void 0 : f.paginated) ?? !1) && Ne.nextCursor != null);
786
+ if (oe.signal.aborted) return;
787
+ const Pe = (ze.options ?? []).map((Ve) => yt(Ve, R));
788
+ G(P ? (Ve) => [...Ve, ...Pe] : Pe), q.current = ze.nextCursor, k(((v == null ? void 0 : v.paginated) ?? !1) && ze.nextCursor != null);
629
789
  } catch {
630
- if (ae.signal.aborted) return;
631
- le("Failed to load results. Please try again.");
790
+ if (oe.signal.aborted) return;
791
+ X("Failed to load results. Please try again.");
632
792
  } finally {
633
- ae.signal.aborted || (re ? F(!1) : J(!1));
793
+ oe.signal.aborted || (P ? me(!1) : se(!1));
634
794
  }
635
795
  },
636
- [I, b, f == null ? void 0 : f.paginated, v, w]
796
+ [Z, U, v == null ? void 0 : v.paginated, W, R]
637
797
  );
638
- we(() => {
639
- if (!z) return;
640
- const E = (re) => {
641
- Q.current && !Q.current.contains(re.target) && _(!1);
798
+ ye(() => {
799
+ if (!Q) return;
800
+ const w = (P) => {
801
+ et.current && !et.current.contains(P.target) && _(!1);
642
802
  };
643
- return document.addEventListener("mousedown", E), () => document.removeEventListener("mousedown", E);
644
- }, [z]), we(() => {
645
- var E;
646
- z || ((E = V.current) == null || E.abort(), fe(""), te([]), G(!1), le(null), J(!1), F(!1), h.current = void 0);
647
- }, [z]), we(() => {
648
- if (!z) return;
649
- if (R) {
650
- te([]), G(!1), le(null), h.current = void 0;
803
+ return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
804
+ }, [Q]), ye(() => {
805
+ var w;
806
+ Q || ((w = $e.current) == null || w.abort(), O(""), G([]), k(!1), X(null), se(!1), me(!1), q.current = void 0);
807
+ }, [Q]), ye(() => {
808
+ if (!Q) return;
809
+ if (T) {
810
+ G([]), k(!1), X(null), q.current = void 0;
651
811
  return;
652
812
  }
653
- if (!ee && !T) {
654
- te([]), G(!1), le(null), h.current = void 0;
813
+ if (!b && !z) {
814
+ G([]), k(!1), X(null), q.current = void 0;
655
815
  return;
656
816
  }
657
- x.current && clearTimeout(x.current);
658
- const E = ee ? 300 : 0;
659
- return x.current = setTimeout(() => {
660
- te([]), G(!1), h.current = void 0, S(ee);
661
- }, E), () => {
662
- x.current && clearTimeout(x.current);
817
+ xe.current && clearTimeout(xe.current);
818
+ const w = b ? 300 : 0;
819
+ return xe.current = setTimeout(() => {
820
+ G([]), k(!1), q.current = void 0, Ke(b);
821
+ }, w), () => {
822
+ xe.current && clearTimeout(xe.current);
663
823
  };
664
- }, [ee, z, T, S, R, A]), Oe(a, t, r);
665
- const W = Ae(t, i, a);
824
+ }, [b, Q, z, Ke, T, A]), Le(a, t, r);
825
+ const it = Ce(t, i, a);
666
826
  if (a === !1)
667
827
  return null;
668
- const ce = () => {
669
- fe(""), te([]), G(!1), le(null), h.current = void 0, _(!0);
670
- }, q = (E) => {
671
- r(t, U ? { value: E.id, label: E.name } : E.id), he(E), X.current = { value: E.id, label: U ? E.name : void 0 }, _(!1);
672
- }, H = (E) => {
673
- E.stopPropagation(), r(t, void 0), he(void 0);
674
- }, ke = (E) => {
675
- (E.key === "Enter" || E.key === " ") && H(E);
676
- }, Pe = ((Ee = u == null ? void 0 : u.options) == null ? void 0 : Ee.placeholder) ?? "Select an option";
677
- return /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
678
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
828
+ const zt = () => {
829
+ O(""), G([]), k(!1), X(null), q.current = void 0, _(!0);
830
+ }, Yr = (w) => {
831
+ if (d) {
832
+ const P = J.has(w.id);
833
+ if (!P && $) return;
834
+ const oe = P ? x.filter((we) => we.value !== w.id) : [...x, { value: w.id, label: w.name }];
835
+ P || (le.current[w.id] = w.name, ne((we) => we + 1)), qe(oe), O("");
836
+ return;
837
+ }
838
+ qe([{ value: w.id, label: w.name }]), K(w), fe.current = { value: w.id, label: F ? w.name : void 0 }, _(!1);
839
+ }, Mt = (w) => {
840
+ w.stopPropagation(), r(t, void 0), K(void 0);
841
+ }, Ft = (w, P) => {
842
+ w.stopPropagation(), qe(x.filter((oe) => oe.value !== P));
843
+ }, Gr = (w) => {
844
+ (w.key === "Enter" || w.key === " ") && Mt(w);
845
+ }, Jr = ((jt = u == null ? void 0 : u.options) == null ? void 0 : jt.placeholder) ?? "Select an option", Zr = d ? "" : (de == null ? void 0 : de.name) ?? "";
846
+ return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
847
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
679
848
  n,
680
849
  " ",
681
- W && /* @__PURE__ */ l(p, { color: "red", children: "*" })
850
+ it && /* @__PURE__ */ s(h, { color: "red", children: "*" })
682
851
  ] }),
683
- /* @__PURE__ */ g("div", { ref: Q, style: { position: "relative" }, children: [
684
- /* @__PURE__ */ l(
685
- Ie.Root,
852
+ d && x.length > 0 && /* @__PURE__ */ s(L, { gap: "1", wrap: "wrap", mb: "1", children: x.map((w) => /* @__PURE__ */ p(
853
+ L,
854
+ {
855
+ align: "center",
856
+ gap: "1",
857
+ px: "2",
858
+ py: "1",
859
+ style: {
860
+ background: "var(--accent-3)",
861
+ borderRadius: "var(--radius-2)",
862
+ fontSize: "var(--font-size-1)"
863
+ },
864
+ children: [
865
+ /* @__PURE__ */ s(h, { size: "1", children: ae[w.value] ?? w.value }),
866
+ I && /* @__PURE__ */ s(
867
+ "span",
868
+ {
869
+ role: "button",
870
+ tabIndex: 0,
871
+ "aria-label": `Remove ${ae[w.value] ?? w.value}`,
872
+ onMouseDown: (P) => P.preventDefault(),
873
+ onClick: (P) => Ft(P, w.value),
874
+ onKeyDown: (P) => {
875
+ (P.key === "Enter" || P.key === " ") && Ft(P, w.value);
876
+ },
877
+ style: { lineHeight: 1, color: "var(--gray-11)", cursor: "pointer" },
878
+ children: "×"
879
+ }
880
+ )
881
+ ]
882
+ },
883
+ w.value
884
+ )) }),
885
+ /* @__PURE__ */ p("div", { ref: et, style: { position: "relative" }, children: [
886
+ /* @__PURE__ */ s(
887
+ Fe.Root,
686
888
  {
687
889
  id: t,
688
- value: z ? ee : (ye == null ? void 0 : ye.name) ?? "",
689
- placeholder: z && (f != null && f.searchable) ? "Search..." : Pe,
690
- disabled: !ne,
691
- readOnly: z && !(f != null && f.searchable),
692
- style: Y ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
693
- onChange: (E) => {
694
- f != null && f.searchable && (fe(E.target.value), z || ce());
890
+ value: Q ? b : Zr,
891
+ placeholder: Q && (v != null && v.searchable) ? "Search..." : Jr,
892
+ disabled: !I,
893
+ readOnly: Q && !(v != null && v.searchable) || d && !Q,
894
+ style: re ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
895
+ onChange: (w) => {
896
+ v != null && v.searchable && (O(w.target.value), Q || zt());
695
897
  },
696
898
  onFocus: () => {
697
- ne && !z && ce();
899
+ I && !Q && zt();
698
900
  },
699
- onKeyDown: (E) => {
700
- E.key === "Escape" && _(!1);
901
+ onKeyDown: (w) => {
902
+ w.key === "Escape" && _(!1);
701
903
  },
702
- children: /* @__PURE__ */ l(Ie.Slot, { side: "right", children: /* @__PURE__ */ g($, { align: "center", gap: "1", children: [
703
- O && ne && /* @__PURE__ */ l(
904
+ children: /* @__PURE__ */ s(Fe.Slot, { side: "right", children: /* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
905
+ B && I && /* @__PURE__ */ s(
704
906
  "span",
705
907
  {
706
908
  role: "button",
707
909
  tabIndex: 0,
708
- onMouseDown: (E) => E.preventDefault(),
709
- onClick: H,
710
- onKeyDown: ke,
910
+ onMouseDown: (w) => w.preventDefault(),
911
+ onClick: Mt,
912
+ onKeyDown: Gr,
711
913
  style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
712
914
  "aria-label": "Clear selection",
713
915
  children: "×"
714
916
  }
715
917
  ),
716
- /* @__PURE__ */ l(
717
- qt,
918
+ /* @__PURE__ */ s(
919
+ br,
718
920
  {
719
- style: { transform: z ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
921
+ style: { transform: Q ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
720
922
  }
721
923
  )
722
924
  ] }) })
723
925
  }
724
926
  ),
725
- z && /* @__PURE__ */ l(
726
- M,
927
+ Q && /* @__PURE__ */ s(
928
+ N,
727
929
  {
728
930
  style: {
729
931
  position: "absolute",
@@ -737,153 +939,535 @@ const mn = {
737
939
  border: "1px solid var(--gray-a6)",
738
940
  overflow: "hidden"
739
941
  },
740
- children: I ? /* @__PURE__ */ l(M, { p: "3", children: /* @__PURE__ */ l(p, { size: "2", color: "gray", children: I }) }) : /* @__PURE__ */ l(Ht, { style: { maxHeight: 240 }, children: /* @__PURE__ */ g(M, { p: "1", children: [
741
- C && /* @__PURE__ */ l($, { justify: "center", p: "4", children: /* @__PURE__ */ l(Be, {}) }),
742
- !C && Z && /* @__PURE__ */ l(M, { px: "3", py: "2", children: /* @__PURE__ */ l(p, { size: "2", color: "red", children: Z }) }),
743
- !C && !Z && oe.length === 0 && /* @__PURE__ */ l(M, { px: "3", py: "2", children: /* @__PURE__ */ l(p, { size: "2", color: "gray", children: R ? "Select the related field first." : ee || T ? "No results found." : "Type to search…" }) }),
744
- oe.map((E) => /* @__PURE__ */ l(
745
- M,
746
- {
747
- px: "3",
748
- py: "2",
749
- onMouseDown: (re) => re.preventDefault(),
750
- onClick: () => q(E),
751
- style: {
752
- cursor: "pointer",
753
- borderRadius: "var(--radius-2)",
754
- backgroundColor: E.id === O ? "var(--accent-3)" : void 0
942
+ children: Z ? /* @__PURE__ */ s(N, { p: "3", children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: Z }) }) : /* @__PURE__ */ s(gr, { style: { maxHeight: 240 }, children: /* @__PURE__ */ p(N, { p: "1", children: [
943
+ ee && /* @__PURE__ */ s(L, { justify: "center", p: "4", children: /* @__PURE__ */ s(Je, {}) }),
944
+ !ee && D && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(h, { size: "2", color: "red", children: D }) }),
945
+ !ee && !D && V.length === 0 && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: T ? "Select the related field first." : b || z ? "No results found." : "Type to search…" }) }),
946
+ V.map((w) => {
947
+ const P = J.has(w.id), oe = $ && !P;
948
+ return /* @__PURE__ */ s(
949
+ N,
950
+ {
951
+ px: "3",
952
+ py: "2",
953
+ onMouseDown: (we) => we.preventDefault(),
954
+ onClick: () => {
955
+ oe || Yr(w);
956
+ },
957
+ "aria-disabled": oe || void 0,
958
+ style: {
959
+ cursor: oe ? "not-allowed" : "pointer",
960
+ opacity: oe ? 0.5 : 1,
961
+ borderRadius: "var(--radius-2)",
962
+ backgroundColor: P ? "var(--accent-3)" : void 0
963
+ },
964
+ className: oe ? void 0 : "hover:bg-(--gray-3)",
965
+ children: /* @__PURE__ */ p(L, { align: "center", justify: "between", gap: "2", children: [
966
+ /* @__PURE__ */ s(h, { size: "2", children: w.name }),
967
+ d && P && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: "✓" })
968
+ ] })
755
969
  },
756
- className: "hover:bg-(--gray-3)",
757
- children: /* @__PURE__ */ l(p, { size: "2", children: E.name })
758
- },
759
- E.id
760
- )),
761
- (f == null ? void 0 : f.paginated) && k && !pe && /* @__PURE__ */ l(M, { px: "3", py: "2", children: /* @__PURE__ */ l(
762
- Ue,
970
+ w.id
971
+ );
972
+ }),
973
+ (v == null ? void 0 : v.paginated) && y && !ce && /* @__PURE__ */ s(N, { px: "3", py: "2", children: /* @__PURE__ */ s(
974
+ Re,
763
975
  {
764
976
  variant: "ghost",
765
977
  size: "1",
766
978
  style: { width: "100%" },
767
- onMouseDown: (E) => E.preventDefault(),
768
- onClick: () => void S(ee, !0),
979
+ onMouseDown: (w) => w.preventDefault(),
980
+ onClick: () => void Ke(b, !0),
769
981
  children: "Load more"
770
982
  }
771
983
  ) }),
772
- pe && /* @__PURE__ */ l($, { justify: "center", p: "2", children: /* @__PURE__ */ l(Be, {}) })
984
+ ce && /* @__PURE__ */ s(L, { justify: "center", p: "2", children: /* @__PURE__ */ s(Je, {}) })
773
985
  ] }) })
774
986
  }
775
987
  )
776
988
  ] }),
777
- !Y && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Re(o, n) }),
778
- c.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: c.description })
989
+ !re && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(o, n) }),
990
+ c.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: c.description })
779
991
  ] }) });
780
- }, yn = be(gn), bn = ie(
781
- 3,
782
- ze((e) => {
783
- const r = e["x-search"];
784
- return (e.type === "string" || e.type === "object") && typeof (r == null ? void 0 : r.service) == "string" && r.service !== "";
785
- })
786
- ), vn = (e) => {
992
+ }, wo = Ee(vo), Eo = (e) => {
787
993
  if (e)
788
994
  return /^\d{2}:\d{2}$/.test(e) ? `${e}:00` : e;
789
- }, Rt = (e, r) => {
995
+ }, Yt = (e, r) => {
790
996
  if (!e) return "";
791
997
  const t = e.match(/^(\d{2}:\d{2})(:\d{2})?/);
792
998
  return t ? r ? `${t[1]}${t[2] ?? ":00"}` : t[1] : e;
793
- }, wn = (e, r) => Kt(`${e}T${r}`).format(), En = ({ path: e, label: r, required: t, errors: n, description: i, children: o }) => {
794
- const s = n.length === 0;
795
- return /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
796
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
999
+ }, xo = (e, r) => vr(`${e}T${r}`).format(), To = ({ path: e, label: r, required: t, errors: n, description: i, children: o }) => {
1000
+ const l = n.length === 0;
1001
+ return /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
1002
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", htmlFor: e, children: [
797
1003
  r,
798
1004
  " ",
799
- t && /* @__PURE__ */ l(p, { color: "red", children: "*" })
1005
+ t && /* @__PURE__ */ s(h, { color: "red", children: "*" })
800
1006
  ] }),
801
1007
  o,
802
- !s && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Re(n, r) }),
803
- i && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: i })
1008
+ !l && /* @__PURE__ */ s(h, { color: "red", size: "1", children: Oe(n, r) }),
1009
+ i && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: i })
804
1010
  ] }) });
805
- }, Tn = ({
1011
+ }, Ao = ({
806
1012
  data: e,
807
1013
  handleChange: r,
808
1014
  path: t,
809
1015
  label: n,
810
1016
  required: i,
811
1017
  errors: o,
812
- schema: s,
1018
+ schema: l,
813
1019
  uischema: a,
814
1020
  enabled: c,
815
1021
  visible: u = !0
816
1022
  }) => {
817
- var v;
818
- we(() => {
1023
+ var A;
1024
+ ye(() => {
819
1025
  u === !1 && r(t, void 0);
820
1026
  }, [u, t, r]);
821
- const d = Ae(t, i, u);
1027
+ const d = Ce(t, i, u);
822
1028
  if (u === !1)
823
1029
  return null;
824
- const y = o.length === 0, m = typeof e == "string" ? e : "", f = ((v = a == null ? void 0 : a.options) == null ? void 0 : v.showSeconds) === !0, T = f ? 1 : 60, w = (b) => /* @__PURE__ */ l(En, { path: t, label: n, required: d, errors: o, description: s.description, children: b });
825
- if (s.format === "time")
826
- return w(
827
- /* @__PURE__ */ l(
828
- Ie.Root,
1030
+ const m = o.length === 0, f = typeof e == "string" ? e : "", g = ((A = a == null ? void 0 : a.options) == null ? void 0 : A.showSeconds) === !0, E = g ? 1 : 60, v = (T) => /* @__PURE__ */ s(To, { path: t, label: n, required: d, errors: o, description: l.description, children: T });
1031
+ if (l.format === "time")
1032
+ return v(
1033
+ /* @__PURE__ */ s(
1034
+ Fe.Root,
829
1035
  {
830
1036
  type: "time",
831
- step: T,
832
- value: Rt(m, f),
833
- onChange: (b) => r(t, vn(b.target.value)),
1037
+ step: E,
1038
+ value: Yt(f, g),
1039
+ onChange: (T) => r(t, Eo(T.target.value)),
834
1040
  disabled: !c,
835
- color: y ? void 0 : "red",
1041
+ color: m ? void 0 : "red",
836
1042
  id: t
837
1043
  }
838
1044
  )
839
1045
  );
840
- const L = s.format === "date-time", [D = "", N = ""] = m.split("T"), A = Rt(N, f), R = (b, U) => {
841
- if (!b) {
1046
+ const z = l.format === "date-time", [R = "", j = ""] = f.split("T"), S = Yt(j, g), C = (T, W) => {
1047
+ if (!T) {
842
1048
  r(t, void 0);
843
1049
  return;
844
1050
  }
845
- r(t, L ? wn(b, U || "00:00") : b);
1051
+ r(t, z ? xo(T, W || "00:00") : T);
846
1052
  };
847
- return w(
848
- /* @__PURE__ */ g($, { gap: "2", align: "center", children: [
849
- /* @__PURE__ */ l(
850
- Ie.Root,
1053
+ return v(
1054
+ /* @__PURE__ */ p(L, { gap: "2", align: "center", children: [
1055
+ /* @__PURE__ */ s(
1056
+ Fe.Root,
851
1057
  {
852
1058
  type: "date",
853
- value: D,
1059
+ value: R,
854
1060
  disabled: !c,
855
- color: y ? void 0 : "red",
856
- onChange: (b) => R(b.target.value, A),
1061
+ color: m ? void 0 : "red",
1062
+ onChange: (T) => C(T.target.value, S),
857
1063
  id: t,
858
1064
  style: { flex: 1 }
859
1065
  }
860
1066
  ),
861
- L && /* @__PURE__ */ l(
862
- Ie.Root,
1067
+ z && /* @__PURE__ */ s(
1068
+ Fe.Root,
863
1069
  {
864
1070
  type: "time",
865
- step: T,
866
- value: A,
867
- disabled: !c || !D,
868
- color: y ? void 0 : "red",
869
- onChange: (b) => R(D, b.target.value),
1071
+ step: E,
1072
+ value: S,
1073
+ disabled: !c || !R,
1074
+ color: m ? void 0 : "red",
1075
+ onChange: (T) => C(R, T.target.value),
870
1076
  style: { flex: 1 }
871
1077
  }
872
1078
  )
873
1079
  ] })
874
1080
  );
875
- }, xn = ie(2, ot(xr, Ar, Rr)), An = be(Tn), Rn = ({
1081
+ }, So = ue(2, pt(un, dn, fn)), Ro = Ee(Ao), bt = "var(--form-steps-offset, 16px)", Co = (e) => e.enabled ? /* @__PURE__ */ s(Oo, { ...e }) : /* @__PURE__ */ s(Do, { ...e }), Oo = ({ uischema: e, schema: r, path: t, renderers: n, cells: i, enabled: o }) => {
1082
+ var _;
1083
+ const l = Ne(), a = l.core, c = Tr(), u = (a == null ? void 0 : a.schema) ?? r, d = a == null ? void 0 : a.data, m = a == null ? void 0 : a.ajv, f = l.config, g = (_ = l.i18n) == null ? void 0 : _.translate, E = (b, O) => _n(g, b, O), v = Cr(e, t), z = v.length, R = z, j = Se(
1084
+ () => [...(a == null ? void 0 : a.errors) ?? [], ...(a == null ? void 0 : a.additionalErrors) ?? []],
1085
+ [a == null ? void 0 : a.errors, a == null ? void 0 : a.additionalErrors]
1086
+ ), S = Se(
1087
+ () => v.map(
1088
+ (b) => $n(ut(b, d, m, f, t), j, u, t, g)
1089
+ ),
1090
+ // categories is rebuilt every render; its content follows uischema, data and rules.
1091
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1092
+ [e, t, d, m, f, j, u, g]
1093
+ ), [C, A] = Y(0), [T, W] = Y(() => {
1094
+ const b = (V, G) => S[G].length === 0 && Un(ut(V, d, m, f, t), d, t), O = v.findIndex((V, G) => !b(V, G));
1095
+ return O === -1 ? R : O;
1096
+ }), [U, F] = Y(/* @__PURE__ */ new Set()), M = Math.min(C, R), x = M === R, te = ur(() => {
1097
+ var b;
1098
+ return (b = c == null ? void 0 : c.onStepChange) == null ? void 0 : b.call(c, { step: M, count: z, last: M === R });
1099
+ });
1100
+ ye(() => {
1101
+ te();
1102
+ }, [M, z, R]);
1103
+ const H = he(null), J = he(null), B = he(M);
1104
+ if (ye(() => {
1105
+ var V, G;
1106
+ if (B.current === M) return;
1107
+ B.current = M;
1108
+ const b = H.current, O = b && parseFloat(getComputedStyle(b).scrollMarginTop) || 0;
1109
+ b && b.getBoundingClientRect().top < O && ((V = b.scrollIntoView) == null || V.call(b, { block: "start", behavior: "smooth" })), (G = J.current) == null || G.focus({ preventScroll: !0 });
1110
+ }, [M]), !z) return null;
1111
+ const le = (b) => {
1112
+ b > T && b !== M || A(b);
1113
+ }, ve = () => {
1114
+ var O, V;
1115
+ if ((O = S[M]) != null && O.length) {
1116
+ F((G) => new Set(G).add(M)), (V = c == null ? void 0 : c.onInvalidStep) == null || V.call(c);
1117
+ return;
1118
+ }
1119
+ const b = Math.min(M + 1, R);
1120
+ A(b), W((G) => Math.max(G, b));
1121
+ }, ne = [...v.map((b) => kr(b, g)), E("review")], ae = ne.length, $ = (b) => {
1122
+ var O;
1123
+ return b === M ? "current" : b < z && ((O = S[b]) != null && O.length) && (U.has(b) || b < T) ? "error" : b < T || b < z && b < M ? "done" : "todo";
1124
+ }, Z = (b, O) => {
1125
+ var V;
1126
+ return O === "error" || O === "current" && U.has(b) ? ((V = S[b]) == null ? void 0 : V.length) ?? 0 : 0;
1127
+ }, I = (b, O) => {
1128
+ if (b === R) return E("noteReview");
1129
+ if (Z(b, O) > 0) return E("noteToFix", { count: Z(b, O) });
1130
+ if (O === "done") return E("noteDone");
1131
+ const V = Pn(ut(v[b], d, m, f, t), d, t), G = V.count === 1;
1132
+ return V.kind === "items" ? E(G ? "noteItem" : "noteItems", { count: V.count }) : E(G ? "noteField" : "noteFields", { count: V.count });
1133
+ }, re = x ? void 0 : No(v[M], g), Q = S.map((b, O) => ({ index: O, p: b })).filter(({ p: b }) => b.length).map(({ index: b, p: O }) => ({
1134
+ key: String(b),
1135
+ label: `${ne[b]}: ${O.map((V) => V.label).join(", ")}`,
1136
+ onClick: () => {
1137
+ F((V) => new Set(V).add(b)), le(b);
1138
+ }
1139
+ }));
1140
+ return /* @__PURE__ */ p(L, { ref: H, gap: "5", align: "start", style: { scrollMarginTop: bt }, children: [
1141
+ /* @__PURE__ */ s(
1142
+ N,
1143
+ {
1144
+ asChild: !0,
1145
+ display: { initial: "none", sm: "block" },
1146
+ p: "4",
1147
+ style: {
1148
+ ...wt,
1149
+ flex: "0 0 248px",
1150
+ position: "sticky",
1151
+ top: bt,
1152
+ maxHeight: `calc(100vh - 2 * ${bt})`,
1153
+ overflowY: "auto"
1154
+ },
1155
+ children: /* @__PURE__ */ s("nav", { "aria-label": E("navLabel"), children: /* @__PURE__ */ s("ol", { style: { listStyle: "none", margin: 0, padding: 0 }, children: ne.map((b, O) => {
1156
+ const V = $(O);
1157
+ return /* @__PURE__ */ p("li", { style: { position: "relative" }, children: [
1158
+ O < ae - 1 && /* @__PURE__ */ s(
1159
+ "span",
1160
+ {
1161
+ "aria-hidden": !0,
1162
+ style: {
1163
+ position: "absolute",
1164
+ left: 21,
1165
+ top: 40,
1166
+ bottom: -4,
1167
+ width: 2,
1168
+ borderRadius: 1,
1169
+ background: V === "done" ? "var(--green-9)" : "var(--gray-a5)"
1170
+ }
1171
+ }
1172
+ ),
1173
+ /* @__PURE__ */ s(
1174
+ ko,
1175
+ {
1176
+ index: O,
1177
+ label: b,
1178
+ note: I(O, V),
1179
+ errorCount: Z(O, V),
1180
+ status: V,
1181
+ disabled: O > T,
1182
+ onSelect: () => le(O)
1183
+ }
1184
+ )
1185
+ ] }, `${t}-step-${O}`);
1186
+ }) }) })
1187
+ }
1188
+ ),
1189
+ /* @__PURE__ */ p(N, { style: { ...wt, flex: 1, minWidth: 0 }, children: [
1190
+ /* @__PURE__ */ p(N, { px: { initial: "4", sm: "6" }, pt: { initial: "4", sm: "5" }, pb: "4", children: [
1191
+ /* @__PURE__ */ s(
1192
+ h,
1193
+ {
1194
+ as: "p",
1195
+ size: "1",
1196
+ weight: "bold",
1197
+ color: "gray",
1198
+ style: { letterSpacing: "0.06em", textTransform: "uppercase" },
1199
+ children: E("stepOf", { step: M + 1, total: ae })
1200
+ }
1201
+ ),
1202
+ /* @__PURE__ */ s(tt, { ref: J, tabIndex: -1, size: "5", as: "h2", mt: "1", style: { outline: "none" }, children: ne[M] }),
1203
+ re && /* @__PURE__ */ s(h, { as: "p", size: "2", color: "gray", mt: "1", children: re }),
1204
+ /* @__PURE__ */ s(Tn, { value: (M + 1) / ae * 100, size: "1", mt: "4", "aria-label": E("progressLabel") })
1205
+ ] }),
1206
+ /* @__PURE__ */ p(N, { px: { initial: "4", sm: "6" }, pb: "5", "data-form-review": x ? "" : void 0, children: [
1207
+ x && (Q.length ? /* @__PURE__ */ s(Gt, { title: E("incompleteSteps"), items: Q }) : /* @__PURE__ */ s(h, { as: "p", size: "2", color: "gray", mb: "5", children: E("reviewHint") })),
1208
+ v.map((b, O) => /* @__PURE__ */ p(N, { hidden: !(x || O === M), mb: x ? "6" : void 0, children: [
1209
+ x && /* @__PURE__ */ p(
1210
+ L,
1211
+ {
1212
+ justify: "between",
1213
+ align: "center",
1214
+ mb: "3",
1215
+ pb: "2",
1216
+ style: { borderBottom: "1px solid var(--gray-a4)" },
1217
+ children: [
1218
+ /* @__PURE__ */ s(tt, { size: "3", as: "h3", children: ne[O] }),
1219
+ /* @__PURE__ */ s(
1220
+ Re,
1221
+ {
1222
+ type: "button",
1223
+ variant: "ghost",
1224
+ onClick: () => le(O),
1225
+ "aria-label": E("editStep", { step: ne[O] }),
1226
+ children: E("edit")
1227
+ }
1228
+ )
1229
+ ]
1230
+ }
1231
+ ),
1232
+ !x && U.has(O) && S[O].length > 0 && /* @__PURE__ */ s(
1233
+ Gt,
1234
+ {
1235
+ title: E("missingFields"),
1236
+ items: S[O].map((G) => ({
1237
+ key: G.path,
1238
+ label: G.label,
1239
+ onClick: () => Io(G.path)
1240
+ }))
1241
+ }
1242
+ ),
1243
+ /* @__PURE__ */ s(
1244
+ Or,
1245
+ {
1246
+ category: b,
1247
+ schema: r,
1248
+ path: t,
1249
+ renderers: n,
1250
+ cells: i,
1251
+ enabled: o && !x
1252
+ }
1253
+ )
1254
+ ] }, `${t}-${O}`))
1255
+ ] }),
1256
+ /* @__PURE__ */ p(
1257
+ L,
1258
+ {
1259
+ gap: "3",
1260
+ align: "center",
1261
+ wrap: "wrap",
1262
+ px: { initial: "4", sm: "6" },
1263
+ py: "4",
1264
+ style: {
1265
+ position: "sticky",
1266
+ bottom: 0,
1267
+ zIndex: 1,
1268
+ borderTop: "1px solid var(--gray-a5)",
1269
+ background: "var(--color-panel-solid)",
1270
+ borderRadius: "0 0 var(--radius-5) var(--radius-5)"
1271
+ },
1272
+ children: [
1273
+ M > 0 && /* @__PURE__ */ p(Re, { type: "button", variant: "ghost", color: "gray", size: "3", onClick: () => A(M - 1), children: [
1274
+ /* @__PURE__ */ s(An, {}),
1275
+ E("back")
1276
+ ] }),
1277
+ /* @__PURE__ */ s(N, { flexGrow: "1" }),
1278
+ c == null ? void 0 : c.actions,
1279
+ M < R && /* @__PURE__ */ p(Re, { type: "button", size: "3", onClick: ve, children: [
1280
+ E("continue"),
1281
+ /* @__PURE__ */ s(Sn, {})
1282
+ ] })
1283
+ ]
1284
+ }
1285
+ )
1286
+ ] })
1287
+ ] });
1288
+ }, wt = {
1289
+ background: "var(--color-panel-solid)",
1290
+ border: "1px solid var(--gray-a4)",
1291
+ borderRadius: "var(--radius-5)",
1292
+ boxShadow: "var(--shadow-2)"
1293
+ };
1294
+ function ko({
1295
+ index: e,
1296
+ label: r,
1297
+ note: t,
1298
+ errorCount: n,
1299
+ status: i,
1300
+ disabled: o,
1301
+ onSelect: l
1302
+ }) {
1303
+ return /* @__PURE__ */ s(
1304
+ "button",
1305
+ {
1306
+ type: "button",
1307
+ onClick: l,
1308
+ disabled: o,
1309
+ "aria-current": i === "current" ? "step" : void 0,
1310
+ className: "w-full rounded-md disabled:cursor-default enabled:hover:bg-[var(--gray-a2)]",
1311
+ style: { border: 0, background: "transparent", cursor: "pointer", textAlign: "left", padding: "8px 8px 12px" },
1312
+ children: /* @__PURE__ */ p(L, { gap: "3", align: "start", children: [
1313
+ /* @__PURE__ */ s(
1314
+ L,
1315
+ {
1316
+ align: "center",
1317
+ justify: "center",
1318
+ "aria-hidden": !0,
1319
+ style: {
1320
+ width: 28,
1321
+ height: 28,
1322
+ flex: "0 0 28px",
1323
+ borderRadius: "50%",
1324
+ fontSize: 13,
1325
+ fontWeight: 600,
1326
+ ...{
1327
+ done: { background: "var(--green-9)", color: "white" },
1328
+ current: {
1329
+ background: "var(--color-panel-solid)",
1330
+ color: "var(--accent-11)",
1331
+ boxShadow: "inset 0 0 0 2px var(--accent-9)"
1332
+ },
1333
+ error: { background: "var(--red-9)", color: "white" },
1334
+ todo: {
1335
+ background: "var(--color-panel-solid)",
1336
+ color: "var(--gray-11)",
1337
+ boxShadow: "inset 0 0 0 2px var(--gray-a6)"
1338
+ }
1339
+ }[i]
1340
+ },
1341
+ children: i === "done" ? /* @__PURE__ */ s(Rn, { width: 16, height: 16 }) : e + 1
1342
+ }
1343
+ ),
1344
+ /* @__PURE__ */ p(N, { style: { minWidth: 0, flex: 1, paddingTop: 2 }, children: [
1345
+ /* @__PURE__ */ p(L, { align: "center", gap: "2", justify: "between", children: [
1346
+ /* @__PURE__ */ s(
1347
+ h,
1348
+ {
1349
+ size: "2",
1350
+ weight: i === "current" ? "bold" : "medium",
1351
+ style: { color: i === "current" ? "var(--accent-11)" : "var(--gray-12)" },
1352
+ children: r
1353
+ }
1354
+ ),
1355
+ n > 0 && /* @__PURE__ */ s(
1356
+ L,
1357
+ {
1358
+ align: "center",
1359
+ justify: "center",
1360
+ "aria-hidden": !0,
1361
+ "data-testid": "step-error-count",
1362
+ style: {
1363
+ minWidth: 20,
1364
+ height: 20,
1365
+ padding: "0 6px",
1366
+ boxSizing: "border-box",
1367
+ borderRadius: 10,
1368
+ background: "var(--red-9)",
1369
+ color: "white",
1370
+ fontSize: 12,
1371
+ fontWeight: 600,
1372
+ lineHeight: 1,
1373
+ flexShrink: 0
1374
+ },
1375
+ children: n
1376
+ }
1377
+ )
1378
+ ] }),
1379
+ /* @__PURE__ */ s(h, { as: "p", size: "1", color: n > 0 ? "red" : "gray", children: t })
1380
+ ] })
1381
+ ] })
1382
+ }
1383
+ );
1384
+ }
1385
+ function Io(e) {
1386
+ var t;
1387
+ const r = document.getElementById(e);
1388
+ (t = r == null ? void 0 : r.scrollIntoView) == null || t.call(r, { block: "center" }), r == null || r.focus();
1389
+ }
1390
+ function Gt({
1391
+ title: e,
1392
+ items: r
1393
+ }) {
1394
+ return /* @__PURE__ */ p(gt.Root, { color: "red", mb: "4", role: "alert", children: [
1395
+ /* @__PURE__ */ s(gt.Icon, { children: /* @__PURE__ */ s(ht, {}) }),
1396
+ /* @__PURE__ */ s(gt.Text, { children: e }),
1397
+ /* @__PURE__ */ s("ul", { style: { margin: 0, paddingLeft: 20 }, children: r.map((t) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(Re, { type: "button", variant: "ghost", color: "red", size: "1", onClick: t.onClick, children: t.label }) }, t.key)) })
1398
+ ] });
1399
+ }
1400
+ const Do = ({ uischema: e, schema: r, path: t, renderers: n, cells: i }) => {
1401
+ var d;
1402
+ const o = (d = Ne().i18n) == null ? void 0 : d.translate, l = Tr(), a = Cr(e, t), c = a.length, u = ur(() => {
1403
+ var m;
1404
+ return (m = l == null ? void 0 : l.onStepChange) == null ? void 0 : m.call(l, { step: c, count: c, last: !0 });
1405
+ });
1406
+ return ye(() => {
1407
+ u();
1408
+ }, [c]), /* @__PURE__ */ s(L, { direction: "column", gap: "6", p: { initial: "4", sm: "6" }, style: wt, "data-form-review": "", children: a.map((m, f) => /* @__PURE__ */ p(N, { children: [
1409
+ /* @__PURE__ */ s(tt, { size: "3", as: "h3", mb: "3", children: kr(m, o) }),
1410
+ /* @__PURE__ */ s(
1411
+ Or,
1412
+ {
1413
+ category: m,
1414
+ schema: r,
1415
+ path: t,
1416
+ renderers: n,
1417
+ cells: i,
1418
+ enabled: !1
1419
+ }
1420
+ )
1421
+ ] }, `${t}-${f}`)) });
1422
+ };
1423
+ function Cr(e, r) {
1424
+ var l, a;
1425
+ const t = Ne(), n = (l = t.core) == null ? void 0 : l.ajv, i = (a = t.core) == null ? void 0 : a.data, o = t.config;
1426
+ return zn(e).filter((c) => !c.rule || !n || dr(c, i, r, n, o));
1427
+ }
1428
+ function Or({
1429
+ category: e,
1430
+ schema: r,
1431
+ path: t,
1432
+ renderers: n,
1433
+ cells: i,
1434
+ enabled: o
1435
+ }) {
1436
+ return /* @__PURE__ */ s(L, { direction: "column", gap: "4", children: e.elements.map((l, a) => /* @__PURE__ */ s(
1437
+ Qe,
1438
+ {
1439
+ uischema: l,
1440
+ schema: r,
1441
+ path: t,
1442
+ renderers: n,
1443
+ cells: i,
1444
+ enabled: o
1445
+ },
1446
+ `${t}-${a}`
1447
+ )) });
1448
+ }
1449
+ function kr(e, r) {
1450
+ return pn(e, r ?? nt) ?? e.label;
1451
+ }
1452
+ function No(e, r) {
1453
+ var i;
1454
+ const t = (i = e == null ? void 0 : e.options) == null ? void 0 : i.description;
1455
+ if (!e || !t) return;
1456
+ const n = hn(void 0, e);
1457
+ return (r ?? nt)(n ? `${n}.description` : t, t);
1458
+ }
1459
+ const Lo = ({
876
1460
  uischema: e,
877
1461
  schema: r,
878
1462
  path: t,
879
1463
  renderers: n,
880
1464
  cells: i,
881
1465
  enabled: o,
882
- visible: s = !0
1466
+ visible: l = !0
883
1467
  }) => {
884
1468
  const c = e.elements;
885
- return s === !1 ? null : /* @__PURE__ */ l($, { direction: "column", gap: "4", children: c.map((u, d) => /* @__PURE__ */ l(
886
- Ge,
1469
+ return l === !1 ? null : /* @__PURE__ */ s(L, { direction: "column", gap: "4", children: c.map((u, d) => /* @__PURE__ */ s(
1470
+ Qe,
887
1471
  {
888
1472
  uischema: u,
889
1473
  schema: r,
@@ -894,18 +1478,18 @@ const mn = {
894
1478
  },
895
1479
  `${t}-${d}`
896
1480
  )) });
897
- }, Cn = ie(1, Ye("VerticalLayout")), Sn = ({
1481
+ }, zo = ue(1, ot("VerticalLayout")), Mo = ({
898
1482
  uischema: e,
899
1483
  schema: r,
900
1484
  path: t,
901
1485
  renderers: n,
902
1486
  cells: i,
903
1487
  enabled: o,
904
- visible: s = !0
1488
+ visible: l = !0
905
1489
  }) => {
906
1490
  const c = e.elements;
907
- return s === !1 ? null : /* @__PURE__ */ l($, { direction: "row", gap: "4", children: c.map((u, d) => /* @__PURE__ */ l(M, { style: { flex: 1 }, children: /* @__PURE__ */ l(
908
- Ge,
1491
+ return l === !1 ? null : /* @__PURE__ */ s(L, { direction: "row", gap: "4", children: c.map((u, d) => /* @__PURE__ */ s(N, { style: { flex: 1 }, children: /* @__PURE__ */ s(
1492
+ Qe,
909
1493
  {
910
1494
  uischema: u,
911
1495
  schema: r,
@@ -915,20 +1499,20 @@ const mn = {
915
1499
  enabled: o
916
1500
  }
917
1501
  ) }, `${t}-${d}`)) });
918
- }, On = ie(1, Ye("HorizontalLayout")), Nn = ({
1502
+ }, Fo = ue(1, ot("HorizontalLayout")), $o = ({
919
1503
  uischema: e,
920
1504
  schema: r,
921
1505
  path: t,
922
1506
  renderers: n,
923
1507
  cells: i,
924
1508
  enabled: o,
925
- visible: s = !0
1509
+ visible: l = !0
926
1510
  }) => {
927
1511
  const a = e, c = a.elements;
928
- return s === !1 ? null : /* @__PURE__ */ g(M, { mb: "6", children: [
929
- a.label && /* @__PURE__ */ l(Bt, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: a.label }),
930
- /* @__PURE__ */ l($, { direction: "column", gap: "4", children: c.map((u, d) => /* @__PURE__ */ l(
931
- Ge,
1512
+ return l === !1 ? null : /* @__PURE__ */ p(N, { mb: "6", children: [
1513
+ a.label && /* @__PURE__ */ s(tt, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: a.label }),
1514
+ /* @__PURE__ */ s(L, { direction: "column", gap: "4", children: c.map((u, d) => /* @__PURE__ */ s(
1515
+ Qe,
932
1516
  {
933
1517
  uischema: u,
934
1518
  schema: r,
@@ -940,226 +1524,228 @@ const mn = {
940
1524
  `${t}-${d}`
941
1525
  )) })
942
1526
  ] });
943
- }, Dn = ie(1, Ye("Group")), In = ({
944
- uischema: e,
945
- schema: r,
946
- path: t,
947
- renderers: n,
948
- cells: i,
949
- enabled: o,
950
- visible: s = !0
951
- }) => {
1527
+ }, Po = ue(1, ot("Group")), Uo = (e) => e.visible === !1 ? null : Ln(e.uischema) ? /* @__PURE__ */ s(
1528
+ Co,
1529
+ {
1530
+ uischema: e.uischema,
1531
+ schema: e.schema,
1532
+ path: e.path,
1533
+ renderers: e.renderers,
1534
+ cells: e.cells,
1535
+ enabled: e.enabled
1536
+ }
1537
+ ) : /* @__PURE__ */ s(jo, { ...e }), jo = ({ uischema: e, schema: r, path: t, renderers: n, cells: i, enabled: o }) => {
952
1538
  var m;
953
- const c = e.elements.filter((f) => f.type === "Category"), [u, d] = B(((m = c[0]) == null ? void 0 : m.label) || "");
954
- if (s === !1 || !c.length) return null;
955
- const y = c.find((f) => f.label === u) ? u : c[0].label;
956
- return /* @__PURE__ */ g(et.Root, { value: y, onValueChange: d, children: [
957
- /* @__PURE__ */ l(et.List, { children: c.map((f, T) => /* @__PURE__ */ l(et.Trigger, { value: f.label, children: f.label }, `${t}-${T}`)) }),
958
- /* @__PURE__ */ l(M, { pt: "3", children: c.map((f, T) => /* @__PURE__ */ l(et.Content, { value: f.label, children: /* @__PURE__ */ l($, { direction: "column", gap: "4", children: f.elements.map((w, L) => /* @__PURE__ */ l(
959
- Ge,
1539
+ const a = e.elements.filter((f) => f.type === "Category"), [c, u] = Y(((m = a[0]) == null ? void 0 : m.label) || "");
1540
+ if (!a.length) return null;
1541
+ const d = a.find((f) => f.label === c) ? c : a[0].label;
1542
+ return /* @__PURE__ */ p(at.Root, { value: d, onValueChange: u, children: [
1543
+ /* @__PURE__ */ s(at.List, { children: a.map((f, g) => /* @__PURE__ */ s(at.Trigger, { value: f.label, children: f.label }, `${t}-${g}`)) }),
1544
+ /* @__PURE__ */ s(N, { pt: "3", children: a.map((f, g) => /* @__PURE__ */ s(at.Content, { value: f.label, children: /* @__PURE__ */ s(L, { direction: "column", gap: "4", children: f.elements.map((E, v) => /* @__PURE__ */ s(
1545
+ Qe,
960
1546
  {
961
- uischema: w,
1547
+ uischema: E,
962
1548
  schema: r,
963
1549
  path: t,
964
1550
  renderers: n,
965
1551
  cells: i,
966
1552
  enabled: o
967
1553
  },
968
- `${t}-${T}-${L}`
969
- )) }) }, `${t}-${T}`)) })
1554
+ `${t}-${g}-${v}`
1555
+ )) }) }, `${t}-${g}`)) })
970
1556
  ] });
971
- }, kn = ie(1, Ye("Categorization"));
972
- function Ce(e) {
1557
+ }, _o = ue(1, ot("Categorization"));
1558
+ function Ie(e) {
973
1559
  return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
974
1560
  }
975
- function Se(e) {
1561
+ function De(e) {
976
1562
  const r = e.split(",").map((o) => o.trim()).filter(Boolean), t = r.filter((o) => o.startsWith(".")), i = (t.length > 0 ? t : r).map((o) => {
977
1563
  if (o.endsWith("/*")) return o.split("/")[0].toUpperCase() + "S";
978
1564
  if (o.startsWith(".")) return o.slice(1).toUpperCase();
979
- const s = o.split("/")[1];
980
- return s ? s.toUpperCase() : o;
1565
+ const l = o.split("/")[1];
1566
+ return l ? l.toUpperCase() : o;
981
1567
  });
982
1568
  return [...new Set(i)].join(", ");
983
1569
  }
984
- const Ln = "image/png,image/jpeg,image/gif,image/webp,application/pdf,text/html,text/plain,.png,.jpg,.jpeg,.gif,.webp,.pdf,.html,.htm,.txt";
985
- function Zt(e, r) {
1570
+ const Vo = "image/png,image/jpeg,image/gif,image/webp,application/pdf,text/html,text/plain,.png,.jpg,.jpeg,.gif,.webp,.pdf,.html,.htm,.txt";
1571
+ function Ir(e, r) {
986
1572
  return r.split(",").map((n) => n.trim()).filter(Boolean).some((n) => n === "*" || n === "*/*" ? !0 : n.endsWith("/*") ? (e.type ?? "").startsWith(n.slice(0, -1)) : n.startsWith(".") ? e.name.toLowerCase().endsWith(n.toLowerCase()) : e.type === n);
987
1573
  }
988
- function Mn(e) {
989
- const r = !!e.type, t = ct(e.name) !== void 0;
990
- return !r && !t ? !0 : Zt(e, Ln);
1574
+ function Wo(e) {
1575
+ const r = !!e.type, t = Et(e.name) !== void 0;
1576
+ return !r && !t ? !0 : Ir(e, Vo);
991
1577
  }
992
- function ct(e) {
1578
+ function Et(e) {
993
1579
  const r = e.split(/[/\\]/).pop() ?? e, t = r.lastIndexOf(".");
994
1580
  if (!(t <= 0 || t === r.length - 1))
995
1581
  return r.slice(t);
996
1582
  }
997
- function zn(e, r, t) {
998
- Qt(new Blob([e], { type: t }), r);
1583
+ function Ho(e, r, t) {
1584
+ Dr(new Blob([e], { type: t }), r);
999
1585
  }
1000
- function Qt(e, r) {
1586
+ function Dr(e, r) {
1001
1587
  const t = URL.createObjectURL(e), n = document.createElement("a");
1002
1588
  n.href = t, n.download = r, n.click(), setTimeout(() => URL.revokeObjectURL(t), 0);
1003
1589
  }
1004
- async function Fn(e, r) {
1590
+ async function Bo(e, r) {
1005
1591
  const t = await fetch(e);
1006
1592
  if (!t.ok) throw new Error(`Download failed (${t.status})`);
1007
- Qt(await t.blob(), r);
1593
+ Dr(await t.blob(), r);
1008
1594
  }
1009
- function $n(e, r, t) {
1595
+ function Xo(e, r, t) {
1010
1596
  const n = t.name || t.key;
1011
1597
  if (!e) return n;
1012
- const i = mt(e, r, n), o = ct(t.name ?? "") ?? ct(t.key);
1598
+ const i = It(e, r, n), o = Et(t.name ?? "") ?? Et(t.key);
1013
1599
  return !o || i.toLowerCase().endsWith(o.toLowerCase()) ? i : `${i}${o}`;
1014
1600
  }
1015
- const Un = /* @__PURE__ */ new Set(["/", "\\", "<", ">", ":", '"', "|", "?", "*"]), Pn = (e) => Un.has(e) || e.charCodeAt(0) < 32 || e.charCodeAt(0) === 127;
1016
- function _n(e, r) {
1017
- const t = Array.from(e, (n) => Pn(n) ? "_" : n).join("").trim();
1601
+ const qo = /* @__PURE__ */ new Set(["/", "\\", "<", ">", ":", '"', "|", "?", "*"]), Ko = (e) => qo.has(e) || e.charCodeAt(0) < 32 || e.charCodeAt(0) === 127;
1602
+ function Yo(e, r) {
1603
+ const t = Array.from(e, (n) => Ko(n) ? "_" : n).join("").trim();
1018
1604
  return t === "" || t.startsWith(".") ? r : t;
1019
1605
  }
1020
- function mt(e, r, t) {
1606
+ function It(e, r, t) {
1021
1607
  const n = r !== null && typeof r == "object" && !Array.isArray(r) ? r : {};
1022
- return _n(it(e, n), t);
1608
+ return Yo(mt(e, n), t);
1023
1609
  }
1024
- function jn(e) {
1610
+ function Go(e) {
1025
1611
  return e ? Array.isArray(e) ? e : [e] : [];
1026
1612
  }
1027
- const Vn = ({
1613
+ const Jo = ({
1028
1614
  data: e,
1029
1615
  handleChange: r,
1030
1616
  path: t,
1031
1617
  label: n,
1032
1618
  required: i,
1033
1619
  uischema: o,
1034
- schema: s,
1620
+ schema: l,
1035
1621
  enabled: a,
1036
1622
  errors: c,
1037
1623
  visible: u = !0
1038
1624
  }) => {
1039
- const d = Ur();
1040
- Oe(u, t, r);
1041
- const y = Ae(t, i, u), m = !c || c.length === 0, f = (s == null ? void 0 : s["x-file"]) ?? {}, T = (o == null ? void 0 : o.options) ?? {}, w = f.maxFiles ?? T.maxFiles ?? 1, L = f.maxSize ?? T.maxSize ?? 5 * 1024 * 1024, D = f.accept ?? T.accept ?? "image/*,application/pdf", N = typeof f.fileName == "string" ? f.fileName : void 0, A = w > 1, R = a !== !1, [v, b] = B(!1), [U, P] = B(null), [O, j] = B({}), [I, ne] = B({}), Y = ge(/* @__PURE__ */ new Set()), z = ge(null), _ = jn(e), ee = _.length >= w, fe = (h) => {
1042
- const x = I[h];
1043
- return { name: (x == null ? void 0 : x.name) ?? h, type: x == null ? void 0 : x.type };
1044
- }, oe = async (h) => {
1045
- var Q, X;
1046
- const x = (Q = I[h]) == null ? void 0 : Q.blobUrl;
1047
- if (x) return x;
1048
- const V = await ((X = d == null ? void 0 : d.getDownloadUrl) == null ? void 0 : X.call(d, h));
1049
- return V == null ? void 0 : V.url;
1050
- }, te = (h, x) => {
1051
- j((V) => ({ ...V, [h]: x }));
1052
- }, k = (h) => {
1053
- j((x) => {
1054
- if (!x[h]) return x;
1055
- const V = { ...x };
1056
- return delete V[h], V;
1625
+ const d = Dn();
1626
+ Le(u, t, r);
1627
+ const m = Ce(t, i, u), f = !c || c.length === 0, g = (l == null ? void 0 : l["x-file"]) ?? {}, E = (o == null ? void 0 : o.options) ?? {}, v = g.maxFiles ?? E.maxFiles ?? 1, z = g.maxSize ?? E.maxSize ?? 5 * 1024 * 1024, R = g.accept ?? E.accept ?? "image/*,application/pdf", j = typeof g.fileName == "string" ? g.fileName : void 0, S = v > 1, C = a !== !1, [A, T] = Y(!1), [W, U] = Y(null), [F, M] = Y({}), [x, te] = Y({}), H = he(/* @__PURE__ */ new Set()), J = he(null), B = Go(e), le = B.length >= v, ve = (y) => {
1628
+ const k = x[y];
1629
+ return { name: (k == null ? void 0 : k.name) ?? y, type: k == null ? void 0 : k.type };
1630
+ }, ne = async (y) => {
1631
+ var se, ce;
1632
+ const k = (se = x[y]) == null ? void 0 : se.blobUrl;
1633
+ if (k) return k;
1634
+ const ee = await ((ce = d == null ? void 0 : d.getDownloadUrl) == null ? void 0 : ce.call(d, y));
1635
+ return ee == null ? void 0 : ee.url;
1636
+ }, ae = (y, k) => {
1637
+ M((ee) => ({ ...ee, [y]: k }));
1638
+ }, $ = (y) => {
1639
+ M((k) => {
1640
+ if (!k[y]) return k;
1641
+ const ee = { ...k };
1642
+ return delete ee[y], ee;
1057
1643
  });
1058
1644
  };
1059
- we(() => () => {
1060
- Y.current.forEach((h) => URL.revokeObjectURL(h)), Y.current.clear();
1645
+ ye(() => () => {
1646
+ H.current.forEach((y) => URL.revokeObjectURL(y)), H.current.clear();
1061
1647
  }, []);
1062
- const G = We(
1063
- async (h) => {
1064
- if (P(null), _.length >= w) {
1065
- P(`Maximum ${w} file${w > 1 ? "s" : ""} allowed.`);
1648
+ const Z = Be(
1649
+ async (y) => {
1650
+ if (U(null), B.length >= v) {
1651
+ U(`Maximum ${v} file${v > 1 ? "s" : ""} allowed.`);
1066
1652
  return;
1067
1653
  }
1068
- if (h.size > L) {
1069
- P(`File exceeds the ${Ce(L)} limit.`);
1654
+ if (y.size > z) {
1655
+ U(`File exceeds the ${Ie(z)} limit.`);
1070
1656
  return;
1071
1657
  }
1072
- if (!Zt(h, D)) {
1073
- P(`Invalid type. Accepted: ${Se(D)}`);
1658
+ if (!Ir(y, R)) {
1659
+ U(`Invalid type. Accepted: ${De(R)}`);
1074
1660
  return;
1075
1661
  }
1076
1662
  if (!(d != null && d.onUpload)) {
1077
- P("Upload service not configured.");
1663
+ U("Upload service not configured.");
1078
1664
  return;
1079
1665
  }
1080
1666
  try {
1081
- const x = await d.onUpload(h), V = URL.createObjectURL(h);
1082
- Y.current.add(V);
1083
- const Q = {
1084
- key: x.key,
1085
- name: x.name ?? h.name,
1086
- type: h.type || void 0,
1087
- blobUrl: V
1667
+ const k = await d.onUpload(y), ee = URL.createObjectURL(y);
1668
+ H.current.add(ee);
1669
+ const se = {
1670
+ key: k.key,
1671
+ name: k.name ?? y.name,
1672
+ type: y.type || void 0,
1673
+ blobUrl: ee
1088
1674
  };
1089
- ne((me) => ({ ...me, [x.key]: Q }));
1090
- const X = [..._, x.key];
1091
- r(t, A ? X : X[0]);
1675
+ te((me) => ({ ...me, [k.key]: se }));
1676
+ const ce = [...B, k.key];
1677
+ r(t, S ? ce : ce[0]);
1092
1678
  } catch {
1093
- P("Upload failed. Please try again."), z.current && (z.current.value = "");
1679
+ U("Upload failed. Please try again."), J.current && (J.current.value = "");
1094
1680
  }
1095
1681
  },
1096
- [_, w, L, D, d, t, r, A]
1682
+ [B, v, z, R, d, t, r, S]
1097
1683
  );
1098
1684
  if (u === !1)
1099
1685
  return null;
1100
- const C = (h) => {
1101
- h.preventDefault(), h.stopPropagation(), !(!R || ee) && b(h.type === "dragenter" || h.type === "dragover");
1102
- }, J = (h) => {
1103
- var x;
1104
- h.preventDefault(), h.stopPropagation(), b(!1), !(!R || ee) && (x = h.dataTransfer.files) != null && x[0] && G(h.dataTransfer.files[0]);
1105
- }, pe = (h) => {
1106
- var x;
1107
- (x = h.target.files) != null && x[0] && (G(h.target.files[0]), h.target.value = "");
1108
- }, F = (h) => {
1109
- if (!R) return;
1110
- ne((V) => {
1686
+ const I = (y) => {
1687
+ y.preventDefault(), y.stopPropagation(), !(!C || le) && T(y.type === "dragenter" || y.type === "dragover");
1688
+ }, re = (y) => {
1689
+ var k;
1690
+ y.preventDefault(), y.stopPropagation(), T(!1), !(!C || le) && (k = y.dataTransfer.files) != null && k[0] && Z(y.dataTransfer.files[0]);
1691
+ }, Q = (y) => {
1692
+ var k;
1693
+ (k = y.target.files) != null && k[0] && (Z(y.target.files[0]), y.target.value = "");
1694
+ }, _ = (y) => {
1695
+ if (!C) return;
1696
+ te((ee) => {
1111
1697
  var me;
1112
- const Q = { ...V }, X = (me = Q[h]) == null ? void 0 : me.blobUrl;
1113
- return X && (URL.revokeObjectURL(X), Y.current.delete(X)), delete Q[h], Q;
1114
- }), k(h);
1115
- const x = _.filter((V) => V !== h);
1116
- r(t, A ? x.length > 0 ? x : void 0 : x[0]);
1117
- }, Z = async (h, x) => {
1118
- var X, me;
1119
- h.preventDefault(), k(x);
1120
- const V = (X = I[x]) == null ? void 0 : X.blobUrl;
1121
- if (V) {
1122
- (me = window.open(V, "_blank", "noopener,noreferrer")) == null || me.focus();
1698
+ const se = { ...ee }, ce = (me = se[y]) == null ? void 0 : me.blobUrl;
1699
+ return ce && (URL.revokeObjectURL(ce), H.current.delete(ce)), delete se[y], se;
1700
+ }), $(y);
1701
+ const k = B.filter((ee) => ee !== y);
1702
+ r(t, S ? k.length > 0 ? k : void 0 : k[0]);
1703
+ }, b = async (y, k) => {
1704
+ var ce, me;
1705
+ y.preventDefault(), $(k);
1706
+ const ee = (ce = x[k]) == null ? void 0 : ce.blobUrl;
1707
+ if (ee) {
1708
+ (me = window.open(ee, "_blank", "noopener,noreferrer")) == null || me.focus();
1123
1709
  return;
1124
1710
  }
1125
- const Q = window.open("", "_blank");
1126
- if (Q)
1711
+ const se = window.open("", "_blank");
1712
+ if (se)
1127
1713
  try {
1128
- const S = await oe(x);
1129
- S ? Q.location.href = S : (Q.close(), te(x, "Unable to open file."));
1714
+ const D = await ne(k);
1715
+ D ? se.location.href = D : (se.close(), ae(k, "Unable to open file."));
1130
1716
  } catch {
1131
- Q.close(), te(x, "Unable to open file.");
1717
+ se.close(), ae(k, "Unable to open file.");
1132
1718
  }
1133
- }, le = async (h, x) => {
1134
- k(h);
1719
+ }, O = async (y, k) => {
1720
+ $(y);
1135
1721
  try {
1136
- const V = await oe(h);
1137
- if (!V) {
1138
- te(h, "Unable to download file.");
1722
+ const ee = await ne(y);
1723
+ if (!ee) {
1724
+ ae(y, "Unable to download file.");
1139
1725
  return;
1140
1726
  }
1141
- await Fn(V, x);
1727
+ await Bo(ee, k);
1142
1728
  } catch {
1143
- te(h, "Unable to download file.");
1729
+ ae(y, "Unable to download file.");
1144
1730
  }
1145
1731
  };
1146
- if (!R && _.length === 0) return null;
1147
- const ye = w - _.length, he = R && !ee;
1148
- return /* @__PURE__ */ g(M, { mb: "4", children: [
1149
- /* @__PURE__ */ g($, { align: "center", justify: "between", mb: "2", children: [
1150
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", children: [
1732
+ if (!C && B.length === 0) return null;
1733
+ const V = v - B.length, G = C && !le;
1734
+ return /* @__PURE__ */ p(N, { mb: "4", children: [
1735
+ /* @__PURE__ */ p(L, { align: "center", justify: "between", mb: "2", children: [
1736
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", children: [
1151
1737
  n,
1152
- y && /* @__PURE__ */ l(p, { color: "red", children: " *" })
1738
+ m && /* @__PURE__ */ s(h, { color: "red", children: " *" })
1153
1739
  ] }),
1154
- /* @__PURE__ */ l(p, { size: "1", color: "gray", children: A ? `Up to ${w} files · ${Ce(L)} each · ${Se(D)}` : `${Ce(L)} · ${Se(D)}` })
1740
+ /* @__PURE__ */ s(h, { size: "1", color: "gray", children: S ? `Up to ${v} files · ${Ie(z)} each · ${De(R)}` : `${Ie(z)} · ${De(R)}` })
1155
1741
  ] }),
1156
- _.map((h, x) => {
1157
- var q;
1158
- const V = x + 1, Q = (q = I[h]) == null ? void 0 : q.name, X = $n(N, { index: V }, { name: Q, key: h }), me = N ? X : Q ?? "Uploaded File", S = !!(N && Q), W = O[h], ce = Mn(fe(h));
1159
- return /* @__PURE__ */ g(Xt, { size: "2", variant: "surface", mb: "2", children: [
1160
- /* @__PURE__ */ g($, { align: "center", gap: "3", children: [
1161
- /* @__PURE__ */ l(
1162
- M,
1742
+ B.map((y, k) => {
1743
+ var K;
1744
+ const ee = k + 1, se = (K = x[y]) == null ? void 0 : K.name, ce = Xo(j, { index: ee }, { name: se, key: y }), me = j ? ce : se ?? "Uploaded File", D = !!(j && se), X = F[y], de = Wo(ve(y));
1745
+ return /* @__PURE__ */ p(yr, { size: "2", variant: "surface", mb: "2", children: [
1746
+ /* @__PURE__ */ p(L, { align: "center", gap: "3", children: [
1747
+ /* @__PURE__ */ s(
1748
+ N,
1163
1749
  {
1164
1750
  style: {
1165
1751
  background: "var(--blue-3)",
@@ -1168,12 +1754,12 @@ const Vn = ({
1168
1754
  color: "var(--blue-9)",
1169
1755
  flexShrink: 0
1170
1756
  },
1171
- children: /* @__PURE__ */ l(Mr, { width: "20", height: "20" })
1757
+ children: /* @__PURE__ */ s(Cn, { width: "20", height: "20" })
1172
1758
  }
1173
1759
  ),
1174
- /* @__PURE__ */ g(M, { style: { flex: 1, overflow: "hidden" }, children: [
1175
- /* @__PURE__ */ l(
1176
- p,
1760
+ /* @__PURE__ */ p(N, { style: { flex: 1, overflow: "hidden" }, children: [
1761
+ /* @__PURE__ */ s(
1762
+ h,
1177
1763
  {
1178
1764
  size: "2",
1179
1765
  weight: "bold",
@@ -1186,8 +1772,8 @@ const Vn = ({
1186
1772
  children: me
1187
1773
  }
1188
1774
  ),
1189
- S && /* @__PURE__ */ l(
1190
- p,
1775
+ D && /* @__PURE__ */ s(
1776
+ h,
1191
1777
  {
1192
1778
  size: "1",
1193
1779
  color: "gray",
@@ -1197,83 +1783,83 @@ const Vn = ({
1197
1783
  textOverflow: "ellipsis",
1198
1784
  whiteSpace: "nowrap"
1199
1785
  },
1200
- children: Q
1786
+ children: se
1201
1787
  }
1202
1788
  )
1203
1789
  ] }),
1204
- /* @__PURE__ */ g($, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
1205
- ce && /* @__PURE__ */ l(Ue, { variant: "soft", color: "blue", size: "1", onClick: (H) => void Z(H, h), children: "View" }),
1206
- /* @__PURE__ */ l(Ke, { content: "Download", children: /* @__PURE__ */ l(
1207
- Xe,
1790
+ /* @__PURE__ */ p(L, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
1791
+ de && /* @__PURE__ */ s(Re, { variant: "soft", color: "blue", size: "1", onClick: (q) => void b(q, y), children: "View" }),
1792
+ /* @__PURE__ */ s(rt, { content: "Download", children: /* @__PURE__ */ s(
1793
+ Ze,
1208
1794
  {
1209
1795
  variant: "ghost",
1210
1796
  color: "gray",
1211
1797
  "aria-label": "Download",
1212
- onClick: () => void le(h, X),
1213
- children: /* @__PURE__ */ l(dt, {})
1798
+ onClick: () => void O(y, ce),
1799
+ children: /* @__PURE__ */ s(Rt, {})
1214
1800
  }
1215
1801
  ) }),
1216
- /* @__PURE__ */ l(zr, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
1217
- R && /* @__PURE__ */ l(Xe, { variant: "ghost", color: "gray", onClick: () => F(h), children: /* @__PURE__ */ l(ft, {}) })
1802
+ /* @__PURE__ */ s(On, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
1803
+ C && /* @__PURE__ */ s(Ze, { variant: "ghost", color: "gray", onClick: () => _(y), children: /* @__PURE__ */ s(Ct, {}) })
1218
1804
  ] })
1219
1805
  ] }),
1220
- W && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: W })
1221
- ] }, h);
1806
+ X && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: X })
1807
+ ] }, y);
1222
1808
  }),
1223
- he && /* @__PURE__ */ g(
1809
+ G && /* @__PURE__ */ p(
1224
1810
  "div",
1225
1811
  {
1226
1812
  role: "button",
1227
1813
  tabIndex: 0,
1228
1814
  onClick: () => {
1229
- var h;
1230
- return (h = z.current) == null ? void 0 : h.click();
1815
+ var y;
1816
+ return (y = J.current) == null ? void 0 : y.click();
1231
1817
  },
1232
- onKeyDown: (h) => {
1233
- var x;
1234
- (h.key === "Enter" || h.key === " ") && (h.preventDefault(), (x = z.current) == null || x.click());
1818
+ onKeyDown: (y) => {
1819
+ var k;
1820
+ (y.key === "Enter" || y.key === " ") && (y.preventDefault(), (k = J.current) == null || k.click());
1235
1821
  },
1236
- onDragEnter: C,
1237
- onDragLeave: C,
1238
- onDragOver: C,
1239
- onDrop: J,
1822
+ onDragEnter: I,
1823
+ onDragLeave: I,
1824
+ onDragOver: I,
1825
+ onDrop: re,
1240
1826
  style: { cursor: "pointer" },
1241
1827
  className: [
1242
1828
  "border-2 border-dashed rounded-lg p-6 text-center",
1243
1829
  "transition-all duration-200 ease-in-out",
1244
- v ? "border-blue-500 bg-blue-50" : U ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
1830
+ A ? "border-blue-500 bg-blue-50" : W ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
1245
1831
  ].join(" "),
1246
1832
  children: [
1247
- /* @__PURE__ */ l("input", { ref: z, type: "file", style: { display: "none" }, accept: D, onChange: pe }),
1248
- /* @__PURE__ */ l($, { direction: "column", align: "center", gap: "2", children: U ? /* @__PURE__ */ g(xe, { children: [
1249
- /* @__PURE__ */ l(pt, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
1250
- /* @__PURE__ */ l(p, { size: "2", color: "red", weight: "medium", children: U }),
1251
- /* @__PURE__ */ l(p, { size: "1", color: "gray", children: "Click to try again" })
1252
- ] }) : /* @__PURE__ */ g(xe, { children: [
1253
- /* @__PURE__ */ l(je, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
1254
- /* @__PURE__ */ l(p, { size: "2", weight: "medium", children: _.length > 0 ? `Add another file (${ye} remaining)` : "Click to upload or drag and drop" }),
1255
- /* @__PURE__ */ g(p, { size: "1", color: "gray", children: [
1256
- Ce(L),
1833
+ /* @__PURE__ */ s("input", { ref: J, type: "file", style: { display: "none" }, accept: R, onChange: Q }),
1834
+ /* @__PURE__ */ s(L, { direction: "column", align: "center", gap: "2", children: W ? /* @__PURE__ */ p(Ae, { children: [
1835
+ /* @__PURE__ */ s(ht, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
1836
+ /* @__PURE__ */ s(h, { size: "2", color: "red", weight: "medium", children: W }),
1837
+ /* @__PURE__ */ s(h, { size: "1", color: "gray", children: "Click to try again" })
1838
+ ] }) : /* @__PURE__ */ p(Ae, { children: [
1839
+ /* @__PURE__ */ s(Ge, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
1840
+ /* @__PURE__ */ s(h, { size: "2", weight: "medium", children: B.length > 0 ? `Add another file (${V} remaining)` : "Click to upload or drag and drop" }),
1841
+ /* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
1842
+ Ie(z),
1257
1843
  " max · ",
1258
- Se(D)
1844
+ De(R)
1259
1845
  ] })
1260
1846
  ] }) })
1261
1847
  ]
1262
1848
  }
1263
1849
  ),
1264
- R && ee && A && /* @__PURE__ */ g(p, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
1850
+ C && le && S && /* @__PURE__ */ p(h, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
1265
1851
  "Maximum ",
1266
- w,
1852
+ v,
1267
1853
  " files uploaded. Remove one to replace it."
1268
1854
  ] }),
1269
- !m && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Re(c, n) })
1855
+ !f && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Oe(c, n) })
1270
1856
  ] });
1271
- }, Wn = be(Vn), Hn = ie(
1857
+ }, Zo = Ee(Jo), Qo = ue(
1272
1858
  10,
1273
1859
  // high rank to beat default array renderer
1274
- Wt(
1860
+ mr(
1275
1861
  // Match both single-file (type: string) and multi-file (type: array)
1276
- ze((e) => {
1862
+ _e((e) => {
1277
1863
  if (e.type === "string" && e.format === "file") return !0;
1278
1864
  if (e.type === "array") {
1279
1865
  const r = e.items;
@@ -1283,19 +1869,19 @@ const Vn = ({
1283
1869
  })
1284
1870
  )
1285
1871
  );
1286
- function er(e, r) {
1872
+ function Nr(e, r) {
1287
1873
  return e !== !1 && r !== !0;
1288
1874
  }
1289
- class at extends Error {
1875
+ class xt extends Error {
1290
1876
  }
1291
- async function Bn(e, r) {
1877
+ async function ei(e, r) {
1292
1878
  const { read: t, utils: n } = await import("@e965/xlsx"), i = t(e, { type: "array", cellDates: !0 });
1293
1879
  if (i.SheetNames.length === 0)
1294
- throw new at("This file has no sheets.");
1295
- const o = r ?? i.SheetNames[0], s = i.Sheets[o];
1296
- if (!s)
1297
- throw new at(`This file doesn't have a sheet named "${o}".`);
1298
- const a = n.sheet_to_json(s, { header: 1, raw: !0, defval: null });
1880
+ throw new xt("This file has no sheets.");
1881
+ const o = r ?? i.SheetNames[0], l = i.Sheets[o];
1882
+ if (!l)
1883
+ throw new xt(`This file doesn't have a sheet named "${o}".`);
1884
+ const a = n.sheet_to_json(l, { header: 1, raw: !0, defval: null });
1299
1885
  return {
1300
1886
  sheetName: o,
1301
1887
  matrix: a,
@@ -1303,7 +1889,7 @@ async function Bn(e, r) {
1303
1889
  colCount: Math.max(0, ...a.map((c) => c.length))
1304
1890
  };
1305
1891
  }
1306
- function Xn(e) {
1892
+ function ti(e) {
1307
1893
  let r = e + 1, t = "";
1308
1894
  for (; r > 0; ) {
1309
1895
  const n = (r - 1) % 26;
@@ -1311,14 +1897,14 @@ function Xn(e) {
1311
1897
  }
1312
1898
  return t;
1313
1899
  }
1314
- class de extends Error {
1900
+ class be extends Error {
1315
1901
  constructor(t, n) {
1316
1902
  super(n ?? t);
1317
- vt(this, "code");
1903
+ Vt(this, "code");
1318
1904
  this.code = t, this.name = "FormulaError";
1319
1905
  }
1320
1906
  }
1321
- const qn = [
1907
+ const ri = [
1322
1908
  // Logical
1323
1909
  // IF is excluded here even though its native body is real, non-stub code —
1324
1910
  // see LOGICAL_FUNCTIONS_WITH_BROKEN_CONDITION_COERCION below for why it's
@@ -1344,7 +1930,7 @@ const qn = [
1344
1930
  // DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL.
1345
1931
  "DATE",
1346
1932
  "TODAY"
1347
- ], Kn = [
1933
+ ], ni = [
1348
1934
  "MAX",
1349
1935
  "MIN",
1350
1936
  "MAXA",
@@ -1363,7 +1949,7 @@ const qn = [
1363
1949
  "COUNTA",
1364
1950
  // not present in fast-formula-parser's function table at all.
1365
1951
  "UPPER"
1366
- ], Yn = ["YEAR", "MONTH", "DAY", "WEEKDAY"], Gn = ["IF"], Jn = [
1952
+ ], oi = ["YEAR", "MONTH", "DAY", "WEEKDAY"], ii = ["IF"], si = [
1367
1953
  "CONCATENATE",
1368
1954
  "CONCAT",
1369
1955
  "LEN",
@@ -1374,24 +1960,24 @@ const qn = [
1374
1960
  "MID",
1375
1961
  "FIND",
1376
1962
  "SEARCH"
1377
- ], Zn = /* @__PURE__ */ new Set([
1378
- ...qn,
1379
- ...Kn,
1380
- ...Yn,
1381
- ...Jn,
1382
- ...Gn
1383
- ]), Qn = /"(?:[^"]|"")*"/g, Ct = new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(", "g");
1384
- function eo(e) {
1385
- const r = e.replace(Qn, (n) => " ".repeat(n.length));
1386
- Ct.lastIndex = 0;
1963
+ ], li = /* @__PURE__ */ new Set([
1964
+ ...ri,
1965
+ ...ni,
1966
+ ...oi,
1967
+ ...si,
1968
+ ...ii
1969
+ ]), ai = /"(?:[^"]|"")*"/g, Jt = new RegExp("(?<![A-Za-z0-9_.])([A-Za-z_][A-Za-z0-9_.]*)\\s*\\(", "g");
1970
+ function ci(e) {
1971
+ const r = e.replace(ai, (n) => " ".repeat(n.length));
1972
+ Jt.lastIndex = 0;
1387
1973
  let t;
1388
- for (; (t = Ct.exec(r)) !== null; ) {
1974
+ for (; (t = Jt.exec(r)) !== null; ) {
1389
1975
  const n = t[1].toUpperCase();
1390
- if (!Zn.has(n))
1391
- throw new de("NAME", `Function ${n} is not allowed.`);
1976
+ if (!li.has(n))
1977
+ throw new be("NAME", `Function ${n} is not allowed.`);
1392
1978
  }
1393
1979
  }
1394
- function to(e, r, t) {
1980
+ function ui(e, r, t) {
1395
1981
  let n = e;
1396
1982
  if (n == null) throw t.NA;
1397
1983
  if (typeof n == "object" && !(n instanceof t) && (n = r.retrieveRef(n)), n instanceof t) throw n;
@@ -1399,52 +1985,52 @@ function to(e, r, t) {
1399
1985
  if (typeof n == "number") return n !== 0;
1400
1986
  throw t.VALUE;
1401
1987
  }
1402
- function tr(e) {
1988
+ function Lr(e) {
1403
1989
  return e !== null && typeof e == "object" && "value" in e ? e.value : e;
1404
1990
  }
1405
- function Fe(e) {
1406
- const r = tr(e);
1991
+ function He(e) {
1992
+ const r = Lr(e);
1407
1993
  return Array.isArray(r) ? r.flat(1 / 0) : [r];
1408
1994
  }
1409
- function K(e) {
1410
- const r = tr(e);
1995
+ function ie(e) {
1996
+ const r = Lr(e);
1411
1997
  return Array.isArray(r) ? r.flat(1 / 0)[0] : r;
1412
1998
  }
1413
- function tt(e) {
1414
- return e === void 0 ? void 0 : K(e);
1999
+ function ct(e) {
2000
+ return e === void 0 ? void 0 : ie(e);
1415
2001
  }
1416
- function ue(e) {
2002
+ function ge(e) {
1417
2003
  return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
1418
2004
  }
1419
- function ro(e, r) {
2005
+ function di(e, r) {
1420
2006
  return e instanceof r ? e : new r(e.message || "#ERROR!");
1421
2007
  }
1422
- function se(e) {
2008
+ function pe(e) {
1423
2009
  return e.find((r) => r instanceof Error);
1424
2010
  }
1425
- function no(e, r) {
2011
+ function fi(e, r) {
1426
2012
  const t = (o) => {
1427
- throw ro(o, r);
1428
- }, n = (o, { checkArgsForErrors: s = !0 } = {}) => (...a) => {
1429
- const c = a.flatMap(Fe);
1430
- if (s) {
1431
- const d = se(c);
2013
+ throw di(o, r);
2014
+ }, n = (o, { checkArgsForErrors: l = !0 } = {}) => (...a) => {
2015
+ const c = a.flatMap(He);
2016
+ if (l) {
2017
+ const d = pe(c);
1432
2018
  d && t(d);
1433
2019
  }
1434
2020
  const u = o(...c);
1435
2021
  return u instanceof Error ? t(u) : u;
1436
- }, i = (o, { toText: s = !1 } = {}) => (a) => {
1437
- const c = K(a), u = se([c]);
2022
+ }, i = (o, { toText: l = !1 } = {}) => (a) => {
2023
+ const c = ie(a), u = pe([c]);
1438
2024
  u && t(u);
1439
- const d = o(s ? ue(c) : c);
2025
+ const d = o(l ? ge(c) : c);
1440
2026
  return d instanceof Error ? t(d) : d;
1441
2027
  };
1442
2028
  return {
1443
2029
  // valueIfTrue/valueIfFalse are passed through unretrieved (not
1444
2030
  // dereferenced or type-checked here) — that's what makes
1445
2031
  // `IF(FALSE, B100, 99)` a genuine short-circuit rather than a lookup.
1446
- IF: (o, s, a, c) => {
1447
- const u = to(s, o, r);
2032
+ IF: (o, l, a, c) => {
2033
+ const u = ui(l, o, r);
1448
2034
  if (a == null) throw r.NA;
1449
2035
  return u ? a : c ?? !1;
1450
2036
  },
@@ -1460,26 +2046,26 @@ function no(e, r) {
1460
2046
  // which never checks for errors), so this skips the error propagation
1461
2047
  // the other aggregates use.
1462
2048
  COUNTA: n(e.COUNTA, { checkArgsForErrors: !1 }),
1463
- LARGE: (o, s) => {
1464
- const a = Fe(o), c = K(s), u = se([...a, c]);
2049
+ LARGE: (o, l) => {
2050
+ const a = He(o), c = ie(l), u = pe([...a, c]);
1465
2051
  u && t(u);
1466
2052
  const d = e.LARGE(a, c);
1467
2053
  return d instanceof Error ? t(d) : d;
1468
2054
  },
1469
- SMALL: (o, s) => {
1470
- const a = Fe(o), c = K(s), u = se([...a, c]);
2055
+ SMALL: (o, l) => {
2056
+ const a = He(o), c = ie(l), u = pe([...a, c]);
1471
2057
  u && t(u);
1472
2058
  const d = e.SMALL(a, c);
1473
2059
  return d instanceof Error ? t(d) : d;
1474
2060
  },
1475
- PERMUT: (o, s) => {
1476
- const a = [K(o), K(s)], c = se(a);
2061
+ PERMUT: (o, l) => {
2062
+ const a = [ie(o), ie(l)], c = pe(a);
1477
2063
  c && t(c);
1478
2064
  const u = e.PERMUT(a[0], a[1]);
1479
2065
  return u instanceof Error ? t(u) : u;
1480
2066
  },
1481
- PERMUTATIONA: (o, s) => {
1482
- const a = [K(o), K(s)], c = se(a);
2067
+ PERMUTATIONA: (o, l) => {
2068
+ const a = [ie(o), ie(l)], c = pe(a);
1483
2069
  c && t(c);
1484
2070
  const u = e.PERMUTATIONA(a[0], a[1]);
1485
2071
  return u instanceof Error ? t(u) : u;
@@ -1490,40 +2076,40 @@ function no(e, r) {
1490
2076
  // Excel's own default too) risks silently mis-ranking unsorted
1491
2077
  // real-world data. Same scope decision as the hand-rolled engine this
1492
2078
  // replaces, carried forward deliberately rather than dropped.
1493
- MATCH: (o, s) => {
1494
- const a = K(o), c = Fe(s), u = se([a, ...c]);
2079
+ MATCH: (o, l) => {
2080
+ const a = ie(o), c = He(l), u = pe([a, ...c]);
1495
2081
  u && t(u);
1496
2082
  const d = e.MATCH(a, c, 0);
1497
2083
  return d instanceof Error ? t(d) : d;
1498
2084
  },
1499
2085
  SWITCH: (...o) => {
1500
- const s = o.map(K), a = se(s);
2086
+ const l = o.map(ie), a = pe(l);
1501
2087
  a && t(a);
1502
- const c = e.SWITCH(...s);
2088
+ const c = e.SWITCH(...l);
1503
2089
  return c instanceof Error ? t(c) : c;
1504
2090
  },
1505
- SUBSTITUTE: (o, s, a, c) => {
1506
- const u = [ue(K(o)), ue(K(s)), ue(K(a))];
1507
- c !== void 0 && u.push(K(c));
1508
- const d = se(u);
2091
+ SUBSTITUTE: (o, l, a, c) => {
2092
+ const u = [ge(ie(o)), ge(ie(l)), ge(ie(a))];
2093
+ c !== void 0 && u.push(ie(c));
2094
+ const d = pe(u);
1509
2095
  d && t(d);
1510
- const y = e.SUBSTITUTE(...u);
1511
- return y instanceof Error ? t(y) : y;
1512
- },
1513
- TEXTJOIN: (o, s, ...a) => {
1514
- const c = ue(K(o)), u = K(s), d = a.flatMap(Fe).map(ue), y = se([c, u]);
1515
- y && t(y);
1516
- const m = e.TEXTJOIN(c, u, d);
2096
+ const m = e.SUBSTITUTE(...u);
1517
2097
  return m instanceof Error ? t(m) : m;
1518
2098
  },
2099
+ TEXTJOIN: (o, l, ...a) => {
2100
+ const c = ge(ie(o)), u = ie(l), d = a.flatMap(He).map(ge), m = pe([c, u]);
2101
+ m && t(m);
2102
+ const f = e.TEXTJOIN(c, u, d);
2103
+ return f instanceof Error ? t(f) : f;
2104
+ },
1519
2105
  UPPER: i(e.UPPER),
1520
2106
  // See DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL above for why these override
1521
2107
  // fast-formula-parser's own (real, but broken-for-Date-cells) versions.
1522
2108
  YEAR: i(e.YEAR),
1523
2109
  MONTH: i(e.MONTH),
1524
2110
  DAY: i(e.DAY),
1525
- WEEKDAY: (o, s) => {
1526
- const a = K(o), c = K(s), u = se([a]);
2111
+ WEEKDAY: (o, l) => {
2112
+ const a = ie(o), c = ie(l), u = pe([a]);
1527
2113
  u && t(u);
1528
2114
  const d = e.WEEKDAY(a, c);
1529
2115
  return d instanceof Error ? t(d) : d;
@@ -1538,53 +2124,53 @@ function no(e, r) {
1538
2124
  // separator, matching Excel's own range-argument behavior — the native
1539
2125
  // implementation instead inserts stray commas for a whole-range argument.
1540
2126
  CONCATENATE: (...o) => {
1541
- const s = o.flatMap(Fe), a = se(s);
2127
+ const l = o.flatMap(He), a = pe(l);
1542
2128
  a && t(a);
1543
- const c = e.CONCATENATE(...s.map(ue));
2129
+ const c = e.CONCATENATE(...l.map(ge));
1544
2130
  return c instanceof Error ? t(c) : c;
1545
2131
  },
1546
2132
  CONCAT: (...o) => {
1547
- const s = o.flatMap(Fe), a = se(s);
2133
+ const l = o.flatMap(He), a = pe(l);
1548
2134
  a && t(a);
1549
- const c = e.CONCAT(...s.map(ue));
2135
+ const c = e.CONCAT(...l.map(ge));
1550
2136
  return c instanceof Error ? t(c) : c;
1551
2137
  },
1552
2138
  LEN: i(e.LEN, { toText: !0 }),
1553
2139
  TRIM: i(e.TRIM, { toText: !0 }),
1554
2140
  LOWER: i(e.LOWER, { toText: !0 }),
1555
- LEFT: (o, s) => {
1556
- const a = K(o), c = tt(s), u = se([a]);
2141
+ LEFT: (o, l) => {
2142
+ const a = ie(o), c = ct(l), u = pe([a]);
1557
2143
  u && t(u);
1558
- const d = e.LEFT(ue(a), c);
2144
+ const d = e.LEFT(ge(a), c);
1559
2145
  return d instanceof Error ? t(d) : d;
1560
2146
  },
1561
- RIGHT: (o, s) => {
1562
- const a = K(o), c = tt(s), u = se([a]);
2147
+ RIGHT: (o, l) => {
2148
+ const a = ie(o), c = ct(l), u = pe([a]);
1563
2149
  u && t(u);
1564
- const d = e.RIGHT(ue(a), c);
2150
+ const d = e.RIGHT(ge(a), c);
1565
2151
  return d instanceof Error ? t(d) : d;
1566
2152
  },
1567
- MID: (o, s, a) => {
1568
- const c = K(o), u = K(s), d = K(a), y = se([c, u, d]);
1569
- y && t(y);
1570
- const m = e.MID(ue(c), u, d);
1571
- return m instanceof Error ? t(m) : m;
2153
+ MID: (o, l, a) => {
2154
+ const c = ie(o), u = ie(l), d = ie(a), m = pe([c, u, d]);
2155
+ m && t(m);
2156
+ const f = e.MID(ge(c), u, d);
2157
+ return f instanceof Error ? t(f) : f;
1572
2158
  },
1573
- FIND: (o, s, a) => {
1574
- const c = K(o), u = K(s), d = tt(a), y = se([c, u]);
1575
- y && t(y);
1576
- const m = e.FIND(ue(c), ue(u), d);
1577
- return m instanceof Error ? t(m) : m;
2159
+ FIND: (o, l, a) => {
2160
+ const c = ie(o), u = ie(l), d = ct(a), m = pe([c, u]);
2161
+ m && t(m);
2162
+ const f = e.FIND(ge(c), ge(u), d);
2163
+ return f instanceof Error ? t(f) : f;
1578
2164
  },
1579
- SEARCH: (o, s, a) => {
1580
- const c = K(o), u = K(s), d = tt(a), y = se([c, u]);
1581
- y && t(y);
1582
- const m = e.SEARCH(ue(c), ue(u), d);
1583
- return m instanceof Error ? t(m) : m;
2165
+ SEARCH: (o, l, a) => {
2166
+ const c = ie(o), u = ie(l), d = ct(a), m = pe([c, u]);
2167
+ m && t(m);
2168
+ const f = e.SEARCH(ge(c), ge(u), d);
2169
+ return f instanceof Error ? t(f) : f;
1584
2170
  }
1585
2171
  };
1586
2172
  }
1587
- const oo = {
2173
+ const pi = {
1588
2174
  "#REF!": "REF",
1589
2175
  "#VALUE!": "VALUE",
1590
2176
  "#DIV/0!": "DIV0",
@@ -1593,100 +2179,100 @@ const oo = {
1593
2179
  "#NUM!": "NUM",
1594
2180
  "#NULL!": "NULL"
1595
2181
  };
1596
- function St(e) {
1597
- return oo[e.error] ?? "ERROR";
2182
+ function Zt(e) {
2183
+ return pi[e.error] ?? "ERROR";
1598
2184
  }
1599
- function Ot(e, r) {
1600
- if (e instanceof de) return e;
2185
+ function Qt(e, r) {
2186
+ if (e instanceof be) return e;
1601
2187
  if (e instanceof r) {
1602
2188
  const t = e.details;
1603
- return t instanceof de ? t : t instanceof r ? new de(St(t), t.message) : new de(St(e), e.message);
2189
+ return t instanceof be ? t : t instanceof r ? new be(Zt(t), t.message) : new be(Zt(e), e.message);
1604
2190
  }
1605
- return new de("ERROR", e instanceof Error ? e.message : void 0);
2191
+ return new be("ERROR", e instanceof Error ? e.message : void 0);
1606
2192
  }
1607
- function io(e) {
2193
+ function hi(e) {
1608
2194
  return Math.max(0, ...e.map((r) => (r == null ? void 0 : r.length) ?? 0));
1609
2195
  }
1610
- function so(e) {
2196
+ function mi(e) {
1611
2197
  return (r) => {
1612
2198
  const t = e[r.row - 1];
1613
2199
  if (r.row < 1 || r.col < 1 || t == null || r.col - 1 >= t.length)
1614
- throw new de("REF");
2200
+ throw new be("REF");
1615
2201
  const n = t[r.col - 1];
1616
2202
  return n == null || n === "" ? null : n;
1617
2203
  };
1618
2204
  }
1619
- function lo(e) {
2205
+ function gi(e) {
1620
2206
  return (r) => {
1621
- const t = Math.min(r.from.row, r.to.row), n = Math.min(r.from.col, r.to.col), i = Math.max(r.from.row, r.to.row), o = Math.max(r.from.col, r.to.col), s = io(e);
1622
- if (t > e.length || n > s)
1623
- throw new de("REF");
2207
+ const t = Math.min(r.from.row, r.to.row), n = Math.min(r.from.col, r.to.col), i = Math.max(r.from.row, r.to.row), o = Math.max(r.from.col, r.to.col), l = hi(e);
2208
+ if (t > e.length || n > l)
2209
+ throw new be("REF");
1624
2210
  const a = Math.min(i, e.length), c = [];
1625
2211
  for (let u = t; u <= a; u++) {
1626
- const d = e[u - 1], y = [];
2212
+ const d = e[u - 1], m = [];
1627
2213
  if (d != null) {
1628
- const m = Math.min(o, d.length);
1629
- for (let f = n; f <= m; f++) {
1630
- const T = d[f - 1];
1631
- y.push(T == null || T === "" ? null : T);
2214
+ const f = Math.min(o, d.length);
2215
+ for (let g = n; g <= f; g++) {
2216
+ const E = d[g - 1];
2217
+ m.push(E == null || E === "" ? null : E);
1632
2218
  }
1633
2219
  }
1634
- c.push(y);
2220
+ c.push(m);
1635
2221
  }
1636
2222
  return c;
1637
2223
  };
1638
2224
  }
1639
- function co(e) {
2225
+ function yi(e) {
1640
2226
  if (e == null || e === "") return null;
1641
2227
  if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
1642
2228
  return e;
1643
- throw new de("VALUE");
2229
+ throw new be("VALUE");
1644
2230
  }
1645
- async function rr(e, r) {
1646
- if (typeof e != "string") throw new de("ERROR");
2231
+ async function zr(e, r) {
2232
+ if (typeof e != "string") throw new be("ERROR");
1647
2233
  const t = e.trim();
1648
- if (t === "") throw new de("ERROR");
2234
+ if (t === "") throw new be("ERROR");
1649
2235
  const n = t.startsWith("=") ? t.slice(1) : t;
1650
- eo(n);
2236
+ ci(n);
1651
2237
  const [i, o] = await Promise.all([
1652
2238
  import("fast-formula-parser"),
1653
2239
  import("@formulajs/formulajs")
1654
- ]), s = i.default ?? i, a = s.FormulaError, c = new s({
2240
+ ]), l = i.default ?? i, a = l.FormulaError, c = new l({
1655
2241
  ...r,
1656
2242
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- formulajs's own types are all `any`-typed; formulaFunctions.ts narrows the surface it actually calls.
1657
- functions: no(o, a)
2243
+ functions: fi(o, a)
1658
2244
  });
1659
2245
  let u;
1660
2246
  try {
1661
2247
  u = c.parse(n, { row: 1, col: 1, sheet: "Sheet1" });
1662
2248
  } catch (d) {
1663
- throw Ot(d, a);
2249
+ throw Qt(d, a);
1664
2250
  }
1665
2251
  if (u instanceof a)
1666
- throw Ot(u, a);
1667
- return co(u);
2252
+ throw Qt(u, a);
2253
+ return yi(u);
1668
2254
  }
1669
- async function ao(e, r) {
1670
- return rr(r, { onCell: so(e), onRange: lo(e) });
2255
+ async function bi(e, r) {
2256
+ return zr(r, { onCell: mi(e), onRange: gi(e) });
1671
2257
  }
1672
- const Nt = -1;
1673
- async function nr(e, r) {
2258
+ const er = -1;
2259
+ async function Mr(e, r) {
1674
2260
  const t = Object.keys(e);
1675
- return rr(r, {
2261
+ return zr(r, {
1676
2262
  onVariable: (n) => {
1677
2263
  const i = t.indexOf(n);
1678
- return i === -1 ? null : { row: Nt, col: i + 1 };
2264
+ return i === -1 ? null : { row: er, col: i + 1 };
1679
2265
  },
1680
2266
  onCell: (n) => {
1681
- if (n.row === Nt) return e[t[n.col - 1]] ?? null;
1682
- throw new de("REF");
2267
+ if (n.row === er) return e[t[n.col - 1]] ?? null;
2268
+ throw new be("REF");
1683
2269
  },
1684
2270
  onRange: () => {
1685
- throw new de("REF");
2271
+ throw new be("REF");
1686
2272
  }
1687
2273
  });
1688
2274
  }
1689
- const or = {
2275
+ const Fr = {
1690
2276
  REF: "#REF!",
1691
2277
  VALUE: "#VALUE!",
1692
2278
  DIV0: "#DIV/0!",
@@ -1696,34 +2282,34 @@ const or = {
1696
2282
  NUM: "#NUM!",
1697
2283
  NULL: "#NULL!"
1698
2284
  };
1699
- function gt(e) {
1700
- const r = e instanceof de ? e.code : "ERROR";
1701
- return or[r];
2285
+ function Dt(e) {
2286
+ const r = e instanceof be ? e.code : "ERROR";
2287
+ return Fr[r];
1702
2288
  }
1703
- async function uo(e, r) {
2289
+ async function vi(e, r) {
1704
2290
  return e.length === 0 ? r.map((t) => ({
1705
2291
  id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
1706
2292
  label: (t == null ? void 0 : t.label) ?? "(unknown)",
1707
2293
  value: null,
1708
- error: or.ERROR
2294
+ error: Fr.ERROR
1709
2295
  })) : Promise.all(
1710
2296
  r.map(async (t) => {
1711
2297
  try {
1712
2298
  if (!t || typeof t.label != "string" || typeof t.expression != "string" || typeof t.id != "string")
1713
- throw new de("ERROR");
1714
- return { id: t.id, label: t.label, value: await ao(e, t.expression) };
2299
+ throw new be("ERROR");
2300
+ return { id: t.id, label: t.label, value: await bi(e, t.expression) };
1715
2301
  } catch (n) {
1716
2302
  return {
1717
2303
  id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
1718
2304
  label: (t == null ? void 0 : t.label) ?? "(unknown)",
1719
2305
  value: null,
1720
- error: gt(n)
2306
+ error: Dt(n)
1721
2307
  };
1722
2308
  }
1723
2309
  })
1724
2310
  );
1725
2311
  }
1726
- function Dt(e) {
2312
+ function tr(e) {
1727
2313
  const r = /* @__PURE__ */ new Set();
1728
2314
  for (const { id: t } of e) {
1729
2315
  if (r.has(t)) return t;
@@ -1731,7 +2317,7 @@ function Dt(e) {
1731
2317
  }
1732
2318
  return null;
1733
2319
  }
1734
- function ir(e) {
2320
+ function $r(e) {
1735
2321
  const { columnHeader: r, rowHeader: t, columns: n, rows: i } = e;
1736
2322
  if (n !== void 0 && !Array.isArray(n))
1737
2323
  return "columns must be an array of { id, label } objects.";
@@ -1741,150 +2327,150 @@ function ir(e) {
1741
2327
  return "columns is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
1742
2328
  if (i !== void 0 && i.length === 0)
1743
2329
  return "rows is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
1744
- const o = (d) => !!d && typeof d.id == "string" && d.id !== "" && typeof d.label == "string" && d.label !== "", s = n == null ? void 0 : n.findIndex((d) => !o(d));
1745
- if (s != null && s !== -1)
1746
- return `columns[${s}] must be a { id, label } object with non-empty string fields.`;
2330
+ const o = (d) => !!d && typeof d.id == "string" && d.id !== "" && typeof d.label == "string" && d.label !== "", l = n == null ? void 0 : n.findIndex((d) => !o(d));
2331
+ if (l != null && l !== -1)
2332
+ return `columns[${l}] must be a { id, label } object with non-empty string fields.`;
1747
2333
  const a = i == null ? void 0 : i.findIndex((d) => !o(d));
1748
2334
  if (a != null && a !== -1)
1749
2335
  return `rows[${a}] must be a { id, label } object with non-empty string fields.`;
1750
2336
  const c = !!n && n.length > 0, u = !!i && i.length > 0;
1751
2337
  if (c) {
1752
- const d = Dt(n);
2338
+ const d = tr(n);
1753
2339
  if (d) return `duplicate column id "${d}" — every declared column id must be unique.`;
1754
2340
  }
1755
2341
  if (u) {
1756
- const d = Dt(i);
2342
+ const d = tr(i);
1757
2343
  if (d) return `duplicate row id "${d}" — every declared row id must be unique.`;
1758
2344
  }
1759
2345
  return r && t ? "columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape." : c && u ? "columns and rows cannot both be declared — pick one orientation for the persisted sheet shape." : r && !c ? "columnHeader is true but columns is missing or empty — declare the column list columnHeader positions map to." : t && !u ? "rowHeader is true but rows is missing or empty — declare the row list rowHeader positions map to." : null;
1760
2346
  }
1761
- function It(e, r = {}) {
1762
- const t = ir(r);
2347
+ function rr(e, r = {}) {
2348
+ const t = $r(r);
1763
2349
  if (t) throw new Error(`x-spreadsheet: ${t}`);
1764
- const { columnHeader: n, rowHeader: i, columns: o, rows: s } = r;
1765
- return o && o.length > 0 ? fo(e, o, n === !0) : s && s.length > 0 ? po(e, s, i === !0) : e;
2350
+ const { columnHeader: n, rowHeader: i, columns: o, rows: l } = r;
2351
+ return o && o.length > 0 ? wi(e, o, n === !0) : l && l.length > 0 ? Ei(e, l, i === !0) : e;
1766
2352
  }
1767
- function fo(e, r, t) {
2353
+ function wi(e, r, t) {
1768
2354
  return (t ? e.slice(1) : e).map((i) => {
1769
2355
  const o = /* @__PURE__ */ Object.create(null);
1770
- return r.forEach((s, a) => {
1771
- o[s.id] = i[a] ?? null;
2356
+ return r.forEach((l, a) => {
2357
+ o[l.id] = i[a] ?? null;
1772
2358
  }), o;
1773
2359
  });
1774
2360
  }
1775
- function po(e, r, t) {
1776
- const n = t ? 1 : 0, i = Math.max(0, ...e.map((s) => s.length)), o = Math.max(0, i - n);
1777
- return Array.from({ length: o }, (s, a) => {
2361
+ function Ei(e, r, t) {
2362
+ const n = t ? 1 : 0, i = Math.max(0, ...e.map((l) => l.length)), o = Math.max(0, i - n);
2363
+ return Array.from({ length: o }, (l, a) => {
1778
2364
  const c = n + a, u = /* @__PURE__ */ Object.create(null);
1779
- return r.forEach((d, y) => {
1780
- var m;
1781
- u[d.id] = ((m = e[y]) == null ? void 0 : m[c]) ?? null;
2365
+ return r.forEach((d, m) => {
2366
+ var f;
2367
+ u[d.id] = ((f = e[m]) == null ? void 0 : f[c]) ?? null;
1782
2368
  }), u;
1783
2369
  });
1784
2370
  }
1785
- function sr(e) {
2371
+ function Pr(e) {
1786
2372
  return !Array.isArray(e[0]);
1787
2373
  }
1788
- function ho(e) {
2374
+ function xi(e) {
1789
2375
  const r = /* @__PURE__ */ Object.create(null);
1790
2376
  for (const { id: t, label: n, value: i, error: o } of e)
1791
2377
  r[t] = o === void 0 ? { label: n, value: i } : { label: n, value: i, error: o };
1792
2378
  return r;
1793
2379
  }
1794
- function ut(e, r) {
2380
+ function Tt(e, r) {
1795
2381
  const t = (n) => n instanceof Date ? n.toISOString() : n ?? null;
1796
2382
  return t(e) === t(r);
1797
2383
  }
1798
- function mo(e, r) {
2384
+ function Ti(e, r) {
1799
2385
  const t = e ?? {}, n = r ?? {}, i = Object.keys(t);
1800
2386
  return i.length !== Object.keys(n).length ? !1 : i.every((o) => {
1801
2387
  if (!Object.prototype.hasOwnProperty.call(n, o)) return !1;
1802
- const s = t[o], a = n[o];
1803
- return s.label === a.label && s.error === a.error && ut(s.value, a.value);
2388
+ const l = t[o], a = n[o];
2389
+ return l.label === a.label && l.error === a.error && Tt(l.value, a.value);
1804
2390
  });
1805
2391
  }
1806
- function go(e, r) {
2392
+ function Ai(e, r) {
1807
2393
  if (e == null || r == null) return e === r;
1808
2394
  const t = Array.isArray(e);
1809
2395
  if (t !== Array.isArray(r)) return !1;
1810
2396
  if (t) {
1811
- const s = e, a = r;
1812
- return s.length === a.length && s.every((c, u) => ut(c, a[u]));
2397
+ const l = e, a = r;
2398
+ return l.length === a.length && l.every((c, u) => Tt(c, a[u]));
1813
2399
  }
1814
2400
  const n = e, i = r, o = Object.keys(n);
1815
- return o.length !== Object.keys(i).length ? !1 : o.every((s) => Object.prototype.hasOwnProperty.call(i, s) && ut(n[s], i[s]));
2401
+ return o.length !== Object.keys(i).length ? !1 : o.every((l) => Object.prototype.hasOwnProperty.call(i, l) && Tt(n[l], i[l]));
1816
2402
  }
1817
- function yo(e, r) {
2403
+ function Si(e, r) {
1818
2404
  if (e === r) return !0;
1819
2405
  if (e == null || r == null) return !1;
1820
2406
  const t = e, n = r;
1821
- return t.length !== n.length ? !1 : t.every((i, o) => go(i, n[o]));
2407
+ return t.length !== n.length ? !1 : t.every((i, o) => Ai(i, n[o]));
1822
2408
  }
1823
- function bo(e) {
2409
+ function Ri(e) {
1824
2410
  return e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
1825
2411
  }
1826
- function lr(e, r) {
2412
+ function Ur(e, r) {
1827
2413
  if (e.length === 0) return [];
1828
2414
  const t = [], n = /* @__PURE__ */ new Set();
1829
2415
  for (const o of r ?? [])
1830
2416
  n.has(o) || (n.add(o), t.push(o));
1831
2417
  for (const o of e)
1832
- for (const s of Object.keys(o))
1833
- n.has(s) || (n.add(s), t.push(s));
2418
+ for (const l of Object.keys(o))
2419
+ n.has(l) || (n.add(l), t.push(l));
1834
2420
  if (t.length === 0) return [];
1835
2421
  const i = e.map(
1836
- (o) => t.map((s) => {
1837
- if (!Object.prototype.hasOwnProperty.call(o, s)) return null;
1838
- const a = o[s];
1839
- return bo(a) ? a : null;
2422
+ (o) => t.map((l) => {
2423
+ if (!Object.prototype.hasOwnProperty.call(o, l)) return null;
2424
+ const a = o[l];
2425
+ return Ri(a) ? a : null;
1840
2426
  })
1841
2427
  );
1842
2428
  return [t, ...i];
1843
2429
  }
1844
- function vo(e) {
2430
+ function Ci(e) {
1845
2431
  const r = Math.max(0, ...e.map((t) => t.length));
1846
2432
  return Array.from({ length: r }, (t, n) => e.map((i) => i[n] ?? null));
1847
2433
  }
1848
- const wo = ".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv", Eo = 10 * 1024 * 1024, lt = 200, To = 50, xo = [];
1849
- function kt(e) {
2434
+ const Oi = ".xlsx,.xls,.csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,text/csv", ki = 10 * 1024 * 1024, vt = 200, Ii = 50, Di = [];
2435
+ function nr(e) {
1850
2436
  return e == null || e === "" ? "" : e instanceof Date ? e.toLocaleDateString() : String(e);
1851
2437
  }
1852
- const Ao = ({
2438
+ const Ni = ({
1853
2439
  data: e,
1854
2440
  handleChange: r,
1855
2441
  path: t,
1856
2442
  label: n,
1857
2443
  required: i,
1858
2444
  schema: o,
1859
- enabled: s,
2445
+ enabled: l,
1860
2446
  readonly: a,
1861
2447
  errors: c,
1862
2448
  visible: u = !0
1863
2449
  }) => {
1864
- Oe(u, t, r);
1865
- const d = Ae(t, i, u), y = !c || c.length === 0, m = er(s, a), f = (o == null ? void 0 : o["x-spreadsheet"]) ?? {}, T = (o == null ? void 0 : o["x-evaluate"]) ?? xo, w = f.accept ?? wo, L = f.maxSize ?? Eo, D = f.columnHeader === !0, N = f.rowHeader === !0, A = f.columns, R = f.rows, v = Array.isArray(A) && A.length > 0, b = Array.isArray(R) && R.length > 0, U = ir({ columnHeader: D, rowHeader: N, columns: A, rows: R }), P = f.showSheet !== !1, O = f.sheetName, j = f.persistSheet !== !1, I = e ?? null, [ne, Y] = B(
1866
- () => I != null && I.sheet || Object.keys((I == null ? void 0 : I.derivations) ?? {}).length > 0 ? "ready" : "empty"
1867
- ), [z, _] = B(null), [ee, fe] = B(!1), [oe, te] = B(null), [k, G] = B(null), C = ge(null), J = ge(null), pe = (I == null ? void 0 : I.sheet) ?? null, F = We(
1868
- (S) => {
1869
- if (!sr(S)) return S;
1870
- const W = b ? R : v ? A : void 0, ce = lr(
1871
- S,
1872
- W == null ? void 0 : W.map((q) => q.id)
2450
+ Le(u, t, r);
2451
+ const d = Ce(t, i, u), m = !c || c.length === 0, f = Nr(l, a), g = (o == null ? void 0 : o["x-spreadsheet"]) ?? {}, E = (o == null ? void 0 : o["x-evaluate"]) ?? Di, v = g.accept ?? Oi, z = g.maxSize ?? ki, R = g.columnHeader === !0, j = g.rowHeader === !0, S = g.columns, C = g.rows, A = Array.isArray(S) && S.length > 0, T = Array.isArray(C) && C.length > 0, W = $r({ columnHeader: R, rowHeader: j, columns: S, rows: C }), U = g.showSheet !== !1, F = g.sheetName, M = g.persistSheet !== !1, x = e ?? null, [te, H] = Y(
2452
+ () => x != null && x.sheet || Object.keys((x == null ? void 0 : x.derivations) ?? {}).length > 0 ? "ready" : "empty"
2453
+ ), [J, B] = Y(null), [le, ve] = Y(!1), [ne, ae] = Y(null), [$, Z] = Y(null), I = he(null), re = he(null), Q = (x == null ? void 0 : x.sheet) ?? null, _ = Be(
2454
+ (D) => {
2455
+ if (!Pr(D)) return D;
2456
+ const X = T ? C : A ? S : void 0, de = Ur(
2457
+ D,
2458
+ X == null ? void 0 : X.map((K) => K.id)
1873
2459
  );
1874
- return b ? vo(ce) : ce;
2460
+ return T ? Ci(de) : de;
1875
2461
  },
1876
- [v, b, A, R]
1877
- ), Z = Ve(() => oe ?? (pe ? F(pe) : null), [oe, pe, F]), le = ((k == null ? void 0 : k.matrix) === Z ? k.derivations : null) ?? (I == null ? void 0 : I.derivations) ?? {}, ye = Z != null || I != null, he = Ve(() => {
1878
- const S = v ? 1 : 0, W = b ? 1 : 0, ce = Z ? Z.slice(S) : [], q = ce.slice(0, lt), H = Math.min(
1879
- To,
1880
- Math.max(0, ...q.map((Ee) => Math.max(0, Ee.length - W)))
1881
- ), ke = Array.from({ length: H }, (Ee, E) => E + W), Pe = "", Je = b && !v;
1882
- return /* @__PURE__ */ l(xe, { children: Z && P && /* @__PURE__ */ g(M, { mt: "3", children: [
1883
- /* @__PURE__ */ l(M, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ g(De.Root, { variant: "surface", size: "1", children: [
1884
- !Je && /* @__PURE__ */ l(De.Header, { children: /* @__PURE__ */ g(De.Row, { children: [
1885
- /* @__PURE__ */ l(De.ColumnHeaderCell, { children: Pe }),
1886
- ke.map((Ee) => {
1887
- var E;
2462
+ [A, T, S, C]
2463
+ ), b = Se(() => ne ?? (Q ? _(Q) : null), [ne, Q, _]), O = (($ == null ? void 0 : $.matrix) === b ? $.derivations : null) ?? (x == null ? void 0 : x.derivations) ?? {}, V = b != null || x != null, G = Se(() => {
2464
+ const D = A ? 1 : 0, X = T ? 1 : 0, de = b ? b.slice(D) : [], K = de.slice(0, vt), q = Math.min(
2465
+ Ii,
2466
+ Math.max(0, ...K.map((fe) => Math.max(0, fe.length - X)))
2467
+ ), xe = Array.from({ length: q }, (fe, ke) => ke + X), $e = "", et = T && !A;
2468
+ return /* @__PURE__ */ s(Ae, { children: b && U && /* @__PURE__ */ p(N, { mt: "3", children: [
2469
+ /* @__PURE__ */ s(N, { style: { overflow: "auto", maxHeight: 420 }, children: /* @__PURE__ */ p(Me.Root, { variant: "surface", size: "1", children: [
2470
+ !et && /* @__PURE__ */ s(Me.Header, { children: /* @__PURE__ */ p(Me.Row, { children: [
2471
+ /* @__PURE__ */ s(Me.ColumnHeaderCell, { children: $e }),
2472
+ xe.map((fe) => {
2473
+ var ke;
1888
2474
  return (
1889
2475
  // This row only renders when hasRows isn't the sole
1890
2476
  // flag set (see suppressColumnHeaderRow) — so reaching
@@ -1892,227 +2478,227 @@ const Ao = ({
1892
2478
  // looked up positionally — never read from the matrix
1893
2479
  // cell itself, which only ever holds the id) or both
1894
2480
  // are false (columnLetter fallback).
1895
- /* @__PURE__ */ l(De.ColumnHeaderCell, { children: v ? ((E = A == null ? void 0 : A[Ee]) == null ? void 0 : E.label) ?? "" : Xn(Ee) }, Ee)
2481
+ /* @__PURE__ */ s(Me.ColumnHeaderCell, { children: A ? ((ke = S == null ? void 0 : S[fe]) == null ? void 0 : ke.label) ?? "" : ti(fe) }, fe)
1896
2482
  );
1897
2483
  })
1898
2484
  ] }) }),
1899
- /* @__PURE__ */ l(De.Body, { children: q.map((Ee, E) => {
1900
- var ae;
1901
- const re = S + E;
1902
- return /* @__PURE__ */ g(De.Row, { children: [
1903
- /* @__PURE__ */ l(
1904
- De.RowHeaderCell,
2485
+ /* @__PURE__ */ s(Me.Body, { children: K.map((fe, ke) => {
2486
+ var Ke;
2487
+ const qe = D + ke;
2488
+ return /* @__PURE__ */ p(Me.Row, { children: [
2489
+ /* @__PURE__ */ s(
2490
+ Me.RowHeaderCell,
1905
2491
  {
1906
- style: b ? { fontWeight: 700, background: "var(--gray-a3)" } : void 0,
1907
- children: b ? ((ae = R == null ? void 0 : R[re]) == null ? void 0 : ae.label) ?? "" : v ? "" : re + 1
2492
+ style: T ? { fontWeight: 700, background: "var(--gray-a3)" } : void 0,
2493
+ children: T ? ((Ke = C == null ? void 0 : C[qe]) == null ? void 0 : Ke.label) ?? "" : A ? "" : qe + 1
1908
2494
  }
1909
2495
  ),
1910
- ke.map((Te) => /* @__PURE__ */ l(De.Cell, { children: kt(Ee[Te]) }, Te))
1911
- ] }, E);
2496
+ xe.map((it) => /* @__PURE__ */ s(Me.Cell, { children: nr(fe[it]) }, it))
2497
+ ] }, ke);
1912
2498
  }) })
1913
2499
  ] }) }),
1914
- ce.length > lt && /* @__PURE__ */ g(p, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
2500
+ de.length > vt && /* @__PURE__ */ p(h, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
1915
2501
  "Showing first ",
1916
- lt,
2502
+ vt,
1917
2503
  " of ",
1918
- ce.length,
2504
+ de.length,
1919
2505
  " rows"
1920
2506
  ] })
1921
2507
  ] }) });
1922
- }, [Z, P, v, b, A, R]), h = We(
1923
- async (S) => {
1924
- if (_(null), S.size > L) {
1925
- _(`File exceeds the ${Ce(L)} limit.`);
2508
+ }, [b, U, A, T, S, C]), y = Be(
2509
+ async (D) => {
2510
+ if (B(null), D.size > z) {
2511
+ B(`File exceeds the ${Ie(z)} limit.`);
1926
2512
  return;
1927
2513
  }
1928
- if (!w.split(",").map((H) => H.trim()).some((H) => H === "*" || H === "*/*" ? !0 : H.endsWith("/*") ? S.type.startsWith(H.slice(0, -1)) : H.startsWith(".") ? S.name.toLowerCase().endsWith(H.toLowerCase()) : S.type === H)) {
1929
- _(`Invalid type. Accepted: ${Se(w)}`);
2514
+ if (!v.split(",").map((q) => q.trim()).some((q) => q === "*" || q === "*/*" ? !0 : q.endsWith("/*") ? D.type.startsWith(q.slice(0, -1)) : q.startsWith(".") ? D.name.toLowerCase().endsWith(q.toLowerCase()) : D.type === q)) {
2515
+ B(`Invalid type. Accepted: ${De(v)}`);
1930
2516
  return;
1931
2517
  }
1932
- Y("parsing");
1933
- let q;
2518
+ H("parsing");
2519
+ let K;
1934
2520
  try {
1935
- const H = await S.arrayBuffer();
1936
- q = (await Bn(H, O)).matrix;
1937
- } catch (H) {
1938
- Y("error"), _(
1939
- H instanceof at ? H.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
2521
+ const q = await D.arrayBuffer();
2522
+ K = (await ei(q, F)).matrix;
2523
+ } catch (q) {
2524
+ H("error"), B(
2525
+ q instanceof xt ? q.message : "This doesn't look like a valid spreadsheet. Please check the file and try again."
1940
2526
  );
1941
2527
  return;
1942
2528
  }
1943
- if (v || b)
2529
+ if (A || T)
1944
2530
  try {
1945
- q = F(It(q, { columnHeader: D, rowHeader: N, columns: A, rows: R }));
1946
- } catch (H) {
1947
- Y("error"), _(H instanceof Error ? H.message : "Failed to process this sheet.");
2531
+ K = _(rr(K, { columnHeader: R, rowHeader: j, columns: S, rows: C }));
2532
+ } catch (q) {
2533
+ H("error"), B(q instanceof Error ? q.message : "Failed to process this sheet.");
1948
2534
  return;
1949
2535
  }
1950
- J.current = (e == null ? void 0 : e.sheet) ?? null, te(q), Y("ready");
2536
+ re.current = (e == null ? void 0 : e.sheet) ?? null, ae(K), H("ready");
1951
2537
  },
1952
- [w, L, O, e, D, N, A, R, v, b, F]
2538
+ [v, z, F, e, R, j, S, C, A, T, _]
1953
2539
  );
1954
- if (we(() => {
1955
- oe != null && pe != null && pe !== J.current && te(null);
1956
- }, [oe, pe]), we(() => {
1957
- if (U || T.length === 0 && !j) return;
1958
- let S = !1;
1959
- const W = (q) => {
1960
- m && (mo(I == null ? void 0 : I.derivations, q == null ? void 0 : q.derivations) && yo(I == null ? void 0 : I.sheet, q == null ? void 0 : q.sheet) || (J.current = (q == null ? void 0 : q.sheet) ?? null, r(t, q)));
1961
- }, ce = Z ?? [];
1962
- if (ce.length === 0) {
1963
- I != null && W(void 0);
2540
+ if (ye(() => {
2541
+ ne != null && Q != null && Q !== re.current && ae(null);
2542
+ }, [ne, Q]), ye(() => {
2543
+ if (W || E.length === 0 && !M) return;
2544
+ let D = !1;
2545
+ const X = (K) => {
2546
+ f && (Ti(x == null ? void 0 : x.derivations, K == null ? void 0 : K.derivations) && Si(x == null ? void 0 : x.sheet, K == null ? void 0 : K.sheet) || (re.current = (K == null ? void 0 : K.sheet) ?? null, r(t, K)));
2547
+ }, de = b ?? [];
2548
+ if (de.length === 0) {
2549
+ x != null && X(void 0);
1964
2550
  return;
1965
2551
  }
1966
- return uo(ce, T).then((q) => {
1967
- if (S) return;
1968
- let H;
1969
- if (oe != null) {
1970
- if (j)
2552
+ return vi(de, E).then((K) => {
2553
+ if (D) return;
2554
+ let q;
2555
+ if (ne != null) {
2556
+ if (M)
1971
2557
  try {
1972
- H = It(ce, { columnHeader: v, rowHeader: b, columns: A, rows: R });
1973
- } catch (Pe) {
1974
- _(Pe instanceof Error ? Pe.message : "Failed to process this sheet.");
2558
+ q = rr(de, { columnHeader: A, rowHeader: T, columns: S, rows: C });
2559
+ } catch ($e) {
2560
+ B($e instanceof Error ? $e.message : "Failed to process this sheet.");
1975
2561
  return;
1976
2562
  }
1977
2563
  } else
1978
- H = I == null ? void 0 : I.sheet;
1979
- _(null);
1980
- const ke = ho(q);
1981
- G({ matrix: ce, derivations: ke }), W(H === void 0 ? { derivations: ke } : { sheet: H, derivations: ke });
2564
+ q = x == null ? void 0 : x.sheet;
2565
+ B(null);
2566
+ const xe = xi(K);
2567
+ Z({ matrix: de, derivations: xe }), X(q === void 0 ? { derivations: xe } : { sheet: q, derivations: xe });
1982
2568
  }), () => {
1983
- S = !0;
2569
+ D = !0;
1984
2570
  };
1985
- }, [Z, oe, T, m, j, v, b, A, R, U]), u === !1)
2571
+ }, [b, ne, E, f, M, A, T, S, C, W]), u === !1)
1986
2572
  return null;
1987
- if (U)
1988
- return /* @__PURE__ */ g(M, { mb: "4", children: [
1989
- /* @__PURE__ */ l(p, { as: "label", size: "2", weight: "bold", children: n }),
1990
- /* @__PURE__ */ g(p, { size: "2", color: "red", style: { display: "block" }, children: [
2573
+ if (W)
2574
+ return /* @__PURE__ */ p(N, { mb: "4", children: [
2575
+ /* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: n }),
2576
+ /* @__PURE__ */ p(h, { size: "2", color: "red", style: { display: "block" }, children: [
1991
2577
  "Invalid x-spreadsheet config: ",
1992
- U
2578
+ W
1993
2579
  ] })
1994
2580
  ] });
1995
- if (!m && !ye) return null;
1996
- const x = (S) => {
1997
- S.preventDefault(), S.stopPropagation(), m && fe(S.type === "dragenter" || S.type === "dragover");
1998
- }, V = (S) => {
1999
- var W;
2000
- S.preventDefault(), S.stopPropagation(), fe(!1), m && (W = S.dataTransfer.files) != null && W[0] && h(S.dataTransfer.files[0]);
2001
- }, Q = (S) => {
2002
- var W;
2003
- (W = S.target.files) != null && W[0] && (h(S.target.files[0]), S.target.value = "");
2004
- }, X = () => {
2005
- m && (te(null), G(null), J.current = null, _(null), Y("empty"), r(t, void 0));
2006
- }, me = P && Z == null && I != null;
2007
- return /* @__PURE__ */ g(M, { mb: "4", children: [
2008
- /* @__PURE__ */ g($, { align: "center", justify: "between", mb: "2", children: [
2009
- /* @__PURE__ */ g($, { align: "center", gap: "1", children: [
2010
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", children: [
2581
+ if (!f && !V) return null;
2582
+ const k = (D) => {
2583
+ D.preventDefault(), D.stopPropagation(), f && ve(D.type === "dragenter" || D.type === "dragover");
2584
+ }, ee = (D) => {
2585
+ var X;
2586
+ D.preventDefault(), D.stopPropagation(), ve(!1), f && (X = D.dataTransfer.files) != null && X[0] && y(D.dataTransfer.files[0]);
2587
+ }, se = (D) => {
2588
+ var X;
2589
+ (X = D.target.files) != null && X[0] && (y(D.target.files[0]), D.target.value = "");
2590
+ }, ce = () => {
2591
+ f && (ae(null), Z(null), re.current = null, B(null), H("empty"), r(t, void 0));
2592
+ }, me = U && b == null && x != null;
2593
+ return /* @__PURE__ */ p(N, { mb: "4", children: [
2594
+ /* @__PURE__ */ p(L, { align: "center", justify: "between", mb: "2", children: [
2595
+ /* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
2596
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", children: [
2011
2597
  n,
2012
- d && /* @__PURE__ */ l(p, { color: "red", children: " *" })
2598
+ d && /* @__PURE__ */ s(h, { color: "red", children: " *" })
2013
2599
  ] }),
2014
- ye && m && /* @__PURE__ */ g(xe, { children: [
2015
- /* @__PURE__ */ l(Ke, { content: "Replace spreadsheet", children: /* @__PURE__ */ l(
2016
- Xe,
2600
+ V && f && /* @__PURE__ */ p(Ae, { children: [
2601
+ /* @__PURE__ */ s(rt, { content: "Replace spreadsheet", children: /* @__PURE__ */ s(
2602
+ Ze,
2017
2603
  {
2018
2604
  variant: "ghost",
2019
2605
  size: "1",
2020
2606
  onClick: () => {
2021
- var S;
2022
- return (S = C.current) == null ? void 0 : S.click();
2607
+ var D;
2608
+ return (D = I.current) == null ? void 0 : D.click();
2023
2609
  },
2024
2610
  "aria-label": "Replace spreadsheet",
2025
- children: /* @__PURE__ */ l(je, {})
2611
+ children: /* @__PURE__ */ s(Ge, {})
2026
2612
  }
2027
2613
  ) }),
2028
- /* @__PURE__ */ l(Ke, { content: "Remove spreadsheet", children: /* @__PURE__ */ l(
2029
- Xe,
2614
+ /* @__PURE__ */ s(rt, { content: "Remove spreadsheet", children: /* @__PURE__ */ s(
2615
+ Ze,
2030
2616
  {
2031
2617
  variant: "ghost",
2032
2618
  size: "1",
2033
2619
  color: "gray",
2034
- onClick: X,
2620
+ onClick: ce,
2035
2621
  "aria-label": "Remove spreadsheet",
2036
- children: /* @__PURE__ */ l(ft, {})
2622
+ children: /* @__PURE__ */ s(Ct, {})
2037
2623
  }
2038
2624
  ) })
2039
2625
  ] })
2040
2626
  ] }),
2041
- /* @__PURE__ */ g(p, { size: "1", color: "gray", children: [
2042
- Ce(L),
2627
+ /* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
2628
+ Ie(z),
2043
2629
  " max · ",
2044
- Se(w)
2630
+ De(v)
2045
2631
  ] })
2046
2632
  ] }),
2047
- ye && z && /* @__PURE__ */ l(p, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: z }),
2048
- /* @__PURE__ */ l("input", { ref: C, type: "file", style: { display: "none" }, accept: w, onChange: Q }),
2049
- m && !ye && /* @__PURE__ */ l(
2633
+ V && J && /* @__PURE__ */ s(h, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: J }),
2634
+ /* @__PURE__ */ s("input", { ref: I, type: "file", style: { display: "none" }, accept: v, onChange: se }),
2635
+ f && !V && /* @__PURE__ */ s(
2050
2636
  "div",
2051
2637
  {
2052
2638
  role: "button",
2053
2639
  tabIndex: 0,
2054
2640
  onClick: () => {
2055
- var S;
2056
- return (S = C.current) == null ? void 0 : S.click();
2641
+ var D;
2642
+ return (D = I.current) == null ? void 0 : D.click();
2057
2643
  },
2058
- onKeyDown: (S) => {
2059
- var W;
2060
- (S.key === "Enter" || S.key === " ") && (S.preventDefault(), (W = C.current) == null || W.click());
2644
+ onKeyDown: (D) => {
2645
+ var X;
2646
+ (D.key === "Enter" || D.key === " ") && (D.preventDefault(), (X = I.current) == null || X.click());
2061
2647
  },
2062
- onDragEnter: x,
2063
- onDragLeave: x,
2064
- onDragOver: x,
2065
- onDrop: V,
2648
+ onDragEnter: k,
2649
+ onDragLeave: k,
2650
+ onDragOver: k,
2651
+ onDrop: ee,
2066
2652
  style: { cursor: "pointer" },
2067
2653
  className: [
2068
2654
  "border-2 border-dashed rounded-lg p-6 text-center",
2069
2655
  "transition-all duration-200 ease-in-out",
2070
- ee ? "border-blue-500 bg-blue-50" : z ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
2656
+ le ? "border-blue-500 bg-blue-50" : J ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
2071
2657
  ].join(" "),
2072
- children: /* @__PURE__ */ l($, { direction: "column", align: "center", gap: "2", children: ne === "parsing" ? /* @__PURE__ */ g(xe, { children: [
2073
- /* @__PURE__ */ l(Be, { size: "3" }),
2074
- /* @__PURE__ */ l(p, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
2075
- ] }) : z ? /* @__PURE__ */ g(xe, { children: [
2076
- /* @__PURE__ */ l(pt, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
2077
- /* @__PURE__ */ l(p, { size: "2", color: "red", weight: "medium", children: z }),
2078
- /* @__PURE__ */ l(p, { size: "1", color: "gray", children: "Click to try again" })
2079
- ] }) : /* @__PURE__ */ g(xe, { children: [
2080
- /* @__PURE__ */ l(je, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
2081
- /* @__PURE__ */ l(p, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
2082
- /* @__PURE__ */ g(p, { size: "1", color: "gray", children: [
2083
- Ce(L),
2658
+ children: /* @__PURE__ */ s(L, { direction: "column", align: "center", gap: "2", children: te === "parsing" ? /* @__PURE__ */ p(Ae, { children: [
2659
+ /* @__PURE__ */ s(Je, { size: "3" }),
2660
+ /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Parsing spreadsheet…" })
2661
+ ] }) : J ? /* @__PURE__ */ p(Ae, { children: [
2662
+ /* @__PURE__ */ s(ht, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
2663
+ /* @__PURE__ */ s(h, { size: "2", color: "red", weight: "medium", children: J }),
2664
+ /* @__PURE__ */ s(h, { size: "1", color: "gray", children: "Click to try again" })
2665
+ ] }) : /* @__PURE__ */ p(Ae, { children: [
2666
+ /* @__PURE__ */ s(Ge, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
2667
+ /* @__PURE__ */ s(h, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
2668
+ /* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
2669
+ Ie(z),
2084
2670
  " max · ",
2085
- Se(w)
2671
+ De(v)
2086
2672
  ] })
2087
2673
  ] }) })
2088
2674
  }
2089
2675
  ),
2090
- he,
2091
- me && /* @__PURE__ */ l(p, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
2092
- Object.keys(le).length > 0 && /* @__PURE__ */ g(M, { mt: "3", children: [
2093
- /* @__PURE__ */ l(p, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
2094
- /* @__PURE__ */ l($, { direction: "column", gap: "1", children: Object.entries(le).map(([S, W]) => /* @__PURE__ */ g($, { justify: "between", children: [
2095
- /* @__PURE__ */ l(p, { size: "2", children: W.label }),
2096
- W.error ? /* @__PURE__ */ l(p, { size: "2", color: "red", children: W.error }) : (
2676
+ G,
2677
+ me && /* @__PURE__ */ s(h, { size: "2", color: "gray", mt: "3", style: { display: "block" }, children: "Sheet preview not stored for this field — re-upload to view contents." }),
2678
+ Object.keys(O).length > 0 && /* @__PURE__ */ p(N, { mt: "3", children: [
2679
+ /* @__PURE__ */ s(h, { size: "2", weight: "bold", as: "div", mb: "1", children: "Computed values" }),
2680
+ /* @__PURE__ */ s(L, { direction: "column", gap: "1", children: Object.entries(O).map(([D, X]) => /* @__PURE__ */ p(L, { justify: "between", children: [
2681
+ /* @__PURE__ */ s(h, { size: "2", children: X.label }),
2682
+ X.error ? /* @__PURE__ */ s(h, { size: "2", color: "red", children: X.error }) : (
2097
2683
  // d.value is CellValue | null now (SUM/AVERAGE aren't the only
2098
2684
  // possible results anymore — INDEX/CONCATENATE can return a
2099
2685
  // string, a bare comparison can return a boolean, etc.), so
2100
2686
  // `.toLocaleString()` would throw for e.g. a boolean result.
2101
2687
  // Reuse the same formatCell used for the sheet-preview grid.
2102
- /* @__PURE__ */ l(p, { size: "2", children: kt(W.value) })
2688
+ /* @__PURE__ */ s(h, { size: "2", children: nr(X.value) })
2103
2689
  )
2104
- ] }, S)) })
2690
+ ] }, D)) })
2105
2691
  ] }),
2106
- !y && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Re(c, n) })
2692
+ !m && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Oe(c, n) })
2107
2693
  ] });
2108
- }, Ro = be(Ao), Co = ie(
2694
+ }, Li = Ee(Ni), zi = ue(
2109
2695
  10,
2110
2696
  // matches FileControlTester's rank — beats the default object/Group renderer
2111
- ze(
2697
+ _e(
2112
2698
  (e) => e.type === "object" && typeof e["x-spreadsheet"] == "object"
2113
2699
  )
2114
- ), So = "Sheet1", Oo = "xlsx";
2115
- function No(e) {
2700
+ ), Mi = "Sheet1", Fi = "xlsx";
2701
+ function $i(e) {
2116
2702
  if (e === void 0) return null;
2117
2703
  if (!Array.isArray(e)) return "columns must be an array of { id, label } objects.";
2118
2704
  if (e.length === 0)
@@ -2122,64 +2708,64 @@ function No(e) {
2122
2708
  );
2123
2709
  return r !== -1 ? `columns[${r}] must be a { id, label } object with non-empty string fields.` : null;
2124
2710
  }
2125
- function Do(e, r) {
2126
- if (!sr(e)) return e;
2127
- const t = lr(
2711
+ function Pi(e, r) {
2712
+ if (!Pr(e)) return e;
2713
+ const t = Ur(
2128
2714
  e,
2129
- r == null ? void 0 : r.map((s) => s.id)
2715
+ r == null ? void 0 : r.map((l) => l.id)
2130
2716
  );
2131
2717
  if (!r || t.length === 0) return t;
2132
- const n = new Map(r.map((s) => [s.id, s.label])), [i, ...o] = t;
2133
- return [i.map((s) => n.get(String(s)) ?? s), ...o];
2718
+ const n = new Map(r.map((l) => [l.id, l.label])), [i, ...o] = t;
2719
+ return [i.map((l) => n.get(String(l)) ?? l), ...o];
2134
2720
  }
2135
- const Io = ({ data: e, path: r, label: t, schema: n, visible: i = !0 }) => {
2136
- const [o, s] = B(null), a = $e();
2721
+ const Ui = ({ data: e, path: r, label: t, schema: n, visible: i = !0 }) => {
2722
+ const [o, l] = Y(null), a = Ne();
2137
2723
  if (i === !1)
2138
2724
  return null;
2139
- const c = (n == null ? void 0 : n["x-spreadsheet-export"]) ?? {}, u = c.columns, d = c.sheetName ?? So, y = c.fileType ?? Oo, m = c.fileName ?? `export.${y}`, f = No(u);
2140
- if (f)
2141
- return /* @__PURE__ */ g(M, { mb: "4", children: [
2142
- /* @__PURE__ */ l(p, { as: "label", size: "2", weight: "bold", children: t }),
2143
- /* @__PURE__ */ g(p, { size: "2", color: "red", style: { display: "block" }, children: [
2725
+ const c = (n == null ? void 0 : n["x-spreadsheet-export"]) ?? {}, u = c.columns, d = c.sheetName ?? Mi, m = c.fileType ?? Fi, f = c.fileName ?? `export.${m}`, g = $i(u);
2726
+ if (g)
2727
+ return /* @__PURE__ */ p(N, { mb: "4", children: [
2728
+ /* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: t }),
2729
+ /* @__PURE__ */ p(h, { size: "2", color: "red", style: { display: "block" }, children: [
2144
2730
  "Invalid x-spreadsheet-export config: ",
2145
- f
2731
+ g
2146
2732
  ] })
2147
2733
  ] });
2148
- const T = Array.isArray(e) && e.length > 0, w = async () => {
2149
- var L, D;
2150
- if (T) {
2151
- s(null);
2734
+ const E = Array.isArray(e) && e.length > 0, v = async () => {
2735
+ var z, R;
2736
+ if (E) {
2737
+ l(null);
2152
2738
  try {
2153
- const N = await import("@e965/xlsx"), A = Do(e, u), R = N.utils.aoa_to_sheet(A), v = N.utils.book_new();
2154
- N.utils.book_append_sheet(v, R, d);
2155
- const b = r.split(".").slice(0, -1).join("."), U = b ? He.data((L = a.core) == null ? void 0 : L.data, b) : (D = a.core) == null ? void 0 : D.data;
2156
- N.writeFile(v, mt(m, U, `export.${y}`), { bookType: y });
2157
- } catch (N) {
2158
- s(N instanceof Error ? N.message : "Failed to build the workbook.");
2739
+ const j = await import("@e965/xlsx"), S = Pi(e, u), C = j.utils.aoa_to_sheet(S), A = j.utils.book_new();
2740
+ j.utils.book_append_sheet(A, C, d);
2741
+ const T = r.split(".").slice(0, -1).join("."), W = T ? Xe.data((z = a.core) == null ? void 0 : z.data, T) : (R = a.core) == null ? void 0 : R.data;
2742
+ j.writeFile(A, It(f, W, `export.${m}`), { bookType: m });
2743
+ } catch (j) {
2744
+ l(j instanceof Error ? j.message : "Failed to build the workbook.");
2159
2745
  }
2160
2746
  }
2161
2747
  };
2162
- return /* @__PURE__ */ g(M, { mb: "4", children: [
2163
- /* @__PURE__ */ l(p, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: t }),
2164
- /* @__PURE__ */ g(Ue, { type: "button", variant: "soft", disabled: !T, onClick: () => void w(), children: [
2165
- /* @__PURE__ */ l(dt, {}),
2748
+ return /* @__PURE__ */ p(N, { mb: "4", children: [
2749
+ /* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: t }),
2750
+ /* @__PURE__ */ p(Re, { type: "button", variant: "soft", disabled: !E, onClick: () => void v(), children: [
2751
+ /* @__PURE__ */ s(Rt, {}),
2166
2752
  " Download Spreadsheet"
2167
2753
  ] }),
2168
- o && /* @__PURE__ */ l(p, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: o })
2754
+ o && /* @__PURE__ */ s(h, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: o })
2169
2755
  ] });
2170
- }, ko = be(Io), Lo = ie(
2756
+ }, ji = Ee(Ui), _i = ue(
2171
2757
  10,
2172
- Wt(
2173
- ze((e) => {
2758
+ mr(
2759
+ _e((e) => {
2174
2760
  const r = e["x-spreadsheet-export"];
2175
2761
  return e.type === "array" && typeof r == "object" && r !== null;
2176
2762
  }),
2177
- Cr(Sr("editable", !0))
2763
+ mn(gn("editable", !0))
2178
2764
  )
2179
2765
  );
2180
- class Le extends Error {
2766
+ class Ue extends Error {
2181
2767
  }
2182
- const Lt = 5e6, Mo = 1024, zo = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i, Fo = {
2768
+ const or = 5e6, Vi = 1024, Wi = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i, Hi = {
2183
2769
  // Default is true, which would silently drop what in many formats is most of
2184
2770
  // the payload.
2185
2771
  ignoreAttributes: !1,
@@ -2226,7 +2812,7 @@ const Lt = 5e6, Mo = 1024, zo = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["'
2226
2812
  maxNestedTags: 100,
2227
2813
  strictReservedNames: !0
2228
2814
  };
2229
- function $o(e) {
2815
+ function Bi(e) {
2230
2816
  const r = new Set(e);
2231
2817
  return r.size === 0 ? () => !1 : (t, n) => (
2232
2818
  // A string while the library's own `jPath` option is true (the default) and
@@ -2234,120 +2820,120 @@ function $o(e) {
2234
2820
  r.has(typeof n == "string" ? n : n.toString()) || r.has(t)
2235
2821
  );
2236
2822
  }
2237
- function Uo(e) {
2823
+ function Xi(e) {
2238
2824
  const r = e instanceof Error ? e.message : "";
2239
2825
  return r.startsWith("[SECURITY] Invalid name:") ? "This document uses a reserved JavaScript name (__proto__, constructor or prototype) as an element or attribute name, which cannot be represented safely." : r === "External entities are not supported" || r === "Parameter entities are not supported" ? `${r}. Please remove the DOCTYPE entity declarations and try again.` : r.startsWith("Maximum nested tags exceeded") ? "This document is nested too deeply to parse." : r.startsWith("Entity count") || r.includes("exceeds maximum allowed") ? "This document declares too many or too large entity definitions to expand safely." : "This doesn't look like a valid XML document. Please check the file and try again.";
2240
2826
  }
2241
- async function Po(e, r = {}) {
2827
+ async function qi(e, r = {}) {
2242
2828
  var u;
2243
- if (typeof e != "string") throw new Le("This file could not be read as text.");
2829
+ if (typeof e != "string") throw new Ue("This file could not be read as text.");
2244
2830
  const t = e.charCodeAt(0) === 65279 ? e.slice(1) : e;
2245
- if (t.trim() === "") throw new Le("This file is empty.");
2246
- if (t.length > Lt)
2247
- throw new Le(
2248
- `This document is too large to parse (over ${Lt / 1e6} million characters).`
2831
+ if (t.trim() === "") throw new Ue("This file is empty.");
2832
+ if (t.length > or)
2833
+ throw new Ue(
2834
+ `This document is too large to parse (over ${or / 1e6} million characters).`
2249
2835
  );
2250
- const n = (u = zo.exec(t.slice(0, Mo))) == null ? void 0 : u[1];
2836
+ const n = (u = Wi.exec(t.slice(0, Vi))) == null ? void 0 : u[1];
2251
2837
  if (n && !/^utf-?8$/i.test(n))
2252
- throw new Le(
2838
+ throw new Ue(
2253
2839
  `This document declares the unsupported encoding "${n}". Only UTF-8 is supported.`
2254
2840
  );
2255
- const { XMLParser: i, XMLValidator: o } = await import("fast-xml-parser"), s = o.validate(t, { allowBooleanAttributes: !1 });
2256
- if (s !== !0) {
2257
- const { msg: d, line: y, col: m } = s.err;
2258
- throw new Le(`Invalid XML at line ${y}, column ${m}: ${d}`);
2841
+ const { XMLParser: i, XMLValidator: o } = await import("fast-xml-parser"), l = o.validate(t, { allowBooleanAttributes: !1 });
2842
+ if (l !== !0) {
2843
+ const { msg: d, line: m, col: f } = l.err;
2844
+ throw new Ue(`Invalid XML at line ${m}, column ${f}: ${d}`);
2259
2845
  }
2260
2846
  const a = new i({
2261
- ...Fo,
2847
+ ...Hi,
2262
2848
  removeNSPrefix: r.removeNamespaces === !0,
2263
- isArray: $o(r.arrayPaths ?? [])
2849
+ isArray: Bi(r.arrayPaths ?? [])
2264
2850
  });
2265
2851
  let c;
2266
2852
  try {
2267
2853
  c = a.parse(t);
2268
2854
  } catch (d) {
2269
- throw new Le(Uo(d));
2855
+ throw new Ue(Xi(d));
2270
2856
  }
2271
2857
  if (c == null || typeof c != "object" || Array.isArray(c))
2272
- throw new Le("This document has no root element.");
2858
+ throw new Ue("This document has no root element.");
2273
2859
  return c;
2274
2860
  }
2275
- function cr(e, r, t) {
2276
- const { path: n, default: i } = typeof t == "string" ? { path: t, default: void 0 } : t, o = He.data(e, r ? `${r}.${n}` : n);
2861
+ function jr(e, r, t) {
2862
+ const { path: n, default: i } = typeof t == "string" ? { path: t, default: void 0 } : t, o = Xe.data(e, r ? `${r}.${n}` : n);
2277
2863
  return o ?? i;
2278
2864
  }
2279
- function _o(e, r, t) {
2865
+ function Ki(e, r, t) {
2280
2866
  const n = {};
2281
2867
  for (const [i, o] of Object.entries(t)) {
2282
- const s = cr(e, r, o);
2283
- if (s === void 0) return;
2284
- n[i] = s;
2868
+ const l = jr(e, r, o);
2869
+ if (l === void 0) return;
2870
+ n[i] = l;
2285
2871
  }
2286
2872
  return n;
2287
2873
  }
2288
- async function jo(e, r) {
2874
+ async function Yi(e, r) {
2289
2875
  try {
2290
- return { status: "ok", value: await nr(e, r) };
2876
+ return { status: "ok", value: await Mr(e, r) };
2291
2877
  } catch (t) {
2292
- return { status: "error", error: gt(t) };
2878
+ return { status: "error", error: Dt(t) };
2293
2879
  }
2294
2880
  }
2295
- function ar(e, r) {
2296
- return e == null ? "" : typeof e == "number" ? e.toFixed(Vo(r)) : e instanceof Date ? e.toLocaleDateString() : String(e);
2881
+ function _r(e, r) {
2882
+ return e == null ? "" : typeof e == "number" ? e.toFixed(Gi(r)) : e instanceof Date ? e.toLocaleDateString() : String(e);
2297
2883
  }
2298
- function Vo(e) {
2884
+ function Gi(e) {
2299
2885
  return Number.isFinite(e) ? Math.min(100, Math.max(0, Math.trunc(e))) : 0;
2300
2886
  }
2301
- const Me = { found: !1 }, ve = (e) => ({ found: !0, value: e });
2302
- function Mt(e) {
2303
- return e == null || e === "" ? Me : Array.isArray(e) || e instanceof Date ? ve(e) : typeof e == "object" ? Me : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? ve(e) : Me;
2887
+ const je = { found: !1 }, Te = (e) => ({ found: !0, value: e });
2888
+ function ir(e) {
2889
+ return e == null || e === "" ? je : Array.isArray(e) || e instanceof Date ? Te(e) : typeof e == "object" ? je : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? Te(e) : je;
2304
2890
  }
2305
- const Wo = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), Ho = /* @__PURE__ */ new Set(["false", "0", "no", "n"]), Bo = /^(\d{4}-\d{2}-\d{2})(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;
2306
- async function Xo(e, r, t) {
2891
+ const Ji = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), Zi = /* @__PURE__ */ new Set(["false", "0", "no", "n"]), Qi = /^(\d{4}-\d{2}-\d{2})(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;
2892
+ async function es(e, r, t) {
2307
2893
  switch (r.as) {
2308
2894
  case void 0:
2309
- return ve(e);
2895
+ return Te(e);
2310
2896
  case "string":
2311
- return ve(e instanceof Date ? e.toISOString() : String(e));
2897
+ return Te(e instanceof Date ? e.toISOString() : String(e));
2312
2898
  case "number": {
2313
2899
  const n = e instanceof Date ? e.getTime() : Number(e);
2314
- return Number.isFinite(n) ? ve(r.decimals === void 0 ? n : ar(n, r.decimals)) : Me;
2900
+ return Number.isFinite(n) ? Te(r.decimals === void 0 ? n : _r(n, r.decimals)) : je;
2315
2901
  }
2316
2902
  case "boolean": {
2317
2903
  const n = String(e).trim().toLowerCase();
2318
- return Wo.has(n) ? ve(!0) : Ho.has(n) ? ve(!1) : Me;
2904
+ return Ji.has(n) ? Te(!0) : Zi.has(n) ? Te(!1) : je;
2319
2905
  }
2320
2906
  case "date": {
2321
2907
  const { default: n } = await import("dayjs"), { default: i } = await import("./customParseFormat-D14EWdSX.js").then((a) => a.c);
2322
2908
  if (n.extend(i), t === "export") {
2323
- const a = typeof e == "string" ? Bo.exec(e) : null, c = e instanceof Date ? n(e) : a ? n(a[1], "YYYY-MM-DD", !0) : null;
2324
- return c != null && c.isValid() ? ve(c.format(r.format ?? "YYYY-MM-DD")) : Me;
2909
+ const a = typeof e == "string" ? Qi.exec(e) : null, c = e instanceof Date ? n(e) : a ? n(a[1], "YYYY-MM-DD", !0) : null;
2910
+ return c != null && c.isValid() ? Te(c.format(r.format ?? "YYYY-MM-DD")) : je;
2325
2911
  }
2326
- const o = e instanceof Date ? e.toISOString() : String(e), s = r.format ? n(o, r.format, !0) : n(o);
2327
- return s.isValid() ? ve(s.format("YYYY-MM-DD")) : Me;
2912
+ const o = e instanceof Date ? e.toISOString() : String(e), l = r.format ? n(o, r.format, !0) : n(o);
2913
+ return l.isValid() ? Te(l.format("YYYY-MM-DD")) : je;
2328
2914
  }
2329
2915
  }
2330
2916
  }
2331
- async function qo(e, r) {
2917
+ async function ts(e, r) {
2332
2918
  if (r.formula !== void 0) {
2333
2919
  const t = {};
2334
2920
  for (const [n, i] of Object.entries(r.inputs ?? {})) {
2335
- const o = Mt(He.data(e, i));
2336
- if (!o.found || Array.isArray(o.value)) return Me;
2921
+ const o = ir(Xe.data(e, i));
2922
+ if (!o.found || Array.isArray(o.value)) return je;
2337
2923
  t[n] = o.value;
2338
2924
  }
2339
2925
  try {
2340
- return ve(await nr(t, r.formula));
2926
+ return Te(await Mr(t, r.formula));
2341
2927
  } catch (n) {
2342
- throw new Error(`writeTo "${r.to}": ${gt(n)}`);
2928
+ throw new Error(`writeTo "${r.to}": ${Dt(n)}`);
2343
2929
  }
2344
2930
  }
2345
2931
  if (r.from === void 0) throw new Error(`writeTo "${r.to}" needs either "from" or "formula".`);
2346
- return Mt(He.data(e, r.from));
2932
+ return ir(Xe.data(e, r.from));
2347
2933
  }
2348
- const rt = "@_", ur = "#text", nt = (e) => e.split(".").filter(Boolean), dr = (e) => e.startsWith(rt) || e === ur;
2349
- function fr(e, r) {
2350
- if (typeof e.to != "string" || nt(e.to).length === 0) return '"to" must be a non-empty path.';
2934
+ const dt = "@_", Vr = "#text", ft = (e) => e.split(".").filter(Boolean), Wr = (e) => e.startsWith(dt) || e === Vr;
2935
+ function Hr(e, r) {
2936
+ if (typeof e.to != "string" || ft(e.to).length === 0) return '"to" must be a non-empty path.';
2351
2937
  if (e.format !== void 0 && e.as !== "date") return '"format" needs "as": "date".';
2352
2938
  if (e.decimals !== void 0) {
2353
2939
  if (r === "import")
@@ -2358,79 +2944,79 @@ function fr(e, r) {
2358
2944
  return '"decimals" must be a whole number from 0 to 100.';
2359
2945
  }
2360
2946
  if (r === "export") {
2361
- const t = nt(e.to);
2947
+ const t = ft(e.to);
2362
2948
  for (const [n, i] of t.entries()) {
2363
- if (i === rt) return '"@_" needs an attribute name after it, e.g. "@_id".';
2364
- if (dr(i) && n < t.length - 1)
2949
+ if (i === dt) return '"@_" needs an attribute name after it, e.g. "@_id".';
2950
+ if (Wr(i) && n < t.length - 1)
2365
2951
  return `"${i}" must be the last segment — it belongs to the element before it.`;
2366
2952
  }
2367
2953
  }
2368
2954
  return null;
2369
2955
  }
2370
- function zt(e, r, t) {
2371
- const n = t ? ` To give "${r}" both text and attributes, write its text to "${r}.${ur}".` : "";
2956
+ function sr(e, r, t) {
2957
+ const n = t ? ` To give "${r}" both text and attributes, write its text to "${r}.${Vr}".` : "";
2372
2958
  return new Error(`writeTo "${e}": "${r}" is written both as a value and as the parent of other values.${n}`);
2373
2959
  }
2374
- function pr(e) {
2960
+ function Br(e) {
2375
2961
  const r = {}, t = /* @__PURE__ */ new Set([r]);
2376
2962
  for (const { to: n, value: i } of e) {
2377
- const o = nt(n);
2963
+ const o = ft(n);
2378
2964
  if (o.length === 0) continue;
2379
- let s = r;
2965
+ let l = r;
2380
2966
  for (const [u, d] of o.slice(0, -1).entries()) {
2381
- const y = s[d];
2382
- if (y === void 0) {
2383
- const m = {};
2384
- t.add(m), s[d] = m, s = m;
2385
- } else if (t.has(y))
2386
- s = y;
2967
+ const m = l[d];
2968
+ if (m === void 0) {
2969
+ const f = {};
2970
+ t.add(f), l[d] = f, l = f;
2971
+ } else if (t.has(m))
2972
+ l = m;
2387
2973
  else
2388
- throw zt(n, o.slice(0, u + 1).join("."), o[u + 1].startsWith(rt));
2974
+ throw sr(n, o.slice(0, u + 1).join("."), o[u + 1].startsWith(dt));
2389
2975
  }
2390
- const a = o[o.length - 1], c = s[a];
2976
+ const a = o[o.length - 1], c = l[a];
2391
2977
  if (t.has(c)) {
2392
- const u = Object.keys(c).some((d) => d.startsWith(rt));
2393
- throw zt(n, o.join("."), u);
2978
+ const u = Object.keys(c).some((d) => d.startsWith(dt));
2979
+ throw sr(n, o.join("."), u);
2394
2980
  }
2395
- s[a] = i;
2981
+ l[a] = i;
2396
2982
  }
2397
2983
  return r;
2398
2984
  }
2399
- const Ko = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean";
2400
- async function yt(e, r, t) {
2985
+ const rs = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean";
2986
+ async function Nt(e, r, t) {
2401
2987
  const n = [];
2402
2988
  for (const i of r) {
2403
- const o = fr(i, t);
2989
+ const o = Hr(i, t);
2404
2990
  if (o) throw new Error(`writeTo "${i.to}": ${o}`);
2405
- const s = nt(i.to), a = t === "export" && dr(s[s.length - 1]), c = (y) => {
2406
- if (!(a && y == null)) {
2407
- if (a && !Ko(y)) {
2408
- const m = y instanceof Date ? ' Add "as": "date" to write a date.' : "";
2991
+ const l = ft(i.to), a = t === "export" && Wr(l[l.length - 1]), c = (m) => {
2992
+ if (!(a && m == null)) {
2993
+ if (a && !rs(m)) {
2994
+ const f = m instanceof Date ? ' Add "as": "date" to write a date.' : "";
2409
2995
  throw new Error(
2410
- `writeTo "${i.to}": an attribute or #text value must be text, a number or a boolean.${m}`
2996
+ `writeTo "${i.to}": an attribute or #text value must be text, a number or a boolean.${f}`
2411
2997
  );
2412
2998
  }
2413
- n.push({ to: i.to, value: y });
2999
+ n.push({ to: i.to, value: m });
2414
3000
  }
2415
3001
  };
2416
- let u = await qo(e, i);
3002
+ let u = await ts(e, i);
2417
3003
  const d = u.found && Array.isArray(u.value);
2418
3004
  if (u.found && d && i.writeTo) {
2419
- const y = await Promise.all(
3005
+ const m = await Promise.all(
2420
3006
  u.value.map(
2421
- async (m) => pr(await yt(m, i.writeTo, t))
3007
+ async (f) => Br(await Nt(f, i.writeTo, t))
2422
3008
  )
2423
3009
  );
2424
- c(y);
3010
+ c(m);
2425
3011
  continue;
2426
3012
  }
2427
3013
  if (u.found && !d && i.writeTo)
2428
3014
  throw new Error(`writeTo "${i.to}": "writeTo" is set, but "from" did not resolve to a repeating element.`);
2429
3015
  if (u.found && !d && i.map) {
2430
- const y = u.value instanceof Date ? u.value.toISOString() : String(u.value);
2431
- Object.prototype.hasOwnProperty.call(i.map, y) && (u = ve(i.map[y]));
3016
+ const m = u.value instanceof Date ? u.value.toISOString() : String(u.value);
3017
+ Object.prototype.hasOwnProperty.call(i.map, m) && (u = Te(i.map[m]));
2432
3018
  }
2433
- if (u.found && !d && (u = await Xo(u.value, i, t)), !u.found) {
3019
+ if (u.found && !d && (u = await es(u.value, i, t)), !u.found) {
2434
3020
  if (i.default === void 0) continue;
2435
3021
  c(i.default);
2436
3022
  continue;
@@ -2439,163 +3025,163 @@ async function yt(e, r, t) {
2439
3025
  }
2440
3026
  return n;
2441
3027
  }
2442
- const Yo = ".xml,text/xml,application/xml", Go = 5 * 1024 * 1024, Jo = ({
3028
+ const ns = ".xml,text/xml,application/xml", os = 5 * 1024 * 1024, is = ({
2443
3029
  data: e,
2444
3030
  handleChange: r,
2445
3031
  path: t,
2446
3032
  label: n,
2447
3033
  required: i,
2448
3034
  schema: o,
2449
- enabled: s,
3035
+ enabled: l,
2450
3036
  readonly: a,
2451
3037
  errors: c,
2452
3038
  visible: u = !0
2453
3039
  }) => {
2454
- Oe(u, t, r);
2455
- const d = Ae(t, i, u), y = !c || c.length === 0, m = er(s, a), f = (o == null ? void 0 : o["x-xml"]) ?? {}, T = f.accept ?? Yo, w = f.maxSize ?? Go, L = f.arrayPaths, D = f.removeNamespaces === !0, N = f.writeTo, A = f.writeBase ?? "root", R = f.persistDocument !== !1, v = $e(), b = e ?? null, [U, P] = B(() => b ? "ready" : "empty"), [O, j] = B(null), [I, ne] = B(!1), Y = ge(null), z = ge(0), _ = b != null, ee = N !== void 0 && N.length > 0, fe = We(
2456
- async (C) => {
2457
- var he;
2458
- const J = ++z.current;
2459
- if (j(null), C.size > w) {
2460
- j(`File exceeds the ${Ce(w)} limit.`);
3040
+ Le(u, t, r);
3041
+ const d = Ce(t, i, u), m = !c || c.length === 0, f = Nr(l, a), g = (o == null ? void 0 : o["x-xml"]) ?? {}, E = g.accept ?? ns, v = g.maxSize ?? os, z = g.arrayPaths, R = g.removeNamespaces === !0, j = g.writeTo, S = g.writeBase ?? "root", C = g.persistDocument !== !1, A = Ne(), T = e ?? null, [W, U] = Y(() => T ? "ready" : "empty"), [F, M] = Y(null), [x, te] = Y(!1), H = he(null), J = he(0), B = T != null, le = j !== void 0 && j.length > 0, ve = Be(
3042
+ async (I) => {
3043
+ var G;
3044
+ const re = ++J.current;
3045
+ if (M(null), I.size > v) {
3046
+ M(`File exceeds the ${Ie(v)} limit.`);
2461
3047
  return;
2462
3048
  }
2463
- if (!T.split(",").map((h) => h.trim()).some((h) => h === "*" || h === "*/*" ? !0 : h.endsWith("/*") ? C.type.startsWith(h.slice(0, -1)) : h.startsWith(".") ? C.name.toLowerCase().endsWith(h.toLowerCase()) : C.type === h)) {
2464
- j(`Invalid type. Accepted: ${Se(T)}`);
3049
+ if (!E.split(",").map((y) => y.trim()).some((y) => y === "*" || y === "*/*" ? !0 : y.endsWith("/*") ? I.type.startsWith(y.slice(0, -1)) : y.startsWith(".") ? I.name.toLowerCase().endsWith(y.toLowerCase()) : I.type === y)) {
3050
+ M(`Invalid type. Accepted: ${De(E)}`);
2465
3051
  return;
2466
3052
  }
2467
- P("parsing");
2468
- let Z;
3053
+ U("parsing");
3054
+ let b;
2469
3055
  try {
2470
- const h = await C.text();
2471
- Z = await Po(h, { arrayPaths: L, removeNamespaces: D });
2472
- } catch (h) {
2473
- if (J !== z.current) return;
2474
- P("error"), j(
2475
- h instanceof Le ? h.message : "This doesn't look like a valid XML document. Please check the file and try again."
3056
+ const y = await I.text();
3057
+ b = await qi(y, { arrayPaths: z, removeNamespaces: R });
3058
+ } catch (y) {
3059
+ if (re !== J.current) return;
3060
+ U("error"), M(
3061
+ y instanceof Ue ? y.message : "This doesn't look like a valid XML document. Please check the file and try again."
2476
3062
  );
2477
3063
  return;
2478
3064
  }
2479
- let le = [];
2480
- if (N && N.length > 0)
3065
+ let O = [];
3066
+ if (j && j.length > 0)
2481
3067
  try {
2482
- le = await yt(Z, N, "import");
2483
- } catch (h) {
2484
- if (J !== z.current) return;
2485
- P("error"), j(h instanceof Error ? h.message : "This document could not be mapped onto the form.");
3068
+ O = await Nt(b, j, "import");
3069
+ } catch (y) {
3070
+ if (re !== J.current) return;
3071
+ U("error"), M(y instanceof Error ? y.message : "This document could not be mapped onto the form.");
2486
3072
  return;
2487
3073
  }
2488
- if (J !== z.current) return;
2489
- R && r(t, Z);
2490
- const ye = A === "parent" ? t.split(".").slice(0, -1).join(".") : "";
2491
- for (const h of le) (he = v.dispatch) == null || he.call(v, Or(ye ? `${ye}.${h.to}` : h.to, () => h.value));
2492
- P("ready");
3074
+ if (re !== J.current) return;
3075
+ C && r(t, b);
3076
+ const V = S === "parent" ? t.split(".").slice(0, -1).join(".") : "";
3077
+ for (const y of O) (G = A.dispatch) == null || G.call(A, yn(V ? `${V}.${y.to}` : y.to, () => y.value));
3078
+ U("ready");
2493
3079
  },
2494
- [T, w, L, D, N, A, R, t, r, v]
3080
+ [E, v, z, R, j, S, C, t, r, A]
2495
3081
  );
2496
- if (u === !1 || !m && !_) return null;
2497
- const oe = (C) => {
2498
- C.preventDefault(), C.stopPropagation(), m && ne(C.type === "dragenter" || C.type === "dragover");
2499
- }, te = (C) => {
2500
- var J;
2501
- C.preventDefault(), C.stopPropagation(), ne(!1), m && (J = C.dataTransfer.files) != null && J[0] && fe(C.dataTransfer.files[0]);
2502
- }, k = (C) => {
2503
- var J;
2504
- (J = C.target.files) != null && J[0] && (fe(C.target.files[0]), C.target.value = "");
3082
+ if (u === !1 || !f && !B) return null;
3083
+ const ne = (I) => {
3084
+ I.preventDefault(), I.stopPropagation(), f && te(I.type === "dragenter" || I.type === "dragover");
3085
+ }, ae = (I) => {
3086
+ var re;
3087
+ I.preventDefault(), I.stopPropagation(), te(!1), f && (re = I.dataTransfer.files) != null && re[0] && ve(I.dataTransfer.files[0]);
3088
+ }, $ = (I) => {
3089
+ var re;
3090
+ (re = I.target.files) != null && re[0] && (ve(I.target.files[0]), I.target.value = "");
2505
3091
  };
2506
- return /* @__PURE__ */ g(M, { mb: "4", children: [
2507
- /* @__PURE__ */ g($, { align: "center", justify: "between", mb: "2", children: [
2508
- /* @__PURE__ */ g($, { align: "center", gap: "1", children: [
2509
- /* @__PURE__ */ g(p, { as: "label", size: "2", weight: "bold", children: [
3092
+ return /* @__PURE__ */ p(N, { mb: "4", children: [
3093
+ /* @__PURE__ */ p(L, { align: "center", justify: "between", mb: "2", children: [
3094
+ /* @__PURE__ */ p(L, { align: "center", gap: "1", children: [
3095
+ /* @__PURE__ */ p(h, { as: "label", size: "2", weight: "bold", children: [
2510
3096
  n,
2511
- d && /* @__PURE__ */ l(p, { color: "red", children: " *" })
3097
+ d && /* @__PURE__ */ s(h, { color: "red", children: " *" })
2512
3098
  ] }),
2513
- !ee && _ && m && /* @__PURE__ */ g(xe, { children: [
2514
- /* @__PURE__ */ l(Ke, { content: "Replace document", children: /* @__PURE__ */ l(
2515
- Xe,
3099
+ !le && B && f && /* @__PURE__ */ p(Ae, { children: [
3100
+ /* @__PURE__ */ s(rt, { content: "Replace document", children: /* @__PURE__ */ s(
3101
+ Ze,
2516
3102
  {
2517
3103
  variant: "ghost",
2518
3104
  size: "1",
2519
3105
  onClick: () => {
2520
- var C;
2521
- return (C = Y.current) == null ? void 0 : C.click();
3106
+ var I;
3107
+ return (I = H.current) == null ? void 0 : I.click();
2522
3108
  },
2523
3109
  "aria-label": "Replace document",
2524
- children: /* @__PURE__ */ l(je, {})
3110
+ children: /* @__PURE__ */ s(Ge, {})
2525
3111
  }
2526
3112
  ) }),
2527
- /* @__PURE__ */ l(Ke, { content: "Remove document", children: /* @__PURE__ */ l(Xe, { variant: "ghost", size: "1", color: "gray", onClick: () => {
2528
- m && (++z.current, j(null), P("empty"), r(t, void 0));
2529
- }, "aria-label": "Remove document", children: /* @__PURE__ */ l(ft, {}) }) })
3113
+ /* @__PURE__ */ s(rt, { content: "Remove document", children: /* @__PURE__ */ s(Ze, { variant: "ghost", size: "1", color: "gray", onClick: () => {
3114
+ f && (++J.current, M(null), U("empty"), r(t, void 0));
3115
+ }, "aria-label": "Remove document", children: /* @__PURE__ */ s(Ct, {}) }) })
2530
3116
  ] })
2531
3117
  ] }),
2532
- /* @__PURE__ */ g($, { align: "center", gap: "2", children: [
2533
- /* @__PURE__ */ g(p, { size: "1", color: "gray", children: [
2534
- Ce(w),
3118
+ /* @__PURE__ */ p(L, { align: "center", gap: "2", children: [
3119
+ /* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
3120
+ Ie(v),
2535
3121
  " max · ",
2536
- Se(T)
3122
+ De(E)
2537
3123
  ] }),
2538
- ee && m && /* @__PURE__ */ g(Ue, { size: "1", variant: "soft", onClick: () => {
2539
- var C;
2540
- return (C = Y.current) == null ? void 0 : C.click();
2541
- }, disabled: U === "parsing", children: [
2542
- U === "parsing" ? /* @__PURE__ */ l(Be, { size: "1" }) : /* @__PURE__ */ l(je, {}),
3124
+ le && f && /* @__PURE__ */ p(Re, { size: "1", variant: "soft", onClick: () => {
3125
+ var I;
3126
+ return (I = H.current) == null ? void 0 : I.click();
3127
+ }, disabled: W === "parsing", children: [
3128
+ W === "parsing" ? /* @__PURE__ */ s(Je, { size: "1" }) : /* @__PURE__ */ s(Ge, {}),
2543
3129
  "Upload"
2544
3130
  ] })
2545
3131
  ] })
2546
3132
  ] }),
2547
- (ee || _) && O && /* @__PURE__ */ l(p, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: O }),
2548
- /* @__PURE__ */ l("input", { ref: Y, type: "file", style: { display: "none" }, accept: T, onChange: k }),
2549
- !ee && m && !_ && /* @__PURE__ */ l(
3133
+ (le || B) && F && /* @__PURE__ */ s(h, { size: "2", color: "red", mb: "2", style: { display: "block" }, children: F }),
3134
+ /* @__PURE__ */ s("input", { ref: H, type: "file", style: { display: "none" }, accept: E, onChange: $ }),
3135
+ !le && f && !B && /* @__PURE__ */ s(
2550
3136
  "div",
2551
3137
  {
2552
3138
  role: "button",
2553
3139
  tabIndex: 0,
2554
3140
  onClick: () => {
2555
- var C;
2556
- return (C = Y.current) == null ? void 0 : C.click();
3141
+ var I;
3142
+ return (I = H.current) == null ? void 0 : I.click();
2557
3143
  },
2558
- onKeyDown: (C) => {
2559
- var J;
2560
- (C.key === "Enter" || C.key === " ") && (C.preventDefault(), (J = Y.current) == null || J.click());
3144
+ onKeyDown: (I) => {
3145
+ var re;
3146
+ (I.key === "Enter" || I.key === " ") && (I.preventDefault(), (re = H.current) == null || re.click());
2561
3147
  },
2562
- onDragEnter: oe,
2563
- onDragLeave: oe,
2564
- onDragOver: oe,
2565
- onDrop: te,
3148
+ onDragEnter: ne,
3149
+ onDragLeave: ne,
3150
+ onDragOver: ne,
3151
+ onDrop: ae,
2566
3152
  style: { cursor: "pointer" },
2567
3153
  className: [
2568
3154
  "border-2 border-dashed rounded-lg p-6 text-center",
2569
3155
  "transition-all duration-200 ease-in-out",
2570
- I ? "border-blue-500 bg-blue-50" : O ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
3156
+ x ? "border-blue-500 bg-blue-50" : F ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
2571
3157
  ].join(" "),
2572
- children: /* @__PURE__ */ l($, { direction: "column", align: "center", gap: "2", children: U === "parsing" ? /* @__PURE__ */ g(xe, { children: [
2573
- /* @__PURE__ */ l(Be, { size: "3" }),
2574
- /* @__PURE__ */ l(p, { size: "2", color: "gray", children: "Parsing document…" })
2575
- ] }) : O ? /* @__PURE__ */ g(xe, { children: [
2576
- /* @__PURE__ */ l(pt, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
2577
- /* @__PURE__ */ l(p, { size: "2", color: "red", weight: "medium", children: O }),
2578
- /* @__PURE__ */ l(p, { size: "1", color: "gray", children: "Click to try again" })
2579
- ] }) : /* @__PURE__ */ g(xe, { children: [
2580
- /* @__PURE__ */ l(je, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
2581
- /* @__PURE__ */ l(p, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
2582
- /* @__PURE__ */ g(p, { size: "1", color: "gray", children: [
2583
- Ce(w),
3158
+ children: /* @__PURE__ */ s(L, { direction: "column", align: "center", gap: "2", children: W === "parsing" ? /* @__PURE__ */ p(Ae, { children: [
3159
+ /* @__PURE__ */ s(Je, { size: "3" }),
3160
+ /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Parsing document…" })
3161
+ ] }) : F ? /* @__PURE__ */ p(Ae, { children: [
3162
+ /* @__PURE__ */ s(ht, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
3163
+ /* @__PURE__ */ s(h, { size: "2", color: "red", weight: "medium", children: F }),
3164
+ /* @__PURE__ */ s(h, { size: "1", color: "gray", children: "Click to try again" })
3165
+ ] }) : /* @__PURE__ */ p(Ae, { children: [
3166
+ /* @__PURE__ */ s(Ge, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
3167
+ /* @__PURE__ */ s(h, { size: "2", weight: "medium", children: "Click to upload or drag and drop" }),
3168
+ /* @__PURE__ */ p(h, { size: "1", color: "gray", children: [
3169
+ Ie(v),
2584
3170
  " max · ",
2585
- Se(T)
3171
+ De(E)
2586
3172
  ] })
2587
3173
  ] }) })
2588
3174
  }
2589
3175
  ),
2590
- !y && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Re(c, n) })
3176
+ !m && /* @__PURE__ */ s(h, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Oe(c, n) })
2591
3177
  ] });
2592
- }, Zo = be(Jo), Qo = ie(
3178
+ }, ss = Ee(is), ls = ue(
2593
3179
  10,
2594
- ze((e) => {
3180
+ _e((e) => {
2595
3181
  const r = e["x-xml"];
2596
3182
  return e.type === "object" && typeof r == "object" && r !== null;
2597
3183
  })
2598
- ), ei = "root", Ft = "export.xml", ti = {
3184
+ ), as = "root", lr = "export.xml", cs = {
2599
3185
  format: !0,
2600
3186
  indentBy: " ",
2601
3187
  ignoreAttributes: !1,
@@ -2604,189 +3190,189 @@ const Yo = ".xml,text/xml,application/xml", Go = 5 * 1024 * 1024, Jo = ({
2604
3190
  suppressBooleanAttributes: !1,
2605
3191
  processEntities: !0
2606
3192
  };
2607
- function ri(e) {
3193
+ function us(e) {
2608
3194
  if (e === null || typeof e != "object" || Array.isArray(e))
2609
3195
  return 'declaration must be an object, e.g. { "standalone": "no" }, or {} for the defaults.';
2610
3196
  const { version: r, encoding: t, standalone: n, ...i } = e, [o] = Object.keys(i);
2611
3197
  return o ? `declaration has an unknown key "${o}" — only version, encoding and standalone.` : r !== void 0 && r !== "1.0" && r !== "1.1" ? 'declaration.version must be "1.0" or "1.1".' : t !== void 0 && t !== "UTF-8" ? 'declaration.encoding can only be "UTF-8" — the file is always written as UTF-8.' : n !== void 0 && n !== "yes" && n !== "no" ? 'declaration.standalone must be "yes" or "no".' : null;
2612
3198
  }
2613
- function hr(e) {
3199
+ function Xr(e) {
2614
3200
  for (const r of e) {
2615
3201
  if (r === null || typeof r != "object" || Array.isArray(r))
2616
3202
  return "every writeTo entry must be an object.";
2617
- const { to: t, writeTo: n } = r, i = fr(r, "export");
3203
+ const { to: t, writeTo: n } = r, i = Hr(r, "export");
2618
3204
  if (i) return `writeTo "${t}": ${i}`;
2619
3205
  if (n !== void 0) {
2620
3206
  if (!Array.isArray(n)) return `writeTo "${t}": its nested writeTo must be an array.`;
2621
- const o = hr(n);
3207
+ const o = Xr(n);
2622
3208
  if (o) return o;
2623
3209
  }
2624
3210
  }
2625
3211
  return null;
2626
3212
  }
2627
- function ni({ writeTo: e, declaration: r }) {
2628
- return e === void 0 ? "writeTo is required — see docs/xml-export-control.md." : Array.isArray(e) ? e.length === 0 ? "writeTo is declared but empty — declare at least one entry." : hr(e) ?? (r === void 0 ? null : ri(r)) : "writeTo must be an array of { from | formula, to } entries.";
3213
+ function ds({ writeTo: e, declaration: r }) {
3214
+ return e === void 0 ? "writeTo is required — see docs/xml-export-control.md." : Array.isArray(e) ? e.length === 0 ? "writeTo is declared but empty — declare at least one entry." : Xr(e) ?? (r === void 0 ? null : us(r)) : "writeTo must be an array of { from | formula, to } entries.";
2629
3215
  }
2630
- function oi({ version: e = "1.0", standalone: r }) {
3216
+ function fs({ version: e = "1.0", standalone: r }) {
2631
3217
  return { "@_version": e, "@_encoding": "UTF-8", ...r && { "@_standalone": r } };
2632
3218
  }
2633
- function ii(e) {
3219
+ function ps(e) {
2634
3220
  return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
2635
3221
  }
2636
- const si = ({ path: e, label: r, schema: t, visible: n = !0 }) => {
2637
- var N, A;
2638
- const i = (t == null ? void 0 : t["x-xml-export"]) ?? {}, o = i.rootElement ?? ei, s = i.fileName ?? Ft, a = i.writeTo, c = i.writeBase ?? "root", u = i.declaration, d = ni(i), y = $e(), m = c === "parent" ? e.split(".").slice(0, -1).join(".") : "", f = m ? He.data((N = y.core) == null ? void 0 : N.data, m) : (A = y.core) == null ? void 0 : A.data, [T, w] = B(null), L = ii(f), D = We(async () => {
3222
+ const hs = ({ path: e, label: r, schema: t, visible: n = !0 }) => {
3223
+ var j, S;
3224
+ const i = (t == null ? void 0 : t["x-xml-export"]) ?? {}, o = i.rootElement ?? as, l = i.fileName ?? lr, a = i.writeTo, c = i.writeBase ?? "root", u = i.declaration, d = ds(i), m = Ne(), f = c === "parent" ? e.split(".").slice(0, -1).join(".") : "", g = f ? Xe.data((j = m.core) == null ? void 0 : j.data, f) : (S = m.core) == null ? void 0 : S.data, [E, v] = Y(null), z = ps(g), R = Be(async () => {
2639
3225
  if (a) {
2640
- w(null);
3226
+ v(null);
2641
3227
  try {
2642
- const R = pr(await yt(f, a, "export")), { XMLBuilder: v } = await import("fast-xml-parser"), b = {
2643
- ...u && { "?xml": oi(u) },
2644
- [o]: R
2645
- }, U = new v(ti).build(b);
2646
- zn(U, mt(s, f, Ft), "application/xml");
2647
- } catch (R) {
2648
- w(R instanceof Error ? R.message : "This export could not be built.");
3228
+ const C = Br(await Nt(g, a, "export")), { XMLBuilder: A } = await import("fast-xml-parser"), T = {
3229
+ ...u && { "?xml": fs(u) },
3230
+ [o]: C
3231
+ }, W = new A(cs).build(T);
3232
+ Ho(W, It(l, g, lr), "application/xml");
3233
+ } catch (C) {
3234
+ v(C instanceof Error ? C.message : "This export could not be built.");
2649
3235
  }
2650
3236
  }
2651
- }, [a, f, u, o, s]);
2652
- return n === !1 ? null : d ? /* @__PURE__ */ g(M, { mb: "4", children: [
2653
- /* @__PURE__ */ l(p, { as: "label", size: "2", weight: "bold", children: r }),
2654
- /* @__PURE__ */ g(p, { size: "2", color: "red", style: { display: "block" }, children: [
3237
+ }, [a, g, u, o, l]);
3238
+ return n === !1 ? null : d ? /* @__PURE__ */ p(N, { mb: "4", children: [
3239
+ /* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: r }),
3240
+ /* @__PURE__ */ p(h, { size: "2", color: "red", style: { display: "block" }, children: [
2655
3241
  "Invalid x-xml-export config: ",
2656
3242
  d
2657
3243
  ] })
2658
- ] }) : /* @__PURE__ */ g(M, { mb: "4", children: [
2659
- /* @__PURE__ */ l(p, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: r }),
2660
- /* @__PURE__ */ g(Ue, { size: "1", variant: "soft", disabled: L, onClick: () => void D(), children: [
2661
- /* @__PURE__ */ l(dt, {}),
3244
+ ] }) : /* @__PURE__ */ p(N, { mb: "4", children: [
3245
+ /* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", style: { display: "block", marginBottom: "var(--space-2)" }, children: r }),
3246
+ /* @__PURE__ */ p(Re, { size: "1", variant: "soft", disabled: z, onClick: () => void R(), children: [
3247
+ /* @__PURE__ */ s(Rt, {}),
2662
3248
  "Download XML"
2663
3249
  ] }),
2664
- T && /* @__PURE__ */ l(p, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: T })
3250
+ E && /* @__PURE__ */ s(h, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: E })
2665
3251
  ] });
2666
- }, li = be(si), ci = ie(
3252
+ }, ms = Ee(hs), gs = ue(
2667
3253
  10,
2668
- ze((e) => {
3254
+ _e((e) => {
2669
3255
  const r = e["x-xml-export"];
2670
3256
  return e.type === "object" && typeof r == "object" && r !== null;
2671
3257
  })
2672
- ), ai = "{value}", ui = 2, di = {}, fi = ({ data: e, handleChange: r, path: t, label: n, schema: i, visible: o = !0 }) => {
2673
- var b;
2674
- Oe(o, t, r);
2675
- const s = i == null ? void 0 : i["x-computed"], a = (s == null ? void 0 : s.inputs) ?? di, c = (s == null ? void 0 : s.formula) ?? "", u = (s == null ? void 0 : s.format) ?? ai, d = (s == null ? void 0 : s.decimals) ?? ui, y = $e(), m = t.split(".").slice(0, -1).join("."), f = _o((b = y.core) == null ? void 0 : b.data, m, a), T = f ? JSON.stringify(f) : null, w = y.readonly === !0, [L, D] = B(() => typeof e == "number" ? "ok" : "unavailable"), [N, A] = B(() => typeof e == "number" ? e : null), [R, v] = B(null);
2676
- return we(() => {
3258
+ ), ys = "{value}", bs = 2, vs = {}, ws = ({ data: e, handleChange: r, path: t, label: n, schema: i, visible: o = !0 }) => {
3259
+ var T;
3260
+ Le(o, t, r);
3261
+ const l = i == null ? void 0 : i["x-computed"], a = (l == null ? void 0 : l.inputs) ?? vs, c = (l == null ? void 0 : l.formula) ?? "", u = (l == null ? void 0 : l.format) ?? ys, d = (l == null ? void 0 : l.decimals) ?? bs, m = Ne(), f = t.split(".").slice(0, -1).join("."), g = Ki((T = m.core) == null ? void 0 : T.data, f, a), E = g ? JSON.stringify(g) : null, v = m.readonly === !0, [z, R] = Y(() => typeof e == "number" ? "ok" : "unavailable"), [j, S] = Y(() => typeof e == "number" ? e : null), [C, A] = Y(null);
3262
+ return ye(() => {
2677
3263
  if (!o) return;
2678
- let U = !1;
2679
- const P = (O) => {
2680
- w || O !== e && r(t, O);
3264
+ let W = !1;
3265
+ const U = (F) => {
3266
+ v || F !== e && r(t, F);
2681
3267
  };
2682
- if (f === void 0) {
2683
- D("unavailable"), v(null), A(null), P(void 0);
3268
+ if (g === void 0) {
3269
+ R("unavailable"), A(null), S(null), U(void 0);
2684
3270
  return;
2685
3271
  }
2686
- return D((O) => O === "ok" ? O : "loading"), jo(f, c).then((O) => {
2687
- if (U) return;
2688
- const j = O.status === "ok" && typeof O.value == "number" && Number.isFinite(O.value) ? O.value : null;
2689
- if (j === null) {
2690
- D("error"), v(
2691
- O.status === "error" ? O.error ?? "Unable to compute value." : "Computed value must be a number."
2692
- ), A(null), P(void 0);
3272
+ return R((F) => F === "ok" ? F : "loading"), Yi(g, c).then((F) => {
3273
+ if (W) return;
3274
+ const M = F.status === "ok" && typeof F.value == "number" && Number.isFinite(F.value) ? F.value : null;
3275
+ if (M === null) {
3276
+ R("error"), A(
3277
+ F.status === "error" ? F.error ?? "Unable to compute value." : "Computed value must be a number."
3278
+ ), S(null), U(void 0);
2693
3279
  return;
2694
3280
  }
2695
- D("ok"), v(null), A(j), P(j);
3281
+ R("ok"), A(null), S(M), U(M);
2696
3282
  }), () => {
2697
- U = !0;
3283
+ W = !0;
2698
3284
  };
2699
- }, [T, c, o, w]), o === !1 ? null : /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ g($, { direction: "column", gap: "1", children: [
2700
- /* @__PURE__ */ l(p, { as: "label", size: "2", weight: "bold", children: n }),
2701
- L === "unavailable" ? /* @__PURE__ */ l(p, { size: "2", color: "gray", children: "Not yet available." }) : L === "loading" ? /* @__PURE__ */ g($, { align: "center", gap: "2", children: [
2702
- /* @__PURE__ */ l(Be, { size: "1" }),
2703
- /* @__PURE__ */ l(p, { size: "2", color: "gray", children: "Computing…" })
2704
- ] }) : L === "error" ? /* @__PURE__ */ l(p, { size: "2", color: "red", children: R }) : /* @__PURE__ */ l(p, { size: "2", children: it(u, { value: ar(N, d) }) }),
2705
- i.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: i.description })
3285
+ }, [E, c, o, v]), o === !1 ? null : /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ p(L, { direction: "column", gap: "1", children: [
3286
+ /* @__PURE__ */ s(h, { as: "label", size: "2", weight: "bold", children: n }),
3287
+ z === "unavailable" ? /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Not yet available." }) : z === "loading" ? /* @__PURE__ */ p(L, { align: "center", gap: "2", children: [
3288
+ /* @__PURE__ */ s(Je, { size: "1" }),
3289
+ /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "Computing…" })
3290
+ ] }) : z === "error" ? /* @__PURE__ */ s(h, { size: "2", color: "red", children: C }) : /* @__PURE__ */ s(h, { size: "2", children: mt(u, { value: _r(j, d) }) }),
3291
+ i.description && /* @__PURE__ */ s(h, { size: "1", color: "gray", children: i.description })
2706
3292
  ] }) });
2707
- }, pi = be(fi), hi = ie(
3293
+ }, Es = Ee(ws), xs = ue(
2708
3294
  5,
2709
- ze((e) => {
3295
+ _e((e) => {
2710
3296
  const r = e["x-computed"];
2711
3297
  return e.type === "number" && typeof r == "object" && r !== null;
2712
3298
  })
2713
- ), mr = "seq", $t = 2, mi = (e) => e == null || e === "", gr = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0, gi = (e) => {
3299
+ ), qr = "seq", ar = 2, Ts = (e) => e == null || e === "", Kr = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? e : void 0, As = (e) => {
2714
3300
  const r = e == null ? void 0 : e["x-template"];
2715
3301
  if (typeof r != "object" || r === null) return;
2716
3302
  const { template: t, inputs: n } = r;
2717
3303
  if (!(typeof t != "string" || t === ""))
2718
3304
  return { template: t, inputs: n };
2719
- }, bt = (e) => typeof e == "object" && e.name === mr && e.arg !== void 0, yi = (e) => e.every((r, t) => !bt(r) || typeof e[t - 1] != "object" && typeof e[t + 1] != "object"), bi = (e) => {
3305
+ }, Lt = (e) => typeof e == "object" && e.name === qr && e.arg !== void 0, Ss = (e) => e.every((r, t) => !Lt(r) || typeof e[t - 1] != "object" && typeof e[t + 1] != "object"), Rs = (e) => {
2720
3306
  const r = /* @__PURE__ */ new Set();
2721
- for (const t of ht(e))
3307
+ for (const t of kt(e))
2722
3308
  typeof t == "object" && t.arg === void 0 && r.add(t.name);
2723
3309
  return [...r];
2724
- }, vi = (e) => {
3310
+ }, Cs = (e) => {
2725
3311
  const r = [];
2726
3312
  for (const [t, n] of Object.entries((e == null ? void 0 : e.properties) ?? {})) {
2727
- const i = gi(n);
3313
+ const i = As(n);
2728
3314
  i && r.push([t, i]);
2729
3315
  }
2730
3316
  return r;
2731
- }, wi = (e, r, t) => {
3317
+ }, Os = (e, r, t) => {
2732
3318
  var i;
2733
3319
  const n = {};
2734
- for (const o of bi(t.template)) {
2735
- const s = cr(e, r, ((i = t.inputs) == null ? void 0 : i[o]) ?? o);
2736
- n[o] = typeof s == "string" || typeof s == "number" || typeof s == "boolean" ? String(s) : "";
3320
+ for (const o of Rs(t.template)) {
3321
+ const l = jr(e, r, ((i = t.inputs) == null ? void 0 : i[o]) ?? o);
3322
+ n[o] = typeof l == "string" || typeof l == "number" || typeof l == "boolean" ? String(l) : "";
2737
3323
  }
2738
3324
  return n;
2739
- }, Ei = (e) => (r) => {
2740
- const t = r.trim() === "" ? $t : Number(r);
2741
- return `${e}`.padStart(Number.isInteger(t) && t >= 0 ? t : $t, "0");
2742
- }, Ti = (e) => {
3325
+ }, ks = (e) => (r) => {
3326
+ const t = r.trim() === "" ? ar : Number(r);
3327
+ return `${e}`.padStart(Number.isInteger(t) && t >= 0 ? t : ar, "0");
3328
+ }, Is = (e) => {
2743
3329
  const r = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2744
3330
  let t = "";
2745
- for (const n of ht(e))
2746
- typeof n == "string" ? t += r(n) : t += bt(n) ? "(\\d+)" : ".*?";
3331
+ for (const n of kt(e))
3332
+ typeof n == "string" ? t += r(n) : t += Lt(n) ? "(\\d+)" : ".*?";
2747
3333
  return new RegExp(`^${t}$`);
2748
- }, xi = (e, r, t) => {
2749
- var o, s;
2750
- const n = Ti(t.template);
3334
+ }, Ds = (e, r, t) => {
3335
+ var o, l;
3336
+ const n = Is(t.template);
2751
3337
  let i = 0;
2752
3338
  for (const a of e) {
2753
- const c = (o = gr(a)) == null ? void 0 : o[r];
3339
+ const c = (o = Kr(a)) == null ? void 0 : o[r];
2754
3340
  if (typeof c != "string") continue;
2755
- const u = Number((s = n.exec(c)) == null ? void 0 : s[1]);
3341
+ const u = Number((l = n.exec(c)) == null ? void 0 : l[1]);
2756
3342
  Number.isFinite(u) && u > i && (i = u);
2757
3343
  }
2758
3344
  return i;
2759
- }, Ai = (e, r, t, n, i, o) => {
2760
- const s = vi(e);
2761
- if (s.length === 0) return r;
2762
- const a = gr(r);
3345
+ }, Ns = (e, r, t, n, i, o) => {
3346
+ const l = Cs(e);
3347
+ if (l.length === 0) return r;
3348
+ const a = Kr(r);
2763
3349
  if (!a) return r;
2764
3350
  const c = { ...a };
2765
- for (const [u, d] of s) {
2766
- if (!mi(c[u])) continue;
2767
- const y = ht(d.template), m = {};
2768
- if (y.some(bt)) {
2769
- if (!yi(y)) {
3351
+ for (const [u, d] of l) {
3352
+ if (!Ts(c[u])) continue;
3353
+ const m = kt(d.template), f = {};
3354
+ if (m.some(Lt)) {
3355
+ if (!Ss(m)) {
2770
3356
  console.warn(
2771
3357
  `x-template: {seq(…)} needs literal text between it and other placeholders; not numbering "${d.template}"`
2772
3358
  );
2773
3359
  continue;
2774
3360
  }
2775
- const f = Math.max(o[u] ?? 0, xi(t, u, d)) + 1;
2776
- o[u] = f, m[mr] = Ei(f);
3361
+ const g = Math.max(o[u] ?? 0, Ds(t, u, d)) + 1;
3362
+ o[u] = g, f[qr] = ks(g);
2777
3363
  }
2778
- c[u] = it(d.template, wi(n, i, d), m);
3364
+ c[u] = mt(d.template, Os(n, i, d), f);
2779
3365
  }
2780
3366
  return c;
2781
- }, Ri = ({ path: e, items: r, itemsSchema: t, rootSchema: n, addItem: i, sequences: o }) => {
2782
- const s = $e();
2783
- return /* @__PURE__ */ l(M, { mt: "2", children: /* @__PURE__ */ g(Ue, { type: "button", variant: "surface", onClick: () => {
3367
+ }, Ls = ({ path: e, items: r, itemsSchema: t, rootSchema: n, addItem: i, sequences: o }) => {
3368
+ const l = Ne();
3369
+ return /* @__PURE__ */ s(N, { mt: "2", children: /* @__PURE__ */ p(Re, { type: "button", variant: "surface", onClick: () => {
2784
3370
  var u;
2785
- const c = Ai(
3371
+ const c = Ns(
2786
3372
  t,
2787
- Nr(t, n),
3373
+ bn(t, n),
2788
3374
  r,
2789
- (u = s.core) == null ? void 0 : u.data,
3375
+ (u = l.core) == null ? void 0 : u.data,
2790
3376
  // The object CONTAINING the array, not the row: a row being filled is
2791
3377
  // empty, so what a template reaches for sits alongside the array.
2792
3378
  e.split(".").slice(0, -1).join("."),
@@ -2794,176 +3380,180 @@ const si = ({ path: e, label: r, schema: t, visible: n = !0 }) => {
2794
3380
  );
2795
3381
  i && i(e, c)();
2796
3382
  }, children: [
2797
- /* @__PURE__ */ l($r, {}),
3383
+ /* @__PURE__ */ s(In, {}),
2798
3384
  "Add Item"
2799
3385
  ] }) });
2800
- }, Ci = ({
3386
+ }, zs = ({
2801
3387
  data: e,
2802
3388
  path: r,
2803
3389
  schema: t,
2804
3390
  uischema: n,
2805
3391
  enabled: i,
2806
3392
  visible: o,
2807
- addItem: s,
3393
+ addItem: l,
2808
3394
  removeItems: a,
2809
3395
  rootSchema: c,
2810
3396
  arraySchema: u,
2811
3397
  required: d = !1,
2812
- errors: y = ""
3398
+ errors: m = ""
2813
3399
  }) => {
2814
- const m = ge({}), f = Ae(r, d, o), T = u ? t : t.items, w = u || t;
2815
- if (o === !1 || !T || typeof T != "object" || Array.isArray(T))
3400
+ const f = he({}), g = Ce(r, d, o), E = u ? t : t.items, v = u || t;
3401
+ if (o === !1 || !E || typeof E != "object" || Array.isArray(E))
2816
3402
  return null;
2817
- const L = T, D = Array.isArray(e) ? e : [], N = w.title || "Array Items", A = n.options ?? {}, R = i && A.addable !== !1, v = i && A.removable !== !1, b = A.itemLabel || "Item", U = f || typeof w.minItems == "number" && w.minItems >= 1, P = !y, O = P ? "" : D.length === 0 && A.errorMessage || Re(y, N), j = (I) => {
3403
+ const z = E, R = Array.isArray(e) ? e : [], j = v.title || "Array Items", S = n.options ?? {}, C = i && S.addable !== !1, A = i && S.removable !== !1, T = S.itemLabel || "Item", W = g || typeof v.minItems == "number" && v.minItems >= 1, U = !m, F = U ? "" : R.length === 0 && S.errorMessage || Oe(m, j), M = (x) => {
2818
3404
  if (a) {
2819
- const ne = a(r, [I]);
2820
- ne && ne();
3405
+ const te = a(r, [x]);
3406
+ te && te();
2821
3407
  }
2822
3408
  };
2823
- return /* @__PURE__ */ l(M, { mb: "6", children: /* @__PURE__ */ g($, { direction: "column", gap: "4", children: [
2824
- /* @__PURE__ */ g(p, { as: "div", size: "4", weight: "bold", children: [
2825
- N,
3409
+ return /* @__PURE__ */ s(N, { mb: "6", children: /* @__PURE__ */ p(L, { direction: "column", gap: "4", children: [
3410
+ /* @__PURE__ */ p(h, { as: "div", size: "4", weight: "bold", children: [
3411
+ j,
2826
3412
  " ",
2827
- U && /* @__PURE__ */ l(p, { color: "red", children: "*" })
3413
+ W && /* @__PURE__ */ s(h, { color: "red", children: "*" })
2828
3414
  ] }),
2829
- D.length === 0 && /* @__PURE__ */ l(M, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ l(p, { size: "2", color: "gray", children: "No items have been added yet." }) }),
2830
- !P && /* @__PURE__ */ l(p, { color: "red", size: "1", children: O }),
2831
- D.map((I, ne) => {
2832
- var z;
2833
- const Y = `${r}.${ne}`;
2834
- return /* @__PURE__ */ l(Xt, { size: "3", variant: "surface", children: /* @__PURE__ */ g($, { direction: "column", gap: "4", children: [
2835
- /* @__PURE__ */ g($, { justify: "between", align: "center", children: [
2836
- /* @__PURE__ */ g(p, { size: "3", weight: "bold", children: [
2837
- b,
3415
+ R.length === 0 && /* @__PURE__ */ s(N, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ s(h, { size: "2", color: "gray", children: "No items have been added yet." }) }),
3416
+ !U && /* @__PURE__ */ s(h, { color: "red", size: "1", children: F }),
3417
+ R.map((x, te) => {
3418
+ var J;
3419
+ const H = `${r}.${te}`;
3420
+ return /* @__PURE__ */ s(yr, { size: "3", variant: "surface", children: /* @__PURE__ */ p(L, { direction: "column", gap: "4", children: [
3421
+ /* @__PURE__ */ p(L, { justify: "between", align: "center", children: [
3422
+ /* @__PURE__ */ p(h, { size: "3", weight: "bold", children: [
3423
+ T,
2838
3424
  " ",
2839
- ne + 1
3425
+ te + 1
2840
3426
  ] }),
2841
- v && /* @__PURE__ */ g(
2842
- Ue,
3427
+ A && /* @__PURE__ */ p(
3428
+ Re,
2843
3429
  {
2844
3430
  type: "button",
2845
3431
  color: "red",
2846
3432
  variant: "soft",
2847
- onClick: () => j(ne),
3433
+ onClick: () => M(te),
2848
3434
  title: "Remove item",
2849
3435
  children: [
2850
- /* @__PURE__ */ l(Fr, {}),
3436
+ /* @__PURE__ */ s(kn, {}),
2851
3437
  "Remove"
2852
3438
  ]
2853
3439
  }
2854
3440
  )
2855
3441
  ] }),
2856
- /* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(
2857
- Ge,
3442
+ /* @__PURE__ */ s(N, { children: /* @__PURE__ */ s(
3443
+ Qe,
2858
3444
  {
2859
- schema: L,
2860
- uischema: ((z = n.options) == null ? void 0 : z.detail) || (L.type === "object" || L.properties ? {
3445
+ schema: z,
3446
+ uischema: ((J = n.options) == null ? void 0 : J.detail) || (z.type === "object" || z.properties ? {
2861
3447
  type: "VerticalLayout",
2862
- elements: Object.keys(L.properties || {}).map((_) => ({
3448
+ elements: Object.keys(z.properties || {}).map((B) => ({
2863
3449
  type: "Control",
2864
- scope: `#/properties/${_}`
3450
+ scope: `#/properties/${B}`
2865
3451
  }))
2866
3452
  } : {
2867
3453
  type: "Control",
2868
3454
  scope: "#"
2869
3455
  }),
2870
- path: Y,
3456
+ path: H,
2871
3457
  enabled: i,
2872
3458
  renderers: void 0,
2873
3459
  cells: void 0
2874
3460
  }
2875
3461
  ) })
2876
- ] }) }, Y);
3462
+ ] }) }, H);
2877
3463
  }),
2878
- R && /* @__PURE__ */ l(
2879
- Ri,
3464
+ C && /* @__PURE__ */ s(
3465
+ Ls,
2880
3466
  {
2881
3467
  path: r,
2882
- items: D,
2883
- itemsSchema: L,
3468
+ items: R,
3469
+ itemsSchema: z,
2884
3470
  rootSchema: c,
2885
- addItem: s,
2886
- sequences: m
3471
+ addItem: l,
3472
+ sequences: f
2887
3473
  }
2888
3474
  )
2889
3475
  ] }) });
2890
- }, Ut = kr(Ci), Si = ie(3, Dr), Oi = ({ uischema: e, visible: r }) => {
3476
+ }, cr = En(zs), Ms = ue(3, vn), Fs = ({ uischema: e, visible: r }) => {
2891
3477
  const t = e;
2892
- return r === !1 ? null : /* @__PURE__ */ l(M, { mb: "4", children: /* @__PURE__ */ l(Bt, { size: "4", children: t.text }) });
2893
- }, Ni = ie(1, Ye("Label")), Di = ie(3, Ir), ji = [
2894
- { tester: Kr, renderer: Yr },
2895
- { tester: Zr, renderer: Qr },
2896
- { tester: tn, renderer: rn },
2897
- { tester: on, renderer: sn },
2898
- { tester: bn, renderer: yn },
2899
- { tester: cn, renderer: Tt },
2900
- { tester: an, renderer: Tt },
2901
- { tester: xn, renderer: An },
3478
+ return r === !1 ? null : /* @__PURE__ */ s(N, { mb: "4", children: /* @__PURE__ */ s(tt, { size: "4", children: t.text }) });
3479
+ }, $s = ue(1, ot("Label")), Ps = ue(3, wn), Gs = [
3480
+ { tester: Gn, renderer: Jn },
3481
+ { tester: eo, renderer: to },
3482
+ { tester: no, renderer: oo },
3483
+ { tester: so, renderer: lo },
3484
+ { tester: ho, renderer: wo },
3485
+ { tester: co, renderer: Bt },
3486
+ { tester: uo, renderer: Bt },
3487
+ { tester: So, renderer: Ro },
2902
3488
  // The layout renderers take their props from withJsonFormsLayoutProps, which
2903
3489
  // evaluates the layout's rule into `visible` and `enabled`, as
2904
3490
  // withJsonFormsControlProps does for the controls.
2905
- { tester: Cn, renderer: Ze(Rn) },
2906
- { tester: On, renderer: Ze(Sn) },
2907
- { tester: Dn, renderer: Ze(Nn) },
2908
- { tester: kn, renderer: Ze(In) },
2909
- { tester: Hn, renderer: Wn },
2910
- { tester: Co, renderer: Ro },
2911
- { tester: Lo, renderer: ko },
3491
+ { tester: zo, renderer: st(Lo) },
3492
+ { tester: Fo, renderer: st(Mo) },
3493
+ { tester: Po, renderer: st($o) },
3494
+ { tester: _o, renderer: st(Uo) },
3495
+ { tester: Qo, renderer: Zo },
3496
+ { tester: zi, renderer: Li },
3497
+ { tester: _i, renderer: ji },
2912
3498
  // After SpreadsheetControl on purpose: both testers rank 10, and a tie is
2913
3499
  // resolved by registration order (see XmlControlTester's comment).
2914
- { tester: Qo, renderer: Zo },
3500
+ { tester: ls, renderer: ss },
2915
3501
  // Also rank 10, but matches the distinct `x-xml-export` keyword rather
2916
3502
  // than `x-xml`, so it never ties with XmlControlTester on the same schema
2917
3503
  // node (see XmlExportControlTester's own comment).
2918
- { tester: ci, renderer: li },
2919
- { tester: hi, renderer: pi },
2920
- { tester: Si, renderer: Ut },
2921
- { tester: Di, renderer: Ut },
2922
- { tester: Ni, renderer: Oi }
3504
+ { tester: gs, renderer: ms },
3505
+ { tester: xs, renderer: Es },
3506
+ { tester: Ms, renderer: cr },
3507
+ { tester: Ps, renderer: cr },
3508
+ { tester: $s, renderer: Fs }
2923
3509
  ];
2924
3510
  export {
2925
- Ut as ArrayControl,
2926
- Si as ArrayControlTester,
2927
- en as BooleanControl,
2928
- tn as BooleanControlTester,
2929
- In as CategorizationLayoutRenderer,
2930
- kn as CategorizationLayoutTester,
2931
- pi as ComputedControl,
2932
- hi as ComputedControlTester,
2933
- Tn as DateControl,
2934
- xn as DateControlTester,
2935
- Wn as FileControl,
2936
- Hn as FileControlTester,
2937
- Nn as GroupLayoutRenderer,
2938
- Dn as GroupLayoutTester,
2939
- Sn as HorizontalLayoutRenderer,
2940
- On as HorizontalLayoutTester,
2941
- Oi as LabelRenderer,
2942
- Ni as LabelTester,
2943
- Jr as NumberControl,
2944
- Zr as NumberControlTester,
2945
- nn as RadioControl,
2946
- on as RadioControlTester,
2947
- yn as SearchSelectControl,
2948
- bn as SearchSelectControlTester,
2949
- _i as SearchServiceProvider,
2950
- ln as SelectControl,
2951
- cn as SelectControlTester,
2952
- an as SelectObjectControlTester,
2953
- Ro as SpreadsheetControl,
2954
- Co as SpreadsheetControlTester,
2955
- ko as SpreadsheetExportControl,
2956
- Lo as SpreadsheetExportControlTester,
2957
- qr as TextControl,
2958
- Kr as TextControlTester,
2959
- Pi as UploadProvider,
2960
- Rn as VerticalLayoutRenderer,
2961
- Cn as VerticalLayoutTester,
2962
- Zo as XmlControl,
2963
- Qo as XmlControlTester,
2964
- li as XmlExportControl,
2965
- ci as XmlExportControlTester,
2966
- ji as radixRenderers,
2967
- Pr as useSearchService,
2968
- Ur as useUpload
3511
+ cr as ArrayControl,
3512
+ Ms as ArrayControlTester,
3513
+ ro as BooleanControl,
3514
+ no as BooleanControlTester,
3515
+ Uo as CategorizationLayoutRenderer,
3516
+ _o as CategorizationLayoutTester,
3517
+ Es as ComputedControl,
3518
+ xs as ComputedControlTester,
3519
+ Ao as DateControl,
3520
+ So as DateControlTester,
3521
+ Zo as FileControl,
3522
+ Qo as FileControlTester,
3523
+ Ys as FormStepsProvider,
3524
+ $o as GroupLayoutRenderer,
3525
+ Po as GroupLayoutTester,
3526
+ Mo as HorizontalLayoutRenderer,
3527
+ Fo as HorizontalLayoutTester,
3528
+ Fs as LabelRenderer,
3529
+ $s as LabelTester,
3530
+ Qn as NumberControl,
3531
+ eo as NumberControlTester,
3532
+ io as RadioControl,
3533
+ so as RadioControlTester,
3534
+ jn as STEPPER_MESSAGES,
3535
+ wo as SearchSelectControl,
3536
+ ho as SearchSelectControlTester,
3537
+ Ks as SearchServiceProvider,
3538
+ ao as SelectControl,
3539
+ co as SelectControlTester,
3540
+ uo as SelectObjectControlTester,
3541
+ Li as SpreadsheetControl,
3542
+ zi as SpreadsheetControlTester,
3543
+ ji as SpreadsheetExportControl,
3544
+ _i as SpreadsheetExportControlTester,
3545
+ Yn as TextControl,
3546
+ Gn as TextControlTester,
3547
+ qs as UploadProvider,
3548
+ Lo as VerticalLayoutRenderer,
3549
+ zo as VerticalLayoutTester,
3550
+ ss as XmlControl,
3551
+ ls as XmlControlTester,
3552
+ ms as XmlExportControl,
3553
+ gs as XmlExportControlTester,
3554
+ Ln as isStepperUiSchema,
3555
+ Gs as radixRenderers,
3556
+ Rr as searchSelectTargetSchema,
3557
+ Nn as useSearchService,
3558
+ Dn as useUpload
2969
3559
  };