@reformer/core 5.0.2 → 7.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 (131) hide show
  1. package/README.md +7 -5
  2. package/dist/behaviors-O9a1Djj9.js +147 -0
  3. package/dist/behaviors.d.ts +131 -4
  4. package/dist/behaviors.js +298 -27
  5. package/dist/core/model/behaviors.d.ts +123 -0
  6. package/dist/core/model/form-model.d.ts +18 -0
  7. package/dist/core/model/index.d.ts +12 -0
  8. package/dist/core/model/types.d.ts +112 -0
  9. package/dist/core/model/validate-model.d.ts +46 -0
  10. package/dist/core/nodes/array-node.d.ts +34 -2
  11. package/dist/core/nodes/group-node.d.ts +19 -71
  12. package/dist/core/nodes/model-array-node.d.ts +71 -0
  13. package/dist/core/types/deep-schema.d.ts +16 -2
  14. package/dist/core/types/form-proxy.d.ts +17 -6
  15. package/dist/core/types/index.d.ts +5 -23
  16. package/dist/core/types/validation-schema.d.ts +15 -66
  17. package/dist/core/utils/create-form.d.ts +24 -0
  18. package/dist/core/utils/derived-registry.d.ts +5 -0
  19. package/dist/core/utils/index.d.ts +4 -4
  20. package/dist/core/utils/signal-node-registry.d.ts +12 -0
  21. package/dist/core/utils/type-guards.d.ts +2 -3
  22. package/dist/core/validation/index.d.ts +5 -11
  23. package/dist/core/validation/validators/email.d.ts +5 -29
  24. package/dist/core/validation/validators/future-date.d.ts +6 -28
  25. package/dist/core/validation/validators/index.d.ts +11 -4
  26. package/dist/core/validation/validators/integer.d.ts +13 -0
  27. package/dist/core/validation/validators/is-date.d.ts +5 -28
  28. package/dist/core/validation/validators/is-number.d.ts +14 -0
  29. package/dist/core/validation/validators/max-age.d.ts +6 -29
  30. package/dist/core/validation/validators/max-date.d.ts +6 -29
  31. package/dist/core/validation/validators/max-length.d.ts +5 -30
  32. package/dist/core/validation/validators/max.d.ts +7 -29
  33. package/dist/core/validation/validators/min-age.d.ts +6 -29
  34. package/dist/core/validation/validators/min-date.d.ts +6 -29
  35. package/dist/core/validation/validators/min-length.d.ts +5 -30
  36. package/dist/core/validation/validators/min.d.ts +7 -29
  37. package/dist/core/validation/validators/multiple-of.d.ts +13 -0
  38. package/dist/core/validation/validators/non-negative.d.ts +13 -0
  39. package/dist/core/validation/validators/non-zero.d.ts +13 -0
  40. package/dist/core/validation/validators/past-date.d.ts +5 -28
  41. package/dist/core/validation/validators/pattern.d.ts +5 -32
  42. package/dist/core/validation/validators/phone.d.ts +9 -19
  43. package/dist/core/validation/validators/required.d.ts +10 -31
  44. package/dist/core/validation/validators/url.d.ts +13 -15
  45. package/dist/index.d.ts +3 -4
  46. package/dist/index.js +1299 -875
  47. package/dist/validators/email.js +7 -9
  48. package/dist/validators/future-date.js +11 -12
  49. package/dist/validators/integer.d.ts +2 -0
  50. package/dist/validators/integer.js +10 -0
  51. package/dist/validators/is-date.js +6 -7
  52. package/dist/validators/is-number.d.ts +2 -0
  53. package/dist/validators/is-number.js +10 -0
  54. package/dist/validators/max-age.js +11 -12
  55. package/dist/validators/max-date.js +11 -12
  56. package/dist/validators/max-length.js +12 -8
  57. package/dist/validators/max.js +5 -6
  58. package/dist/validators/min-age.js +10 -11
  59. package/dist/validators/min-date.js +12 -13
  60. package/dist/validators/min-length.js +12 -8
  61. package/dist/validators/min.js +6 -7
  62. package/dist/validators/multiple-of.d.ts +2 -0
  63. package/dist/validators/multiple-of.js +10 -0
  64. package/dist/validators/non-negative.d.ts +2 -0
  65. package/dist/validators/non-negative.js +10 -0
  66. package/dist/validators/non-zero.d.ts +2 -0
  67. package/dist/validators/non-zero.js +10 -0
  68. package/dist/validators/past-date.js +11 -12
  69. package/dist/validators/pattern.js +6 -7
  70. package/dist/validators/phone.js +14 -32
  71. package/dist/validators/required.js +9 -10
  72. package/dist/validators/url.js +19 -16
  73. package/dist/validators.js +67 -54
  74. package/llms.txt +959 -2584
  75. package/package.json +19 -35
  76. package/dist/behaviors/compute-from.d.ts +0 -2
  77. package/dist/behaviors/compute-from.js +0 -31
  78. package/dist/behaviors/copy-from.d.ts +0 -2
  79. package/dist/behaviors/copy-from.js +0 -29
  80. package/dist/behaviors/enable-when.d.ts +0 -2
  81. package/dist/behaviors/enable-when.js +0 -25
  82. package/dist/behaviors/reset-when.d.ts +0 -2
  83. package/dist/behaviors/reset-when.js +0 -24
  84. package/dist/behaviors/revalidate-when.d.ts +0 -2
  85. package/dist/behaviors/revalidate-when.js +0 -18
  86. package/dist/behaviors/sync-fields.d.ts +0 -2
  87. package/dist/behaviors/sync-fields.js +0 -41
  88. package/dist/behaviors/transform-value.d.ts +0 -2
  89. package/dist/behaviors/transform-value.js +0 -45
  90. package/dist/behaviors/watch-field.d.ts +0 -2
  91. package/dist/behaviors/watch-field.js +0 -21
  92. package/dist/core/behavior/behavior-context.d.ts +0 -47
  93. package/dist/core/behavior/behavior-registry.d.ts +0 -85
  94. package/dist/core/behavior/behaviors/compute-from.d.ts +0 -70
  95. package/dist/core/behavior/behaviors/copy-from.d.ts +0 -56
  96. package/dist/core/behavior/behaviors/enable-when.d.ts +0 -118
  97. package/dist/core/behavior/behaviors/index.d.ts +0 -11
  98. package/dist/core/behavior/behaviors/reset-when.d.ts +0 -64
  99. package/dist/core/behavior/behaviors/revalidate-when.d.ts +0 -53
  100. package/dist/core/behavior/behaviors/sync-fields.d.ts +0 -48
  101. package/dist/core/behavior/behaviors/transform-value.d.ts +0 -192
  102. package/dist/core/behavior/behaviors/watch-field.d.ts +0 -80
  103. package/dist/core/behavior/compose-behavior.d.ts +0 -96
  104. package/dist/core/behavior/index.d.ts +0 -11
  105. package/dist/core/behavior/types.d.ts +0 -146
  106. package/dist/core/types/field-path.d.ts +0 -42
  107. package/dist/core/types/form-context.d.ts +0 -89
  108. package/dist/core/utils/field-path-navigator.d.ts +0 -240
  109. package/dist/core/utils/field-path.d.ts +0 -60
  110. package/dist/core/utils/registry-helpers.d.ts +0 -43
  111. package/dist/core/validation/core/apply-when.d.ts +0 -22
  112. package/dist/core/validation/core/apply.d.ts +0 -52
  113. package/dist/core/validation/core/index.d.ts +0 -8
  114. package/dist/core/validation/core/validate-async.d.ts +0 -36
  115. package/dist/core/validation/core/validate-tree.d.ts +0 -35
  116. package/dist/core/validation/core/validate.d.ts +0 -26
  117. package/dist/core/validation/validate-form.d.ts +0 -48
  118. package/dist/core/validation/validation-applicator.d.ts +0 -70
  119. package/dist/core/validation/validation-context.d.ts +0 -86
  120. package/dist/core/validation/validation-registry.d.ts +0 -142
  121. package/dist/core/validation/validators/array-validators.d.ts +0 -53
  122. package/dist/core/validation/validators/number.d.ts +0 -31
  123. package/dist/field-path-DuKdGcIE.js +0 -66
  124. package/dist/hooks/useHiddenCondition.d.ts +0 -25
  125. package/dist/index-D25LsbRm.js +0 -73
  126. package/dist/registry-helpers-Bv_BJ1s-.js +0 -615
  127. package/dist/safe-effect-Dh8uw81c.js +0 -20
  128. package/dist/validate-C3XiA_zf.js +0 -10
  129. package/dist/validators/number.d.ts +0 -2
  130. package/dist/validators/number.js +0 -35
  131. package/dist/validators-BGsNOgT1.js +0 -207
package/dist/index.js CHANGED
@@ -1,14 +1,9 @@
1
- import { signal as g, computed as d, effect as m, batch as j } from "@preact/signals-core";
2
- import { F as S, E as V, V as K, B as H } from "./registry-helpers-Bv_BJ1s-.js";
3
- import { A as ke, R as xe, b as Fe, g as Te } from "./registry-helpers-Bv_BJ1s-.js";
4
- import { i as M, a as N, A as z, V as J, T as Y } from "./validators-BGsNOgT1.js";
5
- import { g as Pe, c as Ce, d as De, v as Re, b as Me } from "./validators-BGsNOgT1.js";
6
- import { c as I } from "./field-path-DuKdGcIE.js";
7
- import { a as Ie, e as Le, t as Be } from "./field-path-DuKdGcIE.js";
8
- import U, { useRef as P, useCallback as b, useSyncExternalStore as Q } from "react";
9
- import { i as $e } from "./index-D25LsbRm.js";
10
- import { r as We, s as qe, a as je } from "./safe-effect-Dh8uw81c.js";
11
- class C {
1
+ import { signal as g, computed as c, effect as m, batch as ge, Signal as ne } from "@preact/signals-core";
2
+ import { i as U, d as be, g as X } from "./behaviors-O9a1Djj9.js";
3
+ import { j as lt, c as ut, k as ht, e as ct, m as dt, a as ft, b as pt, r as vt, f as mt, h as yt, s as gt, t as bt, w as _t } from "./behaviors-O9a1Djj9.js";
4
+ import ae, { useRef as H, useCallback as A } from "react";
5
+ import { default as wt } from "./validators.js";
6
+ class I {
12
7
  // ============================================================================
13
8
  // Protected состояние (для Template Method паттерна)
14
9
  // ============================================================================
@@ -34,33 +29,33 @@ class C {
34
29
  * Пользователь взаимодействовал с узлом (touched)
35
30
  * Computed из _touched для предоставления readonly интерфейса
36
31
  */
37
- touched = d(() => this._touched.value);
32
+ touched = c(() => this._touched.value);
38
33
  /**
39
34
  * Пользователь не взаимодействовал с узлом (untouched)
40
35
  */
41
- untouched = d(() => !this._touched.value);
36
+ untouched = c(() => !this._touched.value);
42
37
  /**
43
38
  * Значение узла было изменено (dirty)
44
39
  * Computed из _dirty для предоставления readonly интерфейса
45
40
  */
46
- dirty = d(() => this._dirty.value);
41
+ dirty = c(() => this._dirty.value);
47
42
  /**
48
43
  * Значение узла не было изменено (pristine)
49
44
  */
50
- pristine = d(() => !this._dirty.value);
45
+ pristine = c(() => !this._dirty.value);
51
46
  /**
52
47
  * Текущий статус узла
53
48
  * Computed из _status для предоставления readonly интерфейса
54
49
  */
55
- status = d(() => this._status.value);
50
+ status = c(() => this._status.value);
56
51
  /**
57
52
  * Узел отключен (disabled)
58
53
  */
59
- disabled = d(() => this._status.value === "disabled");
54
+ disabled = c(() => this._status.value === "disabled");
60
55
  /**
61
56
  * Узел включен (enabled)
62
57
  */
63
- enabled = d(() => this._status.value !== "disabled");
58
+ enabled = c(() => this._status.value !== "disabled");
64
59
  /**
65
60
  * Получить ошибки валидации с фильтрацией
66
61
  *
@@ -108,8 +103,8 @@ class C {
108
103
  if (e.params !== void 0) {
109
104
  if (!s.params)
110
105
  return !1;
111
- for (const [i, r] of Object.entries(e.params))
112
- if (s.params[i] !== r)
106
+ for (const [r, n] of Object.entries(e.params))
107
+ if (s.params[r] !== n)
113
108
  return !1;
114
109
  }
115
110
  return !(e.predicate !== void 0 && !e.predicate(s));
@@ -285,7 +280,7 @@ class C {
285
280
  onEnable() {
286
281
  }
287
282
  }
288
- class D {
283
+ class z {
289
284
  /**
290
285
  * Хранилище подписок
291
286
  * Ключ: уникальный идентификатор подписки
@@ -453,7 +448,7 @@ class D {
453
448
  this.clear();
454
449
  }
455
450
  }
456
- const w = {
451
+ const O = {
457
452
  /** FieldNode.watch() */
458
453
  Watch: "watch",
459
454
  /** FieldNode.computeFrom() */
@@ -467,11 +462,144 @@ const w = {
467
462
  /** ArrayNode.watchLength() */
468
463
  WatchLength: "watchLength"
469
464
  };
470
- let X = 0;
471
- function A(a) {
472
- return `${a}-${++X}`;
465
+ let _e = 0;
466
+ function F(i) {
467
+ return `${i}-${++_e}`;
473
468
  }
474
- class Z {
469
+ var S = /* @__PURE__ */ ((i) => (i.THROW = "throw", i.LOG = "log", i.CONVERT = "convert", i))(S || {});
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, s = "throw") {
511
+ const r = this.extractMessage(e);
512
+ switch (s) {
513
+ case "throw":
514
+ throw e;
515
+ case "log":
516
+ return;
517
+ case "convert":
518
+ return {
519
+ code: "validator_error",
520
+ message: r,
521
+ params: { field: t }
522
+ };
523
+ }
524
+ }
525
+ /**
526
+ * Извлечь сообщение из ошибки
527
+ *
528
+ * Обрабатывает различные типы ошибок:
529
+ * - Error объекты → error.message
530
+ * - Строки → возвращает как есть
531
+ * - Объекты с message → извлекает message
532
+ * - Другое → String(error)
533
+ *
534
+ * @param error Ошибка для извлечения сообщения
535
+ * @returns Сообщение ошибки
536
+ * @private
537
+ *
538
+ * @example
539
+ * ```typescript
540
+ * FormErrorHandler.extractMessage(new Error('Test'));
541
+ * // 'Test'
542
+ *
543
+ * FormErrorHandler.extractMessage('String error');
544
+ * // 'String error'
545
+ *
546
+ * FormErrorHandler.extractMessage({ message: 'Object error' });
547
+ * // 'Object error'
548
+ *
549
+ * FormErrorHandler.extractMessage(null);
550
+ * // 'null'
551
+ * ```
552
+ */
553
+ static extractMessage(e) {
554
+ return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e ? String(e.message) : String(e);
555
+ }
556
+ /**
557
+ * Создать ValidationError с заданными параметрами
558
+ *
559
+ * Утилитная функция для создания ValidationError объектов
560
+ *
561
+ * @param code Код ошибки
562
+ * @param message Сообщение ошибки
563
+ * @param field Поле (опционально)
564
+ * @returns ValidationError объект
565
+ *
566
+ * @example
567
+ * ```typescript
568
+ * const error = FormErrorHandler.createValidationError(
569
+ * 'required',
570
+ * 'This field is required',
571
+ * 'email'
572
+ * );
573
+ * // { code: 'required', message: 'This field is required', field: 'email' }
574
+ * ```
575
+ */
576
+ static createValidationError(e, t, s) {
577
+ return {
578
+ code: e,
579
+ message: t,
580
+ params: s ? { field: s } : void 0
581
+ };
582
+ }
583
+ /**
584
+ * Проверить, является ли объект ValidationError
585
+ *
586
+ * Type guard для ValidationError
587
+ *
588
+ * @param value Значение для проверки
589
+ * @returns true если value является ValidationError
590
+ *
591
+ * @example
592
+ * ```typescript
593
+ * if (FormErrorHandler.isValidationError(result)) {
594
+ * console.log(result.code); // OK, типобезопасно
595
+ * }
596
+ * ```
597
+ */
598
+ static isValidationError(e) {
599
+ return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
600
+ }
601
+ }
602
+ class Ee {
475
603
  /** Внутренний сигнал статуса */
476
604
  _status;
477
605
  /** Публичный read-only сигнал статуса */
@@ -488,7 +616,7 @@ class Z {
488
616
  * @param initial - Начальный статус (по умолчанию 'valid')
489
617
  */
490
618
  constructor(e = "valid") {
491
- this._status = g(e), this.status = d(() => this._status.value), this.valid = d(() => this._status.value === "valid"), this.invalid = d(() => this._status.value === "invalid"), this.pending = d(() => this._status.value === "pending"), this.disabled = d(() => this._status.value === "disabled");
619
+ 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");
492
620
  }
493
621
  /**
494
622
  * Начать валидацию
@@ -616,7 +744,7 @@ class Z {
616
744
  return this._status.value !== "disabled";
617
745
  }
618
746
  }
619
- class ee extends C {
747
+ class we extends I {
620
748
  // ============================================================================
621
749
  // Приватные сигналы
622
750
  // ============================================================================
@@ -670,13 +798,13 @@ class ee extends C {
670
798
  * Менеджер подписок для централизованного cleanup
671
799
  * Использует SubscriptionManager вместо массива для управления подписками
672
800
  */
673
- disposers = new D();
801
+ disposers = new z();
674
802
  component;
675
803
  // ============================================================================
676
804
  // Конструктор
677
805
  // ============================================================================
678
806
  constructor(e) {
679
- super(), this.initialValue = e.value, this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = g(e.value), this._errors = g([]), this._componentProps = g(e.componentProps || {}), this.statusMachine = new Z(e.disabled ? "disabled" : "valid"), this.value = d(() => this._value.value), this.valid = d(() => this.statusMachine.valid.value), this.invalid = d(() => this.statusMachine.invalid.value), this.pending = d(() => this.statusMachine.pending.value), this.status = d(() => this.statusMachine.status.value), this.disabled = d(() => this.statusMachine.disabled.value), this.errors = d(() => this._errors.value), this.componentProps = d(() => this._componentProps.value), this.shouldShowError = d(
807
+ 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 Ee(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(
680
808
  () => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
681
809
  );
682
810
  }
@@ -689,12 +817,12 @@ class ee extends C {
689
817
  setValue(e, t) {
690
818
  if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
691
819
  return;
692
- const s = this.validators.length > 0 || this.asyncValidators.length > 0, i = this._errors.value.length > 0;
820
+ const s = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
693
821
  if (this.updateOn === "change") {
694
822
  this.validate();
695
823
  return;
696
824
  }
697
- i && s && this.validate();
825
+ r && s && this.validate();
698
826
  }
699
827
  patchValue(e) {
700
828
  this.setValue(e);
@@ -788,19 +916,19 @@ class ee extends C {
788
916
  if (this.cancelPendingValidation(), t <= 0 || this.asyncValidators.length === 0)
789
917
  return this.validateImmediate();
790
918
  const s = new AbortController();
791
- return new Promise((i) => {
792
- this.pendingValidation = { resolve: i, abortController: s }, this.validateDebounceTimer = setTimeout(async () => {
919
+ return new Promise((r) => {
920
+ this.pendingValidation = { resolve: r, abortController: s }, this.validateDebounceTimer = setTimeout(async () => {
793
921
  if (this.validateDebounceTimer = void 0, s.signal.aborted) {
794
- i(!1);
922
+ r(!1);
795
923
  return;
796
924
  }
797
925
  this.pendingValidation = void 0;
798
- const r = await this.validateImmediate(s);
799
- i(r);
926
+ const n = await this.validateImmediate(s);
927
+ r(n);
800
928
  }, t), s.signal.addEventListener(
801
929
  "abort",
802
930
  () => {
803
- this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), i(!1);
931
+ this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), r(!1);
804
932
  },
805
933
  { once: !0 }
806
934
  );
@@ -819,17 +947,17 @@ class ee extends C {
819
947
  async validateImmediate(e) {
820
948
  const t = e ?? new AbortController();
821
949
  e || this.currentAbortController?.abort(), this.currentAbortController = t;
822
- const { signal: s } = t, i = [];
823
- for (const n of this.validators) {
824
- const o = n(this._value.value);
825
- o && i.push(o);
950
+ const { signal: s } = t, r = [];
951
+ for (const a of this.validators) {
952
+ const o = a(this._value.value);
953
+ o && r.push(o);
826
954
  }
827
955
  if (s.aborted)
828
956
  return !1;
829
- if (i.length > 0) {
830
- this._errors.value = i;
831
- const n = i.some((o) => o.severity !== "warning");
832
- if (this.statusMachine.setErrors(n), n)
957
+ if (r.length > 0) {
958
+ this._errors.value = r;
959
+ const a = r.some((o) => o.severity !== "warning");
960
+ if (this.statusMachine.setErrors(a), a)
833
961
  return !1;
834
962
  }
835
963
  if (this.asyncValidators.length > 0) {
@@ -837,7 +965,7 @@ class ee extends C {
837
965
  return !1;
838
966
  this.statusMachine.startValidation();
839
967
  try {
840
- const n = await Promise.all(
968
+ const a = await Promise.all(
841
969
  this.asyncValidators.map(async (l) => {
842
970
  if (s.aborted)
843
971
  throw new DOMException("Validation aborted", "AbortError");
@@ -849,30 +977,30 @@ class ee extends C {
849
977
  } catch (u) {
850
978
  if (u instanceof DOMException && u.name === "AbortError")
851
979
  throw u;
852
- return S.handle(
980
+ return k.handle(
853
981
  u,
854
982
  "FieldNode AsyncValidator",
855
- V.CONVERT
983
+ S.CONVERT
856
984
  );
857
985
  }
858
986
  })
859
987
  );
860
988
  if (s.aborted)
861
989
  return !1;
862
- const o = n.filter(Boolean);
990
+ const o = a.filter(Boolean);
863
991
  if (o.length > 0) {
864
992
  this._errors.value = o;
865
993
  const l = o.some((u) => u.severity !== "warning");
866
994
  if (this.statusMachine.completeValidation(l), l)
867
995
  return !1;
868
996
  }
869
- } catch (n) {
870
- if (n instanceof DOMException && n.name === "AbortError")
997
+ } catch (a) {
998
+ if (a instanceof DOMException && a.name === "AbortError")
871
999
  return !1;
872
- throw n;
1000
+ throw a;
873
1001
  }
874
1002
  }
875
- 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"));
1003
+ 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"));
876
1004
  }
877
1005
  setErrors(e) {
878
1006
  this._errors.value = e;
@@ -995,10 +1123,10 @@ class ee extends C {
995
1123
  */
996
1124
  watch(e) {
997
1125
  const t = new AbortController(), s = m(() => {
998
- const r = this.value.value;
999
- e(r, t.signal);
1000
- }), i = A(w.Watch);
1001
- return this.disposers.add(i, () => {
1126
+ const n = this.value.value;
1127
+ e(n, t.signal);
1128
+ }), r = F(O.Watch);
1129
+ return this.disposers.add(r, () => {
1002
1130
  t.abort(), s();
1003
1131
  });
1004
1132
  }
@@ -1026,10 +1154,10 @@ class ee extends C {
1026
1154
  */
1027
1155
  computeFrom(e, t) {
1028
1156
  const s = m(() => {
1029
- const r = e.map((o) => o.value), n = t(...r);
1030
- this.setValue(n, { emitEvent: !1 });
1031
- }), i = A(w.ComputeFrom);
1032
- return this.disposers.add(i, s);
1157
+ const n = e.map((o) => o.value), a = t(...n);
1158
+ this.setValue(a, { emitEvent: !1 });
1159
+ }), r = F(O.ComputeFrom);
1160
+ return this.disposers.add(r, s);
1033
1161
  }
1034
1162
  /**
1035
1163
  * Очистить все ресурсы и таймеры
@@ -1059,451 +1187,46 @@ class ee extends C {
1059
1187
  }
1060
1188
  }
1061
1189
  }
1062
- class te {
1063
- form;
1064
- constructor(e) {
1065
- this.form = e;
1066
- }
1067
- /**
1068
- * Применить валидаторы к полям формы
1069
- *
1070
- * Этапы применения:
1071
- * 1. Разделение валидаторов на field и tree
1072
- * 2. Применение field валидаторов (sync/async)
1073
- * 3. Применение tree валидаторов (кросс-полевая валидация)
1074
- *
1075
- * @param validators Зарегистрированные валидаторы
1076
- */
1077
- async apply(e) {
1078
- const { validatorsByField: t, treeValidators: s } = this.groupValidators(e);
1079
- await this.applyFieldValidators(t), this.applyTreeValidators(s);
1080
- }
1081
- /**
1082
- * Группировка валидаторов по типам
1083
- *
1084
- * Разделяет валидаторы на:
1085
- * - Field validators (sync/async) - группируются по fieldPath
1086
- * - Tree validators - применяются ко всей форме
1087
- *
1088
- * @param validators Все зарегистрированные валидаторы
1089
- * @returns Сгруппированные валидаторы
1090
- */
1091
- groupValidators(e) {
1092
- const t = /* @__PURE__ */ new Map(), s = [];
1093
- for (const i of e)
1094
- if (i.type === "tree")
1095
- s.push(i);
1096
- else {
1097
- const r = t.get(i.fieldPath) || [];
1098
- r.push(i), t.set(i.fieldPath, r);
1099
- }
1100
- return { validatorsByField: t, treeValidators: s };
1101
- }
1102
- /**
1103
- * Применение field валидаторов к полям
1104
- *
1105
- * Для каждого поля:
1106
- * 1. Найти FieldNode по пути
1107
- * 2. Проверить условия (condition)
1108
- * 3. Выполнить sync/async валидаторы
1109
- * 4. Установить ошибки на поле
1110
- *
1111
- * @param validatorsByField Валидаторы, сгруппированные по полям
1112
- */
1113
- async applyFieldValidators(e) {
1114
- for (const [t, s] of e) {
1115
- const i = this.form.getFieldByPath(t);
1116
- if (!i) {
1117
- console.warn(`Field ${t} not found in GroupNode`);
1118
- continue;
1119
- }
1120
- if (!M(i) && !N(i)) {
1121
- process.env.NODE_ENV !== "production" && console.warn(`Validation can only run on FieldNode or ArrayNode, skipping ${t}`);
1122
- continue;
1123
- }
1124
- const r = [];
1125
- let n;
1126
- if (N(i)) {
1127
- const o = i.getValue();
1128
- n = new z(this.form, t, o);
1129
- } else
1130
- n = new J(this.form, t, i);
1131
- for (const o of s)
1132
- if (!(o.condition && !this.checkCondition(o.condition)))
1133
- try {
1134
- let l = null;
1135
- const u = n.value();
1136
- if (o.type === "sync") {
1137
- const v = o.validator;
1138
- l = v(u, n);
1139
- } else if (o.type === "async") {
1140
- const v = o.validator;
1141
- l = await v(u, n);
1142
- }
1143
- l && r.push(l);
1144
- } catch (l) {
1145
- S.handle(
1146
- l,
1147
- `ValidationApplicator: validator for ${t}`,
1148
- V.LOG
1149
- );
1150
- }
1151
- r.length > 0 ? i.setErrors(r) : i.clearErrors();
1152
- }
1153
- }
1154
- /**
1155
- * Применение tree валидаторов (кросс-полевая валидация)
1156
- *
1157
- * Tree валидаторы имеют доступ ко всей форме через TreeValidationContext.
1158
- * Ошибки устанавливаются на targetField (если указано).
1159
- *
1160
- * @param treeValidators Список tree валидаторов
1161
- */
1162
- applyTreeValidators(e) {
1163
- for (const t of e) {
1164
- const s = new Y(this.form);
1165
- if (!(t.condition && !this.checkCondition(t.condition)))
1166
- try {
1167
- if (t.type !== "tree")
1168
- continue;
1169
- const i = t.validator, r = i(s);
1170
- if (r && t.options && "targetField" in t.options) {
1171
- const n = t.options.targetField;
1172
- if (n) {
1173
- const o = this.form.getFieldByPath(String(n));
1174
- if (o && M(o)) {
1175
- const l = o.errors.value;
1176
- o.setErrors([...l, r]);
1177
- }
1178
- }
1179
- }
1180
- } catch (i) {
1181
- S.handle(i, "ValidationApplicator: tree validator", V.LOG);
1182
- }
1183
- }
1184
- }
1185
- /**
1186
- * Проверка условия (condition) для валидатора
1187
- *
1188
- * Условие определяет, должен ли валидатор выполняться.
1189
- * Использует getFieldByPath для поддержки вложенных путей.
1190
- *
1191
- * @param condition Условие валидатора
1192
- * @returns true, если условие выполнено
1193
- */
1194
- checkCondition(e) {
1195
- const t = this.form.getFieldByPath(e.fieldPath);
1196
- if (!t)
1197
- return !1;
1198
- const s = t.value.value;
1199
- return e.conditionFn(s);
1200
- }
1201
- }
1202
- class se {
1203
- /**
1204
- * Парсит путь в массив сегментов
1205
- *
1206
- * Поддерживаемые форматы:
1207
- * - Простые пути: "name", "email"
1208
- * - Вложенные пути: "address.city", "user.profile.avatar"
1209
- * - Массивы: "items[0]", "items[0].name", "tags[1][0]"
1210
- * - Комбинации: "orders[0].items[1].price"
1211
- *
1212
- * @param path Путь к полю (строка с точками и квадратными скобками)
1213
- * @returns Массив сегментов пути
1214
- *
1215
- * @example
1216
- * ```typescript
1217
- * navigator.parsePath('email');
1218
- * // [{ key: 'email' }]
1219
- *
1220
- * navigator.parsePath('address.city');
1221
- * // [{ key: 'address' }, { key: 'city' }]
1222
- *
1223
- * navigator.parsePath('items[0].name');
1224
- * // [{ key: 'items', index: 0 }, { key: 'name' }]
1225
- * ```
1226
- */
1227
- parsePath(e) {
1228
- const t = [];
1229
- let s = "", i = !1;
1230
- for (let r = 0; r < e.length; r++) {
1231
- const n = e[r];
1232
- n === "[" ? (i = !0, s += n) : n === "]" ? (i = !1, s += n) : n === "." && !i ? s && (this.addSegment(t, s), s = "") : s += n;
1233
- }
1234
- return s && this.addSegment(t, s), t;
1235
- }
1236
- /**
1237
- * Добавляет сегмент в массив, обрабатывая массивы
1238
- * @private
1239
- */
1240
- addSegment(e, t) {
1241
- const s = t.match(/^(.+)\[(\d+)\]$/);
1242
- s ? e.push({
1243
- key: s[1],
1244
- index: parseInt(s[2], 10)
1245
- }) : e.push({ key: t });
1246
- }
1247
- /**
1248
- * Получает значение по пути из объекта
1249
- *
1250
- * Проходит по всем сегментам пути и возвращает конечное значение.
1251
- * Если путь не найден, возвращает undefined.
1252
- *
1253
- * @param obj Объект для навигации
1254
- * @param path Путь к значению
1255
- * @returns Значение или undefined, если путь не найден
1256
- *
1257
- * @example
1258
- * ```typescript
1259
- * const obj = {
1260
- * email: 'test@mail.com',
1261
- * address: { city: 'Moscow' },
1262
- * items: [{ title: 'Item 1' }]
1263
- * };
1264
- *
1265
- * navigator.getValueByPath(obj, 'email');
1266
- * // 'test@mail.com'
1267
- *
1268
- * navigator.getValueByPath(obj, 'address.city');
1269
- * // 'Moscow'
1270
- *
1271
- * navigator.getValueByPath(obj, 'items[0].title');
1272
- * // 'Item 1'
1273
- *
1274
- * navigator.getValueByPath(obj, 'invalid.path');
1275
- * // undefined
1276
- * ```
1277
- */
1278
- getValueByPath(e, t) {
1279
- const s = this.parsePath(t);
1280
- let i = e;
1281
- for (const r of s) {
1282
- if (i == null) return;
1283
- if (i = i[r.key], r.index !== void 0) {
1284
- if (!Array.isArray(i)) return;
1285
- i = i[r.index];
1286
- }
1287
- }
1288
- return i;
1289
- }
1290
- /**
1291
- * Устанавливает значение по пути в объекте (мутирует объект)
1292
- *
1293
- * Создает промежуточные объекты, если они не существуют.
1294
- * Выбрасывает ошибку, если ожидается массив, но его нет.
1295
- *
1296
- * @param obj Объект для модификации
1297
- * @param path Путь к значению
1298
- * @param value Новое значение
1299
- *
1300
- * @throws {Error} Если ожидается массив по пути, но его нет
1301
- *
1302
- * @example
1303
- * ```typescript
1304
- * const obj = { address: { city: '' } };
1305
- * navigator.setValueByPath(obj, 'address.city', 'Moscow');
1306
- * // obj.address.city === 'Moscow'
1307
- *
1308
- * const obj2: UnknownRecord = {};
1309
- * navigator.setValueByPath(obj2, 'address.city', 'Moscow');
1310
- * // Создаст { address: { city: 'Moscow' } }
1311
- *
1312
- * const obj3 = { items: [{ title: 'Old' }] };
1313
- * navigator.setValueByPath(obj3, 'items[0].title', 'New');
1314
- * // obj3.items[0].title === 'New'
1315
- * ```
1316
- */
1317
- setValueByPath(e, t, s) {
1318
- const i = this.parsePath(t);
1319
- if (i.length === 0)
1320
- throw new Error("Cannot set value: empty path");
1321
- let r = e;
1322
- for (let o = 0; o < i.length - 1; o++) {
1323
- const l = i[o];
1324
- let u = r[l.key];
1325
- if (l.index !== void 0) {
1326
- if (!Array.isArray(u))
1327
- throw new Error(`Expected array at path segment: ${l.key}, but got ${typeof u}`);
1328
- r = u[l.index];
1329
- } else
1330
- u == null && (r[l.key] = {}, u = r[l.key]), r = u;
1331
- }
1332
- const n = i[i.length - 1];
1333
- if (n.index !== void 0) {
1334
- const o = r[n.key];
1335
- if (!Array.isArray(o))
1336
- throw new Error(
1337
- `Expected array at path segment: ${n.key}, but got ${typeof o}`
1338
- );
1339
- o[n.index] = s;
1340
- } else
1341
- r[n.key] = s;
1342
- }
1343
- /**
1344
- * Получить значение из FormNode по пути
1345
- *
1346
- * Автоматически извлекает значение из FormNode (через .value.value).
1347
- * Используется в ValidationContext и BehaviorContext для единообразного
1348
- * доступа к значениям полей формы.
1349
- *
1350
- * @param form Корневой узел формы (обычно GroupNode)
1351
- * @param path Путь к полю
1352
- * @returns Значение поля или undefined, если путь не найден
1353
- *
1354
- * @example
1355
- * ```typescript
1356
- * const form = new GroupNode({
1357
- * email: { value: 'test@mail.com', component: Input },
1358
- * address: {
1359
- * city: { value: 'Moscow', component: Input }
1360
- * },
1361
- * items: [{ title: { value: 'Item 1', component: Input } }]
1362
- * });
1363
- *
1364
- * navigator.getFormNodeValue(form, 'email');
1365
- * // 'test@mail.com'
1366
- *
1367
- * navigator.getFormNodeValue(form, 'address.city');
1368
- * // 'Moscow'
1369
- *
1370
- * navigator.getFormNodeValue(form, 'items[0].title');
1371
- * // 'Item 1'
1372
- *
1373
- * navigator.getFormNodeValue(form, 'invalid.path');
1374
- * // undefined
1375
- * ```
1376
- */
1377
- getFormNodeValue(e, t) {
1378
- const s = this.getNodeByPath(e, t);
1379
- if (s != null)
1380
- return this.isFormNode(s) ? s.value.value : s;
1381
- }
1382
- /**
1383
- * Type guard для проверки, является ли объект FormNode
1384
- *
1385
- * Проверяет наличие характерных свойств FormNode:
1386
- * - value (Signal)
1387
- * - value.value (значение Signal)
1388
- *
1389
- * @param obj Объект для проверки
1390
- * @returns true, если объект является FormNode
1391
- * @private
1392
- */
1393
- isFormNode(e) {
1394
- return e != null && typeof e == "object" && "value" in e && typeof e.value == "object" && e.value != null && "value" in e.value;
1395
- }
1396
- /**
1397
- * Получает узел формы по пути
1398
- *
1399
- * Навигирует по структуре FormNode (GroupNode/FieldNode/ArrayNode)
1400
- * и возвращает узел по указанному пути.
1401
- *
1402
- * Поддерживает:
1403
- * - Доступ к полям GroupNode через fields Map
1404
- * - Доступ к элементам ArrayNode через индекс
1405
- * - Proxy-доступ к полям (для обратной совместимости)
1406
- *
1407
- * @param form Корневой узел формы (обычно GroupNode)
1408
- * @param path Путь к узлу
1409
- * @returns Узел формы или null, если путь не найден
1410
- *
1411
- * @example
1412
- * ```typescript
1413
- * const form = new GroupNode({
1414
- * email: { value: '', component: Input },
1415
- * address: {
1416
- * city: { value: '', component: Input }
1417
- * },
1418
- * items: [{ title: { value: '', component: Input } }]
1419
- * });
1420
- *
1421
- * const emailNode = navigator.getNodeByPath(form, 'email');
1422
- * // FieldNode
1423
- *
1424
- * const cityNode = navigator.getNodeByPath(form, 'address.city');
1425
- * // FieldNode
1426
- *
1427
- * const itemNode = navigator.getNodeByPath(form, 'items[0]');
1428
- * // GroupNode
1429
- *
1430
- * const titleNode = navigator.getNodeByPath(form, 'items[0].title');
1431
- * // FieldNode
1432
- *
1433
- * const invalidNode = navigator.getNodeByPath(form, 'invalid.path');
1434
- * // null
1435
- * ```
1436
- */
1437
- getNodeByPath(e, t) {
1438
- const s = this.parsePath(t);
1439
- let i = e;
1440
- for (const r of s) {
1441
- if (i == null) return null;
1442
- const n = i;
1443
- if (n.fields && n.fields instanceof Map) {
1444
- if (i = n.fields.get(r.key), r.index === void 0) {
1445
- if (i == null) return null;
1446
- continue;
1447
- }
1448
- } else if (r.index !== void 0 && n.items) {
1449
- const o = n.items.value || n.items;
1450
- if (!Array.isArray(o) || (i = o[r.index], i == null)) return null;
1451
- continue;
1452
- } else if (r.index === void 0) {
1453
- if (i = n[r.key], i == null) return null;
1454
- continue;
1455
- }
1456
- if (i && r.index !== void 0 && i.items) {
1457
- const o = i.items.value || i.items;
1458
- if (!Array.isArray(o)) return null;
1459
- i = o[r.index];
1460
- } else if (i && r.index !== void 0 && !i.items)
1461
- return null;
1462
- if (i == null) return null;
1463
- }
1464
- return i;
1465
- }
1466
- }
1467
- function W(a) {
1468
- const { getChildren: e, ownErrors: t, disabled: s } = a, i = d(() => t.value.length > 0 ? !1 : e().every((h) => h.disabled.value || h.valid.value)), r = d(() => !i.value), n = d(() => e().some((h) => h.pending.value)), o = d(() => e().some((h) => h.touched.value)), l = d(() => e().some((h) => h.dirty.value)), u = d(() => {
1190
+ function J(i) {
1191
+ const { getChildren: e, ownErrors: t, disabled: s } = i, r = c(() => t.value.length > 0 ? !1 : e().every((h) => h.disabled.value || h.valid.value)), n = c(() => !r.value), a = c(() => e().some((h) => h.pending.value)), o = c(() => e().some((h) => h.touched.value)), l = c(() => e().some((h) => h.dirty.value)), u = c(() => {
1469
1192
  const h = [...t.value];
1470
1193
  for (const f of e())
1471
1194
  h.push(...f.errors.value);
1472
1195
  return h;
1473
- }), v = d(() => s?.value ? "disabled" : n.value ? "pending" : r.value ? "invalid" : "valid");
1196
+ }), y = c(() => s?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
1474
1197
  return {
1475
- valid: i,
1476
- invalid: r,
1477
- pending: n,
1198
+ valid: r,
1199
+ invalid: n,
1200
+ pending: a,
1478
1201
  touched: o,
1479
1202
  dirty: l,
1480
1203
  errors: u,
1481
- status: v
1204
+ status: y
1482
1205
  };
1483
1206
  }
1484
- function ie(a) {
1485
- return typeof a == "object" && a !== null && "getProxy" in a && typeof a.getProxy == "function";
1207
+ function Ae(i) {
1208
+ return typeof i == "object" && i !== null && "getProxy" in i && typeof i.getProxy == "function";
1486
1209
  }
1487
- function re(a, e) {
1488
- return new Proxy(a, {
1210
+ function Se(i, e) {
1211
+ return new Proxy(i, {
1489
1212
  get: (t, s) => {
1490
1213
  if (s in t)
1491
1214
  return t[s];
1492
1215
  if (typeof s == "string" && e.has(s)) {
1493
- const i = e.get(s);
1494
- return i && ie(i) ? i.getProxy() : i;
1216
+ const r = e.get(s);
1217
+ return r && Ae(r) ? r.getProxy() : r;
1495
1218
  }
1496
1219
  },
1497
- set: (t, s, i) => typeof s == "string" && e.has(s) ? !1 : (t[s] = i, !0),
1220
+ set: (t, s, r) => typeof s == "string" && e.has(s) ? !1 : (t[s] = r, !0),
1498
1221
  has: (t, s) => typeof s == "string" && e.has(s) ? !0 : s in t,
1499
1222
  ownKeys: (t) => {
1500
- const s = Reflect.ownKeys(t), i = Array.from(e.keys());
1501
- return [.../* @__PURE__ */ new Set([...s, ...i])];
1223
+ const s = Reflect.ownKeys(t), r = Array.from(e.keys());
1224
+ return [.../* @__PURE__ */ new Set([...s, ...r])];
1502
1225
  },
1503
1226
  getOwnPropertyDescriptor: (t, s) => typeof s == "string" && e.has(s) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, s)
1504
1227
  });
1505
1228
  }
1506
- class ae {
1229
+ class ke {
1507
1230
  /**
1508
1231
  * @param form - Форма для отправки
1509
1232
  */
@@ -1513,7 +1236,7 @@ class ae {
1513
1236
  /** Внутренний сигнал состояния отправки */
1514
1237
  _submitting = g(!1);
1515
1238
  /** Публичный read-only сигнал состояния отправки */
1516
- submitting = d(() => this._submitting.value);
1239
+ submitting = c(() => this._submitting.value);
1517
1240
  /**
1518
1241
  * Отправить форму
1519
1242
  *
@@ -1543,8 +1266,8 @@ class ae {
1543
1266
  * ```
1544
1267
  */
1545
1268
  async submit(e, t) {
1546
- const { skipValidation: s = !1, skipTouch: i = !1 } = t || {};
1547
- if (i || this.form.markAsTouched(), !s && !await this.form.validate())
1269
+ const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1270
+ if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1548
1271
  return null;
1549
1272
  this._submitting.value = !0;
1550
1273
  try {
@@ -1578,17 +1301,17 @@ class ae {
1578
1301
  * ```
1579
1302
  */
1580
1303
  async submitWithResult(e, t) {
1581
- const { skipValidation: s = !1, skipTouch: i = !1 } = t || {};
1582
- if (i || this.form.markAsTouched(), !s && !await this.form.validate())
1304
+ const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1305
+ if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1583
1306
  return { success: !1, data: null };
1584
1307
  this._submitting.value = !0;
1585
1308
  try {
1586
1309
  return { success: !0, data: await e(this.form.getValue()) };
1587
- } catch (r) {
1310
+ } catch (n) {
1588
1311
  return {
1589
1312
  success: !1,
1590
1313
  data: null,
1591
- error: r instanceof Error ? r : new Error(String(r))
1314
+ error: n instanceof Error ? n : new Error(String(n))
1592
1315
  };
1593
1316
  } finally {
1594
1317
  this._submitting.value = !1;
@@ -1601,7 +1324,16 @@ class ae {
1601
1324
  return this._submitting.value;
1602
1325
  }
1603
1326
  }
1604
- class k extends C {
1327
+ function Ve(i) {
1328
+ const e = [];
1329
+ for (const t of i.split(".")) {
1330
+ const s = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1331
+ if (!s) return [];
1332
+ e.push(s[2] !== void 0 ? { key: s[1], index: Number(s[2]) } : { key: s[1] });
1333
+ }
1334
+ return e;
1335
+ }
1336
+ let T = class oe extends I {
1605
1337
  // ============================================================================
1606
1338
  // Приватные поля
1607
1339
  // ============================================================================
@@ -1614,33 +1346,19 @@ class k extends C {
1614
1346
  /**
1615
1347
  * Менеджер подписок для централизованного cleanup
1616
1348
  */
1617
- disposers = new D();
1349
+ disposers = new z();
1618
1350
  /**
1619
- * Ссылка на Proxy-инстанс для использования в BehaviorContext
1351
+ * Ссылка на Proxy-инстанс
1620
1352
  */
1621
1353
  _proxyInstance;
1622
1354
  /**
1623
- * Навигатор для работы с путями к полям
1355
+ * Cleanup декларативной схемы поведения (createForm({ behavior })). Вызывается в dispose().
1624
1356
  */
1625
- pathNavigator = new se();
1357
+ _behaviorCleanup;
1626
1358
  /**
1627
1359
  * Фабрика для создания узлов формы
1628
1360
  */
1629
- nodeFactory = new ne();
1630
- /**
1631
- * Реестр валидаторов для этой формы
1632
- * Может быть инжектирован через config._validationRegistry для тестирования
1633
- */
1634
- validationRegistry;
1635
- /**
1636
- * Реестр behaviors для этой формы
1637
- * Может быть инжектирован через config._behaviorRegistry для тестирования
1638
- */
1639
- behaviorRegistry;
1640
- /**
1641
- * Аппликатор для применения валидаторов к форме
1642
- */
1643
- validationApplicator = new te(this);
1361
+ nodeFactory = new Oe();
1644
1362
  // ============================================================================
1645
1363
  // Приватные сигналы состояния (inline из StateManager)
1646
1364
  // ============================================================================
@@ -1664,25 +1382,24 @@ class k extends C {
1664
1382
  status;
1665
1383
  submitting;
1666
1384
  constructor(e) {
1667
- super(), this.formSubmitter = new ae(this);
1668
- const t = "form" in e, s = t ? e : void 0, i = t ? e.form : e, r = t ? e.behavior : void 0, n = t ? e.validation : void 0;
1669
- this.validationRegistry = s?._validationRegistry ?? new K(), this.behaviorRegistry = s?._behaviorRegistry ?? new H();
1670
- for (const [l, u] of Object.entries(i)) {
1671
- const v = this.createNode(u);
1672
- this._fields.set(l, v);
1385
+ super(), this.formSubmitter = new ke(this);
1386
+ const s = "form" in e ? e.form : e;
1387
+ for (const [n, a] of Object.entries(s)) {
1388
+ const o = this.createNode(a);
1389
+ this._fields.set(n, o);
1673
1390
  }
1674
- this.value = d(() => {
1675
- const l = {};
1676
- return this._fields.forEach((u, v) => {
1677
- l[v] = u.value.value;
1678
- }), l;
1391
+ this.value = c(() => {
1392
+ const n = {};
1393
+ return this._fields.forEach((a, o) => {
1394
+ n[o] = a.value.value;
1395
+ }), n;
1679
1396
  });
1680
- const o = W({
1397
+ const r = J({
1681
1398
  getChildren: () => Array.from(this._fields.values()),
1682
1399
  ownErrors: this._formErrors,
1683
1400
  disabled: this._disabled
1684
1401
  });
1685
- this.valid = o.valid, this.invalid = o.invalid, this.pending = o.pending, this.touched = o.touched, this.dirty = o.dirty, this.errors = o.errors, this.status = o.status, this.submitting = this.formSubmitter.submitting, r && this.applyBehaviorSchema(r), n && this.applyValidationSchema(n);
1402
+ this.valid = r.valid, this.invalid = r.invalid, this.pending = r.pending, this.touched = r.touched, this.dirty = r.dirty, this.errors = r.errors, this.status = r.status, this.submitting = this.formSubmitter.submitting;
1686
1403
  }
1687
1404
  // ============================================================================
1688
1405
  // Приватный метод для создания Proxy
@@ -1692,7 +1409,7 @@ class k extends C {
1692
1409
  * @see buildFormProxy
1693
1410
  */
1694
1411
  buildProxy() {
1695
- return re(this, this._fields);
1412
+ return Se(this, this._fields);
1696
1413
  }
1697
1414
  // ============================================================================
1698
1415
  // Реализация абстрактных методов FormNode
@@ -1704,16 +1421,22 @@ class k extends C {
1704
1421
  }), e;
1705
1422
  }
1706
1423
  setValue(e, t) {
1707
- for (const [s, i] of Object.entries(e)) {
1708
- const r = this._fields.get(s);
1709
- r && r.setValue(i, t);
1424
+ for (const [s, r] of Object.entries(e)) {
1425
+ const n = this._fields.get(s);
1426
+ if (n) {
1427
+ if (U(n.value)) continue;
1428
+ n.setValue(r, t);
1429
+ }
1710
1430
  }
1711
1431
  }
1712
1432
  patchValue(e) {
1713
- j(() => {
1433
+ ge(() => {
1714
1434
  for (const [t, s] of Object.entries(e)) {
1715
- const i = this._fields.get(t);
1716
- i && s !== void 0 && i.setValue(s, { emitEvent: !1 });
1435
+ const r = this._fields.get(t);
1436
+ if (r && s !== void 0) {
1437
+ if (U(r.value)) continue;
1438
+ r.setValue(s, { emitEvent: !1 });
1439
+ }
1717
1440
  }
1718
1441
  });
1719
1442
  }
@@ -1736,8 +1459,8 @@ class k extends C {
1736
1459
  */
1737
1460
  reset(e) {
1738
1461
  this._fields.forEach((t, s) => {
1739
- const i = e?.[s];
1740
- t.reset(i);
1462
+ const r = e?.[s];
1463
+ t.reset(r);
1741
1464
  });
1742
1465
  }
1743
1466
  /**
@@ -1749,10 +1472,8 @@ class k extends C {
1749
1472
  });
1750
1473
  }
1751
1474
  async validate() {
1752
- this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((t) => t.validate()));
1753
- const e = this.validationRegistry.getValidators();
1754
- return e && e.length > 0 && await this.applyContextualValidators(e), Array.from(this._fields.values()).every(
1755
- (t) => t.valid.value || t.disabled.value
1475
+ return this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((e) => e.validate())), Array.from(this._fields.values()).every(
1476
+ (e) => e.valid.value || e.disabled.value
1756
1477
  );
1757
1478
  }
1758
1479
  /**
@@ -1852,36 +1573,6 @@ class k extends C {
1852
1573
  async submitWithResult(e, t) {
1853
1574
  return this.formSubmitter.submitWithResult(e, t);
1854
1575
  }
1855
- /**
1856
- * Применить validation schema к форме
1857
- *
1858
- * Использует локальный реестр валидаторов (this.validationRegistry)
1859
- * вместо глобального Singleton для изоляции форм друг от друга.
1860
- */
1861
- applyValidationSchema(e) {
1862
- this.validationRegistry.beginRegistration();
1863
- try {
1864
- const t = I();
1865
- e(t);
1866
- const s = this.getProxy();
1867
- this.validationRegistry.endRegistration(s);
1868
- } catch (t) {
1869
- throw console.error("Error applying validation schema:", t), t;
1870
- }
1871
- }
1872
- /**
1873
- * Применить behavior schema к форме
1874
- * @returns Функция cleanup для отписки от всех behaviors
1875
- */
1876
- applyBehaviorSchema(e) {
1877
- this.behaviorRegistry.beginRegistration();
1878
- try {
1879
- const t = I();
1880
- return e(t), this.behaviorRegistry.endRegistration(this.getProxy()).cleanup;
1881
- } catch (t) {
1882
- throw console.error("Error applying behavior schema:", t), t;
1883
- }
1884
- }
1885
1576
  /**
1886
1577
  * Получить вложенное поле по пути
1887
1578
  *
@@ -1914,37 +1605,22 @@ class k extends C {
1914
1605
  getFieldByPath(e) {
1915
1606
  if (e.startsWith(".") || e.endsWith("."))
1916
1607
  return;
1917
- const t = this.pathNavigator.parsePath(e);
1608
+ const t = Ve(e);
1918
1609
  if (t.length === 0)
1919
1610
  return;
1920
1611
  let s = this;
1921
- for (const i of t) {
1922
- if (!(s instanceof k) || (s = s.getField(i.key), !s)) return;
1923
- if (i.index !== void 0)
1612
+ for (const r of t) {
1613
+ if (!(s instanceof oe) || (s = s.getField(r.key), !s)) return;
1614
+ if (r.index !== void 0)
1924
1615
  if ("at" in s && "length" in s && typeof s.at == "function") {
1925
- const r = s.at(i.index);
1926
- if (!r) return;
1927
- s = r;
1616
+ const n = s.at(r.index);
1617
+ if (!n) return;
1618
+ s = n;
1928
1619
  } else
1929
1620
  return;
1930
1621
  }
1931
1622
  return s;
1932
1623
  }
1933
- /**
1934
- * Применить contextual валидаторы к полям
1935
- *
1936
- * ✅ РЕФАКТОРИНГ: Делегирование ValidationApplicator (SRP)
1937
- *
1938
- * Логика применения валидаторов извлечена в ValidationApplicator для:
1939
- * - Соблюдения Single Responsibility Principle
1940
- * - Уменьшения размера GroupNode (~120 строк)
1941
- * - Улучшения тестируемости
1942
- *
1943
- * @param validators Зарегистрированные валидаторы
1944
- */
1945
- async applyContextualValidators(e) {
1946
- await this.validationApplicator.apply(e);
1947
- }
1948
1624
  // ============================================================================
1949
1625
  // Private методы для создания узлов
1950
1626
  // ============================================================================
@@ -1973,16 +1649,16 @@ class k extends C {
1973
1649
  * Связывает два поля: при изменении source автоматически обновляется target
1974
1650
  */
1975
1651
  linkFields(e, t, s) {
1976
- const i = this._fields.get(e), r = this._fields.get(t);
1977
- if (!i || !r) {
1978
- const l = i ? t : e;
1652
+ const r = this._fields.get(e), n = this._fields.get(t);
1653
+ if (!r || !n) {
1654
+ const l = r ? t : e;
1979
1655
  throw new Error(`GroupNode.linkFields: field "${String(l)}" not found`);
1980
1656
  }
1981
- const n = m(() => {
1982
- const l = i.value.value, u = s ? s(l) : l;
1983
- r.setValue(u, { emitEvent: !1 });
1984
- }), o = A(w.LinkFields);
1985
- return this.disposers.add(o, n);
1657
+ const a = m(() => {
1658
+ const l = r.value.value, u = s ? s(l) : l;
1659
+ n.setValue(u, { emitEvent: !1 });
1660
+ }), o = F(O.LinkFields);
1661
+ return this.disposers.add(o, a);
1986
1662
  }
1987
1663
  /**
1988
1664
  * Подписка на изменения вложенного поля по строковому пути
@@ -2015,11 +1691,11 @@ class k extends C {
2015
1691
  const s = this.getFieldByPath(e);
2016
1692
  if (!s)
2017
1693
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
2018
- const i = m(() => {
2019
- const n = s.value.value;
2020
- t(n);
2021
- }), r = A(w.WatchField);
2022
- return this.disposers.add(r, i);
1694
+ const r = m(() => {
1695
+ const a = s.value.value;
1696
+ t(a);
1697
+ }), n = F(O.WatchField);
1698
+ return this.disposers.add(n, r);
2023
1699
  }
2024
1700
  /**
2025
1701
  * Hook: вызывается после disable()
@@ -2033,16 +1709,22 @@ class k extends C {
2033
1709
  onEnable() {
2034
1710
  this._disabled.value = !1, this._fields.forEach((e) => e.enable());
2035
1711
  }
1712
+ /**
1713
+ * Прикрепить cleanup декларативной схемы поведения (вызывается createForm).
1714
+ * @internal
1715
+ */
1716
+ attachBehaviorCleanup(e) {
1717
+ this._behaviorCleanup = e;
1718
+ }
2036
1719
  /**
2037
1720
  * Очистить все ресурсы узла
2038
1721
  */
2039
1722
  dispose() {
2040
- this.disposers.dispose(), this._fields.forEach((e) => {
1723
+ this._behaviorCleanup?.(), this._behaviorCleanup = void 0, this.disposers.dispose(), this._fields.forEach((e) => {
2041
1724
  "dispose" in e && typeof e.dispose == "function" && e.dispose();
2042
1725
  });
2043
1726
  }
2044
- }
2045
- class L extends C {
1727
+ }, Z = class extends I {
2046
1728
  // ============================================================================
2047
1729
  // Приватные поля
2048
1730
  // ============================================================================
@@ -2053,7 +1735,7 @@ class L extends C {
2053
1735
  * Менеджер подписок для централизованного cleanup
2054
1736
  * Использует SubscriptionManager вместо массива для управления подписками
2055
1737
  */
2056
- disposers = new D();
1738
+ disposers = new z();
2057
1739
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
2058
1740
  _arrayErrors = g([]);
2059
1741
  // ============================================================================
@@ -2078,10 +1760,10 @@ class L extends C {
2078
1760
  // ============================================================================
2079
1761
  constructor(e, t = []) {
2080
1762
  super(), this.itemSchema = e, this.initialItems = t, this.items = g([]);
2081
- for (const i of t)
2082
- this.push(i);
2083
- this.length = d(() => this.items.value.length), this.value = d(() => this.items.value.map((i) => i.value.value));
2084
- const s = W({
1763
+ for (const r of t)
1764
+ this.push(r);
1765
+ this.length = c(() => this.items.value.length), this.value = c(() => this.items.value.map((r) => r.value.value));
1766
+ const s = J({
2085
1767
  getChildren: () => this.items.value,
2086
1768
  ownErrors: this._arrayErrors
2087
1769
  });
@@ -2107,17 +1789,17 @@ class L extends C {
2107
1789
  */
2108
1790
  removeAt(e) {
2109
1791
  if (e < 0 || e >= this.items.value.length) {
2110
- S.handle(
1792
+ k.handle(
2111
1793
  new Error(
2112
1794
  `ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
2113
1795
  ),
2114
1796
  "ArrayNode.removeAt",
2115
- V.LOG
1797
+ S.LOG
2116
1798
  );
2117
1799
  return;
2118
1800
  }
2119
1801
  const t = this.items.value[e];
2120
- this.items.value = this.items.value.filter((s, i) => i !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1802
+ this.items.value = this.items.value.filter((s, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
2121
1803
  }
2122
1804
  /**
2123
1805
  * Вставить элемент в массив
@@ -2126,17 +1808,75 @@ class L extends C {
2126
1808
  */
2127
1809
  insert(e, t) {
2128
1810
  if (e < 0 || e > this.items.value.length) {
2129
- S.handle(
1811
+ k.handle(
2130
1812
  new Error(
2131
1813
  `ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
2132
1814
  ),
2133
1815
  "ArrayNode.insert",
2134
- V.LOG
1816
+ S.LOG
1817
+ );
1818
+ return;
1819
+ }
1820
+ const s = this.createItem(t), r = [...this.items.value];
1821
+ r.splice(e, 0, s), this.items.value = r;
1822
+ }
1823
+ /**
1824
+ * Переместить элемент массива с позиции `from` на позицию `to`
1825
+ *
1826
+ * @param from - Индекс перемещаемого элемента
1827
+ * @param to - Целевой индекс
1828
+ *
1829
+ * @remarks
1830
+ * Реордер не уничтожает элемент (dispose НЕ вызывается) — тот же инстанс под-формы
1831
+ * переезжает на новую позицию, состояние/валидация сохраняются. Длина не меняется.
1832
+ *
1833
+ * @example
1834
+ * ```typescript
1835
+ * // Поднять элемент #2 на одну позицию вверх
1836
+ * form.items.move(2, 1);
1837
+ * ```
1838
+ */
1839
+ move(e, t) {
1840
+ const s = this.items.value.length;
1841
+ if (e < 0 || e >= s || t < 0 || t >= s) {
1842
+ k.handle(
1843
+ new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${s})`),
1844
+ "ArrayNode.move",
1845
+ S.LOG
2135
1846
  );
2136
1847
  return;
2137
1848
  }
2138
- const s = this.createItem(t), i = [...this.items.value];
2139
- i.splice(e, 0, s), this.items.value = i;
1849
+ if (e === t) return;
1850
+ const r = [...this.items.value], [n] = r.splice(e, 1);
1851
+ r.splice(t, 0, n), this.items.value = r;
1852
+ }
1853
+ /**
1854
+ * Поменять местами два элемента массива
1855
+ *
1856
+ * @param a - Индекс первого элемента
1857
+ * @param b - Индекс второго элемента
1858
+ *
1859
+ * @remarks
1860
+ * Как и {@link move}, не уничтожает элементы — меняет только их порядок.
1861
+ *
1862
+ * @example
1863
+ * ```typescript
1864
+ * form.items.swap(0, 2);
1865
+ * ```
1866
+ */
1867
+ swap(e, t) {
1868
+ const s = this.items.value.length;
1869
+ if (e < 0 || e >= s || t < 0 || t >= s) {
1870
+ k.handle(
1871
+ new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${s})`),
1872
+ "ArrayNode.swap",
1873
+ S.LOG
1874
+ );
1875
+ return;
1876
+ }
1877
+ if (e === t) return;
1878
+ const r = [...this.items.value];
1879
+ [r[e], r[t]] = [r[t], r[e]], this.items.value = r;
2140
1880
  }
2141
1881
  /**
2142
1882
  * Удалить все элементы массива
@@ -2168,7 +1908,7 @@ class L extends C {
2168
1908
  }
2169
1909
  setValue(e, t) {
2170
1910
  this.clear(), e.forEach((s) => this.push(s)), t?.emitEvent !== !1 && this.validate().catch((s) => {
2171
- S.handle(s, "ArrayNode.setValue", V.LOG);
1911
+ k.handle(s, "ArrayNode.setValue", S.LOG);
2172
1912
  });
2173
1913
  }
2174
1914
  patchValue(e) {
@@ -2302,8 +2042,8 @@ class L extends C {
2302
2042
  */
2303
2043
  forEach(e) {
2304
2044
  this.items.value.forEach((t, s) => {
2305
- const i = t.getProxy();
2306
- e(i, s);
2045
+ const r = t.getProxy();
2046
+ e(r, s);
2307
2047
  });
2308
2048
  }
2309
2049
  /**
@@ -2313,8 +2053,8 @@ class L extends C {
2313
2053
  */
2314
2054
  map(e) {
2315
2055
  return this.items.value.map((t, s) => {
2316
- const i = t.getProxy();
2317
- return e(i, s);
2056
+ const r = t.getProxy();
2057
+ return e(r, s);
2318
2058
  });
2319
2059
  }
2320
2060
  // ============================================================================
@@ -2326,7 +2066,7 @@ class L extends C {
2326
2066
  */
2327
2067
  createItem(e) {
2328
2068
  if (this.isGroupSchema(this.itemSchema)) {
2329
- const t = new k(this.itemSchema);
2069
+ const t = new T(this.itemSchema);
2330
2070
  return e && t.patchValue(e), this.validationSchemaFn && "applyValidationSchema" in t && t.applyValidationSchema(this.validationSchemaFn), this.behaviorSchemaFn && "applyBehaviorSchema" in t && t.applyBehaviorSchema(this.behaviorSchemaFn), t;
2331
2071
  }
2332
2072
  throw new Error(
@@ -2414,13 +2154,13 @@ class L extends C {
2414
2154
  */
2415
2155
  watchItems(e, t) {
2416
2156
  const s = m(() => {
2417
- const r = this.items.value.map((n) => {
2418
- if (n instanceof k)
2419
- return n.getFieldByPath(e)?.value.value;
2157
+ const n = this.items.value.map((a) => {
2158
+ if (a instanceof T)
2159
+ return a.getFieldByPath(e)?.value.value;
2420
2160
  });
2421
- t(r);
2422
- }), i = A(w.WatchItems);
2423
- return this.disposers.add(i, s);
2161
+ t(n);
2162
+ }), r = F(O.WatchItems);
2163
+ return this.disposers.add(r, s);
2424
2164
  }
2425
2165
  /**
2426
2166
  * Подписка на изменение длины массива
@@ -2446,9 +2186,9 @@ class L extends C {
2446
2186
  */
2447
2187
  watchLength(e) {
2448
2188
  const t = m(() => {
2449
- const i = this.length.value;
2450
- e(i);
2451
- }), s = A(w.WatchLength);
2189
+ const r = this.length.value;
2190
+ e(r);
2191
+ }), s = F(O.WatchLength);
2452
2192
  return this.disposers.add(s, t);
2453
2193
  }
2454
2194
  /**
@@ -2511,8 +2251,8 @@ class L extends C {
2511
2251
  e.enable();
2512
2252
  });
2513
2253
  }
2514
- }
2515
- class ne {
2254
+ };
2255
+ class Oe {
2516
2256
  /**
2517
2257
  * Создает узел формы на основе конфигурации
2518
2258
  *
@@ -2562,16 +2302,16 @@ class ne {
2562
2302
  if (Array.isArray(e) && e.length >= 1)
2563
2303
  return this.createArrayNodeFromArray(e);
2564
2304
  if (this.isFieldConfig(e))
2565
- return new ee(e);
2305
+ return new we(e);
2566
2306
  if (this.isArrayConfig(e)) {
2567
2307
  const t = e;
2568
- return new L(
2308
+ return new Z(
2569
2309
  t.schema,
2570
2310
  t.initialItems
2571
2311
  );
2572
2312
  }
2573
2313
  if (this.isGroupConfig(e))
2574
- return new k(e);
2314
+ return new T(e);
2575
2315
  throw new Error(
2576
2316
  `NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
2577
2317
  e
@@ -2605,11 +2345,11 @@ class ne {
2605
2345
  */
2606
2346
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2607
2347
  createArrayNodeFromArray(e) {
2608
- const [t, ...s] = e, i = [];
2609
- this.isGroupConfig(t) && i.push(this.extractValues(t));
2610
- for (const r of s)
2611
- this.isGroupConfig(r) ? i.push(this.extractValues(r)) : i.push(r);
2612
- return new L(t, i);
2348
+ const [t, ...s] = e, r = [];
2349
+ this.isGroupConfig(t) && r.push(this.extractValues(t));
2350
+ for (const n of s)
2351
+ this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
2352
+ return new Z(t, r);
2613
2353
  }
2614
2354
  /**
2615
2355
  * Извлечь значения из схемы (рекурсивно)
@@ -2647,8 +2387,8 @@ class ne {
2647
2387
  return e.map((t) => this.extractValues(t));
2648
2388
  if (this.isGroupConfig(e)) {
2649
2389
  const t = {};
2650
- for (const [s, i] of Object.entries(e))
2651
- t[s] = this.extractValues(i);
2390
+ for (const [s, r] of Object.entries(e))
2391
+ t[s] = this.extractValues(r);
2652
2392
  return t;
2653
2393
  }
2654
2394
  return e;
@@ -2673,7 +2413,7 @@ class ne {
2673
2413
  * ```
2674
2414
  */
2675
2415
  isFieldConfig(e) {
2676
- return e != null && typeof e == "object" && "value" in e && "component" in e;
2416
+ return e == null || typeof e != "object" ? !1 : "valueSignal" in e ? !0 : "value" in e && "component" in e;
2677
2417
  }
2678
2418
  /**
2679
2419
  * Проверяет, является ли конфиг конфигурацией массива (ArrayConfig)
@@ -2728,10 +2468,345 @@ class ne {
2728
2468
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2729
2469
  }
2730
2470
  }
2731
- function ge(a) {
2732
- return new k(a).getProxy();
2471
+ class Fe {
2472
+ stack = [];
2473
+ /**
2474
+ * Добавить элемент в стек
2475
+ * @param item - Элемент для добавления
2476
+ */
2477
+ push(e) {
2478
+ this.stack.push(e);
2479
+ }
2480
+ /**
2481
+ * Извлечь элемент из стека
2482
+ * @returns Извлеченный элемент или undefined если стек пуст
2483
+ */
2484
+ pop() {
2485
+ return this.stack.pop();
2486
+ }
2487
+ /**
2488
+ * Получить текущий элемент (вершину стека) без извлечения
2489
+ * @returns Текущий элемент или null если стек пуст
2490
+ */
2491
+ getCurrent() {
2492
+ return this.stack.length > 0 ? this.stack[this.stack.length - 1] : null;
2493
+ }
2494
+ /**
2495
+ * Извлечь элемент из стека с проверкой
2496
+ * Выводит предупреждение в DEV режиме если извлеченный элемент не совпадает с ожидаемым
2497
+ *
2498
+ * @param expected - Ожидаемый элемент
2499
+ * @param name - Имя реестра для отладки (например, 'ValidationRegistry')
2500
+ */
2501
+ verify(e, t) {
2502
+ this.pop();
2503
+ }
2504
+ /**
2505
+ * Получить длину стека
2506
+ * @returns Количество элементов в стеке
2507
+ */
2508
+ get length() {
2509
+ return this.stack.length;
2510
+ }
2511
+ /**
2512
+ * Проверить, пуст ли стек
2513
+ * @returns true если стек пуст
2514
+ */
2515
+ isEmpty() {
2516
+ return this.stack.length === 0;
2517
+ }
2518
+ /**
2519
+ * Очистить стек
2520
+ */
2521
+ clear() {
2522
+ this.stack = [];
2523
+ }
2524
+ }
2525
+ function L(i) {
2526
+ return i == null ? !1 : typeof i == "object" && "value" in i && "setValue" in i && "getValue" in i && "validate" in i;
2527
+ }
2528
+ function Ne(i) {
2529
+ return i == null ? !1 : L(i) && "validators" in i && "asyncValidators" in i && // FieldNode имеет markAsTouched метод
2530
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2531
+ typeof i.markAsTouched == "function" && // У FieldNode нет fields или items
2532
+ !("fields" in i) && !("items" in i);
2533
+ }
2534
+ function Te(i) {
2535
+ return i == null ? !1 : L(i) && "getFieldByPath" in i && "fields" in i && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2536
+ !("items" in i) && !("push" in i) && !("removeAt" in i);
2537
+ }
2538
+ function xe(i) {
2539
+ return i == null ? !1 : L(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
2540
+ typeof i.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2541
+ typeof i.removeAt == "function";
2542
+ }
2543
+ function Ye(i) {
2544
+ return Ne(i) ? "FieldNode" : Te(i) ? "GroupNode" : xe(i) ? "ArrayNode" : L(i) ? "FormNode" : "Unknown";
2545
+ }
2546
+ class Pe extends I {
2547
+ /**
2548
+ * @param control Реактивный массив модели (`model.<path>`).
2549
+ * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
2550
+ * импорта с `create-form`). Обычно `(item) => createForm({ model: item, schema: itemSchema(item) })`.
2551
+ */
2552
+ constructor(e, t) {
2553
+ super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = m(() => {
2554
+ const r = e.length, n = [];
2555
+ for (let a = 0; a < r; a++) {
2556
+ const o = e.at(a);
2557
+ if (!o) continue;
2558
+ let l = this.cache.get(o);
2559
+ l || (l = t(o), this.cache.set(o, l)), n.push(l);
2560
+ }
2561
+ this.itemNodes.value = n;
2562
+ }), this.length = c(() => this.itemNodes.value.length), this.value = c(() => this.itemNodes.value.map((r) => r.value.value));
2563
+ const s = J({
2564
+ getChildren: () => this.itemNodes.value,
2565
+ ownErrors: this._arrayErrors
2566
+ });
2567
+ 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;
2568
+ }
2569
+ itemNodes = g([]);
2570
+ // Кэш per-item формы по идентичности фасада под-модели (фасады кэшируются в core).
2571
+ cache = /* @__PURE__ */ new WeakMap();
2572
+ initial;
2573
+ _arrayErrors = g([]);
2574
+ disposeSync;
2575
+ /**
2576
+ * Сигнал per-item форм. Публичен в т.ч. чтобы `isArrayNode` распознавал узел как массив
2577
+ * (duck-typing проверяет наличие `items`).
2578
+ */
2579
+ get items() {
2580
+ return this.itemNodes;
2581
+ }
2582
+ value;
2583
+ valid;
2584
+ invalid;
2585
+ pending;
2586
+ touched;
2587
+ dirty;
2588
+ errors;
2589
+ status;
2590
+ length;
2591
+ // ── Доступ к элементам ─────────────────────────────────────────────────────
2592
+ at(e) {
2593
+ return this.itemNodes.value[e];
2594
+ }
2595
+ map(e) {
2596
+ return this.itemNodes.value.map((t, s) => e(t, s));
2597
+ }
2598
+ forEach(e) {
2599
+ this.itemNodes.value.forEach((t, s) => e(t, s));
2600
+ }
2601
+ // ── Мутации (делегируют массиву модели; effect пересоберёт itemNodes) ──────
2602
+ push(e) {
2603
+ this.control.push(e ?? {});
2604
+ }
2605
+ insert(e, t) {
2606
+ this.control.insertAt(e, t ?? {});
2607
+ }
2608
+ removeAt(e) {
2609
+ this.control.removeAt(e);
2610
+ }
2611
+ /**
2612
+ * Переместить элемент модель-массива. Делегирует мутацию массиву модели; внутренний `effect`
2613
+ * пересоберёт `itemNodes` в новом порядке (per-item формы сохраняются по кешу идентичности).
2614
+ */
2615
+ move(e, t) {
2616
+ this.control.move(e, t);
2617
+ }
2618
+ /** Поменять местами два элемента модель-массива (см. {@link move}). */
2619
+ swap(e, t) {
2620
+ this.control.swap(e, t);
2621
+ }
2622
+ clear() {
2623
+ this.control.clear();
2624
+ }
2625
+ // ── Абстрактные методы FormNode ────────────────────────────────────────────
2626
+ getValue() {
2627
+ return this.control.toArray();
2628
+ }
2629
+ setValue(e) {
2630
+ this.control.clear(), (e ?? []).forEach((t) => this.control.push(t));
2631
+ }
2632
+ patchValue(e) {
2633
+ this.setValue(e);
2634
+ }
2635
+ reset(e) {
2636
+ this._arrayErrors.value = [], this.setValue(e ?? this.initial);
2637
+ }
2638
+ resetToInitial() {
2639
+ this.reset(this.initial);
2640
+ }
2641
+ async validate() {
2642
+ return (await Promise.all(
2643
+ this.itemNodes.value.map(
2644
+ (t) => t.validate()
2645
+ )
2646
+ )).every(Boolean) && this._arrayErrors.value.length === 0;
2647
+ }
2648
+ setErrors(e) {
2649
+ this._arrayErrors.value = e;
2650
+ }
2651
+ clearErrors() {
2652
+ this._arrayErrors.value = [], this.itemNodes.value.forEach(
2653
+ (e) => e.clearErrors?.()
2654
+ );
2655
+ }
2656
+ // ── Hooks (forward к элементам) ────────────────────────────────────────────
2657
+ onMarkAsTouched() {
2658
+ this.itemNodes.value.forEach(
2659
+ (e) => e.markAsTouched?.()
2660
+ );
2661
+ }
2662
+ /** Очистка подписки синхронизации. */
2663
+ dispose() {
2664
+ this.disposeSync();
2665
+ }
2666
+ }
2667
+ const le = (i) => i !== null && typeof i == "object" && !Array.isArray(i) && !(i instanceof Date) && !(typeof Blob < "u" && i instanceof Blob) && !(typeof File < "u" && i instanceof File);
2668
+ function W(i, e, t) {
2669
+ if (i == null || typeof i != "object") return;
2670
+ if (Array.isArray(i)) {
2671
+ for (const n of i) W(n, e, t);
2672
+ return;
2673
+ }
2674
+ const s = i, r = s.array;
2675
+ if (r && typeof r.__path == "string" && typeof s.item == "function") {
2676
+ t.set(r.__path, s.item);
2677
+ return;
2678
+ }
2679
+ s.value instanceof ne && e.set(s.value, {
2680
+ component: s.component,
2681
+ componentProps: s.componentProps,
2682
+ validators: s.validators,
2683
+ asyncValidators: s.asyncValidators,
2684
+ updateOn: s.updateOn,
2685
+ disabled: s.disabled,
2686
+ debounce: s.debounce
2687
+ });
2688
+ for (const [n, a] of Object.entries(s))
2689
+ n !== "value" && W(a, e, t);
2690
+ }
2691
+ function ue(i, e, t, s) {
2692
+ const r = {};
2693
+ for (const [n, a] of Object.entries(e)) {
2694
+ const o = t === "" ? n : `${t}.${n}`;
2695
+ if (Array.isArray(a))
2696
+ continue;
2697
+ if (le(a)) {
2698
+ r[n] = ue(i, a, o, s);
2699
+ continue;
2700
+ }
2701
+ const l = i.signalAt(o);
2702
+ if (!l) throw new Error(`createForm({ model }): не найден сигнал для пути "${o}"`);
2703
+ const u = s.get(l) ?? {}, { validators: y, asyncValidators: h, ...f } = u;
2704
+ r[n] = { ...f, valueSignal: l };
2705
+ }
2706
+ return r;
2707
+ }
2708
+ function he(i, e, t) {
2709
+ for (const [s, r] of Object.entries(i)) {
2710
+ const n = e === "" ? s : `${e}.${s}`;
2711
+ Array.isArray(r) || (le(r) ? he(r, n, t) : t.push(n));
2712
+ }
2713
+ }
2714
+ function ce(i) {
2715
+ const { model: e, schema: t, behavior: s } = i, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2716
+ t !== void 0 && W(t, r, n);
2717
+ const a = ue(e, e.get(), "", r), o = new T(a), l = e.get();
2718
+ for (const [h, f] of Object.entries(l)) {
2719
+ if (!Array.isArray(f)) continue;
2720
+ const d = n.get(h);
2721
+ if (!d) continue;
2722
+ const p = e[h], v = (_) => ce({ model: _, schema: d(_) }), b = new Pe(p, v);
2723
+ o.fields.set(h, b);
2724
+ }
2725
+ const u = o.getProxy(), y = [];
2726
+ he(e.get(), "", y);
2727
+ for (const h of y) {
2728
+ const f = e.signalAt(h), d = o.getFieldByPath(h);
2729
+ f && d && be(f, d);
2730
+ }
2731
+ return s && o.attachBehaviorCleanup(s.__run(e, u)), u;
2732
+ }
2733
+ const Ce = (i) => i != null && typeof i == "object" && "model" in i && typeof i.model?.signalAt == "function";
2734
+ function Qe(i) {
2735
+ return Ce(i) ? ce(i) : new T(i).getProxy();
2736
+ }
2737
+ const j = /* @__PURE__ */ new Map();
2738
+ class P {
2739
+ /** Флаг активной регистрации */
2740
+ isRegistering = !1;
2741
+ /** Массив зарегистрированных элементов */
2742
+ registrations = [];
2743
+ /**
2744
+ * Получить стек для конкретного класса реестра
2745
+ * Создает новый стек если не существует
2746
+ *
2747
+ * @param ctor - Конструктор класса реестра
2748
+ * @returns RegistryStack для данного класса
2749
+ */
2750
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2751
+ static getStack(e) {
2752
+ return j.has(e) || j.set(e, new Fe()), j.get(e);
2753
+ }
2754
+ /**
2755
+ * Получить текущий активный реестр из стека
2756
+ * Должен быть переопределен в наследниках как static метод
2757
+ *
2758
+ * @param ctor - Конструктор класса реестра
2759
+ * @returns Текущий активный реестр или null
2760
+ */
2761
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2762
+ static getCurrentFromStack(e) {
2763
+ return this.getStack(e).getCurrent();
2764
+ }
2765
+ /**
2766
+ * Начать регистрацию
2767
+ *
2768
+ * Помещает this в global stack для изоляции форм
2769
+ * Вызывает hook onBeginRegistration()
2770
+ */
2771
+ beginRegistration() {
2772
+ this.isRegistering = !0, this.registrations = [], P.getStack(this.constructor).push(this), this.onBeginRegistration();
2773
+ }
2774
+ /**
2775
+ * Проверить, активна ли регистрация
2776
+ */
2777
+ isActive() {
2778
+ return this.isRegistering;
2779
+ }
2780
+ /**
2781
+ * Получить зарегистрированные элементы
2782
+ */
2783
+ getRegistrations() {
2784
+ return this.registrations;
2785
+ }
2786
+ /**
2787
+ * Hook: вызывается в начале регистрации
2788
+ * Может быть переопределен в наследниках для инициализации
2789
+ */
2790
+ onBeginRegistration() {
2791
+ }
2792
+ /**
2793
+ * Завершить регистрацию и извлечь из стека
2794
+ *
2795
+ * @param registryName - Имя реестра для отладки
2796
+ */
2797
+ completeRegistration(e) {
2798
+ this.isRegistering = !1, P.getStack(this.constructor).verify(this, e);
2799
+ }
2800
+ /**
2801
+ * Отменить регистрацию без применения
2802
+ *
2803
+ * @param registryName - Имя реестра для отладки
2804
+ */
2805
+ cancelRegistration(e) {
2806
+ this.isRegistering = !1, this.registrations = [], P.getStack(this.constructor).verify(this, e);
2807
+ }
2733
2808
  }
2734
- class be {
2809
+ class Xe {
2735
2810
  /**
2736
2811
  * @param form - Форма для наблюдения
2737
2812
  * @param options - Опции observer
@@ -2874,34 +2949,34 @@ class be {
2874
2949
  };
2875
2950
  const s = [];
2876
2951
  if (this.shouldTrack("value")) {
2877
- let i = t.value.value;
2878
- const r = m(() => {
2879
- const n = t.value.value;
2880
- n !== i && (this.emit({
2952
+ let r = t.value.value;
2953
+ const n = m(() => {
2954
+ const a = t.value.value;
2955
+ a !== r && (this.emit({
2881
2956
  type: "value",
2882
2957
  path: e,
2883
2958
  timestamp: Date.now(),
2884
- oldValue: i,
2885
- newValue: n
2886
- }), i = n);
2959
+ oldValue: r,
2960
+ newValue: a
2961
+ }), r = a);
2887
2962
  });
2888
- s.push(r);
2963
+ s.push(n);
2889
2964
  }
2890
2965
  if (this.shouldTrack("status")) {
2891
- let i = t.status.value;
2892
- const r = m(() => {
2893
- const n = t.status.value;
2894
- n !== i && (this.emit({
2966
+ let r = t.status.value;
2967
+ const n = m(() => {
2968
+ const a = t.status.value;
2969
+ a !== r && (this.emit({
2895
2970
  type: "status",
2896
2971
  path: e,
2897
2972
  timestamp: Date.now(),
2898
- oldValue: i,
2899
- newValue: n
2900
- }), i = n);
2973
+ oldValue: r,
2974
+ newValue: a
2975
+ }), r = a);
2901
2976
  });
2902
- s.push(r);
2977
+ s.push(n);
2903
2978
  }
2904
- return () => s.forEach((i) => i());
2979
+ return () => s.forEach((r) => r());
2905
2980
  }
2906
2981
  /**
2907
2982
  * Отправить событие всем listeners
@@ -2934,38 +3009,397 @@ class be {
2934
3009
  this.disposers.forEach((e) => e()), this.disposers = [], this.listeners.clear();
2935
3010
  }
2936
3011
  }
2937
- var x = { exports: {} }, T = {};
2938
- var B;
2939
- function oe() {
2940
- if (B) return T;
2941
- B = 1;
2942
- var a = U;
3012
+ const C = (i) => !(i === null || typeof i != "object" || Array.isArray(i) || i instanceof Date || typeof Blob < "u" && i instanceof Blob || typeof File < "u" && i instanceof File), E = (i, e) => i === "" ? String(e) : `${i}.${e}`, q = (i) => /^\d+$/.test(i), w = (i) => {
3013
+ if (Array.isArray(i)) return i.map(w);
3014
+ if (C(i)) {
3015
+ const e = {};
3016
+ for (const t of Object.keys(i)) e[t] = w(i[t]);
3017
+ return e;
3018
+ }
3019
+ return i;
3020
+ }, M = (i, e) => {
3021
+ if (i === e) return !0;
3022
+ if (Array.isArray(i) && Array.isArray(e))
3023
+ return i.length !== e.length ? !1 : i.every((t, s) => M(t, e[s]));
3024
+ if (C(i) && C(e)) {
3025
+ const t = Object.keys(i), s = Object.keys(e);
3026
+ return t.length !== s.length ? !1 : t.every((r) => M(i[r], e[r]));
3027
+ }
3028
+ return !1;
3029
+ };
3030
+ class Me {
3031
+ constructor(e, t) {
3032
+ this.path = t;
3033
+ const s = g(e);
3034
+ s.__path = t, this.signal = s, this.initial = w(e);
3035
+ }
3036
+ kind = "leaf";
3037
+ signal;
3038
+ initial;
3039
+ rebase(e) {
3040
+ this.path = e, this.signal.__path = e;
3041
+ }
3042
+ /** Реактивное чтение (внутри effect/computed создаёт зависимость). */
3043
+ read() {
3044
+ return this.signal.value;
3045
+ }
3046
+ /** Нереактивный снимок. */
3047
+ peek() {
3048
+ return this.signal.peek();
3049
+ }
3050
+ set(e) {
3051
+ this.signal.value = e;
3052
+ }
3053
+ resetToInitial() {
3054
+ this.signal.value = w(this.initial);
3055
+ }
3056
+ captureInitial() {
3057
+ this.initial = w(this.signal.peek());
3058
+ }
3059
+ dirty() {
3060
+ return !M(this.signal.peek(), this.initial);
3061
+ }
3062
+ }
3063
+ class de {
3064
+ constructor(e, t) {
3065
+ this.path = t;
3066
+ for (const s of Object.keys(e))
3067
+ this.children.set(s, N(e[s], E(t, s)));
3068
+ }
3069
+ kind = "group";
3070
+ children = /* @__PURE__ */ new Map();
3071
+ rebase(e) {
3072
+ this.path = e;
3073
+ for (const [t, s] of this.children) s.rebase(E(e, t));
3074
+ }
3075
+ peek() {
3076
+ const e = {};
3077
+ for (const [t, s] of this.children) e[t] = s.peek();
3078
+ return e;
3079
+ }
3080
+ set(e) {
3081
+ if (e == null || typeof e != "object") return;
3082
+ const t = e;
3083
+ for (const [s, r] of this.children)
3084
+ s in t && (r.kind === "leaf" && U(r.signal) || r.set(t[s]));
3085
+ }
3086
+ resetToInitial() {
3087
+ for (const e of this.children.values()) e.resetToInitial();
3088
+ }
3089
+ captureInitial() {
3090
+ for (const e of this.children.values()) e.captureInitial();
3091
+ }
3092
+ dirty() {
3093
+ for (const e of this.children.values()) if (e.dirty()) return !0;
3094
+ return !1;
3095
+ }
3096
+ }
3097
+ class De {
3098
+ constructor(e, t) {
3099
+ this.path = t, this.items = g(e.map((s, r) => N(s, E(t, r)))), this.initial = w(e);
3100
+ }
3101
+ kind = "array";
3102
+ items;
3103
+ initial;
3104
+ rebase(e) {
3105
+ this.path = e, this.items.peek().forEach((t, s) => t.rebase(E(e, s)));
3106
+ }
3107
+ reindex() {
3108
+ this.items.peek().forEach((e, t) => e.rebase(E(this.path, t)));
3109
+ }
3110
+ push(e) {
3111
+ const t = this.items.peek();
3112
+ this.items.value = [...t, N(e, E(this.path, t.length))];
3113
+ }
3114
+ insertAt(e, t) {
3115
+ const s = [...this.items.peek()];
3116
+ s.splice(e, 0, N(t, E(this.path, e))), this.items.value = s, this.reindex();
3117
+ }
3118
+ removeAt(e) {
3119
+ const t = [...this.items.peek()];
3120
+ t.splice(e, 1), this.items.value = t, this.reindex();
3121
+ }
3122
+ move(e, t) {
3123
+ const s = [...this.items.peek()], [r] = s.splice(e, 1);
3124
+ r && s.splice(t, 0, r), this.items.value = s, this.reindex();
3125
+ }
3126
+ swap(e, t) {
3127
+ const s = [...this.items.peek()];
3128
+ 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());
3129
+ }
3130
+ clear() {
3131
+ this.items.value = [];
3132
+ }
3133
+ peek() {
3134
+ return this.items.peek().map((e) => e.peek());
3135
+ }
3136
+ set(e) {
3137
+ const t = Array.isArray(e) ? e : [];
3138
+ this.items.value = t.map((s, r) => N(s, E(this.path, r)));
3139
+ }
3140
+ resetToInitial() {
3141
+ this.set(w(this.initial));
3142
+ }
3143
+ captureInitial() {
3144
+ this.initial = w(this.peek());
3145
+ }
3146
+ dirty() {
3147
+ return !M(this.peek(), this.initial);
3148
+ }
3149
+ }
3150
+ function N(i, e) {
3151
+ return Array.isArray(i) ? new De(i, e) : C(i) ? new de(i, e) : new Me(i, e);
3152
+ }
3153
+ function D(i) {
3154
+ if (i)
3155
+ return i.kind === "leaf" ? i.read() : i.kind === "group" ? Ie(i) : fe(i);
3156
+ }
3157
+ function Ie(i) {
3158
+ return new Proxy(
3159
+ {},
3160
+ {
3161
+ get: (e, t) => t === "__path" ? i.path : typeof t == "string" ? D(i.children.get(t)) : void 0,
3162
+ set: (e, t, s) => {
3163
+ if (typeof t != "string") return !1;
3164
+ const r = i.children.get(t);
3165
+ return r && r.set(s), !0;
3166
+ },
3167
+ has: (e, t) => typeof t == "string" && i.children.has(t),
3168
+ ownKeys: () => [...i.children.keys()],
3169
+ getOwnPropertyDescriptor: (e, t) => typeof t == "string" && i.children.has(t) ? { enumerable: !0, configurable: !0 } : void 0
3170
+ }
3171
+ );
3172
+ }
3173
+ function $(i) {
3174
+ if (i)
3175
+ return i.kind === "group" ? pe(i) : i.kind === "array" ? fe(i) : i.read();
3176
+ }
3177
+ function fe(i) {
3178
+ const e = {
3179
+ get length() {
3180
+ return i.items.value.length;
3181
+ },
3182
+ push: (t) => i.push(t),
3183
+ insertAt: (t, s) => i.insertAt(t, s),
3184
+ removeAt: (t) => i.removeAt(t),
3185
+ move: (t, s) => i.move(t, s),
3186
+ swap: (t, s) => i.swap(t, s),
3187
+ clear: () => i.clear(),
3188
+ at: (t) => $(i.items.value[t]),
3189
+ map: (t) => i.items.value.map((s, r) => t($(s), r)),
3190
+ forEach: (t) => i.items.value.forEach((s, r) => t($(s), r)),
3191
+ toArray: () => i.peek(),
3192
+ [Symbol.iterator]: function* () {
3193
+ const t = i.items.value;
3194
+ for (let s = 0; s < t.length; s++) yield D(t[s]);
3195
+ }
3196
+ };
3197
+ return new Proxy(e, {
3198
+ get: (t, s, r) => s === "__path" ? i.path : typeof s == "string" && q(s) ? D(i.items.value[Number(s)]) : Reflect.get(t, s, r),
3199
+ has: (t, s) => typeof s == "string" && q(s) ? Number(s) < i.items.value.length : Reflect.has(t, s)
3200
+ });
3201
+ }
3202
+ function K(i) {
3203
+ if (i.kind === "leaf") return i.signal;
3204
+ if (i.kind === "group")
3205
+ return new Proxy(
3206
+ {},
3207
+ {
3208
+ get: (t, s) => {
3209
+ if (s === "__path") return i.path;
3210
+ if (typeof s != "string") return;
3211
+ const r = i.children.get(s);
3212
+ return r ? K(r) : void 0;
3213
+ },
3214
+ has: (t, s) => typeof s == "string" && i.children.has(s),
3215
+ ownKeys: () => [...i.children.keys()],
3216
+ getOwnPropertyDescriptor: (t, s) => typeof s == "string" && i.children.has(s) ? { enumerable: !0, configurable: !0 } : void 0
3217
+ }
3218
+ );
3219
+ const e = i;
3220
+ return new Proxy(
3221
+ {
3222
+ get length() {
3223
+ return e.items.value.length;
3224
+ }
3225
+ },
3226
+ {
3227
+ get: (t, s, r) => {
3228
+ if (s === "__path") return e.path;
3229
+ if (typeof s == "string" && q(s)) {
3230
+ const n = e.items.value[Number(s)];
3231
+ return n ? K(n) : void 0;
3232
+ }
3233
+ return Reflect.get(t, s, r);
3234
+ }
3235
+ }
3236
+ );
3237
+ }
3238
+ function Le(i, e) {
3239
+ if (!e) return;
3240
+ let t = i;
3241
+ for (const s of e.split(".")) {
3242
+ if (!t) return;
3243
+ if (t.kind === "group") t = t.children.get(s);
3244
+ else if (t.kind === "array") t = t.items.peek()[Number(s)];
3245
+ else return;
3246
+ }
3247
+ return t && t.kind === "leaf" ? t.signal : void 0;
3248
+ }
3249
+ const ee = /* @__PURE__ */ new Set([
3250
+ "$",
3251
+ "get",
3252
+ "set",
3253
+ "patch",
3254
+ "isDirty",
3255
+ "reset",
3256
+ "captureInitial",
3257
+ "signalAt"
3258
+ ]), te = /* @__PURE__ */ new WeakMap();
3259
+ function pe(i) {
3260
+ const e = te.get(i);
3261
+ if (e) return e;
3262
+ const t = {
3263
+ $: K(i),
3264
+ get: () => i.peek(),
3265
+ set: (r) => i.set(r),
3266
+ patch: (r) => i.set(r),
3267
+ isDirty: () => i.dirty(),
3268
+ reset: () => i.resetToInitial(),
3269
+ captureInitial: () => i.captureInitial(),
3270
+ signalAt: (r) => Le(i, r)
3271
+ }, s = new Proxy(
3272
+ {},
3273
+ {
3274
+ get: (r, n) => {
3275
+ if (typeof n != "string") return;
3276
+ const a = i.children.get(n);
3277
+ if (a) return D(a);
3278
+ if (ee.has(n)) return t[n];
3279
+ },
3280
+ set: (r, n, a) => {
3281
+ if (typeof n != "string") return !1;
3282
+ const o = i.children.get(n);
3283
+ return o ? (o.set(a), !0) : !1;
3284
+ },
3285
+ has: (r, n) => typeof n == "string" && (i.children.has(n) || ee.has(n)),
3286
+ ownKeys: () => [...i.children.keys()],
3287
+ getOwnPropertyDescriptor: (r, n) => typeof n == "string" && i.children.has(n) ? { enumerable: !0, configurable: !0 } : void 0
3288
+ }
3289
+ );
3290
+ return te.set(i, s), s;
3291
+ }
3292
+ function Ze(i) {
3293
+ const e = new de(i, "");
3294
+ return pe(e);
3295
+ }
3296
+ const Re = (i) => {
3297
+ const e = i.componentProps;
3298
+ return e != null && typeof e == "object" && typeof e.itemComponent == "function" && e.control != null && typeof e.control.at == "function" && typeof e.control.length == "number";
3299
+ }, je = (i) => typeof i.when == "function" && Array.isArray(i.children);
3300
+ function V(i, e, t, s, r) {
3301
+ if (i == null || typeof i != "object") return;
3302
+ if (Array.isArray(i)) {
3303
+ for (const a of i) V(a, e, t, s, r);
3304
+ return;
3305
+ }
3306
+ const n = i;
3307
+ if (je(n)) {
3308
+ const a = s && !!n.when(e, t);
3309
+ for (const o of n.children) V(o, e, t, a, r);
3310
+ return;
3311
+ }
3312
+ if (Re(n)) {
3313
+ const a = n.componentProps.control, o = n.componentProps.itemComponent, l = a.length;
3314
+ for (let u = 0; u < l; u++) {
3315
+ const y = a.at(u);
3316
+ V(o(y), y, t, s, r);
3317
+ }
3318
+ return;
3319
+ }
3320
+ if (n.value instanceof ne) {
3321
+ const a = n.validators ?? [];
3322
+ a.length > 0 && (s ? r.tasks.push({ signal: n.value, validators: a, scope: e }) : r.clearSignals.push(n.value));
3323
+ for (const [o, l] of Object.entries(n))
3324
+ o === "value" || o === "validators" || V(l, e, t, s, r);
3325
+ return;
3326
+ }
3327
+ for (const a of Object.values(n)) V(a, e, t, s, r);
3328
+ }
3329
+ function Y(i, e) {
3330
+ const t = { tasks: [], clearSignals: [] };
3331
+ return V(e, i, i, !0, t), t;
3332
+ }
3333
+ const ve = (i, e, t) => {
3334
+ (i[e] ??= []).push(t);
3335
+ };
3336
+ function et(i, e) {
3337
+ const { tasks: t } = Y(i, e), s = {};
3338
+ for (const { signal: r, validators: n, scope: a } of t) {
3339
+ const o = r.peek();
3340
+ for (const l of n) {
3341
+ const u = l(o, a, i);
3342
+ u && typeof u.then == "function" || u && ve(s, r.__path, u);
3343
+ }
3344
+ }
3345
+ return { valid: Object.keys(s).length === 0, errors: s };
3346
+ }
3347
+ async function tt(i, e) {
3348
+ const { tasks: t } = Y(i, e), s = await me(t, i);
3349
+ return { valid: Object.keys(s).length === 0, errors: s };
3350
+ }
3351
+ async function me(i, e) {
3352
+ const t = {};
3353
+ return await Promise.all(
3354
+ i.map(async ({ signal: s, validators: r, scope: n }) => {
3355
+ const a = s.peek();
3356
+ for (const o of r) {
3357
+ const l = await o(a, n, e);
3358
+ l && ve(t, s.__path, l);
3359
+ }
3360
+ })
3361
+ ), t;
3362
+ }
3363
+ async function st(i, e) {
3364
+ const { tasks: t, clearSignals: s } = Y(i, e), r = await me(t, i);
3365
+ for (const { signal: n } of t)
3366
+ X(n)?.setErrors(r[n.__path] ?? []);
3367
+ for (const n of s)
3368
+ X(n)?.setErrors([]);
3369
+ return { valid: Object.keys(r).length === 0, errors: r };
3370
+ }
3371
+ var x = { exports: {} }, B = {};
3372
+ var se;
3373
+ function $e() {
3374
+ if (se) return B;
3375
+ se = 1;
3376
+ var i = ae;
2943
3377
  function e(h, f) {
2944
3378
  return h === f && (h !== 0 || 1 / h === 1 / f) || h !== h && f !== f;
2945
3379
  }
2946
- var t = typeof Object.is == "function" ? Object.is : e, s = a.useState, i = a.useEffect, r = a.useLayoutEffect, n = a.useDebugValue;
3380
+ var t = typeof Object.is == "function" ? Object.is : e, s = i.useState, r = i.useEffect, n = i.useLayoutEffect, a = i.useDebugValue;
2947
3381
  function o(h, f) {
2948
- var c = f(), p = s({ inst: { value: c, getSnapshot: f } }), y = p[0].inst, E = p[1];
2949
- return r(
3382
+ var d = f(), p = s({ inst: { value: d, getSnapshot: f } }), v = p[0].inst, b = p[1];
3383
+ return n(
2950
3384
  function() {
2951
- y.value = c, y.getSnapshot = f, l(y) && E({ inst: y });
3385
+ v.value = d, v.getSnapshot = f, l(v) && b({ inst: v });
2952
3386
  },
2953
- [h, c, f]
2954
- ), i(
3387
+ [h, d, f]
3388
+ ), r(
2955
3389
  function() {
2956
- return l(y) && E({ inst: y }), h(function() {
2957
- l(y) && E({ inst: y });
3390
+ return l(v) && b({ inst: v }), h(function() {
3391
+ l(v) && b({ inst: v });
2958
3392
  });
2959
3393
  },
2960
3394
  [h]
2961
- ), n(c), c;
3395
+ ), a(d), d;
2962
3396
  }
2963
3397
  function l(h) {
2964
3398
  var f = h.getSnapshot;
2965
3399
  h = h.value;
2966
3400
  try {
2967
- var c = f();
2968
- return !t(h, c);
3401
+ var d = f();
3402
+ return !t(h, d);
2969
3403
  } catch {
2970
3404
  return !0;
2971
3405
  }
@@ -2973,133 +3407,133 @@ function oe() {
2973
3407
  function u(h, f) {
2974
3408
  return f();
2975
3409
  }
2976
- var v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : o;
2977
- return T.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : v, T;
3410
+ var y = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : o;
3411
+ return B.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : y, B;
2978
3412
  }
2979
- var O = {};
2980
- var G;
2981
- function le() {
2982
- return G || (G = 1, process.env.NODE_ENV !== "production" && (function() {
2983
- function a(c, p) {
2984
- return c === p && (c !== 0 || 1 / c === 1 / p) || c !== c && p !== p;
3413
+ var G = {};
3414
+ var ie;
3415
+ function Be() {
3416
+ return ie || (ie = 1, process.env.NODE_ENV !== "production" && (function() {
3417
+ function i(d, p) {
3418
+ return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
2985
3419
  }
2986
- function e(c, p) {
2987
- v || i.startTransition === void 0 || (v = !0, console.error(
3420
+ function e(d, p) {
3421
+ y || r.startTransition === void 0 || (y = !0, console.error(
2988
3422
  "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."
2989
3423
  ));
2990
- var y = p();
3424
+ var v = p();
2991
3425
  if (!h) {
2992
- var E = p();
2993
- r(y, E) || (console.error(
3426
+ var b = p();
3427
+ n(v, b) || (console.error(
2994
3428
  "The result of getSnapshot should be cached to avoid an infinite loop"
2995
3429
  ), h = !0);
2996
3430
  }
2997
- E = n({
2998
- inst: { value: y, getSnapshot: p }
3431
+ b = a({
3432
+ inst: { value: v, getSnapshot: p }
2999
3433
  });
3000
- var _ = E[0].inst, F = E[1];
3434
+ var _ = b[0].inst, R = b[1];
3001
3435
  return l(
3002
3436
  function() {
3003
- _.value = y, _.getSnapshot = p, t(_) && F({ inst: _ });
3437
+ _.value = v, _.getSnapshot = p, t(_) && R({ inst: _ });
3004
3438
  },
3005
- [c, y, p]
3439
+ [d, v, p]
3006
3440
  ), o(
3007
3441
  function() {
3008
- return t(_) && F({ inst: _ }), c(function() {
3009
- t(_) && F({ inst: _ });
3442
+ return t(_) && R({ inst: _ }), d(function() {
3443
+ t(_) && R({ inst: _ });
3010
3444
  });
3011
3445
  },
3012
- [c]
3013
- ), u(y), y;
3446
+ [d]
3447
+ ), u(v), v;
3014
3448
  }
3015
- function t(c) {
3016
- var p = c.getSnapshot;
3017
- c = c.value;
3449
+ function t(d) {
3450
+ var p = d.getSnapshot;
3451
+ d = d.value;
3018
3452
  try {
3019
- var y = p();
3020
- return !r(c, y);
3453
+ var v = p();
3454
+ return !n(d, v);
3021
3455
  } catch {
3022
3456
  return !0;
3023
3457
  }
3024
3458
  }
3025
- function s(c, p) {
3459
+ function s(d, p) {
3026
3460
  return p();
3027
3461
  }
3028
3462
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3029
- var i = U, r = typeof Object.is == "function" ? Object.is : a, n = i.useState, o = i.useEffect, l = i.useLayoutEffect, u = i.useDebugValue, v = !1, h = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
3030
- O.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
3031
- })()), O;
3463
+ var r = ae, n = typeof Object.is == "function" ? Object.is : i, a = r.useState, o = r.useEffect, l = r.useLayoutEffect, u = r.useDebugValue, y = !1, h = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
3464
+ G.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());
3465
+ })()), G;
3032
3466
  }
3033
- var $;
3034
- function ue() {
3035
- return $ || ($ = 1, process.env.NODE_ENV === "production" ? x.exports = oe() : x.exports = le()), x.exports;
3467
+ var re;
3468
+ function Ge() {
3469
+ return re || (re = 1, process.env.NODE_ENV === "production" ? x.exports = $e() : x.exports = Be()), x.exports;
3036
3470
  }
3037
- var R = ue();
3038
- function he(a, e) {
3039
- if (a === e) return !0;
3040
- if (a.length !== e.length) return !1;
3041
- for (let t = 0; t < a.length; t++)
3042
- if (a[t] !== e[t]) return !1;
3471
+ var Q = Ge();
3472
+ function Ue(i, e) {
3473
+ if (i === e) return !0;
3474
+ if (i.length !== e.length) return !1;
3475
+ for (let t = 0; t < i.length; t++)
3476
+ if (i[t] !== e[t]) return !1;
3043
3477
  return !0;
3044
3478
  }
3045
- function q(a, e, t) {
3046
- const s = P(null);
3479
+ function ye(i, e, t) {
3480
+ const s = H(null);
3047
3481
  if (s.current === null) {
3048
- const n = {};
3049
- for (const o in a)
3050
- n[o] = a[o].value;
3051
- s.current = { ...n, __snapshot: null };
3482
+ const a = {};
3483
+ for (const o in i)
3484
+ a[o] = i[o].value;
3485
+ s.current = { ...a, __snapshot: null };
3052
3486
  }
3053
- const i = b(
3054
- (n) => {
3487
+ const r = A(
3488
+ (a) => {
3055
3489
  let o = !0;
3056
3490
  return m(() => {
3057
- for (const u in a)
3058
- a[u].value;
3491
+ for (const u in i)
3492
+ i[u].value;
3059
3493
  if (o) {
3060
3494
  o = !1;
3061
3495
  return;
3062
3496
  }
3063
- n();
3497
+ a();
3064
3498
  });
3065
3499
  },
3066
- [a]
3067
- ), r = b(() => {
3068
- const n = s.current, o = {};
3069
- for (const u in a)
3070
- o[u] = a[u].value;
3500
+ [i]
3501
+ ), n = A(() => {
3502
+ const a = s.current, o = {};
3503
+ for (const u in i)
3504
+ o[u] = i[u].value;
3071
3505
  let l = !1;
3072
3506
  for (const u of e) {
3073
- const { key: v, useShallowArrayEqual: h } = u, f = o[v], c = n[v];
3507
+ const { key: y, useShallowArrayEqual: h } = u, f = o[y], d = a[y];
3074
3508
  if (h) {
3075
- if (!he(c, f)) {
3509
+ if (!Ue(d, f)) {
3076
3510
  l = !0;
3077
3511
  break;
3078
3512
  }
3079
- } else if (c !== f) {
3513
+ } else if (d !== f) {
3080
3514
  l = !0;
3081
3515
  break;
3082
3516
  }
3083
3517
  }
3084
- if (!l && n.__snapshot)
3085
- return n.__snapshot;
3086
- for (const u in a)
3087
- n[u] = o[u];
3088
- return n.__snapshot = t(o), n.__snapshot;
3089
- }, [a, t]);
3090
- return R.useSyncExternalStore(i, r, r);
3518
+ if (!l && a.__snapshot)
3519
+ return a.__snapshot;
3520
+ for (const u in i)
3521
+ a[u] = o[u];
3522
+ return a.__snapshot = t(o), a.__snapshot;
3523
+ }, [i, t]);
3524
+ return Q.useSyncExternalStore(r, n, n);
3091
3525
  }
3092
- function de(a) {
3526
+ function We(i) {
3093
3527
  const e = {
3094
- value: a.value,
3095
- disabled: a.disabled,
3096
- errors: a.errors,
3097
- pending: a.pending,
3098
- valid: a.valid,
3099
- invalid: a.invalid,
3100
- touched: a.touched,
3101
- shouldShowError: a.shouldShowError,
3102
- componentProps: a.componentProps
3528
+ value: i.value,
3529
+ disabled: i.disabled,
3530
+ errors: i.errors,
3531
+ pending: i.pending,
3532
+ valid: i.valid,
3533
+ invalid: i.invalid,
3534
+ touched: i.touched,
3535
+ shouldShowError: i.shouldShowError,
3536
+ componentProps: i.componentProps
3103
3537
  }, t = [
3104
3538
  { key: "value" },
3105
3539
  { key: "disabled" },
@@ -3110,32 +3544,32 @@ function de(a) {
3110
3544
  { key: "touched" },
3111
3545
  { key: "shouldShowError" },
3112
3546
  { key: "componentProps" }
3113
- ], s = b(
3114
- (i) => ({
3115
- value: i.value,
3116
- pending: i.pending,
3117
- disabled: i.disabled,
3118
- errors: i.errors,
3119
- valid: i.valid,
3120
- invalid: i.invalid,
3121
- touched: i.touched,
3122
- shouldShowError: i.shouldShowError,
3123
- componentProps: i.componentProps
3547
+ ], s = A(
3548
+ (r) => ({
3549
+ value: r.value,
3550
+ pending: r.pending,
3551
+ disabled: r.disabled,
3552
+ errors: r.errors,
3553
+ valid: r.valid,
3554
+ invalid: r.invalid,
3555
+ touched: r.touched,
3556
+ shouldShowError: r.shouldShowError,
3557
+ componentProps: r.componentProps
3124
3558
  }),
3125
3559
  []
3126
3560
  );
3127
- return q(e, t, s);
3561
+ return ye(e, t, s);
3128
3562
  }
3129
- function ce(a) {
3563
+ function qe(i) {
3130
3564
  const e = {
3131
- value: a.value,
3132
- length: a.length,
3133
- errors: a.errors,
3134
- pending: a.pending,
3135
- valid: a.valid,
3136
- invalid: a.invalid,
3137
- touched: a.touched,
3138
- dirty: a.dirty
3565
+ value: i.value,
3566
+ length: i.length,
3567
+ errors: i.errors,
3568
+ pending: i.pending,
3569
+ valid: i.valid,
3570
+ invalid: i.invalid,
3571
+ touched: i.touched,
3572
+ dirty: i.dirty
3139
3573
  }, t = [
3140
3574
  { key: "value" },
3141
3575
  { key: "length" },
@@ -3145,24 +3579,24 @@ function ce(a) {
3145
3579
  { key: "invalid" },
3146
3580
  { key: "touched" },
3147
3581
  { key: "dirty" }
3148
- ], s = b(
3149
- (i) => ({
3150
- value: i.value,
3151
- length: i.length,
3152
- pending: i.pending,
3153
- errors: i.errors,
3154
- valid: i.valid,
3155
- invalid: i.invalid,
3156
- touched: i.touched,
3157
- dirty: i.dirty
3582
+ ], s = A(
3583
+ (r) => ({
3584
+ value: r.value,
3585
+ length: r.length,
3586
+ pending: r.pending,
3587
+ errors: r.errors,
3588
+ valid: r.valid,
3589
+ invalid: r.invalid,
3590
+ touched: r.touched,
3591
+ dirty: r.dirty
3158
3592
  }),
3159
3593
  []
3160
3594
  );
3161
- return q(e, t, s);
3595
+ return ye(e, t, s);
3162
3596
  }
3163
- function Ee(a) {
3164
- const e = a && "length" in a && "map" in a;
3165
- return a ? e ? ce(a) : de(a) : {
3597
+ function it(i) {
3598
+ const e = i && "length" in i && "map" in i;
3599
+ return i ? e ? qe(i) : We(i) : {
3166
3600
  value: [],
3167
3601
  length: 0,
3168
3602
  pending: !1,
@@ -3173,99 +3607,89 @@ function Ee(a) {
3173
3607
  dirty: !1
3174
3608
  };
3175
3609
  }
3176
- function _e(a) {
3177
- const e = P({ value: a.value.value }), t = b(
3178
- (i) => {
3179
- let r = !0;
3610
+ function rt(i) {
3611
+ const e = H({ value: i.value.value }), t = A(
3612
+ (r) => {
3613
+ let n = !0;
3180
3614
  return m(() => {
3181
- if (a.value.value, r) {
3182
- r = !1;
3615
+ if (i.value.value, n) {
3616
+ n = !1;
3183
3617
  return;
3184
3618
  }
3185
- i();
3619
+ r();
3186
3620
  });
3187
3621
  },
3188
- [a]
3189
- ), s = b(() => {
3190
- const i = a.value.value;
3191
- return e.current.value === i ? e.current.value : (e.current.value = i, i);
3192
- }, [a]);
3193
- return R.useSyncExternalStore(t, s, s);
3622
+ [i]
3623
+ ), s = A(() => {
3624
+ const r = i.value.value;
3625
+ return e.current.value === r ? e.current.value : (e.current.value = r, r);
3626
+ }, [i]);
3627
+ return Q.useSyncExternalStore(t, s, s);
3194
3628
  }
3195
- function Se(a) {
3196
- const e = P({ length: a.length.value }), t = b(
3197
- (i) => {
3198
- let r = !0;
3629
+ function nt(i) {
3630
+ const e = H({ length: i.length.value }), t = A(
3631
+ (r) => {
3632
+ let n = !0;
3199
3633
  return m(() => {
3200
- if (a.length.value, r) {
3201
- r = !1;
3634
+ if (i.length.value, n) {
3635
+ n = !1;
3202
3636
  return;
3203
3637
  }
3204
- i();
3638
+ r();
3205
3639
  });
3206
3640
  },
3207
- [a]
3208
- ), s = b(() => {
3209
- const i = a.length.value;
3210
- return e.current.length === i ? e.current.length : (e.current.length = i, i);
3211
- }, [a]);
3212
- return R.useSyncExternalStore(t, s, s);
3213
- }
3214
- function Ve(a, e, t) {
3215
- const s = b(
3216
- (r) => {
3217
- const n = e, o = [];
3218
- for (const l of Object.keys(n)) {
3219
- const u = n[l];
3220
- if (u && typeof u == "object" && u.value && typeof u.value.subscribe == "function") {
3221
- const v = u.value.subscribe(r);
3222
- o.push(v);
3223
- }
3224
- }
3225
- return () => {
3226
- o.forEach((l) => l());
3227
- };
3228
- },
3229
- [e]
3230
- ), i = b(() => a ? a(e, t) : !1, [a, e, t]);
3231
- return Q(s, i, i);
3641
+ [i]
3642
+ ), s = A(() => {
3643
+ const r = i.length.value;
3644
+ return e.current.length === r ? e.current.length : (e.current.length = r, r);
3645
+ }, [i]);
3646
+ return Q.useSyncExternalStore(t, s, s);
3232
3647
  }
3233
3648
  export {
3234
- ke as AbstractRegistry,
3235
- L as ArrayNode,
3236
- V as ErrorStrategy,
3237
- ee as FieldNode,
3238
- se as FieldPathNavigator,
3239
- S as FormErrorHandler,
3240
- C as FormNode,
3241
- be as FormObserver,
3242
- Z as FormStatusMachine,
3243
- ae as FormSubmitter,
3244
- k as GroupNode,
3245
- ne as NodeFactory,
3246
- xe as RegistryStack,
3247
- D as SubscriptionManager,
3248
- $e as behaviors,
3249
- I as createFieldPath,
3250
- ge as createForm,
3251
- Ie as extractKey,
3252
- Le as extractPath,
3253
- Fe as getCurrentBehaviorRegistry,
3254
- Te as getCurrentValidationRegistry,
3255
- Pe as getNodeType,
3256
- N as isArrayNode,
3257
- M as isFieldNode,
3258
- Ce as isFormNode,
3259
- De as isGroupNode,
3260
- We as runOutsideEffect,
3261
- qe as safeCallback,
3262
- je as safeDebouncedCallback,
3263
- Be as toFieldPath,
3264
- A as uniqueId,
3265
- Se as useArrayLength,
3266
- Ee as useFormControl,
3267
- _e as useFormControlValue,
3268
- Ve as useHiddenCondition,
3269
- Re as validateForm,
3270
- Me as validators
3649
+ P as AbstractRegistry,
3650
+ Z as ArrayNode,
3651
+ S as ErrorStrategy,
3652
+ we as FieldNode,
3653
+ k as FormErrorHandler,
3654
+ I as FormNode,
3655
+ Xe as FormObserver,
3656
+ Ee as FormStatusMachine,
3657
+ ke as FormSubmitter,
3658
+ T as GroupNode,
3659
+ Pe as ModelArrayNode,
3660
+ Oe as NodeFactory,
3661
+ Fe as RegistryStack,
3662
+ z as SubscriptionManager,
3663
+ lt as computeFrom,
3664
+ ut as copyFrom,
3665
+ Qe as createForm,
3666
+ ce as createFormFromModel,
3667
+ Ze as createModel,
3668
+ ht as disableWhen,
3669
+ ct as enableWhen,
3670
+ X as getNodeForSignal,
3671
+ Ye as getNodeType,
3672
+ xe as isArrayNode,
3673
+ U as isDerived,
3674
+ Ne as isFieldNode,
3675
+ L as isFormNode,
3676
+ Te as isGroupNode,
3677
+ dt as markDerived,
3678
+ be as registerSignalNode,
3679
+ ft as resetWhen,
3680
+ pt as revalidateWhen,
3681
+ vt as runOutsideEffect,
3682
+ mt as safeCallback,
3683
+ yt as safeDebouncedCallback,
3684
+ gt as syncFields,
3685
+ bt as transformValue,
3686
+ F as uniqueId,
3687
+ nt as useArrayLength,
3688
+ it as useFormControl,
3689
+ rt as useFormControlValue,
3690
+ st as validateFormModel,
3691
+ tt as validateModel,
3692
+ et as validateModelSync,
3693
+ wt as validators,
3694
+ _t as watchField
3271
3695
  };