@opennsw/jsonforms-renderers 0.12.0 → 0.13.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.
- package/dist/index.d.ts +2 -0
- package/dist/renderers.cjs.js +3 -3
- package/dist/renderers.es.js +1586 -1433
- package/package.json +1 -1
package/dist/renderers.es.js
CHANGED
|
@@ -1,194 +1,313 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { useContext as
|
|
6
|
-
import { rankWith as
|
|
7
|
-
import {
|
|
8
|
-
import { Box as
|
|
9
|
-
import { ChevronDownIcon as
|
|
10
|
-
import
|
|
11
|
-
const
|
|
12
|
-
function
|
|
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({
|
|
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__ */
|
|
18
|
+
return /* @__PURE__ */ l(Yt.Provider, { value: n, children: e });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function Ur() {
|
|
21
|
+
return Pt(Yt);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const Gt = _t(null);
|
|
24
|
+
function _i({
|
|
25
25
|
children: e,
|
|
26
26
|
services: r
|
|
27
27
|
}) {
|
|
28
|
-
const t =
|
|
29
|
-
return /* @__PURE__ */
|
|
28
|
+
const t = Ve(() => r, [r]);
|
|
29
|
+
return /* @__PURE__ */ l(Gt.Provider, { value: t, children: e });
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const r =
|
|
31
|
+
function Pr(e) {
|
|
32
|
+
const r = Pt(Gt);
|
|
33
33
|
return !r || !e ? null : r[e] ?? null;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const Oe = (e, r, t, n = void 0) => {
|
|
36
|
+
we(() => {
|
|
37
37
|
e === !1 && t(r, n);
|
|
38
38
|
}, [e, r, t, n]);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
}, Et = /* @__PURE__ */ new WeakMap();
|
|
40
|
+
function _r(e) {
|
|
41
|
+
if (!e || typeof e != "object") return !1;
|
|
42
|
+
const r = Et.get(e);
|
|
43
|
+
if (r !== void 0) return r;
|
|
44
|
+
const t = _e(e, e, /* @__PURE__ */ new Set());
|
|
45
|
+
return Et.set(e, t), t;
|
|
46
|
+
}
|
|
47
|
+
function jr(e, r) {
|
|
48
|
+
if (!r.startsWith("#/")) return;
|
|
49
|
+
const t = r.slice(2).split("/");
|
|
50
|
+
let n = e;
|
|
51
|
+
for (const i of t) {
|
|
52
|
+
if (!n || typeof n != "object") return;
|
|
53
|
+
n = n[i];
|
|
54
|
+
}
|
|
55
|
+
return n && typeof n == "object" ? n : void 0;
|
|
56
|
+
}
|
|
57
|
+
function _e(e, r, t) {
|
|
58
|
+
if (!e || typeof e != "object" || t.has(e)) return !1;
|
|
59
|
+
t.add(e);
|
|
60
|
+
const n = e;
|
|
61
|
+
if (n.if != null || n.dependentRequired != null || n.dependencies != null) return !0;
|
|
62
|
+
for (const i of ["allOf", "anyOf", "oneOf"]) {
|
|
63
|
+
const o = n[i];
|
|
64
|
+
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;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (typeof n.$ref == "string") {
|
|
72
|
+
const i = jr(r, n.$ref);
|
|
73
|
+
if (i && _e(i, r, t)) return !0;
|
|
74
|
+
}
|
|
75
|
+
for (const i of ["then", "else", "not", "contains", "additionalProperties", "items"]) {
|
|
76
|
+
const o = n[i];
|
|
77
|
+
if (o && typeof o == "object" && !Array.isArray(o) && _e(o, r, t))
|
|
78
|
+
return !0;
|
|
79
|
+
}
|
|
80
|
+
if (Array.isArray(n.items)) {
|
|
81
|
+
for (const i of n.items)
|
|
82
|
+
if (_e(i, r, t)) return !0;
|
|
83
|
+
}
|
|
84
|
+
for (const i of ["properties", "patternProperties", "$defs", "definitions"]) {
|
|
85
|
+
const o = n[i];
|
|
86
|
+
if (!(!o || typeof o != "object")) {
|
|
87
|
+
for (const s of Object.values(o))
|
|
88
|
+
if (_e(s, r, t)) return !0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return !1;
|
|
92
|
+
}
|
|
93
|
+
function Vr(e, r) {
|
|
94
|
+
const t = structuredClone(e ?? {});
|
|
95
|
+
if (!r) return t;
|
|
96
|
+
const n = r.split(".");
|
|
97
|
+
let i = t;
|
|
98
|
+
for (let s = 0; s < n.length - 1; s++) {
|
|
99
|
+
const a = n[s];
|
|
100
|
+
if (i == null || typeof i != "object") return t;
|
|
101
|
+
const c = i[a];
|
|
102
|
+
if (c == null || typeof c != "object") return t;
|
|
103
|
+
i = c;
|
|
104
|
+
}
|
|
105
|
+
const o = n[n.length - 1];
|
|
106
|
+
return i != null && typeof i == "object" && delete i[o], t;
|
|
107
|
+
}
|
|
108
|
+
function Wr(e) {
|
|
109
|
+
const r = e.lastIndexOf(".");
|
|
110
|
+
return r === -1 ? "" : "/" + e.slice(0, r).split(".").join("/");
|
|
111
|
+
}
|
|
112
|
+
function Hr(e) {
|
|
113
|
+
if (!e) return "";
|
|
114
|
+
const r = e.lastIndexOf(".");
|
|
115
|
+
return r === -1 ? e : e.slice(r + 1);
|
|
116
|
+
}
|
|
117
|
+
function Br(e, r) {
|
|
118
|
+
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);
|
|
120
|
+
}
|
|
121
|
+
function Xr(e, r, t) {
|
|
122
|
+
if (!e || !t) return !1;
|
|
123
|
+
const n = Vr(r, e);
|
|
124
|
+
t(n);
|
|
125
|
+
const i = t.errors;
|
|
126
|
+
return i != null && i.length ? i.some((o) => Br(o, e)) : !1;
|
|
127
|
+
}
|
|
128
|
+
function Ae(e, r = !1, t = !0) {
|
|
129
|
+
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]);
|
|
132
|
+
}
|
|
133
|
+
const Re = (e, r) => {
|
|
134
|
+
if (!e) return "";
|
|
135
|
+
const t = r || "This field";
|
|
136
|
+
return e.split(`
|
|
137
|
+
`).map((n) => {
|
|
138
|
+
const i = n.trim();
|
|
139
|
+
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
|
+
}).join(`
|
|
141
|
+
`);
|
|
142
|
+
}, qr = ({
|
|
42
143
|
data: e,
|
|
43
144
|
handleChange: r,
|
|
44
145
|
path: t,
|
|
45
146
|
label: n,
|
|
46
|
-
required:
|
|
147
|
+
required: i,
|
|
47
148
|
errors: o,
|
|
48
149
|
uischema: s,
|
|
49
|
-
schema:
|
|
50
|
-
enabled:
|
|
51
|
-
visible:
|
|
150
|
+
schema: a,
|
|
151
|
+
enabled: c,
|
|
152
|
+
visible: u = !0
|
|
52
153
|
}) => {
|
|
53
|
-
var
|
|
54
|
-
|
|
154
|
+
var m;
|
|
155
|
+
Oe(u, t, r);
|
|
156
|
+
const d = Ae(t, i, u);
|
|
157
|
+
if (u === !1)
|
|
55
158
|
return null;
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
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: [
|
|
59
162
|
n,
|
|
60
163
|
" ",
|
|
61
|
-
|
|
164
|
+
d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
62
165
|
] }),
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
166
|
+
/* @__PURE__ */ l(
|
|
167
|
+
Ie.Root,
|
|
65
168
|
{
|
|
66
169
|
value: e || "",
|
|
67
|
-
onChange: (
|
|
68
|
-
disabled: !
|
|
69
|
-
placeholder: (
|
|
70
|
-
color:
|
|
170
|
+
onChange: (f) => r(t, f.target.value),
|
|
171
|
+
disabled: !c,
|
|
172
|
+
placeholder: (m = s.options) == null ? void 0 : m.placeholder,
|
|
173
|
+
color: y ? void 0 : "red",
|
|
71
174
|
id: t
|
|
72
175
|
}
|
|
73
176
|
),
|
|
74
|
-
!
|
|
75
|
-
|
|
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 })
|
|
76
179
|
] }) });
|
|
77
|
-
},
|
|
180
|
+
}, Kr = ie(1, vr), Yr = be(qr), Gr = /* @__PURE__ */ new Set(["-", "+", "e", "E"]), Jr = ({
|
|
78
181
|
data: e,
|
|
79
182
|
handleChange: r,
|
|
80
183
|
path: t,
|
|
81
184
|
label: n,
|
|
82
|
-
required:
|
|
185
|
+
required: i,
|
|
83
186
|
errors: o,
|
|
84
187
|
uischema: s,
|
|
85
|
-
schema:
|
|
86
|
-
enabled:
|
|
87
|
-
visible:
|
|
188
|
+
schema: a,
|
|
189
|
+
enabled: c,
|
|
190
|
+
visible: u = !0
|
|
88
191
|
}) => {
|
|
89
|
-
var
|
|
90
|
-
|
|
192
|
+
var R;
|
|
193
|
+
Oe(u, t, r);
|
|
194
|
+
const d = Ae(t, i, u);
|
|
195
|
+
if (u === !1)
|
|
91
196
|
return null;
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
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 === "") {
|
|
94
199
|
r(t, void 0);
|
|
95
200
|
return;
|
|
96
201
|
}
|
|
97
|
-
const b = Number(
|
|
202
|
+
const b = Number(v);
|
|
98
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();
|
|
99
210
|
};
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
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: [
|
|
102
213
|
n,
|
|
103
214
|
" ",
|
|
104
|
-
|
|
215
|
+
d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
105
216
|
] }),
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
|
|
217
|
+
/* @__PURE__ */ l(
|
|
218
|
+
Ie.Root,
|
|
108
219
|
{
|
|
109
220
|
type: "number",
|
|
110
221
|
value: e ?? "",
|
|
111
|
-
onChange: (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
222
|
+
onChange: (v) => D(v.target.value),
|
|
223
|
+
onKeyDown: N,
|
|
224
|
+
onPaste: A,
|
|
225
|
+
min: T,
|
|
226
|
+
step: L,
|
|
227
|
+
disabled: !c,
|
|
228
|
+
placeholder: (R = s.options) == null ? void 0 : R.placeholder,
|
|
229
|
+
color: y ? void 0 : "red",
|
|
115
230
|
id: t
|
|
116
231
|
}
|
|
117
232
|
),
|
|
118
|
-
!
|
|
119
|
-
|
|
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 })
|
|
120
235
|
] }) });
|
|
121
|
-
},
|
|
236
|
+
}, Zr = ie(2, ot(wr, Er)), Qr = be(Jr), en = ({
|
|
122
237
|
data: e,
|
|
123
238
|
handleChange: r,
|
|
124
239
|
path: t,
|
|
125
240
|
label: n,
|
|
126
|
-
required:
|
|
241
|
+
required: i,
|
|
127
242
|
errors: o,
|
|
128
243
|
schema: s,
|
|
129
|
-
enabled:
|
|
130
|
-
visible:
|
|
244
|
+
enabled: a,
|
|
245
|
+
visible: c = !0
|
|
131
246
|
}) => {
|
|
132
|
-
|
|
247
|
+
Oe(c, t, r);
|
|
248
|
+
const u = Ae(t, i, c);
|
|
249
|
+
if (c === !1)
|
|
133
250
|
return null;
|
|
134
|
-
const
|
|
135
|
-
return /* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
|
|
251
|
+
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,
|
|
139
256
|
{
|
|
140
257
|
checked: !!e,
|
|
141
|
-
onCheckedChange: (
|
|
142
|
-
disabled: !
|
|
258
|
+
onCheckedChange: (y) => r(t, y === !0),
|
|
259
|
+
disabled: !a,
|
|
143
260
|
id: t
|
|
144
261
|
}
|
|
145
262
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ g(p, { as: "label", size: "2", htmlFor: t, children: [
|
|
147
264
|
n,
|
|
148
265
|
" ",
|
|
149
|
-
|
|
266
|
+
u && "*"
|
|
150
267
|
] })
|
|
151
268
|
] }),
|
|
152
|
-
!
|
|
153
|
-
s.description && /* @__PURE__ */
|
|
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 })
|
|
154
271
|
] });
|
|
155
|
-
},
|
|
272
|
+
}, tn = ie(2, Tr), rn = be(en), nn = ({
|
|
156
273
|
data: e,
|
|
157
274
|
handleChange: r,
|
|
158
275
|
path: t,
|
|
159
276
|
label: n,
|
|
160
|
-
required:
|
|
277
|
+
required: i,
|
|
161
278
|
errors: o,
|
|
162
279
|
schema: s,
|
|
163
|
-
enabled:
|
|
164
|
-
visible:
|
|
280
|
+
enabled: a,
|
|
281
|
+
visible: c = !0
|
|
165
282
|
}) => {
|
|
166
|
-
|
|
283
|
+
Oe(c, t, r);
|
|
284
|
+
const u = Ae(t, i, c);
|
|
285
|
+
if (c === !1)
|
|
167
286
|
return null;
|
|
168
|
-
const
|
|
169
|
-
let
|
|
170
|
-
s.enum ?
|
|
171
|
-
value:
|
|
172
|
-
label:
|
|
287
|
+
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)
|
|
173
292
|
})));
|
|
174
|
-
const
|
|
175
|
-
return /* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
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: [
|
|
177
296
|
n,
|
|
178
297
|
" ",
|
|
179
|
-
|
|
298
|
+
u && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
180
299
|
] }),
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
|
|
300
|
+
/* @__PURE__ */ l(
|
|
301
|
+
wt.Root,
|
|
183
302
|
{
|
|
184
|
-
value:
|
|
185
|
-
onValueChange: (
|
|
186
|
-
const
|
|
187
|
-
|
|
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);
|
|
188
307
|
},
|
|
189
|
-
disabled: !
|
|
190
|
-
children: /* @__PURE__ */
|
|
191
|
-
|
|
308
|
+
disabled: !a,
|
|
309
|
+
children: /* @__PURE__ */ l(
|
|
310
|
+
$,
|
|
192
311
|
{
|
|
193
312
|
direction: "row",
|
|
194
313
|
style: {
|
|
@@ -196,107 +315,109 @@ const Re = (e, r, t, n = void 0) => {
|
|
|
196
315
|
columnGap: "clamp(14px, 3vw, 36px)",
|
|
197
316
|
rowGap: "clamp(8px, 1.6vw, 14px)"
|
|
198
317
|
},
|
|
199
|
-
children:
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
] }, String(
|
|
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)))
|
|
203
322
|
}
|
|
204
323
|
)
|
|
205
324
|
}
|
|
206
325
|
),
|
|
207
|
-
!
|
|
208
|
-
s.description && /* @__PURE__ */
|
|
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 })
|
|
209
328
|
] }) });
|
|
210
|
-
},
|
|
211
|
-
var
|
|
212
|
-
return
|
|
213
|
-
},
|
|
329
|
+
}, on = (e, r, t) => {
|
|
330
|
+
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 = ({
|
|
214
333
|
data: e,
|
|
215
334
|
handleChange: r,
|
|
216
335
|
path: t,
|
|
217
336
|
label: n,
|
|
218
|
-
required:
|
|
337
|
+
required: i,
|
|
219
338
|
errors: o,
|
|
220
339
|
schema: s,
|
|
221
|
-
uischema:
|
|
222
|
-
enabled:
|
|
223
|
-
visible:
|
|
340
|
+
uischema: a,
|
|
341
|
+
enabled: c,
|
|
342
|
+
visible: u = !0
|
|
224
343
|
}) => {
|
|
225
|
-
var
|
|
226
|
-
|
|
227
|
-
const d = ((
|
|
228
|
-
if (
|
|
229
|
-
if (!
|
|
230
|
-
const
|
|
231
|
-
|
|
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);
|
|
232
351
|
};
|
|
233
|
-
return document.addEventListener("mousedown",
|
|
234
|
-
}, [
|
|
352
|
+
return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
|
|
353
|
+
}, [y, m]), u === !1)
|
|
235
354
|
return null;
|
|
236
|
-
const
|
|
237
|
-
let
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
label:
|
|
241
|
-
}))
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
(
|
|
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 };
|
|
360
|
+
}));
|
|
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);
|
|
363
|
+
};
|
|
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);
|
|
250
371
|
};
|
|
251
|
-
return /* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
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: [
|
|
253
374
|
n,
|
|
254
375
|
" ",
|
|
255
|
-
|
|
376
|
+
d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
256
377
|
] }),
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
|
|
378
|
+
/* @__PURE__ */ g("div", { ref: N, style: { position: "relative" }, children: [
|
|
379
|
+
/* @__PURE__ */ l(
|
|
380
|
+
Ie.Root,
|
|
260
381
|
{
|
|
261
382
|
id: t,
|
|
262
|
-
value:
|
|
263
|
-
placeholder:
|
|
264
|
-
disabled: !
|
|
265
|
-
style:
|
|
266
|
-
onChange: (
|
|
267
|
-
|
|
383
|
+
value: m ? T : j,
|
|
384
|
+
placeholder: I,
|
|
385
|
+
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);
|
|
268
389
|
},
|
|
269
390
|
onFocus: () => {
|
|
270
|
-
|
|
391
|
+
c && !m && (w(""), D(0), f(!0));
|
|
271
392
|
},
|
|
272
|
-
onKeyDown: (
|
|
273
|
-
|
|
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]));
|
|
274
395
|
},
|
|
275
|
-
children: /* @__PURE__ */
|
|
276
|
-
|
|
396
|
+
children: /* @__PURE__ */ l(Ie.Slot, { side: "right", children: /* @__PURE__ */ g($, { align: "center", gap: "1", children: [
|
|
397
|
+
O && c && /* @__PURE__ */ l(
|
|
277
398
|
"span",
|
|
278
399
|
{
|
|
279
400
|
role: "button",
|
|
280
401
|
tabIndex: 0,
|
|
281
|
-
onMouseDown: (
|
|
282
|
-
onClick:
|
|
283
|
-
onKeyDown:
|
|
402
|
+
onMouseDown: (F) => F.preventDefault(),
|
|
403
|
+
onClick: J,
|
|
404
|
+
onKeyDown: pe,
|
|
284
405
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
285
406
|
"aria-label": "Clear selection",
|
|
286
407
|
children: "×"
|
|
287
408
|
}
|
|
288
409
|
),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
|
|
410
|
+
/* @__PURE__ */ l(
|
|
411
|
+
qt,
|
|
291
412
|
{
|
|
292
|
-
style: { transform:
|
|
413
|
+
style: { transform: m ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
293
414
|
}
|
|
294
415
|
)
|
|
295
416
|
] }) })
|
|
296
417
|
}
|
|
297
418
|
),
|
|
298
|
-
|
|
299
|
-
|
|
419
|
+
m && /* @__PURE__ */ l(
|
|
420
|
+
M,
|
|
300
421
|
{
|
|
301
422
|
style: {
|
|
302
423
|
position: "absolute",
|
|
@@ -310,278 +431,299 @@ const Re = (e, r, t, n = void 0) => {
|
|
|
310
431
|
border: "1px solid var(--gray-a6)",
|
|
311
432
|
overflow: "hidden"
|
|
312
433
|
},
|
|
313
|
-
children: /* @__PURE__ */
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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,
|
|
317
438
|
{
|
|
318
439
|
px: "3",
|
|
319
440
|
py: "2",
|
|
320
|
-
onMouseDown: (
|
|
321
|
-
onClick: () =>
|
|
322
|
-
onMouseEnter: () =>
|
|
441
|
+
onMouseDown: (le) => le.preventDefault(),
|
|
442
|
+
onClick: () => C(F),
|
|
443
|
+
onMouseEnter: () => D(Z),
|
|
323
444
|
style: {
|
|
324
445
|
cursor: "pointer",
|
|
325
446
|
borderRadius: "var(--radius-2)",
|
|
326
|
-
backgroundColor:
|
|
447
|
+
backgroundColor: Z === G ? "var(--accent-4)" : F.value === O ? "var(--accent-3)" : void 0
|
|
327
448
|
},
|
|
328
|
-
children: /* @__PURE__ */
|
|
449
|
+
children: /* @__PURE__ */ l(p, { size: "2", children: F.label })
|
|
329
450
|
},
|
|
330
|
-
|
|
451
|
+
F.value
|
|
331
452
|
))
|
|
332
453
|
] }) })
|
|
333
454
|
}
|
|
334
455
|
)
|
|
335
456
|
] }),
|
|
336
|
-
!
|
|
337
|
-
s.description && /* @__PURE__ */
|
|
457
|
+
!z && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Y }),
|
|
458
|
+
s.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: s.description })
|
|
338
459
|
] }) });
|
|
339
460
|
}
|
|
340
|
-
return /* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
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: [
|
|
342
463
|
n,
|
|
343
464
|
" ",
|
|
344
|
-
|
|
465
|
+
d && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
345
466
|
] }),
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
467
|
+
/* @__PURE__ */ g(
|
|
468
|
+
Qe.Root,
|
|
469
|
+
{
|
|
470
|
+
value: O,
|
|
471
|
+
onValueChange: (k) => {
|
|
472
|
+
const G = v.find((C) => C.value === k);
|
|
473
|
+
G && _(G);
|
|
474
|
+
},
|
|
475
|
+
disabled: !c,
|
|
476
|
+
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)) })
|
|
479
|
+
]
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
!z && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Y }),
|
|
483
|
+
s.description && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: s.description })
|
|
352
484
|
] }) });
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
485
|
+
}, cn = ie(2, ot(jt, Vt)), an = ie(
|
|
486
|
+
3,
|
|
487
|
+
ze((e) => {
|
|
488
|
+
var t;
|
|
489
|
+
if (e.type !== "object" || e["x-search"] !== void 0) return !1;
|
|
490
|
+
const r = (t = e.properties) == null ? void 0 : t.value;
|
|
491
|
+
return Array.isArray(r == null ? void 0 : r.enum) || Array.isArray(r == null ? void 0 : r.oneOf);
|
|
492
|
+
})
|
|
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) => {
|
|
499
|
+
let a;
|
|
360
500
|
if (s === void 0) {
|
|
361
|
-
if (!
|
|
362
|
-
|
|
501
|
+
if (!xt(r, o)) return i;
|
|
502
|
+
a = r[o];
|
|
363
503
|
} else {
|
|
364
|
-
if (!
|
|
504
|
+
if (!xt(n, o)) return i;
|
|
365
505
|
try {
|
|
366
|
-
|
|
506
|
+
a = n[o](s);
|
|
367
507
|
} catch {
|
|
368
|
-
return
|
|
508
|
+
return i;
|
|
369
509
|
}
|
|
370
510
|
}
|
|
371
|
-
return
|
|
511
|
+
return a == null ? "" : dn(a) ? String(a) : i;
|
|
372
512
|
});
|
|
373
513
|
}
|
|
374
|
-
function
|
|
514
|
+
function ht(e) {
|
|
375
515
|
const r = [];
|
|
376
516
|
let t = 0;
|
|
377
|
-
for (const n of e.matchAll(
|
|
517
|
+
for (const n of e.matchAll(Jt))
|
|
378
518
|
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;
|
|
379
519
|
return t < e.length && r.push(e.slice(t)), r;
|
|
380
520
|
}
|
|
381
|
-
function
|
|
521
|
+
function fn(e) {
|
|
382
522
|
if (typeof e == "string" && e.length > 0) return e;
|
|
383
523
|
if (e && typeof e == "object" && typeof e.value == "string") {
|
|
384
524
|
const r = e.value;
|
|
385
525
|
return r.length > 0 ? r : void 0;
|
|
386
526
|
}
|
|
387
527
|
}
|
|
388
|
-
function
|
|
528
|
+
function pn(e) {
|
|
389
529
|
if (typeof e == "string") return e.length > 0 ? { parent: e } : void 0;
|
|
390
530
|
if (!e || typeof e != "object") return;
|
|
391
531
|
const r = Object.entries(e);
|
|
392
532
|
if (r.length === 0) return;
|
|
393
533
|
const t = {}, n = [];
|
|
394
|
-
for (const [
|
|
395
|
-
typeof o == "string" && o.length > 0 ? t[
|
|
534
|
+
for (const [i, o] of r)
|
|
535
|
+
typeof o == "string" && o.length > 0 ? t[i] = o : n.push(i);
|
|
396
536
|
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;
|
|
397
537
|
}
|
|
398
|
-
function
|
|
538
|
+
function hn(e, r, t) {
|
|
399
539
|
const n = {};
|
|
400
|
-
for (const [
|
|
401
|
-
n[
|
|
540
|
+
for (const [i, o] of Object.entries(e))
|
|
541
|
+
n[i] = fn(He.data(r, t ? `${t}.${o}` : o));
|
|
402
542
|
return n;
|
|
403
543
|
}
|
|
404
|
-
function
|
|
405
|
-
return r ? { ...e, name:
|
|
544
|
+
function At(e, r) {
|
|
545
|
+
return r ? { ...e, name: it(r, e) } : e;
|
|
406
546
|
}
|
|
407
|
-
const
|
|
547
|
+
const mn = {
|
|
408
548
|
"small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
|
|
409
549
|
"large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
|
|
410
550
|
"large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
|
|
411
|
-
},
|
|
551
|
+
}, gn = ({
|
|
412
552
|
data: e,
|
|
413
553
|
handleChange: r,
|
|
414
554
|
path: t,
|
|
415
555
|
label: n,
|
|
416
|
-
required:
|
|
556
|
+
required: i,
|
|
417
557
|
errors: o,
|
|
418
558
|
enabled: s,
|
|
419
|
-
visible:
|
|
420
|
-
schema:
|
|
421
|
-
uischema:
|
|
559
|
+
visible: a = !0,
|
|
560
|
+
schema: c,
|
|
561
|
+
uischema: u
|
|
422
562
|
}) => {
|
|
423
|
-
var
|
|
424
|
-
const d = (
|
|
563
|
+
var Je, Ee;
|
|
564
|
+
const d = (c == null ? void 0 : c["x-search"]) ?? {
|
|
425
565
|
service: "",
|
|
426
566
|
displayTemplate: ""
|
|
427
|
-
},
|
|
428
|
-
var
|
|
429
|
-
const E =
|
|
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);
|
|
430
570
|
if (!E) return { parentValues: void 0, parentValuesKey: "", missingParent: !1 };
|
|
431
|
-
const
|
|
432
|
-
return { parentValues:
|
|
433
|
-
}, [d.dependsOn, (
|
|
434
|
-
|
|
435
|
-
if (!
|
|
436
|
-
const E =
|
|
437
|
-
if (
|
|
438
|
-
Object.keys(
|
|
439
|
-
}, [
|
|
440
|
-
var
|
|
441
|
-
if (
|
|
442
|
-
|
|
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;
|
|
443
583
|
return;
|
|
444
584
|
}
|
|
445
|
-
if (!
|
|
446
|
-
|
|
585
|
+
if (!O) {
|
|
586
|
+
he(void 0), X.current = void 0;
|
|
447
587
|
return;
|
|
448
588
|
}
|
|
449
|
-
if (((
|
|
450
|
-
if (
|
|
451
|
-
|
|
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 };
|
|
452
592
|
return;
|
|
453
593
|
}
|
|
454
|
-
if (
|
|
455
|
-
|
|
594
|
+
if (he({ id: O, name: j ?? O }), !(b != null && b.resolve)) {
|
|
595
|
+
X.current = { value: O, label: j };
|
|
456
596
|
return;
|
|
457
597
|
}
|
|
458
598
|
let E = !1;
|
|
459
|
-
const
|
|
460
|
-
return
|
|
461
|
-
E || (
|
|
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 });
|
|
462
602
|
}).catch(() => {
|
|
463
|
-
E || (
|
|
603
|
+
E || (X.current = { value: re, label: ae });
|
|
464
604
|
}), () => {
|
|
465
605
|
E = !0;
|
|
466
606
|
};
|
|
467
|
-
}, [
|
|
468
|
-
const
|
|
469
|
-
async (E,
|
|
470
|
-
var
|
|
471
|
-
if (
|
|
472
|
-
if (!
|
|
473
|
-
|
|
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.");
|
|
474
614
|
return;
|
|
475
615
|
}
|
|
476
|
-
(
|
|
477
|
-
const
|
|
478
|
-
|
|
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));
|
|
479
619
|
try {
|
|
480
|
-
const
|
|
620
|
+
const Ne = await b.search({
|
|
481
621
|
query: E,
|
|
482
|
-
cursor:
|
|
483
|
-
signal:
|
|
484
|
-
params:
|
|
622
|
+
cursor: re ? h.current : void 0,
|
|
623
|
+
signal: ae.signal,
|
|
624
|
+
params: v
|
|
485
625
|
});
|
|
486
|
-
if (
|
|
487
|
-
const
|
|
488
|
-
|
|
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);
|
|
489
629
|
} catch {
|
|
490
|
-
if (
|
|
491
|
-
|
|
630
|
+
if (ae.signal.aborted) return;
|
|
631
|
+
le("Failed to load results. Please try again.");
|
|
492
632
|
} finally {
|
|
493
|
-
|
|
633
|
+
ae.signal.aborted || (re ? F(!1) : J(!1));
|
|
494
634
|
}
|
|
495
635
|
},
|
|
496
|
-
[
|
|
636
|
+
[I, b, f == null ? void 0 : f.paginated, v, w]
|
|
497
637
|
);
|
|
498
|
-
|
|
499
|
-
if (!
|
|
500
|
-
const E = (
|
|
501
|
-
|
|
638
|
+
we(() => {
|
|
639
|
+
if (!z) return;
|
|
640
|
+
const E = (re) => {
|
|
641
|
+
Q.current && !Q.current.contains(re.target) && _(!1);
|
|
502
642
|
};
|
|
503
643
|
return document.addEventListener("mousedown", E), () => document.removeEventListener("mousedown", E);
|
|
504
|
-
}, [
|
|
644
|
+
}, [z]), we(() => {
|
|
505
645
|
var E;
|
|
506
|
-
|
|
507
|
-
}, [
|
|
508
|
-
if (!
|
|
509
|
-
if (
|
|
510
|
-
|
|
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;
|
|
511
651
|
return;
|
|
512
652
|
}
|
|
513
|
-
if (!
|
|
514
|
-
|
|
653
|
+
if (!ee && !T) {
|
|
654
|
+
te([]), G(!1), le(null), h.current = void 0;
|
|
515
655
|
return;
|
|
516
656
|
}
|
|
517
|
-
|
|
518
|
-
const E =
|
|
519
|
-
return
|
|
520
|
-
|
|
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);
|
|
521
661
|
}, E), () => {
|
|
522
|
-
|
|
662
|
+
x.current && clearTimeout(x.current);
|
|
523
663
|
};
|
|
524
|
-
}, [
|
|
664
|
+
}, [ee, z, T, S, R, A]), Oe(a, t, r);
|
|
665
|
+
const W = Ae(t, i, a);
|
|
666
|
+
if (a === !1)
|
|
525
667
|
return null;
|
|
526
|
-
const
|
|
527
|
-
|
|
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);
|
|
528
672
|
}, H = (E) => {
|
|
529
|
-
|
|
530
|
-
},
|
|
531
|
-
E.
|
|
532
|
-
},
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
return /* @__PURE__ */ i(k, { mb: "4", children: /* @__PURE__ */ y(F, { direction: "column", gap: "1", children: [
|
|
536
|
-
/* @__PURE__ */ y(h, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
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: [
|
|
537
679
|
n,
|
|
538
680
|
" ",
|
|
539
|
-
|
|
681
|
+
W && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
540
682
|
] }),
|
|
541
|
-
/* @__PURE__ */
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
|
|
683
|
+
/* @__PURE__ */ g("div", { ref: Q, style: { position: "relative" }, children: [
|
|
684
|
+
/* @__PURE__ */ l(
|
|
685
|
+
Ie.Root,
|
|
544
686
|
{
|
|
545
687
|
id: t,
|
|
546
|
-
value:
|
|
547
|
-
placeholder:
|
|
548
|
-
disabled: !
|
|
549
|
-
readOnly:
|
|
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),
|
|
550
692
|
style: Y ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
551
693
|
onChange: (E) => {
|
|
552
|
-
|
|
694
|
+
f != null && f.searchable && (fe(E.target.value), z || ce());
|
|
553
695
|
},
|
|
554
696
|
onFocus: () => {
|
|
555
|
-
|
|
697
|
+
ne && !z && ce();
|
|
556
698
|
},
|
|
557
699
|
onKeyDown: (E) => {
|
|
558
|
-
E.key === "Escape" &&
|
|
700
|
+
E.key === "Escape" && _(!1);
|
|
559
701
|
},
|
|
560
|
-
children: /* @__PURE__ */
|
|
561
|
-
|
|
702
|
+
children: /* @__PURE__ */ l(Ie.Slot, { side: "right", children: /* @__PURE__ */ g($, { align: "center", gap: "1", children: [
|
|
703
|
+
O && ne && /* @__PURE__ */ l(
|
|
562
704
|
"span",
|
|
563
705
|
{
|
|
564
706
|
role: "button",
|
|
565
707
|
tabIndex: 0,
|
|
566
708
|
onMouseDown: (E) => E.preventDefault(),
|
|
567
|
-
onClick:
|
|
568
|
-
onKeyDown:
|
|
709
|
+
onClick: H,
|
|
710
|
+
onKeyDown: ke,
|
|
569
711
|
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
570
712
|
"aria-label": "Clear selection",
|
|
571
713
|
children: "×"
|
|
572
714
|
}
|
|
573
715
|
),
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
-
|
|
716
|
+
/* @__PURE__ */ l(
|
|
717
|
+
qt,
|
|
576
718
|
{
|
|
577
|
-
style: { transform:
|
|
719
|
+
style: { transform: z ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
578
720
|
}
|
|
579
721
|
)
|
|
580
722
|
] }) })
|
|
581
723
|
}
|
|
582
724
|
),
|
|
583
|
-
|
|
584
|
-
|
|
725
|
+
z && /* @__PURE__ */ l(
|
|
726
|
+
M,
|
|
585
727
|
{
|
|
586
728
|
style: {
|
|
587
729
|
position: "absolute",
|
|
@@ -595,427 +737,429 @@ const tn = {
|
|
|
595
737
|
border: "1px solid var(--gray-a6)",
|
|
596
738
|
overflow: "hidden"
|
|
597
739
|
},
|
|
598
|
-
children:
|
|
599
|
-
|
|
600
|
-
!
|
|
601
|
-
!
|
|
602
|
-
|
|
603
|
-
|
|
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,
|
|
604
746
|
{
|
|
605
747
|
px: "3",
|
|
606
748
|
py: "2",
|
|
607
|
-
onMouseDown: (
|
|
608
|
-
onClick: () =>
|
|
749
|
+
onMouseDown: (re) => re.preventDefault(),
|
|
750
|
+
onClick: () => q(E),
|
|
609
751
|
style: {
|
|
610
752
|
cursor: "pointer",
|
|
611
753
|
borderRadius: "var(--radius-2)",
|
|
612
|
-
backgroundColor: E.id ===
|
|
754
|
+
backgroundColor: E.id === O ? "var(--accent-3)" : void 0
|
|
613
755
|
},
|
|
614
756
|
className: "hover:bg-(--gray-3)",
|
|
615
|
-
children: /* @__PURE__ */
|
|
757
|
+
children: /* @__PURE__ */ l(p, { size: "2", children: E.name })
|
|
616
758
|
},
|
|
617
759
|
E.id
|
|
618
760
|
)),
|
|
619
|
-
(
|
|
620
|
-
|
|
761
|
+
(f == null ? void 0 : f.paginated) && k && !pe && /* @__PURE__ */ l(M, { px: "3", py: "2", children: /* @__PURE__ */ l(
|
|
762
|
+
Ue,
|
|
621
763
|
{
|
|
622
764
|
variant: "ghost",
|
|
623
765
|
size: "1",
|
|
624
766
|
style: { width: "100%" },
|
|
625
767
|
onMouseDown: (E) => E.preventDefault(),
|
|
626
|
-
onClick: () => void
|
|
768
|
+
onClick: () => void S(ee, !0),
|
|
627
769
|
children: "Load more"
|
|
628
770
|
}
|
|
629
771
|
) }),
|
|
630
|
-
|
|
772
|
+
pe && /* @__PURE__ */ l($, { justify: "center", p: "2", children: /* @__PURE__ */ l(Be, {}) })
|
|
631
773
|
] }) })
|
|
632
774
|
}
|
|
633
775
|
)
|
|
634
776
|
] }),
|
|
635
|
-
!Y && /* @__PURE__ */
|
|
636
|
-
|
|
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 })
|
|
637
779
|
] }) });
|
|
638
|
-
},
|
|
780
|
+
}, yn = be(gn), bn = ie(
|
|
639
781
|
3,
|
|
640
|
-
|
|
782
|
+
ze((e) => {
|
|
641
783
|
const r = e["x-search"];
|
|
642
784
|
return (e.type === "string" || e.type === "object") && typeof (r == null ? void 0 : r.service) == "string" && r.service !== "";
|
|
643
785
|
})
|
|
644
|
-
),
|
|
786
|
+
), vn = (e) => {
|
|
645
787
|
if (e)
|
|
646
788
|
return /^\d{2}:\d{2}$/.test(e) ? `${e}:00` : e;
|
|
647
|
-
},
|
|
789
|
+
}, Rt = (e, r) => {
|
|
648
790
|
if (!e) return "";
|
|
649
791
|
const t = e.match(/^(\d{2}:\d{2})(:\d{2})?/);
|
|
650
792
|
return t ? r ? `${t[1]}${t[2] ?? ":00"}` : t[1] : e;
|
|
651
|
-
},
|
|
793
|
+
}, wn = (e, r) => Kt(`${e}T${r}`).format(), En = ({ path: e, label: r, required: t, errors: n, description: i, children: o }) => {
|
|
652
794
|
const s = n.length === 0;
|
|
653
|
-
return /* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
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: [
|
|
655
797
|
r,
|
|
656
798
|
" ",
|
|
657
|
-
t && /* @__PURE__ */
|
|
799
|
+
t && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
658
800
|
] }),
|
|
659
801
|
o,
|
|
660
|
-
!s && /* @__PURE__ */
|
|
661
|
-
|
|
802
|
+
!s && /* @__PURE__ */ l(p, { color: "red", size: "1", children: Re(n, r) }),
|
|
803
|
+
i && /* @__PURE__ */ l(p, { size: "1", color: "gray", children: i })
|
|
662
804
|
] }) });
|
|
663
|
-
},
|
|
805
|
+
}, Tn = ({
|
|
664
806
|
data: e,
|
|
665
807
|
handleChange: r,
|
|
666
808
|
path: t,
|
|
667
809
|
label: n,
|
|
668
|
-
required:
|
|
810
|
+
required: i,
|
|
669
811
|
errors: o,
|
|
670
812
|
schema: s,
|
|
671
|
-
uischema:
|
|
672
|
-
enabled:
|
|
673
|
-
visible:
|
|
813
|
+
uischema: a,
|
|
814
|
+
enabled: c,
|
|
815
|
+
visible: u = !0
|
|
674
816
|
}) => {
|
|
675
|
-
var
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
}, [
|
|
817
|
+
var v;
|
|
818
|
+
we(() => {
|
|
819
|
+
u === !1 && r(t, void 0);
|
|
820
|
+
}, [u, t, r]);
|
|
821
|
+
const d = Ae(t, i, u);
|
|
822
|
+
if (u === !1)
|
|
679
823
|
return null;
|
|
680
|
-
const
|
|
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 });
|
|
681
825
|
if (s.format === "time")
|
|
682
|
-
return
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
|
|
826
|
+
return w(
|
|
827
|
+
/* @__PURE__ */ l(
|
|
828
|
+
Ie.Root,
|
|
685
829
|
{
|
|
686
830
|
type: "time",
|
|
687
|
-
step:
|
|
688
|
-
value:
|
|
689
|
-
onChange: (
|
|
690
|
-
disabled: !
|
|
691
|
-
color:
|
|
831
|
+
step: T,
|
|
832
|
+
value: Rt(m, f),
|
|
833
|
+
onChange: (b) => r(t, vn(b.target.value)),
|
|
834
|
+
disabled: !c,
|
|
835
|
+
color: y ? void 0 : "red",
|
|
692
836
|
id: t
|
|
693
837
|
}
|
|
694
838
|
)
|
|
695
839
|
);
|
|
696
|
-
const
|
|
697
|
-
if (!
|
|
840
|
+
const L = s.format === "date-time", [D = "", N = ""] = m.split("T"), A = Rt(N, f), R = (b, U) => {
|
|
841
|
+
if (!b) {
|
|
698
842
|
r(t, void 0);
|
|
699
843
|
return;
|
|
700
844
|
}
|
|
701
|
-
r(t,
|
|
845
|
+
r(t, L ? wn(b, U || "00:00") : b);
|
|
702
846
|
};
|
|
703
|
-
return
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
|
|
847
|
+
return w(
|
|
848
|
+
/* @__PURE__ */ g($, { gap: "2", align: "center", children: [
|
|
849
|
+
/* @__PURE__ */ l(
|
|
850
|
+
Ie.Root,
|
|
707
851
|
{
|
|
708
852
|
type: "date",
|
|
709
|
-
value:
|
|
710
|
-
disabled: !
|
|
711
|
-
color:
|
|
712
|
-
onChange: (
|
|
853
|
+
value: D,
|
|
854
|
+
disabled: !c,
|
|
855
|
+
color: y ? void 0 : "red",
|
|
856
|
+
onChange: (b) => R(b.target.value, A),
|
|
713
857
|
id: t,
|
|
714
858
|
style: { flex: 1 }
|
|
715
859
|
}
|
|
716
860
|
),
|
|
717
|
-
|
|
718
|
-
|
|
861
|
+
L && /* @__PURE__ */ l(
|
|
862
|
+
Ie.Root,
|
|
719
863
|
{
|
|
720
864
|
type: "time",
|
|
721
|
-
step:
|
|
722
|
-
value:
|
|
723
|
-
disabled: !
|
|
724
|
-
color:
|
|
725
|
-
onChange: (
|
|
865
|
+
step: T,
|
|
866
|
+
value: A,
|
|
867
|
+
disabled: !c || !D,
|
|
868
|
+
color: y ? void 0 : "red",
|
|
869
|
+
onChange: (b) => R(D, b.target.value),
|
|
726
870
|
style: { flex: 1 }
|
|
727
871
|
}
|
|
728
872
|
)
|
|
729
873
|
] })
|
|
730
874
|
);
|
|
731
|
-
},
|
|
875
|
+
}, xn = ie(2, ot(xr, Ar, Rr)), An = be(Tn), Rn = ({
|
|
732
876
|
uischema: e,
|
|
733
877
|
schema: r,
|
|
734
878
|
path: t,
|
|
735
879
|
renderers: n,
|
|
736
|
-
cells:
|
|
880
|
+
cells: i,
|
|
737
881
|
enabled: o,
|
|
738
882
|
visible: s = !0
|
|
739
883
|
}) => {
|
|
740
|
-
const
|
|
741
|
-
return s === !1 ? null : /* @__PURE__ */
|
|
742
|
-
|
|
884
|
+
const c = e.elements;
|
|
885
|
+
return s === !1 ? null : /* @__PURE__ */ l($, { direction: "column", gap: "4", children: c.map((u, d) => /* @__PURE__ */ l(
|
|
886
|
+
Ge,
|
|
743
887
|
{
|
|
744
|
-
uischema:
|
|
888
|
+
uischema: u,
|
|
745
889
|
schema: r,
|
|
746
890
|
path: t,
|
|
747
891
|
renderers: n,
|
|
748
|
-
cells:
|
|
892
|
+
cells: i,
|
|
749
893
|
enabled: o
|
|
750
894
|
},
|
|
751
895
|
`${t}-${d}`
|
|
752
896
|
)) });
|
|
753
|
-
},
|
|
897
|
+
}, Cn = ie(1, Ye("VerticalLayout")), Sn = ({
|
|
754
898
|
uischema: e,
|
|
755
899
|
schema: r,
|
|
756
900
|
path: t,
|
|
757
901
|
renderers: n,
|
|
758
|
-
cells:
|
|
902
|
+
cells: i,
|
|
759
903
|
enabled: o,
|
|
760
904
|
visible: s = !0
|
|
761
905
|
}) => {
|
|
762
|
-
const
|
|
763
|
-
return s === !1 ? null : /* @__PURE__ */
|
|
764
|
-
|
|
906
|
+
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,
|
|
765
909
|
{
|
|
766
|
-
uischema:
|
|
910
|
+
uischema: u,
|
|
767
911
|
schema: r,
|
|
768
912
|
path: t,
|
|
769
913
|
renderers: n,
|
|
770
|
-
cells:
|
|
914
|
+
cells: i,
|
|
771
915
|
enabled: o
|
|
772
916
|
}
|
|
773
917
|
) }, `${t}-${d}`)) });
|
|
774
|
-
},
|
|
918
|
+
}, On = ie(1, Ye("HorizontalLayout")), Nn = ({
|
|
775
919
|
uischema: e,
|
|
776
920
|
schema: r,
|
|
777
921
|
path: t,
|
|
778
922
|
renderers: n,
|
|
779
|
-
cells:
|
|
923
|
+
cells: i,
|
|
780
924
|
enabled: o,
|
|
781
925
|
visible: s = !0
|
|
782
926
|
}) => {
|
|
783
|
-
const
|
|
784
|
-
return s === !1 ? null : /* @__PURE__ */
|
|
785
|
-
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
|
|
927
|
+
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,
|
|
788
932
|
{
|
|
789
|
-
uischema:
|
|
933
|
+
uischema: u,
|
|
790
934
|
schema: r,
|
|
791
935
|
path: t,
|
|
792
936
|
renderers: n,
|
|
793
|
-
cells:
|
|
937
|
+
cells: i,
|
|
794
938
|
enabled: o
|
|
795
939
|
},
|
|
796
940
|
`${t}-${d}`
|
|
797
941
|
)) })
|
|
798
942
|
] });
|
|
799
|
-
},
|
|
943
|
+
}, Dn = ie(1, Ye("Group")), In = ({
|
|
800
944
|
uischema: e,
|
|
801
945
|
schema: r,
|
|
802
946
|
path: t,
|
|
803
947
|
renderers: n,
|
|
804
|
-
cells:
|
|
948
|
+
cells: i,
|
|
805
949
|
enabled: o,
|
|
806
950
|
visible: s = !0
|
|
807
951
|
}) => {
|
|
808
|
-
var
|
|
809
|
-
const
|
|
810
|
-
if (s === !1 || !
|
|
811
|
-
const
|
|
812
|
-
return /* @__PURE__ */
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
/* @__PURE__ */
|
|
815
|
-
|
|
952
|
+
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,
|
|
816
960
|
{
|
|
817
|
-
uischema:
|
|
961
|
+
uischema: w,
|
|
818
962
|
schema: r,
|
|
819
963
|
path: t,
|
|
820
964
|
renderers: n,
|
|
821
|
-
cells:
|
|
965
|
+
cells: i,
|
|
822
966
|
enabled: o
|
|
823
967
|
},
|
|
824
|
-
`${t}-${
|
|
825
|
-
)) }) }, `${t}-${
|
|
968
|
+
`${t}-${T}-${L}`
|
|
969
|
+
)) }) }, `${t}-${T}`)) })
|
|
826
970
|
] });
|
|
827
|
-
},
|
|
828
|
-
function
|
|
971
|
+
}, kn = ie(1, Ye("Categorization"));
|
|
972
|
+
function Ce(e) {
|
|
829
973
|
return e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(0)} MB` : e >= 1024 ? `${(e / 1024).toFixed(0)} KB` : `${e} B`;
|
|
830
974
|
}
|
|
831
|
-
function
|
|
832
|
-
const r = e.split(",").map((o) => o.trim()).filter(Boolean), t = r.filter((o) => o.startsWith(".")),
|
|
975
|
+
function Se(e) {
|
|
976
|
+
const r = e.split(",").map((o) => o.trim()).filter(Boolean), t = r.filter((o) => o.startsWith(".")), i = (t.length > 0 ? t : r).map((o) => {
|
|
833
977
|
if (o.endsWith("/*")) return o.split("/")[0].toUpperCase() + "S";
|
|
834
978
|
if (o.startsWith(".")) return o.slice(1).toUpperCase();
|
|
835
979
|
const s = o.split("/")[1];
|
|
836
980
|
return s ? s.toUpperCase() : o;
|
|
837
981
|
});
|
|
838
|
-
return [...new Set(
|
|
982
|
+
return [...new Set(i)].join(", ");
|
|
839
983
|
}
|
|
840
|
-
const
|
|
841
|
-
function
|
|
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) {
|
|
842
986
|
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);
|
|
843
987
|
}
|
|
844
|
-
function
|
|
845
|
-
const r = !!e.type, t =
|
|
846
|
-
return !r && !t ? !0 :
|
|
988
|
+
function Mn(e) {
|
|
989
|
+
const r = !!e.type, t = ct(e.name) !== void 0;
|
|
990
|
+
return !r && !t ? !0 : Zt(e, Ln);
|
|
847
991
|
}
|
|
848
|
-
function
|
|
992
|
+
function ct(e) {
|
|
849
993
|
const r = e.split(/[/\\]/).pop() ?? e, t = r.lastIndexOf(".");
|
|
850
994
|
if (!(t <= 0 || t === r.length - 1))
|
|
851
995
|
return r.slice(t);
|
|
852
996
|
}
|
|
853
|
-
function
|
|
854
|
-
|
|
997
|
+
function zn(e, r, t) {
|
|
998
|
+
Qt(new Blob([e], { type: t }), r);
|
|
855
999
|
}
|
|
856
|
-
function
|
|
1000
|
+
function Qt(e, r) {
|
|
857
1001
|
const t = URL.createObjectURL(e), n = document.createElement("a");
|
|
858
1002
|
n.href = t, n.download = r, n.click(), setTimeout(() => URL.revokeObjectURL(t), 0);
|
|
859
1003
|
}
|
|
860
|
-
async function
|
|
1004
|
+
async function Fn(e, r) {
|
|
861
1005
|
const t = await fetch(e);
|
|
862
1006
|
if (!t.ok) throw new Error(`Download failed (${t.status})`);
|
|
863
|
-
|
|
1007
|
+
Qt(await t.blob(), r);
|
|
864
1008
|
}
|
|
865
|
-
function
|
|
1009
|
+
function $n(e, r, t) {
|
|
866
1010
|
const n = t.name || t.key;
|
|
867
1011
|
if (!e) return n;
|
|
868
|
-
const
|
|
869
|
-
return !o ||
|
|
1012
|
+
const i = mt(e, r, n), o = ct(t.name ?? "") ?? ct(t.key);
|
|
1013
|
+
return !o || i.toLowerCase().endsWith(o.toLowerCase()) ? i : `${i}${o}`;
|
|
870
1014
|
}
|
|
871
|
-
const
|
|
872
|
-
function
|
|
873
|
-
const t = Array.from(e, (n) =>
|
|
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();
|
|
874
1018
|
return t === "" || t.startsWith(".") ? r : t;
|
|
875
1019
|
}
|
|
876
|
-
function
|
|
1020
|
+
function mt(e, r, t) {
|
|
877
1021
|
const n = r !== null && typeof r == "object" && !Array.isArray(r) ? r : {};
|
|
878
|
-
return
|
|
1022
|
+
return _n(it(e, n), t);
|
|
879
1023
|
}
|
|
880
|
-
function
|
|
1024
|
+
function jn(e) {
|
|
881
1025
|
return e ? Array.isArray(e) ? e : [e] : [];
|
|
882
1026
|
}
|
|
883
|
-
const
|
|
1027
|
+
const Vn = ({
|
|
884
1028
|
data: e,
|
|
885
1029
|
handleChange: r,
|
|
886
1030
|
path: t,
|
|
887
1031
|
label: n,
|
|
888
|
-
required:
|
|
1032
|
+
required: i,
|
|
889
1033
|
uischema: o,
|
|
890
1034
|
schema: s,
|
|
891
|
-
enabled:
|
|
892
|
-
errors:
|
|
893
|
-
visible:
|
|
1035
|
+
enabled: a,
|
|
1036
|
+
errors: c,
|
|
1037
|
+
visible: u = !0
|
|
894
1038
|
}) => {
|
|
895
|
-
const d =
|
|
896
|
-
|
|
897
|
-
const
|
|
898
|
-
const
|
|
899
|
-
return { name: (
|
|
900
|
-
},
|
|
901
|
-
var
|
|
902
|
-
const
|
|
903
|
-
if (
|
|
904
|
-
const
|
|
905
|
-
return
|
|
906
|
-
},
|
|
907
|
-
|
|
908
|
-
},
|
|
909
|
-
|
|
910
|
-
if (!
|
|
911
|
-
const
|
|
912
|
-
return delete
|
|
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;
|
|
913
1057
|
});
|
|
914
1058
|
};
|
|
915
|
-
|
|
916
|
-
|
|
1059
|
+
we(() => () => {
|
|
1060
|
+
Y.current.forEach((h) => URL.revokeObjectURL(h)), Y.current.clear();
|
|
917
1061
|
}, []);
|
|
918
|
-
const
|
|
919
|
-
async (
|
|
920
|
-
if (
|
|
921
|
-
|
|
1062
|
+
const G = We(
|
|
1063
|
+
async (h) => {
|
|
1064
|
+
if (P(null), _.length >= w) {
|
|
1065
|
+
P(`Maximum ${w} file${w > 1 ? "s" : ""} allowed.`);
|
|
922
1066
|
return;
|
|
923
1067
|
}
|
|
924
|
-
if (
|
|
925
|
-
|
|
1068
|
+
if (h.size > L) {
|
|
1069
|
+
P(`File exceeds the ${Ce(L)} limit.`);
|
|
926
1070
|
return;
|
|
927
1071
|
}
|
|
928
|
-
if (!
|
|
929
|
-
|
|
1072
|
+
if (!Zt(h, D)) {
|
|
1073
|
+
P(`Invalid type. Accepted: ${Se(D)}`);
|
|
930
1074
|
return;
|
|
931
1075
|
}
|
|
932
1076
|
if (!(d != null && d.onUpload)) {
|
|
933
|
-
|
|
1077
|
+
P("Upload service not configured.");
|
|
934
1078
|
return;
|
|
935
1079
|
}
|
|
936
1080
|
try {
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
const
|
|
940
|
-
key:
|
|
941
|
-
name:
|
|
942
|
-
type:
|
|
943
|
-
blobUrl:
|
|
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
|
|
944
1088
|
};
|
|
945
|
-
|
|
946
|
-
const
|
|
947
|
-
r(t,
|
|
1089
|
+
ne((me) => ({ ...me, [x.key]: Q }));
|
|
1090
|
+
const X = [..._, x.key];
|
|
1091
|
+
r(t, A ? X : X[0]);
|
|
948
1092
|
} catch {
|
|
949
|
-
|
|
1093
|
+
P("Upload failed. Please try again."), z.current && (z.current.value = "");
|
|
950
1094
|
}
|
|
951
1095
|
},
|
|
952
|
-
[
|
|
1096
|
+
[_, w, L, D, d, t, r, A]
|
|
953
1097
|
);
|
|
954
|
-
if (
|
|
1098
|
+
if (u === !1)
|
|
955
1099
|
return null;
|
|
956
|
-
const
|
|
957
|
-
|
|
958
|
-
},
|
|
959
|
-
var
|
|
960
|
-
|
|
961
|
-
},
|
|
962
|
-
var
|
|
963
|
-
(
|
|
964
|
-
},
|
|
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) => {
|
|
965
1109
|
if (!R) return;
|
|
966
|
-
|
|
967
|
-
var
|
|
968
|
-
const
|
|
969
|
-
return
|
|
970
|
-
}),
|
|
971
|
-
const
|
|
972
|
-
r(t,
|
|
973
|
-
},
|
|
974
|
-
var
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
if (
|
|
978
|
-
(
|
|
1110
|
+
ne((V) => {
|
|
1111
|
+
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();
|
|
979
1123
|
return;
|
|
980
1124
|
}
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
1125
|
+
const Q = window.open("", "_blank");
|
|
1126
|
+
if (Q)
|
|
983
1127
|
try {
|
|
984
|
-
const
|
|
985
|
-
|
|
1128
|
+
const S = await oe(x);
|
|
1129
|
+
S ? Q.location.href = S : (Q.close(), te(x, "Unable to open file."));
|
|
986
1130
|
} catch {
|
|
987
|
-
|
|
1131
|
+
Q.close(), te(x, "Unable to open file.");
|
|
988
1132
|
}
|
|
989
|
-
},
|
|
990
|
-
|
|
1133
|
+
}, le = async (h, x) => {
|
|
1134
|
+
k(h);
|
|
991
1135
|
try {
|
|
992
|
-
const
|
|
993
|
-
if (
|
|
994
|
-
|
|
1136
|
+
const V = await oe(h);
|
|
1137
|
+
if (!V) {
|
|
1138
|
+
te(h, "Unable to download file.");
|
|
995
1139
|
return;
|
|
996
1140
|
}
|
|
997
|
-
await
|
|
1141
|
+
await Fn(V, x);
|
|
998
1142
|
} catch {
|
|
999
|
-
|
|
1143
|
+
te(h, "Unable to download file.");
|
|
1000
1144
|
}
|
|
1001
1145
|
};
|
|
1002
|
-
if (!R &&
|
|
1003
|
-
const
|
|
1004
|
-
return /* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
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: [
|
|
1007
1151
|
n,
|
|
1008
|
-
|
|
1152
|
+
y && /* @__PURE__ */ l(p, { color: "red", children: " *" })
|
|
1009
1153
|
] }),
|
|
1010
|
-
/* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ l(p, { size: "1", color: "gray", children: A ? `Up to ${w} files · ${Ce(L)} each · ${Se(D)}` : `${Ce(L)} · ${Se(D)}` })
|
|
1011
1155
|
] }),
|
|
1012
|
-
|
|
1013
|
-
var
|
|
1014
|
-
const
|
|
1015
|
-
return /* @__PURE__ */
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
|
|
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,
|
|
1019
1163
|
{
|
|
1020
1164
|
style: {
|
|
1021
1165
|
background: "var(--blue-3)",
|
|
@@ -1024,12 +1168,12 @@ const Nn = ({
|
|
|
1024
1168
|
color: "var(--blue-9)",
|
|
1025
1169
|
flexShrink: 0
|
|
1026
1170
|
},
|
|
1027
|
-
children: /* @__PURE__ */
|
|
1171
|
+
children: /* @__PURE__ */ l(Mr, { width: "20", height: "20" })
|
|
1028
1172
|
}
|
|
1029
1173
|
),
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
/* @__PURE__ */
|
|
1032
|
-
|
|
1174
|
+
/* @__PURE__ */ g(M, { style: { flex: 1, overflow: "hidden" }, children: [
|
|
1175
|
+
/* @__PURE__ */ l(
|
|
1176
|
+
p,
|
|
1033
1177
|
{
|
|
1034
1178
|
size: "2",
|
|
1035
1179
|
weight: "bold",
|
|
@@ -1039,11 +1183,11 @@ const Nn = ({
|
|
|
1039
1183
|
textOverflow: "ellipsis",
|
|
1040
1184
|
whiteSpace: "nowrap"
|
|
1041
1185
|
},
|
|
1042
|
-
children:
|
|
1186
|
+
children: me
|
|
1043
1187
|
}
|
|
1044
1188
|
),
|
|
1045
|
-
|
|
1046
|
-
|
|
1189
|
+
S && /* @__PURE__ */ l(
|
|
1190
|
+
p,
|
|
1047
1191
|
{
|
|
1048
1192
|
size: "1",
|
|
1049
1193
|
color: "gray",
|
|
@@ -1053,83 +1197,83 @@ const Nn = ({
|
|
|
1053
1197
|
textOverflow: "ellipsis",
|
|
1054
1198
|
whiteSpace: "nowrap"
|
|
1055
1199
|
},
|
|
1056
|
-
children:
|
|
1200
|
+
children: Q
|
|
1057
1201
|
}
|
|
1058
1202
|
)
|
|
1059
1203
|
] }),
|
|
1060
|
-
/* @__PURE__ */
|
|
1061
|
-
|
|
1062
|
-
/* @__PURE__ */
|
|
1063
|
-
|
|
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,
|
|
1064
1208
|
{
|
|
1065
1209
|
variant: "ghost",
|
|
1066
1210
|
color: "gray",
|
|
1067
1211
|
"aria-label": "Download",
|
|
1068
|
-
onClick: () => void
|
|
1069
|
-
children: /* @__PURE__ */
|
|
1212
|
+
onClick: () => void le(h, X),
|
|
1213
|
+
children: /* @__PURE__ */ l(dt, {})
|
|
1070
1214
|
}
|
|
1071
1215
|
) }),
|
|
1072
|
-
/* @__PURE__ */
|
|
1073
|
-
R && /* @__PURE__ */
|
|
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, {}) })
|
|
1074
1218
|
] })
|
|
1075
1219
|
] }),
|
|
1076
|
-
|
|
1077
|
-
] },
|
|
1220
|
+
W && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: W })
|
|
1221
|
+
] }, h);
|
|
1078
1222
|
}),
|
|
1079
|
-
|
|
1223
|
+
he && /* @__PURE__ */ g(
|
|
1080
1224
|
"div",
|
|
1081
1225
|
{
|
|
1082
1226
|
role: "button",
|
|
1083
1227
|
tabIndex: 0,
|
|
1084
1228
|
onClick: () => {
|
|
1085
|
-
var
|
|
1086
|
-
return (
|
|
1229
|
+
var h;
|
|
1230
|
+
return (h = z.current) == null ? void 0 : h.click();
|
|
1087
1231
|
},
|
|
1088
|
-
onKeyDown: (
|
|
1089
|
-
var
|
|
1090
|
-
(
|
|
1232
|
+
onKeyDown: (h) => {
|
|
1233
|
+
var x;
|
|
1234
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), (x = z.current) == null || x.click());
|
|
1091
1235
|
},
|
|
1092
|
-
onDragEnter:
|
|
1093
|
-
onDragLeave:
|
|
1094
|
-
onDragOver:
|
|
1095
|
-
onDrop:
|
|
1236
|
+
onDragEnter: C,
|
|
1237
|
+
onDragLeave: C,
|
|
1238
|
+
onDragOver: C,
|
|
1239
|
+
onDrop: J,
|
|
1096
1240
|
style: { cursor: "pointer" },
|
|
1097
1241
|
className: [
|
|
1098
1242
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
1099
1243
|
"transition-all duration-200 ease-in-out",
|
|
1100
|
-
|
|
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"
|
|
1101
1245
|
].join(" "),
|
|
1102
1246
|
children: [
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
] }) : /* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
|
|
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),
|
|
1113
1257
|
" max · ",
|
|
1114
|
-
|
|
1258
|
+
Se(D)
|
|
1115
1259
|
] })
|
|
1116
1260
|
] }) })
|
|
1117
1261
|
]
|
|
1118
1262
|
}
|
|
1119
1263
|
),
|
|
1120
|
-
R &&
|
|
1264
|
+
R && ee && A && /* @__PURE__ */ g(p, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
|
|
1121
1265
|
"Maximum ",
|
|
1122
|
-
|
|
1266
|
+
w,
|
|
1123
1267
|
" files uploaded. Remove one to replace it."
|
|
1124
1268
|
] }),
|
|
1125
|
-
!
|
|
1269
|
+
!m && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Re(c, n) })
|
|
1126
1270
|
] });
|
|
1127
|
-
},
|
|
1271
|
+
}, Wn = be(Vn), Hn = ie(
|
|
1128
1272
|
10,
|
|
1129
1273
|
// high rank to beat default array renderer
|
|
1130
|
-
|
|
1274
|
+
Wt(
|
|
1131
1275
|
// Match both single-file (type: string) and multi-file (type: array)
|
|
1132
|
-
|
|
1276
|
+
ze((e) => {
|
|
1133
1277
|
if (e.type === "string" && e.format === "file") return !0;
|
|
1134
1278
|
if (e.type === "array") {
|
|
1135
1279
|
const r = e.items;
|
|
@@ -1139,27 +1283,27 @@ const Nn = ({
|
|
|
1139
1283
|
})
|
|
1140
1284
|
)
|
|
1141
1285
|
);
|
|
1142
|
-
function
|
|
1286
|
+
function er(e, r) {
|
|
1143
1287
|
return e !== !1 && r !== !0;
|
|
1144
1288
|
}
|
|
1145
|
-
class
|
|
1289
|
+
class at extends Error {
|
|
1146
1290
|
}
|
|
1147
|
-
async function
|
|
1148
|
-
const { read: t, utils: n } = await import("@e965/xlsx"),
|
|
1149
|
-
if (
|
|
1150
|
-
throw new
|
|
1151
|
-
const o = r ??
|
|
1291
|
+
async function Bn(e, r) {
|
|
1292
|
+
const { read: t, utils: n } = await import("@e965/xlsx"), i = t(e, { type: "array", cellDates: !0 });
|
|
1293
|
+
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];
|
|
1152
1296
|
if (!s)
|
|
1153
|
-
throw new
|
|
1154
|
-
const
|
|
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 });
|
|
1155
1299
|
return {
|
|
1156
1300
|
sheetName: o,
|
|
1157
|
-
matrix:
|
|
1158
|
-
rowCount:
|
|
1159
|
-
colCount: Math.max(0, ...
|
|
1301
|
+
matrix: a,
|
|
1302
|
+
rowCount: a.length,
|
|
1303
|
+
colCount: Math.max(0, ...a.map((c) => c.length))
|
|
1160
1304
|
};
|
|
1161
1305
|
}
|
|
1162
|
-
function
|
|
1306
|
+
function Xn(e) {
|
|
1163
1307
|
let r = e + 1, t = "";
|
|
1164
1308
|
for (; r > 0; ) {
|
|
1165
1309
|
const n = (r - 1) % 26;
|
|
@@ -1167,14 +1311,14 @@ function Ln(e) {
|
|
|
1167
1311
|
}
|
|
1168
1312
|
return t;
|
|
1169
1313
|
}
|
|
1170
|
-
class
|
|
1314
|
+
class de extends Error {
|
|
1171
1315
|
constructor(t, n) {
|
|
1172
1316
|
super(n ?? t);
|
|
1173
|
-
|
|
1317
|
+
vt(this, "code");
|
|
1174
1318
|
this.code = t, this.name = "FormulaError";
|
|
1175
1319
|
}
|
|
1176
1320
|
}
|
|
1177
|
-
const
|
|
1321
|
+
const qn = [
|
|
1178
1322
|
// Logical
|
|
1179
1323
|
// IF is excluded here even though its native body is real, non-stub code —
|
|
1180
1324
|
// see LOGICAL_FUNCTIONS_WITH_BROKEN_CONDITION_COERCION below for why it's
|
|
@@ -1200,7 +1344,7 @@ const Mn = [
|
|
|
1200
1344
|
// DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL.
|
|
1201
1345
|
"DATE",
|
|
1202
1346
|
"TODAY"
|
|
1203
|
-
],
|
|
1347
|
+
], Kn = [
|
|
1204
1348
|
"MAX",
|
|
1205
1349
|
"MIN",
|
|
1206
1350
|
"MAXA",
|
|
@@ -1219,7 +1363,7 @@ const Mn = [
|
|
|
1219
1363
|
"COUNTA",
|
|
1220
1364
|
// not present in fast-formula-parser's function table at all.
|
|
1221
1365
|
"UPPER"
|
|
1222
|
-
],
|
|
1366
|
+
], Yn = ["YEAR", "MONTH", "DAY", "WEEKDAY"], Gn = ["IF"], Jn = [
|
|
1223
1367
|
"CONCATENATE",
|
|
1224
1368
|
"CONCAT",
|
|
1225
1369
|
"LEN",
|
|
@@ -1230,24 +1374,24 @@ const Mn = [
|
|
|
1230
1374
|
"MID",
|
|
1231
1375
|
"FIND",
|
|
1232
1376
|
"SEARCH"
|
|
1233
|
-
],
|
|
1234
|
-
...
|
|
1235
|
-
...
|
|
1236
|
-
...
|
|
1237
|
-
|
|
1238
|
-
...
|
|
1239
|
-
]),
|
|
1240
|
-
function
|
|
1241
|
-
const r = e.replace(
|
|
1242
|
-
|
|
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;
|
|
1243
1387
|
let t;
|
|
1244
|
-
for (; (t =
|
|
1388
|
+
for (; (t = Ct.exec(r)) !== null; ) {
|
|
1245
1389
|
const n = t[1].toUpperCase();
|
|
1246
|
-
if (!
|
|
1247
|
-
throw new
|
|
1390
|
+
if (!Zn.has(n))
|
|
1391
|
+
throw new de("NAME", `Function ${n} is not allowed.`);
|
|
1248
1392
|
}
|
|
1249
1393
|
}
|
|
1250
|
-
function
|
|
1394
|
+
function to(e, r, t) {
|
|
1251
1395
|
let n = e;
|
|
1252
1396
|
if (n == null) throw t.NA;
|
|
1253
1397
|
if (typeof n == "object" && !(n instanceof t) && (n = r.retrieveRef(n)), n instanceof t) throw n;
|
|
@@ -1255,54 +1399,54 @@ function Vn(e, r, t) {
|
|
|
1255
1399
|
if (typeof n == "number") return n !== 0;
|
|
1256
1400
|
throw t.VALUE;
|
|
1257
1401
|
}
|
|
1258
|
-
function
|
|
1402
|
+
function tr(e) {
|
|
1259
1403
|
return e !== null && typeof e == "object" && "value" in e ? e.value : e;
|
|
1260
1404
|
}
|
|
1261
|
-
function
|
|
1262
|
-
const r =
|
|
1405
|
+
function Fe(e) {
|
|
1406
|
+
const r = tr(e);
|
|
1263
1407
|
return Array.isArray(r) ? r.flat(1 / 0) : [r];
|
|
1264
1408
|
}
|
|
1265
|
-
function
|
|
1266
|
-
const r =
|
|
1409
|
+
function K(e) {
|
|
1410
|
+
const r = tr(e);
|
|
1267
1411
|
return Array.isArray(r) ? r.flat(1 / 0)[0] : r;
|
|
1268
1412
|
}
|
|
1269
|
-
function
|
|
1270
|
-
return e === void 0 ? void 0 :
|
|
1413
|
+
function tt(e) {
|
|
1414
|
+
return e === void 0 ? void 0 : K(e);
|
|
1271
1415
|
}
|
|
1272
|
-
function
|
|
1416
|
+
function ue(e) {
|
|
1273
1417
|
return e == null || e === "" ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1274
1418
|
}
|
|
1275
|
-
function
|
|
1419
|
+
function ro(e, r) {
|
|
1276
1420
|
return e instanceof r ? e : new r(e.message || "#ERROR!");
|
|
1277
1421
|
}
|
|
1278
|
-
function
|
|
1422
|
+
function se(e) {
|
|
1279
1423
|
return e.find((r) => r instanceof Error);
|
|
1280
1424
|
}
|
|
1281
|
-
function
|
|
1425
|
+
function no(e, r) {
|
|
1282
1426
|
const t = (o) => {
|
|
1283
|
-
throw
|
|
1284
|
-
}, n = (o, { checkArgsForErrors: s = !0 } = {}) => (...
|
|
1285
|
-
const
|
|
1427
|
+
throw ro(o, r);
|
|
1428
|
+
}, n = (o, { checkArgsForErrors: s = !0 } = {}) => (...a) => {
|
|
1429
|
+
const c = a.flatMap(Fe);
|
|
1286
1430
|
if (s) {
|
|
1287
|
-
const d =
|
|
1431
|
+
const d = se(c);
|
|
1288
1432
|
d && t(d);
|
|
1289
1433
|
}
|
|
1290
|
-
const
|
|
1291
|
-
return
|
|
1292
|
-
},
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1295
|
-
const d = o(s ?
|
|
1434
|
+
const u = o(...c);
|
|
1435
|
+
return u instanceof Error ? t(u) : u;
|
|
1436
|
+
}, i = (o, { toText: s = !1 } = {}) => (a) => {
|
|
1437
|
+
const c = K(a), u = se([c]);
|
|
1438
|
+
u && t(u);
|
|
1439
|
+
const d = o(s ? ue(c) : c);
|
|
1296
1440
|
return d instanceof Error ? t(d) : d;
|
|
1297
1441
|
};
|
|
1298
1442
|
return {
|
|
1299
1443
|
// valueIfTrue/valueIfFalse are passed through unretrieved (not
|
|
1300
1444
|
// dereferenced or type-checked here) — that's what makes
|
|
1301
1445
|
// `IF(FALSE, B100, 99)` a genuine short-circuit rather than a lookup.
|
|
1302
|
-
IF: (o, s,
|
|
1303
|
-
const
|
|
1304
|
-
if (
|
|
1305
|
-
return
|
|
1446
|
+
IF: (o, s, a, c) => {
|
|
1447
|
+
const u = to(s, o, r);
|
|
1448
|
+
if (a == null) throw r.NA;
|
|
1449
|
+
return u ? a : c ?? !1;
|
|
1306
1450
|
},
|
|
1307
1451
|
// Empty input -> 0, matching both the hand-rolled engine this replaces
|
|
1308
1452
|
// and formulajs's own convention for MAX/MIN.
|
|
@@ -1317,28 +1461,28 @@ function Wn(e, r) {
|
|
|
1317
1461
|
// the other aggregates use.
|
|
1318
1462
|
COUNTA: n(e.COUNTA, { checkArgsForErrors: !1 }),
|
|
1319
1463
|
LARGE: (o, s) => {
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
const d = e.LARGE(
|
|
1464
|
+
const a = Fe(o), c = K(s), u = se([...a, c]);
|
|
1465
|
+
u && t(u);
|
|
1466
|
+
const d = e.LARGE(a, c);
|
|
1323
1467
|
return d instanceof Error ? t(d) : d;
|
|
1324
1468
|
},
|
|
1325
1469
|
SMALL: (o, s) => {
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
const d = e.SMALL(
|
|
1470
|
+
const a = Fe(o), c = K(s), u = se([...a, c]);
|
|
1471
|
+
u && t(u);
|
|
1472
|
+
const d = e.SMALL(a, c);
|
|
1329
1473
|
return d instanceof Error ? t(d) : d;
|
|
1330
1474
|
},
|
|
1331
1475
|
PERMUT: (o, s) => {
|
|
1332
|
-
const
|
|
1333
|
-
|
|
1334
|
-
const
|
|
1335
|
-
return
|
|
1476
|
+
const a = [K(o), K(s)], c = se(a);
|
|
1477
|
+
c && t(c);
|
|
1478
|
+
const u = e.PERMUT(a[0], a[1]);
|
|
1479
|
+
return u instanceof Error ? t(u) : u;
|
|
1336
1480
|
},
|
|
1337
1481
|
PERMUTATIONA: (o, s) => {
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1341
|
-
return
|
|
1482
|
+
const a = [K(o), K(s)], c = se(a);
|
|
1483
|
+
c && t(c);
|
|
1484
|
+
const u = e.PERMUTATIONA(a[0], a[1]);
|
|
1485
|
+
return u instanceof Error ? t(u) : u;
|
|
1342
1486
|
},
|
|
1343
1487
|
// match_type is intentionally ignored and forced to 0 (exact match)
|
|
1344
1488
|
// regardless of what the formula author supplied — approximate/sorted
|
|
@@ -1347,41 +1491,41 @@ function Wn(e, r) {
|
|
|
1347
1491
|
// real-world data. Same scope decision as the hand-rolled engine this
|
|
1348
1492
|
// replaces, carried forward deliberately rather than dropped.
|
|
1349
1493
|
MATCH: (o, s) => {
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
const d = e.MATCH(
|
|
1494
|
+
const a = K(o), c = Fe(s), u = se([a, ...c]);
|
|
1495
|
+
u && t(u);
|
|
1496
|
+
const d = e.MATCH(a, c, 0);
|
|
1353
1497
|
return d instanceof Error ? t(d) : d;
|
|
1354
1498
|
},
|
|
1355
1499
|
SWITCH: (...o) => {
|
|
1356
|
-
const s = o.map(
|
|
1357
|
-
|
|
1358
|
-
const
|
|
1359
|
-
return
|
|
1500
|
+
const s = o.map(K), a = se(s);
|
|
1501
|
+
a && t(a);
|
|
1502
|
+
const c = e.SWITCH(...s);
|
|
1503
|
+
return c instanceof Error ? t(c) : c;
|
|
1360
1504
|
},
|
|
1361
|
-
SUBSTITUTE: (o, s,
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
const d =
|
|
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);
|
|
1365
1509
|
d && t(d);
|
|
1366
|
-
const
|
|
1367
|
-
return
|
|
1510
|
+
const y = e.SUBSTITUTE(...u);
|
|
1511
|
+
return y instanceof Error ? t(y) : y;
|
|
1368
1512
|
},
|
|
1369
|
-
TEXTJOIN: (o, s, ...
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1372
|
-
const
|
|
1373
|
-
return
|
|
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);
|
|
1517
|
+
return m instanceof Error ? t(m) : m;
|
|
1374
1518
|
},
|
|
1375
|
-
UPPER:
|
|
1519
|
+
UPPER: i(e.UPPER),
|
|
1376
1520
|
// See DATE_FUNCTIONS_WITH_BROKEN_NATIVE_IMPL above for why these override
|
|
1377
1521
|
// fast-formula-parser's own (real, but broken-for-Date-cells) versions.
|
|
1378
|
-
YEAR:
|
|
1379
|
-
MONTH:
|
|
1380
|
-
DAY:
|
|
1522
|
+
YEAR: i(e.YEAR),
|
|
1523
|
+
MONTH: i(e.MONTH),
|
|
1524
|
+
DAY: i(e.DAY),
|
|
1381
1525
|
WEEKDAY: (o, s) => {
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
const d = e.WEEKDAY(
|
|
1526
|
+
const a = K(o), c = K(s), u = se([a]);
|
|
1527
|
+
u && t(u);
|
|
1528
|
+
const d = e.WEEKDAY(a, c);
|
|
1385
1529
|
return d instanceof Error ? t(d) : d;
|
|
1386
1530
|
},
|
|
1387
1531
|
// See TEXT_FUNCTIONS_BROKEN_FOR_BLANK_CELLS above: these override fast-
|
|
@@ -1394,53 +1538,53 @@ function Wn(e, r) {
|
|
|
1394
1538
|
// separator, matching Excel's own range-argument behavior — the native
|
|
1395
1539
|
// implementation instead inserts stray commas for a whole-range argument.
|
|
1396
1540
|
CONCATENATE: (...o) => {
|
|
1397
|
-
const s = o.flatMap(
|
|
1398
|
-
|
|
1399
|
-
const
|
|
1400
|
-
return
|
|
1541
|
+
const s = o.flatMap(Fe), a = se(s);
|
|
1542
|
+
a && t(a);
|
|
1543
|
+
const c = e.CONCATENATE(...s.map(ue));
|
|
1544
|
+
return c instanceof Error ? t(c) : c;
|
|
1401
1545
|
},
|
|
1402
1546
|
CONCAT: (...o) => {
|
|
1403
|
-
const s = o.flatMap(
|
|
1404
|
-
|
|
1405
|
-
const
|
|
1406
|
-
return
|
|
1547
|
+
const s = o.flatMap(Fe), a = se(s);
|
|
1548
|
+
a && t(a);
|
|
1549
|
+
const c = e.CONCAT(...s.map(ue));
|
|
1550
|
+
return c instanceof Error ? t(c) : c;
|
|
1407
1551
|
},
|
|
1408
|
-
LEN:
|
|
1409
|
-
TRIM:
|
|
1410
|
-
LOWER:
|
|
1552
|
+
LEN: i(e.LEN, { toText: !0 }),
|
|
1553
|
+
TRIM: i(e.TRIM, { toText: !0 }),
|
|
1554
|
+
LOWER: i(e.LOWER, { toText: !0 }),
|
|
1411
1555
|
LEFT: (o, s) => {
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
const d = e.LEFT(
|
|
1556
|
+
const a = K(o), c = tt(s), u = se([a]);
|
|
1557
|
+
u && t(u);
|
|
1558
|
+
const d = e.LEFT(ue(a), c);
|
|
1415
1559
|
return d instanceof Error ? t(d) : d;
|
|
1416
1560
|
},
|
|
1417
1561
|
RIGHT: (o, s) => {
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
const d = e.RIGHT(
|
|
1562
|
+
const a = K(o), c = tt(s), u = se([a]);
|
|
1563
|
+
u && t(u);
|
|
1564
|
+
const d = e.RIGHT(ue(a), c);
|
|
1421
1565
|
return d instanceof Error ? t(d) : d;
|
|
1422
1566
|
},
|
|
1423
|
-
MID: (o, s,
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
const
|
|
1427
|
-
return
|
|
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;
|
|
1428
1572
|
},
|
|
1429
|
-
FIND: (o, s,
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1432
|
-
const
|
|
1433
|
-
return
|
|
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;
|
|
1434
1578
|
},
|
|
1435
|
-
SEARCH: (o, s,
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
const
|
|
1439
|
-
return
|
|
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;
|
|
1440
1584
|
}
|
|
1441
1585
|
};
|
|
1442
1586
|
}
|
|
1443
|
-
const
|
|
1587
|
+
const oo = {
|
|
1444
1588
|
"#REF!": "REF",
|
|
1445
1589
|
"#VALUE!": "VALUE",
|
|
1446
1590
|
"#DIV/0!": "DIV0",
|
|
@@ -1449,100 +1593,100 @@ const Bn = {
|
|
|
1449
1593
|
"#NUM!": "NUM",
|
|
1450
1594
|
"#NULL!": "NULL"
|
|
1451
1595
|
};
|
|
1452
|
-
function
|
|
1453
|
-
return
|
|
1596
|
+
function St(e) {
|
|
1597
|
+
return oo[e.error] ?? "ERROR";
|
|
1454
1598
|
}
|
|
1455
|
-
function
|
|
1456
|
-
if (e instanceof
|
|
1599
|
+
function Ot(e, r) {
|
|
1600
|
+
if (e instanceof de) return e;
|
|
1457
1601
|
if (e instanceof r) {
|
|
1458
1602
|
const t = e.details;
|
|
1459
|
-
return t instanceof
|
|
1603
|
+
return t instanceof de ? t : t instanceof r ? new de(St(t), t.message) : new de(St(e), e.message);
|
|
1460
1604
|
}
|
|
1461
|
-
return new
|
|
1605
|
+
return new de("ERROR", e instanceof Error ? e.message : void 0);
|
|
1462
1606
|
}
|
|
1463
|
-
function
|
|
1607
|
+
function io(e) {
|
|
1464
1608
|
return Math.max(0, ...e.map((r) => (r == null ? void 0 : r.length) ?? 0));
|
|
1465
1609
|
}
|
|
1466
|
-
function
|
|
1610
|
+
function so(e) {
|
|
1467
1611
|
return (r) => {
|
|
1468
1612
|
const t = e[r.row - 1];
|
|
1469
1613
|
if (r.row < 1 || r.col < 1 || t == null || r.col - 1 >= t.length)
|
|
1470
|
-
throw new
|
|
1614
|
+
throw new de("REF");
|
|
1471
1615
|
const n = t[r.col - 1];
|
|
1472
1616
|
return n == null || n === "" ? null : n;
|
|
1473
1617
|
};
|
|
1474
1618
|
}
|
|
1475
|
-
function
|
|
1619
|
+
function lo(e) {
|
|
1476
1620
|
return (r) => {
|
|
1477
|
-
const t = Math.min(r.from.row, r.to.row), n = Math.min(r.from.col, r.to.col),
|
|
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);
|
|
1478
1622
|
if (t > e.length || n > s)
|
|
1479
|
-
throw new
|
|
1480
|
-
const
|
|
1481
|
-
for (let
|
|
1482
|
-
const d = e[
|
|
1623
|
+
throw new de("REF");
|
|
1624
|
+
const a = Math.min(i, e.length), c = [];
|
|
1625
|
+
for (let u = t; u <= a; u++) {
|
|
1626
|
+
const d = e[u - 1], y = [];
|
|
1483
1627
|
if (d != null) {
|
|
1484
|
-
const
|
|
1485
|
-
for (let
|
|
1486
|
-
const
|
|
1487
|
-
|
|
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);
|
|
1488
1632
|
}
|
|
1489
1633
|
}
|
|
1490
|
-
|
|
1634
|
+
c.push(y);
|
|
1491
1635
|
}
|
|
1492
|
-
return
|
|
1636
|
+
return c;
|
|
1493
1637
|
};
|
|
1494
1638
|
}
|
|
1495
|
-
function
|
|
1639
|
+
function co(e) {
|
|
1496
1640
|
if (e == null || e === "") return null;
|
|
1497
1641
|
if (typeof e == "number" || typeof e == "string" || typeof e == "boolean" || e instanceof Date)
|
|
1498
1642
|
return e;
|
|
1499
|
-
throw new
|
|
1643
|
+
throw new de("VALUE");
|
|
1500
1644
|
}
|
|
1501
|
-
async function
|
|
1502
|
-
if (typeof e != "string") throw new
|
|
1645
|
+
async function rr(e, r) {
|
|
1646
|
+
if (typeof e != "string") throw new de("ERROR");
|
|
1503
1647
|
const t = e.trim();
|
|
1504
|
-
if (t === "") throw new
|
|
1648
|
+
if (t === "") throw new de("ERROR");
|
|
1505
1649
|
const n = t.startsWith("=") ? t.slice(1) : t;
|
|
1506
|
-
|
|
1507
|
-
const [
|
|
1650
|
+
eo(n);
|
|
1651
|
+
const [i, o] = await Promise.all([
|
|
1508
1652
|
import("fast-formula-parser"),
|
|
1509
1653
|
import("@formulajs/formulajs")
|
|
1510
|
-
]), s =
|
|
1654
|
+
]), s = i.default ?? i, a = s.FormulaError, c = new s({
|
|
1511
1655
|
...r,
|
|
1512
1656
|
// 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.
|
|
1513
|
-
functions:
|
|
1657
|
+
functions: no(o, a)
|
|
1514
1658
|
});
|
|
1515
|
-
let
|
|
1659
|
+
let u;
|
|
1516
1660
|
try {
|
|
1517
|
-
|
|
1661
|
+
u = c.parse(n, { row: 1, col: 1, sheet: "Sheet1" });
|
|
1518
1662
|
} catch (d) {
|
|
1519
|
-
throw
|
|
1663
|
+
throw Ot(d, a);
|
|
1520
1664
|
}
|
|
1521
|
-
if (
|
|
1522
|
-
throw
|
|
1523
|
-
return
|
|
1665
|
+
if (u instanceof a)
|
|
1666
|
+
throw Ot(u, a);
|
|
1667
|
+
return co(u);
|
|
1524
1668
|
}
|
|
1525
|
-
async function
|
|
1526
|
-
return
|
|
1669
|
+
async function ao(e, r) {
|
|
1670
|
+
return rr(r, { onCell: so(e), onRange: lo(e) });
|
|
1527
1671
|
}
|
|
1528
|
-
const
|
|
1529
|
-
async function
|
|
1672
|
+
const Nt = -1;
|
|
1673
|
+
async function nr(e, r) {
|
|
1530
1674
|
const t = Object.keys(e);
|
|
1531
|
-
return
|
|
1675
|
+
return rr(r, {
|
|
1532
1676
|
onVariable: (n) => {
|
|
1533
|
-
const
|
|
1534
|
-
return
|
|
1677
|
+
const i = t.indexOf(n);
|
|
1678
|
+
return i === -1 ? null : { row: Nt, col: i + 1 };
|
|
1535
1679
|
},
|
|
1536
1680
|
onCell: (n) => {
|
|
1537
|
-
if (n.row ===
|
|
1538
|
-
throw new
|
|
1681
|
+
if (n.row === Nt) return e[t[n.col - 1]] ?? null;
|
|
1682
|
+
throw new de("REF");
|
|
1539
1683
|
},
|
|
1540
1684
|
onRange: () => {
|
|
1541
|
-
throw new
|
|
1685
|
+
throw new de("REF");
|
|
1542
1686
|
}
|
|
1543
1687
|
});
|
|
1544
1688
|
}
|
|
1545
|
-
const
|
|
1689
|
+
const or = {
|
|
1546
1690
|
REF: "#REF!",
|
|
1547
1691
|
VALUE: "#VALUE!",
|
|
1548
1692
|
DIV0: "#DIV/0!",
|
|
@@ -1552,34 +1696,34 @@ const Qt = {
|
|
|
1552
1696
|
NUM: "#NUM!",
|
|
1553
1697
|
NULL: "#NULL!"
|
|
1554
1698
|
};
|
|
1555
|
-
function
|
|
1556
|
-
const r = e instanceof
|
|
1557
|
-
return
|
|
1699
|
+
function gt(e) {
|
|
1700
|
+
const r = e instanceof de ? e.code : "ERROR";
|
|
1701
|
+
return or[r];
|
|
1558
1702
|
}
|
|
1559
|
-
async function
|
|
1703
|
+
async function uo(e, r) {
|
|
1560
1704
|
return e.length === 0 ? r.map((t) => ({
|
|
1561
1705
|
id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
|
|
1562
1706
|
label: (t == null ? void 0 : t.label) ?? "(unknown)",
|
|
1563
1707
|
value: null,
|
|
1564
|
-
error:
|
|
1708
|
+
error: or.ERROR
|
|
1565
1709
|
})) : Promise.all(
|
|
1566
1710
|
r.map(async (t) => {
|
|
1567
1711
|
try {
|
|
1568
1712
|
if (!t || typeof t.label != "string" || typeof t.expression != "string" || typeof t.id != "string")
|
|
1569
|
-
throw new
|
|
1570
|
-
return { id: t.id, label: t.label, value: await
|
|
1713
|
+
throw new de("ERROR");
|
|
1714
|
+
return { id: t.id, label: t.label, value: await ao(e, t.expression) };
|
|
1571
1715
|
} catch (n) {
|
|
1572
1716
|
return {
|
|
1573
1717
|
id: typeof (t == null ? void 0 : t.id) == "string" ? t.id : "(unknown)",
|
|
1574
1718
|
label: (t == null ? void 0 : t.label) ?? "(unknown)",
|
|
1575
1719
|
value: null,
|
|
1576
|
-
error:
|
|
1720
|
+
error: gt(n)
|
|
1577
1721
|
};
|
|
1578
1722
|
}
|
|
1579
1723
|
})
|
|
1580
1724
|
);
|
|
1581
1725
|
}
|
|
1582
|
-
function
|
|
1726
|
+
function Dt(e) {
|
|
1583
1727
|
const r = /* @__PURE__ */ new Set();
|
|
1584
1728
|
for (const { id: t } of e) {
|
|
1585
1729
|
if (r.has(t)) return t;
|
|
@@ -1587,99 +1731,99 @@ function Rt(e) {
|
|
|
1587
1731
|
}
|
|
1588
1732
|
return null;
|
|
1589
1733
|
}
|
|
1590
|
-
function
|
|
1591
|
-
const { columnHeader: r, rowHeader: t, columns: n, rows:
|
|
1734
|
+
function ir(e) {
|
|
1735
|
+
const { columnHeader: r, rowHeader: t, columns: n, rows: i } = e;
|
|
1592
1736
|
if (n !== void 0 && !Array.isArray(n))
|
|
1593
1737
|
return "columns must be an array of { id, label } objects.";
|
|
1594
|
-
if (
|
|
1738
|
+
if (i !== void 0 && !Array.isArray(i))
|
|
1595
1739
|
return "rows must be an array of { id, label } objects.";
|
|
1596
1740
|
if (n !== void 0 && n.length === 0)
|
|
1597
1741
|
return "columns is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
|
|
1598
|
-
if (
|
|
1742
|
+
if (i !== void 0 && i.length === 0)
|
|
1599
1743
|
return "rows is declared but empty — declare at least one field, or omit it entirely for raw matrix mode.";
|
|
1600
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));
|
|
1601
1745
|
if (s != null && s !== -1)
|
|
1602
1746
|
return `columns[${s}] must be a { id, label } object with non-empty string fields.`;
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
return `rows[${
|
|
1606
|
-
const
|
|
1607
|
-
if (
|
|
1608
|
-
const d =
|
|
1747
|
+
const a = i == null ? void 0 : i.findIndex((d) => !o(d));
|
|
1748
|
+
if (a != null && a !== -1)
|
|
1749
|
+
return `rows[${a}] must be a { id, label } object with non-empty string fields.`;
|
|
1750
|
+
const c = !!n && n.length > 0, u = !!i && i.length > 0;
|
|
1751
|
+
if (c) {
|
|
1752
|
+
const d = Dt(n);
|
|
1609
1753
|
if (d) return `duplicate column id "${d}" — every declared column id must be unique.`;
|
|
1610
1754
|
}
|
|
1611
|
-
if (
|
|
1612
|
-
const d =
|
|
1755
|
+
if (u) {
|
|
1756
|
+
const d = Dt(i);
|
|
1613
1757
|
if (d) return `duplicate row id "${d}" — every declared row id must be unique.`;
|
|
1614
1758
|
}
|
|
1615
|
-
return r && t ? "columnHeader and rowHeader cannot both be true — pick one orientation for the persisted sheet shape." :
|
|
1759
|
+
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;
|
|
1616
1760
|
}
|
|
1617
|
-
function
|
|
1618
|
-
const t =
|
|
1761
|
+
function It(e, r = {}) {
|
|
1762
|
+
const t = ir(r);
|
|
1619
1763
|
if (t) throw new Error(`x-spreadsheet: ${t}`);
|
|
1620
|
-
const { columnHeader: n, rowHeader:
|
|
1621
|
-
return o && o.length > 0 ?
|
|
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;
|
|
1622
1766
|
}
|
|
1623
|
-
function
|
|
1624
|
-
return (t ? e.slice(1) : e).map((
|
|
1767
|
+
function fo(e, r, t) {
|
|
1768
|
+
return (t ? e.slice(1) : e).map((i) => {
|
|
1625
1769
|
const o = /* @__PURE__ */ Object.create(null);
|
|
1626
|
-
return r.forEach((s,
|
|
1627
|
-
o[s.id] =
|
|
1770
|
+
return r.forEach((s, a) => {
|
|
1771
|
+
o[s.id] = i[a] ?? null;
|
|
1628
1772
|
}), o;
|
|
1629
1773
|
});
|
|
1630
1774
|
}
|
|
1631
|
-
function
|
|
1632
|
-
const n = t ? 1 : 0,
|
|
1633
|
-
return Array.from({ length: o }, (s,
|
|
1634
|
-
const
|
|
1635
|
-
return r.forEach((d,
|
|
1636
|
-
var
|
|
1637
|
-
|
|
1638
|
-
}),
|
|
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) => {
|
|
1778
|
+
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;
|
|
1782
|
+
}), u;
|
|
1639
1783
|
});
|
|
1640
1784
|
}
|
|
1641
|
-
function
|
|
1785
|
+
function sr(e) {
|
|
1642
1786
|
return !Array.isArray(e[0]);
|
|
1643
1787
|
}
|
|
1644
|
-
function
|
|
1788
|
+
function ho(e) {
|
|
1645
1789
|
const r = /* @__PURE__ */ Object.create(null);
|
|
1646
|
-
for (const { id: t, label: n, value:
|
|
1647
|
-
r[t] = o === void 0 ? { label: n, value:
|
|
1790
|
+
for (const { id: t, label: n, value: i, error: o } of e)
|
|
1791
|
+
r[t] = o === void 0 ? { label: n, value: i } : { label: n, value: i, error: o };
|
|
1648
1792
|
return r;
|
|
1649
1793
|
}
|
|
1650
|
-
function
|
|
1794
|
+
function ut(e, r) {
|
|
1651
1795
|
const t = (n) => n instanceof Date ? n.toISOString() : n ?? null;
|
|
1652
1796
|
return t(e) === t(r);
|
|
1653
1797
|
}
|
|
1654
|
-
function
|
|
1655
|
-
const t = e ?? {}, n = r ?? {},
|
|
1656
|
-
return
|
|
1798
|
+
function mo(e, r) {
|
|
1799
|
+
const t = e ?? {}, n = r ?? {}, i = Object.keys(t);
|
|
1800
|
+
return i.length !== Object.keys(n).length ? !1 : i.every((o) => {
|
|
1657
1801
|
if (!Object.prototype.hasOwnProperty.call(n, o)) return !1;
|
|
1658
|
-
const s = t[o],
|
|
1659
|
-
return s.label ===
|
|
1802
|
+
const s = t[o], a = n[o];
|
|
1803
|
+
return s.label === a.label && s.error === a.error && ut(s.value, a.value);
|
|
1660
1804
|
});
|
|
1661
1805
|
}
|
|
1662
|
-
function
|
|
1806
|
+
function go(e, r) {
|
|
1663
1807
|
if (e == null || r == null) return e === r;
|
|
1664
1808
|
const t = Array.isArray(e);
|
|
1665
1809
|
if (t !== Array.isArray(r)) return !1;
|
|
1666
1810
|
if (t) {
|
|
1667
|
-
const s = e,
|
|
1668
|
-
return s.length ===
|
|
1811
|
+
const s = e, a = r;
|
|
1812
|
+
return s.length === a.length && s.every((c, u) => ut(c, a[u]));
|
|
1669
1813
|
}
|
|
1670
|
-
const n = e,
|
|
1671
|
-
return o.length !== Object.keys(
|
|
1814
|
+
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]));
|
|
1672
1816
|
}
|
|
1673
|
-
function
|
|
1817
|
+
function yo(e, r) {
|
|
1674
1818
|
if (e === r) return !0;
|
|
1675
1819
|
if (e == null || r == null) return !1;
|
|
1676
1820
|
const t = e, n = r;
|
|
1677
|
-
return t.length !== n.length ? !1 : t.every((
|
|
1821
|
+
return t.length !== n.length ? !1 : t.every((i, o) => go(i, n[o]));
|
|
1678
1822
|
}
|
|
1679
|
-
function
|
|
1823
|
+
function bo(e) {
|
|
1680
1824
|
return e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e instanceof Date;
|
|
1681
1825
|
}
|
|
1682
|
-
function
|
|
1826
|
+
function lr(e, r) {
|
|
1683
1827
|
if (e.length === 0) return [];
|
|
1684
1828
|
const t = [], n = /* @__PURE__ */ new Set();
|
|
1685
1829
|
for (const o of r ?? [])
|
|
@@ -1688,58 +1832,58 @@ function rr(e, r) {
|
|
|
1688
1832
|
for (const s of Object.keys(o))
|
|
1689
1833
|
n.has(s) || (n.add(s), t.push(s));
|
|
1690
1834
|
if (t.length === 0) return [];
|
|
1691
|
-
const
|
|
1835
|
+
const i = e.map(
|
|
1692
1836
|
(o) => t.map((s) => {
|
|
1693
1837
|
if (!Object.prototype.hasOwnProperty.call(o, s)) return null;
|
|
1694
|
-
const
|
|
1695
|
-
return
|
|
1838
|
+
const a = o[s];
|
|
1839
|
+
return bo(a) ? a : null;
|
|
1696
1840
|
})
|
|
1697
1841
|
);
|
|
1698
|
-
return [t, ...
|
|
1842
|
+
return [t, ...i];
|
|
1699
1843
|
}
|
|
1700
|
-
function
|
|
1844
|
+
function vo(e) {
|
|
1701
1845
|
const r = Math.max(0, ...e.map((t) => t.length));
|
|
1702
|
-
return Array.from({ length: r }, (t, n) => e.map((
|
|
1846
|
+
return Array.from({ length: r }, (t, n) => e.map((i) => i[n] ?? null));
|
|
1703
1847
|
}
|
|
1704
|
-
const
|
|
1705
|
-
function
|
|
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) {
|
|
1706
1850
|
return e == null || e === "" ? "" : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
1707
1851
|
}
|
|
1708
|
-
const
|
|
1852
|
+
const Ao = ({
|
|
1709
1853
|
data: e,
|
|
1710
1854
|
handleChange: r,
|
|
1711
1855
|
path: t,
|
|
1712
1856
|
label: n,
|
|
1713
|
-
required:
|
|
1857
|
+
required: i,
|
|
1714
1858
|
schema: o,
|
|
1715
1859
|
enabled: s,
|
|
1716
|
-
readonly:
|
|
1717
|
-
errors:
|
|
1718
|
-
visible:
|
|
1860
|
+
readonly: a,
|
|
1861
|
+
errors: c,
|
|
1862
|
+
visible: u = !0
|
|
1719
1863
|
}) => {
|
|
1720
|
-
|
|
1721
|
-
const d = !
|
|
1722
|
-
() =>
|
|
1723
|
-
), [
|
|
1724
|
-
(
|
|
1725
|
-
if (!
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1728
|
-
|
|
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)
|
|
1729
1873
|
);
|
|
1730
|
-
return
|
|
1874
|
+
return b ? vo(ce) : ce;
|
|
1731
1875
|
},
|
|
1732
|
-
[
|
|
1733
|
-
),
|
|
1734
|
-
const
|
|
1735
|
-
|
|
1736
|
-
Math.max(0, ...
|
|
1737
|
-
),
|
|
1738
|
-
return /* @__PURE__ */
|
|
1739
|
-
/* @__PURE__ */
|
|
1740
|
-
!
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
|
|
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) => {
|
|
1743
1887
|
var E;
|
|
1744
1888
|
return (
|
|
1745
1889
|
// This row only renders when hasRows isn't the sole
|
|
@@ -1748,227 +1892,227 @@ const uo = ({
|
|
|
1748
1892
|
// looked up positionally — never read from the matrix
|
|
1749
1893
|
// cell itself, which only ever holds the id) or both
|
|
1750
1894
|
// are false (columnLetter fallback).
|
|
1751
|
-
/* @__PURE__ */
|
|
1895
|
+
/* @__PURE__ */ l(De.ColumnHeaderCell, { children: v ? ((E = A == null ? void 0 : A[Ee]) == null ? void 0 : E.label) ?? "" : Xn(Ee) }, Ee)
|
|
1752
1896
|
);
|
|
1753
1897
|
})
|
|
1754
1898
|
] }) }),
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
var
|
|
1757
|
-
const
|
|
1758
|
-
return /* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
-
|
|
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,
|
|
1761
1905
|
{
|
|
1762
|
-
style:
|
|
1763
|
-
children:
|
|
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
|
|
1764
1908
|
}
|
|
1765
1909
|
),
|
|
1766
|
-
|
|
1910
|
+
ke.map((Te) => /* @__PURE__ */ l(De.Cell, { children: kt(Ee[Te]) }, Te))
|
|
1767
1911
|
] }, E);
|
|
1768
1912
|
}) })
|
|
1769
1913
|
] }) }),
|
|
1770
|
-
|
|
1914
|
+
ce.length > lt && /* @__PURE__ */ g(p, { size: "1", color: "gray", mt: "1", style: { display: "block" }, children: [
|
|
1771
1915
|
"Showing first ",
|
|
1772
|
-
|
|
1916
|
+
lt,
|
|
1773
1917
|
" of ",
|
|
1774
|
-
|
|
1918
|
+
ce.length,
|
|
1775
1919
|
" rows"
|
|
1776
1920
|
] })
|
|
1777
1921
|
] }) });
|
|
1778
|
-
}, [
|
|
1779
|
-
async (
|
|
1780
|
-
if (
|
|
1781
|
-
|
|
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.`);
|
|
1782
1926
|
return;
|
|
1783
1927
|
}
|
|
1784
|
-
if (!
|
|
1785
|
-
|
|
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)}`);
|
|
1786
1930
|
return;
|
|
1787
1931
|
}
|
|
1788
|
-
|
|
1789
|
-
let
|
|
1932
|
+
Y("parsing");
|
|
1933
|
+
let q;
|
|
1790
1934
|
try {
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
} catch (
|
|
1794
|
-
|
|
1795
|
-
|
|
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."
|
|
1796
1940
|
);
|
|
1797
1941
|
return;
|
|
1798
1942
|
}
|
|
1799
|
-
if (
|
|
1943
|
+
if (v || b)
|
|
1800
1944
|
try {
|
|
1801
|
-
|
|
1802
|
-
} catch (
|
|
1803
|
-
|
|
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.");
|
|
1804
1948
|
return;
|
|
1805
1949
|
}
|
|
1806
|
-
|
|
1950
|
+
J.current = (e == null ? void 0 : e.sheet) ?? null, te(q), Y("ready");
|
|
1807
1951
|
},
|
|
1808
|
-
[
|
|
1952
|
+
[w, L, O, e, D, N, A, R, v, b, F]
|
|
1809
1953
|
);
|
|
1810
|
-
if (
|
|
1811
|
-
|
|
1812
|
-
}, [
|
|
1813
|
-
if (
|
|
1814
|
-
let
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
},
|
|
1818
|
-
if (
|
|
1819
|
-
|
|
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);
|
|
1820
1964
|
return;
|
|
1821
1965
|
}
|
|
1822
|
-
return
|
|
1823
|
-
if (
|
|
1824
|
-
let
|
|
1825
|
-
if (
|
|
1826
|
-
if (
|
|
1966
|
+
return uo(ce, T).then((q) => {
|
|
1967
|
+
if (S) return;
|
|
1968
|
+
let H;
|
|
1969
|
+
if (oe != null) {
|
|
1970
|
+
if (j)
|
|
1827
1971
|
try {
|
|
1828
|
-
|
|
1829
|
-
} catch (
|
|
1830
|
-
|
|
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.");
|
|
1831
1975
|
return;
|
|
1832
1976
|
}
|
|
1833
1977
|
} else
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
const
|
|
1837
|
-
|
|
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 });
|
|
1838
1982
|
}), () => {
|
|
1839
|
-
|
|
1983
|
+
S = !0;
|
|
1840
1984
|
};
|
|
1841
|
-
}, [
|
|
1985
|
+
}, [Z, oe, T, m, j, v, b, A, R, U]), u === !1)
|
|
1842
1986
|
return null;
|
|
1843
|
-
if (
|
|
1844
|
-
return /* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
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: [
|
|
1847
1991
|
"Invalid x-spreadsheet config: ",
|
|
1848
|
-
|
|
1992
|
+
U
|
|
1849
1993
|
] })
|
|
1850
1994
|
] });
|
|
1851
|
-
if (!
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1854
|
-
},
|
|
1855
|
-
var
|
|
1856
|
-
|
|
1857
|
-
},
|
|
1858
|
-
var
|
|
1859
|
-
(
|
|
1860
|
-
},
|
|
1861
|
-
|
|
1862
|
-
},
|
|
1863
|
-
return /* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1866
|
-
/* @__PURE__ */
|
|
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: [
|
|
1867
2011
|
n,
|
|
1868
|
-
|
|
2012
|
+
d && /* @__PURE__ */ l(p, { color: "red", children: " *" })
|
|
1869
2013
|
] }),
|
|
1870
|
-
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
|
|
2014
|
+
ye && m && /* @__PURE__ */ g(xe, { children: [
|
|
2015
|
+
/* @__PURE__ */ l(Ke, { content: "Replace spreadsheet", children: /* @__PURE__ */ l(
|
|
2016
|
+
Xe,
|
|
1873
2017
|
{
|
|
1874
2018
|
variant: "ghost",
|
|
1875
2019
|
size: "1",
|
|
1876
2020
|
onClick: () => {
|
|
1877
|
-
var
|
|
1878
|
-
return (
|
|
2021
|
+
var S;
|
|
2022
|
+
return (S = C.current) == null ? void 0 : S.click();
|
|
1879
2023
|
},
|
|
1880
2024
|
"aria-label": "Replace spreadsheet",
|
|
1881
|
-
children: /* @__PURE__ */
|
|
2025
|
+
children: /* @__PURE__ */ l(je, {})
|
|
1882
2026
|
}
|
|
1883
2027
|
) }),
|
|
1884
|
-
/* @__PURE__ */
|
|
1885
|
-
|
|
2028
|
+
/* @__PURE__ */ l(Ke, { content: "Remove spreadsheet", children: /* @__PURE__ */ l(
|
|
2029
|
+
Xe,
|
|
1886
2030
|
{
|
|
1887
2031
|
variant: "ghost",
|
|
1888
2032
|
size: "1",
|
|
1889
2033
|
color: "gray",
|
|
1890
|
-
onClick:
|
|
2034
|
+
onClick: X,
|
|
1891
2035
|
"aria-label": "Remove spreadsheet",
|
|
1892
|
-
children: /* @__PURE__ */
|
|
2036
|
+
children: /* @__PURE__ */ l(ft, {})
|
|
1893
2037
|
}
|
|
1894
2038
|
) })
|
|
1895
2039
|
] })
|
|
1896
2040
|
] }),
|
|
1897
|
-
/* @__PURE__ */
|
|
1898
|
-
|
|
2041
|
+
/* @__PURE__ */ g(p, { size: "1", color: "gray", children: [
|
|
2042
|
+
Ce(L),
|
|
1899
2043
|
" max · ",
|
|
1900
|
-
|
|
2044
|
+
Se(w)
|
|
1901
2045
|
] })
|
|
1902
2046
|
] }),
|
|
1903
|
-
|
|
1904
|
-
/* @__PURE__ */
|
|
1905
|
-
|
|
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(
|
|
1906
2050
|
"div",
|
|
1907
2051
|
{
|
|
1908
2052
|
role: "button",
|
|
1909
2053
|
tabIndex: 0,
|
|
1910
2054
|
onClick: () => {
|
|
1911
|
-
var
|
|
1912
|
-
return (
|
|
2055
|
+
var S;
|
|
2056
|
+
return (S = C.current) == null ? void 0 : S.click();
|
|
1913
2057
|
},
|
|
1914
|
-
onKeyDown: (
|
|
1915
|
-
var
|
|
1916
|
-
(
|
|
2058
|
+
onKeyDown: (S) => {
|
|
2059
|
+
var W;
|
|
2060
|
+
(S.key === "Enter" || S.key === " ") && (S.preventDefault(), (W = C.current) == null || W.click());
|
|
1917
2061
|
},
|
|
1918
|
-
onDragEnter:
|
|
1919
|
-
onDragLeave:
|
|
1920
|
-
onDragOver:
|
|
1921
|
-
onDrop:
|
|
2062
|
+
onDragEnter: x,
|
|
2063
|
+
onDragLeave: x,
|
|
2064
|
+
onDragOver: x,
|
|
2065
|
+
onDrop: V,
|
|
1922
2066
|
style: { cursor: "pointer" },
|
|
1923
2067
|
className: [
|
|
1924
2068
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
1925
2069
|
"transition-all duration-200 ease-in-out",
|
|
1926
|
-
|
|
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"
|
|
1927
2071
|
].join(" "),
|
|
1928
|
-
children: /* @__PURE__ */
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
] }) :
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
1934
|
-
/* @__PURE__ */
|
|
1935
|
-
] }) : /* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
1937
|
-
/* @__PURE__ */
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
|
|
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),
|
|
1940
2084
|
" max · ",
|
|
1941
|
-
|
|
2085
|
+
Se(w)
|
|
1942
2086
|
] })
|
|
1943
2087
|
] }) })
|
|
1944
2088
|
}
|
|
1945
2089
|
),
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
Object.keys(
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
/* @__PURE__ */
|
|
1951
|
-
/* @__PURE__ */
|
|
1952
|
-
|
|
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 }) : (
|
|
1953
2097
|
// d.value is CellValue | null now (SUM/AVERAGE aren't the only
|
|
1954
2098
|
// possible results anymore — INDEX/CONCATENATE can return a
|
|
1955
2099
|
// string, a bare comparison can return a boolean, etc.), so
|
|
1956
2100
|
// `.toLocaleString()` would throw for e.g. a boolean result.
|
|
1957
2101
|
// Reuse the same formatCell used for the sheet-preview grid.
|
|
1958
|
-
/* @__PURE__ */
|
|
2102
|
+
/* @__PURE__ */ l(p, { size: "2", children: kt(W.value) })
|
|
1959
2103
|
)
|
|
1960
|
-
] },
|
|
2104
|
+
] }, S)) })
|
|
1961
2105
|
] }),
|
|
1962
|
-
!
|
|
2106
|
+
!y && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Re(c, n) })
|
|
1963
2107
|
] });
|
|
1964
|
-
},
|
|
2108
|
+
}, Ro = be(Ao), Co = ie(
|
|
1965
2109
|
10,
|
|
1966
2110
|
// matches FileControlTester's rank — beats the default object/Group renderer
|
|
1967
|
-
|
|
2111
|
+
ze(
|
|
1968
2112
|
(e) => e.type === "object" && typeof e["x-spreadsheet"] == "object"
|
|
1969
2113
|
)
|
|
1970
|
-
),
|
|
1971
|
-
function
|
|
2114
|
+
), So = "Sheet1", Oo = "xlsx";
|
|
2115
|
+
function No(e) {
|
|
1972
2116
|
if (e === void 0) return null;
|
|
1973
2117
|
if (!Array.isArray(e)) return "columns must be an array of { id, label } objects.";
|
|
1974
2118
|
if (e.length === 0)
|
|
@@ -1978,64 +2122,64 @@ function go(e) {
|
|
|
1978
2122
|
);
|
|
1979
2123
|
return r !== -1 ? `columns[${r}] must be a { id, label } object with non-empty string fields.` : null;
|
|
1980
2124
|
}
|
|
1981
|
-
function
|
|
1982
|
-
if (!
|
|
1983
|
-
const t =
|
|
2125
|
+
function Do(e, r) {
|
|
2126
|
+
if (!sr(e)) return e;
|
|
2127
|
+
const t = lr(
|
|
1984
2128
|
e,
|
|
1985
2129
|
r == null ? void 0 : r.map((s) => s.id)
|
|
1986
2130
|
);
|
|
1987
2131
|
if (!r || t.length === 0) return t;
|
|
1988
|
-
const n = new Map(r.map((s) => [s.id, s.label])), [
|
|
1989
|
-
return [
|
|
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];
|
|
1990
2134
|
}
|
|
1991
|
-
const
|
|
1992
|
-
const [o, s] =
|
|
1993
|
-
if (
|
|
2135
|
+
const Io = ({ data: e, path: r, label: t, schema: n, visible: i = !0 }) => {
|
|
2136
|
+
const [o, s] = B(null), a = $e();
|
|
2137
|
+
if (i === !1)
|
|
1994
2138
|
return null;
|
|
1995
|
-
const
|
|
1996
|
-
if (
|
|
1997
|
-
return /* @__PURE__ */
|
|
1998
|
-
/* @__PURE__ */
|
|
1999
|
-
/* @__PURE__ */
|
|
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: [
|
|
2000
2144
|
"Invalid x-spreadsheet-export config: ",
|
|
2001
|
-
|
|
2145
|
+
f
|
|
2002
2146
|
] })
|
|
2003
2147
|
] });
|
|
2004
|
-
const
|
|
2005
|
-
var
|
|
2006
|
-
if (
|
|
2148
|
+
const T = Array.isArray(e) && e.length > 0, w = async () => {
|
|
2149
|
+
var L, D;
|
|
2150
|
+
if (T) {
|
|
2007
2151
|
s(null);
|
|
2008
2152
|
try {
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2013
|
-
} catch (
|
|
2014
|
-
s(
|
|
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.");
|
|
2015
2159
|
}
|
|
2016
2160
|
}
|
|
2017
2161
|
};
|
|
2018
|
-
return /* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
/* @__PURE__ */
|
|
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, {}),
|
|
2022
2166
|
" Download Spreadsheet"
|
|
2023
2167
|
] }),
|
|
2024
|
-
o && /* @__PURE__ */
|
|
2168
|
+
o && /* @__PURE__ */ l(p, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: o })
|
|
2025
2169
|
] });
|
|
2026
|
-
},
|
|
2170
|
+
}, ko = be(Io), Lo = ie(
|
|
2027
2171
|
10,
|
|
2028
|
-
|
|
2029
|
-
|
|
2172
|
+
Wt(
|
|
2173
|
+
ze((e) => {
|
|
2030
2174
|
const r = e["x-spreadsheet-export"];
|
|
2031
2175
|
return e.type === "array" && typeof r == "object" && r !== null;
|
|
2032
2176
|
}),
|
|
2033
|
-
|
|
2177
|
+
Cr(Sr("editable", !0))
|
|
2034
2178
|
)
|
|
2035
2179
|
);
|
|
2036
|
-
class
|
|
2180
|
+
class Le extends Error {
|
|
2037
2181
|
}
|
|
2038
|
-
const
|
|
2182
|
+
const Lt = 5e6, Mo = 1024, zo = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["']/i, Fo = {
|
|
2039
2183
|
// Default is true, which would silently drop what in many formats is most of
|
|
2040
2184
|
// the payload.
|
|
2041
2185
|
ignoreAttributes: !1,
|
|
@@ -2082,7 +2226,7 @@ const Ot = 5e6, Eo = 1024, To = /^<\?xml\s+[^>]*\bencoding\s*=\s*["']([^"']+)["'
|
|
|
2082
2226
|
maxNestedTags: 100,
|
|
2083
2227
|
strictReservedNames: !0
|
|
2084
2228
|
};
|
|
2085
|
-
function
|
|
2229
|
+
function $o(e) {
|
|
2086
2230
|
const r = new Set(e);
|
|
2087
2231
|
return r.size === 0 ? () => !1 : (t, n) => (
|
|
2088
2232
|
// A string while the library's own `jPath` option is true (the default) and
|
|
@@ -2090,120 +2234,120 @@ function Ao(e) {
|
|
|
2090
2234
|
r.has(typeof n == "string" ? n : n.toString()) || r.has(t)
|
|
2091
2235
|
);
|
|
2092
2236
|
}
|
|
2093
|
-
function
|
|
2237
|
+
function Uo(e) {
|
|
2094
2238
|
const r = e instanceof Error ? e.message : "";
|
|
2095
2239
|
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.";
|
|
2096
2240
|
}
|
|
2097
|
-
async function
|
|
2098
|
-
var
|
|
2099
|
-
if (typeof e != "string") throw new
|
|
2241
|
+
async function Po(e, r = {}) {
|
|
2242
|
+
var u;
|
|
2243
|
+
if (typeof e != "string") throw new Le("This file could not be read as text.");
|
|
2100
2244
|
const t = e.charCodeAt(0) === 65279 ? e.slice(1) : e;
|
|
2101
|
-
if (t.trim() === "") throw new
|
|
2102
|
-
if (t.length >
|
|
2103
|
-
throw new
|
|
2104
|
-
`This document is too large to parse (over ${
|
|
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).`
|
|
2105
2249
|
);
|
|
2106
|
-
const n = (
|
|
2250
|
+
const n = (u = zo.exec(t.slice(0, Mo))) == null ? void 0 : u[1];
|
|
2107
2251
|
if (n && !/^utf-?8$/i.test(n))
|
|
2108
|
-
throw new
|
|
2252
|
+
throw new Le(
|
|
2109
2253
|
`This document declares the unsupported encoding "${n}". Only UTF-8 is supported.`
|
|
2110
2254
|
);
|
|
2111
|
-
const { XMLParser:
|
|
2255
|
+
const { XMLParser: i, XMLValidator: o } = await import("fast-xml-parser"), s = o.validate(t, { allowBooleanAttributes: !1 });
|
|
2112
2256
|
if (s !== !0) {
|
|
2113
|
-
const { msg: d, line:
|
|
2114
|
-
throw new
|
|
2257
|
+
const { msg: d, line: y, col: m } = s.err;
|
|
2258
|
+
throw new Le(`Invalid XML at line ${y}, column ${m}: ${d}`);
|
|
2115
2259
|
}
|
|
2116
|
-
const
|
|
2117
|
-
...
|
|
2260
|
+
const a = new i({
|
|
2261
|
+
...Fo,
|
|
2118
2262
|
removeNSPrefix: r.removeNamespaces === !0,
|
|
2119
|
-
isArray:
|
|
2263
|
+
isArray: $o(r.arrayPaths ?? [])
|
|
2120
2264
|
});
|
|
2121
|
-
let
|
|
2265
|
+
let c;
|
|
2122
2266
|
try {
|
|
2123
|
-
|
|
2267
|
+
c = a.parse(t);
|
|
2124
2268
|
} catch (d) {
|
|
2125
|
-
throw new
|
|
2269
|
+
throw new Le(Uo(d));
|
|
2126
2270
|
}
|
|
2127
|
-
if (
|
|
2128
|
-
throw new
|
|
2129
|
-
return
|
|
2271
|
+
if (c == null || typeof c != "object" || Array.isArray(c))
|
|
2272
|
+
throw new Le("This document has no root element.");
|
|
2273
|
+
return c;
|
|
2130
2274
|
}
|
|
2131
|
-
function
|
|
2132
|
-
const { path: n, default:
|
|
2133
|
-
return o ??
|
|
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);
|
|
2277
|
+
return o ?? i;
|
|
2134
2278
|
}
|
|
2135
|
-
function
|
|
2279
|
+
function _o(e, r, t) {
|
|
2136
2280
|
const n = {};
|
|
2137
|
-
for (const [
|
|
2138
|
-
const s =
|
|
2281
|
+
for (const [i, o] of Object.entries(t)) {
|
|
2282
|
+
const s = cr(e, r, o);
|
|
2139
2283
|
if (s === void 0) return;
|
|
2140
|
-
n[
|
|
2284
|
+
n[i] = s;
|
|
2141
2285
|
}
|
|
2142
2286
|
return n;
|
|
2143
2287
|
}
|
|
2144
|
-
async function
|
|
2288
|
+
async function jo(e, r) {
|
|
2145
2289
|
try {
|
|
2146
|
-
return { status: "ok", value: await
|
|
2290
|
+
return { status: "ok", value: await nr(e, r) };
|
|
2147
2291
|
} catch (t) {
|
|
2148
|
-
return { status: "error", error:
|
|
2292
|
+
return { status: "error", error: gt(t) };
|
|
2149
2293
|
}
|
|
2150
2294
|
}
|
|
2151
|
-
function
|
|
2152
|
-
return e == null ? "" : typeof e == "number" ? e.toFixed(
|
|
2295
|
+
function ar(e, r) {
|
|
2296
|
+
return e == null ? "" : typeof e == "number" ? e.toFixed(Vo(r)) : e instanceof Date ? e.toLocaleDateString() : String(e);
|
|
2153
2297
|
}
|
|
2154
|
-
function
|
|
2298
|
+
function Vo(e) {
|
|
2155
2299
|
return Number.isFinite(e) ? Math.min(100, Math.max(0, Math.trunc(e))) : 0;
|
|
2156
2300
|
}
|
|
2157
|
-
const
|
|
2158
|
-
function
|
|
2159
|
-
return e == null || e === "" ?
|
|
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;
|
|
2160
2304
|
}
|
|
2161
|
-
const
|
|
2162
|
-
async function
|
|
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) {
|
|
2163
2307
|
switch (r.as) {
|
|
2164
2308
|
case void 0:
|
|
2165
|
-
return
|
|
2309
|
+
return ve(e);
|
|
2166
2310
|
case "string":
|
|
2167
|
-
return
|
|
2311
|
+
return ve(e instanceof Date ? e.toISOString() : String(e));
|
|
2168
2312
|
case "number": {
|
|
2169
2313
|
const n = e instanceof Date ? e.getTime() : Number(e);
|
|
2170
|
-
return Number.isFinite(n) ?
|
|
2314
|
+
return Number.isFinite(n) ? ve(r.decimals === void 0 ? n : ar(n, r.decimals)) : Me;
|
|
2171
2315
|
}
|
|
2172
2316
|
case "boolean": {
|
|
2173
2317
|
const n = String(e).trim().toLowerCase();
|
|
2174
|
-
return
|
|
2318
|
+
return Wo.has(n) ? ve(!0) : Ho.has(n) ? ve(!1) : Me;
|
|
2175
2319
|
}
|
|
2176
2320
|
case "date": {
|
|
2177
|
-
const { default: n } = await import("dayjs"), { default:
|
|
2178
|
-
if (n.extend(
|
|
2179
|
-
const
|
|
2180
|
-
return
|
|
2321
|
+
const { default: n } = await import("dayjs"), { default: i } = await import("./customParseFormat-D14EWdSX.js").then((a) => a.c);
|
|
2322
|
+
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;
|
|
2181
2325
|
}
|
|
2182
2326
|
const o = e instanceof Date ? e.toISOString() : String(e), s = r.format ? n(o, r.format, !0) : n(o);
|
|
2183
|
-
return s.isValid() ?
|
|
2327
|
+
return s.isValid() ? ve(s.format("YYYY-MM-DD")) : Me;
|
|
2184
2328
|
}
|
|
2185
2329
|
}
|
|
2186
2330
|
}
|
|
2187
|
-
async function
|
|
2331
|
+
async function qo(e, r) {
|
|
2188
2332
|
if (r.formula !== void 0) {
|
|
2189
2333
|
const t = {};
|
|
2190
|
-
for (const [n,
|
|
2191
|
-
const o =
|
|
2192
|
-
if (!o.found || Array.isArray(o.value)) return
|
|
2334
|
+
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;
|
|
2193
2337
|
t[n] = o.value;
|
|
2194
2338
|
}
|
|
2195
2339
|
try {
|
|
2196
|
-
return
|
|
2340
|
+
return ve(await nr(t, r.formula));
|
|
2197
2341
|
} catch (n) {
|
|
2198
|
-
throw new Error(`writeTo "${r.to}": ${
|
|
2342
|
+
throw new Error(`writeTo "${r.to}": ${gt(n)}`);
|
|
2199
2343
|
}
|
|
2200
2344
|
}
|
|
2201
2345
|
if (r.from === void 0) throw new Error(`writeTo "${r.to}" needs either "from" or "formula".`);
|
|
2202
|
-
return
|
|
2346
|
+
return Mt(He.data(e, r.from));
|
|
2203
2347
|
}
|
|
2204
|
-
const
|
|
2205
|
-
function
|
|
2206
|
-
if (typeof e.to != "string" ||
|
|
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.';
|
|
2207
2351
|
if (e.format !== void 0 && e.as !== "date") return '"format" needs "as": "date".';
|
|
2208
2352
|
if (e.decimals !== void 0) {
|
|
2209
2353
|
if (r === "import")
|
|
@@ -2214,244 +2358,244 @@ function lr(e, r) {
|
|
|
2214
2358
|
return '"decimals" must be a whole number from 0 to 100.';
|
|
2215
2359
|
}
|
|
2216
2360
|
if (r === "export") {
|
|
2217
|
-
const t =
|
|
2218
|
-
for (const [n,
|
|
2219
|
-
if (
|
|
2220
|
-
if (
|
|
2221
|
-
return `"${
|
|
2361
|
+
const t = nt(e.to);
|
|
2362
|
+
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)
|
|
2365
|
+
return `"${i}" must be the last segment — it belongs to the element before it.`;
|
|
2222
2366
|
}
|
|
2223
2367
|
}
|
|
2224
2368
|
return null;
|
|
2225
2369
|
}
|
|
2226
|
-
function
|
|
2227
|
-
const n = t ? ` To give "${r}" both text and attributes, write its text to "${r}.${
|
|
2370
|
+
function zt(e, r, t) {
|
|
2371
|
+
const n = t ? ` To give "${r}" both text and attributes, write its text to "${r}.${ur}".` : "";
|
|
2228
2372
|
return new Error(`writeTo "${e}": "${r}" is written both as a value and as the parent of other values.${n}`);
|
|
2229
2373
|
}
|
|
2230
|
-
function
|
|
2374
|
+
function pr(e) {
|
|
2231
2375
|
const r = {}, t = /* @__PURE__ */ new Set([r]);
|
|
2232
|
-
for (const { to: n, value:
|
|
2233
|
-
const o =
|
|
2376
|
+
for (const { to: n, value: i } of e) {
|
|
2377
|
+
const o = nt(n);
|
|
2234
2378
|
if (o.length === 0) continue;
|
|
2235
2379
|
let s = r;
|
|
2236
|
-
for (const [
|
|
2237
|
-
const
|
|
2238
|
-
if (
|
|
2239
|
-
const
|
|
2240
|
-
t.add(
|
|
2241
|
-
} else if (t.has(
|
|
2242
|
-
s =
|
|
2380
|
+
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;
|
|
2243
2387
|
else
|
|
2244
|
-
throw
|
|
2388
|
+
throw zt(n, o.slice(0, u + 1).join("."), o[u + 1].startsWith(rt));
|
|
2245
2389
|
}
|
|
2246
|
-
const
|
|
2247
|
-
if (t.has(
|
|
2248
|
-
const
|
|
2249
|
-
throw
|
|
2390
|
+
const a = o[o.length - 1], c = s[a];
|
|
2391
|
+
if (t.has(c)) {
|
|
2392
|
+
const u = Object.keys(c).some((d) => d.startsWith(rt));
|
|
2393
|
+
throw zt(n, o.join("."), u);
|
|
2250
2394
|
}
|
|
2251
|
-
s[
|
|
2395
|
+
s[a] = i;
|
|
2252
2396
|
}
|
|
2253
2397
|
return r;
|
|
2254
2398
|
}
|
|
2255
|
-
const
|
|
2256
|
-
async function
|
|
2399
|
+
const Ko = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
2400
|
+
async function yt(e, r, t) {
|
|
2257
2401
|
const n = [];
|
|
2258
|
-
for (const
|
|
2259
|
-
const o =
|
|
2260
|
-
if (o) throw new Error(`writeTo "${
|
|
2261
|
-
const s =
|
|
2262
|
-
if (!(
|
|
2263
|
-
if (
|
|
2264
|
-
const
|
|
2402
|
+
for (const i of r) {
|
|
2403
|
+
const o = fr(i, t);
|
|
2404
|
+
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.' : "";
|
|
2265
2409
|
throw new Error(
|
|
2266
|
-
`writeTo "${
|
|
2410
|
+
`writeTo "${i.to}": an attribute or #text value must be text, a number or a boolean.${m}`
|
|
2267
2411
|
);
|
|
2268
2412
|
}
|
|
2269
|
-
n.push({ to:
|
|
2413
|
+
n.push({ to: i.to, value: y });
|
|
2270
2414
|
}
|
|
2271
2415
|
};
|
|
2272
|
-
let
|
|
2273
|
-
const d =
|
|
2274
|
-
if (
|
|
2275
|
-
const
|
|
2276
|
-
|
|
2277
|
-
async (
|
|
2416
|
+
let u = await qo(e, i);
|
|
2417
|
+
const d = u.found && Array.isArray(u.value);
|
|
2418
|
+
if (u.found && d && i.writeTo) {
|
|
2419
|
+
const y = await Promise.all(
|
|
2420
|
+
u.value.map(
|
|
2421
|
+
async (m) => pr(await yt(m, i.writeTo, t))
|
|
2278
2422
|
)
|
|
2279
2423
|
);
|
|
2280
|
-
|
|
2424
|
+
c(y);
|
|
2281
2425
|
continue;
|
|
2282
2426
|
}
|
|
2283
|
-
if (
|
|
2284
|
-
throw new Error(`writeTo "${
|
|
2285
|
-
if (
|
|
2286
|
-
const
|
|
2287
|
-
Object.prototype.hasOwnProperty.call(
|
|
2427
|
+
if (u.found && !d && i.writeTo)
|
|
2428
|
+
throw new Error(`writeTo "${i.to}": "writeTo" is set, but "from" did not resolve to a repeating element.`);
|
|
2429
|
+
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]));
|
|
2288
2432
|
}
|
|
2289
|
-
if (
|
|
2290
|
-
if (
|
|
2291
|
-
|
|
2433
|
+
if (u.found && !d && (u = await Xo(u.value, i, t)), !u.found) {
|
|
2434
|
+
if (i.default === void 0) continue;
|
|
2435
|
+
c(i.default);
|
|
2292
2436
|
continue;
|
|
2293
2437
|
}
|
|
2294
|
-
|
|
2438
|
+
c(u.value);
|
|
2295
2439
|
}
|
|
2296
2440
|
return n;
|
|
2297
2441
|
}
|
|
2298
|
-
const
|
|
2442
|
+
const Yo = ".xml,text/xml,application/xml", Go = 5 * 1024 * 1024, Jo = ({
|
|
2299
2443
|
data: e,
|
|
2300
2444
|
handleChange: r,
|
|
2301
2445
|
path: t,
|
|
2302
2446
|
label: n,
|
|
2303
|
-
required:
|
|
2447
|
+
required: i,
|
|
2304
2448
|
schema: o,
|
|
2305
2449
|
enabled: s,
|
|
2306
|
-
readonly:
|
|
2307
|
-
errors:
|
|
2308
|
-
visible:
|
|
2450
|
+
readonly: a,
|
|
2451
|
+
errors: c,
|
|
2452
|
+
visible: u = !0
|
|
2309
2453
|
}) => {
|
|
2310
|
-
|
|
2311
|
-
const d = !
|
|
2312
|
-
async (
|
|
2313
|
-
var
|
|
2314
|
-
const
|
|
2315
|
-
if (
|
|
2316
|
-
|
|
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.`);
|
|
2317
2461
|
return;
|
|
2318
2462
|
}
|
|
2319
|
-
if (!
|
|
2320
|
-
|
|
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)}`);
|
|
2321
2465
|
return;
|
|
2322
2466
|
}
|
|
2323
|
-
|
|
2324
|
-
let
|
|
2467
|
+
P("parsing");
|
|
2468
|
+
let Z;
|
|
2325
2469
|
try {
|
|
2326
|
-
const
|
|
2327
|
-
|
|
2328
|
-
} catch (
|
|
2329
|
-
if (
|
|
2330
|
-
|
|
2331
|
-
|
|
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."
|
|
2332
2476
|
);
|
|
2333
2477
|
return;
|
|
2334
2478
|
}
|
|
2335
|
-
let
|
|
2336
|
-
if (
|
|
2479
|
+
let le = [];
|
|
2480
|
+
if (N && N.length > 0)
|
|
2337
2481
|
try {
|
|
2338
|
-
|
|
2339
|
-
} catch (
|
|
2340
|
-
if (
|
|
2341
|
-
|
|
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.");
|
|
2342
2486
|
return;
|
|
2343
2487
|
}
|
|
2344
|
-
if (
|
|
2345
|
-
R && r(t,
|
|
2346
|
-
const
|
|
2347
|
-
for (const
|
|
2348
|
-
|
|
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");
|
|
2349
2493
|
},
|
|
2350
|
-
[
|
|
2494
|
+
[T, w, L, D, N, A, R, t, r, v]
|
|
2351
2495
|
);
|
|
2352
|
-
if (
|
|
2353
|
-
const
|
|
2354
|
-
|
|
2355
|
-
},
|
|
2356
|
-
var
|
|
2357
|
-
|
|
2358
|
-
},
|
|
2359
|
-
var
|
|
2360
|
-
(
|
|
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 = "");
|
|
2361
2505
|
};
|
|
2362
|
-
return /* @__PURE__ */
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2365
|
-
/* @__PURE__ */
|
|
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: [
|
|
2366
2510
|
n,
|
|
2367
|
-
|
|
2511
|
+
d && /* @__PURE__ */ l(p, { color: "red", children: " *" })
|
|
2368
2512
|
] }),
|
|
2369
|
-
!
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
|
|
2513
|
+
!ee && _ && m && /* @__PURE__ */ g(xe, { children: [
|
|
2514
|
+
/* @__PURE__ */ l(Ke, { content: "Replace document", children: /* @__PURE__ */ l(
|
|
2515
|
+
Xe,
|
|
2372
2516
|
{
|
|
2373
2517
|
variant: "ghost",
|
|
2374
2518
|
size: "1",
|
|
2375
2519
|
onClick: () => {
|
|
2376
|
-
var
|
|
2377
|
-
return (
|
|
2520
|
+
var C;
|
|
2521
|
+
return (C = Y.current) == null ? void 0 : C.click();
|
|
2378
2522
|
},
|
|
2379
2523
|
"aria-label": "Replace document",
|
|
2380
|
-
children: /* @__PURE__ */
|
|
2524
|
+
children: /* @__PURE__ */ l(je, {})
|
|
2381
2525
|
}
|
|
2382
2526
|
) }),
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
|
|
2385
|
-
}, "aria-label": "Remove document", children: /* @__PURE__ */
|
|
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, {}) }) })
|
|
2386
2530
|
] })
|
|
2387
2531
|
] }),
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
|
|
2532
|
+
/* @__PURE__ */ g($, { align: "center", gap: "2", children: [
|
|
2533
|
+
/* @__PURE__ */ g(p, { size: "1", color: "gray", children: [
|
|
2534
|
+
Ce(w),
|
|
2391
2535
|
" max · ",
|
|
2392
|
-
|
|
2536
|
+
Se(T)
|
|
2393
2537
|
] }),
|
|
2394
|
-
|
|
2395
|
-
var
|
|
2396
|
-
return (
|
|
2397
|
-
}, disabled:
|
|
2398
|
-
|
|
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, {}),
|
|
2399
2543
|
"Upload"
|
|
2400
2544
|
] })
|
|
2401
2545
|
] })
|
|
2402
2546
|
] }),
|
|
2403
|
-
(
|
|
2404
|
-
/* @__PURE__ */
|
|
2405
|
-
!
|
|
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(
|
|
2406
2550
|
"div",
|
|
2407
2551
|
{
|
|
2408
2552
|
role: "button",
|
|
2409
2553
|
tabIndex: 0,
|
|
2410
2554
|
onClick: () => {
|
|
2411
|
-
var
|
|
2412
|
-
return (
|
|
2555
|
+
var C;
|
|
2556
|
+
return (C = Y.current) == null ? void 0 : C.click();
|
|
2413
2557
|
},
|
|
2414
|
-
onKeyDown: (
|
|
2415
|
-
var
|
|
2416
|
-
(
|
|
2558
|
+
onKeyDown: (C) => {
|
|
2559
|
+
var J;
|
|
2560
|
+
(C.key === "Enter" || C.key === " ") && (C.preventDefault(), (J = Y.current) == null || J.click());
|
|
2417
2561
|
},
|
|
2418
|
-
onDragEnter:
|
|
2419
|
-
onDragLeave:
|
|
2420
|
-
onDragOver:
|
|
2421
|
-
onDrop:
|
|
2562
|
+
onDragEnter: oe,
|
|
2563
|
+
onDragLeave: oe,
|
|
2564
|
+
onDragOver: oe,
|
|
2565
|
+
onDrop: te,
|
|
2422
2566
|
style: { cursor: "pointer" },
|
|
2423
2567
|
className: [
|
|
2424
2568
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
2425
2569
|
"transition-all duration-200 ease-in-out",
|
|
2426
|
-
|
|
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"
|
|
2427
2571
|
].join(" "),
|
|
2428
|
-
children: /* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
2431
|
-
] }) :
|
|
2432
|
-
/* @__PURE__ */
|
|
2433
|
-
/* @__PURE__ */
|
|
2434
|
-
/* @__PURE__ */
|
|
2435
|
-
] }) : /* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
|
|
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),
|
|
2440
2584
|
" max · ",
|
|
2441
|
-
|
|
2585
|
+
Se(T)
|
|
2442
2586
|
] })
|
|
2443
2587
|
] }) })
|
|
2444
2588
|
}
|
|
2445
2589
|
),
|
|
2446
|
-
!
|
|
2590
|
+
!y && /* @__PURE__ */ l(p, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: Re(c, n) })
|
|
2447
2591
|
] });
|
|
2448
|
-
},
|
|
2592
|
+
}, Zo = be(Jo), Qo = ie(
|
|
2449
2593
|
10,
|
|
2450
|
-
|
|
2594
|
+
ze((e) => {
|
|
2451
2595
|
const r = e["x-xml"];
|
|
2452
2596
|
return e.type === "object" && typeof r == "object" && r !== null;
|
|
2453
2597
|
})
|
|
2454
|
-
),
|
|
2598
|
+
), ei = "root", Ft = "export.xml", ti = {
|
|
2455
2599
|
format: !0,
|
|
2456
2600
|
indentBy: " ",
|
|
2457
2601
|
ignoreAttributes: !1,
|
|
@@ -2460,357 +2604,366 @@ const Fo = ".xml,text/xml,application/xml", Uo = 5 * 1024 * 1024, $o = ({
|
|
|
2460
2604
|
suppressBooleanAttributes: !1,
|
|
2461
2605
|
processEntities: !0
|
|
2462
2606
|
};
|
|
2463
|
-
function
|
|
2607
|
+
function ri(e) {
|
|
2464
2608
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
2465
2609
|
return 'declaration must be an object, e.g. { "standalone": "no" }, or {} for the defaults.';
|
|
2466
|
-
const { version: r, encoding: t, standalone: n, ...
|
|
2610
|
+
const { version: r, encoding: t, standalone: n, ...i } = e, [o] = Object.keys(i);
|
|
2467
2611
|
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;
|
|
2468
2612
|
}
|
|
2469
|
-
function
|
|
2613
|
+
function hr(e) {
|
|
2470
2614
|
for (const r of e) {
|
|
2471
2615
|
if (r === null || typeof r != "object" || Array.isArray(r))
|
|
2472
2616
|
return "every writeTo entry must be an object.";
|
|
2473
|
-
const { to: t, writeTo: n } = r,
|
|
2474
|
-
if (
|
|
2617
|
+
const { to: t, writeTo: n } = r, i = fr(r, "export");
|
|
2618
|
+
if (i) return `writeTo "${t}": ${i}`;
|
|
2475
2619
|
if (n !== void 0) {
|
|
2476
2620
|
if (!Array.isArray(n)) return `writeTo "${t}": its nested writeTo must be an array.`;
|
|
2477
|
-
const o =
|
|
2621
|
+
const o = hr(n);
|
|
2478
2622
|
if (o) return o;
|
|
2479
2623
|
}
|
|
2480
2624
|
}
|
|
2481
2625
|
return null;
|
|
2482
2626
|
}
|
|
2483
|
-
function
|
|
2484
|
-
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." :
|
|
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.";
|
|
2485
2629
|
}
|
|
2486
|
-
function
|
|
2630
|
+
function oi({ version: e = "1.0", standalone: r }) {
|
|
2487
2631
|
return { "@_version": e, "@_encoding": "UTF-8", ...r && { "@_standalone": r } };
|
|
2488
2632
|
}
|
|
2489
|
-
function
|
|
2633
|
+
function ii(e) {
|
|
2490
2634
|
return e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == "object" ? Object.keys(e).length === 0 : !1;
|
|
2491
2635
|
}
|
|
2492
|
-
const
|
|
2493
|
-
var
|
|
2494
|
-
const
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
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 () => {
|
|
2639
|
+
if (a) {
|
|
2640
|
+
w(null);
|
|
2497
2641
|
try {
|
|
2498
|
-
const
|
|
2499
|
-
...
|
|
2500
|
-
[o]:
|
|
2501
|
-
},
|
|
2502
|
-
|
|
2503
|
-
} catch (
|
|
2504
|
-
|
|
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.");
|
|
2505
2649
|
}
|
|
2506
2650
|
}
|
|
2507
|
-
}, [
|
|
2508
|
-
return n === !1 ? null : d ? /* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
2510
|
-
/* @__PURE__ */
|
|
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: [
|
|
2511
2655
|
"Invalid x-xml-export config: ",
|
|
2512
2656
|
d
|
|
2513
2657
|
] })
|
|
2514
|
-
] }) : /* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
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, {}),
|
|
2518
2662
|
"Download XML"
|
|
2519
2663
|
] }),
|
|
2520
|
-
|
|
2664
|
+
T && /* @__PURE__ */ l(p, { size: "2", color: "red", style: { display: "block", marginTop: "var(--space-2)" }, children: T })
|
|
2521
2665
|
] });
|
|
2522
|
-
},
|
|
2666
|
+
}, li = be(si), ci = ie(
|
|
2523
2667
|
10,
|
|
2524
|
-
|
|
2668
|
+
ze((e) => {
|
|
2525
2669
|
const r = e["x-xml-export"];
|
|
2526
2670
|
return e.type === "object" && typeof r == "object" && r !== null;
|
|
2527
2671
|
})
|
|
2528
|
-
),
|
|
2529
|
-
var
|
|
2530
|
-
|
|
2531
|
-
const s =
|
|
2532
|
-
return
|
|
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(() => {
|
|
2533
2677
|
if (!o) return;
|
|
2534
|
-
let
|
|
2535
|
-
const
|
|
2536
|
-
|
|
2678
|
+
let U = !1;
|
|
2679
|
+
const P = (O) => {
|
|
2680
|
+
w || O !== e && r(t, O);
|
|
2537
2681
|
};
|
|
2538
|
-
if (
|
|
2539
|
-
|
|
2682
|
+
if (f === void 0) {
|
|
2683
|
+
D("unavailable"), v(null), A(null), P(void 0);
|
|
2540
2684
|
return;
|
|
2541
2685
|
}
|
|
2542
|
-
return
|
|
2543
|
-
if (
|
|
2544
|
-
const
|
|
2545
|
-
if (
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
),
|
|
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);
|
|
2549
2693
|
return;
|
|
2550
2694
|
}
|
|
2551
|
-
|
|
2695
|
+
D("ok"), v(null), A(j), P(j);
|
|
2552
2696
|
}), () => {
|
|
2553
|
-
|
|
2697
|
+
U = !0;
|
|
2554
2698
|
};
|
|
2555
|
-
}, [
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
] }) :
|
|
2561
|
-
|
|
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 })
|
|
2562
2706
|
] }) });
|
|
2563
|
-
},
|
|
2707
|
+
}, pi = be(fi), hi = ie(
|
|
2564
2708
|
5,
|
|
2565
|
-
|
|
2709
|
+
ze((e) => {
|
|
2566
2710
|
const r = e["x-computed"];
|
|
2567
2711
|
return e.type === "number" && typeof r == "object" && r !== null;
|
|
2568
2712
|
})
|
|
2569
|
-
),
|
|
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) => {
|
|
2570
2714
|
const r = e == null ? void 0 : e["x-template"];
|
|
2571
2715
|
if (typeof r != "object" || r === null) return;
|
|
2572
2716
|
const { template: t, inputs: n } = r;
|
|
2573
2717
|
if (!(typeof t != "string" || t === ""))
|
|
2574
2718
|
return { template: t, inputs: n };
|
|
2575
|
-
},
|
|
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) => {
|
|
2576
2720
|
const r = /* @__PURE__ */ new Set();
|
|
2577
|
-
for (const t of
|
|
2721
|
+
for (const t of ht(e))
|
|
2578
2722
|
typeof t == "object" && t.arg === void 0 && r.add(t.name);
|
|
2579
2723
|
return [...r];
|
|
2580
|
-
},
|
|
2724
|
+
}, vi = (e) => {
|
|
2581
2725
|
const r = [];
|
|
2582
2726
|
for (const [t, n] of Object.entries((e == null ? void 0 : e.properties) ?? {})) {
|
|
2583
|
-
const
|
|
2584
|
-
|
|
2727
|
+
const i = gi(n);
|
|
2728
|
+
i && r.push([t, i]);
|
|
2585
2729
|
}
|
|
2586
2730
|
return r;
|
|
2587
|
-
},
|
|
2588
|
-
var
|
|
2731
|
+
}, wi = (e, r, t) => {
|
|
2732
|
+
var i;
|
|
2589
2733
|
const n = {};
|
|
2590
|
-
for (const o of
|
|
2591
|
-
const s =
|
|
2734
|
+
for (const o of bi(t.template)) {
|
|
2735
|
+
const s = cr(e, r, ((i = t.inputs) == null ? void 0 : i[o]) ?? o);
|
|
2592
2736
|
n[o] = typeof s == "string" || typeof s == "number" || typeof s == "boolean" ? String(s) : "";
|
|
2593
2737
|
}
|
|
2594
2738
|
return n;
|
|
2595
|
-
},
|
|
2596
|
-
const t = r.trim() === "" ?
|
|
2597
|
-
return `${e}`.padStart(Number.isInteger(t) && t >= 0 ? t :
|
|
2598
|
-
},
|
|
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) => {
|
|
2599
2743
|
const r = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2600
2744
|
let t = "";
|
|
2601
|
-
for (const n of
|
|
2602
|
-
typeof n == "string" ? t += r(n) : t +=
|
|
2745
|
+
for (const n of ht(e))
|
|
2746
|
+
typeof n == "string" ? t += r(n) : t += bt(n) ? "(\\d+)" : ".*?";
|
|
2603
2747
|
return new RegExp(`^${t}$`);
|
|
2604
|
-
},
|
|
2748
|
+
}, xi = (e, r, t) => {
|
|
2605
2749
|
var o, s;
|
|
2606
|
-
const n =
|
|
2607
|
-
let
|
|
2608
|
-
for (const
|
|
2609
|
-
const
|
|
2610
|
-
if (typeof
|
|
2611
|
-
const
|
|
2612
|
-
Number.isFinite(
|
|
2750
|
+
const n = Ti(t.template);
|
|
2751
|
+
let i = 0;
|
|
2752
|
+
for (const a of e) {
|
|
2753
|
+
const c = (o = gr(a)) == null ? void 0 : o[r];
|
|
2754
|
+
if (typeof c != "string") continue;
|
|
2755
|
+
const u = Number((s = n.exec(c)) == null ? void 0 : s[1]);
|
|
2756
|
+
Number.isFinite(u) && u > i && (i = u);
|
|
2613
2757
|
}
|
|
2614
|
-
return
|
|
2615
|
-
},
|
|
2616
|
-
const s =
|
|
2758
|
+
return i;
|
|
2759
|
+
}, Ai = (e, r, t, n, i, o) => {
|
|
2760
|
+
const s = vi(e);
|
|
2617
2761
|
if (s.length === 0) return r;
|
|
2618
|
-
const
|
|
2619
|
-
if (!
|
|
2620
|
-
const
|
|
2621
|
-
for (const [
|
|
2622
|
-
if (!
|
|
2623
|
-
const
|
|
2624
|
-
if (
|
|
2625
|
-
if (!
|
|
2762
|
+
const a = gr(r);
|
|
2763
|
+
if (!a) return r;
|
|
2764
|
+
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)) {
|
|
2626
2770
|
console.warn(
|
|
2627
2771
|
`x-template: {seq(…)} needs literal text between it and other placeholders; not numbering "${d.template}"`
|
|
2628
2772
|
);
|
|
2629
2773
|
continue;
|
|
2630
2774
|
}
|
|
2631
|
-
const
|
|
2632
|
-
o[
|
|
2775
|
+
const f = Math.max(o[u] ?? 0, xi(t, u, d)) + 1;
|
|
2776
|
+
o[u] = f, m[mr] = Ei(f);
|
|
2633
2777
|
}
|
|
2634
|
-
|
|
2778
|
+
c[u] = it(d.template, wi(n, i, d), m);
|
|
2635
2779
|
}
|
|
2636
|
-
return
|
|
2637
|
-
},
|
|
2638
|
-
const s =
|
|
2639
|
-
return /* @__PURE__ */
|
|
2640
|
-
var
|
|
2641
|
-
const
|
|
2780
|
+
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: () => {
|
|
2784
|
+
var u;
|
|
2785
|
+
const c = Ai(
|
|
2642
2786
|
t,
|
|
2643
|
-
|
|
2787
|
+
Nr(t, n),
|
|
2644
2788
|
r,
|
|
2645
|
-
(
|
|
2789
|
+
(u = s.core) == null ? void 0 : u.data,
|
|
2646
2790
|
// The object CONTAINING the array, not the row: a row being filled is
|
|
2647
2791
|
// empty, so what a template reaches for sits alongside the array.
|
|
2648
2792
|
e.split(".").slice(0, -1).join("."),
|
|
2649
2793
|
o.current
|
|
2650
2794
|
);
|
|
2651
|
-
|
|
2795
|
+
i && i(e, c)();
|
|
2652
2796
|
}, children: [
|
|
2653
|
-
/* @__PURE__ */
|
|
2797
|
+
/* @__PURE__ */ l($r, {}),
|
|
2654
2798
|
"Add Item"
|
|
2655
2799
|
] }) });
|
|
2656
|
-
},
|
|
2800
|
+
}, Ci = ({
|
|
2657
2801
|
data: e,
|
|
2658
2802
|
path: r,
|
|
2659
2803
|
schema: t,
|
|
2660
2804
|
uischema: n,
|
|
2661
|
-
enabled:
|
|
2805
|
+
enabled: i,
|
|
2662
2806
|
visible: o,
|
|
2663
2807
|
addItem: s,
|
|
2664
|
-
removeItems:
|
|
2665
|
-
rootSchema:
|
|
2666
|
-
arraySchema:
|
|
2808
|
+
removeItems: a,
|
|
2809
|
+
rootSchema: c,
|
|
2810
|
+
arraySchema: u,
|
|
2811
|
+
required: d = !1,
|
|
2812
|
+
errors: y = ""
|
|
2667
2813
|
}) => {
|
|
2668
|
-
const
|
|
2669
|
-
if (o === !1 || !
|
|
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))
|
|
2670
2816
|
return null;
|
|
2671
|
-
const
|
|
2672
|
-
if (
|
|
2673
|
-
const
|
|
2674
|
-
|
|
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) => {
|
|
2818
|
+
if (a) {
|
|
2819
|
+
const ne = a(r, [I]);
|
|
2820
|
+
ne && ne();
|
|
2675
2821
|
}
|
|
2676
2822
|
};
|
|
2677
|
-
return /* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
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,
|
|
2826
|
+
" ",
|
|
2827
|
+
U && /* @__PURE__ */ l(p, { color: "red", children: "*" })
|
|
2828
|
+
] }),
|
|
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,
|
|
2687
2838
|
" ",
|
|
2688
|
-
|
|
2839
|
+
ne + 1
|
|
2689
2840
|
] }),
|
|
2690
|
-
|
|
2691
|
-
|
|
2841
|
+
v && /* @__PURE__ */ g(
|
|
2842
|
+
Ue,
|
|
2692
2843
|
{
|
|
2693
2844
|
type: "button",
|
|
2694
2845
|
color: "red",
|
|
2695
2846
|
variant: "soft",
|
|
2696
|
-
onClick: () =>
|
|
2847
|
+
onClick: () => j(ne),
|
|
2697
2848
|
title: "Remove item",
|
|
2698
2849
|
children: [
|
|
2699
|
-
/* @__PURE__ */
|
|
2850
|
+
/* @__PURE__ */ l(Fr, {}),
|
|
2700
2851
|
"Remove"
|
|
2701
2852
|
]
|
|
2702
2853
|
}
|
|
2703
2854
|
)
|
|
2704
2855
|
] }),
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
|
|
2856
|
+
/* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(
|
|
2857
|
+
Ge,
|
|
2707
2858
|
{
|
|
2708
|
-
schema:
|
|
2709
|
-
uischema: ((
|
|
2859
|
+
schema: L,
|
|
2860
|
+
uischema: ((z = n.options) == null ? void 0 : z.detail) || (L.type === "object" || L.properties ? {
|
|
2710
2861
|
type: "VerticalLayout",
|
|
2711
|
-
elements: Object.keys(
|
|
2862
|
+
elements: Object.keys(L.properties || {}).map((_) => ({
|
|
2712
2863
|
type: "Control",
|
|
2713
|
-
scope: `#/properties/${
|
|
2864
|
+
scope: `#/properties/${_}`
|
|
2714
2865
|
}))
|
|
2715
2866
|
} : {
|
|
2716
2867
|
type: "Control",
|
|
2717
2868
|
scope: "#"
|
|
2718
2869
|
}),
|
|
2719
|
-
path:
|
|
2720
|
-
enabled:
|
|
2870
|
+
path: Y,
|
|
2871
|
+
enabled: i,
|
|
2721
2872
|
renderers: void 0,
|
|
2722
2873
|
cells: void 0
|
|
2723
2874
|
}
|
|
2724
2875
|
) })
|
|
2725
|
-
] }) },
|
|
2876
|
+
] }) }, Y);
|
|
2726
2877
|
}),
|
|
2727
|
-
|
|
2728
|
-
|
|
2878
|
+
R && /* @__PURE__ */ l(
|
|
2879
|
+
Ri,
|
|
2729
2880
|
{
|
|
2730
2881
|
path: r,
|
|
2731
|
-
items:
|
|
2732
|
-
itemsSchema:
|
|
2733
|
-
rootSchema:
|
|
2882
|
+
items: D,
|
|
2883
|
+
itemsSchema: L,
|
|
2884
|
+
rootSchema: c,
|
|
2734
2885
|
addItem: s,
|
|
2735
|
-
sequences:
|
|
2886
|
+
sequences: m
|
|
2736
2887
|
}
|
|
2737
2888
|
)
|
|
2738
2889
|
] }) });
|
|
2739
|
-
},
|
|
2890
|
+
}, Ut = kr(Ci), Si = ie(3, Dr), Oi = ({ uischema: e, visible: r }) => {
|
|
2740
2891
|
const t = e;
|
|
2741
|
-
return r === !1 ? null : /* @__PURE__ */
|
|
2742
|
-
},
|
|
2743
|
-
{ tester:
|
|
2744
|
-
{ tester:
|
|
2745
|
-
{ tester:
|
|
2746
|
-
{ tester:
|
|
2747
|
-
{ tester:
|
|
2748
|
-
{ tester:
|
|
2749
|
-
{ tester:
|
|
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 },
|
|
2750
2902
|
// The layout renderers take their props from withJsonFormsLayoutProps, which
|
|
2751
2903
|
// evaluates the layout's rule into `visible` and `enabled`, as
|
|
2752
2904
|
// withJsonFormsControlProps does for the controls.
|
|
2753
|
-
{ tester:
|
|
2754
|
-
{ tester:
|
|
2755
|
-
{ tester:
|
|
2756
|
-
{ tester:
|
|
2757
|
-
{ tester:
|
|
2758
|
-
{ tester:
|
|
2759
|
-
{ tester:
|
|
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 },
|
|
2760
2912
|
// After SpreadsheetControl on purpose: both testers rank 10, and a tie is
|
|
2761
2913
|
// resolved by registration order (see XmlControlTester's comment).
|
|
2762
|
-
{ tester:
|
|
2914
|
+
{ tester: Qo, renderer: Zo },
|
|
2763
2915
|
// Also rank 10, but matches the distinct `x-xml-export` keyword rather
|
|
2764
2916
|
// than `x-xml`, so it never ties with XmlControlTester on the same schema
|
|
2765
2917
|
// node (see XmlExportControlTester's own comment).
|
|
2766
|
-
{ tester:
|
|
2767
|
-
{ tester:
|
|
2768
|
-
{ tester:
|
|
2769
|
-
{ tester:
|
|
2770
|
-
{ tester:
|
|
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 }
|
|
2771
2923
|
];
|
|
2772
2924
|
export {
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
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
|
|
2816
2969
|
};
|