@regulaforensics/facesdk-webclient
Version:
JS client for facesdk web service
1,696 lines (1,695 loc) • 128 kB
JavaScript
function dt(e, t) {
return function() {
return e.apply(t, arguments);
};
}
const { toString: Dt } = Object.prototype, { getPrototypeOf: xe } = Object, { iterator: Oe, toStringTag: ut } = Symbol, _e = /* @__PURE__ */ ((e) => (t) => {
const r = Dt.call(t);
return e[r] || (e[r] = r.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), G = (e) => (e = e.toLowerCase(), (t) => _e(t) === e), Re = (e) => (t) => typeof t === e, { isArray: K } = Array, Z = Re("undefined");
function re(e) {
return e !== null && !Z(e) && e.constructor !== null && !Z(e.constructor) && N(e.constructor.isBuffer) && e.constructor.isBuffer(e);
}
const pt = G("ArrayBuffer");
function Bt(e) {
let t;
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && pt(e.buffer), t;
}
const Ht = Re("string"), N = Re("function"), ht = Re("number"), se = (e) => e !== null && typeof e == "object", Gt = (e) => e === !0 || e === !1, pe = (e) => {
if (_e(e) !== "object")
return !1;
const t = xe(e);
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(ut in e) && !(Oe in e);
}, Mt = (e) => {
if (!se(e) || re(e))
return !1;
try {
return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
} catch {
return !1;
}
}, vt = G("Date"), jt = G("File"), kt = (e) => !!(e && typeof e.uri < "u"), Ft = (e) => e && typeof e.getParts < "u", qt = G("Blob"), $t = G("FileList"), zt = (e) => se(e) && N(e.pipe);
function Wt() {
return typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
}
const $e = Wt(), ze = typeof $e.FormData < "u" ? $e.FormData : void 0, Yt = (e) => {
let t;
return e && (ze && e instanceof ze || N(e.append) && ((t = _e(e)) === "formdata" || // detect form-data instance
t === "object" && N(e.toString) && e.toString() === "[object FormData]"));
}, Xt = G("URLSearchParams"), [Jt, Zt, Kt, Qt] = [
"ReadableStream",
"Request",
"Response",
"Headers"
].map(G), er = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function ne(e, t, { allOwnKeys: r = !1 } = {}) {
if (e === null || typeof e > "u")
return;
let s, n;
if (typeof e != "object" && (e = [e]), K(e))
for (s = 0, n = e.length; s < n; s++)
t.call(null, e[s], s, e);
else {
if (re(e))
return;
const o = r ? Object.getOwnPropertyNames(e) : Object.keys(e), a = o.length;
let i;
for (s = 0; s < a; s++)
i = o[s], t.call(null, e[i], i, e);
}
}
function ft(e, t) {
if (re(e))
return null;
t = t.toLowerCase();
const r = Object.keys(e);
let s = r.length, n;
for (; s-- > 0; )
if (n = r[s], t === n.toLowerCase())
return n;
return null;
}
const z = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Et = (e) => !Z(e) && e !== z;
function Le() {
const { caseless: e, skipUndefined: t } = Et(this) && this || {}, r = {}, s = (n, o) => {
if (o === "__proto__" || o === "constructor" || o === "prototype")
return;
const a = e && ft(r, o) || o;
pe(r[a]) && pe(n) ? r[a] = Le(r[a], n) : pe(n) ? r[a] = Le({}, n) : K(n) ? r[a] = n.slice() : (!t || !Z(n)) && (r[a] = n);
};
for (let n = 0, o = arguments.length; n < o; n++)
arguments[n] && ne(arguments[n], s);
return r;
}
const tr = (e, t, r, { allOwnKeys: s } = {}) => (ne(
t,
(n, o) => {
r && N(n) ? Object.defineProperty(e, o, {
value: dt(n, r),
writable: !0,
enumerable: !0,
configurable: !0
}) : Object.defineProperty(e, o, {
value: n,
writable: !0,
enumerable: !0,
configurable: !0
});
},
{ allOwnKeys: s }
), e), rr = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), sr = (e, t, r, s) => {
e.prototype = Object.create(t.prototype, s), Object.defineProperty(e.prototype, "constructor", {
value: e,
writable: !0,
enumerable: !1,
configurable: !0
}), Object.defineProperty(e, "super", {
value: t.prototype
}), r && Object.assign(e.prototype, r);
}, nr = (e, t, r, s) => {
let n, o, a;
const i = {};
if (t = t || {}, e == null) return t;
do {
for (n = Object.getOwnPropertyNames(e), o = n.length; o-- > 0; )
a = n[o], (!s || s(a, e, t)) && !i[a] && (t[a] = e[a], i[a] = !0);
e = r !== !1 && xe(e);
} while (e && (!r || r(e, t)) && e !== Object.prototype);
return t;
}, or = (e, t, r) => {
e = String(e), (r === void 0 || r > e.length) && (r = e.length), r -= t.length;
const s = e.indexOf(t, r);
return s !== -1 && s === r;
}, ar = (e) => {
if (!e) return null;
if (K(e)) return e;
let t = e.length;
if (!ht(t)) return null;
const r = new Array(t);
for (; t-- > 0; )
r[t] = e[t];
return r;
}, ir = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && xe(Uint8Array)), lr = (e, t) => {
const s = (e && e[Oe]).call(e);
let n;
for (; (n = s.next()) && !n.done; ) {
const o = n.value;
t.call(e, o[0], o[1]);
}
}, cr = (e, t) => {
let r;
const s = [];
for (; (r = e.exec(t)) !== null; )
s.push(r);
return s;
}, dr = G("HTMLFormElement"), ur = (e) => e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function(r, s, n) {
return s.toUpperCase() + n;
}), We = (({ hasOwnProperty: e }) => (t, r) => e.call(t, r))(Object.prototype), pr = G("RegExp"), At = (e, t) => {
const r = Object.getOwnPropertyDescriptors(e), s = {};
ne(r, (n, o) => {
let a;
(a = t(n, o, e)) !== !1 && (s[o] = a || n);
}), Object.defineProperties(e, s);
}, hr = (e) => {
At(e, (t, r) => {
if (N(e) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
return !1;
const s = e[r];
if (N(s)) {
if (t.enumerable = !1, "writable" in t) {
t.writable = !1;
return;
}
t.set || (t.set = () => {
throw Error("Can not rewrite read-only method '" + r + "'");
});
}
});
}, fr = (e, t) => {
const r = {}, s = (n) => {
n.forEach((o) => {
r[o] = !0;
});
};
return K(e) ? s(e) : s(String(e).split(t)), r;
}, Er = () => {
}, Ar = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
function Or(e) {
return !!(e && N(e.append) && e[ut] === "FormData" && e[Oe]);
}
const _r = (e) => {
const t = new Array(10), r = (s, n) => {
if (se(s)) {
if (t.indexOf(s) >= 0)
return;
if (re(s))
return s;
if (!("toJSON" in s)) {
t[n] = s;
const o = K(s) ? [] : {};
return ne(s, (a, i) => {
const l = r(a, n + 1);
!Z(l) && (o[i] = l);
}), t[n] = void 0, o;
}
}
return s;
};
return r(e, 0);
}, Rr = G("AsyncFunction"), mr = (e) => e && (se(e) || N(e)) && N(e.then) && N(e.catch), Ot = ((e, t) => e ? setImmediate : t ? ((r, s) => (z.addEventListener(
"message",
({ source: n, data: o }) => {
n === z && o === r && s.length && s.shift()();
},
!1
), (n) => {
s.push(n), z.postMessage(r, "*");
}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(typeof setImmediate == "function", N(z.postMessage)), Tr = typeof queueMicrotask < "u" ? queueMicrotask.bind(z) : typeof process < "u" && process.nextTick || Ot, Pr = (e) => e != null && N(e[Oe]), u = {
isArray: K,
isArrayBuffer: pt,
isBuffer: re,
isFormData: Yt,
isArrayBufferView: Bt,
isString: Ht,
isNumber: ht,
isBoolean: Gt,
isObject: se,
isPlainObject: pe,
isEmptyObject: Mt,
isReadableStream: Jt,
isRequest: Zt,
isResponse: Kt,
isHeaders: Qt,
isUndefined: Z,
isDate: vt,
isFile: jt,
isReactNativeBlob: kt,
isReactNative: Ft,
isBlob: qt,
isRegExp: pr,
isFunction: N,
isStream: zt,
isURLSearchParams: Xt,
isTypedArray: ir,
isFileList: $t,
forEach: ne,
merge: Le,
extend: tr,
trim: er,
stripBOM: rr,
inherits: sr,
toFlatObject: nr,
kindOf: _e,
kindOfTest: G,
endsWith: or,
toArray: ar,
forEachEntry: lr,
matchAll: cr,
isHTMLForm: dr,
hasOwnProperty: We,
hasOwnProp: We,
// an alias to avoid ESLint no-prototype-builtins detection
reduceDescriptors: At,
freezeMethods: hr,
toObjectSet: fr,
toCamelCase: ur,
noop: Er,
toFiniteNumber: Ar,
findKey: ft,
global: z,
isContextDefined: Et,
isSpecCompliantForm: Or,
toJSONObject: _r,
isAsyncFn: Rr,
isThenable: mr,
setImmediate: Ot,
asap: Tr,
isIterable: Pr
};
let A = class _t extends Error {
static from(t, r, s, n, o, a) {
const i = new _t(t.message, r || t.code, s, n, o);
return i.cause = t, i.name = t.name, t.status != null && i.status == null && (i.status = t.status), a && Object.assign(i, a), i;
}
/**
* Create an Error with the specified message, config, error code, request and response.
*
* @param {string} message The error message.
* @param {string} [code] The error code (for example, 'ECONNABORTED').
* @param {Object} [config] The config.
* @param {Object} [request] The request.
* @param {Object} [response] The response.
*
* @returns {Error} The created error.
*/
constructor(t, r, s, n, o) {
super(t), Object.defineProperty(this, "message", {
value: t,
enumerable: !0,
writable: !0,
configurable: !0
}), this.name = "AxiosError", this.isAxiosError = !0, r && (this.code = r), s && (this.config = s), n && (this.request = n), o && (this.response = o, this.status = o.status);
}
toJSON() {
return {
// Standard
message: this.message,
name: this.name,
// Microsoft
description: this.description,
number: this.number,
// Mozilla
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: u.toJSONObject(this.config),
code: this.code,
status: this.status
};
}
};
A.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
A.ERR_BAD_OPTION = "ERR_BAD_OPTION";
A.ECONNABORTED = "ECONNABORTED";
A.ETIMEDOUT = "ETIMEDOUT";
A.ERR_NETWORK = "ERR_NETWORK";
A.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
A.ERR_DEPRECATED = "ERR_DEPRECATED";
A.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
A.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
A.ERR_CANCELED = "ERR_CANCELED";
A.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
A.ERR_INVALID_URL = "ERR_INVALID_URL";
const Ir = null;
function ge(e) {
return u.isPlainObject(e) || u.isArray(e);
}
function Rt(e) {
return u.endsWith(e, "[]") ? e.slice(0, -2) : e;
}
function Se(e, t, r) {
return e ? e.concat(t).map(function(n, o) {
return n = Rt(n), !r && o ? "[" + n + "]" : n;
}).join(r ? "." : "") : t;
}
function Sr(e) {
return u.isArray(e) && !e.some(ge);
}
const br = u.toFlatObject(u, {}, null, function(t) {
return /^is[A-Z]/.test(t);
});
function me(e, t, r) {
if (!u.isObject(e))
throw new TypeError("target must be an object");
t = t || new FormData(), r = u.toFlatObject(
r,
{
metaTokens: !0,
dots: !1,
indexes: !1
},
!1,
function(E, f) {
return !u.isUndefined(f[E]);
}
);
const s = r.metaTokens, n = r.visitor || d, o = r.dots, a = r.indexes, l = (r.Blob || typeof Blob < "u" && Blob) && u.isSpecCompliantForm(t);
if (!u.isFunction(n))
throw new TypeError("visitor must be a function");
function c(h) {
if (h === null) return "";
if (u.isDate(h))
return h.toISOString();
if (u.isBoolean(h))
return h.toString();
if (!l && u.isBlob(h))
throw new A("Blob is not supported. Use a Buffer instead.");
return u.isArrayBuffer(h) || u.isTypedArray(h) ? l && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
}
function d(h, E, f) {
let w = h;
if (u.isReactNative(t) && u.isReactNativeBlob(h))
return t.append(Se(f, E, o), c(h)), !1;
if (h && !f && typeof h == "object") {
if (u.endsWith(E, "{}"))
E = s ? E : E.slice(0, -2), h = JSON.stringify(h);
else if (u.isArray(h) && Sr(h) || (u.isFileList(h) || u.endsWith(E, "[]")) && (w = u.toArray(h)))
return E = Rt(E), w.forEach(function(y, g) {
!(u.isUndefined(y) || y === null) && t.append(
// eslint-disable-next-line no-nested-ternary
a === !0 ? Se([E], g, o) : a === null ? E : E + "[]",
c(y)
);
}), !1;
}
return ge(h) ? !0 : (t.append(Se(f, E, o), c(h)), !1);
}
const p = [], _ = Object.assign(br, {
defaultVisitor: d,
convertValue: c,
isVisitable: ge
});
function C(h, E) {
if (!u.isUndefined(h)) {
if (p.indexOf(h) !== -1)
throw Error("Circular reference detected in " + E.join("."));
p.push(h), u.forEach(h, function(w, x) {
(!(u.isUndefined(w) || w === null) && n.call(t, w, u.isString(x) ? x.trim() : x, E, _)) === !0 && C(w, E ? E.concat(x) : [x]);
}), p.pop();
}
}
if (!u.isObject(e))
throw new TypeError("data must be an object");
return C(e), t;
}
function Ye(e) {
const t = {
"!": "%21",
"'": "%27",
"(": "%28",
")": "%29",
"~": "%7E",
"%20": "+",
"%00": "\0"
};
return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(s) {
return t[s];
});
}
function De(e, t) {
this._pairs = [], e && me(e, this, t);
}
const mt = De.prototype;
mt.append = function(t, r) {
this._pairs.push([t, r]);
};
mt.toString = function(t) {
const r = t ? function(s) {
return t.call(this, s, Ye);
} : Ye;
return this._pairs.map(function(n) {
return r(n[0]) + "=" + r(n[1]);
}, "").join("&");
};
function wr(e) {
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
}
function Tt(e, t, r) {
if (!t)
return e;
const s = r && r.encode || wr, n = u.isFunction(r) ? {
serialize: r
} : r, o = n && n.serialize;
let a;
if (o ? a = o(t, n) : a = u.isURLSearchParams(t) ? t.toString() : new De(t, n).toString(s), a) {
const i = e.indexOf("#");
i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + a;
}
return e;
}
class Xe {
constructor() {
this.handlers = [];
}
/**
* Add a new interceptor to the stack
*
* @param {Function} fulfilled The function to handle `then` for a `Promise`
* @param {Function} rejected The function to handle `reject` for a `Promise`
* @param {Object} options The options for the interceptor, synchronous and runWhen
*
* @return {Number} An ID used to remove interceptor later
*/
use(t, r, s) {
return this.handlers.push({
fulfilled: t,
rejected: r,
synchronous: s ? s.synchronous : !1,
runWhen: s ? s.runWhen : null
}), this.handlers.length - 1;
}
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*
* @returns {void}
*/
eject(t) {
this.handlers[t] && (this.handlers[t] = null);
}
/**
* Clear all interceptors from the stack
*
* @returns {void}
*/
clear() {
this.handlers && (this.handlers = []);
}
/**
* Iterate over all the registered interceptors
*
* This method is particularly useful for skipping over any
* interceptors that may have become `null` calling `eject`.
*
* @param {Function} fn The function to call for each interceptor
*
* @returns {void}
*/
forEach(t) {
u.forEach(this.handlers, function(s) {
s !== null && t(s);
});
}
}
const Be = {
silentJSONParsing: !0,
forcedJSONParsing: !0,
clarifyTimeoutError: !1,
legacyInterceptorReqResOrdering: !0
}, yr = typeof URLSearchParams < "u" ? URLSearchParams : De, Cr = typeof FormData < "u" ? FormData : null, Lr = typeof Blob < "u" ? Blob : null, gr = {
isBrowser: !0,
classes: {
URLSearchParams: yr,
FormData: Cr,
Blob: Lr
},
protocols: ["http", "https", "file", "blob", "url", "data"]
}, He = typeof window < "u" && typeof document < "u", Ve = typeof navigator == "object" && navigator || void 0, Vr = He && (!Ve || ["ReactNative", "NativeScript", "NS"].indexOf(Ve.product) < 0), Nr = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Ur = He && window.location.href || "http://localhost", xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
hasBrowserEnv: He,
hasStandardBrowserEnv: Vr,
hasStandardBrowserWebWorkerEnv: Nr,
navigator: Ve,
origin: Ur
}, Symbol.toStringTag, { value: "Module" })), L = {
...xr,
...gr
};
function Dr(e, t) {
return me(e, new L.classes.URLSearchParams(), {
visitor: function(r, s, n, o) {
return L.isNode && u.isBuffer(r) ? (this.append(s, r.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
},
...t
});
}
function Br(e) {
return u.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
}
function Hr(e) {
const t = {}, r = Object.keys(e);
let s;
const n = r.length;
let o;
for (s = 0; s < n; s++)
o = r[s], t[o] = e[o];
return t;
}
function Pt(e) {
function t(r, s, n, o) {
let a = r[o++];
if (a === "__proto__") return !0;
const i = Number.isFinite(+a), l = o >= r.length;
return a = !a && u.isArray(n) ? n.length : a, l ? (u.hasOwnProp(n, a) ? n[a] = [n[a], s] : n[a] = s, !i) : ((!n[a] || !u.isObject(n[a])) && (n[a] = []), t(r, s, n[a], o) && u.isArray(n[a]) && (n[a] = Hr(n[a])), !i);
}
if (u.isFormData(e) && u.isFunction(e.entries)) {
const r = {};
return u.forEachEntry(e, (s, n) => {
t(Br(s), n, r, 0);
}), r;
}
return null;
}
function Gr(e, t, r) {
if (u.isString(e))
try {
return (t || JSON.parse)(e), u.trim(e);
} catch (s) {
if (s.name !== "SyntaxError")
throw s;
}
return (r || JSON.stringify)(e);
}
const oe = {
transitional: Be,
adapter: ["xhr", "http", "fetch"],
transformRequest: [
function(t, r) {
const s = r.getContentType() || "", n = s.indexOf("application/json") > -1, o = u.isObject(t);
if (o && u.isHTMLForm(t) && (t = new FormData(t)), u.isFormData(t))
return n ? JSON.stringify(Pt(t)) : t;
if (u.isArrayBuffer(t) || u.isBuffer(t) || u.isStream(t) || u.isFile(t) || u.isBlob(t) || u.isReadableStream(t))
return t;
if (u.isArrayBufferView(t))
return t.buffer;
if (u.isURLSearchParams(t))
return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
let i;
if (o) {
if (s.indexOf("application/x-www-form-urlencoded") > -1)
return Dr(t, this.formSerializer).toString();
if ((i = u.isFileList(t)) || s.indexOf("multipart/form-data") > -1) {
const l = this.env && this.env.FormData;
return me(
i ? { "files[]": t } : t,
l && new l(),
this.formSerializer
);
}
}
return o || n ? (r.setContentType("application/json", !1), Gr(t)) : t;
}
],
transformResponse: [
function(t) {
const r = this.transitional || oe.transitional, s = r && r.forcedJSONParsing, n = this.responseType === "json";
if (u.isResponse(t) || u.isReadableStream(t))
return t;
if (t && u.isString(t) && (s && !this.responseType || n)) {
const a = !(r && r.silentJSONParsing) && n;
try {
return JSON.parse(t, this.parseReviver);
} catch (i) {
if (a)
throw i.name === "SyntaxError" ? A.from(i, A.ERR_BAD_RESPONSE, this, null, this.response) : i;
}
}
return t;
}
],
/**
* A timeout in milliseconds to abort a request. If set to 0 (default) a
* timeout is not created.
*/
timeout: 0,
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: L.classes.FormData,
Blob: L.classes.Blob
},
validateStatus: function(t) {
return t >= 200 && t < 300;
},
headers: {
common: {
Accept: "application/json, text/plain, */*",
"Content-Type": void 0
}
}
};
u.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
oe.headers[e] = {};
});
const Mr = u.toObjectSet([
"age",
"authorization",
"content-length",
"content-type",
"etag",
"expires",
"from",
"host",
"if-modified-since",
"if-unmodified-since",
"last-modified",
"location",
"max-forwards",
"proxy-authorization",
"referer",
"retry-after",
"user-agent"
]), vr = (e) => {
const t = {};
let r, s, n;
return e && e.split(`
`).forEach(function(a) {
n = a.indexOf(":"), r = a.substring(0, n).trim().toLowerCase(), s = a.substring(n + 1).trim(), !(!r || t[r] && Mr[r]) && (r === "set-cookie" ? t[r] ? t[r].push(s) : t[r] = [s] : t[r] = t[r] ? t[r] + ", " + s : s);
}), t;
}, Je = /* @__PURE__ */ Symbol("internals"), jr = (e) => !/[\r\n]/.test(e);
function It(e, t) {
if (!(e === !1 || e == null)) {
if (u.isArray(e)) {
e.forEach((r) => It(r, t));
return;
}
if (!jr(String(e)))
throw new Error(`Invalid character in header content ["${t}"]`);
}
}
function te(e) {
return e && String(e).trim().toLowerCase();
}
function kr(e) {
let t = e.length;
for (; t > 0; ) {
const r = e.charCodeAt(t - 1);
if (r !== 10 && r !== 13)
break;
t -= 1;
}
return t === e.length ? e : e.slice(0, t);
}
function he(e) {
return e === !1 || e == null ? e : u.isArray(e) ? e.map(he) : kr(String(e));
}
function Fr(e) {
const t = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
let s;
for (; s = r.exec(e); )
t[s[1]] = s[2];
return t;
}
const qr = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
function be(e, t, r, s, n) {
if (u.isFunction(s))
return s.call(this, t, r);
if (n && (t = r), !!u.isString(t)) {
if (u.isString(s))
return t.indexOf(s) !== -1;
if (u.isRegExp(s))
return s.test(t);
}
}
function $r(e) {
return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, r, s) => r.toUpperCase() + s);
}
function zr(e, t) {
const r = u.toCamelCase(" " + t);
["get", "set", "has"].forEach((s) => {
Object.defineProperty(e, s + r, {
value: function(n, o, a) {
return this[s].call(this, t, n, o, a);
},
configurable: !0
});
});
}
let U = class {
constructor(t) {
t && this.set(t);
}
set(t, r, s) {
const n = this;
function o(i, l, c) {
const d = te(l);
if (!d)
throw new Error("header name must be a non-empty string");
const p = u.findKey(n, d);
(!p || n[p] === void 0 || c === !0 || c === void 0 && n[p] !== !1) && (It(i, l), n[p || l] = he(i));
}
const a = (i, l) => u.forEach(i, (c, d) => o(c, d, l));
if (u.isPlainObject(t) || t instanceof this.constructor)
a(t, r);
else if (u.isString(t) && (t = t.trim()) && !qr(t))
a(vr(t), r);
else if (u.isObject(t) && u.isIterable(t)) {
let i = {}, l, c;
for (const d of t) {
if (!u.isArray(d))
throw TypeError("Object iterator must return a key-value pair");
i[c = d[0]] = (l = i[c]) ? u.isArray(l) ? [...l, d[1]] : [l, d[1]] : d[1];
}
a(i, r);
} else
t != null && o(r, t, s);
return this;
}
get(t, r) {
if (t = te(t), t) {
const s = u.findKey(this, t);
if (s) {
const n = this[s];
if (!r)
return n;
if (r === !0)
return Fr(n);
if (u.isFunction(r))
return r.call(this, n, s);
if (u.isRegExp(r))
return r.exec(n);
throw new TypeError("parser must be boolean|regexp|function");
}
}
}
has(t, r) {
if (t = te(t), t) {
const s = u.findKey(this, t);
return !!(s && this[s] !== void 0 && (!r || be(this, this[s], s, r)));
}
return !1;
}
delete(t, r) {
const s = this;
let n = !1;
function o(a) {
if (a = te(a), a) {
const i = u.findKey(s, a);
i && (!r || be(s, s[i], i, r)) && (delete s[i], n = !0);
}
}
return u.isArray(t) ? t.forEach(o) : o(t), n;
}
clear(t) {
const r = Object.keys(this);
let s = r.length, n = !1;
for (; s--; ) {
const o = r[s];
(!t || be(this, this[o], o, t, !0)) && (delete this[o], n = !0);
}
return n;
}
normalize(t) {
const r = this, s = {};
return u.forEach(this, (n, o) => {
const a = u.findKey(s, o);
if (a) {
r[a] = he(n), delete r[o];
return;
}
const i = t ? $r(o) : String(o).trim();
i !== o && delete r[o], r[i] = he(n), s[i] = !0;
}), this;
}
concat(...t) {
return this.constructor.concat(this, ...t);
}
toJSON(t) {
const r = /* @__PURE__ */ Object.create(null);
return u.forEach(this, (s, n) => {
s != null && s !== !1 && (r[n] = t && u.isArray(s) ? s.join(", ") : s);
}), r;
}
[Symbol.iterator]() {
return Object.entries(this.toJSON())[Symbol.iterator]();
}
toString() {
return Object.entries(this.toJSON()).map(([t, r]) => t + ": " + r).join(`
`);
}
getSetCookie() {
return this.get("set-cookie") || [];
}
get [Symbol.toStringTag]() {
return "AxiosHeaders";
}
static from(t) {
return t instanceof this ? t : new this(t);
}
static concat(t, ...r) {
const s = new this(t);
return r.forEach((n) => s.set(n)), s;
}
static accessor(t) {
const s = (this[Je] = this[Je] = {
accessors: {}
}).accessors, n = this.prototype;
function o(a) {
const i = te(a);
s[i] || (zr(n, a), s[i] = !0);
}
return u.isArray(t) ? t.forEach(o) : o(t), this;
}
};
U.accessor([
"Content-Type",
"Content-Length",
"Accept",
"Accept-Encoding",
"User-Agent",
"Authorization"
]);
u.reduceDescriptors(U.prototype, ({ value: e }, t) => {
let r = t[0].toUpperCase() + t.slice(1);
return {
get: () => e,
set(s) {
this[r] = s;
}
};
});
u.freezeMethods(U);
function we(e, t) {
const r = this || oe, s = t || r, n = U.from(s.headers);
let o = s.data;
return u.forEach(e, function(i) {
o = i.call(r, o, n.normalize(), t ? t.status : void 0);
}), n.normalize(), o;
}
function St(e) {
return !!(e && e.__CANCEL__);
}
let ae = class extends A {
/**
* A `CanceledError` is an object that is thrown when an operation is canceled.
*
* @param {string=} message The message.
* @param {Object=} config The config.
* @param {Object=} request The request.
*
* @returns {CanceledError} The created error.
*/
constructor(t, r, s) {
super(t ?? "canceled", A.ERR_CANCELED, r, s), this.name = "CanceledError", this.__CANCEL__ = !0;
}
};
function bt(e, t, r) {
const s = r.config.validateStatus;
!r.status || !s || s(r.status) ? e(r) : t(
new A(
"Request failed with status code " + r.status,
[A.ERR_BAD_REQUEST, A.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
r.config,
r.request,
r
)
);
}
function Wr(e) {
const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
return t && t[1] || "";
}
function Yr(e, t) {
e = e || 10;
const r = new Array(e), s = new Array(e);
let n = 0, o = 0, a;
return t = t !== void 0 ? t : 1e3, function(l) {
const c = Date.now(), d = s[o];
a || (a = c), r[n] = l, s[n] = c;
let p = o, _ = 0;
for (; p !== n; )
_ += r[p++], p = p % e;
if (n = (n + 1) % e, n === o && (o = (o + 1) % e), c - a < t)
return;
const C = d && c - d;
return C ? Math.round(_ * 1e3 / C) : void 0;
};
}
function Xr(e, t) {
let r = 0, s = 1e3 / t, n, o;
const a = (c, d = Date.now()) => {
r = d, n = null, o && (clearTimeout(o), o = null), e(...c);
};
return [(...c) => {
const d = Date.now(), p = d - r;
p >= s ? a(c, d) : (n = c, o || (o = setTimeout(() => {
o = null, a(n);
}, s - p)));
}, () => n && a(n)];
}
const Ee = (e, t, r = 3) => {
let s = 0;
const n = Yr(50, 250);
return Xr((o) => {
const a = o.loaded, i = o.lengthComputable ? o.total : void 0, l = a - s, c = n(l), d = a <= i;
s = a;
const p = {
loaded: a,
total: i,
progress: i ? a / i : void 0,
bytes: l,
rate: c || void 0,
estimated: c && i && d ? (i - a) / c : void 0,
event: o,
lengthComputable: i != null,
[t ? "download" : "upload"]: !0
};
e(p);
}, r);
}, Ze = (e, t) => {
const r = e != null;
return [
(s) => t[0]({
lengthComputable: r,
total: e,
loaded: s
}),
t[1]
];
}, Ke = (e) => (...t) => u.asap(() => e(...t)), Jr = L.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (r) => (r = new URL(r, L.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(
new URL(L.origin),
L.navigator && /(msie|trident)/i.test(L.navigator.userAgent)
) : () => !0, Zr = L.hasStandardBrowserEnv ? (
// Standard browser envs support document.cookie
{
write(e, t, r, s, n, o, a) {
if (typeof document > "u") return;
const i = [`${e}=${encodeURIComponent(t)}`];
u.isNumber(r) && i.push(`expires=${new Date(r).toUTCString()}`), u.isString(s) && i.push(`path=${s}`), u.isString(n) && i.push(`domain=${n}`), o === !0 && i.push("secure"), u.isString(a) && i.push(`SameSite=${a}`), document.cookie = i.join("; ");
},
read(e) {
if (typeof document > "u") return null;
const t = document.cookie.match(new RegExp("(?:^|; )" + e + "=([^;]*)"));
return t ? decodeURIComponent(t[1]) : null;
},
remove(e) {
this.write(e, "", Date.now() - 864e5, "/");
}
}
) : (
// Non-standard browser env (web workers, react-native) lack needed support.
{
write() {
},
read() {
return null;
},
remove() {
}
}
);
function Kr(e) {
return typeof e != "string" ? !1 : /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
}
function Qr(e, t) {
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
}
function wt(e, t, r) {
let s = !Kr(t);
return e && (s || r == !1) ? Qr(e, t) : t;
}
const Qe = (e) => e instanceof U ? { ...e } : e;
function Y(e, t) {
t = t || {};
const r = {};
function s(c, d, p, _) {
return u.isPlainObject(c) && u.isPlainObject(d) ? u.merge.call({ caseless: _ }, c, d) : u.isPlainObject(d) ? u.merge({}, d) : u.isArray(d) ? d.slice() : d;
}
function n(c, d, p, _) {
if (u.isUndefined(d)) {
if (!u.isUndefined(c))
return s(void 0, c, p, _);
} else return s(c, d, p, _);
}
function o(c, d) {
if (!u.isUndefined(d))
return s(void 0, d);
}
function a(c, d) {
if (u.isUndefined(d)) {
if (!u.isUndefined(c))
return s(void 0, c);
} else return s(void 0, d);
}
function i(c, d, p) {
if (p in t)
return s(c, d);
if (p in e)
return s(void 0, c);
}
const l = {
url: o,
method: o,
data: o,
baseURL: a,
transformRequest: a,
transformResponse: a,
paramsSerializer: a,
timeout: a,
timeoutMessage: a,
withCredentials: a,
withXSRFToken: a,
adapter: a,
responseType: a,
xsrfCookieName: a,
xsrfHeaderName: a,
onUploadProgress: a,
onDownloadProgress: a,
decompress: a,
maxContentLength: a,
maxBodyLength: a,
beforeRedirect: a,
transport: a,
httpAgent: a,
httpsAgent: a,
cancelToken: a,
socketPath: a,
responseEncoding: a,
validateStatus: i,
headers: (c, d, p) => n(Qe(c), Qe(d), p, !0)
};
return u.forEach(Object.keys({ ...e, ...t }), function(d) {
if (d === "__proto__" || d === "constructor" || d === "prototype") return;
const p = u.hasOwnProp(l, d) ? l[d] : n, _ = p(e[d], t[d], d);
u.isUndefined(_) && p !== i || (r[d] = _);
}), r;
}
const yt = (e) => {
const t = Y({}, e);
let { data: r, withXSRFToken: s, xsrfHeaderName: n, xsrfCookieName: o, headers: a, auth: i } = t;
if (t.headers = a = U.from(a), t.url = Tt(
wt(t.baseURL, t.url, t.allowAbsoluteUrls),
e.params,
e.paramsSerializer
), i && a.set(
"Authorization",
"Basic " + btoa(
(i.username || "") + ":" + (i.password ? unescape(encodeURIComponent(i.password)) : "")
)
), u.isFormData(r)) {
if (L.hasStandardBrowserEnv || L.hasStandardBrowserWebWorkerEnv)
a.setContentType(void 0);
else if (u.isFunction(r.getHeaders)) {
const l = r.getHeaders(), c = ["content-type", "content-length"];
Object.entries(l).forEach(([d, p]) => {
c.includes(d.toLowerCase()) && a.set(d, p);
});
}
}
if (L.hasStandardBrowserEnv && (s && u.isFunction(s) && (s = s(t)), s || s !== !1 && Jr(t.url))) {
const l = n && o && Zr.read(o);
l && a.set(n, l);
}
return t;
}, es = typeof XMLHttpRequest < "u", ts = es && function(e) {
return new Promise(function(r, s) {
const n = yt(e);
let o = n.data;
const a = U.from(n.headers).normalize();
let { responseType: i, onUploadProgress: l, onDownloadProgress: c } = n, d, p, _, C, h;
function E() {
C && C(), h && h(), n.cancelToken && n.cancelToken.unsubscribe(d), n.signal && n.signal.removeEventListener("abort", d);
}
let f = new XMLHttpRequest();
f.open(n.method.toUpperCase(), n.url, !0), f.timeout = n.timeout;
function w() {
if (!f)
return;
const y = U.from(
"getAllResponseHeaders" in f && f.getAllResponseHeaders()
), H = {
data: !i || i === "text" || i === "json" ? f.responseText : f.response,
status: f.status,
statusText: f.statusText,
headers: y,
config: e,
request: f
};
bt(
function(D) {
r(D), E();
},
function(D) {
s(D), E();
},
H
), f = null;
}
"onloadend" in f ? f.onloadend = w : f.onreadystatechange = function() {
!f || f.readyState !== 4 || f.status === 0 && !(f.responseURL && f.responseURL.indexOf("file:") === 0) || setTimeout(w);
}, f.onabort = function() {
f && (s(new A("Request aborted", A.ECONNABORTED, e, f)), f = null);
}, f.onerror = function(g) {
const H = g && g.message ? g.message : "Network Error", F = new A(H, A.ERR_NETWORK, e, f);
F.event = g || null, s(F), f = null;
}, f.ontimeout = function() {
let g = n.timeout ? "timeout of " + n.timeout + "ms exceeded" : "timeout exceeded";
const H = n.transitional || Be;
n.timeoutErrorMessage && (g = n.timeoutErrorMessage), s(
new A(
g,
H.clarifyTimeoutError ? A.ETIMEDOUT : A.ECONNABORTED,
e,
f
)
), f = null;
}, o === void 0 && a.setContentType(null), "setRequestHeader" in f && u.forEach(a.toJSON(), function(g, H) {
f.setRequestHeader(H, g);
}), u.isUndefined(n.withCredentials) || (f.withCredentials = !!n.withCredentials), i && i !== "json" && (f.responseType = n.responseType), c && ([_, h] = Ee(c, !0), f.addEventListener("progress", _)), l && f.upload && ([p, C] = Ee(l), f.upload.addEventListener("progress", p), f.upload.addEventListener("loadend", C)), (n.cancelToken || n.signal) && (d = (y) => {
f && (s(!y || y.type ? new ae(null, e, f) : y), f.abort(), f = null);
}, n.cancelToken && n.cancelToken.subscribe(d), n.signal && (n.signal.aborted ? d() : n.signal.addEventListener("abort", d)));
const x = Wr(n.url);
if (x && L.protocols.indexOf(x) === -1) {
s(
new A(
"Unsupported protocol " + x + ":",
A.ERR_BAD_REQUEST,
e
)
);
return;
}
f.send(o || null);
});
}, rs = (e, t) => {
const { length: r } = e = e ? e.filter(Boolean) : [];
if (t || r) {
let s = new AbortController(), n;
const o = function(c) {
if (!n) {
n = !0, i();
const d = c instanceof Error ? c : this.reason;
s.abort(
d instanceof A ? d : new ae(d instanceof Error ? d.message : d)
);
}
};
let a = t && setTimeout(() => {
a = null, o(new A(`timeout of ${t}ms exceeded`, A.ETIMEDOUT));
}, t);
const i = () => {
e && (a && clearTimeout(a), a = null, e.forEach((c) => {
c.unsubscribe ? c.unsubscribe(o) : c.removeEventListener("abort", o);
}), e = null);
};
e.forEach((c) => c.addEventListener("abort", o));
const { signal: l } = s;
return l.unsubscribe = () => u.asap(i), l;
}
}, ss = function* (e, t) {
let r = e.byteLength;
if (r < t) {
yield e;
return;
}
let s = 0, n;
for (; s < r; )
n = s + t, yield e.slice(s, n), s = n;
}, ns = async function* (e, t) {
for await (const r of os(e))
yield* ss(r, t);
}, os = async function* (e) {
if (e[Symbol.asyncIterator]) {
yield* e;
return;
}
const t = e.getReader();
try {
for (; ; ) {
const { done: r, value: s } = await t.read();
if (r)
break;
yield s;
}
} finally {
await t.cancel();
}
}, et = (e, t, r, s) => {
const n = ns(e, t);
let o = 0, a, i = (l) => {
a || (a = !0, s && s(l));
};
return new ReadableStream(
{
async pull(l) {
try {
const { done: c, value: d } = await n.next();
if (c) {
i(), l.close();
return;
}
let p = d.byteLength;
if (r) {
let _ = o += p;
r(_);
}
l.enqueue(new Uint8Array(d));
} catch (c) {
throw i(c), c;
}
},
cancel(l) {
return i(l), n.return();
}
},
{
highWaterMark: 2
}
);
}, tt = 64 * 1024, { isFunction: de } = u, as = (({ Request: e, Response: t }) => ({
Request: e,
Response: t
}))(u.global), { ReadableStream: rt, TextEncoder: st } = u.global, nt = (e, ...t) => {
try {
return !!e(...t);
} catch {
return !1;
}
}, is = (e) => {
e = u.merge.call(
{
skipUndefined: !0
},
as,
e
);
const { fetch: t, Request: r, Response: s } = e, n = t ? de(t) : typeof fetch == "function", o = de(r), a = de(s);
if (!n)
return !1;
const i = n && de(rt), l = n && (typeof st == "function" ? /* @__PURE__ */ ((h) => (E) => h.encode(E))(new st()) : async (h) => new Uint8Array(await new r(h).arrayBuffer())), c = o && i && nt(() => {
let h = !1;
const E = new rt(), f = new r(L.origin, {
body: E,
method: "POST",
get duplex() {
return h = !0, "half";
}
}).headers.has("Content-Type");
return E.cancel(), h && !f;
}), d = a && i && nt(() => u.isReadableStream(new s("").body)), p = {
stream: d && ((h) => h.body)
};
n && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((h) => {
!p[h] && (p[h] = (E, f) => {
let w = E && E[h];
if (w)
return w.call(E);
throw new A(
`Response type '${h}' is not supported`,
A.ERR_NOT_SUPPORT,
f
);
});
});
const _ = async (h) => {
if (h == null)
return 0;
if (u.isBlob(h))
return h.size;
if (u.isSpecCompliantForm(h))
return (await new r(L.origin, {
method: "POST",
body: h
}).arrayBuffer()).byteLength;
if (u.isArrayBufferView(h) || u.isArrayBuffer(h))
return h.byteLength;
if (u.isURLSearchParams(h) && (h = h + ""), u.isString(h))
return (await l(h)).byteLength;
}, C = async (h, E) => {
const f = u.toFiniteNumber(h.getContentLength());
return f ?? _(E);
};
return async (h) => {
let {
url: E,
method: f,
data: w,
signal: x,
cancelToken: y,
timeout: g,
onDownloadProgress: H,
onUploadProgress: F,
responseType: D,
headers: Pe,
withCredentials: ie = "same-origin",
fetchOptions: Me
} = yt(h), ve = t || fetch;
D = D ? (D + "").toLowerCase() : "text";
let le = rs(
[x, y && y.toAbortSignal()],
g
), ee = null;
const q = le && le.unsubscribe && (() => {
le.unsubscribe();
});
let je;
try {
if (F && c && f !== "get" && f !== "head" && (je = await C(Pe, w)) !== 0) {
let k = new r(E, {
method: "POST",
body: w,
duplex: "half"
}), X;
if (u.isFormData(w) && (X = k.headers.get("content-type")) && Pe.setContentType(X), k.body) {
const [Ie, ce] = Ze(
je,
Ee(Ke(F))
);
w = et(k.body, tt, Ie, ce);
}
}
u.isString(ie) || (ie = ie ? "include" : "omit");
const V = o && "credentials" in r.prototype, ke = {
...Me,
signal: le,
method: f.toUpperCase(),
headers: Pe.normalize().toJSON(),
body: w,
duplex: "half",
credentials: V ? ie : void 0
};
ee = o && new r(E, ke);
let j = await (o ? ve(ee, Me) : ve(E, ke));
const Fe = d && (D === "stream" || D === "response");
if (d && (H || Fe && q)) {
const k = {};
["status", "statusText", "headers"].forEach((qe) => {
k[qe] = j[qe];
});
const X = u.toFiniteNumber(j.headers.get("content-length")), [Ie, ce] = H && Ze(
X,
Ee(Ke(H), !0)
) || [];
j = new s(
et(j.body, tt, Ie, () => {
ce && ce(), q && q();
}),
k
);
}
D = D || "text";
let xt = await p[u.findKey(p, D) || "text"](
j,
h
);
return !Fe && q && q(), await new Promise((k, X) => {
bt(k, X, {
data: xt,
headers: U.from(j.headers),
status: j.status,
statusText: j.statusText,
config: h,
request: ee
});
});
} catch (V) {
throw q && q(), V && V.name === "TypeError" && /Load failed|fetch/i.test(V.message) ? Object.assign(
new A(
"Network Error",
A.ERR_NETWORK,
h,
ee,
V && V.response
),
{
cause: V.cause || V
}
) : A.from(V, V && V.code, h, ee, V && V.response);
}
};
}, ls = /* @__PURE__ */ new Map(), Ct = (e) => {
let t = e && e.env || {};
const { fetch: r, Request: s, Response: n } = t, o = [s, n, r];
let a = o.length, i = a, l, c, d = ls;
for (; i--; )
l = o[i], c = d.get(l), c === void 0 && d.set(l, c = i ? /* @__PURE__ */ new Map() : is(t)), d = c;
return c;
};
Ct();
const Ge = {
http: Ir,
xhr: ts,
fetch: {
get: Ct
}
};
u.forEach(Ge, (e, t) => {
if (e) {
try {
Object.defineProperty(e, "name", { value: t });
} catch {
}
Object.defineProperty(e, "adapterName", { value: t });
}
});
const ot = (e) => `- ${e}`, cs = (e) => u.isFunction(e) || e === null || e === !1;
function ds(e, t) {
e = u.isArray(e) ? e : [e];
const { length: r } = e;
let s, n;
const o = {};
for (let a = 0; a < r; a++) {
s = e[a];
let i;
if (n = s, !cs(s) && (n = Ge[(i = String(s)).toLowerCase()], n === void 0))
throw new A(`Unknown adapter '${i}'`);
if (n && (u.isFunction(n) || (n = n.get(t))))
break;
o[i || "#" + a] = n;
}
if (!n) {
const a = Object.entries(o).map(
([l, c]) => `adapter ${l} ` + (c === !1 ? "is not supported by the environment" : "is not available in the build")
);
let i = r ? a.length > 1 ? `since :
` + a.map(ot).join(`
`) : " " + ot(a[0]) : "as no adapter specified";
throw new A(
"There is no suitable adapter to dispatch the request " + i,
"ERR_NOT_SUPPORT"
);
}
return n;
}
const Lt = {
/**
* Resolve an adapter from a list of adapter names or functions.
* @type {Function}
*/
getAdapter: ds,
/**
* Exposes all known adapters
* @type {Object<string, Function|Object>}
*/
adapters: Ge
};
function ye(e) {
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
throw new ae(null, e);
}
function at(e) {
return ye(e), e.headers = U.from(e.headers), e.data = we.call(e, e.transformRequest), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Lt.getAdapter(e.adapter || oe.adapter, e)(e).then(
function(s) {
return ye(e), s.data = we.call(e, e.transformResponse, s), s.headers = U.from(s.headers), s;
},
function(s) {
return St(s) || (ye(e), s && s.response && (s.response.data = we.call(
e,
e.transformResponse,
s.response
), s.response.headers = U.from(s.response.headers))), Promise.reject(s);
}
);
}
const gt = "1.15.0", Te = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
Te[e] = function(s) {
return typeof s === e || "a" + (t < 1 ? "n " : " ") + e;
};
});
const it = {};
Te.transitional = function(t, r, s) {
function n(o, a) {
return "[Axios v" + gt + "] Transitional option '" + o + "'" + a + (s ? ". " + s : "");
}
return (o, a, i) => {
if (t === !1)
throw new A(
n(a, " has been removed" + (r ? " in " + r : "")),
A.ERR_DEPRECATED
);
return r && !it[a] && (it[a] = !0, console.warn(
n(
a,
" has been deprecated since v" + r + " and will be removed in the near future"
)
)), t ? t(o, a, i) : !0;
};
};
Te.spelling = function(t) {
return (r, s) => (console.warn(`${s} is likely a misspelling of ${t}`), !0);
};
function us(e, t, r) {
if (typeof e != "object")
throw new A("options must be an object", A.ERR_BAD_OPTION_VALUE);
const s = Object.keys(e);
let n = s.length;
for (; n-- > 0; ) {
const o = s[n], a = t[o];
if (a) {
const i = e[o], l = i === void 0 || a(i, o, e);
if (l !== !0)
throw new A(
"option " + o + " must be " + l,
A.ERR_BAD_OPTION_VALUE
);
continue;
}
if (r !== !0)
throw new A("Unknown option " + o, A.ERR_BAD_OPTION);
}
}
const fe = {
assertOptions: us,
validators: Te
}, B = fe.validators;
let W = class {
constructor(t) {
this.defaults = t || {}, this.interceptors = {
request: new Xe(),
response: new Xe()
};
}
/**
* Dispatch a request
*
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
* @param {?Object} config
*
* @returns {Promise} The Promise to be fulfilled
*/
async request(t, r) {
try {
return await this._request(t, r);
} catch (s) {
if (s instanceof Error) {
let n = {};
Error.captureStackTrace ? Error.captureStackTrace(n) : n = new Error();
const o = (() => {
if (!n.stack)
return "";
const a = n.stack.indexOf(`
`);
return a === -1 ? "" : n.stack.slice(a + 1);
})();
try {
if (!s.stack)
s.stack = o;
else if (o) {
const a = o.indexOf(`
`), i = a === -1 ? -1 : o.indexOf(`
`, a + 1), l = i === -1 ? "" : o.slice(i + 1);
String(s.stack).endsWith(l) || (s.stack += `
` + o);
}
} catch {
}
}
throw s;
}
}
_request(t, r) {
typeof t == "string" ? (r = r || {}, r.url = t) : r = t || {}, r = Y(this.defaults, r);
const { transitional: s, paramsSerializer: n, headers: o } = r;
s !== void 0 && fe.assertOptions(
s,
{
silentJSONParsing: B.transitional(B.boolean),
forcedJSONParsing: B.transitional(B.boolean),
clarifyTimeoutError: B.transitional(B.boolean),
legacyInterceptorReqResOrdering: B.transitional(B.boolean)
},
!1
), n != null && (u.isFunction(n) ? r.paramsSerializer = {
serialize: n
} : fe.assertOptions(
n,
{
encode: B.function,
serialize: B.function
},
!0
)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), fe.assertOptions(
r,
{
baseUrl: B.spelling("baseURL"),
withXsrfToken: B.spelling("withXSRFToken")
},
!0
), r.method = (r.method || this.defaults.method || "get").toLowerCase();
let a = o && u.merge(o.common, o[r.method]);
o && u.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (h) => {
delete o[h];
}), r.headers = U.concat(a, o);
const i = [];
let l = !0;
this.interceptors.request.forEach(function(E) {
if (typeof E.runWhen == "function" && E.runWhen(r) === !1)
return;
l = l && E.synchronous;
const f = r.transitional || Be;
f && f.legacyInterceptorReqResOrdering ? i.unshift(E.fulfilled, E.rejected) : i.push(E.fulfilled, E.rejected);
});
const c = [];
this.interceptors.response.forEach(function(E) {
c.push(E.fulfilled, E.rejected);
});
let d, p = 0, _;
if (!l) {
const h = [at.bind(this), void 0];
for (h.unshift(...i), h.push(...c), _ = h.length, d = Promise.resolve(r); p < _; )
d = d.then(h[p++], h[p++]);
return d;
}
_ = i.length;
let C = r;
for (; p < _; ) {
const h = i[p++], E = i[p++];
try {
C = h(C);
} catch (f) {
E.call(this, f);
break;
}
}
try {
d = at.call(this, C);
} catch (h) {
return Promise.reject(h);
}
for (p = 0, _ = c.length; p < _; )
d = d.then(c[p++], c[p++]);
return d;
}
getUri(t) {
t = Y(this.defaults, t);
const r = wt(t.baseURL, t.url, t.allowAbsoluteUrls);
return Tt(r, t.params, t.paramsSerializer);
}
};
u.forEach(["delete", "get", "head", "options"], function(t) {
W.prototype[t] = function(r, s) {
return this.request(
Y(s || {}, {
method: t,
url: r,
data: (s || {}).data
})
);
};