@goodie-forms/core 1.1.5-alpha → 1.2.0-alpha

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.
Files changed (40) hide show
  1. package/LICENSE +426 -426
  2. package/dist/field/FieldPath.d.ts +32 -0
  3. package/dist/field/FieldPath.d.ts.map +1 -0
  4. package/dist/field/FieldPathBuilder.d.ts +25 -0
  5. package/dist/field/FieldPathBuilder.d.ts.map +1 -0
  6. package/dist/field/Reconcile.d.ts +9 -0
  7. package/dist/field/Reconcile.d.ts.map +1 -0
  8. package/dist/form/FormController.d.ts +35 -39
  9. package/dist/form/FormController.d.ts.map +1 -1
  10. package/dist/form/FormField.d.ts +12 -10
  11. package/dist/form/FormField.d.ts.map +1 -1
  12. package/dist/form/NonullFormField.d.ts +3 -4
  13. package/dist/form/NonullFormField.d.ts.map +1 -1
  14. package/dist/index.d.ts +7 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +615 -881
  17. package/dist/index.js.map +1 -1
  18. package/dist/validation/CustomValidation.d.ts +10 -0
  19. package/dist/validation/CustomValidation.d.ts.map +1 -0
  20. package/package.json +1 -1
  21. package/src/field/FieldPath.ts +292 -0
  22. package/src/field/FieldPathBuilder.ts +132 -0
  23. package/src/field/Reconcile.ts +99 -0
  24. package/src/form/FormController.ts +342 -310
  25. package/src/form/FormField.ts +200 -202
  26. package/src/form/NonullFormField.ts +15 -21
  27. package/src/index.ts +12 -5
  28. package/src/types/DeepPartial.ts +7 -7
  29. package/src/types/Mixin.ts +2 -2
  30. package/src/utils/ensureImmerability.ts +30 -30
  31. package/src/utils/getId.ts +5 -5
  32. package/src/utils/removeBy.ts +11 -11
  33. package/src/{form → validation}/CustomValidation.ts +52 -52
  34. package/tsconfig.json +8 -7
  35. package/vite.config.ts +18 -18
  36. package/dist/form/CustomValidation.d.ts +0 -10
  37. package/dist/form/CustomValidation.d.ts.map +0 -1
  38. package/dist/form/Field.d.ts +0 -31
  39. package/dist/form/Field.d.ts.map +0 -1
  40. package/src/form/Field.ts +0 -334
package/dist/index.js CHANGED
@@ -1,137 +1,177 @@
1
- var m;
1
+ var h;
2
2
  ((t) => {
3
- function e(r, c, l) {
4
- if (r === c) return !0;
5
- if (r === null || c === null || typeof r != "object" || typeof c != "object") return !1;
6
- if (Array.isArray(r)) {
7
- if (!Array.isArray(c) || r.length !== c.length) return !1;
8
- for (let y = 0; y < r.length; y++)
9
- if (!e(r[y], c[y])) return !1;
10
- return !0;
11
- }
12
- if (l != null) {
13
- const y = l(r, c);
14
- if (y !== void 0) return y;
15
- }
16
- if (r instanceof Date && c instanceof Date)
17
- return r.getTime() === c.getTime();
18
- if (r instanceof RegExp && c instanceof RegExp)
19
- return r.source === c.source && r.flags === c.flags;
20
- if (r instanceof Map && c instanceof Map) {
21
- if (r.size !== c.size) return !1;
22
- for (const [y, V] of r)
23
- if (!c.has(y) || !e(V, c.get(y))) return !1;
24
- return !0;
25
- }
26
- if (r instanceof Set && c instanceof Set) {
27
- if (r.size !== c.size) return !1;
28
- for (const y of r)
29
- if (!c.has(y)) return !1;
30
- return !0;
31
- }
32
- if (Object.getPrototypeOf(r) !== Object.getPrototypeOf(c))
33
- return !1;
34
- const _ = Object.keys(r), g = Object.keys(c);
35
- if (_.length !== g.length) return !1;
36
- for (const y of _)
37
- if (!Object.prototype.hasOwnProperty.call(c, y) || !e(r[y], c[y])) return !1;
38
- return !0;
39
- }
40
- t.deepEqual = e;
41
- function n(r, c, l, _) {
42
- const g = [], y = [], V = [];
43
- for (const D of c)
44
- r.some((O) => l(O, D)) ? (_?.(D) ?? !0) && V.push(D) : (_?.(D) ?? !0) && g.push(D);
45
- for (const D of r)
46
- c.some((O) => l(D, O)) || (_?.(D) ?? !0) && y.push(D);
47
- return { added: g, removed: y, unchanged: V };
48
- }
49
- t.diff = n;
50
- function i(r) {
51
- const c = [];
3
+ function e(c) {
4
+ return c.join(".");
5
+ }
6
+ t.toCanonicalPath = e;
7
+ function i(c) {
8
+ const a = r(c);
9
+ let l = "";
10
+ for (const y of a)
11
+ typeof y == "number" ? l += `[${y}]` : (l.length > 0 && (l += "."), l += y.toString());
12
+ return l;
13
+ }
14
+ t.toStringPath = i;
15
+ function n(c) {
16
+ const a = [];
52
17
  let l = 0;
53
- for (; l < r.length; ) {
54
- const _ = r[l];
55
- if (_ === ".") {
18
+ for (; l < c.length; ) {
19
+ const y = c[l];
20
+ if (y === ".") {
56
21
  l++;
57
22
  continue;
58
23
  }
59
- if (_ === "[") {
24
+ if (y === "[") {
60
25
  l++;
61
- let y = "";
62
- for (; l < r.length && r[l] !== "]"; )
63
- y += r[l], l++;
64
- if (l++, !y || !/^\d+$/.test(y))
65
- throw new Error(`Invalid array index in path: ${r}`);
66
- c.push(Number(y));
26
+ let S = "";
27
+ for (; l < c.length && c[l] !== "]"; )
28
+ S += c[l], l++;
29
+ if (l++, !S || !/^\d+$/.test(S))
30
+ throw new Error(`Invalid array index in path: ${c}`);
31
+ a.push(Number(S));
67
32
  continue;
68
33
  }
69
- let g = "";
70
- for (; l < r.length && /[^\.\[]/.test(r[l]); )
71
- g += r[l], l++;
72
- g && c.push(g);
73
- }
74
- return c;
75
- }
76
- t.parsePathFragments = i;
77
- function o(r) {
78
- let c = "";
79
- for (const l of r) {
80
- const _ = typeof l == "object" && "key" in l ? l.key : l;
81
- typeof _ == "number" ? c += `[${_}]` : (c.length > 0 && (c += "."), c += _.toString());
34
+ let v = "";
35
+ for (; l < c.length && /[^\.\[]/.test(c[l]); )
36
+ v += c[l], l++;
37
+ v && a.push(v);
82
38
  }
83
- return c;
84
- }
85
- t.parsePath = o;
86
- function a(r, c) {
87
- const l = i(r), _ = i(c);
88
- if (l.length >= _.length) return !1;
89
- for (let g = 0; g < l.length; g++)
90
- if (l[g] !== _[g])
39
+ return a;
40
+ }
41
+ t.fromStringPath = n;
42
+ function r(c) {
43
+ return c?.map((a) => {
44
+ if (typeof a == "string" || typeof a == "number" || typeof a == "symbol") return a;
45
+ if (typeof a == "object" && "key" in a)
46
+ return typeof a == "string" || typeof a == "number" || typeof a == "symbol" ? a : a.key;
47
+ });
48
+ }
49
+ t.normalize = r;
50
+ function s(c, a) {
51
+ if (c === a) return !0;
52
+ if (c == null || a == null || c.length !== a.length) return !1;
53
+ for (let l = 0; l < c.length; l++)
54
+ if (c[l] !== a[l]) return !1;
55
+ return !0;
56
+ }
57
+ t.equals = s;
58
+ function o(c, a) {
59
+ if (c.length >= a.length) return !1;
60
+ for (let l = 0; l < c.length; l++)
61
+ if (c[l] !== a[l])
91
62
  return !1;
92
63
  return !0;
93
64
  }
94
- t.isDescendant = a;
95
- function u(r, c) {
96
- if (r == null) return;
97
- const l = i(c);
98
- let _ = r;
99
- for (const g of l) {
100
- if (_ == null) return;
101
- _ = _[g];
65
+ t.isDescendant = o;
66
+ function f(c, a) {
67
+ let l = c;
68
+ for (const y of a) {
69
+ if (l == null) return;
70
+ l = l[y];
71
+ }
72
+ return l;
73
+ }
74
+ t.getValue = f;
75
+ function d(c, a, l) {
76
+ return t.modifyValue(c, a, () => l);
77
+ }
78
+ t.setValue = d;
79
+ function u(c, a, l) {
80
+ let y = c;
81
+ for (let A = 0; A < a.length - 1; A++) {
82
+ const Q = a[A], Ot = a[A + 1];
83
+ y[Q] == null && (y[Q] = typeof Ot == "number" ? [] : {}), y = y[Q];
84
+ }
85
+ const v = a[a.length - 1], S = y[v], ht = l(S);
86
+ ht !== void 0 && (y[v] = ht);
87
+ }
88
+ t.modifyValue = u;
89
+ function _(c, a) {
90
+ let l = c;
91
+ for (let v = 0; v < a.length - 1; v++) {
92
+ const S = a[v];
93
+ if (l[S] == null) return;
94
+ l = l[S];
95
+ }
96
+ const y = a[a.length - 1];
97
+ delete l[y];
98
+ }
99
+ t.deleteValue = _;
100
+ })(h || (h = {}));
101
+ const _t = /* @__PURE__ */ Symbol("PathResolver");
102
+ class et {
103
+ static wrap(e) {
104
+ return new Proxy(e, {
105
+ get(i, n, r) {
106
+ if (n === _t) return e;
107
+ const s = typeof n == "string" && /^\d+$/.test(n) ? Number(n) : n;
108
+ return et.wrap([
109
+ ...e,
110
+ s
111
+ ]);
112
+ }
113
+ });
114
+ }
115
+ fromStringPath(e) {
116
+ return h.fromStringPath(
117
+ e
118
+ );
119
+ }
120
+ fromProxy(e) {
121
+ return e(et.wrap([]))[_t];
122
+ }
123
+ }
124
+ var V;
125
+ ((t) => {
126
+ function e(n, r, s) {
127
+ if (n === r) return !0;
128
+ if (n === null || r === null || typeof n != "object" || typeof r != "object") return !1;
129
+ if (Array.isArray(n)) {
130
+ if (!Array.isArray(r) || n.length !== r.length) return !1;
131
+ for (let d = 0; d < n.length; d++)
132
+ if (!e(n[d], r[d])) return !1;
133
+ return !0;
134
+ }
135
+ if (s != null) {
136
+ const d = s(n, r);
137
+ if (d !== void 0) return d;
102
138
  }
103
- return _;
104
- }
105
- t.getValue = u;
106
- function h(r, c, l) {
107
- return d(r, c, () => l);
108
- }
109
- t.setValue = h;
110
- function d(r, c, l) {
111
- const _ = i(c);
112
- let g = r;
113
- for (let O = 0; O < _.length - 1; O++) {
114
- const f = _[O], S = _[O + 1];
115
- g[f] == null && (g[f] = typeof S == "number" ? [] : {}), g = g[f];
139
+ if (n instanceof Date && r instanceof Date)
140
+ return n.getTime() === r.getTime();
141
+ if (n instanceof RegExp && r instanceof RegExp)
142
+ return n.source === r.source && n.flags === r.flags;
143
+ if (n instanceof Map && r instanceof Map) {
144
+ if (n.size !== r.size) return !1;
145
+ for (const [d, u] of n)
146
+ if (!r.has(d) || !e(u, r.get(d))) return !1;
147
+ return !0;
116
148
  }
117
- const y = _[_.length - 1], V = g[y], D = l(V);
118
- D !== void 0 && (g[y] = D);
119
- }
120
- t.modifyValue = d;
121
- function s(r, c) {
122
- const l = i(c);
123
- let _ = r;
124
- for (let y = 0; y < l.length - 1; y++) {
125
- const V = l[y];
126
- if (_[V] == null) return;
127
- _ = _[V];
149
+ if (n instanceof Set && r instanceof Set) {
150
+ if (n.size !== r.size) return !1;
151
+ for (const d of n)
152
+ if (!r.has(d)) return !1;
153
+ return !0;
128
154
  }
129
- const g = l[l.length - 1];
130
- delete _[g];
155
+ if (Object.getPrototypeOf(n) !== Object.getPrototypeOf(r))
156
+ return !1;
157
+ const o = Object.keys(n), f = Object.keys(r);
158
+ if (o.length !== f.length) return !1;
159
+ for (const d of o)
160
+ if (!Object.prototype.hasOwnProperty.call(r, d) || !e(n[d], r[d])) return !1;
161
+ return !0;
131
162
  }
132
- t.deleteValue = s;
133
- })(m || (m = {}));
134
- var zt = /* @__PURE__ */ Symbol.for("immer-nothing"), J = /* @__PURE__ */ Symbol.for("immer-draftable"), p = /* @__PURE__ */ Symbol.for("immer-state"), jt = process.env.NODE_ENV !== "production" ? [
163
+ t.deepEqual = e;
164
+ function i(n, r, s, o) {
165
+ const f = [], d = [], u = [];
166
+ for (const _ of r)
167
+ n.some((c) => s(c, _)) ? (o?.(_) ?? !0) && u.push(_) : (o?.(_) ?? !0) && f.push(_);
168
+ for (const _ of n)
169
+ r.some((c) => s(_, c)) || (o?.(_) ?? !0) && d.push(_);
170
+ return { added: f, removed: d, unchanged: u };
171
+ }
172
+ t.diff = i;
173
+ })(V || (V = {}));
174
+ var Dt = /* @__PURE__ */ Symbol.for("immer-nothing"), x = /* @__PURE__ */ Symbol.for("immer-draftable"), m = /* @__PURE__ */ Symbol.for("immer-state"), At = process.env.NODE_ENV !== "production" ? [
135
175
  // All error codes, starting by 0:
136
176
  function(t) {
137
177
  return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
@@ -162,125 +202,118 @@ var zt = /* @__PURE__ */ Symbol.for("immer-nothing"), J = /* @__PURE__ */ Symbol
162
202
  // Note: if more errors are added, the errorOffset in Patches.ts should be increased
163
203
  // See Patches.ts for additional errors
164
204
  ] : [];
165
- function E(t, ...e) {
205
+ function g(t, ...e) {
166
206
  if (process.env.NODE_ENV !== "production") {
167
- const n = jt[t], i = k(n) ? n.apply(null, e) : n;
168
- throw new Error(`[Immer] ${i}`);
207
+ const i = At[t], n = b(i) ? i.apply(null, e) : i;
208
+ throw new Error(`[Immer] ${n}`);
169
209
  }
170
210
  throw new Error(
171
211
  `[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`
172
212
  );
173
213
  }
174
- var F = Object, x = F.getPrototypeOf, Q = "constructor", rt = "prototype", pt = "configurable", X = "enumerable", K = "writable", j = "value", C = (t) => !!t && !!t[p];
175
- function b(t) {
176
- return t ? At(t) || st(t) || !!t[J] || !!t[Q]?.[J] || ot(t) || at(t) : !1;
214
+ var p = Object, F = p.getPrototypeOf, U = "constructor", W = "prototype", it = "configurable", j = "enumerable", M = "writable", k = "value", w = (t) => !!t && !!t[m];
215
+ function D(t) {
216
+ return t ? wt(t) || K(t) || !!t[x] || !!t[U]?.[x] || H(t) || Y(t) : !1;
177
217
  }
178
- var Lt = F[rt][Q].toString(), Ft = /* @__PURE__ */ new WeakMap();
179
- function At(t) {
180
- if (!t || !ct(t))
218
+ var Tt = p[W][U].toString(), yt = /* @__PURE__ */ new WeakMap();
219
+ function wt(t) {
220
+ if (!t || !ft(t))
181
221
  return !1;
182
- const e = x(t);
183
- if (e === null || e === F[rt])
222
+ const e = F(t);
223
+ if (e === null || e === p[W])
184
224
  return !0;
185
- const n = F.hasOwnProperty.call(e, Q) && e[Q];
186
- if (n === Object)
225
+ const i = p.hasOwnProperty.call(e, U) && e[U];
226
+ if (i === Object)
187
227
  return !0;
188
- if (!k(n))
228
+ if (!b(i))
189
229
  return !1;
190
- let i = Ft.get(n);
191
- return i === void 0 && (i = Function.toString.call(n), Ft.set(n, i)), i === Lt;
230
+ let n = yt.get(i);
231
+ return n === void 0 && (n = Function.toString.call(i), yt.set(i, n)), n === Tt;
192
232
  }
193
- function q(t, e, n = !0) {
194
- G(t) === 0 ? (n ? Reflect.ownKeys(t) : F.keys(t)).forEach((o) => {
195
- e(o, t[o], t);
196
- }) : t.forEach((i, o) => e(o, i, t));
233
+ function G(t, e, i = !0) {
234
+ O(t) === 0 ? (i ? Reflect.ownKeys(t) : p.keys(t)).forEach((r) => {
235
+ e(r, t[r], t);
236
+ }) : t.forEach((n, r) => e(r, n, t));
197
237
  }
198
- function G(t) {
199
- const e = t[p];
200
- return e ? e.type_ : st(t) ? 1 : ot(t) ? 2 : at(t) ? 3 : 0;
238
+ function O(t) {
239
+ const e = t[m];
240
+ return e ? e.type_ : K(t) ? 1 : H(t) ? 2 : Y(t) ? 3 : 0;
201
241
  }
202
- var Mt = (t, e, n = G(t)) => n === 2 ? t.has(e) : F[rt].hasOwnProperty.call(t, e), yt = (t, e, n = G(t)) => (
242
+ var mt = (t, e, i = O(t)) => i === 2 ? t.has(e) : p[W].hasOwnProperty.call(t, e), nt = (t, e, i = O(t)) => (
203
243
  // @ts-ignore
204
- n === 2 ? t.get(e) : t[e]
205
- ), Z = (t, e, n, i = G(t)) => {
206
- i === 2 ? t.set(e, n) : i === 3 ? t.add(n) : t[e] = n;
244
+ i === 2 ? t.get(e) : t[e]
245
+ ), q = (t, e, i, n = O(t)) => {
246
+ n === 2 ? t.set(e, i) : n === 3 ? t.add(i) : t[e] = i;
207
247
  };
208
- function Bt(t, e) {
248
+ function Mt(t, e) {
209
249
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
210
250
  }
211
- var st = Array.isArray, ot = (t) => t instanceof Map, at = (t) => t instanceof Set, ct = (t) => typeof t == "object", k = (t) => typeof t == "function", ht = (t) => typeof t == "boolean";
212
- function Ht(t) {
251
+ var K = Array.isArray, H = (t) => t instanceof Map, Y = (t) => t instanceof Set, ft = (t) => typeof t == "object", b = (t) => typeof t == "function", Z = (t) => typeof t == "boolean";
252
+ function Nt(t) {
213
253
  const e = +t;
214
254
  return Number.isInteger(e) && String(e) === t;
215
255
  }
216
- var $t = (t) => ct(t) ? t?.[p] : null, v = (t) => t.copy_ || t.base_, qt = (t) => {
217
- const e = $t(t);
218
- return e ? e.copy_ ?? e.base_ : t;
219
- }, wt = (t) => t.modified_ ? t.copy_ : t.base_;
220
- function gt(t, e) {
221
- if (ot(t))
256
+ var P = (t) => t.copy_ || t.base_, ct = (t) => t.modified_ ? t.copy_ : t.base_;
257
+ function rt(t, e) {
258
+ if (H(t))
222
259
  return new Map(t);
223
- if (at(t))
260
+ if (Y(t))
224
261
  return new Set(t);
225
- if (st(t))
226
- return Array[rt].slice.call(t);
227
- const n = At(t);
228
- if (e === !0 || e === "class_only" && !n) {
229
- const i = F.getOwnPropertyDescriptors(t);
230
- delete i[p];
231
- let o = Reflect.ownKeys(i);
232
- for (let a = 0; a < o.length; a++) {
233
- const u = o[a], h = i[u];
234
- h[K] === !1 && (h[K] = !0, h[pt] = !0), (h.get || h.set) && (i[u] = {
235
- [pt]: !0,
236
- [K]: !0,
262
+ if (K(t))
263
+ return Array[W].slice.call(t);
264
+ const i = wt(t);
265
+ if (e === !0 || e === "class_only" && !i) {
266
+ const n = p.getOwnPropertyDescriptors(t);
267
+ delete n[m];
268
+ let r = Reflect.ownKeys(n);
269
+ for (let s = 0; s < r.length; s++) {
270
+ const o = r[s], f = n[o];
271
+ f[M] === !1 && (f[M] = !0, f[it] = !0), (f.get || f.set) && (n[o] = {
272
+ [it]: !0,
273
+ [M]: !0,
237
274
  // could live with !!desc.set as well here...
238
- [X]: h[X],
239
- [j]: t[u]
275
+ [j]: f[j],
276
+ [k]: t[o]
240
277
  });
241
278
  }
242
- return F.create(x(t), i);
279
+ return p.create(F(t), n);
243
280
  } else {
244
- const i = x(t);
245
- if (i !== null && n)
281
+ const n = F(t);
282
+ if (n !== null && i)
246
283
  return { ...t };
247
- const o = F.create(i);
248
- return F.assign(o, t);
284
+ const r = p.create(n);
285
+ return p.assign(r, t);
249
286
  }
250
287
  }
251
- function Et(t, e = !1) {
252
- return lt(t) || C(t) || !b(t) || (G(t) > 1 && F.defineProperties(t, {
253
- set: W,
254
- add: W,
255
- clear: W,
256
- delete: W
257
- }), F.freeze(t), e && q(
288
+ function dt(t, e = !1) {
289
+ return X(t) || w(t) || !D(t) || (O(t) > 1 && p.defineProperties(t, {
290
+ set: T,
291
+ add: T,
292
+ clear: T,
293
+ delete: T
294
+ }), p.freeze(t), e && G(
258
295
  t,
259
- (n, i) => {
260
- Et(i, !0);
296
+ (i, n) => {
297
+ dt(n, !0);
261
298
  },
262
299
  !1
263
300
  )), t;
264
301
  }
265
- function Gt() {
266
- E(2);
302
+ function Rt() {
303
+ g(2);
267
304
  }
268
- var W = {
269
- [j]: Gt
305
+ var T = {
306
+ [k]: Rt
270
307
  };
271
- function lt(t) {
272
- return t === null || !ct(t) ? !0 : F.isFrozen(t);
273
- }
274
- var L = "MapSet", mt = "Patches", St = "ArrayMethods", tt = {};
275
- function N(t) {
276
- const e = tt[t];
277
- return e || E(0, t), e;
308
+ function X(t) {
309
+ return t === null || !ft(t) ? !0 : p.isFrozen(t);
278
310
  }
279
- var Vt = (t) => !!tt[t];
280
- function Ct(t, e) {
281
- tt[t] || (tt[t] = e);
311
+ var B = "MapSet", st = "Patches", gt = "ArrayMethods", bt = {};
312
+ function E(t) {
313
+ const e = bt[t];
314
+ return e || g(0, t), e;
282
315
  }
283
- var B, et = () => B, Wt = (t, e) => ({
316
+ var pt = (t) => !!bt[t], C, Et = () => C, xt = (t, e) => ({
284
317
  drafts_: [],
285
318
  parent_: t,
286
319
  immer_: e,
@@ -290,137 +323,137 @@ var B, et = () => B, Wt = (t, e) => ({
290
323
  unfinalizedDrafts_: 0,
291
324
  handledSet_: /* @__PURE__ */ new Set(),
292
325
  processedForPatches_: /* @__PURE__ */ new Set(),
293
- mapSetPlugin_: Vt(L) ? N(L) : void 0,
294
- arrayMethodsPlugin_: Vt(St) ? N(St) : void 0
326
+ mapSetPlugin_: pt(B) ? E(B) : void 0,
327
+ arrayMethodsPlugin_: pt(gt) ? E(gt) : void 0
295
328
  });
296
- function bt(t, e) {
297
- e && (t.patchPlugin_ = N(mt), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
329
+ function vt(t, e) {
330
+ e && (t.patchPlugin_ = E(st), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
298
331
  }
299
- function vt(t) {
300
- Pt(t), t.drafts_.forEach(Kt), t.drafts_ = null;
332
+ function ot(t) {
333
+ at(t), t.drafts_.forEach(Ut), t.drafts_ = null;
301
334
  }
302
- function Pt(t) {
303
- t === B && (B = t.parent_);
335
+ function at(t) {
336
+ t === C && (C = t.parent_);
304
337
  }
305
- var Ot = (t) => B = Wt(B, t);
306
- function Kt(t) {
307
- const e = t[p];
338
+ var St = (t) => C = xt(C, t);
339
+ function Ut(t) {
340
+ const e = t[m];
308
341
  e.type_ === 0 || e.type_ === 1 ? e.revoke_() : e.revoked_ = !0;
309
342
  }
310
- function It(t, e) {
343
+ function Pt(t, e) {
311
344
  e.unfinalizedDrafts_ = e.drafts_.length;
312
- const n = e.drafts_[0];
313
- if (t !== void 0 && t !== n) {
314
- n[p].modified_ && (vt(e), E(4)), b(t) && (t = Tt(e, t));
315
- const { patchPlugin_: o } = e;
316
- o && o.generateReplacementPatches_(
317
- n[p].base_,
345
+ const i = e.drafts_[0];
346
+ if (t !== void 0 && t !== i) {
347
+ i[m].modified_ && (ot(e), g(4)), D(t) && (t = Vt(e, t));
348
+ const { patchPlugin_: r } = e;
349
+ r && r.generateReplacementPatches_(
350
+ i[m].base_,
318
351
  t,
319
352
  e
320
353
  );
321
354
  } else
322
- t = Tt(e, n);
323
- return Yt(e, t, !0), vt(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== zt ? t : void 0;
355
+ t = Vt(e, i);
356
+ return jt(e, t, !0), ot(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== Dt ? t : void 0;
324
357
  }
325
- function Tt(t, e) {
326
- if (lt(e))
358
+ function Vt(t, e) {
359
+ if (X(e))
327
360
  return e;
328
- const n = e[p];
329
- if (!n)
330
- return nt(e, t.handledSet_, t);
331
- if (!ut(n, t))
361
+ const i = e[m];
362
+ if (!i)
363
+ return $(e, t.handledSet_, t);
364
+ if (!J(i, t))
332
365
  return e;
333
- if (!n.modified_)
334
- return n.base_;
335
- if (!n.finalized_) {
336
- const { callbacks_: i } = n;
337
- if (i)
338
- for (; i.length > 0; )
339
- i.pop()(t);
340
- xt(n, t);
341
- }
342
- return n.copy_;
366
+ if (!i.modified_)
367
+ return i.base_;
368
+ if (!i.finalized_) {
369
+ const { callbacks_: n } = i;
370
+ if (n)
371
+ for (; n.length > 0; )
372
+ n.pop()(t);
373
+ kt(i, t);
374
+ }
375
+ return i.copy_;
343
376
  }
344
- function Yt(t, e, n = !1) {
345
- !t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && Et(e, n);
377
+ function jt(t, e, i = !1) {
378
+ !t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && dt(e, i);
346
379
  }
347
- function kt(t) {
380
+ function Ft(t) {
348
381
  t.finalized_ = !0, t.scope_.unfinalizedDrafts_--;
349
382
  }
350
- var ut = (t, e) => t.scope_ === e, Jt = [];
351
- function Nt(t, e, n, i) {
352
- const o = v(t), a = t.type_;
353
- if (i !== void 0 && yt(o, i, a) === e) {
354
- Z(o, i, n, a);
383
+ var J = (t, e) => t.scope_ === e, qt = [];
384
+ function zt(t, e, i, n) {
385
+ const r = P(t), s = t.type_;
386
+ if (n !== void 0 && nt(r, n, s) === e) {
387
+ q(r, n, i, s);
355
388
  return;
356
389
  }
357
390
  if (!t.draftLocations_) {
358
- const h = t.draftLocations_ = /* @__PURE__ */ new Map();
359
- q(o, (d, s) => {
360
- if (C(s)) {
361
- const r = h.get(s) || [];
362
- r.push(d), h.set(s, r);
391
+ const f = t.draftLocations_ = /* @__PURE__ */ new Map();
392
+ G(r, (d, u) => {
393
+ if (w(u)) {
394
+ const _ = f.get(u) || [];
395
+ _.push(d), f.set(u, _);
363
396
  }
364
397
  });
365
398
  }
366
- const u = t.draftLocations_.get(e) ?? Jt;
367
- for (const h of u)
368
- Z(o, h, n, a);
399
+ const o = t.draftLocations_.get(e) ?? qt;
400
+ for (const f of o)
401
+ q(r, f, i, s);
369
402
  }
370
- function Qt(t, e, n) {
371
- t.callbacks_.push(function(o) {
372
- const a = e;
373
- if (!a || !ut(a, o))
403
+ function Bt(t, e, i) {
404
+ t.callbacks_.push(function(r) {
405
+ const s = e;
406
+ if (!s || !J(s, r))
374
407
  return;
375
- o.mapSetPlugin_?.fixSetContents(a);
376
- const u = wt(a);
377
- Nt(t, a.draft_ ?? a, u, n), xt(a, o);
408
+ r.mapSetPlugin_?.fixSetContents(s);
409
+ const o = ct(s);
410
+ zt(t, s.draft_ ?? s, o, i), kt(s, r);
378
411
  });
379
412
  }
380
- function xt(t, e) {
413
+ function kt(t, e) {
381
414
  if (t.modified_ && !t.finalized_ && (t.type_ === 3 || t.type_ === 1 && t.allIndicesReassigned_ || (t.assigned_?.size ?? 0) > 0)) {
382
- const { patchPlugin_: i } = e;
383
- if (i) {
384
- const o = i.getPath(t);
385
- o && i.generatePatches_(t, o, e);
415
+ const { patchPlugin_: n } = e;
416
+ if (n) {
417
+ const r = n.getPath(t);
418
+ r && n.generatePatches_(t, r, e);
386
419
  }
387
- kt(t);
420
+ Ft(t);
388
421
  }
389
422
  }
390
- function Dt(t, e, n) {
391
- const { scope_: i } = t;
392
- if (C(n)) {
393
- const o = n[p];
394
- ut(o, i) && o.callbacks_.push(function() {
395
- U(t);
396
- const u = wt(o);
397
- Nt(t, n, u, e);
423
+ function $t(t, e, i) {
424
+ const { scope_: n } = t;
425
+ if (w(i)) {
426
+ const r = i[m];
427
+ J(r, n) && r.callbacks_.push(function() {
428
+ N(t);
429
+ const o = ct(r);
430
+ zt(t, i, o, e);
398
431
  });
399
- } else b(n) && t.callbacks_.push(function() {
400
- const a = v(t);
401
- t.type_ === 3 ? a.has(n) && nt(n, i.handledSet_, i) : yt(a, e, t.type_) === n && i.drafts_.length > 1 && (t.assigned_.get(e) ?? !1) === !0 && t.copy_ && nt(
402
- yt(t.copy_, e, t.type_),
403
- i.handledSet_,
404
- i
432
+ } else D(i) && t.callbacks_.push(function() {
433
+ const s = P(t);
434
+ t.type_ === 3 ? s.has(i) && $(i, n.handledSet_, n) : nt(s, e, t.type_) === i && n.drafts_.length > 1 && (t.assigned_.get(e) ?? !1) === !0 && t.copy_ && $(
435
+ nt(t.copy_, e, t.type_),
436
+ n.handledSet_,
437
+ n
405
438
  );
406
439
  });
407
440
  }
408
- function nt(t, e, n) {
409
- return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 || C(t) || e.has(t) || !b(t) || lt(t) || (e.add(t), q(t, (i, o) => {
410
- if (C(o)) {
411
- const a = o[p];
412
- if (ut(a, n)) {
413
- const u = wt(a);
414
- Z(t, i, u, t.type_), kt(a);
441
+ function $(t, e, i) {
442
+ return !i.immer_.autoFreeze_ && i.unfinalizedDrafts_ < 1 || w(t) || e.has(t) || !D(t) || X(t) || (e.add(t), G(t, (n, r) => {
443
+ if (w(r)) {
444
+ const s = r[m];
445
+ if (J(s, i)) {
446
+ const o = ct(s);
447
+ q(t, n, o, t.type_), Ft(s);
415
448
  }
416
- } else b(o) && nt(o, e, n);
449
+ } else D(r) && $(r, e, i);
417
450
  })), t;
418
451
  }
419
- function Xt(t, e) {
420
- const n = st(t), i = {
421
- type_: n ? 1 : 0,
452
+ function Lt(t, e) {
453
+ const i = K(t), n = {
454
+ type_: i ? 1 : 0,
422
455
  // Track which produce call this is associated with.
423
- scope_: e ? e.scope_ : et(),
456
+ scope_: e ? e.scope_ : Et(),
424
457
  // True for both shallow and deep changes.
425
458
  modified_: !1,
426
459
  // Used during finalization.
@@ -443,177 +476,177 @@ function Xt(t, e) {
443
476
  // `callbacks` actually gets assigned in `createProxy`
444
477
  callbacks_: void 0
445
478
  };
446
- let o = i, a = it;
447
- n && (o = [i], a = H);
448
- const { revoke: u, proxy: h } = Proxy.revocable(o, a);
449
- return i.draft_ = h, i.revoke_ = u, [h, i];
479
+ let r = n, s = L;
480
+ i && (r = [n], s = I);
481
+ const { revoke: o, proxy: f } = Proxy.revocable(r, s);
482
+ return n.draft_ = f, n.revoke_ = o, [f, n];
450
483
  }
451
- var it = {
484
+ var L = {
452
485
  get(t, e) {
453
- if (e === p)
486
+ if (e === m)
454
487
  return t;
455
- let n = t.scope_.arrayMethodsPlugin_;
456
- const i = t.type_ === 1 && typeof e == "string";
457
- if (i && n?.isArrayOperationMethod(e))
458
- return n.createMethodInterceptor(t, e);
459
- const o = v(t);
460
- if (!Mt(o, e, t.type_))
461
- return Zt(t, o, e);
462
- const a = o[e];
463
- if (t.finalized_ || !b(a) || i && t.operationMethod && n?.isMutatingArrayMethod(
488
+ let i = t.scope_.arrayMethodsPlugin_;
489
+ const n = t.type_ === 1 && typeof e == "string";
490
+ if (n && i?.isArrayOperationMethod(e))
491
+ return i.createMethodInterceptor(t, e);
492
+ const r = P(t);
493
+ if (!mt(r, e, t.type_))
494
+ return Wt(t, r, e);
495
+ const s = r[e];
496
+ if (t.finalized_ || !D(s) || n && t.operationMethod && i?.isMutatingArrayMethod(
464
497
  t.operationMethod
465
- ) && Ht(e))
466
- return a;
467
- if (a === _t(t.base_, e)) {
468
- U(t);
469
- const u = t.type_ === 1 ? +e : e, h = $(t.scope_, a, t, u);
470
- return t.copy_[u] = h;
498
+ ) && Nt(e))
499
+ return s;
500
+ if (s === tt(t.base_, e)) {
501
+ N(t);
502
+ const o = t.type_ === 1 ? +e : e, f = ut(t.scope_, s, t, o);
503
+ return t.copy_[o] = f;
471
504
  }
472
- return a;
505
+ return s;
473
506
  },
474
507
  has(t, e) {
475
- return e in v(t);
508
+ return e in P(t);
476
509
  },
477
510
  ownKeys(t) {
478
- return Reflect.ownKeys(v(t));
511
+ return Reflect.ownKeys(P(t));
479
512
  },
480
- set(t, e, n) {
481
- const i = Rt(v(t), e);
482
- if (i?.set)
483
- return i.set.call(t.draft_, n), !0;
513
+ set(t, e, i) {
514
+ const n = Ct(P(t), e);
515
+ if (n?.set)
516
+ return n.set.call(t.draft_, i), !0;
484
517
  if (!t.modified_) {
485
- const o = _t(v(t), e), a = o?.[p];
486
- if (a && a.base_ === n)
487
- return t.copy_[e] = n, t.assigned_.set(e, !1), !0;
488
- if (Bt(n, o) && (n !== void 0 || Mt(t.base_, e, t.type_)))
518
+ const r = tt(P(t), e), s = r?.[m];
519
+ if (s && s.base_ === i)
520
+ return t.copy_[e] = i, t.assigned_.set(e, !1), !0;
521
+ if (Mt(i, r) && (i !== void 0 || mt(t.base_, e, t.type_)))
489
522
  return !0;
490
- U(t), I(t);
523
+ N(t), lt(t);
491
524
  }
492
- return t.copy_[e] === n && // special case: handle new props with value 'undefined'
493
- (n !== void 0 || e in t.copy_) || // special case: NaN
494
- Number.isNaN(n) && Number.isNaN(t.copy_[e]) || (t.copy_[e] = n, t.assigned_.set(e, !0), Dt(t, e, n)), !0;
525
+ return t.copy_[e] === i && // special case: handle new props with value 'undefined'
526
+ (i !== void 0 || e in t.copy_) || // special case: NaN
527
+ Number.isNaN(i) && Number.isNaN(t.copy_[e]) || (t.copy_[e] = i, t.assigned_.set(e, !0), $t(t, e, i)), !0;
495
528
  },
496
529
  deleteProperty(t, e) {
497
- return U(t), _t(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_.set(e, !1), I(t)) : t.assigned_.delete(e), t.copy_ && delete t.copy_[e], !0;
530
+ return N(t), tt(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_.set(e, !1), lt(t)) : t.assigned_.delete(e), t.copy_ && delete t.copy_[e], !0;
498
531
  },
499
532
  // Note: We never coerce `desc.value` into an Immer draft, because we can't make
500
533
  // the same guarantee in ES5 mode.
501
534
  getOwnPropertyDescriptor(t, e) {
502
- const n = v(t), i = Reflect.getOwnPropertyDescriptor(n, e);
503
- return i && {
504
- [K]: !0,
505
- [pt]: t.type_ !== 1 || e !== "length",
506
- [X]: i[X],
507
- [j]: n[e]
535
+ const i = P(t), n = Reflect.getOwnPropertyDescriptor(i, e);
536
+ return n && {
537
+ [M]: !0,
538
+ [it]: t.type_ !== 1 || e !== "length",
539
+ [j]: n[j],
540
+ [k]: i[e]
508
541
  };
509
542
  },
510
543
  defineProperty() {
511
- E(11);
544
+ g(11);
512
545
  },
513
546
  getPrototypeOf(t) {
514
- return x(t.base_);
547
+ return F(t.base_);
515
548
  },
516
549
  setPrototypeOf() {
517
- E(12);
518
- }
519
- }, H = {};
520
- for (let t in it) {
521
- let e = it[t];
522
- H[t] = function() {
523
- const n = arguments;
524
- return n[0] = n[0][0], e.apply(this, n);
550
+ g(12);
551
+ }
552
+ }, I = {};
553
+ for (let t in L) {
554
+ let e = L[t];
555
+ I[t] = function() {
556
+ const i = arguments;
557
+ return i[0] = i[0][0], e.apply(this, i);
525
558
  };
526
559
  }
527
- H.deleteProperty = function(t, e) {
528
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && E(13), H.set.call(this, t, e, void 0);
560
+ I.deleteProperty = function(t, e) {
561
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && g(13), I.set.call(this, t, e, void 0);
529
562
  };
530
- H.set = function(t, e, n) {
531
- return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) && E(14), it.set.call(this, t[0], e, n, t[0]);
563
+ I.set = function(t, e, i) {
564
+ return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) && g(14), L.set.call(this, t[0], e, i, t[0]);
532
565
  };
533
- function _t(t, e) {
534
- const n = t[p];
535
- return (n ? v(n) : t)[e];
566
+ function tt(t, e) {
567
+ const i = t[m];
568
+ return (i ? P(i) : t)[e];
536
569
  }
537
- function Zt(t, e, n) {
538
- const i = Rt(e, n);
539
- return i ? j in i ? i[j] : (
570
+ function Wt(t, e, i) {
571
+ const n = Ct(e, i);
572
+ return n ? k in n ? n[k] : (
540
573
  // This is a very special case, if the prop is a getter defined by the
541
574
  // prototype, we should invoke it with the draft as context!
542
- i.get?.call(t.draft_)
575
+ n.get?.call(t.draft_)
543
576
  ) : void 0;
544
577
  }
545
- function Rt(t, e) {
578
+ function Ct(t, e) {
546
579
  if (!(e in t))
547
580
  return;
548
- let n = x(t);
549
- for (; n; ) {
550
- const i = Object.getOwnPropertyDescriptor(n, e);
551
- if (i)
552
- return i;
553
- n = x(n);
581
+ let i = F(t);
582
+ for (; i; ) {
583
+ const n = Object.getOwnPropertyDescriptor(i, e);
584
+ if (n)
585
+ return n;
586
+ i = F(i);
554
587
  }
555
588
  }
556
- function I(t) {
557
- t.modified_ || (t.modified_ = !0, t.parent_ && I(t.parent_));
589
+ function lt(t) {
590
+ t.modified_ || (t.modified_ = !0, t.parent_ && lt(t.parent_));
558
591
  }
559
- function U(t) {
560
- t.copy_ || (t.assigned_ = /* @__PURE__ */ new Map(), t.copy_ = gt(
592
+ function N(t) {
593
+ t.copy_ || (t.assigned_ = /* @__PURE__ */ new Map(), t.copy_ = rt(
561
594
  t.base_,
562
595
  t.scope_.immer_.useStrictShallowCopy_
563
596
  ));
564
597
  }
565
- var te = class {
598
+ var Gt = class {
566
599
  constructor(t) {
567
- this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (e, n, i) => {
568
- if (k(e) && !k(n)) {
569
- const a = n;
570
- n = e;
571
- const u = this;
572
- return function(d = a, ...s) {
573
- return u.produce(d, (r) => n.call(this, r, ...s));
600
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (e, i, n) => {
601
+ if (b(e) && !b(i)) {
602
+ const s = i;
603
+ i = e;
604
+ const o = this;
605
+ return function(d = s, ...u) {
606
+ return o.produce(d, (_) => i.call(this, _, ...u));
574
607
  };
575
608
  }
576
- k(n) || E(6), i !== void 0 && !k(i) && E(7);
577
- let o;
578
- if (b(e)) {
579
- const a = Ot(this), u = $(a, e, void 0);
580
- let h = !0;
609
+ b(i) || g(6), n !== void 0 && !b(n) && g(7);
610
+ let r;
611
+ if (D(e)) {
612
+ const s = St(this), o = ut(s, e, void 0);
613
+ let f = !0;
581
614
  try {
582
- o = n(u), h = !1;
615
+ r = i(o), f = !1;
583
616
  } finally {
584
- h ? vt(a) : Pt(a);
617
+ f ? ot(s) : at(s);
585
618
  }
586
- return bt(a, i), It(o, a);
587
- } else if (!e || !ct(e)) {
588
- if (o = n(e), o === void 0 && (o = e), o === zt && (o = void 0), this.autoFreeze_ && Et(o, !0), i) {
589
- const a = [], u = [];
590
- N(mt).generateReplacementPatches_(e, o, {
591
- patches_: a,
592
- inversePatches_: u
593
- }), i(a, u);
619
+ return vt(s, n), Pt(r, s);
620
+ } else if (!e || !ft(e)) {
621
+ if (r = i(e), r === void 0 && (r = e), r === Dt && (r = void 0), this.autoFreeze_ && dt(r, !0), n) {
622
+ const s = [], o = [];
623
+ E(st).generateReplacementPatches_(e, r, {
624
+ patches_: s,
625
+ inversePatches_: o
626
+ }), n(s, o);
594
627
  }
595
- return o;
628
+ return r;
596
629
  } else
597
- E(1, e);
598
- }, this.produceWithPatches = (e, n) => {
599
- if (k(e))
600
- return (u, ...h) => this.produceWithPatches(u, (d) => e(d, ...h));
601
- let i, o;
602
- return [this.produce(e, n, (u, h) => {
603
- i = u, o = h;
604
- }), i, o];
605
- }, ht(t?.autoFreeze) && this.setAutoFreeze(t.autoFreeze), ht(t?.useStrictShallowCopy) && this.setUseStrictShallowCopy(t.useStrictShallowCopy), ht(t?.useStrictIteration) && this.setUseStrictIteration(t.useStrictIteration);
630
+ g(1, e);
631
+ }, this.produceWithPatches = (e, i) => {
632
+ if (b(e))
633
+ return (o, ...f) => this.produceWithPatches(o, (d) => e(d, ...f));
634
+ let n, r;
635
+ return [this.produce(e, i, (o, f) => {
636
+ n = o, r = f;
637
+ }), n, r];
638
+ }, Z(t?.autoFreeze) && this.setAutoFreeze(t.autoFreeze), Z(t?.useStrictShallowCopy) && this.setUseStrictShallowCopy(t.useStrictShallowCopy), Z(t?.useStrictIteration) && this.setUseStrictIteration(t.useStrictIteration);
606
639
  }
607
640
  createDraft(t) {
608
- b(t) || E(8), C(t) && (t = ee(t));
609
- const e = Ot(this), n = $(e, t, void 0);
610
- return n[p].isManual_ = !0, Pt(e), n;
641
+ D(t) || g(8), w(t) && (t = Kt(t));
642
+ const e = St(this), i = ut(e, t, void 0);
643
+ return i[m].isManual_ = !0, at(e), i;
611
644
  }
612
645
  finishDraft(t, e) {
613
- const n = t && t[p];
614
- (!n || !n.isManual_) && E(9);
615
- const { scope_: i } = n;
616
- return bt(i, e), It(void 0, i);
646
+ const i = t && t[m];
647
+ (!i || !i.isManual_) && g(9);
648
+ const { scope_: n } = i;
649
+ return vt(n, e), Pt(void 0, n);
617
650
  }
618
651
  /**
619
652
  * Pass true to automatically freeze all copies created by Immer.
@@ -644,390 +677,98 @@ var te = class {
644
677
  return this.useStrictIteration_;
645
678
  }
646
679
  applyPatches(t, e) {
647
- let n;
648
- for (n = e.length - 1; n >= 0; n--) {
649
- const o = e[n];
650
- if (o.path.length === 0 && o.op === "replace") {
651
- t = o.value;
680
+ let i;
681
+ for (i = e.length - 1; i >= 0; i--) {
682
+ const r = e[i];
683
+ if (r.path.length === 0 && r.op === "replace") {
684
+ t = r.value;
652
685
  break;
653
686
  }
654
687
  }
655
- n > -1 && (e = e.slice(n + 1));
656
- const i = N(mt).applyPatches_;
657
- return C(t) ? i(t, e) : this.produce(
688
+ i > -1 && (e = e.slice(i + 1));
689
+ const n = E(st).applyPatches_;
690
+ return w(t) ? n(t, e) : this.produce(
658
691
  t,
659
- (o) => i(o, e)
692
+ (r) => n(r, e)
660
693
  );
661
694
  }
662
695
  };
663
- function $(t, e, n, i) {
664
- const [o, a] = ot(e) ? N(L).proxyMap_(e, n) : at(e) ? N(L).proxySet_(e, n) : Xt(e, n);
665
- return (n?.scope_ ?? et()).drafts_.push(o), a.callbacks_ = n?.callbacks_ ?? [], a.key_ = i, n && i !== void 0 ? Qt(n, a, i) : a.callbacks_.push(function(d) {
666
- d.mapSetPlugin_?.fixSetContents(a);
667
- const { patchPlugin_: s } = d;
668
- a.modified_ && s && s.generatePatches_(a, [], d);
669
- }), o;
696
+ function ut(t, e, i, n) {
697
+ const [r, s] = H(e) ? E(B).proxyMap_(e, i) : Y(e) ? E(B).proxySet_(e, i) : Lt(e, i);
698
+ return (i?.scope_ ?? Et()).drafts_.push(r), s.callbacks_ = i?.callbacks_ ?? [], s.key_ = n, i && n !== void 0 ? Bt(i, s, n) : s.callbacks_.push(function(d) {
699
+ d.mapSetPlugin_?.fixSetContents(s);
700
+ const { patchPlugin_: u } = d;
701
+ s.modified_ && u && u.generatePatches_(s, [], d);
702
+ }), r;
670
703
  }
671
- function ee(t) {
672
- return C(t) || E(10, t), Ut(t);
704
+ function Kt(t) {
705
+ return w(t) || g(10, t), It(t);
673
706
  }
674
- function Ut(t) {
675
- if (!b(t) || lt(t))
707
+ function It(t) {
708
+ if (!D(t) || X(t))
676
709
  return t;
677
- const e = t[p];
678
- let n, i = !0;
710
+ const e = t[m];
711
+ let i, n = !0;
679
712
  if (e) {
680
713
  if (!e.modified_)
681
714
  return e.base_;
682
- e.finalized_ = !0, n = gt(t, e.scope_.immer_.useStrictShallowCopy_), i = e.scope_.immer_.shouldUseStrictIteration();
715
+ e.finalized_ = !0, i = rt(t, e.scope_.immer_.useStrictShallowCopy_), n = e.scope_.immer_.shouldUseStrictIteration();
683
716
  } else
684
- n = gt(t, !0);
685
- return q(
686
- n,
687
- (o, a) => {
688
- Z(n, o, Ut(a));
717
+ i = rt(t, !0);
718
+ return G(
719
+ i,
720
+ (r, s) => {
721
+ q(i, r, It(s));
689
722
  },
690
- i
691
- ), e && (e.finalized_ = !1), n;
723
+ n
724
+ ), e && (e.finalized_ = !1), i;
692
725
  }
693
- function ne() {
694
- class t extends Map {
695
- constructor(s, r) {
696
- super(), this[p] = {
697
- type_: 2,
698
- parent_: r,
699
- scope_: r ? r.scope_ : et(),
700
- modified_: !1,
701
- finalized_: !1,
702
- copy_: void 0,
703
- assigned_: void 0,
704
- base_: s,
705
- draft_: this,
706
- isManual_: !1,
707
- revoked_: !1,
708
- callbacks_: []
709
- };
710
- }
711
- get size() {
712
- return v(this[p]).size;
713
- }
714
- has(s) {
715
- return v(this[p]).has(s);
716
- }
717
- set(s, r) {
718
- const c = this[p];
719
- return u(c), (!v(c).has(s) || v(c).get(s) !== r) && (n(c), I(c), c.assigned_.set(s, !0), c.copy_.set(s, r), c.assigned_.set(s, !0), Dt(c, s, r)), this;
720
- }
721
- delete(s) {
722
- if (!this.has(s))
723
- return !1;
724
- const r = this[p];
725
- return u(r), n(r), I(r), r.base_.has(s) ? r.assigned_.set(s, !1) : r.assigned_.delete(s), r.copy_.delete(s), !0;
726
- }
727
- clear() {
728
- const s = this[p];
729
- u(s), v(s).size && (n(s), I(s), s.assigned_ = /* @__PURE__ */ new Map(), q(s.base_, (r) => {
730
- s.assigned_.set(r, !1);
731
- }), s.copy_.clear());
732
- }
733
- forEach(s, r) {
734
- const c = this[p];
735
- v(c).forEach((l, _, g) => {
736
- s.call(r, this.get(_), _, this);
737
- });
738
- }
739
- get(s) {
740
- const r = this[p];
741
- u(r);
742
- const c = v(r).get(s);
743
- if (r.finalized_ || !b(c) || c !== r.base_.get(s))
744
- return c;
745
- const l = $(r.scope_, c, r, s);
746
- return n(r), r.copy_.set(s, l), l;
747
- }
748
- keys() {
749
- return v(this[p]).keys();
750
- }
751
- values() {
752
- const s = this.keys();
753
- return {
754
- [Symbol.iterator]: () => this.values(),
755
- next: () => {
756
- const r = s.next();
757
- return r.done ? r : {
758
- done: !1,
759
- value: this.get(r.value)
760
- };
761
- }
762
- };
763
- }
764
- entries() {
765
- const s = this.keys();
766
- return {
767
- [Symbol.iterator]: () => this.entries(),
768
- next: () => {
769
- const r = s.next();
770
- if (r.done)
771
- return r;
772
- const c = this.get(r.value);
773
- return {
774
- done: !1,
775
- value: [r.value, c]
776
- };
777
- }
778
- };
779
- }
780
- [Symbol.iterator]() {
781
- return this.entries();
782
- }
783
- }
784
- function e(d, s) {
785
- const r = new t(d, s);
786
- return [r, r[p]];
787
- }
788
- function n(d) {
789
- d.copy_ || (d.assigned_ = /* @__PURE__ */ new Map(), d.copy_ = new Map(d.base_));
790
- }
791
- class i extends Set {
792
- constructor(s, r) {
793
- super(), this[p] = {
794
- type_: 3,
795
- parent_: r,
796
- scope_: r ? r.scope_ : et(),
797
- modified_: !1,
798
- finalized_: !1,
799
- copy_: void 0,
800
- base_: s,
801
- draft_: this,
802
- drafts_: /* @__PURE__ */ new Map(),
803
- revoked_: !1,
804
- isManual_: !1,
805
- assigned_: void 0,
806
- callbacks_: []
807
- };
808
- }
809
- get size() {
810
- return v(this[p]).size;
811
- }
812
- has(s) {
813
- const r = this[p];
814
- return u(r), r.copy_ ? !!(r.copy_.has(s) || r.drafts_.has(s) && r.copy_.has(r.drafts_.get(s))) : r.base_.has(s);
815
- }
816
- add(s) {
817
- const r = this[p];
818
- return u(r), this.has(s) || (a(r), I(r), r.copy_.add(s), Dt(r, s, s)), this;
819
- }
820
- delete(s) {
821
- if (!this.has(s))
822
- return !1;
823
- const r = this[p];
824
- return u(r), a(r), I(r), r.copy_.delete(s) || (r.drafts_.has(s) ? r.copy_.delete(r.drafts_.get(s)) : (
825
- /* istanbul ignore next */
826
- !1
827
- ));
828
- }
829
- clear() {
830
- const s = this[p];
831
- u(s), v(s).size && (a(s), I(s), s.copy_.clear());
832
- }
833
- values() {
834
- const s = this[p];
835
- return u(s), a(s), s.copy_.values();
836
- }
837
- entries() {
838
- const s = this[p];
839
- return u(s), a(s), s.copy_.entries();
840
- }
841
- keys() {
842
- return this.values();
843
- }
844
- [Symbol.iterator]() {
845
- return this.values();
846
- }
847
- forEach(s, r) {
848
- const c = this.values();
849
- let l = c.next();
850
- for (; !l.done; )
851
- s.call(r, l.value, l.value, this), l = c.next();
852
- }
853
- }
854
- function o(d, s) {
855
- const r = new i(d, s);
856
- return [r, r[p]];
857
- }
858
- function a(d) {
859
- d.copy_ || (d.copy_ = /* @__PURE__ */ new Set(), d.base_.forEach((s) => {
860
- if (b(s)) {
861
- const r = $(d.scope_, s, d, s);
862
- d.drafts_.set(s, r), d.copy_.add(r);
863
- } else
864
- d.copy_.add(s);
865
- }));
866
- }
867
- function u(d) {
868
- d.revoked_ && E(3, JSON.stringify(v(d)));
869
- }
870
- function h(d) {
871
- if (d.type_ === 3 && d.copy_) {
872
- const s = new Set(d.copy_);
873
- d.copy_.clear(), s.forEach((r) => {
874
- d.copy_.add(qt(r));
875
- });
876
- }
877
- }
878
- Ct(L, { proxyMap_: e, proxySet_: o, fixSetContents: h });
879
- }
880
- function ie() {
881
- const t = /* @__PURE__ */ new Set(["shift", "unshift"]), e = /* @__PURE__ */ new Set(["push", "pop"]), n = /* @__PURE__ */ new Set([
882
- ...e,
883
- ...t
884
- ]), i = /* @__PURE__ */ new Set(["reverse", "sort"]), o = /* @__PURE__ */ new Set([
885
- ...n,
886
- ...i,
887
- "splice"
888
- ]), a = /* @__PURE__ */ new Set(["find", "findLast"]), u = /* @__PURE__ */ new Set([
889
- "filter",
890
- "slice",
891
- "concat",
892
- "flat",
893
- ...a,
894
- "findIndex",
895
- "findLastIndex",
896
- "some",
897
- "every",
898
- "indexOf",
899
- "lastIndexOf",
900
- "includes",
901
- "join",
902
- "toString",
903
- "toLocaleString"
904
- ]);
905
- function h(f) {
906
- return o.has(f);
907
- }
908
- function d(f) {
909
- return u.has(f);
910
- }
911
- function s(f) {
912
- return h(f) || d(f);
913
- }
914
- function r(f, S) {
915
- f.operationMethod = S;
916
- }
917
- function c(f) {
918
- f.operationMethod = void 0;
919
- }
920
- function l(f, S, M = !0) {
921
- U(f);
922
- const P = S();
923
- return I(f), M && f.assigned_.set("length", !0), P;
924
- }
925
- function _(f) {
926
- f.allIndicesReassigned_ = !0;
927
- }
928
- function g(f, S) {
929
- return f < 0 ? Math.max(S + f, 0) : Math.min(f, S);
930
- }
931
- function y(f, S, M) {
932
- return l(f, () => {
933
- const P = f.copy_[S](...M);
934
- return t.has(S) && _(f), n.has(S) ? P : f.draft_;
935
- });
936
- }
937
- function V(f, S, M) {
938
- return l(
939
- f,
940
- () => (f.copy_[S](...M), _(f), f.draft_),
941
- !1
942
- );
943
- }
944
- function D(f, S) {
945
- return function(...P) {
946
- const w = S;
947
- r(f, w);
948
- try {
949
- if (h(w)) {
950
- if (n.has(w))
951
- return y(f, w, P);
952
- if (i.has(w))
953
- return V(f, w, P);
954
- if (w === "splice") {
955
- const T = l(
956
- f,
957
- () => f.copy_.splice(...P)
958
- );
959
- return _(f), T;
960
- }
961
- } else
962
- return O(f, w, P);
963
- } finally {
964
- c(f);
965
- }
726
+ var Ht = new Gt(), z = Ht.produce;
727
+ let Yt = () => ({
728
+ emit(t, ...e) {
729
+ for (let i = this.events[t] || [], n = 0, r = i.length; n < r; n++)
730
+ i[n](...e);
731
+ },
732
+ events: {},
733
+ on(t, e) {
734
+ return (this.events[t] ||= []).push(e), () => {
735
+ this.events[t] = this.events[t]?.filter((i) => e !== i);
966
736
  };
967
737
  }
968
- function O(f, S, M) {
969
- const P = v(f);
970
- if (S === "filter") {
971
- const w = M[0], T = [];
972
- for (let z = 0; z < P.length; z++)
973
- w(P[z], z, P) && T.push(f.draft_[z]);
974
- return T;
975
- }
976
- if (a.has(S)) {
977
- const w = M[0], T = S === "find", z = T ? 1 : -1, ft = T ? 0 : P.length - 1;
978
- for (let A = ft; A >= 0 && A < P.length; A += z)
979
- if (w(P[A], A, P))
980
- return f.draft_[A];
981
- return;
982
- }
983
- if (S === "slice") {
984
- const w = M[0] ?? 0, T = M[1] ?? P.length, z = g(w, P.length), ft = g(T, P.length), A = [];
985
- for (let dt = z; dt < ft; dt++)
986
- A.push(f.draft_[dt]);
987
- return A;
988
- }
989
- return P[S](...M);
990
- }
991
- Ct(St, {
992
- createMethodInterceptor: D,
993
- isArrayOperationMethod: s,
994
- isMutatingArrayMethod: h
995
- });
996
- }
997
- var re = new te(), R = re.produce;
998
- function Y(t) {
738
+ });
739
+ function R(t) {
999
740
  if (typeof t != "object" || t === null) return;
1000
741
  const e = Object.getPrototypeOf(t);
1001
742
  if (e === Object.prototype || e === null) return;
1002
- const n = e.constructor;
1003
- typeof n == "function" && (t instanceof Date || t instanceof RegExp || t instanceof Map || t instanceof Set || t instanceof WeakMap || t instanceof WeakSet || ArrayBuffer.isView(t) || n[J] !== !0 && (n[J] = !0));
743
+ const i = e.constructor;
744
+ typeof i == "function" && (t instanceof Date || t instanceof RegExp || t instanceof Map || t instanceof Set || t instanceof WeakMap || t instanceof WeakSet || ArrayBuffer.isView(t) || i[x] !== !0 && (i[x] = !0));
1004
745
  }
1005
- let se = 0;
1006
- function oe() {
1007
- return se++;
746
+ let Xt = 0;
747
+ function Jt() {
748
+ return Xt++;
1008
749
  }
1009
- class ae {
1010
- constructor(e, n, i) {
1011
- this.controller = e, this.path = n, this.id = oe(), this._isTouched = !1, this._isDirty = !1, i?.isTouched && this._setTouched(!0), i?.isDirty && this._setDirty(!0);
750
+ class Qt {
751
+ constructor(e, i, n) {
752
+ this.controller = e, this.path = i, this.id = Jt(), this._isTouched = !1, this._isDirty = !1, n?.isTouched && this._setTouched(!0), n?.isDirty && this._setDirty(!0);
753
+ }
754
+ get canonicalPath() {
755
+ return h.toCanonicalPath(this.path);
756
+ }
757
+ get stringPath() {
758
+ return h.toStringPath(this.path);
1012
759
  }
1013
760
  get value() {
1014
- return m.getValue(
1015
- this.controller._data,
1016
- this.path
1017
- );
761
+ return h.getValue(this.controller._data, this.path);
1018
762
  }
1019
763
  get initialValue() {
1020
- return m.getValue(
1021
- this.controller._initialData,
1022
- this.path
1023
- );
764
+ return h.getValue(this.controller._initialData, this.path);
1024
765
  }
1025
766
  get boundElement() {
1026
767
  return this.target;
1027
768
  }
1028
769
  get issues() {
1029
770
  return this.controller._issues.filter(
1030
- (e) => m.parsePath(e.path ?? []) === this.path
771
+ (e) => h.equals(h.normalize(e.path), this.path)
1031
772
  );
1032
773
  }
1033
774
  get isTouched() {
@@ -1040,68 +781,68 @@ class ae {
1040
781
  return this.issues.length === 0;
1041
782
  }
1042
783
  _setTouched(e) {
1043
- const n = this._isTouched !== e;
1044
- if (this._isTouched = e, n) {
1045
- const i = this.controller.getAscendantFields(this.path);
1046
- for (let o = i.length - 1; o >= 0; o--) {
1047
- const a = i[o];
1048
- a != null && this.controller.events.emit("fieldTouchUpdated", a.path);
784
+ const i = this._isTouched !== e;
785
+ if (this._isTouched = e, i) {
786
+ const n = this.controller.getAscendantFields(this.path);
787
+ for (let r = n.length - 1; r >= 0; r--) {
788
+ const s = n[r];
789
+ s != null && this.controller.events.emit("fieldTouchUpdated", s.path);
1049
790
  }
1050
791
  }
1051
792
  }
1052
793
  _setDirty(e) {
1053
- const n = this._isDirty !== e;
1054
- if (this._isDirty = e, n) {
1055
- const i = this.controller.getAscendantFields(this.path);
1056
- for (let o = i.length - 1; o >= 0; o--) {
1057
- const a = i[o];
1058
- a != null && this.controller.events.emit("fieldDirtyUpdated", a.path);
794
+ const i = this._isDirty !== e;
795
+ if (this._isDirty = e, i) {
796
+ const n = this.controller.getAscendantFields(this.path);
797
+ for (let r = n.length - 1; r >= 0; r--) {
798
+ const s = n[r];
799
+ s != null && this.controller.events.emit("fieldDirtyUpdated", s.path);
1059
800
  }
1060
801
  }
1061
802
  }
1062
803
  bindElement(e) {
1063
- e != null ? this.controller.events.emit("elementBound", this.path, e) : this.controller.events.emit("elementUnbound", this.path), this.target = e;
1064
- }
1065
- setValue(e, n) {
1066
- return this.modifyValue(() => e, n);
1067
- }
1068
- modifyValue(e, n) {
1069
- (n?.shouldTouch == null || n?.shouldTouch) && this.touch();
1070
- const i = this.controller.getAscendantFields(this.path), o = i.map((s) => s?.initialValue);
1071
- o.forEach((s) => Y(s));
1072
- const a = i.map((s) => s?.value);
1073
- a.forEach((s) => Y(s)), this.controller._data = R(this.controller._data, (s) => {
1074
- m.modifyValue(s, this.path, (r) => e(r));
804
+ this.target = e, e != null ? this.controller.events.emit("elementBound", this.path, e) : this.controller.events.emit("elementUnbound", this.path);
805
+ }
806
+ setValue(e, i) {
807
+ return this.modifyValue(() => e, i);
808
+ }
809
+ modifyValue(e, i) {
810
+ (i?.shouldTouch == null || i?.shouldTouch) && this.touch();
811
+ const n = this.controller.getAscendantFields(this.path), r = n.map((u) => u?.initialValue);
812
+ r.forEach((u) => R(u));
813
+ const s = n.map((u) => u?.value);
814
+ s.forEach((u) => R(u)), this.controller._data = z(this.controller._data, (u) => {
815
+ h.modifyValue(u, this.path, (_) => e(_));
1075
816
  });
1076
- const u = i.map((s) => s?.value);
1077
- u.forEach((s) => Y(s));
1078
- const h = (s, r) => {
1079
- if (typeof s != "object" || typeof r != "object") return;
1080
- const c = s.constructor, l = r.constructor;
1081
- if (c === l)
1082
- return this.controller.equalityComparators?.[c]?.(s, r);
817
+ const o = n.map((u) => u?.value);
818
+ o.forEach((u) => R(u));
819
+ const f = (u, _) => {
820
+ if (typeof u != "object" || typeof _ != "object") return;
821
+ const c = u.constructor, a = _.constructor;
822
+ if (c === a)
823
+ return this.controller.equalityComparators?.[c]?.(u, _);
1083
824
  };
1084
- if (!m.deepEqual(
1085
- a[a.length - 1],
1086
- u[u.length - 1],
1087
- h
825
+ if (!V.deepEqual(
826
+ s[s.length - 1],
827
+ o[o.length - 1],
828
+ f
1088
829
  ))
1089
- for (let s = i.length - 1; s >= 0; s--) {
1090
- const r = i[s];
830
+ for (let u = n.length - 1; u >= 0; u--) {
831
+ const _ = n[u];
1091
832
  this.controller.events.emit(
1092
833
  "valueChanged",
1093
- r.path,
1094
- u[s],
1095
- a[s]
834
+ _.path,
835
+ o[u],
836
+ s[u]
1096
837
  );
1097
838
  }
1098
- if (n?.shouldMarkDirty == null || n?.shouldMarkDirty) {
1099
- const s = !m.deepEqual(
839
+ if (i?.shouldMarkDirty == null || i?.shouldMarkDirty) {
840
+ const u = !V.deepEqual(
841
+ r[r.length - 1],
1100
842
  o[o.length - 1],
1101
- u[u.length - 1],
1102
- h
843
+ f
1103
844
  );
1104
- this._setDirty(s);
845
+ this._setDirty(u);
1105
846
  }
1106
847
  }
1107
848
  reset() {
@@ -1122,29 +863,15 @@ class ae {
1122
863
  }), this.target?.scrollIntoView(), this.target?.focus();
1123
864
  }
1124
865
  }
1125
- let ce = () => ({
1126
- emit(t, ...e) {
1127
- for (let n = this.events[t] || [], i = 0, o = n.length; i < o; i++)
1128
- n[i](...e);
1129
- },
1130
- events: {},
1131
- on(t, e) {
1132
- return (this.events[t] ||= []).push(e), () => {
1133
- this.events[t] = this.events[t]?.filter((n) => e !== n);
1134
- };
1135
- }
1136
- });
1137
- function le(t, e) {
1138
- let n = [];
1139
- for (let i = t.length - 1; i >= 0; i--)
1140
- e(t[i]) && n.push(i);
1141
- n.forEach((i) => t.splice(i, 1));
866
+ function Zt(t, e) {
867
+ let i = [];
868
+ for (let n = t.length - 1; n >= 0; n--)
869
+ e(t[n]) && i.push(n);
870
+ i.forEach((n) => t.splice(n, 1));
1142
871
  }
1143
- ne();
1144
- ie();
1145
- class ue {
872
+ class te {
1146
873
  constructor(e) {
1147
- this._isValidating = !1, this._isSubmitting = !1, this._fields = /* @__PURE__ */ new Map(), this._issues = [], this.events = ce(), this.validationSchema = e.validationSchema, this.equalityComparators = e.equalityComparators, this._initialData = e.initialData ?? {}, this._data = R(this._initialData, () => {
874
+ this._isValidating = !1, this._isSubmitting = !1, this._fields = /* @__PURE__ */ new Map(), this._issues = [], this.events = Yt(), this.validationSchema = e.validationSchema, this.equalityComparators = e.equalityComparators, this._initialData = e.initialData ?? {}, this._data = z(this._initialData, () => {
1148
875
  });
1149
876
  }
1150
877
  get isDirty() {
@@ -1167,67 +894,66 @@ class ue {
1167
894
  setSubmitting(e) {
1168
895
  this._isSubmitting !== e && (this._isSubmitting = e, this.events.emit("submissionStatusChange", e));
1169
896
  }
1170
- _unsafeSetFieldValue(e, n, i) {
1171
- Y(n), i?.updateInitialValue === !0 && (this._initialData = R(this._initialData, (o) => {
1172
- m.setValue(o, e, n);
1173
- })), this._data = R(this._data, (o) => {
1174
- m.setValue(o, e, n);
897
+ _unsafeSetFieldValue(e, i, n) {
898
+ R(i), n?.updateInitialValue === !0 && (this._initialData = z(this._initialData, (r) => {
899
+ h.setValue(r, e, i);
900
+ })), this._data = z(this._data, (r) => {
901
+ h.setValue(r, e, i);
1175
902
  });
1176
903
  }
1177
904
  // TODO: Rename to "register" ??
1178
- bindField(e, n) {
1179
- let i = m.getValue(this._data, e);
1180
- i == null && n?.defaultValue != null && (this._unsafeSetFieldValue(e, n.defaultValue, {
1181
- updateInitialValue: n.overrideInitialValue
1182
- }), i = m.getValue(this._data, e));
1183
- const o = m.getValue(this._initialData, e), a = new ae(this, e, {
1184
- isDirty: !m.deepEqual(i, o)
905
+ bindField(e, i) {
906
+ let n = h.getValue(this._data, e);
907
+ n == null && i?.defaultValue != null && (this._unsafeSetFieldValue(e, i.defaultValue, {
908
+ updateInitialValue: i.overrideInitialValue
909
+ }), n = h.getValue(this._data, e));
910
+ const r = h.getValue(this._initialData, e), s = new Qt(this, e, {
911
+ isDirty: !V.deepEqual(n, r)
1185
912
  });
1186
- return n?.domElement != null && a.bindElement(n.domElement), this._fields.set(e, a), this.events.emit("fieldBound", e), a;
913
+ return i?.domElement != null && s.bindElement(i.domElement), this._fields.set(s.stringPath, s), this.events.emit("fieldBound", s.path), s;
1187
914
  }
1188
915
  unbindField(e) {
1189
- this._fields.delete(e), this.events.emit("fieldUnbound", e);
916
+ const i = h.toStringPath(e);
917
+ this._fields.delete(i), this.events.emit("fieldUnbound", e);
1190
918
  }
1191
919
  // TODO: Add an option to keep dirty/touched fields as they are
1192
920
  reset(e) {
1193
921
  this._data = this._initialData, this._issues = [];
1194
- for (const n of this._fields.values())
1195
- n.reset();
1196
- e != null && (this._initialData = e, this._data = R(this._initialData, () => {
922
+ for (const i of this._fields.values())
923
+ i.reset();
924
+ e != null && (this._initialData = e, this._data = z(this._initialData, () => {
1197
925
  }));
1198
926
  }
1199
927
  getAscendantFields(e) {
1200
- const n = m.parsePathFragments(e);
1201
- return n.map((o, a) => m.parsePath(
1202
- n.slice(0, a + 1)
1203
- )).map((o) => this.getField(o)).filter((o) => !!o);
928
+ return e.map((n, r) => e.slice(0, r + 1)).map((n) => this.getField(n)).filter((n) => !!n);
1204
929
  }
1205
930
  getField(e) {
1206
- return this._fields.get(e);
931
+ const i = h.toStringPath(e);
932
+ return this._fields.get(i);
1207
933
  }
1208
934
  clearFieldIssues(e) {
1209
- this._issues = this._issues.filter((n) => n.path == null ? !0 : m.parsePath(n.path) !== e);
935
+ this._issues = this._issues.filter((i) => !h.equals(h.normalize(i.path), e));
1210
936
  }
1211
- async applyValidation(e, n) {
1212
- const i = m.diff(
937
+ async applyValidation(e, i) {
938
+ const n = V.diff(
1213
939
  this._issues,
1214
940
  e.issues ?? [],
1215
- m.deepEqual,
1216
- (o) => {
1217
- if (o.path == null) return !1;
1218
- const a = m.parsePath(o.path);
1219
- return a === n || m.isDescendant(n, a);
941
+ V.deepEqual,
942
+ (r) => {
943
+ if (r.path == null) return !1;
944
+ const s = h.normalize(r.path);
945
+ return h.equals(s, i) || h.isDescendant(i, s);
1220
946
  }
1221
947
  );
1222
- le(this._issues, (o) => i.removed.includes(o)), i.added.forEach((o) => this._issues.push(o)), (i.added.length !== 0 || i.removed.length !== 0) && this.events.emit("fieldIssuesUpdated", n);
948
+ Zt(this._issues, (r) => n.removed.includes(r)), n.added.forEach((r) => this._issues.push(r)), (n.added.length !== 0 || n.removed.length !== 0) && this.events.emit("fieldIssuesUpdated", i);
1223
949
  }
1224
950
  async validateField(e) {
1225
951
  if (this._isValidating || this.validationSchema == null) return;
1226
952
  this.setValidating(!0), this.getField(e) == null && this.bindField(e);
1227
- const n = await this.validationSchema["~standard"].validate(
953
+ const i = await this.validationSchema["~standard"].validate(
1228
954
  this._data
1229
955
  );
1230
- this.events.emit("validationTriggered", e), this.applyValidation(n, e), this.setValidating(!1);
956
+ this.events.emit("validationTriggered", e), this.applyValidation(i, e), this.setValidating(!1);
1231
957
  }
1232
958
  async validateForm() {
1233
959
  if (this._isValidating || this.validationSchema == null) return;
@@ -1235,49 +961,55 @@ class ue {
1235
961
  const e = await this.validationSchema["~standard"].validate(
1236
962
  this._data
1237
963
  );
1238
- for (const i of this._fields.keys())
1239
- this.events.emit("validationTriggered", i), this.applyValidation(e, i);
1240
- m.diff(this._issues, e.issues ?? [], m.deepEqual).added.forEach((i) => this._issues.push(i)), this.setValidating(!1);
1241
- }
1242
- createSubmitHandler(e, n) {
1243
- return async (i) => {
1244
- if (i?.preventDefault(), this._isValidating || this._isSubmitting) return;
1245
- const o = new AbortController();
964
+ for (const n of this._fields.keys()) {
965
+ const r = h.fromStringPath(n);
966
+ this.events.emit("validationTriggered", r), this.applyValidation(e, r);
967
+ }
968
+ V.diff(
969
+ this._issues,
970
+ e.issues ?? [],
971
+ V.deepEqual
972
+ ).added.forEach((n) => this._issues.push(n)), this.setValidating(!1);
973
+ }
974
+ createSubmitHandler(e, i) {
975
+ return async (n) => {
976
+ if (n?.preventDefault(), this._isValidating || this._isSubmitting) return;
977
+ const r = new AbortController();
1246
978
  if (await this.validateForm(), this._issues.length === 0) {
1247
- this.setSubmitting(!0), await e?.(this._data, i, o.signal), this.setSubmitting(!1);
979
+ this.setSubmitting(!0), await e?.(this._data, n, r.signal), this.setSubmitting(!1);
1248
980
  return;
1249
981
  }
1250
- for (const a of this._issues) {
1251
- if (a.path == null) continue;
1252
- const u = m.parsePath(a.path), h = this.getField(u);
1253
- if (h != null && h.boundElement != null) {
1254
- h.focus();
982
+ for (const s of this._issues) {
983
+ if (s.path == null) continue;
984
+ const o = h.normalize(s.path), f = this.getField(o);
985
+ if (f != null && f.boundElement != null) {
986
+ f.focus();
1255
987
  break;
1256
988
  }
1257
989
  }
1258
- await n?.(this._issues, i, o.signal), this.setSubmitting(!1);
990
+ await i?.(this._issues, n, r.signal), this.setSubmitting(!1);
1259
991
  };
1260
992
  }
1261
993
  }
1262
- function fe(t) {
994
+ function ee(t) {
1263
995
  return {
1264
996
  "~standard": {
1265
997
  version: 1,
1266
998
  vendor: "goodie-forms/custom",
1267
999
  validate: async (e) => {
1268
1000
  try {
1269
- const n = await t(e);
1270
- return n == null ? { value: e } : {
1271
- issues: n.map((i) => ({
1272
- path: m.parsePathFragments(i.path),
1273
- message: i.message
1001
+ const i = await t(e);
1002
+ return i == null ? { value: e } : {
1003
+ issues: i.map((n) => ({
1004
+ path: h.fromStringPath(n.path),
1005
+ message: n.message
1274
1006
  }))
1275
1007
  };
1276
- } catch (n) {
1008
+ } catch (i) {
1277
1009
  return {
1278
1010
  issues: [
1279
1011
  {
1280
- message: n instanceof Error ? n.message : "Unknown error"
1012
+ message: i instanceof Error ? i.message : "Unknown error"
1281
1013
  }
1282
1014
  ]
1283
1015
  };
@@ -1287,9 +1019,11 @@ function fe(t) {
1287
1019
  };
1288
1020
  }
1289
1021
  export {
1290
- m as Field,
1291
- ue as FormController,
1292
- ae as FormField,
1293
- fe as customValidation
1022
+ h as FieldPath,
1023
+ et as FieldPathBuilder,
1024
+ te as FormController,
1025
+ Qt as FormField,
1026
+ V as Reconsile,
1027
+ ee as customValidation
1294
1028
  };
1295
1029
  //# sourceMappingURL=index.js.map