@golemui/core 0.13.0 → 0.13.2
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 +23 -22
- package/index.js +360 -392
- package/index.umd.cjs +6 -6
- package/lib/form.d.ts +1 -1
- package/lib/store/reducers/index.d.ts +14 -14
- package/package.json +1 -1
- package/lib/context/index.d.ts +0 -3
- package/lib/middleware/index.d.ts +0 -1
package/index.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import { BehaviorSubject as Jr, distinctUntilChanged as
|
|
1
|
+
import { BehaviorSubject as Jr, distinctUntilChanged as W, Subject as Qr, pipe as R, map as D, filter as Ee, combineLatest as qr, startWith as Yr } from "rxjs";
|
|
2
2
|
import "@standard-schema/spec";
|
|
3
|
-
|
|
3
|
+
function Zr(e, r) {
|
|
4
|
+
const t = e["~standard"].validate(r);
|
|
5
|
+
if (t instanceof Promise)
|
|
6
|
+
throw new TypeError("Schema validation must be synchronous");
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
function xr(e) {
|
|
10
|
+
return e.issues === void 0;
|
|
11
|
+
}
|
|
12
|
+
var br = class {
|
|
4
13
|
constructor(e) {
|
|
5
14
|
this.value = e;
|
|
6
15
|
}
|
|
7
16
|
map(e) {
|
|
8
|
-
return
|
|
17
|
+
return T(e(this.value));
|
|
9
18
|
}
|
|
10
19
|
isOk() {
|
|
11
20
|
return !0;
|
|
12
21
|
}
|
|
13
|
-
},
|
|
22
|
+
}, et = class {
|
|
14
23
|
constructor(e) {
|
|
15
24
|
this.error = e;
|
|
16
25
|
}
|
|
@@ -21,13 +30,13 @@ var Zr = class {
|
|
|
21
30
|
return !1;
|
|
22
31
|
}
|
|
23
32
|
};
|
|
24
|
-
function
|
|
25
|
-
return new
|
|
33
|
+
function T(e) {
|
|
34
|
+
return new br(e);
|
|
26
35
|
}
|
|
27
36
|
function v(e) {
|
|
28
|
-
return new
|
|
37
|
+
return new et(e);
|
|
29
38
|
}
|
|
30
|
-
var
|
|
39
|
+
var P = class Re {
|
|
31
40
|
constructor(r) {
|
|
32
41
|
this.decodeFn = r, this["~standard"] = { version: 1, vendor: "ts.data.json", validate: (t) => {
|
|
33
42
|
let n = this.decode(t);
|
|
@@ -51,7 +60,7 @@ var W = class Re {
|
|
|
51
60
|
map(r) {
|
|
52
61
|
return new Re((t) => {
|
|
53
62
|
let n = this.decodeFn(t);
|
|
54
|
-
return n.isOk() ?
|
|
63
|
+
return n.isOk() ? T(r(n.value)) : v(n.error);
|
|
55
64
|
});
|
|
56
65
|
}
|
|
57
66
|
flatMap(r) {
|
|
@@ -60,145 +69,82 @@ var W = class Re {
|
|
|
60
69
|
return n.isOk() ? r(n.value).decode(t) : v(n.error);
|
|
61
70
|
});
|
|
62
71
|
}
|
|
63
|
-
},
|
|
72
|
+
}, rt = (e, r, t) => `<${e}> decoder failed at index "${r}" with error: ${t}`, Y = (e, r) => `${JSON.stringify(e)} is not a valid ${r}`;
|
|
64
73
|
function Ve(e, r) {
|
|
65
|
-
return new
|
|
74
|
+
return new P((t) => {
|
|
66
75
|
if (t instanceof Array) {
|
|
67
76
|
let n = [];
|
|
68
77
|
for (let o = 0; o < t.length; o++) {
|
|
69
78
|
let i = e.decode(t[o]);
|
|
70
79
|
if (i.isOk()) n.push(i.value);
|
|
71
|
-
else return v(
|
|
80
|
+
else return v(rt(r, o, i.error));
|
|
72
81
|
}
|
|
73
|
-
return
|
|
82
|
+
return T(n);
|
|
74
83
|
} else return v(Y(t, "array"));
|
|
75
84
|
});
|
|
76
85
|
}
|
|
77
|
-
function
|
|
78
|
-
return new
|
|
86
|
+
function tt() {
|
|
87
|
+
return new P((e) => typeof e == "boolean" ? T(e) : v(Y(e, "boolean")));
|
|
79
88
|
}
|
|
80
89
|
function hr(e) {
|
|
81
|
-
return new
|
|
90
|
+
return new P((r) => e().decode(r));
|
|
82
91
|
}
|
|
83
|
-
var
|
|
92
|
+
var nt = (e, r) => `${JSON.stringify(e)} is not exactly ${JSON.stringify(r)}`;
|
|
84
93
|
function Se(e) {
|
|
85
|
-
return new
|
|
94
|
+
return new P((r) => r === e ? T(e) : v(nt(r, e)));
|
|
86
95
|
}
|
|
87
96
|
function ve() {
|
|
88
|
-
return new
|
|
97
|
+
return new P((e) => typeof e == "number" ? T(e) : v(Y(e, "number")));
|
|
89
98
|
}
|
|
90
|
-
var
|
|
99
|
+
var ot = (e, r, t) => `<${e}> decoder failed at key "${r}" with error: ${t}`;
|
|
91
100
|
function oe(e, r) {
|
|
92
|
-
return new
|
|
101
|
+
return new P((t) => {
|
|
93
102
|
if (t !== null && typeof t == "object") {
|
|
94
103
|
let n = {};
|
|
95
104
|
for (let o in e) if (Object.prototype.hasOwnProperty.call(e, o)) {
|
|
96
105
|
let i, s = e[o];
|
|
97
|
-
if (s instanceof
|
|
98
|
-
else return v(
|
|
106
|
+
if (s instanceof P ? i = s.decode(t[o]) : i = s.decoder.decode(t[s.fromKey]), i.isOk()) n[o] = i.value;
|
|
107
|
+
else return v(ot(r, o, i.error));
|
|
99
108
|
}
|
|
100
|
-
return
|
|
109
|
+
return T(n);
|
|
101
110
|
} else return v(Y(t, r));
|
|
102
111
|
});
|
|
103
112
|
}
|
|
104
|
-
var
|
|
113
|
+
var it = (e, r) => `<${e}> decoder failed because ${JSON.stringify(r)} can't be decoded with any of the provided oneOf decoders`;
|
|
105
114
|
function Z(e, r) {
|
|
106
|
-
return new
|
|
115
|
+
return new P((t) => {
|
|
107
116
|
for (let n = 0; n < e.length; n++) {
|
|
108
117
|
let o = e[n].decode(t);
|
|
109
118
|
if (o.isOk()) return o;
|
|
110
119
|
}
|
|
111
|
-
return v(
|
|
120
|
+
return v(it(r, t));
|
|
112
121
|
});
|
|
113
122
|
}
|
|
114
|
-
function
|
|
115
|
-
return new
|
|
123
|
+
function $(e) {
|
|
124
|
+
return new P((r) => r === void 0 ? T(void 0) : e.decode(r));
|
|
116
125
|
}
|
|
117
|
-
var
|
|
118
|
-
function
|
|
119
|
-
return new
|
|
126
|
+
var st = (e, r, t) => `<${e}> record decoder failed at key "${r}" with error: ${t}`;
|
|
127
|
+
function dt(e, r) {
|
|
128
|
+
return new P((t) => {
|
|
120
129
|
if (t !== null && typeof t == "object") {
|
|
121
130
|
let n = {};
|
|
122
131
|
for (let o in t) if (Object.prototype.hasOwnProperty.call(t, o)) {
|
|
123
132
|
let i = e.decode(t[o]);
|
|
124
133
|
if (i.isOk()) n[o] = i.value;
|
|
125
|
-
else return v(
|
|
134
|
+
else return v(st(r, o, i.error));
|
|
126
135
|
}
|
|
127
|
-
return
|
|
136
|
+
return T(n);
|
|
128
137
|
} else return v(Y(t, r));
|
|
129
138
|
});
|
|
130
139
|
}
|
|
131
140
|
function I() {
|
|
132
|
-
return new
|
|
141
|
+
return new P((e) => typeof e == "string" ? T(e) : v(Y(e, "string")));
|
|
133
142
|
}
|
|
134
143
|
function J() {
|
|
135
|
-
return new
|
|
136
|
-
}
|
|
137
|
-
function vo(e) {
|
|
138
|
-
return {
|
|
139
|
-
...e,
|
|
140
|
-
form: {
|
|
141
|
-
uid: "",
|
|
142
|
-
type: "flex",
|
|
143
|
-
kind: "layout",
|
|
144
|
-
children: e.form
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
const pr = oe(
|
|
149
|
-
{
|
|
150
|
-
states: A(it(I(), "states")),
|
|
151
|
-
form: hr(() => He)
|
|
152
|
-
},
|
|
153
|
-
"FormDef"
|
|
154
|
-
), gr = (e) => ({
|
|
155
|
-
formName: "",
|
|
156
|
-
formDef: pr.parse({
|
|
157
|
-
form: {
|
|
158
|
-
kind: "layout",
|
|
159
|
-
type: "flex",
|
|
160
|
-
children: []
|
|
161
|
-
}
|
|
162
|
-
}),
|
|
163
|
-
flatForm: {},
|
|
164
|
-
currentStates: [],
|
|
165
|
-
calculatedWidgets: {},
|
|
166
|
-
validations: {},
|
|
167
|
-
touchedControls: {},
|
|
168
|
-
injectedValidations: {},
|
|
169
|
-
widgetFlags: {},
|
|
170
|
-
widgetPropOverrides: {},
|
|
171
|
-
data: {},
|
|
172
|
-
meta: {},
|
|
173
|
-
formHealth: { status: "ok" },
|
|
174
|
-
touched: !1,
|
|
175
|
-
lang: e
|
|
176
|
-
}), st = (e) => !(typeof e != "object" || e === null || typeof e.key != "string");
|
|
177
|
-
function Io(e) {
|
|
178
|
-
const r = new Intl.Locale(e).maximize().script;
|
|
179
|
-
return ["Arab", "Hebr", "Thaa", "Syrc", "Tfng", "Adlm", "Rohg"].includes(r || "") ? "rtl" : "ltr";
|
|
144
|
+
return new P((e) => T(e));
|
|
180
145
|
}
|
|
181
|
-
const dt = (e = navigator.language || "en-US") => {
|
|
182
|
-
const r = /* @__PURE__ */ new Set();
|
|
183
|
-
return {
|
|
184
|
-
get lang() {
|
|
185
|
-
return e;
|
|
186
|
-
},
|
|
187
|
-
translate(n) {
|
|
188
|
-
return n;
|
|
189
|
-
},
|
|
190
|
-
subscribe(n) {
|
|
191
|
-
return r.add(n), () => {
|
|
192
|
-
r.delete(n);
|
|
193
|
-
};
|
|
194
|
-
},
|
|
195
|
-
setLang(n) {
|
|
196
|
-
e = n, r.forEach((o) => o(e));
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
146
|
function ie(e, r) {
|
|
201
|
-
return new
|
|
147
|
+
return new P((t) => {
|
|
202
148
|
if (typeof t != "object" || t === null)
|
|
203
149
|
return v(`<${r}> failed. Expected object literal, got "${typeof t}"`);
|
|
204
150
|
const n = {};
|
|
@@ -216,81 +162,81 @@ function ie(e, r) {
|
|
|
216
162
|
}
|
|
217
163
|
}
|
|
218
164
|
}
|
|
219
|
-
return
|
|
165
|
+
return T(n);
|
|
220
166
|
});
|
|
221
167
|
}
|
|
222
|
-
const
|
|
168
|
+
const pr = () => crypto.randomUUID().slice(0, 8), ut = (e) => typeof e != "function" && e.kind === "display", re = (e) => typeof e != "function" && e.kind === "action", F = (e) => typeof e != "function" && e.kind === "input", ke = (e) => typeof e != "function" && e.kind === "layout", se = (e) => typeof e == "function", ct = oe({ in: Ve(I(), "In[]") }, "In"), Ue = oe({ when: I() }, "When"), Ie = Z([ct, Ue], "In | When"), lt = oe({ from: Ve(I(), "From[]") }, "From"), Oe = Z([lt, Ue], "Exclude"), _e = Z([tt(), Ue], "Bool | When"), at = new P((e) => {
|
|
223
169
|
const r = typeof e;
|
|
224
|
-
return r === "function" ?
|
|
225
|
-
}),
|
|
170
|
+
return r === "function" ? T(e) : v(`Expected a function, got '${r}'`);
|
|
171
|
+
}), H = (e) => Z([e, at], ""), He = ie(
|
|
226
172
|
{
|
|
227
|
-
load: { suffixed: !0, decoder:
|
|
228
|
-
click: { suffixed: !0, decoder:
|
|
229
|
-
change: { suffixed: !0, decoder:
|
|
230
|
-
filter: { suffixed: !0, decoder:
|
|
231
|
-
blur: { suffixed: !0, decoder:
|
|
173
|
+
load: { suffixed: !0, decoder: H($(I())) },
|
|
174
|
+
click: { suffixed: !0, decoder: H($(I())) },
|
|
175
|
+
change: { suffixed: !0, decoder: H($(I())) },
|
|
176
|
+
filter: { suffixed: !0, decoder: H($(I())) },
|
|
177
|
+
blur: { suffixed: !0, decoder: H($(I())) }
|
|
232
178
|
},
|
|
233
179
|
"On"
|
|
234
180
|
), ft = oe(
|
|
235
181
|
{
|
|
236
182
|
key: I(),
|
|
237
|
-
default:
|
|
183
|
+
default: $(I()),
|
|
238
184
|
params: J()
|
|
239
185
|
},
|
|
240
186
|
"TranslationConfig"
|
|
241
|
-
),
|
|
187
|
+
), gr = Z([I(), ft], "Localizable"), we = $(I()).map((e) => e || pr()), ht = ie(
|
|
242
188
|
{
|
|
243
189
|
kind: { decoder: Se("display") },
|
|
244
|
-
uid: { decoder:
|
|
190
|
+
uid: { decoder: we },
|
|
245
191
|
type: { decoder: I() },
|
|
246
|
-
size: { suffixed: !0, decoder:
|
|
247
|
-
include: { decoder:
|
|
248
|
-
exclude: { decoder:
|
|
249
|
-
props: { decoder:
|
|
192
|
+
size: { suffixed: !0, decoder: $(ve()) },
|
|
193
|
+
include: { decoder: $(Ie) },
|
|
194
|
+
exclude: { decoder: $(Oe) },
|
|
195
|
+
props: { decoder: $(J()) }
|
|
250
196
|
},
|
|
251
197
|
"DisplayWidget"
|
|
252
198
|
), pt = ie(
|
|
253
199
|
{
|
|
254
200
|
kind: { decoder: Se("action") },
|
|
255
|
-
uid: { decoder:
|
|
201
|
+
uid: { decoder: we },
|
|
256
202
|
type: { decoder: I() },
|
|
257
|
-
size: { suffixed: !0, decoder:
|
|
258
|
-
include: { decoder:
|
|
259
|
-
exclude: { decoder:
|
|
260
|
-
label: { suffixed: !0, decoder:
|
|
261
|
-
disabled: { suffixed: !0, decoder:
|
|
262
|
-
on: { decoder:
|
|
263
|
-
props: { decoder:
|
|
203
|
+
size: { suffixed: !0, decoder: $(ve()) },
|
|
204
|
+
include: { decoder: $(Ie) },
|
|
205
|
+
exclude: { decoder: $(Oe) },
|
|
206
|
+
label: { suffixed: !0, decoder: H(gr) },
|
|
207
|
+
disabled: { suffixed: !0, decoder: $(_e) },
|
|
208
|
+
on: { decoder: $(He) },
|
|
209
|
+
props: { decoder: $(J()) }
|
|
264
210
|
},
|
|
265
211
|
"ActionWidget"
|
|
266
|
-
), gt = new
|
|
212
|
+
), gt = new P((e) => {
|
|
267
213
|
const r = typeof e;
|
|
268
214
|
if (r === "function") {
|
|
269
215
|
const t = e, n = t(void 0);
|
|
270
|
-
return t.uid = n.uid ||
|
|
216
|
+
return t.uid = n.uid || pr(), t.type = n.type, t.path = n.path, T(t);
|
|
271
217
|
} else
|
|
272
218
|
return v(`Expected a function, got '${r}'`);
|
|
273
219
|
}), mt = ie(
|
|
274
220
|
{
|
|
275
221
|
kind: { decoder: Se("input") },
|
|
276
|
-
uid: { decoder:
|
|
222
|
+
uid: { decoder: we },
|
|
277
223
|
type: { decoder: I() },
|
|
278
|
-
size: { suffixed: !0, decoder:
|
|
279
|
-
include: { decoder:
|
|
280
|
-
exclude: { decoder:
|
|
281
|
-
disabled: { suffixed: !0, decoder:
|
|
282
|
-
readonly: { suffixed: !0, decoder:
|
|
283
|
-
on: { decoder:
|
|
284
|
-
props: { decoder:
|
|
224
|
+
size: { suffixed: !0, decoder: $(ve()) },
|
|
225
|
+
include: { decoder: $(Ie) },
|
|
226
|
+
exclude: { decoder: $(Oe) },
|
|
227
|
+
disabled: { suffixed: !0, decoder: $(_e) },
|
|
228
|
+
readonly: { suffixed: !0, decoder: $(_e) },
|
|
229
|
+
on: { decoder: $(He) },
|
|
230
|
+
props: { decoder: $(J()) },
|
|
285
231
|
label: {
|
|
286
232
|
suffixed: !0,
|
|
287
|
-
decoder:
|
|
233
|
+
decoder: H($(gr))
|
|
288
234
|
},
|
|
289
235
|
path: { decoder: I() },
|
|
290
|
-
defaultValue: { decoder:
|
|
236
|
+
defaultValue: { decoder: $(J()) },
|
|
291
237
|
validator: {
|
|
292
238
|
suffixed: !0,
|
|
293
|
-
decoder:
|
|
239
|
+
decoder: H($(J()))
|
|
294
240
|
}
|
|
295
241
|
},
|
|
296
242
|
"InputWidget"
|
|
@@ -298,7 +244,7 @@ const mr = () => crypto.randomUUID().slice(0, 8), ut = (e) => typeof e != "funct
|
|
|
298
244
|
const r = { ...e };
|
|
299
245
|
if (e.uid || (r.uid = `${e.path}-${e.type}`), e.type === "repeater") {
|
|
300
246
|
const t = e.props;
|
|
301
|
-
t.template =
|
|
247
|
+
t.template = Be.parse(t.template);
|
|
302
248
|
}
|
|
303
249
|
return r;
|
|
304
250
|
}), yt = hr(
|
|
@@ -306,22 +252,22 @@ const mr = () => crypto.randomUUID().slice(0, 8), ut = (e) => typeof e != "funct
|
|
|
306
252
|
[
|
|
307
253
|
gt,
|
|
308
254
|
mt,
|
|
309
|
-
|
|
255
|
+
Be,
|
|
310
256
|
ht,
|
|
311
257
|
pt
|
|
312
258
|
],
|
|
313
259
|
"FormWidget"
|
|
314
260
|
)
|
|
315
|
-
),
|
|
261
|
+
), Be = ie(
|
|
316
262
|
{
|
|
317
263
|
kind: { decoder: Se("layout") },
|
|
318
|
-
uid: { decoder:
|
|
264
|
+
uid: { decoder: we },
|
|
319
265
|
type: { decoder: I() },
|
|
320
|
-
size: { suffixed: !0, decoder:
|
|
321
|
-
include: { decoder:
|
|
322
|
-
exclude: { decoder:
|
|
323
|
-
props: { decoder:
|
|
324
|
-
on: { decoder:
|
|
266
|
+
size: { suffixed: !0, decoder: $(ve()) },
|
|
267
|
+
include: { decoder: $(Ie) },
|
|
268
|
+
exclude: { decoder: $(Oe) },
|
|
269
|
+
props: { decoder: $(J()) },
|
|
270
|
+
on: { decoder: $(He) },
|
|
325
271
|
children: { decoder: Ve(yt, "FormWidget[]") }
|
|
326
272
|
},
|
|
327
273
|
"LayoutWidget"
|
|
@@ -349,24 +295,74 @@ const mr = () => crypto.randomUUID().slice(0, 8), ut = (e) => typeof e != "funct
|
|
|
349
295
|
};
|
|
350
296
|
X.sharedCache = /* @__PURE__ */ new Map();
|
|
351
297
|
let Ne = X;
|
|
352
|
-
function
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
298
|
+
function So(e) {
|
|
299
|
+
return {
|
|
300
|
+
...e,
|
|
301
|
+
form: {
|
|
302
|
+
uid: "",
|
|
303
|
+
type: "flex",
|
|
304
|
+
kind: "layout",
|
|
305
|
+
children: e.form
|
|
306
|
+
}
|
|
307
|
+
};
|
|
357
308
|
}
|
|
358
|
-
|
|
359
|
-
|
|
309
|
+
const mr = oe(
|
|
310
|
+
{
|
|
311
|
+
states: $(dt(I(), "states")),
|
|
312
|
+
form: hr(() => Be)
|
|
313
|
+
},
|
|
314
|
+
"FormDef"
|
|
315
|
+
), yr = (e) => ({
|
|
316
|
+
formName: "",
|
|
317
|
+
formDef: mr.parse({
|
|
318
|
+
form: {
|
|
319
|
+
kind: "layout",
|
|
320
|
+
type: "flex",
|
|
321
|
+
children: []
|
|
322
|
+
}
|
|
323
|
+
}),
|
|
324
|
+
flatForm: {},
|
|
325
|
+
currentStates: [],
|
|
326
|
+
calculatedWidgets: {},
|
|
327
|
+
validations: {},
|
|
328
|
+
touchedControls: {},
|
|
329
|
+
injectedValidations: {},
|
|
330
|
+
widgetFlags: {},
|
|
331
|
+
widgetPropOverrides: {},
|
|
332
|
+
data: {},
|
|
333
|
+
meta: {},
|
|
334
|
+
formHealth: { status: "ok" },
|
|
335
|
+
touched: !1,
|
|
336
|
+
lang: e
|
|
337
|
+
}), At = (e) => !(typeof e != "object" || e === null || typeof e.key != "string");
|
|
338
|
+
function vo(e) {
|
|
339
|
+
const r = new Intl.Locale(e).maximize().script;
|
|
340
|
+
return ["Arab", "Hebr", "Thaa", "Syrc", "Tfng", "Adlm", "Rohg"].includes(r || "") ? "rtl" : "ltr";
|
|
360
341
|
}
|
|
361
|
-
const
|
|
342
|
+
const $t = (e = navigator.language || "en-US") => {
|
|
343
|
+
const r = /* @__PURE__ */ new Set();
|
|
344
|
+
return {
|
|
345
|
+
get lang() {
|
|
346
|
+
return e;
|
|
347
|
+
},
|
|
348
|
+
translate(n) {
|
|
349
|
+
return n;
|
|
350
|
+
},
|
|
351
|
+
subscribe(n) {
|
|
352
|
+
return r.add(n), () => {
|
|
353
|
+
r.delete(n);
|
|
354
|
+
};
|
|
355
|
+
},
|
|
356
|
+
setLang(n) {
|
|
357
|
+
e = n, r.forEach((o) => o(e));
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
}, Et = (e) => {
|
|
362
361
|
throw new Error(`Unhandled case: ${JSON.stringify(e)}`);
|
|
363
362
|
};
|
|
364
363
|
function L(e, ...r) {
|
|
365
364
|
return r.reduce((t, n) => n(t), e);
|
|
366
365
|
}
|
|
367
|
-
function wo(...e) {
|
|
368
|
-
return (r) => e.reduceRight((t, n) => n(t), r);
|
|
369
|
-
}
|
|
370
366
|
function St(e, r) {
|
|
371
367
|
const t = r.payload.widget.uid;
|
|
372
368
|
if (!t)
|
|
@@ -423,26 +419,26 @@ function sr(e) {
|
|
|
423
419
|
r[t] = sr(e[t]);
|
|
424
420
|
return r;
|
|
425
421
|
}
|
|
426
|
-
const
|
|
422
|
+
const C = {
|
|
427
423
|
FORM: "$form",
|
|
428
424
|
META: "$meta",
|
|
429
425
|
ERRORS: "$errors",
|
|
430
426
|
FORM_IS_INVALID: "$formIsInvalid"
|
|
431
|
-
}, It = (e) => typeof e == "string" && !e.includes(" ") && (e.startsWith(`${
|
|
432
|
-
`\\{\\{(?:(?<scope>${
|
|
427
|
+
}, It = (e) => typeof e == "string" && !e.includes(" ") && (e.startsWith(`${C.FORM}.`) || e.startsWith(`${C.META}.`) || e.startsWith(`${C.ERRORS}.`) || e === C.FORM_IS_INVALID), Ot = [C.FORM, C.META, C.ERRORS].map((e) => e.replace("$", "\\$")).join("|"), wt = new RegExp(
|
|
428
|
+
`\\{\\{(?:(?<scope>${Ot})\\.(?<path>[^}]+)|(?<isInvalid>\\${C.FORM_IS_INVALID}))\\}\\}`,
|
|
433
429
|
"g"
|
|
434
|
-
), Ct = (e, r) => typeof e != "string" || !e.includes("{{$") ? e : e.replace(
|
|
430
|
+
), Ct = (e, r) => typeof e != "string" || !e.includes("{{$") ? e : e.replace(wt, (t, ...n) => {
|
|
435
431
|
const o = n[n.length - 1], { scope: i, path: s, isInvalid: u } = o;
|
|
436
432
|
try {
|
|
437
|
-
if (u ===
|
|
433
|
+
if (u === C.FORM_IS_INVALID)
|
|
438
434
|
return r.resolveFormIsInvalid();
|
|
439
435
|
if (i && s)
|
|
440
436
|
switch (i) {
|
|
441
|
-
case
|
|
437
|
+
case C.FORM:
|
|
442
438
|
return r.resolveFormPath(s);
|
|
443
|
-
case
|
|
439
|
+
case C.META:
|
|
444
440
|
return r.resolveMetaPath(s);
|
|
445
|
-
case
|
|
441
|
+
case C.ERRORS:
|
|
446
442
|
return r.resolveErrorsPath(s);
|
|
447
443
|
default:
|
|
448
444
|
return t;
|
|
@@ -451,17 +447,17 @@ const F = {
|
|
|
451
447
|
return console.error(`Error resolving Expression: '${e}'`, c), t;
|
|
452
448
|
}
|
|
453
449
|
return t;
|
|
454
|
-
}),
|
|
455
|
-
const t = `${
|
|
450
|
+
}), Dt = (e, r) => {
|
|
451
|
+
const t = `${C.FORM}.`;
|
|
456
452
|
if (e.startsWith(t))
|
|
457
453
|
return r.resolveFormPath(e.replace(t, ""));
|
|
458
|
-
const n = `${
|
|
454
|
+
const n = `${C.META}.`;
|
|
459
455
|
if (e.startsWith(n))
|
|
460
456
|
return r.resolveMetaPath(e.replace(n, ""));
|
|
461
|
-
const o = `${
|
|
457
|
+
const o = `${C.ERRORS}.`;
|
|
462
458
|
if (e.startsWith(o))
|
|
463
459
|
return r.resolveErrorsPath(e.replace(o, ""));
|
|
464
|
-
if (e ===
|
|
460
|
+
if (e === C.FORM_IS_INVALID)
|
|
465
461
|
return r.resolveFormIsInvalid();
|
|
466
462
|
};
|
|
467
463
|
function Ke(e) {
|
|
@@ -482,10 +478,10 @@ let Le, f, p, m = (e) => (f = 0, p = e, m.newline = !1, e = E(), p[f] ? Q() : e
|
|
|
482
478
|
throw SyntaxError(`${e} at ${t.length + 1}:${n.length + 1}
|
|
483
479
|
${p[r - 41] !== `
|
|
484
480
|
`, "" + o}${s}${u}`);
|
|
485
|
-
},
|
|
481
|
+
}, Ar = (e, r = f) => (Array.isArray(e) && (e.loc = r), e), x = (e, r = f, t) => {
|
|
486
482
|
for (; t = e(p.charCodeAt(f)); ) f += t;
|
|
487
483
|
return p.slice(r, f);
|
|
488
|
-
},
|
|
484
|
+
}, O = (e = 1) => p[f += e], Me = (e) => f = e, E = (e = 0, r) => {
|
|
489
485
|
let t, n, o, i, s;
|
|
490
486
|
for (r && m.asi && (m.newline = !1); (t = m.space()) && (s = m.newline, 1) && t !== r && (o = // ASI before [ on new line (access handler would consume it; lineBreak distinguishes real \n from synthetic } flag)
|
|
491
487
|
(n && t === 91 && Le && m.asi?.(n, e, E) || null) ?? ((i = _[t]) && i(n, e)) ?? (n && s && m.asi?.(n, e, E)) ?? (!n && x(m.id))); ) n = o;
|
|
@@ -494,16 +490,16 @@ ${p[r - 41] !== `
|
|
|
494
490
|
for (Le = !1; (e = p.charCodeAt(f)) <= ze; )
|
|
495
491
|
m.asi && e === 10 && (m.newline = Le = !0), f++;
|
|
496
492
|
return e;
|
|
497
|
-
},
|
|
493
|
+
}, Ft = (e = f) => {
|
|
498
494
|
for (; p.charCodeAt(e) <= ze; ) e++;
|
|
499
495
|
return p.charCodeAt(e);
|
|
500
496
|
};
|
|
501
497
|
m.id = (e) => e >= 48 && e <= 57 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e == 36 || e == 95 || e >= 192 && e != 215 && e != 247;
|
|
502
|
-
let Pt = (e, r = e.length) => p.substr(f, r) === e && !m.id(p.charCodeAt(f + r)), _ = [], dr = {}, k = (e, r = ze, t, n = e.charCodeAt(0), o = e.length, i = _[n], s = e.toUpperCase() !== e, u, c) => (r = dr[e] = !i && dr[e] || r, _[n] = (h,
|
|
498
|
+
let Pt = (e, r = e.length) => p.substr(f, r) === e && !m.id(p.charCodeAt(f + r)), _ = [], dr = {}, k = (e, r = ze, t, n = e.charCodeAt(0), o = e.length, i = _[n], s = e.toUpperCase() !== e, u, c) => (r = dr[e] = !i && dr[e] || r, _[n] = (h, A, g, a = f) => (u = g, (g ? e == g : (o < 2 || e.charCodeAt(1) === p.charCodeAt(f + 1) && (o < 3 || p.substr(f, o) == e)) && (!s || !m.id(p.charCodeAt(f + o))) && (u = g = e)) && A < r && (f += o, (c = t(h)) ? Ar(c, a) : (f = a, u = 0, !s && !i && !h && Q()), c) || i?.(h, A, u))), y = (e, r, t = !1) => k(e, r, (n) => n && /* @__PURE__ */ ((o) => o && [e, n, o])(E(r - (t ? 0.5 : 0)))), K = (e, r, t) => k(e, r, (n) => !n && (n = E(r - 0.5)) && [e, n]), de = (e, r) => k(e, 200, (t) => !t && [, r]), $r = (e, r, t) => k(
|
|
503
499
|
e,
|
|
504
500
|
r,
|
|
505
501
|
(n, o) => (o = E(r - (t ? 0.5 : 0)), n?.[0] !== e && (n = [e, n || null]), o?.[0] === e ? n.push(...o.slice(1)) : n.push(o || null), n)
|
|
506
|
-
), Je = (e, r) => k(e[0], r, (t) => !t && [e, E(0, e.charCodeAt(1)) || null]), Er = (e, r) => k(e[0], r, (t) => t && [e, t, E(0, e.charCodeAt(1)) || null]), ue = (e, r, t, n = e.charCodeAt(0), o = e.length, i = _[n], s) => _[n] = (u, c, h,
|
|
502
|
+
), Je = (e, r) => k(e[0], r, (t) => !t && [e, E(0, e.charCodeAt(1)) || null]), Er = (e, r) => k(e[0], r, (t) => t && [e, t, E(0, e.charCodeAt(1)) || null]), ue = (e, r, t, n = e.charCodeAt(0), o = e.length, i = _[n], s) => _[n] = (u, c, h, A = f) => !u && (h ? e == h : (o < 2 || p.substr(f, o) == e) && (h = e)) && c < r && !m.id(p.charCodeAt(f + o)) && (!m.prop || m.prop(f + o)) && (Me(f + o), (s = t()) ? Ar(s, A) : Me(A), s) || i?.(u, c, h);
|
|
507
503
|
Object.defineProperty(m, "space", {
|
|
508
504
|
configurable: !0,
|
|
509
505
|
enumerable: !0,
|
|
@@ -521,7 +517,7 @@ const je = {}, l = (e, r, t = je[e]) => je[e] = (...n) => r(...n) || t?.(...n),
|
|
|
521
517
|
t === pe && p.charCodeAt(f + 1) !== pe || t >= te && t <= ge || t === he || ((t === Wt || t === Tt) && ((t = p.charCodeAt(f + 1)) >= te && t <= ge || t === Rt || t === kt) ? 2 : 0)
|
|
522
518
|
)
|
|
523
519
|
));
|
|
524
|
-
return p.charCodeAt(f) === Sr ? (
|
|
520
|
+
return p.charCodeAt(f) === Sr ? (O(), [, BigInt(r)]) : (e = +r) != e ? Q() : [, e];
|
|
525
521
|
}, jt = {
|
|
526
522
|
2: (e) => e === 48 || e === 49 || e === he,
|
|
527
523
|
8: (e) => e >= 48 && e <= 55 || e === he,
|
|
@@ -536,9 +532,9 @@ _[te] = (e) => {
|
|
|
536
532
|
if (r) {
|
|
537
533
|
for (const [t, n] of Object.entries(r))
|
|
538
534
|
if (t[0] === "0" && p[f + 1]?.toLowerCase() === t[1]) {
|
|
539
|
-
|
|
535
|
+
O(2);
|
|
540
536
|
const o = vr(x(jt[n]));
|
|
541
|
-
return p.charCodeAt(f) === Sr ? (
|
|
537
|
+
return p.charCodeAt(f) === Sr ? (O(), [, BigInt("0" + t[1] + o)]) : [, parseInt(o, n)];
|
|
542
538
|
}
|
|
543
539
|
}
|
|
544
540
|
return Qe();
|
|
@@ -546,14 +542,14 @@ _[te] = (e) => {
|
|
|
546
542
|
const Vt = 92, ur = 34, cr = 39, Ut = { n: `
|
|
547
543
|
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" }, Ir = (e) => (r, t, n = "") => {
|
|
548
544
|
if (!(r || !m.string?.[String.fromCharCode(e)]))
|
|
549
|
-
return
|
|
545
|
+
return O(), x((o) => o - e && (o === Vt ? (n += Ut[p[f + 1]] || p[f + 1], 2) : (n += p[f], 1))), p[f] === String.fromCharCode(e) ? O() : Q("Bad string"), [, n];
|
|
550
546
|
};
|
|
551
547
|
_[ur] = Ir(ur);
|
|
552
548
|
_[cr] = Ir(cr);
|
|
553
549
|
m.string = { '"': !0 };
|
|
554
|
-
const
|
|
555
|
-
"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map((e) => y(e,
|
|
556
|
-
const
|
|
550
|
+
const Ht = 20;
|
|
551
|
+
"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map((e) => y(e, Ht, !0));
|
|
552
|
+
const Or = (e, r, t, n) => typeof e == "string" ? (o) => r(o, e, o) : e[0] === "." ? (t = d(e[1]), n = e[2], (o) => r(t(o), n, o)) : e[0] === "[]" && e.length === 3 ? (t = d(e[1]), n = d(e[2]), (o) => r(t(o), n(o), o)) : e[0] === "()" && e.length === 2 ? Or(e[1], r) : (() => {
|
|
557
553
|
throw Error("Invalid assignment target");
|
|
558
554
|
})(), lr = {
|
|
559
555
|
"=": (e, r, t) => e[r] = t,
|
|
@@ -568,20 +564,20 @@ const wr = (e, r, t, n) => typeof e == "string" ? (o) => r(o, e, o) : e[0] === "
|
|
|
568
564
|
">>=": (e, r, t) => e[r] >>= t,
|
|
569
565
|
"<<=": (e, r, t) => e[r] <<= t
|
|
570
566
|
};
|
|
571
|
-
for (const e in lr) l(e, (r, t) => (t = d(t),
|
|
572
|
-
const
|
|
567
|
+
for (const e in lr) l(e, (r, t) => (t = d(t), Or(r, (n, o, i) => lr[e](n, o, t(i)))));
|
|
568
|
+
const Bt = 30, Gt = 40, Kt = 140;
|
|
573
569
|
K("!", Kt);
|
|
574
|
-
y("||",
|
|
570
|
+
y("||", Bt);
|
|
575
571
|
y("&&", Gt);
|
|
576
572
|
l("!", (e) => (e = d(e), (r) => !e(r)));
|
|
577
573
|
l("||", (e, r) => (e = d(e), r = d(r), (t) => e(t) || r(t)));
|
|
578
574
|
l("&&", (e, r) => (e = d(e), r = d(r), (t) => e(t) && r(t)));
|
|
579
|
-
const Xt = 50, zt = 60, Jt = 70,
|
|
575
|
+
const Xt = 50, zt = 60, Jt = 70, wr = 100, Qt = 140;
|
|
580
576
|
y("|", Xt);
|
|
581
577
|
y("&", Jt);
|
|
582
578
|
y("^", zt);
|
|
583
|
-
y(">>",
|
|
584
|
-
y("<<",
|
|
579
|
+
y(">>", wr);
|
|
580
|
+
y("<<", wr);
|
|
585
581
|
K("~", Qt);
|
|
586
582
|
l("~", (e) => (e = d(e), (r) => ~e(r)));
|
|
587
583
|
l("|", (e, r) => (e = d(e), r = d(r), (t) => e(t) | r(t)));
|
|
@@ -603,14 +599,14 @@ y("==", Cr);
|
|
|
603
599
|
y("!=", Cr);
|
|
604
600
|
l("==", (e, r) => (e = d(e), r = d(r), (t) => e(t) == r(t)));
|
|
605
601
|
l("!=", (e, r) => (e = d(e), r = d(r), (t) => e(t) != r(t)));
|
|
606
|
-
const
|
|
607
|
-
y("+",
|
|
608
|
-
y("-",
|
|
602
|
+
const Dr = 110, qe = 120, Fr = 140;
|
|
603
|
+
y("+", Dr);
|
|
604
|
+
y("-", Dr);
|
|
609
605
|
y("*", qe);
|
|
610
606
|
y("/", qe);
|
|
611
607
|
y("%", qe);
|
|
612
|
-
K("+",
|
|
613
|
-
K("-",
|
|
608
|
+
K("+", Fr);
|
|
609
|
+
K("-", Fr);
|
|
614
610
|
l("+", (e, r) => r !== void 0 ? (e = d(e), r = d(r), (t) => e(t) + r(t)) : (e = d(e), (t) => +e(t)));
|
|
615
611
|
l("-", (e, r) => r !== void 0 ? (e = d(e), r = d(r), (t) => e(t) - r(t)) : (e = d(e), (t) => -e(t)));
|
|
616
612
|
l("*", (e, r) => (e = d(e), r = d(r), (t) => e(t) * r(t)));
|
|
@@ -628,8 +624,8 @@ const Ye = (e, r, t, n) => typeof e == "string" ? (o) => r(o, e) : e[0] === "."
|
|
|
628
624
|
l("++", (e, r) => Ye(e, r === null ? (t, n) => t[n]++ : (t, n) => ++t[n]));
|
|
629
625
|
l("--", (e, r) => Ye(e, r === null ? (t, n) => t[n]-- : (t, n) => --t[n]));
|
|
630
626
|
const qt = 5, Yt = 10;
|
|
631
|
-
|
|
632
|
-
|
|
627
|
+
$r(",", Yt);
|
|
628
|
+
$r(";", qt, !0);
|
|
633
629
|
const Pr = (...e) => (e = e.map(d), (r) => {
|
|
634
630
|
let t;
|
|
635
631
|
for (const n of e) t = n(r);
|
|
@@ -639,7 +635,7 @@ l(",", Pr);
|
|
|
639
635
|
l(";", Pr);
|
|
640
636
|
const Zt = 170;
|
|
641
637
|
Je("()", Zt);
|
|
642
|
-
const
|
|
638
|
+
const B = (e) => e?.[0] === "_" && e[1] === "_" || e === "constructor" || e === "prototype", Ze = 170;
|
|
643
639
|
Er("[]", Ze);
|
|
644
640
|
y(".", Ze);
|
|
645
641
|
Er("()", Ze);
|
|
@@ -649,9 +645,9 @@ const ye = (e) => {
|
|
|
649
645
|
l("[]", (e, r) => r === void 0 ? (e = e ? e[0] === "," ? e.slice(1) : [e] : [], e = e.map((t) => t == null ? (() => {
|
|
650
646
|
}) : t[0] === "..." ? (t = d(t[1]), (n) => t(n)) : (t = d(t), (n) => [t(n)])), (t) => e.flatMap((n) => n(t))) : (r == null && ye("Missing index"), e = d(e), r = d(r), (t) => {
|
|
651
647
|
const n = r(t);
|
|
652
|
-
return
|
|
648
|
+
return B(n) ? void 0 : e(t)[n];
|
|
653
649
|
}));
|
|
654
|
-
l(".", (e, r) => (e = d(e), r = r[0] ? r : r[1],
|
|
650
|
+
l(".", (e, r) => (e = d(e), r = r[0] ? r : r[1], B(r) ? () => {
|
|
655
651
|
} : (t) => e(t)[r]));
|
|
656
652
|
l("()", (e, r) => {
|
|
657
653
|
if (r === void 0) return e == null ? ye("Empty ()") : d(e);
|
|
@@ -669,11 +665,11 @@ const q = (e) => typeof e == "string" || Array.isArray(e) && (e[0] === "." || e[
|
|
|
669
665
|
}) : (e = d(e), (o) => r([e(o)], 0, o)), b = xe, xt = 32, bt = m.space;
|
|
670
666
|
m.comment ??= { "//": `
|
|
671
667
|
`, "/*": "*/" };
|
|
672
|
-
let
|
|
668
|
+
let Fe;
|
|
673
669
|
m.space = () => {
|
|
674
|
-
|
|
670
|
+
Fe || (Fe = Object.entries(m.comment).map(([o, i]) => [o, i, o.charCodeAt(0)]));
|
|
675
671
|
for (var e; e = bt(); ) {
|
|
676
|
-
for (var r = 0, t; t =
|
|
672
|
+
for (var r = 0, t; t = Fe[r++]; )
|
|
677
673
|
if (e === t[2] && p.substr(f, t[0].length) === t[0]) {
|
|
678
674
|
var n = f + t[0].length;
|
|
679
675
|
if (t[1] === `
|
|
@@ -716,7 +712,7 @@ y(">>>", sn);
|
|
|
716
712
|
y(">>>=", on, !0);
|
|
717
713
|
l(">>>", (e, r) => (e = d(e), r = d(r), (t) => e(t) >>> r(t)));
|
|
718
714
|
l(">>>=", (e, r) => (q(e) || dn("Invalid assignment target"), r = d(r), b(e, (t, n, o) => t[n] >>>= r(o))));
|
|
719
|
-
const be = 5, un = 10, cn = 20, ln = (e) => e[0]?.[0] === "," ? e[0].slice(1) : e,
|
|
715
|
+
const be = 5, un = 10, cn = 20, ln = (e) => e[0]?.[0] === "," ? e[0].slice(1) : e, Ae = (e, r, t) => {
|
|
720
716
|
if (typeof e == "string") {
|
|
721
717
|
t[e] = r;
|
|
722
718
|
return;
|
|
@@ -727,14 +723,14 @@ const be = 5, un = 10, cn = 20, ln = (e) => e[0]?.[0] === "," ? e[0].slice(1) :
|
|
|
727
723
|
for (const u of i) {
|
|
728
724
|
if (Array.isArray(u) && u[0] === "...") {
|
|
729
725
|
const a = {};
|
|
730
|
-
for (const
|
|
726
|
+
for (const w in r) s.includes(w) || (a[w] = r[w]);
|
|
731
727
|
t[u[1]] = a;
|
|
732
728
|
break;
|
|
733
729
|
}
|
|
734
|
-
let c, h,
|
|
735
|
-
typeof u == "string" ? c = h = u : u[0] === "=" ? (typeof u[1] == "string" ? c = h = u[1] : [, c, h] = u[1],
|
|
730
|
+
let c, h, A;
|
|
731
|
+
typeof u == "string" ? c = h = u : u[0] === "=" ? (typeof u[1] == "string" ? c = h = u[1] : [, c, h] = u[1], A = u[2]) : [, c, h] = u, s.push(c);
|
|
736
732
|
let g = r[c];
|
|
737
|
-
g === void 0 &&
|
|
733
|
+
g === void 0 && A && (g = d(A)(t)), Ae(h, g, t);
|
|
738
734
|
}
|
|
739
735
|
} else if (n === "[]") {
|
|
740
736
|
let s = 0;
|
|
@@ -749,8 +745,8 @@ const be = 5, un = 10, cn = 20, ln = (e) => e[0]?.[0] === "," ? e[0].slice(1) :
|
|
|
749
745
|
}
|
|
750
746
|
let c = u, h;
|
|
751
747
|
Array.isArray(u) && u[0] === "=" && ([, c, h] = u);
|
|
752
|
-
let
|
|
753
|
-
|
|
748
|
+
let A = r[s++];
|
|
749
|
+
A === void 0 && h && (A = d(h)(t)), Ae(c, A, t);
|
|
754
750
|
}
|
|
755
751
|
}
|
|
756
752
|
}, Rr = (e) => {
|
|
@@ -768,7 +764,7 @@ const kr = (...e) => (e = e.map((r) => {
|
|
|
768
764
|
const [, t, n] = r, o = d(n);
|
|
769
765
|
return typeof t == "string" ? (i) => {
|
|
770
766
|
i[t] = o(i);
|
|
771
|
-
} : (i) =>
|
|
767
|
+
} : (i) => Ae(t, o(i), i);
|
|
772
768
|
}
|
|
773
769
|
return d(r);
|
|
774
770
|
}), (r) => {
|
|
@@ -780,7 +776,7 @@ l("var", (e) => typeof e == "string" ? (r) => {
|
|
|
780
776
|
r[e] = void 0;
|
|
781
777
|
} : () => {
|
|
782
778
|
});
|
|
783
|
-
const er = 20,
|
|
779
|
+
const er = 20, De = (e) => {
|
|
784
780
|
throw Error(e);
|
|
785
781
|
};
|
|
786
782
|
y("||=", er, !0);
|
|
@@ -791,13 +787,13 @@ l("=", (e, r) => {
|
|
|
791
787
|
const t = e[1];
|
|
792
788
|
return r = d(r), typeof t == "string" ? (n) => {
|
|
793
789
|
n[t] = r(n);
|
|
794
|
-
} : (n) =>
|
|
790
|
+
} : (n) => Ae(t, r(n), n);
|
|
795
791
|
}
|
|
796
|
-
return q(e) ||
|
|
792
|
+
return q(e) || De("Invalid assignment target"), r = d(r), b(e, (t, n, o) => t[n] = r(o));
|
|
797
793
|
});
|
|
798
|
-
l("||=", (e, r) => (q(e) ||
|
|
799
|
-
l("&&=", (e, r) => (q(e) ||
|
|
800
|
-
l("??=", (e, r) => (q(e) ||
|
|
794
|
+
l("||=", (e, r) => (q(e) || De("Invalid assignment target"), r = d(r), b(e, (t, n, o) => t[n] ||= r(o))));
|
|
795
|
+
l("&&=", (e, r) => (q(e) || De("Invalid assignment target"), r = d(r), b(e, (t, n, o) => t[n] &&= r(o))));
|
|
796
|
+
l("??=", (e, r) => (q(e) || De("Invalid assignment target"), r = d(r), b(e, (t, n, o) => t[n] ??= r(o))));
|
|
801
797
|
de("true", !0);
|
|
802
798
|
de("false", !1);
|
|
803
799
|
de("null", null);
|
|
@@ -819,13 +815,13 @@ l("=>", (e, r) => {
|
|
|
819
815
|
return r = d(s ? ["{", r[1]] : r), (u) => (...c) => {
|
|
820
816
|
const h = {};
|
|
821
817
|
t.forEach((g, a) => h[g] = c[a]), o && (h[o] = c.slice(n));
|
|
822
|
-
const
|
|
818
|
+
const A = new Proxy(h, {
|
|
823
819
|
get: (g, a) => a in g ? g[a] : u?.[a],
|
|
824
|
-
set: (g, a,
|
|
820
|
+
set: (g, a, w) => ((a in g ? g : u)[a] = w, !0),
|
|
825
821
|
has: (g, a) => a in g || (u ? a in u : !1)
|
|
826
822
|
});
|
|
827
823
|
try {
|
|
828
|
-
const g = r(
|
|
824
|
+
const g = r(A);
|
|
829
825
|
return s ? void 0 : g;
|
|
830
826
|
} catch (g) {
|
|
831
827
|
if (g === an) return g[0];
|
|
@@ -840,38 +836,38 @@ const ar = 170;
|
|
|
840
836
|
k("?.", ar, (e, r) => {
|
|
841
837
|
if (!e) return;
|
|
842
838
|
const t = G();
|
|
843
|
-
return t === 40 ? (
|
|
839
|
+
return t === 40 ? (O(), ["?.()", e, E(0, 41) || null]) : t === 91 ? (O(), ["?.[]", e, E(0, 93)]) : (r = E(ar), r ? ["?.", e, r] : void 0);
|
|
844
840
|
});
|
|
845
|
-
l("?.", (e, r) => (e = d(e),
|
|
841
|
+
l("?.", (e, r) => (e = d(e), B(r) ? () => {
|
|
846
842
|
} : (t) => e(t)?.[r]));
|
|
847
843
|
l("?.[]", (e, r) => (e = d(e), r = d(r), (t) => {
|
|
848
844
|
const n = r(t);
|
|
849
|
-
return
|
|
845
|
+
return B(n) ? void 0 : e(t)?.[n];
|
|
850
846
|
}));
|
|
851
847
|
l("?.()", (e, r) => {
|
|
852
848
|
const t = r ? r[0] === "," ? (r = r.slice(1).map(d), (o) => r.map((i) => i(o))) : (r = d(r), (o) => [r(o)]) : () => [];
|
|
853
849
|
if (e[0] === "?.") {
|
|
854
850
|
const o = d(e[1]), i = e[2];
|
|
855
|
-
return
|
|
851
|
+
return B(i) ? () => {
|
|
856
852
|
} : (s) => o(s)?.[i]?.(...t(s));
|
|
857
853
|
}
|
|
858
854
|
if (e[0] === "?.[]") {
|
|
859
855
|
const o = d(e[1]), i = d(e[2]);
|
|
860
856
|
return (s) => {
|
|
861
857
|
const u = o(s), c = i(s);
|
|
862
|
-
return
|
|
858
|
+
return B(c) ? void 0 : u?.[c]?.(...t(s));
|
|
863
859
|
};
|
|
864
860
|
}
|
|
865
861
|
if (e[0] === ".") {
|
|
866
862
|
const o = d(e[1]), i = e[2];
|
|
867
|
-
return
|
|
863
|
+
return B(i) ? () => {
|
|
868
864
|
} : (s) => o(s)?.[i]?.(...t(s));
|
|
869
865
|
}
|
|
870
866
|
if (e[0] === "[]" && e.length === 3) {
|
|
871
867
|
const o = d(e[1]), i = d(e[2]);
|
|
872
868
|
return (s) => {
|
|
873
869
|
const u = o(s), c = i(s);
|
|
874
|
-
return
|
|
870
|
+
return B(c) ? void 0 : u?.[c]?.(...t(s));
|
|
875
871
|
};
|
|
876
872
|
}
|
|
877
873
|
const n = d(e);
|
|
@@ -884,7 +880,7 @@ K("delete", ne);
|
|
|
884
880
|
ue(
|
|
885
881
|
"new",
|
|
886
882
|
ne,
|
|
887
|
-
() => Pt(".target") ? (
|
|
883
|
+
() => Pt(".target") ? (O(7), ["new.target"]) : ["new", E(ne)]
|
|
888
884
|
);
|
|
889
885
|
l("typeof", (e) => (e = d(e), (r) => typeof e(r)));
|
|
890
886
|
l("void", (e) => (e = d(e), (r) => (e(r), void 0)));
|
|
@@ -908,9 +904,9 @@ const rr = Symbol("accessor"), tr = 20, pn = 40, _r = 41, Nr = 123, Lr = 125, Mr
|
|
|
908
904
|
G();
|
|
909
905
|
const t = x(m.id);
|
|
910
906
|
if (!t || (G(), p.charCodeAt(f) !== pn)) return !1;
|
|
911
|
-
|
|
907
|
+
O();
|
|
912
908
|
const n = E(0, _r);
|
|
913
|
-
return G(), p.charCodeAt(f) !== Nr ? !1 : (
|
|
909
|
+
return G(), p.charCodeAt(f) !== Nr ? !1 : (O(), [e, t, n, E(0, Lr)]);
|
|
914
910
|
};
|
|
915
911
|
k("get", tr - 1, Mr("get"));
|
|
916
912
|
k("set", tr - 1, Mr("set"));
|
|
@@ -918,7 +914,7 @@ k("(", tr - 1, (e) => {
|
|
|
918
914
|
if (!e || typeof e != "string") return;
|
|
919
915
|
const r = E(0, _r) || null;
|
|
920
916
|
if (G(), p.charCodeAt(f) === Nr)
|
|
921
|
-
return
|
|
917
|
+
return O(), [":", e, ["=>", ["()", r], E(0, Lr) || null]];
|
|
922
918
|
});
|
|
923
919
|
l("get", (e, r) => (r = r ? d(r) : () => {
|
|
924
920
|
}, (t) => [[rr, e, {
|
|
@@ -935,7 +931,7 @@ l("set", (e, r, t) => (t = t ? d(t) : () => {
|
|
|
935
931
|
}
|
|
936
932
|
}]]));
|
|
937
933
|
const gn = 20, jr = 200;
|
|
938
|
-
m.prop = (e) =>
|
|
934
|
+
m.prop = (e) => Ft(e) !== 58;
|
|
939
935
|
const mn = (e) => e == null || typeof e == "string" || [":", ",", "...", "get", "set"].includes(e[0]);
|
|
940
936
|
Je("[]", jr);
|
|
941
937
|
Je("{}", jr);
|
|
@@ -959,19 +955,19 @@ l("{}", (e, r) => {
|
|
|
959
955
|
l("{", (e) => (e = e ? d(e) : () => {
|
|
960
956
|
}, (r) => e(Object.create(r))));
|
|
961
957
|
l(":", (e, r) => (r = d(r), Array.isArray(e) ? (e = d(e), (t) => [[e(t), r(t)]]) : (t) => [[e, r(t)]]));
|
|
962
|
-
const yn = 170,
|
|
958
|
+
const yn = 170, $e = 96, An = 36, $n = 123, En = 92, Sn = { n: `
|
|
963
959
|
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" }, fr = () => {
|
|
964
960
|
const e = [];
|
|
965
|
-
for (let r = "", t; (t = p.charCodeAt(f)) !==
|
|
966
|
-
t ? t === En ? (
|
|
967
|
-
return
|
|
968
|
-
}, vn = _[
|
|
969
|
-
_[
|
|
961
|
+
for (let r = "", t; (t = p.charCodeAt(f)) !== $e; )
|
|
962
|
+
t ? t === En ? (O(), r += Sn[p[f]] || p[f], O()) : t === An && p.charCodeAt(f + 1) === $n ? (r && e.push([, r]), r = "", O(2), e.push(E(0, 125))) : (r += p[f], O(), t = p.charCodeAt(f), t === $e && r && e.push([, r])) : Q("Unterminated template");
|
|
963
|
+
return O(), e;
|
|
964
|
+
}, vn = _[$e];
|
|
965
|
+
_[$e] = (e, r) => e && r < yn ? m.asi && m.newline ? void 0 : (O(), ["``", e, ...fr()]) : (
|
|
970
966
|
// tagged
|
|
971
967
|
e ? (
|
|
972
968
|
// plain
|
|
973
969
|
vn?.(e, r)
|
|
974
|
-
) : (
|
|
970
|
+
) : (O(), ((t) => t.length < 2 && t[0]?.[0] === void 0 ? t[0] || [, ""] : ["`", ...t])(fr()))
|
|
975
971
|
);
|
|
976
972
|
l("`", (...e) => (e = e.map(d), (r) => e.map((t) => t(r)).join("")));
|
|
977
973
|
l("``", (e, ...r) => {
|
|
@@ -988,7 +984,7 @@ const In = {
|
|
|
988
984
|
log: (e, r) => (r ? console.log(r, e) : console.log(e), e)
|
|
989
985
|
};
|
|
990
986
|
function j(e, r, t, n, o) {
|
|
991
|
-
const i = m(
|
|
987
|
+
const i = m(On(e));
|
|
992
988
|
return d(i)({
|
|
993
989
|
$form: r,
|
|
994
990
|
$meta: t,
|
|
@@ -997,7 +993,7 @@ function j(e, r, t, n, o) {
|
|
|
997
993
|
$log: In.log
|
|
998
994
|
}) === !0;
|
|
999
995
|
}
|
|
1000
|
-
function
|
|
996
|
+
function On(e) {
|
|
1001
997
|
return e.replace(/\?\.(\d+)/g, "?.[$1]").replace(/\.(\d+)/g, "[$1]");
|
|
1002
998
|
}
|
|
1003
999
|
const V = (e) => {
|
|
@@ -1005,7 +1001,7 @@ const V = (e) => {
|
|
|
1005
1001
|
if (!r || Object.keys(r).length === 0 || e.formHealth.status === "errored")
|
|
1006
1002
|
return e;
|
|
1007
1003
|
const { $formIsInvalid: t, $errors: n } = Xe(e);
|
|
1008
|
-
r =
|
|
1004
|
+
r = wn(r);
|
|
1009
1005
|
let o = [], i = { status: "ok" };
|
|
1010
1006
|
try {
|
|
1011
1007
|
o = Object.keys(r).map((s) => {
|
|
@@ -1028,7 +1024,7 @@ const V = (e) => {
|
|
|
1028
1024
|
}
|
|
1029
1025
|
return { ...e, currentStates: o, formHealth: i };
|
|
1030
1026
|
};
|
|
1031
|
-
function
|
|
1027
|
+
function wn(e) {
|
|
1032
1028
|
const r = {};
|
|
1033
1029
|
function t(n) {
|
|
1034
1030
|
const o = n.split(":"), i = [];
|
|
@@ -1053,7 +1049,7 @@ function Vr(e, r) {
|
|
|
1053
1049
|
}
|
|
1054
1050
|
return t;
|
|
1055
1051
|
}
|
|
1056
|
-
function
|
|
1052
|
+
function Io(e, r, t) {
|
|
1057
1053
|
for (let n = 0; n < e.length; n++)
|
|
1058
1054
|
r(e[n], n, e) && t(e[n], n, e);
|
|
1059
1055
|
}
|
|
@@ -1063,7 +1059,7 @@ function Cn(e, r, t, n) {
|
|
|
1063
1059
|
r(e[i], i, e) && (o = t(o, e[i], i, e));
|
|
1064
1060
|
return o;
|
|
1065
1061
|
}
|
|
1066
|
-
function
|
|
1062
|
+
function Dn(e, r, t) {
|
|
1067
1063
|
if (e.length !== r.length)
|
|
1068
1064
|
return !1;
|
|
1069
1065
|
for (let n = 0; n < e.length; n++)
|
|
@@ -1071,9 +1067,9 @@ function Fn(e, r, t) {
|
|
|
1071
1067
|
return !1;
|
|
1072
1068
|
return !0;
|
|
1073
1069
|
}
|
|
1074
|
-
function
|
|
1070
|
+
function Fn(e, r) {
|
|
1075
1071
|
const t = Ur(e.uid, r);
|
|
1076
|
-
return
|
|
1072
|
+
return F(e) ? {
|
|
1077
1073
|
...e,
|
|
1078
1074
|
uid: t,
|
|
1079
1075
|
path: Pn(e.path, r)
|
|
@@ -1129,7 +1125,7 @@ function Wn(e, r, t) {
|
|
|
1129
1125
|
return o.uid = n.uid, o;
|
|
1130
1126
|
}
|
|
1131
1127
|
return n;
|
|
1132
|
-
}).filter((n) => !!(n.include && ("in" in n.include || "when" in n.include) || n.exclude && ("from" in n.exclude || "when" in n.exclude) || (
|
|
1128
|
+
}).filter((n) => !!(n.include && ("in" in n.include || "when" in n.include) || n.exclude && ("from" in n.exclude || "when" in n.exclude) || (F(n) || re(n)) && z(n.disabled) || F(n) && z(n.readonly))).reduce(
|
|
1133
1129
|
(n, o) => (n[o.uid] = n[o.uid] || {}, o.include && "in" in o.include ? n[o.uid].hidden = !o.include.in.some(
|
|
1134
1130
|
(i) => e.currentStates.includes(i)
|
|
1135
1131
|
) : o.include && "when" in o.include && (n[o.uid].hidden = !j(
|
|
@@ -1146,13 +1142,13 @@ function Wn(e, r, t) {
|
|
|
1146
1142
|
e.meta,
|
|
1147
1143
|
r,
|
|
1148
1144
|
t
|
|
1149
|
-
)), (
|
|
1145
|
+
)), (F(o) || re(o)) && z(o.disabled) && (n[o.uid].disabled = j(
|
|
1150
1146
|
o.disabled.when,
|
|
1151
1147
|
e.data,
|
|
1152
1148
|
e.meta,
|
|
1153
1149
|
r,
|
|
1154
1150
|
t
|
|
1155
|
-
)),
|
|
1151
|
+
)), F(o) && z(o.readonly) && (n[o.uid].readonly = j(
|
|
1156
1152
|
o.readonly.when,
|
|
1157
1153
|
e.data,
|
|
1158
1154
|
e.meta,
|
|
@@ -1168,18 +1164,18 @@ function Tn(e, r, t) {
|
|
|
1168
1164
|
(n) => !se(n) && n.type === "repeater",
|
|
1169
1165
|
(n, o) => ({
|
|
1170
1166
|
...n,
|
|
1171
|
-
...
|
|
1167
|
+
...Hr(e, o, [], r, t)
|
|
1172
1168
|
}),
|
|
1173
1169
|
{}
|
|
1174
1170
|
);
|
|
1175
1171
|
}
|
|
1176
|
-
function
|
|
1172
|
+
function Hr(e, r, t, n, o) {
|
|
1177
1173
|
const i = r.props.template, s = N(e.data, r.path);
|
|
1178
1174
|
if (!Array.isArray(s))
|
|
1179
1175
|
return {};
|
|
1180
1176
|
const u = {};
|
|
1181
1177
|
return s.forEach((c, h) => {
|
|
1182
|
-
const
|
|
1178
|
+
const A = [...t, h];
|
|
1183
1179
|
Ke([i]).forEach((g) => {
|
|
1184
1180
|
let a;
|
|
1185
1181
|
if (se(g) ? (a = g({
|
|
@@ -1188,48 +1184,48 @@ function Br(e, r, t, n, o) {
|
|
|
1188
1184
|
touched: void 0,
|
|
1189
1185
|
translate: void 0
|
|
1190
1186
|
}), a.uid = g.uid) : a = g, a.type === "repeater") {
|
|
1191
|
-
const ee =
|
|
1187
|
+
const ee = Fn(
|
|
1192
1188
|
a,
|
|
1193
|
-
|
|
1189
|
+
A
|
|
1194
1190
|
);
|
|
1195
1191
|
Object.assign(
|
|
1196
1192
|
u,
|
|
1197
|
-
|
|
1193
|
+
Hr(
|
|
1198
1194
|
e,
|
|
1199
1195
|
ee,
|
|
1200
|
-
|
|
1196
|
+
A,
|
|
1201
1197
|
n,
|
|
1202
1198
|
o
|
|
1203
1199
|
)
|
|
1204
1200
|
);
|
|
1205
1201
|
return;
|
|
1206
1202
|
}
|
|
1207
|
-
const
|
|
1208
|
-
u[
|
|
1209
|
-
le(a.include.when,
|
|
1203
|
+
const w = Ur(a.uid, A);
|
|
1204
|
+
u[w] = u[w] || {}, a.include && "in" in a.include ? u[w].hidden = !a.include.in.some((ee) => e.currentStates.includes(ee)) : a.include && "when" in a.include && (u[w].hidden = !j(
|
|
1205
|
+
le(a.include.when, A),
|
|
1210
1206
|
e.data,
|
|
1211
1207
|
e.meta,
|
|
1212
1208
|
n,
|
|
1213
1209
|
o
|
|
1214
|
-
)), a.exclude && "from" in a.exclude ? u[
|
|
1215
|
-
le(a.exclude.when,
|
|
1210
|
+
)), a.exclude && "from" in a.exclude ? u[w].hidden = a.exclude.from.some((ee) => e.currentStates.includes(ee)) : a.exclude && "when" in a.exclude && (u[w].hidden = j(
|
|
1211
|
+
le(a.exclude.when, A),
|
|
1216
1212
|
e.data,
|
|
1217
1213
|
e.meta,
|
|
1218
1214
|
n,
|
|
1219
1215
|
o
|
|
1220
|
-
)), (
|
|
1216
|
+
)), (F(a) || re(a)) && z(a.disabled) && (u[w].disabled = j(
|
|
1221
1217
|
le(
|
|
1222
1218
|
a.disabled.when,
|
|
1223
|
-
|
|
1219
|
+
A
|
|
1224
1220
|
),
|
|
1225
1221
|
e.data,
|
|
1226
1222
|
e.meta,
|
|
1227
1223
|
n,
|
|
1228
1224
|
o
|
|
1229
|
-
)),
|
|
1225
|
+
)), F(a) && z(a.readonly) && (u[w].readonly = j(
|
|
1230
1226
|
le(
|
|
1231
1227
|
a.readonly.when,
|
|
1232
|
-
|
|
1228
|
+
A
|
|
1233
1229
|
),
|
|
1234
1230
|
e.data,
|
|
1235
1231
|
e.meta,
|
|
@@ -1273,7 +1269,7 @@ function kn(e, r, t, n) {
|
|
|
1273
1269
|
}
|
|
1274
1270
|
function _n(e, r, t, n) {
|
|
1275
1271
|
const o = new Qn(r, e.current);
|
|
1276
|
-
return o.write("uid", r.uid), o.write("type", r.type), o.write("kind", r.kind), ut(r) ? Nn(o, n) : re(r) ? Ln(o, n) :
|
|
1272
|
+
return o.write("uid", r.uid), o.write("type", r.type), o.write("kind", r.kind), ut(r) ? Nn(o, n) : re(r) ? Ln(o, n) : F(r) ? Mn(o, n) : ke(r) && jn(o, n), Vn(r, o, n, t), (re(r) || F(r)) && Un(r, o, n), ke(r) && Hn(r, o, t), o.changed ? { source: e.source, current: o.current } : e;
|
|
1277
1273
|
}
|
|
1278
1274
|
function Nn(e, r) {
|
|
1279
1275
|
S(e, r, "size"), S(e, r, "include"), S(e, r, "exclude");
|
|
@@ -1290,14 +1286,14 @@ function jn(e, r) {
|
|
|
1290
1286
|
function Vn(e, r, t, n) {
|
|
1291
1287
|
const o = n.widgetPropOverrides[e.uid] ?? {}, i = { ...e.props ?? {}, ...o };
|
|
1292
1288
|
for (const s of Kr(Object.keys(i)))
|
|
1293
|
-
|
|
1289
|
+
Bn(r, t, s);
|
|
1294
1290
|
}
|
|
1295
1291
|
function Un(e, r, t) {
|
|
1296
1292
|
const n = e.on ?? {};
|
|
1297
1293
|
for (const o of Kr(Object.keys(n)))
|
|
1298
1294
|
Gn(r, t, o);
|
|
1299
1295
|
}
|
|
1300
|
-
function
|
|
1296
|
+
function Hn(e, r, t) {
|
|
1301
1297
|
const n = xn(e.uid), o = Zn(e.children, n, t.widgetFlags);
|
|
1302
1298
|
r.current.children = o;
|
|
1303
1299
|
const i = r.previous.children ?? [];
|
|
@@ -1319,7 +1315,7 @@ function S(e, r, t) {
|
|
|
1319
1315
|
}
|
|
1320
1316
|
e.write(t, i);
|
|
1321
1317
|
}
|
|
1322
|
-
function
|
|
1318
|
+
function Bn(e, r, t) {
|
|
1323
1319
|
const n = e.source.props, o = ir(n, t, r.sortedStates);
|
|
1324
1320
|
let i = Gr(o, r);
|
|
1325
1321
|
const s = r.widgetPropOverrides[e.source.uid]?.[t];
|
|
@@ -1335,7 +1331,7 @@ function or(e, r) {
|
|
|
1335
1331
|
function Kn(e, r) {
|
|
1336
1332
|
return r.localization.translate(e.key, Jn(e.params, r), e.default);
|
|
1337
1333
|
}
|
|
1338
|
-
function
|
|
1334
|
+
function Br(e, r) {
|
|
1339
1335
|
return Ct(e, {
|
|
1340
1336
|
resolveFormPath: (t) => N(r.$form, t) ?? e,
|
|
1341
1337
|
resolveMetaPath: (t) => N(r.$meta, t) ?? e,
|
|
@@ -1344,10 +1340,10 @@ function Hr(e, r) {
|
|
|
1344
1340
|
});
|
|
1345
1341
|
}
|
|
1346
1342
|
function Gr(e, r) {
|
|
1347
|
-
return typeof e == "function" ? or(e, r) :
|
|
1343
|
+
return typeof e == "function" ? or(e, r) : At(e) ? Kn(e, r) : typeof e == "string" ? Br(e, r) : e;
|
|
1348
1344
|
}
|
|
1349
1345
|
function Xn(e, r, t, n) {
|
|
1350
|
-
return typeof e == "function" ? or(e, r) : z(e) ? r.widgetFlags[t]?.[n] : typeof e == "string" ?
|
|
1346
|
+
return typeof e == "function" ? or(e, r) : z(e) ? r.widgetFlags[t]?.[n] : typeof e == "string" ? Br(e, r) : e;
|
|
1351
1347
|
}
|
|
1352
1348
|
function zn(e, r) {
|
|
1353
1349
|
return typeof e == "function" ? or(e, r) : e;
|
|
@@ -1365,7 +1361,7 @@ function ir(e, r, t) {
|
|
|
1365
1361
|
function Jn(e, r) {
|
|
1366
1362
|
return e && Object.keys(e).reduce((t, n) => {
|
|
1367
1363
|
const o = String(e[n]);
|
|
1368
|
-
return It(o) ? t[n] =
|
|
1364
|
+
return It(o) ? t[n] = Dt(o, {
|
|
1369
1365
|
resolveFormPath: (i) => N(r.$form, i) ?? o,
|
|
1370
1366
|
resolveMetaPath: (i) => N(r.$meta, i) ?? o,
|
|
1371
1367
|
resolveErrorsPath: (i) => N(r.$errors, i) ?? o,
|
|
@@ -1417,7 +1413,7 @@ function Zn(e, r, t) {
|
|
|
1417
1413
|
}
|
|
1418
1414
|
const xn = (e) => [...e.matchAll(/\[(\d+)\]/g)].map((r) => parseInt(r[1], 10)), bn = ({ lang: e }, r) => {
|
|
1419
1415
|
const t = {
|
|
1420
|
-
...
|
|
1416
|
+
...yr(e),
|
|
1421
1417
|
formName: r.payload.formName
|
|
1422
1418
|
};
|
|
1423
1419
|
let n = r.payload.formDef, o = { status: "ok" };
|
|
@@ -1444,17 +1440,17 @@ const xn = (e) => [...e.matchAll(/\[(\d+)\]/g)].map((r) => parseInt(r[1], 10)),
|
|
|
1444
1440
|
children: c
|
|
1445
1441
|
};
|
|
1446
1442
|
}
|
|
1447
|
-
const i =
|
|
1443
|
+
const i = mr.decode(n);
|
|
1448
1444
|
if (i.isOk()) {
|
|
1449
1445
|
o = { status: "ok" };
|
|
1450
1446
|
let u = {};
|
|
1451
1447
|
try {
|
|
1452
1448
|
u = Ke([i.value.form]).reduce(
|
|
1453
1449
|
(c, h) => {
|
|
1454
|
-
const
|
|
1455
|
-
if (c[
|
|
1456
|
-
throw { existingWidget: c[
|
|
1457
|
-
return c[
|
|
1450
|
+
const A = h.uid;
|
|
1451
|
+
if (c[A])
|
|
1452
|
+
throw { existingWidget: c[A], newWidget: h };
|
|
1453
|
+
return c[A] = h, c;
|
|
1458
1454
|
},
|
|
1459
1455
|
{}
|
|
1460
1456
|
);
|
|
@@ -1484,7 +1480,7 @@ const xn = (e) => [...e.matchAll(/\[(\d+)\]/g)].map((r) => parseInt(r[1], 10)),
|
|
|
1484
1480
|
};
|
|
1485
1481
|
};
|
|
1486
1482
|
function eo(e, r) {
|
|
1487
|
-
const t = (n) =>
|
|
1483
|
+
const t = (n) => F(n) ? ` at "${n.path}"` : "";
|
|
1488
1484
|
return `Duplicate UID "${r.uid}": Assigned to widget "${e.type}"${t(e)} and "${r.type}"${t(r)}.`;
|
|
1489
1485
|
}
|
|
1490
1486
|
function ro(e, r) {
|
|
@@ -1500,7 +1496,7 @@ const to = (e, { payload: r }) => {
|
|
|
1500
1496
|
let t;
|
|
1501
1497
|
if ("path" in r) {
|
|
1502
1498
|
if (t = Object.values(e.calculatedWidgets).find(
|
|
1503
|
-
({ source: i }) =>
|
|
1499
|
+
({ source: i }) => F(i) && i.path === r.path
|
|
1504
1500
|
), !t)
|
|
1505
1501
|
return console.warn(`Input with path "${r.path}" not found`), e;
|
|
1506
1502
|
} else if (t = e.calculatedWidgets[r.uid], !t)
|
|
@@ -1530,7 +1526,7 @@ function no(e, r) {
|
|
|
1530
1526
|
touchedControls: {
|
|
1531
1527
|
...L(e.touchedControls, (t) => {
|
|
1532
1528
|
const n = e.flatForm[r.payload.uid];
|
|
1533
|
-
return n &&
|
|
1529
|
+
return n && F(n) ? ce(t, n.path) : t;
|
|
1534
1530
|
})
|
|
1535
1531
|
}
|
|
1536
1532
|
// TODO: clear widget from injectedValidations
|
|
@@ -1557,20 +1553,20 @@ const oo = (e, r) => ({
|
|
|
1557
1553
|
}, We = (e, r) => (t) => {
|
|
1558
1554
|
const n = Vr(
|
|
1559
1555
|
Object.values(t.calculatedWidgets),
|
|
1560
|
-
({ current: i }) =>
|
|
1556
|
+
({ current: i }) => F(i) ? i : nr
|
|
1561
1557
|
), o = t.validations;
|
|
1562
1558
|
return {
|
|
1563
1559
|
...t,
|
|
1564
1560
|
validations: n.reduce(
|
|
1565
1561
|
(i, s) => {
|
|
1566
1562
|
if (i[s.path] = null, s.validator) {
|
|
1567
|
-
const u = e(s.validator, r), c = N(t.data, s.path), h =
|
|
1563
|
+
const u = e(s.validator, r), c = N(t.data, s.path), h = Zr(
|
|
1568
1564
|
u,
|
|
1569
1565
|
c
|
|
1570
1566
|
);
|
|
1571
|
-
i[s.path] =
|
|
1567
|
+
i[s.path] = xr(h) ? null : h.issues.map((A) => A.message);
|
|
1572
1568
|
}
|
|
1573
|
-
return Array.isArray(i[s.path]) && Array.isArray(o[s.path]) &&
|
|
1569
|
+
return Array.isArray(i[s.path]) && Array.isArray(o[s.path]) && Dn(
|
|
1574
1570
|
i[s.path],
|
|
1575
1571
|
o[s.path],
|
|
1576
1572
|
(u, c) => u === c
|
|
@@ -1636,7 +1632,7 @@ const oo = (e, r) => ({
|
|
|
1636
1632
|
ae(
|
|
1637
1633
|
(i) => {
|
|
1638
1634
|
let s = !1, u = "";
|
|
1639
|
-
"path" in o.payload ? (s = !0, u = o.payload.path) :
|
|
1635
|
+
"path" in o.payload ? (s = !0, u = o.payload.path) : F(i.calculatedWidgets[o.payload.uid].current) && (s = !0, u = i.calculatedWidgets[o.payload.uid].current.path);
|
|
1640
1636
|
const c = s && i.touchedControls[u];
|
|
1641
1637
|
return i.touched && c;
|
|
1642
1638
|
},
|
|
@@ -1653,7 +1649,7 @@ const oo = (e, r) => ({
|
|
|
1653
1649
|
touchedControls: Object.keys(n.calculatedWidgets).reduce(
|
|
1654
1650
|
(i, s) => {
|
|
1655
1651
|
const u = n.calculatedWidgets[s].source;
|
|
1656
|
-
return
|
|
1652
|
+
return F(u) && (i[u.path] = !0), i;
|
|
1657
1653
|
},
|
|
1658
1654
|
{}
|
|
1659
1655
|
)
|
|
@@ -1680,7 +1676,7 @@ const oo = (e, r) => ({
|
|
|
1680
1676
|
// TODO: extract this into a separate function
|
|
1681
1677
|
// When the widget is a Widget Function, we propagate the validation result immediately
|
|
1682
1678
|
(c) => {
|
|
1683
|
-
const h = o.payload.uid,
|
|
1679
|
+
const h = o.payload.uid, A = c.calculatedWidgets[h], g = A.source;
|
|
1684
1680
|
if (se(g)) {
|
|
1685
1681
|
const a = g({
|
|
1686
1682
|
$form: c.data,
|
|
@@ -1693,7 +1689,7 @@ const oo = (e, r) => ({
|
|
|
1693
1689
|
calculatedWidgets: {
|
|
1694
1690
|
...c.calculatedWidgets,
|
|
1695
1691
|
[h]: {
|
|
1696
|
-
source:
|
|
1692
|
+
source: A.source,
|
|
1697
1693
|
current: a
|
|
1698
1694
|
}
|
|
1699
1695
|
}
|
|
@@ -1710,10 +1706,10 @@ const oo = (e, r) => ({
|
|
|
1710
1706
|
}
|
|
1711
1707
|
}, Te = (e) => e.formHealth.status === "ok";
|
|
1712
1708
|
function ao(e = [], r, t, n) {
|
|
1713
|
-
const o = new Jr(
|
|
1709
|
+
const o = new Jr(yr(n.lang)), i = o.asObservable().pipe(W()), s = lo({ validators: r, validateOn: t, localization: n });
|
|
1714
1710
|
function u(g) {
|
|
1715
|
-
const a = o.getValue(),
|
|
1716
|
-
o.next(
|
|
1711
|
+
const a = o.getValue(), w = s(a, g);
|
|
1712
|
+
o.next(w);
|
|
1717
1713
|
}
|
|
1718
1714
|
let c = u;
|
|
1719
1715
|
const h = {
|
|
@@ -1727,11 +1723,11 @@ function ao(e = [], r, t, n) {
|
|
|
1727
1723
|
getState: () => o.getValue()
|
|
1728
1724
|
};
|
|
1729
1725
|
}
|
|
1730
|
-
class
|
|
1726
|
+
class Oo {
|
|
1731
1727
|
constructor() {
|
|
1732
1728
|
this.widgetRegistry = new Ne(), this.store = {}, this.events$ = new Qr(), this.uuid = crypto.randomUUID(), this.itemRenderers = {}, this.dependencies = {};
|
|
1733
1729
|
}
|
|
1734
|
-
initialize(r, t = [], n, o, i, s =
|
|
1730
|
+
initialize(r, t = [], n, o, i, s = $t(), u) {
|
|
1735
1731
|
this.localization = s, this.dependencies = u, this.widgetRegistry.setWidgetLoaders(r), this.itemRenderers = i, this.store = ao(t, n, o, s);
|
|
1736
1732
|
}
|
|
1737
1733
|
emitEvent(r, t, n) {
|
|
@@ -1773,7 +1769,7 @@ class Co {
|
|
|
1773
1769
|
}));
|
|
1774
1770
|
}
|
|
1775
1771
|
}
|
|
1776
|
-
function
|
|
1772
|
+
function wo(e = "GolemUI Form Store") {
|
|
1777
1773
|
return (r) => {
|
|
1778
1774
|
const n = (typeof window < "u" ? window.__REDUX_DEVTOOLS_EXTENSION__ : void 0)?.connect({ name: e });
|
|
1779
1775
|
return n?.init(r.getState()), (o) => (i) => {
|
|
@@ -1781,76 +1777,74 @@ function Fo(e = "GolemUI Form Store") {
|
|
|
1781
1777
|
};
|
|
1782
1778
|
};
|
|
1783
1779
|
}
|
|
1784
|
-
const fo =
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
),
|
|
1780
|
+
const fo = R(
|
|
1781
|
+
D((e) => e.data),
|
|
1782
|
+
W()
|
|
1783
|
+
), Co = (e) => R(
|
|
1788
1784
|
fo,
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
), ho =
|
|
1785
|
+
D((r) => N(r, e)),
|
|
1786
|
+
W()
|
|
1787
|
+
), ho = R(
|
|
1792
1788
|
Ee((e) => e.touched === !0),
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
),
|
|
1789
|
+
D((e) => e.validations),
|
|
1790
|
+
W()
|
|
1791
|
+
), Do = (e) => R(
|
|
1796
1792
|
ho,
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
), po =
|
|
1793
|
+
D((r) => r[e]),
|
|
1794
|
+
W()
|
|
1795
|
+
), po = R(
|
|
1800
1796
|
Ee((e) => e.touched === !0),
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
),
|
|
1797
|
+
D((e) => e.injectedValidations),
|
|
1798
|
+
W()
|
|
1799
|
+
), Fo = (e) => R(
|
|
1804
1800
|
po,
|
|
1805
|
-
|
|
1806
|
-
|
|
1801
|
+
D((r) => r[e]),
|
|
1802
|
+
W(),
|
|
1807
1803
|
// we want to make sure combineLatest([validation$, injectedValidation$]) triggers
|
|
1808
|
-
|
|
1809
|
-
), go =
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
), Xr =
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
),
|
|
1816
|
-
|
|
1804
|
+
Yr(null)
|
|
1805
|
+
), go = R(
|
|
1806
|
+
D((e) => e.lang),
|
|
1807
|
+
W()
|
|
1808
|
+
), Xr = R(
|
|
1809
|
+
D((e) => e.calculatedWidgets),
|
|
1810
|
+
W()
|
|
1811
|
+
), Po = (e) => (r) => qr([r.pipe(go), r.pipe(Xr)]).pipe(
|
|
1812
|
+
D(([t, n]) => ({ lang: t, widget: n[e] })),
|
|
1817
1813
|
Ee((t) => t.widget !== void 0),
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
),
|
|
1814
|
+
W((t, n) => t.lang === n.lang && t.widget === n.widget),
|
|
1815
|
+
D((t) => t.widget.current)
|
|
1816
|
+
), Wo = (e) => R(
|
|
1821
1817
|
Xr,
|
|
1822
|
-
|
|
1818
|
+
D((r) => r[e]),
|
|
1823
1819
|
Ee((r) => r !== void 0),
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
)
|
|
1827
|
-
|
|
1828
|
-
D()
|
|
1829
|
-
|
|
1820
|
+
D((r) => r.current.children),
|
|
1821
|
+
W()
|
|
1822
|
+
);
|
|
1823
|
+
R(
|
|
1824
|
+
D((e) => e.widgetFlags),
|
|
1825
|
+
W()
|
|
1826
|
+
);
|
|
1827
|
+
const mo = R(
|
|
1828
|
+
D((e) => e.touchedControls),
|
|
1829
|
+
W()
|
|
1830
|
+
), To = (e) => R(
|
|
1830
1831
|
mo,
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
), yo =
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
), _o = (e) => T(
|
|
1837
|
-
yo,
|
|
1838
|
-
O((r) => r[e]),
|
|
1839
|
-
D()
|
|
1840
|
-
), $o = T(
|
|
1841
|
-
O((e) => e.formHealth),
|
|
1842
|
-
D(
|
|
1832
|
+
D((r) => r[e]),
|
|
1833
|
+
W()
|
|
1834
|
+
), yo = R(
|
|
1835
|
+
D((e) => e.formHealth),
|
|
1836
|
+
W(
|
|
1843
1837
|
(e, r) => !(e.status !== r.status || e.status === "errored")
|
|
1844
1838
|
)
|
|
1845
|
-
),
|
|
1839
|
+
), Ro = (e) => e.pipe(yo);
|
|
1846
1840
|
let zr = !1;
|
|
1847
|
-
function
|
|
1841
|
+
function ko() {
|
|
1848
1842
|
zr = !0;
|
|
1849
1843
|
}
|
|
1850
1844
|
function Ao() {
|
|
1851
1845
|
return zr;
|
|
1852
1846
|
}
|
|
1853
|
-
function
|
|
1847
|
+
function _o(e, r, t) {
|
|
1854
1848
|
if (!Ao())
|
|
1855
1849
|
return;
|
|
1856
1850
|
const n = Object.keys(r ?? {}).filter((o) => o in t);
|
|
@@ -1860,51 +1854,25 @@ function Mo(e, r, t) {
|
|
|
1860
1854
|
);
|
|
1861
1855
|
}
|
|
1862
1856
|
export {
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
Mo as assertNoPropCollisions,
|
|
1868
|
-
Ro as calculatedLayoutChildrenByUid$,
|
|
1869
|
-
To as calculatedWidgetsByUid$,
|
|
1857
|
+
Oo as FormContext,
|
|
1858
|
+
_o as assertNoPropCollisions,
|
|
1859
|
+
Wo as calculatedLayoutChildrenByUid$,
|
|
1860
|
+
Po as calculatedWidgetsByUid$,
|
|
1870
1861
|
sr as cloneObject,
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
vo as defineForm,
|
|
1876
|
-
ce as deleteKey,
|
|
1877
|
-
Fo as devToolsMiddleware,
|
|
1878
|
-
Lo as enableDevMode,
|
|
1862
|
+
Co as dataByPath$,
|
|
1863
|
+
So as defineForm,
|
|
1864
|
+
wo as devToolsMiddleware,
|
|
1865
|
+
ko as enableDevMode,
|
|
1879
1866
|
fe as errorCodes,
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
ut as isDisplayWidget,
|
|
1892
|
-
se as isFunctionWidget,
|
|
1893
|
-
P as isInputWidget,
|
|
1894
|
-
ke as isLayoutWidget,
|
|
1895
|
-
At as isStandardValidateSuccess,
|
|
1896
|
-
st as isTranslationConfig,
|
|
1897
|
-
He as layoutWidgetDecoder,
|
|
1898
|
-
Dn as makeRepeaterItemConfig,
|
|
1899
|
-
L as pipe,
|
|
1900
|
-
mo as selectWidgetFlags,
|
|
1901
|
-
Ge as set,
|
|
1902
|
-
mr as shortUUID,
|
|
1903
|
-
$t as standardValidate,
|
|
1904
|
-
Ur as toRepeaterItemUid,
|
|
1905
|
-
_o as touchedControlsByPath$,
|
|
1906
|
-
le as transformRepeaterItemWhenExpression,
|
|
1907
|
-
Po as validationByPath$,
|
|
1908
|
-
ko as widgetFlagsByUid$,
|
|
1909
|
-
Fn as zipEvery
|
|
1867
|
+
Io as filterTap,
|
|
1868
|
+
Ro as formHealth,
|
|
1869
|
+
vo as getDirectionFromLanguage,
|
|
1870
|
+
$t as identityTranslator,
|
|
1871
|
+
Fo as injectedValidationByPath$,
|
|
1872
|
+
xr as isStandardValidateSuccess,
|
|
1873
|
+
Fn as makeRepeaterItemConfig,
|
|
1874
|
+
pr as shortUUID,
|
|
1875
|
+
Zr as standardValidate,
|
|
1876
|
+
To as touchedControlsByPath$,
|
|
1877
|
+
Do as validationByPath$
|
|
1910
1878
|
};
|