@harnessio/forms 1.1.0 → 1.2.0
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.
- package/README.md +2 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +390 -381
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var ye = (r, e, t) =>
|
|
4
|
-
import { isEmpty as Ce, set as P, get as E, forOwn as
|
|
5
|
-
import
|
|
6
|
-
import { useFormContext as
|
|
7
|
-
import { Controller as
|
|
8
|
-
import { toNestErrors as
|
|
9
|
-
class
|
|
1
|
+
var zt = Object.defineProperty;
|
|
2
|
+
var Bt = (r, e, t) => e in r ? zt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var ye = (r, e, t) => Bt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { isEmpty as Ce, set as P, get as E, forOwn as St, isArray as J, isObject as Ot, merge as te, isUndefined as Se, cloneDeep as de, unset as Rt, isPlainObject as Ut, isNull as Et, isString as Wt, omitBy as Jt, isNil as Ht, capitalize as Yt } from "lodash-es";
|
|
5
|
+
import Gt, { createContext as Qt, useContext as Xt, Component as Kt, memo as er, useMemo as ge, useRef as G, useEffect as Y, useCallback as tr, forwardRef as rr, Fragment as nr } from "react";
|
|
6
|
+
import { useFormContext as sr, get as ar, useForm as ir, FormProvider as or, appendErrors as ur, useController as cr } from "react-hook-form";
|
|
7
|
+
import { Controller as Dn, Form as Ln, FormProvider as qn, get as zn, set as Bn, useFieldArray as Un, useForm as Wn, useFormContext as Jn, useFormState as Hn, useWatch as Yn } from "react-hook-form";
|
|
8
|
+
import { toNestErrors as dr } from "@hookform/resolvers";
|
|
9
|
+
class lr extends Error {
|
|
10
10
|
constructor(e) {
|
|
11
11
|
super(`Input component '${e}' is already registered.`);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class At {
|
|
15
15
|
constructor(e) {
|
|
16
16
|
ye(this, "componentBank");
|
|
17
17
|
ye(this, "allowOverride");
|
|
@@ -25,7 +25,7 @@ class Rt {
|
|
|
25
25
|
*/
|
|
26
26
|
registerComponent(e) {
|
|
27
27
|
if (!this.allowOverride && this.getComponent(e.internalType))
|
|
28
|
-
throw new
|
|
28
|
+
throw new lr(e.internalType);
|
|
29
29
|
this.componentBank.set(e.internalType, e);
|
|
30
30
|
}
|
|
31
31
|
getComponent(e) {
|
|
@@ -46,7 +46,7 @@ class Rt {
|
|
|
46
46
|
* @returns new input factory
|
|
47
47
|
*/
|
|
48
48
|
clone() {
|
|
49
|
-
const e = new
|
|
49
|
+
const e = new At({
|
|
50
50
|
allowOverride: this.allowOverride
|
|
51
51
|
});
|
|
52
52
|
return this.listRegisteredComponents().forEach((t) => {
|
|
@@ -54,16 +54,16 @@ class Rt {
|
|
|
54
54
|
}), e;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
var
|
|
57
|
+
var Oe = { exports: {} }, ee = {};
|
|
58
58
|
/*
|
|
59
59
|
object-assign
|
|
60
60
|
(c) Sindre Sorhus
|
|
61
61
|
@license MIT
|
|
62
62
|
*/
|
|
63
|
-
var Re,
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
66
|
-
|
|
63
|
+
var Re, nt;
|
|
64
|
+
function fr() {
|
|
65
|
+
if (nt) return Re;
|
|
66
|
+
nt = 1;
|
|
67
67
|
var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
|
|
68
68
|
function n(s) {
|
|
69
69
|
if (s == null)
|
|
@@ -114,14 +114,14 @@ function cr() {
|
|
|
114
114
|
* This source code is licensed under the MIT license found in the
|
|
115
115
|
* LICENSE file in the root directory of this source tree.
|
|
116
116
|
*/
|
|
117
|
-
var
|
|
118
|
-
function
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
var r =
|
|
122
|
-
if (
|
|
117
|
+
var st;
|
|
118
|
+
function hr() {
|
|
119
|
+
if (st) return ee;
|
|
120
|
+
st = 1, fr();
|
|
121
|
+
var r = Gt, e = 60103;
|
|
122
|
+
if (ee.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
|
|
123
123
|
var t = Symbol.for;
|
|
124
|
-
e = t("react.element"),
|
|
124
|
+
e = t("react.element"), ee.Fragment = t("react.fragment");
|
|
125
125
|
}
|
|
126
126
|
var n = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
127
127
|
function i(o, u, c) {
|
|
@@ -131,22 +131,22 @@ function dr() {
|
|
|
131
131
|
if (o && o.defaultProps) for (d in u = o.defaultProps, u) y[d] === void 0 && (y[d] = u[d]);
|
|
132
132
|
return { $$typeof: e, type: o, key: h, ref: v, props: y, _owner: n.current };
|
|
133
133
|
}
|
|
134
|
-
return
|
|
134
|
+
return ee.jsx = i, ee.jsxs = i, ee;
|
|
135
135
|
}
|
|
136
|
-
var
|
|
137
|
-
function
|
|
138
|
-
return
|
|
136
|
+
var at;
|
|
137
|
+
function mr() {
|
|
138
|
+
return at || (at = 1, Oe.exports = hr()), Oe.exports;
|
|
139
139
|
}
|
|
140
|
-
var
|
|
141
|
-
const
|
|
142
|
-
function
|
|
140
|
+
var S = mr();
|
|
141
|
+
const It = Qt({});
|
|
142
|
+
function pr({
|
|
143
143
|
children: r,
|
|
144
144
|
metadata: e,
|
|
145
145
|
inputErrorHandler: t,
|
|
146
146
|
readonly: n
|
|
147
147
|
}) {
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
|
|
148
|
+
return /* @__PURE__ */ S.jsx(
|
|
149
|
+
It.Provider,
|
|
150
150
|
{
|
|
151
151
|
value: {
|
|
152
152
|
metadata: e,
|
|
@@ -157,11 +157,11 @@ function fr({
|
|
|
157
157
|
}
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
const r =
|
|
160
|
+
function yr() {
|
|
161
|
+
const r = Xt(It);
|
|
162
162
|
return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
|
|
163
163
|
}
|
|
164
|
-
class
|
|
164
|
+
class gr extends Kt {
|
|
165
165
|
constructor() {
|
|
166
166
|
super(...arguments);
|
|
167
167
|
ye(this, "state", {
|
|
@@ -180,13 +180,13 @@ class mr extends Gt {
|
|
|
180
180
|
(i = (s = this.props).inputErrorHandler) == null || i.call(s, a);
|
|
181
181
|
}
|
|
182
182
|
render() {
|
|
183
|
-
return this.state.hasError ? /* @__PURE__ */
|
|
183
|
+
return this.state.hasError ? /* @__PURE__ */ S.jsx(S.Fragment, {}) : this.props.children;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const it = ({
|
|
187
187
|
children: r,
|
|
188
188
|
withoutWrapper: e = !1
|
|
189
|
-
}) => e || !r ? r : /* @__PURE__ */
|
|
189
|
+
}) => e || !r ? r : /* @__PURE__ */ S.jsx("div", { children: r }), _r = er(function({
|
|
190
190
|
path: e,
|
|
191
191
|
factory: t,
|
|
192
192
|
onUpdate: n,
|
|
@@ -195,20 +195,20 @@ const at = ({
|
|
|
195
195
|
input: i,
|
|
196
196
|
withoutWrapper: o = !1
|
|
197
197
|
}) {
|
|
198
|
-
var
|
|
199
|
-
const u =
|
|
198
|
+
var Ye, Ge, Qe, Xe, Ke;
|
|
199
|
+
const u = sr(), { formState: c } = u, { fixedValues: d = {} } = {}, { metadata: y, readonly: h, inputErrorHandler: v } = yr(), O = t == null ? void 0 : t.getComponent(i.inputType), w = !!(i.isVisible || typeof i.disabled == "function" || typeof ((Ye = i.validation) == null ? void 0 : Ye.schema) == "function" || typeof ((Ge = i.warning) == null ? void 0 : Ge.schema) == "function"), R = !!((Qe = i.warning) != null && Qe.schema || (Xe = i.validation) != null && Xe.schema), T = w ? u.watch() : {}, V = R ? w ? ar(T, i.path) : u.watch(i.path) : void 0, Z = ge(() => {
|
|
200
200
|
if (!w) return {};
|
|
201
201
|
let ie = T;
|
|
202
202
|
return d && Object.keys(d).forEach((pe) => {
|
|
203
203
|
const oe = d[pe];
|
|
204
204
|
ie = P(ie, pe, oe);
|
|
205
205
|
}), ie;
|
|
206
|
-
}, [w, T, d]), H = !i.isVisible || i.isVisible(Z, y), A = h || i.readonly, M = typeof i.disabled == "function" ? i.disabled(Z, y) : i.disabled,
|
|
207
|
-
var
|
|
208
|
-
if (!H || typeof
|
|
209
|
-
const ie = typeof
|
|
210
|
-
return !pe &&
|
|
211
|
-
}, [i.path, V,
|
|
206
|
+
}, [w, T, d]), H = !i.isVisible || i.isVisible(Z, y), A = h || i.readonly, M = typeof i.disabled == "function" ? i.disabled(Z, y) : i.disabled, j = (Ke = i.warning) == null ? void 0 : Ke.schema, Je = ge(() => {
|
|
207
|
+
var tt, rt;
|
|
208
|
+
if (!H || typeof j > "u") return;
|
|
209
|
+
const ie = typeof j == "function" ? j(Z, y) : j, { success: pe, error: oe } = ie.safeParse(V), et = (rt = (tt = oe == null ? void 0 : oe.errors) == null ? void 0 : tt[0]) == null ? void 0 : rt.message;
|
|
210
|
+
return !pe && et ? et : void 0;
|
|
211
|
+
}, [i.path, V, j, H, y]), He = ge(
|
|
212
212
|
() => ({
|
|
213
213
|
path: e,
|
|
214
214
|
key: e,
|
|
@@ -219,26 +219,26 @@ const at = ({
|
|
|
219
219
|
readonly: A,
|
|
220
220
|
input: i,
|
|
221
221
|
disabled: M,
|
|
222
|
-
warning:
|
|
222
|
+
warning: Je
|
|
223
223
|
}),
|
|
224
|
-
[t, s, i, a, n, e, A, c.errors, M,
|
|
225
|
-
),
|
|
224
|
+
[t, s, i, a, n, e, A, c.errors, M, Je]
|
|
225
|
+
), qt = ge(() => H ? /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
|
|
226
226
|
i.before ? i.before : null,
|
|
227
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ S.jsx(gr, { path: e, inputType: i.inputType, inputErrorHandler: v, children: O == null ? void 0 : O.renderComponent(He) }),
|
|
228
228
|
i.after ? i.after : null
|
|
229
|
-
] }) : null, [H, i.before, i.inputType, i.after, e,
|
|
230
|
-
return
|
|
229
|
+
] }) : null, [H, i.before, i.inputType, i.after, e, O, He, c.errors]);
|
|
230
|
+
return O ? /* @__PURE__ */ S.jsx(it, { withoutWrapper: o, children: qt }) : /* @__PURE__ */ S.jsx(it, { withoutWrapper: o, children: /* @__PURE__ */ S.jsxs("p", { children: [
|
|
231
231
|
"Input component not found (internal type: ",
|
|
232
232
|
i.inputType,
|
|
233
233
|
")"
|
|
234
234
|
] }) });
|
|
235
235
|
});
|
|
236
|
-
class
|
|
236
|
+
class yn {
|
|
237
237
|
getType() {
|
|
238
238
|
return this.internalType;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function ot() {
|
|
242
242
|
return typeof window < "u" && "requestIdleCallback" in window ? window.requestIdleCallback : function(r, e) {
|
|
243
243
|
const t = Date.now(), n = (e == null ? void 0 : e.timeout) || 1;
|
|
244
244
|
return setTimeout(function() {
|
|
@@ -251,10 +251,10 @@ function it() {
|
|
|
251
251
|
}, n);
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function ut() {
|
|
255
255
|
return typeof window < "u" && "cancelIdleCallback" in window ? window.cancelIdleCallback : clearTimeout;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function gn(r) {
|
|
258
258
|
const {
|
|
259
259
|
mode: e = "onSubmit",
|
|
260
260
|
resolver: t,
|
|
@@ -273,17 +273,17 @@ function mn(r) {
|
|
|
273
273
|
// fixedValues
|
|
274
274
|
autoFocusPath: y,
|
|
275
275
|
readonly: h
|
|
276
|
-
} = r, v =
|
|
276
|
+
} = r, v = ir({
|
|
277
277
|
mode: e,
|
|
278
278
|
reValidateMode: "onChange",
|
|
279
279
|
defaultValues: n,
|
|
280
280
|
shouldFocusError: a,
|
|
281
281
|
resolver: t
|
|
282
|
-
}),
|
|
282
|
+
}), O = G(!1), w = G(JSON.stringify(n ?? {}));
|
|
283
283
|
Y(() => {
|
|
284
284
|
w.current = JSON.stringify(n ?? {}), v.reset(n, {});
|
|
285
285
|
}, [v.reset, n]), Y(() => {
|
|
286
|
-
const A =
|
|
286
|
+
const A = ot(), M = ut(), j = A(() => {
|
|
287
287
|
v.reset({}, {
|
|
288
288
|
keepErrors: !0,
|
|
289
289
|
keepDirty: !0,
|
|
@@ -297,7 +297,7 @@ function mn(r) {
|
|
|
297
297
|
keepSubmitCount: !0
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
|
-
return () => M(
|
|
300
|
+
return () => M(j);
|
|
301
301
|
}, []);
|
|
302
302
|
const { handleSubmit: R } = v, T = G(s);
|
|
303
303
|
Y(() => {
|
|
@@ -310,8 +310,8 @@ function mn(r) {
|
|
|
310
310
|
const Z = G(!1);
|
|
311
311
|
Y(() => {
|
|
312
312
|
const A = v.watch((M) => {
|
|
313
|
-
var
|
|
314
|
-
Z.current || JSON.stringify(M ?? {}) !== w.current && ((
|
|
313
|
+
var j;
|
|
314
|
+
Z.current || JSON.stringify(M ?? {}) !== w.current && ((j = T.current) == null || j.call(T, { ...M }), O.current === !0 && (Z.current = !0, v.trigger().finally(() => {
|
|
315
315
|
Z.current = !1;
|
|
316
316
|
})));
|
|
317
317
|
});
|
|
@@ -329,21 +329,21 @@ function mn(r) {
|
|
|
329
329
|
(A = V.current) == null || A.call(V, { isValid: v.formState.isValid, isSubmitted: v.formState.isSubmitted });
|
|
330
330
|
}, [v.formState.isValid, v.formState.isSubmitted]), Y(() => {
|
|
331
331
|
if (y) {
|
|
332
|
-
const A =
|
|
332
|
+
const A = ot(), M = ut(), j = A(() => {
|
|
333
333
|
v.setFocus(y);
|
|
334
334
|
});
|
|
335
|
-
return () => M(
|
|
335
|
+
return () => M(j);
|
|
336
336
|
}
|
|
337
|
-
}, [v, y]), /* @__PURE__ */
|
|
337
|
+
}, [v, y]), /* @__PURE__ */ S.jsx(pr, { metadata: c, readonly: h, inputErrorHandler: u, children: /* @__PURE__ */ S.jsx(or, { ...v, children: typeof d == "function" ? d({
|
|
338
338
|
...v,
|
|
339
339
|
submitForm: async () => {
|
|
340
|
-
o && (
|
|
340
|
+
o && (O.current = !0, R((A) => {
|
|
341
341
|
o(A);
|
|
342
342
|
})());
|
|
343
343
|
}
|
|
344
344
|
}) : d }) });
|
|
345
345
|
}
|
|
346
|
-
const
|
|
346
|
+
const _n = (r) => {
|
|
347
347
|
const e = {}, t = (n) => {
|
|
348
348
|
n.forEach((a) => {
|
|
349
349
|
const { path: s, default: i, inputs: o } = a;
|
|
@@ -352,21 +352,21 @@ const pn = (r) => {
|
|
|
352
352
|
};
|
|
353
353
|
return Array.isArray(r.inputs) && t(r.inputs), e;
|
|
354
354
|
};
|
|
355
|
-
function
|
|
355
|
+
function vn(r, e) {
|
|
356
356
|
const t = r.inputs.map((n) => {
|
|
357
|
-
const a =
|
|
357
|
+
const a = vr(e, n.path);
|
|
358
358
|
return a || n;
|
|
359
359
|
});
|
|
360
360
|
return { ...r, inputs: t };
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function vr(r, e) {
|
|
363
363
|
return r.inputs.find((t) => t.path === e);
|
|
364
364
|
}
|
|
365
|
-
const
|
|
366
|
-
function
|
|
365
|
+
const jt = "__temp_", xn = (r) => jt + r.split(".").join("__");
|
|
366
|
+
function xr(r) {
|
|
367
367
|
const e = { ...r };
|
|
368
|
-
return
|
|
369
|
-
n.startsWith(
|
|
368
|
+
return St(e, (t, n) => {
|
|
369
|
+
n.startsWith(jt) && delete e[n];
|
|
370
370
|
}), e;
|
|
371
371
|
}
|
|
372
372
|
var k;
|
|
@@ -406,14 +406,14 @@ var k;
|
|
|
406
406
|
}
|
|
407
407
|
r.joinValues = n, r.jsonStringifyReplacer = (a, s) => typeof s == "bigint" ? s.toString() : s;
|
|
408
408
|
})(k || (k = {}));
|
|
409
|
-
var
|
|
409
|
+
var ct;
|
|
410
410
|
(function(r) {
|
|
411
411
|
r.mergeShapes = (e, t) => ({
|
|
412
412
|
...e,
|
|
413
413
|
...t
|
|
414
414
|
// second overwrites first
|
|
415
415
|
});
|
|
416
|
-
})(
|
|
416
|
+
})(ct || (ct = {}));
|
|
417
417
|
const m = k.arrayToEnum([
|
|
418
418
|
"string",
|
|
419
419
|
"nan",
|
|
@@ -538,7 +538,7 @@ class F extends Error {
|
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
F.create = (r) => new F(r);
|
|
541
|
-
const
|
|
541
|
+
const Ne = (r, e) => {
|
|
542
542
|
let t;
|
|
543
543
|
switch (r.code) {
|
|
544
544
|
case l.invalid_type:
|
|
@@ -594,11 +594,11 @@ const Ie = (r, e) => {
|
|
|
594
594
|
}
|
|
595
595
|
return { message: t };
|
|
596
596
|
};
|
|
597
|
-
let
|
|
598
|
-
function
|
|
599
|
-
return
|
|
597
|
+
let br = Ne;
|
|
598
|
+
function kr() {
|
|
599
|
+
return br;
|
|
600
600
|
}
|
|
601
|
-
const
|
|
601
|
+
const wr = (r) => {
|
|
602
602
|
const { data: e, path: t, errorMaps: n, issueData: a } = r, s = [...t, ...a.path || []], i = {
|
|
603
603
|
...a,
|
|
604
604
|
path: s
|
|
@@ -620,7 +620,7 @@ const xr = (r) => {
|
|
|
620
620
|
};
|
|
621
621
|
};
|
|
622
622
|
function f(r, e) {
|
|
623
|
-
const t =
|
|
623
|
+
const t = kr(), n = wr({
|
|
624
624
|
issueData: e,
|
|
625
625
|
data: r.data,
|
|
626
626
|
path: r.path,
|
|
@@ -631,13 +631,13 @@ function f(r, e) {
|
|
|
631
631
|
// then schema-bound map if available
|
|
632
632
|
t,
|
|
633
633
|
// then global override map
|
|
634
|
-
t ===
|
|
634
|
+
t === Ne ? void 0 : Ne
|
|
635
635
|
// then global default map
|
|
636
636
|
].filter((a) => !!a)
|
|
637
637
|
});
|
|
638
638
|
r.common.issues.push(n);
|
|
639
639
|
}
|
|
640
|
-
class
|
|
640
|
+
class I {
|
|
641
641
|
constructor() {
|
|
642
642
|
this.value = "valid";
|
|
643
643
|
}
|
|
@@ -665,7 +665,7 @@ class j {
|
|
|
665
665
|
value: i
|
|
666
666
|
});
|
|
667
667
|
}
|
|
668
|
-
return
|
|
668
|
+
return I.mergeObjectSync(e, n);
|
|
669
669
|
}
|
|
670
670
|
static mergeObjectSync(e, t) {
|
|
671
671
|
const n = {};
|
|
@@ -680,7 +680,7 @@ class j {
|
|
|
680
680
|
}
|
|
681
681
|
const g = Object.freeze({
|
|
682
682
|
status: "aborted"
|
|
683
|
-
}), ue = (r) => ({ status: "dirty", value: r }), N = (r) => ({ status: "valid", value: r }),
|
|
683
|
+
}), ue = (r) => ({ status: "dirty", value: r }), N = (r) => ({ status: "valid", value: r }), dt = (r) => r.status === "aborted", lt = (r) => r.status === "dirty", ne = (r) => r.status === "valid", xe = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
684
684
|
var p;
|
|
685
685
|
(function(r) {
|
|
686
686
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
@@ -693,8 +693,8 @@ class U {
|
|
|
693
693
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
|
-
const
|
|
697
|
-
if (
|
|
696
|
+
const ft = (r, e) => {
|
|
697
|
+
if (ne(e))
|
|
698
698
|
return { success: !0, data: e.value };
|
|
699
699
|
if (!r.common.issues.length)
|
|
700
700
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -738,7 +738,7 @@ class b {
|
|
|
738
738
|
}
|
|
739
739
|
_processInputParams(e) {
|
|
740
740
|
return {
|
|
741
|
-
status: new
|
|
741
|
+
status: new I(),
|
|
742
742
|
ctx: {
|
|
743
743
|
common: e.parent.common,
|
|
744
744
|
data: e.data,
|
|
@@ -778,7 +778,7 @@ class b {
|
|
|
778
778
|
data: e,
|
|
779
779
|
parsedType: L(e)
|
|
780
780
|
}, a = this._parseSync({ data: e, path: n.path, parent: n });
|
|
781
|
-
return
|
|
781
|
+
return ft(n, a);
|
|
782
782
|
}
|
|
783
783
|
"~validate"(e) {
|
|
784
784
|
var n, a;
|
|
@@ -796,7 +796,7 @@ class b {
|
|
|
796
796
|
if (!this["~standard"].async)
|
|
797
797
|
try {
|
|
798
798
|
const s = this._parseSync({ data: e, path: [], parent: t });
|
|
799
|
-
return
|
|
799
|
+
return ne(s) ? {
|
|
800
800
|
value: s.value
|
|
801
801
|
} : {
|
|
802
802
|
issues: t.common.issues
|
|
@@ -807,7 +807,7 @@ class b {
|
|
|
807
807
|
async: !0
|
|
808
808
|
};
|
|
809
809
|
}
|
|
810
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((s) =>
|
|
810
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((s) => ne(s) ? {
|
|
811
811
|
value: s.value
|
|
812
812
|
} : {
|
|
813
813
|
issues: t.common.issues
|
|
@@ -832,7 +832,7 @@ class b {
|
|
|
832
832
|
data: e,
|
|
833
833
|
parsedType: L(e)
|
|
834
834
|
}, a = this._parse({ data: e, path: n.path, parent: n }), s = await (xe(a) ? a : Promise.resolve(a));
|
|
835
|
-
return
|
|
835
|
+
return ft(n, s);
|
|
836
836
|
}
|
|
837
837
|
refine(e, t) {
|
|
838
838
|
const n = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
|
|
@@ -848,7 +848,7 @@ class b {
|
|
|
848
848
|
return this._refinement((n, a) => e(n) ? !0 : (a.addIssue(typeof t == "function" ? t(n, a) : t), !1));
|
|
849
849
|
}
|
|
850
850
|
_refinement(e) {
|
|
851
|
-
return new
|
|
851
|
+
return new K({
|
|
852
852
|
schema: this,
|
|
853
853
|
typeName: _.ZodEffects,
|
|
854
854
|
effect: { type: "refinement", refinement: e }
|
|
@@ -886,7 +886,7 @@ class b {
|
|
|
886
886
|
return we.create(this, e, this._def);
|
|
887
887
|
}
|
|
888
888
|
transform(e) {
|
|
889
|
-
return new
|
|
889
|
+
return new K({
|
|
890
890
|
...x(this._def),
|
|
891
891
|
schema: this,
|
|
892
892
|
typeName: _.ZodEffects,
|
|
@@ -895,7 +895,7 @@ class b {
|
|
|
895
895
|
}
|
|
896
896
|
default(e) {
|
|
897
897
|
const t = typeof e == "function" ? e : () => e;
|
|
898
|
-
return new
|
|
898
|
+
return new Pe({
|
|
899
899
|
...x(this._def),
|
|
900
900
|
innerType: this,
|
|
901
901
|
defaultValue: t,
|
|
@@ -903,7 +903,7 @@ class b {
|
|
|
903
903
|
});
|
|
904
904
|
}
|
|
905
905
|
brand() {
|
|
906
|
-
return new
|
|
906
|
+
return new Wr({
|
|
907
907
|
typeName: _.ZodBranded,
|
|
908
908
|
type: this,
|
|
909
909
|
...x(this._def)
|
|
@@ -911,7 +911,7 @@ class b {
|
|
|
911
911
|
}
|
|
912
912
|
catch(e) {
|
|
913
913
|
const t = typeof e == "function" ? e : () => e;
|
|
914
|
-
return new
|
|
914
|
+
return new $e({
|
|
915
915
|
...x(this._def),
|
|
916
916
|
innerType: this,
|
|
917
917
|
catchValue: t,
|
|
@@ -926,10 +926,10 @@ class b {
|
|
|
926
926
|
});
|
|
927
927
|
}
|
|
928
928
|
pipe(e) {
|
|
929
|
-
return
|
|
929
|
+
return Le.create(this, e);
|
|
930
930
|
}
|
|
931
931
|
readonly() {
|
|
932
|
-
return
|
|
932
|
+
return Me.create(this);
|
|
933
933
|
}
|
|
934
934
|
isOptional() {
|
|
935
935
|
return this.safeParse(void 0).success;
|
|
@@ -938,28 +938,28 @@ class b {
|
|
|
938
938
|
return this.safeParse(null).success;
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
|
-
const
|
|
941
|
+
const Tr = /^c[^\s-]{8,}$/i, Cr = /^[0-9a-z]+$/, Sr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Or = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Rr = /^[a-z0-9_-]{21}$/i, Er = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ar = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ir = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, jr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
942
942
|
let Ee;
|
|
943
|
-
const
|
|
944
|
-
function
|
|
943
|
+
const Nr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Vr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Zr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pr = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, $r = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Mr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Nt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Fr = new RegExp(`^${Nt}$`);
|
|
944
|
+
function Vt(r) {
|
|
945
945
|
let e = "[0-5]\\d";
|
|
946
946
|
r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
947
947
|
const t = r.precision ? "+" : "?";
|
|
948
948
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
949
949
|
}
|
|
950
|
-
function
|
|
951
|
-
return new RegExp(`^${
|
|
950
|
+
function Dr(r) {
|
|
951
|
+
return new RegExp(`^${Vt(r)}$`);
|
|
952
952
|
}
|
|
953
|
-
function
|
|
954
|
-
let e = `${
|
|
953
|
+
function Lr(r) {
|
|
954
|
+
let e = `${Nt}T${Vt(r)}`;
|
|
955
955
|
const t = [];
|
|
956
956
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
957
957
|
}
|
|
958
|
-
function
|
|
959
|
-
return !!((e === "v4" || !e) &&
|
|
958
|
+
function qr(r, e) {
|
|
959
|
+
return !!((e === "v4" || !e) && Nr.test(r) || (e === "v6" || !e) && Zr.test(r));
|
|
960
960
|
}
|
|
961
|
-
function
|
|
962
|
-
if (!
|
|
961
|
+
function zr(r, e) {
|
|
962
|
+
if (!Er.test(r))
|
|
963
963
|
return !1;
|
|
964
964
|
try {
|
|
965
965
|
const [t] = r.split(".");
|
|
@@ -971,8 +971,8 @@ function Dr(r, e) {
|
|
|
971
971
|
return !1;
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
|
-
function
|
|
975
|
-
return !!((e === "v4" || !e) &&
|
|
974
|
+
function Br(r, e) {
|
|
975
|
+
return !!((e === "v4" || !e) && Vr.test(r) || (e === "v6" || !e) && Pr.test(r));
|
|
976
976
|
}
|
|
977
977
|
class q extends b {
|
|
978
978
|
_parse(e) {
|
|
@@ -984,7 +984,7 @@ class q extends b {
|
|
|
984
984
|
received: s.parsedType
|
|
985
985
|
}), g;
|
|
986
986
|
}
|
|
987
|
-
const n = new
|
|
987
|
+
const n = new I();
|
|
988
988
|
let a;
|
|
989
989
|
for (const s of this._def.checks)
|
|
990
990
|
if (s.kind === "min")
|
|
@@ -1023,43 +1023,43 @@ class q extends b {
|
|
|
1023
1023
|
message: s.message
|
|
1024
1024
|
}), n.dirty());
|
|
1025
1025
|
} else if (s.kind === "email")
|
|
1026
|
-
|
|
1026
|
+
Ir.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1027
1027
|
validation: "email",
|
|
1028
1028
|
code: l.invalid_string,
|
|
1029
1029
|
message: s.message
|
|
1030
1030
|
}), n.dirty());
|
|
1031
1031
|
else if (s.kind === "emoji")
|
|
1032
|
-
Ee || (Ee = new RegExp(
|
|
1032
|
+
Ee || (Ee = new RegExp(jr, "u")), Ee.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1033
1033
|
validation: "emoji",
|
|
1034
1034
|
code: l.invalid_string,
|
|
1035
1035
|
message: s.message
|
|
1036
1036
|
}), n.dirty());
|
|
1037
1037
|
else if (s.kind === "uuid")
|
|
1038
|
-
|
|
1038
|
+
Or.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1039
1039
|
validation: "uuid",
|
|
1040
1040
|
code: l.invalid_string,
|
|
1041
1041
|
message: s.message
|
|
1042
1042
|
}), n.dirty());
|
|
1043
1043
|
else if (s.kind === "nanoid")
|
|
1044
|
-
|
|
1044
|
+
Rr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1045
1045
|
validation: "nanoid",
|
|
1046
1046
|
code: l.invalid_string,
|
|
1047
1047
|
message: s.message
|
|
1048
1048
|
}), n.dirty());
|
|
1049
1049
|
else if (s.kind === "cuid")
|
|
1050
|
-
|
|
1050
|
+
Tr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1051
1051
|
validation: "cuid",
|
|
1052
1052
|
code: l.invalid_string,
|
|
1053
1053
|
message: s.message
|
|
1054
1054
|
}), n.dirty());
|
|
1055
1055
|
else if (s.kind === "cuid2")
|
|
1056
|
-
|
|
1056
|
+
Cr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1057
1057
|
validation: "cuid2",
|
|
1058
1058
|
code: l.invalid_string,
|
|
1059
1059
|
message: s.message
|
|
1060
1060
|
}), n.dirty());
|
|
1061
1061
|
else if (s.kind === "ulid")
|
|
1062
|
-
|
|
1062
|
+
Sr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1063
1063
|
validation: "ulid",
|
|
1064
1064
|
code: l.invalid_string,
|
|
1065
1065
|
message: s.message
|
|
@@ -1090,39 +1090,39 @@ class q extends b {
|
|
|
1090
1090
|
code: l.invalid_string,
|
|
1091
1091
|
validation: { endsWith: s.value },
|
|
1092
1092
|
message: s.message
|
|
1093
|
-
}), n.dirty()) : s.kind === "datetime" ?
|
|
1093
|
+
}), n.dirty()) : s.kind === "datetime" ? Lr(s).test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1094
1094
|
code: l.invalid_string,
|
|
1095
1095
|
validation: "datetime",
|
|
1096
1096
|
message: s.message
|
|
1097
|
-
}), n.dirty()) : s.kind === "date" ?
|
|
1097
|
+
}), n.dirty()) : s.kind === "date" ? Fr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1098
1098
|
code: l.invalid_string,
|
|
1099
1099
|
validation: "date",
|
|
1100
1100
|
message: s.message
|
|
1101
|
-
}), n.dirty()) : s.kind === "time" ?
|
|
1101
|
+
}), n.dirty()) : s.kind === "time" ? Dr(s).test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1102
1102
|
code: l.invalid_string,
|
|
1103
1103
|
validation: "time",
|
|
1104
1104
|
message: s.message
|
|
1105
|
-
}), n.dirty()) : s.kind === "duration" ?
|
|
1105
|
+
}), n.dirty()) : s.kind === "duration" ? Ar.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1106
1106
|
validation: "duration",
|
|
1107
1107
|
code: l.invalid_string,
|
|
1108
1108
|
message: s.message
|
|
1109
|
-
}), n.dirty()) : s.kind === "ip" ?
|
|
1109
|
+
}), n.dirty()) : s.kind === "ip" ? qr(e.data, s.version) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1110
1110
|
validation: "ip",
|
|
1111
1111
|
code: l.invalid_string,
|
|
1112
1112
|
message: s.message
|
|
1113
|
-
}), n.dirty()) : s.kind === "jwt" ?
|
|
1113
|
+
}), n.dirty()) : s.kind === "jwt" ? zr(e.data, s.alg) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1114
1114
|
validation: "jwt",
|
|
1115
1115
|
code: l.invalid_string,
|
|
1116
1116
|
message: s.message
|
|
1117
|
-
}), n.dirty()) : s.kind === "cidr" ?
|
|
1117
|
+
}), n.dirty()) : s.kind === "cidr" ? Br(e.data, s.version) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1118
1118
|
validation: "cidr",
|
|
1119
1119
|
code: l.invalid_string,
|
|
1120
1120
|
message: s.message
|
|
1121
|
-
}), n.dirty()) : s.kind === "base64" ?
|
|
1121
|
+
}), n.dirty()) : s.kind === "base64" ? $r.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1122
1122
|
validation: "base64",
|
|
1123
1123
|
code: l.invalid_string,
|
|
1124
1124
|
message: s.message
|
|
1125
|
-
}), n.dirty()) : s.kind === "base64url" ?
|
|
1125
|
+
}), n.dirty()) : s.kind === "base64url" ? Mr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
|
|
1126
1126
|
validation: "base64url",
|
|
1127
1127
|
code: l.invalid_string,
|
|
1128
1128
|
message: s.message
|
|
@@ -1357,11 +1357,11 @@ q.create = (r) => new q({
|
|
|
1357
1357
|
coerce: (r == null ? void 0 : r.coerce) ?? !1,
|
|
1358
1358
|
...x(r)
|
|
1359
1359
|
});
|
|
1360
|
-
function
|
|
1360
|
+
function Ur(r, e) {
|
|
1361
1361
|
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, a = t > n ? t : n, s = Number.parseInt(r.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
|
|
1362
1362
|
return s % i / 10 ** a;
|
|
1363
1363
|
}
|
|
1364
|
-
class
|
|
1364
|
+
class le extends b {
|
|
1365
1365
|
constructor() {
|
|
1366
1366
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1367
1367
|
}
|
|
@@ -1375,7 +1375,7 @@ class fe extends b {
|
|
|
1375
1375
|
}), g;
|
|
1376
1376
|
}
|
|
1377
1377
|
let n;
|
|
1378
|
-
const a = new
|
|
1378
|
+
const a = new I();
|
|
1379
1379
|
for (const s of this._def.checks)
|
|
1380
1380
|
s.kind === "int" ? k.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1381
1381
|
code: l.invalid_type,
|
|
@@ -1396,7 +1396,7 @@ class fe extends b {
|
|
|
1396
1396
|
inclusive: s.inclusive,
|
|
1397
1397
|
exact: !1,
|
|
1398
1398
|
message: s.message
|
|
1399
|
-
}), a.dirty()) : s.kind === "multipleOf" ?
|
|
1399
|
+
}), a.dirty()) : s.kind === "multipleOf" ? Ur(e.data, s.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1400
1400
|
code: l.not_multiple_of,
|
|
1401
1401
|
multipleOf: s.value,
|
|
1402
1402
|
message: s.message
|
|
@@ -1419,7 +1419,7 @@ class fe extends b {
|
|
|
1419
1419
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1420
1420
|
}
|
|
1421
1421
|
setLimit(e, t, n, a) {
|
|
1422
|
-
return new
|
|
1422
|
+
return new le({
|
|
1423
1423
|
...this._def,
|
|
1424
1424
|
checks: [
|
|
1425
1425
|
...this._def.checks,
|
|
@@ -1433,7 +1433,7 @@ class fe extends b {
|
|
|
1433
1433
|
});
|
|
1434
1434
|
}
|
|
1435
1435
|
_addCheck(e) {
|
|
1436
|
-
return new
|
|
1436
|
+
return new le({
|
|
1437
1437
|
...this._def,
|
|
1438
1438
|
checks: [...this._def.checks, e]
|
|
1439
1439
|
});
|
|
@@ -1527,13 +1527,13 @@ class fe extends b {
|
|
|
1527
1527
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1528
1528
|
}
|
|
1529
1529
|
}
|
|
1530
|
-
|
|
1530
|
+
le.create = (r) => new le({
|
|
1531
1531
|
checks: [],
|
|
1532
1532
|
typeName: _.ZodNumber,
|
|
1533
1533
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1534
1534
|
...x(r)
|
|
1535
1535
|
});
|
|
1536
|
-
class
|
|
1536
|
+
class fe extends b {
|
|
1537
1537
|
constructor() {
|
|
1538
1538
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1539
1539
|
}
|
|
@@ -1547,7 +1547,7 @@ class he extends b {
|
|
|
1547
1547
|
if (this._getType(e) !== m.bigint)
|
|
1548
1548
|
return this._getInvalidInput(e);
|
|
1549
1549
|
let n;
|
|
1550
|
-
const a = new
|
|
1550
|
+
const a = new I();
|
|
1551
1551
|
for (const s of this._def.checks)
|
|
1552
1552
|
s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), f(n, {
|
|
1553
1553
|
code: l.too_small,
|
|
@@ -1589,7 +1589,7 @@ class he extends b {
|
|
|
1589
1589
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1590
1590
|
}
|
|
1591
1591
|
setLimit(e, t, n, a) {
|
|
1592
|
-
return new
|
|
1592
|
+
return new fe({
|
|
1593
1593
|
...this._def,
|
|
1594
1594
|
checks: [
|
|
1595
1595
|
...this._def.checks,
|
|
@@ -1603,7 +1603,7 @@ class he extends b {
|
|
|
1603
1603
|
});
|
|
1604
1604
|
}
|
|
1605
1605
|
_addCheck(e) {
|
|
1606
|
-
return new
|
|
1606
|
+
return new fe({
|
|
1607
1607
|
...this._def,
|
|
1608
1608
|
checks: [...this._def.checks, e]
|
|
1609
1609
|
});
|
|
@@ -1660,13 +1660,13 @@ class he extends b {
|
|
|
1660
1660
|
return e;
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
|
-
|
|
1663
|
+
fe.create = (r) => new fe({
|
|
1664
1664
|
checks: [],
|
|
1665
1665
|
typeName: _.ZodBigInt,
|
|
1666
1666
|
coerce: (r == null ? void 0 : r.coerce) ?? !1,
|
|
1667
1667
|
...x(r)
|
|
1668
1668
|
});
|
|
1669
|
-
class
|
|
1669
|
+
class ht extends b {
|
|
1670
1670
|
_parse(e) {
|
|
1671
1671
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
|
|
1672
1672
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1679,7 +1679,7 @@ class ft extends b {
|
|
|
1679
1679
|
return N(e.data);
|
|
1680
1680
|
}
|
|
1681
1681
|
}
|
|
1682
|
-
|
|
1682
|
+
ht.create = (r) => new ht({
|
|
1683
1683
|
typeName: _.ZodBoolean,
|
|
1684
1684
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1685
1685
|
...x(r)
|
|
@@ -1700,7 +1700,7 @@ class be extends b {
|
|
|
1700
1700
|
code: l.invalid_date
|
|
1701
1701
|
}), g;
|
|
1702
1702
|
}
|
|
1703
|
-
const n = new
|
|
1703
|
+
const n = new I();
|
|
1704
1704
|
let a;
|
|
1705
1705
|
for (const s of this._def.checks)
|
|
1706
1706
|
s.kind === "min" ? e.data.getTime() < s.value && (a = this._getOrReturnCtx(e, a), f(a, {
|
|
@@ -1762,7 +1762,7 @@ be.create = (r) => new be({
|
|
|
1762
1762
|
typeName: _.ZodDate,
|
|
1763
1763
|
...x(r)
|
|
1764
1764
|
});
|
|
1765
|
-
class
|
|
1765
|
+
class mt extends b {
|
|
1766
1766
|
_parse(e) {
|
|
1767
1767
|
if (this._getType(e) !== m.symbol) {
|
|
1768
1768
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1775,11 +1775,11 @@ class ht extends b {
|
|
|
1775
1775
|
return N(e.data);
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
|
-
|
|
1778
|
+
mt.create = (r) => new mt({
|
|
1779
1779
|
typeName: _.ZodSymbol,
|
|
1780
1780
|
...x(r)
|
|
1781
1781
|
});
|
|
1782
|
-
class
|
|
1782
|
+
class pt extends b {
|
|
1783
1783
|
_parse(e) {
|
|
1784
1784
|
if (this._getType(e) !== m.undefined) {
|
|
1785
1785
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1792,11 +1792,11 @@ class mt extends b {
|
|
|
1792
1792
|
return N(e.data);
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
|
-
|
|
1795
|
+
pt.create = (r) => new pt({
|
|
1796
1796
|
typeName: _.ZodUndefined,
|
|
1797
1797
|
...x(r)
|
|
1798
1798
|
});
|
|
1799
|
-
class
|
|
1799
|
+
class yt extends b {
|
|
1800
1800
|
_parse(e) {
|
|
1801
1801
|
if (this._getType(e) !== m.null) {
|
|
1802
1802
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1809,11 +1809,11 @@ class pt extends b {
|
|
|
1809
1809
|
return N(e.data);
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
|
-
|
|
1812
|
+
yt.create = (r) => new yt({
|
|
1813
1813
|
typeName: _.ZodNull,
|
|
1814
1814
|
...x(r)
|
|
1815
1815
|
});
|
|
1816
|
-
class
|
|
1816
|
+
class Ve extends b {
|
|
1817
1817
|
constructor() {
|
|
1818
1818
|
super(...arguments), this._any = !0;
|
|
1819
1819
|
}
|
|
@@ -1821,11 +1821,11 @@ class Ne extends b {
|
|
|
1821
1821
|
return N(e.data);
|
|
1822
1822
|
}
|
|
1823
1823
|
}
|
|
1824
|
-
|
|
1824
|
+
Ve.create = (r) => new Ve({
|
|
1825
1825
|
typeName: _.ZodAny,
|
|
1826
1826
|
...x(r)
|
|
1827
1827
|
});
|
|
1828
|
-
class
|
|
1828
|
+
class gt extends b {
|
|
1829
1829
|
constructor() {
|
|
1830
1830
|
super(...arguments), this._unknown = !0;
|
|
1831
1831
|
}
|
|
@@ -1833,7 +1833,7 @@ class yt extends b {
|
|
|
1833
1833
|
return N(e.data);
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
|
|
1836
|
+
gt.create = (r) => new gt({
|
|
1837
1837
|
typeName: _.ZodUnknown,
|
|
1838
1838
|
...x(r)
|
|
1839
1839
|
});
|
|
@@ -1851,7 +1851,7 @@ W.create = (r) => new W({
|
|
|
1851
1851
|
typeName: _.ZodNever,
|
|
1852
1852
|
...x(r)
|
|
1853
1853
|
});
|
|
1854
|
-
class
|
|
1854
|
+
class _t extends b {
|
|
1855
1855
|
_parse(e) {
|
|
1856
1856
|
if (this._getType(e) !== m.undefined) {
|
|
1857
1857
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1864,7 +1864,7 @@ class gt extends b {
|
|
|
1864
1864
|
return N(e.data);
|
|
1865
1865
|
}
|
|
1866
1866
|
}
|
|
1867
|
-
|
|
1867
|
+
_t.create = (r) => new _t({
|
|
1868
1868
|
typeName: _.ZodVoid,
|
|
1869
1869
|
...x(r)
|
|
1870
1870
|
});
|
|
@@ -1904,9 +1904,9 @@ class $ extends b {
|
|
|
1904
1904
|
exact: !1,
|
|
1905
1905
|
message: a.maxLength.message
|
|
1906
1906
|
}), n.dirty()), t.common.async)
|
|
1907
|
-
return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new U(t, i, t.path, o)))).then((i) =>
|
|
1907
|
+
return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new U(t, i, t.path, o)))).then((i) => I.mergeArray(n, i));
|
|
1908
1908
|
const s = [...t.data].map((i, o) => a.type._parseSync(new U(t, i, t.path, o)));
|
|
1909
|
-
return
|
|
1909
|
+
return I.mergeArray(n, s);
|
|
1910
1910
|
}
|
|
1911
1911
|
get element() {
|
|
1912
1912
|
return this._def.type;
|
|
@@ -1941,12 +1941,12 @@ $.create = (r, e) => new $({
|
|
|
1941
1941
|
typeName: _.ZodArray,
|
|
1942
1942
|
...x(e)
|
|
1943
1943
|
});
|
|
1944
|
-
function
|
|
1944
|
+
function re(r) {
|
|
1945
1945
|
if (r instanceof C) {
|
|
1946
1946
|
const e = {};
|
|
1947
1947
|
for (const t in r.shape) {
|
|
1948
1948
|
const n = r.shape[t];
|
|
1949
|
-
e[t] = z.create(
|
|
1949
|
+
e[t] = z.create(re(n));
|
|
1950
1950
|
}
|
|
1951
1951
|
return new C({
|
|
1952
1952
|
...r._def,
|
|
@@ -1954,8 +1954,8 @@ function te(r) {
|
|
|
1954
1954
|
});
|
|
1955
1955
|
} else return r instanceof $ ? new $({
|
|
1956
1956
|
...r._def,
|
|
1957
|
-
type:
|
|
1958
|
-
}) : r instanceof z ? z.create(
|
|
1957
|
+
type: re(r.element)
|
|
1958
|
+
}) : r instanceof z ? z.create(re(r.unwrap())) : r instanceof ae ? ae.create(re(r.unwrap())) : r instanceof X ? X.create(r.items.map((e) => re(e))) : r;
|
|
1959
1959
|
}
|
|
1960
1960
|
class C extends b {
|
|
1961
1961
|
constructor() {
|
|
@@ -2028,7 +2028,7 @@ class C extends b {
|
|
|
2028
2028
|
});
|
|
2029
2029
|
}
|
|
2030
2030
|
return c;
|
|
2031
|
-
}).then((c) =>
|
|
2031
|
+
}).then((c) => I.mergeObjectSync(n, c)) : I.mergeObjectSync(n, u);
|
|
2032
2032
|
}
|
|
2033
2033
|
get shape() {
|
|
2034
2034
|
return this._def.shape();
|
|
@@ -2191,7 +2191,7 @@ class C extends b {
|
|
|
2191
2191
|
* @deprecated
|
|
2192
2192
|
*/
|
|
2193
2193
|
deepPartial() {
|
|
2194
|
-
return
|
|
2194
|
+
return re(this);
|
|
2195
2195
|
}
|
|
2196
2196
|
partial(e) {
|
|
2197
2197
|
const t = {};
|
|
@@ -2221,7 +2221,7 @@ class C extends b {
|
|
|
2221
2221
|
});
|
|
2222
2222
|
}
|
|
2223
2223
|
keyof() {
|
|
2224
|
-
return
|
|
2224
|
+
return Zt(k.objectKeys(this.shape));
|
|
2225
2225
|
}
|
|
2226
2226
|
}
|
|
2227
2227
|
C.create = (r, e) => new C({
|
|
@@ -2318,14 +2318,14 @@ ke.create = (r, e) => new ke({
|
|
|
2318
2318
|
typeName: _.ZodUnion,
|
|
2319
2319
|
...x(e)
|
|
2320
2320
|
});
|
|
2321
|
-
function
|
|
2321
|
+
function Ze(r, e) {
|
|
2322
2322
|
const t = L(r), n = L(e);
|
|
2323
2323
|
if (r === e)
|
|
2324
2324
|
return { valid: !0, data: r };
|
|
2325
2325
|
if (t === m.object && n === m.object) {
|
|
2326
2326
|
const a = k.objectKeys(e), s = k.objectKeys(r).filter((o) => a.indexOf(o) !== -1), i = { ...r, ...e };
|
|
2327
2327
|
for (const o of s) {
|
|
2328
|
-
const u =
|
|
2328
|
+
const u = Ze(r[o], e[o]);
|
|
2329
2329
|
if (!u.valid)
|
|
2330
2330
|
return { valid: !1 };
|
|
2331
2331
|
i[o] = u.data;
|
|
@@ -2336,7 +2336,7 @@ function Ve(r, e) {
|
|
|
2336
2336
|
return { valid: !1 };
|
|
2337
2337
|
const a = [];
|
|
2338
2338
|
for (let s = 0; s < r.length; s++) {
|
|
2339
|
-
const i = r[s], o = e[s], u =
|
|
2339
|
+
const i = r[s], o = e[s], u = Ze(i, o);
|
|
2340
2340
|
if (!u.valid)
|
|
2341
2341
|
return { valid: !1 };
|
|
2342
2342
|
a.push(u.data);
|
|
@@ -2347,10 +2347,10 @@ function Ve(r, e) {
|
|
|
2347
2347
|
class we extends b {
|
|
2348
2348
|
_parse(e) {
|
|
2349
2349
|
const { status: t, ctx: n } = this._processInputParams(e), a = (s, i) => {
|
|
2350
|
-
if (
|
|
2350
|
+
if (dt(s) || dt(i))
|
|
2351
2351
|
return g;
|
|
2352
|
-
const o =
|
|
2353
|
-
return o.valid ? ((
|
|
2352
|
+
const o = Ze(s.value, i.value);
|
|
2353
|
+
return o.valid ? ((lt(s) || lt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(n, {
|
|
2354
2354
|
code: l.invalid_intersection_types
|
|
2355
2355
|
}), g);
|
|
2356
2356
|
};
|
|
@@ -2410,7 +2410,7 @@ class X extends b {
|
|
|
2410
2410
|
const u = this._def.items[o] || this._def.rest;
|
|
2411
2411
|
return u ? u._parse(new U(n, i, n.path, o)) : null;
|
|
2412
2412
|
}).filter((i) => !!i);
|
|
2413
|
-
return n.common.async ? Promise.all(s).then((i) =>
|
|
2413
|
+
return n.common.async ? Promise.all(s).then((i) => I.mergeArray(t, i)) : I.mergeArray(t, s);
|
|
2414
2414
|
}
|
|
2415
2415
|
get items() {
|
|
2416
2416
|
return this._def.items;
|
|
@@ -2432,7 +2432,7 @@ X.create = (r, e) => {
|
|
|
2432
2432
|
...x(e)
|
|
2433
2433
|
});
|
|
2434
2434
|
};
|
|
2435
|
-
class
|
|
2435
|
+
class vt extends b {
|
|
2436
2436
|
get keySchema() {
|
|
2437
2437
|
return this._def.keyType;
|
|
2438
2438
|
}
|
|
@@ -2474,13 +2474,13 @@ class _t extends b {
|
|
|
2474
2474
|
}
|
|
2475
2475
|
}
|
|
2476
2476
|
}
|
|
2477
|
-
|
|
2477
|
+
vt.create = (r, e, t) => new vt({
|
|
2478
2478
|
valueType: e,
|
|
2479
2479
|
keyType: r,
|
|
2480
2480
|
typeName: _.ZodMap,
|
|
2481
2481
|
...x(t)
|
|
2482
2482
|
});
|
|
2483
|
-
class
|
|
2483
|
+
class he extends b {
|
|
2484
2484
|
_parse(e) {
|
|
2485
2485
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2486
2486
|
if (n.parsedType !== m.set)
|
|
@@ -2519,13 +2519,13 @@ class me extends b {
|
|
|
2519
2519
|
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2520
2520
|
}
|
|
2521
2521
|
min(e, t) {
|
|
2522
|
-
return new
|
|
2522
|
+
return new he({
|
|
2523
2523
|
...this._def,
|
|
2524
2524
|
minSize: { value: e, message: p.toString(t) }
|
|
2525
2525
|
});
|
|
2526
2526
|
}
|
|
2527
2527
|
max(e, t) {
|
|
2528
|
-
return new
|
|
2528
|
+
return new he({
|
|
2529
2529
|
...this._def,
|
|
2530
2530
|
maxSize: { value: e, message: p.toString(t) }
|
|
2531
2531
|
});
|
|
@@ -2537,14 +2537,14 @@ class me extends b {
|
|
|
2537
2537
|
return this.min(1, e);
|
|
2538
2538
|
}
|
|
2539
2539
|
}
|
|
2540
|
-
|
|
2540
|
+
he.create = (r, e) => new he({
|
|
2541
2541
|
valueType: r,
|
|
2542
2542
|
minSize: null,
|
|
2543
2543
|
maxSize: null,
|
|
2544
2544
|
typeName: _.ZodSet,
|
|
2545
2545
|
...x(e)
|
|
2546
2546
|
});
|
|
2547
|
-
class
|
|
2547
|
+
class xt extends b {
|
|
2548
2548
|
get schema() {
|
|
2549
2549
|
return this._def.getter();
|
|
2550
2550
|
}
|
|
@@ -2553,12 +2553,12 @@ class vt extends b {
|
|
|
2553
2553
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2554
2554
|
}
|
|
2555
2555
|
}
|
|
2556
|
-
|
|
2556
|
+
xt.create = (r, e) => new xt({
|
|
2557
2557
|
getter: r,
|
|
2558
2558
|
typeName: _.ZodLazy,
|
|
2559
2559
|
...x(e)
|
|
2560
2560
|
});
|
|
2561
|
-
class
|
|
2561
|
+
class bt extends b {
|
|
2562
2562
|
_parse(e) {
|
|
2563
2563
|
if (e.data !== this._def.value) {
|
|
2564
2564
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2574,19 +2574,19 @@ class xt extends b {
|
|
|
2574
2574
|
return this._def.value;
|
|
2575
2575
|
}
|
|
2576
2576
|
}
|
|
2577
|
-
|
|
2577
|
+
bt.create = (r, e) => new bt({
|
|
2578
2578
|
value: r,
|
|
2579
2579
|
typeName: _.ZodLiteral,
|
|
2580
2580
|
...x(e)
|
|
2581
2581
|
});
|
|
2582
|
-
function
|
|
2583
|
-
return new
|
|
2582
|
+
function Zt(r, e) {
|
|
2583
|
+
return new se({
|
|
2584
2584
|
values: r,
|
|
2585
2585
|
typeName: _.ZodEnum,
|
|
2586
2586
|
...x(e)
|
|
2587
2587
|
});
|
|
2588
2588
|
}
|
|
2589
|
-
class
|
|
2589
|
+
class se extends b {
|
|
2590
2590
|
_parse(e) {
|
|
2591
2591
|
if (typeof e.data != "string") {
|
|
2592
2592
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
@@ -2628,20 +2628,20 @@ class ne extends b {
|
|
|
2628
2628
|
return e;
|
|
2629
2629
|
}
|
|
2630
2630
|
extract(e, t = this._def) {
|
|
2631
|
-
return
|
|
2631
|
+
return se.create(e, {
|
|
2632
2632
|
...this._def,
|
|
2633
2633
|
...t
|
|
2634
2634
|
});
|
|
2635
2635
|
}
|
|
2636
2636
|
exclude(e, t = this._def) {
|
|
2637
|
-
return
|
|
2637
|
+
return se.create(this.options.filter((n) => !e.includes(n)), {
|
|
2638
2638
|
...this._def,
|
|
2639
2639
|
...t
|
|
2640
2640
|
});
|
|
2641
2641
|
}
|
|
2642
2642
|
}
|
|
2643
|
-
|
|
2644
|
-
class
|
|
2643
|
+
se.create = Zt;
|
|
2644
|
+
class kt extends b {
|
|
2645
2645
|
_parse(e) {
|
|
2646
2646
|
const t = k.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2647
2647
|
if (n.parsedType !== m.string && n.parsedType !== m.number) {
|
|
@@ -2666,7 +2666,7 @@ class bt extends b {
|
|
|
2666
2666
|
return this._def.values;
|
|
2667
2667
|
}
|
|
2668
2668
|
}
|
|
2669
|
-
|
|
2669
|
+
kt.create = (r, e) => new kt({
|
|
2670
2670
|
values: r,
|
|
2671
2671
|
typeName: _.ZodNativeEnum,
|
|
2672
2672
|
...x(e)
|
|
@@ -2695,7 +2695,7 @@ Te.create = (r, e) => new Te({
|
|
|
2695
2695
|
typeName: _.ZodPromise,
|
|
2696
2696
|
...x(e)
|
|
2697
2697
|
});
|
|
2698
|
-
class
|
|
2698
|
+
class K extends b {
|
|
2699
2699
|
innerType() {
|
|
2700
2700
|
return this._def.schema;
|
|
2701
2701
|
}
|
|
@@ -2761,27 +2761,27 @@ class se extends b {
|
|
|
2761
2761
|
path: n.path,
|
|
2762
2762
|
parent: n
|
|
2763
2763
|
});
|
|
2764
|
-
if (!
|
|
2764
|
+
if (!ne(i))
|
|
2765
2765
|
return g;
|
|
2766
2766
|
const o = a.transform(i.value, s);
|
|
2767
2767
|
if (o instanceof Promise)
|
|
2768
2768
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2769
2769
|
return { status: t.value, value: o };
|
|
2770
2770
|
} else
|
|
2771
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
2771
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => ne(i) ? Promise.resolve(a.transform(i.value, s)).then((o) => ({
|
|
2772
2772
|
status: t.value,
|
|
2773
2773
|
value: o
|
|
2774
2774
|
})) : g);
|
|
2775
2775
|
k.assertNever(a);
|
|
2776
2776
|
}
|
|
2777
2777
|
}
|
|
2778
|
-
|
|
2778
|
+
K.create = (r, e, t) => new K({
|
|
2779
2779
|
schema: r,
|
|
2780
2780
|
typeName: _.ZodEffects,
|
|
2781
2781
|
effect: e,
|
|
2782
2782
|
...x(t)
|
|
2783
2783
|
});
|
|
2784
|
-
|
|
2784
|
+
K.createWithPreprocess = (r, e, t) => new K({
|
|
2785
2785
|
schema: e,
|
|
2786
2786
|
effect: { type: "preprocess", transform: r },
|
|
2787
2787
|
typeName: _.ZodEffects,
|
|
@@ -2813,7 +2813,7 @@ ae.create = (r, e) => new ae({
|
|
|
2813
2813
|
typeName: _.ZodNullable,
|
|
2814
2814
|
...x(e)
|
|
2815
2815
|
});
|
|
2816
|
-
class
|
|
2816
|
+
class Pe extends b {
|
|
2817
2817
|
_parse(e) {
|
|
2818
2818
|
const { ctx: t } = this._processInputParams(e);
|
|
2819
2819
|
let n = t.data;
|
|
@@ -2827,13 +2827,13 @@ class Ze extends b {
|
|
|
2827
2827
|
return this._def.innerType;
|
|
2828
2828
|
}
|
|
2829
2829
|
}
|
|
2830
|
-
|
|
2830
|
+
Pe.create = (r, e) => new Pe({
|
|
2831
2831
|
innerType: r,
|
|
2832
2832
|
typeName: _.ZodDefault,
|
|
2833
2833
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2834
2834
|
...x(e)
|
|
2835
2835
|
});
|
|
2836
|
-
class
|
|
2836
|
+
class $e extends b {
|
|
2837
2837
|
_parse(e) {
|
|
2838
2838
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2839
2839
|
...t,
|
|
@@ -2870,13 +2870,13 @@ class Pe extends b {
|
|
|
2870
2870
|
return this._def.innerType;
|
|
2871
2871
|
}
|
|
2872
2872
|
}
|
|
2873
|
-
|
|
2873
|
+
$e.create = (r, e) => new $e({
|
|
2874
2874
|
innerType: r,
|
|
2875
2875
|
typeName: _.ZodCatch,
|
|
2876
2876
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2877
2877
|
...x(e)
|
|
2878
2878
|
});
|
|
2879
|
-
class
|
|
2879
|
+
class wt extends b {
|
|
2880
2880
|
_parse(e) {
|
|
2881
2881
|
if (this._getType(e) !== m.nan) {
|
|
2882
2882
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2889,11 +2889,11 @@ class kt extends b {
|
|
|
2889
2889
|
return { status: "valid", value: e.data };
|
|
2890
2890
|
}
|
|
2891
2891
|
}
|
|
2892
|
-
|
|
2892
|
+
wt.create = (r) => new wt({
|
|
2893
2893
|
typeName: _.ZodNaN,
|
|
2894
2894
|
...x(r)
|
|
2895
2895
|
});
|
|
2896
|
-
class
|
|
2896
|
+
class Wr extends b {
|
|
2897
2897
|
_parse(e) {
|
|
2898
2898
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2899
2899
|
return this._def.type._parse({
|
|
@@ -2906,7 +2906,7 @@ class zr extends b {
|
|
|
2906
2906
|
return this._def.type;
|
|
2907
2907
|
}
|
|
2908
2908
|
}
|
|
2909
|
-
class
|
|
2909
|
+
class Le extends b {
|
|
2910
2910
|
_parse(e) {
|
|
2911
2911
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2912
2912
|
if (n.common.async)
|
|
@@ -2939,23 +2939,23 @@ class ze extends b {
|
|
|
2939
2939
|
}
|
|
2940
2940
|
}
|
|
2941
2941
|
static create(e, t) {
|
|
2942
|
-
return new
|
|
2942
|
+
return new Le({
|
|
2943
2943
|
in: e,
|
|
2944
2944
|
out: t,
|
|
2945
2945
|
typeName: _.ZodPipeline
|
|
2946
2946
|
});
|
|
2947
2947
|
}
|
|
2948
2948
|
}
|
|
2949
|
-
class
|
|
2949
|
+
class Me extends b {
|
|
2950
2950
|
_parse(e) {
|
|
2951
|
-
const t = this._def.innerType._parse(e), n = (a) => (
|
|
2951
|
+
const t = this._def.innerType._parse(e), n = (a) => (ne(a) && (a.value = Object.freeze(a.value)), a);
|
|
2952
2952
|
return xe(t) ? t.then((a) => n(a)) : n(t);
|
|
2953
2953
|
}
|
|
2954
2954
|
unwrap() {
|
|
2955
2955
|
return this._def.innerType;
|
|
2956
2956
|
}
|
|
2957
2957
|
}
|
|
2958
|
-
|
|
2958
|
+
Me.create = (r, e) => new Me({
|
|
2959
2959
|
innerType: r,
|
|
2960
2960
|
typeName: _.ZodReadonly,
|
|
2961
2961
|
...x(e)
|
|
@@ -2964,16 +2964,16 @@ var _;
|
|
|
2964
2964
|
(function(r) {
|
|
2965
2965
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
2966
2966
|
})(_ || (_ = {}));
|
|
2967
|
-
const
|
|
2967
|
+
const Jr = q.create, B = Ve.create;
|
|
2968
2968
|
W.create;
|
|
2969
|
-
const
|
|
2969
|
+
const Pt = $.create, qe = C.create, ze = ke.create;
|
|
2970
2970
|
we.create;
|
|
2971
|
-
const
|
|
2972
|
-
|
|
2971
|
+
const Hr = X.create;
|
|
2972
|
+
se.create;
|
|
2973
2973
|
Te.create;
|
|
2974
2974
|
z.create;
|
|
2975
2975
|
ae.create;
|
|
2976
|
-
const Q = g,
|
|
2976
|
+
const Yr = K.createWithPreprocess, Q = g, Gr = "Required field";
|
|
2977
2977
|
function ce(r) {
|
|
2978
2978
|
let e;
|
|
2979
2979
|
if (typeof r == "string")
|
|
@@ -2989,29 +2989,29 @@ function ce(r) {
|
|
|
2989
2989
|
if (J(e))
|
|
2990
2990
|
return ce(e[0]);
|
|
2991
2991
|
const t = e;
|
|
2992
|
-
return
|
|
2992
|
+
return Ot(t) && (t != null && t.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
2993
2993
|
}
|
|
2994
|
-
function
|
|
2994
|
+
function Qr(r, e, t) {
|
|
2995
2995
|
let n = {};
|
|
2996
2996
|
if (_e(n, r.inputs, e, t), t != null && t.prefix) {
|
|
2997
2997
|
const s = t == null ? void 0 : t.prefix.replace(/.$/, "");
|
|
2998
2998
|
n = P({}, s, n);
|
|
2999
2999
|
}
|
|
3000
|
-
return
|
|
3000
|
+
return qe(me(n, e, t));
|
|
3001
3001
|
}
|
|
3002
|
-
function
|
|
3002
|
+
function Xr(r, e, t) {
|
|
3003
3003
|
const n = Object.keys(r).filter((i) => /^\d+$/.test(i) && !i.startsWith("_")).map((i) => parseInt(i, 10)).sort((i, o) => i - o);
|
|
3004
3004
|
if (n.length === 0) return null;
|
|
3005
3005
|
const a = Math.max(...n), s = [];
|
|
3006
3006
|
for (let i = 0; i <= a; i++)
|
|
3007
3007
|
if (n.includes(i)) {
|
|
3008
|
-
const o = r[i], u =
|
|
3008
|
+
const o = r[i], u = me({ item: o }, e, t);
|
|
3009
3009
|
s.push(u.item || B().optional());
|
|
3010
3010
|
} else
|
|
3011
3011
|
s.push(B().optional());
|
|
3012
|
-
return
|
|
3012
|
+
return Hr(s).rest(B()).optional();
|
|
3013
3013
|
}
|
|
3014
|
-
const
|
|
3014
|
+
const $t = /* @__PURE__ */ new Set([
|
|
3015
3015
|
"_requiredOnly",
|
|
3016
3016
|
"_schemaObj",
|
|
3017
3017
|
"_input",
|
|
@@ -3020,10 +3020,10 @@ const Yr = /* @__PURE__ */ new Set([
|
|
|
3020
3020
|
"_isTuple",
|
|
3021
3021
|
"_schema"
|
|
3022
3022
|
]);
|
|
3023
|
-
function
|
|
3023
|
+
function me(r, e, t) {
|
|
3024
3024
|
const n = {};
|
|
3025
3025
|
return Object.keys(r).forEach((a) => {
|
|
3026
|
-
if (
|
|
3026
|
+
if ($t.has(a))
|
|
3027
3027
|
return;
|
|
3028
3028
|
const {
|
|
3029
3029
|
_requiredOnly: s,
|
|
@@ -3036,34 +3036,43 @@ function de(r, e, t) {
|
|
|
3036
3036
|
/*...nestedSchemaObj*/
|
|
3037
3037
|
} = r[a];
|
|
3038
3038
|
if (d && !u && !c) {
|
|
3039
|
-
const h =
|
|
3039
|
+
const h = Xr(r[a], e, t);
|
|
3040
3040
|
if (h) {
|
|
3041
3041
|
n[a] = h;
|
|
3042
3042
|
return;
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
3045
3045
|
if (u && i && o) {
|
|
3046
|
-
const h =
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
]),
|
|
3050
|
-
n[a] =
|
|
3046
|
+
const h = qe(me(i, e, t)), v = ze([
|
|
3047
|
+
Pt(h).optional(),
|
|
3048
|
+
Be(o, t)
|
|
3049
|
+
]), O = Ct(y, o, e, t, v);
|
|
3050
|
+
n[a] = O;
|
|
3051
3051
|
} else if (c && o) {
|
|
3052
|
-
const h = i != null && i.___array ?
|
|
3053
|
-
n[a] =
|
|
3052
|
+
const h = i != null && i.___array ? me({ ___array: i.___array }, e, t) : { ___array: B() }, v = Kr(h, o, t), O = Ct(y, o, e, t, v);
|
|
3053
|
+
n[a] = O;
|
|
3054
3054
|
} else if (y && o) {
|
|
3055
|
-
const h =
|
|
3056
|
-
n[a] = h;
|
|
3057
|
-
} else if (s && o)
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
n[a] =
|
|
3062
|
-
}
|
|
3055
|
+
const h = en(y, o, e, t);
|
|
3056
|
+
n[a] = Tt(r[a]) ? h.pipe(Ae(r[a], e, t)) : h;
|
|
3057
|
+
} else if (s && o) {
|
|
3058
|
+
const h = Ue(o, t);
|
|
3059
|
+
n[a] = Tt(r[a]) ? h.pipe(Ae(r[a], e, t)) : h;
|
|
3060
|
+
} else
|
|
3061
|
+
n[a] = Ae(r[a], e, t);
|
|
3063
3062
|
}), n;
|
|
3064
3063
|
}
|
|
3065
|
-
function
|
|
3066
|
-
return
|
|
3064
|
+
function Tt(r) {
|
|
3065
|
+
return Object.keys(r).some((e) => !$t.has(e));
|
|
3066
|
+
}
|
|
3067
|
+
function Ae(r, e, t) {
|
|
3068
|
+
const n = Yr(
|
|
3069
|
+
(a) => a ?? {},
|
|
3070
|
+
qe(me(r, e, t))
|
|
3071
|
+
);
|
|
3072
|
+
return r._input ? ze([n, Be(r._input, t)]) : n;
|
|
3073
|
+
}
|
|
3074
|
+
function Be(r, e) {
|
|
3075
|
+
return Jr().superRefine((t, n) => {
|
|
3067
3076
|
var a;
|
|
3068
3077
|
if ((a = e == null ? void 0 : e.validationConfig) != null && a.globalValidation) {
|
|
3069
3078
|
const s = e.validationConfig.globalValidation(t, r, e.metadata);
|
|
@@ -3078,16 +3087,16 @@ function De(r, e) {
|
|
|
3078
3087
|
return !0;
|
|
3079
3088
|
});
|
|
3080
3089
|
}
|
|
3081
|
-
function
|
|
3082
|
-
return
|
|
3090
|
+
function Kr(r, e, t) {
|
|
3091
|
+
return ze([Pt(r.___array).optional(), Be(e, t)]);
|
|
3083
3092
|
}
|
|
3084
|
-
function
|
|
3093
|
+
function en(r, e, t, n) {
|
|
3085
3094
|
return B().optional().superRefine(async (a, s) => {
|
|
3086
3095
|
var o, u;
|
|
3087
|
-
if (e.required && !(await
|
|
3096
|
+
if (e.required && !(await Ue(e, n).safeParseAsync(a)).success)
|
|
3088
3097
|
return s.addIssue({
|
|
3089
3098
|
code: l.custom,
|
|
3090
|
-
message:
|
|
3099
|
+
message: Fe(e, n)
|
|
3091
3100
|
}), Q;
|
|
3092
3101
|
if ((o = n == null ? void 0 : n.validationConfig) != null && o.globalValidation) {
|
|
3093
3102
|
const c = (u = n == null ? void 0 : n.validationConfig) == null ? void 0 : u.globalValidation(a, e, n.metadata);
|
|
@@ -3099,11 +3108,11 @@ function Qr(r, e, t, n) {
|
|
|
3099
3108
|
if (!c.continue)
|
|
3100
3109
|
return !0;
|
|
3101
3110
|
}
|
|
3102
|
-
const i =
|
|
3111
|
+
const i = Mt(r, t);
|
|
3103
3112
|
if (i) {
|
|
3104
3113
|
const c = await i.safeParseAsync(a);
|
|
3105
3114
|
if (!c.success) {
|
|
3106
|
-
const d = ce(c == null ? void 0 : c.error.message), y = d === "Required" ?
|
|
3115
|
+
const d = ce(c == null ? void 0 : c.error.message), y = d === "Required" ? Fe(e, n) : d;
|
|
3107
3116
|
s.addIssue({
|
|
3108
3117
|
code: l.custom,
|
|
3109
3118
|
message: y
|
|
@@ -3112,10 +3121,10 @@ function Qr(r, e, t, n) {
|
|
|
3112
3121
|
}
|
|
3113
3122
|
});
|
|
3114
3123
|
}
|
|
3115
|
-
function
|
|
3124
|
+
function Ct(r, e, t, n, a) {
|
|
3116
3125
|
return B().optional().superRefine(async (s, i) => {
|
|
3117
3126
|
var d, y;
|
|
3118
|
-
const u = await
|
|
3127
|
+
const u = await Ue(e, n).safeParseAsync(s);
|
|
3119
3128
|
if (e.required && !u.success) {
|
|
3120
3129
|
const h = ce(u.error.message);
|
|
3121
3130
|
return i.addIssue({ code: l.custom, message: h, fatal: !0 }), Q;
|
|
@@ -3137,7 +3146,7 @@ function wt(r, e, t, n, a) {
|
|
|
3137
3146
|
code: l.custom,
|
|
3138
3147
|
message: "'Value is not array'"
|
|
3139
3148
|
}), Q;
|
|
3140
|
-
const c =
|
|
3149
|
+
const c = Mt(r, t);
|
|
3141
3150
|
if (c) {
|
|
3142
3151
|
const h = await c.safeParseAsync(s);
|
|
3143
3152
|
if (!h.success)
|
|
@@ -3153,15 +3162,15 @@ function _e(r, e, t, n, a) {
|
|
|
3153
3162
|
var o, u, c, d, y, h, v;
|
|
3154
3163
|
const i = t;
|
|
3155
3164
|
if (!s.isVisible || (o = s.isVisible) != null && o.call(s, i, n == null ? void 0 : n.metadata)) {
|
|
3156
|
-
const
|
|
3165
|
+
const O = E(r, s.path);
|
|
3157
3166
|
if ((u = s.validation) != null && u.schema ? P(
|
|
3158
3167
|
r,
|
|
3159
3168
|
s.path,
|
|
3160
|
-
|
|
3169
|
+
te(O, {
|
|
3161
3170
|
_schema: (c = s.validation) == null ? void 0 : c.schema,
|
|
3162
3171
|
_input: s
|
|
3163
3172
|
})
|
|
3164
|
-
) : s.required && P(r, s.path,
|
|
3173
|
+
) : s.required && P(r, s.path, te(O, { _requiredOnly: !0, _input: s })), s.inputs && (s.path && P(r, s.path, te(E(r, s.path), { _input: s })), _e(r, s.inputs, t, n)), s.inputType === "list") {
|
|
3165
3174
|
const w = {};
|
|
3166
3175
|
_e(
|
|
3167
3176
|
w,
|
|
@@ -3173,7 +3182,7 @@ function _e(r, e, t, n, a) {
|
|
|
3173
3182
|
n
|
|
3174
3183
|
);
|
|
3175
3184
|
const R = E(r, s.path);
|
|
3176
|
-
P(r, s.path,
|
|
3185
|
+
P(r, s.path, te(R, { _schemaObj: w, _isList: !0, _input: s }));
|
|
3177
3186
|
}
|
|
3178
3187
|
if (!((h = s.validation) != null && h.schema) && s.inputType === "array") {
|
|
3179
3188
|
const w = {};
|
|
@@ -3185,7 +3194,7 @@ function _e(r, e, t, n, a) {
|
|
|
3185
3194
|
), P(
|
|
3186
3195
|
r,
|
|
3187
3196
|
s.path,
|
|
3188
|
-
|
|
3197
|
+
te(O, {
|
|
3189
3198
|
_schemaObj: w,
|
|
3190
3199
|
_schema: (v = s.validation) == null ? void 0 : v.schema,
|
|
3191
3200
|
_isArrayItem: !0,
|
|
@@ -3208,34 +3217,34 @@ function _e(r, e, t, n, a) {
|
|
|
3208
3217
|
}
|
|
3209
3218
|
});
|
|
3210
3219
|
}
|
|
3211
|
-
function
|
|
3220
|
+
function Fe(r, e) {
|
|
3212
3221
|
var t, n, a;
|
|
3213
|
-
return ((n = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredMessagePerInput) == null ? void 0 : n[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ??
|
|
3222
|
+
return ((n = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredMessagePerInput) == null ? void 0 : n[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ?? Gr;
|
|
3214
3223
|
}
|
|
3215
|
-
function
|
|
3224
|
+
function Ue(r, e) {
|
|
3216
3225
|
var n, a, s, i, o, u;
|
|
3217
3226
|
if ((a = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredSchemaPerInput) != null && a[r.inputType])
|
|
3218
3227
|
return (i = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : i[r.inputType];
|
|
3219
3228
|
if ((o = e == null ? void 0 : e.validationConfig) != null && o.requiredSchema)
|
|
3220
3229
|
return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
|
|
3221
|
-
const t =
|
|
3230
|
+
const t = Fe(r, e);
|
|
3222
3231
|
return B().optional().superRefine((c, d) => {
|
|
3223
3232
|
typeof c == "object" && Ce(c) && d.addIssue({
|
|
3224
3233
|
code: l.custom,
|
|
3225
3234
|
message: t
|
|
3226
|
-
}), (
|
|
3235
|
+
}), (Se(c) || c === "") && d.addIssue({
|
|
3227
3236
|
code: l.custom,
|
|
3228
3237
|
message: t
|
|
3229
3238
|
});
|
|
3230
3239
|
});
|
|
3231
3240
|
}
|
|
3232
|
-
function
|
|
3241
|
+
function Mt(r, e) {
|
|
3233
3242
|
if (r instanceof b)
|
|
3234
3243
|
return r;
|
|
3235
3244
|
if (typeof r == "function")
|
|
3236
3245
|
return r(e);
|
|
3237
3246
|
}
|
|
3238
|
-
const
|
|
3247
|
+
const tn = (r) => Array.isArray(r == null ? void 0 : r.errors), rn = (r, e) => {
|
|
3239
3248
|
const t = {};
|
|
3240
3249
|
for (; r.length; ) {
|
|
3241
3250
|
const n = r[0], { code: a, message: s, path: i } = n, o = i.join(".");
|
|
@@ -3251,7 +3260,7 @@ const Xr = (r) => Array.isArray(r == null ? void 0 : r.errors), Kr = (r, e) => {
|
|
|
3251
3260
|
"unionErrors" in n && n.unionErrors.forEach((u) => u.errors.forEach((c) => r.push(c)));
|
|
3252
3261
|
{
|
|
3253
3262
|
const u = t[o].types, c = u && u[n.code];
|
|
3254
|
-
t[o] =
|
|
3263
|
+
t[o] = ur(
|
|
3255
3264
|
o,
|
|
3256
3265
|
e,
|
|
3257
3266
|
t,
|
|
@@ -3263,19 +3272,19 @@ const Xr = (r) => Array.isArray(r == null ? void 0 : r.errors), Kr = (r, e) => {
|
|
|
3263
3272
|
}
|
|
3264
3273
|
return t;
|
|
3265
3274
|
};
|
|
3266
|
-
function
|
|
3267
|
-
return
|
|
3275
|
+
function bn(r, e) {
|
|
3276
|
+
return tr(
|
|
3268
3277
|
async (t, n, a) => {
|
|
3269
3278
|
try {
|
|
3270
|
-
return await
|
|
3279
|
+
return await Qr(r, t, e).parseAsync(t), {
|
|
3271
3280
|
values: t,
|
|
3272
3281
|
errors: {}
|
|
3273
3282
|
};
|
|
3274
3283
|
} catch (s) {
|
|
3275
|
-
if (
|
|
3284
|
+
if (tn(s))
|
|
3276
3285
|
return {
|
|
3277
3286
|
values: {},
|
|
3278
|
-
errors:
|
|
3287
|
+
errors: dr(rn(s.errors, !0), a)
|
|
3279
3288
|
};
|
|
3280
3289
|
throw s;
|
|
3281
3290
|
}
|
|
@@ -3283,13 +3292,13 @@ function _n(r, e) {
|
|
|
3283
3292
|
[r, e]
|
|
3284
3293
|
);
|
|
3285
3294
|
}
|
|
3286
|
-
const
|
|
3295
|
+
const Ie = (r, e) => r.level !== e.level ? r.level - e.level : r.isPrimitive ? 1 : -1, je = (r, e) => r.level !== e.level ? e.level - r.level : r.isPrimitive ? -1 : 1;
|
|
3287
3296
|
function ve(r, e, t) {
|
|
3288
3297
|
E(r, e) === void 0 && t === void 0 || P(r, e, t);
|
|
3289
3298
|
}
|
|
3290
|
-
function
|
|
3291
|
-
const t =
|
|
3292
|
-
return n.sort(
|
|
3299
|
+
function nn(r, e) {
|
|
3300
|
+
const t = de(r), n = e.filter((o) => o.inputPriority === "early"), a = e.filter((o) => o.inputPriority === "normal"), s = e.filter((o) => o.inputPriority === "late");
|
|
3301
|
+
return n.sort(Ie), a.sort(Ie), s.sort(Ie), [...n, ...a, ...s].forEach((o) => {
|
|
3293
3302
|
if (o.inputTransform) {
|
|
3294
3303
|
const u = J(o.inputTransform) ? o.inputTransform : [o.inputTransform];
|
|
3295
3304
|
let c;
|
|
@@ -3306,25 +3315,25 @@ function en(r, e) {
|
|
|
3306
3315
|
}
|
|
3307
3316
|
}), t;
|
|
3308
3317
|
}
|
|
3309
|
-
function
|
|
3318
|
+
function sn(r, e, t) {
|
|
3310
3319
|
const n = e.filter((d) => d.outputPriority === "early"), a = e.filter((d) => d.outputPriority === "normal"), s = e.filter((d) => d.outputPriority === "late");
|
|
3311
3320
|
n.sort(je), a.sort(je), s.sort(je);
|
|
3312
3321
|
const i = [...n, ...a, ...s], o = [];
|
|
3313
3322
|
let u = {};
|
|
3314
|
-
t || (u =
|
|
3315
|
-
const c =
|
|
3323
|
+
t || (u = de(r));
|
|
3324
|
+
const c = de(r);
|
|
3316
3325
|
return i.forEach((d) => {
|
|
3317
3326
|
if (d.outputTransform) {
|
|
3318
3327
|
const y = J(d.outputTransform) ? d.outputTransform : [d.outputTransform];
|
|
3319
3328
|
let h = E(c, d.path);
|
|
3320
3329
|
y.forEach((v) => {
|
|
3321
|
-
const
|
|
3330
|
+
const O = E(u, d.path), w = v(h, c, O, u);
|
|
3322
3331
|
if (w)
|
|
3323
3332
|
if (h = w.value, w.path) {
|
|
3324
3333
|
if (w.merge) {
|
|
3325
3334
|
const R = E(u, w.path);
|
|
3326
3335
|
let T;
|
|
3327
|
-
R ? T =
|
|
3336
|
+
R ? T = te({}, R, w.value) : T = w.value, ve(u, w.path, T);
|
|
3328
3337
|
} else
|
|
3329
3338
|
ve(u, w.path, w.value);
|
|
3330
3339
|
w.unset && o.push(d.path);
|
|
@@ -3333,21 +3342,21 @@ function tn(r, e, t) {
|
|
|
3333
3342
|
});
|
|
3334
3343
|
}
|
|
3335
3344
|
}), o.forEach((d) => {
|
|
3336
|
-
|
|
3345
|
+
Rt(u, d);
|
|
3337
3346
|
}), u;
|
|
3338
3347
|
}
|
|
3339
|
-
function
|
|
3340
|
-
return r.reduce((t, n) => Array.isArray(n.inputs) ? [...t, n, ...
|
|
3348
|
+
function We(r) {
|
|
3349
|
+
return r.reduce((t, n) => Array.isArray(n.inputs) ? [...t, n, ...We(n.inputs)] : [...t, n], []);
|
|
3341
3350
|
}
|
|
3342
|
-
const
|
|
3351
|
+
const an = (r) => {
|
|
3343
3352
|
if (r !== void 0)
|
|
3344
3353
|
return { value: r };
|
|
3345
|
-
},
|
|
3354
|
+
}, on = (r) => {
|
|
3346
3355
|
if (r !== void 0)
|
|
3347
3356
|
return { value: r };
|
|
3348
3357
|
};
|
|
3349
|
-
function
|
|
3350
|
-
return
|
|
3358
|
+
function Ft(r, e) {
|
|
3359
|
+
return We(r.inputs).reduce((a, s) => {
|
|
3351
3360
|
var h, v;
|
|
3352
3361
|
const i = s.inputType === "text" || s.inputType === "boolean" || s.inputType === "number" || s.inputType === "textarea" || s.inputType === "select", o = !!s.inputTransform, u = !!s.outputTransform, c = Array.isArray(s.inputs) && s.inputs.length > 0, d = s.inputType === "list" || s.inputType === "array";
|
|
3353
3362
|
return o || u ? a.push({
|
|
@@ -3360,8 +3369,8 @@ function Pt(r, e) {
|
|
|
3360
3369
|
outputPriority: ((v = s.transformerPriority) == null ? void 0 : v.output) ?? "normal"
|
|
3361
3370
|
}) : e && !(c || d) && a.push({
|
|
3362
3371
|
path: s.path,
|
|
3363
|
-
inputTransform:
|
|
3364
|
-
outputTransform:
|
|
3372
|
+
inputTransform: an,
|
|
3373
|
+
outputTransform: on,
|
|
3365
3374
|
level: s.path.split(".").length,
|
|
3366
3375
|
isPrimitive: i,
|
|
3367
3376
|
inputPriority: "normal",
|
|
@@ -3369,22 +3378,22 @@ function Pt(r, e) {
|
|
|
3369
3378
|
}), a;
|
|
3370
3379
|
}, []);
|
|
3371
3380
|
}
|
|
3372
|
-
function
|
|
3373
|
-
const { preserve: a } = n, s =
|
|
3381
|
+
function un(r, e, t, n = {}) {
|
|
3382
|
+
const { preserve: a } = n, s = We(r.inputs), i = de(e);
|
|
3374
3383
|
return s.forEach((o) => {
|
|
3375
|
-
a && a.includes(o.path) || o.isVisible && !o.isVisible(e, t) &&
|
|
3384
|
+
a && a.includes(o.path) || o.isVisible && !o.isVisible(e, t) && Rt(i, o.path);
|
|
3376
3385
|
}), i;
|
|
3377
3386
|
}
|
|
3378
|
-
function
|
|
3379
|
-
const t =
|
|
3380
|
-
return
|
|
3387
|
+
function kn(r, e) {
|
|
3388
|
+
const t = Ft(e);
|
|
3389
|
+
return nn(r, t);
|
|
3381
3390
|
}
|
|
3382
|
-
function
|
|
3383
|
-
const a = n.cleanOutput, s =
|
|
3384
|
-
let i =
|
|
3385
|
-
return i =
|
|
3391
|
+
function wn(r, e, t, n = {}) {
|
|
3392
|
+
const a = n.cleanOutput, s = Ft(e, a);
|
|
3393
|
+
let i = un(e, r, t, n);
|
|
3394
|
+
return i = sn(i, s, n.cleanOutput), i = xr(i), i;
|
|
3386
3395
|
}
|
|
3387
|
-
function
|
|
3396
|
+
function Tn(r) {
|
|
3388
3397
|
const e = {}, t = (n) => {
|
|
3389
3398
|
n.forEach((a) => {
|
|
3390
3399
|
const { default: s, path: i, inputs: o } = a;
|
|
@@ -3393,15 +3402,15 @@ function bn(r) {
|
|
|
3393
3402
|
};
|
|
3394
3403
|
return Array.isArray(r.inputs) && t(r.inputs), e;
|
|
3395
3404
|
}
|
|
3396
|
-
function
|
|
3405
|
+
function Cn() {
|
|
3397
3406
|
return function(r, e) {
|
|
3398
3407
|
if (!(typeof r > "u"))
|
|
3399
|
-
return !r || !
|
|
3408
|
+
return !r || !Ut(r) ? { value: r } : {
|
|
3400
3409
|
value: Object.getOwnPropertyNames(r).map((t) => ({ key: t, value: r[t] }))
|
|
3401
3410
|
};
|
|
3402
3411
|
};
|
|
3403
3412
|
}
|
|
3404
|
-
function
|
|
3413
|
+
function Sn(r) {
|
|
3405
3414
|
return function(e) {
|
|
3406
3415
|
if (typeof e > "u") return;
|
|
3407
3416
|
if (!e || !J(e)) return { value: e };
|
|
@@ -3414,32 +3423,32 @@ function wn(r) {
|
|
|
3414
3423
|
return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
|
|
3415
3424
|
};
|
|
3416
3425
|
}
|
|
3417
|
-
function
|
|
3426
|
+
function On() {
|
|
3418
3427
|
return function(r) {
|
|
3419
3428
|
if (!(typeof r > "u"))
|
|
3420
3429
|
return J(r) && Ce(r) ? { value: void 0 } : { value: r };
|
|
3421
3430
|
};
|
|
3422
3431
|
}
|
|
3423
|
-
function
|
|
3432
|
+
function Rn(r, e) {
|
|
3424
3433
|
return function(t, n, a, s) {
|
|
3425
3434
|
let i;
|
|
3426
3435
|
if (r ? i = E(e && s ? s : n, r) : i = e ? a : t, !(typeof i > "u")) {
|
|
3427
|
-
if (
|
|
3428
|
-
if (
|
|
3429
|
-
const o =
|
|
3436
|
+
if (Et(i)) return { value: void 0, path: r };
|
|
3437
|
+
if (Ot(i)) {
|
|
3438
|
+
const o = Lt(de(i));
|
|
3430
3439
|
return Object.getOwnPropertyNames(o).length === 0 ? { value: void 0, path: r } : void 0;
|
|
3431
3440
|
}
|
|
3432
3441
|
return { value: i, path: r };
|
|
3433
3442
|
}
|
|
3434
3443
|
};
|
|
3435
3444
|
}
|
|
3436
|
-
function
|
|
3445
|
+
function En() {
|
|
3437
3446
|
return function(r) {
|
|
3438
3447
|
if (!(typeof r > "u"))
|
|
3439
|
-
return
|
|
3448
|
+
return Wt(r) && Ce(r) ? { value: void 0 } : { value: r };
|
|
3440
3449
|
};
|
|
3441
3450
|
}
|
|
3442
|
-
function
|
|
3451
|
+
function An(r) {
|
|
3443
3452
|
return function(e, t) {
|
|
3444
3453
|
const n = E(t, r);
|
|
3445
3454
|
if (typeof n == "string")
|
|
@@ -3448,20 +3457,20 @@ function Sn(r) {
|
|
|
3448
3457
|
return { value: e };
|
|
3449
3458
|
};
|
|
3450
3459
|
}
|
|
3451
|
-
function
|
|
3460
|
+
function In(r) {
|
|
3452
3461
|
return function(e, t, n, a) {
|
|
3453
3462
|
if (typeof e > "u") return;
|
|
3454
3463
|
if (!e) return { value: e };
|
|
3455
3464
|
const s = E(a || t, r);
|
|
3456
3465
|
if (typeof s == "object") {
|
|
3457
|
-
const i =
|
|
3466
|
+
const i = Lt(s);
|
|
3458
3467
|
if (Object.getOwnPropertyNames(i).length === 1)
|
|
3459
3468
|
return { value: e, path: r };
|
|
3460
3469
|
}
|
|
3461
3470
|
return { value: e };
|
|
3462
3471
|
};
|
|
3463
3472
|
}
|
|
3464
|
-
function
|
|
3473
|
+
function jn(r) {
|
|
3465
3474
|
return function(e, t) {
|
|
3466
3475
|
const n = E(t, r);
|
|
3467
3476
|
if (typeof n == "string")
|
|
@@ -3470,7 +3479,7 @@ function En(r) {
|
|
|
3470
3479
|
return { value: e };
|
|
3471
3480
|
};
|
|
3472
3481
|
}
|
|
3473
|
-
function
|
|
3482
|
+
function Nn(r, e) {
|
|
3474
3483
|
return function(t, n) {
|
|
3475
3484
|
if (typeof t > "u") return;
|
|
3476
3485
|
if (!t) return { value: t };
|
|
@@ -3484,35 +3493,35 @@ function An(r, e) {
|
|
|
3484
3493
|
return { value: t };
|
|
3485
3494
|
};
|
|
3486
3495
|
}
|
|
3487
|
-
function
|
|
3488
|
-
return
|
|
3496
|
+
function Dt(r) {
|
|
3497
|
+
return Ht(r) ? !0 : J(r) ? r.length === 0 : typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !Dt(r[e])) : Se(r);
|
|
3489
3498
|
}
|
|
3490
|
-
function
|
|
3491
|
-
return
|
|
3499
|
+
function Lt(r) {
|
|
3500
|
+
return Jt(r, (e) => typeof e == "object" ? Dt(e) : Se(e));
|
|
3492
3501
|
}
|
|
3493
|
-
function
|
|
3494
|
-
const { items: e, className: t, withoutWrapper: n = !0, ...a } = r, s = e.map((i) => /* @__PURE__ */
|
|
3495
|
-
return n ? /* @__PURE__ */
|
|
3502
|
+
function De(r) {
|
|
3503
|
+
const { items: e, className: t, withoutWrapper: n = !0, ...a } = r, s = e.map((i) => /* @__PURE__ */ S.jsx(_r, { input: i, path: i.path, ...a }, `${i.inputType}_${i.path}`));
|
|
3504
|
+
return n ? /* @__PURE__ */ S.jsx(S.Fragment, { children: s }) : /* @__PURE__ */ S.jsx("div", { className: t, children: s });
|
|
3496
3505
|
}
|
|
3497
|
-
|
|
3498
|
-
const
|
|
3506
|
+
De.displayName = "RenderInputs";
|
|
3507
|
+
const cn = rr((r, e) => {
|
|
3499
3508
|
const { inputs: t, className: n, factory: a, withoutWrapper: s } = r;
|
|
3500
|
-
return s ? /* @__PURE__ */
|
|
3509
|
+
return s ? /* @__PURE__ */ S.jsxs(nr, { children: [
|
|
3501
3510
|
t.hero,
|
|
3502
|
-
/* @__PURE__ */
|
|
3503
|
-
] }) : /* @__PURE__ */
|
|
3511
|
+
/* @__PURE__ */ S.jsx(De, { items: t.inputs, factory: a })
|
|
3512
|
+
] }) : /* @__PURE__ */ S.jsxs("div", { className: n, ref: e, children: [
|
|
3504
3513
|
t.hero,
|
|
3505
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ S.jsx(De, { items: t.inputs, factory: a })
|
|
3506
3515
|
] });
|
|
3507
3516
|
});
|
|
3508
|
-
|
|
3509
|
-
function
|
|
3517
|
+
cn.displayName = "RenderForm";
|
|
3518
|
+
function Vn(r) {
|
|
3510
3519
|
let e = !0;
|
|
3511
|
-
return
|
|
3512
|
-
e = e && (t === "" ||
|
|
3520
|
+
return St(r, (t) => {
|
|
3521
|
+
e = e && (t === "" || Et(t) || Se(t));
|
|
3513
3522
|
}), e;
|
|
3514
3523
|
}
|
|
3515
|
-
const
|
|
3524
|
+
const Zn = (r = "") => Yt(r.split("_").join(" ")), dn = (r, e = 2, t, n = 1e3) => {
|
|
3516
3525
|
let a = !1;
|
|
3517
3526
|
const s = () => {
|
|
3518
3527
|
requestAnimationFrame(() => {
|
|
@@ -3524,7 +3533,7 @@ const In = (r = "") => Wt(r.split("_").join(" ")), on = (r, e = 2, t, n = 1e3) =
|
|
|
3524
3533
|
a = !0;
|
|
3525
3534
|
});
|
|
3526
3535
|
};
|
|
3527
|
-
function
|
|
3536
|
+
function Pn(r, e) {
|
|
3528
3537
|
return {
|
|
3529
3538
|
...r,
|
|
3530
3539
|
inputs: r.inputs.map((t) => D(t, e))
|
|
@@ -3537,7 +3546,7 @@ function D(r, e) {
|
|
|
3537
3546
|
const y = ((u = n.inputConfig) == null ? void 0 : u.inputs) || [], h = (s == null ? void 0 : s.inputs) || [];
|
|
3538
3547
|
if (y.length > 0 || h.length > 0) {
|
|
3539
3548
|
const v = Math.max(y.length, h.length);
|
|
3540
|
-
o.inputConfig.inputs = Array.from({ length: v }, (
|
|
3549
|
+
o.inputConfig.inputs = Array.from({ length: v }, (O, w) => {
|
|
3541
3550
|
var V;
|
|
3542
3551
|
const R = y[w], T = h[w];
|
|
3543
3552
|
if (!R && T) return D(T, e);
|
|
@@ -3563,66 +3572,66 @@ function D(r, e) {
|
|
|
3563
3572
|
}
|
|
3564
3573
|
return o;
|
|
3565
3574
|
}
|
|
3566
|
-
function
|
|
3575
|
+
function $n(r) {
|
|
3567
3576
|
const {
|
|
3568
3577
|
field: { onBlur: e, ...t },
|
|
3569
3578
|
...n
|
|
3570
|
-
} =
|
|
3579
|
+
} = cr(r), a = G(Date.now());
|
|
3571
3580
|
return {
|
|
3572
3581
|
...n,
|
|
3573
3582
|
field: {
|
|
3574
3583
|
...t,
|
|
3575
|
-
onBlur:
|
|
3584
|
+
onBlur: dn(e, 2, a.current)
|
|
3576
3585
|
}
|
|
3577
3586
|
};
|
|
3578
3587
|
}
|
|
3579
3588
|
export {
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3589
|
+
Dn as Controller,
|
|
3590
|
+
Ln as Form,
|
|
3591
|
+
qn as FormProvider,
|
|
3592
|
+
yn as InputComponent,
|
|
3593
|
+
_r as InputComponentRenderer,
|
|
3594
|
+
At as InputFactory,
|
|
3595
|
+
lr as InputOverrideError,
|
|
3596
|
+
cn as RenderForm,
|
|
3597
|
+
De as RenderInputs,
|
|
3598
|
+
gn as RootForm,
|
|
3599
|
+
dn as afterFrames,
|
|
3600
|
+
Pn as applyFormOverrides,
|
|
3592
3601
|
D as applyInputOverride,
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3602
|
+
Sn as arrayToObjectOutputTransformer,
|
|
3603
|
+
Tn as collectDefaultValues,
|
|
3604
|
+
kn as convertDataToFormModel,
|
|
3605
|
+
wn as convertFormModelToData,
|
|
3606
|
+
Zn as generateReadableLabel,
|
|
3607
|
+
zn as get,
|
|
3608
|
+
_n as getDefaultValuesFromFormDefinition,
|
|
3609
|
+
xn as getTemporaryPath,
|
|
3610
|
+
Ft as getTransformers,
|
|
3611
|
+
Qr as getValidationSchema,
|
|
3612
|
+
nn as inputTransformValues,
|
|
3613
|
+
Vn as isChildrenEmpty,
|
|
3614
|
+
Cn as objectToArrayInputTransformer,
|
|
3615
|
+
sn as outputTransformValues,
|
|
3616
|
+
vn as overrideFormDefinition,
|
|
3608
3617
|
ce as processValidationParseResponse,
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3618
|
+
xr as removeTemporaryFieldsValue,
|
|
3619
|
+
Bn as set,
|
|
3620
|
+
jn as shorthandArrayInputTransformer,
|
|
3621
|
+
Nn as shorthandArrayOutputTransformer,
|
|
3622
|
+
An as shorthandObjectInputTransformer,
|
|
3623
|
+
In as shorthandObjectOutputTransformer,
|
|
3624
|
+
On as unsetEmptyArrayOutputTransformer,
|
|
3625
|
+
Rn as unsetEmptyObjectOutputTransformer,
|
|
3626
|
+
En as unsetEmptyStringOutputTransformer,
|
|
3627
|
+
un as unsetHiddenInputsValues,
|
|
3628
|
+
$n as useController,
|
|
3629
|
+
Un as useFieldArray,
|
|
3630
|
+
Wn as useForm,
|
|
3631
|
+
Jn as useFormContext,
|
|
3632
|
+
Hn as useFormState,
|
|
3633
|
+
yr as useRootFormContext,
|
|
3634
|
+
Yn as useWatch,
|
|
3635
|
+
bn as useZodValidationResolver
|
|
3627
3636
|
};
|
|
3628
3637
|
//# sourceMappingURL=index.js.map
|