@arenarium/maps 1.0.192 → 1.0.200
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.d.ts +18 -169
- package/dist/index.js +2 -2
- package/dist/main.cjs.js +2 -2
- package/dist/main.d.ts +18 -37
- package/dist/main.es.js +4305 -1472
- package/package.json +5 -16
- package/dist/api.cjs.js +0 -1
- package/dist/api.d.ts +0 -158
- package/dist/api.es.js +0 -81
- package/dist/states-C618H9PS.cjs +0 -1
- package/dist/states-CQ1aDpNu.js +0 -3204
package/dist/states-CQ1aDpNu.js
DELETED
|
@@ -1,3204 +0,0 @@
|
|
|
1
|
-
var At = Object.defineProperty;
|
|
2
|
-
var St = (s, e, t) => e in s ? At(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var R = (s, e, t) => St(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
var Re;
|
|
5
|
-
((s) => {
|
|
6
|
-
function e(t, n, r) {
|
|
7
|
-
const a = t / 2, i = n / 2, o = Math.sqrt(a * a + i * i), u = Math.atan(i / a) * (180 / Math.PI), c = r * (Math.PI / 180);
|
|
8
|
-
return r < 180 ? r < 90 ? r < u ? {
|
|
9
|
-
x: 0,
|
|
10
|
-
y: o * Math.sin(c) - i
|
|
11
|
-
} : {
|
|
12
|
-
x: o * Math.cos(c) - a,
|
|
13
|
-
y: 0
|
|
14
|
-
} : r < 180 - u ? {
|
|
15
|
-
x: o * Math.cos(c) - a,
|
|
16
|
-
y: 0
|
|
17
|
-
} : {
|
|
18
|
-
x: -t,
|
|
19
|
-
y: o * Math.sin(c) - i
|
|
20
|
-
} : r < 270 ? r < 180 + u ? {
|
|
21
|
-
x: -t,
|
|
22
|
-
y: o * Math.sin(c) - i
|
|
23
|
-
} : {
|
|
24
|
-
x: o * Math.cos(c) - a,
|
|
25
|
-
y: -n
|
|
26
|
-
} : r < 360 - u ? {
|
|
27
|
-
x: o * Math.cos(c) - a,
|
|
28
|
-
y: -n
|
|
29
|
-
} : {
|
|
30
|
-
x: 0,
|
|
31
|
-
y: o * Math.sin(c) - i
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
s.getOffsets = e;
|
|
35
|
-
})(Re || (Re = {}));
|
|
36
|
-
var Ze;
|
|
37
|
-
((s) => {
|
|
38
|
-
function e(o, u, c) {
|
|
39
|
-
return {
|
|
40
|
-
x: n(u) * c,
|
|
41
|
-
y: r(o) * c
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
s.project = e;
|
|
45
|
-
function t(o, u, c) {
|
|
46
|
-
return {
|
|
47
|
-
lat: i(u / c),
|
|
48
|
-
lng: a(o / c)
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
s.unproject = t;
|
|
52
|
-
function n(o) {
|
|
53
|
-
return (180 + o) / 360;
|
|
54
|
-
}
|
|
55
|
-
function r(o) {
|
|
56
|
-
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + o * Math.PI / 360))) / 360;
|
|
57
|
-
}
|
|
58
|
-
function a(o) {
|
|
59
|
-
return o * 360 - 180;
|
|
60
|
-
}
|
|
61
|
-
function i(o) {
|
|
62
|
-
return 360 / Math.PI * Math.atan(Math.exp((180 - o * 360) * Math.PI / 180)) - 90;
|
|
63
|
-
}
|
|
64
|
-
})(Ze || (Ze = {}));
|
|
65
|
-
var P;
|
|
66
|
-
((s) => {
|
|
67
|
-
s.COUNT = 12, s.DEGREES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330], s.DEGREES_DEFAULT = 270;
|
|
68
|
-
})(P || (P = {}));
|
|
69
|
-
var _e;
|
|
70
|
-
((s) => {
|
|
71
|
-
const e = P.DEGREES.map((c) => c * Math.PI / 180), t = e.map((c) => Math.cos(c)), n = e.map((c) => Math.sin(c));
|
|
72
|
-
function r(c, v) {
|
|
73
|
-
const N = Math.abs(v / c);
|
|
74
|
-
return N < 1 ? N < 0.26795 ? 0 : 1 : N < 3.73205 ? 2 : 3;
|
|
75
|
-
}
|
|
76
|
-
function a(c, v) {
|
|
77
|
-
const N = r(c, v);
|
|
78
|
-
return c > 0 ? v > 0 ? (12 - N) % 12 : 0 + N : v > 0 ? 6 + N : 6 - N;
|
|
79
|
-
}
|
|
80
|
-
function i(c, v) {
|
|
81
|
-
return v == 0 ? c : ((c + v) % P.COUNT + P.COUNT) % P.COUNT;
|
|
82
|
-
}
|
|
83
|
-
function o(c) {
|
|
84
|
-
let v = !0;
|
|
85
|
-
for (let N = 0; N < c.length; N++) {
|
|
86
|
-
const z = c[N], j = z.particle, D = z.x, p = z.y, l = j.distX, f = j.distY, g = j.index, x = i(g, -1), _ = i(g, 1), k = D + l * t[x], E = p + f * n[x], C = D + l * t[g], ge = p + f * n[g], Ae = D + l * t[_], ce = p + f * n[_];
|
|
87
|
-
let J = 0, W = 0, Q = 0;
|
|
88
|
-
const de = z.neighbours;
|
|
89
|
-
for (let Se = 0; Se < de.length; Se++) {
|
|
90
|
-
const Ne = de[Se], Te = Ne.particle, xt = Ne.x, kt = Ne.y, bt = Te.distX, wt = Te.distY, Je = Te.index, Oe = xt + bt * t[Je], Ce = kt + wt * n[Je], Qe = k - Oe, Ke = E - Ce;
|
|
91
|
-
J += 1 / (Qe * Qe + Ke * Ke);
|
|
92
|
-
const et = C - Oe, tt = ge - Ce;
|
|
93
|
-
W += 1 / (et * et + tt * tt);
|
|
94
|
-
const st = Ae - Oe, nt = ce - Ce;
|
|
95
|
-
Q += 1 / (st * st + nt * nt);
|
|
96
|
-
}
|
|
97
|
-
let ye = 0;
|
|
98
|
-
J < W && J < Q && (ye = -1), Q < W && Q < J && (ye = 1), ye != 0 && (j.index = i(g, ye), v = !1);
|
|
99
|
-
}
|
|
100
|
-
return v;
|
|
101
|
-
}
|
|
102
|
-
s.updateAngleIndexes = o;
|
|
103
|
-
function u(c) {
|
|
104
|
-
for (let v = 0; v < c.length; v++) {
|
|
105
|
-
const N = c[v], z = N.x, j = N.y;
|
|
106
|
-
let D = 0, p = 0;
|
|
107
|
-
for (let l = 0; l < c.length; l++) {
|
|
108
|
-
const f = c[l], g = f.x, x = f.y, _ = z - g, k = j - x;
|
|
109
|
-
if (_ == 0 && k == 0) continue;
|
|
110
|
-
const E = Math.sqrt(_ * _ + k * k), C = 1 / (E * E);
|
|
111
|
-
D += C * _ / E, p += -(C * k) / E;
|
|
112
|
-
}
|
|
113
|
-
N.particle.index = a(D, p);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
s.initializeAngleIndexes = u;
|
|
117
|
-
})(_e || (_e = {}));
|
|
118
|
-
var K;
|
|
119
|
-
((s) => {
|
|
120
|
-
function e(n, r) {
|
|
121
|
-
return !(n.x - n.distances.left > r.x + r.distances.right || n.x + n.distances.right < r.x - r.distances.left || n.y - n.distances.top > r.y + r.distances.bottom || n.y + n.distances.bottom < r.y - r.distances.top);
|
|
122
|
-
}
|
|
123
|
-
s.areOverlaping = e;
|
|
124
|
-
function t(n, r) {
|
|
125
|
-
let a = Math.abs(n.x - r.x), o = (n.x < r.x ? n.distances.right + r.distances.left : n.distances.left + r.distances.right) / a, u = Math.abs(n.y - r.y), v = (n.y < r.y ? n.distances.bottom + r.distances.top : n.distances.top + r.distances.bottom) / u, N = Math.min(o, v);
|
|
126
|
-
return Math.log2(N);
|
|
127
|
-
}
|
|
128
|
-
s.getZoomWhenTouching = t;
|
|
129
|
-
})(K || (K = {}));
|
|
130
|
-
var O;
|
|
131
|
-
(function(s) {
|
|
132
|
-
s.assertEqual = (r) => {
|
|
133
|
-
};
|
|
134
|
-
function e(r) {
|
|
135
|
-
}
|
|
136
|
-
s.assertIs = e;
|
|
137
|
-
function t(r) {
|
|
138
|
-
throw new Error();
|
|
139
|
-
}
|
|
140
|
-
s.assertNever = t, s.arrayToEnum = (r) => {
|
|
141
|
-
const a = {};
|
|
142
|
-
for (const i of r)
|
|
143
|
-
a[i] = i;
|
|
144
|
-
return a;
|
|
145
|
-
}, s.getValidEnumValues = (r) => {
|
|
146
|
-
const a = s.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), i = {};
|
|
147
|
-
for (const o of a)
|
|
148
|
-
i[o] = r[o];
|
|
149
|
-
return s.objectValues(i);
|
|
150
|
-
}, s.objectValues = (r) => s.objectKeys(r).map(function(a) {
|
|
151
|
-
return r[a];
|
|
152
|
-
}), s.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
|
|
153
|
-
const a = [];
|
|
154
|
-
for (const i in r)
|
|
155
|
-
Object.prototype.hasOwnProperty.call(r, i) && a.push(i);
|
|
156
|
-
return a;
|
|
157
|
-
}, s.find = (r, a) => {
|
|
158
|
-
for (const i of r)
|
|
159
|
-
if (a(i))
|
|
160
|
-
return i;
|
|
161
|
-
}, s.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && Number.isFinite(r) && Math.floor(r) === r;
|
|
162
|
-
function n(r, a = " | ") {
|
|
163
|
-
return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
164
|
-
}
|
|
165
|
-
s.joinValues = n, s.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
166
|
-
})(O || (O = {}));
|
|
167
|
-
var rt;
|
|
168
|
-
(function(s) {
|
|
169
|
-
s.mergeShapes = (e, t) => ({
|
|
170
|
-
...e,
|
|
171
|
-
...t
|
|
172
|
-
// second overwrites first
|
|
173
|
-
});
|
|
174
|
-
})(rt || (rt = {}));
|
|
175
|
-
const m = O.arrayToEnum([
|
|
176
|
-
"string",
|
|
177
|
-
"nan",
|
|
178
|
-
"number",
|
|
179
|
-
"integer",
|
|
180
|
-
"float",
|
|
181
|
-
"boolean",
|
|
182
|
-
"date",
|
|
183
|
-
"bigint",
|
|
184
|
-
"symbol",
|
|
185
|
-
"function",
|
|
186
|
-
"undefined",
|
|
187
|
-
"null",
|
|
188
|
-
"array",
|
|
189
|
-
"object",
|
|
190
|
-
"unknown",
|
|
191
|
-
"promise",
|
|
192
|
-
"void",
|
|
193
|
-
"never",
|
|
194
|
-
"map",
|
|
195
|
-
"set"
|
|
196
|
-
]), q = (s) => {
|
|
197
|
-
switch (typeof s) {
|
|
198
|
-
case "undefined":
|
|
199
|
-
return m.undefined;
|
|
200
|
-
case "string":
|
|
201
|
-
return m.string;
|
|
202
|
-
case "number":
|
|
203
|
-
return Number.isNaN(s) ? m.nan : m.number;
|
|
204
|
-
case "boolean":
|
|
205
|
-
return m.boolean;
|
|
206
|
-
case "function":
|
|
207
|
-
return m.function;
|
|
208
|
-
case "bigint":
|
|
209
|
-
return m.bigint;
|
|
210
|
-
case "symbol":
|
|
211
|
-
return m.symbol;
|
|
212
|
-
case "object":
|
|
213
|
-
return Array.isArray(s) ? m.array : s === null ? m.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? m.promise : typeof Map < "u" && s instanceof Map ? m.map : typeof Set < "u" && s instanceof Set ? m.set : typeof Date < "u" && s instanceof Date ? m.date : m.object;
|
|
214
|
-
default:
|
|
215
|
-
return m.unknown;
|
|
216
|
-
}
|
|
217
|
-
}, d = O.arrayToEnum([
|
|
218
|
-
"invalid_type",
|
|
219
|
-
"invalid_literal",
|
|
220
|
-
"custom",
|
|
221
|
-
"invalid_union",
|
|
222
|
-
"invalid_union_discriminator",
|
|
223
|
-
"invalid_enum_value",
|
|
224
|
-
"unrecognized_keys",
|
|
225
|
-
"invalid_arguments",
|
|
226
|
-
"invalid_return_type",
|
|
227
|
-
"invalid_date",
|
|
228
|
-
"invalid_string",
|
|
229
|
-
"too_small",
|
|
230
|
-
"too_big",
|
|
231
|
-
"invalid_intersection_types",
|
|
232
|
-
"not_multiple_of",
|
|
233
|
-
"not_finite"
|
|
234
|
-
]);
|
|
235
|
-
class V extends Error {
|
|
236
|
-
get errors() {
|
|
237
|
-
return this.issues;
|
|
238
|
-
}
|
|
239
|
-
constructor(e) {
|
|
240
|
-
super(), this.issues = [], this.addIssue = (n) => {
|
|
241
|
-
this.issues = [...this.issues, n];
|
|
242
|
-
}, this.addIssues = (n = []) => {
|
|
243
|
-
this.issues = [...this.issues, ...n];
|
|
244
|
-
};
|
|
245
|
-
const t = new.target.prototype;
|
|
246
|
-
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
|
|
247
|
-
}
|
|
248
|
-
format(e) {
|
|
249
|
-
const t = e || function(a) {
|
|
250
|
-
return a.message;
|
|
251
|
-
}, n = { _errors: [] }, r = (a) => {
|
|
252
|
-
for (const i of a.issues)
|
|
253
|
-
if (i.code === "invalid_union")
|
|
254
|
-
i.unionErrors.map(r);
|
|
255
|
-
else if (i.code === "invalid_return_type")
|
|
256
|
-
r(i.returnTypeError);
|
|
257
|
-
else if (i.code === "invalid_arguments")
|
|
258
|
-
r(i.argumentsError);
|
|
259
|
-
else if (i.path.length === 0)
|
|
260
|
-
n._errors.push(t(i));
|
|
261
|
-
else {
|
|
262
|
-
let o = n, u = 0;
|
|
263
|
-
for (; u < i.path.length; ) {
|
|
264
|
-
const c = i.path[u];
|
|
265
|
-
u === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], u++;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
return r(this), n;
|
|
270
|
-
}
|
|
271
|
-
static assert(e) {
|
|
272
|
-
if (!(e instanceof V))
|
|
273
|
-
throw new Error(`Not a ZodError: ${e}`);
|
|
274
|
-
}
|
|
275
|
-
toString() {
|
|
276
|
-
return this.message;
|
|
277
|
-
}
|
|
278
|
-
get message() {
|
|
279
|
-
return JSON.stringify(this.issues, O.jsonStringifyReplacer, 2);
|
|
280
|
-
}
|
|
281
|
-
get isEmpty() {
|
|
282
|
-
return this.issues.length === 0;
|
|
283
|
-
}
|
|
284
|
-
flatten(e = (t) => t.message) {
|
|
285
|
-
const t = {}, n = [];
|
|
286
|
-
for (const r of this.issues)
|
|
287
|
-
if (r.path.length > 0) {
|
|
288
|
-
const a = r.path[0];
|
|
289
|
-
t[a] = t[a] || [], t[a].push(e(r));
|
|
290
|
-
} else
|
|
291
|
-
n.push(e(r));
|
|
292
|
-
return { formErrors: n, fieldErrors: t };
|
|
293
|
-
}
|
|
294
|
-
get formErrors() {
|
|
295
|
-
return this.flatten();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
V.create = (s) => new V(s);
|
|
299
|
-
const he = (s, e) => {
|
|
300
|
-
let t;
|
|
301
|
-
switch (s.code) {
|
|
302
|
-
case d.invalid_type:
|
|
303
|
-
s.received === m.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
|
|
304
|
-
break;
|
|
305
|
-
case d.invalid_literal:
|
|
306
|
-
t = `Invalid literal value, expected ${JSON.stringify(s.expected, O.jsonStringifyReplacer)}`;
|
|
307
|
-
break;
|
|
308
|
-
case d.unrecognized_keys:
|
|
309
|
-
t = `Unrecognized key(s) in object: ${O.joinValues(s.keys, ", ")}`;
|
|
310
|
-
break;
|
|
311
|
-
case d.invalid_union:
|
|
312
|
-
t = "Invalid input";
|
|
313
|
-
break;
|
|
314
|
-
case d.invalid_union_discriminator:
|
|
315
|
-
t = `Invalid discriminator value. Expected ${O.joinValues(s.options)}`;
|
|
316
|
-
break;
|
|
317
|
-
case d.invalid_enum_value:
|
|
318
|
-
t = `Invalid enum value. Expected ${O.joinValues(s.options)}, received '${s.received}'`;
|
|
319
|
-
break;
|
|
320
|
-
case d.invalid_arguments:
|
|
321
|
-
t = "Invalid function arguments";
|
|
322
|
-
break;
|
|
323
|
-
case d.invalid_return_type:
|
|
324
|
-
t = "Invalid function return type";
|
|
325
|
-
break;
|
|
326
|
-
case d.invalid_date:
|
|
327
|
-
t = "Invalid date";
|
|
328
|
-
break;
|
|
329
|
-
case d.invalid_string:
|
|
330
|
-
typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : O.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
|
|
331
|
-
break;
|
|
332
|
-
case d.too_small:
|
|
333
|
-
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "bigint" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
|
|
334
|
-
break;
|
|
335
|
-
case d.too_big:
|
|
336
|
-
s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
|
|
337
|
-
break;
|
|
338
|
-
case d.custom:
|
|
339
|
-
t = "Invalid input";
|
|
340
|
-
break;
|
|
341
|
-
case d.invalid_intersection_types:
|
|
342
|
-
t = "Intersection results could not be merged";
|
|
343
|
-
break;
|
|
344
|
-
case d.not_multiple_of:
|
|
345
|
-
t = `Number must be a multiple of ${s.multipleOf}`;
|
|
346
|
-
break;
|
|
347
|
-
case d.not_finite:
|
|
348
|
-
t = "Number must be finite";
|
|
349
|
-
break;
|
|
350
|
-
default:
|
|
351
|
-
t = e.defaultError, O.assertNever(s);
|
|
352
|
-
}
|
|
353
|
-
return { message: t };
|
|
354
|
-
};
|
|
355
|
-
let Nt = he;
|
|
356
|
-
function Me() {
|
|
357
|
-
return Nt;
|
|
358
|
-
}
|
|
359
|
-
const je = (s) => {
|
|
360
|
-
const { data: e, path: t, errorMaps: n, issueData: r } = s, a = [...t, ...r.path || []], i = {
|
|
361
|
-
...r,
|
|
362
|
-
path: a
|
|
363
|
-
};
|
|
364
|
-
if (r.message !== void 0)
|
|
365
|
-
return {
|
|
366
|
-
...r,
|
|
367
|
-
path: a,
|
|
368
|
-
message: r.message
|
|
369
|
-
};
|
|
370
|
-
let o = "";
|
|
371
|
-
const u = n.filter((c) => !!c).slice().reverse();
|
|
372
|
-
for (const c of u)
|
|
373
|
-
o = c(i, { data: e, defaultError: o }).message;
|
|
374
|
-
return {
|
|
375
|
-
...r,
|
|
376
|
-
path: a,
|
|
377
|
-
message: o
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
function h(s, e) {
|
|
381
|
-
const t = Me(), n = je({
|
|
382
|
-
issueData: e,
|
|
383
|
-
data: s.data,
|
|
384
|
-
path: s.path,
|
|
385
|
-
errorMaps: [
|
|
386
|
-
s.common.contextualErrorMap,
|
|
387
|
-
// contextual error map is first priority
|
|
388
|
-
s.schemaErrorMap,
|
|
389
|
-
// then schema-bound map if available
|
|
390
|
-
t,
|
|
391
|
-
// then global override map
|
|
392
|
-
t === he ? void 0 : he
|
|
393
|
-
// then global default map
|
|
394
|
-
].filter((r) => !!r)
|
|
395
|
-
});
|
|
396
|
-
s.common.issues.push(n);
|
|
397
|
-
}
|
|
398
|
-
class L {
|
|
399
|
-
constructor() {
|
|
400
|
-
this.value = "valid";
|
|
401
|
-
}
|
|
402
|
-
dirty() {
|
|
403
|
-
this.value === "valid" && (this.value = "dirty");
|
|
404
|
-
}
|
|
405
|
-
abort() {
|
|
406
|
-
this.value !== "aborted" && (this.value = "aborted");
|
|
407
|
-
}
|
|
408
|
-
static mergeArray(e, t) {
|
|
409
|
-
const n = [];
|
|
410
|
-
for (const r of t) {
|
|
411
|
-
if (r.status === "aborted")
|
|
412
|
-
return b;
|
|
413
|
-
r.status === "dirty" && e.dirty(), n.push(r.value);
|
|
414
|
-
}
|
|
415
|
-
return { status: e.value, value: n };
|
|
416
|
-
}
|
|
417
|
-
static async mergeObjectAsync(e, t) {
|
|
418
|
-
const n = [];
|
|
419
|
-
for (const r of t) {
|
|
420
|
-
const a = await r.key, i = await r.value;
|
|
421
|
-
n.push({
|
|
422
|
-
key: a,
|
|
423
|
-
value: i
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
return L.mergeObjectSync(e, n);
|
|
427
|
-
}
|
|
428
|
-
static mergeObjectSync(e, t) {
|
|
429
|
-
const n = {};
|
|
430
|
-
for (const r of t) {
|
|
431
|
-
const { key: a, value: i } = r;
|
|
432
|
-
if (a.status === "aborted" || i.status === "aborted")
|
|
433
|
-
return b;
|
|
434
|
-
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (n[a.value] = i.value);
|
|
435
|
-
}
|
|
436
|
-
return { status: e.value, value: n };
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
const b = Object.freeze({
|
|
440
|
-
status: "aborted"
|
|
441
|
-
}), ue = (s) => ({ status: "dirty", value: s }), $ = (s) => ({ status: "valid", value: s }), at = (s) => s.status === "aborted", it = (s) => s.status === "dirty", ne = (s) => s.status === "valid", xe = (s) => typeof Promise < "u" && s instanceof Promise;
|
|
442
|
-
var y;
|
|
443
|
-
(function(s) {
|
|
444
|
-
s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
445
|
-
})(y || (y = {}));
|
|
446
|
-
class X {
|
|
447
|
-
constructor(e, t, n, r) {
|
|
448
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = r;
|
|
449
|
-
}
|
|
450
|
-
get path() {
|
|
451
|
-
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
const ot = (s, e) => {
|
|
455
|
-
if (ne(e))
|
|
456
|
-
return { success: !0, data: e.value };
|
|
457
|
-
if (!s.common.issues.length)
|
|
458
|
-
throw new Error("Validation failed but no issues detected.");
|
|
459
|
-
return {
|
|
460
|
-
success: !1,
|
|
461
|
-
get error() {
|
|
462
|
-
if (this._error)
|
|
463
|
-
return this._error;
|
|
464
|
-
const t = new V(s.common.issues);
|
|
465
|
-
return this._error = t, this._error;
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
};
|
|
469
|
-
function A(s) {
|
|
470
|
-
if (!s)
|
|
471
|
-
return {};
|
|
472
|
-
const { errorMap: e, invalid_type_error: t, required_error: n, description: r } = s;
|
|
473
|
-
if (e && (t || n))
|
|
474
|
-
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
475
|
-
return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
|
|
476
|
-
const { message: u } = s;
|
|
477
|
-
return i.code === "invalid_enum_value" ? { message: u ?? o.defaultError } : typeof o.data > "u" ? { message: u ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: u ?? t ?? o.defaultError };
|
|
478
|
-
}, description: r };
|
|
479
|
-
}
|
|
480
|
-
class T {
|
|
481
|
-
get description() {
|
|
482
|
-
return this._def.description;
|
|
483
|
-
}
|
|
484
|
-
_getType(e) {
|
|
485
|
-
return q(e.data);
|
|
486
|
-
}
|
|
487
|
-
_getOrReturnCtx(e, t) {
|
|
488
|
-
return t || {
|
|
489
|
-
common: e.parent.common,
|
|
490
|
-
data: e.data,
|
|
491
|
-
parsedType: q(e.data),
|
|
492
|
-
schemaErrorMap: this._def.errorMap,
|
|
493
|
-
path: e.path,
|
|
494
|
-
parent: e.parent
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
_processInputParams(e) {
|
|
498
|
-
return {
|
|
499
|
-
status: new L(),
|
|
500
|
-
ctx: {
|
|
501
|
-
common: e.parent.common,
|
|
502
|
-
data: e.data,
|
|
503
|
-
parsedType: q(e.data),
|
|
504
|
-
schemaErrorMap: this._def.errorMap,
|
|
505
|
-
path: e.path,
|
|
506
|
-
parent: e.parent
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
_parseSync(e) {
|
|
511
|
-
const t = this._parse(e);
|
|
512
|
-
if (xe(t))
|
|
513
|
-
throw new Error("Synchronous parse encountered promise.");
|
|
514
|
-
return t;
|
|
515
|
-
}
|
|
516
|
-
_parseAsync(e) {
|
|
517
|
-
const t = this._parse(e);
|
|
518
|
-
return Promise.resolve(t);
|
|
519
|
-
}
|
|
520
|
-
parse(e, t) {
|
|
521
|
-
const n = this.safeParse(e, t);
|
|
522
|
-
if (n.success)
|
|
523
|
-
return n.data;
|
|
524
|
-
throw n.error;
|
|
525
|
-
}
|
|
526
|
-
safeParse(e, t) {
|
|
527
|
-
const n = {
|
|
528
|
-
common: {
|
|
529
|
-
issues: [],
|
|
530
|
-
async: (t == null ? void 0 : t.async) ?? !1,
|
|
531
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap
|
|
532
|
-
},
|
|
533
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
534
|
-
schemaErrorMap: this._def.errorMap,
|
|
535
|
-
parent: null,
|
|
536
|
-
data: e,
|
|
537
|
-
parsedType: q(e)
|
|
538
|
-
}, r = this._parseSync({ data: e, path: n.path, parent: n });
|
|
539
|
-
return ot(n, r);
|
|
540
|
-
}
|
|
541
|
-
"~validate"(e) {
|
|
542
|
-
var n, r;
|
|
543
|
-
const t = {
|
|
544
|
-
common: {
|
|
545
|
-
issues: [],
|
|
546
|
-
async: !!this["~standard"].async
|
|
547
|
-
},
|
|
548
|
-
path: [],
|
|
549
|
-
schemaErrorMap: this._def.errorMap,
|
|
550
|
-
parent: null,
|
|
551
|
-
data: e,
|
|
552
|
-
parsedType: q(e)
|
|
553
|
-
};
|
|
554
|
-
if (!this["~standard"].async)
|
|
555
|
-
try {
|
|
556
|
-
const a = this._parseSync({ data: e, path: [], parent: t });
|
|
557
|
-
return ne(a) ? {
|
|
558
|
-
value: a.value
|
|
559
|
-
} : {
|
|
560
|
-
issues: t.common.issues
|
|
561
|
-
};
|
|
562
|
-
} catch (a) {
|
|
563
|
-
(r = (n = a == null ? void 0 : a.message) == null ? void 0 : n.toLowerCase()) != null && r.includes("encountered") && (this["~standard"].async = !0), t.common = {
|
|
564
|
-
issues: [],
|
|
565
|
-
async: !0
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((a) => ne(a) ? {
|
|
569
|
-
value: a.value
|
|
570
|
-
} : {
|
|
571
|
-
issues: t.common.issues
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
async parseAsync(e, t) {
|
|
575
|
-
const n = await this.safeParseAsync(e, t);
|
|
576
|
-
if (n.success)
|
|
577
|
-
return n.data;
|
|
578
|
-
throw n.error;
|
|
579
|
-
}
|
|
580
|
-
async safeParseAsync(e, t) {
|
|
581
|
-
const n = {
|
|
582
|
-
common: {
|
|
583
|
-
issues: [],
|
|
584
|
-
contextualErrorMap: t == null ? void 0 : t.errorMap,
|
|
585
|
-
async: !0
|
|
586
|
-
},
|
|
587
|
-
path: (t == null ? void 0 : t.path) || [],
|
|
588
|
-
schemaErrorMap: this._def.errorMap,
|
|
589
|
-
parent: null,
|
|
590
|
-
data: e,
|
|
591
|
-
parsedType: q(e)
|
|
592
|
-
}, r = this._parse({ data: e, path: n.path, parent: n }), a = await (xe(r) ? r : Promise.resolve(r));
|
|
593
|
-
return ot(n, a);
|
|
594
|
-
}
|
|
595
|
-
refine(e, t) {
|
|
596
|
-
const n = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
|
|
597
|
-
return this._refinement((r, a) => {
|
|
598
|
-
const i = e(r), o = () => a.addIssue({
|
|
599
|
-
code: d.custom,
|
|
600
|
-
...n(r)
|
|
601
|
-
});
|
|
602
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
refinement(e, t) {
|
|
606
|
-
return this._refinement((n, r) => e(n) ? !0 : (r.addIssue(typeof t == "function" ? t(n, r) : t), !1));
|
|
607
|
-
}
|
|
608
|
-
_refinement(e) {
|
|
609
|
-
return new ie({
|
|
610
|
-
schema: this,
|
|
611
|
-
typeName: w.ZodEffects,
|
|
612
|
-
effect: { type: "refinement", refinement: e }
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
superRefine(e) {
|
|
616
|
-
return this._refinement(e);
|
|
617
|
-
}
|
|
618
|
-
constructor(e) {
|
|
619
|
-
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
|
|
620
|
-
version: 1,
|
|
621
|
-
vendor: "zod",
|
|
622
|
-
validate: (t) => this["~validate"](t)
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
optional() {
|
|
626
|
-
return Y.create(this, this._def);
|
|
627
|
-
}
|
|
628
|
-
nullable() {
|
|
629
|
-
return oe.create(this, this._def);
|
|
630
|
-
}
|
|
631
|
-
nullish() {
|
|
632
|
-
return this.nullable().optional();
|
|
633
|
-
}
|
|
634
|
-
array() {
|
|
635
|
-
return U.create(this);
|
|
636
|
-
}
|
|
637
|
-
promise() {
|
|
638
|
-
return pe.create(this, this._def);
|
|
639
|
-
}
|
|
640
|
-
or(e) {
|
|
641
|
-
return be.create([this, e], this._def);
|
|
642
|
-
}
|
|
643
|
-
and(e) {
|
|
644
|
-
return we.create(this, e, this._def);
|
|
645
|
-
}
|
|
646
|
-
transform(e) {
|
|
647
|
-
return new ie({
|
|
648
|
-
...A(this._def),
|
|
649
|
-
schema: this,
|
|
650
|
-
typeName: w.ZodEffects,
|
|
651
|
-
effect: { type: "transform", transform: e }
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
default(e) {
|
|
655
|
-
const t = typeof e == "function" ? e : () => e;
|
|
656
|
-
return new Le({
|
|
657
|
-
...A(this._def),
|
|
658
|
-
innerType: this,
|
|
659
|
-
defaultValue: t,
|
|
660
|
-
typeName: w.ZodDefault
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
brand() {
|
|
664
|
-
return new Xt({
|
|
665
|
-
typeName: w.ZodBranded,
|
|
666
|
-
type: this,
|
|
667
|
-
...A(this._def)
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
catch(e) {
|
|
671
|
-
const t = typeof e == "function" ? e : () => e;
|
|
672
|
-
return new Ve({
|
|
673
|
-
...A(this._def),
|
|
674
|
-
innerType: this,
|
|
675
|
-
catchValue: t,
|
|
676
|
-
typeName: w.ZodCatch
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
describe(e) {
|
|
680
|
-
const t = this.constructor;
|
|
681
|
-
return new t({
|
|
682
|
-
...this._def,
|
|
683
|
-
description: e
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
pipe(e) {
|
|
687
|
-
return Ge.create(this, e);
|
|
688
|
-
}
|
|
689
|
-
readonly() {
|
|
690
|
-
return Fe.create(this);
|
|
691
|
-
}
|
|
692
|
-
isOptional() {
|
|
693
|
-
return this.safeParse(void 0).success;
|
|
694
|
-
}
|
|
695
|
-
isNullable() {
|
|
696
|
-
return this.safeParse(null).success;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
const Tt = /^c[^\s-]{8,}$/i, Ot = /^[0-9a-z]+$/, Ct = /^[0-9A-HJKMNP-TV-Z]{26}$/i, It = /^[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, Et = /^[a-z0-9_-]{21}$/i, Rt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Zt = /^[-+]?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)?)??$/, Mt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, jt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
700
|
-
let Ie;
|
|
701
|
-
const zt = /^(?:(?: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])$/, Pt = /^(?:(?: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])$/, $t = /^(([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]))$/, Dt = /^(([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])$/, Lt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Vt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, yt = "((\\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])))", Ft = new RegExp(`^${yt}$`);
|
|
702
|
-
function vt(s) {
|
|
703
|
-
let e = "[0-5]\\d";
|
|
704
|
-
s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
705
|
-
const t = s.precision ? "+" : "?";
|
|
706
|
-
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
707
|
-
}
|
|
708
|
-
function Ut(s) {
|
|
709
|
-
return new RegExp(`^${vt(s)}$`);
|
|
710
|
-
}
|
|
711
|
-
function Bt(s) {
|
|
712
|
-
let e = `${yt}T${vt(s)}`;
|
|
713
|
-
const t = [];
|
|
714
|
-
return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
715
|
-
}
|
|
716
|
-
function Wt(s, e) {
|
|
717
|
-
return !!((e === "v4" || !e) && zt.test(s) || (e === "v6" || !e) && $t.test(s));
|
|
718
|
-
}
|
|
719
|
-
function qt(s, e) {
|
|
720
|
-
if (!Rt.test(s))
|
|
721
|
-
return !1;
|
|
722
|
-
try {
|
|
723
|
-
const [t] = s.split(".");
|
|
724
|
-
if (!t)
|
|
725
|
-
return !1;
|
|
726
|
-
const n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(n));
|
|
727
|
-
return !(typeof r != "object" || r === null || "typ" in r && (r == null ? void 0 : r.typ) !== "JWT" || !r.alg || e && r.alg !== e);
|
|
728
|
-
} catch {
|
|
729
|
-
return !1;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
function Gt(s, e) {
|
|
733
|
-
return !!((e === "v4" || !e) && Pt.test(s) || (e === "v6" || !e) && Dt.test(s));
|
|
734
|
-
}
|
|
735
|
-
class G extends T {
|
|
736
|
-
_parse(e) {
|
|
737
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
|
|
738
|
-
const a = this._getOrReturnCtx(e);
|
|
739
|
-
return h(a, {
|
|
740
|
-
code: d.invalid_type,
|
|
741
|
-
expected: m.string,
|
|
742
|
-
received: a.parsedType
|
|
743
|
-
}), b;
|
|
744
|
-
}
|
|
745
|
-
const n = new L();
|
|
746
|
-
let r;
|
|
747
|
-
for (const a of this._def.checks)
|
|
748
|
-
if (a.kind === "min")
|
|
749
|
-
e.data.length < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
750
|
-
code: d.too_small,
|
|
751
|
-
minimum: a.value,
|
|
752
|
-
type: "string",
|
|
753
|
-
inclusive: !0,
|
|
754
|
-
exact: !1,
|
|
755
|
-
message: a.message
|
|
756
|
-
}), n.dirty());
|
|
757
|
-
else if (a.kind === "max")
|
|
758
|
-
e.data.length > a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
759
|
-
code: d.too_big,
|
|
760
|
-
maximum: a.value,
|
|
761
|
-
type: "string",
|
|
762
|
-
inclusive: !0,
|
|
763
|
-
exact: !1,
|
|
764
|
-
message: a.message
|
|
765
|
-
}), n.dirty());
|
|
766
|
-
else if (a.kind === "length") {
|
|
767
|
-
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
768
|
-
(i || o) && (r = this._getOrReturnCtx(e, r), i ? h(r, {
|
|
769
|
-
code: d.too_big,
|
|
770
|
-
maximum: a.value,
|
|
771
|
-
type: "string",
|
|
772
|
-
inclusive: !0,
|
|
773
|
-
exact: !0,
|
|
774
|
-
message: a.message
|
|
775
|
-
}) : o && h(r, {
|
|
776
|
-
code: d.too_small,
|
|
777
|
-
minimum: a.value,
|
|
778
|
-
type: "string",
|
|
779
|
-
inclusive: !0,
|
|
780
|
-
exact: !0,
|
|
781
|
-
message: a.message
|
|
782
|
-
}), n.dirty());
|
|
783
|
-
} else if (a.kind === "email")
|
|
784
|
-
Mt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
785
|
-
validation: "email",
|
|
786
|
-
code: d.invalid_string,
|
|
787
|
-
message: a.message
|
|
788
|
-
}), n.dirty());
|
|
789
|
-
else if (a.kind === "emoji")
|
|
790
|
-
Ie || (Ie = new RegExp(jt, "u")), Ie.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
791
|
-
validation: "emoji",
|
|
792
|
-
code: d.invalid_string,
|
|
793
|
-
message: a.message
|
|
794
|
-
}), n.dirty());
|
|
795
|
-
else if (a.kind === "uuid")
|
|
796
|
-
It.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
797
|
-
validation: "uuid",
|
|
798
|
-
code: d.invalid_string,
|
|
799
|
-
message: a.message
|
|
800
|
-
}), n.dirty());
|
|
801
|
-
else if (a.kind === "nanoid")
|
|
802
|
-
Et.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
803
|
-
validation: "nanoid",
|
|
804
|
-
code: d.invalid_string,
|
|
805
|
-
message: a.message
|
|
806
|
-
}), n.dirty());
|
|
807
|
-
else if (a.kind === "cuid")
|
|
808
|
-
Tt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
809
|
-
validation: "cuid",
|
|
810
|
-
code: d.invalid_string,
|
|
811
|
-
message: a.message
|
|
812
|
-
}), n.dirty());
|
|
813
|
-
else if (a.kind === "cuid2")
|
|
814
|
-
Ot.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
815
|
-
validation: "cuid2",
|
|
816
|
-
code: d.invalid_string,
|
|
817
|
-
message: a.message
|
|
818
|
-
}), n.dirty());
|
|
819
|
-
else if (a.kind === "ulid")
|
|
820
|
-
Ct.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
821
|
-
validation: "ulid",
|
|
822
|
-
code: d.invalid_string,
|
|
823
|
-
message: a.message
|
|
824
|
-
}), n.dirty());
|
|
825
|
-
else if (a.kind === "url")
|
|
826
|
-
try {
|
|
827
|
-
new URL(e.data);
|
|
828
|
-
} catch {
|
|
829
|
-
r = this._getOrReturnCtx(e, r), h(r, {
|
|
830
|
-
validation: "url",
|
|
831
|
-
code: d.invalid_string,
|
|
832
|
-
message: a.message
|
|
833
|
-
}), n.dirty();
|
|
834
|
-
}
|
|
835
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
836
|
-
validation: "regex",
|
|
837
|
-
code: d.invalid_string,
|
|
838
|
-
message: a.message
|
|
839
|
-
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
840
|
-
code: d.invalid_string,
|
|
841
|
-
validation: { includes: a.value, position: a.position },
|
|
842
|
-
message: a.message
|
|
843
|
-
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
844
|
-
code: d.invalid_string,
|
|
845
|
-
validation: { startsWith: a.value },
|
|
846
|
-
message: a.message
|
|
847
|
-
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
848
|
-
code: d.invalid_string,
|
|
849
|
-
validation: { endsWith: a.value },
|
|
850
|
-
message: a.message
|
|
851
|
-
}), n.dirty()) : a.kind === "datetime" ? Bt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
852
|
-
code: d.invalid_string,
|
|
853
|
-
validation: "datetime",
|
|
854
|
-
message: a.message
|
|
855
|
-
}), n.dirty()) : a.kind === "date" ? Ft.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
856
|
-
code: d.invalid_string,
|
|
857
|
-
validation: "date",
|
|
858
|
-
message: a.message
|
|
859
|
-
}), n.dirty()) : a.kind === "time" ? Ut(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
860
|
-
code: d.invalid_string,
|
|
861
|
-
validation: "time",
|
|
862
|
-
message: a.message
|
|
863
|
-
}), n.dirty()) : a.kind === "duration" ? Zt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
864
|
-
validation: "duration",
|
|
865
|
-
code: d.invalid_string,
|
|
866
|
-
message: a.message
|
|
867
|
-
}), n.dirty()) : a.kind === "ip" ? Wt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
868
|
-
validation: "ip",
|
|
869
|
-
code: d.invalid_string,
|
|
870
|
-
message: a.message
|
|
871
|
-
}), n.dirty()) : a.kind === "jwt" ? qt(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
872
|
-
validation: "jwt",
|
|
873
|
-
code: d.invalid_string,
|
|
874
|
-
message: a.message
|
|
875
|
-
}), n.dirty()) : a.kind === "cidr" ? Gt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
876
|
-
validation: "cidr",
|
|
877
|
-
code: d.invalid_string,
|
|
878
|
-
message: a.message
|
|
879
|
-
}), n.dirty()) : a.kind === "base64" ? Lt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
880
|
-
validation: "base64",
|
|
881
|
-
code: d.invalid_string,
|
|
882
|
-
message: a.message
|
|
883
|
-
}), n.dirty()) : a.kind === "base64url" ? Vt.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
884
|
-
validation: "base64url",
|
|
885
|
-
code: d.invalid_string,
|
|
886
|
-
message: a.message
|
|
887
|
-
}), n.dirty()) : O.assertNever(a);
|
|
888
|
-
return { status: n.value, value: e.data };
|
|
889
|
-
}
|
|
890
|
-
_regex(e, t, n) {
|
|
891
|
-
return this.refinement((r) => e.test(r), {
|
|
892
|
-
validation: t,
|
|
893
|
-
code: d.invalid_string,
|
|
894
|
-
...y.errToObj(n)
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
_addCheck(e) {
|
|
898
|
-
return new G({
|
|
899
|
-
...this._def,
|
|
900
|
-
checks: [...this._def.checks, e]
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
email(e) {
|
|
904
|
-
return this._addCheck({ kind: "email", ...y.errToObj(e) });
|
|
905
|
-
}
|
|
906
|
-
url(e) {
|
|
907
|
-
return this._addCheck({ kind: "url", ...y.errToObj(e) });
|
|
908
|
-
}
|
|
909
|
-
emoji(e) {
|
|
910
|
-
return this._addCheck({ kind: "emoji", ...y.errToObj(e) });
|
|
911
|
-
}
|
|
912
|
-
uuid(e) {
|
|
913
|
-
return this._addCheck({ kind: "uuid", ...y.errToObj(e) });
|
|
914
|
-
}
|
|
915
|
-
nanoid(e) {
|
|
916
|
-
return this._addCheck({ kind: "nanoid", ...y.errToObj(e) });
|
|
917
|
-
}
|
|
918
|
-
cuid(e) {
|
|
919
|
-
return this._addCheck({ kind: "cuid", ...y.errToObj(e) });
|
|
920
|
-
}
|
|
921
|
-
cuid2(e) {
|
|
922
|
-
return this._addCheck({ kind: "cuid2", ...y.errToObj(e) });
|
|
923
|
-
}
|
|
924
|
-
ulid(e) {
|
|
925
|
-
return this._addCheck({ kind: "ulid", ...y.errToObj(e) });
|
|
926
|
-
}
|
|
927
|
-
base64(e) {
|
|
928
|
-
return this._addCheck({ kind: "base64", ...y.errToObj(e) });
|
|
929
|
-
}
|
|
930
|
-
base64url(e) {
|
|
931
|
-
return this._addCheck({
|
|
932
|
-
kind: "base64url",
|
|
933
|
-
...y.errToObj(e)
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
jwt(e) {
|
|
937
|
-
return this._addCheck({ kind: "jwt", ...y.errToObj(e) });
|
|
938
|
-
}
|
|
939
|
-
ip(e) {
|
|
940
|
-
return this._addCheck({ kind: "ip", ...y.errToObj(e) });
|
|
941
|
-
}
|
|
942
|
-
cidr(e) {
|
|
943
|
-
return this._addCheck({ kind: "cidr", ...y.errToObj(e) });
|
|
944
|
-
}
|
|
945
|
-
datetime(e) {
|
|
946
|
-
return typeof e == "string" ? this._addCheck({
|
|
947
|
-
kind: "datetime",
|
|
948
|
-
precision: null,
|
|
949
|
-
offset: !1,
|
|
950
|
-
local: !1,
|
|
951
|
-
message: e
|
|
952
|
-
}) : this._addCheck({
|
|
953
|
-
kind: "datetime",
|
|
954
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
955
|
-
offset: (e == null ? void 0 : e.offset) ?? !1,
|
|
956
|
-
local: (e == null ? void 0 : e.local) ?? !1,
|
|
957
|
-
...y.errToObj(e == null ? void 0 : e.message)
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
date(e) {
|
|
961
|
-
return this._addCheck({ kind: "date", message: e });
|
|
962
|
-
}
|
|
963
|
-
time(e) {
|
|
964
|
-
return typeof e == "string" ? this._addCheck({
|
|
965
|
-
kind: "time",
|
|
966
|
-
precision: null,
|
|
967
|
-
message: e
|
|
968
|
-
}) : this._addCheck({
|
|
969
|
-
kind: "time",
|
|
970
|
-
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
971
|
-
...y.errToObj(e == null ? void 0 : e.message)
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
duration(e) {
|
|
975
|
-
return this._addCheck({ kind: "duration", ...y.errToObj(e) });
|
|
976
|
-
}
|
|
977
|
-
regex(e, t) {
|
|
978
|
-
return this._addCheck({
|
|
979
|
-
kind: "regex",
|
|
980
|
-
regex: e,
|
|
981
|
-
...y.errToObj(t)
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
includes(e, t) {
|
|
985
|
-
return this._addCheck({
|
|
986
|
-
kind: "includes",
|
|
987
|
-
value: e,
|
|
988
|
-
position: t == null ? void 0 : t.position,
|
|
989
|
-
...y.errToObj(t == null ? void 0 : t.message)
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
startsWith(e, t) {
|
|
993
|
-
return this._addCheck({
|
|
994
|
-
kind: "startsWith",
|
|
995
|
-
value: e,
|
|
996
|
-
...y.errToObj(t)
|
|
997
|
-
});
|
|
998
|
-
}
|
|
999
|
-
endsWith(e, t) {
|
|
1000
|
-
return this._addCheck({
|
|
1001
|
-
kind: "endsWith",
|
|
1002
|
-
value: e,
|
|
1003
|
-
...y.errToObj(t)
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1006
|
-
min(e, t) {
|
|
1007
|
-
return this._addCheck({
|
|
1008
|
-
kind: "min",
|
|
1009
|
-
value: e,
|
|
1010
|
-
...y.errToObj(t)
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
max(e, t) {
|
|
1014
|
-
return this._addCheck({
|
|
1015
|
-
kind: "max",
|
|
1016
|
-
value: e,
|
|
1017
|
-
...y.errToObj(t)
|
|
1018
|
-
});
|
|
1019
|
-
}
|
|
1020
|
-
length(e, t) {
|
|
1021
|
-
return this._addCheck({
|
|
1022
|
-
kind: "length",
|
|
1023
|
-
value: e,
|
|
1024
|
-
...y.errToObj(t)
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Equivalent to `.min(1)`
|
|
1029
|
-
*/
|
|
1030
|
-
nonempty(e) {
|
|
1031
|
-
return this.min(1, y.errToObj(e));
|
|
1032
|
-
}
|
|
1033
|
-
trim() {
|
|
1034
|
-
return new G({
|
|
1035
|
-
...this._def,
|
|
1036
|
-
checks: [...this._def.checks, { kind: "trim" }]
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
toLowerCase() {
|
|
1040
|
-
return new G({
|
|
1041
|
-
...this._def,
|
|
1042
|
-
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
toUpperCase() {
|
|
1046
|
-
return new G({
|
|
1047
|
-
...this._def,
|
|
1048
|
-
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
get isDatetime() {
|
|
1052
|
-
return !!this._def.checks.find((e) => e.kind === "datetime");
|
|
1053
|
-
}
|
|
1054
|
-
get isDate() {
|
|
1055
|
-
return !!this._def.checks.find((e) => e.kind === "date");
|
|
1056
|
-
}
|
|
1057
|
-
get isTime() {
|
|
1058
|
-
return !!this._def.checks.find((e) => e.kind === "time");
|
|
1059
|
-
}
|
|
1060
|
-
get isDuration() {
|
|
1061
|
-
return !!this._def.checks.find((e) => e.kind === "duration");
|
|
1062
|
-
}
|
|
1063
|
-
get isEmail() {
|
|
1064
|
-
return !!this._def.checks.find((e) => e.kind === "email");
|
|
1065
|
-
}
|
|
1066
|
-
get isURL() {
|
|
1067
|
-
return !!this._def.checks.find((e) => e.kind === "url");
|
|
1068
|
-
}
|
|
1069
|
-
get isEmoji() {
|
|
1070
|
-
return !!this._def.checks.find((e) => e.kind === "emoji");
|
|
1071
|
-
}
|
|
1072
|
-
get isUUID() {
|
|
1073
|
-
return !!this._def.checks.find((e) => e.kind === "uuid");
|
|
1074
|
-
}
|
|
1075
|
-
get isNANOID() {
|
|
1076
|
-
return !!this._def.checks.find((e) => e.kind === "nanoid");
|
|
1077
|
-
}
|
|
1078
|
-
get isCUID() {
|
|
1079
|
-
return !!this._def.checks.find((e) => e.kind === "cuid");
|
|
1080
|
-
}
|
|
1081
|
-
get isCUID2() {
|
|
1082
|
-
return !!this._def.checks.find((e) => e.kind === "cuid2");
|
|
1083
|
-
}
|
|
1084
|
-
get isULID() {
|
|
1085
|
-
return !!this._def.checks.find((e) => e.kind === "ulid");
|
|
1086
|
-
}
|
|
1087
|
-
get isIP() {
|
|
1088
|
-
return !!this._def.checks.find((e) => e.kind === "ip");
|
|
1089
|
-
}
|
|
1090
|
-
get isCIDR() {
|
|
1091
|
-
return !!this._def.checks.find((e) => e.kind === "cidr");
|
|
1092
|
-
}
|
|
1093
|
-
get isBase64() {
|
|
1094
|
-
return !!this._def.checks.find((e) => e.kind === "base64");
|
|
1095
|
-
}
|
|
1096
|
-
get isBase64url() {
|
|
1097
|
-
return !!this._def.checks.find((e) => e.kind === "base64url");
|
|
1098
|
-
}
|
|
1099
|
-
get minLength() {
|
|
1100
|
-
let e = null;
|
|
1101
|
-
for (const t of this._def.checks)
|
|
1102
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1103
|
-
return e;
|
|
1104
|
-
}
|
|
1105
|
-
get maxLength() {
|
|
1106
|
-
let e = null;
|
|
1107
|
-
for (const t of this._def.checks)
|
|
1108
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1109
|
-
return e;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
G.create = (s) => new G({
|
|
1113
|
-
checks: [],
|
|
1114
|
-
typeName: w.ZodString,
|
|
1115
|
-
coerce: (s == null ? void 0 : s.coerce) ?? !1,
|
|
1116
|
-
...A(s)
|
|
1117
|
-
});
|
|
1118
|
-
function Yt(s, e) {
|
|
1119
|
-
const t = (s.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = t > n ? t : n, a = Number.parseInt(s.toFixed(r).replace(".", "")), i = Number.parseInt(e.toFixed(r).replace(".", ""));
|
|
1120
|
-
return a % i / 10 ** r;
|
|
1121
|
-
}
|
|
1122
|
-
class re extends T {
|
|
1123
|
-
constructor() {
|
|
1124
|
-
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1125
|
-
}
|
|
1126
|
-
_parse(e) {
|
|
1127
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
|
|
1128
|
-
const a = this._getOrReturnCtx(e);
|
|
1129
|
-
return h(a, {
|
|
1130
|
-
code: d.invalid_type,
|
|
1131
|
-
expected: m.number,
|
|
1132
|
-
received: a.parsedType
|
|
1133
|
-
}), b;
|
|
1134
|
-
}
|
|
1135
|
-
let n;
|
|
1136
|
-
const r = new L();
|
|
1137
|
-
for (const a of this._def.checks)
|
|
1138
|
-
a.kind === "int" ? O.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1139
|
-
code: d.invalid_type,
|
|
1140
|
-
expected: "integer",
|
|
1141
|
-
received: "float",
|
|
1142
|
-
message: a.message
|
|
1143
|
-
}), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1144
|
-
code: d.too_small,
|
|
1145
|
-
minimum: a.value,
|
|
1146
|
-
type: "number",
|
|
1147
|
-
inclusive: a.inclusive,
|
|
1148
|
-
exact: !1,
|
|
1149
|
-
message: a.message
|
|
1150
|
-
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1151
|
-
code: d.too_big,
|
|
1152
|
-
maximum: a.value,
|
|
1153
|
-
type: "number",
|
|
1154
|
-
inclusive: a.inclusive,
|
|
1155
|
-
exact: !1,
|
|
1156
|
-
message: a.message
|
|
1157
|
-
}), r.dirty()) : a.kind === "multipleOf" ? Yt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1158
|
-
code: d.not_multiple_of,
|
|
1159
|
-
multipleOf: a.value,
|
|
1160
|
-
message: a.message
|
|
1161
|
-
}), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1162
|
-
code: d.not_finite,
|
|
1163
|
-
message: a.message
|
|
1164
|
-
}), r.dirty()) : O.assertNever(a);
|
|
1165
|
-
return { status: r.value, value: e.data };
|
|
1166
|
-
}
|
|
1167
|
-
gte(e, t) {
|
|
1168
|
-
return this.setLimit("min", e, !0, y.toString(t));
|
|
1169
|
-
}
|
|
1170
|
-
gt(e, t) {
|
|
1171
|
-
return this.setLimit("min", e, !1, y.toString(t));
|
|
1172
|
-
}
|
|
1173
|
-
lte(e, t) {
|
|
1174
|
-
return this.setLimit("max", e, !0, y.toString(t));
|
|
1175
|
-
}
|
|
1176
|
-
lt(e, t) {
|
|
1177
|
-
return this.setLimit("max", e, !1, y.toString(t));
|
|
1178
|
-
}
|
|
1179
|
-
setLimit(e, t, n, r) {
|
|
1180
|
-
return new re({
|
|
1181
|
-
...this._def,
|
|
1182
|
-
checks: [
|
|
1183
|
-
...this._def.checks,
|
|
1184
|
-
{
|
|
1185
|
-
kind: e,
|
|
1186
|
-
value: t,
|
|
1187
|
-
inclusive: n,
|
|
1188
|
-
message: y.toString(r)
|
|
1189
|
-
}
|
|
1190
|
-
]
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
_addCheck(e) {
|
|
1194
|
-
return new re({
|
|
1195
|
-
...this._def,
|
|
1196
|
-
checks: [...this._def.checks, e]
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
int(e) {
|
|
1200
|
-
return this._addCheck({
|
|
1201
|
-
kind: "int",
|
|
1202
|
-
message: y.toString(e)
|
|
1203
|
-
});
|
|
1204
|
-
}
|
|
1205
|
-
positive(e) {
|
|
1206
|
-
return this._addCheck({
|
|
1207
|
-
kind: "min",
|
|
1208
|
-
value: 0,
|
|
1209
|
-
inclusive: !1,
|
|
1210
|
-
message: y.toString(e)
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
negative(e) {
|
|
1214
|
-
return this._addCheck({
|
|
1215
|
-
kind: "max",
|
|
1216
|
-
value: 0,
|
|
1217
|
-
inclusive: !1,
|
|
1218
|
-
message: y.toString(e)
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
nonpositive(e) {
|
|
1222
|
-
return this._addCheck({
|
|
1223
|
-
kind: "max",
|
|
1224
|
-
value: 0,
|
|
1225
|
-
inclusive: !0,
|
|
1226
|
-
message: y.toString(e)
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
|
-
nonnegative(e) {
|
|
1230
|
-
return this._addCheck({
|
|
1231
|
-
kind: "min",
|
|
1232
|
-
value: 0,
|
|
1233
|
-
inclusive: !0,
|
|
1234
|
-
message: y.toString(e)
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
multipleOf(e, t) {
|
|
1238
|
-
return this._addCheck({
|
|
1239
|
-
kind: "multipleOf",
|
|
1240
|
-
value: e,
|
|
1241
|
-
message: y.toString(t)
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
finite(e) {
|
|
1245
|
-
return this._addCheck({
|
|
1246
|
-
kind: "finite",
|
|
1247
|
-
message: y.toString(e)
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
safe(e) {
|
|
1251
|
-
return this._addCheck({
|
|
1252
|
-
kind: "min",
|
|
1253
|
-
inclusive: !0,
|
|
1254
|
-
value: Number.MIN_SAFE_INTEGER,
|
|
1255
|
-
message: y.toString(e)
|
|
1256
|
-
})._addCheck({
|
|
1257
|
-
kind: "max",
|
|
1258
|
-
inclusive: !0,
|
|
1259
|
-
value: Number.MAX_SAFE_INTEGER,
|
|
1260
|
-
message: y.toString(e)
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
get minValue() {
|
|
1264
|
-
let e = null;
|
|
1265
|
-
for (const t of this._def.checks)
|
|
1266
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1267
|
-
return e;
|
|
1268
|
-
}
|
|
1269
|
-
get maxValue() {
|
|
1270
|
-
let e = null;
|
|
1271
|
-
for (const t of this._def.checks)
|
|
1272
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1273
|
-
return e;
|
|
1274
|
-
}
|
|
1275
|
-
get isInt() {
|
|
1276
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && O.isInteger(e.value));
|
|
1277
|
-
}
|
|
1278
|
-
get isFinite() {
|
|
1279
|
-
let e = null, t = null;
|
|
1280
|
-
for (const n of this._def.checks) {
|
|
1281
|
-
if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
|
|
1282
|
-
return !0;
|
|
1283
|
-
n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
|
|
1284
|
-
}
|
|
1285
|
-
return Number.isFinite(t) && Number.isFinite(e);
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
re.create = (s) => new re({
|
|
1289
|
-
checks: [],
|
|
1290
|
-
typeName: w.ZodNumber,
|
|
1291
|
-
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1292
|
-
...A(s)
|
|
1293
|
-
});
|
|
1294
|
-
class fe extends T {
|
|
1295
|
-
constructor() {
|
|
1296
|
-
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1297
|
-
}
|
|
1298
|
-
_parse(e) {
|
|
1299
|
-
if (this._def.coerce)
|
|
1300
|
-
try {
|
|
1301
|
-
e.data = BigInt(e.data);
|
|
1302
|
-
} catch {
|
|
1303
|
-
return this._getInvalidInput(e);
|
|
1304
|
-
}
|
|
1305
|
-
if (this._getType(e) !== m.bigint)
|
|
1306
|
-
return this._getInvalidInput(e);
|
|
1307
|
-
let n;
|
|
1308
|
-
const r = new L();
|
|
1309
|
-
for (const a of this._def.checks)
|
|
1310
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1311
|
-
code: d.too_small,
|
|
1312
|
-
type: "bigint",
|
|
1313
|
-
minimum: a.value,
|
|
1314
|
-
inclusive: a.inclusive,
|
|
1315
|
-
message: a.message
|
|
1316
|
-
}), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1317
|
-
code: d.too_big,
|
|
1318
|
-
type: "bigint",
|
|
1319
|
-
maximum: a.value,
|
|
1320
|
-
inclusive: a.inclusive,
|
|
1321
|
-
message: a.message
|
|
1322
|
-
}), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1323
|
-
code: d.not_multiple_of,
|
|
1324
|
-
multipleOf: a.value,
|
|
1325
|
-
message: a.message
|
|
1326
|
-
}), r.dirty()) : O.assertNever(a);
|
|
1327
|
-
return { status: r.value, value: e.data };
|
|
1328
|
-
}
|
|
1329
|
-
_getInvalidInput(e) {
|
|
1330
|
-
const t = this._getOrReturnCtx(e);
|
|
1331
|
-
return h(t, {
|
|
1332
|
-
code: d.invalid_type,
|
|
1333
|
-
expected: m.bigint,
|
|
1334
|
-
received: t.parsedType
|
|
1335
|
-
}), b;
|
|
1336
|
-
}
|
|
1337
|
-
gte(e, t) {
|
|
1338
|
-
return this.setLimit("min", e, !0, y.toString(t));
|
|
1339
|
-
}
|
|
1340
|
-
gt(e, t) {
|
|
1341
|
-
return this.setLimit("min", e, !1, y.toString(t));
|
|
1342
|
-
}
|
|
1343
|
-
lte(e, t) {
|
|
1344
|
-
return this.setLimit("max", e, !0, y.toString(t));
|
|
1345
|
-
}
|
|
1346
|
-
lt(e, t) {
|
|
1347
|
-
return this.setLimit("max", e, !1, y.toString(t));
|
|
1348
|
-
}
|
|
1349
|
-
setLimit(e, t, n, r) {
|
|
1350
|
-
return new fe({
|
|
1351
|
-
...this._def,
|
|
1352
|
-
checks: [
|
|
1353
|
-
...this._def.checks,
|
|
1354
|
-
{
|
|
1355
|
-
kind: e,
|
|
1356
|
-
value: t,
|
|
1357
|
-
inclusive: n,
|
|
1358
|
-
message: y.toString(r)
|
|
1359
|
-
}
|
|
1360
|
-
]
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
|
-
_addCheck(e) {
|
|
1364
|
-
return new fe({
|
|
1365
|
-
...this._def,
|
|
1366
|
-
checks: [...this._def.checks, e]
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
positive(e) {
|
|
1370
|
-
return this._addCheck({
|
|
1371
|
-
kind: "min",
|
|
1372
|
-
value: BigInt(0),
|
|
1373
|
-
inclusive: !1,
|
|
1374
|
-
message: y.toString(e)
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
negative(e) {
|
|
1378
|
-
return this._addCheck({
|
|
1379
|
-
kind: "max",
|
|
1380
|
-
value: BigInt(0),
|
|
1381
|
-
inclusive: !1,
|
|
1382
|
-
message: y.toString(e)
|
|
1383
|
-
});
|
|
1384
|
-
}
|
|
1385
|
-
nonpositive(e) {
|
|
1386
|
-
return this._addCheck({
|
|
1387
|
-
kind: "max",
|
|
1388
|
-
value: BigInt(0),
|
|
1389
|
-
inclusive: !0,
|
|
1390
|
-
message: y.toString(e)
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
1393
|
-
nonnegative(e) {
|
|
1394
|
-
return this._addCheck({
|
|
1395
|
-
kind: "min",
|
|
1396
|
-
value: BigInt(0),
|
|
1397
|
-
inclusive: !0,
|
|
1398
|
-
message: y.toString(e)
|
|
1399
|
-
});
|
|
1400
|
-
}
|
|
1401
|
-
multipleOf(e, t) {
|
|
1402
|
-
return this._addCheck({
|
|
1403
|
-
kind: "multipleOf",
|
|
1404
|
-
value: e,
|
|
1405
|
-
message: y.toString(t)
|
|
1406
|
-
});
|
|
1407
|
-
}
|
|
1408
|
-
get minValue() {
|
|
1409
|
-
let e = null;
|
|
1410
|
-
for (const t of this._def.checks)
|
|
1411
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1412
|
-
return e;
|
|
1413
|
-
}
|
|
1414
|
-
get maxValue() {
|
|
1415
|
-
let e = null;
|
|
1416
|
-
for (const t of this._def.checks)
|
|
1417
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1418
|
-
return e;
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
fe.create = (s) => new fe({
|
|
1422
|
-
checks: [],
|
|
1423
|
-
typeName: w.ZodBigInt,
|
|
1424
|
-
coerce: (s == null ? void 0 : s.coerce) ?? !1,
|
|
1425
|
-
...A(s)
|
|
1426
|
-
});
|
|
1427
|
-
class ze extends T {
|
|
1428
|
-
_parse(e) {
|
|
1429
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
|
|
1430
|
-
const n = this._getOrReturnCtx(e);
|
|
1431
|
-
return h(n, {
|
|
1432
|
-
code: d.invalid_type,
|
|
1433
|
-
expected: m.boolean,
|
|
1434
|
-
received: n.parsedType
|
|
1435
|
-
}), b;
|
|
1436
|
-
}
|
|
1437
|
-
return $(e.data);
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
ze.create = (s) => new ze({
|
|
1441
|
-
typeName: w.ZodBoolean,
|
|
1442
|
-
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1443
|
-
...A(s)
|
|
1444
|
-
});
|
|
1445
|
-
class ke extends T {
|
|
1446
|
-
_parse(e) {
|
|
1447
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
|
|
1448
|
-
const a = this._getOrReturnCtx(e);
|
|
1449
|
-
return h(a, {
|
|
1450
|
-
code: d.invalid_type,
|
|
1451
|
-
expected: m.date,
|
|
1452
|
-
received: a.parsedType
|
|
1453
|
-
}), b;
|
|
1454
|
-
}
|
|
1455
|
-
if (Number.isNaN(e.data.getTime())) {
|
|
1456
|
-
const a = this._getOrReturnCtx(e);
|
|
1457
|
-
return h(a, {
|
|
1458
|
-
code: d.invalid_date
|
|
1459
|
-
}), b;
|
|
1460
|
-
}
|
|
1461
|
-
const n = new L();
|
|
1462
|
-
let r;
|
|
1463
|
-
for (const a of this._def.checks)
|
|
1464
|
-
a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1465
|
-
code: d.too_small,
|
|
1466
|
-
message: a.message,
|
|
1467
|
-
inclusive: !0,
|
|
1468
|
-
exact: !1,
|
|
1469
|
-
minimum: a.value,
|
|
1470
|
-
type: "date"
|
|
1471
|
-
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1472
|
-
code: d.too_big,
|
|
1473
|
-
message: a.message,
|
|
1474
|
-
inclusive: !0,
|
|
1475
|
-
exact: !1,
|
|
1476
|
-
maximum: a.value,
|
|
1477
|
-
type: "date"
|
|
1478
|
-
}), n.dirty()) : O.assertNever(a);
|
|
1479
|
-
return {
|
|
1480
|
-
status: n.value,
|
|
1481
|
-
value: new Date(e.data.getTime())
|
|
1482
|
-
};
|
|
1483
|
-
}
|
|
1484
|
-
_addCheck(e) {
|
|
1485
|
-
return new ke({
|
|
1486
|
-
...this._def,
|
|
1487
|
-
checks: [...this._def.checks, e]
|
|
1488
|
-
});
|
|
1489
|
-
}
|
|
1490
|
-
min(e, t) {
|
|
1491
|
-
return this._addCheck({
|
|
1492
|
-
kind: "min",
|
|
1493
|
-
value: e.getTime(),
|
|
1494
|
-
message: y.toString(t)
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
max(e, t) {
|
|
1498
|
-
return this._addCheck({
|
|
1499
|
-
kind: "max",
|
|
1500
|
-
value: e.getTime(),
|
|
1501
|
-
message: y.toString(t)
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
get minDate() {
|
|
1505
|
-
let e = null;
|
|
1506
|
-
for (const t of this._def.checks)
|
|
1507
|
-
t.kind === "min" && (e === null || t.value > e) && (e = t.value);
|
|
1508
|
-
return e != null ? new Date(e) : null;
|
|
1509
|
-
}
|
|
1510
|
-
get maxDate() {
|
|
1511
|
-
let e = null;
|
|
1512
|
-
for (const t of this._def.checks)
|
|
1513
|
-
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1514
|
-
return e != null ? new Date(e) : null;
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
ke.create = (s) => new ke({
|
|
1518
|
-
checks: [],
|
|
1519
|
-
coerce: (s == null ? void 0 : s.coerce) || !1,
|
|
1520
|
-
typeName: w.ZodDate,
|
|
1521
|
-
...A(s)
|
|
1522
|
-
});
|
|
1523
|
-
class ct extends T {
|
|
1524
|
-
_parse(e) {
|
|
1525
|
-
if (this._getType(e) !== m.symbol) {
|
|
1526
|
-
const n = this._getOrReturnCtx(e);
|
|
1527
|
-
return h(n, {
|
|
1528
|
-
code: d.invalid_type,
|
|
1529
|
-
expected: m.symbol,
|
|
1530
|
-
received: n.parsedType
|
|
1531
|
-
}), b;
|
|
1532
|
-
}
|
|
1533
|
-
return $(e.data);
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
ct.create = (s) => new ct({
|
|
1537
|
-
typeName: w.ZodSymbol,
|
|
1538
|
-
...A(s)
|
|
1539
|
-
});
|
|
1540
|
-
class dt extends T {
|
|
1541
|
-
_parse(e) {
|
|
1542
|
-
if (this._getType(e) !== m.undefined) {
|
|
1543
|
-
const n = this._getOrReturnCtx(e);
|
|
1544
|
-
return h(n, {
|
|
1545
|
-
code: d.invalid_type,
|
|
1546
|
-
expected: m.undefined,
|
|
1547
|
-
received: n.parsedType
|
|
1548
|
-
}), b;
|
|
1549
|
-
}
|
|
1550
|
-
return $(e.data);
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
dt.create = (s) => new dt({
|
|
1554
|
-
typeName: w.ZodUndefined,
|
|
1555
|
-
...A(s)
|
|
1556
|
-
});
|
|
1557
|
-
class ut extends T {
|
|
1558
|
-
_parse(e) {
|
|
1559
|
-
if (this._getType(e) !== m.null) {
|
|
1560
|
-
const n = this._getOrReturnCtx(e);
|
|
1561
|
-
return h(n, {
|
|
1562
|
-
code: d.invalid_type,
|
|
1563
|
-
expected: m.null,
|
|
1564
|
-
received: n.parsedType
|
|
1565
|
-
}), b;
|
|
1566
|
-
}
|
|
1567
|
-
return $(e.data);
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
ut.create = (s) => new ut({
|
|
1571
|
-
typeName: w.ZodNull,
|
|
1572
|
-
...A(s)
|
|
1573
|
-
});
|
|
1574
|
-
class Pe extends T {
|
|
1575
|
-
constructor() {
|
|
1576
|
-
super(...arguments), this._any = !0;
|
|
1577
|
-
}
|
|
1578
|
-
_parse(e) {
|
|
1579
|
-
return $(e.data);
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
Pe.create = (s) => new Pe({
|
|
1583
|
-
typeName: w.ZodAny,
|
|
1584
|
-
...A(s)
|
|
1585
|
-
});
|
|
1586
|
-
class se extends T {
|
|
1587
|
-
constructor() {
|
|
1588
|
-
super(...arguments), this._unknown = !0;
|
|
1589
|
-
}
|
|
1590
|
-
_parse(e) {
|
|
1591
|
-
return $(e.data);
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
se.create = (s) => new se({
|
|
1595
|
-
typeName: w.ZodUnknown,
|
|
1596
|
-
...A(s)
|
|
1597
|
-
});
|
|
1598
|
-
class H extends T {
|
|
1599
|
-
_parse(e) {
|
|
1600
|
-
const t = this._getOrReturnCtx(e);
|
|
1601
|
-
return h(t, {
|
|
1602
|
-
code: d.invalid_type,
|
|
1603
|
-
expected: m.never,
|
|
1604
|
-
received: t.parsedType
|
|
1605
|
-
}), b;
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
H.create = (s) => new H({
|
|
1609
|
-
typeName: w.ZodNever,
|
|
1610
|
-
...A(s)
|
|
1611
|
-
});
|
|
1612
|
-
class $e extends T {
|
|
1613
|
-
_parse(e) {
|
|
1614
|
-
if (this._getType(e) !== m.undefined) {
|
|
1615
|
-
const n = this._getOrReturnCtx(e);
|
|
1616
|
-
return h(n, {
|
|
1617
|
-
code: d.invalid_type,
|
|
1618
|
-
expected: m.void,
|
|
1619
|
-
received: n.parsedType
|
|
1620
|
-
}), b;
|
|
1621
|
-
}
|
|
1622
|
-
return $(e.data);
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
$e.create = (s) => new $e({
|
|
1626
|
-
typeName: w.ZodVoid,
|
|
1627
|
-
...A(s)
|
|
1628
|
-
});
|
|
1629
|
-
class U extends T {
|
|
1630
|
-
_parse(e) {
|
|
1631
|
-
const { ctx: t, status: n } = this._processInputParams(e), r = this._def;
|
|
1632
|
-
if (t.parsedType !== m.array)
|
|
1633
|
-
return h(t, {
|
|
1634
|
-
code: d.invalid_type,
|
|
1635
|
-
expected: m.array,
|
|
1636
|
-
received: t.parsedType
|
|
1637
|
-
}), b;
|
|
1638
|
-
if (r.exactLength !== null) {
|
|
1639
|
-
const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
|
|
1640
|
-
(i || o) && (h(t, {
|
|
1641
|
-
code: i ? d.too_big : d.too_small,
|
|
1642
|
-
minimum: o ? r.exactLength.value : void 0,
|
|
1643
|
-
maximum: i ? r.exactLength.value : void 0,
|
|
1644
|
-
type: "array",
|
|
1645
|
-
inclusive: !0,
|
|
1646
|
-
exact: !0,
|
|
1647
|
-
message: r.exactLength.message
|
|
1648
|
-
}), n.dirty());
|
|
1649
|
-
}
|
|
1650
|
-
if (r.minLength !== null && t.data.length < r.minLength.value && (h(t, {
|
|
1651
|
-
code: d.too_small,
|
|
1652
|
-
minimum: r.minLength.value,
|
|
1653
|
-
type: "array",
|
|
1654
|
-
inclusive: !0,
|
|
1655
|
-
exact: !1,
|
|
1656
|
-
message: r.minLength.message
|
|
1657
|
-
}), n.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (h(t, {
|
|
1658
|
-
code: d.too_big,
|
|
1659
|
-
maximum: r.maxLength.value,
|
|
1660
|
-
type: "array",
|
|
1661
|
-
inclusive: !0,
|
|
1662
|
-
exact: !1,
|
|
1663
|
-
message: r.maxLength.message
|
|
1664
|
-
}), n.dirty()), t.common.async)
|
|
1665
|
-
return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new X(t, i, t.path, o)))).then((i) => L.mergeArray(n, i));
|
|
1666
|
-
const a = [...t.data].map((i, o) => r.type._parseSync(new X(t, i, t.path, o)));
|
|
1667
|
-
return L.mergeArray(n, a);
|
|
1668
|
-
}
|
|
1669
|
-
get element() {
|
|
1670
|
-
return this._def.type;
|
|
1671
|
-
}
|
|
1672
|
-
min(e, t) {
|
|
1673
|
-
return new U({
|
|
1674
|
-
...this._def,
|
|
1675
|
-
minLength: { value: e, message: y.toString(t) }
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
|
-
max(e, t) {
|
|
1679
|
-
return new U({
|
|
1680
|
-
...this._def,
|
|
1681
|
-
maxLength: { value: e, message: y.toString(t) }
|
|
1682
|
-
});
|
|
1683
|
-
}
|
|
1684
|
-
length(e, t) {
|
|
1685
|
-
return new U({
|
|
1686
|
-
...this._def,
|
|
1687
|
-
exactLength: { value: e, message: y.toString(t) }
|
|
1688
|
-
});
|
|
1689
|
-
}
|
|
1690
|
-
nonempty(e) {
|
|
1691
|
-
return this.min(1, e);
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
U.create = (s, e) => new U({
|
|
1695
|
-
type: s,
|
|
1696
|
-
minLength: null,
|
|
1697
|
-
maxLength: null,
|
|
1698
|
-
exactLength: null,
|
|
1699
|
-
typeName: w.ZodArray,
|
|
1700
|
-
...A(e)
|
|
1701
|
-
});
|
|
1702
|
-
function te(s) {
|
|
1703
|
-
if (s instanceof Z) {
|
|
1704
|
-
const e = {};
|
|
1705
|
-
for (const t in s.shape) {
|
|
1706
|
-
const n = s.shape[t];
|
|
1707
|
-
e[t] = Y.create(te(n));
|
|
1708
|
-
}
|
|
1709
|
-
return new Z({
|
|
1710
|
-
...s._def,
|
|
1711
|
-
shape: () => e
|
|
1712
|
-
});
|
|
1713
|
-
} else return s instanceof U ? new U({
|
|
1714
|
-
...s._def,
|
|
1715
|
-
type: te(s.element)
|
|
1716
|
-
}) : s instanceof Y ? Y.create(te(s.unwrap())) : s instanceof oe ? oe.create(te(s.unwrap())) : s instanceof B ? B.create(s.items.map((e) => te(e))) : s;
|
|
1717
|
-
}
|
|
1718
|
-
class Z extends T {
|
|
1719
|
-
constructor() {
|
|
1720
|
-
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1721
|
-
}
|
|
1722
|
-
_getCached() {
|
|
1723
|
-
if (this._cached !== null)
|
|
1724
|
-
return this._cached;
|
|
1725
|
-
const e = this._def.shape(), t = O.objectKeys(e);
|
|
1726
|
-
return this._cached = { shape: e, keys: t }, this._cached;
|
|
1727
|
-
}
|
|
1728
|
-
_parse(e) {
|
|
1729
|
-
if (this._getType(e) !== m.object) {
|
|
1730
|
-
const c = this._getOrReturnCtx(e);
|
|
1731
|
-
return h(c, {
|
|
1732
|
-
code: d.invalid_type,
|
|
1733
|
-
expected: m.object,
|
|
1734
|
-
received: c.parsedType
|
|
1735
|
-
}), b;
|
|
1736
|
-
}
|
|
1737
|
-
const { status: n, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1738
|
-
if (!(this._def.catchall instanceof H && this._def.unknownKeys === "strip"))
|
|
1739
|
-
for (const c in r.data)
|
|
1740
|
-
i.includes(c) || o.push(c);
|
|
1741
|
-
const u = [];
|
|
1742
|
-
for (const c of i) {
|
|
1743
|
-
const v = a[c], N = r.data[c];
|
|
1744
|
-
u.push({
|
|
1745
|
-
key: { status: "valid", value: c },
|
|
1746
|
-
value: v._parse(new X(r, N, r.path, c)),
|
|
1747
|
-
alwaysSet: c in r.data
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
if (this._def.catchall instanceof H) {
|
|
1751
|
-
const c = this._def.unknownKeys;
|
|
1752
|
-
if (c === "passthrough")
|
|
1753
|
-
for (const v of o)
|
|
1754
|
-
u.push({
|
|
1755
|
-
key: { status: "valid", value: v },
|
|
1756
|
-
value: { status: "valid", value: r.data[v] }
|
|
1757
|
-
});
|
|
1758
|
-
else if (c === "strict")
|
|
1759
|
-
o.length > 0 && (h(r, {
|
|
1760
|
-
code: d.unrecognized_keys,
|
|
1761
|
-
keys: o
|
|
1762
|
-
}), n.dirty());
|
|
1763
|
-
else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1764
|
-
} else {
|
|
1765
|
-
const c = this._def.catchall;
|
|
1766
|
-
for (const v of o) {
|
|
1767
|
-
const N = r.data[v];
|
|
1768
|
-
u.push({
|
|
1769
|
-
key: { status: "valid", value: v },
|
|
1770
|
-
value: c._parse(
|
|
1771
|
-
new X(r, N, r.path, v)
|
|
1772
|
-
//, ctx.child(key), value, getParsedType(value)
|
|
1773
|
-
),
|
|
1774
|
-
alwaysSet: v in r.data
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
return r.common.async ? Promise.resolve().then(async () => {
|
|
1779
|
-
const c = [];
|
|
1780
|
-
for (const v of u) {
|
|
1781
|
-
const N = await v.key, z = await v.value;
|
|
1782
|
-
c.push({
|
|
1783
|
-
key: N,
|
|
1784
|
-
value: z,
|
|
1785
|
-
alwaysSet: v.alwaysSet
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
return c;
|
|
1789
|
-
}).then((c) => L.mergeObjectSync(n, c)) : L.mergeObjectSync(n, u);
|
|
1790
|
-
}
|
|
1791
|
-
get shape() {
|
|
1792
|
-
return this._def.shape();
|
|
1793
|
-
}
|
|
1794
|
-
strict(e) {
|
|
1795
|
-
return y.errToObj, new Z({
|
|
1796
|
-
...this._def,
|
|
1797
|
-
unknownKeys: "strict",
|
|
1798
|
-
...e !== void 0 ? {
|
|
1799
|
-
errorMap: (t, n) => {
|
|
1800
|
-
var a, i;
|
|
1801
|
-
const r = ((i = (a = this._def).errorMap) == null ? void 0 : i.call(a, t, n).message) ?? n.defaultError;
|
|
1802
|
-
return t.code === "unrecognized_keys" ? {
|
|
1803
|
-
message: y.errToObj(e).message ?? r
|
|
1804
|
-
} : {
|
|
1805
|
-
message: r
|
|
1806
|
-
};
|
|
1807
|
-
}
|
|
1808
|
-
} : {}
|
|
1809
|
-
});
|
|
1810
|
-
}
|
|
1811
|
-
strip() {
|
|
1812
|
-
return new Z({
|
|
1813
|
-
...this._def,
|
|
1814
|
-
unknownKeys: "strip"
|
|
1815
|
-
});
|
|
1816
|
-
}
|
|
1817
|
-
passthrough() {
|
|
1818
|
-
return new Z({
|
|
1819
|
-
...this._def,
|
|
1820
|
-
unknownKeys: "passthrough"
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1823
|
-
// const AugmentFactory =
|
|
1824
|
-
// <Def extends ZodObjectDef>(def: Def) =>
|
|
1825
|
-
// <Augmentation extends ZodRawShape>(
|
|
1826
|
-
// augmentation: Augmentation
|
|
1827
|
-
// ): ZodObject<
|
|
1828
|
-
// extendShape<ReturnType<Def["shape"]>, Augmentation>,
|
|
1829
|
-
// Def["unknownKeys"],
|
|
1830
|
-
// Def["catchall"]
|
|
1831
|
-
// > => {
|
|
1832
|
-
// return new ZodObject({
|
|
1833
|
-
// ...def,
|
|
1834
|
-
// shape: () => ({
|
|
1835
|
-
// ...def.shape(),
|
|
1836
|
-
// ...augmentation,
|
|
1837
|
-
// }),
|
|
1838
|
-
// }) as any;
|
|
1839
|
-
// };
|
|
1840
|
-
extend(e) {
|
|
1841
|
-
return new Z({
|
|
1842
|
-
...this._def,
|
|
1843
|
-
shape: () => ({
|
|
1844
|
-
...this._def.shape(),
|
|
1845
|
-
...e
|
|
1846
|
-
})
|
|
1847
|
-
});
|
|
1848
|
-
}
|
|
1849
|
-
/**
|
|
1850
|
-
* Prior to zod@1.0.12 there was a bug in the
|
|
1851
|
-
* inferred type of merged objects. Please
|
|
1852
|
-
* upgrade if you are experiencing issues.
|
|
1853
|
-
*/
|
|
1854
|
-
merge(e) {
|
|
1855
|
-
return new Z({
|
|
1856
|
-
unknownKeys: e._def.unknownKeys,
|
|
1857
|
-
catchall: e._def.catchall,
|
|
1858
|
-
shape: () => ({
|
|
1859
|
-
...this._def.shape(),
|
|
1860
|
-
...e._def.shape()
|
|
1861
|
-
}),
|
|
1862
|
-
typeName: w.ZodObject
|
|
1863
|
-
});
|
|
1864
|
-
}
|
|
1865
|
-
// merge<
|
|
1866
|
-
// Incoming extends AnyZodObject,
|
|
1867
|
-
// Augmentation extends Incoming["shape"],
|
|
1868
|
-
// NewOutput extends {
|
|
1869
|
-
// [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
|
|
1870
|
-
// ? Augmentation[k]["_output"]
|
|
1871
|
-
// : k extends keyof Output
|
|
1872
|
-
// ? Output[k]
|
|
1873
|
-
// : never;
|
|
1874
|
-
// },
|
|
1875
|
-
// NewInput extends {
|
|
1876
|
-
// [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
|
|
1877
|
-
// ? Augmentation[k]["_input"]
|
|
1878
|
-
// : k extends keyof Input
|
|
1879
|
-
// ? Input[k]
|
|
1880
|
-
// : never;
|
|
1881
|
-
// }
|
|
1882
|
-
// >(
|
|
1883
|
-
// merging: Incoming
|
|
1884
|
-
// ): ZodObject<
|
|
1885
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
1886
|
-
// Incoming["_def"]["unknownKeys"],
|
|
1887
|
-
// Incoming["_def"]["catchall"],
|
|
1888
|
-
// NewOutput,
|
|
1889
|
-
// NewInput
|
|
1890
|
-
// > {
|
|
1891
|
-
// const merged: any = new ZodObject({
|
|
1892
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
1893
|
-
// catchall: merging._def.catchall,
|
|
1894
|
-
// shape: () =>
|
|
1895
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
1896
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1897
|
-
// }) as any;
|
|
1898
|
-
// return merged;
|
|
1899
|
-
// }
|
|
1900
|
-
setKey(e, t) {
|
|
1901
|
-
return this.augment({ [e]: t });
|
|
1902
|
-
}
|
|
1903
|
-
// merge<Incoming extends AnyZodObject>(
|
|
1904
|
-
// merging: Incoming
|
|
1905
|
-
// ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
|
|
1906
|
-
// ZodObject<
|
|
1907
|
-
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
1908
|
-
// Incoming["_def"]["unknownKeys"],
|
|
1909
|
-
// Incoming["_def"]["catchall"]
|
|
1910
|
-
// > {
|
|
1911
|
-
// // const mergedShape = objectUtil.mergeShapes(
|
|
1912
|
-
// // this._def.shape(),
|
|
1913
|
-
// // merging._def.shape()
|
|
1914
|
-
// // );
|
|
1915
|
-
// const merged: any = new ZodObject({
|
|
1916
|
-
// unknownKeys: merging._def.unknownKeys,
|
|
1917
|
-
// catchall: merging._def.catchall,
|
|
1918
|
-
// shape: () =>
|
|
1919
|
-
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
1920
|
-
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
1921
|
-
// }) as any;
|
|
1922
|
-
// return merged;
|
|
1923
|
-
// }
|
|
1924
|
-
catchall(e) {
|
|
1925
|
-
return new Z({
|
|
1926
|
-
...this._def,
|
|
1927
|
-
catchall: e
|
|
1928
|
-
});
|
|
1929
|
-
}
|
|
1930
|
-
pick(e) {
|
|
1931
|
-
const t = {};
|
|
1932
|
-
for (const n of O.objectKeys(e))
|
|
1933
|
-
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
1934
|
-
return new Z({
|
|
1935
|
-
...this._def,
|
|
1936
|
-
shape: () => t
|
|
1937
|
-
});
|
|
1938
|
-
}
|
|
1939
|
-
omit(e) {
|
|
1940
|
-
const t = {};
|
|
1941
|
-
for (const n of O.objectKeys(this.shape))
|
|
1942
|
-
e[n] || (t[n] = this.shape[n]);
|
|
1943
|
-
return new Z({
|
|
1944
|
-
...this._def,
|
|
1945
|
-
shape: () => t
|
|
1946
|
-
});
|
|
1947
|
-
}
|
|
1948
|
-
/**
|
|
1949
|
-
* @deprecated
|
|
1950
|
-
*/
|
|
1951
|
-
deepPartial() {
|
|
1952
|
-
return te(this);
|
|
1953
|
-
}
|
|
1954
|
-
partial(e) {
|
|
1955
|
-
const t = {};
|
|
1956
|
-
for (const n of O.objectKeys(this.shape)) {
|
|
1957
|
-
const r = this.shape[n];
|
|
1958
|
-
e && !e[n] ? t[n] = r : t[n] = r.optional();
|
|
1959
|
-
}
|
|
1960
|
-
return new Z({
|
|
1961
|
-
...this._def,
|
|
1962
|
-
shape: () => t
|
|
1963
|
-
});
|
|
1964
|
-
}
|
|
1965
|
-
required(e) {
|
|
1966
|
-
const t = {};
|
|
1967
|
-
for (const n of O.objectKeys(this.shape))
|
|
1968
|
-
if (e && !e[n])
|
|
1969
|
-
t[n] = this.shape[n];
|
|
1970
|
-
else {
|
|
1971
|
-
let a = this.shape[n];
|
|
1972
|
-
for (; a instanceof Y; )
|
|
1973
|
-
a = a._def.innerType;
|
|
1974
|
-
t[n] = a;
|
|
1975
|
-
}
|
|
1976
|
-
return new Z({
|
|
1977
|
-
...this._def,
|
|
1978
|
-
shape: () => t
|
|
1979
|
-
});
|
|
1980
|
-
}
|
|
1981
|
-
keyof() {
|
|
1982
|
-
return _t(O.objectKeys(this.shape));
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
Z.create = (s, e) => new Z({
|
|
1986
|
-
shape: () => s,
|
|
1987
|
-
unknownKeys: "strip",
|
|
1988
|
-
catchall: H.create(),
|
|
1989
|
-
typeName: w.ZodObject,
|
|
1990
|
-
...A(e)
|
|
1991
|
-
});
|
|
1992
|
-
Z.strictCreate = (s, e) => new Z({
|
|
1993
|
-
shape: () => s,
|
|
1994
|
-
unknownKeys: "strict",
|
|
1995
|
-
catchall: H.create(),
|
|
1996
|
-
typeName: w.ZodObject,
|
|
1997
|
-
...A(e)
|
|
1998
|
-
});
|
|
1999
|
-
Z.lazycreate = (s, e) => new Z({
|
|
2000
|
-
shape: s,
|
|
2001
|
-
unknownKeys: "strip",
|
|
2002
|
-
catchall: H.create(),
|
|
2003
|
-
typeName: w.ZodObject,
|
|
2004
|
-
...A(e)
|
|
2005
|
-
});
|
|
2006
|
-
class be extends T {
|
|
2007
|
-
_parse(e) {
|
|
2008
|
-
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
2009
|
-
function r(a) {
|
|
2010
|
-
for (const o of a)
|
|
2011
|
-
if (o.result.status === "valid")
|
|
2012
|
-
return o.result;
|
|
2013
|
-
for (const o of a)
|
|
2014
|
-
if (o.result.status === "dirty")
|
|
2015
|
-
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2016
|
-
const i = a.map((o) => new V(o.ctx.common.issues));
|
|
2017
|
-
return h(t, {
|
|
2018
|
-
code: d.invalid_union,
|
|
2019
|
-
unionErrors: i
|
|
2020
|
-
}), b;
|
|
2021
|
-
}
|
|
2022
|
-
if (t.common.async)
|
|
2023
|
-
return Promise.all(n.map(async (a) => {
|
|
2024
|
-
const i = {
|
|
2025
|
-
...t,
|
|
2026
|
-
common: {
|
|
2027
|
-
...t.common,
|
|
2028
|
-
issues: []
|
|
2029
|
-
},
|
|
2030
|
-
parent: null
|
|
2031
|
-
};
|
|
2032
|
-
return {
|
|
2033
|
-
result: await a._parseAsync({
|
|
2034
|
-
data: t.data,
|
|
2035
|
-
path: t.path,
|
|
2036
|
-
parent: i
|
|
2037
|
-
}),
|
|
2038
|
-
ctx: i
|
|
2039
|
-
};
|
|
2040
|
-
})).then(r);
|
|
2041
|
-
{
|
|
2042
|
-
let a;
|
|
2043
|
-
const i = [];
|
|
2044
|
-
for (const u of n) {
|
|
2045
|
-
const c = {
|
|
2046
|
-
...t,
|
|
2047
|
-
common: {
|
|
2048
|
-
...t.common,
|
|
2049
|
-
issues: []
|
|
2050
|
-
},
|
|
2051
|
-
parent: null
|
|
2052
|
-
}, v = u._parseSync({
|
|
2053
|
-
data: t.data,
|
|
2054
|
-
path: t.path,
|
|
2055
|
-
parent: c
|
|
2056
|
-
});
|
|
2057
|
-
if (v.status === "valid")
|
|
2058
|
-
return v;
|
|
2059
|
-
v.status === "dirty" && !a && (a = { result: v, ctx: c }), c.common.issues.length && i.push(c.common.issues);
|
|
2060
|
-
}
|
|
2061
|
-
if (a)
|
|
2062
|
-
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2063
|
-
const o = i.map((u) => new V(u));
|
|
2064
|
-
return h(t, {
|
|
2065
|
-
code: d.invalid_union,
|
|
2066
|
-
unionErrors: o
|
|
2067
|
-
}), b;
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
get options() {
|
|
2071
|
-
return this._def.options;
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
be.create = (s, e) => new be({
|
|
2075
|
-
options: s,
|
|
2076
|
-
typeName: w.ZodUnion,
|
|
2077
|
-
...A(e)
|
|
2078
|
-
});
|
|
2079
|
-
function De(s, e) {
|
|
2080
|
-
const t = q(s), n = q(e);
|
|
2081
|
-
if (s === e)
|
|
2082
|
-
return { valid: !0, data: s };
|
|
2083
|
-
if (t === m.object && n === m.object) {
|
|
2084
|
-
const r = O.objectKeys(e), a = O.objectKeys(s).filter((o) => r.indexOf(o) !== -1), i = { ...s, ...e };
|
|
2085
|
-
for (const o of a) {
|
|
2086
|
-
const u = De(s[o], e[o]);
|
|
2087
|
-
if (!u.valid)
|
|
2088
|
-
return { valid: !1 };
|
|
2089
|
-
i[o] = u.data;
|
|
2090
|
-
}
|
|
2091
|
-
return { valid: !0, data: i };
|
|
2092
|
-
} else if (t === m.array && n === m.array) {
|
|
2093
|
-
if (s.length !== e.length)
|
|
2094
|
-
return { valid: !1 };
|
|
2095
|
-
const r = [];
|
|
2096
|
-
for (let a = 0; a < s.length; a++) {
|
|
2097
|
-
const i = s[a], o = e[a], u = De(i, o);
|
|
2098
|
-
if (!u.valid)
|
|
2099
|
-
return { valid: !1 };
|
|
2100
|
-
r.push(u.data);
|
|
2101
|
-
}
|
|
2102
|
-
return { valid: !0, data: r };
|
|
2103
|
-
} else return t === m.date && n === m.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
|
|
2104
|
-
}
|
|
2105
|
-
class we extends T {
|
|
2106
|
-
_parse(e) {
|
|
2107
|
-
const { status: t, ctx: n } = this._processInputParams(e), r = (a, i) => {
|
|
2108
|
-
if (at(a) || at(i))
|
|
2109
|
-
return b;
|
|
2110
|
-
const o = De(a.value, i.value);
|
|
2111
|
-
return o.valid ? ((it(a) || it(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(n, {
|
|
2112
|
-
code: d.invalid_intersection_types
|
|
2113
|
-
}), b);
|
|
2114
|
-
};
|
|
2115
|
-
return n.common.async ? Promise.all([
|
|
2116
|
-
this._def.left._parseAsync({
|
|
2117
|
-
data: n.data,
|
|
2118
|
-
path: n.path,
|
|
2119
|
-
parent: n
|
|
2120
|
-
}),
|
|
2121
|
-
this._def.right._parseAsync({
|
|
2122
|
-
data: n.data,
|
|
2123
|
-
path: n.path,
|
|
2124
|
-
parent: n
|
|
2125
|
-
})
|
|
2126
|
-
]).then(([a, i]) => r(a, i)) : r(this._def.left._parseSync({
|
|
2127
|
-
data: n.data,
|
|
2128
|
-
path: n.path,
|
|
2129
|
-
parent: n
|
|
2130
|
-
}), this._def.right._parseSync({
|
|
2131
|
-
data: n.data,
|
|
2132
|
-
path: n.path,
|
|
2133
|
-
parent: n
|
|
2134
|
-
}));
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
we.create = (s, e, t) => new we({
|
|
2138
|
-
left: s,
|
|
2139
|
-
right: e,
|
|
2140
|
-
typeName: w.ZodIntersection,
|
|
2141
|
-
...A(t)
|
|
2142
|
-
});
|
|
2143
|
-
class B extends T {
|
|
2144
|
-
_parse(e) {
|
|
2145
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2146
|
-
if (n.parsedType !== m.array)
|
|
2147
|
-
return h(n, {
|
|
2148
|
-
code: d.invalid_type,
|
|
2149
|
-
expected: m.array,
|
|
2150
|
-
received: n.parsedType
|
|
2151
|
-
}), b;
|
|
2152
|
-
if (n.data.length < this._def.items.length)
|
|
2153
|
-
return h(n, {
|
|
2154
|
-
code: d.too_small,
|
|
2155
|
-
minimum: this._def.items.length,
|
|
2156
|
-
inclusive: !0,
|
|
2157
|
-
exact: !1,
|
|
2158
|
-
type: "array"
|
|
2159
|
-
}), b;
|
|
2160
|
-
!this._def.rest && n.data.length > this._def.items.length && (h(n, {
|
|
2161
|
-
code: d.too_big,
|
|
2162
|
-
maximum: this._def.items.length,
|
|
2163
|
-
inclusive: !0,
|
|
2164
|
-
exact: !1,
|
|
2165
|
-
type: "array"
|
|
2166
|
-
}), t.dirty());
|
|
2167
|
-
const a = [...n.data].map((i, o) => {
|
|
2168
|
-
const u = this._def.items[o] || this._def.rest;
|
|
2169
|
-
return u ? u._parse(new X(n, i, n.path, o)) : null;
|
|
2170
|
-
}).filter((i) => !!i);
|
|
2171
|
-
return n.common.async ? Promise.all(a).then((i) => L.mergeArray(t, i)) : L.mergeArray(t, a);
|
|
2172
|
-
}
|
|
2173
|
-
get items() {
|
|
2174
|
-
return this._def.items;
|
|
2175
|
-
}
|
|
2176
|
-
rest(e) {
|
|
2177
|
-
return new B({
|
|
2178
|
-
...this._def,
|
|
2179
|
-
rest: e
|
|
2180
|
-
});
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
B.create = (s, e) => {
|
|
2184
|
-
if (!Array.isArray(s))
|
|
2185
|
-
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2186
|
-
return new B({
|
|
2187
|
-
items: s,
|
|
2188
|
-
typeName: w.ZodTuple,
|
|
2189
|
-
rest: null,
|
|
2190
|
-
...A(e)
|
|
2191
|
-
});
|
|
2192
|
-
};
|
|
2193
|
-
class lt extends T {
|
|
2194
|
-
get keySchema() {
|
|
2195
|
-
return this._def.keyType;
|
|
2196
|
-
}
|
|
2197
|
-
get valueSchema() {
|
|
2198
|
-
return this._def.valueType;
|
|
2199
|
-
}
|
|
2200
|
-
_parse(e) {
|
|
2201
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2202
|
-
if (n.parsedType !== m.map)
|
|
2203
|
-
return h(n, {
|
|
2204
|
-
code: d.invalid_type,
|
|
2205
|
-
expected: m.map,
|
|
2206
|
-
received: n.parsedType
|
|
2207
|
-
}), b;
|
|
2208
|
-
const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], c) => ({
|
|
2209
|
-
key: r._parse(new X(n, o, n.path, [c, "key"])),
|
|
2210
|
-
value: a._parse(new X(n, u, n.path, [c, "value"]))
|
|
2211
|
-
}));
|
|
2212
|
-
if (n.common.async) {
|
|
2213
|
-
const o = /* @__PURE__ */ new Map();
|
|
2214
|
-
return Promise.resolve().then(async () => {
|
|
2215
|
-
for (const u of i) {
|
|
2216
|
-
const c = await u.key, v = await u.value;
|
|
2217
|
-
if (c.status === "aborted" || v.status === "aborted")
|
|
2218
|
-
return b;
|
|
2219
|
-
(c.status === "dirty" || v.status === "dirty") && t.dirty(), o.set(c.value, v.value);
|
|
2220
|
-
}
|
|
2221
|
-
return { status: t.value, value: o };
|
|
2222
|
-
});
|
|
2223
|
-
} else {
|
|
2224
|
-
const o = /* @__PURE__ */ new Map();
|
|
2225
|
-
for (const u of i) {
|
|
2226
|
-
const c = u.key, v = u.value;
|
|
2227
|
-
if (c.status === "aborted" || v.status === "aborted")
|
|
2228
|
-
return b;
|
|
2229
|
-
(c.status === "dirty" || v.status === "dirty") && t.dirty(), o.set(c.value, v.value);
|
|
2230
|
-
}
|
|
2231
|
-
return { status: t.value, value: o };
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
lt.create = (s, e, t) => new lt({
|
|
2236
|
-
valueType: e,
|
|
2237
|
-
keyType: s,
|
|
2238
|
-
typeName: w.ZodMap,
|
|
2239
|
-
...A(t)
|
|
2240
|
-
});
|
|
2241
|
-
class me extends T {
|
|
2242
|
-
_parse(e) {
|
|
2243
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2244
|
-
if (n.parsedType !== m.set)
|
|
2245
|
-
return h(n, {
|
|
2246
|
-
code: d.invalid_type,
|
|
2247
|
-
expected: m.set,
|
|
2248
|
-
received: n.parsedType
|
|
2249
|
-
}), b;
|
|
2250
|
-
const r = this._def;
|
|
2251
|
-
r.minSize !== null && n.data.size < r.minSize.value && (h(n, {
|
|
2252
|
-
code: d.too_small,
|
|
2253
|
-
minimum: r.minSize.value,
|
|
2254
|
-
type: "set",
|
|
2255
|
-
inclusive: !0,
|
|
2256
|
-
exact: !1,
|
|
2257
|
-
message: r.minSize.message
|
|
2258
|
-
}), t.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (h(n, {
|
|
2259
|
-
code: d.too_big,
|
|
2260
|
-
maximum: r.maxSize.value,
|
|
2261
|
-
type: "set",
|
|
2262
|
-
inclusive: !0,
|
|
2263
|
-
exact: !1,
|
|
2264
|
-
message: r.maxSize.message
|
|
2265
|
-
}), t.dirty());
|
|
2266
|
-
const a = this._def.valueType;
|
|
2267
|
-
function i(u) {
|
|
2268
|
-
const c = /* @__PURE__ */ new Set();
|
|
2269
|
-
for (const v of u) {
|
|
2270
|
-
if (v.status === "aborted")
|
|
2271
|
-
return b;
|
|
2272
|
-
v.status === "dirty" && t.dirty(), c.add(v.value);
|
|
2273
|
-
}
|
|
2274
|
-
return { status: t.value, value: c };
|
|
2275
|
-
}
|
|
2276
|
-
const o = [...n.data.values()].map((u, c) => a._parse(new X(n, u, n.path, c)));
|
|
2277
|
-
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2278
|
-
}
|
|
2279
|
-
min(e, t) {
|
|
2280
|
-
return new me({
|
|
2281
|
-
...this._def,
|
|
2282
|
-
minSize: { value: e, message: y.toString(t) }
|
|
2283
|
-
});
|
|
2284
|
-
}
|
|
2285
|
-
max(e, t) {
|
|
2286
|
-
return new me({
|
|
2287
|
-
...this._def,
|
|
2288
|
-
maxSize: { value: e, message: y.toString(t) }
|
|
2289
|
-
});
|
|
2290
|
-
}
|
|
2291
|
-
size(e, t) {
|
|
2292
|
-
return this.min(e, t).max(e, t);
|
|
2293
|
-
}
|
|
2294
|
-
nonempty(e) {
|
|
2295
|
-
return this.min(1, e);
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
me.create = (s, e) => new me({
|
|
2299
|
-
valueType: s,
|
|
2300
|
-
minSize: null,
|
|
2301
|
-
maxSize: null,
|
|
2302
|
-
typeName: w.ZodSet,
|
|
2303
|
-
...A(e)
|
|
2304
|
-
});
|
|
2305
|
-
class le extends T {
|
|
2306
|
-
constructor() {
|
|
2307
|
-
super(...arguments), this.validate = this.implement;
|
|
2308
|
-
}
|
|
2309
|
-
_parse(e) {
|
|
2310
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2311
|
-
if (t.parsedType !== m.function)
|
|
2312
|
-
return h(t, {
|
|
2313
|
-
code: d.invalid_type,
|
|
2314
|
-
expected: m.function,
|
|
2315
|
-
received: t.parsedType
|
|
2316
|
-
}), b;
|
|
2317
|
-
function n(o, u) {
|
|
2318
|
-
return je({
|
|
2319
|
-
data: o,
|
|
2320
|
-
path: t.path,
|
|
2321
|
-
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Me(), he].filter((c) => !!c),
|
|
2322
|
-
issueData: {
|
|
2323
|
-
code: d.invalid_arguments,
|
|
2324
|
-
argumentsError: u
|
|
2325
|
-
}
|
|
2326
|
-
});
|
|
2327
|
-
}
|
|
2328
|
-
function r(o, u) {
|
|
2329
|
-
return je({
|
|
2330
|
-
data: o,
|
|
2331
|
-
path: t.path,
|
|
2332
|
-
errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Me(), he].filter((c) => !!c),
|
|
2333
|
-
issueData: {
|
|
2334
|
-
code: d.invalid_return_type,
|
|
2335
|
-
returnTypeError: u
|
|
2336
|
-
}
|
|
2337
|
-
});
|
|
2338
|
-
}
|
|
2339
|
-
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2340
|
-
if (this._def.returns instanceof pe) {
|
|
2341
|
-
const o = this;
|
|
2342
|
-
return $(async function(...u) {
|
|
2343
|
-
const c = new V([]), v = await o._def.args.parseAsync(u, a).catch((j) => {
|
|
2344
|
-
throw c.addIssue(n(u, j)), c;
|
|
2345
|
-
}), N = await Reflect.apply(i, this, v);
|
|
2346
|
-
return await o._def.returns._def.type.parseAsync(N, a).catch((j) => {
|
|
2347
|
-
throw c.addIssue(r(N, j)), c;
|
|
2348
|
-
});
|
|
2349
|
-
});
|
|
2350
|
-
} else {
|
|
2351
|
-
const o = this;
|
|
2352
|
-
return $(function(...u) {
|
|
2353
|
-
const c = o._def.args.safeParse(u, a);
|
|
2354
|
-
if (!c.success)
|
|
2355
|
-
throw new V([n(u, c.error)]);
|
|
2356
|
-
const v = Reflect.apply(i, this, c.data), N = o._def.returns.safeParse(v, a);
|
|
2357
|
-
if (!N.success)
|
|
2358
|
-
throw new V([r(v, N.error)]);
|
|
2359
|
-
return N.data;
|
|
2360
|
-
});
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
parameters() {
|
|
2364
|
-
return this._def.args;
|
|
2365
|
-
}
|
|
2366
|
-
returnType() {
|
|
2367
|
-
return this._def.returns;
|
|
2368
|
-
}
|
|
2369
|
-
args(...e) {
|
|
2370
|
-
return new le({
|
|
2371
|
-
...this._def,
|
|
2372
|
-
args: B.create(e).rest(se.create())
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
returns(e) {
|
|
2376
|
-
return new le({
|
|
2377
|
-
...this._def,
|
|
2378
|
-
returns: e
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
implement(e) {
|
|
2382
|
-
return this.parse(e);
|
|
2383
|
-
}
|
|
2384
|
-
strictImplement(e) {
|
|
2385
|
-
return this.parse(e);
|
|
2386
|
-
}
|
|
2387
|
-
static create(e, t, n) {
|
|
2388
|
-
return new le({
|
|
2389
|
-
args: e || B.create([]).rest(se.create()),
|
|
2390
|
-
returns: t || se.create(),
|
|
2391
|
-
typeName: w.ZodFunction,
|
|
2392
|
-
...A(n)
|
|
2393
|
-
});
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
class ht extends T {
|
|
2397
|
-
get schema() {
|
|
2398
|
-
return this._def.getter();
|
|
2399
|
-
}
|
|
2400
|
-
_parse(e) {
|
|
2401
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2402
|
-
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2403
|
-
}
|
|
2404
|
-
}
|
|
2405
|
-
ht.create = (s, e) => new ht({
|
|
2406
|
-
getter: s,
|
|
2407
|
-
typeName: w.ZodLazy,
|
|
2408
|
-
...A(e)
|
|
2409
|
-
});
|
|
2410
|
-
class ft extends T {
|
|
2411
|
-
_parse(e) {
|
|
2412
|
-
if (e.data !== this._def.value) {
|
|
2413
|
-
const t = this._getOrReturnCtx(e);
|
|
2414
|
-
return h(t, {
|
|
2415
|
-
received: t.data,
|
|
2416
|
-
code: d.invalid_literal,
|
|
2417
|
-
expected: this._def.value
|
|
2418
|
-
}), b;
|
|
2419
|
-
}
|
|
2420
|
-
return { status: "valid", value: e.data };
|
|
2421
|
-
}
|
|
2422
|
-
get value() {
|
|
2423
|
-
return this._def.value;
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
ft.create = (s, e) => new ft({
|
|
2427
|
-
value: s,
|
|
2428
|
-
typeName: w.ZodLiteral,
|
|
2429
|
-
...A(e)
|
|
2430
|
-
});
|
|
2431
|
-
function _t(s, e) {
|
|
2432
|
-
return new ae({
|
|
2433
|
-
values: s,
|
|
2434
|
-
typeName: w.ZodEnum,
|
|
2435
|
-
...A(e)
|
|
2436
|
-
});
|
|
2437
|
-
}
|
|
2438
|
-
class ae extends T {
|
|
2439
|
-
_parse(e) {
|
|
2440
|
-
if (typeof e.data != "string") {
|
|
2441
|
-
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2442
|
-
return h(t, {
|
|
2443
|
-
expected: O.joinValues(n),
|
|
2444
|
-
received: t.parsedType,
|
|
2445
|
-
code: d.invalid_type
|
|
2446
|
-
}), b;
|
|
2447
|
-
}
|
|
2448
|
-
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2449
|
-
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2450
|
-
return h(t, {
|
|
2451
|
-
received: t.data,
|
|
2452
|
-
code: d.invalid_enum_value,
|
|
2453
|
-
options: n
|
|
2454
|
-
}), b;
|
|
2455
|
-
}
|
|
2456
|
-
return $(e.data);
|
|
2457
|
-
}
|
|
2458
|
-
get options() {
|
|
2459
|
-
return this._def.values;
|
|
2460
|
-
}
|
|
2461
|
-
get enum() {
|
|
2462
|
-
const e = {};
|
|
2463
|
-
for (const t of this._def.values)
|
|
2464
|
-
e[t] = t;
|
|
2465
|
-
return e;
|
|
2466
|
-
}
|
|
2467
|
-
get Values() {
|
|
2468
|
-
const e = {};
|
|
2469
|
-
for (const t of this._def.values)
|
|
2470
|
-
e[t] = t;
|
|
2471
|
-
return e;
|
|
2472
|
-
}
|
|
2473
|
-
get Enum() {
|
|
2474
|
-
const e = {};
|
|
2475
|
-
for (const t of this._def.values)
|
|
2476
|
-
e[t] = t;
|
|
2477
|
-
return e;
|
|
2478
|
-
}
|
|
2479
|
-
extract(e, t = this._def) {
|
|
2480
|
-
return ae.create(e, {
|
|
2481
|
-
...this._def,
|
|
2482
|
-
...t
|
|
2483
|
-
});
|
|
2484
|
-
}
|
|
2485
|
-
exclude(e, t = this._def) {
|
|
2486
|
-
return ae.create(this.options.filter((n) => !e.includes(n)), {
|
|
2487
|
-
...this._def,
|
|
2488
|
-
...t
|
|
2489
|
-
});
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
ae.create = _t;
|
|
2493
|
-
class mt extends T {
|
|
2494
|
-
_parse(e) {
|
|
2495
|
-
const t = O.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2496
|
-
if (n.parsedType !== m.string && n.parsedType !== m.number) {
|
|
2497
|
-
const r = O.objectValues(t);
|
|
2498
|
-
return h(n, {
|
|
2499
|
-
expected: O.joinValues(r),
|
|
2500
|
-
received: n.parsedType,
|
|
2501
|
-
code: d.invalid_type
|
|
2502
|
-
}), b;
|
|
2503
|
-
}
|
|
2504
|
-
if (this._cache || (this._cache = new Set(O.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2505
|
-
const r = O.objectValues(t);
|
|
2506
|
-
return h(n, {
|
|
2507
|
-
received: n.data,
|
|
2508
|
-
code: d.invalid_enum_value,
|
|
2509
|
-
options: r
|
|
2510
|
-
}), b;
|
|
2511
|
-
}
|
|
2512
|
-
return $(e.data);
|
|
2513
|
-
}
|
|
2514
|
-
get enum() {
|
|
2515
|
-
return this._def.values;
|
|
2516
|
-
}
|
|
2517
|
-
}
|
|
2518
|
-
mt.create = (s, e) => new mt({
|
|
2519
|
-
values: s,
|
|
2520
|
-
typeName: w.ZodNativeEnum,
|
|
2521
|
-
...A(e)
|
|
2522
|
-
});
|
|
2523
|
-
class pe extends T {
|
|
2524
|
-
unwrap() {
|
|
2525
|
-
return this._def.type;
|
|
2526
|
-
}
|
|
2527
|
-
_parse(e) {
|
|
2528
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2529
|
-
if (t.parsedType !== m.promise && t.common.async === !1)
|
|
2530
|
-
return h(t, {
|
|
2531
|
-
code: d.invalid_type,
|
|
2532
|
-
expected: m.promise,
|
|
2533
|
-
received: t.parsedType
|
|
2534
|
-
}), b;
|
|
2535
|
-
const n = t.parsedType === m.promise ? t.data : Promise.resolve(t.data);
|
|
2536
|
-
return $(n.then((r) => this._def.type.parseAsync(r, {
|
|
2537
|
-
path: t.path,
|
|
2538
|
-
errorMap: t.common.contextualErrorMap
|
|
2539
|
-
})));
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
pe.create = (s, e) => new pe({
|
|
2543
|
-
type: s,
|
|
2544
|
-
typeName: w.ZodPromise,
|
|
2545
|
-
...A(e)
|
|
2546
|
-
});
|
|
2547
|
-
class ie extends T {
|
|
2548
|
-
innerType() {
|
|
2549
|
-
return this._def.schema;
|
|
2550
|
-
}
|
|
2551
|
-
sourceType() {
|
|
2552
|
-
return this._def.schema._def.typeName === w.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2553
|
-
}
|
|
2554
|
-
_parse(e) {
|
|
2555
|
-
const { status: t, ctx: n } = this._processInputParams(e), r = this._def.effect || null, a = {
|
|
2556
|
-
addIssue: (i) => {
|
|
2557
|
-
h(n, i), i.fatal ? t.abort() : t.dirty();
|
|
2558
|
-
},
|
|
2559
|
-
get path() {
|
|
2560
|
-
return n.path;
|
|
2561
|
-
}
|
|
2562
|
-
};
|
|
2563
|
-
if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
|
|
2564
|
-
const i = r.transform(n.data, a);
|
|
2565
|
-
if (n.common.async)
|
|
2566
|
-
return Promise.resolve(i).then(async (o) => {
|
|
2567
|
-
if (t.value === "aborted")
|
|
2568
|
-
return b;
|
|
2569
|
-
const u = await this._def.schema._parseAsync({
|
|
2570
|
-
data: o,
|
|
2571
|
-
path: n.path,
|
|
2572
|
-
parent: n
|
|
2573
|
-
});
|
|
2574
|
-
return u.status === "aborted" ? b : u.status === "dirty" || t.value === "dirty" ? ue(u.value) : u;
|
|
2575
|
-
});
|
|
2576
|
-
{
|
|
2577
|
-
if (t.value === "aborted")
|
|
2578
|
-
return b;
|
|
2579
|
-
const o = this._def.schema._parseSync({
|
|
2580
|
-
data: i,
|
|
2581
|
-
path: n.path,
|
|
2582
|
-
parent: n
|
|
2583
|
-
});
|
|
2584
|
-
return o.status === "aborted" ? b : o.status === "dirty" || t.value === "dirty" ? ue(o.value) : o;
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
if (r.type === "refinement") {
|
|
2588
|
-
const i = (o) => {
|
|
2589
|
-
const u = r.refinement(o, a);
|
|
2590
|
-
if (n.common.async)
|
|
2591
|
-
return Promise.resolve(u);
|
|
2592
|
-
if (u instanceof Promise)
|
|
2593
|
-
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2594
|
-
return o;
|
|
2595
|
-
};
|
|
2596
|
-
if (n.common.async === !1) {
|
|
2597
|
-
const o = this._def.schema._parseSync({
|
|
2598
|
-
data: n.data,
|
|
2599
|
-
path: n.path,
|
|
2600
|
-
parent: n
|
|
2601
|
-
});
|
|
2602
|
-
return o.status === "aborted" ? b : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2603
|
-
} else
|
|
2604
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? b : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2605
|
-
}
|
|
2606
|
-
if (r.type === "transform")
|
|
2607
|
-
if (n.common.async === !1) {
|
|
2608
|
-
const i = this._def.schema._parseSync({
|
|
2609
|
-
data: n.data,
|
|
2610
|
-
path: n.path,
|
|
2611
|
-
parent: n
|
|
2612
|
-
});
|
|
2613
|
-
if (!ne(i))
|
|
2614
|
-
return b;
|
|
2615
|
-
const o = r.transform(i.value, a);
|
|
2616
|
-
if (o instanceof Promise)
|
|
2617
|
-
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2618
|
-
return { status: t.value, value: o };
|
|
2619
|
-
} else
|
|
2620
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => ne(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({
|
|
2621
|
-
status: t.value,
|
|
2622
|
-
value: o
|
|
2623
|
-
})) : b);
|
|
2624
|
-
O.assertNever(r);
|
|
2625
|
-
}
|
|
2626
|
-
}
|
|
2627
|
-
ie.create = (s, e, t) => new ie({
|
|
2628
|
-
schema: s,
|
|
2629
|
-
typeName: w.ZodEffects,
|
|
2630
|
-
effect: e,
|
|
2631
|
-
...A(t)
|
|
2632
|
-
});
|
|
2633
|
-
ie.createWithPreprocess = (s, e, t) => new ie({
|
|
2634
|
-
schema: e,
|
|
2635
|
-
effect: { type: "preprocess", transform: s },
|
|
2636
|
-
typeName: w.ZodEffects,
|
|
2637
|
-
...A(t)
|
|
2638
|
-
});
|
|
2639
|
-
class Y extends T {
|
|
2640
|
-
_parse(e) {
|
|
2641
|
-
return this._getType(e) === m.undefined ? $(void 0) : this._def.innerType._parse(e);
|
|
2642
|
-
}
|
|
2643
|
-
unwrap() {
|
|
2644
|
-
return this._def.innerType;
|
|
2645
|
-
}
|
|
2646
|
-
}
|
|
2647
|
-
Y.create = (s, e) => new Y({
|
|
2648
|
-
innerType: s,
|
|
2649
|
-
typeName: w.ZodOptional,
|
|
2650
|
-
...A(e)
|
|
2651
|
-
});
|
|
2652
|
-
class oe extends T {
|
|
2653
|
-
_parse(e) {
|
|
2654
|
-
return this._getType(e) === m.null ? $(null) : this._def.innerType._parse(e);
|
|
2655
|
-
}
|
|
2656
|
-
unwrap() {
|
|
2657
|
-
return this._def.innerType;
|
|
2658
|
-
}
|
|
2659
|
-
}
|
|
2660
|
-
oe.create = (s, e) => new oe({
|
|
2661
|
-
innerType: s,
|
|
2662
|
-
typeName: w.ZodNullable,
|
|
2663
|
-
...A(e)
|
|
2664
|
-
});
|
|
2665
|
-
class Le extends T {
|
|
2666
|
-
_parse(e) {
|
|
2667
|
-
const { ctx: t } = this._processInputParams(e);
|
|
2668
|
-
let n = t.data;
|
|
2669
|
-
return t.parsedType === m.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
2670
|
-
data: n,
|
|
2671
|
-
path: t.path,
|
|
2672
|
-
parent: t
|
|
2673
|
-
});
|
|
2674
|
-
}
|
|
2675
|
-
removeDefault() {
|
|
2676
|
-
return this._def.innerType;
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
Le.create = (s, e) => new Le({
|
|
2680
|
-
innerType: s,
|
|
2681
|
-
typeName: w.ZodDefault,
|
|
2682
|
-
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2683
|
-
...A(e)
|
|
2684
|
-
});
|
|
2685
|
-
class Ve extends T {
|
|
2686
|
-
_parse(e) {
|
|
2687
|
-
const { ctx: t } = this._processInputParams(e), n = {
|
|
2688
|
-
...t,
|
|
2689
|
-
common: {
|
|
2690
|
-
...t.common,
|
|
2691
|
-
issues: []
|
|
2692
|
-
}
|
|
2693
|
-
}, r = this._def.innerType._parse({
|
|
2694
|
-
data: n.data,
|
|
2695
|
-
path: n.path,
|
|
2696
|
-
parent: {
|
|
2697
|
-
...n
|
|
2698
|
-
}
|
|
2699
|
-
});
|
|
2700
|
-
return xe(r) ? r.then((a) => ({
|
|
2701
|
-
status: "valid",
|
|
2702
|
-
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2703
|
-
get error() {
|
|
2704
|
-
return new V(n.common.issues);
|
|
2705
|
-
},
|
|
2706
|
-
input: n.data
|
|
2707
|
-
})
|
|
2708
|
-
})) : {
|
|
2709
|
-
status: "valid",
|
|
2710
|
-
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
2711
|
-
get error() {
|
|
2712
|
-
return new V(n.common.issues);
|
|
2713
|
-
},
|
|
2714
|
-
input: n.data
|
|
2715
|
-
})
|
|
2716
|
-
};
|
|
2717
|
-
}
|
|
2718
|
-
removeCatch() {
|
|
2719
|
-
return this._def.innerType;
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
Ve.create = (s, e) => new Ve({
|
|
2723
|
-
innerType: s,
|
|
2724
|
-
typeName: w.ZodCatch,
|
|
2725
|
-
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2726
|
-
...A(e)
|
|
2727
|
-
});
|
|
2728
|
-
class pt extends T {
|
|
2729
|
-
_parse(e) {
|
|
2730
|
-
if (this._getType(e) !== m.nan) {
|
|
2731
|
-
const n = this._getOrReturnCtx(e);
|
|
2732
|
-
return h(n, {
|
|
2733
|
-
code: d.invalid_type,
|
|
2734
|
-
expected: m.nan,
|
|
2735
|
-
received: n.parsedType
|
|
2736
|
-
}), b;
|
|
2737
|
-
}
|
|
2738
|
-
return { status: "valid", value: e.data };
|
|
2739
|
-
}
|
|
2740
|
-
}
|
|
2741
|
-
pt.create = (s) => new pt({
|
|
2742
|
-
typeName: w.ZodNaN,
|
|
2743
|
-
...A(s)
|
|
2744
|
-
});
|
|
2745
|
-
class Xt extends T {
|
|
2746
|
-
_parse(e) {
|
|
2747
|
-
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2748
|
-
return this._def.type._parse({
|
|
2749
|
-
data: n,
|
|
2750
|
-
path: t.path,
|
|
2751
|
-
parent: t
|
|
2752
|
-
});
|
|
2753
|
-
}
|
|
2754
|
-
unwrap() {
|
|
2755
|
-
return this._def.type;
|
|
2756
|
-
}
|
|
2757
|
-
}
|
|
2758
|
-
class Ge extends T {
|
|
2759
|
-
_parse(e) {
|
|
2760
|
-
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2761
|
-
if (n.common.async)
|
|
2762
|
-
return (async () => {
|
|
2763
|
-
const a = await this._def.in._parseAsync({
|
|
2764
|
-
data: n.data,
|
|
2765
|
-
path: n.path,
|
|
2766
|
-
parent: n
|
|
2767
|
-
});
|
|
2768
|
-
return a.status === "aborted" ? b : a.status === "dirty" ? (t.dirty(), ue(a.value)) : this._def.out._parseAsync({
|
|
2769
|
-
data: a.value,
|
|
2770
|
-
path: n.path,
|
|
2771
|
-
parent: n
|
|
2772
|
-
});
|
|
2773
|
-
})();
|
|
2774
|
-
{
|
|
2775
|
-
const r = this._def.in._parseSync({
|
|
2776
|
-
data: n.data,
|
|
2777
|
-
path: n.path,
|
|
2778
|
-
parent: n
|
|
2779
|
-
});
|
|
2780
|
-
return r.status === "aborted" ? b : r.status === "dirty" ? (t.dirty(), {
|
|
2781
|
-
status: "dirty",
|
|
2782
|
-
value: r.value
|
|
2783
|
-
}) : this._def.out._parseSync({
|
|
2784
|
-
data: r.value,
|
|
2785
|
-
path: n.path,
|
|
2786
|
-
parent: n
|
|
2787
|
-
});
|
|
2788
|
-
}
|
|
2789
|
-
}
|
|
2790
|
-
static create(e, t) {
|
|
2791
|
-
return new Ge({
|
|
2792
|
-
in: e,
|
|
2793
|
-
out: t,
|
|
2794
|
-
typeName: w.ZodPipeline
|
|
2795
|
-
});
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
class Fe extends T {
|
|
2799
|
-
_parse(e) {
|
|
2800
|
-
const t = this._def.innerType._parse(e), n = (r) => (ne(r) && (r.value = Object.freeze(r.value)), r);
|
|
2801
|
-
return xe(t) ? t.then((r) => n(r)) : n(t);
|
|
2802
|
-
}
|
|
2803
|
-
unwrap() {
|
|
2804
|
-
return this._def.innerType;
|
|
2805
|
-
}
|
|
2806
|
-
}
|
|
2807
|
-
Fe.create = (s, e) => new Fe({
|
|
2808
|
-
innerType: s,
|
|
2809
|
-
typeName: w.ZodReadonly,
|
|
2810
|
-
...A(e)
|
|
2811
|
-
});
|
|
2812
|
-
var w;
|
|
2813
|
-
(function(s) {
|
|
2814
|
-
s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
|
|
2815
|
-
})(w || (w = {}));
|
|
2816
|
-
const ee = G.create, S = re.create, Ue = ze.create, Ye = Pe.create;
|
|
2817
|
-
se.create;
|
|
2818
|
-
H.create;
|
|
2819
|
-
const ve = $e.create, Xe = U.create, I = Z.create;
|
|
2820
|
-
be.create;
|
|
2821
|
-
we.create;
|
|
2822
|
-
const gt = B.create, F = le.create, Ht = ae.create, Jt = pe.create;
|
|
2823
|
-
Y.create;
|
|
2824
|
-
oe.create;
|
|
2825
|
-
I({
|
|
2826
|
-
pin: I({
|
|
2827
|
-
fade: Ue().optional(),
|
|
2828
|
-
maxCount: S().optional(),
|
|
2829
|
-
maxZoom: S().optional()
|
|
2830
|
-
}).optional(),
|
|
2831
|
-
animation: I({
|
|
2832
|
-
queue: I({
|
|
2833
|
-
limit: S().optional()
|
|
2834
|
-
}).optional()
|
|
2835
|
-
}).optional(),
|
|
2836
|
-
api: I({
|
|
2837
|
-
states: I({
|
|
2838
|
-
url: ee().optional(),
|
|
2839
|
-
key: ee()
|
|
2840
|
-
}).optional(),
|
|
2841
|
-
log: I({
|
|
2842
|
-
enabled: Ue()
|
|
2843
|
-
}).optional()
|
|
2844
|
-
}).optional()
|
|
2845
|
-
});
|
|
2846
|
-
const Be = S().min(-90).max(90), We = S().min(-180).max(180), Qt = I({
|
|
2847
|
-
sw: I({ lat: Be, lng: We }),
|
|
2848
|
-
ne: I({ lat: Be, lng: We })
|
|
2849
|
-
}), qe = Ye().refine((s) => s instanceof HTMLElement, "Must be an HTMLElement"), He = I({
|
|
2850
|
-
mapSize: S().min(1),
|
|
2851
|
-
zoomMin: S().min(0),
|
|
2852
|
-
zoomMax: S().min(0),
|
|
2853
|
-
zoomScale: S().min(1).max(10)
|
|
2854
|
-
}), Kt = I({
|
|
2855
|
-
instance: Ye(),
|
|
2856
|
-
inserted: F().returns(Ue()),
|
|
2857
|
-
insert: F().returns(ve()),
|
|
2858
|
-
remove: F().returns(ve()),
|
|
2859
|
-
update: F().args(S()).returns(ve())
|
|
2860
|
-
}), as = I({
|
|
2861
|
-
getParameters: F().args().returns(He),
|
|
2862
|
-
getContainer: F().args().returns(qe),
|
|
2863
|
-
getZoom: F().args().returns(S()),
|
|
2864
|
-
getBounds: F().args().returns(Qt),
|
|
2865
|
-
panBy: F().args(S(), S()).returns(ve()),
|
|
2866
|
-
createMarker: F().args(qe, Be, We, S()).returns(Kt)
|
|
2867
|
-
}), Ee = F().args(ee()).returns(Jt(qe)), es = I({
|
|
2868
|
-
id: ee().min(1),
|
|
2869
|
-
rank: S(),
|
|
2870
|
-
lat: S().min(-90).max(90),
|
|
2871
|
-
lng: S().min(-180).max(180),
|
|
2872
|
-
tooltip: I({
|
|
2873
|
-
style: I({
|
|
2874
|
-
width: S(),
|
|
2875
|
-
height: S(),
|
|
2876
|
-
margin: S(),
|
|
2877
|
-
radius: S()
|
|
2878
|
-
}).refine((s) => Math.min(s.width, s.height) / s.margin >= 5, "Tooltip width and height must be at least 5 times the margin"),
|
|
2879
|
-
body: Ee
|
|
2880
|
-
}),
|
|
2881
|
-
pin: I({
|
|
2882
|
-
style: I({
|
|
2883
|
-
width: S(),
|
|
2884
|
-
height: S(),
|
|
2885
|
-
radius: S()
|
|
2886
|
-
}),
|
|
2887
|
-
body: Ee
|
|
2888
|
-
}).optional(),
|
|
2889
|
-
popup: I({
|
|
2890
|
-
style: I({
|
|
2891
|
-
width: S(),
|
|
2892
|
-
height: S(),
|
|
2893
|
-
radius: S(),
|
|
2894
|
-
margin: S()
|
|
2895
|
-
}),
|
|
2896
|
-
body: Ee
|
|
2897
|
-
}).optional()
|
|
2898
|
-
}), is = Xe(es);
|
|
2899
|
-
gt([S(), Xe(gt([S(), S()]))]);
|
|
2900
|
-
const ts = He, ss = I({
|
|
2901
|
-
id: ee(),
|
|
2902
|
-
rank: S(),
|
|
2903
|
-
lat: S(),
|
|
2904
|
-
lng: S(),
|
|
2905
|
-
width: S(),
|
|
2906
|
-
height: S(),
|
|
2907
|
-
margin: S()
|
|
2908
|
-
});
|
|
2909
|
-
I({
|
|
2910
|
-
key: ee(),
|
|
2911
|
-
parameters: He,
|
|
2912
|
-
input: Xe(ss)
|
|
2913
|
-
});
|
|
2914
|
-
const ns = Ht(["info", "warn", "error"]);
|
|
2915
|
-
I({
|
|
2916
|
-
title: ee(),
|
|
2917
|
-
level: ns,
|
|
2918
|
-
content: Ye()
|
|
2919
|
-
});
|
|
2920
|
-
var M;
|
|
2921
|
-
((s) => {
|
|
2922
|
-
class e {
|
|
2923
|
-
constructor() {
|
|
2924
|
-
R(this, "zoomAfterExpanded");
|
|
2925
|
-
R(this, "zoomAfterAngleIndexes");
|
|
2926
|
-
this.zoomAfterExpanded = NaN, this.zoomAfterAngleIndexes = [];
|
|
2927
|
-
}
|
|
2928
|
-
}
|
|
2929
|
-
s.State = e;
|
|
2930
|
-
class t {
|
|
2931
|
-
constructor(l) {
|
|
2932
|
-
R(this, "min");
|
|
2933
|
-
R(this, "max");
|
|
2934
|
-
R(this, "scale");
|
|
2935
|
-
R(this, "step");
|
|
2936
|
-
ts.parse(l), this.min = l.zoomMin, this.max = l.zoomMax, this.scale = Math.round(l.zoomScale), this.step = 1 / this.scale;
|
|
2937
|
-
}
|
|
2938
|
-
addSteps(l, f) {
|
|
2939
|
-
return Math.round((l + f * this.step) * this.scale) / this.scale;
|
|
2940
|
-
}
|
|
2941
|
-
getLevel(l) {
|
|
2942
|
-
if (!(l < this.min))
|
|
2943
|
-
return l > this.max ? this.max * this.scale : Math.floor(l * this.scale);
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
s.Zoom = t;
|
|
2947
|
-
class n {
|
|
2948
|
-
constructor(l, f, g) {
|
|
2949
|
-
// PROPERTIES
|
|
2950
|
-
/** The id of the tooltip that this tooltip represents. */
|
|
2951
|
-
R(this, "id", "");
|
|
2952
|
-
/** The index of the tooltip in the tooltips array. */
|
|
2953
|
-
R(this, "index", NaN);
|
|
2954
|
-
/** The rank of the tooltip tooltip. */
|
|
2955
|
-
R(this, "rank", NaN);
|
|
2956
|
-
/** The x coordinate of the tooltip anchor. */
|
|
2957
|
-
R(this, "x", NaN);
|
|
2958
|
-
/** The y coordinate of the tooltip anchor. */
|
|
2959
|
-
R(this, "y", NaN);
|
|
2960
|
-
/** The base width of the tooltip tooltip. */
|
|
2961
|
-
R(this, "width", NaN);
|
|
2962
|
-
/** The base height of the tooltip tooltip. */
|
|
2963
|
-
R(this, "height", NaN);
|
|
2964
|
-
// STATE
|
|
2965
|
-
/** State of the tooltip expanded or not. */
|
|
2966
|
-
R(this, "expanded", !0);
|
|
2967
|
-
/** The scale of the tooltip. */
|
|
2968
|
-
R(this, "scale", 1);
|
|
2969
|
-
/** The angle of the tooltip. */
|
|
2970
|
-
R(this, "angle", P.DEGREES_DEFAULT);
|
|
2971
|
-
/** The neighbours of the tooltip. */
|
|
2972
|
-
R(this, "neighbours", new Array());
|
|
2973
|
-
// BOUNDS
|
|
2974
|
-
//* Scaled distances to edges of the tooltip bounds */
|
|
2975
|
-
R(this, "distances", { left: NaN, right: NaN, top: NaN, bottom: NaN });
|
|
2976
|
-
// SIMULATION
|
|
2977
|
-
/** A tooltip has a particle whose position is used to calculate the angle */
|
|
2978
|
-
R(this, "particle", { index: P.DEGREES.indexOf(P.DEGREES_DEFAULT), distX: NaN, distY: NaN });
|
|
2979
|
-
const x = Ze.project(f.lat, f.lng, l.mapSize);
|
|
2980
|
-
this.index = g, this.id = f.id, this.rank = f.rank, this.x = x.x, this.y = x.y, this.width = f.width + 2 * f.margin, this.height = f.height + 2 * f.margin;
|
|
2981
|
-
}
|
|
2982
|
-
updateScale(l) {
|
|
2983
|
-
l != this.scale && (this.scale = l, this.updateBounds(l, this.angle), this.updateParticle(l));
|
|
2984
|
-
}
|
|
2985
|
-
updateAngle(l) {
|
|
2986
|
-
l != this.angle && (this.angle = l, this.updateBounds(this.scale, l));
|
|
2987
|
-
}
|
|
2988
|
-
updateBounds(l, f) {
|
|
2989
|
-
const g = Re.getOffsets(this.width, this.height, f), x = -g.x, _ = this.width - x, k = -g.y, E = this.height - k, C = this.distances;
|
|
2990
|
-
C.left = x / l, C.right = _ / l, C.top = k / l, C.bottom = E / l;
|
|
2991
|
-
}
|
|
2992
|
-
updateParticle(l) {
|
|
2993
|
-
this.particle.distX = this.width / 2 / l, this.particle.distY = this.height / 2 / l;
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
s.Tooltip = n;
|
|
2997
|
-
function r(p, l) {
|
|
2998
|
-
let f = new Array(l.length);
|
|
2999
|
-
for (let g = 0; g < l.length; g++)
|
|
3000
|
-
f[g] = new n(p, l[g], g);
|
|
3001
|
-
return f;
|
|
3002
|
-
}
|
|
3003
|
-
s.createTooltips = r;
|
|
3004
|
-
function a(p, l) {
|
|
3005
|
-
let f = new Array(), g = 0;
|
|
3006
|
-
for (let _ = l.min * l.scale; _ <= l.max * l.scale; _++)
|
|
3007
|
-
f[_] = new Array(p.length);
|
|
3008
|
-
const x = new Array(p.length);
|
|
3009
|
-
for (let _ = 0; _ < p.length; _++) {
|
|
3010
|
-
const k = p[_];
|
|
3011
|
-
x[_] = {
|
|
3012
|
-
x: k.x,
|
|
3013
|
-
y: k.y,
|
|
3014
|
-
distances: {
|
|
3015
|
-
left: k.width,
|
|
3016
|
-
right: k.width,
|
|
3017
|
-
top: k.height,
|
|
3018
|
-
bottom: k.height
|
|
3019
|
-
}
|
|
3020
|
-
};
|
|
3021
|
-
}
|
|
3022
|
-
for (let _ = 0; _ < p.length; _++) {
|
|
3023
|
-
const k = p[_], E = x[_];
|
|
3024
|
-
for (let C = _ + 1; C < p.length; C++) {
|
|
3025
|
-
const ge = p[C], Ae = x[C], ce = K.getZoomWhenTouching(E, Ae);
|
|
3026
|
-
ce > g && (g = ce);
|
|
3027
|
-
const J = l.getLevel(ce);
|
|
3028
|
-
if (J == null) continue;
|
|
3029
|
-
const W = f[J], Q = W[_];
|
|
3030
|
-
Q ? Q.push(ge) : W[_] = [ge];
|
|
3031
|
-
const de = W[C];
|
|
3032
|
-
de ? de.push(k) : W[C] = [k];
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
return { zoomMax: g, zoomLevelDeltas: f };
|
|
3036
|
-
}
|
|
3037
|
-
s.createNeighbours = a;
|
|
3038
|
-
function i(p, l) {
|
|
3039
|
-
for (let f = 0; f < p.length; f++) {
|
|
3040
|
-
let g = p[f];
|
|
3041
|
-
if (g.expanded == !1) {
|
|
3042
|
-
g.neighbours.length = 0;
|
|
3043
|
-
continue;
|
|
3044
|
-
}
|
|
3045
|
-
const x = l[f];
|
|
3046
|
-
if (x != null)
|
|
3047
|
-
for (let _ = 0; _ < x.length; _++) {
|
|
3048
|
-
const k = x[_];
|
|
3049
|
-
k.expanded != !1 && g.neighbours.push(k);
|
|
3050
|
-
}
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
s.updateNeighbours = i;
|
|
3054
|
-
function o(p) {
|
|
3055
|
-
const l = /* @__PURE__ */ new Set(), f = [];
|
|
3056
|
-
for (let g = 0; g < p.length; g++) {
|
|
3057
|
-
let x = p[g];
|
|
3058
|
-
if (x.expanded == !1 || x.neighbours.length == 0 || l.has(x)) continue;
|
|
3059
|
-
l.add(x);
|
|
3060
|
-
const _ = [], k = [x];
|
|
3061
|
-
for (; k.length > 0; ) {
|
|
3062
|
-
const E = k.pop();
|
|
3063
|
-
_.push(E);
|
|
3064
|
-
for (const C of E.neighbours)
|
|
3065
|
-
l.has(C) || (l.add(C), k.push(C));
|
|
3066
|
-
}
|
|
3067
|
-
f.push(_);
|
|
3068
|
-
}
|
|
3069
|
-
return f;
|
|
3070
|
-
}
|
|
3071
|
-
s.getNeighbourGraphs = o;
|
|
3072
|
-
function u(p) {
|
|
3073
|
-
p.expanded = !1;
|
|
3074
|
-
const l = p.neighbours;
|
|
3075
|
-
for (let f = 0; f < l.length; f++) {
|
|
3076
|
-
const g = l[f], x = g.neighbours.indexOf(p);
|
|
3077
|
-
g.neighbours.splice(x, 1);
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3080
|
-
s.updateCollapsed = u;
|
|
3081
|
-
function c(p, l, f) {
|
|
3082
|
-
for (let g = 0; g < l.length; g++) {
|
|
3083
|
-
const x = l[g];
|
|
3084
|
-
if (x.expanded == !1) continue;
|
|
3085
|
-
const _ = p.get(x.id);
|
|
3086
|
-
if (!_) throw new Error("Tooltip not found");
|
|
3087
|
-
_.zoomAfterExpanded = f;
|
|
3088
|
-
const k = P.DEGREES.indexOf(x.angle);
|
|
3089
|
-
_.zoomAfterAngleIndexes.length == 0 ? _.zoomAfterAngleIndexes.push([f, k]) : _.zoomAfterAngleIndexes[0][1] != k ? _.zoomAfterAngleIndexes.unshift([f, k]) : _.zoomAfterAngleIndexes[0][0] = f;
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
s.updateStates = c;
|
|
3093
|
-
function v(p, l) {
|
|
3094
|
-
for (let f = 0; f < p.length; f++)
|
|
3095
|
-
p[f].updateScale(l);
|
|
3096
|
-
}
|
|
3097
|
-
s.updateScale = v;
|
|
3098
|
-
function N(p) {
|
|
3099
|
-
const l = /* @__PURE__ */ new Set();
|
|
3100
|
-
for (let f = 0; f < p.length; f++) {
|
|
3101
|
-
const g = p[f], x = p[f].neighbours;
|
|
3102
|
-
for (let _ = 0; _ < x.length; _++) {
|
|
3103
|
-
const k = x[_];
|
|
3104
|
-
K.areOverlaping(g, k) && (l.add(g), l.add(k));
|
|
3105
|
-
}
|
|
3106
|
-
}
|
|
3107
|
-
return l;
|
|
3108
|
-
}
|
|
3109
|
-
s.getOverlaps = N;
|
|
3110
|
-
function z(p, l) {
|
|
3111
|
-
let f = !1;
|
|
3112
|
-
for (let g = 0; g < l.length; g++) {
|
|
3113
|
-
const x = l[g], _ = l[g].neighbours;
|
|
3114
|
-
for (let k = 0; k < _.length; k++) {
|
|
3115
|
-
const E = _[k];
|
|
3116
|
-
K.areOverlaping(x, E) && (p.has(x) || (p.add(x), f = !0), p.has(E) || (p.add(E), f = !0));
|
|
3117
|
-
}
|
|
3118
|
-
}
|
|
3119
|
-
return f;
|
|
3120
|
-
}
|
|
3121
|
-
s.updateOverlaps = z;
|
|
3122
|
-
function j(p) {
|
|
3123
|
-
let l, f = 0;
|
|
3124
|
-
for (let g = 0; g < p.length; g++) {
|
|
3125
|
-
const x = p[g], _ = p[g].neighbours;
|
|
3126
|
-
let k = 0;
|
|
3127
|
-
for (let E = 0; E < _.length; E++) {
|
|
3128
|
-
const C = _[E];
|
|
3129
|
-
K.areOverlaping(x, C) && (k += 1 + (C.rank - x.rank));
|
|
3130
|
-
}
|
|
3131
|
-
k = k * _.length, k > f && (f = k, l = x);
|
|
3132
|
-
}
|
|
3133
|
-
return l;
|
|
3134
|
-
}
|
|
3135
|
-
s.getOverlapsWorstTooltip = j;
|
|
3136
|
-
function D(p) {
|
|
3137
|
-
for (let l = 0; l < p.length; l++) {
|
|
3138
|
-
const f = p[l];
|
|
3139
|
-
for (let g = l + 1; g < p.length; g++) {
|
|
3140
|
-
const x = p[g];
|
|
3141
|
-
if (K.areOverlaping(f, x))
|
|
3142
|
-
return !0;
|
|
3143
|
-
}
|
|
3144
|
-
}
|
|
3145
|
-
return !1;
|
|
3146
|
-
}
|
|
3147
|
-
s.areOverlaping = D, ((p) => {
|
|
3148
|
-
function l(x) {
|
|
3149
|
-
_e.initializeAngleIndexes(x), g(x);
|
|
3150
|
-
}
|
|
3151
|
-
p.initializeAngles = l;
|
|
3152
|
-
function f(x) {
|
|
3153
|
-
const _ = _e.updateAngleIndexes(x);
|
|
3154
|
-
return g(x), _;
|
|
3155
|
-
}
|
|
3156
|
-
p.updateAngles = f;
|
|
3157
|
-
function g(x) {
|
|
3158
|
-
for (let _ = 0; _ < x.length; _++) {
|
|
3159
|
-
const k = x[_];
|
|
3160
|
-
k.updateAngle(P.DEGREES[k.particle.index]);
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
p.updateTooltips = g;
|
|
3164
|
-
})(s.Particles || (s.Particles = {}));
|
|
3165
|
-
})(M || (M = {}));
|
|
3166
|
-
function os(s, e) {
|
|
3167
|
-
const t = new M.Zoom(s);
|
|
3168
|
-
if (e.length == 0) return [];
|
|
3169
|
-
if (e.length == 1) return [[t.min, [[t.min, P.DEGREES.indexOf(P.DEGREES_DEFAULT)]]]];
|
|
3170
|
-
const n = new Map(e.map((c) => [c.id, new M.State()])), r = M.createTooltips(s, e), a = M.createNeighbours(r, t);
|
|
3171
|
-
M.Particles.initializeAngles(r), M.updateStates(n, r, t.addSteps(t.max, 1));
|
|
3172
|
-
const i = t.getLevel(a.zoomMax);
|
|
3173
|
-
if (i == null) return Array.from(n.values()).map((c) => [c.zoomAfterExpanded, c.zoomAfterAngleIndexes]);
|
|
3174
|
-
const o = t.min, u = i / t.scale;
|
|
3175
|
-
for (let c = u; c >= o; c = t.addSteps(c, -1)) {
|
|
3176
|
-
const v = Math.pow(2, c), N = c * t.scale;
|
|
3177
|
-
M.updateNeighbours(r, a.zoomLevelDeltas[N]);
|
|
3178
|
-
const z = M.getNeighbourGraphs(r);
|
|
3179
|
-
for (const j of z) {
|
|
3180
|
-
M.updateScale(j, v);
|
|
3181
|
-
const D = M.getOverlaps(j);
|
|
3182
|
-
for (; D.size > 1; ) {
|
|
3183
|
-
const p = Array.from(D);
|
|
3184
|
-
for (let g = 0; g < P.COUNT && !(M.Particles.updateAngles(p) == !0 || M.areOverlaping(p) == !1); g++)
|
|
3185
|
-
;
|
|
3186
|
-
if (M.updateOverlaps(D, p)) continue;
|
|
3187
|
-
const f = M.getOverlapsWorstTooltip(p);
|
|
3188
|
-
if (f == null) break;
|
|
3189
|
-
M.updateCollapsed(f), D.delete(f);
|
|
3190
|
-
}
|
|
3191
|
-
}
|
|
3192
|
-
M.updateStates(n, r, Number(c.toFixed(1)));
|
|
3193
|
-
}
|
|
3194
|
-
return Array.from(n.values()).map((c) => [c.zoomAfterExpanded, c.zoomAfterAngleIndexes]);
|
|
3195
|
-
}
|
|
3196
|
-
export {
|
|
3197
|
-
P as A,
|
|
3198
|
-
K as B,
|
|
3199
|
-
Ze as M,
|
|
3200
|
-
Re as R,
|
|
3201
|
-
is as a,
|
|
3202
|
-
os as g,
|
|
3203
|
-
as as m
|
|
3204
|
-
};
|