hplx-feature-library 1.0.175 → 1.0.177
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/APIAction-GKwgCFa7.cjs +1 -0
- package/dist/{index-nNWK2dDb.js → APIAction-owCQeK4h.js} +1 -1
- package/dist/AllInvestigations/index.js +1 -1
- package/dist/{AllInvestigationsTable-txmu7PTJ.js → AllInvestigationsTable-230u6fB3.js} +40 -38
- package/dist/{AllInvestigationsTable-C7uQ56B0.cjs → AllInvestigationsTable-BDLPOHjr.cjs} +4 -4
- package/dist/NineDots/index.js +4 -0
- package/dist/NineDots-Cy5GdMqh.cjs +3 -0
- package/dist/NineDots-Q7DH5xQq.js +1787 -0
- package/dist/{components → PatientAddEdit/components}/PatientAddEdit.d.ts +1 -1
- package/dist/PatientAddEdit/index.d.ts +1 -0
- package/dist/PatientAddEdit/index.js +2 -1661
- package/dist/PatientAddEdit-D-PuyA4h.cjs +7 -0
- package/dist/PatientAddEdit-MgBWiJqX.js +1665 -0
- package/dist/PatientPopup/components/bills/Bills.d.ts +3 -1
- package/dist/PatientPopup/index.js +1 -1
- package/dist/PatientPopupContainer-BREW2AZX.cjs +36 -0
- package/dist/{PatientPopupContainer-BSWU5CPk.js → PatientPopupContainer-CyTTjYhk.js} +3976 -3967
- package/dist/{PrintModal-BeR4-UcB.js → PrintModal-BR_tTgyn.js} +2 -1
- package/dist/{PrintModal-PPpn_LGy.cjs → PrintModal-CaqANEG3.cjs} +8 -8
- package/dist/{components → SearchPatients/components}/SearchPatients.d.ts +1 -1
- package/dist/SearchPatients/index.d.ts +1 -0
- package/dist/SearchPatients/index.js +4 -0
- package/dist/SearchPatients-BEQ0kjtj.js +233 -0
- package/dist/SearchPatients-eiOJOnND.cjs +1 -0
- package/dist/UserProfile/index.js +4 -0
- package/dist/UserProfile-Bs3EzSqu.js +1761 -0
- package/dist/UserProfile-C4cNhkeg.cjs +14 -0
- package/dist/common-utils-CDvwCtzy.js +2328 -0
- package/dist/common-utils-lI6oOpoS.cjs +6 -0
- package/dist/hplx-feature-library.css +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.esm-BdlMQ1M7.cjs +4 -0
- package/dist/index.esm-Bn1Rklqj.js +1275 -0
- package/dist/index.js +16 -2023
- package/dist/nineDots/{nineDots.d.ts → NineDots.d.ts} +1 -1
- package/dist/nineDots/NineDotsUtils.d.ts +1 -1
- package/dist/nineDots/index.d.ts +1 -0
- package/dist/print-pdf/index.js +1 -1
- package/dist/types/AllInvestigationTypes.d.ts +2 -0
- package/dist/useMediaQuery-CZAbdJzN.js +13 -0
- package/dist/useMediaQuery-D4SIgdMW.cjs +1 -0
- package/dist/userProfile/index.d.ts +1 -0
- package/package.json +22 -11
- package/dist/PatientPopupContainer-nZZA67ZY.cjs +0 -36
- package/dist/index-Cy8OvNyb.cjs +0 -1
- package/dist/index.esm-BJMiy-rl.js +0 -3597
- package/dist/index.esm-DvJKLbVG.cjs +0 -9
- /package/dist/{nineDots → types}/NineDotsTypes.d.ts +0 -0
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
var U, B;
|
|
2
|
+
function lt() {
|
|
3
|
+
if (B) return U;
|
|
4
|
+
B = 1;
|
|
5
|
+
function s(o) {
|
|
6
|
+
this._maxSize = o, this.clear();
|
|
7
|
+
}
|
|
8
|
+
s.prototype.clear = function() {
|
|
9
|
+
this._size = 0, this._values = /* @__PURE__ */ Object.create(null);
|
|
10
|
+
}, s.prototype.get = function(o) {
|
|
11
|
+
return this._values[o];
|
|
12
|
+
}, s.prototype.set = function(o, f) {
|
|
13
|
+
return this._size >= this._maxSize && this.clear(), o in this._values || this._size++, this._values[o] = f;
|
|
14
|
+
};
|
|
15
|
+
var t = /[^.^\]^[]+|(?=\[\]|\.\.)/g, e = /^\d+$/, r = /^\d/, n = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, i = /^\s*(['"]?)(.*?)(\1)\s*$/, a = 512, l = new s(a), u = new s(a), c = new s(a);
|
|
16
|
+
U = {
|
|
17
|
+
Cache: s,
|
|
18
|
+
split: p,
|
|
19
|
+
normalizePath: h,
|
|
20
|
+
setter: function(o) {
|
|
21
|
+
var f = h(o);
|
|
22
|
+
return u.get(o) || u.set(o, function(T, m) {
|
|
23
|
+
for (var y = 0, _ = f.length, k = T; y < _ - 1; ) {
|
|
24
|
+
var D = f[y];
|
|
25
|
+
if (D === "__proto__" || D === "constructor" || D === "prototype")
|
|
26
|
+
return T;
|
|
27
|
+
k = k[f[y++]];
|
|
28
|
+
}
|
|
29
|
+
k[f[y]] = m;
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
getter: function(o, f) {
|
|
33
|
+
var F = h(o);
|
|
34
|
+
return c.get(o) || c.set(o, function(m) {
|
|
35
|
+
for (var y = 0, _ = F.length; y < _; )
|
|
36
|
+
if (m != null || !f) m = m[F[y++]];
|
|
37
|
+
else return;
|
|
38
|
+
return m;
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
join: function(o) {
|
|
42
|
+
return o.reduce(function(f, F) {
|
|
43
|
+
return f + (d(F) || e.test(F) ? "[" + F + "]" : (f ? "." : "") + F);
|
|
44
|
+
}, "");
|
|
45
|
+
},
|
|
46
|
+
forEach: function(o, f, F) {
|
|
47
|
+
$(Array.isArray(o) ? o : p(o), f, F);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function h(o) {
|
|
51
|
+
return l.get(o) || l.set(
|
|
52
|
+
o,
|
|
53
|
+
p(o).map(function(f) {
|
|
54
|
+
return f.replace(i, "$2");
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function p(o) {
|
|
59
|
+
return o.match(t) || [""];
|
|
60
|
+
}
|
|
61
|
+
function $(o, f, F) {
|
|
62
|
+
var T = o.length, m, y, _, k;
|
|
63
|
+
for (y = 0; y < T; y++)
|
|
64
|
+
m = o[y], m && (S(m) && (m = '"' + m + '"'), k = d(m), _ = !k && /^\d+$/.test(m), f.call(F, m, k, _, y, o));
|
|
65
|
+
}
|
|
66
|
+
function d(o) {
|
|
67
|
+
return typeof o == "string" && o && ["'", '"'].indexOf(o.charAt(0)) !== -1;
|
|
68
|
+
}
|
|
69
|
+
function E(o) {
|
|
70
|
+
return o.match(r) && !o.match(e);
|
|
71
|
+
}
|
|
72
|
+
function b(o) {
|
|
73
|
+
return n.test(o);
|
|
74
|
+
}
|
|
75
|
+
function S(o) {
|
|
76
|
+
return !d(o) && (E(o) || b(o));
|
|
77
|
+
}
|
|
78
|
+
return U;
|
|
79
|
+
}
|
|
80
|
+
var K = lt(), P = { exports: {} }, H;
|
|
81
|
+
function ot() {
|
|
82
|
+
if (H) return P.exports;
|
|
83
|
+
H = 1, P.exports = function(n) {
|
|
84
|
+
return s(t(n), n);
|
|
85
|
+
}, P.exports.array = s;
|
|
86
|
+
function s(n, i) {
|
|
87
|
+
var a = n.length, l = new Array(a), u = {}, c = a, h = e(i), p = r(n);
|
|
88
|
+
for (i.forEach(function(d) {
|
|
89
|
+
if (!p.has(d[0]) || !p.has(d[1]))
|
|
90
|
+
throw new Error("Unknown node. There is an unknown node in the supplied edges.");
|
|
91
|
+
}); c--; )
|
|
92
|
+
u[c] || $(n[c], c, /* @__PURE__ */ new Set());
|
|
93
|
+
return l;
|
|
94
|
+
function $(d, E, b) {
|
|
95
|
+
if (b.has(d)) {
|
|
96
|
+
var S;
|
|
97
|
+
try {
|
|
98
|
+
S = ", node was:" + JSON.stringify(d);
|
|
99
|
+
} catch {
|
|
100
|
+
S = "";
|
|
101
|
+
}
|
|
102
|
+
throw new Error("Cyclic dependency" + S);
|
|
103
|
+
}
|
|
104
|
+
if (!p.has(d))
|
|
105
|
+
throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(d));
|
|
106
|
+
if (!u[E]) {
|
|
107
|
+
u[E] = !0;
|
|
108
|
+
var o = h.get(d) || /* @__PURE__ */ new Set();
|
|
109
|
+
if (o = Array.from(o), E = o.length) {
|
|
110
|
+
b.add(d);
|
|
111
|
+
do {
|
|
112
|
+
var f = o[--E];
|
|
113
|
+
$(f, p.get(f), b);
|
|
114
|
+
} while (E);
|
|
115
|
+
b.delete(d);
|
|
116
|
+
}
|
|
117
|
+
l[--a] = d;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function t(n) {
|
|
122
|
+
for (var i = /* @__PURE__ */ new Set(), a = 0, l = n.length; a < l; a++) {
|
|
123
|
+
var u = n[a];
|
|
124
|
+
i.add(u[0]), i.add(u[1]);
|
|
125
|
+
}
|
|
126
|
+
return Array.from(i);
|
|
127
|
+
}
|
|
128
|
+
function e(n) {
|
|
129
|
+
for (var i = /* @__PURE__ */ new Map(), a = 0, l = n.length; a < l; a++) {
|
|
130
|
+
var u = n[a];
|
|
131
|
+
i.has(u[0]) || i.set(u[0], /* @__PURE__ */ new Set()), i.has(u[1]) || i.set(u[1], /* @__PURE__ */ new Set()), i.get(u[0]).add(u[1]);
|
|
132
|
+
}
|
|
133
|
+
return i;
|
|
134
|
+
}
|
|
135
|
+
function r(n) {
|
|
136
|
+
for (var i = /* @__PURE__ */ new Map(), a = 0, l = n.length; a < l; a++)
|
|
137
|
+
i.set(n[a], a);
|
|
138
|
+
return i;
|
|
139
|
+
}
|
|
140
|
+
return P.exports;
|
|
141
|
+
}
|
|
142
|
+
ot();
|
|
143
|
+
const ct = Object.prototype.toString, ht = Error.prototype.toString, ft = RegExp.prototype.toString, dt = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", pt = /^Symbol\((.*)\)(.*)$/;
|
|
144
|
+
function mt(s) {
|
|
145
|
+
return s != +s ? "NaN" : s === 0 && 1 / s < 0 ? "-0" : "" + s;
|
|
146
|
+
}
|
|
147
|
+
function Q(s, t = !1) {
|
|
148
|
+
if (s == null || s === !0 || s === !1) return "" + s;
|
|
149
|
+
const e = typeof s;
|
|
150
|
+
if (e === "number") return mt(s);
|
|
151
|
+
if (e === "string") return t ? `"${s}"` : s;
|
|
152
|
+
if (e === "function") return "[Function " + (s.name || "anonymous") + "]";
|
|
153
|
+
if (e === "symbol") return dt.call(s).replace(pt, "Symbol($1)");
|
|
154
|
+
const r = ct.call(s).slice(8, -1);
|
|
155
|
+
return r === "Date" ? isNaN(s.getTime()) ? "" + s : s.toISOString(s) : r === "Error" || s instanceof Error ? "[" + ht.call(s) + "]" : r === "RegExp" ? ft.call(s) : null;
|
|
156
|
+
}
|
|
157
|
+
function A(s, t) {
|
|
158
|
+
let e = Q(s, t);
|
|
159
|
+
return e !== null ? e : JSON.stringify(s, function(r, n) {
|
|
160
|
+
let i = Q(this[r], t);
|
|
161
|
+
return i !== null ? i : n;
|
|
162
|
+
}, 2);
|
|
163
|
+
}
|
|
164
|
+
function W(s) {
|
|
165
|
+
return s == null ? [] : [].concat(s);
|
|
166
|
+
}
|
|
167
|
+
let tt, et, rt, yt = /\$\{\s*(\w+)\s*\}/g;
|
|
168
|
+
tt = Symbol.toStringTag;
|
|
169
|
+
class J {
|
|
170
|
+
constructor(t, e, r, n) {
|
|
171
|
+
this.name = void 0, this.message = void 0, this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = void 0, this.inner = void 0, this[tt] = "Error", this.name = "ValidationError", this.value = e, this.path = r, this.type = n, this.errors = [], this.inner = [], W(t).forEach((i) => {
|
|
172
|
+
if (v.isError(i)) {
|
|
173
|
+
this.errors.push(...i.errors);
|
|
174
|
+
const a = i.inner.length ? i.inner : [i];
|
|
175
|
+
this.inner.push(...a);
|
|
176
|
+
} else
|
|
177
|
+
this.errors.push(i);
|
|
178
|
+
}), this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
et = Symbol.hasInstance;
|
|
182
|
+
rt = Symbol.toStringTag;
|
|
183
|
+
class v extends Error {
|
|
184
|
+
static formatError(t, e) {
|
|
185
|
+
const r = e.label || e.path || "this";
|
|
186
|
+
return e = Object.assign({}, e, {
|
|
187
|
+
path: r,
|
|
188
|
+
originalPath: e.path
|
|
189
|
+
}), typeof t == "string" ? t.replace(yt, (n, i) => A(e[i])) : typeof t == "function" ? t(e) : t;
|
|
190
|
+
}
|
|
191
|
+
static isError(t) {
|
|
192
|
+
return t && t.name === "ValidationError";
|
|
193
|
+
}
|
|
194
|
+
constructor(t, e, r, n, i) {
|
|
195
|
+
const a = new J(t, e, r, n);
|
|
196
|
+
if (i)
|
|
197
|
+
return a;
|
|
198
|
+
super(), this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = [], this.inner = [], this[rt] = "Error", this.name = a.name, this.message = a.message, this.type = a.type, this.value = a.value, this.path = a.path, this.errors = a.errors, this.inner = a.inner, Error.captureStackTrace && Error.captureStackTrace(this, v);
|
|
199
|
+
}
|
|
200
|
+
static [et](t) {
|
|
201
|
+
return J[Symbol.hasInstance](t) || super[Symbol.hasInstance](t);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
let x = {
|
|
205
|
+
default: "${path} is invalid",
|
|
206
|
+
required: "${path} is a required field",
|
|
207
|
+
defined: "${path} must be defined",
|
|
208
|
+
notNull: "${path} cannot be null",
|
|
209
|
+
oneOf: "${path} must be one of the following values: ${values}",
|
|
210
|
+
notOneOf: "${path} must not be one of the following values: ${values}",
|
|
211
|
+
notType: ({
|
|
212
|
+
path: s,
|
|
213
|
+
type: t,
|
|
214
|
+
value: e,
|
|
215
|
+
originalValue: r
|
|
216
|
+
}) => {
|
|
217
|
+
const n = r != null && r !== e ? ` (cast from the value \`${A(r, !0)}\`).` : ".";
|
|
218
|
+
return t !== "mixed" ? `${s} must be a \`${t}\` type, but the final value was: \`${A(e, !0)}\`` + n : `${s} must match the configured type. The validated value was: \`${A(e, !0)}\`` + n;
|
|
219
|
+
}
|
|
220
|
+
}, w = {
|
|
221
|
+
length: "${path} must be exactly ${length} characters",
|
|
222
|
+
min: "${path} must be at least ${min} characters",
|
|
223
|
+
max: "${path} must be at most ${max} characters",
|
|
224
|
+
matches: '${path} must match the following: "${regex}"',
|
|
225
|
+
email: "${path} must be a valid email",
|
|
226
|
+
url: "${path} must be a valid URL",
|
|
227
|
+
uuid: "${path} must be a valid UUID",
|
|
228
|
+
datetime: "${path} must be a valid ISO date-time",
|
|
229
|
+
datetime_precision: "${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",
|
|
230
|
+
datetime_offset: '${path} must be a valid ISO date-time with UTC "Z" timezone',
|
|
231
|
+
trim: "${path} must be a trimmed string",
|
|
232
|
+
lowercase: "${path} must be a lowercase string",
|
|
233
|
+
uppercase: "${path} must be a upper case string"
|
|
234
|
+
}, gt = {
|
|
235
|
+
min: "${path} must be greater than or equal to ${min}",
|
|
236
|
+
max: "${path} must be less than or equal to ${max}",
|
|
237
|
+
lessThan: "${path} must be less than ${less}",
|
|
238
|
+
moreThan: "${path} must be greater than ${more}",
|
|
239
|
+
positive: "${path} must be a positive number",
|
|
240
|
+
negative: "${path} must be a negative number",
|
|
241
|
+
integer: "${path} must be an integer"
|
|
242
|
+
}, Z = {
|
|
243
|
+
min: "${path} field must be later than ${min}",
|
|
244
|
+
max: "${path} field must be at earlier than ${max}"
|
|
245
|
+
}, bt = {
|
|
246
|
+
isValue: "${path} field must be ${value}"
|
|
247
|
+
}, Ft = {
|
|
248
|
+
noUnknown: "${path} field has unspecified keys: ${unknown}",
|
|
249
|
+
exact: "${path} object contains unknown properties: ${properties}"
|
|
250
|
+
}, $t = {
|
|
251
|
+
min: "${path} field must have at least ${min} items",
|
|
252
|
+
max: "${path} field must have less than or equal to ${max} items",
|
|
253
|
+
length: "${path} must have ${length} items"
|
|
254
|
+
}, vt = {
|
|
255
|
+
notType: (s) => {
|
|
256
|
+
const {
|
|
257
|
+
path: t,
|
|
258
|
+
value: e,
|
|
259
|
+
spec: r
|
|
260
|
+
} = s, n = r.types.length;
|
|
261
|
+
if (Array.isArray(e)) {
|
|
262
|
+
if (e.length < n) return `${t} tuple value has too few items, expected a length of ${n} but got ${e.length} for value: \`${A(e, !0)}\``;
|
|
263
|
+
if (e.length > n) return `${t} tuple value has too many items, expected a length of ${n} but got ${e.length} for value: \`${A(e, !0)}\``;
|
|
264
|
+
}
|
|
265
|
+
return v.formatError(x.notType, s);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
269
|
+
mixed: x,
|
|
270
|
+
string: w,
|
|
271
|
+
number: gt,
|
|
272
|
+
date: Z,
|
|
273
|
+
object: Ft,
|
|
274
|
+
array: $t,
|
|
275
|
+
boolean: bt,
|
|
276
|
+
tuple: vt
|
|
277
|
+
});
|
|
278
|
+
const st = (s) => s && s.__isYupSchema__;
|
|
279
|
+
class q {
|
|
280
|
+
static fromOptions(t, e) {
|
|
281
|
+
if (!e.then && !e.otherwise) throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
|
|
282
|
+
let {
|
|
283
|
+
is: r,
|
|
284
|
+
then: n,
|
|
285
|
+
otherwise: i
|
|
286
|
+
} = e, a = typeof r == "function" ? r : (...l) => l.every((u) => u === r);
|
|
287
|
+
return new q(t, (l, u) => {
|
|
288
|
+
var c;
|
|
289
|
+
let h = a(...l) ? n : i;
|
|
290
|
+
return (c = h?.(u)) != null ? c : u;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
constructor(t, e) {
|
|
294
|
+
this.fn = void 0, this.refs = t, this.refs = t, this.fn = e;
|
|
295
|
+
}
|
|
296
|
+
resolve(t, e) {
|
|
297
|
+
let r = this.refs.map((i) => (
|
|
298
|
+
// TODO: ? operator here?
|
|
299
|
+
i.getValue(e?.value, e?.parent, e?.context)
|
|
300
|
+
)), n = this.fn(r, t, e);
|
|
301
|
+
if (n === void 0 || // @ts-ignore this can be base
|
|
302
|
+
n === t)
|
|
303
|
+
return t;
|
|
304
|
+
if (!st(n)) throw new TypeError("conditions must return a schema object");
|
|
305
|
+
return n.resolve(e);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const M = {
|
|
309
|
+
context: "$",
|
|
310
|
+
value: "."
|
|
311
|
+
};
|
|
312
|
+
class z {
|
|
313
|
+
constructor(t, e = {}) {
|
|
314
|
+
if (this.key = void 0, this.isContext = void 0, this.isValue = void 0, this.isSibling = void 0, this.path = void 0, this.getter = void 0, this.map = void 0, typeof t != "string") throw new TypeError("ref must be a string, got: " + t);
|
|
315
|
+
if (this.key = t.trim(), t === "") throw new TypeError("ref must be a non-empty string");
|
|
316
|
+
this.isContext = this.key[0] === M.context, this.isValue = this.key[0] === M.value, this.isSibling = !this.isContext && !this.isValue;
|
|
317
|
+
let r = this.isContext ? M.context : this.isValue ? M.value : "";
|
|
318
|
+
this.path = this.key.slice(r.length), this.getter = this.path && K.getter(this.path, !0), this.map = e.map;
|
|
319
|
+
}
|
|
320
|
+
getValue(t, e, r) {
|
|
321
|
+
let n = this.isContext ? r : this.isValue ? t : e;
|
|
322
|
+
return this.getter && (n = this.getter(n || {})), this.map && (n = this.map(n)), n;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
*
|
|
326
|
+
* @param {*} value
|
|
327
|
+
* @param {Object} options
|
|
328
|
+
* @param {Object=} options.context
|
|
329
|
+
* @param {Object=} options.parent
|
|
330
|
+
*/
|
|
331
|
+
cast(t, e) {
|
|
332
|
+
return this.getValue(t, e?.parent, e?.context);
|
|
333
|
+
}
|
|
334
|
+
resolve() {
|
|
335
|
+
return this;
|
|
336
|
+
}
|
|
337
|
+
describe() {
|
|
338
|
+
return {
|
|
339
|
+
type: "ref",
|
|
340
|
+
key: this.key
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
toString() {
|
|
344
|
+
return `Ref(${this.key})`;
|
|
345
|
+
}
|
|
346
|
+
static isRef(t) {
|
|
347
|
+
return t && t.__isYupRef;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
z.prototype.__isYupRef = !0;
|
|
351
|
+
const C = (s) => s == null;
|
|
352
|
+
function j(s) {
|
|
353
|
+
function t({
|
|
354
|
+
value: e,
|
|
355
|
+
path: r = "",
|
|
356
|
+
options: n,
|
|
357
|
+
originalValue: i,
|
|
358
|
+
schema: a
|
|
359
|
+
}, l, u) {
|
|
360
|
+
const {
|
|
361
|
+
name: c,
|
|
362
|
+
test: h,
|
|
363
|
+
params: p,
|
|
364
|
+
message: $,
|
|
365
|
+
skipAbsent: d
|
|
366
|
+
} = s;
|
|
367
|
+
let {
|
|
368
|
+
parent: E,
|
|
369
|
+
context: b,
|
|
370
|
+
abortEarly: S = a.spec.abortEarly,
|
|
371
|
+
disableStackTrace: o = a.spec.disableStackTrace
|
|
372
|
+
} = n;
|
|
373
|
+
const f = {
|
|
374
|
+
value: e,
|
|
375
|
+
parent: E,
|
|
376
|
+
context: b
|
|
377
|
+
};
|
|
378
|
+
function F(g = {}) {
|
|
379
|
+
const R = nt(Object.assign({
|
|
380
|
+
value: e,
|
|
381
|
+
originalValue: i,
|
|
382
|
+
label: a.spec.label,
|
|
383
|
+
path: g.path || r,
|
|
384
|
+
spec: a.spec,
|
|
385
|
+
disableStackTrace: g.disableStackTrace || o
|
|
386
|
+
}, p, g.params), f), X = new v(v.formatError(g.message || $, R), e, R.path, g.type || c, R.disableStackTrace);
|
|
387
|
+
return X.params = R, X;
|
|
388
|
+
}
|
|
389
|
+
const T = S ? l : u;
|
|
390
|
+
let m = {
|
|
391
|
+
path: r,
|
|
392
|
+
parent: E,
|
|
393
|
+
type: c,
|
|
394
|
+
from: n.from,
|
|
395
|
+
createError: F,
|
|
396
|
+
resolve(g) {
|
|
397
|
+
return it(g, f);
|
|
398
|
+
},
|
|
399
|
+
options: n,
|
|
400
|
+
originalValue: i,
|
|
401
|
+
schema: a
|
|
402
|
+
};
|
|
403
|
+
const y = (g) => {
|
|
404
|
+
v.isError(g) ? T(g) : g ? u(null) : T(F());
|
|
405
|
+
}, _ = (g) => {
|
|
406
|
+
v.isError(g) ? T(g) : l(g);
|
|
407
|
+
};
|
|
408
|
+
if (d && C(e))
|
|
409
|
+
return y(!0);
|
|
410
|
+
let D;
|
|
411
|
+
try {
|
|
412
|
+
var Y;
|
|
413
|
+
if (D = h.call(m, e, m), typeof ((Y = D) == null ? void 0 : Y.then) == "function") {
|
|
414
|
+
if (n.sync)
|
|
415
|
+
throw new Error(`Validation test of type: "${m.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
|
|
416
|
+
return Promise.resolve(D).then(y, _);
|
|
417
|
+
}
|
|
418
|
+
} catch (g) {
|
|
419
|
+
_(g);
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
y(D);
|
|
423
|
+
}
|
|
424
|
+
return t.OPTIONS = s, t;
|
|
425
|
+
}
|
|
426
|
+
function nt(s, t) {
|
|
427
|
+
if (!s) return s;
|
|
428
|
+
for (const e of Object.keys(s))
|
|
429
|
+
s[e] = it(s[e], t);
|
|
430
|
+
return s;
|
|
431
|
+
}
|
|
432
|
+
function it(s, t) {
|
|
433
|
+
return z.isRef(s) ? s.getValue(t.value, t.parent, t.context) : s;
|
|
434
|
+
}
|
|
435
|
+
function wt(s, t, e, r = e) {
|
|
436
|
+
let n, i, a;
|
|
437
|
+
return t ? (K.forEach(t, (l, u, c) => {
|
|
438
|
+
let h = u ? l.slice(1, l.length - 1) : l;
|
|
439
|
+
s = s.resolve({
|
|
440
|
+
context: r,
|
|
441
|
+
parent: n,
|
|
442
|
+
value: e
|
|
443
|
+
});
|
|
444
|
+
let p = s.type === "tuple", $ = c ? parseInt(h, 10) : 0;
|
|
445
|
+
if (s.innerType || p) {
|
|
446
|
+
if (p && !c) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${a}" must contain an index to the tuple element, e.g. "${a}[0]"`);
|
|
447
|
+
if (e && $ >= e.length)
|
|
448
|
+
throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${t}. because there is no value at that index. `);
|
|
449
|
+
n = e, e = e && e[$], s = p ? s.spec.types[$] : s.innerType;
|
|
450
|
+
}
|
|
451
|
+
if (!c) {
|
|
452
|
+
if (!s.fields || !s.fields[h]) throw new Error(`The schema does not contain the path: ${t}. (failed at: ${a} which is a type: "${s.type}")`);
|
|
453
|
+
n = e, e = e && e[h], s = s.fields[h];
|
|
454
|
+
}
|
|
455
|
+
i = h, a = u ? "[" + l + "]" : "." + l;
|
|
456
|
+
}), {
|
|
457
|
+
schema: s,
|
|
458
|
+
parent: n,
|
|
459
|
+
parentPath: i
|
|
460
|
+
}) : {
|
|
461
|
+
parent: n,
|
|
462
|
+
parentPath: t,
|
|
463
|
+
schema: s
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
class V extends Set {
|
|
467
|
+
describe() {
|
|
468
|
+
const t = [];
|
|
469
|
+
for (const e of this.values())
|
|
470
|
+
t.push(z.isRef(e) ? e.describe() : e);
|
|
471
|
+
return t;
|
|
472
|
+
}
|
|
473
|
+
resolveAll(t) {
|
|
474
|
+
let e = [];
|
|
475
|
+
for (const r of this.values())
|
|
476
|
+
e.push(t(r));
|
|
477
|
+
return e;
|
|
478
|
+
}
|
|
479
|
+
clone() {
|
|
480
|
+
return new V(this.values());
|
|
481
|
+
}
|
|
482
|
+
merge(t, e) {
|
|
483
|
+
const r = this.clone();
|
|
484
|
+
return t.forEach((n) => r.add(n)), e.forEach((n) => r.delete(n)), r;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
function I(s, t = /* @__PURE__ */ new Map()) {
|
|
488
|
+
if (st(s) || !s || typeof s != "object") return s;
|
|
489
|
+
if (t.has(s)) return t.get(s);
|
|
490
|
+
let e;
|
|
491
|
+
if (s instanceof Date)
|
|
492
|
+
e = new Date(s.getTime()), t.set(s, e);
|
|
493
|
+
else if (s instanceof RegExp)
|
|
494
|
+
e = new RegExp(s), t.set(s, e);
|
|
495
|
+
else if (Array.isArray(s)) {
|
|
496
|
+
e = new Array(s.length), t.set(s, e);
|
|
497
|
+
for (let r = 0; r < s.length; r++) e[r] = I(s[r], t);
|
|
498
|
+
} else if (s instanceof Map) {
|
|
499
|
+
e = /* @__PURE__ */ new Map(), t.set(s, e);
|
|
500
|
+
for (const [r, n] of s.entries()) e.set(r, I(n, t));
|
|
501
|
+
} else if (s instanceof Set) {
|
|
502
|
+
e = /* @__PURE__ */ new Set(), t.set(s, e);
|
|
503
|
+
for (const r of s) e.add(I(r, t));
|
|
504
|
+
} else if (s instanceof Object) {
|
|
505
|
+
e = {}, t.set(s, e);
|
|
506
|
+
for (const [r, n] of Object.entries(s)) e[r] = I(n, t);
|
|
507
|
+
} else
|
|
508
|
+
throw Error(`Unable to clone ${s}`);
|
|
509
|
+
return e;
|
|
510
|
+
}
|
|
511
|
+
function Et(s) {
|
|
512
|
+
if (!(s != null && s.length))
|
|
513
|
+
return;
|
|
514
|
+
const t = [];
|
|
515
|
+
let e = "", r = !1, n = !1;
|
|
516
|
+
for (let i = 0; i < s.length; i++) {
|
|
517
|
+
const a = s[i];
|
|
518
|
+
if (a === "[" && !n) {
|
|
519
|
+
e && (t.push(...e.split(".").filter(Boolean)), e = ""), r = !0;
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
if (a === "]" && !n) {
|
|
523
|
+
e && (/^\d+$/.test(e) ? t.push(e) : t.push(e.replace(/^"|"$/g, "")), e = ""), r = !1;
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
if (a === '"') {
|
|
527
|
+
n = !n;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
if (a === "." && !r && !n) {
|
|
531
|
+
e && (t.push(e), e = "");
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
e += a;
|
|
535
|
+
}
|
|
536
|
+
return e && t.push(...e.split(".").filter(Boolean)), t;
|
|
537
|
+
}
|
|
538
|
+
function xt(s, t) {
|
|
539
|
+
const e = t ? `${t}.${s.path}` : s.path;
|
|
540
|
+
return s.errors.map((r) => ({
|
|
541
|
+
message: r,
|
|
542
|
+
path: Et(e)
|
|
543
|
+
}));
|
|
544
|
+
}
|
|
545
|
+
function at(s, t) {
|
|
546
|
+
var e;
|
|
547
|
+
if (!((e = s.inner) != null && e.length) && s.errors.length)
|
|
548
|
+
return xt(s, t);
|
|
549
|
+
const r = t ? `${t}.${s.path}` : s.path;
|
|
550
|
+
return s.inner.flatMap((n) => at(n, r));
|
|
551
|
+
}
|
|
552
|
+
class N {
|
|
553
|
+
constructor(t) {
|
|
554
|
+
this.type = void 0, this.deps = [], this.tests = void 0, this.transforms = void 0, this.conditions = [], this._mutate = void 0, this.internalTests = {}, this._whitelist = new V(), this._blacklist = new V(), this.exclusiveTests = /* @__PURE__ */ Object.create(null), this._typeCheck = void 0, this.spec = void 0, this.tests = [], this.transforms = [], this.withMutation(() => {
|
|
555
|
+
this.typeError(x.notType);
|
|
556
|
+
}), this.type = t.type, this._typeCheck = t.check, this.spec = Object.assign({
|
|
557
|
+
strip: !1,
|
|
558
|
+
strict: !1,
|
|
559
|
+
abortEarly: !0,
|
|
560
|
+
recursive: !0,
|
|
561
|
+
disableStackTrace: !1,
|
|
562
|
+
nullable: !1,
|
|
563
|
+
optional: !0,
|
|
564
|
+
coerce: !0
|
|
565
|
+
}, t?.spec), this.withMutation((e) => {
|
|
566
|
+
e.nonNullable();
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
// TODO: remove
|
|
570
|
+
get _type() {
|
|
571
|
+
return this.type;
|
|
572
|
+
}
|
|
573
|
+
clone(t) {
|
|
574
|
+
if (this._mutate)
|
|
575
|
+
return t && Object.assign(this.spec, t), this;
|
|
576
|
+
const e = Object.create(Object.getPrototypeOf(this));
|
|
577
|
+
return e.type = this.type, e._typeCheck = this._typeCheck, e._whitelist = this._whitelist.clone(), e._blacklist = this._blacklist.clone(), e.internalTests = Object.assign({}, this.internalTests), e.exclusiveTests = Object.assign({}, this.exclusiveTests), e.deps = [...this.deps], e.conditions = [...this.conditions], e.tests = [...this.tests], e.transforms = [...this.transforms], e.spec = I(Object.assign({}, this.spec, t)), e;
|
|
578
|
+
}
|
|
579
|
+
label(t) {
|
|
580
|
+
let e = this.clone();
|
|
581
|
+
return e.spec.label = t, e;
|
|
582
|
+
}
|
|
583
|
+
meta(...t) {
|
|
584
|
+
if (t.length === 0) return this.spec.meta;
|
|
585
|
+
let e = this.clone();
|
|
586
|
+
return e.spec.meta = Object.assign(e.spec.meta || {}, t[0]), e;
|
|
587
|
+
}
|
|
588
|
+
withMutation(t) {
|
|
589
|
+
let e = this._mutate;
|
|
590
|
+
this._mutate = !0;
|
|
591
|
+
let r = t(this);
|
|
592
|
+
return this._mutate = e, r;
|
|
593
|
+
}
|
|
594
|
+
concat(t) {
|
|
595
|
+
if (!t || t === this) return this;
|
|
596
|
+
if (t.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);
|
|
597
|
+
let e = this, r = t.clone();
|
|
598
|
+
const n = Object.assign({}, e.spec, r.spec);
|
|
599
|
+
return r.spec = n, r.internalTests = Object.assign({}, e.internalTests, r.internalTests), r._whitelist = e._whitelist.merge(t._whitelist, t._blacklist), r._blacklist = e._blacklist.merge(t._blacklist, t._whitelist), r.tests = e.tests, r.exclusiveTests = e.exclusiveTests, r.withMutation((i) => {
|
|
600
|
+
t.tests.forEach((a) => {
|
|
601
|
+
i.test(a.OPTIONS);
|
|
602
|
+
});
|
|
603
|
+
}), r.transforms = [...e.transforms, ...r.transforms], r;
|
|
604
|
+
}
|
|
605
|
+
isType(t) {
|
|
606
|
+
return t == null ? !!(this.spec.nullable && t === null || this.spec.optional && t === void 0) : this._typeCheck(t);
|
|
607
|
+
}
|
|
608
|
+
resolve(t) {
|
|
609
|
+
let e = this;
|
|
610
|
+
if (e.conditions.length) {
|
|
611
|
+
let r = e.conditions;
|
|
612
|
+
e = e.clone(), e.conditions = [], e = r.reduce((n, i) => i.resolve(n, t), e), e = e.resolve(t);
|
|
613
|
+
}
|
|
614
|
+
return e;
|
|
615
|
+
}
|
|
616
|
+
resolveOptions(t) {
|
|
617
|
+
var e, r, n, i;
|
|
618
|
+
return Object.assign({}, t, {
|
|
619
|
+
from: t.from || [],
|
|
620
|
+
strict: (e = t.strict) != null ? e : this.spec.strict,
|
|
621
|
+
abortEarly: (r = t.abortEarly) != null ? r : this.spec.abortEarly,
|
|
622
|
+
recursive: (n = t.recursive) != null ? n : this.spec.recursive,
|
|
623
|
+
disableStackTrace: (i = t.disableStackTrace) != null ? i : this.spec.disableStackTrace
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Run the configured transform pipeline over an input value.
|
|
628
|
+
*/
|
|
629
|
+
cast(t, e = {}) {
|
|
630
|
+
let r = this.resolve(Object.assign({}, e, {
|
|
631
|
+
value: t
|
|
632
|
+
// parent: options.parent,
|
|
633
|
+
// context: options.context,
|
|
634
|
+
})), n = e.assert === "ignore-optionality", i = r._cast(t, e);
|
|
635
|
+
if (e.assert !== !1 && !r.isType(i)) {
|
|
636
|
+
if (n && C(i))
|
|
637
|
+
return i;
|
|
638
|
+
let a = A(t), l = A(i);
|
|
639
|
+
throw new TypeError(`The value of ${e.path || "field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
640
|
+
|
|
641
|
+
attempted value: ${a}
|
|
642
|
+
` + (l !== a ? `result of cast: ${l}` : ""));
|
|
643
|
+
}
|
|
644
|
+
return i;
|
|
645
|
+
}
|
|
646
|
+
_cast(t, e) {
|
|
647
|
+
let r = t === void 0 ? t : this.transforms.reduce((n, i) => i.call(this, n, t, this, e), t);
|
|
648
|
+
return r === void 0 && (r = this.getDefault(e)), r;
|
|
649
|
+
}
|
|
650
|
+
_validate(t, e = {}, r, n) {
|
|
651
|
+
let {
|
|
652
|
+
path: i,
|
|
653
|
+
originalValue: a = t,
|
|
654
|
+
strict: l = this.spec.strict
|
|
655
|
+
} = e, u = t;
|
|
656
|
+
l || (u = this._cast(u, Object.assign({
|
|
657
|
+
assert: !1
|
|
658
|
+
}, e)));
|
|
659
|
+
let c = [];
|
|
660
|
+
for (let h of Object.values(this.internalTests))
|
|
661
|
+
h && c.push(h);
|
|
662
|
+
this.runTests({
|
|
663
|
+
path: i,
|
|
664
|
+
value: u,
|
|
665
|
+
originalValue: a,
|
|
666
|
+
options: e,
|
|
667
|
+
tests: c
|
|
668
|
+
}, r, (h) => {
|
|
669
|
+
if (h.length)
|
|
670
|
+
return n(h, u);
|
|
671
|
+
this.runTests({
|
|
672
|
+
path: i,
|
|
673
|
+
value: u,
|
|
674
|
+
originalValue: a,
|
|
675
|
+
options: e,
|
|
676
|
+
tests: this.tests
|
|
677
|
+
}, r, n);
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Executes a set of validations, either schema, produced Tests or a nested
|
|
682
|
+
* schema validate result.
|
|
683
|
+
*/
|
|
684
|
+
runTests(t, e, r) {
|
|
685
|
+
let n = !1, {
|
|
686
|
+
tests: i,
|
|
687
|
+
value: a,
|
|
688
|
+
originalValue: l,
|
|
689
|
+
path: u,
|
|
690
|
+
options: c
|
|
691
|
+
} = t, h = (b) => {
|
|
692
|
+
n || (n = !0, e(b, a));
|
|
693
|
+
}, p = (b) => {
|
|
694
|
+
n || (n = !0, r(b, a));
|
|
695
|
+
}, $ = i.length, d = [];
|
|
696
|
+
if (!$) return p([]);
|
|
697
|
+
let E = {
|
|
698
|
+
value: a,
|
|
699
|
+
originalValue: l,
|
|
700
|
+
path: u,
|
|
701
|
+
options: c,
|
|
702
|
+
schema: this
|
|
703
|
+
};
|
|
704
|
+
for (let b = 0; b < i.length; b++) {
|
|
705
|
+
const S = i[b];
|
|
706
|
+
S(E, h, function(f) {
|
|
707
|
+
f && (Array.isArray(f) ? d.push(...f) : d.push(f)), --$ <= 0 && p(d);
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
asNestedTest({
|
|
712
|
+
key: t,
|
|
713
|
+
index: e,
|
|
714
|
+
parent: r,
|
|
715
|
+
parentPath: n,
|
|
716
|
+
originalParent: i,
|
|
717
|
+
options: a
|
|
718
|
+
}) {
|
|
719
|
+
const l = t ?? e;
|
|
720
|
+
if (l == null)
|
|
721
|
+
throw TypeError("Must include `key` or `index` for nested validations");
|
|
722
|
+
const u = typeof l == "number";
|
|
723
|
+
let c = r[l];
|
|
724
|
+
const h = Object.assign({}, a, {
|
|
725
|
+
// Nested validations fields are always strict:
|
|
726
|
+
// 1. parent isn't strict so the casting will also have cast inner values
|
|
727
|
+
// 2. parent is strict in which case the nested values weren't cast either
|
|
728
|
+
strict: !0,
|
|
729
|
+
parent: r,
|
|
730
|
+
value: c,
|
|
731
|
+
originalValue: i[l],
|
|
732
|
+
// FIXME: tests depend on `index` being passed around deeply,
|
|
733
|
+
// we should not let the options.key/index bleed through
|
|
734
|
+
key: void 0,
|
|
735
|
+
// index: undefined,
|
|
736
|
+
[u ? "index" : "key"]: l,
|
|
737
|
+
path: u || l.includes(".") ? `${n || ""}[${u ? l : `"${l}"`}]` : (n ? `${n}.` : "") + t
|
|
738
|
+
});
|
|
739
|
+
return (p, $, d) => this.resolve(h)._validate(c, h, $, d);
|
|
740
|
+
}
|
|
741
|
+
validate(t, e) {
|
|
742
|
+
var r;
|
|
743
|
+
let n = this.resolve(Object.assign({}, e, {
|
|
744
|
+
value: t
|
|
745
|
+
})), i = (r = e?.disableStackTrace) != null ? r : n.spec.disableStackTrace;
|
|
746
|
+
return new Promise((a, l) => n._validate(t, e, (u, c) => {
|
|
747
|
+
v.isError(u) && (u.value = c), l(u);
|
|
748
|
+
}, (u, c) => {
|
|
749
|
+
u.length ? l(new v(u, c, void 0, void 0, i)) : a(c);
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
752
|
+
validateSync(t, e) {
|
|
753
|
+
var r;
|
|
754
|
+
let n = this.resolve(Object.assign({}, e, {
|
|
755
|
+
value: t
|
|
756
|
+
})), i, a = (r = e?.disableStackTrace) != null ? r : n.spec.disableStackTrace;
|
|
757
|
+
return n._validate(t, Object.assign({}, e, {
|
|
758
|
+
sync: !0
|
|
759
|
+
}), (l, u) => {
|
|
760
|
+
throw v.isError(l) && (l.value = u), l;
|
|
761
|
+
}, (l, u) => {
|
|
762
|
+
if (l.length) throw new v(l, t, void 0, void 0, a);
|
|
763
|
+
i = u;
|
|
764
|
+
}), i;
|
|
765
|
+
}
|
|
766
|
+
isValid(t, e) {
|
|
767
|
+
return this.validate(t, e).then(() => !0, (r) => {
|
|
768
|
+
if (v.isError(r)) return !1;
|
|
769
|
+
throw r;
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
isValidSync(t, e) {
|
|
773
|
+
try {
|
|
774
|
+
return this.validateSync(t, e), !0;
|
|
775
|
+
} catch (r) {
|
|
776
|
+
if (v.isError(r)) return !1;
|
|
777
|
+
throw r;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
_getDefault(t) {
|
|
781
|
+
let e = this.spec.default;
|
|
782
|
+
return e == null ? e : typeof e == "function" ? e.call(this, t) : I(e);
|
|
783
|
+
}
|
|
784
|
+
getDefault(t) {
|
|
785
|
+
return this.resolve(t || {})._getDefault(t);
|
|
786
|
+
}
|
|
787
|
+
default(t) {
|
|
788
|
+
return arguments.length === 0 ? this._getDefault() : this.clone({
|
|
789
|
+
default: t
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
strict(t = !0) {
|
|
793
|
+
return this.clone({
|
|
794
|
+
strict: t
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
nullability(t, e) {
|
|
798
|
+
const r = this.clone({
|
|
799
|
+
nullable: t
|
|
800
|
+
});
|
|
801
|
+
return r.internalTests.nullable = j({
|
|
802
|
+
message: e,
|
|
803
|
+
name: "nullable",
|
|
804
|
+
test(n) {
|
|
805
|
+
return n === null ? this.schema.spec.nullable : !0;
|
|
806
|
+
}
|
|
807
|
+
}), r;
|
|
808
|
+
}
|
|
809
|
+
optionality(t, e) {
|
|
810
|
+
const r = this.clone({
|
|
811
|
+
optional: t
|
|
812
|
+
});
|
|
813
|
+
return r.internalTests.optionality = j({
|
|
814
|
+
message: e,
|
|
815
|
+
name: "optionality",
|
|
816
|
+
test(n) {
|
|
817
|
+
return n === void 0 ? this.schema.spec.optional : !0;
|
|
818
|
+
}
|
|
819
|
+
}), r;
|
|
820
|
+
}
|
|
821
|
+
optional() {
|
|
822
|
+
return this.optionality(!0);
|
|
823
|
+
}
|
|
824
|
+
defined(t = x.defined) {
|
|
825
|
+
return this.optionality(!1, t);
|
|
826
|
+
}
|
|
827
|
+
nullable() {
|
|
828
|
+
return this.nullability(!0);
|
|
829
|
+
}
|
|
830
|
+
nonNullable(t = x.notNull) {
|
|
831
|
+
return this.nullability(!1, t);
|
|
832
|
+
}
|
|
833
|
+
required(t = x.required) {
|
|
834
|
+
return this.clone().withMutation((e) => e.nonNullable(t).defined(t));
|
|
835
|
+
}
|
|
836
|
+
notRequired() {
|
|
837
|
+
return this.clone().withMutation((t) => t.nullable().optional());
|
|
838
|
+
}
|
|
839
|
+
transform(t) {
|
|
840
|
+
let e = this.clone();
|
|
841
|
+
return e.transforms.push(t), e;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Adds a test function to the schema's queue of tests.
|
|
845
|
+
* tests can be exclusive or non-exclusive.
|
|
846
|
+
*
|
|
847
|
+
* - exclusive tests, will replace any existing tests of the same name.
|
|
848
|
+
* - non-exclusive: can be stacked
|
|
849
|
+
*
|
|
850
|
+
* If a non-exclusive test is added to a schema with an exclusive test of the same name
|
|
851
|
+
* the exclusive test is removed and further tests of the same name will be stacked.
|
|
852
|
+
*
|
|
853
|
+
* If an exclusive test is added to a schema with non-exclusive tests of the same name
|
|
854
|
+
* the previous tests are removed and further tests of the same name will replace each other.
|
|
855
|
+
*/
|
|
856
|
+
test(...t) {
|
|
857
|
+
let e;
|
|
858
|
+
if (t.length === 1 ? typeof t[0] == "function" ? e = {
|
|
859
|
+
test: t[0]
|
|
860
|
+
} : e = t[0] : t.length === 2 ? e = {
|
|
861
|
+
name: t[0],
|
|
862
|
+
test: t[1]
|
|
863
|
+
} : e = {
|
|
864
|
+
name: t[0],
|
|
865
|
+
message: t[1],
|
|
866
|
+
test: t[2]
|
|
867
|
+
}, e.message === void 0 && (e.message = x.default), typeof e.test != "function") throw new TypeError("`test` is a required parameters");
|
|
868
|
+
let r = this.clone(), n = j(e), i = e.exclusive || e.name && r.exclusiveTests[e.name] === !0;
|
|
869
|
+
if (e.exclusive && !e.name)
|
|
870
|
+
throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
|
|
871
|
+
return e.name && (r.exclusiveTests[e.name] = !!e.exclusive), r.tests = r.tests.filter((a) => !(a.OPTIONS.name === e.name && (i || a.OPTIONS.test === n.OPTIONS.test))), r.tests.push(n), r;
|
|
872
|
+
}
|
|
873
|
+
when(t, e) {
|
|
874
|
+
!Array.isArray(t) && typeof t != "string" && (e = t, t = ".");
|
|
875
|
+
let r = this.clone(), n = W(t).map((i) => new z(i));
|
|
876
|
+
return n.forEach((i) => {
|
|
877
|
+
i.isSibling && r.deps.push(i.key);
|
|
878
|
+
}), r.conditions.push(typeof e == "function" ? new q(n, e) : q.fromOptions(n, e)), r;
|
|
879
|
+
}
|
|
880
|
+
typeError(t) {
|
|
881
|
+
let e = this.clone();
|
|
882
|
+
return e.internalTests.typeError = j({
|
|
883
|
+
message: t,
|
|
884
|
+
name: "typeError",
|
|
885
|
+
skipAbsent: !0,
|
|
886
|
+
test(r) {
|
|
887
|
+
return this.schema._typeCheck(r) ? !0 : this.createError({
|
|
888
|
+
params: {
|
|
889
|
+
type: this.schema.type
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
}), e;
|
|
894
|
+
}
|
|
895
|
+
oneOf(t, e = x.oneOf) {
|
|
896
|
+
let r = this.clone();
|
|
897
|
+
return t.forEach((n) => {
|
|
898
|
+
r._whitelist.add(n), r._blacklist.delete(n);
|
|
899
|
+
}), r.internalTests.whiteList = j({
|
|
900
|
+
message: e,
|
|
901
|
+
name: "oneOf",
|
|
902
|
+
skipAbsent: !0,
|
|
903
|
+
test(n) {
|
|
904
|
+
let i = this.schema._whitelist, a = i.resolveAll(this.resolve);
|
|
905
|
+
return a.includes(n) ? !0 : this.createError({
|
|
906
|
+
params: {
|
|
907
|
+
values: Array.from(i).join(", "),
|
|
908
|
+
resolved: a
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}), r;
|
|
913
|
+
}
|
|
914
|
+
notOneOf(t, e = x.notOneOf) {
|
|
915
|
+
let r = this.clone();
|
|
916
|
+
return t.forEach((n) => {
|
|
917
|
+
r._blacklist.add(n), r._whitelist.delete(n);
|
|
918
|
+
}), r.internalTests.blacklist = j({
|
|
919
|
+
message: e,
|
|
920
|
+
name: "notOneOf",
|
|
921
|
+
test(n) {
|
|
922
|
+
let i = this.schema._blacklist, a = i.resolveAll(this.resolve);
|
|
923
|
+
return a.includes(n) ? this.createError({
|
|
924
|
+
params: {
|
|
925
|
+
values: Array.from(i).join(", "),
|
|
926
|
+
resolved: a
|
|
927
|
+
}
|
|
928
|
+
}) : !0;
|
|
929
|
+
}
|
|
930
|
+
}), r;
|
|
931
|
+
}
|
|
932
|
+
strip(t = !0) {
|
|
933
|
+
let e = this.clone();
|
|
934
|
+
return e.spec.strip = t, e;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Return a serialized description of the schema including validations, flags, types etc.
|
|
938
|
+
*
|
|
939
|
+
* @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).
|
|
940
|
+
*/
|
|
941
|
+
describe(t) {
|
|
942
|
+
const e = (t ? this.resolve(t) : this).clone(), {
|
|
943
|
+
label: r,
|
|
944
|
+
meta: n,
|
|
945
|
+
optional: i,
|
|
946
|
+
nullable: a
|
|
947
|
+
} = e.spec;
|
|
948
|
+
return {
|
|
949
|
+
meta: n,
|
|
950
|
+
label: r,
|
|
951
|
+
optional: i,
|
|
952
|
+
nullable: a,
|
|
953
|
+
default: e.getDefault(t),
|
|
954
|
+
type: e.type,
|
|
955
|
+
oneOf: e._whitelist.describe(),
|
|
956
|
+
notOneOf: e._blacklist.describe(),
|
|
957
|
+
tests: e.tests.filter((u, c, h) => h.findIndex((p) => p.OPTIONS.name === u.OPTIONS.name) === c).map((u) => {
|
|
958
|
+
const c = u.OPTIONS.params && t ? nt(Object.assign({}, u.OPTIONS.params), t) : u.OPTIONS.params;
|
|
959
|
+
return {
|
|
960
|
+
name: u.OPTIONS.name,
|
|
961
|
+
params: c
|
|
962
|
+
};
|
|
963
|
+
})
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
get "~standard"() {
|
|
967
|
+
const t = this;
|
|
968
|
+
return {
|
|
969
|
+
version: 1,
|
|
970
|
+
vendor: "yup",
|
|
971
|
+
async validate(r) {
|
|
972
|
+
try {
|
|
973
|
+
return {
|
|
974
|
+
value: await t.validate(r, {
|
|
975
|
+
abortEarly: !1
|
|
976
|
+
})
|
|
977
|
+
};
|
|
978
|
+
} catch (n) {
|
|
979
|
+
if (n instanceof v)
|
|
980
|
+
return {
|
|
981
|
+
issues: at(n)
|
|
982
|
+
};
|
|
983
|
+
throw n;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
N.prototype.__isYupSchema__ = !0;
|
|
990
|
+
for (const s of ["validate", "validateSync"]) N.prototype[`${s}At`] = function(t, e, r = {}) {
|
|
991
|
+
const {
|
|
992
|
+
parent: n,
|
|
993
|
+
parentPath: i,
|
|
994
|
+
schema: a
|
|
995
|
+
} = wt(this, t, e, r.context);
|
|
996
|
+
return a[s](n && n[i], Object.assign({}, r, {
|
|
997
|
+
parent: n,
|
|
998
|
+
path: t
|
|
999
|
+
}));
|
|
1000
|
+
};
|
|
1001
|
+
for (const s of ["equals", "is"]) N.prototype[s] = N.prototype.oneOf;
|
|
1002
|
+
for (const s of ["not", "nope"]) N.prototype[s] = N.prototype.notOneOf;
|
|
1003
|
+
const St = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
|
|
1004
|
+
function Tt(s) {
|
|
1005
|
+
const t = L(s);
|
|
1006
|
+
if (!t) return Date.parse ? Date.parse(s) : Number.NaN;
|
|
1007
|
+
if (t.z === void 0 && t.plusMinus === void 0)
|
|
1008
|
+
return new Date(t.year, t.month, t.day, t.hour, t.minute, t.second, t.millisecond).valueOf();
|
|
1009
|
+
let e = 0;
|
|
1010
|
+
return t.z !== "Z" && t.plusMinus !== void 0 && (e = t.hourOffset * 60 + t.minuteOffset, t.plusMinus === "+" && (e = 0 - e)), Date.UTC(t.year, t.month, t.day, t.hour, t.minute + e, t.second, t.millisecond);
|
|
1011
|
+
}
|
|
1012
|
+
function L(s) {
|
|
1013
|
+
var t, e;
|
|
1014
|
+
const r = St.exec(s);
|
|
1015
|
+
return r ? {
|
|
1016
|
+
year: O(r[1]),
|
|
1017
|
+
month: O(r[2], 1) - 1,
|
|
1018
|
+
day: O(r[3], 1),
|
|
1019
|
+
hour: O(r[4]),
|
|
1020
|
+
minute: O(r[5]),
|
|
1021
|
+
second: O(r[6]),
|
|
1022
|
+
millisecond: r[7] ? (
|
|
1023
|
+
// allow arbitrary sub-second precision beyond milliseconds
|
|
1024
|
+
O(r[7].substring(0, 3))
|
|
1025
|
+
) : 0,
|
|
1026
|
+
precision: (t = (e = r[7]) == null ? void 0 : e.length) != null ? t : void 0,
|
|
1027
|
+
z: r[8] || void 0,
|
|
1028
|
+
plusMinus: r[9] || void 0,
|
|
1029
|
+
hourOffset: O(r[10]),
|
|
1030
|
+
minuteOffset: O(r[11])
|
|
1031
|
+
} : null;
|
|
1032
|
+
}
|
|
1033
|
+
function O(s, t = 0) {
|
|
1034
|
+
return Number(s) || t;
|
|
1035
|
+
}
|
|
1036
|
+
let _t = (
|
|
1037
|
+
// eslint-disable-next-line
|
|
1038
|
+
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
|
|
1039
|
+
), Ot = (
|
|
1040
|
+
// eslint-disable-next-line
|
|
1041
|
+
/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
|
|
1042
|
+
), kt = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i, Dt = "^\\d{4}-\\d{2}-\\d{2}", At = "\\d{2}:\\d{2}:\\d{2}", Nt = "(([+-]\\d{2}(:?\\d{2})?)|Z)", Ct = new RegExp(`${Dt}T${At}(\\.\\d+)?${Nt}$`), jt = (s) => C(s) || s === s.trim(), It = {}.toString();
|
|
1043
|
+
function zt() {
|
|
1044
|
+
return new ut();
|
|
1045
|
+
}
|
|
1046
|
+
class ut extends N {
|
|
1047
|
+
constructor() {
|
|
1048
|
+
super({
|
|
1049
|
+
type: "string",
|
|
1050
|
+
check(t) {
|
|
1051
|
+
return t instanceof String && (t = t.valueOf()), typeof t == "string";
|
|
1052
|
+
}
|
|
1053
|
+
}), this.withMutation(() => {
|
|
1054
|
+
this.transform((t, e) => {
|
|
1055
|
+
if (!this.spec.coerce || this.isType(t) || Array.isArray(t)) return t;
|
|
1056
|
+
const r = t != null && t.toString ? t.toString() : t;
|
|
1057
|
+
return r === It ? t : r;
|
|
1058
|
+
});
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
required(t) {
|
|
1062
|
+
return super.required(t).withMutation((e) => e.test({
|
|
1063
|
+
message: t || x.required,
|
|
1064
|
+
name: "required",
|
|
1065
|
+
skipAbsent: !0,
|
|
1066
|
+
test: (r) => !!r.length
|
|
1067
|
+
}));
|
|
1068
|
+
}
|
|
1069
|
+
notRequired() {
|
|
1070
|
+
return super.notRequired().withMutation((t) => (t.tests = t.tests.filter((e) => e.OPTIONS.name !== "required"), t));
|
|
1071
|
+
}
|
|
1072
|
+
length(t, e = w.length) {
|
|
1073
|
+
return this.test({
|
|
1074
|
+
message: e,
|
|
1075
|
+
name: "length",
|
|
1076
|
+
exclusive: !0,
|
|
1077
|
+
params: {
|
|
1078
|
+
length: t
|
|
1079
|
+
},
|
|
1080
|
+
skipAbsent: !0,
|
|
1081
|
+
test(r) {
|
|
1082
|
+
return r.length === this.resolve(t);
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
min(t, e = w.min) {
|
|
1087
|
+
return this.test({
|
|
1088
|
+
message: e,
|
|
1089
|
+
name: "min",
|
|
1090
|
+
exclusive: !0,
|
|
1091
|
+
params: {
|
|
1092
|
+
min: t
|
|
1093
|
+
},
|
|
1094
|
+
skipAbsent: !0,
|
|
1095
|
+
test(r) {
|
|
1096
|
+
return r.length >= this.resolve(t);
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
max(t, e = w.max) {
|
|
1101
|
+
return this.test({
|
|
1102
|
+
name: "max",
|
|
1103
|
+
exclusive: !0,
|
|
1104
|
+
message: e,
|
|
1105
|
+
params: {
|
|
1106
|
+
max: t
|
|
1107
|
+
},
|
|
1108
|
+
skipAbsent: !0,
|
|
1109
|
+
test(r) {
|
|
1110
|
+
return r.length <= this.resolve(t);
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
matches(t, e) {
|
|
1115
|
+
let r = !1, n, i;
|
|
1116
|
+
return e && (typeof e == "object" ? {
|
|
1117
|
+
excludeEmptyString: r = !1,
|
|
1118
|
+
message: n,
|
|
1119
|
+
name: i
|
|
1120
|
+
} = e : n = e), this.test({
|
|
1121
|
+
name: i || "matches",
|
|
1122
|
+
message: n || w.matches,
|
|
1123
|
+
params: {
|
|
1124
|
+
regex: t
|
|
1125
|
+
},
|
|
1126
|
+
skipAbsent: !0,
|
|
1127
|
+
test: (a) => a === "" && r || a.search(t) !== -1
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
email(t = w.email) {
|
|
1131
|
+
return this.matches(_t, {
|
|
1132
|
+
name: "email",
|
|
1133
|
+
message: t,
|
|
1134
|
+
excludeEmptyString: !0
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
url(t = w.url) {
|
|
1138
|
+
return this.matches(Ot, {
|
|
1139
|
+
name: "url",
|
|
1140
|
+
message: t,
|
|
1141
|
+
excludeEmptyString: !0
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
uuid(t = w.uuid) {
|
|
1145
|
+
return this.matches(kt, {
|
|
1146
|
+
name: "uuid",
|
|
1147
|
+
message: t,
|
|
1148
|
+
excludeEmptyString: !1
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
datetime(t) {
|
|
1152
|
+
let e = "", r, n;
|
|
1153
|
+
return t && (typeof t == "object" ? {
|
|
1154
|
+
message: e = "",
|
|
1155
|
+
allowOffset: r = !1,
|
|
1156
|
+
precision: n = void 0
|
|
1157
|
+
} = t : e = t), this.matches(Ct, {
|
|
1158
|
+
name: "datetime",
|
|
1159
|
+
message: e || w.datetime,
|
|
1160
|
+
excludeEmptyString: !0
|
|
1161
|
+
}).test({
|
|
1162
|
+
name: "datetime_offset",
|
|
1163
|
+
message: e || w.datetime_offset,
|
|
1164
|
+
params: {
|
|
1165
|
+
allowOffset: r
|
|
1166
|
+
},
|
|
1167
|
+
skipAbsent: !0,
|
|
1168
|
+
test: (i) => {
|
|
1169
|
+
if (!i || r) return !0;
|
|
1170
|
+
const a = L(i);
|
|
1171
|
+
return a ? !!a.z : !1;
|
|
1172
|
+
}
|
|
1173
|
+
}).test({
|
|
1174
|
+
name: "datetime_precision",
|
|
1175
|
+
message: e || w.datetime_precision,
|
|
1176
|
+
params: {
|
|
1177
|
+
precision: n
|
|
1178
|
+
},
|
|
1179
|
+
skipAbsent: !0,
|
|
1180
|
+
test: (i) => {
|
|
1181
|
+
if (!i || n == null) return !0;
|
|
1182
|
+
const a = L(i);
|
|
1183
|
+
return a ? a.precision === n : !1;
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
//-- transforms --
|
|
1188
|
+
ensure() {
|
|
1189
|
+
return this.default("").transform((t) => t === null ? "" : t);
|
|
1190
|
+
}
|
|
1191
|
+
trim(t = w.trim) {
|
|
1192
|
+
return this.transform((e) => e != null ? e.trim() : e).test({
|
|
1193
|
+
message: t,
|
|
1194
|
+
name: "trim",
|
|
1195
|
+
test: jt
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
lowercase(t = w.lowercase) {
|
|
1199
|
+
return this.transform((e) => C(e) ? e : e.toLowerCase()).test({
|
|
1200
|
+
message: t,
|
|
1201
|
+
name: "string_case",
|
|
1202
|
+
exclusive: !0,
|
|
1203
|
+
skipAbsent: !0,
|
|
1204
|
+
test: (e) => C(e) || e === e.toLowerCase()
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
uppercase(t = w.uppercase) {
|
|
1208
|
+
return this.transform((e) => C(e) ? e : e.toUpperCase()).test({
|
|
1209
|
+
message: t,
|
|
1210
|
+
name: "string_case",
|
|
1211
|
+
exclusive: !0,
|
|
1212
|
+
skipAbsent: !0,
|
|
1213
|
+
test: (e) => C(e) || e === e.toUpperCase()
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
zt.prototype = ut.prototype;
|
|
1218
|
+
let Rt = /* @__PURE__ */ new Date(""), Pt = (s) => Object.prototype.toString.call(s) === "[object Date]";
|
|
1219
|
+
class G extends N {
|
|
1220
|
+
constructor() {
|
|
1221
|
+
super({
|
|
1222
|
+
type: "date",
|
|
1223
|
+
check(t) {
|
|
1224
|
+
return Pt(t) && !isNaN(t.getTime());
|
|
1225
|
+
}
|
|
1226
|
+
}), this.withMutation(() => {
|
|
1227
|
+
this.transform((t, e) => !this.spec.coerce || this.isType(t) || t === null ? t : (t = Tt(t), isNaN(t) ? G.INVALID_DATE : new Date(t)));
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
prepareParam(t, e) {
|
|
1231
|
+
let r;
|
|
1232
|
+
if (z.isRef(t))
|
|
1233
|
+
r = t;
|
|
1234
|
+
else {
|
|
1235
|
+
let n = this.cast(t);
|
|
1236
|
+
if (!this._typeCheck(n)) throw new TypeError(`\`${e}\` must be a Date or a value that can be \`cast()\` to a Date`);
|
|
1237
|
+
r = n;
|
|
1238
|
+
}
|
|
1239
|
+
return r;
|
|
1240
|
+
}
|
|
1241
|
+
min(t, e = Z.min) {
|
|
1242
|
+
let r = this.prepareParam(t, "min");
|
|
1243
|
+
return this.test({
|
|
1244
|
+
message: e,
|
|
1245
|
+
name: "min",
|
|
1246
|
+
exclusive: !0,
|
|
1247
|
+
params: {
|
|
1248
|
+
min: t
|
|
1249
|
+
},
|
|
1250
|
+
skipAbsent: !0,
|
|
1251
|
+
test(n) {
|
|
1252
|
+
return n >= this.resolve(r);
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
max(t, e = Z.max) {
|
|
1257
|
+
let r = this.prepareParam(t, "max");
|
|
1258
|
+
return this.test({
|
|
1259
|
+
message: e,
|
|
1260
|
+
name: "max",
|
|
1261
|
+
exclusive: !0,
|
|
1262
|
+
params: {
|
|
1263
|
+
max: t
|
|
1264
|
+
},
|
|
1265
|
+
skipAbsent: !0,
|
|
1266
|
+
test(n) {
|
|
1267
|
+
return n <= this.resolve(r);
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
G.INVALID_DATE = Rt;
|
|
1273
|
+
export {
|
|
1274
|
+
zt as c
|
|
1275
|
+
};
|