@reformer/core 11.0.0-beta.7 → 11.0.0-beta.9

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 (226) hide show
  1. package/README.md +90 -68
  2. package/dist/behaviors-value-HA_Q03hc.js +108 -0
  3. package/dist/behaviors.js +382 -217
  4. package/dist/create-model-BvcbNPgL.js +30 -0
  5. package/dist/date-utils-90-qZbse.js +43 -0
  6. package/dist/{en-CjAqn7h0.js → en-HP8XEych.js} +6 -3
  7. package/dist/form/aggregate-signals.d.ts +21 -63
  8. package/dist/form/behaviors/collections.d.ts +42 -8
  9. package/dist/form/behaviors/context.d.ts +37 -4
  10. package/dist/form/behaviors/index.d.ts +6 -4
  11. package/dist/form/behaviors/internals.d.ts +9 -3
  12. package/dist/form/behaviors/node.d.ts +25 -2
  13. package/dist/form/behaviors/operators.d.ts +17 -9
  14. package/dist/form/behaviors/schema-operators.d.ts +78 -0
  15. package/dist/form/behaviors/types.d.ts +25 -5
  16. package/dist/form/create-form.d.ts +57 -70
  17. package/dist/form/flow/flow.d.ts +87 -0
  18. package/dist/form/form-bundle.d.ts +153 -0
  19. package/dist/form/form-config-base.d.ts +46 -0
  20. package/dist/form/form-level.d.ts +121 -0
  21. package/dist/form/form-proxy-builder.d.ts +6 -22
  22. package/dist/form/index.d.ts +20 -20
  23. package/dist/form/nodes/form-array-node.d.ts +100 -0
  24. package/dist/form/nodes/form-control-node.d.ts +73 -0
  25. package/dist/form/nodes/form-group-node.d.ts +66 -0
  26. package/dist/form/nodes/node-kind.d.ts +29 -0
  27. package/dist/form/nodes/state/availability.d.ts +6 -0
  28. package/dist/form/nodes/state/component.d.ts +6 -0
  29. package/dist/form/nodes/state/index.d.ts +12 -0
  30. package/dist/form/nodes/state/interaction.d.ts +13 -0
  31. package/dist/form/nodes/state/issues.d.ts +9 -0
  32. package/dist/form/nodes/state/pending.d.ts +6 -0
  33. package/dist/form/schema/compile.d.ts +59 -0
  34. package/dist/form/schema/compiled.d.ts +143 -0
  35. package/dist/form/schema/row-key.d.ts +11 -0
  36. package/dist/form/schema-controller.d.ts +153 -0
  37. package/dist/form/schema-subtree.d.ts +28 -0
  38. package/dist/form/signal-node-registry.d.ts +27 -22
  39. package/dist/form/submission.d.ts +93 -0
  40. package/dist/form/type-guards.d.ts +14 -73
  41. package/dist/form/types/contracts.d.ts +19 -92
  42. package/dist/form/types/field-config.d.ts +27 -0
  43. package/dist/form/types/index.d.ts +5 -57
  44. package/dist/form/types/nodes.d.ts +159 -0
  45. package/dist/form/types/schema-node.d.ts +147 -46
  46. package/dist/form/types/validation-schema.d.ts +23 -27
  47. package/dist/form/validation/context.d.ts +46 -6
  48. package/dist/form/validation/index.d.ts +9 -8
  49. package/dist/form/validation/operators.d.ts +71 -17
  50. package/dist/form/validation/run.d.ts +93 -18
  51. package/dist/form/validation/strategy.d.ts +41 -13
  52. package/dist/form/validation/types.d.ts +74 -19
  53. package/dist/form/validators/date-utils.d.ts +13 -1
  54. package/dist/form/validators/email.d.ts +8 -7
  55. package/dist/form/validators/file-type.d.ts +8 -7
  56. package/dist/form/validators/file-utils.d.ts +2 -1
  57. package/dist/form/validators/future-date.d.ts +8 -7
  58. package/dist/form/validators/index.d.ts +1 -1
  59. package/dist/form/validators/integer.d.ts +8 -7
  60. package/dist/form/validators/is-date.d.ts +11 -9
  61. package/dist/form/validators/is-number.d.ts +11 -9
  62. package/dist/form/validators/max-age.d.ts +13 -9
  63. package/dist/form/validators/max-date.d.ts +8 -7
  64. package/dist/form/validators/max-file-size.d.ts +8 -7
  65. package/dist/form/validators/max-files.d.ts +8 -7
  66. package/dist/form/validators/max-length.d.ts +14 -7
  67. package/dist/form/validators/max-total-file-size.d.ts +8 -7
  68. package/dist/form/validators/max.d.ts +10 -8
  69. package/dist/form/validators/min-age.d.ts +12 -9
  70. package/dist/form/validators/min-date.d.ts +8 -7
  71. package/dist/form/validators/min-file-size.d.ts +8 -7
  72. package/dist/form/validators/min-files.d.ts +11 -9
  73. package/dist/form/validators/min-length.d.ts +14 -7
  74. package/dist/form/validators/min.d.ts +10 -8
  75. package/dist/form/validators/multiple-of.d.ts +10 -8
  76. package/dist/form/validators/non-negative.d.ts +8 -7
  77. package/dist/form/validators/non-zero.d.ts +8 -7
  78. package/dist/form/validators/past-date.d.ts +8 -7
  79. package/dist/form/validators/pattern.d.ts +9 -8
  80. package/dist/form/validators/phone.d.ts +8 -7
  81. package/dist/form/validators/required.d.ts +11 -9
  82. package/dist/form/validators/url.d.ts +20 -13
  83. package/dist/form/validators/validation-issue.d.ts +8 -0
  84. package/dist/i18n/descriptor.d.ts +1 -1
  85. package/dist/i18n/en.json.d.ts +5 -1
  86. package/dist/i18n/locale-store.d.ts +7 -0
  87. package/dist/i18n/message-format.d.ts +24 -4
  88. package/dist/i18n/ru.json.d.ts +5 -1
  89. package/dist/i18n/translator.d.ts +11 -0
  90. package/dist/i18n/validation-message.d.ts +42 -7
  91. package/dist/i18n.d.ts +7 -12
  92. package/dist/i18n.js +66 -283
  93. package/dist/index.d.ts +16 -7
  94. package/dist/index.js +958 -2798
  95. package/dist/loader-BWkigpVe.js +52 -0
  96. package/dist/locale/en.js +1 -1
  97. package/dist/locale/en.json +4 -1
  98. package/dist/locale/ru.js +4 -1
  99. package/dist/locale/ru.json +4 -1
  100. package/dist/locale-CG54AU2Q.js +219 -0
  101. package/dist/locale.js +1 -1
  102. package/dist/model/behaviors-value.d.ts +24 -6
  103. package/dist/model/create-model.d.ts +2 -2
  104. package/dist/model/derived-registry.d.ts +1 -1
  105. package/dist/model/index.d.ts +16 -5
  106. package/dist/model/model-nodes.d.ts +138 -8
  107. package/dist/model/model-signals-proxy.d.ts +11 -5
  108. package/dist/model/model-value-proxy.d.ts +84 -3
  109. package/dist/model/safe-effect.d.ts +33 -1
  110. package/dist/model/types.d.ts +70 -17
  111. package/dist/model.js +21 -17
  112. package/dist/node-kind-C-r6ZMdo.js +15 -0
  113. package/dist/platforms/react/field-binding/field-adapter.d.ts +1 -1
  114. package/dist/platforms/react/field-binding/field-handle.d.ts +5 -2
  115. package/dist/platforms/react/form-bundle-context.d.ts +27 -0
  116. package/dist/platforms/react/hooks/types.d.ts +57 -38
  117. package/dist/platforms/react/hooks/use-form-bundle.d.ts +19 -4
  118. package/dist/platforms/react/hooks/use-form-flow.d.ts +40 -0
  119. package/dist/platforms/react/hooks/use-form-validation.d.ts +12 -6
  120. package/dist/platforms/react/hooks/useArrayLength.d.ts +6 -6
  121. package/dist/platforms/react/hooks/useFormControl.d.ts +7 -9
  122. package/dist/platforms/react/hooks/useFormControlValue.d.ts +18 -19
  123. package/dist/platforms/react/hooks/useSignalSubscription.d.ts +9 -1
  124. package/dist/platforms/react/i18n/context.d.ts +6 -1
  125. package/dist/platforms/react/i18n/hooks.d.ts +16 -10
  126. package/dist/platforms/react/i18n/provider.d.ts +9 -2
  127. package/dist/platforms/react/index.d.ts +7 -4
  128. package/dist/react.d.ts +22 -0
  129. package/dist/react.js +505 -0
  130. package/dist/runtime-token.d.ts +1 -2
  131. package/dist/safe-effect-BbtX3KuN.js +643 -0
  132. package/dist/schema-controller-CpiO2JoK.js +143 -0
  133. package/dist/signals.d.ts +15 -9
  134. package/dist/signals.js +11 -6
  135. package/dist/strategy-CoFSemuP.js +375 -0
  136. package/dist/type-guards-D-N_5Ddh.js +19 -0
  137. package/dist/validation-issue-B9mjI8jz.js +7 -0
  138. package/dist/validation-message-Ced9MGxs.js +194 -0
  139. package/dist/validation.js +9 -8
  140. package/dist/validators/email.js +5 -5
  141. package/dist/validators/future-date.js +8 -8
  142. package/dist/validators/integer.js +3 -3
  143. package/dist/validators/is-date.js +4 -4
  144. package/dist/validators/is-number.js +4 -4
  145. package/dist/validators/max-age.js +8 -9
  146. package/dist/validators/max-date.js +8 -8
  147. package/dist/validators/max-length.js +7 -7
  148. package/dist/validators/max.js +4 -4
  149. package/dist/validators/min-age.js +10 -8
  150. package/dist/validators/min-date.js +3 -3
  151. package/dist/validators/min-length.js +5 -5
  152. package/dist/validators/min.js +4 -4
  153. package/dist/validators/multiple-of.js +11 -7
  154. package/dist/validators/non-negative.js +3 -3
  155. package/dist/validators/non-zero.js +3 -3
  156. package/dist/validators/past-date.js +8 -8
  157. package/dist/validators/pattern.js +5 -5
  158. package/dist/validators/phone.js +11 -9
  159. package/dist/validators/required.js +2 -2
  160. package/dist/validators/url.js +48 -12
  161. package/dist/validators.js +17 -17
  162. package/docs/llms/01-api-reference.md +60 -34
  163. package/docs/llms/02-quick-start.md +111 -80
  164. package/docs/llms/03-api-signatures.md +368 -153
  165. package/docs/llms/04-common-patterns.md +58 -56
  166. package/docs/llms/05-common-mistakes.md +69 -44
  167. package/docs/llms/06-troubleshooting.md +14 -9
  168. package/docs/llms/07-complete-import.md +74 -43
  169. package/docs/llms/08-form-types.md +11 -4
  170. package/docs/llms/09-formschema.md +131 -83
  171. package/docs/llms/10-arrays.md +119 -69
  172. package/docs/llms/11-async-watchfield.md +2 -2
  173. package/docs/llms/13-multi-step.md +134 -63
  174. package/docs/llms/14-extended-mistakes.md +20 -17
  175. package/docs/llms/15-project-structure.md +221 -74
  176. package/docs/llms/16-ui-components.md +55 -42
  177. package/docs/llms/17-nonexistent-api.md +199 -32
  178. package/docs/llms/18-conditional-fields.md +66 -32
  179. package/docs/llms/19-reading-values.md +15 -3
  180. package/docs/llms/20-compute-vs-watch.md +16 -10
  181. package/docs/llms/21-array-operations.md +76 -26
  182. package/docs/llms/22-cycle-detection.md +1 -1
  183. package/docs/llms/23-copy-from.md +2 -2
  184. package/docs/llms/24-sync-fields.md +6 -5
  185. package/docs/llms/25-reset-when.md +14 -7
  186. package/docs/llms/26-transform-value.md +4 -4
  187. package/docs/llms/27-revalidate-when.md +16 -15
  188. package/docs/llms/28-submit-and-reset.md +276 -128
  189. package/docs/llms/29-async-preload.md +40 -30
  190. package/docs/llms/30-type-safety-recipes.md +105 -51
  191. package/docs/llms/31-async-validator-debounce.md +96 -53
  192. package/docs/llms/33-validation-strategy.md +178 -66
  193. package/docs/llms/34-i18n.md +69 -43
  194. package/docs/llms/35-unified-contract.md +307 -0
  195. package/docs/llms/36-issue-messages.md +284 -0
  196. package/docs/llms/37-compiled-schema.md +332 -0
  197. package/docs/llms/38-form-flow.md +397 -0
  198. package/llms-index.json +1 -1
  199. package/llms.txt +6968 -3278
  200. package/package.json +23 -4
  201. package/dist/behaviors-value-C7dSEhCc.js +0 -134
  202. package/dist/create-model-B8U-COv-.js +0 -103
  203. package/dist/date-utils-dTT_x_Be.js +0 -31
  204. package/dist/form/create-core-form.d.ts +0 -70
  205. package/dist/form/factories/index.d.ts +0 -6
  206. package/dist/form/factories/node-factory.d.ts +0 -189
  207. package/dist/form/form-submitter.d.ts +0 -121
  208. package/dist/form/nodes/array-node.d.ts +0 -276
  209. package/dist/form/nodes/field-node.d.ts +0 -297
  210. package/dist/form/nodes/form-node.d.ts +0 -326
  211. package/dist/form/nodes/group-node.d.ts +0 -284
  212. package/dist/form/nodes/model-array-node.d.ts +0 -121
  213. package/dist/form/nodes/subscription-manager.d.ts +0 -180
  214. package/dist/form/status-machine.d.ts +0 -115
  215. package/dist/form/types/deep-schema.d.ts +0 -107
  216. package/dist/form/types/form-proxy.d.ts +0 -141
  217. package/dist/form/unique-id.d.ts +0 -45
  218. package/dist/form/validation/config.d.ts +0 -73
  219. package/dist/form/validation/error-handler.d.ts +0 -166
  220. package/dist/form/validators/validation-error.d.ts +0 -8
  221. package/dist/index-BrNkQj1y.js +0 -105
  222. package/dist/loader-Dv_Hl7JC.js +0 -216
  223. package/dist/model-signals-proxy-2vqS243J.js +0 -250
  224. package/dist/node-DGEFMTQu.js +0 -18
  225. package/dist/strategy-BXS_gBfz.js +0 -170
  226. package/dist/validation-error-B-U3RsV0.js +0 -11
@@ -0,0 +1,194 @@
1
+ import { m as $ } from "./en-HP8XEych.js";
2
+ import { h as p, i as g, f as E, p as D, t as L } from "./locale-CG54AU2Q.js";
3
+ function R(t, n, e = {}) {
4
+ const r = /* @__PURE__ */ new Set(), o = t.peek?.(n);
5
+ let a = {
6
+ lang: n,
7
+ locale: o ?? e.previous ?? null,
8
+ pending: o === void 0,
9
+ error: void 0
10
+ }, u = null, s = o === void 0 ? null : n;
11
+ const f = (i) => {
12
+ a = i;
13
+ for (const l of [...r]) l();
14
+ };
15
+ return {
16
+ getState: () => a,
17
+ subscribe(i) {
18
+ return r.add(i), () => {
19
+ r.delete(i);
20
+ };
21
+ },
22
+ setLang(i) {
23
+ if (u === i) return;
24
+ if (s === i) {
25
+ u = null, (a.lang !== i || a.pending || a.error !== void 0) && f({ ...a, lang: i, pending: !1, error: void 0 });
26
+ return;
27
+ }
28
+ const l = t.peek?.(i);
29
+ if (l !== void 0) {
30
+ u = null, s = i, f({ lang: i, locale: l, pending: !1, error: void 0 });
31
+ return;
32
+ }
33
+ c(i);
34
+ },
35
+ retry() {
36
+ a.error === void 0 || u !== null || c(a.lang);
37
+ }
38
+ };
39
+ function c(i) {
40
+ u = i, f({ ...a, lang: i, pending: !0, error: void 0 }), t(i).then(
41
+ (l) => {
42
+ u === i && (u = null, s = i, f({ lang: i, locale: l, pending: !1, error: void 0 }));
43
+ },
44
+ (l) => {
45
+ u === i && (u = null, f({ ...a, pending: !1, error: l }), e.onError?.(l, i));
46
+ }
47
+ );
48
+ }
49
+ }
50
+ const v = "en", N = { onMissingArgument: (t) => `{${t}}` }, w = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new WeakMap();
51
+ function T() {
52
+ return process.env.NODE_ENV !== "production";
53
+ }
54
+ function z(t, n) {
55
+ try {
56
+ if (typeof t != "string") throw new TypeError("сообщение не является строкой");
57
+ return D(t);
58
+ } catch (e) {
59
+ return T() && console.error(
60
+ `[@reformer/core/i18n] ${n}: ${e instanceof Error ? e.message : String(e)}`
61
+ ), null;
62
+ }
63
+ }
64
+ function A(t, n, e) {
65
+ if (!p(t, n)) return;
66
+ let r = w.get(t);
67
+ r === void 0 && w.set(t, r = /* @__PURE__ */ new Map());
68
+ let o = r.get(n);
69
+ return o === void 0 && (o = z(t[n], `локаль «${e}», ключ «${n}»`), r.set(n, o)), o;
70
+ }
71
+ function m(t, n, e, r) {
72
+ const o = A(t, e, n);
73
+ if (o != null)
74
+ return E(o, r ?? {}, n, N);
75
+ }
76
+ function _(t, n, e, r) {
77
+ if (typeof t[e] == "string")
78
+ return m(t, n, e, r);
79
+ }
80
+ function U(t, n, e, r) {
81
+ return m(t.messages, t.code, e, r) ?? m(n, v, e, r) ?? e;
82
+ }
83
+ function P(t, n) {
84
+ let e = S.get(t);
85
+ return e === void 0 && (e = z(t, `defaultMessage «${t}»`), S.set(t, e)), e === null ? void 0 : E(e, n ?? {}, v, N);
86
+ }
87
+ const M = ["b", "kb", "mb", "gb", "tb"], y = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
88
+ function F(t, n, e, r) {
89
+ const o = e === void 0 ? n : `${n}|${JSON.stringify(e)}`;
90
+ let a = t.get(o);
91
+ return a === void 0 && t.set(o, a = r()), a;
92
+ }
93
+ const b = /* @__PURE__ */ new WeakMap();
94
+ function Z(t) {
95
+ const n = b.get(t);
96
+ if (n !== void 0) return n;
97
+ const { code: e, messages: r } = t, o = (s, f) => F(
98
+ y,
99
+ e,
100
+ f,
101
+ () => new Intl.NumberFormat(g(e), f)
102
+ ).format(s), a = (s, f, c) => {
103
+ const i = m(r, e, s, f);
104
+ if (i !== void 0) return i;
105
+ if (c !== void 0) {
106
+ const d = P(c, f);
107
+ if (d !== void 0) return d;
108
+ }
109
+ const l = m($, v, s, f);
110
+ if (l !== void 0) return l;
111
+ if (T()) {
112
+ let d = h.get(r);
113
+ d === void 0 && h.set(r, d = /* @__PURE__ */ new Set()), d.has(s) || (d.add(s), console.warn(
114
+ `[@reformer/core/i18n] ключа «${s}» нет в локали «${e}», и defaultMessage не задан — показан сам ключ`
115
+ ));
116
+ }
117
+ return s;
118
+ }, u = {
119
+ locale: t,
120
+ code: e,
121
+ has: (s) => p(r, s),
122
+ t: a,
123
+ number: o,
124
+ date: (s, f) => F(
125
+ j,
126
+ e,
127
+ f,
128
+ () => new Intl.DateTimeFormat(g(e), f)
129
+ ).format(s),
130
+ fileSize: (s) => {
131
+ if (!Number.isFinite(s) || s < 0) return "";
132
+ let f = s, c = 0;
133
+ for (; f >= 1024 && c < M.length - 1; )
134
+ f /= 1024, c += 1;
135
+ const i = o(f, { maximumFractionDigits: c === 0 ? 0 : 1, useGrouping: !1 });
136
+ return a(`format.fileSize.${M[c]}`, { value: i });
137
+ }
138
+ };
139
+ return b.set(t, u), u;
140
+ }
141
+ function G(t) {
142
+ return t;
143
+ }
144
+ const C = /* @__PURE__ */ new Set([
145
+ "maxFileSize",
146
+ "minFileSize",
147
+ "actualSize",
148
+ "maxTotalFileSize",
149
+ "actualTotal"
150
+ ]), I = /* @__PURE__ */ new Map();
151
+ function W(t, n) {
152
+ const e = n.map(L);
153
+ let r = I.get(t);
154
+ if (r === void 0) {
155
+ try {
156
+ r = new Intl.ListFormat(g(t), { style: "narrow", type: "conjunction" });
157
+ } catch {
158
+ r = null;
159
+ }
160
+ I.set(t, r);
161
+ }
162
+ return r === null ? e.join(", ") : r.format(e);
163
+ }
164
+ function O(t, n) {
165
+ if (t === void 0) return;
166
+ const e = {};
167
+ for (const r of Object.keys(t)) {
168
+ const o = t[r];
169
+ o instanceof Date ? e[r] = n.date(o, { dateStyle: "medium" }) : Array.isArray(o) ? e[r] = W(n.code, o) : typeof o == "number" && C.has(r) ? e[r] = n.fileSize(o) : e[r] = o;
170
+ }
171
+ return e;
172
+ }
173
+ function J(t, n, e) {
174
+ if (e !== void 0 && p(e, t.code)) {
175
+ const o = e[t.code];
176
+ if (typeof o == "function") return o(t.params ?? {}, n);
177
+ const a = _(
178
+ e,
179
+ n.code,
180
+ t.code,
181
+ O(t.params, n)
182
+ );
183
+ if (a !== void 0) return a;
184
+ }
185
+ const r = `validation.${t.code}`;
186
+ return n.has(r) || p($, r) ? n.t(r, O(t.params, n)) : t.code;
187
+ }
188
+ export {
189
+ Z as a,
190
+ R as c,
191
+ G as d,
192
+ J as r,
193
+ U as t
194
+ };
@@ -1,12 +1,13 @@
1
- import { d as s, h as d, c as i, f as l, e as t, v as o, a as c, g as n, b as r } from "./strategy-BXS_gBfz.js";
1
+ import { c as i, d as l, f as s, h as d, e as t, r as n, v as o, a as p, g as r, b as v } from "./strategy-CoFSemuP.js";
2
2
  export {
3
- s as apply,
3
+ i as apply,
4
+ l as applyEach,
5
+ s as applyValidationResult,
4
6
  d as createFormValidation,
5
- i as cross,
6
- l as defineValidationSchema,
7
- t as each,
7
+ t as defineValidation,
8
+ n as runValidation,
8
9
  o as validate,
9
- c as validateAsync,
10
- n as validateModel,
11
- r as validateWhen
10
+ p as validateAsync,
11
+ r as validateModel,
12
+ v as validateWhen
12
13
  };
@@ -1,8 +1,8 @@
1
- import { v as n } from "../validation-error-B-U3RsV0.js";
2
- const i = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
3
- function o(t) {
4
- return (r) => r ? i.test(r) ? null : n("email", t) : null;
1
+ import { v as n } from "../validation-issue-B9mjI8jz.js";
2
+ const e = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
3
+ function s(t) {
4
+ return (r) => r ? e.test(r) ? null : n("email", t) : null;
5
5
  }
6
6
  export {
7
- o as email
7
+ s as email
8
8
  };
@@ -1,14 +1,14 @@
1
- import { p as e, n as i, g as l } from "../date-utils-dTT_x_Be.js";
2
- import { v as u } from "../validation-error-B-U3RsV0.js";
1
+ import { p as o, n as s, g as u } from "../date-utils-90-qZbse.js";
2
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
3
3
  function f(n) {
4
- return (r) => {
5
- if (r == null || r === "")
4
+ return (t) => {
5
+ if (t == null || t === "")
6
6
  return null;
7
- const t = e(r);
8
- if (t === null)
7
+ const r = o(t);
8
+ if (r === null)
9
9
  return null;
10
- const o = i(t), a = l();
11
- return o < a ? u("date_past", n) : null;
10
+ const a = s(r), e = u();
11
+ return a < e ? i("date_past", n) : null;
12
12
  };
13
13
  }
14
14
  export {
@@ -1,7 +1,7 @@
1
- import { v as t } from "../validation-error-B-U3RsV0.js";
2
- function e(n) {
1
+ import { v as t } from "../validation-issue-B9mjI8jz.js";
2
+ function i(n) {
3
3
  return (r) => r == null || typeof r != "number" || isNaN(r) || Number.isInteger(r) ? null : t("integer", n);
4
4
  }
5
5
  export {
6
- e as integer
6
+ i as integer
7
7
  };
@@ -1,8 +1,8 @@
1
- import { p as t } from "../date-utils-dTT_x_Be.js";
2
- import { v as i } from "../validation-error-B-U3RsV0.js";
3
- function l(n) {
1
+ import { p as t } from "../date-utils-90-qZbse.js";
2
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
3
+ function a(n) {
4
4
  return (r) => r == null || r === "" ? null : t(r) === null ? i("date_invalid", n) : null;
5
5
  }
6
6
  export {
7
- l as isDate
7
+ a as isDate
8
8
  };
@@ -1,7 +1,7 @@
1
- import { v as i } from "../validation-error-B-U3RsV0.js";
2
- function o(n) {
3
- return (r) => r == null ? null : typeof r != "number" || isNaN(r) ? i("isNumber", n) : null;
1
+ import { v as n } from "../validation-issue-B9mjI8jz.js";
2
+ function u(i) {
3
+ return (r) => r == null || r === "" ? null : typeof r != "number" || !Number.isFinite(r) ? n("isNumber", i) : null;
4
4
  }
5
5
  export {
6
- o as isNumber
6
+ u as isNumber
7
7
  };
@@ -1,16 +1,15 @@
1
- import { p as o, c as i } from "../date-utils-dTT_x_Be.js";
2
- import { v as l } from "../validation-error-B-U3RsV0.js";
3
- function s(n, a) {
1
+ import { p as i, i as a, c as l } from "../date-utils-90-qZbse.js";
2
+ import { v as s } from "../validation-issue-B9mjI8jz.js";
3
+ function f(n, u) {
4
4
  return (r) => {
5
5
  if (r == null || r === "")
6
6
  return null;
7
- const t = o(r);
8
- if (t === null)
9
- return null;
10
- const e = i(t);
11
- return e > n ? l("date_max_age", a, { maxAge: n, currentAge: e }) : null;
7
+ const t = i(r);
8
+ if (t === null || a(t)) return null;
9
+ const e = l(t);
10
+ return e > n ? s("date_max_age", u, { maxAge: n, currentAge: e }) : null;
12
11
  };
13
12
  }
14
13
  export {
15
- s as maxAge
14
+ f as maxAge
16
15
  };
@@ -1,14 +1,14 @@
1
- import { p as l, n as o } from "../date-utils-dTT_x_Be.js";
2
- import { v as m } from "../validation-error-B-U3RsV0.js";
3
- function d(n, a) {
4
- return (r) => {
5
- if (r == null || r === "")
1
+ import { p as l, n as a } from "../date-utils-90-qZbse.js";
2
+ import { v as s } from "../validation-issue-B9mjI8jz.js";
3
+ function d(r, o) {
4
+ return (n) => {
5
+ if (n == null || n === "")
6
6
  return null;
7
- const t = l(r);
7
+ const t = l(n);
8
8
  if (t === null)
9
9
  return null;
10
- const e = o(t), i = o(n);
11
- return e > i ? m("date_max", a, { maxDate: n }) : null;
10
+ const e = a(t), i = a(r);
11
+ return e > i ? s("date_max", o, { maxDate: r }) : null;
12
12
  };
13
13
  }
14
14
  export {
@@ -1,12 +1,12 @@
1
- import { v as l } from "../validation-error-B-U3RsV0.js";
2
- function u(t, e) {
3
- return (n) => {
4
- if (n == null || n === "")
1
+ import { v as u } from "../validation-issue-B9mjI8jz.js";
2
+ function a(r, e) {
3
+ return (t) => {
4
+ if (t == null || t === "")
5
5
  return null;
6
- const r = n.length;
7
- return typeof r != "number" ? null : r > t ? l("maxLength", e, { maxLength: t, actualLength: r }) : null;
6
+ const n = t.length;
7
+ return typeof n != "number" ? null : n > r ? Array.isArray(t) ? u("maxItems", e, { maxLength: r, actualLength: n }) : u("maxLength", e, { maxLength: r, actualLength: n }) : null;
8
8
  };
9
9
  }
10
10
  export {
11
- u as maxLength
11
+ a as maxLength
12
12
  };
@@ -1,7 +1,7 @@
1
- import { v as i } from "../validation-error-B-U3RsV0.js";
2
- function u(n, t) {
3
- return (r) => r == null ? null : r > n ? i("max", t, { max: n, actual: r }) : null;
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ function m(n, t) {
3
+ return (r) => typeof r != "number" || Number.isNaN(r) ? null : r > n ? i("max", t, { max: n, actual: r }) : null;
4
4
  }
5
5
  export {
6
- u as max
6
+ m as max
7
7
  };
@@ -1,16 +1,18 @@
1
- import { p as o, c as a } from "../date-utils-dTT_x_Be.js";
2
- import { v as l } from "../validation-error-B-U3RsV0.js";
3
- function s(n, i) {
1
+ import { p as a, i as s, c as f } from "../date-utils-90-qZbse.js";
2
+ import { v as u } from "../validation-issue-B9mjI8jz.js";
3
+ function c(t, e) {
4
4
  return (r) => {
5
5
  if (r == null || r === "")
6
6
  return null;
7
- const t = o(r);
8
- if (t === null)
7
+ const n = a(r);
8
+ if (n === null)
9
9
  return null;
10
- const e = a(t);
11
- return e < n ? l("date_min_age", i, { minAge: n, currentAge: e }) : null;
10
+ if (s(n))
11
+ return u("date_future", e, { minAge: t });
12
+ const i = f(n);
13
+ return i < t ? u("date_min_age", e, { minAge: t, currentAge: i }) : null;
12
14
  };
13
15
  }
14
16
  export {
15
- s as minAge
17
+ c as minAge
16
18
  };
@@ -1,5 +1,5 @@
1
- import { p as l, n as i } from "../date-utils-dTT_x_Be.js";
2
- import { v as m } from "../validation-error-B-U3RsV0.js";
1
+ import { p as l, n as i } from "../date-utils-90-qZbse.js";
2
+ import { v as s } from "../validation-issue-B9mjI8jz.js";
3
3
  function d(r, o) {
4
4
  return (n) => {
5
5
  if (n == null || n === "")
@@ -8,7 +8,7 @@ function d(r, o) {
8
8
  if (t === null)
9
9
  return null;
10
10
  const e = i(t), a = i(r);
11
- return e < a ? m("date_min", o, { minDate: r }) : null;
11
+ return e < a ? s("date_min", o, { minDate: r }) : null;
12
12
  };
13
13
  }
14
14
  export {
@@ -1,12 +1,12 @@
1
- import { v as i } from "../validation-error-B-U3RsV0.js";
2
- function o(t, e) {
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ function l(r, e) {
3
3
  return (n) => {
4
4
  if (n == null || n === "")
5
5
  return null;
6
- const r = n.length;
7
- return typeof r != "number" ? null : r < t ? i("minLength", e, { minLength: t, actualLength: r }) : null;
6
+ const t = n.length;
7
+ return typeof t != "number" ? null : t < r ? Array.isArray(n) ? i("minItems", e, { minLength: r, actualLength: t }) : i("minLength", e, { minLength: r, actualLength: t }) : null;
8
8
  };
9
9
  }
10
10
  export {
11
- o as minLength
11
+ l as minLength
12
12
  };
@@ -1,7 +1,7 @@
1
- import { v as t } from "../validation-error-B-U3RsV0.js";
2
- function u(n, i) {
3
- return (r) => r == null ? null : r < n ? t("min", i, { min: n, actual: r }) : null;
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ function m(n, t) {
3
+ return (r) => typeof r != "number" || Number.isNaN(r) ? null : r < n ? i("min", t, { min: n, actual: r }) : null;
4
4
  }
5
5
  export {
6
- u as min
6
+ m as min
7
7
  };
@@ -1,11 +1,15 @@
1
- import { v as i } from "../validation-error-B-U3RsV0.js";
2
- function o(n, l) {
3
- return (t) => {
4
- if (t == null || typeof t != "number" || isNaN(t)) return null;
5
- const r = Math.abs(t % n);
6
- return r <= 1e-9 || Math.abs(r - Math.abs(n)) <= 1e-9 ? null : i("multipleOf", l, { multipleOf: n });
1
+ import { v as u } from "../validation-issue-B9mjI8jz.js";
2
+ function f(t, e) {
3
+ if (!Number.isFinite(t) || t === 0)
4
+ throw new RangeError(
5
+ `[@reformer/core] multipleOf(${String(t)}): делитель должен быть конечным числом, не равным нулю.`
6
+ );
7
+ return (r) => {
8
+ if (r == null || typeof r != "number" || isNaN(r)) return null;
9
+ const n = r / t;
10
+ return Math.abs(n - Math.round(n)) <= 8 * Number.EPSILON * Math.max(1, Math.abs(n)) ? null : u("multipleOf", e, { multipleOf: t });
7
11
  };
8
12
  }
9
13
  export {
10
- o as multipleOf
14
+ f as multipleOf
11
15
  };
@@ -1,7 +1,7 @@
1
- import { v as t } from "../validation-error-B-U3RsV0.js";
2
- function o(r) {
1
+ import { v as t } from "../validation-issue-B9mjI8jz.js";
2
+ function e(r) {
3
3
  return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n < 0 ? t("nonNegative", r) : null;
4
4
  }
5
5
  export {
6
- o as nonNegative
6
+ e as nonNegative
7
7
  };
@@ -1,6 +1,6 @@
1
- import { v as o } from "../validation-error-B-U3RsV0.js";
2
- function i(n) {
3
- return (r) => r == null || typeof r != "number" || isNaN(r) ? null : r === 0 ? o("nonZero", n) : null;
1
+ import { v as o } from "../validation-issue-B9mjI8jz.js";
2
+ function i(r) {
3
+ return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n === 0 ? o("nonZero", r) : null;
4
4
  }
5
5
  export {
6
6
  i as nonZero
@@ -1,14 +1,14 @@
1
- import { p as e, n as i, g as l } from "../date-utils-dTT_x_Be.js";
2
- import { v as u } from "../validation-error-B-U3RsV0.js";
1
+ import { p as o, n as s, g as u } from "../date-utils-90-qZbse.js";
2
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
3
3
  function f(n) {
4
- return (r) => {
5
- if (r == null || r === "")
4
+ return (t) => {
5
+ if (t == null || t === "")
6
6
  return null;
7
- const t = e(r);
8
- if (t === null)
7
+ const r = o(t);
8
+ if (r === null)
9
9
  return null;
10
- const o = i(t), a = l();
11
- return o > a ? u("date_future", n) : null;
10
+ const a = s(r), e = u();
11
+ return a > e ? i("date_future", n) : null;
12
12
  };
13
13
  }
14
14
  export {
@@ -1,8 +1,8 @@
1
- import { v as o } from "../validation-error-B-U3RsV0.js";
2
- function a(r, e) {
3
- const t = new RegExp(r.source, r.flags);
4
- return (n) => n ? (t.lastIndex = 0, t.test(n) ? null : o("pattern", e, { pattern: r.source })) : null;
1
+ import { v as s } from "../validation-issue-B9mjI8jz.js";
2
+ function o(t, e) {
3
+ const n = new RegExp(t.source, t.flags);
4
+ return (r) => r ? (n.lastIndex = 0, n.test(r) ? null : s("pattern", e, { pattern: t.source })) : null;
5
5
  }
6
6
  export {
7
- a as pattern
7
+ o as pattern
8
8
  };
@@ -1,14 +1,16 @@
1
- import { v as o } from "../validation-error-B-U3RsV0.js";
2
- const e = {
1
+ import { v as e } from "../validation-issue-B9mjI8jz.js";
2
+ const o = {
3
3
  international: /^\+?[1-9]\d{1,14}$/,
4
- ru: /^(\+7|7|8)?[\s-]?\(?[489][0-9]{2}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
5
- us: /^(\+?1)?[\s-]?\(?[2-9]\d{2}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
6
- any: /^\+?\(?[0-9]{1,4}\)?[-\s.]?\(?[0-9]{1,4}\)?[-\s.]?[0-9]{1,9}$/
4
+ // Код города — в парных скобках либо без них: непарная скобка — не номер.
5
+ ru: /^(\+7|7|8)?[\s-]?(?:\([489][0-9]{2}\)|[489][0-9]{2})[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
6
+ us: /^(\+?1)?[\s-]?(?:\([2-9]\d{2}\)|[2-9]\d{2})[\s-]?\d{3}[\s-]?\d{4}$/,
7
+ // От 3 до 15 цифр (предел E.164), между ними — любые скобки, пробелы, точки и дефисы.
8
+ any: /^\+?(?:[\s().-]*\d){3,15}[\s().-]*$/
7
9
  };
8
- function u(r) {
9
- const n = r?.format ?? "any", s = e[n];
10
- return (t) => t ? s.test(t) ? null : o("phone", r, { format: n }) : null;
10
+ function a(n) {
11
+ const r = n?.format ?? "any", t = o[r];
12
+ return (s) => s ? t.test(s) ? null : e("phone", n, { format: r }) : null;
11
13
  }
12
14
  export {
13
- u as phone
15
+ a as phone
14
16
  };
@@ -1,6 +1,6 @@
1
- import { v as i } from "../validation-error-B-U3RsV0.js";
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
2
  function e(t) {
3
- return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "boolean" && r !== !0 ? i("required", t) : null;
3
+ return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "number" && Number.isNaN(r) || typeof r == "boolean" && r !== !0 ? i("required", t) : null;
4
4
  }
5
5
  export {
6
6
  e as required
@@ -1,17 +1,53 @@
1
- import { v as t } from "../validation-error-B-U3RsV0.js";
2
- const a = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i, c = /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i;
3
- function n(o) {
4
- return (r) => {
5
- if (!r)
1
+ import { v as i } from "../validation-issue-B9mjI8jz.js";
2
+ const f = ["http", "https"], h = /^([a-z][a-z\d+.-]*):\/\//i, a = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)", p = new RegExp(`^${a}(?:\\.${a}){3}$`), L = /^\[[\da-f:.]+\]$/i, w = /^[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?$/u, P = new RegExp("^(?:\\p{L}{2,}|xn--[a-z\\d-]+)$", "iu"), E = /^\d{1,5}$/, x = /\s/;
3
+ function O(t) {
4
+ if (t.toLowerCase() === "localhost" || p.test(t) || L.test(t)) return !0;
5
+ const r = t.split(".");
6
+ return r.length >= 2 && r.every((l) => w.test(l)) && P.test(r[r.length - 1]);
7
+ }
8
+ function d(t, r) {
9
+ const l = t.slice(r), c = l.search(/[/?#]/), e = c === -1 ? l : l.slice(0, c);
10
+ if (e.includes("@")) return !1;
11
+ let s = e, n;
12
+ if (e.startsWith("[")) {
13
+ const o = e.indexOf("]");
14
+ if (o === -1) return !1;
15
+ s = e.slice(0, o + 1);
16
+ const u = e.slice(o + 1);
17
+ if (u !== "") {
18
+ if (!u.startsWith(":")) return !1;
19
+ n = u.slice(1);
20
+ }
21
+ } else {
22
+ const o = e.lastIndexOf(":");
23
+ o !== -1 && (s = e.slice(0, o), n = e.slice(o + 1));
24
+ }
25
+ if (!O(s) || n !== void 0 && !E.test(n)) return !1;
26
+ try {
27
+ return new URL(t), !0;
28
+ } catch {
29
+ return !1;
30
+ }
31
+ }
32
+ function C(t) {
33
+ const r = t?.allowedProtocols !== void 0 && t.allowedProtocols.length > 0, l = (r ? t.allowedProtocols : f).map(
34
+ (e) => e.toLowerCase()
35
+ ), c = () => i("url_protocol", t, {
36
+ allowedProtocols: r ? t.allowedProtocols : [...f]
37
+ });
38
+ return (e) => {
39
+ if (!e)
6
40
  return null;
7
- const l = r;
8
- return (o?.requireProtocol ? c : a).test(l) ? o?.allowedProtocols && o.allowedProtocols.length > 0 && !o.allowedProtocols.some(
9
- (e) => l.toLowerCase().startsWith(`${e}://`)
10
- ) ? t("url_protocol", o, {
11
- allowedProtocols: o.allowedProtocols
12
- }) : null : t("url", o);
41
+ if (x.test(e)) return i("url", t);
42
+ const s = h.exec(e);
43
+ if (s === null) {
44
+ if (t?.requireProtocol || e.startsWith("/")) return i("url", t);
45
+ const n = `http://${e}`;
46
+ return d(n, 7) ? r ? c() : null : i("url", t);
47
+ }
48
+ return d(e, s[0].length) ? l.includes(s[1].toLowerCase()) ? null : c() : i("url", t);
13
49
  };
14
50
  }
15
51
  export {
16
- n as url
52
+ C as url
17
53
  };