@odynn/awayz-core 0.2.32 → 0.3.0

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