remix-validated-form 4.6.0-beta.0 → 4.6.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/browser/ValidatedForm.js +13 -5
  3. package/browser/internal/hooks.d.ts +1 -3
  4. package/browser/internal/logic/requestSubmit.d.ts +5 -0
  5. package/browser/internal/logic/requestSubmit.js +66 -0
  6. package/browser/internal/state/createFormStore.js +2 -1
  7. package/browser/internal/state/fieldArray.d.ts +1 -1
  8. package/browser/internal/state/fieldArray.js +2 -1
  9. package/browser/validation/createValidator.js +3 -1
  10. package/dist/remix-validated-form.cjs.js +4 -4
  11. package/dist/remix-validated-form.cjs.js.map +1 -1
  12. package/dist/remix-validated-form.es.js +796 -1734
  13. package/dist/remix-validated-form.es.js.map +1 -1
  14. package/dist/remix-validated-form.umd.js +4 -4
  15. package/dist/remix-validated-form.umd.js.map +1 -1
  16. package/dist/types/internal/flatten.d.ts +1 -1
  17. package/dist/types/internal/logic/requestSubmit.d.ts +5 -0
  18. package/dist/types/internal/state/fieldArray.d.ts +1 -1
  19. package/package.json +6 -4
  20. package/src/ValidatedForm.tsx +22 -8
  21. package/src/internal/flatten.ts +4 -3
  22. package/src/internal/getInputProps.ts +2 -2
  23. package/src/internal/hooks.ts +3 -3
  24. package/src/internal/logic/requestSubmit.test.tsx +24 -0
  25. package/src/internal/logic/requestSubmit.ts +103 -0
  26. package/src/internal/state/arrayUtil.ts +5 -6
  27. package/src/internal/state/createFormStore.ts +9 -10
  28. package/src/internal/state/fieldArray.tsx +1 -1
  29. package/src/internal/util.ts +2 -2
  30. package/src/validation/createValidator.ts +5 -1
  31. package/src/validation/validation.test.ts +26 -0
  32. package/stats.html +4044 -0
@@ -1,1321 +1,195 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a2, b2) => {
9
- for (var prop in b2 || (b2 = {}))
10
- if (__hasOwnProp.call(b2, prop))
11
- __defNormalProp(a2, prop, b2[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b2)) {
14
- if (__propIsEnum.call(b2, prop))
15
- __defNormalProp(a2, prop, b2[prop]);
16
- }
17
- return a2;
18
- };
19
- var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
1
  import React, { createContext, useDebugValue, useContext, useCallback, useEffect, useMemo, useRef, useLayoutEffect, useState } from "react";
33
2
  import { useActionData, useMatches, useTransition, Form, useSubmit } from "@remix-run/react";
34
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
35
- function listCacheClear$1() {
36
- this.__data__ = [];
37
- this.size = 0;
38
- }
39
- var _listCacheClear = listCacheClear$1;
40
- function eq$3(value, other) {
41
- return value === other || value !== value && other !== other;
42
- }
43
- var eq_1 = eq$3;
44
- var eq$2 = eq_1;
45
- function assocIndexOf$4(array, key) {
46
- var length = array.length;
47
- while (length--) {
48
- if (eq$2(array[length][0], key)) {
49
- return length;
50
- }
51
- }
52
- return -1;
53
- }
54
- var _assocIndexOf = assocIndexOf$4;
55
- var assocIndexOf$3 = _assocIndexOf;
56
- var arrayProto = Array.prototype;
57
- var splice = arrayProto.splice;
58
- function listCacheDelete$1(key) {
59
- var data = this.__data__, index = assocIndexOf$3(data, key);
60
- if (index < 0) {
61
- return false;
62
- }
63
- var lastIndex = data.length - 1;
64
- if (index == lastIndex) {
65
- data.pop();
66
- } else {
67
- splice.call(data, index, 1);
68
- }
69
- --this.size;
70
- return true;
71
- }
72
- var _listCacheDelete = listCacheDelete$1;
73
- var assocIndexOf$2 = _assocIndexOf;
74
- function listCacheGet$1(key) {
75
- var data = this.__data__, index = assocIndexOf$2(data, key);
76
- return index < 0 ? void 0 : data[index][1];
77
- }
78
- var _listCacheGet = listCacheGet$1;
79
- var assocIndexOf$1 = _assocIndexOf;
80
- function listCacheHas$1(key) {
81
- return assocIndexOf$1(this.__data__, key) > -1;
82
- }
83
- var _listCacheHas = listCacheHas$1;
84
- var assocIndexOf = _assocIndexOf;
85
- function listCacheSet$1(key, value) {
86
- var data = this.__data__, index = assocIndexOf(data, key);
87
- if (index < 0) {
88
- ++this.size;
89
- data.push([key, value]);
90
- } else {
91
- data[index][1] = value;
92
- }
93
- return this;
94
- }
95
- var _listCacheSet = listCacheSet$1;
96
- var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
97
- function ListCache$4(entries) {
98
- var index = -1, length = entries == null ? 0 : entries.length;
99
- this.clear();
100
- while (++index < length) {
101
- var entry = entries[index];
102
- this.set(entry[0], entry[1]);
103
- }
104
- }
105
- ListCache$4.prototype.clear = listCacheClear;
106
- ListCache$4.prototype["delete"] = listCacheDelete;
107
- ListCache$4.prototype.get = listCacheGet;
108
- ListCache$4.prototype.has = listCacheHas;
109
- ListCache$4.prototype.set = listCacheSet;
110
- var _ListCache = ListCache$4;
111
- var ListCache$3 = _ListCache;
112
- function stackClear$1() {
113
- this.__data__ = new ListCache$3();
114
- this.size = 0;
115
- }
116
- var _stackClear = stackClear$1;
117
- function stackDelete$1(key) {
118
- var data = this.__data__, result = data["delete"](key);
119
- this.size = data.size;
120
- return result;
121
- }
122
- var _stackDelete = stackDelete$1;
123
- function stackGet$1(key) {
124
- return this.__data__.get(key);
125
- }
126
- var _stackGet = stackGet$1;
127
- function stackHas$1(key) {
128
- return this.__data__.has(key);
129
- }
130
- var _stackHas = stackHas$1;
131
- var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
132
- var _freeGlobal = freeGlobal$1;
133
- var freeGlobal = _freeGlobal;
134
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
135
- var root$8 = freeGlobal || freeSelf || Function("return this")();
136
- var _root = root$8;
137
- var root$7 = _root;
138
- var Symbol$5 = root$7.Symbol;
139
- var _Symbol = Symbol$5;
140
- var Symbol$4 = _Symbol;
141
- var objectProto$d = Object.prototype;
142
- var hasOwnProperty$a = objectProto$d.hasOwnProperty;
143
- var nativeObjectToString$1 = objectProto$d.toString;
144
- var symToStringTag$1 = Symbol$4 ? Symbol$4.toStringTag : void 0;
145
- function getRawTag$1(value) {
146
- var isOwn = hasOwnProperty$a.call(value, symToStringTag$1), tag = value[symToStringTag$1];
147
- try {
148
- value[symToStringTag$1] = void 0;
149
- var unmasked = true;
150
- } catch (e2) {
151
- }
152
- var result = nativeObjectToString$1.call(value);
153
- if (unmasked) {
154
- if (isOwn) {
155
- value[symToStringTag$1] = tag;
156
- } else {
157
- delete value[symToStringTag$1];
158
- }
159
- }
160
- return result;
161
- }
162
- var _getRawTag = getRawTag$1;
163
- var objectProto$c = Object.prototype;
164
- var nativeObjectToString = objectProto$c.toString;
165
- function objectToString$1(value) {
166
- return nativeObjectToString.call(value);
167
- }
168
- var _objectToString = objectToString$1;
169
- var Symbol$3 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
170
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
171
- var symToStringTag = Symbol$3 ? Symbol$3.toStringTag : void 0;
172
- function baseGetTag$5(value) {
173
- if (value == null) {
174
- return value === void 0 ? undefinedTag : nullTag;
175
- }
176
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
177
- }
178
- var _baseGetTag = baseGetTag$5;
179
- function isObject$5(value) {
180
- var type = typeof value;
181
- return value != null && (type == "object" || type == "function");
182
- }
183
- var isObject_1 = isObject$5;
184
- var baseGetTag$4 = _baseGetTag, isObject$4 = isObject_1;
185
- var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
186
- function isFunction$2(value) {
187
- if (!isObject$4(value)) {
188
- return false;
189
- }
190
- var tag = baseGetTag$4(value);
191
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
192
- }
193
- var isFunction_1 = isFunction$2;
194
- var root$6 = _root;
195
- var coreJsData$1 = root$6["__core-js_shared__"];
196
- var _coreJsData = coreJsData$1;
197
- var coreJsData = _coreJsData;
198
- var maskSrcKey = function() {
199
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
200
- return uid ? "Symbol(src)_1." + uid : "";
201
- }();
202
- function isMasked$1(func) {
203
- return !!maskSrcKey && maskSrcKey in func;
204
- }
205
- var _isMasked = isMasked$1;
206
- var funcProto$1 = Function.prototype;
207
- var funcToString$1 = funcProto$1.toString;
208
- function toSource$2(func) {
209
- if (func != null) {
210
- try {
211
- return funcToString$1.call(func);
212
- } catch (e2) {
3
+ var __spreadArray = globalThis && globalThis.__spreadArray || function(to, from2, pack) {
4
+ if (pack || arguments.length === 2)
5
+ for (var i2 = 0, l2 = from2.length, ar; i2 < l2; i2++) {
6
+ if (ar || !(i2 in from2)) {
7
+ if (!ar)
8
+ ar = Array.prototype.slice.call(from2, 0, i2);
9
+ ar[i2] = from2[i2];
10
+ }
213
11
  }
214
- try {
215
- return func + "";
216
- } catch (e2) {
12
+ return to.concat(ar || Array.prototype.slice.call(from2));
13
+ };
14
+ function purry(fn2, args, lazy) {
15
+ var diff = fn2.length - args.length;
16
+ var arrayArgs = Array.from(args);
17
+ if (diff === 0) {
18
+ return fn2.apply(void 0, arrayArgs);
19
+ }
20
+ if (diff === 1) {
21
+ var ret = function(data) {
22
+ return fn2.apply(void 0, __spreadArray([data], arrayArgs, false));
23
+ };
24
+ if (lazy || fn2.lazy) {
25
+ ret.lazy = lazy || fn2.lazy;
26
+ ret.lazyArgs = args;
217
27
  }
28
+ return ret;
218
29
  }
219
- return "";
220
- }
221
- var _toSource = toSource$2;
222
- var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$3 = isObject_1, toSource$1 = _toSource;
223
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
224
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
225
- var funcProto = Function.prototype, objectProto$b = Object.prototype;
226
- var funcToString = funcProto.toString;
227
- var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
228
- var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$9).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
229
- function baseIsNative$1(value) {
230
- if (!isObject$3(value) || isMasked(value)) {
231
- return false;
232
- }
233
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
234
- return pattern.test(toSource$1(value));
235
- }
236
- var _baseIsNative = baseIsNative$1;
237
- function getValue$1(object, key) {
238
- return object == null ? void 0 : object[key];
239
- }
240
- var _getValue = getValue$1;
241
- var baseIsNative = _baseIsNative, getValue = _getValue;
242
- function getNative$7(object, key) {
243
- var value = getValue(object, key);
244
- return baseIsNative(value) ? value : void 0;
245
- }
246
- var _getNative = getNative$7;
247
- var getNative$6 = _getNative, root$5 = _root;
248
- var Map$4 = getNative$6(root$5, "Map");
249
- var _Map = Map$4;
250
- var getNative$5 = _getNative;
251
- var nativeCreate$4 = getNative$5(Object, "create");
252
- var _nativeCreate = nativeCreate$4;
253
- var nativeCreate$3 = _nativeCreate;
254
- function hashClear$1() {
255
- this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
256
- this.size = 0;
257
- }
258
- var _hashClear = hashClear$1;
259
- function hashDelete$1(key) {
260
- var result = this.has(key) && delete this.__data__[key];
261
- this.size -= result ? 1 : 0;
262
- return result;
263
- }
264
- var _hashDelete = hashDelete$1;
265
- var nativeCreate$2 = _nativeCreate;
266
- var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
267
- var objectProto$a = Object.prototype;
268
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
269
- function hashGet$1(key) {
270
- var data = this.__data__;
271
- if (nativeCreate$2) {
272
- var result = data[key];
273
- return result === HASH_UNDEFINED$2 ? void 0 : result;
274
- }
275
- return hasOwnProperty$8.call(data, key) ? data[key] : void 0;
276
- }
277
- var _hashGet = hashGet$1;
278
- var nativeCreate$1 = _nativeCreate;
279
- var objectProto$9 = Object.prototype;
280
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
281
- function hashHas$1(key) {
282
- var data = this.__data__;
283
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$7.call(data, key);
284
- }
285
- var _hashHas = hashHas$1;
286
- var nativeCreate = _nativeCreate;
287
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
288
- function hashSet$1(key, value) {
289
- var data = this.__data__;
290
- this.size += this.has(key) ? 0 : 1;
291
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
292
- return this;
293
- }
294
- var _hashSet = hashSet$1;
295
- var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
296
- function Hash$1(entries) {
297
- var index = -1, length = entries == null ? 0 : entries.length;
298
- this.clear();
299
- while (++index < length) {
300
- var entry = entries[index];
301
- this.set(entry[0], entry[1]);
302
- }
303
- }
304
- Hash$1.prototype.clear = hashClear;
305
- Hash$1.prototype["delete"] = hashDelete;
306
- Hash$1.prototype.get = hashGet;
307
- Hash$1.prototype.has = hashHas;
308
- Hash$1.prototype.set = hashSet;
309
- var _Hash = Hash$1;
310
- var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map;
311
- function mapCacheClear$1() {
312
- this.size = 0;
313
- this.__data__ = {
314
- "hash": new Hash(),
315
- "map": new (Map$3 || ListCache$2)(),
316
- "string": new Hash()
317
- };
30
+ throw new Error("Wrong number of arguments");
318
31
  }
319
- var _mapCacheClear = mapCacheClear$1;
320
- function isKeyable$1(value) {
321
- var type = typeof value;
322
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
323
- }
324
- var _isKeyable = isKeyable$1;
325
- var isKeyable = _isKeyable;
326
- function getMapData$4(map, key) {
327
- var data = map.__data__;
328
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
329
- }
330
- var _getMapData = getMapData$4;
331
- var getMapData$3 = _getMapData;
332
- function mapCacheDelete$1(key) {
333
- var result = getMapData$3(this, key)["delete"](key);
334
- this.size -= result ? 1 : 0;
335
- return result;
336
- }
337
- var _mapCacheDelete = mapCacheDelete$1;
338
- var getMapData$2 = _getMapData;
339
- function mapCacheGet$1(key) {
340
- return getMapData$2(this, key).get(key);
341
- }
342
- var _mapCacheGet = mapCacheGet$1;
343
- var getMapData$1 = _getMapData;
344
- function mapCacheHas$1(key) {
345
- return getMapData$1(this, key).has(key);
346
- }
347
- var _mapCacheHas = mapCacheHas$1;
348
- var getMapData = _getMapData;
349
- function mapCacheSet$1(key, value) {
350
- var data = getMapData(this, key), size = data.size;
351
- data.set(key, value);
352
- this.size += data.size == size ? 0 : 1;
353
- return this;
354
- }
355
- var _mapCacheSet = mapCacheSet$1;
356
- var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
357
- function MapCache$3(entries) {
358
- var index = -1, length = entries == null ? 0 : entries.length;
359
- this.clear();
360
- while (++index < length) {
361
- var entry = entries[index];
362
- this.set(entry[0], entry[1]);
363
- }
364
- }
365
- MapCache$3.prototype.clear = mapCacheClear;
366
- MapCache$3.prototype["delete"] = mapCacheDelete;
367
- MapCache$3.prototype.get = mapCacheGet;
368
- MapCache$3.prototype.has = mapCacheHas;
369
- MapCache$3.prototype.set = mapCacheSet;
370
- var _MapCache = MapCache$3;
371
- var ListCache$1 = _ListCache, Map$2 = _Map, MapCache$2 = _MapCache;
372
- var LARGE_ARRAY_SIZE$1 = 200;
373
- function stackSet$1(key, value) {
374
- var data = this.__data__;
375
- if (data instanceof ListCache$1) {
376
- var pairs = data.__data__;
377
- if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
378
- pairs.push([key, value]);
379
- this.size = ++data.size;
380
- return this;
32
+ function _reduceLazy(array, lazy, indexed) {
33
+ return array.reduce(function(acc, item, index) {
34
+ var result = indexed ? lazy(item, index, array) : lazy(item);
35
+ if (result.hasMany === true) {
36
+ acc.push.apply(acc, result.next);
37
+ } else if (result.hasNext === true) {
38
+ acc.push(result.next);
381
39
  }
382
- data = this.__data__ = new MapCache$2(pairs);
383
- }
384
- data.set(key, value);
385
- this.size = data.size;
386
- return this;
387
- }
388
- var _stackSet = stackSet$1;
389
- var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
390
- function Stack$2(entries) {
391
- var data = this.__data__ = new ListCache(entries);
392
- this.size = data.size;
393
- }
394
- Stack$2.prototype.clear = stackClear;
395
- Stack$2.prototype["delete"] = stackDelete;
396
- Stack$2.prototype.get = stackGet;
397
- Stack$2.prototype.has = stackHas;
398
- Stack$2.prototype.set = stackSet;
399
- var _Stack = Stack$2;
400
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
401
- function setCacheAdd$1(value) {
402
- this.__data__.set(value, HASH_UNDEFINED);
403
- return this;
404
- }
405
- var _setCacheAdd = setCacheAdd$1;
406
- function setCacheHas$1(value) {
407
- return this.__data__.has(value);
408
- }
409
- var _setCacheHas = setCacheHas$1;
410
- var MapCache$1 = _MapCache, setCacheAdd = _setCacheAdd, setCacheHas = _setCacheHas;
411
- function SetCache$2(values) {
412
- var index = -1, length = values == null ? 0 : values.length;
413
- this.__data__ = new MapCache$1();
414
- while (++index < length) {
415
- this.add(values[index]);
416
- }
40
+ return acc;
41
+ }, []);
417
42
  }
418
- SetCache$2.prototype.add = SetCache$2.prototype.push = setCacheAdd;
419
- SetCache$2.prototype.has = setCacheHas;
420
- var _SetCache = SetCache$2;
421
- function arraySome$1(array, predicate) {
422
- var index = -1, length = array == null ? 0 : array.length;
423
- while (++index < length) {
424
- if (predicate(array[index], index, array)) {
425
- return true;
426
- }
427
- }
428
- return false;
429
- }
430
- var _arraySome = arraySome$1;
431
- function cacheHas$2(cache, key) {
432
- return cache.has(key);
433
- }
434
- var _cacheHas = cacheHas$2;
435
- var SetCache$1 = _SetCache, arraySome = _arraySome, cacheHas$1 = _cacheHas;
436
- var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
437
- function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
438
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
439
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
440
- return false;
441
- }
442
- var arrStacked = stack.get(array);
443
- var othStacked = stack.get(other);
444
- if (arrStacked && othStacked) {
445
- return arrStacked == other && othStacked == array;
446
- }
447
- var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache$1() : void 0;
448
- stack.set(array, other);
449
- stack.set(other, array);
450
- while (++index < arrLength) {
451
- var arrValue = array[index], othValue = other[index];
452
- if (customizer) {
453
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
454
- }
455
- if (compared !== void 0) {
456
- if (compared) {
457
- continue;
458
- }
459
- result = false;
460
- break;
461
- }
462
- if (seen) {
463
- if (!arraySome(other, function(othValue2, othIndex) {
464
- if (!cacheHas$1(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
465
- return seen.push(othIndex);
466
- }
467
- })) {
468
- result = false;
469
- break;
470
- }
471
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
472
- result = false;
473
- break;
474
- }
475
- }
476
- stack["delete"](array);
477
- stack["delete"](other);
478
- return result;
479
- }
480
- var _equalArrays = equalArrays$2;
481
- var root$4 = _root;
482
- var Uint8Array$1 = root$4.Uint8Array;
483
- var _Uint8Array = Uint8Array$1;
484
- function mapToArray$1(map) {
485
- var index = -1, result = Array(map.size);
486
- map.forEach(function(value, key) {
487
- result[++index] = [key, value];
488
- });
489
- return result;
43
+ var isArray = Array.isArray;
44
+ var keyList = Object.keys;
45
+ var hasProp = Object.prototype.hasOwnProperty;
46
+ function equals() {
47
+ return purry(_equals, arguments);
490
48
  }
491
- var _mapToArray = mapToArray$1;
492
- function setToArray$3(set2) {
493
- var index = -1, result = Array(set2.size);
494
- set2.forEach(function(value) {
495
- result[++index] = value;
496
- });
497
- return result;
498
- }
499
- var _setToArray = setToArray$3;
500
- var Symbol$2 = _Symbol, Uint8Array2 = _Uint8Array, eq$1 = eq_1, equalArrays$1 = _equalArrays, mapToArray = _mapToArray, setToArray$2 = _setToArray;
501
- var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
502
- var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]";
503
- var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]";
504
- var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : void 0;
505
- function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack) {
506
- switch (tag) {
507
- case dataViewTag$2:
508
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
49
+ function _equals(a2, b2) {
50
+ if (a2 === b2) {
51
+ return true;
52
+ }
53
+ if (a2 && b2 && typeof a2 === "object" && typeof b2 === "object") {
54
+ var arrA = isArray(a2);
55
+ var arrB = isArray(b2);
56
+ var i2 = void 0;
57
+ var length = void 0;
58
+ var key = void 0;
59
+ if (arrA && arrB) {
60
+ length = a2.length;
61
+ if (length !== b2.length) {
509
62
  return false;
510
63
  }
511
- object = object.buffer;
512
- other = other.buffer;
513
- case arrayBufferTag$1:
514
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
515
- return false;
64
+ for (i2 = length; i2-- !== 0; ) {
65
+ if (!equals(a2[i2], b2[i2])) {
66
+ return false;
67
+ }
516
68
  }
517
69
  return true;
518
- case boolTag$1:
519
- case dateTag$1:
520
- case numberTag$1:
521
- return eq$1(+object, +other);
522
- case errorTag$1:
523
- return object.name == other.name && object.message == other.message;
524
- case regexpTag$1:
525
- case stringTag$1:
526
- return object == other + "";
527
- case mapTag$2:
528
- var convert = mapToArray;
529
- case setTag$2:
530
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
531
- convert || (convert = setToArray$2);
532
- if (object.size != other.size && !isPartial) {
533
- return false;
534
- }
535
- var stacked = stack.get(object);
536
- if (stacked) {
537
- return stacked == other;
538
- }
539
- bitmask |= COMPARE_UNORDERED_FLAG$2;
540
- stack.set(object, other);
541
- var result = equalArrays$1(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
542
- stack["delete"](object);
543
- return result;
544
- case symbolTag$1:
545
- if (symbolValueOf) {
546
- return symbolValueOf.call(object) == symbolValueOf.call(other);
547
- }
548
- }
549
- return false;
550
- }
551
- var _equalByTag = equalByTag$1;
552
- function arrayPush$2(array, values) {
553
- var index = -1, length = values.length, offset = array.length;
554
- while (++index < length) {
555
- array[offset + index] = values[index];
556
- }
557
- return array;
558
- }
559
- var _arrayPush = arrayPush$2;
560
- var isArray$8 = Array.isArray;
561
- var isArray_1 = isArray$8;
562
- var arrayPush$1 = _arrayPush, isArray$7 = isArray_1;
563
- function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
564
- var result = keysFunc(object);
565
- return isArray$7(object) ? result : arrayPush$1(result, symbolsFunc(object));
566
- }
567
- var _baseGetAllKeys = baseGetAllKeys$2;
568
- function arrayFilter$1(array, predicate) {
569
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
570
- while (++index < length) {
571
- var value = array[index];
572
- if (predicate(value, index, array)) {
573
- result[resIndex++] = value;
574
70
  }
575
- }
576
- return result;
577
- }
578
- var _arrayFilter = arrayFilter$1;
579
- function stubArray$2() {
580
- return [];
581
- }
582
- var stubArray_1 = stubArray$2;
583
- var arrayFilter = _arrayFilter, stubArray$1 = stubArray_1;
584
- var objectProto$8 = Object.prototype;
585
- var propertyIsEnumerable$1 = objectProto$8.propertyIsEnumerable;
586
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
587
- var getSymbols$2 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
588
- if (object == null) {
589
- return [];
590
- }
591
- object = Object(object);
592
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
593
- return propertyIsEnumerable$1.call(object, symbol);
594
- });
595
- };
596
- var _getSymbols = getSymbols$2;
597
- function baseTimes$1(n2, iteratee) {
598
- var index = -1, result = Array(n2);
599
- while (++index < n2) {
600
- result[index] = iteratee(index);
601
- }
602
- return result;
603
- }
604
- var _baseTimes = baseTimes$1;
605
- function isObjectLike$5(value) {
606
- return value != null && typeof value == "object";
607
- }
608
- var isObjectLike_1 = isObjectLike$5;
609
- var baseGetTag$3 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
610
- var argsTag$2 = "[object Arguments]";
611
- function baseIsArguments$1(value) {
612
- return isObjectLike$4(value) && baseGetTag$3(value) == argsTag$2;
613
- }
614
- var _baseIsArguments = baseIsArguments$1;
615
- var baseIsArguments = _baseIsArguments, isObjectLike$3 = isObjectLike_1;
616
- var objectProto$7 = Object.prototype;
617
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
618
- var propertyIsEnumerable = objectProto$7.propertyIsEnumerable;
619
- var isArguments$2 = baseIsArguments(function() {
620
- return arguments;
621
- }()) ? baseIsArguments : function(value) {
622
- return isObjectLike$3(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
623
- };
624
- var isArguments_1 = isArguments$2;
625
- var isBuffer$2 = { exports: {} };
626
- function stubFalse() {
627
- return false;
628
- }
629
- var stubFalse_1 = stubFalse;
630
- (function(module, exports) {
631
- var root2 = _root, stubFalse2 = stubFalse_1;
632
- var freeExports = exports && !exports.nodeType && exports;
633
- var freeModule = freeExports && true && module && !module.nodeType && module;
634
- var moduleExports = freeModule && freeModule.exports === freeExports;
635
- var Buffer2 = moduleExports ? root2.Buffer : void 0;
636
- var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
637
- var isBuffer2 = nativeIsBuffer || stubFalse2;
638
- module.exports = isBuffer2;
639
- })(isBuffer$2, isBuffer$2.exports);
640
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
641
- var reIsUint = /^(?:0|[1-9]\d*)$/;
642
- function isIndex$3(value, length) {
643
- var type = typeof value;
644
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
645
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
646
- }
647
- var _isIndex = isIndex$3;
648
- var MAX_SAFE_INTEGER = 9007199254740991;
649
- function isLength$3(value) {
650
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
651
- }
652
- var isLength_1 = isLength$3;
653
- var baseGetTag$2 = _baseGetTag, isLength$2 = isLength_1, isObjectLike$2 = isObjectLike_1;
654
- var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", mapTag$1 = "[object Map]", numberTag = "[object Number]", objectTag$2 = "[object Object]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", weakMapTag$1 = "[object WeakMap]";
655
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
656
- var typedArrayTags = {};
657
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
658
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag$1] = typedArrayTags[numberTag] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] = typedArrayTags[setTag$1] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false;
659
- function baseIsTypedArray$1(value) {
660
- return isObjectLike$2(value) && isLength$2(value.length) && !!typedArrayTags[baseGetTag$2(value)];
661
- }
662
- var _baseIsTypedArray = baseIsTypedArray$1;
663
- function baseUnary$1(func) {
664
- return function(value) {
665
- return func(value);
666
- };
667
- }
668
- var _baseUnary = baseUnary$1;
669
- var _nodeUtil = { exports: {} };
670
- (function(module, exports) {
671
- var freeGlobal2 = _freeGlobal;
672
- var freeExports = exports && !exports.nodeType && exports;
673
- var freeModule = freeExports && true && module && !module.nodeType && module;
674
- var moduleExports = freeModule && freeModule.exports === freeExports;
675
- var freeProcess = moduleExports && freeGlobal2.process;
676
- var nodeUtil2 = function() {
677
- try {
678
- var types = freeModule && freeModule.require && freeModule.require("util").types;
679
- if (types) {
680
- return types;
681
- }
682
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
683
- } catch (e2) {
684
- }
685
- }();
686
- module.exports = nodeUtil2;
687
- })(_nodeUtil, _nodeUtil.exports);
688
- var baseIsTypedArray = _baseIsTypedArray, baseUnary = _baseUnary, nodeUtil = _nodeUtil.exports;
689
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
690
- var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
691
- var isTypedArray_1 = isTypedArray$2;
692
- var baseTimes = _baseTimes, isArguments$1 = isArguments_1, isArray$6 = isArray_1, isBuffer$1 = isBuffer$2.exports, isIndex$2 = _isIndex, isTypedArray$1 = isTypedArray_1;
693
- var objectProto$6 = Object.prototype;
694
- var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
695
- function arrayLikeKeys$2(value, inherited) {
696
- var isArr = isArray$6(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
697
- for (var key in value) {
698
- if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex$2(key, length)))) {
699
- result.push(key);
700
- }
701
- }
702
- return result;
703
- }
704
- var _arrayLikeKeys = arrayLikeKeys$2;
705
- var objectProto$5 = Object.prototype;
706
- function isPrototype$2(value) {
707
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$5;
708
- return value === proto;
709
- }
710
- var _isPrototype = isPrototype$2;
711
- function overArg$2(func, transform) {
712
- return function(arg) {
713
- return func(transform(arg));
714
- };
715
- }
716
- var _overArg = overArg$2;
717
- var overArg$1 = _overArg;
718
- var nativeKeys$1 = overArg$1(Object.keys, Object);
719
- var _nativeKeys = nativeKeys$1;
720
- var isPrototype$1 = _isPrototype, nativeKeys = _nativeKeys;
721
- var objectProto$4 = Object.prototype;
722
- var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
723
- function baseKeys$1(object) {
724
- if (!isPrototype$1(object)) {
725
- return nativeKeys(object);
726
- }
727
- var result = [];
728
- for (var key in Object(object)) {
729
- if (hasOwnProperty$4.call(object, key) && key != "constructor") {
730
- result.push(key);
731
- }
732
- }
733
- return result;
734
- }
735
- var _baseKeys = baseKeys$1;
736
- var isFunction = isFunction_1, isLength$1 = isLength_1;
737
- function isArrayLike$2(value) {
738
- return value != null && isLength$1(value.length) && !isFunction(value);
739
- }
740
- var isArrayLike_1 = isArrayLike$2;
741
- var arrayLikeKeys$1 = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike$1 = isArrayLike_1;
742
- function keys$2(object) {
743
- return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
744
- }
745
- var keys_1 = keys$2;
746
- var baseGetAllKeys$1 = _baseGetAllKeys, getSymbols$1 = _getSymbols, keys$1 = keys_1;
747
- function getAllKeys$1(object) {
748
- return baseGetAllKeys$1(object, keys$1, getSymbols$1);
749
- }
750
- var _getAllKeys = getAllKeys$1;
751
- var getAllKeys = _getAllKeys;
752
- var COMPARE_PARTIAL_FLAG$3 = 1;
753
- var objectProto$3 = Object.prototype;
754
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
755
- function equalObjects$1(object, other, bitmask, customizer, equalFunc, stack) {
756
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
757
- if (objLength != othLength && !isPartial) {
758
- return false;
759
- }
760
- var index = objLength;
761
- while (index--) {
762
- var key = objProps[index];
763
- if (!(isPartial ? key in other : hasOwnProperty$3.call(other, key))) {
71
+ if (arrA !== arrB) {
764
72
  return false;
765
73
  }
766
- }
767
- var objStacked = stack.get(object);
768
- var othStacked = stack.get(other);
769
- if (objStacked && othStacked) {
770
- return objStacked == other && othStacked == object;
771
- }
772
- var result = true;
773
- stack.set(object, other);
774
- stack.set(other, object);
775
- var skipCtor = isPartial;
776
- while (++index < objLength) {
777
- key = objProps[index];
778
- var objValue = object[key], othValue = other[key];
779
- if (customizer) {
780
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
781
- }
782
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
783
- result = false;
784
- break;
785
- }
786
- skipCtor || (skipCtor = key == "constructor");
787
- }
788
- if (result && !skipCtor) {
789
- var objCtor = object.constructor, othCtor = other.constructor;
790
- if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
791
- result = false;
74
+ var dateA = a2 instanceof Date;
75
+ var dateB = b2 instanceof Date;
76
+ if (dateA !== dateB) {
77
+ return false;
792
78
  }
793
- }
794
- stack["delete"](object);
795
- stack["delete"](other);
796
- return result;
797
- }
798
- var _equalObjects = equalObjects$1;
799
- var getNative$4 = _getNative, root$3 = _root;
800
- var DataView$1 = getNative$4(root$3, "DataView");
801
- var _DataView = DataView$1;
802
- var getNative$3 = _getNative, root$2 = _root;
803
- var Promise$2 = getNative$3(root$2, "Promise");
804
- var _Promise = Promise$2;
805
- var getNative$2 = _getNative, root$1 = _root;
806
- var Set$3 = getNative$2(root$1, "Set");
807
- var _Set = Set$3;
808
- var getNative$1 = _getNative, root = _root;
809
- var WeakMap$1 = getNative$1(root, "WeakMap");
810
- var _WeakMap = WeakMap$1;
811
- var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$2 = _Set, WeakMap = _WeakMap, baseGetTag$1 = _baseGetTag, toSource = _toSource;
812
- var mapTag = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
813
- var dataViewTag = "[object DataView]";
814
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap);
815
- var getTag$1 = baseGetTag$1;
816
- if (DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag$1(new Map$1()) != mapTag || Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag || Set$2 && getTag$1(new Set$2()) != setTag || WeakMap && getTag$1(new WeakMap()) != weakMapTag) {
817
- getTag$1 = function(value) {
818
- var result = baseGetTag$1(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
819
- if (ctorString) {
820
- switch (ctorString) {
821
- case dataViewCtorString:
822
- return dataViewTag;
823
- case mapCtorString:
824
- return mapTag;
825
- case promiseCtorString:
826
- return promiseTag;
827
- case setCtorString:
828
- return setTag;
829
- case weakMapCtorString:
830
- return weakMapTag;
831
- }
79
+ if (dateA && dateB) {
80
+ return a2.getTime() === b2.getTime();
832
81
  }
833
- return result;
834
- };
835
- }
836
- var _getTag = getTag$1;
837
- var Stack$1 = _Stack, equalArrays = _equalArrays, equalByTag = _equalByTag, equalObjects = _equalObjects, getTag = _getTag, isArray$5 = isArray_1, isBuffer = isBuffer$2.exports, isTypedArray = isTypedArray_1;
838
- var COMPARE_PARTIAL_FLAG$2 = 1;
839
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
840
- var objectProto$2 = Object.prototype;
841
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
842
- function baseIsEqualDeep$1(object, other, bitmask, customizer, equalFunc, stack) {
843
- var objIsArr = isArray$5(object), othIsArr = isArray$5(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
844
- objTag = objTag == argsTag ? objectTag : objTag;
845
- othTag = othTag == argsTag ? objectTag : othTag;
846
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
847
- if (isSameTag && isBuffer(object)) {
848
- if (!isBuffer(other)) {
82
+ var regexpA = a2 instanceof RegExp;
83
+ var regexpB = b2 instanceof RegExp;
84
+ if (regexpA !== regexpB) {
849
85
  return false;
850
86
  }
851
- objIsArr = true;
852
- objIsObj = false;
853
- }
854
- if (isSameTag && !objIsObj) {
855
- stack || (stack = new Stack$1());
856
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
857
- }
858
- if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
859
- var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$2.call(other, "__wrapped__");
860
- if (objIsWrapped || othIsWrapped) {
861
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
862
- stack || (stack = new Stack$1());
863
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
87
+ if (regexpA && regexpB) {
88
+ return a2.toString() === b2.toString();
864
89
  }
865
- }
866
- if (!isSameTag) {
867
- return false;
868
- }
869
- stack || (stack = new Stack$1());
870
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
871
- }
872
- var _baseIsEqualDeep = baseIsEqualDeep$1;
873
- var baseIsEqualDeep = _baseIsEqualDeep, isObjectLike$1 = isObjectLike_1;
874
- function baseIsEqual$3(value, other, bitmask, customizer, stack) {
875
- if (value === other) {
876
- return true;
877
- }
878
- if (value == null || other == null || !isObjectLike$1(value) && !isObjectLike$1(other)) {
879
- return value !== value && other !== other;
880
- }
881
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$3, stack);
882
- }
883
- var _baseIsEqual = baseIsEqual$3;
884
- var Stack = _Stack, baseIsEqual$2 = _baseIsEqual;
885
- var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
886
- function baseIsMatch$1(object, source, matchData, customizer) {
887
- var index = matchData.length, length = index, noCustomizer = !customizer;
888
- if (object == null) {
889
- return !length;
890
- }
891
- object = Object(object);
892
- while (index--) {
893
- var data = matchData[index];
894
- if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
90
+ var keys = keyList(a2);
91
+ length = keys.length;
92
+ if (length !== keyList(b2).length) {
895
93
  return false;
896
94
  }
897
- }
898
- while (++index < length) {
899
- data = matchData[index];
900
- var key = data[0], objValue = object[key], srcValue = data[1];
901
- if (noCustomizer && data[2]) {
902
- if (objValue === void 0 && !(key in object)) {
95
+ for (i2 = length; i2-- !== 0; ) {
96
+ if (!hasProp.call(b2, keys[i2])) {
903
97
  return false;
904
98
  }
905
- } else {
906
- var stack = new Stack();
907
- if (customizer) {
908
- var result = customizer(objValue, srcValue, key, object, source, stack);
909
- }
910
- if (!(result === void 0 ? baseIsEqual$2(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
99
+ }
100
+ for (i2 = length; i2-- !== 0; ) {
101
+ key = keys[i2];
102
+ if (!equals(a2[key], b2[key])) {
911
103
  return false;
912
104
  }
913
105
  }
106
+ return true;
914
107
  }
915
- return true;
916
- }
917
- var _baseIsMatch = baseIsMatch$1;
918
- var isObject$2 = isObject_1;
919
- function isStrictComparable$2(value) {
920
- return value === value && !isObject$2(value);
921
- }
922
- var _isStrictComparable = isStrictComparable$2;
923
- var isStrictComparable$1 = _isStrictComparable, keys = keys_1;
924
- function getMatchData$1(object) {
925
- var result = keys(object), length = result.length;
926
- while (length--) {
927
- var key = result[length], value = object[key];
928
- result[length] = [key, value, isStrictComparable$1(value)];
929
- }
930
- return result;
108
+ return a2 !== a2 && b2 !== b2;
931
109
  }
932
- var _getMatchData = getMatchData$1;
933
- function matchesStrictComparable$2(key, srcValue) {
934
- return function(object) {
935
- if (object == null) {
936
- return false;
110
+ function omit() {
111
+ return purry(_omit, arguments);
112
+ }
113
+ function _omit(object, names) {
114
+ var set2 = new Set(names);
115
+ return Object.entries(object).reduce(function(acc, _a) {
116
+ var name = _a[0], value = _a[1];
117
+ if (!set2.has(name)) {
118
+ acc[name] = value;
937
119
  }
938
- return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
939
- };
120
+ return acc;
121
+ }, {});
940
122
  }
941
- var _matchesStrictComparable = matchesStrictComparable$2;
942
- var baseIsMatch = _baseIsMatch, getMatchData = _getMatchData, matchesStrictComparable$1 = _matchesStrictComparable;
943
- function baseMatches$1(source) {
944
- var matchData = getMatchData(source);
945
- if (matchData.length == 1 && matchData[0][2]) {
946
- return matchesStrictComparable$1(matchData[0][0], matchData[0][1]);
947
- }
948
- return function(object) {
949
- return object === source || baseIsMatch(object, source, matchData);
950
- };
123
+ function omitBy() {
124
+ return purry(_omitBy, arguments);
951
125
  }
952
- var _baseMatches = baseMatches$1;
953
- var baseGetTag = _baseGetTag, isObjectLike = isObjectLike_1;
954
- var symbolTag = "[object Symbol]";
955
- function isSymbol$3(value) {
956
- return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
957
- }
958
- var isSymbol_1 = isSymbol$3;
959
- var isArray$4 = isArray_1, isSymbol$2 = isSymbol_1;
960
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
961
- function isKey$3(value, object) {
962
- if (isArray$4(value)) {
963
- return false;
964
- }
965
- var type = typeof value;
966
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) {
967
- return true;
968
- }
969
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
970
- }
971
- var _isKey = isKey$3;
972
- var MapCache = _MapCache;
973
- var FUNC_ERROR_TEXT$1 = "Expected a function";
974
- function memoize$1(func, resolver) {
975
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
976
- throw new TypeError(FUNC_ERROR_TEXT$1);
977
- }
978
- var memoized = function() {
979
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
980
- if (cache.has(key)) {
981
- return cache.get(key);
982
- }
983
- var result = func.apply(this, args);
984
- memoized.cache = cache.set(key, result) || cache;
985
- return result;
986
- };
987
- memoized.cache = new (memoize$1.Cache || MapCache)();
988
- return memoized;
989
- }
990
- memoize$1.Cache = MapCache;
991
- var memoize_1 = memoize$1;
992
- var memoize = memoize_1;
993
- var MAX_MEMOIZE_SIZE = 500;
994
- function memoizeCapped$1(func) {
995
- var result = memoize(func, function(key) {
996
- if (cache.size === MAX_MEMOIZE_SIZE) {
997
- cache.clear();
126
+ function _omitBy(object, fn2) {
127
+ return Object.keys(object).reduce(function(acc, key) {
128
+ if (!fn2(object[key], key)) {
129
+ acc[key] = object[key];
998
130
  }
999
- return key;
1000
- });
1001
- var cache = result.cache;
1002
- return result;
1003
- }
1004
- var _memoizeCapped = memoizeCapped$1;
1005
- var memoizeCapped = _memoizeCapped;
1006
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1007
- var reEscapeChar = /\\(\\)?/g;
1008
- var stringToPath$1 = memoizeCapped(function(string) {
1009
- var result = [];
1010
- if (string.charCodeAt(0) === 46) {
1011
- result.push("");
1012
- }
1013
- string.replace(rePropName, function(match, number, quote, subString) {
1014
- result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
1015
- });
1016
- return result;
1017
- });
1018
- var _stringToPath = stringToPath$1;
1019
- function arrayMap$2(array, iteratee) {
1020
- var index = -1, length = array == null ? 0 : array.length, result = Array(length);
1021
- while (++index < length) {
1022
- result[index] = iteratee(array[index], index, array);
1023
- }
1024
- return result;
1025
- }
1026
- var _arrayMap = arrayMap$2;
1027
- var Symbol$1 = _Symbol, arrayMap$1 = _arrayMap, isArray$3 = isArray_1, isSymbol$1 = isSymbol_1;
1028
- var INFINITY$2 = 1 / 0;
1029
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
1030
- function baseToString$1(value) {
1031
- if (typeof value == "string") {
1032
- return value;
1033
- }
1034
- if (isArray$3(value)) {
1035
- return arrayMap$1(value, baseToString$1) + "";
1036
- }
1037
- if (isSymbol$1(value)) {
1038
- return symbolToString ? symbolToString.call(value) : "";
1039
- }
1040
- var result = value + "";
1041
- return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
1042
- }
1043
- var _baseToString = baseToString$1;
1044
- var baseToString = _baseToString;
1045
- function toString$1(value) {
1046
- return value == null ? "" : baseToString(value);
1047
- }
1048
- var toString_1 = toString$1;
1049
- var isArray$2 = isArray_1, isKey$2 = _isKey, stringToPath = _stringToPath, toString = toString_1;
1050
- function castPath$4(value, object) {
1051
- if (isArray$2(value)) {
1052
- return value;
1053
- }
1054
- return isKey$2(value, object) ? [value] : stringToPath(toString(value));
1055
- }
1056
- var _castPath = castPath$4;
1057
- var isSymbol = isSymbol_1;
1058
- var INFINITY$1 = 1 / 0;
1059
- function toKey$5(value) {
1060
- if (typeof value == "string" || isSymbol(value)) {
1061
- return value;
1062
- }
1063
- var result = value + "";
1064
- return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
1065
- }
1066
- var _toKey = toKey$5;
1067
- var castPath$3 = _castPath, toKey$4 = _toKey;
1068
- function baseGet$3(object, path) {
1069
- path = castPath$3(path, object);
1070
- var index = 0, length = path.length;
1071
- while (object != null && index < length) {
1072
- object = object[toKey$4(path[index++])];
1073
- }
1074
- return index && index == length ? object : void 0;
1075
- }
1076
- var _baseGet = baseGet$3;
1077
- var baseGet$2 = _baseGet;
1078
- function get$1(object, path, defaultValue) {
1079
- var result = object == null ? void 0 : baseGet$2(object, path);
1080
- return result === void 0 ? defaultValue : result;
1081
- }
1082
- var get_1 = get$1;
1083
- function baseHasIn$1(object, key) {
1084
- return object != null && key in Object(object);
1085
- }
1086
- var _baseHasIn = baseHasIn$1;
1087
- var castPath$2 = _castPath, isArguments = isArguments_1, isArray$1 = isArray_1, isIndex$1 = _isIndex, isLength = isLength_1, toKey$3 = _toKey;
1088
- function hasPath$1(object, path, hasFunc) {
1089
- path = castPath$2(path, object);
1090
- var index = -1, length = path.length, result = false;
1091
- while (++index < length) {
1092
- var key = toKey$3(path[index]);
1093
- if (!(result = object != null && hasFunc(object, key))) {
1094
- break;
131
+ return acc;
132
+ }, {});
133
+ }
134
+ function pathOr() {
135
+ return purry(_pathOr, arguments);
136
+ }
137
+ function _pathOr(object, path, defaultValue) {
138
+ var current = object;
139
+ for (var _i = 0, path_1 = path; _i < path_1.length; _i++) {
140
+ var prop = path_1[_i];
141
+ if (current == null || current[prop] == null) {
142
+ return defaultValue;
1095
143
  }
1096
- object = object[key];
1097
- }
1098
- if (result || ++index != length) {
1099
- return result;
1100
- }
1101
- length = object == null ? 0 : object.length;
1102
- return !!length && isLength(length) && isIndex$1(key, length) && (isArray$1(object) || isArguments(object));
1103
- }
1104
- var _hasPath = hasPath$1;
1105
- var baseHasIn = _baseHasIn, hasPath = _hasPath;
1106
- function hasIn$1(object, path) {
1107
- return object != null && hasPath(object, path, baseHasIn);
1108
- }
1109
- var hasIn_1 = hasIn$1;
1110
- var baseIsEqual$1 = _baseIsEqual, get = get_1, hasIn = hasIn_1, isKey$1 = _isKey, isStrictComparable = _isStrictComparable, matchesStrictComparable = _matchesStrictComparable, toKey$2 = _toKey;
1111
- var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
1112
- function baseMatchesProperty$1(path, srcValue) {
1113
- if (isKey$1(path) && isStrictComparable(srcValue)) {
1114
- return matchesStrictComparable(toKey$2(path), srcValue);
1115
- }
1116
- return function(object) {
1117
- var objValue = get(object, path);
1118
- return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1119
- };
1120
- }
1121
- var _baseMatchesProperty = baseMatchesProperty$1;
1122
- function identity$1(value) {
1123
- return value;
1124
- }
1125
- var identity_1 = identity$1;
1126
- function baseProperty$1(key) {
1127
- return function(object) {
1128
- return object == null ? void 0 : object[key];
1129
- };
1130
- }
1131
- var _baseProperty = baseProperty$1;
1132
- var baseGet$1 = _baseGet;
1133
- function basePropertyDeep$1(path) {
1134
- return function(object) {
1135
- return baseGet$1(object, path);
1136
- };
1137
- }
1138
- var _basePropertyDeep = basePropertyDeep$1;
1139
- var baseProperty = _baseProperty, basePropertyDeep = _basePropertyDeep, isKey = _isKey, toKey$1 = _toKey;
1140
- function property$1(path) {
1141
- return isKey(path) ? baseProperty(toKey$1(path)) : basePropertyDeep(path);
1142
- }
1143
- var property_1 = property$1;
1144
- var baseMatches = _baseMatches, baseMatchesProperty = _baseMatchesProperty, identity = identity_1, isArray = isArray_1, property = property_1;
1145
- function baseIteratee$2(value) {
1146
- if (typeof value == "function") {
1147
- return value;
1148
- }
1149
- if (value == null) {
1150
- return identity;
1151
- }
1152
- if (typeof value == "object") {
1153
- return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
144
+ current = current[prop];
1154
145
  }
1155
- return property(value);
146
+ return current;
1156
147
  }
1157
- var _baseIteratee = baseIteratee$2;
1158
- var FUNC_ERROR_TEXT = "Expected a function";
1159
- function negate$1(predicate) {
1160
- if (typeof predicate != "function") {
1161
- throw new TypeError(FUNC_ERROR_TEXT);
1162
- }
1163
- return function() {
1164
- var args = arguments;
1165
- switch (args.length) {
1166
- case 0:
1167
- return !predicate.call(this);
1168
- case 1:
1169
- return !predicate.call(this, args[0]);
1170
- case 2:
1171
- return !predicate.call(this, args[0], args[1]);
1172
- case 3:
1173
- return !predicate.call(this, args[0], args[1], args[2]);
148
+ var __assign = globalThis && globalThis.__assign || function() {
149
+ __assign = Object.assign || function(t2) {
150
+ for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
151
+ s2 = arguments[i2];
152
+ for (var p2 in s2)
153
+ if (Object.prototype.hasOwnProperty.call(s2, p2))
154
+ t2[p2] = s2[p2];
1174
155
  }
1175
- return !predicate.apply(this, args);
156
+ return t2;
1176
157
  };
158
+ return __assign.apply(this, arguments);
159
+ };
160
+ function set() {
161
+ return purry(_set, arguments);
1177
162
  }
1178
- var negate_1 = negate$1;
1179
- var getNative = _getNative;
1180
- var defineProperty$1 = function() {
1181
- try {
1182
- var func = getNative(Object, "defineProperty");
1183
- func({}, "", {});
1184
- return func;
1185
- } catch (e2) {
1186
- }
1187
- }();
1188
- var _defineProperty = defineProperty$1;
1189
- var defineProperty = _defineProperty;
1190
- function baseAssignValue$1(object, key, value) {
1191
- if (key == "__proto__" && defineProperty) {
1192
- defineProperty(object, key, {
1193
- "configurable": true,
1194
- "enumerable": true,
1195
- "value": value,
1196
- "writable": true
1197
- });
1198
- } else {
1199
- object[key] = value;
1200
- }
163
+ function _set(obj, prop, value) {
164
+ var _a;
165
+ return __assign(__assign({}, obj), (_a = {}, _a[prop] = value, _a));
1201
166
  }
1202
- var _baseAssignValue = baseAssignValue$1;
1203
- var baseAssignValue = _baseAssignValue, eq = eq_1;
1204
- var objectProto$1 = Object.prototype;
1205
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1206
- function assignValue$1(object, key, value) {
1207
- var objValue = object[key];
1208
- if (!(hasOwnProperty$1.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
1209
- baseAssignValue(object, key, value);
1210
- }
167
+ function uniq() {
168
+ return purry(_uniq, arguments, uniq.lazy);
1211
169
  }
1212
- var _assignValue = assignValue$1;
1213
- var assignValue = _assignValue, castPath$1 = _castPath, isIndex = _isIndex, isObject$1 = isObject_1, toKey = _toKey;
1214
- function baseSet$2(object, path, value, customizer) {
1215
- if (!isObject$1(object)) {
1216
- return object;
1217
- }
1218
- path = castPath$1(path, object);
1219
- var index = -1, length = path.length, lastIndex = length - 1, nested = object;
1220
- while (nested != null && ++index < length) {
1221
- var key = toKey(path[index]), newValue = value;
1222
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
1223
- return object;
1224
- }
1225
- if (index != lastIndex) {
1226
- var objValue = nested[key];
1227
- newValue = customizer ? customizer(objValue, key, nested) : void 0;
1228
- if (newValue === void 0) {
1229
- newValue = isObject$1(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
1230
- }
1231
- }
1232
- assignValue(nested, key, newValue);
1233
- nested = nested[key];
1234
- }
1235
- return object;
170
+ function _uniq(array) {
171
+ return _reduceLazy(array, uniq.lazy());
1236
172
  }
1237
- var _baseSet = baseSet$2;
1238
- var baseGet = _baseGet, baseSet$1 = _baseSet, castPath = _castPath;
1239
- function basePickBy$1(object, paths, predicate) {
1240
- var index = -1, length = paths.length, result = {};
1241
- while (++index < length) {
1242
- var path = paths[index], value = baseGet(object, path);
1243
- if (predicate(value, path)) {
1244
- baseSet$1(result, castPath(path, object), value);
1245
- }
1246
- }
1247
- return result;
1248
- }
1249
- var _basePickBy = basePickBy$1;
1250
- var overArg = _overArg;
1251
- var getPrototype$1 = overArg(Object.getPrototypeOf, Object);
1252
- var _getPrototype = getPrototype$1;
1253
- var arrayPush = _arrayPush, getPrototype = _getPrototype, getSymbols = _getSymbols, stubArray = stubArray_1;
1254
- var nativeGetSymbols = Object.getOwnPropertySymbols;
1255
- var getSymbolsIn$1 = !nativeGetSymbols ? stubArray : function(object) {
1256
- var result = [];
1257
- while (object) {
1258
- arrayPush(result, getSymbols(object));
1259
- object = getPrototype(object);
1260
- }
1261
- return result;
1262
- };
1263
- var _getSymbolsIn = getSymbolsIn$1;
1264
- function nativeKeysIn$1(object) {
1265
- var result = [];
1266
- if (object != null) {
1267
- for (var key in Object(object)) {
1268
- result.push(key);
1269
- }
1270
- }
1271
- return result;
1272
- }
1273
- var _nativeKeysIn = nativeKeysIn$1;
1274
- var isObject = isObject_1, isPrototype = _isPrototype, nativeKeysIn = _nativeKeysIn;
1275
- var objectProto = Object.prototype;
1276
- var hasOwnProperty = objectProto.hasOwnProperty;
1277
- function baseKeysIn$1(object) {
1278
- if (!isObject(object)) {
1279
- return nativeKeysIn(object);
1280
- }
1281
- var isProto = isPrototype(object), result = [];
1282
- for (var key in object) {
1283
- if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
1284
- result.push(key);
1285
- }
1286
- }
1287
- return result;
1288
- }
1289
- var _baseKeysIn = baseKeysIn$1;
1290
- var arrayLikeKeys = _arrayLikeKeys, baseKeysIn = _baseKeysIn, isArrayLike = isArrayLike_1;
1291
- function keysIn$1(object) {
1292
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
1293
- }
1294
- var keysIn_1 = keysIn$1;
1295
- var baseGetAllKeys = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn = keysIn_1;
1296
- function getAllKeysIn$1(object) {
1297
- return baseGetAllKeys(object, keysIn, getSymbolsIn);
1298
- }
1299
- var _getAllKeysIn = getAllKeysIn$1;
1300
- var arrayMap = _arrayMap, baseIteratee$1 = _baseIteratee, basePickBy = _basePickBy, getAllKeysIn = _getAllKeysIn;
1301
- function pickBy$1(object, predicate) {
1302
- if (object == null) {
1303
- return {};
173
+ (function(uniq2) {
174
+ function lazy() {
175
+ var set2 = /* @__PURE__ */ new Set();
176
+ return function(value) {
177
+ if (set2.has(value)) {
178
+ return {
179
+ done: false,
180
+ hasNext: false
181
+ };
182
+ }
183
+ set2.add(value);
184
+ return {
185
+ done: false,
186
+ hasNext: true,
187
+ next: value
188
+ };
189
+ };
1304
190
  }
1305
- var props = arrayMap(getAllKeysIn(object), function(prop) {
1306
- return [prop];
1307
- });
1308
- predicate = baseIteratee$1(predicate);
1309
- return basePickBy(object, props, function(value, path) {
1310
- return predicate(value, path[0]);
1311
- });
1312
- }
1313
- var pickBy_1 = pickBy$1;
1314
- var baseIteratee = _baseIteratee, negate = negate_1, pickBy = pickBy_1;
1315
- function omitBy(object, predicate) {
1316
- return pickBy(object, negate(baseIteratee(predicate)));
1317
- }
1318
- var omitBy_1 = omitBy;
191
+ uniq2.lazy = lazy;
192
+ })(uniq || (uniq = {}));
1319
193
  const getCheckboxChecked = (checkboxValue = "on", newValue) => {
1320
194
  if (Array.isArray(newValue))
1321
195
  return newValue.some((val) => val === true || val === checkboxValue);
@@ -1345,10 +219,14 @@ const createGetInputProps = ({
1345
219
  validationBehavior,
1346
220
  name
1347
221
  }) => {
1348
- const validationBehaviors = __spreadValues(__spreadValues({}, defaultValidationBehavior), validationBehavior);
222
+ const validationBehaviors = {
223
+ ...defaultValidationBehavior,
224
+ ...validationBehavior
225
+ };
1349
226
  return (props = {}) => {
1350
227
  const behavior = hasBeenSubmitted ? validationBehaviors.whenSubmitted : touched ? validationBehaviors.whenTouched : validationBehaviors.initial;
1351
- const inputProps = __spreadProps(__spreadValues({}, props), {
228
+ const inputProps = {
229
+ ...props,
1352
230
  onChange: (...args) => {
1353
231
  var _a;
1354
232
  if (behavior === "onChange")
@@ -1365,7 +243,7 @@ const createGetInputProps = ({
1365
243
  return (_a = props == null ? void 0 : props.onBlur) == null ? void 0 : _a.call(props, ...args);
1366
244
  },
1367
245
  name
1368
- });
246
+ };
1369
247
  if (props.type === "checkbox") {
1370
248
  inputProps.defaultChecked = getCheckboxChecked(props.value, defaultValue);
1371
249
  } else if (props.type === "radio") {
@@ -1373,9 +251,39 @@ const createGetInputProps = ({
1373
251
  } else if (props.value === void 0) {
1374
252
  inputProps.defaultValue = defaultValue;
1375
253
  }
1376
- return omitBy_1(inputProps, (value) => value === void 0);
254
+ return omitBy(inputProps, (value) => value === void 0);
1377
255
  };
1378
256
  };
257
+ const stringToPathArray = (path) => {
258
+ if (path.length === 0)
259
+ return [];
260
+ const match = path.match(/^\[(.+?)\](.*)$/) || path.match(/^\.?([^\.\[\]]+)(.*)$/);
261
+ if (match) {
262
+ const [_2, key, rest] = match;
263
+ return [/^\d+$/.test(key) ? Number(key) : key, ...stringToPathArray(rest)];
264
+ }
265
+ return [path];
266
+ };
267
+ function setPath(object, path, defaultValue) {
268
+ return _setPathNormalized(object, stringToPathArray(path), defaultValue);
269
+ }
270
+ function _setPathNormalized(object, path, value) {
271
+ var _a;
272
+ const leadingSegments = path.slice(0, -1);
273
+ const lastSegment = path[path.length - 1];
274
+ let obj = object;
275
+ for (let i2 = 0; i2 < leadingSegments.length; i2++) {
276
+ const segment = leadingSegments[i2];
277
+ if (obj[segment] === void 0) {
278
+ const nextSegment = (_a = leadingSegments[i2 + 1]) != null ? _a : lastSegment;
279
+ obj[segment] = typeof nextSegment === "number" ? [] : {};
280
+ }
281
+ obj = obj[segment];
282
+ }
283
+ obj[lastSegment] = value;
284
+ return object;
285
+ }
286
+ const getPath = (object, path) => pathOr(object, stringToPathArray(path), void 0);
1379
287
  var isProduction = true;
1380
288
  var prefix = "Invariant failed";
1381
289
  function invariant(condition, message) {
@@ -1407,11 +315,6 @@ const hydratable = {
1407
315
  hydratedData,
1408
316
  from
1409
317
  };
1410
- var baseSet = _baseSet;
1411
- function set(object, path, value) {
1412
- return object == null ? object : baseSet(object, path, value);
1413
- }
1414
- var set_1 = set;
1415
318
  const createStoreImpl = (createState) => {
1416
319
  let state;
1417
320
  const listeners = /* @__PURE__ */ new Set();
@@ -1449,9 +352,9 @@ var useSyncExternalStoreShim_production_min = {};
1449
352
  */
1450
353
  var e = React;
1451
354
  function h$2(a2, b2) {
1452
- return a2 === b2 && (a2 !== 0 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
355
+ return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
1453
356
  }
1454
- var k$1 = typeof Object.is === "function" ? Object.is : h$2, l$1 = e.useState, m = e.useEffect, n$2 = e.useLayoutEffect, p$2 = e.useDebugValue;
357
+ var k$1 = "function" === typeof Object.is ? Object.is : h$2, l$1 = e.useState, m = e.useEffect, n$2 = e.useLayoutEffect, p$2 = e.useDebugValue;
1455
358
  function q$2(a2, b2) {
1456
359
  var d2 = b2(), f2 = l$1({ inst: { value: d2, getSnapshot: b2 } }), c2 = f2[0].inst, g2 = f2[1];
1457
360
  n$2(function() {
@@ -1481,8 +384,8 @@ function r$2(a2) {
1481
384
  function t$2(a2, b2) {
1482
385
  return b2();
1483
386
  }
1484
- var u$2 = typeof window === "undefined" || typeof window.document === "undefined" || typeof window.document.createElement === "undefined" ? t$2 : q$2;
1485
- useSyncExternalStoreShim_production_min.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u$2;
387
+ var u$2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? t$2 : q$2;
388
+ useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u$2;
1486
389
  {
1487
390
  shim.exports = useSyncExternalStoreShim_production_min;
1488
391
  }
@@ -1497,12 +400,12 @@ useSyncExternalStoreShim_production_min.useSyncExternalStore = e.useSyncExternal
1497
400
  */
1498
401
  var h$1 = React, n$1 = shim.exports;
1499
402
  function p$1(a2, b2) {
1500
- return a2 === b2 && (a2 !== 0 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
403
+ return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
1501
404
  }
1502
- var q$1 = typeof Object.is === "function" ? Object.is : p$1, r$1 = n$1.useSyncExternalStore, t$1 = h$1.useRef, u$1 = h$1.useEffect, v$1 = h$1.useMemo, w$1 = h$1.useDebugValue;
405
+ var q$1 = "function" === typeof Object.is ? Object.is : p$1, r$1 = n$1.useSyncExternalStore, t$1 = h$1.useRef, u$1 = h$1.useEffect, v$1 = h$1.useMemo, w$1 = h$1.useDebugValue;
1503
406
  withSelector_production_min.useSyncExternalStoreWithSelector = function(a2, b2, e2, l2, g2) {
1504
407
  var c2 = t$1(null);
1505
- if (c2.current === null) {
408
+ if (null === c2.current) {
1506
409
  var f2 = { hasValue: false, value: null };
1507
410
  c2.current = f2;
1508
411
  } else
@@ -1513,7 +416,7 @@ withSelector_production_min.useSyncExternalStoreWithSelector = function(a2, b2,
1513
416
  c3 = true;
1514
417
  d3 = a4;
1515
418
  a4 = l2(a4);
1516
- if (g2 !== void 0 && f2.hasValue) {
419
+ if (void 0 !== g2 && f2.hasValue) {
1517
420
  var b3 = f2.value;
1518
421
  if (g2(b3, a4))
1519
422
  return k2 = b3;
@@ -1524,15 +427,15 @@ withSelector_production_min.useSyncExternalStoreWithSelector = function(a2, b2,
1524
427
  if (q$1(d3, a4))
1525
428
  return b3;
1526
429
  var e3 = l2(a4);
1527
- if (g2 !== void 0 && g2(b3, e3))
430
+ if (void 0 !== g2 && g2(b3, e3))
1528
431
  return b3;
1529
432
  d3 = a4;
1530
433
  return k2 = e3;
1531
434
  }
1532
- var c3 = false, d3, k2, m2 = e2 === void 0 ? null : e2;
435
+ var c3 = false, d3, k2, m2 = void 0 === e2 ? null : e2;
1533
436
  return [function() {
1534
437
  return a3(b2());
1535
- }, m2 === null ? void 0 : function() {
438
+ }, null === m2 ? void 0 : function() {
1536
439
  return a3(m2());
1537
440
  }];
1538
441
  }, [b2, e2, l2, g2]);
@@ -1572,18 +475,18 @@ function r(n2) {
1572
475
  }
1573
476
  function t(n2) {
1574
477
  return !!n2 && (function(n3) {
1575
- if (!n3 || typeof n3 != "object")
478
+ if (!n3 || "object" != typeof n3)
1576
479
  return false;
1577
480
  var r2 = Object.getPrototypeOf(n3);
1578
- if (r2 === null)
481
+ if (null === r2)
1579
482
  return true;
1580
483
  var t2 = Object.hasOwnProperty.call(r2, "constructor") && r2.constructor;
1581
- return t2 === Object || typeof t2 == "function" && Function.toString.call(t2) === Z;
484
+ return t2 === Object || "function" == typeof t2 && Function.toString.call(t2) === Z;
1582
485
  }(n2) || Array.isArray(n2) || !!n2[L] || !!n2.constructor[L] || s(n2) || v(n2));
1583
486
  }
1584
487
  function i(n2, r2, t2) {
1585
- t2 === void 0 && (t2 = false), o(n2) === 0 ? (t2 ? Object.keys : nn)(n2).forEach(function(e2) {
1586
- t2 && typeof e2 == "symbol" || r2(e2, n2[e2], n2);
488
+ void 0 === t2 && (t2 = false), 0 === o(n2) ? (t2 ? Object.keys : nn)(n2).forEach(function(e2) {
489
+ t2 && "symbol" == typeof e2 || r2(e2, n2[e2], n2);
1587
490
  }) : n2.forEach(function(t3, e2) {
1588
491
  return r2(e2, t3, n2);
1589
492
  });
@@ -1593,17 +496,17 @@ function o(n2) {
1593
496
  return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s(n2) ? 2 : v(n2) ? 3 : 0;
1594
497
  }
1595
498
  function u(n2, r2) {
1596
- return o(n2) === 2 ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
499
+ return 2 === o(n2) ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
1597
500
  }
1598
501
  function a(n2, r2) {
1599
- return o(n2) === 2 ? n2.get(r2) : n2[r2];
502
+ return 2 === o(n2) ? n2.get(r2) : n2[r2];
1600
503
  }
1601
504
  function f(n2, r2, t2) {
1602
505
  var e2 = o(n2);
1603
- e2 === 2 ? n2.set(r2, t2) : e2 === 3 ? (n2.delete(r2), n2.add(t2)) : n2[r2] = t2;
506
+ 2 === e2 ? n2.set(r2, t2) : 3 === e2 ? (n2.delete(r2), n2.add(t2)) : n2[r2] = t2;
1604
507
  }
1605
508
  function c(n2, r2) {
1606
- return n2 === r2 ? n2 !== 0 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
509
+ return n2 === r2 ? 0 !== n2 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
1607
510
  }
1608
511
  function s(n2) {
1609
512
  return X && n2 instanceof Map;
@@ -1621,12 +524,12 @@ function l(n2) {
1621
524
  delete r2[Q];
1622
525
  for (var t2 = nn(r2), e2 = 0; e2 < t2.length; e2++) {
1623
526
  var i2 = t2[e2], o2 = r2[i2];
1624
- o2.writable === false && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
527
+ false === o2.writable && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
1625
528
  }
1626
529
  return Object.create(Object.getPrototypeOf(n2), r2);
1627
530
  }
1628
531
  function d(n2, e2) {
1629
- return e2 === void 0 && (e2 = false), y(n2) || r(n2) || !t(n2) ? n2 : (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e2 && i(n2, function(n3, r2) {
532
+ return void 0 === e2 && (e2 = false), y(n2) || r(n2) || !t(n2) ? n2 : (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e2 && i(n2, function(n3, r2) {
1630
533
  return d(r2, true);
1631
534
  }, true), n2);
1632
535
  }
@@ -1634,7 +537,7 @@ function h() {
1634
537
  n(2);
1635
538
  }
1636
539
  function y(n2) {
1637
- return n2 == null || typeof n2 != "object" || Object.isFrozen(n2);
540
+ return null == n2 || "object" != typeof n2 || Object.isFrozen(n2);
1638
541
  }
1639
542
  function b(r2) {
1640
543
  var t2 = tn[r2];
@@ -1657,11 +560,11 @@ function w(n2) {
1657
560
  }
1658
561
  function S(n2) {
1659
562
  var r2 = n2[Q];
1660
- r2.i === 0 || r2.i === 1 ? r2.j() : r2.O = true;
563
+ 0 === r2.i || 1 === r2.i ? r2.j() : r2.O = true;
1661
564
  }
1662
565
  function P(r2, e2) {
1663
566
  e2._ = e2.p.length;
1664
- var i2 = e2.p[0], o2 = r2 !== void 0 && r2 !== i2;
567
+ var i2 = e2.p[0], o2 = void 0 !== r2 && r2 !== i2;
1665
568
  return e2.h.g || b("ES5").S(e2, r2, o2), o2 ? (i2[Q].P && (O(e2), n(4)), t(r2) && (r2 = M(e2, r2), e2.l || x(e2, r2)), e2.u && b("Patches").M(i2[Q].t, r2, e2.u, e2.s)) : r2 = M(e2, i2, []), O(e2), e2.u && e2.v(e2.u, e2.s), r2 !== H ? r2 : void 0;
1666
569
  }
1667
570
  function M(n2, r2, t2) {
@@ -1678,8 +581,8 @@ function M(n2, r2, t2) {
1678
581
  return x(n2, e2.t, true), e2.t;
1679
582
  if (!e2.I) {
1680
583
  e2.I = true, e2.A._--;
1681
- var o2 = e2.i === 4 || e2.i === 5 ? e2.o = l(e2.k) : e2.o;
1682
- i(e2.i === 3 ? new Set(o2) : o2, function(r3, i2) {
584
+ var o2 = 4 === e2.i || 5 === e2.i ? e2.o = l(e2.k) : e2.o;
585
+ i(3 === e2.i ? new Set(o2) : o2, function(r3, i2) {
1683
586
  return A(n2, e2, o2, r3, i2, t2);
1684
587
  }), x(n2, o2, false), t2 && n2.u && b("Patches").R(e2, t2, n2.u, n2.s);
1685
588
  }
@@ -1687,7 +590,7 @@ function M(n2, r2, t2) {
1687
590
  }
1688
591
  function A(e2, i2, o2, a2, c2, s2) {
1689
592
  if (r(c2)) {
1690
- var v2 = M(e2, c2, s2 && i2 && i2.i !== 3 && !u(i2.D, a2) ? s2.concat(a2) : void 0);
593
+ var v2 = M(e2, c2, s2 && i2 && 3 !== i2.i && !u(i2.D, a2) ? s2.concat(a2) : void 0);
1691
594
  if (f(o2, a2, v2), !r(v2))
1692
595
  return;
1693
596
  e2.m = false;
@@ -1699,7 +602,7 @@ function A(e2, i2, o2, a2, c2, s2) {
1699
602
  }
1700
603
  }
1701
604
  function x(n2, r2, t2) {
1702
- t2 === void 0 && (t2 = false), n2.h.F && n2.m && d(r2, t2);
605
+ void 0 === t2 && (t2 = false), n2.h.F && n2.m && d(r2, t2);
1703
606
  }
1704
607
  function z(n2, r2) {
1705
608
  var t2 = n2[Q];
@@ -1742,7 +645,7 @@ function D(e2) {
1742
645
  e3 = F(r2, c2);
1743
646
  return i(e3, function(r3, t2) {
1744
647
  u2 && a(u2.t, r3) === t2 || f(e3, r3, n2(t2));
1745
- }), c2 === 3 ? new Set(e3) : e3;
648
+ }), 3 === c2 ? new Set(e3) : e3;
1746
649
  }(e2);
1747
650
  }
1748
651
  function F(n2, r2) {
@@ -1754,7 +657,7 @@ function F(n2, r2) {
1754
657
  }
1755
658
  return l(n2);
1756
659
  }
1757
- var G, U, W = typeof Symbol != "undefined" && typeof Symbol("x") == "symbol", X = typeof Map != "undefined", q = typeof Set != "undefined", B = typeof Proxy != "undefined" && Proxy.revocable !== void 0 && typeof Reflect != "undefined", H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G), L = W ? Symbol.for("immer-draftable") : "__$immer_draftable", Q = W ? Symbol.for("immer-state") : "__$immer_state", Z = "" + Object.prototype.constructor, nn = typeof Reflect != "undefined" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(n2) {
660
+ var G, U, W = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x"), X = "undefined" != typeof Map, q = "undefined" != typeof Set, B = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect, H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G), L = W ? Symbol.for("immer-draftable") : "__$immer_draftable", Q = W ? Symbol.for("immer-state") : "__$immer_state", Z = "" + Object.prototype.constructor, nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n2) {
1758
661
  return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
1759
662
  } : Object.getOwnPropertyNames, rn = Object.getOwnPropertyDescriptors || function(n2) {
1760
663
  var r2 = {};
@@ -1768,7 +671,7 @@ var G, U, W = typeof Symbol != "undefined" && typeof Symbol("x") == "symbol", X
1768
671
  if (!u(e2, r2))
1769
672
  return function(n3, r3, t2) {
1770
673
  var e3, i3 = I(r3, t2);
1771
- return i3 ? "value" in i3 ? i3.value : (e3 = i3.get) === null || e3 === void 0 ? void 0 : e3.call(n3.k) : void 0;
674
+ return i3 ? "value" in i3 ? i3.value : null === (e3 = i3.get) || void 0 === e3 ? void 0 : e3.call(n3.k) : void 0;
1772
675
  }(n2, e2, r2);
1773
676
  var i2 = e2[r2];
1774
677
  return n2.I || !t(i2) ? i2 : i2 === z(n2.t, r2) ? (E(n2), n2.o[r2] = R(n2.A.h, i2, n2)) : i2;
@@ -1778,22 +681,22 @@ var G, U, W = typeof Symbol != "undefined" && typeof Symbol("x") == "symbol", X
1778
681
  return Reflect.ownKeys(p(n2));
1779
682
  }, set: function(n2, r2, t2) {
1780
683
  var e2 = I(p(n2), r2);
1781
- if (e2 == null ? void 0 : e2.set)
684
+ if (null == e2 ? void 0 : e2.set)
1782
685
  return e2.set.call(n2.k, t2), true;
1783
686
  if (!n2.P) {
1784
- var i2 = z(p(n2), r2), o2 = i2 == null ? void 0 : i2[Q];
687
+ var i2 = z(p(n2), r2), o2 = null == i2 ? void 0 : i2[Q];
1785
688
  if (o2 && o2.t === t2)
1786
689
  return n2.o[r2] = t2, n2.D[r2] = false, true;
1787
- if (c(t2, i2) && (t2 !== void 0 || u(n2.t, r2)))
690
+ if (c(t2, i2) && (void 0 !== t2 || u(n2.t, r2)))
1788
691
  return true;
1789
692
  E(n2), k(n2);
1790
693
  }
1791
- return n2.o[r2] === t2 && typeof t2 != "number" && (t2 !== void 0 || r2 in n2.o) || (n2.o[r2] = t2, n2.D[r2] = true, true);
694
+ return n2.o[r2] === t2 && "number" != typeof t2 && (void 0 !== t2 || r2 in n2.o) || (n2.o[r2] = t2, n2.D[r2] = true, true);
1792
695
  }, deleteProperty: function(n2, r2) {
1793
- return z(n2.t, r2) !== void 0 || r2 in n2.t ? (n2.D[r2] = false, E(n2), k(n2)) : delete n2.D[r2], n2.o && delete n2.o[r2], true;
696
+ return void 0 !== z(n2.t, r2) || r2 in n2.t ? (n2.D[r2] = false, E(n2), k(n2)) : delete n2.D[r2], n2.o && delete n2.o[r2], true;
1794
697
  }, getOwnPropertyDescriptor: function(n2, r2) {
1795
698
  var t2 = p(n2), e2 = Reflect.getOwnPropertyDescriptor(t2, r2);
1796
- return e2 ? { writable: true, configurable: n2.i !== 1 || r2 !== "length", enumerable: e2.enumerable, value: t2[r2] } : e2;
699
+ return e2 ? { writable: true, configurable: 1 !== n2.i || "length" !== r2, enumerable: e2.enumerable, value: t2[r2] } : e2;
1797
700
  }, defineProperty: function() {
1798
701
  n(11);
1799
702
  }, getPrototypeOf: function(n2) {
@@ -1814,13 +717,13 @@ var un = function() {
1814
717
  function e2(r2) {
1815
718
  var e3 = this;
1816
719
  this.g = B, this.F = true, this.produce = function(r3, i3, o2) {
1817
- if (typeof r3 == "function" && typeof i3 != "function") {
720
+ if ("function" == typeof r3 && "function" != typeof i3) {
1818
721
  var u2 = i3;
1819
722
  i3 = r3;
1820
723
  var a2 = e3;
1821
724
  return function(n2) {
1822
725
  var r4 = this;
1823
- n2 === void 0 && (n2 = u2);
726
+ void 0 === n2 && (n2 = u2);
1824
727
  for (var t2 = arguments.length, e4 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
1825
728
  e4[o3 - 1] = arguments[o3];
1826
729
  return a2.produce(n2, function(n3) {
@@ -1830,21 +733,21 @@ var un = function() {
1830
733
  };
1831
734
  }
1832
735
  var f2;
1833
- if (typeof i3 != "function" && n(6), o2 !== void 0 && typeof o2 != "function" && n(7), t(r3)) {
736
+ if ("function" != typeof i3 && n(6), void 0 !== o2 && "function" != typeof o2 && n(7), t(r3)) {
1834
737
  var c2 = w(e3), s2 = R(e3, r3, void 0), v2 = true;
1835
738
  try {
1836
739
  f2 = i3(s2), v2 = false;
1837
740
  } finally {
1838
741
  v2 ? O(c2) : g(c2);
1839
742
  }
1840
- return typeof Promise != "undefined" && f2 instanceof Promise ? f2.then(function(n2) {
743
+ return "undefined" != typeof Promise && f2 instanceof Promise ? f2.then(function(n2) {
1841
744
  return j(c2, o2), P(n2, c2);
1842
745
  }, function(n2) {
1843
746
  throw O(c2), n2;
1844
747
  }) : (j(c2, o2), P(f2, c2));
1845
748
  }
1846
- if (!r3 || typeof r3 != "object") {
1847
- if ((f2 = i3(r3)) === void 0 && (f2 = r3), f2 === H && (f2 = void 0), e3.F && d(f2, true), o2) {
749
+ if (!r3 || "object" != typeof r3) {
750
+ if (void 0 === (f2 = i3(r3)) && (f2 = r3), f2 === H && (f2 = void 0), e3.F && d(f2, true), o2) {
1848
751
  var p2 = [], l2 = [];
1849
752
  b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
1850
753
  }
@@ -1852,7 +755,7 @@ var un = function() {
1852
755
  }
1853
756
  n(21, r3);
1854
757
  }, this.produceWithPatches = function(n2, r3) {
1855
- if (typeof n2 == "function")
758
+ if ("function" == typeof n2)
1856
759
  return function(r4) {
1857
760
  for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
1858
761
  i4[o3 - 1] = arguments[o3];
@@ -1863,10 +766,10 @@ var un = function() {
1863
766
  var t2, i3, o2 = e3.produce(n2, r3, function(n3, r4) {
1864
767
  t2 = n3, i3 = r4;
1865
768
  });
1866
- return typeof Promise != "undefined" && o2 instanceof Promise ? o2.then(function(n3) {
769
+ return "undefined" != typeof Promise && o2 instanceof Promise ? o2.then(function(n3) {
1867
770
  return [n3, t2, i3];
1868
771
  }) : [o2, t2, i3];
1869
- }, typeof (r2 == null ? void 0 : r2.useProxies) == "boolean" && this.setUseProxies(r2.useProxies), typeof (r2 == null ? void 0 : r2.autoFreeze) == "boolean" && this.setAutoFreeze(r2.autoFreeze);
772
+ }, "boolean" == typeof (null == r2 ? void 0 : r2.useProxies) && this.setUseProxies(r2.useProxies), "boolean" == typeof (null == r2 ? void 0 : r2.autoFreeze) && this.setAutoFreeze(r2.autoFreeze);
1870
773
  }
1871
774
  var i2 = e2.prototype;
1872
775
  return i2.createDraft = function(e3) {
@@ -1885,7 +788,7 @@ var un = function() {
1885
788
  var e3;
1886
789
  for (e3 = t2.length - 1; e3 >= 0; e3--) {
1887
790
  var i3 = t2[e3];
1888
- if (i3.path.length === 0 && i3.op === "replace") {
791
+ if (0 === i3.path.length && "replace" === i3.op) {
1889
792
  n2 = i3.value;
1890
793
  break;
1891
794
  }
@@ -1903,22 +806,64 @@ an.setUseProxies.bind(an);
1903
806
  an.applyPatches.bind(an);
1904
807
  an.createDraft.bind(an);
1905
808
  an.finishDraft.bind(an);
1906
- const immerImpl = (initializer) => (set2, get2, store) => {
809
+ const immerImpl = (initializer) => (set2, get, store) => {
1907
810
  store.setState = (updater, replace2, ...a2) => {
1908
811
  const nextState = typeof updater === "function" ? fn(updater) : updater;
1909
812
  return set2(nextState, replace2, ...a2);
1910
813
  };
1911
- return initializer(store.setState, get2, store);
814
+ return initializer(store.setState, get, store);
1912
815
  };
1913
816
  const immer = immerImpl;
817
+ const requestSubmit = (element, submitter) => {
818
+ if (typeof Object.getPrototypeOf(element).requestSubmit === "function" && true) {
819
+ element.requestSubmit(submitter);
820
+ return;
821
+ }
822
+ if (submitter) {
823
+ validateSubmitter(element, submitter);
824
+ submitter.click();
825
+ return;
826
+ }
827
+ const dummySubmitter = document.createElement("input");
828
+ dummySubmitter.type = "submit";
829
+ dummySubmitter.hidden = true;
830
+ element.appendChild(dummySubmitter);
831
+ dummySubmitter.click();
832
+ element.removeChild(dummySubmitter);
833
+ };
834
+ function validateSubmitter(element, submitter) {
835
+ const isHtmlElement = submitter instanceof HTMLElement;
836
+ if (!isHtmlElement) {
837
+ raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
838
+ }
839
+ const hasSubmitType = "type" in submitter && submitter.type === "submit";
840
+ if (!hasSubmitType)
841
+ raise(TypeError, "The specified element is not a submit button");
842
+ const isForCorrectForm = "form" in submitter && submitter.form === element;
843
+ if (!isForCorrectForm)
844
+ raise(
845
+ DOMException,
846
+ "The specified element is not owned by this form element",
847
+ "NotFoundError"
848
+ );
849
+ }
850
+ function raise(errorConstructor, message, name) {
851
+ throw new errorConstructor(
852
+ "Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".",
853
+ name
854
+ );
855
+ }
1914
856
  const getArray = (values, field) => {
1915
- const value = get_1(values, field);
857
+ const value = getPath(values, field);
1916
858
  if (value === void 0 || value === null) {
1917
859
  const newValue = [];
1918
- set_1(values, field, newValue);
860
+ setPath(values, field, newValue);
1919
861
  return newValue;
1920
862
  }
1921
- invariant(Array.isArray(value), `FieldArray: defaultValue value for ${field} must be an array, null, or undefined`);
863
+ invariant(
864
+ Array.isArray(value),
865
+ `FieldArray: defaultValue value for ${field} must be an array, null, or undefined`
866
+ );
1922
867
  return value;
1923
868
  };
1924
869
  const swap = (array, indexA, indexB) => {
@@ -1964,8 +909,8 @@ const mutateAsArray = (field, obj, mutate) => {
1964
909
  for (const [key, value] of Object.entries(obj)) {
1965
910
  if (key.startsWith(field) && key !== field) {
1966
911
  beforeKeys.add(key);
912
+ setPath(arr, key.substring(field.length), value);
1967
913
  }
1968
- set_1(arr, key.substring(field.length), value);
1969
914
  }
1970
915
  mutate(arr);
1971
916
  for (const key of beforeKeys) {
@@ -1973,16 +918,20 @@ const mutateAsArray = (field, obj, mutate) => {
1973
918
  }
1974
919
  const newKeys = getDeepArrayPaths(arr);
1975
920
  for (const key of newKeys) {
1976
- const val = get_1(arr, key);
921
+ const val = getPath(arr, key);
1977
922
  obj[`${field}${key}`] = val;
1978
923
  }
1979
924
  };
1980
925
  const getDeepArrayPaths = (obj, basePath = "") => {
1981
926
  if (Array.isArray(obj)) {
1982
- return obj.flatMap((item, index) => getDeepArrayPaths(item, `${basePath}[${index}]`));
927
+ return obj.flatMap(
928
+ (item, index) => getDeepArrayPaths(item, `${basePath}[${index}]`)
929
+ );
1983
930
  }
1984
931
  if (typeof obj === "object") {
1985
- return Object.keys(obj).flatMap((key) => getDeepArrayPaths(obj[key], `${basePath}.${key}`));
932
+ return Object.keys(obj).flatMap(
933
+ (key) => getDeepArrayPaths(obj[key], `${basePath}.${key}`)
934
+ );
1986
935
  }
1987
936
  return [basePath];
1988
937
  };
@@ -2040,7 +989,7 @@ const defaultFormState = {
2040
989
  }
2041
990
  }
2042
991
  };
2043
- const createFormState = (set2, get2) => ({
992
+ const createFormState = (set2, get) => ({
2044
993
  isHydrated: false,
2045
994
  isSubmitting: false,
2046
995
  hasBeenSubmitted: false,
@@ -2048,7 +997,7 @@ const createFormState = (set2, get2) => ({
2048
997
  fieldErrors: {},
2049
998
  formElement: null,
2050
999
  currentDefaultValues: {},
2051
- isValid: () => Object.keys(get2().fieldErrors).length === 0,
1000
+ isValid: () => Object.keys(get().fieldErrors).length === 0,
2052
1001
  startSubmit: () => set2((state) => {
2053
1002
  state.isSubmitting = true;
2054
1003
  state.hasBeenSubmitted = true;
@@ -2086,7 +1035,7 @@ const createFormState = (set2, get2) => ({
2086
1035
  state.isHydrated = true;
2087
1036
  }),
2088
1037
  setFormElement: (formElement) => {
2089
- if (get2().formElement === formElement)
1038
+ if (get().formElement === formElement)
2090
1039
  return;
2091
1040
  set2((state) => {
2092
1041
  state.formElement = formElement;
@@ -2094,43 +1043,61 @@ const createFormState = (set2, get2) => ({
2094
1043
  },
2095
1044
  validateField: async (field) => {
2096
1045
  var _a, _b, _c;
2097
- const formElement = get2().formElement;
2098
- invariant(formElement, "Cannot find reference to form. This is probably a bug in remix-validated-form.");
2099
- const validator = (_a = get2().formProps) == null ? void 0 : _a.validator;
2100
- invariant(validator, "Cannot validator. This is probably a bug in remix-validated-form.");
2101
- await ((_c = (_b = get2().controlledFields).awaitValueUpdate) == null ? void 0 : _c.call(_b, field));
2102
- const { error } = await validator.validateField(new FormData(formElement), field);
1046
+ const formElement = get().formElement;
1047
+ invariant(
1048
+ formElement,
1049
+ "Cannot find reference to form. This is probably a bug in remix-validated-form."
1050
+ );
1051
+ const validator = (_a = get().formProps) == null ? void 0 : _a.validator;
1052
+ invariant(
1053
+ validator,
1054
+ "Cannot validator. This is probably a bug in remix-validated-form."
1055
+ );
1056
+ await ((_c = (_b = get().controlledFields).awaitValueUpdate) == null ? void 0 : _c.call(_b, field));
1057
+ const { error } = await validator.validateField(
1058
+ new FormData(formElement),
1059
+ field
1060
+ );
2103
1061
  if (error) {
2104
- get2().setFieldError(field, error);
1062
+ get().setFieldError(field, error);
2105
1063
  return error;
2106
1064
  } else {
2107
- get2().clearFieldError(field);
1065
+ get().clearFieldError(field);
2108
1066
  return null;
2109
1067
  }
2110
1068
  },
2111
1069
  validate: async () => {
2112
1070
  var _a;
2113
- const formElement = get2().formElement;
2114
- invariant(formElement, "Cannot find reference to form. This is probably a bug in remix-validated-form.");
2115
- const validator = (_a = get2().formProps) == null ? void 0 : _a.validator;
2116
- invariant(validator, "Cannot validator. This is probably a bug in remix-validated-form.");
1071
+ const formElement = get().formElement;
1072
+ invariant(
1073
+ formElement,
1074
+ "Cannot find reference to form. This is probably a bug in remix-validated-form."
1075
+ );
1076
+ const validator = (_a = get().formProps) == null ? void 0 : _a.validator;
1077
+ invariant(
1078
+ validator,
1079
+ "Cannot validator. This is probably a bug in remix-validated-form."
1080
+ );
2117
1081
  const result = await validator.validate(new FormData(formElement));
2118
1082
  if (result.error)
2119
- get2().setFieldErrors(result.error.fieldErrors);
1083
+ get().setFieldErrors(result.error.fieldErrors);
2120
1084
  return result;
2121
1085
  },
2122
1086
  submit: () => {
2123
- const formElement = get2().formElement;
2124
- invariant(formElement, "Cannot find reference to form. This is probably a bug in remix-validated-form.");
2125
- formElement.requestSubmit();
1087
+ const formElement = get().formElement;
1088
+ invariant(
1089
+ formElement,
1090
+ "Cannot find reference to form. This is probably a bug in remix-validated-form."
1091
+ );
1092
+ requestSubmit(formElement);
2126
1093
  },
2127
1094
  getValues: () => {
2128
1095
  var _a;
2129
- return new FormData((_a = get2().formElement) != null ? _a : void 0);
1096
+ return new FormData((_a = get().formElement) != null ? _a : void 0);
2130
1097
  },
2131
1098
  resetFormElement: () => {
2132
1099
  var _a;
2133
- return (_a = get2().formElement) == null ? void 0 : _a.reset();
1100
+ return (_a = get().formElement) == null ? void 0 : _a.reset();
2134
1101
  },
2135
1102
  controlledFields: {
2136
1103
  values: {},
@@ -2145,7 +1112,7 @@ const createFormState = (set2, get2) => ({
2145
1112
  });
2146
1113
  },
2147
1114
  unregister: (fieldName) => {
2148
- if (get2() === null || get2() === void 0)
1115
+ if (get() === null || get() === void 0)
2149
1116
  return;
2150
1117
  set2((state) => {
2151
1118
  var _a, _b, _c;
@@ -2154,20 +1121,30 @@ const createFormState = (set2, get2) => ({
2154
1121
  state.controlledFields.refCounts[fieldName] = current - 1;
2155
1122
  return;
2156
1123
  }
2157
- const isNested = Object.keys(state.controlledFields.refCounts).some((key) => fieldName.startsWith(key) && key !== fieldName);
1124
+ const isNested = Object.keys(state.controlledFields.refCounts).some(
1125
+ (key) => fieldName.startsWith(key) && key !== fieldName
1126
+ );
2158
1127
  if (!isNested) {
2159
- set_1(state.controlledFields.values, fieldName, get_1((_b = state.formProps) == null ? void 0 : _b.defaultValues, fieldName));
2160
- set_1(state.currentDefaultValues, fieldName, get_1((_c = state.formProps) == null ? void 0 : _c.defaultValues, fieldName));
1128
+ setPath(
1129
+ state.controlledFields.values,
1130
+ fieldName,
1131
+ getPath((_b = state.formProps) == null ? void 0 : _b.defaultValues, fieldName)
1132
+ );
1133
+ setPath(
1134
+ state.currentDefaultValues,
1135
+ fieldName,
1136
+ getPath((_c = state.formProps) == null ? void 0 : _c.defaultValues, fieldName)
1137
+ );
2161
1138
  }
2162
1139
  delete state.controlledFields.refCounts[fieldName];
2163
1140
  });
2164
1141
  },
2165
- getValue: (fieldName) => get_1(get2().controlledFields.values, fieldName),
1142
+ getValue: (fieldName) => getPath(get().controlledFields.values, fieldName),
2166
1143
  setValue: (fieldName, value) => {
2167
1144
  set2((state) => {
2168
- set_1(state.controlledFields.values, fieldName, value);
1145
+ setPath(state.controlledFields.values, fieldName, value);
2169
1146
  });
2170
- get2().controlledFields.kickoffValueUpdate(fieldName);
1147
+ get().controlledFields.kickoffValueUpdate(fieldName);
2171
1148
  },
2172
1149
  kickoffValueUpdate: (fieldName) => {
2173
1150
  const clear = () => set2((state) => {
@@ -2182,7 +1159,7 @@ const createFormState = (set2, get2) => ({
2182
1159
  });
2183
1160
  },
2184
1161
  awaitValueUpdate: async (fieldName) => {
2185
- await get2().controlledFields.valueUpdatePromises[fieldName];
1162
+ await get().controlledFields.valueUpdatePromises[fieldName];
2186
1163
  },
2187
1164
  array: {
2188
1165
  push: (fieldName, item) => {
@@ -2190,92 +1167,191 @@ const createFormState = (set2, get2) => ({
2190
1167
  getArray(state.controlledFields.values, fieldName).push(item);
2191
1168
  getArray(state.currentDefaultValues, fieldName).push(item);
2192
1169
  });
2193
- get2().controlledFields.kickoffValueUpdate(fieldName);
1170
+ get().controlledFields.kickoffValueUpdate(fieldName);
2194
1171
  },
2195
1172
  swap: (fieldName, indexA, indexB) => {
2196
1173
  set2((state) => {
2197
- swap(getArray(state.controlledFields.values, fieldName), indexA, indexB);
2198
- swap(getArray(state.currentDefaultValues, fieldName), indexA, indexB);
2199
- mutateAsArray(fieldName, state.touchedFields, (array) => swap(array, indexA, indexB));
2200
- mutateAsArray(fieldName, state.fieldErrors, (array) => swap(array, indexA, indexB));
1174
+ swap(
1175
+ getArray(state.controlledFields.values, fieldName),
1176
+ indexA,
1177
+ indexB
1178
+ );
1179
+ swap(
1180
+ getArray(state.currentDefaultValues, fieldName),
1181
+ indexA,
1182
+ indexB
1183
+ );
1184
+ mutateAsArray(
1185
+ fieldName,
1186
+ state.touchedFields,
1187
+ (array) => swap(array, indexA, indexB)
1188
+ );
1189
+ mutateAsArray(
1190
+ fieldName,
1191
+ state.fieldErrors,
1192
+ (array) => swap(array, indexA, indexB)
1193
+ );
2201
1194
  });
2202
- get2().controlledFields.kickoffValueUpdate(fieldName);
1195
+ get().controlledFields.kickoffValueUpdate(fieldName);
2203
1196
  },
2204
1197
  move: (fieldName, from2, to) => {
2205
1198
  set2((state) => {
2206
- move(getArray(state.controlledFields.values, fieldName), from2, to);
2207
- move(getArray(state.currentDefaultValues, fieldName), from2, to);
2208
- mutateAsArray(fieldName, state.touchedFields, (array) => move(array, from2, to));
2209
- mutateAsArray(fieldName, state.fieldErrors, (array) => move(array, from2, to));
1199
+ move(
1200
+ getArray(state.controlledFields.values, fieldName),
1201
+ from2,
1202
+ to
1203
+ );
1204
+ move(
1205
+ getArray(state.currentDefaultValues, fieldName),
1206
+ from2,
1207
+ to
1208
+ );
1209
+ mutateAsArray(
1210
+ fieldName,
1211
+ state.touchedFields,
1212
+ (array) => move(array, from2, to)
1213
+ );
1214
+ mutateAsArray(
1215
+ fieldName,
1216
+ state.fieldErrors,
1217
+ (array) => move(array, from2, to)
1218
+ );
2210
1219
  });
2211
- get2().controlledFields.kickoffValueUpdate(fieldName);
1220
+ get().controlledFields.kickoffValueUpdate(fieldName);
2212
1221
  },
2213
1222
  insert: (fieldName, index, item) => {
2214
1223
  set2((state) => {
2215
- insert(getArray(state.controlledFields.values, fieldName), index, item);
2216
- insert(getArray(state.currentDefaultValues, fieldName), index, item);
2217
- mutateAsArray(fieldName, state.touchedFields, (array) => insert(array, index, false));
2218
- mutateAsArray(fieldName, state.fieldErrors, (array) => insert(array, index, void 0));
1224
+ insert(
1225
+ getArray(state.controlledFields.values, fieldName),
1226
+ index,
1227
+ item
1228
+ );
1229
+ insert(
1230
+ getArray(state.currentDefaultValues, fieldName),
1231
+ index,
1232
+ item
1233
+ );
1234
+ mutateAsArray(
1235
+ fieldName,
1236
+ state.touchedFields,
1237
+ (array) => insert(array, index, false)
1238
+ );
1239
+ mutateAsArray(
1240
+ fieldName,
1241
+ state.fieldErrors,
1242
+ (array) => insert(array, index, void 0)
1243
+ );
2219
1244
  });
2220
- get2().controlledFields.kickoffValueUpdate(fieldName);
1245
+ get().controlledFields.kickoffValueUpdate(fieldName);
2221
1246
  },
2222
1247
  remove: (fieldName, index) => {
2223
1248
  set2((state) => {
2224
- remove(getArray(state.controlledFields.values, fieldName), index);
2225
- remove(getArray(state.currentDefaultValues, fieldName), index);
2226
- mutateAsArray(fieldName, state.touchedFields, (array) => remove(array, index));
2227
- mutateAsArray(fieldName, state.fieldErrors, (array) => remove(array, index));
1249
+ remove(
1250
+ getArray(state.controlledFields.values, fieldName),
1251
+ index
1252
+ );
1253
+ remove(
1254
+ getArray(state.currentDefaultValues, fieldName),
1255
+ index
1256
+ );
1257
+ mutateAsArray(
1258
+ fieldName,
1259
+ state.touchedFields,
1260
+ (array) => remove(array, index)
1261
+ );
1262
+ mutateAsArray(
1263
+ fieldName,
1264
+ state.fieldErrors,
1265
+ (array) => remove(array, index)
1266
+ );
2228
1267
  });
2229
- get2().controlledFields.kickoffValueUpdate(fieldName);
1268
+ get().controlledFields.kickoffValueUpdate(fieldName);
2230
1269
  },
2231
1270
  pop: (fieldName) => {
2232
1271
  set2((state) => {
2233
1272
  getArray(state.controlledFields.values, fieldName).pop();
2234
1273
  getArray(state.currentDefaultValues, fieldName).pop();
2235
- mutateAsArray(fieldName, state.touchedFields, (array) => array.pop());
2236
- mutateAsArray(fieldName, state.fieldErrors, (array) => array.pop());
1274
+ mutateAsArray(
1275
+ fieldName,
1276
+ state.touchedFields,
1277
+ (array) => array.pop()
1278
+ );
1279
+ mutateAsArray(
1280
+ fieldName,
1281
+ state.fieldErrors,
1282
+ (array) => array.pop()
1283
+ );
2237
1284
  });
2238
- get2().controlledFields.kickoffValueUpdate(fieldName);
1285
+ get().controlledFields.kickoffValueUpdate(fieldName);
2239
1286
  },
2240
1287
  unshift: (fieldName, value) => {
2241
1288
  set2((state) => {
2242
1289
  getArray(state.controlledFields.values, fieldName).unshift(value);
2243
1290
  getArray(state.currentDefaultValues, fieldName).unshift(value);
2244
- mutateAsArray(fieldName, state.touchedFields, (array) => array.unshift(false));
2245
- mutateAsArray(fieldName, state.fieldErrors, (array) => array.unshift(void 0));
1291
+ mutateAsArray(
1292
+ fieldName,
1293
+ state.touchedFields,
1294
+ (array) => array.unshift(false)
1295
+ );
1296
+ mutateAsArray(
1297
+ fieldName,
1298
+ state.fieldErrors,
1299
+ (array) => array.unshift(void 0)
1300
+ );
2246
1301
  });
2247
1302
  },
2248
1303
  replace: (fieldName, index, item) => {
2249
1304
  set2((state) => {
2250
- replace(getArray(state.controlledFields.values, fieldName), index, item);
2251
- replace(getArray(state.currentDefaultValues, fieldName), index, item);
2252
- mutateAsArray(fieldName, state.touchedFields, (array) => replace(array, index, item));
2253
- mutateAsArray(fieldName, state.fieldErrors, (array) => replace(array, index, item));
1305
+ replace(
1306
+ getArray(state.controlledFields.values, fieldName),
1307
+ index,
1308
+ item
1309
+ );
1310
+ replace(
1311
+ getArray(state.currentDefaultValues, fieldName),
1312
+ index,
1313
+ item
1314
+ );
1315
+ mutateAsArray(
1316
+ fieldName,
1317
+ state.touchedFields,
1318
+ (array) => replace(array, index, item)
1319
+ );
1320
+ mutateAsArray(
1321
+ fieldName,
1322
+ state.fieldErrors,
1323
+ (array) => replace(array, index, item)
1324
+ );
2254
1325
  });
2255
- get2().controlledFields.kickoffValueUpdate(fieldName);
1326
+ get().controlledFields.kickoffValueUpdate(fieldName);
2256
1327
  }
2257
1328
  }
2258
1329
  }
2259
1330
  });
2260
- const useRootFormStore = create$1()(immer((set2, get2) => ({
2261
- forms: {},
2262
- form: (formId) => {
2263
- var _a;
2264
- return (_a = get2().forms[formId]) != null ? _a : defaultFormState;
2265
- },
2266
- cleanupForm: (formId) => {
2267
- set2((state) => {
2268
- delete state.forms[formId];
2269
- });
2270
- },
2271
- registerForm: (formId) => {
2272
- if (get2().forms[formId])
2273
- return;
2274
- set2((state) => {
2275
- state.forms[formId] = createFormState((setter) => set2((state2) => setter(state2.forms[formId])), () => get2().forms[formId]);
2276
- });
2277
- }
2278
- })));
1331
+ const useRootFormStore = create$1()(
1332
+ immer((set2, get) => ({
1333
+ forms: {},
1334
+ form: (formId) => {
1335
+ var _a;
1336
+ return (_a = get().forms[formId]) != null ? _a : defaultFormState;
1337
+ },
1338
+ cleanupForm: (formId) => {
1339
+ set2((state) => {
1340
+ delete state.forms[formId];
1341
+ });
1342
+ },
1343
+ registerForm: (formId) => {
1344
+ if (get().forms[formId])
1345
+ return;
1346
+ set2((state) => {
1347
+ state.forms[formId] = createFormState(
1348
+ (setter) => set2((state2) => setter(state2.forms[formId])),
1349
+ () => get().forms[formId]
1350
+ );
1351
+ });
1352
+ }
1353
+ }))
1354
+ );
2279
1355
  const useFormStore = (formId, selector) => {
2280
1356
  return useRootFormStore((state) => selector(state.form(formId)));
2281
1357
  };
@@ -2285,7 +1361,9 @@ const useInternalFormContext = (formId, hookName) => {
2285
1361
  return { formId };
2286
1362
  if (formContext)
2287
1363
  return formContext;
2288
- throw new Error(`Unable to determine form for ${hookName}. Please use it inside a ValidatedForm or pass a 'formId'.`);
1364
+ throw new Error(
1365
+ `Unable to determine form for ${hookName}. Please use it inside a ValidatedForm or pass a 'formId'.`
1366
+ );
2289
1367
  };
2290
1368
  function useErrorResponseForForm({
2291
1369
  fetcher,
@@ -2331,7 +1409,10 @@ const useDefaultValuesForForm = (context) => {
2331
1409
  if (hydrated)
2332
1410
  return hydratable.hydratedData();
2333
1411
  if (errorResponse == null ? void 0 : errorResponse.repopulateFields) {
2334
- invariant(typeof errorResponse.repopulateFields === "object", "repopulateFields returned something other than an object");
1412
+ invariant(
1413
+ typeof errorResponse.repopulateFields === "object",
1414
+ "repopulateFields returned something other than an object"
1415
+ );
2335
1416
  return hydratable.serverData(errorResponse.repopulateFields);
2336
1417
  }
2337
1418
  if (defaultValuesProp)
@@ -2348,23 +1429,29 @@ const useHasActiveFormSubmit = ({
2348
1429
  const useFieldTouched = (field, { formId }) => {
2349
1430
  const touched = useFormStore(formId, (state) => state.touchedFields[field]);
2350
1431
  const setFieldTouched = useFormStore(formId, (state) => state.setTouched);
2351
- const setTouched = useCallback((touched2) => setFieldTouched(field, touched2), [field, setFieldTouched]);
1432
+ const setTouched = useCallback(
1433
+ (touched2) => setFieldTouched(field, touched2),
1434
+ [field, setFieldTouched]
1435
+ );
2352
1436
  return [touched, setTouched];
2353
1437
  };
2354
1438
  const useFieldError = (name, context) => {
2355
1439
  const fieldErrors = useFieldErrorsForForm(context);
2356
- const state = useFormStore(context.formId, (state2) => state2.fieldErrors[name]);
1440
+ const state = useFormStore(
1441
+ context.formId,
1442
+ (state2) => state2.fieldErrors[name]
1443
+ );
2357
1444
  return fieldErrors.map((fieldErrors2) => fieldErrors2 == null ? void 0 : fieldErrors2[name]).hydrateTo(state);
2358
1445
  };
2359
1446
  const useClearError = (context) => {
2360
1447
  const { formId } = context;
2361
1448
  return useFormStore(formId, (state) => state.clearFieldError);
2362
1449
  };
2363
- const useCurrentDefaultValueForField = (formId, field) => useFormStore(formId, (state) => get_1(state.currentDefaultValues, field));
1450
+ const useCurrentDefaultValueForField = (formId, field) => useFormStore(formId, (state) => getPath(state.currentDefaultValues, field));
2364
1451
  const useFieldDefaultValue = (name, context) => {
2365
1452
  const defaultValues = useDefaultValuesForForm(context);
2366
1453
  const state = useCurrentDefaultValueForField(context.formId, name);
2367
- return defaultValues.map((val) => get_1(val, name)).hydrateTo(state);
1454
+ return defaultValues.map((val) => getPath(val, name)).hydrateTo(state);
2368
1455
  };
2369
1456
  const useInternalIsSubmitting = (formId) => useFormStore(formId, (state) => state.isSubmitting);
2370
1457
  const useInternalIsValid = (formId) => useFormStore(formId, (state) => state.isValid());
@@ -2373,15 +1460,21 @@ const useValidateField = (formId) => useFormStore(formId, (state) => state.valid
2373
1460
  const useValidate = (formId) => useFormStore(formId, (state) => state.validate);
2374
1461
  const noOpReceiver = () => () => {
2375
1462
  };
2376
- const useRegisterReceiveFocus = (formId) => useFormStore(formId, (state) => {
2377
- var _a, _b;
2378
- return (_b = (_a = state.formProps) == null ? void 0 : _a.registerReceiveFocus) != null ? _b : noOpReceiver;
2379
- });
1463
+ const useRegisterReceiveFocus = (formId) => useFormStore(
1464
+ formId,
1465
+ (state) => {
1466
+ var _a, _b;
1467
+ return (_b = (_a = state.formProps) == null ? void 0 : _a.registerReceiveFocus) != null ? _b : noOpReceiver;
1468
+ }
1469
+ );
2380
1470
  const defaultDefaultValues = {};
2381
- const useSyncedDefaultValues = (formId) => useFormStore(formId, (state) => {
2382
- var _a, _b;
2383
- return (_b = (_a = state.formProps) == null ? void 0 : _a.defaultValues) != null ? _b : defaultDefaultValues;
2384
- });
1471
+ const useSyncedDefaultValues = (formId) => useFormStore(
1472
+ formId,
1473
+ (state) => {
1474
+ var _a, _b;
1475
+ return (_b = (_a = state.formProps) == null ? void 0 : _a.defaultValues) != null ? _b : defaultDefaultValues;
1476
+ }
1477
+ );
2385
1478
  const useSetTouched = ({ formId }) => useFormStore(formId, (state) => state.setTouched);
2386
1479
  const useTouchedFields = (formId) => useFormStore(formId, (state) => state.touchedFields);
2387
1480
  const useFieldErrors = (formId) => useFormStore(formId, (state) => state.fieldErrors);
@@ -2398,18 +1491,33 @@ const useFormSubactionProp = (formId) => useFormStore(formId, (state) => {
2398
1491
  });
2399
1492
  const useFormValues = (formId) => useFormStore(formId, (state) => state.getValues);
2400
1493
  const useControlledFieldValue = (context, field) => {
2401
- const value = useFormStore(context.formId, (state) => state.controlledFields.getValue(field));
2402
- const isFormHydrated = useFormStore(context.formId, (state) => state.isHydrated);
1494
+ const value = useFormStore(
1495
+ context.formId,
1496
+ (state) => state.controlledFields.getValue(field)
1497
+ );
1498
+ const isFormHydrated = useFormStore(
1499
+ context.formId,
1500
+ (state) => state.isHydrated
1501
+ );
2403
1502
  const defaultValue = useFieldDefaultValue(field, context);
2404
1503
  return isFormHydrated ? value : defaultValue;
2405
1504
  };
2406
1505
  const useRegisterControlledField = (context, field) => {
2407
- const resolveUpdate = useFormStore(context.formId, (state) => state.controlledFields.valueUpdateResolvers[field]);
1506
+ const resolveUpdate = useFormStore(
1507
+ context.formId,
1508
+ (state) => state.controlledFields.valueUpdateResolvers[field]
1509
+ );
2408
1510
  useEffect(() => {
2409
1511
  resolveUpdate == null ? void 0 : resolveUpdate();
2410
1512
  }, [resolveUpdate]);
2411
- const register = useFormStore(context.formId, (state) => state.controlledFields.register);
2412
- const unregister = useFormStore(context.formId, (state) => state.controlledFields.unregister);
1513
+ const register = useFormStore(
1514
+ context.formId,
1515
+ (state) => state.controlledFields.register
1516
+ );
1517
+ const unregister = useFormStore(
1518
+ context.formId,
1519
+ (state) => state.controlledFields.unregister
1520
+ );
2413
1521
  useEffect(() => {
2414
1522
  register(field);
2415
1523
  return () => unregister(field);
@@ -2417,14 +1525,26 @@ const useRegisterControlledField = (context, field) => {
2417
1525
  };
2418
1526
  const useControllableValue = (context, field) => {
2419
1527
  useRegisterControlledField(context, field);
2420
- const setControlledFieldValue = useFormStore(context.formId, (state) => state.controlledFields.setValue);
2421
- const setValue = useCallback((value2) => setControlledFieldValue(field, value2), [field, setControlledFieldValue]);
1528
+ const setControlledFieldValue = useFormStore(
1529
+ context.formId,
1530
+ (state) => state.controlledFields.setValue
1531
+ );
1532
+ const setValue = useCallback(
1533
+ (value2) => setControlledFieldValue(field, value2),
1534
+ [field, setControlledFieldValue]
1535
+ );
2422
1536
  const value = useControlledFieldValue(context, field);
2423
1537
  return [value, setValue];
2424
1538
  };
2425
1539
  const useUpdateControllableValue = (formId) => {
2426
- const setValue = useFormStore(formId, (state) => state.controlledFields.setValue);
2427
- return useCallback((field, value) => setValue(field, value), [setValue]);
1540
+ const setValue = useFormStore(
1541
+ formId,
1542
+ (state) => state.controlledFields.setValue
1543
+ );
1544
+ return useCallback(
1545
+ (field, value) => setValue(field, value),
1546
+ [setValue]
1547
+ );
2428
1548
  };
2429
1549
  const useIsSubmitting = (formId) => {
2430
1550
  const formContext = useInternalFormContext(formId, "useIsSubmitting");
@@ -2459,14 +1579,16 @@ const useField = (name, options) => {
2459
1579
  touched,
2460
1580
  setTouched
2461
1581
  };
2462
- const getInputProps = createGetInputProps(__spreadProps(__spreadValues({}, helpers), {
1582
+ const getInputProps = createGetInputProps({
1583
+ ...helpers,
2463
1584
  name,
2464
1585
  hasBeenSubmitted,
2465
1586
  validationBehavior: options == null ? void 0 : options.validationBehavior
2466
- }));
2467
- return __spreadProps(__spreadValues({}, helpers), {
2468
- getInputProps
2469
1587
  });
1588
+ return {
1589
+ ...helpers,
1590
+ getInputProps
1591
+ };
2470
1592
  }, [
2471
1593
  error,
2472
1594
  clearError,
@@ -2507,123 +1629,25 @@ const json = (data, init = {}) => {
2507
1629
  if (!headers.has("Content-Type")) {
2508
1630
  headers.set("Content-Type", "application/json; charset=utf-8");
2509
1631
  }
2510
- return new Response(JSON.stringify(data), __spreadProps(__spreadValues({}, responseInit), {
1632
+ return new Response(JSON.stringify(data), {
1633
+ ...responseInit,
2511
1634
  headers
2512
- }));
1635
+ });
2513
1636
  };
2514
1637
  function validationError(error, repopulateFields, init) {
2515
- return json({
2516
- fieldErrors: error.fieldErrors,
2517
- subaction: error.subaction,
2518
- repopulateFields,
2519
- formId: error.formId
2520
- }, __spreadValues({ status: 422 }, init));
1638
+ return json(
1639
+ {
1640
+ fieldErrors: error.fieldErrors,
1641
+ subaction: error.subaction,
1642
+ repopulateFields,
1643
+ formId: error.formId
1644
+ },
1645
+ { status: 422, ...init }
1646
+ );
2521
1647
  }
2522
1648
  const setFormDefaults = (formId, defaultValues) => ({
2523
1649
  [formDefaultValuesKey(formId)]: defaultValues
2524
1650
  });
2525
- function baseFindIndex$1(array, predicate, fromIndex, fromRight) {
2526
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
2527
- while (fromRight ? index-- : ++index < length) {
2528
- if (predicate(array[index], index, array)) {
2529
- return index;
2530
- }
2531
- }
2532
- return -1;
2533
- }
2534
- var _baseFindIndex = baseFindIndex$1;
2535
- function baseIsNaN$1(value) {
2536
- return value !== value;
2537
- }
2538
- var _baseIsNaN = baseIsNaN$1;
2539
- function strictIndexOf$1(array, value, fromIndex) {
2540
- var index = fromIndex - 1, length = array.length;
2541
- while (++index < length) {
2542
- if (array[index] === value) {
2543
- return index;
2544
- }
2545
- }
2546
- return -1;
2547
- }
2548
- var _strictIndexOf = strictIndexOf$1;
2549
- var baseFindIndex = _baseFindIndex, baseIsNaN = _baseIsNaN, strictIndexOf = _strictIndexOf;
2550
- function baseIndexOf$1(array, value, fromIndex) {
2551
- return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
2552
- }
2553
- var _baseIndexOf = baseIndexOf$1;
2554
- var baseIndexOf = _baseIndexOf;
2555
- function arrayIncludes$1(array, value) {
2556
- var length = array == null ? 0 : array.length;
2557
- return !!length && baseIndexOf(array, value, 0) > -1;
2558
- }
2559
- var _arrayIncludes = arrayIncludes$1;
2560
- function arrayIncludesWith$1(array, value, comparator) {
2561
- var index = -1, length = array == null ? 0 : array.length;
2562
- while (++index < length) {
2563
- if (comparator(value, array[index])) {
2564
- return true;
2565
- }
2566
- }
2567
- return false;
2568
- }
2569
- var _arrayIncludesWith = arrayIncludesWith$1;
2570
- function noop$1() {
2571
- }
2572
- var noop_1 = noop$1;
2573
- var Set$1 = _Set, noop = noop_1, setToArray$1 = _setToArray;
2574
- var INFINITY = 1 / 0;
2575
- var createSet$1 = !(Set$1 && 1 / setToArray$1(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
2576
- return new Set$1(values);
2577
- };
2578
- var _createSet = createSet$1;
2579
- var SetCache = _SetCache, arrayIncludes = _arrayIncludes, arrayIncludesWith = _arrayIncludesWith, cacheHas = _cacheHas, createSet = _createSet, setToArray = _setToArray;
2580
- var LARGE_ARRAY_SIZE = 200;
2581
- function baseUniq$1(array, iteratee, comparator) {
2582
- var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
2583
- if (comparator) {
2584
- isCommon = false;
2585
- includes = arrayIncludesWith;
2586
- } else if (length >= LARGE_ARRAY_SIZE) {
2587
- var set2 = iteratee ? null : createSet(array);
2588
- if (set2) {
2589
- return setToArray(set2);
2590
- }
2591
- isCommon = false;
2592
- includes = cacheHas;
2593
- seen = new SetCache();
2594
- } else {
2595
- seen = iteratee ? [] : result;
2596
- }
2597
- outer:
2598
- while (++index < length) {
2599
- var value = array[index], computed = iteratee ? iteratee(value) : value;
2600
- value = comparator || value !== 0 ? value : 0;
2601
- if (isCommon && computed === computed) {
2602
- var seenIndex = seen.length;
2603
- while (seenIndex--) {
2604
- if (seen[seenIndex] === computed) {
2605
- continue outer;
2606
- }
2607
- }
2608
- if (iteratee) {
2609
- seen.push(computed);
2610
- }
2611
- result.push(value);
2612
- } else if (!includes(seen, computed, comparator)) {
2613
- if (seen !== result) {
2614
- seen.push(computed);
2615
- }
2616
- result.push(value);
2617
- }
2618
- }
2619
- return result;
2620
- }
2621
- var _baseUniq = baseUniq$1;
2622
- var baseUniq = _baseUniq;
2623
- function uniq(array) {
2624
- return array && array.length ? baseUniq(array) : [];
2625
- }
2626
- var uniq_1 = uniq;
2627
1651
  class MultiValueMap {
2628
1652
  constructor() {
2629
1653
  this.dict = /* @__PURE__ */ new Map();
@@ -2677,11 +1701,6 @@ function useSubmitComplete(isSubmitting, callback) {
2677
1701
  }
2678
1702
  });
2679
1703
  }
2680
- var baseIsEqual = _baseIsEqual;
2681
- function isEqual(value, other) {
2682
- return baseIsEqual(value, other);
2683
- }
2684
- var isEqual_1 = isEqual;
2685
1704
  const mergeRefs = (refs) => {
2686
1705
  return (value) => {
2687
1706
  refs.filter(Boolean).forEach((ref) => {
@@ -2696,7 +1715,7 @@ const mergeRefs = (refs) => {
2696
1715
  const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
2697
1716
  const useDeepEqualsMemo = (item) => {
2698
1717
  const ref = useRef(item);
2699
- const areEqual = ref.current === item || isEqual_1(ref.current, item);
1718
+ const areEqual = ref.current === item || equals(ref.current, item);
2700
1719
  useEffect(() => {
2701
1720
  if (!areEqual) {
2702
1721
  ref.current = item;
@@ -2716,7 +1735,7 @@ const focusFirstInvalidInput = (fieldErrors, customFocusHandlers, formElement) =
2716
1735
  return input.name;
2717
1736
  return null;
2718
1737
  }).filter(nonNull).filter((name) => name in fieldErrors);
2719
- const uniqueNamesInOrder = uniq_1(namesInOrder);
1738
+ const uniqueNamesInOrder = uniq(namesInOrder);
2720
1739
  for (const fieldName of uniqueNamesInOrder) {
2721
1740
  if (customFocusHandlers.has(fieldName)) {
2722
1741
  customFocusHandlers.getAll(fieldName).forEach((handler) => {
@@ -2728,7 +1747,9 @@ const focusFirstInvalidInput = (fieldErrors, customFocusHandlers, formElement) =
2728
1747
  if (!elem)
2729
1748
  continue;
2730
1749
  if (elem instanceof RadioNodeList) {
2731
- const selectedRadio = (_a = [...elem].filter((item) => item instanceof HTMLInputElement).find((item) => item.value === elem.value)) != null ? _a : elem[0];
1750
+ const selectedRadio = (_a = [...elem].filter(
1751
+ (item) => item instanceof HTMLInputElement
1752
+ ).find((item) => item.value === elem.value)) != null ? _a : elem[0];
2732
1753
  if (selectedRadio && selectedRadio instanceof HTMLInputElement) {
2733
1754
  selectedRadio.focus();
2734
1755
  break;
@@ -2777,53 +1798,41 @@ function formEventProxy(event) {
2777
1798
  }
2778
1799
  });
2779
1800
  }
2780
- function ValidatedForm(_a) {
2781
- var _b = _a, {
2782
- validator,
2783
- onSubmit,
2784
- children,
2785
- fetcher,
2786
- action,
2787
- defaultValues: unMemoizedDefaults,
2788
- formRef: formRefProp,
2789
- onReset,
2790
- subaction,
2791
- resetAfterSubmit = false,
2792
- disableFocusOnError,
2793
- method,
2794
- replace: replace2,
2795
- id
2796
- } = _b, rest = __objRest(_b, [
2797
- "validator",
2798
- "onSubmit",
2799
- "children",
2800
- "fetcher",
2801
- "action",
2802
- "defaultValues",
2803
- "formRef",
2804
- "onReset",
2805
- "subaction",
2806
- "resetAfterSubmit",
2807
- "disableFocusOnError",
2808
- "method",
2809
- "replace",
2810
- "id"
2811
- ]);
2812
- var _a2;
1801
+ function ValidatedForm({
1802
+ validator,
1803
+ onSubmit,
1804
+ children,
1805
+ fetcher,
1806
+ action,
1807
+ defaultValues: unMemoizedDefaults,
1808
+ formRef: formRefProp,
1809
+ onReset,
1810
+ subaction,
1811
+ resetAfterSubmit = false,
1812
+ disableFocusOnError,
1813
+ method,
1814
+ replace: replace2,
1815
+ id,
1816
+ ...rest
1817
+ }) {
1818
+ var _a;
2813
1819
  const formId = useFormId(id);
2814
1820
  const providedDefaultValues = useDeepEqualsMemo(unMemoizedDefaults);
2815
- const contextValue = useMemo(() => ({
2816
- formId,
2817
- action,
2818
- subaction,
2819
- defaultValuesProp: providedDefaultValues,
2820
- fetcher
2821
- }), [action, fetcher, formId, providedDefaultValues, subaction]);
1821
+ const contextValue = useMemo(
1822
+ () => ({
1823
+ formId,
1824
+ action,
1825
+ subaction,
1826
+ defaultValuesProp: providedDefaultValues,
1827
+ fetcher
1828
+ }),
1829
+ [action, fetcher, formId, providedDefaultValues, subaction]
1830
+ );
2822
1831
  const backendError = useErrorResponseForForm(contextValue);
2823
1832
  const backendDefaultValues = useDefaultValuesFromLoader(contextValue);
2824
1833
  const hasActiveSubmission = useHasActiveFormSubmit(contextValue);
2825
1834
  const formRef = useRef(null);
2826
- const Form$1 = (_a2 = fetcher == null ? void 0 : fetcher.Form) != null ? _a2 : Form;
1835
+ const Form$1 = (_a = fetcher == null ? void 0 : fetcher.Form) != null ? _a : Form;
2827
1836
  const submit = useSubmit();
2828
1837
  const setFieldErrors = useSetFieldErrors(formId);
2829
1838
  const setFieldError = useFormStore(formId, (state) => state.setFieldError);
@@ -2831,25 +1840,31 @@ function ValidatedForm(_a) {
2831
1840
  const startSubmit = useFormStore(formId, (state) => state.startSubmit);
2832
1841
  const endSubmit = useFormStore(formId, (state) => state.endSubmit);
2833
1842
  const syncFormProps = useFormStore(formId, (state) => state.syncFormProps);
2834
- const setFormElementInState = useFormStore(formId, (state) => state.setFormElement);
1843
+ const setFormElementInState = useFormStore(
1844
+ formId,
1845
+ (state) => state.setFormElement
1846
+ );
2835
1847
  const cleanupForm = useRootFormStore((state) => state.cleanupForm);
2836
1848
  const registerForm = useRootFormStore((state) => state.registerForm);
2837
1849
  const customFocusHandlers = useMultiValueMap();
2838
- const registerReceiveFocus = useCallback((fieldName, handler) => {
2839
- customFocusHandlers().add(fieldName, handler);
2840
- return () => {
2841
- customFocusHandlers().remove(fieldName, handler);
2842
- };
2843
- }, [customFocusHandlers]);
1850
+ const registerReceiveFocus = useCallback(
1851
+ (fieldName, handler) => {
1852
+ customFocusHandlers().add(fieldName, handler);
1853
+ return () => {
1854
+ customFocusHandlers().remove(fieldName, handler);
1855
+ };
1856
+ },
1857
+ [customFocusHandlers]
1858
+ );
2844
1859
  useIsomorphicLayoutEffect(() => {
2845
1860
  registerForm(formId);
2846
1861
  return () => cleanupForm(formId);
2847
1862
  }, [cleanupForm, formId, registerForm]);
2848
1863
  useIsomorphicLayoutEffect(() => {
2849
- var _a3;
1864
+ var _a2;
2850
1865
  syncFormProps({
2851
1866
  action,
2852
- defaultValues: (_a3 = providedDefaultValues != null ? providedDefaultValues : backendDefaultValues) != null ? _a3 : {},
1867
+ defaultValues: (_a2 = providedDefaultValues != null ? providedDefaultValues : backendDefaultValues) != null ? _a2 : {},
2853
1868
  subaction,
2854
1869
  registerReceiveFocus,
2855
1870
  validator
@@ -2867,45 +1882,61 @@ function ValidatedForm(_a) {
2867
1882
  setFormElementInState(formRef.current);
2868
1883
  }, [setFormElementInState]);
2869
1884
  useEffect(() => {
2870
- var _a3;
2871
- setFieldErrors((_a3 = backendError == null ? void 0 : backendError.fieldErrors) != null ? _a3 : {});
1885
+ var _a2;
1886
+ setFieldErrors((_a2 = backendError == null ? void 0 : backendError.fieldErrors) != null ? _a2 : {});
2872
1887
  }, [backendError == null ? void 0 : backendError.fieldErrors, setFieldErrors, setFieldError]);
2873
1888
  useSubmitComplete(hasActiveSubmission, () => {
2874
1889
  endSubmit();
2875
1890
  });
2876
1891
  const handleSubmit = async (e2, target, nativeEvent) => {
2877
1892
  startSubmit();
2878
- const result = await validator.validate(getDataFromForm(e2.currentTarget));
1893
+ const submitter = nativeEvent.submitter;
1894
+ const formDataToValidate = getDataFromForm(e2.currentTarget);
1895
+ if (submitter == null ? void 0 : submitter.name) {
1896
+ formDataToValidate.append(submitter.name, submitter.value);
1897
+ }
1898
+ const result = await validator.validate(formDataToValidate);
2879
1899
  if (result.error) {
2880
- endSubmit();
2881
1900
  setFieldErrors(result.error.fieldErrors);
1901
+ endSubmit();
2882
1902
  if (!disableFocusOnError) {
2883
- focusFirstInvalidInput(result.error.fieldErrors, customFocusHandlers(), formRef.current);
1903
+ focusFirstInvalidInput(
1904
+ result.error.fieldErrors,
1905
+ customFocusHandlers(),
1906
+ formRef.current
1907
+ );
2884
1908
  }
2885
1909
  } else {
1910
+ setFieldErrors({});
2886
1911
  const eventProxy = formEventProxy(e2);
2887
1912
  await (onSubmit == null ? void 0 : onSubmit(result.data, eventProxy));
2888
1913
  if (eventProxy.defaultPrevented) {
2889
1914
  endSubmit();
2890
1915
  return;
2891
1916
  }
2892
- const submitter = nativeEvent.submitter;
2893
1917
  if (fetcher)
2894
1918
  fetcher.submit(submitter || e2.currentTarget);
2895
1919
  else
2896
- submit(submitter || target, { replace: replace2 });
1920
+ submit(submitter || target, {
1921
+ replace: replace2,
1922
+ method: (submitter == null ? void 0 : submitter.formMethod) || method
1923
+ });
2897
1924
  }
2898
1925
  };
2899
- return /* @__PURE__ */ React.createElement(Form$1, __spreadProps(__spreadValues({
2900
- ref: mergeRefs([formRef, formRefProp])
2901
- }, rest), {
1926
+ return /* @__PURE__ */ React.createElement(Form$1, {
1927
+ ref: mergeRefs([formRef, formRefProp]),
1928
+ ...rest,
2902
1929
  id,
2903
1930
  action,
2904
1931
  method,
2905
1932
  replace: replace2,
2906
1933
  onSubmit: (e2) => {
2907
1934
  e2.preventDefault();
2908
- handleSubmit(e2, e2.currentTarget, e2.nativeEvent);
1935
+ handleSubmit(
1936
+ e2,
1937
+ e2.currentTarget,
1938
+ e2.nativeEvent
1939
+ );
2909
1940
  },
2910
1941
  onReset: (event) => {
2911
1942
  onReset == null ? void 0 : onReset(event);
@@ -2913,7 +1944,7 @@ function ValidatedForm(_a) {
2913
1944
  return;
2914
1945
  reset();
2915
1946
  }
2916
- }), /* @__PURE__ */ React.createElement(InternalFormContext.Provider, {
1947
+ }, /* @__PURE__ */ React.createElement(InternalFormContext.Provider, {
2917
1948
  value: contextValue
2918
1949
  }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormResetter, {
2919
1950
  formRef,
@@ -2931,18 +1962,22 @@ function ValidatedForm(_a) {
2931
1962
  const objectFromPathEntries = (entries) => {
2932
1963
  const map = new MultiValueMap();
2933
1964
  entries.forEach(([key, value]) => map.add(key, value));
2934
- return [...map.entries()].reduce((acc, [key, value]) => set_1(acc, key, value.length === 1 ? value[0] : value), {});
1965
+ return [...map.entries()].reduce(
1966
+ (acc, [key, value]) => set(acc, key, value.length === 1 ? value[0] : value),
1967
+ {}
1968
+ );
2935
1969
  };
2936
1970
  const preprocessFormData = (data) => {
2937
1971
  if ("entries" in data && typeof data.entries === "function")
2938
1972
  return objectFromPathEntries([...data.entries()]);
2939
1973
  return objectFromPathEntries(Object.entries(data));
2940
1974
  };
1975
+ const omitInternalFields = (data) => omit(data, [FORM_ID_FIELD]);
2941
1976
  function createValidator(validator) {
2942
1977
  return {
2943
1978
  validate: async (value) => {
2944
1979
  const data = preprocessFormData(value);
2945
- const result = await validator.validate(data);
1980
+ const result = await validator.validate(omitInternalFields(data));
2946
1981
  if (result.error) {
2947
1982
  return {
2948
1983
  data: void 0,
@@ -2979,25 +2014,28 @@ const useFormState = (formId) => {
2979
2014
  const fieldErrorsFromState = useFieldErrors(formContext.formId);
2980
2015
  const fieldErrorsToUse = useFieldErrorsForForm(formContext);
2981
2016
  const hydratedFieldErrors = fieldErrorsToUse.hydrateTo(fieldErrorsFromState);
2982
- return useMemo(() => ({
2983
- action,
2984
- subaction,
2985
- defaultValues: hydratedDefaultValues,
2986
- fieldErrors: hydratedFieldErrors != null ? hydratedFieldErrors : {},
2987
- hasBeenSubmitted,
2988
- isSubmitting,
2989
- touchedFields,
2990
- isValid
2991
- }), [
2992
- action,
2993
- hasBeenSubmitted,
2994
- hydratedDefaultValues,
2995
- hydratedFieldErrors,
2996
- isSubmitting,
2997
- isValid,
2998
- subaction,
2999
- touchedFields
3000
- ]);
2017
+ return useMemo(
2018
+ () => ({
2019
+ action,
2020
+ subaction,
2021
+ defaultValues: hydratedDefaultValues,
2022
+ fieldErrors: hydratedFieldErrors != null ? hydratedFieldErrors : {},
2023
+ hasBeenSubmitted,
2024
+ isSubmitting,
2025
+ touchedFields,
2026
+ isValid
2027
+ }),
2028
+ [
2029
+ action,
2030
+ hasBeenSubmitted,
2031
+ hydratedDefaultValues,
2032
+ hydratedFieldErrors,
2033
+ isSubmitting,
2034
+ isValid,
2035
+ subaction,
2036
+ touchedFields
2037
+ ]
2038
+ );
3001
2039
  };
3002
2040
  const useFormHelpers = (formId) => {
3003
2041
  const formContext = useInternalFormContext(formId, "useFormHelpers");
@@ -3009,25 +2047,28 @@ const useFormHelpers = (formId) => {
3009
2047
  const reset = useResetFormElement(formContext.formId);
3010
2048
  const submit = useSubmitForm(formContext.formId);
3011
2049
  const getValues = useFormValues(formContext.formId);
3012
- return useMemo(() => ({
3013
- setTouched,
3014
- validateField,
3015
- clearError,
3016
- validate,
3017
- clearAllErrors: () => setFieldErrors({}),
3018
- reset,
3019
- submit,
3020
- getValues
3021
- }), [
3022
- clearError,
3023
- reset,
3024
- setFieldErrors,
3025
- setTouched,
3026
- submit,
3027
- validate,
3028
- validateField,
3029
- getValues
3030
- ]);
2050
+ return useMemo(
2051
+ () => ({
2052
+ setTouched,
2053
+ validateField,
2054
+ clearError,
2055
+ validate,
2056
+ clearAllErrors: () => setFieldErrors({}),
2057
+ reset,
2058
+ submit,
2059
+ getValues
2060
+ }),
2061
+ [
2062
+ clearError,
2063
+ reset,
2064
+ setFieldErrors,
2065
+ setTouched,
2066
+ submit,
2067
+ validate,
2068
+ validateField,
2069
+ getValues
2070
+ ]
2071
+ );
3031
2072
  };
3032
2073
  const useFormContext = (formId) => {
3033
2074
  const context = useInternalFormContext(formId, "useFormContext");
@@ -3043,33 +2084,40 @@ const useFormContext = (formId) => {
3043
2084
  getValues
3044
2085
  } = useFormHelpers(formId);
3045
2086
  const registerReceiveFocus = useRegisterReceiveFocus(context.formId);
3046
- const clearError = useCallback((...names) => {
3047
- names.forEach((name) => {
3048
- internalClearError(name);
3049
- });
3050
- }, [internalClearError]);
3051
- return useMemo(() => __spreadProps(__spreadValues({}, state), {
3052
- setFieldTouched: setTouched,
3053
- validateField,
3054
- clearError,
3055
- registerReceiveFocus,
3056
- clearAllErrors,
3057
- validate,
3058
- reset,
3059
- submit,
3060
- getValues
3061
- }), [
3062
- clearAllErrors,
3063
- clearError,
3064
- registerReceiveFocus,
3065
- reset,
3066
- setTouched,
3067
- state,
3068
- submit,
3069
- validate,
3070
- validateField,
3071
- getValues
3072
- ]);
2087
+ const clearError = useCallback(
2088
+ (...names) => {
2089
+ names.forEach((name) => {
2090
+ internalClearError(name);
2091
+ });
2092
+ },
2093
+ [internalClearError]
2094
+ );
2095
+ return useMemo(
2096
+ () => ({
2097
+ ...state,
2098
+ setFieldTouched: setTouched,
2099
+ validateField,
2100
+ clearError,
2101
+ registerReceiveFocus,
2102
+ clearAllErrors,
2103
+ validate,
2104
+ reset,
2105
+ submit,
2106
+ getValues
2107
+ }),
2108
+ [
2109
+ clearAllErrors,
2110
+ clearError,
2111
+ registerReceiveFocus,
2112
+ reset,
2113
+ setTouched,
2114
+ state,
2115
+ submit,
2116
+ validate,
2117
+ validateField,
2118
+ getValues
2119
+ ]
2120
+ );
3073
2121
  };
3074
2122
  const useInternalFieldArray = (context, field, validationBehavior) => {
3075
2123
  const value = useFieldDefaultValue(field, context);
@@ -3077,52 +2125,62 @@ const useInternalFieldArray = (context, field, validationBehavior) => {
3077
2125
  const hasBeenSubmitted = useInternalHasBeenSubmitted(context.formId);
3078
2126
  const validateField = useValidateField(context.formId);
3079
2127
  const error = useFieldError(field, context);
3080
- const resolvedValidationBehavior = __spreadValues({
2128
+ const resolvedValidationBehavior = {
3081
2129
  initial: "onSubmit",
3082
- whenSubmitted: "onChange"
3083
- }, validationBehavior);
2130
+ whenSubmitted: "onChange",
2131
+ ...validationBehavior
2132
+ };
3084
2133
  const behavior = hasBeenSubmitted ? resolvedValidationBehavior.whenSubmitted : resolvedValidationBehavior.initial;
3085
2134
  const maybeValidate = useCallback(() => {
3086
2135
  if (behavior === "onChange") {
3087
2136
  validateField(field);
3088
2137
  }
3089
2138
  }, [behavior, field, validateField]);
3090
- invariant(value === void 0 || value === null || Array.isArray(value), `FieldArray: defaultValue value for ${field} must be an array, null, or undefined`);
3091
- const arr = useFormStore(context.formId, (state) => state.controlledFields.array);
3092
- const helpers = useMemo(() => ({
3093
- push: (item) => {
3094
- arr.push(field, item);
3095
- maybeValidate();
3096
- },
3097
- swap: (indexA, indexB) => {
3098
- arr.swap(field, indexA, indexB);
3099
- maybeValidate();
3100
- },
3101
- move: (from2, to) => {
3102
- arr.move(field, from2, to);
3103
- maybeValidate();
3104
- },
3105
- insert: (index, value2) => {
3106
- arr.insert(field, index, value2);
3107
- maybeValidate();
3108
- },
3109
- unshift: (value2) => {
3110
- arr.unshift(field, value2);
3111
- maybeValidate();
3112
- },
3113
- remove: (index) => {
3114
- arr.remove(field, index);
3115
- maybeValidate();
3116
- },
3117
- pop: () => {
3118
- arr.pop(field);
3119
- maybeValidate();
3120
- },
3121
- replace: (index, value2) => {
3122
- arr.replace(field, index, value2);
3123
- maybeValidate();
3124
- }
3125
- }), [arr, field, maybeValidate]);
2139
+ invariant(
2140
+ value === void 0 || value === null || Array.isArray(value),
2141
+ `FieldArray: defaultValue value for ${field} must be an array, null, or undefined`
2142
+ );
2143
+ const arr = useFormStore(
2144
+ context.formId,
2145
+ (state) => state.controlledFields.array
2146
+ );
2147
+ const helpers = useMemo(
2148
+ () => ({
2149
+ push: (item) => {
2150
+ arr.push(field, item);
2151
+ maybeValidate();
2152
+ },
2153
+ swap: (indexA, indexB) => {
2154
+ arr.swap(field, indexA, indexB);
2155
+ maybeValidate();
2156
+ },
2157
+ move: (from2, to) => {
2158
+ arr.move(field, from2, to);
2159
+ maybeValidate();
2160
+ },
2161
+ insert: (index, value2) => {
2162
+ arr.insert(field, index, value2);
2163
+ maybeValidate();
2164
+ },
2165
+ unshift: (value2) => {
2166
+ arr.unshift(field, value2);
2167
+ maybeValidate();
2168
+ },
2169
+ remove: (index) => {
2170
+ arr.remove(field, index);
2171
+ maybeValidate();
2172
+ },
2173
+ pop: () => {
2174
+ arr.pop(field);
2175
+ maybeValidate();
2176
+ },
2177
+ replace: (index, value2) => {
2178
+ arr.replace(field, index, value2);
2179
+ maybeValidate();
2180
+ }
2181
+ }),
2182
+ [arr, field, maybeValidate]
2183
+ );
3126
2184
  const arrayValue = useMemo(() => value != null ? value : [], [value]);
3127
2185
  return [arrayValue, helpers, error];
3128
2186
  };
@@ -3137,8 +2195,12 @@ const FieldArray = ({
3137
2195
  validationBehavior
3138
2196
  }) => {
3139
2197
  const context = useInternalFormContext(formId, "FieldArray");
3140
- const [value, helpers, error] = useInternalFieldArray(context, name, validationBehavior);
3141
- return children(value, helpers, error);
2198
+ const [value, helpers, error] = useInternalFieldArray(
2199
+ context,
2200
+ name,
2201
+ validationBehavior
2202
+ );
2203
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, children(value, helpers, error));
3142
2204
  };
3143
2205
  export { FieldArray, ValidatedForm, createValidator, setFormDefaults, useControlField, useField, useFieldArray, useFormContext, useIsSubmitting, useIsValid, useUpdateControlledField, validationError };
3144
2206
  //# sourceMappingURL=remix-validated-form.es.js.map