@golemui/core 1.0.0-rc.2 → 1.0.0-rc.4

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