@reformer/core 9.1.1 → 10.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 (36) hide show
  1. package/README.md +39 -28
  2. package/dist/behaviors-node-DUrqAqp1.js +18 -0
  3. package/dist/behaviors.js +1 -1
  4. package/dist/form/create-form.d.ts +13 -17
  5. package/dist/form/index.d.ts +4 -6
  6. package/dist/form/nodes/group-node.d.ts +2 -15
  7. package/dist/form/types/schema-node.d.ts +13 -9
  8. package/dist/form/types/validation-schema.d.ts +7 -29
  9. package/dist/form/validation/index.d.ts +7 -0
  10. package/dist/form/validation/validators/email.d.ts +1 -1
  11. package/dist/form/validation/validators/file-type.d.ts +31 -0
  12. package/dist/form/validation/validators/file-utils.d.ts +51 -0
  13. package/dist/form/validation/validators/future-date.d.ts +1 -1
  14. package/dist/form/validation/validators/index.d.ts +7 -0
  15. package/dist/form/validation/validators/is-date.d.ts +1 -1
  16. package/dist/form/validation/validators/max-file-size.d.ts +28 -0
  17. package/dist/form/validation/validators/max-files.d.ts +26 -0
  18. package/dist/form/validation/validators/max-total-file-size.d.ts +26 -0
  19. package/dist/form/validation/validators/min-file-size.d.ts +28 -0
  20. package/dist/form/validation/validators/min-files.d.ts +26 -0
  21. package/dist/form/validation/validators/past-date.d.ts +1 -1
  22. package/dist/form/validation/validators/pattern.d.ts +1 -1
  23. package/dist/form/validation/validators/phone.d.ts +1 -1
  24. package/dist/form/validation/validators/url.d.ts +1 -1
  25. package/dist/form/validation-schema.d.ts +93 -0
  26. package/dist/index.js +352 -454
  27. package/dist/signal-node-registry-tiwel-TV.js +11 -0
  28. package/dist/state/behaviors-value.d.ts +3 -3
  29. package/dist/validation.d.ts +2 -0
  30. package/dist/validation.js +115 -0
  31. package/dist/validators.js +196 -65
  32. package/llms.txt +1198 -582
  33. package/package.json +5 -1
  34. package/dist/behaviors-node-BMOI2JJF.js +0 -26
  35. package/dist/form/validate-model-core.d.ts +0 -72
  36. package/dist/form/validate-model.d.ts +0 -27
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
- import { S as I } from "./form-model-C8Fi83k4.js";
2
- import { c as Ge } from "./form-model-C8Fi83k4.js";
3
- import { i as G } from "./behaviors-value-lCpqicfa.js";
4
- import { c as We, a as qe, m as He, r as Ke, b as Je, d as Ye, e as ze, f as Qe, s as Xe, t as Ze, u as et, w as tt } from "./behaviors-value-lCpqicfa.js";
5
- import { default as rt } from "./validators.js";
6
- import { signal as g, computed as f, effect as b, batch as ie, Signal as z } from "@preact/signals-core";
7
- import { g as U, r as ne } from "./behaviors-node-BMOI2JJF.js";
8
- import { d as nt, e as at } from "./behaviors-node-BMOI2JJF.js";
9
- import Q, { useRef as N, useCallback as E } from "react";
10
- class C {
1
+ import { S as D } from "./form-model-C8Fi83k4.js";
2
+ import { c as Ce } from "./form-model-C8Fi83k4.js";
3
+ import { i as B } from "./behaviors-value-lCpqicfa.js";
4
+ import { c as Pe, a as Te, m as De, r as Ie, b as Le, d as Re, e as Be, f as $e, s as Ge, t as je, u as Ue, w as We } from "./behaviors-value-lCpqicfa.js";
5
+ import { default as He } from "./validators.js";
6
+ import { signal as g, computed as c, effect as _, batch as X, Signal as $ } from "@preact/signals-core";
7
+ import { r as Z } from "./signal-node-registry-tiwel-TV.js";
8
+ import { g as Je } from "./signal-node-registry-tiwel-TV.js";
9
+ import { d as ze, e as Qe } from "./behaviors-node-DUrqAqp1.js";
10
+ import K, { useRef as O, useCallback as E } from "react";
11
+ class M {
11
12
  // ============================================================================
12
13
  // Protected состояние (для Template Method паттерна)
13
14
  // ============================================================================
@@ -33,33 +34,33 @@ class C {
33
34
  * Пользователь взаимодействовал с узлом (touched)
34
35
  * Computed из _touched для предоставления readonly интерфейса
35
36
  */
36
- touched = f(() => this._touched.value);
37
+ touched = c(() => this._touched.value);
37
38
  /**
38
39
  * Пользователь не взаимодействовал с узлом (untouched)
39
40
  */
40
- untouched = f(() => !this._touched.value);
41
+ untouched = c(() => !this._touched.value);
41
42
  /**
42
43
  * Значение узла было изменено (dirty)
43
44
  * Computed из _dirty для предоставления readonly интерфейса
44
45
  */
45
- dirty = f(() => this._dirty.value);
46
+ dirty = c(() => this._dirty.value);
46
47
  /**
47
48
  * Значение узла не было изменено (pristine)
48
49
  */
49
- pristine = f(() => !this._dirty.value);
50
+ pristine = c(() => !this._dirty.value);
50
51
  /**
51
52
  * Текущий статус узла
52
53
  * Computed из _status для предоставления readonly интерфейса
53
54
  */
54
- status = f(() => this._status.value);
55
+ status = c(() => this._status.value);
55
56
  /**
56
57
  * Узел отключен (disabled)
57
58
  */
58
- disabled = f(() => this._status.value === "disabled");
59
+ disabled = c(() => this._status.value === "disabled");
59
60
  /**
60
61
  * Узел включен (enabled)
61
62
  */
62
- enabled = f(() => this._status.value !== "disabled");
63
+ enabled = c(() => this._status.value !== "disabled");
63
64
  /**
64
65
  * Получить ошибки валидации с фильтрацией
65
66
  *
@@ -107,8 +108,8 @@ class C {
107
108
  if (e.params !== void 0) {
108
109
  if (!s.params)
109
110
  return !1;
110
- for (const [i, n] of Object.entries(e.params))
111
- if (s.params[i] !== n)
111
+ for (const [i, a] of Object.entries(e.params))
112
+ if (s.params[i] !== a)
112
113
  return !1;
113
114
  }
114
115
  return !(e.predicate !== void 0 && !e.predicate(s));
@@ -298,12 +299,12 @@ const w = {
298
299
  /** ArrayNode.watchLength() */
299
300
  WatchLength: "watchLength"
300
301
  };
301
- let ae = 0;
302
+ let ee = 0;
302
303
  function V(r) {
303
- return `${r}-${++ae}`;
304
+ return `${r}-${++ee}`;
304
305
  }
305
306
  var A = /* @__PURE__ */ ((r) => (r.THROW = "throw", r.LOG = "log", r.CONVERT = "convert", r))(A || {});
306
- class O {
307
+ class F {
307
308
  static handle(e, t, s = "throw") {
308
309
  const i = this.extractMessage(e);
309
310
  switch (process.env.NODE_ENV !== "production" && console.error(`[${t}]`, e), s) {
@@ -396,7 +397,7 @@ class O {
396
397
  return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
397
398
  }
398
399
  }
399
- class oe {
400
+ class te {
400
401
  /** Внутренний сигнал статуса */
401
402
  _status;
402
403
  /** Публичный read-only сигнал статуса */
@@ -413,7 +414,7 @@ class oe {
413
414
  * @param initial - Начальный статус (по умолчанию 'valid')
414
415
  */
415
416
  constructor(e = "valid") {
416
- this._status = g(e), this.status = f(() => this._status.value), this.valid = f(() => this._status.value === "valid"), this.invalid = f(() => this._status.value === "invalid"), this.pending = f(() => this._status.value === "pending"), this.disabled = f(() => this._status.value === "disabled");
417
+ this._status = g(e), this.status = c(() => this._status.value), this.valid = c(() => this._status.value === "valid"), this.invalid = c(() => this._status.value === "invalid"), this.pending = c(() => this._status.value === "pending"), this.disabled = c(() => this._status.value === "disabled");
417
418
  }
418
419
  /**
419
420
  * Начать валидацию
@@ -541,7 +542,7 @@ class oe {
541
542
  return this._status.value !== "disabled";
542
543
  }
543
544
  }
544
- class le extends C {
545
+ class se extends M {
545
546
  // ============================================================================
546
547
  // Приватные сигналы
547
548
  // ============================================================================
@@ -593,13 +594,13 @@ class le extends C {
593
594
  * Менеджер подписок для централизованного cleanup
594
595
  * Использует SubscriptionManager вместо массива для управления подписками
595
596
  */
596
- disposers = new I();
597
+ disposers = new D();
597
598
  component;
598
599
  // ============================================================================
599
600
  // Конструктор
600
601
  // ============================================================================
601
602
  constructor(e) {
602
- super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ?? g(e.value), this.initialValue = this._value.peek(), this._errors = g([]), this._componentProps = g(e.componentProps || {}), this.statusMachine = new oe(e.disabled ? "disabled" : "valid"), this.value = f(() => this._value.value), this.valid = f(() => this.statusMachine.valid.value), this.invalid = f(() => this.statusMachine.invalid.value), this.pending = f(() => this.statusMachine.pending.value), this.status = f(() => this.statusMachine.status.value), this.disabled = f(() => this.statusMachine.disabled.value), this.errors = f(() => this._errors.value), this.componentProps = f(() => this._componentProps.value), this.shouldShowError = f(
603
+ super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ?? g(e.value), this.initialValue = this._value.peek(), this._errors = g([]), this._componentProps = g(e.componentProps || {}), this.statusMachine = new te(e.disabled ? "disabled" : "valid"), this.value = c(() => this._value.value), this.valid = c(() => this.statusMachine.valid.value), this.invalid = c(() => this.statusMachine.invalid.value), this.pending = c(() => this.statusMachine.pending.value), this.status = c(() => this.statusMachine.status.value), this.disabled = c(() => this.statusMachine.disabled.value), this.errors = c(() => this._errors.value), this.componentProps = c(() => this._componentProps.value), this.shouldShowError = c(
603
604
  () => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
604
605
  );
605
606
  }
@@ -718,8 +719,8 @@ class le extends C {
718
719
  return;
719
720
  }
720
721
  this.pendingValidation = void 0;
721
- const n = await this.validateImmediate(s);
722
- i(n);
722
+ const a = await this.validateImmediate(s);
723
+ i(a);
723
724
  }, t), s.signal.addEventListener(
724
725
  "abort",
725
726
  () => {
@@ -743,16 +744,16 @@ class le extends C {
743
744
  const t = e ?? new AbortController();
744
745
  e || this.currentAbortController?.abort(), this.currentAbortController = t;
745
746
  const { signal: s } = t, i = [];
746
- for (const a of this.validators) {
747
- const l = a(this._value.value);
747
+ for (const n of this.validators) {
748
+ const l = n(this._value.value);
748
749
  l && i.push(l);
749
750
  }
750
751
  if (s.aborted)
751
752
  return !1;
752
753
  if (i.length > 0) {
753
754
  this._errors.value = i;
754
- const a = i.some((l) => l.severity !== "warning");
755
- if (this.statusMachine.setErrors(a), a)
755
+ const n = i.some((l) => l.severity !== "warning");
756
+ if (this.statusMachine.setErrors(n), n)
756
757
  return !1;
757
758
  }
758
759
  if (this.asyncValidators.length > 0) {
@@ -760,19 +761,19 @@ class le extends C {
760
761
  return !1;
761
762
  this.statusMachine.startValidation();
762
763
  try {
763
- const a = await Promise.all(
764
- this.asyncValidators.map(async (d) => {
764
+ const n = await Promise.all(
765
+ this.asyncValidators.map(async (h) => {
765
766
  if (s.aborted)
766
767
  throw new DOMException("Validation aborted", "AbortError");
767
768
  try {
768
- const u = await d(this._value.value, { signal: s });
769
+ const u = await h(this._value.value, { signal: s });
769
770
  if (s.aborted)
770
771
  throw new DOMException("Validation aborted", "AbortError");
771
772
  return u;
772
773
  } catch (u) {
773
774
  if (u instanceof DOMException && u.name === "AbortError")
774
775
  throw u;
775
- return O.handle(
776
+ return F.handle(
776
777
  u,
777
778
  "FieldNode AsyncValidator",
778
779
  A.CONVERT
@@ -782,20 +783,20 @@ class le extends C {
782
783
  );
783
784
  if (s.aborted)
784
785
  return !1;
785
- const l = a.filter((d) => d !== null);
786
+ const l = n.filter((h) => h !== null);
786
787
  if (l.length > 0) {
787
788
  this._errors.value = l;
788
- const d = l.some((u) => u.severity !== "warning");
789
- if (this.statusMachine.completeValidation(d), d)
789
+ const h = l.some((u) => u.severity !== "warning");
790
+ if (this.statusMachine.completeValidation(h), h)
790
791
  return !1;
791
792
  }
792
- } catch (a) {
793
- if (a instanceof DOMException && a.name === "AbortError")
793
+ } catch (n) {
794
+ if (n instanceof DOMException && n.name === "AbortError")
794
795
  return !1;
795
- throw a;
796
+ throw n;
796
797
  }
797
798
  }
798
- 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"));
799
+ return s.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this.statusMachine.completeValidation(!1)), !this._errors.value.some((n) => n.severity !== "warning"));
799
800
  }
800
801
  setErrors(e) {
801
802
  this._errors.value = e;
@@ -916,9 +917,9 @@ class le extends C {
916
917
  * ```
917
918
  */
918
919
  watch(e) {
919
- const t = new AbortController(), s = b(() => {
920
- const n = this.value.value;
921
- e(n, t.signal);
920
+ const t = new AbortController(), s = _(() => {
921
+ const a = this.value.value;
922
+ e(a, t.signal);
922
923
  }), i = V(w.Watch);
923
924
  return this.disposers.add(i, () => {
924
925
  t.abort(), s();
@@ -947,9 +948,9 @@ class le extends C {
947
948
  * ```
948
949
  */
949
950
  computeFrom(e, t) {
950
- const s = b(() => {
951
- const n = e.map((l) => l.value), a = t(...n);
952
- this.setValue(a, { emitEvent: !1 });
951
+ const s = _(() => {
952
+ const a = e.map((l) => l.value), n = t(...a);
953
+ this.setValue(n, { emitEvent: !1 });
953
954
  }), i = V(w.ComputeFrom);
954
955
  return this.disposers.add(i, s);
955
956
  }
@@ -981,59 +982,59 @@ class le extends C {
981
982
  }
982
983
  }
983
984
  }
984
- function L(r) {
985
- const { getChildren: e, ownErrors: t, disabled: s } = r, i = f(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), n = f(() => !i.value), a = f(() => e().some((o) => o.pending.value)), l = f(() => e().some((o) => o.touched.value)), d = f(() => e().some((o) => o.dirty.value)), u = f(() => {
985
+ function I(r) {
986
+ const { getChildren: e, ownErrors: t, disabled: s } = r, i = c(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), a = c(() => !i.value), n = c(() => e().some((o) => o.pending.value)), l = c(() => e().some((o) => o.touched.value)), h = c(() => e().some((o) => o.dirty.value)), u = c(() => {
986
987
  const o = [...t.value];
987
988
  for (const p of e())
988
989
  o.push(...p.errors.value);
989
990
  return o;
990
- }), h = f(() => s?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
991
+ }), v = c(() => s?.value ? "disabled" : n.value ? "pending" : a.value ? "invalid" : "valid");
991
992
  return {
992
993
  valid: i,
993
- invalid: n,
994
- pending: a,
994
+ invalid: a,
995
+ pending: n,
995
996
  touched: l,
996
- dirty: d,
997
+ dirty: h,
997
998
  errors: u,
998
- status: h
999
+ status: v
999
1000
  };
1000
1001
  }
1001
- function W(r) {
1002
+ function G(r) {
1002
1003
  return typeof r == "object" && r !== null && "getProxy" in r && typeof r.getProxy == "function";
1003
1004
  }
1004
- const q = "$";
1005
- function ue(r, e) {
1005
+ const j = "$";
1006
+ function ie(r, e) {
1006
1007
  let t;
1007
1008
  const s = () => {
1008
1009
  if (!t) {
1009
1010
  const i = {};
1010
- e.forEach((n, a) => {
1011
- i[a] = n && W(n) ? n.getProxy() : n;
1011
+ e.forEach((a, n) => {
1012
+ i[n] = a && G(a) ? a.getProxy() : a;
1012
1013
  }), t = i;
1013
1014
  }
1014
1015
  return t;
1015
1016
  };
1016
1017
  return new Proxy(r, {
1017
- get: (i, n) => {
1018
- if (n === q)
1018
+ get: (i, a) => {
1019
+ if (a === j)
1019
1020
  return s();
1020
- if (n in i)
1021
- return i[n];
1022
- if (typeof n == "string" && e.has(n)) {
1023
- const a = e.get(n);
1024
- return a && W(a) ? a.getProxy() : a;
1021
+ if (a in i)
1022
+ return i[a];
1023
+ if (typeof a == "string" && e.has(a)) {
1024
+ const n = e.get(a);
1025
+ return n && G(n) ? n.getProxy() : n;
1025
1026
  }
1026
1027
  },
1027
- set: (i, n, a) => typeof n == "string" && e.has(n) ? !1 : (i[n] = a, !0),
1028
- has: (i, n) => n === q || typeof n == "string" && e.has(n) ? !0 : n in i,
1028
+ set: (i, a, n) => typeof a == "string" && e.has(a) ? !1 : (i[a] = n, !0),
1029
+ has: (i, a) => a === j || typeof a == "string" && e.has(a) ? !0 : a in i,
1029
1030
  ownKeys: (i) => {
1030
- const n = Reflect.ownKeys(i), a = Array.from(e.keys());
1031
- return [.../* @__PURE__ */ new Set([...n, ...a])];
1031
+ const a = Reflect.ownKeys(i), n = Array.from(e.keys());
1032
+ return [.../* @__PURE__ */ new Set([...a, ...n])];
1032
1033
  },
1033
- getOwnPropertyDescriptor: (i, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(i, n)
1034
+ getOwnPropertyDescriptor: (i, a) => typeof a == "string" && e.has(a) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(i, a)
1034
1035
  });
1035
1036
  }
1036
- class de {
1037
+ class re {
1037
1038
  /**
1038
1039
  * @param form - Форма для отправки
1039
1040
  */
@@ -1043,7 +1044,7 @@ class de {
1043
1044
  /** Внутренний сигнал состояния отправки */
1044
1045
  _submitting = g(!1);
1045
1046
  /** Публичный read-only сигнал состояния отправки */
1046
- submitting = f(() => this._submitting.value);
1047
+ submitting = c(() => this._submitting.value);
1047
1048
  /**
1048
1049
  * Отправить форму
1049
1050
  *
@@ -1119,11 +1120,11 @@ class de {
1119
1120
  this._submitting.value = !0;
1120
1121
  try {
1121
1122
  return { success: !0, data: await e(this.form.getValue()) };
1122
- } catch (n) {
1123
+ } catch (a) {
1123
1124
  return {
1124
1125
  success: !1,
1125
1126
  data: null,
1126
- error: n instanceof Error ? n : new Error(String(n))
1127
+ error: a instanceof Error ? a : new Error(String(a))
1127
1128
  };
1128
1129
  } finally {
1129
1130
  this._submitting.value = !1;
@@ -1136,7 +1137,7 @@ class de {
1136
1137
  return this._submitting.value;
1137
1138
  }
1138
1139
  }
1139
- function ce(r) {
1140
+ function ae(r) {
1140
1141
  const e = [];
1141
1142
  for (const t of r.split(".")) {
1142
1143
  const s = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
@@ -1145,7 +1146,7 @@ function ce(r) {
1145
1146
  }
1146
1147
  return e;
1147
1148
  }
1148
- class S extends C {
1149
+ class S extends M {
1149
1150
  // ============================================================================
1150
1151
  // Приватные поля
1151
1152
  // ============================================================================
@@ -1158,7 +1159,7 @@ class S extends C {
1158
1159
  /**
1159
1160
  * Менеджер подписок для централизованного cleanup
1160
1161
  */
1161
- disposers = new I();
1162
+ disposers = new D();
1162
1163
  /**
1163
1164
  * Ссылка на Proxy-инстанс
1164
1165
  */
@@ -1170,7 +1171,7 @@ class S extends C {
1170
1171
  /**
1171
1172
  * Фабрика для создания узлов формы
1172
1173
  */
1173
- nodeFactory = new he();
1174
+ nodeFactory = new ne();
1174
1175
  // ============================================================================
1175
1176
  // Приватные сигналы состояния (inline из StateManager)
1176
1177
  // ============================================================================
@@ -1181,12 +1182,6 @@ class S extends C {
1181
1182
  _disabled = g(!1);
1182
1183
  /** Form-level validation errors */
1183
1184
  _formErrors = g([]);
1184
- /**
1185
- * M1: валидация уровня модели/схемы (`validateFormModel(model, schema)`). Привязывается
1186
- * `createForm({ model, schema })`, т.к. под M1 валидаторы срезаны с FieldNode и живут на слое
1187
- * модели. Без неё `validate()`/`submit()` пропускали бы все schema-валидаторы. @internal
1188
- */
1189
- _modelValidate;
1190
1185
  /**
1191
1186
  * M1: связь листовой ноды-ребёнка → её сигнал модели (тот, что помечает `markDerived`).
1192
1187
  * Нужна bulk-сеттерам (`setValue`/`patchValue`), чтобы корректно определять derived-поля:
@@ -1207,24 +1202,24 @@ class S extends C {
1207
1202
  status;
1208
1203
  submitting;
1209
1204
  constructor(e) {
1210
- super(), this.formSubmitter = new de(this);
1211
- const t = e.form, s = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !s ? e.form : e;
1212
- for (const [l, d] of Object.entries(n)) {
1213
- const u = this.createNode(d);
1205
+ super(), this.formSubmitter = new re(this);
1206
+ const t = e.form, s = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), a = "form" in e && !s ? e.form : e;
1207
+ for (const [l, h] of Object.entries(a)) {
1208
+ const u = this.createNode(h);
1214
1209
  this._fields.set(l, u);
1215
1210
  }
1216
- this.value = f(() => {
1211
+ this.value = c(() => {
1217
1212
  const l = {};
1218
- return this._fields.forEach((d, u) => {
1219
- l[u] = d.value.value;
1213
+ return this._fields.forEach((h, u) => {
1214
+ l[u] = h.value.value;
1220
1215
  }), l;
1221
1216
  });
1222
- const a = L({
1217
+ const n = I({
1223
1218
  getChildren: () => Array.from(this._fields.values()),
1224
1219
  ownErrors: this._formErrors,
1225
1220
  disabled: this._disabled
1226
1221
  });
1227
- this.valid = a.valid, this.invalid = a.invalid, this.pending = a.pending, this.touched = a.touched, this.dirty = a.dirty, this.errors = a.errors, this.status = a.status, this.submitting = this.formSubmitter.submitting;
1222
+ this.valid = n.valid, this.invalid = n.invalid, this.pending = n.pending, this.touched = n.touched, this.dirty = n.dirty, this.errors = n.errors, this.status = n.status, this.submitting = this.formSubmitter.submitting;
1228
1223
  }
1229
1224
  // ============================================================================
1230
1225
  // Приватный метод для создания Proxy
@@ -1234,7 +1229,7 @@ class S extends C {
1234
1229
  * @see buildFormProxy
1235
1230
  */
1236
1231
  buildProxy() {
1237
- return ue(this, this._fields);
1232
+ return ie(this, this._fields);
1238
1233
  }
1239
1234
  // ============================================================================
1240
1235
  // Реализация абстрактных методов FormNode
@@ -1247,21 +1242,21 @@ class S extends C {
1247
1242
  }
1248
1243
  setValue(e, t) {
1249
1244
  for (const [s, i] of Object.entries(e)) {
1250
- const n = this._fields.get(s);
1251
- if (n) {
1252
- const a = this._fieldSignals.get(n) ?? n.value;
1253
- if (G(a)) continue;
1254
- n.setValue(i, t);
1245
+ const a = this._fields.get(s);
1246
+ if (a) {
1247
+ const n = this._fieldSignals.get(a) ?? a.value;
1248
+ if (B(n)) continue;
1249
+ a.setValue(i, t);
1255
1250
  }
1256
1251
  }
1257
1252
  }
1258
1253
  patchValue(e) {
1259
- ie(() => {
1254
+ X(() => {
1260
1255
  for (const [t, s] of Object.entries(e)) {
1261
1256
  const i = this._fields.get(t);
1262
1257
  if (i && s !== void 0) {
1263
- const n = this._fieldSignals.get(i) ?? i.value;
1264
- if (G(n)) continue;
1258
+ const a = this._fieldSignals.get(i) ?? i.value;
1259
+ if (B(a)) continue;
1265
1260
  i.setValue(s, { emitEvent: !1 });
1266
1261
  }
1267
1262
  }
@@ -1299,11 +1294,9 @@ class S extends C {
1299
1294
  });
1300
1295
  }
1301
1296
  async validate() {
1302
- this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((s) => s.validate()));
1303
- const e = this._modelValidate ? await this._modelValidate() : !0, t = Array.from(this._fields.values()).every(
1304
- (s) => s.valid.value || s.disabled.value
1297
+ return this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((t) => t.validate())), Array.from(this._fields.values()).every(
1298
+ (t) => t.valid.value || t.disabled.value
1305
1299
  );
1306
- return e && t;
1307
1300
  }
1308
1301
  /**
1309
1302
  * Установить form-level validation errors
@@ -1437,7 +1430,7 @@ class S extends C {
1437
1430
  getFieldByPath(e) {
1438
1431
  if (e.startsWith(".") || e.endsWith("."))
1439
1432
  return;
1440
- const t = ce(e);
1433
+ const t = ae(e);
1441
1434
  if (t.length === 0)
1442
1435
  return;
1443
1436
  let s = this;
@@ -1445,9 +1438,9 @@ class S extends C {
1445
1438
  if (!(s instanceof S) || (s = s.getField(i.key), !s)) return;
1446
1439
  if (i.index !== void 0)
1447
1440
  if ("at" in s && "length" in s && typeof s.at == "function") {
1448
- const n = s.at(i.index);
1449
- if (!n) return;
1450
- s = n;
1441
+ const a = s.at(i.index);
1442
+ if (!a) return;
1443
+ s = a;
1451
1444
  } else
1452
1445
  return;
1453
1446
  }
@@ -1481,16 +1474,16 @@ class S extends C {
1481
1474
  * Связывает два поля: при изменении source автоматически обновляется target
1482
1475
  */
1483
1476
  linkFields(e, t, s) {
1484
- const i = this._fields.get(e), n = this._fields.get(t);
1485
- if (!i || !n) {
1486
- const d = i ? t : e;
1487
- throw new Error(`GroupNode.linkFields: field "${String(d)}" not found`);
1477
+ const i = this._fields.get(e), a = this._fields.get(t);
1478
+ if (!i || !a) {
1479
+ const h = i ? t : e;
1480
+ throw new Error(`GroupNode.linkFields: field "${String(h)}" not found`);
1488
1481
  }
1489
- const a = b(() => {
1490
- const d = i.value.value, u = s ? s(d) : d;
1491
- n.setValue(u, { emitEvent: !1 });
1482
+ const n = _(() => {
1483
+ const h = i.value.value, u = s ? s(h) : h;
1484
+ a.setValue(u, { emitEvent: !1 });
1492
1485
  }), l = V(w.LinkFields);
1493
- return this.disposers.add(l, a);
1486
+ return this.disposers.add(l, n);
1494
1487
  }
1495
1488
  /**
1496
1489
  * Подписка на изменения вложенного поля по строковому пути
@@ -1524,10 +1517,10 @@ class S extends C {
1524
1517
  const s = this.getFieldByPath(e);
1525
1518
  if (!s)
1526
1519
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
1527
- const i = b(() => {
1520
+ const i = _(() => {
1528
1521
  t(s.value.value);
1529
- }), n = V(w.WatchField);
1530
- return this.disposers.add(n, i);
1522
+ }), a = V(w.WatchField);
1523
+ return this.disposers.add(a, i);
1531
1524
  }
1532
1525
  /**
1533
1526
  * Подписка на вложенное поле по строковому пути ("address.city").
@@ -1537,10 +1530,10 @@ class S extends C {
1537
1530
  const s = this.getFieldByPath(e);
1538
1531
  if (!s)
1539
1532
  throw new Error(`GroupNode.watchFieldByPath: field "${e}" not found`);
1540
- const i = b(() => {
1533
+ const i = _(() => {
1541
1534
  t(s.value.value);
1542
- }), n = V(w.WatchField);
1543
- return this.disposers.add(n, i);
1535
+ }), a = V(w.WatchField);
1536
+ return this.disposers.add(a, i);
1544
1537
  }
1545
1538
  /**
1546
1539
  * Hook: вызывается после disable()
@@ -1561,15 +1554,6 @@ class S extends C {
1561
1554
  attachBehaviorCleanup(e) {
1562
1555
  this._behaviorCleanup = e;
1563
1556
  }
1564
- /**
1565
- * Прикрепить валидацию уровня модели/схемы (M1). Вызывается `createForm({ model, schema })`,
1566
- * чтобы `validate()`/`submit()` прогоняли schema-валидаторы (`validateFormModel`), а не только
1567
- * пустые FieldNode. Возвращаемый флаг — валидна ли модель по схеме.
1568
- * @internal
1569
- */
1570
- attachModelValidator(e) {
1571
- this._modelValidate = e;
1572
- }
1573
1557
  /**
1574
1558
  * Связать листовую ноду-ребёнка с её сигналом модели (M1). Вызывается `createForm` для каждого
1575
1559
  * листового поля на его владеющей группе — используется bulk-сеттерами для derived-guard (F9).
@@ -1588,7 +1572,7 @@ class S extends C {
1588
1572
  });
1589
1573
  }
1590
1574
  }
1591
- class H extends C {
1575
+ class U extends M {
1592
1576
  // ============================================================================
1593
1577
  // Приватные поля
1594
1578
  // ============================================================================
@@ -1599,7 +1583,7 @@ class H extends C {
1599
1583
  * Менеджер подписок для централизованного cleanup
1600
1584
  * Использует SubscriptionManager вместо массива для управления подписками
1601
1585
  */
1602
- disposers = new I();
1586
+ disposers = new D();
1603
1587
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
1604
1588
  _arrayErrors = g([]);
1605
1589
  // ============================================================================
@@ -1626,8 +1610,8 @@ class H extends C {
1626
1610
  super(), this.itemSchema = e, this.initialItems = t, this.items = g([]);
1627
1611
  for (const i of t)
1628
1612
  this.push(i);
1629
- this.length = f(() => this.items.value.length), this.value = f(() => this.items.value.map((i) => i.value.value));
1630
- const s = L({
1613
+ this.length = c(() => this.items.value.length), this.value = c(() => this.items.value.map((i) => i.value.value));
1614
+ const s = I({
1631
1615
  getChildren: () => this.items.value,
1632
1616
  ownErrors: this._arrayErrors
1633
1617
  });
@@ -1653,7 +1637,7 @@ class H extends C {
1653
1637
  */
1654
1638
  removeAt(e) {
1655
1639
  if (e < 0 || e >= this.items.value.length) {
1656
- O.handle(
1640
+ F.handle(
1657
1641
  new Error(
1658
1642
  `ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
1659
1643
  ),
@@ -1672,7 +1656,7 @@ class H extends C {
1672
1656
  */
1673
1657
  insert(e, t) {
1674
1658
  if (e < 0 || e > this.items.value.length) {
1675
- O.handle(
1659
+ F.handle(
1676
1660
  new Error(
1677
1661
  `ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
1678
1662
  ),
@@ -1703,7 +1687,7 @@ class H extends C {
1703
1687
  move(e, t) {
1704
1688
  const s = this.items.value.length;
1705
1689
  if (e < 0 || e >= s || t < 0 || t >= s) {
1706
- O.handle(
1690
+ F.handle(
1707
1691
  new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${s})`),
1708
1692
  "ArrayNode.move",
1709
1693
  A.LOG
@@ -1711,8 +1695,8 @@ class H extends C {
1711
1695
  return;
1712
1696
  }
1713
1697
  if (e === t) return;
1714
- const i = [...this.items.value], [n] = i.splice(e, 1);
1715
- i.splice(t, 0, n), this.items.value = i;
1698
+ const i = [...this.items.value], [a] = i.splice(e, 1);
1699
+ i.splice(t, 0, a), this.items.value = i;
1716
1700
  }
1717
1701
  /**
1718
1702
  * Поменять местами два элемента массива
@@ -1731,7 +1715,7 @@ class H extends C {
1731
1715
  swap(e, t) {
1732
1716
  const s = this.items.value.length;
1733
1717
  if (e < 0 || e >= s || t < 0 || t >= s) {
1734
- O.handle(
1718
+ F.handle(
1735
1719
  new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${s})`),
1736
1720
  "ArrayNode.swap",
1737
1721
  A.LOG
@@ -1772,7 +1756,7 @@ class H extends C {
1772
1756
  }
1773
1757
  setValue(e, t) {
1774
1758
  this.clear(), e.forEach((s) => this.push(s)), t?.emitEvent !== !1 && this.validate().catch((s) => {
1775
- O.handle(s, "ArrayNode.setValue", A.LOG);
1759
+ F.handle(s, "ArrayNode.setValue", A.LOG);
1776
1760
  });
1777
1761
  }
1778
1762
  patchValue(e) {
@@ -2017,12 +2001,12 @@ class H extends C {
2017
2001
  * ```
2018
2002
  */
2019
2003
  watchItems(e, t) {
2020
- const s = b(() => {
2021
- const n = this.items.value.map((a) => {
2022
- if (a instanceof S)
2023
- return a.getFieldByPath(e)?.value.value;
2004
+ const s = _(() => {
2005
+ const a = this.items.value.map((n) => {
2006
+ if (n instanceof S)
2007
+ return n.getFieldByPath(e)?.value.value;
2024
2008
  });
2025
- t(n);
2009
+ t(a);
2026
2010
  }), i = V(w.WatchItems);
2027
2011
  return this.disposers.add(i, s);
2028
2012
  }
@@ -2049,7 +2033,7 @@ class H extends C {
2049
2033
  * ```
2050
2034
  */
2051
2035
  watchLength(e) {
2052
- const t = b(() => {
2036
+ const t = _(() => {
2053
2037
  const i = this.length.value;
2054
2038
  e(i);
2055
2039
  }), s = V(w.WatchLength);
@@ -2116,7 +2100,7 @@ class H extends C {
2116
2100
  });
2117
2101
  }
2118
2102
  }
2119
- class he {
2103
+ class ne {
2120
2104
  /**
2121
2105
  * Создает узел формы на основе конфигурации
2122
2106
  *
@@ -2166,9 +2150,9 @@ class he {
2166
2150
  if (Array.isArray(e) && e.length >= 1)
2167
2151
  return this.createArrayNodeFromArray(e);
2168
2152
  if (this.isFieldConfig(e))
2169
- return new le(e);
2153
+ return new se(e);
2170
2154
  if (this.isArrayConfig(e))
2171
- return new H(
2155
+ return new U(
2172
2156
  e.schema,
2173
2157
  e.initialItems
2174
2158
  );
@@ -2209,9 +2193,9 @@ class he {
2209
2193
  createArrayNodeFromArray(e) {
2210
2194
  const [t, ...s] = e, i = [];
2211
2195
  this.isGroupConfig(t) && i.push(this.extractValues(t));
2212
- for (const n of s)
2213
- this.isGroupConfig(n) ? i.push(this.extractValues(n)) : i.push(n);
2214
- return new H(t, i);
2196
+ for (const a of s)
2197
+ this.isGroupConfig(a) ? i.push(this.extractValues(a)) : i.push(a);
2198
+ return new U(t, i);
2215
2199
  }
2216
2200
  /**
2217
2201
  * Извлечь значения из схемы (рекурсивно)
@@ -2330,30 +2314,30 @@ class he {
2330
2314
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2331
2315
  }
2332
2316
  }
2333
- class fe extends C {
2317
+ class oe extends M {
2334
2318
  /**
2335
2319
  * @param control Реактивный массив модели (`model.<path>`).
2336
2320
  * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
2337
2321
  * импорта с `create-form`). Обычно `(item) => createForm({ model: item, schema: itemSchema(item) })`.
2338
2322
  */
2339
2323
  constructor(e, t) {
2340
- super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = b(() => {
2341
- const i = e.length, n = [], a = [];
2324
+ super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = _(() => {
2325
+ const i = e.length, a = [], n = [];
2342
2326
  for (let u = 0; u < i; u++) {
2343
- const h = e.at(u);
2344
- if (!h) continue;
2345
- let o = this.cache.get(h);
2346
- o || (o = t(h), this.cache.set(h, o)), n.push(h), a.push(o);
2327
+ const v = e.at(u);
2328
+ if (!v) continue;
2329
+ let o = this.cache.get(v);
2330
+ o || (o = t(v), this.cache.set(v, o)), a.push(v), n.push(o);
2347
2331
  }
2348
- const l = new Set(n), d = [];
2332
+ const l = new Set(a), h = [];
2349
2333
  for (const u of this.mountedModels) {
2350
2334
  if (l.has(u)) continue;
2351
- const h = this.cache.get(u);
2352
- this.cache.delete(u), h && d.push(h);
2335
+ const v = this.cache.get(u);
2336
+ this.cache.delete(u), v && h.push(v);
2353
2337
  }
2354
- this.mountedModels = n, this.itemNodes.value = a, d.forEach((u) => this.disposeItemNode(u));
2355
- }), this.length = f(() => this.itemNodes.value.length), this.value = f(() => this.itemNodes.value.map((i) => i.value.value));
2356
- const s = L({
2338
+ this.mountedModels = a, this.itemNodes.value = n, h.forEach((u) => this.disposeItemNode(u));
2339
+ }), this.length = c(() => this.itemNodes.value.length), this.value = c(() => this.itemNodes.value.map((i) => i.value.value));
2340
+ const s = I({
2357
2341
  getChildren: () => this.itemNodes.value,
2358
2342
  ownErrors: this._arrayErrors
2359
2343
  });
@@ -2492,90 +2476,11 @@ class fe extends C {
2492
2476
  this.disposeSync(), this.itemNodes.value.forEach((e) => this.disposeItemNode(e)), this.mountedModels = [];
2493
2477
  }
2494
2478
  }
2495
- const ve = (r) => {
2496
- const e = r.componentProps;
2497
- return e != null && typeof e == "object" && typeof e.itemComponent == "function" && e.control != null && typeof e.control.at == "function" && typeof e.control.length == "number";
2498
- }, pe = (r) => typeof r.when == "function" && Array.isArray(r.children);
2499
- function F(r, e, t, s, i) {
2500
- if (r == null || typeof r != "object") return;
2479
+ const J = (r) => r !== null && typeof r == "object" && !Array.isArray(r) && !(r instanceof Date) && !(typeof Blob < "u" && r instanceof Blob) && !(typeof File < "u" && r instanceof File);
2480
+ function T(r, e, t) {
2481
+ if (r == null || typeof r != "object" || r instanceof $) return;
2501
2482
  if (Array.isArray(r)) {
2502
- for (const a of r) F(a, e, t, s, i);
2503
- return;
2504
- }
2505
- const n = r;
2506
- if (pe(n)) {
2507
- const a = s && !!n.when(e, t);
2508
- for (const l of n.children) F(l, e, t, a, i);
2509
- return;
2510
- }
2511
- if (ve(n)) {
2512
- const a = n.componentProps.control, l = n.componentProps.itemComponent, d = a.length;
2513
- for (let u = 0; u < d; u++) {
2514
- const h = a.at(u);
2515
- F(l(h), h, t, s, i);
2516
- }
2517
- return;
2518
- }
2519
- if (n.value instanceof z) {
2520
- const a = n.validators ?? [], l = n.asyncValidators ?? [], d = l.length ? [...a, ...l] : a;
2521
- d.length > 0 && (s ? i.tasks.push({ signal: n.value, validators: d, scope: e }) : i.clearSignals.push(n.value));
2522
- for (const [u, h] of Object.entries(n))
2523
- u === "value" || u === "validators" || u === "asyncValidators" || F(h, e, t, s, i);
2524
- return;
2525
- }
2526
- for (const a of Object.values(n)) F(a, e, t, s, i);
2527
- }
2528
- function R(r, e) {
2529
- const t = { tasks: [], clearSignals: [] };
2530
- return F(e, r, r, !0, t), t;
2531
- }
2532
- const X = (r, e, t) => {
2533
- (r[e] ??= []).push(t);
2534
- }, B = (r) => {
2535
- for (const e of Object.values(r))
2536
- for (const t of e) if (t.severity !== "warning") return !0;
2537
- return !1;
2538
- };
2539
- function Pe(r, e) {
2540
- const { tasks: t } = R(r, e), s = {};
2541
- for (const { signal: i, validators: n, scope: a } of t) {
2542
- const l = i.peek();
2543
- for (const d of n) {
2544
- const u = d(l, a, r);
2545
- u && typeof u.then == "function" || u && X(s, i.__path, u);
2546
- }
2547
- }
2548
- return { valid: !B(s), errors: s };
2549
- }
2550
- async function Te(r, e) {
2551
- const { tasks: t } = R(r, e), s = await Z(t, r);
2552
- return { valid: !B(s), errors: s };
2553
- }
2554
- async function Z(r, e) {
2555
- const t = {};
2556
- return await Promise.all(
2557
- r.map(async ({ signal: s, validators: i, scope: n }) => {
2558
- const a = s.peek();
2559
- for (const l of i) {
2560
- const d = await l(a, n, e);
2561
- d && X(t, s.__path, d);
2562
- }
2563
- })
2564
- ), t;
2565
- }
2566
- async function me(r, e) {
2567
- const { tasks: t, clearSignals: s } = R(r, e), i = await Z(t, r);
2568
- for (const { signal: n } of t)
2569
- U(n)?.setErrors(i[n.__path] ?? []);
2570
- for (const n of s)
2571
- U(n)?.setErrors([]);
2572
- return { valid: !B(i), errors: i };
2573
- }
2574
- const ee = (r) => r !== null && typeof r == "object" && !Array.isArray(r) && !(r instanceof Date) && !(typeof Blob < "u" && r instanceof Blob) && !(typeof File < "u" && r instanceof File);
2575
- function D(r, e, t) {
2576
- if (r == null || typeof r != "object") return;
2577
- if (Array.isArray(r)) {
2578
- for (const n of r) D(n, e, t);
2483
+ for (const a of r) T(a, e, t);
2579
2484
  return;
2580
2485
  }
2581
2486
  const s = r, i = s.array;
@@ -2583,7 +2488,7 @@ function D(r, e, t) {
2583
2488
  t.set(i.__path, s.item);
2584
2489
  return;
2585
2490
  }
2586
- s.value instanceof z ? e.set(s.value, {
2491
+ s.value instanceof $ ? e.set(s.value, {
2587
2492
  component: s.component,
2588
2493
  componentProps: s.componentProps,
2589
2494
  validators: s.validators,
@@ -2594,116 +2499,112 @@ function D(r, e, t) {
2594
2499
  }) : process.env.NODE_ENV !== "production" && s.component !== void 0 && ("valueSignal" in s || s.value != null) && console.warn(
2595
2500
  "[reformer] createForm({ schema }): узел с `component` не распознан как поле — `value` не является сигналом модели. Ожидается `value: model.$.<path>`; проверьте, что не передан `value: model.<path>` (value-прокси) или `valueSignal:`."
2596
2501
  );
2597
- for (const [n, a] of Object.entries(s))
2598
- n !== "value" && D(a, e, t);
2502
+ for (const [a, n] of Object.entries(s))
2503
+ a !== "value" && T(n, e, t);
2599
2504
  }
2600
- function te(r, e, t, s) {
2505
+ function Y(r, e, t, s) {
2601
2506
  const i = {};
2602
- for (const [n, a] of Object.entries(e)) {
2603
- const l = t === "" ? n : `${t}.${n}`;
2604
- if (Array.isArray(a))
2507
+ for (const [a, n] of Object.entries(e)) {
2508
+ const l = t === "" ? a : `${t}.${a}`;
2509
+ if (Array.isArray(n))
2605
2510
  continue;
2606
- if (ee(a)) {
2607
- i[n] = te(r, a, l, s);
2511
+ if (J(n)) {
2512
+ i[a] = Y(r, n, l, s);
2608
2513
  continue;
2609
2514
  }
2610
- const d = r.signalAt(l);
2611
- if (!d) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2612
- const u = s.get(d) ?? {}, { validators: h, asyncValidators: o, ...p } = u;
2613
- i[n] = { ...p, valueSignal: d };
2515
+ const h = r.signalAt(l);
2516
+ if (!h) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2517
+ const u = s.get(h) ?? {}, { validators: v, asyncValidators: o, ...p } = u;
2518
+ i[a] = { ...p, valueSignal: h };
2614
2519
  }
2615
2520
  return i;
2616
2521
  }
2617
- function se(r, e, t) {
2522
+ function z(r, e, t) {
2618
2523
  for (const [s, i] of Object.entries(r)) {
2619
- const n = e === "" ? s : `${e}.${s}`;
2620
- Array.isArray(i) || (ee(i) ? se(i, n, t) : t.push(n));
2524
+ const a = e === "" ? s : `${e}.${s}`;
2525
+ Array.isArray(i) || (J(i) ? z(i, a, t) : t.push(a));
2621
2526
  }
2622
2527
  }
2623
- function re(r) {
2624
- const { model: e, schema: t, behavior: s } = r, i = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2625
- t !== void 0 && D(t, i, n);
2626
- const a = te(e, e.get(), "", i), l = new S(a), d = e.get();
2627
- for (const [o, p] of Object.entries(d)) {
2528
+ function Q(r) {
2529
+ const { model: e, schema: t, behavior: s } = r, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
2530
+ t !== void 0 && T(t, i, a);
2531
+ const n = Y(e, e.get(), "", i), l = new S(n), h = e.get();
2532
+ for (const [o, p] of Object.entries(h)) {
2628
2533
  if (!Array.isArray(p)) continue;
2629
- const c = n.get(o);
2630
- if (!c) continue;
2631
- const v = e[o], m = (y) => re({ model: y, schema: c(y) }), _ = new fe(v, m);
2632
- l.fields.set(o, _);
2633
- }
2634
- const u = l.getProxy(), h = [];
2635
- se(e.get(), "", h);
2636
- for (const o of h) {
2637
- const p = e.signalAt(o), c = l.getFieldByPath(o);
2638
- if (p && c) {
2639
- ne(p, c);
2640
- const v = o.lastIndexOf("."), m = v === -1 ? l : l.getFieldByPath(o.slice(0, v));
2641
- m instanceof S && m.registerFieldSignal(c, p);
2534
+ const d = a.get(o);
2535
+ if (!d) continue;
2536
+ const f = e[o], m = (y) => Q({ model: y, schema: d(y) }), b = new oe(f, m);
2537
+ l.fields.set(o, b);
2538
+ }
2539
+ const u = l.getProxy(), v = [];
2540
+ z(e.get(), "", v);
2541
+ for (const o of v) {
2542
+ const p = e.signalAt(o), d = l.getFieldByPath(o);
2543
+ if (p && d) {
2544
+ Z(p, d);
2545
+ const f = o.lastIndexOf("."), m = f === -1 ? l : l.getFieldByPath(o.slice(0, f));
2546
+ m instanceof S && m.registerFieldSignal(d, p);
2642
2547
  }
2643
2548
  }
2644
- if (t !== void 0) {
2645
- const o = t;
2646
- l.attachModelValidator(async () => (await me(e, o)).valid);
2647
- }
2648
2549
  return s && l.attachBehaviorCleanup(s.__run(e, u)), u;
2649
2550
  }
2650
- const ye = (r) => r != null && typeof r == "object" && "model" in r && typeof r.model?.signalAt == "function";
2651
- function De(r) {
2652
- return ye(r) ? re(r) : new S(r).getProxy();
2551
+ const le = (r) => r != null && typeof r == "object" && "model" in r && typeof r.model?.signalAt == "function";
2552
+ function we(r) {
2553
+ return le(r) ? Q(r) : new S(r).getProxy();
2653
2554
  }
2654
- function x(r) {
2555
+ function C(r) {
2655
2556
  return r == null ? !1 : typeof r == "object" && "value" in r && "setValue" in r && "getValue" in r && "validate" in r;
2656
2557
  }
2657
- function ge(r) {
2658
- return r == null ? !1 : x(r) && "validators" in r && "asyncValidators" in r && // FieldNode имеет markAsTouched метод
2558
+ function ue(r) {
2559
+ return r == null ? !1 : C(r) && "validators" in r && "asyncValidators" in r && // FieldNode имеет markAsTouched метод
2659
2560
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2660
2561
  typeof r.markAsTouched == "function" && // У FieldNode нет fields или items
2661
2562
  !("fields" in r) && !("items" in r);
2662
2563
  }
2663
- function _e(r) {
2664
- return r == null ? !1 : x(r) && "getFieldByPath" in r && "fields" in r && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2564
+ function de(r) {
2565
+ return r == null ? !1 : C(r) && "getFieldByPath" in r && "fields" in r && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2665
2566
  !("items" in r) && !("push" in r) && !("removeAt" in r);
2666
2567
  }
2667
- function be(r) {
2668
- return r == null ? !1 : x(r) && "items" in r && "length" in r && "push" in r && "removeAt" in r && "at" in r && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2568
+ function he(r) {
2569
+ return r == null ? !1 : C(r) && "items" in r && "length" in r && "push" in r && "removeAt" in r && "at" in r && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2669
2570
  typeof r.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2670
2571
  typeof r.removeAt == "function";
2671
2572
  }
2672
- function Ie(r) {
2673
- return ge(r) ? "FieldNode" : _e(r) ? "GroupNode" : be(r) ? "ArrayNode" : x(r) ? "FormNode" : "Unknown";
2573
+ function Ve(r) {
2574
+ return ue(r) ? "FieldNode" : de(r) ? "GroupNode" : he(r) ? "ArrayNode" : C(r) ? "FormNode" : "Unknown";
2674
2575
  }
2675
- var M = { exports: {} }, P = {};
2676
- var K;
2677
- function Ee() {
2678
- if (K) return P;
2679
- K = 1;
2680
- var r = Q;
2576
+ var N = { exports: {} }, x = {};
2577
+ var W;
2578
+ function ce() {
2579
+ if (W) return x;
2580
+ W = 1;
2581
+ var r = K;
2681
2582
  function e(o, p) {
2682
2583
  return o === p && (o !== 0 || 1 / o === 1 / p) || o !== o && p !== p;
2683
2584
  }
2684
- var t = typeof Object.is == "function" ? Object.is : e, s = r.useState, i = r.useEffect, n = r.useLayoutEffect, a = r.useDebugValue;
2585
+ var t = typeof Object.is == "function" ? Object.is : e, s = r.useState, i = r.useEffect, a = r.useLayoutEffect, n = r.useDebugValue;
2685
2586
  function l(o, p) {
2686
- var c = p(), v = s({ inst: { value: c, getSnapshot: p } }), m = v[0].inst, _ = v[1];
2687
- return n(
2587
+ var d = p(), f = s({ inst: { value: d, getSnapshot: p } }), m = f[0].inst, b = f[1];
2588
+ return a(
2688
2589
  function() {
2689
- m.value = c, m.getSnapshot = p, d(m) && _({ inst: m });
2590
+ m.value = d, m.getSnapshot = p, h(m) && b({ inst: m });
2690
2591
  },
2691
- [o, c, p]
2592
+ [o, d, p]
2692
2593
  ), i(
2693
2594
  function() {
2694
- return d(m) && _({ inst: m }), o(function() {
2695
- d(m) && _({ inst: m });
2595
+ return h(m) && b({ inst: m }), o(function() {
2596
+ h(m) && b({ inst: m });
2696
2597
  });
2697
2598
  },
2698
2599
  [o]
2699
- ), a(c), c;
2600
+ ), n(d), d;
2700
2601
  }
2701
- function d(o) {
2602
+ function h(o) {
2702
2603
  var p = o.getSnapshot;
2703
2604
  o = o.value;
2704
2605
  try {
2705
- var c = p();
2706
- return !t(o, c);
2606
+ var d = p();
2607
+ return !t(o, d);
2707
2608
  } catch {
2708
2609
  return !0;
2709
2610
  }
@@ -2711,128 +2612,128 @@ function Ee() {
2711
2612
  function u(o, p) {
2712
2613
  return p();
2713
2614
  }
2714
- var h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
2715
- return P.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : h, P;
2615
+ var v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
2616
+ return x.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : v, x;
2716
2617
  }
2717
- var T = {};
2718
- var J;
2719
- function Se() {
2720
- return J || (J = 1, process.env.NODE_ENV !== "production" && (function() {
2721
- function r(c, v) {
2722
- return c === v && (c !== 0 || 1 / c === 1 / v) || c !== c && v !== v;
2618
+ var P = {};
2619
+ var q;
2620
+ function fe() {
2621
+ return q || (q = 1, process.env.NODE_ENV !== "production" && (function() {
2622
+ function r(d, f) {
2623
+ return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
2723
2624
  }
2724
- function e(c, v) {
2725
- h || i.startTransition === void 0 || (h = !0, console.error(
2625
+ function e(d, f) {
2626
+ v || i.startTransition === void 0 || (v = !0, console.error(
2726
2627
  "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
2727
2628
  ));
2728
- var m = v();
2629
+ var m = f();
2729
2630
  if (!o) {
2730
- var _ = v();
2731
- n(m, _) || (console.error(
2631
+ var b = f();
2632
+ a(m, b) || (console.error(
2732
2633
  "The result of getSnapshot should be cached to avoid an infinite loop"
2733
2634
  ), o = !0);
2734
2635
  }
2735
- _ = a({
2736
- inst: { value: m, getSnapshot: v }
2636
+ b = n({
2637
+ inst: { value: m, getSnapshot: f }
2737
2638
  });
2738
- var y = _[0].inst, k = _[1];
2739
- return d(
2639
+ var y = b[0].inst, k = b[1];
2640
+ return h(
2740
2641
  function() {
2741
- y.value = m, y.getSnapshot = v, t(y) && k({ inst: y });
2642
+ y.value = m, y.getSnapshot = f, t(y) && k({ inst: y });
2742
2643
  },
2743
- [c, m, v]
2644
+ [d, m, f]
2744
2645
  ), l(
2745
2646
  function() {
2746
- return t(y) && k({ inst: y }), c(function() {
2647
+ return t(y) && k({ inst: y }), d(function() {
2747
2648
  t(y) && k({ inst: y });
2748
2649
  });
2749
2650
  },
2750
- [c]
2651
+ [d]
2751
2652
  ), u(m), m;
2752
2653
  }
2753
- function t(c) {
2754
- var v = c.getSnapshot;
2755
- c = c.value;
2654
+ function t(d) {
2655
+ var f = d.getSnapshot;
2656
+ d = d.value;
2756
2657
  try {
2757
- var m = v();
2758
- return !n(c, m);
2658
+ var m = f();
2659
+ return !a(d, m);
2759
2660
  } catch {
2760
2661
  return !0;
2761
2662
  }
2762
2663
  }
2763
- function s(c, v) {
2764
- return v();
2664
+ function s(d, f) {
2665
+ return f();
2765
2666
  }
2766
2667
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2767
- var i = Q, n = typeof Object.is == "function" ? Object.is : r, a = i.useState, l = i.useEffect, d = i.useLayoutEffect, u = i.useDebugValue, h = !1, o = !1, p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
2768
- T.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2769
- })()), T;
2668
+ var i = K, a = typeof Object.is == "function" ? Object.is : r, n = i.useState, l = i.useEffect, h = i.useLayoutEffect, u = i.useDebugValue, v = !1, o = !1, p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
2669
+ P.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2670
+ })()), P;
2770
2671
  }
2771
- var Y;
2772
- function Ae() {
2773
- return Y || (Y = 1, process.env.NODE_ENV === "production" ? M.exports = Ee() : M.exports = Se()), M.exports;
2672
+ var H;
2673
+ function ve() {
2674
+ return H || (H = 1, process.env.NODE_ENV === "production" ? N.exports = ce() : N.exports = fe()), N.exports;
2774
2675
  }
2775
- var $ = Ae();
2776
- function we(r, e) {
2676
+ var L = ve();
2677
+ function pe(r, e) {
2777
2678
  if (r === e) return !0;
2778
2679
  if (r.length !== e.length) return !1;
2779
2680
  for (let t = 0; t < r.length; t++)
2780
2681
  if (r[t] !== e[t]) return !1;
2781
2682
  return !0;
2782
2683
  }
2783
- function j(r, e, t, s) {
2784
- const i = N(null), n = N(r);
2785
- n.current = r;
2786
- const a = N(e);
2787
- a.current = e;
2788
- const l = N(t);
2684
+ function R(r, e, t, s) {
2685
+ const i = O(null), a = O(r);
2686
+ a.current = r;
2687
+ const n = O(e);
2688
+ n.current = e;
2689
+ const l = O(t);
2789
2690
  if (l.current = t, i.current === null) {
2790
- const h = {};
2691
+ const v = {};
2791
2692
  for (const o in r)
2792
- h[o] = r[o].value;
2793
- i.current = { ...h, __snapshot: null };
2693
+ v[o] = r[o].value;
2694
+ i.current = { ...v, __snapshot: null };
2794
2695
  }
2795
- const d = E(
2796
- (h) => {
2696
+ const h = E(
2697
+ (v) => {
2797
2698
  let o = !0;
2798
- return b(() => {
2799
- const c = n.current;
2800
- for (const v in c)
2801
- c[v].value;
2699
+ return _(() => {
2700
+ const d = a.current;
2701
+ for (const f in d)
2702
+ d[f].value;
2802
2703
  if (o) {
2803
2704
  o = !1;
2804
2705
  return;
2805
2706
  }
2806
- h();
2707
+ v();
2807
2708
  });
2808
2709
  },
2809
2710
  [s]
2810
2711
  ), u = E(() => {
2811
- const h = i.current, o = n.current, p = {};
2812
- for (const v in o)
2813
- p[v] = o[v].value;
2814
- let c = !1;
2815
- for (const v of a.current) {
2816
- const { key: m, useShallowArrayEqual: _ } = v, y = p[m], k = h[m];
2817
- if (_) {
2818
- if (!we(k, y)) {
2819
- c = !0;
2712
+ const v = i.current, o = a.current, p = {};
2713
+ for (const f in o)
2714
+ p[f] = o[f].value;
2715
+ let d = !1;
2716
+ for (const f of n.current) {
2717
+ const { key: m, useShallowArrayEqual: b } = f, y = p[m], k = v[m];
2718
+ if (b) {
2719
+ if (!pe(k, y)) {
2720
+ d = !0;
2820
2721
  break;
2821
2722
  }
2822
2723
  } else if (k !== y) {
2823
- c = !0;
2724
+ d = !0;
2824
2725
  break;
2825
2726
  }
2826
2727
  }
2827
- if (!c && h.__snapshot)
2828
- return h.__snapshot;
2829
- for (const v in o)
2830
- h[v] = p[v];
2831
- return h.__snapshot = l.current(p), h.__snapshot;
2728
+ if (!d && v.__snapshot)
2729
+ return v.__snapshot;
2730
+ for (const f in o)
2731
+ v[f] = p[f];
2732
+ return v.__snapshot = l.current(p), v.__snapshot;
2832
2733
  }, [s]);
2833
- return $.useSyncExternalStore(d, u, u);
2734
+ return L.useSyncExternalStore(h, u, u);
2834
2735
  }
2835
- function Ve(r) {
2736
+ function me(r) {
2836
2737
  const e = {
2837
2738
  value: r.value,
2838
2739
  disabled: r.disabled,
@@ -2870,9 +2771,9 @@ function Ve(r) {
2870
2771
  }),
2871
2772
  []
2872
2773
  );
2873
- return j(e, t, s, r);
2774
+ return R(e, t, s, r);
2874
2775
  }
2875
- function ke(r) {
2776
+ function ye(r) {
2876
2777
  const e = {
2877
2778
  value: r.value,
2878
2779
  length: r.length,
@@ -2907,9 +2808,9 @@ function ke(r) {
2907
2808
  }),
2908
2809
  []
2909
2810
  );
2910
- return j(e, t, s, r);
2811
+ return R(e, t, s, r);
2911
2812
  }
2912
- function Oe() {
2813
+ function ge() {
2913
2814
  const r = E(
2914
2815
  () => ({
2915
2816
  value: [],
@@ -2924,19 +2825,19 @@ function Oe() {
2924
2825
  }),
2925
2826
  []
2926
2827
  );
2927
- return j({}, [], r);
2828
+ return R({}, [], r);
2928
2829
  }
2929
- function Le(r) {
2830
+ function ke(r) {
2930
2831
  const e = r && "length" in r && "map" in r;
2931
- return r ? e ? ke(r) : Ve(r) : Oe();
2832
+ return r ? e ? ye(r) : me(r) : ge();
2932
2833
  }
2933
- function Re(r) {
2934
- const e = N({ value: r.value.value }), t = E(
2834
+ function Fe(r) {
2835
+ const e = O({ value: r.value.value }), t = E(
2935
2836
  (i) => {
2936
- let n = !0;
2937
- return b(() => {
2938
- if (r.value.value, n) {
2939
- n = !1;
2837
+ let a = !0;
2838
+ return _(() => {
2839
+ if (r.value.value, a) {
2840
+ a = !1;
2940
2841
  return;
2941
2842
  }
2942
2843
  i();
@@ -2947,15 +2848,15 @@ function Re(r) {
2947
2848
  const i = r.value.value;
2948
2849
  return e.current.value === i ? e.current.value : (e.current.value = i, i);
2949
2850
  }, [r]);
2950
- return $.useSyncExternalStore(t, s, s);
2851
+ return L.useSyncExternalStore(t, s, s);
2951
2852
  }
2952
- function Be(r) {
2953
- const e = N({ length: r.length.value }), t = E(
2853
+ function Oe(r) {
2854
+ const e = O({ length: r.length.value }), t = E(
2954
2855
  (i) => {
2955
- let n = !0;
2956
- return b(() => {
2957
- if (r.length.value, n) {
2958
- n = !1;
2856
+ let a = !0;
2857
+ return _(() => {
2858
+ if (r.length.value, a) {
2859
+ a = !1;
2959
2860
  return;
2960
2861
  }
2961
2862
  i();
@@ -2966,51 +2867,48 @@ function Be(r) {
2966
2867
  const i = r.length.value;
2967
2868
  return e.current.length === i ? e.current.length : (e.current.length = i, i);
2968
2869
  }, [r]);
2969
- return $.useSyncExternalStore(t, s, s);
2870
+ return L.useSyncExternalStore(t, s, s);
2970
2871
  }
2971
2872
  export {
2972
- H as ArrayNode,
2873
+ U as ArrayNode,
2973
2874
  A as ErrorStrategy,
2974
- le as FieldNode,
2975
- O as FormErrorHandler,
2976
- C as FormNode,
2977
- oe as FormStatusMachine,
2978
- de as FormSubmitter,
2875
+ se as FieldNode,
2876
+ F as FormErrorHandler,
2877
+ M as FormNode,
2878
+ te as FormStatusMachine,
2879
+ re as FormSubmitter,
2979
2880
  S as GroupNode,
2980
- fe as ModelArrayNode,
2981
- he as NodeFactory,
2982
- I as SubscriptionManager,
2983
- We as computeFrom,
2984
- qe as copyFrom,
2985
- De as createForm,
2986
- re as createFormFromModel,
2987
- Ge as createModel,
2988
- nt as disableWhen,
2989
- at as enableWhen,
2990
- U as getNodeForSignal,
2991
- Ie as getNodeType,
2992
- be as isArrayNode,
2993
- G as isDerived,
2994
- ge as isFieldNode,
2995
- x as isFormNode,
2996
- _e as isGroupNode,
2997
- He as markDerived,
2998
- ne as registerSignalNode,
2999
- Ke as resetWhen,
3000
- Je as revalidateWhen,
3001
- Ye as runOutsideEffect,
3002
- ze as safeCallback,
3003
- Qe as safeDebouncedCallback,
3004
- Xe as syncFields,
3005
- Ze as transformValue,
2881
+ oe as ModelArrayNode,
2882
+ ne as NodeFactory,
2883
+ D as SubscriptionManager,
2884
+ Pe as computeFrom,
2885
+ Te as copyFrom,
2886
+ we as createForm,
2887
+ Q as createFormFromModel,
2888
+ Ce as createModel,
2889
+ ze as disableWhen,
2890
+ Qe as enableWhen,
2891
+ Je as getNodeForSignal,
2892
+ Ve as getNodeType,
2893
+ he as isArrayNode,
2894
+ B as isDerived,
2895
+ ue as isFieldNode,
2896
+ C as isFormNode,
2897
+ de as isGroupNode,
2898
+ De as markDerived,
2899
+ Z as registerSignalNode,
2900
+ Ie as resetWhen,
2901
+ Le as revalidateWhen,
2902
+ Re as runOutsideEffect,
2903
+ Be as safeCallback,
2904
+ $e as safeDebouncedCallback,
2905
+ Ge as syncFields,
2906
+ je as transformValue,
3006
2907
  V as uniqueId,
3007
- et as unmarkDerived,
3008
- Be as useArrayLength,
3009
- Le as useFormControl,
3010
- Re as useFormControlValue,
3011
- me as validateFormModel,
3012
- Te as validateModel,
3013
- Pe as validateModelSync,
3014
- rt as validators,
3015
- tt as watchField
2908
+ Ue as unmarkDerived,
2909
+ Oe as useArrayLength,
2910
+ ke as useFormControl,
2911
+ Fe as useFormControlValue,
2912
+ He as validators,
2913
+ We as watchField
3016
2914
  };