@reformer/core 8.0.0 → 9.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/core/factories/node-factory.d.ts +5 -4
  2. package/dist/core/model/types.d.ts +41 -12
  3. package/dist/core/model/validate-model.d.ts +8 -4
  4. package/dist/core/nodes/field-node.d.ts +2 -2
  5. package/dist/core/nodes/group-node.d.ts +7 -1
  6. package/dist/core/nodes/model-array-node.d.ts +5 -0
  7. package/dist/core/types/deep-schema.d.ts +16 -4
  8. package/dist/core/types/form-proxy.d.ts +1 -1
  9. package/dist/core/types/index.d.ts +4 -10
  10. package/dist/core/types/schema-node.d.ts +79 -0
  11. package/dist/core/types/validation-schema.d.ts +22 -11
  12. package/dist/core/utils/create-form.d.ts +4 -3
  13. package/dist/core/utils/error-handler.d.ts +4 -1
  14. package/dist/core/utils/form-submitter.d.ts +2 -3
  15. package/dist/core/utils/type-guards.d.ts +3 -3
  16. package/dist/core/validation/validators/date-utils.d.ts +5 -1
  17. package/dist/core/validation/validators/integer.d.ts +1 -1
  18. package/dist/core/validation/validators/is-number.d.ts +1 -1
  19. package/dist/core/validation/validators/max.d.ts +1 -1
  20. package/dist/core/validation/validators/min.d.ts +1 -1
  21. package/dist/core/validation/validators/multiple-of.d.ts +1 -1
  22. package/dist/core/validation/validators/non-negative.d.ts +1 -1
  23. package/dist/core/validation/validators/non-zero.d.ts +1 -1
  24. package/dist/{date-utils-xUWFslTj.js → date-utils-dTT_x_Be.js} +12 -10
  25. package/dist/hooks/types.d.ts +1 -1
  26. package/dist/hooks/useArrayLength.d.ts +1 -2
  27. package/dist/hooks/useFormControl.d.ts +2 -2
  28. package/dist/index.js +514 -514
  29. package/dist/signals.d.ts +13 -0
  30. package/dist/signals.js +9 -0
  31. package/dist/validators/future-date.js +1 -1
  32. package/dist/validators/is-date.js +1 -1
  33. package/dist/validators/max-age.js +1 -1
  34. package/dist/validators/max-date.js +1 -1
  35. package/dist/validators/min-age.js +1 -1
  36. package/dist/validators/min-date.js +1 -1
  37. package/dist/validators/multiple-of.js +11 -7
  38. package/dist/validators/past-date.js +1 -1
  39. package/llms.txt +568 -155
  40. package/package.json +6 -2
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { signal as y, computed as h, effect as _, batch as me, Signal as ie } from "@preact/signals-core";
2
- import { i as B, d as ye, g as Y } from "./behaviors-O9a1Djj9.js";
3
- import { j as rt, c as nt, k as at, e as ot, m as lt, a as ut, b as ct, r as ht, f as dt, h as ft, s as pt, t as vt, w as mt } from "./behaviors-O9a1Djj9.js";
4
- import re, { useRef as q, useCallback as S } from "react";
5
- import { default as gt } from "./validators.js";
6
- class I {
1
+ import { signal as y, computed as h, effect as _, batch as me, Signal as re } from "@preact/signals-core";
2
+ import { i as B, d as ye, g as Q } from "./behaviors-O9a1Djj9.js";
3
+ import { j as nt, c as at, k as ot, e as lt, m as ut, a as ct, b as ht, r as dt, f as ft, h as pt, s as vt, t as mt, w as yt } from "./behaviors-O9a1Djj9.js";
4
+ import ne, { useRef as q, useCallback as E } from "react";
5
+ import { default as bt } from "./validators.js";
6
+ class D {
7
7
  // ============================================================================
8
8
  // Protected состояние (для Template Method паттерна)
9
9
  // ============================================================================
@@ -97,17 +97,17 @@ class I {
97
97
  */
98
98
  getErrors(e) {
99
99
  const t = this.errors.value;
100
- return e ? t.filter((i) => {
101
- if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(i.code) || e.message !== void 0 && !i.message.toLowerCase().includes(e.message.toLowerCase()))
100
+ return e ? t.filter((s) => {
101
+ if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(s.code) || e.message !== void 0 && !s.message.toLowerCase().includes(e.message.toLowerCase()))
102
102
  return !1;
103
103
  if (e.params !== void 0) {
104
- if (!i.params)
104
+ if (!s.params)
105
105
  return !1;
106
106
  for (const [r, n] of Object.entries(e.params))
107
- if (i.params[r] !== n)
107
+ if (s.params[r] !== n)
108
108
  return !1;
109
109
  }
110
- return !(e.predicate !== void 0 && !e.predicate(i));
110
+ return !(e.predicate !== void 0 && !e.predicate(s));
111
111
  }) : t;
112
112
  }
113
113
  // ============================================================================
@@ -448,7 +448,7 @@ class K {
448
448
  this.clear();
449
449
  }
450
450
  }
451
- const O = {
451
+ const k = {
452
452
  /** FieldNode.watch() */
453
453
  Watch: "watch",
454
454
  /** FieldNode.computeFrom() */
@@ -463,53 +463,14 @@ const O = {
463
463
  WatchLength: "watchLength"
464
464
  };
465
465
  let ge = 0;
466
- function N(s) {
467
- return `${s}-${++ge}`;
466
+ function V(i) {
467
+ return `${i}-${++ge}`;
468
468
  }
469
- var w = /* @__PURE__ */ ((s) => (s.THROW = "throw", s.LOG = "log", s.CONVERT = "convert", s))(w || {});
470
- class k {
471
- /**
472
- * Обработать ошибку согласно заданной стратегии
473
- *
474
- * @param error Ошибка для обработки (Error | string | unknown)
475
- * @param context Контекст ошибки для логирования (например, 'AsyncValidator', 'BehaviorRegistry')
476
- * @param strategy Стратегия обработки (THROW | LOG | CONVERT)
477
- * @returns ValidationError если strategy = CONVERT, undefined если strategy = LOG, никогда не возвращается если strategy = THROW
478
- *
479
- * @example
480
- * ```typescript
481
- * // THROW - пробросить ошибку
482
- * try {
483
- * riskyOperation();
484
- * } catch (error) {
485
- * FormErrorHandler.handle(error, 'RiskyOperation', ErrorStrategy.THROW);
486
- * // Этот код никогда не выполнится
487
- * }
488
- *
489
- * // LOG - залогировать и продолжить
490
- * try {
491
- * nonCriticalOperation();
492
- * } catch (error) {
493
- * FormErrorHandler.handle(error, 'NonCritical', ErrorStrategy.LOG);
494
- * // Продолжаем выполнение
495
- * }
496
- *
497
- * // CONVERT - конвертировать в ValidationError
498
- * try {
499
- * await validator(value);
500
- * } catch (error) {
501
- * const validationError = FormErrorHandler.handle(
502
- * error,
503
- * 'AsyncValidator',
504
- * ErrorStrategy.CONVERT
505
- * );
506
- * return validationError;
507
- * }
508
- * ```
509
- */
510
- static handle(e, t, i = "throw") {
469
+ var S = /* @__PURE__ */ ((i) => (i.THROW = "throw", i.LOG = "log", i.CONVERT = "convert", i))(S || {});
470
+ class O {
471
+ static handle(e, t, s = "throw") {
511
472
  const r = this.extractMessage(e);
512
- switch (i) {
473
+ switch (s) {
513
474
  case "throw":
514
475
  throw e;
515
476
  case "log":
@@ -573,11 +534,11 @@ class k {
573
534
  * // { code: 'required', message: 'This field is required', field: 'email' }
574
535
  * ```
575
536
  */
576
- static createValidationError(e, t, i) {
537
+ static createValidationError(e, t, s) {
577
538
  return {
578
539
  code: e,
579
540
  message: t,
580
- params: i ? { field: i } : void 0
541
+ params: s ? { field: s } : void 0
581
542
  };
582
543
  }
583
544
  /**
@@ -649,7 +610,7 @@ class be {
649
610
  * ```
650
611
  */
651
612
  completeValidation(e) {
652
- (this._status.value === "pending" || this._status.value !== "disabled") && (this._status.value = e ? "invalid" : "valid");
613
+ this._status.value !== "disabled" && (this._status.value = e ? "invalid" : "valid");
653
614
  }
654
615
  /**
655
616
  * Установить ошибки напрямую (без перехода через pending)
@@ -744,7 +705,7 @@ class be {
744
705
  return this._status.value !== "disabled";
745
706
  }
746
707
  }
747
- class _e extends I {
708
+ class _e extends D {
748
709
  // ============================================================================
749
710
  // Приватные сигналы
750
711
  // ============================================================================
@@ -752,7 +713,6 @@ class _e extends I {
752
713
  _errors;
753
714
  // _touched, _dirty наследуются от FormNode (protected)
754
715
  // _status управляется через statusMachine
755
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
756
716
  _componentProps;
757
717
  /**
758
718
  * State machine для управления статусом поля
@@ -772,7 +732,6 @@ class _e extends I {
772
732
  disabled;
773
733
  // touched, dirty наследуются от FormNode
774
734
  errors;
775
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
776
735
  componentProps;
777
736
  /**
778
737
  * Вычисляемое свойство: нужно ли показывать ошибку
@@ -817,12 +776,12 @@ class _e extends I {
817
776
  setValue(e, t) {
818
777
  if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
819
778
  return;
820
- const i = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
779
+ const s = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
821
780
  if (this.updateOn === "change") {
822
781
  this.validate();
823
782
  return;
824
783
  }
825
- r && i && this.validate();
784
+ r && s && this.validate();
826
785
  }
827
786
  patchValue(e) {
828
787
  this.setValue(e);
@@ -915,17 +874,17 @@ class _e extends I {
915
874
  const t = e?.debounce ?? this.debounceMs;
916
875
  if (this.cancelPendingValidation(), t <= 0 || this.asyncValidators.length === 0)
917
876
  return this.validateImmediate();
918
- const i = new AbortController();
877
+ const s = new AbortController();
919
878
  return new Promise((r) => {
920
- this.pendingValidation = { resolve: r, abortController: i }, this.validateDebounceTimer = setTimeout(async () => {
921
- if (this.validateDebounceTimer = void 0, i.signal.aborted) {
879
+ this.pendingValidation = { resolve: r, abortController: s }, this.validateDebounceTimer = setTimeout(async () => {
880
+ if (this.validateDebounceTimer = void 0, s.signal.aborted) {
922
881
  r(!1);
923
882
  return;
924
883
  }
925
884
  this.pendingValidation = void 0;
926
- const n = await this.validateImmediate(i);
885
+ const n = await this.validateImmediate(s);
927
886
  r(n);
928
- }, t), i.signal.addEventListener(
887
+ }, t), s.signal.addEventListener(
929
888
  "abort",
930
889
  () => {
931
890
  this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), r(!1);
@@ -947,12 +906,12 @@ class _e extends I {
947
906
  async validateImmediate(e) {
948
907
  const t = e ?? new AbortController();
949
908
  e || this.currentAbortController?.abort(), this.currentAbortController = t;
950
- const { signal: i } = t, r = [];
909
+ const { signal: s } = t, r = [];
951
910
  for (const a of this.validators) {
952
911
  const o = a(this._value.value);
953
912
  o && r.push(o);
954
913
  }
955
- if (i.aborted)
914
+ if (s.aborted)
956
915
  return !1;
957
916
  if (r.length > 0) {
958
917
  this._errors.value = r;
@@ -961,33 +920,33 @@ class _e extends I {
961
920
  return !1;
962
921
  }
963
922
  if (this.asyncValidators.length > 0) {
964
- if (i.aborted)
923
+ if (s.aborted)
965
924
  return !1;
966
925
  this.statusMachine.startValidation();
967
926
  try {
968
927
  const a = await Promise.all(
969
928
  this.asyncValidators.map(async (l) => {
970
- if (i.aborted)
929
+ if (s.aborted)
971
930
  throw new DOMException("Validation aborted", "AbortError");
972
931
  try {
973
- const u = await l(this._value.value, { signal: i });
974
- if (i.aborted)
932
+ const u = await l(this._value.value, { signal: s });
933
+ if (s.aborted)
975
934
  throw new DOMException("Validation aborted", "AbortError");
976
935
  return u;
977
936
  } catch (u) {
978
937
  if (u instanceof DOMException && u.name === "AbortError")
979
938
  throw u;
980
- return k.handle(
939
+ return O.handle(
981
940
  u,
982
941
  "FieldNode AsyncValidator",
983
- w.CONVERT
942
+ S.CONVERT
984
943
  );
985
944
  }
986
945
  })
987
946
  );
988
- if (i.aborted)
947
+ if (s.aborted)
989
948
  return !1;
990
- const o = a.filter(Boolean);
949
+ const o = a.filter((l) => l !== null);
991
950
  if (o.length > 0) {
992
951
  this._errors.value = o;
993
952
  const l = o.some((u) => u.severity !== "warning");
@@ -1000,11 +959,11 @@ class _e extends I {
1000
959
  throw a;
1001
960
  }
1002
961
  }
1003
- return i.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this.statusMachine.completeValidation(!1)), !this._errors.value.some((a) => a.severity !== "warning"));
962
+ return s.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this.statusMachine.completeValidation(!1)), !this._errors.value.some((a) => a.severity !== "warning"));
1004
963
  }
1005
964
  setErrors(e) {
1006
965
  this._errors.value = e;
1007
- const t = e.some((i) => i.severity !== "warning");
966
+ const t = e.some((s) => s.severity !== "warning");
1008
967
  this.statusMachine.setErrors(t);
1009
968
  }
1010
969
  clearErrors() {
@@ -1048,7 +1007,6 @@ class _e extends I {
1048
1007
  * });
1049
1008
  * ```
1050
1009
  */
1051
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1052
1010
  updateComponentProps(e) {
1053
1011
  this._componentProps.value = {
1054
1012
  ...this._componentProps.value,
@@ -1122,12 +1080,12 @@ class _e extends I {
1122
1080
  * ```
1123
1081
  */
1124
1082
  watch(e) {
1125
- const t = new AbortController(), i = _(() => {
1083
+ const t = new AbortController(), s = _(() => {
1126
1084
  const n = this.value.value;
1127
1085
  e(n, t.signal);
1128
- }), r = N(O.Watch);
1086
+ }), r = V(k.Watch);
1129
1087
  return this.disposers.add(r, () => {
1130
- t.abort(), i();
1088
+ t.abort(), s();
1131
1089
  });
1132
1090
  }
1133
1091
  /**
@@ -1153,11 +1111,11 @@ class _e extends I {
1153
1111
  * ```
1154
1112
  */
1155
1113
  computeFrom(e, t) {
1156
- const i = _(() => {
1114
+ const s = _(() => {
1157
1115
  const n = e.map((o) => o.value), a = t(...n);
1158
1116
  this.setValue(a, { emitEvent: !1 });
1159
- }), r = N(O.ComputeFrom);
1160
- return this.disposers.add(r, i);
1117
+ }), r = V(k.ComputeFrom);
1118
+ return this.disposers.add(r, s);
1161
1119
  }
1162
1120
  /**
1163
1121
  * Очистить все ресурсы и таймеры
@@ -1187,13 +1145,13 @@ class _e extends I {
1187
1145
  }
1188
1146
  }
1189
1147
  }
1190
- function H(s) {
1191
- const { getChildren: e, ownErrors: t, disabled: i } = s, r = h(() => t.value.length > 0 ? !1 : e().every((c) => c.disabled.value || c.valid.value)), n = h(() => !r.value), a = h(() => e().some((c) => c.pending.value)), o = h(() => e().some((c) => c.touched.value)), l = h(() => e().some((c) => c.dirty.value)), u = h(() => {
1148
+ function H(i) {
1149
+ const { getChildren: e, ownErrors: t, disabled: s } = i, r = h(() => t.value.length > 0 ? !1 : e().every((c) => c.disabled.value || c.valid.value)), n = h(() => !r.value), a = h(() => e().some((c) => c.pending.value)), o = h(() => e().some((c) => c.touched.value)), l = h(() => e().some((c) => c.dirty.value)), u = h(() => {
1192
1150
  const c = [...t.value];
1193
1151
  for (const f of e())
1194
1152
  c.push(...f.errors.value);
1195
1153
  return c;
1196
- }), m = h(() => i?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
1154
+ }), m = h(() => s?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
1197
1155
  return {
1198
1156
  valid: r,
1199
1157
  invalid: n,
@@ -1204,29 +1162,29 @@ function H(s) {
1204
1162
  status: m
1205
1163
  };
1206
1164
  }
1207
- function Ee(s) {
1208
- return typeof s == "object" && s !== null && "getProxy" in s && typeof s.getProxy == "function";
1165
+ function Ee(i) {
1166
+ return typeof i == "object" && i !== null && "getProxy" in i && typeof i.getProxy == "function";
1209
1167
  }
1210
- function Ae(s, e) {
1211
- return new Proxy(s, {
1212
- get: (t, i) => {
1213
- if (i in t)
1214
- return t[i];
1215
- if (typeof i == "string" && e.has(i)) {
1216
- const r = e.get(i);
1168
+ function Ae(i, e) {
1169
+ return new Proxy(i, {
1170
+ get: (t, s) => {
1171
+ if (s in t)
1172
+ return t[s];
1173
+ if (typeof s == "string" && e.has(s)) {
1174
+ const r = e.get(s);
1217
1175
  return r && Ee(r) ? r.getProxy() : r;
1218
1176
  }
1219
1177
  },
1220
- set: (t, i, r) => typeof i == "string" && e.has(i) ? !1 : (t[i] = r, !0),
1221
- has: (t, i) => typeof i == "string" && e.has(i) ? !0 : i in t,
1178
+ set: (t, s, r) => typeof s == "string" && e.has(s) ? !1 : (t[s] = r, !0),
1179
+ has: (t, s) => typeof s == "string" && e.has(s) ? !0 : s in t,
1222
1180
  ownKeys: (t) => {
1223
- const i = Reflect.ownKeys(t), r = Array.from(e.keys());
1224
- return [.../* @__PURE__ */ new Set([...i, ...r])];
1181
+ const s = Reflect.ownKeys(t), r = Array.from(e.keys());
1182
+ return [.../* @__PURE__ */ new Set([...s, ...r])];
1225
1183
  },
1226
- getOwnPropertyDescriptor: (t, i) => typeof i == "string" && e.has(i) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, i)
1184
+ getOwnPropertyDescriptor: (t, s) => typeof s == "string" && e.has(s) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, s)
1227
1185
  });
1228
1186
  }
1229
- class Se {
1187
+ class we {
1230
1188
  /**
1231
1189
  * @param form - Форма для отправки
1232
1190
  */
@@ -1266,8 +1224,8 @@ class Se {
1266
1224
  * ```
1267
1225
  */
1268
1226
  async submit(e, t) {
1269
- const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
1270
- if (r || this.form.markAsTouched(), !i && !await this.form.validate())
1227
+ const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1228
+ if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1271
1229
  return null;
1272
1230
  this._submitting.value = !0;
1273
1231
  try {
@@ -1301,8 +1259,8 @@ class Se {
1301
1259
  * ```
1302
1260
  */
1303
1261
  async submitWithResult(e, t) {
1304
- const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
1305
- if (r || this.form.markAsTouched(), !i && !await this.form.validate())
1262
+ const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1263
+ if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1306
1264
  return { success: !1, data: null };
1307
1265
  this._submitting.value = !0;
1308
1266
  try {
@@ -1324,16 +1282,16 @@ class Se {
1324
1282
  return this._submitting.value;
1325
1283
  }
1326
1284
  }
1327
- function we(s) {
1285
+ function Se(i) {
1328
1286
  const e = [];
1329
- for (const t of s.split(".")) {
1330
- const i = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1331
- if (!i) return [];
1332
- e.push(i[2] !== void 0 ? { key: i[1], index: Number(i[2]) } : { key: i[1] });
1287
+ for (const t of i.split(".")) {
1288
+ const s = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1289
+ if (!s) return [];
1290
+ e.push(s[2] !== void 0 ? { key: s[1], index: Number(s[2]) } : { key: s[1] });
1333
1291
  }
1334
1292
  return e;
1335
1293
  }
1336
- let x = class ne extends I {
1294
+ let x = class ae extends D {
1337
1295
  // ============================================================================
1338
1296
  // Приватные поля
1339
1297
  // ============================================================================
@@ -1382,9 +1340,9 @@ let x = class ne extends I {
1382
1340
  status;
1383
1341
  submitting;
1384
1342
  constructor(e) {
1385
- super(), this.formSubmitter = new Se(this);
1386
- const i = "form" in e ? e.form : e;
1387
- for (const [n, a] of Object.entries(i)) {
1343
+ super(), this.formSubmitter = new we(this);
1344
+ const s = "form" in e ? e.form : e;
1345
+ for (const [n, a] of Object.entries(s)) {
1388
1346
  const o = this.createNode(a);
1389
1347
  this._fields.set(n, o);
1390
1348
  }
@@ -1416,13 +1374,13 @@ let x = class ne extends I {
1416
1374
  // ============================================================================
1417
1375
  getValue() {
1418
1376
  const e = {};
1419
- return this._fields.forEach((t, i) => {
1420
- e[i] = t.getValue();
1377
+ return this._fields.forEach((t, s) => {
1378
+ e[s] = t.getValue();
1421
1379
  }), e;
1422
1380
  }
1423
1381
  setValue(e, t) {
1424
- for (const [i, r] of Object.entries(e)) {
1425
- const n = this._fields.get(i);
1382
+ for (const [s, r] of Object.entries(e)) {
1383
+ const n = this._fields.get(s);
1426
1384
  if (n) {
1427
1385
  if (B(n.value)) continue;
1428
1386
  n.setValue(r, t);
@@ -1431,11 +1389,11 @@ let x = class ne extends I {
1431
1389
  }
1432
1390
  patchValue(e) {
1433
1391
  me(() => {
1434
- for (const [t, i] of Object.entries(e)) {
1392
+ for (const [t, s] of Object.entries(e)) {
1435
1393
  const r = this._fields.get(t);
1436
- if (r && i !== void 0) {
1394
+ if (r && s !== void 0) {
1437
1395
  if (B(r.value)) continue;
1438
- r.setValue(i, { emitEvent: !1 });
1396
+ r.setValue(s, { emitEvent: !1 });
1439
1397
  }
1440
1398
  }
1441
1399
  });
@@ -1458,8 +1416,8 @@ let x = class ne extends I {
1458
1416
  * ```
1459
1417
  */
1460
1418
  reset(e) {
1461
- this._fields.forEach((t, i) => {
1462
- const r = e?.[i];
1419
+ this._fields.forEach((t, s) => {
1420
+ const r = e?.[s];
1463
1421
  t.reset(r);
1464
1422
  });
1465
1423
  }
@@ -1603,21 +1561,21 @@ let x = class ne extends I {
1603
1561
  getFieldByPath(e) {
1604
1562
  if (e.startsWith(".") || e.endsWith("."))
1605
1563
  return;
1606
- const t = we(e);
1564
+ const t = Se(e);
1607
1565
  if (t.length === 0)
1608
1566
  return;
1609
- let i = this;
1567
+ let s = this;
1610
1568
  for (const r of t) {
1611
- if (!(i instanceof ne) || (i = i.getField(r.key), !i)) return;
1569
+ if (!(s instanceof ae) || (s = s.getField(r.key), !s)) return;
1612
1570
  if (r.index !== void 0)
1613
- if ("at" in i && "length" in i && typeof i.at == "function") {
1614
- const n = i.at(r.index);
1571
+ if ("at" in s && "length" in s && typeof s.at == "function") {
1572
+ const n = s.at(r.index);
1615
1573
  if (!n) return;
1616
- i = n;
1574
+ s = n;
1617
1575
  } else
1618
1576
  return;
1619
1577
  }
1620
- return i;
1578
+ return s;
1621
1579
  }
1622
1580
  // ============================================================================
1623
1581
  // Private методы для создания узлов
@@ -1646,16 +1604,16 @@ let x = class ne extends I {
1646
1604
  /**
1647
1605
  * Связывает два поля: при изменении source автоматически обновляется target
1648
1606
  */
1649
- linkFields(e, t, i) {
1607
+ linkFields(e, t, s) {
1650
1608
  const r = this._fields.get(e), n = this._fields.get(t);
1651
1609
  if (!r || !n) {
1652
1610
  const l = r ? t : e;
1653
1611
  throw new Error(`GroupNode.linkFields: field "${String(l)}" not found`);
1654
1612
  }
1655
1613
  const a = _(() => {
1656
- const l = r.value.value, u = i ? i(l) : l;
1614
+ const l = r.value.value, u = s ? s(l) : l;
1657
1615
  n.setValue(u, { emitEvent: !1 });
1658
- }), o = N(O.LinkFields);
1616
+ }), o = V(k.LinkFields);
1659
1617
  return this.disposers.add(o, a);
1660
1618
  }
1661
1619
  /**
@@ -1685,14 +1643,27 @@ let x = class ne extends I {
1685
1643
  * useEffect(() => dispose, []);
1686
1644
  * ```
1687
1645
  */
1646
+ /** Подписка на top-level поле — value типизирован как `T[K]`. */
1688
1647
  watchField(e, t) {
1689
- const i = this.getFieldByPath(e);
1690
- if (!i)
1648
+ const s = this.getFieldByPath(e);
1649
+ if (!s)
1691
1650
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
1692
1651
  const r = _(() => {
1693
- const a = i.value.value;
1694
- t(a);
1695
- }), n = N(O.WatchField);
1652
+ t(s.value.value);
1653
+ }), n = V(k.WatchField);
1654
+ return this.disposers.add(n, r);
1655
+ }
1656
+ /**
1657
+ * Подписка на вложенное поле по строковому пути ("address.city").
1658
+ * Путь нельзя выразить в типах узла → value честно `unknown`, потребитель сужает.
1659
+ */
1660
+ watchFieldByPath(e, t) {
1661
+ const s = this.getFieldByPath(e);
1662
+ if (!s)
1663
+ throw new Error(`GroupNode.watchFieldByPath: field "${e}" not found`);
1664
+ const r = _(() => {
1665
+ t(s.value.value);
1666
+ }), n = V(k.WatchField);
1696
1667
  return this.disposers.add(n, r);
1697
1668
  }
1698
1669
  /**
@@ -1722,7 +1693,7 @@ let x = class ne extends I {
1722
1693
  "dispose" in e && typeof e.dispose == "function" && e.dispose();
1723
1694
  });
1724
1695
  }
1725
- }, Q = class extends I {
1696
+ }, X = class extends D {
1726
1697
  // ============================================================================
1727
1698
  // Приватные поля
1728
1699
  // ============================================================================
@@ -1761,11 +1732,11 @@ let x = class ne extends I {
1761
1732
  for (const r of t)
1762
1733
  this.push(r);
1763
1734
  this.length = h(() => this.items.value.length), this.value = h(() => this.items.value.map((r) => r.value.value));
1764
- const i = H({
1735
+ const s = H({
1765
1736
  getChildren: () => this.items.value,
1766
1737
  ownErrors: this._arrayErrors
1767
1738
  });
1768
- this.valid = i.valid, this.invalid = i.invalid, this.pending = i.pending, this.touched = i.touched, this.dirty = i.dirty, this.errors = i.errors, this.status = i.status;
1739
+ this.valid = s.valid, this.invalid = s.invalid, this.pending = s.pending, this.touched = s.touched, this.dirty = s.dirty, this.errors = s.errors, this.status = s.status;
1769
1740
  }
1770
1741
  // ============================================================================
1771
1742
  // CRUD операции
@@ -1787,17 +1758,17 @@ let x = class ne extends I {
1787
1758
  */
1788
1759
  removeAt(e) {
1789
1760
  if (e < 0 || e >= this.items.value.length) {
1790
- k.handle(
1761
+ O.handle(
1791
1762
  new Error(
1792
1763
  `ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
1793
1764
  ),
1794
1765
  "ArrayNode.removeAt",
1795
- w.LOG
1766
+ S.LOG
1796
1767
  );
1797
1768
  return;
1798
1769
  }
1799
1770
  const t = this.items.value[e];
1800
- this.items.value = this.items.value.filter((i, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1771
+ this.items.value = this.items.value.filter((s, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1801
1772
  }
1802
1773
  /**
1803
1774
  * Вставить элемент в массив
@@ -1806,17 +1777,17 @@ let x = class ne extends I {
1806
1777
  */
1807
1778
  insert(e, t) {
1808
1779
  if (e < 0 || e > this.items.value.length) {
1809
- k.handle(
1780
+ O.handle(
1810
1781
  new Error(
1811
1782
  `ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
1812
1783
  ),
1813
1784
  "ArrayNode.insert",
1814
- w.LOG
1785
+ S.LOG
1815
1786
  );
1816
1787
  return;
1817
1788
  }
1818
- const i = this.createItem(t), r = [...this.items.value];
1819
- r.splice(e, 0, i), this.items.value = r;
1789
+ const s = this.createItem(t), r = [...this.items.value];
1790
+ r.splice(e, 0, s), this.items.value = r;
1820
1791
  }
1821
1792
  /**
1822
1793
  * Переместить элемент массива с позиции `from` на позицию `to`
@@ -1835,12 +1806,12 @@ let x = class ne extends I {
1835
1806
  * ```
1836
1807
  */
1837
1808
  move(e, t) {
1838
- const i = this.items.value.length;
1839
- if (e < 0 || e >= i || t < 0 || t >= i) {
1840
- k.handle(
1841
- new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${i})`),
1809
+ const s = this.items.value.length;
1810
+ if (e < 0 || e >= s || t < 0 || t >= s) {
1811
+ O.handle(
1812
+ new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${s})`),
1842
1813
  "ArrayNode.move",
1843
- w.LOG
1814
+ S.LOG
1844
1815
  );
1845
1816
  return;
1846
1817
  }
@@ -1863,12 +1834,12 @@ let x = class ne extends I {
1863
1834
  * ```
1864
1835
  */
1865
1836
  swap(e, t) {
1866
- const i = this.items.value.length;
1867
- if (e < 0 || e >= i || t < 0 || t >= i) {
1868
- k.handle(
1869
- new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${i})`),
1837
+ const s = this.items.value.length;
1838
+ if (e < 0 || e >= s || t < 0 || t >= s) {
1839
+ O.handle(
1840
+ new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${s})`),
1870
1841
  "ArrayNode.swap",
1871
- w.LOG
1842
+ S.LOG
1872
1843
  );
1873
1844
  return;
1874
1845
  }
@@ -1905,13 +1876,13 @@ let x = class ne extends I {
1905
1876
  return this.items.value.map((e) => e.getValue());
1906
1877
  }
1907
1878
  setValue(e, t) {
1908
- this.clear(), e.forEach((i) => this.push(i)), t?.emitEvent !== !1 && this.validate().catch((i) => {
1909
- k.handle(i, "ArrayNode.setValue", w.LOG);
1879
+ this.clear(), e.forEach((s) => this.push(s)), t?.emitEvent !== !1 && this.validate().catch((s) => {
1880
+ O.handle(s, "ArrayNode.setValue", S.LOG);
1910
1881
  });
1911
1882
  }
1912
1883
  patchValue(e) {
1913
- e.forEach((t, i) => {
1914
- this.items.value[i] && t !== void 0 && this.items.value[i].patchValue(t);
1884
+ e.forEach((t, s) => {
1885
+ this.items.value[s] && t !== void 0 && this.items.value[s].patchValue(t);
1915
1886
  });
1916
1887
  }
1917
1888
  /**
@@ -2039,9 +2010,9 @@ let x = class ne extends I {
2039
2010
  * @param callback - Функция, вызываемая для каждого элемента с типизированным GroupNode proxy
2040
2011
  */
2041
2012
  forEach(e) {
2042
- this.items.value.forEach((t, i) => {
2013
+ this.items.value.forEach((t, s) => {
2043
2014
  const r = t.getProxy();
2044
- e(r, i);
2015
+ e(r, s);
2045
2016
  });
2046
2017
  }
2047
2018
  /**
@@ -2050,9 +2021,9 @@ let x = class ne extends I {
2050
2021
  * @returns Новый массив результатов
2051
2022
  */
2052
2023
  map(e) {
2053
- return this.items.value.map((t, i) => {
2024
+ return this.items.value.map((t, s) => {
2054
2025
  const r = t.getProxy();
2055
- return e(r, i);
2026
+ return e(r, s);
2056
2027
  });
2057
2028
  }
2058
2029
  // ============================================================================
@@ -2151,14 +2122,14 @@ let x = class ne extends I {
2151
2122
  * ```
2152
2123
  */
2153
2124
  watchItems(e, t) {
2154
- const i = _(() => {
2125
+ const s = _(() => {
2155
2126
  const n = this.items.value.map((a) => {
2156
2127
  if (a instanceof x)
2157
2128
  return a.getFieldByPath(e)?.value.value;
2158
2129
  });
2159
2130
  t(n);
2160
- }), r = N(O.WatchItems);
2161
- return this.disposers.add(r, i);
2131
+ }), r = V(k.WatchItems);
2132
+ return this.disposers.add(r, s);
2162
2133
  }
2163
2134
  /**
2164
2135
  * Подписка на изменение длины массива
@@ -2186,8 +2157,8 @@ let x = class ne extends I {
2186
2157
  const t = _(() => {
2187
2158
  const r = this.length.value;
2188
2159
  e(r);
2189
- }), i = N(O.WatchLength);
2190
- return this.disposers.add(i, t);
2160
+ }), s = V(k.WatchLength);
2161
+ return this.disposers.add(s, t);
2191
2162
  }
2192
2163
  /**
2193
2164
  * Очистить все ресурсы узла
@@ -2301,13 +2272,11 @@ class ke {
2301
2272
  return this.createArrayNodeFromArray(e);
2302
2273
  if (this.isFieldConfig(e))
2303
2274
  return new _e(e);
2304
- if (this.isArrayConfig(e)) {
2305
- const t = e;
2306
- return new Q(
2307
- t.schema,
2308
- t.initialItems
2275
+ if (this.isArrayConfig(e))
2276
+ return new X(
2277
+ e.schema,
2278
+ e.initialItems
2309
2279
  );
2310
- }
2311
2280
  if (this.isGroupConfig(e))
2312
2281
  return new x(e);
2313
2282
  throw new Error(
@@ -2343,11 +2312,11 @@ class ke {
2343
2312
  */
2344
2313
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2345
2314
  createArrayNodeFromArray(e) {
2346
- const [t, ...i] = e, r = [];
2315
+ const [t, ...s] = e, r = [];
2347
2316
  this.isGroupConfig(t) && r.push(this.extractValues(t));
2348
- for (const n of i)
2317
+ for (const n of s)
2349
2318
  this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
2350
- return new Q(t, r);
2319
+ return new X(t, r);
2351
2320
  }
2352
2321
  /**
2353
2322
  * Извлечь значения из схемы (рекурсивно)
@@ -2385,8 +2354,8 @@ class ke {
2385
2354
  return e.map((t) => this.extractValues(t));
2386
2355
  if (this.isGroupConfig(e)) {
2387
2356
  const t = {};
2388
- for (const [i, r] of Object.entries(e))
2389
- t[i] = this.extractValues(r);
2357
+ for (const [s, r] of Object.entries(e))
2358
+ t[s] = this.extractValues(r);
2390
2359
  return t;
2391
2360
  }
2392
2361
  return e;
@@ -2466,28 +2435,28 @@ class ke {
2466
2435
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2467
2436
  }
2468
2437
  }
2469
- function D(s) {
2470
- return s == null ? !1 : typeof s == "object" && "value" in s && "setValue" in s && "getValue" in s && "validate" in s;
2438
+ function I(i) {
2439
+ return i == null ? !1 : typeof i == "object" && "value" in i && "setValue" in i && "getValue" in i && "validate" in i;
2471
2440
  }
2472
- function Ve(s) {
2473
- return s == null ? !1 : D(s) && "validators" in s && "asyncValidators" in s && // FieldNode имеет markAsTouched метод
2441
+ function Ve(i) {
2442
+ return i == null ? !1 : I(i) && "validators" in i && "asyncValidators" in i && // FieldNode имеет markAsTouched метод
2474
2443
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2475
- typeof s.markAsTouched == "function" && // У FieldNode нет fields или items
2476
- !("fields" in s) && !("items" in s);
2444
+ typeof i.markAsTouched == "function" && // У FieldNode нет fields или items
2445
+ !("fields" in i) && !("items" in i);
2477
2446
  }
2478
- function Oe(s) {
2479
- return s == null ? !1 : D(s) && "getFieldByPath" in s && "fields" in s && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2480
- !("items" in s) && !("push" in s) && !("removeAt" in s);
2447
+ function Oe(i) {
2448
+ return i == null ? !1 : I(i) && "getFieldByPath" in i && "fields" in i && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2449
+ !("items" in i) && !("push" in i) && !("removeAt" in i);
2481
2450
  }
2482
- function Ne(s) {
2483
- return s == null ? !1 : D(s) && "items" in s && "length" in s && "push" in s && "removeAt" in s && "at" in s && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2484
- typeof s.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2485
- typeof s.removeAt == "function";
2451
+ function Ne(i) {
2452
+ return i == null ? !1 : I(i) && "items" in i && "length" in i && "push" in i && "removeAt" in i && "at" in i && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2453
+ typeof i.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2454
+ typeof i.removeAt == "function";
2486
2455
  }
2487
- function He(s) {
2488
- return Ve(s) ? "FieldNode" : Oe(s) ? "GroupNode" : Ne(s) ? "ArrayNode" : D(s) ? "FormNode" : "Unknown";
2456
+ function ze(i) {
2457
+ return Ve(i) ? "FieldNode" : Oe(i) ? "GroupNode" : Ne(i) ? "ArrayNode" : I(i) ? "FormNode" : "Unknown";
2489
2458
  }
2490
- class Fe extends I {
2459
+ class Fe extends D {
2491
2460
  /**
2492
2461
  * @param control Реактивный массив модели (`model.<path>`).
2493
2462
  * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
@@ -2504,11 +2473,11 @@ class Fe extends I {
2504
2473
  }
2505
2474
  this.itemNodes.value = n;
2506
2475
  }), this.length = h(() => this.itemNodes.value.length), this.value = h(() => this.itemNodes.value.map((r) => r.value.value));
2507
- const i = H({
2476
+ const s = H({
2508
2477
  getChildren: () => this.itemNodes.value,
2509
2478
  ownErrors: this._arrayErrors
2510
2479
  });
2511
- this.valid = i.valid, this.invalid = i.invalid, this.pending = i.pending, this.touched = i.touched, this.dirty = i.dirty, this.errors = i.errors, this.status = i.status;
2480
+ this.valid = s.valid, this.invalid = s.invalid, this.pending = s.pending, this.touched = s.touched, this.dirty = s.dirty, this.errors = s.errors, this.status = s.status;
2512
2481
  }
2513
2482
  itemNodes = y([]);
2514
2483
  // Кэш per-item формы по идентичности фасада под-модели (фасады кэшируются в core).
@@ -2537,10 +2506,10 @@ class Fe extends I {
2537
2506
  return this.itemNodes.value[e];
2538
2507
  }
2539
2508
  map(e) {
2540
- return this.itemNodes.value.map((t, i) => e(t, i));
2509
+ return this.itemNodes.value.map((t, s) => e(t, s));
2541
2510
  }
2542
2511
  forEach(e) {
2543
- this.itemNodes.value.forEach((t, i) => e(t, i));
2512
+ this.itemNodes.value.forEach((t, s) => e(t, s));
2544
2513
  }
2545
2514
  // ── Мутации (делегируют массиву модели; effect пересоберёт itemNodes) ──────
2546
2515
  push(e) {
@@ -2598,109 +2567,133 @@ class Fe extends I {
2598
2567
  );
2599
2568
  }
2600
2569
  // ── Hooks (forward к элементам) ────────────────────────────────────────────
2570
+ // Агрегатное состояние (touched/dirty/status) выводится из детей (createAggregateSignals), поэтому
2571
+ // базовые сигналы бесполезны для чтения — состояние меняется ТОЛЬКО через per-item формы. Форвардим
2572
+ // ВСЕ hook'и (как ArrayNode), иначе markAsUntouched/Pristine/Dirty/disable/enable молча no-op.
2601
2573
  onMarkAsTouched() {
2602
2574
  this.itemNodes.value.forEach(
2603
2575
  (e) => e.markAsTouched?.()
2604
2576
  );
2605
2577
  }
2578
+ onMarkAsUntouched() {
2579
+ this.itemNodes.value.forEach(
2580
+ (e) => e.markAsUntouched?.()
2581
+ );
2582
+ }
2583
+ onMarkAsDirty() {
2584
+ this.itemNodes.value.forEach(
2585
+ (e) => e.markAsDirty?.()
2586
+ );
2587
+ }
2588
+ onMarkAsPristine() {
2589
+ this.itemNodes.value.forEach(
2590
+ (e) => e.markAsPristine?.()
2591
+ );
2592
+ }
2593
+ onDisable() {
2594
+ this.itemNodes.value.forEach((e) => e.disable?.());
2595
+ }
2596
+ onEnable() {
2597
+ this.itemNodes.value.forEach((e) => e.enable?.());
2598
+ }
2606
2599
  /** Очистка подписки синхронизации. */
2607
2600
  dispose() {
2608
2601
  this.disposeSync();
2609
2602
  }
2610
2603
  }
2611
- const ae = (s) => s !== null && typeof s == "object" && !Array.isArray(s) && !(s instanceof Date) && !(typeof Blob < "u" && s instanceof Blob) && !(typeof File < "u" && s instanceof File);
2612
- function G(s, e, t) {
2613
- if (s == null || typeof s != "object") return;
2614
- if (Array.isArray(s)) {
2615
- for (const n of s) G(n, e, t);
2604
+ const oe = (i) => i !== null && typeof i == "object" && !Array.isArray(i) && !(i instanceof Date) && !(typeof Blob < "u" && i instanceof Blob) && !(typeof File < "u" && i instanceof File);
2605
+ function G(i, e, t) {
2606
+ if (i == null || typeof i != "object") return;
2607
+ if (Array.isArray(i)) {
2608
+ for (const n of i) G(n, e, t);
2616
2609
  return;
2617
2610
  }
2618
- const i = s, r = i.array;
2619
- if (r && typeof r.__path == "string" && typeof i.item == "function") {
2620
- t.set(r.__path, i.item);
2611
+ const s = i, r = s.array;
2612
+ if (r && typeof r.__path == "string" && typeof s.item == "function") {
2613
+ t.set(r.__path, s.item);
2621
2614
  return;
2622
2615
  }
2623
- i.value instanceof ie && e.set(i.value, {
2624
- component: i.component,
2625
- componentProps: i.componentProps,
2626
- validators: i.validators,
2627
- asyncValidators: i.asyncValidators,
2628
- updateOn: i.updateOn,
2629
- disabled: i.disabled,
2630
- debounce: i.debounce
2616
+ s.value instanceof re && e.set(s.value, {
2617
+ component: s.component,
2618
+ componentProps: s.componentProps,
2619
+ validators: s.validators,
2620
+ asyncValidators: s.asyncValidators,
2621
+ updateOn: s.updateOn,
2622
+ disabled: s.disabled,
2623
+ debounce: s.debounce
2631
2624
  });
2632
- for (const [n, a] of Object.entries(i))
2625
+ for (const [n, a] of Object.entries(s))
2633
2626
  n !== "value" && G(a, e, t);
2634
2627
  }
2635
- function oe(s, e, t, i) {
2628
+ function le(i, e, t, s) {
2636
2629
  const r = {};
2637
2630
  for (const [n, a] of Object.entries(e)) {
2638
2631
  const o = t === "" ? n : `${t}.${n}`;
2639
2632
  if (Array.isArray(a))
2640
2633
  continue;
2641
- if (ae(a)) {
2642
- r[n] = oe(s, a, o, i);
2634
+ if (oe(a)) {
2635
+ r[n] = le(i, a, o, s);
2643
2636
  continue;
2644
2637
  }
2645
- const l = s.signalAt(o);
2638
+ const l = i.signalAt(o);
2646
2639
  if (!l) throw new Error(`createForm({ model }): не найден сигнал для пути "${o}"`);
2647
- const u = i.get(l) ?? {}, { validators: m, asyncValidators: c, ...f } = u;
2640
+ const u = s.get(l) ?? {}, { validators: m, asyncValidators: c, ...f } = u;
2648
2641
  r[n] = { ...f, valueSignal: l };
2649
2642
  }
2650
2643
  return r;
2651
2644
  }
2652
- function le(s, e, t) {
2653
- for (const [i, r] of Object.entries(s)) {
2654
- const n = e === "" ? i : `${e}.${i}`;
2655
- Array.isArray(r) || (ae(r) ? le(r, n, t) : t.push(n));
2645
+ function ue(i, e, t) {
2646
+ for (const [s, r] of Object.entries(i)) {
2647
+ const n = e === "" ? s : `${e}.${s}`;
2648
+ Array.isArray(r) || (oe(r) ? ue(r, n, t) : t.push(n));
2656
2649
  }
2657
2650
  }
2658
- function ue(s) {
2659
- const { model: e, schema: t, behavior: i } = s, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2651
+ function ce(i) {
2652
+ const { model: e, schema: t, behavior: s } = i, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2660
2653
  t !== void 0 && G(t, r, n);
2661
- const a = oe(e, e.get(), "", r), o = new x(a), l = e.get();
2654
+ const a = le(e, e.get(), "", r), o = new x(a), l = e.get();
2662
2655
  for (const [c, f] of Object.entries(l)) {
2663
2656
  if (!Array.isArray(f)) continue;
2664
2657
  const d = n.get(c);
2665
2658
  if (!d) continue;
2666
- const p = e[c], v = (b) => ue({ model: b, schema: d(b) }), g = new Fe(p, v);
2659
+ const p = e[c], v = (b) => ce({ model: b, schema: d(b) }), g = new Fe(p, v);
2667
2660
  o.fields.set(c, g);
2668
2661
  }
2669
2662
  const u = o.getProxy(), m = [];
2670
- le(e.get(), "", m);
2663
+ ue(e.get(), "", m);
2671
2664
  for (const c of m) {
2672
2665
  const f = e.signalAt(c), d = o.getFieldByPath(c);
2673
2666
  f && d && ye(f, d);
2674
2667
  }
2675
- return i && o.attachBehaviorCleanup(i.__run(e, u)), u;
2668
+ return s && o.attachBehaviorCleanup(s.__run(e, u)), u;
2676
2669
  }
2677
- const xe = (s) => s != null && typeof s == "object" && "model" in s && typeof s.model?.signalAt == "function";
2678
- function ze(s) {
2679
- return xe(s) ? ue(s) : new x(s).getProxy();
2670
+ const xe = (i) => i != null && typeof i == "object" && "model" in i && typeof i.model?.signalAt == "function";
2671
+ function Je(i) {
2672
+ return xe(i) ? ce(i) : new x(i).getProxy();
2680
2673
  }
2681
- const P = (s) => !(s === null || typeof s != "object" || Array.isArray(s) || s instanceof Date || typeof Blob < "u" && s instanceof Blob || typeof File < "u" && s instanceof File), E = (s, e) => s === "" ? String(e) : `${s}.${e}`, U = (s) => /^\d+$/.test(s), A = (s) => {
2682
- if (Array.isArray(s)) return s.map(A);
2683
- if (P(s)) {
2674
+ const M = (i) => !(i === null || typeof i != "object" || Array.isArray(i) || i instanceof Date || typeof Blob < "u" && i instanceof Blob || typeof File < "u" && i instanceof File), A = (i, e) => i === "" ? String(e) : `${i}.${e}`, U = (i) => /^\d+$/.test(i), w = (i) => {
2675
+ if (Array.isArray(i)) return i.map(w);
2676
+ if (M(i)) {
2684
2677
  const e = {};
2685
- for (const t of Object.keys(s)) e[t] = A(s[t]);
2678
+ for (const t of Object.keys(i)) e[t] = w(i[t]);
2686
2679
  return e;
2687
2680
  }
2688
- return s;
2689
- }, C = (s, e) => {
2690
- if (s === e) return !0;
2691
- if (Array.isArray(s) && Array.isArray(e))
2692
- return s.length !== e.length ? !1 : s.every((t, i) => C(t, e[i]));
2693
- if (P(s) && P(e)) {
2694
- const t = Object.keys(s), i = Object.keys(e);
2695
- return t.length !== i.length ? !1 : t.every((r) => C(s[r], e[r]));
2681
+ return i;
2682
+ }, C = (i, e) => {
2683
+ if (i === e) return !0;
2684
+ if (Array.isArray(i) && Array.isArray(e))
2685
+ return i.length !== e.length ? !1 : i.every((t, s) => C(t, e[s]));
2686
+ if (M(i) && M(e)) {
2687
+ const t = Object.keys(i), s = Object.keys(e);
2688
+ return t.length !== s.length ? !1 : t.every((r) => C(i[r], e[r]));
2696
2689
  }
2697
2690
  return !1;
2698
2691
  };
2699
- class Me {
2692
+ class Pe {
2700
2693
  constructor(e, t) {
2701
2694
  this.path = t;
2702
- const i = y(e);
2703
- i.__path = t, this.signal = i, this.initial = A(e);
2695
+ const s = y(e);
2696
+ s.__path = t, this.signal = s, this.initial = w(e);
2704
2697
  }
2705
2698
  kind = "leaf";
2706
2699
  signal;
@@ -2720,37 +2713,37 @@ class Me {
2720
2713
  this.signal.value = e;
2721
2714
  }
2722
2715
  resetToInitial() {
2723
- this.signal.value = A(this.initial);
2716
+ this.signal.value = w(this.initial);
2724
2717
  }
2725
2718
  captureInitial() {
2726
- this.initial = A(this.signal.peek());
2719
+ this.initial = w(this.signal.peek());
2727
2720
  }
2728
2721
  dirty() {
2729
2722
  return !C(this.signal.peek(), this.initial);
2730
2723
  }
2731
2724
  }
2732
- class ce {
2725
+ class he {
2733
2726
  constructor(e, t) {
2734
2727
  this.path = t;
2735
- for (const i of Object.keys(e))
2736
- this.children.set(i, F(e[i], E(t, i)));
2728
+ for (const s of Object.keys(e))
2729
+ this.children.set(s, F(e[s], A(t, s)));
2737
2730
  }
2738
2731
  kind = "group";
2739
2732
  children = /* @__PURE__ */ new Map();
2740
2733
  rebase(e) {
2741
2734
  this.path = e;
2742
- for (const [t, i] of this.children) i.rebase(E(e, t));
2735
+ for (const [t, s] of this.children) s.rebase(A(e, t));
2743
2736
  }
2744
2737
  peek() {
2745
2738
  const e = {};
2746
- for (const [t, i] of this.children) e[t] = i.peek();
2739
+ for (const [t, s] of this.children) e[t] = s.peek();
2747
2740
  return e;
2748
2741
  }
2749
2742
  set(e) {
2750
2743
  if (e == null || typeof e != "object") return;
2751
2744
  const t = e;
2752
- for (const [i, r] of this.children)
2753
- i in t && (r.kind === "leaf" && B(r.signal) || r.set(t[i]));
2745
+ for (const [s, r] of this.children)
2746
+ s in t && (r.kind === "leaf" && B(r.signal) || r.set(t[s]));
2754
2747
  }
2755
2748
  resetToInitial() {
2756
2749
  for (const e of this.children.values()) e.resetToInitial();
@@ -2763,38 +2756,38 @@ class ce {
2763
2756
  return !1;
2764
2757
  }
2765
2758
  }
2766
- class Pe {
2759
+ class Me {
2767
2760
  constructor(e, t) {
2768
- this.path = t, this.items = y(e.map((i, r) => F(i, E(t, r)))), this.initial = A(e);
2761
+ this.path = t, this.items = y(e.map((s, r) => F(s, A(t, r)))), this.initial = w(e);
2769
2762
  }
2770
2763
  kind = "array";
2771
2764
  items;
2772
2765
  initial;
2773
2766
  rebase(e) {
2774
- this.path = e, this.items.peek().forEach((t, i) => t.rebase(E(e, i)));
2767
+ this.path = e, this.items.peek().forEach((t, s) => t.rebase(A(e, s)));
2775
2768
  }
2776
2769
  reindex() {
2777
- this.items.peek().forEach((e, t) => e.rebase(E(this.path, t)));
2770
+ this.items.peek().forEach((e, t) => e.rebase(A(this.path, t)));
2778
2771
  }
2779
2772
  push(e) {
2780
2773
  const t = this.items.peek();
2781
- this.items.value = [...t, F(e, E(this.path, t.length))];
2774
+ this.items.value = [...t, F(e, A(this.path, t.length))];
2782
2775
  }
2783
2776
  insertAt(e, t) {
2784
- const i = [...this.items.peek()];
2785
- i.splice(e, 0, F(t, E(this.path, e))), this.items.value = i, this.reindex();
2777
+ const s = [...this.items.peek()];
2778
+ s.splice(e, 0, F(t, A(this.path, e))), this.items.value = s, this.reindex();
2786
2779
  }
2787
2780
  removeAt(e) {
2788
2781
  const t = [...this.items.peek()];
2789
2782
  t.splice(e, 1), this.items.value = t, this.reindex();
2790
2783
  }
2791
2784
  move(e, t) {
2792
- const i = [...this.items.peek()], [r] = i.splice(e, 1);
2793
- r && i.splice(t, 0, r), this.items.value = i, this.reindex();
2785
+ const s = [...this.items.peek()], [r] = s.splice(e, 1);
2786
+ r && s.splice(t, 0, r), this.items.value = s, this.reindex();
2794
2787
  }
2795
2788
  swap(e, t) {
2796
- const i = [...this.items.peek()];
2797
- e < 0 || t < 0 || e >= i.length || t >= i.length || e === t || ([i[e], i[t]] = [i[t], i[e]], this.items.value = i, this.reindex());
2789
+ const s = [...this.items.peek()];
2790
+ e < 0 || t < 0 || e >= s.length || t >= s.length || e === t || ([s[e], s[t]] = [s[t], s[e]], this.items.value = s, this.reindex());
2798
2791
  }
2799
2792
  clear() {
2800
2793
  this.items.value = [];
@@ -2804,88 +2797,88 @@ class Pe {
2804
2797
  }
2805
2798
  set(e) {
2806
2799
  const t = Array.isArray(e) ? e : [];
2807
- this.items.value = t.map((i, r) => F(i, E(this.path, r)));
2800
+ this.items.value = t.map((s, r) => F(s, A(this.path, r)));
2808
2801
  }
2809
2802
  resetToInitial() {
2810
- this.set(A(this.initial));
2803
+ this.set(w(this.initial));
2811
2804
  }
2812
2805
  captureInitial() {
2813
- this.initial = A(this.peek());
2806
+ this.initial = w(this.peek());
2814
2807
  }
2815
2808
  dirty() {
2816
2809
  return !C(this.peek(), this.initial);
2817
2810
  }
2818
2811
  }
2819
- function F(s, e) {
2820
- return Array.isArray(s) ? new Pe(s, e) : P(s) ? new ce(s, e) : new Me(s, e);
2812
+ function F(i, e) {
2813
+ return Array.isArray(i) ? new Me(i, e) : M(i) ? new he(i, e) : new Pe(i, e);
2821
2814
  }
2822
- function T(s) {
2823
- if (s)
2824
- return s.kind === "leaf" ? s.read() : s.kind === "group" ? Ce(s) : he(s);
2815
+ function T(i) {
2816
+ if (i)
2817
+ return i.kind === "leaf" ? i.read() : i.kind === "group" ? Ce(i) : de(i);
2825
2818
  }
2826
- function Ce(s) {
2819
+ function Ce(i) {
2827
2820
  return new Proxy(
2828
2821
  {},
2829
2822
  {
2830
- get: (e, t) => t === "__path" ? s.path : typeof t == "string" ? T(s.children.get(t)) : void 0,
2831
- set: (e, t, i) => {
2823
+ get: (e, t) => t === "__path" ? i.path : typeof t == "string" ? T(i.children.get(t)) : void 0,
2824
+ set: (e, t, s) => {
2832
2825
  if (typeof t != "string") return !1;
2833
- const r = s.children.get(t);
2834
- return r && r.set(i), !0;
2826
+ const r = i.children.get(t);
2827
+ return r && r.set(s), !0;
2835
2828
  },
2836
- has: (e, t) => typeof t == "string" && s.children.has(t),
2837
- ownKeys: () => [...s.children.keys()],
2838
- getOwnPropertyDescriptor: (e, t) => typeof t == "string" && s.children.has(t) ? { enumerable: !0, configurable: !0 } : void 0
2829
+ has: (e, t) => typeof t == "string" && i.children.has(t),
2830
+ ownKeys: () => [...i.children.keys()],
2831
+ getOwnPropertyDescriptor: (e, t) => typeof t == "string" && i.children.has(t) ? { enumerable: !0, configurable: !0 } : void 0
2839
2832
  }
2840
2833
  );
2841
2834
  }
2842
- function j(s) {
2843
- if (s)
2844
- return s.kind === "group" ? de(s) : s.kind === "array" ? he(s) : s.read();
2835
+ function j(i) {
2836
+ if (i)
2837
+ return i.kind === "group" ? fe(i) : i.kind === "array" ? de(i) : i.read();
2845
2838
  }
2846
- function he(s) {
2839
+ function de(i) {
2847
2840
  const e = {
2848
2841
  get length() {
2849
- return s.items.value.length;
2842
+ return i.items.value.length;
2850
2843
  },
2851
- push: (t) => s.push(t),
2852
- insertAt: (t, i) => s.insertAt(t, i),
2853
- removeAt: (t) => s.removeAt(t),
2854
- move: (t, i) => s.move(t, i),
2855
- swap: (t, i) => s.swap(t, i),
2856
- clear: () => s.clear(),
2857
- at: (t) => j(s.items.value[t]),
2858
- map: (t) => s.items.value.map((i, r) => t(j(i), r)),
2859
- forEach: (t) => s.items.value.forEach((i, r) => t(j(i), r)),
2860
- toArray: () => s.peek(),
2844
+ push: (t) => i.push(t),
2845
+ insertAt: (t, s) => i.insertAt(t, s),
2846
+ removeAt: (t) => i.removeAt(t),
2847
+ move: (t, s) => i.move(t, s),
2848
+ swap: (t, s) => i.swap(t, s),
2849
+ clear: () => i.clear(),
2850
+ at: (t) => j(i.items.value[t]),
2851
+ map: (t) => i.items.value.map((s, r) => t(j(s), r)),
2852
+ forEach: (t) => i.items.value.forEach((s, r) => t(j(s), r)),
2853
+ toArray: () => i.peek(),
2861
2854
  [Symbol.iterator]: function* () {
2862
- const t = s.items.value;
2863
- for (let i = 0; i < t.length; i++) yield T(t[i]);
2855
+ const t = i.items.value;
2856
+ for (let s = 0; s < t.length; s++) yield T(t[s]);
2864
2857
  }
2865
2858
  };
2866
2859
  return new Proxy(e, {
2867
- get: (t, i, r) => i === "__path" ? s.path : typeof i == "string" && U(i) ? T(s.items.value[Number(i)]) : Reflect.get(t, i, r),
2868
- has: (t, i) => typeof i == "string" && U(i) ? Number(i) < s.items.value.length : Reflect.has(t, i)
2860
+ get: (t, s, r) => s === "__path" ? i.path : typeof s == "string" && U(s) ? T(i.items.value[Number(s)]) : Reflect.get(t, s, r),
2861
+ has: (t, s) => typeof s == "string" && U(s) ? Number(s) < i.items.value.length : Reflect.has(t, s)
2869
2862
  });
2870
2863
  }
2871
- function W(s) {
2872
- if (s.kind === "leaf") return s.signal;
2873
- if (s.kind === "group")
2864
+ function W(i) {
2865
+ if (i.kind === "leaf") return i.signal;
2866
+ if (i.kind === "group")
2874
2867
  return new Proxy(
2875
2868
  {},
2876
2869
  {
2877
- get: (t, i) => {
2878
- if (i === "__path") return s.path;
2879
- if (typeof i != "string") return;
2880
- const r = s.children.get(i);
2870
+ get: (t, s) => {
2871
+ if (s === "__path") return i.path;
2872
+ if (typeof s != "string") return;
2873
+ const r = i.children.get(s);
2881
2874
  return r ? W(r) : void 0;
2882
2875
  },
2883
- has: (t, i) => typeof i == "string" && s.children.has(i),
2884
- ownKeys: () => [...s.children.keys()],
2885
- getOwnPropertyDescriptor: (t, i) => typeof i == "string" && s.children.has(i) ? { enumerable: !0, configurable: !0 } : void 0
2876
+ has: (t, s) => typeof s == "string" && i.children.has(s),
2877
+ ownKeys: () => [...i.children.keys()],
2878
+ getOwnPropertyDescriptor: (t, s) => typeof s == "string" && i.children.has(s) ? { enumerable: !0, configurable: !0 } : void 0
2886
2879
  }
2887
2880
  );
2888
- const e = s;
2881
+ const e = i;
2889
2882
  return new Proxy(
2890
2883
  {
2891
2884
  get length() {
@@ -2893,29 +2886,29 @@ function W(s) {
2893
2886
  }
2894
2887
  },
2895
2888
  {
2896
- get: (t, i, r) => {
2897
- if (i === "__path") return e.path;
2898
- if (typeof i == "string" && U(i)) {
2899
- const n = e.items.value[Number(i)];
2889
+ get: (t, s, r) => {
2890
+ if (s === "__path") return e.path;
2891
+ if (typeof s == "string" && U(s)) {
2892
+ const n = e.items.value[Number(s)];
2900
2893
  return n ? W(n) : void 0;
2901
2894
  }
2902
- return Reflect.get(t, i, r);
2895
+ return Reflect.get(t, s, r);
2903
2896
  }
2904
2897
  }
2905
2898
  );
2906
2899
  }
2907
- function Te(s, e) {
2900
+ function Te(i, e) {
2908
2901
  if (!e) return;
2909
- let t = s;
2910
- for (const i of e.split(".")) {
2902
+ let t = i;
2903
+ for (const s of e.split(".")) {
2911
2904
  if (!t) return;
2912
- if (t.kind === "group") t = t.children.get(i);
2913
- else if (t.kind === "array") t = t.items.peek()[Number(i)];
2905
+ if (t.kind === "group") t = t.children.get(s);
2906
+ else if (t.kind === "array") t = t.items.peek()[Number(s)];
2914
2907
  else return;
2915
2908
  }
2916
2909
  return t && t.kind === "leaf" ? t.signal : void 0;
2917
2910
  }
2918
- const X = /* @__PURE__ */ new Set([
2911
+ const Z = /* @__PURE__ */ new Set([
2919
2912
  "$",
2920
2913
  "get",
2921
2914
  "set",
@@ -2924,131 +2917,131 @@ const X = /* @__PURE__ */ new Set([
2924
2917
  "reset",
2925
2918
  "captureInitial",
2926
2919
  "signalAt"
2927
- ]), Z = /* @__PURE__ */ new WeakMap();
2928
- function de(s) {
2929
- const e = Z.get(s);
2920
+ ]), ee = /* @__PURE__ */ new WeakMap();
2921
+ function fe(i) {
2922
+ const e = ee.get(i);
2930
2923
  if (e) return e;
2931
2924
  const t = {
2932
- $: W(s),
2933
- get: () => s.peek(),
2934
- set: (r) => s.set(r),
2935
- patch: (r) => s.set(r),
2936
- isDirty: () => s.dirty(),
2937
- reset: () => s.resetToInitial(),
2938
- captureInitial: () => s.captureInitial(),
2939
- signalAt: (r) => Te(s, r)
2940
- }, i = new Proxy(
2925
+ $: W(i),
2926
+ get: () => i.peek(),
2927
+ set: (r) => i.set(r),
2928
+ patch: (r) => i.set(r),
2929
+ isDirty: () => i.dirty(),
2930
+ reset: () => i.resetToInitial(),
2931
+ captureInitial: () => i.captureInitial(),
2932
+ signalAt: (r) => Te(i, r)
2933
+ }, s = new Proxy(
2941
2934
  {},
2942
2935
  {
2943
2936
  get: (r, n) => {
2944
2937
  if (typeof n != "string") return;
2945
- const a = s.children.get(n);
2938
+ const a = i.children.get(n);
2946
2939
  if (a) return T(a);
2947
- if (X.has(n)) return t[n];
2940
+ if (Z.has(n)) return t[n];
2948
2941
  },
2949
2942
  set: (r, n, a) => {
2950
2943
  if (typeof n != "string") return !1;
2951
- const o = s.children.get(n);
2944
+ const o = i.children.get(n);
2952
2945
  return o ? (o.set(a), !0) : !1;
2953
2946
  },
2954
- has: (r, n) => typeof n == "string" && (s.children.has(n) || X.has(n)),
2955
- ownKeys: () => [...s.children.keys()],
2956
- getOwnPropertyDescriptor: (r, n) => typeof n == "string" && s.children.has(n) ? { enumerable: !0, configurable: !0 } : void 0
2947
+ has: (r, n) => typeof n == "string" && (i.children.has(n) || Z.has(n)),
2948
+ ownKeys: () => [...i.children.keys()],
2949
+ getOwnPropertyDescriptor: (r, n) => typeof n == "string" && i.children.has(n) ? { enumerable: !0, configurable: !0 } : void 0
2957
2950
  }
2958
2951
  );
2959
- return Z.set(s, i), i;
2952
+ return ee.set(i, s), s;
2960
2953
  }
2961
- function Je(s) {
2962
- const e = new ce(s, "");
2963
- return de(e);
2954
+ function Ye(i) {
2955
+ const e = new he(i, "");
2956
+ return fe(e);
2964
2957
  }
2965
- const Ie = (s) => {
2966
- const e = s.componentProps;
2958
+ const De = (i) => {
2959
+ const e = i.componentProps;
2967
2960
  return e != null && typeof e == "object" && typeof e.itemComponent == "function" && e.control != null && typeof e.control.at == "function" && typeof e.control.length == "number";
2968
- }, De = (s) => typeof s.when == "function" && Array.isArray(s.children);
2969
- function V(s, e, t, i, r) {
2970
- if (s == null || typeof s != "object") return;
2971
- if (Array.isArray(s)) {
2972
- for (const a of s) V(a, e, t, i, r);
2961
+ }, Ie = (i) => typeof i.when == "function" && Array.isArray(i.children);
2962
+ function N(i, e, t, s, r) {
2963
+ if (i == null || typeof i != "object") return;
2964
+ if (Array.isArray(i)) {
2965
+ for (const a of i) N(a, e, t, s, r);
2973
2966
  return;
2974
2967
  }
2975
- const n = s;
2976
- if (De(n)) {
2977
- const a = i && !!n.when(e, t);
2978
- for (const o of n.children) V(o, e, t, a, r);
2968
+ const n = i;
2969
+ if (Ie(n)) {
2970
+ const a = s && !!n.when(e, t);
2971
+ for (const o of n.children) N(o, e, t, a, r);
2979
2972
  return;
2980
2973
  }
2981
- if (Ie(n)) {
2974
+ if (De(n)) {
2982
2975
  const a = n.componentProps.control, o = n.componentProps.itemComponent, l = a.length;
2983
2976
  for (let u = 0; u < l; u++) {
2984
2977
  const m = a.at(u);
2985
- V(o(m), m, t, i, r);
2978
+ N(o(m), m, t, s, r);
2986
2979
  }
2987
2980
  return;
2988
2981
  }
2989
- if (n.value instanceof ie) {
2982
+ if (n.value instanceof re) {
2990
2983
  const a = n.validators ?? [];
2991
- a.length > 0 && (i ? r.tasks.push({ signal: n.value, validators: a, scope: e }) : r.clearSignals.push(n.value));
2984
+ a.length > 0 && (s ? r.tasks.push({ signal: n.value, validators: a, scope: e }) : r.clearSignals.push(n.value));
2992
2985
  for (const [o, l] of Object.entries(n))
2993
- o === "value" || o === "validators" || V(l, e, t, i, r);
2986
+ o === "value" || o === "validators" || N(l, e, t, s, r);
2994
2987
  return;
2995
2988
  }
2996
- for (const a of Object.values(n)) V(a, e, t, i, r);
2989
+ for (const a of Object.values(n)) N(a, e, t, s, r);
2997
2990
  }
2998
- function z(s, e) {
2991
+ function z(i, e) {
2999
2992
  const t = { tasks: [], clearSignals: [] };
3000
- return V(e, s, s, !0, t), t;
2993
+ return N(e, i, i, !0, t), t;
3001
2994
  }
3002
- const fe = (s, e, t) => {
3003
- (s[e] ??= []).push(t);
2995
+ const pe = (i, e, t) => {
2996
+ (i[e] ??= []).push(t);
3004
2997
  };
3005
- function Ye(s, e) {
3006
- const { tasks: t } = z(s, e), i = {};
2998
+ function Qe(i, e) {
2999
+ const { tasks: t } = z(i, e), s = {};
3007
3000
  for (const { signal: r, validators: n, scope: a } of t) {
3008
3001
  const o = r.peek();
3009
3002
  for (const l of n) {
3010
- const u = l(o, a, s);
3011
- u && typeof u.then == "function" || u && fe(i, r.__path, u);
3003
+ const u = l(o, a, i);
3004
+ u && typeof u.then == "function" || u && pe(s, r.__path, u);
3012
3005
  }
3013
3006
  }
3014
- return { valid: Object.keys(i).length === 0, errors: i };
3007
+ return { valid: Object.keys(s).length === 0, errors: s };
3015
3008
  }
3016
- async function Qe(s, e) {
3017
- const { tasks: t } = z(s, e), i = await pe(t, s);
3018
- return { valid: Object.keys(i).length === 0, errors: i };
3009
+ async function Xe(i, e) {
3010
+ const { tasks: t } = z(i, e), s = await ve(t, i);
3011
+ return { valid: Object.keys(s).length === 0, errors: s };
3019
3012
  }
3020
- async function pe(s, e) {
3013
+ async function ve(i, e) {
3021
3014
  const t = {};
3022
3015
  return await Promise.all(
3023
- s.map(async ({ signal: i, validators: r, scope: n }) => {
3024
- const a = i.peek();
3016
+ i.map(async ({ signal: s, validators: r, scope: n }) => {
3017
+ const a = s.peek();
3025
3018
  for (const o of r) {
3026
3019
  const l = await o(a, n, e);
3027
- l && fe(t, i.__path, l);
3020
+ l && pe(t, s.__path, l);
3028
3021
  }
3029
3022
  })
3030
3023
  ), t;
3031
3024
  }
3032
- async function Xe(s, e) {
3033
- const { tasks: t, clearSignals: i } = z(s, e), r = await pe(t, s);
3025
+ async function Ze(i, e) {
3026
+ const { tasks: t, clearSignals: s } = z(i, e), r = await ve(t, i);
3034
3027
  for (const { signal: n } of t)
3035
- Y(n)?.setErrors(r[n.__path] ?? []);
3036
- for (const n of i)
3037
- Y(n)?.setErrors([]);
3028
+ Q(n)?.setErrors(r[n.__path] ?? []);
3029
+ for (const n of s)
3030
+ Q(n)?.setErrors([]);
3038
3031
  return { valid: Object.keys(r).length === 0, errors: r };
3039
3032
  }
3040
- var M = { exports: {} }, R = {};
3041
- var ee;
3033
+ var P = { exports: {} }, R = {};
3034
+ var te;
3042
3035
  function Le() {
3043
- if (ee) return R;
3044
- ee = 1;
3045
- var s = re;
3036
+ if (te) return R;
3037
+ te = 1;
3038
+ var i = ne;
3046
3039
  function e(c, f) {
3047
3040
  return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
3048
3041
  }
3049
- var t = typeof Object.is == "function" ? Object.is : e, i = s.useState, r = s.useEffect, n = s.useLayoutEffect, a = s.useDebugValue;
3042
+ var t = typeof Object.is == "function" ? Object.is : e, s = i.useState, r = i.useEffect, n = i.useLayoutEffect, a = i.useDebugValue;
3050
3043
  function o(c, f) {
3051
- var d = f(), p = i({ inst: { value: d, getSnapshot: f } }), v = p[0].inst, g = p[1];
3044
+ var d = f(), p = s({ inst: { value: d, getSnapshot: f } }), v = p[0].inst, g = p[1];
3052
3045
  return n(
3053
3046
  function() {
3054
3047
  v.value = d, v.getSnapshot = f, l(v) && g({ inst: v });
@@ -3077,13 +3070,13 @@ function Le() {
3077
3070
  return f();
3078
3071
  }
3079
3072
  var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : o;
3080
- return R.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : m, R;
3073
+ return R.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : m, R;
3081
3074
  }
3082
3075
  var $ = {};
3083
- var te;
3076
+ var se;
3084
3077
  function je() {
3085
- return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
3086
- function s(d, p) {
3078
+ return se || (se = 1, process.env.NODE_ENV !== "production" && (function() {
3079
+ function i(d, p) {
3087
3080
  return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
3088
3081
  }
3089
3082
  function e(d, p) {
@@ -3125,40 +3118,40 @@ function je() {
3125
3118
  return !0;
3126
3119
  }
3127
3120
  }
3128
- function i(d, p) {
3121
+ function s(d, p) {
3129
3122
  return p();
3130
3123
  }
3131
3124
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3132
- var r = re, n = typeof Object.is == "function" ? Object.is : s, a = r.useState, o = r.useEffect, l = r.useLayoutEffect, u = r.useDebugValue, m = !1, c = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? i : e;
3125
+ var r = ne, n = typeof Object.is == "function" ? Object.is : i, a = r.useState, o = r.useEffect, l = r.useLayoutEffect, u = r.useDebugValue, m = !1, c = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
3133
3126
  $.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
3134
3127
  })()), $;
3135
3128
  }
3136
- var se;
3129
+ var ie;
3137
3130
  function Re() {
3138
- return se || (se = 1, process.env.NODE_ENV === "production" ? M.exports = Le() : M.exports = je()), M.exports;
3131
+ return ie || (ie = 1, process.env.NODE_ENV === "production" ? P.exports = Le() : P.exports = je()), P.exports;
3139
3132
  }
3140
3133
  var J = Re();
3141
- function $e(s, e) {
3142
- if (s === e) return !0;
3143
- if (s.length !== e.length) return !1;
3144
- for (let t = 0; t < s.length; t++)
3145
- if (s[t] !== e[t]) return !1;
3134
+ function $e(i, e) {
3135
+ if (i === e) return !0;
3136
+ if (i.length !== e.length) return !1;
3137
+ for (let t = 0; t < i.length; t++)
3138
+ if (i[t] !== e[t]) return !1;
3146
3139
  return !0;
3147
3140
  }
3148
- function ve(s, e, t) {
3149
- const i = q(null);
3150
- if (i.current === null) {
3141
+ function Y(i, e, t) {
3142
+ const s = q(null);
3143
+ if (s.current === null) {
3151
3144
  const a = {};
3152
- for (const o in s)
3153
- a[o] = s[o].value;
3154
- i.current = { ...a, __snapshot: null };
3145
+ for (const o in i)
3146
+ a[o] = i[o].value;
3147
+ s.current = { ...a, __snapshot: null };
3155
3148
  }
3156
- const r = S(
3149
+ const r = E(
3157
3150
  (a) => {
3158
3151
  let o = !0;
3159
3152
  return _(() => {
3160
- for (const u in s)
3161
- s[u].value;
3153
+ for (const u in i)
3154
+ i[u].value;
3162
3155
  if (o) {
3163
3156
  o = !1;
3164
3157
  return;
@@ -3166,11 +3159,11 @@ function ve(s, e, t) {
3166
3159
  a();
3167
3160
  });
3168
3161
  },
3169
- [s]
3170
- ), n = S(() => {
3171
- const a = i.current, o = {};
3172
- for (const u in s)
3173
- o[u] = s[u].value;
3162
+ [i]
3163
+ ), n = E(() => {
3164
+ const a = s.current, o = {};
3165
+ for (const u in i)
3166
+ o[u] = i[u].value;
3174
3167
  let l = !1;
3175
3168
  for (const u of e) {
3176
3169
  const { key: m, useShallowArrayEqual: c } = u, f = o[m], d = a[m];
@@ -3186,23 +3179,23 @@ function ve(s, e, t) {
3186
3179
  }
3187
3180
  if (!l && a.__snapshot)
3188
3181
  return a.__snapshot;
3189
- for (const u in s)
3182
+ for (const u in i)
3190
3183
  a[u] = o[u];
3191
3184
  return a.__snapshot = t(o), a.__snapshot;
3192
- }, [s, t]);
3185
+ }, [i, t]);
3193
3186
  return J.useSyncExternalStore(r, n, n);
3194
3187
  }
3195
- function Be(s) {
3188
+ function Be(i) {
3196
3189
  const e = {
3197
- value: s.value,
3198
- disabled: s.disabled,
3199
- errors: s.errors,
3200
- pending: s.pending,
3201
- valid: s.valid,
3202
- invalid: s.invalid,
3203
- touched: s.touched,
3204
- shouldShowError: s.shouldShowError,
3205
- componentProps: s.componentProps
3190
+ value: i.value,
3191
+ disabled: i.disabled,
3192
+ errors: i.errors,
3193
+ pending: i.pending,
3194
+ valid: i.valid,
3195
+ invalid: i.invalid,
3196
+ touched: i.touched,
3197
+ shouldShowError: i.shouldShowError,
3198
+ componentProps: i.componentProps
3206
3199
  }, t = [
3207
3200
  { key: "value" },
3208
3201
  { key: "disabled" },
@@ -3213,7 +3206,7 @@ function Be(s) {
3213
3206
  { key: "touched" },
3214
3207
  { key: "shouldShowError" },
3215
3208
  { key: "componentProps" }
3216
- ], i = S(
3209
+ ], s = E(
3217
3210
  (r) => ({
3218
3211
  value: r.value,
3219
3212
  pending: r.pending,
@@ -3227,18 +3220,18 @@ function Be(s) {
3227
3220
  }),
3228
3221
  []
3229
3222
  );
3230
- return ve(e, t, i);
3223
+ return Y(e, t, s);
3231
3224
  }
3232
- function Ge(s) {
3225
+ function Ge(i) {
3233
3226
  const e = {
3234
- value: s.value,
3235
- length: s.length,
3236
- errors: s.errors,
3237
- pending: s.pending,
3238
- valid: s.valid,
3239
- invalid: s.invalid,
3240
- touched: s.touched,
3241
- dirty: s.dirty
3227
+ value: i.value,
3228
+ length: i.length,
3229
+ errors: i.errors,
3230
+ pending: i.pending,
3231
+ valid: i.valid,
3232
+ invalid: i.invalid,
3233
+ touched: i.touched,
3234
+ dirty: i.dirty
3242
3235
  }, t = [
3243
3236
  { key: "value" },
3244
3237
  { key: "length" },
@@ -3248,7 +3241,7 @@ function Ge(s) {
3248
3241
  { key: "invalid" },
3249
3242
  { key: "touched" },
3250
3243
  { key: "dirty" }
3251
- ], i = S(
3244
+ ], s = E(
3252
3245
  (r) => ({
3253
3246
  value: r.value,
3254
3247
  length: r.length,
@@ -3261,101 +3254,108 @@ function Ge(s) {
3261
3254
  }),
3262
3255
  []
3263
3256
  );
3264
- return ve(e, t, i);
3257
+ return Y(e, t, s);
3265
3258
  }
3266
- function Ze(s) {
3267
- const e = s && "length" in s && "map" in s;
3268
- return s ? e ? Ge(s) : Be(s) : {
3269
- value: [],
3270
- length: 0,
3271
- pending: !1,
3272
- errors: [],
3273
- valid: !0,
3274
- invalid: !1,
3275
- touched: !1,
3276
- dirty: !1
3277
- };
3259
+ function Ue() {
3260
+ const i = E(
3261
+ () => ({
3262
+ value: [],
3263
+ length: 0,
3264
+ pending: !1,
3265
+ errors: [],
3266
+ valid: !0,
3267
+ invalid: !1,
3268
+ touched: !1,
3269
+ dirty: !1
3270
+ }),
3271
+ []
3272
+ );
3273
+ return Y({}, [], i);
3274
+ }
3275
+ function et(i) {
3276
+ const e = i && "length" in i && "map" in i;
3277
+ return i ? e ? Ge(i) : Be(i) : Ue();
3278
3278
  }
3279
- function et(s) {
3280
- const e = q({ value: s.value.value }), t = S(
3279
+ function tt(i) {
3280
+ const e = q({ value: i.value.value }), t = E(
3281
3281
  (r) => {
3282
3282
  let n = !0;
3283
3283
  return _(() => {
3284
- if (s.value.value, n) {
3284
+ if (i.value.value, n) {
3285
3285
  n = !1;
3286
3286
  return;
3287
3287
  }
3288
3288
  r();
3289
3289
  });
3290
3290
  },
3291
- [s]
3292
- ), i = S(() => {
3293
- const r = s.value.value;
3291
+ [i]
3292
+ ), s = E(() => {
3293
+ const r = i.value.value;
3294
3294
  return e.current.value === r ? e.current.value : (e.current.value = r, r);
3295
- }, [s]);
3296
- return J.useSyncExternalStore(t, i, i);
3295
+ }, [i]);
3296
+ return J.useSyncExternalStore(t, s, s);
3297
3297
  }
3298
- function tt(s) {
3299
- const e = q({ length: s.length.value }), t = S(
3298
+ function st(i) {
3299
+ const e = q({ length: i.length.value }), t = E(
3300
3300
  (r) => {
3301
3301
  let n = !0;
3302
3302
  return _(() => {
3303
- if (s.length.value, n) {
3303
+ if (i.length.value, n) {
3304
3304
  n = !1;
3305
3305
  return;
3306
3306
  }
3307
3307
  r();
3308
3308
  });
3309
3309
  },
3310
- [s]
3311
- ), i = S(() => {
3312
- const r = s.length.value;
3310
+ [i]
3311
+ ), s = E(() => {
3312
+ const r = i.length.value;
3313
3313
  return e.current.length === r ? e.current.length : (e.current.length = r, r);
3314
- }, [s]);
3315
- return J.useSyncExternalStore(t, i, i);
3314
+ }, [i]);
3315
+ return J.useSyncExternalStore(t, s, s);
3316
3316
  }
3317
3317
  export {
3318
- Q as ArrayNode,
3319
- w as ErrorStrategy,
3318
+ X as ArrayNode,
3319
+ S as ErrorStrategy,
3320
3320
  _e as FieldNode,
3321
- k as FormErrorHandler,
3322
- I as FormNode,
3321
+ O as FormErrorHandler,
3322
+ D as FormNode,
3323
3323
  be as FormStatusMachine,
3324
- Se as FormSubmitter,
3324
+ we as FormSubmitter,
3325
3325
  x as GroupNode,
3326
3326
  Fe as ModelArrayNode,
3327
3327
  ke as NodeFactory,
3328
3328
  K as SubscriptionManager,
3329
- rt as computeFrom,
3330
- nt as copyFrom,
3331
- ze as createForm,
3332
- ue as createFormFromModel,
3333
- Je as createModel,
3334
- at as disableWhen,
3335
- ot as enableWhen,
3336
- Y as getNodeForSignal,
3337
- He as getNodeType,
3329
+ nt as computeFrom,
3330
+ at as copyFrom,
3331
+ Je as createForm,
3332
+ ce as createFormFromModel,
3333
+ Ye as createModel,
3334
+ ot as disableWhen,
3335
+ lt as enableWhen,
3336
+ Q as getNodeForSignal,
3337
+ ze as getNodeType,
3338
3338
  Ne as isArrayNode,
3339
3339
  B as isDerived,
3340
3340
  Ve as isFieldNode,
3341
- D as isFormNode,
3341
+ I as isFormNode,
3342
3342
  Oe as isGroupNode,
3343
- lt as markDerived,
3343
+ ut as markDerived,
3344
3344
  ye as registerSignalNode,
3345
- ut as resetWhen,
3346
- ct as revalidateWhen,
3347
- ht as runOutsideEffect,
3348
- dt as safeCallback,
3349
- ft as safeDebouncedCallback,
3350
- pt as syncFields,
3351
- vt as transformValue,
3352
- N as uniqueId,
3353
- tt as useArrayLength,
3354
- Ze as useFormControl,
3355
- et as useFormControlValue,
3356
- Xe as validateFormModel,
3357
- Qe as validateModel,
3358
- Ye as validateModelSync,
3359
- gt as validators,
3360
- mt as watchField
3345
+ ct as resetWhen,
3346
+ ht as revalidateWhen,
3347
+ dt as runOutsideEffect,
3348
+ ft as safeCallback,
3349
+ pt as safeDebouncedCallback,
3350
+ vt as syncFields,
3351
+ mt as transformValue,
3352
+ V as uniqueId,
3353
+ st as useArrayLength,
3354
+ et as useFormControl,
3355
+ tt as useFormControlValue,
3356
+ Ze as validateFormModel,
3357
+ Xe as validateModel,
3358
+ Qe as validateModelSync,
3359
+ bt as validators,
3360
+ yt as watchField
3361
3361
  };