@next-feature/client 0.1.2-2 → 0.1.2-3

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.
@@ -0,0 +1,4792 @@
1
+ function zt(t, e) {
2
+ return function() {
3
+ return t.apply(e, arguments);
4
+ };
5
+ }
6
+ const { toString: Tr } = Object.prototype, { getPrototypeOf: xt } = Object, { iterator: et, toStringTag: qt } = Symbol, tt = /* @__PURE__ */ ((t) => (e) => {
7
+ const r = Tr.call(e);
8
+ return t[r] || (t[r] = r.slice(8, -1).toLowerCase());
9
+ })(/* @__PURE__ */ Object.create(null)), V = (t) => (t = t.toLowerCase(), (e) => tt(e) === t), rt = (t) => (e) => typeof e === t, { isArray: _e } = Array, ke = rt("undefined");
10
+ function Sr(t) {
11
+ return t !== null && !ke(t) && t.constructor !== null && !ke(t.constructor) && L(t.constructor.isBuffer) && t.constructor.isBuffer(t);
12
+ }
13
+ const Ht = V("ArrayBuffer");
14
+ function Rr(t) {
15
+ let e;
16
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && Ht(t.buffer), e;
17
+ }
18
+ const Or = rt("string"), L = rt("function"), Wt = rt("number"), nt = (t) => t !== null && typeof t == "object", Ar = (t) => t === !0 || t === !1, Be = (t) => {
19
+ if (tt(t) !== "object")
20
+ return !1;
21
+ const e = xt(t);
22
+ return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(qt in t) && !(et in t);
23
+ }, Cr = V("Date"), Nr = V("File"), jr = V("Blob"), Pr = V("FileList"), Zr = (t) => nt(t) && L(t.pipe), Ir = (t) => {
24
+ let e;
25
+ return t && (typeof FormData == "function" && t instanceof FormData || L(t.append) && ((e = tt(t)) === "formdata" || // detect form-data instance
26
+ e === "object" && L(t.toString) && t.toString() === "[object FormData]"));
27
+ }, Dr = V("URLSearchParams"), [Lr, Ur, Fr, Mr] = ["ReadableStream", "Request", "Response", "Headers"].map(V), Br = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
28
+ function Le(t, e, { allOwnKeys: r = !1 } = {}) {
29
+ if (t === null || typeof t > "u")
30
+ return;
31
+ let n, s;
32
+ if (typeof t != "object" && (t = [t]), _e(t))
33
+ for (n = 0, s = t.length; n < s; n++)
34
+ e.call(null, t[n], n, t);
35
+ else {
36
+ const i = r ? Object.getOwnPropertyNames(t) : Object.keys(t), a = i.length;
37
+ let o;
38
+ for (n = 0; n < a; n++)
39
+ o = i[n], e.call(null, t[o], o, t);
40
+ }
41
+ }
42
+ function Jt(t, e) {
43
+ e = e.toLowerCase();
44
+ const r = Object.keys(t);
45
+ let n = r.length, s;
46
+ for (; n-- > 0; )
47
+ if (s = r[n], e === s.toLowerCase())
48
+ return s;
49
+ return null;
50
+ }
51
+ const se = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Kt = (t) => !ke(t) && t !== se;
52
+ function ft() {
53
+ const { caseless: t } = Kt(this) && this || {}, e = {}, r = (n, s) => {
54
+ const i = t && Jt(e, s) || s;
55
+ Be(e[i]) && Be(n) ? e[i] = ft(e[i], n) : Be(n) ? e[i] = ft({}, n) : _e(n) ? e[i] = n.slice() : e[i] = n;
56
+ };
57
+ for (let n = 0, s = arguments.length; n < s; n++)
58
+ arguments[n] && Le(arguments[n], r);
59
+ return e;
60
+ }
61
+ const $r = (t, e, r, { allOwnKeys: n } = {}) => (Le(e, (s, i) => {
62
+ r && L(s) ? t[i] = zt(s, r) : t[i] = s;
63
+ }, { allOwnKeys: n }), t), Vr = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), zr = (t, e, r, n) => {
64
+ t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", {
65
+ value: e.prototype
66
+ }), r && Object.assign(t.prototype, r);
67
+ }, qr = (t, e, r, n) => {
68
+ let s, i, a;
69
+ const o = {};
70
+ if (e = e || {}, t == null) return e;
71
+ do {
72
+ for (s = Object.getOwnPropertyNames(t), i = s.length; i-- > 0; )
73
+ a = s[i], (!n || n(a, t, e)) && !o[a] && (e[a] = t[a], o[a] = !0);
74
+ t = r !== !1 && xt(t);
75
+ } while (t && (!r || r(t, e)) && t !== Object.prototype);
76
+ return e;
77
+ }, Hr = (t, e, r) => {
78
+ t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length;
79
+ const n = t.indexOf(e, r);
80
+ return n !== -1 && n === r;
81
+ }, Wr = (t) => {
82
+ if (!t) return null;
83
+ if (_e(t)) return t;
84
+ let e = t.length;
85
+ if (!Wt(e)) return null;
86
+ const r = new Array(e);
87
+ for (; e-- > 0; )
88
+ r[e] = t[e];
89
+ return r;
90
+ }, Jr = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && xt(Uint8Array)), Kr = (t, e) => {
91
+ const n = (t && t[et]).call(t);
92
+ let s;
93
+ for (; (s = n.next()) && !s.done; ) {
94
+ const i = s.value;
95
+ e.call(t, i[0], i[1]);
96
+ }
97
+ }, Xr = (t, e) => {
98
+ let r;
99
+ const n = [];
100
+ for (; (r = t.exec(e)) !== null; )
101
+ n.push(r);
102
+ return n;
103
+ }, Gr = V("HTMLFormElement"), Yr = (t) => t.toLowerCase().replace(
104
+ /[-_\s]([a-z\d])(\w*)/g,
105
+ function(r, n, s) {
106
+ return n.toUpperCase() + s;
107
+ }
108
+ ), Ot = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Qr = V("RegExp"), Xt = (t, e) => {
109
+ const r = Object.getOwnPropertyDescriptors(t), n = {};
110
+ Le(r, (s, i) => {
111
+ let a;
112
+ (a = e(s, i, t)) !== !1 && (n[i] = a || s);
113
+ }), Object.defineProperties(t, n);
114
+ }, en = (t) => {
115
+ Xt(t, (e, r) => {
116
+ if (L(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
117
+ return !1;
118
+ const n = t[r];
119
+ if (L(n)) {
120
+ if (e.enumerable = !1, "writable" in e) {
121
+ e.writable = !1;
122
+ return;
123
+ }
124
+ e.set || (e.set = () => {
125
+ throw Error("Can not rewrite read-only method '" + r + "'");
126
+ });
127
+ }
128
+ });
129
+ }, tn = (t, e) => {
130
+ const r = {}, n = (s) => {
131
+ s.forEach((i) => {
132
+ r[i] = !0;
133
+ });
134
+ };
135
+ return _e(t) ? n(t) : n(String(t).split(e)), r;
136
+ }, rn = () => {
137
+ }, nn = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
138
+ function sn(t) {
139
+ return !!(t && L(t.append) && t[qt] === "FormData" && t[et]);
140
+ }
141
+ const an = (t) => {
142
+ const e = new Array(10), r = (n, s) => {
143
+ if (nt(n)) {
144
+ if (e.indexOf(n) >= 0)
145
+ return;
146
+ if (!("toJSON" in n)) {
147
+ e[s] = n;
148
+ const i = _e(n) ? [] : {};
149
+ return Le(n, (a, o) => {
150
+ const l = r(a, s + 1);
151
+ !ke(l) && (i[o] = l);
152
+ }), e[s] = void 0, i;
153
+ }
154
+ }
155
+ return n;
156
+ };
157
+ return r(t, 0);
158
+ }, on = V("AsyncFunction"), cn = (t) => t && (nt(t) || L(t)) && L(t.then) && L(t.catch), Gt = ((t, e) => t ? setImmediate : e ? ((r, n) => (se.addEventListener("message", ({ source: s, data: i }) => {
159
+ s === se && i === r && n.length && n.shift()();
160
+ }, !1), (s) => {
161
+ n.push(s), se.postMessage(r, "*");
162
+ }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
163
+ typeof setImmediate == "function",
164
+ L(se.postMessage)
165
+ ), un = typeof queueMicrotask < "u" ? queueMicrotask.bind(se) : typeof process < "u" && process.nextTick || Gt, ln = (t) => t != null && L(t[et]), u = {
166
+ isArray: _e,
167
+ isArrayBuffer: Ht,
168
+ isBuffer: Sr,
169
+ isFormData: Ir,
170
+ isArrayBufferView: Rr,
171
+ isString: Or,
172
+ isNumber: Wt,
173
+ isBoolean: Ar,
174
+ isObject: nt,
175
+ isPlainObject: Be,
176
+ isReadableStream: Lr,
177
+ isRequest: Ur,
178
+ isResponse: Fr,
179
+ isHeaders: Mr,
180
+ isUndefined: ke,
181
+ isDate: Cr,
182
+ isFile: Nr,
183
+ isBlob: jr,
184
+ isRegExp: Qr,
185
+ isFunction: L,
186
+ isStream: Zr,
187
+ isURLSearchParams: Dr,
188
+ isTypedArray: Jr,
189
+ isFileList: Pr,
190
+ forEach: Le,
191
+ merge: ft,
192
+ extend: $r,
193
+ trim: Br,
194
+ stripBOM: Vr,
195
+ inherits: zr,
196
+ toFlatObject: qr,
197
+ kindOf: tt,
198
+ kindOfTest: V,
199
+ endsWith: Hr,
200
+ toArray: Wr,
201
+ forEachEntry: Kr,
202
+ matchAll: Xr,
203
+ isHTMLForm: Gr,
204
+ hasOwnProperty: Ot,
205
+ hasOwnProp: Ot,
206
+ // an alias to avoid ESLint no-prototype-builtins detection
207
+ reduceDescriptors: Xt,
208
+ freezeMethods: en,
209
+ toObjectSet: tn,
210
+ toCamelCase: Yr,
211
+ noop: rn,
212
+ toFiniteNumber: nn,
213
+ findKey: Jt,
214
+ global: se,
215
+ isContextDefined: Kt,
216
+ isSpecCompliantForm: sn,
217
+ toJSONObject: an,
218
+ isAsyncFn: on,
219
+ isThenable: cn,
220
+ setImmediate: Gt,
221
+ asap: un,
222
+ isIterable: ln
223
+ };
224
+ function w(t, e, r, n, s) {
225
+ Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), s && (this.response = s, this.status = s.status ? s.status : null);
226
+ }
227
+ u.inherits(w, Error, {
228
+ toJSON: function() {
229
+ return {
230
+ // Standard
231
+ message: this.message,
232
+ name: this.name,
233
+ // Microsoft
234
+ description: this.description,
235
+ number: this.number,
236
+ // Mozilla
237
+ fileName: this.fileName,
238
+ lineNumber: this.lineNumber,
239
+ columnNumber: this.columnNumber,
240
+ stack: this.stack,
241
+ // Axios
242
+ config: u.toJSONObject(this.config),
243
+ code: this.code,
244
+ status: this.status
245
+ };
246
+ }
247
+ });
248
+ const Yt = w.prototype, Qt = {};
249
+ [
250
+ "ERR_BAD_OPTION_VALUE",
251
+ "ERR_BAD_OPTION",
252
+ "ECONNABORTED",
253
+ "ETIMEDOUT",
254
+ "ERR_NETWORK",
255
+ "ERR_FR_TOO_MANY_REDIRECTS",
256
+ "ERR_DEPRECATED",
257
+ "ERR_BAD_RESPONSE",
258
+ "ERR_BAD_REQUEST",
259
+ "ERR_CANCELED",
260
+ "ERR_NOT_SUPPORT",
261
+ "ERR_INVALID_URL"
262
+ // eslint-disable-next-line func-names
263
+ ].forEach((t) => {
264
+ Qt[t] = { value: t };
265
+ });
266
+ Object.defineProperties(w, Qt);
267
+ Object.defineProperty(Yt, "isAxiosError", { value: !0 });
268
+ w.from = (t, e, r, n, s, i) => {
269
+ const a = Object.create(Yt);
270
+ return u.toFlatObject(t, a, function(l) {
271
+ return l !== Error.prototype;
272
+ }, (o) => o !== "isAxiosError"), w.call(a, t.message, e, r, n, s), a.cause = t, a.name = t.name, i && Object.assign(a, i), a;
273
+ };
274
+ const dn = null;
275
+ function ht(t) {
276
+ return u.isPlainObject(t) || u.isArray(t);
277
+ }
278
+ function er(t) {
279
+ return u.endsWith(t, "[]") ? t.slice(0, -2) : t;
280
+ }
281
+ function At(t, e, r) {
282
+ return t ? t.concat(e).map(function(s, i) {
283
+ return s = er(s), !r && i ? "[" + s + "]" : s;
284
+ }).join(r ? "." : "") : e;
285
+ }
286
+ function fn(t) {
287
+ return u.isArray(t) && !t.some(ht);
288
+ }
289
+ const hn = u.toFlatObject(u, {}, null, function(e) {
290
+ return /^is[A-Z]/.test(e);
291
+ });
292
+ function st(t, e, r) {
293
+ if (!u.isObject(t))
294
+ throw new TypeError("target must be an object");
295
+ e = e || new FormData(), r = u.toFlatObject(r, {
296
+ metaTokens: !0,
297
+ dots: !1,
298
+ indexes: !1
299
+ }, !1, function(k, _) {
300
+ return !u.isUndefined(_[k]);
301
+ });
302
+ const n = r.metaTokens, s = r.visitor || d, i = r.dots, a = r.indexes, l = (r.Blob || typeof Blob < "u" && Blob) && u.isSpecCompliantForm(e);
303
+ if (!u.isFunction(s))
304
+ throw new TypeError("visitor must be a function");
305
+ function c(g) {
306
+ if (g === null) return "";
307
+ if (u.isDate(g))
308
+ return g.toISOString();
309
+ if (!l && u.isBlob(g))
310
+ throw new w("Blob is not supported. Use a Buffer instead.");
311
+ return u.isArrayBuffer(g) || u.isTypedArray(g) ? l && typeof Blob == "function" ? new Blob([g]) : Buffer.from(g) : g;
312
+ }
313
+ function d(g, k, _) {
314
+ let A = g;
315
+ if (g && !_ && typeof g == "object") {
316
+ if (u.endsWith(k, "{}"))
317
+ k = n ? k : k.slice(0, -2), g = JSON.stringify(g);
318
+ else if (u.isArray(g) && fn(g) || (u.isFileList(g) || u.endsWith(k, "[]")) && (A = u.toArray(g)))
319
+ return k = er(k), A.forEach(function(j, J) {
320
+ !(u.isUndefined(j) || j === null) && e.append(
321
+ // eslint-disable-next-line no-nested-ternary
322
+ a === !0 ? At([k], J, i) : a === null ? k : k + "[]",
323
+ c(j)
324
+ );
325
+ }), !1;
326
+ }
327
+ return ht(g) ? !0 : (e.append(At(_, k, i), c(g)), !1);
328
+ }
329
+ const p = [], S = Object.assign(hn, {
330
+ defaultVisitor: d,
331
+ convertValue: c,
332
+ isVisitable: ht
333
+ });
334
+ function R(g, k) {
335
+ if (!u.isUndefined(g)) {
336
+ if (p.indexOf(g) !== -1)
337
+ throw Error("Circular reference detected in " + k.join("."));
338
+ p.push(g), u.forEach(g, function(A, N) {
339
+ (!(u.isUndefined(A) || A === null) && s.call(
340
+ e,
341
+ A,
342
+ u.isString(N) ? N.trim() : N,
343
+ k,
344
+ S
345
+ )) === !0 && R(A, k ? k.concat(N) : [N]);
346
+ }), p.pop();
347
+ }
348
+ }
349
+ if (!u.isObject(t))
350
+ throw new TypeError("data must be an object");
351
+ return R(t), e;
352
+ }
353
+ function Ct(t) {
354
+ const e = {
355
+ "!": "%21",
356
+ "'": "%27",
357
+ "(": "%28",
358
+ ")": "%29",
359
+ "~": "%7E",
360
+ "%20": "+",
361
+ "%00": "\0"
362
+ };
363
+ return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(n) {
364
+ return e[n];
365
+ });
366
+ }
367
+ function kt(t, e) {
368
+ this._pairs = [], t && st(t, this, e);
369
+ }
370
+ const tr = kt.prototype;
371
+ tr.append = function(e, r) {
372
+ this._pairs.push([e, r]);
373
+ };
374
+ tr.toString = function(e) {
375
+ const r = e ? function(n) {
376
+ return e.call(this, n, Ct);
377
+ } : Ct;
378
+ return this._pairs.map(function(s) {
379
+ return r(s[0]) + "=" + r(s[1]);
380
+ }, "").join("&");
381
+ };
382
+ function pn(t) {
383
+ return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
384
+ }
385
+ function rr(t, e, r) {
386
+ if (!e)
387
+ return t;
388
+ const n = r && r.encode || pn;
389
+ u.isFunction(r) && (r = {
390
+ serialize: r
391
+ });
392
+ const s = r && r.serialize;
393
+ let i;
394
+ if (s ? i = s(e, r) : i = u.isURLSearchParams(e) ? e.toString() : new kt(e, r).toString(n), i) {
395
+ const a = t.indexOf("#");
396
+ a !== -1 && (t = t.slice(0, a)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
397
+ }
398
+ return t;
399
+ }
400
+ class Nt {
401
+ constructor() {
402
+ this.handlers = [];
403
+ }
404
+ /**
405
+ * Add a new interceptor to the stack
406
+ *
407
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
408
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
409
+ *
410
+ * @return {Number} An ID used to remove interceptor later
411
+ */
412
+ use(e, r, n) {
413
+ return this.handlers.push({
414
+ fulfilled: e,
415
+ rejected: r,
416
+ synchronous: n ? n.synchronous : !1,
417
+ runWhen: n ? n.runWhen : null
418
+ }), this.handlers.length - 1;
419
+ }
420
+ /**
421
+ * Remove an interceptor from the stack
422
+ *
423
+ * @param {Number} id The ID that was returned by `use`
424
+ *
425
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
426
+ */
427
+ eject(e) {
428
+ this.handlers[e] && (this.handlers[e] = null);
429
+ }
430
+ /**
431
+ * Clear all interceptors from the stack
432
+ *
433
+ * @returns {void}
434
+ */
435
+ clear() {
436
+ this.handlers && (this.handlers = []);
437
+ }
438
+ /**
439
+ * Iterate over all the registered interceptors
440
+ *
441
+ * This method is particularly useful for skipping over any
442
+ * interceptors that may have become `null` calling `eject`.
443
+ *
444
+ * @param {Function} fn The function to call for each interceptor
445
+ *
446
+ * @returns {void}
447
+ */
448
+ forEach(e) {
449
+ u.forEach(this.handlers, function(n) {
450
+ n !== null && e(n);
451
+ });
452
+ }
453
+ }
454
+ const nr = {
455
+ silentJSONParsing: !0,
456
+ forcedJSONParsing: !0,
457
+ clarifyTimeoutError: !1
458
+ }, mn = typeof URLSearchParams < "u" ? URLSearchParams : kt, yn = typeof FormData < "u" ? FormData : null, gn = typeof Blob < "u" ? Blob : null, _n = {
459
+ isBrowser: !0,
460
+ classes: {
461
+ URLSearchParams: mn,
462
+ FormData: yn,
463
+ Blob: gn
464
+ },
465
+ protocols: ["http", "https", "file", "blob", "url", "data"]
466
+ }, Et = typeof window < "u" && typeof document < "u", pt = typeof navigator == "object" && navigator || void 0, vn = Et && (!pt || ["ReactNative", "NativeScript", "NS"].indexOf(pt.product) < 0), bn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
467
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", wn = Et && window.location.href || "http://localhost", xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
468
+ __proto__: null,
469
+ hasBrowserEnv: Et,
470
+ hasStandardBrowserEnv: vn,
471
+ hasStandardBrowserWebWorkerEnv: bn,
472
+ navigator: pt,
473
+ origin: wn
474
+ }, Symbol.toStringTag, { value: "Module" })), P = {
475
+ ...xn,
476
+ ..._n
477
+ };
478
+ function kn(t, e) {
479
+ return st(t, new P.classes.URLSearchParams(), Object.assign({
480
+ visitor: function(r, n, s, i) {
481
+ return P.isNode && u.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
482
+ }
483
+ }, e));
484
+ }
485
+ function En(t) {
486
+ return u.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
487
+ }
488
+ function Tn(t) {
489
+ const e = {}, r = Object.keys(t);
490
+ let n;
491
+ const s = r.length;
492
+ let i;
493
+ for (n = 0; n < s; n++)
494
+ i = r[n], e[i] = t[i];
495
+ return e;
496
+ }
497
+ function sr(t) {
498
+ function e(r, n, s, i) {
499
+ let a = r[i++];
500
+ if (a === "__proto__") return !0;
501
+ const o = Number.isFinite(+a), l = i >= r.length;
502
+ return a = !a && u.isArray(s) ? s.length : a, l ? (u.hasOwnProp(s, a) ? s[a] = [s[a], n] : s[a] = n, !o) : ((!s[a] || !u.isObject(s[a])) && (s[a] = []), e(r, n, s[a], i) && u.isArray(s[a]) && (s[a] = Tn(s[a])), !o);
503
+ }
504
+ if (u.isFormData(t) && u.isFunction(t.entries)) {
505
+ const r = {};
506
+ return u.forEachEntry(t, (n, s) => {
507
+ e(En(n), s, r, 0);
508
+ }), r;
509
+ }
510
+ return null;
511
+ }
512
+ function Sn(t, e, r) {
513
+ if (u.isString(t))
514
+ try {
515
+ return (e || JSON.parse)(t), u.trim(t);
516
+ } catch (n) {
517
+ if (n.name !== "SyntaxError")
518
+ throw n;
519
+ }
520
+ return (r || JSON.stringify)(t);
521
+ }
522
+ const Ue = {
523
+ transitional: nr,
524
+ adapter: ["xhr", "http", "fetch"],
525
+ transformRequest: [function(e, r) {
526
+ const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, i = u.isObject(e);
527
+ if (i && u.isHTMLForm(e) && (e = new FormData(e)), u.isFormData(e))
528
+ return s ? JSON.stringify(sr(e)) : e;
529
+ if (u.isArrayBuffer(e) || u.isBuffer(e) || u.isStream(e) || u.isFile(e) || u.isBlob(e) || u.isReadableStream(e))
530
+ return e;
531
+ if (u.isArrayBufferView(e))
532
+ return e.buffer;
533
+ if (u.isURLSearchParams(e))
534
+ return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
535
+ let o;
536
+ if (i) {
537
+ if (n.indexOf("application/x-www-form-urlencoded") > -1)
538
+ return kn(e, this.formSerializer).toString();
539
+ if ((o = u.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
540
+ const l = this.env && this.env.FormData;
541
+ return st(
542
+ o ? { "files[]": e } : e,
543
+ l && new l(),
544
+ this.formSerializer
545
+ );
546
+ }
547
+ }
548
+ return i || s ? (r.setContentType("application/json", !1), Sn(e)) : e;
549
+ }],
550
+ transformResponse: [function(e) {
551
+ const r = this.transitional || Ue.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
552
+ if (u.isResponse(e) || u.isReadableStream(e))
553
+ return e;
554
+ if (e && u.isString(e) && (n && !this.responseType || s)) {
555
+ const a = !(r && r.silentJSONParsing) && s;
556
+ try {
557
+ return JSON.parse(e);
558
+ } catch (o) {
559
+ if (a)
560
+ throw o.name === "SyntaxError" ? w.from(o, w.ERR_BAD_RESPONSE, this, null, this.response) : o;
561
+ }
562
+ }
563
+ return e;
564
+ }],
565
+ /**
566
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
567
+ * timeout is not created.
568
+ */
569
+ timeout: 0,
570
+ xsrfCookieName: "XSRF-TOKEN",
571
+ xsrfHeaderName: "X-XSRF-TOKEN",
572
+ maxContentLength: -1,
573
+ maxBodyLength: -1,
574
+ env: {
575
+ FormData: P.classes.FormData,
576
+ Blob: P.classes.Blob
577
+ },
578
+ validateStatus: function(e) {
579
+ return e >= 200 && e < 300;
580
+ },
581
+ headers: {
582
+ common: {
583
+ Accept: "application/json, text/plain, */*",
584
+ "Content-Type": void 0
585
+ }
586
+ }
587
+ };
588
+ u.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
589
+ Ue.headers[t] = {};
590
+ });
591
+ const Rn = u.toObjectSet([
592
+ "age",
593
+ "authorization",
594
+ "content-length",
595
+ "content-type",
596
+ "etag",
597
+ "expires",
598
+ "from",
599
+ "host",
600
+ "if-modified-since",
601
+ "if-unmodified-since",
602
+ "last-modified",
603
+ "location",
604
+ "max-forwards",
605
+ "proxy-authorization",
606
+ "referer",
607
+ "retry-after",
608
+ "user-agent"
609
+ ]), On = (t) => {
610
+ const e = {};
611
+ let r, n, s;
612
+ return t && t.split(`
613
+ `).forEach(function(a) {
614
+ s = a.indexOf(":"), r = a.substring(0, s).trim().toLowerCase(), n = a.substring(s + 1).trim(), !(!r || e[r] && Rn[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n);
615
+ }), e;
616
+ }, jt = Symbol("internals");
617
+ function be(t) {
618
+ return t && String(t).trim().toLowerCase();
619
+ }
620
+ function $e(t) {
621
+ return t === !1 || t == null ? t : u.isArray(t) ? t.map($e) : String(t);
622
+ }
623
+ function An(t) {
624
+ const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
625
+ let n;
626
+ for (; n = r.exec(t); )
627
+ e[n[1]] = n[2];
628
+ return e;
629
+ }
630
+ const Cn = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
631
+ function ct(t, e, r, n, s) {
632
+ if (u.isFunction(n))
633
+ return n.call(this, e, r);
634
+ if (s && (e = r), !!u.isString(e)) {
635
+ if (u.isString(n))
636
+ return e.indexOf(n) !== -1;
637
+ if (u.isRegExp(n))
638
+ return n.test(e);
639
+ }
640
+ }
641
+ function Nn(t) {
642
+ return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n);
643
+ }
644
+ function jn(t, e) {
645
+ const r = u.toCamelCase(" " + e);
646
+ ["get", "set", "has"].forEach((n) => {
647
+ Object.defineProperty(t, n + r, {
648
+ value: function(s, i, a) {
649
+ return this[n].call(this, e, s, i, a);
650
+ },
651
+ configurable: !0
652
+ });
653
+ });
654
+ }
655
+ let U = class {
656
+ constructor(e) {
657
+ e && this.set(e);
658
+ }
659
+ set(e, r, n) {
660
+ const s = this;
661
+ function i(o, l, c) {
662
+ const d = be(l);
663
+ if (!d)
664
+ throw new Error("header name must be a non-empty string");
665
+ const p = u.findKey(s, d);
666
+ (!p || s[p] === void 0 || c === !0 || c === void 0 && s[p] !== !1) && (s[p || l] = $e(o));
667
+ }
668
+ const a = (o, l) => u.forEach(o, (c, d) => i(c, d, l));
669
+ if (u.isPlainObject(e) || e instanceof this.constructor)
670
+ a(e, r);
671
+ else if (u.isString(e) && (e = e.trim()) && !Cn(e))
672
+ a(On(e), r);
673
+ else if (u.isObject(e) && u.isIterable(e)) {
674
+ let o = {}, l, c;
675
+ for (const d of e) {
676
+ if (!u.isArray(d))
677
+ throw TypeError("Object iterator must return a key-value pair");
678
+ o[c = d[0]] = (l = o[c]) ? u.isArray(l) ? [...l, d[1]] : [l, d[1]] : d[1];
679
+ }
680
+ a(o, r);
681
+ } else
682
+ e != null && i(r, e, n);
683
+ return this;
684
+ }
685
+ get(e, r) {
686
+ if (e = be(e), e) {
687
+ const n = u.findKey(this, e);
688
+ if (n) {
689
+ const s = this[n];
690
+ if (!r)
691
+ return s;
692
+ if (r === !0)
693
+ return An(s);
694
+ if (u.isFunction(r))
695
+ return r.call(this, s, n);
696
+ if (u.isRegExp(r))
697
+ return r.exec(s);
698
+ throw new TypeError("parser must be boolean|regexp|function");
699
+ }
700
+ }
701
+ }
702
+ has(e, r) {
703
+ if (e = be(e), e) {
704
+ const n = u.findKey(this, e);
705
+ return !!(n && this[n] !== void 0 && (!r || ct(this, this[n], n, r)));
706
+ }
707
+ return !1;
708
+ }
709
+ delete(e, r) {
710
+ const n = this;
711
+ let s = !1;
712
+ function i(a) {
713
+ if (a = be(a), a) {
714
+ const o = u.findKey(n, a);
715
+ o && (!r || ct(n, n[o], o, r)) && (delete n[o], s = !0);
716
+ }
717
+ }
718
+ return u.isArray(e) ? e.forEach(i) : i(e), s;
719
+ }
720
+ clear(e) {
721
+ const r = Object.keys(this);
722
+ let n = r.length, s = !1;
723
+ for (; n--; ) {
724
+ const i = r[n];
725
+ (!e || ct(this, this[i], i, e, !0)) && (delete this[i], s = !0);
726
+ }
727
+ return s;
728
+ }
729
+ normalize(e) {
730
+ const r = this, n = {};
731
+ return u.forEach(this, (s, i) => {
732
+ const a = u.findKey(n, i);
733
+ if (a) {
734
+ r[a] = $e(s), delete r[i];
735
+ return;
736
+ }
737
+ const o = e ? Nn(i) : String(i).trim();
738
+ o !== i && delete r[i], r[o] = $e(s), n[o] = !0;
739
+ }), this;
740
+ }
741
+ concat(...e) {
742
+ return this.constructor.concat(this, ...e);
743
+ }
744
+ toJSON(e) {
745
+ const r = /* @__PURE__ */ Object.create(null);
746
+ return u.forEach(this, (n, s) => {
747
+ n != null && n !== !1 && (r[s] = e && u.isArray(n) ? n.join(", ") : n);
748
+ }), r;
749
+ }
750
+ [Symbol.iterator]() {
751
+ return Object.entries(this.toJSON())[Symbol.iterator]();
752
+ }
753
+ toString() {
754
+ return Object.entries(this.toJSON()).map(([e, r]) => e + ": " + r).join(`
755
+ `);
756
+ }
757
+ getSetCookie() {
758
+ return this.get("set-cookie") || [];
759
+ }
760
+ get [Symbol.toStringTag]() {
761
+ return "AxiosHeaders";
762
+ }
763
+ static from(e) {
764
+ return e instanceof this ? e : new this(e);
765
+ }
766
+ static concat(e, ...r) {
767
+ const n = new this(e);
768
+ return r.forEach((s) => n.set(s)), n;
769
+ }
770
+ static accessor(e) {
771
+ const n = (this[jt] = this[jt] = {
772
+ accessors: {}
773
+ }).accessors, s = this.prototype;
774
+ function i(a) {
775
+ const o = be(a);
776
+ n[o] || (jn(s, a), n[o] = !0);
777
+ }
778
+ return u.isArray(e) ? e.forEach(i) : i(e), this;
779
+ }
780
+ };
781
+ U.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
782
+ u.reduceDescriptors(U.prototype, ({ value: t }, e) => {
783
+ let r = e[0].toUpperCase() + e.slice(1);
784
+ return {
785
+ get: () => t,
786
+ set(n) {
787
+ this[r] = n;
788
+ }
789
+ };
790
+ });
791
+ u.freezeMethods(U);
792
+ function ut(t, e) {
793
+ const r = this || Ue, n = e || r, s = U.from(n.headers);
794
+ let i = n.data;
795
+ return u.forEach(t, function(o) {
796
+ i = o.call(r, i, s.normalize(), e ? e.status : void 0);
797
+ }), s.normalize(), i;
798
+ }
799
+ function ir(t) {
800
+ return !!(t && t.__CANCEL__);
801
+ }
802
+ function ve(t, e, r) {
803
+ w.call(this, t ?? "canceled", w.ERR_CANCELED, e, r), this.name = "CanceledError";
804
+ }
805
+ u.inherits(ve, w, {
806
+ __CANCEL__: !0
807
+ });
808
+ function ar(t, e, r) {
809
+ const n = r.config.validateStatus;
810
+ !r.status || !n || n(r.status) ? t(r) : e(new w(
811
+ "Request failed with status code " + r.status,
812
+ [w.ERR_BAD_REQUEST, w.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
813
+ r.config,
814
+ r.request,
815
+ r
816
+ ));
817
+ }
818
+ function Pn(t) {
819
+ const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
820
+ return e && e[1] || "";
821
+ }
822
+ function Zn(t, e) {
823
+ t = t || 10;
824
+ const r = new Array(t), n = new Array(t);
825
+ let s = 0, i = 0, a;
826
+ return e = e !== void 0 ? e : 1e3, function(l) {
827
+ const c = Date.now(), d = n[i];
828
+ a || (a = c), r[s] = l, n[s] = c;
829
+ let p = i, S = 0;
830
+ for (; p !== s; )
831
+ S += r[p++], p = p % t;
832
+ if (s = (s + 1) % t, s === i && (i = (i + 1) % t), c - a < e)
833
+ return;
834
+ const R = d && c - d;
835
+ return R ? Math.round(S * 1e3 / R) : void 0;
836
+ };
837
+ }
838
+ function In(t, e) {
839
+ let r = 0, n = 1e3 / e, s, i;
840
+ const a = (c, d = Date.now()) => {
841
+ r = d, s = null, i && (clearTimeout(i), i = null), t.apply(null, c);
842
+ };
843
+ return [(...c) => {
844
+ const d = Date.now(), p = d - r;
845
+ p >= n ? a(c, d) : (s = c, i || (i = setTimeout(() => {
846
+ i = null, a(s);
847
+ }, n - p)));
848
+ }, () => s && a(s)];
849
+ }
850
+ const ze = (t, e, r = 3) => {
851
+ let n = 0;
852
+ const s = Zn(50, 250);
853
+ return In((i) => {
854
+ const a = i.loaded, o = i.lengthComputable ? i.total : void 0, l = a - n, c = s(l), d = a <= o;
855
+ n = a;
856
+ const p = {
857
+ loaded: a,
858
+ total: o,
859
+ progress: o ? a / o : void 0,
860
+ bytes: l,
861
+ rate: c || void 0,
862
+ estimated: c && o && d ? (o - a) / c : void 0,
863
+ event: i,
864
+ lengthComputable: o != null,
865
+ [e ? "download" : "upload"]: !0
866
+ };
867
+ t(p);
868
+ }, r);
869
+ }, Pt = (t, e) => {
870
+ const r = t != null;
871
+ return [(n) => e[0]({
872
+ lengthComputable: r,
873
+ total: t,
874
+ loaded: n
875
+ }), e[1]];
876
+ }, Zt = (t) => (...e) => u.asap(() => t(...e)), Dn = P.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, P.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))(
877
+ new URL(P.origin),
878
+ P.navigator && /(msie|trident)/i.test(P.navigator.userAgent)
879
+ ) : () => !0, Ln = P.hasStandardBrowserEnv ? (
880
+ // Standard browser envs support document.cookie
881
+ {
882
+ write(t, e, r, n, s, i) {
883
+ const a = [t + "=" + encodeURIComponent(e)];
884
+ u.isNumber(r) && a.push("expires=" + new Date(r).toGMTString()), u.isString(n) && a.push("path=" + n), u.isString(s) && a.push("domain=" + s), i === !0 && a.push("secure"), document.cookie = a.join("; ");
885
+ },
886
+ read(t) {
887
+ const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
888
+ return e ? decodeURIComponent(e[3]) : null;
889
+ },
890
+ remove(t) {
891
+ this.write(t, "", Date.now() - 864e5);
892
+ }
893
+ }
894
+ ) : (
895
+ // Non-standard browser env (web workers, react-native) lack needed support.
896
+ {
897
+ write() {
898
+ },
899
+ read() {
900
+ return null;
901
+ },
902
+ remove() {
903
+ }
904
+ }
905
+ );
906
+ function Un(t) {
907
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
908
+ }
909
+ function Fn(t, e) {
910
+ return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
911
+ }
912
+ function or(t, e, r) {
913
+ let n = !Un(e);
914
+ return t && (n || r == !1) ? Fn(t, e) : e;
915
+ }
916
+ const It = (t) => t instanceof U ? { ...t } : t;
917
+ function oe(t, e) {
918
+ e = e || {};
919
+ const r = {};
920
+ function n(c, d, p, S) {
921
+ return u.isPlainObject(c) && u.isPlainObject(d) ? u.merge.call({ caseless: S }, c, d) : u.isPlainObject(d) ? u.merge({}, d) : u.isArray(d) ? d.slice() : d;
922
+ }
923
+ function s(c, d, p, S) {
924
+ if (u.isUndefined(d)) {
925
+ if (!u.isUndefined(c))
926
+ return n(void 0, c, p, S);
927
+ } else return n(c, d, p, S);
928
+ }
929
+ function i(c, d) {
930
+ if (!u.isUndefined(d))
931
+ return n(void 0, d);
932
+ }
933
+ function a(c, d) {
934
+ if (u.isUndefined(d)) {
935
+ if (!u.isUndefined(c))
936
+ return n(void 0, c);
937
+ } else return n(void 0, d);
938
+ }
939
+ function o(c, d, p) {
940
+ if (p in e)
941
+ return n(c, d);
942
+ if (p in t)
943
+ return n(void 0, c);
944
+ }
945
+ const l = {
946
+ url: i,
947
+ method: i,
948
+ data: i,
949
+ baseURL: a,
950
+ transformRequest: a,
951
+ transformResponse: a,
952
+ paramsSerializer: a,
953
+ timeout: a,
954
+ timeoutMessage: a,
955
+ withCredentials: a,
956
+ withXSRFToken: a,
957
+ adapter: a,
958
+ responseType: a,
959
+ xsrfCookieName: a,
960
+ xsrfHeaderName: a,
961
+ onUploadProgress: a,
962
+ onDownloadProgress: a,
963
+ decompress: a,
964
+ maxContentLength: a,
965
+ maxBodyLength: a,
966
+ beforeRedirect: a,
967
+ transport: a,
968
+ httpAgent: a,
969
+ httpsAgent: a,
970
+ cancelToken: a,
971
+ socketPath: a,
972
+ responseEncoding: a,
973
+ validateStatus: o,
974
+ headers: (c, d, p) => s(It(c), It(d), p, !0)
975
+ };
976
+ return u.forEach(Object.keys(Object.assign({}, t, e)), function(d) {
977
+ const p = l[d] || s, S = p(t[d], e[d], d);
978
+ u.isUndefined(S) && p !== o || (r[d] = S);
979
+ }), r;
980
+ }
981
+ const cr = (t) => {
982
+ const e = oe({}, t);
983
+ let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: i, headers: a, auth: o } = e;
984
+ e.headers = a = U.from(a), e.url = rr(or(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), o && a.set(
985
+ "Authorization",
986
+ "Basic " + btoa((o.username || "") + ":" + (o.password ? unescape(encodeURIComponent(o.password)) : ""))
987
+ );
988
+ let l;
989
+ if (u.isFormData(r)) {
990
+ if (P.hasStandardBrowserEnv || P.hasStandardBrowserWebWorkerEnv)
991
+ a.setContentType(void 0);
992
+ else if ((l = a.getContentType()) !== !1) {
993
+ const [c, ...d] = l ? l.split(";").map((p) => p.trim()).filter(Boolean) : [];
994
+ a.setContentType([c || "multipart/form-data", ...d].join("; "));
995
+ }
996
+ }
997
+ if (P.hasStandardBrowserEnv && (n && u.isFunction(n) && (n = n(e)), n || n !== !1 && Dn(e.url))) {
998
+ const c = s && i && Ln.read(i);
999
+ c && a.set(s, c);
1000
+ }
1001
+ return e;
1002
+ }, Mn = typeof XMLHttpRequest < "u", Bn = Mn && function(t) {
1003
+ return new Promise(function(r, n) {
1004
+ const s = cr(t);
1005
+ let i = s.data;
1006
+ const a = U.from(s.headers).normalize();
1007
+ let { responseType: o, onUploadProgress: l, onDownloadProgress: c } = s, d, p, S, R, g;
1008
+ function k() {
1009
+ R && R(), g && g(), s.cancelToken && s.cancelToken.unsubscribe(d), s.signal && s.signal.removeEventListener("abort", d);
1010
+ }
1011
+ let _ = new XMLHttpRequest();
1012
+ _.open(s.method.toUpperCase(), s.url, !0), _.timeout = s.timeout;
1013
+ function A() {
1014
+ if (!_)
1015
+ return;
1016
+ const j = U.from(
1017
+ "getAllResponseHeaders" in _ && _.getAllResponseHeaders()
1018
+ ), D = {
1019
+ data: !o || o === "text" || o === "json" ? _.responseText : _.response,
1020
+ status: _.status,
1021
+ statusText: _.statusText,
1022
+ headers: j,
1023
+ config: t,
1024
+ request: _
1025
+ };
1026
+ ar(function(ne) {
1027
+ r(ne), k();
1028
+ }, function(ne) {
1029
+ n(ne), k();
1030
+ }, D), _ = null;
1031
+ }
1032
+ "onloadend" in _ ? _.onloadend = A : _.onreadystatechange = function() {
1033
+ !_ || _.readyState !== 4 || _.status === 0 && !(_.responseURL && _.responseURL.indexOf("file:") === 0) || setTimeout(A);
1034
+ }, _.onabort = function() {
1035
+ _ && (n(new w("Request aborted", w.ECONNABORTED, t, _)), _ = null);
1036
+ }, _.onerror = function() {
1037
+ n(new w("Network Error", w.ERR_NETWORK, t, _)), _ = null;
1038
+ }, _.ontimeout = function() {
1039
+ let J = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1040
+ const D = s.transitional || nr;
1041
+ s.timeoutErrorMessage && (J = s.timeoutErrorMessage), n(new w(
1042
+ J,
1043
+ D.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
1044
+ t,
1045
+ _
1046
+ )), _ = null;
1047
+ }, i === void 0 && a.setContentType(null), "setRequestHeader" in _ && u.forEach(a.toJSON(), function(J, D) {
1048
+ _.setRequestHeader(D, J);
1049
+ }), u.isUndefined(s.withCredentials) || (_.withCredentials = !!s.withCredentials), o && o !== "json" && (_.responseType = s.responseType), c && ([S, g] = ze(c, !0), _.addEventListener("progress", S)), l && _.upload && ([p, R] = ze(l), _.upload.addEventListener("progress", p), _.upload.addEventListener("loadend", R)), (s.cancelToken || s.signal) && (d = (j) => {
1050
+ _ && (n(!j || j.type ? new ve(null, t, _) : j), _.abort(), _ = null);
1051
+ }, s.cancelToken && s.cancelToken.subscribe(d), s.signal && (s.signal.aborted ? d() : s.signal.addEventListener("abort", d)));
1052
+ const N = Pn(s.url);
1053
+ if (N && P.protocols.indexOf(N) === -1) {
1054
+ n(new w("Unsupported protocol " + N + ":", w.ERR_BAD_REQUEST, t));
1055
+ return;
1056
+ }
1057
+ _.send(i || null);
1058
+ });
1059
+ }, $n = (t, e) => {
1060
+ const { length: r } = t = t ? t.filter(Boolean) : [];
1061
+ if (e || r) {
1062
+ let n = new AbortController(), s;
1063
+ const i = function(c) {
1064
+ if (!s) {
1065
+ s = !0, o();
1066
+ const d = c instanceof Error ? c : this.reason;
1067
+ n.abort(d instanceof w ? d : new ve(d instanceof Error ? d.message : d));
1068
+ }
1069
+ };
1070
+ let a = e && setTimeout(() => {
1071
+ a = null, i(new w(`timeout ${e} of ms exceeded`, w.ETIMEDOUT));
1072
+ }, e);
1073
+ const o = () => {
1074
+ t && (a && clearTimeout(a), a = null, t.forEach((c) => {
1075
+ c.unsubscribe ? c.unsubscribe(i) : c.removeEventListener("abort", i);
1076
+ }), t = null);
1077
+ };
1078
+ t.forEach((c) => c.addEventListener("abort", i));
1079
+ const { signal: l } = n;
1080
+ return l.unsubscribe = () => u.asap(o), l;
1081
+ }
1082
+ }, Vn = function* (t, e) {
1083
+ let r = t.byteLength;
1084
+ if (r < e) {
1085
+ yield t;
1086
+ return;
1087
+ }
1088
+ let n = 0, s;
1089
+ for (; n < r; )
1090
+ s = n + e, yield t.slice(n, s), n = s;
1091
+ }, zn = async function* (t, e) {
1092
+ for await (const r of qn(t))
1093
+ yield* Vn(r, e);
1094
+ }, qn = async function* (t) {
1095
+ if (t[Symbol.asyncIterator]) {
1096
+ yield* t;
1097
+ return;
1098
+ }
1099
+ const e = t.getReader();
1100
+ try {
1101
+ for (; ; ) {
1102
+ const { done: r, value: n } = await e.read();
1103
+ if (r)
1104
+ break;
1105
+ yield n;
1106
+ }
1107
+ } finally {
1108
+ await e.cancel();
1109
+ }
1110
+ }, Dt = (t, e, r, n) => {
1111
+ const s = zn(t, e);
1112
+ let i = 0, a, o = (l) => {
1113
+ a || (a = !0, n && n(l));
1114
+ };
1115
+ return new ReadableStream({
1116
+ async pull(l) {
1117
+ try {
1118
+ const { done: c, value: d } = await s.next();
1119
+ if (c) {
1120
+ o(), l.close();
1121
+ return;
1122
+ }
1123
+ let p = d.byteLength;
1124
+ if (r) {
1125
+ let S = i += p;
1126
+ r(S);
1127
+ }
1128
+ l.enqueue(new Uint8Array(d));
1129
+ } catch (c) {
1130
+ throw o(c), c;
1131
+ }
1132
+ },
1133
+ cancel(l) {
1134
+ return o(l), s.return();
1135
+ }
1136
+ }, {
1137
+ highWaterMark: 2
1138
+ });
1139
+ }, it = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", ur = it && typeof ReadableStream == "function", Hn = it && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), lr = (t, ...e) => {
1140
+ try {
1141
+ return !!t(...e);
1142
+ } catch {
1143
+ return !1;
1144
+ }
1145
+ }, Wn = ur && lr(() => {
1146
+ let t = !1;
1147
+ const e = new Request(P.origin, {
1148
+ body: new ReadableStream(),
1149
+ method: "POST",
1150
+ get duplex() {
1151
+ return t = !0, "half";
1152
+ }
1153
+ }).headers.has("Content-Type");
1154
+ return t && !e;
1155
+ }), Lt = 64 * 1024, mt = ur && lr(() => u.isReadableStream(new Response("").body)), qe = {
1156
+ stream: mt && ((t) => t.body)
1157
+ };
1158
+ it && ((t) => {
1159
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
1160
+ !qe[e] && (qe[e] = u.isFunction(t[e]) ? (r) => r[e]() : (r, n) => {
1161
+ throw new w(`Response type '${e}' is not supported`, w.ERR_NOT_SUPPORT, n);
1162
+ });
1163
+ });
1164
+ })(new Response());
1165
+ const Jn = async (t) => {
1166
+ if (t == null)
1167
+ return 0;
1168
+ if (u.isBlob(t))
1169
+ return t.size;
1170
+ if (u.isSpecCompliantForm(t))
1171
+ return (await new Request(P.origin, {
1172
+ method: "POST",
1173
+ body: t
1174
+ }).arrayBuffer()).byteLength;
1175
+ if (u.isArrayBufferView(t) || u.isArrayBuffer(t))
1176
+ return t.byteLength;
1177
+ if (u.isURLSearchParams(t) && (t = t + ""), u.isString(t))
1178
+ return (await Hn(t)).byteLength;
1179
+ }, Kn = async (t, e) => {
1180
+ const r = u.toFiniteNumber(t.getContentLength());
1181
+ return r ?? Jn(e);
1182
+ }, Xn = it && (async (t) => {
1183
+ let {
1184
+ url: e,
1185
+ method: r,
1186
+ data: n,
1187
+ signal: s,
1188
+ cancelToken: i,
1189
+ timeout: a,
1190
+ onDownloadProgress: o,
1191
+ onUploadProgress: l,
1192
+ responseType: c,
1193
+ headers: d,
1194
+ withCredentials: p = "same-origin",
1195
+ fetchOptions: S
1196
+ } = cr(t);
1197
+ c = c ? (c + "").toLowerCase() : "text";
1198
+ let R = $n([s, i && i.toAbortSignal()], a), g;
1199
+ const k = R && R.unsubscribe && (() => {
1200
+ R.unsubscribe();
1201
+ });
1202
+ let _;
1203
+ try {
1204
+ if (l && Wn && r !== "get" && r !== "head" && (_ = await Kn(d, n)) !== 0) {
1205
+ let D = new Request(e, {
1206
+ method: "POST",
1207
+ body: n,
1208
+ duplex: "half"
1209
+ }), Y;
1210
+ if (u.isFormData(n) && (Y = D.headers.get("content-type")) && d.setContentType(Y), D.body) {
1211
+ const [ne, Me] = Pt(
1212
+ _,
1213
+ ze(Zt(l))
1214
+ );
1215
+ n = Dt(D.body, Lt, ne, Me);
1216
+ }
1217
+ }
1218
+ u.isString(p) || (p = p ? "include" : "omit");
1219
+ const A = "credentials" in Request.prototype;
1220
+ g = new Request(e, {
1221
+ ...S,
1222
+ signal: R,
1223
+ method: r.toUpperCase(),
1224
+ headers: d.normalize().toJSON(),
1225
+ body: n,
1226
+ duplex: "half",
1227
+ credentials: A ? p : void 0
1228
+ });
1229
+ let N = await fetch(g);
1230
+ const j = mt && (c === "stream" || c === "response");
1231
+ if (mt && (o || j && k)) {
1232
+ const D = {};
1233
+ ["status", "statusText", "headers"].forEach((Rt) => {
1234
+ D[Rt] = N[Rt];
1235
+ });
1236
+ const Y = u.toFiniteNumber(N.headers.get("content-length")), [ne, Me] = o && Pt(
1237
+ Y,
1238
+ ze(Zt(o), !0)
1239
+ ) || [];
1240
+ N = new Response(
1241
+ Dt(N.body, Lt, ne, () => {
1242
+ Me && Me(), k && k();
1243
+ }),
1244
+ D
1245
+ );
1246
+ }
1247
+ c = c || "text";
1248
+ let J = await qe[u.findKey(qe, c) || "text"](N, t);
1249
+ return !j && k && k(), await new Promise((D, Y) => {
1250
+ ar(D, Y, {
1251
+ data: J,
1252
+ headers: U.from(N.headers),
1253
+ status: N.status,
1254
+ statusText: N.statusText,
1255
+ config: t,
1256
+ request: g
1257
+ });
1258
+ });
1259
+ } catch (A) {
1260
+ throw k && k(), A && A.name === "TypeError" && /Load failed|fetch/i.test(A.message) ? Object.assign(
1261
+ new w("Network Error", w.ERR_NETWORK, t, g),
1262
+ {
1263
+ cause: A.cause || A
1264
+ }
1265
+ ) : w.from(A, A && A.code, t, g);
1266
+ }
1267
+ }), yt = {
1268
+ http: dn,
1269
+ xhr: Bn,
1270
+ fetch: Xn
1271
+ };
1272
+ u.forEach(yt, (t, e) => {
1273
+ if (t) {
1274
+ try {
1275
+ Object.defineProperty(t, "name", { value: e });
1276
+ } catch {
1277
+ }
1278
+ Object.defineProperty(t, "adapterName", { value: e });
1279
+ }
1280
+ });
1281
+ const Ut = (t) => `- ${t}`, Gn = (t) => u.isFunction(t) || t === null || t === !1, dr = {
1282
+ getAdapter: (t) => {
1283
+ t = u.isArray(t) ? t : [t];
1284
+ const { length: e } = t;
1285
+ let r, n;
1286
+ const s = {};
1287
+ for (let i = 0; i < e; i++) {
1288
+ r = t[i];
1289
+ let a;
1290
+ if (n = r, !Gn(r) && (n = yt[(a = String(r)).toLowerCase()], n === void 0))
1291
+ throw new w(`Unknown adapter '${a}'`);
1292
+ if (n)
1293
+ break;
1294
+ s[a || "#" + i] = n;
1295
+ }
1296
+ if (!n) {
1297
+ const i = Object.entries(s).map(
1298
+ ([o, l]) => `adapter ${o} ` + (l === !1 ? "is not supported by the environment" : "is not available in the build")
1299
+ );
1300
+ let a = e ? i.length > 1 ? `since :
1301
+ ` + i.map(Ut).join(`
1302
+ `) : " " + Ut(i[0]) : "as no adapter specified";
1303
+ throw new w(
1304
+ "There is no suitable adapter to dispatch the request " + a,
1305
+ "ERR_NOT_SUPPORT"
1306
+ );
1307
+ }
1308
+ return n;
1309
+ },
1310
+ adapters: yt
1311
+ };
1312
+ function lt(t) {
1313
+ if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
1314
+ throw new ve(null, t);
1315
+ }
1316
+ function Ft(t) {
1317
+ return lt(t), t.headers = U.from(t.headers), t.data = ut.call(
1318
+ t,
1319
+ t.transformRequest
1320
+ ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), dr.getAdapter(t.adapter || Ue.adapter)(t).then(function(n) {
1321
+ return lt(t), n.data = ut.call(
1322
+ t,
1323
+ t.transformResponse,
1324
+ n
1325
+ ), n.headers = U.from(n.headers), n;
1326
+ }, function(n) {
1327
+ return ir(n) || (lt(t), n && n.response && (n.response.data = ut.call(
1328
+ t,
1329
+ t.transformResponse,
1330
+ n.response
1331
+ ), n.response.headers = U.from(n.response.headers))), Promise.reject(n);
1332
+ });
1333
+ }
1334
+ const fr = "1.9.0", at = {};
1335
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
1336
+ at[t] = function(n) {
1337
+ return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
1338
+ };
1339
+ });
1340
+ const Mt = {};
1341
+ at.transitional = function(e, r, n) {
1342
+ function s(i, a) {
1343
+ return "[Axios v" + fr + "] Transitional option '" + i + "'" + a + (n ? ". " + n : "");
1344
+ }
1345
+ return (i, a, o) => {
1346
+ if (e === !1)
1347
+ throw new w(
1348
+ s(a, " has been removed" + (r ? " in " + r : "")),
1349
+ w.ERR_DEPRECATED
1350
+ );
1351
+ return r && !Mt[a] && (Mt[a] = !0, console.warn(
1352
+ s(
1353
+ a,
1354
+ " has been deprecated since v" + r + " and will be removed in the near future"
1355
+ )
1356
+ )), e ? e(i, a, o) : !0;
1357
+ };
1358
+ };
1359
+ at.spelling = function(e) {
1360
+ return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
1361
+ };
1362
+ function Yn(t, e, r) {
1363
+ if (typeof t != "object")
1364
+ throw new w("options must be an object", w.ERR_BAD_OPTION_VALUE);
1365
+ const n = Object.keys(t);
1366
+ let s = n.length;
1367
+ for (; s-- > 0; ) {
1368
+ const i = n[s], a = e[i];
1369
+ if (a) {
1370
+ const o = t[i], l = o === void 0 || a(o, i, t);
1371
+ if (l !== !0)
1372
+ throw new w("option " + i + " must be " + l, w.ERR_BAD_OPTION_VALUE);
1373
+ continue;
1374
+ }
1375
+ if (r !== !0)
1376
+ throw new w("Unknown option " + i, w.ERR_BAD_OPTION);
1377
+ }
1378
+ }
1379
+ const Ve = {
1380
+ assertOptions: Yn,
1381
+ validators: at
1382
+ }, z = Ve.validators;
1383
+ let ie = class {
1384
+ constructor(e) {
1385
+ this.defaults = e || {}, this.interceptors = {
1386
+ request: new Nt(),
1387
+ response: new Nt()
1388
+ };
1389
+ }
1390
+ /**
1391
+ * Dispatch a request
1392
+ *
1393
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1394
+ * @param {?Object} config
1395
+ *
1396
+ * @returns {Promise} The Promise to be fulfilled
1397
+ */
1398
+ async request(e, r) {
1399
+ try {
1400
+ return await this._request(e, r);
1401
+ } catch (n) {
1402
+ if (n instanceof Error) {
1403
+ let s = {};
1404
+ Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
1405
+ const i = s.stack ? s.stack.replace(/^.+\n/, "") : "";
1406
+ try {
1407
+ n.stack ? i && !String(n.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (n.stack += `
1408
+ ` + i) : n.stack = i;
1409
+ } catch {
1410
+ }
1411
+ }
1412
+ throw n;
1413
+ }
1414
+ }
1415
+ _request(e, r) {
1416
+ typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = oe(this.defaults, r);
1417
+ const { transitional: n, paramsSerializer: s, headers: i } = r;
1418
+ n !== void 0 && Ve.assertOptions(n, {
1419
+ silentJSONParsing: z.transitional(z.boolean),
1420
+ forcedJSONParsing: z.transitional(z.boolean),
1421
+ clarifyTimeoutError: z.transitional(z.boolean)
1422
+ }, !1), s != null && (u.isFunction(s) ? r.paramsSerializer = {
1423
+ serialize: s
1424
+ } : Ve.assertOptions(s, {
1425
+ encode: z.function,
1426
+ serialize: z.function
1427
+ }, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Ve.assertOptions(r, {
1428
+ baseUrl: z.spelling("baseURL"),
1429
+ withXsrfToken: z.spelling("withXSRFToken")
1430
+ }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
1431
+ let a = i && u.merge(
1432
+ i.common,
1433
+ i[r.method]
1434
+ );
1435
+ i && u.forEach(
1436
+ ["delete", "get", "head", "post", "put", "patch", "common"],
1437
+ (g) => {
1438
+ delete i[g];
1439
+ }
1440
+ ), r.headers = U.concat(a, i);
1441
+ const o = [];
1442
+ let l = !0;
1443
+ this.interceptors.request.forEach(function(k) {
1444
+ typeof k.runWhen == "function" && k.runWhen(r) === !1 || (l = l && k.synchronous, o.unshift(k.fulfilled, k.rejected));
1445
+ });
1446
+ const c = [];
1447
+ this.interceptors.response.forEach(function(k) {
1448
+ c.push(k.fulfilled, k.rejected);
1449
+ });
1450
+ let d, p = 0, S;
1451
+ if (!l) {
1452
+ const g = [Ft.bind(this), void 0];
1453
+ for (g.unshift.apply(g, o), g.push.apply(g, c), S = g.length, d = Promise.resolve(r); p < S; )
1454
+ d = d.then(g[p++], g[p++]);
1455
+ return d;
1456
+ }
1457
+ S = o.length;
1458
+ let R = r;
1459
+ for (p = 0; p < S; ) {
1460
+ const g = o[p++], k = o[p++];
1461
+ try {
1462
+ R = g(R);
1463
+ } catch (_) {
1464
+ k.call(this, _);
1465
+ break;
1466
+ }
1467
+ }
1468
+ try {
1469
+ d = Ft.call(this, R);
1470
+ } catch (g) {
1471
+ return Promise.reject(g);
1472
+ }
1473
+ for (p = 0, S = c.length; p < S; )
1474
+ d = d.then(c[p++], c[p++]);
1475
+ return d;
1476
+ }
1477
+ getUri(e) {
1478
+ e = oe(this.defaults, e);
1479
+ const r = or(e.baseURL, e.url, e.allowAbsoluteUrls);
1480
+ return rr(r, e.params, e.paramsSerializer);
1481
+ }
1482
+ };
1483
+ u.forEach(["delete", "get", "head", "options"], function(e) {
1484
+ ie.prototype[e] = function(r, n) {
1485
+ return this.request(oe(n || {}, {
1486
+ method: e,
1487
+ url: r,
1488
+ data: (n || {}).data
1489
+ }));
1490
+ };
1491
+ });
1492
+ u.forEach(["post", "put", "patch"], function(e) {
1493
+ function r(n) {
1494
+ return function(i, a, o) {
1495
+ return this.request(oe(o || {}, {
1496
+ method: e,
1497
+ headers: n ? {
1498
+ "Content-Type": "multipart/form-data"
1499
+ } : {},
1500
+ url: i,
1501
+ data: a
1502
+ }));
1503
+ };
1504
+ }
1505
+ ie.prototype[e] = r(), ie.prototype[e + "Form"] = r(!0);
1506
+ });
1507
+ let Qn = class hr {
1508
+ constructor(e) {
1509
+ if (typeof e != "function")
1510
+ throw new TypeError("executor must be a function.");
1511
+ let r;
1512
+ this.promise = new Promise(function(i) {
1513
+ r = i;
1514
+ });
1515
+ const n = this;
1516
+ this.promise.then((s) => {
1517
+ if (!n._listeners) return;
1518
+ let i = n._listeners.length;
1519
+ for (; i-- > 0; )
1520
+ n._listeners[i](s);
1521
+ n._listeners = null;
1522
+ }), this.promise.then = (s) => {
1523
+ let i;
1524
+ const a = new Promise((o) => {
1525
+ n.subscribe(o), i = o;
1526
+ }).then(s);
1527
+ return a.cancel = function() {
1528
+ n.unsubscribe(i);
1529
+ }, a;
1530
+ }, e(function(i, a, o) {
1531
+ n.reason || (n.reason = new ve(i, a, o), r(n.reason));
1532
+ });
1533
+ }
1534
+ /**
1535
+ * Throws a `CanceledError` if cancellation has been requested.
1536
+ */
1537
+ throwIfRequested() {
1538
+ if (this.reason)
1539
+ throw this.reason;
1540
+ }
1541
+ /**
1542
+ * Subscribe to the cancel signal
1543
+ */
1544
+ subscribe(e) {
1545
+ if (this.reason) {
1546
+ e(this.reason);
1547
+ return;
1548
+ }
1549
+ this._listeners ? this._listeners.push(e) : this._listeners = [e];
1550
+ }
1551
+ /**
1552
+ * Unsubscribe from the cancel signal
1553
+ */
1554
+ unsubscribe(e) {
1555
+ if (!this._listeners)
1556
+ return;
1557
+ const r = this._listeners.indexOf(e);
1558
+ r !== -1 && this._listeners.splice(r, 1);
1559
+ }
1560
+ toAbortSignal() {
1561
+ const e = new AbortController(), r = (n) => {
1562
+ e.abort(n);
1563
+ };
1564
+ return this.subscribe(r), e.signal.unsubscribe = () => this.unsubscribe(r), e.signal;
1565
+ }
1566
+ /**
1567
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
1568
+ * cancels the `CancelToken`.
1569
+ */
1570
+ static source() {
1571
+ let e;
1572
+ return {
1573
+ token: new hr(function(s) {
1574
+ e = s;
1575
+ }),
1576
+ cancel: e
1577
+ };
1578
+ }
1579
+ };
1580
+ function es(t) {
1581
+ return function(r) {
1582
+ return t.apply(null, r);
1583
+ };
1584
+ }
1585
+ function ts(t) {
1586
+ return u.isObject(t) && t.isAxiosError === !0;
1587
+ }
1588
+ const gt = {
1589
+ Continue: 100,
1590
+ SwitchingProtocols: 101,
1591
+ Processing: 102,
1592
+ EarlyHints: 103,
1593
+ Ok: 200,
1594
+ Created: 201,
1595
+ Accepted: 202,
1596
+ NonAuthoritativeInformation: 203,
1597
+ NoContent: 204,
1598
+ ResetContent: 205,
1599
+ PartialContent: 206,
1600
+ MultiStatus: 207,
1601
+ AlreadyReported: 208,
1602
+ ImUsed: 226,
1603
+ MultipleChoices: 300,
1604
+ MovedPermanently: 301,
1605
+ Found: 302,
1606
+ SeeOther: 303,
1607
+ NotModified: 304,
1608
+ UseProxy: 305,
1609
+ Unused: 306,
1610
+ TemporaryRedirect: 307,
1611
+ PermanentRedirect: 308,
1612
+ BadRequest: 400,
1613
+ Unauthorized: 401,
1614
+ PaymentRequired: 402,
1615
+ Forbidden: 403,
1616
+ NotFound: 404,
1617
+ MethodNotAllowed: 405,
1618
+ NotAcceptable: 406,
1619
+ ProxyAuthenticationRequired: 407,
1620
+ RequestTimeout: 408,
1621
+ Conflict: 409,
1622
+ Gone: 410,
1623
+ LengthRequired: 411,
1624
+ PreconditionFailed: 412,
1625
+ PayloadTooLarge: 413,
1626
+ UriTooLong: 414,
1627
+ UnsupportedMediaType: 415,
1628
+ RangeNotSatisfiable: 416,
1629
+ ExpectationFailed: 417,
1630
+ ImATeapot: 418,
1631
+ MisdirectedRequest: 421,
1632
+ UnprocessableEntity: 422,
1633
+ Locked: 423,
1634
+ FailedDependency: 424,
1635
+ TooEarly: 425,
1636
+ UpgradeRequired: 426,
1637
+ PreconditionRequired: 428,
1638
+ TooManyRequests: 429,
1639
+ RequestHeaderFieldsTooLarge: 431,
1640
+ UnavailableForLegalReasons: 451,
1641
+ InternalServerError: 500,
1642
+ NotImplemented: 501,
1643
+ BadGateway: 502,
1644
+ ServiceUnavailable: 503,
1645
+ GatewayTimeout: 504,
1646
+ HttpVersionNotSupported: 505,
1647
+ VariantAlsoNegotiates: 506,
1648
+ InsufficientStorage: 507,
1649
+ LoopDetected: 508,
1650
+ NotExtended: 510,
1651
+ NetworkAuthenticationRequired: 511
1652
+ };
1653
+ Object.entries(gt).forEach(([t, e]) => {
1654
+ gt[e] = t;
1655
+ });
1656
+ function pr(t) {
1657
+ const e = new ie(t), r = zt(ie.prototype.request, e);
1658
+ return u.extend(r, ie.prototype, e, { allOwnKeys: !0 }), u.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(s) {
1659
+ return pr(oe(t, s));
1660
+ }, r;
1661
+ }
1662
+ const C = pr(Ue);
1663
+ C.Axios = ie;
1664
+ C.CanceledError = ve;
1665
+ C.CancelToken = Qn;
1666
+ C.isCancel = ir;
1667
+ C.VERSION = fr;
1668
+ C.toFormData = st;
1669
+ C.AxiosError = w;
1670
+ C.Cancel = C.CanceledError;
1671
+ C.all = function(e) {
1672
+ return Promise.all(e);
1673
+ };
1674
+ C.spread = es;
1675
+ C.isAxiosError = ts;
1676
+ C.mergeConfig = oe;
1677
+ C.AxiosHeaders = U;
1678
+ C.formToJSON = (t) => sr(u.isHTMLForm(t) ? new FormData(t) : t);
1679
+ C.getAdapter = dr.getAdapter;
1680
+ C.HttpStatusCode = gt;
1681
+ C.default = C;
1682
+ const {
1683
+ Axios: gi,
1684
+ AxiosError: rs,
1685
+ CanceledError: _i,
1686
+ isCancel: vi,
1687
+ CancelToken: bi,
1688
+ VERSION: wi,
1689
+ all: xi,
1690
+ Cancel: ki,
1691
+ isAxiosError: Ei,
1692
+ spread: Ti,
1693
+ toFormData: Si,
1694
+ AxiosHeaders: Ri,
1695
+ HttpStatusCode: Tt,
1696
+ formToJSON: Oi,
1697
+ getAdapter: Ai,
1698
+ mergeConfig: Ci
1699
+ } = C;
1700
+ var T;
1701
+ (function(t) {
1702
+ t.assertEqual = (s) => s;
1703
+ function e(s) {
1704
+ }
1705
+ t.assertIs = e;
1706
+ function r(s) {
1707
+ throw new Error();
1708
+ }
1709
+ t.assertNever = r, t.arrayToEnum = (s) => {
1710
+ const i = {};
1711
+ for (const a of s)
1712
+ i[a] = a;
1713
+ return i;
1714
+ }, t.getValidEnumValues = (s) => {
1715
+ const i = t.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), a = {};
1716
+ for (const o of i)
1717
+ a[o] = s[o];
1718
+ return t.objectValues(a);
1719
+ }, t.objectValues = (s) => t.objectKeys(s).map(function(i) {
1720
+ return s[i];
1721
+ }), t.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
1722
+ const i = [];
1723
+ for (const a in s)
1724
+ Object.prototype.hasOwnProperty.call(s, a) && i.push(a);
1725
+ return i;
1726
+ }, t.find = (s, i) => {
1727
+ for (const a of s)
1728
+ if (i(a))
1729
+ return a;
1730
+ }, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
1731
+ function n(s, i = " | ") {
1732
+ return s.map((a) => typeof a == "string" ? `'${a}'` : a).join(i);
1733
+ }
1734
+ t.joinValues = n, t.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
1735
+ })(T || (T = {}));
1736
+ var _t;
1737
+ (function(t) {
1738
+ t.mergeShapes = (e, r) => ({
1739
+ ...e,
1740
+ ...r
1741
+ // second overwrites first
1742
+ });
1743
+ })(_t || (_t = {}));
1744
+ const m = T.arrayToEnum([
1745
+ "string",
1746
+ "nan",
1747
+ "number",
1748
+ "integer",
1749
+ "float",
1750
+ "boolean",
1751
+ "date",
1752
+ "bigint",
1753
+ "symbol",
1754
+ "function",
1755
+ "undefined",
1756
+ "null",
1757
+ "array",
1758
+ "object",
1759
+ "unknown",
1760
+ "promise",
1761
+ "void",
1762
+ "never",
1763
+ "map",
1764
+ "set"
1765
+ ]), X = (t) => {
1766
+ switch (typeof t) {
1767
+ case "undefined":
1768
+ return m.undefined;
1769
+ case "string":
1770
+ return m.string;
1771
+ case "number":
1772
+ return isNaN(t) ? m.nan : m.number;
1773
+ case "boolean":
1774
+ return m.boolean;
1775
+ case "function":
1776
+ return m.function;
1777
+ case "bigint":
1778
+ return m.bigint;
1779
+ case "symbol":
1780
+ return m.symbol;
1781
+ case "object":
1782
+ return Array.isArray(t) ? m.array : t === null ? m.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? m.promise : typeof Map < "u" && t instanceof Map ? m.map : typeof Set < "u" && t instanceof Set ? m.set : typeof Date < "u" && t instanceof Date ? m.date : m.object;
1783
+ default:
1784
+ return m.unknown;
1785
+ }
1786
+ }, f = T.arrayToEnum([
1787
+ "invalid_type",
1788
+ "invalid_literal",
1789
+ "custom",
1790
+ "invalid_union",
1791
+ "invalid_union_discriminator",
1792
+ "invalid_enum_value",
1793
+ "unrecognized_keys",
1794
+ "invalid_arguments",
1795
+ "invalid_return_type",
1796
+ "invalid_date",
1797
+ "invalid_string",
1798
+ "too_small",
1799
+ "too_big",
1800
+ "invalid_intersection_types",
1801
+ "not_multiple_of",
1802
+ "not_finite"
1803
+ ]), ns = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
1804
+ class F extends Error {
1805
+ get errors() {
1806
+ return this.issues;
1807
+ }
1808
+ constructor(e) {
1809
+ super(), this.issues = [], this.addIssue = (n) => {
1810
+ this.issues = [...this.issues, n];
1811
+ }, this.addIssues = (n = []) => {
1812
+ this.issues = [...this.issues, ...n];
1813
+ };
1814
+ const r = new.target.prototype;
1815
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e;
1816
+ }
1817
+ format(e) {
1818
+ const r = e || function(i) {
1819
+ return i.message;
1820
+ }, n = { _errors: [] }, s = (i) => {
1821
+ for (const a of i.issues)
1822
+ if (a.code === "invalid_union")
1823
+ a.unionErrors.map(s);
1824
+ else if (a.code === "invalid_return_type")
1825
+ s(a.returnTypeError);
1826
+ else if (a.code === "invalid_arguments")
1827
+ s(a.argumentsError);
1828
+ else if (a.path.length === 0)
1829
+ n._errors.push(r(a));
1830
+ else {
1831
+ let o = n, l = 0;
1832
+ for (; l < a.path.length; ) {
1833
+ const c = a.path[l];
1834
+ l === a.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(r(a))) : o[c] = o[c] || { _errors: [] }, o = o[c], l++;
1835
+ }
1836
+ }
1837
+ };
1838
+ return s(this), n;
1839
+ }
1840
+ static assert(e) {
1841
+ if (!(e instanceof F))
1842
+ throw new Error(`Not a ZodError: ${e}`);
1843
+ }
1844
+ toString() {
1845
+ return this.message;
1846
+ }
1847
+ get message() {
1848
+ return JSON.stringify(this.issues, T.jsonStringifyReplacer, 2);
1849
+ }
1850
+ get isEmpty() {
1851
+ return this.issues.length === 0;
1852
+ }
1853
+ flatten(e = (r) => r.message) {
1854
+ const r = {}, n = [];
1855
+ for (const s of this.issues)
1856
+ s.path.length > 0 ? (r[s.path[0]] = r[s.path[0]] || [], r[s.path[0]].push(e(s))) : n.push(e(s));
1857
+ return { formErrors: n, fieldErrors: r };
1858
+ }
1859
+ get formErrors() {
1860
+ return this.flatten();
1861
+ }
1862
+ }
1863
+ F.create = (t) => new F(t);
1864
+ const me = (t, e) => {
1865
+ let r;
1866
+ switch (t.code) {
1867
+ case f.invalid_type:
1868
+ t.received === m.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
1869
+ break;
1870
+ case f.invalid_literal:
1871
+ r = `Invalid literal value, expected ${JSON.stringify(t.expected, T.jsonStringifyReplacer)}`;
1872
+ break;
1873
+ case f.unrecognized_keys:
1874
+ r = `Unrecognized key(s) in object: ${T.joinValues(t.keys, ", ")}`;
1875
+ break;
1876
+ case f.invalid_union:
1877
+ r = "Invalid input";
1878
+ break;
1879
+ case f.invalid_union_discriminator:
1880
+ r = `Invalid discriminator value. Expected ${T.joinValues(t.options)}`;
1881
+ break;
1882
+ case f.invalid_enum_value:
1883
+ r = `Invalid enum value. Expected ${T.joinValues(t.options)}, received '${t.received}'`;
1884
+ break;
1885
+ case f.invalid_arguments:
1886
+ r = "Invalid function arguments";
1887
+ break;
1888
+ case f.invalid_return_type:
1889
+ r = "Invalid function return type";
1890
+ break;
1891
+ case f.invalid_date:
1892
+ r = "Invalid date";
1893
+ break;
1894
+ case f.invalid_string:
1895
+ typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : T.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
1896
+ break;
1897
+ case f.too_small:
1898
+ t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
1899
+ break;
1900
+ case f.too_big:
1901
+ t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : r = "Invalid input";
1902
+ break;
1903
+ case f.custom:
1904
+ r = "Invalid input";
1905
+ break;
1906
+ case f.invalid_intersection_types:
1907
+ r = "Intersection results could not be merged";
1908
+ break;
1909
+ case f.not_multiple_of:
1910
+ r = `Number must be a multiple of ${t.multipleOf}`;
1911
+ break;
1912
+ case f.not_finite:
1913
+ r = "Number must be finite";
1914
+ break;
1915
+ default:
1916
+ r = e.defaultError, T.assertNever(t);
1917
+ }
1918
+ return { message: r };
1919
+ };
1920
+ let mr = me;
1921
+ function ss(t) {
1922
+ mr = t;
1923
+ }
1924
+ function He() {
1925
+ return mr;
1926
+ }
1927
+ const We = (t) => {
1928
+ const { data: e, path: r, errorMaps: n, issueData: s } = t, i = [...r, ...s.path || []], a = {
1929
+ ...s,
1930
+ path: i
1931
+ };
1932
+ if (s.message !== void 0)
1933
+ return {
1934
+ ...s,
1935
+ path: i,
1936
+ message: s.message
1937
+ };
1938
+ let o = "";
1939
+ const l = n.filter((c) => !!c).slice().reverse();
1940
+ for (const c of l)
1941
+ o = c(a, { data: e, defaultError: o }).message;
1942
+ return {
1943
+ ...s,
1944
+ path: i,
1945
+ message: o
1946
+ };
1947
+ }, is = [];
1948
+ function h(t, e) {
1949
+ const r = He(), n = We({
1950
+ issueData: e,
1951
+ data: t.data,
1952
+ path: t.path,
1953
+ errorMaps: [
1954
+ t.common.contextualErrorMap,
1955
+ // contextual error map is first priority
1956
+ t.schemaErrorMap,
1957
+ // then schema-bound map if available
1958
+ r,
1959
+ // then global override map
1960
+ r === me ? void 0 : me
1961
+ // then global default map
1962
+ ].filter((s) => !!s)
1963
+ });
1964
+ t.common.issues.push(n);
1965
+ }
1966
+ class Z {
1967
+ constructor() {
1968
+ this.value = "valid";
1969
+ }
1970
+ dirty() {
1971
+ this.value === "valid" && (this.value = "dirty");
1972
+ }
1973
+ abort() {
1974
+ this.value !== "aborted" && (this.value = "aborted");
1975
+ }
1976
+ static mergeArray(e, r) {
1977
+ const n = [];
1978
+ for (const s of r) {
1979
+ if (s.status === "aborted")
1980
+ return b;
1981
+ s.status === "dirty" && e.dirty(), n.push(s.value);
1982
+ }
1983
+ return { status: e.value, value: n };
1984
+ }
1985
+ static async mergeObjectAsync(e, r) {
1986
+ const n = [];
1987
+ for (const s of r) {
1988
+ const i = await s.key, a = await s.value;
1989
+ n.push({
1990
+ key: i,
1991
+ value: a
1992
+ });
1993
+ }
1994
+ return Z.mergeObjectSync(e, n);
1995
+ }
1996
+ static mergeObjectSync(e, r) {
1997
+ const n = {};
1998
+ for (const s of r) {
1999
+ const { key: i, value: a } = s;
2000
+ if (i.status === "aborted" || a.status === "aborted")
2001
+ return b;
2002
+ i.status === "dirty" && e.dirty(), a.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof a.value < "u" || s.alwaysSet) && (n[i.value] = a.value);
2003
+ }
2004
+ return { status: e.value, value: n };
2005
+ }
2006
+ }
2007
+ const b = Object.freeze({
2008
+ status: "aborted"
2009
+ }), he = (t) => ({ status: "dirty", value: t }), I = (t) => ({ status: "valid", value: t }), vt = (t) => t.status === "aborted", bt = (t) => t.status === "dirty", ce = (t) => t.status === "valid", Ee = (t) => typeof Promise < "u" && t instanceof Promise;
2010
+ function Je(t, e, r, n) {
2011
+ if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2012
+ return e.get(t);
2013
+ }
2014
+ function yr(t, e, r, n, s) {
2015
+ if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2016
+ return e.set(t, r), r;
2017
+ }
2018
+ var y;
2019
+ (function(t) {
2020
+ t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
2021
+ })(y || (y = {}));
2022
+ var we, xe;
2023
+ class H {
2024
+ constructor(e, r, n, s) {
2025
+ this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
2026
+ }
2027
+ get path() {
2028
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
2029
+ }
2030
+ }
2031
+ const Bt = (t, e) => {
2032
+ if (ce(e))
2033
+ return { success: !0, data: e.value };
2034
+ if (!t.common.issues.length)
2035
+ throw new Error("Validation failed but no issues detected.");
2036
+ return {
2037
+ success: !1,
2038
+ get error() {
2039
+ if (this._error)
2040
+ return this._error;
2041
+ const r = new F(t.common.issues);
2042
+ return this._error = r, this._error;
2043
+ }
2044
+ };
2045
+ };
2046
+ function x(t) {
2047
+ if (!t)
2048
+ return {};
2049
+ const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
2050
+ if (e && (r || n))
2051
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
2052
+ return e ? { errorMap: e, description: s } : { errorMap: (a, o) => {
2053
+ var l, c;
2054
+ const { message: d } = t;
2055
+ return a.code === "invalid_enum_value" ? { message: d ?? o.defaultError } : typeof o.data > "u" ? { message: (l = d ?? n) !== null && l !== void 0 ? l : o.defaultError } : a.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = d ?? r) !== null && c !== void 0 ? c : o.defaultError };
2056
+ }, description: s };
2057
+ }
2058
+ class E {
2059
+ get description() {
2060
+ return this._def.description;
2061
+ }
2062
+ _getType(e) {
2063
+ return X(e.data);
2064
+ }
2065
+ _getOrReturnCtx(e, r) {
2066
+ return r || {
2067
+ common: e.parent.common,
2068
+ data: e.data,
2069
+ parsedType: X(e.data),
2070
+ schemaErrorMap: this._def.errorMap,
2071
+ path: e.path,
2072
+ parent: e.parent
2073
+ };
2074
+ }
2075
+ _processInputParams(e) {
2076
+ return {
2077
+ status: new Z(),
2078
+ ctx: {
2079
+ common: e.parent.common,
2080
+ data: e.data,
2081
+ parsedType: X(e.data),
2082
+ schemaErrorMap: this._def.errorMap,
2083
+ path: e.path,
2084
+ parent: e.parent
2085
+ }
2086
+ };
2087
+ }
2088
+ _parseSync(e) {
2089
+ const r = this._parse(e);
2090
+ if (Ee(r))
2091
+ throw new Error("Synchronous parse encountered promise.");
2092
+ return r;
2093
+ }
2094
+ _parseAsync(e) {
2095
+ const r = this._parse(e);
2096
+ return Promise.resolve(r);
2097
+ }
2098
+ parse(e, r) {
2099
+ const n = this.safeParse(e, r);
2100
+ if (n.success)
2101
+ return n.data;
2102
+ throw n.error;
2103
+ }
2104
+ safeParse(e, r) {
2105
+ var n;
2106
+ const s = {
2107
+ common: {
2108
+ issues: [],
2109
+ async: (n = r?.async) !== null && n !== void 0 ? n : !1,
2110
+ contextualErrorMap: r?.errorMap
2111
+ },
2112
+ path: r?.path || [],
2113
+ schemaErrorMap: this._def.errorMap,
2114
+ parent: null,
2115
+ data: e,
2116
+ parsedType: X(e)
2117
+ }, i = this._parseSync({ data: e, path: s.path, parent: s });
2118
+ return Bt(s, i);
2119
+ }
2120
+ "~validate"(e) {
2121
+ var r, n;
2122
+ const s = {
2123
+ common: {
2124
+ issues: [],
2125
+ async: !!this["~standard"].async
2126
+ },
2127
+ path: [],
2128
+ schemaErrorMap: this._def.errorMap,
2129
+ parent: null,
2130
+ data: e,
2131
+ parsedType: X(e)
2132
+ };
2133
+ if (!this["~standard"].async)
2134
+ try {
2135
+ const i = this._parseSync({ data: e, path: [], parent: s });
2136
+ return ce(i) ? {
2137
+ value: i.value
2138
+ } : {
2139
+ issues: s.common.issues
2140
+ };
2141
+ } catch (i) {
2142
+ !((n = (r = i?.message) === null || r === void 0 ? void 0 : r.toLowerCase()) === null || n === void 0) && n.includes("encountered") && (this["~standard"].async = !0), s.common = {
2143
+ issues: [],
2144
+ async: !0
2145
+ };
2146
+ }
2147
+ return this._parseAsync({ data: e, path: [], parent: s }).then((i) => ce(i) ? {
2148
+ value: i.value
2149
+ } : {
2150
+ issues: s.common.issues
2151
+ });
2152
+ }
2153
+ async parseAsync(e, r) {
2154
+ const n = await this.safeParseAsync(e, r);
2155
+ if (n.success)
2156
+ return n.data;
2157
+ throw n.error;
2158
+ }
2159
+ async safeParseAsync(e, r) {
2160
+ const n = {
2161
+ common: {
2162
+ issues: [],
2163
+ contextualErrorMap: r?.errorMap,
2164
+ async: !0
2165
+ },
2166
+ path: r?.path || [],
2167
+ schemaErrorMap: this._def.errorMap,
2168
+ parent: null,
2169
+ data: e,
2170
+ parsedType: X(e)
2171
+ }, s = this._parse({ data: e, path: n.path, parent: n }), i = await (Ee(s) ? s : Promise.resolve(s));
2172
+ return Bt(n, i);
2173
+ }
2174
+ refine(e, r) {
2175
+ const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
2176
+ return this._refinement((s, i) => {
2177
+ const a = e(s), o = () => i.addIssue({
2178
+ code: f.custom,
2179
+ ...n(s)
2180
+ });
2181
+ return typeof Promise < "u" && a instanceof Promise ? a.then((l) => l ? !0 : (o(), !1)) : a ? !0 : (o(), !1);
2182
+ });
2183
+ }
2184
+ refinement(e, r) {
2185
+ return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
2186
+ }
2187
+ _refinement(e) {
2188
+ return new $({
2189
+ schema: this,
2190
+ typeName: v.ZodEffects,
2191
+ effect: { type: "refinement", refinement: e }
2192
+ });
2193
+ }
2194
+ superRefine(e) {
2195
+ return this._refinement(e);
2196
+ }
2197
+ constructor(e) {
2198
+ 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"] = {
2199
+ version: 1,
2200
+ vendor: "zod",
2201
+ validate: (r) => this["~validate"](r)
2202
+ };
2203
+ }
2204
+ optional() {
2205
+ return q.create(this, this._def);
2206
+ }
2207
+ nullable() {
2208
+ return re.create(this, this._def);
2209
+ }
2210
+ nullish() {
2211
+ return this.nullable().optional();
2212
+ }
2213
+ array() {
2214
+ return B.create(this);
2215
+ }
2216
+ promise() {
2217
+ return ge.create(this, this._def);
2218
+ }
2219
+ or(e) {
2220
+ return Oe.create([this, e], this._def);
2221
+ }
2222
+ and(e) {
2223
+ return Ae.create(this, e, this._def);
2224
+ }
2225
+ transform(e) {
2226
+ return new $({
2227
+ ...x(this._def),
2228
+ schema: this,
2229
+ typeName: v.ZodEffects,
2230
+ effect: { type: "transform", transform: e }
2231
+ });
2232
+ }
2233
+ default(e) {
2234
+ const r = typeof e == "function" ? e : () => e;
2235
+ return new Ze({
2236
+ ...x(this._def),
2237
+ innerType: this,
2238
+ defaultValue: r,
2239
+ typeName: v.ZodDefault
2240
+ });
2241
+ }
2242
+ brand() {
2243
+ return new St({
2244
+ typeName: v.ZodBranded,
2245
+ type: this,
2246
+ ...x(this._def)
2247
+ });
2248
+ }
2249
+ catch(e) {
2250
+ const r = typeof e == "function" ? e : () => e;
2251
+ return new Ie({
2252
+ ...x(this._def),
2253
+ innerType: this,
2254
+ catchValue: r,
2255
+ typeName: v.ZodCatch
2256
+ });
2257
+ }
2258
+ describe(e) {
2259
+ const r = this.constructor;
2260
+ return new r({
2261
+ ...this._def,
2262
+ description: e
2263
+ });
2264
+ }
2265
+ pipe(e) {
2266
+ return Fe.create(this, e);
2267
+ }
2268
+ readonly() {
2269
+ return De.create(this);
2270
+ }
2271
+ isOptional() {
2272
+ return this.safeParse(void 0).success;
2273
+ }
2274
+ isNullable() {
2275
+ return this.safeParse(null).success;
2276
+ }
2277
+ }
2278
+ const as = /^c[^\s-]{8,}$/i, os = /^[0-9a-z]+$/, cs = /^[0-9A-HJKMNP-TV-Z]{26}$/i, us = /^[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, ls = /^[a-z0-9_-]{21}$/i, ds = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, fs = /^[-+]?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)?)??$/, hs = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ps = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
2279
+ let dt;
2280
+ const ms = /^(?:(?: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])$/, ys = /^(?:(?: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])$/, gs = /^(([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]))$/, _s = /^(([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])$/, vs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, bs = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, gr = "((\\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])))", ws = new RegExp(`^${gr}$`);
2281
+ function _r(t) {
2282
+ let e = "[0-5]\\d";
2283
+ t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
2284
+ const r = t.precision ? "+" : "?";
2285
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
2286
+ }
2287
+ function xs(t) {
2288
+ return new RegExp(`^${_r(t)}$`);
2289
+ }
2290
+ function vr(t) {
2291
+ let e = `${gr}T${_r(t)}`;
2292
+ const r = [];
2293
+ return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
2294
+ }
2295
+ function ks(t, e) {
2296
+ return !!((e === "v4" || !e) && ms.test(t) || (e === "v6" || !e) && gs.test(t));
2297
+ }
2298
+ function Es(t, e) {
2299
+ if (!ds.test(t))
2300
+ return !1;
2301
+ try {
2302
+ const [r] = t.split("."), n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(n));
2303
+ return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
2304
+ } catch {
2305
+ return !1;
2306
+ }
2307
+ }
2308
+ function Ts(t, e) {
2309
+ return !!((e === "v4" || !e) && ys.test(t) || (e === "v6" || !e) && _s.test(t));
2310
+ }
2311
+ class M extends E {
2312
+ _parse(e) {
2313
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
2314
+ const i = this._getOrReturnCtx(e);
2315
+ return h(i, {
2316
+ code: f.invalid_type,
2317
+ expected: m.string,
2318
+ received: i.parsedType
2319
+ }), b;
2320
+ }
2321
+ const n = new Z();
2322
+ let s;
2323
+ for (const i of this._def.checks)
2324
+ if (i.kind === "min")
2325
+ e.data.length < i.value && (s = this._getOrReturnCtx(e, s), h(s, {
2326
+ code: f.too_small,
2327
+ minimum: i.value,
2328
+ type: "string",
2329
+ inclusive: !0,
2330
+ exact: !1,
2331
+ message: i.message
2332
+ }), n.dirty());
2333
+ else if (i.kind === "max")
2334
+ e.data.length > i.value && (s = this._getOrReturnCtx(e, s), h(s, {
2335
+ code: f.too_big,
2336
+ maximum: i.value,
2337
+ type: "string",
2338
+ inclusive: !0,
2339
+ exact: !1,
2340
+ message: i.message
2341
+ }), n.dirty());
2342
+ else if (i.kind === "length") {
2343
+ const a = e.data.length > i.value, o = e.data.length < i.value;
2344
+ (a || o) && (s = this._getOrReturnCtx(e, s), a ? h(s, {
2345
+ code: f.too_big,
2346
+ maximum: i.value,
2347
+ type: "string",
2348
+ inclusive: !0,
2349
+ exact: !0,
2350
+ message: i.message
2351
+ }) : o && h(s, {
2352
+ code: f.too_small,
2353
+ minimum: i.value,
2354
+ type: "string",
2355
+ inclusive: !0,
2356
+ exact: !0,
2357
+ message: i.message
2358
+ }), n.dirty());
2359
+ } else if (i.kind === "email")
2360
+ hs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2361
+ validation: "email",
2362
+ code: f.invalid_string,
2363
+ message: i.message
2364
+ }), n.dirty());
2365
+ else if (i.kind === "emoji")
2366
+ dt || (dt = new RegExp(ps, "u")), dt.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2367
+ validation: "emoji",
2368
+ code: f.invalid_string,
2369
+ message: i.message
2370
+ }), n.dirty());
2371
+ else if (i.kind === "uuid")
2372
+ us.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2373
+ validation: "uuid",
2374
+ code: f.invalid_string,
2375
+ message: i.message
2376
+ }), n.dirty());
2377
+ else if (i.kind === "nanoid")
2378
+ ls.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2379
+ validation: "nanoid",
2380
+ code: f.invalid_string,
2381
+ message: i.message
2382
+ }), n.dirty());
2383
+ else if (i.kind === "cuid")
2384
+ as.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2385
+ validation: "cuid",
2386
+ code: f.invalid_string,
2387
+ message: i.message
2388
+ }), n.dirty());
2389
+ else if (i.kind === "cuid2")
2390
+ os.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2391
+ validation: "cuid2",
2392
+ code: f.invalid_string,
2393
+ message: i.message
2394
+ }), n.dirty());
2395
+ else if (i.kind === "ulid")
2396
+ cs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2397
+ validation: "ulid",
2398
+ code: f.invalid_string,
2399
+ message: i.message
2400
+ }), n.dirty());
2401
+ else if (i.kind === "url")
2402
+ try {
2403
+ new URL(e.data);
2404
+ } catch {
2405
+ s = this._getOrReturnCtx(e, s), h(s, {
2406
+ validation: "url",
2407
+ code: f.invalid_string,
2408
+ message: i.message
2409
+ }), n.dirty();
2410
+ }
2411
+ else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2412
+ validation: "regex",
2413
+ code: f.invalid_string,
2414
+ message: i.message
2415
+ }), n.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (s = this._getOrReturnCtx(e, s), h(s, {
2416
+ code: f.invalid_string,
2417
+ validation: { includes: i.value, position: i.position },
2418
+ message: i.message
2419
+ }), n.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (s = this._getOrReturnCtx(e, s), h(s, {
2420
+ code: f.invalid_string,
2421
+ validation: { startsWith: i.value },
2422
+ message: i.message
2423
+ }), n.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s), h(s, {
2424
+ code: f.invalid_string,
2425
+ validation: { endsWith: i.value },
2426
+ message: i.message
2427
+ }), n.dirty()) : i.kind === "datetime" ? vr(i).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2428
+ code: f.invalid_string,
2429
+ validation: "datetime",
2430
+ message: i.message
2431
+ }), n.dirty()) : i.kind === "date" ? ws.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2432
+ code: f.invalid_string,
2433
+ validation: "date",
2434
+ message: i.message
2435
+ }), n.dirty()) : i.kind === "time" ? xs(i).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2436
+ code: f.invalid_string,
2437
+ validation: "time",
2438
+ message: i.message
2439
+ }), n.dirty()) : i.kind === "duration" ? fs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2440
+ validation: "duration",
2441
+ code: f.invalid_string,
2442
+ message: i.message
2443
+ }), n.dirty()) : i.kind === "ip" ? ks(e.data, i.version) || (s = this._getOrReturnCtx(e, s), h(s, {
2444
+ validation: "ip",
2445
+ code: f.invalid_string,
2446
+ message: i.message
2447
+ }), n.dirty()) : i.kind === "jwt" ? Es(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), h(s, {
2448
+ validation: "jwt",
2449
+ code: f.invalid_string,
2450
+ message: i.message
2451
+ }), n.dirty()) : i.kind === "cidr" ? Ts(e.data, i.version) || (s = this._getOrReturnCtx(e, s), h(s, {
2452
+ validation: "cidr",
2453
+ code: f.invalid_string,
2454
+ message: i.message
2455
+ }), n.dirty()) : i.kind === "base64" ? vs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2456
+ validation: "base64",
2457
+ code: f.invalid_string,
2458
+ message: i.message
2459
+ }), n.dirty()) : i.kind === "base64url" ? bs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2460
+ validation: "base64url",
2461
+ code: f.invalid_string,
2462
+ message: i.message
2463
+ }), n.dirty()) : T.assertNever(i);
2464
+ return { status: n.value, value: e.data };
2465
+ }
2466
+ _regex(e, r, n) {
2467
+ return this.refinement((s) => e.test(s), {
2468
+ validation: r,
2469
+ code: f.invalid_string,
2470
+ ...y.errToObj(n)
2471
+ });
2472
+ }
2473
+ _addCheck(e) {
2474
+ return new M({
2475
+ ...this._def,
2476
+ checks: [...this._def.checks, e]
2477
+ });
2478
+ }
2479
+ email(e) {
2480
+ return this._addCheck({ kind: "email", ...y.errToObj(e) });
2481
+ }
2482
+ url(e) {
2483
+ return this._addCheck({ kind: "url", ...y.errToObj(e) });
2484
+ }
2485
+ emoji(e) {
2486
+ return this._addCheck({ kind: "emoji", ...y.errToObj(e) });
2487
+ }
2488
+ uuid(e) {
2489
+ return this._addCheck({ kind: "uuid", ...y.errToObj(e) });
2490
+ }
2491
+ nanoid(e) {
2492
+ return this._addCheck({ kind: "nanoid", ...y.errToObj(e) });
2493
+ }
2494
+ cuid(e) {
2495
+ return this._addCheck({ kind: "cuid", ...y.errToObj(e) });
2496
+ }
2497
+ cuid2(e) {
2498
+ return this._addCheck({ kind: "cuid2", ...y.errToObj(e) });
2499
+ }
2500
+ ulid(e) {
2501
+ return this._addCheck({ kind: "ulid", ...y.errToObj(e) });
2502
+ }
2503
+ base64(e) {
2504
+ return this._addCheck({ kind: "base64", ...y.errToObj(e) });
2505
+ }
2506
+ base64url(e) {
2507
+ return this._addCheck({
2508
+ kind: "base64url",
2509
+ ...y.errToObj(e)
2510
+ });
2511
+ }
2512
+ jwt(e) {
2513
+ return this._addCheck({ kind: "jwt", ...y.errToObj(e) });
2514
+ }
2515
+ ip(e) {
2516
+ return this._addCheck({ kind: "ip", ...y.errToObj(e) });
2517
+ }
2518
+ cidr(e) {
2519
+ return this._addCheck({ kind: "cidr", ...y.errToObj(e) });
2520
+ }
2521
+ datetime(e) {
2522
+ var r, n;
2523
+ return typeof e == "string" ? this._addCheck({
2524
+ kind: "datetime",
2525
+ precision: null,
2526
+ offset: !1,
2527
+ local: !1,
2528
+ message: e
2529
+ }) : this._addCheck({
2530
+ kind: "datetime",
2531
+ precision: typeof e?.precision > "u" ? null : e?.precision,
2532
+ offset: (r = e?.offset) !== null && r !== void 0 ? r : !1,
2533
+ local: (n = e?.local) !== null && n !== void 0 ? n : !1,
2534
+ ...y.errToObj(e?.message)
2535
+ });
2536
+ }
2537
+ date(e) {
2538
+ return this._addCheck({ kind: "date", message: e });
2539
+ }
2540
+ time(e) {
2541
+ return typeof e == "string" ? this._addCheck({
2542
+ kind: "time",
2543
+ precision: null,
2544
+ message: e
2545
+ }) : this._addCheck({
2546
+ kind: "time",
2547
+ precision: typeof e?.precision > "u" ? null : e?.precision,
2548
+ ...y.errToObj(e?.message)
2549
+ });
2550
+ }
2551
+ duration(e) {
2552
+ return this._addCheck({ kind: "duration", ...y.errToObj(e) });
2553
+ }
2554
+ regex(e, r) {
2555
+ return this._addCheck({
2556
+ kind: "regex",
2557
+ regex: e,
2558
+ ...y.errToObj(r)
2559
+ });
2560
+ }
2561
+ includes(e, r) {
2562
+ return this._addCheck({
2563
+ kind: "includes",
2564
+ value: e,
2565
+ position: r?.position,
2566
+ ...y.errToObj(r?.message)
2567
+ });
2568
+ }
2569
+ startsWith(e, r) {
2570
+ return this._addCheck({
2571
+ kind: "startsWith",
2572
+ value: e,
2573
+ ...y.errToObj(r)
2574
+ });
2575
+ }
2576
+ endsWith(e, r) {
2577
+ return this._addCheck({
2578
+ kind: "endsWith",
2579
+ value: e,
2580
+ ...y.errToObj(r)
2581
+ });
2582
+ }
2583
+ min(e, r) {
2584
+ return this._addCheck({
2585
+ kind: "min",
2586
+ value: e,
2587
+ ...y.errToObj(r)
2588
+ });
2589
+ }
2590
+ max(e, r) {
2591
+ return this._addCheck({
2592
+ kind: "max",
2593
+ value: e,
2594
+ ...y.errToObj(r)
2595
+ });
2596
+ }
2597
+ length(e, r) {
2598
+ return this._addCheck({
2599
+ kind: "length",
2600
+ value: e,
2601
+ ...y.errToObj(r)
2602
+ });
2603
+ }
2604
+ /**
2605
+ * Equivalent to `.min(1)`
2606
+ */
2607
+ nonempty(e) {
2608
+ return this.min(1, y.errToObj(e));
2609
+ }
2610
+ trim() {
2611
+ return new M({
2612
+ ...this._def,
2613
+ checks: [...this._def.checks, { kind: "trim" }]
2614
+ });
2615
+ }
2616
+ toLowerCase() {
2617
+ return new M({
2618
+ ...this._def,
2619
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
2620
+ });
2621
+ }
2622
+ toUpperCase() {
2623
+ return new M({
2624
+ ...this._def,
2625
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
2626
+ });
2627
+ }
2628
+ get isDatetime() {
2629
+ return !!this._def.checks.find((e) => e.kind === "datetime");
2630
+ }
2631
+ get isDate() {
2632
+ return !!this._def.checks.find((e) => e.kind === "date");
2633
+ }
2634
+ get isTime() {
2635
+ return !!this._def.checks.find((e) => e.kind === "time");
2636
+ }
2637
+ get isDuration() {
2638
+ return !!this._def.checks.find((e) => e.kind === "duration");
2639
+ }
2640
+ get isEmail() {
2641
+ return !!this._def.checks.find((e) => e.kind === "email");
2642
+ }
2643
+ get isURL() {
2644
+ return !!this._def.checks.find((e) => e.kind === "url");
2645
+ }
2646
+ get isEmoji() {
2647
+ return !!this._def.checks.find((e) => e.kind === "emoji");
2648
+ }
2649
+ get isUUID() {
2650
+ return !!this._def.checks.find((e) => e.kind === "uuid");
2651
+ }
2652
+ get isNANOID() {
2653
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
2654
+ }
2655
+ get isCUID() {
2656
+ return !!this._def.checks.find((e) => e.kind === "cuid");
2657
+ }
2658
+ get isCUID2() {
2659
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
2660
+ }
2661
+ get isULID() {
2662
+ return !!this._def.checks.find((e) => e.kind === "ulid");
2663
+ }
2664
+ get isIP() {
2665
+ return !!this._def.checks.find((e) => e.kind === "ip");
2666
+ }
2667
+ get isCIDR() {
2668
+ return !!this._def.checks.find((e) => e.kind === "cidr");
2669
+ }
2670
+ get isBase64() {
2671
+ return !!this._def.checks.find((e) => e.kind === "base64");
2672
+ }
2673
+ get isBase64url() {
2674
+ return !!this._def.checks.find((e) => e.kind === "base64url");
2675
+ }
2676
+ get minLength() {
2677
+ let e = null;
2678
+ for (const r of this._def.checks)
2679
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2680
+ return e;
2681
+ }
2682
+ get maxLength() {
2683
+ let e = null;
2684
+ for (const r of this._def.checks)
2685
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2686
+ return e;
2687
+ }
2688
+ }
2689
+ M.create = (t) => {
2690
+ var e;
2691
+ return new M({
2692
+ checks: [],
2693
+ typeName: v.ZodString,
2694
+ coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
2695
+ ...x(t)
2696
+ });
2697
+ };
2698
+ function Ss(t, e) {
2699
+ const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, i = parseInt(t.toFixed(s).replace(".", "")), a = parseInt(e.toFixed(s).replace(".", ""));
2700
+ return i % a / Math.pow(10, s);
2701
+ }
2702
+ class Q extends E {
2703
+ constructor() {
2704
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
2705
+ }
2706
+ _parse(e) {
2707
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
2708
+ const i = this._getOrReturnCtx(e);
2709
+ return h(i, {
2710
+ code: f.invalid_type,
2711
+ expected: m.number,
2712
+ received: i.parsedType
2713
+ }), b;
2714
+ }
2715
+ let n;
2716
+ const s = new Z();
2717
+ for (const i of this._def.checks)
2718
+ i.kind === "int" ? T.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2719
+ code: f.invalid_type,
2720
+ expected: "integer",
2721
+ received: "float",
2722
+ message: i.message
2723
+ }), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2724
+ code: f.too_small,
2725
+ minimum: i.value,
2726
+ type: "number",
2727
+ inclusive: i.inclusive,
2728
+ exact: !1,
2729
+ message: i.message
2730
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2731
+ code: f.too_big,
2732
+ maximum: i.value,
2733
+ type: "number",
2734
+ inclusive: i.inclusive,
2735
+ exact: !1,
2736
+ message: i.message
2737
+ }), s.dirty()) : i.kind === "multipleOf" ? Ss(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), h(n, {
2738
+ code: f.not_multiple_of,
2739
+ multipleOf: i.value,
2740
+ message: i.message
2741
+ }), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2742
+ code: f.not_finite,
2743
+ message: i.message
2744
+ }), s.dirty()) : T.assertNever(i);
2745
+ return { status: s.value, value: e.data };
2746
+ }
2747
+ gte(e, r) {
2748
+ return this.setLimit("min", e, !0, y.toString(r));
2749
+ }
2750
+ gt(e, r) {
2751
+ return this.setLimit("min", e, !1, y.toString(r));
2752
+ }
2753
+ lte(e, r) {
2754
+ return this.setLimit("max", e, !0, y.toString(r));
2755
+ }
2756
+ lt(e, r) {
2757
+ return this.setLimit("max", e, !1, y.toString(r));
2758
+ }
2759
+ setLimit(e, r, n, s) {
2760
+ return new Q({
2761
+ ...this._def,
2762
+ checks: [
2763
+ ...this._def.checks,
2764
+ {
2765
+ kind: e,
2766
+ value: r,
2767
+ inclusive: n,
2768
+ message: y.toString(s)
2769
+ }
2770
+ ]
2771
+ });
2772
+ }
2773
+ _addCheck(e) {
2774
+ return new Q({
2775
+ ...this._def,
2776
+ checks: [...this._def.checks, e]
2777
+ });
2778
+ }
2779
+ int(e) {
2780
+ return this._addCheck({
2781
+ kind: "int",
2782
+ message: y.toString(e)
2783
+ });
2784
+ }
2785
+ positive(e) {
2786
+ return this._addCheck({
2787
+ kind: "min",
2788
+ value: 0,
2789
+ inclusive: !1,
2790
+ message: y.toString(e)
2791
+ });
2792
+ }
2793
+ negative(e) {
2794
+ return this._addCheck({
2795
+ kind: "max",
2796
+ value: 0,
2797
+ inclusive: !1,
2798
+ message: y.toString(e)
2799
+ });
2800
+ }
2801
+ nonpositive(e) {
2802
+ return this._addCheck({
2803
+ kind: "max",
2804
+ value: 0,
2805
+ inclusive: !0,
2806
+ message: y.toString(e)
2807
+ });
2808
+ }
2809
+ nonnegative(e) {
2810
+ return this._addCheck({
2811
+ kind: "min",
2812
+ value: 0,
2813
+ inclusive: !0,
2814
+ message: y.toString(e)
2815
+ });
2816
+ }
2817
+ multipleOf(e, r) {
2818
+ return this._addCheck({
2819
+ kind: "multipleOf",
2820
+ value: e,
2821
+ message: y.toString(r)
2822
+ });
2823
+ }
2824
+ finite(e) {
2825
+ return this._addCheck({
2826
+ kind: "finite",
2827
+ message: y.toString(e)
2828
+ });
2829
+ }
2830
+ safe(e) {
2831
+ return this._addCheck({
2832
+ kind: "min",
2833
+ inclusive: !0,
2834
+ value: Number.MIN_SAFE_INTEGER,
2835
+ message: y.toString(e)
2836
+ })._addCheck({
2837
+ kind: "max",
2838
+ inclusive: !0,
2839
+ value: Number.MAX_SAFE_INTEGER,
2840
+ message: y.toString(e)
2841
+ });
2842
+ }
2843
+ get minValue() {
2844
+ let e = null;
2845
+ for (const r of this._def.checks)
2846
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2847
+ return e;
2848
+ }
2849
+ get maxValue() {
2850
+ let e = null;
2851
+ for (const r of this._def.checks)
2852
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2853
+ return e;
2854
+ }
2855
+ get isInt() {
2856
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && T.isInteger(e.value));
2857
+ }
2858
+ get isFinite() {
2859
+ let e = null, r = null;
2860
+ for (const n of this._def.checks) {
2861
+ if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
2862
+ return !0;
2863
+ n.kind === "min" ? (r === null || n.value > r) && (r = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
2864
+ }
2865
+ return Number.isFinite(r) && Number.isFinite(e);
2866
+ }
2867
+ }
2868
+ Q.create = (t) => new Q({
2869
+ checks: [],
2870
+ typeName: v.ZodNumber,
2871
+ coerce: t?.coerce || !1,
2872
+ ...x(t)
2873
+ });
2874
+ class ee extends E {
2875
+ constructor() {
2876
+ super(...arguments), this.min = this.gte, this.max = this.lte;
2877
+ }
2878
+ _parse(e) {
2879
+ if (this._def.coerce)
2880
+ try {
2881
+ e.data = BigInt(e.data);
2882
+ } catch {
2883
+ return this._getInvalidInput(e);
2884
+ }
2885
+ if (this._getType(e) !== m.bigint)
2886
+ return this._getInvalidInput(e);
2887
+ let n;
2888
+ const s = new Z();
2889
+ for (const i of this._def.checks)
2890
+ i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2891
+ code: f.too_small,
2892
+ type: "bigint",
2893
+ minimum: i.value,
2894
+ inclusive: i.inclusive,
2895
+ message: i.message
2896
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2897
+ code: f.too_big,
2898
+ type: "bigint",
2899
+ maximum: i.value,
2900
+ inclusive: i.inclusive,
2901
+ message: i.message
2902
+ }), s.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), h(n, {
2903
+ code: f.not_multiple_of,
2904
+ multipleOf: i.value,
2905
+ message: i.message
2906
+ }), s.dirty()) : T.assertNever(i);
2907
+ return { status: s.value, value: e.data };
2908
+ }
2909
+ _getInvalidInput(e) {
2910
+ const r = this._getOrReturnCtx(e);
2911
+ return h(r, {
2912
+ code: f.invalid_type,
2913
+ expected: m.bigint,
2914
+ received: r.parsedType
2915
+ }), b;
2916
+ }
2917
+ gte(e, r) {
2918
+ return this.setLimit("min", e, !0, y.toString(r));
2919
+ }
2920
+ gt(e, r) {
2921
+ return this.setLimit("min", e, !1, y.toString(r));
2922
+ }
2923
+ lte(e, r) {
2924
+ return this.setLimit("max", e, !0, y.toString(r));
2925
+ }
2926
+ lt(e, r) {
2927
+ return this.setLimit("max", e, !1, y.toString(r));
2928
+ }
2929
+ setLimit(e, r, n, s) {
2930
+ return new ee({
2931
+ ...this._def,
2932
+ checks: [
2933
+ ...this._def.checks,
2934
+ {
2935
+ kind: e,
2936
+ value: r,
2937
+ inclusive: n,
2938
+ message: y.toString(s)
2939
+ }
2940
+ ]
2941
+ });
2942
+ }
2943
+ _addCheck(e) {
2944
+ return new ee({
2945
+ ...this._def,
2946
+ checks: [...this._def.checks, e]
2947
+ });
2948
+ }
2949
+ positive(e) {
2950
+ return this._addCheck({
2951
+ kind: "min",
2952
+ value: BigInt(0),
2953
+ inclusive: !1,
2954
+ message: y.toString(e)
2955
+ });
2956
+ }
2957
+ negative(e) {
2958
+ return this._addCheck({
2959
+ kind: "max",
2960
+ value: BigInt(0),
2961
+ inclusive: !1,
2962
+ message: y.toString(e)
2963
+ });
2964
+ }
2965
+ nonpositive(e) {
2966
+ return this._addCheck({
2967
+ kind: "max",
2968
+ value: BigInt(0),
2969
+ inclusive: !0,
2970
+ message: y.toString(e)
2971
+ });
2972
+ }
2973
+ nonnegative(e) {
2974
+ return this._addCheck({
2975
+ kind: "min",
2976
+ value: BigInt(0),
2977
+ inclusive: !0,
2978
+ message: y.toString(e)
2979
+ });
2980
+ }
2981
+ multipleOf(e, r) {
2982
+ return this._addCheck({
2983
+ kind: "multipleOf",
2984
+ value: e,
2985
+ message: y.toString(r)
2986
+ });
2987
+ }
2988
+ get minValue() {
2989
+ let e = null;
2990
+ for (const r of this._def.checks)
2991
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2992
+ return e;
2993
+ }
2994
+ get maxValue() {
2995
+ let e = null;
2996
+ for (const r of this._def.checks)
2997
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2998
+ return e;
2999
+ }
3000
+ }
3001
+ ee.create = (t) => {
3002
+ var e;
3003
+ return new ee({
3004
+ checks: [],
3005
+ typeName: v.ZodBigInt,
3006
+ coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
3007
+ ...x(t)
3008
+ });
3009
+ };
3010
+ class Te extends E {
3011
+ _parse(e) {
3012
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
3013
+ const n = this._getOrReturnCtx(e);
3014
+ return h(n, {
3015
+ code: f.invalid_type,
3016
+ expected: m.boolean,
3017
+ received: n.parsedType
3018
+ }), b;
3019
+ }
3020
+ return I(e.data);
3021
+ }
3022
+ }
3023
+ Te.create = (t) => new Te({
3024
+ typeName: v.ZodBoolean,
3025
+ coerce: t?.coerce || !1,
3026
+ ...x(t)
3027
+ });
3028
+ class ue extends E {
3029
+ _parse(e) {
3030
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
3031
+ const i = this._getOrReturnCtx(e);
3032
+ return h(i, {
3033
+ code: f.invalid_type,
3034
+ expected: m.date,
3035
+ received: i.parsedType
3036
+ }), b;
3037
+ }
3038
+ if (isNaN(e.data.getTime())) {
3039
+ const i = this._getOrReturnCtx(e);
3040
+ return h(i, {
3041
+ code: f.invalid_date
3042
+ }), b;
3043
+ }
3044
+ const n = new Z();
3045
+ let s;
3046
+ for (const i of this._def.checks)
3047
+ i.kind === "min" ? e.data.getTime() < i.value && (s = this._getOrReturnCtx(e, s), h(s, {
3048
+ code: f.too_small,
3049
+ message: i.message,
3050
+ inclusive: !0,
3051
+ exact: !1,
3052
+ minimum: i.value,
3053
+ type: "date"
3054
+ }), n.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (s = this._getOrReturnCtx(e, s), h(s, {
3055
+ code: f.too_big,
3056
+ message: i.message,
3057
+ inclusive: !0,
3058
+ exact: !1,
3059
+ maximum: i.value,
3060
+ type: "date"
3061
+ }), n.dirty()) : T.assertNever(i);
3062
+ return {
3063
+ status: n.value,
3064
+ value: new Date(e.data.getTime())
3065
+ };
3066
+ }
3067
+ _addCheck(e) {
3068
+ return new ue({
3069
+ ...this._def,
3070
+ checks: [...this._def.checks, e]
3071
+ });
3072
+ }
3073
+ min(e, r) {
3074
+ return this._addCheck({
3075
+ kind: "min",
3076
+ value: e.getTime(),
3077
+ message: y.toString(r)
3078
+ });
3079
+ }
3080
+ max(e, r) {
3081
+ return this._addCheck({
3082
+ kind: "max",
3083
+ value: e.getTime(),
3084
+ message: y.toString(r)
3085
+ });
3086
+ }
3087
+ get minDate() {
3088
+ let e = null;
3089
+ for (const r of this._def.checks)
3090
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
3091
+ return e != null ? new Date(e) : null;
3092
+ }
3093
+ get maxDate() {
3094
+ let e = null;
3095
+ for (const r of this._def.checks)
3096
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
3097
+ return e != null ? new Date(e) : null;
3098
+ }
3099
+ }
3100
+ ue.create = (t) => new ue({
3101
+ checks: [],
3102
+ coerce: t?.coerce || !1,
3103
+ typeName: v.ZodDate,
3104
+ ...x(t)
3105
+ });
3106
+ class Ke extends E {
3107
+ _parse(e) {
3108
+ if (this._getType(e) !== m.symbol) {
3109
+ const n = this._getOrReturnCtx(e);
3110
+ return h(n, {
3111
+ code: f.invalid_type,
3112
+ expected: m.symbol,
3113
+ received: n.parsedType
3114
+ }), b;
3115
+ }
3116
+ return I(e.data);
3117
+ }
3118
+ }
3119
+ Ke.create = (t) => new Ke({
3120
+ typeName: v.ZodSymbol,
3121
+ ...x(t)
3122
+ });
3123
+ class Se extends E {
3124
+ _parse(e) {
3125
+ if (this._getType(e) !== m.undefined) {
3126
+ const n = this._getOrReturnCtx(e);
3127
+ return h(n, {
3128
+ code: f.invalid_type,
3129
+ expected: m.undefined,
3130
+ received: n.parsedType
3131
+ }), b;
3132
+ }
3133
+ return I(e.data);
3134
+ }
3135
+ }
3136
+ Se.create = (t) => new Se({
3137
+ typeName: v.ZodUndefined,
3138
+ ...x(t)
3139
+ });
3140
+ class Re extends E {
3141
+ _parse(e) {
3142
+ if (this._getType(e) !== m.null) {
3143
+ const n = this._getOrReturnCtx(e);
3144
+ return h(n, {
3145
+ code: f.invalid_type,
3146
+ expected: m.null,
3147
+ received: n.parsedType
3148
+ }), b;
3149
+ }
3150
+ return I(e.data);
3151
+ }
3152
+ }
3153
+ Re.create = (t) => new Re({
3154
+ typeName: v.ZodNull,
3155
+ ...x(t)
3156
+ });
3157
+ class ye extends E {
3158
+ constructor() {
3159
+ super(...arguments), this._any = !0;
3160
+ }
3161
+ _parse(e) {
3162
+ return I(e.data);
3163
+ }
3164
+ }
3165
+ ye.create = (t) => new ye({
3166
+ typeName: v.ZodAny,
3167
+ ...x(t)
3168
+ });
3169
+ class ae extends E {
3170
+ constructor() {
3171
+ super(...arguments), this._unknown = !0;
3172
+ }
3173
+ _parse(e) {
3174
+ return I(e.data);
3175
+ }
3176
+ }
3177
+ ae.create = (t) => new ae({
3178
+ typeName: v.ZodUnknown,
3179
+ ...x(t)
3180
+ });
3181
+ class G extends E {
3182
+ _parse(e) {
3183
+ const r = this._getOrReturnCtx(e);
3184
+ return h(r, {
3185
+ code: f.invalid_type,
3186
+ expected: m.never,
3187
+ received: r.parsedType
3188
+ }), b;
3189
+ }
3190
+ }
3191
+ G.create = (t) => new G({
3192
+ typeName: v.ZodNever,
3193
+ ...x(t)
3194
+ });
3195
+ class Xe extends E {
3196
+ _parse(e) {
3197
+ if (this._getType(e) !== m.undefined) {
3198
+ const n = this._getOrReturnCtx(e);
3199
+ return h(n, {
3200
+ code: f.invalid_type,
3201
+ expected: m.void,
3202
+ received: n.parsedType
3203
+ }), b;
3204
+ }
3205
+ return I(e.data);
3206
+ }
3207
+ }
3208
+ Xe.create = (t) => new Xe({
3209
+ typeName: v.ZodVoid,
3210
+ ...x(t)
3211
+ });
3212
+ class B extends E {
3213
+ _parse(e) {
3214
+ const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
3215
+ if (r.parsedType !== m.array)
3216
+ return h(r, {
3217
+ code: f.invalid_type,
3218
+ expected: m.array,
3219
+ received: r.parsedType
3220
+ }), b;
3221
+ if (s.exactLength !== null) {
3222
+ const a = r.data.length > s.exactLength.value, o = r.data.length < s.exactLength.value;
3223
+ (a || o) && (h(r, {
3224
+ code: a ? f.too_big : f.too_small,
3225
+ minimum: o ? s.exactLength.value : void 0,
3226
+ maximum: a ? s.exactLength.value : void 0,
3227
+ type: "array",
3228
+ inclusive: !0,
3229
+ exact: !0,
3230
+ message: s.exactLength.message
3231
+ }), n.dirty());
3232
+ }
3233
+ if (s.minLength !== null && r.data.length < s.minLength.value && (h(r, {
3234
+ code: f.too_small,
3235
+ minimum: s.minLength.value,
3236
+ type: "array",
3237
+ inclusive: !0,
3238
+ exact: !1,
3239
+ message: s.minLength.message
3240
+ }), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (h(r, {
3241
+ code: f.too_big,
3242
+ maximum: s.maxLength.value,
3243
+ type: "array",
3244
+ inclusive: !0,
3245
+ exact: !1,
3246
+ message: s.maxLength.message
3247
+ }), n.dirty()), r.common.async)
3248
+ return Promise.all([...r.data].map((a, o) => s.type._parseAsync(new H(r, a, r.path, o)))).then((a) => Z.mergeArray(n, a));
3249
+ const i = [...r.data].map((a, o) => s.type._parseSync(new H(r, a, r.path, o)));
3250
+ return Z.mergeArray(n, i);
3251
+ }
3252
+ get element() {
3253
+ return this._def.type;
3254
+ }
3255
+ min(e, r) {
3256
+ return new B({
3257
+ ...this._def,
3258
+ minLength: { value: e, message: y.toString(r) }
3259
+ });
3260
+ }
3261
+ max(e, r) {
3262
+ return new B({
3263
+ ...this._def,
3264
+ maxLength: { value: e, message: y.toString(r) }
3265
+ });
3266
+ }
3267
+ length(e, r) {
3268
+ return new B({
3269
+ ...this._def,
3270
+ exactLength: { value: e, message: y.toString(r) }
3271
+ });
3272
+ }
3273
+ nonempty(e) {
3274
+ return this.min(1, e);
3275
+ }
3276
+ }
3277
+ B.create = (t, e) => new B({
3278
+ type: t,
3279
+ minLength: null,
3280
+ maxLength: null,
3281
+ exactLength: null,
3282
+ typeName: v.ZodArray,
3283
+ ...x(e)
3284
+ });
3285
+ function fe(t) {
3286
+ if (t instanceof O) {
3287
+ const e = {};
3288
+ for (const r in t.shape) {
3289
+ const n = t.shape[r];
3290
+ e[r] = q.create(fe(n));
3291
+ }
3292
+ return new O({
3293
+ ...t._def,
3294
+ shape: () => e
3295
+ });
3296
+ } else return t instanceof B ? new B({
3297
+ ...t._def,
3298
+ type: fe(t.element)
3299
+ }) : t instanceof q ? q.create(fe(t.unwrap())) : t instanceof re ? re.create(fe(t.unwrap())) : t instanceof W ? W.create(t.items.map((e) => fe(e))) : t;
3300
+ }
3301
+ class O extends E {
3302
+ constructor() {
3303
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
3304
+ }
3305
+ _getCached() {
3306
+ if (this._cached !== null)
3307
+ return this._cached;
3308
+ const e = this._def.shape(), r = T.objectKeys(e);
3309
+ return this._cached = { shape: e, keys: r };
3310
+ }
3311
+ _parse(e) {
3312
+ if (this._getType(e) !== m.object) {
3313
+ const c = this._getOrReturnCtx(e);
3314
+ return h(c, {
3315
+ code: f.invalid_type,
3316
+ expected: m.object,
3317
+ received: c.parsedType
3318
+ }), b;
3319
+ }
3320
+ const { status: n, ctx: s } = this._processInputParams(e), { shape: i, keys: a } = this._getCached(), o = [];
3321
+ if (!(this._def.catchall instanceof G && this._def.unknownKeys === "strip"))
3322
+ for (const c in s.data)
3323
+ a.includes(c) || o.push(c);
3324
+ const l = [];
3325
+ for (const c of a) {
3326
+ const d = i[c], p = s.data[c];
3327
+ l.push({
3328
+ key: { status: "valid", value: c },
3329
+ value: d._parse(new H(s, p, s.path, c)),
3330
+ alwaysSet: c in s.data
3331
+ });
3332
+ }
3333
+ if (this._def.catchall instanceof G) {
3334
+ const c = this._def.unknownKeys;
3335
+ if (c === "passthrough")
3336
+ for (const d of o)
3337
+ l.push({
3338
+ key: { status: "valid", value: d },
3339
+ value: { status: "valid", value: s.data[d] }
3340
+ });
3341
+ else if (c === "strict")
3342
+ o.length > 0 && (h(s, {
3343
+ code: f.unrecognized_keys,
3344
+ keys: o
3345
+ }), n.dirty());
3346
+ else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
3347
+ } else {
3348
+ const c = this._def.catchall;
3349
+ for (const d of o) {
3350
+ const p = s.data[d];
3351
+ l.push({
3352
+ key: { status: "valid", value: d },
3353
+ value: c._parse(
3354
+ new H(s, p, s.path, d)
3355
+ //, ctx.child(key), value, getParsedType(value)
3356
+ ),
3357
+ alwaysSet: d in s.data
3358
+ });
3359
+ }
3360
+ }
3361
+ return s.common.async ? Promise.resolve().then(async () => {
3362
+ const c = [];
3363
+ for (const d of l) {
3364
+ const p = await d.key, S = await d.value;
3365
+ c.push({
3366
+ key: p,
3367
+ value: S,
3368
+ alwaysSet: d.alwaysSet
3369
+ });
3370
+ }
3371
+ return c;
3372
+ }).then((c) => Z.mergeObjectSync(n, c)) : Z.mergeObjectSync(n, l);
3373
+ }
3374
+ get shape() {
3375
+ return this._def.shape();
3376
+ }
3377
+ strict(e) {
3378
+ return y.errToObj, new O({
3379
+ ...this._def,
3380
+ unknownKeys: "strict",
3381
+ ...e !== void 0 ? {
3382
+ errorMap: (r, n) => {
3383
+ var s, i, a, o;
3384
+ const l = (a = (i = (s = this._def).errorMap) === null || i === void 0 ? void 0 : i.call(s, r, n).message) !== null && a !== void 0 ? a : n.defaultError;
3385
+ return r.code === "unrecognized_keys" ? {
3386
+ message: (o = y.errToObj(e).message) !== null && o !== void 0 ? o : l
3387
+ } : {
3388
+ message: l
3389
+ };
3390
+ }
3391
+ } : {}
3392
+ });
3393
+ }
3394
+ strip() {
3395
+ return new O({
3396
+ ...this._def,
3397
+ unknownKeys: "strip"
3398
+ });
3399
+ }
3400
+ passthrough() {
3401
+ return new O({
3402
+ ...this._def,
3403
+ unknownKeys: "passthrough"
3404
+ });
3405
+ }
3406
+ // const AugmentFactory =
3407
+ // <Def extends ZodObjectDef>(def: Def) =>
3408
+ // <Augmentation extends ZodRawShape>(
3409
+ // augmentation: Augmentation
3410
+ // ): ZodObject<
3411
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
3412
+ // Def["unknownKeys"],
3413
+ // Def["catchall"]
3414
+ // > => {
3415
+ // return new ZodObject({
3416
+ // ...def,
3417
+ // shape: () => ({
3418
+ // ...def.shape(),
3419
+ // ...augmentation,
3420
+ // }),
3421
+ // }) as any;
3422
+ // };
3423
+ extend(e) {
3424
+ return new O({
3425
+ ...this._def,
3426
+ shape: () => ({
3427
+ ...this._def.shape(),
3428
+ ...e
3429
+ })
3430
+ });
3431
+ }
3432
+ /**
3433
+ * Prior to zod@1.0.12 there was a bug in the
3434
+ * inferred type of merged objects. Please
3435
+ * upgrade if you are experiencing issues.
3436
+ */
3437
+ merge(e) {
3438
+ return new O({
3439
+ unknownKeys: e._def.unknownKeys,
3440
+ catchall: e._def.catchall,
3441
+ shape: () => ({
3442
+ ...this._def.shape(),
3443
+ ...e._def.shape()
3444
+ }),
3445
+ typeName: v.ZodObject
3446
+ });
3447
+ }
3448
+ // merge<
3449
+ // Incoming extends AnyZodObject,
3450
+ // Augmentation extends Incoming["shape"],
3451
+ // NewOutput extends {
3452
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
3453
+ // ? Augmentation[k]["_output"]
3454
+ // : k extends keyof Output
3455
+ // ? Output[k]
3456
+ // : never;
3457
+ // },
3458
+ // NewInput extends {
3459
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
3460
+ // ? Augmentation[k]["_input"]
3461
+ // : k extends keyof Input
3462
+ // ? Input[k]
3463
+ // : never;
3464
+ // }
3465
+ // >(
3466
+ // merging: Incoming
3467
+ // ): ZodObject<
3468
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3469
+ // Incoming["_def"]["unknownKeys"],
3470
+ // Incoming["_def"]["catchall"],
3471
+ // NewOutput,
3472
+ // NewInput
3473
+ // > {
3474
+ // const merged: any = new ZodObject({
3475
+ // unknownKeys: merging._def.unknownKeys,
3476
+ // catchall: merging._def.catchall,
3477
+ // shape: () =>
3478
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3479
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3480
+ // }) as any;
3481
+ // return merged;
3482
+ // }
3483
+ setKey(e, r) {
3484
+ return this.augment({ [e]: r });
3485
+ }
3486
+ // merge<Incoming extends AnyZodObject>(
3487
+ // merging: Incoming
3488
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
3489
+ // ZodObject<
3490
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3491
+ // Incoming["_def"]["unknownKeys"],
3492
+ // Incoming["_def"]["catchall"]
3493
+ // > {
3494
+ // // const mergedShape = objectUtil.mergeShapes(
3495
+ // // this._def.shape(),
3496
+ // // merging._def.shape()
3497
+ // // );
3498
+ // const merged: any = new ZodObject({
3499
+ // unknownKeys: merging._def.unknownKeys,
3500
+ // catchall: merging._def.catchall,
3501
+ // shape: () =>
3502
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3503
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3504
+ // }) as any;
3505
+ // return merged;
3506
+ // }
3507
+ catchall(e) {
3508
+ return new O({
3509
+ ...this._def,
3510
+ catchall: e
3511
+ });
3512
+ }
3513
+ pick(e) {
3514
+ const r = {};
3515
+ return T.objectKeys(e).forEach((n) => {
3516
+ e[n] && this.shape[n] && (r[n] = this.shape[n]);
3517
+ }), new O({
3518
+ ...this._def,
3519
+ shape: () => r
3520
+ });
3521
+ }
3522
+ omit(e) {
3523
+ const r = {};
3524
+ return T.objectKeys(this.shape).forEach((n) => {
3525
+ e[n] || (r[n] = this.shape[n]);
3526
+ }), new O({
3527
+ ...this._def,
3528
+ shape: () => r
3529
+ });
3530
+ }
3531
+ /**
3532
+ * @deprecated
3533
+ */
3534
+ deepPartial() {
3535
+ return fe(this);
3536
+ }
3537
+ partial(e) {
3538
+ const r = {};
3539
+ return T.objectKeys(this.shape).forEach((n) => {
3540
+ const s = this.shape[n];
3541
+ e && !e[n] ? r[n] = s : r[n] = s.optional();
3542
+ }), new O({
3543
+ ...this._def,
3544
+ shape: () => r
3545
+ });
3546
+ }
3547
+ required(e) {
3548
+ const r = {};
3549
+ return T.objectKeys(this.shape).forEach((n) => {
3550
+ if (e && !e[n])
3551
+ r[n] = this.shape[n];
3552
+ else {
3553
+ let i = this.shape[n];
3554
+ for (; i instanceof q; )
3555
+ i = i._def.innerType;
3556
+ r[n] = i;
3557
+ }
3558
+ }), new O({
3559
+ ...this._def,
3560
+ shape: () => r
3561
+ });
3562
+ }
3563
+ keyof() {
3564
+ return br(T.objectKeys(this.shape));
3565
+ }
3566
+ }
3567
+ O.create = (t, e) => new O({
3568
+ shape: () => t,
3569
+ unknownKeys: "strip",
3570
+ catchall: G.create(),
3571
+ typeName: v.ZodObject,
3572
+ ...x(e)
3573
+ });
3574
+ O.strictCreate = (t, e) => new O({
3575
+ shape: () => t,
3576
+ unknownKeys: "strict",
3577
+ catchall: G.create(),
3578
+ typeName: v.ZodObject,
3579
+ ...x(e)
3580
+ });
3581
+ O.lazycreate = (t, e) => new O({
3582
+ shape: t,
3583
+ unknownKeys: "strip",
3584
+ catchall: G.create(),
3585
+ typeName: v.ZodObject,
3586
+ ...x(e)
3587
+ });
3588
+ class Oe extends E {
3589
+ _parse(e) {
3590
+ const { ctx: r } = this._processInputParams(e), n = this._def.options;
3591
+ function s(i) {
3592
+ for (const o of i)
3593
+ if (o.result.status === "valid")
3594
+ return o.result;
3595
+ for (const o of i)
3596
+ if (o.result.status === "dirty")
3597
+ return r.common.issues.push(...o.ctx.common.issues), o.result;
3598
+ const a = i.map((o) => new F(o.ctx.common.issues));
3599
+ return h(r, {
3600
+ code: f.invalid_union,
3601
+ unionErrors: a
3602
+ }), b;
3603
+ }
3604
+ if (r.common.async)
3605
+ return Promise.all(n.map(async (i) => {
3606
+ const a = {
3607
+ ...r,
3608
+ common: {
3609
+ ...r.common,
3610
+ issues: []
3611
+ },
3612
+ parent: null
3613
+ };
3614
+ return {
3615
+ result: await i._parseAsync({
3616
+ data: r.data,
3617
+ path: r.path,
3618
+ parent: a
3619
+ }),
3620
+ ctx: a
3621
+ };
3622
+ })).then(s);
3623
+ {
3624
+ let i;
3625
+ const a = [];
3626
+ for (const l of n) {
3627
+ const c = {
3628
+ ...r,
3629
+ common: {
3630
+ ...r.common,
3631
+ issues: []
3632
+ },
3633
+ parent: null
3634
+ }, d = l._parseSync({
3635
+ data: r.data,
3636
+ path: r.path,
3637
+ parent: c
3638
+ });
3639
+ if (d.status === "valid")
3640
+ return d;
3641
+ d.status === "dirty" && !i && (i = { result: d, ctx: c }), c.common.issues.length && a.push(c.common.issues);
3642
+ }
3643
+ if (i)
3644
+ return r.common.issues.push(...i.ctx.common.issues), i.result;
3645
+ const o = a.map((l) => new F(l));
3646
+ return h(r, {
3647
+ code: f.invalid_union,
3648
+ unionErrors: o
3649
+ }), b;
3650
+ }
3651
+ }
3652
+ get options() {
3653
+ return this._def.options;
3654
+ }
3655
+ }
3656
+ Oe.create = (t, e) => new Oe({
3657
+ options: t,
3658
+ typeName: v.ZodUnion,
3659
+ ...x(e)
3660
+ });
3661
+ const K = (t) => t instanceof Ne ? K(t.schema) : t instanceof $ ? K(t.innerType()) : t instanceof je ? [t.value] : t instanceof te ? t.options : t instanceof Pe ? T.objectValues(t.enum) : t instanceof Ze ? K(t._def.innerType) : t instanceof Se ? [void 0] : t instanceof Re ? [null] : t instanceof q ? [void 0, ...K(t.unwrap())] : t instanceof re ? [null, ...K(t.unwrap())] : t instanceof St || t instanceof De ? K(t.unwrap()) : t instanceof Ie ? K(t._def.innerType) : [];
3662
+ class ot extends E {
3663
+ _parse(e) {
3664
+ const { ctx: r } = this._processInputParams(e);
3665
+ if (r.parsedType !== m.object)
3666
+ return h(r, {
3667
+ code: f.invalid_type,
3668
+ expected: m.object,
3669
+ received: r.parsedType
3670
+ }), b;
3671
+ const n = this.discriminator, s = r.data[n], i = this.optionsMap.get(s);
3672
+ return i ? r.common.async ? i._parseAsync({
3673
+ data: r.data,
3674
+ path: r.path,
3675
+ parent: r
3676
+ }) : i._parseSync({
3677
+ data: r.data,
3678
+ path: r.path,
3679
+ parent: r
3680
+ }) : (h(r, {
3681
+ code: f.invalid_union_discriminator,
3682
+ options: Array.from(this.optionsMap.keys()),
3683
+ path: [n]
3684
+ }), b);
3685
+ }
3686
+ get discriminator() {
3687
+ return this._def.discriminator;
3688
+ }
3689
+ get options() {
3690
+ return this._def.options;
3691
+ }
3692
+ get optionsMap() {
3693
+ return this._def.optionsMap;
3694
+ }
3695
+ /**
3696
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
3697
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
3698
+ * have a different value for each object in the union.
3699
+ * @param discriminator the name of the discriminator property
3700
+ * @param types an array of object schemas
3701
+ * @param params
3702
+ */
3703
+ static create(e, r, n) {
3704
+ const s = /* @__PURE__ */ new Map();
3705
+ for (const i of r) {
3706
+ const a = K(i.shape[e]);
3707
+ if (!a.length)
3708
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
3709
+ for (const o of a) {
3710
+ if (s.has(o))
3711
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
3712
+ s.set(o, i);
3713
+ }
3714
+ }
3715
+ return new ot({
3716
+ typeName: v.ZodDiscriminatedUnion,
3717
+ discriminator: e,
3718
+ options: r,
3719
+ optionsMap: s,
3720
+ ...x(n)
3721
+ });
3722
+ }
3723
+ }
3724
+ function wt(t, e) {
3725
+ const r = X(t), n = X(e);
3726
+ if (t === e)
3727
+ return { valid: !0, data: t };
3728
+ if (r === m.object && n === m.object) {
3729
+ const s = T.objectKeys(e), i = T.objectKeys(t).filter((o) => s.indexOf(o) !== -1), a = { ...t, ...e };
3730
+ for (const o of i) {
3731
+ const l = wt(t[o], e[o]);
3732
+ if (!l.valid)
3733
+ return { valid: !1 };
3734
+ a[o] = l.data;
3735
+ }
3736
+ return { valid: !0, data: a };
3737
+ } else if (r === m.array && n === m.array) {
3738
+ if (t.length !== e.length)
3739
+ return { valid: !1 };
3740
+ const s = [];
3741
+ for (let i = 0; i < t.length; i++) {
3742
+ const a = t[i], o = e[i], l = wt(a, o);
3743
+ if (!l.valid)
3744
+ return { valid: !1 };
3745
+ s.push(l.data);
3746
+ }
3747
+ return { valid: !0, data: s };
3748
+ } else return r === m.date && n === m.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
3749
+ }
3750
+ class Ae extends E {
3751
+ _parse(e) {
3752
+ const { status: r, ctx: n } = this._processInputParams(e), s = (i, a) => {
3753
+ if (vt(i) || vt(a))
3754
+ return b;
3755
+ const o = wt(i.value, a.value);
3756
+ return o.valid ? ((bt(i) || bt(a)) && r.dirty(), { status: r.value, value: o.data }) : (h(n, {
3757
+ code: f.invalid_intersection_types
3758
+ }), b);
3759
+ };
3760
+ return n.common.async ? Promise.all([
3761
+ this._def.left._parseAsync({
3762
+ data: n.data,
3763
+ path: n.path,
3764
+ parent: n
3765
+ }),
3766
+ this._def.right._parseAsync({
3767
+ data: n.data,
3768
+ path: n.path,
3769
+ parent: n
3770
+ })
3771
+ ]).then(([i, a]) => s(i, a)) : s(this._def.left._parseSync({
3772
+ data: n.data,
3773
+ path: n.path,
3774
+ parent: n
3775
+ }), this._def.right._parseSync({
3776
+ data: n.data,
3777
+ path: n.path,
3778
+ parent: n
3779
+ }));
3780
+ }
3781
+ }
3782
+ Ae.create = (t, e, r) => new Ae({
3783
+ left: t,
3784
+ right: e,
3785
+ typeName: v.ZodIntersection,
3786
+ ...x(r)
3787
+ });
3788
+ class W extends E {
3789
+ _parse(e) {
3790
+ const { status: r, ctx: n } = this._processInputParams(e);
3791
+ if (n.parsedType !== m.array)
3792
+ return h(n, {
3793
+ code: f.invalid_type,
3794
+ expected: m.array,
3795
+ received: n.parsedType
3796
+ }), b;
3797
+ if (n.data.length < this._def.items.length)
3798
+ return h(n, {
3799
+ code: f.too_small,
3800
+ minimum: this._def.items.length,
3801
+ inclusive: !0,
3802
+ exact: !1,
3803
+ type: "array"
3804
+ }), b;
3805
+ !this._def.rest && n.data.length > this._def.items.length && (h(n, {
3806
+ code: f.too_big,
3807
+ maximum: this._def.items.length,
3808
+ inclusive: !0,
3809
+ exact: !1,
3810
+ type: "array"
3811
+ }), r.dirty());
3812
+ const i = [...n.data].map((a, o) => {
3813
+ const l = this._def.items[o] || this._def.rest;
3814
+ return l ? l._parse(new H(n, a, n.path, o)) : null;
3815
+ }).filter((a) => !!a);
3816
+ return n.common.async ? Promise.all(i).then((a) => Z.mergeArray(r, a)) : Z.mergeArray(r, i);
3817
+ }
3818
+ get items() {
3819
+ return this._def.items;
3820
+ }
3821
+ rest(e) {
3822
+ return new W({
3823
+ ...this._def,
3824
+ rest: e
3825
+ });
3826
+ }
3827
+ }
3828
+ W.create = (t, e) => {
3829
+ if (!Array.isArray(t))
3830
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3831
+ return new W({
3832
+ items: t,
3833
+ typeName: v.ZodTuple,
3834
+ rest: null,
3835
+ ...x(e)
3836
+ });
3837
+ };
3838
+ class Ce extends E {
3839
+ get keySchema() {
3840
+ return this._def.keyType;
3841
+ }
3842
+ get valueSchema() {
3843
+ return this._def.valueType;
3844
+ }
3845
+ _parse(e) {
3846
+ const { status: r, ctx: n } = this._processInputParams(e);
3847
+ if (n.parsedType !== m.object)
3848
+ return h(n, {
3849
+ code: f.invalid_type,
3850
+ expected: m.object,
3851
+ received: n.parsedType
3852
+ }), b;
3853
+ const s = [], i = this._def.keyType, a = this._def.valueType;
3854
+ for (const o in n.data)
3855
+ s.push({
3856
+ key: i._parse(new H(n, o, n.path, o)),
3857
+ value: a._parse(new H(n, n.data[o], n.path, o)),
3858
+ alwaysSet: o in n.data
3859
+ });
3860
+ return n.common.async ? Z.mergeObjectAsync(r, s) : Z.mergeObjectSync(r, s);
3861
+ }
3862
+ get element() {
3863
+ return this._def.valueType;
3864
+ }
3865
+ static create(e, r, n) {
3866
+ return r instanceof E ? new Ce({
3867
+ keyType: e,
3868
+ valueType: r,
3869
+ typeName: v.ZodRecord,
3870
+ ...x(n)
3871
+ }) : new Ce({
3872
+ keyType: M.create(),
3873
+ valueType: e,
3874
+ typeName: v.ZodRecord,
3875
+ ...x(r)
3876
+ });
3877
+ }
3878
+ }
3879
+ class Ge extends E {
3880
+ get keySchema() {
3881
+ return this._def.keyType;
3882
+ }
3883
+ get valueSchema() {
3884
+ return this._def.valueType;
3885
+ }
3886
+ _parse(e) {
3887
+ const { status: r, ctx: n } = this._processInputParams(e);
3888
+ if (n.parsedType !== m.map)
3889
+ return h(n, {
3890
+ code: f.invalid_type,
3891
+ expected: m.map,
3892
+ received: n.parsedType
3893
+ }), b;
3894
+ const s = this._def.keyType, i = this._def.valueType, a = [...n.data.entries()].map(([o, l], c) => ({
3895
+ key: s._parse(new H(n, o, n.path, [c, "key"])),
3896
+ value: i._parse(new H(n, l, n.path, [c, "value"]))
3897
+ }));
3898
+ if (n.common.async) {
3899
+ const o = /* @__PURE__ */ new Map();
3900
+ return Promise.resolve().then(async () => {
3901
+ for (const l of a) {
3902
+ const c = await l.key, d = await l.value;
3903
+ if (c.status === "aborted" || d.status === "aborted")
3904
+ return b;
3905
+ (c.status === "dirty" || d.status === "dirty") && r.dirty(), o.set(c.value, d.value);
3906
+ }
3907
+ return { status: r.value, value: o };
3908
+ });
3909
+ } else {
3910
+ const o = /* @__PURE__ */ new Map();
3911
+ for (const l of a) {
3912
+ const c = l.key, d = l.value;
3913
+ if (c.status === "aborted" || d.status === "aborted")
3914
+ return b;
3915
+ (c.status === "dirty" || d.status === "dirty") && r.dirty(), o.set(c.value, d.value);
3916
+ }
3917
+ return { status: r.value, value: o };
3918
+ }
3919
+ }
3920
+ }
3921
+ Ge.create = (t, e, r) => new Ge({
3922
+ valueType: e,
3923
+ keyType: t,
3924
+ typeName: v.ZodMap,
3925
+ ...x(r)
3926
+ });
3927
+ class le extends E {
3928
+ _parse(e) {
3929
+ const { status: r, ctx: n } = this._processInputParams(e);
3930
+ if (n.parsedType !== m.set)
3931
+ return h(n, {
3932
+ code: f.invalid_type,
3933
+ expected: m.set,
3934
+ received: n.parsedType
3935
+ }), b;
3936
+ const s = this._def;
3937
+ s.minSize !== null && n.data.size < s.minSize.value && (h(n, {
3938
+ code: f.too_small,
3939
+ minimum: s.minSize.value,
3940
+ type: "set",
3941
+ inclusive: !0,
3942
+ exact: !1,
3943
+ message: s.minSize.message
3944
+ }), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (h(n, {
3945
+ code: f.too_big,
3946
+ maximum: s.maxSize.value,
3947
+ type: "set",
3948
+ inclusive: !0,
3949
+ exact: !1,
3950
+ message: s.maxSize.message
3951
+ }), r.dirty());
3952
+ const i = this._def.valueType;
3953
+ function a(l) {
3954
+ const c = /* @__PURE__ */ new Set();
3955
+ for (const d of l) {
3956
+ if (d.status === "aborted")
3957
+ return b;
3958
+ d.status === "dirty" && r.dirty(), c.add(d.value);
3959
+ }
3960
+ return { status: r.value, value: c };
3961
+ }
3962
+ const o = [...n.data.values()].map((l, c) => i._parse(new H(n, l, n.path, c)));
3963
+ return n.common.async ? Promise.all(o).then((l) => a(l)) : a(o);
3964
+ }
3965
+ min(e, r) {
3966
+ return new le({
3967
+ ...this._def,
3968
+ minSize: { value: e, message: y.toString(r) }
3969
+ });
3970
+ }
3971
+ max(e, r) {
3972
+ return new le({
3973
+ ...this._def,
3974
+ maxSize: { value: e, message: y.toString(r) }
3975
+ });
3976
+ }
3977
+ size(e, r) {
3978
+ return this.min(e, r).max(e, r);
3979
+ }
3980
+ nonempty(e) {
3981
+ return this.min(1, e);
3982
+ }
3983
+ }
3984
+ le.create = (t, e) => new le({
3985
+ valueType: t,
3986
+ minSize: null,
3987
+ maxSize: null,
3988
+ typeName: v.ZodSet,
3989
+ ...x(e)
3990
+ });
3991
+ class pe extends E {
3992
+ constructor() {
3993
+ super(...arguments), this.validate = this.implement;
3994
+ }
3995
+ _parse(e) {
3996
+ const { ctx: r } = this._processInputParams(e);
3997
+ if (r.parsedType !== m.function)
3998
+ return h(r, {
3999
+ code: f.invalid_type,
4000
+ expected: m.function,
4001
+ received: r.parsedType
4002
+ }), b;
4003
+ function n(o, l) {
4004
+ return We({
4005
+ data: o,
4006
+ path: r.path,
4007
+ errorMaps: [
4008
+ r.common.contextualErrorMap,
4009
+ r.schemaErrorMap,
4010
+ He(),
4011
+ me
4012
+ ].filter((c) => !!c),
4013
+ issueData: {
4014
+ code: f.invalid_arguments,
4015
+ argumentsError: l
4016
+ }
4017
+ });
4018
+ }
4019
+ function s(o, l) {
4020
+ return We({
4021
+ data: o,
4022
+ path: r.path,
4023
+ errorMaps: [
4024
+ r.common.contextualErrorMap,
4025
+ r.schemaErrorMap,
4026
+ He(),
4027
+ me
4028
+ ].filter((c) => !!c),
4029
+ issueData: {
4030
+ code: f.invalid_return_type,
4031
+ returnTypeError: l
4032
+ }
4033
+ });
4034
+ }
4035
+ const i = { errorMap: r.common.contextualErrorMap }, a = r.data;
4036
+ if (this._def.returns instanceof ge) {
4037
+ const o = this;
4038
+ return I(async function(...l) {
4039
+ const c = new F([]), d = await o._def.args.parseAsync(l, i).catch((R) => {
4040
+ throw c.addIssue(n(l, R)), c;
4041
+ }), p = await Reflect.apply(a, this, d);
4042
+ return await o._def.returns._def.type.parseAsync(p, i).catch((R) => {
4043
+ throw c.addIssue(s(p, R)), c;
4044
+ });
4045
+ });
4046
+ } else {
4047
+ const o = this;
4048
+ return I(function(...l) {
4049
+ const c = o._def.args.safeParse(l, i);
4050
+ if (!c.success)
4051
+ throw new F([n(l, c.error)]);
4052
+ const d = Reflect.apply(a, this, c.data), p = o._def.returns.safeParse(d, i);
4053
+ if (!p.success)
4054
+ throw new F([s(d, p.error)]);
4055
+ return p.data;
4056
+ });
4057
+ }
4058
+ }
4059
+ parameters() {
4060
+ return this._def.args;
4061
+ }
4062
+ returnType() {
4063
+ return this._def.returns;
4064
+ }
4065
+ args(...e) {
4066
+ return new pe({
4067
+ ...this._def,
4068
+ args: W.create(e).rest(ae.create())
4069
+ });
4070
+ }
4071
+ returns(e) {
4072
+ return new pe({
4073
+ ...this._def,
4074
+ returns: e
4075
+ });
4076
+ }
4077
+ implement(e) {
4078
+ return this.parse(e);
4079
+ }
4080
+ strictImplement(e) {
4081
+ return this.parse(e);
4082
+ }
4083
+ static create(e, r, n) {
4084
+ return new pe({
4085
+ args: e || W.create([]).rest(ae.create()),
4086
+ returns: r || ae.create(),
4087
+ typeName: v.ZodFunction,
4088
+ ...x(n)
4089
+ });
4090
+ }
4091
+ }
4092
+ class Ne extends E {
4093
+ get schema() {
4094
+ return this._def.getter();
4095
+ }
4096
+ _parse(e) {
4097
+ const { ctx: r } = this._processInputParams(e);
4098
+ return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
4099
+ }
4100
+ }
4101
+ Ne.create = (t, e) => new Ne({
4102
+ getter: t,
4103
+ typeName: v.ZodLazy,
4104
+ ...x(e)
4105
+ });
4106
+ class je extends E {
4107
+ _parse(e) {
4108
+ if (e.data !== this._def.value) {
4109
+ const r = this._getOrReturnCtx(e);
4110
+ return h(r, {
4111
+ received: r.data,
4112
+ code: f.invalid_literal,
4113
+ expected: this._def.value
4114
+ }), b;
4115
+ }
4116
+ return { status: "valid", value: e.data };
4117
+ }
4118
+ get value() {
4119
+ return this._def.value;
4120
+ }
4121
+ }
4122
+ je.create = (t, e) => new je({
4123
+ value: t,
4124
+ typeName: v.ZodLiteral,
4125
+ ...x(e)
4126
+ });
4127
+ function br(t, e) {
4128
+ return new te({
4129
+ values: t,
4130
+ typeName: v.ZodEnum,
4131
+ ...x(e)
4132
+ });
4133
+ }
4134
+ class te extends E {
4135
+ constructor() {
4136
+ super(...arguments), we.set(this, void 0);
4137
+ }
4138
+ _parse(e) {
4139
+ if (typeof e.data != "string") {
4140
+ const r = this._getOrReturnCtx(e), n = this._def.values;
4141
+ return h(r, {
4142
+ expected: T.joinValues(n),
4143
+ received: r.parsedType,
4144
+ code: f.invalid_type
4145
+ }), b;
4146
+ }
4147
+ if (Je(this, we) || yr(this, we, new Set(this._def.values)), !Je(this, we).has(e.data)) {
4148
+ const r = this._getOrReturnCtx(e), n = this._def.values;
4149
+ return h(r, {
4150
+ received: r.data,
4151
+ code: f.invalid_enum_value,
4152
+ options: n
4153
+ }), b;
4154
+ }
4155
+ return I(e.data);
4156
+ }
4157
+ get options() {
4158
+ return this._def.values;
4159
+ }
4160
+ get enum() {
4161
+ const e = {};
4162
+ for (const r of this._def.values)
4163
+ e[r] = r;
4164
+ return e;
4165
+ }
4166
+ get Values() {
4167
+ const e = {};
4168
+ for (const r of this._def.values)
4169
+ e[r] = r;
4170
+ return e;
4171
+ }
4172
+ get Enum() {
4173
+ const e = {};
4174
+ for (const r of this._def.values)
4175
+ e[r] = r;
4176
+ return e;
4177
+ }
4178
+ extract(e, r = this._def) {
4179
+ return te.create(e, {
4180
+ ...this._def,
4181
+ ...r
4182
+ });
4183
+ }
4184
+ exclude(e, r = this._def) {
4185
+ return te.create(this.options.filter((n) => !e.includes(n)), {
4186
+ ...this._def,
4187
+ ...r
4188
+ });
4189
+ }
4190
+ }
4191
+ we = /* @__PURE__ */ new WeakMap();
4192
+ te.create = br;
4193
+ class Pe extends E {
4194
+ constructor() {
4195
+ super(...arguments), xe.set(this, void 0);
4196
+ }
4197
+ _parse(e) {
4198
+ const r = T.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
4199
+ if (n.parsedType !== m.string && n.parsedType !== m.number) {
4200
+ const s = T.objectValues(r);
4201
+ return h(n, {
4202
+ expected: T.joinValues(s),
4203
+ received: n.parsedType,
4204
+ code: f.invalid_type
4205
+ }), b;
4206
+ }
4207
+ if (Je(this, xe) || yr(this, xe, new Set(T.getValidEnumValues(this._def.values))), !Je(this, xe).has(e.data)) {
4208
+ const s = T.objectValues(r);
4209
+ return h(n, {
4210
+ received: n.data,
4211
+ code: f.invalid_enum_value,
4212
+ options: s
4213
+ }), b;
4214
+ }
4215
+ return I(e.data);
4216
+ }
4217
+ get enum() {
4218
+ return this._def.values;
4219
+ }
4220
+ }
4221
+ xe = /* @__PURE__ */ new WeakMap();
4222
+ Pe.create = (t, e) => new Pe({
4223
+ values: t,
4224
+ typeName: v.ZodNativeEnum,
4225
+ ...x(e)
4226
+ });
4227
+ class ge extends E {
4228
+ unwrap() {
4229
+ return this._def.type;
4230
+ }
4231
+ _parse(e) {
4232
+ const { ctx: r } = this._processInputParams(e);
4233
+ if (r.parsedType !== m.promise && r.common.async === !1)
4234
+ return h(r, {
4235
+ code: f.invalid_type,
4236
+ expected: m.promise,
4237
+ received: r.parsedType
4238
+ }), b;
4239
+ const n = r.parsedType === m.promise ? r.data : Promise.resolve(r.data);
4240
+ return I(n.then((s) => this._def.type.parseAsync(s, {
4241
+ path: r.path,
4242
+ errorMap: r.common.contextualErrorMap
4243
+ })));
4244
+ }
4245
+ }
4246
+ ge.create = (t, e) => new ge({
4247
+ type: t,
4248
+ typeName: v.ZodPromise,
4249
+ ...x(e)
4250
+ });
4251
+ class $ extends E {
4252
+ innerType() {
4253
+ return this._def.schema;
4254
+ }
4255
+ sourceType() {
4256
+ return this._def.schema._def.typeName === v.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
4257
+ }
4258
+ _parse(e) {
4259
+ const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, i = {
4260
+ addIssue: (a) => {
4261
+ h(n, a), a.fatal ? r.abort() : r.dirty();
4262
+ },
4263
+ get path() {
4264
+ return n.path;
4265
+ }
4266
+ };
4267
+ if (i.addIssue = i.addIssue.bind(i), s.type === "preprocess") {
4268
+ const a = s.transform(n.data, i);
4269
+ if (n.common.async)
4270
+ return Promise.resolve(a).then(async (o) => {
4271
+ if (r.value === "aborted")
4272
+ return b;
4273
+ const l = await this._def.schema._parseAsync({
4274
+ data: o,
4275
+ path: n.path,
4276
+ parent: n
4277
+ });
4278
+ return l.status === "aborted" ? b : l.status === "dirty" || r.value === "dirty" ? he(l.value) : l;
4279
+ });
4280
+ {
4281
+ if (r.value === "aborted")
4282
+ return b;
4283
+ const o = this._def.schema._parseSync({
4284
+ data: a,
4285
+ path: n.path,
4286
+ parent: n
4287
+ });
4288
+ return o.status === "aborted" ? b : o.status === "dirty" || r.value === "dirty" ? he(o.value) : o;
4289
+ }
4290
+ }
4291
+ if (s.type === "refinement") {
4292
+ const a = (o) => {
4293
+ const l = s.refinement(o, i);
4294
+ if (n.common.async)
4295
+ return Promise.resolve(l);
4296
+ if (l instanceof Promise)
4297
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
4298
+ return o;
4299
+ };
4300
+ if (n.common.async === !1) {
4301
+ const o = this._def.schema._parseSync({
4302
+ data: n.data,
4303
+ path: n.path,
4304
+ parent: n
4305
+ });
4306
+ return o.status === "aborted" ? b : (o.status === "dirty" && r.dirty(), a(o.value), { status: r.value, value: o.value });
4307
+ } else
4308
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? b : (o.status === "dirty" && r.dirty(), a(o.value).then(() => ({ status: r.value, value: o.value }))));
4309
+ }
4310
+ if (s.type === "transform")
4311
+ if (n.common.async === !1) {
4312
+ const a = this._def.schema._parseSync({
4313
+ data: n.data,
4314
+ path: n.path,
4315
+ parent: n
4316
+ });
4317
+ if (!ce(a))
4318
+ return a;
4319
+ const o = s.transform(a.value, i);
4320
+ if (o instanceof Promise)
4321
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
4322
+ return { status: r.value, value: o };
4323
+ } else
4324
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ce(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({ status: r.value, value: o })) : a);
4325
+ T.assertNever(s);
4326
+ }
4327
+ }
4328
+ $.create = (t, e, r) => new $({
4329
+ schema: t,
4330
+ typeName: v.ZodEffects,
4331
+ effect: e,
4332
+ ...x(r)
4333
+ });
4334
+ $.createWithPreprocess = (t, e, r) => new $({
4335
+ schema: e,
4336
+ effect: { type: "preprocess", transform: t },
4337
+ typeName: v.ZodEffects,
4338
+ ...x(r)
4339
+ });
4340
+ class q extends E {
4341
+ _parse(e) {
4342
+ return this._getType(e) === m.undefined ? I(void 0) : this._def.innerType._parse(e);
4343
+ }
4344
+ unwrap() {
4345
+ return this._def.innerType;
4346
+ }
4347
+ }
4348
+ q.create = (t, e) => new q({
4349
+ innerType: t,
4350
+ typeName: v.ZodOptional,
4351
+ ...x(e)
4352
+ });
4353
+ class re extends E {
4354
+ _parse(e) {
4355
+ return this._getType(e) === m.null ? I(null) : this._def.innerType._parse(e);
4356
+ }
4357
+ unwrap() {
4358
+ return this._def.innerType;
4359
+ }
4360
+ }
4361
+ re.create = (t, e) => new re({
4362
+ innerType: t,
4363
+ typeName: v.ZodNullable,
4364
+ ...x(e)
4365
+ });
4366
+ class Ze extends E {
4367
+ _parse(e) {
4368
+ const { ctx: r } = this._processInputParams(e);
4369
+ let n = r.data;
4370
+ return r.parsedType === m.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
4371
+ data: n,
4372
+ path: r.path,
4373
+ parent: r
4374
+ });
4375
+ }
4376
+ removeDefault() {
4377
+ return this._def.innerType;
4378
+ }
4379
+ }
4380
+ Ze.create = (t, e) => new Ze({
4381
+ innerType: t,
4382
+ typeName: v.ZodDefault,
4383
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
4384
+ ...x(e)
4385
+ });
4386
+ class Ie extends E {
4387
+ _parse(e) {
4388
+ const { ctx: r } = this._processInputParams(e), n = {
4389
+ ...r,
4390
+ common: {
4391
+ ...r.common,
4392
+ issues: []
4393
+ }
4394
+ }, s = this._def.innerType._parse({
4395
+ data: n.data,
4396
+ path: n.path,
4397
+ parent: {
4398
+ ...n
4399
+ }
4400
+ });
4401
+ return Ee(s) ? s.then((i) => ({
4402
+ status: "valid",
4403
+ value: i.status === "valid" ? i.value : this._def.catchValue({
4404
+ get error() {
4405
+ return new F(n.common.issues);
4406
+ },
4407
+ input: n.data
4408
+ })
4409
+ })) : {
4410
+ status: "valid",
4411
+ value: s.status === "valid" ? s.value : this._def.catchValue({
4412
+ get error() {
4413
+ return new F(n.common.issues);
4414
+ },
4415
+ input: n.data
4416
+ })
4417
+ };
4418
+ }
4419
+ removeCatch() {
4420
+ return this._def.innerType;
4421
+ }
4422
+ }
4423
+ Ie.create = (t, e) => new Ie({
4424
+ innerType: t,
4425
+ typeName: v.ZodCatch,
4426
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
4427
+ ...x(e)
4428
+ });
4429
+ class Ye extends E {
4430
+ _parse(e) {
4431
+ if (this._getType(e) !== m.nan) {
4432
+ const n = this._getOrReturnCtx(e);
4433
+ return h(n, {
4434
+ code: f.invalid_type,
4435
+ expected: m.nan,
4436
+ received: n.parsedType
4437
+ }), b;
4438
+ }
4439
+ return { status: "valid", value: e.data };
4440
+ }
4441
+ }
4442
+ Ye.create = (t) => new Ye({
4443
+ typeName: v.ZodNaN,
4444
+ ...x(t)
4445
+ });
4446
+ const Rs = Symbol("zod_brand");
4447
+ class St extends E {
4448
+ _parse(e) {
4449
+ const { ctx: r } = this._processInputParams(e), n = r.data;
4450
+ return this._def.type._parse({
4451
+ data: n,
4452
+ path: r.path,
4453
+ parent: r
4454
+ });
4455
+ }
4456
+ unwrap() {
4457
+ return this._def.type;
4458
+ }
4459
+ }
4460
+ class Fe extends E {
4461
+ _parse(e) {
4462
+ const { status: r, ctx: n } = this._processInputParams(e);
4463
+ if (n.common.async)
4464
+ return (async () => {
4465
+ const i = await this._def.in._parseAsync({
4466
+ data: n.data,
4467
+ path: n.path,
4468
+ parent: n
4469
+ });
4470
+ return i.status === "aborted" ? b : i.status === "dirty" ? (r.dirty(), he(i.value)) : this._def.out._parseAsync({
4471
+ data: i.value,
4472
+ path: n.path,
4473
+ parent: n
4474
+ });
4475
+ })();
4476
+ {
4477
+ const s = this._def.in._parseSync({
4478
+ data: n.data,
4479
+ path: n.path,
4480
+ parent: n
4481
+ });
4482
+ return s.status === "aborted" ? b : s.status === "dirty" ? (r.dirty(), {
4483
+ status: "dirty",
4484
+ value: s.value
4485
+ }) : this._def.out._parseSync({
4486
+ data: s.value,
4487
+ path: n.path,
4488
+ parent: n
4489
+ });
4490
+ }
4491
+ }
4492
+ static create(e, r) {
4493
+ return new Fe({
4494
+ in: e,
4495
+ out: r,
4496
+ typeName: v.ZodPipeline
4497
+ });
4498
+ }
4499
+ }
4500
+ class De extends E {
4501
+ _parse(e) {
4502
+ const r = this._def.innerType._parse(e), n = (s) => (ce(s) && (s.value = Object.freeze(s.value)), s);
4503
+ return Ee(r) ? r.then((s) => n(s)) : n(r);
4504
+ }
4505
+ unwrap() {
4506
+ return this._def.innerType;
4507
+ }
4508
+ }
4509
+ De.create = (t, e) => new De({
4510
+ innerType: t,
4511
+ typeName: v.ZodReadonly,
4512
+ ...x(e)
4513
+ });
4514
+ function $t(t, e) {
4515
+ const r = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
4516
+ return typeof r == "string" ? { message: r } : r;
4517
+ }
4518
+ function wr(t, e = {}, r) {
4519
+ return t ? ye.create().superRefine((n, s) => {
4520
+ var i, a;
4521
+ const o = t(n);
4522
+ if (o instanceof Promise)
4523
+ return o.then((l) => {
4524
+ var c, d;
4525
+ if (!l) {
4526
+ const p = $t(e, n), S = (d = (c = p.fatal) !== null && c !== void 0 ? c : r) !== null && d !== void 0 ? d : !0;
4527
+ s.addIssue({ code: "custom", ...p, fatal: S });
4528
+ }
4529
+ });
4530
+ if (!o) {
4531
+ const l = $t(e, n), c = (a = (i = l.fatal) !== null && i !== void 0 ? i : r) !== null && a !== void 0 ? a : !0;
4532
+ s.addIssue({ code: "custom", ...l, fatal: c });
4533
+ }
4534
+ }) : ye.create();
4535
+ }
4536
+ const Os = {
4537
+ object: O.lazycreate
4538
+ };
4539
+ var v;
4540
+ (function(t) {
4541
+ t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
4542
+ })(v || (v = {}));
4543
+ const As = (t, e = {
4544
+ message: `Input not instance of ${t.name}`
4545
+ }) => wr((r) => r instanceof t, e), xr = M.create, kr = Q.create, Cs = Ye.create, Ns = ee.create, Er = Te.create, js = ue.create, Ps = Ke.create, Zs = Se.create, Is = Re.create, Ds = ye.create, Ls = ae.create, Us = G.create, Fs = Xe.create, Ms = B.create, Bs = O.create, $s = O.strictCreate, Vs = Oe.create, zs = ot.create, qs = Ae.create, Hs = W.create, Ws = Ce.create, Js = Ge.create, Ks = le.create, Xs = pe.create, Gs = Ne.create, Ys = je.create, Qs = te.create, ei = Pe.create, ti = ge.create, Vt = $.create, ri = q.create, ni = re.create, si = $.createWithPreprocess, ii = Fe.create, ai = () => xr().optional(), oi = () => kr().optional(), ci = () => Er().optional(), ui = {
4546
+ string: (t) => M.create({ ...t, coerce: !0 }),
4547
+ number: (t) => Q.create({ ...t, coerce: !0 }),
4548
+ boolean: (t) => Te.create({
4549
+ ...t,
4550
+ coerce: !0
4551
+ }),
4552
+ bigint: (t) => ee.create({ ...t, coerce: !0 }),
4553
+ date: (t) => ue.create({ ...t, coerce: !0 })
4554
+ }, li = b;
4555
+ var Ni = /* @__PURE__ */ Object.freeze({
4556
+ __proto__: null,
4557
+ defaultErrorMap: me,
4558
+ setErrorMap: ss,
4559
+ getErrorMap: He,
4560
+ makeIssue: We,
4561
+ EMPTY_PATH: is,
4562
+ addIssueToContext: h,
4563
+ ParseStatus: Z,
4564
+ INVALID: b,
4565
+ DIRTY: he,
4566
+ OK: I,
4567
+ isAborted: vt,
4568
+ isDirty: bt,
4569
+ isValid: ce,
4570
+ isAsync: Ee,
4571
+ get util() {
4572
+ return T;
4573
+ },
4574
+ get objectUtil() {
4575
+ return _t;
4576
+ },
4577
+ ZodParsedType: m,
4578
+ getParsedType: X,
4579
+ ZodType: E,
4580
+ datetimeRegex: vr,
4581
+ ZodString: M,
4582
+ ZodNumber: Q,
4583
+ ZodBigInt: ee,
4584
+ ZodBoolean: Te,
4585
+ ZodDate: ue,
4586
+ ZodSymbol: Ke,
4587
+ ZodUndefined: Se,
4588
+ ZodNull: Re,
4589
+ ZodAny: ye,
4590
+ ZodUnknown: ae,
4591
+ ZodNever: G,
4592
+ ZodVoid: Xe,
4593
+ ZodArray: B,
4594
+ ZodObject: O,
4595
+ ZodUnion: Oe,
4596
+ ZodDiscriminatedUnion: ot,
4597
+ ZodIntersection: Ae,
4598
+ ZodTuple: W,
4599
+ ZodRecord: Ce,
4600
+ ZodMap: Ge,
4601
+ ZodSet: le,
4602
+ ZodFunction: pe,
4603
+ ZodLazy: Ne,
4604
+ ZodLiteral: je,
4605
+ ZodEnum: te,
4606
+ ZodNativeEnum: Pe,
4607
+ ZodPromise: ge,
4608
+ ZodEffects: $,
4609
+ ZodTransformer: $,
4610
+ ZodOptional: q,
4611
+ ZodNullable: re,
4612
+ ZodDefault: Ze,
4613
+ ZodCatch: Ie,
4614
+ ZodNaN: Ye,
4615
+ BRAND: Rs,
4616
+ ZodBranded: St,
4617
+ ZodPipeline: Fe,
4618
+ ZodReadonly: De,
4619
+ custom: wr,
4620
+ Schema: E,
4621
+ ZodSchema: E,
4622
+ late: Os,
4623
+ get ZodFirstPartyTypeKind() {
4624
+ return v;
4625
+ },
4626
+ coerce: ui,
4627
+ any: Ds,
4628
+ array: Ms,
4629
+ bigint: Ns,
4630
+ boolean: Er,
4631
+ date: js,
4632
+ discriminatedUnion: zs,
4633
+ effect: Vt,
4634
+ enum: Qs,
4635
+ function: Xs,
4636
+ instanceof: As,
4637
+ intersection: qs,
4638
+ lazy: Gs,
4639
+ literal: Ys,
4640
+ map: Js,
4641
+ nan: Cs,
4642
+ nativeEnum: ei,
4643
+ never: Us,
4644
+ null: Is,
4645
+ nullable: ni,
4646
+ number: kr,
4647
+ object: Bs,
4648
+ oboolean: ci,
4649
+ onumber: oi,
4650
+ optional: ri,
4651
+ ostring: ai,
4652
+ pipeline: ii,
4653
+ preprocess: si,
4654
+ promise: ti,
4655
+ record: Ws,
4656
+ set: Ks,
4657
+ strictObject: $s,
4658
+ string: xr,
4659
+ symbol: Ps,
4660
+ transformer: Vt,
4661
+ tuple: Hs,
4662
+ undefined: Zs,
4663
+ union: Vs,
4664
+ unknown: Ls,
4665
+ void: Fs,
4666
+ NEVER: li,
4667
+ ZodIssueCode: f,
4668
+ quotelessJson: ns,
4669
+ ZodError: F
4670
+ });
4671
+ class de extends Error {
4672
+ constructor(e, r) {
4673
+ super(
4674
+ e.detail || e.title || r?.message || "An API error occurred"
4675
+ ), this.problemDetail = e, this.originalError = r, this.name = "ApiError", Object.setPrototypeOf(this, de.prototype);
4676
+ }
4677
+ get status() {
4678
+ return this.problemDetail.status;
4679
+ }
4680
+ get body() {
4681
+ return this.problemDetail;
4682
+ }
4683
+ get isClientError() {
4684
+ return this.status >= 400 && this.status < 500;
4685
+ }
4686
+ get isServerError() {
4687
+ return this.status >= 500;
4688
+ }
4689
+ get isUnauthorized() {
4690
+ return this.status === 401;
4691
+ }
4692
+ get isForbidden() {
4693
+ return this.status === 403;
4694
+ }
4695
+ get isNotFound() {
4696
+ return this.status === 404;
4697
+ }
4698
+ static builder() {
4699
+ return new Qe(null);
4700
+ }
4701
+ static of(e) {
4702
+ return console.error("ApiError#of", e), pi(e);
4703
+ }
4704
+ }
4705
+ class Qe {
4706
+ constructor(e) {
4707
+ this._originalError = e, this._problemDetail = {
4708
+ title: e?.name || "ApiError",
4709
+ detail: e?.message || "",
4710
+ status: Tt.InternalServerError,
4711
+ type: "about:blank"
4712
+ };
4713
+ }
4714
+ /**
4715
+ * Set standard ProblemDetail
4716
+ */
4717
+ problemDetail(e) {
4718
+ return e && (this._problemDetail = e), this;
4719
+ }
4720
+ originalError(e) {
4721
+ return this._originalError = e, this._problemDetail.title = e.name, this._problemDetail.detail = e.message, this;
4722
+ }
4723
+ message(e) {
4724
+ return this._problemDetail.detail = e, this;
4725
+ }
4726
+ status(e) {
4727
+ return this._problemDetail.status = e, this;
4728
+ }
4729
+ errors(e) {
4730
+ return this._problemDetail.errors = e || {}, this;
4731
+ }
4732
+ title(e) {
4733
+ return this._problemDetail.title = e, this;
4734
+ }
4735
+ instance(e) {
4736
+ return this._problemDetail.instance = e, this;
4737
+ }
4738
+ build() {
4739
+ return new de(this._problemDetail, this._originalError);
4740
+ }
4741
+ }
4742
+ function di(t) {
4743
+ if (!t.data)
4744
+ return null;
4745
+ const e = t.data;
4746
+ return typeof e == "object" && "type" in e && "title" in e && "status" in e ? e : null;
4747
+ }
4748
+ function fi(t) {
4749
+ const e = new Qe(t);
4750
+ if (e.instance(t.config.url), t.status && e.status(t.status), t.response && t.response.data) {
4751
+ const r = di(t.response);
4752
+ if (r !== null)
4753
+ return e.problemDetail(r).build();
4754
+ }
4755
+ return t.code === "ECONNREFUSED" && e.status(Tt.ServiceUnavailable).message("Failed to connect to service").title("Service Unavailable"), e.build();
4756
+ }
4757
+ function hi(t) {
4758
+ const e = {};
4759
+ return t.errors.forEach((r) => {
4760
+ r.path.forEach((n) => {
4761
+ e[n] = r.message;
4762
+ });
4763
+ }), de.builder().originalError(t).status(Tt.BadRequest).message("Validation Error").errors(e).build();
4764
+ }
4765
+ function ji(t) {
4766
+ return t instanceof de ? t.problemDetail.detail ? t.problemDetail.detail : t.problemDetail.title ? t.problemDetail.title : t.message : t instanceof Error ? t.message : "An unexpected error occurred";
4767
+ }
4768
+ function Pi(t, e) {
4769
+ return t instanceof de && t.status === e;
4770
+ }
4771
+ function pi(t) {
4772
+ if (t instanceof de)
4773
+ return t;
4774
+ if (t instanceof rs)
4775
+ return fi(t);
4776
+ if (t instanceof F)
4777
+ return hi(t);
4778
+ if (t instanceof Error)
4779
+ return new Qe(t).build();
4780
+ const e = new Error("Unknown api error");
4781
+ return new Qe(e).instance("handleApiError").build();
4782
+ }
4783
+ export {
4784
+ de as A,
4785
+ C as a,
4786
+ fi as b,
4787
+ hi as c,
4788
+ ji as g,
4789
+ pi as h,
4790
+ Pi as i,
4791
+ Ni as z
4792
+ };