@reformer/core 1.0.0-beta.1 → 1.0.0-beta.2

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 (79) hide show
  1. package/dist/behaviors/compute-from.js +3 -3
  2. package/dist/behaviors/enable-when.js +5 -5
  3. package/dist/behaviors/reset-when.js +1 -1
  4. package/dist/behaviors/revalidate-when.js +1 -1
  5. package/dist/behaviors/sync-fields.js +5 -5
  6. package/dist/behaviors/watch-field.js +3 -3
  7. package/dist/behaviors.js +2 -2
  8. package/dist/core/types/field-path.d.ts +2 -2
  9. package/dist/core/types/index.d.ts +1 -1
  10. package/dist/core/types/validation-schema.d.ts +21 -50
  11. package/dist/core/validation/core/index.d.ts +0 -1
  12. package/dist/core/validation/core/validate-async.d.ts +9 -15
  13. package/dist/core/validation/core/validate.d.ts +15 -15
  14. package/dist/core/validation/index.d.ts +5 -3
  15. package/dist/core/validation/validation-applicator.d.ts +2 -56
  16. package/dist/core/validation/validation-registry.d.ts +18 -16
  17. package/dist/core/validation/validators/array-validators.d.ts +6 -31
  18. package/dist/core/validation/validators/email.d.ts +5 -29
  19. package/dist/core/validation/validators/future-date.d.ts +6 -28
  20. package/dist/core/validation/validators/index.d.ts +12 -4
  21. package/dist/core/validation/validators/integer.d.ts +13 -0
  22. package/dist/core/validation/validators/is-date.d.ts +5 -28
  23. package/dist/core/validation/validators/is-number.d.ts +14 -0
  24. package/dist/core/validation/validators/max-age.d.ts +6 -29
  25. package/dist/core/validation/validators/max-date.d.ts +6 -29
  26. package/dist/core/validation/validators/max-length.d.ts +5 -30
  27. package/dist/core/validation/validators/max.d.ts +7 -29
  28. package/dist/core/validation/validators/min-age.d.ts +6 -29
  29. package/dist/core/validation/validators/min-date.d.ts +6 -29
  30. package/dist/core/validation/validators/min-length.d.ts +5 -30
  31. package/dist/core/validation/validators/min.d.ts +7 -29
  32. package/dist/core/validation/validators/multiple-of.d.ts +13 -0
  33. package/dist/core/validation/validators/non-negative.d.ts +13 -0
  34. package/dist/core/validation/validators/non-zero.d.ts +13 -0
  35. package/dist/core/validation/validators/past-date.d.ts +5 -28
  36. package/dist/core/validation/validators/pattern.d.ts +5 -32
  37. package/dist/core/validation/validators/phone.d.ts +9 -19
  38. package/dist/core/validation/validators/required.d.ts +10 -31
  39. package/dist/core/validation/validators/url.d.ts +13 -15
  40. package/dist/{index-D25LsbRm.js → index-DLh_Ryb2.js} +1 -1
  41. package/dist/index.js +465 -397
  42. package/dist/{registry-helpers-Bv_BJ1s-.js → registry-helpers-CLPXad2B.js} +152 -292
  43. package/dist/validators/email.js +7 -9
  44. package/dist/validators/future-date.js +11 -12
  45. package/dist/validators/integer.d.ts +2 -0
  46. package/dist/validators/integer.js +10 -0
  47. package/dist/validators/is-date.js +6 -7
  48. package/dist/validators/is-number.d.ts +2 -0
  49. package/dist/validators/is-number.js +10 -0
  50. package/dist/validators/max-age.js +11 -12
  51. package/dist/validators/max-date.js +11 -12
  52. package/dist/validators/max-length.js +12 -8
  53. package/dist/validators/max.js +5 -6
  54. package/dist/validators/min-age.js +10 -11
  55. package/dist/validators/min-date.js +12 -13
  56. package/dist/validators/min-length.js +12 -8
  57. package/dist/validators/min.js +6 -7
  58. package/dist/validators/multiple-of.d.ts +2 -0
  59. package/dist/validators/multiple-of.js +10 -0
  60. package/dist/validators/non-negative.d.ts +2 -0
  61. package/dist/validators/non-negative.js +10 -0
  62. package/dist/validators/non-zero.d.ts +2 -0
  63. package/dist/validators/non-zero.js +10 -0
  64. package/dist/validators/past-date.js +11 -12
  65. package/dist/validators/pattern.js +6 -7
  66. package/dist/validators/phone.js +14 -32
  67. package/dist/validators/required.js +9 -10
  68. package/dist/validators/url.js +19 -16
  69. package/dist/validators-xJyP-jLZ.js +169 -0
  70. package/dist/validators.js +54 -50
  71. package/llms.txt +505 -790
  72. package/package.json +20 -4
  73. package/dist/core/validation/core/validate-tree.d.ts +0 -35
  74. package/dist/core/validation/validation-context.d.ts +0 -86
  75. package/dist/core/validation/validators/number.d.ts +0 -31
  76. package/dist/validate-C3XiA_zf.js +0 -10
  77. package/dist/validators/number.d.ts +0 -2
  78. package/dist/validators/number.js +0 -35
  79. package/dist/validators-BGsNOgT1.js +0 -207
@@ -0,0 +1,10 @@
1
+ function n(e) {
2
+ return (r) => r == null ? null : typeof r != "number" || isNaN(r) ? {
3
+ code: "isNumber",
4
+ message: e?.message ?? "invalid",
5
+ params: e?.params
6
+ } : null;
7
+ }
8
+ export {
9
+ n as isNumber
10
+ };
@@ -1,20 +1,19 @@
1
- import { v as m } from "../validate-C3XiA_zf.js";
2
- import { p as c, c as o } from "../date-utils-xUWFslTj.js";
3
- function l(a, e, n) {
4
- a && m(a, (r) => {
1
+ import { p as s, c as l } from "../date-utils-xUWFslTj.js";
2
+ function c(e, a) {
3
+ return (r) => {
5
4
  if (r == null || r === "")
6
5
  return null;
7
- const t = c(r);
8
- if (t === null)
6
+ const n = s(r);
7
+ if (n === null)
9
8
  return null;
10
- const s = o(t);
11
- return s > e ? {
9
+ const t = l(n);
10
+ return t > e ? {
12
11
  code: "date_max_age",
13
- message: n?.message || `Максимальный возраст: ${e} лет`,
14
- params: { maxAge: e, currentAge: s, ...n?.params }
12
+ message: a?.message ?? "invalid",
13
+ params: { maxAge: e, currentAge: t, ...a?.params }
15
14
  } : null;
16
- });
15
+ };
17
16
  }
18
17
  export {
19
- l as maxAge
18
+ c as maxAge
20
19
  };
@@ -1,20 +1,19 @@
1
- import { v as i } from "../validate-C3XiA_zf.js";
2
- import { p as l, n as m } from "../date-utils-xUWFslTj.js";
3
- function c(a, e, n) {
4
- a && i(a, (r) => {
1
+ import { p as m, n as t } from "../date-utils-xUWFslTj.js";
2
+ function o(n, a) {
3
+ return (r) => {
5
4
  if (r == null || r === "")
6
5
  return null;
7
- const t = l(r);
8
- if (t === null)
6
+ const e = m(r);
7
+ if (e === null)
9
8
  return null;
10
- const s = m(t), o = m(e);
11
- return s > o ? {
9
+ const s = t(e), l = t(n);
10
+ return s > l ? {
12
11
  code: "date_max",
13
- message: n?.message || `Дата должна быть не позднее ${o.toLocaleDateString()}`,
14
- params: { maxDate: e, ...n?.params }
12
+ message: a?.message ?? "invalid",
13
+ params: { maxDate: n, ...a?.params }
15
14
  } : null;
16
- });
15
+ };
17
16
  }
18
17
  export {
19
- c as maxDate
18
+ o as maxDate
20
19
  };
@@ -1,11 +1,15 @@
1
- import { v as a } from "../validate-C3XiA_zf.js";
2
- function m(e, r, n) {
3
- e && a(e, (t) => t && t.length > r ? {
4
- code: "maxLength",
5
- message: n?.message || `Максимальная длина: ${r} символов`,
6
- params: { maxLength: r, actualLength: t.length, ...n?.params }
7
- } : null);
1
+ function l(r, t) {
2
+ return (n) => {
3
+ if (n == null || n === "")
4
+ return null;
5
+ const e = n.length;
6
+ return typeof e != "number" ? null : e > r ? {
7
+ code: "maxLength",
8
+ message: t?.message ?? "invalid",
9
+ params: { maxLength: r, actualLength: e, ...t?.params }
10
+ } : null;
11
+ };
8
12
  }
9
13
  export {
10
- m as maxLength
14
+ l as maxLength
11
15
  };
@@ -1,10 +1,9 @@
1
- import { v as a } from "../validate-C3XiA_zf.js";
2
- function e(m, n, t) {
3
- m && a(m, (r) => r == null ? null : r > n ? {
1
+ function e(n, a) {
2
+ return (r) => r == null ? null : r > n ? {
4
3
  code: "max",
5
- message: t?.message || `Максимальное значение: ${n}`,
6
- params: { max: n, actual: r, ...t?.params }
7
- } : null);
4
+ message: a?.message ?? "invalid",
5
+ params: { max: n, actual: r, ...a?.params }
6
+ } : null;
8
7
  }
9
8
  export {
10
9
  e as max
@@ -1,20 +1,19 @@
1
- import { v as m } from "../validate-C3XiA_zf.js";
2
- import { p as c, c as i } from "../date-utils-xUWFslTj.js";
3
- function l(n, e, t) {
4
- n && m(n, (r) => {
1
+ import { p as s, c as i } from "../date-utils-xUWFslTj.js";
2
+ function u(e, n) {
3
+ return (r) => {
5
4
  if (r == null || r === "")
6
5
  return null;
7
- const a = c(r);
6
+ const a = s(r);
8
7
  if (a === null)
9
8
  return null;
10
- const s = i(a);
11
- return s < e ? {
9
+ const t = i(a);
10
+ return t < e ? {
12
11
  code: "date_min_age",
13
- message: t?.message || `Минимальный возраст: ${e} лет`,
14
- params: { minAge: e, currentAge: s, ...t?.params }
12
+ message: n?.message ?? "invalid",
13
+ params: { minAge: e, currentAge: t, ...n?.params }
15
14
  } : null;
16
- });
15
+ };
17
16
  }
18
17
  export {
19
- l as minAge
18
+ u as minAge
20
19
  };
@@ -1,20 +1,19 @@
1
- import { v as s } from "../validate-C3XiA_zf.js";
2
- import { p as l, n as o } from "../date-utils-xUWFslTj.js";
3
- function c(n, e, a) {
4
- n && s(n, (r) => {
5
- if (r == null || r === "")
1
+ import { p as l, n as t } from "../date-utils-xUWFslTj.js";
2
+ function o(r, e) {
3
+ return (n) => {
4
+ if (n == null || n === "")
6
5
  return null;
7
- const t = l(r);
8
- if (t === null)
6
+ const a = l(n);
7
+ if (a === null)
9
8
  return null;
10
- const m = o(t), i = o(e);
11
- return m < i ? {
9
+ const i = t(a), s = t(r);
10
+ return i < s ? {
12
11
  code: "date_min",
13
- message: a?.message || `Дата должна быть не ранее ${i.toLocaleDateString()}`,
14
- params: { minDate: e, ...a?.params }
12
+ message: e?.message ?? "invalid",
13
+ params: { minDate: r, ...e?.params }
15
14
  } : null;
16
- });
15
+ };
17
16
  }
18
17
  export {
19
- c as minDate
18
+ o as minDate
20
19
  };
@@ -1,11 +1,15 @@
1
- import { v as a } from "../validate-C3XiA_zf.js";
2
- function m(e, r, n) {
3
- e && a(e, (t) => t && t.length < r ? {
4
- code: "minLength",
5
- message: n?.message || `Минимальная длина: ${r} символов`,
6
- params: { minLength: r, actualLength: t.length, ...n?.params }
7
- } : null);
1
+ function l(r, t) {
2
+ return (n) => {
3
+ if (n == null || n === "")
4
+ return null;
5
+ const e = n.length;
6
+ return typeof e != "number" ? null : e < r ? {
7
+ code: "minLength",
8
+ message: t?.message ?? "invalid",
9
+ params: { minLength: r, actualLength: e, ...t?.params }
10
+ } : null;
11
+ };
8
12
  }
9
13
  export {
10
- m as minLength
14
+ l as minLength
11
15
  };
@@ -1,11 +1,10 @@
1
- import { v as i } from "../validate-C3XiA_zf.js";
2
- function a(m, n, t) {
3
- m && i(m, (r) => r == null ? null : r < n ? {
1
+ function e(r, i) {
2
+ return (n) => n == null ? null : n < r ? {
4
3
  code: "min",
5
- message: t?.message || `Минимальное значение: ${n}`,
6
- params: { min: n, actual: r, ...t?.params }
7
- } : null);
4
+ message: i?.message ?? "invalid",
5
+ params: { min: r, actual: n, ...i?.params }
6
+ } : null;
8
7
  }
9
8
  export {
10
- a as min
9
+ e as min
11
10
  };
@@ -0,0 +1,2 @@
1
+ export * from '../core/validation/validators/multiple-of'
2
+ export {}
@@ -0,0 +1,10 @@
1
+ function l(e, n) {
2
+ return (r) => r == null || typeof r != "number" || isNaN(r) ? null : r % e !== 0 ? {
3
+ code: "multipleOf",
4
+ message: n?.message ?? "invalid",
5
+ params: { multipleOf: e, ...n?.params }
6
+ } : null;
7
+ }
8
+ export {
9
+ l as multipleOf
10
+ };
@@ -0,0 +1,2 @@
1
+ export * from '../core/validation/validators/non-negative'
2
+ export {}
@@ -0,0 +1,10 @@
1
+ function e(r) {
2
+ return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n < 0 ? {
3
+ code: "nonNegative",
4
+ message: r?.message ?? "invalid",
5
+ params: r?.params
6
+ } : null;
7
+ }
8
+ export {
9
+ e as nonNegative
10
+ };
@@ -0,0 +1,2 @@
1
+ export * from '../core/validation/validators/non-zero'
2
+ export {}
@@ -0,0 +1,10 @@
1
+ function e(r) {
2
+ return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n === 0 ? {
3
+ code: "nonZero",
4
+ message: r?.message ?? "invalid",
5
+ params: r?.params
6
+ } : null;
7
+ }
8
+ export {
9
+ e as nonZero
10
+ };
@@ -1,20 +1,19 @@
1
- import { v as o } from "../validate-C3XiA_zf.js";
2
- import { p as u, n as l, g as m } from "../date-utils-xUWFslTj.js";
3
- function d(a, e) {
4
- a && o(a, (r) => {
1
+ import { p as s, n as l, g as o } from "../date-utils-xUWFslTj.js";
2
+ function i(a) {
3
+ return (r) => {
5
4
  if (r == null || r === "")
6
5
  return null;
7
- const t = u(r);
8
- if (t === null)
6
+ const e = s(r);
7
+ if (e === null)
9
8
  return null;
10
- const n = l(t), s = m();
11
- return n > s ? {
9
+ const n = l(e), t = o();
10
+ return n > t ? {
12
11
  code: "date_future",
13
- message: e?.message || "Дата не может быть в будущем",
14
- params: e?.params
12
+ message: a?.message ?? "invalid",
13
+ params: a?.params
15
14
  } : null;
16
- });
15
+ };
17
16
  }
18
17
  export {
19
- d as pastDate
18
+ i as pastDate
20
19
  };
@@ -1,11 +1,10 @@
1
- import { v as n } from "../validate-C3XiA_zf.js";
2
- function u(r, t, e) {
3
- r && n(r, (a) => a ? t.test(a) ? null : {
1
+ function n(r, t) {
2
+ return (e) => e ? r.test(e) ? null : {
4
3
  code: "pattern",
5
- message: e?.message || "Значение не соответствует требуемому формату",
6
- params: { pattern: t.source, ...e?.params }
7
- } : null);
4
+ message: t?.message ?? "invalid",
5
+ params: { pattern: r.source, ...t?.params }
6
+ } : null;
8
7
  }
9
8
  export {
10
- u as pattern
9
+ n as pattern
11
10
  };
@@ -1,35 +1,17 @@
1
- import { v as o } from "../validate-C3XiA_zf.js";
2
- function f(n, s) {
3
- if (!n) return;
4
- const r = s?.format || "any", t = {
5
- // Международный формат: +1234567890 или +1 234 567 8900
6
- international: /^\+?[1-9]\d{1,14}$/,
7
- // Российский формат: +7 (XXX) XXX-XX-XX, 8 (XXX) XXX-XX-XX, и вариации
8
- ru: /^(\+7|7|8)?[\s-]?\(?[489][0-9]{2}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
9
- // US формат: (123) 456-7890, 123-456-7890, 1234567890
10
- us: /^(\+?1)?[\s-]?\(?[2-9]\d{2}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
11
- // Любой формат: минимум 10 цифр с возможными разделителями
12
- any: /^[+]?[(]?[0-9]{1,4}[)]?[-\s.]?[(]?[0-9]{1,4}[)]?[-\s.]?[0-9]{1,9}$/
13
- };
14
- o(n, (e) => {
15
- if (!e)
16
- return null;
17
- if (!t[r].test(e)) {
18
- const a = {
19
- international: "Введите телефон в международном формате (например, +1234567890)",
20
- ru: "Введите российский номер телефона (например, +7 900 123-45-67)",
21
- us: "Введите американский номер телефона (например, (123) 456-7890)",
22
- any: "Неверный формат телефона"
23
- };
24
- return {
25
- code: "phone",
26
- message: s?.message || a[r],
27
- params: { format: r, ...s?.params }
28
- };
29
- }
30
- return null;
31
- });
1
+ const t = {
2
+ international: /^\+?[1-9]\d{1,14}$/,
3
+ ru: /^(\+7|7|8)?[\s-]?\(?[489][0-9]{2}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
4
+ us: /^(\+?1)?[\s-]?\(?[2-9]\d{2}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
5
+ any: /^\+?\(?[0-9]{1,4}\)?[-\s.]?\(?[0-9]{1,4}\)?[-\s.]?[0-9]{1,9}$/
6
+ };
7
+ function a(s) {
8
+ const n = s?.format ?? "any", e = t[n];
9
+ return (r) => r ? e.test(r) ? null : {
10
+ code: "phone",
11
+ message: s?.message ?? "invalid",
12
+ params: { format: n, ...s?.params }
13
+ } : null;
32
14
  }
33
15
  export {
34
- f as phone
16
+ a as phone
35
17
  };
@@ -1,15 +1,14 @@
1
- import { v as m } from "../validate-C3XiA_zf.js";
2
- function u(a, e) {
3
- a && m(a, (r) => r == null || r === "" ? {
1
+ function a(r) {
2
+ return (e) => e == null || e === "" ? {
4
3
  code: "required",
5
- message: e?.message || "Поле обязательно для заполнения",
6
- params: e?.params
7
- } : typeof r == "boolean" && r !== !0 ? {
4
+ message: r?.message ?? "invalid",
5
+ params: r?.params
6
+ } : typeof e == "boolean" && e !== !0 ? {
8
7
  code: "required",
9
- message: e?.message || "Поле обязательно для заполнения",
10
- params: e?.params
11
- } : null);
8
+ message: r?.message ?? "invalid",
9
+ params: r?.params
10
+ } : null;
12
11
  }
13
12
  export {
14
- u as required
13
+ a as required
15
14
  };
@@ -1,19 +1,22 @@
1
- import { v as s } from "../validate-C3XiA_zf.js";
2
- function m(e, r) {
3
- if (!e) return;
4
- const l = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i, t = /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i;
5
- s(e, (o) => o ? (r?.requireProtocol ? t : l).test(o) ? r?.allowedProtocols && r.allowedProtocols.length > 0 && !r.allowedProtocols.some(
6
- (a) => o.toLowerCase().startsWith(`${a}://`)
7
- ) ? {
8
- code: "url_protocol",
9
- message: r?.message || `URL должен использовать один из протоколов: ${r.allowedProtocols.join(", ")}`,
10
- params: { allowedProtocols: r.allowedProtocols, ...r?.params }
11
- } : null : {
12
- code: "url",
13
- message: r?.message || "Неверный формат URL",
14
- params: r?.params
15
- } : null);
1
+ const a = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i, t = /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i;
2
+ function d(e) {
3
+ return (r) => {
4
+ if (!r)
5
+ return null;
6
+ const l = r;
7
+ return (e?.requireProtocol ? t : a).test(l) ? e?.allowedProtocols && e.allowedProtocols.length > 0 && !e.allowedProtocols.some(
8
+ (o) => l.toLowerCase().startsWith(`${o}://`)
9
+ ) ? {
10
+ code: "url_protocol",
11
+ message: e?.message ?? "invalid",
12
+ params: { allowedProtocols: e.allowedProtocols, ...e?.params }
13
+ } : null : {
14
+ code: "url",
15
+ message: e?.message ?? "invalid",
16
+ params: e?.params
17
+ };
18
+ };
16
19
  }
17
20
  export {
18
- m as url
21
+ d as url
19
22
  };
@@ -0,0 +1,169 @@
1
+ import { b as a, V as l } from "./registry-helpers-CLPXad2B.js";
2
+ import { e as s, t as y, c, a as x } from "./field-path-DuKdGcIE.js";
3
+ import { required as N } from "./validators/required.js";
4
+ import { min as V } from "./validators/min.js";
5
+ import { max as b } from "./validators/max.js";
6
+ import { minLength as _ } from "./validators/min-length.js";
7
+ import { maxLength as C } from "./validators/max-length.js";
8
+ import { email as P } from "./validators/email.js";
9
+ import { pattern as R } from "./validators/pattern.js";
10
+ import { url as w } from "./validators/url.js";
11
+ import { phone as D } from "./validators/phone.js";
12
+ import { isNumber as j } from "./validators/is-number.js";
13
+ import { integer as k } from "./validators/integer.js";
14
+ import { multipleOf as F } from "./validators/multiple-of.js";
15
+ import { nonNegative as L } from "./validators/non-negative.js";
16
+ import { nonZero as B } from "./validators/non-zero.js";
17
+ import { isDate as T } from "./validators/is-date.js";
18
+ import { minDate as E } from "./validators/min-date.js";
19
+ import { maxDate as G } from "./validators/max-date.js";
20
+ import { pastDate as I } from "./validators/past-date.js";
21
+ import { futureDate as M } from "./validators/future-date.js";
22
+ import { minAge as S } from "./validators/min-age.js";
23
+ import { maxAge as q } from "./validators/max-age.js";
24
+ function z(t, r, n) {
25
+ if (!t) return;
26
+ const i = s(t);
27
+ a().registerSync(
28
+ i,
29
+ r,
30
+ n
31
+ );
32
+ }
33
+ function K(t, r, n) {
34
+ const i = s(t);
35
+ a().registerAsync(
36
+ i,
37
+ r,
38
+ n
39
+ );
40
+ }
41
+ function U(t, r) {
42
+ if (!Array.isArray(t) && !Array.isArray(r) && t && !("__key" in t) && !("__path" in t)) {
43
+ r(t);
44
+ return;
45
+ }
46
+ const n = (Array.isArray(t) ? t : [t]).filter(
47
+ Boolean
48
+ ), i = Array.isArray(r) ? r : [r];
49
+ for (const e of n) {
50
+ const o = y(e);
51
+ for (const p of i)
52
+ p(o);
53
+ }
54
+ }
55
+ function W(t, r, n) {
56
+ const i = s(t);
57
+ a().enterCondition(i, r);
58
+ try {
59
+ const e = c();
60
+ n(e);
61
+ } finally {
62
+ a().exitCondition();
63
+ }
64
+ }
65
+ function Z(t) {
66
+ return (r) => {
67
+ if (r == null)
68
+ return null;
69
+ const n = r.length;
70
+ return typeof n != "number" || n >= 1 ? null : {
71
+ code: "minLength",
72
+ message: t?.message ?? "invalid",
73
+ params: { minLength: 1, ...t?.params }
74
+ };
75
+ };
76
+ }
77
+ function H(t, r) {
78
+ if (!t) return;
79
+ const n = s(t);
80
+ a().registerArrayItemValidation(n, r);
81
+ }
82
+ function m(t) {
83
+ return t == null ? !1 : typeof t == "object" && "value" in t && "setValue" in t && "getValue" in t && "validate" in t;
84
+ }
85
+ function u(t) {
86
+ return t == null ? !1 : m(t) && "validators" in t && "asyncValidators" in t && // FieldNode имеет markAsTouched метод
87
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
+ typeof t.markAsTouched == "function" && // У FieldNode нет fields или items
89
+ !("fields" in t) && !("items" in t);
90
+ }
91
+ function d(t) {
92
+ return t == null ? !1 : m(t) && "applyValidationSchema" in t && "applyBehaviorSchema" in t && "getFieldByPath" in t && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode)
93
+ !("items" in t) && !("push" in t) && !("removeAt" in t);
94
+ }
95
+ function g(t) {
96
+ return t == null ? !1 : m(t) && "items" in t && "length" in t && "push" in t && "removeAt" in t && "at" in t && // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
+ typeof t.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ typeof t.removeAt == "function";
99
+ }
100
+ function ht(t) {
101
+ return u(t) ? "FieldNode" : d(t) ? "GroupNode" : g(t) ? "ArrayNode" : m(t) ? "FormNode" : "Unknown";
102
+ }
103
+ function f(t) {
104
+ return u(t) ? [t] : d(t) ? Array.from(t.getAllFields()).flatMap(f) : g(t) ? t.map((r) => f(r)).flat() : [];
105
+ }
106
+ async function J(t, r) {
107
+ const n = new l();
108
+ n.beginRegistration();
109
+ let i = [], e = !1;
110
+ try {
111
+ const o = c();
112
+ r(o), i = n.getCurrentContext()?.getValidators() || [], n.cancelRegistration(), e = !0, t.clearErrors();
113
+ const h = f(t);
114
+ return await Promise.allSettled(h.map((A) => A.validate())), i.length > 0 && await t.applyContextualValidators(i), t.valid.value;
115
+ } catch (o) {
116
+ throw e || n.cancelRegistration(), o;
117
+ }
118
+ }
119
+ const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120
+ __proto__: null,
121
+ ValidationRegistry: l,
122
+ apply: U,
123
+ applyWhen: W,
124
+ createFieldPath: c,
125
+ email: P,
126
+ extractKey: x,
127
+ extractPath: s,
128
+ futureDate: M,
129
+ integer: k,
130
+ isDate: T,
131
+ isNumber: j,
132
+ max: b,
133
+ maxAge: q,
134
+ maxDate: G,
135
+ maxLength: C,
136
+ min: V,
137
+ minAge: S,
138
+ minDate: E,
139
+ minLength: _,
140
+ multipleOf: F,
141
+ nonNegative: L,
142
+ nonZero: B,
143
+ notEmpty: Z,
144
+ pastDate: I,
145
+ pattern: R,
146
+ phone: D,
147
+ required: N,
148
+ toFieldPath: y,
149
+ url: w,
150
+ validate: z,
151
+ validateAsync: K,
152
+ validateForm: J,
153
+ validateItems: H
154
+ }, Symbol.toStringTag, { value: "Module" }));
155
+ export {
156
+ g as a,
157
+ At as b,
158
+ m as c,
159
+ d,
160
+ z as e,
161
+ K as f,
162
+ ht as g,
163
+ U as h,
164
+ u as i,
165
+ W as j,
166
+ H as k,
167
+ Z as n,
168
+ J as v
169
+ };