@harnessio/forms 1.0.0 → 1.1.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/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +274 -258
- package/dist/index.js.map +1 -1
- package/dist/types/pipeline-input.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var Dt = Object.defineProperty;
|
|
2
2
|
var Lt = (r, e, t) => e in r ? Dt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var ye = (r, e, t) => Lt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { isEmpty as Ce, set as
|
|
4
|
+
import { isEmpty as Ce, set as P, get as E, forOwn as Tt, isArray as J, isObject as Ct, merge as ee, isUndefined as Oe, cloneDeep as le, unset as Ot, isPlainObject as qt, isNull as St, isString as zt, omitBy as Bt, isNil as Ut, capitalize as Wt } from "lodash-es";
|
|
5
5
|
import Jt, { createContext as Ht, useContext as Yt, Component as Gt, memo as Qt, useMemo as ge, useRef as G, useEffect as Y, useCallback as Xt, forwardRef as Kt, Fragment as er } from "react";
|
|
6
6
|
import { useFormContext as tr, get as rr, useForm as nr, FormProvider as sr, appendErrors as ar, useController as ir } from "react-hook-form";
|
|
7
|
-
import { Controller as
|
|
7
|
+
import { Controller as $n, Form as Mn, FormProvider as Fn, get as Dn, set as Ln, useFieldArray as qn, useForm as zn, useFormContext as Bn, useFormState as Un, useWatch as Wn } from "react-hook-form";
|
|
8
8
|
import { toNestErrors as or } from "@hookform/resolvers";
|
|
9
9
|
class ur extends Error {
|
|
10
10
|
constructor(e) {
|
|
11
11
|
super(`Input component '${e}' is already registered.`);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class Rt {
|
|
15
15
|
constructor(e) {
|
|
16
16
|
ye(this, "componentBank");
|
|
17
17
|
ye(this, "allowOverride");
|
|
@@ -46,7 +46,7 @@ class Ot {
|
|
|
46
46
|
* @returns new input factory
|
|
47
47
|
*/
|
|
48
48
|
clone() {
|
|
49
|
-
const e = new
|
|
49
|
+
const e = new Rt({
|
|
50
50
|
allowOverride: this.allowOverride
|
|
51
51
|
});
|
|
52
52
|
return this.listRegisteredComponents().forEach((t) => {
|
|
@@ -60,10 +60,10 @@ object-assign
|
|
|
60
60
|
(c) Sindre Sorhus
|
|
61
61
|
@license MIT
|
|
62
62
|
*/
|
|
63
|
-
var Re,
|
|
63
|
+
var Re, rt;
|
|
64
64
|
function cr() {
|
|
65
|
-
if (
|
|
66
|
-
|
|
65
|
+
if (rt) return Re;
|
|
66
|
+
rt = 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,10 +114,10 @@ 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
|
|
117
|
+
var nt;
|
|
118
118
|
function dr() {
|
|
119
|
-
if (
|
|
120
|
-
|
|
119
|
+
if (nt) return K;
|
|
120
|
+
nt = 1, cr();
|
|
121
121
|
var r = Jt, e = 60103;
|
|
122
122
|
if (K.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
|
|
123
123
|
var t = Symbol.for;
|
|
@@ -133,12 +133,12 @@ function dr() {
|
|
|
133
133
|
}
|
|
134
134
|
return K.jsx = i, K.jsxs = i, K;
|
|
135
135
|
}
|
|
136
|
-
var
|
|
136
|
+
var st;
|
|
137
137
|
function lr() {
|
|
138
|
-
return
|
|
138
|
+
return st || (st = 1, Se.exports = dr()), Se.exports;
|
|
139
139
|
}
|
|
140
140
|
var O = lr();
|
|
141
|
-
const
|
|
141
|
+
const Et = Ht({});
|
|
142
142
|
function fr({
|
|
143
143
|
children: r,
|
|
144
144
|
metadata: e,
|
|
@@ -146,7 +146,7 @@ function fr({
|
|
|
146
146
|
readonly: n
|
|
147
147
|
}) {
|
|
148
148
|
return /* @__PURE__ */ O.jsx(
|
|
149
|
-
|
|
149
|
+
Et.Provider,
|
|
150
150
|
{
|
|
151
151
|
value: {
|
|
152
152
|
metadata: e,
|
|
@@ -158,7 +158,7 @@ function fr({
|
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
function hr() {
|
|
161
|
-
const r = Yt(
|
|
161
|
+
const r = Yt(Et);
|
|
162
162
|
return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
|
|
163
163
|
}
|
|
164
164
|
class mr extends Gt {
|
|
@@ -183,7 +183,7 @@ class mr extends Gt {
|
|
|
183
183
|
return this.state.hasError ? /* @__PURE__ */ O.jsx(O.Fragment, {}) : this.props.children;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const at = ({
|
|
187
187
|
children: r,
|
|
188
188
|
withoutWrapper: e = !1
|
|
189
189
|
}) => e || !r ? r : /* @__PURE__ */ O.jsx("div", { children: r }), pr = Qt(function({
|
|
@@ -195,20 +195,20 @@ const nt = ({
|
|
|
195
195
|
input: i,
|
|
196
196
|
withoutWrapper: o = !1
|
|
197
197
|
}) {
|
|
198
|
-
var
|
|
199
|
-
const u = tr(), { formState: c } = u, { fixedValues: d = {} } = {}, { metadata: y, readonly: h, inputErrorHandler: v } = hr(), S = t == null ? void 0 : t.getComponent(i.inputType), w = !!(i.isVisible || typeof i.disabled == "function" || typeof ((
|
|
198
|
+
var He, Ye, Ge, Qe, Xe;
|
|
199
|
+
const u = tr(), { formState: c } = u, { fixedValues: d = {} } = {}, { metadata: y, readonly: h, inputErrorHandler: v } = hr(), S = t == null ? void 0 : t.getComponent(i.inputType), w = !!(i.isVisible || typeof i.disabled == "function" || typeof ((He = i.validation) == null ? void 0 : He.schema) == "function" || typeof ((Ye = i.warning) == null ? void 0 : Ye.schema) == "function"), R = !!((Ge = i.warning) != null && Ge.schema || (Qe = i.validation) != null && Qe.schema), T = w ? u.watch() : {}, V = R ? w ? rr(T, i.path) : u.watch(i.path) : void 0, Z = ge(() => {
|
|
200
200
|
if (!w) return {};
|
|
201
|
-
let
|
|
201
|
+
let ie = T;
|
|
202
202
|
return d && Object.keys(d).forEach((pe) => {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
}),
|
|
206
|
-
}, [w, T, d]), H = !i.isVisible || i.isVisible(Z, y),
|
|
207
|
-
var
|
|
203
|
+
const oe = d[pe];
|
|
204
|
+
ie = P(ie, pe, oe);
|
|
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, I = (Xe = i.warning) == null ? void 0 : Xe.schema, We = ge(() => {
|
|
207
|
+
var et, tt;
|
|
208
208
|
if (!H || typeof I > "u") return;
|
|
209
|
-
const
|
|
210
|
-
return !pe &&
|
|
211
|
-
}, [i.path, V, I, H, y]),
|
|
209
|
+
const ie = typeof I == "function" ? I(Z, y) : I, { success: pe, error: oe } = ie.safeParse(V), Ke = (tt = (et = oe == null ? void 0 : oe.errors) == null ? void 0 : et[0]) == null ? void 0 : tt.message;
|
|
210
|
+
return !pe && Ke ? Ke : void 0;
|
|
211
|
+
}, [i.path, V, I, H, y]), Je = ge(
|
|
212
212
|
() => ({
|
|
213
213
|
path: e,
|
|
214
214
|
key: e,
|
|
@@ -216,29 +216,29 @@ const nt = ({
|
|
|
216
216
|
onUpdate: n,
|
|
217
217
|
onChange: a,
|
|
218
218
|
factory: t,
|
|
219
|
-
readonly:
|
|
219
|
+
readonly: A,
|
|
220
220
|
input: i,
|
|
221
|
-
disabled:
|
|
222
|
-
warning:
|
|
221
|
+
disabled: M,
|
|
222
|
+
warning: We
|
|
223
223
|
}),
|
|
224
|
-
[t, s, i, a, n, e,
|
|
224
|
+
[t, s, i, a, n, e, A, c.errors, M, We]
|
|
225
225
|
), Ft = ge(() => H ? /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
|
|
226
226
|
i.before ? i.before : null,
|
|
227
|
-
/* @__PURE__ */ O.jsx(mr, { path: e, inputType: i.inputType, inputErrorHandler: v, children: S == null ? void 0 : S.renderComponent(
|
|
227
|
+
/* @__PURE__ */ O.jsx(mr, { path: e, inputType: i.inputType, inputErrorHandler: v, children: S == null ? void 0 : S.renderComponent(Je) }),
|
|
228
228
|
i.after ? i.after : null
|
|
229
|
-
] }) : null, [H, i.before, i.inputType, i.after, e, S,
|
|
230
|
-
return S ? /* @__PURE__ */ O.jsx(
|
|
229
|
+
] }) : null, [H, i.before, i.inputType, i.after, e, S, Je, c.errors]);
|
|
230
|
+
return S ? /* @__PURE__ */ O.jsx(at, { withoutWrapper: o, children: Ft }) : /* @__PURE__ */ O.jsx(at, { withoutWrapper: o, children: /* @__PURE__ */ O.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 hn {
|
|
237
237
|
getType() {
|
|
238
238
|
return this.internalType;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function it() {
|
|
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 st() {
|
|
|
251
251
|
}, n);
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function ot() {
|
|
255
255
|
return typeof window < "u" && "cancelIdleCallback" in window ? window.cancelIdleCallback : clearTimeout;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function mn(r) {
|
|
258
258
|
const {
|
|
259
259
|
mode: e = "onSubmit",
|
|
260
260
|
resolver: t,
|
|
@@ -283,7 +283,7 @@ function hn(r) {
|
|
|
283
283
|
Y(() => {
|
|
284
284
|
w.current = JSON.stringify(n ?? {}), v.reset(n, {});
|
|
285
285
|
}, [v.reset, n]), Y(() => {
|
|
286
|
-
const
|
|
286
|
+
const A = it(), M = ot(), I = A(() => {
|
|
287
287
|
v.reset({}, {
|
|
288
288
|
keepErrors: !0,
|
|
289
289
|
keepDirty: !0,
|
|
@@ -297,7 +297,7 @@ function hn(r) {
|
|
|
297
297
|
keepSubmitCount: !0
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
|
-
return () =>
|
|
300
|
+
return () => M(I);
|
|
301
301
|
}, []);
|
|
302
302
|
const { handleSubmit: R } = v, T = G(s);
|
|
303
303
|
Y(() => {
|
|
@@ -309,50 +309,50 @@ function hn(r) {
|
|
|
309
309
|
}, [i]);
|
|
310
310
|
const Z = G(!1);
|
|
311
311
|
Y(() => {
|
|
312
|
-
const
|
|
312
|
+
const A = v.watch((M) => {
|
|
313
313
|
var I;
|
|
314
|
-
Z.current || JSON.stringify(
|
|
314
|
+
Z.current || JSON.stringify(M ?? {}) !== w.current && ((I = T.current) == null || I.call(T, { ...M }), S.current === !0 && (Z.current = !0, v.trigger().finally(() => {
|
|
315
315
|
Z.current = !1;
|
|
316
316
|
})));
|
|
317
317
|
});
|
|
318
318
|
return () => {
|
|
319
|
-
|
|
319
|
+
A.unsubscribe();
|
|
320
320
|
};
|
|
321
321
|
}, [v]);
|
|
322
322
|
const H = G(!0);
|
|
323
323
|
return Y(() => {
|
|
324
|
-
var
|
|
324
|
+
var A;
|
|
325
325
|
if (H.current) {
|
|
326
326
|
H.current = !1;
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
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
|
|
332
|
+
const A = it(), M = ot(), I = A(() => {
|
|
333
333
|
v.setFocus(y);
|
|
334
334
|
});
|
|
335
|
-
return () =>
|
|
335
|
+
return () => M(I);
|
|
336
336
|
}
|
|
337
337
|
}, [v, y]), /* @__PURE__ */ O.jsx(fr, { metadata: c, readonly: h, inputErrorHandler: u, children: /* @__PURE__ */ O.jsx(sr, { ...v, children: typeof d == "function" ? d({
|
|
338
338
|
...v,
|
|
339
339
|
submitForm: async () => {
|
|
340
|
-
o && (S.current = !0, R((
|
|
341
|
-
o(
|
|
340
|
+
o && (S.current = !0, R((A) => {
|
|
341
|
+
o(A);
|
|
342
342
|
})());
|
|
343
343
|
}
|
|
344
344
|
}) : d }) });
|
|
345
345
|
}
|
|
346
|
-
const
|
|
346
|
+
const pn = (r) => {
|
|
347
347
|
const e = {}, t = (n) => {
|
|
348
348
|
n.forEach((a) => {
|
|
349
349
|
const { path: s, default: i, inputs: o } = a;
|
|
350
|
-
Array.isArray(o) ? t(o) : E(e, s) === void 0 &&
|
|
350
|
+
Array.isArray(o) ? t(o) : E(e, s) === void 0 && P(e, s, i);
|
|
351
351
|
});
|
|
352
352
|
};
|
|
353
353
|
return Array.isArray(r.inputs) && t(r.inputs), e;
|
|
354
354
|
};
|
|
355
|
-
function
|
|
355
|
+
function yn(r, e) {
|
|
356
356
|
const t = r.inputs.map((n) => {
|
|
357
357
|
const a = yr(e, n.path);
|
|
358
358
|
return a || n;
|
|
@@ -362,11 +362,11 @@ function pn(r, e) {
|
|
|
362
362
|
function yr(r, e) {
|
|
363
363
|
return r.inputs.find((t) => t.path === e);
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const At = "__temp_", gn = (r) => At + r.split(".").join("__");
|
|
366
366
|
function gr(r) {
|
|
367
367
|
const e = { ...r };
|
|
368
|
-
return
|
|
369
|
-
n.startsWith(
|
|
368
|
+
return Tt(e, (t, n) => {
|
|
369
|
+
n.startsWith(At) && 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 ut;
|
|
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
|
+
})(ut || (ut = {}));
|
|
417
417
|
const m = k.arrayToEnum([
|
|
418
418
|
"string",
|
|
419
419
|
"nan",
|
|
@@ -637,7 +637,7 @@ function f(r, e) {
|
|
|
637
637
|
});
|
|
638
638
|
r.common.issues.push(n);
|
|
639
639
|
}
|
|
640
|
-
class
|
|
640
|
+
class j {
|
|
641
641
|
constructor() {
|
|
642
642
|
this.value = "valid";
|
|
643
643
|
}
|
|
@@ -665,7 +665,7 @@ class A {
|
|
|
665
665
|
value: i
|
|
666
666
|
});
|
|
667
667
|
}
|
|
668
|
-
return
|
|
668
|
+
return j.mergeObjectSync(e, n);
|
|
669
669
|
}
|
|
670
670
|
static mergeObjectSync(e, t) {
|
|
671
671
|
const n = {};
|
|
@@ -680,7 +680,7 @@ class A {
|
|
|
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 }), ct = (r) => r.status === "aborted", dt = (r) => r.status === "dirty", re = (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 lt = (r, e) => {
|
|
697
|
+
if (re(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 j(),
|
|
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 lt(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 re(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) => re(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 lt(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 se({
|
|
852
852
|
schema: this,
|
|
853
853
|
typeName: _.ZodEffects,
|
|
854
854
|
effect: { type: "refinement", refinement: e }
|
|
@@ -868,13 +868,13 @@ class b {
|
|
|
868
868
|
return z.create(this, this._def);
|
|
869
869
|
}
|
|
870
870
|
nullable() {
|
|
871
|
-
return
|
|
871
|
+
return ae.create(this, this._def);
|
|
872
872
|
}
|
|
873
873
|
nullish() {
|
|
874
874
|
return this.nullable().optional();
|
|
875
875
|
}
|
|
876
876
|
array() {
|
|
877
|
-
return
|
|
877
|
+
return $.create(this);
|
|
878
878
|
}
|
|
879
879
|
promise() {
|
|
880
880
|
return Te.create(this, this._def);
|
|
@@ -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 se({
|
|
890
890
|
...x(this._def),
|
|
891
891
|
schema: this,
|
|
892
892
|
typeName: _.ZodEffects,
|
|
@@ -926,7 +926,7 @@ class b {
|
|
|
926
926
|
});
|
|
927
927
|
}
|
|
928
928
|
pipe(e) {
|
|
929
|
-
return
|
|
929
|
+
return ze.create(this, e);
|
|
930
930
|
}
|
|
931
931
|
readonly() {
|
|
932
932
|
return $e.create(this);
|
|
@@ -940,23 +940,23 @@ class b {
|
|
|
940
940
|
}
|
|
941
941
|
const br = /^c[^\s-]{8,}$/i, kr = /^[0-9a-z]+$/, wr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Tr = /^[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, Cr = /^[a-z0-9_-]{21}$/i, Or = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Sr = /^[-+]?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)?)??$/, Rr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Er = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
942
942
|
let Ee;
|
|
943
|
-
const
|
|
944
|
-
function
|
|
943
|
+
const Ar = /^(?:(?: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])$/, jr = /^(?:(?: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])$/, Ir = /^(([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]))$/, Nr = /^(([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])$/, Vr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, jt = "((\\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])))", Pr = new RegExp(`^${jt}$`);
|
|
944
|
+
function It(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
950
|
function $r(r) {
|
|
951
|
-
return new RegExp(`^${
|
|
951
|
+
return new RegExp(`^${It(r)}$`);
|
|
952
952
|
}
|
|
953
953
|
function Mr(r) {
|
|
954
|
-
let e = `${
|
|
954
|
+
let e = `${jt}T${It(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
958
|
function Fr(r, e) {
|
|
959
|
-
return !!((e === "v4" || !e) &&
|
|
959
|
+
return !!((e === "v4" || !e) && Ar.test(r) || (e === "v6" || !e) && Ir.test(r));
|
|
960
960
|
}
|
|
961
961
|
function Dr(r, e) {
|
|
962
962
|
if (!Or.test(r))
|
|
@@ -972,7 +972,7 @@ function Dr(r, e) {
|
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
974
|
function Lr(r, e) {
|
|
975
|
-
return !!((e === "v4" || !e) &&
|
|
975
|
+
return !!((e === "v4" || !e) && jr.test(r) || (e === "v6" || !e) && Nr.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 j();
|
|
988
988
|
let a;
|
|
989
989
|
for (const s of this._def.checks)
|
|
990
990
|
if (s.kind === "min")
|
|
@@ -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 j();
|
|
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,
|
|
@@ -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 j();
|
|
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,
|
|
@@ -1666,7 +1666,7 @@ he.create = (r) => new he({
|
|
|
1666
1666
|
coerce: (r == null ? void 0 : r.coerce) ?? !1,
|
|
1667
1667
|
...x(r)
|
|
1668
1668
|
});
|
|
1669
|
-
class
|
|
1669
|
+
class ft 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 dt extends b {
|
|
|
1679
1679
|
return N(e.data);
|
|
1680
1680
|
}
|
|
1681
1681
|
}
|
|
1682
|
-
|
|
1682
|
+
ft.create = (r) => new ft({
|
|
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 j();
|
|
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 ht 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 lt extends b {
|
|
|
1775
1775
|
return N(e.data);
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
|
-
|
|
1778
|
+
ht.create = (r) => new ht({
|
|
1779
1779
|
typeName: _.ZodSymbol,
|
|
1780
1780
|
...x(r)
|
|
1781
1781
|
});
|
|
1782
|
-
class
|
|
1782
|
+
class mt 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 ft extends b {
|
|
|
1792
1792
|
return N(e.data);
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
|
-
|
|
1795
|
+
mt.create = (r) => new mt({
|
|
1796
1796
|
typeName: _.ZodUndefined,
|
|
1797
1797
|
...x(r)
|
|
1798
1798
|
});
|
|
1799
|
-
class
|
|
1799
|
+
class pt extends b {
|
|
1800
1800
|
_parse(e) {
|
|
1801
1801
|
if (this._getType(e) !== m.null) {
|
|
1802
1802
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1809,7 +1809,7 @@ class ht extends b {
|
|
|
1809
1809
|
return N(e.data);
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
|
-
|
|
1812
|
+
pt.create = (r) => new pt({
|
|
1813
1813
|
typeName: _.ZodNull,
|
|
1814
1814
|
...x(r)
|
|
1815
1815
|
});
|
|
@@ -1825,7 +1825,7 @@ Ne.create = (r) => new Ne({
|
|
|
1825
1825
|
typeName: _.ZodAny,
|
|
1826
1826
|
...x(r)
|
|
1827
1827
|
});
|
|
1828
|
-
class
|
|
1828
|
+
class yt extends b {
|
|
1829
1829
|
constructor() {
|
|
1830
1830
|
super(...arguments), this._unknown = !0;
|
|
1831
1831
|
}
|
|
@@ -1833,7 +1833,7 @@ class mt extends b {
|
|
|
1833
1833
|
return N(e.data);
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
|
|
1836
|
+
yt.create = (r) => new yt({
|
|
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 gt extends b {
|
|
1855
1855
|
_parse(e) {
|
|
1856
1856
|
if (this._getType(e) !== m.undefined) {
|
|
1857
1857
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1864,11 +1864,11 @@ class pt extends b {
|
|
|
1864
1864
|
return N(e.data);
|
|
1865
1865
|
}
|
|
1866
1866
|
}
|
|
1867
|
-
|
|
1867
|
+
gt.create = (r) => new gt({
|
|
1868
1868
|
typeName: _.ZodVoid,
|
|
1869
1869
|
...x(r)
|
|
1870
1870
|
});
|
|
1871
|
-
class
|
|
1871
|
+
class $ extends b {
|
|
1872
1872
|
_parse(e) {
|
|
1873
1873
|
const { ctx: t, status: n } = this._processInputParams(e), a = this._def;
|
|
1874
1874
|
if (t.parsedType !== m.array)
|
|
@@ -1904,27 +1904,27 @@ class P 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) => j.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 j.mergeArray(n, s);
|
|
1910
1910
|
}
|
|
1911
1911
|
get element() {
|
|
1912
1912
|
return this._def.type;
|
|
1913
1913
|
}
|
|
1914
1914
|
min(e, t) {
|
|
1915
|
-
return new
|
|
1915
|
+
return new $({
|
|
1916
1916
|
...this._def,
|
|
1917
1917
|
minLength: { value: e, message: p.toString(t) }
|
|
1918
1918
|
});
|
|
1919
1919
|
}
|
|
1920
1920
|
max(e, t) {
|
|
1921
|
-
return new
|
|
1921
|
+
return new $({
|
|
1922
1922
|
...this._def,
|
|
1923
1923
|
maxLength: { value: e, message: p.toString(t) }
|
|
1924
1924
|
});
|
|
1925
1925
|
}
|
|
1926
1926
|
length(e, t) {
|
|
1927
|
-
return new
|
|
1927
|
+
return new $({
|
|
1928
1928
|
...this._def,
|
|
1929
1929
|
exactLength: { value: e, message: p.toString(t) }
|
|
1930
1930
|
});
|
|
@@ -1933,7 +1933,7 @@ class P extends b {
|
|
|
1933
1933
|
return this.min(1, e);
|
|
1934
1934
|
}
|
|
1935
1935
|
}
|
|
1936
|
-
|
|
1936
|
+
$.create = (r, e) => new $({
|
|
1937
1937
|
type: r,
|
|
1938
1938
|
minLength: null,
|
|
1939
1939
|
maxLength: null,
|
|
@@ -1941,21 +1941,21 @@ P.create = (r, e) => new P({
|
|
|
1941
1941
|
typeName: _.ZodArray,
|
|
1942
1942
|
...x(e)
|
|
1943
1943
|
});
|
|
1944
|
-
function
|
|
1944
|
+
function te(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(te(n));
|
|
1950
1950
|
}
|
|
1951
1951
|
return new C({
|
|
1952
1952
|
...r._def,
|
|
1953
1953
|
shape: () => e
|
|
1954
1954
|
});
|
|
1955
|
-
} else return r instanceof
|
|
1955
|
+
} else return r instanceof $ ? new $({
|
|
1956
1956
|
...r._def,
|
|
1957
|
-
type:
|
|
1958
|
-
}) : r instanceof z ? z.create(
|
|
1957
|
+
type: te(r.element)
|
|
1958
|
+
}) : r instanceof z ? z.create(te(r.unwrap())) : r instanceof ae ? ae.create(te(r.unwrap())) : r instanceof X ? X.create(r.items.map((e) => te(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) => j.mergeObjectSync(n, c)) : j.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 te(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 Nt(k.objectKeys(this.shape));
|
|
2225
2225
|
}
|
|
2226
2226
|
}
|
|
2227
2227
|
C.create = (r, e) => new C({
|
|
@@ -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 (ct(s) || ct(i))
|
|
2351
2351
|
return g;
|
|
2352
2352
|
const o = Ve(s.value, i.value);
|
|
2353
|
-
return o.valid ? ((
|
|
2353
|
+
return o.valid ? ((dt(s) || dt(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) => j.mergeArray(t, i)) : j.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 _t extends b {
|
|
2436
2436
|
get keySchema() {
|
|
2437
2437
|
return this._def.keyType;
|
|
2438
2438
|
}
|
|
@@ -2474,7 +2474,7 @@ class yt extends b {
|
|
|
2474
2474
|
}
|
|
2475
2475
|
}
|
|
2476
2476
|
}
|
|
2477
|
-
|
|
2477
|
+
_t.create = (r, e, t) => new _t({
|
|
2478
2478
|
valueType: e,
|
|
2479
2479
|
keyType: r,
|
|
2480
2480
|
typeName: _.ZodMap,
|
|
@@ -2544,7 +2544,7 @@ me.create = (r, e) => new me({
|
|
|
2544
2544
|
typeName: _.ZodSet,
|
|
2545
2545
|
...x(e)
|
|
2546
2546
|
});
|
|
2547
|
-
class
|
|
2547
|
+
class vt extends b {
|
|
2548
2548
|
get schema() {
|
|
2549
2549
|
return this._def.getter();
|
|
2550
2550
|
}
|
|
@@ -2553,12 +2553,12 @@ class gt extends b {
|
|
|
2553
2553
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2554
2554
|
}
|
|
2555
2555
|
}
|
|
2556
|
-
|
|
2556
|
+
vt.create = (r, e) => new vt({
|
|
2557
2557
|
getter: r,
|
|
2558
2558
|
typeName: _.ZodLazy,
|
|
2559
2559
|
...x(e)
|
|
2560
2560
|
});
|
|
2561
|
-
class
|
|
2561
|
+
class xt 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 _t extends b {
|
|
|
2574
2574
|
return this._def.value;
|
|
2575
2575
|
}
|
|
2576
2576
|
}
|
|
2577
|
-
|
|
2577
|
+
xt.create = (r, e) => new xt({
|
|
2578
2578
|
value: r,
|
|
2579
2579
|
typeName: _.ZodLiteral,
|
|
2580
2580
|
...x(e)
|
|
2581
2581
|
});
|
|
2582
|
-
function
|
|
2583
|
-
return new
|
|
2582
|
+
function Nt(r, e) {
|
|
2583
|
+
return new ne({
|
|
2584
2584
|
values: r,
|
|
2585
2585
|
typeName: _.ZodEnum,
|
|
2586
2586
|
...x(e)
|
|
2587
2587
|
});
|
|
2588
2588
|
}
|
|
2589
|
-
class
|
|
2589
|
+
class ne 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 re extends b {
|
|
|
2628
2628
|
return e;
|
|
2629
2629
|
}
|
|
2630
2630
|
extract(e, t = this._def) {
|
|
2631
|
-
return
|
|
2631
|
+
return ne.create(e, {
|
|
2632
2632
|
...this._def,
|
|
2633
2633
|
...t
|
|
2634
2634
|
});
|
|
2635
2635
|
}
|
|
2636
2636
|
exclude(e, t = this._def) {
|
|
2637
|
-
return
|
|
2637
|
+
return ne.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
|
+
ne.create = Nt;
|
|
2644
|
+
class bt 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 vt extends b {
|
|
|
2666
2666
|
return this._def.values;
|
|
2667
2667
|
}
|
|
2668
2668
|
}
|
|
2669
|
-
|
|
2669
|
+
bt.create = (r, e) => new bt({
|
|
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 se extends b {
|
|
2699
2699
|
innerType() {
|
|
2700
2700
|
return this._def.schema;
|
|
2701
2701
|
}
|
|
@@ -2761,27 +2761,27 @@ class ne extends b {
|
|
|
2761
2761
|
path: n.path,
|
|
2762
2762
|
parent: n
|
|
2763
2763
|
});
|
|
2764
|
-
if (!
|
|
2764
|
+
if (!re(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) => re(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
|
+
se.create = (r, e, t) => new se({
|
|
2779
2779
|
schema: r,
|
|
2780
2780
|
typeName: _.ZodEffects,
|
|
2781
2781
|
effect: e,
|
|
2782
2782
|
...x(t)
|
|
2783
2783
|
});
|
|
2784
|
-
|
|
2784
|
+
se.createWithPreprocess = (r, e, t) => new se({
|
|
2785
2785
|
schema: e,
|
|
2786
2786
|
effect: { type: "preprocess", transform: r },
|
|
2787
2787
|
typeName: _.ZodEffects,
|
|
@@ -2800,7 +2800,7 @@ z.create = (r, e) => new z({
|
|
|
2800
2800
|
typeName: _.ZodOptional,
|
|
2801
2801
|
...x(e)
|
|
2802
2802
|
});
|
|
2803
|
-
class
|
|
2803
|
+
class ae extends b {
|
|
2804
2804
|
_parse(e) {
|
|
2805
2805
|
return this._getType(e) === m.null ? N(null) : this._def.innerType._parse(e);
|
|
2806
2806
|
}
|
|
@@ -2808,7 +2808,7 @@ class se extends b {
|
|
|
2808
2808
|
return this._def.innerType;
|
|
2809
2809
|
}
|
|
2810
2810
|
}
|
|
2811
|
-
|
|
2811
|
+
ae.create = (r, e) => new ae({
|
|
2812
2812
|
innerType: r,
|
|
2813
2813
|
typeName: _.ZodNullable,
|
|
2814
2814
|
...x(e)
|
|
@@ -2876,7 +2876,7 @@ Pe.create = (r, e) => new Pe({
|
|
|
2876
2876
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2877
2877
|
...x(e)
|
|
2878
2878
|
});
|
|
2879
|
-
class
|
|
2879
|
+
class kt extends b {
|
|
2880
2880
|
_parse(e) {
|
|
2881
2881
|
if (this._getType(e) !== m.nan) {
|
|
2882
2882
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2889,7 +2889,7 @@ class xt extends b {
|
|
|
2889
2889
|
return { status: "valid", value: e.data };
|
|
2890
2890
|
}
|
|
2891
2891
|
}
|
|
2892
|
-
|
|
2892
|
+
kt.create = (r) => new kt({
|
|
2893
2893
|
typeName: _.ZodNaN,
|
|
2894
2894
|
...x(r)
|
|
2895
2895
|
});
|
|
@@ -2906,7 +2906,7 @@ class zr extends b {
|
|
|
2906
2906
|
return this._def.type;
|
|
2907
2907
|
}
|
|
2908
2908
|
}
|
|
2909
|
-
class
|
|
2909
|
+
class ze extends b {
|
|
2910
2910
|
_parse(e) {
|
|
2911
2911
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2912
2912
|
if (n.common.async)
|
|
@@ -2939,7 +2939,7 @@ class Le extends b {
|
|
|
2939
2939
|
}
|
|
2940
2940
|
}
|
|
2941
2941
|
static create(e, t) {
|
|
2942
|
-
return new
|
|
2942
|
+
return new ze({
|
|
2943
2943
|
in: e,
|
|
2944
2944
|
out: t,
|
|
2945
2945
|
typeName: _.ZodPipeline
|
|
@@ -2948,7 +2948,7 @@ class Le extends b {
|
|
|
2948
2948
|
}
|
|
2949
2949
|
class $e 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) => (re(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() {
|
|
@@ -2966,13 +2966,13 @@ var _;
|
|
|
2966
2966
|
})(_ || (_ = {}));
|
|
2967
2967
|
const Br = q.create, B = Ne.create;
|
|
2968
2968
|
W.create;
|
|
2969
|
-
const
|
|
2969
|
+
const Vt = $.create, Me = C.create, Fe = ke.create;
|
|
2970
2970
|
we.create;
|
|
2971
2971
|
const Ur = X.create;
|
|
2972
|
-
|
|
2972
|
+
ne.create;
|
|
2973
2973
|
Te.create;
|
|
2974
2974
|
z.create;
|
|
2975
|
-
|
|
2975
|
+
ae.create;
|
|
2976
2976
|
const Q = g, Wr = "Required field";
|
|
2977
2977
|
function ce(r) {
|
|
2978
2978
|
let e;
|
|
@@ -2989,13 +2989,13 @@ function ce(r) {
|
|
|
2989
2989
|
if (J(e))
|
|
2990
2990
|
return ce(e[0]);
|
|
2991
2991
|
const t = e;
|
|
2992
|
-
return
|
|
2992
|
+
return Ct(t) && (t != null && t.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
2993
2993
|
}
|
|
2994
2994
|
function Jr(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
|
-
n =
|
|
2998
|
+
n = P({}, s, n);
|
|
2999
2999
|
}
|
|
3000
3000
|
return Me(de(n, e, t));
|
|
3001
3001
|
}
|
|
@@ -3011,9 +3011,20 @@ function Hr(r, e, t) {
|
|
|
3011
3011
|
s.push(B().optional());
|
|
3012
3012
|
return Ur(s).rest(B()).optional();
|
|
3013
3013
|
}
|
|
3014
|
+
const Yr = /* @__PURE__ */ new Set([
|
|
3015
|
+
"_requiredOnly",
|
|
3016
|
+
"_schemaObj",
|
|
3017
|
+
"_input",
|
|
3018
|
+
"_isList",
|
|
3019
|
+
"_isArrayItem",
|
|
3020
|
+
"_isTuple",
|
|
3021
|
+
"_schema"
|
|
3022
|
+
]);
|
|
3014
3023
|
function de(r, e, t) {
|
|
3015
3024
|
const n = {};
|
|
3016
3025
|
return Object.keys(r).forEach((a) => {
|
|
3026
|
+
if (Yr.has(a))
|
|
3027
|
+
return;
|
|
3017
3028
|
const {
|
|
3018
3029
|
_requiredOnly: s,
|
|
3019
3030
|
_schemaObj: i,
|
|
@@ -3032,21 +3043,26 @@ function de(r, e, t) {
|
|
|
3032
3043
|
}
|
|
3033
3044
|
}
|
|
3034
3045
|
if (u && i && o) {
|
|
3035
|
-
const h = Me(de(i, e, t)), v =
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
]), S =
|
|
3046
|
+
const h = Me(de(i, e, t)), v = Fe([
|
|
3047
|
+
Vt(h).optional(),
|
|
3048
|
+
De(o, t)
|
|
3049
|
+
]), S = wt(y, o, e, t, v);
|
|
3039
3050
|
n[a] = S;
|
|
3040
3051
|
} else if (c && o) {
|
|
3041
|
-
const h = i != null && i.___array ? de({ ___array: i.___array }, e, t) : { ___array: B() }, v =
|
|
3052
|
+
const h = i != null && i.___array ? de({ ___array: i.___array }, e, t) : { ___array: B() }, v = Gr(h, o, t), S = wt(y, o, e, t, v);
|
|
3042
3053
|
n[a] = S;
|
|
3043
3054
|
} else if (y && o) {
|
|
3044
|
-
const h =
|
|
3055
|
+
const h = Qr(y, o, e, t);
|
|
3045
3056
|
n[a] = h;
|
|
3046
|
-
} else s && o
|
|
3057
|
+
} else if (s && o)
|
|
3058
|
+
n[a] = Be(o, t);
|
|
3059
|
+
else {
|
|
3060
|
+
const h = Me(de(r[a], e, t)).optional();
|
|
3061
|
+
n[a] = o ? Fe([h, De(o, t)]) : h;
|
|
3062
|
+
}
|
|
3047
3063
|
}), n;
|
|
3048
3064
|
}
|
|
3049
|
-
function
|
|
3065
|
+
function De(r, e) {
|
|
3050
3066
|
return Br().superRefine((t, n) => {
|
|
3051
3067
|
var a;
|
|
3052
3068
|
if ((a = e == null ? void 0 : e.validationConfig) != null && a.globalValidation) {
|
|
@@ -3062,16 +3078,16 @@ function Vt(r, e) {
|
|
|
3062
3078
|
return !0;
|
|
3063
3079
|
});
|
|
3064
3080
|
}
|
|
3065
|
-
function
|
|
3066
|
-
return
|
|
3081
|
+
function Gr(r, e, t) {
|
|
3082
|
+
return Fe([Vt(r.___array).optional(), De(e, t)]);
|
|
3067
3083
|
}
|
|
3068
|
-
function
|
|
3084
|
+
function Qr(r, e, t, n) {
|
|
3069
3085
|
return B().optional().superRefine(async (a, s) => {
|
|
3070
3086
|
var o, u;
|
|
3071
|
-
if (e.required && !(await
|
|
3087
|
+
if (e.required && !(await Be(e, n).safeParseAsync(a)).success)
|
|
3072
3088
|
return s.addIssue({
|
|
3073
3089
|
code: l.custom,
|
|
3074
|
-
message:
|
|
3090
|
+
message: Le(e, n)
|
|
3075
3091
|
}), Q;
|
|
3076
3092
|
if ((o = n == null ? void 0 : n.validationConfig) != null && o.globalValidation) {
|
|
3077
3093
|
const c = (u = n == null ? void 0 : n.validationConfig) == null ? void 0 : u.globalValidation(a, e, n.metadata);
|
|
@@ -3087,7 +3103,7 @@ function Gr(r, e, t, n) {
|
|
|
3087
3103
|
if (i) {
|
|
3088
3104
|
const c = await i.safeParseAsync(a);
|
|
3089
3105
|
if (!c.success) {
|
|
3090
|
-
const d = ce(c == null ? void 0 : c.error.message), y = d === "Required" ?
|
|
3106
|
+
const d = ce(c == null ? void 0 : c.error.message), y = d === "Required" ? Le(e, n) : d;
|
|
3091
3107
|
s.addIssue({
|
|
3092
3108
|
code: l.custom,
|
|
3093
3109
|
message: y
|
|
@@ -3096,10 +3112,10 @@ function Gr(r, e, t, n) {
|
|
|
3096
3112
|
}
|
|
3097
3113
|
});
|
|
3098
3114
|
}
|
|
3099
|
-
function
|
|
3115
|
+
function wt(r, e, t, n, a) {
|
|
3100
3116
|
return B().optional().superRefine(async (s, i) => {
|
|
3101
3117
|
var d, y;
|
|
3102
|
-
const u = await
|
|
3118
|
+
const u = await Be(e, n).safeParseAsync(s);
|
|
3103
3119
|
if (e.required && !u.success) {
|
|
3104
3120
|
const h = ce(u.error.message);
|
|
3105
3121
|
return i.addIssue({ code: l.custom, message: h, fatal: !0 }), Q;
|
|
@@ -3138,14 +3154,14 @@ function _e(r, e, t, n, a) {
|
|
|
3138
3154
|
const i = t;
|
|
3139
3155
|
if (!s.isVisible || (o = s.isVisible) != null && o.call(s, i, n == null ? void 0 : n.metadata)) {
|
|
3140
3156
|
const S = E(r, s.path);
|
|
3141
|
-
if ((u = s.validation) != null && u.schema ?
|
|
3157
|
+
if ((u = s.validation) != null && u.schema ? P(
|
|
3142
3158
|
r,
|
|
3143
3159
|
s.path,
|
|
3144
|
-
|
|
3160
|
+
ee(S, {
|
|
3145
3161
|
_schema: (c = s.validation) == null ? void 0 : c.schema,
|
|
3146
3162
|
_input: s
|
|
3147
3163
|
})
|
|
3148
|
-
) : s.required &&
|
|
3164
|
+
) : s.required && P(r, s.path, ee(S, { _requiredOnly: !0, _input: s })), s.inputs && (s.path && P(r, s.path, ee(E(r, s.path), { _input: s })), _e(r, s.inputs, t, n)), s.inputType === "list") {
|
|
3149
3165
|
const w = {};
|
|
3150
3166
|
_e(
|
|
3151
3167
|
w,
|
|
@@ -3157,7 +3173,7 @@ function _e(r, e, t, n, a) {
|
|
|
3157
3173
|
n
|
|
3158
3174
|
);
|
|
3159
3175
|
const R = E(r, s.path);
|
|
3160
|
-
|
|
3176
|
+
P(r, s.path, ee(R, { _schemaObj: w, _isList: !0, _input: s }));
|
|
3161
3177
|
}
|
|
3162
3178
|
if (!((h = s.validation) != null && h.schema) && s.inputType === "array") {
|
|
3163
3179
|
const w = {};
|
|
@@ -3166,10 +3182,10 @@ function _e(r, e, t, n, a) {
|
|
|
3166
3182
|
[{ ...s.inputConfig.input, path: "___array" }],
|
|
3167
3183
|
t,
|
|
3168
3184
|
n
|
|
3169
|
-
),
|
|
3185
|
+
), P(
|
|
3170
3186
|
r,
|
|
3171
3187
|
s.path,
|
|
3172
|
-
|
|
3188
|
+
ee(S, {
|
|
3173
3189
|
_schemaObj: w,
|
|
3174
3190
|
_schema: (v = s.validation) == null ? void 0 : v.schema,
|
|
3175
3191
|
_isArrayItem: !0,
|
|
@@ -3192,17 +3208,17 @@ function _e(r, e, t, n, a) {
|
|
|
3192
3208
|
}
|
|
3193
3209
|
});
|
|
3194
3210
|
}
|
|
3195
|
-
function
|
|
3211
|
+
function Le(r, e) {
|
|
3196
3212
|
var t, n, a;
|
|
3197
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) ?? Wr;
|
|
3198
3214
|
}
|
|
3199
|
-
function
|
|
3215
|
+
function Be(r, e) {
|
|
3200
3216
|
var n, a, s, i, o, u;
|
|
3201
3217
|
if ((a = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredSchemaPerInput) != null && a[r.inputType])
|
|
3202
3218
|
return (i = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : i[r.inputType];
|
|
3203
3219
|
if ((o = e == null ? void 0 : e.validationConfig) != null && o.requiredSchema)
|
|
3204
3220
|
return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
|
|
3205
|
-
const t =
|
|
3221
|
+
const t = Le(r, e);
|
|
3206
3222
|
return B().optional().superRefine((c, d) => {
|
|
3207
3223
|
typeof c == "object" && Ce(c) && d.addIssue({
|
|
3208
3224
|
code: l.custom,
|
|
@@ -3219,7 +3235,7 @@ function Zt(r, e) {
|
|
|
3219
3235
|
if (typeof r == "function")
|
|
3220
3236
|
return r(e);
|
|
3221
3237
|
}
|
|
3222
|
-
const
|
|
3238
|
+
const Xr = (r) => Array.isArray(r == null ? void 0 : r.errors), Kr = (r, e) => {
|
|
3223
3239
|
const t = {};
|
|
3224
3240
|
for (; r.length; ) {
|
|
3225
3241
|
const n = r[0], { code: a, message: s, path: i } = n, o = i.join(".");
|
|
@@ -3247,7 +3263,7 @@ const Qr = (r) => Array.isArray(r == null ? void 0 : r.errors), Xr = (r, e) => {
|
|
|
3247
3263
|
}
|
|
3248
3264
|
return t;
|
|
3249
3265
|
};
|
|
3250
|
-
function
|
|
3266
|
+
function _n(r, e) {
|
|
3251
3267
|
return Xt(
|
|
3252
3268
|
async (t, n, a) => {
|
|
3253
3269
|
try {
|
|
@@ -3256,10 +3272,10 @@ function gn(r, e) {
|
|
|
3256
3272
|
errors: {}
|
|
3257
3273
|
};
|
|
3258
3274
|
} catch (s) {
|
|
3259
|
-
if (
|
|
3275
|
+
if (Xr(s))
|
|
3260
3276
|
return {
|
|
3261
3277
|
values: {},
|
|
3262
|
-
errors: or(
|
|
3278
|
+
errors: or(Kr(s.errors, !0), a)
|
|
3263
3279
|
};
|
|
3264
3280
|
throw s;
|
|
3265
3281
|
}
|
|
@@ -3267,13 +3283,13 @@ function gn(r, e) {
|
|
|
3267
3283
|
[r, e]
|
|
3268
3284
|
);
|
|
3269
3285
|
}
|
|
3270
|
-
const
|
|
3286
|
+
const Ae = (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;
|
|
3271
3287
|
function ve(r, e, t) {
|
|
3272
|
-
E(r, e) === void 0 && t === void 0 ||
|
|
3288
|
+
E(r, e) === void 0 && t === void 0 || P(r, e, t);
|
|
3273
3289
|
}
|
|
3274
|
-
function
|
|
3290
|
+
function en(r, e) {
|
|
3275
3291
|
const t = le(r), n = e.filter((o) => o.inputPriority === "early"), a = e.filter((o) => o.inputPriority === "normal"), s = e.filter((o) => o.inputPriority === "late");
|
|
3276
|
-
return n.sort(
|
|
3292
|
+
return n.sort(Ae), a.sort(Ae), s.sort(Ae), [...n, ...a, ...s].forEach((o) => {
|
|
3277
3293
|
if (o.inputTransform) {
|
|
3278
3294
|
const u = J(o.inputTransform) ? o.inputTransform : [o.inputTransform];
|
|
3279
3295
|
let c;
|
|
@@ -3290,9 +3306,9 @@ function Kr(r, e) {
|
|
|
3290
3306
|
}
|
|
3291
3307
|
}), t;
|
|
3292
3308
|
}
|
|
3293
|
-
function
|
|
3309
|
+
function tn(r, e, t) {
|
|
3294
3310
|
const n = e.filter((d) => d.outputPriority === "early"), a = e.filter((d) => d.outputPriority === "normal"), s = e.filter((d) => d.outputPriority === "late");
|
|
3295
|
-
n.sort(
|
|
3311
|
+
n.sort(je), a.sort(je), s.sort(je);
|
|
3296
3312
|
const i = [...n, ...a, ...s], o = [];
|
|
3297
3313
|
let u = {};
|
|
3298
3314
|
t || (u = le(r));
|
|
@@ -3308,7 +3324,7 @@ function en(r, e, t) {
|
|
|
3308
3324
|
if (w.merge) {
|
|
3309
3325
|
const R = E(u, w.path);
|
|
3310
3326
|
let T;
|
|
3311
|
-
R ? T =
|
|
3327
|
+
R ? T = ee({}, R, w.value) : T = w.value, ve(u, w.path, T);
|
|
3312
3328
|
} else
|
|
3313
3329
|
ve(u, w.path, w.value);
|
|
3314
3330
|
w.unset && o.push(d.path);
|
|
@@ -3317,21 +3333,21 @@ function en(r, e, t) {
|
|
|
3317
3333
|
});
|
|
3318
3334
|
}
|
|
3319
3335
|
}), o.forEach((d) => {
|
|
3320
|
-
|
|
3336
|
+
Ot(u, d);
|
|
3321
3337
|
}), u;
|
|
3322
3338
|
}
|
|
3323
|
-
function
|
|
3324
|
-
return r.reduce((t, n) => Array.isArray(n.inputs) ? [...t, n, ...
|
|
3339
|
+
function Ue(r) {
|
|
3340
|
+
return r.reduce((t, n) => Array.isArray(n.inputs) ? [...t, n, ...Ue(n.inputs)] : [...t, n], []);
|
|
3325
3341
|
}
|
|
3326
|
-
const
|
|
3342
|
+
const rn = (r) => {
|
|
3327
3343
|
if (r !== void 0)
|
|
3328
3344
|
return { value: r };
|
|
3329
|
-
},
|
|
3345
|
+
}, nn = (r) => {
|
|
3330
3346
|
if (r !== void 0)
|
|
3331
3347
|
return { value: r };
|
|
3332
3348
|
};
|
|
3333
3349
|
function Pt(r, e) {
|
|
3334
|
-
return
|
|
3350
|
+
return Ue(r.inputs).reduce((a, s) => {
|
|
3335
3351
|
var h, v;
|
|
3336
3352
|
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";
|
|
3337
3353
|
return o || u ? a.push({
|
|
@@ -3344,8 +3360,8 @@ function Pt(r, e) {
|
|
|
3344
3360
|
outputPriority: ((v = s.transformerPriority) == null ? void 0 : v.output) ?? "normal"
|
|
3345
3361
|
}) : e && !(c || d) && a.push({
|
|
3346
3362
|
path: s.path,
|
|
3347
|
-
inputTransform:
|
|
3348
|
-
outputTransform:
|
|
3363
|
+
inputTransform: rn,
|
|
3364
|
+
outputTransform: nn,
|
|
3349
3365
|
level: s.path.split(".").length,
|
|
3350
3366
|
isPrimitive: i,
|
|
3351
3367
|
inputPriority: "normal",
|
|
@@ -3353,31 +3369,31 @@ function Pt(r, e) {
|
|
|
3353
3369
|
}), a;
|
|
3354
3370
|
}, []);
|
|
3355
3371
|
}
|
|
3356
|
-
function
|
|
3357
|
-
const { preserve: a } = n, s =
|
|
3372
|
+
function sn(r, e, t, n = {}) {
|
|
3373
|
+
const { preserve: a } = n, s = Ue(r.inputs), i = le(e);
|
|
3358
3374
|
return s.forEach((o) => {
|
|
3359
|
-
a && a.includes(o.path) || o.isVisible && !o.isVisible(e, t) &&
|
|
3375
|
+
a && a.includes(o.path) || o.isVisible && !o.isVisible(e, t) && Ot(i, o.path);
|
|
3360
3376
|
}), i;
|
|
3361
3377
|
}
|
|
3362
|
-
function
|
|
3378
|
+
function vn(r, e) {
|
|
3363
3379
|
const t = Pt(e);
|
|
3364
|
-
return
|
|
3380
|
+
return en(r, t);
|
|
3365
3381
|
}
|
|
3366
|
-
function
|
|
3382
|
+
function xn(r, e, t, n = {}) {
|
|
3367
3383
|
const a = n.cleanOutput, s = Pt(e, a);
|
|
3368
|
-
let i =
|
|
3369
|
-
return i =
|
|
3384
|
+
let i = sn(e, r, t, n);
|
|
3385
|
+
return i = tn(i, s, n.cleanOutput), i = gr(i), i;
|
|
3370
3386
|
}
|
|
3371
|
-
function
|
|
3387
|
+
function bn(r) {
|
|
3372
3388
|
const e = {}, t = (n) => {
|
|
3373
3389
|
n.forEach((a) => {
|
|
3374
3390
|
const { default: s, path: i, inputs: o } = a;
|
|
3375
|
-
Array.isArray(o) ? t(o) : s !== void 0 &&
|
|
3391
|
+
Array.isArray(o) ? t(o) : s !== void 0 && P(e, i, s);
|
|
3376
3392
|
});
|
|
3377
3393
|
};
|
|
3378
3394
|
return Array.isArray(r.inputs) && t(r.inputs), e;
|
|
3379
3395
|
}
|
|
3380
|
-
function
|
|
3396
|
+
function kn() {
|
|
3381
3397
|
return function(r, e) {
|
|
3382
3398
|
if (!(typeof r > "u"))
|
|
3383
3399
|
return !r || !qt(r) ? { value: r } : {
|
|
@@ -3385,7 +3401,7 @@ function bn() {
|
|
|
3385
3401
|
};
|
|
3386
3402
|
};
|
|
3387
3403
|
}
|
|
3388
|
-
function
|
|
3404
|
+
function wn(r) {
|
|
3389
3405
|
return function(e) {
|
|
3390
3406
|
if (typeof e > "u") return;
|
|
3391
3407
|
if (!e || !J(e)) return { value: e };
|
|
@@ -3398,18 +3414,18 @@ function kn(r) {
|
|
|
3398
3414
|
return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
|
|
3399
3415
|
};
|
|
3400
3416
|
}
|
|
3401
|
-
function
|
|
3417
|
+
function Tn() {
|
|
3402
3418
|
return function(r) {
|
|
3403
3419
|
if (!(typeof r > "u"))
|
|
3404
3420
|
return J(r) && Ce(r) ? { value: void 0 } : { value: r };
|
|
3405
3421
|
};
|
|
3406
3422
|
}
|
|
3407
|
-
function
|
|
3423
|
+
function Cn(r, e) {
|
|
3408
3424
|
return function(t, n, a, s) {
|
|
3409
3425
|
let i;
|
|
3410
3426
|
if (r ? i = E(e && s ? s : n, r) : i = e ? a : t, !(typeof i > "u")) {
|
|
3411
|
-
if (
|
|
3412
|
-
if (
|
|
3427
|
+
if (St(i)) return { value: void 0, path: r };
|
|
3428
|
+
if (Ct(i)) {
|
|
3413
3429
|
const o = Mt(le(i));
|
|
3414
3430
|
return Object.getOwnPropertyNames(o).length === 0 ? { value: void 0, path: r } : void 0;
|
|
3415
3431
|
}
|
|
@@ -3417,13 +3433,13 @@ function Tn(r, e) {
|
|
|
3417
3433
|
}
|
|
3418
3434
|
};
|
|
3419
3435
|
}
|
|
3420
|
-
function
|
|
3436
|
+
function On() {
|
|
3421
3437
|
return function(r) {
|
|
3422
3438
|
if (!(typeof r > "u"))
|
|
3423
3439
|
return zt(r) && Ce(r) ? { value: void 0 } : { value: r };
|
|
3424
3440
|
};
|
|
3425
3441
|
}
|
|
3426
|
-
function
|
|
3442
|
+
function Sn(r) {
|
|
3427
3443
|
return function(e, t) {
|
|
3428
3444
|
const n = E(t, r);
|
|
3429
3445
|
if (typeof n == "string")
|
|
@@ -3432,7 +3448,7 @@ function On(r) {
|
|
|
3432
3448
|
return { value: e };
|
|
3433
3449
|
};
|
|
3434
3450
|
}
|
|
3435
|
-
function
|
|
3451
|
+
function Rn(r) {
|
|
3436
3452
|
return function(e, t, n, a) {
|
|
3437
3453
|
if (typeof e > "u") return;
|
|
3438
3454
|
if (!e) return { value: e };
|
|
@@ -3445,7 +3461,7 @@ function Sn(r) {
|
|
|
3445
3461
|
return { value: e };
|
|
3446
3462
|
};
|
|
3447
3463
|
}
|
|
3448
|
-
function
|
|
3464
|
+
function En(r) {
|
|
3449
3465
|
return function(e, t) {
|
|
3450
3466
|
const n = E(t, r);
|
|
3451
3467
|
if (typeof n == "string")
|
|
@@ -3454,7 +3470,7 @@ function Rn(r) {
|
|
|
3454
3470
|
return { value: e };
|
|
3455
3471
|
};
|
|
3456
3472
|
}
|
|
3457
|
-
function
|
|
3473
|
+
function An(r, e) {
|
|
3458
3474
|
return function(t, n) {
|
|
3459
3475
|
if (typeof t > "u") return;
|
|
3460
3476
|
if (!t) return { value: t };
|
|
@@ -3474,29 +3490,29 @@ function $t(r) {
|
|
|
3474
3490
|
function Mt(r) {
|
|
3475
3491
|
return Bt(r, (e) => typeof e == "object" ? $t(e) : Oe(e));
|
|
3476
3492
|
}
|
|
3477
|
-
function
|
|
3493
|
+
function qe(r) {
|
|
3478
3494
|
const { items: e, className: t, withoutWrapper: n = !0, ...a } = r, s = e.map((i) => /* @__PURE__ */ O.jsx(pr, { input: i, path: i.path, ...a }, `${i.inputType}_${i.path}`));
|
|
3479
3495
|
return n ? /* @__PURE__ */ O.jsx(O.Fragment, { children: s }) : /* @__PURE__ */ O.jsx("div", { className: t, children: s });
|
|
3480
3496
|
}
|
|
3481
|
-
|
|
3482
|
-
const
|
|
3497
|
+
qe.displayName = "RenderInputs";
|
|
3498
|
+
const an = Kt((r, e) => {
|
|
3483
3499
|
const { inputs: t, className: n, factory: a, withoutWrapper: s } = r;
|
|
3484
3500
|
return s ? /* @__PURE__ */ O.jsxs(er, { children: [
|
|
3485
3501
|
t.hero,
|
|
3486
|
-
/* @__PURE__ */ O.jsx(
|
|
3502
|
+
/* @__PURE__ */ O.jsx(qe, { items: t.inputs, factory: a })
|
|
3487
3503
|
] }) : /* @__PURE__ */ O.jsxs("div", { className: n, ref: e, children: [
|
|
3488
3504
|
t.hero,
|
|
3489
|
-
/* @__PURE__ */ O.jsx(
|
|
3505
|
+
/* @__PURE__ */ O.jsx(qe, { items: t.inputs, factory: a })
|
|
3490
3506
|
] });
|
|
3491
3507
|
});
|
|
3492
|
-
|
|
3508
|
+
an.displayName = "RenderForm";
|
|
3493
3509
|
function jn(r) {
|
|
3494
3510
|
let e = !0;
|
|
3495
|
-
return
|
|
3496
|
-
e = e && (t === "" ||
|
|
3511
|
+
return Tt(r, (t) => {
|
|
3512
|
+
e = e && (t === "" || St(t) || Oe(t));
|
|
3497
3513
|
}), e;
|
|
3498
3514
|
}
|
|
3499
|
-
const
|
|
3515
|
+
const In = (r = "") => Wt(r.split("_").join(" ")), on = (r, e = 2, t, n = 1e3) => {
|
|
3500
3516
|
let a = !1;
|
|
3501
3517
|
const s = () => {
|
|
3502
3518
|
requestAnimationFrame(() => {
|
|
@@ -3508,7 +3524,7 @@ const An = (r = "") => Wt(r.split("_").join(" ")), an = (r, e = 2, t, n = 1e3) =
|
|
|
3508
3524
|
a = !0;
|
|
3509
3525
|
});
|
|
3510
3526
|
};
|
|
3511
|
-
function
|
|
3527
|
+
function Nn(r, e) {
|
|
3512
3528
|
return {
|
|
3513
3529
|
...r,
|
|
3514
3530
|
inputs: r.inputs.map((t) => D(t, e))
|
|
@@ -3547,7 +3563,7 @@ function D(r, e) {
|
|
|
3547
3563
|
}
|
|
3548
3564
|
return o;
|
|
3549
3565
|
}
|
|
3550
|
-
function
|
|
3566
|
+
function Vn(r) {
|
|
3551
3567
|
const {
|
|
3552
3568
|
field: { onBlur: e, ...t },
|
|
3553
3569
|
...n
|
|
@@ -3556,57 +3572,57 @@ function Nn(r) {
|
|
|
3556
3572
|
...n,
|
|
3557
3573
|
field: {
|
|
3558
3574
|
...t,
|
|
3559
|
-
onBlur:
|
|
3575
|
+
onBlur: on(e, 2, a.current)
|
|
3560
3576
|
}
|
|
3561
3577
|
};
|
|
3562
3578
|
}
|
|
3563
3579
|
export {
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3580
|
+
$n as Controller,
|
|
3581
|
+
Mn as Form,
|
|
3582
|
+
Fn as FormProvider,
|
|
3583
|
+
hn as InputComponent,
|
|
3568
3584
|
pr as InputComponentRenderer,
|
|
3569
|
-
|
|
3585
|
+
Rt as InputFactory,
|
|
3570
3586
|
ur as InputOverrideError,
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3587
|
+
an as RenderForm,
|
|
3588
|
+
qe as RenderInputs,
|
|
3589
|
+
mn as RootForm,
|
|
3590
|
+
on as afterFrames,
|
|
3591
|
+
Nn as applyFormOverrides,
|
|
3576
3592
|
D as applyInputOverride,
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3593
|
+
wn as arrayToObjectOutputTransformer,
|
|
3594
|
+
bn as collectDefaultValues,
|
|
3595
|
+
vn as convertDataToFormModel,
|
|
3596
|
+
xn as convertFormModelToData,
|
|
3597
|
+
In as generateReadableLabel,
|
|
3598
|
+
Dn as get,
|
|
3599
|
+
pn as getDefaultValuesFromFormDefinition,
|
|
3600
|
+
gn as getTemporaryPath,
|
|
3585
3601
|
Pt as getTransformers,
|
|
3586
3602
|
Jr as getValidationSchema,
|
|
3587
|
-
|
|
3603
|
+
en as inputTransformValues,
|
|
3588
3604
|
jn as isChildrenEmpty,
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3605
|
+
kn as objectToArrayInputTransformer,
|
|
3606
|
+
tn as outputTransformValues,
|
|
3607
|
+
yn as overrideFormDefinition,
|
|
3592
3608
|
ce as processValidationParseResponse,
|
|
3593
3609
|
gr as removeTemporaryFieldsValue,
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3610
|
+
Ln as set,
|
|
3611
|
+
En as shorthandArrayInputTransformer,
|
|
3612
|
+
An as shorthandArrayOutputTransformer,
|
|
3613
|
+
Sn as shorthandObjectInputTransformer,
|
|
3614
|
+
Rn as shorthandObjectOutputTransformer,
|
|
3615
|
+
Tn as unsetEmptyArrayOutputTransformer,
|
|
3616
|
+
Cn as unsetEmptyObjectOutputTransformer,
|
|
3617
|
+
On as unsetEmptyStringOutputTransformer,
|
|
3618
|
+
sn as unsetHiddenInputsValues,
|
|
3619
|
+
Vn as useController,
|
|
3620
|
+
qn as useFieldArray,
|
|
3621
|
+
zn as useForm,
|
|
3622
|
+
Bn as useFormContext,
|
|
3623
|
+
Un as useFormState,
|
|
3608
3624
|
hr as useRootFormContext,
|
|
3609
|
-
|
|
3610
|
-
|
|
3625
|
+
Wn as useWatch,
|
|
3626
|
+
_n as useZodValidationResolver
|
|
3611
3627
|
};
|
|
3612
3628
|
//# sourceMappingURL=index.js.map
|