@next-feature/client 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,4831 @@
1
+ function $t(t, e) {
2
+ return function() {
3
+ return t.apply(e, arguments);
4
+ };
5
+ }
6
+ const { toString: _r } = Object.prototype, { getPrototypeOf: vt } = Object, { iterator: He, toStringTag: zt } = Symbol, We = /* @__PURE__ */ ((t) => (e) => {
7
+ const r = _r.call(e);
8
+ return t[r] || (t[r] = r.slice(8, -1).toLowerCase());
9
+ })(/* @__PURE__ */ Object.create(null)), M = (t) => (t = t.toLowerCase(), (e) => We(e) === t), Je = (t) => (e) => typeof e === t, { isArray: he } = Array, be = Je("undefined");
10
+ function vr(t) {
11
+ return t !== null && !be(t) && t.constructor !== null && !be(t.constructor) && L(t.constructor.isBuffer) && t.constructor.isBuffer(t);
12
+ }
13
+ const qt = M("ArrayBuffer");
14
+ function br(t) {
15
+ let e;
16
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && qt(t.buffer), e;
17
+ }
18
+ const wr = Je("string"), L = Je("function"), Vt = Je("number"), Ke = (t) => t !== null && typeof t == "object", xr = (t) => t === !0 || t === !1, Te = (t) => {
19
+ if (We(t) !== "object")
20
+ return !1;
21
+ const e = vt(t);
22
+ return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(zt in t) && !(He in t);
23
+ }, kr = M("Date"), Er = M("File"), Rr = M("Blob"), Sr = M("FileList"), Tr = (t) => Ke(t) && L(t.pipe), Ar = (t) => {
24
+ let e;
25
+ return t && (typeof FormData == "function" && t instanceof FormData || L(t.append) && ((e = We(t)) === "formdata" || // detect form-data instance
26
+ e === "object" && L(t.toString) && t.toString() === "[object FormData]"));
27
+ }, Or = M("URLSearchParams"), [Cr, Nr, jr, Pr] = ["ReadableStream", "Request", "Response", "Headers"].map(M), Ir = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
28
+ function Ee(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]), he(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 Ht(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 ee = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Wt = (t) => !be(t) && t !== ee;
52
+ function st() {
53
+ const { caseless: t } = Wt(this) && this || {}, e = {}, r = (n, s) => {
54
+ const i = t && Ht(e, s) || s;
55
+ Te(e[i]) && Te(n) ? e[i] = st(e[i], n) : Te(n) ? e[i] = st({}, n) : he(n) ? e[i] = n.slice() : e[i] = n;
56
+ };
57
+ for (let n = 0, s = arguments.length; n < s; n++)
58
+ arguments[n] && Ee(arguments[n], r);
59
+ return e;
60
+ }
61
+ const Dr = (t, e, r, { allOwnKeys: n } = {}) => (Ee(e, (s, i) => {
62
+ r && L(s) ? t[i] = $t(s, r) : t[i] = s;
63
+ }, { allOwnKeys: n }), t), Lr = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), Ur = (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
+ }, Fr = (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 && vt(t);
75
+ } while (t && (!r || r(t, e)) && t !== Object.prototype);
76
+ return e;
77
+ }, Zr = (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
+ }, Mr = (t) => {
82
+ if (!t) return null;
83
+ if (he(t)) return t;
84
+ let e = t.length;
85
+ if (!Vt(e)) return null;
86
+ const r = new Array(e);
87
+ for (; e-- > 0; )
88
+ r[e] = t[e];
89
+ return r;
90
+ }, Br = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && vt(Uint8Array)), $r = (t, e) => {
91
+ const n = (t && t[He]).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
+ }, zr = (t, e) => {
98
+ let r;
99
+ const n = [];
100
+ for (; (r = t.exec(e)) !== null; )
101
+ n.push(r);
102
+ return n;
103
+ }, qr = M("HTMLFormElement"), Vr = (t) => t.toLowerCase().replace(
104
+ /[-_\s]([a-z\d])(\w*)/g,
105
+ function(r, n, s) {
106
+ return n.toUpperCase() + s;
107
+ }
108
+ ), Rt = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Hr = M("RegExp"), Jt = (t, e) => {
109
+ const r = Object.getOwnPropertyDescriptors(t), n = {};
110
+ Ee(r, (s, i) => {
111
+ let a;
112
+ (a = e(s, i, t)) !== !1 && (n[i] = a || s);
113
+ }), Object.defineProperties(t, n);
114
+ }, Wr = (t) => {
115
+ Jt(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
+ }, Jr = (t, e) => {
130
+ const r = {}, n = (s) => {
131
+ s.forEach((i) => {
132
+ r[i] = !0;
133
+ });
134
+ };
135
+ return he(t) ? n(t) : n(String(t).split(e)), r;
136
+ }, Kr = () => {
137
+ }, Xr = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
138
+ function Gr(t) {
139
+ return !!(t && L(t.append) && t[zt] === "FormData" && t[He]);
140
+ }
141
+ const Yr = (t) => {
142
+ const e = new Array(10), r = (n, s) => {
143
+ if (Ke(n)) {
144
+ if (e.indexOf(n) >= 0)
145
+ return;
146
+ if (!("toJSON" in n)) {
147
+ e[s] = n;
148
+ const i = he(n) ? [] : {};
149
+ return Ee(n, (a, o) => {
150
+ const d = r(a, s + 1);
151
+ !be(d) && (i[o] = d);
152
+ }), e[s] = void 0, i;
153
+ }
154
+ }
155
+ return n;
156
+ };
157
+ return r(t, 0);
158
+ }, Qr = M("AsyncFunction"), en = (t) => t && (Ke(t) || L(t)) && L(t.then) && L(t.catch), Kt = ((t, e) => t ? setImmediate : e ? ((r, n) => (ee.addEventListener("message", ({ source: s, data: i }) => {
159
+ s === ee && i === r && n.length && n.shift()();
160
+ }, !1), (s) => {
161
+ n.push(s), ee.postMessage(r, "*");
162
+ }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
163
+ typeof setImmediate == "function",
164
+ L(ee.postMessage)
165
+ ), tn = typeof queueMicrotask < "u" ? queueMicrotask.bind(ee) : typeof process < "u" && process.nextTick || Kt, rn = (t) => t != null && L(t[He]), u = {
166
+ isArray: he,
167
+ isArrayBuffer: qt,
168
+ isBuffer: vr,
169
+ isFormData: Ar,
170
+ isArrayBufferView: br,
171
+ isString: wr,
172
+ isNumber: Vt,
173
+ isBoolean: xr,
174
+ isObject: Ke,
175
+ isPlainObject: Te,
176
+ isReadableStream: Cr,
177
+ isRequest: Nr,
178
+ isResponse: jr,
179
+ isHeaders: Pr,
180
+ isUndefined: be,
181
+ isDate: kr,
182
+ isFile: Er,
183
+ isBlob: Rr,
184
+ isRegExp: Hr,
185
+ isFunction: L,
186
+ isStream: Tr,
187
+ isURLSearchParams: Or,
188
+ isTypedArray: Br,
189
+ isFileList: Sr,
190
+ forEach: Ee,
191
+ merge: st,
192
+ extend: Dr,
193
+ trim: Ir,
194
+ stripBOM: Lr,
195
+ inherits: Ur,
196
+ toFlatObject: Fr,
197
+ kindOf: We,
198
+ kindOfTest: M,
199
+ endsWith: Zr,
200
+ toArray: Mr,
201
+ forEachEntry: $r,
202
+ matchAll: zr,
203
+ isHTMLForm: qr,
204
+ hasOwnProperty: Rt,
205
+ hasOwnProp: Rt,
206
+ // an alias to avoid ESLint no-prototype-builtins detection
207
+ reduceDescriptors: Jt,
208
+ freezeMethods: Wr,
209
+ toObjectSet: Jr,
210
+ toCamelCase: Vr,
211
+ noop: Kr,
212
+ toFiniteNumber: Xr,
213
+ findKey: Ht,
214
+ global: ee,
215
+ isContextDefined: Wt,
216
+ isSpecCompliantForm: Gr,
217
+ toJSONObject: Yr,
218
+ isAsyncFn: Qr,
219
+ isThenable: en,
220
+ setImmediate: Kt,
221
+ asap: tn,
222
+ isIterable: rn
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 Xt = w.prototype, Gt = {};
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
+ Gt[t] = { value: t };
265
+ });
266
+ Object.defineProperties(w, Gt);
267
+ Object.defineProperty(Xt, "isAxiosError", { value: !0 });
268
+ w.from = (t, e, r, n, s, i) => {
269
+ const a = Object.create(Xt);
270
+ return u.toFlatObject(t, a, function(d) {
271
+ return d !== 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 nn = null;
275
+ function it(t) {
276
+ return u.isPlainObject(t) || u.isArray(t);
277
+ }
278
+ function Yt(t) {
279
+ return u.endsWith(t, "[]") ? t.slice(0, -2) : t;
280
+ }
281
+ function St(t, e, r) {
282
+ return t ? t.concat(e).map(function(s, i) {
283
+ return s = Yt(s), !r && i ? "[" + s + "]" : s;
284
+ }).join(r ? "." : "") : e;
285
+ }
286
+ function sn(t) {
287
+ return u.isArray(t) && !t.some(it);
288
+ }
289
+ const an = u.toFlatObject(u, {}, null, function(e) {
290
+ return /^is[A-Z]/.test(e);
291
+ });
292
+ function Xe(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 || l, i = r.dots, a = r.indexes, d = (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 (!d && u.isBlob(g))
310
+ throw new w("Blob is not supported. Use a Buffer instead.");
311
+ return u.isArrayBuffer(g) || u.isTypedArray(g) ? d && typeof Blob == "function" ? new Blob([g]) : Buffer.from(g) : g;
312
+ }
313
+ function l(g, k, _) {
314
+ let O = 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) && sn(g) || (u.isFileList(g) || u.endsWith(k, "[]")) && (O = u.toArray(g)))
319
+ return k = Yt(k), O.forEach(function(j, q) {
320
+ !(u.isUndefined(j) || j === null) && e.append(
321
+ // eslint-disable-next-line no-nested-ternary
322
+ a === !0 ? St([k], q, i) : a === null ? k : k + "[]",
323
+ c(j)
324
+ );
325
+ }), !1;
326
+ }
327
+ return it(g) ? !0 : (e.append(St(_, k, i), c(g)), !1);
328
+ }
329
+ const m = [], S = Object.assign(an, {
330
+ defaultVisitor: l,
331
+ convertValue: c,
332
+ isVisitable: it
333
+ });
334
+ function T(g, k) {
335
+ if (!u.isUndefined(g)) {
336
+ if (m.indexOf(g) !== -1)
337
+ throw Error("Circular reference detected in " + k.join("."));
338
+ m.push(g), u.forEach(g, function(O, N) {
339
+ (!(u.isUndefined(O) || O === null) && s.call(
340
+ e,
341
+ O,
342
+ u.isString(N) ? N.trim() : N,
343
+ k,
344
+ S
345
+ )) === !0 && T(O, k ? k.concat(N) : [N]);
346
+ }), m.pop();
347
+ }
348
+ }
349
+ if (!u.isObject(t))
350
+ throw new TypeError("data must be an object");
351
+ return T(t), e;
352
+ }
353
+ function Tt(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 bt(t, e) {
368
+ this._pairs = [], t && Xe(t, this, e);
369
+ }
370
+ const Qt = bt.prototype;
371
+ Qt.append = function(e, r) {
372
+ this._pairs.push([e, r]);
373
+ };
374
+ Qt.toString = function(e) {
375
+ const r = e ? function(n) {
376
+ return e.call(this, n, Tt);
377
+ } : Tt;
378
+ return this._pairs.map(function(s) {
379
+ return r(s[0]) + "=" + r(s[1]);
380
+ }, "").join("&");
381
+ };
382
+ function on(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 er(t, e, r) {
386
+ if (!e)
387
+ return t;
388
+ const n = r && r.encode || on;
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 bt(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 At {
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 tr = {
455
+ silentJSONParsing: !0,
456
+ forcedJSONParsing: !0,
457
+ clarifyTimeoutError: !1
458
+ }, cn = typeof URLSearchParams < "u" ? URLSearchParams : bt, un = typeof FormData < "u" ? FormData : null, ln = typeof Blob < "u" ? Blob : null, dn = {
459
+ isBrowser: !0,
460
+ classes: {
461
+ URLSearchParams: cn,
462
+ FormData: un,
463
+ Blob: ln
464
+ },
465
+ protocols: ["http", "https", "file", "blob", "url", "data"]
466
+ }, wt = typeof window < "u" && typeof document < "u", at = typeof navigator == "object" && navigator || void 0, fn = wt && (!at || ["ReactNative", "NativeScript", "NS"].indexOf(at.product) < 0), hn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
467
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", pn = wt && window.location.href || "http://localhost", mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
468
+ __proto__: null,
469
+ hasBrowserEnv: wt,
470
+ hasStandardBrowserEnv: fn,
471
+ hasStandardBrowserWebWorkerEnv: hn,
472
+ navigator: at,
473
+ origin: pn
474
+ }, Symbol.toStringTag, { value: "Module" })), P = {
475
+ ...mn,
476
+ ...dn
477
+ };
478
+ function yn(t, e) {
479
+ return Xe(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 gn(t) {
486
+ return u.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
487
+ }
488
+ function _n(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 rr(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), d = i >= r.length;
502
+ return a = !a && u.isArray(s) ? s.length : a, d ? (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] = _n(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(gn(n), s, r, 0);
508
+ }), r;
509
+ }
510
+ return null;
511
+ }
512
+ function vn(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 Re = {
523
+ transitional: tr,
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(rr(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 yn(e, this.formSerializer).toString();
539
+ if ((o = u.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
540
+ const d = this.env && this.env.FormData;
541
+ return Xe(
542
+ o ? { "files[]": e } : e,
543
+ d && new d(),
544
+ this.formSerializer
545
+ );
546
+ }
547
+ }
548
+ return i || s ? (r.setContentType("application/json", !1), vn(e)) : e;
549
+ }],
550
+ transformResponse: [function(e) {
551
+ const r = this.transitional || Re.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
+ Re.headers[t] = {};
590
+ });
591
+ const bn = 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
+ ]), wn = (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] && bn[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n);
615
+ }), e;
616
+ }, Ot = Symbol("internals");
617
+ function me(t) {
618
+ return t && String(t).trim().toLowerCase();
619
+ }
620
+ function Ae(t) {
621
+ return t === !1 || t == null ? t : u.isArray(t) ? t.map(Ae) : String(t);
622
+ }
623
+ function xn(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 kn = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
631
+ function et(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 En(t) {
642
+ return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n);
643
+ }
644
+ function Rn(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, d, c) {
662
+ const l = me(d);
663
+ if (!l)
664
+ throw new Error("header name must be a non-empty string");
665
+ const m = u.findKey(s, l);
666
+ (!m || s[m] === void 0 || c === !0 || c === void 0 && s[m] !== !1) && (s[m || d] = Ae(o));
667
+ }
668
+ const a = (o, d) => u.forEach(o, (c, l) => i(c, l, d));
669
+ if (u.isPlainObject(e) || e instanceof this.constructor)
670
+ a(e, r);
671
+ else if (u.isString(e) && (e = e.trim()) && !kn(e))
672
+ a(wn(e), r);
673
+ else if (u.isObject(e) && u.isIterable(e)) {
674
+ let o = {}, d, c;
675
+ for (const l of e) {
676
+ if (!u.isArray(l))
677
+ throw TypeError("Object iterator must return a key-value pair");
678
+ o[c = l[0]] = (d = o[c]) ? u.isArray(d) ? [...d, l[1]] : [d, l[1]] : l[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 = me(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 xn(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 = me(e), e) {
704
+ const n = u.findKey(this, e);
705
+ return !!(n && this[n] !== void 0 && (!r || et(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 = me(a), a) {
714
+ const o = u.findKey(n, a);
715
+ o && (!r || et(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 || et(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] = Ae(s), delete r[i];
735
+ return;
736
+ }
737
+ const o = e ? En(i) : String(i).trim();
738
+ o !== i && delete r[i], r[o] = Ae(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[Ot] = this[Ot] = {
772
+ accessors: {}
773
+ }).accessors, s = this.prototype;
774
+ function i(a) {
775
+ const o = me(a);
776
+ n[o] || (Rn(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 tt(t, e) {
793
+ const r = this || Re, 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 nr(t) {
800
+ return !!(t && t.__CANCEL__);
801
+ }
802
+ function pe(t, e, r) {
803
+ w.call(this, t ?? "canceled", w.ERR_CANCELED, e, r), this.name = "CanceledError";
804
+ }
805
+ u.inherits(pe, w, {
806
+ __CANCEL__: !0
807
+ });
808
+ function sr(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 Sn(t) {
819
+ const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
820
+ return e && e[1] || "";
821
+ }
822
+ function Tn(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(d) {
827
+ const c = Date.now(), l = n[i];
828
+ a || (a = c), r[s] = d, n[s] = c;
829
+ let m = i, S = 0;
830
+ for (; m !== s; )
831
+ S += r[m++], m = m % t;
832
+ if (s = (s + 1) % t, s === i && (i = (i + 1) % t), c - a < e)
833
+ return;
834
+ const T = l && c - l;
835
+ return T ? Math.round(S * 1e3 / T) : void 0;
836
+ };
837
+ }
838
+ function An(t, e) {
839
+ let r = 0, n = 1e3 / e, s, i;
840
+ const a = (c, l = Date.now()) => {
841
+ r = l, s = null, i && (clearTimeout(i), i = null), t.apply(null, c);
842
+ };
843
+ return [(...c) => {
844
+ const l = Date.now(), m = l - r;
845
+ m >= n ? a(c, l) : (s = c, i || (i = setTimeout(() => {
846
+ i = null, a(s);
847
+ }, n - m)));
848
+ }, () => s && a(s)];
849
+ }
850
+ const Ce = (t, e, r = 3) => {
851
+ let n = 0;
852
+ const s = Tn(50, 250);
853
+ return An((i) => {
854
+ const a = i.loaded, o = i.lengthComputable ? i.total : void 0, d = a - n, c = s(d), l = a <= o;
855
+ n = a;
856
+ const m = {
857
+ loaded: a,
858
+ total: o,
859
+ progress: o ? a / o : void 0,
860
+ bytes: d,
861
+ rate: c || void 0,
862
+ estimated: c && o && l ? (o - a) / c : void 0,
863
+ event: i,
864
+ lengthComputable: o != null,
865
+ [e ? "download" : "upload"]: !0
866
+ };
867
+ t(m);
868
+ }, r);
869
+ }, Ct = (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
+ }, Nt = (t) => (...e) => u.asap(() => t(...e)), On = 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, Cn = 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 Nn(t) {
907
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
908
+ }
909
+ function jn(t, e) {
910
+ return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
911
+ }
912
+ function ir(t, e, r) {
913
+ let n = !Nn(e);
914
+ return t && (n || r == !1) ? jn(t, e) : e;
915
+ }
916
+ const jt = (t) => t instanceof U ? { ...t } : t;
917
+ function re(t, e) {
918
+ e = e || {};
919
+ const r = {};
920
+ function n(c, l, m, S) {
921
+ return u.isPlainObject(c) && u.isPlainObject(l) ? u.merge.call({ caseless: S }, c, l) : u.isPlainObject(l) ? u.merge({}, l) : u.isArray(l) ? l.slice() : l;
922
+ }
923
+ function s(c, l, m, S) {
924
+ if (u.isUndefined(l)) {
925
+ if (!u.isUndefined(c))
926
+ return n(void 0, c, m, S);
927
+ } else return n(c, l, m, S);
928
+ }
929
+ function i(c, l) {
930
+ if (!u.isUndefined(l))
931
+ return n(void 0, l);
932
+ }
933
+ function a(c, l) {
934
+ if (u.isUndefined(l)) {
935
+ if (!u.isUndefined(c))
936
+ return n(void 0, c);
937
+ } else return n(void 0, l);
938
+ }
939
+ function o(c, l, m) {
940
+ if (m in e)
941
+ return n(c, l);
942
+ if (m in t)
943
+ return n(void 0, c);
944
+ }
945
+ const d = {
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, l, m) => s(jt(c), jt(l), m, !0)
975
+ };
976
+ return u.forEach(Object.keys(Object.assign({}, t, e)), function(l) {
977
+ const m = d[l] || s, S = m(t[l], e[l], l);
978
+ u.isUndefined(S) && m !== o || (r[l] = S);
979
+ }), r;
980
+ }
981
+ const ar = (t) => {
982
+ const e = re({}, 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 = er(ir(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 d;
989
+ if (u.isFormData(r)) {
990
+ if (P.hasStandardBrowserEnv || P.hasStandardBrowserWebWorkerEnv)
991
+ a.setContentType(void 0);
992
+ else if ((d = a.getContentType()) !== !1) {
993
+ const [c, ...l] = d ? d.split(";").map((m) => m.trim()).filter(Boolean) : [];
994
+ a.setContentType([c || "multipart/form-data", ...l].join("; "));
995
+ }
996
+ }
997
+ if (P.hasStandardBrowserEnv && (n && u.isFunction(n) && (n = n(e)), n || n !== !1 && On(e.url))) {
998
+ const c = s && i && Cn.read(i);
999
+ c && a.set(s, c);
1000
+ }
1001
+ return e;
1002
+ }, Pn = typeof XMLHttpRequest < "u", In = Pn && function(t) {
1003
+ return new Promise(function(r, n) {
1004
+ const s = ar(t);
1005
+ let i = s.data;
1006
+ const a = U.from(s.headers).normalize();
1007
+ let { responseType: o, onUploadProgress: d, onDownloadProgress: c } = s, l, m, S, T, g;
1008
+ function k() {
1009
+ T && T(), g && g(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
1010
+ }
1011
+ let _ = new XMLHttpRequest();
1012
+ _.open(s.method.toUpperCase(), s.url, !0), _.timeout = s.timeout;
1013
+ function O() {
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
+ sr(function(Q) {
1027
+ r(Q), k();
1028
+ }, function(Q) {
1029
+ n(Q), k();
1030
+ }, D), _ = null;
1031
+ }
1032
+ "onloadend" in _ ? _.onloadend = O : _.onreadystatechange = function() {
1033
+ !_ || _.readyState !== 4 || _.status === 0 && !(_.responseURL && _.responseURL.indexOf("file:") === 0) || setTimeout(O);
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 q = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1040
+ const D = s.transitional || tr;
1041
+ s.timeoutErrorMessage && (q = s.timeoutErrorMessage), n(new w(
1042
+ q,
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(q, D) {
1048
+ _.setRequestHeader(D, q);
1049
+ }), u.isUndefined(s.withCredentials) || (_.withCredentials = !!s.withCredentials), o && o !== "json" && (_.responseType = s.responseType), c && ([S, g] = Ce(c, !0), _.addEventListener("progress", S)), d && _.upload && ([m, T] = Ce(d), _.upload.addEventListener("progress", m), _.upload.addEventListener("loadend", T)), (s.cancelToken || s.signal) && (l = (j) => {
1050
+ _ && (n(!j || j.type ? new pe(null, t, _) : j), _.abort(), _ = null);
1051
+ }, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
1052
+ const N = Sn(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
+ }, Dn = (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 l = c instanceof Error ? c : this.reason;
1067
+ n.abort(l instanceof w ? l : new pe(l instanceof Error ? l.message : l));
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: d } = n;
1080
+ return d.unsubscribe = () => u.asap(o), d;
1081
+ }
1082
+ }, Ln = 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
+ }, Un = async function* (t, e) {
1092
+ for await (const r of Fn(t))
1093
+ yield* Ln(r, e);
1094
+ }, Fn = 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
+ }, Pt = (t, e, r, n) => {
1111
+ const s = Un(t, e);
1112
+ let i = 0, a, o = (d) => {
1113
+ a || (a = !0, n && n(d));
1114
+ };
1115
+ return new ReadableStream({
1116
+ async pull(d) {
1117
+ try {
1118
+ const { done: c, value: l } = await s.next();
1119
+ if (c) {
1120
+ o(), d.close();
1121
+ return;
1122
+ }
1123
+ let m = l.byteLength;
1124
+ if (r) {
1125
+ let S = i += m;
1126
+ r(S);
1127
+ }
1128
+ d.enqueue(new Uint8Array(l));
1129
+ } catch (c) {
1130
+ throw o(c), c;
1131
+ }
1132
+ },
1133
+ cancel(d) {
1134
+ return o(d), s.return();
1135
+ }
1136
+ }, {
1137
+ highWaterMark: 2
1138
+ });
1139
+ }, Ge = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", or = Ge && typeof ReadableStream == "function", Zn = Ge && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), cr = (t, ...e) => {
1140
+ try {
1141
+ return !!t(...e);
1142
+ } catch {
1143
+ return !1;
1144
+ }
1145
+ }, Mn = or && cr(() => {
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
+ }), It = 64 * 1024, ot = or && cr(() => u.isReadableStream(new Response("").body)), Ne = {
1156
+ stream: ot && ((t) => t.body)
1157
+ };
1158
+ Ge && ((t) => {
1159
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
1160
+ !Ne[e] && (Ne[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 Bn = 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 Zn(t)).byteLength;
1179
+ }, $n = async (t, e) => {
1180
+ const r = u.toFiniteNumber(t.getContentLength());
1181
+ return r ?? Bn(e);
1182
+ }, zn = Ge && (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: d,
1192
+ responseType: c,
1193
+ headers: l,
1194
+ withCredentials: m = "same-origin",
1195
+ fetchOptions: S
1196
+ } = ar(t);
1197
+ c = c ? (c + "").toLowerCase() : "text";
1198
+ let T = Dn([s, i && i.toAbortSignal()], a), g;
1199
+ const k = T && T.unsubscribe && (() => {
1200
+ T.unsubscribe();
1201
+ });
1202
+ let _;
1203
+ try {
1204
+ if (d && Mn && r !== "get" && r !== "head" && (_ = await $n(l, n)) !== 0) {
1205
+ let D = new Request(e, {
1206
+ method: "POST",
1207
+ body: n,
1208
+ duplex: "half"
1209
+ }), X;
1210
+ if (u.isFormData(n) && (X = D.headers.get("content-type")) && l.setContentType(X), D.body) {
1211
+ const [Q, Se] = Ct(
1212
+ _,
1213
+ Ce(Nt(d))
1214
+ );
1215
+ n = Pt(D.body, It, Q, Se);
1216
+ }
1217
+ }
1218
+ u.isString(m) || (m = m ? "include" : "omit");
1219
+ const O = "credentials" in Request.prototype;
1220
+ g = new Request(e, {
1221
+ ...S,
1222
+ signal: T,
1223
+ method: r.toUpperCase(),
1224
+ headers: l.normalize().toJSON(),
1225
+ body: n,
1226
+ duplex: "half",
1227
+ credentials: O ? m : void 0
1228
+ });
1229
+ let N = await fetch(g);
1230
+ const j = ot && (c === "stream" || c === "response");
1231
+ if (ot && (o || j && k)) {
1232
+ const D = {};
1233
+ ["status", "statusText", "headers"].forEach((Et) => {
1234
+ D[Et] = N[Et];
1235
+ });
1236
+ const X = u.toFiniteNumber(N.headers.get("content-length")), [Q, Se] = o && Ct(
1237
+ X,
1238
+ Ce(Nt(o), !0)
1239
+ ) || [];
1240
+ N = new Response(
1241
+ Pt(N.body, It, Q, () => {
1242
+ Se && Se(), k && k();
1243
+ }),
1244
+ D
1245
+ );
1246
+ }
1247
+ c = c || "text";
1248
+ let q = await Ne[u.findKey(Ne, c) || "text"](N, t);
1249
+ return !j && k && k(), await new Promise((D, X) => {
1250
+ sr(D, X, {
1251
+ data: q,
1252
+ headers: U.from(N.headers),
1253
+ status: N.status,
1254
+ statusText: N.statusText,
1255
+ config: t,
1256
+ request: g
1257
+ });
1258
+ });
1259
+ } catch (O) {
1260
+ throw k && k(), O && O.name === "TypeError" && /Load failed|fetch/i.test(O.message) ? Object.assign(
1261
+ new w("Network Error", w.ERR_NETWORK, t, g),
1262
+ {
1263
+ cause: O.cause || O
1264
+ }
1265
+ ) : w.from(O, O && O.code, t, g);
1266
+ }
1267
+ }), ct = {
1268
+ http: nn,
1269
+ xhr: In,
1270
+ fetch: zn
1271
+ };
1272
+ u.forEach(ct, (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 Dt = (t) => `- ${t}`, qn = (t) => u.isFunction(t) || t === null || t === !1, ur = {
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, !qn(r) && (n = ct[(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, d]) => `adapter ${o} ` + (d === !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(Dt).join(`
1302
+ `) : " " + Dt(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: ct
1311
+ };
1312
+ function rt(t) {
1313
+ if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
1314
+ throw new pe(null, t);
1315
+ }
1316
+ function Lt(t) {
1317
+ return rt(t), t.headers = U.from(t.headers), t.data = tt.call(
1318
+ t,
1319
+ t.transformRequest
1320
+ ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), ur.getAdapter(t.adapter || Re.adapter)(t).then(function(n) {
1321
+ return rt(t), n.data = tt.call(
1322
+ t,
1323
+ t.transformResponse,
1324
+ n
1325
+ ), n.headers = U.from(n.headers), n;
1326
+ }, function(n) {
1327
+ return nr(n) || (rt(t), n && n.response && (n.response.data = tt.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 lr = "1.9.0", Ye = {};
1335
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
1336
+ Ye[t] = function(n) {
1337
+ return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
1338
+ };
1339
+ });
1340
+ const Ut = {};
1341
+ Ye.transitional = function(e, r, n) {
1342
+ function s(i, a) {
1343
+ return "[Axios v" + lr + "] 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 && !Ut[a] && (Ut[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
+ Ye.spelling = function(e) {
1360
+ return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
1361
+ };
1362
+ function Vn(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], d = o === void 0 || a(o, i, t);
1371
+ if (d !== !0)
1372
+ throw new w("option " + i + " must be " + d, 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 Oe = {
1380
+ assertOptions: Vn,
1381
+ validators: Ye
1382
+ }, B = Oe.validators;
1383
+ let te = class {
1384
+ constructor(e) {
1385
+ this.defaults = e || {}, this.interceptors = {
1386
+ request: new At(),
1387
+ response: new At()
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 = re(this.defaults, r);
1417
+ const { transitional: n, paramsSerializer: s, headers: i } = r;
1418
+ n !== void 0 && Oe.assertOptions(n, {
1419
+ silentJSONParsing: B.transitional(B.boolean),
1420
+ forcedJSONParsing: B.transitional(B.boolean),
1421
+ clarifyTimeoutError: B.transitional(B.boolean)
1422
+ }, !1), s != null && (u.isFunction(s) ? r.paramsSerializer = {
1423
+ serialize: s
1424
+ } : Oe.assertOptions(s, {
1425
+ encode: B.function,
1426
+ serialize: B.function
1427
+ }, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Oe.assertOptions(r, {
1428
+ baseUrl: B.spelling("baseURL"),
1429
+ withXsrfToken: B.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 d = !0;
1443
+ this.interceptors.request.forEach(function(k) {
1444
+ typeof k.runWhen == "function" && k.runWhen(r) === !1 || (d = d && 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 l, m = 0, S;
1451
+ if (!d) {
1452
+ const g = [Lt.bind(this), void 0];
1453
+ for (g.unshift.apply(g, o), g.push.apply(g, c), S = g.length, l = Promise.resolve(r); m < S; )
1454
+ l = l.then(g[m++], g[m++]);
1455
+ return l;
1456
+ }
1457
+ S = o.length;
1458
+ let T = r;
1459
+ for (m = 0; m < S; ) {
1460
+ const g = o[m++], k = o[m++];
1461
+ try {
1462
+ T = g(T);
1463
+ } catch (_) {
1464
+ k.call(this, _);
1465
+ break;
1466
+ }
1467
+ }
1468
+ try {
1469
+ l = Lt.call(this, T);
1470
+ } catch (g) {
1471
+ return Promise.reject(g);
1472
+ }
1473
+ for (m = 0, S = c.length; m < S; )
1474
+ l = l.then(c[m++], c[m++]);
1475
+ return l;
1476
+ }
1477
+ getUri(e) {
1478
+ e = re(this.defaults, e);
1479
+ const r = ir(e.baseURL, e.url, e.allowAbsoluteUrls);
1480
+ return er(r, e.params, e.paramsSerializer);
1481
+ }
1482
+ };
1483
+ u.forEach(["delete", "get", "head", "options"], function(e) {
1484
+ te.prototype[e] = function(r, n) {
1485
+ return this.request(re(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(re(o || {}, {
1496
+ method: e,
1497
+ headers: n ? {
1498
+ "Content-Type": "multipart/form-data"
1499
+ } : {},
1500
+ url: i,
1501
+ data: a
1502
+ }));
1503
+ };
1504
+ }
1505
+ te.prototype[e] = r(), te.prototype[e + "Form"] = r(!0);
1506
+ });
1507
+ let Hn = class dr {
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 pe(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 dr(function(s) {
1574
+ e = s;
1575
+ }),
1576
+ cancel: e
1577
+ };
1578
+ }
1579
+ };
1580
+ function Wn(t) {
1581
+ return function(r) {
1582
+ return t.apply(null, r);
1583
+ };
1584
+ }
1585
+ function Jn(t) {
1586
+ return u.isObject(t) && t.isAxiosError === !0;
1587
+ }
1588
+ const ut = {
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(ut).forEach(([t, e]) => {
1654
+ ut[e] = t;
1655
+ });
1656
+ function fr(t) {
1657
+ const e = new te(t), r = $t(te.prototype.request, e);
1658
+ return u.extend(r, te.prototype, e, { allOwnKeys: !0 }), u.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(s) {
1659
+ return fr(re(t, s));
1660
+ }, r;
1661
+ }
1662
+ const C = fr(Re);
1663
+ C.Axios = te;
1664
+ C.CanceledError = pe;
1665
+ C.CancelToken = Hn;
1666
+ C.isCancel = nr;
1667
+ C.VERSION = lr;
1668
+ C.toFormData = Xe;
1669
+ C.AxiosError = w;
1670
+ C.Cancel = C.CanceledError;
1671
+ C.all = function(e) {
1672
+ return Promise.all(e);
1673
+ };
1674
+ C.spread = Wn;
1675
+ C.isAxiosError = Jn;
1676
+ C.mergeConfig = re;
1677
+ C.AxiosHeaders = U;
1678
+ C.formToJSON = (t) => rr(u.isHTMLForm(t) ? new FormData(t) : t);
1679
+ C.getAdapter = ur.getAdapter;
1680
+ C.HttpStatusCode = ut;
1681
+ C.default = C;
1682
+ const {
1683
+ Axios: Es,
1684
+ AxiosError: Kn,
1685
+ CanceledError: Rs,
1686
+ isCancel: Ss,
1687
+ CancelToken: Ts,
1688
+ VERSION: As,
1689
+ all: Os,
1690
+ Cancel: Cs,
1691
+ isAxiosError: Ns,
1692
+ spread: js,
1693
+ toFormData: Ps,
1694
+ AxiosHeaders: Is,
1695
+ HttpStatusCode: xt,
1696
+ formToJSON: Ds,
1697
+ getAdapter: Ls,
1698
+ mergeConfig: Us
1699
+ } = C;
1700
+ var R;
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
+ })(R || (R = {}));
1736
+ var Ft;
1737
+ (function(t) {
1738
+ t.mergeShapes = (e, r) => ({
1739
+ ...e,
1740
+ ...r
1741
+ // second overwrites first
1742
+ });
1743
+ })(Ft || (Ft = {}));
1744
+ const p = R.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
+ ]), G = (t) => {
1766
+ switch (typeof t) {
1767
+ case "undefined":
1768
+ return p.undefined;
1769
+ case "string":
1770
+ return p.string;
1771
+ case "number":
1772
+ return isNaN(t) ? p.nan : p.number;
1773
+ case "boolean":
1774
+ return p.boolean;
1775
+ case "function":
1776
+ return p.function;
1777
+ case "bigint":
1778
+ return p.bigint;
1779
+ case "symbol":
1780
+ return p.symbol;
1781
+ case "object":
1782
+ return Array.isArray(t) ? p.array : t === null ? p.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? p.promise : typeof Map < "u" && t instanceof Map ? p.map : typeof Set < "u" && t instanceof Set ? p.set : typeof Date < "u" && t instanceof Date ? p.date : p.object;
1783
+ default:
1784
+ return p.unknown;
1785
+ }
1786
+ }, f = R.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
+ ]);
1804
+ class Z 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, d = 0;
1832
+ for (; d < a.path.length; ) {
1833
+ const c = a.path[d];
1834
+ d === a.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(r(a))) : o[c] = o[c] || { _errors: [] }, o = o[c], d++;
1835
+ }
1836
+ }
1837
+ };
1838
+ return s(this), n;
1839
+ }
1840
+ static assert(e) {
1841
+ if (!(e instanceof Z))
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, R.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
+ Z.create = (t) => new Z(t);
1864
+ const we = (t, e) => {
1865
+ let r;
1866
+ switch (t.code) {
1867
+ case f.invalid_type:
1868
+ t.received === p.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, R.jsonStringifyReplacer)}`;
1872
+ break;
1873
+ case f.unrecognized_keys:
1874
+ r = `Unrecognized key(s) in object: ${R.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 ${R.joinValues(t.options)}`;
1881
+ break;
1882
+ case f.invalid_enum_value:
1883
+ r = `Invalid enum value. Expected ${R.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}"` : R.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, R.assertNever(t);
1917
+ }
1918
+ return { message: r };
1919
+ };
1920
+ let Xn = we;
1921
+ function lt() {
1922
+ return Xn;
1923
+ }
1924
+ const dt = (t) => {
1925
+ const { data: e, path: r, errorMaps: n, issueData: s } = t, i = [...r, ...s.path || []], a = {
1926
+ ...s,
1927
+ path: i
1928
+ };
1929
+ if (s.message !== void 0)
1930
+ return {
1931
+ ...s,
1932
+ path: i,
1933
+ message: s.message
1934
+ };
1935
+ let o = "";
1936
+ const d = n.filter((c) => !!c).slice().reverse();
1937
+ for (const c of d)
1938
+ o = c(a, { data: e, defaultError: o }).message;
1939
+ return {
1940
+ ...s,
1941
+ path: i,
1942
+ message: o
1943
+ };
1944
+ };
1945
+ function h(t, e) {
1946
+ const r = lt(), n = dt({
1947
+ issueData: e,
1948
+ data: t.data,
1949
+ path: t.path,
1950
+ errorMaps: [
1951
+ t.common.contextualErrorMap,
1952
+ // contextual error map is first priority
1953
+ t.schemaErrorMap,
1954
+ // then schema-bound map if available
1955
+ r,
1956
+ // then global override map
1957
+ r === we ? void 0 : we
1958
+ // then global default map
1959
+ ].filter((s) => !!s)
1960
+ });
1961
+ t.common.issues.push(n);
1962
+ }
1963
+ class I {
1964
+ constructor() {
1965
+ this.value = "valid";
1966
+ }
1967
+ dirty() {
1968
+ this.value === "valid" && (this.value = "dirty");
1969
+ }
1970
+ abort() {
1971
+ this.value !== "aborted" && (this.value = "aborted");
1972
+ }
1973
+ static mergeArray(e, r) {
1974
+ const n = [];
1975
+ for (const s of r) {
1976
+ if (s.status === "aborted")
1977
+ return b;
1978
+ s.status === "dirty" && e.dirty(), n.push(s.value);
1979
+ }
1980
+ return { status: e.value, value: n };
1981
+ }
1982
+ static async mergeObjectAsync(e, r) {
1983
+ const n = [];
1984
+ for (const s of r) {
1985
+ const i = await s.key, a = await s.value;
1986
+ n.push({
1987
+ key: i,
1988
+ value: a
1989
+ });
1990
+ }
1991
+ return I.mergeObjectSync(e, n);
1992
+ }
1993
+ static mergeObjectSync(e, r) {
1994
+ const n = {};
1995
+ for (const s of r) {
1996
+ const { key: i, value: a } = s;
1997
+ if (i.status === "aborted" || a.status === "aborted")
1998
+ return b;
1999
+ i.status === "dirty" && e.dirty(), a.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof a.value < "u" || s.alwaysSet) && (n[i.value] = a.value);
2000
+ }
2001
+ return { status: e.value, value: n };
2002
+ }
2003
+ }
2004
+ const b = Object.freeze({
2005
+ status: "aborted"
2006
+ }), ye = (t) => ({ status: "dirty", value: t }), F = (t) => ({ status: "valid", value: t }), Zt = (t) => t.status === "aborted", Mt = (t) => t.status === "dirty", ue = (t) => t.status === "valid", je = (t) => typeof Promise < "u" && t instanceof Promise;
2007
+ function Pe(t, e, r, n) {
2008
+ 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");
2009
+ return e.get(t);
2010
+ }
2011
+ function hr(t, e, r, n, s) {
2012
+ 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");
2013
+ return e.set(t, r), r;
2014
+ }
2015
+ var y;
2016
+ (function(t) {
2017
+ t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
2018
+ })(y || (y = {}));
2019
+ var ge, _e;
2020
+ class z {
2021
+ constructor(e, r, n, s) {
2022
+ this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
2023
+ }
2024
+ get path() {
2025
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
2026
+ }
2027
+ }
2028
+ const Bt = (t, e) => {
2029
+ if (ue(e))
2030
+ return { success: !0, data: e.value };
2031
+ if (!t.common.issues.length)
2032
+ throw new Error("Validation failed but no issues detected.");
2033
+ return {
2034
+ success: !1,
2035
+ get error() {
2036
+ if (this._error)
2037
+ return this._error;
2038
+ const r = new Z(t.common.issues);
2039
+ return this._error = r, this._error;
2040
+ }
2041
+ };
2042
+ };
2043
+ function x(t) {
2044
+ if (!t)
2045
+ return {};
2046
+ const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
2047
+ if (e && (r || n))
2048
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
2049
+ return e ? { errorMap: e, description: s } : { errorMap: (a, o) => {
2050
+ var d, c;
2051
+ const { message: l } = t;
2052
+ return a.code === "invalid_enum_value" ? { message: l ?? o.defaultError } : typeof o.data > "u" ? { message: (d = l ?? n) !== null && d !== void 0 ? d : o.defaultError } : a.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = l ?? r) !== null && c !== void 0 ? c : o.defaultError };
2053
+ }, description: s };
2054
+ }
2055
+ class E {
2056
+ get description() {
2057
+ return this._def.description;
2058
+ }
2059
+ _getType(e) {
2060
+ return G(e.data);
2061
+ }
2062
+ _getOrReturnCtx(e, r) {
2063
+ return r || {
2064
+ common: e.parent.common,
2065
+ data: e.data,
2066
+ parsedType: G(e.data),
2067
+ schemaErrorMap: this._def.errorMap,
2068
+ path: e.path,
2069
+ parent: e.parent
2070
+ };
2071
+ }
2072
+ _processInputParams(e) {
2073
+ return {
2074
+ status: new I(),
2075
+ ctx: {
2076
+ common: e.parent.common,
2077
+ data: e.data,
2078
+ parsedType: G(e.data),
2079
+ schemaErrorMap: this._def.errorMap,
2080
+ path: e.path,
2081
+ parent: e.parent
2082
+ }
2083
+ };
2084
+ }
2085
+ _parseSync(e) {
2086
+ const r = this._parse(e);
2087
+ if (je(r))
2088
+ throw new Error("Synchronous parse encountered promise.");
2089
+ return r;
2090
+ }
2091
+ _parseAsync(e) {
2092
+ const r = this._parse(e);
2093
+ return Promise.resolve(r);
2094
+ }
2095
+ parse(e, r) {
2096
+ const n = this.safeParse(e, r);
2097
+ if (n.success)
2098
+ return n.data;
2099
+ throw n.error;
2100
+ }
2101
+ safeParse(e, r) {
2102
+ var n;
2103
+ const s = {
2104
+ common: {
2105
+ issues: [],
2106
+ async: (n = r?.async) !== null && n !== void 0 ? n : !1,
2107
+ contextualErrorMap: r?.errorMap
2108
+ },
2109
+ path: r?.path || [],
2110
+ schemaErrorMap: this._def.errorMap,
2111
+ parent: null,
2112
+ data: e,
2113
+ parsedType: G(e)
2114
+ }, i = this._parseSync({ data: e, path: s.path, parent: s });
2115
+ return Bt(s, i);
2116
+ }
2117
+ "~validate"(e) {
2118
+ var r, n;
2119
+ const s = {
2120
+ common: {
2121
+ issues: [],
2122
+ async: !!this["~standard"].async
2123
+ },
2124
+ path: [],
2125
+ schemaErrorMap: this._def.errorMap,
2126
+ parent: null,
2127
+ data: e,
2128
+ parsedType: G(e)
2129
+ };
2130
+ if (!this["~standard"].async)
2131
+ try {
2132
+ const i = this._parseSync({ data: e, path: [], parent: s });
2133
+ return ue(i) ? {
2134
+ value: i.value
2135
+ } : {
2136
+ issues: s.common.issues
2137
+ };
2138
+ } catch (i) {
2139
+ !((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 = {
2140
+ issues: [],
2141
+ async: !0
2142
+ };
2143
+ }
2144
+ return this._parseAsync({ data: e, path: [], parent: s }).then((i) => ue(i) ? {
2145
+ value: i.value
2146
+ } : {
2147
+ issues: s.common.issues
2148
+ });
2149
+ }
2150
+ async parseAsync(e, r) {
2151
+ const n = await this.safeParseAsync(e, r);
2152
+ if (n.success)
2153
+ return n.data;
2154
+ throw n.error;
2155
+ }
2156
+ async safeParseAsync(e, r) {
2157
+ const n = {
2158
+ common: {
2159
+ issues: [],
2160
+ contextualErrorMap: r?.errorMap,
2161
+ async: !0
2162
+ },
2163
+ path: r?.path || [],
2164
+ schemaErrorMap: this._def.errorMap,
2165
+ parent: null,
2166
+ data: e,
2167
+ parsedType: G(e)
2168
+ }, s = this._parse({ data: e, path: n.path, parent: n }), i = await (je(s) ? s : Promise.resolve(s));
2169
+ return Bt(n, i);
2170
+ }
2171
+ refine(e, r) {
2172
+ const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
2173
+ return this._refinement((s, i) => {
2174
+ const a = e(s), o = () => i.addIssue({
2175
+ code: f.custom,
2176
+ ...n(s)
2177
+ });
2178
+ return typeof Promise < "u" && a instanceof Promise ? a.then((d) => d ? !0 : (o(), !1)) : a ? !0 : (o(), !1);
2179
+ });
2180
+ }
2181
+ refinement(e, r) {
2182
+ return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
2183
+ }
2184
+ _refinement(e) {
2185
+ return new K({
2186
+ schema: this,
2187
+ typeName: v.ZodEffects,
2188
+ effect: { type: "refinement", refinement: e }
2189
+ });
2190
+ }
2191
+ superRefine(e) {
2192
+ return this._refinement(e);
2193
+ }
2194
+ constructor(e) {
2195
+ 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"] = {
2196
+ version: 1,
2197
+ vendor: "zod",
2198
+ validate: (r) => this["~validate"](r)
2199
+ };
2200
+ }
2201
+ optional() {
2202
+ return W.create(this, this._def);
2203
+ }
2204
+ nullable() {
2205
+ return se.create(this, this._def);
2206
+ }
2207
+ nullish() {
2208
+ return this.nullable().optional();
2209
+ }
2210
+ array() {
2211
+ return $.create(this);
2212
+ }
2213
+ promise() {
2214
+ return ke.create(this, this._def);
2215
+ }
2216
+ or(e) {
2217
+ return Le.create([this, e], this._def);
2218
+ }
2219
+ and(e) {
2220
+ return Ue.create(this, e, this._def);
2221
+ }
2222
+ transform(e) {
2223
+ return new K({
2224
+ ...x(this._def),
2225
+ schema: this,
2226
+ typeName: v.ZodEffects,
2227
+ effect: { type: "transform", transform: e }
2228
+ });
2229
+ }
2230
+ default(e) {
2231
+ const r = typeof e == "function" ? e : () => e;
2232
+ return new $e({
2233
+ ...x(this._def),
2234
+ innerType: this,
2235
+ defaultValue: r,
2236
+ typeName: v.ZodDefault
2237
+ });
2238
+ }
2239
+ brand() {
2240
+ return new gr({
2241
+ typeName: v.ZodBranded,
2242
+ type: this,
2243
+ ...x(this._def)
2244
+ });
2245
+ }
2246
+ catch(e) {
2247
+ const r = typeof e == "function" ? e : () => e;
2248
+ return new ze({
2249
+ ...x(this._def),
2250
+ innerType: this,
2251
+ catchValue: r,
2252
+ typeName: v.ZodCatch
2253
+ });
2254
+ }
2255
+ describe(e) {
2256
+ const r = this.constructor;
2257
+ return new r({
2258
+ ...this._def,
2259
+ description: e
2260
+ });
2261
+ }
2262
+ pipe(e) {
2263
+ return Qe.create(this, e);
2264
+ }
2265
+ readonly() {
2266
+ return qe.create(this);
2267
+ }
2268
+ isOptional() {
2269
+ return this.safeParse(void 0).success;
2270
+ }
2271
+ isNullable() {
2272
+ return this.safeParse(null).success;
2273
+ }
2274
+ }
2275
+ const Gn = /^c[^\s-]{8,}$/i, Yn = /^[0-9a-z]+$/, Qn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, es = /^[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, ts = /^[a-z0-9_-]{21}$/i, rs = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ns = /^[-+]?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)?)??$/, ss = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, is = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
2276
+ let nt;
2277
+ const as = /^(?:(?: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])$/, os = /^(?:(?: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])$/, cs = /^(([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]))$/, us = /^(([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])$/, ls = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ds = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, pr = "((\\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])))", fs = new RegExp(`^${pr}$`);
2278
+ function mr(t) {
2279
+ let e = "[0-5]\\d";
2280
+ t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
2281
+ const r = t.precision ? "+" : "?";
2282
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
2283
+ }
2284
+ function hs(t) {
2285
+ return new RegExp(`^${mr(t)}$`);
2286
+ }
2287
+ function ps(t) {
2288
+ let e = `${pr}T${mr(t)}`;
2289
+ const r = [];
2290
+ return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
2291
+ }
2292
+ function ms(t, e) {
2293
+ return !!((e === "v4" || !e) && as.test(t) || (e === "v6" || !e) && cs.test(t));
2294
+ }
2295
+ function ys(t, e) {
2296
+ if (!rs.test(t))
2297
+ return !1;
2298
+ try {
2299
+ const [r] = t.split("."), n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(n));
2300
+ return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
2301
+ } catch {
2302
+ return !1;
2303
+ }
2304
+ }
2305
+ function gs(t, e) {
2306
+ return !!((e === "v4" || !e) && os.test(t) || (e === "v6" || !e) && us.test(t));
2307
+ }
2308
+ class H extends E {
2309
+ _parse(e) {
2310
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
2311
+ const i = this._getOrReturnCtx(e);
2312
+ return h(i, {
2313
+ code: f.invalid_type,
2314
+ expected: p.string,
2315
+ received: i.parsedType
2316
+ }), b;
2317
+ }
2318
+ const n = new I();
2319
+ let s;
2320
+ for (const i of this._def.checks)
2321
+ if (i.kind === "min")
2322
+ e.data.length < i.value && (s = this._getOrReturnCtx(e, s), h(s, {
2323
+ code: f.too_small,
2324
+ minimum: i.value,
2325
+ type: "string",
2326
+ inclusive: !0,
2327
+ exact: !1,
2328
+ message: i.message
2329
+ }), n.dirty());
2330
+ else if (i.kind === "max")
2331
+ e.data.length > i.value && (s = this._getOrReturnCtx(e, s), h(s, {
2332
+ code: f.too_big,
2333
+ maximum: i.value,
2334
+ type: "string",
2335
+ inclusive: !0,
2336
+ exact: !1,
2337
+ message: i.message
2338
+ }), n.dirty());
2339
+ else if (i.kind === "length") {
2340
+ const a = e.data.length > i.value, o = e.data.length < i.value;
2341
+ (a || o) && (s = this._getOrReturnCtx(e, s), a ? h(s, {
2342
+ code: f.too_big,
2343
+ maximum: i.value,
2344
+ type: "string",
2345
+ inclusive: !0,
2346
+ exact: !0,
2347
+ message: i.message
2348
+ }) : o && h(s, {
2349
+ code: f.too_small,
2350
+ minimum: i.value,
2351
+ type: "string",
2352
+ inclusive: !0,
2353
+ exact: !0,
2354
+ message: i.message
2355
+ }), n.dirty());
2356
+ } else if (i.kind === "email")
2357
+ ss.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2358
+ validation: "email",
2359
+ code: f.invalid_string,
2360
+ message: i.message
2361
+ }), n.dirty());
2362
+ else if (i.kind === "emoji")
2363
+ nt || (nt = new RegExp(is, "u")), nt.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2364
+ validation: "emoji",
2365
+ code: f.invalid_string,
2366
+ message: i.message
2367
+ }), n.dirty());
2368
+ else if (i.kind === "uuid")
2369
+ es.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2370
+ validation: "uuid",
2371
+ code: f.invalid_string,
2372
+ message: i.message
2373
+ }), n.dirty());
2374
+ else if (i.kind === "nanoid")
2375
+ ts.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2376
+ validation: "nanoid",
2377
+ code: f.invalid_string,
2378
+ message: i.message
2379
+ }), n.dirty());
2380
+ else if (i.kind === "cuid")
2381
+ Gn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2382
+ validation: "cuid",
2383
+ code: f.invalid_string,
2384
+ message: i.message
2385
+ }), n.dirty());
2386
+ else if (i.kind === "cuid2")
2387
+ Yn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2388
+ validation: "cuid2",
2389
+ code: f.invalid_string,
2390
+ message: i.message
2391
+ }), n.dirty());
2392
+ else if (i.kind === "ulid")
2393
+ Qn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2394
+ validation: "ulid",
2395
+ code: f.invalid_string,
2396
+ message: i.message
2397
+ }), n.dirty());
2398
+ else if (i.kind === "url")
2399
+ try {
2400
+ new URL(e.data);
2401
+ } catch {
2402
+ s = this._getOrReturnCtx(e, s), h(s, {
2403
+ validation: "url",
2404
+ code: f.invalid_string,
2405
+ message: i.message
2406
+ }), n.dirty();
2407
+ }
2408
+ else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2409
+ validation: "regex",
2410
+ code: f.invalid_string,
2411
+ message: i.message
2412
+ }), 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, {
2413
+ code: f.invalid_string,
2414
+ validation: { includes: i.value, position: i.position },
2415
+ message: i.message
2416
+ }), 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, {
2417
+ code: f.invalid_string,
2418
+ validation: { startsWith: i.value },
2419
+ message: i.message
2420
+ }), n.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s), h(s, {
2421
+ code: f.invalid_string,
2422
+ validation: { endsWith: i.value },
2423
+ message: i.message
2424
+ }), n.dirty()) : i.kind === "datetime" ? ps(i).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2425
+ code: f.invalid_string,
2426
+ validation: "datetime",
2427
+ message: i.message
2428
+ }), n.dirty()) : i.kind === "date" ? fs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2429
+ code: f.invalid_string,
2430
+ validation: "date",
2431
+ message: i.message
2432
+ }), n.dirty()) : i.kind === "time" ? hs(i).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2433
+ code: f.invalid_string,
2434
+ validation: "time",
2435
+ message: i.message
2436
+ }), n.dirty()) : i.kind === "duration" ? ns.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2437
+ validation: "duration",
2438
+ code: f.invalid_string,
2439
+ message: i.message
2440
+ }), n.dirty()) : i.kind === "ip" ? ms(e.data, i.version) || (s = this._getOrReturnCtx(e, s), h(s, {
2441
+ validation: "ip",
2442
+ code: f.invalid_string,
2443
+ message: i.message
2444
+ }), n.dirty()) : i.kind === "jwt" ? ys(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), h(s, {
2445
+ validation: "jwt",
2446
+ code: f.invalid_string,
2447
+ message: i.message
2448
+ }), n.dirty()) : i.kind === "cidr" ? gs(e.data, i.version) || (s = this._getOrReturnCtx(e, s), h(s, {
2449
+ validation: "cidr",
2450
+ code: f.invalid_string,
2451
+ message: i.message
2452
+ }), n.dirty()) : i.kind === "base64" ? ls.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2453
+ validation: "base64",
2454
+ code: f.invalid_string,
2455
+ message: i.message
2456
+ }), n.dirty()) : i.kind === "base64url" ? ds.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2457
+ validation: "base64url",
2458
+ code: f.invalid_string,
2459
+ message: i.message
2460
+ }), n.dirty()) : R.assertNever(i);
2461
+ return { status: n.value, value: e.data };
2462
+ }
2463
+ _regex(e, r, n) {
2464
+ return this.refinement((s) => e.test(s), {
2465
+ validation: r,
2466
+ code: f.invalid_string,
2467
+ ...y.errToObj(n)
2468
+ });
2469
+ }
2470
+ _addCheck(e) {
2471
+ return new H({
2472
+ ...this._def,
2473
+ checks: [...this._def.checks, e]
2474
+ });
2475
+ }
2476
+ email(e) {
2477
+ return this._addCheck({ kind: "email", ...y.errToObj(e) });
2478
+ }
2479
+ url(e) {
2480
+ return this._addCheck({ kind: "url", ...y.errToObj(e) });
2481
+ }
2482
+ emoji(e) {
2483
+ return this._addCheck({ kind: "emoji", ...y.errToObj(e) });
2484
+ }
2485
+ uuid(e) {
2486
+ return this._addCheck({ kind: "uuid", ...y.errToObj(e) });
2487
+ }
2488
+ nanoid(e) {
2489
+ return this._addCheck({ kind: "nanoid", ...y.errToObj(e) });
2490
+ }
2491
+ cuid(e) {
2492
+ return this._addCheck({ kind: "cuid", ...y.errToObj(e) });
2493
+ }
2494
+ cuid2(e) {
2495
+ return this._addCheck({ kind: "cuid2", ...y.errToObj(e) });
2496
+ }
2497
+ ulid(e) {
2498
+ return this._addCheck({ kind: "ulid", ...y.errToObj(e) });
2499
+ }
2500
+ base64(e) {
2501
+ return this._addCheck({ kind: "base64", ...y.errToObj(e) });
2502
+ }
2503
+ base64url(e) {
2504
+ return this._addCheck({
2505
+ kind: "base64url",
2506
+ ...y.errToObj(e)
2507
+ });
2508
+ }
2509
+ jwt(e) {
2510
+ return this._addCheck({ kind: "jwt", ...y.errToObj(e) });
2511
+ }
2512
+ ip(e) {
2513
+ return this._addCheck({ kind: "ip", ...y.errToObj(e) });
2514
+ }
2515
+ cidr(e) {
2516
+ return this._addCheck({ kind: "cidr", ...y.errToObj(e) });
2517
+ }
2518
+ datetime(e) {
2519
+ var r, n;
2520
+ return typeof e == "string" ? this._addCheck({
2521
+ kind: "datetime",
2522
+ precision: null,
2523
+ offset: !1,
2524
+ local: !1,
2525
+ message: e
2526
+ }) : this._addCheck({
2527
+ kind: "datetime",
2528
+ precision: typeof e?.precision > "u" ? null : e?.precision,
2529
+ offset: (r = e?.offset) !== null && r !== void 0 ? r : !1,
2530
+ local: (n = e?.local) !== null && n !== void 0 ? n : !1,
2531
+ ...y.errToObj(e?.message)
2532
+ });
2533
+ }
2534
+ date(e) {
2535
+ return this._addCheck({ kind: "date", message: e });
2536
+ }
2537
+ time(e) {
2538
+ return typeof e == "string" ? this._addCheck({
2539
+ kind: "time",
2540
+ precision: null,
2541
+ message: e
2542
+ }) : this._addCheck({
2543
+ kind: "time",
2544
+ precision: typeof e?.precision > "u" ? null : e?.precision,
2545
+ ...y.errToObj(e?.message)
2546
+ });
2547
+ }
2548
+ duration(e) {
2549
+ return this._addCheck({ kind: "duration", ...y.errToObj(e) });
2550
+ }
2551
+ regex(e, r) {
2552
+ return this._addCheck({
2553
+ kind: "regex",
2554
+ regex: e,
2555
+ ...y.errToObj(r)
2556
+ });
2557
+ }
2558
+ includes(e, r) {
2559
+ return this._addCheck({
2560
+ kind: "includes",
2561
+ value: e,
2562
+ position: r?.position,
2563
+ ...y.errToObj(r?.message)
2564
+ });
2565
+ }
2566
+ startsWith(e, r) {
2567
+ return this._addCheck({
2568
+ kind: "startsWith",
2569
+ value: e,
2570
+ ...y.errToObj(r)
2571
+ });
2572
+ }
2573
+ endsWith(e, r) {
2574
+ return this._addCheck({
2575
+ kind: "endsWith",
2576
+ value: e,
2577
+ ...y.errToObj(r)
2578
+ });
2579
+ }
2580
+ min(e, r) {
2581
+ return this._addCheck({
2582
+ kind: "min",
2583
+ value: e,
2584
+ ...y.errToObj(r)
2585
+ });
2586
+ }
2587
+ max(e, r) {
2588
+ return this._addCheck({
2589
+ kind: "max",
2590
+ value: e,
2591
+ ...y.errToObj(r)
2592
+ });
2593
+ }
2594
+ length(e, r) {
2595
+ return this._addCheck({
2596
+ kind: "length",
2597
+ value: e,
2598
+ ...y.errToObj(r)
2599
+ });
2600
+ }
2601
+ /**
2602
+ * Equivalent to `.min(1)`
2603
+ */
2604
+ nonempty(e) {
2605
+ return this.min(1, y.errToObj(e));
2606
+ }
2607
+ trim() {
2608
+ return new H({
2609
+ ...this._def,
2610
+ checks: [...this._def.checks, { kind: "trim" }]
2611
+ });
2612
+ }
2613
+ toLowerCase() {
2614
+ return new H({
2615
+ ...this._def,
2616
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
2617
+ });
2618
+ }
2619
+ toUpperCase() {
2620
+ return new H({
2621
+ ...this._def,
2622
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
2623
+ });
2624
+ }
2625
+ get isDatetime() {
2626
+ return !!this._def.checks.find((e) => e.kind === "datetime");
2627
+ }
2628
+ get isDate() {
2629
+ return !!this._def.checks.find((e) => e.kind === "date");
2630
+ }
2631
+ get isTime() {
2632
+ return !!this._def.checks.find((e) => e.kind === "time");
2633
+ }
2634
+ get isDuration() {
2635
+ return !!this._def.checks.find((e) => e.kind === "duration");
2636
+ }
2637
+ get isEmail() {
2638
+ return !!this._def.checks.find((e) => e.kind === "email");
2639
+ }
2640
+ get isURL() {
2641
+ return !!this._def.checks.find((e) => e.kind === "url");
2642
+ }
2643
+ get isEmoji() {
2644
+ return !!this._def.checks.find((e) => e.kind === "emoji");
2645
+ }
2646
+ get isUUID() {
2647
+ return !!this._def.checks.find((e) => e.kind === "uuid");
2648
+ }
2649
+ get isNANOID() {
2650
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
2651
+ }
2652
+ get isCUID() {
2653
+ return !!this._def.checks.find((e) => e.kind === "cuid");
2654
+ }
2655
+ get isCUID2() {
2656
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
2657
+ }
2658
+ get isULID() {
2659
+ return !!this._def.checks.find((e) => e.kind === "ulid");
2660
+ }
2661
+ get isIP() {
2662
+ return !!this._def.checks.find((e) => e.kind === "ip");
2663
+ }
2664
+ get isCIDR() {
2665
+ return !!this._def.checks.find((e) => e.kind === "cidr");
2666
+ }
2667
+ get isBase64() {
2668
+ return !!this._def.checks.find((e) => e.kind === "base64");
2669
+ }
2670
+ get isBase64url() {
2671
+ return !!this._def.checks.find((e) => e.kind === "base64url");
2672
+ }
2673
+ get minLength() {
2674
+ let e = null;
2675
+ for (const r of this._def.checks)
2676
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2677
+ return e;
2678
+ }
2679
+ get maxLength() {
2680
+ let e = null;
2681
+ for (const r of this._def.checks)
2682
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2683
+ return e;
2684
+ }
2685
+ }
2686
+ H.create = (t) => {
2687
+ var e;
2688
+ return new H({
2689
+ checks: [],
2690
+ typeName: v.ZodString,
2691
+ coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
2692
+ ...x(t)
2693
+ });
2694
+ };
2695
+ function _s(t, e) {
2696
+ 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(".", ""));
2697
+ return i % a / Math.pow(10, s);
2698
+ }
2699
+ class le extends E {
2700
+ constructor() {
2701
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
2702
+ }
2703
+ _parse(e) {
2704
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
2705
+ const i = this._getOrReturnCtx(e);
2706
+ return h(i, {
2707
+ code: f.invalid_type,
2708
+ expected: p.number,
2709
+ received: i.parsedType
2710
+ }), b;
2711
+ }
2712
+ let n;
2713
+ const s = new I();
2714
+ for (const i of this._def.checks)
2715
+ i.kind === "int" ? R.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2716
+ code: f.invalid_type,
2717
+ expected: "integer",
2718
+ received: "float",
2719
+ message: i.message
2720
+ }), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2721
+ code: f.too_small,
2722
+ minimum: i.value,
2723
+ type: "number",
2724
+ inclusive: i.inclusive,
2725
+ exact: !1,
2726
+ message: i.message
2727
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2728
+ code: f.too_big,
2729
+ maximum: i.value,
2730
+ type: "number",
2731
+ inclusive: i.inclusive,
2732
+ exact: !1,
2733
+ message: i.message
2734
+ }), s.dirty()) : i.kind === "multipleOf" ? _s(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), h(n, {
2735
+ code: f.not_multiple_of,
2736
+ multipleOf: i.value,
2737
+ message: i.message
2738
+ }), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2739
+ code: f.not_finite,
2740
+ message: i.message
2741
+ }), s.dirty()) : R.assertNever(i);
2742
+ return { status: s.value, value: e.data };
2743
+ }
2744
+ gte(e, r) {
2745
+ return this.setLimit("min", e, !0, y.toString(r));
2746
+ }
2747
+ gt(e, r) {
2748
+ return this.setLimit("min", e, !1, y.toString(r));
2749
+ }
2750
+ lte(e, r) {
2751
+ return this.setLimit("max", e, !0, y.toString(r));
2752
+ }
2753
+ lt(e, r) {
2754
+ return this.setLimit("max", e, !1, y.toString(r));
2755
+ }
2756
+ setLimit(e, r, n, s) {
2757
+ return new le({
2758
+ ...this._def,
2759
+ checks: [
2760
+ ...this._def.checks,
2761
+ {
2762
+ kind: e,
2763
+ value: r,
2764
+ inclusive: n,
2765
+ message: y.toString(s)
2766
+ }
2767
+ ]
2768
+ });
2769
+ }
2770
+ _addCheck(e) {
2771
+ return new le({
2772
+ ...this._def,
2773
+ checks: [...this._def.checks, e]
2774
+ });
2775
+ }
2776
+ int(e) {
2777
+ return this._addCheck({
2778
+ kind: "int",
2779
+ message: y.toString(e)
2780
+ });
2781
+ }
2782
+ positive(e) {
2783
+ return this._addCheck({
2784
+ kind: "min",
2785
+ value: 0,
2786
+ inclusive: !1,
2787
+ message: y.toString(e)
2788
+ });
2789
+ }
2790
+ negative(e) {
2791
+ return this._addCheck({
2792
+ kind: "max",
2793
+ value: 0,
2794
+ inclusive: !1,
2795
+ message: y.toString(e)
2796
+ });
2797
+ }
2798
+ nonpositive(e) {
2799
+ return this._addCheck({
2800
+ kind: "max",
2801
+ value: 0,
2802
+ inclusive: !0,
2803
+ message: y.toString(e)
2804
+ });
2805
+ }
2806
+ nonnegative(e) {
2807
+ return this._addCheck({
2808
+ kind: "min",
2809
+ value: 0,
2810
+ inclusive: !0,
2811
+ message: y.toString(e)
2812
+ });
2813
+ }
2814
+ multipleOf(e, r) {
2815
+ return this._addCheck({
2816
+ kind: "multipleOf",
2817
+ value: e,
2818
+ message: y.toString(r)
2819
+ });
2820
+ }
2821
+ finite(e) {
2822
+ return this._addCheck({
2823
+ kind: "finite",
2824
+ message: y.toString(e)
2825
+ });
2826
+ }
2827
+ safe(e) {
2828
+ return this._addCheck({
2829
+ kind: "min",
2830
+ inclusive: !0,
2831
+ value: Number.MIN_SAFE_INTEGER,
2832
+ message: y.toString(e)
2833
+ })._addCheck({
2834
+ kind: "max",
2835
+ inclusive: !0,
2836
+ value: Number.MAX_SAFE_INTEGER,
2837
+ message: y.toString(e)
2838
+ });
2839
+ }
2840
+ get minValue() {
2841
+ let e = null;
2842
+ for (const r of this._def.checks)
2843
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2844
+ return e;
2845
+ }
2846
+ get maxValue() {
2847
+ let e = null;
2848
+ for (const r of this._def.checks)
2849
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2850
+ return e;
2851
+ }
2852
+ get isInt() {
2853
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && R.isInteger(e.value));
2854
+ }
2855
+ get isFinite() {
2856
+ let e = null, r = null;
2857
+ for (const n of this._def.checks) {
2858
+ if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
2859
+ return !0;
2860
+ n.kind === "min" ? (r === null || n.value > r) && (r = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
2861
+ }
2862
+ return Number.isFinite(r) && Number.isFinite(e);
2863
+ }
2864
+ }
2865
+ le.create = (t) => new le({
2866
+ checks: [],
2867
+ typeName: v.ZodNumber,
2868
+ coerce: t?.coerce || !1,
2869
+ ...x(t)
2870
+ });
2871
+ class de extends E {
2872
+ constructor() {
2873
+ super(...arguments), this.min = this.gte, this.max = this.lte;
2874
+ }
2875
+ _parse(e) {
2876
+ if (this._def.coerce)
2877
+ try {
2878
+ e.data = BigInt(e.data);
2879
+ } catch {
2880
+ return this._getInvalidInput(e);
2881
+ }
2882
+ if (this._getType(e) !== p.bigint)
2883
+ return this._getInvalidInput(e);
2884
+ let n;
2885
+ const s = new I();
2886
+ for (const i of this._def.checks)
2887
+ i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2888
+ code: f.too_small,
2889
+ type: "bigint",
2890
+ minimum: i.value,
2891
+ inclusive: i.inclusive,
2892
+ message: i.message
2893
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2894
+ code: f.too_big,
2895
+ type: "bigint",
2896
+ maximum: i.value,
2897
+ inclusive: i.inclusive,
2898
+ message: i.message
2899
+ }), s.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), h(n, {
2900
+ code: f.not_multiple_of,
2901
+ multipleOf: i.value,
2902
+ message: i.message
2903
+ }), s.dirty()) : R.assertNever(i);
2904
+ return { status: s.value, value: e.data };
2905
+ }
2906
+ _getInvalidInput(e) {
2907
+ const r = this._getOrReturnCtx(e);
2908
+ return h(r, {
2909
+ code: f.invalid_type,
2910
+ expected: p.bigint,
2911
+ received: r.parsedType
2912
+ }), b;
2913
+ }
2914
+ gte(e, r) {
2915
+ return this.setLimit("min", e, !0, y.toString(r));
2916
+ }
2917
+ gt(e, r) {
2918
+ return this.setLimit("min", e, !1, y.toString(r));
2919
+ }
2920
+ lte(e, r) {
2921
+ return this.setLimit("max", e, !0, y.toString(r));
2922
+ }
2923
+ lt(e, r) {
2924
+ return this.setLimit("max", e, !1, y.toString(r));
2925
+ }
2926
+ setLimit(e, r, n, s) {
2927
+ return new de({
2928
+ ...this._def,
2929
+ checks: [
2930
+ ...this._def.checks,
2931
+ {
2932
+ kind: e,
2933
+ value: r,
2934
+ inclusive: n,
2935
+ message: y.toString(s)
2936
+ }
2937
+ ]
2938
+ });
2939
+ }
2940
+ _addCheck(e) {
2941
+ return new de({
2942
+ ...this._def,
2943
+ checks: [...this._def.checks, e]
2944
+ });
2945
+ }
2946
+ positive(e) {
2947
+ return this._addCheck({
2948
+ kind: "min",
2949
+ value: BigInt(0),
2950
+ inclusive: !1,
2951
+ message: y.toString(e)
2952
+ });
2953
+ }
2954
+ negative(e) {
2955
+ return this._addCheck({
2956
+ kind: "max",
2957
+ value: BigInt(0),
2958
+ inclusive: !1,
2959
+ message: y.toString(e)
2960
+ });
2961
+ }
2962
+ nonpositive(e) {
2963
+ return this._addCheck({
2964
+ kind: "max",
2965
+ value: BigInt(0),
2966
+ inclusive: !0,
2967
+ message: y.toString(e)
2968
+ });
2969
+ }
2970
+ nonnegative(e) {
2971
+ return this._addCheck({
2972
+ kind: "min",
2973
+ value: BigInt(0),
2974
+ inclusive: !0,
2975
+ message: y.toString(e)
2976
+ });
2977
+ }
2978
+ multipleOf(e, r) {
2979
+ return this._addCheck({
2980
+ kind: "multipleOf",
2981
+ value: e,
2982
+ message: y.toString(r)
2983
+ });
2984
+ }
2985
+ get minValue() {
2986
+ let e = null;
2987
+ for (const r of this._def.checks)
2988
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2989
+ return e;
2990
+ }
2991
+ get maxValue() {
2992
+ let e = null;
2993
+ for (const r of this._def.checks)
2994
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2995
+ return e;
2996
+ }
2997
+ }
2998
+ de.create = (t) => {
2999
+ var e;
3000
+ return new de({
3001
+ checks: [],
3002
+ typeName: v.ZodBigInt,
3003
+ coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
3004
+ ...x(t)
3005
+ });
3006
+ };
3007
+ class ft extends E {
3008
+ _parse(e) {
3009
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
3010
+ const n = this._getOrReturnCtx(e);
3011
+ return h(n, {
3012
+ code: f.invalid_type,
3013
+ expected: p.boolean,
3014
+ received: n.parsedType
3015
+ }), b;
3016
+ }
3017
+ return F(e.data);
3018
+ }
3019
+ }
3020
+ ft.create = (t) => new ft({
3021
+ typeName: v.ZodBoolean,
3022
+ coerce: t?.coerce || !1,
3023
+ ...x(t)
3024
+ });
3025
+ class xe extends E {
3026
+ _parse(e) {
3027
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
3028
+ const i = this._getOrReturnCtx(e);
3029
+ return h(i, {
3030
+ code: f.invalid_type,
3031
+ expected: p.date,
3032
+ received: i.parsedType
3033
+ }), b;
3034
+ }
3035
+ if (isNaN(e.data.getTime())) {
3036
+ const i = this._getOrReturnCtx(e);
3037
+ return h(i, {
3038
+ code: f.invalid_date
3039
+ }), b;
3040
+ }
3041
+ const n = new I();
3042
+ let s;
3043
+ for (const i of this._def.checks)
3044
+ i.kind === "min" ? e.data.getTime() < i.value && (s = this._getOrReturnCtx(e, s), h(s, {
3045
+ code: f.too_small,
3046
+ message: i.message,
3047
+ inclusive: !0,
3048
+ exact: !1,
3049
+ minimum: i.value,
3050
+ type: "date"
3051
+ }), n.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (s = this._getOrReturnCtx(e, s), h(s, {
3052
+ code: f.too_big,
3053
+ message: i.message,
3054
+ inclusive: !0,
3055
+ exact: !1,
3056
+ maximum: i.value,
3057
+ type: "date"
3058
+ }), n.dirty()) : R.assertNever(i);
3059
+ return {
3060
+ status: n.value,
3061
+ value: new Date(e.data.getTime())
3062
+ };
3063
+ }
3064
+ _addCheck(e) {
3065
+ return new xe({
3066
+ ...this._def,
3067
+ checks: [...this._def.checks, e]
3068
+ });
3069
+ }
3070
+ min(e, r) {
3071
+ return this._addCheck({
3072
+ kind: "min",
3073
+ value: e.getTime(),
3074
+ message: y.toString(r)
3075
+ });
3076
+ }
3077
+ max(e, r) {
3078
+ return this._addCheck({
3079
+ kind: "max",
3080
+ value: e.getTime(),
3081
+ message: y.toString(r)
3082
+ });
3083
+ }
3084
+ get minDate() {
3085
+ let e = null;
3086
+ for (const r of this._def.checks)
3087
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
3088
+ return e != null ? new Date(e) : null;
3089
+ }
3090
+ get maxDate() {
3091
+ let e = null;
3092
+ for (const r of this._def.checks)
3093
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
3094
+ return e != null ? new Date(e) : null;
3095
+ }
3096
+ }
3097
+ xe.create = (t) => new xe({
3098
+ checks: [],
3099
+ coerce: t?.coerce || !1,
3100
+ typeName: v.ZodDate,
3101
+ ...x(t)
3102
+ });
3103
+ class ht extends E {
3104
+ _parse(e) {
3105
+ if (this._getType(e) !== p.symbol) {
3106
+ const n = this._getOrReturnCtx(e);
3107
+ return h(n, {
3108
+ code: f.invalid_type,
3109
+ expected: p.symbol,
3110
+ received: n.parsedType
3111
+ }), b;
3112
+ }
3113
+ return F(e.data);
3114
+ }
3115
+ }
3116
+ ht.create = (t) => new ht({
3117
+ typeName: v.ZodSymbol,
3118
+ ...x(t)
3119
+ });
3120
+ class Ie extends E {
3121
+ _parse(e) {
3122
+ if (this._getType(e) !== p.undefined) {
3123
+ const n = this._getOrReturnCtx(e);
3124
+ return h(n, {
3125
+ code: f.invalid_type,
3126
+ expected: p.undefined,
3127
+ received: n.parsedType
3128
+ }), b;
3129
+ }
3130
+ return F(e.data);
3131
+ }
3132
+ }
3133
+ Ie.create = (t) => new Ie({
3134
+ typeName: v.ZodUndefined,
3135
+ ...x(t)
3136
+ });
3137
+ class De extends E {
3138
+ _parse(e) {
3139
+ if (this._getType(e) !== p.null) {
3140
+ const n = this._getOrReturnCtx(e);
3141
+ return h(n, {
3142
+ code: f.invalid_type,
3143
+ expected: p.null,
3144
+ received: n.parsedType
3145
+ }), b;
3146
+ }
3147
+ return F(e.data);
3148
+ }
3149
+ }
3150
+ De.create = (t) => new De({
3151
+ typeName: v.ZodNull,
3152
+ ...x(t)
3153
+ });
3154
+ class pt extends E {
3155
+ constructor() {
3156
+ super(...arguments), this._any = !0;
3157
+ }
3158
+ _parse(e) {
3159
+ return F(e.data);
3160
+ }
3161
+ }
3162
+ pt.create = (t) => new pt({
3163
+ typeName: v.ZodAny,
3164
+ ...x(t)
3165
+ });
3166
+ class ce extends E {
3167
+ constructor() {
3168
+ super(...arguments), this._unknown = !0;
3169
+ }
3170
+ _parse(e) {
3171
+ return F(e.data);
3172
+ }
3173
+ }
3174
+ ce.create = (t) => new ce({
3175
+ typeName: v.ZodUnknown,
3176
+ ...x(t)
3177
+ });
3178
+ class Y extends E {
3179
+ _parse(e) {
3180
+ const r = this._getOrReturnCtx(e);
3181
+ return h(r, {
3182
+ code: f.invalid_type,
3183
+ expected: p.never,
3184
+ received: r.parsedType
3185
+ }), b;
3186
+ }
3187
+ }
3188
+ Y.create = (t) => new Y({
3189
+ typeName: v.ZodNever,
3190
+ ...x(t)
3191
+ });
3192
+ class mt extends E {
3193
+ _parse(e) {
3194
+ if (this._getType(e) !== p.undefined) {
3195
+ const n = this._getOrReturnCtx(e);
3196
+ return h(n, {
3197
+ code: f.invalid_type,
3198
+ expected: p.void,
3199
+ received: n.parsedType
3200
+ }), b;
3201
+ }
3202
+ return F(e.data);
3203
+ }
3204
+ }
3205
+ mt.create = (t) => new mt({
3206
+ typeName: v.ZodVoid,
3207
+ ...x(t)
3208
+ });
3209
+ class $ extends E {
3210
+ _parse(e) {
3211
+ const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
3212
+ if (r.parsedType !== p.array)
3213
+ return h(r, {
3214
+ code: f.invalid_type,
3215
+ expected: p.array,
3216
+ received: r.parsedType
3217
+ }), b;
3218
+ if (s.exactLength !== null) {
3219
+ const a = r.data.length > s.exactLength.value, o = r.data.length < s.exactLength.value;
3220
+ (a || o) && (h(r, {
3221
+ code: a ? f.too_big : f.too_small,
3222
+ minimum: o ? s.exactLength.value : void 0,
3223
+ maximum: a ? s.exactLength.value : void 0,
3224
+ type: "array",
3225
+ inclusive: !0,
3226
+ exact: !0,
3227
+ message: s.exactLength.message
3228
+ }), n.dirty());
3229
+ }
3230
+ if (s.minLength !== null && r.data.length < s.minLength.value && (h(r, {
3231
+ code: f.too_small,
3232
+ minimum: s.minLength.value,
3233
+ type: "array",
3234
+ inclusive: !0,
3235
+ exact: !1,
3236
+ message: s.minLength.message
3237
+ }), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (h(r, {
3238
+ code: f.too_big,
3239
+ maximum: s.maxLength.value,
3240
+ type: "array",
3241
+ inclusive: !0,
3242
+ exact: !1,
3243
+ message: s.maxLength.message
3244
+ }), n.dirty()), r.common.async)
3245
+ return Promise.all([...r.data].map((a, o) => s.type._parseAsync(new z(r, a, r.path, o)))).then((a) => I.mergeArray(n, a));
3246
+ const i = [...r.data].map((a, o) => s.type._parseSync(new z(r, a, r.path, o)));
3247
+ return I.mergeArray(n, i);
3248
+ }
3249
+ get element() {
3250
+ return this._def.type;
3251
+ }
3252
+ min(e, r) {
3253
+ return new $({
3254
+ ...this._def,
3255
+ minLength: { value: e, message: y.toString(r) }
3256
+ });
3257
+ }
3258
+ max(e, r) {
3259
+ return new $({
3260
+ ...this._def,
3261
+ maxLength: { value: e, message: y.toString(r) }
3262
+ });
3263
+ }
3264
+ length(e, r) {
3265
+ return new $({
3266
+ ...this._def,
3267
+ exactLength: { value: e, message: y.toString(r) }
3268
+ });
3269
+ }
3270
+ nonempty(e) {
3271
+ return this.min(1, e);
3272
+ }
3273
+ }
3274
+ $.create = (t, e) => new $({
3275
+ type: t,
3276
+ minLength: null,
3277
+ maxLength: null,
3278
+ exactLength: null,
3279
+ typeName: v.ZodArray,
3280
+ ...x(e)
3281
+ });
3282
+ function ae(t) {
3283
+ if (t instanceof A) {
3284
+ const e = {};
3285
+ for (const r in t.shape) {
3286
+ const n = t.shape[r];
3287
+ e[r] = W.create(ae(n));
3288
+ }
3289
+ return new A({
3290
+ ...t._def,
3291
+ shape: () => e
3292
+ });
3293
+ } else return t instanceof $ ? new $({
3294
+ ...t._def,
3295
+ type: ae(t.element)
3296
+ }) : t instanceof W ? W.create(ae(t.unwrap())) : t instanceof se ? se.create(ae(t.unwrap())) : t instanceof J ? J.create(t.items.map((e) => ae(e))) : t;
3297
+ }
3298
+ class A extends E {
3299
+ constructor() {
3300
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
3301
+ }
3302
+ _getCached() {
3303
+ if (this._cached !== null)
3304
+ return this._cached;
3305
+ const e = this._def.shape(), r = R.objectKeys(e);
3306
+ return this._cached = { shape: e, keys: r };
3307
+ }
3308
+ _parse(e) {
3309
+ if (this._getType(e) !== p.object) {
3310
+ const c = this._getOrReturnCtx(e);
3311
+ return h(c, {
3312
+ code: f.invalid_type,
3313
+ expected: p.object,
3314
+ received: c.parsedType
3315
+ }), b;
3316
+ }
3317
+ const { status: n, ctx: s } = this._processInputParams(e), { shape: i, keys: a } = this._getCached(), o = [];
3318
+ if (!(this._def.catchall instanceof Y && this._def.unknownKeys === "strip"))
3319
+ for (const c in s.data)
3320
+ a.includes(c) || o.push(c);
3321
+ const d = [];
3322
+ for (const c of a) {
3323
+ const l = i[c], m = s.data[c];
3324
+ d.push({
3325
+ key: { status: "valid", value: c },
3326
+ value: l._parse(new z(s, m, s.path, c)),
3327
+ alwaysSet: c in s.data
3328
+ });
3329
+ }
3330
+ if (this._def.catchall instanceof Y) {
3331
+ const c = this._def.unknownKeys;
3332
+ if (c === "passthrough")
3333
+ for (const l of o)
3334
+ d.push({
3335
+ key: { status: "valid", value: l },
3336
+ value: { status: "valid", value: s.data[l] }
3337
+ });
3338
+ else if (c === "strict")
3339
+ o.length > 0 && (h(s, {
3340
+ code: f.unrecognized_keys,
3341
+ keys: o
3342
+ }), n.dirty());
3343
+ else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
3344
+ } else {
3345
+ const c = this._def.catchall;
3346
+ for (const l of o) {
3347
+ const m = s.data[l];
3348
+ d.push({
3349
+ key: { status: "valid", value: l },
3350
+ value: c._parse(
3351
+ new z(s, m, s.path, l)
3352
+ //, ctx.child(key), value, getParsedType(value)
3353
+ ),
3354
+ alwaysSet: l in s.data
3355
+ });
3356
+ }
3357
+ }
3358
+ return s.common.async ? Promise.resolve().then(async () => {
3359
+ const c = [];
3360
+ for (const l of d) {
3361
+ const m = await l.key, S = await l.value;
3362
+ c.push({
3363
+ key: m,
3364
+ value: S,
3365
+ alwaysSet: l.alwaysSet
3366
+ });
3367
+ }
3368
+ return c;
3369
+ }).then((c) => I.mergeObjectSync(n, c)) : I.mergeObjectSync(n, d);
3370
+ }
3371
+ get shape() {
3372
+ return this._def.shape();
3373
+ }
3374
+ strict(e) {
3375
+ return y.errToObj, new A({
3376
+ ...this._def,
3377
+ unknownKeys: "strict",
3378
+ ...e !== void 0 ? {
3379
+ errorMap: (r, n) => {
3380
+ var s, i, a, o;
3381
+ const d = (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;
3382
+ return r.code === "unrecognized_keys" ? {
3383
+ message: (o = y.errToObj(e).message) !== null && o !== void 0 ? o : d
3384
+ } : {
3385
+ message: d
3386
+ };
3387
+ }
3388
+ } : {}
3389
+ });
3390
+ }
3391
+ strip() {
3392
+ return new A({
3393
+ ...this._def,
3394
+ unknownKeys: "strip"
3395
+ });
3396
+ }
3397
+ passthrough() {
3398
+ return new A({
3399
+ ...this._def,
3400
+ unknownKeys: "passthrough"
3401
+ });
3402
+ }
3403
+ // const AugmentFactory =
3404
+ // <Def extends ZodObjectDef>(def: Def) =>
3405
+ // <Augmentation extends ZodRawShape>(
3406
+ // augmentation: Augmentation
3407
+ // ): ZodObject<
3408
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
3409
+ // Def["unknownKeys"],
3410
+ // Def["catchall"]
3411
+ // > => {
3412
+ // return new ZodObject({
3413
+ // ...def,
3414
+ // shape: () => ({
3415
+ // ...def.shape(),
3416
+ // ...augmentation,
3417
+ // }),
3418
+ // }) as any;
3419
+ // };
3420
+ extend(e) {
3421
+ return new A({
3422
+ ...this._def,
3423
+ shape: () => ({
3424
+ ...this._def.shape(),
3425
+ ...e
3426
+ })
3427
+ });
3428
+ }
3429
+ /**
3430
+ * Prior to zod@1.0.12 there was a bug in the
3431
+ * inferred type of merged objects. Please
3432
+ * upgrade if you are experiencing issues.
3433
+ */
3434
+ merge(e) {
3435
+ return new A({
3436
+ unknownKeys: e._def.unknownKeys,
3437
+ catchall: e._def.catchall,
3438
+ shape: () => ({
3439
+ ...this._def.shape(),
3440
+ ...e._def.shape()
3441
+ }),
3442
+ typeName: v.ZodObject
3443
+ });
3444
+ }
3445
+ // merge<
3446
+ // Incoming extends AnyZodObject,
3447
+ // Augmentation extends Incoming["shape"],
3448
+ // NewOutput extends {
3449
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
3450
+ // ? Augmentation[k]["_output"]
3451
+ // : k extends keyof Output
3452
+ // ? Output[k]
3453
+ // : never;
3454
+ // },
3455
+ // NewInput extends {
3456
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
3457
+ // ? Augmentation[k]["_input"]
3458
+ // : k extends keyof Input
3459
+ // ? Input[k]
3460
+ // : never;
3461
+ // }
3462
+ // >(
3463
+ // merging: Incoming
3464
+ // ): ZodObject<
3465
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3466
+ // Incoming["_def"]["unknownKeys"],
3467
+ // Incoming["_def"]["catchall"],
3468
+ // NewOutput,
3469
+ // NewInput
3470
+ // > {
3471
+ // const merged: any = new ZodObject({
3472
+ // unknownKeys: merging._def.unknownKeys,
3473
+ // catchall: merging._def.catchall,
3474
+ // shape: () =>
3475
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3476
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3477
+ // }) as any;
3478
+ // return merged;
3479
+ // }
3480
+ setKey(e, r) {
3481
+ return this.augment({ [e]: r });
3482
+ }
3483
+ // merge<Incoming extends AnyZodObject>(
3484
+ // merging: Incoming
3485
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
3486
+ // ZodObject<
3487
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3488
+ // Incoming["_def"]["unknownKeys"],
3489
+ // Incoming["_def"]["catchall"]
3490
+ // > {
3491
+ // // const mergedShape = objectUtil.mergeShapes(
3492
+ // // this._def.shape(),
3493
+ // // merging._def.shape()
3494
+ // // );
3495
+ // const merged: any = new ZodObject({
3496
+ // unknownKeys: merging._def.unknownKeys,
3497
+ // catchall: merging._def.catchall,
3498
+ // shape: () =>
3499
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3500
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3501
+ // }) as any;
3502
+ // return merged;
3503
+ // }
3504
+ catchall(e) {
3505
+ return new A({
3506
+ ...this._def,
3507
+ catchall: e
3508
+ });
3509
+ }
3510
+ pick(e) {
3511
+ const r = {};
3512
+ return R.objectKeys(e).forEach((n) => {
3513
+ e[n] && this.shape[n] && (r[n] = this.shape[n]);
3514
+ }), new A({
3515
+ ...this._def,
3516
+ shape: () => r
3517
+ });
3518
+ }
3519
+ omit(e) {
3520
+ const r = {};
3521
+ return R.objectKeys(this.shape).forEach((n) => {
3522
+ e[n] || (r[n] = this.shape[n]);
3523
+ }), new A({
3524
+ ...this._def,
3525
+ shape: () => r
3526
+ });
3527
+ }
3528
+ /**
3529
+ * @deprecated
3530
+ */
3531
+ deepPartial() {
3532
+ return ae(this);
3533
+ }
3534
+ partial(e) {
3535
+ const r = {};
3536
+ return R.objectKeys(this.shape).forEach((n) => {
3537
+ const s = this.shape[n];
3538
+ e && !e[n] ? r[n] = s : r[n] = s.optional();
3539
+ }), new A({
3540
+ ...this._def,
3541
+ shape: () => r
3542
+ });
3543
+ }
3544
+ required(e) {
3545
+ const r = {};
3546
+ return R.objectKeys(this.shape).forEach((n) => {
3547
+ if (e && !e[n])
3548
+ r[n] = this.shape[n];
3549
+ else {
3550
+ let i = this.shape[n];
3551
+ for (; i instanceof W; )
3552
+ i = i._def.innerType;
3553
+ r[n] = i;
3554
+ }
3555
+ }), new A({
3556
+ ...this._def,
3557
+ shape: () => r
3558
+ });
3559
+ }
3560
+ keyof() {
3561
+ return yr(R.objectKeys(this.shape));
3562
+ }
3563
+ }
3564
+ A.create = (t, e) => new A({
3565
+ shape: () => t,
3566
+ unknownKeys: "strip",
3567
+ catchall: Y.create(),
3568
+ typeName: v.ZodObject,
3569
+ ...x(e)
3570
+ });
3571
+ A.strictCreate = (t, e) => new A({
3572
+ shape: () => t,
3573
+ unknownKeys: "strict",
3574
+ catchall: Y.create(),
3575
+ typeName: v.ZodObject,
3576
+ ...x(e)
3577
+ });
3578
+ A.lazycreate = (t, e) => new A({
3579
+ shape: t,
3580
+ unknownKeys: "strip",
3581
+ catchall: Y.create(),
3582
+ typeName: v.ZodObject,
3583
+ ...x(e)
3584
+ });
3585
+ class Le extends E {
3586
+ _parse(e) {
3587
+ const { ctx: r } = this._processInputParams(e), n = this._def.options;
3588
+ function s(i) {
3589
+ for (const o of i)
3590
+ if (o.result.status === "valid")
3591
+ return o.result;
3592
+ for (const o of i)
3593
+ if (o.result.status === "dirty")
3594
+ return r.common.issues.push(...o.ctx.common.issues), o.result;
3595
+ const a = i.map((o) => new Z(o.ctx.common.issues));
3596
+ return h(r, {
3597
+ code: f.invalid_union,
3598
+ unionErrors: a
3599
+ }), b;
3600
+ }
3601
+ if (r.common.async)
3602
+ return Promise.all(n.map(async (i) => {
3603
+ const a = {
3604
+ ...r,
3605
+ common: {
3606
+ ...r.common,
3607
+ issues: []
3608
+ },
3609
+ parent: null
3610
+ };
3611
+ return {
3612
+ result: await i._parseAsync({
3613
+ data: r.data,
3614
+ path: r.path,
3615
+ parent: a
3616
+ }),
3617
+ ctx: a
3618
+ };
3619
+ })).then(s);
3620
+ {
3621
+ let i;
3622
+ const a = [];
3623
+ for (const d of n) {
3624
+ const c = {
3625
+ ...r,
3626
+ common: {
3627
+ ...r.common,
3628
+ issues: []
3629
+ },
3630
+ parent: null
3631
+ }, l = d._parseSync({
3632
+ data: r.data,
3633
+ path: r.path,
3634
+ parent: c
3635
+ });
3636
+ if (l.status === "valid")
3637
+ return l;
3638
+ l.status === "dirty" && !i && (i = { result: l, ctx: c }), c.common.issues.length && a.push(c.common.issues);
3639
+ }
3640
+ if (i)
3641
+ return r.common.issues.push(...i.ctx.common.issues), i.result;
3642
+ const o = a.map((d) => new Z(d));
3643
+ return h(r, {
3644
+ code: f.invalid_union,
3645
+ unionErrors: o
3646
+ }), b;
3647
+ }
3648
+ }
3649
+ get options() {
3650
+ return this._def.options;
3651
+ }
3652
+ }
3653
+ Le.create = (t, e) => new Le({
3654
+ options: t,
3655
+ typeName: v.ZodUnion,
3656
+ ...x(e)
3657
+ });
3658
+ const V = (t) => t instanceof Ze ? V(t.schema) : t instanceof K ? V(t.innerType()) : t instanceof Me ? [t.value] : t instanceof ne ? t.options : t instanceof Be ? R.objectValues(t.enum) : t instanceof $e ? V(t._def.innerType) : t instanceof Ie ? [void 0] : t instanceof De ? [null] : t instanceof W ? [void 0, ...V(t.unwrap())] : t instanceof se ? [null, ...V(t.unwrap())] : t instanceof gr || t instanceof qe ? V(t.unwrap()) : t instanceof ze ? V(t._def.innerType) : [];
3659
+ class kt extends E {
3660
+ _parse(e) {
3661
+ const { ctx: r } = this._processInputParams(e);
3662
+ if (r.parsedType !== p.object)
3663
+ return h(r, {
3664
+ code: f.invalid_type,
3665
+ expected: p.object,
3666
+ received: r.parsedType
3667
+ }), b;
3668
+ const n = this.discriminator, s = r.data[n], i = this.optionsMap.get(s);
3669
+ return i ? r.common.async ? i._parseAsync({
3670
+ data: r.data,
3671
+ path: r.path,
3672
+ parent: r
3673
+ }) : i._parseSync({
3674
+ data: r.data,
3675
+ path: r.path,
3676
+ parent: r
3677
+ }) : (h(r, {
3678
+ code: f.invalid_union_discriminator,
3679
+ options: Array.from(this.optionsMap.keys()),
3680
+ path: [n]
3681
+ }), b);
3682
+ }
3683
+ get discriminator() {
3684
+ return this._def.discriminator;
3685
+ }
3686
+ get options() {
3687
+ return this._def.options;
3688
+ }
3689
+ get optionsMap() {
3690
+ return this._def.optionsMap;
3691
+ }
3692
+ /**
3693
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
3694
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
3695
+ * have a different value for each object in the union.
3696
+ * @param discriminator the name of the discriminator property
3697
+ * @param types an array of object schemas
3698
+ * @param params
3699
+ */
3700
+ static create(e, r, n) {
3701
+ const s = /* @__PURE__ */ new Map();
3702
+ for (const i of r) {
3703
+ const a = V(i.shape[e]);
3704
+ if (!a.length)
3705
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
3706
+ for (const o of a) {
3707
+ if (s.has(o))
3708
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
3709
+ s.set(o, i);
3710
+ }
3711
+ }
3712
+ return new kt({
3713
+ typeName: v.ZodDiscriminatedUnion,
3714
+ discriminator: e,
3715
+ options: r,
3716
+ optionsMap: s,
3717
+ ...x(n)
3718
+ });
3719
+ }
3720
+ }
3721
+ function yt(t, e) {
3722
+ const r = G(t), n = G(e);
3723
+ if (t === e)
3724
+ return { valid: !0, data: t };
3725
+ if (r === p.object && n === p.object) {
3726
+ const s = R.objectKeys(e), i = R.objectKeys(t).filter((o) => s.indexOf(o) !== -1), a = { ...t, ...e };
3727
+ for (const o of i) {
3728
+ const d = yt(t[o], e[o]);
3729
+ if (!d.valid)
3730
+ return { valid: !1 };
3731
+ a[o] = d.data;
3732
+ }
3733
+ return { valid: !0, data: a };
3734
+ } else if (r === p.array && n === p.array) {
3735
+ if (t.length !== e.length)
3736
+ return { valid: !1 };
3737
+ const s = [];
3738
+ for (let i = 0; i < t.length; i++) {
3739
+ const a = t[i], o = e[i], d = yt(a, o);
3740
+ if (!d.valid)
3741
+ return { valid: !1 };
3742
+ s.push(d.data);
3743
+ }
3744
+ return { valid: !0, data: s };
3745
+ } else return r === p.date && n === p.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
3746
+ }
3747
+ class Ue extends E {
3748
+ _parse(e) {
3749
+ const { status: r, ctx: n } = this._processInputParams(e), s = (i, a) => {
3750
+ if (Zt(i) || Zt(a))
3751
+ return b;
3752
+ const o = yt(i.value, a.value);
3753
+ return o.valid ? ((Mt(i) || Mt(a)) && r.dirty(), { status: r.value, value: o.data }) : (h(n, {
3754
+ code: f.invalid_intersection_types
3755
+ }), b);
3756
+ };
3757
+ return n.common.async ? Promise.all([
3758
+ this._def.left._parseAsync({
3759
+ data: n.data,
3760
+ path: n.path,
3761
+ parent: n
3762
+ }),
3763
+ this._def.right._parseAsync({
3764
+ data: n.data,
3765
+ path: n.path,
3766
+ parent: n
3767
+ })
3768
+ ]).then(([i, a]) => s(i, a)) : s(this._def.left._parseSync({
3769
+ data: n.data,
3770
+ path: n.path,
3771
+ parent: n
3772
+ }), this._def.right._parseSync({
3773
+ data: n.data,
3774
+ path: n.path,
3775
+ parent: n
3776
+ }));
3777
+ }
3778
+ }
3779
+ Ue.create = (t, e, r) => new Ue({
3780
+ left: t,
3781
+ right: e,
3782
+ typeName: v.ZodIntersection,
3783
+ ...x(r)
3784
+ });
3785
+ class J extends E {
3786
+ _parse(e) {
3787
+ const { status: r, ctx: n } = this._processInputParams(e);
3788
+ if (n.parsedType !== p.array)
3789
+ return h(n, {
3790
+ code: f.invalid_type,
3791
+ expected: p.array,
3792
+ received: n.parsedType
3793
+ }), b;
3794
+ if (n.data.length < this._def.items.length)
3795
+ return h(n, {
3796
+ code: f.too_small,
3797
+ minimum: this._def.items.length,
3798
+ inclusive: !0,
3799
+ exact: !1,
3800
+ type: "array"
3801
+ }), b;
3802
+ !this._def.rest && n.data.length > this._def.items.length && (h(n, {
3803
+ code: f.too_big,
3804
+ maximum: this._def.items.length,
3805
+ inclusive: !0,
3806
+ exact: !1,
3807
+ type: "array"
3808
+ }), r.dirty());
3809
+ const i = [...n.data].map((a, o) => {
3810
+ const d = this._def.items[o] || this._def.rest;
3811
+ return d ? d._parse(new z(n, a, n.path, o)) : null;
3812
+ }).filter((a) => !!a);
3813
+ return n.common.async ? Promise.all(i).then((a) => I.mergeArray(r, a)) : I.mergeArray(r, i);
3814
+ }
3815
+ get items() {
3816
+ return this._def.items;
3817
+ }
3818
+ rest(e) {
3819
+ return new J({
3820
+ ...this._def,
3821
+ rest: e
3822
+ });
3823
+ }
3824
+ }
3825
+ J.create = (t, e) => {
3826
+ if (!Array.isArray(t))
3827
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3828
+ return new J({
3829
+ items: t,
3830
+ typeName: v.ZodTuple,
3831
+ rest: null,
3832
+ ...x(e)
3833
+ });
3834
+ };
3835
+ class Fe extends E {
3836
+ get keySchema() {
3837
+ return this._def.keyType;
3838
+ }
3839
+ get valueSchema() {
3840
+ return this._def.valueType;
3841
+ }
3842
+ _parse(e) {
3843
+ const { status: r, ctx: n } = this._processInputParams(e);
3844
+ if (n.parsedType !== p.object)
3845
+ return h(n, {
3846
+ code: f.invalid_type,
3847
+ expected: p.object,
3848
+ received: n.parsedType
3849
+ }), b;
3850
+ const s = [], i = this._def.keyType, a = this._def.valueType;
3851
+ for (const o in n.data)
3852
+ s.push({
3853
+ key: i._parse(new z(n, o, n.path, o)),
3854
+ value: a._parse(new z(n, n.data[o], n.path, o)),
3855
+ alwaysSet: o in n.data
3856
+ });
3857
+ return n.common.async ? I.mergeObjectAsync(r, s) : I.mergeObjectSync(r, s);
3858
+ }
3859
+ get element() {
3860
+ return this._def.valueType;
3861
+ }
3862
+ static create(e, r, n) {
3863
+ return r instanceof E ? new Fe({
3864
+ keyType: e,
3865
+ valueType: r,
3866
+ typeName: v.ZodRecord,
3867
+ ...x(n)
3868
+ }) : new Fe({
3869
+ keyType: H.create(),
3870
+ valueType: e,
3871
+ typeName: v.ZodRecord,
3872
+ ...x(r)
3873
+ });
3874
+ }
3875
+ }
3876
+ class gt extends E {
3877
+ get keySchema() {
3878
+ return this._def.keyType;
3879
+ }
3880
+ get valueSchema() {
3881
+ return this._def.valueType;
3882
+ }
3883
+ _parse(e) {
3884
+ const { status: r, ctx: n } = this._processInputParams(e);
3885
+ if (n.parsedType !== p.map)
3886
+ return h(n, {
3887
+ code: f.invalid_type,
3888
+ expected: p.map,
3889
+ received: n.parsedType
3890
+ }), b;
3891
+ const s = this._def.keyType, i = this._def.valueType, a = [...n.data.entries()].map(([o, d], c) => ({
3892
+ key: s._parse(new z(n, o, n.path, [c, "key"])),
3893
+ value: i._parse(new z(n, d, n.path, [c, "value"]))
3894
+ }));
3895
+ if (n.common.async) {
3896
+ const o = /* @__PURE__ */ new Map();
3897
+ return Promise.resolve().then(async () => {
3898
+ for (const d of a) {
3899
+ const c = await d.key, l = await d.value;
3900
+ if (c.status === "aborted" || l.status === "aborted")
3901
+ return b;
3902
+ (c.status === "dirty" || l.status === "dirty") && r.dirty(), o.set(c.value, l.value);
3903
+ }
3904
+ return { status: r.value, value: o };
3905
+ });
3906
+ } else {
3907
+ const o = /* @__PURE__ */ new Map();
3908
+ for (const d of a) {
3909
+ const c = d.key, l = d.value;
3910
+ if (c.status === "aborted" || l.status === "aborted")
3911
+ return b;
3912
+ (c.status === "dirty" || l.status === "dirty") && r.dirty(), o.set(c.value, l.value);
3913
+ }
3914
+ return { status: r.value, value: o };
3915
+ }
3916
+ }
3917
+ }
3918
+ gt.create = (t, e, r) => new gt({
3919
+ valueType: e,
3920
+ keyType: t,
3921
+ typeName: v.ZodMap,
3922
+ ...x(r)
3923
+ });
3924
+ class fe extends E {
3925
+ _parse(e) {
3926
+ const { status: r, ctx: n } = this._processInputParams(e);
3927
+ if (n.parsedType !== p.set)
3928
+ return h(n, {
3929
+ code: f.invalid_type,
3930
+ expected: p.set,
3931
+ received: n.parsedType
3932
+ }), b;
3933
+ const s = this._def;
3934
+ s.minSize !== null && n.data.size < s.minSize.value && (h(n, {
3935
+ code: f.too_small,
3936
+ minimum: s.minSize.value,
3937
+ type: "set",
3938
+ inclusive: !0,
3939
+ exact: !1,
3940
+ message: s.minSize.message
3941
+ }), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (h(n, {
3942
+ code: f.too_big,
3943
+ maximum: s.maxSize.value,
3944
+ type: "set",
3945
+ inclusive: !0,
3946
+ exact: !1,
3947
+ message: s.maxSize.message
3948
+ }), r.dirty());
3949
+ const i = this._def.valueType;
3950
+ function a(d) {
3951
+ const c = /* @__PURE__ */ new Set();
3952
+ for (const l of d) {
3953
+ if (l.status === "aborted")
3954
+ return b;
3955
+ l.status === "dirty" && r.dirty(), c.add(l.value);
3956
+ }
3957
+ return { status: r.value, value: c };
3958
+ }
3959
+ const o = [...n.data.values()].map((d, c) => i._parse(new z(n, d, n.path, c)));
3960
+ return n.common.async ? Promise.all(o).then((d) => a(d)) : a(o);
3961
+ }
3962
+ min(e, r) {
3963
+ return new fe({
3964
+ ...this._def,
3965
+ minSize: { value: e, message: y.toString(r) }
3966
+ });
3967
+ }
3968
+ max(e, r) {
3969
+ return new fe({
3970
+ ...this._def,
3971
+ maxSize: { value: e, message: y.toString(r) }
3972
+ });
3973
+ }
3974
+ size(e, r) {
3975
+ return this.min(e, r).max(e, r);
3976
+ }
3977
+ nonempty(e) {
3978
+ return this.min(1, e);
3979
+ }
3980
+ }
3981
+ fe.create = (t, e) => new fe({
3982
+ valueType: t,
3983
+ minSize: null,
3984
+ maxSize: null,
3985
+ typeName: v.ZodSet,
3986
+ ...x(e)
3987
+ });
3988
+ class ve extends E {
3989
+ constructor() {
3990
+ super(...arguments), this.validate = this.implement;
3991
+ }
3992
+ _parse(e) {
3993
+ const { ctx: r } = this._processInputParams(e);
3994
+ if (r.parsedType !== p.function)
3995
+ return h(r, {
3996
+ code: f.invalid_type,
3997
+ expected: p.function,
3998
+ received: r.parsedType
3999
+ }), b;
4000
+ function n(o, d) {
4001
+ return dt({
4002
+ data: o,
4003
+ path: r.path,
4004
+ errorMaps: [
4005
+ r.common.contextualErrorMap,
4006
+ r.schemaErrorMap,
4007
+ lt(),
4008
+ we
4009
+ ].filter((c) => !!c),
4010
+ issueData: {
4011
+ code: f.invalid_arguments,
4012
+ argumentsError: d
4013
+ }
4014
+ });
4015
+ }
4016
+ function s(o, d) {
4017
+ return dt({
4018
+ data: o,
4019
+ path: r.path,
4020
+ errorMaps: [
4021
+ r.common.contextualErrorMap,
4022
+ r.schemaErrorMap,
4023
+ lt(),
4024
+ we
4025
+ ].filter((c) => !!c),
4026
+ issueData: {
4027
+ code: f.invalid_return_type,
4028
+ returnTypeError: d
4029
+ }
4030
+ });
4031
+ }
4032
+ const i = { errorMap: r.common.contextualErrorMap }, a = r.data;
4033
+ if (this._def.returns instanceof ke) {
4034
+ const o = this;
4035
+ return F(async function(...d) {
4036
+ const c = new Z([]), l = await o._def.args.parseAsync(d, i).catch((T) => {
4037
+ throw c.addIssue(n(d, T)), c;
4038
+ }), m = await Reflect.apply(a, this, l);
4039
+ return await o._def.returns._def.type.parseAsync(m, i).catch((T) => {
4040
+ throw c.addIssue(s(m, T)), c;
4041
+ });
4042
+ });
4043
+ } else {
4044
+ const o = this;
4045
+ return F(function(...d) {
4046
+ const c = o._def.args.safeParse(d, i);
4047
+ if (!c.success)
4048
+ throw new Z([n(d, c.error)]);
4049
+ const l = Reflect.apply(a, this, c.data), m = o._def.returns.safeParse(l, i);
4050
+ if (!m.success)
4051
+ throw new Z([s(l, m.error)]);
4052
+ return m.data;
4053
+ });
4054
+ }
4055
+ }
4056
+ parameters() {
4057
+ return this._def.args;
4058
+ }
4059
+ returnType() {
4060
+ return this._def.returns;
4061
+ }
4062
+ args(...e) {
4063
+ return new ve({
4064
+ ...this._def,
4065
+ args: J.create(e).rest(ce.create())
4066
+ });
4067
+ }
4068
+ returns(e) {
4069
+ return new ve({
4070
+ ...this._def,
4071
+ returns: e
4072
+ });
4073
+ }
4074
+ implement(e) {
4075
+ return this.parse(e);
4076
+ }
4077
+ strictImplement(e) {
4078
+ return this.parse(e);
4079
+ }
4080
+ static create(e, r, n) {
4081
+ return new ve({
4082
+ args: e || J.create([]).rest(ce.create()),
4083
+ returns: r || ce.create(),
4084
+ typeName: v.ZodFunction,
4085
+ ...x(n)
4086
+ });
4087
+ }
4088
+ }
4089
+ class Ze extends E {
4090
+ get schema() {
4091
+ return this._def.getter();
4092
+ }
4093
+ _parse(e) {
4094
+ const { ctx: r } = this._processInputParams(e);
4095
+ return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
4096
+ }
4097
+ }
4098
+ Ze.create = (t, e) => new Ze({
4099
+ getter: t,
4100
+ typeName: v.ZodLazy,
4101
+ ...x(e)
4102
+ });
4103
+ class Me extends E {
4104
+ _parse(e) {
4105
+ if (e.data !== this._def.value) {
4106
+ const r = this._getOrReturnCtx(e);
4107
+ return h(r, {
4108
+ received: r.data,
4109
+ code: f.invalid_literal,
4110
+ expected: this._def.value
4111
+ }), b;
4112
+ }
4113
+ return { status: "valid", value: e.data };
4114
+ }
4115
+ get value() {
4116
+ return this._def.value;
4117
+ }
4118
+ }
4119
+ Me.create = (t, e) => new Me({
4120
+ value: t,
4121
+ typeName: v.ZodLiteral,
4122
+ ...x(e)
4123
+ });
4124
+ function yr(t, e) {
4125
+ return new ne({
4126
+ values: t,
4127
+ typeName: v.ZodEnum,
4128
+ ...x(e)
4129
+ });
4130
+ }
4131
+ class ne extends E {
4132
+ constructor() {
4133
+ super(...arguments), ge.set(this, void 0);
4134
+ }
4135
+ _parse(e) {
4136
+ if (typeof e.data != "string") {
4137
+ const r = this._getOrReturnCtx(e), n = this._def.values;
4138
+ return h(r, {
4139
+ expected: R.joinValues(n),
4140
+ received: r.parsedType,
4141
+ code: f.invalid_type
4142
+ }), b;
4143
+ }
4144
+ if (Pe(this, ge) || hr(this, ge, new Set(this._def.values)), !Pe(this, ge).has(e.data)) {
4145
+ const r = this._getOrReturnCtx(e), n = this._def.values;
4146
+ return h(r, {
4147
+ received: r.data,
4148
+ code: f.invalid_enum_value,
4149
+ options: n
4150
+ }), b;
4151
+ }
4152
+ return F(e.data);
4153
+ }
4154
+ get options() {
4155
+ return this._def.values;
4156
+ }
4157
+ get enum() {
4158
+ const e = {};
4159
+ for (const r of this._def.values)
4160
+ e[r] = r;
4161
+ return e;
4162
+ }
4163
+ get Values() {
4164
+ const e = {};
4165
+ for (const r of this._def.values)
4166
+ e[r] = r;
4167
+ return e;
4168
+ }
4169
+ get Enum() {
4170
+ const e = {};
4171
+ for (const r of this._def.values)
4172
+ e[r] = r;
4173
+ return e;
4174
+ }
4175
+ extract(e, r = this._def) {
4176
+ return ne.create(e, {
4177
+ ...this._def,
4178
+ ...r
4179
+ });
4180
+ }
4181
+ exclude(e, r = this._def) {
4182
+ return ne.create(this.options.filter((n) => !e.includes(n)), {
4183
+ ...this._def,
4184
+ ...r
4185
+ });
4186
+ }
4187
+ }
4188
+ ge = /* @__PURE__ */ new WeakMap();
4189
+ ne.create = yr;
4190
+ class Be extends E {
4191
+ constructor() {
4192
+ super(...arguments), _e.set(this, void 0);
4193
+ }
4194
+ _parse(e) {
4195
+ const r = R.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
4196
+ if (n.parsedType !== p.string && n.parsedType !== p.number) {
4197
+ const s = R.objectValues(r);
4198
+ return h(n, {
4199
+ expected: R.joinValues(s),
4200
+ received: n.parsedType,
4201
+ code: f.invalid_type
4202
+ }), b;
4203
+ }
4204
+ if (Pe(this, _e) || hr(this, _e, new Set(R.getValidEnumValues(this._def.values))), !Pe(this, _e).has(e.data)) {
4205
+ const s = R.objectValues(r);
4206
+ return h(n, {
4207
+ received: n.data,
4208
+ code: f.invalid_enum_value,
4209
+ options: s
4210
+ }), b;
4211
+ }
4212
+ return F(e.data);
4213
+ }
4214
+ get enum() {
4215
+ return this._def.values;
4216
+ }
4217
+ }
4218
+ _e = /* @__PURE__ */ new WeakMap();
4219
+ Be.create = (t, e) => new Be({
4220
+ values: t,
4221
+ typeName: v.ZodNativeEnum,
4222
+ ...x(e)
4223
+ });
4224
+ class ke extends E {
4225
+ unwrap() {
4226
+ return this._def.type;
4227
+ }
4228
+ _parse(e) {
4229
+ const { ctx: r } = this._processInputParams(e);
4230
+ if (r.parsedType !== p.promise && r.common.async === !1)
4231
+ return h(r, {
4232
+ code: f.invalid_type,
4233
+ expected: p.promise,
4234
+ received: r.parsedType
4235
+ }), b;
4236
+ const n = r.parsedType === p.promise ? r.data : Promise.resolve(r.data);
4237
+ return F(n.then((s) => this._def.type.parseAsync(s, {
4238
+ path: r.path,
4239
+ errorMap: r.common.contextualErrorMap
4240
+ })));
4241
+ }
4242
+ }
4243
+ ke.create = (t, e) => new ke({
4244
+ type: t,
4245
+ typeName: v.ZodPromise,
4246
+ ...x(e)
4247
+ });
4248
+ class K extends E {
4249
+ innerType() {
4250
+ return this._def.schema;
4251
+ }
4252
+ sourceType() {
4253
+ return this._def.schema._def.typeName === v.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
4254
+ }
4255
+ _parse(e) {
4256
+ const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, i = {
4257
+ addIssue: (a) => {
4258
+ h(n, a), a.fatal ? r.abort() : r.dirty();
4259
+ },
4260
+ get path() {
4261
+ return n.path;
4262
+ }
4263
+ };
4264
+ if (i.addIssue = i.addIssue.bind(i), s.type === "preprocess") {
4265
+ const a = s.transform(n.data, i);
4266
+ if (n.common.async)
4267
+ return Promise.resolve(a).then(async (o) => {
4268
+ if (r.value === "aborted")
4269
+ return b;
4270
+ const d = await this._def.schema._parseAsync({
4271
+ data: o,
4272
+ path: n.path,
4273
+ parent: n
4274
+ });
4275
+ return d.status === "aborted" ? b : d.status === "dirty" || r.value === "dirty" ? ye(d.value) : d;
4276
+ });
4277
+ {
4278
+ if (r.value === "aborted")
4279
+ return b;
4280
+ const o = this._def.schema._parseSync({
4281
+ data: a,
4282
+ path: n.path,
4283
+ parent: n
4284
+ });
4285
+ return o.status === "aborted" ? b : o.status === "dirty" || r.value === "dirty" ? ye(o.value) : o;
4286
+ }
4287
+ }
4288
+ if (s.type === "refinement") {
4289
+ const a = (o) => {
4290
+ const d = s.refinement(o, i);
4291
+ if (n.common.async)
4292
+ return Promise.resolve(d);
4293
+ if (d instanceof Promise)
4294
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
4295
+ return o;
4296
+ };
4297
+ if (n.common.async === !1) {
4298
+ const o = this._def.schema._parseSync({
4299
+ data: n.data,
4300
+ path: n.path,
4301
+ parent: n
4302
+ });
4303
+ return o.status === "aborted" ? b : (o.status === "dirty" && r.dirty(), a(o.value), { status: r.value, value: o.value });
4304
+ } else
4305
+ 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 }))));
4306
+ }
4307
+ if (s.type === "transform")
4308
+ if (n.common.async === !1) {
4309
+ const a = this._def.schema._parseSync({
4310
+ data: n.data,
4311
+ path: n.path,
4312
+ parent: n
4313
+ });
4314
+ if (!ue(a))
4315
+ return a;
4316
+ const o = s.transform(a.value, i);
4317
+ if (o instanceof Promise)
4318
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
4319
+ return { status: r.value, value: o };
4320
+ } else
4321
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ue(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({ status: r.value, value: o })) : a);
4322
+ R.assertNever(s);
4323
+ }
4324
+ }
4325
+ K.create = (t, e, r) => new K({
4326
+ schema: t,
4327
+ typeName: v.ZodEffects,
4328
+ effect: e,
4329
+ ...x(r)
4330
+ });
4331
+ K.createWithPreprocess = (t, e, r) => new K({
4332
+ schema: e,
4333
+ effect: { type: "preprocess", transform: t },
4334
+ typeName: v.ZodEffects,
4335
+ ...x(r)
4336
+ });
4337
+ class W extends E {
4338
+ _parse(e) {
4339
+ return this._getType(e) === p.undefined ? F(void 0) : this._def.innerType._parse(e);
4340
+ }
4341
+ unwrap() {
4342
+ return this._def.innerType;
4343
+ }
4344
+ }
4345
+ W.create = (t, e) => new W({
4346
+ innerType: t,
4347
+ typeName: v.ZodOptional,
4348
+ ...x(e)
4349
+ });
4350
+ class se extends E {
4351
+ _parse(e) {
4352
+ return this._getType(e) === p.null ? F(null) : this._def.innerType._parse(e);
4353
+ }
4354
+ unwrap() {
4355
+ return this._def.innerType;
4356
+ }
4357
+ }
4358
+ se.create = (t, e) => new se({
4359
+ innerType: t,
4360
+ typeName: v.ZodNullable,
4361
+ ...x(e)
4362
+ });
4363
+ class $e extends E {
4364
+ _parse(e) {
4365
+ const { ctx: r } = this._processInputParams(e);
4366
+ let n = r.data;
4367
+ return r.parsedType === p.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
4368
+ data: n,
4369
+ path: r.path,
4370
+ parent: r
4371
+ });
4372
+ }
4373
+ removeDefault() {
4374
+ return this._def.innerType;
4375
+ }
4376
+ }
4377
+ $e.create = (t, e) => new $e({
4378
+ innerType: t,
4379
+ typeName: v.ZodDefault,
4380
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
4381
+ ...x(e)
4382
+ });
4383
+ class ze extends E {
4384
+ _parse(e) {
4385
+ const { ctx: r } = this._processInputParams(e), n = {
4386
+ ...r,
4387
+ common: {
4388
+ ...r.common,
4389
+ issues: []
4390
+ }
4391
+ }, s = this._def.innerType._parse({
4392
+ data: n.data,
4393
+ path: n.path,
4394
+ parent: {
4395
+ ...n
4396
+ }
4397
+ });
4398
+ return je(s) ? s.then((i) => ({
4399
+ status: "valid",
4400
+ value: i.status === "valid" ? i.value : this._def.catchValue({
4401
+ get error() {
4402
+ return new Z(n.common.issues);
4403
+ },
4404
+ input: n.data
4405
+ })
4406
+ })) : {
4407
+ status: "valid",
4408
+ value: s.status === "valid" ? s.value : this._def.catchValue({
4409
+ get error() {
4410
+ return new Z(n.common.issues);
4411
+ },
4412
+ input: n.data
4413
+ })
4414
+ };
4415
+ }
4416
+ removeCatch() {
4417
+ return this._def.innerType;
4418
+ }
4419
+ }
4420
+ ze.create = (t, e) => new ze({
4421
+ innerType: t,
4422
+ typeName: v.ZodCatch,
4423
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
4424
+ ...x(e)
4425
+ });
4426
+ class _t extends E {
4427
+ _parse(e) {
4428
+ if (this._getType(e) !== p.nan) {
4429
+ const n = this._getOrReturnCtx(e);
4430
+ return h(n, {
4431
+ code: f.invalid_type,
4432
+ expected: p.nan,
4433
+ received: n.parsedType
4434
+ }), b;
4435
+ }
4436
+ return { status: "valid", value: e.data };
4437
+ }
4438
+ }
4439
+ _t.create = (t) => new _t({
4440
+ typeName: v.ZodNaN,
4441
+ ...x(t)
4442
+ });
4443
+ class gr extends E {
4444
+ _parse(e) {
4445
+ const { ctx: r } = this._processInputParams(e), n = r.data;
4446
+ return this._def.type._parse({
4447
+ data: n,
4448
+ path: r.path,
4449
+ parent: r
4450
+ });
4451
+ }
4452
+ unwrap() {
4453
+ return this._def.type;
4454
+ }
4455
+ }
4456
+ class Qe extends E {
4457
+ _parse(e) {
4458
+ const { status: r, ctx: n } = this._processInputParams(e);
4459
+ if (n.common.async)
4460
+ return (async () => {
4461
+ const i = await this._def.in._parseAsync({
4462
+ data: n.data,
4463
+ path: n.path,
4464
+ parent: n
4465
+ });
4466
+ return i.status === "aborted" ? b : i.status === "dirty" ? (r.dirty(), ye(i.value)) : this._def.out._parseAsync({
4467
+ data: i.value,
4468
+ path: n.path,
4469
+ parent: n
4470
+ });
4471
+ })();
4472
+ {
4473
+ const s = this._def.in._parseSync({
4474
+ data: n.data,
4475
+ path: n.path,
4476
+ parent: n
4477
+ });
4478
+ return s.status === "aborted" ? b : s.status === "dirty" ? (r.dirty(), {
4479
+ status: "dirty",
4480
+ value: s.value
4481
+ }) : this._def.out._parseSync({
4482
+ data: s.value,
4483
+ path: n.path,
4484
+ parent: n
4485
+ });
4486
+ }
4487
+ }
4488
+ static create(e, r) {
4489
+ return new Qe({
4490
+ in: e,
4491
+ out: r,
4492
+ typeName: v.ZodPipeline
4493
+ });
4494
+ }
4495
+ }
4496
+ class qe extends E {
4497
+ _parse(e) {
4498
+ const r = this._def.innerType._parse(e), n = (s) => (ue(s) && (s.value = Object.freeze(s.value)), s);
4499
+ return je(r) ? r.then((s) => n(s)) : n(r);
4500
+ }
4501
+ unwrap() {
4502
+ return this._def.innerType;
4503
+ }
4504
+ }
4505
+ qe.create = (t, e) => new qe({
4506
+ innerType: t,
4507
+ typeName: v.ZodReadonly,
4508
+ ...x(e)
4509
+ });
4510
+ A.lazycreate;
4511
+ var v;
4512
+ (function(t) {
4513
+ 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";
4514
+ })(v || (v = {}));
4515
+ H.create;
4516
+ le.create;
4517
+ _t.create;
4518
+ de.create;
4519
+ ft.create;
4520
+ xe.create;
4521
+ ht.create;
4522
+ Ie.create;
4523
+ De.create;
4524
+ pt.create;
4525
+ ce.create;
4526
+ Y.create;
4527
+ mt.create;
4528
+ $.create;
4529
+ A.create;
4530
+ A.strictCreate;
4531
+ Le.create;
4532
+ kt.create;
4533
+ Ue.create;
4534
+ J.create;
4535
+ Fe.create;
4536
+ gt.create;
4537
+ fe.create;
4538
+ ve.create;
4539
+ Ze.create;
4540
+ Me.create;
4541
+ ne.create;
4542
+ Be.create;
4543
+ ke.create;
4544
+ K.create;
4545
+ W.create;
4546
+ se.create;
4547
+ K.createWithPreprocess;
4548
+ Qe.create;
4549
+ class ie extends Error {
4550
+ constructor(e, r) {
4551
+ super(
4552
+ e.detail || e.title || r?.message || "An API error occurred"
4553
+ ), this.problemDetail = e, this.originalError = r, this.name = "ApiError", Object.setPrototypeOf(this, ie.prototype);
4554
+ }
4555
+ get status() {
4556
+ return this.problemDetail.status;
4557
+ }
4558
+ get body() {
4559
+ return this.problemDetail;
4560
+ }
4561
+ get isClientError() {
4562
+ return this.status >= 400 && this.status < 500;
4563
+ }
4564
+ get isServerError() {
4565
+ return this.status >= 500;
4566
+ }
4567
+ get isUnauthorized() {
4568
+ return this.status === 401;
4569
+ }
4570
+ get isForbidden() {
4571
+ return this.status === 403;
4572
+ }
4573
+ get isNotFound() {
4574
+ return this.status === 404;
4575
+ }
4576
+ static builder() {
4577
+ return new Ve(null);
4578
+ }
4579
+ static of(e) {
4580
+ return console.error("ApiError#of", e), oe(e);
4581
+ }
4582
+ }
4583
+ class Ve {
4584
+ constructor(e) {
4585
+ this._originalError = e, this._problemDetail = {
4586
+ title: e?.name || "ApiError",
4587
+ detail: e?.message || "",
4588
+ status: xt.InternalServerError,
4589
+ type: "about:blank"
4590
+ };
4591
+ }
4592
+ /**
4593
+ * Set standard ProblemDetail
4594
+ */
4595
+ problemDetail(e) {
4596
+ return e && (this._problemDetail = e), this;
4597
+ }
4598
+ originalError(e) {
4599
+ return this._originalError = e, this._problemDetail.title = e.name, this._problemDetail.detail = e.message, this;
4600
+ }
4601
+ message(e) {
4602
+ return this._problemDetail.detail = e, this;
4603
+ }
4604
+ status(e) {
4605
+ return this._problemDetail.status = e, this;
4606
+ }
4607
+ errors(e) {
4608
+ return this._problemDetail.errors = e || {}, this;
4609
+ }
4610
+ title(e) {
4611
+ return this._problemDetail.title = e, this;
4612
+ }
4613
+ instance(e) {
4614
+ return this._problemDetail.instance = e, this;
4615
+ }
4616
+ build() {
4617
+ return new ie(this._problemDetail, this._originalError);
4618
+ }
4619
+ }
4620
+ function vs(t) {
4621
+ if (!t.data)
4622
+ return null;
4623
+ const e = t.data;
4624
+ return typeof e == "object" && "type" in e && "title" in e && "status" in e ? e : null;
4625
+ }
4626
+ function bs(t) {
4627
+ const e = new Ve(t);
4628
+ if (e.instance(t.config.url), t.status && e.status(t.status), t.response && t.response.data) {
4629
+ const r = vs(t.response);
4630
+ if (r !== null)
4631
+ return e.problemDetail(r).build();
4632
+ }
4633
+ return t.code === "ECONNREFUSED" && e.status(xt.ServiceUnavailable).message("Failed to connect to service").title("Service Unavailable"), e.build();
4634
+ }
4635
+ function ws(t) {
4636
+ const e = {};
4637
+ return t.errors.forEach((r) => {
4638
+ r.path.forEach((n) => {
4639
+ e[n] = r.message;
4640
+ });
4641
+ }), ie.builder().originalError(t).status(xt.BadRequest).message("Validation Error").errors(e).build();
4642
+ }
4643
+ function Fs(t) {
4644
+ return t instanceof ie ? t.problemDetail.detail ? t.problemDetail.detail : t.problemDetail.title ? t.problemDetail.title : t.message : t instanceof Error ? t.message : "An unexpected error occurred";
4645
+ }
4646
+ function Zs(t, e) {
4647
+ return t instanceof ie && t.status === e;
4648
+ }
4649
+ function oe(t) {
4650
+ if (t instanceof ie)
4651
+ return t;
4652
+ if (t instanceof Kn)
4653
+ return bs(t);
4654
+ if (t instanceof Z)
4655
+ return ws(t);
4656
+ if (t instanceof Error)
4657
+ return new Ve(t).build();
4658
+ const e = new Error("Unknown api error");
4659
+ return new Ve(e).instance("handleApiError").build();
4660
+ }
4661
+ class Ms {
4662
+ constructor(e) {
4663
+ this.isRefreshing = !1, this.pendingRequests = [], this.config = {
4664
+ timeout: 3e4,
4665
+ enableRefreshToken: !1,
4666
+ maxRetries: 3,
4667
+ retryDelay: 1e3,
4668
+ onUnauthorized: async () => {
4669
+ console.log("Unauthorized");
4670
+ },
4671
+ onRefreshTokenExpired: async () => {
4672
+ console.log("Refresh token expired");
4673
+ },
4674
+ onAuthenticated: async (r) => {
4675
+ console.log(
4676
+ "[api-client]",
4677
+ r.method.toUpperCase(),
4678
+ r.url,
4679
+ r.data
4680
+ );
4681
+ },
4682
+ onRefreshToken: async () => "",
4683
+ ...e
4684
+ }, this.instance = C.create({
4685
+ baseURL: this.config.baseURL,
4686
+ timeout: this.config.timeout,
4687
+ headers: {
4688
+ "Content-Type": "application/json"
4689
+ }
4690
+ }), this.setupInterceptors();
4691
+ }
4692
+ /**
4693
+ * Setup request and response interceptors
4694
+ */
4695
+ setupInterceptors() {
4696
+ this.instance.interceptors.request.use(
4697
+ this.handleRequestFulfilled.bind(this),
4698
+ this.handleRequestRejected.bind(this)
4699
+ ), this.instance.interceptors.response.use(
4700
+ this.handleResponseFulfilled.bind(this),
4701
+ this.handleResponseRejected.bind(this)
4702
+ );
4703
+ }
4704
+ /**
4705
+ * Attach JWT token to request headers
4706
+ */
4707
+ async handleRequestFulfilled(e) {
4708
+ try {
4709
+ return this.config.onAuthenticated && this.config.onAuthenticated(e), e;
4710
+ } catch (r) {
4711
+ return console.error("onAuthenticated error on request:", r), e;
4712
+ }
4713
+ }
4714
+ /**
4715
+ * Handle request errors
4716
+ */
4717
+ handleRequestRejected(e) {
4718
+ return console.error("Request configuration error:", e), Promise.reject(e);
4719
+ }
4720
+ /**
4721
+ * Pass through successful responses
4722
+ */
4723
+ handleResponseFulfilled(e) {
4724
+ return e;
4725
+ }
4726
+ /**
4727
+ * Handle response errors with retry logic and token refresh
4728
+ */
4729
+ async handleResponseRejected(e) {
4730
+ const r = e.config;
4731
+ return r ? e.response?.status === 401 && this.config.enableRefreshToken ? this.handleUnauthorizedError(e, r) : this.shouldRetry(e, r) ? this.retryRequest(r) : Promise.reject(oe(e)) : Promise.reject(oe(e));
4732
+ }
4733
+ /**
4734
+ * Handle 401 errors with token refresh
4735
+ */
4736
+ async handleUnauthorizedError(e, r) {
4737
+ if (r._retry)
4738
+ return this.config.onRefreshTokenExpired && await this.config.onRefreshTokenExpired(), Promise.reject(oe(e));
4739
+ if (r._retry = !0, this.isRefreshing)
4740
+ return new Promise((n, s) => {
4741
+ this.pendingRequests.push({ resolve: n, reject: s });
4742
+ }).then((n) => (r.headers.Authorization = `Bearer ${n}`, this.instance(r))).catch((n) => Promise.reject(oe(n)));
4743
+ this.isRefreshing = !0;
4744
+ try {
4745
+ const n = await this.refreshToken();
4746
+ return r.headers.Authorization = `Bearer ${n}`, this.processPendingRequests(null, n), this.instance(r);
4747
+ } catch (n) {
4748
+ return this.processPendingRequests(n, null), this.config.onUnauthorized && await this.config.onUnauthorized(), Promise.reject(oe(e));
4749
+ } finally {
4750
+ this.isRefreshing = !1;
4751
+ }
4752
+ }
4753
+ /**
4754
+ * Refresh the JWT token using the refresh token
4755
+ */
4756
+ async refreshToken() {
4757
+ try {
4758
+ return this.config.onRefreshToken();
4759
+ } catch (e) {
4760
+ throw console.error("Token refresh failed:", e), e;
4761
+ }
4762
+ }
4763
+ /**
4764
+ * Process all pending requests after token refresh
4765
+ */
4766
+ processPendingRequests(e, r) {
4767
+ this.pendingRequests.forEach((n) => {
4768
+ e ? n.reject(e) : r && n.resolve(r);
4769
+ }), this.pendingRequests = [];
4770
+ }
4771
+ /**
4772
+ * Determine if request should be retried
4773
+ */
4774
+ shouldRetry(e, r) {
4775
+ if ((r._retryCount || 0) >= this.config.maxRetries)
4776
+ return !1;
4777
+ if (!e.response)
4778
+ return !0;
4779
+ const s = e.response.status;
4780
+ return s >= 500 && s !== 501 || s === 429;
4781
+ }
4782
+ /**
4783
+ * Retry failed request with exponential backoff
4784
+ */
4785
+ async retryRequest(e) {
4786
+ e._retryCount = (e._retryCount || 0) + 1;
4787
+ const r = this.config.retryDelay * Math.pow(2, e._retryCount - 1);
4788
+ return await this.sleep(r), console.log(
4789
+ `Retrying request (attempt ${e._retryCount}):`,
4790
+ e.url
4791
+ ), this.instance(e);
4792
+ }
4793
+ /**
4794
+ * Sleep helper for retry delays
4795
+ */
4796
+ sleep(e) {
4797
+ return new Promise((r) => setTimeout(r, e));
4798
+ }
4799
+ /**
4800
+ * HTTP Methods with proper typing
4801
+ */
4802
+ async get(e, r) {
4803
+ return (await this.instance.get(e, r)).data;
4804
+ }
4805
+ async post(e, r, n) {
4806
+ return (await this.instance.post(e, r, n)).data;
4807
+ }
4808
+ async put(e, r, n) {
4809
+ return (await this.instance.put(e, r, n)).data;
4810
+ }
4811
+ async patch(e, r, n) {
4812
+ return (await this.instance.patch(e, r, n)).data;
4813
+ }
4814
+ async delete(e, r) {
4815
+ return (await this.instance.delete(e, r)).data;
4816
+ }
4817
+ /**
4818
+ * Get the underlying Axios instance for advanced usage
4819
+ */
4820
+ getAxiosInstance() {
4821
+ return this.instance;
4822
+ }
4823
+ }
4824
+ export {
4825
+ Ms as ApiClient,
4826
+ ie as ApiError,
4827
+ Fs as getErrorMessage,
4828
+ bs as handleAxiosError,
4829
+ ws as handleZodError,
4830
+ Zs as isHttpStatus
4831
+ };