react-auth-service 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/README.md +252 -0
- package/dist/auth-ui.es.js +2302 -0
- package/dist/auth-ui.umd.js +11 -0
- package/dist/react-auth-ui.css +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +40 -0
- package/types/App.d.ts +3 -0
- package/types/common/ProtectedRoute.d.ts +12 -0
- package/types/common/token.d.ts +2 -0
- package/types/components/Auth/index.d.ts +4 -0
- package/types/components/UserProfile/index.d.ts +4 -0
- package/types/constants/apiEndpoints.d.ts +9 -0
- package/types/constants/constants.d.ts +8 -0
- package/types/constants/messages.d.ts +6 -0
- package/types/context/AuthContext.d.ts +10 -0
- package/types/enum/auth.d.ts +5 -0
- package/types/hooks/useAuth.d.ts +5 -0
- package/types/index.d.ts +10 -0
- package/types/main.d.ts +1 -0
- package/types/services/axiosInterceptor.d.ts +2 -0
- package/types/types/auth.d.ts +18 -0
- package/types/utils/helperfunction.d.ts +6 -0
|
@@ -0,0 +1,2302 @@
|
|
|
1
|
+
import ht, { createContext as Wt, useContext as Vt, useState as M, useEffect as pt } from "react";
|
|
2
|
+
import { useNavigate as mt, Navigate as bt } from "react-router-dom";
|
|
3
|
+
var ye = { exports: {} }, ae = {};
|
|
4
|
+
var We;
|
|
5
|
+
function Yt() {
|
|
6
|
+
if (We) return ae;
|
|
7
|
+
We = 1;
|
|
8
|
+
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
9
|
+
function r(n, s, i) {
|
|
10
|
+
var o = null;
|
|
11
|
+
if (i !== void 0 && (o = "" + i), s.key !== void 0 && (o = "" + s.key), "key" in s) {
|
|
12
|
+
i = {};
|
|
13
|
+
for (var c in s)
|
|
14
|
+
c !== "key" && (i[c] = s[c]);
|
|
15
|
+
} else i = s;
|
|
16
|
+
return s = i.ref, {
|
|
17
|
+
$$typeof: e,
|
|
18
|
+
type: n,
|
|
19
|
+
key: o,
|
|
20
|
+
ref: s !== void 0 ? s : null,
|
|
21
|
+
props: i
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return ae.Fragment = t, ae.jsx = r, ae.jsxs = r, ae;
|
|
25
|
+
}
|
|
26
|
+
var ce = {};
|
|
27
|
+
var Ve;
|
|
28
|
+
function Xt() {
|
|
29
|
+
return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
|
+
function e(l) {
|
|
31
|
+
if (l == null) return null;
|
|
32
|
+
if (typeof l == "function")
|
|
33
|
+
return l.$$typeof === be ? null : l.displayName || l.name || null;
|
|
34
|
+
if (typeof l == "string") return l;
|
|
35
|
+
switch (l) {
|
|
36
|
+
case p:
|
|
37
|
+
return "Fragment";
|
|
38
|
+
case N:
|
|
39
|
+
return "Profiler";
|
|
40
|
+
case S:
|
|
41
|
+
return "StrictMode";
|
|
42
|
+
case $:
|
|
43
|
+
return "Suspense";
|
|
44
|
+
case j:
|
|
45
|
+
return "SuspenseList";
|
|
46
|
+
case me:
|
|
47
|
+
return "Activity";
|
|
48
|
+
}
|
|
49
|
+
if (typeof l == "object")
|
|
50
|
+
switch (typeof l.tag == "number" && console.error(
|
|
51
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
|
+
), l.$$typeof) {
|
|
53
|
+
case b:
|
|
54
|
+
return "Portal";
|
|
55
|
+
case C:
|
|
56
|
+
return l.displayName || "Context";
|
|
57
|
+
case A:
|
|
58
|
+
return (l._context.displayName || "Context") + ".Consumer";
|
|
59
|
+
case U:
|
|
60
|
+
var E = l.render;
|
|
61
|
+
return l = l.displayName, l || (l = E.displayName || E.name || "", l = l !== "" ? "ForwardRef(" + l + ")" : "ForwardRef"), l;
|
|
62
|
+
case se:
|
|
63
|
+
return E = l.displayName || null, E !== null ? E : e(l.type) || "Memo";
|
|
64
|
+
case H:
|
|
65
|
+
E = l._payload, l = l._init;
|
|
66
|
+
try {
|
|
67
|
+
return e(l(E));
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function t(l) {
|
|
74
|
+
return "" + l;
|
|
75
|
+
}
|
|
76
|
+
function r(l) {
|
|
77
|
+
try {
|
|
78
|
+
t(l);
|
|
79
|
+
var E = !1;
|
|
80
|
+
} catch {
|
|
81
|
+
E = !0;
|
|
82
|
+
}
|
|
83
|
+
if (E) {
|
|
84
|
+
E = console;
|
|
85
|
+
var R = E.error, O = typeof Symbol == "function" && Symbol.toStringTag && l[Symbol.toStringTag] || l.constructor.name || "Object";
|
|
86
|
+
return R.call(
|
|
87
|
+
E,
|
|
88
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
+
O
|
|
90
|
+
), t(l);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function n(l) {
|
|
94
|
+
if (l === p) return "<>";
|
|
95
|
+
if (typeof l == "object" && l !== null && l.$$typeof === H)
|
|
96
|
+
return "<...>";
|
|
97
|
+
try {
|
|
98
|
+
var E = e(l);
|
|
99
|
+
return E ? "<" + E + ">" : "<...>";
|
|
100
|
+
} catch {
|
|
101
|
+
return "<...>";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function s() {
|
|
105
|
+
var l = z.A;
|
|
106
|
+
return l === null ? null : l.getOwner();
|
|
107
|
+
}
|
|
108
|
+
function i() {
|
|
109
|
+
return Error("react-stack-top-frame");
|
|
110
|
+
}
|
|
111
|
+
function o(l) {
|
|
112
|
+
if (G.call(l, "key")) {
|
|
113
|
+
var E = Object.getOwnPropertyDescriptor(l, "key").get;
|
|
114
|
+
if (E && E.isReactWarning) return !1;
|
|
115
|
+
}
|
|
116
|
+
return l.key !== void 0;
|
|
117
|
+
}
|
|
118
|
+
function c(l, E) {
|
|
119
|
+
function R() {
|
|
120
|
+
F || (F = !0, console.error(
|
|
121
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
122
|
+
E
|
|
123
|
+
));
|
|
124
|
+
}
|
|
125
|
+
R.isReactWarning = !0, Object.defineProperty(l, "key", {
|
|
126
|
+
get: R,
|
|
127
|
+
configurable: !0
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function h() {
|
|
131
|
+
var l = e(this.type);
|
|
132
|
+
return oe[l] || (oe[l] = !0, console.error(
|
|
133
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
134
|
+
)), l = this.props.ref, l !== void 0 ? l : null;
|
|
135
|
+
}
|
|
136
|
+
function f(l, E, R, O, W, ke) {
|
|
137
|
+
var _ = R.ref;
|
|
138
|
+
return l = {
|
|
139
|
+
$$typeof: d,
|
|
140
|
+
type: l,
|
|
141
|
+
key: E,
|
|
142
|
+
props: R,
|
|
143
|
+
_owner: O
|
|
144
|
+
}, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(l, "ref", {
|
|
145
|
+
enumerable: !1,
|
|
146
|
+
get: h
|
|
147
|
+
}) : Object.defineProperty(l, "ref", { enumerable: !1, value: null }), l._store = {}, Object.defineProperty(l._store, "validated", {
|
|
148
|
+
configurable: !1,
|
|
149
|
+
enumerable: !1,
|
|
150
|
+
writable: !0,
|
|
151
|
+
value: 0
|
|
152
|
+
}), Object.defineProperty(l, "_debugInfo", {
|
|
153
|
+
configurable: !1,
|
|
154
|
+
enumerable: !1,
|
|
155
|
+
writable: !0,
|
|
156
|
+
value: null
|
|
157
|
+
}), Object.defineProperty(l, "_debugStack", {
|
|
158
|
+
configurable: !1,
|
|
159
|
+
enumerable: !1,
|
|
160
|
+
writable: !0,
|
|
161
|
+
value: W
|
|
162
|
+
}), Object.defineProperty(l, "_debugTask", {
|
|
163
|
+
configurable: !1,
|
|
164
|
+
enumerable: !1,
|
|
165
|
+
writable: !0,
|
|
166
|
+
value: ke
|
|
167
|
+
}), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
|
|
168
|
+
}
|
|
169
|
+
function u(l, E, R, O, W, ke) {
|
|
170
|
+
var _ = E.children;
|
|
171
|
+
if (_ !== void 0)
|
|
172
|
+
if (O)
|
|
173
|
+
if (q(_)) {
|
|
174
|
+
for (O = 0; O < _.length; O++)
|
|
175
|
+
m(_[O]);
|
|
176
|
+
Object.freeze && Object.freeze(_);
|
|
177
|
+
} else
|
|
178
|
+
console.error(
|
|
179
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
|
+
);
|
|
181
|
+
else m(_);
|
|
182
|
+
if (G.call(E, "key")) {
|
|
183
|
+
_ = e(l);
|
|
184
|
+
var Q = Object.keys(E).filter(function(Jt) {
|
|
185
|
+
return Jt !== "key";
|
|
186
|
+
});
|
|
187
|
+
O = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", Ee[_ + O] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
189
|
+
let props = %s;
|
|
190
|
+
<%s {...props} />
|
|
191
|
+
React keys must be passed directly to JSX without using spread:
|
|
192
|
+
let props = %s;
|
|
193
|
+
<%s key={someKey} {...props} />`,
|
|
194
|
+
O,
|
|
195
|
+
_,
|
|
196
|
+
Q,
|
|
197
|
+
_
|
|
198
|
+
), Ee[_ + O] = !0);
|
|
199
|
+
}
|
|
200
|
+
if (_ = null, R !== void 0 && (r(R), _ = "" + R), o(E) && (r(E.key), _ = "" + E.key), "key" in E) {
|
|
201
|
+
R = {};
|
|
202
|
+
for (var je in E)
|
|
203
|
+
je !== "key" && (R[je] = E[je]);
|
|
204
|
+
} else R = E;
|
|
205
|
+
return _ && c(
|
|
206
|
+
R,
|
|
207
|
+
typeof l == "function" ? l.displayName || l.name || "Unknown" : l
|
|
208
|
+
), f(
|
|
209
|
+
l,
|
|
210
|
+
_,
|
|
211
|
+
R,
|
|
212
|
+
s(),
|
|
213
|
+
W,
|
|
214
|
+
ke
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
function m(l) {
|
|
218
|
+
g(l) ? l._store && (l._store.validated = 1) : typeof l == "object" && l !== null && l.$$typeof === H && (l._payload.status === "fulfilled" ? g(l._payload.value) && l._payload.value._store && (l._payload.value._store.validated = 1) : l._store && (l._store.validated = 1));
|
|
219
|
+
}
|
|
220
|
+
function g(l) {
|
|
221
|
+
return typeof l == "object" && l !== null && l.$$typeof === d;
|
|
222
|
+
}
|
|
223
|
+
var T = ht, d = Symbol.for("react.transitional.element"), b = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), S = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), A = Symbol.for("react.consumer"), C = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), $ = Symbol.for("react.suspense"), j = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), me = Symbol.for("react.activity"), be = Symbol.for("react.client.reference"), z = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, q = Array.isArray, Z = console.createTask ? console.createTask : function() {
|
|
224
|
+
return null;
|
|
225
|
+
};
|
|
226
|
+
T = {
|
|
227
|
+
react_stack_bottom_frame: function(l) {
|
|
228
|
+
return l();
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var F, oe = {}, v = T.react_stack_bottom_frame.bind(
|
|
232
|
+
T,
|
|
233
|
+
i
|
|
234
|
+
)(), ie = Z(n(i)), Ee = {};
|
|
235
|
+
ce.Fragment = p, ce.jsx = function(l, E, R) {
|
|
236
|
+
var O = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
237
|
+
return u(
|
|
238
|
+
l,
|
|
239
|
+
E,
|
|
240
|
+
R,
|
|
241
|
+
!1,
|
|
242
|
+
O ? Error("react-stack-top-frame") : v,
|
|
243
|
+
O ? Z(n(l)) : ie
|
|
244
|
+
);
|
|
245
|
+
}, ce.jsxs = function(l, E, R) {
|
|
246
|
+
var O = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
247
|
+
return u(
|
|
248
|
+
l,
|
|
249
|
+
E,
|
|
250
|
+
R,
|
|
251
|
+
!0,
|
|
252
|
+
O ? Error("react-stack-top-frame") : v,
|
|
253
|
+
O ? Z(n(l)) : ie
|
|
254
|
+
);
|
|
255
|
+
};
|
|
256
|
+
})()), ce;
|
|
257
|
+
}
|
|
258
|
+
var Ye;
|
|
259
|
+
function Kt() {
|
|
260
|
+
return Ye || (Ye = 1, process.env.NODE_ENV === "production" ? ye.exports = Yt() : ye.exports = Xt()), ye.exports;
|
|
261
|
+
}
|
|
262
|
+
var w = Kt();
|
|
263
|
+
const ee = "http://localhost:5000", X = {
|
|
264
|
+
refreshToken: `${ee}/auth/renew-token`,
|
|
265
|
+
login: `${ee}/auth/authenticate`,
|
|
266
|
+
logout: `${ee}/auth/terminate`,
|
|
267
|
+
register: `${ee}/auth/register`,
|
|
268
|
+
userDetails: `${ee}/auth/profile`,
|
|
269
|
+
test: `${ee}/auth/test-endpoint`
|
|
270
|
+
}, Zt = "Registration successful! Please login.", Qt = "Registration failed. Please try again.", er = "Login failed. Please try again.", tr = "Login successful!", Mn = "Logged out successfully.", rr = "Session expired. Please login again.", P = {
|
|
271
|
+
LOGIN: "Sign In",
|
|
272
|
+
SIGNUP: "Sign Up"
|
|
273
|
+
}, nr = "Signing in...", sr = "Signing up...", Et = "Email", or = "Password", ir = "User ID", ar = "Logout", Te = "sessionExpired", qe = "true";
|
|
274
|
+
let yt = null;
|
|
275
|
+
function ue(e) {
|
|
276
|
+
yt = e;
|
|
277
|
+
}
|
|
278
|
+
function cr() {
|
|
279
|
+
return yt;
|
|
280
|
+
}
|
|
281
|
+
function wt(e, t) {
|
|
282
|
+
return function() {
|
|
283
|
+
return e.apply(t, arguments);
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
const { toString: lr } = Object.prototype, { getPrototypeOf: Me } = Object, { iterator: xe, toStringTag: gt } = Symbol, Ne = /* @__PURE__ */ ((e) => (t) => {
|
|
287
|
+
const r = lr.call(t);
|
|
288
|
+
return e[r] || (e[r] = r.slice(8, -1).toLowerCase());
|
|
289
|
+
})(/* @__PURE__ */ Object.create(null)), D = (e) => (e = e.toLowerCase(), (t) => Ne(t) === e), _e = (e) => (t) => typeof t === e, { isArray: re } = Array, te = _e("undefined");
|
|
290
|
+
function fe(e) {
|
|
291
|
+
return e !== null && !te(e) && e.constructor !== null && !te(e.constructor) && L(e.constructor.isBuffer) && e.constructor.isBuffer(e);
|
|
292
|
+
}
|
|
293
|
+
const St = D("ArrayBuffer");
|
|
294
|
+
function ur(e) {
|
|
295
|
+
let t;
|
|
296
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && St(e.buffer), t;
|
|
297
|
+
}
|
|
298
|
+
const fr = _e("string"), L = _e("function"), Rt = _e("number"), de = (e) => e !== null && typeof e == "object", dr = (e) => e === !0 || e === !1, Se = (e) => {
|
|
299
|
+
if (Ne(e) !== "object")
|
|
300
|
+
return !1;
|
|
301
|
+
const t = Me(e);
|
|
302
|
+
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(gt in e) && !(xe in e);
|
|
303
|
+
}, hr = (e) => {
|
|
304
|
+
if (!de(e) || fe(e))
|
|
305
|
+
return !1;
|
|
306
|
+
try {
|
|
307
|
+
return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
|
|
308
|
+
} catch {
|
|
309
|
+
return !1;
|
|
310
|
+
}
|
|
311
|
+
}, pr = D("Date"), mr = D("File"), br = D("Blob"), Er = D("FileList"), yr = (e) => de(e) && L(e.pipe), wr = (e) => {
|
|
312
|
+
let t;
|
|
313
|
+
return e && (typeof FormData == "function" && e instanceof FormData || L(e.append) && ((t = Ne(e)) === "formdata" || // detect form-data instance
|
|
314
|
+
t === "object" && L(e.toString) && e.toString() === "[object FormData]"));
|
|
315
|
+
}, gr = D("URLSearchParams"), [Sr, Rr, Or, Tr] = ["ReadableStream", "Request", "Response", "Headers"].map(D), Ar = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
316
|
+
function he(e, t, { allOwnKeys: r = !1 } = {}) {
|
|
317
|
+
if (e === null || typeof e > "u")
|
|
318
|
+
return;
|
|
319
|
+
let n, s;
|
|
320
|
+
if (typeof e != "object" && (e = [e]), re(e))
|
|
321
|
+
for (n = 0, s = e.length; n < s; n++)
|
|
322
|
+
t.call(null, e[n], n, e);
|
|
323
|
+
else {
|
|
324
|
+
if (fe(e))
|
|
325
|
+
return;
|
|
326
|
+
const i = r ? Object.getOwnPropertyNames(e) : Object.keys(e), o = i.length;
|
|
327
|
+
let c;
|
|
328
|
+
for (n = 0; n < o; n++)
|
|
329
|
+
c = i[n], t.call(null, e[c], c, e);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function Ot(e, t) {
|
|
333
|
+
if (fe(e))
|
|
334
|
+
return null;
|
|
335
|
+
t = t.toLowerCase();
|
|
336
|
+
const r = Object.keys(e);
|
|
337
|
+
let n = r.length, s;
|
|
338
|
+
for (; n-- > 0; )
|
|
339
|
+
if (s = r[n], t === s.toLowerCase())
|
|
340
|
+
return s;
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
const V = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Tt = (e) => !te(e) && e !== V;
|
|
344
|
+
function Fe() {
|
|
345
|
+
const { caseless: e, skipUndefined: t } = Tt(this) && this || {}, r = {}, n = (s, i) => {
|
|
346
|
+
const o = e && Ot(r, i) || i;
|
|
347
|
+
Se(r[o]) && Se(s) ? r[o] = Fe(r[o], s) : Se(s) ? r[o] = Fe({}, s) : re(s) ? r[o] = s.slice() : (!t || !te(s)) && (r[o] = s);
|
|
348
|
+
};
|
|
349
|
+
for (let s = 0, i = arguments.length; s < i; s++)
|
|
350
|
+
arguments[s] && he(arguments[s], n);
|
|
351
|
+
return r;
|
|
352
|
+
}
|
|
353
|
+
const xr = (e, t, r, { allOwnKeys: n } = {}) => (he(t, (s, i) => {
|
|
354
|
+
r && L(s) ? e[i] = wt(s, r) : e[i] = s;
|
|
355
|
+
}, { allOwnKeys: n }), e), Nr = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), _r = (e, t, r, n) => {
|
|
356
|
+
e.prototype = Object.create(t.prototype, n), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
357
|
+
value: t.prototype
|
|
358
|
+
}), r && Object.assign(e.prototype, r);
|
|
359
|
+
}, Pr = (e, t, r, n) => {
|
|
360
|
+
let s, i, o;
|
|
361
|
+
const c = {};
|
|
362
|
+
if (t = t || {}, e == null) return t;
|
|
363
|
+
do {
|
|
364
|
+
for (s = Object.getOwnPropertyNames(e), i = s.length; i-- > 0; )
|
|
365
|
+
o = s[i], (!n || n(o, e, t)) && !c[o] && (t[o] = e[o], c[o] = !0);
|
|
366
|
+
e = r !== !1 && Me(e);
|
|
367
|
+
} while (e && (!r || r(e, t)) && e !== Object.prototype);
|
|
368
|
+
return t;
|
|
369
|
+
}, Cr = (e, t, r) => {
|
|
370
|
+
e = String(e), (r === void 0 || r > e.length) && (r = e.length), r -= t.length;
|
|
371
|
+
const n = e.indexOf(t, r);
|
|
372
|
+
return n !== -1 && n === r;
|
|
373
|
+
}, kr = (e) => {
|
|
374
|
+
if (!e) return null;
|
|
375
|
+
if (re(e)) return e;
|
|
376
|
+
let t = e.length;
|
|
377
|
+
if (!Rt(t)) return null;
|
|
378
|
+
const r = new Array(t);
|
|
379
|
+
for (; t-- > 0; )
|
|
380
|
+
r[t] = e[t];
|
|
381
|
+
return r;
|
|
382
|
+
}, jr = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Me(Uint8Array)), Lr = (e, t) => {
|
|
383
|
+
const n = (e && e[xe]).call(e);
|
|
384
|
+
let s;
|
|
385
|
+
for (; (s = n.next()) && !s.done; ) {
|
|
386
|
+
const i = s.value;
|
|
387
|
+
t.call(e, i[0], i[1]);
|
|
388
|
+
}
|
|
389
|
+
}, Ir = (e, t) => {
|
|
390
|
+
let r;
|
|
391
|
+
const n = [];
|
|
392
|
+
for (; (r = e.exec(t)) !== null; )
|
|
393
|
+
n.push(r);
|
|
394
|
+
return n;
|
|
395
|
+
}, Ur = D("HTMLFormElement"), Fr = (e) => e.toLowerCase().replace(
|
|
396
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
397
|
+
function(r, n, s) {
|
|
398
|
+
return n.toUpperCase() + s;
|
|
399
|
+
}
|
|
400
|
+
), Xe = (({ hasOwnProperty: e }) => (t, r) => e.call(t, r))(Object.prototype), vr = D("RegExp"), At = (e, t) => {
|
|
401
|
+
const r = Object.getOwnPropertyDescriptors(e), n = {};
|
|
402
|
+
he(r, (s, i) => {
|
|
403
|
+
let o;
|
|
404
|
+
(o = t(s, i, e)) !== !1 && (n[i] = o || s);
|
|
405
|
+
}), Object.defineProperties(e, n);
|
|
406
|
+
}, Dr = (e) => {
|
|
407
|
+
At(e, (t, r) => {
|
|
408
|
+
if (L(e) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
|
|
409
|
+
return !1;
|
|
410
|
+
const n = e[r];
|
|
411
|
+
if (L(n)) {
|
|
412
|
+
if (t.enumerable = !1, "writable" in t) {
|
|
413
|
+
t.writable = !1;
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
t.set || (t.set = () => {
|
|
417
|
+
throw Error("Can not rewrite read-only method '" + r + "'");
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}, Br = (e, t) => {
|
|
422
|
+
const r = {}, n = (s) => {
|
|
423
|
+
s.forEach((i) => {
|
|
424
|
+
r[i] = !0;
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
return re(e) ? n(e) : n(String(e).split(t)), r;
|
|
428
|
+
}, $r = () => {
|
|
429
|
+
}, qr = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
430
|
+
function Mr(e) {
|
|
431
|
+
return !!(e && L(e.append) && e[gt] === "FormData" && e[xe]);
|
|
432
|
+
}
|
|
433
|
+
const Hr = (e) => {
|
|
434
|
+
const t = new Array(10), r = (n, s) => {
|
|
435
|
+
if (de(n)) {
|
|
436
|
+
if (t.indexOf(n) >= 0)
|
|
437
|
+
return;
|
|
438
|
+
if (fe(n))
|
|
439
|
+
return n;
|
|
440
|
+
if (!("toJSON" in n)) {
|
|
441
|
+
t[s] = n;
|
|
442
|
+
const i = re(n) ? [] : {};
|
|
443
|
+
return he(n, (o, c) => {
|
|
444
|
+
const h = r(o, s + 1);
|
|
445
|
+
!te(h) && (i[c] = h);
|
|
446
|
+
}), t[s] = void 0, i;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return n;
|
|
450
|
+
};
|
|
451
|
+
return r(e, 0);
|
|
452
|
+
}, zr = D("AsyncFunction"), Gr = (e) => e && (de(e) || L(e)) && L(e.then) && L(e.catch), xt = ((e, t) => e ? setImmediate : t ? ((r, n) => (V.addEventListener("message", ({ source: s, data: i }) => {
|
|
453
|
+
s === V && i === r && n.length && n.shift()();
|
|
454
|
+
}, !1), (s) => {
|
|
455
|
+
n.push(s), V.postMessage(r, "*");
|
|
456
|
+
}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
|
|
457
|
+
typeof setImmediate == "function",
|
|
458
|
+
L(V.postMessage)
|
|
459
|
+
), Jr = typeof queueMicrotask < "u" ? queueMicrotask.bind(V) : typeof process < "u" && process.nextTick || xt, Wr = (e) => e != null && L(e[xe]), a = {
|
|
460
|
+
isArray: re,
|
|
461
|
+
isArrayBuffer: St,
|
|
462
|
+
isBuffer: fe,
|
|
463
|
+
isFormData: wr,
|
|
464
|
+
isArrayBufferView: ur,
|
|
465
|
+
isString: fr,
|
|
466
|
+
isNumber: Rt,
|
|
467
|
+
isBoolean: dr,
|
|
468
|
+
isObject: de,
|
|
469
|
+
isPlainObject: Se,
|
|
470
|
+
isEmptyObject: hr,
|
|
471
|
+
isReadableStream: Sr,
|
|
472
|
+
isRequest: Rr,
|
|
473
|
+
isResponse: Or,
|
|
474
|
+
isHeaders: Tr,
|
|
475
|
+
isUndefined: te,
|
|
476
|
+
isDate: pr,
|
|
477
|
+
isFile: mr,
|
|
478
|
+
isBlob: br,
|
|
479
|
+
isRegExp: vr,
|
|
480
|
+
isFunction: L,
|
|
481
|
+
isStream: yr,
|
|
482
|
+
isURLSearchParams: gr,
|
|
483
|
+
isTypedArray: jr,
|
|
484
|
+
isFileList: Er,
|
|
485
|
+
forEach: he,
|
|
486
|
+
merge: Fe,
|
|
487
|
+
extend: xr,
|
|
488
|
+
trim: Ar,
|
|
489
|
+
stripBOM: Nr,
|
|
490
|
+
inherits: _r,
|
|
491
|
+
toFlatObject: Pr,
|
|
492
|
+
kindOf: Ne,
|
|
493
|
+
kindOfTest: D,
|
|
494
|
+
endsWith: Cr,
|
|
495
|
+
toArray: kr,
|
|
496
|
+
forEachEntry: Lr,
|
|
497
|
+
matchAll: Ir,
|
|
498
|
+
isHTMLForm: Ur,
|
|
499
|
+
hasOwnProperty: Xe,
|
|
500
|
+
hasOwnProp: Xe,
|
|
501
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
502
|
+
reduceDescriptors: At,
|
|
503
|
+
freezeMethods: Dr,
|
|
504
|
+
toObjectSet: Br,
|
|
505
|
+
toCamelCase: Fr,
|
|
506
|
+
noop: $r,
|
|
507
|
+
toFiniteNumber: qr,
|
|
508
|
+
findKey: Ot,
|
|
509
|
+
global: V,
|
|
510
|
+
isContextDefined: Tt,
|
|
511
|
+
isSpecCompliantForm: Mr,
|
|
512
|
+
toJSONObject: Hr,
|
|
513
|
+
isAsyncFn: zr,
|
|
514
|
+
isThenable: Gr,
|
|
515
|
+
setImmediate: xt,
|
|
516
|
+
asap: Jr,
|
|
517
|
+
isIterable: Wr
|
|
518
|
+
};
|
|
519
|
+
function y(e, t, r, n, s) {
|
|
520
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), r && (this.config = r), n && (this.request = n), s && (this.response = s, this.status = s.status ? s.status : null);
|
|
521
|
+
}
|
|
522
|
+
a.inherits(y, Error, {
|
|
523
|
+
toJSON: function() {
|
|
524
|
+
return {
|
|
525
|
+
// Standard
|
|
526
|
+
message: this.message,
|
|
527
|
+
name: this.name,
|
|
528
|
+
// Microsoft
|
|
529
|
+
description: this.description,
|
|
530
|
+
number: this.number,
|
|
531
|
+
// Mozilla
|
|
532
|
+
fileName: this.fileName,
|
|
533
|
+
lineNumber: this.lineNumber,
|
|
534
|
+
columnNumber: this.columnNumber,
|
|
535
|
+
stack: this.stack,
|
|
536
|
+
// Axios
|
|
537
|
+
config: a.toJSONObject(this.config),
|
|
538
|
+
code: this.code,
|
|
539
|
+
status: this.status
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
const Nt = y.prototype, _t = {};
|
|
544
|
+
[
|
|
545
|
+
"ERR_BAD_OPTION_VALUE",
|
|
546
|
+
"ERR_BAD_OPTION",
|
|
547
|
+
"ECONNABORTED",
|
|
548
|
+
"ETIMEDOUT",
|
|
549
|
+
"ERR_NETWORK",
|
|
550
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
551
|
+
"ERR_DEPRECATED",
|
|
552
|
+
"ERR_BAD_RESPONSE",
|
|
553
|
+
"ERR_BAD_REQUEST",
|
|
554
|
+
"ERR_CANCELED",
|
|
555
|
+
"ERR_NOT_SUPPORT",
|
|
556
|
+
"ERR_INVALID_URL"
|
|
557
|
+
// eslint-disable-next-line func-names
|
|
558
|
+
].forEach((e) => {
|
|
559
|
+
_t[e] = { value: e };
|
|
560
|
+
});
|
|
561
|
+
Object.defineProperties(y, _t);
|
|
562
|
+
Object.defineProperty(Nt, "isAxiosError", { value: !0 });
|
|
563
|
+
y.from = (e, t, r, n, s, i) => {
|
|
564
|
+
const o = Object.create(Nt);
|
|
565
|
+
a.toFlatObject(e, o, function(u) {
|
|
566
|
+
return u !== Error.prototype;
|
|
567
|
+
}, (f) => f !== "isAxiosError");
|
|
568
|
+
const c = e && e.message ? e.message : "Error", h = t == null && e ? e.code : t;
|
|
569
|
+
return y.call(o, c, h, r, n, s), e && o.cause == null && Object.defineProperty(o, "cause", { value: e, configurable: !0 }), o.name = e && e.name || "Error", i && Object.assign(o, i), o;
|
|
570
|
+
};
|
|
571
|
+
const Vr = null;
|
|
572
|
+
function ve(e) {
|
|
573
|
+
return a.isPlainObject(e) || a.isArray(e);
|
|
574
|
+
}
|
|
575
|
+
function Pt(e) {
|
|
576
|
+
return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
|
|
577
|
+
}
|
|
578
|
+
function Ke(e, t, r) {
|
|
579
|
+
return e ? e.concat(t).map(function(s, i) {
|
|
580
|
+
return s = Pt(s), !r && i ? "[" + s + "]" : s;
|
|
581
|
+
}).join(r ? "." : "") : t;
|
|
582
|
+
}
|
|
583
|
+
function Yr(e) {
|
|
584
|
+
return a.isArray(e) && !e.some(ve);
|
|
585
|
+
}
|
|
586
|
+
const Xr = a.toFlatObject(a, {}, null, function(t) {
|
|
587
|
+
return /^is[A-Z]/.test(t);
|
|
588
|
+
});
|
|
589
|
+
function Pe(e, t, r) {
|
|
590
|
+
if (!a.isObject(e))
|
|
591
|
+
throw new TypeError("target must be an object");
|
|
592
|
+
t = t || new FormData(), r = a.toFlatObject(r, {
|
|
593
|
+
metaTokens: !0,
|
|
594
|
+
dots: !1,
|
|
595
|
+
indexes: !1
|
|
596
|
+
}, !1, function(b, p) {
|
|
597
|
+
return !a.isUndefined(p[b]);
|
|
598
|
+
});
|
|
599
|
+
const n = r.metaTokens, s = r.visitor || u, i = r.dots, o = r.indexes, h = (r.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
|
|
600
|
+
if (!a.isFunction(s))
|
|
601
|
+
throw new TypeError("visitor must be a function");
|
|
602
|
+
function f(d) {
|
|
603
|
+
if (d === null) return "";
|
|
604
|
+
if (a.isDate(d))
|
|
605
|
+
return d.toISOString();
|
|
606
|
+
if (a.isBoolean(d))
|
|
607
|
+
return d.toString();
|
|
608
|
+
if (!h && a.isBlob(d))
|
|
609
|
+
throw new y("Blob is not supported. Use a Buffer instead.");
|
|
610
|
+
return a.isArrayBuffer(d) || a.isTypedArray(d) ? h && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
|
|
611
|
+
}
|
|
612
|
+
function u(d, b, p) {
|
|
613
|
+
let S = d;
|
|
614
|
+
if (d && !p && typeof d == "object") {
|
|
615
|
+
if (a.endsWith(b, "{}"))
|
|
616
|
+
b = n ? b : b.slice(0, -2), d = JSON.stringify(d);
|
|
617
|
+
else if (a.isArray(d) && Yr(d) || (a.isFileList(d) || a.endsWith(b, "[]")) && (S = a.toArray(d)))
|
|
618
|
+
return b = Pt(b), S.forEach(function(A, C) {
|
|
619
|
+
!(a.isUndefined(A) || A === null) && t.append(
|
|
620
|
+
// eslint-disable-next-line no-nested-ternary
|
|
621
|
+
o === !0 ? Ke([b], C, i) : o === null ? b : b + "[]",
|
|
622
|
+
f(A)
|
|
623
|
+
);
|
|
624
|
+
}), !1;
|
|
625
|
+
}
|
|
626
|
+
return ve(d) ? !0 : (t.append(Ke(p, b, i), f(d)), !1);
|
|
627
|
+
}
|
|
628
|
+
const m = [], g = Object.assign(Xr, {
|
|
629
|
+
defaultVisitor: u,
|
|
630
|
+
convertValue: f,
|
|
631
|
+
isVisitable: ve
|
|
632
|
+
});
|
|
633
|
+
function T(d, b) {
|
|
634
|
+
if (!a.isUndefined(d)) {
|
|
635
|
+
if (m.indexOf(d) !== -1)
|
|
636
|
+
throw Error("Circular reference detected in " + b.join("."));
|
|
637
|
+
m.push(d), a.forEach(d, function(S, N) {
|
|
638
|
+
(!(a.isUndefined(S) || S === null) && s.call(
|
|
639
|
+
t,
|
|
640
|
+
S,
|
|
641
|
+
a.isString(N) ? N.trim() : N,
|
|
642
|
+
b,
|
|
643
|
+
g
|
|
644
|
+
)) === !0 && T(S, b ? b.concat(N) : [N]);
|
|
645
|
+
}), m.pop();
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (!a.isObject(e))
|
|
649
|
+
throw new TypeError("data must be an object");
|
|
650
|
+
return T(e), t;
|
|
651
|
+
}
|
|
652
|
+
function Ze(e) {
|
|
653
|
+
const t = {
|
|
654
|
+
"!": "%21",
|
|
655
|
+
"'": "%27",
|
|
656
|
+
"(": "%28",
|
|
657
|
+
")": "%29",
|
|
658
|
+
"~": "%7E",
|
|
659
|
+
"%20": "+",
|
|
660
|
+
"%00": "\0"
|
|
661
|
+
};
|
|
662
|
+
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(n) {
|
|
663
|
+
return t[n];
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
function He(e, t) {
|
|
667
|
+
this._pairs = [], e && Pe(e, this, t);
|
|
668
|
+
}
|
|
669
|
+
const Ct = He.prototype;
|
|
670
|
+
Ct.append = function(t, r) {
|
|
671
|
+
this._pairs.push([t, r]);
|
|
672
|
+
};
|
|
673
|
+
Ct.toString = function(t) {
|
|
674
|
+
const r = t ? function(n) {
|
|
675
|
+
return t.call(this, n, Ze);
|
|
676
|
+
} : Ze;
|
|
677
|
+
return this._pairs.map(function(s) {
|
|
678
|
+
return r(s[0]) + "=" + r(s[1]);
|
|
679
|
+
}, "").join("&");
|
|
680
|
+
};
|
|
681
|
+
function Kr(e) {
|
|
682
|
+
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
683
|
+
}
|
|
684
|
+
function kt(e, t, r) {
|
|
685
|
+
if (!t)
|
|
686
|
+
return e;
|
|
687
|
+
const n = r && r.encode || Kr;
|
|
688
|
+
a.isFunction(r) && (r = {
|
|
689
|
+
serialize: r
|
|
690
|
+
});
|
|
691
|
+
const s = r && r.serialize;
|
|
692
|
+
let i;
|
|
693
|
+
if (s ? i = s(t, r) : i = a.isURLSearchParams(t) ? t.toString() : new He(t, r).toString(n), i) {
|
|
694
|
+
const o = e.indexOf("#");
|
|
695
|
+
o !== -1 && (e = e.slice(0, o)), e += (e.indexOf("?") === -1 ? "?" : "&") + i;
|
|
696
|
+
}
|
|
697
|
+
return e;
|
|
698
|
+
}
|
|
699
|
+
class Qe {
|
|
700
|
+
constructor() {
|
|
701
|
+
this.handlers = [];
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Add a new interceptor to the stack
|
|
705
|
+
*
|
|
706
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
707
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
708
|
+
*
|
|
709
|
+
* @return {Number} An ID used to remove interceptor later
|
|
710
|
+
*/
|
|
711
|
+
use(t, r, n) {
|
|
712
|
+
return this.handlers.push({
|
|
713
|
+
fulfilled: t,
|
|
714
|
+
rejected: r,
|
|
715
|
+
synchronous: n ? n.synchronous : !1,
|
|
716
|
+
runWhen: n ? n.runWhen : null
|
|
717
|
+
}), this.handlers.length - 1;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Remove an interceptor from the stack
|
|
721
|
+
*
|
|
722
|
+
* @param {Number} id The ID that was returned by `use`
|
|
723
|
+
*
|
|
724
|
+
* @returns {void}
|
|
725
|
+
*/
|
|
726
|
+
eject(t) {
|
|
727
|
+
this.handlers[t] && (this.handlers[t] = null);
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Clear all interceptors from the stack
|
|
731
|
+
*
|
|
732
|
+
* @returns {void}
|
|
733
|
+
*/
|
|
734
|
+
clear() {
|
|
735
|
+
this.handlers && (this.handlers = []);
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Iterate over all the registered interceptors
|
|
739
|
+
*
|
|
740
|
+
* This method is particularly useful for skipping over any
|
|
741
|
+
* interceptors that may have become `null` calling `eject`.
|
|
742
|
+
*
|
|
743
|
+
* @param {Function} fn The function to call for each interceptor
|
|
744
|
+
*
|
|
745
|
+
* @returns {void}
|
|
746
|
+
*/
|
|
747
|
+
forEach(t) {
|
|
748
|
+
a.forEach(this.handlers, function(n) {
|
|
749
|
+
n !== null && t(n);
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
const jt = {
|
|
754
|
+
silentJSONParsing: !0,
|
|
755
|
+
forcedJSONParsing: !0,
|
|
756
|
+
clarifyTimeoutError: !1
|
|
757
|
+
}, Zr = typeof URLSearchParams < "u" ? URLSearchParams : He, Qr = typeof FormData < "u" ? FormData : null, en = typeof Blob < "u" ? Blob : null, tn = {
|
|
758
|
+
isBrowser: !0,
|
|
759
|
+
classes: {
|
|
760
|
+
URLSearchParams: Zr,
|
|
761
|
+
FormData: Qr,
|
|
762
|
+
Blob: en
|
|
763
|
+
},
|
|
764
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
765
|
+
}, ze = typeof window < "u" && typeof document < "u", De = typeof navigator == "object" && navigator || void 0, rn = ze && (!De || ["ReactNative", "NativeScript", "NS"].indexOf(De.product) < 0), nn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
766
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", sn = ze && window.location.href || "http://localhost", on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
767
|
+
__proto__: null,
|
|
768
|
+
hasBrowserEnv: ze,
|
|
769
|
+
hasStandardBrowserEnv: rn,
|
|
770
|
+
hasStandardBrowserWebWorkerEnv: nn,
|
|
771
|
+
navigator: De,
|
|
772
|
+
origin: sn
|
|
773
|
+
}, Symbol.toStringTag, { value: "Module" })), k = {
|
|
774
|
+
...on,
|
|
775
|
+
...tn
|
|
776
|
+
};
|
|
777
|
+
function an(e, t) {
|
|
778
|
+
return Pe(e, new k.classes.URLSearchParams(), {
|
|
779
|
+
visitor: function(r, n, s, i) {
|
|
780
|
+
return k.isNode && a.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
|
|
781
|
+
},
|
|
782
|
+
...t
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
function cn(e) {
|
|
786
|
+
return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
|
|
787
|
+
}
|
|
788
|
+
function ln(e) {
|
|
789
|
+
const t = {}, r = Object.keys(e);
|
|
790
|
+
let n;
|
|
791
|
+
const s = r.length;
|
|
792
|
+
let i;
|
|
793
|
+
for (n = 0; n < s; n++)
|
|
794
|
+
i = r[n], t[i] = e[i];
|
|
795
|
+
return t;
|
|
796
|
+
}
|
|
797
|
+
function Lt(e) {
|
|
798
|
+
function t(r, n, s, i) {
|
|
799
|
+
let o = r[i++];
|
|
800
|
+
if (o === "__proto__") return !0;
|
|
801
|
+
const c = Number.isFinite(+o), h = i >= r.length;
|
|
802
|
+
return o = !o && a.isArray(s) ? s.length : o, h ? (a.hasOwnProp(s, o) ? s[o] = [s[o], n] : s[o] = n, !c) : ((!s[o] || !a.isObject(s[o])) && (s[o] = []), t(r, n, s[o], i) && a.isArray(s[o]) && (s[o] = ln(s[o])), !c);
|
|
803
|
+
}
|
|
804
|
+
if (a.isFormData(e) && a.isFunction(e.entries)) {
|
|
805
|
+
const r = {};
|
|
806
|
+
return a.forEachEntry(e, (n, s) => {
|
|
807
|
+
t(cn(n), s, r, 0);
|
|
808
|
+
}), r;
|
|
809
|
+
}
|
|
810
|
+
return null;
|
|
811
|
+
}
|
|
812
|
+
function un(e, t, r) {
|
|
813
|
+
if (a.isString(e))
|
|
814
|
+
try {
|
|
815
|
+
return (t || JSON.parse)(e), a.trim(e);
|
|
816
|
+
} catch (n) {
|
|
817
|
+
if (n.name !== "SyntaxError")
|
|
818
|
+
throw n;
|
|
819
|
+
}
|
|
820
|
+
return (r || JSON.stringify)(e);
|
|
821
|
+
}
|
|
822
|
+
const pe = {
|
|
823
|
+
transitional: jt,
|
|
824
|
+
adapter: ["xhr", "http", "fetch"],
|
|
825
|
+
transformRequest: [function(t, r) {
|
|
826
|
+
const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, i = a.isObject(t);
|
|
827
|
+
if (i && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
|
|
828
|
+
return s ? JSON.stringify(Lt(t)) : t;
|
|
829
|
+
if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t) || a.isReadableStream(t))
|
|
830
|
+
return t;
|
|
831
|
+
if (a.isArrayBufferView(t))
|
|
832
|
+
return t.buffer;
|
|
833
|
+
if (a.isURLSearchParams(t))
|
|
834
|
+
return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
|
|
835
|
+
let c;
|
|
836
|
+
if (i) {
|
|
837
|
+
if (n.indexOf("application/x-www-form-urlencoded") > -1)
|
|
838
|
+
return an(t, this.formSerializer).toString();
|
|
839
|
+
if ((c = a.isFileList(t)) || n.indexOf("multipart/form-data") > -1) {
|
|
840
|
+
const h = this.env && this.env.FormData;
|
|
841
|
+
return Pe(
|
|
842
|
+
c ? { "files[]": t } : t,
|
|
843
|
+
h && new h(),
|
|
844
|
+
this.formSerializer
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return i || s ? (r.setContentType("application/json", !1), un(t)) : t;
|
|
849
|
+
}],
|
|
850
|
+
transformResponse: [function(t) {
|
|
851
|
+
const r = this.transitional || pe.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
|
|
852
|
+
if (a.isResponse(t) || a.isReadableStream(t))
|
|
853
|
+
return t;
|
|
854
|
+
if (t && a.isString(t) && (n && !this.responseType || s)) {
|
|
855
|
+
const o = !(r && r.silentJSONParsing) && s;
|
|
856
|
+
try {
|
|
857
|
+
return JSON.parse(t, this.parseReviver);
|
|
858
|
+
} catch (c) {
|
|
859
|
+
if (o)
|
|
860
|
+
throw c.name === "SyntaxError" ? y.from(c, y.ERR_BAD_RESPONSE, this, null, this.response) : c;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return t;
|
|
864
|
+
}],
|
|
865
|
+
/**
|
|
866
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
867
|
+
* timeout is not created.
|
|
868
|
+
*/
|
|
869
|
+
timeout: 0,
|
|
870
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
871
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
872
|
+
maxContentLength: -1,
|
|
873
|
+
maxBodyLength: -1,
|
|
874
|
+
env: {
|
|
875
|
+
FormData: k.classes.FormData,
|
|
876
|
+
Blob: k.classes.Blob
|
|
877
|
+
},
|
|
878
|
+
validateStatus: function(t) {
|
|
879
|
+
return t >= 200 && t < 300;
|
|
880
|
+
},
|
|
881
|
+
headers: {
|
|
882
|
+
common: {
|
|
883
|
+
Accept: "application/json, text/plain, */*",
|
|
884
|
+
"Content-Type": void 0
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
|
|
889
|
+
pe.headers[e] = {};
|
|
890
|
+
});
|
|
891
|
+
const fn = a.toObjectSet([
|
|
892
|
+
"age",
|
|
893
|
+
"authorization",
|
|
894
|
+
"content-length",
|
|
895
|
+
"content-type",
|
|
896
|
+
"etag",
|
|
897
|
+
"expires",
|
|
898
|
+
"from",
|
|
899
|
+
"host",
|
|
900
|
+
"if-modified-since",
|
|
901
|
+
"if-unmodified-since",
|
|
902
|
+
"last-modified",
|
|
903
|
+
"location",
|
|
904
|
+
"max-forwards",
|
|
905
|
+
"proxy-authorization",
|
|
906
|
+
"referer",
|
|
907
|
+
"retry-after",
|
|
908
|
+
"user-agent"
|
|
909
|
+
]), dn = (e) => {
|
|
910
|
+
const t = {};
|
|
911
|
+
let r, n, s;
|
|
912
|
+
return e && e.split(`
|
|
913
|
+
`).forEach(function(o) {
|
|
914
|
+
s = o.indexOf(":"), r = o.substring(0, s).trim().toLowerCase(), n = o.substring(s + 1).trim(), !(!r || t[r] && fn[r]) && (r === "set-cookie" ? t[r] ? t[r].push(n) : t[r] = [n] : t[r] = t[r] ? t[r] + ", " + n : n);
|
|
915
|
+
}), t;
|
|
916
|
+
}, et = Symbol("internals");
|
|
917
|
+
function le(e) {
|
|
918
|
+
return e && String(e).trim().toLowerCase();
|
|
919
|
+
}
|
|
920
|
+
function Re(e) {
|
|
921
|
+
return e === !1 || e == null ? e : a.isArray(e) ? e.map(Re) : String(e);
|
|
922
|
+
}
|
|
923
|
+
function hn(e) {
|
|
924
|
+
const t = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
925
|
+
let n;
|
|
926
|
+
for (; n = r.exec(e); )
|
|
927
|
+
t[n[1]] = n[2];
|
|
928
|
+
return t;
|
|
929
|
+
}
|
|
930
|
+
const pn = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
|
|
931
|
+
function Le(e, t, r, n, s) {
|
|
932
|
+
if (a.isFunction(n))
|
|
933
|
+
return n.call(this, t, r);
|
|
934
|
+
if (s && (t = r), !!a.isString(t)) {
|
|
935
|
+
if (a.isString(n))
|
|
936
|
+
return t.indexOf(n) !== -1;
|
|
937
|
+
if (a.isRegExp(n))
|
|
938
|
+
return n.test(t);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
function mn(e) {
|
|
942
|
+
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, r, n) => r.toUpperCase() + n);
|
|
943
|
+
}
|
|
944
|
+
function bn(e, t) {
|
|
945
|
+
const r = a.toCamelCase(" " + t);
|
|
946
|
+
["get", "set", "has"].forEach((n) => {
|
|
947
|
+
Object.defineProperty(e, n + r, {
|
|
948
|
+
value: function(s, i, o) {
|
|
949
|
+
return this[n].call(this, t, s, i, o);
|
|
950
|
+
},
|
|
951
|
+
configurable: !0
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
let I = class {
|
|
956
|
+
constructor(t) {
|
|
957
|
+
t && this.set(t);
|
|
958
|
+
}
|
|
959
|
+
set(t, r, n) {
|
|
960
|
+
const s = this;
|
|
961
|
+
function i(c, h, f) {
|
|
962
|
+
const u = le(h);
|
|
963
|
+
if (!u)
|
|
964
|
+
throw new Error("header name must be a non-empty string");
|
|
965
|
+
const m = a.findKey(s, u);
|
|
966
|
+
(!m || s[m] === void 0 || f === !0 || f === void 0 && s[m] !== !1) && (s[m || h] = Re(c));
|
|
967
|
+
}
|
|
968
|
+
const o = (c, h) => a.forEach(c, (f, u) => i(f, u, h));
|
|
969
|
+
if (a.isPlainObject(t) || t instanceof this.constructor)
|
|
970
|
+
o(t, r);
|
|
971
|
+
else if (a.isString(t) && (t = t.trim()) && !pn(t))
|
|
972
|
+
o(dn(t), r);
|
|
973
|
+
else if (a.isObject(t) && a.isIterable(t)) {
|
|
974
|
+
let c = {}, h, f;
|
|
975
|
+
for (const u of t) {
|
|
976
|
+
if (!a.isArray(u))
|
|
977
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
978
|
+
c[f = u[0]] = (h = c[f]) ? a.isArray(h) ? [...h, u[1]] : [h, u[1]] : u[1];
|
|
979
|
+
}
|
|
980
|
+
o(c, r);
|
|
981
|
+
} else
|
|
982
|
+
t != null && i(r, t, n);
|
|
983
|
+
return this;
|
|
984
|
+
}
|
|
985
|
+
get(t, r) {
|
|
986
|
+
if (t = le(t), t) {
|
|
987
|
+
const n = a.findKey(this, t);
|
|
988
|
+
if (n) {
|
|
989
|
+
const s = this[n];
|
|
990
|
+
if (!r)
|
|
991
|
+
return s;
|
|
992
|
+
if (r === !0)
|
|
993
|
+
return hn(s);
|
|
994
|
+
if (a.isFunction(r))
|
|
995
|
+
return r.call(this, s, n);
|
|
996
|
+
if (a.isRegExp(r))
|
|
997
|
+
return r.exec(s);
|
|
998
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
has(t, r) {
|
|
1003
|
+
if (t = le(t), t) {
|
|
1004
|
+
const n = a.findKey(this, t);
|
|
1005
|
+
return !!(n && this[n] !== void 0 && (!r || Le(this, this[n], n, r)));
|
|
1006
|
+
}
|
|
1007
|
+
return !1;
|
|
1008
|
+
}
|
|
1009
|
+
delete(t, r) {
|
|
1010
|
+
const n = this;
|
|
1011
|
+
let s = !1;
|
|
1012
|
+
function i(o) {
|
|
1013
|
+
if (o = le(o), o) {
|
|
1014
|
+
const c = a.findKey(n, o);
|
|
1015
|
+
c && (!r || Le(n, n[c], c, r)) && (delete n[c], s = !0);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
return a.isArray(t) ? t.forEach(i) : i(t), s;
|
|
1019
|
+
}
|
|
1020
|
+
clear(t) {
|
|
1021
|
+
const r = Object.keys(this);
|
|
1022
|
+
let n = r.length, s = !1;
|
|
1023
|
+
for (; n--; ) {
|
|
1024
|
+
const i = r[n];
|
|
1025
|
+
(!t || Le(this, this[i], i, t, !0)) && (delete this[i], s = !0);
|
|
1026
|
+
}
|
|
1027
|
+
return s;
|
|
1028
|
+
}
|
|
1029
|
+
normalize(t) {
|
|
1030
|
+
const r = this, n = {};
|
|
1031
|
+
return a.forEach(this, (s, i) => {
|
|
1032
|
+
const o = a.findKey(n, i);
|
|
1033
|
+
if (o) {
|
|
1034
|
+
r[o] = Re(s), delete r[i];
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
const c = t ? mn(i) : String(i).trim();
|
|
1038
|
+
c !== i && delete r[i], r[c] = Re(s), n[c] = !0;
|
|
1039
|
+
}), this;
|
|
1040
|
+
}
|
|
1041
|
+
concat(...t) {
|
|
1042
|
+
return this.constructor.concat(this, ...t);
|
|
1043
|
+
}
|
|
1044
|
+
toJSON(t) {
|
|
1045
|
+
const r = /* @__PURE__ */ Object.create(null);
|
|
1046
|
+
return a.forEach(this, (n, s) => {
|
|
1047
|
+
n != null && n !== !1 && (r[s] = t && a.isArray(n) ? n.join(", ") : n);
|
|
1048
|
+
}), r;
|
|
1049
|
+
}
|
|
1050
|
+
[Symbol.iterator]() {
|
|
1051
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1052
|
+
}
|
|
1053
|
+
toString() {
|
|
1054
|
+
return Object.entries(this.toJSON()).map(([t, r]) => t + ": " + r).join(`
|
|
1055
|
+
`);
|
|
1056
|
+
}
|
|
1057
|
+
getSetCookie() {
|
|
1058
|
+
return this.get("set-cookie") || [];
|
|
1059
|
+
}
|
|
1060
|
+
get [Symbol.toStringTag]() {
|
|
1061
|
+
return "AxiosHeaders";
|
|
1062
|
+
}
|
|
1063
|
+
static from(t) {
|
|
1064
|
+
return t instanceof this ? t : new this(t);
|
|
1065
|
+
}
|
|
1066
|
+
static concat(t, ...r) {
|
|
1067
|
+
const n = new this(t);
|
|
1068
|
+
return r.forEach((s) => n.set(s)), n;
|
|
1069
|
+
}
|
|
1070
|
+
static accessor(t) {
|
|
1071
|
+
const n = (this[et] = this[et] = {
|
|
1072
|
+
accessors: {}
|
|
1073
|
+
}).accessors, s = this.prototype;
|
|
1074
|
+
function i(o) {
|
|
1075
|
+
const c = le(o);
|
|
1076
|
+
n[c] || (bn(s, o), n[c] = !0);
|
|
1077
|
+
}
|
|
1078
|
+
return a.isArray(t) ? t.forEach(i) : i(t), this;
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
I.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
1082
|
+
a.reduceDescriptors(I.prototype, ({ value: e }, t) => {
|
|
1083
|
+
let r = t[0].toUpperCase() + t.slice(1);
|
|
1084
|
+
return {
|
|
1085
|
+
get: () => e,
|
|
1086
|
+
set(n) {
|
|
1087
|
+
this[r] = n;
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
});
|
|
1091
|
+
a.freezeMethods(I);
|
|
1092
|
+
function Ie(e, t) {
|
|
1093
|
+
const r = this || pe, n = t || r, s = I.from(n.headers);
|
|
1094
|
+
let i = n.data;
|
|
1095
|
+
return a.forEach(e, function(c) {
|
|
1096
|
+
i = c.call(r, i, s.normalize(), t ? t.status : void 0);
|
|
1097
|
+
}), s.normalize(), i;
|
|
1098
|
+
}
|
|
1099
|
+
function It(e) {
|
|
1100
|
+
return !!(e && e.__CANCEL__);
|
|
1101
|
+
}
|
|
1102
|
+
function ne(e, t, r) {
|
|
1103
|
+
y.call(this, e ?? "canceled", y.ERR_CANCELED, t, r), this.name = "CanceledError";
|
|
1104
|
+
}
|
|
1105
|
+
a.inherits(ne, y, {
|
|
1106
|
+
__CANCEL__: !0
|
|
1107
|
+
});
|
|
1108
|
+
function Ut(e, t, r) {
|
|
1109
|
+
const n = r.config.validateStatus;
|
|
1110
|
+
!r.status || !n || n(r.status) ? e(r) : t(new y(
|
|
1111
|
+
"Request failed with status code " + r.status,
|
|
1112
|
+
[y.ERR_BAD_REQUEST, y.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
|
|
1113
|
+
r.config,
|
|
1114
|
+
r.request,
|
|
1115
|
+
r
|
|
1116
|
+
));
|
|
1117
|
+
}
|
|
1118
|
+
function En(e) {
|
|
1119
|
+
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
|
|
1120
|
+
return t && t[1] || "";
|
|
1121
|
+
}
|
|
1122
|
+
function yn(e, t) {
|
|
1123
|
+
e = e || 10;
|
|
1124
|
+
const r = new Array(e), n = new Array(e);
|
|
1125
|
+
let s = 0, i = 0, o;
|
|
1126
|
+
return t = t !== void 0 ? t : 1e3, function(h) {
|
|
1127
|
+
const f = Date.now(), u = n[i];
|
|
1128
|
+
o || (o = f), r[s] = h, n[s] = f;
|
|
1129
|
+
let m = i, g = 0;
|
|
1130
|
+
for (; m !== s; )
|
|
1131
|
+
g += r[m++], m = m % e;
|
|
1132
|
+
if (s = (s + 1) % e, s === i && (i = (i + 1) % e), f - o < t)
|
|
1133
|
+
return;
|
|
1134
|
+
const T = u && f - u;
|
|
1135
|
+
return T ? Math.round(g * 1e3 / T) : void 0;
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
function wn(e, t) {
|
|
1139
|
+
let r = 0, n = 1e3 / t, s, i;
|
|
1140
|
+
const o = (f, u = Date.now()) => {
|
|
1141
|
+
r = u, s = null, i && (clearTimeout(i), i = null), e(...f);
|
|
1142
|
+
};
|
|
1143
|
+
return [(...f) => {
|
|
1144
|
+
const u = Date.now(), m = u - r;
|
|
1145
|
+
m >= n ? o(f, u) : (s = f, i || (i = setTimeout(() => {
|
|
1146
|
+
i = null, o(s);
|
|
1147
|
+
}, n - m)));
|
|
1148
|
+
}, () => s && o(s)];
|
|
1149
|
+
}
|
|
1150
|
+
const Ae = (e, t, r = 3) => {
|
|
1151
|
+
let n = 0;
|
|
1152
|
+
const s = yn(50, 250);
|
|
1153
|
+
return wn((i) => {
|
|
1154
|
+
const o = i.loaded, c = i.lengthComputable ? i.total : void 0, h = o - n, f = s(h), u = o <= c;
|
|
1155
|
+
n = o;
|
|
1156
|
+
const m = {
|
|
1157
|
+
loaded: o,
|
|
1158
|
+
total: c,
|
|
1159
|
+
progress: c ? o / c : void 0,
|
|
1160
|
+
bytes: h,
|
|
1161
|
+
rate: f || void 0,
|
|
1162
|
+
estimated: f && c && u ? (c - o) / f : void 0,
|
|
1163
|
+
event: i,
|
|
1164
|
+
lengthComputable: c != null,
|
|
1165
|
+
[t ? "download" : "upload"]: !0
|
|
1166
|
+
};
|
|
1167
|
+
e(m);
|
|
1168
|
+
}, r);
|
|
1169
|
+
}, tt = (e, t) => {
|
|
1170
|
+
const r = e != null;
|
|
1171
|
+
return [(n) => t[0]({
|
|
1172
|
+
lengthComputable: r,
|
|
1173
|
+
total: e,
|
|
1174
|
+
loaded: n
|
|
1175
|
+
}), t[1]];
|
|
1176
|
+
}, rt = (e) => (...t) => a.asap(() => e(...t)), gn = k.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (r) => (r = new URL(r, k.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(
|
|
1177
|
+
new URL(k.origin),
|
|
1178
|
+
k.navigator && /(msie|trident)/i.test(k.navigator.userAgent)
|
|
1179
|
+
) : () => !0, Sn = k.hasStandardBrowserEnv ? (
|
|
1180
|
+
// Standard browser envs support document.cookie
|
|
1181
|
+
{
|
|
1182
|
+
write(e, t, r, n, s, i, o) {
|
|
1183
|
+
if (typeof document > "u") return;
|
|
1184
|
+
const c = [`${e}=${encodeURIComponent(t)}`];
|
|
1185
|
+
a.isNumber(r) && c.push(`expires=${new Date(r).toUTCString()}`), a.isString(n) && c.push(`path=${n}`), a.isString(s) && c.push(`domain=${s}`), i === !0 && c.push("secure"), a.isString(o) && c.push(`SameSite=${o}`), document.cookie = c.join("; ");
|
|
1186
|
+
},
|
|
1187
|
+
read(e) {
|
|
1188
|
+
if (typeof document > "u") return null;
|
|
1189
|
+
const t = document.cookie.match(new RegExp("(?:^|; )" + e + "=([^;]*)"));
|
|
1190
|
+
return t ? decodeURIComponent(t[1]) : null;
|
|
1191
|
+
},
|
|
1192
|
+
remove(e) {
|
|
1193
|
+
this.write(e, "", Date.now() - 864e5, "/");
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
) : (
|
|
1197
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
1198
|
+
{
|
|
1199
|
+
write() {
|
|
1200
|
+
},
|
|
1201
|
+
read() {
|
|
1202
|
+
return null;
|
|
1203
|
+
},
|
|
1204
|
+
remove() {
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
);
|
|
1208
|
+
function Rn(e) {
|
|
1209
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
1210
|
+
}
|
|
1211
|
+
function On(e, t) {
|
|
1212
|
+
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
1213
|
+
}
|
|
1214
|
+
function Ft(e, t, r) {
|
|
1215
|
+
let n = !Rn(t);
|
|
1216
|
+
return e && (n || r == !1) ? On(e, t) : t;
|
|
1217
|
+
}
|
|
1218
|
+
const nt = (e) => e instanceof I ? { ...e } : e;
|
|
1219
|
+
function K(e, t) {
|
|
1220
|
+
t = t || {};
|
|
1221
|
+
const r = {};
|
|
1222
|
+
function n(f, u, m, g) {
|
|
1223
|
+
return a.isPlainObject(f) && a.isPlainObject(u) ? a.merge.call({ caseless: g }, f, u) : a.isPlainObject(u) ? a.merge({}, u) : a.isArray(u) ? u.slice() : u;
|
|
1224
|
+
}
|
|
1225
|
+
function s(f, u, m, g) {
|
|
1226
|
+
if (a.isUndefined(u)) {
|
|
1227
|
+
if (!a.isUndefined(f))
|
|
1228
|
+
return n(void 0, f, m, g);
|
|
1229
|
+
} else return n(f, u, m, g);
|
|
1230
|
+
}
|
|
1231
|
+
function i(f, u) {
|
|
1232
|
+
if (!a.isUndefined(u))
|
|
1233
|
+
return n(void 0, u);
|
|
1234
|
+
}
|
|
1235
|
+
function o(f, u) {
|
|
1236
|
+
if (a.isUndefined(u)) {
|
|
1237
|
+
if (!a.isUndefined(f))
|
|
1238
|
+
return n(void 0, f);
|
|
1239
|
+
} else return n(void 0, u);
|
|
1240
|
+
}
|
|
1241
|
+
function c(f, u, m) {
|
|
1242
|
+
if (m in t)
|
|
1243
|
+
return n(f, u);
|
|
1244
|
+
if (m in e)
|
|
1245
|
+
return n(void 0, f);
|
|
1246
|
+
}
|
|
1247
|
+
const h = {
|
|
1248
|
+
url: i,
|
|
1249
|
+
method: i,
|
|
1250
|
+
data: i,
|
|
1251
|
+
baseURL: o,
|
|
1252
|
+
transformRequest: o,
|
|
1253
|
+
transformResponse: o,
|
|
1254
|
+
paramsSerializer: o,
|
|
1255
|
+
timeout: o,
|
|
1256
|
+
timeoutMessage: o,
|
|
1257
|
+
withCredentials: o,
|
|
1258
|
+
withXSRFToken: o,
|
|
1259
|
+
adapter: o,
|
|
1260
|
+
responseType: o,
|
|
1261
|
+
xsrfCookieName: o,
|
|
1262
|
+
xsrfHeaderName: o,
|
|
1263
|
+
onUploadProgress: o,
|
|
1264
|
+
onDownloadProgress: o,
|
|
1265
|
+
decompress: o,
|
|
1266
|
+
maxContentLength: o,
|
|
1267
|
+
maxBodyLength: o,
|
|
1268
|
+
beforeRedirect: o,
|
|
1269
|
+
transport: o,
|
|
1270
|
+
httpAgent: o,
|
|
1271
|
+
httpsAgent: o,
|
|
1272
|
+
cancelToken: o,
|
|
1273
|
+
socketPath: o,
|
|
1274
|
+
responseEncoding: o,
|
|
1275
|
+
validateStatus: c,
|
|
1276
|
+
headers: (f, u, m) => s(nt(f), nt(u), m, !0)
|
|
1277
|
+
};
|
|
1278
|
+
return a.forEach(Object.keys({ ...e, ...t }), function(u) {
|
|
1279
|
+
const m = h[u] || s, g = m(e[u], t[u], u);
|
|
1280
|
+
a.isUndefined(g) && m !== c || (r[u] = g);
|
|
1281
|
+
}), r;
|
|
1282
|
+
}
|
|
1283
|
+
const vt = (e) => {
|
|
1284
|
+
const t = K({}, e);
|
|
1285
|
+
let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: i, headers: o, auth: c } = t;
|
|
1286
|
+
if (t.headers = o = I.from(o), t.url = kt(Ft(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), c && o.set(
|
|
1287
|
+
"Authorization",
|
|
1288
|
+
"Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
|
|
1289
|
+
), a.isFormData(r)) {
|
|
1290
|
+
if (k.hasStandardBrowserEnv || k.hasStandardBrowserWebWorkerEnv)
|
|
1291
|
+
o.setContentType(void 0);
|
|
1292
|
+
else if (a.isFunction(r.getHeaders)) {
|
|
1293
|
+
const h = r.getHeaders(), f = ["content-type", "content-length"];
|
|
1294
|
+
Object.entries(h).forEach(([u, m]) => {
|
|
1295
|
+
f.includes(u.toLowerCase()) && o.set(u, m);
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
if (k.hasStandardBrowserEnv && (n && a.isFunction(n) && (n = n(t)), n || n !== !1 && gn(t.url))) {
|
|
1300
|
+
const h = s && i && Sn.read(i);
|
|
1301
|
+
h && o.set(s, h);
|
|
1302
|
+
}
|
|
1303
|
+
return t;
|
|
1304
|
+
}, Tn = typeof XMLHttpRequest < "u", An = Tn && function(e) {
|
|
1305
|
+
return new Promise(function(r, n) {
|
|
1306
|
+
const s = vt(e);
|
|
1307
|
+
let i = s.data;
|
|
1308
|
+
const o = I.from(s.headers).normalize();
|
|
1309
|
+
let { responseType: c, onUploadProgress: h, onDownloadProgress: f } = s, u, m, g, T, d;
|
|
1310
|
+
function b() {
|
|
1311
|
+
T && T(), d && d(), s.cancelToken && s.cancelToken.unsubscribe(u), s.signal && s.signal.removeEventListener("abort", u);
|
|
1312
|
+
}
|
|
1313
|
+
let p = new XMLHttpRequest();
|
|
1314
|
+
p.open(s.method.toUpperCase(), s.url, !0), p.timeout = s.timeout;
|
|
1315
|
+
function S() {
|
|
1316
|
+
if (!p)
|
|
1317
|
+
return;
|
|
1318
|
+
const A = I.from(
|
|
1319
|
+
"getAllResponseHeaders" in p && p.getAllResponseHeaders()
|
|
1320
|
+
), U = {
|
|
1321
|
+
data: !c || c === "text" || c === "json" ? p.responseText : p.response,
|
|
1322
|
+
status: p.status,
|
|
1323
|
+
statusText: p.statusText,
|
|
1324
|
+
headers: A,
|
|
1325
|
+
config: e,
|
|
1326
|
+
request: p
|
|
1327
|
+
};
|
|
1328
|
+
Ut(function(j) {
|
|
1329
|
+
r(j), b();
|
|
1330
|
+
}, function(j) {
|
|
1331
|
+
n(j), b();
|
|
1332
|
+
}, U), p = null;
|
|
1333
|
+
}
|
|
1334
|
+
"onloadend" in p ? p.onloadend = S : p.onreadystatechange = function() {
|
|
1335
|
+
!p || p.readyState !== 4 || p.status === 0 && !(p.responseURL && p.responseURL.indexOf("file:") === 0) || setTimeout(S);
|
|
1336
|
+
}, p.onabort = function() {
|
|
1337
|
+
p && (n(new y("Request aborted", y.ECONNABORTED, e, p)), p = null);
|
|
1338
|
+
}, p.onerror = function(C) {
|
|
1339
|
+
const U = C && C.message ? C.message : "Network Error", $ = new y(U, y.ERR_NETWORK, e, p);
|
|
1340
|
+
$.event = C || null, n($), p = null;
|
|
1341
|
+
}, p.ontimeout = function() {
|
|
1342
|
+
let C = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
|
|
1343
|
+
const U = s.transitional || jt;
|
|
1344
|
+
s.timeoutErrorMessage && (C = s.timeoutErrorMessage), n(new y(
|
|
1345
|
+
C,
|
|
1346
|
+
U.clarifyTimeoutError ? y.ETIMEDOUT : y.ECONNABORTED,
|
|
1347
|
+
e,
|
|
1348
|
+
p
|
|
1349
|
+
)), p = null;
|
|
1350
|
+
}, i === void 0 && o.setContentType(null), "setRequestHeader" in p && a.forEach(o.toJSON(), function(C, U) {
|
|
1351
|
+
p.setRequestHeader(U, C);
|
|
1352
|
+
}), a.isUndefined(s.withCredentials) || (p.withCredentials = !!s.withCredentials), c && c !== "json" && (p.responseType = s.responseType), f && ([g, d] = Ae(f, !0), p.addEventListener("progress", g)), h && p.upload && ([m, T] = Ae(h), p.upload.addEventListener("progress", m), p.upload.addEventListener("loadend", T)), (s.cancelToken || s.signal) && (u = (A) => {
|
|
1353
|
+
p && (n(!A || A.type ? new ne(null, e, p) : A), p.abort(), p = null);
|
|
1354
|
+
}, s.cancelToken && s.cancelToken.subscribe(u), s.signal && (s.signal.aborted ? u() : s.signal.addEventListener("abort", u)));
|
|
1355
|
+
const N = En(s.url);
|
|
1356
|
+
if (N && k.protocols.indexOf(N) === -1) {
|
|
1357
|
+
n(new y("Unsupported protocol " + N + ":", y.ERR_BAD_REQUEST, e));
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
p.send(i || null);
|
|
1361
|
+
});
|
|
1362
|
+
}, xn = (e, t) => {
|
|
1363
|
+
const { length: r } = e = e ? e.filter(Boolean) : [];
|
|
1364
|
+
if (t || r) {
|
|
1365
|
+
let n = new AbortController(), s;
|
|
1366
|
+
const i = function(f) {
|
|
1367
|
+
if (!s) {
|
|
1368
|
+
s = !0, c();
|
|
1369
|
+
const u = f instanceof Error ? f : this.reason;
|
|
1370
|
+
n.abort(u instanceof y ? u : new ne(u instanceof Error ? u.message : u));
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
let o = t && setTimeout(() => {
|
|
1374
|
+
o = null, i(new y(`timeout ${t} of ms exceeded`, y.ETIMEDOUT));
|
|
1375
|
+
}, t);
|
|
1376
|
+
const c = () => {
|
|
1377
|
+
e && (o && clearTimeout(o), o = null, e.forEach((f) => {
|
|
1378
|
+
f.unsubscribe ? f.unsubscribe(i) : f.removeEventListener("abort", i);
|
|
1379
|
+
}), e = null);
|
|
1380
|
+
};
|
|
1381
|
+
e.forEach((f) => f.addEventListener("abort", i));
|
|
1382
|
+
const { signal: h } = n;
|
|
1383
|
+
return h.unsubscribe = () => a.asap(c), h;
|
|
1384
|
+
}
|
|
1385
|
+
}, Nn = function* (e, t) {
|
|
1386
|
+
let r = e.byteLength;
|
|
1387
|
+
if (r < t) {
|
|
1388
|
+
yield e;
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
let n = 0, s;
|
|
1392
|
+
for (; n < r; )
|
|
1393
|
+
s = n + t, yield e.slice(n, s), n = s;
|
|
1394
|
+
}, _n = async function* (e, t) {
|
|
1395
|
+
for await (const r of Pn(e))
|
|
1396
|
+
yield* Nn(r, t);
|
|
1397
|
+
}, Pn = async function* (e) {
|
|
1398
|
+
if (e[Symbol.asyncIterator]) {
|
|
1399
|
+
yield* e;
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
const t = e.getReader();
|
|
1403
|
+
try {
|
|
1404
|
+
for (; ; ) {
|
|
1405
|
+
const { done: r, value: n } = await t.read();
|
|
1406
|
+
if (r)
|
|
1407
|
+
break;
|
|
1408
|
+
yield n;
|
|
1409
|
+
}
|
|
1410
|
+
} finally {
|
|
1411
|
+
await t.cancel();
|
|
1412
|
+
}
|
|
1413
|
+
}, st = (e, t, r, n) => {
|
|
1414
|
+
const s = _n(e, t);
|
|
1415
|
+
let i = 0, o, c = (h) => {
|
|
1416
|
+
o || (o = !0, n && n(h));
|
|
1417
|
+
};
|
|
1418
|
+
return new ReadableStream({
|
|
1419
|
+
async pull(h) {
|
|
1420
|
+
try {
|
|
1421
|
+
const { done: f, value: u } = await s.next();
|
|
1422
|
+
if (f) {
|
|
1423
|
+
c(), h.close();
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
let m = u.byteLength;
|
|
1427
|
+
if (r) {
|
|
1428
|
+
let g = i += m;
|
|
1429
|
+
r(g);
|
|
1430
|
+
}
|
|
1431
|
+
h.enqueue(new Uint8Array(u));
|
|
1432
|
+
} catch (f) {
|
|
1433
|
+
throw c(f), f;
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
cancel(h) {
|
|
1437
|
+
return c(h), s.return();
|
|
1438
|
+
}
|
|
1439
|
+
}, {
|
|
1440
|
+
highWaterMark: 2
|
|
1441
|
+
});
|
|
1442
|
+
}, ot = 64 * 1024, { isFunction: we } = a, Cn = (({ Request: e, Response: t }) => ({
|
|
1443
|
+
Request: e,
|
|
1444
|
+
Response: t
|
|
1445
|
+
}))(a.global), {
|
|
1446
|
+
ReadableStream: it,
|
|
1447
|
+
TextEncoder: at
|
|
1448
|
+
} = a.global, ct = (e, ...t) => {
|
|
1449
|
+
try {
|
|
1450
|
+
return !!e(...t);
|
|
1451
|
+
} catch {
|
|
1452
|
+
return !1;
|
|
1453
|
+
}
|
|
1454
|
+
}, kn = (e) => {
|
|
1455
|
+
e = a.merge.call({
|
|
1456
|
+
skipUndefined: !0
|
|
1457
|
+
}, Cn, e);
|
|
1458
|
+
const { fetch: t, Request: r, Response: n } = e, s = t ? we(t) : typeof fetch == "function", i = we(r), o = we(n);
|
|
1459
|
+
if (!s)
|
|
1460
|
+
return !1;
|
|
1461
|
+
const c = s && we(it), h = s && (typeof at == "function" ? /* @__PURE__ */ ((d) => (b) => d.encode(b))(new at()) : async (d) => new Uint8Array(await new r(d).arrayBuffer())), f = i && c && ct(() => {
|
|
1462
|
+
let d = !1;
|
|
1463
|
+
const b = new r(k.origin, {
|
|
1464
|
+
body: new it(),
|
|
1465
|
+
method: "POST",
|
|
1466
|
+
get duplex() {
|
|
1467
|
+
return d = !0, "half";
|
|
1468
|
+
}
|
|
1469
|
+
}).headers.has("Content-Type");
|
|
1470
|
+
return d && !b;
|
|
1471
|
+
}), u = o && c && ct(() => a.isReadableStream(new n("").body)), m = {
|
|
1472
|
+
stream: u && ((d) => d.body)
|
|
1473
|
+
};
|
|
1474
|
+
s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((d) => {
|
|
1475
|
+
!m[d] && (m[d] = (b, p) => {
|
|
1476
|
+
let S = b && b[d];
|
|
1477
|
+
if (S)
|
|
1478
|
+
return S.call(b);
|
|
1479
|
+
throw new y(`Response type '${d}' is not supported`, y.ERR_NOT_SUPPORT, p);
|
|
1480
|
+
});
|
|
1481
|
+
});
|
|
1482
|
+
const g = async (d) => {
|
|
1483
|
+
if (d == null)
|
|
1484
|
+
return 0;
|
|
1485
|
+
if (a.isBlob(d))
|
|
1486
|
+
return d.size;
|
|
1487
|
+
if (a.isSpecCompliantForm(d))
|
|
1488
|
+
return (await new r(k.origin, {
|
|
1489
|
+
method: "POST",
|
|
1490
|
+
body: d
|
|
1491
|
+
}).arrayBuffer()).byteLength;
|
|
1492
|
+
if (a.isArrayBufferView(d) || a.isArrayBuffer(d))
|
|
1493
|
+
return d.byteLength;
|
|
1494
|
+
if (a.isURLSearchParams(d) && (d = d + ""), a.isString(d))
|
|
1495
|
+
return (await h(d)).byteLength;
|
|
1496
|
+
}, T = async (d, b) => {
|
|
1497
|
+
const p = a.toFiniteNumber(d.getContentLength());
|
|
1498
|
+
return p ?? g(b);
|
|
1499
|
+
};
|
|
1500
|
+
return async (d) => {
|
|
1501
|
+
let {
|
|
1502
|
+
url: b,
|
|
1503
|
+
method: p,
|
|
1504
|
+
data: S,
|
|
1505
|
+
signal: N,
|
|
1506
|
+
cancelToken: A,
|
|
1507
|
+
timeout: C,
|
|
1508
|
+
onDownloadProgress: U,
|
|
1509
|
+
onUploadProgress: $,
|
|
1510
|
+
responseType: j,
|
|
1511
|
+
headers: se,
|
|
1512
|
+
withCredentials: H = "same-origin",
|
|
1513
|
+
fetchOptions: me
|
|
1514
|
+
} = vt(d), be = t || fetch;
|
|
1515
|
+
j = j ? (j + "").toLowerCase() : "text";
|
|
1516
|
+
let z = xn([N, A && A.toAbortSignal()], C), G = null;
|
|
1517
|
+
const q = z && z.unsubscribe && (() => {
|
|
1518
|
+
z.unsubscribe();
|
|
1519
|
+
});
|
|
1520
|
+
let Z;
|
|
1521
|
+
try {
|
|
1522
|
+
if ($ && f && p !== "get" && p !== "head" && (Z = await T(se, S)) !== 0) {
|
|
1523
|
+
let l = new r(b, {
|
|
1524
|
+
method: "POST",
|
|
1525
|
+
body: S,
|
|
1526
|
+
duplex: "half"
|
|
1527
|
+
}), E;
|
|
1528
|
+
if (a.isFormData(S) && (E = l.headers.get("content-type")) && se.setContentType(E), l.body) {
|
|
1529
|
+
const [R, O] = tt(
|
|
1530
|
+
Z,
|
|
1531
|
+
Ae(rt($))
|
|
1532
|
+
);
|
|
1533
|
+
S = st(l.body, ot, R, O);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
a.isString(H) || (H = H ? "include" : "omit");
|
|
1537
|
+
const F = i && "credentials" in r.prototype, oe = {
|
|
1538
|
+
...me,
|
|
1539
|
+
signal: z,
|
|
1540
|
+
method: p.toUpperCase(),
|
|
1541
|
+
headers: se.normalize().toJSON(),
|
|
1542
|
+
body: S,
|
|
1543
|
+
duplex: "half",
|
|
1544
|
+
credentials: F ? H : void 0
|
|
1545
|
+
};
|
|
1546
|
+
G = i && new r(b, oe);
|
|
1547
|
+
let v = await (i ? be(G, me) : be(b, oe));
|
|
1548
|
+
const ie = u && (j === "stream" || j === "response");
|
|
1549
|
+
if (u && (U || ie && q)) {
|
|
1550
|
+
const l = {};
|
|
1551
|
+
["status", "statusText", "headers"].forEach((W) => {
|
|
1552
|
+
l[W] = v[W];
|
|
1553
|
+
});
|
|
1554
|
+
const E = a.toFiniteNumber(v.headers.get("content-length")), [R, O] = U && tt(
|
|
1555
|
+
E,
|
|
1556
|
+
Ae(rt(U), !0)
|
|
1557
|
+
) || [];
|
|
1558
|
+
v = new n(
|
|
1559
|
+
st(v.body, ot, R, () => {
|
|
1560
|
+
O && O(), q && q();
|
|
1561
|
+
}),
|
|
1562
|
+
l
|
|
1563
|
+
);
|
|
1564
|
+
}
|
|
1565
|
+
j = j || "text";
|
|
1566
|
+
let Ee = await m[a.findKey(m, j) || "text"](v, d);
|
|
1567
|
+
return !ie && q && q(), await new Promise((l, E) => {
|
|
1568
|
+
Ut(l, E, {
|
|
1569
|
+
data: Ee,
|
|
1570
|
+
headers: I.from(v.headers),
|
|
1571
|
+
status: v.status,
|
|
1572
|
+
statusText: v.statusText,
|
|
1573
|
+
config: d,
|
|
1574
|
+
request: G
|
|
1575
|
+
});
|
|
1576
|
+
});
|
|
1577
|
+
} catch (F) {
|
|
1578
|
+
throw q && q(), F && F.name === "TypeError" && /Load failed|fetch/i.test(F.message) ? Object.assign(
|
|
1579
|
+
new y("Network Error", y.ERR_NETWORK, d, G),
|
|
1580
|
+
{
|
|
1581
|
+
cause: F.cause || F
|
|
1582
|
+
}
|
|
1583
|
+
) : y.from(F, F && F.code, d, G);
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
}, jn = /* @__PURE__ */ new Map(), Dt = (e) => {
|
|
1587
|
+
let t = e && e.env || {};
|
|
1588
|
+
const { fetch: r, Request: n, Response: s } = t, i = [
|
|
1589
|
+
n,
|
|
1590
|
+
s,
|
|
1591
|
+
r
|
|
1592
|
+
];
|
|
1593
|
+
let o = i.length, c = o, h, f, u = jn;
|
|
1594
|
+
for (; c--; )
|
|
1595
|
+
h = i[c], f = u.get(h), f === void 0 && u.set(h, f = c ? /* @__PURE__ */ new Map() : kn(t)), u = f;
|
|
1596
|
+
return f;
|
|
1597
|
+
};
|
|
1598
|
+
Dt();
|
|
1599
|
+
const Ge = {
|
|
1600
|
+
http: Vr,
|
|
1601
|
+
xhr: An,
|
|
1602
|
+
fetch: {
|
|
1603
|
+
get: Dt
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
a.forEach(Ge, (e, t) => {
|
|
1607
|
+
if (e) {
|
|
1608
|
+
try {
|
|
1609
|
+
Object.defineProperty(e, "name", { value: t });
|
|
1610
|
+
} catch {
|
|
1611
|
+
}
|
|
1612
|
+
Object.defineProperty(e, "adapterName", { value: t });
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
const lt = (e) => `- ${e}`, Ln = (e) => a.isFunction(e) || e === null || e === !1;
|
|
1616
|
+
function In(e, t) {
|
|
1617
|
+
e = a.isArray(e) ? e : [e];
|
|
1618
|
+
const { length: r } = e;
|
|
1619
|
+
let n, s;
|
|
1620
|
+
const i = {};
|
|
1621
|
+
for (let o = 0; o < r; o++) {
|
|
1622
|
+
n = e[o];
|
|
1623
|
+
let c;
|
|
1624
|
+
if (s = n, !Ln(n) && (s = Ge[(c = String(n)).toLowerCase()], s === void 0))
|
|
1625
|
+
throw new y(`Unknown adapter '${c}'`);
|
|
1626
|
+
if (s && (a.isFunction(s) || (s = s.get(t))))
|
|
1627
|
+
break;
|
|
1628
|
+
i[c || "#" + o] = s;
|
|
1629
|
+
}
|
|
1630
|
+
if (!s) {
|
|
1631
|
+
const o = Object.entries(i).map(
|
|
1632
|
+
([h, f]) => `adapter ${h} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
1633
|
+
);
|
|
1634
|
+
let c = r ? o.length > 1 ? `since :
|
|
1635
|
+
` + o.map(lt).join(`
|
|
1636
|
+
`) : " " + lt(o[0]) : "as no adapter specified";
|
|
1637
|
+
throw new y(
|
|
1638
|
+
"There is no suitable adapter to dispatch the request " + c,
|
|
1639
|
+
"ERR_NOT_SUPPORT"
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
return s;
|
|
1643
|
+
}
|
|
1644
|
+
const Bt = {
|
|
1645
|
+
/**
|
|
1646
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
1647
|
+
* @type {Function}
|
|
1648
|
+
*/
|
|
1649
|
+
getAdapter: In,
|
|
1650
|
+
/**
|
|
1651
|
+
* Exposes all known adapters
|
|
1652
|
+
* @type {Object<string, Function|Object>}
|
|
1653
|
+
*/
|
|
1654
|
+
adapters: Ge
|
|
1655
|
+
};
|
|
1656
|
+
function Ue(e) {
|
|
1657
|
+
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
1658
|
+
throw new ne(null, e);
|
|
1659
|
+
}
|
|
1660
|
+
function ut(e) {
|
|
1661
|
+
return Ue(e), e.headers = I.from(e.headers), e.data = Ie.call(
|
|
1662
|
+
e,
|
|
1663
|
+
e.transformRequest
|
|
1664
|
+
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Bt.getAdapter(e.adapter || pe.adapter, e)(e).then(function(n) {
|
|
1665
|
+
return Ue(e), n.data = Ie.call(
|
|
1666
|
+
e,
|
|
1667
|
+
e.transformResponse,
|
|
1668
|
+
n
|
|
1669
|
+
), n.headers = I.from(n.headers), n;
|
|
1670
|
+
}, function(n) {
|
|
1671
|
+
return It(n) || (Ue(e), n && n.response && (n.response.data = Ie.call(
|
|
1672
|
+
e,
|
|
1673
|
+
e.transformResponse,
|
|
1674
|
+
n.response
|
|
1675
|
+
), n.response.headers = I.from(n.response.headers))), Promise.reject(n);
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
const $t = "1.13.2", Ce = {};
|
|
1679
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
|
|
1680
|
+
Ce[e] = function(n) {
|
|
1681
|
+
return typeof n === e || "a" + (t < 1 ? "n " : " ") + e;
|
|
1682
|
+
};
|
|
1683
|
+
});
|
|
1684
|
+
const ft = {};
|
|
1685
|
+
Ce.transitional = function(t, r, n) {
|
|
1686
|
+
function s(i, o) {
|
|
1687
|
+
return "[Axios v" + $t + "] Transitional option '" + i + "'" + o + (n ? ". " + n : "");
|
|
1688
|
+
}
|
|
1689
|
+
return (i, o, c) => {
|
|
1690
|
+
if (t === !1)
|
|
1691
|
+
throw new y(
|
|
1692
|
+
s(o, " has been removed" + (r ? " in " + r : "")),
|
|
1693
|
+
y.ERR_DEPRECATED
|
|
1694
|
+
);
|
|
1695
|
+
return r && !ft[o] && (ft[o] = !0, console.warn(
|
|
1696
|
+
s(
|
|
1697
|
+
o,
|
|
1698
|
+
" has been deprecated since v" + r + " and will be removed in the near future"
|
|
1699
|
+
)
|
|
1700
|
+
)), t ? t(i, o, c) : !0;
|
|
1701
|
+
};
|
|
1702
|
+
};
|
|
1703
|
+
Ce.spelling = function(t) {
|
|
1704
|
+
return (r, n) => (console.warn(`${n} is likely a misspelling of ${t}`), !0);
|
|
1705
|
+
};
|
|
1706
|
+
function Un(e, t, r) {
|
|
1707
|
+
if (typeof e != "object")
|
|
1708
|
+
throw new y("options must be an object", y.ERR_BAD_OPTION_VALUE);
|
|
1709
|
+
const n = Object.keys(e);
|
|
1710
|
+
let s = n.length;
|
|
1711
|
+
for (; s-- > 0; ) {
|
|
1712
|
+
const i = n[s], o = t[i];
|
|
1713
|
+
if (o) {
|
|
1714
|
+
const c = e[i], h = c === void 0 || o(c, i, e);
|
|
1715
|
+
if (h !== !0)
|
|
1716
|
+
throw new y("option " + i + " must be " + h, y.ERR_BAD_OPTION_VALUE);
|
|
1717
|
+
continue;
|
|
1718
|
+
}
|
|
1719
|
+
if (r !== !0)
|
|
1720
|
+
throw new y("Unknown option " + i, y.ERR_BAD_OPTION);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
const Oe = {
|
|
1724
|
+
assertOptions: Un,
|
|
1725
|
+
validators: Ce
|
|
1726
|
+
}, B = Oe.validators;
|
|
1727
|
+
let Y = class {
|
|
1728
|
+
constructor(t) {
|
|
1729
|
+
this.defaults = t || {}, this.interceptors = {
|
|
1730
|
+
request: new Qe(),
|
|
1731
|
+
response: new Qe()
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* Dispatch a request
|
|
1736
|
+
*
|
|
1737
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
1738
|
+
* @param {?Object} config
|
|
1739
|
+
*
|
|
1740
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
1741
|
+
*/
|
|
1742
|
+
async request(t, r) {
|
|
1743
|
+
try {
|
|
1744
|
+
return await this._request(t, r);
|
|
1745
|
+
} catch (n) {
|
|
1746
|
+
if (n instanceof Error) {
|
|
1747
|
+
let s = {};
|
|
1748
|
+
Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
|
|
1749
|
+
const i = s.stack ? s.stack.replace(/^.+\n/, "") : "";
|
|
1750
|
+
try {
|
|
1751
|
+
n.stack ? i && !String(n.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (n.stack += `
|
|
1752
|
+
` + i) : n.stack = i;
|
|
1753
|
+
} catch {
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
throw n;
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
_request(t, r) {
|
|
1760
|
+
typeof t == "string" ? (r = r || {}, r.url = t) : r = t || {}, r = K(this.defaults, r);
|
|
1761
|
+
const { transitional: n, paramsSerializer: s, headers: i } = r;
|
|
1762
|
+
n !== void 0 && Oe.assertOptions(n, {
|
|
1763
|
+
silentJSONParsing: B.transitional(B.boolean),
|
|
1764
|
+
forcedJSONParsing: B.transitional(B.boolean),
|
|
1765
|
+
clarifyTimeoutError: B.transitional(B.boolean)
|
|
1766
|
+
}, !1), s != null && (a.isFunction(s) ? r.paramsSerializer = {
|
|
1767
|
+
serialize: s
|
|
1768
|
+
} : Oe.assertOptions(s, {
|
|
1769
|
+
encode: B.function,
|
|
1770
|
+
serialize: B.function
|
|
1771
|
+
}, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Oe.assertOptions(r, {
|
|
1772
|
+
baseUrl: B.spelling("baseURL"),
|
|
1773
|
+
withXsrfToken: B.spelling("withXSRFToken")
|
|
1774
|
+
}, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
|
|
1775
|
+
let o = i && a.merge(
|
|
1776
|
+
i.common,
|
|
1777
|
+
i[r.method]
|
|
1778
|
+
);
|
|
1779
|
+
i && a.forEach(
|
|
1780
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
1781
|
+
(d) => {
|
|
1782
|
+
delete i[d];
|
|
1783
|
+
}
|
|
1784
|
+
), r.headers = I.concat(o, i);
|
|
1785
|
+
const c = [];
|
|
1786
|
+
let h = !0;
|
|
1787
|
+
this.interceptors.request.forEach(function(b) {
|
|
1788
|
+
typeof b.runWhen == "function" && b.runWhen(r) === !1 || (h = h && b.synchronous, c.unshift(b.fulfilled, b.rejected));
|
|
1789
|
+
});
|
|
1790
|
+
const f = [];
|
|
1791
|
+
this.interceptors.response.forEach(function(b) {
|
|
1792
|
+
f.push(b.fulfilled, b.rejected);
|
|
1793
|
+
});
|
|
1794
|
+
let u, m = 0, g;
|
|
1795
|
+
if (!h) {
|
|
1796
|
+
const d = [ut.bind(this), void 0];
|
|
1797
|
+
for (d.unshift(...c), d.push(...f), g = d.length, u = Promise.resolve(r); m < g; )
|
|
1798
|
+
u = u.then(d[m++], d[m++]);
|
|
1799
|
+
return u;
|
|
1800
|
+
}
|
|
1801
|
+
g = c.length;
|
|
1802
|
+
let T = r;
|
|
1803
|
+
for (; m < g; ) {
|
|
1804
|
+
const d = c[m++], b = c[m++];
|
|
1805
|
+
try {
|
|
1806
|
+
T = d(T);
|
|
1807
|
+
} catch (p) {
|
|
1808
|
+
b.call(this, p);
|
|
1809
|
+
break;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
try {
|
|
1813
|
+
u = ut.call(this, T);
|
|
1814
|
+
} catch (d) {
|
|
1815
|
+
return Promise.reject(d);
|
|
1816
|
+
}
|
|
1817
|
+
for (m = 0, g = f.length; m < g; )
|
|
1818
|
+
u = u.then(f[m++], f[m++]);
|
|
1819
|
+
return u;
|
|
1820
|
+
}
|
|
1821
|
+
getUri(t) {
|
|
1822
|
+
t = K(this.defaults, t);
|
|
1823
|
+
const r = Ft(t.baseURL, t.url, t.allowAbsoluteUrls);
|
|
1824
|
+
return kt(r, t.params, t.paramsSerializer);
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
a.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1828
|
+
Y.prototype[t] = function(r, n) {
|
|
1829
|
+
return this.request(K(n || {}, {
|
|
1830
|
+
method: t,
|
|
1831
|
+
url: r,
|
|
1832
|
+
data: (n || {}).data
|
|
1833
|
+
}));
|
|
1834
|
+
};
|
|
1835
|
+
});
|
|
1836
|
+
a.forEach(["post", "put", "patch"], function(t) {
|
|
1837
|
+
function r(n) {
|
|
1838
|
+
return function(i, o, c) {
|
|
1839
|
+
return this.request(K(c || {}, {
|
|
1840
|
+
method: t,
|
|
1841
|
+
headers: n ? {
|
|
1842
|
+
"Content-Type": "multipart/form-data"
|
|
1843
|
+
} : {},
|
|
1844
|
+
url: i,
|
|
1845
|
+
data: o
|
|
1846
|
+
}));
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
Y.prototype[t] = r(), Y.prototype[t + "Form"] = r(!0);
|
|
1850
|
+
});
|
|
1851
|
+
let Fn = class qt {
|
|
1852
|
+
constructor(t) {
|
|
1853
|
+
if (typeof t != "function")
|
|
1854
|
+
throw new TypeError("executor must be a function.");
|
|
1855
|
+
let r;
|
|
1856
|
+
this.promise = new Promise(function(i) {
|
|
1857
|
+
r = i;
|
|
1858
|
+
});
|
|
1859
|
+
const n = this;
|
|
1860
|
+
this.promise.then((s) => {
|
|
1861
|
+
if (!n._listeners) return;
|
|
1862
|
+
let i = n._listeners.length;
|
|
1863
|
+
for (; i-- > 0; )
|
|
1864
|
+
n._listeners[i](s);
|
|
1865
|
+
n._listeners = null;
|
|
1866
|
+
}), this.promise.then = (s) => {
|
|
1867
|
+
let i;
|
|
1868
|
+
const o = new Promise((c) => {
|
|
1869
|
+
n.subscribe(c), i = c;
|
|
1870
|
+
}).then(s);
|
|
1871
|
+
return o.cancel = function() {
|
|
1872
|
+
n.unsubscribe(i);
|
|
1873
|
+
}, o;
|
|
1874
|
+
}, t(function(i, o, c) {
|
|
1875
|
+
n.reason || (n.reason = new ne(i, o, c), r(n.reason));
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
1880
|
+
*/
|
|
1881
|
+
throwIfRequested() {
|
|
1882
|
+
if (this.reason)
|
|
1883
|
+
throw this.reason;
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
* Subscribe to the cancel signal
|
|
1887
|
+
*/
|
|
1888
|
+
subscribe(t) {
|
|
1889
|
+
if (this.reason) {
|
|
1890
|
+
t(this.reason);
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
this._listeners ? this._listeners.push(t) : this._listeners = [t];
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Unsubscribe from the cancel signal
|
|
1897
|
+
*/
|
|
1898
|
+
unsubscribe(t) {
|
|
1899
|
+
if (!this._listeners)
|
|
1900
|
+
return;
|
|
1901
|
+
const r = this._listeners.indexOf(t);
|
|
1902
|
+
r !== -1 && this._listeners.splice(r, 1);
|
|
1903
|
+
}
|
|
1904
|
+
toAbortSignal() {
|
|
1905
|
+
const t = new AbortController(), r = (n) => {
|
|
1906
|
+
t.abort(n);
|
|
1907
|
+
};
|
|
1908
|
+
return this.subscribe(r), t.signal.unsubscribe = () => this.unsubscribe(r), t.signal;
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
1912
|
+
* cancels the `CancelToken`.
|
|
1913
|
+
*/
|
|
1914
|
+
static source() {
|
|
1915
|
+
let t;
|
|
1916
|
+
return {
|
|
1917
|
+
token: new qt(function(s) {
|
|
1918
|
+
t = s;
|
|
1919
|
+
}),
|
|
1920
|
+
cancel: t
|
|
1921
|
+
};
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
function vn(e) {
|
|
1925
|
+
return function(r) {
|
|
1926
|
+
return e.apply(null, r);
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
function Dn(e) {
|
|
1930
|
+
return a.isObject(e) && e.isAxiosError === !0;
|
|
1931
|
+
}
|
|
1932
|
+
const Be = {
|
|
1933
|
+
Continue: 100,
|
|
1934
|
+
SwitchingProtocols: 101,
|
|
1935
|
+
Processing: 102,
|
|
1936
|
+
EarlyHints: 103,
|
|
1937
|
+
Ok: 200,
|
|
1938
|
+
Created: 201,
|
|
1939
|
+
Accepted: 202,
|
|
1940
|
+
NonAuthoritativeInformation: 203,
|
|
1941
|
+
NoContent: 204,
|
|
1942
|
+
ResetContent: 205,
|
|
1943
|
+
PartialContent: 206,
|
|
1944
|
+
MultiStatus: 207,
|
|
1945
|
+
AlreadyReported: 208,
|
|
1946
|
+
ImUsed: 226,
|
|
1947
|
+
MultipleChoices: 300,
|
|
1948
|
+
MovedPermanently: 301,
|
|
1949
|
+
Found: 302,
|
|
1950
|
+
SeeOther: 303,
|
|
1951
|
+
NotModified: 304,
|
|
1952
|
+
UseProxy: 305,
|
|
1953
|
+
Unused: 306,
|
|
1954
|
+
TemporaryRedirect: 307,
|
|
1955
|
+
PermanentRedirect: 308,
|
|
1956
|
+
BadRequest: 400,
|
|
1957
|
+
Unauthorized: 401,
|
|
1958
|
+
PaymentRequired: 402,
|
|
1959
|
+
Forbidden: 403,
|
|
1960
|
+
NotFound: 404,
|
|
1961
|
+
MethodNotAllowed: 405,
|
|
1962
|
+
NotAcceptable: 406,
|
|
1963
|
+
ProxyAuthenticationRequired: 407,
|
|
1964
|
+
RequestTimeout: 408,
|
|
1965
|
+
Conflict: 409,
|
|
1966
|
+
Gone: 410,
|
|
1967
|
+
LengthRequired: 411,
|
|
1968
|
+
PreconditionFailed: 412,
|
|
1969
|
+
PayloadTooLarge: 413,
|
|
1970
|
+
UriTooLong: 414,
|
|
1971
|
+
UnsupportedMediaType: 415,
|
|
1972
|
+
RangeNotSatisfiable: 416,
|
|
1973
|
+
ExpectationFailed: 417,
|
|
1974
|
+
ImATeapot: 418,
|
|
1975
|
+
MisdirectedRequest: 421,
|
|
1976
|
+
UnprocessableEntity: 422,
|
|
1977
|
+
Locked: 423,
|
|
1978
|
+
FailedDependency: 424,
|
|
1979
|
+
TooEarly: 425,
|
|
1980
|
+
UpgradeRequired: 426,
|
|
1981
|
+
PreconditionRequired: 428,
|
|
1982
|
+
TooManyRequests: 429,
|
|
1983
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
1984
|
+
UnavailableForLegalReasons: 451,
|
|
1985
|
+
InternalServerError: 500,
|
|
1986
|
+
NotImplemented: 501,
|
|
1987
|
+
BadGateway: 502,
|
|
1988
|
+
ServiceUnavailable: 503,
|
|
1989
|
+
GatewayTimeout: 504,
|
|
1990
|
+
HttpVersionNotSupported: 505,
|
|
1991
|
+
VariantAlsoNegotiates: 506,
|
|
1992
|
+
InsufficientStorage: 507,
|
|
1993
|
+
LoopDetected: 508,
|
|
1994
|
+
NotExtended: 510,
|
|
1995
|
+
NetworkAuthenticationRequired: 511,
|
|
1996
|
+
WebServerIsDown: 521,
|
|
1997
|
+
ConnectionTimedOut: 522,
|
|
1998
|
+
OriginIsUnreachable: 523,
|
|
1999
|
+
TimeoutOccurred: 524,
|
|
2000
|
+
SslHandshakeFailed: 525,
|
|
2001
|
+
InvalidSslCertificate: 526
|
|
2002
|
+
};
|
|
2003
|
+
Object.entries(Be).forEach(([e, t]) => {
|
|
2004
|
+
Be[t] = e;
|
|
2005
|
+
});
|
|
2006
|
+
function Mt(e) {
|
|
2007
|
+
const t = new Y(e), r = wt(Y.prototype.request, t);
|
|
2008
|
+
return a.extend(r, Y.prototype, t, { allOwnKeys: !0 }), a.extend(r, t, null, { allOwnKeys: !0 }), r.create = function(s) {
|
|
2009
|
+
return Mt(K(e, s));
|
|
2010
|
+
}, r;
|
|
2011
|
+
}
|
|
2012
|
+
const x = Mt(pe);
|
|
2013
|
+
x.Axios = Y;
|
|
2014
|
+
x.CanceledError = ne;
|
|
2015
|
+
x.CancelToken = Fn;
|
|
2016
|
+
x.isCancel = It;
|
|
2017
|
+
x.VERSION = $t;
|
|
2018
|
+
x.toFormData = Pe;
|
|
2019
|
+
x.AxiosError = y;
|
|
2020
|
+
x.Cancel = x.CanceledError;
|
|
2021
|
+
x.all = function(t) {
|
|
2022
|
+
return Promise.all(t);
|
|
2023
|
+
};
|
|
2024
|
+
x.spread = vn;
|
|
2025
|
+
x.isAxiosError = Dn;
|
|
2026
|
+
x.mergeConfig = K;
|
|
2027
|
+
x.AxiosHeaders = I;
|
|
2028
|
+
x.formToJSON = (e) => Lt(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
2029
|
+
x.getAdapter = Bt.getAdapter;
|
|
2030
|
+
x.HttpStatusCode = Be;
|
|
2031
|
+
x.default = x;
|
|
2032
|
+
const {
|
|
2033
|
+
Axios: Gn,
|
|
2034
|
+
AxiosError: Jn,
|
|
2035
|
+
CanceledError: Wn,
|
|
2036
|
+
isCancel: Vn,
|
|
2037
|
+
CancelToken: Yn,
|
|
2038
|
+
VERSION: Xn,
|
|
2039
|
+
all: Kn,
|
|
2040
|
+
Cancel: Zn,
|
|
2041
|
+
isAxiosError: Qn,
|
|
2042
|
+
spread: es,
|
|
2043
|
+
toFormData: ts,
|
|
2044
|
+
AxiosHeaders: rs,
|
|
2045
|
+
HttpStatusCode: ns,
|
|
2046
|
+
formToJSON: ss,
|
|
2047
|
+
getAdapter: os,
|
|
2048
|
+
mergeConfig: is
|
|
2049
|
+
} = x, Ht = Wt(null), as = ({ children: e }) => {
|
|
2050
|
+
const [t, r] = M(
|
|
2051
|
+
localStorage.getItem("isLoggedIn") === "true"
|
|
2052
|
+
), n = () => {
|
|
2053
|
+
localStorage.setItem("isLoggedIn", "true"), r(!0);
|
|
2054
|
+
}, s = () => {
|
|
2055
|
+
localStorage.removeItem("isLoggedIn"), ue(null), r(!1);
|
|
2056
|
+
};
|
|
2057
|
+
return /* @__PURE__ */ w.jsx(Ht.Provider, { value: { isAuthenticated: t, login: n, logout: s }, children: e });
|
|
2058
|
+
}, Je = () => {
|
|
2059
|
+
const e = Vt(Ht);
|
|
2060
|
+
if (!e)
|
|
2061
|
+
throw new Error("useAuth must be used inside AuthProvider");
|
|
2062
|
+
return e;
|
|
2063
|
+
};
|
|
2064
|
+
async function zt() {
|
|
2065
|
+
try {
|
|
2066
|
+
const e = await x.post(
|
|
2067
|
+
X.refreshToken,
|
|
2068
|
+
{},
|
|
2069
|
+
{
|
|
2070
|
+
withCredentials: !0
|
|
2071
|
+
// Include cookies in the request
|
|
2072
|
+
}
|
|
2073
|
+
), t = e?.data?.accessToken || e?.data?.data?.accessToken;
|
|
2074
|
+
if (!t)
|
|
2075
|
+
throw new Error("Invalid refresh response");
|
|
2076
|
+
return t;
|
|
2077
|
+
} catch (e) {
|
|
2078
|
+
throw e;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
const J = x.create({
|
|
2082
|
+
withCredentials: !0
|
|
2083
|
+
});
|
|
2084
|
+
let ge = !1, $e = [];
|
|
2085
|
+
const dt = (e, t = null) => {
|
|
2086
|
+
$e.forEach((r) => {
|
|
2087
|
+
e ? r.reject(e) : r.resolve(t);
|
|
2088
|
+
}), $e = [];
|
|
2089
|
+
};
|
|
2090
|
+
J.interceptors.request.use(
|
|
2091
|
+
async (e) => {
|
|
2092
|
+
if (e.withCredentials = !0, e.url === X.login || e.url === X.register)
|
|
2093
|
+
return e.headers && "Authorization" in e.headers && delete e.headers.Authorization, e;
|
|
2094
|
+
const r = cr();
|
|
2095
|
+
if (r)
|
|
2096
|
+
return e.headers && (e.headers.Authorization = `Bearer ${r}`), e;
|
|
2097
|
+
try {
|
|
2098
|
+
const n = await zt();
|
|
2099
|
+
return ue(n), e.headers && (e.headers.Authorization = `Bearer ${n}`), e;
|
|
2100
|
+
} catch (n) {
|
|
2101
|
+
throw window.location.href = "/", sessionStorage.setItem(Te, qe), ue(null), localStorage.removeItem("isLoggedIn"), n;
|
|
2102
|
+
}
|
|
2103
|
+
},
|
|
2104
|
+
(e) => Promise.reject(e)
|
|
2105
|
+
);
|
|
2106
|
+
J.interceptors.response.use(
|
|
2107
|
+
(e) => e,
|
|
2108
|
+
async (e) => {
|
|
2109
|
+
const t = e.config;
|
|
2110
|
+
if (e.response?.status === 401 && !t._retry) {
|
|
2111
|
+
if (ge)
|
|
2112
|
+
return new Promise((r, n) => {
|
|
2113
|
+
$e.push({ resolve: r, reject: n });
|
|
2114
|
+
}).then((r) => (t.headers && (t.headers.Authorization = `Bearer ${r}`), J(t))).catch((r) => Promise.reject(r));
|
|
2115
|
+
t._retry = !0, ge = !0;
|
|
2116
|
+
try {
|
|
2117
|
+
const r = await zt();
|
|
2118
|
+
return ue(r), t.headers && (t.headers.Authorization = `Bearer ${r}`), dt(null, r), ge = !1, J(t);
|
|
2119
|
+
} catch (r) {
|
|
2120
|
+
return window.location.href = "/", sessionStorage.setItem(Te, qe), dt(r, null), ge = !1, Je().logout(), Promise.reject(r);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
return Promise.reject(e);
|
|
2124
|
+
}
|
|
2125
|
+
);
|
|
2126
|
+
const Gt = {
|
|
2127
|
+
MIN_LENGTH: 8,
|
|
2128
|
+
REGEX: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#])[A-Za-z\d@$!%*?&#]{8,}$/,
|
|
2129
|
+
ERROR_MESSAGE: "Password must be at least 8 characters long and include uppercase, lowercase, number, and special character."
|
|
2130
|
+
}, Bn = (e) => Gt.REGEX.test(e), cs = ({ onLoginSuccess: e }) => {
|
|
2131
|
+
const [t, r] = M(P.LOGIN), [n, s] = M({
|
|
2132
|
+
email: "",
|
|
2133
|
+
password: ""
|
|
2134
|
+
}), i = mt(), [o, c] = M(!1), [h, f] = M(""), [u, m] = M("");
|
|
2135
|
+
pt(() => {
|
|
2136
|
+
typeof window < "u" && sessionStorage.getItem(Te) === qe && (sessionStorage.removeItem(Te), f(rr), r(P.LOGIN));
|
|
2137
|
+
}, []);
|
|
2138
|
+
const g = (p) => {
|
|
2139
|
+
const { name: S, value: N } = p.target;
|
|
2140
|
+
s((A) => ({ ...A, [S]: N })), f("");
|
|
2141
|
+
}, T = async (p) => {
|
|
2142
|
+
p.preventDefault(), c(!0), f(""), m("");
|
|
2143
|
+
try {
|
|
2144
|
+
if (t === P.SIGNUP) {
|
|
2145
|
+
if (!Bn(n.password)) {
|
|
2146
|
+
f(Gt.ERROR_MESSAGE);
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
2149
|
+
await J.post(X.register, n), m(Zt), r(P.LOGIN), s({ email: n.email, password: "" });
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
const S = await J.post(X.login, n), { accessToken: N } = S.data;
|
|
2153
|
+
ue(N), localStorage.setItem("isLoggedIn", "true"), m(tr), e && e(), i("/profile");
|
|
2154
|
+
} catch (S) {
|
|
2155
|
+
const N = S?.response?.data?.message || (t === P.SIGNUP ? Qt : er);
|
|
2156
|
+
f(N);
|
|
2157
|
+
} finally {
|
|
2158
|
+
c(!1);
|
|
2159
|
+
}
|
|
2160
|
+
}, d = () => {
|
|
2161
|
+
r(P.SIGNUP), f(""), m("");
|
|
2162
|
+
}, b = () => {
|
|
2163
|
+
r(P.LOGIN), f(""), m("");
|
|
2164
|
+
};
|
|
2165
|
+
return /* @__PURE__ */ w.jsx("div", { className: "auth-container", children: /* @__PURE__ */ w.jsxs("div", { className: "auth-card", children: [
|
|
2166
|
+
/* @__PURE__ */ w.jsxs("div", { className: "mode-selector", children: [
|
|
2167
|
+
/* @__PURE__ */ w.jsx(
|
|
2168
|
+
"button",
|
|
2169
|
+
{
|
|
2170
|
+
className: t === P.LOGIN ? "active" : "",
|
|
2171
|
+
onClick: b,
|
|
2172
|
+
children: P.LOGIN
|
|
2173
|
+
}
|
|
2174
|
+
),
|
|
2175
|
+
/* @__PURE__ */ w.jsx(
|
|
2176
|
+
"button",
|
|
2177
|
+
{
|
|
2178
|
+
className: t === P.SIGNUP ? "active" : "",
|
|
2179
|
+
onClick: d,
|
|
2180
|
+
children: P.SIGNUP
|
|
2181
|
+
}
|
|
2182
|
+
)
|
|
2183
|
+
] }),
|
|
2184
|
+
/* @__PURE__ */ w.jsxs("form", { onSubmit: T, children: [
|
|
2185
|
+
t === P.LOGIN ? /* @__PURE__ */ w.jsx("h2", { children: P.LOGIN }) : /* @__PURE__ */ w.jsx("h2", { children: P.SIGNUP }),
|
|
2186
|
+
/* @__PURE__ */ w.jsxs("div", { className: "form-group", children: [
|
|
2187
|
+
/* @__PURE__ */ w.jsx("label", { htmlFor: "email", children: Et }),
|
|
2188
|
+
/* @__PURE__ */ w.jsx(
|
|
2189
|
+
"input",
|
|
2190
|
+
{
|
|
2191
|
+
type: "email",
|
|
2192
|
+
id: "email",
|
|
2193
|
+
name: "email",
|
|
2194
|
+
value: n.email,
|
|
2195
|
+
onChange: g,
|
|
2196
|
+
required: !0,
|
|
2197
|
+
placeholder: "Enter your email"
|
|
2198
|
+
}
|
|
2199
|
+
)
|
|
2200
|
+
] }),
|
|
2201
|
+
/* @__PURE__ */ w.jsxs("div", { className: "form-group", children: [
|
|
2202
|
+
/* @__PURE__ */ w.jsx("label", { htmlFor: "password", children: or }),
|
|
2203
|
+
/* @__PURE__ */ w.jsx(
|
|
2204
|
+
"input",
|
|
2205
|
+
{
|
|
2206
|
+
type: "password",
|
|
2207
|
+
id: "password",
|
|
2208
|
+
name: "password",
|
|
2209
|
+
value: n.password,
|
|
2210
|
+
onChange: g,
|
|
2211
|
+
required: !0,
|
|
2212
|
+
placeholder: "Enter your password"
|
|
2213
|
+
}
|
|
2214
|
+
)
|
|
2215
|
+
] }),
|
|
2216
|
+
h && /* @__PURE__ */ w.jsx("div", { className: "error-message", children: h }),
|
|
2217
|
+
u && /* @__PURE__ */ w.jsx("div", { className: "success-message", children: u }),
|
|
2218
|
+
/* @__PURE__ */ w.jsx("button", { type: "submit", className: "submit-btn", disabled: o, children: o ? t === P.LOGIN ? nr : sr : t === P.LOGIN ? P.LOGIN : P.SIGNUP })
|
|
2219
|
+
] })
|
|
2220
|
+
] }) });
|
|
2221
|
+
}, ls = ({ onLogout: e }) => {
|
|
2222
|
+
const [t, r] = ht.useState(null), [n, s] = M(!1), [i, o] = M(""), [c, h] = M(""), f = mt(), u = () => {
|
|
2223
|
+
J.post(X.logout).catch((m) => {
|
|
2224
|
+
console.error("Logout failed:", m);
|
|
2225
|
+
}), r(null), e(), f("/");
|
|
2226
|
+
};
|
|
2227
|
+
return pt(() => {
|
|
2228
|
+
(async () => {
|
|
2229
|
+
s(!0), o("");
|
|
2230
|
+
try {
|
|
2231
|
+
const g = await J.get(X.userDetails);
|
|
2232
|
+
r(g.data.data), h("User details fetched successfully");
|
|
2233
|
+
} catch (g) {
|
|
2234
|
+
o(g.response?.data?.message || "Failed to fetch user details");
|
|
2235
|
+
} finally {
|
|
2236
|
+
s(!1);
|
|
2237
|
+
}
|
|
2238
|
+
})();
|
|
2239
|
+
}, []), /* @__PURE__ */ w.jsx("div", { className: "auth-container", children: /* @__PURE__ */ w.jsxs("div", { className: "auth-card profile-view", children: [
|
|
2240
|
+
/* @__PURE__ */ w.jsx("h2", { children: "User Profile" }),
|
|
2241
|
+
n && /* @__PURE__ */ w.jsx("div", { className: "loading", children: "Loading user details..." }),
|
|
2242
|
+
/* @__PURE__ */ w.jsxs("div", { className: "user-details", children: [
|
|
2243
|
+
/* @__PURE__ */ w.jsxs("div", { className: "detail-row", children: [
|
|
2244
|
+
/* @__PURE__ */ w.jsxs("span", { className: "label", children: [
|
|
2245
|
+
ir,
|
|
2246
|
+
":"
|
|
2247
|
+
] }),
|
|
2248
|
+
/* @__PURE__ */ w.jsx("span", { className: "value", children: t?.userId })
|
|
2249
|
+
] }),
|
|
2250
|
+
/* @__PURE__ */ w.jsxs("div", { className: "detail-row", children: [
|
|
2251
|
+
/* @__PURE__ */ w.jsxs("span", { className: "label", children: [
|
|
2252
|
+
Et,
|
|
2253
|
+
":"
|
|
2254
|
+
] }),
|
|
2255
|
+
/* @__PURE__ */ w.jsx("span", { className: "value", children: t?.emailId })
|
|
2256
|
+
] })
|
|
2257
|
+
] }),
|
|
2258
|
+
i && /* @__PURE__ */ w.jsx("div", { className: "error-message", children: i }),
|
|
2259
|
+
c && /* @__PURE__ */ w.jsx("div", { className: "success-message", children: c }),
|
|
2260
|
+
/* @__PURE__ */ w.jsx("button", { className: "logout-btn", onClick: u, children: ar })
|
|
2261
|
+
] }) });
|
|
2262
|
+
}, us = ({
|
|
2263
|
+
children: e,
|
|
2264
|
+
redirectTo: t = "/"
|
|
2265
|
+
}) => {
|
|
2266
|
+
const { isAuthenticated: r } = Je();
|
|
2267
|
+
return r ? /* @__PURE__ */ w.jsx(w.Fragment, { children: e }) : /* @__PURE__ */ w.jsx(bt, { to: t, replace: !0 });
|
|
2268
|
+
}, fs = ({
|
|
2269
|
+
children: e,
|
|
2270
|
+
redirectTo: t = "/profile"
|
|
2271
|
+
}) => {
|
|
2272
|
+
const { isAuthenticated: r } = Je();
|
|
2273
|
+
return r ? /* @__PURE__ */ w.jsx(bt, { to: t, replace: !0 }) : /* @__PURE__ */ w.jsx(w.Fragment, { children: e });
|
|
2274
|
+
};
|
|
2275
|
+
export {
|
|
2276
|
+
ee as API_BASE_URL,
|
|
2277
|
+
cs as AuthForm,
|
|
2278
|
+
P as AuthMode,
|
|
2279
|
+
as as AuthProvider,
|
|
2280
|
+
Et as EMAIL_LABEL,
|
|
2281
|
+
er as LOGIN_FAILED,
|
|
2282
|
+
tr as LOGIN_SUCCESS,
|
|
2283
|
+
ar as LOGOUT_BUTTON,
|
|
2284
|
+
Mn as LOGOUT_SUCCESS,
|
|
2285
|
+
or as PASSWORD_LABEL,
|
|
2286
|
+
Gt as PASSWORD_VALIDATION,
|
|
2287
|
+
us as ProtectedRoute,
|
|
2288
|
+
fs as PublicRoute,
|
|
2289
|
+
Qt as REGISTRATION_FAILED,
|
|
2290
|
+
Zt as REGISTRATION_SUCCESS,
|
|
2291
|
+
rr as SESSION_EXPIRED,
|
|
2292
|
+
nr as SIGNING_IN,
|
|
2293
|
+
sr as SIGNING_UP,
|
|
2294
|
+
ir as USER_ID,
|
|
2295
|
+
ls as UserProfile,
|
|
2296
|
+
J as axiosInstance,
|
|
2297
|
+
X as endPoints,
|
|
2298
|
+
Te as sessionExpired,
|
|
2299
|
+
qe as sessionExpiredValue,
|
|
2300
|
+
Je as useAuth,
|
|
2301
|
+
Bn as validatePassword
|
|
2302
|
+
};
|