@golemui/core 1.5.0 → 1.5.1-rc.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/CHANGELOG.md +14 -0
- package/index.js +959 -1147
- package/index.umd.cjs +8 -8
- package/package.json +1 -2
package/index.js
CHANGED
|
@@ -1,274 +1,86 @@
|
|
|
1
|
-
import { BehaviorSubject as
|
|
1
|
+
import { BehaviorSubject as dr, distinctUntilChanged as Ne, Subject as nt, pipe as ur, map as At } from "rxjs";
|
|
2
|
+
import { Decoder as he, err as K, ok as Ve, object as q, array as Re, string as E, oneOf as z, boolean as lr, optional as y, succeed as L, number as me, literal as H, lazy as Et, discriminatedUnion as ar, record as fr, formatIssuePath as pr } from "ts.data.json";
|
|
2
3
|
import "@standard-schema/spec";
|
|
3
|
-
function
|
|
4
|
+
function hr(e, t) {
|
|
4
5
|
const r = e["~standard"].validate(t);
|
|
5
6
|
if (r instanceof Promise)
|
|
6
7
|
throw new TypeError("Schema validation must be synchronous");
|
|
7
8
|
return r;
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function mr(e) {
|
|
10
11
|
return e.issues === void 0;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
constructor(e) {
|
|
15
|
-
this.value = e;
|
|
16
|
-
}
|
|
17
|
-
map(e) {
|
|
18
|
-
return k(e(this.value));
|
|
19
|
-
}
|
|
20
|
-
isOk() {
|
|
21
|
-
return !0;
|
|
22
|
-
}
|
|
23
|
-
}, $r = class It {
|
|
24
|
-
issues;
|
|
25
|
-
constructor(t) {
|
|
26
|
-
this.issues = t;
|
|
27
|
-
}
|
|
28
|
-
map(t) {
|
|
29
|
-
return new It(this.issues);
|
|
30
|
-
}
|
|
31
|
-
isOk() {
|
|
32
|
-
return !1;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
function k(e) {
|
|
36
|
-
return new vr(e);
|
|
37
|
-
}
|
|
38
|
-
function E(e) {
|
|
39
|
-
return new $r(e);
|
|
40
|
-
}
|
|
41
|
-
function kt(e) {
|
|
42
|
-
return e.reduce((t, r) => typeof r == "number" ? `${t}[${r}]` : t.length === 0 ? String(r) : `${t}.${r}`, "");
|
|
43
|
-
}
|
|
44
|
-
function ut(e) {
|
|
45
|
-
return e.map((t) => t.path.length === 0 ? t.message : `${kt(t.path)}: ${t.message}`).join("; ");
|
|
46
|
-
}
|
|
47
|
-
var C = class Pe {
|
|
48
|
-
decodeFn;
|
|
49
|
-
constructor(t) {
|
|
50
|
-
this.decodeFn = t;
|
|
51
|
-
}
|
|
52
|
-
parse(t) {
|
|
53
|
-
let r = this.decode(t);
|
|
54
|
-
if (r.isOk()) return r.value;
|
|
55
|
-
{
|
|
56
|
-
let n = r;
|
|
57
|
-
throw Error(ut(n.issues), { cause: n.issues });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
decode(t) {
|
|
61
|
-
return this.decodeFn(t);
|
|
62
|
-
}
|
|
63
|
-
"~standard" = {
|
|
64
|
-
version: 1,
|
|
65
|
-
vendor: "ts.data.json",
|
|
66
|
-
validate: (t) => {
|
|
67
|
-
let r = this.decode(t);
|
|
68
|
-
return r.isOk() ? { value: r.value } : { issues: r.issues.map((n) => ({
|
|
69
|
-
message: n.message,
|
|
70
|
-
path: n.path.length > 0 ? n.path.map((o) => ({ key: o })) : void 0
|
|
71
|
-
})) };
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
decodePromise(t) {
|
|
75
|
-
return new Promise((r, n) => {
|
|
76
|
-
let o = this.decode(t);
|
|
77
|
-
if (o.isOk()) return r(o.value);
|
|
78
|
-
{
|
|
79
|
-
let s = o;
|
|
80
|
-
return n(Error(ut(s.issues), { cause: s.issues }));
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
map(t) {
|
|
85
|
-
return new Pe((r) => {
|
|
86
|
-
let n = this.decodeFn(r);
|
|
87
|
-
return n.isOk() ? k(t(n.value)) : E(n.issues);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
flatMap(t) {
|
|
91
|
-
return new Pe((r) => {
|
|
92
|
-
let n = this.decodeFn(r);
|
|
93
|
-
return n.isOk() ? t(n.value).decode(r) : E(n.issues);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}, b = (e, t) => [{
|
|
97
|
-
message: `${JSON.stringify(e)} is not a valid ${t}`,
|
|
98
|
-
path: []
|
|
99
|
-
}], Me = (e, t) => e.map((r) => ({
|
|
100
|
-
...r,
|
|
101
|
-
path: [t, ...r.path]
|
|
102
|
-
}));
|
|
103
|
-
function _e(e) {
|
|
104
|
-
return new C((t) => {
|
|
105
|
-
if (t instanceof Array) {
|
|
106
|
-
let r = [], n = [];
|
|
107
|
-
for (let o = 0; o < t.length; o++) {
|
|
108
|
-
let s = e.decode(t[o]);
|
|
109
|
-
s.isOk() ? r.push(s.value) : n.push(...Me(s.issues, o));
|
|
110
|
-
}
|
|
111
|
-
return n.length > 0 ? E(n) : k(r);
|
|
112
|
-
} else return E(b(t, "array"));
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function Sr() {
|
|
116
|
-
return new C((e) => typeof e == "boolean" ? k(e) : E(b(e, "boolean")));
|
|
117
|
-
}
|
|
118
|
-
function Ar(e, t) {
|
|
119
|
-
return new C((r) => {
|
|
120
|
-
if (typeof r != "object" || !r) return E(b(r, "object"));
|
|
121
|
-
let n = r[e];
|
|
122
|
-
return Object.prototype.hasOwnProperty.call(t, n) ? t[n].decode(r) : E([{
|
|
123
|
-
message: `"${e}" must be one of ${Object.keys(t).map((o) => JSON.stringify(o)).join(", ")}, but got ${JSON.stringify(n)}`,
|
|
124
|
-
path: [e]
|
|
125
|
-
}]);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function jt(e) {
|
|
129
|
-
return new C((t) => e().decode(t));
|
|
130
|
-
}
|
|
131
|
-
function G(e) {
|
|
132
|
-
return new C((t) => t === e ? k(e) : E([{
|
|
133
|
-
message: `${JSON.stringify(t)} is not exactly ${JSON.stringify(e)}`,
|
|
134
|
-
path: []
|
|
135
|
-
}]));
|
|
136
|
-
}
|
|
137
|
-
function ye() {
|
|
138
|
-
return new C((e) => typeof e == "number" ? k(e) : E(b(e, "number")));
|
|
139
|
-
}
|
|
140
|
-
function Y(e) {
|
|
141
|
-
return new C((t) => {
|
|
142
|
-
if (typeof t == "object" && t) {
|
|
143
|
-
let r = {}, n = [];
|
|
144
|
-
for (let o in e) if (Object.prototype.hasOwnProperty.call(e, o)) {
|
|
145
|
-
let s, i = e[o];
|
|
146
|
-
s = i instanceof C ? i.decode(t[o]) : i.decoder.decode(t[i.fromKey]), s.isOk() ? r[o] = s.value : n.push(...Me(s.issues, o));
|
|
147
|
-
}
|
|
148
|
-
return n.length > 0 ? E(n) : k(r);
|
|
149
|
-
} else return E(b(t, "object"));
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function K(e) {
|
|
153
|
-
return new C((t) => {
|
|
154
|
-
let r = [];
|
|
155
|
-
for (let n = 0; n < e.length; n++) {
|
|
156
|
-
let o = e[n].decode(t);
|
|
157
|
-
if (o.isOk()) return o;
|
|
158
|
-
r.push(o.issues);
|
|
159
|
-
}
|
|
160
|
-
return E([{
|
|
161
|
-
message: `no alternative matched (tried ${e.length})`,
|
|
162
|
-
path: []
|
|
163
|
-
}, ...Er(r)]);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
function Er(e) {
|
|
167
|
-
let t = /* @__PURE__ */ new Map();
|
|
168
|
-
for (let r of e) for (let n of r) {
|
|
169
|
-
let o = JSON.stringify(n.path), s = t.get(o);
|
|
170
|
-
s ? s.messages.includes(n.message) || s.messages.push(n.message) : t.set(o, {
|
|
171
|
-
path: n.path,
|
|
172
|
-
messages: [n.message]
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
return Array.from(t.values()).map(({ path: r, messages: n }) => ({
|
|
176
|
-
message: n.join(" or "),
|
|
177
|
-
path: r
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
function y(e) {
|
|
181
|
-
return new C((t) => t === void 0 ? k(void 0) : e.decode(t));
|
|
182
|
-
}
|
|
183
|
-
function wr(e) {
|
|
184
|
-
return new C((t) => {
|
|
185
|
-
if (typeof t == "object" && t) {
|
|
186
|
-
let r = {}, n = [];
|
|
187
|
-
for (let o in t) if (Object.prototype.hasOwnProperty.call(t, o)) {
|
|
188
|
-
let s = e.decode(t[o]);
|
|
189
|
-
s.isOk() ? r[o] = s.value : n.push(...Me(s.issues, o));
|
|
190
|
-
}
|
|
191
|
-
return n.length > 0 ? E(n) : k(r);
|
|
192
|
-
} else return E(b(t, "object"));
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function w() {
|
|
196
|
-
return new C((e) => typeof e == "string" ? k(e) : E(b(e, "string")));
|
|
197
|
-
}
|
|
198
|
-
function U() {
|
|
199
|
-
return new C((e) => k(e));
|
|
200
|
-
}
|
|
201
|
-
function ee(e) {
|
|
202
|
-
return new C((t) => {
|
|
13
|
+
function J(e) {
|
|
14
|
+
return new he((t) => {
|
|
203
15
|
if (typeof t != "object" || t === null)
|
|
204
|
-
return
|
|
16
|
+
return K([{ message: `Expected object literal, got "${typeof t}"`, path: [] }]);
|
|
205
17
|
const r = {};
|
|
206
18
|
for (const [n, o] of Object.entries(e)) {
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
209
|
-
return
|
|
210
|
-
|
|
211
|
-
message:
|
|
212
|
-
path: [n, ...
|
|
19
|
+
const i = o.decoder.decode(t[n]);
|
|
20
|
+
if (!i.isOk())
|
|
21
|
+
return K(
|
|
22
|
+
i.issues.map((s) => ({
|
|
23
|
+
message: s.message,
|
|
24
|
+
path: [n, ...s.path]
|
|
213
25
|
}))
|
|
214
26
|
);
|
|
215
|
-
if (r[n] =
|
|
216
|
-
for (const [
|
|
217
|
-
if (
|
|
218
|
-
const
|
|
219
|
-
if (!
|
|
220
|
-
return
|
|
221
|
-
|
|
27
|
+
if (r[n] = i.value, o.suffixed) {
|
|
28
|
+
for (const [s, c] of Object.entries(t))
|
|
29
|
+
if (s.startsWith(n + ".")) {
|
|
30
|
+
const u = o.decoder.decode(c);
|
|
31
|
+
if (!u.isOk())
|
|
32
|
+
return K(
|
|
33
|
+
u.issues.map((l) => ({
|
|
222
34
|
message: l.message,
|
|
223
|
-
path: [
|
|
35
|
+
path: [s, ...l.path]
|
|
224
36
|
}))
|
|
225
37
|
);
|
|
226
|
-
r[
|
|
38
|
+
r[s] = u.value;
|
|
227
39
|
}
|
|
228
40
|
}
|
|
229
41
|
}
|
|
230
|
-
return
|
|
42
|
+
return Ve(r);
|
|
231
43
|
});
|
|
232
44
|
}
|
|
233
|
-
const
|
|
45
|
+
const gr = (e) => typeof e != "function" && e.kind === "display", oe = (e) => typeof e != "function" && e.kind === "action", I = (e) => typeof e != "function" && e.kind === "input", _ = (e) => typeof e != "function" && e.kind === "layout", P = (e) => typeof e == "function", yr = q({ in: Re(E()) }), Le = q({ when: E() }), ge = z([yr, Le]), vr = q({ from: Re(E()) }), ye = z([vr, Le]), ke = z([lr(), Le]), $r = new he((e) => {
|
|
234
46
|
const t = typeof e;
|
|
235
|
-
return t === "function" ?
|
|
236
|
-
}),
|
|
237
|
-
load: { suffixed: !0, decoder:
|
|
238
|
-
click: { suffixed: !0, decoder:
|
|
239
|
-
change: { suffixed: !0, decoder:
|
|
240
|
-
filter: { suffixed: !0, decoder:
|
|
241
|
-
blur: { suffixed: !0, decoder:
|
|
242
|
-
}),
|
|
243
|
-
key:
|
|
244
|
-
default: y(
|
|
245
|
-
params: y(
|
|
246
|
-
}),
|
|
247
|
-
kind: { decoder:
|
|
248
|
-
uid: { decoder:
|
|
249
|
-
type: { decoder:
|
|
250
|
-
size: { suffixed: !0, decoder: y(
|
|
251
|
-
include: { decoder: y(
|
|
252
|
-
exclude: { decoder: y(
|
|
253
|
-
props: { decoder: y(
|
|
254
|
-
}),
|
|
255
|
-
kind: { decoder:
|
|
256
|
-
uid: { decoder:
|
|
257
|
-
type: { decoder:
|
|
47
|
+
return t === "function" ? Ve(e) : K([{ message: `Expected a function, got '${t}'`, path: [] }]);
|
|
48
|
+
}), D = (e) => z([e, $r]), _e = J({
|
|
49
|
+
load: { suffixed: !0, decoder: D(y(E())) },
|
|
50
|
+
click: { suffixed: !0, decoder: D(y(E())) },
|
|
51
|
+
change: { suffixed: !0, decoder: D(y(E())) },
|
|
52
|
+
filter: { suffixed: !0, decoder: D(y(E())) },
|
|
53
|
+
blur: { suffixed: !0, decoder: D(y(E())) }
|
|
54
|
+
}), Sr = q({
|
|
55
|
+
key: E(),
|
|
56
|
+
default: y(E()),
|
|
57
|
+
params: y(L())
|
|
58
|
+
}), Ct = z([E(), Sr]), Me = y(E()), Ar = J({
|
|
59
|
+
kind: { decoder: H("display") },
|
|
60
|
+
uid: { decoder: Me },
|
|
61
|
+
type: { decoder: E() },
|
|
62
|
+
size: { suffixed: !0, decoder: y(me()) },
|
|
63
|
+
include: { decoder: y(ge) },
|
|
64
|
+
exclude: { decoder: y(ye) },
|
|
65
|
+
props: { decoder: y(L()) }
|
|
66
|
+
}), Er = J({
|
|
67
|
+
kind: { decoder: H("action") },
|
|
68
|
+
uid: { decoder: Me },
|
|
69
|
+
type: { decoder: E() },
|
|
258
70
|
actionType: {
|
|
259
|
-
decoder: y(
|
|
71
|
+
decoder: y(z([H("button"), H("submit")]))
|
|
260
72
|
},
|
|
261
|
-
size: { suffixed: !0, decoder: y(
|
|
262
|
-
include: { decoder: y(
|
|
263
|
-
exclude: { decoder: y(
|
|
73
|
+
size: { suffixed: !0, decoder: y(me()) },
|
|
74
|
+
include: { decoder: y(ge) },
|
|
75
|
+
exclude: { decoder: y(ye) },
|
|
264
76
|
label: {
|
|
265
77
|
suffixed: !0,
|
|
266
|
-
decoder:
|
|
78
|
+
decoder: D(y(Ct))
|
|
267
79
|
},
|
|
268
|
-
disabled: { suffixed: !0, decoder: y(
|
|
269
|
-
on: { decoder: y(
|
|
270
|
-
props: { decoder: y(
|
|
271
|
-
}),
|
|
80
|
+
disabled: { suffixed: !0, decoder: y(ke) },
|
|
81
|
+
on: { decoder: y(_e) },
|
|
82
|
+
props: { decoder: y(L()) }
|
|
83
|
+
}), Cr = new he((e) => {
|
|
272
84
|
const t = typeof e;
|
|
273
85
|
if (t === "function") {
|
|
274
86
|
const r = e, n = r({
|
|
@@ -277,58 +89,58 @@ const Or = (e) => typeof e != "function" && e.kind === "display", ue = (e) => ty
|
|
|
277
89
|
touched: void 0,
|
|
278
90
|
translate: void 0
|
|
279
91
|
});
|
|
280
|
-
return r.uid = r.uid || n.uid, r.type = n.type, r.path = n.path,
|
|
92
|
+
return r.uid = r.uid || n.uid, r.type = n.type, r.path = n.path, Ve(r);
|
|
281
93
|
} else
|
|
282
|
-
return
|
|
283
|
-
}),
|
|
284
|
-
kind: { decoder:
|
|
285
|
-
uid: { decoder: y(
|
|
286
|
-
type: { decoder:
|
|
287
|
-
size: { suffixed: !0, decoder: y(
|
|
288
|
-
include: { decoder: y(
|
|
289
|
-
exclude: { decoder: y(
|
|
290
|
-
disabled: { suffixed: !0, decoder: y(
|
|
291
|
-
readonly: { suffixed: !0, decoder: y(
|
|
292
|
-
on: { decoder: y(
|
|
293
|
-
props: { decoder: y(
|
|
94
|
+
return K([{ message: `Expected a function, got '${t}'`, path: [] }]);
|
|
95
|
+
}), wr = J({
|
|
96
|
+
kind: { decoder: H("input") },
|
|
97
|
+
uid: { decoder: y(E()) },
|
|
98
|
+
type: { decoder: E() },
|
|
99
|
+
size: { suffixed: !0, decoder: y(me()) },
|
|
100
|
+
include: { decoder: y(ge) },
|
|
101
|
+
exclude: { decoder: y(ye) },
|
|
102
|
+
disabled: { suffixed: !0, decoder: y(ke) },
|
|
103
|
+
readonly: { suffixed: !0, decoder: y(ke) },
|
|
104
|
+
on: { decoder: y(_e) },
|
|
105
|
+
props: { decoder: y(L()) },
|
|
294
106
|
label: {
|
|
295
107
|
suffixed: !0,
|
|
296
|
-
decoder:
|
|
108
|
+
decoder: D(y(Ct))
|
|
297
109
|
},
|
|
298
|
-
path: { decoder:
|
|
299
|
-
defaultValue: { decoder: y(
|
|
110
|
+
path: { decoder: E() },
|
|
111
|
+
defaultValue: { decoder: y(L()) },
|
|
300
112
|
validator: {
|
|
301
113
|
suffixed: !0,
|
|
302
|
-
decoder:
|
|
114
|
+
decoder: D(y(L()))
|
|
303
115
|
}
|
|
304
116
|
}).map((e) => {
|
|
305
117
|
const t = { ...e };
|
|
306
118
|
if (e.uid || (t.uid = `${e.path}-${e.type}`), e.type === "repeater") {
|
|
307
119
|
const r = e.props;
|
|
308
|
-
t.props = { ...r, template:
|
|
120
|
+
t.props = { ...r, template: Ue.parse(r.template) };
|
|
309
121
|
}
|
|
310
122
|
return t;
|
|
311
|
-
}),
|
|
312
|
-
const e =
|
|
313
|
-
input:
|
|
314
|
-
layout:
|
|
315
|
-
display:
|
|
316
|
-
action:
|
|
123
|
+
}), Ir = Et(() => {
|
|
124
|
+
const e = ar("kind", {
|
|
125
|
+
input: wr,
|
|
126
|
+
layout: Ue,
|
|
127
|
+
display: Ar,
|
|
128
|
+
action: Er
|
|
317
129
|
});
|
|
318
|
-
return new
|
|
319
|
-
(t) => typeof t == "function" ?
|
|
130
|
+
return new he(
|
|
131
|
+
(t) => typeof t == "function" ? Cr.decode(t) : e.decode(t)
|
|
320
132
|
);
|
|
321
|
-
}),
|
|
322
|
-
kind: { decoder:
|
|
323
|
-
uid: { decoder:
|
|
324
|
-
type: { decoder:
|
|
325
|
-
size: { suffixed: !0, decoder: y(
|
|
326
|
-
include: { decoder: y(
|
|
327
|
-
exclude: { decoder: y(
|
|
328
|
-
props: { decoder: y(
|
|
329
|
-
on: { decoder: y(
|
|
330
|
-
children: { decoder:
|
|
331
|
-
}),
|
|
133
|
+
}), Ue = J({
|
|
134
|
+
kind: { decoder: H("layout") },
|
|
135
|
+
uid: { decoder: Me },
|
|
136
|
+
type: { decoder: E() },
|
|
137
|
+
size: { suffixed: !0, decoder: y(me()) },
|
|
138
|
+
include: { decoder: y(ge) },
|
|
139
|
+
exclude: { decoder: y(ye) },
|
|
140
|
+
props: { decoder: y(L()) },
|
|
141
|
+
on: { decoder: y(_e) },
|
|
142
|
+
children: { decoder: Re(Ir) }
|
|
143
|
+
}), W = class W {
|
|
332
144
|
constructor() {
|
|
333
145
|
this.widgetLoaders = {}, this._ready = !1;
|
|
334
146
|
}
|
|
@@ -343,11 +155,11 @@ const Or = (e) => typeof e != "function" && e.kind === "display", ue = (e) => ty
|
|
|
343
155
|
}
|
|
344
156
|
async loadWidget(t) {
|
|
345
157
|
const r = this.widgetLoaders[t];
|
|
346
|
-
if (!
|
|
347
|
-
const n = r().catch((o) => (
|
|
348
|
-
|
|
158
|
+
if (!W.sharedCache.has(r)) {
|
|
159
|
+
const n = r().catch((o) => (W.sharedCache.delete(r), Promise.reject(o)));
|
|
160
|
+
W.sharedCache.set(r, n);
|
|
349
161
|
}
|
|
350
|
-
return
|
|
162
|
+
return W.sharedCache.get(r);
|
|
351
163
|
}
|
|
352
164
|
/**
|
|
353
165
|
* Loads the given widget types (default: every configured type) and stores each
|
|
@@ -359,7 +171,7 @@ const Or = (e) => typeof e != "function" && e.kind === "display", ue = (e) => ty
|
|
|
359
171
|
await Promise.all(
|
|
360
172
|
r.map(async (n) => {
|
|
361
173
|
const o = await this.loadWidget(n);
|
|
362
|
-
|
|
174
|
+
W.resolvedCache.set(this.widgetLoaders[n], o);
|
|
363
175
|
})
|
|
364
176
|
);
|
|
365
177
|
}
|
|
@@ -370,31 +182,31 @@ const Or = (e) => typeof e != "function" && e.kind === "display", ue = (e) => ty
|
|
|
370
182
|
getIfLoaded(t) {
|
|
371
183
|
const r = this.widgetLoaders[t];
|
|
372
184
|
if (r)
|
|
373
|
-
return
|
|
185
|
+
return W.resolvedCache.get(r);
|
|
374
186
|
}
|
|
375
187
|
};
|
|
376
|
-
|
|
377
|
-
let
|
|
378
|
-
async function
|
|
379
|
-
const t = new
|
|
188
|
+
W.sharedCache = /* @__PURE__ */ new Map(), W.resolvedCache = /* @__PURE__ */ new Map();
|
|
189
|
+
let ie = W;
|
|
190
|
+
async function Yo(e) {
|
|
191
|
+
const t = new ie();
|
|
380
192
|
t.setWidgetLoaders(e.widgetLoaders), await t.preloadWidgets();
|
|
381
193
|
}
|
|
382
|
-
function
|
|
383
|
-
|
|
194
|
+
function Or(e) {
|
|
195
|
+
je(e, "#0");
|
|
384
196
|
}
|
|
385
|
-
function
|
|
386
|
-
if (
|
|
197
|
+
function je(e, t) {
|
|
198
|
+
if (P(e)) {
|
|
387
199
|
e.uid || (e.uid = `${t}.f`);
|
|
388
200
|
return;
|
|
389
201
|
}
|
|
390
|
-
if (e.uid || (e.uid = t),
|
|
391
|
-
|
|
392
|
-
}),
|
|
202
|
+
if (e.uid || (e.uid = t), _(e) && e.children.forEach((r, n) => {
|
|
203
|
+
je(r, `${t}.${n}`);
|
|
204
|
+
}), I(e) && e.type === "repeater") {
|
|
393
205
|
const r = e.props?.template;
|
|
394
|
-
r &&
|
|
206
|
+
r && je(r, `${t}.t`);
|
|
395
207
|
}
|
|
396
208
|
}
|
|
397
|
-
function
|
|
209
|
+
function ei(e) {
|
|
398
210
|
return {
|
|
399
211
|
...e,
|
|
400
212
|
form: {
|
|
@@ -405,12 +217,12 @@ function us(e) {
|
|
|
405
217
|
}
|
|
406
218
|
};
|
|
407
219
|
}
|
|
408
|
-
const
|
|
409
|
-
states: y(
|
|
410
|
-
form:
|
|
411
|
-
}).map((e) => (
|
|
220
|
+
const wt = q({
|
|
221
|
+
states: y(fr(E())),
|
|
222
|
+
form: Et(() => Ue)
|
|
223
|
+
}).map((e) => (Or(e.form), e)), It = (e) => ({
|
|
412
224
|
formName: "",
|
|
413
|
-
formDef:
|
|
225
|
+
formDef: wt.parse({
|
|
414
226
|
form: {
|
|
415
227
|
kind: "layout",
|
|
416
228
|
type: "flex",
|
|
@@ -434,16 +246,16 @@ const Ft = Y({
|
|
|
434
246
|
touched: !1,
|
|
435
247
|
allControlsValidated: !1,
|
|
436
248
|
lang: e
|
|
437
|
-
}),
|
|
249
|
+
}), ti = {
|
|
438
250
|
submit: "formSubmit",
|
|
439
251
|
health: "formHealth",
|
|
440
252
|
event: "formEvent"
|
|
441
|
-
},
|
|
442
|
-
function
|
|
253
|
+
}, kr = (e) => !(typeof e != "object" || e === null || typeof e.key != "string");
|
|
254
|
+
function ri(e) {
|
|
443
255
|
const t = new Intl.Locale(e).maximize().script;
|
|
444
256
|
return ["Arab", "Hebr", "Thaa", "Syrc", "Tfng", "Adlm", "Rohg"].includes(t || "") ? "rtl" : "ltr";
|
|
445
257
|
}
|
|
446
|
-
const
|
|
258
|
+
const jr = (e = typeof navigator < "u" && navigator.language || "en-US") => {
|
|
447
259
|
const t = /* @__PURE__ */ new Set();
|
|
448
260
|
return {
|
|
449
261
|
get lang() {
|
|
@@ -461,7 +273,7 @@ const Rr = (e = typeof navigator < "u" && navigator.language || "en-US") => {
|
|
|
461
273
|
e = n, t.forEach((o) => o(e));
|
|
462
274
|
}
|
|
463
275
|
};
|
|
464
|
-
},
|
|
276
|
+
}, k = {
|
|
465
277
|
calculateCurrentStateError: 10,
|
|
466
278
|
calculateWidgetFlagsError: 11,
|
|
467
279
|
calculateWidgetPropsError: 12,
|
|
@@ -471,13 +283,13 @@ const Rr = (e = typeof navigator < "u" && navigator.language || "en-US") => {
|
|
|
471
283
|
initializeMalformedFormShapeError: 23,
|
|
472
284
|
widgetCouldNotBeLoaded: 30,
|
|
473
285
|
resolveStringInterpolationError: 40
|
|
474
|
-
},
|
|
286
|
+
}, Wr = (e) => {
|
|
475
287
|
throw new Error(`Unhandled case: ${JSON.stringify(e)}`);
|
|
476
|
-
},
|
|
288
|
+
}, V = (e, t) => {
|
|
477
289
|
if (e === void 0)
|
|
478
290
|
throw new Error("obj is undefined");
|
|
479
291
|
return t.split(".").reduce((r, n) => r === void 0 || n === "" ? r : Array.isArray(r) ? r[parseInt(n, 10)] : r[n], e);
|
|
480
|
-
},
|
|
292
|
+
}, Pr = (e, t) => {
|
|
481
293
|
if (t === "")
|
|
482
294
|
return !1;
|
|
483
295
|
let r = e;
|
|
@@ -496,7 +308,7 @@ const Rr = (e = typeof navigator < "u" && navigator.language || "en-US") => {
|
|
|
496
308
|
}
|
|
497
309
|
}
|
|
498
310
|
return !0;
|
|
499
|
-
},
|
|
311
|
+
}, We = (e, t, r) => {
|
|
500
312
|
if (e === null)
|
|
501
313
|
throw new Error("object is null");
|
|
502
314
|
if (e === void 0)
|
|
@@ -505,161 +317,161 @@ const Rr = (e = typeof navigator < "u" && navigator.language || "en-US") => {
|
|
|
505
317
|
throw new Error("path cannot be empty");
|
|
506
318
|
const n = t.split(".");
|
|
507
319
|
let o = e;
|
|
508
|
-
for (let
|
|
509
|
-
const
|
|
510
|
-
(o[
|
|
320
|
+
for (let s = 0; s < n.length - 1; s++) {
|
|
321
|
+
const c = n[s], u = n[s + 1];
|
|
322
|
+
(o[c] == null || typeof o[c] != "object") && (o[c] = kt(u) ? [] : {}), o = o[c];
|
|
511
323
|
}
|
|
512
|
-
const
|
|
513
|
-
return o[
|
|
514
|
-
},
|
|
324
|
+
const i = n[n.length - 1];
|
|
325
|
+
return o[i] = r, e;
|
|
326
|
+
}, Ot = (e, t, r) => {
|
|
515
327
|
if (e === null)
|
|
516
328
|
throw new Error("object is null");
|
|
517
329
|
if (e === void 0)
|
|
518
330
|
throw new Error("object is undefined");
|
|
519
331
|
if (t === "")
|
|
520
332
|
throw new Error("path cannot be empty");
|
|
521
|
-
const n = t.split("."), o =
|
|
522
|
-
let
|
|
523
|
-
for (let
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
}
|
|
527
|
-
return
|
|
528
|
-
},
|
|
333
|
+
const n = t.split("."), o = ot(e);
|
|
334
|
+
let i = o;
|
|
335
|
+
for (let s = 0; s < n.length - 1; s++) {
|
|
336
|
+
const c = n[s], u = n[s + 1];
|
|
337
|
+
i[c] == null || typeof i[c] != "object" ? i[c] = kt(u) ? [] : {} : i[c] = ot(i[c]), i = i[c];
|
|
338
|
+
}
|
|
339
|
+
return i[n[n.length - 1]] = r, o;
|
|
340
|
+
}, ot = (e) => Array.isArray(e) ? e.slice() : { ...e }, Dr = (e, t) => {
|
|
529
341
|
if (t === "")
|
|
530
342
|
return e;
|
|
531
343
|
const r = t.split("."), n = [e];
|
|
532
|
-
for (let
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
344
|
+
for (let s = 0; s < r.length - 1; s++) {
|
|
345
|
+
const c = n[s];
|
|
346
|
+
if (c == null || typeof c != "object")
|
|
535
347
|
return e;
|
|
536
|
-
const
|
|
348
|
+
const u = r[s], l = Array.isArray(c) ? c[parseInt(u, 10)] : c[u];
|
|
537
349
|
if (l == null || typeof l != "object")
|
|
538
350
|
return e;
|
|
539
351
|
n.push(l);
|
|
540
352
|
}
|
|
541
|
-
const o = n[n.length - 1],
|
|
542
|
-
Array.isArray(o) ? o.splice(parseInt(
|
|
543
|
-
for (let
|
|
544
|
-
const
|
|
545
|
-
if (Array.isArray(
|
|
353
|
+
const o = n[n.length - 1], i = r[r.length - 1];
|
|
354
|
+
Array.isArray(o) ? o.splice(parseInt(i, 10), 1) : delete o[i];
|
|
355
|
+
for (let s = n.length - 1; s >= 1; s--) {
|
|
356
|
+
const c = n[s];
|
|
357
|
+
if (Array.isArray(c) || !Fr(c))
|
|
546
358
|
break;
|
|
547
|
-
const
|
|
548
|
-
if (Array.isArray(
|
|
359
|
+
const u = n[s - 1], l = r[s - 1];
|
|
360
|
+
if (Array.isArray(u))
|
|
549
361
|
break;
|
|
550
|
-
delete
|
|
362
|
+
delete u[l];
|
|
551
363
|
}
|
|
552
364
|
return e;
|
|
553
365
|
};
|
|
554
|
-
function
|
|
366
|
+
function kt(e) {
|
|
555
367
|
const t = Number(e);
|
|
556
368
|
return Number.isInteger(t) && t >= 0 && t.toString() === e;
|
|
557
369
|
}
|
|
558
|
-
function
|
|
370
|
+
function Fr(e) {
|
|
559
371
|
return e != null && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0;
|
|
560
372
|
}
|
|
561
|
-
function
|
|
373
|
+
function se(e) {
|
|
562
374
|
if (e === null || typeof e != "object")
|
|
563
375
|
return e;
|
|
564
376
|
if (Array.isArray(e))
|
|
565
|
-
return e.map((r) =>
|
|
377
|
+
return e.map((r) => se(r));
|
|
566
378
|
const t = {};
|
|
567
379
|
for (const r of Object.keys(e))
|
|
568
|
-
t[r] =
|
|
380
|
+
t[r] = se(e[r]);
|
|
569
381
|
return t;
|
|
570
382
|
}
|
|
571
|
-
function
|
|
383
|
+
function He(e) {
|
|
572
384
|
return e.flatMap((t) => [
|
|
573
385
|
t,
|
|
574
|
-
...
|
|
386
|
+
..._(t) ? He(t.children) : []
|
|
575
387
|
]);
|
|
576
388
|
}
|
|
577
|
-
function
|
|
389
|
+
function ve(e) {
|
|
578
390
|
return Object.entries(e.validations).sort(
|
|
579
391
|
([n], [o]) => n.split(".").length - o.split(".").length
|
|
580
392
|
).reduce(
|
|
581
|
-
(n, [o,
|
|
393
|
+
(n, [o, i]) => (i !== null && (n.$formIsInvalid = !0, We(n.$errors, o, [...i])), n),
|
|
582
394
|
{ $formIsInvalid: !1, $errors: {} }
|
|
583
395
|
);
|
|
584
396
|
}
|
|
585
|
-
function
|
|
397
|
+
function T(e) {
|
|
586
398
|
if (e !== void 0)
|
|
587
|
-
return
|
|
399
|
+
return I(e) || P(e) ? e.path : void 0;
|
|
588
400
|
}
|
|
589
|
-
function
|
|
590
|
-
const t =
|
|
401
|
+
function we(e) {
|
|
402
|
+
const t = se(e.data);
|
|
591
403
|
for (const [r, n] of Object.entries(e.widgetFlags))
|
|
592
404
|
if (n.hidden === !0) {
|
|
593
|
-
const o =
|
|
594
|
-
o !== void 0 &&
|
|
405
|
+
const o = T(e.resolvedSources[r]);
|
|
406
|
+
o !== void 0 && Dr(t, o);
|
|
595
407
|
}
|
|
596
408
|
return t;
|
|
597
409
|
}
|
|
598
|
-
const
|
|
599
|
-
function
|
|
410
|
+
const $e = (e) => !P(e) && e.type === "repeater", Z = (e) => [...e.matchAll(/\[(\d+)\]/g)].map((t) => parseInt(t[1], 10));
|
|
411
|
+
function Pe(e, t) {
|
|
600
412
|
const r = { resolvedSources: {}, repeaterItemScopes: {} };
|
|
601
413
|
for (const n of Object.values(e))
|
|
602
|
-
r.resolvedSources[n.uid] = n,
|
|
414
|
+
r.resolvedSources[n.uid] = n, $e(n) && jt(n, [], t, r);
|
|
603
415
|
return r;
|
|
604
416
|
}
|
|
605
|
-
function
|
|
606
|
-
const o =
|
|
417
|
+
function jt(e, t, r, n) {
|
|
418
|
+
const o = V(r, e.path);
|
|
607
419
|
if (!Array.isArray(o))
|
|
608
420
|
return;
|
|
609
|
-
const
|
|
610
|
-
o.forEach((
|
|
611
|
-
const
|
|
612
|
-
itemPath: `${e.path}.${
|
|
613
|
-
index:
|
|
421
|
+
const i = He([e.props.template]);
|
|
422
|
+
o.forEach((s, c) => {
|
|
423
|
+
const u = [...t, c], l = {
|
|
424
|
+
itemPath: `${e.path}.${c}`,
|
|
425
|
+
index: c
|
|
614
426
|
};
|
|
615
|
-
for (const a of
|
|
616
|
-
const p =
|
|
427
|
+
for (const a of i) {
|
|
428
|
+
const p = Wt(a, u);
|
|
617
429
|
n.resolvedSources[p.uid] = p, n.repeaterItemScopes[p.uid] = l;
|
|
618
|
-
const g =
|
|
619
|
-
g &&
|
|
430
|
+
const g = Tr(a, p, u, r, s, c);
|
|
431
|
+
g && jt(g, u, r, n);
|
|
620
432
|
}
|
|
621
433
|
});
|
|
622
434
|
}
|
|
623
|
-
function
|
|
624
|
-
if (
|
|
435
|
+
function Tr(e, t, r, n, o, i) {
|
|
436
|
+
if ($e(t))
|
|
625
437
|
return t;
|
|
626
|
-
if (!
|
|
438
|
+
if (!P(e))
|
|
627
439
|
return;
|
|
628
|
-
const
|
|
440
|
+
const s = e({
|
|
629
441
|
$form: n,
|
|
630
442
|
$item: o,
|
|
631
|
-
$index:
|
|
443
|
+
$index: i,
|
|
632
444
|
errors: void 0,
|
|
633
445
|
touched: void 0,
|
|
634
446
|
translate: void 0
|
|
635
447
|
});
|
|
636
|
-
if (
|
|
448
|
+
if (s.type !== "repeater")
|
|
637
449
|
return;
|
|
638
|
-
const
|
|
639
|
-
return
|
|
450
|
+
const c = { ...s, uid: e.uid };
|
|
451
|
+
return Wt(c, r);
|
|
640
452
|
}
|
|
641
|
-
function
|
|
642
|
-
const r =
|
|
643
|
-
if (
|
|
453
|
+
function Wt(e, t) {
|
|
454
|
+
const r = ze(e.uid, t);
|
|
455
|
+
if (P(e)) {
|
|
644
456
|
const n = (o) => e(o);
|
|
645
|
-
return n.uid = r, n.type = e.type, e.path !== void 0 && (n.path =
|
|
457
|
+
return n.uid = r, n.type = e.type, e.path !== void 0 && (n.path = it(e.path, t)), n;
|
|
646
458
|
}
|
|
647
|
-
return
|
|
459
|
+
return I(e) ? {
|
|
648
460
|
...e,
|
|
649
461
|
uid: r,
|
|
650
|
-
path:
|
|
462
|
+
path: it(e.path, t)
|
|
651
463
|
} : {
|
|
652
464
|
...e,
|
|
653
465
|
uid: r
|
|
654
466
|
};
|
|
655
467
|
}
|
|
656
|
-
function
|
|
468
|
+
function ze(e, t) {
|
|
657
469
|
if (t.length === 0)
|
|
658
470
|
throw new Error("Repeater indexes cannot be an empty array");
|
|
659
471
|
const r = t.reduce((n, o) => `${n}[${o}]`, "");
|
|
660
472
|
return `${e}${r}`;
|
|
661
473
|
}
|
|
662
|
-
function
|
|
474
|
+
function it(e, t) {
|
|
663
475
|
if (t.length === 0)
|
|
664
476
|
throw new Error("Repeater indexes cannot be an empty array");
|
|
665
477
|
const r = "items", n = e.split(`.${r}`), o = n.length - 1;
|
|
@@ -667,125 +479,125 @@ function dt(e, t) {
|
|
|
667
479
|
throw new Error(
|
|
668
480
|
`Path contains ${o} '${r}' occurrences, but ${t.length} indexes were provided.`
|
|
669
481
|
);
|
|
670
|
-
return n.reduce((
|
|
482
|
+
return n.reduce((i, s, c) => c === 0 ? s : `${i}.${t[c - 1]}${s}`);
|
|
671
483
|
}
|
|
672
|
-
function
|
|
484
|
+
function Nr(e, t) {
|
|
673
485
|
let r = 0;
|
|
674
486
|
return e.replace(/\.items(\??)\./g, (n, o) => {
|
|
675
|
-
const
|
|
676
|
-
return
|
|
487
|
+
const i = t[r++];
|
|
488
|
+
return i === void 0 ? n : `.${i}${o}.`;
|
|
677
489
|
});
|
|
678
490
|
}
|
|
679
|
-
const
|
|
680
|
-
function
|
|
681
|
-
if (!
|
|
682
|
-
(o) =>
|
|
491
|
+
const st = ["include", "exclude", "disabled", "readonly"];
|
|
492
|
+
function Vr(e, t) {
|
|
493
|
+
if (!st.some(
|
|
494
|
+
(o) => ct(e[o])
|
|
683
495
|
))
|
|
684
496
|
return e;
|
|
685
497
|
const n = { ...e };
|
|
686
|
-
for (const o of
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
...
|
|
690
|
-
when:
|
|
498
|
+
for (const o of st) {
|
|
499
|
+
const i = n[o];
|
|
500
|
+
ct(i) && (n[o] = {
|
|
501
|
+
...i,
|
|
502
|
+
when: Nr(i.when, t)
|
|
691
503
|
});
|
|
692
504
|
}
|
|
693
505
|
return n;
|
|
694
506
|
}
|
|
695
|
-
function
|
|
507
|
+
function ct(e) {
|
|
696
508
|
return e !== null && typeof e == "object" && "when" in e && typeof e.when == "string";
|
|
697
509
|
}
|
|
698
|
-
const
|
|
699
|
-
let t = e.data, r =
|
|
700
|
-
for (let n = 0; n <
|
|
510
|
+
const Rr = 50, Lr = (e) => {
|
|
511
|
+
let t = e.data, r = Pe(e.flatForm, t);
|
|
512
|
+
for (let n = 0; n < Rr; n++) {
|
|
701
513
|
let o = !1;
|
|
702
|
-
for (const
|
|
703
|
-
!
|
|
514
|
+
for (const i of Object.values(r.resolvedSources))
|
|
515
|
+
!I(i) || Pr(t, i.path) || (t = Ot(t, i.path, se(i.defaultValue)), i.defaultValue !== void 0 && (o = !0));
|
|
704
516
|
if (!o)
|
|
705
517
|
break;
|
|
706
|
-
r =
|
|
518
|
+
r = Pe(e.flatForm, t);
|
|
707
519
|
}
|
|
708
520
|
return { ...e, data: t, ...r };
|
|
709
|
-
},
|
|
710
|
-
let
|
|
711
|
-
`), n = r.pop(), o = m.slice(Math.max(0, t - 40), t),
|
|
521
|
+
}, be = 32;
|
|
522
|
+
let De, h, m, v = (e) => (h = 0, m = e, v.newline = !1, e = S(), m[h] ? M() : e || ""), M = (e = "Unexpected token", t = h, r = m.slice(0, t).split(`
|
|
523
|
+
`), n = r.pop(), o = m.slice(Math.max(0, t - 40), t), i = "̭", s = (m[t] || " ") + i, c = m.slice(t + 1, t + 20)) => {
|
|
712
524
|
throw SyntaxError(`${e} at ${r.length + 1}:${n.length + 1}
|
|
713
525
|
${m[t - 41] !== `
|
|
714
|
-
`, "" + o}${
|
|
715
|
-
},
|
|
526
|
+
`, "" + o}${s}${c}`);
|
|
527
|
+
}, Pt = (e, t = h) => (Array.isArray(e) && (e.loc = t), e), b = (e, t = h, r) => {
|
|
716
528
|
for (; r = e(m.charCodeAt(h)); ) h += r;
|
|
717
529
|
return m.slice(t, h);
|
|
718
|
-
},
|
|
719
|
-
let r, n, o,
|
|
720
|
-
for (t && v.asi && (v.newline = !1); (r = v.space()) && (
|
|
721
|
-
(n && r === 91 &&
|
|
722
|
-
return t && (r == t ? (h++, t === 125 && v.asi && (v.newline = !0)) :
|
|
723
|
-
},
|
|
724
|
-
for (
|
|
725
|
-
v.asi && e === 10 && (v.newline =
|
|
530
|
+
}, C = (e = 1) => m[h += e], Fe = (e) => h = e, S = (e = 0, t) => {
|
|
531
|
+
let r, n, o, i, s;
|
|
532
|
+
for (t && v.asi && (v.newline = !1); (r = v.space()) && (s = v.newline, 1) && r !== t && (o = // ASI before [ on new line (access handler would consume it; lineBreak distinguishes real \n from synthetic } flag)
|
|
533
|
+
(n && r === 91 && De && v.asi?.(n, e, S) || null) ?? ((i = j[r]) && i(n, e)) ?? (n && s && v.asi?.(n, e, S)) ?? (!n && b(v.id))); ) n = o;
|
|
534
|
+
return t && (r == t ? (h++, t === 125 && v.asi && (v.newline = !0)) : M("Unclosed " + String.fromCharCode(t - (t > 42 ? 2 : 1)))), n;
|
|
535
|
+
}, N = (e, t = h) => {
|
|
536
|
+
for (De = !1; (e = m.charCodeAt(h)) <= be; )
|
|
537
|
+
v.asi && e === 10 && (v.newline = De = !0), h++;
|
|
726
538
|
return e;
|
|
727
|
-
},
|
|
728
|
-
for (; m.charCodeAt(e) <=
|
|
539
|
+
}, _r = (e = h) => {
|
|
540
|
+
for (; m.charCodeAt(e) <= be; ) e++;
|
|
729
541
|
return m.charCodeAt(e);
|
|
730
542
|
};
|
|
731
543
|
v.id = (e) => e >= 48 && e <= 57 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e == 36 || e == 95 || e >= 192 && e != 215 && e != 247;
|
|
732
|
-
let
|
|
544
|
+
let Mr = (e, t = e.length) => m.substr(h, t) === e && !v.id(m.charCodeAt(h + t)), j = [], dt = {}, O = (e, t = be, r, n = e.charCodeAt(0), o = e.length, i = j[n], s = e.toUpperCase() !== e, c, u) => (t = dt[e] = !i && dt[e] || t, j[n] = (l, a, p, g = h) => (c = p, (p ? e == p : (o < 2 || e.charCodeAt(1) === m.charCodeAt(h + 1) && (o < 3 || m.substr(h, o) == e)) && (!s || !v.id(m.charCodeAt(h + o))) && (c = p = e)) && a < t && (h += o, (u = r(l)) ? Pt(u, g) : (h = g, c = 0, !s && !i && !l && M()), u) || i?.(l, a, c))), $ = (e, t, r = !1) => O(e, t, (n) => n && /* @__PURE__ */ ((o) => o && [e, n, o])(S(t - (r ? 0.5 : 0)))), R = (e, t, r) => O(e, t, (n) => !n && (n = S(t - 0.5)) && [e, n]), Y = (e, t) => O(e, 200, (r) => !r && [, t]), Dt = (e, t, r) => O(
|
|
733
545
|
e,
|
|
734
546
|
t,
|
|
735
547
|
(n, o) => (o = S(t - (r ? 0.5 : 0)), n?.[0] !== e && (n = [e, n || null]), o?.[0] === e ? n.push(...o.slice(1)) : n.push(o || null), n)
|
|
736
|
-
),
|
|
548
|
+
), Be = (e, t) => O(e[0], t, (r) => !r && [e, S(0, e.charCodeAt(1)) || null]), Ft = (e, t) => O(e[0], t, (r) => r && [e, r, S(0, e.charCodeAt(1)) || null]), ee = (e, t, r, n = e.charCodeAt(0), o = e.length, i = j[n], s) => j[n] = (c, u, l, a = h) => !c && (l ? e == l : (o < 2 || m.substr(h, o) == e) && (l = e)) && u < t && !v.id(m.charCodeAt(h + o)) && (!v.prop || v.prop(h + o)) && (Fe(h + o), (s = r()) ? Pt(s, a) : Fe(a), s) || i?.(c, u, l);
|
|
737
549
|
Object.defineProperty(v, "space", {
|
|
738
550
|
configurable: !0,
|
|
739
551
|
enumerable: !0,
|
|
740
|
-
get: () =>
|
|
741
|
-
set: (e) =>
|
|
552
|
+
get: () => N,
|
|
553
|
+
set: (e) => N = e
|
|
742
554
|
});
|
|
743
|
-
const
|
|
555
|
+
const Te = {}, f = (e, t, r = Te[e]) => Te[e] = (...n) => t(...n) || r?.(...n), d = (e) => Array.isArray(e) ? e[0] == null ? /* @__PURE__ */ ((t) => () => t)(e[1]) : (
|
|
744
556
|
// == catches both undefined and null
|
|
745
|
-
|
|
557
|
+
Te[e[0]]?.(...e.slice(1)) ?? M(`Unknown operator: ${e[0]}`, e?.loc)
|
|
746
558
|
) : e === void 0 ? () => {
|
|
747
|
-
} : (t) => t?.[e],
|
|
748
|
-
let t =
|
|
559
|
+
} : (t) => t?.[e], ce = 46, X = 48, de = 57, Ur = 69, Hr = 101, zr = 43, br = 45, ne = 95, Tt = 110, Br = 97, Gr = 102, Kr = 65, Xr = 70, Nt = (e) => e.indexOf("_") < 0 ? e : e.replaceAll("_", ""), Ge = (e) => {
|
|
560
|
+
let t = Nt(b(
|
|
749
561
|
(r) => (
|
|
750
562
|
// . is decimal only if NOT followed by another . (range operator)
|
|
751
|
-
r ===
|
|
563
|
+
r === ce && m.charCodeAt(h + 1) !== ce || r >= X && r <= de || r === ne || ((r === Ur || r === Hr) && ((r = m.charCodeAt(h + 1)) >= X && r <= de || r === zr || r === br) ? 2 : 0)
|
|
752
564
|
)
|
|
753
565
|
));
|
|
754
|
-
return m.charCodeAt(h) ===
|
|
755
|
-
},
|
|
756
|
-
2: (e) => e === 48 || e === 49 || e ===
|
|
757
|
-
8: (e) => e >= 48 && e <= 55 || e ===
|
|
758
|
-
16: (e) => e >=
|
|
566
|
+
return m.charCodeAt(h) === Tt ? (C(), [, BigInt(t)]) : (e = +t) != e ? M() : [, e];
|
|
567
|
+
}, xr = {
|
|
568
|
+
2: (e) => e === 48 || e === 49 || e === ne,
|
|
569
|
+
8: (e) => e >= 48 && e <= 55 || e === ne,
|
|
570
|
+
16: (e) => e >= X && e <= de || e >= Br && e <= Gr || e >= Kr && e <= Xr || e === ne
|
|
759
571
|
};
|
|
760
572
|
v.number = null;
|
|
761
|
-
|
|
762
|
-
for (let e =
|
|
763
|
-
|
|
573
|
+
j[ce] = (e) => !e && m.charCodeAt(h + 1) !== ce && Ge();
|
|
574
|
+
for (let e = X; e <= de; e++) j[e] = (t) => t ? void 0 : Ge();
|
|
575
|
+
j[X] = (e) => {
|
|
764
576
|
if (e) return;
|
|
765
577
|
const t = v.number;
|
|
766
578
|
if (t) {
|
|
767
579
|
for (const [r, n] of Object.entries(t))
|
|
768
580
|
if (r[0] === "0" && m[h + 1]?.toLowerCase() === r[1]) {
|
|
769
|
-
|
|
770
|
-
const o =
|
|
771
|
-
return m.charCodeAt(h) ===
|
|
581
|
+
C(2);
|
|
582
|
+
const o = Nt(b(xr[n]));
|
|
583
|
+
return m.charCodeAt(h) === Tt ? (C(), [, BigInt("0" + r[1] + o)]) : [, parseInt(o, n)];
|
|
772
584
|
}
|
|
773
585
|
}
|
|
774
|
-
return
|
|
586
|
+
return Ge();
|
|
775
587
|
};
|
|
776
|
-
const
|
|
777
|
-
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" },
|
|
588
|
+
const Qr = 92, ut = 34, lt = 39, qr = { n: `
|
|
589
|
+
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" }, Vt = (e) => (t, r, n = "") => {
|
|
778
590
|
if (!(t || !v.string?.[String.fromCharCode(e)]))
|
|
779
|
-
return
|
|
591
|
+
return C(), b((o) => o - e && (o === Qr ? (n += qr[m[h + 1]] || m[h + 1], 2) : (n += m[h], 1))), m[h] === String.fromCharCode(e) ? C() : M("Bad string"), [, n];
|
|
780
592
|
};
|
|
781
|
-
|
|
782
|
-
|
|
593
|
+
j[ut] = Vt(ut);
|
|
594
|
+
j[lt] = Vt(lt);
|
|
783
595
|
v.string = { '"': !0 };
|
|
784
|
-
const
|
|
785
|
-
"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map((e) => $(e,
|
|
786
|
-
const
|
|
596
|
+
const Jr = 20;
|
|
597
|
+
"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map((e) => $(e, Jr, !0));
|
|
598
|
+
const Rt = (e, t, r, n) => typeof e == "string" ? (o) => t(o, e, o) : e[0] === "." ? (r = d(e[1]), n = e[2], (o) => t(r(o), n, o)) : e[0] === "[]" && e.length === 3 ? (r = d(e[1]), n = d(e[2]), (o) => t(r(o), n(o), o)) : e[0] === "()" && e.length === 2 ? Rt(e[1], t) : (() => {
|
|
787
599
|
throw Error("Invalid assignment target");
|
|
788
|
-
})(),
|
|
600
|
+
})(), at = {
|
|
789
601
|
"=": (e, t, r) => e[t] = r,
|
|
790
602
|
"+=": (e, t, r) => e[t] += r,
|
|
791
603
|
"-=": (e, t, r) => e[t] -= r,
|
|
@@ -798,450 +610,450 @@ const bt = (e, t, r, n) => typeof e == "string" ? (o) => t(o, e, o) : e[0] === "
|
|
|
798
610
|
">>=": (e, t, r) => e[t] >>= r,
|
|
799
611
|
"<<=": (e, t, r) => e[t] <<= r
|
|
800
612
|
};
|
|
801
|
-
for (const e in
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
$("||",
|
|
805
|
-
$("&&",
|
|
806
|
-
f("!", (e) => (e =
|
|
807
|
-
f("||", (e, t) => (e =
|
|
808
|
-
f("&&", (e, t) => (e =
|
|
809
|
-
const
|
|
810
|
-
$("|",
|
|
811
|
-
$("&",
|
|
812
|
-
$("^",
|
|
813
|
-
$(">>",
|
|
814
|
-
$("<<",
|
|
815
|
-
|
|
816
|
-
f("~", (e) => (e =
|
|
817
|
-
f("|", (e, t) => (e =
|
|
818
|
-
f("&", (e, t) => (e =
|
|
819
|
-
f("^", (e, t) => (e =
|
|
820
|
-
f(">>", (e, t) => (e =
|
|
821
|
-
f("<<", (e, t) => (e =
|
|
822
|
-
const
|
|
823
|
-
$("<",
|
|
824
|
-
$(">",
|
|
825
|
-
$("<=",
|
|
826
|
-
$(">=",
|
|
827
|
-
f(">", (e, t) => (e =
|
|
828
|
-
f("<", (e, t) => (e =
|
|
829
|
-
f(">=", (e, t) => (e =
|
|
830
|
-
f("<=", (e, t) => (e =
|
|
831
|
-
const
|
|
832
|
-
$("==",
|
|
833
|
-
$("!=",
|
|
834
|
-
f("==", (e, t) => (e =
|
|
835
|
-
f("!=", (e, t) => (e =
|
|
836
|
-
const
|
|
837
|
-
$("+",
|
|
838
|
-
$("-",
|
|
839
|
-
$("*",
|
|
840
|
-
$("/",
|
|
841
|
-
$("%",
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
f("+", (e, t) => t !== void 0 ? (e =
|
|
845
|
-
f("-", (e, t) => t !== void 0 ? (e =
|
|
846
|
-
f("*", (e, t) => (e =
|
|
847
|
-
f("/", (e, t) => (e =
|
|
848
|
-
f("%", (e, t) => (e =
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
const
|
|
613
|
+
for (const e in at) f(e, (t, r) => (r = d(r), Rt(t, (n, o, i) => at[e](n, o, r(i)))));
|
|
614
|
+
const Zr = 30, Yr = 40, en = 140;
|
|
615
|
+
R("!", en);
|
|
616
|
+
$("||", Zr);
|
|
617
|
+
$("&&", Yr);
|
|
618
|
+
f("!", (e) => (e = d(e), (t) => !e(t)));
|
|
619
|
+
f("||", (e, t) => (e = d(e), t = d(t), (r) => e(r) || t(r)));
|
|
620
|
+
f("&&", (e, t) => (e = d(e), t = d(t), (r) => e(r) && t(r)));
|
|
621
|
+
const tn = 50, rn = 60, nn = 70, Lt = 100, on = 140;
|
|
622
|
+
$("|", tn);
|
|
623
|
+
$("&", nn);
|
|
624
|
+
$("^", rn);
|
|
625
|
+
$(">>", Lt);
|
|
626
|
+
$("<<", Lt);
|
|
627
|
+
R("~", on);
|
|
628
|
+
f("~", (e) => (e = d(e), (t) => ~e(t)));
|
|
629
|
+
f("|", (e, t) => (e = d(e), t = d(t), (r) => e(r) | t(r)));
|
|
630
|
+
f("&", (e, t) => (e = d(e), t = d(t), (r) => e(r) & t(r)));
|
|
631
|
+
f("^", (e, t) => (e = d(e), t = d(t), (r) => e(r) ^ t(r)));
|
|
632
|
+
f(">>", (e, t) => (e = d(e), t = d(t), (r) => e(r) >> t(r)));
|
|
633
|
+
f("<<", (e, t) => (e = d(e), t = d(t), (r) => e(r) << t(r)));
|
|
634
|
+
const Se = 90;
|
|
635
|
+
$("<", Se);
|
|
636
|
+
$(">", Se);
|
|
637
|
+
$("<=", Se);
|
|
638
|
+
$(">=", Se);
|
|
639
|
+
f(">", (e, t) => (e = d(e), t = d(t), (r) => e(r) > t(r)));
|
|
640
|
+
f("<", (e, t) => (e = d(e), t = d(t), (r) => e(r) < t(r)));
|
|
641
|
+
f(">=", (e, t) => (e = d(e), t = d(t), (r) => e(r) >= t(r)));
|
|
642
|
+
f("<=", (e, t) => (e = d(e), t = d(t), (r) => e(r) <= t(r)));
|
|
643
|
+
const _t = 80;
|
|
644
|
+
$("==", _t);
|
|
645
|
+
$("!=", _t);
|
|
646
|
+
f("==", (e, t) => (e = d(e), t = d(t), (r) => e(r) == t(r)));
|
|
647
|
+
f("!=", (e, t) => (e = d(e), t = d(t), (r) => e(r) != t(r)));
|
|
648
|
+
const Mt = 110, Ke = 120, Ut = 140;
|
|
649
|
+
$("+", Mt);
|
|
650
|
+
$("-", Mt);
|
|
651
|
+
$("*", Ke);
|
|
652
|
+
$("/", Ke);
|
|
653
|
+
$("%", Ke);
|
|
654
|
+
R("+", Ut);
|
|
655
|
+
R("-", Ut);
|
|
656
|
+
f("+", (e, t) => t !== void 0 ? (e = d(e), t = d(t), (r) => e(r) + t(r)) : (e = d(e), (r) => +e(r)));
|
|
657
|
+
f("-", (e, t) => t !== void 0 ? (e = d(e), t = d(t), (r) => e(r) - t(r)) : (e = d(e), (r) => -e(r)));
|
|
658
|
+
f("*", (e, t) => (e = d(e), t = d(t), (r) => e(r) * t(r)));
|
|
659
|
+
f("/", (e, t) => (e = d(e), t = d(t), (r) => e(r) / t(r)));
|
|
660
|
+
f("%", (e, t) => (e = d(e), t = d(t), (r) => e(r) % t(r)));
|
|
661
|
+
const ue = 150;
|
|
662
|
+
O("++", ue, (e) => e ? ["++", e, null] : ["++", S(ue - 1)]);
|
|
663
|
+
O("--", ue, (e) => e ? ["--", e, null] : ["--", S(ue - 1)]);
|
|
664
|
+
const Xe = (e, t, r, n) => typeof e == "string" ? (o) => t(o, e) : e[0] === "." ? (r = d(e[1]), n = e[2], (o) => t(r(o), n)) : e[0] === "[]" && e.length === 3 ? (r = d(e[1]), n = d(e[2]), (o) => t(r(o), n(o))) : e[0] === "()" && e.length === 2 ? Xe(e[1], t) : (
|
|
853
665
|
// unwrap parens: (x)++
|
|
854
666
|
(() => {
|
|
855
667
|
throw Error("Invalid increment target");
|
|
856
668
|
})()
|
|
857
669
|
);
|
|
858
|
-
f("++", (e, t) =>
|
|
859
|
-
f("--", (e, t) =>
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
const
|
|
670
|
+
f("++", (e, t) => Xe(e, t === null ? (r, n) => r[n]++ : (r, n) => ++r[n]));
|
|
671
|
+
f("--", (e, t) => Xe(e, t === null ? (r, n) => r[n]-- : (r, n) => --r[n]));
|
|
672
|
+
const sn = 5, cn = 10;
|
|
673
|
+
Dt(",", cn);
|
|
674
|
+
Dt(";", sn, !0);
|
|
675
|
+
const Ht = (...e) => (e = e.map(d), (t) => {
|
|
864
676
|
let r;
|
|
865
677
|
for (const n of e) r = n(t);
|
|
866
678
|
return r;
|
|
867
679
|
});
|
|
868
|
-
f(",",
|
|
869
|
-
f(";",
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
$(".",
|
|
875
|
-
|
|
876
|
-
const
|
|
680
|
+
f(",", Ht);
|
|
681
|
+
f(";", Ht);
|
|
682
|
+
const dn = 170;
|
|
683
|
+
Be("()", dn);
|
|
684
|
+
const F = (e) => e?.[0] === "_" && e[1] === "_" || e === "constructor" || e === "prototype", xe = 170;
|
|
685
|
+
Ft("[]", xe);
|
|
686
|
+
$(".", xe);
|
|
687
|
+
Ft("()", xe);
|
|
688
|
+
const le = (e) => {
|
|
877
689
|
throw Error(e);
|
|
878
690
|
};
|
|
879
691
|
f("[]", (e, t) => t === void 0 ? (e = e ? e[0] === "," ? e.slice(1) : [e] : [], e = e.map((r) => r == null ? (() => {
|
|
880
|
-
}) : r[0] === "..." ? (r =
|
|
692
|
+
}) : r[0] === "..." ? (r = d(r[1]), (n) => r(n)) : (r = d(r), (n) => [r(n)])), (r) => e.flatMap((n) => n(r))) : (t == null && le("Missing index"), e = d(e), t = d(t), (r) => {
|
|
881
693
|
const n = t(r);
|
|
882
|
-
return
|
|
694
|
+
return F(n) ? void 0 : e(r)[n];
|
|
883
695
|
}));
|
|
884
|
-
f(".", (e, t) => (e =
|
|
696
|
+
f(".", (e, t) => (e = d(e), t = t[0] ? t : t[1], F(t) ? () => {
|
|
885
697
|
} : (r) => e(r)[t]));
|
|
886
698
|
f("()", (e, t) => {
|
|
887
|
-
if (t === void 0) return e == null ?
|
|
888
|
-
const r = (o) => o?.[0] === "," && o.slice(1).some((
|
|
889
|
-
r(t) &&
|
|
890
|
-
const n = t ? t[0] === "," ? (t = t.slice(1).map(
|
|
891
|
-
return
|
|
699
|
+
if (t === void 0) return e == null ? le("Empty ()") : d(e);
|
|
700
|
+
const r = (o) => o?.[0] === "," && o.slice(1).some((i) => i == null || r(i));
|
|
701
|
+
r(t) && le("Empty argument");
|
|
702
|
+
const n = t ? t[0] === "," ? (t = t.slice(1).map(d), (o) => t.map((i) => i(o))) : (t = d(t), (o) => [t(o)]) : () => [];
|
|
703
|
+
return Qe(e, (o, i, s) => o[i](...n(s)));
|
|
892
704
|
});
|
|
893
|
-
const
|
|
894
|
-
const
|
|
895
|
-
return
|
|
896
|
-
}) : e[0] === "[]" && e.length === 3 ? (r =
|
|
897
|
-
const
|
|
898
|
-
return
|
|
899
|
-
}) : (e =
|
|
705
|
+
const U = (e) => typeof e == "string" || Array.isArray(e) && (e[0] === "." || e[0] === "?." || e[0] === "[]" && e.length === 3 || e[0] === "?.[]" || e[0] === "()" && e.length === 2 && U(e[1]) || e[0] === "{}"), Qe = (e, t, r, n) => e == null ? le("Empty ()") : e[0] === "()" && e.length == 2 ? Qe(e[1], t) : typeof e == "string" ? (o) => t(o, e, o) : e[0] === "." ? (r = d(e[1]), n = e[2], (o) => t(r(o), n, o)) : e[0] === "?." ? (r = d(e[1]), n = e[2], (o) => {
|
|
706
|
+
const i = r(o);
|
|
707
|
+
return i == null ? void 0 : t(i, n, o);
|
|
708
|
+
}) : e[0] === "[]" && e.length === 3 ? (r = d(e[1]), n = d(e[2]), (o) => t(r(o), n(o), o)) : e[0] === "?.[]" ? (r = d(e[1]), n = d(e[2]), (o) => {
|
|
709
|
+
const i = r(o);
|
|
710
|
+
return i == null ? void 0 : t(i, n(o), o);
|
|
711
|
+
}) : (e = d(e), (o) => t([e(o)], 0, o)), B = Qe, un = 32, ln = v.space;
|
|
900
712
|
v.comment ??= { "//": `
|
|
901
713
|
`, "/*": "*/" };
|
|
902
|
-
let
|
|
714
|
+
let Ie;
|
|
903
715
|
v.space = () => {
|
|
904
|
-
|
|
905
|
-
for (var e; e =
|
|
906
|
-
for (var t = 0, r; r =
|
|
716
|
+
Ie || (Ie = Object.entries(v.comment).map(([o, i]) => [o, i, o.charCodeAt(0)]));
|
|
717
|
+
for (var e; e = ln(); ) {
|
|
718
|
+
for (var t = 0, r; r = Ie[t++]; )
|
|
907
719
|
if (e === r[2] && m.substr(h, r[0].length) === r[0]) {
|
|
908
720
|
var n = h + r[0].length;
|
|
909
721
|
if (r[1] === `
|
|
910
|
-
`) for (; m.charCodeAt(n) >=
|
|
722
|
+
`) for (; m.charCodeAt(n) >= un; ) n++;
|
|
911
723
|
else {
|
|
912
724
|
for (; m[n] && m.substr(n, r[1].length) !== r[1]; ) n++;
|
|
913
725
|
m[n] && (n += r[1].length);
|
|
914
726
|
}
|
|
915
|
-
|
|
727
|
+
Fe(n), e = 0;
|
|
916
728
|
break;
|
|
917
729
|
}
|
|
918
730
|
if (e) return e;
|
|
919
731
|
}
|
|
920
732
|
return e;
|
|
921
733
|
};
|
|
922
|
-
const
|
|
923
|
-
$("===",
|
|
924
|
-
$("!==",
|
|
925
|
-
f("===", (e, t) => (e =
|
|
926
|
-
f("!==", (e, t) => (e =
|
|
927
|
-
const
|
|
928
|
-
$("??",
|
|
929
|
-
f("??", (e, t) => (e =
|
|
930
|
-
const
|
|
931
|
-
$("**",
|
|
932
|
-
$("**=",
|
|
933
|
-
f("**", (e, t) => (e =
|
|
934
|
-
const
|
|
734
|
+
const zt = 80;
|
|
735
|
+
$("===", zt);
|
|
736
|
+
$("!==", zt);
|
|
737
|
+
f("===", (e, t) => (e = d(e), t = d(t), (r) => e(r) === t(r)));
|
|
738
|
+
f("!==", (e, t) => (e = d(e), t = d(t), (r) => e(r) !== t(r)));
|
|
739
|
+
const an = 30;
|
|
740
|
+
$("??", an);
|
|
741
|
+
f("??", (e, t) => (e = d(e), t = d(t), (r) => e(r) ?? t(r)));
|
|
742
|
+
const fn = 130, pn = 20;
|
|
743
|
+
$("**", fn, !0);
|
|
744
|
+
$("**=", pn, !0);
|
|
745
|
+
f("**", (e, t) => (e = d(e), t = d(t), (r) => e(r) ** t(r)));
|
|
746
|
+
const hn = (e) => {
|
|
935
747
|
throw Error(e);
|
|
936
748
|
};
|
|
937
|
-
f("**=", (e, t) => (
|
|
938
|
-
const
|
|
939
|
-
$("in",
|
|
940
|
-
$("of",
|
|
941
|
-
f("in", (e, t) => (e =
|
|
942
|
-
const
|
|
749
|
+
f("**=", (e, t) => (U(e) || hn("Invalid assignment target"), t = d(t), B(e, (r, n, o) => r[n] **= t(o))));
|
|
750
|
+
const bt = 90;
|
|
751
|
+
$("in", bt);
|
|
752
|
+
$("of", bt);
|
|
753
|
+
f("in", (e, t) => (e = d(e), t = d(t), (r) => e(r) in t(r)));
|
|
754
|
+
const mn = 20, gn = 100, yn = (e) => {
|
|
943
755
|
throw Error(e);
|
|
944
756
|
};
|
|
945
|
-
$(">>>",
|
|
946
|
-
$(">>>=",
|
|
947
|
-
f(">>>", (e, t) => (e =
|
|
948
|
-
f(">>>=", (e, t) => (
|
|
949
|
-
const
|
|
757
|
+
$(">>>", gn);
|
|
758
|
+
$(">>>=", mn, !0);
|
|
759
|
+
f(">>>", (e, t) => (e = d(e), t = d(t), (r) => e(r) >>> t(r)));
|
|
760
|
+
f(">>>=", (e, t) => (U(e) || yn("Invalid assignment target"), t = d(t), B(e, (r, n, o) => r[n] >>>= t(o))));
|
|
761
|
+
const qe = 5, vn = 10, $n = 20, Sn = (e) => e[0]?.[0] === "," ? e[0].slice(1) : e, ae = (e, t, r) => {
|
|
950
762
|
if (typeof e == "string") {
|
|
951
763
|
r[e] = t;
|
|
952
764
|
return;
|
|
953
765
|
}
|
|
954
|
-
const [n, ...o] = e,
|
|
766
|
+
const [n, ...o] = e, i = Sn(o);
|
|
955
767
|
if (n === "{}") {
|
|
956
|
-
const
|
|
957
|
-
for (const
|
|
958
|
-
if (Array.isArray(
|
|
768
|
+
const s = [];
|
|
769
|
+
for (const c of i) {
|
|
770
|
+
if (Array.isArray(c) && c[0] === "...") {
|
|
959
771
|
const g = {};
|
|
960
|
-
for (const
|
|
961
|
-
r[
|
|
772
|
+
for (const w in t) s.includes(w) || (g[w] = t[w]);
|
|
773
|
+
r[c[1]] = g;
|
|
962
774
|
break;
|
|
963
775
|
}
|
|
964
|
-
let
|
|
965
|
-
typeof
|
|
966
|
-
let p = t[
|
|
967
|
-
p === void 0 && a && (p =
|
|
776
|
+
let u, l, a;
|
|
777
|
+
typeof c == "string" ? u = l = c : c[0] === "=" ? (typeof c[1] == "string" ? u = l = c[1] : [, u, l] = c[1], a = c[2]) : [, u, l] = c, s.push(u);
|
|
778
|
+
let p = t[u];
|
|
779
|
+
p === void 0 && a && (p = d(a)(r)), ae(l, p, r);
|
|
968
780
|
}
|
|
969
781
|
} else if (n === "[]") {
|
|
970
|
-
let
|
|
971
|
-
for (const
|
|
972
|
-
if (
|
|
973
|
-
|
|
782
|
+
let s = 0;
|
|
783
|
+
for (const c of i) {
|
|
784
|
+
if (c === null) {
|
|
785
|
+
s++;
|
|
974
786
|
continue;
|
|
975
787
|
}
|
|
976
|
-
if (Array.isArray(
|
|
977
|
-
r[
|
|
788
|
+
if (Array.isArray(c) && c[0] === "...") {
|
|
789
|
+
r[c[1]] = t.slice(s);
|
|
978
790
|
break;
|
|
979
791
|
}
|
|
980
|
-
let
|
|
981
|
-
Array.isArray(
|
|
982
|
-
let a = t[
|
|
983
|
-
a === void 0 && l && (a =
|
|
792
|
+
let u = c, l;
|
|
793
|
+
Array.isArray(c) && c[0] === "=" && ([, u, l] = c);
|
|
794
|
+
let a = t[s++];
|
|
795
|
+
a === void 0 && l && (a = d(l)(r)), ae(u, a, r);
|
|
984
796
|
}
|
|
985
797
|
}
|
|
986
|
-
},
|
|
987
|
-
let t = S(
|
|
798
|
+
}, Bt = (e) => {
|
|
799
|
+
let t = S(vn - 1);
|
|
988
800
|
return t?.[0] === "in" || t?.[0] === "of" ? [t[0], [e, t[1]], t[2]] : t?.[0] === "," ? [e, ...t.slice(1)] : [e, t];
|
|
989
801
|
};
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
const
|
|
802
|
+
ee("let", qe + 1, () => Bt("let"));
|
|
803
|
+
ee("const", qe + 1, () => Bt("const"));
|
|
804
|
+
ee("var", qe, () => (N(), ["var", S($n)]));
|
|
805
|
+
const Gt = (...e) => (e = e.map((t) => {
|
|
994
806
|
if (typeof t == "string") return (r) => {
|
|
995
807
|
r[t] = void 0;
|
|
996
808
|
};
|
|
997
809
|
if (t[0] === "=") {
|
|
998
|
-
const [, r, n] = t, o =
|
|
999
|
-
return typeof r == "string" ? (
|
|
1000
|
-
|
|
1001
|
-
} : (
|
|
810
|
+
const [, r, n] = t, o = d(n);
|
|
811
|
+
return typeof r == "string" ? (i) => {
|
|
812
|
+
i[r] = o(i);
|
|
813
|
+
} : (i) => ae(r, o(i), i);
|
|
1002
814
|
}
|
|
1003
|
-
return
|
|
815
|
+
return d(t);
|
|
1004
816
|
}), (t) => {
|
|
1005
817
|
for (const r of e) r(t);
|
|
1006
818
|
});
|
|
1007
|
-
f("let",
|
|
1008
|
-
f("const",
|
|
819
|
+
f("let", Gt);
|
|
820
|
+
f("const", Gt);
|
|
1009
821
|
f("var", (e) => typeof e == "string" ? (t) => {
|
|
1010
822
|
t[e] = void 0;
|
|
1011
823
|
} : () => {
|
|
1012
824
|
});
|
|
1013
|
-
const
|
|
825
|
+
const Je = 20, Ae = (e) => {
|
|
1014
826
|
throw Error(e);
|
|
1015
827
|
};
|
|
1016
|
-
$("||=",
|
|
1017
|
-
$("&&=",
|
|
1018
|
-
$("??=",
|
|
828
|
+
$("||=", Je, !0);
|
|
829
|
+
$("&&=", Je, !0);
|
|
830
|
+
$("??=", Je, !0);
|
|
1019
831
|
f("=", (e, t) => {
|
|
1020
832
|
if (Array.isArray(e) && (e[0] === "let" || e[0] === "const" || e[0] === "var")) {
|
|
1021
833
|
const r = e[1];
|
|
1022
|
-
return t =
|
|
834
|
+
return t = d(t), typeof r == "string" ? (n) => {
|
|
1023
835
|
n[r] = t(n);
|
|
1024
|
-
} : (n) =>
|
|
836
|
+
} : (n) => ae(r, t(n), n);
|
|
1025
837
|
}
|
|
1026
|
-
return
|
|
838
|
+
return U(e) || Ae("Invalid assignment target"), t = d(t), B(e, (r, n, o) => r[n] = t(o));
|
|
1027
839
|
});
|
|
1028
|
-
f("||=", (e, t) => (
|
|
1029
|
-
f("&&=", (e, t) => (
|
|
1030
|
-
f("??=", (e, t) => (
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
f("?", (e, t, r) => (e =
|
|
1040
|
-
const
|
|
1041
|
-
$("=>",
|
|
840
|
+
f("||=", (e, t) => (U(e) || Ae("Invalid assignment target"), t = d(t), B(e, (r, n, o) => r[n] ||= t(o))));
|
|
841
|
+
f("&&=", (e, t) => (U(e) || Ae("Invalid assignment target"), t = d(t), B(e, (r, n, o) => r[n] &&= t(o))));
|
|
842
|
+
f("??=", (e, t) => (U(e) || Ae("Invalid assignment target"), t = d(t), B(e, (r, n, o) => r[n] ??= t(o))));
|
|
843
|
+
Y("true", !0);
|
|
844
|
+
Y("false", !1);
|
|
845
|
+
Y("null", null);
|
|
846
|
+
ee("undefined", 200, () => []);
|
|
847
|
+
Y("NaN", NaN);
|
|
848
|
+
Y("Infinity", 1 / 0);
|
|
849
|
+
const Oe = 20;
|
|
850
|
+
O("?", Oe, (e, t, r) => e && (t = S(Oe - 1)) && b((n) => n === 58) && (r = S(Oe - 1), ["?", e, t, r]));
|
|
851
|
+
f("?", (e, t, r) => (e = d(e), t = d(t), r = d(r), (n) => e(n) ? t(n) : r(n)));
|
|
852
|
+
const An = [], En = 20;
|
|
853
|
+
$("=>", En, !0);
|
|
1042
854
|
f("=>", (e, t) => {
|
|
1043
855
|
e = e?.[0] === "()" ? e[1] : e;
|
|
1044
856
|
const r = e ? e[0] === "," ? e.slice(1) : [e] : [];
|
|
1045
857
|
let n = -1, o = null;
|
|
1046
|
-
const
|
|
1047
|
-
Array.isArray(
|
|
1048
|
-
const
|
|
1049
|
-
return t =
|
|
858
|
+
const i = r[r.length - 1];
|
|
859
|
+
Array.isArray(i) && i[0] === "..." && (n = r.length - 1, o = i[1], r.length--);
|
|
860
|
+
const s = t?.[0] === "{}";
|
|
861
|
+
return t = d(s ? ["{", t[1]] : t), (c) => (...u) => {
|
|
1050
862
|
const l = {};
|
|
1051
|
-
r.forEach((p, g) => l[p] =
|
|
863
|
+
r.forEach((p, g) => l[p] = u[g]), o && (l[o] = u.slice(n));
|
|
1052
864
|
const a = new Proxy(l, {
|
|
1053
|
-
get: (p, g) => g in p ? p[g] :
|
|
1054
|
-
set: (p, g,
|
|
1055
|
-
has: (p, g) => g in p || (
|
|
865
|
+
get: (p, g) => g in p ? p[g] : c?.[g],
|
|
866
|
+
set: (p, g, w) => ((g in p ? p : c)[g] = w, !0),
|
|
867
|
+
has: (p, g) => g in p || (c ? g in c : !1)
|
|
1056
868
|
});
|
|
1057
869
|
try {
|
|
1058
870
|
const p = t(a);
|
|
1059
|
-
return
|
|
871
|
+
return s ? void 0 : p;
|
|
1060
872
|
} catch (p) {
|
|
1061
|
-
if (p ===
|
|
873
|
+
if (p === An) return p[0];
|
|
1062
874
|
throw p;
|
|
1063
875
|
}
|
|
1064
876
|
};
|
|
1065
877
|
});
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
f("...", (e) => (e =
|
|
1069
|
-
const
|
|
1070
|
-
|
|
878
|
+
const Cn = 140;
|
|
879
|
+
R("...", Cn);
|
|
880
|
+
f("...", (e) => (e = d(e), (t) => Object.entries(e(t))));
|
|
881
|
+
const ft = 170;
|
|
882
|
+
O("?.", ft, (e, t) => {
|
|
1071
883
|
if (!e) return;
|
|
1072
|
-
const r =
|
|
1073
|
-
return r === 40 ? (
|
|
884
|
+
const r = N();
|
|
885
|
+
return r === 40 ? (C(), ["?.()", e, S(0, 41) || null]) : r === 91 ? (C(), ["?.[]", e, S(0, 93)]) : (t = S(ft), t ? ["?.", e, t] : void 0);
|
|
1074
886
|
});
|
|
1075
|
-
f("?.", (e, t) => (e =
|
|
887
|
+
f("?.", (e, t) => (e = d(e), F(t) ? () => {
|
|
1076
888
|
} : (r) => e(r)?.[t]));
|
|
1077
|
-
f("?.[]", (e, t) => (e =
|
|
889
|
+
f("?.[]", (e, t) => (e = d(e), t = d(t), (r) => {
|
|
1078
890
|
const n = t(r);
|
|
1079
|
-
return
|
|
891
|
+
return F(n) ? void 0 : e(r)?.[n];
|
|
1080
892
|
}));
|
|
1081
893
|
f("?.()", (e, t) => {
|
|
1082
|
-
const r = t ? t[0] === "," ? (t = t.slice(1).map(
|
|
894
|
+
const r = t ? t[0] === "," ? (t = t.slice(1).map(d), (o) => t.map((i) => i(o))) : (t = d(t), (o) => [t(o)]) : () => [];
|
|
1083
895
|
if (e[0] === "?.") {
|
|
1084
|
-
const o =
|
|
1085
|
-
return
|
|
1086
|
-
} : (
|
|
896
|
+
const o = d(e[1]), i = e[2];
|
|
897
|
+
return F(i) ? () => {
|
|
898
|
+
} : (s) => o(s)?.[i]?.(...r(s));
|
|
1087
899
|
}
|
|
1088
900
|
if (e[0] === "?.[]") {
|
|
1089
|
-
const o =
|
|
1090
|
-
return (
|
|
1091
|
-
const
|
|
1092
|
-
return
|
|
901
|
+
const o = d(e[1]), i = d(e[2]);
|
|
902
|
+
return (s) => {
|
|
903
|
+
const c = o(s), u = i(s);
|
|
904
|
+
return F(u) ? void 0 : c?.[u]?.(...r(s));
|
|
1093
905
|
};
|
|
1094
906
|
}
|
|
1095
907
|
if (e[0] === ".") {
|
|
1096
|
-
const o =
|
|
1097
|
-
return
|
|
1098
|
-
} : (
|
|
908
|
+
const o = d(e[1]), i = e[2];
|
|
909
|
+
return F(i) ? () => {
|
|
910
|
+
} : (s) => o(s)?.[i]?.(...r(s));
|
|
1099
911
|
}
|
|
1100
912
|
if (e[0] === "[]" && e.length === 3) {
|
|
1101
|
-
const o =
|
|
1102
|
-
return (
|
|
1103
|
-
const
|
|
1104
|
-
return
|
|
913
|
+
const o = d(e[1]), i = d(e[2]);
|
|
914
|
+
return (s) => {
|
|
915
|
+
const c = o(s), u = i(s);
|
|
916
|
+
return F(u) ? void 0 : c?.[u]?.(...r(s));
|
|
1105
917
|
};
|
|
1106
918
|
}
|
|
1107
|
-
const n =
|
|
919
|
+
const n = d(e);
|
|
1108
920
|
return (o) => n(o)?.(...r(o));
|
|
1109
921
|
});
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
922
|
+
const x = 140;
|
|
923
|
+
R("typeof", x);
|
|
924
|
+
R("void", x);
|
|
925
|
+
R("delete", x);
|
|
926
|
+
ee(
|
|
1115
927
|
"new",
|
|
1116
|
-
|
|
1117
|
-
() =>
|
|
928
|
+
x,
|
|
929
|
+
() => Mr(".target") ? (C(7), ["new.target"]) : ["new", S(x)]
|
|
1118
930
|
);
|
|
1119
|
-
f("typeof", (e) => (e =
|
|
1120
|
-
f("void", (e) => (e =
|
|
931
|
+
f("typeof", (e) => (e = d(e), (t) => typeof e(t)));
|
|
932
|
+
f("void", (e) => (e = d(e), (t) => (e(t), void 0)));
|
|
1121
933
|
f("delete", (e) => {
|
|
1122
934
|
if (e[0] === ".") {
|
|
1123
|
-
const t =
|
|
935
|
+
const t = d(e[1]), r = e[2];
|
|
1124
936
|
return (n) => delete t(n)[r];
|
|
1125
937
|
}
|
|
1126
938
|
if (e[0] === "[]") {
|
|
1127
|
-
const t =
|
|
939
|
+
const t = d(e[1]), r = d(e[2]);
|
|
1128
940
|
return (n) => delete t(n)[r(n)];
|
|
1129
941
|
}
|
|
1130
942
|
return () => !0;
|
|
1131
943
|
});
|
|
1132
944
|
f("new", (e) => {
|
|
1133
|
-
const t =
|
|
945
|
+
const t = d(e?.[0] === "()" ? e[1] : e), r = e?.[0] === "()" ? e[2] : null, n = r ? r[0] === "," ? /* @__PURE__ */ ((o) => (i) => o.map((s) => s(i)))(r.slice(1).map(d)) : /* @__PURE__ */ ((o) => (i) => [o(i)])(d(r)) : () => [];
|
|
1134
946
|
return (o) => new (t(o))(...n(o));
|
|
1135
947
|
});
|
|
1136
|
-
const
|
|
948
|
+
const Ze = /* @__PURE__ */ Symbol("accessor"), Ye = 20, wn = 40, Kt = 41, Xt = 123, xt = 125, Qt = (e) => (t) => {
|
|
1137
949
|
if (t) return;
|
|
1138
|
-
|
|
1139
|
-
const r =
|
|
1140
|
-
if (!r || (
|
|
1141
|
-
|
|
1142
|
-
const n = S(0,
|
|
1143
|
-
return
|
|
950
|
+
N();
|
|
951
|
+
const r = b(v.id);
|
|
952
|
+
if (!r || (N(), m.charCodeAt(h) !== wn)) return !1;
|
|
953
|
+
C();
|
|
954
|
+
const n = S(0, Kt);
|
|
955
|
+
return N(), m.charCodeAt(h) !== Xt ? !1 : (C(), [e, r, n, S(0, xt)]);
|
|
1144
956
|
};
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
957
|
+
O("get", Ye - 1, Qt("get"));
|
|
958
|
+
O("set", Ye - 1, Qt("set"));
|
|
959
|
+
O("(", Ye - 1, (e) => {
|
|
1148
960
|
if (!e || typeof e != "string") return;
|
|
1149
|
-
const t = S(0,
|
|
1150
|
-
if (
|
|
1151
|
-
return
|
|
961
|
+
const t = S(0, Kt) || null;
|
|
962
|
+
if (N(), m.charCodeAt(h) === Xt)
|
|
963
|
+
return C(), [":", e, ["=>", ["()", t], S(0, xt) || null]];
|
|
1152
964
|
});
|
|
1153
|
-
f("get", (e, t) => (t = t ?
|
|
1154
|
-
}, (r) => [[
|
|
965
|
+
f("get", (e, t) => (t = t ? d(t) : () => {
|
|
966
|
+
}, (r) => [[Ze, e, {
|
|
1155
967
|
get: function() {
|
|
1156
968
|
const n = Object.create(r || {});
|
|
1157
969
|
return n.this = this, t(n);
|
|
1158
970
|
}
|
|
1159
971
|
}]]));
|
|
1160
|
-
f("set", (e, t, r) => (r = r ?
|
|
1161
|
-
}, (n) => [[
|
|
972
|
+
f("set", (e, t, r) => (r = r ? d(r) : () => {
|
|
973
|
+
}, (n) => [[Ze, e, {
|
|
1162
974
|
set: function(o) {
|
|
1163
|
-
const
|
|
1164
|
-
|
|
975
|
+
const i = Object.create(n || {});
|
|
976
|
+
i.this = this, i[t] = o, r(i);
|
|
1165
977
|
}
|
|
1166
978
|
}]]));
|
|
1167
|
-
const
|
|
1168
|
-
v.prop = (e) =>
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
$(":",
|
|
979
|
+
const In = 20, qt = 200;
|
|
980
|
+
v.prop = (e) => _r(e) !== 58;
|
|
981
|
+
const On = (e) => e == null || typeof e == "string" || [":", ",", "...", "get", "set"].includes(e[0]);
|
|
982
|
+
Be("[]", qt);
|
|
983
|
+
Be("{}", qt);
|
|
984
|
+
$(":", In - 1, !0);
|
|
1173
985
|
f("{}", (e, t) => {
|
|
1174
986
|
if (t !== void 0) return;
|
|
1175
|
-
if (!
|
|
987
|
+
if (!On(e)) return d(["{", e]);
|
|
1176
988
|
e = e ? e[0] !== "," ? [e] : e.slice(1) : [];
|
|
1177
|
-
const r = e.map((n) =>
|
|
989
|
+
const r = e.map((n) => d(typeof n == "string" ? [":", n, n] : n));
|
|
1178
990
|
return (n) => {
|
|
1179
|
-
const o = {},
|
|
1180
|
-
for (const
|
|
1181
|
-
if (
|
|
1182
|
-
const [,
|
|
1183
|
-
|
|
1184
|
-
} else o[
|
|
1185
|
-
for (const
|
|
991
|
+
const o = {}, i = {};
|
|
992
|
+
for (const s of r.flatMap((c) => c(n)))
|
|
993
|
+
if (s[0] === Ze) {
|
|
994
|
+
const [, c, u] = s;
|
|
995
|
+
i[c] = { ...i[c], ...u, configurable: !0, enumerable: !0 };
|
|
996
|
+
} else o[s[0]] = s[1];
|
|
997
|
+
for (const s in i) Object.defineProperty(o, s, i[s]);
|
|
1186
998
|
return o;
|
|
1187
999
|
};
|
|
1188
1000
|
});
|
|
1189
|
-
f("{", (e) => (e = e ?
|
|
1001
|
+
f("{", (e) => (e = e ? d(e) : () => {
|
|
1190
1002
|
}, (t) => e(Object.create(t))));
|
|
1191
|
-
f(":", (e, t) => (t =
|
|
1192
|
-
const
|
|
1193
|
-
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" },
|
|
1003
|
+
f(":", (e, t) => (t = d(t), Array.isArray(e) ? (e = d(e), (r) => [[e(r), t(r)]]) : (r) => [[e, t(r)]]));
|
|
1004
|
+
const kn = 170, fe = 96, jn = 36, Wn = 123, Pn = 92, Dn = { n: `
|
|
1005
|
+
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" }, pt = () => {
|
|
1194
1006
|
const e = [];
|
|
1195
|
-
for (let t = "", r; (r = m.charCodeAt(h)) !==
|
|
1196
|
-
r ? r ===
|
|
1197
|
-
return
|
|
1198
|
-
},
|
|
1199
|
-
|
|
1007
|
+
for (let t = "", r; (r = m.charCodeAt(h)) !== fe; )
|
|
1008
|
+
r ? r === Pn ? (C(), t += Dn[m[h]] || m[h], C()) : r === jn && m.charCodeAt(h + 1) === Wn ? (t && e.push([, t]), t = "", C(2), e.push(S(0, 125))) : (t += m[h], C(), r = m.charCodeAt(h), r === fe && t && e.push([, t])) : M("Unterminated template");
|
|
1009
|
+
return C(), e;
|
|
1010
|
+
}, Fn = j[fe];
|
|
1011
|
+
j[fe] = (e, t) => e && t < kn ? v.asi && v.newline ? void 0 : (C(), ["``", e, ...pt()]) : (
|
|
1200
1012
|
// tagged
|
|
1201
1013
|
e ? (
|
|
1202
1014
|
// plain
|
|
1203
|
-
|
|
1204
|
-
) : (
|
|
1015
|
+
Fn?.(e, t)
|
|
1016
|
+
) : (C(), ((r) => r.length < 2 && r[0]?.[0] === void 0 ? r[0] || [, ""] : ["`", ...r])(pt()))
|
|
1205
1017
|
);
|
|
1206
|
-
f("`", (...e) => (e = e.map(
|
|
1018
|
+
f("`", (...e) => (e = e.map(d), (t) => e.map((r) => r(t)).join("")));
|
|
1207
1019
|
f("``", (e, ...t) => {
|
|
1208
|
-
e =
|
|
1020
|
+
e = d(e);
|
|
1209
1021
|
const r = [], n = [];
|
|
1210
|
-
for (const
|
|
1211
|
-
Array.isArray(
|
|
1022
|
+
for (const i of t)
|
|
1023
|
+
Array.isArray(i) && i[0] === void 0 ? r.push(i[1]) : n.push(d(i));
|
|
1212
1024
|
const o = Object.assign([...r], { raw: r });
|
|
1213
|
-
return (
|
|
1025
|
+
return (i) => e(i)(o, ...n.map((s) => s(i)));
|
|
1214
1026
|
});
|
|
1215
1027
|
v.string["'"] = !0;
|
|
1216
1028
|
v.number = { "0x": 16, "0b": 2, "0o": 8 };
|
|
1217
|
-
const
|
|
1029
|
+
const Tn = {
|
|
1218
1030
|
log: (e, t) => (t ? console.log(t, e) : console.log(e), e)
|
|
1219
|
-
},
|
|
1220
|
-
function
|
|
1221
|
-
const t =
|
|
1031
|
+
}, Nn = 2e3, te = /* @__PURE__ */ new Map();
|
|
1032
|
+
function et(e) {
|
|
1033
|
+
const t = te.get(e);
|
|
1222
1034
|
if (t !== void 0)
|
|
1223
1035
|
return t;
|
|
1224
|
-
const r =
|
|
1225
|
-
return
|
|
1036
|
+
const r = d(v(Vn(e)));
|
|
1037
|
+
return te.size >= Nn && te.clear(), te.set(e, r), r;
|
|
1226
1038
|
}
|
|
1227
|
-
function
|
|
1228
|
-
return
|
|
1039
|
+
function G(e, t, r, n, o, i) {
|
|
1040
|
+
return et(e)({
|
|
1229
1041
|
$form: t,
|
|
1230
1042
|
$meta: r,
|
|
1231
1043
|
$errors: n,
|
|
1232
1044
|
$formIsInvalid: o,
|
|
1233
|
-
$log:
|
|
1045
|
+
$log: Tn.log,
|
|
1234
1046
|
$fn: {},
|
|
1235
|
-
...
|
|
1047
|
+
...i
|
|
1236
1048
|
}) === !0;
|
|
1237
1049
|
}
|
|
1238
|
-
function
|
|
1050
|
+
function Vn(e) {
|
|
1239
1051
|
return e.replace(
|
|
1240
1052
|
/(\?\.|\.)(\d+)/g,
|
|
1241
|
-
(t, r, n, o) => r === "." &&
|
|
1053
|
+
(t, r, n, o) => r === "." && Rn(e, o) ? t : r === "?." ? `?.[${n}]` : `[${n}]`
|
|
1242
1054
|
);
|
|
1243
1055
|
}
|
|
1244
|
-
function
|
|
1056
|
+
function Rn(e, t) {
|
|
1245
1057
|
let r = t - 1, n = !1;
|
|
1246
1058
|
for (; r >= 0 && e[r] >= "0" && e[r] <= "9"; )
|
|
1247
1059
|
n = !0, r--;
|
|
@@ -1250,289 +1062,289 @@ function Bn(e, t) {
|
|
|
1250
1062
|
const o = e[r];
|
|
1251
1063
|
return n ? !/[\w$.\]]/.test(o) : !/[\w$)\]]/.test(o);
|
|
1252
1064
|
}
|
|
1253
|
-
const
|
|
1065
|
+
const Ln = (e) => (t, r) => {
|
|
1254
1066
|
let n = t.formDef.states;
|
|
1255
1067
|
if (!n || Object.keys(n).length === 0 || t.formHealth.status === "errored")
|
|
1256
1068
|
return t;
|
|
1257
|
-
const { $formIsInvalid: o, $errors:
|
|
1258
|
-
n =
|
|
1259
|
-
let
|
|
1069
|
+
const { $formIsInvalid: o, $errors: i } = r ?? ve(t);
|
|
1070
|
+
n = _n(n);
|
|
1071
|
+
let s = [], c = { status: "ok" };
|
|
1260
1072
|
try {
|
|
1261
|
-
|
|
1262
|
-
const l = n[
|
|
1073
|
+
s = Object.keys(n).map((u) => {
|
|
1074
|
+
const l = n[u];
|
|
1263
1075
|
let a;
|
|
1264
1076
|
try {
|
|
1265
|
-
a =
|
|
1077
|
+
a = G(l, t.data, t.meta, i, o, {
|
|
1266
1078
|
$fn: e
|
|
1267
1079
|
});
|
|
1268
1080
|
} catch {
|
|
1269
1081
|
a = !1;
|
|
1270
1082
|
}
|
|
1271
|
-
return a === !0 ?
|
|
1272
|
-
}).filter((
|
|
1273
|
-
} catch (
|
|
1274
|
-
const l =
|
|
1275
|
-
|
|
1083
|
+
return a === !0 ? u : void 0;
|
|
1084
|
+
}).filter((u) => u !== void 0);
|
|
1085
|
+
} catch (u) {
|
|
1086
|
+
const l = u, a = k.calculateCurrentStateError;
|
|
1087
|
+
c = {
|
|
1276
1088
|
status: "errored",
|
|
1277
1089
|
message: `[${a}] ${l.message}`,
|
|
1278
1090
|
code: a
|
|
1279
1091
|
};
|
|
1280
1092
|
}
|
|
1281
|
-
return { ...t, currentStates:
|
|
1093
|
+
return { ...t, currentStates: s, formHealth: c };
|
|
1282
1094
|
};
|
|
1283
|
-
function
|
|
1095
|
+
function _n(e) {
|
|
1284
1096
|
const t = {};
|
|
1285
1097
|
function r(n) {
|
|
1286
|
-
const o = n.split(":"),
|
|
1287
|
-
for (let
|
|
1288
|
-
|
|
1289
|
-
return
|
|
1098
|
+
const o = n.split(":"), i = [];
|
|
1099
|
+
for (let s = 0; s < o.length; s++)
|
|
1100
|
+
i.push(o.slice(0, s + 1).join(":"));
|
|
1101
|
+
return i;
|
|
1290
1102
|
}
|
|
1291
1103
|
for (const [n, o] of Object.entries(e)) {
|
|
1292
|
-
const
|
|
1293
|
-
for (const
|
|
1294
|
-
e[
|
|
1295
|
-
t[n] =
|
|
1104
|
+
const i = r(n), s = [];
|
|
1105
|
+
for (const c of i)
|
|
1106
|
+
e[c] && s.push(`(${e[c]})`);
|
|
1107
|
+
t[n] = s.join(" && ");
|
|
1296
1108
|
}
|
|
1297
1109
|
return t;
|
|
1298
1110
|
}
|
|
1299
|
-
const
|
|
1300
|
-
function
|
|
1111
|
+
const Q = (e) => e !== void 0 && typeof e == "object" && e !== null && "when" in e;
|
|
1112
|
+
function ht(e) {
|
|
1301
1113
|
if (typeof e != "object" || e === null)
|
|
1302
1114
|
return !1;
|
|
1303
1115
|
const t = Object.getPrototypeOf(e);
|
|
1304
1116
|
return t === Object.prototype || t === null;
|
|
1305
1117
|
}
|
|
1306
|
-
function
|
|
1118
|
+
function pe(e, t) {
|
|
1307
1119
|
if (e === t)
|
|
1308
1120
|
return !0;
|
|
1309
1121
|
if (Array.isArray(e) && Array.isArray(t))
|
|
1310
|
-
return e.length === t.length && e.every((r, n) =>
|
|
1311
|
-
if (
|
|
1122
|
+
return e.length === t.length && e.every((r, n) => pe(r, t[n]));
|
|
1123
|
+
if (ht(e) && ht(t)) {
|
|
1312
1124
|
const r = Object.keys(e);
|
|
1313
|
-
return r.length !== Object.keys(t).length ? !1 : r.every((n) => n in t &&
|
|
1125
|
+
return r.length !== Object.keys(t).length ? !1 : r.every((n) => n in t && pe(e[n], t[n]));
|
|
1314
1126
|
}
|
|
1315
1127
|
return !1;
|
|
1316
1128
|
}
|
|
1317
|
-
const
|
|
1318
|
-
const { $formIsInvalid: n, $errors: o } = r ??
|
|
1129
|
+
const Mn = (e) => (t, r) => {
|
|
1130
|
+
const { $formIsInvalid: n, $errors: o } = r ?? ve(t);
|
|
1319
1131
|
return {
|
|
1320
1132
|
...t,
|
|
1321
|
-
widgetFlags:
|
|
1133
|
+
widgetFlags: Un(t, o, n, e)
|
|
1322
1134
|
};
|
|
1323
1135
|
};
|
|
1324
|
-
function
|
|
1136
|
+
function Un(e, t, r, n) {
|
|
1325
1137
|
const o = [];
|
|
1326
|
-
for (const [
|
|
1327
|
-
if (
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1330
|
-
} else
|
|
1331
|
-
const
|
|
1332
|
-
(
|
|
1333
|
-
|
|
1334
|
-
const
|
|
1335
|
-
return
|
|
1138
|
+
for (const [s, c] of Object.entries(e.resolvedSources))
|
|
1139
|
+
if (P(c)) {
|
|
1140
|
+
const u = yt(s, c, e);
|
|
1141
|
+
mt(u) && o.push(u);
|
|
1142
|
+
} else mt(c) && o.push(yt(s, c, e));
|
|
1143
|
+
const i = o.reduce(
|
|
1144
|
+
(s, c) => {
|
|
1145
|
+
s[c.uid] = s[c.uid] || {};
|
|
1146
|
+
const u = e.repeaterItemScopes[c.uid], l = u ? { $item: V(e.data, u.itemPath), $index: u.index, $fn: n } : { $fn: n };
|
|
1147
|
+
return c.include && "in" in c.include ? s[c.uid].hidden = !c.include.in.some(
|
|
1336
1148
|
(a) => e.currentStates.includes(a)
|
|
1337
|
-
) :
|
|
1338
|
-
|
|
1149
|
+
) : c.include && "when" in c.include && (s[c.uid].hidden = !G(
|
|
1150
|
+
c.include.when,
|
|
1339
1151
|
e.data,
|
|
1340
1152
|
e.meta,
|
|
1341
1153
|
t,
|
|
1342
1154
|
r,
|
|
1343
1155
|
l
|
|
1344
|
-
)),
|
|
1156
|
+
)), c.exclude && "from" in c.exclude ? s[c.uid].hidden = c.exclude.from.some(
|
|
1345
1157
|
(a) => e.currentStates.includes(a)
|
|
1346
|
-
) :
|
|
1347
|
-
|
|
1158
|
+
) : c.exclude && "when" in c.exclude && (s[c.uid].hidden = G(
|
|
1159
|
+
c.exclude.when,
|
|
1348
1160
|
e.data,
|
|
1349
1161
|
e.meta,
|
|
1350
1162
|
t,
|
|
1351
1163
|
r,
|
|
1352
1164
|
l
|
|
1353
|
-
)), (
|
|
1354
|
-
|
|
1165
|
+
)), (I(c) || oe(c)) && Q(c.disabled) && (s[c.uid].disabled = G(
|
|
1166
|
+
c.disabled.when,
|
|
1355
1167
|
e.data,
|
|
1356
1168
|
e.meta,
|
|
1357
1169
|
t,
|
|
1358
1170
|
r,
|
|
1359
1171
|
l
|
|
1360
|
-
)),
|
|
1361
|
-
|
|
1172
|
+
)), I(c) && Q(c.readonly) && (s[c.uid].readonly = G(
|
|
1173
|
+
c.readonly.when,
|
|
1362
1174
|
e.data,
|
|
1363
1175
|
e.meta,
|
|
1364
1176
|
t,
|
|
1365
1177
|
r,
|
|
1366
1178
|
l
|
|
1367
|
-
)),
|
|
1179
|
+
)), s;
|
|
1368
1180
|
},
|
|
1369
1181
|
{}
|
|
1370
1182
|
);
|
|
1371
|
-
return
|
|
1183
|
+
return Hn(e, i), i;
|
|
1372
1184
|
}
|
|
1373
|
-
function
|
|
1374
|
-
return !!(e.include && ("in" in e.include || "when" in e.include) || e.exclude && ("from" in e.exclude || "when" in e.exclude) || (
|
|
1185
|
+
function mt(e) {
|
|
1186
|
+
return !!(e.include && ("in" in e.include || "when" in e.include) || e.exclude && ("from" in e.exclude || "when" in e.exclude) || (I(e) || oe(e)) && Q(e.disabled) || I(e) && Q(e.readonly));
|
|
1375
1187
|
}
|
|
1376
|
-
function
|
|
1188
|
+
function Hn(e, t) {
|
|
1377
1189
|
const r = Object.keys(t).filter((n) => t[n].hidden === !0);
|
|
1378
1190
|
for (const n of r)
|
|
1379
|
-
|
|
1191
|
+
Jt(n, e, t);
|
|
1380
1192
|
}
|
|
1381
|
-
function
|
|
1193
|
+
function Jt(e, t, r) {
|
|
1382
1194
|
const n = t.resolvedSources[e];
|
|
1383
1195
|
if (n !== void 0) {
|
|
1384
|
-
if (
|
|
1196
|
+
if ($e(n) || P(n) && n.path !== void 0) {
|
|
1385
1197
|
const o = `${n.path}.`;
|
|
1386
|
-
for (const [
|
|
1387
|
-
|
|
1198
|
+
for (const [i, s] of Object.entries(t.repeaterItemScopes))
|
|
1199
|
+
s.itemPath.startsWith(o) && gt(i, r);
|
|
1388
1200
|
}
|
|
1389
|
-
if (
|
|
1390
|
-
const o =
|
|
1391
|
-
for (const
|
|
1392
|
-
const
|
|
1393
|
-
if (t.resolvedSources[
|
|
1201
|
+
if (_(n)) {
|
|
1202
|
+
const o = Z(e);
|
|
1203
|
+
for (const i of n.children) {
|
|
1204
|
+
const s = o.length > 0 ? ze(i.uid, o) : i.uid;
|
|
1205
|
+
if (t.resolvedSources[s] === void 0)
|
|
1394
1206
|
continue;
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1207
|
+
const c = r[s]?.hidden === !0;
|
|
1208
|
+
gt(s, r), c || Jt(s, t, r);
|
|
1397
1209
|
}
|
|
1398
1210
|
}
|
|
1399
1211
|
}
|
|
1400
1212
|
}
|
|
1401
|
-
function
|
|
1213
|
+
function gt(e, t) {
|
|
1402
1214
|
t[e] = t[e] || {}, t[e].hidden = !0;
|
|
1403
1215
|
}
|
|
1404
|
-
function
|
|
1216
|
+
function yt(e, t, r) {
|
|
1405
1217
|
const n = r.repeaterItemScopes[e];
|
|
1406
1218
|
let o;
|
|
1407
|
-
|
|
1219
|
+
P(t) ? (o = {
|
|
1408
1220
|
...t({
|
|
1409
1221
|
$form: r.data,
|
|
1410
|
-
$item: n ?
|
|
1222
|
+
$item: n ? V(r.data, n.itemPath) : void 0,
|
|
1411
1223
|
$index: n?.index,
|
|
1412
1224
|
errors: void 0,
|
|
1413
1225
|
touched: void 0,
|
|
1414
1226
|
translate: void 0
|
|
1415
1227
|
})
|
|
1416
1228
|
}, o.uid = e) : o = t;
|
|
1417
|
-
const
|
|
1418
|
-
return
|
|
1229
|
+
const i = Z(e);
|
|
1230
|
+
return i.length > 0 && (o = Vr(o, i)), o;
|
|
1419
1231
|
}
|
|
1420
|
-
const
|
|
1232
|
+
const Zt = (e, t) => (r, n) => {
|
|
1421
1233
|
try {
|
|
1422
|
-
const o = n ??
|
|
1234
|
+
const o = n ?? ve(r);
|
|
1423
1235
|
return {
|
|
1424
1236
|
...r,
|
|
1425
|
-
calculatedWidgets:
|
|
1237
|
+
calculatedWidgets: zn(r, e, t, o)
|
|
1426
1238
|
};
|
|
1427
1239
|
} catch (o) {
|
|
1428
|
-
const
|
|
1240
|
+
const i = o, s = i.code ?? k.calculateWidgetPropsError;
|
|
1429
1241
|
return {
|
|
1430
1242
|
...r,
|
|
1431
1243
|
formHealth: {
|
|
1432
1244
|
status: "errored",
|
|
1433
|
-
message: `[${
|
|
1434
|
-
code:
|
|
1245
|
+
message: `[${s}] ${i.message}`,
|
|
1246
|
+
code: s
|
|
1435
1247
|
}
|
|
1436
1248
|
};
|
|
1437
1249
|
}
|
|
1438
1250
|
};
|
|
1439
|
-
function
|
|
1440
|
-
const
|
|
1441
|
-
for (const
|
|
1442
|
-
if (e.widgetFlags[
|
|
1251
|
+
function zn(e, t, r, { $formIsInvalid: n, $errors: o }) {
|
|
1252
|
+
const i = co(e, t, n, o, r), s = {};
|
|
1253
|
+
for (const c of Object.keys(e.calculatedWidgets)) {
|
|
1254
|
+
if (e.widgetFlags[c]?.hidden)
|
|
1443
1255
|
continue;
|
|
1444
|
-
const
|
|
1445
|
-
if (
|
|
1446
|
-
|
|
1256
|
+
const u = e.calculatedWidgets[c], l = u.source, a = e.repeaterItemScopes[c];
|
|
1257
|
+
if (P(l)) {
|
|
1258
|
+
s[c] = bn(u, c, l, e, t, a);
|
|
1447
1259
|
continue;
|
|
1448
1260
|
}
|
|
1449
|
-
const p = a ? { ...
|
|
1450
|
-
|
|
1451
|
-
|
|
1261
|
+
const p = a ? { ...i, $item: V(i.$form, a.itemPath), $index: a.index } : i;
|
|
1262
|
+
s[c] = Bn(
|
|
1263
|
+
u,
|
|
1452
1264
|
l,
|
|
1453
1265
|
e,
|
|
1454
1266
|
p
|
|
1455
1267
|
);
|
|
1456
1268
|
}
|
|
1457
|
-
return
|
|
1269
|
+
return s;
|
|
1458
1270
|
}
|
|
1459
|
-
function
|
|
1460
|
-
const
|
|
1271
|
+
function bn(e, t, r, n, o, i) {
|
|
1272
|
+
const s = {
|
|
1461
1273
|
...r({
|
|
1462
1274
|
$form: n.data,
|
|
1463
1275
|
errors: r.path ? n.validations[r.path] : void 0,
|
|
1464
1276
|
touched: r.path ? n.touchedControls[r.path] : void 0,
|
|
1465
1277
|
translate: o.translate,
|
|
1466
|
-
$item:
|
|
1467
|
-
$index:
|
|
1278
|
+
$item: i ? V(n.data, i.itemPath) : void 0,
|
|
1279
|
+
$index: i?.index
|
|
1468
1280
|
})
|
|
1469
1281
|
};
|
|
1470
|
-
|
|
1471
|
-
const
|
|
1472
|
-
return
|
|
1282
|
+
s.uid = t, r.path !== void 0 && (s.path = r.path);
|
|
1283
|
+
const c = n.widgetPropOverrides[t];
|
|
1284
|
+
return c !== void 0 && (s.props = { ...s.props, ...c }), e.current && pe(e.current, s) ? e : { source: r, current: s };
|
|
1473
1285
|
}
|
|
1474
|
-
function
|
|
1475
|
-
const o = new
|
|
1476
|
-
return o.write("uid", t.uid), o.write("type", t.type), o.write("kind", t.kind),
|
|
1286
|
+
function Bn(e, t, r, n) {
|
|
1287
|
+
const o = new so(t, e.current);
|
|
1288
|
+
return o.write("uid", t.uid), o.write("type", t.type), o.write("kind", t.kind), gr(t) ? Gn(o, n) : oe(t) ? Kn(o, n) : I(t) ? Xn(o, n) : _(t) && xn(o, n), Qn(t, o, n, r), (oe(t) || I(t)) && qn(t, o, n), _(t) && Jn(t, o, r), o.changed ? { source: e.source, current: o.current } : e;
|
|
1477
1289
|
}
|
|
1478
|
-
function
|
|
1290
|
+
function Gn(e, t) {
|
|
1479
1291
|
A(e, t, "size"), A(e, t, "include"), A(e, t, "exclude");
|
|
1480
1292
|
}
|
|
1481
|
-
function
|
|
1293
|
+
function Kn(e, t) {
|
|
1482
1294
|
A(e, t, "size"), A(e, t, "include"), A(e, t, "exclude"), A(e, t, "label"), A(e, t, "disabled"), A(e, t, "actionType");
|
|
1483
1295
|
}
|
|
1484
|
-
function
|
|
1296
|
+
function Xn(e, t) {
|
|
1485
1297
|
A(e, t, "size"), A(e, t, "include"), A(e, t, "exclude"), A(e, t, "label"), A(e, t, "disabled"), A(e, t, "readonly"), A(e, t, "validator"), A(e, t, "path"), A(e, t, "defaultValue");
|
|
1486
1298
|
}
|
|
1487
|
-
function
|
|
1299
|
+
function xn(e, t) {
|
|
1488
1300
|
A(e, t, "size"), A(e, t, "include"), A(e, t, "exclude");
|
|
1489
1301
|
}
|
|
1490
|
-
function
|
|
1491
|
-
const o = n.widgetPropOverrides[e.uid] ?? {},
|
|
1492
|
-
for (const
|
|
1493
|
-
|
|
1302
|
+
function Qn(e, t, r, n) {
|
|
1303
|
+
const o = n.widgetPropOverrides[e.uid] ?? {}, i = { ...e.props ?? {}, ...o };
|
|
1304
|
+
for (const s of tr(Object.keys(i)))
|
|
1305
|
+
Zn(t, r, s);
|
|
1494
1306
|
}
|
|
1495
|
-
function
|
|
1307
|
+
function qn(e, t, r) {
|
|
1496
1308
|
const n = e.on ?? {};
|
|
1497
|
-
for (const o of
|
|
1498
|
-
|
|
1309
|
+
for (const o of tr(Object.keys(n)))
|
|
1310
|
+
Yn(t, r, o);
|
|
1499
1311
|
}
|
|
1500
|
-
function
|
|
1501
|
-
const n =
|
|
1312
|
+
function Jn(e, t, r) {
|
|
1313
|
+
const n = Z(e.uid), o = lo(e.children, n, r.widgetFlags);
|
|
1502
1314
|
t.current.children = o;
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1315
|
+
const i = t.previous.children ?? [];
|
|
1316
|
+
i.length === o.length && o.every((c, u) => i[u] && i[u].uid === o[u].uid) || t.markChanged();
|
|
1505
1317
|
}
|
|
1506
1318
|
function A(e, t, r) {
|
|
1507
1319
|
const n = e.source;
|
|
1508
|
-
if (!
|
|
1320
|
+
if (!uo(n, r))
|
|
1509
1321
|
return;
|
|
1510
|
-
const o =
|
|
1511
|
-
let
|
|
1322
|
+
const o = rt(n, r, t.sortedStates);
|
|
1323
|
+
let i;
|
|
1512
1324
|
switch (r) {
|
|
1513
1325
|
case "disabled":
|
|
1514
1326
|
case "readonly":
|
|
1515
|
-
|
|
1327
|
+
i = ro(o, t, e.source.uid, r);
|
|
1516
1328
|
break;
|
|
1517
1329
|
case "defaultValue":
|
|
1518
|
-
|
|
1330
|
+
i = o;
|
|
1519
1331
|
break;
|
|
1520
1332
|
default:
|
|
1521
|
-
|
|
1333
|
+
i = er(o, t);
|
|
1522
1334
|
}
|
|
1523
|
-
e.write(r,
|
|
1335
|
+
e.write(r, i);
|
|
1524
1336
|
}
|
|
1525
|
-
function
|
|
1526
|
-
const n = e.source.props, o =
|
|
1527
|
-
let
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1337
|
+
function Zn(e, t, r) {
|
|
1338
|
+
const n = e.source.props, o = rt(n, r, t.sortedStates);
|
|
1339
|
+
let i = er(o, t);
|
|
1340
|
+
const s = t.widgetPropOverrides[e.source.uid]?.[r];
|
|
1341
|
+
s !== void 0 && (i = s), e.write(`props.${r}`, i);
|
|
1530
1342
|
}
|
|
1531
|
-
function
|
|
1532
|
-
const n = e.source.on, o =
|
|
1533
|
-
e.write(`on.${r}`,
|
|
1343
|
+
function Yn(e, t, r) {
|
|
1344
|
+
const n = e.source.on, o = rt(n, r, t.sortedStates);
|
|
1345
|
+
e.write(`on.${r}`, no(o, t));
|
|
1534
1346
|
}
|
|
1535
|
-
function
|
|
1347
|
+
function tt(e, t) {
|
|
1536
1348
|
return e({
|
|
1537
1349
|
$form: t.$form,
|
|
1538
1350
|
translate: t.localization.translate,
|
|
@@ -1540,14 +1352,14 @@ function ot(e, t) {
|
|
|
1540
1352
|
$index: t.$index
|
|
1541
1353
|
});
|
|
1542
1354
|
}
|
|
1543
|
-
function
|
|
1544
|
-
return t.localization.translate(e.key,
|
|
1355
|
+
function eo(e, t) {
|
|
1356
|
+
return t.localization.translate(e.key, io(e.params, t), e.default);
|
|
1545
1357
|
}
|
|
1546
|
-
const
|
|
1547
|
-
function
|
|
1548
|
-
return e.includes("{{") ? e.replace(
|
|
1358
|
+
const to = /\{\{([^}]+)\}\}/g;
|
|
1359
|
+
function Yt(e, t) {
|
|
1360
|
+
return e.includes("{{") ? e.replace(to, (r, n) => {
|
|
1549
1361
|
try {
|
|
1550
|
-
const o =
|
|
1362
|
+
const o = et(n.trim())({
|
|
1551
1363
|
$form: t.$form,
|
|
1552
1364
|
$meta: t.$meta,
|
|
1553
1365
|
$errors: t.$errors,
|
|
@@ -1558,21 +1370,21 @@ function sr(e, t) {
|
|
|
1558
1370
|
});
|
|
1559
1371
|
return o == null ? "" : String(o);
|
|
1560
1372
|
} catch (o) {
|
|
1561
|
-
const
|
|
1562
|
-
throw new
|
|
1373
|
+
const i = o instanceof Error ? o.message : String(o);
|
|
1374
|
+
throw new rr(`Failed to evaluate '{{${n.trim()}}}': ${i}`);
|
|
1563
1375
|
}
|
|
1564
1376
|
}) : e;
|
|
1565
1377
|
}
|
|
1566
|
-
function
|
|
1567
|
-
return typeof e == "function" ?
|
|
1378
|
+
function er(e, t) {
|
|
1379
|
+
return typeof e == "function" ? tt(e, t) : kr(e) ? eo(e, t) : typeof e == "string" ? Yt(e, t) : e;
|
|
1568
1380
|
}
|
|
1569
|
-
function
|
|
1570
|
-
return typeof e == "function" ?
|
|
1381
|
+
function ro(e, t, r, n) {
|
|
1382
|
+
return typeof e == "function" ? tt(e, t) : Q(e) ? t.widgetFlags[r]?.[n] : typeof e == "string" ? Yt(e, t) : e;
|
|
1571
1383
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return typeof e == "function" ?
|
|
1384
|
+
function no(e, t) {
|
|
1385
|
+
return typeof e == "function" ? tt(e, t) : e;
|
|
1574
1386
|
}
|
|
1575
|
-
function
|
|
1387
|
+
function rt(e, t, r) {
|
|
1576
1388
|
if (e) {
|
|
1577
1389
|
for (const n of r) {
|
|
1578
1390
|
const o = e[`${t}.${n}`];
|
|
@@ -1582,15 +1394,15 @@ function st(e, t, r) {
|
|
|
1582
1394
|
return e[t];
|
|
1583
1395
|
}
|
|
1584
1396
|
}
|
|
1585
|
-
function
|
|
1397
|
+
function oo(e) {
|
|
1586
1398
|
return e.startsWith("$form") || e.startsWith("$meta") || e.startsWith("$errors") || e.startsWith("$item") || e.startsWith("$index") || e.startsWith("$fn") || e === "$formIsInvalid";
|
|
1587
1399
|
}
|
|
1588
|
-
function
|
|
1400
|
+
function io(e, t) {
|
|
1589
1401
|
return e && Object.keys(e).reduce((r, n) => {
|
|
1590
1402
|
const o = String(e[n]);
|
|
1591
|
-
if (
|
|
1403
|
+
if (oo(o))
|
|
1592
1404
|
try {
|
|
1593
|
-
const
|
|
1405
|
+
const i = et(o)({
|
|
1594
1406
|
$form: t.$form,
|
|
1595
1407
|
$meta: t.$meta,
|
|
1596
1408
|
$errors: t.$errors,
|
|
@@ -1599,17 +1411,17 @@ function ho(e, t) {
|
|
|
1599
1411
|
$index: t.$index,
|
|
1600
1412
|
$fn: t.$fn
|
|
1601
1413
|
});
|
|
1602
|
-
r[n] =
|
|
1603
|
-
} catch (
|
|
1604
|
-
const
|
|
1605
|
-
throw new
|
|
1414
|
+
r[n] = i ?? o;
|
|
1415
|
+
} catch (i) {
|
|
1416
|
+
const s = i instanceof Error ? i.message : String(i);
|
|
1417
|
+
throw new rr(`Failed to evaluate i18n param '${o}': ${s}`);
|
|
1606
1418
|
}
|
|
1607
1419
|
else
|
|
1608
1420
|
r[n] = o;
|
|
1609
1421
|
return r;
|
|
1610
1422
|
}, {});
|
|
1611
1423
|
}
|
|
1612
|
-
class
|
|
1424
|
+
class so {
|
|
1613
1425
|
constructor(t, r) {
|
|
1614
1426
|
this._changed = !1, this.source = t, this.previous = r, this.current = {};
|
|
1615
1427
|
}
|
|
@@ -1620,17 +1432,17 @@ class mo {
|
|
|
1620
1432
|
this._changed = !0;
|
|
1621
1433
|
}
|
|
1622
1434
|
write(t, r) {
|
|
1623
|
-
const n =
|
|
1624
|
-
if (
|
|
1625
|
-
|
|
1435
|
+
const n = V(this.previous, t);
|
|
1436
|
+
if (pe(n, r)) {
|
|
1437
|
+
We(this.current, t, n);
|
|
1626
1438
|
return;
|
|
1627
1439
|
}
|
|
1628
|
-
|
|
1440
|
+
We(this.current, t, r), this._changed = !0;
|
|
1629
1441
|
}
|
|
1630
1442
|
}
|
|
1631
|
-
function
|
|
1443
|
+
function co(e, t, r, n, o) {
|
|
1632
1444
|
return {
|
|
1633
|
-
sortedStates: [...e.currentStates].sort((
|
|
1445
|
+
sortedStates: [...e.currentStates].sort((i, s) => s.length - i.length),
|
|
1634
1446
|
widgetPropOverrides: e.widgetPropOverrides,
|
|
1635
1447
|
widgetFlags: e.widgetFlags,
|
|
1636
1448
|
$form: e.data,
|
|
@@ -1641,46 +1453,46 @@ function go(e, t, r, n, o) {
|
|
|
1641
1453
|
$fn: o
|
|
1642
1454
|
};
|
|
1643
1455
|
}
|
|
1644
|
-
function
|
|
1456
|
+
function uo(e, t) {
|
|
1645
1457
|
if (t in e)
|
|
1646
1458
|
return !0;
|
|
1647
1459
|
const r = `${t}.`;
|
|
1648
1460
|
return Object.keys(e).some((n) => n.startsWith(r));
|
|
1649
1461
|
}
|
|
1650
|
-
function
|
|
1462
|
+
function tr(e) {
|
|
1651
1463
|
return Array.from(new Set(e.map((t) => t.split(".")[0])));
|
|
1652
1464
|
}
|
|
1653
|
-
function
|
|
1465
|
+
function lo(e, t, r) {
|
|
1654
1466
|
const n = t.map((o) => `[${o}]`).join("");
|
|
1655
1467
|
return e.filter((o) => {
|
|
1656
|
-
const
|
|
1657
|
-
return !
|
|
1468
|
+
const i = o.uid + n, s = r[i];
|
|
1469
|
+
return !s || s.hidden !== !0;
|
|
1658
1470
|
});
|
|
1659
1471
|
}
|
|
1660
|
-
class
|
|
1472
|
+
class rr extends Error {
|
|
1661
1473
|
constructor() {
|
|
1662
|
-
super(...arguments), this.code =
|
|
1474
|
+
super(...arguments), this.code = k.resolveStringInterpolationError, this.name = "StringInterpolationError";
|
|
1663
1475
|
}
|
|
1664
1476
|
}
|
|
1665
|
-
const
|
|
1666
|
-
const t =
|
|
1477
|
+
const ao = (e) => {
|
|
1478
|
+
const t = fo(e.resolvedSources), r = re(
|
|
1667
1479
|
e.widgetPropOverrides,
|
|
1668
|
-
(
|
|
1669
|
-
), n =
|
|
1480
|
+
(s) => s in e.resolvedSources
|
|
1481
|
+
), n = re(e.touchedControls, (s) => t.has(s)), o = re(e.validations, (s) => t.has(s)), i = re(
|
|
1670
1482
|
e.injectedValidations,
|
|
1671
|
-
(
|
|
1483
|
+
(s) => t.has(s)
|
|
1672
1484
|
);
|
|
1673
|
-
return r === e.widgetPropOverrides && n === e.touchedControls && o === e.validations &&
|
|
1485
|
+
return r === e.widgetPropOverrides && n === e.touchedControls && o === e.validations && i === e.injectedValidations ? e : { ...e, widgetPropOverrides: r, touchedControls: n, validations: o, injectedValidations: i };
|
|
1674
1486
|
};
|
|
1675
|
-
function
|
|
1487
|
+
function fo(e) {
|
|
1676
1488
|
const t = /* @__PURE__ */ new Set();
|
|
1677
1489
|
for (const r of Object.values(e)) {
|
|
1678
|
-
const n =
|
|
1490
|
+
const n = T(r);
|
|
1679
1491
|
n !== void 0 && t.add(n);
|
|
1680
1492
|
}
|
|
1681
1493
|
return t;
|
|
1682
1494
|
}
|
|
1683
|
-
function
|
|
1495
|
+
function re(e, t) {
|
|
1684
1496
|
const r = Object.keys(e).filter(t);
|
|
1685
1497
|
if (r.length === Object.keys(e).length)
|
|
1686
1498
|
return e;
|
|
@@ -1689,20 +1501,20 @@ function se(e, t) {
|
|
|
1689
1501
|
n[o] = e[o];
|
|
1690
1502
|
return n;
|
|
1691
1503
|
}
|
|
1692
|
-
const
|
|
1504
|
+
const po = (e) => {
|
|
1693
1505
|
const t = Object.keys(e.resolvedSources), r = {};
|
|
1694
1506
|
let n = t.length !== Object.keys(e.calculatedWidgets).length;
|
|
1695
1507
|
for (const o of t) {
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1508
|
+
const i = e.calculatedWidgets[o];
|
|
1509
|
+
i ? r[o] = i : (r[o] = {
|
|
1698
1510
|
source: e.resolvedSources[o],
|
|
1699
1511
|
current: {}
|
|
1700
1512
|
}, n = !0);
|
|
1701
1513
|
}
|
|
1702
1514
|
return n ? { ...e, calculatedWidgets: r } : e;
|
|
1703
|
-
},
|
|
1515
|
+
}, ho = ({ lang: e }, t) => {
|
|
1704
1516
|
const r = {
|
|
1705
|
-
...
|
|
1517
|
+
...It(e),
|
|
1706
1518
|
formName: t.payload.formName
|
|
1707
1519
|
};
|
|
1708
1520
|
let n = t.payload.formDef, o = { status: "ok" };
|
|
@@ -1710,7 +1522,7 @@ const Ao = (e) => {
|
|
|
1710
1522
|
try {
|
|
1711
1523
|
n = JSON.parse(n);
|
|
1712
1524
|
} catch (a) {
|
|
1713
|
-
const p = a, g =
|
|
1525
|
+
const p = a, g = k.initializeParseError;
|
|
1714
1526
|
o = {
|
|
1715
1527
|
status: "errored",
|
|
1716
1528
|
message: `[${g}] ${p.message}`,
|
|
@@ -1720,10 +1532,10 @@ const Ao = (e) => {
|
|
|
1720
1532
|
if (o.status === "errored")
|
|
1721
1533
|
return { ...r, formHealth: o };
|
|
1722
1534
|
}
|
|
1723
|
-
let
|
|
1535
|
+
let i = n;
|
|
1724
1536
|
if (Array.isArray(n.form)) {
|
|
1725
1537
|
const a = n.form;
|
|
1726
|
-
|
|
1538
|
+
i = {
|
|
1727
1539
|
...n,
|
|
1728
1540
|
form: {
|
|
1729
1541
|
uid: "",
|
|
@@ -1733,83 +1545,83 @@ const Ao = (e) => {
|
|
|
1733
1545
|
}
|
|
1734
1546
|
};
|
|
1735
1547
|
}
|
|
1736
|
-
const
|
|
1737
|
-
if (
|
|
1548
|
+
const s = wt.decode(i);
|
|
1549
|
+
if (s.isOk()) {
|
|
1738
1550
|
o = { status: "ok" };
|
|
1739
1551
|
let a = {};
|
|
1740
1552
|
try {
|
|
1741
|
-
a =
|
|
1553
|
+
a = He([s.value.form]).reduce(
|
|
1742
1554
|
(p, g) => {
|
|
1743
|
-
const
|
|
1744
|
-
if (p[
|
|
1745
|
-
throw { existingWidget: p[
|
|
1746
|
-
return p[
|
|
1555
|
+
const w = g.uid;
|
|
1556
|
+
if (p[w])
|
|
1557
|
+
throw { existingWidget: p[w], newWidget: g };
|
|
1558
|
+
return p[w] = g, p;
|
|
1747
1559
|
},
|
|
1748
1560
|
{}
|
|
1749
1561
|
);
|
|
1750
1562
|
} catch (p) {
|
|
1751
|
-
o =
|
|
1563
|
+
o = yo(p.existingWidget, p.newWidget), a = {};
|
|
1752
1564
|
}
|
|
1753
|
-
return
|
|
1565
|
+
return vo(a, s.value.states), {
|
|
1754
1566
|
...r,
|
|
1755
|
-
formDef:
|
|
1567
|
+
formDef: s.value,
|
|
1756
1568
|
flatForm: a,
|
|
1757
|
-
...
|
|
1569
|
+
...Pe(a, {}),
|
|
1758
1570
|
formHealth: o
|
|
1759
1571
|
};
|
|
1760
1572
|
}
|
|
1761
|
-
const
|
|
1762
|
-
if (
|
|
1763
|
-
return { ...r, formHealth:
|
|
1764
|
-
const
|
|
1573
|
+
const c = go(n);
|
|
1574
|
+
if (c)
|
|
1575
|
+
return { ...r, formHealth: c };
|
|
1576
|
+
const u = k.initializeUnknownError, l = s.issues.map((a) => `${a.path.length > 0 ? pr(a.path) : "root"}: ${a.message}`).join("; ");
|
|
1765
1577
|
return {
|
|
1766
1578
|
...r,
|
|
1767
1579
|
formHealth: {
|
|
1768
1580
|
status: "errored",
|
|
1769
|
-
message: `[${
|
|
1770
|
-
code:
|
|
1581
|
+
message: `[${u}] ${l}`,
|
|
1582
|
+
code: u
|
|
1771
1583
|
}
|
|
1772
1584
|
};
|
|
1773
1585
|
};
|
|
1774
|
-
function
|
|
1586
|
+
function nr(e, t) {
|
|
1775
1587
|
return { status: "errored", code: e, message: `[${e}] ${t}` };
|
|
1776
1588
|
}
|
|
1777
|
-
function
|
|
1589
|
+
function mo() {
|
|
1778
1590
|
return "Malformed form definition. Pass it directly as formDef - `config={{ formDef: { states, form: [...] } }}`. Do NOT wrap it in an extra `{ form: ... }`.";
|
|
1779
1591
|
}
|
|
1780
|
-
function
|
|
1592
|
+
function go(e) {
|
|
1781
1593
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1782
1594
|
return null;
|
|
1783
1595
|
const t = e.form;
|
|
1784
|
-
return t && typeof t == "object" && !Array.isArray(t) && !
|
|
1596
|
+
return t && typeof t == "object" && !Array.isArray(t) && !_(t) ? nr(k.initializeMalformedFormShapeError, mo()) : null;
|
|
1785
1597
|
}
|
|
1786
|
-
function
|
|
1787
|
-
const r = (o) =>
|
|
1788
|
-
return
|
|
1598
|
+
function yo(e, t) {
|
|
1599
|
+
const r = (o) => I(o) ? ` at "${o.path}"` : "", n = `Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`;
|
|
1600
|
+
return nr(k.initializeUidCollisionError, n);
|
|
1789
1601
|
}
|
|
1790
|
-
function
|
|
1602
|
+
function vo(e, t) {
|
|
1791
1603
|
const r = new Set(Object.keys(t ?? {})), n = /* @__PURE__ */ new Map();
|
|
1792
|
-
for (const
|
|
1793
|
-
const
|
|
1794
|
-
|
|
1795
|
-
const
|
|
1796
|
-
|
|
1797
|
-
for (const l of
|
|
1604
|
+
for (const i of Object.values(e)) {
|
|
1605
|
+
const s = [], c = i.include;
|
|
1606
|
+
c && Array.isArray(c.in) && s.push(...c.in);
|
|
1607
|
+
const u = i.exclude;
|
|
1608
|
+
u && Array.isArray(u.from) && s.push(...u.from);
|
|
1609
|
+
for (const l of s) {
|
|
1798
1610
|
if (r.has(l))
|
|
1799
1611
|
continue;
|
|
1800
1612
|
const a = n.get(l) ?? [];
|
|
1801
|
-
a.push(
|
|
1613
|
+
a.push(i.uid || "(unknown)"), n.set(l, a);
|
|
1802
1614
|
}
|
|
1803
1615
|
}
|
|
1804
1616
|
if (n.size === 0)
|
|
1805
1617
|
return;
|
|
1806
1618
|
const o = r.size ? [...r].join(", ") : "(none declared)";
|
|
1807
|
-
for (const [
|
|
1619
|
+
for (const [i, s] of n)
|
|
1808
1620
|
console.error(
|
|
1809
|
-
`[GolemUI] include/exclude references undefined state "${
|
|
1621
|
+
`[GolemUI] include/exclude references undefined state "${i}" (on ${s.join(", ")}); these widgets will stay hidden. Declared states: ${o}. Fix: declare "${i}" in formConfig.states, or correct the name.`
|
|
1810
1622
|
);
|
|
1811
1623
|
}
|
|
1812
|
-
function
|
|
1624
|
+
function $o(e, t) {
|
|
1813
1625
|
const { path: r, issues: n } = t.payload, o = n?.length ? {
|
|
1814
1626
|
touched: !0,
|
|
1815
1627
|
touchedControls: { ...e.touchedControls, [r]: !0 }
|
|
@@ -1823,8 +1635,8 @@ function ko(e, t) {
|
|
|
1823
1635
|
}
|
|
1824
1636
|
};
|
|
1825
1637
|
}
|
|
1826
|
-
const
|
|
1827
|
-
const r = "path" in t ?
|
|
1638
|
+
const So = (e, { payload: t }) => {
|
|
1639
|
+
const r = "path" in t ? Eo(e, t.path) : Ao(e, t.uid);
|
|
1828
1640
|
if (r === void 0)
|
|
1829
1641
|
return e;
|
|
1830
1642
|
const n = e.widgetPropOverrides[r] || {};
|
|
@@ -1836,53 +1648,53 @@ const jo = (e, { payload: t }) => {
|
|
|
1836
1648
|
}
|
|
1837
1649
|
};
|
|
1838
1650
|
};
|
|
1839
|
-
function
|
|
1651
|
+
function Ao(e, t) {
|
|
1840
1652
|
if (t in e.resolvedSources)
|
|
1841
1653
|
return t;
|
|
1842
1654
|
console.warn(`Widget with uid "${t}" not found`);
|
|
1843
1655
|
}
|
|
1844
|
-
function
|
|
1656
|
+
function Eo(e, t) {
|
|
1845
1657
|
const r = Object.values(e.calculatedWidgets).find(
|
|
1846
|
-
({ source: o, current:
|
|
1658
|
+
({ source: o, current: i }) => (T(i) ?? T(o)) === t
|
|
1847
1659
|
);
|
|
1848
1660
|
if (r)
|
|
1849
1661
|
return r.source.uid;
|
|
1850
1662
|
const n = Object.keys(e.resolvedSources).find(
|
|
1851
|
-
(o) =>
|
|
1663
|
+
(o) => T(e.resolvedSources[o]) === t
|
|
1852
1664
|
);
|
|
1853
1665
|
if (n !== void 0)
|
|
1854
1666
|
return n;
|
|
1855
1667
|
console.warn(`Input with path "${t}" not found`);
|
|
1856
1668
|
}
|
|
1857
|
-
const
|
|
1669
|
+
const Co = (e, t) => ({
|
|
1858
1670
|
...e,
|
|
1859
1671
|
data: { ...t.payload.data }
|
|
1860
|
-
}),
|
|
1672
|
+
}), wo = (e, t) => ({
|
|
1861
1673
|
...e,
|
|
1862
1674
|
formHealth: t.payload.formHealth
|
|
1863
|
-
}),
|
|
1675
|
+
}), Io = (e, t) => ({
|
|
1864
1676
|
...e,
|
|
1865
1677
|
lang: t.payload.lang
|
|
1866
|
-
}),
|
|
1678
|
+
}), Oo = (e, t) => ({
|
|
1867
1679
|
...e,
|
|
1868
1680
|
meta: { ...t.payload.meta }
|
|
1869
|
-
}),
|
|
1681
|
+
}), ko = (e, t) => ({
|
|
1870
1682
|
...e,
|
|
1871
|
-
data:
|
|
1872
|
-
}),
|
|
1873
|
-
function
|
|
1683
|
+
data: Ot(e.data, t.payload.path, t.payload.data)
|
|
1684
|
+
}), or = /* @__PURE__ */ Symbol("filterMap.skip");
|
|
1685
|
+
function jo(e, t) {
|
|
1874
1686
|
const r = [];
|
|
1875
1687
|
for (let n = 0; n < e.length; n++) {
|
|
1876
1688
|
const o = t(e[n], n, e);
|
|
1877
|
-
o !==
|
|
1689
|
+
o !== or && r.push(o);
|
|
1878
1690
|
}
|
|
1879
1691
|
return r;
|
|
1880
1692
|
}
|
|
1881
|
-
function
|
|
1693
|
+
function ni(e, t, r) {
|
|
1882
1694
|
for (let n = 0; n < e.length; n++)
|
|
1883
1695
|
t(e[n], n, e) && r(e[n], n, e);
|
|
1884
1696
|
}
|
|
1885
|
-
function
|
|
1697
|
+
function Wo(e, t, r) {
|
|
1886
1698
|
if (e.length !== t.length)
|
|
1887
1699
|
return !1;
|
|
1888
1700
|
for (let n = 0; n < e.length; n++)
|
|
@@ -1890,140 +1702,140 @@ function Lo(e, t, r) {
|
|
|
1890
1702
|
return !1;
|
|
1891
1703
|
return !0;
|
|
1892
1704
|
}
|
|
1893
|
-
const
|
|
1894
|
-
const n =
|
|
1705
|
+
const Po = (e, t) => (r) => {
|
|
1706
|
+
const n = jo(
|
|
1895
1707
|
Object.values(r.calculatedWidgets),
|
|
1896
|
-
({ current:
|
|
1708
|
+
({ current: i }) => I(i) ? i : or
|
|
1897
1709
|
), o = r.validations;
|
|
1898
1710
|
return {
|
|
1899
1711
|
...r,
|
|
1900
1712
|
validations: n.reduce(
|
|
1901
|
-
(
|
|
1902
|
-
if (s
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1905
|
-
|
|
1713
|
+
(i, s) => {
|
|
1714
|
+
if (i[s.path] = null, s.validator) {
|
|
1715
|
+
const c = e(s.validator, t), u = V(r.data, s.path), l = hr(
|
|
1716
|
+
c,
|
|
1717
|
+
u
|
|
1906
1718
|
);
|
|
1907
|
-
s
|
|
1719
|
+
i[s.path] = mr(l) ? null : l.issues.map((a) => a.message);
|
|
1908
1720
|
}
|
|
1909
|
-
return Array.isArray(s
|
|
1910
|
-
s
|
|
1911
|
-
o[
|
|
1912
|
-
(
|
|
1913
|
-
) && (s
|
|
1721
|
+
return Array.isArray(i[s.path]) && Array.isArray(o[s.path]) && Wo(
|
|
1722
|
+
i[s.path],
|
|
1723
|
+
o[s.path],
|
|
1724
|
+
(c, u) => c === u
|
|
1725
|
+
) && (i[s.path] = o[s.path]), i;
|
|
1914
1726
|
},
|
|
1915
1727
|
{}
|
|
1916
1728
|
)
|
|
1917
1729
|
};
|
|
1918
|
-
},
|
|
1730
|
+
}, Do = ({
|
|
1919
1731
|
validators: e,
|
|
1920
1732
|
validateOn: t,
|
|
1921
1733
|
localization: r,
|
|
1922
1734
|
functions: n
|
|
1923
1735
|
}) => {
|
|
1924
|
-
const o =
|
|
1736
|
+
const o = No(r, n), i = Po(e, r), s = Zt(r, n), c = (l) => vt(l, o, i, !1), u = (l) => vt(l, o, i, !0);
|
|
1925
1737
|
return (l, a) => {
|
|
1926
1738
|
switch (a.type) {
|
|
1927
1739
|
case "INITIALIZE":
|
|
1928
|
-
return
|
|
1740
|
+
return ho(l, a);
|
|
1929
1741
|
case "SET_DATA":
|
|
1930
|
-
return
|
|
1742
|
+
return c(Co(l, a));
|
|
1931
1743
|
case "SET_META":
|
|
1932
|
-
return
|
|
1744
|
+
return c(Oo(l, a));
|
|
1933
1745
|
case "SET_WIDGET_DATA":
|
|
1934
|
-
return
|
|
1746
|
+
return c(ko(l, a));
|
|
1935
1747
|
case "SET_LANGUAGE":
|
|
1936
|
-
return
|
|
1748
|
+
return s(Io(l, a));
|
|
1937
1749
|
case "OVERRIDE_WIDGET_PROP": {
|
|
1938
|
-
const p =
|
|
1750
|
+
const p = So(l, a);
|
|
1939
1751
|
if (p === l)
|
|
1940
1752
|
return l;
|
|
1941
|
-
const g =
|
|
1942
|
-
return
|
|
1753
|
+
const g = c(p);
|
|
1754
|
+
return _o(g, a) ? i(g) : g;
|
|
1943
1755
|
}
|
|
1944
1756
|
case "SET_FORM_HEALTH":
|
|
1945
|
-
return
|
|
1757
|
+
return wo(l, a);
|
|
1946
1758
|
case "VALIDATE_ALL":
|
|
1947
|
-
return
|
|
1759
|
+
return u(i(Ro(l)));
|
|
1948
1760
|
case "ATTEMPT_VALIDATION": {
|
|
1949
|
-
if (!
|
|
1761
|
+
if (!Lo(t, a.payload.reason))
|
|
1950
1762
|
return l;
|
|
1951
1763
|
const p = {
|
|
1952
1764
|
...l,
|
|
1953
1765
|
touched: !0,
|
|
1954
1766
|
touchedControls: { ...l.touchedControls, [a.payload.path]: !0 }
|
|
1955
1767
|
};
|
|
1956
|
-
return
|
|
1768
|
+
return u(i(p));
|
|
1957
1769
|
}
|
|
1958
1770
|
case "INJECT_VALIDATION_ISSUES":
|
|
1959
|
-
return
|
|
1771
|
+
return $o(l, a);
|
|
1960
1772
|
default:
|
|
1961
|
-
return
|
|
1773
|
+
return Wr(a);
|
|
1962
1774
|
}
|
|
1963
1775
|
};
|
|
1964
|
-
},
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
]),
|
|
1970
|
-
function
|
|
1971
|
-
const r =
|
|
1972
|
-
return function(
|
|
1973
|
-
if (
|
|
1974
|
-
return
|
|
1975
|
-
const
|
|
1776
|
+
}, Fo = /* @__PURE__ */ new Set([
|
|
1777
|
+
k.calculateCurrentStateError,
|
|
1778
|
+
k.calculateWidgetFlagsError,
|
|
1779
|
+
k.calculateWidgetPropsError,
|
|
1780
|
+
k.resolveStringInterpolationError
|
|
1781
|
+
]), To = (e) => e.formHealth.status === "errored" && !Fo.has(e.formHealth.code);
|
|
1782
|
+
function No(e, t) {
|
|
1783
|
+
const r = Ln(t), n = Mn(t), o = Zt(e, t);
|
|
1784
|
+
return function(s) {
|
|
1785
|
+
if (To(s))
|
|
1786
|
+
return s;
|
|
1787
|
+
const c = (u) => ({ ...s, formHealth: u });
|
|
1976
1788
|
try {
|
|
1977
|
-
let
|
|
1978
|
-
|
|
1979
|
-
const l =
|
|
1980
|
-
return
|
|
1981
|
-
} catch (
|
|
1982
|
-
const l =
|
|
1983
|
-
return
|
|
1789
|
+
let u = s.formHealth.status === "ok" ? s : { ...s, formHealth: { status: "ok" } };
|
|
1790
|
+
u = Lr(u), u = ao(u);
|
|
1791
|
+
const l = ve(u);
|
|
1792
|
+
return u = r(u, l), u.formHealth.status !== "ok" ? c(u.formHealth) : (u = n(u, l), u = po(u), u = o(u, l), u.formHealth.status === "ok" ? u : c(u.formHealth));
|
|
1793
|
+
} catch (u) {
|
|
1794
|
+
const l = k.calculateWidgetFlagsError;
|
|
1795
|
+
return c({
|
|
1984
1796
|
status: "errored",
|
|
1985
1797
|
code: l,
|
|
1986
|
-
message: `[${l}] ${
|
|
1798
|
+
message: `[${l}] ${u.message}`
|
|
1987
1799
|
});
|
|
1988
1800
|
}
|
|
1989
1801
|
};
|
|
1990
1802
|
}
|
|
1991
|
-
function
|
|
1992
|
-
const o = (a) => n ?
|
|
1993
|
-
let
|
|
1994
|
-
if (!
|
|
1995
|
-
return o(
|
|
1996
|
-
const
|
|
1997
|
-
if (
|
|
1998
|
-
return o(
|
|
1999
|
-
const l = { ...
|
|
2000
|
-
for (const a of
|
|
1803
|
+
function vt(e, t, r, n) {
|
|
1804
|
+
const o = (a) => n ? $t(a) : a, i = e.resolvedSources, s = e.widgetFlags;
|
|
1805
|
+
let c = t(e);
|
|
1806
|
+
if (!c.allControlsValidated || c.formHealth.status !== "ok")
|
|
1807
|
+
return o(c);
|
|
1808
|
+
const u = Vo(c, i, s);
|
|
1809
|
+
if (u.length === 0)
|
|
1810
|
+
return o(c);
|
|
1811
|
+
const l = { ...c.touchedControls };
|
|
1812
|
+
for (const a of u)
|
|
2001
1813
|
l[a] = !0;
|
|
2002
|
-
return
|
|
1814
|
+
return c = { ...c, touchedControls: l }, $t(t(r(c)));
|
|
2003
1815
|
}
|
|
2004
|
-
function
|
|
1816
|
+
function Vo(e, t, r) {
|
|
2005
1817
|
const n = [];
|
|
2006
|
-
for (const [o,
|
|
2007
|
-
const
|
|
2008
|
-
if (
|
|
1818
|
+
for (const [o, i] of Object.entries(e.resolvedSources)) {
|
|
1819
|
+
const s = T(i);
|
|
1820
|
+
if (s === void 0 || e.widgetFlags[o]?.hidden === !0 || e.touchedControls[s] === !0)
|
|
2009
1821
|
continue;
|
|
2010
|
-
const
|
|
2011
|
-
(
|
|
1822
|
+
const c = t[o] === void 0, u = r[o]?.hidden === !0;
|
|
1823
|
+
(c || u) && n.push(s);
|
|
2012
1824
|
}
|
|
2013
1825
|
return n;
|
|
2014
1826
|
}
|
|
2015
|
-
function
|
|
1827
|
+
function Ro(e) {
|
|
2016
1828
|
const t = {};
|
|
2017
1829
|
for (const { source: r, current: n } of Object.values(e.calculatedWidgets)) {
|
|
2018
|
-
const o =
|
|
1830
|
+
const o = T(n) ?? T(r);
|
|
2019
1831
|
o !== void 0 && (t[o] = !0);
|
|
2020
1832
|
}
|
|
2021
1833
|
return { ...e, touched: !0, allControlsValidated: !0, touchedControls: t };
|
|
2022
1834
|
}
|
|
2023
|
-
function
|
|
1835
|
+
function Lo(e, t) {
|
|
2024
1836
|
return e === "eager" || t === e || Array.isArray(e) && e.includes(t);
|
|
2025
1837
|
}
|
|
2026
|
-
function
|
|
1838
|
+
function _o(e, t) {
|
|
2027
1839
|
if (!e.touched)
|
|
2028
1840
|
return !1;
|
|
2029
1841
|
let r;
|
|
@@ -2031,70 +1843,70 @@ function Ko(e, t) {
|
|
|
2031
1843
|
r = t.payload.path;
|
|
2032
1844
|
else {
|
|
2033
1845
|
const n = e.calculatedWidgets[t.payload.uid]?.current;
|
|
2034
|
-
n &&
|
|
1846
|
+
n && I(n) && (r = n.path);
|
|
2035
1847
|
}
|
|
2036
1848
|
return r !== void 0 && e.touchedControls[r] === !0;
|
|
2037
1849
|
}
|
|
2038
|
-
function
|
|
1850
|
+
function $t(e) {
|
|
2039
1851
|
const t = Object.keys(e.injectedValidations), r = Object.keys(e.validations);
|
|
2040
1852
|
if (t.length === 0 && r.length === 0)
|
|
2041
1853
|
return { ...e, isFormValid: !0 };
|
|
2042
1854
|
let n = t.find((o) => {
|
|
2043
|
-
const
|
|
2044
|
-
return Array.isArray(
|
|
1855
|
+
const i = e.injectedValidations[o];
|
|
1856
|
+
return Array.isArray(i) && i.length > 0;
|
|
2045
1857
|
});
|
|
2046
1858
|
return n !== void 0 ? { ...e, isFormValid: !1 } : (n = r.find((o) => {
|
|
2047
|
-
const
|
|
2048
|
-
return Array.isArray(
|
|
1859
|
+
const i = e.validations[o];
|
|
1860
|
+
return Array.isArray(i) && i.length > 0;
|
|
2049
1861
|
}), n !== void 0 ? { ...e, isFormValid: !1 } : { ...e, isFormValid: !0 });
|
|
2050
1862
|
}
|
|
2051
|
-
function
|
|
2052
|
-
const
|
|
2053
|
-
function
|
|
2054
|
-
const
|
|
2055
|
-
|
|
1863
|
+
function Mo(e = [], t, r, n, o = {}) {
|
|
1864
|
+
const i = new dr(It(n.lang)), s = i.asObservable().pipe(Ne()), c = Do({ validators: t, validateOn: r, localization: n, functions: o });
|
|
1865
|
+
function u(g) {
|
|
1866
|
+
const w = i.getValue(), Ee = c(w, g);
|
|
1867
|
+
i.next(Ee);
|
|
2056
1868
|
}
|
|
2057
|
-
let l =
|
|
1869
|
+
let l = u;
|
|
2058
1870
|
const a = {
|
|
2059
|
-
getState: () =>
|
|
1871
|
+
getState: () => i.getValue(),
|
|
2060
1872
|
dispatch: (g) => l(g)
|
|
2061
1873
|
// reference is updated later
|
|
2062
1874
|
};
|
|
2063
|
-
return l = e.map((g) => g(a)).reduceRight((g,
|
|
2064
|
-
state$:
|
|
1875
|
+
return l = e.map((g) => g(a)).reduceRight((g, w) => w(g), u), {
|
|
1876
|
+
state$: s,
|
|
2065
1877
|
dispatch: l,
|
|
2066
|
-
getState: () =>
|
|
1878
|
+
getState: () => i.getValue()
|
|
2067
1879
|
};
|
|
2068
1880
|
}
|
|
2069
|
-
class
|
|
1881
|
+
class oi {
|
|
2070
1882
|
constructor() {
|
|
2071
|
-
this.widgetRegistry = new
|
|
1883
|
+
this.widgetRegistry = new ie(), this.store = {}, this.events$ = new nt(), this.submit$ = new nt(), this.itemRenderers = {}, this.dependencies = {};
|
|
2072
1884
|
}
|
|
2073
|
-
initialize(t, r = [], n, o,
|
|
2074
|
-
this.localization =
|
|
1885
|
+
initialize(t, r = [], n, o, i, s = jr(), c, u = {}) {
|
|
1886
|
+
this.localization = s, this.dependencies = c, this.widgetRegistry.setWidgetLoaders(t), this.itemRenderers = i, this.store = Mo(r, n, o, s, u);
|
|
2075
1887
|
}
|
|
2076
1888
|
emitEvent(t, r, n) {
|
|
2077
|
-
const
|
|
2078
|
-
if (this.attemptValidation(t, r),
|
|
2079
|
-
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2082
|
-
name:
|
|
2083
|
-
data:
|
|
1889
|
+
const i = this.store.getState().currentStates.filter((s) => r.on?.[`${t}.${s}`] !== void 0);
|
|
1890
|
+
if (this.attemptValidation(t, r), i.length > 0)
|
|
1891
|
+
i.forEach((s) => {
|
|
1892
|
+
const c = r.on?.[`${t}.${s}`];
|
|
1893
|
+
c && this.events$.next({
|
|
1894
|
+
name: c,
|
|
1895
|
+
data: we(this.store.getState()),
|
|
2084
1896
|
detail: n ?? void 0,
|
|
2085
|
-
callback: (
|
|
2086
|
-
this.store.dispatch(
|
|
1897
|
+
callback: (u) => {
|
|
1898
|
+
this.store.dispatch(u);
|
|
2087
1899
|
}
|
|
2088
1900
|
});
|
|
2089
1901
|
});
|
|
2090
1902
|
else {
|
|
2091
|
-
const
|
|
2092
|
-
|
|
2093
|
-
name:
|
|
2094
|
-
data:
|
|
1903
|
+
const s = r.on?.[t];
|
|
1904
|
+
s && this.events$.next({
|
|
1905
|
+
name: s,
|
|
1906
|
+
data: we(this.store.getState()),
|
|
2095
1907
|
detail: n,
|
|
2096
|
-
callback: (
|
|
2097
|
-
this.store.dispatch(
|
|
1908
|
+
callback: (c) => {
|
|
1909
|
+
this.store.dispatch(c);
|
|
2098
1910
|
}
|
|
2099
1911
|
});
|
|
2100
1912
|
}
|
|
@@ -2103,7 +1915,7 @@ class as {
|
|
|
2103
1915
|
this.store.dispatch({
|
|
2104
1916
|
type: "VALIDATE_ALL"
|
|
2105
1917
|
}), this.store.getState().isFormValid && this.submit$.next({
|
|
2106
|
-
data:
|
|
1918
|
+
data: we(this.store.getState()),
|
|
2107
1919
|
callback: (t) => {
|
|
2108
1920
|
this.store.dispatch(t);
|
|
2109
1921
|
}
|
|
@@ -2122,45 +1934,45 @@ class as {
|
|
|
2122
1934
|
}));
|
|
2123
1935
|
}
|
|
2124
1936
|
}
|
|
2125
|
-
function
|
|
1937
|
+
function ii(e = "GolemUI Form Store") {
|
|
2126
1938
|
return (t) => {
|
|
2127
1939
|
const n = (typeof window < "u" ? window.__REDUX_DEVTOOLS_EXTENSION__ : void 0)?.connect({ name: e });
|
|
2128
|
-
return n?.init(t.getState()), (o) => (
|
|
2129
|
-
o(
|
|
1940
|
+
return n?.init(t.getState()), (o) => (i) => {
|
|
1941
|
+
o(i), n && n.send(i, t.getState());
|
|
2130
1942
|
};
|
|
2131
1943
|
};
|
|
2132
1944
|
}
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
),
|
|
2137
|
-
function
|
|
2138
|
-
return
|
|
1945
|
+
const Uo = ur(
|
|
1946
|
+
At((e) => e.formHealth),
|
|
1947
|
+
Ne((e, t) => e.status !== t.status ? !1 : e.status === "errored" && t.status === "errored" ? e.message === t.message && e.code === t.code : !0)
|
|
1948
|
+
), si = (e) => e.pipe(Uo);
|
|
1949
|
+
function ci(e, t) {
|
|
1950
|
+
return sr(e, t, ir(e, t), void 0);
|
|
2139
1951
|
}
|
|
2140
|
-
function
|
|
1952
|
+
function Ho() {
|
|
2141
1953
|
const e = /* @__PURE__ */ new Map();
|
|
2142
1954
|
return (t, r) => {
|
|
2143
|
-
const n =
|
|
2144
|
-
if (o &&
|
|
1955
|
+
const n = ir(t, r), o = e.get(r);
|
|
1956
|
+
if (o && Bo(o.slices, n))
|
|
2145
1957
|
return o.viewModel;
|
|
2146
|
-
const
|
|
2147
|
-
return e.set(r, { slices: n, viewModel:
|
|
1958
|
+
const i = sr(t, r, n, o);
|
|
1959
|
+
return e.set(r, { slices: n, viewModel: i }), i;
|
|
2148
1960
|
};
|
|
2149
1961
|
}
|
|
2150
|
-
const
|
|
2151
|
-
const r =
|
|
1962
|
+
const di = (e) => (t) => {
|
|
1963
|
+
const r = Ho();
|
|
2152
1964
|
return t.pipe(
|
|
2153
|
-
|
|
1965
|
+
At((n) => r(n, e)),
|
|
2154
1966
|
// The reader returns the same object while nothing changed, so reference equality is enough.
|
|
2155
|
-
|
|
1967
|
+
Ne()
|
|
2156
1968
|
);
|
|
2157
|
-
},
|
|
2158
|
-
function
|
|
2159
|
-
const r =
|
|
1969
|
+
}, zo = [], St = [], bo = [];
|
|
1970
|
+
function ir(e, t) {
|
|
1971
|
+
const r = Go(e, t);
|
|
2160
1972
|
return [
|
|
2161
1973
|
e.calculatedWidgets[t],
|
|
2162
1974
|
e.lang,
|
|
2163
|
-
r === void 0 ? void 0 :
|
|
1975
|
+
r === void 0 ? void 0 : V(e.data, r),
|
|
2164
1976
|
r !== void 0 && e.touched ? e.validations[r] : null,
|
|
2165
1977
|
r !== void 0 && e.touched ? e.injectedValidations[r] : null,
|
|
2166
1978
|
r !== void 0 && e.touchedControls[r] === !0,
|
|
@@ -2168,60 +1980,60 @@ function ar(e, t) {
|
|
|
2168
1980
|
e.widgetFlags[t]?.hidden === !0
|
|
2169
1981
|
];
|
|
2170
1982
|
}
|
|
2171
|
-
function
|
|
1983
|
+
function Bo(e, t) {
|
|
2172
1984
|
return e.every((r, n) => Object.is(r, t[n]));
|
|
2173
1985
|
}
|
|
2174
|
-
function
|
|
2175
|
-
const [o, s,
|
|
1986
|
+
function sr(e, t, r, n) {
|
|
1987
|
+
const [o, i, s, c, u, l, a, p] = r, g = n === void 0 || !Object.is(n.slices[0], o), w = n === void 0 || !Object.is(n.slices[2], s), Ee = n === void 0 || !Object.is(n.slices[3], c) || !Object.is(n.slices[4], u), Ce = o?.current;
|
|
2176
1988
|
return {
|
|
2177
1989
|
uid: t,
|
|
2178
1990
|
widget: Ce,
|
|
2179
|
-
children: g ?
|
|
2180
|
-
rows: g ||
|
|
2181
|
-
lang:
|
|
2182
|
-
value:
|
|
2183
|
-
errors:
|
|
1991
|
+
children: g ? Ko(e, t, Ce) : n.viewModel.children,
|
|
1992
|
+
rows: g || w ? Xo(e, t, Ce, s) : n.viewModel.rows,
|
|
1993
|
+
lang: i,
|
|
1994
|
+
value: s,
|
|
1995
|
+
errors: Ee ? xo(c, u) : n.viewModel.errors,
|
|
2184
1996
|
touched: l,
|
|
2185
1997
|
formInvalid: a,
|
|
2186
1998
|
hidden: p
|
|
2187
1999
|
};
|
|
2188
2000
|
}
|
|
2189
|
-
function
|
|
2001
|
+
function Go(e, t) {
|
|
2190
2002
|
return e.resolvedSources[t]?.path;
|
|
2191
2003
|
}
|
|
2192
|
-
function
|
|
2193
|
-
if (r === void 0 || !
|
|
2194
|
-
return
|
|
2195
|
-
const n = r.children, o =
|
|
2004
|
+
function Ko(e, t, r) {
|
|
2005
|
+
if (r === void 0 || !_(r))
|
|
2006
|
+
return zo;
|
|
2007
|
+
const n = r.children, o = Z(t);
|
|
2196
2008
|
if (o.length === 0)
|
|
2197
2009
|
return n;
|
|
2198
|
-
const
|
|
2199
|
-
return n.map((
|
|
2010
|
+
const i = o.map((s) => `[${s}]`).join("");
|
|
2011
|
+
return n.map((s) => e.resolvedSources[`${s.uid}${i}`] ?? s);
|
|
2200
2012
|
}
|
|
2201
|
-
function
|
|
2013
|
+
function Xo(e, t, r, n) {
|
|
2202
2014
|
if (r === void 0 || !Array.isArray(n))
|
|
2203
|
-
return
|
|
2015
|
+
return St;
|
|
2204
2016
|
const o = e.resolvedSources[t];
|
|
2205
|
-
if (o === void 0 ||
|
|
2206
|
-
return
|
|
2207
|
-
const
|
|
2208
|
-
return n.map((
|
|
2209
|
-
const l =
|
|
2017
|
+
if (o === void 0 || !$e(o))
|
|
2018
|
+
return St;
|
|
2019
|
+
const i = o.props.template.uid, s = Z(t);
|
|
2020
|
+
return n.map((c, u) => {
|
|
2021
|
+
const l = ze(i, [...s, u]);
|
|
2210
2022
|
return e.resolvedSources[l];
|
|
2211
|
-
}).filter((
|
|
2023
|
+
}).filter((c) => c !== void 0);
|
|
2212
2024
|
}
|
|
2213
|
-
function
|
|
2214
|
-
return (e?.length ?? 0) + (t?.length ?? 0) === 0 ?
|
|
2025
|
+
function xo(e, t) {
|
|
2026
|
+
return (e?.length ?? 0) + (t?.length ?? 0) === 0 ? bo : [...e ?? [], ...t ?? []];
|
|
2215
2027
|
}
|
|
2216
|
-
let
|
|
2217
|
-
function
|
|
2218
|
-
|
|
2028
|
+
let cr = !1;
|
|
2029
|
+
function ui() {
|
|
2030
|
+
cr = !0;
|
|
2219
2031
|
}
|
|
2220
|
-
function
|
|
2221
|
-
return
|
|
2032
|
+
function Qo() {
|
|
2033
|
+
return cr;
|
|
2222
2034
|
}
|
|
2223
|
-
function
|
|
2224
|
-
if (!
|
|
2035
|
+
function li(e, t, r) {
|
|
2036
|
+
if (!Qo())
|
|
2225
2037
|
return;
|
|
2226
2038
|
const n = Object.keys(t ?? {}).filter((o) => o in r);
|
|
2227
2039
|
if (n.length > 0)
|
|
@@ -2229,26 +2041,26 @@ function ys(e, t, r) {
|
|
|
2229
2041
|
`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`
|
|
2230
2042
|
);
|
|
2231
2043
|
}
|
|
2232
|
-
const
|
|
2044
|
+
const ai = () => crypto.randomUUID().slice(0, 8);
|
|
2233
2045
|
export {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2046
|
+
oi as FormContext,
|
|
2047
|
+
li as assertNoPropCollisions,
|
|
2048
|
+
se as cloneObject,
|
|
2049
|
+
Ho as createWidgetViewModelReader,
|
|
2050
|
+
ei as defineForm,
|
|
2051
|
+
ii as devToolsMiddleware,
|
|
2052
|
+
ui as enableDevMode,
|
|
2053
|
+
k as errorCodes,
|
|
2054
|
+
ni as filterTap,
|
|
2055
|
+
ti as formEventNames,
|
|
2056
|
+
si as formHealth,
|
|
2057
|
+
ri as getDirectionFromLanguage,
|
|
2058
|
+
jr as identityTranslator,
|
|
2059
|
+
mr as isStandardValidateSuccess,
|
|
2060
|
+
Wt as makeRepeaterItemConfig,
|
|
2061
|
+
Yo as preloadFormWidgets,
|
|
2062
|
+
ai as shortUUID,
|
|
2063
|
+
hr as standardValidate,
|
|
2064
|
+
ci as widgetViewModel,
|
|
2065
|
+
di as widgetViewModel$
|
|
2254
2066
|
};
|