@fuul/sdk 0.17.0 → 1.0.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/README.md +21 -26
  2. package/dist/constants.d.ts.map +1 -0
  3. package/dist/fuul-sdk.mjs +1569 -0
  4. package/dist/fuul-sdk.umd.js +3 -0
  5. package/dist/index.d.ts +36 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/{lib/cjs/types → dist}/infrastructure/conversions/conversionService.d.ts +2 -2
  8. package/dist/infrastructure/conversions/conversionService.d.ts.map +1 -0
  9. package/{lib/cjs/types → dist}/infrastructure/conversions/dtos.d.ts +4 -0
  10. package/dist/infrastructure/conversions/dtos.d.ts.map +1 -0
  11. package/{lib/cjs/types → dist}/infrastructure/http/HttpClient.d.ts +1 -1
  12. package/dist/infrastructure/http/HttpClient.d.ts.map +1 -0
  13. package/dist/types/index.d.ts +37 -0
  14. package/dist/types/index.d.ts.map +1 -0
  15. package/dist/utils/events.d.ts +4 -0
  16. package/dist/utils/events.d.ts.map +1 -0
  17. package/{lib/cjs/types → dist}/utils/localStorage.d.ts +5 -0
  18. package/dist/utils/localStorage.d.ts.map +1 -0
  19. package/dist/utils/queryParams.d.ts.map +1 -0
  20. package/package.json +55 -17
  21. package/lib/cjs/constants.js +0 -15
  22. package/lib/cjs/index.js +0 -247
  23. package/lib/cjs/infrastructure/conversions/conversionService.js +0 -24
  24. package/lib/cjs/infrastructure/conversions/dtos.js +0 -2
  25. package/lib/cjs/infrastructure/http/HttpClient.js +0 -51
  26. package/lib/cjs/types/constants.d.ts.map +0 -1
  27. package/lib/cjs/types/index.d.ts +0 -46
  28. package/lib/cjs/types/index.d.ts.map +0 -1
  29. package/lib/cjs/types/index.js +0 -2
  30. package/lib/cjs/types/infrastructure/conversions/conversionService.d.ts.map +0 -1
  31. package/lib/cjs/types/infrastructure/conversions/dtos.d.ts.map +0 -1
  32. package/lib/cjs/types/infrastructure/http/HttpClient.d.ts.map +0 -1
  33. package/lib/cjs/types/types/index.d.ts +0 -27
  34. package/lib/cjs/types/types/index.d.ts.map +0 -1
  35. package/lib/cjs/types/utils/localStorage.d.ts.map +0 -1
  36. package/lib/cjs/types/utils/queryParams.d.ts.map +0 -1
  37. package/lib/cjs/utils/localStorage.js +0 -20
  38. package/lib/cjs/utils/queryParams.js +0 -14
  39. package/lib/esm/constants.js +0 -12
  40. package/lib/esm/index.mjs +0 -243
  41. package/lib/esm/infrastructure/conversions/conversionService.js +0 -20
  42. package/lib/esm/infrastructure/conversions/dtos.js +0 -1
  43. package/lib/esm/infrastructure/http/HttpClient.js +0 -44
  44. package/lib/esm/types/constants.d.ts +0 -13
  45. package/lib/esm/types/constants.d.ts.map +0 -1
  46. package/lib/esm/types/index.d.ts +0 -46
  47. package/lib/esm/types/index.d.ts.map +0 -1
  48. package/lib/esm/types/index.js +0 -1
  49. package/lib/esm/types/infrastructure/conversions/conversionService.d.ts +0 -8
  50. package/lib/esm/types/infrastructure/conversions/conversionService.d.ts.map +0 -1
  51. package/lib/esm/types/infrastructure/conversions/dtos.d.ts +0 -33
  52. package/lib/esm/types/infrastructure/conversions/dtos.d.ts.map +0 -1
  53. package/lib/esm/types/infrastructure/http/HttpClient.d.ts +0 -27
  54. package/lib/esm/types/infrastructure/http/HttpClient.d.ts.map +0 -1
  55. package/lib/esm/types/types/index.d.ts +0 -27
  56. package/lib/esm/types/types/index.d.ts.map +0 -1
  57. package/lib/esm/types/utils/localStorage.d.ts +0 -9
  58. package/lib/esm/types/utils/localStorage.d.ts.map +0 -1
  59. package/lib/esm/types/utils/queryParams.d.ts +0 -2
  60. package/lib/esm/types/utils/queryParams.d.ts.map +0 -1
  61. package/lib/esm/utils/localStorage.js +0 -9
  62. package/lib/esm/utils/queryParams.js +0 -10
  63. /package/{lib/cjs/types → dist}/constants.d.ts +0 -0
  64. /package/{lib/cjs/types → dist}/utils/queryParams.d.ts +0 -0
@@ -0,0 +1,1569 @@
1
+ var Ve = Object.defineProperty;
2
+ var We = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var b = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ let Ye = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
5
+ const Se = "fuul.session_id", ge = "fuul.tracking_id", Re = "fuul.referrer_id", I = "fuul.traffic_source", M = "fuul.traffic_category", K = "fuul.traffic_title", be = "fuul.traffic_tag", Ge = "fuul.traffic_origin_url", Ae = "fuul.sent";
6
+ const Qe = ["google.com", "bing.com", "yahoo.com"], Xe = () => localStorage.getItem(Se), Oe = () => localStorage.getItem(ge), Ze = () => localStorage.getItem(Re), et = () => localStorage.getItem(I), tt = () => localStorage.getItem(M), nt = () => localStorage.getItem(K), rt = () => localStorage.getItem(be), F = typeof window > "u" || typeof document > "u", Te = () => Ye(), st = () => {
7
+ F || localStorage.setItem(Se, Te());
8
+ }, ot = () => {
9
+ F || Oe() || localStorage.setItem(ge, Te());
10
+ }, it = () => {
11
+ if (F)
12
+ return;
13
+ const e = new URLSearchParams(window.location.search);
14
+ localStorage.setItem(Re, e.get("referrer") ?? ""), localStorage.setItem(I, e.get("source") ?? ""), localStorage.setItem(M, e.get("category") ?? ""), localStorage.setItem(K, e.get("title") ?? ""), localStorage.setItem(be, e.get("tag") ?? ""), localStorage.setItem(Ge, document.referrer ?? ""), at();
15
+ }, at = () => {
16
+ const e = new URLSearchParams(window.location.search), t = e.get("source"), n = e.get("referrer");
17
+ if (!t)
18
+ if (n)
19
+ localStorage.setItem(I, "affiliate"), localStorage.setItem(M, "affiliate"), localStorage.setItem(K, n);
20
+ else {
21
+ const r = document.referrer;
22
+ localStorage.setItem(M, r), localStorage.setItem(K, r), Qe.includes(r) ? localStorage.setItem(I, "organic") : localStorage.setItem(I, "direct");
23
+ }
24
+ };
25
+ function _e(e, t) {
26
+ return function() {
27
+ return e.apply(t, arguments);
28
+ };
29
+ }
30
+ const { toString: Pe } = Object.prototype, { getPrototypeOf: ne } = Object, re = ((e) => (t) => {
31
+ const n = Pe.call(t);
32
+ return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
33
+ })(/* @__PURE__ */ Object.create(null)), O = (e) => (e = e.toLowerCase(), (t) => re(t) === e), $ = (e) => (t) => typeof t === e, { isArray: C } = Array, D = $("undefined");
34
+ function ct(e) {
35
+ return e !== null && !D(e) && e.constructor !== null && !D(e.constructor) && _(e.constructor.isBuffer) && e.constructor.isBuffer(e);
36
+ }
37
+ const Ne = O("ArrayBuffer");
38
+ function ut(e) {
39
+ let t;
40
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ne(e.buffer), t;
41
+ }
42
+ const lt = $("string"), _ = $("function"), Ce = $("number"), se = (e) => e !== null && typeof e == "object", ft = (e) => e === !0 || e === !1, k = (e) => {
43
+ if (re(e) !== "object")
44
+ return !1;
45
+ const t = ne(e);
46
+ return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
47
+ }, dt = O("Date"), ht = O("File"), pt = O("Blob"), mt = O("FileList"), yt = (e) => se(e) && _(e.pipe), Et = (e) => {
48
+ const t = "[object FormData]";
49
+ return e && (typeof FormData == "function" && e instanceof FormData || Pe.call(e) === t || _(e.toString) && e.toString() === t);
50
+ }, wt = O("URLSearchParams"), St = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
51
+ function L(e, t, { allOwnKeys: n = !1 } = {}) {
52
+ if (e === null || typeof e > "u")
53
+ return;
54
+ let r, s;
55
+ if (typeof e != "object" && (e = [e]), C(e))
56
+ for (r = 0, s = e.length; r < s; r++)
57
+ t.call(null, e[r], r, e);
58
+ else {
59
+ const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
60
+ let u;
61
+ for (r = 0; r < i; r++)
62
+ u = o[r], t.call(null, e[u], u, e);
63
+ }
64
+ }
65
+ function xe(e, t) {
66
+ t = t.toLowerCase();
67
+ const n = Object.keys(e);
68
+ let r = n.length, s;
69
+ for (; r-- > 0; )
70
+ if (s = n[r], t === s.toLowerCase())
71
+ return s;
72
+ return null;
73
+ }
74
+ const Ie = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), Fe = (e) => !D(e) && e !== Ie;
75
+ function X() {
76
+ const { caseless: e } = Fe(this) && this || {}, t = {}, n = (r, s) => {
77
+ const o = e && xe(t, s) || s;
78
+ k(t[o]) && k(r) ? t[o] = X(t[o], r) : k(r) ? t[o] = X({}, r) : C(r) ? t[o] = r.slice() : t[o] = r;
79
+ };
80
+ for (let r = 0, s = arguments.length; r < s; r++)
81
+ arguments[r] && L(arguments[r], n);
82
+ return t;
83
+ }
84
+ const gt = (e, t, n, { allOwnKeys: r } = {}) => (L(t, (s, o) => {
85
+ n && _(s) ? e[o] = _e(s, n) : e[o] = s;
86
+ }, { allOwnKeys: r }), e), Rt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), bt = (e, t, n, r) => {
87
+ e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
88
+ value: t.prototype
89
+ }), n && Object.assign(e.prototype, n);
90
+ }, At = (e, t, n, r) => {
91
+ let s, o, i;
92
+ const u = {};
93
+ if (t = t || {}, e == null)
94
+ return t;
95
+ do {
96
+ for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
97
+ i = s[o], (!r || r(i, e, t)) && !u[i] && (t[i] = e[i], u[i] = !0);
98
+ e = n !== !1 && ne(e);
99
+ } while (e && (!n || n(e, t)) && e !== Object.prototype);
100
+ return t;
101
+ }, Ot = (e, t, n) => {
102
+ e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
103
+ const r = e.indexOf(t, n);
104
+ return r !== -1 && r === n;
105
+ }, Tt = (e) => {
106
+ if (!e)
107
+ return null;
108
+ if (C(e))
109
+ return e;
110
+ let t = e.length;
111
+ if (!Ce(t))
112
+ return null;
113
+ const n = new Array(t);
114
+ for (; t-- > 0; )
115
+ n[t] = e[t];
116
+ return n;
117
+ }, _t = ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ne(Uint8Array)), Pt = (e, t) => {
118
+ const r = (e && e[Symbol.iterator]).call(e);
119
+ let s;
120
+ for (; (s = r.next()) && !s.done; ) {
121
+ const o = s.value;
122
+ t.call(e, o[0], o[1]);
123
+ }
124
+ }, Nt = (e, t) => {
125
+ let n;
126
+ const r = [];
127
+ for (; (n = e.exec(t)) !== null; )
128
+ r.push(n);
129
+ return r;
130
+ }, Ct = O("HTMLFormElement"), xt = (e) => e.toLowerCase().replace(
131
+ /[-_\s]([a-z\d])(\w*)/g,
132
+ function(n, r, s) {
133
+ return r.toUpperCase() + s;
134
+ }
135
+ ), ue = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), It = O("RegExp"), De = (e, t) => {
136
+ const n = Object.getOwnPropertyDescriptors(e), r = {};
137
+ L(n, (s, o) => {
138
+ t(s, o, e) !== !1 && (r[o] = s);
139
+ }), Object.defineProperties(e, r);
140
+ }, Ft = (e) => {
141
+ De(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
+ }, Dt = (e, t) => {
156
+ const n = {}, r = (s) => {
157
+ s.forEach((o) => {
158
+ n[o] = !0;
159
+ });
160
+ };
161
+ return C(e) ? r(e) : r(String(e).split(t)), n;
162
+ }, Lt = () => {
163
+ }, Ut = (e, t) => (e = +e, Number.isFinite(e) ? e : t), W = "abcdefghijklmnopqrstuvwxyz", le = "0123456789", Le = {
164
+ DIGIT: le,
165
+ ALPHA: W,
166
+ ALPHA_DIGIT: W + W.toUpperCase() + le
167
+ }, Bt = (e = 16, t = Le.ALPHA_DIGIT) => {
168
+ let n = "";
169
+ const { length: r } = t;
170
+ for (; e--; )
171
+ n += t[Math.random() * r | 0];
172
+ return n;
173
+ };
174
+ function kt(e) {
175
+ return !!(e && _(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
176
+ }
177
+ const jt = (e) => {
178
+ const t = new Array(10), n = (r, s) => {
179
+ if (se(r)) {
180
+ if (t.indexOf(r) >= 0)
181
+ return;
182
+ if (!("toJSON" in r)) {
183
+ t[s] = r;
184
+ const o = C(r) ? [] : {};
185
+ return L(r, (i, u) => {
186
+ const d = n(i, s + 1);
187
+ !D(d) && (o[u] = d);
188
+ }), t[s] = void 0, o;
189
+ }
190
+ }
191
+ return r;
192
+ };
193
+ return n(e, 0);
194
+ }, a = {
195
+ isArray: C,
196
+ isArrayBuffer: Ne,
197
+ isBuffer: ct,
198
+ isFormData: Et,
199
+ isArrayBufferView: ut,
200
+ isString: lt,
201
+ isNumber: Ce,
202
+ isBoolean: ft,
203
+ isObject: se,
204
+ isPlainObject: k,
205
+ isUndefined: D,
206
+ isDate: dt,
207
+ isFile: ht,
208
+ isBlob: pt,
209
+ isRegExp: It,
210
+ isFunction: _,
211
+ isStream: yt,
212
+ isURLSearchParams: wt,
213
+ isTypedArray: _t,
214
+ isFileList: mt,
215
+ forEach: L,
216
+ merge: X,
217
+ extend: gt,
218
+ trim: St,
219
+ stripBOM: Rt,
220
+ inherits: bt,
221
+ toFlatObject: At,
222
+ kindOf: re,
223
+ kindOfTest: O,
224
+ endsWith: Ot,
225
+ toArray: Tt,
226
+ forEachEntry: Pt,
227
+ matchAll: Nt,
228
+ isHTMLForm: Ct,
229
+ hasOwnProperty: ue,
230
+ hasOwnProp: ue,
231
+ // an alias to avoid ESLint no-prototype-builtins detection
232
+ reduceDescriptors: De,
233
+ freezeMethods: Ft,
234
+ toObjectSet: Dt,
235
+ toCamelCase: xt,
236
+ noop: Lt,
237
+ toFiniteNumber: Ut,
238
+ findKey: xe,
239
+ global: Ie,
240
+ isContextDefined: Fe,
241
+ ALPHABET: Le,
242
+ generateString: Bt,
243
+ isSpecCompliantForm: kt,
244
+ toJSONObject: jt
245
+ };
246
+ function m(e, t, n, r, s) {
247
+ 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);
248
+ }
249
+ a.inherits(m, Error, {
250
+ toJSON: function() {
251
+ return {
252
+ // Standard
253
+ message: this.message,
254
+ name: this.name,
255
+ // Microsoft
256
+ description: this.description,
257
+ number: this.number,
258
+ // Mozilla
259
+ fileName: this.fileName,
260
+ lineNumber: this.lineNumber,
261
+ columnNumber: this.columnNumber,
262
+ stack: this.stack,
263
+ // Axios
264
+ config: a.toJSONObject(this.config),
265
+ code: this.code,
266
+ status: this.response && this.response.status ? this.response.status : null
267
+ };
268
+ }
269
+ });
270
+ const Ue = m.prototype, Be = {};
271
+ [
272
+ "ERR_BAD_OPTION_VALUE",
273
+ "ERR_BAD_OPTION",
274
+ "ECONNABORTED",
275
+ "ETIMEDOUT",
276
+ "ERR_NETWORK",
277
+ "ERR_FR_TOO_MANY_REDIRECTS",
278
+ "ERR_DEPRECATED",
279
+ "ERR_BAD_RESPONSE",
280
+ "ERR_BAD_REQUEST",
281
+ "ERR_CANCELED",
282
+ "ERR_NOT_SUPPORT",
283
+ "ERR_INVALID_URL"
284
+ // eslint-disable-next-line func-names
285
+ ].forEach((e) => {
286
+ Be[e] = { value: e };
287
+ });
288
+ Object.defineProperties(m, Be);
289
+ Object.defineProperty(Ue, "isAxiosError", { value: !0 });
290
+ m.from = (e, t, n, r, s, o) => {
291
+ const i = Object.create(Ue);
292
+ return a.toFlatObject(e, i, function(d) {
293
+ return d !== Error.prototype;
294
+ }, (u) => u !== "isAxiosError"), m.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
295
+ };
296
+ const qt = null;
297
+ function Z(e) {
298
+ return a.isPlainObject(e) || a.isArray(e);
299
+ }
300
+ function ke(e) {
301
+ return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
302
+ }
303
+ function fe(e, t, n) {
304
+ return e ? e.concat(t).map(function(s, o) {
305
+ return s = ke(s), !n && o ? "[" + s + "]" : s;
306
+ }).join(n ? "." : "") : t;
307
+ }
308
+ function Ht(e) {
309
+ return a.isArray(e) && !e.some(Z);
310
+ }
311
+ const Mt = a.toFlatObject(a, {}, null, function(t) {
312
+ return /^is[A-Z]/.test(t);
313
+ });
314
+ function z(e, t, n) {
315
+ if (!a.isObject(e))
316
+ throw new TypeError("target must be an object");
317
+ t = t || new FormData(), n = a.toFlatObject(n, {
318
+ metaTokens: !0,
319
+ dots: !1,
320
+ indexes: !1
321
+ }, !1, function(p, R) {
322
+ return !a.isUndefined(R[p]);
323
+ });
324
+ const r = n.metaTokens, s = n.visitor || l, o = n.dots, i = n.indexes, d = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
325
+ if (!a.isFunction(s))
326
+ throw new TypeError("visitor must be a function");
327
+ function c(f) {
328
+ if (f === null)
329
+ return "";
330
+ if (a.isDate(f))
331
+ return f.toISOString();
332
+ if (!d && a.isBlob(f))
333
+ throw new m("Blob is not supported. Use a Buffer instead.");
334
+ return a.isArrayBuffer(f) || a.isTypedArray(f) ? d && typeof Blob == "function" ? new Blob([f]) : Buffer.from(f) : f;
335
+ }
336
+ function l(f, p, R) {
337
+ let S = f;
338
+ if (f && !R && typeof f == "object") {
339
+ if (a.endsWith(p, "{}"))
340
+ p = r ? p : p.slice(0, -2), f = JSON.stringify(f);
341
+ else if (a.isArray(f) && Ht(f) || (a.isFileList(f) || a.endsWith(p, "[]")) && (S = a.toArray(f)))
342
+ return p = ke(p), S.forEach(function(B, Je) {
343
+ !(a.isUndefined(B) || B === null) && t.append(
344
+ // eslint-disable-next-line no-nested-ternary
345
+ i === !0 ? fe([p], Je, o) : i === null ? p : p + "[]",
346
+ c(B)
347
+ );
348
+ }), !1;
349
+ }
350
+ return Z(f) ? !0 : (t.append(fe(R, p, o), c(f)), !1);
351
+ }
352
+ const h = [], E = Object.assign(Mt, {
353
+ defaultVisitor: l,
354
+ convertValue: c,
355
+ isVisitable: Z
356
+ });
357
+ function y(f, p) {
358
+ if (!a.isUndefined(f)) {
359
+ if (h.indexOf(f) !== -1)
360
+ throw Error("Circular reference detected in " + p.join("."));
361
+ h.push(f), a.forEach(f, function(S, P) {
362
+ (!(a.isUndefined(S) || S === null) && s.call(
363
+ t,
364
+ S,
365
+ a.isString(P) ? P.trim() : P,
366
+ p,
367
+ E
368
+ )) === !0 && y(S, p ? p.concat(P) : [P]);
369
+ }), h.pop();
370
+ }
371
+ }
372
+ if (!a.isObject(e))
373
+ throw new TypeError("data must be an object");
374
+ return y(e), t;
375
+ }
376
+ function de(e) {
377
+ const t = {
378
+ "!": "%21",
379
+ "'": "%27",
380
+ "(": "%28",
381
+ ")": "%29",
382
+ "~": "%7E",
383
+ "%20": "+",
384
+ "%00": "\0"
385
+ };
386
+ return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
387
+ return t[r];
388
+ });
389
+ }
390
+ function oe(e, t) {
391
+ this._pairs = [], e && z(e, this, t);
392
+ }
393
+ const je = oe.prototype;
394
+ je.append = function(t, n) {
395
+ this._pairs.push([t, n]);
396
+ };
397
+ je.toString = function(t) {
398
+ const n = t ? function(r) {
399
+ return t.call(this, r, de);
400
+ } : de;
401
+ return this._pairs.map(function(s) {
402
+ return n(s[0]) + "=" + n(s[1]);
403
+ }, "").join("&");
404
+ };
405
+ function Kt(e) {
406
+ return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
407
+ }
408
+ function qe(e, t, n) {
409
+ if (!t)
410
+ return e;
411
+ const r = n && n.encode || Kt, s = n && n.serialize;
412
+ let o;
413
+ if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new oe(t, n).toString(r), o) {
414
+ const i = e.indexOf("#");
415
+ i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
416
+ }
417
+ return e;
418
+ }
419
+ class vt {
420
+ constructor() {
421
+ this.handlers = [];
422
+ }
423
+ /**
424
+ * Add a new interceptor to the stack
425
+ *
426
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
427
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
428
+ *
429
+ * @return {Number} An ID used to remove interceptor later
430
+ */
431
+ use(t, n, r) {
432
+ return this.handlers.push({
433
+ fulfilled: t,
434
+ rejected: n,
435
+ synchronous: r ? r.synchronous : !1,
436
+ runWhen: r ? r.runWhen : null
437
+ }), this.handlers.length - 1;
438
+ }
439
+ /**
440
+ * Remove an interceptor from the stack
441
+ *
442
+ * @param {Number} id The ID that was returned by `use`
443
+ *
444
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
445
+ */
446
+ eject(t) {
447
+ this.handlers[t] && (this.handlers[t] = null);
448
+ }
449
+ /**
450
+ * Clear all interceptors from the stack
451
+ *
452
+ * @returns {void}
453
+ */
454
+ clear() {
455
+ this.handlers && (this.handlers = []);
456
+ }
457
+ /**
458
+ * Iterate over all the registered interceptors
459
+ *
460
+ * This method is particularly useful for skipping over any
461
+ * interceptors that may have become `null` calling `eject`.
462
+ *
463
+ * @param {Function} fn The function to call for each interceptor
464
+ *
465
+ * @returns {void}
466
+ */
467
+ forEach(t) {
468
+ a.forEach(this.handlers, function(r) {
469
+ r !== null && t(r);
470
+ });
471
+ }
472
+ }
473
+ const he = vt, He = {
474
+ silentJSONParsing: !0,
475
+ forcedJSONParsing: !0,
476
+ clarifyTimeoutError: !1
477
+ }, $t = typeof URLSearchParams < "u" ? URLSearchParams : oe, zt = typeof FormData < "u" ? FormData : null, Jt = typeof Blob < "u" ? Blob : null, Vt = (() => {
478
+ let e;
479
+ return typeof navigator < "u" && ((e = navigator.product) === "ReactNative" || e === "NativeScript" || e === "NS") ? !1 : typeof window < "u" && typeof document < "u";
480
+ })(), Wt = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
481
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), g = {
482
+ isBrowser: !0,
483
+ classes: {
484
+ URLSearchParams: $t,
485
+ FormData: zt,
486
+ Blob: Jt
487
+ },
488
+ isStandardBrowserEnv: Vt,
489
+ isStandardBrowserWebWorkerEnv: Wt,
490
+ protocols: ["http", "https", "file", "blob", "url", "data"]
491
+ };
492
+ function Yt(e, t) {
493
+ return z(e, new g.classes.URLSearchParams(), Object.assign({
494
+ visitor: function(n, r, s, o) {
495
+ return g.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
496
+ }
497
+ }, t));
498
+ }
499
+ function Gt(e) {
500
+ return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
501
+ }
502
+ function Qt(e) {
503
+ const t = {}, n = Object.keys(e);
504
+ let r;
505
+ const s = n.length;
506
+ let o;
507
+ for (r = 0; r < s; r++)
508
+ o = n[r], t[o] = e[o];
509
+ return t;
510
+ }
511
+ function Me(e) {
512
+ function t(n, r, s, o) {
513
+ let i = n[o++];
514
+ const u = Number.isFinite(+i), d = o >= n.length;
515
+ return i = !i && a.isArray(s) ? s.length : i, d ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !u) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = Qt(s[i])), !u);
516
+ }
517
+ if (a.isFormData(e) && a.isFunction(e.entries)) {
518
+ const n = {};
519
+ return a.forEachEntry(e, (r, s) => {
520
+ t(Gt(r), s, n, 0);
521
+ }), n;
522
+ }
523
+ return null;
524
+ }
525
+ const Xt = {
526
+ "Content-Type": void 0
527
+ };
528
+ function Zt(e, t, n) {
529
+ if (a.isString(e))
530
+ try {
531
+ return (t || JSON.parse)(e), a.trim(e);
532
+ } catch (r) {
533
+ if (r.name !== "SyntaxError")
534
+ throw r;
535
+ }
536
+ return (n || JSON.stringify)(e);
537
+ }
538
+ const J = {
539
+ transitional: He,
540
+ adapter: ["xhr", "http"],
541
+ transformRequest: [function(t, n) {
542
+ const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = a.isObject(t);
543
+ if (o && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
544
+ return s && s ? JSON.stringify(Me(t)) : t;
545
+ if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t))
546
+ return t;
547
+ if (a.isArrayBufferView(t))
548
+ return t.buffer;
549
+ if (a.isURLSearchParams(t))
550
+ return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
551
+ let u;
552
+ if (o) {
553
+ if (r.indexOf("application/x-www-form-urlencoded") > -1)
554
+ return Yt(t, this.formSerializer).toString();
555
+ if ((u = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
556
+ const d = this.env && this.env.FormData;
557
+ return z(
558
+ u ? { "files[]": t } : t,
559
+ d && new d(),
560
+ this.formSerializer
561
+ );
562
+ }
563
+ }
564
+ return o || s ? (n.setContentType("application/json", !1), Zt(t)) : t;
565
+ }],
566
+ transformResponse: [function(t) {
567
+ const n = this.transitional || J.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
568
+ if (t && a.isString(t) && (r && !this.responseType || s)) {
569
+ const i = !(n && n.silentJSONParsing) && s;
570
+ try {
571
+ return JSON.parse(t);
572
+ } catch (u) {
573
+ if (i)
574
+ throw u.name === "SyntaxError" ? m.from(u, m.ERR_BAD_RESPONSE, this, null, this.response) : u;
575
+ }
576
+ }
577
+ return t;
578
+ }],
579
+ /**
580
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
581
+ * timeout is not created.
582
+ */
583
+ timeout: 0,
584
+ xsrfCookieName: "XSRF-TOKEN",
585
+ xsrfHeaderName: "X-XSRF-TOKEN",
586
+ maxContentLength: -1,
587
+ maxBodyLength: -1,
588
+ env: {
589
+ FormData: g.classes.FormData,
590
+ Blob: g.classes.Blob
591
+ },
592
+ validateStatus: function(t) {
593
+ return t >= 200 && t < 300;
594
+ },
595
+ headers: {
596
+ common: {
597
+ Accept: "application/json, text/plain, */*"
598
+ }
599
+ }
600
+ };
601
+ a.forEach(["delete", "get", "head"], function(t) {
602
+ J.headers[t] = {};
603
+ });
604
+ a.forEach(["post", "put", "patch"], function(t) {
605
+ J.headers[t] = a.merge(Xt);
606
+ });
607
+ const ie = J, en = a.toObjectSet([
608
+ "age",
609
+ "authorization",
610
+ "content-length",
611
+ "content-type",
612
+ "etag",
613
+ "expires",
614
+ "from",
615
+ "host",
616
+ "if-modified-since",
617
+ "if-unmodified-since",
618
+ "last-modified",
619
+ "location",
620
+ "max-forwards",
621
+ "proxy-authorization",
622
+ "referer",
623
+ "retry-after",
624
+ "user-agent"
625
+ ]), tn = (e) => {
626
+ const t = {};
627
+ let n, r, s;
628
+ return e && e.split(`
629
+ `).forEach(function(i) {
630
+ s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && en[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
631
+ }), t;
632
+ }, pe = Symbol("internals");
633
+ function x(e) {
634
+ return e && String(e).trim().toLowerCase();
635
+ }
636
+ function j(e) {
637
+ return e === !1 || e == null ? e : a.isArray(e) ? e.map(j) : String(e);
638
+ }
639
+ function nn(e) {
640
+ const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
641
+ let r;
642
+ for (; r = n.exec(e); )
643
+ t[r[1]] = r[2];
644
+ return t;
645
+ }
646
+ function rn(e) {
647
+ return /^[-_a-zA-Z]+$/.test(e.trim());
648
+ }
649
+ function Y(e, t, n, r, s) {
650
+ if (a.isFunction(r))
651
+ return r.call(this, t, n);
652
+ if (s && (t = n), !!a.isString(t)) {
653
+ if (a.isString(r))
654
+ return t.indexOf(r) !== -1;
655
+ if (a.isRegExp(r))
656
+ return r.test(t);
657
+ }
658
+ }
659
+ function sn(e) {
660
+ return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
661
+ }
662
+ function on(e, t) {
663
+ const n = a.toCamelCase(" " + t);
664
+ ["get", "set", "has"].forEach((r) => {
665
+ Object.defineProperty(e, r + n, {
666
+ value: function(s, o, i) {
667
+ return this[r].call(this, t, s, o, i);
668
+ },
669
+ configurable: !0
670
+ });
671
+ });
672
+ }
673
+ class V {
674
+ constructor(t) {
675
+ t && this.set(t);
676
+ }
677
+ set(t, n, r) {
678
+ const s = this;
679
+ function o(u, d, c) {
680
+ const l = x(d);
681
+ if (!l)
682
+ throw new Error("header name must be a non-empty string");
683
+ const h = a.findKey(s, l);
684
+ (!h || s[h] === void 0 || c === !0 || c === void 0 && s[h] !== !1) && (s[h || d] = j(u));
685
+ }
686
+ const i = (u, d) => a.forEach(u, (c, l) => o(c, l, d));
687
+ return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !rn(t) ? i(tn(t), n) : t != null && o(n, t, r), this;
688
+ }
689
+ get(t, n) {
690
+ if (t = x(t), t) {
691
+ const r = a.findKey(this, t);
692
+ if (r) {
693
+ const s = this[r];
694
+ if (!n)
695
+ return s;
696
+ if (n === !0)
697
+ return nn(s);
698
+ if (a.isFunction(n))
699
+ return n.call(this, s, r);
700
+ if (a.isRegExp(n))
701
+ return n.exec(s);
702
+ throw new TypeError("parser must be boolean|regexp|function");
703
+ }
704
+ }
705
+ }
706
+ has(t, n) {
707
+ if (t = x(t), t) {
708
+ const r = a.findKey(this, t);
709
+ return !!(r && this[r] !== void 0 && (!n || Y(this, this[r], r, n)));
710
+ }
711
+ return !1;
712
+ }
713
+ delete(t, n) {
714
+ const r = this;
715
+ let s = !1;
716
+ function o(i) {
717
+ if (i = x(i), i) {
718
+ const u = a.findKey(r, i);
719
+ u && (!n || Y(r, r[u], u, n)) && (delete r[u], s = !0);
720
+ }
721
+ }
722
+ return a.isArray(t) ? t.forEach(o) : o(t), s;
723
+ }
724
+ clear(t) {
725
+ const n = Object.keys(this);
726
+ let r = n.length, s = !1;
727
+ for (; r--; ) {
728
+ const o = n[r];
729
+ (!t || Y(this, this[o], o, t, !0)) && (delete this[o], s = !0);
730
+ }
731
+ return s;
732
+ }
733
+ normalize(t) {
734
+ const n = this, r = {};
735
+ return a.forEach(this, (s, o) => {
736
+ const i = a.findKey(r, o);
737
+ if (i) {
738
+ n[i] = j(s), delete n[o];
739
+ return;
740
+ }
741
+ const u = t ? sn(o) : String(o).trim();
742
+ u !== o && delete n[o], n[u] = j(s), r[u] = !0;
743
+ }), this;
744
+ }
745
+ concat(...t) {
746
+ return this.constructor.concat(this, ...t);
747
+ }
748
+ toJSON(t) {
749
+ const n = /* @__PURE__ */ Object.create(null);
750
+ return a.forEach(this, (r, s) => {
751
+ r != null && r !== !1 && (n[s] = t && a.isArray(r) ? r.join(", ") : r);
752
+ }), n;
753
+ }
754
+ [Symbol.iterator]() {
755
+ return Object.entries(this.toJSON())[Symbol.iterator]();
756
+ }
757
+ toString() {
758
+ return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
759
+ `);
760
+ }
761
+ get [Symbol.toStringTag]() {
762
+ return "AxiosHeaders";
763
+ }
764
+ static from(t) {
765
+ return t instanceof this ? t : new this(t);
766
+ }
767
+ static concat(t, ...n) {
768
+ const r = new this(t);
769
+ return n.forEach((s) => r.set(s)), r;
770
+ }
771
+ static accessor(t) {
772
+ const r = (this[pe] = this[pe] = {
773
+ accessors: {}
774
+ }).accessors, s = this.prototype;
775
+ function o(i) {
776
+ const u = x(i);
777
+ r[u] || (on(s, i), r[u] = !0);
778
+ }
779
+ return a.isArray(t) ? t.forEach(o) : o(t), this;
780
+ }
781
+ }
782
+ V.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
783
+ a.freezeMethods(V.prototype);
784
+ a.freezeMethods(V);
785
+ const A = V;
786
+ function G(e, t) {
787
+ const n = this || ie, r = t || n, s = A.from(r.headers);
788
+ let o = r.data;
789
+ return a.forEach(e, function(u) {
790
+ o = u.call(n, o, s.normalize(), t ? t.status : void 0);
791
+ }), s.normalize(), o;
792
+ }
793
+ function Ke(e) {
794
+ return !!(e && e.__CANCEL__);
795
+ }
796
+ function U(e, t, n) {
797
+ m.call(this, e ?? "canceled", m.ERR_CANCELED, t, n), this.name = "CanceledError";
798
+ }
799
+ a.inherits(U, m, {
800
+ __CANCEL__: !0
801
+ });
802
+ function an(e, t, n) {
803
+ const r = n.config.validateStatus;
804
+ !n.status || !r || r(n.status) ? e(n) : t(new m(
805
+ "Request failed with status code " + n.status,
806
+ [m.ERR_BAD_REQUEST, m.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
807
+ n.config,
808
+ n.request,
809
+ n
810
+ ));
811
+ }
812
+ const cn = g.isStandardBrowserEnv ? (
813
+ // Standard browser envs support document.cookie
814
+ function() {
815
+ return {
816
+ write: function(n, r, s, o, i, u) {
817
+ const d = [];
818
+ d.push(n + "=" + encodeURIComponent(r)), a.isNumber(s) && d.push("expires=" + new Date(s).toGMTString()), a.isString(o) && d.push("path=" + o), a.isString(i) && d.push("domain=" + i), u === !0 && d.push("secure"), document.cookie = d.join("; ");
819
+ },
820
+ read: function(n) {
821
+ const r = document.cookie.match(new RegExp("(^|;\\s*)(" + n + ")=([^;]*)"));
822
+ return r ? decodeURIComponent(r[3]) : null;
823
+ },
824
+ remove: function(n) {
825
+ this.write(n, "", Date.now() - 864e5);
826
+ }
827
+ };
828
+ }()
829
+ ) : (
830
+ // Non standard browser env (web workers, react-native) lack needed support.
831
+ function() {
832
+ return {
833
+ write: function() {
834
+ },
835
+ read: function() {
836
+ return null;
837
+ },
838
+ remove: function() {
839
+ }
840
+ };
841
+ }()
842
+ );
843
+ function un(e) {
844
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
845
+ }
846
+ function ln(e, t) {
847
+ return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
848
+ }
849
+ function ve(e, t) {
850
+ return e && !un(t) ? ln(e, t) : t;
851
+ }
852
+ const fn = g.isStandardBrowserEnv ? (
853
+ // Standard browser envs have full support of the APIs needed to test
854
+ // whether the request URL is of the same origin as current location.
855
+ function() {
856
+ const t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
857
+ let r;
858
+ function s(o) {
859
+ let i = o;
860
+ return t && (n.setAttribute("href", i), i = n.href), n.setAttribute("href", i), {
861
+ href: n.href,
862
+ protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
863
+ host: n.host,
864
+ search: n.search ? n.search.replace(/^\?/, "") : "",
865
+ hash: n.hash ? n.hash.replace(/^#/, "") : "",
866
+ hostname: n.hostname,
867
+ port: n.port,
868
+ pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
869
+ };
870
+ }
871
+ return r = s(window.location.href), function(i) {
872
+ const u = a.isString(i) ? s(i) : i;
873
+ return u.protocol === r.protocol && u.host === r.host;
874
+ };
875
+ }()
876
+ ) : (
877
+ // Non standard browser envs (web workers, react-native) lack needed support.
878
+ function() {
879
+ return function() {
880
+ return !0;
881
+ };
882
+ }()
883
+ );
884
+ function dn(e) {
885
+ const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
886
+ return t && t[1] || "";
887
+ }
888
+ function hn(e, t) {
889
+ e = e || 10;
890
+ const n = new Array(e), r = new Array(e);
891
+ let s = 0, o = 0, i;
892
+ return t = t !== void 0 ? t : 1e3, function(d) {
893
+ const c = Date.now(), l = r[o];
894
+ i || (i = c), n[s] = d, r[s] = c;
895
+ let h = o, E = 0;
896
+ for (; h !== s; )
897
+ E += n[h++], h = h % e;
898
+ if (s = (s + 1) % e, s === o && (o = (o + 1) % e), c - i < t)
899
+ return;
900
+ const y = l && c - l;
901
+ return y ? Math.round(E * 1e3 / y) : void 0;
902
+ };
903
+ }
904
+ function me(e, t) {
905
+ let n = 0;
906
+ const r = hn(50, 250);
907
+ return (s) => {
908
+ const o = s.loaded, i = s.lengthComputable ? s.total : void 0, u = o - n, d = r(u), c = o <= i;
909
+ n = o;
910
+ const l = {
911
+ loaded: o,
912
+ total: i,
913
+ progress: i ? o / i : void 0,
914
+ bytes: u,
915
+ rate: d || void 0,
916
+ estimated: d && i && c ? (i - o) / d : void 0,
917
+ event: s
918
+ };
919
+ l[t ? "download" : "upload"] = !0, e(l);
920
+ };
921
+ }
922
+ const pn = typeof XMLHttpRequest < "u", mn = pn && function(e) {
923
+ return new Promise(function(n, r) {
924
+ let s = e.data;
925
+ const o = A.from(e.headers).normalize(), i = e.responseType;
926
+ let u;
927
+ function d() {
928
+ e.cancelToken && e.cancelToken.unsubscribe(u), e.signal && e.signal.removeEventListener("abort", u);
929
+ }
930
+ a.isFormData(s) && (g.isStandardBrowserEnv || g.isStandardBrowserWebWorkerEnv) && o.setContentType(!1);
931
+ let c = new XMLHttpRequest();
932
+ if (e.auth) {
933
+ const y = e.auth.username || "", f = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
934
+ o.set("Authorization", "Basic " + btoa(y + ":" + f));
935
+ }
936
+ const l = ve(e.baseURL, e.url);
937
+ c.open(e.method.toUpperCase(), qe(l, e.params, e.paramsSerializer), !0), c.timeout = e.timeout;
938
+ function h() {
939
+ if (!c)
940
+ return;
941
+ const y = A.from(
942
+ "getAllResponseHeaders" in c && c.getAllResponseHeaders()
943
+ ), p = {
944
+ data: !i || i === "text" || i === "json" ? c.responseText : c.response,
945
+ status: c.status,
946
+ statusText: c.statusText,
947
+ headers: y,
948
+ config: e,
949
+ request: c
950
+ };
951
+ an(function(S) {
952
+ n(S), d();
953
+ }, function(S) {
954
+ r(S), d();
955
+ }, p), c = null;
956
+ }
957
+ if ("onloadend" in c ? c.onloadend = h : c.onreadystatechange = function() {
958
+ !c || c.readyState !== 4 || c.status === 0 && !(c.responseURL && c.responseURL.indexOf("file:") === 0) || setTimeout(h);
959
+ }, c.onabort = function() {
960
+ c && (r(new m("Request aborted", m.ECONNABORTED, e, c)), c = null);
961
+ }, c.onerror = function() {
962
+ r(new m("Network Error", m.ERR_NETWORK, e, c)), c = null;
963
+ }, c.ontimeout = function() {
964
+ let f = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
965
+ const p = e.transitional || He;
966
+ e.timeoutErrorMessage && (f = e.timeoutErrorMessage), r(new m(
967
+ f,
968
+ p.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
969
+ e,
970
+ c
971
+ )), c = null;
972
+ }, g.isStandardBrowserEnv) {
973
+ const y = (e.withCredentials || fn(l)) && e.xsrfCookieName && cn.read(e.xsrfCookieName);
974
+ y && o.set(e.xsrfHeaderName, y);
975
+ }
976
+ s === void 0 && o.setContentType(null), "setRequestHeader" in c && a.forEach(o.toJSON(), function(f, p) {
977
+ c.setRequestHeader(p, f);
978
+ }), a.isUndefined(e.withCredentials) || (c.withCredentials = !!e.withCredentials), i && i !== "json" && (c.responseType = e.responseType), typeof e.onDownloadProgress == "function" && c.addEventListener("progress", me(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && c.upload && c.upload.addEventListener("progress", me(e.onUploadProgress)), (e.cancelToken || e.signal) && (u = (y) => {
979
+ c && (r(!y || y.type ? new U(null, e, c) : y), c.abort(), c = null);
980
+ }, e.cancelToken && e.cancelToken.subscribe(u), e.signal && (e.signal.aborted ? u() : e.signal.addEventListener("abort", u)));
981
+ const E = dn(l);
982
+ if (E && g.protocols.indexOf(E) === -1) {
983
+ r(new m("Unsupported protocol " + E + ":", m.ERR_BAD_REQUEST, e));
984
+ return;
985
+ }
986
+ c.send(s || null);
987
+ });
988
+ }, q = {
989
+ http: qt,
990
+ xhr: mn
991
+ };
992
+ a.forEach(q, (e, t) => {
993
+ if (e) {
994
+ try {
995
+ Object.defineProperty(e, "name", { value: t });
996
+ } catch {
997
+ }
998
+ Object.defineProperty(e, "adapterName", { value: t });
999
+ }
1000
+ });
1001
+ const yn = {
1002
+ getAdapter: (e) => {
1003
+ e = a.isArray(e) ? e : [e];
1004
+ const { length: t } = e;
1005
+ let n, r;
1006
+ for (let s = 0; s < t && (n = e[s], !(r = a.isString(n) ? q[n.toLowerCase()] : n)); s++)
1007
+ ;
1008
+ if (!r)
1009
+ throw r === !1 ? new m(
1010
+ `Adapter ${n} is not supported by the environment`,
1011
+ "ERR_NOT_SUPPORT"
1012
+ ) : new Error(
1013
+ a.hasOwnProp(q, n) ? `Adapter '${n}' is not available in the build` : `Unknown adapter '${n}'`
1014
+ );
1015
+ if (!a.isFunction(r))
1016
+ throw new TypeError("adapter is not a function");
1017
+ return r;
1018
+ },
1019
+ adapters: q
1020
+ };
1021
+ function Q(e) {
1022
+ if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1023
+ throw new U(null, e);
1024
+ }
1025
+ function ye(e) {
1026
+ return Q(e), e.headers = A.from(e.headers), e.data = G.call(
1027
+ e,
1028
+ e.transformRequest
1029
+ ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), yn.getAdapter(e.adapter || ie.adapter)(e).then(function(r) {
1030
+ return Q(e), r.data = G.call(
1031
+ e,
1032
+ e.transformResponse,
1033
+ r
1034
+ ), r.headers = A.from(r.headers), r;
1035
+ }, function(r) {
1036
+ return Ke(r) || (Q(e), r && r.response && (r.response.data = G.call(
1037
+ e,
1038
+ e.transformResponse,
1039
+ r.response
1040
+ ), r.response.headers = A.from(r.response.headers))), Promise.reject(r);
1041
+ });
1042
+ }
1043
+ const Ee = (e) => e instanceof A ? e.toJSON() : e;
1044
+ function N(e, t) {
1045
+ t = t || {};
1046
+ const n = {};
1047
+ function r(c, l, h) {
1048
+ return a.isPlainObject(c) && a.isPlainObject(l) ? a.merge.call({ caseless: h }, c, l) : a.isPlainObject(l) ? a.merge({}, l) : a.isArray(l) ? l.slice() : l;
1049
+ }
1050
+ function s(c, l, h) {
1051
+ if (a.isUndefined(l)) {
1052
+ if (!a.isUndefined(c))
1053
+ return r(void 0, c, h);
1054
+ } else
1055
+ return r(c, l, h);
1056
+ }
1057
+ function o(c, l) {
1058
+ if (!a.isUndefined(l))
1059
+ return r(void 0, l);
1060
+ }
1061
+ function i(c, l) {
1062
+ if (a.isUndefined(l)) {
1063
+ if (!a.isUndefined(c))
1064
+ return r(void 0, c);
1065
+ } else
1066
+ return r(void 0, l);
1067
+ }
1068
+ function u(c, l, h) {
1069
+ if (h in t)
1070
+ return r(c, l);
1071
+ if (h in e)
1072
+ return r(void 0, c);
1073
+ }
1074
+ const d = {
1075
+ url: o,
1076
+ method: o,
1077
+ data: o,
1078
+ baseURL: i,
1079
+ transformRequest: i,
1080
+ transformResponse: i,
1081
+ paramsSerializer: i,
1082
+ timeout: i,
1083
+ timeoutMessage: i,
1084
+ withCredentials: i,
1085
+ adapter: i,
1086
+ responseType: i,
1087
+ xsrfCookieName: i,
1088
+ xsrfHeaderName: i,
1089
+ onUploadProgress: i,
1090
+ onDownloadProgress: i,
1091
+ decompress: i,
1092
+ maxContentLength: i,
1093
+ maxBodyLength: i,
1094
+ beforeRedirect: i,
1095
+ transport: i,
1096
+ httpAgent: i,
1097
+ httpsAgent: i,
1098
+ cancelToken: i,
1099
+ socketPath: i,
1100
+ responseEncoding: i,
1101
+ validateStatus: u,
1102
+ headers: (c, l) => s(Ee(c), Ee(l), !0)
1103
+ };
1104
+ return a.forEach(Object.keys(e).concat(Object.keys(t)), function(l) {
1105
+ const h = d[l] || s, E = h(e[l], t[l], l);
1106
+ a.isUndefined(E) && h !== u || (n[l] = E);
1107
+ }), n;
1108
+ }
1109
+ const $e = "1.3.4", ae = {};
1110
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1111
+ ae[e] = function(r) {
1112
+ return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1113
+ };
1114
+ });
1115
+ const we = {};
1116
+ ae.transitional = function(t, n, r) {
1117
+ function s(o, i) {
1118
+ return "[Axios v" + $e + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1119
+ }
1120
+ return (o, i, u) => {
1121
+ if (t === !1)
1122
+ throw new m(
1123
+ s(i, " has been removed" + (n ? " in " + n : "")),
1124
+ m.ERR_DEPRECATED
1125
+ );
1126
+ return n && !we[i] && (we[i] = !0, console.warn(
1127
+ s(
1128
+ i,
1129
+ " has been deprecated since v" + n + " and will be removed in the near future"
1130
+ )
1131
+ )), t ? t(o, i, u) : !0;
1132
+ };
1133
+ };
1134
+ function En(e, t, n) {
1135
+ if (typeof e != "object")
1136
+ throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
1137
+ const r = Object.keys(e);
1138
+ let s = r.length;
1139
+ for (; s-- > 0; ) {
1140
+ const o = r[s], i = t[o];
1141
+ if (i) {
1142
+ const u = e[o], d = u === void 0 || i(u, o, e);
1143
+ if (d !== !0)
1144
+ throw new m("option " + o + " must be " + d, m.ERR_BAD_OPTION_VALUE);
1145
+ continue;
1146
+ }
1147
+ if (n !== !0)
1148
+ throw new m("Unknown option " + o, m.ERR_BAD_OPTION);
1149
+ }
1150
+ }
1151
+ const ee = {
1152
+ assertOptions: En,
1153
+ validators: ae
1154
+ }, T = ee.validators;
1155
+ class v {
1156
+ constructor(t) {
1157
+ this.defaults = t, this.interceptors = {
1158
+ request: new he(),
1159
+ response: new he()
1160
+ };
1161
+ }
1162
+ /**
1163
+ * Dispatch a request
1164
+ *
1165
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1166
+ * @param {?Object} config
1167
+ *
1168
+ * @returns {Promise} The Promise to be fulfilled
1169
+ */
1170
+ request(t, n) {
1171
+ typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = N(this.defaults, n);
1172
+ const { transitional: r, paramsSerializer: s, headers: o } = n;
1173
+ r !== void 0 && ee.assertOptions(r, {
1174
+ silentJSONParsing: T.transitional(T.boolean),
1175
+ forcedJSONParsing: T.transitional(T.boolean),
1176
+ clarifyTimeoutError: T.transitional(T.boolean)
1177
+ }, !1), s !== void 0 && ee.assertOptions(s, {
1178
+ encode: T.function,
1179
+ serialize: T.function
1180
+ }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1181
+ let i;
1182
+ i = o && a.merge(
1183
+ o.common,
1184
+ o[n.method]
1185
+ ), i && a.forEach(
1186
+ ["delete", "get", "head", "post", "put", "patch", "common"],
1187
+ (f) => {
1188
+ delete o[f];
1189
+ }
1190
+ ), n.headers = A.concat(i, o);
1191
+ const u = [];
1192
+ let d = !0;
1193
+ this.interceptors.request.forEach(function(p) {
1194
+ typeof p.runWhen == "function" && p.runWhen(n) === !1 || (d = d && p.synchronous, u.unshift(p.fulfilled, p.rejected));
1195
+ });
1196
+ const c = [];
1197
+ this.interceptors.response.forEach(function(p) {
1198
+ c.push(p.fulfilled, p.rejected);
1199
+ });
1200
+ let l, h = 0, E;
1201
+ if (!d) {
1202
+ const f = [ye.bind(this), void 0];
1203
+ for (f.unshift.apply(f, u), f.push.apply(f, c), E = f.length, l = Promise.resolve(n); h < E; )
1204
+ l = l.then(f[h++], f[h++]);
1205
+ return l;
1206
+ }
1207
+ E = u.length;
1208
+ let y = n;
1209
+ for (h = 0; h < E; ) {
1210
+ const f = u[h++], p = u[h++];
1211
+ try {
1212
+ y = f(y);
1213
+ } catch (R) {
1214
+ p.call(this, R);
1215
+ break;
1216
+ }
1217
+ }
1218
+ try {
1219
+ l = ye.call(this, y);
1220
+ } catch (f) {
1221
+ return Promise.reject(f);
1222
+ }
1223
+ for (h = 0, E = c.length; h < E; )
1224
+ l = l.then(c[h++], c[h++]);
1225
+ return l;
1226
+ }
1227
+ getUri(t) {
1228
+ t = N(this.defaults, t);
1229
+ const n = ve(t.baseURL, t.url);
1230
+ return qe(n, t.params, t.paramsSerializer);
1231
+ }
1232
+ }
1233
+ a.forEach(["delete", "get", "head", "options"], function(t) {
1234
+ v.prototype[t] = function(n, r) {
1235
+ return this.request(N(r || {}, {
1236
+ method: t,
1237
+ url: n,
1238
+ data: (r || {}).data
1239
+ }));
1240
+ };
1241
+ });
1242
+ a.forEach(["post", "put", "patch"], function(t) {
1243
+ function n(r) {
1244
+ return function(o, i, u) {
1245
+ return this.request(N(u || {}, {
1246
+ method: t,
1247
+ headers: r ? {
1248
+ "Content-Type": "multipart/form-data"
1249
+ } : {},
1250
+ url: o,
1251
+ data: i
1252
+ }));
1253
+ };
1254
+ }
1255
+ v.prototype[t] = n(), v.prototype[t + "Form"] = n(!0);
1256
+ });
1257
+ const H = v;
1258
+ class ce {
1259
+ constructor(t) {
1260
+ if (typeof t != "function")
1261
+ throw new TypeError("executor must be a function.");
1262
+ let n;
1263
+ this.promise = new Promise(function(o) {
1264
+ n = o;
1265
+ });
1266
+ const r = this;
1267
+ this.promise.then((s) => {
1268
+ if (!r._listeners)
1269
+ return;
1270
+ let o = r._listeners.length;
1271
+ for (; o-- > 0; )
1272
+ r._listeners[o](s);
1273
+ r._listeners = null;
1274
+ }), this.promise.then = (s) => {
1275
+ let o;
1276
+ const i = new Promise((u) => {
1277
+ r.subscribe(u), o = u;
1278
+ }).then(s);
1279
+ return i.cancel = function() {
1280
+ r.unsubscribe(o);
1281
+ }, i;
1282
+ }, t(function(o, i, u) {
1283
+ r.reason || (r.reason = new U(o, i, u), n(r.reason));
1284
+ });
1285
+ }
1286
+ /**
1287
+ * Throws a `CanceledError` if cancellation has been requested.
1288
+ */
1289
+ throwIfRequested() {
1290
+ if (this.reason)
1291
+ throw this.reason;
1292
+ }
1293
+ /**
1294
+ * Subscribe to the cancel signal
1295
+ */
1296
+ subscribe(t) {
1297
+ if (this.reason) {
1298
+ t(this.reason);
1299
+ return;
1300
+ }
1301
+ this._listeners ? this._listeners.push(t) : this._listeners = [t];
1302
+ }
1303
+ /**
1304
+ * Unsubscribe from the cancel signal
1305
+ */
1306
+ unsubscribe(t) {
1307
+ if (!this._listeners)
1308
+ return;
1309
+ const n = this._listeners.indexOf(t);
1310
+ n !== -1 && this._listeners.splice(n, 1);
1311
+ }
1312
+ /**
1313
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
1314
+ * cancels the `CancelToken`.
1315
+ */
1316
+ static source() {
1317
+ let t;
1318
+ return {
1319
+ token: new ce(function(s) {
1320
+ t = s;
1321
+ }),
1322
+ cancel: t
1323
+ };
1324
+ }
1325
+ }
1326
+ const wn = ce;
1327
+ function Sn(e) {
1328
+ return function(n) {
1329
+ return e.apply(null, n);
1330
+ };
1331
+ }
1332
+ function gn(e) {
1333
+ return a.isObject(e) && e.isAxiosError === !0;
1334
+ }
1335
+ const te = {
1336
+ Continue: 100,
1337
+ SwitchingProtocols: 101,
1338
+ Processing: 102,
1339
+ EarlyHints: 103,
1340
+ Ok: 200,
1341
+ Created: 201,
1342
+ Accepted: 202,
1343
+ NonAuthoritativeInformation: 203,
1344
+ NoContent: 204,
1345
+ ResetContent: 205,
1346
+ PartialContent: 206,
1347
+ MultiStatus: 207,
1348
+ AlreadyReported: 208,
1349
+ ImUsed: 226,
1350
+ MultipleChoices: 300,
1351
+ MovedPermanently: 301,
1352
+ Found: 302,
1353
+ SeeOther: 303,
1354
+ NotModified: 304,
1355
+ UseProxy: 305,
1356
+ Unused: 306,
1357
+ TemporaryRedirect: 307,
1358
+ PermanentRedirect: 308,
1359
+ BadRequest: 400,
1360
+ Unauthorized: 401,
1361
+ PaymentRequired: 402,
1362
+ Forbidden: 403,
1363
+ NotFound: 404,
1364
+ MethodNotAllowed: 405,
1365
+ NotAcceptable: 406,
1366
+ ProxyAuthenticationRequired: 407,
1367
+ RequestTimeout: 408,
1368
+ Conflict: 409,
1369
+ Gone: 410,
1370
+ LengthRequired: 411,
1371
+ PreconditionFailed: 412,
1372
+ PayloadTooLarge: 413,
1373
+ UriTooLong: 414,
1374
+ UnsupportedMediaType: 415,
1375
+ RangeNotSatisfiable: 416,
1376
+ ExpectationFailed: 417,
1377
+ ImATeapot: 418,
1378
+ MisdirectedRequest: 421,
1379
+ UnprocessableEntity: 422,
1380
+ Locked: 423,
1381
+ FailedDependency: 424,
1382
+ TooEarly: 425,
1383
+ UpgradeRequired: 426,
1384
+ PreconditionRequired: 428,
1385
+ TooManyRequests: 429,
1386
+ RequestHeaderFieldsTooLarge: 431,
1387
+ UnavailableForLegalReasons: 451,
1388
+ InternalServerError: 500,
1389
+ NotImplemented: 501,
1390
+ BadGateway: 502,
1391
+ ServiceUnavailable: 503,
1392
+ GatewayTimeout: 504,
1393
+ HttpVersionNotSupported: 505,
1394
+ VariantAlsoNegotiates: 506,
1395
+ InsufficientStorage: 507,
1396
+ LoopDetected: 508,
1397
+ NotExtended: 510,
1398
+ NetworkAuthenticationRequired: 511
1399
+ };
1400
+ Object.entries(te).forEach(([e, t]) => {
1401
+ te[t] = e;
1402
+ });
1403
+ const Rn = te;
1404
+ function ze(e) {
1405
+ const t = new H(e), n = _e(H.prototype.request, t);
1406
+ return a.extend(n, H.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1407
+ return ze(N(e, s));
1408
+ }, n;
1409
+ }
1410
+ const w = ze(ie);
1411
+ w.Axios = H;
1412
+ w.CanceledError = U;
1413
+ w.CancelToken = wn;
1414
+ w.isCancel = Ke;
1415
+ w.VERSION = $e;
1416
+ w.toFormData = z;
1417
+ w.AxiosError = m;
1418
+ w.Cancel = w.CanceledError;
1419
+ w.all = function(t) {
1420
+ return Promise.all(t);
1421
+ };
1422
+ w.spread = Sn;
1423
+ w.isAxiosError = gn;
1424
+ w.mergeConfig = N;
1425
+ w.AxiosHeaders = A;
1426
+ w.formToJSON = (e) => Me(a.isHTMLForm(e) ? new FormData(e) : e);
1427
+ w.HttpStatusCode = Rn;
1428
+ w.default = w;
1429
+ const bn = w, An = (e) => {
1430
+ let t = "";
1431
+ return Object.keys(e).forEach((n) => {
1432
+ t = t === "" ? t + `?${n}=${e[n]}` : t + `&${n}=${e[n]}`;
1433
+ }), t;
1434
+ };
1435
+ class On {
1436
+ constructor(t) {
1437
+ b(this, "client");
1438
+ b(this, "queryParams");
1439
+ this.client = bn.create({
1440
+ ...t,
1441
+ headers: t.apiKey ? this._getHeaders(t.apiKey) : {}
1442
+ }), this.queryParams = t.queryParams ? An(t.queryParams) : "";
1443
+ }
1444
+ async get(t, n) {
1445
+ return this.client.get(t + this.queryParams, { params: n });
1446
+ }
1447
+ async post(t, n) {
1448
+ return this.client.post(t + this.queryParams, n);
1449
+ }
1450
+ async put(t, n) {
1451
+ return this.client.put(t + this.queryParams, n);
1452
+ }
1453
+ async delete(t) {
1454
+ return this.client.delete(t + this.queryParams);
1455
+ }
1456
+ _getHeaders(t) {
1457
+ const n = {};
1458
+ return n.Authorization = `Bearer ${t}`, n;
1459
+ }
1460
+ }
1461
+ class Tn {
1462
+ constructor(t) {
1463
+ b(this, "httpClient");
1464
+ this.httpClient = t;
1465
+ }
1466
+ async getAll() {
1467
+ const { data: t } = await this.httpClient.get("conversions");
1468
+ return t;
1469
+ }
1470
+ }
1471
+ const _n = (e, t) => {
1472
+ const n = Date.now(), r = `${Ae}_${e}`, s = { ...t, timestamp: n };
1473
+ localStorage.setItem(r, JSON.stringify(s));
1474
+ }, Pn = (e, t) => {
1475
+ const n = `${Ae}_${e}`, r = localStorage.getItem(n);
1476
+ if (!r)
1477
+ return !0;
1478
+ const s = JSON.parse(r);
1479
+ if (Date.now() - s.timestamp > 6e4)
1480
+ return !0;
1481
+ if (t.metadata) {
1482
+ const { tracking_id: d, project_id: c, referrer: l, source: h, category: E, title: y, tag: f } = t.metadata, p = s.metadata.tracking_id === d && s.metadata.project_id === c && s.metadata.referrer === l && s.metadata.source === h && s.metadata.category === E && s.metadata.title === y && s.metadata.tag === f;
1483
+ return s.user_address, t.user_address, !p;
1484
+ }
1485
+ return !0;
1486
+ }, Nn = (e, t) => `p=${t}&source=fuul&referrer=${e}`;
1487
+ class xn {
1488
+ constructor(t, n = {}) {
1489
+ b(this, "apiKey");
1490
+ b(this, "BASE_API_URL", "https://api.fuul.xyz/api/v1/");
1491
+ b(this, "httpClient");
1492
+ b(this, "settings");
1493
+ b(this, "conversionService");
1494
+ this.apiKey = t, this.settings = n, this.checkApiKey(), st(), ot(), it(), this.httpClient = new On({
1495
+ baseURL: n.baseApiUrl || this.BASE_API_URL,
1496
+ timeout: 1e4,
1497
+ apiKey: this.apiKey,
1498
+ ...this.settings.defaultQueryParams && { queryParams: this.settings.defaultQueryParams }
1499
+ }), this.conversionService = new Tn(this.httpClient), this.init();
1500
+ }
1501
+ async init() {
1502
+ F || await this.sendEvent("pageview");
1503
+ }
1504
+ checkApiKey() {
1505
+ if (!this.apiKey)
1506
+ throw new Error("Fuul API key is required");
1507
+ }
1508
+ /**
1509
+ * @param {EventType} name Event name.
1510
+ * @param {EventArgs} args Event arguments
1511
+ * @param {EventMetadata} metadata Event metadata like userAddress, signature, signatureMessage
1512
+ * @returns {Promise<any>} Promise object represents the result of the event.
1513
+ * @example
1514
+ * ```js
1515
+ * fuul.sendEvent('my_event', { value: 10 }, { userAddress: '0x01' })
1516
+ * ```
1517
+ */
1518
+ async sendEvent(t, n = {}, r = {}) {
1519
+ const s = Xe(), o = Oe(), i = Ze(), u = et(), d = tt(), c = nt(), l = rt(), { userAddress: h, signature: E, signatureMessage: y } = r;
1520
+ if (!o)
1521
+ return;
1522
+ const f = {
1523
+ name: t,
1524
+ event_args: n,
1525
+ metadata: {
1526
+ ...i && { referrer: i },
1527
+ session_id: s,
1528
+ tracking_id: o,
1529
+ source: u,
1530
+ category: d,
1531
+ title: c,
1532
+ tag: l
1533
+ },
1534
+ ...h && { user_address: h },
1535
+ ...E && { signature: E },
1536
+ ...y && { signature_message: y }
1537
+ };
1538
+ if (Pn(t, f))
1539
+ try {
1540
+ await this.httpClient.post("events", f), _n(t, f);
1541
+ } catch (p) {
1542
+ return p;
1543
+ }
1544
+ }
1545
+ verifyConnection() {
1546
+ if (F)
1547
+ throw new Error(
1548
+ 'Fuul SDK is not supported in this environment. Please use "typeof window !== undefined" to check if you are in the browser environment.'
1549
+ );
1550
+ window.alert("You are successfully connected to Fuul SDK! ✅");
1551
+ }
1552
+ /**
1553
+ * Generates a tracking link for a referrer
1554
+ * @param {Object} trackingLinkParams - Tracking link parameters
1555
+ * @param {string} trackingLinkParams.address - Referrer wallet address.
1556
+ * @param {string} trackingLinkParams.projectId - Project ID.
1557
+ * @param {string} trackingLinkParams.baseUrl - Base URL of your app. Defaults to window.location.href.
1558
+ * @returns {string} tracking link
1559
+ **/
1560
+ generateTrackingLink({ address: t, projectId: n, baseUrl: r }) {
1561
+ return `${r ?? window.location.href}?${Nn(t, n)}`;
1562
+ }
1563
+ async getAllConversions() {
1564
+ return this.conversionService.getAll();
1565
+ }
1566
+ }
1567
+ export {
1568
+ xn as default
1569
+ };