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